From 82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Apr 2017 03:09:25 +0200 Subject: Reorganize module loading. We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node. --- .gitignore | 2 + decl/jed.d.ts | 18 + decl/jquery/jquery.d.ts | 3190 -- decl/lib.es6.d.ts | 20674 -------- decl/node.d.ts | 2178 - decl/react-dom.d.ts | 75 - decl/react-global.d.ts | 11 - decl/react.d.ts | 2547 - decl/systemjs/systemjs.d.ts | 20 - decl/urijs.d.ts | 227 + decl/urijs/URIjs.d.ts | 236 - gulpfile.js | 48 +- manifest.json | 5 +- node_modules/.yarn-integrity | 2 +- node_modules/ansi-regex/index.js | 2 +- node_modules/ansi-regex/license | 21 - node_modules/ansi-regex/package.json | 11 +- node_modules/ansi-regex/readme.md | 4 +- node_modules/archiver/CHANGELOG.md | 6 + node_modules/archiver/README.md | 50 +- node_modules/archiver/lib/core.js | 111 +- node_modules/archiver/package.json | 7 +- node_modules/arr-flatten/LICENSE | 2 +- node_modules/arr-flatten/README.md | 100 +- node_modules/arr-flatten/index.js | 20 +- node_modules/arr-flatten/package.json | 67 +- node_modules/async/CHANGELOG.md | 20 + node_modules/async/LICENSE | 2 +- node_modules/async/README.md | 2 + node_modules/async/dist/async.js | 1583 +- node_modules/async/dist/async.min.js | 2 +- node_modules/async/package.json | 7 +- node_modules/babel-code-frame/README.md | 3 +- node_modules/babel-code-frame/lib/index.js | 54 +- node_modules/babel-code-frame/package.json | 4 +- node_modules/babel-generator/README.md | 4 +- node_modules/babel-generator/lib/buffer.js | 47 +- .../babel-generator/lib/generators/base.js | 7 +- .../babel-generator/lib/generators/expressions.js | 15 +- .../babel-generator/lib/generators/flow.js | 10 +- node_modules/babel-generator/lib/generators/jsx.js | 8 + .../babel-generator/lib/generators/modules.js | 11 +- .../babel-generator/lib/generators/statements.js | 3 +- .../lib/generators/template-literals.js | 2 - .../babel-generator/lib/generators/types.js | 20 +- node_modules/babel-generator/lib/index.js | 22 +- .../babel-generator/lib/node/parentheses.js | 119 +- .../babel-generator/lib/node/whitespace.js | 25 +- node_modules/babel-generator/lib/printer.js | 2 - node_modules/babel-generator/lib/source-map.js | 48 +- node_modules/babel-generator/package.json | 13 +- node_modules/babel-messages/README.md | 2 +- node_modules/babel-messages/lib/index.js | 33 +- node_modules/babel-messages/package.json | 4 +- .../babel-runtime/helpers/asyncGenerator.js | 8 +- .../babel-runtime/helpers/asyncIterator.js | 8 +- node_modules/babel-runtime/package.json | 8 +- node_modules/babel-template/README.md | 14 +- node_modules/babel-template/lib/index.js | 4 +- node_modules/babel-template/package.json | 8 +- node_modules/babel-traverse/lib/cache.js | 10 + node_modules/babel-traverse/lib/index.js | 3 + node_modules/babel-traverse/lib/path/ancestry.js | 12 + node_modules/babel-traverse/lib/path/comments.js | 2 + node_modules/babel-traverse/lib/path/evaluation.js | 10 +- node_modules/babel-traverse/lib/path/family.js | 101 + node_modules/babel-traverse/lib/path/index.js | 12 +- .../lib/path/inference/inferer-reference.js | 12 +- .../babel-traverse/lib/path/introspection.js | 26 +- .../babel-traverse/lib/path/lib/hoister.js | 91 +- .../babel-traverse/lib/path/lib/removal-hooks.js | 21 +- .../babel-traverse/lib/path/lib/virtual-types.js | 20 +- .../babel-traverse/lib/path/modification.js | 4 +- .../babel-traverse/lib/path/replacement.js | 14 +- node_modules/babel-traverse/lib/scope/binding.js | 10 +- node_modules/babel-traverse/lib/scope/index.js | 177 +- .../babel-traverse/lib/scope/lib/renamer.js | 10 +- node_modules/babel-traverse/package.json | 15 +- node_modules/babel-types/README.md | 1009 +- node_modules/babel-types/lib/converters.js | 12 +- node_modules/babel-types/lib/definitions/es2015.js | 3 + .../babel-types/lib/definitions/experimental.js | 4 + node_modules/babel-types/lib/definitions/jsx.js | 12 +- node_modules/babel-types/lib/index.js | 32 +- node_modules/babel-types/lib/retrievers.js | 4 +- node_modules/babel-types/lib/validators.js | 64 + node_modules/babel-types/package.json | 7 +- node_modules/babylon/CHANGELOG.md | 327 +- node_modules/babylon/README.md | 16 +- .../babylon/bin/generate-identifier-regex.js | 2 +- node_modules/babylon/lib/index.js | 1625 +- node_modules/babylon/package.json | 51 +- node_modules/bl/.travis.yml | 4 +- node_modules/bl/LICENSE.md | 2 +- node_modules/bl/README.md | 10 +- node_modules/bl/bl.js | 55 +- node_modules/bl/package.json | 6 +- node_modules/bl/test/test.js | 59 + node_modules/brace-expansion/README.md | 1 + node_modules/brace-expansion/index.js | 2 +- node_modules/brace-expansion/package.json | 6 +- node_modules/buffer-crc32/.npmignore | 1 - node_modules/buffer-crc32/.travis.yml | 8 - node_modules/buffer-crc32/index.js | 30 +- node_modules/buffer-crc32/package.json | 9 +- node_modules/buffer-crc32/tests/crc.test.js | 89 - node_modules/camelcase/index.js | 37 +- node_modules/camelcase/package.json | 7 +- node_modules/camelcase/readme.md | 27 +- node_modules/clone-stats/package.json | 2 +- node_modules/cloneable-readable/package.json | 2 +- node_modules/compress-commons/README.md | 2 +- .../lib/archivers/zip/constants.js | 2 +- .../lib/archivers/zip/zip-archive-entry.js | 186 +- .../lib/archivers/zip/zip-archive-output-stream.js | 3 +- node_modules/compress-commons/package.json | 6 +- node_modules/concat-stream/package.json | 10 +- node_modules/concat-stream/readme.md | 2 +- node_modules/convert-source-map/.travis.yml | 8 +- node_modules/convert-source-map/README.md | 20 +- .../convert-source-map/example/comment-to-json.js | 6 +- node_modules/convert-source-map/index.js | 67 +- node_modules/convert-source-map/package.json | 8 +- .../convert-source-map/test/comment-regex.js | 9 +- .../convert-source-map/test/convert-source-map.js | 52 +- node_modules/core-js/CHANGELOG.md | 188 +- node_modules/core-js/LICENSE | 2 +- node_modules/core-js/bower.json | 19 +- node_modules/core-js/build/Gruntfile.ls | 24 +- node_modules/core-js/build/build.ls | 226 +- node_modules/core-js/build/config.js | 251 - node_modules/core-js/build/index.js | 152 +- node_modules/core-js/client/core.js | 7445 +-- node_modules/core-js/client/core.min.js | 7 +- node_modules/core-js/client/core.min.js.map | 2 +- node_modules/core-js/client/library.js | 7044 +-- node_modules/core-js/client/library.min.js | 7 +- node_modules/core-js/client/library.min.js.map | 2 +- node_modules/core-js/client/shim.js | 7309 +-- node_modules/core-js/client/shim.min.js | 7 +- node_modules/core-js/client/shim.min.js.map | 2 +- node_modules/core-js/core/_.js | 2 +- node_modules/core-js/core/delay.js | 2 +- node_modules/core-js/core/dict.js | 2 +- node_modules/core-js/core/function.js | 2 +- node_modules/core-js/core/index.js | 4 +- node_modules/core-js/core/number.js | 2 +- node_modules/core-js/core/object.js | 2 +- node_modules/core-js/core/regexp.js | 2 - node_modules/core-js/core/string.js | 2 +- node_modules/core-js/es5/index.js | 32 +- node_modules/core-js/es6/array.js | 19 +- node_modules/core-js/es6/date.js | 6 - node_modules/core-js/es6/function.js | 3 +- node_modules/core-js/es6/index.js | 73 +- node_modules/core-js/es6/map.js | 2 +- node_modules/core-js/es6/math.js | 2 +- node_modules/core-js/es6/number.js | 4 +- node_modules/core-js/es6/object.js | 21 +- node_modules/core-js/es6/parse-float.js | 2 - node_modules/core-js/es6/parse-int.js | 2 - node_modules/core-js/es6/promise.js | 2 +- node_modules/core-js/es6/reflect.js | 2 +- node_modules/core-js/es6/regexp.js | 3 +- node_modules/core-js/es6/set.js | 2 +- node_modules/core-js/es6/string.js | 15 +- node_modules/core-js/es6/symbol.js | 2 +- node_modules/core-js/es6/typed.js | 13 - node_modules/core-js/es6/weak-map.js | 2 +- node_modules/core-js/es6/weak-set.js | 2 +- node_modules/core-js/es7/array.js | 2 +- node_modules/core-js/es7/asap.js | 2 - node_modules/core-js/es7/error.js | 2 - node_modules/core-js/es7/index.js | 31 +- node_modules/core-js/es7/map.js | 2 +- node_modules/core-js/es7/math.js | 5 - node_modules/core-js/es7/object.js | 6 +- node_modules/core-js/es7/observable.js | 7 - node_modules/core-js/es7/reflect.js | 10 - node_modules/core-js/es7/set.js | 2 +- node_modules/core-js/es7/string.js | 7 +- node_modules/core-js/es7/symbol.js | 3 - node_modules/core-js/es7/system.js | 2 - node_modules/core-js/fn/_.js | 2 +- node_modules/core-js/fn/array/concat.js | 6 +- node_modules/core-js/fn/array/copy-within.js | 2 +- node_modules/core-js/fn/array/entries.js | 2 +- node_modules/core-js/fn/array/every.js | 4 +- node_modules/core-js/fn/array/fill.js | 2 +- node_modules/core-js/fn/array/filter.js | 4 +- node_modules/core-js/fn/array/find-index.js | 2 +- node_modules/core-js/fn/array/find.js | 2 +- node_modules/core-js/fn/array/for-each.js | 4 +- node_modules/core-js/fn/array/from.js | 2 +- node_modules/core-js/fn/array/includes.js | 2 +- node_modules/core-js/fn/array/index-of.js | 4 +- node_modules/core-js/fn/array/index.js | 20 +- node_modules/core-js/fn/array/is-array.js | 2 - node_modules/core-js/fn/array/iterator.js | 2 +- node_modules/core-js/fn/array/join.js | 4 +- node_modules/core-js/fn/array/keys.js | 2 +- node_modules/core-js/fn/array/last-index-of.js | 4 +- node_modules/core-js/fn/array/map.js | 4 +- node_modules/core-js/fn/array/of.js | 2 +- node_modules/core-js/fn/array/pop.js | 6 +- node_modules/core-js/fn/array/push.js | 6 +- node_modules/core-js/fn/array/reduce-right.js | 4 +- node_modules/core-js/fn/array/reduce.js | 4 +- node_modules/core-js/fn/array/reverse.js | 6 +- node_modules/core-js/fn/array/shift.js | 6 +- node_modules/core-js/fn/array/slice.js | 4 +- node_modules/core-js/fn/array/some.js | 4 +- node_modules/core-js/fn/array/sort.js | 4 +- node_modules/core-js/fn/array/splice.js | 6 +- node_modules/core-js/fn/array/unshift.js | 6 +- node_modules/core-js/fn/array/values.js | 2 +- .../core-js/fn/array/virtual/copy-within.js | 2 - node_modules/core-js/fn/array/virtual/entries.js | 2 - node_modules/core-js/fn/array/virtual/every.js | 2 - node_modules/core-js/fn/array/virtual/fill.js | 2 - node_modules/core-js/fn/array/virtual/filter.js | 2 - .../core-js/fn/array/virtual/find-index.js | 2 - node_modules/core-js/fn/array/virtual/find.js | 2 - node_modules/core-js/fn/array/virtual/for-each.js | 2 - node_modules/core-js/fn/array/virtual/includes.js | 2 - node_modules/core-js/fn/array/virtual/index-of.js | 2 - node_modules/core-js/fn/array/virtual/index.js | 20 - node_modules/core-js/fn/array/virtual/iterator.js | 2 - node_modules/core-js/fn/array/virtual/join.js | 2 - node_modules/core-js/fn/array/virtual/keys.js | 2 - .../core-js/fn/array/virtual/last-index-of.js | 2 - node_modules/core-js/fn/array/virtual/map.js | 2 - .../core-js/fn/array/virtual/reduce-right.js | 2 - node_modules/core-js/fn/array/virtual/reduce.js | 2 - node_modules/core-js/fn/array/virtual/slice.js | 2 - node_modules/core-js/fn/array/virtual/some.js | 2 - node_modules/core-js/fn/array/virtual/sort.js | 2 - node_modules/core-js/fn/array/virtual/values.js | 2 - node_modules/core-js/fn/asap.js | 2 - node_modules/core-js/fn/clear-immediate.js | 2 +- node_modules/core-js/fn/date/index.js | 6 - node_modules/core-js/fn/date/now.js | 2 - node_modules/core-js/fn/date/to-iso-string.js | 3 - node_modules/core-js/fn/date/to-json.js | 2 - node_modules/core-js/fn/date/to-primitive.js | 5 - node_modules/core-js/fn/date/to-string.js | 5 - node_modules/core-js/fn/delay.js | 2 +- node_modules/core-js/fn/dict.js | 2 +- node_modules/core-js/fn/dom-collections/index.js | 8 - .../core-js/fn/dom-collections/iterator.js | 2 - node_modules/core-js/fn/error/index.js | 2 - node_modules/core-js/fn/error/is-error.js | 2 - node_modules/core-js/fn/function/bind.js | 2 - node_modules/core-js/fn/function/has-instance.js | 2 +- node_modules/core-js/fn/function/index.js | 3 +- node_modules/core-js/fn/function/part.js | 2 +- node_modules/core-js/fn/function/virtual/bind.js | 2 - node_modules/core-js/fn/function/virtual/index.js | 3 - node_modules/core-js/fn/function/virtual/part.js | 2 - node_modules/core-js/fn/json/index.js | 2 - node_modules/core-js/fn/json/stringify.js | 5 +- node_modules/core-js/fn/map.js | 2 +- node_modules/core-js/fn/math/acosh.js | 2 +- node_modules/core-js/fn/math/asinh.js | 2 +- node_modules/core-js/fn/math/atanh.js | 2 +- node_modules/core-js/fn/math/cbrt.js | 2 +- node_modules/core-js/fn/math/clz32.js | 2 +- node_modules/core-js/fn/math/cosh.js | 2 +- node_modules/core-js/fn/math/expm1.js | 2 +- node_modules/core-js/fn/math/fround.js | 2 +- node_modules/core-js/fn/math/hypot.js | 2 +- node_modules/core-js/fn/math/iaddh.js | 2 - node_modules/core-js/fn/math/imul.js | 2 +- node_modules/core-js/fn/math/imulh.js | 2 - node_modules/core-js/fn/math/index.js | 6 +- node_modules/core-js/fn/math/isubh.js | 2 - node_modules/core-js/fn/math/log10.js | 2 +- node_modules/core-js/fn/math/log1p.js | 2 +- node_modules/core-js/fn/math/log2.js | 2 +- node_modules/core-js/fn/math/sign.js | 2 +- node_modules/core-js/fn/math/sinh.js | 2 +- node_modules/core-js/fn/math/tanh.js | 2 +- node_modules/core-js/fn/math/trunc.js | 2 +- node_modules/core-js/fn/math/umulh.js | 2 - node_modules/core-js/fn/number/constructor.js | 2 - node_modules/core-js/fn/number/index.js | 4 +- node_modules/core-js/fn/number/is-finite.js | 2 +- node_modules/core-js/fn/number/is-integer.js | 2 +- node_modules/core-js/fn/number/is-nan.js | 2 +- node_modules/core-js/fn/number/is-safe-integer.js | 2 +- node_modules/core-js/fn/number/iterator.js | 2 +- node_modules/core-js/fn/number/to-fixed.js | 2 - node_modules/core-js/fn/number/to-precision.js | 2 - node_modules/core-js/fn/number/virtual/index.js | 4 - node_modules/core-js/fn/number/virtual/iterator.js | 2 - node_modules/core-js/fn/number/virtual/to-fixed.js | 2 - .../core-js/fn/number/virtual/to-precision.js | 2 - node_modules/core-js/fn/object/assign.js | 2 +- node_modules/core-js/fn/object/classof.js | 2 +- node_modules/core-js/fn/object/create.js | 5 +- node_modules/core-js/fn/object/define-getter.js | 2 - .../core-js/fn/object/define-properties.js | 5 +- node_modules/core-js/fn/object/define-property.js | 5 +- node_modules/core-js/fn/object/define-setter.js | 2 - node_modules/core-js/fn/object/define.js | 2 +- node_modules/core-js/fn/object/entries.js | 2 +- node_modules/core-js/fn/object/freeze.js | 2 +- .../fn/object/get-own-property-descriptor.js | 4 +- .../fn/object/get-own-property-descriptors.js | 2 +- .../core-js/fn/object/get-own-property-names.js | 4 +- .../core-js/fn/object/get-own-property-symbols.js | 2 +- node_modules/core-js/fn/object/get-prototype-of.js | 2 +- node_modules/core-js/fn/object/index.js | 25 +- node_modules/core-js/fn/object/is-extensible.js | 2 +- node_modules/core-js/fn/object/is-frozen.js | 2 +- node_modules/core-js/fn/object/is-object.js | 2 +- node_modules/core-js/fn/object/is-sealed.js | 2 +- node_modules/core-js/fn/object/is.js | 2 +- node_modules/core-js/fn/object/keys.js | 2 +- node_modules/core-js/fn/object/lookup-getter.js | 2 - node_modules/core-js/fn/object/lookup-setter.js | 2 - node_modules/core-js/fn/object/make.js | 2 +- .../core-js/fn/object/prevent-extensions.js | 2 +- node_modules/core-js/fn/object/seal.js | 2 +- node_modules/core-js/fn/object/set-prototype-of.js | 2 +- node_modules/core-js/fn/object/values.js | 2 +- node_modules/core-js/fn/observable.js | 7 - node_modules/core-js/fn/parse-float.js | 2 - node_modules/core-js/fn/parse-int.js | 2 - node_modules/core-js/fn/promise.js | 2 +- node_modules/core-js/fn/reflect/apply.js | 2 +- node_modules/core-js/fn/reflect/construct.js | 2 +- node_modules/core-js/fn/reflect/define-metadata.js | 2 - node_modules/core-js/fn/reflect/define-property.js | 2 +- node_modules/core-js/fn/reflect/delete-metadata.js | 2 - node_modules/core-js/fn/reflect/delete-property.js | 2 +- node_modules/core-js/fn/reflect/enumerate.js | 2 +- .../core-js/fn/reflect/get-metadata-keys.js | 2 - node_modules/core-js/fn/reflect/get-metadata.js | 2 - .../core-js/fn/reflect/get-own-metadata-keys.js | 2 - .../core-js/fn/reflect/get-own-metadata.js | 2 - .../fn/reflect/get-own-property-descriptor.js | 2 +- .../core-js/fn/reflect/get-prototype-of.js | 2 +- node_modules/core-js/fn/reflect/get.js | 2 +- node_modules/core-js/fn/reflect/has-metadata.js | 2 - .../core-js/fn/reflect/has-own-metadata.js | 2 - node_modules/core-js/fn/reflect/has.js | 2 +- node_modules/core-js/fn/reflect/index.js | 11 +- node_modules/core-js/fn/reflect/is-extensible.js | 2 +- node_modules/core-js/fn/reflect/metadata.js | 2 - node_modules/core-js/fn/reflect/own-keys.js | 2 +- .../core-js/fn/reflect/prevent-extensions.js | 2 +- .../core-js/fn/reflect/set-prototype-of.js | 2 +- node_modules/core-js/fn/reflect/set.js | 2 +- node_modules/core-js/fn/regexp/constructor.js | 2 - node_modules/core-js/fn/regexp/escape.js | 4 +- node_modules/core-js/fn/regexp/flags.js | 5 - node_modules/core-js/fn/regexp/index.js | 5 +- node_modules/core-js/fn/regexp/match.js | 5 - node_modules/core-js/fn/regexp/replace.js | 5 - node_modules/core-js/fn/regexp/search.js | 5 - node_modules/core-js/fn/regexp/split.js | 5 - node_modules/core-js/fn/regexp/to-string.js | 5 - node_modules/core-js/fn/set-immediate.js | 2 +- node_modules/core-js/fn/set-interval.js | 2 +- node_modules/core-js/fn/set-timeout.js | 2 +- node_modules/core-js/fn/set.js | 2 +- node_modules/core-js/fn/string/anchor.js | 2 - node_modules/core-js/fn/string/at.js | 2 +- node_modules/core-js/fn/string/big.js | 2 - node_modules/core-js/fn/string/blink.js | 2 - node_modules/core-js/fn/string/bold.js | 2 - node_modules/core-js/fn/string/code-point-at.js | 2 +- node_modules/core-js/fn/string/ends-with.js | 2 +- node_modules/core-js/fn/string/escape-html.js | 2 +- node_modules/core-js/fn/string/fixed.js | 2 - node_modules/core-js/fn/string/fontcolor.js | 2 - node_modules/core-js/fn/string/fontsize.js | 2 - node_modules/core-js/fn/string/from-code-point.js | 2 +- node_modules/core-js/fn/string/includes.js | 2 +- node_modules/core-js/fn/string/index.js | 20 +- node_modules/core-js/fn/string/italics.js | 2 - node_modules/core-js/fn/string/iterator.js | 2 +- node_modules/core-js/fn/string/link.js | 2 - node_modules/core-js/fn/string/match-all.js | 2 - node_modules/core-js/fn/string/pad-end.js | 2 - node_modules/core-js/fn/string/pad-start.js | 2 - node_modules/core-js/fn/string/raw.js | 2 +- node_modules/core-js/fn/string/repeat.js | 2 +- node_modules/core-js/fn/string/small.js | 2 - node_modules/core-js/fn/string/starts-with.js | 2 +- node_modules/core-js/fn/string/strike.js | 2 - node_modules/core-js/fn/string/sub.js | 2 - node_modules/core-js/fn/string/sup.js | 2 - node_modules/core-js/fn/string/trim-end.js | 2 - node_modules/core-js/fn/string/trim-left.js | 2 +- node_modules/core-js/fn/string/trim-right.js | 2 +- node_modules/core-js/fn/string/trim-start.js | 2 - node_modules/core-js/fn/string/trim.js | 2 +- node_modules/core-js/fn/string/unescape-html.js | 2 +- node_modules/core-js/fn/string/virtual/anchor.js | 2 - node_modules/core-js/fn/string/virtual/at.js | 2 - node_modules/core-js/fn/string/virtual/big.js | 2 - node_modules/core-js/fn/string/virtual/blink.js | 2 - node_modules/core-js/fn/string/virtual/bold.js | 2 - .../core-js/fn/string/virtual/code-point-at.js | 2 - .../core-js/fn/string/virtual/ends-with.js | 2 - .../core-js/fn/string/virtual/escape-html.js | 2 - node_modules/core-js/fn/string/virtual/fixed.js | 2 - .../core-js/fn/string/virtual/fontcolor.js | 2 - node_modules/core-js/fn/string/virtual/fontsize.js | 2 - node_modules/core-js/fn/string/virtual/includes.js | 2 - node_modules/core-js/fn/string/virtual/index.js | 33 - node_modules/core-js/fn/string/virtual/italics.js | 2 - node_modules/core-js/fn/string/virtual/iterator.js | 2 - node_modules/core-js/fn/string/virtual/link.js | 2 - .../core-js/fn/string/virtual/match-all.js | 2 - node_modules/core-js/fn/string/virtual/pad-end.js | 2 - .../core-js/fn/string/virtual/pad-start.js | 2 - node_modules/core-js/fn/string/virtual/repeat.js | 2 - node_modules/core-js/fn/string/virtual/small.js | 2 - .../core-js/fn/string/virtual/starts-with.js | 2 - node_modules/core-js/fn/string/virtual/strike.js | 2 - node_modules/core-js/fn/string/virtual/sub.js | 2 - node_modules/core-js/fn/string/virtual/sup.js | 2 - node_modules/core-js/fn/string/virtual/trim-end.js | 2 - .../core-js/fn/string/virtual/trim-left.js | 2 - .../core-js/fn/string/virtual/trim-right.js | 2 - .../core-js/fn/string/virtual/trim-start.js | 2 - node_modules/core-js/fn/string/virtual/trim.js | 2 - .../core-js/fn/string/virtual/unescape-html.js | 2 - node_modules/core-js/fn/symbol/async-iterator.js | 2 - node_modules/core-js/fn/symbol/for.js | 2 +- node_modules/core-js/fn/symbol/has-instance.js | 3 +- node_modules/core-js/fn/symbol/index.js | 4 +- .../core-js/fn/symbol/is-concat-spreadable.js | 2 +- node_modules/core-js/fn/symbol/iterator.js | 2 +- node_modules/core-js/fn/symbol/key-for.js | 2 +- node_modules/core-js/fn/symbol/match.js | 2 +- node_modules/core-js/fn/symbol/observable.js | 2 - node_modules/core-js/fn/symbol/replace.js | 2 +- node_modules/core-js/fn/symbol/search.js | 2 +- node_modules/core-js/fn/symbol/species.js | 2 +- node_modules/core-js/fn/symbol/split.js | 2 +- node_modules/core-js/fn/symbol/to-primitive.js | 2 +- node_modules/core-js/fn/symbol/to-string-tag.js | 2 +- node_modules/core-js/fn/symbol/unscopables.js | 2 +- node_modules/core-js/fn/system/global.js | 2 - node_modules/core-js/fn/system/index.js | 2 - node_modules/core-js/fn/typed/array-buffer.js | 3 - node_modules/core-js/fn/typed/data-view.js | 3 - node_modules/core-js/fn/typed/float32-array.js | 2 - node_modules/core-js/fn/typed/float64-array.js | 2 - node_modules/core-js/fn/typed/index.js | 13 - node_modules/core-js/fn/typed/int16-array.js | 2 - node_modules/core-js/fn/typed/int32-array.js | 2 - node_modules/core-js/fn/typed/int8-array.js | 2 - node_modules/core-js/fn/typed/uint16-array.js | 2 - node_modules/core-js/fn/typed/uint32-array.js | 2 - node_modules/core-js/fn/typed/uint8-array.js | 2 - .../core-js/fn/typed/uint8-clamped-array.js | 2 - node_modules/core-js/fn/weak-map.js | 2 +- node_modules/core-js/fn/weak-set.js | 2 +- node_modules/core-js/index.js | 4 +- node_modules/core-js/library/core/_.js | 2 +- node_modules/core-js/library/core/delay.js | 2 +- node_modules/core-js/library/core/dict.js | 2 +- node_modules/core-js/library/core/function.js | 2 +- node_modules/core-js/library/core/index.js | 4 +- node_modules/core-js/library/core/number.js | 2 +- node_modules/core-js/library/core/object.js | 2 +- node_modules/core-js/library/core/regexp.js | 2 - node_modules/core-js/library/core/string.js | 2 +- node_modules/core-js/library/es5/index.js | 32 +- node_modules/core-js/library/es6/array.js | 19 +- node_modules/core-js/library/es6/date.js | 6 - node_modules/core-js/library/es6/function.js | 3 +- node_modules/core-js/library/es6/index.js | 73 +- node_modules/core-js/library/es6/map.js | 2 +- node_modules/core-js/library/es6/math.js | 2 +- node_modules/core-js/library/es6/number.js | 4 +- node_modules/core-js/library/es6/object.js | 21 +- node_modules/core-js/library/es6/parse-float.js | 2 - node_modules/core-js/library/es6/parse-int.js | 2 - node_modules/core-js/library/es6/promise.js | 2 +- node_modules/core-js/library/es6/reflect.js | 2 +- node_modules/core-js/library/es6/regexp.js | 3 +- node_modules/core-js/library/es6/set.js | 2 +- node_modules/core-js/library/es6/string.js | 15 +- node_modules/core-js/library/es6/symbol.js | 2 +- node_modules/core-js/library/es6/typed.js | 13 - node_modules/core-js/library/es6/weak-map.js | 2 +- node_modules/core-js/library/es6/weak-set.js | 2 +- node_modules/core-js/library/es7/array.js | 2 +- node_modules/core-js/library/es7/asap.js | 2 - node_modules/core-js/library/es7/error.js | 2 - node_modules/core-js/library/es7/index.js | 31 +- node_modules/core-js/library/es7/map.js | 2 +- node_modules/core-js/library/es7/math.js | 5 - node_modules/core-js/library/es7/object.js | 6 +- node_modules/core-js/library/es7/observable.js | 7 - node_modules/core-js/library/es7/reflect.js | 10 - node_modules/core-js/library/es7/set.js | 2 +- node_modules/core-js/library/es7/string.js | 7 +- node_modules/core-js/library/es7/symbol.js | 3 - node_modules/core-js/library/es7/system.js | 2 - node_modules/core-js/library/fn/_.js | 2 +- node_modules/core-js/library/fn/array/concat.js | 6 +- .../core-js/library/fn/array/copy-within.js | 2 +- node_modules/core-js/library/fn/array/entries.js | 2 +- node_modules/core-js/library/fn/array/every.js | 4 +- node_modules/core-js/library/fn/array/fill.js | 2 +- node_modules/core-js/library/fn/array/filter.js | 4 +- .../core-js/library/fn/array/find-index.js | 2 +- node_modules/core-js/library/fn/array/find.js | 2 +- node_modules/core-js/library/fn/array/for-each.js | 4 +- node_modules/core-js/library/fn/array/from.js | 2 +- node_modules/core-js/library/fn/array/includes.js | 2 +- node_modules/core-js/library/fn/array/index-of.js | 4 +- node_modules/core-js/library/fn/array/index.js | 20 +- node_modules/core-js/library/fn/array/is-array.js | 2 - node_modules/core-js/library/fn/array/iterator.js | 2 +- node_modules/core-js/library/fn/array/join.js | 4 +- node_modules/core-js/library/fn/array/keys.js | 2 +- .../core-js/library/fn/array/last-index-of.js | 4 +- node_modules/core-js/library/fn/array/map.js | 4 +- node_modules/core-js/library/fn/array/of.js | 2 +- node_modules/core-js/library/fn/array/pop.js | 6 +- node_modules/core-js/library/fn/array/push.js | 6 +- .../core-js/library/fn/array/reduce-right.js | 4 +- node_modules/core-js/library/fn/array/reduce.js | 4 +- node_modules/core-js/library/fn/array/reverse.js | 6 +- node_modules/core-js/library/fn/array/shift.js | 6 +- node_modules/core-js/library/fn/array/slice.js | 4 +- node_modules/core-js/library/fn/array/some.js | 4 +- node_modules/core-js/library/fn/array/sort.js | 4 +- node_modules/core-js/library/fn/array/splice.js | 6 +- node_modules/core-js/library/fn/array/unshift.js | 6 +- node_modules/core-js/library/fn/array/values.js | 2 +- .../library/fn/array/virtual/copy-within.js | 2 - .../core-js/library/fn/array/virtual/entries.js | 2 - .../core-js/library/fn/array/virtual/every.js | 2 - .../core-js/library/fn/array/virtual/fill.js | 2 - .../core-js/library/fn/array/virtual/filter.js | 2 - .../core-js/library/fn/array/virtual/find-index.js | 2 - .../core-js/library/fn/array/virtual/find.js | 2 - .../core-js/library/fn/array/virtual/for-each.js | 2 - .../core-js/library/fn/array/virtual/includes.js | 2 - .../core-js/library/fn/array/virtual/index-of.js | 2 - .../core-js/library/fn/array/virtual/index.js | 20 - .../core-js/library/fn/array/virtual/iterator.js | 2 - .../core-js/library/fn/array/virtual/join.js | 2 - .../core-js/library/fn/array/virtual/keys.js | 2 - .../library/fn/array/virtual/last-index-of.js | 2 - .../core-js/library/fn/array/virtual/map.js | 2 - .../library/fn/array/virtual/reduce-right.js | 2 - .../core-js/library/fn/array/virtual/reduce.js | 2 - .../core-js/library/fn/array/virtual/slice.js | 2 - .../core-js/library/fn/array/virtual/some.js | 2 - .../core-js/library/fn/array/virtual/sort.js | 2 - .../core-js/library/fn/array/virtual/values.js | 2 - node_modules/core-js/library/fn/asap.js | 2 - node_modules/core-js/library/fn/clear-immediate.js | 2 +- node_modules/core-js/library/fn/date/index.js | 6 - node_modules/core-js/library/fn/date/now.js | 2 - .../core-js/library/fn/date/to-iso-string.js | 3 - node_modules/core-js/library/fn/date/to-json.js | 2 - .../core-js/library/fn/date/to-primitive.js | 5 - node_modules/core-js/library/fn/date/to-string.js | 5 - node_modules/core-js/library/fn/delay.js | 2 +- node_modules/core-js/library/fn/dict.js | 2 +- .../core-js/library/fn/dom-collections/index.js | 8 - .../core-js/library/fn/dom-collections/iterator.js | 2 - node_modules/core-js/library/fn/error/index.js | 2 - node_modules/core-js/library/fn/error/is-error.js | 2 - node_modules/core-js/library/fn/function/bind.js | 2 - .../core-js/library/fn/function/has-instance.js | 2 +- node_modules/core-js/library/fn/function/index.js | 3 +- node_modules/core-js/library/fn/function/part.js | 2 +- .../core-js/library/fn/function/virtual/bind.js | 2 - .../core-js/library/fn/function/virtual/index.js | 3 - .../core-js/library/fn/function/virtual/part.js | 2 - node_modules/core-js/library/fn/json/index.js | 2 - node_modules/core-js/library/fn/json/stringify.js | 5 +- node_modules/core-js/library/fn/map.js | 2 +- node_modules/core-js/library/fn/math/acosh.js | 2 +- node_modules/core-js/library/fn/math/asinh.js | 2 +- node_modules/core-js/library/fn/math/atanh.js | 2 +- node_modules/core-js/library/fn/math/cbrt.js | 2 +- node_modules/core-js/library/fn/math/clz32.js | 2 +- node_modules/core-js/library/fn/math/cosh.js | 2 +- node_modules/core-js/library/fn/math/expm1.js | 2 +- node_modules/core-js/library/fn/math/fround.js | 2 +- node_modules/core-js/library/fn/math/hypot.js | 2 +- node_modules/core-js/library/fn/math/iaddh.js | 2 - node_modules/core-js/library/fn/math/imul.js | 2 +- node_modules/core-js/library/fn/math/imulh.js | 2 - node_modules/core-js/library/fn/math/index.js | 6 +- node_modules/core-js/library/fn/math/isubh.js | 2 - node_modules/core-js/library/fn/math/log10.js | 2 +- node_modules/core-js/library/fn/math/log1p.js | 2 +- node_modules/core-js/library/fn/math/log2.js | 2 +- node_modules/core-js/library/fn/math/sign.js | 2 +- node_modules/core-js/library/fn/math/sinh.js | 2 +- node_modules/core-js/library/fn/math/tanh.js | 2 +- node_modules/core-js/library/fn/math/trunc.js | 2 +- node_modules/core-js/library/fn/math/umulh.js | 2 - .../core-js/library/fn/number/constructor.js | 2 - node_modules/core-js/library/fn/number/index.js | 4 +- .../core-js/library/fn/number/is-finite.js | 2 +- .../core-js/library/fn/number/is-integer.js | 2 +- node_modules/core-js/library/fn/number/is-nan.js | 2 +- .../core-js/library/fn/number/is-safe-integer.js | 2 +- node_modules/core-js/library/fn/number/iterator.js | 2 +- node_modules/core-js/library/fn/number/to-fixed.js | 2 - .../core-js/library/fn/number/to-precision.js | 2 - .../core-js/library/fn/number/virtual/index.js | 4 - .../core-js/library/fn/number/virtual/iterator.js | 2 - .../core-js/library/fn/number/virtual/to-fixed.js | 2 - .../library/fn/number/virtual/to-precision.js | 2 - node_modules/core-js/library/fn/object/assign.js | 2 +- node_modules/core-js/library/fn/object/classof.js | 2 +- node_modules/core-js/library/fn/object/create.js | 5 +- .../core-js/library/fn/object/define-getter.js | 2 - .../core-js/library/fn/object/define-properties.js | 5 +- .../core-js/library/fn/object/define-property.js | 5 +- .../core-js/library/fn/object/define-setter.js | 2 - node_modules/core-js/library/fn/object/define.js | 2 +- node_modules/core-js/library/fn/object/entries.js | 2 +- node_modules/core-js/library/fn/object/freeze.js | 2 +- .../fn/object/get-own-property-descriptor.js | 4 +- .../fn/object/get-own-property-descriptors.js | 2 +- .../library/fn/object/get-own-property-names.js | 4 +- .../library/fn/object/get-own-property-symbols.js | 2 +- .../core-js/library/fn/object/get-prototype-of.js | 2 +- node_modules/core-js/library/fn/object/index.js | 25 +- .../core-js/library/fn/object/is-extensible.js | 2 +- .../core-js/library/fn/object/is-frozen.js | 2 +- .../core-js/library/fn/object/is-object.js | 2 +- .../core-js/library/fn/object/is-sealed.js | 2 +- node_modules/core-js/library/fn/object/is.js | 2 +- node_modules/core-js/library/fn/object/keys.js | 2 +- .../core-js/library/fn/object/lookup-getter.js | 2 - .../core-js/library/fn/object/lookup-setter.js | 2 - node_modules/core-js/library/fn/object/make.js | 2 +- .../library/fn/object/prevent-extensions.js | 2 +- node_modules/core-js/library/fn/object/seal.js | 2 +- .../core-js/library/fn/object/set-prototype-of.js | 2 +- node_modules/core-js/library/fn/object/values.js | 2 +- node_modules/core-js/library/fn/observable.js | 7 - node_modules/core-js/library/fn/parse-float.js | 2 - node_modules/core-js/library/fn/parse-int.js | 2 - node_modules/core-js/library/fn/promise.js | 2 +- node_modules/core-js/library/fn/reflect/apply.js | 2 +- .../core-js/library/fn/reflect/construct.js | 2 +- .../core-js/library/fn/reflect/define-metadata.js | 2 - .../core-js/library/fn/reflect/define-property.js | 2 +- .../core-js/library/fn/reflect/delete-metadata.js | 2 - .../core-js/library/fn/reflect/delete-property.js | 2 +- .../core-js/library/fn/reflect/enumerate.js | 2 +- .../library/fn/reflect/get-metadata-keys.js | 2 - .../core-js/library/fn/reflect/get-metadata.js | 2 - .../library/fn/reflect/get-own-metadata-keys.js | 2 - .../core-js/library/fn/reflect/get-own-metadata.js | 2 - .../fn/reflect/get-own-property-descriptor.js | 2 +- .../core-js/library/fn/reflect/get-prototype-of.js | 2 +- node_modules/core-js/library/fn/reflect/get.js | 2 +- .../core-js/library/fn/reflect/has-metadata.js | 2 - .../core-js/library/fn/reflect/has-own-metadata.js | 2 - node_modules/core-js/library/fn/reflect/has.js | 2 +- node_modules/core-js/library/fn/reflect/index.js | 11 +- .../core-js/library/fn/reflect/is-extensible.js | 2 +- .../core-js/library/fn/reflect/metadata.js | 2 - .../core-js/library/fn/reflect/own-keys.js | 2 +- .../library/fn/reflect/prevent-extensions.js | 2 +- .../core-js/library/fn/reflect/set-prototype-of.js | 2 +- node_modules/core-js/library/fn/reflect/set.js | 2 +- .../core-js/library/fn/regexp/constructor.js | 2 - node_modules/core-js/library/fn/regexp/escape.js | 4 +- node_modules/core-js/library/fn/regexp/flags.js | 5 - node_modules/core-js/library/fn/regexp/index.js | 5 +- node_modules/core-js/library/fn/regexp/match.js | 5 - node_modules/core-js/library/fn/regexp/replace.js | 5 - node_modules/core-js/library/fn/regexp/search.js | 5 - node_modules/core-js/library/fn/regexp/split.js | 5 - .../core-js/library/fn/regexp/to-string.js | 5 - node_modules/core-js/library/fn/set-immediate.js | 2 +- node_modules/core-js/library/fn/set-interval.js | 2 +- node_modules/core-js/library/fn/set-timeout.js | 2 +- node_modules/core-js/library/fn/set.js | 2 +- node_modules/core-js/library/fn/string/anchor.js | 2 - node_modules/core-js/library/fn/string/at.js | 2 +- node_modules/core-js/library/fn/string/big.js | 2 - node_modules/core-js/library/fn/string/blink.js | 2 - node_modules/core-js/library/fn/string/bold.js | 2 - .../core-js/library/fn/string/code-point-at.js | 2 +- .../core-js/library/fn/string/ends-with.js | 2 +- .../core-js/library/fn/string/escape-html.js | 2 +- node_modules/core-js/library/fn/string/fixed.js | 2 - .../core-js/library/fn/string/fontcolor.js | 2 - node_modules/core-js/library/fn/string/fontsize.js | 2 - .../core-js/library/fn/string/from-code-point.js | 2 +- node_modules/core-js/library/fn/string/includes.js | 2 +- node_modules/core-js/library/fn/string/index.js | 20 +- node_modules/core-js/library/fn/string/italics.js | 2 - node_modules/core-js/library/fn/string/iterator.js | 2 +- node_modules/core-js/library/fn/string/link.js | 2 - .../core-js/library/fn/string/match-all.js | 2 - node_modules/core-js/library/fn/string/pad-end.js | 2 - .../core-js/library/fn/string/pad-start.js | 2 - node_modules/core-js/library/fn/string/raw.js | 2 +- node_modules/core-js/library/fn/string/repeat.js | 2 +- node_modules/core-js/library/fn/string/small.js | 2 - .../core-js/library/fn/string/starts-with.js | 2 +- node_modules/core-js/library/fn/string/strike.js | 2 - node_modules/core-js/library/fn/string/sub.js | 2 - node_modules/core-js/library/fn/string/sup.js | 2 - node_modules/core-js/library/fn/string/trim-end.js | 2 - .../core-js/library/fn/string/trim-left.js | 2 +- .../core-js/library/fn/string/trim-right.js | 2 +- .../core-js/library/fn/string/trim-start.js | 2 - node_modules/core-js/library/fn/string/trim.js | 2 +- .../core-js/library/fn/string/unescape-html.js | 2 +- .../core-js/library/fn/string/virtual/anchor.js | 2 - .../core-js/library/fn/string/virtual/at.js | 2 - .../core-js/library/fn/string/virtual/big.js | 2 - .../core-js/library/fn/string/virtual/blink.js | 2 - .../core-js/library/fn/string/virtual/bold.js | 2 - .../library/fn/string/virtual/code-point-at.js | 2 - .../core-js/library/fn/string/virtual/ends-with.js | 2 - .../library/fn/string/virtual/escape-html.js | 2 - .../core-js/library/fn/string/virtual/fixed.js | 2 - .../core-js/library/fn/string/virtual/fontcolor.js | 2 - .../core-js/library/fn/string/virtual/fontsize.js | 2 - .../core-js/library/fn/string/virtual/includes.js | 2 - .../core-js/library/fn/string/virtual/index.js | 33 - .../core-js/library/fn/string/virtual/italics.js | 2 - .../core-js/library/fn/string/virtual/iterator.js | 2 - .../core-js/library/fn/string/virtual/link.js | 2 - .../core-js/library/fn/string/virtual/match-all.js | 2 - .../core-js/library/fn/string/virtual/pad-end.js | 2 - .../core-js/library/fn/string/virtual/pad-start.js | 2 - .../core-js/library/fn/string/virtual/repeat.js | 2 - .../core-js/library/fn/string/virtual/small.js | 2 - .../library/fn/string/virtual/starts-with.js | 2 - .../core-js/library/fn/string/virtual/strike.js | 2 - .../core-js/library/fn/string/virtual/sub.js | 2 - .../core-js/library/fn/string/virtual/sup.js | 2 - .../core-js/library/fn/string/virtual/trim-end.js | 2 - .../core-js/library/fn/string/virtual/trim-left.js | 2 - .../library/fn/string/virtual/trim-right.js | 2 - .../library/fn/string/virtual/trim-start.js | 2 - .../core-js/library/fn/string/virtual/trim.js | 2 - .../library/fn/string/virtual/unescape-html.js | 2 - .../core-js/library/fn/symbol/async-iterator.js | 2 - node_modules/core-js/library/fn/symbol/for.js | 2 +- .../core-js/library/fn/symbol/has-instance.js | 3 +- node_modules/core-js/library/fn/symbol/index.js | 4 +- .../library/fn/symbol/is-concat-spreadable.js | 2 +- node_modules/core-js/library/fn/symbol/iterator.js | 2 +- node_modules/core-js/library/fn/symbol/key-for.js | 2 +- node_modules/core-js/library/fn/symbol/match.js | 2 +- .../core-js/library/fn/symbol/observable.js | 2 - node_modules/core-js/library/fn/symbol/replace.js | 2 +- node_modules/core-js/library/fn/symbol/search.js | 2 +- node_modules/core-js/library/fn/symbol/species.js | 2 +- node_modules/core-js/library/fn/symbol/split.js | 2 +- .../core-js/library/fn/symbol/to-primitive.js | 2 +- .../core-js/library/fn/symbol/to-string-tag.js | 2 +- .../core-js/library/fn/symbol/unscopables.js | 2 +- node_modules/core-js/library/fn/system/global.js | 2 - node_modules/core-js/library/fn/system/index.js | 2 - .../core-js/library/fn/typed/array-buffer.js | 3 - node_modules/core-js/library/fn/typed/data-view.js | 3 - .../core-js/library/fn/typed/float32-array.js | 2 - .../core-js/library/fn/typed/float64-array.js | 2 - node_modules/core-js/library/fn/typed/index.js | 13 - .../core-js/library/fn/typed/int16-array.js | 2 - .../core-js/library/fn/typed/int32-array.js | 2 - .../core-js/library/fn/typed/int8-array.js | 2 - .../core-js/library/fn/typed/uint16-array.js | 2 - .../core-js/library/fn/typed/uint32-array.js | 2 - .../core-js/library/fn/typed/uint8-array.js | 2 - .../library/fn/typed/uint8-clamped-array.js | 2 - node_modules/core-js/library/fn/weak-map.js | 2 +- node_modules/core-js/library/fn/weak-set.js | 2 +- node_modules/core-js/library/index.js | 4 +- .../core-js/library/modules/_a-function.js | 4 - .../core-js/library/modules/_a-number-value.js | 5 - .../core-js/library/modules/_add-to-unscopables.js | 1 - .../core-js/library/modules/_an-instance.js | 5 - node_modules/core-js/library/modules/_an-object.js | 5 - .../core-js/library/modules/_array-copy-within.js | 26 - .../core-js/library/modules/_array-fill.js | 15 - .../library/modules/_array-from-iterable.js | 7 - .../core-js/library/modules/_array-includes.js | 21 - .../core-js/library/modules/_array-methods.js | 44 - .../core-js/library/modules/_array-reduce.js | 28 - .../library/modules/_array-species-constructor.js | 16 - .../library/modules/_array-species-create.js | 6 - node_modules/core-js/library/modules/_bind.js | 24 - node_modules/core-js/library/modules/_classof.js | 23 - node_modules/core-js/library/modules/_cof.js | 5 - .../core-js/library/modules/_collection-strong.js | 142 - .../core-js/library/modules/_collection-to-json.js | 9 - .../core-js/library/modules/_collection-weak.js | 83 - .../core-js/library/modules/_collection.js | 59 - node_modules/core-js/library/modules/_core.js | 2 - .../core-js/library/modules/_create-property.js | 8 - node_modules/core-js/library/modules/_ctx.js | 20 - .../core-js/library/modules/_date-to-primitive.js | 9 - node_modules/core-js/library/modules/_defined.js | 5 - .../core-js/library/modules/_descriptors.js | 4 - .../core-js/library/modules/_dom-create.js | 7 - .../core-js/library/modules/_entry-virtual.js | 5 - .../core-js/library/modules/_enum-bug-keys.js | 4 - node_modules/core-js/library/modules/_enum-keys.js | 15 - node_modules/core-js/library/modules/_export.js | 61 - .../core-js/library/modules/_fails-is-regexp.js | 12 - node_modules/core-js/library/modules/_fails.js | 7 - .../core-js/library/modules/_fix-re-wks.js | 28 - node_modules/core-js/library/modules/_flags.js | 13 - node_modules/core-js/library/modules/_for-of.js | 25 - node_modules/core-js/library/modules/_global.js | 4 - node_modules/core-js/library/modules/_has.js | 4 - node_modules/core-js/library/modules/_hide.js | 8 - node_modules/core-js/library/modules/_html.js | 1 - .../core-js/library/modules/_ie8-dom-define.js | 3 - .../library/modules/_inherit-if-required.js | 8 - node_modules/core-js/library/modules/_invoke.js | 16 - node_modules/core-js/library/modules/_iobject.js | 5 - .../core-js/library/modules/_is-array-iter.js | 8 - node_modules/core-js/library/modules/_is-array.js | 5 - .../core-js/library/modules/_is-integer.js | 6 - node_modules/core-js/library/modules/_is-object.js | 3 - node_modules/core-js/library/modules/_is-regexp.js | 8 - node_modules/core-js/library/modules/_iter-call.js | 12 - .../core-js/library/modules/_iter-create.js | 13 - .../core-js/library/modules/_iter-define.js | 70 - .../core-js/library/modules/_iter-detect.js | 21 - node_modules/core-js/library/modules/_iter-step.js | 3 - node_modules/core-js/library/modules/_iterators.js | 1 - node_modules/core-js/library/modules/_keyof.js | 10 - node_modules/core-js/library/modules/_library.js | 1 - .../core-js/library/modules/_math-expm1.js | 10 - .../core-js/library/modules/_math-log1p.js | 4 - node_modules/core-js/library/modules/_math-sign.js | 4 - node_modules/core-js/library/modules/_meta.js | 53 - node_modules/core-js/library/modules/_metadata.js | 51 - node_modules/core-js/library/modules/_microtask.js | 68 - .../core-js/library/modules/_object-assign.js | 33 - .../core-js/library/modules/_object-create.js | 41 - .../core-js/library/modules/_object-define.js | 12 - node_modules/core-js/library/modules/_object-dp.js | 16 - .../core-js/library/modules/_object-dps.js | 13 - .../core-js/library/modules/_object-forced-pam.js | 7 - .../core-js/library/modules/_object-gopd.js | 16 - .../core-js/library/modules/_object-gopn-ext.js | 19 - .../core-js/library/modules/_object-gopn.js | 7 - .../core-js/library/modules/_object-gops.js | 1 - .../core-js/library/modules/_object-gpo.js | 13 - .../library/modules/_object-keys-internal.js | 17 - .../core-js/library/modules/_object-keys.js | 7 - .../core-js/library/modules/_object-pie.js | 1 - .../core-js/library/modules/_object-sap.js | 10 - .../core-js/library/modules/_object-to-array.js | 16 - node_modules/core-js/library/modules/_own-keys.js | 10 - .../core-js/library/modules/_parse-float.js | 8 - node_modules/core-js/library/modules/_parse-int.js | 9 - node_modules/core-js/library/modules/_partial.js | 23 - node_modules/core-js/library/modules/_path.js | 1 - .../core-js/library/modules/_property-desc.js | 8 - .../core-js/library/modules/_redefine-all.js | 7 - node_modules/core-js/library/modules/_redefine.js | 1 - node_modules/core-js/library/modules/_replacer.js | 8 - .../core-js/library/modules/_same-value.js | 4 - node_modules/core-js/library/modules/_set-proto.js | 25 - .../core-js/library/modules/_set-species.js | 14 - .../core-js/library/modules/_set-to-string-tag.js | 7 - .../core-js/library/modules/_shared-key.js | 5 - node_modules/core-js/library/modules/_shared.js | 6 - .../library/modules/_species-constructor.js | 8 - .../core-js/library/modules/_strict-method.js | 7 - node_modules/core-js/library/modules/_string-at.js | 17 - .../core-js/library/modules/_string-context.js | 8 - .../core-js/library/modules/_string-html.js | 19 - .../core-js/library/modules/_string-pad.js | 16 - .../core-js/library/modules/_string-repeat.js | 12 - .../core-js/library/modules/_string-trim.js | 30 - node_modules/core-js/library/modules/_string-ws.js | 2 - node_modules/core-js/library/modules/_task.js | 75 - node_modules/core-js/library/modules/_to-index.js | 7 - .../core-js/library/modules/_to-integer.js | 6 - .../core-js/library/modules/_to-iobject.js | 6 - node_modules/core-js/library/modules/_to-length.js | 6 - node_modules/core-js/library/modules/_to-object.js | 5 - .../core-js/library/modules/_to-primitive.js | 12 - .../core-js/library/modules/_typed-array.js | 479 - .../core-js/library/modules/_typed-buffer.js | 273 - node_modules/core-js/library/modules/_typed.js | 26 - node_modules/core-js/library/modules/_uid.js | 5 - .../core-js/library/modules/_wks-define.js | 9 - node_modules/core-js/library/modules/_wks-ext.js | 1 - node_modules/core-js/library/modules/_wks.js | 11 - node_modules/core-js/library/modules/core.delay.js | 8 +- node_modules/core-js/library/modules/core.dict.js | 40 +- .../core-js/library/modules/core.function.part.js | 8 +- .../library/modules/core.get-iterator-method.js | 8 +- .../core-js/library/modules/core.get-iterator.js | 4 +- .../core-js/library/modules/core.is-iterable.js | 8 +- .../library/modules/core.number.iterator.js | 2 +- .../core-js/library/modules/core.object.classof.js | 4 +- .../core-js/library/modules/core.object.define.js | 4 +- .../library/modules/core.object.is-object.js | 4 +- .../core-js/library/modules/core.object.make.js | 6 +- .../core-js/library/modules/core.regexp.escape.js | 5 - .../library/modules/core.string.escape-html.js | 4 +- .../library/modules/core.string.unescape-html.js | 4 +- node_modules/core-js/library/modules/es5.js | 311 +- .../library/modules/es6.array.copy-within.js | 6 +- .../core-js/library/modules/es6.array.every.js | 10 - .../core-js/library/modules/es6.array.fill.js | 6 +- .../core-js/library/modules/es6.array.filter.js | 10 - .../library/modules/es6.array.find-index.js | 6 +- .../core-js/library/modules/es6.array.find.js | 6 +- .../core-js/library/modules/es6.array.for-each.js | 11 - .../core-js/library/modules/es6.array.from.js | 29 +- .../core-js/library/modules/es6.array.index-of.js | 15 - .../core-js/library/modules/es6.array.is-array.js | 4 - .../core-js/library/modules/es6.array.iterator.js | 10 +- .../core-js/library/modules/es6.array.join.js | 12 - .../library/modules/es6.array.last-index-of.js | 22 - .../core-js/library/modules/es6.array.map.js | 10 - .../core-js/library/modules/es6.array.of.js | 14 +- .../library/modules/es6.array.reduce-right.js | 10 - .../core-js/library/modules/es6.array.reduce.js | 10 - .../core-js/library/modules/es6.array.slice.js | 28 - .../core-js/library/modules/es6.array.some.js | 10 - .../core-js/library/modules/es6.array.sort.js | 23 - .../core-js/library/modules/es6.array.species.js | 2 +- .../core-js/library/modules/es6.date.now.js | 4 - .../library/modules/es6.date.to-iso-string.js | 28 - .../core-js/library/modules/es6.date.to-json.js | 14 - .../library/modules/es6.date.to-primitive.js | 0 .../core-js/library/modules/es6.function.bind.js | 4 - .../library/modules/es6.function.has-instance.js | 12 +- node_modules/core-js/library/modules/es6.map.js | 4 +- .../core-js/library/modules/es6.math.acosh.js | 12 +- .../core-js/library/modules/es6.math.asinh.js | 6 +- .../core-js/library/modules/es6.math.atanh.js | 6 +- .../core-js/library/modules/es6.math.cbrt.js | 4 +- .../core-js/library/modules/es6.math.clz32.js | 2 +- .../core-js/library/modules/es6.math.cosh.js | 2 +- .../core-js/library/modules/es6.math.expm1.js | 5 +- .../core-js/library/modules/es6.math.fround.js | 4 +- .../core-js/library/modules/es6.math.hypot.js | 15 +- .../core-js/library/modules/es6.math.imul.js | 4 +- .../core-js/library/modules/es6.math.log10.js | 2 +- .../core-js/library/modules/es6.math.log1p.js | 4 +- .../core-js/library/modules/es6.math.log2.js | 2 +- .../core-js/library/modules/es6.math.sign.js | 4 +- .../core-js/library/modules/es6.math.sinh.js | 6 +- .../core-js/library/modules/es6.math.tanh.js | 4 +- .../core-js/library/modules/es6.math.trunc.js | 2 +- .../core-js/library/modules/es6.number.epsilon.js | 2 +- .../library/modules/es6.number.is-finite.js | 4 +- .../library/modules/es6.number.is-integer.js | 4 +- .../core-js/library/modules/es6.number.is-nan.js | 2 +- .../library/modules/es6.number.is-safe-integer.js | 4 +- .../library/modules/es6.number.max-safe-integer.js | 2 +- .../library/modules/es6.number.min-safe-integer.js | 2 +- .../library/modules/es6.number.parse-float.js | 6 +- .../library/modules/es6.number.parse-int.js | 6 +- .../core-js/library/modules/es6.number.to-fixed.js | 113 - .../library/modules/es6.number.to-precision.js | 18 - .../core-js/library/modules/es6.object.assign.js | 4 +- .../core-js/library/modules/es6.object.create.js | 3 - .../modules/es6.object.define-properties.js | 3 - .../library/modules/es6.object.define-property.js | 3 - .../core-js/library/modules/es6.object.freeze.js | 7 +- .../es6.object.get-own-property-descriptor.js | 5 +- .../modules/es6.object.get-own-property-names.js | 4 +- .../library/modules/es6.object.get-prototype-of.js | 5 +- .../library/modules/es6.object.is-extensible.js | 4 +- .../library/modules/es6.object.is-frozen.js | 4 +- .../library/modules/es6.object.is-sealed.js | 4 +- .../core-js/library/modules/es6.object.is.js | 4 +- .../core-js/library/modules/es6.object.keys.js | 5 +- .../modules/es6.object.prevent-extensions.js | 7 +- .../core-js/library/modules/es6.object.seal.js | 7 +- .../library/modules/es6.object.set-prototype-of.js | 4 +- .../core-js/library/modules/es6.parse-float.js | 4 - .../core-js/library/modules/es6.parse-int.js | 4 - .../core-js/library/modules/es6.promise.js | 312 +- .../core-js/library/modules/es6.reflect.apply.js | 18 +- .../library/modules/es6.reflect.construct.js | 30 +- .../library/modules/es6.reflect.define-property.js | 15 +- .../library/modules/es6.reflect.delete-property.js | 8 +- .../library/modules/es6.reflect.enumerate.js | 6 +- .../es6.reflect.get-own-property-descriptor.js | 8 +- .../modules/es6.reflect.get-prototype-of.js | 6 +- .../core-js/library/modules/es6.reflect.get.js | 15 +- .../core-js/library/modules/es6.reflect.has.js | 2 +- .../library/modules/es6.reflect.is-extensible.js | 4 +- .../library/modules/es6.reflect.own-keys.js | 4 +- .../modules/es6.reflect.prevent-extensions.js | 4 +- .../modules/es6.reflect.set-prototype-of.js | 4 +- .../core-js/library/modules/es6.reflect.set.js | 22 +- .../library/modules/es6.regexp.constructor.js | 2 +- .../library/modules/es6.regexp.to-string.js | 0 node_modules/core-js/library/modules/es6.set.js | 4 +- .../core-js/library/modules/es6.string.anchor.js | 7 - .../core-js/library/modules/es6.string.big.js | 7 - .../core-js/library/modules/es6.string.blink.js | 7 - .../core-js/library/modules/es6.string.bold.js | 7 - .../library/modules/es6.string.code-point-at.js | 4 +- .../library/modules/es6.string.ends-with.js | 11 +- .../core-js/library/modules/es6.string.fixed.js | 7 - .../library/modules/es6.string.fontcolor.js | 7 - .../core-js/library/modules/es6.string.fontsize.js | 7 - .../library/modules/es6.string.from-code-point.js | 15 +- .../core-js/library/modules/es6.string.includes.js | 6 +- .../core-js/library/modules/es6.string.italics.js | 7 - .../core-js/library/modules/es6.string.iterator.js | 4 +- .../core-js/library/modules/es6.string.link.js | 7 - .../core-js/library/modules/es6.string.raw.js | 19 +- .../core-js/library/modules/es6.string.repeat.js | 4 +- .../core-js/library/modules/es6.string.small.js | 7 - .../library/modules/es6.string.starts-with.js | 11 +- .../core-js/library/modules/es6.string.strike.js | 7 - .../core-js/library/modules/es6.string.sub.js | 7 - .../core-js/library/modules/es6.string.sup.js | 7 - .../core-js/library/modules/es6.string.trim.js | 2 +- node_modules/core-js/library/modules/es6.symbol.js | 250 +- .../library/modules/es6.typed.array-buffer.js | 81 +- .../core-js/library/modules/es6.typed.data-view.js | 8 +- .../library/modules/es6.typed.float32-array.js | 2 +- .../library/modules/es6.typed.float64-array.js | 2 +- .../library/modules/es6.typed.int16-array.js | 2 +- .../library/modules/es6.typed.int32-array.js | 2 +- .../library/modules/es6.typed.int8-array.js | 2 +- .../library/modules/es6.typed.uint16-array.js | 2 +- .../library/modules/es6.typed.uint32-array.js | 2 +- .../library/modules/es6.typed.uint8-array.js | 2 +- .../modules/es6.typed.uint8-clamped-array.js | 2 +- .../core-js/library/modules/es6.weak-map.js | 51 +- .../core-js/library/modules/es6.weak-set.js | 4 +- .../core-js/library/modules/es7.array.includes.js | 8 +- node_modules/core-js/library/modules/es7.asap.js | 12 - .../core-js/library/modules/es7.error.is-error.js | 9 - .../core-js/library/modules/es7.map.to-json.js | 4 +- .../core-js/library/modules/es7.math.iaddh.js | 11 - .../core-js/library/modules/es7.math.imulh.js | 16 - .../core-js/library/modules/es7.math.isubh.js | 11 - .../core-js/library/modules/es7.math.umulh.js | 16 - .../library/modules/es7.object.define-getter.js | 12 - .../library/modules/es7.object.define-setter.js | 12 - .../core-js/library/modules/es7.object.entries.js | 6 +- .../modules/es7.object.enumerable-entries.js | 12 - .../library/modules/es7.object.enumerable-keys.js | 12 - .../modules/es7.object.enumerable-values.js | 12 - .../es7.object.get-own-property-descriptors.js | 24 +- .../library/modules/es7.object.lookup-getter.js | 18 - .../library/modules/es7.object.lookup-setter.js | 18 - .../core-js/library/modules/es7.object.values.js | 6 +- .../core-js/library/modules/es7.observable.js | 199 - .../library/modules/es7.reflect.define-metadata.js | 8 - .../library/modules/es7.reflect.delete-metadata.js | 15 - .../modules/es7.reflect.get-metadata-keys.js | 19 - .../library/modules/es7.reflect.get-metadata.js | 17 - .../modules/es7.reflect.get-own-metadata-keys.js | 8 - .../modules/es7.reflect.get-own-metadata.js | 9 - .../library/modules/es7.reflect.has-metadata.js | 16 - .../modules/es7.reflect.has-own-metadata.js | 9 - .../library/modules/es7.reflect.metadata.js | 15 - .../core-js/library/modules/es7.set.to-json.js | 4 +- .../core-js/library/modules/es7.string.at.js | 4 +- .../library/modules/es7.string.match-all.js | 30 - .../core-js/library/modules/es7.string.pad-end.js | 10 - .../library/modules/es7.string.pad-start.js | 10 - .../library/modules/es7.string.trim-left.js | 4 +- .../library/modules/es7.string.trim-right.js | 4 +- .../library/modules/es7.symbol.async-iterator.js | 1 - .../library/modules/es7.symbol.observable.js | 1 - .../core-js/library/modules/es7.system.global.js | 4 - .../core-js/library/modules/web.dom.iterable.js | 14 +- .../core-js/library/modules/web.immediate.js | 4 +- node_modules/core-js/library/modules/web.timers.js | 8 +- node_modules/core-js/library/shim.js | 104 +- node_modules/core-js/library/stage/0.js | 10 - node_modules/core-js/library/stage/1.js | 6 - node_modules/core-js/library/stage/2.js | 3 - node_modules/core-js/library/stage/3.js | 4 - node_modules/core-js/library/stage/4.js | 8 - node_modules/core-js/library/stage/index.js | 1 - node_modules/core-js/library/stage/pre.js | 10 - .../core-js/library/web/dom-collections.js | 2 - node_modules/core-js/library/web/immediate.js | 2 +- node_modules/core-js/library/web/index.js | 2 +- node_modules/core-js/library/web/timers.js | 2 +- node_modules/core-js/modules/_a-function.js | 4 - node_modules/core-js/modules/_a-number-value.js | 5 - .../core-js/modules/_add-to-unscopables.js | 7 - node_modules/core-js/modules/_an-instance.js | 5 - node_modules/core-js/modules/_an-object.js | 5 - node_modules/core-js/modules/_array-copy-within.js | 26 - node_modules/core-js/modules/_array-fill.js | 15 - .../core-js/modules/_array-from-iterable.js | 7 - node_modules/core-js/modules/_array-includes.js | 21 - node_modules/core-js/modules/_array-methods.js | 44 - node_modules/core-js/modules/_array-reduce.js | 28 - .../core-js/modules/_array-species-constructor.js | 16 - .../core-js/modules/_array-species-create.js | 6 - node_modules/core-js/modules/_bind.js | 24 - node_modules/core-js/modules/_classof.js | 23 - node_modules/core-js/modules/_cof.js | 5 - node_modules/core-js/modules/_collection-strong.js | 142 - .../core-js/modules/_collection-to-json.js | 9 - node_modules/core-js/modules/_collection-weak.js | 83 - node_modules/core-js/modules/_collection.js | 85 - node_modules/core-js/modules/_core.js | 2 - node_modules/core-js/modules/_create-property.js | 8 - node_modules/core-js/modules/_ctx.js | 20 - node_modules/core-js/modules/_date-to-primitive.js | 9 - node_modules/core-js/modules/_defined.js | 5 - node_modules/core-js/modules/_descriptors.js | 4 - node_modules/core-js/modules/_dom-create.js | 7 - node_modules/core-js/modules/_entry-virtual.js | 5 - node_modules/core-js/modules/_enum-bug-keys.js | 4 - node_modules/core-js/modules/_enum-keys.js | 15 - node_modules/core-js/modules/_export.js | 43 - node_modules/core-js/modules/_fails-is-regexp.js | 12 - node_modules/core-js/modules/_fails.js | 7 - node_modules/core-js/modules/_fix-re-wks.js | 28 - node_modules/core-js/modules/_flags.js | 13 - node_modules/core-js/modules/_for-of.js | 25 - node_modules/core-js/modules/_global.js | 4 - node_modules/core-js/modules/_has.js | 4 - node_modules/core-js/modules/_hide.js | 8 - node_modules/core-js/modules/_html.js | 1 - node_modules/core-js/modules/_ie8-dom-define.js | 3 - .../core-js/modules/_inherit-if-required.js | 8 - node_modules/core-js/modules/_invoke.js | 16 - node_modules/core-js/modules/_iobject.js | 5 - node_modules/core-js/modules/_is-array-iter.js | 8 - node_modules/core-js/modules/_is-array.js | 5 - node_modules/core-js/modules/_is-integer.js | 6 - node_modules/core-js/modules/_is-object.js | 3 - node_modules/core-js/modules/_is-regexp.js | 8 - node_modules/core-js/modules/_iter-call.js | 12 - node_modules/core-js/modules/_iter-create.js | 13 - node_modules/core-js/modules/_iter-define.js | 70 - node_modules/core-js/modules/_iter-detect.js | 21 - node_modules/core-js/modules/_iter-step.js | 3 - node_modules/core-js/modules/_iterators.js | 1 - node_modules/core-js/modules/_keyof.js | 10 - node_modules/core-js/modules/_library.js | 1 - node_modules/core-js/modules/_math-expm1.js | 10 - node_modules/core-js/modules/_math-log1p.js | 4 - node_modules/core-js/modules/_math-sign.js | 4 - node_modules/core-js/modules/_meta.js | 53 - node_modules/core-js/modules/_metadata.js | 51 - node_modules/core-js/modules/_microtask.js | 68 - node_modules/core-js/modules/_object-assign.js | 33 - node_modules/core-js/modules/_object-create.js | 41 - node_modules/core-js/modules/_object-define.js | 12 - node_modules/core-js/modules/_object-dp.js | 16 - node_modules/core-js/modules/_object-dps.js | 13 - node_modules/core-js/modules/_object-forced-pam.js | 7 - node_modules/core-js/modules/_object-gopd.js | 16 - node_modules/core-js/modules/_object-gopn-ext.js | 19 - node_modules/core-js/modules/_object-gopn.js | 7 - node_modules/core-js/modules/_object-gops.js | 1 - node_modules/core-js/modules/_object-gpo.js | 13 - .../core-js/modules/_object-keys-internal.js | 17 - node_modules/core-js/modules/_object-keys.js | 7 - node_modules/core-js/modules/_object-pie.js | 1 - node_modules/core-js/modules/_object-sap.js | 10 - node_modules/core-js/modules/_object-to-array.js | 16 - node_modules/core-js/modules/_own-keys.js | 10 - node_modules/core-js/modules/_parse-float.js | 8 - node_modules/core-js/modules/_parse-int.js | 9 - node_modules/core-js/modules/_partial.js | 23 - node_modules/core-js/modules/_path.js | 1 - node_modules/core-js/modules/_property-desc.js | 8 - node_modules/core-js/modules/_redefine-all.js | 5 - node_modules/core-js/modules/_redefine.js | 32 - node_modules/core-js/modules/_replacer.js | 8 - node_modules/core-js/modules/_same-value.js | 4 - node_modules/core-js/modules/_set-proto.js | 25 - node_modules/core-js/modules/_set-species.js | 13 - node_modules/core-js/modules/_set-to-string-tag.js | 7 - node_modules/core-js/modules/_shared-key.js | 5 - node_modules/core-js/modules/_shared.js | 6 - .../core-js/modules/_species-constructor.js | 8 - node_modules/core-js/modules/_strict-method.js | 7 - node_modules/core-js/modules/_string-at.js | 17 - node_modules/core-js/modules/_string-context.js | 8 - node_modules/core-js/modules/_string-html.js | 19 - node_modules/core-js/modules/_string-pad.js | 16 - node_modules/core-js/modules/_string-repeat.js | 12 - node_modules/core-js/modules/_string-trim.js | 30 - node_modules/core-js/modules/_string-ws.js | 2 - node_modules/core-js/modules/_task.js | 75 - node_modules/core-js/modules/_to-index.js | 7 - node_modules/core-js/modules/_to-integer.js | 6 - node_modules/core-js/modules/_to-iobject.js | 6 - node_modules/core-js/modules/_to-length.js | 6 - node_modules/core-js/modules/_to-object.js | 5 - node_modules/core-js/modules/_to-primitive.js | 12 - node_modules/core-js/modules/_typed-array.js | 479 - node_modules/core-js/modules/_typed-buffer.js | 273 - node_modules/core-js/modules/_typed.js | 26 - node_modules/core-js/modules/_uid.js | 5 - node_modules/core-js/modules/_wks-define.js | 9 - node_modules/core-js/modules/_wks-ext.js | 1 - node_modules/core-js/modules/_wks.js | 11 - node_modules/core-js/modules/core.delay.js | 8 +- node_modules/core-js/modules/core.dict.js | 40 +- node_modules/core-js/modules/core.function.part.js | 8 +- .../core-js/modules/core.get-iterator-method.js | 8 +- node_modules/core-js/modules/core.get-iterator.js | 4 +- node_modules/core-js/modules/core.is-iterable.js | 8 +- .../core-js/modules/core.number.iterator.js | 2 +- .../core-js/modules/core.object.classof.js | 4 +- node_modules/core-js/modules/core.object.define.js | 4 +- .../core-js/modules/core.object.is-object.js | 4 +- node_modules/core-js/modules/core.object.make.js | 6 +- node_modules/core-js/modules/core.regexp.escape.js | 5 - .../core-js/modules/core.string.escape-html.js | 4 +- .../core-js/modules/core.string.unescape-html.js | 4 +- node_modules/core-js/modules/es5.js | 311 +- .../core-js/modules/es6.array.copy-within.js | 6 +- node_modules/core-js/modules/es6.array.every.js | 10 - node_modules/core-js/modules/es6.array.fill.js | 6 +- node_modules/core-js/modules/es6.array.filter.js | 10 - .../core-js/modules/es6.array.find-index.js | 6 +- node_modules/core-js/modules/es6.array.find.js | 6 +- node_modules/core-js/modules/es6.array.for-each.js | 11 - node_modules/core-js/modules/es6.array.from.js | 29 +- node_modules/core-js/modules/es6.array.index-of.js | 15 - node_modules/core-js/modules/es6.array.is-array.js | 4 - node_modules/core-js/modules/es6.array.iterator.js | 10 +- node_modules/core-js/modules/es6.array.join.js | 12 - .../core-js/modules/es6.array.last-index-of.js | 22 - node_modules/core-js/modules/es6.array.map.js | 10 - node_modules/core-js/modules/es6.array.of.js | 14 +- .../core-js/modules/es6.array.reduce-right.js | 10 - node_modules/core-js/modules/es6.array.reduce.js | 10 - node_modules/core-js/modules/es6.array.slice.js | 28 - node_modules/core-js/modules/es6.array.some.js | 10 - node_modules/core-js/modules/es6.array.sort.js | 23 - node_modules/core-js/modules/es6.array.species.js | 2 +- node_modules/core-js/modules/es6.date.now.js | 4 - .../core-js/modules/es6.date.to-iso-string.js | 28 - node_modules/core-js/modules/es6.date.to-json.js | 14 - .../core-js/modules/es6.date.to-primitive.js | 4 - node_modules/core-js/modules/es6.date.to-string.js | 7 +- node_modules/core-js/modules/es6.function.bind.js | 4 - .../core-js/modules/es6.function.has-instance.js | 12 +- node_modules/core-js/modules/es6.function.name.js | 25 +- node_modules/core-js/modules/es6.map.js | 4 +- node_modules/core-js/modules/es6.math.acosh.js | 12 +- node_modules/core-js/modules/es6.math.asinh.js | 6 +- node_modules/core-js/modules/es6.math.atanh.js | 6 +- node_modules/core-js/modules/es6.math.cbrt.js | 4 +- node_modules/core-js/modules/es6.math.clz32.js | 2 +- node_modules/core-js/modules/es6.math.cosh.js | 2 +- node_modules/core-js/modules/es6.math.expm1.js | 5 +- node_modules/core-js/modules/es6.math.fround.js | 4 +- node_modules/core-js/modules/es6.math.hypot.js | 15 +- node_modules/core-js/modules/es6.math.imul.js | 4 +- node_modules/core-js/modules/es6.math.log10.js | 2 +- node_modules/core-js/modules/es6.math.log1p.js | 4 +- node_modules/core-js/modules/es6.math.log2.js | 2 +- node_modules/core-js/modules/es6.math.sign.js | 4 +- node_modules/core-js/modules/es6.math.sinh.js | 6 +- node_modules/core-js/modules/es6.math.tanh.js | 4 +- node_modules/core-js/modules/es6.math.trunc.js | 2 +- .../core-js/modules/es6.number.constructor.js | 43 +- node_modules/core-js/modules/es6.number.epsilon.js | 2 +- .../core-js/modules/es6.number.is-finite.js | 4 +- .../core-js/modules/es6.number.is-integer.js | 4 +- node_modules/core-js/modules/es6.number.is-nan.js | 2 +- .../core-js/modules/es6.number.is-safe-integer.js | 4 +- .../core-js/modules/es6.number.max-safe-integer.js | 2 +- .../core-js/modules/es6.number.min-safe-integer.js | 2 +- .../core-js/modules/es6.number.parse-float.js | 6 +- .../core-js/modules/es6.number.parse-int.js | 6 +- .../core-js/modules/es6.number.to-fixed.js | 113 - .../core-js/modules/es6.number.to-precision.js | 18 - node_modules/core-js/modules/es6.object.assign.js | 4 +- node_modules/core-js/modules/es6.object.create.js | 3 - .../modules/es6.object.define-properties.js | 3 - .../core-js/modules/es6.object.define-property.js | 3 - node_modules/core-js/modules/es6.object.freeze.js | 7 +- .../es6.object.get-own-property-descriptor.js | 5 +- .../modules/es6.object.get-own-property-names.js | 4 +- .../core-js/modules/es6.object.get-prototype-of.js | 5 +- .../core-js/modules/es6.object.is-extensible.js | 4 +- .../core-js/modules/es6.object.is-frozen.js | 4 +- .../core-js/modules/es6.object.is-sealed.js | 4 +- node_modules/core-js/modules/es6.object.is.js | 4 +- node_modules/core-js/modules/es6.object.keys.js | 5 +- .../modules/es6.object.prevent-extensions.js | 7 +- node_modules/core-js/modules/es6.object.seal.js | 7 +- .../core-js/modules/es6.object.set-prototype-of.js | 4 +- .../core-js/modules/es6.object.to-string.js | 6 +- node_modules/core-js/modules/es6.parse-float.js | 4 - node_modules/core-js/modules/es6.parse-int.js | 4 - node_modules/core-js/modules/es6.promise.js | 312 +- node_modules/core-js/modules/es6.reflect.apply.js | 18 +- .../core-js/modules/es6.reflect.construct.js | 30 +- .../core-js/modules/es6.reflect.define-property.js | 15 +- .../core-js/modules/es6.reflect.delete-property.js | 8 +- .../core-js/modules/es6.reflect.enumerate.js | 6 +- .../es6.reflect.get-own-property-descriptor.js | 8 +- .../modules/es6.reflect.get-prototype-of.js | 6 +- node_modules/core-js/modules/es6.reflect.get.js | 15 +- node_modules/core-js/modules/es6.reflect.has.js | 2 +- .../core-js/modules/es6.reflect.is-extensible.js | 4 +- .../core-js/modules/es6.reflect.own-keys.js | 4 +- .../modules/es6.reflect.prevent-extensions.js | 4 +- .../modules/es6.reflect.set-prototype-of.js | 4 +- node_modules/core-js/modules/es6.reflect.set.js | 22 +- .../core-js/modules/es6.regexp.constructor.js | 47 +- node_modules/core-js/modules/es6.regexp.flags.js | 5 +- node_modules/core-js/modules/es6.regexp.match.js | 6 +- node_modules/core-js/modules/es6.regexp.replace.js | 6 +- node_modules/core-js/modules/es6.regexp.search.js | 6 +- node_modules/core-js/modules/es6.regexp.split.js | 72 +- .../core-js/modules/es6.regexp.to-string.js | 25 - node_modules/core-js/modules/es6.set.js | 4 +- node_modules/core-js/modules/es6.string.anchor.js | 7 - node_modules/core-js/modules/es6.string.big.js | 7 - node_modules/core-js/modules/es6.string.blink.js | 7 - node_modules/core-js/modules/es6.string.bold.js | 7 - .../core-js/modules/es6.string.code-point-at.js | 4 +- .../core-js/modules/es6.string.ends-with.js | 11 +- node_modules/core-js/modules/es6.string.fixed.js | 7 - .../core-js/modules/es6.string.fontcolor.js | 7 - .../core-js/modules/es6.string.fontsize.js | 7 - .../core-js/modules/es6.string.from-code-point.js | 15 +- .../core-js/modules/es6.string.includes.js | 6 +- node_modules/core-js/modules/es6.string.italics.js | 7 - .../core-js/modules/es6.string.iterator.js | 4 +- node_modules/core-js/modules/es6.string.link.js | 7 - node_modules/core-js/modules/es6.string.raw.js | 19 +- node_modules/core-js/modules/es6.string.repeat.js | 4 +- node_modules/core-js/modules/es6.string.small.js | 7 - .../core-js/modules/es6.string.starts-with.js | 11 +- node_modules/core-js/modules/es6.string.strike.js | 7 - node_modules/core-js/modules/es6.string.sub.js | 7 - node_modules/core-js/modules/es6.string.sup.js | 7 - node_modules/core-js/modules/es6.string.trim.js | 2 +- node_modules/core-js/modules/es6.symbol.js | 250 +- .../core-js/modules/es6.typed.array-buffer.js | 81 +- .../core-js/modules/es6.typed.data-view.js | 8 +- .../core-js/modules/es6.typed.float32-array.js | 2 +- .../core-js/modules/es6.typed.float64-array.js | 2 +- .../core-js/modules/es6.typed.int16-array.js | 2 +- .../core-js/modules/es6.typed.int32-array.js | 2 +- .../core-js/modules/es6.typed.int8-array.js | 2 +- .../core-js/modules/es6.typed.uint16-array.js | 2 +- .../core-js/modules/es6.typed.uint32-array.js | 2 +- .../core-js/modules/es6.typed.uint8-array.js | 2 +- .../modules/es6.typed.uint8-clamped-array.js | 2 +- node_modules/core-js/modules/es6.weak-map.js | 51 +- node_modules/core-js/modules/es6.weak-set.js | 4 +- node_modules/core-js/modules/es7.array.includes.js | 8 +- node_modules/core-js/modules/es7.asap.js | 12 - node_modules/core-js/modules/es7.error.is-error.js | 9 - node_modules/core-js/modules/es7.map.to-json.js | 4 +- node_modules/core-js/modules/es7.math.iaddh.js | 11 - node_modules/core-js/modules/es7.math.imulh.js | 16 - node_modules/core-js/modules/es7.math.isubh.js | 11 - node_modules/core-js/modules/es7.math.umulh.js | 16 - .../core-js/modules/es7.object.define-getter.js | 12 - .../core-js/modules/es7.object.define-setter.js | 12 - node_modules/core-js/modules/es7.object.entries.js | 6 +- .../modules/es7.object.enumerable-entries.js | 12 - .../core-js/modules/es7.object.enumerable-keys.js | 12 - .../modules/es7.object.enumerable-values.js | 12 - .../es7.object.get-own-property-descriptors.js | 24 +- .../core-js/modules/es7.object.lookup-getter.js | 18 - .../core-js/modules/es7.object.lookup-setter.js | 18 - node_modules/core-js/modules/es7.object.values.js | 6 +- node_modules/core-js/modules/es7.observable.js | 199 - .../core-js/modules/es7.reflect.define-metadata.js | 8 - .../core-js/modules/es7.reflect.delete-metadata.js | 15 - .../modules/es7.reflect.get-metadata-keys.js | 19 - .../core-js/modules/es7.reflect.get-metadata.js | 17 - .../modules/es7.reflect.get-own-metadata-keys.js | 8 - .../modules/es7.reflect.get-own-metadata.js | 9 - .../core-js/modules/es7.reflect.has-metadata.js | 16 - .../modules/es7.reflect.has-own-metadata.js | 9 - .../core-js/modules/es7.reflect.metadata.js | 15 - node_modules/core-js/modules/es7.set.to-json.js | 4 +- node_modules/core-js/modules/es7.string.at.js | 4 +- .../core-js/modules/es7.string.match-all.js | 30 - node_modules/core-js/modules/es7.string.pad-end.js | 10 - .../core-js/modules/es7.string.pad-start.js | 10 - .../core-js/modules/es7.string.trim-left.js | 4 +- .../core-js/modules/es7.string.trim-right.js | 4 +- .../core-js/modules/es7.symbol.async-iterator.js | 1 - .../core-js/modules/es7.symbol.observable.js | 1 - node_modules/core-js/modules/es7.system.global.js | 4 - .../core-js/modules/library/_add-to-unscopables.js | 1 - .../core-js/modules/library/_collection.js | 59 - node_modules/core-js/modules/library/_export.js | 61 - node_modules/core-js/modules/library/_library.js | 1 - node_modules/core-js/modules/library/_path.js | 1 - .../core-js/modules/library/_redefine-all.js | 7 - node_modules/core-js/modules/library/_redefine.js | 1 - .../core-js/modules/library/_set-species.js | 14 - .../modules/library/es6.date.to-primitive.js | 0 .../modules/library/es6.regexp.constructor.js | 2 +- .../modules/library/es6.regexp.to-string.js | 0 .../core-js/modules/library/web.dom.iterable.js | 14 +- node_modules/core-js/modules/web.dom.iterable.js | 34 +- node_modules/core-js/modules/web.immediate.js | 4 +- node_modules/core-js/modules/web.timers.js | 8 +- node_modules/core-js/package.json | 56 +- node_modules/core-js/shim.js | 104 +- node_modules/core-js/stage/0.js | 10 - node_modules/core-js/stage/1.js | 6 - node_modules/core-js/stage/2.js | 3 - node_modules/core-js/stage/3.js | 4 - node_modules/core-js/stage/4.js | 8 - node_modules/core-js/stage/index.js | 1 - node_modules/core-js/stage/pre.js | 10 - node_modules/core-js/web/dom-collections.js | 2 - node_modules/core-js/web/immediate.js | 2 +- node_modules/core-js/web/index.js | 2 +- node_modules/core-js/web/timers.js | 2 +- node_modules/crc32-stream/README.md | 4 +- node_modules/crc32-stream/lib/crc32-stream.js | 12 +- .../crc32-stream/lib/deflate-crc32-stream.js | 12 +- node_modules/crc32-stream/package.json | 10 +- node_modules/dateformat/.npmignore | 59 +- node_modules/dateformat/.travis.yml | 4 - node_modules/dateformat/Readme.md | 157 +- node_modules/dateformat/bin/cli.js | 75 - node_modules/dateformat/package.json | 12 +- node_modules/dateformat/test/test_dayofweek.js | 15 - node_modules/dateformat/test/test_formats.js | 76 - .../dateformat/test/test_isoutcdatetime.js | 11 - .../dateformat/test/weekofyear/test_weekofyear.js | 4 - .../dateformat/test/weekofyear/test_weekofyear.sh | 27 - node_modules/debug/.jshintrc | 3 - node_modules/debug/.npmignore | 2 + node_modules/debug/History.md | 195 - node_modules/debug/Makefile | 42 +- node_modules/debug/Readme.md | 188 - node_modules/debug/bower.json | 7 +- node_modules/debug/browser.js | 168 - node_modules/debug/component.json | 8 +- node_modules/debug/debug.js | 197 - node_modules/debug/node.js | 210 +- node_modules/debug/package.json | 27 +- node_modules/error-ex/index.js | 34 +- node_modules/error-ex/package.json | 4 +- node_modules/fancy-log/LICENSE | 2 +- node_modules/fancy-log/README.md | 18 +- node_modules/fancy-log/index.js | 24 + node_modules/fancy-log/package.json | 10 +- node_modules/for-in/LICENSE | 2 +- node_modules/for-in/README.md | 51 +- node_modules/for-in/index.js | 10 +- node_modules/for-in/package.json | 20 +- node_modules/for-own/LICENSE | 2 +- node_modules/for-own/README.md | 67 +- node_modules/for-own/index.js | 12 +- node_modules/for-own/package.json | 20 +- .../glob-base/node_modules/glob-parent/.npmignore | 4 - .../glob-base/node_modules/glob-parent/.travis.yml | 8 - .../glob-base/node_modules/glob-parent/LICENSE | 15 - .../glob-base/node_modules/glob-parent/README.md | 43 - .../glob-base/node_modules/glob-parent/index.js | 10 - .../node_modules/glob-parent/package.json | 35 - .../glob-base/node_modules/glob-parent/test.js | 28 - node_modules/glob-parent/.travis.yml | 8 +- node_modules/glob-parent/README.md | 22 - node_modules/glob-parent/appveyor.yml | 25 - node_modules/glob-parent/index.js | 5 +- .../glob-parent/node_modules/is-extglob/LICENSE | 21 - .../glob-parent/node_modules/is-extglob/README.md | 107 - .../glob-parent/node_modules/is-extglob/index.js | 20 - .../node_modules/is-extglob/package.json | 69 - .../glob-parent/node_modules/is-glob/LICENSE | 21 - .../glob-parent/node_modules/is-glob/README.md | 142 - .../glob-parent/node_modules/is-glob/index.js | 25 - .../glob-parent/node_modules/is-glob/package.json | 80 - node_modules/glob-parent/package.json | 16 +- node_modules/glob-parent/test.js | 103 +- node_modules/global-prefix/index.js | 16 +- node_modules/global-prefix/package.json | 21 +- node_modules/globals/globals.json | 4 + node_modules/globals/package.json | 2 +- node_modules/graceful-fs/package.json | 2 +- node_modules/graceful-fs/polyfills.js | 12 +- .../gulp-debug/node_modules/clone-stats/LICENSE.md | 21 - .../gulp-debug/node_modules/clone-stats/README.md | 17 - .../gulp-debug/node_modules/clone-stats/index.js | 13 - .../node_modules/clone-stats/package.json | 31 - .../gulp-debug/node_modules/clone-stats/test.js | 36 - .../gulp-debug/node_modules/gulp-util/LICENSE | 20 - .../gulp-debug/node_modules/gulp-util/README.md | 146 - .../gulp-debug/node_modules/gulp-util/index.js | 18 - .../node_modules/gulp-util/lib/PluginError.js | 130 - .../node_modules/gulp-util/lib/buffer.js | 15 - .../node_modules/gulp-util/lib/combine.js | 11 - .../gulp-debug/node_modules/gulp-util/lib/env.js | 4 - .../node_modules/gulp-util/lib/isBuffer.js | 7 - .../node_modules/gulp-util/lib/isNull.js | 3 - .../node_modules/gulp-util/lib/isStream.js | 5 - .../gulp-debug/node_modules/gulp-util/lib/log.js | 14 - .../gulp-debug/node_modules/gulp-util/lib/noop.js | 5 - .../node_modules/gulp-util/lib/template.js | 23 - .../gulp-util/node_modules/.bin/dateformat | 1 - .../gulp-util/node_modules/object-assign/index.js | 39 - .../gulp-util/node_modules/object-assign/license | 21 - .../node_modules/object-assign/package.json | 38 - .../gulp-util/node_modules/object-assign/readme.md | 51 - .../gulp-debug/node_modules/gulp-util/package.json | 51 - .../node_modules/lodash._reinterpolate/LICENSE.txt | 22 - .../node_modules/lodash._reinterpolate/README.md | 20 - .../node_modules/lodash._reinterpolate/index.js | 13 - .../lodash._reinterpolate/package.json | 18 - .../node_modules/lodash.template/LICENSE | 22 - .../node_modules/lodash.template/README.md | 20 - .../node_modules/lodash.template/index.js | 389 - .../node_modules/lodash.template/package.json | 30 - .../gulp-debug/node_modules/replace-ext/.npmignore | 6 - .../node_modules/replace-ext/.travis.yml | 8 - .../gulp-debug/node_modules/replace-ext/LICENSE | 20 - .../gulp-debug/node_modules/replace-ext/README.md | 44 - .../gulp-debug/node_modules/replace-ext/index.js | 9 - .../node_modules/replace-ext/package.json | 35 - .../node_modules/replace-ext/test/main.js | 51 - node_modules/gulp-debug/node_modules/vinyl/LICENSE | 20 - .../gulp-debug/node_modules/vinyl/README.md | 195 - .../gulp-debug/node_modules/vinyl/index.js | 213 - .../node_modules/vinyl/lib/cloneBuffer.js | 7 - .../node_modules/vinyl/lib/inspectStream.js | 11 - .../gulp-debug/node_modules/vinyl/lib/isBuffer.js | 1 - .../gulp-debug/node_modules/vinyl/lib/isNull.js | 3 - .../gulp-debug/node_modules/vinyl/lib/isStream.js | 5 - .../gulp-debug/node_modules/vinyl/package.json | 37 - .../node_modules/clone-stats/LICENSE.md | 21 - .../node_modules/clone-stats/README.md | 17 - .../node_modules/clone-stats/index.js | 13 - .../node_modules/clone-stats/package.json | 31 - .../node_modules/clone-stats/test.js | 36 - .../node_modules/gulp-util/LICENSE | 20 - .../node_modules/gulp-util/README.md | 146 - .../node_modules/gulp-util/index.js | 18 - .../node_modules/gulp-util/lib/PluginError.js | 130 - .../node_modules/gulp-util/lib/buffer.js | 15 - .../node_modules/gulp-util/lib/combine.js | 11 - .../node_modules/gulp-util/lib/env.js | 4 - .../node_modules/gulp-util/lib/isBuffer.js | 7 - .../node_modules/gulp-util/lib/isNull.js | 3 - .../node_modules/gulp-util/lib/isStream.js | 5 - .../node_modules/gulp-util/lib/log.js | 14 - .../node_modules/gulp-util/lib/noop.js | 5 - .../node_modules/gulp-util/lib/template.js | 23 - .../gulp-util/node_modules/.bin/dateformat | 1 - .../node_modules/gulp-util/package.json | 51 - .../node_modules/lodash._reinterpolate/LICENSE.txt | 22 - .../node_modules/lodash._reinterpolate/README.md | 20 - .../node_modules/lodash._reinterpolate/index.js | 13 - .../lodash._reinterpolate/package.json | 18 - .../node_modules/lodash.template/LICENSE | 22 - .../node_modules/lodash.template/README.md | 20 - .../node_modules/lodash.template/index.js | 389 - .../node_modules/lodash.template/package.json | 30 - .../node_modules/object-assign/index.js | 39 - .../node_modules/object-assign/license | 21 - .../node_modules/object-assign/package.json | 38 - .../node_modules/object-assign/readme.md | 51 - .../node_modules/replace-ext/.npmignore | 6 - .../node_modules/replace-ext/.travis.yml | 8 - .../node_modules/replace-ext/LICENSE | 20 - .../node_modules/replace-ext/README.md | 44 - .../node_modules/replace-ext/index.js | 9 - .../node_modules/replace-ext/package.json | 35 - .../node_modules/replace-ext/test/main.js | 51 - .../gulp-json-transform/node_modules/vinyl/LICENSE | 20 - .../node_modules/vinyl/README.md | 195 - .../node_modules/vinyl/index.js | 213 - .../node_modules/vinyl/lib/cloneBuffer.js | 7 - .../node_modules/vinyl/lib/inspectStream.js | 11 - .../node_modules/vinyl/lib/isBuffer.js | 1 - .../node_modules/vinyl/lib/isNull.js | 3 - .../node_modules/vinyl/lib/isStream.js | 5 - .../node_modules/vinyl/package.json | 37 - .../node_modules/clone-stats/LICENSE.md | 21 - .../node_modules/clone-stats/README.md | 17 - .../node_modules/clone-stats/index.js | 13 - .../node_modules/clone-stats/package.json | 31 - .../node_modules/clone-stats/test.js | 36 - .../node_modules/replace-ext/.npmignore | 6 - .../node_modules/replace-ext/.travis.yml | 8 - .../node_modules/replace-ext/LICENSE | 20 - .../node_modules/replace-ext/README.md | 44 - .../node_modules/replace-ext/index.js | 9 - .../node_modules/replace-ext/package.json | 35 - .../node_modules/replace-ext/test/main.js | 51 - .../gulp-tar/node_modules/clone-stats/LICENSE.md | 21 - .../gulp-tar/node_modules/clone-stats/README.md | 17 - .../gulp-tar/node_modules/clone-stats/index.js | 13 - .../gulp-tar/node_modules/clone-stats/package.json | 31 - .../gulp-tar/node_modules/clone-stats/test.js | 36 - .../gulp-tar/node_modules/gulp-util/LICENSE | 20 - .../gulp-tar/node_modules/gulp-util/README.md | 146 - .../gulp-tar/node_modules/gulp-util/index.js | 18 - .../node_modules/gulp-util/lib/PluginError.js | 130 - .../gulp-tar/node_modules/gulp-util/lib/buffer.js | 15 - .../gulp-tar/node_modules/gulp-util/lib/combine.js | 11 - .../gulp-tar/node_modules/gulp-util/lib/env.js | 4 - .../node_modules/gulp-util/lib/isBuffer.js | 7 - .../gulp-tar/node_modules/gulp-util/lib/isNull.js | 3 - .../node_modules/gulp-util/lib/isStream.js | 5 - .../gulp-tar/node_modules/gulp-util/lib/log.js | 14 - .../gulp-tar/node_modules/gulp-util/lib/noop.js | 5 - .../node_modules/gulp-util/lib/template.js | 23 - .../gulp-util/node_modules/.bin/dateformat | 1 - .../gulp-util/node_modules/object-assign/index.js | 39 - .../gulp-util/node_modules/object-assign/license | 21 - .../node_modules/object-assign/package.json | 38 - .../gulp-util/node_modules/object-assign/readme.md | 51 - .../gulp-tar/node_modules/gulp-util/package.json | 51 - .../node_modules/lodash._reinterpolate/LICENSE.txt | 22 - .../node_modules/lodash._reinterpolate/README.md | 20 - .../node_modules/lodash._reinterpolate/index.js | 13 - .../lodash._reinterpolate/package.json | 18 - .../gulp-tar/node_modules/lodash.template/LICENSE | 22 - .../node_modules/lodash.template/README.md | 20 - .../gulp-tar/node_modules/lodash.template/index.js | 389 - .../node_modules/lodash.template/package.json | 30 - .../gulp-tar/node_modules/replace-ext/.npmignore | 6 - .../gulp-tar/node_modules/replace-ext/.travis.yml | 8 - .../gulp-tar/node_modules/replace-ext/LICENSE | 20 - .../gulp-tar/node_modules/replace-ext/README.md | 44 - .../gulp-tar/node_modules/replace-ext/index.js | 9 - .../gulp-tar/node_modules/replace-ext/package.json | 35 - .../gulp-tar/node_modules/replace-ext/test/main.js | 51 - node_modules/gulp-tar/node_modules/vinyl/LICENSE | 20 - node_modules/gulp-tar/node_modules/vinyl/README.md | 195 - node_modules/gulp-tar/node_modules/vinyl/index.js | 213 - .../gulp-tar/node_modules/vinyl/lib/cloneBuffer.js | 7 - .../node_modules/vinyl/lib/inspectStream.js | 11 - .../gulp-tar/node_modules/vinyl/lib/isBuffer.js | 1 - .../gulp-tar/node_modules/vinyl/lib/isNull.js | 3 - .../gulp-tar/node_modules/vinyl/lib/isStream.js | 5 - .../gulp-tar/node_modules/vinyl/package.json | 37 - .../node_modules/clone-stats/LICENSE.md | 21 - .../node_modules/clone-stats/README.md | 17 - .../node_modules/clone-stats/index.js | 13 - .../node_modules/clone-stats/package.json | 31 - .../node_modules/clone-stats/test.js | 36 - .../gulp-typescript/node_modules/gulp-util/LICENSE | 20 - .../node_modules/gulp-util/README.md | 146 - .../node_modules/gulp-util/index.js | 18 - .../node_modules/gulp-util/lib/PluginError.js | 130 - .../node_modules/gulp-util/lib/buffer.js | 15 - .../node_modules/gulp-util/lib/combine.js | 11 - .../node_modules/gulp-util/lib/env.js | 4 - .../node_modules/gulp-util/lib/isBuffer.js | 7 - .../node_modules/gulp-util/lib/isNull.js | 3 - .../node_modules/gulp-util/lib/isStream.js | 5 - .../node_modules/gulp-util/lib/log.js | 14 - .../node_modules/gulp-util/lib/noop.js | 5 - .../node_modules/gulp-util/lib/template.js | 23 - .../gulp-util/node_modules/.bin/dateformat | 1 - .../node_modules/gulp-util/package.json | 51 - .../node_modules/lodash._reinterpolate/LICENSE.txt | 22 - .../node_modules/lodash._reinterpolate/README.md | 20 - .../node_modules/lodash._reinterpolate/index.js | 13 - .../lodash._reinterpolate/package.json | 18 - .../node_modules/lodash.template/LICENSE | 22 - .../node_modules/lodash.template/README.md | 20 - .../node_modules/lodash.template/index.js | 389 - .../node_modules/lodash.template/package.json | 30 - .../node_modules/object-assign/index.js | 39 - .../node_modules/object-assign/license | 21 - .../node_modules/object-assign/package.json | 38 - .../node_modules/object-assign/readme.md | 51 - .../node_modules/replace-ext/.npmignore | 6 - .../node_modules/replace-ext/.travis.yml | 8 - .../node_modules/replace-ext/LICENSE | 20 - .../node_modules/replace-ext/README.md | 44 - .../node_modules/replace-ext/index.js | 9 - .../node_modules/replace-ext/package.json | 35 - .../node_modules/replace-ext/test/main.js | 51 - .../gulp-typescript/node_modules/vinyl/LICENSE | 20 - .../gulp-typescript/node_modules/vinyl/README.md | 195 - .../gulp-typescript/node_modules/vinyl/index.js | 213 - .../node_modules/vinyl/lib/cloneBuffer.js | 7 - .../node_modules/vinyl/lib/inspectStream.js | 11 - .../node_modules/vinyl/lib/isBuffer.js | 1 - .../node_modules/vinyl/lib/isNull.js | 3 - .../node_modules/vinyl/lib/isStream.js | 5 - .../node_modules/vinyl/package.json | 37 - node_modules/gulp-typescript/package.json | 5 +- node_modules/gulp-typescript/release/compiler.d.ts | 4 +- node_modules/gulp-typescript/release/compiler.js | 101 +- node_modules/gulp-typescript/release/output.js | 4 +- node_modules/gulp-typescript/release/project.d.ts | 1 + node_modules/gulp-typescript/release/project.js | 1 + node_modules/gulp-util/.npmignore | 7 - node_modules/gulp-util/.travis.yml | 5 - node_modules/gulp-util/README.md | 33 +- node_modules/gulp-util/index.js | 14 +- node_modules/gulp-util/lib/File.js | 1 - node_modules/gulp-util/lib/PluginError.js | 114 +- node_modules/gulp-util/lib/beep.js | 3 - node_modules/gulp-util/lib/buffer.js | 2 +- node_modules/gulp-util/lib/colors.js | 1 - node_modules/gulp-util/lib/date.js | 1 - node_modules/gulp-util/lib/env.js | 2 +- node_modules/gulp-util/lib/isBuffer.js | 2 +- node_modules/gulp-util/lib/isNull.js | 2 +- node_modules/gulp-util/lib/isStream.js | 2 +- node_modules/gulp-util/lib/linefeed.js | 1 - node_modules/gulp-util/lib/log.js | 16 +- node_modules/gulp-util/lib/replaceExtension.js | 9 - node_modules/gulp-util/lib/template.js | 14 +- .../gulp-util/node_modules/.bin/dateformat | 1 - .../gulp-util/node_modules/ansi-regex/index.js | 4 - .../gulp-util/node_modules/ansi-regex/package.json | 51 - .../gulp-util/node_modules/ansi-regex/readme.md | 33 - .../gulp-util/node_modules/ansi-styles/index.js | 40 - .../node_modules/ansi-styles/package.json | 46 - .../gulp-util/node_modules/ansi-styles/readme.md | 70 - node_modules/gulp-util/node_modules/chalk/index.js | 95 - .../node_modules/chalk/node_modules/.bin/has-ansi | 1 - .../chalk/node_modules/.bin/strip-ansi | 1 - .../chalk/node_modules/.bin/supports-color | 1 - .../gulp-util/node_modules/chalk/package.json | 53 - .../gulp-util/node_modules/chalk/readme.md | 175 - .../gulp-util/node_modules/clone-stats/LICENSE.md | 21 - .../gulp-util/node_modules/clone-stats/README.md | 17 - .../gulp-util/node_modules/clone-stats/index.js | 13 - .../node_modules/clone-stats/package.json | 31 - .../gulp-util/node_modules/clone-stats/test.js | 36 - .../gulp-util/node_modules/has-ansi/cli.js | 53 - .../gulp-util/node_modules/has-ansi/index.js | 4 - .../gulp-util/node_modules/has-ansi/package.json | 57 - .../gulp-util/node_modules/has-ansi/readme.md | 45 - .../gulp-util/node_modules/isarray/README.md | 54 - .../gulp-util/node_modules/isarray/build/build.js | 209 - .../gulp-util/node_modules/isarray/component.json | 19 - .../gulp-util/node_modules/isarray/index.js | 3 - .../gulp-util/node_modules/isarray/package.json | 25 - .../gulp-util/node_modules/minimist/.travis.yml | 4 - .../gulp-util/node_modules/minimist/LICENSE | 18 - .../node_modules/minimist/example/parse.js | 2 - .../gulp-util/node_modules/minimist/index.js | 200 - .../gulp-util/node_modules/minimist/package.json | 40 - .../node_modules/minimist/readme.markdown | 86 - .../node_modules/minimist/test/all_bool.js | 32 - .../gulp-util/node_modules/minimist/test/bool.js | 119 - .../gulp-util/node_modules/minimist/test/dash.js | 31 - .../node_modules/minimist/test/default_bool.js | 20 - .../gulp-util/node_modules/minimist/test/dotted.js | 22 - .../gulp-util/node_modules/minimist/test/long.js | 31 - .../gulp-util/node_modules/minimist/test/num.js | 36 - .../gulp-util/node_modules/minimist/test/parse.js | 197 - .../node_modules/minimist/test/parse_modified.js | 9 - .../gulp-util/node_modules/minimist/test/short.js | 67 - .../node_modules/minimist/test/whitespace.js | 8 - .../node_modules/readable-stream/.npmignore | 5 - .../gulp-util/node_modules/readable-stream/LICENSE | 18 - .../node_modules/readable-stream/README.md | 15 - .../node_modules/readable-stream/duplex.js | 1 - .../readable-stream/lib/_stream_duplex.js | 89 - .../readable-stream/lib/_stream_passthrough.js | 46 - .../readable-stream/lib/_stream_readable.js | 982 - .../readable-stream/lib/_stream_transform.js | 210 - .../readable-stream/lib/_stream_writable.js | 386 - .../node_modules/readable-stream/package.json | 32 - .../node_modules/readable-stream/passthrough.js | 1 - .../node_modules/readable-stream/readable.js | 11 - .../node_modules/readable-stream/transform.js | 1 - .../node_modules/readable-stream/writable.js | 1 - .../gulp-util/node_modules/strip-ansi/cli.js | 39 - .../gulp-util/node_modules/strip-ansi/index.js | 6 - .../gulp-util/node_modules/strip-ansi/package.json | 56 - .../gulp-util/node_modules/strip-ansi/readme.md | 43 - .../gulp-util/node_modules/supports-color/cli.js | 28 - .../gulp-util/node_modules/supports-color/index.js | 32 - .../node_modules/supports-color/package.json | 50 - .../node_modules/supports-color/readme.md | 44 - .../gulp-util/node_modules/through2/.npmignore | 3 - .../gulp-util/node_modules/through2/LICENSE | 39 - .../gulp-util/node_modules/through2/README.md | 140 - .../gulp-util/node_modules/through2/package.json | 32 - .../gulp-util/node_modules/through2/through2.js | 78 - .../gulp-util/node_modules/vinyl/.npmignore | 6 - .../gulp-util/node_modules/vinyl/.travis.yml | 6 - node_modules/gulp-util/node_modules/vinyl/LICENSE | 0 .../gulp-util/node_modules/vinyl/README.md | 156 +- node_modules/gulp-util/node_modules/vinyl/index.js | 125 +- .../node_modules/vinyl/lib/cloneBuffer.js | 2 +- .../node_modules/vinyl/lib/inspectStream.js | 5 +- .../gulp-util/node_modules/vinyl/lib/isBuffer.js | 8 +- .../gulp-util/node_modules/vinyl/lib/isNull.js | 2 +- .../gulp-util/node_modules/vinyl/package.json | 40 +- .../gulp-util/node_modules/vinyl/test/File.js | 540 - .../node_modules/vinyl/test/cloneBuffer.js | 28 - .../node_modules/vinyl/test/inspectStream.js | 53 - .../gulp-util/node_modules/vinyl/test/isBuffer.js | 29 - .../gulp-util/node_modules/vinyl/test/isNull.js | 23 - .../gulp-util/node_modules/vinyl/test/isStream.js | 29 - .../gulp-util/node_modules/xtend/.jshintrc | 30 - .../gulp-util/node_modules/xtend/.npmignore | 1 - node_modules/gulp-util/node_modules/xtend/LICENCE | 19 - node_modules/gulp-util/node_modules/xtend/Makefile | 4 - .../gulp-util/node_modules/xtend/README.md | 28 - node_modules/gulp-util/node_modules/xtend/index.js | 17 - .../gulp-util/node_modules/xtend/mutable.js | 15 - .../gulp-util/node_modules/xtend/package.json | 60 - node_modules/gulp-util/node_modules/xtend/test.js | 63 - node_modules/gulp-util/package.json | 69 +- .../gulp-zip/node_modules/clone-stats/LICENSE.md | 21 - .../gulp-zip/node_modules/clone-stats/README.md | 17 - .../gulp-zip/node_modules/clone-stats/index.js | 13 - .../gulp-zip/node_modules/clone-stats/package.json | 31 - .../gulp-zip/node_modules/clone-stats/test.js | 36 - .../gulp-zip/node_modules/gulp-util/LICENSE | 20 - .../gulp-zip/node_modules/gulp-util/README.md | 146 - .../gulp-zip/node_modules/gulp-util/index.js | 18 - .../node_modules/gulp-util/lib/PluginError.js | 130 - .../gulp-zip/node_modules/gulp-util/lib/buffer.js | 15 - .../gulp-zip/node_modules/gulp-util/lib/combine.js | 11 - .../gulp-zip/node_modules/gulp-util/lib/env.js | 4 - .../node_modules/gulp-util/lib/isBuffer.js | 7 - .../gulp-zip/node_modules/gulp-util/lib/isNull.js | 3 - .../node_modules/gulp-util/lib/isStream.js | 5 - .../gulp-zip/node_modules/gulp-util/lib/log.js | 14 - .../gulp-zip/node_modules/gulp-util/lib/noop.js | 5 - .../node_modules/gulp-util/lib/template.js | 23 - .../gulp-util/node_modules/.bin/dateformat | 1 - .../gulp-zip/node_modules/gulp-util/package.json | 51 - .../node_modules/lodash._reinterpolate/LICENSE.txt | 22 - .../node_modules/lodash._reinterpolate/README.md | 20 - .../node_modules/lodash._reinterpolate/index.js | 13 - .../lodash._reinterpolate/package.json | 18 - .../gulp-zip/node_modules/lodash.template/LICENSE | 22 - .../node_modules/lodash.template/README.md | 20 - .../gulp-zip/node_modules/lodash.template/index.js | 389 - .../node_modules/lodash.template/package.json | 30 - .../gulp-zip/node_modules/object-assign/index.js | 39 - .../gulp-zip/node_modules/object-assign/license | 21 - .../node_modules/object-assign/package.json | 38 - .../gulp-zip/node_modules/object-assign/readme.md | 51 - .../gulp-zip/node_modules/replace-ext/.npmignore | 6 - .../gulp-zip/node_modules/replace-ext/.travis.yml | 8 - .../gulp-zip/node_modules/replace-ext/LICENSE | 20 - .../gulp-zip/node_modules/replace-ext/README.md | 44 - .../gulp-zip/node_modules/replace-ext/index.js | 9 - .../gulp-zip/node_modules/replace-ext/package.json | 35 - .../gulp-zip/node_modules/replace-ext/test/main.js | 51 - node_modules/gulp-zip/node_modules/vinyl/LICENSE | 20 - node_modules/gulp-zip/node_modules/vinyl/README.md | 195 - node_modules/gulp-zip/node_modules/vinyl/index.js | 213 - .../gulp-zip/node_modules/vinyl/lib/cloneBuffer.js | 7 - .../node_modules/vinyl/lib/inspectStream.js | 11 - .../gulp-zip/node_modules/vinyl/lib/isBuffer.js | 1 - .../gulp-zip/node_modules/vinyl/lib/isNull.js | 3 - .../gulp-zip/node_modules/vinyl/lib/isStream.js | 5 - .../gulp-zip/node_modules/vinyl/package.json | 37 - node_modules/gulp/node_modules/.bin/semver | 2 +- .../gulp/node_modules/clone-stats/LICENSE.md | 21 - .../gulp/node_modules/clone-stats/README.md | 17 - .../gulp/node_modules/clone-stats/index.js | 13 - .../gulp/node_modules/clone-stats/package.json | 31 - node_modules/gulp/node_modules/clone-stats/test.js | 36 - node_modules/gulp/node_modules/gulp-util/LICENSE | 20 - node_modules/gulp/node_modules/gulp-util/README.md | 146 - node_modules/gulp/node_modules/gulp-util/index.js | 18 - .../gulp/node_modules/gulp-util/lib/PluginError.js | 130 - .../gulp/node_modules/gulp-util/lib/buffer.js | 15 - .../gulp/node_modules/gulp-util/lib/combine.js | 11 - .../gulp/node_modules/gulp-util/lib/env.js | 4 - .../gulp/node_modules/gulp-util/lib/isBuffer.js | 7 - .../gulp/node_modules/gulp-util/lib/isNull.js | 3 - .../gulp/node_modules/gulp-util/lib/isStream.js | 5 - .../gulp/node_modules/gulp-util/lib/log.js | 14 - .../gulp/node_modules/gulp-util/lib/noop.js | 5 - .../gulp/node_modules/gulp-util/lib/template.js | 23 - .../gulp-util/node_modules/.bin/dateformat | 1 - .../gulp-util/node_modules/clone/.npmignore | 1 - .../gulp-util/node_modules/clone/.travis.yml | 3 - .../gulp-util/node_modules/clone/LICENSE | 18 - .../gulp-util/node_modules/clone/README.md | 126 - .../gulp-util/node_modules/clone/clone.js | 160 - .../gulp-util/node_modules/clone/package.json | 51 - .../node_modules/clone/test-apart-ctx.html | 22 - .../gulp-util/node_modules/clone/test.html | 148 - .../gulp-util/node_modules/clone/test.js | 372 - .../node_modules/readable-stream/.npmignore | 5 - .../node_modules/readable-stream/.travis.yml | 52 - .../node_modules/readable-stream/.zuul.yml | 1 - .../gulp-util/node_modules/readable-stream/LICENSE | 18 - .../node_modules/readable-stream/README.md | 36 - .../readable-stream/doc/stream.markdown | 1760 - .../readable-stream/doc/wg-meetings/2015-01-30.md | 60 - .../node_modules/readable-stream/duplex.js | 1 - .../readable-stream/lib/_stream_duplex.js | 75 - .../readable-stream/lib/_stream_passthrough.js | 26 - .../readable-stream/lib/_stream_readable.js | 880 - .../readable-stream/lib/_stream_transform.js | 180 - .../readable-stream/lib/_stream_writable.js | 516 - .../node_modules/readable-stream/package.json | 37 - .../node_modules/readable-stream/passthrough.js | 1 - .../node_modules/readable-stream/readable.js | 12 - .../node_modules/readable-stream/transform.js | 1 - .../node_modules/readable-stream/writable.js | 1 - .../gulp-util/node_modules/through2/.npmignore | 3 - .../gulp-util/node_modules/through2/LICENSE | 39 - .../gulp-util/node_modules/through2/README.md | 133 - .../gulp-util/node_modules/through2/package.json | 32 - .../gulp-util/node_modules/through2/through2.js | 96 - .../gulp-util/node_modules/vinyl/LICENSE | 20 - .../gulp-util/node_modules/vinyl/README.md | 195 - .../gulp-util/node_modules/vinyl/index.js | 213 - .../node_modules/vinyl/lib/cloneBuffer.js | 7 - .../node_modules/vinyl/lib/inspectStream.js | 11 - .../gulp-util/node_modules/vinyl/lib/isBuffer.js | 1 - .../gulp-util/node_modules/vinyl/lib/isNull.js | 3 - .../gulp-util/node_modules/vinyl/lib/isStream.js | 5 - .../gulp-util/node_modules/vinyl/package.json | 37 - .../gulp/node_modules/gulp-util/package.json | 51 - .../node_modules/lodash._reinterpolate/LICENSE.txt | 22 - .../node_modules/lodash._reinterpolate/README.md | 20 - .../node_modules/lodash._reinterpolate/index.js | 13 - .../lodash._reinterpolate/package.json | 18 - .../gulp/node_modules/lodash.template/LICENSE | 22 - .../gulp/node_modules/lodash.template/README.md | 20 - .../gulp/node_modules/lodash.template/index.js | 389 - .../gulp/node_modules/lodash.template/package.json | 30 - .../gulp/node_modules/object-assign/index.js | 39 - .../gulp/node_modules/object-assign/license | 21 - .../gulp/node_modules/object-assign/package.json | 38 - .../gulp/node_modules/object-assign/readme.md | 51 - .../gulp/node_modules/replace-ext/.npmignore | 6 - .../gulp/node_modules/replace-ext/.travis.yml | 8 - node_modules/gulp/node_modules/replace-ext/LICENSE | 20 - .../gulp/node_modules/replace-ext/README.md | 44 - .../gulp/node_modules/replace-ext/index.js | 9 - .../gulp/node_modules/replace-ext/package.json | 35 - .../gulp/node_modules/replace-ext/test/main.js | 51 - node_modules/hosted-git-info/.npmignore | 2 - node_modules/hosted-git-info/README.md | 61 +- node_modules/hosted-git-info/git-host-info.js | 16 +- node_modules/hosted-git-info/git-host.js | 84 +- node_modules/hosted-git-info/index.js | 56 +- node_modules/hosted-git-info/package.json | 15 +- node_modules/iconv-lite/.travis.yml | 14 +- node_modules/iconv-lite/Changelog.md | 15 + node_modules/iconv-lite/README.md | 4 +- node_modules/iconv-lite/encodings/dbcs-data.js | 22 +- node_modules/iconv-lite/encodings/utf16.js | 2 + node_modules/iconv-lite/package.json | 9 +- node_modules/interpret/CHANGELOG | 12 + node_modules/interpret/README.md | 11 +- node_modules/interpret/index.js | 17 +- node_modules/interpret/package.json | 2 +- node_modules/is-buffer/.travis.yml | 8 - node_modules/is-buffer/.zuul.yml | 14 - node_modules/is-buffer/package.json | 4 +- node_modules/is-unc-path/LICENSE | 2 +- node_modules/is-unc-path/README.md | 151 +- node_modules/is-unc-path/package.json | 39 +- node_modules/isexe/README.md | 14 +- node_modules/isexe/access.js | 15 - node_modules/isexe/index.js | 2 - node_modules/isexe/mode.js | 10 +- node_modules/isexe/package.json | 9 +- node_modules/isexe/test/basic.js | 10 + node_modules/isexe/windows.js | 14 +- node_modules/istanbul-lib-coverage/CHANGELOG.md | 16 +- node_modules/istanbul-lib-coverage/README.md | 1 + node_modules/istanbul-lib-coverage/lib/file.js | 4 + node_modules/istanbul-lib-coverage/package.json | 12 +- node_modules/istanbul-lib-instrument/CHANGELOG.md | 70 +- .../istanbul-lib-instrument/dist/instrumenter.js | 3 +- .../dist/source-coverage.js | 8 +- .../istanbul-lib-instrument/dist/visitor.js | 11 + .../node_modules/.bin/semver | 2 +- .../node_modules/semver/LICENSE | 15 - .../node_modules/semver/README.md | 350 - .../node_modules/semver/bin/semver | 133 - .../node_modules/semver/package.json | 22 - .../node_modules/semver/range.bnf | 16 - .../node_modules/semver/semver.js | 1203 - node_modules/istanbul-lib-instrument/package.json | 24 +- node_modules/js-tokens/LICENSE | 2 +- node_modules/js-tokens/changelog.md | 82 - node_modules/js-tokens/index.js | 12 +- node_modules/js-tokens/package.json | 8 +- node_modules/js-tokens/readme.md | 217 - node_modules/kind-of/README.md | 17 +- node_modules/kind-of/index.js | 3 + node_modules/kind-of/package.json | 12 +- .../node_modules/lodash.keys/LICENSE.txt | 22 - .../node_modules/lodash.keys/README.md | 15 - .../node_modules/lodash.keys/index.js | 36 - .../node_modules/lodash.keys/package.json | 22 - .../node_modules/lodash.keys/LICENSE.txt | 22 - .../node_modules/lodash.keys/README.md | 15 - .../node_modules/lodash.keys/index.js | 36 - .../node_modules/lodash.keys/package.json | 22 - node_modules/lodash.escape/LICENSE | 22 - node_modules/lodash.escape/README.md | 23 +- node_modules/lodash.escape/index.js | 181 +- node_modules/lodash.escape/package.json | 22 +- node_modules/lodash.isequal/LICENSE | 2 +- node_modules/lodash.isequal/README.md | 6 +- node_modules/lodash.isequal/index.js | 497 +- node_modules/lodash.isequal/package.json | 5 +- node_modules/lodash.keys/LICENSE | 22 - node_modules/lodash.keys/README.md | 25 +- node_modules/lodash.keys/index.js | 240 +- node_modules/lodash.keys/package.json | 22 +- node_modules/lodash.template/LICENSE.txt | 22 - node_modules/lodash.template/README.md | 25 +- node_modules/lodash.template/index.js | 387 +- .../node_modules/lodash.escape/LICENSE.txt | 22 - .../node_modules/lodash.escape/README.md | 23 +- .../node_modules/lodash.escape/index.js | 181 +- .../node_modules/lodash.escape/package.json | 22 +- .../node_modules/lodash.keys/LICENSE.txt | 22 - .../node_modules/lodash.keys/README.md | 25 +- .../node_modules/lodash.keys/index.js | 240 +- .../node_modules/lodash.keys/package.json | 22 +- .../lodash.templatesettings/LICENSE.txt | 22 - .../node_modules/lodash.templatesettings/README.md | 15 - .../node_modules/lodash.templatesettings/index.js | 73 - .../lodash.templatesettings/package.json | 21 - node_modules/lodash.template/package.json | 32 +- .../node_modules/lodash.keys/LICENSE.txt | 22 - .../node_modules/lodash.keys/README.md | 15 - .../node_modules/lodash.keys/index.js | 36 - .../node_modules/lodash.keys/package.json | 22 - node_modules/lodash/README.md | 6 +- node_modules/lodash/_assignInDefaults.js | 27 - node_modules/lodash/_baseGetTag.js | 3 +- node_modules/lodash/_baseIsEqual.js | 3 +- node_modules/lodash/_baseIsEqualDeep.js | 15 +- node_modules/lodash/_basePick.js | 1 - node_modules/lodash/_basePickBy.js | 5 +- node_modules/lodash/_basePullAt.js | 17 +- node_modules/lodash/_baseUnset.js | 9 +- node_modules/lodash/_createFlow.js | 6 +- node_modules/lodash/_createRound.js | 2 +- node_modules/lodash/_createWrap.js | 2 +- node_modules/lodash/_equalObjects.js | 6 +- node_modules/lodash/_getSymbols.js | 18 +- node_modules/lodash/_hashHas.js | 2 +- node_modules/lodash/_lazyValue.js | 6 +- node_modules/lodash/_mergeDefaults.js | 27 - node_modules/lodash/core.js | 67 +- node_modules/lodash/core.min.js | 44 +- node_modules/lodash/defaults.js | 6 +- node_modules/lodash/defaultsDeep.js | 4 +- node_modules/lodash/fp/_baseConvert.js | 42 +- node_modules/lodash/fp/_mapping.js | 3 +- node_modules/lodash/fp/_util.js | 1 - node_modules/lodash/isEqual.js | 2 +- node_modules/lodash/lodash.js | 222 +- node_modules/lodash/lodash.min.js | 218 +- node_modules/lodash/omit.js | 11 +- node_modules/lodash/package.json | 2 +- node_modules/lodash/result.js | 2 +- node_modules/lodash/spread.js | 6 +- node_modules/lodash/startsWith.js | 5 +- node_modules/lodash/takeWhile.js | 2 +- node_modules/lodash/template.js | 8 +- node_modules/lodash/templateSettings.js | 4 +- node_modules/lodash/toSafeInteger.js | 4 +- node_modules/lodash/wrapperLodash.js | 6 +- node_modules/loose-envify/package.json | 4 +- node_modules/loose-envify/replace.js | 2 +- node_modules/merge-stream/README.md | 12 +- node_modules/merge-stream/index.js | 1 + node_modules/merge-stream/package.json | 3 +- .../mocha/node_modules/.bin/supports-color | 2 +- node_modules/ms/.npmignore | 5 - node_modules/ms/History.md | 66 - node_modules/ms/LICENSE | 20 - node_modules/ms/README.md | 33 +- node_modules/ms/index.js | 102 +- node_modules/ms/package.json | 34 +- node_modules/normalize-package-data/.npmignore | 2 +- node_modules/normalize-package-data/AUTHORS | 2 +- node_modules/normalize-package-data/LICENSE | 2 +- node_modules/normalize-package-data/README.md | 13 +- .../normalize-package-data/lib/make_warning.js | 2 +- .../normalize-package-data/lib/normalize.js | 6 +- .../normalize-package-data/lib/safe_format.js | 2 +- node_modules/normalize-package-data/lib/typos.json | 2 +- .../node_modules/.bin/semver | 2 +- .../node_modules/semver/LICENSE | 15 - .../node_modules/semver/README.md | 350 - .../node_modules/semver/bin/semver | 133 - .../node_modules/semver/package.json | 22 - .../node_modules/semver/range.bnf | 16 - .../node_modules/semver/semver.js | 1203 - node_modules/normalize-package-data/package.json | 2 +- .../normalize-package-data/test/consistency.js | 4 +- .../normalize-package-data/test/dependencies.js | 4 +- .../test/fixtures/async.json | 2 +- .../test/fixtures/bcrypt.json | 2 +- .../test/fixtures/coffee-script.json | 2 +- .../test/fixtures/http-server.json | 8 +- .../test/fixtures/movefile.json | 2 +- .../test/fixtures/no-description.json | 2 +- .../test/fixtures/node-module_exist.json | 2 +- .../normalize-package-data/test/fixtures/npm.json | 2 +- .../test/fixtures/request.json | 2 +- .../test/fixtures/underscore.json | 2 +- .../normalize-package-data/test/normalize.js | 6 - .../normalize-package-data/test/normalize.js~ | 253 - node_modules/normalize-package-data/test/typo.js | 2 +- node_modules/normalize-path/LICENSE | 2 +- node_modules/normalize-path/README.md | 73 +- node_modules/normalize-path/index.js | 8 +- node_modules/normalize-path/package.json | 29 +- node_modules/object-assign/index.js | 15 +- node_modules/object-assign/package.json | 12 +- node_modules/object-assign/readme.md | 11 +- node_modules/osenv/.npmignore | 13 - node_modules/osenv/.travis.yml | 9 - node_modules/osenv/LICENSE | 15 - node_modules/osenv/README.md | 63 - node_modules/osenv/osenv.js | 72 - node_modules/osenv/package.json | 31 - node_modules/osenv/test/unix.js | 71 - node_modules/osenv/test/windows.js | 74 - node_modules/osenv/x.tap | 39 - node_modules/randomatic/LICENSE | 2 +- node_modules/randomatic/README.md | 66 +- node_modules/randomatic/package.json | 27 +- node_modules/readable-stream/.npmignore | 6 +- node_modules/readable-stream/.travis.yml | 15 +- node_modules/readable-stream/LICENSE | 29 + node_modules/readable-stream/README.md | 29 +- node_modules/readable-stream/duplex.js | 2 +- .../readable-stream/lib/_stream_readable.js | 305 +- .../readable-stream/lib/_stream_transform.js | 16 +- .../readable-stream/lib/_stream_writable.js | 112 +- node_modules/readable-stream/package.json | 33 +- node_modules/readable-stream/passthrough.js | 2 +- node_modules/readable-stream/readable.js | 31 +- node_modules/readable-stream/transform.js | 2 +- node_modules/readable-stream/writable.js | 9 +- node_modules/regenerator-runtime/package.json | 2 +- node_modules/regenerator-runtime/runtime.js | 266 +- node_modules/replace-ext/LICENSE | 35 +- node_modules/replace-ext/README.md | 62 +- node_modules/replace-ext/index.js | 19 +- node_modules/replace-ext/package.json | 65 +- node_modules/rimraf/bin.js | 16 +- node_modules/rimraf/package.json | 4 +- node_modules/rimraf/rimraf.js | 24 +- node_modules/sax/LICENSE-W3C.html | 188 - node_modules/sax/lib/sax.js | 41 +- node_modules/sax/package.json | 9 +- node_modules/selenium-webdriver/CHANGES.md | 39 + node_modules/selenium-webdriver/README.md | 18 +- node_modules/selenium-webdriver/chrome.js | 6 +- node_modules/selenium-webdriver/edge.js | 2 +- node_modules/selenium-webdriver/firefox/binary.js | 171 +- .../selenium-webdriver/firefox/extension.js | 2 +- node_modules/selenium-webdriver/firefox/index.js | 88 +- node_modules/selenium-webdriver/index.js | 4 +- node_modules/selenium-webdriver/lib/README | 5 +- node_modules/selenium-webdriver/lib/actions.js | 8 +- node_modules/selenium-webdriver/lib/by.js | 2 +- .../selenium-webdriver/lib/capabilities.js | 8 +- node_modules/selenium-webdriver/lib/error.js | 19 +- node_modules/selenium-webdriver/lib/events.js | 2 +- .../lib/firefox/amd64/libnoblur64.so | Bin 41623 -> 0 bytes .../lib/firefox/i386/libnoblur.so | Bin 36934 -> 0 bytes .../selenium-webdriver/lib/firefox/webdriver.json | 3 +- .../selenium-webdriver/lib/firefox/webdriver.xpi | Bin 707042 -> 703396 bytes node_modules/selenium-webdriver/lib/http.js | 102 +- node_modules/selenium-webdriver/lib/input.js | 2 +- node_modules/selenium-webdriver/lib/promise.js | 286 +- node_modules/selenium-webdriver/lib/symbols.js | 2 +- node_modules/selenium-webdriver/lib/test/index.js | 6 + node_modules/selenium-webdriver/lib/until.js | 2 +- node_modules/selenium-webdriver/lib/webdriver.js | 24 +- node_modules/selenium-webdriver/opera.js | 2 +- node_modules/selenium-webdriver/package.json | 2 +- node_modules/selenium-webdriver/remote/index.js | 7 +- node_modules/selenium-webdriver/safari.js | 51 +- .../test/firefox/firefox_test.js | 40 +- .../selenium-webdriver/test/lib/http_test.js | 31 + .../selenium-webdriver/test/lib/promise_test.js | 19 + .../selenium-webdriver/test/lib/until_test.js | 41 +- node_modules/selenium-webdriver/testing/index.js | 21 +- node_modules/semver/.npmignore | 4 - node_modules/semver/.travis.yml | 5 - node_modules/semver/Makefile | 24 - node_modules/semver/README.md | 63 +- node_modules/semver/foot.js.txt | 6 - node_modules/semver/head.js.txt | 2 - node_modules/semver/package.json | 19 +- node_modules/semver/semver.browser.js | 1201 - node_modules/semver/semver.browser.js.gz | Bin 7992 -> 0 bytes node_modules/semver/semver.js | 46 +- node_modules/semver/semver.min.js | 1 - node_modules/semver/semver.min.js.gz | Bin 3790 -> 0 bytes node_modules/semver/test/amd.js | 15 - node_modules/semver/test/big-numbers.js | 31 - node_modules/semver/test/clean.js | 29 - node_modules/semver/test/gtr.js | 173 - node_modules/semver/test/index.js | 685 - node_modules/semver/test/ltr.js | 181 - node_modules/semver/test/major-minor-patch.js | 72 - node_modules/semver/test/no-module.js | 19 - node_modules/signal-exit/index.js | 9 + node_modules/signal-exit/package.json | 4 +- node_modules/supports-color/index.js | 81 +- node_modules/supports-color/package.json | 41 +- node_modules/supports-color/readme.md | 42 +- node_modules/systemjs/README.md | 3 + .../systemjs/dist/system-csp-production.js | 6 +- .../systemjs/dist/system-csp-production.js.map | 2 +- .../systemjs/dist/system-csp-production.src.js | 162 +- node_modules/systemjs/dist/system-polyfills.js | 2 +- node_modules/systemjs/dist/system-polyfills.js.map | 2 +- node_modules/systemjs/dist/system-register-only.js | 4 +- .../systemjs/dist/system-register-only.js.map | 2 +- .../systemjs/dist/system-register-only.src.js | 99 +- node_modules/systemjs/dist/system.js | 6 +- node_modules/systemjs/dist/system.js.map | 2 +- node_modules/systemjs/dist/system.src.js | 188 +- node_modules/systemjs/index.js | 11 +- node_modules/systemjs/package.json | 2 +- node_modules/through2/LICENSE | 39 - node_modules/through2/README.md | 3 + node_modules/through2/package.json | 10 +- node_modules/typescript/.mailmap | 82 +- node_modules/typescript/.npmignore | 3 + node_modules/typescript/AUTHORS.md | 68 + node_modules/typescript/Gulpfile.ts | 1046 - node_modules/typescript/README.md | 8 +- node_modules/typescript/lib/README.md | 10 +- node_modules/typescript/lib/cancellationToken.js | 52 +- node_modules/typescript/lib/lib.d.ts | 37891 +++++++------- node_modules/typescript/lib/lib.dom.d.ts | 28794 ++++++----- node_modules/typescript/lib/lib.dom.iterable.d.ts | 125 +- .../typescript/lib/lib.es2015.collection.d.ts | 176 +- node_modules/typescript/lib/lib.es2015.core.d.ts | 1098 +- node_modules/typescript/lib/lib.es2015.d.ts | 50 +- .../typescript/lib/lib.es2015.generator.d.ts | 96 +- .../typescript/lib/lib.es2015.iterable.d.ts | 968 +- .../typescript/lib/lib.es2015.promise.d.ts | 487 +- node_modules/typescript/lib/lib.es2015.proxy.d.ts | 76 +- .../typescript/lib/lib.es2015.reflect.d.ts | 62 +- node_modules/typescript/lib/lib.es2015.symbol.d.ts | 110 +- .../lib/lib.es2015.symbol.wellknown.d.ts | 694 +- .../typescript/lib/lib.es2016.array.include.d.ts | 217 +- node_modules/typescript/lib/lib.es2016.d.ts | 34 +- node_modules/typescript/lib/lib.es2017.d.ts | 40 +- node_modules/typescript/lib/lib.es2017.object.d.ts | 79 +- .../typescript/lib/lib.es2017.sharedmemory.d.ts | 92 +- node_modules/typescript/lib/lib.es5.d.ts | 8537 +-- node_modules/typescript/lib/lib.es6.d.ts | 41454 ++++++++------- node_modules/typescript/lib/lib.scripthost.d.ts | 622 +- node_modules/typescript/lib/lib.webworker.d.ts | 3135 +- node_modules/typescript/lib/protocol.d.ts | 1031 +- node_modules/typescript/lib/tsc.js | 24646 +++++---- node_modules/typescript/lib/tsserver.js | 51506 +++++++++++-------- node_modules/typescript/lib/tsserverlibrary.d.ts | 15255 ++---- node_modules/typescript/lib/tsserverlibrary.js | 42439 +++++++++------ node_modules/typescript/lib/typescript.d.ts | 1641 +- node_modules/typescript/lib/typescript.js | 38996 ++++++++------ .../typescript/lib/typescriptServices.d.ts | 1641 +- node_modules/typescript/lib/typescriptServices.js | 38996 ++++++++------ node_modules/typescript/lib/typingsInstaller.js | 2439 +- node_modules/typescript/package.json | 6 +- node_modules/v8flags/README.md | 2 + node_modules/v8flags/index.js | 8 +- node_modules/v8flags/package.json | 2 +- .../vinyl-fs/node_modules/clone-stats/LICENSE.md | 21 - .../vinyl-fs/node_modules/clone-stats/README.md | 17 - .../vinyl-fs/node_modules/clone-stats/index.js | 13 - .../vinyl-fs/node_modules/clone-stats/package.json | 31 - .../vinyl-fs/node_modules/clone-stats/test.js | 36 - .../vinyl-fs/node_modules/replace-ext/.npmignore | 6 - .../vinyl-fs/node_modules/replace-ext/.travis.yml | 8 - .../vinyl-fs/node_modules/replace-ext/LICENSE | 20 - .../vinyl-fs/node_modules/replace-ext/README.md | 44 - .../vinyl-fs/node_modules/replace-ext/index.js | 9 - .../vinyl-fs/node_modules/replace-ext/package.json | 35 - .../vinyl-fs/node_modules/replace-ext/test/main.js | 51 - node_modules/vinyl/index.js | 2 + node_modules/vinyl/package.json | 4 +- node_modules/when/dist/browser/when.debug.js | 70 +- node_modules/when/dist/browser/when.debug.js.map | 10 +- node_modules/when/dist/browser/when.js | 70 +- node_modules/when/dist/browser/when.js.map | 10 +- node_modules/when/dist/browser/when.min.js | 4 +- node_modules/when/dist/browser/when.min.js.map | 2 +- node_modules/when/es6-shim/Promise.js | 52 +- node_modules/when/es6-shim/Promise.js.map | 8 +- node_modules/when/es6-shim/Promise.min.js | 4 +- node_modules/when/es6-shim/Promise.min.js.map | 2 +- node_modules/when/lib/decorators/array.js | 18 +- node_modules/when/lib/env.js | 4 +- node_modules/when/lib/makePromise.js | 48 +- node_modules/when/package.json | 18 +- node_modules/which/CHANGELOG.md | 12 + node_modules/which/package.json | 6 +- node_modules/zip-stream/README.md | 8 +- node_modules/zip-stream/index.js | 2 +- node_modules/zip-stream/package.json | 9 +- package.json | 13 +- pogen/.gitignore | 1 - pogen/dumpTree.ts | 51 - pogen/example/messages.po | 107 - pogen/example/test.ts | 63 - pogen/example/test2.tsx | 15 - pogen/pogen.ts | 393 - pogen/tsconfig.json | 11 - src/background/background.html | 4 +- src/background/background.ts | 19 +- src/components.ts | 2 + src/content_scripts/notify.ts | 22 +- src/cryptoApi-test.ts | 4 +- src/cryptoApi.ts | 18 +- src/cryptoLib.ts | 359 - src/cryptoWorker.ts | 365 +- src/emscripten/taler-emscripten-lib.d.ts | 28 +- src/emscripten/taler-emscripten-lib.js | 24 +- src/emscriptif-test.ts | 2 +- src/emscriptif.ts | 30 +- src/helpers-test.ts | 2 +- src/helpers.ts | 6 +- src/http.ts | 28 +- src/i18n.tsx | 10 +- src/logging.ts | 2 +- src/moduleTrampoline.ts | 80 - src/pages/add-auditor.html | 68 +- src/pages/add-auditor.tsx | 28 +- src/pages/auditors.html | 51 +- src/pages/auditors.tsx | 22 +- src/pages/confirm-contract.html | 9 +- src/pages/confirm-contract.tsx | 42 +- src/pages/confirm-create-reserve.html | 14 +- src/pages/confirm-create-reserve.tsx | 27 +- src/pages/debug.html | 13 - src/pages/error.html | 23 +- src/pages/error.tsx | 8 +- src/pages/logs.html | 39 +- src/pages/logs.tsx | 4 +- src/pages/popup.css | 84 + src/pages/popup.html | 18 + src/pages/popup.tsx | 543 + src/pages/show-db.html | 6 +- src/pages/tree.html | 39 +- src/pages/tree.tsx | 23 +- src/popup/popup.css | 84 - src/popup/popup.html | 22 - src/popup/popup.tsx | 540 - src/query.ts | 16 +- src/renderHtml.tsx | 3 +- src/types-test.ts | 2 +- src/vendor/URI.js | 2162 - src/vendor/jed.d.ts | 13 - src/vendor/jed.js | 1 - src/vendor/react-dom.dev.js | 18525 ------- src/vendor/react-dom.js | 1 - src/vendor/react-dom.min.js | 15 - src/vendor/react.dev.js | 3783 -- src/vendor/react.js | 1 - src/vendor/react.min.js | 12 - src/vendor/system-csp-production.src.js | 4536 -- src/wallet-test.ts | 2 +- src/wallet.ts | 31 +- src/wxApi.ts | 2 +- src/wxBackend.ts | 19 +- testlib/node/runtime.js | 75 - testlib/selenium/.gitignore | 2 - testlib/selenium/escodegen.browser.js | 4947 -- testlib/selenium/esprima.js | 6605 --- testlib/selenium/instrumenter.js | 1097 - testlib/selenium/runtime.js | 206 - testlib/selenium/system.js | 6 - testlib/selenium/testhost.html | 63 - testlib/talertest.ts | 120 - thirdparty/README | 24 - thirdparty/URI.js/.editorconfig | 9 - thirdparty/URI.js/.gitignore | 2 - thirdparty/URI.js/.jshintrc | 31 - thirdparty/URI.js/CHANGELOG.md | 332 - thirdparty/URI.js/Gruntfile.js | 22 - thirdparty/URI.js/LICENSE.txt | 21 - thirdparty/URI.js/README.md | 244 - thirdparty/URI.js/about-uris.html | 189 - thirdparty/URI.js/bower.json | 16 - thirdparty/URI.js/build.html | 71 - thirdparty/URI.js/build.js | 78 - thirdparty/URI.js/contributing.md | 19 - thirdparty/URI.js/docs.html | 1399 - thirdparty/URI.js/index.html | 173 - thirdparty/URI.js/jquery-1.10.2.min.js | 6 - thirdparty/URI.js/jquery-1.7.2.min.js | 4 - thirdparty/URI.js/jquery-1.8.2.min.js | 2 - thirdparty/URI.js/jquery-1.9.1.min.js | 5 - thirdparty/URI.js/jquery-uri-plugin.html | 203 - thirdparty/URI.js/package.json | 78 - thirdparty/URI.js/prettify/lang-apollo.js | 2 - thirdparty/URI.js/prettify/lang-clj.js | 18 - thirdparty/URI.js/prettify/lang-css.js | 2 - thirdparty/URI.js/prettify/lang-go.js | 1 - thirdparty/URI.js/prettify/lang-hs.js | 2 - thirdparty/URI.js/prettify/lang-lisp.js | 3 - thirdparty/URI.js/prettify/lang-lua.js | 2 - thirdparty/URI.js/prettify/lang-ml.js | 2 - thirdparty/URI.js/prettify/lang-n.js | 4 - thirdparty/URI.js/prettify/lang-proto.js | 1 - thirdparty/URI.js/prettify/lang-scala.js | 2 - thirdparty/URI.js/prettify/lang-sql.js | 2 - thirdparty/URI.js/prettify/lang-tex.js | 1 - thirdparty/URI.js/prettify/lang-vb.js | 2 - thirdparty/URI.js/prettify/lang-vhdl.js | 3 - thirdparty/URI.js/prettify/lang-wiki.js | 2 - thirdparty/URI.js/prettify/lang-xq.js | 3 - thirdparty/URI.js/prettify/lang-yaml.js | 2 - thirdparty/URI.js/prettify/prettify.css | 1 - thirdparty/URI.js/prettify/prettify.js | 28 - thirdparty/URI.js/prettify/prettify.sunburst.css | 52 - thirdparty/URI.js/screen.css | 181 - thirdparty/URI.js/screen.js | 39 - thirdparty/URI.js/src/IPv6.js | 185 - thirdparty/URI.js/src/SecondLevelDomains.js | 240 - thirdparty/URI.js/src/URI.fragmentQuery.js | 104 - thirdparty/URI.js/src/URI.fragmentURI.js | 97 - thirdparty/URI.js/src/URI.js | 2218 - thirdparty/URI.js/src/URI.min.js | 89 - thirdparty/URI.js/src/URITemplate.js | 513 - thirdparty/URI.js/src/jquery.URI.js | 234 - thirdparty/URI.js/src/jquery.URI.min.js | 7 - thirdparty/URI.js/src/punycode.js | 533 - thirdparty/URI.js/test/index.html | 26 - thirdparty/URI.js/test/pre_libs.js | 7 - thirdparty/URI.js/test/qunit/qunit-composite.css | 13 - thirdparty/URI.js/test/qunit/qunit-composite.js | 167 - thirdparty/URI.js/test/qunit/qunit.css | 244 - thirdparty/URI.js/test/qunit/qunit.js | 2212 - thirdparty/URI.js/test/test.URI.html | 26 - thirdparty/URI.js/test/test.fragmentQuery.html | 31 - thirdparty/URI.js/test/test.fragmentURI.html | 31 - thirdparty/URI.js/test/test.jQuery-1.10.html | 31 - thirdparty/URI.js/test/test.jQuery-1.7.html | 31 - thirdparty/URI.js/test/test.jQuery-1.8.html | 31 - thirdparty/URI.js/test/test.jQuery-1.9.html | 31 - thirdparty/URI.js/test/test.js | 1837 - thirdparty/URI.js/test/test_fragmentQuery.js | 59 - thirdparty/URI.js/test/test_fragmentURI.js | 61 - thirdparty/URI.js/test/test_jim.js | 146 - thirdparty/URI.js/test/test_jquery.js | 141 - thirdparty/URI.js/test/test_template.js | 411 - thirdparty/URI.js/test/urls.js | 1892 - thirdparty/URI.js/uri-template.html | 234 - thirdparty/URI.js/utils/SLDs.php | 37 - thirdparty/URI.js/utils/sld.js | 101 - thirdparty/jed/.gitignore | 1 - thirdparty/jed/.travis.yml | 4 - thirdparty/jed/LICENSE | 19 - thirdparty/jed/Makefile | 13 - thirdparty/jed/README.md | 63 - thirdparty/jed/jed.js | 1033 - thirdparty/jed/package.json | 27 - thirdparty/jed/plurals.jison | 72 - thirdparty/jed/test/common.js | 2 - thirdparty/jed/test/index.html | 24 - thirdparty/jed/test/jquery.min.js | 4 - thirdparty/jed/test/tests.js | 746 - thirdparty/systemjs/.agignore | 1 - thirdparty/systemjs/.gitignore | 3 - thirdparty/systemjs/.travis.yml | 14 - thirdparty/systemjs/LICENSE | 10 - thirdparty/systemjs/Makefile | 186 - thirdparty/systemjs/README.md | 149 - thirdparty/systemjs/bench/cjs-sample/cjs.js | 949 - thirdparty/systemjs/bench/config-example/config.js | 1474 - .../bench/config-example/normalize-data.js | 69 - .../systemjs/bench/config-example/pkg-configs.js | 972 - thirdparty/systemjs/bench/get-cjs-deps.js | 63 - thirdparty/systemjs/bench/normalize-perf.js | 67 - thirdparty/systemjs/bower.json | 17 - thirdparty/systemjs/dist/system-csp-production.js | 6 - .../systemjs/dist/system-csp-production.js.map | 1 - .../systemjs/dist/system-csp-production.src.js | 4536 -- thirdparty/systemjs/dist/system-polyfills.js | 5 - thirdparty/systemjs/dist/system-polyfills.js.map | 1 - thirdparty/systemjs/dist/system-polyfills.src.js | 1277 - thirdparty/systemjs/dist/system-register-only.js | 5 - .../systemjs/dist/system-register-only.js.map | 1 - .../systemjs/dist/system-register-only.src.js | 2198 - thirdparty/systemjs/dist/system.js | 6 - thirdparty/systemjs/dist/system.js.map | 1 - thirdparty/systemjs/dist/system.src.js | 5153 -- thirdparty/systemjs/docs/config-api.md | 292 - thirdparty/systemjs/docs/creating-plugins.md | 84 - thirdparty/systemjs/docs/es6-modules-overview.md | 108 - thirdparty/systemjs/docs/module-formats.md | 228 - thirdparty/systemjs/docs/overview.md | 166 - thirdparty/systemjs/docs/production-workflows.md | 83 - thirdparty/systemjs/docs/system-api.md | 141 - thirdparty/systemjs/index.js | 48 - thirdparty/systemjs/lib/alias.js | 38 - thirdparty/systemjs/lib/amd-helpers.js | 245 - thirdparty/systemjs/lib/amd.js | 42 - thirdparty/systemjs/lib/bundles.js | 73 - thirdparty/systemjs/lib/cjs-helpers.js | 43 - thirdparty/systemjs/lib/cjs.js | 138 - thirdparty/systemjs/lib/conditionals.js | 161 - thirdparty/systemjs/lib/core.js | 504 - thirdparty/systemjs/lib/createSystem.js | 3 - thirdparty/systemjs/lib/depCache.js | 44 - thirdparty/systemjs/lib/esm.js | 161 - thirdparty/systemjs/lib/global-eval.js | 142 - thirdparty/systemjs/lib/global-helpers.js | 147 - thirdparty/systemjs/lib/global.js | 70 - thirdparty/systemjs/lib/legacy-transpiler.js | 86 - thirdparty/systemjs/lib/loader-wrapper-end.js | 6 - thirdparty/systemjs/lib/loader-wrapper-start.js | 913 - thirdparty/systemjs/lib/meta.js | 155 - thirdparty/systemjs/lib/package.js | 596 - thirdparty/systemjs/lib/paths.js | 42 - thirdparty/systemjs/lib/perf.js | 227 - thirdparty/systemjs/lib/plugins.js | 263 - thirdparty/systemjs/lib/polyfills-bootstrap.js | 2 - thirdparty/systemjs/lib/proto.js | 268 - thirdparty/systemjs/lib/register.js | 633 - thirdparty/systemjs/lib/scriptLoader.js | 196 - thirdparty/systemjs/lib/scriptOnly.js | 17 - thirdparty/systemjs/lib/system-fetch.js | 125 - thirdparty/systemjs/lib/system-only-resolve.js | 24 - thirdparty/systemjs/lib/url-polyfill.js | 64 - thirdparty/systemjs/lib/wrapper-end.js | 47 - thirdparty/systemjs/lib/wrapper-start.js | 2 - thirdparty/systemjs/package.json | 34 - thirdparty/systemjs/test/test-babel-runtime.html | 44 - thirdparty/systemjs/test/test-babel.html | 29 - thirdparty/systemjs/test/test-babel.js | 3 - thirdparty/systemjs/test/test-csp-inline.html | 61 - thirdparty/systemjs/test/test-csp.html | 280 - thirdparty/systemjs/test/test-jsextensions.html | 112 - thirdparty/systemjs/test/test-register-only.html | 45 - thirdparty/systemjs/test/test-tracer.html | 71 - thirdparty/systemjs/test/test-traceur.html | 34 - thirdparty/systemjs/test/test-traceur.js | 3 - thirdparty/systemjs/test/test-typescript.html | 31 - thirdparty/systemjs/test/test-typescript.js | 4 - thirdparty/systemjs/test/test.js | 1462 - thirdparty/systemjs/test/tests/#.js | 1 - thirdparty/systemjs/test/tests/advanced-plugin.js | 20 - thirdparty/systemjs/test/tests/all-circular1.js | 9 - thirdparty/systemjs/test/tests/all-circular2.js | 3 - thirdparty/systemjs/test/tests/all-circular3.js | 10 - thirdparty/systemjs/test/tests/all-circular4.js | 5 - thirdparty/systemjs/test/tests/all-layers1.js | 3 - thirdparty/systemjs/test/tests/all-layers2.js | 20 - thirdparty/systemjs/test/tests/all-layers3.js | 17 - thirdparty/systemjs/test/tests/all-layers4.js | 1 - thirdparty/systemjs/test/tests/amd-bundle.js | 6 - thirdparty/systemjs/test/tests/amd-circular1.js | 7 - thirdparty/systemjs/test/tests/amd-circular2.js | 6 - thirdparty/systemjs/test/tests/amd-cjs-module.js | 4 - thirdparty/systemjs/test/tests/amd-contextual.js | 6 - thirdparty/systemjs/test/tests/amd-dep-A.js | 1 - thirdparty/systemjs/test/tests/amd-dep-B.js | 1 - thirdparty/systemjs/test/tests/amd-dep.js | 3 - .../systemjs/test/tests/amd-dynamic-require.js | 19 - thirdparty/systemjs/test/tests/amd-dynamic.js | 3 - thirdparty/systemjs/test/tests/amd-extra-deps.js | 7 - thirdparty/systemjs/test/tests/amd-format.js | 18 - thirdparty/systemjs/test/tests/amd-module-2.js | 6 - thirdparty/systemjs/test/tests/amd-module-3.js | 13 - thirdparty/systemjs/test/tests/amd-module-bom.js | 4 - thirdparty/systemjs/test/tests/amd-module.js | 6 - thirdparty/systemjs/test/tests/amd-require.js | 3 - .../tests/amd-simplified-cjs-aliased-require1.js | 7 - .../tests/amd-simplified-cjs-aliased-require2.js | 8 - thirdparty/systemjs/test/tests/anon-named.js | 10 - thirdparty/systemjs/test/tests/async.js | 5 - .../test/tests/bootstrap@3.1.1/test.coffee | 1 - thirdparty/systemjs/test/tests/branch-boolean.js | 1 - thirdparty/systemjs/test/tests/branch-ie.js | 1 - thirdparty/systemjs/test/tests/bundle.js | 7 - thirdparty/systemjs/test/tests/cjs-circular1.js | 4 - thirdparty/systemjs/test/tests/cjs-circular2.js | 4 - thirdparty/systemjs/test/tests/cjs-exports-bom.js | 1 - thirdparty/systemjs/test/tests/cjs-exports-dep.js | 1 - thirdparty/systemjs/test/tests/cjs-exports.js | 6 - thirdparty/systemjs/test/tests/cjs-format.js | 4 - thirdparty/systemjs/test/tests/cjs-globals.js | 3 - .../systemjs/test/tests/cjs-loading-plugin.js | 1 - thirdparty/systemjs/test/tests/cjs-module-bom.js | 1 - thirdparty/systemjs/test/tests/cjs-named-export.js | 5 - thirdparty/systemjs/test/tests/cjs-process.js | 3 - thirdparty/systemjs/test/tests/cjs-resolve.js | 1 - thirdparty/systemjs/test/tests/cjs-this.js | 2 - thirdparty/systemjs/test/tests/common-js-dep.js | 1 - thirdparty/systemjs/test/tests/common-js-module.js | 2 - thirdparty/systemjs/test/tests/commonjs-d.js | 1 - thirdparty/systemjs/test/tests/commonjs-d2.js | 1 - thirdparty/systemjs/test/tests/commonjs-globals.js | 1 - .../systemjs/test/tests/commonjs-requires.js | 40 - .../systemjs/test/tests/commonjs-variation.js | 5 - .../systemjs/test/tests/commonjs-variation2.js | 8 - thirdparty/systemjs/test/tests/compiled.coffee | 1 - thirdparty/systemjs/test/tests/compiler-plugin.js | 4 - .../systemjs/test/tests/compiler-test.coffee | 1 - thirdparty/systemjs/test/tests/connected-tree/a.js | 9 - thirdparty/systemjs/test/tests/connected-tree/b.js | 6 - thirdparty/systemjs/test/tests/connected-tree/c.js | 3 - .../systemjs/test/tests/contextual-map-dep.js | 1 - .../test/tests/contextual-test/contextual-map.js | 1 - thirdparty/systemjs/test/tests/cs-loader.js | 3 - thirdparty/systemjs/test/tests/cs/dep.js | 1 - thirdparty/systemjs/test/tests/cs/main.js | 1 - thirdparty/systemjs/test/tests/csp/integrity.js | 5 - thirdparty/systemjs/test/tests/csp/nonce.js | 3 - thirdparty/systemjs/test/tests/csp/nonce2.js | 3 - thirdparty/systemjs/test/tests/css.css | 3 - thirdparty/systemjs/test/tests/css.js | 3 - thirdparty/systemjs/test/tests/deep/deep-dep.js | 1 - thirdparty/systemjs/test/tests/deep/deep.js | 1 - thirdparty/systemjs/test/tests/default1-dep.js | 1 - thirdparty/systemjs/test/tests/default1.js | 3 - thirdparty/systemjs/test/tests/default2.js | 1 - thirdparty/systemjs/test/tests/default3.js | 1 - thirdparty/systemjs/test/tests/dep.js | 1 - thirdparty/systemjs/test/tests/duplicateDeps/m1.js | 23 - thirdparty/systemjs/test/tests/duplicateDeps/m2.js | 13 - thirdparty/systemjs/test/tests/eaa-amd.js | 3 - thirdparty/systemjs/test/tests/eaa-es6.js | 1 - thirdparty/systemjs/test/tests/empty-es6.js | 3 - .../systemjs/test/tests/ep/some-repo/main.js | 1 - thirdparty/systemjs/test/tests/error-loader.js | 1 - thirdparty/systemjs/test/tests/error-loader2.js | 1 - thirdparty/systemjs/test/tests/error.js | 1 - thirdparty/systemjs/test/tests/es-module-flag.js | 3 - .../systemjs/test/tests/es-named-import-cjs-cjs.js | 3 - .../systemjs/test/tests/es-named-import-cjs.js | 2 - thirdparty/systemjs/test/tests/es6-and-amd.js | 2 - thirdparty/systemjs/test/tests/es6-circular1.js | 10 - thirdparty/systemjs/test/tests/es6-circular2.js | 3 - .../systemjs/test/tests/es6-cjs-named-export.js | 1 - thirdparty/systemjs/test/tests/es6-detection1.js | 1 - thirdparty/systemjs/test/tests/es6-format.js | 6 - .../systemjs/test/tests/es6-import-star-amd.js | 3 - .../systemjs/test/tests/es6-loading-amd-dep.js | 3 - thirdparty/systemjs/test/tests/es6-loading-amd.js | 9 - thirdparty/systemjs/test/tests/es6-plugin.js | 3 - thirdparty/systemjs/test/tests/esm-dep.js | 5 - thirdparty/systemjs/test/tests/esm-with-deps.js | 1 - thirdparty/systemjs/test/tests/export-star.js | 2 - thirdparty/systemjs/test/tests/foo.js | 10 - thirdparty/systemjs/test/tests/global-dep.js | 5 - .../systemjs/test/tests/global-encapsulation.js | 3 - .../systemjs/test/tests/global-exports-array.js | 5 - .../test/tests/global-inaccessible-props.js | 8 - .../systemjs/test/tests/global-inline-dep.js | 7 - .../systemjs/test/tests/global-inline-export.js | 9 - .../systemjs/test/tests/global-multi-diff.js | 3 - thirdparty/systemjs/test/tests/global-multi.js | 6 - thirdparty/systemjs/test/tests/global-shim-amd.js | 6 - .../systemjs/test/tests/global-shim-config-dep.js | 1 - .../test/tests/global-shim-config-exports.js | 1 - .../systemjs/test/tests/global-shim-config.js | 3 - .../systemjs/test/tests/global-single-compiled.js | 9 - thirdparty/systemjs/test/tests/global-single.js | 1 - .../systemjs/test/tests/global-with-export.js | 5 - thirdparty/systemjs/test/tests/global.js | 6 - thirdparty/systemjs/test/tests/group-test.js | 34 - thirdparty/systemjs/test/tests/hbs.hbs | 1 - .../systemjs/test/tests/inline-depends-dep.js | 1 - thirdparty/systemjs/test/tests/inline-depends.js | 1 - thirdparty/systemjs/test/tests/jquery-named.js | 3 - thirdparty/systemjs/test/tests/jquery.js | 2 - thirdparty/systemjs/test/tests/legacy-plugin.js | 5 - thirdparty/systemjs/test/tests/loader-scoping.js | 1 - thirdparty/systemjs/test/tests/main-bundle.js | 3 - thirdparty/systemjs/test/tests/main-dep.js | 1 - thirdparty/systemjs/test/tests/main.js | 1 - thirdparty/systemjs/test/tests/map-test-dep.js | 1 - thirdparty/systemjs/test/tests/map-test.js | 1 - thirdparty/systemjs/test/tests/map-test/sub.js | 1 - thirdparty/systemjs/test/tests/map-version.js | 1 - thirdparty/systemjs/test/tests/meta-deps.js | 21 - thirdparty/systemjs/test/tests/meta-override.js | 2 - thirdparty/systemjs/test/tests/mixed-bundle.js | 68 - thirdparty/systemjs/test/tests/modA.js | 7 - thirdparty/systemjs/test/tests/modC.js | 5 - thirdparty/systemjs/test/tests/module-name.js | 8 - thirdparty/systemjs/test/tests/module.js | 3 - .../systemjs/test/tests/multiple-anonymous.js | 14 - thirdparty/systemjs/test/tests/mypackage/index.js | 1 - .../systemjs/test/tests/mypackage/lib/bar.js | 2 - .../systemjs/test/tests/mypackage/src/foo.js | 3 - thirdparty/systemjs/test/tests/nameddefine.js | 14 - .../systemjs/test/tests/no-default-ext/file.ext | 1 - .../systemjs/test/tests/normalize-hook-test.js | 1 - thirdparty/systemjs/test/tests/out.js | 19 - .../test/tests/package-local-alias/index-cjs.js | 6 - .../tests/package-local-alias/index-default-cjs.js | 10 - .../tests/package-local-alias/index-default-esm.js | 10 - .../test/tests/package-local-alias/index-esm.js | 5 - .../tests/package-local-alias/local/index-cjs.js | 1 - .../package-local-alias/local/index-default-cjs.js | 1 - .../package-local-alias/local/index-default-esm.js | 2 - .../tests/package-local-alias/local/index-esm.js | 1 - thirdparty/systemjs/test/tests/path/deep.js | 1 - thirdparty/systemjs/test/tests/plugin-dep.js | 8 - .../systemjs/test/tests/plugin@1.2.3/plugin.js | 3 - thirdparty/systemjs/test/tests/reflection.js | 1 - .../systemjs/test/tests/register-circular1.js | 24 - .../systemjs/test/tests/register-circular2.js | 14 - .../test/tests/register-default-extension.js | 8 - thirdparty/systemjs/test/tests/register-regex-2.js | 15 - thirdparty/systemjs/test/tests/register-regex.js | 18 - .../systemjs/test/tests/registerdynamic-main.js | 11 - .../test/tests/registerdynamic-notbundled.js | 5 - thirdparty/systemjs/test/tests/reldynamic.js | 5 - thirdparty/systemjs/test/tests/reldynamicdep.js | 1 - .../systemjs/test/tests/shared-dep-bundles/a.js | 33 - .../systemjs/test/tests/shared-dep-bundles/b.js | 33 - .../systemjs/test/tests/shim-map-test-dep.js | 1 - .../test/tests/shim-package/shim-map-test.js | 1 - thirdparty/systemjs/test/tests/some-json.json | 3 - thirdparty/systemjs/test/tests/some-text.txt | 1 - thirdparty/systemjs/test/tests/star-dep.js | 1 - .../test/tests/subcontextual-map/submodule.js | 3 - .../systemjs/test/tests/subcontextual-mapdep.js | 1 - thirdparty/systemjs/test/tests/test.css | 1 - .../systemjs/test/tests/testpkg/depcache-test.js | 1 - .../systemjs/test/tests/testpkg/dir/index.js | 2 - .../systemjs/test/tests/testpkg/dir/self-load.js | 2 - .../systemjs/test/tests/testpkg/dir2/index.json | 3 - .../test/tests/testpkg/env-module-browser.js | 1 - .../systemjs/test/tests/testpkg/env-module.js | 1 - thirdparty/systemjs/test/tests/testpkg/index.js | 1 - .../systemjs/test/tests/testpkg/interpolate.js | 1 - thirdparty/systemjs/test/tests/testpkg/json.js | 4 - thirdparty/systemjs/test/tests/testpkg/json.json | 3 - thirdparty/systemjs/test/tests/testpkg/polate.js | 1 - .../systemjs/test/tests/testpkg/self-load.js | 2 - thirdparty/systemjs/test/tests/testpkg/self.js | 1 - thirdparty/systemjs/test/tests/testpkg/system.json | 28 - thirdparty/systemjs/test/tests/testpkg/test.ts | 1 - thirdparty/systemjs/test/tests/testpkg2.json | 6 - .../systemjs/test/tests/testpkg2/asdf.asdf.js | 3 - thirdparty/systemjs/test/tests/typescript.ts | 1 - thirdparty/systemjs/test/tests/umd-dep.js | 3 - thirdparty/systemjs/test/tests/umd.js | 10 - thirdparty/systemjs/test/tests/versioned@2.0.3.js | 1 - thirdparty/systemjs/test/tests/wildcard-test/2.js | 1 - .../systemjs/test/tests/wildcard-test/2/sub.js | 1 - .../systemjs/test/tests/wildcard-test/first.js | 1 - thirdparty/systemjs/test/tests/with-global-deps.js | 1 - .../systemjs/test/tests/with-runtime-babel.js | 16 - .../systemjs/test/tests/with-runtime-traceur.js | 14 - thirdparty/systemjs/test/tests/worker-babel.js | 14 - thirdparty/systemjs/test/tests/worker-traceur.js | 12 - .../systemjs/test/tests/worker-typescript.js | 16 - thirdparty/systemjs/test/tests/wrapper.js | 1 - thirdparty/systemjs/test/tests/zero@0.js | 1 - tooling/pogen/.gitignore | 1 + tooling/pogen/dumpTree.ts | 51 + tooling/pogen/example/messages.po | 107 + tooling/pogen/example/test.ts | 63 + tooling/pogen/example/test2.tsx | 15 + tooling/pogen/pogen.ts | 393 + tooling/pogen/tsconfig.json | 11 + tooling/talertest/node/runtime.js | 43 + tooling/talertest/package.json | 20 + tooling/talertest/selenium/.gitignore | 2 + tooling/talertest/selenium/escodegen.browser.js | 4947 ++ tooling/talertest/selenium/esprima.js | 6605 +++ tooling/talertest/selenium/instrumenter.js | 1097 + tooling/talertest/selenium/runtime.js | 206 + tooling/talertest/selenium/system.js | 6 + tooling/talertest/selenium/testhost.html | 63 + tooling/talertest/talertest.d.ts | 19 + tooling/talertest/talertest.js | 111 + tooling/talertest/talertest.ts | 122 + tooling/talertest/tsconfig.json | 19 + tooling/talertest/yarn.lock | 7 + tsconfig.json | 20 +- webpack.config.js | 124 + yarn.lock | 1951 +- 2804 files changed, 227445 insertions(+), 336968 deletions(-) create mode 100644 decl/jed.d.ts delete mode 100644 decl/jquery/jquery.d.ts delete mode 100644 decl/lib.es6.d.ts delete mode 100644 decl/node.d.ts delete mode 100644 decl/react-dom.d.ts delete mode 100644 decl/react-global.d.ts delete mode 100644 decl/react.d.ts delete mode 100644 decl/systemjs/systemjs.d.ts create mode 100644 decl/urijs.d.ts delete mode 100644 decl/urijs/URIjs.d.ts delete mode 100644 node_modules/ansi-regex/license mode change 100755 => 100644 node_modules/arr-flatten/index.js mode change 100755 => 100644 node_modules/arr-flatten/package.json delete mode 100644 node_modules/buffer-crc32/.npmignore delete mode 100644 node_modules/buffer-crc32/.travis.yml delete mode 100644 node_modules/buffer-crc32/tests/crc.test.js delete mode 100644 node_modules/core-js/core/regexp.js delete mode 100644 node_modules/core-js/es6/date.js delete mode 100644 node_modules/core-js/es6/parse-float.js delete mode 100644 node_modules/core-js/es6/parse-int.js delete mode 100644 node_modules/core-js/es6/typed.js delete mode 100644 node_modules/core-js/es7/asap.js delete mode 100644 node_modules/core-js/es7/error.js delete mode 100644 node_modules/core-js/es7/math.js delete mode 100644 node_modules/core-js/es7/observable.js delete mode 100644 node_modules/core-js/es7/reflect.js delete mode 100644 node_modules/core-js/es7/symbol.js delete mode 100644 node_modules/core-js/es7/system.js delete mode 100644 node_modules/core-js/fn/array/is-array.js delete mode 100644 node_modules/core-js/fn/array/virtual/copy-within.js delete mode 100644 node_modules/core-js/fn/array/virtual/entries.js delete mode 100644 node_modules/core-js/fn/array/virtual/every.js delete mode 100644 node_modules/core-js/fn/array/virtual/fill.js delete mode 100644 node_modules/core-js/fn/array/virtual/filter.js delete mode 100644 node_modules/core-js/fn/array/virtual/find-index.js delete mode 100644 node_modules/core-js/fn/array/virtual/find.js delete mode 100644 node_modules/core-js/fn/array/virtual/for-each.js delete mode 100644 node_modules/core-js/fn/array/virtual/includes.js delete mode 100644 node_modules/core-js/fn/array/virtual/index-of.js delete mode 100644 node_modules/core-js/fn/array/virtual/index.js delete mode 100644 node_modules/core-js/fn/array/virtual/iterator.js delete mode 100644 node_modules/core-js/fn/array/virtual/join.js delete mode 100644 node_modules/core-js/fn/array/virtual/keys.js delete mode 100644 node_modules/core-js/fn/array/virtual/last-index-of.js delete mode 100644 node_modules/core-js/fn/array/virtual/map.js delete mode 100644 node_modules/core-js/fn/array/virtual/reduce-right.js delete mode 100644 node_modules/core-js/fn/array/virtual/reduce.js delete mode 100644 node_modules/core-js/fn/array/virtual/slice.js delete mode 100644 node_modules/core-js/fn/array/virtual/some.js delete mode 100644 node_modules/core-js/fn/array/virtual/sort.js delete mode 100644 node_modules/core-js/fn/array/virtual/values.js delete mode 100644 node_modules/core-js/fn/asap.js delete mode 100644 node_modules/core-js/fn/date/index.js delete mode 100644 node_modules/core-js/fn/date/now.js delete mode 100644 node_modules/core-js/fn/date/to-iso-string.js delete mode 100644 node_modules/core-js/fn/date/to-json.js delete mode 100644 node_modules/core-js/fn/date/to-primitive.js delete mode 100644 node_modules/core-js/fn/date/to-string.js delete mode 100644 node_modules/core-js/fn/dom-collections/index.js delete mode 100644 node_modules/core-js/fn/dom-collections/iterator.js delete mode 100644 node_modules/core-js/fn/error/index.js delete mode 100644 node_modules/core-js/fn/error/is-error.js delete mode 100644 node_modules/core-js/fn/function/bind.js delete mode 100644 node_modules/core-js/fn/function/virtual/bind.js delete mode 100644 node_modules/core-js/fn/function/virtual/index.js delete mode 100644 node_modules/core-js/fn/function/virtual/part.js delete mode 100644 node_modules/core-js/fn/json/index.js delete mode 100644 node_modules/core-js/fn/math/iaddh.js delete mode 100644 node_modules/core-js/fn/math/imulh.js delete mode 100644 node_modules/core-js/fn/math/isubh.js delete mode 100644 node_modules/core-js/fn/math/umulh.js delete mode 100644 node_modules/core-js/fn/number/constructor.js delete mode 100644 node_modules/core-js/fn/number/to-fixed.js delete mode 100644 node_modules/core-js/fn/number/to-precision.js delete mode 100644 node_modules/core-js/fn/number/virtual/index.js delete mode 100644 node_modules/core-js/fn/number/virtual/iterator.js delete mode 100644 node_modules/core-js/fn/number/virtual/to-fixed.js delete mode 100644 node_modules/core-js/fn/number/virtual/to-precision.js delete mode 100644 node_modules/core-js/fn/object/define-getter.js delete mode 100644 node_modules/core-js/fn/object/define-setter.js delete mode 100644 node_modules/core-js/fn/object/lookup-getter.js delete mode 100644 node_modules/core-js/fn/object/lookup-setter.js delete mode 100644 node_modules/core-js/fn/observable.js delete mode 100644 node_modules/core-js/fn/parse-float.js delete mode 100644 node_modules/core-js/fn/parse-int.js delete mode 100644 node_modules/core-js/fn/reflect/define-metadata.js delete mode 100644 node_modules/core-js/fn/reflect/delete-metadata.js delete mode 100644 node_modules/core-js/fn/reflect/get-metadata-keys.js delete mode 100644 node_modules/core-js/fn/reflect/get-metadata.js delete mode 100644 node_modules/core-js/fn/reflect/get-own-metadata-keys.js delete mode 100644 node_modules/core-js/fn/reflect/get-own-metadata.js delete mode 100644 node_modules/core-js/fn/reflect/has-metadata.js delete mode 100644 node_modules/core-js/fn/reflect/has-own-metadata.js delete mode 100644 node_modules/core-js/fn/reflect/metadata.js delete mode 100644 node_modules/core-js/fn/regexp/constructor.js delete mode 100644 node_modules/core-js/fn/regexp/flags.js delete mode 100644 node_modules/core-js/fn/regexp/match.js delete mode 100644 node_modules/core-js/fn/regexp/replace.js delete mode 100644 node_modules/core-js/fn/regexp/search.js delete mode 100644 node_modules/core-js/fn/regexp/split.js delete mode 100644 node_modules/core-js/fn/regexp/to-string.js delete mode 100644 node_modules/core-js/fn/string/anchor.js delete mode 100644 node_modules/core-js/fn/string/big.js delete mode 100644 node_modules/core-js/fn/string/blink.js delete mode 100644 node_modules/core-js/fn/string/bold.js delete mode 100644 node_modules/core-js/fn/string/fixed.js delete mode 100644 node_modules/core-js/fn/string/fontcolor.js delete mode 100644 node_modules/core-js/fn/string/fontsize.js delete mode 100644 node_modules/core-js/fn/string/italics.js delete mode 100644 node_modules/core-js/fn/string/link.js delete mode 100644 node_modules/core-js/fn/string/match-all.js delete mode 100644 node_modules/core-js/fn/string/pad-end.js delete mode 100644 node_modules/core-js/fn/string/pad-start.js delete mode 100644 node_modules/core-js/fn/string/small.js delete mode 100644 node_modules/core-js/fn/string/strike.js delete mode 100644 node_modules/core-js/fn/string/sub.js delete mode 100644 node_modules/core-js/fn/string/sup.js delete mode 100644 node_modules/core-js/fn/string/trim-end.js delete mode 100644 node_modules/core-js/fn/string/trim-start.js delete mode 100644 node_modules/core-js/fn/string/virtual/anchor.js delete mode 100644 node_modules/core-js/fn/string/virtual/at.js delete mode 100644 node_modules/core-js/fn/string/virtual/big.js delete mode 100644 node_modules/core-js/fn/string/virtual/blink.js delete mode 100644 node_modules/core-js/fn/string/virtual/bold.js delete mode 100644 node_modules/core-js/fn/string/virtual/code-point-at.js delete mode 100644 node_modules/core-js/fn/string/virtual/ends-with.js delete mode 100644 node_modules/core-js/fn/string/virtual/escape-html.js delete mode 100644 node_modules/core-js/fn/string/virtual/fixed.js delete mode 100644 node_modules/core-js/fn/string/virtual/fontcolor.js delete mode 100644 node_modules/core-js/fn/string/virtual/fontsize.js delete mode 100644 node_modules/core-js/fn/string/virtual/includes.js delete mode 100644 node_modules/core-js/fn/string/virtual/index.js delete mode 100644 node_modules/core-js/fn/string/virtual/italics.js delete mode 100644 node_modules/core-js/fn/string/virtual/iterator.js delete mode 100644 node_modules/core-js/fn/string/virtual/link.js delete mode 100644 node_modules/core-js/fn/string/virtual/match-all.js delete mode 100644 node_modules/core-js/fn/string/virtual/pad-end.js delete mode 100644 node_modules/core-js/fn/string/virtual/pad-start.js delete mode 100644 node_modules/core-js/fn/string/virtual/repeat.js delete mode 100644 node_modules/core-js/fn/string/virtual/small.js delete mode 100644 node_modules/core-js/fn/string/virtual/starts-with.js delete mode 100644 node_modules/core-js/fn/string/virtual/strike.js delete mode 100644 node_modules/core-js/fn/string/virtual/sub.js delete mode 100644 node_modules/core-js/fn/string/virtual/sup.js delete mode 100644 node_modules/core-js/fn/string/virtual/trim-end.js delete mode 100644 node_modules/core-js/fn/string/virtual/trim-left.js delete mode 100644 node_modules/core-js/fn/string/virtual/trim-right.js delete mode 100644 node_modules/core-js/fn/string/virtual/trim-start.js delete mode 100644 node_modules/core-js/fn/string/virtual/trim.js delete mode 100644 node_modules/core-js/fn/string/virtual/unescape-html.js delete mode 100644 node_modules/core-js/fn/symbol/async-iterator.js delete mode 100644 node_modules/core-js/fn/symbol/observable.js delete mode 100644 node_modules/core-js/fn/system/global.js delete mode 100644 node_modules/core-js/fn/system/index.js delete mode 100644 node_modules/core-js/fn/typed/array-buffer.js delete mode 100644 node_modules/core-js/fn/typed/data-view.js delete mode 100644 node_modules/core-js/fn/typed/float32-array.js delete mode 100644 node_modules/core-js/fn/typed/float64-array.js delete mode 100644 node_modules/core-js/fn/typed/index.js delete mode 100644 node_modules/core-js/fn/typed/int16-array.js delete mode 100644 node_modules/core-js/fn/typed/int32-array.js delete mode 100644 node_modules/core-js/fn/typed/int8-array.js delete mode 100644 node_modules/core-js/fn/typed/uint16-array.js delete mode 100644 node_modules/core-js/fn/typed/uint32-array.js delete mode 100644 node_modules/core-js/fn/typed/uint8-array.js delete mode 100644 node_modules/core-js/fn/typed/uint8-clamped-array.js delete mode 100644 node_modules/core-js/library/core/regexp.js delete mode 100644 node_modules/core-js/library/es6/date.js delete mode 100644 node_modules/core-js/library/es6/parse-float.js delete mode 100644 node_modules/core-js/library/es6/parse-int.js delete mode 100644 node_modules/core-js/library/es6/typed.js delete mode 100644 node_modules/core-js/library/es7/asap.js delete mode 100644 node_modules/core-js/library/es7/error.js delete mode 100644 node_modules/core-js/library/es7/math.js delete mode 100644 node_modules/core-js/library/es7/observable.js delete mode 100644 node_modules/core-js/library/es7/reflect.js delete mode 100644 node_modules/core-js/library/es7/symbol.js delete mode 100644 node_modules/core-js/library/es7/system.js delete mode 100644 node_modules/core-js/library/fn/array/is-array.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/copy-within.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/entries.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/every.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/fill.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/filter.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/find-index.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/find.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/for-each.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/includes.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/index-of.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/index.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/iterator.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/join.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/keys.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/last-index-of.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/map.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/reduce-right.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/reduce.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/slice.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/some.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/sort.js delete mode 100644 node_modules/core-js/library/fn/array/virtual/values.js delete mode 100644 node_modules/core-js/library/fn/asap.js delete mode 100644 node_modules/core-js/library/fn/date/index.js delete mode 100644 node_modules/core-js/library/fn/date/now.js delete mode 100644 node_modules/core-js/library/fn/date/to-iso-string.js delete mode 100644 node_modules/core-js/library/fn/date/to-json.js delete mode 100644 node_modules/core-js/library/fn/date/to-primitive.js delete mode 100644 node_modules/core-js/library/fn/date/to-string.js delete mode 100644 node_modules/core-js/library/fn/dom-collections/index.js delete mode 100644 node_modules/core-js/library/fn/dom-collections/iterator.js delete mode 100644 node_modules/core-js/library/fn/error/index.js delete mode 100644 node_modules/core-js/library/fn/error/is-error.js delete mode 100644 node_modules/core-js/library/fn/function/bind.js delete mode 100644 node_modules/core-js/library/fn/function/virtual/bind.js delete mode 100644 node_modules/core-js/library/fn/function/virtual/index.js delete mode 100644 node_modules/core-js/library/fn/function/virtual/part.js delete mode 100644 node_modules/core-js/library/fn/json/index.js delete mode 100644 node_modules/core-js/library/fn/math/iaddh.js delete mode 100644 node_modules/core-js/library/fn/math/imulh.js delete mode 100644 node_modules/core-js/library/fn/math/isubh.js delete mode 100644 node_modules/core-js/library/fn/math/umulh.js delete mode 100644 node_modules/core-js/library/fn/number/constructor.js delete mode 100644 node_modules/core-js/library/fn/number/to-fixed.js delete mode 100644 node_modules/core-js/library/fn/number/to-precision.js delete mode 100644 node_modules/core-js/library/fn/number/virtual/index.js delete mode 100644 node_modules/core-js/library/fn/number/virtual/iterator.js delete mode 100644 node_modules/core-js/library/fn/number/virtual/to-fixed.js delete mode 100644 node_modules/core-js/library/fn/number/virtual/to-precision.js delete mode 100644 node_modules/core-js/library/fn/object/define-getter.js delete mode 100644 node_modules/core-js/library/fn/object/define-setter.js delete mode 100644 node_modules/core-js/library/fn/object/lookup-getter.js delete mode 100644 node_modules/core-js/library/fn/object/lookup-setter.js delete mode 100644 node_modules/core-js/library/fn/observable.js delete mode 100644 node_modules/core-js/library/fn/parse-float.js delete mode 100644 node_modules/core-js/library/fn/parse-int.js delete mode 100644 node_modules/core-js/library/fn/reflect/define-metadata.js delete mode 100644 node_modules/core-js/library/fn/reflect/delete-metadata.js delete mode 100644 node_modules/core-js/library/fn/reflect/get-metadata-keys.js delete mode 100644 node_modules/core-js/library/fn/reflect/get-metadata.js delete mode 100644 node_modules/core-js/library/fn/reflect/get-own-metadata-keys.js delete mode 100644 node_modules/core-js/library/fn/reflect/get-own-metadata.js delete mode 100644 node_modules/core-js/library/fn/reflect/has-metadata.js delete mode 100644 node_modules/core-js/library/fn/reflect/has-own-metadata.js delete mode 100644 node_modules/core-js/library/fn/reflect/metadata.js delete mode 100644 node_modules/core-js/library/fn/regexp/constructor.js delete mode 100644 node_modules/core-js/library/fn/regexp/flags.js delete mode 100644 node_modules/core-js/library/fn/regexp/match.js delete mode 100644 node_modules/core-js/library/fn/regexp/replace.js delete mode 100644 node_modules/core-js/library/fn/regexp/search.js delete mode 100644 node_modules/core-js/library/fn/regexp/split.js delete mode 100644 node_modules/core-js/library/fn/regexp/to-string.js delete mode 100644 node_modules/core-js/library/fn/string/anchor.js delete mode 100644 node_modules/core-js/library/fn/string/big.js delete mode 100644 node_modules/core-js/library/fn/string/blink.js delete mode 100644 node_modules/core-js/library/fn/string/bold.js delete mode 100644 node_modules/core-js/library/fn/string/fixed.js delete mode 100644 node_modules/core-js/library/fn/string/fontcolor.js delete mode 100644 node_modules/core-js/library/fn/string/fontsize.js delete mode 100644 node_modules/core-js/library/fn/string/italics.js delete mode 100644 node_modules/core-js/library/fn/string/link.js delete mode 100644 node_modules/core-js/library/fn/string/match-all.js delete mode 100644 node_modules/core-js/library/fn/string/pad-end.js delete mode 100644 node_modules/core-js/library/fn/string/pad-start.js delete mode 100644 node_modules/core-js/library/fn/string/small.js delete mode 100644 node_modules/core-js/library/fn/string/strike.js delete mode 100644 node_modules/core-js/library/fn/string/sub.js delete mode 100644 node_modules/core-js/library/fn/string/sup.js delete mode 100644 node_modules/core-js/library/fn/string/trim-end.js delete mode 100644 node_modules/core-js/library/fn/string/trim-start.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/anchor.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/at.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/big.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/blink.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/bold.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/code-point-at.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/ends-with.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/escape-html.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/fixed.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/fontcolor.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/fontsize.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/includes.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/index.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/italics.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/iterator.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/link.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/match-all.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/pad-end.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/pad-start.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/repeat.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/small.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/starts-with.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/strike.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/sub.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/sup.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/trim-end.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/trim-left.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/trim-right.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/trim-start.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/trim.js delete mode 100644 node_modules/core-js/library/fn/string/virtual/unescape-html.js delete mode 100644 node_modules/core-js/library/fn/symbol/async-iterator.js delete mode 100644 node_modules/core-js/library/fn/symbol/observable.js delete mode 100644 node_modules/core-js/library/fn/system/global.js delete mode 100644 node_modules/core-js/library/fn/system/index.js delete mode 100644 node_modules/core-js/library/fn/typed/array-buffer.js delete mode 100644 node_modules/core-js/library/fn/typed/data-view.js delete mode 100644 node_modules/core-js/library/fn/typed/float32-array.js delete mode 100644 node_modules/core-js/library/fn/typed/float64-array.js delete mode 100644 node_modules/core-js/library/fn/typed/index.js delete mode 100644 node_modules/core-js/library/fn/typed/int16-array.js delete mode 100644 node_modules/core-js/library/fn/typed/int32-array.js delete mode 100644 node_modules/core-js/library/fn/typed/int8-array.js delete mode 100644 node_modules/core-js/library/fn/typed/uint16-array.js delete mode 100644 node_modules/core-js/library/fn/typed/uint32-array.js delete mode 100644 node_modules/core-js/library/fn/typed/uint8-array.js delete mode 100644 node_modules/core-js/library/fn/typed/uint8-clamped-array.js delete mode 100644 node_modules/core-js/library/modules/_a-function.js delete mode 100644 node_modules/core-js/library/modules/_a-number-value.js delete mode 100644 node_modules/core-js/library/modules/_add-to-unscopables.js delete mode 100644 node_modules/core-js/library/modules/_an-instance.js delete mode 100644 node_modules/core-js/library/modules/_an-object.js delete mode 100644 node_modules/core-js/library/modules/_array-copy-within.js delete mode 100644 node_modules/core-js/library/modules/_array-fill.js delete mode 100644 node_modules/core-js/library/modules/_array-from-iterable.js delete mode 100644 node_modules/core-js/library/modules/_array-includes.js delete mode 100644 node_modules/core-js/library/modules/_array-methods.js delete mode 100644 node_modules/core-js/library/modules/_array-reduce.js delete mode 100644 node_modules/core-js/library/modules/_array-species-constructor.js delete mode 100644 node_modules/core-js/library/modules/_array-species-create.js delete mode 100644 node_modules/core-js/library/modules/_bind.js delete mode 100644 node_modules/core-js/library/modules/_classof.js delete mode 100644 node_modules/core-js/library/modules/_cof.js delete mode 100644 node_modules/core-js/library/modules/_collection-strong.js delete mode 100644 node_modules/core-js/library/modules/_collection-to-json.js delete mode 100644 node_modules/core-js/library/modules/_collection-weak.js delete mode 100644 node_modules/core-js/library/modules/_collection.js delete mode 100644 node_modules/core-js/library/modules/_core.js delete mode 100644 node_modules/core-js/library/modules/_create-property.js delete mode 100644 node_modules/core-js/library/modules/_ctx.js delete mode 100644 node_modules/core-js/library/modules/_date-to-primitive.js delete mode 100644 node_modules/core-js/library/modules/_defined.js delete mode 100644 node_modules/core-js/library/modules/_descriptors.js delete mode 100644 node_modules/core-js/library/modules/_dom-create.js delete mode 100644 node_modules/core-js/library/modules/_entry-virtual.js delete mode 100644 node_modules/core-js/library/modules/_enum-bug-keys.js delete mode 100644 node_modules/core-js/library/modules/_enum-keys.js delete mode 100644 node_modules/core-js/library/modules/_export.js delete mode 100644 node_modules/core-js/library/modules/_fails-is-regexp.js delete mode 100644 node_modules/core-js/library/modules/_fails.js delete mode 100644 node_modules/core-js/library/modules/_fix-re-wks.js delete mode 100644 node_modules/core-js/library/modules/_flags.js delete mode 100644 node_modules/core-js/library/modules/_for-of.js delete mode 100644 node_modules/core-js/library/modules/_global.js delete mode 100644 node_modules/core-js/library/modules/_has.js delete mode 100644 node_modules/core-js/library/modules/_hide.js delete mode 100644 node_modules/core-js/library/modules/_html.js delete mode 100644 node_modules/core-js/library/modules/_ie8-dom-define.js delete mode 100644 node_modules/core-js/library/modules/_inherit-if-required.js delete mode 100644 node_modules/core-js/library/modules/_invoke.js delete mode 100644 node_modules/core-js/library/modules/_iobject.js delete mode 100644 node_modules/core-js/library/modules/_is-array-iter.js delete mode 100644 node_modules/core-js/library/modules/_is-array.js delete mode 100644 node_modules/core-js/library/modules/_is-integer.js delete mode 100644 node_modules/core-js/library/modules/_is-object.js delete mode 100644 node_modules/core-js/library/modules/_is-regexp.js delete mode 100644 node_modules/core-js/library/modules/_iter-call.js delete mode 100644 node_modules/core-js/library/modules/_iter-create.js delete mode 100644 node_modules/core-js/library/modules/_iter-define.js delete mode 100644 node_modules/core-js/library/modules/_iter-detect.js delete mode 100644 node_modules/core-js/library/modules/_iter-step.js delete mode 100644 node_modules/core-js/library/modules/_iterators.js delete mode 100644 node_modules/core-js/library/modules/_keyof.js delete mode 100644 node_modules/core-js/library/modules/_library.js delete mode 100644 node_modules/core-js/library/modules/_math-expm1.js delete mode 100644 node_modules/core-js/library/modules/_math-log1p.js delete mode 100644 node_modules/core-js/library/modules/_math-sign.js delete mode 100644 node_modules/core-js/library/modules/_meta.js delete mode 100644 node_modules/core-js/library/modules/_metadata.js delete mode 100644 node_modules/core-js/library/modules/_microtask.js delete mode 100644 node_modules/core-js/library/modules/_object-assign.js delete mode 100644 node_modules/core-js/library/modules/_object-create.js delete mode 100644 node_modules/core-js/library/modules/_object-define.js delete mode 100644 node_modules/core-js/library/modules/_object-dp.js delete mode 100644 node_modules/core-js/library/modules/_object-dps.js delete mode 100644 node_modules/core-js/library/modules/_object-forced-pam.js delete mode 100644 node_modules/core-js/library/modules/_object-gopd.js delete mode 100644 node_modules/core-js/library/modules/_object-gopn-ext.js delete mode 100644 node_modules/core-js/library/modules/_object-gopn.js delete mode 100644 node_modules/core-js/library/modules/_object-gops.js delete mode 100644 node_modules/core-js/library/modules/_object-gpo.js delete mode 100644 node_modules/core-js/library/modules/_object-keys-internal.js delete mode 100644 node_modules/core-js/library/modules/_object-keys.js delete mode 100644 node_modules/core-js/library/modules/_object-pie.js delete mode 100644 node_modules/core-js/library/modules/_object-sap.js delete mode 100644 node_modules/core-js/library/modules/_object-to-array.js delete mode 100644 node_modules/core-js/library/modules/_own-keys.js delete mode 100644 node_modules/core-js/library/modules/_parse-float.js delete mode 100644 node_modules/core-js/library/modules/_parse-int.js delete mode 100644 node_modules/core-js/library/modules/_partial.js delete mode 100644 node_modules/core-js/library/modules/_path.js delete mode 100644 node_modules/core-js/library/modules/_property-desc.js delete mode 100644 node_modules/core-js/library/modules/_redefine-all.js delete mode 100644 node_modules/core-js/library/modules/_redefine.js delete mode 100644 node_modules/core-js/library/modules/_replacer.js delete mode 100644 node_modules/core-js/library/modules/_same-value.js delete mode 100644 node_modules/core-js/library/modules/_set-proto.js delete mode 100644 node_modules/core-js/library/modules/_set-species.js delete mode 100644 node_modules/core-js/library/modules/_set-to-string-tag.js delete mode 100644 node_modules/core-js/library/modules/_shared-key.js delete mode 100644 node_modules/core-js/library/modules/_shared.js delete mode 100644 node_modules/core-js/library/modules/_species-constructor.js delete mode 100644 node_modules/core-js/library/modules/_strict-method.js delete mode 100644 node_modules/core-js/library/modules/_string-at.js delete mode 100644 node_modules/core-js/library/modules/_string-context.js delete mode 100644 node_modules/core-js/library/modules/_string-html.js delete mode 100644 node_modules/core-js/library/modules/_string-pad.js delete mode 100644 node_modules/core-js/library/modules/_string-repeat.js delete mode 100644 node_modules/core-js/library/modules/_string-trim.js delete mode 100644 node_modules/core-js/library/modules/_string-ws.js delete mode 100644 node_modules/core-js/library/modules/_task.js delete mode 100644 node_modules/core-js/library/modules/_to-index.js delete mode 100644 node_modules/core-js/library/modules/_to-integer.js delete mode 100644 node_modules/core-js/library/modules/_to-iobject.js delete mode 100644 node_modules/core-js/library/modules/_to-length.js delete mode 100644 node_modules/core-js/library/modules/_to-object.js delete mode 100644 node_modules/core-js/library/modules/_to-primitive.js delete mode 100644 node_modules/core-js/library/modules/_typed-array.js delete mode 100644 node_modules/core-js/library/modules/_typed-buffer.js delete mode 100644 node_modules/core-js/library/modules/_typed.js delete mode 100644 node_modules/core-js/library/modules/_uid.js delete mode 100644 node_modules/core-js/library/modules/_wks-define.js delete mode 100644 node_modules/core-js/library/modules/_wks-ext.js delete mode 100644 node_modules/core-js/library/modules/_wks.js delete mode 100644 node_modules/core-js/library/modules/core.regexp.escape.js delete mode 100644 node_modules/core-js/library/modules/es6.array.every.js delete mode 100644 node_modules/core-js/library/modules/es6.array.filter.js delete mode 100644 node_modules/core-js/library/modules/es6.array.for-each.js delete mode 100644 node_modules/core-js/library/modules/es6.array.index-of.js delete mode 100644 node_modules/core-js/library/modules/es6.array.is-array.js delete mode 100644 node_modules/core-js/library/modules/es6.array.join.js delete mode 100644 node_modules/core-js/library/modules/es6.array.last-index-of.js delete mode 100644 node_modules/core-js/library/modules/es6.array.map.js delete mode 100644 node_modules/core-js/library/modules/es6.array.reduce-right.js delete mode 100644 node_modules/core-js/library/modules/es6.array.reduce.js delete mode 100644 node_modules/core-js/library/modules/es6.array.slice.js delete mode 100644 node_modules/core-js/library/modules/es6.array.some.js delete mode 100644 node_modules/core-js/library/modules/es6.array.sort.js delete mode 100644 node_modules/core-js/library/modules/es6.date.now.js delete mode 100644 node_modules/core-js/library/modules/es6.date.to-iso-string.js delete mode 100644 node_modules/core-js/library/modules/es6.date.to-json.js delete mode 100644 node_modules/core-js/library/modules/es6.date.to-primitive.js delete mode 100644 node_modules/core-js/library/modules/es6.function.bind.js delete mode 100644 node_modules/core-js/library/modules/es6.number.to-fixed.js delete mode 100644 node_modules/core-js/library/modules/es6.number.to-precision.js delete mode 100644 node_modules/core-js/library/modules/es6.object.create.js delete mode 100644 node_modules/core-js/library/modules/es6.object.define-properties.js delete mode 100644 node_modules/core-js/library/modules/es6.object.define-property.js delete mode 100644 node_modules/core-js/library/modules/es6.parse-float.js delete mode 100644 node_modules/core-js/library/modules/es6.parse-int.js delete mode 100644 node_modules/core-js/library/modules/es6.regexp.to-string.js delete mode 100644 node_modules/core-js/library/modules/es6.string.anchor.js delete mode 100644 node_modules/core-js/library/modules/es6.string.big.js delete mode 100644 node_modules/core-js/library/modules/es6.string.blink.js delete mode 100644 node_modules/core-js/library/modules/es6.string.bold.js delete mode 100644 node_modules/core-js/library/modules/es6.string.fixed.js delete mode 100644 node_modules/core-js/library/modules/es6.string.fontcolor.js delete mode 100644 node_modules/core-js/library/modules/es6.string.fontsize.js delete mode 100644 node_modules/core-js/library/modules/es6.string.italics.js delete mode 100644 node_modules/core-js/library/modules/es6.string.link.js delete mode 100644 node_modules/core-js/library/modules/es6.string.small.js delete mode 100644 node_modules/core-js/library/modules/es6.string.strike.js delete mode 100644 node_modules/core-js/library/modules/es6.string.sub.js delete mode 100644 node_modules/core-js/library/modules/es6.string.sup.js delete mode 100644 node_modules/core-js/library/modules/es7.asap.js delete mode 100644 node_modules/core-js/library/modules/es7.error.is-error.js delete mode 100644 node_modules/core-js/library/modules/es7.math.iaddh.js delete mode 100644 node_modules/core-js/library/modules/es7.math.imulh.js delete mode 100644 node_modules/core-js/library/modules/es7.math.isubh.js delete mode 100644 node_modules/core-js/library/modules/es7.math.umulh.js delete mode 100644 node_modules/core-js/library/modules/es7.object.define-getter.js delete mode 100644 node_modules/core-js/library/modules/es7.object.define-setter.js delete mode 100644 node_modules/core-js/library/modules/es7.object.enumerable-entries.js delete mode 100644 node_modules/core-js/library/modules/es7.object.enumerable-keys.js delete mode 100644 node_modules/core-js/library/modules/es7.object.enumerable-values.js delete mode 100644 node_modules/core-js/library/modules/es7.object.lookup-getter.js delete mode 100644 node_modules/core-js/library/modules/es7.object.lookup-setter.js delete mode 100644 node_modules/core-js/library/modules/es7.observable.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.define-metadata.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.delete-metadata.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.get-metadata-keys.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.get-metadata.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.get-own-metadata-keys.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.get-own-metadata.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.has-metadata.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.has-own-metadata.js delete mode 100644 node_modules/core-js/library/modules/es7.reflect.metadata.js delete mode 100644 node_modules/core-js/library/modules/es7.string.match-all.js delete mode 100644 node_modules/core-js/library/modules/es7.string.pad-end.js delete mode 100644 node_modules/core-js/library/modules/es7.string.pad-start.js delete mode 100644 node_modules/core-js/library/modules/es7.symbol.async-iterator.js delete mode 100644 node_modules/core-js/library/modules/es7.symbol.observable.js delete mode 100644 node_modules/core-js/library/modules/es7.system.global.js delete mode 100644 node_modules/core-js/library/stage/0.js delete mode 100644 node_modules/core-js/library/stage/1.js delete mode 100644 node_modules/core-js/library/stage/2.js delete mode 100644 node_modules/core-js/library/stage/3.js delete mode 100644 node_modules/core-js/library/stage/4.js delete mode 100644 node_modules/core-js/library/stage/index.js delete mode 100644 node_modules/core-js/library/stage/pre.js delete mode 100644 node_modules/core-js/library/web/dom-collections.js delete mode 100644 node_modules/core-js/modules/_a-function.js delete mode 100644 node_modules/core-js/modules/_a-number-value.js delete mode 100644 node_modules/core-js/modules/_add-to-unscopables.js delete mode 100644 node_modules/core-js/modules/_an-instance.js delete mode 100644 node_modules/core-js/modules/_an-object.js delete mode 100644 node_modules/core-js/modules/_array-copy-within.js delete mode 100644 node_modules/core-js/modules/_array-fill.js delete mode 100644 node_modules/core-js/modules/_array-from-iterable.js delete mode 100644 node_modules/core-js/modules/_array-includes.js delete mode 100644 node_modules/core-js/modules/_array-methods.js delete mode 100644 node_modules/core-js/modules/_array-reduce.js delete mode 100644 node_modules/core-js/modules/_array-species-constructor.js delete mode 100644 node_modules/core-js/modules/_array-species-create.js delete mode 100644 node_modules/core-js/modules/_bind.js delete mode 100644 node_modules/core-js/modules/_classof.js delete mode 100644 node_modules/core-js/modules/_cof.js delete mode 100644 node_modules/core-js/modules/_collection-strong.js delete mode 100644 node_modules/core-js/modules/_collection-to-json.js delete mode 100644 node_modules/core-js/modules/_collection-weak.js delete mode 100644 node_modules/core-js/modules/_collection.js delete mode 100644 node_modules/core-js/modules/_core.js delete mode 100644 node_modules/core-js/modules/_create-property.js delete mode 100644 node_modules/core-js/modules/_ctx.js delete mode 100644 node_modules/core-js/modules/_date-to-primitive.js delete mode 100644 node_modules/core-js/modules/_defined.js delete mode 100644 node_modules/core-js/modules/_descriptors.js delete mode 100644 node_modules/core-js/modules/_dom-create.js delete mode 100644 node_modules/core-js/modules/_entry-virtual.js delete mode 100644 node_modules/core-js/modules/_enum-bug-keys.js delete mode 100644 node_modules/core-js/modules/_enum-keys.js delete mode 100644 node_modules/core-js/modules/_export.js delete mode 100644 node_modules/core-js/modules/_fails-is-regexp.js delete mode 100644 node_modules/core-js/modules/_fails.js delete mode 100644 node_modules/core-js/modules/_fix-re-wks.js delete mode 100644 node_modules/core-js/modules/_flags.js delete mode 100644 node_modules/core-js/modules/_for-of.js delete mode 100644 node_modules/core-js/modules/_global.js delete mode 100644 node_modules/core-js/modules/_has.js delete mode 100644 node_modules/core-js/modules/_hide.js delete mode 100644 node_modules/core-js/modules/_html.js delete mode 100644 node_modules/core-js/modules/_ie8-dom-define.js delete mode 100644 node_modules/core-js/modules/_inherit-if-required.js delete mode 100644 node_modules/core-js/modules/_invoke.js delete mode 100644 node_modules/core-js/modules/_iobject.js delete mode 100644 node_modules/core-js/modules/_is-array-iter.js delete mode 100644 node_modules/core-js/modules/_is-array.js delete mode 100644 node_modules/core-js/modules/_is-integer.js delete mode 100644 node_modules/core-js/modules/_is-object.js delete mode 100644 node_modules/core-js/modules/_is-regexp.js delete mode 100644 node_modules/core-js/modules/_iter-call.js delete mode 100644 node_modules/core-js/modules/_iter-create.js delete mode 100644 node_modules/core-js/modules/_iter-define.js delete mode 100644 node_modules/core-js/modules/_iter-detect.js delete mode 100644 node_modules/core-js/modules/_iter-step.js delete mode 100644 node_modules/core-js/modules/_iterators.js delete mode 100644 node_modules/core-js/modules/_keyof.js delete mode 100644 node_modules/core-js/modules/_library.js delete mode 100644 node_modules/core-js/modules/_math-expm1.js delete mode 100644 node_modules/core-js/modules/_math-log1p.js delete mode 100644 node_modules/core-js/modules/_math-sign.js delete mode 100644 node_modules/core-js/modules/_meta.js delete mode 100644 node_modules/core-js/modules/_metadata.js delete mode 100644 node_modules/core-js/modules/_microtask.js delete mode 100644 node_modules/core-js/modules/_object-assign.js delete mode 100644 node_modules/core-js/modules/_object-create.js delete mode 100644 node_modules/core-js/modules/_object-define.js delete mode 100644 node_modules/core-js/modules/_object-dp.js delete mode 100644 node_modules/core-js/modules/_object-dps.js delete mode 100644 node_modules/core-js/modules/_object-forced-pam.js delete mode 100644 node_modules/core-js/modules/_object-gopd.js delete mode 100644 node_modules/core-js/modules/_object-gopn-ext.js delete mode 100644 node_modules/core-js/modules/_object-gopn.js delete mode 100644 node_modules/core-js/modules/_object-gops.js delete mode 100644 node_modules/core-js/modules/_object-gpo.js delete mode 100644 node_modules/core-js/modules/_object-keys-internal.js delete mode 100644 node_modules/core-js/modules/_object-keys.js delete mode 100644 node_modules/core-js/modules/_object-pie.js delete mode 100644 node_modules/core-js/modules/_object-sap.js delete mode 100644 node_modules/core-js/modules/_object-to-array.js delete mode 100644 node_modules/core-js/modules/_own-keys.js delete mode 100644 node_modules/core-js/modules/_parse-float.js delete mode 100644 node_modules/core-js/modules/_parse-int.js delete mode 100644 node_modules/core-js/modules/_partial.js delete mode 100644 node_modules/core-js/modules/_path.js delete mode 100644 node_modules/core-js/modules/_property-desc.js delete mode 100644 node_modules/core-js/modules/_redefine-all.js delete mode 100644 node_modules/core-js/modules/_redefine.js delete mode 100644 node_modules/core-js/modules/_replacer.js delete mode 100644 node_modules/core-js/modules/_same-value.js delete mode 100644 node_modules/core-js/modules/_set-proto.js delete mode 100644 node_modules/core-js/modules/_set-species.js delete mode 100644 node_modules/core-js/modules/_set-to-string-tag.js delete mode 100644 node_modules/core-js/modules/_shared-key.js delete mode 100644 node_modules/core-js/modules/_shared.js delete mode 100644 node_modules/core-js/modules/_species-constructor.js delete mode 100644 node_modules/core-js/modules/_strict-method.js delete mode 100644 node_modules/core-js/modules/_string-at.js delete mode 100644 node_modules/core-js/modules/_string-context.js delete mode 100644 node_modules/core-js/modules/_string-html.js delete mode 100644 node_modules/core-js/modules/_string-pad.js delete mode 100644 node_modules/core-js/modules/_string-repeat.js delete mode 100644 node_modules/core-js/modules/_string-trim.js delete mode 100644 node_modules/core-js/modules/_string-ws.js delete mode 100644 node_modules/core-js/modules/_task.js delete mode 100644 node_modules/core-js/modules/_to-index.js delete mode 100644 node_modules/core-js/modules/_to-integer.js delete mode 100644 node_modules/core-js/modules/_to-iobject.js delete mode 100644 node_modules/core-js/modules/_to-length.js delete mode 100644 node_modules/core-js/modules/_to-object.js delete mode 100644 node_modules/core-js/modules/_to-primitive.js delete mode 100644 node_modules/core-js/modules/_typed-array.js delete mode 100644 node_modules/core-js/modules/_typed-buffer.js delete mode 100644 node_modules/core-js/modules/_typed.js delete mode 100644 node_modules/core-js/modules/_uid.js delete mode 100644 node_modules/core-js/modules/_wks-define.js delete mode 100644 node_modules/core-js/modules/_wks-ext.js delete mode 100644 node_modules/core-js/modules/_wks.js delete mode 100644 node_modules/core-js/modules/core.regexp.escape.js delete mode 100644 node_modules/core-js/modules/es6.array.every.js delete mode 100644 node_modules/core-js/modules/es6.array.filter.js delete mode 100644 node_modules/core-js/modules/es6.array.for-each.js delete mode 100644 node_modules/core-js/modules/es6.array.index-of.js delete mode 100644 node_modules/core-js/modules/es6.array.is-array.js delete mode 100644 node_modules/core-js/modules/es6.array.join.js delete mode 100644 node_modules/core-js/modules/es6.array.last-index-of.js delete mode 100644 node_modules/core-js/modules/es6.array.map.js delete mode 100644 node_modules/core-js/modules/es6.array.reduce-right.js delete mode 100644 node_modules/core-js/modules/es6.array.reduce.js delete mode 100644 node_modules/core-js/modules/es6.array.slice.js delete mode 100644 node_modules/core-js/modules/es6.array.some.js delete mode 100644 node_modules/core-js/modules/es6.array.sort.js delete mode 100644 node_modules/core-js/modules/es6.date.now.js delete mode 100644 node_modules/core-js/modules/es6.date.to-iso-string.js delete mode 100644 node_modules/core-js/modules/es6.date.to-json.js delete mode 100644 node_modules/core-js/modules/es6.date.to-primitive.js delete mode 100644 node_modules/core-js/modules/es6.function.bind.js delete mode 100644 node_modules/core-js/modules/es6.number.to-fixed.js delete mode 100644 node_modules/core-js/modules/es6.number.to-precision.js delete mode 100644 node_modules/core-js/modules/es6.object.create.js delete mode 100644 node_modules/core-js/modules/es6.object.define-properties.js delete mode 100644 node_modules/core-js/modules/es6.object.define-property.js delete mode 100644 node_modules/core-js/modules/es6.parse-float.js delete mode 100644 node_modules/core-js/modules/es6.parse-int.js delete mode 100644 node_modules/core-js/modules/es6.regexp.to-string.js delete mode 100644 node_modules/core-js/modules/es6.string.anchor.js delete mode 100644 node_modules/core-js/modules/es6.string.big.js delete mode 100644 node_modules/core-js/modules/es6.string.blink.js delete mode 100644 node_modules/core-js/modules/es6.string.bold.js delete mode 100644 node_modules/core-js/modules/es6.string.fixed.js delete mode 100644 node_modules/core-js/modules/es6.string.fontcolor.js delete mode 100644 node_modules/core-js/modules/es6.string.fontsize.js delete mode 100644 node_modules/core-js/modules/es6.string.italics.js delete mode 100644 node_modules/core-js/modules/es6.string.link.js delete mode 100644 node_modules/core-js/modules/es6.string.small.js delete mode 100644 node_modules/core-js/modules/es6.string.strike.js delete mode 100644 node_modules/core-js/modules/es6.string.sub.js delete mode 100644 node_modules/core-js/modules/es6.string.sup.js delete mode 100644 node_modules/core-js/modules/es7.asap.js delete mode 100644 node_modules/core-js/modules/es7.error.is-error.js delete mode 100644 node_modules/core-js/modules/es7.math.iaddh.js delete mode 100644 node_modules/core-js/modules/es7.math.imulh.js delete mode 100644 node_modules/core-js/modules/es7.math.isubh.js delete mode 100644 node_modules/core-js/modules/es7.math.umulh.js delete mode 100644 node_modules/core-js/modules/es7.object.define-getter.js delete mode 100644 node_modules/core-js/modules/es7.object.define-setter.js delete mode 100644 node_modules/core-js/modules/es7.object.enumerable-entries.js delete mode 100644 node_modules/core-js/modules/es7.object.enumerable-keys.js delete mode 100644 node_modules/core-js/modules/es7.object.enumerable-values.js delete mode 100644 node_modules/core-js/modules/es7.object.lookup-getter.js delete mode 100644 node_modules/core-js/modules/es7.object.lookup-setter.js delete mode 100644 node_modules/core-js/modules/es7.observable.js delete mode 100644 node_modules/core-js/modules/es7.reflect.define-metadata.js delete mode 100644 node_modules/core-js/modules/es7.reflect.delete-metadata.js delete mode 100644 node_modules/core-js/modules/es7.reflect.get-metadata-keys.js delete mode 100644 node_modules/core-js/modules/es7.reflect.get-metadata.js delete mode 100644 node_modules/core-js/modules/es7.reflect.get-own-metadata-keys.js delete mode 100644 node_modules/core-js/modules/es7.reflect.get-own-metadata.js delete mode 100644 node_modules/core-js/modules/es7.reflect.has-metadata.js delete mode 100644 node_modules/core-js/modules/es7.reflect.has-own-metadata.js delete mode 100644 node_modules/core-js/modules/es7.reflect.metadata.js delete mode 100644 node_modules/core-js/modules/es7.string.match-all.js delete mode 100644 node_modules/core-js/modules/es7.string.pad-end.js delete mode 100644 node_modules/core-js/modules/es7.string.pad-start.js delete mode 100644 node_modules/core-js/modules/es7.symbol.async-iterator.js delete mode 100644 node_modules/core-js/modules/es7.symbol.observable.js delete mode 100644 node_modules/core-js/modules/es7.system.global.js delete mode 100644 node_modules/core-js/modules/library/_add-to-unscopables.js delete mode 100644 node_modules/core-js/modules/library/_collection.js delete mode 100644 node_modules/core-js/modules/library/_export.js delete mode 100644 node_modules/core-js/modules/library/_library.js delete mode 100644 node_modules/core-js/modules/library/_path.js delete mode 100644 node_modules/core-js/modules/library/_redefine-all.js delete mode 100644 node_modules/core-js/modules/library/_redefine.js delete mode 100644 node_modules/core-js/modules/library/_set-species.js delete mode 100644 node_modules/core-js/modules/library/es6.date.to-primitive.js delete mode 100644 node_modules/core-js/modules/library/es6.regexp.to-string.js delete mode 100644 node_modules/core-js/stage/0.js delete mode 100644 node_modules/core-js/stage/1.js delete mode 100644 node_modules/core-js/stage/2.js delete mode 100644 node_modules/core-js/stage/3.js delete mode 100644 node_modules/core-js/stage/4.js delete mode 100644 node_modules/core-js/stage/index.js delete mode 100644 node_modules/core-js/stage/pre.js delete mode 100644 node_modules/core-js/web/dom-collections.js delete mode 100644 node_modules/dateformat/.travis.yml delete mode 100755 node_modules/dateformat/bin/cli.js delete mode 100644 node_modules/dateformat/test/test_dayofweek.js delete mode 100644 node_modules/dateformat/test/test_formats.js delete mode 100644 node_modules/dateformat/test/test_isoutcdatetime.js delete mode 100644 node_modules/dateformat/test/weekofyear/test_weekofyear.js delete mode 100644 node_modules/dateformat/test/weekofyear/test_weekofyear.sh delete mode 100644 node_modules/debug/.jshintrc delete mode 100644 node_modules/debug/History.md delete mode 100644 node_modules/debug/Readme.md delete mode 100644 node_modules/debug/browser.js delete mode 100644 node_modules/debug/debug.js delete mode 100644 node_modules/glob-base/node_modules/glob-parent/.npmignore delete mode 100644 node_modules/glob-base/node_modules/glob-parent/.travis.yml delete mode 100644 node_modules/glob-base/node_modules/glob-parent/LICENSE delete mode 100644 node_modules/glob-base/node_modules/glob-parent/README.md delete mode 100644 node_modules/glob-base/node_modules/glob-parent/index.js delete mode 100644 node_modules/glob-base/node_modules/glob-parent/package.json delete mode 100644 node_modules/glob-base/node_modules/glob-parent/test.js delete mode 100644 node_modules/glob-parent/appveyor.yml delete mode 100644 node_modules/glob-parent/node_modules/is-extglob/LICENSE delete mode 100644 node_modules/glob-parent/node_modules/is-extglob/README.md delete mode 100644 node_modules/glob-parent/node_modules/is-extglob/index.js delete mode 100644 node_modules/glob-parent/node_modules/is-extglob/package.json delete mode 100644 node_modules/glob-parent/node_modules/is-glob/LICENSE delete mode 100644 node_modules/glob-parent/node_modules/is-glob/README.md delete mode 100644 node_modules/glob-parent/node_modules/is-glob/index.js delete mode 100644 node_modules/glob-parent/node_modules/is-glob/package.json delete mode 100644 node_modules/gulp-debug/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp-debug/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp-debug/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp-debug/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp-debug/node_modules/clone-stats/test.js delete mode 100755 node_modules/gulp-debug/node_modules/gulp-util/LICENSE delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/README.md delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/index.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/PluginError.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/buffer.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/combine.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/env.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/isBuffer.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/isNull.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/isStream.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/log.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/noop.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/lib/template.js delete mode 120000 node_modules/gulp-debug/node_modules/gulp-util/node_modules/.bin/dateformat delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/node_modules/object-assign/index.js delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/node_modules/object-assign/license delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/node_modules/object-assign/package.json delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/node_modules/object-assign/readme.md delete mode 100644 node_modules/gulp-debug/node_modules/gulp-util/package.json delete mode 100644 node_modules/gulp-debug/node_modules/lodash._reinterpolate/LICENSE.txt delete mode 100644 node_modules/gulp-debug/node_modules/lodash._reinterpolate/README.md delete mode 100644 node_modules/gulp-debug/node_modules/lodash._reinterpolate/index.js delete mode 100644 node_modules/gulp-debug/node_modules/lodash._reinterpolate/package.json delete mode 100644 node_modules/gulp-debug/node_modules/lodash.template/LICENSE delete mode 100644 node_modules/gulp-debug/node_modules/lodash.template/README.md delete mode 100644 node_modules/gulp-debug/node_modules/lodash.template/index.js delete mode 100644 node_modules/gulp-debug/node_modules/lodash.template/package.json delete mode 100644 node_modules/gulp-debug/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/gulp-debug/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/gulp-debug/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/gulp-debug/node_modules/replace-ext/README.md delete mode 100644 node_modules/gulp-debug/node_modules/replace-ext/index.js delete mode 100644 node_modules/gulp-debug/node_modules/replace-ext/package.json delete mode 100644 node_modules/gulp-debug/node_modules/replace-ext/test/main.js delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/LICENSE delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/README.md delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/index.js delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/lib/cloneBuffer.js delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/lib/inspectStream.js delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/lib/isBuffer.js delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/lib/isNull.js delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/lib/isStream.js delete mode 100644 node_modules/gulp-debug/node_modules/vinyl/package.json delete mode 100644 node_modules/gulp-json-transform/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp-json-transform/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp-json-transform/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp-json-transform/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp-json-transform/node_modules/clone-stats/test.js delete mode 100755 node_modules/gulp-json-transform/node_modules/gulp-util/LICENSE delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/README.md delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/index.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/PluginError.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/buffer.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/combine.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/env.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/isBuffer.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/isNull.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/isStream.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/log.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/noop.js delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/lib/template.js delete mode 120000 node_modules/gulp-json-transform/node_modules/gulp-util/node_modules/.bin/dateformat delete mode 100644 node_modules/gulp-json-transform/node_modules/gulp-util/package.json delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash._reinterpolate/LICENSE.txt delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash._reinterpolate/README.md delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash._reinterpolate/index.js delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash._reinterpolate/package.json delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash.template/LICENSE delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash.template/README.md delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash.template/index.js delete mode 100644 node_modules/gulp-json-transform/node_modules/lodash.template/package.json delete mode 100644 node_modules/gulp-json-transform/node_modules/object-assign/index.js delete mode 100644 node_modules/gulp-json-transform/node_modules/object-assign/license delete mode 100644 node_modules/gulp-json-transform/node_modules/object-assign/package.json delete mode 100644 node_modules/gulp-json-transform/node_modules/object-assign/readme.md delete mode 100644 node_modules/gulp-json-transform/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/gulp-json-transform/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/gulp-json-transform/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/gulp-json-transform/node_modules/replace-ext/README.md delete mode 100644 node_modules/gulp-json-transform/node_modules/replace-ext/index.js delete mode 100644 node_modules/gulp-json-transform/node_modules/replace-ext/package.json delete mode 100644 node_modules/gulp-json-transform/node_modules/replace-ext/test/main.js delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/LICENSE delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/README.md delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/index.js delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/lib/cloneBuffer.js delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/lib/inspectStream.js delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/lib/isBuffer.js delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/lib/isNull.js delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/lib/isStream.js delete mode 100644 node_modules/gulp-json-transform/node_modules/vinyl/package.json delete mode 100644 node_modules/gulp-sourcemaps/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp-sourcemaps/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp-sourcemaps/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp-sourcemaps/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp-sourcemaps/node_modules/clone-stats/test.js delete mode 100644 node_modules/gulp-sourcemaps/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/gulp-sourcemaps/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/gulp-sourcemaps/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/gulp-sourcemaps/node_modules/replace-ext/README.md delete mode 100644 node_modules/gulp-sourcemaps/node_modules/replace-ext/index.js delete mode 100644 node_modules/gulp-sourcemaps/node_modules/replace-ext/package.json delete mode 100644 node_modules/gulp-sourcemaps/node_modules/replace-ext/test/main.js delete mode 100644 node_modules/gulp-tar/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp-tar/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp-tar/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp-tar/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp-tar/node_modules/clone-stats/test.js delete mode 100755 node_modules/gulp-tar/node_modules/gulp-util/LICENSE delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/README.md delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/index.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/PluginError.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/buffer.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/combine.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/env.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/isBuffer.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/isNull.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/isStream.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/log.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/noop.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/lib/template.js delete mode 120000 node_modules/gulp-tar/node_modules/gulp-util/node_modules/.bin/dateformat delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/node_modules/object-assign/index.js delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/node_modules/object-assign/license delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/node_modules/object-assign/package.json delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/node_modules/object-assign/readme.md delete mode 100644 node_modules/gulp-tar/node_modules/gulp-util/package.json delete mode 100644 node_modules/gulp-tar/node_modules/lodash._reinterpolate/LICENSE.txt delete mode 100644 node_modules/gulp-tar/node_modules/lodash._reinterpolate/README.md delete mode 100644 node_modules/gulp-tar/node_modules/lodash._reinterpolate/index.js delete mode 100644 node_modules/gulp-tar/node_modules/lodash._reinterpolate/package.json delete mode 100644 node_modules/gulp-tar/node_modules/lodash.template/LICENSE delete mode 100644 node_modules/gulp-tar/node_modules/lodash.template/README.md delete mode 100644 node_modules/gulp-tar/node_modules/lodash.template/index.js delete mode 100644 node_modules/gulp-tar/node_modules/lodash.template/package.json delete mode 100644 node_modules/gulp-tar/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/gulp-tar/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/gulp-tar/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/gulp-tar/node_modules/replace-ext/README.md delete mode 100644 node_modules/gulp-tar/node_modules/replace-ext/index.js delete mode 100644 node_modules/gulp-tar/node_modules/replace-ext/package.json delete mode 100644 node_modules/gulp-tar/node_modules/replace-ext/test/main.js delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/LICENSE delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/README.md delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/index.js delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/lib/cloneBuffer.js delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/lib/inspectStream.js delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/lib/isBuffer.js delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/lib/isNull.js delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/lib/isStream.js delete mode 100644 node_modules/gulp-tar/node_modules/vinyl/package.json delete mode 100644 node_modules/gulp-typescript/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp-typescript/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp-typescript/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp-typescript/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp-typescript/node_modules/clone-stats/test.js delete mode 100755 node_modules/gulp-typescript/node_modules/gulp-util/LICENSE delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/README.md delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/index.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/PluginError.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/buffer.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/combine.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/env.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/isBuffer.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/isNull.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/isStream.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/log.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/noop.js delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/lib/template.js delete mode 120000 node_modules/gulp-typescript/node_modules/gulp-util/node_modules/.bin/dateformat delete mode 100644 node_modules/gulp-typescript/node_modules/gulp-util/package.json delete mode 100644 node_modules/gulp-typescript/node_modules/lodash._reinterpolate/LICENSE.txt delete mode 100644 node_modules/gulp-typescript/node_modules/lodash._reinterpolate/README.md delete mode 100644 node_modules/gulp-typescript/node_modules/lodash._reinterpolate/index.js delete mode 100644 node_modules/gulp-typescript/node_modules/lodash._reinterpolate/package.json delete mode 100644 node_modules/gulp-typescript/node_modules/lodash.template/LICENSE delete mode 100644 node_modules/gulp-typescript/node_modules/lodash.template/README.md delete mode 100644 node_modules/gulp-typescript/node_modules/lodash.template/index.js delete mode 100644 node_modules/gulp-typescript/node_modules/lodash.template/package.json delete mode 100644 node_modules/gulp-typescript/node_modules/object-assign/index.js delete mode 100644 node_modules/gulp-typescript/node_modules/object-assign/license delete mode 100644 node_modules/gulp-typescript/node_modules/object-assign/package.json delete mode 100644 node_modules/gulp-typescript/node_modules/object-assign/readme.md delete mode 100644 node_modules/gulp-typescript/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/gulp-typescript/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/gulp-typescript/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/gulp-typescript/node_modules/replace-ext/README.md delete mode 100644 node_modules/gulp-typescript/node_modules/replace-ext/index.js delete mode 100644 node_modules/gulp-typescript/node_modules/replace-ext/package.json delete mode 100644 node_modules/gulp-typescript/node_modules/replace-ext/test/main.js delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/LICENSE delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/README.md delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/index.js delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/lib/cloneBuffer.js delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/lib/inspectStream.js delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/lib/isBuffer.js delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/lib/isNull.js delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/lib/isStream.js delete mode 100644 node_modules/gulp-typescript/node_modules/vinyl/package.json delete mode 100644 node_modules/gulp-util/.npmignore delete mode 100644 node_modules/gulp-util/.travis.yml delete mode 100644 node_modules/gulp-util/lib/File.js delete mode 100644 node_modules/gulp-util/lib/beep.js delete mode 100644 node_modules/gulp-util/lib/colors.js delete mode 100644 node_modules/gulp-util/lib/date.js delete mode 100644 node_modules/gulp-util/lib/linefeed.js delete mode 100644 node_modules/gulp-util/lib/replaceExtension.js delete mode 120000 node_modules/gulp-util/node_modules/.bin/dateformat delete mode 100644 node_modules/gulp-util/node_modules/ansi-regex/index.js delete mode 100644 node_modules/gulp-util/node_modules/ansi-regex/package.json delete mode 100644 node_modules/gulp-util/node_modules/ansi-regex/readme.md delete mode 100644 node_modules/gulp-util/node_modules/ansi-styles/index.js delete mode 100644 node_modules/gulp-util/node_modules/ansi-styles/package.json delete mode 100644 node_modules/gulp-util/node_modules/ansi-styles/readme.md delete mode 100644 node_modules/gulp-util/node_modules/chalk/index.js delete mode 120000 node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi delete mode 120000 node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi delete mode 120000 node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color delete mode 100644 node_modules/gulp-util/node_modules/chalk/package.json delete mode 100644 node_modules/gulp-util/node_modules/chalk/readme.md delete mode 100644 node_modules/gulp-util/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp-util/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp-util/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp-util/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp-util/node_modules/clone-stats/test.js delete mode 100755 node_modules/gulp-util/node_modules/has-ansi/cli.js delete mode 100644 node_modules/gulp-util/node_modules/has-ansi/index.js delete mode 100644 node_modules/gulp-util/node_modules/has-ansi/package.json delete mode 100644 node_modules/gulp-util/node_modules/has-ansi/readme.md delete mode 100644 node_modules/gulp-util/node_modules/isarray/README.md delete mode 100644 node_modules/gulp-util/node_modules/isarray/build/build.js delete mode 100644 node_modules/gulp-util/node_modules/isarray/component.json delete mode 100644 node_modules/gulp-util/node_modules/isarray/index.js delete mode 100644 node_modules/gulp-util/node_modules/isarray/package.json delete mode 100644 node_modules/gulp-util/node_modules/minimist/.travis.yml delete mode 100644 node_modules/gulp-util/node_modules/minimist/LICENSE delete mode 100644 node_modules/gulp-util/node_modules/minimist/example/parse.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/index.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/package.json delete mode 100644 node_modules/gulp-util/node_modules/minimist/readme.markdown delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/all_bool.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/bool.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/dash.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/default_bool.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/dotted.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/long.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/num.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/parse.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/parse_modified.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/short.js delete mode 100644 node_modules/gulp-util/node_modules/minimist/test/whitespace.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/.npmignore delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/LICENSE delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/README.md delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/duplex.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/lib/_stream_duplex.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/lib/_stream_passthrough.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/lib/_stream_readable.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/lib/_stream_transform.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/lib/_stream_writable.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/package.json delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/passthrough.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/readable.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/transform.js delete mode 100644 node_modules/gulp-util/node_modules/readable-stream/writable.js delete mode 100755 node_modules/gulp-util/node_modules/strip-ansi/cli.js delete mode 100644 node_modules/gulp-util/node_modules/strip-ansi/index.js delete mode 100644 node_modules/gulp-util/node_modules/strip-ansi/package.json delete mode 100644 node_modules/gulp-util/node_modules/strip-ansi/readme.md delete mode 100755 node_modules/gulp-util/node_modules/supports-color/cli.js delete mode 100644 node_modules/gulp-util/node_modules/supports-color/index.js delete mode 100644 node_modules/gulp-util/node_modules/supports-color/package.json delete mode 100644 node_modules/gulp-util/node_modules/supports-color/readme.md delete mode 100644 node_modules/gulp-util/node_modules/through2/.npmignore delete mode 100644 node_modules/gulp-util/node_modules/through2/LICENSE delete mode 100644 node_modules/gulp-util/node_modules/through2/README.md delete mode 100644 node_modules/gulp-util/node_modules/through2/package.json delete mode 100644 node_modules/gulp-util/node_modules/through2/through2.js delete mode 100644 node_modules/gulp-util/node_modules/vinyl/.npmignore delete mode 100644 node_modules/gulp-util/node_modules/vinyl/.travis.yml mode change 100755 => 100644 node_modules/gulp-util/node_modules/vinyl/LICENSE delete mode 100644 node_modules/gulp-util/node_modules/vinyl/test/File.js delete mode 100644 node_modules/gulp-util/node_modules/vinyl/test/cloneBuffer.js delete mode 100644 node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js delete mode 100644 node_modules/gulp-util/node_modules/vinyl/test/isBuffer.js delete mode 100644 node_modules/gulp-util/node_modules/vinyl/test/isNull.js delete mode 100644 node_modules/gulp-util/node_modules/vinyl/test/isStream.js delete mode 100644 node_modules/gulp-util/node_modules/xtend/.jshintrc delete mode 100644 node_modules/gulp-util/node_modules/xtend/.npmignore delete mode 100644 node_modules/gulp-util/node_modules/xtend/LICENCE delete mode 100644 node_modules/gulp-util/node_modules/xtend/Makefile delete mode 100644 node_modules/gulp-util/node_modules/xtend/README.md delete mode 100644 node_modules/gulp-util/node_modules/xtend/index.js delete mode 100644 node_modules/gulp-util/node_modules/xtend/mutable.js delete mode 100644 node_modules/gulp-util/node_modules/xtend/package.json delete mode 100644 node_modules/gulp-util/node_modules/xtend/test.js delete mode 100644 node_modules/gulp-zip/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp-zip/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp-zip/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp-zip/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp-zip/node_modules/clone-stats/test.js delete mode 100755 node_modules/gulp-zip/node_modules/gulp-util/LICENSE delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/README.md delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/index.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/PluginError.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/buffer.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/combine.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/env.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/isBuffer.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/isNull.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/isStream.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/log.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/noop.js delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/lib/template.js delete mode 120000 node_modules/gulp-zip/node_modules/gulp-util/node_modules/.bin/dateformat delete mode 100644 node_modules/gulp-zip/node_modules/gulp-util/package.json delete mode 100644 node_modules/gulp-zip/node_modules/lodash._reinterpolate/LICENSE.txt delete mode 100644 node_modules/gulp-zip/node_modules/lodash._reinterpolate/README.md delete mode 100644 node_modules/gulp-zip/node_modules/lodash._reinterpolate/index.js delete mode 100644 node_modules/gulp-zip/node_modules/lodash._reinterpolate/package.json delete mode 100644 node_modules/gulp-zip/node_modules/lodash.template/LICENSE delete mode 100644 node_modules/gulp-zip/node_modules/lodash.template/README.md delete mode 100644 node_modules/gulp-zip/node_modules/lodash.template/index.js delete mode 100644 node_modules/gulp-zip/node_modules/lodash.template/package.json delete mode 100644 node_modules/gulp-zip/node_modules/object-assign/index.js delete mode 100644 node_modules/gulp-zip/node_modules/object-assign/license delete mode 100644 node_modules/gulp-zip/node_modules/object-assign/package.json delete mode 100644 node_modules/gulp-zip/node_modules/object-assign/readme.md delete mode 100644 node_modules/gulp-zip/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/gulp-zip/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/gulp-zip/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/gulp-zip/node_modules/replace-ext/README.md delete mode 100644 node_modules/gulp-zip/node_modules/replace-ext/index.js delete mode 100644 node_modules/gulp-zip/node_modules/replace-ext/package.json delete mode 100644 node_modules/gulp-zip/node_modules/replace-ext/test/main.js delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/LICENSE delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/README.md delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/index.js delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/lib/cloneBuffer.js delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/lib/inspectStream.js delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/lib/isBuffer.js delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/lib/isNull.js delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/lib/isStream.js delete mode 100644 node_modules/gulp-zip/node_modules/vinyl/package.json delete mode 100644 node_modules/gulp/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/gulp/node_modules/clone-stats/README.md delete mode 100644 node_modules/gulp/node_modules/clone-stats/index.js delete mode 100644 node_modules/gulp/node_modules/clone-stats/package.json delete mode 100644 node_modules/gulp/node_modules/clone-stats/test.js delete mode 100755 node_modules/gulp/node_modules/gulp-util/LICENSE delete mode 100644 node_modules/gulp/node_modules/gulp-util/README.md delete mode 100644 node_modules/gulp/node_modules/gulp-util/index.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/PluginError.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/buffer.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/combine.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/env.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/isBuffer.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/isNull.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/isStream.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/log.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/noop.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/lib/template.js delete mode 120000 node_modules/gulp/node_modules/gulp-util/node_modules/.bin/dateformat delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/.npmignore delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/.travis.yml delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/LICENSE delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/README.md delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/clone.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/package.json delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/test-apart-ctx.html delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/test.html delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/clone/test.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/.npmignore delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/.travis.yml delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/.zuul.yml delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/LICENSE delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/README.md delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/doc/stream.markdown delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/duplex.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/lib/_stream_duplex.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/lib/_stream_passthrough.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/lib/_stream_readable.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/lib/_stream_transform.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/lib/_stream_writable.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/package.json delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/passthrough.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/readable.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/transform.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/readable-stream/writable.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/through2/.npmignore delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/through2/LICENSE delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/through2/README.md delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/through2/package.json delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/through2/through2.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/LICENSE delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/README.md delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/index.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/lib/cloneBuffer.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/lib/inspectStream.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/lib/isBuffer.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/lib/isNull.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/lib/isStream.js delete mode 100644 node_modules/gulp/node_modules/gulp-util/node_modules/vinyl/package.json delete mode 100644 node_modules/gulp/node_modules/gulp-util/package.json delete mode 100644 node_modules/gulp/node_modules/lodash._reinterpolate/LICENSE.txt delete mode 100644 node_modules/gulp/node_modules/lodash._reinterpolate/README.md delete mode 100644 node_modules/gulp/node_modules/lodash._reinterpolate/index.js delete mode 100644 node_modules/gulp/node_modules/lodash._reinterpolate/package.json delete mode 100644 node_modules/gulp/node_modules/lodash.template/LICENSE delete mode 100644 node_modules/gulp/node_modules/lodash.template/README.md delete mode 100644 node_modules/gulp/node_modules/lodash.template/index.js delete mode 100644 node_modules/gulp/node_modules/lodash.template/package.json delete mode 100644 node_modules/gulp/node_modules/object-assign/index.js delete mode 100644 node_modules/gulp/node_modules/object-assign/license delete mode 100644 node_modules/gulp/node_modules/object-assign/package.json delete mode 100644 node_modules/gulp/node_modules/object-assign/readme.md delete mode 100644 node_modules/gulp/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/gulp/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/gulp/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/gulp/node_modules/replace-ext/README.md delete mode 100644 node_modules/gulp/node_modules/replace-ext/index.js delete mode 100644 node_modules/gulp/node_modules/replace-ext/package.json delete mode 100644 node_modules/gulp/node_modules/replace-ext/test/main.js delete mode 100644 node_modules/hosted-git-info/.npmignore delete mode 100644 node_modules/is-buffer/.travis.yml delete mode 100644 node_modules/is-buffer/.zuul.yml delete mode 100644 node_modules/isexe/access.js delete mode 100644 node_modules/istanbul-lib-instrument/node_modules/semver/LICENSE delete mode 100644 node_modules/istanbul-lib-instrument/node_modules/semver/README.md delete mode 100755 node_modules/istanbul-lib-instrument/node_modules/semver/bin/semver delete mode 100644 node_modules/istanbul-lib-instrument/node_modules/semver/package.json delete mode 100644 node_modules/istanbul-lib-instrument/node_modules/semver/range.bnf delete mode 100644 node_modules/istanbul-lib-instrument/node_modules/semver/semver.js delete mode 100644 node_modules/js-tokens/changelog.md delete mode 100644 node_modules/js-tokens/readme.md delete mode 100644 node_modules/lodash._reunescapedhtml/node_modules/lodash.keys/LICENSE.txt delete mode 100644 node_modules/lodash._reunescapedhtml/node_modules/lodash.keys/README.md delete mode 100644 node_modules/lodash._reunescapedhtml/node_modules/lodash.keys/index.js delete mode 100644 node_modules/lodash._reunescapedhtml/node_modules/lodash.keys/package.json delete mode 100644 node_modules/lodash.defaults/node_modules/lodash.keys/LICENSE.txt delete mode 100644 node_modules/lodash.defaults/node_modules/lodash.keys/README.md delete mode 100644 node_modules/lodash.defaults/node_modules/lodash.keys/index.js delete mode 100644 node_modules/lodash.defaults/node_modules/lodash.keys/package.json delete mode 100644 node_modules/lodash.escape/LICENSE delete mode 100644 node_modules/lodash.keys/LICENSE delete mode 100644 node_modules/lodash.template/LICENSE.txt delete mode 100644 node_modules/lodash.template/node_modules/lodash.escape/LICENSE.txt delete mode 100644 node_modules/lodash.template/node_modules/lodash.keys/LICENSE.txt delete mode 100644 node_modules/lodash.template/node_modules/lodash.templatesettings/LICENSE.txt delete mode 100644 node_modules/lodash.template/node_modules/lodash.templatesettings/README.md delete mode 100644 node_modules/lodash.template/node_modules/lodash.templatesettings/index.js delete mode 100644 node_modules/lodash.template/node_modules/lodash.templatesettings/package.json delete mode 100644 node_modules/lodash.values/node_modules/lodash.keys/LICENSE.txt delete mode 100644 node_modules/lodash.values/node_modules/lodash.keys/README.md delete mode 100644 node_modules/lodash.values/node_modules/lodash.keys/index.js delete mode 100644 node_modules/lodash.values/node_modules/lodash.keys/package.json delete mode 100644 node_modules/lodash/_assignInDefaults.js delete mode 100644 node_modules/lodash/_mergeDefaults.js delete mode 100644 node_modules/ms/.npmignore delete mode 100644 node_modules/ms/History.md delete mode 100644 node_modules/ms/LICENSE delete mode 100644 node_modules/normalize-package-data/node_modules/semver/LICENSE delete mode 100644 node_modules/normalize-package-data/node_modules/semver/README.md delete mode 100755 node_modules/normalize-package-data/node_modules/semver/bin/semver delete mode 100644 node_modules/normalize-package-data/node_modules/semver/package.json delete mode 100644 node_modules/normalize-package-data/node_modules/semver/range.bnf delete mode 100644 node_modules/normalize-package-data/node_modules/semver/semver.js delete mode 100644 node_modules/normalize-package-data/test/normalize.js~ delete mode 100644 node_modules/osenv/.npmignore delete mode 100644 node_modules/osenv/.travis.yml delete mode 100644 node_modules/osenv/LICENSE delete mode 100644 node_modules/osenv/README.md delete mode 100644 node_modules/osenv/osenv.js delete mode 100644 node_modules/osenv/package.json delete mode 100644 node_modules/osenv/test/unix.js delete mode 100644 node_modules/osenv/test/windows.js delete mode 100644 node_modules/osenv/x.tap delete mode 100644 node_modules/sax/LICENSE-W3C.html delete mode 100644 node_modules/selenium-webdriver/lib/firefox/amd64/libnoblur64.so delete mode 100644 node_modules/selenium-webdriver/lib/firefox/i386/libnoblur.so delete mode 100644 node_modules/semver/.npmignore delete mode 100644 node_modules/semver/.travis.yml delete mode 100644 node_modules/semver/Makefile delete mode 100644 node_modules/semver/foot.js.txt delete mode 100644 node_modules/semver/head.js.txt delete mode 100644 node_modules/semver/semver.browser.js delete mode 100644 node_modules/semver/semver.browser.js.gz delete mode 100644 node_modules/semver/semver.min.js delete mode 100644 node_modules/semver/semver.min.js.gz delete mode 100644 node_modules/semver/test/amd.js delete mode 100644 node_modules/semver/test/big-numbers.js delete mode 100644 node_modules/semver/test/clean.js delete mode 100644 node_modules/semver/test/gtr.js delete mode 100644 node_modules/semver/test/index.js delete mode 100644 node_modules/semver/test/ltr.js delete mode 100644 node_modules/semver/test/major-minor-patch.js delete mode 100644 node_modules/semver/test/no-module.js delete mode 100644 node_modules/through2/LICENSE delete mode 100644 node_modules/typescript/Gulpfile.ts delete mode 100644 node_modules/vinyl-fs/node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/vinyl-fs/node_modules/clone-stats/README.md delete mode 100644 node_modules/vinyl-fs/node_modules/clone-stats/index.js delete mode 100644 node_modules/vinyl-fs/node_modules/clone-stats/package.json delete mode 100644 node_modules/vinyl-fs/node_modules/clone-stats/test.js delete mode 100644 node_modules/vinyl-fs/node_modules/replace-ext/.npmignore delete mode 100644 node_modules/vinyl-fs/node_modules/replace-ext/.travis.yml delete mode 100755 node_modules/vinyl-fs/node_modules/replace-ext/LICENSE delete mode 100644 node_modules/vinyl-fs/node_modules/replace-ext/README.md delete mode 100644 node_modules/vinyl-fs/node_modules/replace-ext/index.js delete mode 100644 node_modules/vinyl-fs/node_modules/replace-ext/package.json delete mode 100644 node_modules/vinyl-fs/node_modules/replace-ext/test/main.js delete mode 100644 pogen/.gitignore delete mode 100644 pogen/dumpTree.ts delete mode 100644 pogen/example/messages.po delete mode 100644 pogen/example/test.ts delete mode 100644 pogen/example/test2.tsx delete mode 100644 pogen/pogen.ts delete mode 100644 pogen/tsconfig.json delete mode 100644 src/cryptoLib.ts delete mode 100644 src/moduleTrampoline.ts delete mode 100644 src/pages/debug.html create mode 100644 src/pages/popup.css create mode 100644 src/pages/popup.html create mode 100644 src/pages/popup.tsx delete mode 100644 src/popup/popup.css delete mode 100644 src/popup/popup.html delete mode 100644 src/popup/popup.tsx delete mode 100644 src/vendor/URI.js delete mode 100644 src/vendor/jed.d.ts delete mode 120000 src/vendor/jed.js delete mode 100644 src/vendor/react-dom.dev.js delete mode 120000 src/vendor/react-dom.js delete mode 100644 src/vendor/react-dom.min.js delete mode 100644 src/vendor/react.dev.js delete mode 120000 src/vendor/react.js delete mode 100644 src/vendor/react.min.js delete mode 100644 src/vendor/system-csp-production.src.js delete mode 100644 testlib/node/runtime.js delete mode 100644 testlib/selenium/.gitignore delete mode 100644 testlib/selenium/escodegen.browser.js delete mode 100644 testlib/selenium/esprima.js delete mode 100644 testlib/selenium/instrumenter.js delete mode 100644 testlib/selenium/runtime.js delete mode 100644 testlib/selenium/system.js delete mode 100644 testlib/selenium/testhost.html delete mode 100644 testlib/talertest.ts delete mode 100644 thirdparty/README delete mode 100644 thirdparty/URI.js/.editorconfig delete mode 100644 thirdparty/URI.js/.gitignore delete mode 100644 thirdparty/URI.js/.jshintrc delete mode 100644 thirdparty/URI.js/CHANGELOG.md delete mode 100644 thirdparty/URI.js/Gruntfile.js delete mode 100644 thirdparty/URI.js/LICENSE.txt delete mode 100644 thirdparty/URI.js/README.md delete mode 100644 thirdparty/URI.js/about-uris.html delete mode 100644 thirdparty/URI.js/bower.json delete mode 100644 thirdparty/URI.js/build.html delete mode 100644 thirdparty/URI.js/build.js delete mode 100644 thirdparty/URI.js/contributing.md delete mode 100644 thirdparty/URI.js/docs.html delete mode 100644 thirdparty/URI.js/index.html delete mode 100644 thirdparty/URI.js/jquery-1.10.2.min.js delete mode 100644 thirdparty/URI.js/jquery-1.7.2.min.js delete mode 100644 thirdparty/URI.js/jquery-1.8.2.min.js delete mode 100644 thirdparty/URI.js/jquery-1.9.1.min.js delete mode 100644 thirdparty/URI.js/jquery-uri-plugin.html delete mode 100644 thirdparty/URI.js/package.json delete mode 100644 thirdparty/URI.js/prettify/lang-apollo.js delete mode 100644 thirdparty/URI.js/prettify/lang-clj.js delete mode 100644 thirdparty/URI.js/prettify/lang-css.js delete mode 100644 thirdparty/URI.js/prettify/lang-go.js delete mode 100644 thirdparty/URI.js/prettify/lang-hs.js delete mode 100644 thirdparty/URI.js/prettify/lang-lisp.js delete mode 100644 thirdparty/URI.js/prettify/lang-lua.js delete mode 100644 thirdparty/URI.js/prettify/lang-ml.js delete mode 100644 thirdparty/URI.js/prettify/lang-n.js delete mode 100644 thirdparty/URI.js/prettify/lang-proto.js delete mode 100644 thirdparty/URI.js/prettify/lang-scala.js delete mode 100644 thirdparty/URI.js/prettify/lang-sql.js delete mode 100644 thirdparty/URI.js/prettify/lang-tex.js delete mode 100644 thirdparty/URI.js/prettify/lang-vb.js delete mode 100644 thirdparty/URI.js/prettify/lang-vhdl.js delete mode 100644 thirdparty/URI.js/prettify/lang-wiki.js delete mode 100644 thirdparty/URI.js/prettify/lang-xq.js delete mode 100644 thirdparty/URI.js/prettify/lang-yaml.js delete mode 100644 thirdparty/URI.js/prettify/prettify.css delete mode 100644 thirdparty/URI.js/prettify/prettify.js delete mode 100644 thirdparty/URI.js/prettify/prettify.sunburst.css delete mode 100644 thirdparty/URI.js/screen.css delete mode 100644 thirdparty/URI.js/screen.js delete mode 100644 thirdparty/URI.js/src/IPv6.js delete mode 100644 thirdparty/URI.js/src/SecondLevelDomains.js delete mode 100644 thirdparty/URI.js/src/URI.fragmentQuery.js delete mode 100644 thirdparty/URI.js/src/URI.fragmentURI.js delete mode 100644 thirdparty/URI.js/src/URI.js delete mode 100644 thirdparty/URI.js/src/URI.min.js delete mode 100644 thirdparty/URI.js/src/URITemplate.js delete mode 100644 thirdparty/URI.js/src/jquery.URI.js delete mode 100644 thirdparty/URI.js/src/jquery.URI.min.js delete mode 100644 thirdparty/URI.js/src/punycode.js delete mode 100644 thirdparty/URI.js/test/index.html delete mode 100644 thirdparty/URI.js/test/pre_libs.js delete mode 100644 thirdparty/URI.js/test/qunit/qunit-composite.css delete mode 100644 thirdparty/URI.js/test/qunit/qunit-composite.js delete mode 100644 thirdparty/URI.js/test/qunit/qunit.css delete mode 100644 thirdparty/URI.js/test/qunit/qunit.js delete mode 100644 thirdparty/URI.js/test/test.URI.html delete mode 100644 thirdparty/URI.js/test/test.fragmentQuery.html delete mode 100644 thirdparty/URI.js/test/test.fragmentURI.html delete mode 100644 thirdparty/URI.js/test/test.jQuery-1.10.html delete mode 100644 thirdparty/URI.js/test/test.jQuery-1.7.html delete mode 100644 thirdparty/URI.js/test/test.jQuery-1.8.html delete mode 100644 thirdparty/URI.js/test/test.jQuery-1.9.html delete mode 100644 thirdparty/URI.js/test/test.js delete mode 100644 thirdparty/URI.js/test/test_fragmentQuery.js delete mode 100644 thirdparty/URI.js/test/test_fragmentURI.js delete mode 100644 thirdparty/URI.js/test/test_jim.js delete mode 100644 thirdparty/URI.js/test/test_jquery.js delete mode 100644 thirdparty/URI.js/test/test_template.js delete mode 100644 thirdparty/URI.js/test/urls.js delete mode 100644 thirdparty/URI.js/uri-template.html delete mode 100644 thirdparty/URI.js/utils/SLDs.php delete mode 100644 thirdparty/URI.js/utils/sld.js delete mode 100644 thirdparty/jed/.gitignore delete mode 100644 thirdparty/jed/.travis.yml delete mode 100644 thirdparty/jed/LICENSE delete mode 100644 thirdparty/jed/Makefile delete mode 100644 thirdparty/jed/README.md delete mode 100644 thirdparty/jed/jed.js delete mode 100644 thirdparty/jed/package.json delete mode 100644 thirdparty/jed/plurals.jison delete mode 100644 thirdparty/jed/test/common.js delete mode 100644 thirdparty/jed/test/index.html delete mode 100644 thirdparty/jed/test/jquery.min.js delete mode 100644 thirdparty/jed/test/tests.js delete mode 100644 thirdparty/systemjs/.agignore delete mode 100644 thirdparty/systemjs/.gitignore delete mode 100644 thirdparty/systemjs/.travis.yml delete mode 100644 thirdparty/systemjs/LICENSE delete mode 100755 thirdparty/systemjs/Makefile delete mode 100644 thirdparty/systemjs/README.md delete mode 100644 thirdparty/systemjs/bench/cjs-sample/cjs.js delete mode 100644 thirdparty/systemjs/bench/config-example/config.js delete mode 100644 thirdparty/systemjs/bench/config-example/normalize-data.js delete mode 100644 thirdparty/systemjs/bench/config-example/pkg-configs.js delete mode 100644 thirdparty/systemjs/bench/get-cjs-deps.js delete mode 100644 thirdparty/systemjs/bench/normalize-perf.js delete mode 100644 thirdparty/systemjs/bower.json delete mode 100644 thirdparty/systemjs/dist/system-csp-production.js delete mode 100644 thirdparty/systemjs/dist/system-csp-production.js.map delete mode 100644 thirdparty/systemjs/dist/system-csp-production.src.js delete mode 100644 thirdparty/systemjs/dist/system-polyfills.js delete mode 100644 thirdparty/systemjs/dist/system-polyfills.js.map delete mode 100644 thirdparty/systemjs/dist/system-polyfills.src.js delete mode 100644 thirdparty/systemjs/dist/system-register-only.js delete mode 100644 thirdparty/systemjs/dist/system-register-only.js.map delete mode 100644 thirdparty/systemjs/dist/system-register-only.src.js delete mode 100644 thirdparty/systemjs/dist/system.js delete mode 100644 thirdparty/systemjs/dist/system.js.map delete mode 100644 thirdparty/systemjs/dist/system.src.js delete mode 100644 thirdparty/systemjs/docs/config-api.md delete mode 100644 thirdparty/systemjs/docs/creating-plugins.md delete mode 100644 thirdparty/systemjs/docs/es6-modules-overview.md delete mode 100644 thirdparty/systemjs/docs/module-formats.md delete mode 100644 thirdparty/systemjs/docs/overview.md delete mode 100644 thirdparty/systemjs/docs/production-workflows.md delete mode 100644 thirdparty/systemjs/docs/system-api.md delete mode 100644 thirdparty/systemjs/index.js delete mode 100644 thirdparty/systemjs/lib/alias.js delete mode 100644 thirdparty/systemjs/lib/amd-helpers.js delete mode 100644 thirdparty/systemjs/lib/amd.js delete mode 100644 thirdparty/systemjs/lib/bundles.js delete mode 100644 thirdparty/systemjs/lib/cjs-helpers.js delete mode 100644 thirdparty/systemjs/lib/cjs.js delete mode 100644 thirdparty/systemjs/lib/conditionals.js delete mode 100644 thirdparty/systemjs/lib/core.js delete mode 100644 thirdparty/systemjs/lib/createSystem.js delete mode 100644 thirdparty/systemjs/lib/depCache.js delete mode 100644 thirdparty/systemjs/lib/esm.js delete mode 100644 thirdparty/systemjs/lib/global-eval.js delete mode 100644 thirdparty/systemjs/lib/global-helpers.js delete mode 100644 thirdparty/systemjs/lib/global.js delete mode 100644 thirdparty/systemjs/lib/legacy-transpiler.js delete mode 100644 thirdparty/systemjs/lib/loader-wrapper-end.js delete mode 100644 thirdparty/systemjs/lib/loader-wrapper-start.js delete mode 100644 thirdparty/systemjs/lib/meta.js delete mode 100644 thirdparty/systemjs/lib/package.js delete mode 100644 thirdparty/systemjs/lib/paths.js delete mode 100644 thirdparty/systemjs/lib/perf.js delete mode 100644 thirdparty/systemjs/lib/plugins.js delete mode 100644 thirdparty/systemjs/lib/polyfills-bootstrap.js delete mode 100644 thirdparty/systemjs/lib/proto.js delete mode 100644 thirdparty/systemjs/lib/register.js delete mode 100644 thirdparty/systemjs/lib/scriptLoader.js delete mode 100644 thirdparty/systemjs/lib/scriptOnly.js delete mode 100644 thirdparty/systemjs/lib/system-fetch.js delete mode 100644 thirdparty/systemjs/lib/system-only-resolve.js delete mode 100644 thirdparty/systemjs/lib/url-polyfill.js delete mode 100644 thirdparty/systemjs/lib/wrapper-end.js delete mode 100644 thirdparty/systemjs/lib/wrapper-start.js delete mode 100644 thirdparty/systemjs/package.json delete mode 100644 thirdparty/systemjs/test/test-babel-runtime.html delete mode 100644 thirdparty/systemjs/test/test-babel.html delete mode 100644 thirdparty/systemjs/test/test-babel.js delete mode 100644 thirdparty/systemjs/test/test-csp-inline.html delete mode 100644 thirdparty/systemjs/test/test-csp.html delete mode 100644 thirdparty/systemjs/test/test-jsextensions.html delete mode 100644 thirdparty/systemjs/test/test-register-only.html delete mode 100644 thirdparty/systemjs/test/test-tracer.html delete mode 100644 thirdparty/systemjs/test/test-traceur.html delete mode 100644 thirdparty/systemjs/test/test-traceur.js delete mode 100644 thirdparty/systemjs/test/test-typescript.html delete mode 100644 thirdparty/systemjs/test/test-typescript.js delete mode 100644 thirdparty/systemjs/test/test.js delete mode 100644 thirdparty/systemjs/test/tests/#.js delete mode 100644 thirdparty/systemjs/test/tests/advanced-plugin.js delete mode 100644 thirdparty/systemjs/test/tests/all-circular1.js delete mode 100644 thirdparty/systemjs/test/tests/all-circular2.js delete mode 100644 thirdparty/systemjs/test/tests/all-circular3.js delete mode 100644 thirdparty/systemjs/test/tests/all-circular4.js delete mode 100644 thirdparty/systemjs/test/tests/all-layers1.js delete mode 100644 thirdparty/systemjs/test/tests/all-layers2.js delete mode 100644 thirdparty/systemjs/test/tests/all-layers3.js delete mode 100644 thirdparty/systemjs/test/tests/all-layers4.js delete mode 100644 thirdparty/systemjs/test/tests/amd-bundle.js delete mode 100644 thirdparty/systemjs/test/tests/amd-circular1.js delete mode 100644 thirdparty/systemjs/test/tests/amd-circular2.js delete mode 100644 thirdparty/systemjs/test/tests/amd-cjs-module.js delete mode 100644 thirdparty/systemjs/test/tests/amd-contextual.js delete mode 100644 thirdparty/systemjs/test/tests/amd-dep-A.js delete mode 100644 thirdparty/systemjs/test/tests/amd-dep-B.js delete mode 100644 thirdparty/systemjs/test/tests/amd-dep.js delete mode 100644 thirdparty/systemjs/test/tests/amd-dynamic-require.js delete mode 100644 thirdparty/systemjs/test/tests/amd-dynamic.js delete mode 100644 thirdparty/systemjs/test/tests/amd-extra-deps.js delete mode 100644 thirdparty/systemjs/test/tests/amd-format.js delete mode 100644 thirdparty/systemjs/test/tests/amd-module-2.js delete mode 100644 thirdparty/systemjs/test/tests/amd-module-3.js delete mode 100644 thirdparty/systemjs/test/tests/amd-module-bom.js delete mode 100644 thirdparty/systemjs/test/tests/amd-module.js delete mode 100644 thirdparty/systemjs/test/tests/amd-require.js delete mode 100644 thirdparty/systemjs/test/tests/amd-simplified-cjs-aliased-require1.js delete mode 100644 thirdparty/systemjs/test/tests/amd-simplified-cjs-aliased-require2.js delete mode 100644 thirdparty/systemjs/test/tests/anon-named.js delete mode 100644 thirdparty/systemjs/test/tests/async.js delete mode 100644 thirdparty/systemjs/test/tests/bootstrap@3.1.1/test.coffee delete mode 100644 thirdparty/systemjs/test/tests/branch-boolean.js delete mode 100644 thirdparty/systemjs/test/tests/branch-ie.js delete mode 100644 thirdparty/systemjs/test/tests/bundle.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-circular1.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-circular2.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-exports-bom.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-exports-dep.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-exports.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-format.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-globals.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-loading-plugin.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-module-bom.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-named-export.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-process.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-resolve.js delete mode 100644 thirdparty/systemjs/test/tests/cjs-this.js delete mode 100644 thirdparty/systemjs/test/tests/common-js-dep.js delete mode 100644 thirdparty/systemjs/test/tests/common-js-module.js delete mode 100644 thirdparty/systemjs/test/tests/commonjs-d.js delete mode 100644 thirdparty/systemjs/test/tests/commonjs-d2.js delete mode 100644 thirdparty/systemjs/test/tests/commonjs-globals.js delete mode 100644 thirdparty/systemjs/test/tests/commonjs-requires.js delete mode 100644 thirdparty/systemjs/test/tests/commonjs-variation.js delete mode 100644 thirdparty/systemjs/test/tests/commonjs-variation2.js delete mode 100644 thirdparty/systemjs/test/tests/compiled.coffee delete mode 100644 thirdparty/systemjs/test/tests/compiler-plugin.js delete mode 100644 thirdparty/systemjs/test/tests/compiler-test.coffee delete mode 100644 thirdparty/systemjs/test/tests/connected-tree/a.js delete mode 100644 thirdparty/systemjs/test/tests/connected-tree/b.js delete mode 100644 thirdparty/systemjs/test/tests/connected-tree/c.js delete mode 100644 thirdparty/systemjs/test/tests/contextual-map-dep.js delete mode 100644 thirdparty/systemjs/test/tests/contextual-test/contextual-map.js delete mode 100644 thirdparty/systemjs/test/tests/cs-loader.js delete mode 100644 thirdparty/systemjs/test/tests/cs/dep.js delete mode 100644 thirdparty/systemjs/test/tests/cs/main.js delete mode 100644 thirdparty/systemjs/test/tests/csp/integrity.js delete mode 100644 thirdparty/systemjs/test/tests/csp/nonce.js delete mode 100644 thirdparty/systemjs/test/tests/csp/nonce2.js delete mode 100644 thirdparty/systemjs/test/tests/css.css delete mode 100644 thirdparty/systemjs/test/tests/css.js delete mode 100644 thirdparty/systemjs/test/tests/deep/deep-dep.js delete mode 100644 thirdparty/systemjs/test/tests/deep/deep.js delete mode 100644 thirdparty/systemjs/test/tests/default1-dep.js delete mode 100644 thirdparty/systemjs/test/tests/default1.js delete mode 100644 thirdparty/systemjs/test/tests/default2.js delete mode 100644 thirdparty/systemjs/test/tests/default3.js delete mode 100644 thirdparty/systemjs/test/tests/dep.js delete mode 100644 thirdparty/systemjs/test/tests/duplicateDeps/m1.js delete mode 100644 thirdparty/systemjs/test/tests/duplicateDeps/m2.js delete mode 100644 thirdparty/systemjs/test/tests/eaa-amd.js delete mode 100644 thirdparty/systemjs/test/tests/eaa-es6.js delete mode 100644 thirdparty/systemjs/test/tests/empty-es6.js delete mode 100644 thirdparty/systemjs/test/tests/ep/some-repo/main.js delete mode 100644 thirdparty/systemjs/test/tests/error-loader.js delete mode 100644 thirdparty/systemjs/test/tests/error-loader2.js delete mode 100644 thirdparty/systemjs/test/tests/error.js delete mode 100644 thirdparty/systemjs/test/tests/es-module-flag.js delete mode 100644 thirdparty/systemjs/test/tests/es-named-import-cjs-cjs.js delete mode 100644 thirdparty/systemjs/test/tests/es-named-import-cjs.js delete mode 100644 thirdparty/systemjs/test/tests/es6-and-amd.js delete mode 100644 thirdparty/systemjs/test/tests/es6-circular1.js delete mode 100644 thirdparty/systemjs/test/tests/es6-circular2.js delete mode 100644 thirdparty/systemjs/test/tests/es6-cjs-named-export.js delete mode 100644 thirdparty/systemjs/test/tests/es6-detection1.js delete mode 100644 thirdparty/systemjs/test/tests/es6-format.js delete mode 100644 thirdparty/systemjs/test/tests/es6-import-star-amd.js delete mode 100644 thirdparty/systemjs/test/tests/es6-loading-amd-dep.js delete mode 100644 thirdparty/systemjs/test/tests/es6-loading-amd.js delete mode 100644 thirdparty/systemjs/test/tests/es6-plugin.js delete mode 100644 thirdparty/systemjs/test/tests/esm-dep.js delete mode 100644 thirdparty/systemjs/test/tests/esm-with-deps.js delete mode 100644 thirdparty/systemjs/test/tests/export-star.js delete mode 100644 thirdparty/systemjs/test/tests/foo.js delete mode 100644 thirdparty/systemjs/test/tests/global-dep.js delete mode 100644 thirdparty/systemjs/test/tests/global-encapsulation.js delete mode 100644 thirdparty/systemjs/test/tests/global-exports-array.js delete mode 100644 thirdparty/systemjs/test/tests/global-inaccessible-props.js delete mode 100644 thirdparty/systemjs/test/tests/global-inline-dep.js delete mode 100644 thirdparty/systemjs/test/tests/global-inline-export.js delete mode 100644 thirdparty/systemjs/test/tests/global-multi-diff.js delete mode 100644 thirdparty/systemjs/test/tests/global-multi.js delete mode 100644 thirdparty/systemjs/test/tests/global-shim-amd.js delete mode 100644 thirdparty/systemjs/test/tests/global-shim-config-dep.js delete mode 100644 thirdparty/systemjs/test/tests/global-shim-config-exports.js delete mode 100644 thirdparty/systemjs/test/tests/global-shim-config.js delete mode 100644 thirdparty/systemjs/test/tests/global-single-compiled.js delete mode 100644 thirdparty/systemjs/test/tests/global-single.js delete mode 100644 thirdparty/systemjs/test/tests/global-with-export.js delete mode 100644 thirdparty/systemjs/test/tests/global.js delete mode 100644 thirdparty/systemjs/test/tests/group-test.js delete mode 100644 thirdparty/systemjs/test/tests/hbs.hbs delete mode 100644 thirdparty/systemjs/test/tests/inline-depends-dep.js delete mode 100644 thirdparty/systemjs/test/tests/inline-depends.js delete mode 100644 thirdparty/systemjs/test/tests/jquery-named.js delete mode 100644 thirdparty/systemjs/test/tests/jquery.js delete mode 100644 thirdparty/systemjs/test/tests/legacy-plugin.js delete mode 100644 thirdparty/systemjs/test/tests/loader-scoping.js delete mode 100644 thirdparty/systemjs/test/tests/main-bundle.js delete mode 100644 thirdparty/systemjs/test/tests/main-dep.js delete mode 100644 thirdparty/systemjs/test/tests/main.js delete mode 100644 thirdparty/systemjs/test/tests/map-test-dep.js delete mode 100644 thirdparty/systemjs/test/tests/map-test.js delete mode 100644 thirdparty/systemjs/test/tests/map-test/sub.js delete mode 100644 thirdparty/systemjs/test/tests/map-version.js delete mode 100644 thirdparty/systemjs/test/tests/meta-deps.js delete mode 100644 thirdparty/systemjs/test/tests/meta-override.js delete mode 100644 thirdparty/systemjs/test/tests/mixed-bundle.js delete mode 100644 thirdparty/systemjs/test/tests/modA.js delete mode 100644 thirdparty/systemjs/test/tests/modC.js delete mode 100644 thirdparty/systemjs/test/tests/module-name.js delete mode 100644 thirdparty/systemjs/test/tests/module.js delete mode 100644 thirdparty/systemjs/test/tests/multiple-anonymous.js delete mode 100644 thirdparty/systemjs/test/tests/mypackage/index.js delete mode 100644 thirdparty/systemjs/test/tests/mypackage/lib/bar.js delete mode 100644 thirdparty/systemjs/test/tests/mypackage/src/foo.js delete mode 100644 thirdparty/systemjs/test/tests/nameddefine.js delete mode 100644 thirdparty/systemjs/test/tests/no-default-ext/file.ext delete mode 100644 thirdparty/systemjs/test/tests/normalize-hook-test.js delete mode 100644 thirdparty/systemjs/test/tests/out.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/index-cjs.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/index-default-cjs.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/index-default-esm.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/index-esm.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/local/index-cjs.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/local/index-default-cjs.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/local/index-default-esm.js delete mode 100644 thirdparty/systemjs/test/tests/package-local-alias/local/index-esm.js delete mode 100644 thirdparty/systemjs/test/tests/path/deep.js delete mode 100644 thirdparty/systemjs/test/tests/plugin-dep.js delete mode 100644 thirdparty/systemjs/test/tests/plugin@1.2.3/plugin.js delete mode 100644 thirdparty/systemjs/test/tests/reflection.js delete mode 100644 thirdparty/systemjs/test/tests/register-circular1.js delete mode 100644 thirdparty/systemjs/test/tests/register-circular2.js delete mode 100644 thirdparty/systemjs/test/tests/register-default-extension.js delete mode 100644 thirdparty/systemjs/test/tests/register-regex-2.js delete mode 100644 thirdparty/systemjs/test/tests/register-regex.js delete mode 100644 thirdparty/systemjs/test/tests/registerdynamic-main.js delete mode 100644 thirdparty/systemjs/test/tests/registerdynamic-notbundled.js delete mode 100644 thirdparty/systemjs/test/tests/reldynamic.js delete mode 100644 thirdparty/systemjs/test/tests/reldynamicdep.js delete mode 100644 thirdparty/systemjs/test/tests/shared-dep-bundles/a.js delete mode 100644 thirdparty/systemjs/test/tests/shared-dep-bundles/b.js delete mode 100644 thirdparty/systemjs/test/tests/shim-map-test-dep.js delete mode 100644 thirdparty/systemjs/test/tests/shim-package/shim-map-test.js delete mode 100644 thirdparty/systemjs/test/tests/some-json.json delete mode 100644 thirdparty/systemjs/test/tests/some-text.txt delete mode 100644 thirdparty/systemjs/test/tests/star-dep.js delete mode 100644 thirdparty/systemjs/test/tests/subcontextual-map/submodule.js delete mode 100644 thirdparty/systemjs/test/tests/subcontextual-mapdep.js delete mode 100644 thirdparty/systemjs/test/tests/test.css delete mode 100644 thirdparty/systemjs/test/tests/testpkg/depcache-test.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/dir/index.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/dir/self-load.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/dir2/index.json delete mode 100644 thirdparty/systemjs/test/tests/testpkg/env-module-browser.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/env-module.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/index.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/interpolate.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/json.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/json.json delete mode 100644 thirdparty/systemjs/test/tests/testpkg/polate.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/self-load.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/self.js delete mode 100644 thirdparty/systemjs/test/tests/testpkg/system.json delete mode 100644 thirdparty/systemjs/test/tests/testpkg/test.ts delete mode 100644 thirdparty/systemjs/test/tests/testpkg2.json delete mode 100644 thirdparty/systemjs/test/tests/testpkg2/asdf.asdf.js delete mode 100644 thirdparty/systemjs/test/tests/typescript.ts delete mode 100644 thirdparty/systemjs/test/tests/umd-dep.js delete mode 100644 thirdparty/systemjs/test/tests/umd.js delete mode 100644 thirdparty/systemjs/test/tests/versioned@2.0.3.js delete mode 100644 thirdparty/systemjs/test/tests/wildcard-test/2.js delete mode 100644 thirdparty/systemjs/test/tests/wildcard-test/2/sub.js delete mode 100644 thirdparty/systemjs/test/tests/wildcard-test/first.js delete mode 100644 thirdparty/systemjs/test/tests/with-global-deps.js delete mode 100644 thirdparty/systemjs/test/tests/with-runtime-babel.js delete mode 100644 thirdparty/systemjs/test/tests/with-runtime-traceur.js delete mode 100644 thirdparty/systemjs/test/tests/worker-babel.js delete mode 100644 thirdparty/systemjs/test/tests/worker-traceur.js delete mode 100644 thirdparty/systemjs/test/tests/worker-typescript.js delete mode 100644 thirdparty/systemjs/test/tests/wrapper.js delete mode 100644 thirdparty/systemjs/test/tests/zero@0.js create mode 100644 tooling/pogen/.gitignore create mode 100644 tooling/pogen/dumpTree.ts create mode 100644 tooling/pogen/example/messages.po create mode 100644 tooling/pogen/example/test.ts create mode 100644 tooling/pogen/example/test2.tsx create mode 100644 tooling/pogen/pogen.ts create mode 100644 tooling/pogen/tsconfig.json create mode 100644 tooling/talertest/node/runtime.js create mode 100644 tooling/talertest/package.json create mode 100644 tooling/talertest/selenium/.gitignore create mode 100644 tooling/talertest/selenium/escodegen.browser.js create mode 100644 tooling/talertest/selenium/esprima.js create mode 100644 tooling/talertest/selenium/instrumenter.js create mode 100644 tooling/talertest/selenium/runtime.js create mode 100644 tooling/talertest/selenium/system.js create mode 100644 tooling/talertest/selenium/testhost.html create mode 100644 tooling/talertest/talertest.d.ts create mode 100644 tooling/talertest/talertest.js create mode 100644 tooling/talertest/talertest.ts create mode 100644 tooling/talertest/tsconfig.json create mode 100644 tooling/talertest/yarn.lock create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore index 958dc6d25..9a9b20544 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ node_modules coverage/ coverage-*.json + +dist/ diff --git a/decl/jed.d.ts b/decl/jed.d.ts new file mode 100644 index 000000000..b156702e0 --- /dev/null +++ b/decl/jed.d.ts @@ -0,0 +1,18 @@ + +interface JedInstance { + translate: any; + ngettext: any; +} + +interface JedConstructor { + new(s: any): JedInstance; +} + +declare namespace JedLib { + const Jed: JedConstructor; +} + +declare module "jed" { + export = JedLib; +} + diff --git a/decl/jquery/jquery.d.ts b/decl/jquery/jquery.d.ts deleted file mode 100644 index 8401753e3..000000000 --- a/decl/jquery/jquery.d.ts +++ /dev/null @@ -1,3190 +0,0 @@ -// Type definitions for jQuery 1.10.x / 2.0.x -// Project: http://jquery.com/ -// Definitions by: Boris Yankov , Christian Hoffmeister , Steve Fenton , Diullei Gomes , Tass Iliopoulos , Jason Swearingen , Sean Hill , Guus Goossens , Kelly Summerlin , Basarat Ali Syed , Nicholas Wolverson , Derek Cicerone , Andrew Gaspar , James Harrison Fisher , Seikichi Kondo , Benjamin Jackman , Poul Sorensen , Josh Strobl , John Reilly , Dick van den Brink -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/* ***************************************************************************** -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 *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. -***************************************************************************** */ - - -/** - * Interface for the AJAX setting that will configure the AJAX request - */ -interface JQueryAjaxSettings { - /** - * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. - */ - accepts?: any; - /** - * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success(). - */ - async?: boolean; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. - */ - beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; - /** - * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. - */ - cache?: boolean; - /** - * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - complete? (jqXHR: JQueryXHR, textStatus: string): any; - /** - * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) - */ - contents?: { [key: string]: any; }; - //According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false" - // https://github.com/borisyankov/DefinitelyTyped/issues/742 - /** - * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. - */ - contentType?: any; - /** - * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). - */ - context?: any; - /** - * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5) - */ - converters?: { [key: string]: any; }; - /** - * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5) - */ - crossDomain?: boolean; - /** - * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). - */ - data?: any; - /** - * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. - */ - dataFilter? (data: any, ty: any): any; - /** - * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). - */ - dataType?: string; - /** - * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. - */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; - /** - * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. - */ - global?: boolean; - /** - * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5) - */ - headers?: { [key: string]: any; }; - /** - * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. - */ - ifModified?: boolean; - /** - * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1) - */ - isLocal?: boolean; - /** - * Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" } - */ - jsonp?: any; - /** - * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. - */ - jsonpCallback?: any; - /** - * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0) - */ - method?: string; - /** - * A mime type to override the XHR mime type. (version added: 1.5.1) - */ - mimeType?: string; - /** - * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - password?: string; - /** - * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. - */ - processData?: boolean; - /** - * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. - */ - scriptCharset?: string; - /** - * An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5) - */ - statusCode?: { [key: string]: any; }; - /** - * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - success? (data: any, textStatus: string, jqXHR: JQueryXHR): any; - /** - * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. - */ - timeout?: number; - /** - * Set this to true if you wish to use the traditional style of param serialization. - */ - traditional?: boolean; - /** - * The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. - */ - type?: string; - /** - * A string containing the URL to which the request is sent. - */ - url?: string; - /** - * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - username?: string; - /** - * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory. - */ - xhr?: any; - /** - * An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1) - */ - xhrFields?: { [key: string]: any; }; -} - -/** - * Interface for the jqXHR object - */ -interface JQueryXHR extends XMLHttpRequest, JQueryPromise { - /** - * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). - */ - overrideMimeType(mimeType: string): any; - /** - * Cancel the request. - * - * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" - */ - abort(statusText?: string): void; - /** - * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. - */ - then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => void, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; - /** - * Property containing the parsed response if the response Content-Type is json - */ - responseJSON?: any; - /** - * A function to be called if the request fails. - */ - error(xhr: JQueryXHR, textStatus: string, errorThrown: string): void; -} - -/** - * Interface for the JQuery callback - */ -interface JQueryCallback { - /** - * Add a callback or a collection of callbacks to a callback list. - * - * @param callbacks A function, or array of functions, that are to be added to the callback list. - */ - add(callbacks: Function): JQueryCallback; - /** - * Add a callback or a collection of callbacks to a callback list. - * - * @param callbacks A function, or array of functions, that are to be added to the callback list. - */ - add(callbacks: Function[]): JQueryCallback; - - /** - * Disable a callback list from doing anything more. - */ - disable(): JQueryCallback; - - /** - * Determine if the callbacks list has been disabled. - */ - disabled(): boolean; - - /** - * Remove all of the callbacks from a list. - */ - empty(): JQueryCallback; - - /** - * Call all of the callbacks with the given arguments - * - * @param arguments The argument or list of arguments to pass back to the callback list. - */ - fire(...arguments: any[]): JQueryCallback; - - /** - * Determine if the callbacks have already been called at least once. - */ - fired(): boolean; - - /** - * Call all callbacks in a list with the given context and arguments. - * - * @param context A reference to the context in which the callbacks in the list should be fired. - * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. - */ - fireWith(context?: any, args?: any[]): JQueryCallback; - - /** - * Determine whether a supplied callback is in a list - * - * @param callback The callback to search for. - */ - has(callback: Function): boolean; - - /** - * Lock a callback list in its current state. - */ - lock(): JQueryCallback; - - /** - * Determine if the callbacks list has been locked. - */ - locked(): boolean; - - /** - * Remove a callback or a collection of callbacks from a callback list. - * - * @param callbacks A function, or array of functions, that are to be removed from the callback list. - */ - remove(callbacks: Function): JQueryCallback; - /** - * Remove a callback or a collection of callbacks from a callback list. - * - * @param callbacks A function, or array of functions, that are to be removed from the callback list. - */ - remove(callbacks: Function[]): JQueryCallback; -} - -/** - * Allows jQuery Promises to interop with non-jQuery promises - */ -interface JQueryGenericPromise { - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - */ - then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; - - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - */ - then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; -} - -/** - * Interface for the JQuery promise/deferred callbacks - */ -interface JQueryPromiseCallback { - (value?: T, ...args: any[]): void; -} - -interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; -} - -/** - * Interface for the JQuery promise, part of callbacks - */ -interface JQueryPromise extends JQueryGenericPromise { - /** - * Determine the current state of a Deferred object. - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; -} - -/** - * Interface for the JQuery deferred, part of callbacks - */ -interface JQueryDeferred extends JQueryGenericPromise { - /** - * Determine the current state of a Deferred object. - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given args. - * - * @param args Optional arguments that are passed to the progressCallbacks. - */ - notify(value?: any, ...args: any[]): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given context and args. - * - * @param context Context passed to the progressCallbacks as the this object. - * @param args Optional arguments that are passed to the progressCallbacks. - */ - notifyWith(context: any, value?: any[]): JQueryDeferred; - - /** - * Reject a Deferred object and call any failCallbacks with the given args. - * - * @param args Optional arguments that are passed to the failCallbacks. - */ - reject(value?: any, ...args: any[]): JQueryDeferred; - /** - * Reject a Deferred object and call any failCallbacks with the given context and args. - * - * @param context Context passed to the failCallbacks as the this object. - * @param args An optional array of arguments that are passed to the failCallbacks. - */ - rejectWith(context: any, value?: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given args. - * - * @param value First argument passed to doneCallbacks. - * @param args Optional subsequent arguments that are passed to the doneCallbacks. - */ - resolve(value?: T, ...args: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given context and args. - * - * @param context Context passed to the doneCallbacks as the this object. - * @param args An optional array of arguments that are passed to the doneCallbacks. - */ - resolveWith(context: any, value?: T[]): JQueryDeferred; - - /** - * Return a Deferred's Promise object. - * - * @param target Object onto which the promise methods have to be attached - */ - promise(target?: any): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; -} - -/** - * Interface of the JQuery extension of the W3C event object - */ -interface BaseJQueryEventObject extends Event { - data: any; - delegateTarget: Element; - isDefaultPrevented(): boolean; - isImmediatePropagationStopped(): boolean; - isPropagationStopped(): boolean; - namespace: string; - originalEvent: Event; - preventDefault(): any; - relatedTarget: Element; - result: any; - stopImmediatePropagation(): void; - stopPropagation(): void; - target: Element; - pageX: number; - pageY: number; - which: number; - metaKey: boolean; -} - -interface JQueryInputEventObject extends BaseJQueryEventObject { - altKey: boolean; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; -} - -interface JQueryMouseEventObject extends JQueryInputEventObject { - button: number; - clientX: number; - clientY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; -} - -interface JQueryKeyEventObject extends JQueryInputEventObject { - char: any; - charCode: number; - key: any; - keyCode: number; -} - -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ -} - -/* - Collection of properties of the current browser -*/ - -interface JQuerySupport { - ajax?: boolean; - boxModel?: boolean; - changeBubbles?: boolean; - checkClone?: boolean; - checkOn?: boolean; - cors?: boolean; - cssFloat?: boolean; - hrefNormalized?: boolean; - htmlSerialize?: boolean; - leadingWhitespace?: boolean; - noCloneChecked?: boolean; - noCloneEvent?: boolean; - opacity?: boolean; - optDisabled?: boolean; - optSelected?: boolean; - scriptEval? (): boolean; - style?: boolean; - submitBubbles?: boolean; - tbody?: boolean; -} - -interface JQueryParam { - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - */ - (obj: any): string; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. - */ - (obj: any, traditional: boolean): string; -} - -/** - * The interface used to construct jQuery events (with $.Event). It is - * defined separately instead of inline in JQueryStatic to allow - * overriding the construction function with specific strings - * returning specific event objects. - */ -interface JQueryEventConstructor { - (name: string, eventProperties?: any): JQueryEventObject; - new (name: string, eventProperties?: any): JQueryEventObject; -} - -/** - * The interface used to specify coordinates. - */ -interface JQueryCoordinates { - left: number; - top: number; -} - -/** - * Elements in the array returned by serializeArray() - */ -interface JQuerySerializeArrayElement { - name: string; - value: string; -} - -interface JQueryAnimationOptions { - /** - * A string or number determining how long the animation will run. - */ - duration?: any; - /** - * A string indicating which easing function to use for the transition. - */ - easing?: string; - /** - * A function to call once the animation is complete. - */ - complete?: Function; - /** - * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. - */ - step?: (now: number, tween: any) => any; - /** - * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) - */ - progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; - /** - * A function to call when the animation begins. (version added: 1.8) - */ - start?: (animation: JQueryPromise) => any; - /** - * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) - */ - done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) - */ - fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) - */ - always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. - */ - queue?: any; - /** - * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) - */ - specialEasing?: Object; -} - -/** - * Static members of jQuery (those on $ and jQuery themselves) - */ -interface JQueryStatic { - - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - */ - ajax(settings: JQueryAjaxSettings): JQueryXHR; - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param url A string containing the URL to which the request is sent. - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - */ - ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; - - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @param dataTypes An optional string containing one or more space-separated dataTypes - * @param handler A handler to set default values for future Ajax requests. - */ - ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @param handler A handler to set default values for future Ajax requests. - */ - ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - - ajaxSettings: JQueryAjaxSettings; - - /** - * Set default values for future Ajax requests. Its use is not recommended. - * - * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. - */ - ajaxSetup(options: JQueryAjaxSettings): void; - - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - */ - get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - */ - get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - */ - getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - */ - getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load a JavaScript file from the server using a GET HTTP request, then execute it. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - */ - getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - */ - param: JQueryParam; - - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - */ - post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - */ - post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - - /** - * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. - * - * @param flags An optional list of space-separated flags that change how the callback list behaves. - */ - Callbacks(flags?: string): JQueryCallback; - - /** - * Holds or releases the execution of jQuery's ready event. - * - * @param hold Indicates whether the ready hold is being requested or released - */ - holdReady(hold: boolean): void; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param selector A string containing a selector expression - * @param context A DOM Element, Document, or jQuery to use as context - */ - (selector: string, context?: Element|JQuery): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param element A DOM element to wrap in a jQuery object. - */ - (element: Element): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. - */ - (elementArray: Element[]): JQuery; - - /** - * Binds a function to be executed when the DOM has finished loading. - * - * @param callback A function to execute after the DOM is ready. - */ - (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object A plain object to wrap in a jQuery object. - */ - (object: {}): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object An existing jQuery object to clone. - */ - (object: JQuery): JQuery; - - /** - * Specify a function to execute when the DOM is fully loaded. - */ - (): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. - * @param ownerDocument A document in which the new elements will be created. - */ - (html: string, ownerDocument?: Document): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string defining a single, standalone, HTML element (e.g.
or
). - * @param attributes An object of attributes, events, and methods to call on the newly-created element. - */ - (html: string, attributes: Object): JQuery; - - /** - * Relinquish jQuery's control of the $ variable. - * - * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). - */ - noConflict(removeAll?: boolean): Object; - - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - */ - when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; - - /** - * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. - */ - cssHooks: { [key: string]: any; }; - cssNumber: any; - - /** - * Store arbitrary data associated with the specified element. Returns the value that was set. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - * @param value The new data value. - */ - data(element: Element, key: string, value: T): T; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - */ - data(element: Element, key: string): any; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - */ - data(element: Element): any; - - /** - * Execute the next function on the queue for the matched element. - * - * @param element A DOM element from which to remove and execute a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - dequeue(element: Element, queueName?: string): void; - - /** - * Determine whether an element has any jQuery data associated with it. - * - * @param element A DOM element to be checked for data. - */ - hasData(element: Element): boolean; - - /** - * Show the queue of functions to be executed on the matched element. - * - * @param element A DOM element to inspect for an attached queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - queue(element: Element, queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element where the array of queued functions is attached. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - */ - queue(element: Element, queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element on which to add a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue. - */ - queue(element: Element, queueName: string, callback: Function): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @param element A DOM element from which to remove data. - * @param name A string naming the piece of data to remove. - */ - removeData(element: Element, name?: string): JQuery; - - /** - * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. - * - * @param beforeStart A function that is called just before the constructor returns. - */ - Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred; - - /** - * Effects - */ - fx: { - tick: () => void; - /** - * The rate (in milliseconds) at which animations fire. - */ - interval: number; - stop: () => void; - speeds: { slow: number; fast: number; }; - /** - * Globally disable all animations. - */ - off: boolean; - step: any; - }; - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fnction The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. - */ - proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param context The object to which the context (this) of the function should be set. - * @param name The name of the function whose context will be changed (should be a property of the context object). - * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. - */ - proxy(context: Object, name: string, ...additionalArguments: any[]): any; - - Event: JQueryEventConstructor; - - /** - * Takes a string and throws an exception containing it. - * - * @param message The message to send out. - */ - error(message: any): JQuery; - - expr: any; - fn: any; //TODO: Decide how we want to type this - - isReady: boolean; - - // Properties - support: JQuerySupport; - - /** - * Check to see if a DOM element is a descendant of another DOM element. - * - * @param container The DOM element that may contain the other element. - * @param contained The DOM element that may be contained by (a descendant of) the other element. - */ - contains(container: Element, contained: Element): boolean; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. - */ - each( - collection: T[], - callback: (indexInArray: number, valueOfElement: T) => any - ): any; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. - */ - each( - collection: any, - callback: (indexInArray: any, valueOfElement: any) => any - ): any; - - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - */ - extend(target: any, object1?: any, ...objectN: any[]): any; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). - * @param target The object to extend. It will receive the new properties. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - */ - extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; - - /** - * Execute some JavaScript code globally. - * - * @param code The JavaScript code to execute. - */ - globalEval(code: string): any; - - /** - * Finds the elements of an array which satisfy a filter function. The original array is not affected. - * - * @param array The array to search through. - * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. - * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. - */ - grep(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[]; - - /** - * Search for a specified value within an array and return its index (or -1 if not found). - * - * @param value The value to search for. - * @param array An array through which to search. - * @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array. - */ - inArray(value: T, array: T[], fromIndex?: number): number; - - /** - * Determine whether the argument is an array. - * - * @param obj Object to test whether or not it is an array. - */ - isArray(obj: any): boolean; - /** - * Check to see if an object is empty (contains no enumerable properties). - * - * @param obj The object that will be checked to see if it's empty. - */ - isEmptyObject(obj: any): boolean; - /** - * Determine if the argument passed is a Javascript function object. - * - * @param obj Object to test whether or not it is a function. - */ - isFunction(obj: any): boolean; - /** - * Determines whether its argument is a number. - * - * @param obj The value to be tested. - */ - isNumeric(value: any): boolean; - /** - * Check to see if an object is a plain object (created using "{}" or "new Object"). - * - * @param obj The object that will be checked to see if it's a plain object. - */ - isPlainObject(obj: any): boolean; - /** - * Determine whether the argument is a window. - * - * @param obj Object to test whether or not it is a window. - */ - isWindow(obj: any): boolean; - /** - * Check to see if a DOM node is within an XML document (or is an XML document). - * - * @param node he DOM node that will be checked to see if it's in an XML document. - */ - isXMLDoc(node: Node): boolean; - - /** - * Convert an array-like object into a true JavaScript array. - * - * @param obj Any object to turn into a native Array. - */ - makeArray(obj: any): any[]; - - /** - * Translate all items in an array or object to new array of items. - * - * @param array The Array to translate. - * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. - */ - map(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[]; - /** - * Translate all items in an array or object to new array of items. - * - * @param arrayOrObject The Array or Object to translate. - * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. - */ - map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; - - /** - * Merge the contents of two arrays together into the first array. - * - * @param first The first array to merge, the elements of second added. - * @param second The second array to merge into the first, unaltered. - */ - merge(first: T[], second: T[]): T[]; - - /** - * An empty function. - */ - noop(): any; - - /** - * Return a number representing the current time. - */ - now(): number; - - /** - * Takes a well-formed JSON string and returns the resulting JavaScript object. - * - * @param json The JSON string to parse. - */ - parseJSON(json: string): any; - - /** - * Parses a string into an XML document. - * - * @param data a well-formed XML string to be parsed - */ - parseXML(data: string): XMLDocument; - - /** - * Remove the whitespace from the beginning and end of a string. - * - * @param str Remove the whitespace from the beginning and end of a string. - */ - trim(str: string): string; - - /** - * Determine the internal JavaScript [[Class]] of an object. - * - * @param obj Object to get the internal JavaScript [[Class]] of. - */ - type(obj: any): string; - - /** - * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. - * - * @param array The Array of DOM elements. - */ - unique(array: Element[]): Element[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - */ - parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - */ - parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; -} - -/** - * The jQuery instance members - */ -interface JQuery { - /** - * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. - * - * @param handler The function to be invoked. - */ - ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery; - /** - * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): JQuery; - /** - * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - /** - * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxStart(handler: () => any): JQuery; - /** - * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxStop(handler: () => any): JQuery; - /** - * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. - * - * @param handler The function to be invoked. - */ - ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - - /** - * Load data from the server and place the returned HTML into the matched element. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param complete A callback function that is executed when the request completes. - */ - load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; - - /** - * Encode a set of form elements as a string for submission. - */ - serialize(): string; - /** - * Encode a set of form elements as an array of names and values. - */ - serializeArray(): JQuerySerializeArrayElement[]; - - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param className One or more space-separated classes to be added to the class attribute of each matched element. - */ - addClass(className: string): JQuery; - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. - */ - addClass(func: (index: number, className: string) => string): JQuery; - - /** - * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. - */ - addBack(selector?: string): JQuery; - - /** - * Get the value of an attribute for the first element in the set of matched elements. - * - * @param attributeName The name of the attribute to get. - */ - attr(attributeName: string): string; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. - */ - attr(attributeName: string, value: string|number): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. - */ - attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributes An object of attribute-value pairs to set. - */ - attr(attributes: Object): JQuery; - - /** - * Determine whether any of the matched elements are assigned the given class. - * - * @param className The class name to search for. - */ - hasClass(className: string): boolean; - - /** - * Get the HTML contents of the first element in the set of matched elements. - */ - html(): string; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param htmlString A string of HTML to set as the content of each matched element. - */ - html(htmlString: string): JQuery; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - */ - html(func: (index: number, oldhtml: string) => string): JQuery; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - */ - - /** - * Get the value of a property for the first element in the set of matched elements. - * - * @param propertyName The name of the property to get. - */ - prop(propertyName: string): any; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A value to set for the property. - */ - prop(propertyName: string, value: string|number|boolean): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - */ - prop(properties: Object): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. - */ - prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery; - - /** - * Remove an attribute from each element in the set of matched elements. - * - * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. - */ - removeAttr(attributeName: string): JQuery; - - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param className One or more space-separated classes to be removed from the class attribute of each matched element. - */ - removeClass(className?: string): JQuery; - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. - */ - removeClass(func: (index: number, className: string) => string): JQuery; - - /** - * Remove a property for the set of matched elements. - * - * @param propertyName The name of the property to remove. - */ - removeProp(propertyName: string): JQuery; - - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. - * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - */ - toggleClass(className: string, swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param swtch A boolean value to determine whether the class should be added or removed. - */ - toggleClass(swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. - * @param swtch A boolean value to determine whether the class should be added or removed. - */ - toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): JQuery; - - /** - * Get the current value of the first element in the set of matched elements. - */ - val(): any; - /** - * Set the value of each element in the set of matched elements. - * - * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked. - */ - val(value: string|string[]): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - val(func: (index: number, value: string) => string): JQuery; - - - /** - * Get the value of style properties for the first element in the set of matched elements. - * - * @param propertyName A CSS property. - */ - css(propertyName: string): string; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - */ - css(propertyName: string, value: string|number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - */ - css(properties: Object): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements. - */ - height(): number; - /** - * Set the CSS height of every matched element. - * - * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). - */ - height(value: number|string): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. - */ - height(func: (index: number, height: number) => number|string): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements, including padding but not border. - */ - innerHeight(): number; - - /** - * Sets the inner height on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - innerHeight(height: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding but not border. - */ - innerWidth(): number; - - /** - * Sets the inner width on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - innerWidth(width: number|string): JQuery; - - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the document. - */ - offset(): JQueryCoordinates; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - */ - offset(coordinates: JQueryCoordinates): JQuery; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. - */ - offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - */ - outerHeight(includeMargin?: boolean): number; - - /** - * Sets the outer height on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - outerHeight(height: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding and border. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - */ - outerWidth(includeMargin?: boolean): number; - - /** - * Sets the outer width on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - outerWidth(width: number|string): JQuery; - - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. - */ - position(): JQueryCoordinates; - - /** - * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. - */ - scrollLeft(): number; - /** - * Set the current horizontal position of the scroll bar for each of the set of matched elements. - * - * @param value An integer indicating the new position to set the scroll bar to. - */ - scrollLeft(value: number): JQuery; - - /** - * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. - */ - scrollTop(): number; - /** - * Set the current vertical position of the scroll bar for each of the set of matched elements. - * - * @param value An integer indicating the new position to set the scroll bar to. - */ - scrollTop(value: number): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements. - */ - width(): number; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - width(value: number|string): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. - */ - width(func: (index: number, width: number) => number|string): JQuery; - - /** - * Remove from the queue all items that have not yet been run. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - clearQueue(queueName?: string): JQuery; - - /** - * Store arbitrary data associated with the matched elements. - * - * @param key A string naming the piece of data to set. - * @param value The new data value; it can be any Javascript type including Array or Object. - */ - data(key: string, value: any): JQuery; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - * - * @param key Name of the data stored. - */ - data(key: string): any; - /** - * Store arbitrary data associated with the matched elements. - * - * @param obj An object of key-value pairs of data to update. - */ - data(obj: { [key: string]: any; }): JQuery; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - */ - data(): any; - - /** - * Execute the next function on the queue for the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - dequeue(queueName?: string): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. - */ - removeData(name: string): JQuery; - /** - * Remove a previously-stored piece of data. - * - * @param list An array of strings naming the pieces of data to delete. - */ - removeData(list: string[]): JQuery; - /** - * Remove all previously-stored piece of data. - */ - removeData(): JQuery; - - /** - * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. - * - * @param type The type of queue that needs to be observed. (default: fx) - * @param target Object onto which the promise methods have to be attached - */ - promise(type?: string, target?: Object): JQueryPromise; - - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - animate(properties: Object, duration?: string|number, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. (default: swing) - * @param complete A function to call once the animation is complete. - */ - animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param options A map of additional options to pass to the method. - */ - animate(properties: Object, options: JQueryAnimationOptions): JQuery; - - /** - * Set a timer to delay execution of subsequent items in the queue. - * - * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - delay(duration: number, queueName?: string): JQuery; - - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeIn(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param options A map of additional options to pass to the method. - */ - fadeIn(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeOut(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param options A map of additional options to pass to the method. - */ - fadeOut(options: JQueryAnimationOptions): JQuery; - - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param complete A function to call once the animation is complete. - */ - fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; - - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param options A map of additional options to pass to the method. - */ - fadeToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. - * - * @param queue The name of the queue in which to stop animations. - */ - finish(queue?: string): JQuery; - - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - hide(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - hide(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param options A map of additional options to pass to the method. - */ - hide(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - show(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - show(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param options A map of additional options to pass to the method. - */ - show(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideDown(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - */ - slideDown(options: JQueryAnimationOptions): JQuery; - - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - */ - slideToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideUp(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - */ - slideUp(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation on the matched elements. - * - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - */ - stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - /** - * Stop the currently-running animation on the matched elements. - * - * @param queue The name of the queue in which to stop animations. - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - */ - stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - toggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param options A map of additional options to pass to the method. - */ - toggle(options: JQueryAnimationOptions): JQuery; - /** - * Display or hide the matched elements. - * - * @param showOrHide A Boolean indicating whether to show or hide the elements. - */ - toggle(showOrHide: boolean): JQuery; - - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute each time the event is triggered. - */ - bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - */ - bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - */ - bind(eventType: string, preventBubble: boolean): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param events An object containing one or more DOM event types and functions to execute for them. - */ - bind(events: any): JQuery; - - /** - * Trigger the "blur" event on an element - */ - blur(): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - blur(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "change" event on an element. - */ - change(): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - change(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "click" event on an element. - */ - click(): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - */ - click(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "dblclick" event on an element. - */ - dblclick(): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focus" event on an element. - */ - focus(): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - focus(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focusin" event on an element. - */ - focusin(): JQuery; - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - focusin(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focusout" event on an element. - */ - focusout(): JQuery; - /** - * Bind an event handler to the "focusout" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - focusout(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusout" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. - * - * @param handlerIn A function to execute when the mouse pointer enters the element. - * @param handlerOut A function to execute when the mouse pointer leaves the element. - */ - hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. - * - * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. - */ - hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "keydown" event on an element. - */ - keydown(): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keypress" event on an element. - */ - keypress(): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keyup" event on an element. - */ - keyup(): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - load(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "mousedown" event on an element. - */ - mousedown(): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseenter" event on an element. - */ - mouseenter(): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param handler A function to execute when the event is triggered. - */ - mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseleave" event on an element. - */ - mouseleave(): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param handler A function to execute when the event is triggered. - */ - mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mousemove" event on an element. - */ - mousemove(): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseout" event on an element. - */ - mouseout(): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseover" event on an element. - */ - mouseover(): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseup" event on an element. - */ - mouseup(): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - */ - mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Remove an event handler. - */ - off(): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @param handler A handler function previously attached for the event(s), or the special value false. - */ - off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. - */ - off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - */ - off(events: { [key: string]: any; }, selector?: string): JQuery; - - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). - */ - on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - on(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - on(events: { [key: string]: any; }, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute at the time the event is triggered. - */ - one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param data An object containing data that will be passed to the event handler. - * @param handler A function to execute at the time the event is triggered. - */ - one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - */ - one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - */ - one(events: { [key: string]: any; }, data?: any): JQuery; - - - /** - * Specify a function to execute when the DOM is fully loaded. - * - * @param handler A function to execute after the DOM is ready. - */ - ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Trigger the "resize" event on an element. - */ - resize(): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - */ - resize(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "scroll" event on an element. - */ - scroll(): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - */ - scroll(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "select" event on an element. - */ - select(): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - */ - select(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "submit" event on an element. - */ - submit(): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - */ - submit(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - */ - submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters Additional parameters to pass along to the event handler. - */ - trigger(eventType: string, extraParameters?: any[]|Object): JQuery; - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param event A jQuery.Event object. - * @param extraParameters Additional parameters to pass along to the event handler. - */ - trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; - - /** - * Execute all handlers attached to an element for an event. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters An array of additional parameters to pass along to the event handler. - */ - triggerHandler(eventType: string, ...extraParameters: any[]): Object; - - /** - * Execute all handlers attached to an element for an event. - * - * @param event A jQuery.Event object. - * @param extraParameters An array of additional parameters to pass along to the event handler. - */ - triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object; - - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param handler The function that is to be no longer executed. - */ - unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). - */ - unbind(eventType: string, fls: boolean): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param evt A JavaScript event object as passed to an event handler. - */ - unbind(evt: any): JQuery; - - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - */ - undelegate(): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" - * @param handler A function to execute at the time the event is triggered. - */ - undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param events An object of one or more event types and previously bound functions to unbind from them. - */ - undelegate(selector: string, events: Object): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param namespace A string containing a namespace to unbind all events from. - */ - undelegate(namespace: string): JQuery; - - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - */ - unload(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10) - */ - context: Element; - - jquery: string; - - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - */ - error(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - */ - error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - */ - pushStack(elements: any[]): JQuery; - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - * @param name The name of a jQuery method that generated the array of elements. - * @param arguments The arguments that were passed in to the jQuery method (for serialization). - */ - pushStack(elements: any[], name: string, arguments: any[]): JQuery; - - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - */ - after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - after(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - */ - append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - */ - append(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. - */ - appendTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - */ - before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - before(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Create a deep copy of the set of matched elements. - * - * param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. - * param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). - */ - clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery; - - /** - * Remove the set of matched elements from the DOM. - * - * param selector A selector expression that filters the set of matched elements to be removed. - */ - detach(selector?: string): JQuery; - - /** - * Remove all child nodes of the set of matched elements from the DOM. - */ - empty(): JQuery; - - /** - * Insert every element in the set of matched elements after the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - */ - insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert every element in the set of matched elements before the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - */ - insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - */ - prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - */ - prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. - */ - prependTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - */ - remove(selector?: string): JQuery; - - /** - * Replace each target element with the set of matched elements. - * - * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - */ - replaceAll(target: JQuery|any[]|Element|string): JQuery; - - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - */ - replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param func A function that returns content with which to replace the set of matched elements. - */ - replaceWith(func: () => Element|JQuery): JQuery; - - /** - * Get the combined text contents of each element in the set of matched elements, including their descendants. - */ - text(): string; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. - */ - text(text: string|number|boolean): JQuery; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. - */ - text(func: (index: number, text: string) => string): JQuery; - - /** - * Retrieve all the elements contained in the jQuery set, as an array. - */ - toArray(): any[]; - - /** - * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. - */ - unwrap(): JQuery; - - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrap(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - wrap(func: (index: number) => string|JQuery): JQuery; - - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrapAll(wrappingElement: JQuery|Element|string): JQuery; - wrapAll(func: (index: number) => string): JQuery; - - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. - */ - wrapInner(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - */ - wrapInner(func: (index: number) => string): JQuery; - - /** - * Iterate over a jQuery object, executing a function for each matched element. - * - * @param func A function to execute for each matched element. - */ - each(func: (index: number, elem: Element) => any): JQuery; - - /** - * Retrieve one of the elements matched by the jQuery object. - * - * @param index A zero-based integer indicating which element to retrieve. - */ - get(index: number): HTMLElement; - /** - * Retrieve the elements matched by the jQuery object. - */ - get(): any[]; - - /** - * Search for a given element from among the matched elements. - */ - index(): number; - /** - * Search for a given element from among the matched elements. - * - * @param selector A selector representing a jQuery collection in which to look for an element. - */ - index(selector: string|JQuery|Element): number; - - /** - * The number of elements in the jQuery object. - */ - length: number; - /** - * A selector representing selector passed to jQuery(), if any, when creating the original set. - * version deprecated: 1.7, removed: 1.9 - */ - selector: string; - [index: string]: any; - [index: number]: HTMLElement; - - /** - * Add elements to the set of matched elements. - * - * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. - * @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. - */ - add(selector: string, context?: Element): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param elements One or more elements to add to the set of matched elements. - */ - add(...elements: Element[]): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param html An HTML fragment to add to the set of matched elements. - */ - add(html: string): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param obj An existing jQuery object to add to the set of matched elements. - */ - add(obj: JQuery): JQuery; - - /** - * Get the children of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - children(selector?: string): JQuery; - - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - */ - closest(selector: string): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - */ - closest(selector: string, context?: Element): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param obj A jQuery object to match elements against. - */ - closest(obj: JQuery): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param element An element to match elements against. - */ - closest(element: Element): JQuery; - - /** - * Get an array of all the elements and selectors matched against the current element up through the DOM tree. - * - * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). - * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - */ - closest(selectors: any, context?: Element): any[]; - - /** - * Get the children of each element in the set of matched elements, including text and comment nodes. - */ - contents(): JQuery; - - /** - * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. - */ - end(): JQuery; - - /** - * Reduce the set of matched elements to the one at the specified index. - * - * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. - * - */ - eq(index: number): JQuery; - - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param selector A string containing a selector expression to match the current set of elements against. - */ - filter(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param func A function used as a test for each element in the set. this is the current DOM element. - */ - filter(func: (index: number, element: Element) => any): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param element An element to match the current set of elements against. - */ - filter(element: Element): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param obj An existing jQuery object to match the current set of elements against. - */ - filter(obj: JQuery): JQuery; - - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param selector A string containing a selector expression to match elements against. - */ - find(selector: string): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param element An element to match elements against. - */ - find(element: Element): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param obj A jQuery object to match elements against. - */ - find(obj: JQuery): JQuery; - - /** - * Reduce the set of matched elements to the first in the set. - */ - first(): JQuery; - - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param selector A string containing a selector expression to match elements against. - */ - has(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param contained A DOM element to match elements against. - */ - has(contained: Element): JQuery; - - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param selector A string containing a selector expression to match elements against. - */ - is(selector: string): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. - */ - is(func: (index: number, element: Element) => boolean): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param obj An existing jQuery object to match the current set of elements against. - */ - is(obj: JQuery): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param elements One or more elements to match the current set of elements against. - */ - is(elements: any): boolean; - - /** - * Reduce the set of matched elements to the final one in the set. - */ - last(): JQuery; - - /** - * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. - * - * @param callback A function object that will be invoked for each element in the current set. - */ - map(callback: (index: number, domElement: Element) => any): JQuery; - - /** - * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - next(selector?: string): JQuery; - - /** - * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - nextAll(selector?: string): JQuery; - - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - nextUntil(selector?: string, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - nextUntil(element?: Element, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - nextUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Remove elements from the set of matched elements. - * - * @param selector A string containing a selector expression to match elements against. - */ - not(selector: string): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param func A function used as a test for each element in the set. this is the current DOM element. - */ - not(func: (index: number, element: Element) => boolean): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param elements One or more DOM elements to remove from the matched set. - */ - not(elements: Element|Element[]): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param obj An existing jQuery object to match the current set of elements against. - */ - not(obj: JQuery): JQuery; - - /** - * Get the closest ancestor element that is positioned. - */ - offsetParent(): JQuery; - - /** - * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - parent(selector?: string): JQuery; - - /** - * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - parents(selector?: string): JQuery; - - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - */ - parentsUntil(selector?: string, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - */ - parentsUntil(element?: Element, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - */ - parentsUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - prev(selector?: string): JQuery; - - /** - * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - prevAll(selector?: string): JQuery; - - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - prevUntil(selector?: string, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - prevUntil(element?: Element, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - */ - prevUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - */ - siblings(selector?: string): JQuery; - - /** - * Reduce the set of matched elements to a subset specified by a range of indices. - * - * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. - * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. - */ - slice(start: number, end?: number): JQuery; - - /** - * Show the queue of functions to be executed on the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - */ - queue(queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param newQueue An array of functions to replace the current queue contents. - */ - queue(newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - */ - queue(callback: Function): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - */ - queue(queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - */ - queue(queueName: string, callback: Function): JQuery; -} -declare module "jquery" { - export = $; -} -declare var jQuery: JQueryStatic; -declare var $: JQueryStatic; diff --git a/decl/lib.es6.d.ts b/decl/lib.es6.d.ts deleted file mode 100644 index 084ed4e8a..000000000 --- a/decl/lib.es6.d.ts +++ /dev/null @@ -1,20674 +0,0 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - -/// -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has null prototype. - * @param o Object to use as a prototype. May be null - */ - create(o: null): any; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - */ - create(o: T): T; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(this: Function, thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(this: Function, thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(this: Function, thisArg: any, ...argArray: any[]): any; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray | null; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray | null; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare const Number: NumberConstructor; - -interface TemplateStringsArray extends ReadonlyArray { - readonly raw: ReadonlyArray -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): this; -} - -interface RegExpConstructor { - new (pattern: RegExp): RegExp; - new (pattern: string, flags?: string): RegExp; - (pattern: RegExp): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} - -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T | undefined; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T | undefined; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; - -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} -declare type PropertyKey = string | number | symbol; - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): this; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface DateConstructor { - new (value: Date): Date; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface ReadonlyArray { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: ReadonlyArray) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - new (pattern: RegExp, flags?: string): RegExp; - (pattern: RegExp, flags?: string): RegExp; -} - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number | undefined; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; - readonly size: number; -} - -interface MapConstructor { - new (): Map; - new (entries?: [K, V][]): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (entries?: [K, V][]): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): this; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface SetConstructor { - new (): Set; - new (values?: T[]): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): this; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (values?: T[]): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; -interface GeneratorFunction extends Function { } - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; -/// - -interface SymbolConstructor { - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; -} - -interface IteratorResult { - done: boolean; - value: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; -} - -interface ReadonlyArray { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface Map { - [Symbol.iterator](): IterableIterator<[K,V]>; - entries(): IterableIterator<[K, V]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface MapConstructor { - new (iterable: Iterable<[K, V]>): Map; -} - -interface WeakMap { } - -interface WeakMapConstructor { - new (iterable: Iterable<[K, V]>): WeakMap; -} - -interface Set { - [Symbol.iterator](): IterableIterator; - entries(): IterableIterator<[T, T]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface SetConstructor { - new (iterable: Iterable): Set; -} - -interface WeakSet { } - -interface WeakSetConstructor { - new (iterable: Iterable): WeakSet; -} - -interface Promise { } - -interface PromiseConstructor { - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; -} - -declare namespace Reflect { - function enumerate(target: any): IterableIterator; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -}/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike): Promise; - - /** - * Creates a new Promise with the same internal state of this Promise. - * @returns A Promise. - */ - then(): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => T | PromiseLike): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - -declare var Promise: PromiseConstructor;interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor;declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -}interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string | undefined; -} - -declare var Symbol: SymbolConstructor;/// - -interface SymbolConstructor { - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} - -interface Symbol { - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface Array { - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface Map { - readonly [Symbol.toStringTag]: "Map"; -} - -interface WeakMap{ - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface Set { - readonly [Symbol.toStringTag]: "Set"; -} - -interface WeakSet { - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -interface Function { - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface Math { - readonly [Symbol.toStringTag]: "Math"; -} - -interface Promise { - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - readonly [Symbol.species]: Function; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray | null; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface String { - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - readonly [Symbol.toStringTag]: "Int8Array"; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - readonly [Symbol.toStringTag]: "Int16Array"; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - readonly [Symbol.toStringTag]: "Int32Array"; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - readonly [Symbol.toStringTag]: "Float32Array"; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - readonly [Symbol.toStringTag]: "Float64Array"; -} -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainLongRange extends LongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; -} - -interface EventModifierInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierOS?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends EventModifierInit { - code?: string; - key?: string; - location?: number; - repeat?: boolean; -} - -interface LongRange { - max?: number; - min?: number; -} - -interface MSAccountInfo { - rpDisplayName?: string; - userDisplayName?: string; - accountName?: string; - userId?: string; - accountImageUri?: string; -} - -interface MSAudioLocalClientEvent extends MSLocalClientEventBase { - networkSendQualityEventRatio?: number; - networkDelayEventRatio?: number; - cpuInsufficientEventRatio?: number; - deviceHalfDuplexAECEventRatio?: number; - deviceRenderNotFunctioningEventRatio?: number; - deviceCaptureNotFunctioningEventRatio?: number; - deviceGlitchesEventRatio?: number; - deviceLowSNREventRatio?: number; - deviceLowSpeechLevelEventRatio?: number; - deviceClippingEventRatio?: number; - deviceEchoEventRatio?: number; - deviceNearEndToEchoRatioEventRatio?: number; - deviceRenderZeroVolumeEventRatio?: number; - deviceRenderMuteEventRatio?: number; - deviceMultipleEndpointsEventCount?: number; - deviceHowlingEventCount?: number; -} - -interface MSAudioRecvPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioRecvSignal; - packetReorderRatio?: number; - packetReorderDepthAvg?: number; - packetReorderDepthMax?: number; - burstLossLength1?: number; - burstLossLength2?: number; - burstLossLength3?: number; - burstLossLength4?: number; - burstLossLength5?: number; - burstLossLength6?: number; - burstLossLength7?: number; - burstLossLength8OrHigher?: number; - fecRecvDistance1?: number; - fecRecvDistance2?: number; - fecRecvDistance3?: number; - ratioConcealedSamplesAvg?: number; - ratioStretchedSamplesAvg?: number; - ratioCompressedSamplesAvg?: number; -} - -interface MSAudioRecvSignal { - initialSignalLevelRMS?: number; - recvSignalLevelCh1?: number; - recvNoiseLevelCh1?: number; - renderSignalLevel?: number; - renderNoiseLevel?: number; - renderLoopbackSignalLevel?: number; -} - -interface MSAudioSendPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioSendSignal; - audioFECUsed?: boolean; - sendMutePercent?: number; -} - -interface MSAudioSendSignal { - noiseLevel?: number; - sendSignalLevelCh1?: number; - sendNoiseLevelCh1?: number; -} - -interface MSConnectivity { - iceType?: string; - iceWarningFlags?: MSIceWarningFlags; - relayAddress?: MSRelayAddress; -} - -interface MSCredentialFilter { - accept?: MSCredentialSpec[]; -} - -interface MSCredentialParameters { - type?: string; -} - -interface MSCredentialSpec { - type?: string; - id?: string; -} - -interface MSDelay { - roundTrip?: number; - roundTripMax?: number; -} - -interface MSDescription extends RTCStats { - connectivity?: MSConnectivity; - transport?: string; - networkconnectivity?: MSNetworkConnectivityInfo; - localAddr?: MSIPAddressInfo; - remoteAddr?: MSIPAddressInfo; - deviceDevName?: string; - reflexiveLocalIPAddr?: MSIPAddressInfo; -} - -interface MSFIDOCredentialParameters extends MSCredentialParameters { - algorithm?: string | Algorithm; - authenticators?: AAGUID[]; -} - -interface MSIPAddressInfo { - ipAddr?: string; - port?: number; - manufacturerMacAddrMask?: string; -} - -interface MSIceWarningFlags { - turnTcpTimedOut?: boolean; - turnUdpAllocateFailed?: boolean; - turnUdpSendFailed?: boolean; - turnTcpAllocateFailed?: boolean; - turnTcpSendFailed?: boolean; - udpLocalConnectivityFailed?: boolean; - udpNatConnectivityFailed?: boolean; - udpRelayConnectivityFailed?: boolean; - tcpNatConnectivityFailed?: boolean; - tcpRelayConnectivityFailed?: boolean; - connCheckMessageIntegrityFailed?: boolean; - allocationMessageIntegrityFailed?: boolean; - connCheckOtherError?: boolean; - turnAuthUnknownUsernameError?: boolean; - noRelayServersConfigured?: boolean; - multipleRelayServersAttempted?: boolean; - portRangeExhausted?: boolean; - alternateServerReceived?: boolean; - pseudoTLSFailure?: boolean; - turnTurnTcpConnectivityFailed?: boolean; - useCandidateChecksFailed?: boolean; - fipsAllocationFailure?: boolean; -} - -interface MSJitter { - interArrival?: number; - interArrivalMax?: number; - interArrivalSD?: number; -} - -interface MSLocalClientEventBase extends RTCStats { - networkReceiveQualityEventRatio?: number; - networkBandwidthLowEventRatio?: number; -} - -interface MSNetwork extends RTCStats { - jitter?: MSJitter; - delay?: MSDelay; - packetLoss?: MSPacketLoss; - utilization?: MSUtilization; -} - -interface MSNetworkConnectivityInfo { - vpn?: boolean; - linkspeed?: number; - networkConnectionDetails?: string; -} - -interface MSNetworkInterfaceType { - interfaceTypeEthernet?: boolean; - interfaceTypeWireless?: boolean; - interfaceTypePPP?: boolean; - interfaceTypeTunnel?: boolean; - interfaceTypeWWAN?: boolean; -} - -interface MSOutboundNetwork extends MSNetwork { - appliedBandwidthLimit?: number; -} - -interface MSPacketLoss { - lossRate?: number; - lossRateMax?: number; -} - -interface MSPayloadBase extends RTCStats { - payloadDescription?: string; -} - -interface MSRelayAddress { - relayAddress?: string; - port?: number; -} - -interface MSSignatureParameters { - userPrompt?: string; -} - -interface MSTransportDiagnosticsStats extends RTCStats { - baseAddress?: string; - localAddress?: string; - localSite?: string; - networkName?: string; - remoteAddress?: string; - remoteSite?: string; - localMR?: string; - remoteMR?: string; - iceWarningFlags?: MSIceWarningFlags; - portRangeMin?: number; - portRangeMax?: number; - localMRTCPPort?: number; - remoteMRTCPPort?: number; - stunVer?: number; - numConsentReqSent?: number; - numConsentReqReceived?: number; - numConsentRespSent?: number; - numConsentRespReceived?: number; - interfaces?: MSNetworkInterfaceType; - baseInterface?: MSNetworkInterfaceType; - protocol?: string; - localInterface?: MSNetworkInterfaceType; - localAddrType?: string; - remoteAddrType?: string; - iceRole?: string; - rtpRtcpMux?: boolean; - allocationTimeInMs?: number; - msRtcEngineVersion?: string; -} - -interface MSUtilization { - packets?: number; - bandwidthEstimation?: number; - bandwidthEstimationMin?: number; - bandwidthEstimationMax?: number; - bandwidthEstimationStdDev?: number; - bandwidthEstimationAvg?: number; -} - -interface MSVideoPayload extends MSPayloadBase { - resoluton?: string; - videoBitRateAvg?: number; - videoBitRateMax?: number; - videoFrameRateAvg?: number; - videoPacketLossRate?: number; - durationSeconds?: number; -} - -interface MSVideoRecvPayload extends MSVideoPayload { - videoFrameLossRate?: number; - recvCodecType?: string; - recvResolutionWidth?: number; - recvResolutionHeight?: number; - videoResolutions?: MSVideoResolutionDistribution; - recvFrameRateAverage?: number; - recvBitRateMaximum?: number; - recvBitRateAverage?: number; - recvVideoStreamsMax?: number; - recvVideoStreamsMin?: number; - recvVideoStreamsMode?: number; - videoPostFECPLR?: number; - lowBitRateCallPercent?: number; - lowFrameRateCallPercent?: number; - reorderBufferTotalPackets?: number; - recvReorderBufferReorderedPackets?: number; - recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; - recvReorderBufferMaxSuccessfullyOrderedExtent?: number; - recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; - recvReorderBufferPacketsDroppedDueToTimeout?: number; - recvFpsHarmonicAverage?: number; - recvNumResSwitches?: number; -} - -interface MSVideoResolutionDistribution { - cifQuality?: number; - vgaQuality?: number; - h720Quality?: number; - h1080Quality?: number; - h1440Quality?: number; - h2160Quality?: number; -} - -interface MSVideoSendPayload extends MSVideoPayload { - sendFrameRateAverage?: number; - sendBitRateMaximum?: number; - sendBitRateAverage?: number; - sendVideoStreamsMax?: number; - sendResolutionWidth?: number; - sendResolutionHeight?: number; -} - -interface MediaEncryptedEventInit extends EventInit { - initDataType?: string; - initData?: ArrayBuffer; -} - -interface MediaKeyMessageEventInit extends EventInit { - messageType?: string; - message?: ArrayBuffer; -} - -interface MediaKeySystemConfiguration { - initDataTypes?: string[]; - audioCapabilities?: MediaKeySystemMediaCapability[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: string; - persistentState?: string; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaStreamConstraints { - video?: boolean | MediaTrackConstraints; - audio?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError; -} - -interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - width?: number | LongRange; - height?: number | LongRange; - aspectRatio?: number | DoubleRange; - frameRate?: number | DoubleRange; - facingMode?: string; - volume?: number | DoubleRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - echoCancellation?: boolean[]; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackConstraintSet { - width?: number | ConstrainLongRange; - height?: number | ConstrainLongRange; - aspectRatio?: number | ConstrainDoubleRange; - frameRate?: number | ConstrainDoubleRange; - facingMode?: string | string[] | ConstrainDOMStringParameters; - volume?: number | ConstrainDoubleRange; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - echoCancelation?: boolean | ConstrainBooleanParameters; - deviceId?: string | string[] | ConstrainDOMStringParameters; - groupId?: string | string[] | ConstrainDOMStringParameters; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - width?: number; - height?: number; - aspectRatio?: number; - frameRate?: number; - facingMode?: string; - volume?: number; - sampleRate?: number; - sampleSize?: number; - echoCancellation?: boolean; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackSupportedConstraints { - width?: boolean; - height?: boolean; - aspectRatio?: boolean; - frameRate?: boolean; - facingMode?: boolean; - volume?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - echoCancellation?: boolean; - deviceId?: boolean; - groupId?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - role?: string; - fingerprints?: RTCDtlsFingerprint[]; -} - -interface RTCIceCandidate { - foundation?: string; - priority?: number; - ip?: string; - protocol?: string; - port?: number; - type?: string; - tcpType?: string; - relatedAddress?: string; - relatedPort?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - ipAddress?: string; - portNumber?: number; - transport?: string; - candidateType?: string; - priority?: number; - addressSourceUrl?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - transportId?: string; - localCandidateId?: string; - remoteCandidateId?: string; - state?: string; - priority?: number; - nominated?: boolean; - writable?: boolean; - readable?: boolean; - bytesSent?: number; - bytesReceived?: number; - roundTripTime?: number; - availableOutgoingBitrate?: number; - availableIncomingBitrate?: number; -} - -interface RTCIceGatherOptions { - gatherPolicy?: string; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - usernameFragment?: string; - password?: string; -} - -interface RTCIceServer { - urls?: any; - username?: string; - credential?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - packetsReceived?: number; - bytesReceived?: number; - packetsLost?: number; - jitter?: number; - fractionLost?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - trackIdentifier?: string; - remoteSource?: boolean; - ssrcIds?: string[]; - frameWidth?: number; - frameHeight?: number; - framesPerSecond?: number; - framesSent?: number; - framesReceived?: number; - framesDecoded?: number; - framesDropped?: number; - framesCorrupted?: number; - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - packetsSent?: number; - bytesSent?: number; - targetBitrate?: number; - roundTripTime?: number; -} - -interface RTCRTPStreamStats extends RTCStats { - ssrc?: string; - associateStatsId?: string; - isRemote?: boolean; - mediaTrackId?: string; - transportId?: string; - codecId?: string; - firCount?: number; - pliCount?: number; - nackCount?: number; - sliCount?: number; -} - -interface RTCRtcpFeedback { - type?: string; - parameter?: string; -} - -interface RTCRtcpParameters { - ssrc?: number; - cname?: string; - reducedSize?: boolean; - mux?: boolean; -} - -interface RTCRtpCapabilities { - codecs?: RTCRtpCodecCapability[]; - headerExtensions?: RTCRtpHeaderExtension[]; - fecMechanisms?: string[]; -} - -interface RTCRtpCodecCapability { - name?: string; - kind?: string; - clockRate?: number; - preferredPayloadType?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; - options?: any; - maxTemporalLayers?: number; - maxSpatialLayers?: number; - svcMultiStreamSupport?: boolean; -} - -interface RTCRtpCodecParameters { - name?: string; - payloadType?: any; - clockRate?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; -} - -interface RTCRtpContributingSource { - timestamp?: number; - csrc?: number; - audioLevel?: number; -} - -interface RTCRtpEncodingParameters { - ssrc?: number; - codecPayloadType?: number; - fec?: RTCRtpFecParameters; - rtx?: RTCRtpRtxParameters; - priority?: number; - maxBitrate?: number; - minQuality?: number; - framerateBias?: number; - resolutionScale?: number; - framerateScale?: number; - active?: boolean; - encodingId?: string; - dependencyEncodingIds?: string[]; - ssrcRange?: RTCSsrcRange; -} - -interface RTCRtpFecParameters { - ssrc?: number; - mechanism?: string; -} - -interface RTCRtpHeaderExtension { - kind?: string; - uri?: string; - preferredId?: number; - preferredEncrypt?: boolean; -} - -interface RTCRtpHeaderExtensionParameters { - uri?: string; - id?: number; - encrypt?: boolean; -} - -interface RTCRtpParameters { - muxId?: string; - codecs?: RTCRtpCodecParameters[]; - headerExtensions?: RTCRtpHeaderExtensionParameters[]; - encodings?: RTCRtpEncodingParameters[]; - rtcp?: RTCRtcpParameters; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpUnhandled { - ssrc?: number; - payloadType?: number; - muxId?: string; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiValue?: number; - mkiLength?: number; -} - -interface RTCSrtpSdesParameters { - tag?: number; - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; -} - -interface RTCSsrcRange { - min?: number; - max?: number; -} - -interface RTCStats { - timestamp?: number; - type?: string; - id?: string; - msType?: string; -} - -interface RTCStatsReport { -} - -interface RTCTransportStats extends RTCStats { - bytesSent?: number; - bytesReceived?: number; - rtcpTransportStatsId?: string; - activeConnection?: boolean; - selectedCandidatePairId?: string; - localCertificateId?: string; - remoteCertificateId?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - failIfMajorPerformanceCaveat?: boolean; - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCache extends EventTarget { - oncached: (this: this, ev: Event) => any; - onchecking: (this: this, ev: Event) => any; - ondownloading: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onnoupdate: (this: this, ev: Event) => any; - onobsolete: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onupdateready: (this: this, ev: Event) => any; - readonly status: number; - abort(): void; - swapCache(): void; - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: "cached", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - readonly attributeName: string; - attributeValue: string | null; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - readonly name: string; - readonly ownerElement: Element; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - readonly sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - readonly context: AudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - readonly defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - readonly id: string; - kind: string; - readonly label: string; - language: string; - readonly sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack | null; - item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - readonly pseudoClass: string; - readonly selector: string; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule; - readonly parentStyleSheet: CSSStyleSheet; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; - alignmentBaseline: string | null; - animation: string | null; - animationDelay: string | null; - animationDirection: string | null; - animationDuration: string | null; - animationFillMode: string | null; - animationIterationCount: string | null; - animationName: string | null; - animationPlayState: string | null; - animationTimingFunction: string | null; - backfaceVisibility: string | null; - background: string | null; - backgroundAttachment: string | null; - backgroundClip: string | null; - backgroundColor: string | null; - backgroundImage: string | null; - backgroundOrigin: string | null; - backgroundPosition: string | null; - backgroundPositionX: string | null; - backgroundPositionY: string | null; - backgroundRepeat: string | null; - backgroundSize: string | null; - baselineShift: string | null; - border: string | null; - borderBottom: string | null; - borderBottomColor: string | null; - borderBottomLeftRadius: string | null; - borderBottomRightRadius: string | null; - borderBottomStyle: string | null; - borderBottomWidth: string | null; - borderCollapse: string | null; - borderColor: string | null; - borderImage: string | null; - borderImageOutset: string | null; - borderImageRepeat: string | null; - borderImageSlice: string | null; - borderImageSource: string | null; - borderImageWidth: string | null; - borderLeft: string | null; - borderLeftColor: string | null; - borderLeftStyle: string | null; - borderLeftWidth: string | null; - borderRadius: string | null; - borderRight: string | null; - borderRightColor: string | null; - borderRightStyle: string | null; - borderRightWidth: string | null; - borderSpacing: string | null; - borderStyle: string | null; - borderTop: string | null; - borderTopColor: string | null; - borderTopLeftRadius: string | null; - borderTopRightRadius: string | null; - borderTopStyle: string | null; - borderTopWidth: string | null; - borderWidth: string | null; - bottom: string | null; - boxShadow: string | null; - boxSizing: string | null; - breakAfter: string | null; - breakBefore: string | null; - breakInside: string | null; - captionSide: string | null; - clear: string | null; - clip: string | null; - clipPath: string | null; - clipRule: string | null; - color: string | null; - colorInterpolationFilters: string | null; - columnCount: any; - columnFill: string | null; - columnGap: any; - columnRule: string | null; - columnRuleColor: any; - columnRuleStyle: string | null; - columnRuleWidth: any; - columnSpan: string | null; - columnWidth: any; - columns: string | null; - content: string | null; - counterIncrement: string | null; - counterReset: string | null; - cssFloat: string | null; - cssText: string; - cursor: string | null; - direction: string | null; - display: string | null; - dominantBaseline: string | null; - emptyCells: string | null; - enableBackground: string | null; - fill: string | null; - fillOpacity: string | null; - fillRule: string | null; - filter: string | null; - flex: string | null; - flexBasis: string | null; - flexDirection: string | null; - flexFlow: string | null; - flexGrow: string | null; - flexShrink: string | null; - flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; - height: string | null; - imeMode: string | null; - justifyContent: string | null; - kerning: string | null; - left: string | null; - readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineHeight: string | null; - listStyle: string | null; - listStyleImage: string | null; - listStylePosition: string | null; - listStyleType: string | null; - margin: string | null; - marginBottom: string | null; - marginLeft: string | null; - marginRight: string | null; - marginTop: string | null; - marker: string | null; - markerEnd: string | null; - markerMid: string | null; - markerStart: string | null; - mask: string | null; - maxHeight: string | null; - maxWidth: string | null; - minHeight: string | null; - minWidth: string | null; - msContentZoomChaining: string | null; - msContentZoomLimit: string | null; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string | null; - msContentZoomSnapPoints: string | null; - msContentZoomSnapType: string | null; - msContentZooming: string | null; - msFlowFrom: string | null; - msFlowInto: string | null; - msFontFeatureSettings: string | null; - msGridColumn: any; - msGridColumnAlign: string | null; - msGridColumnSpan: any; - msGridColumns: string | null; - msGridRow: any; - msGridRowAlign: string | null; - msGridRowSpan: any; - msGridRows: string | null; - msHighContrastAdjust: string | null; - msHyphenateLimitChars: string | null; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string | null; - msImeAlign: string | null; - msOverflowStyle: string | null; - msScrollChaining: string | null; - msScrollLimit: string | null; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string | null; - msScrollSnapPointsX: string | null; - msScrollSnapPointsY: string | null; - msScrollSnapType: string | null; - msScrollSnapX: string | null; - msScrollSnapY: string | null; - msScrollTranslation: string | null; - msTextCombineHorizontal: string | null; - msTextSizeAdjust: any; - msTouchAction: string | null; - msTouchSelect: string | null; - msUserSelect: string | null; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string | null; - order: string | null; - orphans: string | null; - outline: string | null; - outlineColor: string | null; - outlineStyle: string | null; - outlineWidth: string | null; - overflow: string | null; - overflowX: string | null; - overflowY: string | null; - padding: string | null; - paddingBottom: string | null; - paddingLeft: string | null; - paddingRight: string | null; - paddingTop: string | null; - pageBreakAfter: string | null; - pageBreakBefore: string | null; - pageBreakInside: string | null; - readonly parentRule: CSSRule; - perspective: string | null; - perspectiveOrigin: string | null; - pointerEvents: string | null; - position: string | null; - quotes: string | null; - right: string | null; - rubyAlign: string | null; - rubyOverhang: string | null; - rubyPosition: string | null; - stopColor: string | null; - stopOpacity: string | null; - stroke: string | null; - strokeDasharray: string | null; - strokeDashoffset: string | null; - strokeLinecap: string | null; - strokeLinejoin: string | null; - strokeMiterlimit: string | null; - strokeOpacity: string | null; - strokeWidth: string | null; - tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; - textAnchor: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; - textKashida: string | null; - textKashidaSpace: string | null; - textOverflow: string | null; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; - top: string | null; - touchAction: string | null; - transform: string | null; - transformOrigin: string | null; - transformStyle: string | null; - transition: string | null; - transitionDelay: string | null; - transitionDuration: string | null; - transitionProperty: string | null; - transitionTimingFunction: string | null; - unicodeBidi: string | null; - verticalAlign: string | null; - visibility: string | null; - webkitAlignContent: string | null; - webkitAlignItems: string | null; - webkitAlignSelf: string | null; - webkitAnimation: string | null; - webkitAnimationDelay: string | null; - webkitAnimationDirection: string | null; - webkitAnimationDuration: string | null; - webkitAnimationFillMode: string | null; - webkitAnimationIterationCount: string | null; - webkitAnimationName: string | null; - webkitAnimationPlayState: string | null; - webkitAnimationTimingFunction: string | null; - webkitAppearance: string | null; - webkitBackfaceVisibility: string | null; - webkitBackgroundClip: string | null; - webkitBackgroundOrigin: string | null; - webkitBackgroundSize: string | null; - webkitBorderBottomLeftRadius: string | null; - webkitBorderBottomRightRadius: string | null; - webkitBorderImage: string | null; - webkitBorderRadius: string | null; - webkitBorderTopLeftRadius: string | null; - webkitBorderTopRightRadius: string | null; - webkitBoxAlign: string | null; - webkitBoxDirection: string | null; - webkitBoxFlex: string | null; - webkitBoxOrdinalGroup: string | null; - webkitBoxOrient: string | null; - webkitBoxPack: string | null; - webkitBoxSizing: string | null; - webkitColumnBreakAfter: string | null; - webkitColumnBreakBefore: string | null; - webkitColumnBreakInside: string | null; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string | null; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string | null; - webkitColumnRuleWidth: any; - webkitColumnSpan: string | null; - webkitColumnWidth: any; - webkitColumns: string | null; - webkitFilter: string | null; - webkitFlex: string | null; - webkitFlexBasis: string | null; - webkitFlexDirection: string | null; - webkitFlexFlow: string | null; - webkitFlexGrow: string | null; - webkitFlexShrink: string | null; - webkitFlexWrap: string | null; - webkitJustifyContent: string | null; - webkitOrder: string | null; - webkitPerspective: string | null; - webkitPerspectiveOrigin: string | null; - webkitTapHighlightColor: string | null; - webkitTextFillColor: string | null; - webkitTextSizeAdjust: any; - webkitTransform: string | null; - webkitTransformOrigin: string | null; - webkitTransformStyle: string | null; - webkitTransition: string | null; - webkitTransitionDelay: string | null; - webkitTransitionDuration: string | null; - webkitTransitionProperty: string | null; - webkitTransitionTimingFunction: string | null; - webkitUserModify: string | null; - webkitUserSelect: string | null; - webkitWritingMode: string | null; - whiteSpace: string | null; - widows: string | null; - width: string | null; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; - zIndex: string | null; - zoom: string | null; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readonly readOnly: boolean; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - cssText: string; - readonly href: string; - readonly id: string; - readonly imports: StyleSheetList; - readonly isAlternate: boolean; - readonly isPrefAlternate: boolean; - readonly ownerRule: CSSRule; - readonly owningElement: Element; - readonly pages: StyleSheetPageList; - readonly readOnly: boolean; - readonly rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D extends Object, CanvasPathMethods { - readonly canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - mozImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - beginPath(): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - measureText(text: string): TextMetrics; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - readonly length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - readonly commandName: string; - readonly detail: string | null; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - readonly subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - readonly detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string | null, version: string | null): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - readonly length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - readonly files: FileList; - readonly items: DataTransferItemList; - readonly types: DOMStringList; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - readonly kind: string; - readonly type: string; - getAsFile(): File | null; - getAsString(_callback: FunctionStringCallback | null): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - readonly length: number; - add(data: File): DataTransferItem | null; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: string; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -} - -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceAcceleration | null; - readonly accelerationIncludingGravity: DeviceAcceleration | null; - readonly interval: number | null; - readonly rotationRate: DeviceRotationRate | null; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - readonly URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - readonly activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - cookie: string; - readonly currentScript: HTMLScriptElement | SVGScriptElement; - /** - * Gets the default character set from the current regional language settings. - */ - readonly defaultCharset: string; - readonly defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollectionOf; - readonly fullscreenElement: Element | null; - readonly fullscreenEnabled: boolean; - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string | null; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - readonly location: Location; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (this: this, ev: UIEvent) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (this: this, ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (this: this, ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (this: this, ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (this: this, ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (this: this, ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (this: this, ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (this: this, ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (this: this, ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (this: this, ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (this: this, ev: MediaStreamErrorEvent) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onfullscreenchange: (this: this, ev: Event) => any; - onfullscreenerror: (this: this, ev: Event) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (this: this, ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (this: this, ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (this: this, ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (this: this, ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (this: this, ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (this: this, ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (this: this, ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (this: this, ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (this: this, ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (this: this, ev: Event) => any; - onpointerlockchange: (this: this, ev: Event) => any; - onpointerlockerror: (this: this, ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (this: this, ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (this: this, ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (this: this, ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (this: this, ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (this: this, ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (this: this, ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (this: this, ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (this: this, ev: UIEvent) => any; - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (this: this, ev: Event) => any; - onselectstart: (this: this, ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (this: this, ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (this: this, ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (this: this, ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (this: this, ev: Event) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - plugins: HTMLCollectionOf; - readonly pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - readonly rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - readonly webkitCurrentFullScreenElement: Element | null; - readonly webkitFullscreenElement: Element | null; - readonly webkitFullscreenEnabled: boolean; - readonly webkitIsFullScreen: boolean; - readonly xmlEncoding: string | null; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string | null; - adoptNode(source: Node): Node; - captureEvents(): void; - caretRangeFromPoint(x: number, y: number): Range; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "blockquote"): HTMLQuoteElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLUnknownElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLPreElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "meter"): HTMLMeterElement; - createElement(tagName: "nextid"): HTMLUnknownElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "picture"): HTMLPictureElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "template"): HTMLTemplateElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLPreElement; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string | null, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement | null; - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "meter"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "picture"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "template"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeListOf; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): void; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectionchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - readonly entities: NamedNodeMap; - readonly internalSubset: string | null; - readonly name: string; - readonly notations: NamedNodeMap; - readonly publicId: string | null; - readonly systemId: string | null; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - readonly dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: AudioParam; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_frag_depth { -} - -declare var EXT_frag_depth: { - prototype: EXT_frag_depth; - new(): EXT_frag_depth; -} - -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { - readonly classList: DOMTokenList; - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - id: string; - msContentZoomFactor: number; - readonly msRegionOverflow: string; - onariarequest: (this: this, ev: AriaRequestEvent) => any; - oncommand: (this: this, ev: CommandEvent) => any; - ongotpointercapture: (this: this, ev: PointerEvent) => any; - onlostpointercapture: (this: this, ev: PointerEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: this, ev: MSPointerEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: this, ev: Event) => any; - onwebkitfullscreenerror: (this: this, ev: Event) => any; - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - readonly tagName: string; - innerHTML: string; - getAttribute(name: string): string | null; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "meter"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "picture"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "template"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - matches(selector: string): boolean; - closest(selector: string): Element | null; - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; - scroll(options?: ScrollToOptions): void; - scroll(x: number, y: number): void; - scrollTo(options?: ScrollToOptions): void; - scrollTo(x: number, y: number): void; - scrollBy(options?: ScrollToOptions): void; - scrollBy(x: number, y: number): void; - insertAdjacentElement(position: string, insertedElement: Element): Element | null; - insertAdjacentHTML(where: string, html: string): void; - insertAdjacentText(where: string, text: string): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: Element | null; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - readonly axes: number[]; - readonly buttons: GamepadButton[]; - readonly connected: boolean; - readonly id: string; - readonly index: number; - readonly mapping: string; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - readonly pressed: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - readonly mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - readonly nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - readonly protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string | null; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - text: any; - vLink: any; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. - */ - toDataURL(type?: string, ...args: any[]): string; - toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Retrieves an object from various collections. - */ - item(index: number): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollectionOf; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElement extends Element { - accessKey: string; - readonly children: HTMLCollection; - contentEditable: string; - readonly dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - readonly isContentEditable: boolean; - lang: string; - readonly offsetHeight: number; - readonly offsetLeft: number; - readonly offsetParent: Element; - readonly offsetTop: number; - readonly offsetWidth: number; - onabort: (this: this, ev: UIEvent) => any; - onactivate: (this: this, ev: UIEvent) => any; - onbeforeactivate: (this: this, ev: UIEvent) => any; - onbeforecopy: (this: this, ev: ClipboardEvent) => any; - onbeforecut: (this: this, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: this, ev: UIEvent) => any; - onbeforepaste: (this: this, ev: ClipboardEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - oncopy: (this: this, ev: ClipboardEvent) => any; - oncuechange: (this: this, ev: Event) => any; - oncut: (this: this, ev: ClipboardEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondeactivate: (this: this, ev: UIEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onfocus: (this: this, ev: FocusEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmscontentzoom: (this: this, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any; - onpaste: (this: this, ev: ClipboardEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreset: (this: this, ev: Event) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onselectstart: (this: this, ev: Event) => any; - onstalled: (this: this, ev: Event) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - readonly style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - msGetInputContext(): MSInputMethodContext; - setActive(): void; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - readonly palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - readonly pluginspage: string; - readonly readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - readonly elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (this: this, ev: FocusEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - onload: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onresize: (this: this, ev: UIEvent) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onunload: (this: this, ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: this, ev: Event) => any; - readonly sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - crossOrigin: string; - readonly currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - lowsrc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - readonly naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - readonly naturalWidth: number; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - readonly x: number; - readonly y: number; - msGetAsCastingSource(): any; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - readonly files: FileList | null; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - readonly list: HTMLElement; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - selectionDirection: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - webkitdirectory: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start?: number, end?: number, direction?: string): void; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - import?: Document; - integrity: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - readonly areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (this: this, ev: Event) => any; - onfinish: (this: this, ev: Event) => any; - onstart: (this: this, ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): void; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - readonly audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - readonly buffered: TimeRanges; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - crossOrigin: string; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - readonly currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - readonly duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - readonly ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - readonly error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - readonly mediaKeys: MediaKeys | null; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - readonly msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - readonly msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - readonly networkState: number; - onencrypted: (this: this, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - readonly paused: boolean; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - readonly played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - readonly seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - readonly seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcObject: MediaStream | null; - readonly textTracks: TextTrackList; - readonly videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Resets the audio or video object and loads a new media resource. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLMeterElement extends HTMLElement { - high: number; - low: number; - max: number; - min: number; - optimum: number; - value: number; -} - -declare var HTMLMeterElement: { - prototype: HTMLMeterElement; - new(): HTMLMeterElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - readonly object: any; - readonly readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - readonly text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLOptionsCollection extends HTMLCollectionOf { - length: number; - selectedIndex: number; - add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; - remove(index: number): void; -} - -declare var HTMLOptionsCollection: { - prototype: HTMLOptionsCollection; - new(): HTMLOptionsCollection; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPictureElement extends HTMLElement { -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - readonly position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - integrity: string; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - readonly options: HTMLOptionsCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - selectedOptions: HTMLCollectionOf; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - disabled: boolean; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - readonly cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollectionOf; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollectionOf; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - readonly rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - readonly sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableDataCellElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTemplateElement extends HTMLElement { - readonly content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readonly readyState: number; - src: string; - srclang: string; - readonly track: TextTrack; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - readonly msIsLayoutOptimalForPlayback: boolean; - readonly msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (this: this, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: this, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoWidth: number; - readonly webkitDisplayingFullscreen: boolean; - readonly webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): void; - addEventListener(type: "MSContentZoom", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "encrypted", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - readonly newURL: string | null; - readonly oldURL: string | null; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - readonly length: number; - readonly state: any; - back(distance?: any): void; - forward(distance?: any): void; - go(delta?: any): void; - pushState(statedata: any, title?: string, url?: string): void; - replaceState(statedata: any, title?: string, url?: string): void; -} - -declare var History: { - prototype: History; - new(): History; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: this, ev: Event) => any; - onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: this, ev: ErrorEvent) => any; - onsuccess: (this: this, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: this, ev: Event) => any; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - readonly altKey: boolean; - readonly char: string | null; - readonly charCode: number; - readonly ctrlKey: boolean; - readonly key: string; - readonly keyCode: number; - readonly locale: string; - readonly location: number; - readonly metaKey: boolean; - readonly repeat: boolean; - readonly shiftKey: boolean; - readonly which: number; - readonly code: string; - getModifierState(keyArg: string): boolean; - initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -interface ListeningStateChangedEvent extends Event { - readonly label: string; - readonly state: string; -} - -declare var ListeningStateChangedEvent: { - prototype: ListeningStateChangedEvent; - new(): ListeningStateChangedEvent; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - readonly executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSAssertion { - readonly id: string; - readonly type: string; -} - -declare var MSAssertion: { - prototype: MSAssertion; - new(): MSAssertion; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; -} - -declare var MSCredentials: { - prototype: MSCredentials; - new(): MSCredentials; -} - -interface MSFIDOCredentialAssertion extends MSAssertion { - readonly algorithm: string | Algorithm; - readonly attestation: any; - readonly publicKey: string; - readonly transportHints: string[]; -} - -declare var MSFIDOCredentialAssertion: { - prototype: MSFIDOCredentialAssertion; - new(): MSFIDOCredentialAssertion; -} - -interface MSFIDOSignature { - readonly authnrData: string; - readonly clientData: string; - readonly signature: string; -} - -declare var MSFIDOSignature: { - prototype: MSFIDOSignature; - new(): MSFIDOSignature; -} - -interface MSFIDOSignatureAssertion extends MSAssertion { - readonly signature: MSFIDOSignature; -} - -declare var MSFIDOSignatureAssertion: { - prototype: MSFIDOSignatureAssertion; - new(): MSFIDOSignatureAssertion; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - readonly clientX: number; - readonly clientY: number; - readonly expansion: number; - readonly gestureObject: any; - readonly hwTimestamp: number; - readonly offsetX: number; - readonly offsetY: number; - readonly rotation: number; - readonly scale: number; - readonly screenX: number; - readonly screenY: number; - readonly translationX: number; - readonly translationY: number; - readonly velocityAngular: number; - readonly velocityExpansion: number; - readonly velocityX: number; - readonly velocityY: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - readonly constrictionActive: boolean; - readonly status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - readonly canGoBack: boolean; - readonly canGoForward: boolean; - readonly containsFullScreenElement: boolean; - readonly documentTitle: string; - height: number; - readonly settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContext extends EventTarget { - readonly compositionEndOffset: number; - readonly compositionStartOffset: number; - oncandidatewindowhide: (this: this, ev: Event) => any; - oncandidatewindowshow: (this: this, ev: Event) => any; - oncandidatewindowupdate: (this: this, ev: Event) => any; - readonly target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - readonly currentState: number; - readonly inertiaDestinationX: number; - readonly inertiaDestinationY: number; - readonly lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - readonly code: number; - readonly systemCode: number; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - readonly destinationURL: string | null; - readonly message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - readonly initData: Uint8Array | null; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - readonly error: MSMediaKeyError | null; - readonly keySystem: string; - readonly sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - readonly keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; - isTypeSupportedWithFeatures(keySystem: string, type?: string): string; -} - -interface MSPointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - readonly length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - readonly actionURL: string; - readonly buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - readonly target: MSHTMLWebViewElement; - readonly type: number; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaDeviceInfo { - readonly deviceId: string; - readonly groupId: string; - readonly kind: string; - readonly label: string; -} - -declare var MediaDeviceInfo: { - prototype: MediaDeviceInfo; - new(): MediaDeviceInfo; -} - -interface MediaDevices extends EventTarget { - ondevicechange: (this: this, ev: Event) => any; - enumerateDevices(): any; - getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: "devicechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaDevices: { - prototype: MediaDevices; - new(): MediaDevices; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaEncryptedEvent extends Event { - readonly initData: ArrayBuffer | null; - readonly initDataType: string; -} - -declare var MediaEncryptedEvent: { - prototype: MediaEncryptedEvent; - new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; -} - -interface MediaError { - readonly code: number; - readonly msExtendedCode: number; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaKeyMessageEvent extends Event { - readonly message: ArrayBuffer; - readonly messageType: string; -} - -declare var MediaKeyMessageEvent: { - prototype: MediaKeyMessageEvent; - new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; -} - -interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; - readonly expiration: number; - readonly keyStatuses: MediaKeyStatusMap; - readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; -} - -declare var MediaKeySession: { - prototype: MediaKeySession; - new(): MediaKeySession; -} - -interface MediaKeyStatusMap { - readonly size: number; - forEach(callback: ForEachCallback): void; - get(keyId: any): string; - has(keyId: any): boolean; -} - -declare var MediaKeyStatusMap: { - prototype: MediaKeyStatusMap; - new(): MediaKeyStatusMap; -} - -interface MediaKeySystemAccess { - readonly keySystem: string; - createMediaKeys(): PromiseLike; - getConfiguration(): MediaKeySystemConfiguration; -} - -declare var MediaKeySystemAccess: { - prototype: MediaKeySystemAccess; - new(): MediaKeySystemAccess; -} - -interface MediaKeys { - createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; -} - -declare var MediaKeys: { - prototype: MediaKeys; - new(): MediaKeys; -} - -interface MediaList { - readonly length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - readonly activeSourceBuffers: SourceBufferList; - duration: number; - readonly readyState: string; - readonly sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MediaStream extends EventTarget { - readonly active: boolean; - readonly id: string; - onactive: (this: this, ev: Event) => any; - onaddtrack: (this: this, ev: TrackEvent) => any; - oninactive: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - addTrack(track: MediaStreamTrack): void; - clone(): MediaStream; - getAudioTracks(): MediaStreamTrack[]; - getTrackById(trackId: string): MediaStreamTrack | null; - getTracks(): MediaStreamTrack[]; - getVideoTracks(): MediaStreamTrack[]; - removeTrack(track: MediaStreamTrack): void; - stop(): void; - addEventListener(type: "active", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "inactive", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStream: { - prototype: MediaStream; - new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; -} - -interface MediaStreamAudioSourceNode extends AudioNode { -} - -declare var MediaStreamAudioSourceNode: { - prototype: MediaStreamAudioSourceNode; - new(): MediaStreamAudioSourceNode; -} - -interface MediaStreamError { - readonly constraintName: string | null; - readonly message: string | null; - readonly name: string; -} - -declare var MediaStreamError: { - prototype: MediaStreamError; - new(): MediaStreamError; -} - -interface MediaStreamErrorEvent extends Event { - readonly error: MediaStreamError | null; -} - -declare var MediaStreamErrorEvent: { - prototype: MediaStreamErrorEvent; - new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; -} - -interface MediaStreamTrack extends EventTarget { - enabled: boolean; - readonly id: string; - readonly kind: string; - readonly label: string; - readonly muted: boolean; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onmute: (this: this, ev: Event) => any; - onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any; - onunmute: (this: this, ev: Event) => any; - readonly readonly: boolean; - readonly readyState: string; - readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; - clone(): MediaStreamTrack; - getCapabilities(): MediaTrackCapabilities; - getConstraints(): MediaTrackConstraints; - getSettings(): MediaTrackSettings; - stop(): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "overconstrained", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unmute", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStreamTrack: { - prototype: MediaStreamTrack; - new(): MediaStreamTrack; -} - -interface MediaStreamTrackEvent extends Event { - readonly track: MediaStreamTrack; -} - -declare var MediaStreamTrackEvent: { - prototype: MediaStreamTrackEvent; - new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: this, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - readonly description: string; - readonly enabledPlugin: Plugin; - readonly suffixes: string; - readonly type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - readonly length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - readonly altKey: boolean; - readonly button: number; - readonly buttons: number; - readonly clientX: number; - readonly clientY: number; - readonly ctrlKey: boolean; - readonly fromElement: Element; - readonly layerX: number; - readonly layerY: number; - readonly metaKey: boolean; - readonly movementX: number; - readonly movementY: number; - readonly offsetX: number; - readonly offsetY: number; - readonly pageX: number; - readonly pageY: number; - readonly relatedTarget: EventTarget; - readonly screenX: number; - readonly screenY: number; - readonly shiftKey: boolean; - readonly toElement: Element; - readonly which: number; - readonly x: number; - readonly y: number; - getModifierState(keyArg: string): boolean; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MutationEvent extends Event { - readonly attrChange: number; - readonly attrName: string; - readonly newValue: string; - readonly prevValue: string; - readonly relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - readonly addedNodes: NodeList; - readonly attributeName: string | null; - readonly attributeNamespace: string | null; - readonly nextSibling: Node | null; - readonly oldValue: string | null; - readonly previousSibling: Node | null; - readonly removedNodes: NodeList; - readonly target: Node; - readonly type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - readonly length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - readonly isSuccess: boolean; - readonly webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - readonly uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - readonly referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { - readonly appCodeName: string; - readonly cookieEnabled: boolean; - readonly language: string; - readonly maxTouchPoints: number; - readonly mimeTypes: MimeTypeArray; - readonly msManipulationViewsEnabled: boolean; - readonly msMaxTouchPoints: number; - readonly msPointerEnabled: boolean; - readonly plugins: PluginArray; - readonly pointerEnabled: boolean; - readonly webdriver: boolean; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; - vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - readonly attributes: NamedNodeMap; - readonly baseURI: string | null; - readonly childNodes: NodeList; - readonly firstChild: Node; - readonly lastChild: Node; - readonly localName: string | null; - readonly namespaceURI: string | null; - readonly nextSibling: Node; - readonly nodeName: string; - readonly nodeType: number; - nodeValue: string | null; - readonly ownerDocument: Document; - readonly parentElement: HTMLElement; - readonly parentNode: Node; - readonly previousSibling: Node; - textContent: string | null; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - contains(child: Node): boolean; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; - isDefaultNamespace(namespaceURI: string | null): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string | null): string | null; - lookupPrefix(namespaceURI: string | null): string | null; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - readonly FILTER_ACCEPT: number; - readonly FILTER_REJECT: number; - readonly FILTER_SKIP: number; - readonly SHOW_ALL: number; - readonly SHOW_ATTRIBUTE: number; - readonly SHOW_CDATA_SECTION: number; - readonly SHOW_COMMENT: number; - readonly SHOW_DOCUMENT: number; - readonly SHOW_DOCUMENT_FRAGMENT: number; - readonly SHOW_DOCUMENT_TYPE: number; - readonly SHOW_ELEMENT: number; - readonly SHOW_ENTITY: number; - readonly SHOW_ENTITY_REFERENCE: number; - readonly SHOW_NOTATION: number; - readonly SHOW_PROCESSING_INSTRUCTION: number; - readonly SHOW_TEXT: number; -} - -interface NodeIterator { - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - readonly length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - readonly renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (this: this, ev: Event) => any; - startRendering(): PromiseLike; - addEventListener(type: "complete", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNode extends AudioNode { - readonly detune: AudioParam; - readonly frequency: AudioParam; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface OverflowEvent extends UIEvent { - readonly horizontalOverflow: boolean; - readonly orient: number; - readonly verticalOverflow: boolean; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -declare var OverflowEvent: { - prototype: OverflowEvent; - new(): OverflowEvent; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -interface PageTransitionEvent extends Event { - readonly persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - readonly activeNetworkRequestCount: number; - readonly averageFrameTime: number; - readonly averagePaintTime: number; - readonly extraInformationEnabled: boolean; - readonly independentRenderingEnabled: boolean; - readonly irDisablingContentString: string; - readonly irStatusAvailable: boolean; - readonly maxCpuSpeed: number; - readonly paintRequestsPerSecond: number; - readonly performanceCounter: number; - readonly performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number | null): any; - getRecentFrames(last: number | null): any; - getRecentMemoryUsage(last: number | null): any; - getRecentPaintRequests(last: number | null): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - readonly navigation: PerformanceNavigation; - readonly timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - readonly duration: number; - readonly entryType: string; - readonly name: string; - readonly startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - readonly redirectCount: number; - readonly type: number; - toJSON(): any; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly navigationStart: number; - readonly redirectCount: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly type: string; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly initiatorType: string; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly msFirstPaint: number; - readonly navigationStart: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; - readonly secureConnectionStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - readonly state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - readonly permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - readonly description: string; - readonly filename: string; - readonly length: number; - readonly name: string; - readonly version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - readonly length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - readonly state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - readonly target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface RTCDTMFToneChangeEvent extends Event { - readonly tone: string; -} - -declare var RTCDTMFToneChangeEvent: { - prototype: RTCDTMFToneChangeEvent; - new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; -} - -interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly state: string; - readonly transport: RTCIceTransport; - getLocalParameters(): RTCDtlsParameters; - getRemoteCertificates(): ArrayBuffer[]; - getRemoteParameters(): RTCDtlsParameters | null; - start(remoteParameters: RTCDtlsParameters): void; - stop(): void; - addEventListener(type: "dtlsstatechange", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtlsTransport: { - prototype: RTCDtlsTransport; - new(transport: RTCIceTransport): RTCDtlsTransport; -} - -interface RTCDtlsTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCDtlsTransportStateChangedEvent: { - prototype: RTCDtlsTransportStateChangedEvent; - new(): RTCDtlsTransportStateChangedEvent; -} - -interface RTCDtmfSender extends EventTarget { - readonly canInsertDTMF: boolean; - readonly duration: number; - readonly interToneGap: number; - ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any; - readonly sender: RTCRtpSender; - readonly toneBuffer: string; - insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: "tonechange", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtmfSender: { - prototype: RTCDtmfSender; - new(sender: RTCRtpSender): RTCDtmfSender; -} - -interface RTCIceCandidatePairChangedEvent extends Event { - readonly pair: RTCIceCandidatePair; -} - -declare var RTCIceCandidatePairChangedEvent: { - prototype: RTCIceCandidatePairChangedEvent; - new(): RTCIceCandidatePairChangedEvent; -} - -interface RTCIceGatherer extends RTCStatsProvider { - readonly component: string; - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null; - createAssociatedGatherer(): RTCIceGatherer; - getLocalCandidates(): RTCIceCandidate[]; - getLocalParameters(): RTCIceParameters; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "localcandidate", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceGatherer: { - prototype: RTCIceGatherer; - new(options: RTCIceGatherOptions): RTCIceGatherer; -} - -interface RTCIceGathererEvent extends Event { - readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; -} - -declare var RTCIceGathererEvent: { - prototype: RTCIceGathererEvent; - new(): RTCIceGathererEvent; -} - -interface RTCIceTransport extends RTCStatsProvider { - readonly component: string; - readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null; - readonly role: string; - readonly state: string; - addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; - createAssociatedTransport(): RTCIceTransport; - getNominatedCandidatePair(): RTCIceCandidatePair | null; - getRemoteCandidates(): RTCIceCandidate[]; - getRemoteParameters(): RTCIceParameters | null; - setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; - start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; - stop(): void; - addEventListener(type: "candidatepairchange", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: "icestatechange", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceTransport: { - prototype: RTCIceTransport; - new(): RTCIceTransport; -} - -interface RTCIceTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCIceTransportStateChangedEvent: { - prototype: RTCIceTransportStateChangedEvent; - new(): RTCIceTransportStateChangedEvent; -} - -interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack | null; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - getContributingSources(): RTCRtpContributingSource[]; - receive(parameters: RTCRtpParameters): void; - requestSendCSRC(csrc: number): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpReceiver: { - prototype: RTCRtpReceiver; - new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - send(parameters: RTCRtpParameters): void; - setTrack(track: MediaStreamTrack): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ssrcconflict", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpSender: { - prototype: RTCRtpSender; - new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: this, ev: ErrorEvent) => any) | null; - readonly transport: RTCIceTransport; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCSrtpSdesTransport: { - prototype: RTCSrtpSdesTransport; - new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; - getLocalParameters(): RTCSrtpSdesParameters[]; -} - -interface RTCSsrcConflictEvent extends Event { - readonly ssrc: number; -} - -declare var RTCSsrcConflictEvent: { - prototype: RTCSsrcConflictEvent; - new(): RTCSsrcConflictEvent; -} - -interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; -} - -declare var RTCStatsProvider: { - prototype: RTCStatsProvider; - new(): RTCStatsProvider; -} - -interface Range { - readonly collapsed: boolean; - readonly commonAncestorContainer: Node; - readonly endContainer: Node; - readonly endOffset: number; - readonly startContainer: Node; - readonly startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly target: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - readonly animVal: SVGAngle; - readonly baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - readonly animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - readonly animVal: SVGLength; - readonly baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - readonly animVal: SVGLengthList; - readonly baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - readonly animVal: SVGNumberList; - readonly baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - readonly animVal: SVGPreserveAspectRatio; - readonly baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - readonly animVal: SVGRect; - readonly baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - readonly animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - readonly animVal: SVGTransformList; - readonly baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - readonly amplitude: SVGAnimatedNumber; - readonly exponent: SVGAnimatedNumber; - readonly intercept: SVGAnimatedNumber; - readonly offset: SVGAnimatedNumber; - readonly slope: SVGAnimatedNumber; - readonly tableValues: SVGAnimatedNumberList; - readonly type: SVGAnimatedEnumeration; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElement extends Element { - onclick: (this: this, ev: MouseEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - onfocusin: (this: this, ev: FocusEvent) => any; - onfocusout: (this: this, ev: FocusEvent) => any; - onload: (this: this, ev: Event) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - readonly ownerSVGElement: SVGSVGElement; - readonly viewportElement: SVGElement; - xmlbase: string; - className: any; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - readonly childNodes: SVGElementInstanceList; - readonly correspondingElement: SVGElement; - readonly correspondingUseElement: SVGUseElement; - readonly firstChild: SVGElementInstance; - readonly lastChild: SVGElementInstance; - readonly nextSibling: SVGElementInstance; - readonly parentNode: SVGElementInstance; - readonly previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - readonly length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly mode: SVGAnimatedEnumeration; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly type: SVGAnimatedEnumeration; - readonly values: SVGAnimatedNumberList; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly k1: SVGAnimatedNumber; - readonly k2: SVGAnimatedNumber; - readonly k3: SVGAnimatedNumber; - readonly k4: SVGAnimatedNumber; - readonly operator: SVGAnimatedEnumeration; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly bias: SVGAnimatedNumber; - readonly divisor: SVGAnimatedNumber; - readonly edgeMode: SVGAnimatedEnumeration; - readonly in1: SVGAnimatedString; - readonly kernelMatrix: SVGAnimatedNumberList; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly orderX: SVGAnimatedInteger; - readonly orderY: SVGAnimatedInteger; - readonly preserveAlpha: SVGAnimatedBoolean; - readonly targetX: SVGAnimatedInteger; - readonly targetY: SVGAnimatedInteger; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly diffuseConstant: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly scale: SVGAnimatedNumber; - readonly xChannelSelector: SVGAnimatedEnumeration; - readonly yChannelSelector: SVGAnimatedEnumeration; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - readonly azimuth: SVGAnimatedNumber; - readonly elevation: SVGAnimatedNumber; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly stdDeviationX: SVGAnimatedNumber; - readonly stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - readonly in1: SVGAnimatedString; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly operator: SVGAnimatedEnumeration; - readonly radiusX: SVGAnimatedNumber; - readonly radiusY: SVGAnimatedNumber; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly dx: SVGAnimatedNumber; - readonly dy: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly specularConstant: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - readonly limitingConeAngle: SVGAnimatedNumber; - readonly pointsAtX: SVGAnimatedNumber; - readonly pointsAtY: SVGAnimatedNumber; - readonly pointsAtZ: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly baseFrequencyX: SVGAnimatedNumber; - readonly baseFrequencyY: SVGAnimatedNumber; - readonly numOctaves: SVGAnimatedInteger; - readonly seed: SVGAnimatedNumber; - readonly stitchTiles: SVGAnimatedEnumeration; - readonly type: SVGAnimatedEnumeration; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly filterResX: SVGAnimatedInteger; - readonly filterResY: SVGAnimatedInteger; - readonly filterUnits: SVGAnimatedEnumeration; - readonly height: SVGAnimatedLength; - readonly primitiveUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - readonly gradientTransform: SVGAnimatedTransformList; - readonly gradientUnits: SVGAnimatedEnumeration; - readonly spreadMethod: SVGAnimatedEnumeration; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly height: SVGAnimatedLength; - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - readonly numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - readonly markerHeight: SVGAnimatedLength; - readonly markerUnits: SVGAnimatedEnumeration; - readonly markerWidth: SVGAnimatedLength; - readonly orientAngle: SVGAnimatedAngle; - readonly orientType: SVGAnimatedEnumeration; - readonly refX: SVGAnimatedLength; - readonly refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly maskContentUnits: SVGAnimatedEnumeration; - readonly maskUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - readonly numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - readonly pathSegType: number; - readonly pathSegTypeAsLetter: string; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - readonly numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly patternContentUnits: SVGAnimatedEnumeration; - readonly patternTransform: SVGAnimatedTransformList; - readonly patternUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - readonly numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly fx: SVGAnimatedLength; - readonly fy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - readonly currentTranslate: SVGPoint; - readonly height: SVGAnimatedLength; - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onunload: (this: this, ev: Event) => any; - onzoom: (this: this, ev: SVGZoomEvent) => any; - readonly pixelUnitToMillimeterX: number; - readonly pixelUnitToMillimeterY: number; - readonly screenPixelToMillimeterX: number; - readonly screenPixelToMillimeterY: number; - readonly viewport: SVGRect; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - readonly offset: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - readonly numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - disabled: boolean; - media: string; - title: string; - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly lengthAdjust: SVGAnimatedEnumeration; - readonly textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - readonly method: SVGAnimatedEnumeration; - readonly spacing: SVGAnimatedEnumeration; - readonly startOffset: SVGAnimatedLength; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - readonly dx: SVGAnimatedLengthList; - readonly dy: SVGAnimatedLengthList; - readonly rotate: SVGAnimatedNumberList; - readonly x: SVGAnimatedLengthList; - readonly y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - readonly angle: number; - readonly matrix: SVGMatrix; - readonly type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - readonly numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - readonly SVG_UNIT_TYPE_UNKNOWN: number; - readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly animatedInstanceRoot: SVGElementInstance; - readonly height: SVGAnimatedLength; - readonly instanceRoot: SVGElementInstance; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - readonly viewTarget: SVGStringList; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - readonly zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - readonly SVG_ZOOMANDPAN_DISABLE: number; - readonly SVG_ZOOMANDPAN_MAGNIFY: number; - readonly SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - readonly newScale: number; - readonly newTranslate: SVGPoint; - readonly previousScale: number; - readonly previousTranslate: SVGPoint; - readonly zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface Screen extends EventTarget { - readonly availHeight: number; - readonly availWidth: number; - bufferDepth: number; - readonly colorDepth: number; - readonly deviceXDPI: number; - readonly deviceYDPI: number; - readonly fontSmoothingEnabled: boolean; - readonly height: number; - readonly logicalXDPI: number; - readonly logicalYDPI: number; - readonly msOrientation: string; - onmsorientationchange: (this: this, ev: Event) => any; - readonly pixelDepth: number; - readonly systemXDPI: number; - readonly systemYDPI: number; - readonly width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - readonly callingUri: string; - readonly value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNode extends AudioNode { - readonly bufferSize: number; - onaudioprocess: (this: this, ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - readonly anchorNode: Node; - readonly anchorOffset: number; - readonly focusNode: Node; - readonly focusOffset: number; - readonly isCollapsed: boolean; - readonly rangeCount: number; - readonly type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - readonly audioTracks: AudioTrackList; - readonly buffered: TimeRanges; - mode: string; - timestampOffset: number; - readonly updating: boolean; - readonly videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - readonly length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - readonly pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - readonly length: number; - clear(): void; - getItem(key: string): string | null; - key(index: number): string | null; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - readonly url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - readonly type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - readonly href: string; - readonly media: MediaList; - readonly ownerNode: Node; - readonly parentStyleSheet: StyleSheet; - readonly title: string; - readonly type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - readonly length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - readonly length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; - deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; - encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - exportKey(format: "jwk", key: CryptoKey): PromiseLike; - exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; - exportKey(format: string, key: CryptoKey): PromiseLike; - generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; - unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; - verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - readonly wholeText: string; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - readonly data: string; - readonly inputMethod: number; - readonly locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - readonly width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextTrack extends EventTarget { - readonly activeCues: TextTrackCueList; - readonly cues: TextTrackCueList; - readonly inBandMetadataTrackDispatchType: string; - readonly kind: string; - readonly label: string; - readonly language: string; - mode: any; - oncuechange: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - readonly readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; - addEventListener(type: "cuechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (this: this, ev: Event) => any; - onexit: (this: this, ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - readonly track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - readonly length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackList extends EventTarget { - readonly length: number; - onaddtrack: ((this: this, ev: TrackEvent) => any) | null; - item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - readonly length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - readonly clientX: number; - readonly clientY: number; - readonly identifier: number; - readonly pageX: number; - readonly pageY: number; - readonly screenX: number; - readonly screenY: number; - readonly target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - readonly altKey: boolean; - readonly changedTouches: TouchList; - readonly ctrlKey: boolean; - readonly metaKey: boolean; - readonly shiftKey: boolean; - readonly targetTouches: TouchList; - readonly touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - readonly length: number; - item(index: number): Touch | null; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - readonly track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - readonly elapsedTime: number; - readonly propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - readonly detail: number; - readonly view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - toString(): string; -} - -declare var URL: { - prototype: URL; - new(url: string, base?: string): URL; - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - readonly mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - readonly badInput: boolean; - readonly customError: boolean; - readonly patternMismatch: boolean; - readonly rangeOverflow: boolean; - readonly rangeUnderflow: boolean; - readonly stepMismatch: boolean; - readonly tooLong: boolean; - readonly typeMismatch: boolean; - readonly valid: boolean; - readonly valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - readonly corruptedVideoFrames: number; - readonly creationTime: number; - readonly droppedVideoFrames: number; - readonly totalFrameDelay: number; - readonly totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - readonly id: string; - kind: string; - readonly label: string; - language: string; - selected: boolean; - readonly sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: this, ev: TrackEvent) => any; - onchange: (this: this, ev: Event) => any; - onremovetrack: (this: this, ev: TrackEvent) => any; - readonly selectedIndex: number; - getTrackById(id: string): VideoTrack | null; - item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array | null; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - readonly name: string; - readonly size: number; - readonly type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - readonly statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - readonly canvas: HTMLCanvasElement; - readonly drawingBufferHeight: number; - readonly drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer | null): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; - bindTexture(target: number, texture: WebGLTexture | null): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader | null): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer | null; - createFramebuffer(): WebGLFramebuffer | null; - createProgram(): WebGLProgram | null; - createRenderbuffer(): WebGLRenderbuffer | null; - createShader(type: number): WebGLShader | null; - createTexture(): WebGLTexture | null; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer | null): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; - deleteProgram(program: WebGLProgram | null): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; - deleteShader(shader: WebGLShader | null): void; - deleteTexture(texture: WebGLTexture | null): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; - getAttribLocation(program: WebGLProgram | null, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram | null): string | null; - getProgramParameter(program: WebGLProgram | null, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader | null): string | null; - getShaderParameter(shader: WebGLShader | null, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; - getShaderSource(shader: WebGLShader | null): string | null; - getSupportedExtensions(): string[] | null; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; - getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer | null): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; - isProgram(program: WebGLProgram | null): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; - isShader(shader: WebGLShader | null): boolean; - isTexture(texture: WebGLTexture | null): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram | null): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader | null, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - useProgram(program: WebGLProgram | null): void; - validateProgram(program: WebGLProgram | null): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - readonly precision: number; - readonly rangeMax: number; - readonly rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: this, ev: CloseEvent) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onopen: (this: this, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: "close", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WheelEvent extends MouseEvent { - readonly deltaMode: number; - readonly deltaX: number; - readonly deltaY: number; - readonly deltaZ: number; - readonly wheelDelta: number; - readonly wheelDeltaX: number; - readonly wheelDeltaY: number; - getCurrentPoint(element: Element): void; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - readonly applicationCache: ApplicationCache; - readonly clientInformation: Navigator; - readonly closed: boolean; - readonly crypto: Crypto; - defaultStatus: string; - readonly devicePixelRatio: number; - readonly doNotTrack: string; - readonly document: Document; - event: Event; - readonly external: External; - readonly frameElement: Element; - readonly frames: Window; - readonly history: History; - readonly innerHeight: number; - readonly innerWidth: number; - readonly length: number; - readonly location: Location; - readonly locationbar: BarProp; - readonly menubar: BarProp; - readonly msCredentials: MSCredentials; - name: string; - readonly navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (this: this, ev: UIEvent) => any; - onafterprint: (this: this, ev: Event) => any; - onbeforeprint: (this: this, ev: Event) => any; - onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any; - onblur: (this: this, ev: FocusEvent) => any; - oncanplay: (this: this, ev: Event) => any; - oncanplaythrough: (this: this, ev: Event) => any; - onchange: (this: this, ev: Event) => any; - onclick: (this: this, ev: MouseEvent) => any; - oncompassneedscalibration: (this: this, ev: Event) => any; - oncontextmenu: (this: this, ev: PointerEvent) => any; - ondblclick: (this: this, ev: MouseEvent) => any; - ondevicelight: (this: this, ev: DeviceLightEvent) => any; - ondevicemotion: (this: this, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any; - ondrag: (this: this, ev: DragEvent) => any; - ondragend: (this: this, ev: DragEvent) => any; - ondragenter: (this: this, ev: DragEvent) => any; - ondragleave: (this: this, ev: DragEvent) => any; - ondragover: (this: this, ev: DragEvent) => any; - ondragstart: (this: this, ev: DragEvent) => any; - ondrop: (this: this, ev: DragEvent) => any; - ondurationchange: (this: this, ev: Event) => any; - onemptied: (this: this, ev: Event) => any; - onended: (this: this, ev: MediaStreamErrorEvent) => any; - onerror: ErrorEventHandler; - onfocus: (this: this, ev: FocusEvent) => any; - onhashchange: (this: this, ev: HashChangeEvent) => any; - oninput: (this: this, ev: Event) => any; - oninvalid: (this: this, ev: Event) => any; - onkeydown: (this: this, ev: KeyboardEvent) => any; - onkeypress: (this: this, ev: KeyboardEvent) => any; - onkeyup: (this: this, ev: KeyboardEvent) => any; - onload: (this: this, ev: Event) => any; - onloadeddata: (this: this, ev: Event) => any; - onloadedmetadata: (this: this, ev: Event) => any; - onloadstart: (this: this, ev: Event) => any; - onmessage: (this: this, ev: MessageEvent) => any; - onmousedown: (this: this, ev: MouseEvent) => any; - onmouseenter: (this: this, ev: MouseEvent) => any; - onmouseleave: (this: this, ev: MouseEvent) => any; - onmousemove: (this: this, ev: MouseEvent) => any; - onmouseout: (this: this, ev: MouseEvent) => any; - onmouseover: (this: this, ev: MouseEvent) => any; - onmouseup: (this: this, ev: MouseEvent) => any; - onmousewheel: (this: this, ev: WheelEvent) => any; - onmsgesturechange: (this: this, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any; - onmsgestureend: (this: this, ev: MSGestureEvent) => any; - onmsgesturehold: (this: this, ev: MSGestureEvent) => any; - onmsgesturestart: (this: this, ev: MSGestureEvent) => any; - onmsgesturetap: (this: this, ev: MSGestureEvent) => any; - onmsinertiastart: (this: this, ev: MSGestureEvent) => any; - onmspointercancel: (this: this, ev: MSPointerEvent) => any; - onmspointerdown: (this: this, ev: MSPointerEvent) => any; - onmspointerenter: (this: this, ev: MSPointerEvent) => any; - onmspointerleave: (this: this, ev: MSPointerEvent) => any; - onmspointermove: (this: this, ev: MSPointerEvent) => any; - onmspointerout: (this: this, ev: MSPointerEvent) => any; - onmspointerover: (this: this, ev: MSPointerEvent) => any; - onmspointerup: (this: this, ev: MSPointerEvent) => any; - onoffline: (this: this, ev: Event) => any; - ononline: (this: this, ev: Event) => any; - onorientationchange: (this: this, ev: Event) => any; - onpagehide: (this: this, ev: PageTransitionEvent) => any; - onpageshow: (this: this, ev: PageTransitionEvent) => any; - onpause: (this: this, ev: Event) => any; - onplay: (this: this, ev: Event) => any; - onplaying: (this: this, ev: Event) => any; - onpopstate: (this: this, ev: PopStateEvent) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - onratechange: (this: this, ev: Event) => any; - onreadystatechange: (this: this, ev: ProgressEvent) => any; - onreset: (this: this, ev: Event) => any; - onresize: (this: this, ev: UIEvent) => any; - onscroll: (this: this, ev: UIEvent) => any; - onseeked: (this: this, ev: Event) => any; - onseeking: (this: this, ev: Event) => any; - onselect: (this: this, ev: UIEvent) => any; - onstalled: (this: this, ev: Event) => any; - onstorage: (this: this, ev: StorageEvent) => any; - onsubmit: (this: this, ev: Event) => any; - onsuspend: (this: this, ev: Event) => any; - ontimeupdate: (this: this, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onunload: (this: this, ev: Event) => any; - onvolumechange: (this: this, ev: Event) => any; - onwaiting: (this: this, ev: Event) => any; - opener: any; - orientation: string | number; - readonly outerHeight: number; - readonly outerWidth: number; - readonly pageXOffset: number; - readonly pageYOffset: number; - readonly parent: Window; - readonly performance: Performance; - readonly personalbar: BarProp; - readonly screen: Screen; - readonly screenLeft: number; - readonly screenTop: number; - readonly screenX: number; - readonly screenY: number; - readonly scrollX: number; - readonly scrollY: number; - readonly scrollbars: BarProp; - readonly self: Window; - status: string; - readonly statusbar: BarProp; - readonly styleMedia: StyleMedia; - readonly toolbar: BarProp; - readonly top: Window; - readonly window: Window; - URL: typeof URL; - Blob: typeof Blob; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, transfer?: any[]): void; - print(): void; - prompt(message?: string, _default?: string): string | null; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitCancelAnimationFrame(handle: number): void; - webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; - webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; - webkitRequestAnimationFrame(callback: FrameRequestCallback): number; - scroll(options?: ScrollToOptions): void; - scrollTo(options?: ScrollToOptions): void; - scrollBy(options?: ScrollToOptions): void; - addEventListener(type: "MSGestureChange", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicelight", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "invalid", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: Window; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: this, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: this, ev: ProgressEvent) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - readonly booleanValue: boolean; - readonly invalidIteratorState: boolean; - readonly numberValue: number; - readonly resultType: number; - readonly singleNodeValue: Node; - readonly snapshotLength: number; - readonly stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorker { - onerror: (this: this, ev: ErrorEvent) => any; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface CanvasPathMethods { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"OverflowEvent"): OverflowEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - readonly childElementCount: number; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly nextElementSibling: Element; - readonly previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlers { - onpointercancel: (this: this, ev: PointerEvent) => any; - onpointerdown: (this: this, ev: PointerEvent) => any; - onpointerenter: (this: this, ev: PointerEvent) => any; - onpointerleave: (this: this, ev: PointerEvent) => any; - onpointermove: (this: this, ev: PointerEvent) => any; - onpointerout: (this: this, ev: PointerEvent) => any; - onpointerover: (this: this, ev: PointerEvent) => any; - onpointerup: (this: this, ev: PointerEvent) => any; - onwheel: (this: this, ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - readonly indexedDB: IDBFactory; -} - -interface LinkStyle { - readonly sheet: StyleSheet; -} - -interface MSBaseReader { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: number; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - readonly geolocation: Geolocation; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NavigatorUserMedia { - readonly mediaDevices: MediaDevices; - getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; -} - -interface NodeSelector { - querySelector(selectors: "a"): HTMLAnchorElement; - querySelector(selectors: "abbr"): HTMLElement; - querySelector(selectors: "acronym"): HTMLElement; - querySelector(selectors: "address"): HTMLElement; - querySelector(selectors: "applet"): HTMLAppletElement; - querySelector(selectors: "area"): HTMLAreaElement; - querySelector(selectors: "article"): HTMLElement; - querySelector(selectors: "aside"): HTMLElement; - querySelector(selectors: "audio"): HTMLAudioElement; - querySelector(selectors: "b"): HTMLElement; - querySelector(selectors: "base"): HTMLBaseElement; - querySelector(selectors: "basefont"): HTMLBaseFontElement; - querySelector(selectors: "bdo"): HTMLElement; - querySelector(selectors: "big"): HTMLElement; - querySelector(selectors: "blockquote"): HTMLQuoteElement; - querySelector(selectors: "body"): HTMLBodyElement; - querySelector(selectors: "br"): HTMLBRElement; - querySelector(selectors: "button"): HTMLButtonElement; - querySelector(selectors: "canvas"): HTMLCanvasElement; - querySelector(selectors: "caption"): HTMLTableCaptionElement; - querySelector(selectors: "center"): HTMLElement; - querySelector(selectors: "circle"): SVGCircleElement; - querySelector(selectors: "cite"): HTMLElement; - querySelector(selectors: "clippath"): SVGClipPathElement; - querySelector(selectors: "code"): HTMLElement; - querySelector(selectors: "col"): HTMLTableColElement; - querySelector(selectors: "colgroup"): HTMLTableColElement; - querySelector(selectors: "datalist"): HTMLDataListElement; - querySelector(selectors: "dd"): HTMLElement; - querySelector(selectors: "defs"): SVGDefsElement; - querySelector(selectors: "del"): HTMLModElement; - querySelector(selectors: "desc"): SVGDescElement; - querySelector(selectors: "dfn"): HTMLElement; - querySelector(selectors: "dir"): HTMLDirectoryElement; - querySelector(selectors: "div"): HTMLDivElement; - querySelector(selectors: "dl"): HTMLDListElement; - querySelector(selectors: "dt"): HTMLElement; - querySelector(selectors: "ellipse"): SVGEllipseElement; - querySelector(selectors: "em"): HTMLElement; - querySelector(selectors: "embed"): HTMLEmbedElement; - querySelector(selectors: "feblend"): SVGFEBlendElement; - querySelector(selectors: "fecolormatrix"): SVGFEColorMatrixElement; - querySelector(selectors: "fecomponenttransfer"): SVGFEComponentTransferElement; - querySelector(selectors: "fecomposite"): SVGFECompositeElement; - querySelector(selectors: "feconvolvematrix"): SVGFEConvolveMatrixElement; - querySelector(selectors: "fediffuselighting"): SVGFEDiffuseLightingElement; - querySelector(selectors: "fedisplacementmap"): SVGFEDisplacementMapElement; - querySelector(selectors: "fedistantlight"): SVGFEDistantLightElement; - querySelector(selectors: "feflood"): SVGFEFloodElement; - querySelector(selectors: "fefunca"): SVGFEFuncAElement; - querySelector(selectors: "fefuncb"): SVGFEFuncBElement; - querySelector(selectors: "fefuncg"): SVGFEFuncGElement; - querySelector(selectors: "fefuncr"): SVGFEFuncRElement; - querySelector(selectors: "fegaussianblur"): SVGFEGaussianBlurElement; - querySelector(selectors: "feimage"): SVGFEImageElement; - querySelector(selectors: "femerge"): SVGFEMergeElement; - querySelector(selectors: "femergenode"): SVGFEMergeNodeElement; - querySelector(selectors: "femorphology"): SVGFEMorphologyElement; - querySelector(selectors: "feoffset"): SVGFEOffsetElement; - querySelector(selectors: "fepointlight"): SVGFEPointLightElement; - querySelector(selectors: "fespecularlighting"): SVGFESpecularLightingElement; - querySelector(selectors: "fespotlight"): SVGFESpotLightElement; - querySelector(selectors: "fetile"): SVGFETileElement; - querySelector(selectors: "feturbulence"): SVGFETurbulenceElement; - querySelector(selectors: "fieldset"): HTMLFieldSetElement; - querySelector(selectors: "figcaption"): HTMLElement; - querySelector(selectors: "figure"): HTMLElement; - querySelector(selectors: "filter"): SVGFilterElement; - querySelector(selectors: "font"): HTMLFontElement; - querySelector(selectors: "footer"): HTMLElement; - querySelector(selectors: "foreignobject"): SVGForeignObjectElement; - querySelector(selectors: "form"): HTMLFormElement; - querySelector(selectors: "frame"): HTMLFrameElement; - querySelector(selectors: "frameset"): HTMLFrameSetElement; - querySelector(selectors: "g"): SVGGElement; - querySelector(selectors: "h1"): HTMLHeadingElement; - querySelector(selectors: "h2"): HTMLHeadingElement; - querySelector(selectors: "h3"): HTMLHeadingElement; - querySelector(selectors: "h4"): HTMLHeadingElement; - querySelector(selectors: "h5"): HTMLHeadingElement; - querySelector(selectors: "h6"): HTMLHeadingElement; - querySelector(selectors: "head"): HTMLHeadElement; - querySelector(selectors: "header"): HTMLElement; - querySelector(selectors: "hgroup"): HTMLElement; - querySelector(selectors: "hr"): HTMLHRElement; - querySelector(selectors: "html"): HTMLHtmlElement; - querySelector(selectors: "i"): HTMLElement; - querySelector(selectors: "iframe"): HTMLIFrameElement; - querySelector(selectors: "image"): SVGImageElement; - querySelector(selectors: "img"): HTMLImageElement; - querySelector(selectors: "input"): HTMLInputElement; - querySelector(selectors: "ins"): HTMLModElement; - querySelector(selectors: "isindex"): HTMLUnknownElement; - querySelector(selectors: "kbd"): HTMLElement; - querySelector(selectors: "keygen"): HTMLElement; - querySelector(selectors: "label"): HTMLLabelElement; - querySelector(selectors: "legend"): HTMLLegendElement; - querySelector(selectors: "li"): HTMLLIElement; - querySelector(selectors: "line"): SVGLineElement; - querySelector(selectors: "lineargradient"): SVGLinearGradientElement; - querySelector(selectors: "link"): HTMLLinkElement; - querySelector(selectors: "listing"): HTMLPreElement; - querySelector(selectors: "map"): HTMLMapElement; - querySelector(selectors: "mark"): HTMLElement; - querySelector(selectors: "marker"): SVGMarkerElement; - querySelector(selectors: "marquee"): HTMLMarqueeElement; - querySelector(selectors: "mask"): SVGMaskElement; - querySelector(selectors: "menu"): HTMLMenuElement; - querySelector(selectors: "meta"): HTMLMetaElement; - querySelector(selectors: "metadata"): SVGMetadataElement; - querySelector(selectors: "meter"): HTMLMeterElement; - querySelector(selectors: "nav"): HTMLElement; - querySelector(selectors: "nextid"): HTMLUnknownElement; - querySelector(selectors: "nobr"): HTMLElement; - querySelector(selectors: "noframes"): HTMLElement; - querySelector(selectors: "noscript"): HTMLElement; - querySelector(selectors: "object"): HTMLObjectElement; - querySelector(selectors: "ol"): HTMLOListElement; - querySelector(selectors: "optgroup"): HTMLOptGroupElement; - querySelector(selectors: "option"): HTMLOptionElement; - querySelector(selectors: "p"): HTMLParagraphElement; - querySelector(selectors: "param"): HTMLParamElement; - querySelector(selectors: "path"): SVGPathElement; - querySelector(selectors: "pattern"): SVGPatternElement; - querySelector(selectors: "picture"): HTMLPictureElement; - querySelector(selectors: "plaintext"): HTMLElement; - querySelector(selectors: "polygon"): SVGPolygonElement; - querySelector(selectors: "polyline"): SVGPolylineElement; - querySelector(selectors: "pre"): HTMLPreElement; - querySelector(selectors: "progress"): HTMLProgressElement; - querySelector(selectors: "q"): HTMLQuoteElement; - querySelector(selectors: "radialgradient"): SVGRadialGradientElement; - querySelector(selectors: "rect"): SVGRectElement; - querySelector(selectors: "rt"): HTMLElement; - querySelector(selectors: "ruby"): HTMLElement; - querySelector(selectors: "s"): HTMLElement; - querySelector(selectors: "samp"): HTMLElement; - querySelector(selectors: "script"): HTMLScriptElement; - querySelector(selectors: "section"): HTMLElement; - querySelector(selectors: "select"): HTMLSelectElement; - querySelector(selectors: "small"): HTMLElement; - querySelector(selectors: "source"): HTMLSourceElement; - querySelector(selectors: "span"): HTMLSpanElement; - querySelector(selectors: "stop"): SVGStopElement; - querySelector(selectors: "strike"): HTMLElement; - querySelector(selectors: "strong"): HTMLElement; - querySelector(selectors: "style"): HTMLStyleElement; - querySelector(selectors: "sub"): HTMLElement; - querySelector(selectors: "sup"): HTMLElement; - querySelector(selectors: "svg"): SVGSVGElement; - querySelector(selectors: "switch"): SVGSwitchElement; - querySelector(selectors: "symbol"): SVGSymbolElement; - querySelector(selectors: "table"): HTMLTableElement; - querySelector(selectors: "tbody"): HTMLTableSectionElement; - querySelector(selectors: "td"): HTMLTableDataCellElement; - querySelector(selectors: "template"): HTMLTemplateElement; - querySelector(selectors: "text"): SVGTextElement; - querySelector(selectors: "textpath"): SVGTextPathElement; - querySelector(selectors: "textarea"): HTMLTextAreaElement; - querySelector(selectors: "tfoot"): HTMLTableSectionElement; - querySelector(selectors: "th"): HTMLTableHeaderCellElement; - querySelector(selectors: "thead"): HTMLTableSectionElement; - querySelector(selectors: "title"): HTMLTitleElement; - querySelector(selectors: "tr"): HTMLTableRowElement; - querySelector(selectors: "track"): HTMLTrackElement; - querySelector(selectors: "tspan"): SVGTSpanElement; - querySelector(selectors: "tt"): HTMLElement; - querySelector(selectors: "u"): HTMLElement; - querySelector(selectors: "ul"): HTMLUListElement; - querySelector(selectors: "use"): SVGUseElement; - querySelector(selectors: "var"): HTMLElement; - querySelector(selectors: "video"): HTMLVideoElement; - querySelector(selectors: "view"): SVGViewElement; - querySelector(selectors: "wbr"): HTMLElement; - querySelector(selectors: "x-ms-webview"): MSHTMLWebViewElement; - querySelector(selectors: "xmp"): HTMLPreElement; - querySelector(selectors: string): Element; - querySelectorAll(selectors: "a"): NodeListOf; - querySelectorAll(selectors: "abbr"): NodeListOf; - querySelectorAll(selectors: "acronym"): NodeListOf; - querySelectorAll(selectors: "address"): NodeListOf; - querySelectorAll(selectors: "applet"): NodeListOf; - querySelectorAll(selectors: "area"): NodeListOf; - querySelectorAll(selectors: "article"): NodeListOf; - querySelectorAll(selectors: "aside"): NodeListOf; - querySelectorAll(selectors: "audio"): NodeListOf; - querySelectorAll(selectors: "b"): NodeListOf; - querySelectorAll(selectors: "base"): NodeListOf; - querySelectorAll(selectors: "basefont"): NodeListOf; - querySelectorAll(selectors: "bdo"): NodeListOf; - querySelectorAll(selectors: "big"): NodeListOf; - querySelectorAll(selectors: "blockquote"): NodeListOf; - querySelectorAll(selectors: "body"): NodeListOf; - querySelectorAll(selectors: "br"): NodeListOf; - querySelectorAll(selectors: "button"): NodeListOf; - querySelectorAll(selectors: "canvas"): NodeListOf; - querySelectorAll(selectors: "caption"): NodeListOf; - querySelectorAll(selectors: "center"): NodeListOf; - querySelectorAll(selectors: "circle"): NodeListOf; - querySelectorAll(selectors: "cite"): NodeListOf; - querySelectorAll(selectors: "clippath"): NodeListOf; - querySelectorAll(selectors: "code"): NodeListOf; - querySelectorAll(selectors: "col"): NodeListOf; - querySelectorAll(selectors: "colgroup"): NodeListOf; - querySelectorAll(selectors: "datalist"): NodeListOf; - querySelectorAll(selectors: "dd"): NodeListOf; - querySelectorAll(selectors: "defs"): NodeListOf; - querySelectorAll(selectors: "del"): NodeListOf; - querySelectorAll(selectors: "desc"): NodeListOf; - querySelectorAll(selectors: "dfn"): NodeListOf; - querySelectorAll(selectors: "dir"): NodeListOf; - querySelectorAll(selectors: "div"): NodeListOf; - querySelectorAll(selectors: "dl"): NodeListOf; - querySelectorAll(selectors: "dt"): NodeListOf; - querySelectorAll(selectors: "ellipse"): NodeListOf; - querySelectorAll(selectors: "em"): NodeListOf; - querySelectorAll(selectors: "embed"): NodeListOf; - querySelectorAll(selectors: "feblend"): NodeListOf; - querySelectorAll(selectors: "fecolormatrix"): NodeListOf; - querySelectorAll(selectors: "fecomponenttransfer"): NodeListOf; - querySelectorAll(selectors: "fecomposite"): NodeListOf; - querySelectorAll(selectors: "feconvolvematrix"): NodeListOf; - querySelectorAll(selectors: "fediffuselighting"): NodeListOf; - querySelectorAll(selectors: "fedisplacementmap"): NodeListOf; - querySelectorAll(selectors: "fedistantlight"): NodeListOf; - querySelectorAll(selectors: "feflood"): NodeListOf; - querySelectorAll(selectors: "fefunca"): NodeListOf; - querySelectorAll(selectors: "fefuncb"): NodeListOf; - querySelectorAll(selectors: "fefuncg"): NodeListOf; - querySelectorAll(selectors: "fefuncr"): NodeListOf; - querySelectorAll(selectors: "fegaussianblur"): NodeListOf; - querySelectorAll(selectors: "feimage"): NodeListOf; - querySelectorAll(selectors: "femerge"): NodeListOf; - querySelectorAll(selectors: "femergenode"): NodeListOf; - querySelectorAll(selectors: "femorphology"): NodeListOf; - querySelectorAll(selectors: "feoffset"): NodeListOf; - querySelectorAll(selectors: "fepointlight"): NodeListOf; - querySelectorAll(selectors: "fespecularlighting"): NodeListOf; - querySelectorAll(selectors: "fespotlight"): NodeListOf; - querySelectorAll(selectors: "fetile"): NodeListOf; - querySelectorAll(selectors: "feturbulence"): NodeListOf; - querySelectorAll(selectors: "fieldset"): NodeListOf; - querySelectorAll(selectors: "figcaption"): NodeListOf; - querySelectorAll(selectors: "figure"): NodeListOf; - querySelectorAll(selectors: "filter"): NodeListOf; - querySelectorAll(selectors: "font"): NodeListOf; - querySelectorAll(selectors: "footer"): NodeListOf; - querySelectorAll(selectors: "foreignobject"): NodeListOf; - querySelectorAll(selectors: "form"): NodeListOf; - querySelectorAll(selectors: "frame"): NodeListOf; - querySelectorAll(selectors: "frameset"): NodeListOf; - querySelectorAll(selectors: "g"): NodeListOf; - querySelectorAll(selectors: "h1"): NodeListOf; - querySelectorAll(selectors: "h2"): NodeListOf; - querySelectorAll(selectors: "h3"): NodeListOf; - querySelectorAll(selectors: "h4"): NodeListOf; - querySelectorAll(selectors: "h5"): NodeListOf; - querySelectorAll(selectors: "h6"): NodeListOf; - querySelectorAll(selectors: "head"): NodeListOf; - querySelectorAll(selectors: "header"): NodeListOf; - querySelectorAll(selectors: "hgroup"): NodeListOf; - querySelectorAll(selectors: "hr"): NodeListOf; - querySelectorAll(selectors: "html"): NodeListOf; - querySelectorAll(selectors: "i"): NodeListOf; - querySelectorAll(selectors: "iframe"): NodeListOf; - querySelectorAll(selectors: "image"): NodeListOf; - querySelectorAll(selectors: "img"): NodeListOf; - querySelectorAll(selectors: "input"): NodeListOf; - querySelectorAll(selectors: "ins"): NodeListOf; - querySelectorAll(selectors: "isindex"): NodeListOf; - querySelectorAll(selectors: "kbd"): NodeListOf; - querySelectorAll(selectors: "keygen"): NodeListOf; - querySelectorAll(selectors: "label"): NodeListOf; - querySelectorAll(selectors: "legend"): NodeListOf; - querySelectorAll(selectors: "li"): NodeListOf; - querySelectorAll(selectors: "line"): NodeListOf; - querySelectorAll(selectors: "lineargradient"): NodeListOf; - querySelectorAll(selectors: "link"): NodeListOf; - querySelectorAll(selectors: "listing"): NodeListOf; - querySelectorAll(selectors: "map"): NodeListOf; - querySelectorAll(selectors: "mark"): NodeListOf; - querySelectorAll(selectors: "marker"): NodeListOf; - querySelectorAll(selectors: "marquee"): NodeListOf; - querySelectorAll(selectors: "mask"): NodeListOf; - querySelectorAll(selectors: "menu"): NodeListOf; - querySelectorAll(selectors: "meta"): NodeListOf; - querySelectorAll(selectors: "metadata"): NodeListOf; - querySelectorAll(selectors: "meter"): NodeListOf; - querySelectorAll(selectors: "nav"): NodeListOf; - querySelectorAll(selectors: "nextid"): NodeListOf; - querySelectorAll(selectors: "nobr"): NodeListOf; - querySelectorAll(selectors: "noframes"): NodeListOf; - querySelectorAll(selectors: "noscript"): NodeListOf; - querySelectorAll(selectors: "object"): NodeListOf; - querySelectorAll(selectors: "ol"): NodeListOf; - querySelectorAll(selectors: "optgroup"): NodeListOf; - querySelectorAll(selectors: "option"): NodeListOf; - querySelectorAll(selectors: "p"): NodeListOf; - querySelectorAll(selectors: "param"): NodeListOf; - querySelectorAll(selectors: "path"): NodeListOf; - querySelectorAll(selectors: "pattern"): NodeListOf; - querySelectorAll(selectors: "picture"): NodeListOf; - querySelectorAll(selectors: "plaintext"): NodeListOf; - querySelectorAll(selectors: "polygon"): NodeListOf; - querySelectorAll(selectors: "polyline"): NodeListOf; - querySelectorAll(selectors: "pre"): NodeListOf; - querySelectorAll(selectors: "progress"): NodeListOf; - querySelectorAll(selectors: "q"): NodeListOf; - querySelectorAll(selectors: "radialgradient"): NodeListOf; - querySelectorAll(selectors: "rect"): NodeListOf; - querySelectorAll(selectors: "rt"): NodeListOf; - querySelectorAll(selectors: "ruby"): NodeListOf; - querySelectorAll(selectors: "s"): NodeListOf; - querySelectorAll(selectors: "samp"): NodeListOf; - querySelectorAll(selectors: "script"): NodeListOf; - querySelectorAll(selectors: "section"): NodeListOf; - querySelectorAll(selectors: "select"): NodeListOf; - querySelectorAll(selectors: "small"): NodeListOf; - querySelectorAll(selectors: "source"): NodeListOf; - querySelectorAll(selectors: "span"): NodeListOf; - querySelectorAll(selectors: "stop"): NodeListOf; - querySelectorAll(selectors: "strike"): NodeListOf; - querySelectorAll(selectors: "strong"): NodeListOf; - querySelectorAll(selectors: "style"): NodeListOf; - querySelectorAll(selectors: "sub"): NodeListOf; - querySelectorAll(selectors: "sup"): NodeListOf; - querySelectorAll(selectors: "svg"): NodeListOf; - querySelectorAll(selectors: "switch"): NodeListOf; - querySelectorAll(selectors: "symbol"): NodeListOf; - querySelectorAll(selectors: "table"): NodeListOf; - querySelectorAll(selectors: "tbody"): NodeListOf; - querySelectorAll(selectors: "td"): NodeListOf; - querySelectorAll(selectors: "template"): NodeListOf; - querySelectorAll(selectors: "text"): NodeListOf; - querySelectorAll(selectors: "textpath"): NodeListOf; - querySelectorAll(selectors: "textarea"): NodeListOf; - querySelectorAll(selectors: "tfoot"): NodeListOf; - querySelectorAll(selectors: "th"): NodeListOf; - querySelectorAll(selectors: "thead"): NodeListOf; - querySelectorAll(selectors: "title"): NodeListOf; - querySelectorAll(selectors: "tr"): NodeListOf; - querySelectorAll(selectors: "track"): NodeListOf; - querySelectorAll(selectors: "tspan"): NodeListOf; - querySelectorAll(selectors: "tt"): NodeListOf; - querySelectorAll(selectors: "u"): NodeListOf; - querySelectorAll(selectors: "ul"): NodeListOf; - querySelectorAll(selectors: "use"): NodeListOf; - querySelectorAll(selectors: "var"): NodeListOf; - querySelectorAll(selectors: "video"): NodeListOf; - querySelectorAll(selectors: "view"): NodeListOf; - querySelectorAll(selectors: "wbr"): NodeListOf; - querySelectorAll(selectors: "x-ms-webview"): NodeListOf; - querySelectorAll(selectors: "xmp"): NodeListOf; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - readonly pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - readonly animatedPoints: SVGPointList; - readonly points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - readonly externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - readonly height: SVGAnimatedLength; - readonly result: SVGAnimatedString; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - readonly farthestViewportElement: SVGElement; - readonly nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - readonly style: CSSStyleDeclaration; -} - -interface SVGTests { - readonly requiredExtensions: SVGStringList; - readonly requiredFeatures: SVGStringList; - readonly systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - readonly transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - readonly href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface WindowLocalStorage { - readonly localStorage: Storage; -} - -interface WindowSessionStorage { - readonly sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: this, ev: Event) => any; - onerror: (this: this, ev: ErrorEvent) => any; - onload: (this: this, ev: Event) => any; - onloadend: (this: this, ev: ProgressEvent) => any; - onloadstart: (this: this, ev: Event) => any; - onprogress: (this: this, ev: ProgressEvent) => any; - ontimeout: (this: this, ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface Canvas2DContextAttributes { - alpha?: boolean; - willReadFrequently?: boolean; - storage?: boolean; - [attribute: string]: boolean | string | undefined; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface HTMLCollectionOf extends HTMLCollection { - item(index: number): T; - namedItem(name: string): T; - [index: number]: T; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface ScrollOptions { - behavior?: ScrollBehavior; -} - -interface ScrollToOptions extends ScrollOptions { - left?: number; - top?: number; -} - -interface ScrollIntoViewOptions extends ScrollOptions { - block?: ScrollLogicalPosition; - inline?: ScrollLogicalPosition; -} - -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -interface ParentNode { - readonly children: HTMLCollection; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly childElementCount: number; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -interface NavigatorUserMediaSuccessCallback { - (stream: MediaStream): void; -} -interface NavigatorUserMediaErrorCallback { - (error: MediaStreamError): void; -} -interface ForEachCallback { - (keyId: any, status: string): void; -} -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msCredentials: MSCredentials; -declare const name: never; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (this: Window, ev: UIEvent) => any; -declare var onafterprint: (this: Window, ev: Event) => any; -declare var onbeforeprint: (this: Window, ev: Event) => any; -declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; -declare var onblur: (this: Window, ev: FocusEvent) => any; -declare var oncanplay: (this: Window, ev: Event) => any; -declare var oncanplaythrough: (this: Window, ev: Event) => any; -declare var onchange: (this: Window, ev: Event) => any; -declare var onclick: (this: Window, ev: MouseEvent) => any; -declare var oncompassneedscalibration: (this: Window, ev: Event) => any; -declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; -declare var ondblclick: (this: Window, ev: MouseEvent) => any; -declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; -declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; -declare var ondrag: (this: Window, ev: DragEvent) => any; -declare var ondragend: (this: Window, ev: DragEvent) => any; -declare var ondragenter: (this: Window, ev: DragEvent) => any; -declare var ondragleave: (this: Window, ev: DragEvent) => any; -declare var ondragover: (this: Window, ev: DragEvent) => any; -declare var ondragstart: (this: Window, ev: DragEvent) => any; -declare var ondrop: (this: Window, ev: DragEvent) => any; -declare var ondurationchange: (this: Window, ev: Event) => any; -declare var onemptied: (this: Window, ev: Event) => any; -declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (this: Window, ev: FocusEvent) => any; -declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; -declare var oninput: (this: Window, ev: Event) => any; -declare var oninvalid: (this: Window, ev: Event) => any; -declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; -declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; -declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; -declare var onload: (this: Window, ev: Event) => any; -declare var onloadeddata: (this: Window, ev: Event) => any; -declare var onloadedmetadata: (this: Window, ev: Event) => any; -declare var onloadstart: (this: Window, ev: Event) => any; -declare var onmessage: (this: Window, ev: MessageEvent) => any; -declare var onmousedown: (this: Window, ev: MouseEvent) => any; -declare var onmouseenter: (this: Window, ev: MouseEvent) => any; -declare var onmouseleave: (this: Window, ev: MouseEvent) => any; -declare var onmousemove: (this: Window, ev: MouseEvent) => any; -declare var onmouseout: (this: Window, ev: MouseEvent) => any; -declare var onmouseover: (this: Window, ev: MouseEvent) => any; -declare var onmouseup: (this: Window, ev: MouseEvent) => any; -declare var onmousewheel: (this: Window, ev: WheelEvent) => any; -declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; -declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; -declare var onoffline: (this: Window, ev: Event) => any; -declare var ononline: (this: Window, ev: Event) => any; -declare var onorientationchange: (this: Window, ev: Event) => any; -declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; -declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; -declare var onpause: (this: Window, ev: Event) => any; -declare var onplay: (this: Window, ev: Event) => any; -declare var onplaying: (this: Window, ev: Event) => any; -declare var onpopstate: (this: Window, ev: PopStateEvent) => any; -declare var onprogress: (this: Window, ev: ProgressEvent) => any; -declare var onratechange: (this: Window, ev: Event) => any; -declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; -declare var onreset: (this: Window, ev: Event) => any; -declare var onresize: (this: Window, ev: UIEvent) => any; -declare var onscroll: (this: Window, ev: UIEvent) => any; -declare var onseeked: (this: Window, ev: Event) => any; -declare var onseeking: (this: Window, ev: Event) => any; -declare var onselect: (this: Window, ev: UIEvent) => any; -declare var onstalled: (this: Window, ev: Event) => any; -declare var onstorage: (this: Window, ev: StorageEvent) => any; -declare var onsubmit: (this: Window, ev: Event) => any; -declare var onsuspend: (this: Window, ev: Event) => any; -declare var ontimeupdate: (this: Window, ev: Event) => any; -declare var ontouchcancel: (ev: TouchEvent) => any; -declare var ontouchend: (ev: TouchEvent) => any; -declare var ontouchmove: (ev: TouchEvent) => any; -declare var ontouchstart: (ev: TouchEvent) => any; -declare var onunload: (this: Window, ev: Event) => any; -declare var onvolumechange: (this: Window, ev: Event) => any; -declare var onwaiting: (this: Window, ev: Event) => any; -declare var opener: any; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string | null; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -declare function webkitCancelAnimationFrame(handle: number): void; -declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; -declare function scroll(options?: ScrollToOptions): void; -declare function scrollTo(options?: ScrollToOptions): void; -declare function scrollBy(options?: ScrollToOptions): void; -declare function toString(): string; -declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (this: Window, ev: PointerEvent) => any; -declare var onpointerdown: (this: Window, ev: PointerEvent) => any; -declare var onpointerenter: (this: Window, ev: PointerEvent) => any; -declare var onpointerleave: (this: Window, ev: PointerEvent) => any; -declare var onpointermove: (this: Window, ev: PointerEvent) => any; -declare var onpointerout: (this: Window, ev: PointerEvent) => any; -declare var onpointerover: (this: Window, ev: PointerEvent) => any; -declare var onpointerup: (this: Window, ev: PointerEvent) => any; -declare var onwheel: (this: Window, ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicelight", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "invalid", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AAGUID = string; -type AlgorithmIdentifier = string | Algorithm; -type ConstrainBoolean = boolean | ConstrainBooleanParameters; -type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; -type ConstrainDouble = number | ConstrainDoubleRange; -type ConstrainLong = number | ConstrainLongRange; -type CryptoOperationData = ArrayBufferView; -type GLbitfield = number; -type GLboolean = boolean; -type GLbyte = number; -type GLclampf = number; -type GLenum = number; -type GLfloat = number; -type GLint = number; -type GLintptr = number; -type GLshort = number; -type GLsizei = number; -type GLsizeiptr = number; -type GLubyte = number; -type GLuint = number; -type GLushort = number; -type IDBKeyPath = string; -type KeyFormat = string; -type KeyType = string; -type KeyUsage = string; -type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; -type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; -type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; -type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; -type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; -type payloadtype = number; -type ScrollBehavior = "auto" | "instant" | "smooth"; -type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; -type IDBValidKey = number | string | Date | IDBArrayKey; -type BufferSource = ArrayBuffer | ArrayBufferView; -type MouseWheelEvent = WheelEvent; -///////////////////////////// -/// WorkerGlobalScope APIs -///////////////////////////// -// These are only available in a Web Worker -declare function importScripts(...urls: string[]): void; - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; - -/** - * Automation date (VT_DATE) - */ -interface VarDate { } - -interface DateConstructor { - new (vd: VarDate): Date; -} - -interface Date { - getVarDate: () => VarDate; -} -/// - -interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} diff --git a/decl/node.d.ts b/decl/node.d.ts deleted file mode 100644 index 8df3d16a7..000000000 --- a/decl/node.d.ts +++ /dev/null @@ -1,2178 +0,0 @@ -// Type definitions for Node.js v4.x -// Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript , DefinitelyTyped -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/************************************************ -* * -* Node.js v4.x API * -* * -************************************************/ - -interface Error { - stack?: string; -} - - -// compat for TypeScript 1.5.3 -// if you use with --target es3 or --target es5 and use below definitions, -// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3. -interface MapConstructor {} -interface WeakMapConstructor {} -interface SetConstructor {} -interface WeakSetConstructor {} - -/************************************************ -* * -* GLOBAL * -* * -************************************************/ -declare var process: NodeJS.Process; -declare var global: NodeJS.Global; - -declare var __filename: string; -declare var __dirname: string; - -declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; -declare function clearTimeout(timeoutId: NodeJS.Timer): void; -declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; -declare function clearInterval(intervalId: NodeJS.Timer): void; -declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; -declare function clearImmediate(immediateId: any): void; - -interface NodeRequireFunction { - (id: string): any; -} - -interface NodeRequire extends NodeRequireFunction { - resolve(id:string): string; - cache: any; - extensions: any; - main: any; -} - -declare var require: NodeRequire; - -interface NodeModule { - exports: any; - require: NodeRequireFunction; - id: string; - filename: string; - loaded: boolean; - parent: any; - children: any[]; -} - -declare var module: NodeModule; - -// Same as module.exports -declare var exports: any; -declare var SlowBuffer: { - new (str: string, encoding?: string): Buffer; - new (size: number): Buffer; - new (size: Uint8Array): Buffer; - new (array: any[]): Buffer; - prototype: Buffer; - isBuffer(obj: any): boolean; - byteLength(string: string, encoding?: string): number; - concat(list: Buffer[], totalLength?: number): Buffer; -}; - - -// Buffer class -interface Buffer extends NodeBuffer {} - -/** - * Raw data is stored in instances of the Buffer class. - * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. - * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - */ -declare var Buffer: { - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - */ - new (str: string, encoding?: string): Buffer; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - */ - new (size: number): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - new (array: Uint8Array): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - new (array: any[]): Buffer; - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - */ - new (buffer: Buffer): Buffer; - prototype: Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - isEncoding(encoding: string): boolean; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - byteLength(string: string, encoding?: string): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - concat(list: Buffer[], totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - compare(buf1: Buffer, buf2: Buffer): number; -}; - -/************************************************ -* * -* GLOBAL INTERFACES * -* * -************************************************/ -declare module NodeJS { - export interface ErrnoException extends Error { - errno?: number; - code?: string; - path?: string; - syscall?: string; - stack?: string; - } - - export interface EventEmitter { - addListener(event: string, listener: Function): EventEmitter; - on(event: string, listener: Function): EventEmitter; - once(event: string, listener: Function): EventEmitter; - removeListener(event: string, listener: Function): EventEmitter; - removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): EventEmitter; - getMaxListeners(): number; - listeners(event: string): Function[]; - emit(event: string, ...args: any[]): boolean; - listenerCount(type: string): number; - } - - export interface ReadableStream extends EventEmitter { - readable: boolean; - read(size?: number): string|Buffer; - setEncoding(encoding: string): void; - pause(): void; - resume(): void; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: Buffer): void; - wrap(oldStream: ReadableStream): ReadableStream; - } - - export interface WritableStream extends EventEmitter { - writable: boolean; - write(buffer: Buffer|string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - } - - export interface ReadWriteStream extends ReadableStream, WritableStream {} - - export interface Process extends EventEmitter { - stdout: WritableStream; - stderr: WritableStream; - stdin: ReadableStream; - argv: string[]; - execPath: string; - abort(): void; - chdir(directory: string): void; - cwd(): string; - env: any; - exit(code?: number): void; - getgid(): number; - setgid(id: number): void; - setgid(id: string): void; - getuid(): number; - setuid(id: number): void; - setuid(id: string): void; - version: string; - versions: { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - openssl: string; - }; - config: { - target_defaults: { - cflags: any[]; - default_configuration: string; - defines: string[]; - include_dirs: string[]; - libraries: string[]; - }; - variables: { - clang: number; - host_arch: string; - node_install_npm: boolean; - node_install_waf: boolean; - node_prefix: string; - node_shared_openssl: boolean; - node_shared_v8: boolean; - node_shared_zlib: boolean; - node_use_dtrace: boolean; - node_use_etw: boolean; - node_use_openssl: boolean; - target_arch: string; - v8_no_strict_aliasing: number; - v8_use_snapshot: boolean; - visibility: string; - }; - }; - kill(pid:number, signal?: string|number): void; - pid: number; - title: string; - arch: string; - platform: string; - memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; - nextTick(callback: Function): void; - umask(mask?: number): number; - uptime(): number; - hrtime(time?:number[]): number[]; - - // Worker - send?(message: any, sendHandle?: any): void; - } - - export interface Global { - Array: typeof Array; - ArrayBuffer: typeof ArrayBuffer; - Boolean: typeof Boolean; - Buffer: typeof Buffer; - DataView: typeof DataView; - Date: typeof Date; - Error: typeof Error; - EvalError: typeof EvalError; - Float32Array: typeof Float32Array; - Float64Array: typeof Float64Array; - Function: typeof Function; - GLOBAL: Global; - Infinity: typeof Infinity; - Int16Array: typeof Int16Array; - Int32Array: typeof Int32Array; - Int8Array: typeof Int8Array; - Intl: typeof Intl; - JSON: typeof JSON; - Map: MapConstructor; - Math: typeof Math; - NaN: typeof NaN; - Number: typeof Number; - Object: typeof Object; - Promise: Function; - RangeError: typeof RangeError; - ReferenceError: typeof ReferenceError; - RegExp: typeof RegExp; - Set: SetConstructor; - String: typeof String; - Symbol: Function; - SyntaxError: typeof SyntaxError; - TypeError: typeof TypeError; - URIError: typeof URIError; - Uint16Array: typeof Uint16Array; - Uint32Array: typeof Uint32Array; - Uint8Array: typeof Uint8Array; - Uint8ClampedArray: Function; - WeakMap: WeakMapConstructor; - WeakSet: WeakSetConstructor; - clearImmediate: (immediateId: any) => void; - clearInterval: (intervalId: NodeJS.Timer) => void; - clearTimeout: (timeoutId: NodeJS.Timer) => void; - console: typeof console; - decodeURI: typeof decodeURI; - decodeURIComponent: typeof decodeURIComponent; - encodeURI: typeof encodeURI; - encodeURIComponent: typeof encodeURIComponent; - escape: (str: string) => string; - eval: typeof eval; - global: Global; - isFinite: typeof isFinite; - isNaN: typeof isNaN; - parseFloat: typeof parseFloat; - parseInt: typeof parseInt; - process: Process; - root: Global; - setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; - setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; - setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; - undefined: typeof undefined; - unescape: (str: string) => string; - gc: () => void; - v8debug?: any; - } - - export interface Timer { - ref() : void; - unref() : void; - } -} - -/** - * @deprecated - */ -interface NodeBuffer { - [index: number]: number; - write(string: string, offset?: number, length?: number, encoding?: string): number; - toString(encoding?: string, start?: number, end?: number): string; - toJSON(): any; - length: number; - equals(otherBuffer: Buffer): boolean; - compare(otherBuffer: Buffer): number; - copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - slice(start?: number, end?: number): Buffer; - writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readUInt8(offset: number, noAsset?: boolean): number; - readUInt16LE(offset: number, noAssert?: boolean): number; - readUInt16BE(offset: number, noAssert?: boolean): number; - readUInt32LE(offset: number, noAssert?: boolean): number; - readUInt32BE(offset: number, noAssert?: boolean): number; - readInt8(offset: number, noAssert?: boolean): number; - readInt16LE(offset: number, noAssert?: boolean): number; - readInt16BE(offset: number, noAssert?: boolean): number; - readInt32LE(offset: number, noAssert?: boolean): number; - readInt32BE(offset: number, noAssert?: boolean): number; - readFloatLE(offset: number, noAssert?: boolean): number; - readFloatBE(offset: number, noAssert?: boolean): number; - readDoubleLE(offset: number, noAssert?: boolean): number; - readDoubleBE(offset: number, noAssert?: boolean): number; - writeUInt8(value: number, offset: number, noAssert?: boolean): number; - writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeInt8(value: number, offset: number, noAssert?: boolean): number; - writeInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeFloatLE(value: number, offset: number, noAssert?: boolean): number; - writeFloatBE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; - fill(value: any, offset?: number, end?: number): Buffer; - indexOf(value: string | number | Buffer, byteOffset?: number): number; -} - -/************************************************ -* * -* MODULES * -* * -************************************************/ -declare module "buffer" { - export var INSPECT_MAX_BYTES: number; -} - -declare module "querystring" { - export interface StringifyOptions { - encodeURIComponent?: Function; - } - - export interface ParseOptions { - maxKeys?: number; - decodeURIComponent?: Function; - } - - export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; - export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any; - export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): T; - export function escape(str: string): string; - export function unescape(str: string): string; -} - -declare module "events" { - export class EventEmitter implements NodeJS.EventEmitter { - static EventEmitter: EventEmitter; - static listenerCount(emitter: EventEmitter, event: string): number; // deprecated - static defaultMaxListeners: number; - - addListener(event: string, listener: Function): EventEmitter; - on(event: string, listener: Function): EventEmitter; - once(event: string, listener: Function): EventEmitter; - removeListener(event: string, listener: Function): EventEmitter; - removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): EventEmitter; - getMaxListeners(): number; - listeners(event: string): Function[]; - emit(event: string, ...args: any[]): boolean; - listenerCount(type: string): number; - } -} - -declare module "http" { - import * as events from "events"; - import * as net from "net"; - import * as stream from "stream"; - - export interface RequestOptions { - protocol?: string; - host?: string; - hostname?: string; - family?: number; - port?: number; - localAddress?: string; - socketPath?: string; - method?: string; - path?: string; - headers?: { [key: string]: any }; - auth?: string; - agent?: Agent|boolean; - } - - export interface Server extends events.EventEmitter { - listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server; - listen(port: number, hostname?: string, callback?: Function): Server; - listen(path: string, callback?: Function): Server; - listen(handle: any, listeningListener?: Function): Server; - close(cb?: any): Server; - address(): { port: number; family: string; address: string; }; - maxHeadersCount: number; - } - /** - * @deprecated Use IncomingMessage - */ - export interface ServerRequest extends IncomingMessage { - connection: net.Socket; - } - export interface ServerResponse extends events.EventEmitter, stream.Writable { - // Extended base methods - write(buffer: Buffer): boolean; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - - writeContinue(): void; - writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; - writeHead(statusCode: number, headers?: any): void; - statusCode: number; - statusMessage: string; - headersSent: boolean; - setHeader(name: string, value: string): void; - sendDate: boolean; - getHeader(name: string): string; - removeHeader(name: string): void; - write(chunk: any, encoding?: string): any; - addTrailers(headers: any): void; - - // Extended base methods - end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; - } - export interface ClientRequest extends events.EventEmitter, stream.Writable { - // Extended base methods - write(buffer: Buffer): boolean; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - - write(chunk: any, encoding?: string): void; - abort(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - - // Extended base methods - end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; - } - export interface IncomingMessage extends events.EventEmitter, stream.Readable { - httpVersion: string; - headers: any; - rawHeaders: string[]; - trailers: any; - rawTrailers: any; - setTimeout(msecs: number, callback: Function): NodeJS.Timer; - /** - * Only valid for request obtained from http.Server. - */ - method?: string; - /** - * Only valid for request obtained from http.Server. - */ - url?: string; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusCode?: number; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusMessage?: string; - socket: net.Socket; - } - /** - * @deprecated Use IncomingMessage - */ - export interface ClientResponse extends IncomingMessage { } - - export interface AgentOptions { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number; - } - - export class Agent { - maxSockets: number; - sockets: any; - requests: any; - - constructor(opts?: AgentOptions); - - /** - * Destroy any sockets that are currently in use by the agent. - * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, - * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, - * sockets may hang open for quite a long time before the server terminates them. - */ - destroy(): void; - } - - export var METHODS: string[]; - - export var STATUS_CODES: { - [errorCode: number]: string; - [errorCode: string]: string; - }; - export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server; - export function createClient(port?: number, host?: string): any; - export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; - export var globalAgent: Agent; -} - -declare module "cluster" { - import * as child from "child_process"; - import * as events from "events"; - - export interface ClusterSettings { - exec?: string; - args?: string[]; - silent?: boolean; - } - - export class Worker extends events.EventEmitter { - id: string; - process: child.ChildProcess; - suicide: boolean; - send(message: any, sendHandle?: any): void; - kill(signal?: string): void; - destroy(signal?: string): void; - disconnect(): void; - } - - export var settings: ClusterSettings; - export var isMaster: boolean; - export var isWorker: boolean; - export function setupMaster(settings?: ClusterSettings): void; - export function fork(env?: any): Worker; - export function disconnect(callback?: Function): void; - export var worker: Worker; - export var workers: Worker[]; - - // Event emitter - export function addListener(event: string, listener: Function): void; - export function on(event: "disconnect", listener: (worker: Worker) => void): void; - export function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): void; - export function on(event: "fork", listener: (worker: Worker) => void): void; - export function on(event: "listening", listener: (worker: Worker, address: any) => void): void; - export function on(event: "message", listener: (worker: Worker, message: any) => void): void; - export function on(event: "online", listener: (worker: Worker) => void): void; - export function on(event: "setup", listener: (settings: any) => void): void; - export function on(event: string, listener: Function): any; - export function once(event: string, listener: Function): void; - export function removeListener(event: string, listener: Function): void; - export function removeAllListeners(event?: string): void; - export function setMaxListeners(n: number): void; - export function listeners(event: string): Function[]; - export function emit(event: string, ...args: any[]): boolean; -} - -declare module "zlib" { - import * as stream from "stream"; - export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; } - - export interface Gzip extends stream.Transform { } - export interface Gunzip extends stream.Transform { } - export interface Deflate extends stream.Transform { } - export interface Inflate extends stream.Transform { } - export interface DeflateRaw extends stream.Transform { } - export interface InflateRaw extends stream.Transform { } - export interface Unzip extends stream.Transform { } - - export function createGzip(options?: ZlibOptions): Gzip; - export function createGunzip(options?: ZlibOptions): Gunzip; - export function createDeflate(options?: ZlibOptions): Deflate; - export function createInflate(options?: ZlibOptions): Inflate; - export function createDeflateRaw(options?: ZlibOptions): DeflateRaw; - export function createInflateRaw(options?: ZlibOptions): InflateRaw; - export function createUnzip(options?: ZlibOptions): Unzip; - - export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; - export function deflateSync(buf: Buffer, options?: ZlibOptions): any; - export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; - export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any; - export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; - export function gzipSync(buf: Buffer, options?: ZlibOptions): any; - export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; - export function gunzipSync(buf: Buffer, options?: ZlibOptions): any; - export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; - export function inflateSync(buf: Buffer, options?: ZlibOptions): any; - export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; - export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any; - export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; - export function unzipSync(buf: Buffer, options?: ZlibOptions): any; - - // Constants - export var Z_NO_FLUSH: number; - export var Z_PARTIAL_FLUSH: number; - export var Z_SYNC_FLUSH: number; - export var Z_FULL_FLUSH: number; - export var Z_FINISH: number; - export var Z_BLOCK: number; - export var Z_TREES: number; - export var Z_OK: number; - export var Z_STREAM_END: number; - export var Z_NEED_DICT: number; - export var Z_ERRNO: number; - export var Z_STREAM_ERROR: number; - export var Z_DATA_ERROR: number; - export var Z_MEM_ERROR: number; - export var Z_BUF_ERROR: number; - export var Z_VERSION_ERROR: number; - export var Z_NO_COMPRESSION: number; - export var Z_BEST_SPEED: number; - export var Z_BEST_COMPRESSION: number; - export var Z_DEFAULT_COMPRESSION: number; - export var Z_FILTERED: number; - export var Z_HUFFMAN_ONLY: number; - export var Z_RLE: number; - export var Z_FIXED: number; - export var Z_DEFAULT_STRATEGY: number; - export var Z_BINARY: number; - export var Z_TEXT: number; - export var Z_ASCII: number; - export var Z_UNKNOWN: number; - export var Z_DEFLATED: number; - export var Z_NULL: number; -} - -declare module "os" { - export interface CpuInfo { - model: string; - speed: number; - times: { - user: number; - nice: number; - sys: number; - idle: number; - irq: number; - }; - } - - export interface NetworkInterfaceInfo { - address: string; - netmask: string; - family: string; - mac: string; - internal: boolean; - } - - export function tmpdir(): string; - export function homedir(): string; - export function endianness(): string; - export function hostname(): string; - export function type(): string; - export function platform(): string; - export function arch(): string; - export function release(): string; - export function uptime(): number; - export function loadavg(): number[]; - export function totalmem(): number; - export function freemem(): number; - export function cpus(): CpuInfo[]; - export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]}; - export var EOL: string; -} - -declare module "https" { - import * as tls from "tls"; - import * as events from "events"; - import * as http from "http"; - - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string) => any; - } - - export interface RequestOptions extends http.RequestOptions{ - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - } - - export interface Agent { - maxSockets: number; - sockets: any; - requests: any; - } - export var Agent: { - new (options?: RequestOptions): Agent; - }; - export interface Server extends tls.Server { } - export function createServer(options: ServerOptions, requestListener?: Function): Server; - export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; - export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; - export var globalAgent: Agent; -} - -declare module "punycode" { - export function decode(string: string): string; - export function encode(string: string): string; - export function toUnicode(domain: string): string; - export function toASCII(domain: string): string; - export var ucs2: ucs2; - interface ucs2 { - decode(string: string): number[]; - encode(codePoints: number[]): string; - } - export var version: any; -} - -declare module "repl" { - import * as stream from "stream"; - import * as events from "events"; - - export interface ReplOptions { - prompt?: string; - input?: NodeJS.ReadableStream; - output?: NodeJS.WritableStream; - terminal?: boolean; - eval?: Function; - useColors?: boolean; - useGlobal?: boolean; - ignoreUndefined?: boolean; - writer?: Function; - } - export function start(options: ReplOptions): events.EventEmitter; -} - -declare module "readline" { - import * as events from "events"; - import * as stream from "stream"; - - export interface Key { - sequence?: string; - name?: string; - ctrl?: boolean; - meta?: boolean; - shift?: boolean; - } - - export interface ReadLine extends events.EventEmitter { - setPrompt(prompt: string): void; - prompt(preserveCursor?: boolean): void; - question(query: string, callback: (answer: string) => void): void; - pause(): ReadLine; - resume(): ReadLine; - close(): void; - write(data: string|Buffer, key?: Key): void; - } - - export interface Completer { - (line: string): CompleterResult; - (line: string, callback: (err: any, result: CompleterResult) => void): any; - } - - export interface CompleterResult { - completions: string[]; - line: string; - } - - export interface ReadLineOptions { - input: NodeJS.ReadableStream; - output?: NodeJS.WritableStream; - completer?: Completer; - terminal?: boolean; - historySize?: number; - } - - export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine; - export function createInterface(options: ReadLineOptions): ReadLine; - - export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void; - export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void; - export function clearLine(stream: NodeJS.WritableStream, dir: number): void; - export function clearScreenDown(stream: NodeJS.WritableStream): void; -} - -declare module "vm" { - export interface Context { } - export interface Script { - runInThisContext(): void; - runInNewContext(sandbox?: Context): void; - } - export function runInThisContext(code: string, filename?: string): void; - export function runInNewContext(code: string, sandbox?: Context, filename?: string): void; - export function runInContext(code: string, context: Context, filename?: string): void; - export function createContext(initSandbox?: Context): Context; - export function createScript(code: string, filename?: string): Script; -} - -declare module "child_process" { - import * as events from "events"; - import * as stream from "stream"; - - export interface ChildProcess extends events.EventEmitter { - stdin: stream.Writable; - stdout: stream.Readable; - stderr: stream.Readable; - pid: number; - kill(signal?: string): void; - send(message: any, sendHandle?: any): void; - disconnect(): void; - unref(): void; - } - - export function spawn(command: string, args?: string[], options?: { - cwd?: string; - stdio?: any; - custom?: any; - env?: any; - detached?: boolean; - }): ChildProcess; - export function exec(command: string, options: { - cwd?: string; - stdio?: any; - customFds?: any; - env?: any; - encoding?: string; - timeout?: number; - maxBuffer?: number; - killSignal?: string; - }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; - export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; - export function execFile(file: string, - callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; - export function execFile(file: string, args?: string[], - callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; - export function execFile(file: string, args?: string[], options?: { - cwd?: string; - stdio?: any; - customFds?: any; - env?: any; - encoding?: string; - timeout?: number; - maxBuffer?: number; - killSignal?: string; - }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; - export function fork(modulePath: string, args?: string[], options?: { - cwd?: string; - env?: any; - execPath?: string; - execArgv?: string[]; - silent?: boolean; - uid?: number; - gid?: number; - }): ChildProcess; - export function spawnSync(command: string, args?: string[], options?: { - cwd?: string; - input?: string | Buffer; - stdio?: any; - env?: any; - uid?: number; - gid?: number; - timeout?: number; - maxBuffer?: number; - killSignal?: string; - encoding?: string; - }): { - pid: number; - output: string[]; - stdout: string | Buffer; - stderr: string | Buffer; - status: number; - signal: string; - error: Error; - }; - export function execSync(command: string, options?: { - cwd?: string; - input?: string|Buffer; - stdio?: any; - env?: any; - uid?: number; - gid?: number; - timeout?: number; - maxBuffer?: number; - killSignal?: string; - encoding?: string; - }): string | Buffer; - export function execFileSync(command: string, args?: string[], options?: { - cwd?: string; - input?: string|Buffer; - stdio?: any; - env?: any; - uid?: number; - gid?: number; - timeout?: number; - maxBuffer?: number; - killSignal?: string; - encoding?: string; - }): string | Buffer; -} - -declare module "url" { - export interface Url { - href?: string; - protocol?: string; - auth?: string; - hostname?: string; - port?: string; - host?: string; - pathname?: string; - search?: string; - query?: any; // string | Object - slashes?: boolean; - hash?: string; - path?: string; - } - - export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url; - export function format(url: Url): string; - export function resolve(from: string, to: string): string; -} - -declare module "dns" { - export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string; - export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string; - export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[]; -} - -declare module "net" { - import * as stream from "stream"; - - export interface Socket extends stream.Duplex { - // Extended base methods - write(buffer: Buffer): boolean; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - - connect(port: number, host?: string, connectionListener?: Function): void; - connect(path: string, connectionListener?: Function): void; - bufferSize: number; - setEncoding(encoding?: string): void; - write(data: any, encoding?: string, callback?: Function): void; - destroy(): void; - pause(): void; - resume(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; - address(): { port: number; family: string; address: string; }; - unref(): void; - ref(): void; - - remoteAddress: string; - remoteFamily: string; - remotePort: number; - localAddress: string; - localPort: number; - bytesRead: number; - bytesWritten: number; - - // Extended base methods - end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; - } - - export var Socket: { - new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): Socket; - }; - - export interface Server extends Socket { - listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; - listen(path: string, listeningListener?: Function): Server; - listen(handle: any, listeningListener?: Function): Server; - close(callback?: Function): Server; - address(): { port: number; family: string; address: string; }; - maxConnections: number; - connections: number; - } - export function createServer(connectionListener?: (socket: Socket) =>void ): Server; - export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server; - export function connect(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; - export function connect(port: number, host?: string, connectionListener?: Function): Socket; - export function connect(path: string, connectionListener?: Function): Socket; - export function createConnection(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; - export function createConnection(port: number, host?: string, connectionListener?: Function): Socket; - export function createConnection(path: string, connectionListener?: Function): Socket; - export function isIP(input: string): number; - export function isIPv4(input: string): boolean; - export function isIPv6(input: string): boolean; -} - -declare module "dgram" { - import * as events from "events"; - - interface RemoteInfo { - address: string; - port: number; - size: number; - } - - interface AddressInfo { - address: string; - family: string; - port: number; - } - - export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - - interface Socket extends events.EventEmitter { - send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; - bind(port: number, address?: string, callback?: () => void): void; - close(): void; - address(): AddressInfo; - setBroadcast(flag: boolean): void; - setMulticastTTL(ttl: number): void; - setMulticastLoopback(flag: boolean): void; - addMembership(multicastAddress: string, multicastInterface?: string): void; - dropMembership(multicastAddress: string, multicastInterface?: string): void; - } -} - -declare module "fs" { - import * as stream from "stream"; - import * as events from "events"; - - interface Stats { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - dev: number; - ino: number; - mode: number; - nlink: number; - uid: number; - gid: number; - rdev: number; - size: number; - blksize: number; - blocks: number; - atime: Date; - mtime: Date; - ctime: Date; - birthtime: Date; - } - - interface FSWatcher extends events.EventEmitter { - close(): void; - } - - export interface ReadStream extends stream.Readable { - close(): void; - } - export interface WriteStream extends stream.Writable { - close(): void; - bytesWritten: number; - } - - /** - * Asynchronous rename. - * @param oldPath - * @param newPath - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - /** - * Synchronous rename - * @param oldPath - * @param newPath - */ - export function renameSync(oldPath: string, newPath: string): void; - export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function truncateSync(path: string, len?: number): void; - export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function ftruncateSync(fd: number, len?: number): void; - export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function chownSync(path: string, uid: number, gid: number): void; - export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function fchownSync(fd: number, uid: number, gid: number): void; - export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function lchownSync(path: string, uid: number, gid: number): void; - export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function chmodSync(path: string, mode: number): void; - export function chmodSync(path: string, mode: string): void; - export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function fchmodSync(fd: number, mode: number): void; - export function fchmodSync(fd: number, mode: string): void; - export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function lchmodSync(path: string, mode: number): void; - export function lchmodSync(path: string, mode: string): void; - export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; - export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; - export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; - export function statSync(path: string): Stats; - export function lstatSync(path: string): Stats; - export function fstatSync(fd: number): Stats; - export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function linkSync(srcpath: string, dstpath: string): void; - export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; - export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; - export function readlinkSync(path: string): string; - export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; - export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void; - export function realpathSync(path: string, cache?: { [path: string]: string }): string; - /* - * Asynchronous unlink - deletes the file specified in {path} - * - * @param path - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - /* - * Synchronous unlink - deletes the file specified in {path} - * - * @param path - */ - export function unlinkSync(path: string): void; - /* - * Asynchronous rmdir - removes the directory specified in {path} - * - * @param path - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - /* - * Synchronous rmdir - removes the directory specified in {path} - * - * @param path - */ - export function rmdirSync(path: string): void; - /* - * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. - * - * @param path - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - /* - * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. - * - * @param path - * @param mode - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - /* - * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. - * - * @param path - * @param mode - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; - /* - * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. - * - * @param path - * @param mode - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function mkdirSync(path: string, mode?: number): void; - /* - * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. - * - * @param path - * @param mode - * @param callback No arguments other than a possible exception are given to the completion callback. - */ - export function mkdirSync(path: string, mode?: string): void; - export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; - export function readdirSync(path: string): string[]; - export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function closeSync(fd: number): void; - export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; - export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; - export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; - export function openSync(path: string, flags: string, mode?: number): number; - export function openSync(path: string, flags: string, mode?: string): number; - export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function utimesSync(path: string, atime: number, mtime: number): void; - export function utimesSync(path: string, atime: Date, mtime: Date): void; - export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function futimesSync(fd: number, atime: number, mtime: number): void; - export function futimesSync(fd: number, atime: Date, mtime: Date): void; - export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; - export function fsyncSync(fd: number): void; - export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; - export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; - export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; - export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; - export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; - export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; - export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; - export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; - /* - * Asynchronous readFile - Asynchronously reads the entire contents of a file. - * - * @param fileName - * @param encoding - * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. - */ - export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; - /* - * Asynchronous readFile - Asynchronously reads the entire contents of a file. - * - * @param fileName - * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. - * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. - */ - export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; - /* - * Asynchronous readFile - Asynchronously reads the entire contents of a file. - * - * @param fileName - * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. - * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. - */ - export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; - /* - * Asynchronous readFile - Asynchronously reads the entire contents of a file. - * - * @param fileName - * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. - */ - export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; - /* - * Synchronous readFile - Synchronously reads the entire contents of a file. - * - * @param fileName - * @param encoding - */ - export function readFileSync(filename: string, encoding: string): string; - /* - * Synchronous readFile - Synchronously reads the entire contents of a file. - * - * @param fileName - * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. - */ - export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; - /* - * Synchronous readFile - Synchronously reads the entire contents of a file. - * - * @param fileName - * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. - */ - export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; - export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; - export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; - export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; - export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; - export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; - export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; - export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; - export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; - export function exists(path: string, callback?: (exists: boolean) => void): void; - export function existsSync(path: string): boolean; - /** Constant for fs.access(). File is visible to the calling process. */ - export var F_OK: number; - /** Constant for fs.access(). File can be read by the calling process. */ - export var R_OK: number; - /** Constant for fs.access(). File can be written by the calling process. */ - export var W_OK: number; - /** Constant for fs.access(). File can be executed by the calling process. */ - export var X_OK: number; - /** Tests a user's permissions for the file specified by path. */ - export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void; - export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; - /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ - export function accessSync(path: string, mode ?: number): void; - export function createReadStream(path: string, options?: { - flags?: string; - encoding?: string; - fd?: number; - mode?: number; - autoClose?: boolean; - }): ReadStream; - export function createWriteStream(path: string, options?: { - flags?: string; - encoding?: string; - fd?: number; - mode?: number; - }): WriteStream; -} - -declare module "path" { - - /** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ - export interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; - } - - /** - * Normalize a string path, reducing '..' and '.' parts. - * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. - * - * @param p string path to normalize. - */ - export function normalize(p: string): string; - /** - * Join all arguments together and normalize the resulting path. - * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. - * - * @param paths string paths to join. - */ - export function join(...paths: any[]): string; - /** - * Join all arguments together and normalize the resulting path. - * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. - * - * @param paths string paths to join. - */ - export function join(...paths: string[]): string; - /** - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. - * - * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. - * - * @param pathSegments string paths to join. Non-string arguments are ignored. - */ - export function resolve(...pathSegments: any[]): string; - /** - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - * - * @param path path to test. - */ - export function isAbsolute(path: string): boolean; - /** - * Solve the relative path from {from} to {to}. - * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. - * - * @param from - * @param to - */ - export function relative(from: string, to: string): string; - /** - * Return the directory name of a path. Similar to the Unix dirname command. - * - * @param p the path to evaluate. - */ - export function dirname(p: string): string; - /** - * Return the last portion of a path. Similar to the Unix basename command. - * Often used to extract the file name from a fully qualified path. - * - * @param p the path to evaluate. - * @param ext optionally, an extension to remove from the result. - */ - export function basename(p: string, ext?: string): string; - /** - * Return the extension of the path, from the last '.' to end of string in the last portion of the path. - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string - * - * @param p the path to evaluate. - */ - export function extname(p: string): string; - /** - * The platform-specific file separator. '\\' or '/'. - */ - export var sep: string; - /** - * The platform-specific file delimiter. ';' or ':'. - */ - export var delimiter: string; - /** - * Returns an object from a path string - the opposite of format(). - * - * @param pathString path to evaluate. - */ - export function parse(pathString: string): ParsedPath; - /** - * Returns a path string from an object - the opposite of parse(). - * - * @param pathString path to evaluate. - */ - export function format(pathObject: ParsedPath): string; - - export module posix { - export function normalize(p: string): string; - export function join(...paths: any[]): string; - export function resolve(...pathSegments: any[]): string; - export function isAbsolute(p: string): boolean; - export function relative(from: string, to: string): string; - export function dirname(p: string): string; - export function basename(p: string, ext?: string): string; - export function extname(p: string): string; - export var sep: string; - export var delimiter: string; - export function parse(p: string): ParsedPath; - export function format(pP: ParsedPath): string; - } - - export module win32 { - export function normalize(p: string): string; - export function join(...paths: any[]): string; - export function resolve(...pathSegments: any[]): string; - export function isAbsolute(p: string): boolean; - export function relative(from: string, to: string): string; - export function dirname(p: string): string; - export function basename(p: string, ext?: string): string; - export function extname(p: string): string; - export var sep: string; - export var delimiter: string; - export function parse(p: string): ParsedPath; - export function format(pP: ParsedPath): string; - } -} - -declare module "string_decoder" { - export interface NodeStringDecoder { - write(buffer: Buffer): string; - detectIncompleteChar(buffer: Buffer): number; - } - export var StringDecoder: { - new (encoding: string): NodeStringDecoder; - }; -} - -declare module "tls" { - import * as crypto from "crypto"; - import * as net from "net"; - import * as stream from "stream"; - - var CLIENT_RENEG_LIMIT: number; - var CLIENT_RENEG_WINDOW: number; - - export interface TlsOptions { - host?: string; - port?: number; - pfx?: any; //string or buffer - key?: any; //string or buffer - passphrase?: string; - cert?: any; - ca?: any; //string or buffer - crl?: any; //string or string array - ciphers?: string; - honorCipherOrder?: any; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; //array or Buffer; - SNICallback?: (servername: string) => any; - } - - export interface ConnectionOptions { - host?: string; - port?: number; - socket?: net.Socket; - pfx?: any; //string | Buffer - key?: any; //string | Buffer - passphrase?: string; - cert?: any; //string | Buffer - ca?: any; //Array of string | Buffer - rejectUnauthorized?: boolean; - NPNProtocols?: any; //Array of string | Buffer - servername?: string; - } - - export interface Server extends net.Server { - // Extended base methods - listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; - listen(path: string, listeningListener?: Function): Server; - listen(handle: any, listeningListener?: Function): Server; - - listen(port: number, host?: string, callback?: Function): Server; - close(): Server; - address(): { port: number; family: string; address: string; }; - addContext(hostName: string, credentials: { - key: string; - cert: string; - ca: string; - }): void; - maxConnections: number; - connections: number; - } - - export interface ClearTextStream extends stream.Duplex { - authorized: boolean; - authorizationError: Error; - getPeerCertificate(): any; - getCipher: { - name: string; - version: string; - }; - address: { - port: number; - family: string; - address: string; - }; - remoteAddress: string; - remotePort: number; - } - - export interface SecurePair { - encrypted: any; - cleartext: any; - } - - export interface SecureContextOptions { - pfx?: any; //string | buffer - key?: any; //string | buffer - passphrase?: string; - cert?: any; // string | buffer - ca?: any; // string | buffer - crl?: any; // string | string[] - ciphers?: string; - honorCipherOrder?: boolean; - } - - export interface SecureContext { - context: any; - } - - export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server; - export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream; - export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; - export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; - export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; - export function createSecureContext(details: SecureContextOptions): SecureContext; -} - -declare module "crypto" { - export interface CredentialDetails { - pfx: string; - key: string; - passphrase: string; - cert: string; - ca: any; //string | string array - crl: any; //string | string array - ciphers: string; - } - export interface Credentials { context?: any; } - export function createCredentials(details: CredentialDetails): Credentials; - export function createHash(algorithm: string): Hash; - export function createHmac(algorithm: string, key: string): Hmac; - export function createHmac(algorithm: string, key: Buffer): Hmac; - export interface Hash { - update(data: any, input_encoding?: string): Hash; - digest(encoding: 'buffer'): Buffer; - digest(encoding: string): any; - digest(): Buffer; - } - export interface Hmac extends NodeJS.ReadWriteStream { - update(data: any, input_encoding?: string): Hmac; - digest(encoding: 'buffer'): Buffer; - digest(encoding: string): any; - digest(): Buffer; - } - export function createCipher(algorithm: string, password: any): Cipher; - export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; - export interface Cipher { - update(data: Buffer): Buffer; - update(data: string, input_encoding?: string, output_encoding?: string): string; - final(): Buffer; - final(output_encoding: string): string; - setAutoPadding(auto_padding: boolean): void; - } - export function createDecipher(algorithm: string, password: any): Decipher; - export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; - export interface Decipher { - update(data: Buffer): Buffer; - update(data: string, input_encoding?: string, output_encoding?: string): string; - final(): Buffer; - final(output_encoding: string): string; - setAutoPadding(auto_padding: boolean): void; - } - export function createSign(algorithm: string): Signer; - export interface Signer extends NodeJS.WritableStream { - update(data: any): void; - sign(private_key: string, output_format: string): string; - } - export function createVerify(algorith: string): Verify; - export interface Verify extends NodeJS.WritableStream { - update(data: any): void; - verify(object: string, signature: string, signature_format?: string): boolean; - } - export function createDiffieHellman(prime_length: number): DiffieHellman; - export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; - export interface DiffieHellman { - generateKeys(encoding?: string): string; - computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; - getPrime(encoding?: string): string; - getGenerator(encoding: string): string; - getPublicKey(encoding?: string): string; - getPrivateKey(encoding?: string): string; - setPublicKey(public_key: string, encoding?: string): void; - setPrivateKey(public_key: string, encoding?: string): void; - } - export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; - export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer; - export function randomBytes(size: number): Buffer; - export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; - export function pseudoRandomBytes(size: number): Buffer; - export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; -} - -declare module "stream" { - import * as events from "events"; - - export class Stream extends events.EventEmitter { - pipe(destination: T, options?: { end?: boolean; }): T; - } - - export interface ReadableOptions { - highWaterMark?: number; - encoding?: string; - objectMode?: boolean; - } - - export class Readable extends events.EventEmitter implements NodeJS.ReadableStream { - readable: boolean; - constructor(opts?: ReadableOptions); - _read(size: number): void; - read(size?: number): any; - setEncoding(encoding: string): void; - pause(): void; - resume(): void; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: T): void; - unshift(chunk: any): void; - wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; - push(chunk: any, encoding?: string): boolean; - } - - export interface WritableOptions { - highWaterMark?: number; - decodeStrings?: boolean; - objectMode?: boolean; - } - - export class Writable extends events.EventEmitter implements NodeJS.WritableStream { - writable: boolean; - constructor(opts?: WritableOptions); - _write(chunk: any, encoding: string, callback: Function): void; - write(chunk: any, cb?: Function): boolean; - write(chunk: any, encoding?: string, cb?: Function): boolean; - end(): void; - end(chunk: any, cb?: Function): void; - end(chunk: any, encoding?: string, cb?: Function): void; - } - - export interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean; - } - - // Note: Duplex extends both Readable and Writable. - export class Duplex extends Readable implements NodeJS.ReadWriteStream { - writable: boolean; - constructor(opts?: DuplexOptions); - _write(chunk: any, encoding: string, callback: Function): void; - write(chunk: any, cb?: Function): boolean; - write(chunk: any, encoding?: string, cb?: Function): boolean; - end(): void; - end(chunk: any, cb?: Function): void; - end(chunk: any, encoding?: string, cb?: Function): void; - } - - export interface TransformOptions extends ReadableOptions, WritableOptions {} - - // Note: Transform lacks the _read and _write methods of Readable/Writable. - export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream { - readable: boolean; - writable: boolean; - constructor(opts?: TransformOptions); - _transform(chunk: any, encoding: string, callback: Function): void; - _flush(callback: Function): void; - read(size?: number): any; - setEncoding(encoding: string): void; - pause(): void; - resume(): void; - pipe(destination: T, options?: { end?: boolean; }): T; - unpipe(destination?: T): void; - unshift(chunk: any): void; - wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; - push(chunk: any, encoding?: string): boolean; - write(chunk: any, cb?: Function): boolean; - write(chunk: any, encoding?: string, cb?: Function): boolean; - end(): void; - end(chunk: any, cb?: Function): void; - end(chunk: any, encoding?: string, cb?: Function): void; - } - - export class PassThrough extends Transform {} -} - -declare module "util" { - export interface InspectOptions { - showHidden?: boolean; - depth?: number; - colors?: boolean; - customInspect?: boolean; - } - - export function format(format: any, ...param: any[]): string; - export function debug(string: string): void; - export function error(...param: any[]): void; - export function puts(...param: any[]): void; - export function print(...param: any[]): void; - export function log(string: string): void; - export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string; - export function inspect(object: any, options: InspectOptions): string; - export function isArray(object: any): boolean; - export function isRegExp(object: any): boolean; - export function isDate(object: any): boolean; - export function isError(object: any): boolean; - export function inherits(constructor: any, superConstructor: any): void; - export function debuglog(key:string): (msg:string,...param: any[])=>void; -} - -declare module "assert" { - function internal (value: any, message?: string): void; - module internal { - export class AssertionError implements Error { - name: string; - message: string; - actual: any; - expected: any; - operator: string; - generatedMessage: boolean; - - constructor(options?: {message?: string; actual?: any; expected?: any; - operator?: string; stackStartFunction?: Function}); - } - - export function fail(actual?: any, expected?: any, message?: string, operator?: string): void; - export function ok(value: any, message?: string): void; - export function equal(actual: any, expected: any, message?: string): void; - export function notEqual(actual: any, expected: any, message?: string): void; - export function deepEqual(actual: any, expected: any, message?: string): void; - export function notDeepEqual(acutal: any, expected: any, message?: string): void; - export function strictEqual(actual: any, expected: any, message?: string): void; - export function notStrictEqual(actual: any, expected: any, message?: string): void; - export function deepStrictEqual(actual: any, expected: any, message?: string): void; - export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; - export var throws: { - (block: Function, message?: string): void; - (block: Function, error: Function, message?: string): void; - (block: Function, error: RegExp, message?: string): void; - (block: Function, error: (err: any) => boolean, message?: string): void; - }; - - export var doesNotThrow: { - (block: Function, message?: string): void; - (block: Function, error: Function, message?: string): void; - (block: Function, error: RegExp, message?: string): void; - (block: Function, error: (err: any) => boolean, message?: string): void; - }; - - export function ifError(value: any): void; - } - - export = internal; -} - -declare module "tty" { - import * as net from "net"; - - export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { - isRaw: boolean; - setRawMode(mode: boolean): void; - isTTY: boolean; - } - export interface WriteStream extends net.Socket { - columns: number; - rows: number; - isTTY: boolean; - } -} - -declare module "domain" { - import * as events from "events"; - - export class Domain extends events.EventEmitter { - run(fn: Function): void; - add(emitter: events.EventEmitter): void; - remove(emitter: events.EventEmitter): void; - bind(cb: (err: Error, data: any) => any): any; - intercept(cb: (data: any) => any): any; - dispose(): void; - - addListener(event: string, listener: Function): Domain; - on(event: string, listener: Function): Domain; - once(event: string, listener: Function): Domain; - removeListener(event: string, listener: Function): Domain; - removeAllListeners(event?: string): Domain; - } - - export function create(): Domain; -} - -declare module "constants" { - export var E2BIG: number; - export var EACCES: number; - export var EADDRINUSE: number; - export var EADDRNOTAVAIL: number; - export var EAFNOSUPPORT: number; - export var EAGAIN: number; - export var EALREADY: number; - export var EBADF: number; - export var EBADMSG: number; - export var EBUSY: number; - export var ECANCELED: number; - export var ECHILD: number; - export var ECONNABORTED: number; - export var ECONNREFUSED: number; - export var ECONNRESET: number; - export var EDEADLK: number; - export var EDESTADDRREQ: number; - export var EDOM: number; - export var EEXIST: number; - export var EFAULT: number; - export var EFBIG: number; - export var EHOSTUNREACH: number; - export var EIDRM: number; - export var EILSEQ: number; - export var EINPROGRESS: number; - export var EINTR: number; - export var EINVAL: number; - export var EIO: number; - export var EISCONN: number; - export var EISDIR: number; - export var ELOOP: number; - export var EMFILE: number; - export var EMLINK: number; - export var EMSGSIZE: number; - export var ENAMETOOLONG: number; - export var ENETDOWN: number; - export var ENETRESET: number; - export var ENETUNREACH: number; - export var ENFILE: number; - export var ENOBUFS: number; - export var ENODATA: number; - export var ENODEV: number; - export var ENOENT: number; - export var ENOEXEC: number; - export var ENOLCK: number; - export var ENOLINK: number; - export var ENOMEM: number; - export var ENOMSG: number; - export var ENOPROTOOPT: number; - export var ENOSPC: number; - export var ENOSR: number; - export var ENOSTR: number; - export var ENOSYS: number; - export var ENOTCONN: number; - export var ENOTDIR: number; - export var ENOTEMPTY: number; - export var ENOTSOCK: number; - export var ENOTSUP: number; - export var ENOTTY: number; - export var ENXIO: number; - export var EOPNOTSUPP: number; - export var EOVERFLOW: number; - export var EPERM: number; - export var EPIPE: number; - export var EPROTO: number; - export var EPROTONOSUPPORT: number; - export var EPROTOTYPE: number; - export var ERANGE: number; - export var EROFS: number; - export var ESPIPE: number; - export var ESRCH: number; - export var ETIME: number; - export var ETIMEDOUT: number; - export var ETXTBSY: number; - export var EWOULDBLOCK: number; - export var EXDEV: number; - export var WSAEINTR: number; - export var WSAEBADF: number; - export var WSAEACCES: number; - export var WSAEFAULT: number; - export var WSAEINVAL: number; - export var WSAEMFILE: number; - export var WSAEWOULDBLOCK: number; - export var WSAEINPROGRESS: number; - export var WSAEALREADY: number; - export var WSAENOTSOCK: number; - export var WSAEDESTADDRREQ: number; - export var WSAEMSGSIZE: number; - export var WSAEPROTOTYPE: number; - export var WSAENOPROTOOPT: number; - export var WSAEPROTONOSUPPORT: number; - export var WSAESOCKTNOSUPPORT: number; - export var WSAEOPNOTSUPP: number; - export var WSAEPFNOSUPPORT: number; - export var WSAEAFNOSUPPORT: number; - export var WSAEADDRINUSE: number; - export var WSAEADDRNOTAVAIL: number; - export var WSAENETDOWN: number; - export var WSAENETUNREACH: number; - export var WSAENETRESET: number; - export var WSAECONNABORTED: number; - export var WSAECONNRESET: number; - export var WSAENOBUFS: number; - export var WSAEISCONN: number; - export var WSAENOTCONN: number; - export var WSAESHUTDOWN: number; - export var WSAETOOMANYREFS: number; - export var WSAETIMEDOUT: number; - export var WSAECONNREFUSED: number; - export var WSAELOOP: number; - export var WSAENAMETOOLONG: number; - export var WSAEHOSTDOWN: number; - export var WSAEHOSTUNREACH: number; - export var WSAENOTEMPTY: number; - export var WSAEPROCLIM: number; - export var WSAEUSERS: number; - export var WSAEDQUOT: number; - export var WSAESTALE: number; - export var WSAEREMOTE: number; - export var WSASYSNOTREADY: number; - export var WSAVERNOTSUPPORTED: number; - export var WSANOTINITIALISED: number; - export var WSAEDISCON: number; - export var WSAENOMORE: number; - export var WSAECANCELLED: number; - export var WSAEINVALIDPROCTABLE: number; - export var WSAEINVALIDPROVIDER: number; - export var WSAEPROVIDERFAILEDINIT: number; - export var WSASYSCALLFAILURE: number; - export var WSASERVICE_NOT_FOUND: number; - export var WSATYPE_NOT_FOUND: number; - export var WSA_E_NO_MORE: number; - export var WSA_E_CANCELLED: number; - export var WSAEREFUSED: number; - export var SIGHUP: number; - export var SIGINT: number; - export var SIGILL: number; - export var SIGABRT: number; - export var SIGFPE: number; - export var SIGKILL: number; - export var SIGSEGV: number; - export var SIGTERM: number; - export var SIGBREAK: number; - export var SIGWINCH: number; - export var SSL_OP_ALL: number; - export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - export var SSL_OP_CIPHER_SERVER_PREFERENCE: number; - export var SSL_OP_CISCO_ANYCONNECT: number; - export var SSL_OP_COOKIE_EXCHANGE: number; - export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - export var SSL_OP_EPHEMERAL_RSA: number; - export var SSL_OP_LEGACY_SERVER_CONNECT: number; - export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; - export var SSL_OP_MICROSOFT_SESS_ID_BUG: number; - export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number; - export var SSL_OP_NETSCAPE_CA_DN_BUG: number; - export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number; - export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; - export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; - export var SSL_OP_NO_COMPRESSION: number; - export var SSL_OP_NO_QUERY_MTU: number; - export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - export var SSL_OP_NO_SSLv2: number; - export var SSL_OP_NO_SSLv3: number; - export var SSL_OP_NO_TICKET: number; - export var SSL_OP_NO_TLSv1: number; - export var SSL_OP_NO_TLSv1_1: number; - export var SSL_OP_NO_TLSv1_2: number; - export var SSL_OP_PKCS1_CHECK_1: number; - export var SSL_OP_PKCS1_CHECK_2: number; - export var SSL_OP_SINGLE_DH_USE: number; - export var SSL_OP_SINGLE_ECDH_USE: number; - export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; - export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; - export var SSL_OP_TLS_BLOCK_PADDING_BUG: number; - export var SSL_OP_TLS_D5_BUG: number; - export var SSL_OP_TLS_ROLLBACK_BUG: number; - export var ENGINE_METHOD_DSA: number; - export var ENGINE_METHOD_DH: number; - export var ENGINE_METHOD_RAND: number; - export var ENGINE_METHOD_ECDH: number; - export var ENGINE_METHOD_ECDSA: number; - export var ENGINE_METHOD_CIPHERS: number; - export var ENGINE_METHOD_DIGESTS: number; - export var ENGINE_METHOD_STORE: number; - export var ENGINE_METHOD_PKEY_METHS: number; - export var ENGINE_METHOD_PKEY_ASN1_METHS: number; - export var ENGINE_METHOD_ALL: number; - export var ENGINE_METHOD_NONE: number; - export var DH_CHECK_P_NOT_SAFE_PRIME: number; - export var DH_CHECK_P_NOT_PRIME: number; - export var DH_UNABLE_TO_CHECK_GENERATOR: number; - export var DH_NOT_SUITABLE_GENERATOR: number; - export var NPN_ENABLED: number; - export var RSA_PKCS1_PADDING: number; - export var RSA_SSLV23_PADDING: number; - export var RSA_NO_PADDING: number; - export var RSA_PKCS1_OAEP_PADDING: number; - export var RSA_X931_PADDING: number; - export var RSA_PKCS1_PSS_PADDING: number; - export var POINT_CONVERSION_COMPRESSED: number; - export var POINT_CONVERSION_UNCOMPRESSED: number; - export var POINT_CONVERSION_HYBRID: number; - export var O_RDONLY: number; - export var O_WRONLY: number; - export var O_RDWR: number; - export var S_IFMT: number; - export var S_IFREG: number; - export var S_IFDIR: number; - export var S_IFCHR: number; - export var S_IFLNK: number; - export var O_CREAT: number; - export var O_EXCL: number; - export var O_TRUNC: number; - export var O_APPEND: number; - export var F_OK: number; - export var R_OK: number; - export var W_OK: number; - export var X_OK: number; - export var UV_UDP_REUSEADDR: number; -} diff --git a/decl/react-dom.d.ts b/decl/react-dom.d.ts deleted file mode 100644 index 1f6ca6efd..000000000 --- a/decl/react-dom.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -// Type definitions for React v0.14 (react-dom) -// Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign , Microsoft -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace __React { - namespace __DOM { - function findDOMNode(instance: ReactInstance): E; - function findDOMNode(instance: ReactInstance): Element; - - function render

( - element: DOMElement, - container: Element, - callback?: (element: T) => any): T; - function render

( - element: SFCElement

, - container: Element, - callback?: () => any): void; - function render>( - element: CElement, - container: Element, - callback?: (component: T) => any): T; - function render

( - element: ReactElement

( - parentComponent: Component, - element: DOMElement, - container: Element, - callback?: (element: T) => any): T; - function unstable_renderSubtreeIntoContainer>( - parentComponent: Component, - element: CElement, - container: Element, - callback?: (component: T) => any): T; - function render

( - parentComponent: Component, - element: SFCElement

, - container: Element, - callback?: () => any): void; - function unstable_renderSubtreeIntoContainer

( - parentComponent: Component, - element: ReactElement

, - container: Element, - callback?: (component?: Component | Element) => any): Component | Element | void; - } - - namespace __DOMServer { - function renderToString(element: ReactElement): string; - function renderToStaticMarkup(element: ReactElement): string; - var version: string; - } -} - -declare module "react-dom" { - import DOM = __React.__DOM; - export = DOM; -} - -declare module "react-dom/server" { - import DOMServer = __React.__DOMServer; - export = DOMServer; -} diff --git a/decl/react-global.d.ts b/decl/react-global.d.ts deleted file mode 100644 index 912d029e9..000000000 --- a/decl/react-global.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Type definitions for React v0.14 (namespace) -// Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign , Microsoft -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - -import React = __React; -import ReactDOM = __React.__DOM; - diff --git a/decl/react.d.ts b/decl/react.d.ts deleted file mode 100644 index 5cba33227..000000000 --- a/decl/react.d.ts +++ /dev/null @@ -1,2547 +0,0 @@ -// Type definitions for React v0.14 -// Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign , Microsoft , John Reilly -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace __React { - - // - // React Elements - // ---------------------------------------------------------------------- - - type ReactType = string | ComponentClass | StatelessComponent; - - type Key = string | number; - type Ref = string | ((instance: T) => any); - type ComponentState = {} | void; - - interface Attributes { - key?: Key; - } - interface ClassAttributes extends Attributes { - ref?: Ref; - } - - interface ReactElement

{ - type: string | ComponentClass

| SFC

; - props: P; - key?: Key; - } - - interface SFCElement

extends ReactElement

{ - type: SFC

; - } - - type CElement> = ComponentElement; - interface ComponentElement> extends ReactElement

{ - type: ComponentClass

; - ref?: Ref; - } - - type ClassicElement

= CElement>; - - interface DOMElement

extends ReactElement

{ - type: string; - ref: Ref; - } - - interface ReactHTMLElement extends DOMElement { - } - - interface ReactSVGElement extends DOMElement { - } - - // - // Factories - // ---------------------------------------------------------------------- - - interface Factory

{ - (props?: P & Attributes, ...children: ReactNode[]): ReactElement

; - } - - interface SFCFactory

{ - (props?: P & Attributes, ...children: ReactNode[]): SFCElement

; - } - - interface ComponentFactory> { - (props?: P & ClassAttributes, ...children: ReactNode[]): CElement; - } - - type CFactory> = ComponentFactory; - type ClassicFactory

= CFactory>; - - interface DOMFactory

{ - (props?: P & ClassAttributes, ...children: ReactNode[]): DOMElement; - } - - interface HTMLFactory extends DOMFactory { - } - - interface SVGFactory extends DOMFactory { - } - - // - // React Nodes - // http://facebook.github.io/react/docs/glossary.html - // ---------------------------------------------------------------------- - - type ReactText = string | number; - type ReactChild = ReactElement | ReactText; - - // Should be Array but type aliases cannot be recursive - type ReactFragment = {} | Array; - type ReactNode = ReactChild | ReactFragment | boolean; - - // - // Top Level API - // ---------------------------------------------------------------------- - - function createClass(spec: ComponentSpec): ClassicComponentClass

; - - function createFactory

( - type: string): DOMFactory; - function createFactory

(type: SFC

): SFCFactory

; - function createFactory

( - type: ClassType, ClassicComponentClass

>): CFactory>; - function createFactory, C extends ComponentClass

>( - type: ClassType): CFactory; - function createFactory

(type: ComponentClass

| SFC

): Factory

; - - function createElement

( - type: string, - props?: P & ClassAttributes, - ...children: ReactNode[]): DOMElement; - function createElement

( - type: SFC

, - props?: P & Attributes, - ...children: ReactNode[]): SFCElement

; - function createElement

( - type: ClassType, ClassicComponentClass

>, - props?: P & ClassAttributes>, - ...children: ReactNode[]): CElement>; - function createElement, C extends ComponentClass

>( - type: ClassType, - props?: P & ClassAttributes, - ...children: ReactNode[]): CElement; - function createElement

( - type: ComponentClass

| SFC

, - props?: P & Attributes, - ...children: ReactNode[]): ReactElement

; - - function cloneElement

( - element: DOMElement, - props?: P & ClassAttributes, - ...children: ReactNode[]): DOMElement; - function cloneElement

( - element: SFCElement

, - props?: Q, // should be Q & Attributes, but then Q is inferred as {} - ...children: ReactNode[]): SFCElement

; - function cloneElement

>( - element: CElement, - props?: Q, // should be Q & ClassAttributes - ...children: ReactNode[]): CElement; - function cloneElement

( - element: ReactElement

, - props?: Q, // should be Q & Attributes - ...children: ReactNode[]): ReactElement

; - - function isValidElement

(object: {}): object is ReactElement

; - - var DOM: ReactDOM; - var PropTypes: ReactPropTypes; - var Children: ReactChildren; - var version: string; - - // - // Component API - // ---------------------------------------------------------------------- - - type ReactInstance = Component | Element; - - // Base component for plain JS classes - class Component implements ComponentLifecycle { - constructor(props?: P, context?: any); - setState(f: (prevState: S, props: P) => S, callback?: () => any): void; - setState(state: S, callback?: () => any): void; - forceUpdate(callback?: () => any): void; - render(): JSX.Element; - - // React.Props is now deprecated, which means that the `children` - // property is not available on `P` by default, even though you can - // always pass children as variadic arguments to `createElement`. - // In the future, if we can define its call signature conditionally - // on the existence of `children` in `P`, then we should remove this. - props: P & { children?: ReactNode }; - state: S; - context: any; - refs: { - [key: string]: ReactInstance - }; - } - - class PureComponent extends Component {} - - interface ClassicComponent extends Component { - replaceState(nextState: S, callback?: () => any): void; - isMounted(): boolean; - getInitialState?(): S; - } - - interface ChildContextProvider { - getChildContext(): CC; - } - - // - // Class Interfaces - // ---------------------------------------------------------------------- - - type SFC

= StatelessComponent

; - interface StatelessComponent

{ - (props: P, context?: any): ReactElement; - propTypes?: ValidationMap

; - contextTypes?: ValidationMap; - defaultProps?: P; - displayName?: string; - } - - interface ComponentClass

{ - new(props?: P, context?: any): Component; - propTypes?: ValidationMap

; - contextTypes?: ValidationMap; - childContextTypes?: ValidationMap; - defaultProps?: P; - displayName?: string; - } - - interface ClassicComponentClass

extends ComponentClass

{ - new(props?: P, context?: any): ClassicComponent; - getDefaultProps?(): P; - } - - /** - * We use an intersection type to infer multiple type parameters from - * a single argument, which is useful for many top-level API defs. - * See https://github.com/Microsoft/TypeScript/issues/7234 for more info. - */ - type ClassType, C extends ComponentClass

> = - C & - (new() => T) & - (new() => { props: P }); - - // - // Component Specs and Lifecycle - // ---------------------------------------------------------------------- - - interface ComponentLifecycle { - componentWillMount?(): void; - componentDidMount?(): void; - componentWillReceiveProps?(nextProps: P, nextContext: any): void; - shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean; - componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void; - componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void; - componentWillUnmount?(): void; - } - - interface Mixin extends ComponentLifecycle { - mixins?: Mixin; - statics?: { - [key: string]: any; - }; - - displayName?: string; - propTypes?: ValidationMap; - contextTypes?: ValidationMap; - childContextTypes?: ValidationMap; - - getDefaultProps?(): P; - getInitialState?(): S; - } - - interface ComponentSpec extends Mixin { - render(): ReactElement; - - [propertyName: string]: any; - } - - // - // Event System - // ---------------------------------------------------------------------- - - interface SyntheticEvent { - bubbles: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; - nativeEvent: Event; - preventDefault(): void; - isDefaultPrevented(): boolean; - stopPropagation(): void; - isPropagationStopped(): boolean; - persist(): void; - target: EventTarget; - timeStamp: Date; - type: string; - } - - interface ClipboardEvent extends SyntheticEvent { - clipboardData: DataTransfer; - } - - interface CompositionEvent extends SyntheticEvent { - data: string; - } - - interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; - } - - interface FocusEvent extends SyntheticEvent { - relatedTarget: EventTarget; - } - - interface FormEvent extends SyntheticEvent { - } - - interface KeyboardEvent extends SyntheticEvent { - altKey: boolean; - charCode: number; - ctrlKey: boolean; - getModifierState(key: string): boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; - } - - interface MouseEvent extends SyntheticEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - } - - interface TouchEvent extends SyntheticEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; - } - - interface UIEvent extends SyntheticEvent { - detail: number; - view: AbstractView; - } - - interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; - } - - interface AnimationEvent extends SyntheticEvent { - animationName: string; - pseudoElement: string; - elapsedTime: number; - } - - interface TransitionEvent extends SyntheticEvent { - propertyName: string; - pseudoElement: string; - elapsedTime: number; - } - - // - // Event Handler Types - // ---------------------------------------------------------------------- - - interface EventHandler { - (event: E): void; - } - - type ReactEventHandler = EventHandler; - - type ClipboardEventHandler = EventHandler; - type CompositionEventHandler = EventHandler; - type DragEventHandler = EventHandler; - type FocusEventHandler = EventHandler; - type FormEventHandler = EventHandler; - type KeyboardEventHandler = EventHandler; - type MouseEventHandler = EventHandler; - type TouchEventHandler = EventHandler; - type UIEventHandler = EventHandler; - type WheelEventHandler = EventHandler; - type AnimationEventHandler = EventHandler; - type TransitionEventHandler = EventHandler; - - // - // Props / DOM Attributes - // ---------------------------------------------------------------------- - - /** - * @deprecated. This was used to allow clients to pass `ref` and `key` - * to `createElement`, which is no longer necessary due to intersection - * types. If you need to declare a props object before passing it to - * `createElement` or a factory, use `ClassAttributes`: - * - * ```ts - * var b: Button; - * var props: ButtonProps & ClassAttributes

, - container: Element, - callback?: (component?: Component | Element) => any): Component | Element | void; - - function unmountComponentAtNode(container: Element): boolean; - - var version: string; - - function unstable_batchedUpdates(callback: (a: A, b: B) => any, a: A, b: B): void; - function unstable_batchedUpdates(callback: (a: A) => any, a: A): void; - function unstable_batchedUpdates(callback: () => any): void; - - function unstable_renderSubtreeIntoContainer

diff --git a/node_modules/sax/lib/sax.js b/node_modules/sax/lib/sax.js index f125c5fee..db0d4c316 100644 --- a/node_modules/sax/lib/sax.js +++ b/node_modules/sax/lib/sax.js @@ -267,8 +267,6 @@ // this really needs to be replaced with character classes. // XML allows all manner of ridiculous numbers and digits. - var number = '0124356789' - var letter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' // (Letter | "_" | ":") var quote = '\'"' @@ -281,8 +279,6 @@ // turn all the string character sets into character class objects. whitespace = charClass(whitespace) - number = charClass(number) - letter = charClass(letter) // http://www.w3.org/TR/REC-xml/#NT-NameStartChar // This implementation works on strings, a single character at a time @@ -292,10 +288,10 @@ // is left as an exercise for the reader. var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ - var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/ + var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ - var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/ + var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/ quote = charClass(quote) attribEnd = charClass(attribEnd) @@ -307,12 +303,16 @@ }, {}) } - function isRegExp (c) { - return Object.prototype.toString.call(c) === '[object RegExp]' + function isMatch (regex, c) { + return regex.test(c) } function is (charclass, c) { - return isRegExp(charclass) ? !!c.match(charclass) : charclass[c] + return charclass[c] + } + + function notMatch (regex, c) { + return !isMatch(regex, c) } function not (charclass, c) { @@ -998,9 +998,11 @@ while (true) { c = charAt(chunk, i++) parser.c = c + if (!c) { break } + if (parser.trackPosition) { parser.position++ if (c === '\n') { @@ -1010,6 +1012,7 @@ parser.column++ } } + switch (parser.state) { case S.BEGIN: parser.state = S.BEGIN_WHITESPACE @@ -1080,7 +1083,7 @@ parser.sgmlDecl = '' } else if (is(whitespace, c)) { // wait for it... - } else if (is(nameStart, c)) { + } else if (isMatch(nameStart, c)) { parser.state = S.OPEN_TAG parser.tagName = c } else if (c === '/') { @@ -1283,7 +1286,7 @@ continue case S.OPEN_TAG: - if (is(nameBody, c)) { + if (isMatch(nameBody, c)) { parser.tagName += c } else { newTag(parser) @@ -1318,7 +1321,7 @@ openTag(parser) } else if (c === '/') { parser.state = S.OPEN_TAG_SLASH - } else if (is(nameStart, c)) { + } else if (isMatch(nameStart, c)) { parser.attribName = c parser.attribValue = '' parser.state = S.ATTRIB_NAME @@ -1337,7 +1340,7 @@ openTag(parser) } else if (is(whitespace, c)) { parser.state = S.ATTRIB_NAME_SAW_WHITE - } else if (is(nameBody, c)) { + } else if (isMatch(nameBody, c)) { parser.attribName += c } else { strictFail(parser, 'Invalid attribute name') @@ -1360,7 +1363,7 @@ parser.attribName = '' if (c === '>') { openTag(parser) - } else if (is(nameStart, c)) { + } else if (isMatch(nameStart, c)) { parser.attribName = c parser.state = S.ATTRIB_NAME } else { @@ -1404,7 +1407,7 @@ openTag(parser) } else if (c === '/') { parser.state = S.OPEN_TAG_SLASH - } else if (is(nameStart, c)) { + } else if (isMatch(nameStart, c)) { strictFail(parser, 'No whitespace between attributes') parser.attribName = c parser.attribValue = '' @@ -1435,7 +1438,7 @@ if (!parser.tagName) { if (is(whitespace, c)) { continue - } else if (not(nameStart, c)) { + } else if (notMatch(nameStart, c)) { if (parser.script) { parser.script += '') { closeTag(parser) - } else if (is(nameBody, c)) { + } else if (isMatch(nameBody, c)) { parser.tagName += c } else if (parser.script) { parser.script += ' (http://blog.izs.me/)", - "version": "1.2.1", + "version": "1.2.2", "main": "lib/sax.js", "license": "ISC", "scripts": { - "test": "tap test/*.js --cov", + "test": "tap test/*.js --cov -j4", "posttest": "standard -F test/*.js lib/*.js" }, "repository": "git://github.com/isaacs/sax-js.git", "files": [ "lib/sax.js", "LICENSE", - "LICENSE-W3C.html", "README.md" ], "devDependencies": { - "standard": "^5.3.1", - "tap": "^5.2.0" + "standard": "^8.6.0", + "tap": "^10.0.2" } } diff --git a/node_modules/selenium-webdriver/CHANGES.md b/node_modules/selenium-webdriver/CHANGES.md index b9ac5fd22..1cdc96814 100644 --- a/node_modules/selenium-webdriver/CHANGES.md +++ b/node_modules/selenium-webdriver/CHANGES.md @@ -1,3 +1,42 @@ +## v3.3.0 + +* Added warning log messages when the user creates new managed promises, or + schedules unchained tasks. Users may opt in to printing these log messages + with + + ```js + const {logging} = require('selenium-webdriver'); + logging.installConsoleHandler(); + logging.getLogger('promise.ControlFlow').setLevel(logging.Level.WARNING); + ``` +* If the `JAVA_HOME` environment variable is set, use it to locate java.exe. + + +## v3.2.0 + +* Release skipped to stay in sync with the main Selenium project. + + +## v3.1.0 + +* The `lib` package is once again platform agnostic (excluding `lib/devmode`). +* Deprecated `promise.when(value, callback, errback)`. + Use `promise.fulfilled(value).then(callback, errback)` +* Changed `promise.fulfilled(value)`, `promise.rejected(reason)` and + `promise.defer()` to all use native promises when the promise manager is + disabled. +* Properly handle W3C error responses to new session commands. +* Updated `selenium-webdriver/testing` to export `describe.only` along with + `describe.skip`. +* Fixed `selenium-webdriver/lib/until.ableToSwitchToFrame`. It was previously + dropping arguments and would never work. +* Added the ability to use Firefox Nightly +* If Firefox cannot be found in the default location, look for it on the PATH +* Allow SafariDriver to use Safari Technology Preview. +* Use the proper wire command for WebElement.getLocation() and + WebElement.getSize() for W3C compliant drivers. + + ## v3.0.1 * More API adjustments to align with native Promises diff --git a/node_modules/selenium-webdriver/README.md b/node_modules/selenium-webdriver/README.md index bc281d504..31708b186 100644 --- a/node_modules/selenium-webdriver/README.md +++ b/node_modules/selenium-webdriver/README.md @@ -136,16 +136,16 @@ will also have "best effort" support. Releases older than the latest LTS, _semver-major_ releases, and all unstable release branches (e.g. "v.Next") are considered strictly unsupported. -For example, suppose the current LTS and stable releases are v4.2.4 and v5.4.1, +For example, suppose the current LTS and stable releases are v6.9.5 and v7.5.0, respectively. Then a Selenium release would have the following support levels: | Version | Support | | ------- | ------------- | -| <= 4.1 | _unsupported_ | -| 4.2 | supported | -| 5.0-3 | best effort | -| 5.4 | supported | -| >= 5.5 | best effort | +| <= 6.8 | _unsupported_ | +| 6.9 | supported | +| 7.0-4 | best effort | +| 7.5 | supported | +| >= 7.5 | best effort | | v.Next | _unsupported_ | ### Support Level Definitions @@ -168,11 +168,11 @@ months, the support window for selenium-webdriver will be roughly: | Date | LTS | Stable | | --------- | ---: | -----: | -| (current) | 4.2 | 5.0 | -| 2016-04 | 4.2 | 6.0 | -| 2016-10 | 6.0 | 7.0 | +| (current) | 6.9 | 7.5 | | 2017-04 | 6.0 | 8.0 | | 2017-10 | 8.0 | 9.0 | +| 2018-04 | 8.0 | 10.0 | +| 2018-10 | 10.0 | 11.0 | ## Issues diff --git a/node_modules/selenium-webdriver/chrome.js b/node_modules/selenium-webdriver/chrome.js index eb33df9ed..2dbc93351 100644 --- a/node_modules/selenium-webdriver/chrome.js +++ b/node_modules/selenium-webdriver/chrome.js @@ -59,7 +59,7 @@ * let options = new chrome.Options(); * // configure browser options ... * - * let driver = new chrome.Driver(options, service); + * let driver = chrome.Driver.createSession(options, service); * * Users should only instantiate the {@link Driver} class directly when they * need a custom driver service configuration (as shown above). For normal @@ -595,7 +595,7 @@ class Options { * let options = new chrome.Options().setMobileEmulation( * {deviceName: 'Google Nexus 5'}); * - * let driver = new chrome.Driver(options); + * let driver = chrome.Driver.createSession(options); * * __Example 2: Using Custom Screen Configuration__ * @@ -605,7 +605,7 @@ class Options { * pixelRatio: 3.0 * }); * - * let driver = new chrome.Driver(options); + * let driver = chrome.Driver.createSession(options); * * * [em]: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation diff --git a/node_modules/selenium-webdriver/edge.js b/node_modules/selenium-webdriver/edge.js index ee9d43383..9280cabd9 100644 --- a/node_modules/selenium-webdriver/edge.js +++ b/node_modules/selenium-webdriver/edge.js @@ -58,7 +58,7 @@ * var options = new edge.Options(); * // configure browser options ... * - * var driver = new edge.Driver(options, service); + * var driver = edge.Driver.createSession(options, service); * * Users should only instantiate the {@link Driver} class directly when they * need a custom driver service configuration (as shown above). For normal diff --git a/node_modules/selenium-webdriver/firefox/binary.js b/node_modules/selenium-webdriver/firefox/binary.js index b997b480d..a1360bab7 100644 --- a/node_modules/selenium-webdriver/firefox/binary.js +++ b/node_modules/selenium-webdriver/firefox/binary.js @@ -47,27 +47,17 @@ const NO_FOCUS_LIB_AMD64 = isDevMode ? const X_IGNORE_NO_FOCUS_LIB = 'x_ignore_nofocus.so'; -let foundBinary = null; -let foundDevBinary = null; - - /** - * Checks the default Windows Firefox locations in Program Files. - * - * @param {boolean=} opt_dev Whether to find the Developer Edition. + * @param {string} file Path to the file to find, relative to the program files + * root. * @return {!Promise} A promise for the located executable. * The promise will resolve to {@code null} if Firefox was not found. */ -function defaultWindowsLocation(opt_dev) { - var files = [ +function findInProgramFiles(file) { + let files = [ process.env['PROGRAMFILES'] || 'C:\\Program Files', process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)' - ].map(function(prefix) { - if (opt_dev) { - return path.join(prefix, 'Firefox Developer Edition\\firefox.exe'); - } - return path.join(prefix, 'Mozilla Firefox\\firefox.exe'); - }); + ].map(prefix => path.join(prefix, file)); return io.exists(files[0]).then(function(exists) { return exists ? files[0] : io.exists(files[1]).then(function(exists) { return exists ? files[1] : null; @@ -77,49 +67,104 @@ function defaultWindowsLocation(opt_dev) { /** - * Locates the Firefox binary for the current system. + * Provides methods for locating the executable for a Firefox release channel + * on Windows and MacOS. For other systems (i.e. Linux), Firefox will always + * be located on the system PATH. * - * @param {boolean=} opt_dev Whether to find the Developer Edition. This only - * used on Windows and OSX. - * @return {!Promise} A promise for the located binary. The promise will - * be rejected if Firefox cannot be located. + * @final */ -function findFirefox(opt_dev) { - if (opt_dev && foundDevBinary) { - return foundDevBinary; +class Channel { + /** + * @param {string} darwin The path to check when running on MacOS. + * @param {string} win32 The path to check when running on Windows. + */ + constructor(darwin, win32) { + /** @private @const */ this.darwin_ = darwin; + /** @private @const */ this.win32_ = win32; + /** @private {Promise} */ + this.found_ = null; } - if (!opt_dev && foundBinary) { - return foundBinary; + /** + * Attempts to locate the Firefox executable for this release channel. This + * will first check the default installation location for the channel before + * checking the user's PATH. The returned promise will be rejected if Firefox + * can not be found. + * + * @return {!Promise} A promise for the location of the located + * Firefox executable. + */ + locate() { + if (this.found_) { + return this.found_; + } + + let found; + switch (process.platform) { + case 'darwin': + found = io.exists(this.darwin_) + .then(exists => exists ? this.darwin_ : io.findInPath('firefox')); + break; + + case 'win32': + found = findInProgramFiles(this.win32_) + .then(found => found || io.findInPath('firefox.exe')); + break; + + default: + found = Promise.resolve(io.findInPath('firefox')); + break; + } + + this.found_ = found.then(found => { + if (found) { + // TODO: verify version info. + return found; + } + throw Error('Could not locate Firefox on the current system'); + }); + return this.found_; } +} - let found; - if (process.platform === 'darwin') { - let exe = opt_dev - ? '/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin' - : '/Applications/Firefox.app/Contents/MacOS/firefox-bin'; - found = io.exists(exe).then(exists => exists ? exe : null); - } else if (process.platform === 'win32') { - found = defaultWindowsLocation(opt_dev); +/** + * Firefox's developer channel. + * @const + * @see + */ +Channel.AURORA = new Channel( + '/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin', + 'Firefox Developer Edition\\firefox.exe'); - } else { - found = Promise.resolve(io.findInPath('firefox')); - } +/** + * Firefox's beta channel. Note this is provided mainly for convenience as + * the beta channel has the same installation location as the main release + * channel. + * @const + * @see + */ +Channel.BETA = new Channel( + '/Applications/Firefox.app/Contents/MacOS/firefox-bin', + 'Mozilla Firefox\\firefox.exe'); - found = found.then(found => { - if (found) { - return found; - } - throw Error('Could not locate Firefox on the current system'); - }); +/** + * Firefox's release channel. + * @const + * @see + */ +Channel.RELEASE = new Channel( + '/Applications/Firefox.app/Contents/MacOS/firefox-bin', + 'Mozilla Firefox\\firefox.exe'); - if (opt_dev) { - return foundDevBinary = found; - } else { - return foundBinary = found; - } -} +/** + * Firefox's nightly release channel. + * @const + * @see + */ +Channel.NIGHTLY = new Channel( + '/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin', + 'Nightly\\firefox.exe'); /** @@ -151,20 +196,23 @@ function installNoFocusLibs(profileDir) { * use with WebDriver. * * If created _without_ a path for the Firefox binary to use, this class will - * attempt to find Firefox when {@link #launch()} is called. For OSX and + * attempt to find Firefox when {@link #launch()} is called. For MacOS and * Windows, this class will look for Firefox in the current platform's default - * installation location (e.g. /Applications/Firefox.app on OSX). For all other - * platforms, the Firefox executable must be available on your system `PATH`. + * installation location (e.g. /Applications/Firefox.app on MacOS). For all + * other platforms, the Firefox executable must be available on your system + * `PATH`. * * @final */ class Binary { /** - * @param {string=} opt_exe Path to the Firefox binary to use. + * @param {?(string|Channel)=} opt_exeOrChannel Either the path to a specific + * Firefox binary to use, or a {@link Channel} instance that describes + * how to locate the desired Firefox version. */ - constructor(opt_exe) { - /** @private {(string|undefined)} */ - this.exe_ = opt_exe; + constructor(opt_exeOrChannel) { + /** @private {?(string|Channel)} */ + this.exe_ = opt_exeOrChannel || null; /** @private {!Array.} */ this.args_ = []; @@ -187,7 +235,7 @@ class Binary { * on the current system. */ getExe() { - return this.exe_; + return typeof this.exe_ === 'string' ? this.exe_ : undefined; } /** @@ -223,6 +271,8 @@ class Binary { * * @param {boolean=} opt_use Whether to use the developer edition. Defaults to * true. + * @deprecated Use the {@link Channel} class to indicate the desired Firefox + * version when creating a new binary: `new Binary(Channel.AURORA)`. */ useDevEdition(opt_use) { this.devEdition_ = opt_use === undefined || !!opt_use; @@ -238,7 +288,13 @@ class Binary { * used by this instance. */ locate() { - return Promise.resolve(this.exe_ || findFirefox(this.devEdition_)); + if (typeof this.exe_ === 'string') { + return Promise.resolve(this.exe_); + } else if (this.exe_ instanceof Channel) { + return this.exe_.locate(); + } + let channel = this.devEdition_ ? Channel.AURORA : Channel.RELEASE; + return channel.locate(); } /** @@ -284,4 +340,5 @@ class Binary { exports.Binary = Binary; +exports.Channel = Channel; diff --git a/node_modules/selenium-webdriver/firefox/extension.js b/node_modules/selenium-webdriver/firefox/extension.js index 60abb06b8..3bda759a7 100644 --- a/node_modules/selenium-webdriver/firefox/extension.js +++ b/node_modules/selenium-webdriver/firefox/extension.js @@ -161,7 +161,7 @@ function readManifest(addonPath) { manifest = io.stat(addonPath).then(function(stats) { if (!stats.isDirectory()) { throw Error( - 'Add-on path is niether a xpi nor a directory: ' + addonPath); + 'Add-on path is neither a xpi nor a directory: ' + addonPath); } return io.read(path.join(addonPath, 'install.rdf')); }); diff --git a/node_modules/selenium-webdriver/firefox/index.js b/node_modules/selenium-webdriver/firefox/index.js index 4ea1702a9..d5c88274a 100644 --- a/node_modules/selenium-webdriver/firefox/index.js +++ b/node_modules/selenium-webdriver/firefox/index.js @@ -26,28 +26,31 @@ * * __Customizing the Firefox Profile__ * - * The {@link Profile} class may be used to configure the browser profile used - * with WebDriver, with functions to install additional + * The {@linkplain Profile} class may be used to configure the browser profile + * used with WebDriver, with functions to install additional * {@linkplain Profile#addExtension extensions}, configure browser * {@linkplain Profile#setPreference preferences}, and more. For example, you * may wish to include Firebug: * - * var firefox = require('selenium-webdriver/firefox'); + * const {Builder} = require('selenium-webdriver'); + * const firefox = require('selenium-webdriver/firefox'); * - * var profile = new firefox.Profile(); + * let profile = new firefox.Profile(); * profile.addExtension('/path/to/firebug.xpi'); * profile.setPreference('extensions.firebug.showChromeErrors', true); * - * var options = new firefox.Options().setProfile(profile); - * var driver = new firefox.Driver(options); + * let options = new firefox.Options().setProfile(profile); + * let driver = new Builder() + * .forBrowser('firefox') + * .setFirefoxOptions(options) + * .build(); * - * The {@link Profile} class may also be used to configure WebDriver based on a - * pre-existing browser profile: + * The {@linkplain Profile} class may also be used to configure WebDriver based + * on a pre-existing browser profile: * - * var profile = new firefox.Profile( + * let profile = new firefox.Profile( * '/usr/local/home/bob/.mozilla/firefox/3fgog75h.testing'); - * var options = new firefox.Options().setProfile(profile); - * var driver = new firefox.Driver(options); + * let options = new firefox.Options().setProfile(profile); * * The FirefoxDriver will _never_ modify a pre-existing profile; instead it will * create a copy for it to modify. By extension, there are certain browser @@ -56,21 +59,35 @@ * * __Using a Custom Firefox Binary__ * - * On Windows and OSX, the FirefoxDriver will search for Firefox in its + * On Windows and MacOS, the FirefoxDriver will search for Firefox in its * default installation location: * - * * Windows: C:\Program Files and C:\Program Files (x86). - * * Mac OS X: /Applications/Firefox.app + * - Windows: C:\Program Files and C:\Program Files (x86). + * - MacOS: /Applications/Firefox.app + * + * For Linux, Firefox will always be located on the PATH: `$(where firefox)`. * - * For Linux, Firefox will be located on the PATH: `$(where firefox)`. + * Several methods are provided for starting Firefox with a custom executable. + * First, on Windows and MacOS, you may configure WebDriver to check the default + * install location for a non-release channel. If the requested channel cannot + * be found in its default location, WebDriver will fallback to searching your + * PATH. _Note:_ on Linux, Firefox is _always_ located on your path, regardless + * of the requested channel. + * + * const {Builder} = require('selenium-webdriver'); + * const firefox = require('selenium-webdriver/firefox'); + * + * let options = new firefox.Options().setBinary(firefox.Channel.NIGHTLY); + * let driver = new Builder() + * .forBrowser('firefox') + * .setFirefoxOptions(options) + * .build(); * - * You can configure WebDriver to start use a custom Firefox installation with - * the {@link Binary} class: + * On all platforms, you may configrue WebDriver to use a Firefox specific + * executable: * - * var firefox = require('selenium-webdriver/firefox'); - * var binary = new firefox.Binary('/my/firefox/install/dir/firefox-bin'); - * var options = new firefox.Options().setBinary(binary); - * var driver = new firefox.Driver(options); + * let options = new firefox.Options() + * .setBinary('/my/firefox/install/dir/firefox-bin'); * * __Remote Testing__ * @@ -84,11 +101,14 @@ * binaries are never copied to remote machines and must be referenced by * installation path. * - * var options = new firefox.Options() + * const {Builder} = require('selenium-webdriver'); + * const firefox = require('selenium-webdriver/firefox'); + * + * let options = new firefox.Options() * .setProfile('/profile/path/on/remote/host') * .setBinary('/install/dir/on/remote/host/firefox-bin'); * - * var driver = new (require('selenium-webdriver')).Builder() + * let driver = new Builder() * .forBrowser('firefox') * .usingServer('http://127.0.0.1:4444/wd/hub') * .setFirefoxOptions(options) @@ -99,8 +119,7 @@ * To test versions of Firefox prior to Firefox 47, you must disable the use of * the geckodriver using the {@link Options} class. * - * var options = new firefox.Options().useGeckoDriver(false); - * var driver = new firefox.Driver(options); + * let options = new firefox.Options().useGeckoDriver(false); * * Alternatively, you may disable the geckodriver at runtime by setting the * environment variable `SELENIUM_MARIONETTE=false`. @@ -113,7 +132,7 @@ const url = require('url'); -const Binary = require('./binary').Binary, +const {Binary, Channel} = require('./binary'), Profile = require('./profile').Profile, decodeProfile = require('./profile').decode, http = require('../http'), @@ -196,16 +215,24 @@ class Options { } /** - * Sets the binary to use. The binary may be specified as the path to a Firefox - * executable, or as a {@link Binary} object. + * Sets the binary to use. The binary may be specified as the path to a + * Firefox executable, a specific {@link Channel}, or as a {@link Binary} + * object. * - * @param {(string|!Binary)} binary The binary to use. + * @param {(string|!Binary|!Channel)} binary The binary to use. * @return {!Options} A self reference. + * @throws {TypeError} If `binary` is an invalid type. */ setBinary(binary) { - if (typeof binary === 'string') { + if (typeof binary === 'string' || binary instanceof Channel) { binary = new Binary(binary); } + + if (!(binary instanceof Binary)) { + throw TypeError( + 'binary must be a string path, Channel, or Binary object'); + } + this.binary_ = binary; return this; } @@ -687,6 +714,7 @@ class Driver extends webdriver.WebDriver { exports.Binary = Binary; +exports.Channel = Channel; exports.Context = Context; exports.Driver = Driver; exports.Options = Options; diff --git a/node_modules/selenium-webdriver/index.js b/node_modules/selenium-webdriver/index.js index 3cde7f396..a1e208b46 100644 --- a/node_modules/selenium-webdriver/index.js +++ b/node_modules/selenium-webdriver/index.js @@ -58,7 +58,7 @@ var seleniumServer; * Starts an instance of the Selenium server if not yet running. * @param {string} jar Path to the server jar to use. * @return {!Promise} A promise for the server's - * addrss once started. + * address once started. */ function startSeleniumServer(jar) { if (!seleniumServer) { @@ -160,7 +160,7 @@ function createDriver(ctor, ...args) { /** @override */ this.catch = pd.then.bind(pd); } - } + }; promise.CancellableThenable.addImplementation(thenableWebDriverProxy); THENABLE_DRIVERS.set(ctor, thenableWebDriverProxy); } diff --git a/node_modules/selenium-webdriver/lib/README b/node_modules/selenium-webdriver/lib/README index 583293864..c39abbece 100644 --- a/node_modules/selenium-webdriver/lib/README +++ b/node_modules/selenium-webdriver/lib/README @@ -1,6 +1,5 @@ This directory contains modules internal to selenium-webdriver that are not intended for general consumption. They may change at any time. -With the exception of the test/ directory, all files under this directory -may only depend on built-in JavaScript features and other modules in the -directory. +All files in this directory and the atoms/ subdirectory may only depend on +built-in JavaScript features and other modules in this directory. diff --git a/node_modules/selenium-webdriver/lib/actions.js b/node_modules/selenium-webdriver/lib/actions.js index 1b059bbbf..0e34f3783 100644 --- a/node_modules/selenium-webdriver/lib/actions.js +++ b/node_modules/selenium-webdriver/lib/actions.js @@ -128,7 +128,7 @@ class ActionSequence { } /** - * Moves the mouse. The location to move to may be specified in terms of the + * Moves the mouse. The location to move to may be specified in terms of the * mouse's current location, an offset relative to the top-left corner of an * element, or an element (in which case the middle of the element is used). * @@ -333,7 +333,7 @@ class ActionSequence { /** * Performs a modifier key press. The modifier key is not released * until {@link #keyUp} or {@link #sendKeys} is called. The key press will be - * targetted at the currently focused element. + * targeted at the currently focused element. * * @param {!input.Key} key The modifier key to push. Must be one of * {ALT, CONTROL, SHIFT, COMMAND, META}. @@ -347,7 +347,7 @@ class ActionSequence { } /** - * Performs a modifier key release. The release is targetted at the currently + * Performs a modifier key release. The release is targeted at the currently * focused element. * @param {!input.Key} key The modifier key to release. Must be one of * {ALT, CONTROL, SHIFT, COMMAND, META}. @@ -363,7 +363,7 @@ class ActionSequence { /** * Simulates typing multiple keys. Each modifier key encountered in the * sequence will not be released until it is encountered again. All key events - * will be targetted at the currently focused element. + * will be targeted at the currently focused element. * * @param {...(string|!input.Key|!Array<(string|!input.Key)>)} var_args * The keys to type. diff --git a/node_modules/selenium-webdriver/lib/by.js b/node_modules/selenium-webdriver/lib/by.js index ac448e683..8c718be64 100644 --- a/node_modules/selenium-webdriver/lib/by.js +++ b/node_modules/selenium-webdriver/lib/by.js @@ -153,7 +153,7 @@ class By { } /** - * Locates eleemnts by the ID attribute. This locator uses the CSS selector + * Locates elements by the ID attribute. This locator uses the CSS selector * `*[id="$ID"]`, _not_ `document.getElementById`. * * @param {string} id The ID to search for. diff --git a/node_modules/selenium-webdriver/lib/capabilities.js b/node_modules/selenium-webdriver/lib/capabilities.js index 61396d54d..65b290f5f 100644 --- a/node_modules/selenium-webdriver/lib/capabilities.js +++ b/node_modules/selenium-webdriver/lib/capabilities.js @@ -103,7 +103,7 @@ const Capability = { */ PROXY: 'proxy', - /** Whether the driver supports changing the brower's orientation. */ + /** Whether the driver supports changing the browser's orientation. */ ROTATABLE: 'rotatable', /** @@ -130,7 +130,7 @@ const Capability = { /** * Defines how the driver should handle unexpected alerts. The value should - * be one of "accept", "dismiss", or "ignore. + * be one of "accept", "dismiss", or "ignore". */ UNEXPECTED_ALERT_BEHAVIOR: 'unexpectedAlertBehavior', @@ -367,7 +367,7 @@ class Capabilities extends Map { /** * Sets the logging preferences. Preferences may be specified as a - * {@link ./logging.Preferences} instance, or a as a map of log-type to + * {@link ./logging.Preferences} instance, or as a map of log-type to * log-level. * @param {!(./logging.Preferences|Object)} prefs The logging * preferences. @@ -408,7 +408,7 @@ class Capabilities extends Map { /** * Sets the default action to take with an unexpected alert before returning * an error. - * @param {string} behavior The desired behavior; should be "accept", + * @param {string} behavior The desired behavior should be "accept", * "dismiss", or "ignore". Defaults to "dismiss". * @return {!Capabilities} A self reference. */ diff --git a/node_modules/selenium-webdriver/lib/error.js b/node_modules/selenium-webdriver/lib/error.js index 555e5cbc5..82f81b07c 100644 --- a/node_modules/selenium-webdriver/lib/error.js +++ b/node_modules/selenium-webdriver/lib/error.js @@ -311,7 +311,7 @@ class UnknownMethodError extends WebDriverError { /** - * Reports an unsupport operation. + * Reports an unsupported operation. */ class UnsupportedOperationError extends WebDriverError { /** @param {string=} opt_error the error message, if any. */ @@ -462,17 +462,29 @@ function checkResponse(data) { return data; } +/** + * Tests if the given value is a valid error response object according to the + * W3C WebDriver spec. + * + * @param {?} data The value to test. + * @return {boolean} Whether the given value data object is a valid error + * response. + * @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol + */ +function isErrorResponse(data) { + return data && typeof data === 'object' && typeof data.error === 'string'; +} /** * Throws an error coded from the W3C protocol. A generic error will be thrown - * if the privded `data` is not a valid encoded error. + * if the provided `data` is not a valid encoded error. * * @param {{error: string, message: string}} data The error data to decode. * @throws {WebDriverError} the decoded error. * @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol */ function throwDecodedError(data) { - if (data && typeof data === 'object' && typeof data.error === 'string') { + if (isErrorResponse(data)) { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; throw new ctor(data.message); } @@ -551,5 +563,6 @@ module.exports = { checkResponse: checkResponse, checkLegacyResponse: checkLegacyResponse, encodeError: encodeError, + isErrorResponse: isErrorResponse, throwDecodedError: throwDecodedError, }; diff --git a/node_modules/selenium-webdriver/lib/events.js b/node_modules/selenium-webdriver/lib/events.js index 65e63de8c..82b34803e 100644 --- a/node_modules/selenium-webdriver/lib/events.js +++ b/node_modules/selenium-webdriver/lib/events.js @@ -22,7 +22,7 @@ */ class Listener { /** - * @param {!Function} fn The acutal listener function. + * @param {!Function} fn The actual listener function. * @param {(Object|undefined)} scope The object in whose scope to invoke the * listener. * @param {boolean} oneshot Whether this listener should only be used once. diff --git a/node_modules/selenium-webdriver/lib/firefox/amd64/libnoblur64.so b/node_modules/selenium-webdriver/lib/firefox/amd64/libnoblur64.so deleted file mode 100644 index 248c32db5..000000000 Binary files a/node_modules/selenium-webdriver/lib/firefox/amd64/libnoblur64.so and /dev/null differ diff --git a/node_modules/selenium-webdriver/lib/firefox/i386/libnoblur.so b/node_modules/selenium-webdriver/lib/firefox/i386/libnoblur.so deleted file mode 100644 index 004062c7b..000000000 Binary files a/node_modules/selenium-webdriver/lib/firefox/i386/libnoblur.so and /dev/null differ diff --git a/node_modules/selenium-webdriver/lib/firefox/webdriver.json b/node_modules/selenium-webdriver/lib/firefox/webdriver.json index 38601a28c..0dbe56bbd 100644 --- a/node_modules/selenium-webdriver/lib/firefox/webdriver.json +++ b/node_modules/selenium-webdriver/lib/firefox/webdriver.json @@ -37,7 +37,6 @@ "network.http.phishy-userpass-length": 255, "offline-apps.allow_by_default": true, "prompts.tab_modal.enabled": false, - "security.csp.enable": false, "security.fileuri.origin_policy": 3, "security.fileuri.strict_origin_policy": false, "signon.rememberSignons": false, @@ -61,6 +60,8 @@ "dom.max_script_run_time": 30, "dom.report_all_js_exceptions": true, "javascript.options.showInConsole": true, + "network.captive-portal-service.enabled": false, + "security.csp.enable": false, "startup.homepage_welcome_url": "about:blank", "startup.homepage_welcome_url.additional": "about:blank", "webdriver_accept_untrusted_certs": true, diff --git a/node_modules/selenium-webdriver/lib/firefox/webdriver.xpi b/node_modules/selenium-webdriver/lib/firefox/webdriver.xpi index f9a51cf4f..a7b0fa3a7 100644 Binary files a/node_modules/selenium-webdriver/lib/firefox/webdriver.xpi and b/node_modules/selenium-webdriver/lib/firefox/webdriver.xpi differ diff --git a/node_modules/selenium-webdriver/lib/http.js b/node_modules/selenium-webdriver/lib/http.js index 68bc43213..136a48e63 100644 --- a/node_modules/selenium-webdriver/lib/http.js +++ b/node_modules/selenium-webdriver/lib/http.js @@ -25,17 +25,26 @@ 'use strict'; -const fs = require('fs'); -const path = require('path'); - const cmd = require('./command'); -const devmode = require('./devmode'); const error = require('./error'); const logging = require('./logging'); const promise = require('./promise'); const Session = require('./session').Session; const WebElement = require('./webdriver').WebElement; +const {getAttribute, isDisplayed} = (function() { + try { + return { + getAttribute: require('./atoms/getAttribute.js'), + isDisplayed: require('./atoms/is-displayed.js') + }; + } catch (ex) { + throw Error( + 'Failed to import atoms modules. If running in devmode, you need to run' + + ' `./go node:atoms` from the project root: ' + ex); + } +})(); + /** * Converts a headers map to a HTTP header block string. @@ -116,43 +125,15 @@ class Response { const DEV_ROOT = '../../../../buck-out/gen/javascript/'; -/** @enum {string} */ +/** @enum {!Function} */ const Atom = { - GET_ATTRIBUTE: devmode - ? path.join(__dirname, DEV_ROOT, 'webdriver/atoms/getAttribute.js') - : path.join(__dirname, 'atoms/getAttribute.js'), - IS_DISPLAYED: devmode - ? path.join(__dirname, DEV_ROOT, 'atoms/fragments/is-displayed.js') - : path.join(__dirname, 'atoms/isDisplayed.js'), + GET_ATTRIBUTE: getAttribute, + IS_DISPLAYED: isDisplayed }; -const ATOMS = /** !Map> */new Map(); const LOG = logging.getLogger('webdriver.http'); -/** - * @param {Atom} file The atom file to load. - * @return {!Promise} A promise that will resolve to the contents of the - * file. - */ -function loadAtom(file) { - if (ATOMS.has(file)) { - return ATOMS.get(file); - } - let contents = /** !Promise */new Promise((resolve, reject) => { - LOG.finest(() => `Loading atom ${file}`); - fs.readFile(file, 'utf8', function(err, data) { - if (err) { - reject(err); - } else { - resolve(data); - } - }); - }); - ATOMS.set(file, contents); - return contents; -} - function post(path) { return resource('POST', path); } function del(path) { return resource('DELETE', path); } @@ -168,17 +149,26 @@ var CommandSpec; var CommandTransformer; +class InternalTypeError extends TypeError {} + + /** * @param {!cmd.Command} command The initial command. * @param {Atom} atom The name of the atom to execute. * @return {!Promise} The transformed command to execute. */ function toExecuteAtomCommand(command, atom, ...params) { - return loadAtom(atom).then(atom => { - return new cmd.Command(cmd.Name.EXECUTE_SCRIPT) + return new Promise((resolve, reject) => { + if (typeof atom !== 'function') { + reject(new InternalTypeError('atom is not a function: ' + typeof atom)); + return; + } + + let newCmd = new cmd.Command(cmd.Name.EXECUTE_SCRIPT) .setParameter('sessionId', command.getParameter('sessionId')) .setParameter('script', `return (${atom}).apply(null, arguments)`) .setParameter('args', params.map(param => command.getParameter(param))); + resolve(newCmd); }); } @@ -269,6 +259,8 @@ const W3C_COMMAND_MAP = new Map([ [cmd.Name.GET_ELEMENT_ATTRIBUTE, (cmd) => { return toExecuteAtomCommand(cmd, Atom.GET_ATTRIBUTE, 'id', 'name'); }], + [cmd.Name.GET_ELEMENT_LOCATION, get('/session/:sessionId/element/:id/rect')], + [cmd.Name.GET_ELEMENT_SIZE, get('/session/:sessionId/element/:id/rect')], [cmd.Name.IS_ELEMENT_DISPLAYED, (cmd) => { return toExecuteAtomCommand(cmd, Atom.IS_DISPLAYED, 'id'); }], @@ -437,7 +429,8 @@ class Executor { this.log_.finer(() => `>>>\n${request}\n<<<\n${response}`); let parsed = - parseHttpResponse(/** @type {!Response} */ (response), this.w3c); + parseHttpResponse( + command, /** @type {!Response} */ (response), this.w3c); if (command.getName() === cmd.Name.NEW_SESSION || command.getName() === cmd.Name.DESCRIBE_SESSION) { @@ -447,7 +440,7 @@ class Executor { } // The remote end is a W3C compliant server if there is no `status` - // field in the response. This is not appliable for the DESCRIBE_SESSION + // field in the response. This is not applicable for the DESCRIBE_SESSION // command, which is not defined in the W3C spec. if (command.getName() === cmd.Name.NEW_SESSION) { this.w3c = this.w3c || !('status' in parsed); @@ -485,29 +478,42 @@ function tryParse(str) { /** * Callback used to parse {@link Response} objects from a * {@link HttpClient}. + * + * @param {!cmd.Command} command The command the response is for. * @param {!Response} httpResponse The HTTP response to parse. * @param {boolean} w3c Whether the response should be processed using the * W3C wire protocol. * @return {?} The parsed response. * @throws {WebDriverError} If the HTTP response is an error. */ -function parseHttpResponse(httpResponse, w3c) { +function parseHttpResponse(command, httpResponse, w3c) { let parsed = tryParse(httpResponse.body); if (parsed !== undefined) { + if (httpResponse.status < 200) { + // This should never happen, but throw the raw response so + // users report it. + throw new error.WebDriverError( + `Unexpected HTTP response:\n${httpResponse}`); + } + if (w3c) { if (httpResponse.status > 399) { error.throwDecodedError(parsed); } + return parsed; + } - if (httpResponse.status < 200) { - // This should never happen, but throw the raw response so - // users report it. - throw new error.WebDriverError( - `Unexpected HTTP response:\n${httpResponse}`); - } - } else { - error.checkLegacyResponse(parsed); + // If this is a new session command, we need to check for a W3C compliant + // error object. This is necessary since a successful new session command + // is what puts the executor into W3C mode. + if (httpResponse.status > 399 + && (command.getName() == cmd.Name.NEW_SESSION + || command.getName() === cmd.Name.DESCRIBE_SESSION) + && error.isErrorResponse(parsed)) { + error.throwDecodedError(parsed); } + + error.checkLegacyResponse(parsed); return parsed; } diff --git a/node_modules/selenium-webdriver/lib/input.js b/node_modules/selenium-webdriver/lib/input.js index 058530ebc..4ea938d45 100644 --- a/node_modules/selenium-webdriver/lib/input.js +++ b/node_modules/selenium-webdriver/lib/input.js @@ -144,7 +144,7 @@ class FileDetector { /** * Handles the file specified by the given path, preparing it for use with * the current browser. If the path does not refer to a valid file, it will - * be returned unchanged, otherwisee a path suitable for use with the current + * be returned unchanged, otherwise a path suitable for use with the current * browser will be returned. * * This default implementation is a no-op. Subtypes may override this function diff --git a/node_modules/selenium-webdriver/lib/promise.js b/node_modules/selenium-webdriver/lib/promise.js index 32d0c98e6..b26cd23ff 100644 --- a/node_modules/selenium-webdriver/lib/promise.js +++ b/node_modules/selenium-webdriver/lib/promise.js @@ -48,7 +48,7 @@ * > e => console.error('FAILURE: ' + e)); * > ``` * > - * > The motiviation behind this change and full deprecation plan are documented + * > The motivation behind this change and full deprecation plan are documented * > in [issue 2969](https://github.com/SeleniumHQ/selenium/issues/2969). * > * > @@ -87,8 +87,7 @@ * The control flow is based on the concept of tasks and task queues. Tasks are * functions that define the basic unit of work for the control flow to execute. * Each task is scheduled via {@link ControlFlow#execute()}, which will return - * a {@link ManagedPromise ManagedPromise} that will be resolved with the task's - * result. + * a {@link ManagedPromise} that will be resolved with the task's result. * * A task queue contains all of the tasks scheduled within a single turn of the * [JavaScript event loop][JSEL]. The control flow will create a new task queue @@ -103,13 +102,13 @@ * * Whenever the control flow creates a new task queue, it will automatically * begin executing tasks in the next available turn of the event loop. This - * execution is scheduled using a "micro-task" timer, such as a (native) - * `ManagedPromise.then()` callback. + * execution is [scheduled as a microtask][MicrotasksArticle] like e.g. a + * (native) `Promise.then()` callback. * * setTimeout(() => console.log('a')); - * ManagedPromise.resolve().then(() => console.log('b')); // A native promise. + * Promise.resolve().then(() => console.log('b')); // A native promise. * flow.execute(() => console.log('c')); - * ManagedPromise.resolve().then(() => console.log('d')); + * Promise.resolve().then(() => console.log('d')); * setTimeout(() => console.log('fin')); * // b * // c @@ -118,13 +117,13 @@ * // fin * * In the example above, b/c/d is logged before a/fin because native promises - * and this module use "micro-task" timers, which have a higher priority than - * "macro-tasks" like `setTimeout`. + * and this module use "microtask" timers, which have a higher priority than + * "macrotasks" like `setTimeout`. * * ## Task Execution * - * Upon creating a task queue, and whenever an exisiting queue completes a task, - * the control flow will schedule a micro-task timer to process any scheduled + * Upon creating a task queue, and whenever an existing queue completes a task, + * the control flow will schedule a microtask timer to process any scheduled * tasks. This ensures no task is ever started within the same turn of the * JavaScript event loop in which it was scheduled, nor is a task ever started * within the same turn that another finishes. @@ -140,13 +139,13 @@ * discarded and the task's promised result (previously returned by * {@link ControlFlow#execute()}) is immediately rejected with the thrown * error. - * 3. The task function returns sucessfully. + * 3. The task function returns successfully. * * If a task function created a new task queue, the control flow will wait for * that queue to complete before processing the task result. If the queue * completes without error, the flow will settle the task's promise with the - * value originaly returned by the task function. On the other hand, if the task - * queue termintes with an error, the task's promise will be rejected with that + * value originally returned by the task function. On the other hand, if the task + * queue terminates with an error, the task's promise will be rejected with that * error. * * flow.execute(function() { @@ -161,7 +160,7 @@ * ## ManagedPromise Integration * * In addition to the {@link ControlFlow} class, the promise module also exports - * a [ManagedPromise/A+] {@linkplain ManagedPromise implementation} that is deeply + * a [Promises/A+] {@linkplain ManagedPromise implementation} that is deeply * integrated with the ControlFlow. First and foremost, each promise * {@linkplain ManagedPromise#then() callback} is scheduled with the * control flow as a task. As a result, each callback is invoked in its own turn @@ -328,7 +327,7 @@ * Even though a subtask's promised result will never resolve while the task * function is on the stack, it will be treated as a promise resolved within the * task. In all other scenarios, a task's promise behaves just like a normal - * promise. In the sample below, `C/D` is loggged before `B` because the + * promise. In the sample below, `C/D` is logged before `B` because the * resolution of `subtask1` interrupts the flow of the enclosing task. Within * the final subtask, `E/F` is logged in order because `subtask1` is a resolved * promise when that task runs. @@ -467,17 +466,17 @@ * * ES6 promises do not require users to handle a promise rejections. This can * result in subtle bugs as the rejections are silently "swallowed" by the - * ManagedPromise class. + * Promise class. * - * ManagedPromise.reject(Error('boom')); + * Promise.reject(Error('boom')); * // ... *crickets* ... * * Selenium's promise module, on the other hand, requires that every rejection * be explicitly handled. When a {@linkplain ManagedPromise ManagedPromise} is * rejected and no callbacks are defined on that promise, it is considered an - * _unhandled rejection_ and reproted to the active task queue. If the rejection + * _unhandled rejection_ and reported to the active task queue. If the rejection * remains unhandled after a single turn of the [event loop][JSEL] (scheduled - * with a micro-task), it will propagate up the stack. + * with a microtask), it will propagate up the stack. * * ## Error Propagation * @@ -534,7 +533,7 @@ * * When a subtask is discarded due to an unreported rejection in its parent * frame, the existing callbacks on that task will never settle and the - * callbacks will not be invoked. If a new callback is attached ot the subtask + * callbacks will not be invoked. If a new callback is attached to the subtask * _after_ it has been discarded, it is handled the same as adding a callback * to a cancelled promise: the error-callback path is invoked. This behavior is * intended to handle cases where the user saves a reference to a task promise, @@ -582,9 +581,9 @@ * * Bottom line: you __*must*__ handle rejected promises. * - * # ManagedPromise/A+ Compatibility + * # Promises/A+ Compatibility * - * This `promise` module is compliant with the [ManagedPromise/A+][] specification + * This `promise` module is compliant with the [Promises/A+] specification * except for sections `2.2.6.1` and `2.2.6.2`: * * > @@ -595,10 +594,10 @@ * > must execute in the order of their originating calls to `then`. * > * - * Specifically, the conformance tests contains the following scenario (for + * Specifically, the conformance tests contain the following scenario (for * brevity, only the fulfillment version is shown): * - * var p1 = ManagedPromise.resolve(); + * var p1 = Promise.resolve(); * p1.then(function() { * console.log('A'); * p1.then(() => console.log('B')); @@ -609,7 +608,7 @@ * // B * * Since the [ControlFlow](#scheduling_callbacks) executes promise callbacks as - * tasks, with this module, the result would be + * tasks, with this module, the result would be: * * var p2 = promise.fulfilled(); * p2.then(function() { @@ -623,7 +622,8 @@ * * [JSEL]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop * [GF]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function* - * [ManagedPromise/A+]: https://promisesaplus.com/ + * [Promises/A+]: https://promisesaplus.com/ + * [MicrotasksArticle]: https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/ */ 'use strict'; @@ -667,7 +667,7 @@ function getUid(obj) { /** - * Runs the given function after a micro-task yield. + * Runs the given function after a microtask yield. * @param {function()} fn The function to run. */ function asyncRun(fn) { @@ -942,7 +942,7 @@ class Thenable { /** * Marker interface for objects that allow consumers to request the cancellation - * of a promies-based operation. A cancelled promise will be rejected with a + * of a promise-based operation. A cancelled promise will be rejected with a * {@link CancellationError}. * * This interface is considered package-private and should not be used outside @@ -1003,6 +1003,9 @@ const PromiseState = { */ const ON_CANCEL_HANDLER = new WeakMap; +const SKIP_LOG = Symbol('skip-log'); +const FLOW_LOG = logging.getLogger('promise.ControlFlow'); + /** * Represents the eventual value of a completed operation. Each promise may be @@ -1025,14 +1028,29 @@ class ManagedPromise { * functions, one for fulfilling the promise and another for rejecting it. * @param {ControlFlow=} opt_flow The control flow * this instance was created under. Defaults to the currently active flow. + * @param {?=} opt_skipLog An internal parameter used to skip logging the + * creation of this promise. This parameter has no effect unless it is + * strictly equal to an internal symbol. In other words, this parameter + * is always ignored for external code. */ - constructor(resolver, opt_flow) { + constructor(resolver, opt_flow, opt_skipLog) { if (!usePromiseManager()) { throw TypeError( 'Unable to create a managed promise instance: the promise manager has' + ' been disabled by the SELENIUM_PROMISE_MANAGER environment' + ' variable: ' + process.env['SELENIUM_PROMISE_MANAGER']); + } else if (opt_skipLog !== SKIP_LOG) { + FLOW_LOG.warning(() => { + let e = + captureStackTrace( + 'ManagedPromiseError', + 'Creating a new managed Promise. This call will fail when the' + + ' promise manager is disabled', + ManagedPromise) + return e.stack; + }); } + getUid(this); /** @private {!ControlFlow} */ @@ -1308,7 +1326,7 @@ class ManagedPromise { * @param {!Function} fn The function to use as the top of the stack when * recording the callback's creation point. * @return {!ManagedPromise} A new promise which will be resolved with the - * esult of the invoked callback. + * result of the invoked callback. * @template R * @private */ @@ -1383,6 +1401,37 @@ function isPending(promise) { } +/** + * Structural interface for a deferred promise resolver. + * @record + * @template T + */ +function Resolver() {} + + +/** + * The promised value for this resolver. + * @type {!Thenable} + */ +Resolver.prototype.promise; + + +/** + * Resolves the promised value with the given `value`. + * @param {T|Thenable} value + * @return {void} + */ +Resolver.prototype.resolve; + + +/** + * Rejects the promised value with the given `reason`. + * @param {*} reason + * @return {void} + */ +Resolver.prototype.reject; + + /** * Represents a value that will be resolved at some point in the future. This * class represents the protected "producer" half of a ManagedPromise - each Deferred @@ -1395,20 +1444,25 @@ function isPending(promise) { * {@link ControlFlow} as an unhandled failure. * * @template T + * @implements {Resolver} */ class Deferred { /** * @param {ControlFlow=} opt_flow The control flow this instance was * created under. This should only be provided during unit tests. + * @param {?=} opt_skipLog An internal parameter used to skip logging the + * creation of this promise. This parameter has no effect unless it is + * strictly equal to an internal symbol. In other words, this parameter + * is always ignored for external code. */ - constructor(opt_flow) { + constructor(opt_flow, opt_skipLog) { var fulfill, reject; /** @type {!ManagedPromise} */ this.promise = new ManagedPromise(function(f, r) { fulfill = f; reject = r; - }, opt_flow); + }, opt_flow, opt_skipLog); var self = this; var checkNotSelf = function(value) { @@ -1421,16 +1475,24 @@ class Deferred { * Resolves this deferred with the given value. It is safe to call this as a * normal function (with no bound "this"). * @param {(T|IThenable|Thenable)=} opt_value The fulfilled value. + * @const */ - this.fulfill = function(opt_value) { + this.resolve = function(opt_value) { checkNotSelf(opt_value); fulfill(opt_value); }; + /** + * An alias for {@link #resolve}. + * @const + */ + this.fulfill = this.resolve; + /** * Rejects this promise with the given reason. It is safe to call this as a * normal function (with no bound "this"). * @param {*=} opt_reason The rejection reason. + * @const */ this.reject = function(opt_reason) { checkNotSelf(opt_reason); @@ -1487,36 +1549,76 @@ function delayed(ms) { /** - * Creates a new deferred object. - * @return {!Deferred} The new deferred object. + * Creates a new deferred resolver. + * + * If the promise manager is currently enabled, this function will return a + * {@link Deferred} instance. Otherwise, it will return a resolver for a + * {@linkplain NativePromise native promise}. + * + * @return {!Resolver} A new deferred resolver. * @template T */ function defer() { - return new Deferred(); + if (usePromiseManager()) { + return new Deferred(); + } + let resolve, reject; + let promise = new NativePromise((_resolve, _reject) => { + resolve = _resolve; + reject = _reject; + }); + return {promise, resolve, reject}; } /** * Creates a promise that has been resolved with the given value. + * + * If the promise manager is currently enabled, this function will return a + * {@linkplain ManagedPromise managed promise}. Otherwise, it will return a + * {@linkplain NativePromise native promise}. + * * @param {T=} opt_value The resolved value. - * @return {!ManagedPromise} The resolved promise. - * @deprecated Use {@link ManagedPromise#resolve Promise.resolve(value)}. + * @return {!Thenable} The resolved promise. * @template T */ function fulfilled(opt_value) { - return ManagedPromise.resolve(opt_value); + let ctor = usePromiseManager() ? ManagedPromise : NativePromise; + if (opt_value instanceof ctor) { + return /** @type {!Thenable} */(opt_value); + } + + if (usePromiseManager()) { + // We can skip logging warnings about creating a managed promise because + // this function will automatically switch to use a native promise when + // the promise manager is disabled. + return new ManagedPromise( + resolve => resolve(opt_value), undefined, SKIP_LOG); + } + return NativePromise.resolve(opt_value); } /** * Creates a promise that has been rejected with the given reason. + * + * If the promise manager is currently enabled, this function will return a + * {@linkplain ManagedPromise managed promise}. Otherwise, it will return a + * {@linkplain NativePromise native promise}. + * * @param {*=} opt_reason The rejection reason; may be any value, but is * usually an Error or a string. - * @return {!ManagedPromise} The rejected promise. - * @deprecated Use {@link ManagedPromise#reject Promise.reject(reason)}. + * @return {!Thenable} The rejected promise. */ function rejected(opt_reason) { - return ManagedPromise.reject(opt_reason); + if (usePromiseManager()) { + // We can skip logging warnings about creating a managed promise because + // this function will automatically switch to use a native promise when + // the promise manager is disabled. + return new ManagedPromise( + (_, reject) => reject(opt_reason), undefined, SKIP_LOG); + } + return NativePromise.reject(opt_reason); } @@ -1610,21 +1712,17 @@ function thenFinally(promise, callback) { * @param {Function=} opt_errback The function to call when the value is * rejected. * @return {!Thenable} A new promise. + * @deprecated Use `promise.fulfilled(value).then(opt_callback, opt_errback)` */ function when(value, opt_callback, opt_errback) { - if (Thenable.isImplementation(value)) { - return value.then(opt_callback, opt_errback); - } - - return createPromise(resolve => resolve(value)) - .then(opt_callback, opt_errback); + return fulfilled(value).then(opt_callback, opt_errback); } /** * Invokes the appropriate callback function as soon as a promised `value` is - * resolved. This function is similar to `when()`, except it does not return - * a new promise. + * resolved. + * * @param {*} value The value to observe. * @param {Function} callback The function to call when the value is * resolved successfully. @@ -1826,7 +1924,7 @@ function filter(arr, fn, opt_self) { */ function fullyResolved(value) { if (isPromise(value)) { - return when(value, fullyResolveValue); + return fulfilled(value).then(fullyResolveValue); } return fullyResolveValue(value); } @@ -1973,7 +2071,7 @@ class Scheduler { /** * Schedules a task to wait for a condition to hold. * - * If the condition is defined as a function, it may return any value. Promies + * If the condition is defined as a function, it may return any value. Promise * will be resolved before testing if the condition holds (resolution time * counts towards the timeout). Once resolved, values are always evaluated as * booleans. @@ -1997,7 +2095,7 @@ class Scheduler { * @param {string=} opt_message An optional error message to include if the * wait times out; defaults to the empty string. * @return {!Thenable} A promise that will be fulfilled - * when the condition has been satisified. The promise shall be rejected + * when the condition has been satisfied. The promise shall be rejected * if the wait times out waiting for the condition. * @throws {TypeError} If condition is not a function or promise or if timeout * is not a number >= 0. @@ -2018,6 +2116,10 @@ function usePromiseManager() { /** + * Creates a new promise with the given `resolver` function. If the promise + * manager is currently enabled, the returned promise will be a + * {@linkplain ManagedPromise} instance. Otherwise, it will be a native promise. + * * @param {function( * function((T|IThenable|Thenable|null)=), * function(*=))} resolver @@ -2040,7 +2142,7 @@ function createPromise(resolver) { * @param {string=} opt_message An optional error message to include if the * wait times out; defaults to the empty string. * @return {!Thenable} A promise that will be fulfilled - * when the condition has been satisified. The promise shall be rejected + * when the condition has been satisfied. The promise shall be rejected * if the wait times out waiting for the condition. * @throws {TypeError} If condition is not a function or promise or if timeout * is not a number >= 0. @@ -2164,7 +2266,7 @@ const SIMPLE_SCHEDULER = new SimpleScheduler; /** * Handles the execution of scheduled tasks, each of which may be an * asynchronous operation. The control flow will ensure tasks are executed in - * the ordered scheduled, starting each task only once those before it have + * the order scheduled, starting each task only once those before it have * completed. * * Each task scheduled within this flow may return a {@link ManagedPromise} to @@ -2172,21 +2274,21 @@ const SIMPLE_SCHEDULER = new SimpleScheduler; * promises to be resolved before marking the task as completed. * * Tasks and each callback registered on a {@link ManagedPromise} will be run - * in their own ControlFlow frame. Any tasks scheduled within a frame will take + * in their own ControlFlow frame. Any tasks scheduled within a frame will take * priority over previously scheduled tasks. Furthermore, if any of the tasks in * the frame fail, the remainder of the tasks in that frame will be discarded * and the failure will be propagated to the user through the callback/task's * promised result. * * Each time a ControlFlow empties its task queue, it will fire an - * {@link ControlFlow.EventType.IDLE IDLE} event. Conversely, - * whenever the flow terminates due to an unhandled error, it will remove all + * {@link ControlFlow.EventType.IDLE IDLE} event. Conversely, whenever + * the flow terminates due to an unhandled error, it will remove all * remaining tasks in its queue and fire an * {@link ControlFlow.EventType.UNCAUGHT_EXCEPTION UNCAUGHT_EXCEPTION} event. * If there are no listeners registered with the flow, the error will be * rethrown to the global error handler. * - * Refer to the {@link ./promise} module documentation for a detailed + * Refer to the {@link ./promise} module documentation for a detailed * explanation of how the ControlFlow coordinates task execution. * * @implements {Scheduler} @@ -2212,7 +2314,7 @@ class ControlFlow extends events.EventEmitter { this.taskQueues_ = null; /** - * Micro task that controls shutting down the control flow. Upon shut down, + * Microtask that controls shutting down the control flow. Upon shut down, * the flow will emit an * {@link ControlFlow.EventType.IDLE} event. Idle events * always follow a brief timeout in order to catch latent errors from the @@ -2221,8 +2323,8 @@ class ControlFlow extends events.EventEmitter { * by the promise system until the next turn of the event loop: * * // Schedule 1 task that fails. - * var result = promise.controlFlow().schedule('example', - * function() { return promise.rejected('failed'); }); + * var result = promise.controlFlow().execute( + * () => promise.rejected('failed'), 'example'); * // Set a callback on the result. This delays reporting the unhandled * // failure for 1 turn of the event loop. * result.then(function() {}); @@ -2246,7 +2348,7 @@ class ControlFlow extends events.EventEmitter { /** * Returns a string representation of this control flow, which is its current * {@linkplain #getSchedule() schedule}, sans task stack traces. - * @return {string} The string representation of this contorl flow. + * @return {string} The string representation of this control flow. * @override */ toString() { @@ -2258,8 +2360,7 @@ class ControlFlow extends events.EventEmitter { * control flow stack and cause rejections within parent tasks. If error * propagation is disabled, tasks will not be aborted when an unhandled * promise rejection is detected, but the rejection _will_ trigger an - * {@link ControlFlow.EventType.UNCAUGHT_EXCEPTION} - * event. + * {@link ControlFlow.EventType.UNCAUGHT_EXCEPTION} event. * * The default behavior is to propagate all unhandled rejections. _The use * of this option is highly discouraged._ @@ -2293,7 +2394,7 @@ class ControlFlow extends events.EventEmitter { * {@code opt_includeStackTraces === true}, the string will include the * stack trace from when each task was scheduled. * @param {string=} opt_includeStackTraces Whether to include the stack traces - * from when each task was scheduled. Defaults to false. + * from when each task was scheduled. Defaults to false. * @return {string} String representation of this flow's internal state. */ getSchedule(opt_includeStackTraces) { @@ -2345,7 +2446,7 @@ class ControlFlow extends events.EventEmitter { } /** - * Returns the currently actively task queue for this flow. If there is no + * Returns the currently active task queue for this flow. If there is no * active queue, one will be created. * @return {!TaskQueue} the currently active task queue for this flow. * @private @@ -2377,15 +2478,31 @@ class ControlFlow extends events.EventEmitter { } if (!this.hold_) { - var holdIntervalMs = 2147483647; // 2^31-1; max timer length for Node.js + let holdIntervalMs = 2147483647; // 2^31-1; max timer length for Node.js this.hold_ = setInterval(function() {}, holdIntervalMs); } - var task = new Task( + let task = new Task( this, fn, opt_description || '', - {name: 'Task', top: ControlFlow.prototype.execute}); + {name: 'Task', top: ControlFlow.prototype.execute}, + true); + + let q = this.getActiveQueue_(); + + for (let i = q.tasks_.length; i > 0; i--) { + let previousTask = q.tasks_[i - 1]; + if (previousTask.userTask_) { + FLOW_LOG.warning(() => { + return `Detected scheduling of an unchained task. +When the promise manager is disabled, unchained tasks will not wait for +previously scheduled tasks to finish before starting to execute. +New task: ${task.promise.stack_.stack} +Previous task: ${previousTask.promise.stack_.stack}`.split(/\n/).join('\n '); + }); + break; + } + } - var q = this.getActiveQueue_(); q.enqueue(task); this.emit(ControlFlow.EventType.SCHEDULE_TASK, task.description); return task.promise; @@ -2393,7 +2510,7 @@ class ControlFlow extends events.EventEmitter { /** @override */ promise(resolver) { - return new ManagedPromise(resolver, this); + return new ManagedPromise(resolver, this, SKIP_LOG); } /** @override */ @@ -2622,7 +2739,7 @@ class MicroTask { } /** - * Runs the given function after a micro-task yield. + * Runs the given function after a microtask yield. * @param {function()} fn The function to run. */ static run(fn) { @@ -2662,9 +2779,11 @@ class Task extends Deferred { * @param {string} description A description of the task for debugging. * @param {{name: string, top: !Function}=} opt_stackOptions Options to use * when capturing the stacktrace for when this task was created. + * @param {boolean=} opt_isUserTask Whether this task was explicitly scheduled + * by the use of the promise manager. */ - constructor(flow, fn, description, opt_stackOptions) { - super(flow); + constructor(flow, fn, description, opt_stackOptions, opt_isUserTask) { + super(flow, SKIP_LOG); getUid(this); /** @type {function(): (T|!ManagedPromise)} */ @@ -2676,6 +2795,9 @@ class Task extends Deferred { /** @type {TaskQueue} */ this.queue = null; + /** @private @const {boolean} */ + this.userTask_ = !!opt_isUserTask; + /** * Whether this task is considered block. A blocked task may be registered * in a task queue, but will be dropped if it is still blocked when it @@ -2889,7 +3011,7 @@ class TaskQueue extends events.EventEmitter { } // Now that all of the remaining tasks have been silently cancelled (e.g. no - // exisitng callbacks on those tasks will fire), clear the silence bit on + // existing callbacks on those tasks will fire), clear the silence bit on // the cancellation error. This ensures additional callbacks registered in // the future will actually execute. cancellation.silent_ = false; @@ -2935,7 +3057,7 @@ class TaskQueue extends events.EventEmitter { this.subQ_.once('end', () => { // On task completion. this.subQ_ = null; - this.pending_ && this.pending_.task.fulfill(result); + this.pending_ && this.pending_.task.resolve(result); }); this.subQ_.once('error', e => { // On task failure. @@ -3068,7 +3190,7 @@ class TaskQueue extends events.EventEmitter { } return task; } -}; +} @@ -3214,7 +3336,7 @@ function consume(generatorFn, opt_self, ...var_args) { function pump(fn, opt_arg) { if (ret instanceof ManagedPromise && !isPending(ret)) { - return; // Defererd was cancelled; silently abort. + return; // Deferred was cancelled; silently abort. } try { @@ -3246,6 +3368,7 @@ module.exports = { MultipleUnhandledRejectionError: MultipleUnhandledRejectionError, Thenable: Thenable, Promise: ManagedPromise, + Resolver: Resolver, Scheduler: Scheduler, all: all, asap: asap, @@ -3254,6 +3377,7 @@ module.exports = { consume: consume, controlFlow: controlFlow, createFlow: createFlow, + createPromise: createPromise, defer: defer, delayed: delayed, filter: filter, @@ -3275,7 +3399,7 @@ module.exports = { * The promise manager is currently enabled by default, but may be disabled * by setting the environment variable `SELENIUM_PROMISE_MANAGER=0` or by * setting this property to false. Setting this property will always take - * precedence ove the use of the environment variable. + * precedence over the use of the environment variable. * * @return {boolean} Whether the promise manager is enabled. * @see diff --git a/node_modules/selenium-webdriver/lib/symbols.js b/node_modules/selenium-webdriver/lib/symbols.js index d5c62504e..6c7cd1d9d 100644 --- a/node_modules/selenium-webdriver/lib/symbols.js +++ b/node_modules/selenium-webdriver/lib/symbols.js @@ -30,7 +30,7 @@ module.exports = { * available, the serialize method will return a promise that will be resolved * with the serialized form. * - * Note that the described method is analgous to objects that define a + * Note that the described method is analogous to objects that define a * `toJSON()` method, except the serialized result may be a promise, or * another object with a promised property. */ diff --git a/node_modules/selenium-webdriver/lib/test/index.js b/node_modules/selenium-webdriver/lib/test/index.js index ba34ddab4..b3275ccbb 100644 --- a/node_modules/selenium-webdriver/lib/test/index.js +++ b/node_modules/selenium-webdriver/lib/test/index.js @@ -24,6 +24,7 @@ var build = require('./build'), webdriver = require('../../'), flow = webdriver.promise.controlFlow(), firefox = require('../../firefox'), + logging = require('../../lib/logging'), safari = require('../../safari'), remote = require('../../remote'), testing = require('../../testing'), @@ -56,6 +57,11 @@ var noMarionette = /^0|false$/i.test(process.env['SELENIUM_GECKODRIVER']); var startServer = !!serverJar && !remoteUrl; var nativeRun = !serverJar && !remoteUrl; +if (/^1|true$/i.test(process.env['SELENIUM_VERBOSE'])) { + logging.installConsoleHandler(); + logging.getLogger('webdriver.http').setLevel(logging.Level.ALL); +} + var browsersToTest = (function() { var permitRemoteBrowsers = !!remoteUrl || !!serverJar; var permitUnknownBrowsers = !nativeRun; diff --git a/node_modules/selenium-webdriver/lib/until.js b/node_modules/selenium-webdriver/lib/until.js index 0cc6f5ea3..b0e68b88b 100644 --- a/node_modules/selenium-webdriver/lib/until.js +++ b/node_modules/selenium-webdriver/lib/until.js @@ -72,7 +72,7 @@ const webdriver = require('./webdriver'), exports.ableToSwitchToFrame = function ableToSwitchToFrame(frame) { var condition; if (typeof frame === 'number' || frame instanceof webdriver.WebElement) { - condition = attemptToSwitchFrames; + condition = driver => attemptToSwitchFrames(driver, frame); } else { condition = function(driver) { let locator = /** @type {!(By|Function)} */(frame); diff --git a/node_modules/selenium-webdriver/lib/webdriver.js b/node_modules/selenium-webdriver/lib/webdriver.js index 081d77bda..c8d04e82a 100644 --- a/node_modules/selenium-webdriver/lib/webdriver.js +++ b/node_modules/selenium-webdriver/lib/webdriver.js @@ -457,12 +457,12 @@ class IWebDriver { * while evaluating the condition, they will be allowed to propagate. In the * event a condition returns a {@link promise.Promise promise}, the polling * loop will wait for it to be resolved and use the resolved value for whether - * the condition has been satisified. Note the resolution time for a promise + * the condition has been satisfied. Note the resolution time for a promise * is factored into whether a wait has timed out. * * Note, if the provided condition is a {@link WebElementCondition}, then * the wait will return a {@link WebElementPromise} that will resolve to the - * element that satisified the condition. + * element that satisfied the condition. * * _Example:_ waiting up to 10 seconds for an element to be present on the * page. @@ -779,7 +779,7 @@ class WebDriver { 'WebDriver.createSession()'); if (typeof opt_onQuit === 'function') { session = session.catch(err => { - return Promise.resolve(opt_onQuit.call(void 0)).then(_ => {throw err}); + return Promise.resolve(opt_onQuit.call(void 0)).then(_ => {throw err;}); }); } const ctor = opt_ctor || WebDriver; @@ -850,7 +850,7 @@ class WebDriver { new command.Command(command.Name.QUIT), 'WebDriver.quit()'); // Delete our session ID when the quit command finishes; this will allow us - // to throw an error when attemnpting to use a driver post-quit. + // to throw an error when attempting to use a driver post-quit. return /** @type {!promise.Thenable} */(promise.finally(result, () => { this.session_ = this.flow_.promise((_, reject) => { reject(new error.NoSuchSessionError( @@ -1181,7 +1181,7 @@ class Navigation { /** * Provides methods for managing browser and driver state. * - * This class should never be instantiated directly. Insead, obtain an instance + * This class should never be instantiated directly. Instead, obtain an instance * with {@linkplain WebDriver#manage() webdriver.manage()}. */ class Options { @@ -1427,7 +1427,7 @@ Options.Cookie.prototype.expiry; /** * An interface for managing timeout behavior for WebDriver instances. * - * This class should never be instantiated directly. Insead, obtain an instance + * This class should never be instantiated directly. Instead, obtain an instance * with * * webdriver.manage().timeouts() @@ -2009,7 +2009,7 @@ class WebElement { * this instance. * * Modifier keys (SHIFT, CONTROL, ALT, META) are stateful; once a modifier is - * processed in the keysequence, that key state is toggled until one of the + * processed in the key sequence, that key state is toggled until one of the * following occurs: * * - The modifier key is encountered again in the sequence. At this point the @@ -2028,13 +2028,13 @@ class WebElement { * Key.chord(Key.CONTROL, "a"), * "now text is"); * - * - The end of the keysequence is encountered. When there are no more keys + * - The end of the key sequence is encountered. When there are no more keys * to type, all depressed modifier keys are released (with accompanying * keyup events). * * If this element is a file input ({@code }), the * specified key sequence should specify the path to the file to attach to - * the element. This is analgous to the user clicking "Browse..." and entering + * the element. This is analogous to the user clicking "Browse..." and entering * the path into the file select dialog. * * var form = driver.findElement(By.css('form')); @@ -2050,7 +2050,7 @@ class WebElement { * * __Note:__ On browsers where native keyboard events are not supported * (e.g. Firefox on OS X), key events will be synthesized. Special - * punctionation keys will be synthesized according to a standard QWERTY en-us + * punctuation keys will be synthesized according to a standard QWERTY en-us * keyboard layout. * * @param {...(number|string|!IThenable<(number|string)>)} var_args The @@ -2214,7 +2214,7 @@ class WebElement { /** * Schedules a command to query whether the DOM element represented by this - * instance is enabled, as dicted by the {@code disabled} attribute. + * instance is enabled, as dictated by the {@code disabled} attribute. * @return {!promise.Thenable} A promise that will be * resolved with whether this element is currently enabled. */ @@ -2327,7 +2327,7 @@ class WebElementPromise extends WebElement { if (promise.CancellableThenable.isImplementation(el)) { /** @type {!promise.CancellableThenable} */(el).cancel(opt_reason); } - } + }; /** @override */ this.then = el.then.bind(el); diff --git a/node_modules/selenium-webdriver/opera.js b/node_modules/selenium-webdriver/opera.js index cc84f2af5..5107bae4e 100644 --- a/node_modules/selenium-webdriver/opera.js +++ b/node_modules/selenium-webdriver/opera.js @@ -62,7 +62,7 @@ * var options = new opera.Options(); * // configure browser options ... * - * var driver = new opera.Driver(options, service); + * var driver = opera.Driver.createSession(options, service); * * Users should only instantiate the {@link Driver} class directly when they * need a custom driver service configuration (as shown above). For normal diff --git a/node_modules/selenium-webdriver/package.json b/node_modules/selenium-webdriver/package.json index 5c3935833..dfb557bf4 100644 --- a/node_modules/selenium-webdriver/package.json +++ b/node_modules/selenium-webdriver/package.json @@ -1,6 +1,6 @@ { "name": "selenium-webdriver", - "version": "3.0.1", + "version": "3.3.0", "description": "The official WebDriver JavaScript bindings from the Selenium project", "license": "Apache-2.0", "keywords": [ diff --git a/node_modules/selenium-webdriver/remote/index.js b/node_modules/selenium-webdriver/remote/index.js index 87dee7e8d..cc0b66462 100644 --- a/node_modules/selenium-webdriver/remote/index.js +++ b/node_modules/selenium-webdriver/remote/index.js @@ -492,7 +492,12 @@ class SeleniumServer extends DriverService { return jvmArgs.concat('-jar', jar, '-port', port).concat(args); }); - super('java', { + let java = 'java'; + if (process.env['JAVA_HOME']) { + java = path.join(process.env['JAVA_HOME'], 'bin/java'); + } + + super(java, { loopback: options.loopback, port: port, args: args, diff --git a/node_modules/selenium-webdriver/safari.js b/node_modules/selenium-webdriver/safari.js index 97d512bc7..5a57387c1 100644 --- a/node_modules/selenium-webdriver/safari.js +++ b/node_modules/selenium-webdriver/safari.js @@ -68,7 +68,7 @@ class ServiceBuilder extends remote.DriverService.Builder { const OPTIONS_CAPABILITY_KEY = 'safari.options'; - +const TECHNOLOGY_PREVIEW_OPTIONS_KEY = 'technologyPreview'; /** * Configuration options specific to the {@link Driver SafariDriver}. @@ -89,16 +89,17 @@ class Options { * Extracts the SafariDriver specific options from the given capabilities * object. * @param {!Capabilities} capabilities The capabilities object. - * @return {!Options} The ChromeDriver options. + * @return {!Options} The SafariDriver options. */ static fromCapabilities(capabilities) { var options = new Options(); - var o = capabilities.get(OPTIONS_CAPABILITY_KEY); + if (o instanceof Options) { options = o; } else if (o) { options.setCleanSession(o.cleanSession); + options.setTechnologyPreview(o[TECHNOLOGY_PREVIEW_OPTIONS_KEY]); } if (capabilities.has(Capability.PROXY)) { @@ -148,6 +149,22 @@ class Options { return this; } + /** + * Instruct the SafariDriver to use the Safari Technology Preview if true. + * Otherwise, use the release version of Safari. Defaults to using the release version of Safari. + * + * @param {boolean} useTechnologyPreview + * @return {!Options} A self reference. + */ + setTechnologyPreview(useTechnologyPreview) { + if (!this.options_) { + this.options_ = {}; + } + + this.options_[TECHNOLOGY_PREVIEW_OPTIONS_KEY] = !!useTechnologyPreview; + return this; + } + /** * Converts this options instance to a {@link Capabilities} object. * @param {Capabilities=} opt_capabilities The capabilities to @@ -179,6 +196,23 @@ class Options { } } +/** + * @param {(Options|Object)=} o The options object + * @return {boolean} + */ +function useTechnologyPreview(o) { + if (o instanceof Options) { + return !!(o.options_ && o.options_[TECHNOLOGY_PREVIEW_OPTIONS_KEY]); + } + + if (o && typeof o === 'object') { + return !!o[TECHNOLOGY_PREVIEW_OPTIONS_KEY]; + } + + return false; +} + +const SAFARIDRIVER_TECHNOLOGY_PREVIEW_EXE = '/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver'; /** * A WebDriver client for Safari. This class should never be instantiated @@ -200,14 +234,19 @@ class Driver extends webdriver.WebDriver { * @return {!Driver} A new driver instance. */ static createSession(opt_config, opt_flow) { - let caps; + let caps, exe; + if (opt_config instanceof Options) { caps = opt_config.toCapabilities(); } else { - caps = opt_config || Capabilities.safari() + caps = opt_config || Capabilities.safari(); + } + + if (useTechnologyPreview(caps.get(OPTIONS_CAPABILITY_KEY))) { + exe = SAFARIDRIVER_TECHNOLOGY_PREVIEW_EXE; } - let service = new ServiceBuilder().build(); + let service = new ServiceBuilder(exe).build(); let executor = new http.Executor( service.start().then(url => new http.HttpClient(url))); diff --git a/node_modules/selenium-webdriver/test/firefox/firefox_test.js b/node_modules/selenium-webdriver/test/firefox/firefox_test.js index 485964f91..dbf9910fa 100644 --- a/node_modules/selenium-webdriver/test/firefox/firefox_test.js +++ b/node_modules/selenium-webdriver/test/firefox/firefox_test.js @@ -26,6 +26,8 @@ var firefox = require('../../firefox'), Context = require('../../firefox').Context, error = require('../..').error; +var {consume} = require('../../lib/promise'); + var JETPACK_EXTENSION = path.join(__dirname, '../../lib/test/data/firefox/jetpack-sample.xpi'); @@ -53,9 +55,7 @@ test.suite(function(env) { * skipped if dev cannot be found on the current system. */ function runWithFirefoxDev(options, testFn) { - let binary = new firefox.Binary(); - binary.useDevEdition(); - return binary.locate().then(exe => { + return firefox.Channel.AURORA.locate().then(exe => { options.setBinary(exe); driver = env.builder() .setFirefoxOptions(options) @@ -67,21 +67,33 @@ test.suite(function(env) { }); } - test.it('can start Firefox with custom preferences', function*() { - var profile = new firefox.Profile(); - profile.setPreference('general.useragent.override', 'foo;bar'); + describe('can start Firefox with custom preferences', function() { + function runTest(opt_dir) { + return consume(function*() { + let profile = new firefox.Profile(opt_dir); + profile.setPreference('general.useragent.override', 'foo;bar'); + + let options = new firefox.Options().setProfile(profile); + + driver = env.builder(). + setFirefoxOptions(options). + build(); - var options = new firefox.Options().setProfile(profile); + yield driver.get('data:text/html,
content
'); - driver = env.builder(). - setFirefoxOptions(options). - build(); + var userAgent = yield driver.executeScript( + 'return window.navigator.userAgent'); + assert(userAgent).equalTo('foo;bar'); + }); + } - yield driver.get('data:text/html,
content
'); + test.it('profile created from scratch', function() { + return runTest(); + }); - var userAgent = yield driver.executeScript( - 'return window.navigator.userAgent'); - assert(userAgent).equalTo('foo;bar'); + test.it('profile created from template', function() { + return io.tmpDir().then(runTest); + }); }); test.it('can start Firefox with a jetpack extension', function() { diff --git a/node_modules/selenium-webdriver/test/lib/http_test.js b/node_modules/selenium-webdriver/test/lib/http_test.js index 1c6c073ad..2dd27869d 100644 --- a/node_modules/selenium-webdriver/test/lib/http_test.js +++ b/node_modules/selenium-webdriver/test/lib/http_test.js @@ -325,6 +325,37 @@ describe('http', function() { assert.ok(executor.w3c, 'should never downgrade'); }); }); + + it('handles legacy new session failures', function() { + let rawResponse = { + status: error.ErrorCode.NO_SUCH_ELEMENT, + value: {message: 'hi'} + }; + + send.returns(Promise.resolve( + new http.Response(500, {}, JSON.stringify(rawResponse)))); + + return executor.execute(command) + .then(() => assert.fail('should have failed'), + e => { + assert.ok(e instanceof error.NoSuchElementError); + assert.equal(e.message, 'hi'); + }); + }); + + it('handles w3c new session failures', function() { + let rawResponse = {error: 'no such element', message: 'oops'}; + + send.returns(Promise.resolve( + new http.Response(500, {}, JSON.stringify(rawResponse)))); + + return executor.execute(command) + .then(() => assert.fail('should have failed'), + e => { + assert.ok(e instanceof error.NoSuchElementError); + assert.equal(e.message, 'oops'); + }); + }); }); describe('extracts Session from DESCRIBE_SESSION response', function() { diff --git a/node_modules/selenium-webdriver/test/lib/promise_test.js b/node_modules/selenium-webdriver/test/lib/promise_test.js index 96d2ccc22..8da1cd89e 100644 --- a/node_modules/selenium-webdriver/test/lib/promise_test.js +++ b/node_modules/selenium-webdriver/test/lib/promise_test.js @@ -301,6 +301,25 @@ describe('promise', function() { }); promiseManagerSuite(() => { + describe('fulfilled', function() { + it('returns input value if it is already a valid promise', function() { + let p = promise.createPromise(function() {}); + let r = promise.fulfilled(p); + assert.strictEqual(p, r); + }); + + it('creates a new promise fulfilled with input', function() { + return promise.fulfilled(1234).then(v => assert.equal(1234, v)); + }); + + it('can convert thenables to valid promise', function() { + let thenable = {then: function(cb) {cb(1234)}}; + let p = promise.fulfilled(thenable); + assert.notStrictEqual(thenable, p); + return p.then(v => assert.equal(1234, v)); + }); + }); + describe('when', function() { it('ReturnsAResolvedPromiseIfGivenANonPromiseValue', function() { var ret = promise.when('abc'); diff --git a/node_modules/selenium-webdriver/test/lib/until_test.js b/node_modules/selenium-webdriver/test/lib/until_test.js index 31b2b32ad..3226a467a 100644 --- a/node_modules/selenium-webdriver/test/lib/until_test.js +++ b/node_modules/selenium-webdriver/test/lib/until_test.js @@ -70,39 +70,54 @@ describe('until', function() { .then(fail, (e2) => assert.strictEqual(e2, e)); }); + const ELEMENT_ID = 'some-element-id'; + const ELEMENT_INDEX = 1234; + + function onSwitchFrame(expectedId) { + if (typeof expectedId === 'string') { + expectedId = WebElement.buildId(expectedId); + } else { + assert.equal(typeof expectedId, 'number', 'must be string or number'); + } + return cmd => { + assert.deepEqual( + cmd.getParameter('id'), expectedId, 'frame ID not specified'); + return true; + }; + } + it('byIndex', function() { - executor.on(CommandName.SWITCH_TO_FRAME, () => true); - return driver.wait(until.ableToSwitchToFrame(0), 100); + executor.on(CommandName.SWITCH_TO_FRAME, onSwitchFrame(ELEMENT_INDEX)); + return driver.wait(until.ableToSwitchToFrame(ELEMENT_INDEX), 100); }); it('byWebElement', function() { - executor.on(CommandName.SWITCH_TO_FRAME, () => true); - var el = new webdriver.WebElement(driver, {ELEMENT: 1234}); + executor.on(CommandName.SWITCH_TO_FRAME, onSwitchFrame(ELEMENT_ID)); + + var el = new webdriver.WebElement(driver, ELEMENT_ID); return driver.wait(until.ableToSwitchToFrame(el), 100); }); it('byWebElementPromise', function() { - executor.on(CommandName.SWITCH_TO_FRAME, () => true); + executor.on(CommandName.SWITCH_TO_FRAME, onSwitchFrame(ELEMENT_ID)); var el = new webdriver.WebElementPromise(driver, - Promise.resolve(new webdriver.WebElement(driver, {ELEMENT: 1234}))); + Promise.resolve(new webdriver.WebElement(driver, ELEMENT_ID))); return driver.wait(until.ableToSwitchToFrame(el), 100); }); it('byLocator', function() { - executor.on(CommandName.FIND_ELEMENTS, () => [WebElement.buildId(1234)]); - executor.on(CommandName.SWITCH_TO_FRAME, () => true); + executor.on(CommandName.FIND_ELEMENTS, () => [WebElement.buildId(ELEMENT_ID)]); + executor.on(CommandName.SWITCH_TO_FRAME, onSwitchFrame(ELEMENT_ID)); return driver.wait(until.ableToSwitchToFrame(By.id('foo')), 100); }); it('byLocator_elementNotInitiallyFound', function() { - var foundResponses = [[], [], [WebElement.buildId(1234)]]; + let foundResponses = [[], [], [WebElement.buildId(ELEMENT_ID)]]; executor.on(CommandName.FIND_ELEMENTS, () => foundResponses.shift()); - executor.on(CommandName.SWITCH_TO_FRAME, () => true); + executor.on(CommandName.SWITCH_TO_FRAME, onSwitchFrame(ELEMENT_ID)); return driver.wait(until.ableToSwitchToFrame(By.id('foo')), 2000) - .then(function() { - assert.equal(foundResponses.length, 0); - }); + .then(() => assert.deepEqual(foundResponses, [])); }); it('timesOutIfNeverAbletoSwitchFrames', function() { diff --git a/node_modules/selenium-webdriver/testing/index.js b/node_modules/selenium-webdriver/testing/index.js index 5bb82d15f..88763c7d5 100644 --- a/node_modules/selenium-webdriver/testing/index.js +++ b/node_modules/selenium-webdriver/testing/index.js @@ -41,16 +41,14 @@ * The provided wrappers leverage the {@link webdriver.promise.ControlFlow} * to simplify writing asynchronous tests: * - * var By = require('selenium-webdriver').By, - * until = require('selenium-webdriver').until, - * firefox = require('selenium-webdriver/firefox'), - * test = require('selenium-webdriver/testing'); + * var {Builder, By, until} = require('selenium-webdriver'); + * var test = require('selenium-webdriver/testing'); * * test.describe('Google Search', function() { * var driver; * * test.before(function() { - * driver = new firefox.Driver(); + * driver = new Builder().forBrowser('firefox').build(); * }); * * test.after(function() { @@ -292,6 +290,19 @@ exports.describe = function(name, opt_fn) { }; +/** + * An alias for {@link #describe()} that marks the suite as exclusive, + * suppressing all other test suites. + * @param {string} name The suite name. + * @param {function()=} opt_fn The suite function, or `undefined` to define + * a pending test suite. + */ +exports.describe.only = function(name, opt_fn) { + let desc = getMochaGlobal('describe'); + return opt_fn ? desc.only(name, opt_fn) : desc.only(name); +}; + + /** * Defines a suppressed test suite. * @param {string} name The suite name. diff --git a/node_modules/semver/.npmignore b/node_modules/semver/.npmignore deleted file mode 100644 index 534108e3f..000000000 --- a/node_modules/semver/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -coverage/ -.nyc_output/ -nyc_output/ diff --git a/node_modules/semver/.travis.yml b/node_modules/semver/.travis.yml deleted file mode 100644 index 991d04b6e..000000000 --- a/node_modules/semver/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - '0.10' - - '0.12' - - 'iojs' diff --git a/node_modules/semver/Makefile b/node_modules/semver/Makefile deleted file mode 100644 index 71af0e975..000000000 --- a/node_modules/semver/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -files = semver.browser.js \ - semver.min.js \ - semver.browser.js.gz \ - semver.min.js.gz - -all: $(files) - -clean: - rm -f $(files) - -semver.browser.js: head.js.txt semver.js foot.js.txt - ( cat head.js.txt; \ - cat semver.js | \ - egrep -v '^ *\/\* nomin \*\/' | \ - perl -pi -e 's/debug\([^\)]+\)//g'; \ - cat foot.js.txt ) > semver.browser.js - -semver.min.js: semver.browser.js - uglifyjs -m semver.min.js - -%.gz: % - gzip --stdout -9 <$< >$@ - -.PHONY: all clean diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md index b5e35ff0b..cbd956549 100644 --- a/node_modules/semver/README.md +++ b/node_modules/semver/README.md @@ -4,6 +4,8 @@ semver(1) -- The semantic versioner for npm ## Usage $ npm install semver + $ node + var semver = require('semver') semver.valid('1.2.3') // '1.2.3' semver.valid('a.b.c') // null @@ -16,18 +18,35 @@ As a command-line utility: $ semver -h - Usage: semver [ [...]] [-r | -i | --preid | -l | -rv] - Test if version(s) satisfy the supplied range(s), and sort them. + SemVer 5.1.0 - Multiple versions or ranges may be supplied, unless increment - option is specified. In that case, only a single version may - be used, and it is incremented by the specified level + A JavaScript implementation of the http://semver.org/ specification + Copyright Isaac Z. Schlueter + + Usage: semver [options] [ [...]] + Prints valid versions sorted by SemVer precedence + + Options: + -r --range + Print versions that match the specified range. + + -i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + + --preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + + -l --loose + Interpret versions and ranges loosely Program exits successfully if any valid version satisfies all supplied ranges, and prints all satisfying versions. - If no versions are valid, or ranges are not satisfied, - then exits failure. + If no satisfying versions are found, then exits failure. Versions are printed in ascending order, so supplying multiple versions to the utility will just sort them. @@ -107,7 +126,7 @@ The method `.inc` takes an additional `identifier` string argument that will append the value of the string as a prerelease identifier: ```javascript -> semver.inc('1.2.3', 'pre', 'beta') +> semver.inc('1.2.3', 'prerelease', 'beta') '1.2.4-beta.0' ``` @@ -228,6 +247,30 @@ zero. * `^1.x` := `>=1.0.0 <2.0.0` * `^0.x` := `>=0.0.0 <1.0.0` +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + ## Functions All methods and classes take a final `loose` boolean argument that, if @@ -248,6 +291,8 @@ strings that they parse. same as `prepatch`. It increments the patch version, then makes a prerelease. If the input version is already a prerelease it simply increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` * `major(v)`: Return the major version number. * `minor(v)`: Return the minor version number. * `patch(v)`: Return the patch version number. @@ -282,6 +327,8 @@ strings that they parse. range. * `maxSatisfying(versions, range)`: Return the highest version in the list that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. * `gtr(version, range)`: Return `true` if version is greater than all the versions possible in the range. * `ltr(version, range)`: Return `true` if version is less than all the diff --git a/node_modules/semver/foot.js.txt b/node_modules/semver/foot.js.txt deleted file mode 100644 index 8f83c20f8..000000000 --- a/node_modules/semver/foot.js.txt +++ /dev/null @@ -1,6 +0,0 @@ - -})( - typeof exports === 'object' ? exports : - typeof define === 'function' && define.amd ? {} : - semver = {} -); diff --git a/node_modules/semver/head.js.txt b/node_modules/semver/head.js.txt deleted file mode 100644 index 653686517..000000000 --- a/node_modules/semver/head.js.txt +++ /dev/null @@ -1,2 +0,0 @@ -;(function(exports) { - diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json index fff26bd8c..ec9b01643 100644 --- a/node_modules/semver/package.json +++ b/node_modules/semver/package.json @@ -1,21 +1,22 @@ { "name": "semver", - "version": "4.3.6", + "version": "5.3.0", "description": "The semantic version parser used by npm.", "main": "semver.js", - "browser": "semver.browser.js", - "min": "semver.min.js", "scripts": { - "test": "tap test/*.js", - "prepublish": "make" + "test": "tap test/*.js" }, "devDependencies": { - "tap": "^1.2.0", - "uglify-js": "~2.3.6" + "tap": "^2.0.0" }, "license": "ISC", - "repository": "git://github.com/npm/node-semver.git", + "repository": "https://github.com/npm/node-semver", "bin": { "semver": "./bin/semver" - } + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ] } diff --git a/node_modules/semver/semver.browser.js b/node_modules/semver/semver.browser.js deleted file mode 100644 index 4b0cfecf2..000000000 --- a/node_modules/semver/semver.browser.js +++ /dev/null @@ -1,1201 +0,0 @@ -;(function(exports) { - -// export the class if we are in a Node-like system. -if (typeof module === 'object' && module.exports === exports) - exports = module.exports = SemVer; - -// The debug function is excluded entirely from the minified version. - -// 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 || 9007199254740991; - -// 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] + '$'; - -// 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++) { - ; - if (!re[i]) - re[i] = new RegExp(src[i]); -} - -exports.parse = parse; -function parse(version, loose) { - if (version instanceof SemVer) - return version; - - if (typeof version !== 'string') - return null; - - if (version.length > MAX_LENGTH) - return null; - - var r = loose ? re[LOOSE] : re[FULL]; - if (!r.test(version)) - return null; - - try { - return new SemVer(version, loose); - } catch (er) { - return null; - } -} - -exports.valid = valid; -function valid(version, loose) { - var v = parse(version, loose); - return v ? v.version : null; -} - - -exports.clean = clean; -function clean(version, loose) { - var s = parse(version.trim().replace(/^[=v]+/, ''), loose); - return s ? s.version : null; -} - -exports.SemVer = SemVer; - -function SemVer(version, loose) { - if (version instanceof SemVer) { - if (version.loose === 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, loose); - - ; - this.loose = loose; - var m = version.trim().match(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.inspect = function() { - return ''; -}; - -SemVer.prototype.toString = function() { - return this.version; -}; - -SemVer.prototype.compare = function(other) { - ; - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - return this.compareMain(other) || this.comparePre(other); -}; - -SemVer.prototype.compareMain = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - 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.loose); - - // 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]; - ; - 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(); - 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); - if (v1.prerelease.length || v2.prerelease.length) { - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return 'pre'+key; - } - } - } - return 'prerelease'; - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return key; - } - } - } - } -} - -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 (anum && !bnum) ? -1 : - (bnum && !anum) ? 1 : - a < b ? -1 : - a > b ? 1 : - 0; -} - -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(b); -} - -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) { - var ret; - switch (op) { - case '===': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a === b; - break; - case '!==': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a !== b; - break; - case '': case '=': case '==': ret = eq(a, b, loose); break; - case '!=': ret = neq(a, b, loose); break; - case '>': ret = gt(a, b, loose); break; - case '>=': ret = gte(a, b, loose); break; - case '<': ret = lt(a, b, loose); break; - case '<=': ret = lte(a, b, loose); break; - default: throw new TypeError('Invalid operator: ' + op); - } - return ret; -} - -exports.Comparator = Comparator; -function Comparator(comp, loose) { - if (comp instanceof Comparator) { - if (comp.loose === loose) - return comp; - else - comp = comp.value; - } - - if (!(this instanceof Comparator)) - return new Comparator(comp, loose); - - ; - this.loose = loose; - this.parse(comp); - - if (this.semver === ANY) - this.value = ''; - else - this.value = this.operator + this.semver.version; - - ; -} - -var ANY = {}; -Comparator.prototype.parse = function(comp) { - var r = this.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.loose); -}; - -Comparator.prototype.inspect = function() { - return ''; -}; - -Comparator.prototype.toString = function() { - return this.value; -}; - -Comparator.prototype.test = function(version) { - ; - - if (this.semver === ANY) - return true; - - if (typeof version === 'string') - version = new SemVer(version, this.loose); - - return cmp(version, this.operator, this.semver, this.loose); -}; - - -exports.Range = Range; -function Range(range, loose) { - if ((range instanceof Range) && range.loose === loose) - return range; - - if (!(this instanceof Range)) - return new Range(range, loose); - - this.loose = loose; - - // 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.inspect = function() { - return ''; -}; - -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.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); - ; - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); - ; - - // `~ 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, loose); - }).join(' ').split(/\s+/); - if (this.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, loose); - }); - - return set; -}; - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators; -function toComparators(range, loose) { - return new Range(range, loose).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, loose) { - ; - comp = replaceCarets(comp, loose); - ; - comp = replaceTildes(comp, loose); - ; - comp = replaceXRanges(comp, loose); - ; - comp = replaceStars(comp, loose); - ; - 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, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceTilde(comp, loose); - }).join(' '); -} - -function replaceTilde(comp, loose) { - var r = loose ? re[TILDELOOSE] : re[TILDE]; - return comp.replace(r, function(_, 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) { - ; - if (pr.charAt(0) !== '-') - 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'; - - ; - 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, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceCaret(comp, loose); - }).join(' '); -} - -function replaceCaret(comp, loose) { - ; - var r = loose ? re[CARETLOOSE] : re[CARET]; - return comp.replace(r, function(_, 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) { - ; - if (pr.charAt(0) !== '-') - 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 { - ; - 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'; - } - - ; - return ret; - }); -} - -function replaceXRanges(comp, loose) { - ; - return comp.split(/\s+/).map(function(comp) { - return replaceXRange(comp, loose); - }).join(' '); -} - -function replaceXRange(comp, loose) { - comp = comp.trim(); - var r = loose ? re[XRANGELOOSE] : re[XRANGE]; - return comp.replace(r, function(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) { - // replace X with 0 - if (xm) - m = 0; - if (xp) - 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 if (xp) { - 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'; - } - - ; - - return ret; - }); -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars(comp, loose) { - ; - // 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.loose); - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version)) - return true; - } - return false; -}; - -function testSet(set, version) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) - return false; - } - - if (version.prerelease.length) { - // 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 (var i = 0; i < set.length; i++) { - ; - 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, loose) { - try { - range = new Range(range, loose); - } catch (er) { - return false; - } - return range.test(version); -} - -exports.maxSatisfying = maxSatisfying; -function maxSatisfying(versions, range, loose) { - return versions.filter(function(version) { - return satisfies(version, range, loose); - }).sort(function(a, b) { - return rcompare(a, b, loose); - })[0] || null; -} - -exports.validRange = validRange; -function validRange(range, loose) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, loose).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, loose) { - return outside(version, range, '<', loose); -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr; -function gtr(version, range, loose) { - return outside(version, range, '>', loose); -} - -exports.outside = outside; -function outside(version, range, hilo, loose) { - version = new SemVer(version, loose); - range = new Range(range, loose); - - 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, loose)) { - 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, loose)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, loose)) { - 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; -} - -// Use the define() function if we're in AMD land -if (typeof define === 'function' && define.amd) - define(exports); - -})( - typeof exports === 'object' ? exports : - typeof define === 'function' && define.amd ? {} : - semver = {} -); diff --git a/node_modules/semver/semver.browser.js.gz b/node_modules/semver/semver.browser.js.gz deleted file mode 100644 index d67009d8a..000000000 Binary files a/node_modules/semver/semver.browser.js.gz and /dev/null differ diff --git a/node_modules/semver/semver.js b/node_modules/semver/semver.js index cafcc006b..5f1a3c5c9 100644 --- a/node_modules/semver/semver.js +++ b/node_modules/semver/semver.js @@ -1,6 +1,4 @@ -// export the class if we are in a Node-like system. -if (typeof module === 'object' && module.exports === exports) - exports = module.exports = SemVer; +exports = module.exports = SemVer; // The debug function is excluded entirely from the minified version. /* nomin */ var debug; @@ -316,9 +314,9 @@ function SemVer(version, loose) { else this.prerelease = m[4].split('.').map(function(id) { if (/^[0-9]+$/.test(id)) { - var num = +id + var num = +id; if (num >= 0 && num < MAX_SAFE_INTEGER) - return num + return num; } return id; }); @@ -334,10 +332,6 @@ SemVer.prototype.format = function() { return this.version; }; -SemVer.prototype.inspect = function() { - return ''; -}; - SemVer.prototype.toString = function() { return this.version; }; @@ -483,6 +477,7 @@ SemVer.prototype.inc = function(release, identifier) { throw new Error('invalid increment argument: ' + release); } this.format(); + this.raw = this.version; return this; }; @@ -693,10 +688,6 @@ Comparator.prototype.parse = function(comp) { this.semver = new SemVer(m[2], this.loose); }; -Comparator.prototype.inspect = function() { - return ''; -}; - Comparator.prototype.toString = function() { return this.value; }; @@ -740,10 +731,6 @@ function Range(range, loose) { this.format(); } -Range.prototype.inspect = function() { - return ''; -}; - Range.prototype.format = function() { this.range = this.set.map(function(comps) { return comps.join(' ').trim(); @@ -849,7 +836,7 @@ function replaceTilde(comp, loose) { else if (isX(m)) ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; else if (isX(p)) - // ~1.2 == >=1.2.0- <1.3.0- + // ~1.2 == >=1.2.0 <1.3.0 ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; else if (pr) { debug('replaceTilde pr', pr); @@ -979,11 +966,11 @@ function replaceXRange(comp, loose) { } 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 = '<' + gtlt = '<'; if (xm) - M = +M + 1 + M = +M + 1; else - m = +m + 1 + m = +m + 1; } ret = gtlt + M + '.' + m + '.' + p; @@ -1107,6 +1094,15 @@ function maxSatisfying(versions, range, loose) { })[0] || null; } +exports.minSatisfying = minSatisfying; +function minSatisfying(versions, range, loose) { + return versions.filter(function(version) { + return satisfies(version, range, loose); + }).sort(function(a, b) { + return compare(a, b, loose); + })[0] || null; +} + exports.validRange = validRange; function validRange(range, loose) { try { @@ -1200,6 +1196,8 @@ function outside(version, range, hilo, loose) { return true; } -// Use the define() function if we're in AMD land -if (typeof define === 'function' && define.amd) - define(exports); +exports.prerelease = prerelease; +function prerelease(version, loose) { + var parsed = parse(version, loose); + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; +} diff --git a/node_modules/semver/semver.min.js b/node_modules/semver/semver.min.js deleted file mode 100644 index dea027b11..000000000 --- a/node_modules/semver/semver.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e){if(typeof module==="object"&&module.exports===e)e=module.exports=K;e.SEMVER_SPEC_VERSION="2.0.0";var r=256;var t=Number.MAX_SAFE_INTEGER||9007199254740991;var n=e.re=[];var i=e.src=[];var s=0;var o=s++;i[o]="0|[1-9]\\d*";var a=s++;i[a]="[0-9]+";var f=s++;i[f]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var u=s++;i[u]="("+i[o]+")\\."+"("+i[o]+")\\."+"("+i[o]+")";var l=s++;i[l]="("+i[a]+")\\."+"("+i[a]+")\\."+"("+i[a]+")";var p=s++;i[p]="(?:"+i[o]+"|"+i[f]+")";var c=s++;i[c]="(?:"+i[a]+"|"+i[f]+")";var h=s++;i[h]="(?:-("+i[p]+"(?:\\."+i[p]+")*))";var v=s++;i[v]="(?:-?("+i[c]+"(?:\\."+i[c]+")*))";var m=s++;i[m]="[0-9A-Za-z-]+";var g=s++;i[g]="(?:\\+("+i[m]+"(?:\\."+i[m]+")*))";var w=s++;var y="v?"+i[u]+i[h]+"?"+i[g]+"?";i[w]="^"+y+"$";var d="[v=\\s]*"+i[l]+i[v]+"?"+i[g]+"?";var j=s++;i[j]="^"+d+"$";var b=s++;i[b]="((?:<|>)?=?)";var E=s++;i[E]=i[a]+"|x|X|\\*";var $=s++;i[$]=i[o]+"|x|X|\\*";var k=s++;i[k]="[v=\\s]*("+i[$]+")"+"(?:\\.("+i[$]+")"+"(?:\\.("+i[$]+")"+"(?:"+i[h]+")?"+i[g]+"?"+")?)?";var R=s++;i[R]="[v=\\s]*("+i[E]+")"+"(?:\\.("+i[E]+")"+"(?:\\.("+i[E]+")"+"(?:"+i[v]+")?"+i[g]+"?"+")?)?";var S=s++;i[S]="^"+i[b]+"\\s*"+i[k]+"$";var x=s++;i[x]="^"+i[b]+"\\s*"+i[R]+"$";var I=s++;i[I]="(?:~>?)";var T=s++;i[T]="(\\s*)"+i[I]+"\\s+";n[T]=new RegExp(i[T],"g");var V="$1~";var A=s++;i[A]="^"+i[I]+i[k]+"$";var C=s++;i[C]="^"+i[I]+i[R]+"$";var M=s++;i[M]="(?:\\^)";var N=s++;i[N]="(\\s*)"+i[M]+"\\s+";n[N]=new RegExp(i[N],"g");var _="$1^";var z=s++;i[z]="^"+i[M]+i[k]+"$";var P=s++;i[P]="^"+i[M]+i[R]+"$";var X=s++;i[X]="^"+i[b]+"\\s*("+d+")$|^$";var Z=s++;i[Z]="^"+i[b]+"\\s*("+y+")$|^$";var q=s++;i[q]="(\\s*)"+i[b]+"\\s*("+d+"|"+i[k]+")";n[q]=new RegExp(i[q],"g");var L="$1$2$3";var F=s++;i[F]="^\\s*("+i[k]+")"+"\\s+-\\s+"+"("+i[k]+")"+"\\s*$";var G=s++;i[G]="^\\s*("+i[R]+")"+"\\s+-\\s+"+"("+i[R]+")"+"\\s*$";var O=s++;i[O]="(<|>)?=?\\s*\\*";for(var B=0;Br)return null;var i=t?n[j]:n[w];if(!i.test(e))return null;try{return new K(e,t)}catch(s){return null}}e.valid=H;function H(e,r){var t=D(e,r);return t?t.version:null}e.clean=J;function J(e,r){var t=D(e.trim().replace(/^[=v]+/,""),r);return t?t.version:null}e.SemVer=K;function K(e,i){if(e instanceof K){if(e.loose===i)return e;else e=e.version}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(e.length>r)throw new TypeError("version is longer than "+r+" characters");if(!(this instanceof K))return new K(e,i);this.loose=i;var s=e.trim().match(i?n[j]:n[w]);if(!s)throw new TypeError("Invalid Version: "+e);this.raw=e;this.major=+s[1];this.minor=+s[2];this.patch=+s[3];if(this.major>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");if(!s[4])this.prerelease=[];else this.prerelease=s[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var r=+e;if(r>=0&&r'};K.prototype.toString=function(){return this.version};K.prototype.compare=function(e){if(!(e instanceof K))e=new K(e,this.loose);return this.compareMain(e)||this.comparePre(e)};K.prototype.compareMain=function(e){if(!(e instanceof K))e=new K(e,this.loose);return Y(this.major,e.major)||Y(this.minor,e.minor)||Y(this.patch,e.patch)};K.prototype.comparePre=function(e){if(!(e instanceof K))e=new K(e,this.loose);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r];var n=e.prerelease[r];if(t===undefined&&n===undefined)return 0;else if(n===undefined)return 1;else if(t===undefined)return-1;else if(t===n)continue;else return Y(t,n)}while(++r)};K.prototype.inc=function(e,r){switch(e){case"premajor":this.prerelease.length=0;this.patch=0;this.minor=0;this.major++;this.inc("pre",r);break;case"preminor":this.prerelease.length=0;this.patch=0;this.minor++;this.inc("pre",r);break;case"prepatch":this.prerelease.length=0;this.inc("patch",r);this.inc("pre",r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",r);this.inc("pre",r);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{var t=this.prerelease.length;while(--t>=0){if(typeof this.prerelease[t]==="number"){this.prerelease[t]++;t=-2}}if(t===-1)this.prerelease.push(0)}if(r){if(this.prerelease[0]===r){if(isNaN(this.prerelease[1]))this.prerelease=[r,0]}else this.prerelease=[r,0]}break;default:throw new Error("invalid increment argument: "+e)}this.format();return this};e.inc=Q;function Q(e,r,t,n){if(typeof t==="string"){n=t;t=undefined}try{return new K(e,t).inc(r,n).version}catch(i){return null}}e.diff=U;function U(e,r){if(pr(e,r)){return null}else{var t=D(e);var n=D(r);if(t.prerelease.length||n.prerelease.length){for(var i in t){if(i==="major"||i==="minor"||i==="patch"){if(t[i]!==n[i]){return"pre"+i}}}return"prerelease"}for(var i in t){if(i==="major"||i==="minor"||i==="patch"){if(t[i]!==n[i]){return i}}}}}e.compareIdentifiers=Y;var W=/^[0-9]+$/;function Y(e,r){var t=W.test(e);var n=W.test(r);if(t&&n){e=+e;r=+r}return t&&!n?-1:n&&!t?1:er?1:0}e.rcompareIdentifiers=er;function er(e,r){return Y(r,e)}e.major=rr;function rr(e,r){return new K(e,r).major}e.minor=tr;function tr(e,r){return new K(e,r).minor}e.patch=nr;function nr(e,r){return new K(e,r).patch}e.compare=ir;function ir(e,r,t){return new K(e,t).compare(r)}e.compareLoose=sr;function sr(e,r){return ir(e,r,true)}e.rcompare=or;function or(e,r,t){return ir(r,e,t)}e.sort=ar;function ar(r,t){return r.sort(function(r,n){return e.compare(r,n,t)})}e.rsort=fr;function fr(r,t){return r.sort(function(r,n){return e.rcompare(r,n,t)})}e.gt=ur;function ur(e,r,t){return ir(e,r,t)>0}e.lt=lr;function lr(e,r,t){return ir(e,r,t)<0}e.eq=pr;function pr(e,r,t){return ir(e,r,t)===0}e.neq=cr;function cr(e,r,t){return ir(e,r,t)!==0}e.gte=hr;function hr(e,r,t){return ir(e,r,t)>=0}e.lte=vr;function vr(e,r,t){return ir(e,r,t)<=0}e.cmp=mr;function mr(e,r,t,n){var i;switch(r){case"===":if(typeof e==="object")e=e.version;if(typeof t==="object")t=t.version;i=e===t;break;case"!==":if(typeof e==="object")e=e.version;if(typeof t==="object")t=t.version;i=e!==t;break;case"":case"=":case"==":i=pr(e,t,n);break;case"!=":i=cr(e,t,n);break;case">":i=ur(e,t,n);break;case">=":i=hr(e,t,n);break;case"<":i=lr(e,t,n);break;case"<=":i=vr(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}e.Comparator=gr;function gr(e,r){if(e instanceof gr){if(e.loose===r)return e;else e=e.value}if(!(this instanceof gr))return new gr(e,r);this.loose=r;this.parse(e);if(this.semver===wr)this.value="";else this.value=this.operator+this.semver.version}var wr={};gr.prototype.parse=function(e){var r=this.loose?n[X]:n[Z];var t=e.match(r);if(!t)throw new TypeError("Invalid comparator: "+e);this.operator=t[1];if(this.operator==="=")this.operator="";if(!t[2])this.semver=wr;else this.semver=new K(t[2],this.loose)};gr.prototype.inspect=function(){return''};gr.prototype.toString=function(){return this.value};gr.prototype.test=function(e){if(this.semver===wr)return true;if(typeof e==="string")e=new K(e,this.loose);return mr(e,this.operator,this.semver,this.loose)};e.Range=yr;function yr(e,r){if(e instanceof yr&&e.loose===r)return e;if(!(this instanceof yr))return new yr(e,r);this.loose=r;this.raw=e;this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+e)}this.format()}yr.prototype.inspect=function(){return''};yr.prototype.format=function(){this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim();return this.range};yr.prototype.toString=function(){return this.range};yr.prototype.parseRange=function(e){var r=this.loose;e=e.trim();var t=r?n[G]:n[F];e=e.replace(t,Tr);e=e.replace(n[q],L);e=e.replace(n[T],V);e=e.replace(n[N],_);e=e.split(/\s+/).join(" ");var i=r?n[X]:n[Z];var s=e.split(" ").map(function(e){return jr(e,r)}).join(" ").split(/\s+/);if(this.loose){s=s.filter(function(e){return!!e.match(i)})}s=s.map(function(e){return new gr(e,r)});return s};e.toComparators=dr;function dr(e,r){return new yr(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function jr(e,r){e=kr(e,r);e=Er(e,r);e=Sr(e,r);e=Ir(e,r);return e}function br(e){return!e||e.toLowerCase()==="x"||e==="*"}function Er(e,r){return e.trim().split(/\s+/).map(function(e){return $r(e,r)}).join(" ")}function $r(e,r){var t=r?n[C]:n[A];return e.replace(t,function(e,r,t,n,i){var s;if(br(r))s="";else if(br(t))s=">="+r+".0.0 <"+(+r+1)+".0.0";else if(br(n))s=">="+r+"."+t+".0 <"+r+"."+(+t+1)+".0";else if(i){if(i.charAt(0)!=="-")i="-"+i;s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+" <"+r+"."+(+t+1)+".0";return s})}function kr(e,r){return e.trim().split(/\s+/).map(function(e){return Rr(e,r)}).join(" ")}function Rr(e,r){var t=r?n[P]:n[z];return e.replace(t,function(e,r,t,n,i){var s;if(br(r))s="";else if(br(t))s=">="+r+".0.0 <"+(+r+1)+".0.0";else if(br(n)){if(r==="0")s=">="+r+"."+t+".0 <"+r+"."+(+t+1)+".0";else s=">="+r+"."+t+".0 <"+(+r+1)+".0.0"}else if(i){if(i.charAt(0)!=="-")i="-"+i;if(r==="0"){if(t==="0")s=">="+r+"."+t+"."+n+i+" <"+r+"."+t+"."+(+n+1);else s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0"}else{if(r==="0"){if(t==="0")s=">="+r+"."+t+"."+n+" <"+r+"."+t+"."+(+n+1);else s=">="+r+"."+t+"."+n+" <"+r+"."+(+t+1)+".0"}else s=">="+r+"."+t+"."+n+" <"+(+r+1)+".0.0"}return s})}function Sr(e,r){return e.split(/\s+/).map(function(e){return xr(e,r)}).join(" ")}function xr(e,r){e=e.trim();var t=r?n[x]:n[S];return e.replace(t,function(e,r,t,n,i,s){var o=br(t);var a=o||br(n);var f=a||br(i);var u=f;if(r==="="&&u)r="";if(o){if(r===">"||r==="<"){e="<0.0.0"}else{e="*"}}else if(r&&u){if(a)n=0;if(f)i=0;if(r===">"){r=">=";if(a){t=+t+1;n=0;i=0}else if(f){n=+n+1;i=0}}else if(r==="<="){r="<";if(a)t=+t+1;else n=+n+1}e=r+t+"."+n+"."+i}else if(a){e=">="+t+".0.0 <"+(+t+1)+".0.0"}else if(f){e=">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0"}return e})}function Ir(e,r){return e.trim().replace(n[O],"")}function Tr(e,r,t,n,i,s,o,a,f,u,l,p,c){if(br(t))r="";else if(br(n))r=">="+t+".0.0";else if(br(i))r=">="+t+"."+n+".0";else r=">="+r;if(br(f))a="";else if(br(u))a="<"+(+f+1)+".0.0";else if(br(l))a="<"+f+"."+(+u+1)+".0";else if(p)a="<="+f+"."+u+"."+l+"-"+p;else a="<="+a;return(r+" "+a).trim()}yr.prototype.test=function(e){if(!e)return false;if(typeof e==="string")e=new K(e,this.loose);for(var r=0;r0){var n=e[t].semver;if(n.major===r.major&&n.minor===r.minor&&n.patch===r.patch)return true}}return false}return true}e.satisfies=Ar;function Ar(e,r,t){try{r=new yr(r,t)}catch(n){return false}return r.test(e)}e.maxSatisfying=Cr;function Cr(e,r,t){return e.filter(function(e){return Ar(e,r,t)}).sort(function(e,r){return or(e,r,t)})[0]||null}e.validRange=Mr;function Mr(e,r){try{return new yr(e,r).range||"*"}catch(t){return null}}e.ltr=Nr;function Nr(e,r,t){return zr(e,r,"<",t)}e.gtr=_r;function _r(e,r,t){return zr(e,r,">",t)}e.outside=zr;function zr(e,r,t,n){e=new K(e,n);r=new yr(r,n);var i,s,o,a,f;switch(t){case">":i=ur;s=vr;o=lr;a=">";f=">=";break;case"<":i=lr;s=hr;o=ur;a="<";f="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Ar(e,r,n)){return false}for(var u=0;u=0.0.0")}p=p||e;c=c||e;if(i(e.semver,p.semver,n)){p=e}else if(o(e.semver,c.semver,n)){c=e}});if(p.operator===a||p.operator===f){return false}if((!c.operator||c.operator===a)&&s(e,c.semver)){return false}else if(c.operator===f&&o(e,c.semver)){return false}}return true}if(typeof define==="function"&&define.amd)define(e)})(typeof exports==="object"?exports:typeof define==="function"&&define.amd?{}:semver={}); \ No newline at end of file diff --git a/node_modules/semver/semver.min.js.gz b/node_modules/semver/semver.min.js.gz deleted file mode 100644 index cbbc16188..000000000 Binary files a/node_modules/semver/semver.min.js.gz and /dev/null differ diff --git a/node_modules/semver/test/amd.js b/node_modules/semver/test/amd.js deleted file mode 100644 index a6041341b..000000000 --- a/node_modules/semver/test/amd.js +++ /dev/null @@ -1,15 +0,0 @@ -var tap = require('tap'); -var test = tap.test; - -test('amd', function(t) { - global.define = define; - define.amd = true; - var defined = null; - function define(stuff) { - defined = stuff; - } - var fromRequire = require('../'); - t.ok(defined, 'amd function called'); - t.equal(fromRequire, defined, 'amd stuff same as require stuff'); - t.end(); -}); diff --git a/node_modules/semver/test/big-numbers.js b/node_modules/semver/test/big-numbers.js deleted file mode 100644 index c051864bc..000000000 --- a/node_modules/semver/test/big-numbers.js +++ /dev/null @@ -1,31 +0,0 @@ -var test = require('tap').test -var semver = require('../') - -test('long version is too long', function (t) { - var v = '1.2.' + new Array(256).join('1') - t.throws(function () { - new semver.SemVer(v) - }) - t.equal(semver.valid(v, false), null) - t.equal(semver.valid(v, true), null) - t.equal(semver.inc(v, 'patch'), null) - t.end() -}) - -test('big number is like too long version', function (t) { - var v = '1.2.' + new Array(100).join('1') - t.throws(function () { - new semver.SemVer(v) - }) - t.equal(semver.valid(v, false), null) - t.equal(semver.valid(v, true), null) - t.equal(semver.inc(v, 'patch'), null) - t.end() -}) - -test('parsing null does not throw', function (t) { - t.equal(semver.parse(null), null) - t.equal(semver.parse({}), null) - t.equal(semver.parse(new semver.SemVer('1.2.3')).version, '1.2.3') - t.end() -}) diff --git a/node_modules/semver/test/clean.js b/node_modules/semver/test/clean.js deleted file mode 100644 index 9e268de95..000000000 --- a/node_modules/semver/test/clean.js +++ /dev/null @@ -1,29 +0,0 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var clean = semver.clean; - -test('\nclean tests', function(t) { - // [range, version] - // Version should be detectable despite extra characters - [ - ['1.2.3', '1.2.3'], - [' 1.2.3 ', '1.2.3'], - [' 1.2.3-4 ', '1.2.3-4'], - [' 1.2.3-pre ', '1.2.3-pre'], - [' =v1.2.3 ', '1.2.3'], - ['v1.2.3', '1.2.3'], - [' v1.2.3 ', '1.2.3'], - ['\t1.2.3', '1.2.3'], - ['>1.2.3', null], - ['~1.2.3', null], - ['<=1.2.3', null], - ['1.2.x', null] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var msg = 'clean(' + range + ') = ' + version; - t.equal(clean(range), version, msg); - }); - t.end(); -}); diff --git a/node_modules/semver/test/gtr.js b/node_modules/semver/test/gtr.js deleted file mode 100644 index bbb87896c..000000000 --- a/node_modules/semver/test/gtr.js +++ /dev/null @@ -1,173 +0,0 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var gtr = semver.gtr; - -test('\ngtr tests', function(t) { - // [range, version, loose] - // Version should be greater than range - [ - ['~1.2.2', '1.3.0'], - ['~0.6.1-1', '0.7.1-1'], - ['1.0.0 - 2.0.0', '2.0.1'], - ['1.0.0', '1.0.1-beta1'], - ['1.0.0', '2.0.0'], - ['<=2.0.0', '2.1.1'], - ['<=2.0.0', '3.2.9'], - ['<2.0.0', '2.0.0'], - ['0.1.20 || 1.2.4', '1.2.5'], - ['2.x.x', '3.0.0'], - ['1.2.x', '1.3.0'], - ['1.2.x || 2.x', '3.0.0'], - ['2.*.*', '5.0.1'], - ['1.2.*', '1.3.3'], - ['1.2.* || 2.*', '4.0.0'], - ['2', '3.0.0'], - ['2.3', '2.4.2'], - ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 - ['~2.4', '2.5.5'], - ['~>3.2.1', '3.3.0'], // >=3.2.1 <3.3.0 - ['~1', '2.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '2.2.4'], - ['~> 1', '3.2.3'], - ['~1.0', '1.1.2'], // >=1.0.0 <1.1.0 - ['~ 1.0', '1.1.0'], - ['<1.2', '1.2.0'], - ['< 1.2', '1.2.1'], - ['1', '2.0.0beta', true], - ['~v0.5.4-pre', '0.6.0'], - ['~v0.5.4-pre', '0.6.1-pre'], - ['=0.7.x', '0.8.0'], - ['=0.7.x', '0.8.0-asdf'], - ['<0.7.x', '0.7.0'], - ['~1.2.2', '1.3.0'], - ['1.0.0 - 2.0.0', '2.2.3'], - ['1.0.0', '1.0.1'], - ['<=2.0.0', '3.0.0'], - ['<=2.0.0', '2.9999.9999'], - ['<=2.0.0', '2.2.9'], - ['<2.0.0', '2.9999.9999'], - ['<2.0.0', '2.2.9'], - ['2.x.x', '3.1.3'], - ['1.2.x', '1.3.3'], - ['1.2.x || 2.x', '3.1.3'], - ['2.*.*', '3.1.3'], - ['1.2.*', '1.3.3'], - ['1.2.* || 2.*', '3.1.3'], - ['2', '3.1.2'], - ['2.3', '2.4.1'], - ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 - ['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0 - ['~1', '2.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '2.2.3'], - ['~1.0', '1.1.0'], // >=1.0.0 <1.1.0 - ['<1', '1.0.0'], - ['1', '2.0.0beta', true], - ['<1', '1.0.0beta', true], - ['< 1', '1.0.0beta', true], - ['=0.7.x', '0.8.2'], - ['<0.7.x', '0.7.2'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')'; - t.ok(gtr(version, range, loose), msg); - }); - t.end(); -}); - -test('\nnegative gtr tests', function(t) { - // [range, version, loose] - // Version should NOT be greater than range - [ - ['~0.6.1-1', '0.6.1-1'], - ['1.0.0 - 2.0.0', '1.2.3'], - ['1.0.0 - 2.0.0', '0.9.9'], - ['1.0.0', '1.0.0'], - ['>=*', '0.2.4'], - ['', '1.0.0', true], - ['*', '1.2.3'], - ['*', 'v1.2.3-foo'], - ['>=1.0.0', '1.0.0'], - ['>=1.0.0', '1.0.1'], - ['>=1.0.0', '1.1.0'], - ['>1.0.0', '1.0.1'], - ['>1.0.0', '1.1.0'], - ['<=2.0.0', '2.0.0'], - ['<=2.0.0', '1.9999.9999'], - ['<=2.0.0', '0.2.9'], - ['<2.0.0', '1.9999.9999'], - ['<2.0.0', '0.2.9'], - ['>= 1.0.0', '1.0.0'], - ['>= 1.0.0', '1.0.1'], - ['>= 1.0.0', '1.1.0'], - ['> 1.0.0', '1.0.1'], - ['> 1.0.0', '1.1.0'], - ['<= 2.0.0', '2.0.0'], - ['<= 2.0.0', '1.9999.9999'], - ['<= 2.0.0', '0.2.9'], - ['< 2.0.0', '1.9999.9999'], - ['<\t2.0.0', '0.2.9'], - ['>=0.1.97', 'v0.1.97'], - ['>=0.1.97', '0.1.97'], - ['0.1.20 || 1.2.4', '1.2.4'], - ['0.1.20 || >1.2.4', '1.2.4'], - ['0.1.20 || 1.2.4', '1.2.3'], - ['0.1.20 || 1.2.4', '0.1.20'], - ['>=0.2.3 || <0.0.1', '0.0.0'], - ['>=0.2.3 || <0.0.1', '0.2.3'], - ['>=0.2.3 || <0.0.1', '0.2.4'], - ['||', '1.3.4'], - ['2.x.x', '2.1.3'], - ['1.2.x', '1.2.3'], - ['1.2.x || 2.x', '2.1.3'], - ['1.2.x || 2.x', '1.2.3'], - ['x', '1.2.3'], - ['2.*.*', '2.1.3'], - ['1.2.*', '1.2.3'], - ['1.2.* || 2.*', '2.1.3'], - ['1.2.* || 2.*', '1.2.3'], - ['1.2.* || 2.*', '1.2.3'], - ['*', '1.2.3'], - ['2', '2.1.2'], - ['2.3', '2.3.1'], - ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 - ['~2.4', '2.4.5'], - ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0 - ['~1', '1.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '1.2.3'], - ['~> 1', '1.2.3'], - ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0 - ['~ 1.0', '1.0.2'], - ['>=1', '1.0.0'], - ['>= 1', '1.0.0'], - ['<1.2', '1.1.1'], - ['< 1.2', '1.1.1'], - ['1', '1.0.0beta', true], - ['~v0.5.4-pre', '0.5.5'], - ['~v0.5.4-pre', '0.5.4'], - ['=0.7.x', '0.7.2'], - ['>=0.7.x', '0.7.2'], - ['=0.7.x', '0.7.0-asdf'], - ['>=0.7.x', '0.7.0-asdf'], - ['<=0.7.x', '0.6.2'], - ['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'], - ['>=0.2.3 <=0.2.4', '0.2.4'], - ['1.0.0 - 2.0.0', '2.0.0'], - ['^1', '0.0.0-0'], - ['^3.0.0', '2.0.0'], - ['^1.0.0 || ~2.0.1', '2.0.0'], - ['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'], - ['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true], - ['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true], - ['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')'; - t.notOk(gtr(version, range, loose), msg); - }); - t.end(); -}); diff --git a/node_modules/semver/test/index.js b/node_modules/semver/test/index.js deleted file mode 100644 index c256c7947..000000000 --- a/node_modules/semver/test/index.js +++ /dev/null @@ -1,685 +0,0 @@ -'use strict'; - -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var eq = semver.eq; -var gt = semver.gt; -var lt = semver.lt; -var neq = semver.neq; -var cmp = semver.cmp; -var gte = semver.gte; -var lte = semver.lte; -var satisfies = semver.satisfies; -var validRange = semver.validRange; -var inc = semver.inc; -var diff = semver.diff; -var replaceStars = semver.replaceStars; -var toComparators = semver.toComparators; -var SemVer = semver.SemVer; -var Range = semver.Range; - -test('\ncomparison tests', function(t) { - // [version1, version2] - // version1 should be greater than version2 - [['0.0.0', '0.0.0-foo'], - ['0.0.1', '0.0.0'], - ['1.0.0', '0.9.9'], - ['0.10.0', '0.9.0'], - ['0.99.0', '0.10.0'], - ['2.0.0', '1.2.3'], - ['v0.0.0', '0.0.0-foo', true], - ['v0.0.1', '0.0.0', true], - ['v1.0.0', '0.9.9', true], - ['v0.10.0', '0.9.0', true], - ['v0.99.0', '0.10.0', true], - ['v2.0.0', '1.2.3', true], - ['0.0.0', 'v0.0.0-foo', true], - ['0.0.1', 'v0.0.0', true], - ['1.0.0', 'v0.9.9', true], - ['0.10.0', 'v0.9.0', true], - ['0.99.0', 'v0.10.0', true], - ['2.0.0', 'v1.2.3', true], - ['1.2.3', '1.2.3-asdf'], - ['1.2.3', '1.2.3-4'], - ['1.2.3', '1.2.3-4-foo'], - ['1.2.3-5-foo', '1.2.3-5'], - ['1.2.3-5', '1.2.3-4'], - ['1.2.3-5-foo', '1.2.3-5-Foo'], - ['3.0.0', '2.7.2+asdf'], - ['1.2.3-a.10', '1.2.3-a.5'], - ['1.2.3-a.b', '1.2.3-a.5'], - ['1.2.3-a.b', '1.2.3-a'], - ['1.2.3-a.b.c.10.d.5', '1.2.3-a.b.c.5.d.100'], - ['1.2.3-r2', '1.2.3-r100'], - ['1.2.3-r100', '1.2.3-R2'] - ].forEach(function(v) { - var v0 = v[0]; - var v1 = v[1]; - var loose = v[2]; - t.ok(gt(v0, v1, loose), "gt('" + v0 + "', '" + v1 + "')"); - t.ok(lt(v1, v0, loose), "lt('" + v1 + "', '" + v0 + "')"); - t.ok(!gt(v1, v0, loose), "!gt('" + v1 + "', '" + v0 + "')"); - t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')"); - t.ok(eq(v0, v0, loose), "eq('" + v0 + "', '" + v0 + "')"); - t.ok(eq(v1, v1, loose), "eq('" + v1 + "', '" + v1 + "')"); - t.ok(neq(v0, v1, loose), "neq('" + v0 + "', '" + v1 + "')"); - t.ok(cmp(v1, '==', v1, loose), "cmp('" + v1 + "' == '" + v1 + "')"); - t.ok(cmp(v0, '>=', v1, loose), "cmp('" + v0 + "' >= '" + v1 + "')"); - t.ok(cmp(v1, '<=', v0, loose), "cmp('" + v1 + "' <= '" + v0 + "')"); - t.ok(cmp(v0, '!=', v1, loose), "cmp('" + v0 + "' != '" + v1 + "')"); - }); - t.end(); -}); - -test('\nequality tests', function(t) { - // [version1, version2] - // version1 should be equivalent to version2 - [['1.2.3', 'v1.2.3', true], - ['1.2.3', '=1.2.3', true], - ['1.2.3', 'v 1.2.3', true], - ['1.2.3', '= 1.2.3', true], - ['1.2.3', ' v1.2.3', true], - ['1.2.3', ' =1.2.3', true], - ['1.2.3', ' v 1.2.3', true], - ['1.2.3', ' = 1.2.3', true], - ['1.2.3-0', 'v1.2.3-0', true], - ['1.2.3-0', '=1.2.3-0', true], - ['1.2.3-0', 'v 1.2.3-0', true], - ['1.2.3-0', '= 1.2.3-0', true], - ['1.2.3-0', ' v1.2.3-0', true], - ['1.2.3-0', ' =1.2.3-0', true], - ['1.2.3-0', ' v 1.2.3-0', true], - ['1.2.3-0', ' = 1.2.3-0', true], - ['1.2.3-1', 'v1.2.3-1', true], - ['1.2.3-1', '=1.2.3-1', true], - ['1.2.3-1', 'v 1.2.3-1', true], - ['1.2.3-1', '= 1.2.3-1', true], - ['1.2.3-1', ' v1.2.3-1', true], - ['1.2.3-1', ' =1.2.3-1', true], - ['1.2.3-1', ' v 1.2.3-1', true], - ['1.2.3-1', ' = 1.2.3-1', true], - ['1.2.3-beta', 'v1.2.3-beta', true], - ['1.2.3-beta', '=1.2.3-beta', true], - ['1.2.3-beta', 'v 1.2.3-beta', true], - ['1.2.3-beta', '= 1.2.3-beta', true], - ['1.2.3-beta', ' v1.2.3-beta', true], - ['1.2.3-beta', ' =1.2.3-beta', true], - ['1.2.3-beta', ' v 1.2.3-beta', true], - ['1.2.3-beta', ' = 1.2.3-beta', true], - ['1.2.3-beta+build', ' = 1.2.3-beta+otherbuild', true], - ['1.2.3+build', ' = 1.2.3+otherbuild', true], - ['1.2.3-beta+build', '1.2.3-beta+otherbuild'], - ['1.2.3+build', '1.2.3+otherbuild'], - [' v1.2.3+build', '1.2.3+otherbuild'] - ].forEach(function(v) { - var v0 = v[0]; - var v1 = v[1]; - var loose = v[2]; - t.ok(eq(v0, v1, loose), "eq('" + v0 + "', '" + v1 + "')"); - t.ok(!neq(v0, v1, loose), "!neq('" + v0 + "', '" + v1 + "')"); - t.ok(cmp(v0, '==', v1, loose), 'cmp(' + v0 + '==' + v1 + ')'); - t.ok(!cmp(v0, '!=', v1, loose), '!cmp(' + v0 + '!=' + v1 + ')'); - t.ok(!cmp(v0, '===', v1, loose), '!cmp(' + v0 + '===' + v1 + ')'); - t.ok(cmp(v0, '!==', v1, loose), 'cmp(' + v0 + '!==' + v1 + ')'); - t.ok(!gt(v0, v1, loose), "!gt('" + v0 + "', '" + v1 + "')"); - t.ok(gte(v0, v1, loose), "gte('" + v0 + "', '" + v1 + "')"); - t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')"); - t.ok(lte(v0, v1, loose), "lte('" + v0 + "', '" + v1 + "')"); - }); - t.end(); -}); - - -test('\nrange tests', function(t) { - // [range, version] - // version should be included by range - [['1.0.0 - 2.0.0', '1.2.3'], - ['^1.2.3+build', '1.2.3'], - ['^1.2.3+build', '1.3.0'], - ['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3'], - ['1.2.3pre+asdf - 2.4.3-pre+asdf', '1.2.3', true], - ['1.2.3-pre+asdf - 2.4.3pre+asdf', '1.2.3', true], - ['1.2.3pre+asdf - 2.4.3pre+asdf', '1.2.3', true], - ['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3-pre.2'], - ['1.2.3-pre+asdf - 2.4.3-pre+asdf', '2.4.3-alpha'], - ['1.2.3+asdf - 2.4.3+asdf', '1.2.3'], - ['1.0.0', '1.0.0'], - ['>=*', '0.2.4'], - ['', '1.0.0'], - ['*', '1.2.3'], - ['*', 'v1.2.3', true], - ['>=1.0.0', '1.0.0'], - ['>=1.0.0', '1.0.1'], - ['>=1.0.0', '1.1.0'], - ['>1.0.0', '1.0.1'], - ['>1.0.0', '1.1.0'], - ['<=2.0.0', '2.0.0'], - ['<=2.0.0', '1.9999.9999'], - ['<=2.0.0', '0.2.9'], - ['<2.0.0', '1.9999.9999'], - ['<2.0.0', '0.2.9'], - ['>= 1.0.0', '1.0.0'], - ['>= 1.0.0', '1.0.1'], - ['>= 1.0.0', '1.1.0'], - ['> 1.0.0', '1.0.1'], - ['> 1.0.0', '1.1.0'], - ['<= 2.0.0', '2.0.0'], - ['<= 2.0.0', '1.9999.9999'], - ['<= 2.0.0', '0.2.9'], - ['< 2.0.0', '1.9999.9999'], - ['<\t2.0.0', '0.2.9'], - ['>=0.1.97', 'v0.1.97', true], - ['>=0.1.97', '0.1.97'], - ['0.1.20 || 1.2.4', '1.2.4'], - ['>=0.2.3 || <0.0.1', '0.0.0'], - ['>=0.2.3 || <0.0.1', '0.2.3'], - ['>=0.2.3 || <0.0.1', '0.2.4'], - ['||', '1.3.4'], - ['2.x.x', '2.1.3'], - ['1.2.x', '1.2.3'], - ['1.2.x || 2.x', '2.1.3'], - ['1.2.x || 2.x', '1.2.3'], - ['x', '1.2.3'], - ['2.*.*', '2.1.3'], - ['1.2.*', '1.2.3'], - ['1.2.* || 2.*', '2.1.3'], - ['1.2.* || 2.*', '1.2.3'], - ['*', '1.2.3'], - ['2', '2.1.2'], - ['2.3', '2.3.1'], - ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 - ['~2.4', '2.4.5'], - ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0, - ['~1', '1.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '1.2.3'], - ['~> 1', '1.2.3'], - ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0, - ['~ 1.0', '1.0.2'], - ['~ 1.0.3', '1.0.12'], - ['>=1', '1.0.0'], - ['>= 1', '1.0.0'], - ['<1.2', '1.1.1'], - ['< 1.2', '1.1.1'], - ['~v0.5.4-pre', '0.5.5'], - ['~v0.5.4-pre', '0.5.4'], - ['=0.7.x', '0.7.2'], - ['<=0.7.x', '0.7.2'], - ['>=0.7.x', '0.7.2'], - ['<=0.7.x', '0.6.2'], - ['~1.2.1 >=1.2.3', '1.2.3'], - ['~1.2.1 =1.2.3', '1.2.3'], - ['~1.2.1 1.2.3', '1.2.3'], - ['~1.2.1 >=1.2.3 1.2.3', '1.2.3'], - ['~1.2.1 1.2.3 >=1.2.3', '1.2.3'], - ['~1.2.1 1.2.3', '1.2.3'], - ['>=1.2.1 1.2.3', '1.2.3'], - ['1.2.3 >=1.2.1', '1.2.3'], - ['>=1.2.3 >=1.2.1', '1.2.3'], - ['>=1.2.1 >=1.2.3', '1.2.3'], - ['>=1.2', '1.2.8'], - ['^1.2.3', '1.8.1'], - ['^0.1.2', '0.1.2'], - ['^0.1', '0.1.2'], - ['^1.2', '1.4.2'], - ['^1.2 ^1', '1.4.2'], - ['^1.2.3-alpha', '1.2.3-pre'], - ['^1.2.0-alpha', '1.2.0-pre'], - ['^0.0.1-alpha', '0.0.1-beta'] - ].forEach(function(v) { - var range = v[0]; - var ver = v[1]; - var loose = v[2]; - t.ok(satisfies(ver, range, loose), range + ' satisfied by ' + ver); - }); - t.end(); -}); - -test('\nnegative range tests', function(t) { - // [range, version] - // version should not be included by range - [['1.0.0 - 2.0.0', '2.2.3'], - ['1.2.3+asdf - 2.4.3+asdf', '1.2.3-pre.2'], - ['1.2.3+asdf - 2.4.3+asdf', '2.4.3-alpha'], - ['^1.2.3+build', '2.0.0'], - ['^1.2.3+build', '1.2.0'], - ['^1.2.3', '1.2.3-pre'], - ['^1.2', '1.2.0-pre'], - ['>1.2', '1.3.0-beta'], - ['<=1.2.3', '1.2.3-beta'], - ['^1.2.3', '1.2.3-beta'], - ['=0.7.x', '0.7.0-asdf'], - ['>=0.7.x', '0.7.0-asdf'], - ['1', '1.0.0beta', true], - ['<1', '1.0.0beta', true], - ['< 1', '1.0.0beta', true], - ['1.0.0', '1.0.1'], - ['>=1.0.0', '0.0.0'], - ['>=1.0.0', '0.0.1'], - ['>=1.0.0', '0.1.0'], - ['>1.0.0', '0.0.1'], - ['>1.0.0', '0.1.0'], - ['<=2.0.0', '3.0.0'], - ['<=2.0.0', '2.9999.9999'], - ['<=2.0.0', '2.2.9'], - ['<2.0.0', '2.9999.9999'], - ['<2.0.0', '2.2.9'], - ['>=0.1.97', 'v0.1.93', true], - ['>=0.1.97', '0.1.93'], - ['0.1.20 || 1.2.4', '1.2.3'], - ['>=0.2.3 || <0.0.1', '0.0.3'], - ['>=0.2.3 || <0.0.1', '0.2.2'], - ['2.x.x', '1.1.3'], - ['2.x.x', '3.1.3'], - ['1.2.x', '1.3.3'], - ['1.2.x || 2.x', '3.1.3'], - ['1.2.x || 2.x', '1.1.3'], - ['2.*.*', '1.1.3'], - ['2.*.*', '3.1.3'], - ['1.2.*', '1.3.3'], - ['1.2.* || 2.*', '3.1.3'], - ['1.2.* || 2.*', '1.1.3'], - ['2', '1.1.2'], - ['2.3', '2.4.1'], - ['~2.4', '2.5.0'], // >=2.4.0 <2.5.0 - ['~2.4', '2.3.9'], - ['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0 - ['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0 - ['~1', '0.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '2.2.3'], - ['~1.0', '1.1.0'], // >=1.0.0 <1.1.0 - ['<1', '1.0.0'], - ['>=1.2', '1.1.1'], - ['1', '2.0.0beta', true], - ['~v0.5.4-beta', '0.5.4-alpha'], - ['=0.7.x', '0.8.2'], - ['>=0.7.x', '0.6.2'], - ['<0.7.x', '0.7.2'], - ['<1.2.3', '1.2.3-beta'], - ['=1.2.3', '1.2.3-beta'], - ['>1.2', '1.2.8'], - ['^1.2.3', '2.0.0-alpha'], - ['^1.2.3', '1.2.2'], - ['^1.2', '1.1.9'], - ['*', 'v1.2.3-foo', true], - // invalid ranges never satisfied! - ['blerg', '1.2.3'], - ['git+https://user:password0123@github.com/foo', '123.0.0', true], - ['^1.2.3', '2.0.0-pre'] - ].forEach(function(v) { - var range = v[0]; - var ver = v[1]; - var loose = v[2]; - var found = satisfies(ver, range, loose); - t.ok(!found, ver + ' not satisfied by ' + range); - }); - t.end(); -}); - -test('\nincrement versions test', function(t) { -// [version, inc, result, identifier] -// inc(version, inc) -> result - [['1.2.3', 'major', '2.0.0'], - ['1.2.3', 'minor', '1.3.0'], - ['1.2.3', 'patch', '1.2.4'], - ['1.2.3tag', 'major', '2.0.0', true], - ['1.2.3-tag', 'major', '2.0.0'], - ['1.2.3', 'fake', null], - ['1.2.0-0', 'patch', '1.2.0'], - ['fake', 'major', null], - ['1.2.3-4', 'major', '2.0.0'], - ['1.2.3-4', 'minor', '1.3.0'], - ['1.2.3-4', 'patch', '1.2.3'], - ['1.2.3-alpha.0.beta', 'major', '2.0.0'], - ['1.2.3-alpha.0.beta', 'minor', '1.3.0'], - ['1.2.3-alpha.0.beta', 'patch', '1.2.3'], - ['1.2.4', 'prerelease', '1.2.5-0'], - ['1.2.3-0', 'prerelease', '1.2.3-1'], - ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'], - ['1.2.3-alpha.1', 'prerelease', '1.2.3-alpha.2'], - ['1.2.3-alpha.2', 'prerelease', '1.2.3-alpha.3'], - ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta'], - ['1.2.3-alpha.1.beta', 'prerelease', '1.2.3-alpha.2.beta'], - ['1.2.3-alpha.2.beta', 'prerelease', '1.2.3-alpha.3.beta'], - ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta'], - ['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta'], - ['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta'], - ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1'], - ['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2'], - ['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3'], - ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta'], - ['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'], - ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'], - ['1.2.0', 'prepatch', '1.2.1-0'], - ['1.2.0-1', 'prepatch', '1.2.1-0'], - ['1.2.0', 'preminor', '1.3.0-0'], - ['1.2.3-1', 'preminor', '1.3.0-0'], - ['1.2.0', 'premajor', '2.0.0-0'], - ['1.2.3-1', 'premajor', '2.0.0-0'], - ['1.2.0-1', 'minor', '1.2.0'], - ['1.0.0-1', 'major', '1.0.0'], - - ['1.2.3', 'major', '2.0.0', false, 'dev'], - ['1.2.3', 'minor', '1.3.0', false, 'dev'], - ['1.2.3', 'patch', '1.2.4', false, 'dev'], - ['1.2.3tag', 'major', '2.0.0', true, 'dev'], - ['1.2.3-tag', 'major', '2.0.0', false, 'dev'], - ['1.2.3', 'fake', null, false, 'dev'], - ['1.2.0-0', 'patch', '1.2.0', false, 'dev'], - ['fake', 'major', null, false, 'dev'], - ['1.2.3-4', 'major', '2.0.0', false, 'dev'], - ['1.2.3-4', 'minor', '1.3.0', false, 'dev'], - ['1.2.3-4', 'patch', '1.2.3', false, 'dev'], - ['1.2.3-alpha.0.beta', 'major', '2.0.0', false, 'dev'], - ['1.2.3-alpha.0.beta', 'minor', '1.3.0', false, 'dev'], - ['1.2.3-alpha.0.beta', 'patch', '1.2.3', false, 'dev'], - ['1.2.4', 'prerelease', '1.2.5-dev.0', false, 'dev'], - ['1.2.3-0', 'prerelease', '1.2.3-dev.0', false, 'dev'], - ['1.2.3-alpha.0', 'prerelease', '1.2.3-dev.0', false, 'dev'], - ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1', false, 'alpha'], - ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], - ['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta', false, 'alpha'], - ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], - ['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta', false, 'alpha'], - ['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta', false, 'alpha'], - ['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta', false, 'alpha'], - ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-dev.0', false, 'dev'], - ['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1', false, 'alpha'], - ['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2', false, 'alpha'], - ['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3', false, 'alpha'], - ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'], - ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta', false, 'alpha'], - ['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta', false, 'alpha'], - ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta', false, 'alpha'], - ['1.2.0', 'prepatch', '1.2.1-dev.0', 'dev'], - ['1.2.0-1', 'prepatch', '1.2.1-dev.0', 'dev'], - ['1.2.0', 'preminor', '1.3.0-dev.0', 'dev'], - ['1.2.3-1', 'preminor', '1.3.0-dev.0', 'dev'], - ['1.2.0', 'premajor', '2.0.0-dev.0', 'dev'], - ['1.2.3-1', 'premajor', '2.0.0-dev.0', 'dev'], - ['1.2.0-1', 'minor', '1.2.0', 'dev'], - ['1.0.0-1', 'major', '1.0.0', 'dev'], - ['1.2.3-dev.bar', 'prerelease', '1.2.3-dev.0', false, 'dev'] - - ].forEach(function(v) { - var pre = v[0]; - var what = v[1]; - var wanted = v[2]; - var loose = v[3]; - var id = v[4]; - var found = inc(pre, what, loose, id); - var cmd = 'inc(' + pre + ', ' + what + ', ' + id + ')'; - t.equal(found, wanted, cmd + ' === ' + wanted); - }); - - t.end(); -}); - -test('\ndiff versions test', function(t) { -// [version1, version2, result] -// diff(version1, version2) -> result - [['1.2.3', '0.2.3', 'major'], - ['1.4.5', '0.2.3', 'major'], - ['1.2.3', '2.0.0-pre', 'premajor'], - ['1.2.3', '1.3.3', 'minor'], - ['1.0.1', '1.1.0-pre', 'preminor'], - ['1.2.3', '1.2.4', 'patch'], - ['1.2.3', '1.2.4-pre', 'prepatch'], - ['0.0.1', '0.0.1-pre', 'prerelease'], - ['0.0.1', '0.0.1-pre-2', 'prerelease'], - ['1.1.0', '1.1.0-pre', 'prerelease'], - ['1.1.0-pre-1', '1.1.0-pre-2', 'prerelease'], - ['1.0.0', '1.0.0', null] - - ].forEach(function(v) { - var version1 = v[0]; - var version2 = v[1]; - var wanted = v[2]; - var found = diff(version1, version2); - var cmd = 'diff(' + version1 + ', ' + version2 + ')'; - t.equal(found, wanted, cmd + ' === ' + wanted); - }); - - t.end(); -}); - -test('\nvalid range test', function(t) { - // [range, result] - // validRange(range) -> result - // translate ranges into their canonical form - [['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'], - ['1.0.0', '1.0.0'], - ['>=*', '*'], - ['', '*'], - ['*', '*'], - ['*', '*'], - ['>=1.0.0', '>=1.0.0'], - ['>1.0.0', '>1.0.0'], - ['<=2.0.0', '<=2.0.0'], - ['1', '>=1.0.0 <2.0.0'], - ['<=2.0.0', '<=2.0.0'], - ['<=2.0.0', '<=2.0.0'], - ['<2.0.0', '<2.0.0'], - ['<2.0.0', '<2.0.0'], - ['>= 1.0.0', '>=1.0.0'], - ['>= 1.0.0', '>=1.0.0'], - ['>= 1.0.0', '>=1.0.0'], - ['> 1.0.0', '>1.0.0'], - ['> 1.0.0', '>1.0.0'], - ['<= 2.0.0', '<=2.0.0'], - ['<= 2.0.0', '<=2.0.0'], - ['<= 2.0.0', '<=2.0.0'], - ['< 2.0.0', '<2.0.0'], - ['< 2.0.0', '<2.0.0'], - ['>=0.1.97', '>=0.1.97'], - ['>=0.1.97', '>=0.1.97'], - ['0.1.20 || 1.2.4', '0.1.20||1.2.4'], - ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], - ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], - ['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'], - ['||', '||'], - ['2.x.x', '>=2.0.0 <3.0.0'], - ['1.2.x', '>=1.2.0 <1.3.0'], - ['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], - ['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], - ['x', '*'], - ['2.*.*', '>=2.0.0 <3.0.0'], - ['1.2.*', '>=1.2.0 <1.3.0'], - ['1.2.* || 2.*', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'], - ['*', '*'], - ['2', '>=2.0.0 <3.0.0'], - ['2.3', '>=2.3.0 <2.4.0'], - ['~2.4', '>=2.4.0 <2.5.0'], - ['~2.4', '>=2.4.0 <2.5.0'], - ['~>3.2.1', '>=3.2.1 <3.3.0'], - ['~1', '>=1.0.0 <2.0.0'], - ['~>1', '>=1.0.0 <2.0.0'], - ['~> 1', '>=1.0.0 <2.0.0'], - ['~1.0', '>=1.0.0 <1.1.0'], - ['~ 1.0', '>=1.0.0 <1.1.0'], - ['^0', '>=0.0.0 <1.0.0'], - ['^ 1', '>=1.0.0 <2.0.0'], - ['^0.1', '>=0.1.0 <0.2.0'], - ['^1.0', '>=1.0.0 <2.0.0'], - ['^1.2', '>=1.2.0 <2.0.0'], - ['^0.0.1', '>=0.0.1 <0.0.2'], - ['^0.0.1-beta', '>=0.0.1-beta <0.0.2'], - ['^0.1.2', '>=0.1.2 <0.2.0'], - ['^1.2.3', '>=1.2.3 <2.0.0'], - ['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0'], - ['<1', '<1.0.0'], - ['< 1', '<1.0.0'], - ['>=1', '>=1.0.0'], - ['>= 1', '>=1.0.0'], - ['<1.2', '<1.2.0'], - ['< 1.2', '<1.2.0'], - ['1', '>=1.0.0 <2.0.0'], - ['>01.02.03', '>1.2.3', true], - ['>01.02.03', null], - ['~1.2.3beta', '>=1.2.3-beta <1.3.0', true], - ['~1.2.3beta', null], - ['^ 1.2 ^ 1', '>=1.2.0 <2.0.0 >=1.0.0 <2.0.0'] - ].forEach(function(v) { - var pre = v[0]; - var wanted = v[1]; - var loose = v[2]; - var found = validRange(pre, loose); - - t.equal(found, wanted, 'validRange(' + pre + ') === ' + wanted); - }); - - t.end(); -}); - -test('\ncomparators test', function(t) { - // [range, comparators] - // turn range into a set of individual comparators - [['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]], - ['1.0.0', [['1.0.0']]], - ['>=*', [['']]], - ['', [['']]], - ['*', [['']]], - ['*', [['']]], - ['>=1.0.0', [['>=1.0.0']]], - ['>=1.0.0', [['>=1.0.0']]], - ['>=1.0.0', [['>=1.0.0']]], - ['>1.0.0', [['>1.0.0']]], - ['>1.0.0', [['>1.0.0']]], - ['<=2.0.0', [['<=2.0.0']]], - ['1', [['>=1.0.0', '<2.0.0']]], - ['<=2.0.0', [['<=2.0.0']]], - ['<=2.0.0', [['<=2.0.0']]], - ['<2.0.0', [['<2.0.0']]], - ['<2.0.0', [['<2.0.0']]], - ['>= 1.0.0', [['>=1.0.0']]], - ['>= 1.0.0', [['>=1.0.0']]], - ['>= 1.0.0', [['>=1.0.0']]], - ['> 1.0.0', [['>1.0.0']]], - ['> 1.0.0', [['>1.0.0']]], - ['<= 2.0.0', [['<=2.0.0']]], - ['<= 2.0.0', [['<=2.0.0']]], - ['<= 2.0.0', [['<=2.0.0']]], - ['< 2.0.0', [['<2.0.0']]], - ['<\t2.0.0', [['<2.0.0']]], - ['>=0.1.97', [['>=0.1.97']]], - ['>=0.1.97', [['>=0.1.97']]], - ['0.1.20 || 1.2.4', [['0.1.20'], ['1.2.4']]], - ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], - ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], - ['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]], - ['||', [[''], ['']]], - ['2.x.x', [['>=2.0.0', '<3.0.0']]], - ['1.2.x', [['>=1.2.0', '<1.3.0']]], - ['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], - ['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], - ['x', [['']]], - ['2.*.*', [['>=2.0.0', '<3.0.0']]], - ['1.2.*', [['>=1.2.0', '<1.3.0']]], - ['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], - ['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]], - ['*', [['']]], - ['2', [['>=2.0.0', '<3.0.0']]], - ['2.3', [['>=2.3.0', '<2.4.0']]], - ['~2.4', [['>=2.4.0', '<2.5.0']]], - ['~2.4', [['>=2.4.0', '<2.5.0']]], - ['~>3.2.1', [['>=3.2.1', '<3.3.0']]], - ['~1', [['>=1.0.0', '<2.0.0']]], - ['~>1', [['>=1.0.0', '<2.0.0']]], - ['~> 1', [['>=1.0.0', '<2.0.0']]], - ['~1.0', [['>=1.0.0', '<1.1.0']]], - ['~ 1.0', [['>=1.0.0', '<1.1.0']]], - ['~ 1.0.3', [['>=1.0.3', '<1.1.0']]], - ['~> 1.0.3', [['>=1.0.3', '<1.1.0']]], - ['<1', [['<1.0.0']]], - ['< 1', [['<1.0.0']]], - ['>=1', [['>=1.0.0']]], - ['>= 1', [['>=1.0.0']]], - ['<1.2', [['<1.2.0']]], - ['< 1.2', [['<1.2.0']]], - ['1', [['>=1.0.0', '<2.0.0']]], - ['1 2', [['>=1.0.0', '<2.0.0', '>=2.0.0', '<3.0.0']]], - ['1.2 - 3.4.5', [['>=1.2.0', '<=3.4.5']]], - ['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0']]], - ['1.2.3 - 3', [['>=1.2.3', '<4.0.0']]], - ['>*', [['<0.0.0']]], - ['<*', [['<0.0.0']]] - ].forEach(function(v) { - var pre = v[0]; - var wanted = v[1]; - var found = toComparators(v[0]); - var jw = JSON.stringify(wanted); - t.equivalent(found, wanted, 'toComparators(' + pre + ') === ' + jw); - }); - - t.end(); -}); - -test('\ninvalid version numbers', function(t) { - ['1.2.3.4', - 'NOT VALID', - 1.2, - null, - 'Infinity.NaN.Infinity' - ].forEach(function(v) { - t.throws(function() { - new SemVer(v); - }, {name:'TypeError', message:'Invalid Version: ' + v}); - }); - - t.end(); -}); - -test('\nstrict vs loose version numbers', function(t) { - [['=1.2.3', '1.2.3'], - ['01.02.03', '1.2.3'], - ['1.2.3-beta.01', '1.2.3-beta.1'], - [' =1.2.3', '1.2.3'], - ['1.2.3foo', '1.2.3-foo'] - ].forEach(function(v) { - var loose = v[0]; - var strict = v[1]; - t.throws(function() { - new SemVer(loose); - }); - var lv = new SemVer(loose, true); - t.equal(lv.version, strict); - t.ok(eq(loose, strict, true)); - t.throws(function() { - eq(loose, strict); - }); - t.throws(function() { - new SemVer(strict).compare(loose); - }); - }); - t.end(); -}); - -test('\nstrict vs loose ranges', function(t) { - [['>=01.02.03', '>=1.2.3'], - ['~1.02.03beta', '>=1.2.3-beta <1.3.0'] - ].forEach(function(v) { - var loose = v[0]; - var comps = v[1]; - t.throws(function() { - new Range(loose); - }); - t.equal(new Range(loose, true).range, comps); - }); - t.end(); -}); - -test('\nmax satisfying', function(t) { - [[['1.2.3', '1.2.4'], '1.2', '1.2.4'], - [['1.2.4', '1.2.3'], '1.2', '1.2.4'], - [['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~1.2.3', '1.2.6'], - [['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', '2.0.0b3', '2.0.0', '2.1.0'], '~2.0.0', '2.0.0', true] - ].forEach(function(v) { - var versions = v[0]; - var range = v[1]; - var expect = v[2]; - var loose = v[3]; - var actual = semver.maxSatisfying(versions, range, loose); - t.equal(actual, expect); - }); - t.end(); -}); diff --git a/node_modules/semver/test/ltr.js b/node_modules/semver/test/ltr.js deleted file mode 100644 index 0f7167d65..000000000 --- a/node_modules/semver/test/ltr.js +++ /dev/null @@ -1,181 +0,0 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var ltr = semver.ltr; - -test('\nltr tests', function(t) { - // [range, version, loose] - // Version should be less than range - [ - ['~1.2.2', '1.2.1'], - ['~0.6.1-1', '0.6.1-0'], - ['1.0.0 - 2.0.0', '0.0.1'], - ['1.0.0-beta.2', '1.0.0-beta.1'], - ['1.0.0', '0.0.0'], - ['>=2.0.0', '1.1.1'], - ['>=2.0.0', '1.2.9'], - ['>2.0.0', '2.0.0'], - ['0.1.20 || 1.2.4', '0.1.5'], - ['2.x.x', '1.0.0'], - ['1.2.x', '1.1.0'], - ['1.2.x || 2.x', '1.0.0'], - ['2.*.*', '1.0.1'], - ['1.2.*', '1.1.3'], - ['1.2.* || 2.*', '1.1.9999'], - ['2', '1.0.0'], - ['2.3', '2.2.2'], - ['~2.4', '2.3.0'], // >=2.4.0 <2.5.0 - ['~2.4', '2.3.5'], - ['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0 - ['~1', '0.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '0.2.4'], - ['~> 1', '0.2.3'], - ['~1.0', '0.1.2'], // >=1.0.0 <1.1.0 - ['~ 1.0', '0.1.0'], - ['>1.2', '1.2.0'], - ['> 1.2', '1.2.1'], - ['1', '0.0.0beta', true], - ['~v0.5.4-pre', '0.5.4-alpha'], - ['~v0.5.4-pre', '0.5.4-alpha'], - ['=0.7.x', '0.6.0'], - ['=0.7.x', '0.6.0-asdf'], - ['>=0.7.x', '0.6.0'], - ['~1.2.2', '1.2.1'], - ['1.0.0 - 2.0.0', '0.2.3'], - ['1.0.0', '0.0.1'], - ['>=2.0.0', '1.0.0'], - ['>=2.0.0', '1.9999.9999'], - ['>=2.0.0', '1.2.9'], - ['>2.0.0', '2.0.0'], - ['>2.0.0', '1.2.9'], - ['2.x.x', '1.1.3'], - ['1.2.x', '1.1.3'], - ['1.2.x || 2.x', '1.1.3'], - ['2.*.*', '1.1.3'], - ['1.2.*', '1.1.3'], - ['1.2.* || 2.*', '1.1.3'], - ['2', '1.9999.9999'], - ['2.3', '2.2.1'], - ['~2.4', '2.3.0'], // >=2.4.0 <2.5.0 - ['~>3.2.1', '2.3.2'], // >=3.2.1 <3.3.0 - ['~1', '0.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '0.2.3'], - ['~1.0', '0.0.0'], // >=1.0.0 <1.1.0 - ['>1', '1.0.0'], - ['2', '1.0.0beta', true], - ['>1', '1.0.0beta', true], - ['> 1', '1.0.0beta', true], - ['=0.7.x', '0.6.2'], - ['=0.7.x', '0.7.0-asdf'], - ['^1', '1.0.0-0'], - ['>=0.7.x', '0.7.0-asdf'], - ['1', '1.0.0beta', true], - ['>=0.7.x', '0.6.2'], - ['>1.2.3', '1.3.0-alpha'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'ltr(' + version + ', ' + range + ', ' + loose + ')'; - t.ok(ltr(version, range, loose), msg); - }); - t.end(); -}); - -test('\nnegative ltr tests', function(t) { - // [range, version, loose] - // Version should NOT be less than range - [ - ['~ 1.0', '1.1.0'], - ['~0.6.1-1', '0.6.1-1'], - ['1.0.0 - 2.0.0', '1.2.3'], - ['1.0.0 - 2.0.0', '2.9.9'], - ['1.0.0', '1.0.0'], - ['>=*', '0.2.4'], - ['', '1.0.0', true], - ['*', '1.2.3'], - ['>=1.0.0', '1.0.0'], - ['>=1.0.0', '1.0.1'], - ['>=1.0.0', '1.1.0'], - ['>1.0.0', '1.0.1'], - ['>1.0.0', '1.1.0'], - ['<=2.0.0', '2.0.0'], - ['<=2.0.0', '1.9999.9999'], - ['<=2.0.0', '0.2.9'], - ['<2.0.0', '1.9999.9999'], - ['<2.0.0', '0.2.9'], - ['>= 1.0.0', '1.0.0'], - ['>= 1.0.0', '1.0.1'], - ['>= 1.0.0', '1.1.0'], - ['> 1.0.0', '1.0.1'], - ['> 1.0.0', '1.1.0'], - ['<= 2.0.0', '2.0.0'], - ['<= 2.0.0', '1.9999.9999'], - ['<= 2.0.0', '0.2.9'], - ['< 2.0.0', '1.9999.9999'], - ['<\t2.0.0', '0.2.9'], - ['>=0.1.97', 'v0.1.97'], - ['>=0.1.97', '0.1.97'], - ['0.1.20 || 1.2.4', '1.2.4'], - ['0.1.20 || >1.2.4', '1.2.4'], - ['0.1.20 || 1.2.4', '1.2.3'], - ['0.1.20 || 1.2.4', '0.1.20'], - ['>=0.2.3 || <0.0.1', '0.0.0'], - ['>=0.2.3 || <0.0.1', '0.2.3'], - ['>=0.2.3 || <0.0.1', '0.2.4'], - ['||', '1.3.4'], - ['2.x.x', '2.1.3'], - ['1.2.x', '1.2.3'], - ['1.2.x || 2.x', '2.1.3'], - ['1.2.x || 2.x', '1.2.3'], - ['x', '1.2.3'], - ['2.*.*', '2.1.3'], - ['1.2.*', '1.2.3'], - ['1.2.* || 2.*', '2.1.3'], - ['1.2.* || 2.*', '1.2.3'], - ['1.2.* || 2.*', '1.2.3'], - ['*', '1.2.3'], - ['2', '2.1.2'], - ['2.3', '2.3.1'], - ['~2.4', '2.4.0'], // >=2.4.0 <2.5.0 - ['~2.4', '2.4.5'], - ['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0 - ['~1', '1.2.3'], // >=1.0.0 <2.0.0 - ['~>1', '1.2.3'], - ['~> 1', '1.2.3'], - ['~1.0', '1.0.2'], // >=1.0.0 <1.1.0 - ['~ 1.0', '1.0.2'], - ['>=1', '1.0.0'], - ['>= 1', '1.0.0'], - ['<1.2', '1.1.1'], - ['< 1.2', '1.1.1'], - ['~v0.5.4-pre', '0.5.5'], - ['~v0.5.4-pre', '0.5.4'], - ['=0.7.x', '0.7.2'], - ['>=0.7.x', '0.7.2'], - ['<=0.7.x', '0.6.2'], - ['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'], - ['>=0.2.3 <=0.2.4', '0.2.4'], - ['1.0.0 - 2.0.0', '2.0.0'], - ['^3.0.0', '4.0.0'], - ['^1.0.0 || ~2.0.1', '2.0.0'], - ['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'], - ['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true], - ['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true], - ['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'], - ['^1.0.0alpha', '1.0.0beta', true], - ['~1.0.0alpha', '1.0.0beta', true], - ['^1.0.0-alpha', '1.0.0beta', true], - ['~1.0.0-alpha', '1.0.0beta', true], - ['^1.0.0-alpha', '1.0.0-beta'], - ['~1.0.0-alpha', '1.0.0-beta'], - ['=0.1.0', '1.0.0'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = '!ltr(' + version + ', ' + range + ', ' + loose + ')'; - t.notOk(ltr(version, range, loose), msg); - }); - t.end(); -}); diff --git a/node_modules/semver/test/major-minor-patch.js b/node_modules/semver/test/major-minor-patch.js deleted file mode 100644 index e9d4039c8..000000000 --- a/node_modules/semver/test/major-minor-patch.js +++ /dev/null @@ -1,72 +0,0 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); - -test('\nmajor tests', function(t) { - // [range, version] - // Version should be detectable despite extra characters - [ - ['1.2.3', 1], - [' 1.2.3 ', 1], - [' 2.2.3-4 ', 2], - [' 3.2.3-pre ', 3], - ['v5.2.3', 5], - [' v8.2.3 ', 8], - ['\t13.2.3', 13], - ['=21.2.3', 21, true], - ['v=34.2.3', 34, true] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'major(' + range + ') = ' + version; - t.equal(semver.major(range, loose), version, msg); - }); - t.end(); -}); - -test('\nminor tests', function(t) { - // [range, version] - // Version should be detectable despite extra characters - [ - ['1.1.3', 1], - [' 1.1.3 ', 1], - [' 1.2.3-4 ', 2], - [' 1.3.3-pre ', 3], - ['v1.5.3', 5], - [' v1.8.3 ', 8], - ['\t1.13.3', 13], - ['=1.21.3', 21, true], - ['v=1.34.3', 34, true] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'minor(' + range + ') = ' + version; - t.equal(semver.minor(range, loose), version, msg); - }); - t.end(); -}); - -test('\npatch tests', function(t) { - // [range, version] - // Version should be detectable despite extra characters - [ - ['1.2.1', 1], - [' 1.2.1 ', 1], - [' 1.2.2-4 ', 2], - [' 1.2.3-pre ', 3], - ['v1.2.5', 5], - [' v1.2.8 ', 8], - ['\t1.2.13', 13], - ['=1.2.21', 21, true], - ['v=1.2.34', 34, true] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'patch(' + range + ') = ' + version; - t.equal(semver.patch(range, loose), version, msg); - }); - t.end(); -}); diff --git a/node_modules/semver/test/no-module.js b/node_modules/semver/test/no-module.js deleted file mode 100644 index 8b50873f1..000000000 --- a/node_modules/semver/test/no-module.js +++ /dev/null @@ -1,19 +0,0 @@ -var tap = require('tap'); -var test = tap.test; - -test('no module system', function(t) { - var fs = require('fs'); - var vm = require('vm'); - var head = fs.readFileSync(require.resolve('../head.js.txt'), 'utf8'); - var src = fs.readFileSync(require.resolve('../'), 'utf8'); - var foot = fs.readFileSync(require.resolve('../foot.js.txt'), 'utf8'); - vm.runInThisContext(head + src + foot, 'semver.js'); - - // just some basic poking to see if it did some stuff - t.type(global.semver, 'object'); - t.type(global.semver.SemVer, 'function'); - t.type(global.semver.Range, 'function'); - t.ok(global.semver.satisfies('1.2.3', '1.2')); - t.end(); -}); - diff --git a/node_modules/signal-exit/index.js b/node_modules/signal-exit/index.js index 7dd8d917d..337f691ed 100644 --- a/node_modules/signal-exit/index.js +++ b/node_modules/signal-exit/index.js @@ -19,6 +19,15 @@ if (process.__signal_exit_emitter__) { emitter.emitted = {} } +// Because this emitter is a global, we have to check to see if a +// previous version of this library failed to enable infinite listeners. +// I know what you're about to say. But literally everything about +// signal-exit is a compromise with evil. Get used to it. +if (!emitter.infinite) { + emitter.setMaxListeners(Infinity) + emitter.infinite = true +} + module.exports = function (cb, opts) { assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') diff --git a/node_modules/signal-exit/package.json b/node_modules/signal-exit/package.json index 8429fac49..50364ccb6 100644 --- a/node_modules/signal-exit/package.json +++ b/node_modules/signal-exit/package.json @@ -1,6 +1,6 @@ { "name": "signal-exit", - "version": "3.0.1", + "version": "3.0.2", "description": "when you want to fire an event no matter how a process exits.", "main": "index.js", "scripts": { @@ -33,6 +33,6 @@ "nyc": "^8.1.0", "standard": "^7.1.2", "standard-version": "^2.3.0", - "tap": "^7.1.0" + "tap": "^8.0.1" } } diff --git a/node_modules/supports-color/index.js b/node_modules/supports-color/index.js index a2b978450..2571c735f 100644 --- a/node_modules/supports-color/index.js +++ b/node_modules/supports-color/index.js @@ -1,39 +1,84 @@ 'use strict'; -var argv = process.argv; +var hasFlag = require('has-flag'); -module.exports = (function () { - if (argv.indexOf('--no-color') !== -1 || - argv.indexOf('--no-colors') !== -1 || - argv.indexOf('--color=false') !== -1) { +var support = function (level) { + if (level === 0) { return false; } - if (argv.indexOf('--color') !== -1 || - argv.indexOf('--colors') !== -1 || - argv.indexOf('--color=true') !== -1 || - argv.indexOf('--color=always') !== -1) { - return true; + return { + level: level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +}; + +var supportLevel = (function () { + if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + return 1; } if (process.stdout && !process.stdout.isTTY) { - return false; + return 0; } if (process.platform === 'win32') { - return true; + return 1; } - if ('COLORTERM' in process.env) { - return true; + if ('CI' in process.env) { + if ('TRAVIS' in process.env || process.env.CI === 'Travis') { + return 1; + } + + return 0; } - if (process.env.TERM === 'dumb') { - return false; + if ('TEAMCITY_VERSION' in process.env) { + return process.env.TEAMCITY_VERSION.match(/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/) === null ? 0 : 1; + } + + if (/^(screen|xterm)-256(?:color)?/.test(process.env.TERM)) { + return 2; } if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { - return true; + return 1; + } + + if ('COLORTERM' in process.env) { + return 1; } - return false; + if (process.env.TERM === 'dumb') { + return 0; + } + + return 0; })(); + +if (supportLevel === 0 && 'FORCE_COLOR' in process.env) { + supportLevel = 1; +} + +module.exports = process && support(supportLevel); diff --git a/node_modules/supports-color/package.json b/node_modules/supports-color/package.json index 7f72e762a..0cc4b383d 100644 --- a/node_modules/supports-color/package.json +++ b/node_modules/supports-color/package.json @@ -1,30 +1,32 @@ { "name": "supports-color", - "version": "1.2.0", + "version": "3.2.3", "description": "Detect whether a terminal supports color", "license": "MIT", - "repository": "sindresorhus/supports-color", + "repository": "chalk/supports-color", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "bin": { - "supports-color": "cli.js" + "url": "sindresorhus.com" }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Boy Nicolai Appelman (jbna.nl)", + "JD Ballard (github.com/qix-)" + ], + "browser": "browser.js", "engines": { - "node": ">=0.10.0" + "node": ">=0.8.0" }, "scripts": { - "test": "mocha" + "test": "xo && mocha", + "travis": "mocha" }, "files": [ "index.js", - "cli.js" + "browser.js" ], "keywords": [ - "cli", - "bin", "color", "colour", "colors", @@ -42,10 +44,23 @@ "support", "supports", "capability", - "detect" + "detect", + "truecolor", + "16m", + "million" ], + "dependencies": { + "has-flag": "^1.0.0" + }, "devDependencies": { "mocha": "*", - "require-uncached": "^1.0.2" + "require-uncached": "^1.0.2", + "xo": "*" + }, + "xo": { + "envs": [ + "node", + "mocha" + ] } } diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md index 32d4f46e9..f7bae4c54 100644 --- a/node_modules/supports-color/readme.md +++ b/node_modules/supports-color/readme.md @@ -1,11 +1,11 @@ -# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) +# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) > Detect whether a terminal supports color ## Install -```sh +``` $ npm install --save supports-color ``` @@ -18,25 +18,41 @@ var supportsColor = require('supports-color'); if (supportsColor) { console.log('Terminal supports color'); } + +if (supportsColor.has256) { + console.log('Terminal supports 256 colors'); +} + +if (supportsColor.has16m) { + console.log('Terminal supports 16 million colors (truecolor)'); +} ``` -It obeys the `--color` and `--no-color` CLI flags. +## API -## CLI +Returns an `object`, or `false` if color is not supported. -```sh -$ npm install --global supports-color -``` +The returned object specifies a level of support for color through a `.level` property and a corresponding flag: -``` -$ supports-color --help +- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) +- `.level = 2` and `.has256 = true`: 256 color support +- `.level = 3` and `.has16m = true`: 16 million (truecolor) support - Usage - supports-color - Exits with code 0 if color is supported and 1 if not -``` +## Info + +It obeys the `--color` and `--no-color` CLI flags. + +For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. + +Explicit 256/truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. + + +## Related + +- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right ## License diff --git a/node_modules/systemjs/README.md b/node_modules/systemjs/README.md index afe998a27..8eab2cc46 100644 --- a/node_modules/systemjs/README.md +++ b/node_modules/systemjs/README.md @@ -5,6 +5,8 @@ SystemJS [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/systemjs/systemjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Support](https://supporterhq.com/api/b/33df4abbec4d39260f49015d2457eafe/SystemJS)](https://supporterhq.com/support/33df4abbec4d39260f49015d2457eafe/SystemJS) +_SystemJS 0.20.0-alpha.1 is now available with performance improvements and Web Assembly support. [Try it out here](https://github.com/systemjs/systemjs/releases/tag/0.20.0-alpha.1)._ + Universal dynamic module loader - loads ES6 modules, AMD, CommonJS and global scripts in the browser and NodeJS. * [Loads any module format](docs/module-formats.md) with [exact circular reference and binding support](https://github.com/ModuleLoader/es6-module-loader/blob/v0.17.0/docs/circular-references-bindings.md). @@ -125,6 +127,7 @@ Additional Plugins: * [SASS](https://github.com/screendriver/plugin-sass) * [SCSS](https://github.com/kevcjones/plugin-scss) * [sofe](https://github.com/CanopyTax/sofe) +* [svelte](https://github.com/CanopyTax/system-svelte) * [SVG](https://github.com/vuzonp/systemjs-plugin-svg) * [WebFont](https://github.com/guybedford/plugin-font) * [WebWorkers](https://github.com/casperlamboo/plugin-worker) diff --git a/node_modules/systemjs/dist/system-csp-production.js b/node_modules/systemjs/dist/system-csp-production.js index 2fb9fdd75..8cbabeb0e 100644 --- a/node_modules/systemjs/dist/system-csp-production.js +++ b/node_modules/systemjs/dist/system-csp-production.js @@ -1,6 +1,6 @@ /* - * SystemJS v0.19.41 + * SystemJS v0.19.47 */ -!function(){function e(){!function(e){function t(e,n){if("string"!=typeof e)throw new TypeError("URL must be a string");var r=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);if(!r)throw new RangeError("Invalid URL format");var a=r[1]||"",o=r[2]||"",i=r[3]||"",s=r[4]||"",l=r[5]||"",u=r[6]||"",d=r[7]||"",c=r[8]||"",f=r[9]||"";if(void 0!==n){var m=n instanceof t?n:new t(n),p=!a&&!s&&!o;!p||d||c||(c=m.search),p&&"/"!==d[0]&&(d=d?(!m.host&&!m.username||m.pathname?"":"/")+m.pathname.slice(0,m.pathname.lastIndexOf("/")+1)+d:m.pathname);var h=[];d.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?h.pop():h.push(e)}),d=h.join("").replace(/^\//,"/"===d[0]?"/":""),p&&(u=m.port,l=m.hostname,s=m.host,i=m.password,o=m.username),a||(a=m.protocol)}d=d.replace(/\\/g,"/"),this.origin=s?a+(""!==a||""!==s?"//":"")+s:"",this.href=a+(a&&s||"file:"==a?"//":"")+(""!==o?o+(""!==i?":"+i:"")+"@":"")+s+d+c+f,this.protocol=a,this.username=o,this.password=i,this.host=s,this.hostname=l,this.port=u,this.pathname=d,this.search=c,this.hash=f}e.URLPolyfill=t}("undefined"!=typeof self?self:global),function(e){function t(e,t){if(!e.originalErr)for(var n=((e.message||e)+(e.stack?"\n"+e.stack:"")).toString().split("\n"),r=[],a=0;as.length?(o[s]&&"/"||"")+t.substr(s.length):"")}else{var d=s.split("*");if(d.length>2)throw new TypeError("Only one wildcard in a path is permitted");var f=d[0].length;f>=a&&t.substr(0,d[0].length)==d[0]&&t.substr(t.length-d[1].length)==d[1]&&(a=f,r=s,n=t.substr(d[0].length,t.length-d[1].length-d[0].length))}}var m=o[r];return"string"==typeof n&&(m=m.replace("*",n)),m}function m(e){for(var t=[],n=[],r=0,a=e.length;r",linkSets:[],dependencies:[],metadata:{}}}function a(e,t,n){return new Promise(u({step:n.address?"fetch":"locate",loader:e,moduleName:t,moduleMetadata:n&&n.metadata||{},moduleSource:n.source,moduleAddress:n.address}))}function o(t,n,r,a){return new Promise(function(e,o){e(t.loaderObj.normalize(n,r,a))}).then(function(n){var r;if(t.modules[n])return r=e(n),r.status="linked",r.module=t.modules[n],r;for(var a=0,o=t.loads.length;a0)){var n=e.startingLoad;if(e.loader.loaderObj.execute===!1){for(var r=[].concat(e.loads),a=0,o=r.length;a "'+r.paths[o]+'" uses wildcards which are being deprecated for just leaving a trailing "/" to indicate folder paths.')}if(e.defaultJSExtensions&&(r.defaultJSExtensions=e.defaultJSExtensions,w.call(r,"The defaultJSExtensions configuration option is deprecated, use packages configuration instead.")),e.pluginFirst&&(r.pluginFirst=e.pluginFirst),e.map)for(var o in e.map){var i=e.map[o];if("string"!=typeof i){var s=r.defaultJSExtensions&&".js"!=o.substr(o.length-3,3),l=r.decanonicalize(o);s&&".js"==l.substr(l.length-3,3)&&(l=l.substr(0,l.length-3));var u="";for(var c in r.packages)l.substr(0,c.length)==c&&(!l[c.length]||"/"==l[c.length])&&u.split("/").lengtha&&(n=o,a=r));return n}function t(e,t,n,r,a){if(!r||"/"==r[r.length-1]||a||t.defaultExtension===!1)return r;var o=!1;if(t.meta&&p(t.meta,r,function(e,t,n){if(0==n||e.lastIndexOf("*")!=e.length-1)return o=!0}),!o&&e.meta&&p(e.meta,n+"/"+r,function(e,t,n){if(0==n||e.lastIndexOf("*")!=e.length-1)return o=!0}),o)return r;var i="."+(t.defaultExtension||"js");return r.substr(r.length-i.length)!=i?r+i:r}function n(e,n,r,a,i){if(!a){if(!n.main)return r+(e.defaultJSExtensions?".js":"");a="./"==n.main.substr(0,2)?n.main.substr(2):n.main}if(n.map){var s="./"+a,l=S(n.map,s);if(l||(s="./"+t(e,n,r,a,i),s!="./"+a&&(l=S(n.map,s))),l){var u=o(e,n,r,l,s,i);if(u)return u}}return r+"/"+t(e,n,r,a,i)}function r(e,t,n,r){if("."==e)throw new Error("Package "+n+' has a map entry for "." which is not permitted.');return!(t.substr(0,e.length)==e&&r.length>e.length)}function o(e,n,a,o,i,s){"/"==i[i.length-1]&&(i=i.substr(0,i.length-1));var l=n.map[o];if("object"==typeof l)throw new Error("Synchronous conditional normalization not supported sync normalizing "+o+" in "+a);if(r(o,l,a,i)&&"string"==typeof l){if("."==l)l=a;else if("./"==l.substr(0,2))return a+"/"+t(e,n,a,l.substr(2)+i.substr(o.length),s);return e.normalizeSync(l+i.substr(o.length),a+"/")}}function l(e,n,r,a,o){if(!a){if(!n.main)return Promise.resolve(r+(e.defaultJSExtensions?".js":""));a="./"==n.main.substr(0,2)?n.main.substr(2):n.main}var i,s;return n.map&&(i="./"+a,s=S(n.map,i),s||(i="./"+t(e,n,r,a,o),i!="./"+a&&(s=S(n.map,i)))),(s?d(e,n,r,s,i,o):Promise.resolve()).then(function(i){return i?Promise.resolve(i):Promise.resolve(r+"/"+t(e,n,r,a,o))})}function u(e,n,r,a,o,i,s){if("."==o)o=r;else if("./"==o.substr(0,2))return Promise.resolve(r+"/"+t(e,n,r,o.substr(2)+i.substr(a.length),s)).then(function(t){return L.call(e,t,r+"/")});return e.normalize(o+i.substr(a.length),r+"/")}function d(e,t,n,a,o,i){"/"==o[o.length-1]&&(o=o.substr(0,o.length-1));var s=t.map[a];if("string"==typeof s)return r(a,s,n,o)?u(e,t,n,a,s,o,i):Promise.resolve();if(e.builder)return Promise.resolve(n+"/#:"+o);var l=[],d=[];for(var c in s){var f=z(c);d.push({condition:f,map:s[c]}),l.push(e.import(f.module,n))}return Promise.all(l).then(function(e){for(var t=0;tl&&(l=n),v(s,t,n&&l>n)}),v(n.metadata,s)}o.format&&!n.metadata.loader&&(n.metadata.format=n.metadata.format||o.format)}return t})}})}(),function(){function t(){if(s&&"interactive"===s.script.readyState)return s.load;for(var e=0;e=0;i--){for(var s=a[i],l=0;l1;)r=a.shift(),e=e[r]=e[r]||{};r=a.shift(),r in e||(e[r]=n)}s(function(e){return function(){this.meta={},e.call(this)}}),i("locate",function(e){return function(t){var n,r=this.meta,a=t.name,o=0;for(var i in r)if(n=i.indexOf("*"),n!==-1&&i.substr(0,n)===a.substr(0,n)&&i.substr(n+1)===a.substr(a.length-i.length+n+1)){var s=i.split("/").length;s>o&&(o=s),v(t.metadata,r[i],o!=s)}return r[a]&&v(t.metadata,r[a]),e.call(this,t)}});var t=/^(\s*\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)+/,n=/\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\/\/[^\n]*|"[^"]+"\s*;?|'[^']+'\s*;?/g;i("translate",function(r){return function(a){if("defined"==a.metadata.format)return a.metadata.deps=a.metadata.deps||[],Promise.resolve(a.source);var o=a.source.match(t);if(o)for(var i=o[0].match(n),s=0;s')}else e()}else if("undefined"!=typeof importScripts){var a="";try{throw new Error("_")}catch(e){e.stack.replace(/(?:at|@).*(http.+):[\d]+:[\d]+/,function(e,t){$__curScript={src:t},a=t.replace(/\/[^\/]*$/,"/")})}t&&importScripts(a+"system-polyfills.js"),e()}else $__curScript="undefined"!=typeof __filename?{src:__filename}:null,e()}(); +!function(){function e(){!function(e){function t(e,n){if("string"!=typeof e)throw new TypeError("URL must be a string");var r=String(e).replace(/^\s+|\s+$/g,"").replace(/\\/g,"/").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);if(!r)throw new RangeError("Invalid URL format");var a=r[1]||"",o=r[2]||"",i=r[3]||"",s=r[4]||"",l=r[5]||"",u=r[6]||"",d=r[7]||"",c=r[8]||"",f=r[9]||"";if(void 0!==n){var m=n instanceof t?n:new t(n),p=!a&&!s&&!o;!p||d||c||(c=m.search),p&&"/"!==d[0]&&(d=d?(!m.host&&!m.username||m.pathname?"":"/")+m.pathname.slice(0,m.pathname.lastIndexOf("/")+1)+d:m.pathname);var h=[];d.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?h.pop():h.push(e)}),d=h.join("").replace(/^\//,"/"===d[0]?"/":""),p&&(u=m.port,l=m.hostname,s=m.host,i=m.password,o=m.username),a||(a=m.protocol)}d=d.replace(/\\/g,"/"),this.origin=s?a+(""!==a||""!==s?"//":"")+s:"",this.href=a+(a&&s||"file:"==a?"//":"")+(""!==o?o+(""!==i?":"+i:"")+"@":"")+s+d+c+f,this.protocol=a,this.username=o,this.password=i,this.host=s,this.hostname=l,this.port=u,this.pathname=d,this.search=c,this.hash=f}e.URLPolyfill=t}("undefined"!=typeof self?self:global),function(e){function t(e,t){if(!e.originalErr)for(var n=((e.message||e)+(e.stack?"\n"+e.stack:"")).toString().split("\n"),r=[],a=0;as.length?(o[s]&&"/"||"")+t.substr(s.length):"")}else{var d=s.split("*");if(d.length>2)throw new TypeError("Only one wildcard in a path is permitted");var f=d[0].length;f>=a&&t.substr(0,d[0].length)==d[0]&&t.substr(t.length-d[1].length)==d[1]&&(a=f,r=s,n=t.substr(d[0].length,t.length-d[1].length-d[0].length))}}var m=o[r];return"string"==typeof n&&(m=m.replace("*",n)),m}function m(e){for(var t=[],n=[],r=0,a=e.length;a>r;r++){var o=$.call(t,e[r]);-1===o?(t.push(e[r]),n.push([r])):n[o].push(r)}return{names:t,indices:n}}function p(t){var n={};if(("object"==typeof t||"function"==typeof t)&&t!==e)if(Q)for(var r in t)"default"!==r&&h(n,t,r);else g(n,t);return n["default"]=t,J(n,"__useDefault",{value:!0}),n}function h(e,t,n){try{var r;(r=Object.getOwnPropertyDescriptor(t,n))&&J(e,n,r)}catch(a){return e[n]=t[n],!1}}function g(e,t,n){var r=t&&t.hasOwnProperty;for(var a in t)(!r||t.hasOwnProperty(a))&&(n&&a in e||(e[a]=t[a]));return e}function v(e,t,n){var r=t&&t.hasOwnProperty;for(var a in t)if(!r||t.hasOwnProperty(a)){var o=t[a];a in e?o instanceof Array&&e[a]instanceof Array?e[a]=[].concat(n?o:e[a]).concat(n?e[a]:o):"object"==typeof o&&null!==o&&"object"==typeof e[a]?e[a]=g(g({},e[a]),o,n):n||(e[a]=o):e[a]=o}}function y(e,t,n,r,a){for(var o in t)if(-1!=$.call(["main","format","defaultExtension","basePath"],o))e[o]=t[o];else if("map"==o)g(e.map=e.map||{},t.map);else if("meta"==o)g(e.meta=e.meta||{},t.meta);else if("depCache"==o)for(var i in t.depCache){var s;s="./"==i.substr(0,2)?n+"/"+i.substr(2):k.call(r,i),r.depCache[s]=(r.depCache[s]||[]).concat(t.depCache[i])}else!a||-1!=$.call(["browserConfig","nodeConfig","devConfig","productionConfig"],o)||t.hasOwnProperty&&!t.hasOwnProperty(o)||w.call(r,'"'+o+'" is not a valid package configuration option in package '+n)}function b(e,t,n,r){var a;if(e.packages[t]){var o=e.packages[t];a=e.packages[t]={},y(a,r?n:o,t,e,r),y(a,r?o:n,t,e,!r)}else a=e.packages[t]=n;return"object"==typeof a.main&&(a.map=a.map||{},a.map["./@main"]=a.main,a.main["default"]=a.main["default"]||"./",a.main="@main"),a}function w(e){this.warnings&&"undefined"!=typeof console&&console.warn&&console.warn(e)}function x(e,t){e.metadata.entry=R(),e.metadata.entry.execute=function(){return t},e.metadata.entry.deps=[],e.metadata.format="defined"}function S(e,t){for(var n=e.split(".");n.length;)t=t[n.shift()];return t}function E(e,t){var n,r=0;for(var a in e)if(t.substr(0,a.length)==a&&(t.length==a.length||"/"==t[a.length])){var o=a.split("/").length;if(r>=o)continue;n=a,r=o}return n}function _(e){this._loader.baseURL!==this.baseURL&&("/"!=this.baseURL[this.baseURL.length-1]&&(this.baseURL+="/"),this._loader.baseURL=this.baseURL=new G(this.baseURL,K).href)}function P(e,t){this.set("@system-env",te=this.newModule({browser:U,node:!!this._nodeRequire,production:!t&&e,dev:t||!e,build:t,"default":!0}))}function j(e,t){if(!d(e))throw new Error("Node module "+e+" can't be loaded as it is not a package require.");if(!ne){var n=this._nodeRequire("module"),r=t.substr(A?8:7);ne=new n(r),ne.paths=n._nodeModulePaths(r)}return ne.require(e)}function k(e,t){if(u(e))return c(e,t);if(l(e))return e;var n=E(this.map,e);if(n){if(e=this.map[n]+e.substr(n.length),u(e))return c(e);if(l(e))return e}if(this.has(e))return e;if("@node/"==e.substr(0,6)){if(!this._nodeRequire)throw new TypeError("Error loading "+e+". Can only load node core modules in Node.");return this.builder?this.set(e,this.newModule({})):this.set(e,this.newModule(p(j.call(this,e.substr(6),this.baseURL)))),e}return _.call(this),f(this,e)||this.baseURL+e}function O(e,t,n){te.browser&&t.browserConfig&&n(t.browserConfig),te.node&&t.nodeConfig&&n(t.nodeConfig),te.dev&&t.devConfig&&n(t.devConfig),te.build&&t.buildConfig&&n(t.buildConfig),te.production&&t.productionConfig&&n(t.productionConfig)}function M(e){var t=e.match(oe);return t&&"System.register"==e.substr(t[0].length,15)}function R(){return{name:null,deps:null,originalIndices:null,declare:null,execute:null,executingRequire:!1,declarative:!1,normalizedDeps:null,groupIndex:null,evaluated:!1,module:null,esModule:null,esmExports:!1}}function z(t){if("string"==typeof t)return S(t,e);if(!(t instanceof Array))throw new Error("Global exports must be a string or array.");for(var n={},r=!0,a=0;at;t++)if(this[t]===e)return t;return-1};!function(){try{Object.defineProperty({},"a",{})&&(J=Object.defineProperty)}catch(e){J=function(e,t,n){try{e[t]=n.value||n.get.call(e)}catch(r){}}}}();var N,F="_"==new Error(0,"_").fileName;if("undefined"!=typeof document&&document.getElementsByTagName){if(N=document.baseURI,!N){var B=document.getElementsByTagName("base");N=B[0]&&B[0].href||window.location.href}}else"undefined"!=typeof location&&(N=e.location.href);if(N)N=N.split("#")[0].split("?")[0],N=N.substr(0,N.lastIndexOf("/")+1);else{if("undefined"==typeof process||!process.cwd)throw new TypeError("No environment baseURI");N="file://"+(A?"/":"")+process.cwd()+"/",A&&(N=N.replace(/\\/g,"/"))}try{var H="test:"==new e.URL("test:///").protocol}catch(X){}var G=H?e.URL:e.URLPolyfill;J(n.prototype,"toString",{value:function(){return"Module"}}),function(){function e(e){return{status:"loading",name:e||"",linkSets:[],dependencies:[],metadata:{}}}function a(e,t,n){return new Promise(u({step:n.address?"fetch":"locate",loader:e,moduleName:t,moduleMetadata:n&&n.metadata||{},moduleSource:n.source,moduleAddress:n.address}))}function o(t,n,r,a){return new Promise(function(e,o){e(t.loaderObj.normalize(n,r,a))}).then(function(n){var r;if(t.modules[n])return r=e(n),r.status="linked",r.module=t.modules[n],r;for(var a=0,o=t.loads.length;o>a;a++)if(r=t.loads[a],r.name==n)return r;return r=e(n),t.loads.push(r),i(t,r),r})}function i(e,t){s(e,t,Promise.resolve().then(function(){return e.loaderObj.locate({name:t.name,metadata:t.metadata})}))}function s(e,t,n){l(e,t,n.then(function(n){return"loading"==t.status?(t.address=n,e.loaderObj.fetch({name:t.name,metadata:t.metadata,address:n})):void 0}))}function l(e,t,n){n.then(function(n){return"loading"==t.status?(t.address=t.address||t.name,Promise.resolve(e.loaderObj.translate({name:t.name,metadata:t.metadata,address:t.address,source:n})).then(function(n){return t.source=n,e.loaderObj.instantiate({name:t.name,metadata:t.metadata,address:t.address,source:n})}).then(function(e){if(void 0===e)throw new TypeError("Declarative modules unsupported in the polyfill.");if("object"!=typeof e)throw new TypeError("Invalid instantiate return value");t.depsList=e.deps||[],t.execute=e.execute}).then(function(){t.dependencies=[];for(var n=t.depsList,r=[],a=0,i=n.length;i>a;a++)(function(n,a){r.push(o(e,n,t.name,t.address).then(function(e){if(t.dependencies[a]={key:n,value:e.name},"linked"!=e.status)for(var r=t.linkSets.concat([]),o=0,i=r.length;i>o;o++)c(r[o],e)}))})(n[a],a);return Promise.all(r)}).then(function(){t.status="loaded";for(var e=t.linkSets.concat([]),n=0,r=e.length;r>n;n++)m(e[n],t)})):void 0})["catch"](function(e){t.status="failed",t.exception=e;for(var n=t.linkSets.concat([]),r=0,a=n.length;a>r;r++)p(n[r],t,e)})}function u(t){return function(n,r){var a=t.loader,o=t.moduleName,u=t.step;if(a.modules[o])throw new TypeError('"'+o+'" already exists in the module table');for(var c,f=0,m=a.loads.length;m>f;f++)if(a.loads[f].name==o&&(c=a.loads[f],"translate"!=u||c.source||(c.address=t.moduleAddress,l(a,c,Promise.resolve(t.moduleSource))),c.linkSets.length&&c.linkSets[0].loads[0].name==c.name))return c.linkSets[0].done.then(function(){n(c)});var p=c||e(o);p.metadata=t.moduleMetadata;var h=d(a,p);a.loads.push(p),n(h.done),"locate"==u?i(a,p):"fetch"==u?s(a,p,Promise.resolve(t.moduleAddress)):(p.address=t.moduleAddress,l(a,p,Promise.resolve(t.moduleSource)))}}function d(e,t){var n={loader:e,loads:[],startingLoad:t,loadingCount:0};return n.done=new Promise(function(e,t){n.resolve=e,n.reject=t}),c(n,t),n}function c(e,t){if("failed"!=t.status){for(var n=0,r=e.loads.length;r>n;n++)if(e.loads[n]==t)return;e.loads.push(t),t.linkSets.push(e),"loaded"!=t.status&&e.loadingCount++;for(var a=e.loader,n=0,r=t.dependencies.length;r>n;n++)if(t.dependencies[n]){var o=t.dependencies[n].value;if(!a.modules[o])for(var i=0,s=a.loads.length;s>i;i++)if(a.loads[i].name==o){c(e,a.loads[i]);break}}}}function f(e){var t=!1;try{y(e,function(n,r){p(e,n,r),t=!0})}catch(n){p(e,null,n),t=!0}return t}function m(e,t){if(e.loadingCount--,!(e.loadingCount>0)){var n=e.startingLoad;if(e.loader.loaderObj.execute===!1){for(var r=[].concat(e.loads),a=0,o=r.length;o>a;a++){var t=r[a];t.module={name:t.name,module:w({}),evaluated:!0},t.status="linked",h(e.loader,t)}return e.resolve(n)}var i=f(e);i||e.resolve(n)}}function p(e,n,r){var a=e.loader;e:if(n)if(e.loads[0].name==n.name)r=t(r,"Error loading "+n.name);else{for(var o=0;oo;o++){var n=u[o];a.loaderObj.failed=a.loaderObj.failed||[],-1==$.call(a.loaderObj.failed,n)&&a.loaderObj.failed.push(n);var c=$.call(n.linkSets,e);if(n.linkSets.splice(c,1),0==n.linkSets.length){var f=$.call(e.loader.loads,n);-1!=f&&e.loader.loads.splice(f,1)}}e.reject(r)}function h(e,t){if(e.loaderObj.trace){e.loaderObj.loads||(e.loaderObj.loads={});var n={};t.dependencies.forEach(function(e){n[e.key]=e.value}),e.loaderObj.loads[t.name]={name:t.name,deps:t.dependencies.map(function(e){return e.key}),depMap:n,address:t.address,metadata:t.metadata,source:t.source}}t.name&&(e.modules[t.name]=t.module);var r=$.call(e.loads,t);-1!=r&&e.loads.splice(r,1);for(var a=0,o=t.linkSets.length;o>a;a++)r=$.call(t.linkSets[a].loads,t),-1!=r&&t.linkSets[a].loads.splice(r,1);t.linkSets.splice(0,t.linkSets.length)}function g(e,t,r){try{var a=t.execute()}catch(o){return void r(t,o)}return a&&a instanceof n?a:void r(t,new TypeError("Execution must define a Module instance"))}function v(e,t,n){var r=e._loader.importPromises;return r[t]=n.then(function(e){return r[t]=void 0,e},function(e){throw r[t]=void 0,e})}function y(e,t){var n=e.loader;if(e.loads.length)for(var r=e.loads.concat([]),a=0;a "'+r.paths[o]+'" uses wildcards which are being deprecated for just leaving a trailing "/" to indicate folder paths.')}if(e.defaultJSExtensions&&(r.defaultJSExtensions=e.defaultJSExtensions,w.call(r,"The defaultJSExtensions configuration option is deprecated, use packages configuration instead.")),e.pluginFirst&&(r.pluginFirst=e.pluginFirst),e.map)for(var o in e.map){var i=e.map[o];if("string"!=typeof i){var s=r.defaultJSExtensions&&".js"!=o.substr(o.length-3,3),l=r.decanonicalize(o);s&&".js"==l.substr(l.length-3,3)&&(l=l.substr(0,l.length-3));var u="";for(var c in r.packages)l.substr(0,c.length)==c&&(!l[c.length]||"/"==l[c.length])&&u.split("/").lengtha&&(n=o,a=r));return n}function t(e,t,n,r,a){if(!r||"/"==r[r.length-1]||a||t.defaultExtension===!1)return r;var o=!1;if(t.meta&&p(t.meta,r,function(e,t,n){return 0==n||e.lastIndexOf("*")!=e.length-1?o=!0:void 0}),!o&&e.meta&&p(e.meta,n+"/"+r,function(e,t,n){return 0==n||e.lastIndexOf("*")!=e.length-1?o=!0:void 0}),o)return r;var i="."+(t.defaultExtension||"js");return r.substr(r.length-i.length)!=i?r+i:r}function n(e,n,r,a,i){if(!a){if(!n.main)return r+(e.defaultJSExtensions?".js":"");a="./"==n.main.substr(0,2)?n.main.substr(2):n.main}if(n.map){var s="./"+a,l=E(n.map,s);if(l||(s="./"+t(e,n,r,a,i),s!="./"+a&&(l=E(n.map,s))),l){var u=o(e,n,r,l,s,i);if(u)return u}}return r+"/"+t(e,n,r,a,i)}function r(e,t,n,r){if("."==e)throw new Error("Package "+n+' has a map entry for "." which is not permitted.');return t.substr(0,e.length)==e&&r.length>e.length?!1:!0}function o(e,n,a,o,i,s){"/"==i[i.length-1]&&(i=i.substr(0,i.length-1));var l=n.map[o];if("object"==typeof l)throw new Error("Synchronous conditional normalization not supported sync normalizing "+o+" in "+a);if(r(o,l,a,i)&&"string"==typeof l){if("."==l)l=a;else if("./"==l.substr(0,2))return a+"/"+t(e,n,a,l.substr(2)+i.substr(o.length),s);return e.normalizeSync(l+i.substr(o.length),a+"/")}}function l(e,n,r,a,o){if(!a){if(!n.main)return Promise.resolve(r+(e.defaultJSExtensions?".js":""));a="./"==n.main.substr(0,2)?n.main.substr(2):n.main}var i,s;return n.map&&(i="./"+a,s=E(n.map,i),s||(i="./"+t(e,n,r,a,o),i!="./"+a&&(s=E(n.map,i)))),(s?d(e,n,r,s,i,o):Promise.resolve()).then(function(i){return i?Promise.resolve(i):Promise.resolve(r+"/"+t(e,n,r,a,o))})}function u(e,n,r,a,o,i,s){if("."==o)o=r;else if("./"==o.substr(0,2))return Promise.resolve(r+"/"+t(e,n,r,o.substr(2)+i.substr(a.length),s)).then(function(t){return T.call(e,t,r+"/")});return e.normalize(o+i.substr(a.length),r+"/")}function d(e,t,n,a,o,i){"/"==o[o.length-1]&&(o=o.substr(0,o.length-1));var s=t.map[a];if("string"==typeof s)return r(a,s,n,o)?u(e,t,n,a,s,o,i):Promise.resolve();if(e.builder)return Promise.resolve(n+"/#:"+o);var l=[],d=[];for(var c in s){var f=I(c);d.push({condition:f,map:s[c]}),l.push(e["import"](f.module,n))}return Promise.all(l).then(function(e){for(var t=0;tl&&(l=n),v(s,t,n&&l>n)}),v(n.metadata,s)}o.format&&!n.metadata.loader&&(n.metadata.format=n.metadata.format||o.format)}return t})}})}(),function(){function t(){if(s&&"interactive"===s.script.readyState)return s.load;for(var e=0;ea;a++){var i=e.normalizedDeps[a],s=n.defined[i];if(s&&!s.evaluated){var l=e.groupIndex+(s.declarative!=e.declarative);if(null===s.groupIndex||s.groupIndex=0;i--){for(var s=a[i],l=0;lr;r++){var s=a.importers[r];if(!s.locked){var l=$.call(s.dependencies,a),u=s.setters[l];u&&u(o)}}return a.locked=!1,t},{id:t.name});if("function"==typeof i&&(i={setters:[],execute:i}),i=i||{setters:[],execute:function(){}},a.setters=i.setters,a.execute=i.execute,!a.setters||!a.execute)throw new TypeError("Invalid System.register form for "+t.name);for(var s=0,d=t.normalizedDeps.length;d>s;s++){var c,f=t.normalizedDeps[s],m=n.defined[f],p=r[f];p?c=p.exports:m&&!m.declarative?c=m.esModule:m?(u(m,n),p=m.module,c=p.exports):c=n.get(f),p&&p.importers?(p.importers.push(a),a.dependencies.push(p)):a.dependencies.push(null);for(var h=t.originalIndices[s],g=0,v=h.length;v>g;++g){var y=h[g];a.setters[y]&&a.setters[y](c)}}}}function d(e,t){var n,r=t.defined[e];if(r)r.declarative?f(e,r,[],t):r.evaluated||c(r,t),n=r.module.exports;else if(n=t.get(e),!n)throw new Error("Unable to load dependency "+e+".");return(!r||r.declarative)&&n&&n.__useDefault?n["default"]:n}function c(t,r){if(!t.module){var a={},o=t.module={exports:a,id:t.name};if(!t.executingRequire)for(var i=0,s=t.normalizedDeps.length;s>i;i++){var l=t.normalizedDeps[i],u=r.defined[l];u&&c(u,r)}t.evaluated=!0;var f=t.execute.call(e,function(e){for(var n=0,a=t.deps.length;a>n;n++)if(t.deps[n]==e)return d(t.normalizedDeps[n],r);var o=r.normalizeSync(e,t.name);if(-1!=$.call(t.normalizedDeps,o))return d(o,r);throw new Error("Module "+e+" not declared as a dependency of "+t.name)},a,o);void 0!==f&&(o.exports=f),a=o.exports,a&&(a.__esModule||a instanceof n)?t.esModule=r.newModule(a):t.esmExports&&a!==e?t.esModule=r.newModule(p(a)):t.esModule=r.newModule({"default":a,__useDefault:!0})}}function f(t,n,r,a){if(n&&!n.evaluated&&n.declarative){r.push(t);for(var o=0,i=n.normalizedDeps.length;i>o;o++){var s=n.normalizedDeps[o];-1==$.call(r,s)&&(a.defined[s]?f(s,a.defined[s],r,a):a.get(s))}n.evaluated||(n.evaluated=!0,n.module.execute.call(e))}}a.prototype.register=function(e,t,n){if("string"!=typeof e&&(n=t,t=e,e=null),"boolean"==typeof n)return this.registerDynamic.apply(this,arguments);var r=R();r.name=e&&(this.decanonicalize||this.normalize).call(this,e),r.declarative=!0,r.deps=t,r.declare=n,this.pushRegister_({amd:!1,entry:r})},a.prototype.registerDynamic=function(e,t,n,r){"string"!=typeof e&&(r=n,n=t,t=e,e=null);var a=R();a.name=e&&(this.decanonicalize||this.normalize).call(this,e),a.deps=t,a.execute=r,a.executingRequire=n,this.pushRegister_({amd:!1,entry:a})},i("reduceRegister_",function(){return function(e,t){if(t){var n=t.entry,r=e&&e.metadata;if(n.name&&(n.name in this.defined||(this.defined[n.name]=n),r&&(r.bundle=!0)),!n.name||e&&!r.entry&&n.name==e.name){if(!r)throw new TypeError("Invalid System.register call. Anonymous System.register calls can only be made by modules loaded by SystemJS.import and not via script tags.");if(r.entry)throw"register"==r.format?new Error("Multiple anonymous System.register calls in module "+e.name+". If loading a bundle, ensure all the System.register calls are named."):new Error("Module "+e.name+" interpreted as "+r.format+" module format, but called System.register.");r.format||(r.format="register"),r.entry=n}}}}),s(function(e){return function(){e.call(this),this.defined={},this._loader.moduleRecords={}}}),J(o,"toString",{value:function(){return"Module"}}),i("delete",function(e){return function(t){return delete this._loader.moduleRecords[t],delete this.defined[t],e.call(this,t)}}),i("fetch",function(e){return function(t){return this.defined[t.name]?(t.metadata.format="defined",""):(t.metadata.deps=t.metadata.deps||[],e.call(this,t))}}),i("translate",function(e){return function(t){return t.metadata.deps=t.metadata.deps||[],Promise.resolve(e.apply(this,arguments)).then(function(e){return("register"==t.metadata.format||"system"==t.metadata.format||!t.metadata.format&&M(t.source))&&(t.metadata.format="register"),e})}}),i("load",function(e){return function(t){var n=this,a=n.defined[t];return!a||a.deps.length?e.apply(this,arguments):(a.originalIndices=a.normalizedDeps=[],r(t,a,n),f(t,a,[],n),a.esModule||(a.esModule=n.newModule(a.module.exports)),n.trace||(n.defined[t]=void 0),n.set(t,a.esModule),Promise.resolve())}}),i("instantiate",function(e){return function(t){"detect"==t.metadata.format&&(t.metadata.format=void 0),e.call(this,t);var n,a=this;if(a.defined[t.name])n=a.defined[t.name],n.declarative||(n.deps=n.deps.concat(t.metadata.deps)),n.deps=n.deps.concat(t.metadata.deps);else if(t.metadata.entry)n=t.metadata.entry,n.deps=n.deps.concat(t.metadata.deps);else if(!(a.builder&&t.metadata.bundle||"register"!=t.metadata.format&&"esm"!=t.metadata.format&&"es6"!=t.metadata.format)){if("undefined"!=typeof __exec&&__exec.call(a,t),!t.metadata.entry&&!t.metadata.bundle)throw new Error(t.name+" detected as "+t.metadata.format+" but didn't execute.");n=t.metadata.entry,n&&t.metadata.deps&&(n.deps=n.deps.concat(t.metadata.deps))}n||(n=R(),n.deps=t.metadata.deps,n.execute=function(){}),a.defined[t.name]=n;var o=m(n.deps);n.deps=o.names,n.originalIndices=o.indices,n.name=t.name,n.esmExports=t.metadata.esmExports!==!1;for(var i=[],s=0,l=n.deps.length;l>s;s++)i.push(Promise.resolve(a.normalize(n.deps[s],t.name)));return Promise.all(i).then(function(e){return n.normalizedDeps=e,{deps:n.deps,execute:function(){return r(t.name,n,a),f(t.name,n,[],a),n.esModule||(n.esModule=a.newModule(n.module.exports)),a.trace||(a.defined[t.name]=void 0),n.esModule}}})}})}(),i("reduceRegister_",function(e){return function(t,n){if(n||!t.metadata.exports&&(!q||"global"!=t.metadata.format))return e.call(this,t,n);t.metadata.format="global";var r=t.metadata.entry=R();r.deps=t.metadata.deps;var a=z(t.metadata.exports);r.execute=function(){return a}}}),s(function(t){return function(){function n(t){if(Object.keys)Object.keys(e).forEach(t);else for(var n in e)i.call(e,n)&&t(n)}function r(t){n(function(n){if(-1==$.call(s,n)){try{var r=e[n]}catch(a){s.push(n)}t(n,r)}})}var a=this;t.call(a);var o,i=Object.prototype.hasOwnProperty,s=["_g","sessionStorage","localStorage","clipboardData","frames","frameElement","external","mozAnimationStartTime","webkitStorageInfo","webkitIndexedDB","mozInnerScreenY","mozInnerScreenX"];a.set("@@global-helpers",a.newModule({prepareGlobal:function(t,n,a,i){var s=e.define;e.define=void 0;var l;if(a){l={};for(var u in a)l[u]=e[u],e[u]=a[u]}return n||(o={},r(function(e,t){o[e]=t})),function(){var t,a=n?z(n):{},u=!!n;if((!n||i)&&r(function(r,s){o[r]!==s&&"undefined"!=typeof s&&(i&&(e[r]=void 0),n||(a[r]=s,"undefined"!=typeof t?u||t===s||(u=!0):t=s))}),a=u?a:t,l)for(var d in l)e[d]=l[d];return e.define=s,a}}}))}}),s(function(e){return function(){function t(e){return"file:///"==e.substr(0,8)?e.substr(7+!!A):r&&e.substr(0,r.length)==r?e.substr(r.length):e}var n=this;if(e.call(n),"undefined"!=typeof window&&"undefined"!=typeof document&&window.location)var r=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"");n.set("@@cjs-helpers",n.newModule({requireResolve:function(e,r){return t(n.normalizeSync(e,r))},getPathVars:function(e){var n,r=e.lastIndexOf("!");n=-1!=r?e.substr(0,r):e;var a=n.split("/");return a.pop(),a=a.join("/"),{filename:t(n),dirname:t(a)}}}))}}),i("fetch",function(t){return function(n){return n.metadata.scriptLoad&&U&&(e.define=this.amdDefine),t.call(this,n)}}),s(function(t){return function(){function n(e,t){e=e.replace(s,"");var n=e.match(d),r=(n[1].split(",")[t]||"require").replace(c,""),a=f[r]||(f[r]=new RegExp(l+r+u,"g"));a.lastIndex=0;for(var o,i=[];o=a.exec(e);)i.push(o[2]||o[3]);return i}function r(e,t,n,a){if("object"==typeof e&&!(e instanceof Array))return r.apply(null,Array.prototype.splice.call(arguments,1,arguments.length-1));if("string"==typeof e&&"function"==typeof t&&(e=[e]),!(e instanceof Array)){if("string"==typeof e){var i=o.defaultJSExtensions&&".js"!=e.substr(e.length-3,3),s=o.decanonicalize(e,a);i&&".js"==s.substr(s.length-3,3)&&(s=s.substr(0,s.length-3));var l=o.get(s);if(!l)throw new Error('Module not already loaded loading "'+e+'" as '+s+(a?' from "'+a+'".':"."));return l.__useDefault?l["default"]:l}throw new TypeError("Invalid require")}for(var u=[],d=0;d1;)r=a.shift(),e=e[r]=e[r]||{};r=a.shift(),r in e||(e[r]=n)}s(function(e){return function(){this.meta={},e.call(this)}}),i("locate",function(e){return function(t){var n,r=this.meta,a=t.name,o=0;for(var i in r)if(n=i.indexOf("*"),-1!==n&&i.substr(0,n)===a.substr(0,n)&&i.substr(n+1)===a.substr(a.length-i.length+n+1)){var s=i.split("/").length;s>o&&(o=s),v(t.metadata,r[i],o!=s)}return r[a]&&v(t.metadata,r[a]),e.call(this,t)}});var t=/^(\s*\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)+/,n=/\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\/\/[^\n]*|"[^"]+"\s*;?|'[^']+'\s*;?/g;i("translate",function(r){return function(a){if("defined"==a.metadata.format)return a.metadata.deps=a.metadata.deps||[],Promise.resolve(a.source);var o=a.source.match(t);if(o)for(var i=o[0].match(n),s=0;s')}else e()}else if("undefined"!=typeof importScripts){var a="";try{throw new Error("_")}catch(o){o.stack.replace(/(?:at|@).*(http.+):[\d]+:[\d]+/,function(e,t){$__curScript={src:t},a=t.replace(/\/[^\/]*$/,"/")})}t&&importScripts(a+"system-polyfills.js"),e()}else $__curScript="undefined"!=typeof __filename?{src:__filename}:null,e()}(); //# sourceMappingURL=system-csp-production.js.map diff --git a/node_modules/systemjs/dist/system-csp-production.js.map b/node_modules/systemjs/dist/system-csp-production.js.map index 2898b5b1f..e1fb76817 100644 --- a/node_modules/systemjs/dist/system-csp-production.js.map +++ b/node_modules/systemjs/dist/system-csp-production.js.map @@ -1 +1 @@ -{"version":3,"sources":["system-csp-production.src.js"],"names":["bootstrap","global","URLPolyfill","url","baseURL","TypeError","m","String","replace","match","RangeError","protocol","username","password","host","hostname","port","pathname","search","hash","undefined","base","flag","slice","lastIndexOf","output","p","pop","push","join","this","origin","href","self","__global","addToError","err","msg","originalErr","stack","message","toString","split","newStack","i","length","$__curScript","indexOf","src","newMsg","substr","isBrowser","isWindows","newErr","errArgs","Error","fileName","lineNumber","Module","Loader","options","_loader","loaderObj","loads","modules","importPromises","moduleRecords","defineProperty","get","SystemJSLoader","call","paths","systemJSConstructor","SystemProto","hook","name","prototype","hookConstructor","isAbsolute","absURLRegEx","isRel","isPlain","urlResolve","parent","baseURI","URL","baseURIObj","applyPaths","loader","wildcard","pathMatch","maxWildcardPrefixLen","pathsCache","hasOwnProperty","path","pathParts","wildcardPrefixLen","outPath","group","deps","names","indices","l","index","getESModule","exports","esModule","getOwnPropertyDescriptor","defineOrCopyProperty","extend","value","targetObj","sourceObj","propName","d","Object","ex","a","b","prepend","extendMeta","val","Array","concat","extendPkgConfig","pkgCfgA","pkgCfgB","pkgName","warnInvalidProperties","prop","map","meta","depCache","dNormalized","coreResolve","warn","setPkgConfig","cfg","prependConfig","pkg","packages","basePkg","main","warnings","console","readMemberExpression","pParts","shift","getMapMatch","bestMatch","bestMatchLength","curMatchLength","prepareBaseURL","setProduction","isProduction","isBuilder","set","envModule","newModule","browser","node","_nodeRequire","production","dev","build","default","getNodeModule","parentModuleContext","_nodeModulePaths","require","parentName","mapMatch","has","builder","envSet","envCallback","browserConfig","nodeConfig","devConfig","buildConfig","productionConfig","detectRegisterFormat","source","leadingCommentAndMeta","leadingCommentAndMetaRegEx","createEntry","originalIndices","declare","execute","executingRequire","declarative","normalizedDeps","groupIndex","evaluated","module","esmExports","getGlobalValue","globalValue","first","parseCondition","condition","conditionExport","conditionModule","negation","conditionExportIndex","sysConditions","negate","serializeCondition","conditionObj","resolveCondition","bool","normalize","then","normalizedCondition","load","q","interpolateConditional","conditionalMatch","interpolationRegEx","Promise","resolve","conditionValue","booleanConditional","booleanIndex","isWorker","window","importScripts","document","process","platform","assert","item","thisLen","e","obj","opt","getElementsByTagName","bases","location","cwd","nativeURL","createLoad","status","anonCnt","linkSets","dependencies","metadata","loadModule","asyncStartLoadPartwayThrough","step","address","moduleName","moduleMetadata","moduleSource","moduleAddress","requestLoad","request","refererName","refererAddress","reject","proceedToLocate","proceedToFetch","locate","proceedToTranslate","fetch","translate","instantiate","instantiateResult","depsList","loadPromises","depLoad","key","addLoadToLinkSet","all","updateLinkSetOnLoad","exc","exception","linkSetFailed","stepState","existingLoad","done","linkSet","createLinkSet","startingLoad","loadingCount","j","doLink","error","link","_newModule","finishLoad","abrupt","checkError","pLoad","dep","failed","linkIndex","splice","globalLoadsIndex","trace","depMap","forEach","loadIndex","doDynamicExecute","linkError","createImportPromise","promise","constructor","define","delete","import","parentAddress","sourcePromise","pNames","getOwnPropertyNames","configurable","enumerable","freeze","referrerName","referrerAddress","System","fetchTextFromURL","XMLHttpRequest","authorization","fulfill","xhr","responseText","statusText","sameDomain","doTimeout","domainCheck","exec","XDomainRequest","onload","onerror","ontimeout","onprogress","timeout","onreadystatechange","readyState","addEventListener","open","setRequestHeader","withCredentials","setTimeout","send","fs","readFile","data","dataString","opts","headers","Accept","credentials","r","ok","text","scriptSrc","defaultJSExtensions","pluginFirst","loaderErrorStack","skipExt","resolved","httpRequest","systemImport","__useDefault","systemTranslate","format","apply","arguments","entry","JSON","parse","getConfig","curCurScript","config","isEnvConfig","checkHasConfig","transpilerRuntime","loadedTranspilerRuntime","bundles","packageConfigPaths","v","defaultJSExtension","decanonicalize","pkgMatch","packageLength","Math","max","normalized","bundle","normalizedBundleDep","c","getPackage","curPkg","pkgLen","curPkgLen","addDefaultExtension","subPath","skipExtensions","defaultExtension","metaMatch","getMetaMatches","metaPattern","matchMeta","matchDepth","applyPackageConfigSync","mapPath","mapped","doMapSync","validMapping","normalizeSync","applyPackageConfig","doMap","doStringMap","conditionPromises","conditions","conditionValues","createPkgConfigPathObj","lastWildcard","regEx","RegExp","getPackageConfigMatch","configPath","exactMatch","packageConfigPath","packageName","loadPackageConfigPath","pkgConfigPath","configLoader","pluginLoader","systemjs","pkgMeta","matchFn","wildcardIndex","dotRel","exactMeta","decanonicalized","isPlugin","parentPackageName","parentPackage","parentMap","parentMapMatch","pkgConfigMatch","isConfigured","configured","bestDepth","getInteractiveScriptLoad","interactiveScript","script","interactiveLoadingScripts","webWorkerImport","integrity","workerLoad","head","curSystem","curRequire","ieEvents","s","createElement","isOpera","opera","attachEvent","loadingCnt","registerQueue","pushRegister","register","reduceRegister_","scriptLoad","complete","evt","cleanup","detachEvent","removeEventListener","removeChild","async","crossOrigin","setAttribute","appendChild","buildGroups","groups","depName","depEntry","defined","depGroupIndex","startEntry","curGroupDeclarative","linkDeclarativeModule","linkDynamicModule","ModuleRecord","getOrCreateModuleRecord","importers","declaration","locked","importerModule","importerIndex","setter","setters","id","depExports","depModule","len","getModule","ensureEvaluated","nameNormalized","__esModule","seen","registerDynamic","pushRegister_","amd","curMeta","del","doLoad","__exec","grouped","normalizePromises","reduceRegister","forEachGlobal","callback","keys","g","forEachGlobalValue","globalName","ignoredGlobalProps","globalSnapshot","prepareGlobal","globals","encapsulate","curDefine","oldGlobals","singleGlobal","multipleExports","stripOrigin","windowOrigin","requireResolve","parentId","getPathVars","moduleId","filename","pluginIndex","dirname","amdDefine","getCJSDeps","requireIndex","commentRegEx","params","fnBracketRegEx","requireAlias","wsRegEx","requireRegEx","requireRegExs","cjsRequirePre","cjsRequirePost","lastIndex","errback","referer","dynamicRequires","factory","req","contextualRequire","depValues","uri","moduleIndex","exportsIndex","toUrl","amdRequire","getParentName","parentPluginIndex","parsePlugin","argumentName","pluginName","argument","plugin","combinePluginParts","checkDefaultExtension","arg","createNormalizeSync","parsed","pluginSyntaxIndex","loaderNormalized","loaderModule","args","result","sourceMap","originalName","file","sources","calledInstantiate","alias","aliasDeps","_export","setMetaProperty","target","curPart","depth","metaRegEx","metaPartRegEx","metaParts","firstChar","metaString","metaName","metaValue","loadedBundles","matched","curModule","parts","substring","SystemJS","version","doPolyfill","scripts","currentScript","defer","curPath","basePath","systemJSBootstrap","write","__filename"],"mappings":";;;CAGA,WACA,QAASA,MACT,SAAUC,GACV,QAASC,GAAYC,EAAKC,GACxB,GAAkB,gBAAPD,GACT,KAAM,IAAIE,WAAU,uBACtB,IAAIC,GAAIC,OAAOJ,GAAKK,QAAQ,aAAc,IAAIC,MAAM,mHACpD,KAAKH,EACH,KAAM,IAAII,YAAW,qBACvB,IAAIC,GAAWL,EAAE,IAAM,GACnBM,EAAWN,EAAE,IAAM,GACnBO,EAAWP,EAAE,IAAM,GACnBQ,EAAOR,EAAE,IAAM,GACfS,EAAWT,EAAE,IAAM,GACnBU,EAAOV,EAAE,IAAM,GACfW,EAAWX,EAAE,IAAM,GACnBY,EAASZ,EAAE,IAAM,GACjBa,EAAOb,EAAE,IAAM,EACnB,IAAgBc,SAAZhB,EAAuB,CACzB,GAAIiB,GAAOjB,YAAmBF,GAAcE,EAAU,GAAIF,GAAYE,GAClEkB,GAAQX,IAAaG,IAASF,GAC9BU,GAASL,GAAaC,IACxBA,EAASG,EAAKH,QACZI,GAAwB,MAAhBL,EAAS,KACnBA,EAAYA,IAAcI,EAAKP,OAAQO,EAAKT,UAAcS,EAAKJ,SAAiB,GAAN,KAAYI,EAAKJ,SAASM,MAAM,EAAGF,EAAKJ,SAASO,YAAY,KAAO,GAAKP,EAAYI,EAAKJ,SAEtK,IAAIQ,KACJR,GAAST,QAAQ,kBAAmB,IACjCA,QAAQ,iBAAkB,KAC1BA,QAAQ,UAAW,QACnBA,QAAQ,aAAc,SAAUkB,GACrB,QAANA,EACFD,EAAOE,MAEPF,EAAOG,KAAKF,KAElBT,EAAWQ,EAAOI,KAAK,IAAIrB,QAAQ,MAAuB,MAAhBS,EAAS,GAAa,IAAM,IAClEK,IACFN,EAAOK,EAAKL,KACZD,EAAWM,EAAKN,SAChBD,EAAOO,EAAKP,KACZD,EAAWQ,EAAKR,SAChBD,EAAWS,EAAKT,UAEbD,IACHA,EAAWU,EAAKV,UAIpBM,EAAWA,EAAST,QAAQ,MAAO,KAEnCsB,KAAKC,OAASjB,EAAOH,GAAyB,KAAbA,GAA4B,KAATG,EAAc,KAAO,IAAMA,EAAO,GACtFgB,KAAKE,KAAOrB,GAAYA,GAAYG,GAAoB,SAAZH,EAAsB,KAAO,KAAoB,KAAbC,EAAkBA,GAAyB,KAAbC,EAAkB,IAAMA,EAAW,IAAM,IAAM,IAAMC,EAAOG,EAAWC,EAASC,EAC9LW,KAAKnB,SAAWA,EAChBmB,KAAKlB,SAAWA,EAChBkB,KAAKjB,SAAWA,EAChBiB,KAAKhB,KAAOA,EACZgB,KAAKf,SAAWA,EAChBe,KAAKd,KAAOA,EACZc,KAAKb,SAAWA,EAChBa,KAAKZ,OAASA,EACdY,KAAKX,KAAOA,EAEdlB,EAAOC,YAAcA,GACH,mBAAR+B,MAAsBA,KAAOhC,QAAQ,SAAUiC,GAqCvD,QAASC,GAAWC,EAAKC,GAEvB,IAAKD,EAAIE,YAGP,IAAK,GAFDC,KAAUH,EAAII,SAAWJ,IAAQA,EAAIG,MAAQ,KAAOH,EAAIG,MAAQ,KAAKE,WAAWC,MAAM,MACtFC,KACKC,EAAI,EAAGA,EAAIL,EAAMM,OAAQD,IACL,mBAAhBE,eAA+BP,EAAMK,GAAGG,QAAQD,aAAaE,OAAQ,GAC9EL,EAASf,KAAKW,EAAMK,GAI1B,IAAIK,GAAS,eAAiBN,EAAWA,EAASd,KAAK,QAAUO,EAAII,QAAQU,OAAO,KAAO,OAASb,CAG/Fc,KACHF,EAASA,EAAOzC,QAAQ4C,EAAY,eAAiB,aAAc,IAErE,IAAIC,GAASC,EAAU,GAAIC,OAAMN,EAAQb,EAAIoB,SAAUpB,EAAIqB,YAAc,GAAIF,OAAMN,EAOnF,OALAI,GAAOd,MAAQU,EAGfI,EAAOf,YAAcF,EAAIE,aAAeF,EAEjCiB,EAoEX,QAASK,MAOT,QAASC,GAAOC,GACd9B,KAAK+B,SACHC,UAAWhC,KACXiC,SACAC,WACAC,kBACAC,kBAIFC,EAAerC,KAAM,UACnBsC,IAAK,WACH,MAAOlC,MA8vBb,QAASmC,KACPV,EAAOW,KAAKxC,MAEZA,KAAKyC,SACLzC,KAAK+B,QAAQU,SAEbC,EAAoBF,KAAKxC,MAI3B,QAAS2C,MAOT,QAASC,GAAKC,EAAMD,GAClBL,EAAeO,UAAUD,GAAQD,EAAKL,EAAeO,UAAUD,IAAS,cAE1E,QAASE,GAAgBH,GACvBF,EAAsBE,EAAKF,GAAuB,cAKpD,QAASM,GAAWH,GAClB,MAAOA,GAAKlE,MAAMsE,GAEpB,QAASC,GAAML,GACb,MAAmB,KAAXA,EAAK,MAAeA,EAAK,IAAiB,KAAXA,EAAK,IAAwB,KAAXA,EAAK,KAA0B,KAAXA,EAAK,GAEpF,QAASM,GAAQN,GACf,OAAQK,EAAML,KAAUG,EAAWH,GAKrC,QAASO,GAAWP,EAAMQ,GAExB,GAAe,KAAXR,EAAK,IAEP,GAAe,KAAXA,EAAK,IAAwB,KAAXA,EAAK,GACzB,OAAQQ,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,EAAKzB,OAAO,OAEzF,IAAe,KAAXyB,EAAK,IAAaA,EAAK5B,QAAQ,OAAQ,EAE9C,OAAQoC,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,CAGhF,OAAO,IAAIU,GAAIV,EAAMQ,GAAUA,EAAO3E,QAAQ,KAAM,QAAU8E,GAAYtD,KAAKxB,QAAQ,OAAQ,KAIjG,QAAS+E,GAAWC,EAAQb,GAE1B,GAAoBc,GAAhBC,EAAY,GAAcC,EAAuB,EAEjDpB,EAAQiB,EAAOjB,MACfqB,EAAaJ,EAAO3B,QAAQU,KAGhC,KAAK,GAAI7C,KAAK6C,GACZ,IAAIA,EAAMsB,gBAAmBtB,EAAMsB,eAAenE,GAAlD,CAIA,GAAIoE,GAAOvB,EAAM7C,EAKjB,IAJIoE,IAASF,EAAWlE,KACtBoE,EAAOvB,EAAM7C,GAAKkE,EAAWlE,GAAKwD,EAAWX,EAAM7C,GAAIsD,EAAMT,EAAM7C,IAAM0D,EAAUI,EAAOpF,UAGxFsB,EAAEqB,QAAQ,QAAS,EAAI,CACzB,GAAI4B,GAAQjD,EACV,MAAO6C,GAAM7C,EAGV,IAAIiD,EAAKzB,OAAO,EAAGxB,EAAEmB,OAAS,IAAMnB,EAAEwB,OAAO,EAAGxB,EAAEmB,OAAS,KAAO8B,EAAK9B,OAASnB,EAAEmB,QAAU8B,EAAKjD,EAAEmB,OAAS,IAAMnB,EAAEA,EAAEmB,OAAS,MAAyC,KAAjC0B,EAAM7C,GAAG6C,EAAM7C,GAAGmB,OAAS,IAAyB,IAAZ0B,EAAM7C,IACxL,MAAO6C,GAAM7C,GAAGwB,OAAO,EAAGqB,EAAM7C,GAAGmB,OAAS,IAAM8B,EAAK9B,OAASnB,EAAEmB,QAAU0B,EAAM7C,IAAM,KAAO,IAAMiD,EAAKzB,OAAOxB,EAAEmB,QAAU,QAI5H,CACH,GAAIkD,GAAYrE,EAAEgB,MAAM,IACxB,IAAIqD,EAAUlD,OAAS,EACrB,KAAM,IAAIxC,WAAU,2CAEtB,IAAI2F,GAAoBD,EAAU,GAAGlD,MACjCmD,IAAqBL,GACrBhB,EAAKzB,OAAO,EAAG6C,EAAU,GAAGlD,SAAWkD,EAAU,IACjDpB,EAAKzB,OAAOyB,EAAK9B,OAASkD,EAAU,GAAGlD,SAAWkD,EAAU,KAC1DJ,EAAuBK,EACvBN,EAAYhE,EACZ+D,EAAWd,EAAKzB,OAAO6C,EAAU,GAAGlD,OAAQ8B,EAAK9B,OAASkD,EAAU,GAAGlD,OAASkD,EAAU,GAAGlD,UAKvG,GAAIoD,GAAU1B,EAAMmB,EAIpB,OAHuB,gBAAZD,KACTQ,EAAUA,EAAQzF,QAAQ,IAAKiF,IAE1BQ,EAWT,QAASC,GAAMC,GAGb,IAAK,GAFDC,MACAC,KACKzD,EAAI,EAAG0D,EAAIH,EAAKtD,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3C,GAAI2D,GAAQxD,EAAQuB,KAAK8B,EAAOD,EAAKvD,GACjC2D,MAAU,GACZH,EAAMxE,KAAKuE,EAAKvD,IAChByD,EAAQzE,MAAMgB,KAGdyD,EAAQE,GAAO3E,KAAKgB,GAGxB,OAASwD,MAAOA,EAAOC,QAASA,GAYlC,QAASG,GAAYC,GACnB,GAAIC,KAEJ,KAAuB,gBAAXD,IAAyC,kBAAXA,KAA0BA,IAAYvE,EAC5E,GAAIyE,EACF,IAAK,GAAIjF,KAAK+E,GAEF,YAAN/E,GAEJkF,EAAqBF,EAAUD,EAAS/E,OAI1CmF,GAAOH,EAAUD,EAOvB,OAJAC,GAAkB,QAAID,EACtBtC,EAAeuC,EAAU,gBACvBI,OAAO,IAEFJ,EAGT,QAASE,GAAqBG,EAAWC,EAAWC,GAClD,IACE,GAAIC,IACAA,EAAIC,OAAOR,yBAAyBK,EAAWC,KACjD9C,EAAe4C,EAAWE,EAAUC,GAExC,MAAOE,GAIL,MADAL,GAAUE,GAAYD,EAAUC,IACzB,GAIX,QAASJ,GAAOQ,EAAGC,EAAGC,GACpB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,GACRzB,IAAmByB,EAAEzB,eAAenE,IAEnC6F,GAAa7F,IAAK2F,KACrBA,EAAE3F,GAAK4F,EAAE5F,GAEb,OAAO2F,GAOT,QAASG,GAAWH,EAAGC,EAAGC,GACxB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,GACZ,IAAIzB,GAAmByB,EAAEzB,eAAenE,GAAxC,CAEA,GAAI+F,GAAMH,EAAE5F,EACNA,KAAK2F,GAEFI,YAAeC,QAASL,EAAE3F,YAAcgG,OAC/CL,EAAE3F,MAAQiG,OAAOJ,EAAUE,EAAMJ,EAAE3F,IAAIiG,OAAOJ,EAAUF,EAAE3F,GAAK+F,GAC1C,gBAAPA,IAA2B,OAARA,GAA+B,gBAARJ,GAAE3F,GAC1D2F,EAAE3F,GAAKmF,EAAOA,KAAWQ,EAAE3F,IAAK+F,EAAKF,GAC7BA,IACRF,EAAE3F,GAAK+F,GANPJ,EAAE3F,GAAK+F,GAUb,QAASG,GAAgBC,EAASC,EAASC,EAASvC,EAAQwC,GAC1D,IAAK,GAAIC,KAAQH,GACf,GAAI/E,EAAQuB,MAAM,OAAQ,SAAU,mBAAoB,YAAa2D,KAAS,EAC5EJ,EAAQI,GAAQH,EAAQG,OAErB,IAAY,OAARA,EACPpB,EAAOgB,EAAQK,IAAML,EAAQK,QAAWJ,EAAQI,SAE7C,IAAY,QAARD,EACPpB,EAAOgB,EAAQM,KAAON,EAAQM,SAAYL,EAAQK,UAE/C,IAAY,YAARF,EACP,IAAK,GAAIf,KAAKY,GAAQM,SAAU,CAC9B,GAAIC,EAGFA,GADoB,MAAlBnB,EAAEhE,OAAO,EAAG,GACA6E,EAAU,IAAMb,EAAEhE,OAAO,GAEzBoF,EAAYhE,KAAKkB,EAAQ0B,GACzC1B,EAAO4C,SAASC,IAAgB7C,EAAO4C,SAASC,QAAoBV,OAAOG,EAAQM,SAASlB,SAGvFc,GAAyBjF,EAAQuB,MAAM,gBAAiB,aAAc,YAAa,oBAAqB2D,KAAS,GACpHH,EAAQjC,iBAAkBiC,EAAQjC,eAAeoC,IACrDM,EAAKjE,KAAKkB,EAAQ,IAAMyC,EAAO,4DAA8DF,GAMnG,QAASS,GAAahD,EAAQuC,EAASU,EAAKC,GAC1C,GAAIC,EAGJ,IAAKnD,EAAOoD,SAASb,GAGhB,CACH,GAAIc,GAAUrD,EAAOoD,SAASb,EAC9BY,GAAMnD,EAAOoD,SAASb,MAEtBH,EAAgBe,EAAKD,EAAgBD,EAAMI,EAASd,EAASvC,EAAQkD,GACrEd,EAAgBe,EAAKD,EAAgBG,EAAUJ,EAAKV,EAASvC,GAASkD,OAPtEC,GAAMnD,EAAOoD,SAASb,GAAWU,CAkBnC,OAPuB,gBAAZE,GAAIG,OACbH,EAAIT,IAAMS,EAAIT,QACdS,EAAIT,IAAI,WAAaS,EAAIG,KACzBH,EAAIG,KAAc,QAAIH,EAAIG,KAAc,SAAK,KAC7CH,EAAIG,KAAO,SAGNH,EAGT,QAASJ,GAAKlG,GACRP,KAAKiH,UAA8B,mBAAXC,UAA0BA,QAAQT,KAgIhE,QAASU,GAAqBvH,EAAGoF,GAE/B,IADA,GAAIoC,GAASxH,EAAEgB,MAAM,KACdwG,EAAOrG,QACZiE,EAAQA,EAAMoC,EAAOC,QACvB,OAAOrC,GAGT,QAASsC,GAAYlB,EAAKvD,GACxB,GAAI0E,GAAWC,EAAkB,CAEjC,KAAK,GAAI5H,KAAKwG,GACZ,GAAIvD,EAAKzB,OAAO,EAAGxB,EAAEmB,SAAWnB,IAAMiD,EAAK9B,QAAUnB,EAAEmB,QAA4B,KAAlB8B,EAAKjD,EAAEmB,SAAiB,CACvF,GAAI0G,GAAiB7H,EAAEgB,MAAM,KAAKG,MAClC,IAAI0G,GAAkBD,EACpB,QACFD,GAAY3H,EACZ4H,EAAkBC,EAItB,MAAOF,GAGT,QAASG,GAAehE,GAElB1D,KAAK+B,QAAQzD,UAAY0B,KAAK1B,UACa,KAAzC0B,KAAK1B,QAAQ0B,KAAK1B,QAAQyC,OAAS,KACrCf,KAAK1B,SAAW,KAElB0B,KAAK+B,QAAQzD,QAAU0B,KAAK1B,QAAU,GAAIiF,GAAIvD,KAAK1B,QAASkF,GAAYtD,MAK5E,QAASyH,GAAcC,EAAcC,GACnC7H,KAAK8H,IAAI,cAAeC,EAAY/H,KAAKgI,WACvCC,QAAS5G,EACT6G,OAAQlI,KAAKmI,aACbC,YAAaP,GAAaD,EAC1BS,IAAKR,IAAcD,EACnBU,MAAOT,EACPU,SAAW,KAuDf,QAASC,GAAc3F,EAAMvE,GAC3B,IAAK6E,EAAQN,GACX,KAAM,IAAIpB,OAAM,eAAiBoB,EAAO,mDAE1C,KAAK4F,GAAqB,CACxB,GAAI7G,GAAS5B,KAAKmI,aAAa,UAC3B5I,EAAOjB,EAAQ8C,OAAOE,EAAY,EAAI,EAC1CmH,IAAsB,GAAI7G,GAAOrC,GACjCkJ,GAAoBhG,MAAQb,EAAO8G,iBAAiBnJ,GAEtD,MAAOkJ,IAAoBE,QAAQ9F,GAGrC,QAAS2D,GAAY3D,EAAM+F,GAEzB,GAAI1F,EAAML,GACR,MAAOO,GAAWP,EAAM+F,EACrB,IAAI5F,EAAWH,GAClB,MAAOA,EAGT,IAAIgG,GAAWvB,EAAYtH,KAAKoG,IAAKvD,EAErC,IAAIgG,EAAU,CAGZ,GAFAhG,EAAO7C,KAAKoG,IAAIyC,GAAYhG,EAAKzB,OAAOyH,EAAS9H,QAE7CmC,EAAML,GACR,MAAOO,GAAWP,EACf,IAAIG,EAAWH,GAClB,MAAOA,GAGX,GAAI7C,KAAK8I,IAAIjG,GACX,MAAOA,EAGT,IAAyB,UAArBA,EAAKzB,OAAO,EAAG,GAAgB,CACjC,IAAKpB,KAAKmI,aACR,KAAM,IAAI5J,WAAU,iBAAmBsE,EAAO,6CAKhD,OAJI7C,MAAK+I,QACP/I,KAAK8H,IAAIjF,EAAM7C,KAAKgI,eAEpBhI,KAAK8H,IAAIjF,EAAM7C,KAAKgI,UAAUtD,EAAY8D,EAAchG,KAAKxC,KAAM6C,EAAKzB,OAAO,GAAIpB,KAAK1B,YACnFuE,EAMT,MAFA6E,GAAelF,KAAKxC,MAEbyD,EAAWzD,KAAM6C,IAAS7C,KAAK1B,QAAUuE,EAgJlD,QAASmG,GAAOtF,EAAQiD,EAAKsC,GACvBlB,EAAUE,SAAWtB,EAAIuC,eAC3BD,EAAYtC,EAAIuC,eACdnB,EAAUG,MAAQvB,EAAIwC,YACxBF,EAAYtC,EAAIwC,YACdpB,EAAUM,KAAO1B,EAAIyC,WACvBH,EAAYtC,EAAIyC,WACdrB,EAAUO,OAAS3B,EAAI0C,aACzBJ,EAAYtC,EAAI0C,aACdtB,EAAUK,YAAczB,EAAI2C,kBAC9BL,EAAYtC,EAAI2C,kBAshCpB,QAASC,GAAqBC,GAC5B,GAAIC,GAAwBD,EAAO7K,MAAM+K,GACzC,OAAOD,IAA+E,mBAAtDD,EAAOpI,OAAOqI,EAAsB,GAAG1I,OAAQ,IAGjF,QAAS4I,KACP,OACE9G,KAAM,KACNwB,KAAM,KACNuF,gBAAiB,KACjBC,QAAS,KACTC,QAAS,KACTC,kBAAkB,EAClBC,aAAa,EACbC,eAAgB,KAChBC,WAAY,KACZC,WAAW,EACXC,OAAQ,KACRxF,SAAU,KACVyF,YAAY,GAkjBhB,QAASC,GAAe3F,GACtB,GAAsB,gBAAXA,GACT,MAAOwC,GAAqBxC,EAASvE,EAEvC,MAAMuE,YAAmBiB,QACvB,KAAM,IAAInE,OAAM,4CAIlB,KAAK,GAFD8I,MACAC,GAAQ,EACH1J,EAAI,EAAGA,EAAI6D,EAAQ5D,OAAQD,IAAK,CACvC,GAAI6E,GAAMwB,EAAqBxC,EAAQ7D,GAAIV,EACvCoK,KACFD,EAAqB,QAAI5E,EACzB6E,GAAQ,GAEVD,EAAY5F,EAAQ7D,GAAGF,MAAM,KAAKf,OAAS8F,EAE7C,MAAO4E,GA+sBP,QAASE,GAAeC,GACtB,GAAIC,GAAiBC,EAAiBC,EAElCA,EAA2B,KAAhBH,EAAU,GACrBI,EAAuBJ,EAAUhL,YAAY,IAsBjD,OArBIoL,KAAwB,GAC1BH,EAAkBD,EAAUtJ,OAAO0J,EAAuB,GAC1DF,EAAkBF,EAAUtJ,OAAOyJ,EAAUC,EAAuBD,GAEhEA,GACFpE,EAAKjE,KAAKxC,KAAM,4BAA8B0K,EAAY,wBAA0BE,EAAkB,KAAOD,EAAkB,KAEvG,KAAtBA,EAAgB,KAClBE,GAAW,EACXF,EAAkBA,EAAgBvJ,OAAO,MAI3CuJ,EAAkB,UAClBC,EAAkBF,EAAUtJ,OAAOyJ,GAC/BE,GAAc9J,QAAQ2J,KAAoB,IAC5CD,EAAkBC,EAClBA,EAAkB,QAKpBR,OAAQQ,GAAmB,cAC3BzE,KAAMwE,EACNK,OAAQH,GAIZ,QAASI,GAAmBC,GAC1B,MAAOA,GAAad,OAAS,KAAOc,EAAaF,OAAS,IAAM,IAAME,EAAa/E,KAGrF,QAASgF,GAAiBD,EAActC,EAAYwC,GAClD,GAAIjL,GAAOH,IACX,OAAOA,MAAKqL,UAAUH,EAAad,OAAQxB,GAC1C0C,KAAK,SAASC,GACb,MAAOpL,GAAKqL,KAAKD,GAChBD,KAAK,SAASG,GACb,GAAIjN,GAAI2I,EAAqB+D,EAAa/E,KAAMhG,EAAKmC,IAAIiJ,GAEzD,IAAIH,GAAoB,iBAAL5M,GACjB,KAAM,IAAID,WAAU,aAAe0M,EAAmBC,GAAgB,iCAExE,OAAOA,GAAaF,QAAUxM,EAAIA,MAMxC,QAASkN,GAAuB7I,EAAM+F,GAEpC,GAAI+C,GAAmB9I,EAAKlE,MAAMiN,GAElC,KAAKD,EACH,MAAOE,SAAQC,QAAQjJ,EAEzB,IAAIqI,GAAeT,EAAejI,KAAKxC,KAAM2L,EAAiB,GAAGvK,OAAO,EAAGuK,EAAiB,GAAG5K,OAAS,GAGxG,OAAIf,MAAK+I,QACA/I,KAAgB,UAAEkL,EAAad,OAAQxB,GAC7C0C,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACf/H,EAAKnE,QAAQkN,GAAoB,KAAOX,EAAmBC,GAAgB,OAG/EC,EAAiB3I,KAAKxC,KAAMkL,EAActC,GAAY,GAC5D0C,KAAK,SAASS,GACb,GAA8B,gBAAnBA,GACT,KAAM,IAAIxN,WAAU,2BAA6BsE,EAAO,gCAE1D,IAAIkJ,EAAe9K,QAAQ,OAAQ,EACjC,KAAM,IAAI1C,WAAU,sCAAwCsE,GAAQ+F,EAAa,OAASA,EAAa,IAAM,2BAA6BmD,EAAiB,mCAE7J,OAAOlJ,GAAKnE,QAAQkN,GAAoBG,KAI5C,QAASC,GAAmBnJ,EAAM+F,GAEhC,GAAIqD,GAAepJ,EAAKnD,YAAY,KAEpC,IAAIuM,IAAgB,EAClB,MAAOJ,SAAQC,QAAQjJ,EAEzB,IAAIqI,GAAeT,EAAejI,KAAKxC,KAAM6C,EAAKzB,OAAO6K,EAAe,GAGxE,OAAIjM,MAAK+I,QACA/I,KAAgB,UAAEkL,EAAad,OAAQxB,GAC7C0C,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACf/H,EAAKzB,OAAO,EAAG6K,GAAgB,KAAOhB,EAAmBC,KAG7DC,EAAiB3I,KAAKxC,KAAMkL,EAActC,GAAY,GAC5D0C,KAAK,SAASS,GACb,MAAOA,GAAiBlJ,EAAKzB,OAAO,EAAG6K,GAAgB,WAp+H3D,GAAIC,GAA4B,mBAAVC,SAAwC,mBAARhM,OAA+C,mBAAjBiM,eAChF/K,EAA6B,mBAAV8K,SAA4C,mBAAZE,UACnD/K,EAA8B,mBAAXgL,UAAqD,mBAApBA,SAAQC,YAA6BD,QAAQC,SAAS5N,MAAM,OAE/GyB,GAAS8G,UACZ9G,EAAS8G,SAAYsF,OAAQ,cAG/B,IASInK,GATApB,EAAU2E,MAAM9C,UAAU7B,SAAW,SAASwL,GAChD,IAAK,GAAI3L,GAAI,EAAG4L,EAAU1M,KAAKe,OAAQD,EAAI4L,EAAS5L,IAClD,GAAId,KAAKc,KAAO2L,EACd,MAAO3L,EAGX,QAAO,IAIT,WACE,IACQuE,OAAOhD,kBAAmB,UAC9BA,EAAiBgD,OAAOhD,gBAE5B,MAAOsK,GACLtK,EAAiB,SAASuK,EAAKzG,EAAM0G,GACnC,IACED,EAAIzG,GAAQ0G,EAAI7H,OAAS6H,EAAIvK,IAAIE,KAAKoK,GAExC,MAAMD,SAKZ,IAsCIrJ,GAtCA9B,EAAwC,KAA9B,GAAIC,OAAM,EAAG,KAAKC,QAyChC,IAAuB,mBAAZ2K,WAA2BA,SAASS,sBAG7C,GAFAxJ,EAAU+I,SAAS/I,SAEdA,EAAS,CACZ,GAAIyJ,GAAQV,SAASS,qBAAqB,OAC1CxJ,GAAUyJ,EAAM,IAAMA,EAAM,GAAG7M,MAAQiM,OAAOa,SAAS9M,UAG/B,mBAAZ8M,YACd1J,EAAUlD,EAAS4M,SAAS9M,KAI9B,IAAIoD,EACFA,EAAUA,EAAQ1C,MAAM,KAAK,GAAGA,MAAM,KAAK,GAC3C0C,EAAUA,EAAQlC,OAAO,EAAGkC,EAAQ5D,YAAY,KAAO,OAEpD,CAAA,GAAsB,mBAAX4M,WAA0BA,QAAQW,IAMhD,KAAM,IAAI1O,WAAU,yBALpB+E,GAAU,WAAahC,EAAY,IAAM,IAAMgL,QAAQW,MAAQ,IAC3D3L,IACFgC,EAAUA,EAAQ5E,QAAQ,MAAO,MAMrC,IACE,GAAIwO,GAAqD,SAAzC,GAAI9M,GAASmD,IAAI,YAAY1E,SAE/C,MAAM8N,IAEN,GAAIpJ,GAAM2J,EAAY9M,EAASmD,IAAMnD,EAAShC,WAwBhDiE,GAAeT,EAAOkB,UAAW,YAC/BkC,MAAO,WACL,MAAO,YAsBX,WAsGE,QAASmI,GAAWtK,GAClB,OACEuK,OAAQ,UACRvK,KAAMA,GAAQ,gBAAiBwK,EAAU,IACzCC,YACAC,gBACAC,aASJ,QAASC,GAAW/J,EAAQb,EAAMf,GAChC,MAAO,IAAI+J,SAAQ6B,GACjBC,KAAM7L,EAAQ8L,QAAU,QAAU,SAClClK,OAAQA,EACRmK,WAAYhL,EAEZiL,eAAgBhM,GAAWA,EAAQ0L,aACnCO,aAAcjM,EAAQ0H,OACtBwE,cAAelM,EAAQ8L,WAK3B,QAASK,GAAYvK,EAAQwK,EAASC,EAAaC,GAEjD,MAAO,IAAIvC,SAAQ,SAASC,EAASuC,GACnCvC,EAAQpI,EAAO1B,UAAUqJ,UAAU6C,EAASC,EAAaC,MAG1D9C,KAAK,SAASzI,GACb,GAAI2I,EACJ,IAAI9H,EAAOxB,QAAQW,GAKjB,MAJA2I,GAAO2B,EAAWtK,GAClB2I,EAAK4B,OAAS,SAEd5B,EAAKpB,OAAS1G,EAAOxB,QAAQW,GACtB2I,CAGT,KAAK,GAAI1K,GAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAQD,EAAI0D,EAAG1D,IAE9C,GADA0K,EAAO9H,EAAOzB,MAAMnB,GAChB0K,EAAK3I,MAAQA,EAEjB,MAAO2I,EAQT,OALAA,GAAO2B,EAAWtK,GAClBa,EAAOzB,MAAMnC,KAAK0L,GAElB8C,EAAgB5K,EAAQ8H,GAEjBA,IAKX,QAAS8C,GAAgB5K,EAAQ8H,GAC/B+C,EAAe7K,EAAQ8H,EACrBK,QAAQC,UAEPR,KAAK,WACJ,MAAO5H,GAAO1B,UAAUwM,QAAS3L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,cAMvE,QAASe,GAAe7K,EAAQ8H,EAAM5L,GACpC6O,EAAmB/K,EAAQ8H,EACzB5L,EAEC0L,KAAK,SAASsC,GAEb,GAAmB,WAAfpC,EAAK4B,OAIT,MAFA5B,GAAKoC,QAAUA,EAERlK,EAAO1B,UAAU0M,OAAQ7L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,SAAUI,QAASA,OAMzF,QAASa,GAAmB/K,EAAQ8H,EAAM5L,GACxCA,EAEC0L,KAAK,SAAS9B,GACb,GAAmB,WAAfgC,EAAK4B,OAKT,MAFA5B,GAAKoC,QAAUpC,EAAKoC,SAAWpC,EAAK3I,KAE7BgJ,QAAQC,QAAQpI,EAAO1B,UAAU2M,WAAY9L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,SAAUI,QAASpC,EAAKoC,QAASpE,OAAQA,KAG5H8B,KAAK,SAAS9B,GAEb,MADAgC,GAAKhC,OAASA,EACP9F,EAAO1B,UAAU4M,aAAc/L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,SAAUI,QAASpC,EAAKoC,QAASpE,OAAQA,MAIhH8B,KAAK,SAASuD,GACb,GAA0BvP,SAAtBuP,EACF,KAAM,IAAItQ,WAAU,mDAEtB,IAAgC,gBAArBsQ,GACT,KAAM,IAAItQ,WAAU,mCAEtBiN,GAAKsD,SAAWD,EAAkBxK,SAClCmH,EAAK1B,QAAU+E,EAAkB/E,UAGlCwB,KAAK,WACJE,EAAK+B,eAIL,KAAK,GAHDuB,GAAWtD,EAAKsD,SAEhBC,KACKjO,EAAI,EAAG0D,EAAIsK,EAAS/N,OAAQD,EAAI0D,EAAG1D,KAAK,SAAUoN,EAASzJ,GAClEsK,EAAajP,KACXmO,EAAYvK,EAAQwK,EAAS1C,EAAK3I,KAAM2I,EAAKoC,SAG5CtC,KAAK,SAAS0D,GASb,GALAxD,EAAK+B,aAAa9I,IAChBwK,IAAKf,EACLlJ,MAAOgK,EAAQnM,MAGK,UAAlBmM,EAAQ5B,OAEV,IAAK,GADDE,GAAW9B,EAAK8B,SAASzH,WACpB/E,EAAI,EAAG0D,EAAI8I,EAASvM,OAAQD,EAAI0D,EAAG1D,IAC1CoO,EAAiB5B,EAASxM,GAAIkO,QAOrCF,EAAShO,GAAIA,EAEhB,OAAO+K,SAAQsD,IAAIJ,KAIpBzD,KAAK,WAIJE,EAAK4B,OAAS,QAGd,KAAK,GADDE,GAAW9B,EAAK8B,SAASzH,WACpB/E,EAAI,EAAG0D,EAAI8I,EAASvM,OAAQD,EAAI0D,EAAG1D,IAC1CsO,EAAoB9B,EAASxM,GAAI0K,OAI/B,MAAE,SAAS6D,GACjB7D,EAAK4B,OAAS,SACd5B,EAAK8D,UAAYD,CAGjB,KAAK,GADD/B,GAAW9B,EAAK8B,SAASzH,WACpB/E,EAAI,EAAG0D,EAAI8I,EAASvM,OAAQD,EAAI0D,EAAG1D,IAC1CyO,EAAcjC,EAASxM,GAAI0K,EAAM6D,KAUvC,QAAS3B,GAA6B8B,GACpC,MAAO,UAAS1D,EAASuC,GACvB,GAAI3K,GAAS8L,EAAU9L,OACnBb,EAAO2M,EAAU3B,WACjBF,EAAO6B,EAAU7B,IAErB,IAAIjK,EAAOxB,QAAQW,GACjB,KAAM,IAAItE,WAAU,IAAMsE,EAAO,uCAInC,KAAK,GADD4M,GACK3O,EAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAQD,EAAI0D,EAAG1D,IAC9C,GAAI4C,EAAOzB,MAAMnB,GAAG+B,MAAQA,IAC1B4M,EAAe/L,EAAOzB,MAAMnB,GAEhB,aAAR6M,GAAwB8B,EAAajG,SACvCiG,EAAa7B,QAAU4B,EAAUxB,cACjCS,EAAmB/K,EAAQ+L,EAAc5D,QAAQC,QAAQ0D,EAAUzB,gBAKjE0B,EAAanC,SAASvM,QAAU0O,EAAanC,SAAS,GAAGrL,MAAM,GAAGY,MAAQ4M,EAAa5M,MACzF,MAAO4M,GAAanC,SAAS,GAAGoC,KAAKpE,KAAK,WACxCQ,EAAQ2D,IAKhB,IAAIjE,GAAOiE,GAAgBtC,EAAWtK,EAEtC2I,GAAKgC,SAAWgC,EAAU1B,cAE1B,IAAI6B,GAAUC,EAAclM,EAAQ8H,EAEpC9H,GAAOzB,MAAMnC,KAAK0L,GAElBM,EAAQ6D,EAAQD,MAEJ,UAAR/B,EACFW,EAAgB5K,EAAQ8H,GAET,SAARmC,EACPY,EAAe7K,EAAQ8H,EAAMK,QAAQC,QAAQ0D,EAAUxB,iBAIvDxC,EAAKoC,QAAU4B,EAAUxB,cACzBS,EAAmB/K,EAAQ8H,EAAMK,QAAQC,QAAQ0D,EAAUzB,iBAWjE,QAAS6B,GAAclM,EAAQmM,GAC7B,GAAIF,IACFjM,OAAQA,EACRzB,SACA4N,aAAcA,EACdC,aAAc,EAOhB,OALAH,GAAQD,KAAO,GAAI7D,SAAQ,SAASC,EAASuC,GAC3CsB,EAAQ7D,QAAUA,EAClB6D,EAAQtB,OAASA,IAEnBa,EAAiBS,EAASE,GACnBF,EAGT,QAAST,GAAiBS,EAASnE,GACjC,GAAmB,UAAfA,EAAK4B,OAAT,CAGA,IAAK,GAAItM,GAAI,EAAG0D,EAAImL,EAAQ1N,MAAMlB,OAAQD,EAAI0D,EAAG1D,IAC/C,GAAI6O,EAAQ1N,MAAMnB,IAAM0K,EACtB,MAEJmE,GAAQ1N,MAAMnC,KAAK0L,GACnBA,EAAK8B,SAASxN,KAAK6P,GAGA,UAAfnE,EAAK4B,QACPuC,EAAQG,cAKV,KAAK,GAFDpM,GAASiM,EAAQjM,OAEZ5C,EAAI,EAAG0D,EAAIgH,EAAK+B,aAAaxM,OAAQD,EAAI0D,EAAG1D,IACnD,GAAK0K,EAAK+B,aAAazM,GAAvB,CAGA,GAAI+B,GAAO2I,EAAK+B,aAAazM,GAAGkE,KAEhC,KAAItB,EAAOxB,QAAQW,GAGnB,IAAK,GAAIkN,GAAI,EAAG3K,EAAI1B,EAAOzB,MAAMlB,OAAQgP,EAAI3K,EAAG2K,IAC9C,GAAIrM,EAAOzB,MAAM8N,GAAGlN,MAAQA,EAA5B,CAGAqM,EAAiBS,EAASjM,EAAOzB,MAAM8N,GACvC,UASN,QAASC,GAAOL,GACd,GAAIM,IAAQ,CACZ,KACEC,EAAKP,EAAS,SAASnE,EAAM6D,GAC3BE,EAAcI,EAASnE,EAAM6D,GAC7BY,GAAQ,IAGZ,MAAMtD,GACJ4C,EAAcI,EAAS,KAAMhD,GAC7BsD,GAAQ,EAEV,MAAOA,GAIT,QAASb,GAAoBO,EAASnE,GAQpC,GAFAmE,EAAQG,iBAEJH,EAAQG,aAAe,GAA3B,CAIA,GAAID,GAAeF,EAAQE,YAK3B,IAAIF,EAAQjM,OAAO1B,UAAU8H,WAAY,EAAO,CAE9C,IAAK,GADD7H,MAAW4D,OAAO8J,EAAQ1N,OACrBnB,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAQD,EAAI0D,EAAG1D,IAAK,CAC5C,GAAI0K,GAAOvJ,EAAMnB,EACjB0K,GAAKpB,QACHvH,KAAM2I,EAAK3I,KACXuH,OAAQ+F,MACRhG,WAAW,GAEbqB,EAAK4B,OAAS,SACdgD,EAAWT,EAAQjM,OAAQ8H,GAE7B,MAAOmE,GAAQ7D,QAAQ+D,GAIzB,GAAIQ,GAASL,EAAOL,EAEhBU,IAKJV,EAAQ7D,QAAQ+D,IAIlB,QAASN,GAAcI,EAASnE,EAAM6D,GACpC,GAAI3L,GAASiM,EAAQjM,MAGrB4M,GACA,GAAI9E,EACF,GAAImE,EAAQ1N,MAAM,GAAGY,MAAQ2I,EAAK3I,KAChCwM,EAAMhP,EAAWgP,EAAK,iBAAmB7D,EAAK3I,UAE3C,CACH,IAAK,GAAI/B,GAAI,EAAGA,EAAI6O,EAAQ1N,MAAMlB,OAAQD,IAExC,IAAK,GADDyP,GAAQZ,EAAQ1N,MAAMnB,GACjBiP,EAAI,EAAGA,EAAIQ,EAAMhD,aAAaxM,OAAQgP,IAAK,CAClD,GAAIS,GAAMD,EAAMhD,aAAawC,EAC7B,IAAIS,EAAIxL,OAASwG,EAAK3I,KAAM,CAC1BwM,EAAMhP,EAAWgP,EAAK,iBAAmB7D,EAAK3I,KAAO,QAAU2N,EAAIvB,IAAM,UAAYsB,EAAM1N,KAC3F,MAAMyN,IAIZjB,EAAMhP,EAAWgP,EAAK,iBAAmB7D,EAAK3I,KAAO,SAAW8M,EAAQ1N,MAAM,GAAGY,UAInFwM,GAAMhP,EAAWgP,EAAK,iBAAmBM,EAAQ1N,MAAM,GAAGY,KAK5D,KAAK,GADDZ,GAAQ0N,EAAQ1N,MAAM4D,WACjB/E,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAQD,EAAI0D,EAAG1D,IAAK,CAC5C,GAAI0K,GAAOvJ,EAAMnB,EAGjB4C,GAAO1B,UAAUyO,OAAS/M,EAAO1B,UAAUyO,WACvCxP,EAAQuB,KAAKkB,EAAO1B,UAAUyO,OAAQjF,KAAS,GACjD9H,EAAO1B,UAAUyO,OAAO3Q,KAAK0L,EAE/B,IAAIkF,GAAYzP,EAAQuB,KAAKgJ,EAAK8B,SAAUqC,EAG5C,IADAnE,EAAK8B,SAASqD,OAAOD,EAAW,GACJ,GAAxBlF,EAAK8B,SAASvM,OAAa,CAC7B,GAAI6P,GAAmB3P,EAAQuB,KAAKmN,EAAQjM,OAAOzB,MAAOuJ,EACtDoF,KAAoB,GACtBjB,EAAQjM,OAAOzB,MAAM0O,OAAOC,EAAkB,IAGpDjB,EAAQtB,OAAOgB,GAIjB,QAASe,GAAW1M,EAAQ8H,GAE1B,GAAI9H,EAAO1B,UAAU6O,MAAO,CACrBnN,EAAO1B,UAAUC,QACpByB,EAAO1B,UAAUC,SACnB,IAAI6O,KACJtF,GAAK+B,aAAawD,QAAQ,SAASP,GACjCM,EAAON,EAAIvB,KAAOuB,EAAIxL,QAExBtB,EAAO1B,UAAUC,MAAMuJ,EAAK3I,OAC1BA,KAAM2I,EAAK3I,KACXwB,KAAMmH,EAAK+B,aAAanH,IAAI,SAASoK,GAAM,MAAOA,GAAIvB,MACtD6B,OAAQA,EACRlD,QAASpC,EAAKoC,QACdJ,SAAUhC,EAAKgC,SACfhE,OAAQgC,EAAKhC,QAIbgC,EAAK3I,OAEPa,EAAOxB,QAAQsJ,EAAK3I,MAAQ2I,EAAKpB,OAEnC,IAAI4G,GAAY/P,EAAQuB,KAAKkB,EAAOzB,MAAOuJ,EACvCwF,KAAa,GACftN,EAAOzB,MAAM0O,OAAOK,EAAW,EACjC,KAAK,GAAIlQ,GAAI,EAAG0D,EAAIgH,EAAK8B,SAASvM,OAAQD,EAAI0D,EAAG1D,IAC/CkQ,EAAY/P,EAAQuB,KAAKgJ,EAAK8B,SAASxM,GAAGmB,MAAOuJ,GAC7CwF,IAAa,GACfxF,EAAK8B,SAASxM,GAAGmB,MAAM0O,OAAOK,EAAW,EAE7CxF,GAAK8B,SAASqD,OAAO,EAAGnF,EAAK8B,SAASvM,QAGxC,QAASkQ,GAAiBtB,EAASnE,EAAM0F,GACvC,IACE,GAAI9G,GAASoB,EAAK1B,UAEpB,MAAM6C,GAEJ,WADAuE,GAAU1F,EAAMmB,GAGlB,MAAKvC,IAAYA,YAAkBxI,GAG1BwI,MAFP8G,GAAU1F,EAAM,GAAIjN,WAAU,4CAWlC,QAAS4S,GAAoBzN,EAAQb,EAAMuO,GACzC,GAAIjP,GAAiBuB,EAAO3B,QAAQI,cACpC,OAAOA,GAAeU,GAAQuO,EAAQ9F,KAAK,SAAS9M,GAElD,MADA2D,GAAeU,GAAQvD,OAChBd,GACN,SAASmO,GAEV,KADAxK,GAAeU,GAAQvD,OACjBqN,IAiKV,QAASuD,GAAKP,EAASuB,GAErB,GAAIxN,GAASiM,EAAQjM,MAErB,IAAKiM,EAAQ1N,MAAMlB,OAKnB,IAAK,GAFDkB,GAAQ0N,EAAQ1N,MAAM4D,WAEjB/E,EAAI,EAAGA,EAAImB,EAAMlB,OAAQD,IAAK,CACrC,GAAI0K,GAAOvJ,EAAMnB,GAEbsJ,EAAS6G,EAAiBtB,EAASnE,EAAM0F,EAC7C,KAAK9G,EACH,MACFoB,GAAKpB,QACHvH,KAAM2I,EAAK3I,KACXuH,OAAQA,GAEVoB,EAAK4B,OAAS,SAEdgD,EAAW1M,EAAQ8H,IA3oBvB,GAAI6B,GAAU,CAyddxL,GAAOiB,WAELuO,YAAaxP,EAEbyP,OAAQ,SAASzO,EAAM2G,EAAQ1H,GAE7B,GAAI9B,KAAK+B,QAAQI,eAAeU,GAC9B,KAAM,IAAItE,WAAU,6BACtB,OAAO4S,GAAoBnR,KAAM6C,EAAM,GAAIgJ,SAAQ6B,GACjDC,KAAM,YACNjK,OAAQ1D,KAAK+B,QACb8L,WAAYhL,EACZiL,eAAgBhM,GAAWA,EAAQ0L,aACnCO,aAAcvE,EACdwE,cAAelM,GAAWA,EAAQ8L,aAItC2D,OAAU,SAAS1O,GACjB,GAAIa,GAAS1D,KAAK+B,OAGlB,cAFO2B,GAAOvB,eAAeU,SACtBa,GAAOtB,cAAcS,KACrBa,EAAOxB,QAAQW,UAAea,GAAOxB,QAAQW,IAItDP,IAAK,SAAS2M,GACZ,GAAKjP,KAAK+B,QAAQG,QAAQ+M,GAE1B,MAAOjP,MAAK+B,QAAQG,QAAQ+M,GAAK7E,QAGnCtB,IAAK,SAASjG,GACZ,QAAS7C,KAAK+B,QAAQG,QAAQW,IAGhC2O,OAAU,SAAS3O,EAAM+F,EAAY6I,GACV,gBAAd7I,KACTA,EAAaA,EAAW/F,KAG1B,IAAIb,GAAYhC,IAGhB,OAAO6L,SAAQC,QAAQ9J,EAAUqJ,UAAUxI,EAAM+F,IAChD0C,KAAK,SAASzI,GACb,GAAIa,GAAS1B,EAAUD,OAEvB,OAAI2B,GAAOxB,QAAQW,GACVa,EAAOxB,QAAQW,GAAMuH,OAEvB1G,EAAOvB,eAAeU,IAASsO,EAAoBnP,EAAWa,EACnE4K,EAAW/J,EAAQb,MAClByI,KAAK,SAASE,GAEb,aADO9H,GAAOvB,eAAeU,GACtB2I,EAAKpB,OAAOA,aAM3BoB,KAAM,SAAS3I,GACb,GAAIa,GAAS1D,KAAK+B,OAClB,OAAI2B,GAAOxB,QAAQW,GACVgJ,QAAQC,UACVpI,EAAOvB,eAAeU,IAASsO,EAAoBnR,KAAM6C,EAAM,GAAIgJ,SAAQ6B,GAChFC,KAAM,SACNjK,OAAQA,EACRmK,WAAYhL,EACZiL,kBACAC,aAAczO,OACd0O,cAAe1O,UAEhBgM,KAAK,iBACG5H,GAAOvB,eAAeU,OAIjCuH,OAAQ,SAASZ,EAAQ1H,GACvB,GAAI0J,GAAO2B,GACX3B,GAAKoC,QAAU9L,GAAWA,EAAQ8L,OAClC,IAAI+B,GAAUC,EAAc5P,KAAK+B,QAASyJ,GACtCkG,EAAgB7F,QAAQC,QAAQtC,GAChC9F,EAAS1D,KAAK+B,QACdnC,EAAI+P,EAAQD,KAAKpE,KAAK,WACxB,MAAOE,GAAKpB,OAAOA,QAGrB,OADAqE,GAAmB/K,EAAQ8H,EAAMkG,GAC1B9R,GAGToI,UAAW,SAAU4E,GACnB,GAAkB,gBAAPA,GACT,KAAM,IAAIrO,WAAU,kBAEtB,IAAIC,GAAI,GAAIoD,GAER+P,IACJ,IAAItM,OAAOuM,qBAA8B,MAAPhF,EAChC+E,EAAStM,OAAOuM,oBAAoBhF,OAEpC,KAAK,GAAIqC,KAAOrC,GACd+E,EAAO7R,KAAKmP,EAEhB,KAAK,GAAInO,GAAI,EAAGA,EAAI6Q,EAAO5Q,OAAQD,KAAK,SAAUmO,GAChD5M,EAAe7D,EAAGyQ,GAChB4C,cAAc,EACdC,YAAY,EACZxP,IAAK,WACH,MAAOsK,GAAIqC,IAEbnH,IAAK,WACH,KAAM,IAAIrG,OAAM,qDAGnBkQ,EAAO7Q,GAKV,OAHIuE,QAAO0M,QACT1M,OAAO0M,OAAOvT,GAETA,GAGTsJ,IAAK,SAASjF,EAAMuH,GAClB,KAAMA,YAAkBxI,IACtB,KAAM,IAAIrD,WAAU,cAAgBsE,EAAO,6BAC7C7C,MAAK+B,QAAQG,QAAQW,IACnBuH,OAAQA,IAQZiB,UAAW,SAASxI,EAAMmP,EAAcC,KAExCzD,OAAQ,SAAShD,GACf,MAAOA,GAAK3I,MAGd6L,MAAO,SAASlD,KAGhBmD,UAAW,SAASnD,GAClB,MAAOA,GAAKhC,QAGdoF,YAAa,SAASpD,KAIxB,IAAI2E,GAAatO,EAAOiB,UAAUkF,YAgCpC,IAAIkK,EAcJvP,GAAYG,UAAYjB,EAAOiB,UAC/BP,EAAeO,UAAY,GAAIH,GAC/BJ,EAAeO,UAAUuO,YAAc9O,CAEvC,IAAIG,GAUAO,EAAc,eAWdO,EAAa,GAAID,GAAID,GA6FrBuB,GAA2B,CAC/B,KACEQ,OAAOR,0BAA2BU,EAAG,GAAK,KAE5C,MAAMoH,GACJ9H,GAA2B,EAqI3B,GAAIsN,EACJ,IAA6B,mBAAlBC,gBACTD,EAAmB,SAAS9T,EAAKgU,EAAeC,EAASjE,GAsBvD,QAAS7C,KACP8G,EAAQC,EAAIC,cAEd,QAASvC,KACP5B,EAAO,GAAI5M,OAAM,aAAe8Q,EAAInF,OAAS,KAAOmF,EAAInF,QAAUmF,EAAIE,WAAa,IAAMF,EAAIE,WAAc,IAAM,IAAM,IAAM,YAAcpU,IAzB7I,GAAIkU,GAAM,GAAIH,gBACVM,GAAa,EACbC,GAAY,CAChB,MAAM,mBAAqBJ,IAAM,CAE/B,GAAIK,GAAc,uBAAuBC,KAAKxU,EAC1CuU,KACFF,EAAaE,EAAY,KAAOzG,OAAOa,SAAShO,KAC5C4T,EAAY,KACdF,GAAcE,EAAY,KAAOzG,OAAOa,SAASnO,WAGlD6T,GAAuC,mBAAlBI,kBACxBP,EAAM,GAAIO,gBACVP,EAAIQ,OAASvH,EACb+G,EAAIS,QAAU/C,EACdsC,EAAIU,UAAYhD,EAChBsC,EAAIW,WAAa,aACjBX,EAAIY,QAAU,EACdR,GAAY,GASdJ,EAAIa,mBAAqB,WACA,IAAnBb,EAAIc,aAEY,GAAdd,EAAInF,OACFmF,EAAIC,aACNhH,KAKA+G,EAAIe,iBAAiB,QAASrD,GAC9BsC,EAAIe,iBAAiB,OAAQ9H,IAGT,MAAf+G,EAAInF,OACX5B,IAGAyE,MAINsC,EAAIgB,KAAK,MAAOlV,GAAK,GAEjBkU,EAAIiB,mBACNjB,EAAIiB,iBAAiB,SAAU,gCAE3BnB,IAC0B,gBAAjBA,IACTE,EAAIiB,iBAAiB,gBAAiBnB,GACxCE,EAAIkB,iBAAkB,IAItBd,EACFe,WAAW,WACTnB,EAAIoB,QACH,GAEHpB,EAAIoB,KAAK,WAIV,IAAsB,mBAAXhL,UAA4C,mBAAX2D,SAAwB,CACvE,GAAIsH,EACJzB,GAAmB,SAAS9T,EAAKgU,EAAeC,EAASjE,GACvD,GAAwB,YAApBhQ,EAAI+C,OAAO,EAAG,GAChB,KAAM,IAAIK,OAAM,oBAAsBpD,EAAM,kEAM9C,OALAuV,GAAKA,GAAMjL,QAAQ,MAEjBtK,EADEiD,EACIjD,EAAIK,QAAQ,MAAO,MAAM0C,OAAO,GAEhC/C,EAAI+C,OAAO,GACZwS,EAAGC,SAASxV,EAAK,SAASiC,EAAKwT,GACpC,GAAIxT,EACF,MAAO+N,GAAO/N,EAId,IAAIyT,GAAaD,EAAO,EACF,YAAlBC,EAAW,KACbA,EAAaA,EAAW3S,OAAO,IAEjCkR,EAAQyB,UAKX,CAAA,GAAmB,mBAAR5T,OAA4C,mBAAdA,MAAKuO,MAwBjD,KAAM,IAAInQ,WAAU,sCAvBpB4T,GAAmB,SAAS9T,EAAKgU,EAAeC,EAASjE,GACvD,GAAI2F,IACFC,SAAUC,OAAU,gCAGlB7B,KAC0B,gBAAjBA,KACT2B,EAAKC,QAAuB,cAAI5B,GAClC2B,EAAKG,YAAc,WAGrBzF,MAAMrQ,EAAK2V,GACR1I,KAAK,SAAU8I,GACd,GAAIA,EAAEC,GACJ,MAAOD,GAAEE,MAET,MAAM,IAAI7S,OAAM,gBAAkB2S,EAAEhH,OAAS,IAAMgH,EAAE3B,cAGxDnH,KAAKgH,EAASjE,IAuCvB,GAAItG,EAYJhF,GAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MAGjBA,KAAK1B,QAAUgF,EAGftD,KAAKoG,OAGsB,mBAAhBpF,gBACThB,KAAKuU,UAAYvT,aAAaE,KAGhClB,KAAKiH,UAAW,EAChBjH,KAAKwU,qBAAsB,EAC3BxU,KAAKyU,aAAc,EACnBzU,KAAK0U,kBAAmB,EAQxB1U,KAAK8H,IAAI,SAAU9H,KAAKgI,eAExBL,EAAcnF,KAAKxC,MAAM,GAAO,MAKd,mBAAX2I,UAA4C,mBAAX2D,UAA2BA,QAAQrE,UAC7E1F,EAAeO,UAAUqF,aAAeQ,QAgB1C,IAAIF,GAqDJ7F,GAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAY+L,GAChC,GAAIC,GAAWpO,EAAYhE,KAAKxC,KAAM6C,EAAM+F,EAG5C,QAFI5I,KAAKwU,qBAAwBG,GAAsD,OAA3CC,EAASxT,OAAOwT,EAAS7T,OAAS,EAAG,IAAgBoC,EAAQyR,KACvGA,GAAY,OACPA,IAKX,IAAIC,IAAuC,mBAAlBzC,eACzBxP,GAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,MAAOK,SAAQC,QAAQ0C,EAAOhM,KAAKxC,KAAMwL,IACxCF,KAAK,SAASsC,GACb,MAAIiH,IACKjH,EAAQlP,QAAQ,KAAM,OACxBkP,OAQbhL,EAAK,QAAS,WACZ,MAAO,UAAS4I,GACd,MAAO,IAAIK,SAAQ,SAASC,EAASuC,GACnC8D,EAAiB3G,EAAKoC,QAASpC,EAAKgC,SAAS6E,cAAevG,EAASuC,QAmB3EzL,EAAK,SAAU,SAASkS,GACtB,MAAO,UAASjS,EAAM+F,EAAY6I,GAGhC,MAFI7I,IAAcA,EAAW/F,MAC3B4D,EAAKjE,KAAKxC,KAAM,oHAAsH6C,EAAO,SAAW+F,EAAW/F,MAC9JiS,EAAatS,KAAKxC,KAAM6C,EAAM+F,EAAY6I,GAAenG,KAAK,SAASlB,GAC5E,MAAOA,GAAO2K,aAAe3K,EAAgB,QAAIA,OAQvDxH,EAAK,YAAa,SAASoS,GACzB,MAAO,UAASxJ,GAGd,MAF4B,UAAxBA,EAAKgC,SAASyH,SAChBzJ,EAAKgC,SAASyH,OAAS3V,QAClB0V,EAAgBE,MAAMlV,KAAMmV,cA0BvCvS,EAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACd,GAA4B,QAAxBA,EAAKgC,SAASyH,SAAqBjV,KAAK+I,QAAS,CACnD,GAAIqM,GAAQ5J,EAAKgC,SAAS4H,MAAQzL,GAClCyL,GAAM/Q,QACN+Q,EAAMtL,QAAU,WACd,IACE,MAAOuL,MAAKC,MAAM9J,EAAKhC,QAEzB,MAAMmD,GACJ,KAAM,IAAIlL,OAAM,qBAAuB+J,EAAK3I,YAsDtDN,EAAeO,UAAUyS,UAAY,SAAS1S,GAC5C,GAAI8D,MACAjD,EAAS1D,IACb,KAAK,GAAIJ,KAAK8D,GACRA,EAAOK,iBAAmBL,EAAOK,eAAenE,IAAMA,IAAK2C,GAAeO,WAAkB,cAALlD,GAEvFqB,EAAQuB,MAAM,UAAW,YAAa,aAAc,UAAW,SAAU,UAAW,SAAU5C,KAAM,IACtG+G,EAAI/G,GAAK8D,EAAO9D,GAGpB,OADA+G,GAAIyB,WAAaL,EAAUK,WACpBzB,EAGT,IAAI6O,GACJjT,GAAeO,UAAU2S,OAAS,SAAS9O,EAAK+O,GAiC1C,QAASC,GAAe/I,GACtB,IAAK,GAAIhN,KAAKgN,GACZ,GAAIA,EAAI7I,eAAenE,GACrB,OAAO,EAnCjB,GAAI8D,GAAS1D,IAoBb,IAlBI,oBAAsB2G,KACxB6O,GAAexU,aACX2F,EAAI+N,iBACN1T,aAAe1B,OAEf0B,aAAewU,IAGf,YAAc7O,KAChBjD,EAAOuD,SAAWN,EAAIM,UAGpBN,EAAIiP,qBAAsB,IAC5BlS,EAAO3B,QAAQ8T,yBAA0B,IAEvC,cAAgBlP,IAAO,SAAWA,KACpCgB,EAAcnF,KAAKkB,IAAUiD,EAAIyB,cAAezB,EAAI2B,OAASP,GAAaA,EAAUO,SAEjFoN,EAAa,CAGhB,GAAIpX,EAOJ,IANA0K,EAAOtF,EAAQiD,EAAK,SAASA,GAC3BrI,EAAUA,GAAWqI,EAAIrI,UAE3BA,EAAUA,GAAWqI,EAAIrI,QAGZ,CAOX,GAAIqX,EAAejS,EAAOoD,WAAa6O,EAAejS,EAAO2C,OAASsP,EAAejS,EAAO4C,WAAaqP,EAAejS,EAAOoS,UAAYH,EAAejS,EAAOqS,oBAC/J,KAAM,IAAIxX,WAAU,qGAEtByB,MAAK1B,QAAUA,EACfoJ,EAAelF,KAAKxC,MAYtB,GATI2G,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,OAE3BuG,EAAOtF,EAAQiD,EAAK,SAASA,GACvBA,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,SAIzBzC,KAAKiH,SACP,IAAK,GAAIrH,KAAK8D,GAAOjB,MACf7C,EAAEqB,QAAQ,OAAQ,GACpBwF,EAAKjE,KAAKkB,EAAQ,wBAA0B9D,EAAI,SAAW8D,EAAOjB,MAAM7C,GAAK,yGAYrF,GARI+G,EAAI6N,sBACN9Q,EAAO8Q,oBAAsB7N,EAAI6N,oBACjC/N,EAAKjE,KAAKkB,EAAQ,oGAGhBiD,EAAI8N,cACN/Q,EAAO+Q,YAAc9N,EAAI8N,aAEvB9N,EAAIP,IACN,IAAK,GAAIxG,KAAK+G,GAAIP,IAAK,CACrB,GAAI4P,GAAIrP,EAAIP,IAAIxG,EAGhB,IAAiB,gBAANoW,GAAgB,CACzB,GAAIC,GAAqBvS,EAAO8Q,qBAAoD,OAA7B5U,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAOwS,eAAetW,EAC7BqW,IAAyD,OAAnC9P,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,GAGtC,IAAIoV,GAAW,EACf,KAAK,GAAItP,KAAOnD,GAAOoD,SACjBX,EAAK/E,OAAO,EAAGyF,EAAI9F,SAAW8F,KACzBV,EAAKU,EAAI9F,SAA+B,KAApBoF,EAAKU,EAAI9F,UAC/BoV,EAASvV,MAAM,KAAKG,OAAS8F,EAAIjG,MAAM,KAAKG,SACjDoV,EAAWtP,EAEXsP,IAAYzS,EAAOoD,SAASqP,GAAUnP,OACxCb,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS2C,EAAOoD,SAASqP,GAAUnP,KAAKjG,OAAS,GAE9E,IAAI8F,GAAMnD,EAAOoD,SAASX,GAAQzC,EAAOoD,SAASX,MAClDU,GAAIT,IAAM4P,MAGVtS,GAAO0C,IAAIxG,GAAKoW,EAKtB,GAAIrP,EAAIoP,mBAAoB,CAE1B,IAAK,GADDA,MACKjV,EAAI,EAAGA,EAAI6F,EAAIoP,mBAAmBhV,OAAQD,IAAK,CACtD,GAAIkD,GAAO2C,EAAIoP,mBAAmBjV,GAC9BsV,EAAgBC,KAAKC,IAAItS,EAAKtE,YAAY,KAAO,EAAGsE,EAAKtE,YAAY,MACrE6W,EAAa/P,EAAYhE,KAAKkB,EAAQM,EAAK5C,OAAO,EAAGgV,GACzDL,GAAmBjV,GAAKyV,EAAavS,EAAK5C,OAAOgV,GAEnD1S,EAAOqS,mBAAqBA,EAG9B,GAAIpP,EAAImP,QACN,IAAK,GAAIlW,KAAK+G,GAAImP,QAAS,CAEzB,IAAK,GADDU,MACK1V,EAAI,EAAGA,EAAI6F,EAAImP,QAAQlW,GAAGmB,OAAQD,IAAK,CAC9C,GAAImV,GAAqBvS,EAAO8Q,qBAAoF,OAA7D7N,EAAImP,QAAQlW,GAAGkB,GAAGM,OAAOuF,EAAImP,QAAQlW,GAAGkB,GAAGC,OAAS,EAAG,GAC1G0V,EAAsB/S,EAAOwS,eAAevP,EAAImP,QAAQlW,GAAGkB,GAC3DmV,IAAuF,OAAjEQ,EAAoBrV,OAAOqV,EAAoB1V,OAAS,EAAG,KACnF0V,EAAsBA,EAAoBrV,OAAO,EAAGqV,EAAoB1V,OAAS,IACnFyV,EAAO1W,KAAK2W,GAEd/S,EAAOoS,QAAQlW,GAAK4W,EAIxB,GAAI7P,EAAIG,SACN,IAAK,GAAIlH,KAAK+G,GAAIG,SAAU,CAC1B,GAAIlH,EAAEjB,MAAM,oBACV,KAAM,IAAIJ,WAAU,IAAMqB,EAAI,iCAEhC,IAAIuG,GAAOK,EAAYhE,KAAKkB,EAAQ9D,EAGP,MAAzBuG,EAAKA,EAAKpF,OAAS,KACrBoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IAEtC2F,EAAahD,EAAQyC,EAAMQ,EAAIG,SAASlH,IAAI,GAIhD,IAAK,GAAI8W,KAAK/P,GAAK,CACjB,GAAIqP,GAAIrP,EAAI+P,EAEZ,IAAIzV,EAAQuB,MAAM,UAAW,MAAO,WAAY,UAAW,QAAS,WAAY,qBAC1E,mBAAoB,gBAAiB,aAAc,YAAa,cAAe,oBAAqBkU,KAAM,EAGhH,GAAgB,gBAALV,IAAiBA,YAAapQ,OACvClC,EAAOgT,GAAKV,MAET,CACHtS,EAAOgT,GAAKhT,EAAOgT,MAEnB,KAAK,GAAI9W,KAAKoW,GAEZ,GAAS,QAALU,GAAuB,KAAR9W,EAAE,GACnBmF,EAAOrB,EAAOgT,GAAG9W,GAAK8D,EAAOgT,GAAG9W,OAAUoW,EAAEpW,QAEzC,IAAS,QAAL8W,EAAa,CAEpB,GAAI9B,GAAWpO,EAAYhE,KAAKkB,EAAQ9D,EACpC8D,GAAO8Q,qBAAkE,OAA3CI,EAASxT,OAAOwT,EAAS7T,OAAS,EAAG,KAAgBoC,EAAQyR,KAC7FA,GAAY,OACd7P,EAAOrB,EAAOgT,GAAG9B,GAAYlR,EAAOgT,GAAG9B,OAAiBoB,EAAEpW,QAEvD,IAAS,YAAL8W,EAAiB,CACxB,GAAIT,GAAqBvS,EAAO8Q,qBAAoD,OAA7B5U,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAOwS,eAAetW,EAC7BqW,IAAyD,OAAnC9P,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IACtC2C,EAAOgT,GAAGvQ,MAAWN,OAAOmQ,EAAEpW,QAG9B8D,GAAOgT,GAAG9W,GAAKoW,EAAEpW,IAMzBoJ,EAAOtF,EAAQiD,EAAK,SAASA,GAC3BjD,EAAO+R,OAAO9O,GAAK,MA6FvB,WAUE,QAASgQ,GAAWjT,EAAQ6S,GAE1B,GAAIK,GAAuBC,EAAfC,EAAY,CACxB,KAAK,GAAIlX,KAAK8D,GAAOoD,SACfyP,EAAWnV,OAAO,EAAGxB,EAAEmB,UAAYnB,GAAM2W,EAAWxV,SAAWnB,EAAEmB,QAAmC,MAAzBwV,EAAW3W,EAAEmB,UAC1F8V,EAASjX,EAAEgB,MAAM,KAAKG,OAClB8V,EAASC,IACXF,EAAShX,EACTkX,EAAYD,GAIlB,OAAOD,GAGT,QAASG,GAAoBrT,EAAQmD,EAAKZ,EAAS+Q,EAASC,GAE1D,IAAKD,GAA0C,KAA/BA,EAAQA,EAAQjW,OAAS,IAAakW,GAAkBpQ,EAAIqQ,oBAAqB,EAC/F,MAAOF,EAET,IAAIG,IAAY,CAgBhB,IAbItQ,EAAIR,MACN+Q,EAAevQ,EAAIR,KAAM2Q,EAAS,SAASK,EAAaC,EAAWC,GACjE,GAAkB,GAAdA,GAAmBF,EAAY3X,YAAY,MAAQ2X,EAAYtW,OAAS,EAC1E,MAAOoW,IAAY,KAIpBA,GAAazT,EAAO2C,MACvB+Q,EAAe1T,EAAO2C,KAAMJ,EAAU,IAAM+Q,EAAS,SAASK,EAAaC,EAAWC,GACpF,GAAkB,GAAdA,GAAmBF,EAAY3X,YAAY,MAAQ2X,EAAYtW,OAAS,EAC1E,MAAOoW,IAAY,IAGrBA,EACF,MAAOH,EAIT,IAAIE,GAAmB,KAAOrQ,EAAIqQ,kBAAoB,KACtD,OAAIF,GAAQ5V,OAAO4V,EAAQjW,OAASmW,EAAiBnW,SAAWmW,EACvDF,EAAUE,EAEVF,EAGX,QAASQ,GAAuB9T,EAAQmD,EAAKZ,EAAS+Q,EAASC,GAE7D,IAAKD,EAAS,CACZ,IAAInQ,EAAIG,KAMN,MAAOf,IAAWvC,EAAO8Q,oBAAsB,MAAQ,GALvDwC,GAAmC,MAAzBnQ,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAIH,EAAIT,IAAK,CACX,GAAIqR,GAAU,KAAOT,EAEjBnO,EAAWvB,EAAYT,EAAIT,IAAKqR,EAQpC,IALK5O,IACH4O,EAAU,KAAOV,EAAoBrT,EAAQmD,EAAKZ,EAAS+Q,EAASC,GAChEQ,GAAW,KAAOT,IACpBnO,EAAWvB,EAAYT,EAAIT,IAAKqR,KAEhC5O,EAAU,CACZ,GAAI6O,GAASC,EAAUjU,EAAQmD,EAAKZ,EAAS4C,EAAU4O,EAASR,EAChE,IAAIS,EACF,MAAOA,IAKb,MAAOzR,GAAU,IAAM8Q,EAAoBrT,EAAQmD,EAAKZ,EAAS+Q,EAASC,GAG5E,QAASW,GAAa/O,EAAU6O,EAAQzR,EAASjC,GAE/C,GAAgB,KAAZ6E,EACF,KAAM,IAAIpH,OAAM,WAAawE,EAAU,mDAIzC,SAAIyR,EAAOtW,OAAO,EAAGyH,EAAS9H,SAAW8H,GAAY7E,EAAKjD,OAAS8H,EAAS9H,QAM9E,QAAS4W,GAAUjU,EAAQmD,EAAKZ,EAAS4C,EAAU7E,EAAMiT,GAC1B,KAAzBjT,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GACtC,IAAI2W,GAAS7Q,EAAIT,IAAIyC,EAErB,IAAqB,gBAAV6O,GACT,KAAM,IAAIjW,OAAM,wEAA0EoH,EAAW,OAAS5C,EAEhH,IAAK2R,EAAa/O,EAAU6O,EAAQzR,EAASjC,IAA0B,gBAAV0T,GAA7D,CAIA,GAAc,KAAVA,EACFA,EAASzR,MAGN,IAA2B,MAAvByR,EAAOtW,OAAO,EAAG,GACxB,MAAO6E,GAAU,IAAM8Q,EAAoBrT,EAAQmD,EAAKZ,EAASyR,EAAOtW,OAAO,GAAK4C,EAAK5C,OAAOyH,EAAS9H,QAASkW,EAGpH,OAAOvT,GAAOmU,cAAcH,EAAS1T,EAAK5C,OAAOyH,EAAS9H,QAASkF,EAAU,MAG/E,QAAS6R,GAAmBpU,EAAQmD,EAAKZ,EAAS+Q,EAASC,GAEzD,IAAKD,EAAS,CACZ,IAAInQ,EAAIG,KAMN,MAAO6E,SAAQC,QAAQ7F,GAAWvC,EAAO8Q,oBAAsB,MAAQ,IALvEwC,GAAmC,MAAzBnQ,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAIyQ,GAAS5O,CAcb,OAZIhC,GAAIT,MACNqR,EAAU,KAAOT,EACjBnO,EAAWvB,EAAYT,EAAIT,IAAKqR,GAG3B5O,IACH4O,EAAU,KAAOV,EAAoBrT,EAAQmD,EAAKZ,EAAS+Q,EAASC,GAChEQ,GAAW,KAAOT,IACpBnO,EAAWvB,EAAYT,EAAIT,IAAKqR,OAI9B5O,EAAWkP,EAAMrU,EAAQmD,EAAKZ,EAAS4C,EAAU4O,EAASR,GAAkBpL,QAAQC,WAC3FR,KAAK,SAASoM,GACb,MAAIA,GACK7L,QAAQC,QAAQ4L,GAGlB7L,QAAQC,QAAQ7F,EAAU,IAAM8Q,EAAoBrT,EAAQmD,EAAKZ,EAAS+Q,EAASC,MAI9F,QAASe,GAAYtU,EAAQmD,EAAKZ,EAAS4C,EAAU6O,EAAQ1T,EAAMiT,GAGjE,GAAc,KAAVS,EACFA,EAASzR,MAGN,IAA2B,MAAvByR,EAAOtW,OAAO,EAAG,GACxB,MAAOyK,SAAQC,QAAQ7F,EAAU,IAAM8Q,EAAoBrT,EAAQmD,EAAKZ,EAASyR,EAAOtW,OAAO,GAAK4C,EAAK5C,OAAOyH,EAAS9H,QAASkW,IACjI3L,KAAK,SAASzI,GACb,MAAO6I,GAAuBlJ,KAAKkB,EAAQb,EAAMoD,EAAU,MAI/D,OAAOvC,GAAO2H,UAAUqM,EAAS1T,EAAK5C,OAAOyH,EAAS9H,QAASkF,EAAU,KAG3E,QAAS8R,GAAMrU,EAAQmD,EAAKZ,EAAS4C,EAAU7E,EAAMiT,GACtB,KAAzBjT,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GAEtC,IAAI2W,GAAS7Q,EAAIT,IAAIyC,EAErB,IAAqB,gBAAV6O,GACT,MAAKE,GAAa/O,EAAU6O,EAAQzR,EAASjC,GAEtCgU,EAAYtU,EAAQmD,EAAKZ,EAAS4C,EAAU6O,EAAQ1T,EAAMiT,GADxDpL,QAAQC,SAKnB,IAAIpI,EAAOqF,QACT,MAAO8C,SAAQC,QAAQ7F,EAAU,MAAQjC,EAG3C,IAAIiU,MACAC,IACJ,KAAK,GAAIvL,KAAK+K,GAAQ,CACpB,GAAIhB,GAAIjM,EAAekC,EACvBuL,GAAWpY,MACT4K,UAAWgM,EACXtQ,IAAKsR,EAAO/K,KAEdsL,EAAkBnY,KAAK4D,EAAe,OAAEgT,EAAEtM,OAAQnE,IAIpD,MAAO4F,SAAQsD,IAAI8I,GAClB3M,KAAK,SAAS6M,GAEb,IAAK,GAAIrX,GAAI,EAAGA,EAAIoX,EAAWnX,OAAQD,IAAK,CAC1C,GAAI4V,GAAIwB,EAAWpX,GAAG4J,UAClB1F,EAAQmC,EAAqBuP,EAAEvQ,KAAMgS,EAAgBrX,GACzD,KAAK4V,EAAE1L,QAAUhG,GAAS0R,EAAE1L,SAAWhG,EACrC,MAAOkT,GAAWpX,GAAGsF,OAG1BkF,KAAK,SAASoM,GACb,GAAIA,EAAQ,CACV,IAAKE,EAAa/O,EAAU6O,EAAQzR,EAASjC,GAC3C,MACF,OAAOgU,GAAYtU,EAAQmD,EAAKZ,EAAS4C,EAAU6O,EAAQ1T,EAAMiT,MA8JvE,QAASmB,GAAuBpU,GAC9B,GAAIqU,GAAerU,EAAKtE,YAAY,KAChCqB,EAASsV,KAAKC,IAAI+B,EAAe,EAAGrU,EAAKtE,YAAY,KACzD,QACEqB,OAAQA,EACRuX,MAAO,GAAIC,QAAO,KAAOvU,EAAK5C,OAAO,EAAGL,GAAQrC,QAAQ,qBAAsB,QAAQA,QAAQ,MAAO,WAAa,YAClHiF,SAAU0U,IAAgB,GAK9B,QAASG,GAAsB9U,EAAQ6S,GAErC,IAAK,GADDtQ,GAA6BwS,EAApBC,GAAa,EACjB5X,EAAI,EAAGA,EAAI4C,EAAOqS,mBAAmBhV,OAAQD,IAAK,CACzD,GAAI6X,GAAoBjV,EAAOqS,mBAAmBjV,GAC9ClB,EAAImW,EAAmB4C,KAAuB5C,EAAmB4C,GAAqBP,EAAuBO,GACjH,MAAIpC,EAAWxV,OAASnB,EAAEmB,QAA1B,CAEA,GAAIpC,GAAQ4X,EAAW5X,MAAMiB,EAAE0Y,QAC3B3Z,GAAWsH,IAAcyS,GAAc9Y,EAAE+D,YAAasC,EAAQlF,OAASpC,EAAM,GAAGoC,WAClFkF,EAAUtH,EAAM,GAChB+Z,GAAc9Y,EAAE+D,SAChB8U,EAAaxS,EAAU0S,EAAkBvX,OAAOxB,EAAEmB,UAItD,GAAKkF,EAGL,OACE2S,YAAa3S,EACbwS,WAAYA,GAIhB,QAASI,GAAsBnV,EAAQuC,EAAS6S,GAC9C,GAAIC,GAAerV,EAAOsV,cAAgBtV,CAM1C,QAHCqV,EAAa1S,KAAKyS,GAAiBC,EAAa1S,KAAKyS,QAAsB7D,OAAS,OACrF8D,EAAa1S,KAAKyS,GAAepV,OAAS,KAEnCqV,EAAavN,KAAKsN,GACxBxN,KAAK,WACJ,GAAI3E,GAAMoS,EAAazW,IAAIwW,GAAwB,OAYnD,OATInS,GAAIsS,WACNtS,EAAMA,EAAIsS,UAGRtS,EAAIzE,UACNyE,EAAIN,KAAOM,EAAIzE,QACfuE,EAAKjE,KAAKkB,EAAQ,uBAAyBoV,EAAgB,yFAGtDpS,EAAahD,EAAQuC,EAASU,GAAK,KAI9C,QAASyQ,GAAe8B,EAASlC,EAASmC,GAExC,GACIC,EACJ,KAAK,GAAIhP,KAAU8O,GAAS,CAE1B,GAAIG,GAAgC,MAAvBjP,EAAOhJ,OAAO,EAAG,GAAa,KAAO,EAKlD,IAJIiY,IACFjP,EAASA,EAAOhJ,OAAO,IAEzBgY,EAAgBhP,EAAOnJ,QAAQ,KAC3BmY,KAAkB,GAGlBhP,EAAOhJ,OAAO,EAAGgY,IAAkBpC,EAAQ5V,OAAO,EAAGgY,IAClDhP,EAAOhJ,OAAOgY,EAAgB,IAAMpC,EAAQ5V,OAAO4V,EAAQjW,OAASqJ,EAAOrJ,OAASqY,EAAgB,IAErGD,EAAQ/O,EAAQ8O,EAAQG,EAASjP,GAASA,EAAOxJ,MAAM,KAAKG,QAC9D,OAIN,GAAIuY,GAAYJ,EAAQlC,IAAYkC,EAAQnV,gBAAkBmV,EAAQnV,eAAeiT,GAAWkC,EAAQlC,GAAWkC,EAAQ,KAAOlC,EAC9HsC,IACFH,EAAQG,EAAWA,EAAW,GAldlCvW,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MACjBA,KAAK8G,YACL9G,KAAK+V,yBAoOTxT,EAAeO,UAAU+U,cAAgBtV,EAAeO,UAAUoT,eAAiB3T,EAAeO,UAAUuI,UAI5GzI,EAAK,iBAAkB,SAASsT,GAC9B,MAAO,UAASrT,EAAM+F,GACpB,GAAI5I,KAAK+I,QACP,MAAOmN,GAAe1T,KAAKxC,KAAM6C,EAAM+F,GAAY,EAErD,IAAI2Q,GAAkBrD,EAAe1T,KAAKxC,KAAM6C,EAAM+F,GAAY,EAElE,KAAK5I,KAAKwU,oBACR,MAAO+E,EAET,IAAItT,GAAU0Q,EAAW3W,KAAMuZ,GAE3B1S,EAAM7G,KAAK8G,SAASb,GACpBiR,EAAmBrQ,GAAOA,EAAIqQ,gBAalC,OAXwB5X,SAApB4X,GAAiCrQ,GAAOA,EAAIR,MAC9C+Q,EAAevQ,EAAIR,KAAMkT,EAAgBnY,OAAO6E,GAAU,SAASoR,EAAaC,EAAWC,GACzF,GAAkB,GAAdA,GAAmBF,EAAY3X,YAAY,MAAQ2X,EAAYtW,OAAS,EAE1E,MADAmW,IAAmB,GACZ,KAIRA,KAAqB,GAASA,GAAwC,OAApBA,IAAiE,OAAnCrU,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,IAAwE,OAAzDwY,EAAgBnY,OAAOmY,EAAgBxY,OAAS,EAAG,KAClLwY,EAAkBA,EAAgBnY,OAAO,EAAGmY,EAAgBxY,OAAS,IAEhEwY,KAIX3W,EAAK,gBAAiB,SAASiV,GAC7B,MAAO,UAAShV,EAAM+F,EAAY4Q,GAChC,GAAI9V,GAAS1D,IAKb,IAJAwZ,EAAWA,KAAa,EAIpB5Q,EACF,GAAI6Q,GAAoB9C,EAAWjT,EAAQkF,IACvClF,EAAO8Q,qBAAsE,OAA/C5L,EAAWxH,OAAOwH,EAAW7H,OAAS,EAAG,IACvE4V,EAAWjT,EAAQkF,EAAWxH,OAAO,EAAGwH,EAAW7H,OAAS,GAElE,IAAI2Y,GAAgBD,GAAqB/V,EAAOoD,SAAS2S,EAGzD,IAAIC,GAA4B,KAAX7W,EAAK,GAAW,CACnC,GAAI8W,GAAYD,EAActT,IAC1BwT,EAAiBD,GAAarS,EAAYqS,EAAW9W,EAEzD,IAAI+W,GAAsD,gBAA7BD,GAAUC,GAA6B,CAClE,GAAIlC,GAASC,EAAUjU,EAAQgW,EAAeD,EAAmBG,EAAgB/W,EAAM2W,EACvF,IAAI9B,EACF,MAAOA,IAIb,GAAIzB,GAAqBvS,EAAO8Q,qBAA0D,OAAnC3R,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhFwV,EAAasB,EAAcrV,KAAKkB,EAAQb,EAAM+F,GAAY,EAG1DqN,IAAqE,OAA/CM,EAAWnV,OAAOmV,EAAWxV,OAAS,EAAG,KACjEkV,GAAqB,GACnBA,IACFM,EAAaA,EAAWnV,OAAO,EAAGmV,EAAWxV,OAAS,GAExD,IAAI8Y,GAAiBrB,EAAsB9U,EAAQ6S,GAC/CtQ,EAAU4T,GAAkBA,EAAejB,aAAejC,EAAWjT,EAAQ6S,EAEjF,KAAKtQ,EACH,MAAOsQ,IAAcN,EAAqB,MAAQ,GAEpD,IAAIe,GAAUT,EAAWnV,OAAO6E,EAAQlF,OAAS,EAEjD,OAAOyW,GAAuB9T,EAAQA,EAAOoD,SAASb,OAAgBA,EAAS+Q,EAASwC,MAI5F5W,EAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAY4Q,GAChC,GAAI9V,GAAS1D,IAGb,OAFAwZ,GAAWA,KAAa,EAEjB3N,QAAQC,UACdR,KAAK,WAGJ,GAAI1C,EACF,GAAI6Q,GAAoB9C,EAAWjT,EAAQkF,IACvClF,EAAO8Q,qBAAsE,OAA/C5L,EAAWxH,OAAOwH,EAAW7H,OAAS,EAAG,IACvE4V,EAAWjT,EAAQkF,EAAWxH,OAAO,EAAGwH,EAAW7H,OAAS,GAElE,IAAI2Y,GAAgBD,GAAqB/V,EAAOoD,SAAS2S,EAGzD,IAAIC,GAAsC,MAArB7W,EAAKzB,OAAO,EAAG,GAAY,CAC9C,GAAIuY,GAAYD,EAActT,IAC1BwT,EAAiBD,GAAarS,EAAYqS,EAAW9W,EAEzD,IAAI+W,EACF,MAAO7B,GAAMrU,EAAQgW,EAAeD,EAAmBG,EAAgB/W,EAAM2W,GAGjF,MAAO3N,SAAQC,YAEhBR,KAAK,SAASoM,GACb,GAAIA,EACF,MAAOA,EAET,IAAIzB,GAAqBvS,EAAO8Q,qBAA0D,OAAnC3R,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhFwV,EAAalL,EAAU7I,KAAKkB,EAAQb,EAAM+F,GAAY,EAGtDqN,IAAqE,OAA/CM,EAAWnV,OAAOmV,EAAWxV,OAAS,EAAG,KACjEkV,GAAqB,GACnBA,IACFM,EAAaA,EAAWnV,OAAO,EAAGmV,EAAWxV,OAAS,GAExD,IAAI8Y,GAAiBrB,EAAsB9U,EAAQ6S,GAC/CtQ,EAAU4T,GAAkBA,EAAejB,aAAejC,EAAWjT,EAAQ6S,EAEjF,KAAKtQ,EACH,MAAO4F,SAAQC,QAAQyK,GAAcN,EAAqB,MAAQ,IAEpE,IAAIpP,GAAMnD,EAAOoD,SAASb,GAGtB6T,EAAejT,IAAQA,EAAIkT,aAAeF,EAC9C,QAAQC,EAAejO,QAAQC,QAAQjF,GAAOgS,EAAsBnV,EAAQuC,EAAS4T,EAAepB,aACnGnN,KAAK,SAASzE,GACb,GAAImQ,GAAUT,EAAWnV,OAAO6E,EAAQlF,OAAS,EAEjD,OAAO+W,GAAmBpU,EAAQmD,EAAKZ,EAAS+Q,EAASwC,SAQjE,IAAIzD,KA0FJnT,GAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAAI9H,GAAS1D,IACb,OAAO6L,SAAQC,QAAQ0C,EAAOhM,KAAKxC,KAAMwL,IACxCF,KAAK,SAASsC,GACb,GAAI3H,GAAU0Q,EAAWjT,EAAQ8H,EAAK3I,KACtC,IAAIoD,EAAS,CACX,GAAIY,GAAMnD,EAAOoD,SAASb,GACtB+Q,EAAUxL,EAAK3I,KAAKzB,OAAO6E,EAAQlF,OAAS,GAE5CsF,IACJ,IAAIQ,EAAIR,KAAM,CACZ,GAAI2T,GAAY,CAGhB5C,GAAevQ,EAAIR,KAAM2Q,EAAS,SAASK,EAAaC,EAAWC,GAC7DA,EAAayC,IACfA,EAAYzC,GACd7R,EAAWW,EAAMiR,EAAWC,GAAcyC,EAAYzC,KAGxD7R,EAAW8F,EAAKgC,SAAUnH,GAIxBQ,EAAIoO,SAAWzJ,EAAKgC,SAAS9J,SAC/B8H,EAAKgC,SAASyH,OAASzJ,EAAKgC,SAASyH,QAAUpO,EAAIoO,QAGvD,MAAOrH,WAWf,WAsBE,QAASqM,KACP,GAAIC,GAA6D,gBAAxCA,EAAkBC,OAAO9G,WAChD,MAAO6G,GAAkB1O,IAE3B,KAAK,GAAI1K,GAAI,EAAGA,EAAIsZ,EAA0BrZ,OAAQD,IACpD,GAAsD,eAAlDsZ,EAA0BtZ,GAAGqZ,OAAO9G,WAEtC,MADA6G,GAAoBE,EAA0BtZ,GACvCoZ,EAAkB1O,KA0C/B,QAAS6O,GAAgB3W,EAAQ8H,GAC/B,MAAO,IAAIK,SAAQ,SAASC,EAASuC,GAC/B7C,EAAKgC,SAAS8M,WAChBjM,EAAO,GAAI5M,OAAM,oEAEnB8Y,EAAa/O,CACb,KACEY,cAAcZ,EAAKoC,SAErB,MAAMjB,GACJ4N,EAAa,KACblM,EAAO1B,GAET4N,EAAa,KAGR/O,EAAKgC,SAAS4H,OACjB/G,EAAO,GAAI5M,OAAM+J,EAAKoC,QAAU,+GAElC9B,EAAQ,MAxFZ,GAAuB,mBAAZO,UACT,GAAImO,GAAOnO,SAASS,qBAAqB,QAAQ,EAEnD,IAAI2N,GACAC,EAeAR,EAZAK,EAAa,KAGbI,EAAWH,GAAQ,WACrB,GAAII,GAAIvO,SAASwO,cAAc,UAC3BC,EAA2B,mBAAVC,QAA8C,mBAArBA,MAAMpa,UACpD,OAAOia,GAAEI,eAAiBJ,EAAEI,YAAYra,UAAYia,EAAEI,YAAYra,WAAWM,QAAQ,gBAAkB,KAAO6Z,KAK5GV,KAkBAa,EAAa,EACbC,IACJtY,GAAK,gBAAiB,SAASuY,GAC7B,MAAO,UAASC,GAEd,OAAID,EAAa3Y,KAAKxC,KAAMob,KAIxBb,EACFva,KAAKqb,gBAAgBd,EAAYa,GAI1BT,EACP3a,KAAKqb,gBAAgBpB,IAA4BmB,GAI1CH,EACPC,EAAcpb,KAAKsb,GAOnBpb,KAAKqb,gBAAgB,KAAMD,IAEtB,MA4BXxY,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,GAAI9H,GAAS1D,IAEb,OAA4B,QAAxBwL,EAAKgC,SAASyH,QAAqBzJ,EAAKgC,SAAS8N,aAAgBja,GAAc6K,GAG/EA,EACKmO,EAAgB3W,EAAQ8H,GAE1B,GAAIK,SAAQ,SAASC,EAASuC,GA+BnC,QAASkN,GAASC,GAChB,IAAIZ,EAAEvH,YAA8B,UAAhBuH,EAAEvH,YAA0C,YAAhBuH,EAAEvH,WAAlD,CAOA,GAJA4H,IAIKzP,EAAKgC,SAAS4H,OAAU8F,EAAcna,QAGtC,IAAK4Z,EAAU,CAClB,IAAK,GAAI7Z,GAAI,EAAGA,EAAIoa,EAAcna,OAAQD,IACxC4C,EAAO2X,gBAAgB7P,EAAM0P,EAAcpa,GAC7Coa,WALAxX,GAAO2X,gBAAgB7P,EAQzBiQ,KAGKjQ,EAAKgC,SAAS4H,OAAU5J,EAAKgC,SAASgJ,QACzCnI,EAAO,GAAI5M,OAAM+J,EAAK3I,KAAO,kKAE/BiJ,EAAQ,KAGV,QAASmE,GAAMuL,GACbC,IACApN,EAAO,GAAI5M,OAAM,yBAA2B+J,EAAKoC,UAGnD,QAAS6N,KAIP,GAHArb,EAAS8R,OAASuI,EAClBra,EAASuI,QAAU+R,EAEfE,EAAEc,YAAa,CACjBd,EAAEc,YAAY,qBAAsBH,EACpC,KAAK,GAAIza,GAAI,EAAGA,EAAIsZ,EAA0BrZ,OAAQD,IAChDsZ,EAA0BtZ,GAAGqZ,QAAUS,IACrCV,GAAqBA,EAAkBC,QAAUS,IACnDV,EAAoB,MACtBE,EAA0BzJ,OAAO7P,EAAG,QAIxC8Z,GAAEe,oBAAoB,OAAQJ,GAAU,GACxCX,EAAEe,oBAAoB,QAAS1L,GAAO;AAGxCuK,EAAKoB,YAAYhB,GA/EnB,GAAIA,GAAIvO,SAASwO,cAAc,SAE/BD,GAAEiB,OAAQ,EAENrQ,EAAKgC,SAASsO,cAChBlB,EAAEkB,YAActQ,EAAKgC,SAASsO,aAE5BtQ,EAAKgC,SAAS8M,WAChBM,EAAEmB,aAAa,YAAavQ,EAAKgC,SAAS8M,WAExCK,GACFC,EAAEI,YAAY,qBAAsBO,GACpCnB,EAA0Bta,MACxBqa,OAAQS,EACRpP,KAAMA,MAIRoP,EAAEtH,iBAAiB,OAAQiI,GAAU,GACrCX,EAAEtH,iBAAiB,QAASrD,GAAO,IAGrCgL,IAEAR,EAAYra,EAAS8R,OACrBwI,EAAata,EAASuI,QAEtBiS,EAAE1Z,IAAMsK,EAAKoC,QACb4M,EAAKwB,YAAYpB,KAlCVlM,EAAMlM,KAAKxC,KAAMwL,QAgJhC,IAAI9B,IAA6B,2FAwBjC,WAsGE,QAASuS,GAAY7G,EAAO1R,EAAQwY,GAGlC,GAFAA,EAAO9G,EAAMlL,YAAcgS,EAAO9G,EAAMlL,gBAEpCjJ,EAAQuB,KAAK0Z,EAAO9G,EAAMlL,YAAakL,KAAU,EAArD,CAGA8G,EAAO9G,EAAMlL,YAAYpK,KAAKsV,EAE9B,KAAK,GAAItU,GAAI,EAAG0D,EAAI4Q,EAAMnL,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAAIqb,GAAU/G,EAAMnL,eAAenJ,GAC/Bsb,EAAW1Y,EAAO2Y,QAAQF,EAG9B,IAAKC,IAAYA,EAASjS,UAA1B,CAIA,GAAImS,GAAgBlH,EAAMlL,YAAckS,EAASpS,aAAeoL,EAAMpL,YAGtE,IAA4B,OAAxBoS,EAASlS,YAAuBkS,EAASlS,WAAaoS,EAAe,CAGvE,GAA4B,OAAxBF,EAASlS,aACXgS,EAAOE,EAASlS,YAAYyG,OAAO1P,EAAQuB,KAAK0Z,EAAOE,EAASlS,YAAakS,GAAW,GAG9C,GAAtCF,EAAOE,EAASlS,YAAYnJ,QAC9B,KAAM,IAAIU,OAAM,kCAGpB2a,GAASlS,WAAaoS,EAGxBL,EAAYG,EAAU1Y,EAAQwY,MAIlC,QAAShM,GAAKrN,EAAM0Z,EAAY7Y,GAE9B,IAAI6Y,EAAWnS,OAAf,CAGAmS,EAAWrS,WAAa,CAExB,IAAIgS,KAEJD,GAAYM,EAAY7Y,EAAQwY,EAGhC,KAAK,GADDM,KAAwBD,EAAWvS,aAAekS,EAAOnb,OAAS,EAC7DD,EAAIob,EAAOnb,OAAS,EAAGD,GAAK,EAAGA,IAAK,CAE3C,IAAK,GADDsD,GAAQ8X,EAAOpb,GACViP,EAAI,EAAGA,EAAI3L,EAAMrD,OAAQgP,IAAK,CACrC,GAAIqF,GAAQhR,EAAM2L,EAGdyM,GACFC,EAAsBrH,EAAO1R,GAE7BgZ,EAAkBtH,EAAO1R,GAE7B8Y,GAAuBA,IAK3B,QAASG,MAOT,QAASC,GAAwB/Z,EAAMT,GACrC,MAAOA,GAAcS,KAAUT,EAAcS,IAC3CA,KAAMA,EACN0K,gBACA5I,QAAS,GAAIgY,GACbE,eAIJ,QAASJ,GAAsBrH,EAAO1R,GAEpC,IAAI0R,EAAMhL,OAAV,CAGA,GAAIhI,GAAgBsB,EAAO3B,QAAQK,cAC/BgI,EAASgL,EAAMhL,OAASwS,EAAwBxH,EAAMvS,KAAMT,GAC5DuC,EAAUyQ,EAAMhL,OAAOzF,QAEvBmY,EAAc1H,EAAMvL,QAAQrH,KAAKpC,EAAU,SAASyC,EAAMmC,GAG5D,GAFAoF,EAAO2S,QAAS,EAEG,gBAARla,GACT,IAAK,GAAIjD,KAAKiD,GACZ8B,EAAQ/E,GAAKiD,EAAKjD,OAGpB+E,GAAQ9B,GAAQmC,CAGlB,KAAK,GAAIlE,GAAI,EAAG0D,EAAI4F,EAAOyS,UAAU9b,OAAQD,EAAI0D,EAAG1D,IAAK,CACvD,GAAIkc,GAAiB5S,EAAOyS,UAAU/b,EACtC,KAAKkc,EAAeD,OAAQ,CAC1B,GAAIE,GAAgBhc,EAAQuB,KAAKwa,EAAezP,aAAcnD,GAC1D8S,EAASF,EAAeG,QAAQF,EAChCC,IACFA,EAAOvY,IAKb,MADAyF,GAAO2S,QAAS,EACT/X,IACJoY,GAAIhI,EAAMvS,MAWf,IAT0B,kBAAfia,KACTA,GAAgBK,WAAarT,QAASgT,IAGxCA,EAAcA,IAAiBK,WAAarT,QAAS,cAErDM,EAAO+S,QAAUL,EAAYK,QAC7B/S,EAAON,QAAUgT,EAAYhT,SAExBM,EAAO+S,UAAY/S,EAAON,QAC7B,KAAM,IAAIvL,WAAU,oCAAsC6W,EAAMvS,KAIlE,KAAK,GAAI/B,GAAI,EAAG0D,EAAI4Q,EAAMnL,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAKIuc,GALAlB,EAAU/G,EAAMnL,eAAenJ,GAC/Bsb,EAAW1Y,EAAO2Y,QAAQF,GAC1BmB,EAAYlb,EAAc+Z,EAK1BmB,GACFD,EAAaC,EAAU3Y,QAGhByX,IAAaA,EAASpS,YAC7BqT,EAAajB,EAASxX,SAGdwX,GAKRK,EAAsBL,EAAU1Y,GAChC4Z,EAAYlB,EAAShS,OACrBiT,EAAaC,EAAU3Y,SANvB0Y,EAAa3Z,EAAOpB,IAAI6Z,GAUtBmB,GAAaA,EAAUT,WACzBS,EAAUT,UAAU/c,KAAKsK,GACzBA,EAAOmD,aAAazN,KAAKwd,IAGzBlT,EAAOmD,aAAazN,KAAK,KAK3B,KAAK,GADD8J,GAAkBwL,EAAMxL,gBAAgB9I,GACnCiP,EAAI,EAAGwN,EAAM3T,EAAgB7I,OAAQgP,EAAIwN,IAAOxN,EAAG,CAC1D,GAAItL,GAAQmF,EAAgBmG,EACxB3F,GAAO+S,QAAQ1Y,IACjB2F,EAAO+S,QAAQ1Y,GAAO4Y,MAO9B,QAASG,GAAU3a,EAAMa,GACvB,GAAIiB,GACAyQ,EAAQ1R,EAAO2Y,QAAQxZ,EAE3B,IAAKuS,EAOCA,EAAMpL,YACRyT,EAAgB5a,EAAMuS,KAAW1R,GAEzB0R,EAAMjL,WACduS,EAAkBtH,EAAO1R,GAE3BiB,EAAUyQ,EAAMhL,OAAOzF,YAXvB,IADAA,EAAUjB,EAAOpB,IAAIO,IAChB8B,EACH,KAAM,IAAIlD,OAAM,6BAA+BoB,EAAO,IAa1D,SAAMuS,GAASA,EAAMpL,cAAgBrF,GAAWA,EAAQoQ,aAC/CpQ,EAAiB,QAEnBA,EAGT,QAAS+X,GAAkBtH,EAAO1R,GAChC,IAAI0R,EAAMhL,OAAV,CAGA,GAAIzF,MAEAyF,EAASgL,EAAMhL,QAAWzF,QAASA,EAASyY,GAAIhI,EAAMvS,KAG1D,KAAKuS,EAAMrL,iBACT,IAAK,GAAIjJ,GAAI,EAAG0D,EAAI4Q,EAAMnL,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAAIqb,GAAU/G,EAAMnL,eAAenJ,GAE/Bsb,EAAW1Y,EAAO2Y,QAAQF,EAC1BC,IACFM,EAAkBN,EAAU1Y,GAKlC0R,EAAMjL,WAAY,CAClB,IAAIxK,GAASyV,EAAMtL,QAAQtH,KAAKpC,EAAU,SAASyC,GACjD,IAAK,GAAI/B,GAAI,EAAG0D,EAAI4Q,EAAM/Q,KAAKtD,OAAQD,EAAI0D,EAAG1D,IAC5C,GAAIsU,EAAM/Q,KAAKvD,IAAM+B,EAErB,MAAO2a,GAAUpI,EAAMnL,eAAenJ,GAAI4C,EAG5C,IAAIga,GAAiBha,EAAOmU,cAAchV,EAAMuS,EAAMvS,KACtD,IAAI5B,EAAQuB,KAAK4S,EAAMnL,eAAgByT,KAAmB,EACxD,MAAOF,GAAUE,EAAgBha,EAEnC,MAAM,IAAIjC,OAAM,UAAYoB,EAAO,oCAAsCuS,EAAMvS,OAC9E8B,EAASyF,EAEG9K,UAAXK,IACFyK,EAAOzF,QAAUhF,GAGnBgF,EAAUyF,EAAOzF,QAGbA,IAAYA,EAAQgZ,YAAchZ,YAAmB/C,IACvDwT,EAAMxQ,SAAWlB,EAAOsE,UAAUrD,GAE3ByQ,EAAM/K,YAAc1F,IAAYvE,EACvCgV,EAAMxQ,SAAWlB,EAAOsE,UAAUtD,EAAYC,IAG9CyQ,EAAMxQ,SAAWlB,EAAOsE,WAAYO,QAAW5D,EAASoQ,cAAc,KAY1E,QAAS0I,GAAgB5P,EAAYuH,EAAOwI,EAAMla,GAEhD,GAAK0R,IAASA,EAAMjL,WAAciL,EAAMpL,YAAxC,CAKA4T,EAAK9d,KAAK+N,EAEV,KAAK,GAAI/M,GAAI,EAAG0D,EAAI4Q,EAAMnL,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAAIqb,GAAU/G,EAAMnL,eAAenJ,EAC/BG,GAAQuB,KAAKob,EAAMzB,KAAY,IAC5BzY,EAAO2Y,QAAQF,GAGlBsB,EAAgBtB,EAASzY,EAAO2Y,QAAQF,GAAUyB,EAAMla,GAFxDA,EAAOpB,IAAI6Z,IAMb/G,EAAMjL,YAGViL,EAAMjL,WAAY,EAClBiL,EAAMhL,OAAON,QAAQtH,KAAKpC,KAvX5BmC,EAAeO,UAAUsY,SAAW,SAASvY,EAAMwB,EAAMwF,GASvD,GARmB,gBAARhH,KACTgH,EAAUxF,EACVA,EAAOxB,EACPA,EAAO,MAKa,iBAAXgH,GACT,MAAO7J,MAAK6d,gBAAgB3I,MAAMlV,KAAMmV,UAE1C,IAAIC,GAAQzL,GAIZyL,GAAMvS,KAAOA,IAAS7C,KAAKkW,gBAAkBlW,KAAKqL,WAAW7I,KAAKxC,KAAM6C,GACxEuS,EAAMpL,aAAc,EACpBoL,EAAM/Q,KAAOA,EACb+Q,EAAMvL,QAAUA,EAEhB7J,KAAK8d,eACHC,KAAK,EACL3I,MAAOA,KAGX7S,EAAeO,UAAU+a,gBAAkB,SAAShb,EAAMwB,EAAMwF,EAASC,GACpD,gBAARjH,KACTiH,EAAUD,EACVA,EAAUxF,EACVA,EAAOxB,EACPA,EAAO,KAIT,IAAIuS,GAAQzL,GACZyL,GAAMvS,KAAOA,IAAS7C,KAAKkW,gBAAkBlW,KAAKqL,WAAW7I,KAAKxC,KAAM6C,GACxEuS,EAAM/Q,KAAOA,EACb+Q,EAAMtL,QAAUA,EAChBsL,EAAMrL,iBAAmBF,EAEzB7J,KAAK8d,eACHC,KAAK,EACL3I,MAAOA,KAGXxS,EAAK,kBAAmB,WACtB,MAAO,UAAS4I,EAAM4P,GACpB,GAAKA,EAAL,CAGA,GAAIhG,GAAQgG,EAAShG,MACjB4I,EAAUxS,GAAQA,EAAKgC,QAW3B,IARI4H,EAAMvS,OACFuS,EAAMvS,OAAQ7C,MAAKqc,UACvBrc,KAAKqc,QAAQjH,EAAMvS,MAAQuS,GAEzB4I,IACFA,EAAQxH,QAAS,KAGhBpB,EAAMvS,MAAQ2I,IAASwS,EAAQ5I,OAASA,EAAMvS,MAAQ2I,EAAK3I,KAAM,CACpE,IAAKmb,EACH,KAAM,IAAIzf,WAAU,+IACtB,IAAIyf,EAAQ5I,MACV,KAAsB,YAAlB4I,EAAQ/I,OACJ,GAAIxT,OAAM,sDAAwD+J,EAAK3I,KAAO,0EAE9E,GAAIpB,OAAM,UAAY+J,EAAK3I,KAAO,mBAAqBmb,EAAQ/I,OAAS,8CAE7E+I,GAAQ/I,SACX+I,EAAQ/I,OAAS,YACnB+I,EAAQ5I,MAAQA,OAKtBrS,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MAEjBA,KAAKqc,WACLrc,KAAK+B,QAAQK,oBAuEjBC,EAAesa,EAAc,YAC3B3X,MAAO,WACL,MAAO,YA8NXpC,EAAK,SAAU,SAASqb,GACtB,MAAO,UAASpb,GAGd,aAFO7C,MAAK+B,QAAQK,cAAcS,SAC3B7C,MAAKqc,QAAQxZ,GACbob,EAAIzb,KAAKxC,KAAM6C,MAI1BD,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,MAAIxL,MAAKqc,QAAQ7Q,EAAK3I,OACpB2I,EAAKgC,SAASyH,OAAS,UAChB,KAGTzJ,EAAKgC,SAASnJ,KAAOmH,EAAKgC,SAASnJ,SAE5BqK,EAAMlM,KAAKxC,KAAMwL,OAI5B5I,EAAK,YAAa,SAAS+L,GAEzB,MAAO,UAASnD,GAEd,MADAA,GAAKgC,SAASnJ,KAAOmH,EAAKgC,SAASnJ,SAC5BwH,QAAQC,QAAQ6C,EAAUuG,MAAMlV,KAAMmV,YAAY7J,KAAK,SAAS9B,GAIrE,OAF4B,YAAxBgC,EAAKgC,SAASyH,SAAyBzJ,EAAKgC,SAASyH,QAAU1L,EAAqBiC,EAAKhC,WAC3FgC,EAAKgC,SAASyH,OAAS,YAClBzL,OAMb5G,EAAK,OAAQ,SAASsb,GACpB,MAAO,UAAS3H,GACd,GAAI7S,GAAS1D,KACToV,EAAQ1R,EAAO2Y,QAAQ9F,EAE3B,QAAKnB,GAASA,EAAM/Q,KAAKtD,OAChBmd,EAAOhJ,MAAMlV,KAAMmV,YAE5BC,EAAMxL,gBAAkBwL,EAAMnL,kBAI9BiG,EAAKqG,EAAYnB,EAAO1R,GAGxB+Z,EAAgBlH,EAAYnB,KAAW1R,GAClC0R,EAAMxQ,WACTwQ,EAAMxQ,SAAWlB,EAAOsE,UAAUoN,EAAMhL,OAAOzF,UAG5CjB,EAAOmN,QACVnN,EAAO2Y,QAAQ9F,GAAcjX,QAG/BoE,EAAOoE,IAAIyO,EAAYnB,EAAMxQ,UAEtBiH,QAAQC,cAInBlJ,EAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACc,UAAxBA,EAAKgC,SAASyH,SAChBzJ,EAAKgC,SAASyH,OAAS3V,QAIzBsP,EAAYpM,KAAKxC,KAAMwL,EAEvB,IAEI4J,GAFA1R,EAAS1D,IAKb,IAAI0D,EAAO2Y,QAAQ7Q,EAAK3I,MACtBuS,EAAQ1R,EAAO2Y,QAAQ7Q,EAAK3I,MAEvBuS,EAAMpL,cACToL,EAAM/Q,KAAO+Q,EAAM/Q,KAAKwB,OAAO2F,EAAKgC,SAASnJ,OAC/C+Q,EAAM/Q,KAAO+Q,EAAM/Q,KAAKwB,OAAO2F,EAAKgC,SAASnJ,UAK1C,IAAImH,EAAKgC,SAAS4H,MACrBA,EAAQ5J,EAAKgC,SAAS4H,MACtBA,EAAM/Q,KAAO+Q,EAAM/Q,KAAKwB,OAAO2F,EAAKgC,SAASnJ,UAK1C,MAAMX,EAAOqF,SAAWyC,EAAKgC,SAASgJ,QACX,YAAxBhL,EAAKgC,SAASyH,QAAgD,OAAxBzJ,EAAKgC,SAASyH,QAA2C,OAAxBzJ,EAAKgC,SAASyH,QAAkB,CAK7G,GAHqB,mBAAVkJ,SACTA,OAAO3b,KAAKkB,EAAQ8H,IAEjBA,EAAKgC,SAAS4H,QAAU5J,EAAKgC,SAASgJ,OACzC,KAAM,IAAI/U,OAAM+J,EAAK3I,KAAO,gBAAkB2I,EAAKgC,SAASyH,OAAS,uBAEvEG,GAAQ5J,EAAKgC,SAAS4H,MAGlBA,GAAS5J,EAAKgC,SAASnJ,OACzB+Q,EAAM/Q,KAAO+Q,EAAM/Q,KAAKwB,OAAO2F,EAAKgC,SAASnJ,OAI5C+Q,IACHA,EAAQzL,IACRyL,EAAM/Q,KAAOmH,EAAKgC,SAASnJ,KAC3B+Q,EAAMtL,QAAU,cAIlBpG,EAAO2Y,QAAQ7Q,EAAK3I,MAAQuS,CAE5B,IAAIgJ,GAAUha,EAAMgR,EAAM/Q,KAE1B+Q,GAAM/Q,KAAO+Z,EAAQ9Z,MACrB8Q,EAAMxL,gBAAkBwU,EAAQ7Z,QAChC6Q,EAAMvS,KAAO2I,EAAK3I,KAClBuS,EAAM/K,WAAamB,EAAKgC,SAASnD,cAAe,CAIhD,KAAK,GADDgU,MACKvd,EAAI,EAAG0D,EAAI4Q,EAAM/Q,KAAKtD,OAAQD,EAAI0D,EAAG1D,IAC5Cud,EAAkBve,KAAK+L,QAAQC,QAAQpI,EAAO2H,UAAU+J,EAAM/Q,KAAKvD,GAAI0K,EAAK3I,OAE9E,OAAOgJ,SAAQsD,IAAIkP,GAAmB/S,KAAK,SAASrB,GAIlD,MAFAmL,GAAMnL,eAAiBA,GAGrB5F,KAAM+Q,EAAM/Q,KACZyF,QAAS,WAgBP,MAbAoG,GAAK1E,EAAK3I,KAAMuS,EAAO1R,GAGvB+Z,EAAgBjS,EAAK3I,KAAMuS,KAAW1R,GAEjC0R,EAAMxQ,WACTwQ,EAAMxQ,SAAWlB,EAAOsE,UAAUoN,EAAMhL,OAAOzF,UAG5CjB,EAAOmN,QACVnN,EAAO2Y,QAAQ7Q,EAAK3I,MAAQvD,QAGvB8V,EAAMxQ,mBA6BzBhC,EAAK,kBAAmB,SAAS0b,GAC/B,MAAO,UAAS9S,EAAM4P,GACpB,GAAIA,IAAc5P,EAAKgC,SAAS7I,WAAauH,GAAoC,UAAxBV,EAAKgC,SAASyH,QACrE,MAAOqJ,GAAe9b,KAAKxC,KAAMwL,EAAM4P,EAEzC5P,GAAKgC,SAASyH,OAAS,QACvB,IAAIG,GAAQ5J,EAAKgC,SAAS4H,MAAQzL,GAClCyL,GAAM/Q,KAAOmH,EAAKgC,SAASnJ,IAC3B,IAAIkG,GAAcD,EAAekB,EAAKgC,SAAS7I,QAC/CyQ,GAAMtL,QAAU,WACd,MAAOS,OAKbxH,EAAgB,SAASsO,GACvB,MAAO,YAYL,QAASkN,GAAcC,GACrB,GAAInZ,OAAOoZ,KACTpZ,OAAOoZ,KAAKre,GAAU2Q,QAAQyN,OAE9B,KAAK,GAAIE,KAAKte,GACP2D,EAAevB,KAAKpC,EAAUse,IAEnCF,EAASE,GAIf,QAASC,GAAmBH,GAC1BD,EAAc,SAASK,GACrB,GAAI3d,EAAQuB,KAAKqc,EAAoBD,KAAe,EAApD,CAEA,IACE,GAAI5Z,GAAQ5E,EAASwe,GAEvB,MAAOjS,GACLkS,EAAmB/e,KAAK8e,GAE1BJ,EAASI,EAAY5Z,MAhCzB,GAAItB,GAAS1D,IACbqR,GAAY7O,KAAKkB,EAEjB,IAMIob,GANA/a,EAAiBsB,OAAOvC,UAAUiB,eAGlC8a,GAAsB,KAAM,iBAAkB,eAAgB,gBAAiB,SAAU,eAAgB,WAC3G,wBAAyB,oBAAqB,kBAAmB,kBAAmB,kBA6BtFnb,GAAOoE,IAAI,mBAAoBpE,EAAOsE,WACpC+W,cAAe,SAASlR,EAAYlJ,EAASqa,EAASC,GAEpD,GAAIC,GAAY9e,EAASkR,MAEzBlR,GAASkR,OAAShS,MAGlB,IAAI6f,EACJ,IAAIH,EAAS,CACXG,IACA,KAAK,GAAIT,KAAKM,GACZG,EAAWT,GAAKte,EAASse,GACzBte,EAASse,GAAKM,EAAQN,GAc1B,MATK/Z,KACHma,KAEAH,EAAmB,SAAS9b,EAAMmC,GAChC8Z,EAAejc,GAAQmC,KAKpB,WACL,GAEIoa,GAFA7U,EAAc5F,EAAU2F,EAAe3F,MAGvC0a,IAAoB1a,CA6BxB,IA3BKA,IAAWsa,GACdN,EAAmB,SAAS9b,EAAMmC,GAC5B8Z,EAAejc,KAAUmC,GAET,mBAATA,KAIPia,IACF7e,EAASyC,GAAQvD,QAEdqF,IACH4F,EAAY1H,GAAQmC,EAEO,mBAAhBoa,GACJC,GAAmBD,IAAiBpa,IACvCqa,GAAkB,GAGpBD,EAAepa,MAKvBuF,EAAc8U,EAAkB9U,EAAc6U,EAG1CD,EACF,IAAK,GAAIT,KAAKS,GACZ/e,EAASse,GAAKS,EAAWT,EAI7B,OAFAte,GAASkR,OAAS4N,EAEX3U,UAMjBxH,EAAgB,SAASsO,GACvB,MAAO,YAOL,QAASiO,GAAYtb,GACnB,MAAyB,YAArBA,EAAK5C,OAAO,EAAG,GACV4C,EAAK5C,OAAO,IAAME,GAEvBie,GAAgBvb,EAAK5C,OAAO,EAAGme,EAAaxe,SAAWwe,EAClDvb,EAAK5C,OAAOme,EAAaxe,QAE3BiD,EAbT,GAAIN,GAAS1D,IAGb,IAFAqR,EAAY7O,KAAKkB,GAEI,mBAAVyI,SAA4C,mBAAZE,WAA2BF,OAAOa,SAC3E,GAAIuS,GAAevS,SAASnO,SAAW,KAAOmO,SAAS/N,UAAY+N,SAAS9N,KAAO,IAAM8N,SAAS9N,KAAO,GAY3GwE,GAAOoE,IAAI,gBAAiBpE,EAAOsE,WACjCwX,eAAgB,SAAStR,EAASuR,GAChC,MAAOH,GAAY5b,EAAOmU,cAAc3J,EAASuR,KAEnDC,YAAa,SAASC,GAEpB,GACIC,GADAC,EAAcF,EAASjgB,YAAY,IAGrCkgB,GADEC,IAAe,EACNF,EAASve,OAAO,EAAGye,GAEnBF,CAEb,IAAIG,GAAUF,EAAShf,MAAM,IAI7B,OAHAkf,GAAQjgB,MACRigB,EAAUA,EAAQ/f,KAAK,MAGrB6f,SAAUN,EAAYM,GACtBE,QAASR,EAAYQ,WAW/Bld,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GAId,MAFIA,GAAKgC,SAAS8N,YAAcja,IAC9BjB,EAASkR,OAAStR,KAAK+f,WAClBrR,EAAMlM,KAAKxC,KAAMwL,MAI5BzI,EAAgB,SAASsO,GACvB,MAAO,YAYL,QAAS2O,GAAWxW,EAAQyW,GAG1BzW,EAASA,EAAO9K,QAAQwhB,EAAc,GAGtC,IAAIC,GAAS3W,EAAO7K,MAAMyhB,GACtBC,GAAgBF,EAAO,GAAGvf,MAAM,KAAKqf,IAAiB,WAAWvhB,QAAQ4hB,EAAS,IAGlFC,EAAeC,EAAcH,KAAkBG,EAAcH,GAAgB,GAAI9H,QAAOkI,EAAgBJ,EAAeK,EAAgB,KAE3IH,GAAaI,UAAY,CAKzB,KAHA,GAEIhiB,GAFA0F,KAGG1F,EAAQ4hB,EAAa1N,KAAKrJ,IAC/BnF,EAAKvE,KAAKnB,EAAM,IAAMA,EAAM,GAE9B,OAAO0F,GAOT,QAASsE,GAAQrE,EAAOka,EAAUoC,EAASC,GAEzC,GAAoB,gBAATvc,MAAuBA,YAAiBsB,QACjD,MAAO+C,GAAQuM,MAAM,KAAMtP,MAAM9C,UAAU6N,OAAOnO,KAAK2S,UAAW,EAAGA,UAAUpU,OAAS,GAK1F,IAFoB,gBAATuD,IAAwC,kBAAZka,KACrCla,GAASA,MACPA,YAAiBsB,QAWhB,CAAA,GAAoB,gBAATtB,GAAmB,CACjC,GAAI2R,GAAqBvS,EAAO8Q,qBAA4D,OAArClQ,EAAMlD,OAAOkD,EAAMvD,OAAS,EAAG,GAClFwV,EAAa7S,EAAOwS,eAAe5R,EAAOuc,EAC1C5K,IAAqE,OAA/CM,EAAWnV,OAAOmV,EAAWxV,OAAS,EAAG,KACjEwV,EAAaA,EAAWnV,OAAO,EAAGmV,EAAWxV,OAAS,GACxD,IAAIqJ,GAAS1G,EAAOpB,IAAIiU,EACxB,KAAKnM,EACH,KAAM,IAAI3I,OAAM,sCAAwC6C,EAAQ,QAAUiS,GAAcsK,EAAU,UAAYA,EAAU,KAAO,KACjI,OAAOzW,GAAO2K,aAAe3K,EAAgB,QAAIA,EAIjD,KAAM,IAAI7L,WAAU,mBArBpB,IAAK,GADDuiB,MACKhgB,EAAI,EAAGA,EAAIwD,EAAMvD,OAAQD,IAChCggB,EAAgBhhB,KAAK4D,EAAe,OAAEY,EAAMxD,GAAI+f,GAClDhV,SAAQsD,IAAI2R,GAAiBxV,KAAK,SAASpJ,GACrCsc,GACFA,EAAStJ,MAAM,KAAMhT,IACtB0e,GAmBP,QAAStP,GAAOzO,EAAMwB,EAAM0c,GAuC1B,QAASjX,GAAQkX,EAAKrc,EAASyF,GAiB3B,QAAS6W,GAAkB3c,EAAOka,EAAUoC,GAC1C,MAAoB,gBAATtc,IAAwC,kBAAZka,GAC9BwC,EAAI1c,GACNqE,EAAQnG,KAAKkB,EAAQY,EAAOka,EAAUoC,EAASxW,EAAOgT,IAlBjE,IAAK,GADD8D,MACKpgB,EAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/BogB,EAAUphB,KAAKkhB,EAAI3c,EAAKvD,IAE1BsJ,GAAO+W,IAAM/W,EAAOgT,GAEpBhT,EAAOqL,OAAS,aAGZ2L,IAAe,GACjBF,EAAUvQ,OAAOyQ,EAAa,EAAGhX,GAE/BiX,IAAgB,GAClBH,EAAUvQ,OAAO0Q,EAAc,EAAG1c,GAEhCsb,IAAgB,IAMlBgB,EAAkBK,MAAQ,SAASze,GAEjC,GAAIoT,GAAqBvS,EAAO8Q,qBAA0D,OAAnC3R,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAChF1C,EAAMqF,EAAOwS,eAAerT,EAAMuH,EAAOgT,GAG7C,OAFInH,IAAuD,OAAjC5X,EAAI+C,OAAO/C,EAAI0C,OAAS,EAAG,KACnD1C,EAAMA,EAAI+C,OAAO,EAAG/C,EAAI0C,OAAS,IAC5B1C,GAET6iB,EAAUvQ,OAAOsP,EAAc,EAAGgB,GAIpC,IAAIvG,GAAata,EAASuI,OAC1BvI,GAASuI,QAAUA,CAEnB,IAAIhJ,GAASohB,EAAQ7L,MAAMmM,IAAgB,EAAKjhB,EAAWuE,EAASuc,EAOpE,IALA9gB,EAASuI,QAAU+R,EAEE,mBAAV/a,IAAyByK,IAClCzK,EAASyK,EAAOzF,SAEG,mBAAVhF,GACT,MAAOA,GAnFQ,gBAARkD,KACTke,EAAU1c,EACVA,EAAOxB,EACPA,EAAO,MAEHwB,YAAgBuB,SACpBmb,EAAU1c,EACVA,GAAQ,UAAW,UAAW,UAAUsM,OAAO,EAAGoQ,EAAQhgB,SAGtC,kBAAXggB,KACTA,EAAU,SAAUA,GAClB,MAAO,YAAa,MAAOA,KAC1BA,IAGyBzhB,SAA1B+E,EAAKA,EAAKtD,OAAS,IACrBsD,EAAKxE,KAGP,IAAIogB,GAAcoB,EAAcD,GAE3BnB,EAAehf,EAAQuB,KAAK6B,EAAM,cAAe,IAEpDA,EAAKsM,OAAOsP,EAAc,GAIrBpd,IACHwB,EAAOA,EAAKwB,OAAOma,EAAWe,EAAQpgB,WAAYsf,OAGjDoB,EAAepgB,EAAQuB,KAAK6B,EAAM,cAAe,GACpDA,EAAKsM,OAAO0Q,EAAc,IAEvBD,EAAcngB,EAAQuB,KAAK6B,EAAM,aAAc,GAClDA,EAAKsM,OAAOyQ,EAAa,EAkD3B,IAAIhM,GAAQzL,GACZyL,GAAMvS,KAAOA,IAASa,EAAOwS,gBAAkBxS,EAAO2H,WAAW7I,KAAKkB,EAAQb,GAC9EuS,EAAM/Q,KAAOA,EACb+Q,EAAMtL,QAAUA,EAEhBpG,EAAOoa,eACLC,KAAK,EACL3I,MAAOA,IAtKX,GAAI1R,GAAS1D,IACbqR,GAAY7O,KAAKxC,KAEjB,IAAIkgB,GAAe,2CACfO,EAAgB,kCAChBC,EAAiB,6CACjBN,EAAiB,eACjBE,EAAU,aAEVE,IAgKJlP,GAAOyM,OAGPnb,EAAK,kBAAmB,SAAS0b,GAC/B,MAAO,UAAS9S,EAAM4P,GAEpB,IAAKA,IAAaA,EAAS2C,IACzB,MAAOO,GAAe9b,KAAKxC,KAAMwL,EAAM4P,EAEzC,IAAI4C,GAAUxS,GAAQA,EAAKgC,SACvB4H,EAAQgG,EAAShG,KAErB,IAAI4I,EACF,GAAKA,EAAQ/I,QAA4B,UAAlB+I,EAAQ/I,QAE1B,IAAKG,EAAMvS,MAA0B,OAAlBmb,EAAQ/I,OAC9B,KAAM,IAAIxT,OAAM,qCAAuCuc,EAAQ/I,OAAS,WAAazJ,EAAK3I,UAF1Fmb,GAAQ/I,OAAS,KAMrB,IAAKG,EAAMvS,KAkBLmb,IACGA,EAAQ5I,OAAU4I,EAAQxH,OAEtBwH,EAAQ5I,OAAS4I,EAAQ5I,MAAMvS,MAAQmb,EAAQ5I,MAAMvS,MAAQ2I,EAAK3I,OACzEmb,EAAQ5I,MAAQ9V,QAFhB0e,EAAQ5I,MAAQA,EAKlB4I,EAAQxH,QAAS,GAIbpB,EAAMvS,OAAQ7C,MAAKqc,UACvBrc,KAAKqc,QAAQjH,EAAMvS,MAAQuS,OA9Bd,CACf,IAAK4I,EACH,KAAM,IAAIzf,WAAU,mCAEtB,IAAIyf,EAAQ5I,QAAU4I,EAAQ5I,MAAMvS,KAClC,KAAM,IAAIpB,OAAM,wCAA0C+J,EAAK3I,KAEjEmb,GAAQ5I,MAAQA,MA4BtB1R,EAAOqc,UAAYzO,EACnB5N,EAAO6d,WAAa5Y,KAWxB,WACE,QAAS6Y,GAAc9d,EAAQkF,GAE7B,GAAIA,EAAY,CACd,GAAI6Y,EACJ,IAAI/d,EAAO+Q,aACT,IAAKgN,EAAoB7Y,EAAWlJ,YAAY,QAAS,EACvD,MAAOkJ,GAAWxH,OAAOqgB,EAAoB,OAG/C,KAAKA,EAAoB7Y,EAAW3H,QAAQ,QAAS,EACnD,MAAO2H,GAAWxH,OAAO,EAAGqgB,EAGhC,OAAO7Y,IAIX,QAAS8Y,GAAYhe,EAAQb,GAC3B,GAAI8e,GACAC,EAEA/B,EAAchd,EAAKnD,YAAY,IAEnC,IAAImgB,IAAe,EAYnB,MATInc,GAAO+Q,aACTkN,EAAe9e,EAAKzB,OAAOye,EAAc,GACzC+B,EAAa/e,EAAKzB,OAAO,EAAGye,KAG5B8B,EAAe9e,EAAKzB,OAAO,EAAGye,GAC9B+B,EAAa/e,EAAKzB,OAAOye,EAAc,IAAM8B,EAAavgB,OAAOugB,EAAajiB,YAAY,KAAO,KAIjGmiB,SAAUF,EACVG,OAAQF,GAKZ,QAASG,GAAmBre,EAAQie,EAAcC,EAAY1K,GAI5D,MAHIA,IAAuE,OAAnDyK,EAAavgB,OAAOugB,EAAa5gB,OAAS,EAAG,KACnE4gB,EAAeA,EAAavgB,OAAO,EAAGugB,EAAa5gB,OAAS,IAE1D2C,EAAO+Q,YACFmN,EAAa,IAAMD,EAGnBA,EAAe,IAAMC,EAOhC,QAASI,GAAsBte,EAAQue,GACrC,MAAOve,GAAO8Q,qBAAwD,OAAjCyN,EAAI7gB,OAAO6gB,EAAIlhB,OAAS,EAAG,GAGlE,QAASmhB,GAAoBrK,GAC3B,MAAO,UAAShV,EAAM+F,EAAY4Q,GAChC,GAAI9V,GAAS1D,KAETmiB,EAAST,EAAYhe,EAAQb,EAGjC,IAFA+F,EAAa4Y,EAAcxhB,KAAM4I,IAE5BuZ,EACH,MAAOtK,GAAcrV,KAAKxC,KAAM6C,EAAM+F,EAAY4Q,EAGpD,IAAImI,GAAeje,EAAOmU,cAAcsK,EAAON,SAAUjZ,GAAY,GACjEgZ,EAAale,EAAOmU,cAAcsK,EAAOL,OAAQlZ,GAAY,EACjE,OAAOmZ,GAAmBre,EAAQie,EAAcC,EAAYI,EAAsBte,EAAQye,EAAON,YAIrGjf,EAAK,iBAAkBsf,GACvBtf,EAAK,gBAAiBsf,GAEtBtf,EAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAY4Q,GAChC,GAAI9V,GAAS1D,IAEb4I,GAAa4Y,EAAcxhB,KAAM4I,EAEjC,IAAIuZ,GAAST,EAAYhe,EAAQb,EAEjC,OAAKsf,GAGEtW,QAAQsD,KACbzL,EAAO2H,UAAU8W,EAAON,SAAUjZ,GAAY,GAC9ClF,EAAO2H,UAAU8W,EAAOL,OAAQlZ,GAAY,KAE7C0C,KAAK,SAASiL,GACb,MAAOwL,GAAmBre,EAAQ6S,EAAW,GAAIA,EAAW,GAAIyL,EAAsBte,EAAQye,EAAON,aAP9FxW,EAAU7I,KAAKkB,EAAQb,EAAM+F,EAAY4Q,MAYtD5W,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAKI4W,GALA1e,EAAS1D,KAET6C,EAAO2I,EAAK3I,IAiBhB,OAbIa,GAAO+Q,aACJ2N,EAAoBvf,EAAK5B,QAAQ,QAAS,IAC7CuK,EAAKgC,SAAS9J,OAASb,EAAKzB,OAAO,EAAGghB,GACtC5W,EAAK3I,KAAOA,EAAKzB,OAAOghB,EAAoB,KAIzCA,EAAoBvf,EAAKnD,YAAY,QAAS,IACjD8L,EAAKgC,SAAS9J,OAASb,EAAKzB,OAAOghB,EAAoB,GACvD5W,EAAK3I,KAAOA,EAAKzB,OAAO,EAAGghB,IAIxB5T,EAAOhM,KAAKkB,EAAQ8H,GAC1BF,KAAK,SAASsC,GACb,MAAIwU,KAAqB,GAAO5W,EAAKgC,SAAS9J,QAKtCA,EAAOsV,cAAgBtV,GAAQ2H,UAAUG,EAAKgC,SAAS9J,OAAQ8H,EAAK3I,MAC3EyI,KAAK,SAAS+W,GAEb,MADA7W,GAAKgC,SAAS9J,OAAS2e,EAChBzU,IAPAA,IAUVtC,KAAK,SAASsC,GACb,GAAIkU,GAAStW,EAAKgC,SAAS9J,MAE3B,KAAKoe,EACH,MAAOlU,EAGT,IAAIpC,EAAK3I,MAAQif,EACf,KAAM,IAAIrgB,OAAM,UAAYqgB,EAAS,sHAGvC,IAAIpe,EAAO2Y,SAAW3Y,EAAO2Y,QAAQxZ,GACnC,MAAO+K,EAET,IAAIoL,GAAetV,EAAOsV,cAAgBtV,CAG1C,OAAOsV,GAAqB,OAAE8I,GAC7BxW,KAAK,SAASgX,GAKb,MAHA9W,GAAKgC,SAAS8U,aAAeA,EAE7B9W,EAAKoC,QAAUA,EACX0U,EAAa9T,OACR8T,EAAa9T,OAAOhM,KAAKkB,EAAQ8H,GAEnCoC,SAMfhL,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,GAAI9H,GAAS1D,IACb,OAAIwL,GAAKgC,SAAS8U,cAAgB9W,EAAKgC,SAAS8U,aAAa5T,OAAiC,WAAxBlD,EAAKgC,SAASyH,QAClFzJ,EAAKgC,SAAS8N,YAAa,EACpB9P,EAAKgC,SAAS8U,aAAa5T,MAAMlM,KAAKkB,EAAQ8H,EAAM,SAASA,GAClE,MAAOkD,GAAMlM,KAAKkB,EAAQ8H,MAIrBkD,EAAMlM,KAAKkB,EAAQ8H,MAKhC5I,EAAK,YAAa,SAAS+L,GACzB,MAAO,UAASnD,GACd,GAAI9H,GAAS1D,KACTuiB,EAAOpN,SACX,OAAI3J,GAAKgC,SAAS8U,cAAgB9W,EAAKgC,SAAS8U,aAAa3T,WAAqC,WAAxBnD,EAAKgC,SAASyH,OAC/EpJ,QAAQC,QAAQN,EAAKgC,SAAS8U,aAAa3T,UAAUuG,MAAMxR,EAAQ6e,IAAOjX,KAAK,SAASkX,GAC7F,GAAIC,GAAYjX,EAAKgC,SAASiV,SAG9B,IAAIA,EAAW,CACb,GAAwB,gBAAbA,GACT,KAAM,IAAIhhB,OAAM,oDAElB,IAAIihB,GAAelX,EAAKoC,QAAQhN,MAAM,KAAK,EAGtC6hB,GAAUE,MAAQF,EAAUE,MAAQnX,EAAKoC,UAC5C6U,EAAUE,KAAOD,EAAe,iBAG7BD,EAAUG,SAAWH,EAAUG,QAAQ7hB,QAAU,KAAO0hB,EAAUG,QAAQ,IAAMH,EAAUG,QAAQ,IAAMpX,EAAKoC,YAChH6U,EAAUG,SAAWF,IASzB,MAHqB,gBAAVF,KACThX,EAAKhC,OAASgZ,GAET7T,EAAUuG,MAAMxR,EAAQ6e,KAI1B5T,EAAUuG,MAAMxR,EAAQ6e,MAKrC3f,EAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACd,GAAI9H,GAAS1D,KACT6iB,GAAoB,CAExB,OAAIrX,GAAKgC,SAAS8U,cAAgB9W,EAAKgC,SAAS8U,aAAa1T,cAAgBlL,EAAOqF,SAAmC,WAAxByC,EAAKgC,SAASyH,OACpGpJ,QAAQC,QAAQN,EAAKgC,SAAS8U,aAAa1T,YAAYpM,KAAKkB,EAAQ8H,EAAM,SAASA,GACxF,GAAIqX,EACF,KAAM,IAAIphB,OAAM,wCAElB,OADAohB,IAAoB,EACbjU,EAAYpM,KAAKkB,EAAQ8H,MAC9BF,KAAK,SAASkX,GAChB,MAAIK,GACKL,GAEMljB,SAAXkjB,IACFhX,EAAKgC,SAAS4H,MAAQzL,IACtB6B,EAAKgC,SAAS4H,MAAMtL,QAAU,WAC5B,MAAO0Y,IAEThX,EAAKgC,SAAS4H,MAAM/Q,KAAOmH,EAAKgC,SAASnJ,KACzCmH,EAAKgC,SAASyH,OAAS,WAElBrG,EAAYpM,KAAKkB,EAAQ8H,MAG3BoD,EAAYpM,KAAKkB,EAAQ8H,QA6CtC,IAAIT,KAAiB,UAAW,OAAQ,MAAO,QAAS,aAAc,WAuDlEa,GAAqB,aAsDzBhJ,GAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAY+L,GAChC,GAAIjR,GAAS1D,IACb,OAAOgM,GAAmBxJ,KAAKkB,EAAQb,EAAM+F,GAC5C0C,KAAK,SAASzI,GACb,MAAOwI,GAAU7I,KAAKkB,EAAQb,EAAM+F,EAAY+L,KAEjDrJ,KAAK,SAASiL,GACb,MAAO7K,GAAuBlJ,KAAKkB,EAAQ6S,EAAY3N,QAY/D,WAEEhG,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,GAAIsX,GAAQtX,EAAKgC,SAASsV,MACtBC,EAAYvX,EAAKgC,SAASnJ,QAC9B,IAAIye,EAAO,CACTtX,EAAKgC,SAASyH,OAAS,SACvB,IAAIG,GAAQzL,GAeZ,OAdA3J,MAAKqc,QAAQ7Q,EAAK3I,MAAQuS,EAC1BA,EAAMpL,aAAc,EACpBoL,EAAM/Q,KAAO0e,EAAUld,QAAQid,IAC/B1N,EAAMvL,QAAU,SAASmZ,GACvB,OACE7F,SAAU,SAAS/S,GACjB,IAAK,GAAIxK,KAAKwK,GACZ4Y,EAAQpjB,EAAGwK,EAAOxK,GAChBwK,GAAO2K,eACTK,EAAMhL,OAAOzF,QAAQoQ,cAAe,KAExCjL,QAAS,eAGN,GAGT,MAAO4E,GAAMlM,KAAKxC,KAAMwL,SA8C9B,WA8CE,QAASyX,GAAgBC,EAAQtjB,EAAGoF,GAGlC,IAFA,GACIme,GADA/b,EAASxH,EAAEgB,MAAM,KAEdwG,EAAOrG,OAAS,GACrBoiB,EAAU/b,EAAOC,QACjB6b,EAASA,EAAOC,GAAWD,EAAOC,MAEpCA,GAAU/b,EAAOC,QACX8b,IAAWD,KACfA,EAAOC,GAAWne,GArDtBjC,EAAgB,SAASsO,GACvB,MAAO,YACLrR,KAAKqG,QACLgL,EAAY7O,KAAKxC,SAIrB4C,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAQI4N,GARA/S,EAAOrG,KAAKqG,KACZxD,EAAO2I,EAAK3I,KAMZmX,EAAY,CAEhB,KAAK,GAAI5P,KAAU/D,GAEjB,GADA+S,EAAgBhP,EAAOnJ,QAAQ,KAC3BmY,KAAkB,GAElBhP,EAAOhJ,OAAO,EAAGgY,KAAmBvW,EAAKzB,OAAO,EAAGgY,IAChDhP,EAAOhJ,OAAOgY,EAAgB,KAAOvW,EAAKzB,OAAOyB,EAAK9B,OAASqJ,EAAOrJ,OAASqY,EAAgB,GAAI,CACxG,GAAIgK,GAAQhZ,EAAOxJ,MAAM,KAAKG,MAC1BqiB,GAAQpJ,IACVA,EAAYoJ,GACd1d,EAAW8F,EAAKgC,SAAUnH,EAAK+D,GAAS4P,GAAaoJ,GAQzD,MAHI/c,GAAKxD,IACP6C,EAAW8F,EAAKgC,SAAUnH,EAAKxD,IAE1B2L,EAAOhM,KAAKxC,KAAMwL,KAM7B,IAAI6X,GAAY,uFACZC,EAAgB,uEAcpB1gB,GAAK,YAAa,SAAS+L,GACzB,MAAO,UAASnD,GAEd,GAA4B,WAAxBA,EAAKgC,SAASyH,OAEhB,MADAzJ,GAAKgC,SAASnJ,KAAOmH,EAAKgC,SAASnJ,SAC5BwH,QAAQC,QAAQN,EAAKhC,OAI9B,IAAInD,GAAOmF,EAAKhC,OAAO7K,MAAM0kB,EAC7B,IAAIhd,EAGF,IAAK,GAFDkd,GAAYld,EAAK,GAAG1H,MAAM2kB,GAErBxiB,EAAI,EAAGA,EAAIyiB,EAAUxiB,OAAQD,IAAK,CACzC,GAAIqiB,GAAUI,EAAUziB,GACpByc,EAAM4F,EAAQpiB,OAEdyiB,EAAYL,EAAQ/hB,OAAO,EAAG,EAIlC,IAHkC,KAA9B+hB,EAAQ/hB,OAAOmc,EAAM,EAAG,IAC1BA,IAEe,KAAbiG,GAAiC,KAAbA,EAAxB,CAGA,GAAIC,GAAaN,EAAQ/hB,OAAO,EAAG+hB,EAAQpiB,OAAS,GAChD2iB,EAAWD,EAAWriB,OAAO,EAAGqiB,EAAWxiB,QAAQ,KAEvD,IAAIyiB,EAAU,CACZ,GAAIC,GAAYF,EAAWriB,OAAOsiB,EAAS3iB,OAAS,EAAG0iB,EAAW1iB,OAAS2iB,EAAS3iB,OAAS,EAE9C,OAA3C2iB,EAAStiB,OAAOsiB,EAAS3iB,OAAS,EAAG,IACvC2iB,EAAWA,EAAStiB,OAAO,EAAGsiB,EAAS3iB,OAAS,GAChDyK,EAAKgC,SAASkW,GAAYlY,EAAKgC,SAASkW,OACxClY,EAAKgC,SAASkW,GAAU5jB,KAAK6jB,IAEtBnY,EAAKgC,SAASkW,YAAqB9d,QAE1Ca,EAAKjE,KAAKxC,KAAM,UAAYwL,EAAK3I,KAAO,8BAAgC8gB,EAAY,qDAAuDA,EAAY,gCACvJnY,EAAKgC,SAASkW,GAAU5jB,KAAK6jB,IAG7BV,EAAgBzX,EAAKgC,SAAUkW,EAAUC,OAI3CnY,GAAKgC,SAASiW,IAAc,GAKlC,MAAO9U,GAAUuG,MAAMlV,KAAMmV,iBAmBnC,WAMEpS,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MACjBA,KAAK8V,WACL9V,KAAK+B,QAAQ6hB,oBAKjBhhB,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAAI9H,GAAS1D,KACT6jB,GAAU,CAEd,MAAMrY,EAAK3I,OAAQa,GAAO2Y,SACxB,IAAK,GAAI7W,KAAK9B,GAAOoS,QAAS,CAC5B,IAAK,GAAIhV,GAAI,EAAGA,EAAI4C,EAAOoS,QAAQtQ,GAAGzE,OAAQD,IAAK,CACjD,GAAIgjB,GAAYpgB,EAAOoS,QAAQtQ,GAAG1E,EAElC,IAAIgjB,GAAatY,EAAK3I,KAAM,CAC1BghB,GAAU,CACV,OAIF,GAAIC,EAAU7iB,QAAQ,OAAQ,EAAI,CAChC,GAAI8iB,GAAQD,EAAUljB,MAAM,IAC5B,IAAoB,GAAhBmjB,EAAMhjB,OAAa,CACrB2C,EAAOoS,QAAQtQ,GAAGmL,OAAO7P,IAAK,EAC9B,UAGF,GAAI0K,EAAK3I,KAAKmhB,UAAU,EAAGD,EAAM,GAAGhjB,SAAWgjB,EAAM,IACjDvY,EAAK3I,KAAKzB,OAAOoK,EAAK3I,KAAK9B,OAASgjB,EAAM,GAAGhjB,OAAQgjB,EAAM,GAAGhjB,SAAWgjB,EAAM,IAC/EvY,EAAK3I,KAAKzB,OAAO2iB,EAAM,GAAGhjB,OAAQyK,EAAK3I,KAAK9B,OAASgjB,EAAM,GAAGhjB,OAASgjB,EAAM,GAAGhjB,QAAQE,QAAQ,OAAQ,EAAI,CAC9G4iB,GAAU,CACV,SAKN,GAAIA,EACF,MAAOngB,GAAe,OAAE8B,GACvB8F,KAAK,WACJ,MAAOkD,GAAOhM,KAAKkB,EAAQ8H,KAInC,MAAOgD,GAAOhM,KAAKkB,EAAQ8H,SA0BjC,WACEzI,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MACjBA,KAAKsG,eAIT1D,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAAI9H,GAAS1D,KAETqE,EAAOX,EAAO4C,SAASkF,EAAK3I,KAChC,IAAIwB,EACF,IAAK,GAAIvD,GAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/B4C,EAAe,OAAEW,EAAKvD,GAAI0K,EAAK3I,KAEnC,OAAO2L,GAAOhM,KAAKkB,EAAQ8H,SASjCzI,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY6D,MAAMlV,KAAMmV,WACxB/U,EAASkR,OAAStR,KAAK+f,aAI3Bnd,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GAEd,MADAA,GAAKgC,SAAS8N,YAAa,EACpB5M,EAAMlM,KAAKxC,KAAMwL,MAEzB0G,EAAS,GAAI3P,GAEhBnC,EAAS6jB,SAAW/R,EACpBA,EAAOgS,QAAU,cACM,gBAAV9Z,SAAsBA,OAAOzF,SAA6B,gBAAXA,WACxDyF,OAAOzF,QAAUuN,GAEnB9R,EAAS8R,OAASA,GAEF,mBAAR/R,MAAsBA,KAAOhC,QAGvC,GAAIgmB,GAAgC,mBAAZtY,QAGxB,IAAwB,mBAAbQ,UAA0B,CACnC,GAAI+X,GAAU/X,SAASS,qBAAqB,SAM5C,IALA9L,aAAeojB,EAAQA,EAAQrjB,OAAS,GACpCsL,SAASgY,gBAAkBrjB,aAAasjB,OAAStjB,aAAa6a,SAChE7a,aAAeqL,SAASgY,eACrBrjB,aAAaE,MAChBF,aAAe1B,QACb6kB,EAAY,CACd,GAAII,GAAUvjB,aAAaE,IACvBsjB,EAAWD,EAAQnjB,OAAO,EAAGmjB,EAAQ7kB,YAAY,KAAO,EAC5DyM,QAAOsY,kBAAoBvmB,EAC3BmO,SAASqY,MACP,uCAA8CF,EAAW,sCAI3DtmB,SAIC,IAA6B,mBAAlBkO,eAA+B,CAC7C,GAAIoY,GAAW,EACf,KACE,KAAM,IAAI/iB,OAAM,KAChB,MAAOkL,GACPA,EAAElM,MAAM/B,QAAQ,iCAAkC,SAASF,EAAGH,GAC5D2C,cAAiBE,IAAK7C,GACtBmmB,EAAWnmB,EAAIK,QAAQ,YAAa,OAGpCylB,GACF/X,cAAcoY,EAAW,uBAC3BtmB,QAGA8C,cAAoC,mBAAd2jB,aAA8BzjB,IAAKyjB,YAAe,KACxEzmB"} \ No newline at end of file +{"version":3,"sources":["system-csp-production.src.js"],"names":["bootstrap","global","URLPolyfill","url","baseURL","TypeError","m","String","replace","match","RangeError","protocol","username","password","host","hostname","port","pathname","search","hash","undefined","base","flag","slice","lastIndexOf","output","p","pop","push","join","this","origin","href","self","__global","addToError","err","msg","originalErr","stack","message","toString","split","newStack","i","length","$__curScript","indexOf","src","newMsg","substr","isBrowser","isWindows","newErr","errArgs","Error","fileName","lineNumber","Module","Loader","options","_loader","loaderObj","loads","modules","importPromises","moduleRecords","defineProperty","get","SystemJSLoader","call","paths","systemJSConstructor","SystemProto","hook","name","prototype","hookConstructor","isAbsolute","absURLRegEx","isRel","isPlain","urlResolve","parent","baseURI","URL","baseURIObj","applyPaths","loader","wildcard","pathMatch","maxWildcardPrefixLen","pathsCache","hasOwnProperty","path","pathParts","wildcardPrefixLen","outPath","group","deps","names","indices","l","index","getESModule","exports","esModule","getOwnPropertyDescriptor","defineOrCopyProperty","extend","value","targetObj","sourceObj","propName","d","Object","ex","a","b","prepend","extendMeta","val","Array","concat","extendPkgConfig","pkgCfgA","pkgCfgB","pkgName","warnInvalidProperties","prop","map","meta","depCache","dNormalized","coreResolve","warn","setPkgConfig","cfg","prependConfig","pkg","packages","basePkg","main","warnings","console","createInstantiate","load","result","metadata","entry","createEntry","execute","format","readMemberExpression","pParts","shift","getMapMatch","bestMatch","bestMatchLength","curMatchLength","prepareBaseURL","setProduction","isProduction","isBuilder","set","envModule","newModule","browser","node","_nodeRequire","production","dev","build","default","getNodeModule","parentModuleContext","_nodeModulePaths","require","parentName","mapMatch","has","builder","envSet","envCallback","browserConfig","nodeConfig","devConfig","buildConfig","productionConfig","detectRegisterFormat","source","leadingCommentAndMeta","leadingCommentAndMetaRegEx","originalIndices","declare","executingRequire","declarative","normalizedDeps","groupIndex","evaluated","module","esmExports","getGlobalValue","globalValue","first","parseCondition","condition","conditionExport","conditionModule","negation","conditionExportIndex","sysConditions","negate","serializeCondition","conditionObj","resolveCondition","bool","normalize","then","normalizedCondition","q","interpolateConditional","conditionalMatch","interpolationRegEx","Promise","resolve","conditionValue","booleanConditional","booleanIndex","isWorker","window","importScripts","document","process","platform","assert","item","thisLen","e","obj","opt","getElementsByTagName","bases","location","cwd","nativeURL","createLoad","status","anonCnt","linkSets","dependencies","loadModule","asyncStartLoadPartwayThrough","step","address","moduleName","moduleMetadata","moduleSource","moduleAddress","requestLoad","request","refererName","refererAddress","reject","proceedToLocate","proceedToFetch","locate","proceedToTranslate","fetch","translate","instantiate","instantiateResult","depsList","loadPromises","depLoad","key","addLoadToLinkSet","all","updateLinkSetOnLoad","exc","exception","linkSetFailed","stepState","existingLoad","done","linkSet","createLinkSet","startingLoad","loadingCount","j","doLink","error","link","_newModule","finishLoad","abrupt","checkError","pLoad","dep","failed","linkIndex","splice","globalLoadsIndex","trace","depMap","forEach","loadIndex","doDynamicExecute","linkError","createImportPromise","promise","constructor","define","delete","import","parentAddress","sourcePromise","pNames","getOwnPropertyNames","configurable","enumerable","freeze","referrerName","referrerAddress","System","fetchTextFromURL","XMLHttpRequest","authorization","fulfill","xhr","responseText","statusText","sameDomain","doTimeout","domainCheck","exec","XDomainRequest","onload","onerror","ontimeout","onprogress","timeout","onreadystatechange","readyState","addEventListener","open","setRequestHeader","withCredentials","setTimeout","send","fs","readFile","data","dataString","opts","headers","Accept","credentials","r","ok","text","scriptSrc","defaultJSExtensions","pluginFirst","loaderErrorStack","skipExt","resolved","httpRequest","systemImport","__useDefault","systemTranslate","apply","arguments","JSON","parse","getConfig","curCurScript","config","isEnvConfig","checkHasConfig","transpilerRuntime","loadedTranspilerRuntime","bundles","packageConfigPaths","v","defaultJSExtension","decanonicalize","pkgMatch","packageLength","Math","max","normalized","bundle","normalizedBundleDep","c","getPackage","curPkg","pkgLen","curPkgLen","addDefaultExtension","subPath","skipExtensions","defaultExtension","metaMatch","getMetaMatches","metaPattern","matchMeta","matchDepth","applyPackageConfigSync","mapPath","mapped","doMapSync","validMapping","normalizeSync","applyPackageConfig","doMap","doStringMap","conditionPromises","conditions","conditionValues","createPkgConfigPathObj","lastWildcard","regEx","RegExp","getPackageConfigMatch","configPath","exactMatch","packageConfigPath","packageName","loadPackageConfigPath","pkgConfigPath","configLoader","pluginLoader","systemjs","pkgMeta","matchFn","wildcardIndex","dotRel","exactMeta","decanonicalized","isPlugin","parentPackageName","parentPackage","parentMap","parentMapMatch","pkgConfigMatch","isConfigured","configured","bestDepth","getInteractiveScriptLoad","interactiveScript","script","interactiveLoadingScripts","webWorkerImport","integrity","workerLoad","head","curSystem","curRequire","ieEvents","s","createElement","isOpera","opera","attachEvent","loadingCnt","registerQueue","pushRegister","register","reduceRegister_","scriptLoad","complete","evt","cleanup","detachEvent","removeEventListener","removeChild","async","crossOrigin","setAttribute","appendChild","buildGroups","groups","depName","depEntry","defined","depGroupIndex","startEntry","curGroupDeclarative","linkDeclarativeModule","linkDynamicModule","ModuleRecord","getOrCreateModuleRecord","importers","declaration","locked","importerModule","importerIndex","setter","setters","id","depExports","depModule","len","getModule","ensureEvaluated","nameNormalized","__esModule","seen","registerDynamic","pushRegister_","amd","curMeta","del","doLoad","__exec","grouped","normalizePromises","reduceRegister","forEachGlobal","callback","keys","g","forEachGlobalValue","globalName","ignoredGlobalProps","globalSnapshot","prepareGlobal","globals","encapsulate","curDefine","oldGlobals","singleGlobal","multipleExports","stripOrigin","windowOrigin","requireResolve","parentId","getPathVars","moduleId","filename","pluginIndex","dirname","amdDefine","getCJSDeps","requireIndex","commentRegEx","params","fnBracketRegEx","requireAlias","wsRegEx","requireRegEx","requireRegExs","cjsRequirePre","cjsRequirePost","lastIndex","errback","referer","dynamicRequires","factory","req","contextualRequire","depValues","uri","moduleIndex","exportsIndex","toUrl","amdRequire","getParentName","parentPluginIndex","parsePlugin","argumentName","pluginName","argument","plugin","combinePluginParts","checkDefaultExtension","arg","createNormalizeSync","parsed","pluginSyntaxIndex","loaderNormalized","loaderModule","args","sourceMap","originalName","file","sources","calledInstantiate","alias","aliasDeps","_export","setMetaProperty","target","curPart","depth","metaRegEx","metaPartRegEx","metaParts","firstChar","metaString","metaName","metaValue","loadedBundles","matched","curModule","parts","substring","SystemJS","version","doPolyfill","scripts","currentScript","defer","curPath","basePath","systemJSBootstrap","write","__filename"],"mappings":";;;CAGA,WACA,QAASA,MACT,SAAUC,GACV,QAASC,GAAYC,EAAKC,GACxB,GAAkB,gBAAPD,GACT,KAAM,IAAIE,WAAU,uBACtB,IAAIC,GAAIC,OAAOJ,GAAKK,QAAQ,aAAc,IAAIA,QAAQ,MAAO,KAAKC,MAAM,mHACxE,KAAKH,EACH,KAAM,IAAII,YAAW,qBACvB,IAAIC,GAAWL,EAAE,IAAM,GACnBM,EAAWN,EAAE,IAAM,GACnBO,EAAWP,EAAE,IAAM,GACnBQ,EAAOR,EAAE,IAAM,GACfS,EAAWT,EAAE,IAAM,GACnBU,EAAOV,EAAE,IAAM,GACfW,EAAWX,EAAE,IAAM,GACnBY,EAASZ,EAAE,IAAM,GACjBa,EAAOb,EAAE,IAAM,EACnB,IAAgBc,SAAZhB,EAAuB,CACzB,GAAIiB,GAAOjB,YAAmBF,GAAcE,EAAU,GAAIF,GAAYE,GAClEkB,GAAQX,IAAaG,IAASF,GAC9BU,GAASL,GAAaC,IACxBA,EAASG,EAAKH,QACZI,GAAwB,MAAhBL,EAAS,KACnBA,EAAYA,IAAcI,EAAKP,OAAQO,EAAKT,UAAcS,EAAKJ,SAAiB,GAAN,KAAYI,EAAKJ,SAASM,MAAM,EAAGF,EAAKJ,SAASO,YAAY,KAAO,GAAKP,EAAYI,EAAKJ,SAEtK,IAAIQ,KACJR,GAAST,QAAQ,kBAAmB,IACjCA,QAAQ,iBAAkB,KAC1BA,QAAQ,UAAW,QACnBA,QAAQ,aAAc,SAAUkB,GACrB,QAANA,EACFD,EAAOE,MAEPF,EAAOG,KAAKF,KAElBT,EAAWQ,EAAOI,KAAK,IAAIrB,QAAQ,MAAuB,MAAhBS,EAAS,GAAa,IAAM,IAClEK,IACFN,EAAOK,EAAKL,KACZD,EAAWM,EAAKN,SAChBD,EAAOO,EAAKP,KACZD,EAAWQ,EAAKR,SAChBD,EAAWS,EAAKT,UAEbD,IACHA,EAAWU,EAAKV,UAIpBM,EAAWA,EAAST,QAAQ,MAAO,KAEnCsB,KAAKC,OAASjB,EAAOH,GAAyB,KAAbA,GAA4B,KAATG,EAAc,KAAO,IAAMA,EAAO,GACtFgB,KAAKE,KAAOrB,GAAYA,GAAYG,GAAoB,SAAZH,EAAsB,KAAO,KAAoB,KAAbC,EAAkBA,GAAyB,KAAbC,EAAkB,IAAMA,EAAW,IAAM,IAAM,IAAMC,EAAOG,EAAWC,EAASC,EAC9LW,KAAKnB,SAAWA,EAChBmB,KAAKlB,SAAWA,EAChBkB,KAAKjB,SAAWA,EAChBiB,KAAKhB,KAAOA,EACZgB,KAAKf,SAAWA,EAChBe,KAAKd,KAAOA,EACZc,KAAKb,SAAWA,EAChBa,KAAKZ,OAASA,EACdY,KAAKX,KAAOA,EAEdlB,EAAOC,YAAcA,GACH,mBAAR+B,MAAsBA,KAAOhC,QACvC,SAAUiC,GAqCR,QAASC,GAAWC,EAAKC,GAEvB,IAAKD,EAAIE,YAGP,IAAK,GAFDC,KAAUH,EAAII,SAAWJ,IAAQA,EAAIG,MAAQ,KAAOH,EAAIG,MAAQ,KAAKE,WAAWC,MAAM,MACtFC,KACKC,EAAI,EAAGA,EAAIL,EAAMM,OAAQD,KACL,mBAAhBE,eAAqE,IAAtCP,EAAMK,GAAGG,QAAQD,aAAaE,OACtEL,EAASf,KAAKW,EAAMK,GAI1B,IAAIK,GAAS,eAAiBN,EAAWA,EAASd,KAAK,OAAUO,EAAII,QAAQU,OAAO,KAAO,MAASb,CAG/Fc,KACHF,EAASA,EAAOzC,QAAQ4C,EAAY,eAAiB,aAAc,IAErE,IAAIC,GAASC,EAAU,GAAIC,OAAMN,EAAQb,EAAIoB,SAAUpB,EAAIqB,YAAc,GAAIF,OAAMN,EAOnF,OALAI,GAAOd,MAAQU,EAGfI,EAAOf,YAAcF,EAAIE,aAAeF,EAEjCiB,EAoEX,QAASK,MAOT,QAASC,GAAOC,GACd9B,KAAK+B,SACHC,UAAWhC,KACXiC,SACAC,WACAC,kBACAC,kBAIFC,EAAerC,KAAM,UACnBsC,IAAK,WACH,MAAOlC,MAqvBb,QAASmC,KACPV,EAAOW,KAAKxC,MAEZA,KAAKyC,SACLzC,KAAK+B,QAAQU,SAEbC,EAAoBF,KAAKxC,MAI3B,QAAS2C,MAOT,QAASC,GAAKC,EAAMD,GAClBL,EAAeO,UAAUD,GAAQD,EAAKL,EAAeO,UAAUD,IAAS,cAE1E,QAASE,GAAgBH,GACvBF,EAAsBE,EAAKF,GAAuB,cAKpD,QAASM,GAAWH,GAClB,MAAOA,GAAKlE,MAAMsE,GAEpB,QAASC,GAAML,GACb,MAAmB,KAAXA,EAAK,MAAeA,EAAK,IAAiB,KAAXA,EAAK,IAAwB,KAAXA,EAAK,KAA0B,KAAXA,EAAK,GAEpF,QAASM,GAAQN,GACf,OAAQK,EAAML,KAAUG,EAAWH,GAKrC,QAASO,GAAWP,EAAMQ,GAExB,GAAe,KAAXR,EAAK,IAEP,GAAe,KAAXA,EAAK,IAAwB,KAAXA,EAAK,GACzB,OAAQQ,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,EAAKzB,OAAO,OAEzF,IAAe,KAAXyB,EAAK,IAAkC,IAArBA,EAAK5B,QAAQ,KAEtC,OAAQoC,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,CAGhF,OAAO,IAAIU,GAAIV,EAAMQ,GAAUA,EAAO3E,QAAQ,KAAM,QAAU8E,GAAYtD,KAAKxB,QAAQ,OAAQ,KAIjG,QAAS+E,GAAWC,EAAQb,GAE1B,GAAoBc,GAAhBC,EAAY,GAAcC,EAAuB,EAEjDpB,EAAQiB,EAAOjB,MACfqB,EAAaJ,EAAO3B,QAAQU,KAGhC,KAAK,GAAI7C,KAAK6C,GACZ,IAAIA,EAAMsB,gBAAmBtB,EAAMsB,eAAenE,GAAlD,CAIA,GAAIoE,GAAOvB,EAAM7C,EAKjB,IAJIoE,IAASF,EAAWlE,KACtBoE,EAAOvB,EAAM7C,GAAKkE,EAAWlE,GAAKwD,EAAWX,EAAM7C,GAAIsD,EAAMT,EAAM7C,IAAM0D,EAAUI,EAAOpF,UAGrE,KAAnBsB,EAAEqB,QAAQ,KAAa,CACzB,GAAI4B,GAAQjD,EACV,MAAO6C,GAAM7C,EAGV,IAAIiD,EAAKzB,OAAO,EAAGxB,EAAEmB,OAAS,IAAMnB,EAAEwB,OAAO,EAAGxB,EAAEmB,OAAS,KAAO8B,EAAK9B,OAASnB,EAAEmB,QAAU8B,EAAKjD,EAAEmB,OAAS,IAAMnB,EAAEA,EAAEmB,OAAS,MAAyC,KAAjC0B,EAAM7C,GAAG6C,EAAM7C,GAAGmB,OAAS,IAAyB,IAAZ0B,EAAM7C,IACxL,MAAO6C,GAAM7C,GAAGwB,OAAO,EAAGqB,EAAM7C,GAAGmB,OAAS,IAAM8B,EAAK9B,OAASnB,EAAEmB,QAAU0B,EAAM7C,IAAM,KAAO,IAAMiD,EAAKzB,OAAOxB,EAAEmB,QAAU,QAI5H,CACH,GAAIkD,GAAYrE,EAAEgB,MAAM,IACxB,IAAIqD,EAAUlD,OAAS,EACrB,KAAM,IAAIxC,WAAU,2CAEtB,IAAI2F,GAAoBD,EAAU,GAAGlD,MACjCmD,IAAqBL,GACrBhB,EAAKzB,OAAO,EAAG6C,EAAU,GAAGlD,SAAWkD,EAAU,IACjDpB,EAAKzB,OAAOyB,EAAK9B,OAASkD,EAAU,GAAGlD,SAAWkD,EAAU,KAC1DJ,EAAuBK,EACvBN,EAAYhE,EACZ+D,EAAWd,EAAKzB,OAAO6C,EAAU,GAAGlD,OAAQ8B,EAAK9B,OAASkD,EAAU,GAAGlD,OAASkD,EAAU,GAAGlD,UAKvG,GAAIoD,GAAU1B,EAAMmB,EAIpB,OAHuB,gBAAZD,KACTQ,EAAUA,EAAQzF,QAAQ,IAAKiF,IAE1BQ,EAWT,QAASC,GAAMC,GAGb,IAAK,GAFDC,MACAC,KACKzD,EAAI,EAAG0D,EAAIH,EAAKtD,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3C,GAAI2D,GAAQxD,EAAQuB,KAAK8B,EAAOD,EAAKvD,GACvB,MAAV2D,GACFH,EAAMxE,KAAKuE,EAAKvD,IAChByD,EAAQzE,MAAMgB,KAGdyD,EAAQE,GAAO3E,KAAKgB,GAGxB,OAASwD,MAAOA,EAAOC,QAASA,GAYlC,QAASG,GAAYC,GACnB,GAAIC,KAEJ,KAAuB,gBAAXD,IAAyC,kBAAXA,KAA0BA,IAAYvE,EAC5E,GAAIyE,EACF,IAAK,GAAIjF,KAAK+E,GAEF,YAAN/E,GAEJkF,EAAqBF,EAAUD,EAAS/E,OAI1CmF,GAAOH,EAAUD,EAOvB,OAJAC,GAAS,WAAaD,EACtBtC,EAAeuC,EAAU,gBACvBI,OAAO,IAEFJ,EAGT,QAASE,GAAqBG,EAAWC,EAAWC,GAClD,IACE,GAAIC,IACAA,EAAIC,OAAOR,yBAAyBK,EAAWC,KACjD9C,EAAe4C,EAAWE,EAAUC,GAExC,MAAOE,GAIL,MADAL,GAAUE,GAAYD,EAAUC,IACzB,GAIX,QAASJ,GAAOQ,EAAGC,EAAGC,GACpB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,KACRzB,GAAmByB,EAAEzB,eAAenE,MAEnC6F,GAAa7F,IAAK2F,KACrBA,EAAE3F,GAAK4F,EAAE5F,IAEb,OAAO2F,GAOT,QAASG,GAAWH,EAAGC,EAAGC,GACxB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,GACZ,IAAIzB,GAAmByB,EAAEzB,eAAenE,GAAxC,CAEA,GAAI+F,GAAMH,EAAE5F,EACNA,KAAK2F,GAEFI,YAAeC,QAASL,EAAE3F,YAAcgG,OAC/CL,EAAE3F,MAAQiG,OAAOJ,EAAUE,EAAMJ,EAAE3F,IAAIiG,OAAOJ,EAAUF,EAAE3F,GAAK+F,GAC1C,gBAAPA,IAA2B,OAARA,GAA+B,gBAARJ,GAAE3F,GAC1D2F,EAAE3F,GAAKmF,EAAOA,KAAWQ,EAAE3F,IAAK+F,EAAKF,GAC7BA,IACRF,EAAE3F,GAAK+F,GANPJ,EAAE3F,GAAK+F,GAUb,QAASG,GAAgBC,EAASC,EAASC,EAASvC,EAAQwC,GAC1D,IAAK,GAAIC,KAAQH,GACf,GAA8E,IAA1E/E,EAAQuB,MAAM,OAAQ,SAAU,mBAAoB,YAAa2D,GACnEJ,EAAQI,GAAQH,EAAQG,OAErB,IAAY,OAARA,EACPpB,EAAOgB,EAAQK,IAAML,EAAQK,QAAWJ,EAAQI,SAE7C,IAAY,QAARD,EACPpB,EAAOgB,EAAQM,KAAON,EAAQM,SAAYL,EAAQK,UAE/C,IAAY,YAARF,EACP,IAAK,GAAIf,KAAKY,GAAQM,SAAU,CAC9B,GAAIC,EAGFA,GADoB,MAAlBnB,EAAEhE,OAAO,EAAG,GACA6E,EAAU,IAAMb,EAAEhE,OAAO,GAEzBoF,EAAYhE,KAAKkB,EAAQ0B,GACzC1B,EAAO4C,SAASC,IAAgB7C,EAAO4C,SAASC,QAAoBV,OAAOG,EAAQM,SAASlB,SAGvFc,GAAiH,IAAxFjF,EAAQuB,MAAM,gBAAiB,aAAc,YAAa,oBAAqB2D,IAC3GH,EAAQjC,iBAAkBiC,EAAQjC,eAAeoC,IACrDM,EAAKjE,KAAKkB,EAAQ,IAAMyC,EAAO,4DAA8DF,GAMnG,QAASS,GAAahD,EAAQuC,EAASU,EAAKC,GAC1C,GAAIC,EAGJ,IAAKnD,EAAOoD,SAASb,GAGhB,CACH,GAAIc,GAAUrD,EAAOoD,SAASb,EAC9BY,GAAMnD,EAAOoD,SAASb,MAEtBH,EAAgBe,EAAKD,EAAgBD,EAAMI,EAASd,EAASvC,EAAQkD,GACrEd,EAAgBe,EAAKD,EAAgBG,EAAUJ,EAAKV,EAASvC,GAASkD,OAPtEC,GAAMnD,EAAOoD,SAASb,GAAWU,CAkBnC,OAPuB,gBAAZE,GAAIG,OACbH,EAAIT,IAAMS,EAAIT,QACdS,EAAIT,IAAI,WAAaS,EAAIG,KACzBH,EAAIG,KAAK,WAAaH,EAAIG,KAAK,YAAc,KAC7CH,EAAIG,KAAO,SAGNH,EAGT,QAASJ,GAAKlG,GACRP,KAAKiH,UAA8B,mBAAXC,UAA0BA,QAAQT,MAC5DS,QAAQT,KAAKlG,GAGjB,QAAS4G,GAAmBC,EAAMC,GAChCD,EAAKE,SAASC,MAAQC,IACtBJ,EAAKE,SAASC,MAAME,QAAU,WAC5B,MAAOJ,IAETD,EAAKE,SAASC,MAAMlD,QACpB+C,EAAKE,SAASI,OAAS,UA+HzB,QAASC,GAAqB/H,EAAGoF,GAE/B,IADA,GAAI4C,GAAShI,EAAEgB,MAAM,KACdgH,EAAO7G,QACZiE,EAAQA,EAAM4C,EAAOC,QACvB,OAAO7C,GAGT,QAAS8C,GAAY1B,EAAKvD,GACxB,GAAIkF,GAAWC,EAAkB,CAEjC,KAAK,GAAIpI,KAAKwG,GACZ,GAAIvD,EAAKzB,OAAO,EAAGxB,EAAEmB,SAAWnB,IAAMiD,EAAK9B,QAAUnB,EAAEmB,QAA4B,KAAlB8B,EAAKjD,EAAEmB,SAAiB,CACvF,GAAIkH,GAAiBrI,EAAEgB,MAAM,KAAKG,MAClC,IAAsBiH,GAAlBC,EACF,QACFF,GAAYnI,EACZoI,EAAkBC,EAItB,MAAOF,GAGT,QAASG,GAAexE,GAElB1D,KAAK+B,QAAQzD,UAAY0B,KAAK1B,UACa,KAAzC0B,KAAK1B,QAAQ0B,KAAK1B,QAAQyC,OAAS,KACrCf,KAAK1B,SAAW,KAElB0B,KAAK+B,QAAQzD,QAAU0B,KAAK1B,QAAU,GAAIiF,GAAIvD,KAAK1B,QAASkF,GAAYtD,MAK5E,QAASiI,GAAcC,EAAcC,GACnCrI,KAAKsI,IAAI,cAAeC,GAAYvI,KAAKwI,WACvCC,QAASpH,EACTqH,OAAQ1I,KAAK2I,aACbC,YAAaP,GAAaD,EAC1BS,IAAKR,IAAcD,EACnBU,MAAOT,EACPU,WAAW,KAuDf,QAASC,GAAcnG,EAAMvE,GAC3B,IAAK6E,EAAQN,GACX,KAAM,IAAIpB,OAAM,eAAiBoB,EAAO,mDAE1C,KAAKoG,GAAqB,CACxB,GAAIrH,GAAS5B,KAAK2I,aAAa,UAC3BpJ,EAAOjB,EAAQ8C,OAAOE,EAAY,EAAI,EAC1C2H,IAAsB,GAAIrH,GAAOrC,GACjC0J,GAAoBxG,MAAQb,EAAOsH,iBAAiB3J,GAEtD,MAAO0J,IAAoBE,QAAQtG,GAGrC,QAAS2D,GAAY3D,EAAMuG,GAEzB,GAAIlG,EAAML,GACR,MAAOO,GAAWP,EAAMuG,EACrB,IAAIpG,EAAWH,GAClB,MAAOA,EAGT,IAAIwG,GAAWvB,EAAY9H,KAAKoG,IAAKvD,EAErC,IAAIwG,EAAU,CAGZ,GAFAxG,EAAO7C,KAAKoG,IAAIiD,GAAYxG,EAAKzB,OAAOiI,EAAStI,QAE7CmC,EAAML,GACR,MAAOO,GAAWP,EACf,IAAIG,EAAWH,GAClB,MAAOA,GAGX,GAAI7C,KAAKsJ,IAAIzG,GACX,MAAOA,EAGT,IAAyB,UAArBA,EAAKzB,OAAO,EAAG,GAAgB,CACjC,IAAKpB,KAAK2I,aACR,KAAM,IAAIpK,WAAU,iBAAmBsE,EAAO,6CAKhD,OAJI7C,MAAKuJ,QACPvJ,KAAKsI,IAAIzF,EAAM7C,KAAKwI,eAEpBxI,KAAKsI,IAAIzF,EAAM7C,KAAKwI,UAAU9D,EAAYsE,EAAcxG,KAAKxC,KAAM6C,EAAKzB,OAAO,GAAIpB,KAAK1B,YACnFuE,EAMT,MAFAqF,GAAe1F,KAAKxC,MAEbyD,EAAWzD,KAAM6C,IAAS7C,KAAK1B,QAAUuE,EAgJlD,QAAS2G,GAAO9F,EAAQiD,EAAK8C,GACvBlB,GAAUE,SAAW9B,EAAI+C,eAC3BD,EAAY9C,EAAI+C,eACdnB,GAAUG,MAAQ/B,EAAIgD,YACxBF,EAAY9C,EAAIgD,YACdpB,GAAUM,KAAOlC,EAAIiD,WACvBH,EAAY9C,EAAIiD,WACdrB,GAAUO,OAASnC,EAAIkD,aACzBJ,EAAY9C,EAAIkD,aACdtB,GAAUK,YAAcjC,EAAImD,kBAC9BL,EAAY9C,EAAImD,kBAshCpB,QAASC,GAAqBC,GAC5B,GAAIC,GAAwBD,EAAOrL,MAAMuL,GACzC,OAAOD,IAA+E,mBAAtDD,EAAO5I,OAAO6I,EAAsB,GAAGlJ,OAAQ,IAGjF,QAASyG,KACP,OACE3E,KAAM,KACNwB,KAAM,KACN8F,gBAAiB,KACjBC,QAAS,KACT3C,QAAS,KACT4C,kBAAkB,EAClBC,aAAa,EACbC,eAAgB,KAChBC,WAAY,KACZC,WAAW,EACXC,OAAQ,KACR9F,SAAU,KACV+F,YAAY,GAkjBhB,QAASC,GAAejG,GACtB,GAAsB,gBAAXA,GACT,MAAOgD,GAAqBhD,EAASvE,EAEvC,MAAMuE,YAAmBiB,QACvB,KAAM,IAAInE,OAAM,4CAIlB,KAAK,GAFDoJ,MACAC,GAAQ,EACHhK,EAAI,EAAGA,EAAI6D,EAAQ5D,OAAQD,IAAK,CACvC,GAAI6E,GAAMgC,EAAqBhD,EAAQ7D,GAAIV,EACvC0K,KACFD,EAAY,WAAalF,EACzBmF,GAAQ,GAEVD,EAAYlG,EAAQ7D,GAAGF,MAAM,KAAKf,OAAS8F,EAE7C,MAAOkF,GAgtBP,QAASE,GAAeC,GACtB,GAAIC,GAAiBC,EAAiBC,EAElCA,EAA2B,KAAhBH,EAAU,GACrBI,EAAuBJ,EAAUtL,YAAY,IAsBjD,OArB4B,IAAxB0L,GACFH,EAAkBD,EAAU5J,OAAOgK,EAAuB,GAC1DF,EAAkBF,EAAU5J,OAAO+J,EAAUC,EAAuBD,GAEhEA,GACF1E,EAAKjE,KAAKxC,KAAM,4BAA8BgL,EAAY,wBAA0BE,EAAkB,KAAOD,EAAkB,KAEvG,KAAtBA,EAAgB,KAClBE,GAAW,EACXF,EAAkBA,EAAgB7J,OAAO,MAI3C6J,EAAkB,UAClBC,EAAkBF,EAAU5J,OAAO+J,GACW,IAA1CE,GAAcpK,QAAQiK,KACxBD,EAAkBC,EAClBA,EAAkB,QAKpBR,OAAQQ,GAAmB,cAC3B/E,KAAM8E,EACNK,OAAQH,GAIZ,QAASI,GAAmBC,GAC1B,MAAOA,GAAad,OAAS,KAAOc,EAAaF,OAAS,IAAM,IAAME,EAAarF,KAGrF,QAASsF,GAAiBD,EAAcpC,EAAYsC,GAClD,GAAIvL,GAAOH,IACX,OAAOA,MAAK2L,UAAUH,EAAad,OAAQtB,GAC1CwC,KAAK,SAASC,GACb,MAAO1L,GAAKiH,KAAKyE,GAChBD,KAAK,SAASE,GACb,GAAItN,GAAImJ,EAAqB6D,EAAarF,KAAMhG,EAAKmC,IAAIuJ,GAEzD,IAAIH,GAAoB,iBAALlN,GACjB,KAAM,IAAID,WAAU,aAAegN,EAAmBC,GAAgB,iCAExE,OAAOA,GAAaF,QAAU9M,EAAIA,MAMxC,QAASuN,GAAuBlJ,EAAMuG,GAEpC,GAAI4C,GAAmBnJ,EAAKlE,MAAMsN,GAElC,KAAKD,EACH,MAAOE,SAAQC,QAAQtJ,EAEzB,IAAI2I,GAAeT,EAAevI,KAAKxC,KAAMgM,EAAiB,GAAG5K,OAAO,EAAG4K,EAAiB,GAAGjL,OAAS,GAGxG,OAAIf,MAAKuJ,QACAvJ,KAAgB,UAAEwL,EAAad,OAAQtB,GAC7CwC,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACfrI,EAAKnE,QAAQuN,GAAoB,KAAOV,EAAmBC,GAAgB,OAG/EC,EAAiBjJ,KAAKxC,KAAMwL,EAAcpC,GAAY,GAC5DwC,KAAK,SAASQ,GACb,GAA8B,gBAAnBA,GACT,KAAM,IAAI7N,WAAU,2BAA6BsE,EAAO,gCAE1D,IAAmC,IAA/BuJ,EAAenL,QAAQ,KACzB,KAAM,IAAI1C,WAAU,sCAAwCsE,GAAQuG,EAAa,OAASA,EAAa,IAAM,0BAA6BgD,EAAiB,mCAE7J,OAAOvJ,GAAKnE,QAAQuN,GAAoBG,KAI5C,QAASC,GAAmBxJ,EAAMuG,GAEhC,GAAIkD,GAAezJ,EAAKnD,YAAY,KAEpC,IAAoB,IAAhB4M,EACF,MAAOJ,SAAQC,QAAQtJ,EAEzB,IAAI2I,GAAeT,EAAevI,KAAKxC,KAAM6C,EAAKzB,OAAOkL,EAAe,GAGxE,OAAItM,MAAKuJ,QACAvJ,KAAgB,UAAEwL,EAAad,OAAQtB,GAC7CwC,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACfrI,EAAKzB,OAAO,EAAGkL,GAAgB,KAAOf,EAAmBC,KAG7DC,EAAiBjJ,KAAKxC,KAAMwL,EAAcpC,GAAY,GAC5DwC,KAAK,SAASQ,GACb,MAAOA,GAAiBvJ,EAAKzB,OAAO,EAAGkL,GAAgB,WAr+H3D,GAAIC,GAA4B,mBAAVC,SAAwC,mBAARrM,OAA+C,mBAAjBsM,eAChFpL,EAA6B,mBAAVmL,SAA4C,mBAAZE,UACnDpL,EAA8B,mBAAXqL,UAAqD,mBAApBA,SAAQC,YAA6BD,QAAQC,SAASjO,MAAM,OAE/GyB,GAAS8G,UACZ9G,EAAS8G,SAAY2F,OAAQ,cAG/B,IASIxK,GATApB,EAAU2E,MAAM9C,UAAU7B,SAAW,SAAS6L,GAChD,IAAK,GAAIhM,GAAI,EAAGiM,EAAU/M,KAAKe,OAAYgM,EAAJjM,EAAaA,IAClD,GAAId,KAAKc,KAAOgM,EACd,MAAOhM,EAGX,OAAO,KAIT,WACE,IACQuE,OAAOhD,kBAAmB,UAC9BA,EAAiBgD,OAAOhD,gBAE5B,MAAO2K,GACL3K,EAAiB,SAAS4K,EAAK9G,EAAM+G,GACnC,IACED,EAAI9G,GAAQ+G,EAAIlI,OAASkI,EAAI5K,IAAIE,KAAKyK,GAExC,MAAMD,SAKZ,IAsCI1J,GAtCA9B,EAAwC,KAA9B,GAAIC,OAAM,EAAG,KAAKC,QAyChC,IAAuB,mBAAZgL,WAA2BA,SAASS,sBAG7C,GAFA7J,EAAUoJ,SAASpJ,SAEdA,EAAS,CACZ,GAAI8J,GAAQV,SAASS,qBAAqB,OAC1C7J,GAAU8J,EAAM,IAAMA,EAAM,GAAGlN,MAAQsM,OAAOa,SAASnN,UAG/B,mBAAZmN,YACd/J,EAAUlD,EAASiN,SAASnN,KAI9B,IAAIoD,EACFA,EAAUA,EAAQ1C,MAAM,KAAK,GAAGA,MAAM,KAAK,GAC3C0C,EAAUA,EAAQlC,OAAO,EAAGkC,EAAQ5D,YAAY,KAAO,OAEpD,CAAA,GAAsB,mBAAXiN,WAA0BA,QAAQW,IAMhD,KAAM,IAAI/O,WAAU,yBALpB+E,GAAU,WAAahC,EAAY,IAAM,IAAMqL,QAAQW,MAAQ,IAC3DhM,IACFgC,EAAUA,EAAQ5E,QAAQ,MAAO,MAMrC,IACE,GAAI6O,GAAqD,SAAzC,GAAInN,GAASmD,IAAI,YAAY1E,SAE/C,MAAMmO,IAEN,GAAIzJ,GAAMgK,EAAYnN,EAASmD,IAAMnD,EAAShC,WAwBhDiE,GAAeT,EAAOkB,UAAW,YAC/BkC,MAAO,WACL,MAAO,YAsBX,WAsGE,QAASwI,GAAW3K,GAClB,OACE4K,OAAQ,UACR5K,KAAMA,GAAQ,gBAAiB6K,EAAU,IACzCC,YACAC,gBACAtG,aASJ,QAASuG,GAAWnK,EAAQb,EAAMf,GAChC,MAAO,IAAIoK,SAAQ4B,GACjBC,KAAMjM,EAAQkM,QAAU,QAAU,SAClCtK,OAAQA,EACRuK,WAAYpL,EAEZqL,eAAgBpM,GAAWA,EAAQwF,aACnC6G,aAAcrM,EAAQkI,OACtBoE,cAAetM,EAAQkM,WAK3B,QAASK,GAAY3K,EAAQ4K,EAASC,EAAaC,GAEjD,MAAO,IAAItC,SAAQ,SAASC,EAASsC,GACnCtC,EAAQzI,EAAO1B,UAAU2J,UAAU2C,EAASC,EAAaC,MAG1D5C,KAAK,SAAS/I,GACb,GAAIuE,EACJ,IAAI1D,EAAOxB,QAAQW,GAKjB,MAJAuE,GAAOoG,EAAW3K,GAClBuE,EAAKqG,OAAS,SAEdrG,EAAKsD,OAAShH,EAAOxB,QAAQW,GACtBuE,CAGT,KAAK,GAAItG,GAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAYyD,EAAJ1D,EAAOA,IAE9C,GADAsG,EAAO1D,EAAOzB,MAAMnB,GAChBsG,EAAKvE,MAAQA,EAEjB,MAAOuE,EAQT,OALAA,GAAOoG,EAAW3K,GAClBa,EAAOzB,MAAMnC,KAAKsH,GAElBsH,EAAgBhL,EAAQ0D,GAEjBA,IAKX,QAASsH,GAAgBhL,EAAQ0D,GAC/BuH,EAAejL,EAAQ0D,EACrB8E,QAAQC,UAEPP,KAAK,WACJ,MAAOlI,GAAO1B,UAAU4M,QAAS/L,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,cAMvE,QAASqH,GAAejL,EAAQ0D,EAAMxH,GACpCiP,EAAmBnL,EAAQ0D,EACzBxH,EAECgM,KAAK,SAASoC,GAEb,MAAmB,WAAf5G,EAAKqG,QAETrG,EAAK4G,QAAUA,EAERtK,EAAO1B,UAAU8M,OAAQjM,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,SAAU0G,QAASA,KAJnF,UAUN,QAASa,GAAmBnL,EAAQ0D,EAAMxH,GACxCA,EAECgM,KAAK,SAAS5B,GACb,MAAmB,WAAf5C,EAAKqG,QAGTrG,EAAK4G,QAAU5G,EAAK4G,SAAW5G,EAAKvE,KAE7BqJ,QAAQC,QAAQzI,EAAO1B,UAAU+M,WAAYlM,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,SAAU0G,QAAS5G,EAAK4G,QAAShE,OAAQA,KAG5H4B,KAAK,SAAS5B,GAEb,MADA5C,GAAK4C,OAASA,EACPtG,EAAO1B,UAAUgN,aAAcnM,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,SAAU0G,QAAS5G,EAAK4G,QAAShE,OAAQA,MAIhH4B,KAAK,SAASqD,GACb,GAA0B3P,SAAtB2P,EACF,KAAM,IAAI1Q,WAAU,mDAEtB,IAAgC,gBAArB0Q,GACT,KAAM,IAAI1Q,WAAU,mCAEtB6I,GAAK8H,SAAWD,EAAkB5K,SAClC+C,EAAKK,QAAUwH,EAAkBxH,UAGlCmE,KAAK,WACJxE,EAAKwG,eAIL,KAAK,GAHDsB,GAAW9H,EAAK8H,SAEhBC,KACKrO,EAAI,EAAG0D,EAAI0K,EAASnO,OAAYyD,EAAJ1D,EAAOA,KAAK,SAAUwN,EAAS7J,GAClE0K,EAAarP,KACXuO,EAAY3K,EAAQ4K,EAASlH,EAAKvE,KAAMuE,EAAK4G,SAG5CpC,KAAK,SAASwD,GASb,GALAhI,EAAKwG,aAAanJ,IAChB4K,IAAKf,EACLtJ,MAAOoK,EAAQvM,MAGK,UAAlBuM,EAAQ3B,OAEV,IAAK,GADDE,GAAWvG,EAAKuG,SAAS9H,WACpB/E,EAAI,EAAG0D,EAAImJ,EAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC1CwO,EAAiB3B,EAAS7M,GAAIsO,QAOrCF,EAASpO,GAAIA,EAEhB,OAAOoL,SAAQqD,IAAIJ,KAIpBvD,KAAK,WAIJxE,EAAKqG,OAAS,QAGd,KAAK,GADDE,GAAWvG,EAAKuG,SAAS9H,WACpB/E,EAAI,EAAG0D,EAAImJ,EAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC1C0O,EAAoB7B,EAAS7M,GAAIsG,MApErC,SAwED,SAAS,SAASqI,GACjBrI,EAAKqG,OAAS,SACdrG,EAAKsI,UAAYD,CAGjB,KAAK,GADD9B,GAAWvG,EAAKuG,SAAS9H,WACpB/E,EAAI,EAAG0D,EAAImJ,EAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC1C6O,EAAchC,EAAS7M,GAAIsG,EAAMqI,KAQvC,QAAS3B,GAA6B8B,GACpC,MAAO,UAASzD,EAASsC,GACvB,GAAI/K,GAASkM,EAAUlM,OACnBb,EAAO+M,EAAU3B,WACjBF,EAAO6B,EAAU7B,IAErB,IAAIrK,EAAOxB,QAAQW,GACjB,KAAM,IAAItE,WAAU,IAAMsE,EAAO,uCAInC,KAAK,GADDgN,GACK/O,EAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAYyD,EAAJ1D,EAAOA,IAC9C,GAAI4C,EAAOzB,MAAMnB,GAAG+B,MAAQA,IAC1BgN,EAAenM,EAAOzB,MAAMnB,GAEhB,aAARiN,GAAwB8B,EAAa7F,SACvC6F,EAAa7B,QAAU4B,EAAUxB,cACjCS,EAAmBnL,EAAQmM,EAAc3D,QAAQC,QAAQyD,EAAUzB,gBAKjE0B,EAAalC,SAAS5M,QAAU8O,EAAalC,SAAS,GAAG1L,MAAM,GAAGY,MAAQgN,EAAahN,MACzF,MAAOgN,GAAalC,SAAS,GAAGmC,KAAKlE,KAAK,WACxCO,EAAQ0D,IAKhB,IAAIzI,GAAOyI,GAAgBrC,EAAW3K,EAEtCuE,GAAKE,SAAWsI,EAAU1B,cAE1B,IAAI6B,GAAUC,EAActM,EAAQ0D,EAEpC1D,GAAOzB,MAAMnC,KAAKsH,GAElB+E,EAAQ4D,EAAQD,MAEJ,UAAR/B,EACFW,EAAgBhL,EAAQ0D,GAET,SAAR2G,EACPY,EAAejL,EAAQ0D,EAAM8E,QAAQC,QAAQyD,EAAUxB,iBAGvDhH,EAAK4G,QAAU4B,EAAUxB,cACzBS,EAAmBnL,EAAQ0D,EAAM8E,QAAQC,QAAQyD,EAAUzB,iBAWjE,QAAS6B,GAActM,EAAQuM,GAC7B,GAAIF,IACFrM,OAAQA,EACRzB,SACAgO,aAAcA,EACdC,aAAc,EAOhB,OALAH,GAAQD,KAAO,GAAI5D,SAAQ,SAASC,EAASsC,GAC3CsB,EAAQ5D,QAAUA,EAClB4D,EAAQtB,OAASA,IAEnBa,EAAiBS,EAASE,GACnBF,EAGT,QAAST,GAAiBS,EAAS3I,GACjC,GAAmB,UAAfA,EAAKqG,OAAT,CAGA,IAAK,GAAI3M,GAAI,EAAG0D,EAAIuL,EAAQ9N,MAAMlB,OAAYyD,EAAJ1D,EAAOA,IAC/C,GAAIiP,EAAQ9N,MAAMnB,IAAMsG,EACtB,MAEJ2I,GAAQ9N,MAAMnC,KAAKsH,GACnBA,EAAKuG,SAAS7N,KAAKiQ,GAGA,UAAf3I,EAAKqG,QACPsC,EAAQG,cAKV,KAAK,GAFDxM,GAASqM,EAAQrM,OAEZ5C,EAAI,EAAG0D,EAAI4C,EAAKwG,aAAa7M,OAAYyD,EAAJ1D,EAAOA,IACnD,GAAKsG,EAAKwG,aAAa9M,GAAvB,CAGA,GAAI+B,GAAOuE,EAAKwG,aAAa9M,GAAGkE,KAEhC,KAAItB,EAAOxB,QAAQW,GAGnB,IAAK,GAAIsN,GAAI,EAAG/K,EAAI1B,EAAOzB,MAAMlB,OAAYqE,EAAJ+K,EAAOA,IAC9C,GAAIzM,EAAOzB,MAAMkO,GAAGtN,MAAQA,EAA5B,CAGAyM,EAAiBS,EAASrM,EAAOzB,MAAMkO,GACvC,UASN,QAASC,GAAOL,GACd,GAAIM,IAAQ,CACZ,KACEC,EAAKP,EAAS,SAAS3I,EAAMqI,GAC3BE,EAAcI,EAAS3I,EAAMqI,GAC7BY,GAAQ,IAGZ,MAAMrD,GACJ2C,EAAcI,EAAS,KAAM/C,GAC7BqD,GAAQ,EAEV,MAAOA,GAIT,QAASb,GAAoBO,EAAS3I,GAKpC,GAFA2I,EAAQG,iBAEJH,EAAQG,aAAe,GAA3B,CAIA,GAAID,GAAeF,EAAQE,YAK3B,IAAIF,EAAQrM,OAAO1B,UAAUyF,WAAY,EAAO,CAE9C,IAAK,GADDxF,MAAW4D,OAAOkK,EAAQ9N,OACrBnB,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC5C,GAAIsG,GAAOnF,EAAMnB,EACjBsG,GAAKsD,QACH7H,KAAMuE,EAAKvE,KACX6H,OAAQ6F,MACR9F,WAAW,GAEbrD,EAAKqG,OAAS,SACd+C,EAAWT,EAAQrM,OAAQ0D,GAE7B,MAAO2I,GAAQ5D,QAAQ8D,GAIzB,GAAIQ,GAASL,EAAOL,EAEhBU,IAGJV,EAAQ5D,QAAQ8D,IAIlB,QAASN,GAAcI,EAAS3I,EAAMqI,GACpC,GAAI/L,GAASqM,EAAQrM,MAGrBgN,GACA,GAAItJ,EACF,GAAI2I,EAAQ9N,MAAM,GAAGY,MAAQuE,EAAKvE,KAChC4M,EAAMpP,EAAWoP,EAAK,iBAAmBrI,EAAKvE,UAE3C,CACH,IAAK,GAAI/B,GAAI,EAAGA,EAAIiP,EAAQ9N,MAAMlB,OAAQD,IAExC,IAAK,GADD6P,GAAQZ,EAAQ9N,MAAMnB,GACjBqP,EAAI,EAAGA,EAAIQ,EAAM/C,aAAa7M,OAAQoP,IAAK,CAClD,GAAIS,GAAMD,EAAM/C,aAAauC,EAC7B,IAAIS,EAAI5L,OAASoC,EAAKvE,KAAM,CAC1B4M,EAAMpP,EAAWoP,EAAK,iBAAmBrI,EAAKvE,KAAO,QAAU+N,EAAIvB,IAAM,UAAYsB,EAAM9N,KAC3F,MAAM6N,IAIZjB,EAAMpP,EAAWoP,EAAK,iBAAmBrI,EAAKvE,KAAO,SAAWkN,EAAQ9N,MAAM,GAAGY,UAInF4M,GAAMpP,EAAWoP,EAAK,iBAAmBM,EAAQ9N,MAAM,GAAGY,KAK5D,KAAK,GADDZ,GAAQ8N,EAAQ9N,MAAM4D,WACjB/E,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC5C,GAAIsG,GAAOnF,EAAMnB,EAGjB4C,GAAO1B,UAAU6O,OAASnN,EAAO1B,UAAU6O,WACQ,IAA/C5P,EAAQuB,KAAKkB,EAAO1B,UAAU6O,OAAQzJ,IACxC1D,EAAO1B,UAAU6O,OAAO/Q,KAAKsH,EAE/B,IAAI0J,GAAY7P,EAAQuB,KAAK4E,EAAKuG,SAAUoC,EAE5C,IADA3I,EAAKuG,SAASoD,OAAOD,EAAW,GACJ,GAAxB1J,EAAKuG,SAAS5M,OAAa,CAC7B,GAAIiQ,GAAmB/P,EAAQuB,KAAKuN,EAAQrM,OAAOzB,MAAOmF,EAClC,KAApB4J,GACFjB,EAAQrM,OAAOzB,MAAM8O,OAAOC,EAAkB,IAGpDjB,EAAQtB,OAAOgB,GAIjB,QAASe,GAAW9M,EAAQ0D,GAE1B,GAAI1D,EAAO1B,UAAUiP,MAAO,CACrBvN,EAAO1B,UAAUC,QACpByB,EAAO1B,UAAUC,SACnB,IAAIiP,KACJ9J,GAAKwG,aAAauD,QAAQ,SAASP,GACjCM,EAAON,EAAIvB,KAAOuB,EAAI5L,QAExBtB,EAAO1B,UAAUC,MAAMmF,EAAKvE,OAC1BA,KAAMuE,EAAKvE,KACXwB,KAAM+C,EAAKwG,aAAaxH,IAAI,SAASwK,GAAM,MAAOA,GAAIvB,MACtD6B,OAAQA,EACRlD,QAAS5G,EAAK4G,QACd1G,SAAUF,EAAKE,SACf0C,OAAQ5C,EAAK4C,QAIb5C,EAAKvE,OACPa,EAAOxB,QAAQkF,EAAKvE,MAAQuE,EAAKsD,OAEnC,IAAI0G,GAAYnQ,EAAQuB,KAAKkB,EAAOzB,MAAOmF,EAC1B,KAAbgK,GACF1N,EAAOzB,MAAM8O,OAAOK,EAAW,EACjC,KAAK,GAAItQ,GAAI,EAAG0D,EAAI4C,EAAKuG,SAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC/CsQ,EAAYnQ,EAAQuB,KAAK4E,EAAKuG,SAAS7M,GAAGmB,MAAOmF,GAChC,IAAbgK,GACFhK,EAAKuG,SAAS7M,GAAGmB,MAAM8O,OAAOK,EAAW,EAE7ChK,GAAKuG,SAASoD,OAAO,EAAG3J,EAAKuG,SAAS5M,QAGxC,QAASsQ,GAAiBtB,EAAS3I,EAAMkK,GACvC,IACE,GAAI5G,GAAStD,EAAKK,UAEpB,MAAMuF,GAEJ,WADAsE,GAAUlK,EAAM4F,GAGlB,MAAKtC,IAAYA,YAAkB9I,GAG1B8I,MAFP4G,GAAUlK,EAAM,GAAI7I,WAAU,4CAWlC,QAASgT,GAAoB7N,EAAQb,EAAM2O,GACzC,GAAIrP,GAAiBuB,EAAO3B,QAAQI,cACpC,OAAOA,GAAeU,GAAQ2O,EAAQ5F,KAAK,SAASpN,GAElD,MADA2D,GAAeU,GAAQvD,OAChBd,GACN,SAASwO,GAEV,KADA7K,GAAeU,GAAQvD,OACjB0N,IAmKV,QAASsD,GAAKP,EAASuB,GAErB,GAAI5N,GAASqM,EAAQrM,MAErB,IAAKqM,EAAQ9N,MAAMlB,OAKnB,IAAK,GAFDkB,GAAQ8N,EAAQ9N,MAAM4D,WAEjB/E,EAAI,EAAGA,EAAImB,EAAMlB,OAAQD,IAAK,CACrC,GAAIsG,GAAOnF,EAAMnB,GAEb4J,EAAS2G,EAAiBtB,EAAS3I,EAAMkK,EAC7C,KAAK5G,EACH,MACFtD,GAAKsD,QACH7H,KAAMuE,EAAKvE,KACX6H,OAAQA,GAEVtD,EAAKqG,OAAS,SAEd+C,EAAW9M,EAAQ0D,IAnoBvB,GAAIsG,GAAU,CA+cd7L,GAAOiB,WAEL2O,YAAa5P,EAEb6P,OAAQ,SAAS7O,EAAMmH,EAAQlI,GAE7B,GAAI9B,KAAK+B,QAAQI,eAAeU,GAC9B,KAAM,IAAItE,WAAU,6BACtB,OAAOgT,GAAoBvR,KAAM6C,EAAM,GAAIqJ,SAAQ4B,GACjDC,KAAM,YACNrK,OAAQ1D,KAAK+B,QACbkM,WAAYpL,EACZqL,eAAgBpM,GAAWA,EAAQwF,aACnC6G,aAAcnE,EACdoE,cAAetM,GAAWA,EAAQkM,aAItC2D,SAAU,SAAS9O,GACjB,GAAIa,GAAS1D,KAAK+B,OAGlB,cAFO2B,GAAOvB,eAAeU,SACtBa,GAAOtB,cAAcS,GACrBa,EAAOxB,QAAQW,SAAea,GAAOxB,QAAQW,IAAQ,GAI9DP,IAAK,SAAS+M,GACZ,MAAKrP,MAAK+B,QAAQG,QAAQmN,GAEnBrP,KAAK+B,QAAQG,QAAQmN,GAAK3E,OAFjC,QAKFpB,IAAK,SAASzG,GACZ,QAAS7C,KAAK+B,QAAQG,QAAQW,IAGhC+O,SAAU,SAAS/O,EAAMuG,EAAYyI,GACV,gBAAdzI,KACTA,EAAaA,EAAWvG,KAG1B,IAAIb,GAAYhC,IAGhB,OAAOkM,SAAQC,QAAQnK,EAAU2J,UAAU9I,EAAMuG,IAChDwC,KAAK,SAAS/I,GACb,GAAIa,GAAS1B,EAAUD,OAEvB,OAAI2B,GAAOxB,QAAQW,GACVa,EAAOxB,QAAQW,GAAM6H,OAEvBhH,EAAOvB,eAAeU,IAAS0O,EAAoBvP,EAAWa,EACnEgL,EAAWnK,EAAQb,MAClB+I,KAAK,SAASxE,GAEb,aADO1D,GAAOvB,eAAeU,GACtBuE,EAAKsD,OAAOA,aAM3BtD,KAAM,SAASvE,GACb,GAAIa,GAAS1D,KAAK+B,OAClB,OAAI2B,GAAOxB,QAAQW,GACVqJ,QAAQC,WACTzI,EAAOvB,eAAeU,IAAS0O,EAAoBvR,KAAM6C,EAAM,GAAIqJ,SAAQ4B,GACjFC,KAAM,SACNrK,OAAQA,EACRuK,WAAYpL,EACZqL,kBACAC,aAAc7O,OACd8O,cAAe9O,UAEhBsM,KAAK,SAASxE,GAEb,aADO1D,GAAOvB,eAAeU,GACtBuE,EAAKsD,OAAOA,WAEpBkB,KAAK,eAGRlB,OAAQ,SAASV,EAAQlI,GACvB,GAAIsF,GAAOoG,GACXpG,GAAK4G,QAAUlM,GAAWA,EAAQkM,OAClC,IAAI+B,GAAUC,EAAchQ,KAAK+B,QAASqF,GACtC0K,EAAgB5F,QAAQC,QAAQnC,GAChCtG,EAAS1D,KAAK+B,QACdnC,EAAImQ,EAAQD,KAAKlE,KAAK,WACxB,MAAOxE,GAAKsD,OAAOA,QAGrB,OADAmE,GAAmBnL,EAAQ0D,EAAM0K,GAC1BlS,GAGT4I,UAAW,SAAUyE,GACnB,GAAkB,gBAAPA,GACT,KAAM,IAAI1O,WAAU,kBAEtB,IAAIC,GAAI,GAAIoD,GAERmQ,IACJ,IAAI1M,OAAO2M,qBAA8B,MAAP/E,EAChC8E,EAAS1M,OAAO2M,oBAAoB/E,OAEpC,KAAK,GAAIoC,KAAOpC,GACd8E,EAAOjS,KAAKuP,EAEhB,KAAK,GAAIvO,GAAI,EAAGA,EAAIiR,EAAOhR,OAAQD,KAAK,SAAUuO,GAChDhN,EAAe7D,EAAG6Q,GAChB4C,cAAc,EACdC,YAAY,EACZ5P,IAAK,WACH,MAAO2K,GAAIoC,IAEb/G,IAAK,WACH,KAAM,IAAI7G,OAAM,qDAGnBsQ,EAAOjR,GAKV,OAHIuE,QAAO8M,QACT9M,OAAO8M,OAAO3T,GAETA,GAGT8J,IAAK,SAASzF,EAAM6H,GAClB,KAAMA,YAAkB9I,IACtB,KAAM,IAAIrD,WAAU,cAAgBsE,EAAO,6BAC7C7C,MAAK+B,QAAQG,QAAQW,IACnB6H,OAAQA,IAQZiB,UAAW,SAAS9I,EAAMuP,EAAcC,KAExCzD,OAAQ,SAASxH,GACf,MAAOA,GAAKvE,MAGdiM,MAAO,SAAS1H,KAGhB2H,UAAW,SAAS3H,GAClB,MAAOA,GAAK4C,QAGdgF,YAAa,SAAS5H,KAIxB,IAAImJ,GAAa1O,EAAOiB,UAAU0F,YAgCpC,IAAI8J,EAaJ3P,GAAYG,UAAYjB,EAAOiB,UAC/BP,EAAeO,UAAY,GAAIH,GAC/BJ,EAAeO,UAAU2O,YAAclP,CAEvC,IAAIG,GAUAO,EAAc,eAWdO,EAAa,GAAID,GAAID,GA6FrBuB,GAA2B,CAC/B,KACEQ,OAAOR,0BAA2BU,EAAG,GAAK,KAE5C,MAAMyH,GACJnI,GAA2B,EA8I3B,GAAI0N,EACJ,IAA6B,mBAAlBC,gBACTD,EAAmB,SAASlU,EAAKoU,EAAeC,EAASjE,GAsBvD,QAASrH,KACPsL,EAAQC,EAAIC,cAEd,QAASvC,KACP5B,EAAO,GAAIhN,OAAM,aAAekR,EAAIlF,OAAS,KAAOkF,EAAIlF,QAAUkF,EAAIE,WAAa,IAAMF,EAAIE,WAAc,IAAM,IAAM,IAAM,YAAcxU,IAzB7I,GAAIsU,GAAM,GAAIH,gBACVM,GAAa,EACbC,GAAY,CAChB,MAAM,mBAAqBJ,IAAM,CAE/B,GAAIK,GAAc,uBAAuBC,KAAK5U,EAC1C2U,KACFF,EAAaE,EAAY,KAAOxG,OAAOa,SAASrO,KAC5CgU,EAAY,KACdF,GAAcE,EAAY,KAAOxG,OAAOa,SAASxO,WAGlDiU,GAAuC,mBAAlBI,kBACxBP,EAAM,GAAIO,gBACVP,EAAIQ,OAAS/L,EACbuL,EAAIS,QAAU/C,EACdsC,EAAIU,UAAYhD,EAChBsC,EAAIW,WAAa,aACjBX,EAAIY,QAAU,EACdR,GAAY,GASdJ,EAAIa,mBAAqB,WACA,IAAnBb,EAAIc,aAEY,GAAdd,EAAIlF,OACFkF,EAAIC,aACNxL,KAKAuL,EAAIe,iBAAiB,QAASrD,GAC9BsC,EAAIe,iBAAiB,OAAQtM,IAGT,MAAfuL,EAAIlF,OACXrG,IAGAiJ,MAINsC,EAAIgB,KAAK,MAAOtV,GAAK,GAEjBsU,EAAIiB,mBACNjB,EAAIiB,iBAAiB,SAAU,gCAE3BnB,IAC0B,gBAAjBA,IACTE,EAAIiB,iBAAiB,gBAAiBnB,GACxCE,EAAIkB,iBAAkB,IAItBd,EACFe,WAAW,WACTnB,EAAIoB,QACH,GAEHpB,EAAIoB,KAAK,WAIV,IAAsB,mBAAX5K,UAA4C,mBAAXwD,SAAwB,CACvE,GAAIqH,GACJzB,GAAmB,SAASlU,EAAKoU,EAAeC,EAASjE,GACvD,GAAwB,YAApBpQ,EAAI+C,OAAO,EAAG,GAChB,KAAM,IAAIK,OAAM,oBAAsBpD,EAAM,kEAM9C,OALA2V,IAAKA,IAAM7K,QAAQ,MAEjB9K,EADEiD,EACIjD,EAAIK,QAAQ,MAAO,MAAM0C,OAAO,GAEhC/C,EAAI+C,OAAO,GACZ4S,GAAGC,SAAS5V,EAAK,SAASiC,EAAK4T,GACpC,GAAI5T,EACF,MAAOmO,GAAOnO,EAId,IAAI6T,GAAaD,EAAO,EACF,YAAlBC,EAAW,KACbA,EAAaA,EAAW/S,OAAO,IAEjCsR,EAAQyB,UAKX,CAAA,GAAmB,mBAARhU,OAA4C,mBAAdA,MAAK2O,MAwBjD,KAAM,IAAIvQ,WAAU,sCAvBpBgU,GAAmB,SAASlU,EAAKoU,EAAeC,EAASjE,GACvD,GAAI2F,IACFC,SAAUC,OAAU,gCAGlB7B,KAC0B,gBAAjBA,KACT2B,EAAKC,QAAuB,cAAI5B,GAClC2B,EAAKG,YAAc,WAGrBzF,MAAMzQ,EAAK+V,GACRxI,KAAK,SAAU4I,GACd,GAAIA,EAAEC,GACJ,MAAOD,GAAEE,MAET,MAAM,IAAIjT,OAAM,gBAAkB+S,EAAE/G,OAAS,IAAM+G,EAAE3B,cAGxDjH,KAAK8G,EAASjE,IAuCvB,GAAIlG,GAYJxF,GAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MAGjBA,KAAK1B,QAAUgF,EAGftD,KAAKoG,OAGsB,mBAAhBpF,gBACThB,KAAK2U,UAAY3T,aAAaE,KAGhClB,KAAKiH,UAAW,EAChBjH,KAAK4U,qBAAsB,EAC3B5U,KAAK6U,aAAc,EACnB7U,KAAK8U,kBAAmB,EAQxB9U,KAAKsI,IAAI,SAAUtI,KAAKwI,eAExBL,EAAc3F,KAAKxC,MAAM,GAAO,MAKd,mBAAXmJ,UAA4C,mBAAXwD,UAA2BA,QAAQlE,UAC7ElG,EAAeO,UAAU6F,aAAeQ,QAgB1C,IAAIF,GAqDJrG,GAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAY2L,GAChC,GAAIC,GAAWxO,EAAYhE,KAAKxC,KAAM6C,EAAMuG,EAG5C,QAFIpJ,KAAK4U,qBAAwBG,GAAsD,OAA3CC,EAAS5T,OAAO4T,EAASjU,OAAS,EAAG,IAAgBoC,EAAQ6R,KACvGA,GAAY,OACPA,IAKX,IAAIC,IAAuC,mBAAlBzC,eACzB5P,GAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,MAAO8E,SAAQC,QAAQyC,EAAOpM,KAAKxC,KAAMoH,IACxCwE,KAAK,SAASoC,GACb,MAAIiH,IACKjH,EAAQtP,QAAQ,KAAM,OACxBsP,OAQbpL,EAAK,QAAS,WACZ,MAAO,UAASwE,GACd,MAAO,IAAI8E,SAAQ,SAASC,EAASsC,GACnC8D,EAAiBnL,EAAK4G,QAAS5G,EAAKE,SAASmL,cAAetG,EAASsC,QAmB3E7L,EAAK,SAAU,SAASsS,GACtB,MAAO,UAASrS,EAAMuG,EAAYyI,GAGhC,MAFIzI,IAAcA,EAAWvG,MAC3B4D,EAAKjE,KAAKxC,KAAM,oHAAsH6C,EAAO,SAAWuG,EAAWvG,MAC9JqS,EAAa1S,KAAKxC,KAAM6C,EAAMuG,EAAYyI,GAAejG,KAAK,SAASlB,GAC5E,MAAOA,GAAOyK,aAAezK,EAAO,WAAaA,OAQvD9H,EAAK,YAAa,SAASwS,GACzB,MAAO,UAAShO,GAGd,MAF4B,UAAxBA,EAAKE,SAASI,SAChBN,EAAKE,SAASI,OAASpI,QAClB8V,EAAgBC,MAAMrV,KAAMsV,cA0BvC1S,EAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACd,GAA4B,QAAxBA,EAAKE,SAASI,SAAqB1H,KAAKuJ,QAAS,CACnD,GAAIhC,GAAQH,EAAKE,SAASC,MAAQC,GAClCD,GAAMlD,QACNkD,EAAME,QAAU,WACd,IACE,MAAO8N,MAAKC,MAAMpO,EAAK4C,QAEzB,MAAMgD,GACJ,KAAM,IAAIvL,OAAM,qBAAuB2F,EAAKvE,YAsDtDN,EAAeO,UAAU2S,UAAY,SAAS5S,GAC5C,GAAI8D,MACAjD,EAAS1D,IACb,KAAK,GAAIJ,KAAK8D,GACRA,EAAOK,iBAAmBL,EAAOK,eAAenE,IAAMA,IAAK2C,GAAeO,WAAkB,cAALlD,GAEa,IAApGqB,EAAQuB,MAAM,UAAW,YAAa,aAAc,UAAW,SAAU,UAAW,SAAU5C,KAChG+G,EAAI/G,GAAK8D,EAAO9D,GAGpB,OADA+G,GAAIiC,WAAaL,GAAUK,WACpBjC,EAGT,IAAI+O,GACJnT,GAAeO,UAAU6S,OAAS,SAAShP,EAAKiP,GAiC1C,QAASC,GAAe5I,GACtB,IAAK,GAAIrN,KAAKqN,GACZ,GAAIA,EAAIlJ,eAAenE,GACrB,OAAO,EAnCjB,GAAI8D,GAAS1D,IAoBb,IAlBI,oBAAsB2G,KACxB+O,GAAe1U,aACX2F,EAAImO,iBACN9T,aAAe1B,OAEf0B,aAAe0U,IAGf,YAAc/O,KAChBjD,EAAOuD,SAAWN,EAAIM,UAGpBN,EAAImP,qBAAsB,IAC5BpS,EAAO3B,QAAQgU,yBAA0B,IAEvC,cAAgBpP,IAAO,SAAWA,KACpCwB,EAAc3F,KAAKkB,IAAUiD,EAAIiC,cAAejC,EAAImC,OAASP,IAAaA,GAAUO,SAEjF8M,EAAa,CAGhB,GAAItX,EAOJ,IANAkL,EAAO9F,EAAQiD,EAAK,SAASA,GAC3BrI,EAAUA,GAAWqI,EAAIrI,UAE3BA,EAAUA,GAAWqI,EAAIrI,QAGZ,CAOX,GAAIuX,EAAenS,EAAOoD,WAAa+O,EAAenS,EAAO2C,OAASwP,EAAenS,EAAO4C,WAAauP,EAAenS,EAAOsS,UAAYH,EAAenS,EAAOuS,oBAC/J,KAAM,IAAI1X,WAAU,qGAEtByB,MAAK1B,QAAUA,EACf4J,EAAe1F,KAAKxC,MAYtB,GATI2G,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,OAE3B+G,EAAO9F,EAAQiD,EAAK,SAASA,GACvBA,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,SAIzBzC,KAAKiH,SACP,IAAK,GAAIrH,KAAK8D,GAAOjB,MACG,IAAlB7C,EAAEqB,QAAQ,MACZwF,EAAKjE,KAAKkB,EAAQ,wBAA0B9D,EAAI,SAAW8D,EAAOjB,MAAM7C,GAAK,yGAYrF,GARI+G,EAAIiO,sBACNlR,EAAOkR,oBAAsBjO,EAAIiO,oBACjCnO,EAAKjE,KAAKkB,EAAQ,oGAGhBiD,EAAIkO,cACNnR,EAAOmR,YAAclO,EAAIkO,aAEvBlO,EAAIP,IACN,IAAK,GAAIxG,KAAK+G,GAAIP,IAAK,CACrB,GAAI8P,GAAIvP,EAAIP,IAAIxG,EAGhB,IAAiB,gBAANsW,GAAgB,CACzB,GAAIC,GAAqBzS,EAAOkR,qBAAoD,OAA7BhV,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAO0S,eAAexW,EAC7BuW,IAAyD,OAAnChQ,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,GAGtC,IAAIsV,GAAW,EACf,KAAK,GAAIxP,KAAOnD,GAAOoD,SACjBX,EAAK/E,OAAO,EAAGyF,EAAI9F,SAAW8F,KACzBV,EAAKU,EAAI9F,SAA+B,KAApBoF,EAAKU,EAAI9F,UAC/BsV,EAASzV,MAAM,KAAKG,OAAS8F,EAAIjG,MAAM,KAAKG,SACjDsV,EAAWxP,EAEXwP,IAAY3S,EAAOoD,SAASuP,GAAUrP,OACxCb,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS2C,EAAOoD,SAASuP,GAAUrP,KAAKjG,OAAS,GAE9E,IAAI8F,GAAMnD,EAAOoD,SAASX,GAAQzC,EAAOoD,SAASX,MAClDU,GAAIT,IAAM8P,MAGVxS,GAAO0C,IAAIxG,GAAKsW,EAKtB,GAAIvP,EAAIsP,mBAAoB,CAE1B,IAAK,GADDA,MACKnV,EAAI,EAAGA,EAAI6F,EAAIsP,mBAAmBlV,OAAQD,IAAK,CACtD,GAAIkD,GAAO2C,EAAIsP,mBAAmBnV,GAC9BwV,EAAgBC,KAAKC,IAAIxS,EAAKtE,YAAY,KAAO,EAAGsE,EAAKtE,YAAY,MACrE+W,EAAajQ,EAAYhE,KAAKkB,EAAQM,EAAK5C,OAAO,EAAGkV,GACzDL,GAAmBnV,GAAK2V,EAAazS,EAAK5C,OAAOkV,GAEnD5S,EAAOuS,mBAAqBA,EAG9B,GAAItP,EAAIqP,QACN,IAAK,GAAIpW,KAAK+G,GAAIqP,QAAS,CAEzB,IAAK,GADDU,MACK5V,EAAI,EAAGA,EAAI6F,EAAIqP,QAAQpW,GAAGmB,OAAQD,IAAK,CAC9C,GAAIqV,GAAqBzS,EAAOkR,qBAAoF,OAA7DjO,EAAIqP,QAAQpW,GAAGkB,GAAGM,OAAOuF,EAAIqP,QAAQpW,GAAGkB,GAAGC,OAAS,EAAG,GAC1G4V,EAAsBjT,EAAO0S,eAAezP,EAAIqP,QAAQpW,GAAGkB,GAC3DqV,IAAuF,OAAjEQ,EAAoBvV,OAAOuV,EAAoB5V,OAAS,EAAG,KACnF4V,EAAsBA,EAAoBvV,OAAO,EAAGuV,EAAoB5V,OAAS,IACnF2V,EAAO5W,KAAK6W,GAEdjT,EAAOsS,QAAQpW,GAAK8W,EAIxB,GAAI/P,EAAIG,SACN,IAAK,GAAIlH,KAAK+G,GAAIG,SAAU,CAC1B,GAAIlH,EAAEjB,MAAM,oBACV,KAAM,IAAIJ,WAAU,IAAMqB,EAAI,iCAEhC,IAAIuG,GAAOK,EAAYhE,KAAKkB,EAAQ9D,EAGP,MAAzBuG,EAAKA,EAAKpF,OAAS,KACrBoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IAEtC2F,EAAahD,EAAQyC,EAAMQ,EAAIG,SAASlH,IAAI,GAIhD,IAAK,GAAIgX,KAAKjQ,GAAK,CACjB,GAAIuP,GAAIvP,EAAIiQ,EAEZ,IACgH,IAD5G3V,EAAQuB,MAAM,UAAW,MAAO,WAAY,UAAW,QAAS,WAAY,qBAC1E,mBAAoB,gBAAiB,aAAc,YAAa,cAAe,oBAAqBoU,GAG1G,GAAgB,gBAALV,IAAiBA,YAAatQ,OACvClC,EAAOkT,GAAKV,MAET,CACHxS,EAAOkT,GAAKlT,EAAOkT,MAEnB,KAAK,GAAIhX,KAAKsW,GAEZ,GAAS,QAALU,GAAuB,KAARhX,EAAE,GACnBmF,EAAOrB,EAAOkT,GAAGhX,GAAK8D,EAAOkT,GAAGhX,OAAUsW,EAAEtW,QAEzC,IAAS,QAALgX,EAAa,CAEpB,GAAI5B,GAAWxO,EAAYhE,KAAKkB,EAAQ9D,EACpC8D,GAAOkR,qBAAkE,OAA3CI,EAAS5T,OAAO4T,EAASjU,OAAS,EAAG,KAAgBoC,EAAQ6R,KAC7FA,GAAY,OACdjQ,EAAOrB,EAAOkT,GAAG5B,GAAYtR,EAAOkT,GAAG5B,OAAiBkB,EAAEtW,QAEvD,IAAS,YAALgX,EAAiB,CACxB,GAAIT,GAAqBzS,EAAOkR,qBAAoD,OAA7BhV,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAO0S,eAAexW,EAC7BuW,IAAyD,OAAnChQ,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IACtC2C,EAAOkT,GAAGzQ,MAAWN,OAAOqQ,EAAEtW,QAG9B8D,GAAOkT,GAAGhX,GAAKsW,EAAEtW,IAMzB4J,EAAO9F,EAAQiD,EAAK,SAASA,GAC3BjD,EAAOiS,OAAOhP,GAAK,MA6FvB,WAUE,QAASkQ,GAAWnT,EAAQ+S,GAE1B,GAAIK,GAAuBC,EAAfC,EAAY,CACxB,KAAK,GAAIpX,KAAK8D,GAAOoD,SACf2P,EAAWrV,OAAO,EAAGxB,EAAEmB,UAAYnB,GAAM6W,EAAW1V,SAAWnB,EAAEmB,QAAmC,MAAzB0V,EAAW7W,EAAEmB,UAC1FgW,EAASnX,EAAEgB,MAAM,KAAKG,OAClBgW,EAASC,IACXF,EAASlX,EACToX,EAAYD,GAIlB,OAAOD,GAGT,QAASG,GAAoBvT,EAAQmD,EAAKZ,EAASiR,EAASC,GAE1D,IAAKD,GAA0C,KAA/BA,EAAQA,EAAQnW,OAAS,IAAaoW,GAAkBtQ,EAAIuQ,oBAAqB,EAC/F,MAAOF,EAET,IAAIG,IAAY,CAgBhB,IAbIxQ,EAAIR,MACNiR,EAAezQ,EAAIR,KAAM6Q,EAAS,SAASK,EAAaC,EAAWC,GACjE,MAAkB,IAAdA,GAAmBF,EAAY7X,YAAY,MAAQ6X,EAAYxW,OAAS,EACnEsW,GAAY,EADrB,UAKCA,GAAa3T,EAAO2C,MACvBiR,EAAe5T,EAAO2C,KAAMJ,EAAU,IAAMiR,EAAS,SAASK,EAAaC,EAAWC,GACpF,MAAkB,IAAdA,GAAmBF,EAAY7X,YAAY,MAAQ6X,EAAYxW,OAAS,EACnEsW,GAAY,EADrB,SAIAA,EACF,MAAOH,EAIT,IAAIE,GAAmB,KAAOvQ,EAAIuQ,kBAAoB,KACtD,OAAIF,GAAQ9V,OAAO8V,EAAQnW,OAASqW,EAAiBrW,SAAWqW,EACvDF,EAAUE,EAEVF,EAGX,QAASQ,GAAuBhU,EAAQmD,EAAKZ,EAASiR,EAASC,GAE7D,IAAKD,EAAS,CACZ,IAAIrQ,EAAIG,KAMN,MAAOf,IAAWvC,EAAOkR,oBAAsB,MAAQ,GALvDsC,GAAmC,MAAzBrQ,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAIH,EAAIT,IAAK,CACX,GAAIuR,GAAU,KAAOT,EAEjB7N,EAAWvB,EAAYjB,EAAIT,IAAKuR,EAQpC,IALKtO,IACHsO,EAAU,KAAOV,EAAoBvT,EAAQmD,EAAKZ,EAASiR,EAASC,GAChEQ,GAAW,KAAOT,IACpB7N,EAAWvB,EAAYjB,EAAIT,IAAKuR,KAEhCtO,EAAU,CACZ,GAAIuO,GAASC,EAAUnU,EAAQmD,EAAKZ,EAASoD,EAAUsO,EAASR,EAChE,IAAIS,EACF,MAAOA,IAKb,MAAO3R,GAAU,IAAMgR,EAAoBvT,EAAQmD,EAAKZ,EAASiR,EAASC,GAG5E,QAASW,GAAazO,EAAUuO,EAAQ3R,EAASjC,GAE/C,GAAgB,KAAZqF,EACF,KAAM,IAAI5H,OAAM,WAAawE,EAAU,mDAIzC,OAAI2R,GAAOxW,OAAO,EAAGiI,EAAStI,SAAWsI,GAAYrF,EAAKjD,OAASsI,EAAStI,QACnE,GAEF,EAGT,QAAS8W,GAAUnU,EAAQmD,EAAKZ,EAASoD,EAAUrF,EAAMmT,GAC1B,KAAzBnT,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GACtC,IAAI6W,GAAS/Q,EAAIT,IAAIiD,EAErB,IAAqB,gBAAVuO,GACT,KAAM,IAAInW,OAAM,wEAA0E4H,EAAW,OAASpD,EAEhH,IAAK6R,EAAazO,EAAUuO,EAAQ3R,EAASjC,IAA0B,gBAAV4T,GAA7D,CAIA,GAAc,KAAVA,EACFA,EAAS3R,MAGN,IAA2B,MAAvB2R,EAAOxW,OAAO,EAAG,GACxB,MAAO6E,GAAU,IAAMgR,EAAoBvT,EAAQmD,EAAKZ,EAAS2R,EAAOxW,OAAO,GAAK4C,EAAK5C,OAAOiI,EAAStI,QAASoW,EAGpH,OAAOzT,GAAOqU,cAAcH,EAAS5T,EAAK5C,OAAOiI,EAAStI,QAASkF,EAAU,MAG/E,QAAS+R,GAAmBtU,EAAQmD,EAAKZ,EAASiR,EAASC,GAEzD,IAAKD,EAAS,CACZ,IAAIrQ,EAAIG,KAMN,MAAOkF,SAAQC,QAAQlG,GAAWvC,EAAOkR,oBAAsB,MAAQ,IALvEsC,GAAmC,MAAzBrQ,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAI2Q,GAAStO,CAcb,OAZIxC,GAAIT,MACNuR,EAAU,KAAOT,EACjB7N,EAAWvB,EAAYjB,EAAIT,IAAKuR,GAG3BtO,IACHsO,EAAU,KAAOV,EAAoBvT,EAAQmD,EAAKZ,EAASiR,EAASC,GAChEQ,GAAW,KAAOT,IACpB7N,EAAWvB,EAAYjB,EAAIT,IAAKuR,OAI9BtO,EAAW4O,EAAMvU,EAAQmD,EAAKZ,EAASoD,EAAUsO,EAASR,GAAkBjL,QAAQC,WAC3FP,KAAK,SAASgM,GACb,MAAIA,GACK1L,QAAQC,QAAQyL,GAGlB1L,QAAQC,QAAQlG,EAAU,IAAMgR,EAAoBvT,EAAQmD,EAAKZ,EAASiR,EAASC,MAI9F,QAASe,GAAYxU,EAAQmD,EAAKZ,EAASoD,EAAUuO,EAAQ5T,EAAMmT,GAGjE,GAAc,KAAVS,EACFA,EAAS3R,MAGN,IAA2B,MAAvB2R,EAAOxW,OAAO,EAAG,GACxB,MAAO8K,SAAQC,QAAQlG,EAAU,IAAMgR,EAAoBvT,EAAQmD,EAAKZ,EAAS2R,EAAOxW,OAAO,GAAK4C,EAAK5C,OAAOiI,EAAStI,QAASoW,IACjIvL,KAAK,SAAS/I,GACb,MAAOkJ,GAAuBvJ,KAAKkB,EAAQb,EAAMoD,EAAU,MAI/D,OAAOvC,GAAOiI,UAAUiM,EAAS5T,EAAK5C,OAAOiI,EAAStI,QAASkF,EAAU,KAG3E,QAASgS,GAAMvU,EAAQmD,EAAKZ,EAASoD,EAAUrF,EAAMmT,GACtB,KAAzBnT,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GAEtC,IAAI6W,GAAS/Q,EAAIT,IAAIiD,EAErB,IAAqB,gBAAVuO,GACT,MAAKE,GAAazO,EAAUuO,EAAQ3R,EAASjC,GAEtCkU,EAAYxU,EAAQmD,EAAKZ,EAASoD,EAAUuO,EAAQ5T,EAAMmT,GADxDjL,QAAQC,SAKnB,IAAIzI,EAAO6F,QACT,MAAO2C,SAAQC,QAAQlG,EAAU,MAAQjC,EAG3C,IAAImU,MACAC,IACJ,KAAK,GAAIpL,KAAK4K,GAAQ,CACpB,GAAIhB,GAAI7L,EAAeiC,EACvBoL,GAAWtY,MACTkL,UAAW4L,EACXxQ,IAAKwR,EAAO5K,KAEdmL,EAAkBrY,KAAK4D,EAAO,UAAUkT,EAAElM,OAAQzE,IAIpD,MAAOiG,SAAQqD,IAAI4I,GAClBvM,KAAK,SAASyM,GAEb,IAAK,GAAIvX,GAAI,EAAGA,EAAIsX,EAAWrX,OAAQD,IAAK,CAC1C,GAAI8V,GAAIwB,EAAWtX,GAAGkK,UAClBhG,EAAQ2C,EAAqBiP,EAAEzQ,KAAMkS,EAAgBvX,GACzD,KAAK8V,EAAEtL,QAAUtG,GAAS4R,EAAEtL,SAAWtG,EACrC,MAAOoT,GAAWtX,GAAGsF,OAG1BwF,KAAK,SAASgM,GACb,GAAIA,EAAQ,CACV,IAAKE,EAAazO,EAAUuO,EAAQ3R,EAASjC,GAC3C,MACF,OAAOkU,GAAYxU,EAAQmD,EAAKZ,EAASoD,EAAUuO,EAAQ5T,EAAMmT,MA8JvE,QAASmB,GAAuBtU,GAC9B,GAAIuU,GAAevU,EAAKtE,YAAY,KAChCqB,EAASwV,KAAKC,IAAI+B,EAAe,EAAGvU,EAAKtE,YAAY,KACzD,QACEqB,OAAQA,EACRyX,MAAO,GAAIC,QAAO,KAAOzU,EAAK5C,OAAO,EAAGL,GAAQrC,QAAQ,qBAAsB,QAAQA,QAAQ,MAAO,WAAa,YAClHiF,SAA0B,IAAhB4U,GAKd,QAASG,GAAsBhV,EAAQ+S,GAErC,IAAK,GADDxQ,GAA6B0S,EAApBC,GAAa,EACjB9X,EAAI,EAAGA,EAAI4C,EAAOuS,mBAAmBlV,OAAQD,IAAK,CACzD,GAAI+X,GAAoBnV,EAAOuS,mBAAmBnV,GAC9ClB,EAAIqW,EAAmB4C,KAAuB5C,EAAmB4C,GAAqBP,EAAuBO,GACjH,MAAIpC,EAAW1V,OAASnB,EAAEmB,QAA1B,CAEA,GAAIpC,GAAQ8X,EAAW9X,MAAMiB,EAAE4Y,QAC3B7Z,GAAWsH,IAAc2S,GAAchZ,EAAE+D,YAAasC,EAAQlF,OAASpC,EAAM,GAAGoC,WAClFkF,EAAUtH,EAAM,GAChBia,GAAchZ,EAAE+D,SAChBgV,EAAa1S,EAAU4S,EAAkBzX,OAAOxB,EAAEmB,UAItD,MAAKkF,IAIH6S,YAAa7S,EACb0S,WAAYA,GALd,OASF,QAASI,GAAsBrV,EAAQuC,EAAS+S,GAC9C,GAAIC,GAAevV,EAAOwV,cAAgBxV,CAM1C,QAHCuV,EAAa5S,KAAK2S,GAAiBC,EAAa5S,KAAK2S,QAAsBtR,OAAS,OACrFuR,EAAa5S,KAAK2S,GAAetV,OAAS,KAEnCuV,EAAa7R,KAAK4R,GACxBpN,KAAK,WACJ,GAAIjF,GAAMsS,EAAa3W,IAAI0W,GAAe,UAY1C,OATIrS,GAAIwS,WACNxS,EAAMA,EAAIwS,UAGRxS,EAAIzE,UACNyE,EAAIN,KAAOM,EAAIzE,QACfuE,EAAKjE,KAAKkB,EAAQ,uBAAyBsV,EAAgB,yFAGtDtS,EAAahD,EAAQuC,EAASU,GAAK,KAI9C,QAAS2Q,GAAe8B,EAASlC,EAASmC,GAExC,GACIC,EACJ,KAAK,GAAI5O,KAAU0O,GAAS,CAE1B,GAAIG,GAAgC,MAAvB7O,EAAOtJ,OAAO,EAAG,GAAa,KAAO,EAKlD,IAJImY,IACF7O,EAASA,EAAOtJ,OAAO,IAEzBkY,EAAgB5O,EAAOzJ,QAAQ,KACT,KAAlBqY,GAGA5O,EAAOtJ,OAAO,EAAGkY,IAAkBpC,EAAQ9V,OAAO,EAAGkY,IAClD5O,EAAOtJ,OAAOkY,EAAgB,IAAMpC,EAAQ9V,OAAO8V,EAAQnW,OAAS2J,EAAO3J,OAASuY,EAAgB,IAErGD,EAAQ3O,EAAQ0O,EAAQG,EAAS7O,GAASA,EAAO9J,MAAM,KAAKG,QAC9D,OAIN,GAAIyY,GAAYJ,EAAQlC,IAAYkC,EAAQrV,gBAAkBqV,EAAQrV,eAAemT,GAAWkC,EAAQlC,GAAWkC,EAAQ,KAAOlC,EAC9HsC,IACFH,EAAQG,EAAWA,EAAW,GAldlCzW,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MACjBA,KAAK8G,YACL9G,KAAKiW,yBAoOT1T,EAAeO,UAAUiV,cAAgBxV,EAAeO,UAAUsT,eAAiB7T,EAAeO,UAAU6I,UAI5G/I,EAAK,iBAAkB,SAASwT,GAC9B,MAAO,UAASvT,EAAMuG,GACpB,GAAIpJ,KAAKuJ,QACP,MAAO6M,GAAe5T,KAAKxC,KAAM6C,EAAMuG,GAAY,EAErD,IAAIqQ,GAAkBrD,EAAe5T,KAAKxC,KAAM6C,EAAMuG,GAAY,EAElE,KAAKpJ,KAAK4U,oBACR,MAAO6E,EAET,IAAIxT,GAAU4Q,EAAW7W,KAAMyZ,GAE3B5S,EAAM7G,KAAK8G,SAASb,GACpBmR,EAAmBvQ,GAAOA,EAAIuQ,gBAalC,OAXwB9X,SAApB8X,GAAiCvQ,GAAOA,EAAIR,MAC9CiR,EAAezQ,EAAIR,KAAMoT,EAAgBrY,OAAO6E,GAAU,SAASsR,EAAaC,EAAWC,GACzF,MAAkB,IAAdA,GAAmBF,EAAY7X,YAAY,MAAQ6X,EAAYxW,OAAS,GAC1EqW,GAAmB,GACZ,GAFT,UAMCA,KAAqB,GAASA,GAAwC,OAApBA,IAAiE,OAAnCvU,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,IAAwE,OAAzD0Y,EAAgBrY,OAAOqY,EAAgB1Y,OAAS,EAAG,KAClL0Y,EAAkBA,EAAgBrY,OAAO,EAAGqY,EAAgB1Y,OAAS,IAEhE0Y,KAIX7W,EAAK,gBAAiB,SAASmV,GAC7B,MAAO,UAASlV,EAAMuG,EAAYsQ,GAChC,GAAIhW,GAAS1D,IAKb,IAJA0Z,EAAWA,KAAa,EAIpBtQ,EACF,GAAIuQ,GAAoB9C,EAAWnT,EAAQ0F,IACvC1F,EAAOkR,qBAAsE,OAA/CxL,EAAWhI,OAAOgI,EAAWrI,OAAS,EAAG,IACvE8V,EAAWnT,EAAQ0F,EAAWhI,OAAO,EAAGgI,EAAWrI,OAAS,GAElE,IAAI6Y,GAAgBD,GAAqBjW,EAAOoD,SAAS6S,EAGzD,IAAIC,GAA4B,KAAX/W,EAAK,GAAW,CACnC,GAAIgX,GAAYD,EAAcxT,IAC1B0T,EAAiBD,GAAa/R,EAAY+R,EAAWhX,EAEzD,IAAIiX,GAAsD,gBAA7BD,GAAUC,GAA6B,CAClE,GAAIlC,GAASC,EAAUnU,EAAQkW,EAAeD,EAAmBG,EAAgBjX,EAAM6W,EACvF,IAAI9B,EACF,MAAOA,IAIb,GAAIzB,GAAqBzS,EAAOkR,qBAA0D,OAAnC/R,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhF0V,EAAasB,EAAcvV,KAAKkB,EAAQb,EAAMuG,GAAY,EAG1D+M,IAAqE,OAA/CM,EAAWrV,OAAOqV,EAAW1V,OAAS,EAAG,KACjEoV,GAAqB,GACnBA,IACFM,EAAaA,EAAWrV,OAAO,EAAGqV,EAAW1V,OAAS,GAExD,IAAIgZ,GAAiBrB,EAAsBhV,EAAQ+S,GAC/CxQ,EAAU8T,GAAkBA,EAAejB,aAAejC,EAAWnT,EAAQ+S,EAEjF,KAAKxQ,EACH,MAAOwQ,IAAcN,EAAqB,MAAQ,GAEpD,IAAIe,GAAUT,EAAWrV,OAAO6E,EAAQlF,OAAS,EAEjD,OAAO2W,GAAuBhU,EAAQA,EAAOoD,SAASb,OAAgBA,EAASiR,EAASwC,MAI5F9W,EAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAYsQ,GAChC,GAAIhW,GAAS1D,IAGb,OAFA0Z,GAAWA,KAAa,EAEjBxN,QAAQC,UACdP,KAAK,WAGJ,GAAIxC,EACF,GAAIuQ,GAAoB9C,EAAWnT,EAAQ0F,IACvC1F,EAAOkR,qBAAsE,OAA/CxL,EAAWhI,OAAOgI,EAAWrI,OAAS,EAAG,IACvE8V,EAAWnT,EAAQ0F,EAAWhI,OAAO,EAAGgI,EAAWrI,OAAS,GAElE,IAAI6Y,GAAgBD,GAAqBjW,EAAOoD,SAAS6S,EAGzD,IAAIC,GAAsC,MAArB/W,EAAKzB,OAAO,EAAG,GAAY,CAC9C,GAAIyY,GAAYD,EAAcxT,IAC1B0T,EAAiBD,GAAa/R,EAAY+R,EAAWhX,EAEzD,IAAIiX,EACF,MAAO7B,GAAMvU,EAAQkW,EAAeD,EAAmBG,EAAgBjX,EAAM6W,GAGjF,MAAOxN,SAAQC,YAEhBP,KAAK,SAASgM,GACb,GAAIA,EACF,MAAOA,EAET,IAAIzB,GAAqBzS,EAAOkR,qBAA0D,OAAnC/R,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhF0V,EAAa9K,EAAUnJ,KAAKkB,EAAQb,EAAMuG,GAAY,EAGtD+M,IAAqE,OAA/CM,EAAWrV,OAAOqV,EAAW1V,OAAS,EAAG,KACjEoV,GAAqB,GACnBA,IACFM,EAAaA,EAAWrV,OAAO,EAAGqV,EAAW1V,OAAS,GAExD,IAAIgZ,GAAiBrB,EAAsBhV,EAAQ+S,GAC/CxQ,EAAU8T,GAAkBA,EAAejB,aAAejC,EAAWnT,EAAQ+S,EAEjF,KAAKxQ,EACH,MAAOiG,SAAQC,QAAQsK,GAAcN,EAAqB,MAAQ,IAEpE,IAAItP,GAAMnD,EAAOoD,SAASb,GAGtB+T,EAAenT,IAAQA,EAAIoT,aAAeF,EAC9C,QAAQC,EAAe9N,QAAQC,QAAQtF,GAAOkS,EAAsBrV,EAAQuC,EAAS8T,EAAepB,aACnG/M,KAAK,SAAS/E,GACb,GAAIqQ,GAAUT,EAAWrV,OAAO6E,EAAQlF,OAAS,EAEjD,OAAOiX,GAAmBtU,EAAQmD,EAAKZ,EAASiR,EAASwC,SAQjE,IAAIzD,KA0FJrT,GAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAAI1D,GAAS1D,IACb,OAAOkM,SAAQC,QAAQyC,EAAOpM,KAAKxC,KAAMoH,IACxCwE,KAAK,SAASoC,GACb,GAAI/H,GAAU4Q,EAAWnT,EAAQ0D,EAAKvE,KACtC,IAAIoD,EAAS,CACX,GAAIY,GAAMnD,EAAOoD,SAASb,GACtBiR,EAAU9P,EAAKvE,KAAKzB,OAAO6E,EAAQlF,OAAS,GAE5CsF,IACJ,IAAIQ,EAAIR,KAAM,CACZ,GAAI6T,GAAY,CAGhB5C,GAAezQ,EAAIR,KAAM6Q,EAAS,SAASK,EAAaC,EAAWC,GAC7DA,EAAayC,IACfA,EAAYzC,GACd/R,EAAWW,EAAMmR,EAAWC,GAAcyC,EAAYzC,KAGxD/R,EAAW0B,EAAKE,SAAUjB,GAIxBQ,EAAIa,SAAWN,EAAKE,SAAS5D,SAC/B0D,EAAKE,SAASI,OAASN,EAAKE,SAASI,QAAUb,EAAIa,QAGvD,MAAOsG,WAWf,WAsBE,QAASmM,KACP,GAAIC,GAA6D,gBAAxCA,EAAkBC,OAAO5G,WAChD,MAAO2G,GAAkBhT,IAE3B,KAAK,GAAItG,GAAI,EAAGA,EAAIwZ,EAA0BvZ,OAAQD,IACpD,GAAsD,eAAlDwZ,EAA0BxZ,GAAGuZ,OAAO5G,WAEtC,MADA2G,GAAoBE,EAA0BxZ,GACvCsZ,EAAkBhT,KA0C/B,QAASmT,GAAgB7W,EAAQ0D,GAC/B,MAAO,IAAI8E,SAAQ,SAASC,EAASsC,GAC/BrH,EAAKE,SAASkT,WAChB/L,EAAO,GAAIhN,OAAM,oEAEnBgZ,EAAarT,CACb,KACEqF,cAAcrF,EAAK4G,SAErB,MAAMhB,GACJyN,EAAa,KACbhM,EAAOzB,GAETyN,EAAa,KAGRrT,EAAKE,SAASC,OACjBkH,EAAO,GAAIhN,OAAM2F,EAAK4G,QAAU,+GAElC7B,EAAQ,MAxFZ,GAAuB,mBAAZO,UACT,GAAIgO,GAAOhO,SAASS,qBAAqB,QAAQ,EAEnD,IAAIwN,GACAC,EAeAR,EAZAK,EAAa,KAGbI,EAAWH,GAAQ,WACrB,GAAII,GAAIpO,SAASqO,cAAc,UAC3BC,EAA2B,mBAAVC,QAA8C,mBAArBA,MAAMta,UACpD,OAAOma,GAAEI,eAAiBJ,EAAEI,YAAYva,UAAYma,EAAEI,YAAYva,WAAWM,QAAQ,gBAAkB,KAAO+Z,KAK5GV,KAkBAa,EAAa,EACbC,IACJxY,GAAK,gBAAiB,SAASyY,GAC7B,MAAO,UAASC,GAEd,MAAID,GAAa7Y,KAAKxC,KAAMsb,IACnB,GAGLb,EACFza,KAAKub,gBAAgBd,EAAYa,GAI1BT,EACP7a,KAAKub,gBAAgBpB,IAA4BmB,GAI1CH,EACPC,EAActb,KAAKwb,GAOnBtb,KAAKub,gBAAgB,KAAMD,IAEtB,MA4BX1Y,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,GAAI1D,GAAS1D,IAEb,OAA4B,QAAxBoH,EAAKE,SAASI,QAAqBN,EAAKE,SAASkU,aAAgBna,GAAckL,GAG/EA,EACKgO,EAAgB7W,EAAQ0D,GAE1B,GAAI8E,SAAQ,SAASC,EAASsC,GA+BnC,QAASgN,GAASC,GAChB,IAAIZ,EAAErH,YAA8B,UAAhBqH,EAAErH,YAA0C,YAAhBqH,EAAErH,WAAlD,CAOA,GAJA0H,IAIK/T,EAAKE,SAASC,OAAU6T,EAAcra,QAGtC,IAAK8Z,EAAU,CAClB,IAAK,GAAI/Z,GAAI,EAAGA,EAAIsa,EAAcra,OAAQD,IACxC4C,EAAO6X,gBAAgBnU,EAAMgU,EAActa,GAC7Csa,WALA1X,GAAO6X,gBAAgBnU,EAQzBuU,KAGKvU,EAAKE,SAASC,OAAUH,EAAKE,SAASoP,QACzCjI,EAAO,GAAIhN,OAAM2F,EAAKvE,KAAO,kKAE/BsJ,EAAQ;EAGV,QAASkE,GAAMqL,GACbC,IACAlN,EAAO,GAAIhN,OAAM,yBAA2B2F,EAAK4G,UAGnD,QAAS2N,KAIP,GAHAvb,EAASkS,OAASqI,EAClBva,EAAS+I,QAAUyR,EAEfE,EAAEc,YAAa,CACjBd,EAAEc,YAAY,qBAAsBH,EACpC,KAAK,GAAI3a,GAAI,EAAGA,EAAIwZ,EAA0BvZ,OAAQD,IAChDwZ,EAA0BxZ,GAAGuZ,QAAUS,IACrCV,GAAqBA,EAAkBC,QAAUS,IACnDV,EAAoB,MACtBE,EAA0BvJ,OAAOjQ,EAAG,QAIxCga,GAAEe,oBAAoB,OAAQJ,GAAU,GACxCX,EAAEe,oBAAoB,QAASxL,GAAO,EAGxCqK,GAAKoB,YAAYhB,GA/EnB,GAAIA,GAAIpO,SAASqO,cAAc,SAE/BD,GAAEiB,OAAQ,EAEN3U,EAAKE,SAAS0U,cAChBlB,EAAEkB,YAAc5U,EAAKE,SAAS0U,aAE5B5U,EAAKE,SAASkT,WAChBM,EAAEmB,aAAa,YAAa7U,EAAKE,SAASkT,WAExCK,GACFC,EAAEI,YAAY,qBAAsBO,GACpCnB,EAA0Bxa,MACxBua,OAAQS,EACR1T,KAAMA,MAIR0T,EAAEpH,iBAAiB,OAAQ+H,GAAU,GACrCX,EAAEpH,iBAAiB,QAASrD,GAAO,IAGrC8K,IAEAR,EAAYva,EAASkS,OACrBsI,EAAaxa,EAAS+I,QAEtB2R,EAAE5Z,IAAMkG,EAAK4G,QACb0M,EAAKwB,YAAYpB,KAlCVhM,EAAMtM,KAAKxC,KAAMoH,QAgJhC,IAAI8C,IAA6B,2FAwBjC,WAsGE,QAASiS,GAAY5U,EAAO7D,EAAQ0Y,GAGlC,GAFAA,EAAO7U,EAAMiD,YAAc4R,EAAO7U,EAAMiD,gBAEa,IAAjDvJ,EAAQuB,KAAK4Z,EAAO7U,EAAMiD,YAAajD,GAA3C,CAGA6U,EAAO7U,EAAMiD,YAAY1K,KAAKyH,EAE9B,KAAK,GAAIzG,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAAIub,GAAU9U,EAAMgD,eAAezJ,GAC/Bwb,EAAW5Y,EAAO6Y,QAAQF,EAG9B,IAAKC,IAAYA,EAAS7R,UAA1B,CAIA,GAAI+R,GAAgBjV,EAAMiD,YAAc8R,EAAShS,aAAe/C,EAAM+C,YAGtE,IAA4B,OAAxBgS,EAAS9R,YAAuB8R,EAAS9R,WAAagS,EAAe,CAGvE,GAA4B,OAAxBF,EAAS9R,aACX4R,EAAOE,EAAS9R,YAAYuG,OAAO9P,EAAQuB,KAAK4Z,EAAOE,EAAS9R,YAAa8R,GAAW,GAG9C,GAAtCF,EAAOE,EAAS9R,YAAYzJ,QAC9B,KAAM,IAAIU,OAAM,kCAGpB6a,GAAS9R,WAAagS,EAGxBL,EAAYG,EAAU5Y,EAAQ0Y,MAIlC,QAAS9L,GAAKzN,EAAM4Z,EAAY/Y,GAE9B,IAAI+Y,EAAW/R,OAAf,CAGA+R,EAAWjS,WAAa,CAExB,IAAI4R,KAEJD,GAAYM,EAAY/Y,EAAQ0Y,EAGhC,KAAK,GADDM,KAAwBD,EAAWnS,aAAe8R,EAAOrb,OAAS,EAC7DD,EAAIsb,EAAOrb,OAAS,EAAGD,GAAK,EAAGA,IAAK,CAE3C,IAAK,GADDsD,GAAQgY,EAAOtb,GACVqP,EAAI,EAAGA,EAAI/L,EAAMrD,OAAQoP,IAAK,CACrC,GAAI5I,GAAQnD,EAAM+L,EAGduM,GACFC,EAAsBpV,EAAO7D,GAE7BkZ,EAAkBrV,EAAO7D,GAE7BgZ,GAAuBA,IAK3B,QAASG,MAOT,QAASC,GAAwBja,EAAMT,GACrC,MAAOA,GAAcS,KAAUT,EAAcS,IAC3CA,KAAMA,EACN+K,gBACAjJ,QAAS,GAAIkY,GACbE,eAIJ,QAASJ,GAAsBpV,EAAO7D,GAEpC,IAAI6D,EAAMmD,OAAV,CAGA,GAAItI,GAAgBsB,EAAO3B,QAAQK,cAC/BsI,EAASnD,EAAMmD,OAASoS,EAAwBvV,EAAM1E,KAAMT,GAC5DuC,EAAU4C,EAAMmD,OAAO/F,QAEvBqY,EAAczV,EAAM6C,QAAQ5H,KAAKpC,EAAU,SAASyC,EAAMmC,GAG5D,GAFA0F,EAAOuS,QAAS,EAEG,gBAARpa,GACT,IAAK,GAAIjD,KAAKiD,GACZ8B,EAAQ/E,GAAKiD,EAAKjD,OAGpB+E,GAAQ9B,GAAQmC,CAGlB,KAAK,GAAIlE,GAAI,EAAG0D,EAAIkG,EAAOqS,UAAUhc,OAAYyD,EAAJ1D,EAAOA,IAAK,CACvD,GAAIoc,GAAiBxS,EAAOqS,UAAUjc,EACtC,KAAKoc,EAAeD,OAAQ,CAC1B,GAAIE,GAAgBlc,EAAQuB,KAAK0a,EAAetP,aAAclD,GAC1D0S,EAASF,EAAeG,QAAQF,EAChCC,IACFA,EAAOzY,IAKb,MADA+F,GAAOuS,QAAS,EACTjY,IACJsY,GAAI/V,EAAM1E,MAWf,IAT0B,kBAAfma,KACTA,GAAgBK,WAAa5V,QAASuV,IAGxCA,EAAcA,IAAiBK,WAAa5V,QAAS,cAErDiD,EAAO2S,QAAUL,EAAYK,QAC7B3S,EAAOjD,QAAUuV,EAAYvV,SAExBiD,EAAO2S,UAAY3S,EAAOjD,QAC7B,KAAM,IAAIlJ,WAAU,oCAAsCgJ,EAAM1E,KAIlE,KAAK,GAAI/B,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAKIyc,GALAlB,EAAU9U,EAAMgD,eAAezJ,GAC/Bwb,EAAW5Y,EAAO6Y,QAAQF,GAC1BmB,EAAYpb,EAAcia,EAK1BmB,GACFD,EAAaC,EAAU7Y,QAGhB2X,IAAaA,EAAShS,YAC7BiT,EAAajB,EAAS1X,SAGd0X,GAKRK,EAAsBL,EAAU5Y,GAChC8Z,EAAYlB,EAAS5R,OACrB6S,EAAaC,EAAU7Y,SANvB4Y,EAAa7Z,EAAOpB,IAAI+Z,GAUtBmB,GAAaA,EAAUT,WACzBS,EAAUT,UAAUjd,KAAK4K,GACzBA,EAAOkD,aAAa9N,KAAK0d,IAGzB9S,EAAOkD,aAAa9N,KAAK,KAK3B,KAAK,GADDqK,GAAkB5C,EAAM4C,gBAAgBrJ,GACnCqP,EAAI,EAAGsN,EAAMtT,EAAgBpJ,OAAY0c,EAAJtN,IAAWA,EAAG,CAC1D,GAAI1L,GAAQ0F,EAAgBgG,EACxBzF,GAAO2S,QAAQ5Y,IACjBiG,EAAO2S,QAAQ5Y,GAAO8Y,MAO9B,QAASG,GAAU7a,EAAMa,GACvB,GAAIiB,GACA4C,EAAQ7D,EAAO6Y,QAAQ1Z,EAE3B,IAAK0E,EAOCA,EAAM+C,YACRqT,EAAgB9a,EAAM0E,KAAW7D,GAEzB6D,EAAMkD,WACdmS,EAAkBrV,EAAO7D,GAE3BiB,EAAU4C,EAAMmD,OAAO/F,YAXvB,IADAA,EAAUjB,EAAOpB,IAAIO,IAChB8B,EACH,KAAM,IAAIlD,OAAM,6BAA+BoB,EAAO,IAa1D,SAAM0E,GAASA,EAAM+C,cAAgB3F,GAAWA,EAAQwQ,aAC/CxQ,EAAQ,WAEVA,EAGT,QAASiY,GAAkBrV,EAAO7D,GAChC,IAAI6D,EAAMmD,OAAV,CAGA,GAAI/F,MAEA+F,EAASnD,EAAMmD,QAAW/F,QAASA,EAAS2Y,GAAI/V,EAAM1E,KAG1D,KAAK0E,EAAM8C,iBACT,IAAK,GAAIvJ,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAAIub,GAAU9U,EAAMgD,eAAezJ,GAE/Bwb,EAAW5Y,EAAO6Y,QAAQF,EAC1BC,IACFM,EAAkBN,EAAU5Y,GAKlC6D,EAAMkD,WAAY,CAClB,IAAI9K,GAAS4H,EAAME,QAAQjF,KAAKpC,EAAU,SAASyC,GACjD,IAAK,GAAI/B,GAAI,EAAG0D,EAAI+C,EAAMlD,KAAKtD,OAAYyD,EAAJ1D,EAAOA,IAC5C,GAAIyG,EAAMlD,KAAKvD,IAAM+B,EAErB,MAAO6a,GAAUnW,EAAMgD,eAAezJ,GAAI4C,EAG5C,IAAIka,GAAiBla,EAAOqU,cAAclV,EAAM0E,EAAM1E,KACtD,IAA0D,IAAtD5B,EAAQuB,KAAK+E,EAAMgD,eAAgBqT,GACrC,MAAOF,GAAUE,EAAgBla,EAEnC,MAAM,IAAIjC,OAAM,UAAYoB,EAAO,oCAAsC0E,EAAM1E,OAC9E8B,EAAS+F,EAEGpL,UAAXK,IACF+K,EAAO/F,QAAUhF,GAGnBgF,EAAU+F,EAAO/F,QAGbA,IAAYA,EAAQkZ,YAAclZ,YAAmB/C,IACvD2F,EAAM3C,SAAWlB,EAAO8E,UAAU7D,GAE3B4C,EAAMoD,YAAchG,IAAYvE,EACvCmH,EAAM3C,SAAWlB,EAAO8E,UAAU9D,EAAYC,IAG9C4C,EAAM3C,SAAWlB,EAAO8E,WAAYO,UAAWpE,EAASwQ,cAAc,KAY1E,QAASwI,GAAgB1P,EAAY1G,EAAOuW,EAAMpa,GAEhD,GAAK6D,IAASA,EAAMkD,WAAclD,EAAM+C,YAAxC,CAKAwT,EAAKhe,KAAKmO,EAEV,KAAK,GAAInN,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAAIub,GAAU9U,EAAMgD,eAAezJ,EACA,KAA/BG,EAAQuB,KAAKsb,EAAMzB,KAChB3Y,EAAO6Y,QAAQF,GAGlBsB,EAAgBtB,EAAS3Y,EAAO6Y,QAAQF,GAAUyB,EAAMpa,GAFxDA,EAAOpB,IAAI+Z,IAMb9U,EAAMkD,YAGVlD,EAAMkD,WAAY,EAClBlD,EAAMmD,OAAOjD,QAAQjF,KAAKpC,KAvX5BmC,EAAeO,UAAUwY,SAAW,SAASzY,EAAMwB,EAAM+F,GASvD,GARmB,gBAARvH,KACTuH,EAAU/F,EACVA,EAAOxB,EACPA,EAAO,MAKa,iBAAXuH,GACT,MAAOpK,MAAK+d,gBAAgB1I,MAAMrV,KAAMsV,UAE1C,IAAI/N,GAAQC,GAIZD,GAAM1E,KAAOA,IAAS7C,KAAKoW,gBAAkBpW,KAAK2L,WAAWnJ,KAAKxC,KAAM6C,GACxE0E,EAAM+C,aAAc,EACpB/C,EAAMlD,KAAOA,EACbkD,EAAM6C,QAAUA,EAEhBpK,KAAKge,eACHC,KAAK,EACL1W,MAAOA,KAGXhF,EAAeO,UAAUib,gBAAkB,SAASlb,EAAMwB,EAAM+F,EAAS3C,GACpD,gBAAR5E,KACT4E,EAAU2C,EACVA,EAAU/F,EACVA,EAAOxB,EACPA,EAAO,KAIT,IAAI0E,GAAQC,GACZD,GAAM1E,KAAOA,IAAS7C,KAAKoW,gBAAkBpW,KAAK2L,WAAWnJ,KAAKxC,KAAM6C,GACxE0E,EAAMlD,KAAOA,EACbkD,EAAME,QAAUA,EAChBF,EAAM8C,iBAAmBD,EAEzBpK,KAAKge,eACHC,KAAK,EACL1W,MAAOA,KAGX3E,EAAK,kBAAmB,WACtB,MAAO,UAASwE,EAAMkU,GACpB,GAAKA,EAAL,CAGA,GAAI/T,GAAQ+T,EAAS/T,MACjB2W,EAAU9W,GAAQA,EAAKE,QAW3B,IARIC,EAAM1E,OACF0E,EAAM1E,OAAQ7C,MAAKuc,UACvBvc,KAAKuc,QAAQhV,EAAM1E,MAAQ0E,GAEzB2W,IACFA,EAAQxH,QAAS,KAGhBnP,EAAM1E,MAAQuE,IAAS8W,EAAQ3W,OAASA,EAAM1E,MAAQuE,EAAKvE,KAAM,CACpE,IAAKqb,EACH,KAAM,IAAI3f,WAAU,+IACtB,IAAI2f,EAAQ3W,MACV,KAAsB,YAAlB2W,EAAQxW,OACJ,GAAIjG,OAAM,sDAAwD2F,EAAKvE,KAAO,0EAE9E,GAAIpB,OAAM,UAAY2F,EAAKvE,KAAO,mBAAqBqb,EAAQxW,OAAS,8CAE7EwW,GAAQxW,SACXwW,EAAQxW,OAAS,YACnBwW,EAAQ3W,MAAQA,OAKtBxE,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MAEjBA,KAAKuc,WACLvc,KAAK+B,QAAQK,oBAuEjBC,EAAewa,EAAc,YAC3B7X,MAAO,WACL,MAAO,YA8NXpC,EAAK,SAAU,SAASub,GACtB,MAAO,UAAStb,GAGd,aAFO7C,MAAK+B,QAAQK,cAAcS,SAC3B7C,MAAKuc,QAAQ1Z,GACbsb,EAAI3b,KAAKxC,KAAM6C,MAI1BD,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,MAAIpH,MAAKuc,QAAQnV,EAAKvE,OACpBuE,EAAKE,SAASI,OAAS,UAChB,KAGTN,EAAKE,SAASjD,KAAO+C,EAAKE,SAASjD,SAE5ByK,EAAMtM,KAAKxC,KAAMoH,OAI5BxE,EAAK,YAAa,SAASmM,GAEzB,MAAO,UAAS3H,GAEd,MADAA,GAAKE,SAASjD,KAAO+C,EAAKE,SAASjD,SAC5B6H,QAAQC,QAAQ4C,EAAUsG,MAAMrV,KAAMsV,YAAY1J,KAAK,SAAS5B,GAIrE,OAF4B,YAAxB5C,EAAKE,SAASI,QAAgD,UAAxBN,EAAKE,SAASI,SAAuBN,EAAKE,SAASI,QAAUqC,EAAqB3C,EAAK4C,WAC/H5C,EAAKE,SAASI,OAAS,YAClBsC,OAMbpH,EAAK,OAAQ,SAASwb,GACpB,MAAO,UAAS3H,GACd,GAAI/S,GAAS1D,KACTuH,EAAQ7D,EAAO6Y,QAAQ9F,EAE3B,QAAKlP,GAASA,EAAMlD,KAAKtD,OAChBqd,EAAO/I,MAAMrV,KAAMsV,YAE5B/N,EAAM4C,gBAAkB5C,EAAMgD,kBAI9B+F,EAAKmG,EAAYlP,EAAO7D,GAGxBia,EAAgBlH,EAAYlP,KAAW7D,GAClC6D,EAAM3C,WACT2C,EAAM3C,SAAWlB,EAAO8E,UAAUjB,EAAMmD,OAAO/F,UAG5CjB,EAAOuN,QACVvN,EAAO6Y,QAAQ9F,GAAcnX,QAG/BoE,EAAO4E,IAAImO,EAAYlP,EAAM3C,UAEtBsH,QAAQC,cAInBvJ,EAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACc,UAAxBA,EAAKE,SAASI,SAChBN,EAAKE,SAASI,OAASpI,QAIzB0P,EAAYxM,KAAKxC,KAAMoH,EAEvB,IAEIG,GAFA7D,EAAS1D,IAKb,IAAI0D,EAAO6Y,QAAQnV,EAAKvE,MACtB0E,EAAQ7D,EAAO6Y,QAAQnV,EAAKvE,MAEvB0E,EAAM+C,cACT/C,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,OAC/CkD,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,UAK1C,IAAI+C,EAAKE,SAASC,MACrBA,EAAQH,EAAKE,SAASC,MACtBA,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,UAK1C,MAAMX,EAAO6F,SAAWnC,EAAKE,SAASoP,QACX,YAAxBtP,EAAKE,SAASI,QAAgD,OAAxBN,EAAKE,SAASI,QAA2C,OAAxBN,EAAKE,SAASI,QAAkB,CAK7G,GAHqB,mBAAV2W,SACTA,OAAO7b,KAAKkB,EAAQ0D,IAEjBA,EAAKE,SAASC,QAAUH,EAAKE,SAASoP,OACzC,KAAM,IAAIjV,OAAM2F,EAAKvE,KAAO,gBAAkBuE,EAAKE,SAASI,OAAS,uBAEvEH,GAAQH,EAAKE,SAASC,MAGlBA,GAASH,EAAKE,SAASjD,OACzBkD,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,OAI5CkD,IACHA,EAAQC,IACRD,EAAMlD,KAAO+C,EAAKE,SAASjD,KAC3BkD,EAAME,QAAU,cAIlB/D,EAAO6Y,QAAQnV,EAAKvE,MAAQ0E,CAE5B,IAAI+W,GAAUla,EAAMmD,EAAMlD,KAE1BkD,GAAMlD,KAAOia,EAAQha,MACrBiD,EAAM4C,gBAAkBmU,EAAQ/Z,QAChCgD,EAAM1E,KAAOuE,EAAKvE,KAClB0E,EAAMoD,WAAavD,EAAKE,SAASqD,cAAe,CAIhD,KAAK,GADD4T,MACKzd,EAAI,EAAG0D,EAAI+C,EAAMlD,KAAKtD,OAAYyD,EAAJ1D,EAAOA,IAC5Cyd,EAAkBze,KAAKoM,QAAQC,QAAQzI,EAAOiI,UAAUpE,EAAMlD,KAAKvD,GAAIsG,EAAKvE,OAE9E,OAAOqJ,SAAQqD,IAAIgP,GAAmB3S,KAAK,SAASrB,GAIlD,MAFAhD,GAAMgD,eAAiBA,GAGrBlG,KAAMkD,EAAMlD,KACZoD,QAAS,WAgBP,MAbA6I,GAAKlJ,EAAKvE,KAAM0E,EAAO7D,GAGvBia,EAAgBvW,EAAKvE,KAAM0E,KAAW7D,GAEjC6D,EAAM3C,WACT2C,EAAM3C,SAAWlB,EAAO8E,UAAUjB,EAAMmD,OAAO/F,UAG5CjB,EAAOuN,QACVvN,EAAO6Y,QAAQnV,EAAKvE,MAAQvD,QAGvBiI,EAAM3C,mBA6BzBhC,EAAK,kBAAmB,SAAS4b,GAC/B,MAAO,UAASpX,EAAMkU,GACpB,GAAIA,IAAclU,EAAKE,SAAS3C,WAAa4H,GAAoC,UAAxBnF,EAAKE,SAASI,QACrE,MAAO8W,GAAehc,KAAKxC,KAAMoH,EAAMkU,EAEzClU,GAAKE,SAASI,OAAS,QACvB,IAAIH,GAAQH,EAAKE,SAASC,MAAQC,GAClCD,GAAMlD,KAAO+C,EAAKE,SAASjD,IAC3B,IAAIwG,GAAcD,EAAexD,EAAKE,SAAS3C,QAC/C4C,GAAME,QAAU,WACd,MAAOoD,OAKb9H,EAAgB,SAAS0O,GACvB,MAAO,YAYL,QAASgN,GAAcC,GACrB,GAAIrZ,OAAOsZ,KACTtZ,OAAOsZ,KAAKve,GAAU+Q,QAAQuN,OAE9B,KAAK,GAAIE,KAAKxe,GACP2D,EAAevB,KAAKpC,EAAUwe,IAEnCF,EAASE,GAIf,QAASC,GAAmBH,GAC1BD,EAAc,SAASK,GACrB,GAAoD,IAAhD7d,EAAQuB,KAAKuc,EAAoBD,GAArC,CAEA,IACE,GAAI9Z,GAAQ5E,EAAS0e,GAEvB,MAAO9R,GACL+R,EAAmBjf,KAAKgf,GAE1BJ,EAASI,EAAY9Z,MAhCzB,GAAItB,GAAS1D,IACbyR,GAAYjP,KAAKkB,EAEjB,IAMIsb,GANAjb,EAAiBsB,OAAOvC,UAAUiB,eAGlCgb,GAAsB,KAAM,iBAAkB,eAAgB,gBAAiB,SAAU,eAAgB,WAC3G,wBAAyB,oBAAqB,kBAAmB,kBAAmB,kBA6BtFrb,GAAO4E,IAAI,mBAAoB5E,EAAO8E,WACpCyW,cAAe,SAAShR,EAAYtJ,EAASua,EAASC,GAEpD,GAAIC,GAAYhf,EAASsR,MAEzBtR,GAASsR,OAASpS,MAGlB,IAAI+f,EACJ,IAAIH,EAAS,CACXG,IACA,KAAK,GAAIT,KAAKM,GACZG,EAAWT,GAAKxe,EAASwe,GACzBxe,EAASwe,GAAKM,EAAQN,GAc1B,MATKja,KACHqa,KAEAH,EAAmB,SAAShc,EAAMmC,GAChCga,EAAenc,GAAQmC,KAKpB,WACL,GAEIsa,GAFAzU,EAAclG,EAAUiG,EAAejG,MAGvC4a,IAAoB5a,CA6BxB,MA3BKA,GAAWwa,IACdN,EAAmB,SAAShc,EAAMmC,GAC5Bga,EAAenc,KAAUmC,GAET,mBAATA,KAIPma,IACF/e,EAASyC,GAAQvD,QAEdqF,IACHkG,EAAYhI,GAAQmC,EAEO,mBAAhBsa,GACJC,GAAmBD,IAAiBta,IACvCua,GAAkB,GAGpBD,EAAeta,MAKvB6F,EAAc0U,EAAkB1U,EAAcyU,EAG1CD,EACF,IAAK,GAAIT,KAAKS,GACZjf,EAASwe,GAAKS,EAAWT,EAI7B,OAFAxe,GAASsR,OAAS0N,EAEXvU,UAMjB9H,EAAgB,SAAS0O,GACvB,MAAO,YAOL,QAAS+N,GAAYxb,GACnB,MAAyB,YAArBA,EAAK5C,OAAO,EAAG,GACV4C,EAAK5C,OAAO,IAAME,GAEvBme,GAAgBzb,EAAK5C,OAAO,EAAGqe,EAAa1e,SAAW0e,EAClDzb,EAAK5C,OAAOqe,EAAa1e,QAE3BiD,EAbT,GAAIN,GAAS1D,IAGb,IAFAyR,EAAYjP,KAAKkB,GAEI,mBAAV8I,SAA4C,mBAAZE,WAA2BF,OAAOa,SAC3E,GAAIoS,GAAepS,SAASxO,SAAW,KAAOwO,SAASpO,UAAYoO,SAASnO,KAAO,IAAMmO,SAASnO,KAAO,GAY3GwE,GAAO4E,IAAI,gBAAiB5E,EAAO8E,WACjCkX,eAAgB,SAASpR,EAASqR,GAChC,MAAOH,GAAY9b,EAAOqU,cAAczJ,EAASqR,KAEnDC,YAAa,SAASC,GAEpB,GACIC,GADAC,EAAcF,EAASngB,YAAY,IAGrCogB,GADiB,IAAfC,EACSF,EAASze,OAAO,EAAG2e,GAEnBF,CAEb,IAAIG,GAAUF,EAASlf,MAAM,IAI7B,OAHAof,GAAQngB,MACRmgB,EAAUA,EAAQjgB,KAAK,MAGrB+f,SAAUN,EAAYM,GACtBE,QAASR,EAAYQ,WAW/Bpd,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GAId,MAFIA,GAAKE,SAASkU,YAAcna,IAC9BjB,EAASsR,OAAS1R,KAAKigB,WAClBnR,EAAMtM,KAAKxC,KAAMoH,MAI5BrE,EAAgB,SAAS0O,GACvB,MAAO,YAYL,QAASyO,GAAWlW,EAAQmW,GAG1BnW,EAASA,EAAOtL,QAAQ0hB,EAAc,GAGtC,IAAIC,GAASrW,EAAOrL,MAAM2hB,GACtBC,GAAgBF,EAAO,GAAGzf,MAAM,KAAKuf,IAAiB,WAAWzhB,QAAQ8hB,EAAS,IAGlFC,EAAeC,EAAcH,KAAkBG,EAAcH,GAAgB,GAAI9H,QAAOkI,EAAgBJ,EAAeK,EAAgB,KAE3IH,GAAaI,UAAY,CAKzB,KAHA,GAEIliB,GAFA0F,KAGG1F,EAAQ8hB,EAAaxN,KAAKjJ,IAC/B3F,EAAKvE,KAAKnB,EAAM,IAAMA,EAAM,GAE9B,OAAO0F,GAOT,QAAS8E,GAAQ7E,EAAOoa,EAAUoC,EAASC,GAEzC,GAAoB,gBAATzc,MAAuBA,YAAiBsB,QACjD,MAAOuD,GAAQkM,MAAM,KAAMzP,MAAM9C,UAAUiO,OAAOvO,KAAK8S,UAAW,EAAGA,UAAUvU,OAAS,GAK1F,IAFoB,gBAATuD,IAAwC,kBAAZoa,KACrCpa,GAASA,MACPA,YAAiBsB,QAWhB,CAAA,GAAoB,gBAATtB,GAAmB,CACjC,GAAI6R,GAAqBzS,EAAOkR,qBAA4D,OAArCtQ,EAAMlD,OAAOkD,EAAMvD,OAAS,EAAG,GAClF0V,EAAa/S,EAAO0S,eAAe9R,EAAOyc,EAC1C5K,IAAqE,OAA/CM,EAAWrV,OAAOqV,EAAW1V,OAAS,EAAG,KACjE0V,EAAaA,EAAWrV,OAAO,EAAGqV,EAAW1V,OAAS,GACxD,IAAI2J,GAAShH,EAAOpB,IAAImU,EACxB,KAAK/L,EACH,KAAM,IAAIjJ,OAAM,sCAAwC6C,EAAQ,QAAUmS,GAAcsK,EAAU,UAAYA,EAAU,KAAO,KACjI,OAAOrW,GAAOyK,aAAezK,EAAO,WAAaA,EAIjD,KAAM,IAAInM,WAAU,mBArBpB,IAAK,GADDyiB,MACKlgB,EAAI,EAAGA,EAAIwD,EAAMvD,OAAQD,IAChCkgB,EAAgBlhB,KAAK4D,EAAO,UAAUY,EAAMxD,GAAIigB,GAClD7U,SAAQqD,IAAIyR,GAAiBpV,KAAK,SAAS1J,GACrCwc,GACFA,EAASrJ,MAAM,KAAMnT,IACtB4e,GAmBP,QAASpP,GAAO7O,EAAMwB,EAAM4c,GAuC1B,QAASxZ,GAAQyZ,EAAKvc,EAAS+F,GAiB3B,QAASyW,GAAkB7c,EAAOoa,EAAUoC,GAC1C,MAAoB,gBAATxc,IAAwC,kBAAZoa,GAC9BwC,EAAI5c,GACN6E,EAAQ3G,KAAKkB,EAAQY,EAAOoa,EAAUoC,EAASpW,EAAO4S,IAlBjE,IAAK,GADD8D,MACKtgB,EAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/BsgB,EAAUthB,KAAKohB,EAAI7c,EAAKvD,IAE1B4J,GAAO2W,IAAM3W,EAAO4S,GAEpB5S,EAAOiL,OAAS,aAGG,IAAf2L,GACFF,EAAUrQ,OAAOuQ,EAAa,EAAG5W,GAEf,IAAhB6W,GACFH,EAAUrQ,OAAOwQ,EAAc,EAAG5c,GAEhB,IAAhBwb,IAMFgB,EAAkBK,MAAQ,SAAS3e,GAEjC,GAAIsT,GAAqBzS,EAAOkR,qBAA0D,OAAnC/R,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAChF1C,EAAMqF,EAAO0S,eAAevT,EAAM6H,EAAO4S,GAG7C,OAFInH,IAAuD,OAAjC9X,EAAI+C,OAAO/C,EAAI0C,OAAS,EAAG,KACnD1C,EAAMA,EAAI+C,OAAO,EAAG/C,EAAI0C,OAAS,IAC5B1C,GAET+iB,EAAUrQ,OAAOoP,EAAc,EAAGgB,GAIpC,IAAIvG,GAAaxa,EAAS+I,OAC1B/I,GAAS+I,QAAUA,CAEnB,IAAIxJ,GAASshB,EAAQ5L,MAAsB,IAAhBkM,EAAqBnhB,EAAWuE,EAASyc,EAOpE,OALAhhB,GAAS+I,QAAUyR,EAEE,mBAAVjb,IAAyB+K,IAClC/K,EAAS+K,EAAO/F,SAEG,mBAAVhF,GACFA,EADT,OAlFiB,gBAARkD,KACToe,EAAU5c,EACVA,EAAOxB,EACPA,EAAO,MAEHwB,YAAgBuB,SACpBqb,EAAU5c,EACVA,GAAQ,UAAW,UAAW,UAAU0M,OAAO,EAAGkQ,EAAQlgB,SAGtC,kBAAXkgB,KACTA,EAAU,SAAUA,GAClB,MAAO,YAAa,MAAOA,KAC1BA,IAGyB3hB,SAA1B+E,EAAKA,EAAKtD,OAAS,IACrBsD,EAAKxE,KAGP,IAAIsgB,GAAcoB,EAAcD,CAEsB,MAAjDnB,EAAelf,EAAQuB,KAAK6B,EAAM,cAErCA,EAAK0M,OAAOoP,EAAc,GAIrBtd,IACHwB,EAAOA,EAAKwB,OAAOqa,EAAWe,EAAQtgB,WAAYwf,MAGA,KAAjDoB,EAAetgB,EAAQuB,KAAK6B,EAAM,aACrCA,EAAK0M,OAAOwQ,EAAc,GAEwB,KAA/CD,EAAcrgB,EAAQuB,KAAK6B,EAAM,YACpCA,EAAK0M,OAAOuQ,EAAa,EAkD3B,IAAI/Z,GAAQC,GACZD,GAAM1E,KAAOA,IAASa,EAAO0S,gBAAkB1S,EAAOiI,WAAWnJ,KAAKkB,EAAQb,GAC9E0E,EAAMlD,KAAOA,EACbkD,EAAME,QAAUA,EAEhB/D,EAAOsa,eACLC,KAAK,EACL1W,MAAOA,IAtKX,GAAI7D,GAAS1D,IACbyR,GAAYjP,KAAKxC,KAEjB,IAAIogB,GAAe,2CACfO,EAAgB,kCAChBC,EAAiB,6CACjBN,EAAiB,eACjBE,EAAU,aAEVE,IAgKJhP,GAAOuM,OAGPrb,EAAK,kBAAmB,SAAS4b,GAC/B,MAAO,UAASpX,EAAMkU,GAEpB,IAAKA,IAAaA,EAAS2C,IACzB,MAAOO,GAAehc,KAAKxC,KAAMoH,EAAMkU,EAEzC,IAAI4C,GAAU9W,GAAQA,EAAKE,SACvBC,EAAQ+T,EAAS/T,KAErB,IAAI2W,EACF,GAAKA,EAAQxW,QAA4B,UAAlBwW,EAAQxW,QAE1B,IAAKH,EAAM1E,MAA0B,OAAlBqb,EAAQxW,OAC9B,KAAM,IAAIjG,OAAM,qCAAuCyc,EAAQxW,OAAS,WAAaN,EAAKvE,UAF1Fqb,GAAQxW,OAAS,KAMrB,IAAKH,EAAM1E,KAkBLqb,IACGA,EAAQ3W,OAAU2W,EAAQxH,OAEtBwH,EAAQ3W,OAAS2W,EAAQ3W,MAAM1E,MAAQqb,EAAQ3W,MAAM1E,MAAQuE,EAAKvE,OACzEqb,EAAQ3W,MAAQjI,QAFhB4e,EAAQ3W,MAAQA,EAKlB2W,EAAQxH,QAAS,GAIbnP,EAAM1E,OAAQ7C,MAAKuc,UACvBvc,KAAKuc,QAAQhV,EAAM1E,MAAQ0E,OA9Bd,CACf,IAAK2W,EACH,KAAM,IAAI3f,WAAU,mCAEtB,IAAI2f,EAAQ3W,QAAU2W,EAAQ3W,MAAM1E,KAClC,KAAM,IAAIpB,OAAM,wCAA0C2F,EAAKvE,KAEjEqb,GAAQ3W,MAAQA,MA4BtB7D,EAAOuc,UAAYvO,EACnBhO,EAAO+d,WAAatY,KAWxB,WACE,QAASuY,GAAche,EAAQ0F,GAE7B,GAAIA,EAAY,CACd,GAAIuY,EACJ,IAAIje,EAAOmR,aACT,GAAyD,KAApD8M,EAAoBvY,EAAW1J,YAAY,MAC9C,MAAO0J,GAAWhI,OAAOugB,EAAoB,OAG/C,IAAqD,KAAhDA,EAAoBvY,EAAWnI,QAAQ,MAC1C,MAAOmI,GAAWhI,OAAO,EAAGugB,EAGhC,OAAOvY,IAIX,QAASwY,GAAYle,EAAQb,GAC3B,GAAIgf,GACAC,EAEA/B,EAAcld,EAAKnD,YAAY,IAEnC,OAAmB,IAAfqgB,GAGArc,EAAOmR,aACTgN,EAAehf,EAAKzB,OAAO2e,EAAc,GACzC+B,EAAajf,EAAKzB,OAAO,EAAG2e,KAG5B8B,EAAehf,EAAKzB,OAAO,EAAG2e,GAC9B+B,EAAajf,EAAKzB,OAAO2e,EAAc,IAAM8B,EAAazgB,OAAOygB,EAAaniB,YAAY,KAAO,KAIjGqiB,SAAUF,EACVG,OAAQF,IAdV,OAmBF,QAASG,GAAmBve,EAAQme,EAAcC,EAAY1K,GAI5D,MAHIA,IAAuE,OAAnDyK,EAAazgB,OAAOygB,EAAa9gB,OAAS,EAAG,KACnE8gB,EAAeA,EAAazgB,OAAO,EAAGygB,EAAa9gB,OAAS,IAE1D2C,EAAOmR,YACFiN,EAAa,IAAMD,EAGnBA,EAAe,IAAMC,EAOhC,QAASI,GAAsBxe,EAAQye,GACrC,MAAOze,GAAOkR,qBAAwD,OAAjCuN,EAAI/gB,OAAO+gB,EAAIphB,OAAS,EAAG,GAGlE,QAASqhB,GAAoBrK,GAC3B,MAAO,UAASlV,EAAMuG,EAAYsQ,GAChC,GAAIhW,GAAS1D,KAETqiB,EAAST,EAAYle,EAAQb,EAGjC,IAFAuG,EAAasY,EAAc1hB,KAAMoJ,IAE5BiZ,EACH,MAAOtK,GAAcvV,KAAKxC,KAAM6C,EAAMuG,EAAYsQ,EAGpD,IAAImI,GAAene,EAAOqU,cAAcsK,EAAON,SAAU3Y,GAAY,GACjE0Y,EAAape,EAAOqU,cAAcsK,EAAOL,OAAQ5Y,GAAY,EACjE,OAAO6Y,GAAmBve,EAAQme,EAAcC,EAAYI,EAAsBxe,EAAQ2e,EAAON,YAIrGnf,EAAK,iBAAkBwf,GACvBxf,EAAK,gBAAiBwf,GAEtBxf,EAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAYsQ,GAChC,GAAIhW,GAAS1D,IAEboJ,GAAasY,EAAc1hB,KAAMoJ,EAEjC,IAAIiZ,GAAST,EAAYle,EAAQb,EAEjC,OAAKwf,GAGEnW,QAAQqD,KACb7L,EAAOiI,UAAU0W,EAAON,SAAU3Y,GAAY,GAC9C1F,EAAOiI,UAAU0W,EAAOL,OAAQ5Y,GAAY,KAE7CwC,KAAK,SAAS6K,GACb,MAAOwL,GAAmBve,EAAQ+S,EAAW,GAAIA,EAAW,GAAIyL,EAAsBxe,EAAQ2e,EAAON,aAP9FpW,EAAUnJ,KAAKkB,EAAQb,EAAMuG,EAAYsQ,MAYtD9W,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAKIkb,GALA5e,EAAS1D,KAET6C,EAAOuE,EAAKvE,IAiBhB,OAbIa,GAAOmR,YACsC,KAA1CyN,EAAoBzf,EAAK5B,QAAQ,QACpCmG,EAAKE,SAAS5D,OAASb,EAAKzB,OAAO,EAAGkhB,GACtClb,EAAKvE,KAAOA,EAAKzB,OAAOkhB,EAAoB,IAIK,KAA9CA,EAAoBzf,EAAKnD,YAAY,QACxC0H,EAAKE,SAAS5D,OAASb,EAAKzB,OAAOkhB,EAAoB,GACvDlb,EAAKvE,KAAOA,EAAKzB,OAAO,EAAGkhB,IAIxB1T,EAAOpM,KAAKkB,EAAQ0D,GAC1BwE,KAAK,SAASoC,GACb,MAAyB,IAArBsU,GAA4Blb,EAAKE,SAAS5D,QAKtCA,EAAOwV,cAAgBxV,GAAQiI,UAAUvE,EAAKE,SAAS5D,OAAQ0D,EAAKvE,MAC3E+I,KAAK,SAAS2W,GAEb,MADAnb,GAAKE,SAAS5D,OAAS6e,EAChBvU,IAPAA,IAUVpC,KAAK,SAASoC,GACb,GAAIgU,GAAS5a,EAAKE,SAAS5D,MAE3B,KAAKse,EACH,MAAOhU,EAGT,IAAI5G,EAAKvE,MAAQmf,EACf,KAAM,IAAIvgB,OAAM,UAAYugB,EAAS,sHAGvC,IAAIte,EAAO6Y,SAAW7Y,EAAO6Y,QAAQ1Z,GACnC,MAAOmL,EAET,IAAIkL,GAAexV,EAAOwV,cAAgBxV,CAG1C,OAAOwV,GAAa,UAAU8I,GAC7BpW,KAAK,SAAS4W,GAKb,MAHApb,GAAKE,SAASkb,aAAeA,EAE7Bpb,EAAK4G,QAAUA,EACXwU,EAAa5T,OACR4T,EAAa5T,OAAOpM,KAAKkB,EAAQ0D,GAEnC4G,SAMfpL,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,GAAI1D,GAAS1D,IACb,IAAIoH,EAAKE,SAASkb,cAAwC,WAAxBpb,EAAKE,SAASI,OAAqB,CACnE,GAA0C,kBAA/BN,GAAKE,SAASkb,cAA+Bpb,EAAKE,SAASkb,uBAAwB5gB,IAAwD,kBAAvCwF,GAAKE,SAASkb,aAAdpb,WAC7G,MAAO,EAET,IADAA,EAAKE,SAASkU,YAAa,EACvBpU,EAAKE,SAASkb,aAAa1T,MAC7B,MAAO1H,GAAKE,SAASkb,aAAa1T,MAAMtM,KAAKkB,EAAQ0D,EAAM,SAASA,GAClE,MAAO0H,GAAMtM,KAAKkB,EAAQ0D,KAGhC,MAAO0H,GAAMtM,KAAKkB,EAAQ0D,MAI9BxE,EAAK,YAAa,SAASmM,GACzB,MAAO,UAAS3H,GACd,GAAI1D,GAAS1D,KACTyiB,EAAOnN,SACX,OAAIlO,GAAKE,SAASkb,cAAgBpb,EAAKE,SAASkb,aAAazT,WAAqC,WAAxB3H,EAAKE,SAASI,OAC/EwE,QAAQC,QAAQ/E,EAAKE,SAASkb,aAAazT,UAAUsG,MAAM3R,EAAQ+e,IAAO7W,KAAK,SAASvE,GAC7F,GAAIqb,GAAYtb,EAAKE,SAASob,SAG9B,IAAIA,EAAW,CACb,GAAwB,gBAAbA,GACT,KAAM,IAAIjhB,OAAM,oDAElB,IAAIkhB,GAAevb,EAAK4G,QAAQpN,MAAM,KAAK,EAGtC8hB,GAAUE,MAAQF,EAAUE,MAAQxb,EAAK4G,UAC5C0U,EAAUE,KAAOD,EAAe,iBAG7BD,EAAUG,SAAWH,EAAUG,QAAQ9hB,QAAU,KAAO2hB,EAAUG,QAAQ,IAAMH,EAAUG,QAAQ,IAAMzb,EAAK4G,YAChH0U,EAAUG,SAAWF,IASzB,MAHqB,gBAAVtb,KACTD,EAAK4C,OAAS3C,GAET0H,EAAUsG,MAAM3R,EAAQ+e,KAG5B1T,EAAUsG,MAAM3R,EAAQ+e,MAInC7f,EAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACd,GAAI1D,GAAS1D,KACT8iB,GAAoB,CAExB,IAAI1b,EAAKE,SAASkb,eAAiB9e,EAAO6F,SAAmC,WAAxBnC,EAAKE,SAASI,OAAqB,CACtF,GAAIN,EAAKE,SAASkb,aAAaxT,YAC7B,MAAO9C,SAAQC,QAAQ/E,EAAKE,SAASkb,aAAaxT,YAAYxM,KAAKkB,EAAQ0D,EAAM,SAASA,GACxF,GAAI0b,EACF,KAAM,IAAIrhB,OAAM,wCAElB,OADAqhB,IAAoB,EACb9T,EAAYxM,KAAKkB,EAAQ0D,MAC9BwE,KAAK,SAASvE,GAChB,MAAIyb,GACKzb,GAEM/H,SAAX+H,GACFF,EAAkBC,EAAMC,GACnB2H,EAAYxM,KAAKkB,EAAQ0D,KAE/B,IAA0C,kBAA/BA,GAAKE,SAASkb,cAA+Bpb,EAAKE,SAASkb,uBAAwB5gB,IAAwD,kBAAvCwF,GAAKE,SAASkb,aAAdpb,WAClH,MAAO8E,SAAQC,SAAS/E,EAAKE,SAASkb,aAAdpb,YAAsCA,EAAKE,SAASkb,cAAchgB,KAAKkB,EAAQ0D,EAAK4G,QAAS5G,EAAKvE,OACzH+I,KAAK,SAAUvE,GAGd,MAFe/H,UAAX+H,GACFF,EAAkBC,EAAMC,GACnB2H,EAAYxM,KAAKkB,EAAQ0D,KAGtC,MAAO4H,GAAYxM,KAAKkB,EAAQ0D,QA6CpC,IAAIiE,KAAiB,UAAW,OAAQ,MAAO,QAAS,aAAc,WAuDlEY,GAAqB,aAsDzBrJ,GAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAY2L,GAChC,GAAIrR,GAAS1D,IACb,OAAOqM,GAAmB7J,KAAKkB,EAAQb,EAAMuG,GAC5CwC,KAAK,SAAS/I,GACb,MAAO8I,GAAUnJ,KAAKkB,EAAQb,EAAMuG,EAAY2L,KAEjDnJ,KAAK,SAAS6K,GACb,MAAO1K,GAAuBvJ,KAAKkB,EAAQ+S,EAAYrN,QAY/D,WAEExG,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,GAAI2b,GAAQ3b,EAAKE,SAASyb,MACtBC,EAAY5b,EAAKE,SAASjD,QAC9B,IAAI0e,EAAO,CACT3b,EAAKE,SAASI,OAAS,SACvB,IAAIH,GAAQC,GAeZ,OAdAxH,MAAKuc,QAAQnV,EAAKvE,MAAQ0E,EAC1BA,EAAM+C,aAAc,EACpB/C,EAAMlD,KAAO2e,EAAUnd,QAAQkd,IAC/Bxb,EAAM6C,QAAU,SAAS6Y,GACvB,OACE5F,SAAU,SAAS3S,GACjB,IAAK,GAAI9K,KAAK8K,GACZuY,EAAQrjB,EAAG8K,EAAO9K,GAChB8K,GAAOyK,eACT5N,EAAMmD,OAAO/F,QAAQwQ,cAAe,KAExC1N,QAAS,eAGN,GAGT,MAAOqH,GAAMtM,KAAKxC,KAAMoH,SA8C9B,WA8CE,QAAS8b,GAAgBC,EAAQvjB,EAAGoF,GAGlC,IAFA,GACIoe,GADAxb,EAAShI,EAAEgB,MAAM,KAEdgH,EAAO7G,OAAS,GACrBqiB,EAAUxb,EAAOC,QACjBsb,EAASA,EAAOC,GAAWD,EAAOC,MAEpCA,GAAUxb,EAAOC,QACXub,IAAWD,KACfA,EAAOC,GAAWpe,GArDtBjC,EAAgB,SAAS0O,GACvB,MAAO,YACLzR,KAAKqG,QACLoL,EAAYjP,KAAKxC,SAIrB4C,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAQIkS,GARAjT,EAAOrG,KAAKqG,KACZxD,EAAOuE,EAAKvE,KAMZqX,EAAY,CAEhB,KAAK,GAAIxP,KAAUrE,GAEjB,GADAiT,EAAgB5O,EAAOzJ,QAAQ,KACT,KAAlBqY,GAEA5O,EAAOtJ,OAAO,EAAGkY,KAAmBzW,EAAKzB,OAAO,EAAGkY,IAChD5O,EAAOtJ,OAAOkY,EAAgB,KAAOzW,EAAKzB,OAAOyB,EAAK9B,OAAS2J,EAAO3J,OAASuY,EAAgB,GAAI,CACxG,GAAI+J,GAAQ3Y,EAAO9J,MAAM,KAAKG,MAC1BsiB,GAAQnJ,IACVA,EAAYmJ,GACd3d,EAAW0B,EAAKE,SAAUjB,EAAKqE,GAASwP,GAAamJ,GAQzD,MAHIhd,GAAKxD,IACP6C,EAAW0B,EAAKE,SAAUjB,EAAKxD,IAE1B+L,EAAOpM,KAAKxC,KAAMoH,KAM7B,IAAIkc,GAAY,uFACZC,EAAgB,uEAcpB3gB,GAAK,YAAa,SAASmM,GACzB,MAAO,UAAS3H,GAEd,GAA4B,WAAxBA,EAAKE,SAASI,OAEhB,MADAN,GAAKE,SAASjD,KAAO+C,EAAKE,SAASjD,SAC5B6H,QAAQC,QAAQ/E,EAAK4C,OAI9B,IAAI3D,GAAOe,EAAK4C,OAAOrL,MAAM2kB,EAC7B,IAAIjd,EAGF,IAAK,GAFDmd,GAAYnd,EAAK,GAAG1H,MAAM4kB,GAErBziB,EAAI,EAAGA,EAAI0iB,EAAUziB,OAAQD,IAAK,CACzC,GAAIsiB,GAAUI,EAAU1iB,GACpB2c,EAAM2F,EAAQriB,OAEd0iB,EAAYL,EAAQhiB,OAAO,EAAG,EAIlC,IAHkC,KAA9BgiB,EAAQhiB,OAAOqc,EAAM,EAAG,IAC1BA,IAEe,KAAbgG,GAAiC,KAAbA,EAAxB,CAGA,GAAIC,GAAaN,EAAQhiB,OAAO,EAAGgiB,EAAQriB,OAAS,GAChD4iB,EAAWD,EAAWtiB,OAAO,EAAGsiB,EAAWziB,QAAQ,KAEvD,IAAI0iB,EAAU,CACZ,GAAIC,GAAYF,EAAWtiB,OAAOuiB,EAAS5iB,OAAS,EAAG2iB,EAAW3iB,OAAS4iB,EAAS5iB,OAAS,EAE9C,OAA3C4iB,EAASviB,OAAOuiB,EAAS5iB,OAAS,EAAG,IACvC4iB,EAAWA,EAASviB,OAAO,EAAGuiB,EAAS5iB,OAAS,GAChDqG,EAAKE,SAASqc,GAAYvc,EAAKE,SAASqc,OACxCvc,EAAKE,SAASqc,GAAU7jB,KAAK8jB,IAEtBxc,EAAKE,SAASqc,YAAqB/d,QAE1Ca,EAAKjE,KAAKxC,KAAM,UAAYoH,EAAKvE,KAAO,8BAAgC+gB,EAAY,qDAAuDA,EAAY,gCACvJxc,EAAKE,SAASqc,GAAU7jB,KAAK8jB,IAG7BV,EAAgB9b,EAAKE,SAAUqc,EAAUC,OAI3Cxc,GAAKE,SAASoc,IAAc,GAKlC,MAAO3U,GAAUsG,MAAMrV,KAAMsV,iBAmBnC,WAMEvS,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MACjBA,KAAKgW,WACLhW,KAAK+B,QAAQ8hB,oBAKjBjhB,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAAI1D,GAAS1D,KACT8jB,GAAU,CAEd,MAAM1c,EAAKvE,OAAQa,GAAO6Y,SACxB,IAAK,GAAI/W,KAAK9B,GAAOsS,QAAS,CAC5B,IAAK,GAAIlV,GAAI,EAAGA,EAAI4C,EAAOsS,QAAQxQ,GAAGzE,OAAQD,IAAK,CACjD,GAAIijB,GAAYrgB,EAAOsS,QAAQxQ,GAAG1E,EAElC,IAAIijB,GAAa3c,EAAKvE,KAAM,CAC1BihB,GAAU,CACV,OAIF,GAA8B,IAA1BC,EAAU9iB,QAAQ,KAAY,CAChC,GAAI+iB,GAAQD,EAAUnjB,MAAM,IAC5B,IAAoB,GAAhBojB,EAAMjjB,OAAa,CACrB2C,EAAOsS,QAAQxQ,GAAGuL,OAAOjQ,IAAK,EAC9B,UAGF,GAAIsG,EAAKvE,KAAKohB,UAAU,EAAGD,EAAM,GAAGjjB,SAAWijB,EAAM,IACjD5c,EAAKvE,KAAKzB,OAAOgG,EAAKvE,KAAK9B,OAASijB,EAAM,GAAGjjB,OAAQijB,EAAM,GAAGjjB,SAAWijB,EAAM,IACyB,IAAxG5c,EAAKvE,KAAKzB,OAAO4iB,EAAM,GAAGjjB,OAAQqG,EAAKvE,KAAK9B,OAASijB,EAAM,GAAGjjB,OAASijB,EAAM,GAAGjjB,QAAQE,QAAQ,KAAY,CAC9G6iB,GAAU,CACV,SAKN,GAAIA,EACF,MAAOpgB,GAAO,UAAU8B,GACvBoG,KAAK,WACJ,MAAOgD,GAAOpM,KAAKkB,EAAQ0D,KAInC,MAAOwH,GAAOpM,KAAKkB,EAAQ0D,SA0BjC,WACErE,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MACjBA,KAAKsG,eAIT1D,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAAI1D,GAAS1D,KAETqE,EAAOX,EAAO4C,SAASc,EAAKvE,KAChC,IAAIwB,EACF,IAAK,GAAIvD,GAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/B4C,EAAO,UAAUW,EAAKvD,GAAIsG,EAAKvE,KAEnC,OAAO+L,GAAOpM,KAAKkB,EAAQ0D,SASjCrE,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAY4D,MAAMrV,KAAMsV,WACxBlV,EAASsR,OAAS1R,KAAKigB,aAI3Brd,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GAEd,MADAA,GAAKE,SAASkU,YAAa,EACpB1M,EAAMtM,KAAKxC,KAAMoH,MAEzBkL,EAAS,GAAI/P,GAEhBnC,EAAS8jB,SAAW5R,EACpBA,EAAO6R,QAAU,cACM,gBAAVzZ,SAAsBA,OAAO/F,SAA6B,gBAAXA,WACxD+F,OAAO/F,QAAU2N,GAEnBlS,EAASkS,OAASA,GAEF,mBAARnS,MAAsBA,KAAOhC,QAGvC,GAAIimB,GAAgC,mBAAZlY,QAGxB,IAAwB,mBAAbQ,UAA0B,CACnC,GAAI2X,GAAU3X,SAASS,qBAAqB,SAM5C,IALAnM,aAAeqjB,EAAQA,EAAQtjB,OAAS,GACpC2L,SAAS4X,gBAAkBtjB,aAAaujB,OAASvjB,aAAa+a,SAChE/a,aAAe0L,SAAS4X,eACrBtjB,aAAaE,MAChBF,aAAe1B,QACb8kB,EAAY,CACd,GAAII,GAAUxjB,aAAaE,IACvBujB,EAAWD,EAAQpjB,OAAO,EAAGojB,EAAQ9kB,YAAY,KAAO,EAC5D8M,QAAOkY,kBAAoBxmB,EAC3BwO,SAASiY,MACP,uCAA8CF,EAAW,sCAI3DvmB,SAIC,IAA6B,mBAAlBuO,eAA+B,CAC7C,GAAIgY,GAAW,EACf,KACE,KAAM,IAAIhjB,OAAM,KAChB,MAAOuL,GACPA,EAAEvM,MAAM/B,QAAQ,iCAAkC,SAASF,EAAGH,GAC5D2C,cAAiBE,IAAK7C,GACtBomB,EAAWpmB,EAAIK,QAAQ,YAAa,OAGpC0lB,GACF3X,cAAcgY,EAAW,uBAC3BvmB,QAGA8C,cAAoC,mBAAd4jB,aAA8B1jB,IAAK0jB,YAAe,KACxE1mB"} \ No newline at end of file diff --git a/node_modules/systemjs/dist/system-csp-production.src.js b/node_modules/systemjs/dist/system-csp-production.src.js index 70dd9125f..b727e9bdf 100644 --- a/node_modules/systemjs/dist/system-csp-production.src.js +++ b/node_modules/systemjs/dist/system-csp-production.src.js @@ -1,5 +1,5 @@ /* - * SystemJS v0.19.41 + * SystemJS v0.19.47 */ (function() { function bootstrap() {// from https://gist.github.com/Yaffle/1088850 @@ -7,7 +7,7 @@ function bootstrap() {// from https://gist.github.com/Yaffle/1088850 function URLPolyfill(url, baseURL) { if (typeof url != 'string') throw new TypeError('URL must be a string'); - var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); + var m = String(url).replace(/^\s+|\s+$/g, "").replace(/\\/g, '/').match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); if (!m) throw new RangeError('Invalid URL format'); var protocol = m[1] || ""; @@ -65,7 +65,8 @@ function URLPolyfill(url, baseURL) { this.hash = hash; } global.URLPolyfill = URLPolyfill; -})(typeof self != 'undefined' ? self : global);(function(__global) { +})(typeof self != 'undefined' ? self : global); +(function(__global) { var isWorker = typeof window == 'undefined' && typeof self != 'undefined' && typeof importScripts != 'undefined'; var isBrowser = typeof window != 'undefined' && typeof document != 'undefined'; @@ -83,7 +84,7 @@ global.URLPolyfill = URLPolyfill; } return -1; }; - + var defineProperty; (function () { try { @@ -120,9 +121,9 @@ global.URLPolyfill = URLPolyfill; newMsg = newMsg.replace(isWindows ? /file:\/\/\//g : /file:\/\//g, ''); var newErr = errArgs ? new Error(newMsg, err.fileName, err.lineNumber) : new Error(newMsg); - + newErr.stack = newMsg; - + // track the original error newErr.originalErr = err.originalErr || err; @@ -431,7 +432,7 @@ function logloads(loads) { .then(function(instantiateResult) { if (instantiateResult === undefined) throw new TypeError('Declarative modules unsupported in the polyfill.'); - + if (typeof instantiateResult != 'object') throw new TypeError('Invalid instantiate return value'); @@ -494,8 +495,6 @@ function logloads(loads) { for (var i = 0, l = linkSets.length; i < l; i++) { linkSetFailed(linkSets[i], load, exc); } - - console.assert(load.linkSets.length == 0, 'linkSets not removed'); }); } @@ -548,7 +547,6 @@ function logloads(loads) { proceedToFetch(loader, load, Promise.resolve(stepState.moduleAddress)); else { - console.assert(step == 'translate', 'translate step'); load.address = stepState.moduleAddress; proceedToTranslate(loader, load, Promise.resolve(stepState.moduleSource)); } @@ -636,9 +634,6 @@ function logloads(loads) { function updateLinkSetOnLoad(linkSet, load) { // console.log('update linkset on load ' + load.name); // snapshot(linkSet.loader); - - console.assert(load.status == 'loaded' || load.status == 'linked', 'loaded or linked'); - linkSet.loadingCount--; if (linkSet.loadingCount > 0) @@ -671,8 +666,6 @@ function logloads(loads) { if (abrupt) return; - console.assert(linkSet.loads.length == 0, 'loads cleared'); - linkSet.resolve(startingLoad); } @@ -681,7 +674,7 @@ function logloads(loads) { var loader = linkSet.loader; var requests; - checkError: + checkError: if (load) { if (linkSet.loads[0].name == load.name) { exc = addToError(exc, 'Error loading ' + load.name); @@ -715,7 +708,6 @@ function logloads(loads) { loader.loaderObj.failed.push(load); var linkIndex = indexOf.call(load.linkSets, linkSet); - console.assert(linkIndex != -1, 'link not present'); load.linkSets.splice(linkIndex, 1); if (load.linkSets.length == 0) { var globalLoadsIndex = indexOf.call(linkSet.loader.loads, load); @@ -747,7 +739,6 @@ function logloads(loads) { } // if not anonymous, add to the module table if (load.name) { - console.assert(!loader.modules[load.name] || loader.modules[load.name].module === load.module.module, 'load not in module table'); loader.modules[load.name] = load.module; } var loadIndex = indexOf.call(loader.loads, load); @@ -857,7 +848,7 @@ function logloads(loads) { var loader = this._loader; if (loader.modules[name]) return Promise.resolve(); - return loader.importPromises[name] || createImportPromise(this, name, new Promise(asyncStartLoadPartwayThrough({ + return (loader.importPromises[name] || createImportPromise(this, name, new Promise(asyncStartLoadPartwayThrough({ step: 'locate', loader: loader, moduleName: name, @@ -865,9 +856,11 @@ function logloads(loads) { moduleSource: undefined, moduleAddress: undefined })) - .then(function() { + .then(function(load) { delete loader.importPromises[name]; - })); + return load.module.module; + }))) + .then(function () {}); }, // 26.3.3.11 module: function(source, options) { @@ -977,7 +970,6 @@ function logloads(loads) { })(); var System; - // SystemJS Loader Class and Extension helpers function SystemJSLoader() { Loader.call(this); @@ -1054,7 +1046,7 @@ function applyPaths(loader, name) { if (p.indexOf('*') === -1) { if (name == p) return paths[p]; - + // support trailing / in paths rules else if (name.substr(0, p.length - 1) == p.substr(0, p.length - 1) && (name.length < p.length || name[p.length - 1] == p[p.length - 1]) && (paths[p][paths[p].length - 1] == '/' || paths[p] == '')) { return paths[p].substr(0, paths[p].length - 1) + (name.length > p.length ? (paths[p] && '/' || '') + name.substr(p.length) : ''); @@ -1208,7 +1200,7 @@ function extendPkgConfig(pkgCfgA, pkgCfgB, pkgName, loader, warnInvalidPropertie loader.depCache[dNormalized] = (loader.depCache[dNormalized] || []).concat(pkgCfgB.depCache[d]); } } - else if (warnInvalidProperties && indexOf.call(['browserConfig', 'nodeConfig', 'devConfig', 'productionConfig'], prop) == -1 && + else if (warnInvalidProperties && indexOf.call(['browserConfig', 'nodeConfig', 'devConfig', 'productionConfig'], prop) == -1 && (!pkgCfgB.hasOwnProperty || pkgCfgB.hasOwnProperty(prop))) { warn.call(loader, '"' + prop + '" is not a valid package configuration option in package ' + pkgName); } @@ -1230,7 +1222,7 @@ function setPkgConfig(loader, pkgName, cfg, prependConfig) { extendPkgConfig(pkg, prependConfig ? cfg : basePkg, pkgName, loader, prependConfig); extendPkgConfig(pkg, prependConfig ? basePkg : cfg, pkgName, loader, !prependConfig); } - + // main object becomes main map if (typeof pkg.main == 'object') { pkg.map = pkg.map || {}; @@ -1246,6 +1238,15 @@ function warn(msg) { if (this.warnings && typeof console != 'undefined' && console.warn) console.warn(msg); } + +function createInstantiate (load, result) { + load.metadata.entry = createEntry(); + load.metadata.entry.execute = function() { + return result; + } + load.metadata.entry.deps = []; + load.metadata.format = 'defined'; +} var fetchTextFromURL; if (typeof XMLHttpRequest != 'undefined') { fetchTextFromURL = function(url, authorization, fulfill, reject) { @@ -2674,7 +2675,7 @@ SystemJSLoader.prototype.config = function(cfg, isEnvConfig) { * * * The code here replicates the ES6 linking groups algorithm to ensure that - * circular ES6 compiled into System.register can work alongside circular AMD + * circular ES6 compiled into System.register can work alongside circular AMD * and CommonJS, identically to the actual ES6 loader. * */ @@ -2684,7 +2685,7 @@ SystemJSLoader.prototype.config = function(cfg, isEnvConfig) { * Registry side table entries in loader.defined * Registry Entry Contains: * - name - * - deps + * - deps * - declare for declarative modules * - execute for dynamic modules, different to declarative execute on module * - executingRequire indicates require drives execution for circularity of dynamic modules @@ -2702,7 +2703,7 @@ SystemJSLoader.prototype.config = function(cfg, isEnvConfig) { * For dynamic we track the es module with: * - esModule actual es module value * - esmExports whether to extend the esModule with named exports - * + * * Then for declarative only we track dynamic bindings with the 'module' records: * - name * - exports @@ -2747,7 +2748,7 @@ function createEntry() { * see https://github.com/ModuleLoader/es6-module-loader/wiki/System.register-Explained * * 2. System.registerDynamic for dynamic modules (3-4 params) - System.registerDynamic([name, ]deps, executingRequire, execute) - * the true or false statement + * the true or false statement * * this extension implements the linking algorithm for the two variations identical to the spec * allowing compiled ES6 circular references to work alongside AMD and CJS circular references. @@ -2766,7 +2767,7 @@ function createEntry() { return this.registerDynamic.apply(this, arguments); var entry = createEntry(); - // ideally wouldn't apply map config to bundle names but + // ideally wouldn't apply map config to bundle names but // dependencies go through map regardless so we can't restrict // could reconsider in shift to new spec entry.name = name && (this.decanonicalize || this.normalize).call(this, name); @@ -2852,17 +2853,17 @@ function createEntry() { for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { var depName = entry.normalizedDeps[i]; var depEntry = loader.defined[depName]; - + // not in the registry means already linked / ES6 if (!depEntry || depEntry.evaluated) continue; - + // now we know the entry is in our unlinked linkage group var depGroupIndex = entry.groupIndex + (depEntry.declarative != entry.declarative); // the group index of an entry is always the maximum if (depEntry.groupIndex === null || depEntry.groupIndex < depGroupIndex) { - + // if already in a group, remove from the old group if (depEntry.groupIndex !== null) { groups[depEntry.groupIndex].splice(indexOf.call(groups[depEntry.groupIndex], depEntry), 1); @@ -2902,7 +2903,7 @@ function createEntry() { else linkDynamicModule(entry, loader); } - curGroupDeclarative = !curGroupDeclarative; + curGroupDeclarative = !curGroupDeclarative; } } @@ -2962,7 +2963,7 @@ function createEntry() { // allowing undefined declaration was a mistake! To be deprecated. declaration = declaration || { setters: [], execute: function() {} }; - + module.setters = declaration.setters; module.execute = declaration.execute; @@ -3005,7 +3006,7 @@ function createEntry() { else { module.dependencies.push(null); } - + // run setters for all entries with the matching dependency name var originalIndices = entry.originalIndices[i]; for (var j = 0, len = originalIndices.length; j < len; ++j) { @@ -3031,7 +3032,7 @@ function createEntry() { else { if (entry.declarative) ensureEvaluated(name, entry, [], loader); - + else if (!entry.evaluated) linkDynamicModule(entry, loader); @@ -3040,7 +3041,7 @@ function createEntry() { if ((!entry || entry.declarative) && exports && exports.__useDefault) return exports['default']; - + return exports; } @@ -3078,7 +3079,7 @@ function createEntry() { throw new Error('Module ' + name + ' not declared as a dependency of ' + entry.name); }, exports, module); - + if (output !== undefined) module.exports = output; @@ -3102,7 +3103,7 @@ function createEntry() { * (unless one is a circular dependency already in the list of seen * modules, in which case we execute it) * - * Then we evaluate the module itself depth-first left to right + * Then we evaluate the module itself depth-first left to right * execution to match ES6 modules */ function ensureEvaluated(moduleName, entry, seen, loader) { @@ -3148,7 +3149,7 @@ function createEntry() { } load.metadata.deps = load.metadata.deps || []; - + return fetch.call(this, load); }; }); @@ -3159,7 +3160,7 @@ function createEntry() { load.metadata.deps = load.metadata.deps || []; return Promise.resolve(translate.apply(this, arguments)).then(function(source) { // run detection for register format - if (load.metadata.format == 'register' || !load.metadata.format && detectRegisterFormat(load.source)) + if (load.metadata.format == 'register' || load.metadata.format == 'system' || !load.metadata.format && detectRegisterFormat(load.source)) load.metadata.format = 'register'; return source; }); @@ -3177,7 +3178,7 @@ function createEntry() { entry.originalIndices = entry.normalizedDeps = []; - // recursively ensure that the module and all its + // recursively ensure that the module and all its // dependencies are linked (with dependency group handling) link(normalized, entry, loader); @@ -3228,9 +3229,9 @@ function createEntry() { // Contains System.register calls // (dont run bundles in the builder) - else if (!(loader.builder && load.metadata.bundle) + else if (!(loader.builder && load.metadata.bundle) && (load.metadata.format == 'register' || load.metadata.format == 'esm' || load.metadata.format == 'es6')) { - + if (typeof __exec != 'undefined') __exec.call(loader, load); @@ -3253,9 +3254,9 @@ function createEntry() { // place this module onto defined for circular references loader.defined[load.name] = entry; - + var grouped = group(entry.deps); - + entry.deps = grouped.names; entry.originalIndices = grouped.indices; entry.name = load.name; @@ -3273,7 +3274,7 @@ function createEntry() { return { deps: entry.deps, execute: function() { - // recursively ensure that the module and all its + // recursively ensure that the module and all its // dependencies are linked (with dependency group handling) link(load.name, entry, loader); @@ -3909,15 +3910,16 @@ hookConstructor(function(constructor) { hook('fetch', function(fetch) { return function(load) { var loader = this; - if (load.metadata.loaderModule && load.metadata.loaderModule.fetch && load.metadata.format != 'defined') { + if (load.metadata.loaderModule && load.metadata.format != 'defined') { + if (typeof load.metadata.loaderModule === 'function' || load.metadata.loaderModule instanceof Module && typeof load.metadata.loaderModule.default === 'function') + return ''; load.metadata.scriptLoad = false; - return load.metadata.loaderModule.fetch.call(loader, load, function(load) { - return fetch.call(loader, load); - }); - } - else { - return fetch.call(loader, load); + if (load.metadata.loaderModule.fetch) + return load.metadata.loaderModule.fetch.call(loader, load, function(load) { + return fetch.call(loader, load); + }); } + return fetch.call(loader, load); }; }); @@ -3954,9 +3956,7 @@ hookConstructor(function(constructor) { return translate.apply(loader, args); }); } - else { - return translate.apply(loader, args); - } + return translate.apply(loader, args); }; }); @@ -3965,28 +3965,30 @@ hookConstructor(function(constructor) { var loader = this; var calledInstantiate = false; - if (load.metadata.loaderModule && load.metadata.loaderModule.instantiate && !loader.builder && load.metadata.format != 'defined') - return Promise.resolve(load.metadata.loaderModule.instantiate.call(loader, load, function(load) { - if (calledInstantiate) - throw new Error('Instantiate must only be called once.'); - calledInstantiate = true; - return instantiate.call(loader, load); - })).then(function(result) { - if (calledInstantiate) - return result; - - if (result !== undefined) { - load.metadata.entry = createEntry(); - load.metadata.entry.execute = function() { + if (load.metadata.loaderModule && !loader.builder && load.metadata.format != 'defined') { + if (load.metadata.loaderModule.instantiate) + return Promise.resolve(load.metadata.loaderModule.instantiate.call(loader, load, function(load) { + if (calledInstantiate) + throw new Error('Instantiate must only be called once.'); + calledInstantiate = true; + return instantiate.call(loader, load); + })).then(function(result) { + if (calledInstantiate) return result; - } - load.metadata.entry.deps = load.metadata.deps; - load.metadata.format = 'defined'; - } - return instantiate.call(loader, load); - }); - else - return instantiate.call(loader, load); + + if (result !== undefined) + createInstantiate(load, result); + return instantiate.call(loader, load); + }); + else if (typeof load.metadata.loaderModule === 'function' || load.metadata.loaderModule instanceof Module && typeof load.metadata.loaderModule.default === 'function') + return Promise.resolve((load.metadata.loaderModule.default || load.metadata.loaderModule).call(loader, load.address, load.name)) + .then(function (result) { + if (result !== undefined) + createInstantiate(load, result); + return instantiate.call(loader, load); + }); + } + return instantiate.call(loader, load); }; }); @@ -4480,7 +4482,7 @@ hook('fetch', function(fetch) { });System = new SystemJSLoader(); __global.SystemJS = System; -System.version = '0.19.41 CSP'; +System.version = '0.19.47 CSP'; if (typeof module == 'object' && module.exports && typeof exports == 'object') module.exports = System; diff --git a/node_modules/systemjs/dist/system-polyfills.js b/node_modules/systemjs/dist/system-polyfills.js index ca76c2418..bf3aaab1b 100644 --- a/node_modules/systemjs/dist/system-polyfills.js +++ b/node_modules/systemjs/dist/system-polyfills.js @@ -1,5 +1,5 @@ /* * SystemJS Promise Polyfill */ -!function(t){!function(e){"object"==typeof exports?module.exports=e():"function"==typeof t&&t.amd?t(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(function(){var t;return function t(e,n,o){function r(u,c){if(!n[u]){if(!e[u]){var f="function"==typeof require&&require;if(!c&&f)return f(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var s=n[u]={exports:{}};e[u][0].call(s.exports,function(t){var n=e[u][1][t];return r(n?n:t)},s,s.exports,t,e,n,o)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u=0&&(l.splice(e,1),h("Handled previous rejection ["+t.id+"] "+r.formatObject(t.value)))}function c(t,e){p.push(t,e),null===d&&(d=o(f,0))}function f(){for(d=null;p.length>0;)p.shift()(p.shift())}var s,a=n,h=n;"undefined"!=typeof console&&(s=console,a="undefined"!=typeof s.error?function(t){s.error(t)}:function(t){s.log(t)},h="undefined"!=typeof s.info?function(t){s.info(t)}:function(t){s.log(t)}),t.onPotentiallyUnhandledRejection=function(t){c(i,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){c(u,t)},t.onFatalRejection=function(t){c(e,t.value)};var p=[],l=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{"../env":5,"../format":6}],5:[function(e,n,o){!function(t){"use strict";t(function(t){function e(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function n(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function o(t){function e(){var t=n;n=void 0,t()}var n,o=document.createTextNode(""),r=new t(e);r.observe(o,{characterData:!0});var i=0;return function(t){n=t,o.data=i^=1}}var r,i="undefined"!=typeof setTimeout&&setTimeout,u=function(t,e){return setTimeout(t,e)},c=function(t){return clearTimeout(t)},f=function(t){return i(t,0)};if(e())f=function(t){return process.nextTick(t)};else if(r=n())f=o(r);else if(!i){var s=t,a=s("vertx");u=function(t,e){return a.setTimer(e,t)},c=a.cancelTimer,f=a.runOnLoop||a.runOnContext}return{setTimer:u,clearTimer:c,asap:f}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{}],6:[function(e,n,o){!function(t){"use strict";t(function(){function t(t){var n="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:e(t);return t instanceof Error?n:n+" (WARNING: non-Error used)"}function e(t){var e=String(t);return"[object Object]"===e&&"undefined"!=typeof JSON&&(e=n(t,e)),e}function n(t,e){try{return JSON.stringify(t)}catch(t){return e}}return{formatError:t,formatObject:e,tryStringify:n}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t()})},{}],7:[function(e,n,o){!function(t){"use strict";t(function(){return function(t){function e(t,e){this._handler=t===_?e:n(t)}function n(t){function e(t){r.resolve(t)}function n(t){r.reject(t)}function o(t){r.notify(t)}var r=new b;try{t(e,n,o)}catch(t){n(t)}return r}function o(t){return k(t)?t:new e(_,new x(v(t)))}function r(t){return new e(_,new x(new P(t)))}function i(){return $}function u(){return new e(_,new b)}function c(t,e){var n=new b(t.receiver,t.join().context);return new e(_,n)}function f(t){return a(B,null,t)}function s(t,e){return a(M,t,e)}function a(t,n,o){function r(e,r,u){u.resolved||h(o,i,e,t(n,r,e),u)}function i(t,e,n){a[t]=e,0===--s&&n.become(new q(a))}for(var u,c="function"==typeof n?r:i,f=new b,s=o.length>>>0,a=new Array(s),p=0;p0?e(n,i.value,r):(r.become(i),p(t,n+1,i))}else e(n,o,r)}function p(t,e,n){for(var o=e;o0||"function"!=typeof e&&r<0)return new this.constructor(_,o);var i=this._beget(),u=i._handler;return o.chain(u,o.receiver,t,e,n),i},e.prototype.catch=function(t){return this.then(void 0,t)},e.prototype._beget=function(){return c(this._handler,this.constructor)},e.all=f,e.race=d,e._traverse=s,e._visitRemaining=p,_.prototype.when=_.prototype.become=_.prototype.notify=_.prototype.fail=_.prototype._unreport=_.prototype._report=K,_.prototype._state=0,_.prototype.state=function(){return this._state},_.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},_.prototype.chain=function(t,e,n,o,r){this.when({resolver:t,receiver:e,fulfilled:n,rejected:o,progress:r})},_.prototype.visit=function(t,e,n,o){this.chain(X,t,e,n,o)},_.prototype.fold=function(t,e,n,o){this.when(new S(t,e,n,o))},A(_,w),w.prototype.become=function(t){t.fail()};var X=new w;A(_,b),b.prototype._state=0,b.prototype.resolve=function(t){this.become(v(t))},b.prototype.reject=function(t){this.resolved||this.become(new P(t))},b.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=O();return t},b.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n=0&&(l.splice(e,1),h("Handled previous rejection ["+t.id+"] "+r.formatObject(t.value)))}function c(t,e){p.push(t,e),null===d&&(d=o(f,0))}function f(){for(d=null;p.length>0;)p.shift()(p.shift())}var s,a=n,h=n;"undefined"!=typeof console&&(s=console,a="undefined"!=typeof s.error?function(t){s.error(t)}:function(t){s.log(t)},h="undefined"!=typeof s.info?function(t){s.info(t)}:function(t){s.log(t)}),t.onPotentiallyUnhandledRejection=function(t){c(i,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){c(u,t)},t.onFatalRejection=function(t){c(e,t.value)};var p=[],l=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{"../env":5,"../format":6}],5:[function(e,n,o){!function(t){"use strict";t(function(t){function e(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function n(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function o(t){function e(){var t=n;n=void 0,t()}var n,o=document.createTextNode(""),r=new t(e);r.observe(o,{characterData:!0});var i=0;return function(t){n=t,o.data=i^=1}}var r,i="undefined"!=typeof setTimeout&&setTimeout,u=function(t,e){return setTimeout(t,e)},c=function(t){return clearTimeout(t)},f=function(t){return i(t,0)};if(e())f=function(t){return process.nextTick(t)};else if(r=n())f=o(r);else if(!i){var s=t,a=s("vertx");u=function(t,e){return a.setTimer(e,t)},c=a.cancelTimer,f=a.runOnLoop||a.runOnContext}return{setTimer:u,clearTimer:c,asap:f}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{}],6:[function(e,n,o){!function(t){"use strict";t(function(){function t(t){var n="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:e(t);return t instanceof Error?n:n+" (WARNING: non-Error used)"}function e(t){var e=String(t);return"[object Object]"===e&&"undefined"!=typeof JSON&&(e=n(t,e)),e}function n(t,e){try{return JSON.stringify(t)}catch(n){return e}}return{formatError:t,formatObject:e,tryStringify:n}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t()})},{}],7:[function(e,n,o){!function(t){"use strict";t(function(){return function(t){function e(t,e){this._handler=t===_?e:n(t)}function n(t){function e(t){r.resolve(t)}function n(t){r.reject(t)}function o(t){r.notify(t)}var r=new b;try{t(e,n,o)}catch(i){n(i)}return r}function o(t){return k(t)?t:new e(_,new x(v(t)))}function r(t){return new e(_,new x(new P(t)))}function i(){return $}function u(){return new e(_,new b)}function c(t,e){var n=new b(t.receiver,t.join().context);return new e(_,n)}function f(t){return a(B,null,t)}function s(t,e){return a(M,t,e)}function a(t,n,o){function r(e,r,u){u.resolved||h(o,i,e,t(n,r,e),u)}function i(t,e,n){a[t]=e,0===--s&&n.become(new q(a))}for(var u,c="function"==typeof n?r:i,f=new b,s=o.length>>>0,a=new Array(s),p=0;p0?e(n,i.value,r):(r.become(i),p(t,n+1,i))}else e(n,o,r)}function p(t,e,n){for(var o=e;on&&t._unreport()}}function d(t){return"object"!=typeof t||null===t?r(new TypeError("non-iterable passed to race()")):0===t.length?i():1===t.length?o(t[0]):y(t)}function y(t){var n,o,r,i=new b;for(n=0;n0||"function"!=typeof e&&0>r)return new this.constructor(_,o);var i=this._beget(),u=i._handler;return o.chain(u,o.receiver,t,e,n),i},e.prototype["catch"]=function(t){return this.then(void 0,t)},e.prototype._beget=function(){return c(this._handler,this.constructor)},e.all=f,e.race=d,e._traverse=s,e._visitRemaining=p,_.prototype.when=_.prototype.become=_.prototype.notify=_.prototype.fail=_.prototype._unreport=_.prototype._report=K,_.prototype._state=0,_.prototype.state=function(){return this._state},_.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},_.prototype.chain=function(t,e,n,o,r){this.when({resolver:t,receiver:e,fulfilled:n,rejected:o,progress:r})},_.prototype.visit=function(t,e,n,o){this.chain(X,t,e,n,o)},_.prototype.fold=function(t,e,n,o){this.when(new S(t,e,n,o))},A(_,w),w.prototype.become=function(t){t.fail()};var X=new w;A(_,b),b.prototype._state=0,b.prototype.resolve=function(t){this.become(v(t))},b.prototype.reject=function(t){this.resolved||this.become(new P(t))},b.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=O();return t},b.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;ns.length?(o[s]&&"/"||"")+t.substr(s.length):"")}else{var c=s.split("*");if(c.length>2)throw new TypeError("Only one wildcard in a path is permitted");var f=c[0].length;f>=a&&t.substr(0,c[0].length)==c[0]&&t.substr(t.length-c[1].length)==c[1]&&(a=f,r=s,n=t.substr(c[0].length,t.length-c[1].length-c[0].length))}}var m=o[r];return"string"==typeof n&&(m=m.replace("*",n)),m}function c(e){for(var t=[],n=[],r=0,a=e.length;r",linkSets:[],dependencies:[],metadata:{}}}function a(e,t,n){return new Promise(l({step:n.address?"fetch":"locate",loader:e,moduleName:t,moduleMetadata:n&&n.metadata||{},moduleSource:n.source,moduleAddress:n.address}))}function o(t,n,r,a){return new Promise(function(e,o){e(t.loaderObj.normalize(n,r,a))}).then(function(n){var r;if(t.modules[n])return r=e(n),r.status="linked",r.module=t.modules[n],r;for(var a=0,o=t.loads.length;a0)){var n=e.startingLoad;if(e.loader.loaderObj.execute===!1){for(var r=[].concat(e.loads),a=0,o=r.length;a=0;i--){for(var s=a[i],d=0;di.length?(o[i]&&"/"||"")+t.substr(i.length):"")}else{var c=i.split("*");if(c.length>2)throw new TypeError("Only one wildcard in a path is permitted");var f=c[0].length;f>=a&&t.substr(0,c[0].length)==c[0]&&t.substr(t.length-c[1].length)==c[1]&&(a=f,r=i,n=t.substr(c[0].length,t.length-c[1].length-c[0].length))}}var m=o[r];return"string"==typeof n&&(m=m.replace("*",n)),m}function c(e){for(var t=[],n=[],r=0,a=e.length;a>r;r++){var o=x.call(t,e[r]);-1===o?(t.push(e[r]),n.push([r])):n[o].push(r)}return{names:t,indices:n}}function f(t){var n={};if(("object"==typeof t||"function"==typeof t)&&t!==e)if(z)for(var r in t)"default"!==r&&m(n,t,r);else p(n,t);return n["default"]=t,w(n,"__useDefault",{value:!0}),n}function m(e,t,n){try{var r;(r=Object.getOwnPropertyDescriptor(t,n))&&w(e,n,r)}catch(a){return e[n]=t[n],!1}}function p(e,t,n){var r=t&&t.hasOwnProperty;for(var a in t)(!r||t.hasOwnProperty(a))&&(n&&a in e||(e[a]=t[a]));return e}function h(e){var t=e.match(D);return t&&"System.register"==e.substr(t[0].length,15)}function g(){return{name:null,deps:null,originalIndices:null,declare:null,execute:null,executingRequire:!1,declarative:!1,normalizedDeps:null,groupIndex:null,evaluated:!1,module:null,esModule:null,esmExports:!1}}var v="undefined"==typeof window&&"undefined"!=typeof self&&"undefined"!=typeof importScripts,y="undefined"!=typeof window&&"undefined"!=typeof document,b="undefined"!=typeof process&&"undefined"!=typeof process.platform&&!!process.platform.match(/^win/);e.console||(e.console={assert:function(){}});var w,x=Array.prototype.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1};!function(){try{Object.defineProperty({},"a",{})&&(w=Object.defineProperty)}catch(e){w=function(e,t,n){try{e[t]=n.value||n.get.call(e)}catch(r){}}}}();var S,E="_"==new Error(0,"_").fileName;if("undefined"!=typeof document&&document.getElementsByTagName){if(S=document.baseURI,!S){var O=document.getElementsByTagName("base");S=O[0]&&O[0].href||window.location.href}}else"undefined"!=typeof location&&(S=e.location.href);if(S)S=S.split("#")[0].split("?")[0],S=S.substr(0,S.lastIndexOf("/")+1);else{if("undefined"==typeof process||!process.cwd)throw new TypeError("No environment baseURI");S="file://"+(b?"/":"")+process.cwd()+"/",b&&(S=S.replace(/\\/g,"/"))}try{var _="test:"==new e.URL("test:///").protocol}catch(P){}var j=_?e.URL:e.URLPolyfill;w(n.prototype,"toString",{value:function(){return"Module"}}),function(){function e(e){return{status:"loading",name:e||"",linkSets:[],dependencies:[],metadata:{}}}function a(e,t,n){return new Promise(l({step:n.address?"fetch":"locate",loader:e,moduleName:t,moduleMetadata:n&&n.metadata||{},moduleSource:n.source,moduleAddress:n.address}))}function o(t,n,r,a){return new Promise(function(e,o){e(t.loaderObj.normalize(n,r,a))}).then(function(n){var r;if(t.modules[n])return r=e(n),r.status="linked",r.module=t.modules[n],r;for(var a=0,o=t.loads.length;o>a;a++)if(r=t.loads[a],r.name==n)return r;return r=e(n),t.loads.push(r),s(t,r),r})}function s(e,t){i(e,t,Promise.resolve().then(function(){return e.loaderObj.locate({name:t.name,metadata:t.metadata})}))}function i(e,t,n){d(e,t,n.then(function(n){return"loading"==t.status?(t.address=n,e.loaderObj.fetch({name:t.name,metadata:t.metadata,address:n})):void 0}))}function d(e,t,n){n.then(function(n){return"loading"==t.status?(t.address=t.address||t.name,Promise.resolve(e.loaderObj.translate({name:t.name,metadata:t.metadata,address:t.address,source:n})).then(function(n){return t.source=n,e.loaderObj.instantiate({name:t.name,metadata:t.metadata,address:t.address,source:n})}).then(function(e){if(void 0===e)throw new TypeError("Declarative modules unsupported in the polyfill.");if("object"!=typeof e)throw new TypeError("Invalid instantiate return value");t.depsList=e.deps||[],t.execute=e.execute}).then(function(){t.dependencies=[];for(var n=t.depsList,r=[],a=0,s=n.length;s>a;a++)(function(n,a){r.push(o(e,n,t.name,t.address).then(function(e){if(t.dependencies[a]={key:n,value:e.name},"linked"!=e.status)for(var r=t.linkSets.concat([]),o=0,s=r.length;s>o;o++)c(r[o],e)}))})(n[a],a);return Promise.all(r)}).then(function(){t.status="loaded";for(var e=t.linkSets.concat([]),n=0,r=e.length;r>n;n++)m(e[n],t)})):void 0})["catch"](function(e){t.status="failed",t.exception=e;for(var n=t.linkSets.concat([]),r=0,a=n.length;a>r;r++)p(n[r],t,e)})}function l(t){return function(n,r){var a=t.loader,o=t.moduleName,l=t.step;if(a.modules[o])throw new TypeError('"'+o+'" already exists in the module table');for(var c,f=0,m=a.loads.length;m>f;f++)if(a.loads[f].name==o&&(c=a.loads[f],"translate"!=l||c.source||(c.address=t.moduleAddress,d(a,c,Promise.resolve(t.moduleSource))),c.linkSets.length&&c.linkSets[0].loads[0].name==c.name))return c.linkSets[0].done.then(function(){n(c)});var p=c||e(o);p.metadata=t.moduleMetadata;var h=u(a,p);a.loads.push(p),n(h.done),"locate"==l?s(a,p):"fetch"==l?i(a,p,Promise.resolve(t.moduleAddress)):(p.address=t.moduleAddress,d(a,p,Promise.resolve(t.moduleSource)))}}function u(e,t){var n={loader:e,loads:[],startingLoad:t,loadingCount:0};return n.done=new Promise(function(e,t){n.resolve=e,n.reject=t}),c(n,t),n}function c(e,t){if("failed"!=t.status){for(var n=0,r=e.loads.length;r>n;n++)if(e.loads[n]==t)return;e.loads.push(t),t.linkSets.push(e),"loaded"!=t.status&&e.loadingCount++;for(var a=e.loader,n=0,r=t.dependencies.length;r>n;n++)if(t.dependencies[n]){var o=t.dependencies[n].value;if(!a.modules[o])for(var s=0,i=a.loads.length;i>s;s++)if(a.loads[s].name==o){c(e,a.loads[s]);break}}}}function f(e){var t=!1;try{y(e,function(n,r){p(e,n,r),t=!0})}catch(n){p(e,null,n),t=!0}return t}function m(e,t){if(e.loadingCount--,!(e.loadingCount>0)){var n=e.startingLoad;if(e.loader.loaderObj.execute===!1){for(var r=[].concat(e.loads),a=0,o=r.length;o>a;a++){var t=r[a];t.module={name:t.name,module:S({}),evaluated:!0},t.status="linked",h(e.loader,t)}return e.resolve(n)}var s=f(e);s||e.resolve(n)}}function p(e,n,r){var a=e.loader;e:if(n)if(e.loads[0].name==n.name)r=t(r,"Error loading "+n.name);else{for(var o=0;oo;o++){var n=l[o];a.loaderObj.failed=a.loaderObj.failed||[],-1==x.call(a.loaderObj.failed,n)&&a.loaderObj.failed.push(n);var c=x.call(n.linkSets,e);if(n.linkSets.splice(c,1),0==n.linkSets.length){var f=x.call(e.loader.loads,n);-1!=f&&e.loader.loads.splice(f,1)}}e.reject(r)}function h(e,t){if(e.loaderObj.trace){e.loaderObj.loads||(e.loaderObj.loads={});var n={};t.dependencies.forEach(function(e){n[e.key]=e.value}),e.loaderObj.loads[t.name]={name:t.name,deps:t.dependencies.map(function(e){return e.key}),depMap:n,address:t.address,metadata:t.metadata,source:t.source}}t.name&&(e.modules[t.name]=t.module);var r=x.call(e.loads,t);-1!=r&&e.loads.splice(r,1);for(var a=0,o=t.linkSets.length;o>a;a++)r=x.call(t.linkSets[a].loads,t),-1!=r&&t.linkSets[a].loads.splice(r,1);t.linkSets.splice(0,t.linkSets.length)}function g(e,t,r){try{var a=t.execute()}catch(o){return void r(t,o)}return a&&a instanceof n?a:void r(t,new TypeError("Execution must define a Module instance"))}function v(e,t,n){var r=e._loader.importPromises;return r[t]=n.then(function(e){return r[t]=void 0,e},function(e){throw r[t]=void 0,e})}function y(e,t){var n=e.loader;if(e.loads.length)for(var r=e.loads.concat([]),a=0;aa;a++){var s=e.normalizedDeps[a],i=n.defined[s];if(i&&!i.evaluated){var d=e.groupIndex+(i.declarative!=e.declarative);if(null===i.groupIndex||i.groupIndex=0;s--){for(var i=a[s],d=0;dr;r++){var i=a.importers[r];if(!i.locked){var d=x.call(i.dependencies,a),l=i.setters[d];l&&l(o)}}return a.locked=!1,t},{id:t.name});if("function"==typeof s&&(s={setters:[],execute:s}),s=s||{setters:[],execute:function(){}},a.setters=s.setters,a.execute=s.execute,!a.setters||!a.execute)throw new TypeError("Invalid System.register form for "+t.name);for(var i=0,u=t.normalizedDeps.length;u>i;i++){var c,f=t.normalizedDeps[i],m=n.defined[f],p=r[f];p?c=p.exports:m&&!m.declarative?c=m.esModule:m?(l(m,n),p=m.module,c=p.exports):c=n.get(f),p&&p.importers?(p.importers.push(a),a.dependencies.push(p)):a.dependencies.push(null);for(var h=t.originalIndices[i],g=0,v=h.length;v>g;++g){var y=h[g];a.setters[y]&&a.setters[y](c)}}}}function u(e,t){var n,r=t.defined[e];if(r)r.declarative?p(e,r,[],t):r.evaluated||m(r,t),n=r.module.exports;else if(n=t.get(e),!n)throw new Error("Unable to load dependency "+e+".");return(!r||r.declarative)&&n&&n.__useDefault?n["default"]:n}function m(t,r){if(!t.module){var a={},o=t.module={exports:a,id:t.name};if(!t.executingRequire)for(var s=0,i=t.normalizedDeps.length;i>s;s++){var d=t.normalizedDeps[s],l=r.defined[d];l&&m(l,r)}t.evaluated=!0;var c=t.execute.call(e,function(e){for(var n=0,a=t.deps.length;a>n;n++)if(t.deps[n]==e)return u(t.normalizedDeps[n],r);var o=r.normalizeSync(e,t.name);if(-1!=x.call(t.normalizedDeps,o))return u(o,r);throw new Error("Module "+e+" not declared as a dependency of "+t.name)},a,o);void 0!==c&&(o.exports=c),a=o.exports,a&&(a.__esModule||a instanceof n)?t.esModule=r.newModule(a):t.esmExports&&a!==e?t.esModule=r.newModule(f(a)):t.esModule=r.newModule({"default":a,__useDefault:!0})}}function p(t,n,r,a){if(n&&!n.evaluated&&n.declarative){r.push(t);for(var o=0,s=n.normalizedDeps.length;s>o;o++){var i=n.normalizedDeps[o];-1==x.call(r,i)&&(a.defined[i]?p(i,a.defined[i],r,a):a.get(i))}n.evaluated||(n.evaluated=!0,n.module.execute.call(e))}}a.prototype.register=function(e,t,n){if("string"!=typeof e&&(n=t,t=e,e=null),"boolean"==typeof n)return this.registerDynamic.apply(this,arguments);var r=g();r.name=e&&(this.decanonicalize||this.normalize).call(this,e),r.declarative=!0,r.deps=t,r.declare=n,this.pushRegister_({amd:!1,entry:r})},a.prototype.registerDynamic=function(e,t,n,r){"string"!=typeof e&&(r=n,n=t,t=e,e=null);var a=g();a.name=e&&(this.decanonicalize||this.normalize).call(this,e),a.deps=t,a.execute=r,a.executingRequire=n,this.pushRegister_({amd:!1,entry:a})},s("reduceRegister_",function(){return function(e,t){if(t){var n=t.entry,r=e&&e.metadata;if(n.name&&(n.name in this.defined||(this.defined[n.name]=n),r&&(r.bundle=!0)),!n.name||e&&!r.entry&&n.name==e.name){if(!r)throw new TypeError("Invalid System.register call. Anonymous System.register calls can only be made by modules loaded by SystemJS.import and not via script tags.");if(r.entry)throw"register"==r.format?new Error("Multiple anonymous System.register calls in module "+e.name+". If loading a bundle, ensure all the System.register calls are named."):new Error("Module "+e.name+" interpreted as "+r.format+" module format, but called System.register.");r.format||(r.format="register"),r.entry=n}}}}),i(function(e){return function(){e.call(this),this.defined={},this._loader.moduleRecords={}}}),w(o,"toString",{value:function(){return"Module"}}),s("delete",function(e){return function(t){return delete this._loader.moduleRecords[t],delete this.defined[t],e.call(this,t)}}),s("fetch",function(e){return function(t){return this.defined[t.name]?(t.metadata.format="defined",""):(t.metadata.deps=t.metadata.deps||[],e.call(this,t))}}),s("translate",function(e){return function(t){return t.metadata.deps=t.metadata.deps||[],Promise.resolve(e.apply(this,arguments)).then(function(e){return("register"==t.metadata.format||"system"==t.metadata.format||!t.metadata.format&&h(t.source))&&(t.metadata.format="register"),e})}}),s("load",function(e){return function(t){var n=this,a=n.defined[t];return!a||a.deps.length?e.apply(this,arguments):(a.originalIndices=a.normalizedDeps=[],r(t,a,n),p(t,a,[],n),a.esModule||(a.esModule=n.newModule(a.module.exports)),n.trace||(n.defined[t]=void 0),n.set(t,a.esModule),Promise.resolve())}}),s("instantiate",function(e){return function(t){"detect"==t.metadata.format&&(t.metadata.format=void 0),e.call(this,t);var n,a=this;if(a.defined[t.name])n=a.defined[t.name],n.declarative||(n.deps=n.deps.concat(t.metadata.deps)),n.deps=n.deps.concat(t.metadata.deps);else if(t.metadata.entry)n=t.metadata.entry,n.deps=n.deps.concat(t.metadata.deps);else if(!(a.builder&&t.metadata.bundle||"register"!=t.metadata.format&&"esm"!=t.metadata.format&&"es6"!=t.metadata.format)){if("undefined"!=typeof __exec&&__exec.call(a,t),!t.metadata.entry&&!t.metadata.bundle)throw new Error(t.name+" detected as "+t.metadata.format+" but didn't execute.");n=t.metadata.entry,n&&t.metadata.deps&&(n.deps=n.deps.concat(t.metadata.deps))}n||(n=g(),n.deps=t.metadata.deps,n.execute=function(){}),a.defined[t.name]=n;var o=c(n.deps);n.deps=o.names,n.originalIndices=o.indices,n.name=t.name,n.esmExports=t.metadata.esmExports!==!1;for(var s=[],i=0,d=n.deps.length;d>i;i++)s.push(Promise.resolve(a.normalize(n.deps[i],t.name)));return Promise.all(s).then(function(e){return n.normalizedDeps=e,{deps:n.deps,execute:function(){return r(t.name,n,a),p(t.name,n,[],a),n.esModule||(n.esModule=a.newModule(n.module.exports)),a.trace||(a.defined[t.name]=void 0),n.esModule}}})}})}(),function(){i(function(e){return function(){e.call(this),this.bundles={},this._loader.loadedBundles={}}}),s("locate",function(e){return function(t){var n=this,r=!1;if(!(t.name in n.defined))for(var a in n.bundles){for(var o=0;o 0) @@ -670,8 +665,6 @@ function logloads(loads) { if (abrupt) return; - console.assert(linkSet.loads.length == 0, 'loads cleared'); - linkSet.resolve(startingLoad); } @@ -680,7 +673,7 @@ function logloads(loads) { var loader = linkSet.loader; var requests; - checkError: + checkError: if (load) { if (linkSet.loads[0].name == load.name) { exc = addToError(exc, 'Error loading ' + load.name); @@ -714,7 +707,6 @@ function logloads(loads) { loader.loaderObj.failed.push(load); var linkIndex = indexOf.call(load.linkSets, linkSet); - console.assert(linkIndex != -1, 'link not present'); load.linkSets.splice(linkIndex, 1); if (load.linkSets.length == 0) { var globalLoadsIndex = indexOf.call(linkSet.loader.loads, load); @@ -746,7 +738,6 @@ function logloads(loads) { } // if not anonymous, add to the module table if (load.name) { - console.assert(!loader.modules[load.name] || loader.modules[load.name].module === load.module.module, 'load not in module table'); loader.modules[load.name] = load.module; } var loadIndex = indexOf.call(loader.loads, load); @@ -856,7 +847,7 @@ function logloads(loads) { var loader = this._loader; if (loader.modules[name]) return Promise.resolve(); - return loader.importPromises[name] || createImportPromise(this, name, new Promise(asyncStartLoadPartwayThrough({ + return (loader.importPromises[name] || createImportPromise(this, name, new Promise(asyncStartLoadPartwayThrough({ step: 'locate', loader: loader, moduleName: name, @@ -864,9 +855,11 @@ function logloads(loads) { moduleSource: undefined, moduleAddress: undefined })) - .then(function() { + .then(function(load) { delete loader.importPromises[name]; - })); + return load.module.module; + }))) + .then(function () {}); }, // 26.3.3.11 module: function(source, options) { @@ -976,7 +969,6 @@ function logloads(loads) { })(); var System; - // SystemJS Loader Class and Extension helpers function SystemJSLoader() { Loader.call(this); @@ -1053,7 +1045,7 @@ function applyPaths(loader, name) { if (p.indexOf('*') === -1) { if (name == p) return paths[p]; - + // support trailing / in paths rules else if (name.substr(0, p.length - 1) == p.substr(0, p.length - 1) && (name.length < p.length || name[p.length - 1] == p[p.length - 1]) && (paths[p][paths[p].length - 1] == '/' || paths[p] == '')) { return paths[p].substr(0, paths[p].length - 1) + (name.length > p.length ? (paths[p] && '/' || '') + name.substr(p.length) : ''); @@ -1207,7 +1199,7 @@ function extendPkgConfig(pkgCfgA, pkgCfgB, pkgName, loader, warnInvalidPropertie loader.depCache[dNormalized] = (loader.depCache[dNormalized] || []).concat(pkgCfgB.depCache[d]); } } - else if (warnInvalidProperties && indexOf.call(['browserConfig', 'nodeConfig', 'devConfig', 'productionConfig'], prop) == -1 && + else if (warnInvalidProperties && indexOf.call(['browserConfig', 'nodeConfig', 'devConfig', 'productionConfig'], prop) == -1 && (!pkgCfgB.hasOwnProperty || pkgCfgB.hasOwnProperty(prop))) { warn.call(loader, '"' + prop + '" is not a valid package configuration option in package ' + pkgName); } @@ -1229,7 +1221,7 @@ function setPkgConfig(loader, pkgName, cfg, prependConfig) { extendPkgConfig(pkg, prependConfig ? cfg : basePkg, pkgName, loader, prependConfig); extendPkgConfig(pkg, prependConfig ? basePkg : cfg, pkgName, loader, !prependConfig); } - + // main object becomes main map if (typeof pkg.main == 'object') { pkg.map = pkg.map || {}; @@ -1245,6 +1237,15 @@ function warn(msg) { if (this.warnings && typeof console != 'undefined' && console.warn) console.warn(msg); } + +function createInstantiate (load, result) { + load.metadata.entry = createEntry(); + load.metadata.entry.execute = function() { + return result; + } + load.metadata.entry.deps = []; + load.metadata.format = 'defined'; +} var absURLRegEx = /^([^\/]+:\/\/|\/)/; // Normalization with module names as absolute URLs @@ -1476,7 +1477,7 @@ SystemJSLoader.prototype.locate = function(load) { * * * The code here replicates the ES6 linking groups algorithm to ensure that - * circular ES6 compiled into System.register can work alongside circular AMD + * circular ES6 compiled into System.register can work alongside circular AMD * and CommonJS, identically to the actual ES6 loader. * */ @@ -1486,7 +1487,7 @@ SystemJSLoader.prototype.locate = function(load) { * Registry side table entries in loader.defined * Registry Entry Contains: * - name - * - deps + * - deps * - declare for declarative modules * - execute for dynamic modules, different to declarative execute on module * - executingRequire indicates require drives execution for circularity of dynamic modules @@ -1504,7 +1505,7 @@ SystemJSLoader.prototype.locate = function(load) { * For dynamic we track the es module with: * - esModule actual es module value * - esmExports whether to extend the esModule with named exports - * + * * Then for declarative only we track dynamic bindings with the 'module' records: * - name * - exports @@ -1549,7 +1550,7 @@ function createEntry() { * see https://github.com/ModuleLoader/es6-module-loader/wiki/System.register-Explained * * 2. System.registerDynamic for dynamic modules (3-4 params) - System.registerDynamic([name, ]deps, executingRequire, execute) - * the true or false statement + * the true or false statement * * this extension implements the linking algorithm for the two variations identical to the spec * allowing compiled ES6 circular references to work alongside AMD and CJS circular references. @@ -1568,7 +1569,7 @@ function createEntry() { return this.registerDynamic.apply(this, arguments); var entry = createEntry(); - // ideally wouldn't apply map config to bundle names but + // ideally wouldn't apply map config to bundle names but // dependencies go through map regardless so we can't restrict // could reconsider in shift to new spec entry.name = name && (this.decanonicalize || this.normalize).call(this, name); @@ -1654,17 +1655,17 @@ function createEntry() { for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { var depName = entry.normalizedDeps[i]; var depEntry = loader.defined[depName]; - + // not in the registry means already linked / ES6 if (!depEntry || depEntry.evaluated) continue; - + // now we know the entry is in our unlinked linkage group var depGroupIndex = entry.groupIndex + (depEntry.declarative != entry.declarative); // the group index of an entry is always the maximum if (depEntry.groupIndex === null || depEntry.groupIndex < depGroupIndex) { - + // if already in a group, remove from the old group if (depEntry.groupIndex !== null) { groups[depEntry.groupIndex].splice(indexOf.call(groups[depEntry.groupIndex], depEntry), 1); @@ -1704,7 +1705,7 @@ function createEntry() { else linkDynamicModule(entry, loader); } - curGroupDeclarative = !curGroupDeclarative; + curGroupDeclarative = !curGroupDeclarative; } } @@ -1764,7 +1765,7 @@ function createEntry() { // allowing undefined declaration was a mistake! To be deprecated. declaration = declaration || { setters: [], execute: function() {} }; - + module.setters = declaration.setters; module.execute = declaration.execute; @@ -1807,7 +1808,7 @@ function createEntry() { else { module.dependencies.push(null); } - + // run setters for all entries with the matching dependency name var originalIndices = entry.originalIndices[i]; for (var j = 0, len = originalIndices.length; j < len; ++j) { @@ -1833,7 +1834,7 @@ function createEntry() { else { if (entry.declarative) ensureEvaluated(name, entry, [], loader); - + else if (!entry.evaluated) linkDynamicModule(entry, loader); @@ -1842,7 +1843,7 @@ function createEntry() { if ((!entry || entry.declarative) && exports && exports.__useDefault) return exports['default']; - + return exports; } @@ -1880,7 +1881,7 @@ function createEntry() { throw new Error('Module ' + name + ' not declared as a dependency of ' + entry.name); }, exports, module); - + if (output !== undefined) module.exports = output; @@ -1904,7 +1905,7 @@ function createEntry() { * (unless one is a circular dependency already in the list of seen * modules, in which case we execute it) * - * Then we evaluate the module itself depth-first left to right + * Then we evaluate the module itself depth-first left to right * execution to match ES6 modules */ function ensureEvaluated(moduleName, entry, seen, loader) { @@ -1950,7 +1951,7 @@ function createEntry() { } load.metadata.deps = load.metadata.deps || []; - + return fetch.call(this, load); }; }); @@ -1961,7 +1962,7 @@ function createEntry() { load.metadata.deps = load.metadata.deps || []; return Promise.resolve(translate.apply(this, arguments)).then(function(source) { // run detection for register format - if (load.metadata.format == 'register' || !load.metadata.format && detectRegisterFormat(load.source)) + if (load.metadata.format == 'register' || load.metadata.format == 'system' || !load.metadata.format && detectRegisterFormat(load.source)) load.metadata.format = 'register'; return source; }); @@ -1979,7 +1980,7 @@ function createEntry() { entry.originalIndices = entry.normalizedDeps = []; - // recursively ensure that the module and all its + // recursively ensure that the module and all its // dependencies are linked (with dependency group handling) link(normalized, entry, loader); @@ -2030,9 +2031,9 @@ function createEntry() { // Contains System.register calls // (dont run bundles in the builder) - else if (!(loader.builder && load.metadata.bundle) + else if (!(loader.builder && load.metadata.bundle) && (load.metadata.format == 'register' || load.metadata.format == 'esm' || load.metadata.format == 'es6')) { - + if (typeof __exec != 'undefined') __exec.call(loader, load); @@ -2055,9 +2056,9 @@ function createEntry() { // place this module onto defined for circular references loader.defined[load.name] = entry; - + var grouped = group(entry.deps); - + entry.deps = grouped.names; entry.originalIndices = grouped.indices; entry.name = load.name; @@ -2075,7 +2076,7 @@ function createEntry() { return { deps: entry.deps, execute: function() { - // recursively ensure that the module and all its + // recursively ensure that the module and all its // dependencies are linked (with dependency group handling) link(load.name, entry, loader); @@ -2189,7 +2190,7 @@ hook('fetch', function(fetch) { });System = new SystemJSLoader(); __global.SystemJS = System; -System.version = '0.19.41 Register Only'; +System.version = '0.19.47 Register Only'; if (typeof module == 'object' && module.exports && typeof exports == 'object') module.exports = System; diff --git a/node_modules/systemjs/dist/system.js b/node_modules/systemjs/dist/system.js index 1b7c1f82f..171b0d3cb 100644 --- a/node_modules/systemjs/dist/system.js +++ b/node_modules/systemjs/dist/system.js @@ -1,6 +1,6 @@ /* - * SystemJS v0.19.41 + * SystemJS v0.19.47 */ -!function(){function e(){!function(e){function t(e,r){if("string"!=typeof e)throw new TypeError("URL must be a string");var n=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);if(!n)throw new RangeError("Invalid URL format");var a=n[1]||"",o=n[2]||"",i=n[3]||"",s=n[4]||"",l=n[5]||"",u=n[6]||"",d=n[7]||"",c=n[8]||"",f=n[9]||"";if(void 0!==r){var m=r instanceof t?r:new t(r),p=!a&&!s&&!o;!p||d||c||(c=m.search),p&&"/"!==d[0]&&(d=d?(!m.host&&!m.username||m.pathname?"":"/")+m.pathname.slice(0,m.pathname.lastIndexOf("/")+1)+d:m.pathname);var h=[];d.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?h.pop():h.push(e)}),d=h.join("").replace(/^\//,"/"===d[0]?"/":""),p&&(u=m.port,l=m.hostname,s=m.host,i=m.password,o=m.username),a||(a=m.protocol)}d=d.replace(/\\/g,"/"),this.origin=s?a+(""!==a||""!==s?"//":"")+s:"",this.href=a+(a&&s||"file:"==a?"//":"")+(""!==o?o+(""!==i?":"+i:"")+"@":"")+s+d+c+f,this.protocol=a,this.username=o,this.password=i,this.host=s,this.hostname=l,this.port=u,this.pathname=d,this.search=c,this.hash=f}e.URLPolyfill=t}("undefined"!=typeof self?self:global),function(e){function t(e,t){if(!e.originalErr)for(var r=((e.message||e)+(e.stack?"\n"+e.stack:"")).toString().split("\n"),n=[],a=0;as.length?(o[s]&&"/"||"")+t.substr(s.length):"")}else{var d=s.split("*");if(d.length>2)throw new TypeError("Only one wildcard in a path is permitted");var f=d[0].length;f>=a&&t.substr(0,d[0].length)==d[0]&&t.substr(t.length-d[1].length)==d[1]&&(a=f,n=s,r=t.substr(d[0].length,t.length-d[1].length-d[0].length))}}var m=o[n];return"string"==typeof r&&(m=m.replace("*",r)),m}function m(e){for(var t=[],r=[],n=0,a=e.length;n",linkSets:[],dependencies:[],metadata:{}}}function a(e,t,r){return new Promise(u({step:r.address?"fetch":"locate",loader:e,moduleName:t,moduleMetadata:r&&r.metadata||{},moduleSource:r.source,moduleAddress:r.address}))}function o(t,r,n,a){return new Promise(function(e,o){e(t.loaderObj.normalize(r,n,a))}).then(function(r){var n;if(t.modules[r])return n=e(r),n.status="linked",n.module=t.modules[r],n;for(var a=0,o=t.loads.length;a0)){var r=e.startingLoad;if(e.loader.loaderObj.execute===!1){for(var n=[].concat(e.loads),a=0,o=n.length;a "'+n.paths[o]+'" uses wildcards which are being deprecated for just leaving a trailing "/" to indicate folder paths.')}if(e.defaultJSExtensions&&(n.defaultJSExtensions=e.defaultJSExtensions,w.call(n,"The defaultJSExtensions configuration option is deprecated, use packages configuration instead.")),e.pluginFirst&&(n.pluginFirst=e.pluginFirst),e.map)for(var o in e.map){var i=e.map[o];if("string"!=typeof i){var s=n.defaultJSExtensions&&".js"!=o.substr(o.length-3,3),l=n.decanonicalize(o);s&&".js"==l.substr(l.length-3,3)&&(l=l.substr(0,l.length-3));var u="";for(var c in n.packages)l.substr(0,c.length)==c&&(!l[c.length]||"/"==l[c.length])&&u.split("/").lengtha&&(r=o,a=n));return r}function t(e,t,r,n,a){if(!n||"/"==n[n.length-1]||a||t.defaultExtension===!1)return n;var o=!1;if(t.meta&&p(t.meta,n,function(e,t,r){if(0==r||e.lastIndexOf("*")!=e.length-1)return o=!0}),!o&&e.meta&&p(e.meta,r+"/"+n,function(e,t,r){if(0==r||e.lastIndexOf("*")!=e.length-1)return o=!0}),o)return n;var i="."+(t.defaultExtension||"js");return n.substr(n.length-i.length)!=i?n+i:n}function r(e,r,n,a,i){if(!a){if(!r.main)return n+(e.defaultJSExtensions?".js":"");a="./"==r.main.substr(0,2)?r.main.substr(2):r.main}if(r.map){var s="./"+a,l=S(r.map,s);if(l||(s="./"+t(e,r,n,a,i),s!="./"+a&&(l=S(r.map,s))),l){var u=o(e,r,n,l,s,i);if(u)return u}}return n+"/"+t(e,r,n,a,i)}function n(e,t,r,n){if("."==e)throw new Error("Package "+r+' has a map entry for "." which is not permitted.');return!(t.substr(0,e.length)==e&&n.length>e.length)}function o(e,r,a,o,i,s){"/"==i[i.length-1]&&(i=i.substr(0,i.length-1));var l=r.map[o];if("object"==typeof l)throw new Error("Synchronous conditional normalization not supported sync normalizing "+o+" in "+a);if(n(o,l,a,i)&&"string"==typeof l){if("."==l)l=a;else if("./"==l.substr(0,2))return a+"/"+t(e,r,a,l.substr(2)+i.substr(o.length),s);return e.normalizeSync(l+i.substr(o.length),a+"/")}}function l(e,r,n,a,o){if(!a){if(!r.main)return Promise.resolve(n+(e.defaultJSExtensions?".js":""));a="./"==r.main.substr(0,2)?r.main.substr(2):r.main}var i,s;return r.map&&(i="./"+a,s=S(r.map,i),s||(i="./"+t(e,r,n,a,o),i!="./"+a&&(s=S(r.map,i)))),(s?d(e,r,n,s,i,o):Promise.resolve()).then(function(i){return i?Promise.resolve(i):Promise.resolve(n+"/"+t(e,r,n,a,o))})}function u(e,r,n,a,o,i,s){if("."==o)o=n;else if("./"==o.substr(0,2))return Promise.resolve(n+"/"+t(e,r,n,o.substr(2)+i.substr(a.length),s)).then(function(t){return C.call(e,t,n+"/")});return e.normalize(o+i.substr(a.length),n+"/")}function d(e,t,r,a,o,i){"/"==o[o.length-1]&&(o=o.substr(0,o.length-1));var s=t.map[a];if("string"==typeof s)return n(a,s,r,o)?u(e,t,r,a,s,o,i):Promise.resolve();if(e.builder)return Promise.resolve(r+"/#:"+o);var l=[],d=[];for(var c in s){var f=z(c);d.push({condition:f,map:s[c]}),l.push(e.import(f.module,r))}return Promise.all(l).then(function(e){for(var t=0;tl&&(l=r),v(s,t,r&&l>r)}),v(r.metadata,s)}o.format&&!r.metadata.loader&&(r.metadata.format=r.metadata.format||o.format)}return t})}})}(),function(){function t(){if(s&&"interactive"===s.script.readyState)return s.load;for(var e=0;e=0;i--){for(var s=a[i],l=0;l100&&!i.metadata.format&&(i.metadata.format="global","traceur"===s.transpiler&&(i.metadata.exports="traceur"),"typescript"===s.transpiler&&(i.metadata.exports="ts")),s._loader.loadedTranspiler=!0),s._loader.loadedTranspilerRuntime===!1&&(i.name!=s.normalizeSync("traceur-runtime")&&i.name!=s.normalizeSync("babel/external-helpers*")||(o.length>100&&(i.metadata.format=i.metadata.format||"global"),s._loader.loadedTranspilerRuntime=!0)),("register"==i.metadata.format||i.metadata.bundle)&&s._loader.loadedTranspilerRuntime!==!0){if("traceur"==s.transpiler&&!e.$traceurRuntime&&i.source.match(n))return s._loader.loadedTranspilerRuntime=s._loader.loadedTranspilerRuntime||!1,s.import("traceur-runtime").then(function(){return o});if("babel"==s.transpiler&&!e.babelHelpers&&i.source.match(a))return s._loader.loadedTranspilerRuntime=s._loader.loadedTranspilerRuntime||!1,s.import("babel/external-helpers").then(function(){return o})}return o})}})}();var ie="undefined"!=typeof self?"self":"global";i("fetch",function(e){return function(t){return t.metadata.exports&&!t.metadata.format&&(t.metadata.format="global"),e.call(this,t)}}),i("instantiate",function(e){return function(t){var r=this;if(t.metadata.format||(t.metadata.format="global"),"global"==t.metadata.format&&!t.metadata.entry){var n=k();t.metadata.entry=n,n.deps=[];for(var a in t.metadata.globals){var o=t.metadata.globals[a];o&&n.deps.push(o)}n.execute=function(e,n,a){var o;if(t.metadata.globals){o={};for(var i in t.metadata.globals)t.metadata.globals[i]&&(o[i]=e(t.metadata.globals[i]))}var s=t.metadata.exports;s&&(t.source+="\n"+ie+'["'+s+'"] = '+s+";");var l=r.get("@@global-helpers").prepareGlobal(a.id,s,o,!!t.metadata.encapsulateGlobal);return ee.call(r,t),l()}}return e.call(this,t)}}),i("reduceRegister_",function(e){return function(t,r){if(r||!t.metadata.exports&&(!A||"global"!=t.metadata.format))return e.call(this,t,r);t.metadata.format="global";var n=t.metadata.entry=k();n.deps=t.metadata.deps;var a=R(t.metadata.exports);n.execute=function(){return a}}}),s(function(t){return function(){function r(t){if(Object.keys)Object.keys(e).forEach(t);else for(var r in e)i.call(e,r)&&t(r)}function n(t){r(function(r){if(U.call(s,r)==-1){try{var n=e[r]}catch(e){s.push(r)}t(r,n)}})}var a=this;t.call(a);var o,i=Object.prototype.hasOwnProperty,s=["_g","sessionStorage","localStorage","clipboardData","frames","frameElement","external","mozAnimationStartTime","webkitStorageInfo","webkitIndexedDB","mozInnerScreenY","mozInnerScreenX"];a.set("@@global-helpers",a.newModule({prepareGlobal:function(t,r,a,i){var s=e.define;e.define=void 0;var l;if(a){l={};for(var u in a)l[u]=e[u],e[u]=a[u]}return r||(o={},n(function(e,t){o[e]=t})),function(){var t,a=r?R(r):{},u=!!r;if(r&&!i||n(function(n,s){o[n]!==s&&"undefined"!=typeof s&&(i&&(e[n]=void 0),r||(a[n]=s,"undefined"!=typeof t?u||t===s||(u=!0):t=s))}),a=u?a:t,l)for(var d in l)e[d]=l[d];return e.define=s,a}}}))}}),function(){function t(e){function t(e,t){for(var r=0;rt.index)return!0;return!1}n.lastIndex=a.lastIndex=o.lastIndex=0;var r,i=[],s=[],l=[];if(e.length/e.split("\n").length<200){for(;r=o.exec(e);)s.push([r.index,r.index+r[0].length]);for(;r=a.exec(e);)t(s,r)||l.push([r.index+r[1].length,r.index+r[0].length-1])}for(;r=n.exec(e);)if(!t(s,r)&&!t(l,r)){var u=r[1].substr(1,r[1].length-2);if(u.match(/"|'/))continue;"/"==u[u.length-1]&&(u=u.substr(0,u.length-1)),i.push(u)}return i}var r=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF.])(exports\s*(\[['"]|\.)|module(\.exports|\['exports'\]|\["exports"\])\s*(\[['"]|[=,\.]))/,n=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF."'])require\s*\(\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*\)/g,a=/(^|[^\\])(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,o=/("[^"\\\n\r]*(\\.[^"\\\n\r]*)*"|'[^'\\\n\r]*(\\.[^'\\\n\r]*)*')/g,s=/^\#\!.*/;i("instantiate",function(a){return function(o){var i=this;if(o.metadata.format||(r.lastIndex=0,n.lastIndex=0,(n.exec(o.source)||r.exec(o.source))&&(o.metadata.format="cjs")),"cjs"==o.metadata.format){var l=o.metadata.deps,u=o.metadata.cjsRequireDetection===!1?[]:t(o.source);for(var d in o.metadata.globals)o.metadata.globals[d]&&u.push(o.metadata.globals[d]);var c=k();o.metadata.entry=c,c.deps=u,c.executingRequire=!0,c.execute=function(t,r,n){function a(e){return"/"==e[e.length-1]&&(e=e.substr(0,e.length-1)),t.apply(this,arguments)}if(a.resolve=function(e){return i.get("@@cjs-helpers").requireResolve(e,n.id)},n.paths=[],n.require=t,!o.metadata.cjsDeferDepsExecute)for(var u=0;u1;)n=a.shift(),e=e[n]=e[n]||{};n=a.shift(),n in e||(e[n]=r)}s(function(e){return function(){this.meta={},e.call(this)}}),i("locate",function(e){return function(t){var r,n=this.meta,a=t.name,o=0;for(var i in n)if(r=i.indexOf("*"),r!==-1&&i.substr(0,r)===a.substr(0,r)&&i.substr(r+1)===a.substr(a.length-i.length+r+1)){var s=i.split("/").length;s>o&&(o=s),v(t.metadata,n[i],o!=s)}return n[a]&&v(t.metadata,n[a]),e.call(this,t)}});var t=/^(\s*\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)+/,r=/\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\/\/[^\n]*|"[^"]+"\s*;?|'[^']+'\s*;?/g;i("translate",function(n){return function(a){if("defined"==a.metadata.format)return a.metadata.deps=a.metadata.deps||[],Promise.resolve(a.source);var o=a.source.match(t);if(o)for(var i=o[0].match(r),s=0;s')}else e()}else if("undefined"!=typeof importScripts){var a="";try{throw new Error("_")}catch(e){e.stack.replace(/(?:at|@).*(http.+):[\d]+:[\d]+/,function(e,t){$__curScript={src:t},a=t.replace(/\/[^\/]*$/,"/")})}t&&importScripts(a+"system-polyfills.js"),e()}else $__curScript="undefined"!=typeof __filename?{src:__filename}:null,e()}(); +!function(){function e(){!function(e){function t(e,r){if("string"!=typeof e)throw new TypeError("URL must be a string");var n=String(e).replace(/^\s+|\s+$/g,"").replace(/\\/g,"/").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);if(!n)throw new RangeError("Invalid URL format");var a=n[1]||"",o=n[2]||"",i=n[3]||"",s=n[4]||"",l=n[5]||"",u=n[6]||"",d=n[7]||"",c=n[8]||"",f=n[9]||"";if(void 0!==r){var m=r instanceof t?r:new t(r),p=!a&&!s&&!o;!p||d||c||(c=m.search),p&&"/"!==d[0]&&(d=d?(!m.host&&!m.username||m.pathname?"":"/")+m.pathname.slice(0,m.pathname.lastIndexOf("/")+1)+d:m.pathname);var h=[];d.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?h.pop():h.push(e)}),d=h.join("").replace(/^\//,"/"===d[0]?"/":""),p&&(u=m.port,l=m.hostname,s=m.host,i=m.password,o=m.username),a||(a=m.protocol)}d=d.replace(/\\/g,"/"),this.origin=s?a+(""!==a||""!==s?"//":"")+s:"",this.href=a+(a&&s||"file:"==a?"//":"")+(""!==o?o+(""!==i?":"+i:"")+"@":"")+s+d+c+f,this.protocol=a,this.username=o,this.password=i,this.host=s,this.hostname=l,this.port=u,this.pathname=d,this.search=c,this.hash=f}e.URLPolyfill=t}("undefined"!=typeof self?self:global),function(e){function t(e,t){if(!e.originalErr)for(var r=((e.message||e)+(e.stack?"\n"+e.stack:"")).toString().split("\n"),n=[],a=0;as.length?(o[s]&&"/"||"")+t.substr(s.length):"")}else{var d=s.split("*");if(d.length>2)throw new TypeError("Only one wildcard in a path is permitted");var f=d[0].length;f>=a&&t.substr(0,d[0].length)==d[0]&&t.substr(t.length-d[1].length)==d[1]&&(a=f,n=s,r=t.substr(d[0].length,t.length-d[1].length-d[0].length))}}var m=o[n];return"string"==typeof r&&(m=m.replace("*",r)),m}function m(e){for(var t=[],r=[],n=0,a=e.length;a>n;n++){var o=$.call(t,e[n]);-1===o?(t.push(e[n]),r.push([n])):r[o].push(n)}return{names:t,indices:r}}function p(t){var r={};if(("object"==typeof t||"function"==typeof t)&&t!==e)if(te)for(var n in t)"default"!==n&&h(r,t,n);else g(r,t);return r["default"]=t,U(r,"__useDefault",{value:!0}),r}function h(e,t,r){try{var n;(n=Object.getOwnPropertyDescriptor(t,r))&&U(e,r,n)}catch(a){return e[r]=t[r],!1}}function g(e,t,r){var n=t&&t.hasOwnProperty;for(var a in t)(!n||t.hasOwnProperty(a))&&(r&&a in e||(e[a]=t[a]));return e}function v(e,t,r){var n=t&&t.hasOwnProperty;for(var a in t)if(!n||t.hasOwnProperty(a)){var o=t[a];a in e?o instanceof Array&&e[a]instanceof Array?e[a]=[].concat(r?o:e[a]).concat(r?e[a]:o):"object"==typeof o&&null!==o&&"object"==typeof e[a]?e[a]=g(g({},e[a]),o,r):r||(e[a]=o):e[a]=o}}function y(e,t,r,n,a){for(var o in t)if(-1!=$.call(["main","format","defaultExtension","basePath"],o))e[o]=t[o];else if("map"==o)g(e.map=e.map||{},t.map);else if("meta"==o)g(e.meta=e.meta||{},t.meta);else if("depCache"==o)for(var i in t.depCache){var s;s="./"==i.substr(0,2)?r+"/"+i.substr(2):M.call(n,i),n.depCache[s]=(n.depCache[s]||[]).concat(t.depCache[i])}else!a||-1!=$.call(["browserConfig","nodeConfig","devConfig","productionConfig"],o)||t.hasOwnProperty&&!t.hasOwnProperty(o)||w.call(n,'"'+o+'" is not a valid package configuration option in package '+r)}function b(e,t,r,n){var a;if(e.packages[t]){var o=e.packages[t];a=e.packages[t]={},y(a,n?r:o,t,e,n),y(a,n?o:r,t,e,!n)}else a=e.packages[t]=r;return"object"==typeof a.main&&(a.map=a.map||{},a.map["./@main"]=a.main,a.main["default"]=a.main["default"]||"./",a.main="@main"),a}function w(e){this.warnings&&"undefined"!=typeof console&&console.warn&&console.warn(e)}function x(e,t){e.metadata.entry=R(),e.metadata.entry.execute=function(){return t},e.metadata.entry.deps=[],e.metadata.format="defined"}function S(e,t){for(var r=e.split(".");r.length;)t=t[r.shift()];return t}function _(e,t){var r,n=0;for(var a in e)if(t.substr(0,a.length)==a&&(t.length==a.length||"/"==t[a.length])){var o=a.split("/").length;if(n>=o)continue;r=a,n=o}return r}function E(e){this._loader.baseURL!==this.baseURL&&("/"!=this.baseURL[this.baseURL.length-1]&&(this.baseURL+="/"),this._loader.baseURL=this.baseURL=new G(this.baseURL,ee).href)}function j(e,t){this.set("@system-env",ne=this.newModule({browser:D,node:!!this._nodeRequire,production:!t&&e,dev:t||!e,build:t,"default":!0}))}function P(e,t){if(!d(e))throw new Error("Node module "+e+" can't be loaded as it is not a package require.");if(!ae){var r=this._nodeRequire("module"),n=t.substr(q?8:7);ae=new r(n),ae.paths=r._nodeModulePaths(n)}return ae.require(e)}function M(e,t){if(u(e))return c(e,t);if(l(e))return e;var r=_(this.map,e);if(r){if(e=this.map[r]+e.substr(r.length),u(e))return c(e);if(l(e))return e}if(this.has(e))return e;if("@node/"==e.substr(0,6)){if(!this._nodeRequire)throw new TypeError("Error loading "+e+". Can only load node core modules in Node.");return this.builder?this.set(e,this.newModule({})):this.set(e,this.newModule(p(P.call(this,e.substr(6),this.baseURL)))),e}return E.call(this),f(this,e)||this.baseURL+e}function O(e,t,r){ne.browser&&t.browserConfig&&r(t.browserConfig),ne.node&&t.nodeConfig&&r(t.nodeConfig),ne.dev&&t.devConfig&&r(t.devConfig),ne.build&&t.buildConfig&&r(t.buildConfig),ne.production&&t.productionConfig&&r(t.productionConfig)}function k(e){var t=e.match(se);return t&&"System.register"==e.substr(t[0].length,15)}function R(){return{name:null,deps:null,originalIndices:null,declare:null,execute:null,executingRequire:!1,declarative:!1,normalizedDeps:null,groupIndex:null,evaluated:!1,module:null,esModule:null,esmExports:!1}}function z(t){if("string"==typeof t)return S(t,e);if(!(t instanceof Array))throw new Error("Global exports must be a string or array.");for(var r={},n=!0,a=0;at;t++)if(this[t]===e)return t;return-1};!function(){try{Object.defineProperty({},"a",{})&&(U=Object.defineProperty)}catch(e){U=function(e,t,r){try{e[t]=r.value||r.get.call(e)}catch(n){}}}}();var J,N="_"==new Error(0,"_").fileName;if("undefined"!=typeof document&&document.getElementsByTagName){if(J=document.baseURI,!J){var B=document.getElementsByTagName("base");J=B[0]&&B[0].href||window.location.href}}else"undefined"!=typeof location&&(J=e.location.href);if(J)J=J.split("#")[0].split("?")[0],J=J.substr(0,J.lastIndexOf("/")+1);else{if("undefined"==typeof process||!process.cwd)throw new TypeError("No environment baseURI");J="file://"+(q?"/":"")+process.cwd()+"/",q&&(J=J.replace(/\\/g,"/"))}try{var H="test:"==new e.URL("test:///").protocol}catch(X){}var G=H?e.URL:e.URLPolyfill;U(r.prototype,"toString",{value:function(){return"Module"}}),function(){function e(e){return{status:"loading",name:e||"",linkSets:[],dependencies:[],metadata:{}}}function a(e,t,r){return new Promise(u({step:r.address?"fetch":"locate",loader:e,moduleName:t,moduleMetadata:r&&r.metadata||{},moduleSource:r.source,moduleAddress:r.address}))}function o(t,r,n,a){return new Promise(function(e,o){e(t.loaderObj.normalize(r,n,a))}).then(function(r){var n;if(t.modules[r])return n=e(r),n.status="linked",n.module=t.modules[r],n;for(var a=0,o=t.loads.length;o>a;a++)if(n=t.loads[a],n.name==r)return n;return n=e(r),t.loads.push(n),i(t,n),n})}function i(e,t){s(e,t,Promise.resolve().then(function(){return e.loaderObj.locate({name:t.name,metadata:t.metadata})}))}function s(e,t,r){l(e,t,r.then(function(r){return"loading"==t.status?(t.address=r,e.loaderObj.fetch({name:t.name,metadata:t.metadata,address:r})):void 0}))}function l(e,t,r){r.then(function(r){return"loading"==t.status?(t.address=t.address||t.name,Promise.resolve(e.loaderObj.translate({name:t.name,metadata:t.metadata,address:t.address,source:r})).then(function(r){return t.source=r,e.loaderObj.instantiate({name:t.name,metadata:t.metadata,address:t.address,source:r})}).then(function(e){if(void 0===e)throw new TypeError("Declarative modules unsupported in the polyfill.");if("object"!=typeof e)throw new TypeError("Invalid instantiate return value");t.depsList=e.deps||[],t.execute=e.execute}).then(function(){t.dependencies=[];for(var r=t.depsList,n=[],a=0,i=r.length;i>a;a++)(function(r,a){n.push(o(e,r,t.name,t.address).then(function(e){if(t.dependencies[a]={key:r,value:e.name},"linked"!=e.status)for(var n=t.linkSets.concat([]),o=0,i=n.length;i>o;o++)c(n[o],e)}))})(r[a],a);return Promise.all(n)}).then(function(){t.status="loaded";for(var e=t.linkSets.concat([]),r=0,n=e.length;n>r;r++)m(e[r],t)})):void 0})["catch"](function(e){t.status="failed",t.exception=e;for(var r=t.linkSets.concat([]),n=0,a=r.length;a>n;n++)p(r[n],t,e)})}function u(t){return function(r,n){var a=t.loader,o=t.moduleName,u=t.step;if(a.modules[o])throw new TypeError('"'+o+'" already exists in the module table');for(var c,f=0,m=a.loads.length;m>f;f++)if(a.loads[f].name==o&&(c=a.loads[f],"translate"!=u||c.source||(c.address=t.moduleAddress,l(a,c,Promise.resolve(t.moduleSource))),c.linkSets.length&&c.linkSets[0].loads[0].name==c.name))return c.linkSets[0].done.then(function(){r(c)});var p=c||e(o);p.metadata=t.moduleMetadata;var h=d(a,p);a.loads.push(p),r(h.done),"locate"==u?i(a,p):"fetch"==u?s(a,p,Promise.resolve(t.moduleAddress)):(p.address=t.moduleAddress,l(a,p,Promise.resolve(t.moduleSource)))}}function d(e,t){var r={loader:e,loads:[],startingLoad:t,loadingCount:0};return r.done=new Promise(function(e,t){r.resolve=e,r.reject=t}),c(r,t),r}function c(e,t){if("failed"!=t.status){for(var r=0,n=e.loads.length;n>r;r++)if(e.loads[r]==t)return;e.loads.push(t),t.linkSets.push(e),"loaded"!=t.status&&e.loadingCount++;for(var a=e.loader,r=0,n=t.dependencies.length;n>r;r++)if(t.dependencies[r]){var o=t.dependencies[r].value;if(!a.modules[o])for(var i=0,s=a.loads.length;s>i;i++)if(a.loads[i].name==o){c(e,a.loads[i]);break}}}}function f(e){var t=!1;try{y(e,function(r,n){p(e,r,n),t=!0})}catch(r){p(e,null,r),t=!0}return t}function m(e,t){if(e.loadingCount--,!(e.loadingCount>0)){var r=e.startingLoad;if(e.loader.loaderObj.execute===!1){for(var n=[].concat(e.loads),a=0,o=n.length;o>a;a++){var t=n[a];t.module={name:t.name,module:w({}),evaluated:!0},t.status="linked",h(e.loader,t)}return e.resolve(r)}var i=f(e);i||e.resolve(r)}}function p(e,r,n){var a=e.loader;e:if(r)if(e.loads[0].name==r.name)n=t(n,"Error loading "+r.name);else{for(var o=0;oo;o++){var r=u[o];a.loaderObj.failed=a.loaderObj.failed||[],-1==$.call(a.loaderObj.failed,r)&&a.loaderObj.failed.push(r);var c=$.call(r.linkSets,e);if(r.linkSets.splice(c,1),0==r.linkSets.length){var f=$.call(e.loader.loads,r);-1!=f&&e.loader.loads.splice(f,1)}}e.reject(n)}function h(e,t){if(e.loaderObj.trace){e.loaderObj.loads||(e.loaderObj.loads={});var r={};t.dependencies.forEach(function(e){r[e.key]=e.value}),e.loaderObj.loads[t.name]={name:t.name,deps:t.dependencies.map(function(e){return e.key}),depMap:r,address:t.address,metadata:t.metadata,source:t.source}}t.name&&(e.modules[t.name]=t.module);var n=$.call(e.loads,t);-1!=n&&e.loads.splice(n,1);for(var a=0,o=t.linkSets.length;o>a;a++)n=$.call(t.linkSets[a].loads,t),-1!=n&&t.linkSets[a].loads.splice(n,1);t.linkSets.splice(0,t.linkSets.length)}function g(e,t,n){try{var a=t.execute()}catch(o){return void n(t,o)}return a&&a instanceof r?a:void n(t,new TypeError("Execution must define a Module instance"))}function v(e,t,r){var n=e._loader.importPromises;return n[t]=r.then(function(e){return n[t]=void 0,e},function(e){throw n[t]=void 0,e})}function y(e,t){var r=e.loader;if(e.loads.length)for(var n=e.loads.concat([]),a=0;a "'+n.paths[o]+'" uses wildcards which are being deprecated for just leaving a trailing "/" to indicate folder paths.')}if(e.defaultJSExtensions&&(n.defaultJSExtensions=e.defaultJSExtensions,w.call(n,"The defaultJSExtensions configuration option is deprecated, use packages configuration instead.")),e.pluginFirst&&(n.pluginFirst=e.pluginFirst),e.map)for(var o in e.map){var i=e.map[o];if("string"!=typeof i){var s=n.defaultJSExtensions&&".js"!=o.substr(o.length-3,3),l=n.decanonicalize(o);s&&".js"==l.substr(l.length-3,3)&&(l=l.substr(0,l.length-3));var u="";for(var c in n.packages)l.substr(0,c.length)==c&&(!l[c.length]||"/"==l[c.length])&&u.split("/").lengtha&&(r=o,a=n));return r}function t(e,t,r,n,a){if(!n||"/"==n[n.length-1]||a||t.defaultExtension===!1)return n;var o=!1;if(t.meta&&p(t.meta,n,function(e,t,r){return 0==r||e.lastIndexOf("*")!=e.length-1?o=!0:void 0}),!o&&e.meta&&p(e.meta,r+"/"+n,function(e,t,r){return 0==r||e.lastIndexOf("*")!=e.length-1?o=!0:void 0}),o)return n;var i="."+(t.defaultExtension||"js");return n.substr(n.length-i.length)!=i?n+i:n}function r(e,r,n,a,i){if(!a){if(!r.main)return n+(e.defaultJSExtensions?".js":"");a="./"==r.main.substr(0,2)?r.main.substr(2):r.main}if(r.map){var s="./"+a,l=_(r.map,s);if(l||(s="./"+t(e,r,n,a,i),s!="./"+a&&(l=_(r.map,s))),l){var u=o(e,r,n,l,s,i);if(u)return u}}return n+"/"+t(e,r,n,a,i)}function n(e,t,r,n){if("."==e)throw new Error("Package "+r+' has a map entry for "." which is not permitted.');return t.substr(0,e.length)==e&&n.length>e.length?!1:!0}function o(e,r,a,o,i,s){"/"==i[i.length-1]&&(i=i.substr(0,i.length-1));var l=r.map[o];if("object"==typeof l)throw new Error("Synchronous conditional normalization not supported sync normalizing "+o+" in "+a);if(n(o,l,a,i)&&"string"==typeof l){if("."==l)l=a;else if("./"==l.substr(0,2))return a+"/"+t(e,r,a,l.substr(2)+i.substr(o.length),s);return e.normalizeSync(l+i.substr(o.length),a+"/")}}function l(e,r,n,a,o){if(!a){if(!r.main)return Promise.resolve(n+(e.defaultJSExtensions?".js":""));a="./"==r.main.substr(0,2)?r.main.substr(2):r.main}var i,s;return r.map&&(i="./"+a,s=_(r.map,i),s||(i="./"+t(e,r,n,a,o),i!="./"+a&&(s=_(r.map,i)))),(s?d(e,r,n,s,i,o):Promise.resolve()).then(function(i){return i?Promise.resolve(i):Promise.resolve(n+"/"+t(e,r,n,a,o))})}function u(e,r,n,a,o,i,s){if("."==o)o=n;else if("./"==o.substr(0,2))return Promise.resolve(n+"/"+t(e,r,n,o.substr(2)+i.substr(a.length),s)).then(function(t){return C.call(e,t,n+"/")});return e.normalize(o+i.substr(a.length),n+"/")}function d(e,t,r,a,o,i){"/"==o[o.length-1]&&(o=o.substr(0,o.length-1));var s=t.map[a];if("string"==typeof s)return n(a,s,r,o)?u(e,t,r,a,s,o,i):Promise.resolve();if(e.builder)return Promise.resolve(r+"/#:"+o);var l=[],d=[];for(var c in s){var f=I(c);d.push({condition:f,map:s[c]}),l.push(e["import"](f.module,r))}return Promise.all(l).then(function(e){for(var t=0;tl&&(l=r),v(s,t,r&&l>r)}),v(r.metadata,s)}o.format&&!r.metadata.loader&&(r.metadata.format=r.metadata.format||o.format)}return t})}})}(),function(){function t(){if(s&&"interactive"===s.script.readyState)return s.load;for(var e=0;ea;a++){var i=e.normalizedDeps[a],s=r.defined[i];if(s&&!s.evaluated){var l=e.groupIndex+(s.declarative!=e.declarative);if(null===s.groupIndex||s.groupIndex=0;i--){for(var s=a[i],l=0;ln;n++){var s=a.importers[n];if(!s.locked){var l=$.call(s.dependencies,a),u=s.setters[l];u&&u(o)}}return a.locked=!1,t},{id:t.name});if("function"==typeof i&&(i={setters:[],execute:i}),i=i||{setters:[],execute:function(){}},a.setters=i.setters,a.execute=i.execute,!a.setters||!a.execute)throw new TypeError("Invalid System.register form for "+t.name);for(var s=0,d=t.normalizedDeps.length;d>s;s++){var c,f=t.normalizedDeps[s],m=r.defined[f],p=n[f];p?c=p.exports:m&&!m.declarative?c=m.esModule:m?(u(m,r),p=m.module,c=p.exports):c=r.get(f),p&&p.importers?(p.importers.push(a),a.dependencies.push(p)):a.dependencies.push(null);for(var h=t.originalIndices[s],g=0,v=h.length;v>g;++g){var y=h[g];a.setters[y]&&a.setters[y](c)}}}}function d(e,t){var r,n=t.defined[e];if(n)n.declarative?f(e,n,[],t):n.evaluated||c(n,t),r=n.module.exports;else if(r=t.get(e),!r)throw new Error("Unable to load dependency "+e+".");return(!n||n.declarative)&&r&&r.__useDefault?r["default"]:r}function c(t,n){if(!t.module){var a={},o=t.module={exports:a,id:t.name};if(!t.executingRequire)for(var i=0,s=t.normalizedDeps.length;s>i;i++){var l=t.normalizedDeps[i],u=n.defined[l];u&&c(u,n)}t.evaluated=!0;var f=t.execute.call(e,function(e){for(var r=0,a=t.deps.length;a>r;r++)if(t.deps[r]==e)return d(t.normalizedDeps[r],n);var o=n.normalizeSync(e,t.name);if(-1!=$.call(t.normalizedDeps,o))return d(o,n);throw new Error("Module "+e+" not declared as a dependency of "+t.name)},a,o);void 0!==f&&(o.exports=f),a=o.exports,a&&(a.__esModule||a instanceof r)?t.esModule=n.newModule(a):t.esmExports&&a!==e?t.esModule=n.newModule(p(a)):t.esModule=n.newModule({"default":a,__useDefault:!0})}}function f(t,r,n,a){if(r&&!r.evaluated&&r.declarative){n.push(t);for(var o=0,i=r.normalizedDeps.length;i>o;o++){var s=r.normalizedDeps[o];-1==$.call(n,s)&&(a.defined[s]?f(s,a.defined[s],n,a):a.get(s))}r.evaluated||(r.evaluated=!0,r.module.execute.call(e))}}a.prototype.register=function(e,t,r){if("string"!=typeof e&&(r=t,t=e,e=null),"boolean"==typeof r)return this.registerDynamic.apply(this,arguments);var n=R();n.name=e&&(this.decanonicalize||this.normalize).call(this,e),n.declarative=!0,n.deps=t,n.declare=r,this.pushRegister_({amd:!1,entry:n})},a.prototype.registerDynamic=function(e,t,r,n){"string"!=typeof e&&(n=r,r=t,t=e,e=null);var a=R();a.name=e&&(this.decanonicalize||this.normalize).call(this,e),a.deps=t,a.execute=n,a.executingRequire=r,this.pushRegister_({amd:!1,entry:a})},i("reduceRegister_",function(){return function(e,t){if(t){var r=t.entry,n=e&&e.metadata;if(r.name&&(r.name in this.defined||(this.defined[r.name]=r),n&&(n.bundle=!0)),!r.name||e&&!n.entry&&r.name==e.name){if(!n)throw new TypeError("Invalid System.register call. Anonymous System.register calls can only be made by modules loaded by SystemJS.import and not via script tags.");if(n.entry)throw"register"==n.format?new Error("Multiple anonymous System.register calls in module "+e.name+". If loading a bundle, ensure all the System.register calls are named."):new Error("Module "+e.name+" interpreted as "+n.format+" module format, but called System.register.");n.format||(n.format="register"),n.entry=r}}}}),s(function(e){return function(){e.call(this),this.defined={},this._loader.moduleRecords={}}}),U(o,"toString",{value:function(){return"Module"}}),i("delete",function(e){return function(t){return delete this._loader.moduleRecords[t],delete this.defined[t],e.call(this,t)}}),i("fetch",function(e){return function(t){return this.defined[t.name]?(t.metadata.format="defined",""):(t.metadata.deps=t.metadata.deps||[],e.call(this,t))}}),i("translate",function(e){return function(t){return t.metadata.deps=t.metadata.deps||[],Promise.resolve(e.apply(this,arguments)).then(function(e){return("register"==t.metadata.format||"system"==t.metadata.format||!t.metadata.format&&k(t.source))&&(t.metadata.format="register"),e})}}),i("load",function(e){return function(t){var r=this,a=r.defined[t];return!a||a.deps.length?e.apply(this,arguments):(a.originalIndices=a.normalizedDeps=[],n(t,a,r),f(t,a,[],r),a.esModule||(a.esModule=r.newModule(a.module.exports)),r.trace||(r.defined[t]=void 0),r.set(t,a.esModule),Promise.resolve())}}),i("instantiate",function(e){return function(t){"detect"==t.metadata.format&&(t.metadata.format=void 0),e.call(this,t);var r,a=this;if(a.defined[t.name])r=a.defined[t.name],r.declarative||(r.deps=r.deps.concat(t.metadata.deps)),r.deps=r.deps.concat(t.metadata.deps);else if(t.metadata.entry)r=t.metadata.entry,r.deps=r.deps.concat(t.metadata.deps);else if(!(a.builder&&t.metadata.bundle||"register"!=t.metadata.format&&"esm"!=t.metadata.format&&"es6"!=t.metadata.format)){if("undefined"!=typeof re&&re.call(a,t),!t.metadata.entry&&!t.metadata.bundle)throw new Error(t.name+" detected as "+t.metadata.format+" but didn't execute.");r=t.metadata.entry,r&&t.metadata.deps&&(r.deps=r.deps.concat(t.metadata.deps))}r||(r=R(),r.deps=t.metadata.deps,r.execute=function(){}),a.defined[t.name]=r;var o=m(r.deps);r.deps=o.names,r.originalIndices=o.indices,r.name=t.name,r.esmExports=t.metadata.esmExports!==!1;for(var i=[],s=0,l=r.deps.length;l>s;s++)i.push(Promise.resolve(a.normalize(r.deps[s],t.name)));return Promise.all(i).then(function(e){return r.normalizedDeps=e,{deps:r.deps,execute:function(){return n(t.name,r,a),f(t.name,r,[],a),r.esModule||(r.esModule=a.newModule(r.module.exports)),a.trace||(a.defined[t.name]=void 0),r.esModule}}})}})}(),function(){var r=/(^\s*|[}\);\n]\s*)(import\s*(['"]|(\*\s+as\s+)?[^"'\(\)\n;]+\s*from\s*['"]|\{)|export\s+\*\s+from\s+["']|export\s*(\{|default|function|class|var|const|let|async\s+function))/,n=/\$traceurRuntime\s*\./,a=/babelHelpers\s*\./;i("translate",function(o){return function(i){var s=this,l=arguments;return o.apply(s,l).then(function(o){if("esm"==i.metadata.format||"es6"==i.metadata.format||!i.metadata.format&&o.match(r)){if("es6"==i.metadata.format&&w.call(s,"Module "+i.name+' has metadata setting its format to "es6", which is deprecated.\nThis should be updated to "esm".'),i.metadata.format="esm",i.metadata.deps){for(var u="",d=0;d100&&!i.metadata.format&&(i.metadata.format="global","traceur"===s.transpiler&&(i.metadata.exports="traceur"),"typescript"===s.transpiler&&(i.metadata.exports="ts")),s._loader.loadedTranspiler=!0),s._loader.loadedTranspilerRuntime===!1&&(i.name==s.normalizeSync("traceur-runtime")||i.name==s.normalizeSync("babel/external-helpers*"))&&(o.length>100&&(i.metadata.format=i.metadata.format||"global"),s._loader.loadedTranspilerRuntime=!0),("register"==i.metadata.format||i.metadata.bundle)&&s._loader.loadedTranspilerRuntime!==!0){if("traceur"==s.transpiler&&!e.$traceurRuntime&&i.source.match(n))return s._loader.loadedTranspilerRuntime=s._loader.loadedTranspilerRuntime||!1,s["import"]("traceur-runtime").then(function(){return o});if("babel"==s.transpiler&&!e.babelHelpers&&i.source.match(a))return s._loader.loadedTranspilerRuntime=s._loader.loadedTranspilerRuntime||!1,s["import"]("babel/external-helpers").then(function(){return o})}return o})}})}();var le="undefined"!=typeof self?"self":"global";i("fetch",function(e){return function(t){return t.metadata.exports&&!t.metadata.format&&(t.metadata.format="global"),e.call(this,t)}}),i("instantiate",function(e){return function(t){var r=this;if(t.metadata.format||(t.metadata.format="global"),"global"==t.metadata.format&&!t.metadata.entry){var n=R();t.metadata.entry=n,n.deps=[];for(var a in t.metadata.globals){var o=t.metadata.globals[a];o&&n.deps.push(o)}n.execute=function(e,n,a){var o;if(t.metadata.globals){o={};for(var i in t.metadata.globals)t.metadata.globals[i]&&(o[i]=e(t.metadata.globals[i]))}var s=t.metadata.exports;s&&(t.source+="\n"+le+'["'+s+'"] = '+s+";");var l=r.get("@@global-helpers").prepareGlobal(a.id,s,o,!!t.metadata.encapsulateGlobal);return re.call(r,t),l()}}return e.call(this,t)}}),i("reduceRegister_",function(e){return function(t,r){if(r||!t.metadata.exports&&(!F||"global"!=t.metadata.format))return e.call(this,t,r);t.metadata.format="global";var n=t.metadata.entry=R();n.deps=t.metadata.deps;var a=z(t.metadata.exports);n.execute=function(){return a}}}),s(function(t){return function(){function r(t){if(Object.keys)Object.keys(e).forEach(t);else for(var r in e)i.call(e,r)&&t(r)}function n(t){r(function(r){if(-1==$.call(s,r)){try{var n=e[r]}catch(a){s.push(r)}t(r,n)}})}var a=this;t.call(a);var o,i=Object.prototype.hasOwnProperty,s=["_g","sessionStorage","localStorage","clipboardData","frames","frameElement","external","mozAnimationStartTime","webkitStorageInfo","webkitIndexedDB","mozInnerScreenY","mozInnerScreenX"];a.set("@@global-helpers",a.newModule({prepareGlobal:function(t,r,a,i){var s=e.define;e.define=void 0;var l;if(a){l={};for(var u in a)l[u]=e[u],e[u]=a[u]}return r||(o={},n(function(e,t){o[e]=t})),function(){var t,a=r?z(r):{},u=!!r;if((!r||i)&&n(function(n,s){o[n]!==s&&"undefined"!=typeof s&&(i&&(e[n]=void 0),r||(a[n]=s,"undefined"!=typeof t?u||t===s||(u=!0):t=s))}),a=u?a:t,l)for(var d in l)e[d]=l[d];return e.define=s,a}}}))}}),function(){function t(e){function t(e,t){for(var r=0;rt.index)return!0;return!1}n.lastIndex=a.lastIndex=o.lastIndex=0;var r,i=[],s=[],l=[];if(e.length/e.split("\n").length<200){for(;r=o.exec(e);)s.push([r.index,r.index+r[0].length]);for(;r=a.exec(e);)t(s,r)||l.push([r.index+r[1].length,r.index+r[0].length-1])}for(;r=n.exec(e);)if(!t(s,r)&&!t(l,r)){var u=r[1].substr(1,r[1].length-2);if(u.match(/"|'/))continue;"/"==u[u.length-1]&&(u=u.substr(0,u.length-1)),i.push(u)}return i}var r=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF.])(exports\s*(\[['"]|\.)|module(\.exports|\['exports'\]|\["exports"\])\s*(\[['"]|[=,\.]))/,n=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF."'])require\s*\(\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*\)/g,a=/(^|[^\\])(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,o=/("[^"\\\n\r]*(\\.[^"\\\n\r]*)*"|'[^'\\\n\r]*(\\.[^'\\\n\r]*)*')/g,s=/^\#\!.*/;i("instantiate",function(a){return function(o){var i=this;if(o.metadata.format||(r.lastIndex=0,n.lastIndex=0,(n.exec(o.source)||r.exec(o.source))&&(o.metadata.format="cjs")),"cjs"==o.metadata.format){var l=o.metadata.deps,u=o.metadata.cjsRequireDetection===!1?[]:t(o.source);for(var d in o.metadata.globals)o.metadata.globals[d]&&u.push(o.metadata.globals[d]);var c=R();o.metadata.entry=c,c.deps=u,c.executingRequire=!0,c.execute=function(t,r,n){function a(e){return"/"==e[e.length-1]&&(e=e.substr(0,e.length-1)),t.apply(this,arguments)}if(a.resolve=function(e){return i.get("@@cjs-helpers").requireResolve(e,n.id)},n.paths=[],n.require=t,!o.metadata.cjsDeferDepsExecute)for(var u=0;u1;)n=a.shift(),e=e[n]=e[n]||{};n=a.shift(),n in e||(e[n]=r)}s(function(e){return function(){this.meta={},e.call(this)}}),i("locate",function(e){return function(t){var r,n=this.meta,a=t.name,o=0;for(var i in n)if(r=i.indexOf("*"),-1!==r&&i.substr(0,r)===a.substr(0,r)&&i.substr(r+1)===a.substr(a.length-i.length+r+1)){var s=i.split("/").length;s>o&&(o=s),v(t.metadata,n[i],o!=s)}return n[a]&&v(t.metadata,n[a]),e.call(this,t)}});var t=/^(\s*\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)+/,r=/\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\/\/[^\n]*|"[^"]+"\s*;?|'[^']+'\s*;?/g;i("translate",function(n){return function(a){if("defined"==a.metadata.format)return a.metadata.deps=a.metadata.deps||[],Promise.resolve(a.source);var o=a.source.match(t);if(o)for(var i=o[0].match(r),s=0;s')}else e()}else if("undefined"!=typeof importScripts){var a="";try{throw new Error("_")}catch(o){o.stack.replace(/(?:at|@).*(http.+):[\d]+:[\d]+/,function(e,t){$__curScript={src:t},a=t.replace(/\/[^\/]*$/,"/")})}t&&importScripts(a+"system-polyfills.js"),e()}else $__curScript="undefined"!=typeof __filename?{src:__filename}:null,e()}(); //# sourceMappingURL=system.js.map diff --git a/node_modules/systemjs/dist/system.js.map b/node_modules/systemjs/dist/system.js.map index bda47f38e..362c1f5ea 100644 --- a/node_modules/systemjs/dist/system.js.map +++ b/node_modules/systemjs/dist/system.js.map @@ -1 +1 @@ -{"version":3,"sources":["system.src.js"],"names":["bootstrap","global","URLPolyfill","url","baseURL","TypeError","m","String","replace","match","RangeError","protocol","username","password","host","hostname","port","pathname","search","hash","undefined","base","flag","slice","lastIndexOf","output","p","pop","push","join","this","origin","href","self","__global","addToError","err","msg","originalErr","stack","message","toString","split","newStack","i","length","$__curScript","indexOf","src","newMsg","substr","isBrowser","isWindows","newErr","errArgs","Error","fileName","lineNumber","Module","Loader","options","_loader","loaderObj","loads","modules","importPromises","moduleRecords","defineProperty","get","SystemJSLoader","call","paths","systemJSConstructor","SystemProto","hook","name","prototype","hookConstructor","isAbsolute","absURLRegEx","isRel","isPlain","urlResolve","parent","baseURI","URL","baseURIObj","applyPaths","loader","wildcard","pathMatch","maxWildcardPrefixLen","pathsCache","hasOwnProperty","path","pathParts","wildcardPrefixLen","outPath","group","deps","names","indices","l","index","getESModule","exports","esModule","getOwnPropertyDescriptor","defineOrCopyProperty","extend","value","targetObj","sourceObj","propName","d","Object","ex","a","b","prepend","extendMeta","val","Array","concat","extendPkgConfig","pkgCfgA","pkgCfgB","pkgName","warnInvalidProperties","prop","map","meta","depCache","dNormalized","coreResolve","warn","setPkgConfig","cfg","prependConfig","pkg","packages","basePkg","main","warnings","console","readMemberExpression","pParts","shift","getMapMatch","bestMatch","bestMatchLength","curMatchLength","prepareBaseURL","setProduction","isProduction","isBuilder","set","envModule","newModule","browser","node","_nodeRequire","production","dev","build","default","getNodeModule","parentModuleContext","_nodeModulePaths","require","parentName","mapMatch","has","builder","envSet","envCallback","browserConfig","nodeConfig","devConfig","buildConfig","productionConfig","detectRegisterFormat","source","leadingCommentAndMeta","leadingCommentAndMetaRegEx","createEntry","originalIndices","declare","execute","executingRequire","declarative","normalizedDeps","groupIndex","evaluated","module","esmExports","getGlobalValue","globalValue","first","parseCondition","condition","conditionExport","conditionModule","negation","conditionExportIndex","sysConditions","negate","serializeCondition","conditionObj","resolveCondition","bool","normalize","then","normalizedCondition","load","q","interpolateConditional","conditionalMatch","interpolationRegEx","Promise","resolve","conditionValue","booleanConditional","booleanIndex","isWorker","window","importScripts","document","process","platform","assert","item","thisLen","e","obj","opt","getElementsByTagName","bases","location","cwd","nativeURL","createLoad","status","anonCnt","linkSets","dependencies","metadata","loadModule","asyncStartLoadPartwayThrough","step","address","moduleName","moduleMetadata","moduleSource","moduleAddress","requestLoad","request","refererName","refererAddress","reject","proceedToLocate","proceedToFetch","locate","proceedToTranslate","fetch","translate","instantiate","instantiateResult","depsList","loadPromises","depLoad","key","addLoadToLinkSet","all","updateLinkSetOnLoad","exc","exception","linkSetFailed","stepState","existingLoad","done","linkSet","createLinkSet","startingLoad","loadingCount","j","doLink","error","link","_newModule","finishLoad","abrupt","checkError","pLoad","dep","failed","linkIndex","splice","globalLoadsIndex","trace","depMap","forEach","loadIndex","doDynamicExecute","linkError","createImportPromise","promise","constructor","define","delete","import","parentAddress","sourcePromise","pNames","getOwnPropertyNames","configurable","enumerable","freeze","referrerName","referrerAddress","System","fetchTextFromURL","XMLHttpRequest","authorization","fulfill","xhr","responseText","statusText","sameDomain","doTimeout","domainCheck","exec","XDomainRequest","onload","onerror","ontimeout","onprogress","timeout","onreadystatechange","readyState","addEventListener","open","setRequestHeader","withCredentials","setTimeout","send","fs","readFile","data","dataString","opts","headers","Accept","credentials","r","ok","text","transpile","transpiler","pluginLoader","__useDefault","transpileFunction","Compiler","traceurTranspile","createLanguageService","typescriptTranspile","babelTranspile","traceur","traceurOptions","script","sourceMaps","filename","inputSourceMap","sourceMap","compiler","doTraceurCompile","compile","babel","babelOptions","code","ast","transform","ts","typescriptOptions","target","ScriptTarget","ES5","inlineSourceMap","ModuleKind","__exec","sourceMapString","hasBuffer","sourceMapPrefix","Buffer","btoa","unescape","encodeURIComponent","getSource","wrap","lastLineIndex","format","JSON","stringify","preExec","curLoad","callCounter","curSystem","SystemJS","postExec","scriptExec","head","body","documentElement","createElement","_e","apply","arguments","integrity","setAttribute","nonce","appendChild","removeChild","register","reduceRegister_","useVm","vm","supportsScriptExec","runInThisContext","eval","chrome","extension","navigator","userAgent","scriptSrc","defaultJSExtensions","pluginFirst","loaderErrorStack","skipExt","resolved","httpRequest","systemImport","systemTranslate","entry","parse","getConfig","curCurScript","config","isEnvConfig","checkHasConfig","transpilerRuntime","loadedTranspilerRuntime","bundles","packageConfigPaths","v","defaultJSExtension","decanonicalize","pkgMatch","packageLength","Math","max","normalized","bundle","normalizedBundleDep","c","getPackage","curPkg","pkgLen","curPkgLen","addDefaultExtension","subPath","skipExtensions","defaultExtension","metaMatch","getMetaMatches","metaPattern","matchMeta","matchDepth","applyPackageConfigSync","mapPath","mapped","doMapSync","validMapping","normalizeSync","applyPackageConfig","doMap","doStringMap","conditionPromises","conditions","conditionValues","createPkgConfigPathObj","lastWildcard","regEx","RegExp","getPackageConfigMatch","configPath","exactMatch","packageConfigPath","packageName","loadPackageConfigPath","pkgConfigPath","configLoader","systemjs","pkgMeta","matchFn","wildcardIndex","dotRel","exactMeta","decanonicalized","isPlugin","parentPackageName","parentPackage","parentMap","parentMapMatch","pkgConfigMatch","isConfigured","configured","bestDepth","getInteractiveScriptLoad","interactiveScript","interactiveLoadingScripts","webWorkerImport","workerLoad","curRequire","ieEvents","s","isOpera","opera","attachEvent","loadingCnt","registerQueue","pushRegister","scriptLoad","complete","evt","cleanup","detachEvent","removeEventListener","async","crossOrigin","buildGroups","groups","depName","depEntry","defined","depGroupIndex","startEntry","curGroupDeclarative","linkDeclarativeModule","linkDynamicModule","ModuleRecord","getOrCreateModuleRecord","importers","declaration","locked","importerModule","importerIndex","setter","setters","id","depExports","depModule","len","getModule","ensureEvaluated","nameNormalized","__esModule","seen","registerDynamic","pushRegister_","amd","curMeta","del","doLoad","grouped","normalizePromises","esmRegEx","traceurRuntimeRegEx","babelHelpersRegEx","args","depInject","loadedTranspiler","transpilerPromise","loaderModule","originalName","file","sources","originalSource","$traceurRuntime","babelHelpers","__globalName","g","globals","gl","exportName","retrieveGlobal","prepareGlobal","encapsulateGlobal","reduceRegister","forEachGlobal","callback","keys","forEachGlobalValue","globalName","ignoredGlobalProps","globalSnapshot","encapsulate","curDefine","oldGlobals","singleGlobal","multipleExports","getCJSDeps","inLocation","locations","cjsRequireRegEx","lastIndex","commentRegEx","stringRegEx","stringLocations","commentLocations","cjsExportsRegEx","hashBangRegEx","metaDeps","cjsRequireDetection","_require","requireResolve","cjsDeferDepsExecute","pathVars","getPathVars","__cjsWrapper","dirname","cjsWrapper","stripOrigin","windowOrigin","parentId","moduleId","pluginIndex","amdDefine","requireIndex","params","fnBracketRegEx","requireAlias","wsRegEx","requireRegEx","requireRegExs","cjsRequirePre","cjsRequirePost","errback","referer","dynamicRequires","factory","req","contextualRequire","depValues","uri","moduleIndex","exportsIndex","toUrl","amdRequire","amdRegEx","builderExecute","getParentName","parentPluginIndex","parsePlugin","argumentName","pluginName","argument","plugin","combinePluginParts","checkDefaultExtension","arg","createNormalizeSync","parsed","pluginSyntaxIndex","loaderNormalized","result","calledInstantiate","alias","aliasDeps","_export","setMetaProperty","curPart","depth","metaRegEx","metaPartRegEx","metaParts","firstChar","metaString","metaName","metaValue","loadedBundles","matched","curModule","parts","substring","version","doPolyfill","scripts","currentScript","defer","curPath","basePath","systemJSBootstrap","write","__filename"],"mappings":";;;CAGA,WACA,QAASA,MACT,SAAUC,GACV,QAASC,GAAYC,EAAKC,GACxB,GAAkB,gBAAPD,GACT,KAAM,IAAIE,WAAU,uBACtB,IAAIC,GAAIC,OAAOJ,GAAKK,QAAQ,aAAc,IAAIC,MAAM,mHACpD,KAAKH,EACH,KAAM,IAAII,YAAW,qBACvB,IAAIC,GAAWL,EAAE,IAAM,GACnBM,EAAWN,EAAE,IAAM,GACnBO,EAAWP,EAAE,IAAM,GACnBQ,EAAOR,EAAE,IAAM,GACfS,EAAWT,EAAE,IAAM,GACnBU,EAAOV,EAAE,IAAM,GACfW,EAAWX,EAAE,IAAM,GACnBY,EAASZ,EAAE,IAAM,GACjBa,EAAOb,EAAE,IAAM,EACnB,IAAgBc,SAAZhB,EAAuB,CACzB,GAAIiB,GAAOjB,YAAmBF,GAAcE,EAAU,GAAIF,GAAYE,GAClEkB,GAAQX,IAAaG,IAASF,GAC9BU,GAASL,GAAaC,IACxBA,EAASG,EAAKH,QACZI,GAAwB,MAAhBL,EAAS,KACnBA,EAAYA,IAAcI,EAAKP,OAAQO,EAAKT,UAAcS,EAAKJ,SAAiB,GAAN,KAAYI,EAAKJ,SAASM,MAAM,EAAGF,EAAKJ,SAASO,YAAY,KAAO,GAAKP,EAAYI,EAAKJ,SAEtK,IAAIQ,KACJR,GAAST,QAAQ,kBAAmB,IACjCA,QAAQ,iBAAkB,KAC1BA,QAAQ,UAAW,QACnBA,QAAQ,aAAc,SAAUkB,GACrB,QAANA,EACFD,EAAOE,MAEPF,EAAOG,KAAKF,KAElBT,EAAWQ,EAAOI,KAAK,IAAIrB,QAAQ,MAAuB,MAAhBS,EAAS,GAAa,IAAM,IAClEK,IACFN,EAAOK,EAAKL,KACZD,EAAWM,EAAKN,SAChBD,EAAOO,EAAKP,KACZD,EAAWQ,EAAKR,SAChBD,EAAWS,EAAKT,UAEbD,IACHA,EAAWU,EAAKV,UAIpBM,EAAWA,EAAST,QAAQ,MAAO,KAEnCsB,KAAKC,OAASjB,EAAOH,GAAyB,KAAbA,GAA4B,KAATG,EAAc,KAAO,IAAMA,EAAO,GACtFgB,KAAKE,KAAOrB,GAAYA,GAAYG,GAAoB,SAAZH,EAAsB,KAAO,KAAoB,KAAbC,EAAkBA,GAAyB,KAAbC,EAAkB,IAAMA,EAAW,IAAM,IAAM,IAAMC,EAAOG,EAAWC,EAASC,EAC9LW,KAAKnB,SAAWA,EAChBmB,KAAKlB,SAAWA,EAChBkB,KAAKjB,SAAWA,EAChBiB,KAAKhB,KAAOA,EACZgB,KAAKf,SAAWA,EAChBe,KAAKd,KAAOA,EACZc,KAAKb,SAAWA,EAChBa,KAAKZ,OAASA,EACdY,KAAKX,KAAOA,EAEdlB,EAAOC,YAAcA,GACH,mBAAR+B,MAAsBA,KAAOhC,QAAQ,SAAUiC,GAqCvD,QAASC,GAAWC,EAAKC,GAEvB,IAAKD,EAAIE,YAGP,IAAK,GAFDC,KAAUH,EAAII,SAAWJ,IAAQA,EAAIG,MAAQ,KAAOH,EAAIG,MAAQ,KAAKE,WAAWC,MAAM,MACtFC,KACKC,EAAI,EAAGA,EAAIL,EAAMM,OAAQD,IACL,mBAAhBE,eAA+BP,EAAMK,GAAGG,QAAQD,aAAaE,OAAQ,GAC9EL,EAASf,KAAKW,EAAMK,GAI1B,IAAIK,GAAS,eAAiBN,EAAWA,EAASd,KAAK,QAAUO,EAAII,QAAQU,OAAO,KAAO,OAASb,CAG/Fc,KACHF,EAASA,EAAOzC,QAAQ4C,EAAY,eAAiB,aAAc,IAErE,IAAIC,GAASC,EAAU,GAAIC,OAAMN,EAAQb,EAAIoB,SAAUpB,EAAIqB,YAAc,GAAIF,OAAMN,EAOnF,OALAI,GAAOd,MAAQU,EAGfI,EAAOf,YAAcF,EAAIE,aAAeF,EAEjCiB,EAoEX,QAASK,MAOT,QAASC,GAAOC,GACd9B,KAAK+B,SACHC,UAAWhC,KACXiC,SACAC,WACAC,kBACAC,kBAIFC,EAAerC,KAAM,UACnBsC,IAAK,WACH,MAAOlC,MAi9Bb,QAASmC,KACPV,EAAOW,KAAKxC,MAEZA,KAAKyC,SACLzC,KAAK+B,QAAQU,SAEbC,EAAoBF,KAAKxC,MAI3B,QAAS2C,MAOT,QAASC,GAAKC,EAAMD,GAClBL,EAAeO,UAAUD,GAAQD,EAAKL,EAAeO,UAAUD,IAAS,cAE1E,QAASE,GAAgBH,GACvBF,EAAsBE,EAAKF,GAAuB,cAKpD,QAASM,GAAWH,GAClB,MAAOA,GAAKlE,MAAMsE,GAEpB,QAASC,GAAML,GACb,MAAmB,KAAXA,EAAK,MAAeA,EAAK,IAAiB,KAAXA,EAAK,IAAwB,KAAXA,EAAK,KAA0B,KAAXA,EAAK,GAEpF,QAASM,GAAQN,GACf,OAAQK,EAAML,KAAUG,EAAWH,GAKrC,QAASO,GAAWP,EAAMQ,GAExB,GAAe,KAAXR,EAAK,IAEP,GAAe,KAAXA,EAAK,IAAwB,KAAXA,EAAK,GACzB,OAAQQ,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,EAAKzB,OAAO,OAEzF,IAAe,KAAXyB,EAAK,IAAaA,EAAK5B,QAAQ,OAAQ,EAE9C,OAAQoC,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,CAGhF,OAAO,IAAIU,GAAIV,EAAMQ,GAAUA,EAAO3E,QAAQ,KAAM,QAAU8E,GAAYtD,KAAKxB,QAAQ,OAAQ,KAIjG,QAAS+E,GAAWC,EAAQb,GAE1B,GAAoBc,GAAhBC,EAAY,GAAcC,EAAuB,EAEjDpB,EAAQiB,EAAOjB,MACfqB,EAAaJ,EAAO3B,QAAQU,KAGhC,KAAK,GAAI7C,KAAK6C,GACZ,IAAIA,EAAMsB,gBAAmBtB,EAAMsB,eAAenE,GAAlD,CAIA,GAAIoE,GAAOvB,EAAM7C,EAKjB,IAJIoE,IAASF,EAAWlE,KACtBoE,EAAOvB,EAAM7C,GAAKkE,EAAWlE,GAAKwD,EAAWX,EAAM7C,GAAIsD,EAAMT,EAAM7C,IAAM0D,EAAUI,EAAOpF,UAGxFsB,EAAEqB,QAAQ,QAAS,EAAI,CACzB,GAAI4B,GAAQjD,EACV,MAAO6C,GAAM7C,EAGV,IAAIiD,EAAKzB,OAAO,EAAGxB,EAAEmB,OAAS,IAAMnB,EAAEwB,OAAO,EAAGxB,EAAEmB,OAAS,KAAO8B,EAAK9B,OAASnB,EAAEmB,QAAU8B,EAAKjD,EAAEmB,OAAS,IAAMnB,EAAEA,EAAEmB,OAAS,MAAyC,KAAjC0B,EAAM7C,GAAG6C,EAAM7C,GAAGmB,OAAS,IAAyB,IAAZ0B,EAAM7C,IACxL,MAAO6C,GAAM7C,GAAGwB,OAAO,EAAGqB,EAAM7C,GAAGmB,OAAS,IAAM8B,EAAK9B,OAASnB,EAAEmB,QAAU0B,EAAM7C,IAAM,KAAO,IAAMiD,EAAKzB,OAAOxB,EAAEmB,QAAU,QAI5H,CACH,GAAIkD,GAAYrE,EAAEgB,MAAM,IACxB,IAAIqD,EAAUlD,OAAS,EACrB,KAAM,IAAIxC,WAAU,2CAEtB,IAAI2F,GAAoBD,EAAU,GAAGlD,MACjCmD,IAAqBL,GACrBhB,EAAKzB,OAAO,EAAG6C,EAAU,GAAGlD,SAAWkD,EAAU,IACjDpB,EAAKzB,OAAOyB,EAAK9B,OAASkD,EAAU,GAAGlD,SAAWkD,EAAU,KAC1DJ,EAAuBK,EACvBN,EAAYhE,EACZ+D,EAAWd,EAAKzB,OAAO6C,EAAU,GAAGlD,OAAQ8B,EAAK9B,OAASkD,EAAU,GAAGlD,OAASkD,EAAU,GAAGlD,UAKvG,GAAIoD,GAAU1B,EAAMmB,EAIpB,OAHuB,gBAAZD,KACTQ,EAAUA,EAAQzF,QAAQ,IAAKiF,IAE1BQ,EAWT,QAASC,GAAMC,GAGb,IAAK,GAFDC,MACAC,KACKzD,EAAI,EAAG0D,EAAIH,EAAKtD,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3C,GAAI2D,GAAQxD,EAAQuB,KAAK8B,EAAOD,EAAKvD,GACjC2D,MAAU,GACZH,EAAMxE,KAAKuE,EAAKvD,IAChByD,EAAQzE,MAAMgB,KAGdyD,EAAQE,GAAO3E,KAAKgB,GAGxB,OAASwD,MAAOA,EAAOC,QAASA,GAYlC,QAASG,GAAYC,GACnB,GAAIC,KAEJ,KAAuB,gBAAXD,IAAyC,kBAAXA,KAA0BA,IAAYvE,EAC5E,GAAIyE,EACF,IAAK,GAAIjF,KAAK+E,GAEF,YAAN/E,GAEJkF,EAAqBF,EAAUD,EAAS/E,OAI1CmF,GAAOH,EAAUD,EAOvB,OAJAC,GAAkB,QAAID,EACtBtC,EAAeuC,EAAU,gBACvBI,OAAO,IAEFJ,EAGT,QAASE,GAAqBG,EAAWC,EAAWC,GAClD,IACE,GAAIC,IACAA,EAAIC,OAAOR,yBAAyBK,EAAWC,KACjD9C,EAAe4C,EAAWE,EAAUC,GAExC,MAAOE,GAIL,MADAL,GAAUE,GAAYD,EAAUC,IACzB,GAIX,QAASJ,GAAOQ,EAAGC,EAAGC,GACpB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,GACRzB,IAAmByB,EAAEzB,eAAenE,IAEnC6F,GAAa7F,IAAK2F,KACrBA,EAAE3F,GAAK4F,EAAE5F,GAEb,OAAO2F,GAOT,QAASG,GAAWH,EAAGC,EAAGC,GACxB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,GACZ,IAAIzB,GAAmByB,EAAEzB,eAAenE,GAAxC,CAEA,GAAI+F,GAAMH,EAAE5F,EACNA,KAAK2F,GAEFI,YAAeC,QAASL,EAAE3F,YAAcgG,OAC/CL,EAAE3F,MAAQiG,OAAOJ,EAAUE,EAAMJ,EAAE3F,IAAIiG,OAAOJ,EAAUF,EAAE3F,GAAK+F,GAC1C,gBAAPA,IAA2B,OAARA,GAA+B,gBAARJ,GAAE3F,GAC1D2F,EAAE3F,GAAKmF,EAAOA,KAAWQ,EAAE3F,IAAK+F,EAAKF,GAC7BA,IACRF,EAAE3F,GAAK+F,GANPJ,EAAE3F,GAAK+F,GAUb,QAASG,GAAgBC,EAASC,EAASC,EAASvC,EAAQwC,GAC1D,IAAK,GAAIC,KAAQH,GACf,GAAI/E,EAAQuB,MAAM,OAAQ,SAAU,mBAAoB,YAAa2D,KAAS,EAC5EJ,EAAQI,GAAQH,EAAQG,OAErB,IAAY,OAARA,EACPpB,EAAOgB,EAAQK,IAAML,EAAQK,QAAWJ,EAAQI,SAE7C,IAAY,QAARD,EACPpB,EAAOgB,EAAQM,KAAON,EAAQM,SAAYL,EAAQK,UAE/C,IAAY,YAARF,EACP,IAAK,GAAIf,KAAKY,GAAQM,SAAU,CAC9B,GAAIC,EAGFA,GADoB,MAAlBnB,EAAEhE,OAAO,EAAG,GACA6E,EAAU,IAAMb,EAAEhE,OAAO,GAEzBoF,EAAYhE,KAAKkB,EAAQ0B,GACzC1B,EAAO4C,SAASC,IAAgB7C,EAAO4C,SAASC,QAAoBV,OAAOG,EAAQM,SAASlB,SAGvFc,GAAyBjF,EAAQuB,MAAM,gBAAiB,aAAc,YAAa,oBAAqB2D,KAAS,GACpHH,EAAQjC,iBAAkBiC,EAAQjC,eAAeoC,IACrDM,EAAKjE,KAAKkB,EAAQ,IAAMyC,EAAO,4DAA8DF,GAMnG,QAASS,GAAahD,EAAQuC,EAASU,EAAKC,GAC1C,GAAIC,EAGJ,IAAKnD,EAAOoD,SAASb,GAGhB,CACH,GAAIc,GAAUrD,EAAOoD,SAASb,EAC9BY,GAAMnD,EAAOoD,SAASb,MAEtBH,EAAgBe,EAAKD,EAAgBD,EAAMI,EAASd,EAASvC,EAAQkD,GACrEd,EAAgBe,EAAKD,EAAgBG,EAAUJ,EAAKV,EAASvC,GAASkD,OAPtEC,GAAMnD,EAAOoD,SAASb,GAAWU,CAkBnC,OAPuB,gBAAZE,GAAIG,OACbH,EAAIT,IAAMS,EAAIT,QACdS,EAAIT,IAAI,WAAaS,EAAIG,KACzBH,EAAIG,KAAc,QAAIH,EAAIG,KAAc,SAAK,KAC7CH,EAAIG,KAAO,SAGNH,EAGT,QAASJ,GAAKlG,GACRP,KAAKiH,UAA8B,mBAAXC,UAA0BA,QAAQT,KAiJhE,QAASU,GAAqBvH,EAAGoF,GAE/B,IADA,GAAIoC,GAASxH,EAAEgB,MAAM,KACdwG,EAAOrG,QACZiE,EAAQA,EAAMoC,EAAOC,QACvB,OAAOrC,GAGT,QAASsC,GAAYlB,EAAKvD,GACxB,GAAI0E,GAAWC,EAAkB,CAEjC,KAAK,GAAI5H,KAAKwG,GACZ,GAAIvD,EAAKzB,OAAO,EAAGxB,EAAEmB,SAAWnB,IAAMiD,EAAK9B,QAAUnB,EAAEmB,QAA4B,KAAlB8B,EAAKjD,EAAEmB,SAAiB,CACvF,GAAI0G,GAAiB7H,EAAEgB,MAAM,KAAKG,MAClC,IAAI0G,GAAkBD,EACpB,QACFD,GAAY3H,EACZ4H,EAAkBC,EAItB,MAAOF,GAGT,QAASG,GAAehE,GAElB1D,KAAK+B,QAAQzD,UAAY0B,KAAK1B,UACa,KAAzC0B,KAAK1B,QAAQ0B,KAAK1B,QAAQyC,OAAS,KACrCf,KAAK1B,SAAW,KAElB0B,KAAK+B,QAAQzD,QAAU0B,KAAK1B,QAAU,GAAIiF,GAAIvD,KAAK1B,QAASkF,GAAYtD,MAK5E,QAASyH,GAAcC,EAAcC,GACnC7H,KAAK8H,IAAI,cAAeC,GAAY/H,KAAKgI,WACvCC,QAAS5G,EACT6G,OAAQlI,KAAKmI,aACbC,YAAaP,GAAaD,EAC1BS,IAAKR,IAAcD,EACnBU,MAAOT,EACPU,SAAW,KAuDf,QAASC,GAAc3F,EAAMvE,GAC3B,IAAK6E,EAAQN,GACX,KAAM,IAAIpB,OAAM,eAAiBoB,EAAO,mDAE1C,KAAK4F,GAAqB,CACxB,GAAI7G,GAAS5B,KAAKmI,aAAa,UAC3B5I,EAAOjB,EAAQ8C,OAAOE,EAAY,EAAI,EAC1CmH,IAAsB,GAAI7G,GAAOrC,GACjCkJ,GAAoBhG,MAAQb,EAAO8G,iBAAiBnJ,GAEtD,MAAOkJ,IAAoBE,QAAQ9F,GAGrC,QAAS2D,GAAY3D,EAAM+F,GAEzB,GAAI1F,EAAML,GACR,MAAOO,GAAWP,EAAM+F,EACrB,IAAI5F,EAAWH,GAClB,MAAOA,EAGT,IAAIgG,GAAWvB,EAAYtH,KAAKoG,IAAKvD,EAErC,IAAIgG,EAAU,CAGZ,GAFAhG,EAAO7C,KAAKoG,IAAIyC,GAAYhG,EAAKzB,OAAOyH,EAAS9H,QAE7CmC,EAAML,GACR,MAAOO,GAAWP,EACf,IAAIG,EAAWH,GAClB,MAAOA,GAGX,GAAI7C,KAAK8I,IAAIjG,GACX,MAAOA,EAGT,IAAyB,UAArBA,EAAKzB,OAAO,EAAG,GAAgB,CACjC,IAAKpB,KAAKmI,aACR,KAAM,IAAI5J,WAAU,iBAAmBsE,EAAO,6CAKhD,OAJI7C,MAAK+I,QACP/I,KAAK8H,IAAIjF,EAAM7C,KAAKgI,eAEpBhI,KAAK8H,IAAIjF,EAAM7C,KAAKgI,UAAUtD,EAAY8D,EAAchG,KAAKxC,KAAM6C,EAAKzB,OAAO,GAAIpB,KAAK1B,YACnFuE,EAMT,MAFA6E,GAAelF,KAAKxC,MAEbyD,EAAWzD,KAAM6C,IAAS7C,KAAK1B,QAAUuE,EAgJlD,QAASmG,GAAOtF,EAAQiD,EAAKsC,GACvBlB,GAAUE,SAAWtB,EAAIuC,eAC3BD,EAAYtC,EAAIuC,eACdnB,GAAUG,MAAQvB,EAAIwC,YACxBF,EAAYtC,EAAIwC,YACdpB,GAAUM,KAAO1B,EAAIyC,WACvBH,EAAYtC,EAAIyC,WACdrB,GAAUO,OAAS3B,EAAI0C,aACzBJ,EAAYtC,EAAI0C,aACdtB,GAAUK,YAAczB,EAAI2C,kBAC9BL,EAAYtC,EAAI2C,kBAshCpB,QAASC,GAAqBC,GAC5B,GAAIC,GAAwBD,EAAO7K,MAAM+K,GACzC,OAAOD,IAA+E,mBAAtDD,EAAOpI,OAAOqI,EAAsB,GAAG1I,OAAQ,IAGjF,QAAS4I,KACP,OACE9G,KAAM,KACNwB,KAAM,KACNuF,gBAAiB,KACjBC,QAAS,KACTC,QAAS,KACTC,kBAAkB,EAClBC,aAAa,EACbC,eAAgB,KAChBC,WAAY,KACZC,WAAW,EACXC,OAAQ,KACRxF,SAAU,KACVyF,YAAY,GAgxBhB,QAASC,GAAe3F,GACtB,GAAsB,gBAAXA,GACT,MAAOwC,GAAqBxC,EAASvE,EAEvC,MAAMuE,YAAmBiB,QACvB,KAAM,IAAInE,OAAM,4CAIlB,KAAK,GAFD8I,MACAC,GAAQ,EACH1J,EAAI,EAAGA,EAAI6D,EAAQ5D,OAAQD,IAAK,CACvC,GAAI6E,GAAMwB,EAAqBxC,EAAQ7D,GAAIV,EACvCoK,KACFD,EAAqB,QAAI5E,EACzB6E,GAAQ,GAEVD,EAAY5F,EAAQ7D,GAAGF,MAAM,KAAKf,OAAS8F,EAE7C,MAAO4E,GAm4BP,QAASE,GAAeC,GACtB,GAAIC,GAAiBC,EAAiBC,EAElCA,EAA2B,KAAhBH,EAAU,GACrBI,EAAuBJ,EAAUhL,YAAY,IAsBjD,OArBIoL,KAAwB,GAC1BH,EAAkBD,EAAUtJ,OAAO0J,EAAuB,GAC1DF,EAAkBF,EAAUtJ,OAAOyJ,EAAUC,EAAuBD,GAEhEA,GACFpE,EAAKjE,KAAKxC,KAAM,4BAA8B0K,EAAY,wBAA0BE,EAAkB,KAAOD,EAAkB,KAEvG,KAAtBA,EAAgB,KAClBE,GAAW,EACXF,EAAkBA,EAAgBvJ,OAAO,MAI3CuJ,EAAkB,UAClBC,EAAkBF,EAAUtJ,OAAOyJ,GAC/BE,GAAc9J,QAAQ2J,KAAoB,IAC5CD,EAAkBC,EAClBA,EAAkB,QAKpBR,OAAQQ,GAAmB,cAC3BzE,KAAMwE,EACNK,OAAQH,GAIZ,QAASI,GAAmBC,GAC1B,MAAOA,GAAad,OAAS,KAAOc,EAAaF,OAAS,IAAM,IAAME,EAAa/E,KAGrF,QAASgF,GAAiBD,EAActC,EAAYwC,GAClD,GAAIjL,GAAOH,IACX,OAAOA,MAAKqL,UAAUH,EAAad,OAAQxB,GAC1C0C,KAAK,SAASC,GACb,MAAOpL,GAAKqL,KAAKD,GAChBD,KAAK,SAASG,GACb,GAAIjN,GAAI2I,EAAqB+D,EAAa/E,KAAMhG,EAAKmC,IAAIiJ,GAEzD,IAAIH,GAAoB,iBAAL5M,GACjB,KAAM,IAAID,WAAU,aAAe0M,EAAmBC,GAAgB,iCAExE,OAAOA,GAAaF,QAAUxM,EAAIA,MAMxC,QAASkN,GAAuB7I,EAAM+F,GAEpC,GAAI+C,GAAmB9I,EAAKlE,MAAMiN,GAElC,KAAKD,EACH,MAAOE,SAAQC,QAAQjJ,EAEzB,IAAIqI,GAAeT,EAAejI,KAAKxC,KAAM2L,EAAiB,GAAGvK,OAAO,EAAGuK,EAAiB,GAAG5K,OAAS,GAGxG,OAAIf,MAAK+I,QACA/I,KAAgB,UAAEkL,EAAad,OAAQxB,GAC7C0C,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACf/H,EAAKnE,QAAQkN,GAAoB,KAAOX,EAAmBC,GAAgB,OAG/EC,EAAiB3I,KAAKxC,KAAMkL,EAActC,GAAY,GAC5D0C,KAAK,SAASS,GACb,GAA8B,gBAAnBA,GACT,KAAM,IAAIxN,WAAU,2BAA6BsE,EAAO,gCAE1D,IAAIkJ,EAAe9K,QAAQ,OAAQ,EACjC,KAAM,IAAI1C,WAAU,sCAAwCsE,GAAQ+F,EAAa,OAASA,EAAa,IAAM,2BAA6BmD,EAAiB,mCAE7J,OAAOlJ,GAAKnE,QAAQkN,GAAoBG,KAI5C,QAASC,GAAmBnJ,EAAM+F,GAEhC,GAAIqD,GAAepJ,EAAKnD,YAAY,KAEpC,IAAIuM,IAAgB,EAClB,MAAOJ,SAAQC,QAAQjJ,EAEzB,IAAIqI,GAAeT,EAAejI,KAAKxC,KAAM6C,EAAKzB,OAAO6K,EAAe,GAGxE,OAAIjM,MAAK+I,QACA/I,KAAgB,UAAEkL,EAAad,OAAQxB,GAC7C0C,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACf/H,EAAKzB,OAAO,EAAG6K,GAAgB,KAAOhB,EAAmBC,KAG7DC,EAAiB3I,KAAKxC,KAAMkL,EAActC,GAAY,GAC5D0C,KAAK,SAASS,GACb,MAAOA,GAAiBlJ,EAAKzB,OAAO,EAAG6K,GAAgB,WA1lJ3D,GAAIC,GAA4B,mBAAVC,SAAwC,mBAARhM,OAA+C,mBAAjBiM,eAChF/K,EAA6B,mBAAV8K,SAA4C,mBAAZE,UACnD/K,EAA8B,mBAAXgL,UAAqD,mBAApBA,SAAQC,YAA6BD,QAAQC,SAAS5N,MAAM,OAE/GyB,GAAS8G,UACZ9G,EAAS8G,SAAYsF,OAAQ,cAG/B,IASInK,GATApB,EAAU2E,MAAM9C,UAAU7B,SAAW,SAASwL,GAChD,IAAK,GAAI3L,GAAI,EAAG4L,EAAU1M,KAAKe,OAAQD,EAAI4L,EAAS5L,IAClD,GAAId,KAAKc,KAAO2L,EACd,MAAO3L,EAGX,QAAO,IAIT,WACE,IACQuE,OAAOhD,kBAAmB,UAC9BA,EAAiBgD,OAAOhD,gBAE5B,MAAOsK,GACLtK,EAAiB,SAASuK,EAAKzG,EAAM0G,GACnC,IACED,EAAIzG,GAAQ0G,EAAI7H,OAAS6H,EAAIvK,IAAIE,KAAKoK,GAExC,MAAMD,SAKZ,IAsCIrJ,GAtCA9B,EAAwC,KAA9B,GAAIC,OAAM,EAAG,KAAKC,QAyChC,IAAuB,mBAAZ2K,WAA2BA,SAASS,sBAG7C,GAFAxJ,EAAU+I,SAAS/I,SAEdA,EAAS,CACZ,GAAIyJ,GAAQV,SAASS,qBAAqB,OAC1CxJ,GAAUyJ,EAAM,IAAMA,EAAM,GAAG7M,MAAQiM,OAAOa,SAAS9M,UAG/B,mBAAZ8M,YACd1J,EAAUlD,EAAS4M,SAAS9M,KAI9B,IAAIoD,EACFA,EAAUA,EAAQ1C,MAAM,KAAK,GAAGA,MAAM,KAAK,GAC3C0C,EAAUA,EAAQlC,OAAO,EAAGkC,EAAQ5D,YAAY,KAAO,OAEpD,CAAA,GAAsB,mBAAX4M,WAA0BA,QAAQW,IAMhD,KAAM,IAAI1O,WAAU,yBALpB+E,GAAU,WAAahC,EAAY,IAAM,IAAMgL,QAAQW,MAAQ,IAC3D3L,IACFgC,EAAUA,EAAQ5E,QAAQ,MAAO,MAMrC,IACE,GAAIwO,GAAqD,SAAzC,GAAI9M,GAASmD,IAAI,YAAY1E,SAE/C,MAAM8N,IAEN,GAAIpJ,GAAM2J,EAAY9M,EAASmD,IAAMnD,EAAShC,WAwBhDiE,GAAeT,EAAOkB,UAAW,YAC/BkC,MAAO,WACL,MAAO,YAsBX,WAsGE,QAASmI,GAAWtK,GAClB,OACEuK,OAAQ,UACRvK,KAAMA,GAAQ,gBAAiBwK,EAAU,IACzCC,YACAC,gBACAC,aASJ,QAASC,GAAW/J,EAAQb,EAAMf,GAChC,MAAO,IAAI+J,SAAQ6B,GACjBC,KAAM7L,EAAQ8L,QAAU,QAAU,SAClClK,OAAQA,EACRmK,WAAYhL,EAEZiL,eAAgBhM,GAAWA,EAAQ0L,aACnCO,aAAcjM,EAAQ0H,OACtBwE,cAAelM,EAAQ8L,WAK3B,QAASK,GAAYvK,EAAQwK,EAASC,EAAaC,GAEjD,MAAO,IAAIvC,SAAQ,SAASC,EAASuC,GACnCvC,EAAQpI,EAAO1B,UAAUqJ,UAAU6C,EAASC,EAAaC,MAG1D9C,KAAK,SAASzI,GACb,GAAI2I,EACJ,IAAI9H,EAAOxB,QAAQW,GAKjB,MAJA2I,GAAO2B,EAAWtK,GAClB2I,EAAK4B,OAAS,SAEd5B,EAAKpB,OAAS1G,EAAOxB,QAAQW,GACtB2I,CAGT,KAAK,GAAI1K,GAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAQD,EAAI0D,EAAG1D,IAE9C,GADA0K,EAAO9H,EAAOzB,MAAMnB,GAChB0K,EAAK3I,MAAQA,EAEjB,MAAO2I,EAQT,OALAA,GAAO2B,EAAWtK,GAClBa,EAAOzB,MAAMnC,KAAK0L,GAElB8C,EAAgB5K,EAAQ8H,GAEjBA,IAKX,QAAS8C,GAAgB5K,EAAQ8H,GAC/B+C,EAAe7K,EAAQ8H,EACrBK,QAAQC,UAEPR,KAAK,WACJ,MAAO5H,GAAO1B,UAAUwM,QAAS3L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,cAMvE,QAASe,GAAe7K,EAAQ8H,EAAM5L,GACpC6O,EAAmB/K,EAAQ8H,EACzB5L,EAEC0L,KAAK,SAASsC,GAEb,GAAmB,WAAfpC,EAAK4B,OAIT,MAFA5B,GAAKoC,QAAUA,EAERlK,EAAO1B,UAAU0M,OAAQ7L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,SAAUI,QAASA,OAMzF,QAASa,GAAmB/K,EAAQ8H,EAAM5L,GACxCA,EAEC0L,KAAK,SAAS9B,GACb,GAAmB,WAAfgC,EAAK4B,OAKT,MAFA5B,GAAKoC,QAAUpC,EAAKoC,SAAWpC,EAAK3I,KAE7BgJ,QAAQC,QAAQpI,EAAO1B,UAAU2M,WAAY9L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,SAAUI,QAASpC,EAAKoC,QAASpE,OAAQA,KAG5H8B,KAAK,SAAS9B,GAEb,MADAgC,GAAKhC,OAASA,EACP9F,EAAO1B,UAAU4M,aAAc/L,KAAM2I,EAAK3I,KAAM2K,SAAUhC,EAAKgC,SAAUI,QAASpC,EAAKoC,QAASpE,OAAQA,MAIhH8B,KAAK,SAASuD,GACb,GAA0BvP,SAAtBuP,EACF,KAAM,IAAItQ,WAAU,mDAEtB,IAAgC,gBAArBsQ,GACT,KAAM,IAAItQ,WAAU,mCAEtBiN,GAAKsD,SAAWD,EAAkBxK,SAClCmH,EAAK1B,QAAU+E,EAAkB/E,UAGlCwB,KAAK,WACJE,EAAK+B,eAIL,KAAK,GAHDuB,GAAWtD,EAAKsD,SAEhBC,KACKjO,EAAI,EAAG0D,EAAIsK,EAAS/N,OAAQD,EAAI0D,EAAG1D,KAAK,SAAUoN,EAASzJ,GAClEsK,EAAajP,KACXmO,EAAYvK,EAAQwK,EAAS1C,EAAK3I,KAAM2I,EAAKoC,SAG5CtC,KAAK,SAAS0D,GASb,GALAxD,EAAK+B,aAAa9I,IAChBwK,IAAKf,EACLlJ,MAAOgK,EAAQnM,MAGK,UAAlBmM,EAAQ5B,OAEV,IAAK,GADDE,GAAW9B,EAAK8B,SAASzH,WACpB/E,EAAI,EAAG0D,EAAI8I,EAASvM,OAAQD,EAAI0D,EAAG1D,IAC1CoO,EAAiB5B,EAASxM,GAAIkO,QAOrCF,EAAShO,GAAIA,EAEhB,OAAO+K,SAAQsD,IAAIJ,KAIpBzD,KAAK,WAIJE,EAAK4B,OAAS,QAGd,KAAK,GADDE,GAAW9B,EAAK8B,SAASzH,WACpB/E,EAAI,EAAG0D,EAAI8I,EAASvM,OAAQD,EAAI0D,EAAG1D,IAC1CsO,EAAoB9B,EAASxM,GAAI0K,OAI/B,MAAE,SAAS6D,GACjB7D,EAAK4B,OAAS,SACd5B,EAAK8D,UAAYD,CAGjB,KAAK,GADD/B,GAAW9B,EAAK8B,SAASzH,WACpB/E,EAAI,EAAG0D,EAAI8I,EAASvM,OAAQD,EAAI0D,EAAG1D,IAC1CyO,EAAcjC,EAASxM,GAAI0K,EAAM6D,KAUvC,QAAS3B,GAA6B8B,GACpC,MAAO,UAAS1D,EAASuC,GACvB,GAAI3K,GAAS8L,EAAU9L,OACnBb,EAAO2M,EAAU3B,WACjBF,EAAO6B,EAAU7B,IAErB,IAAIjK,EAAOxB,QAAQW,GACjB,KAAM,IAAItE,WAAU,IAAMsE,EAAO,uCAInC,KAAK,GADD4M,GACK3O,EAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAQD,EAAI0D,EAAG1D,IAC9C,GAAI4C,EAAOzB,MAAMnB,GAAG+B,MAAQA,IAC1B4M,EAAe/L,EAAOzB,MAAMnB,GAEhB,aAAR6M,GAAwB8B,EAAajG,SACvCiG,EAAa7B,QAAU4B,EAAUxB,cACjCS,EAAmB/K,EAAQ+L,EAAc5D,QAAQC,QAAQ0D,EAAUzB,gBAKjE0B,EAAanC,SAASvM,QAAU0O,EAAanC,SAAS,GAAGrL,MAAM,GAAGY,MAAQ4M,EAAa5M,MACzF,MAAO4M,GAAanC,SAAS,GAAGoC,KAAKpE,KAAK,WACxCQ,EAAQ2D,IAKhB,IAAIjE,GAAOiE,GAAgBtC,EAAWtK,EAEtC2I,GAAKgC,SAAWgC,EAAU1B,cAE1B,IAAI6B,GAAUC,EAAclM,EAAQ8H,EAEpC9H,GAAOzB,MAAMnC,KAAK0L,GAElBM,EAAQ6D,EAAQD,MAEJ,UAAR/B,EACFW,EAAgB5K,EAAQ8H,GAET,SAARmC,EACPY,EAAe7K,EAAQ8H,EAAMK,QAAQC,QAAQ0D,EAAUxB,iBAIvDxC,EAAKoC,QAAU4B,EAAUxB,cACzBS,EAAmB/K,EAAQ8H,EAAMK,QAAQC,QAAQ0D,EAAUzB,iBAWjE,QAAS6B,GAAclM,EAAQmM,GAC7B,GAAIF,IACFjM,OAAQA,EACRzB,SACA4N,aAAcA,EACdC,aAAc,EAOhB,OALAH,GAAQD,KAAO,GAAI7D,SAAQ,SAASC,EAASuC,GAC3CsB,EAAQ7D,QAAUA,EAClB6D,EAAQtB,OAASA,IAEnBa,EAAiBS,EAASE,GACnBF,EAGT,QAAST,GAAiBS,EAASnE,GACjC,GAAmB,UAAfA,EAAK4B,OAAT,CAGA,IAAK,GAAItM,GAAI,EAAG0D,EAAImL,EAAQ1N,MAAMlB,OAAQD,EAAI0D,EAAG1D,IAC/C,GAAI6O,EAAQ1N,MAAMnB,IAAM0K,EACtB,MAEJmE,GAAQ1N,MAAMnC,KAAK0L,GACnBA,EAAK8B,SAASxN,KAAK6P,GAGA,UAAfnE,EAAK4B,QACPuC,EAAQG,cAKV,KAAK,GAFDpM,GAASiM,EAAQjM,OAEZ5C,EAAI,EAAG0D,EAAIgH,EAAK+B,aAAaxM,OAAQD,EAAI0D,EAAG1D,IACnD,GAAK0K,EAAK+B,aAAazM,GAAvB,CAGA,GAAI+B,GAAO2I,EAAK+B,aAAazM,GAAGkE,KAEhC,KAAItB,EAAOxB,QAAQW,GAGnB,IAAK,GAAIkN,GAAI,EAAG3K,EAAI1B,EAAOzB,MAAMlB,OAAQgP,EAAI3K,EAAG2K,IAC9C,GAAIrM,EAAOzB,MAAM8N,GAAGlN,MAAQA,EAA5B,CAGAqM,EAAiBS,EAASjM,EAAOzB,MAAM8N,GACvC,UASN,QAASC,GAAOL,GACd,GAAIM,IAAQ,CACZ,KACEC,EAAKP,EAAS,SAASnE,EAAM6D,GAC3BE,EAAcI,EAASnE,EAAM6D,GAC7BY,GAAQ,IAGZ,MAAMtD,GACJ4C,EAAcI,EAAS,KAAMhD,GAC7BsD,GAAQ,EAEV,MAAOA,GAIT,QAASb,GAAoBO,EAASnE,GAQpC,GAFAmE,EAAQG,iBAEJH,EAAQG,aAAe,GAA3B,CAIA,GAAID,GAAeF,EAAQE,YAK3B,IAAIF,EAAQjM,OAAO1B,UAAU8H,WAAY,EAAO,CAE9C,IAAK,GADD7H,MAAW4D,OAAO8J,EAAQ1N,OACrBnB,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAQD,EAAI0D,EAAG1D,IAAK,CAC5C,GAAI0K,GAAOvJ,EAAMnB,EACjB0K,GAAKpB,QACHvH,KAAM2I,EAAK3I,KACXuH,OAAQ+F,MACRhG,WAAW,GAEbqB,EAAK4B,OAAS,SACdgD,EAAWT,EAAQjM,OAAQ8H,GAE7B,MAAOmE,GAAQ7D,QAAQ+D,GAIzB,GAAIQ,GAASL,EAAOL,EAEhBU,IAKJV,EAAQ7D,QAAQ+D,IAIlB,QAASN,GAAcI,EAASnE,EAAM6D,GACpC,GAAI3L,GAASiM,EAAQjM,MAGrB4M,GACA,GAAI9E,EACF,GAAImE,EAAQ1N,MAAM,GAAGY,MAAQ2I,EAAK3I,KAChCwM,EAAMhP,EAAWgP,EAAK,iBAAmB7D,EAAK3I,UAE3C,CACH,IAAK,GAAI/B,GAAI,EAAGA,EAAI6O,EAAQ1N,MAAMlB,OAAQD,IAExC,IAAK,GADDyP,GAAQZ,EAAQ1N,MAAMnB,GACjBiP,EAAI,EAAGA,EAAIQ,EAAMhD,aAAaxM,OAAQgP,IAAK,CAClD,GAAIS,GAAMD,EAAMhD,aAAawC,EAC7B,IAAIS,EAAIxL,OAASwG,EAAK3I,KAAM,CAC1BwM,EAAMhP,EAAWgP,EAAK,iBAAmB7D,EAAK3I,KAAO,QAAU2N,EAAIvB,IAAM,UAAYsB,EAAM1N,KAC3F,MAAMyN,IAIZjB,EAAMhP,EAAWgP,EAAK,iBAAmB7D,EAAK3I,KAAO,SAAW8M,EAAQ1N,MAAM,GAAGY,UAInFwM,GAAMhP,EAAWgP,EAAK,iBAAmBM,EAAQ1N,MAAM,GAAGY,KAK5D,KAAK,GADDZ,GAAQ0N,EAAQ1N,MAAM4D,WACjB/E,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAQD,EAAI0D,EAAG1D,IAAK,CAC5C,GAAI0K,GAAOvJ,EAAMnB,EAGjB4C,GAAO1B,UAAUyO,OAAS/M,EAAO1B,UAAUyO,WACvCxP,EAAQuB,KAAKkB,EAAO1B,UAAUyO,OAAQjF,KAAS,GACjD9H,EAAO1B,UAAUyO,OAAO3Q,KAAK0L,EAE/B,IAAIkF,GAAYzP,EAAQuB,KAAKgJ,EAAK8B,SAAUqC,EAG5C,IADAnE,EAAK8B,SAASqD,OAAOD,EAAW,GACJ,GAAxBlF,EAAK8B,SAASvM,OAAa,CAC7B,GAAI6P,GAAmB3P,EAAQuB,KAAKmN,EAAQjM,OAAOzB,MAAOuJ,EACtDoF,KAAoB,GACtBjB,EAAQjM,OAAOzB,MAAM0O,OAAOC,EAAkB,IAGpDjB,EAAQtB,OAAOgB,GAIjB,QAASe,GAAW1M,EAAQ8H,GAE1B,GAAI9H,EAAO1B,UAAU6O,MAAO,CACrBnN,EAAO1B,UAAUC,QACpByB,EAAO1B,UAAUC,SACnB,IAAI6O,KACJtF,GAAK+B,aAAawD,QAAQ,SAASP,GACjCM,EAAON,EAAIvB,KAAOuB,EAAIxL,QAExBtB,EAAO1B,UAAUC,MAAMuJ,EAAK3I,OAC1BA,KAAM2I,EAAK3I,KACXwB,KAAMmH,EAAK+B,aAAanH,IAAI,SAASoK,GAAM,MAAOA,GAAIvB,MACtD6B,OAAQA,EACRlD,QAASpC,EAAKoC,QACdJ,SAAUhC,EAAKgC,SACfhE,OAAQgC,EAAKhC,QAIbgC,EAAK3I,OAEPa,EAAOxB,QAAQsJ,EAAK3I,MAAQ2I,EAAKpB,OAEnC,IAAI4G,GAAY/P,EAAQuB,KAAKkB,EAAOzB,MAAOuJ,EACvCwF,KAAa,GACftN,EAAOzB,MAAM0O,OAAOK,EAAW,EACjC,KAAK,GAAIlQ,GAAI,EAAG0D,EAAIgH,EAAK8B,SAASvM,OAAQD,EAAI0D,EAAG1D,IAC/CkQ,EAAY/P,EAAQuB,KAAKgJ,EAAK8B,SAASxM,GAAGmB,MAAOuJ,GAC7CwF,IAAa,GACfxF,EAAK8B,SAASxM,GAAGmB,MAAM0O,OAAOK,EAAW,EAE7CxF,GAAK8B,SAASqD,OAAO,EAAGnF,EAAK8B,SAASvM,QAGxC,QAASkQ,GAAiBtB,EAASnE,EAAM0F,GACvC,IACE,GAAI9G,GAASoB,EAAK1B,UAEpB,MAAM6C,GAEJ,WADAuE,GAAU1F,EAAMmB,GAGlB,MAAKvC,IAAYA,YAAkBxI,GAG1BwI,MAFP8G,GAAU1F,EAAM,GAAIjN,WAAU,4CAWlC,QAAS4S,GAAoBzN,EAAQb,EAAMuO,GACzC,GAAIjP,GAAiBuB,EAAO3B,QAAQI,cACpC,OAAOA,GAAeU,GAAQuO,EAAQ9F,KAAK,SAAS9M,GAElD,MADA2D,GAAeU,GAAQvD,OAChBd,GACN,SAASmO,GAEV,KADAxK,GAAeU,GAAQvD,OACjBqN,IAiKV,QAASuD,GAAKP,EAASuB,GAErB,GAAIxN,GAASiM,EAAQjM,MAErB,IAAKiM,EAAQ1N,MAAMlB,OAKnB,IAAK,GAFDkB,GAAQ0N,EAAQ1N,MAAM4D,WAEjB/E,EAAI,EAAGA,EAAImB,EAAMlB,OAAQD,IAAK,CACrC,GAAI0K,GAAOvJ,EAAMnB,GAEbsJ,EAAS6G,EAAiBtB,EAASnE,EAAM0F,EAC7C,KAAK9G,EACH,MACFoB,GAAKpB,QACHvH,KAAM2I,EAAK3I,KACXuH,OAAQA,GAEVoB,EAAK4B,OAAS,SAEdgD,EAAW1M,EAAQ8H,IA3oBvB,GAAI6B,GAAU,CAyddxL,GAAOiB,WAELuO,YAAaxP,EAEbyP,OAAQ,SAASzO,EAAM2G,EAAQ1H,GAE7B,GAAI9B,KAAK+B,QAAQI,eAAeU,GAC9B,KAAM,IAAItE,WAAU,6BACtB,OAAO4S,GAAoBnR,KAAM6C,EAAM,GAAIgJ,SAAQ6B,GACjDC,KAAM,YACNjK,OAAQ1D,KAAK+B,QACb8L,WAAYhL,EACZiL,eAAgBhM,GAAWA,EAAQ0L,aACnCO,aAAcvE,EACdwE,cAAelM,GAAWA,EAAQ8L,aAItC2D,OAAU,SAAS1O,GACjB,GAAIa,GAAS1D,KAAK+B,OAGlB,cAFO2B,GAAOvB,eAAeU,SACtBa,GAAOtB,cAAcS,KACrBa,EAAOxB,QAAQW,UAAea,GAAOxB,QAAQW,IAItDP,IAAK,SAAS2M,GACZ,GAAKjP,KAAK+B,QAAQG,QAAQ+M,GAE1B,MAAOjP,MAAK+B,QAAQG,QAAQ+M,GAAK7E,QAGnCtB,IAAK,SAASjG,GACZ,QAAS7C,KAAK+B,QAAQG,QAAQW,IAGhC2O,OAAU,SAAS3O,EAAM+F,EAAY6I,GACV,gBAAd7I,KACTA,EAAaA,EAAW/F,KAG1B,IAAIb,GAAYhC,IAGhB,OAAO6L,SAAQC,QAAQ9J,EAAUqJ,UAAUxI,EAAM+F,IAChD0C,KAAK,SAASzI,GACb,GAAIa,GAAS1B,EAAUD,OAEvB,OAAI2B,GAAOxB,QAAQW,GACVa,EAAOxB,QAAQW,GAAMuH,OAEvB1G,EAAOvB,eAAeU,IAASsO,EAAoBnP,EAAWa,EACnE4K,EAAW/J,EAAQb,MAClByI,KAAK,SAASE,GAEb,aADO9H,GAAOvB,eAAeU,GACtB2I,EAAKpB,OAAOA,aAM3BoB,KAAM,SAAS3I,GACb,GAAIa,GAAS1D,KAAK+B,OAClB,OAAI2B,GAAOxB,QAAQW,GACVgJ,QAAQC,UACVpI,EAAOvB,eAAeU,IAASsO,EAAoBnR,KAAM6C,EAAM,GAAIgJ,SAAQ6B,GAChFC,KAAM,SACNjK,OAAQA,EACRmK,WAAYhL,EACZiL,kBACAC,aAAczO,OACd0O,cAAe1O,UAEhBgM,KAAK,iBACG5H,GAAOvB,eAAeU,OAIjCuH,OAAQ,SAASZ,EAAQ1H,GACvB,GAAI0J,GAAO2B,GACX3B,GAAKoC,QAAU9L,GAAWA,EAAQ8L,OAClC,IAAI+B,GAAUC,EAAc5P,KAAK+B,QAASyJ,GACtCkG,EAAgB7F,QAAQC,QAAQtC,GAChC9F,EAAS1D,KAAK+B,QACdnC,EAAI+P,EAAQD,KAAKpE,KAAK,WACxB,MAAOE,GAAKpB,OAAOA,QAGrB,OADAqE,GAAmB/K,EAAQ8H,EAAMkG,GAC1B9R,GAGToI,UAAW,SAAU4E,GACnB,GAAkB,gBAAPA,GACT,KAAM,IAAIrO,WAAU,kBAEtB,IAAIC,GAAI,GAAIoD,GAER+P,IACJ,IAAItM,OAAOuM,qBAA8B,MAAPhF,EAChC+E,EAAStM,OAAOuM,oBAAoBhF,OAEpC,KAAK,GAAIqC,KAAOrC,GACd+E,EAAO7R,KAAKmP,EAEhB,KAAK,GAAInO,GAAI,EAAGA,EAAI6Q,EAAO5Q,OAAQD,KAAK,SAAUmO,GAChD5M,EAAe7D,EAAGyQ,GAChB4C,cAAc,EACdC,YAAY,EACZxP,IAAK,WACH,MAAOsK,GAAIqC,IAEbnH,IAAK,WACH,KAAM,IAAIrG,OAAM,qDAGnBkQ,EAAO7Q,GAKV,OAHIuE,QAAO0M,QACT1M,OAAO0M,OAAOvT,GAETA,GAGTsJ,IAAK,SAASjF,EAAMuH,GAClB,KAAMA,YAAkBxI,IACtB,KAAM,IAAIrD,WAAU,cAAgBsE,EAAO,6BAC7C7C,MAAK+B,QAAQG,QAAQW,IACnBuH,OAAQA,IAQZiB,UAAW,SAASxI,EAAMmP,EAAcC,KAExCzD,OAAQ,SAAShD,GACf,MAAOA,GAAK3I,MAGd6L,MAAO,SAASlD,KAGhBmD,UAAW,SAASnD,GAClB,MAAOA,GAAKhC,QAGdoF,YAAa,SAASpD,KAIxB,IAAI2E,GAAatO,EAAOiB,UAAUkF,YAgCpC,IAAIkK,GAEEC,CACJ,IAA6B,mBAAlBC,gBACTD,EAAmB,SAAS9T,EAAKgU,EAAeC,EAASjE,GAsBvD,QAAS7C,KACP8G,EAAQC,EAAIC,cAEd,QAASvC,KACP5B,EAAO,GAAI5M,OAAM,aAAe8Q,EAAInF,OAAS,KAAOmF,EAAInF,QAAUmF,EAAIE,WAAa,IAAMF,EAAIE,WAAc,IAAM,IAAM,IAAM,YAAcpU,IAzB7I,GAAIkU,GAAM,GAAIH,gBACVM,GAAa,EACbC,GAAY,CAChB,MAAM,mBAAqBJ,IAAM,CAE/B,GAAIK,GAAc,uBAAuBC,KAAKxU,EAC1CuU,KACFF,EAAaE,EAAY,KAAOzG,OAAOa,SAAShO,KAC5C4T,EAAY,KACdF,GAAcE,EAAY,KAAOzG,OAAOa,SAASnO,WAGlD6T,GAAuC,mBAAlBI,kBACxBP,EAAM,GAAIO,gBACVP,EAAIQ,OAASvH,EACb+G,EAAIS,QAAU/C,EACdsC,EAAIU,UAAYhD,EAChBsC,EAAIW,WAAa,aACjBX,EAAIY,QAAU,EACdR,GAAY,GASdJ,EAAIa,mBAAqB,WACA,IAAnBb,EAAIc,aAEY,GAAdd,EAAInF,OACFmF,EAAIC,aACNhH,KAKA+G,EAAIe,iBAAiB,QAASrD,GAC9BsC,EAAIe,iBAAiB,OAAQ9H,IAGT,MAAf+G,EAAInF,OACX5B,IAGAyE,MAINsC,EAAIgB,KAAK,MAAOlV,GAAK,GAEjBkU,EAAIiB,mBACNjB,EAAIiB,iBAAiB,SAAU,gCAE3BnB,IAC0B,gBAAjBA,IACTE,EAAIiB,iBAAiB,gBAAiBnB,GACxCE,EAAIkB,iBAAkB,IAItBd,EACFe,WAAW,WACTnB,EAAIoB,QACH,GAEHpB,EAAIoB,KAAK,WAIV,IAAsB,mBAAXhL,UAA4C,mBAAX2D,SAAwB,CACvE,GAAIsH,EACJzB,GAAmB,SAAS9T,EAAKgU,EAAeC,EAASjE,GACvD,GAAwB,YAApBhQ,EAAI+C,OAAO,EAAG,GAChB,KAAM,IAAIK,OAAM,oBAAsBpD,EAAM,kEAM9C,OALAuV,GAAKA,GAAMjL,QAAQ,MAEjBtK,EADEiD,EACIjD,EAAIK,QAAQ,MAAO,MAAM0C,OAAO,GAEhC/C,EAAI+C,OAAO,GACZwS,EAAGC,SAASxV,EAAK,SAASiC,EAAKwT,GACpC,GAAIxT,EACF,MAAO+N,GAAO/N,EAId,IAAIyT,GAAaD,EAAO,EACF,YAAlBC,EAAW,KACbA,EAAaA,EAAW3S,OAAO,IAEjCkR,EAAQyB,UAKX,CAAA,GAAmB,mBAAR5T,OAA4C,mBAAdA,MAAKuO,MAwBjD,KAAM,IAAInQ,WAAU,sCAvBpB4T,GAAmB,SAAS9T,EAAKgU,EAAeC,EAASjE,GACvD,GAAI2F,IACFC,SAAUC,OAAU,gCAGlB7B,KAC0B,gBAAjBA,KACT2B,EAAKC,QAAuB,cAAI5B,GAClC2B,EAAKG,YAAc,WAGrBzF,MAAMrQ,EAAK2V,GACR1I,KAAK,SAAU8I,GACd,GAAIA,EAAEC,GACJ,MAAOD,GAAEE,MAET,MAAM,IAAI7S,OAAM,gBAAkB2S,EAAEhH,OAAS,IAAMgH,EAAE3B,cAGxDnH,KAAKgH,EAASjE,IASvB,GAAIkG,GAAY,WAKd,QAASA,GAAU/I,GACjB,GAAIrL,GAAOH,IAEX,OAAO6L,SAAQC,QAAQ1L,EAA4B,cAAnBD,EAAKqU,WAA6B,KAAOrU,EAAKqU,cACtErU,EAAKsU,cAAgBtU,GAAc,OAAEA,EAAKqU,aACjDlJ,KAAK,SAASkJ,GACTA,EAAWE,eACbF,EAAaA,EAAoB,QAEnC,IAAIG,EASJ,OAPEA,GADEH,EAAWI,SACOC,EACbL,EAAWM,sBACEC,EAEAC,EAGf,2BAA6BL,EAAkBnS,KAAKrC,EAAMqL,EAAMgJ,GAAc,SAAWhJ,EAAK3I,KAAO,sBAAwB2I,EAAKoC,QAAU,gBAIvJ,QAASiH,GAAiBrJ,EAAMyJ,GAC9B,GAAInT,GAAU9B,KAAKkV,kBACnBpT,GAAQI,QAAU,cAClBJ,EAAQqT,QAAS,EACU7V,SAAvBwC,EAAQsT,aACVtT,EAAQsT,WAAa,UACvBtT,EAAQuT,SAAW7J,EAAKoC,QACxB9L,EAAQwT,eAAiB9J,EAAKgC,SAAS+H,UACvCzT,EAAQ+L,YAAa,CAErB,IAAI2H,GAAW,GAAIP,GAAQL,SAAS9S,EAEpC,OAAO2T,GAAiBjK,EAAKhC,OAAQgM,EAAU1T,EAAQuT,UAEzD,QAASI,GAAiBjM,EAAQgM,EAAUH,GAC1C,IACE,MAAOG,GAASE,QAAQlM,EAAQ6L,GAElC,MAAM1I,GAGJ,GAAIA,EAAE5L,OACJ,KAAM4L,GAAE,EAEV,MAAMA,IAIV,QAASqI,GAAexJ,EAAMmK,GAC5B,GAAI7T,GAAU9B,KAAK4V,gBASnB,OARA9T,GAAQI,QAAU,SACQ5C,SAAtBwC,EAAQyT,YACVzT,EAAQyT,UAAY,UACtBzT,EAAQwT,eAAiB9J,EAAKgC,SAAS+H,UACvCzT,EAAQuT,SAAW7J,EAAKoC,QACxB9L,EAAQ+T,MAAO,EACf/T,EAAQgU,KAAM,EAEPH,EAAMI,UAAUvK,EAAKhC,OAAQ1H,GAAS+T,KAG/C,QAASd,GAAoBvJ,EAAMwK,GACjC,GAAIlU,GAAU9B,KAAKiW,qBASnB,OARAnU,GAAQoU,OAASpU,EAAQoU,QAAUF,EAAGG,aAAaC,IACzB9W,SAAtBwC,EAAQyT,YACVzT,EAAQyT,WAAY,GAClBzT,EAAQyT,WAAazT,EAAQuU,mBAAoB,IACnDvU,EAAQuU,iBAAkB,GAE5BvU,EAAQsI,OAAS4L,EAAGM,WAAWpE,OAExB8D,EAAGzB,UAAU/I,EAAKhC,OAAQ1H,EAAS0J,EAAKoC,SAGjD,MA9EA/L,GAAOiB,UAAU0R,WAAa,UA8EvBD,IAcT5R,GAAYG,UAAYjB,EAAOiB,UAC/BP,EAAeO,UAAY,GAAIH,GAC/BJ,EAAeO,UAAUuO,YAAc9O,CAEvC,IAAIG,GAUAO,EAAc,eAWdO,EAAa,GAAID,GAAID,GA6FrBuB,GAA2B,CAC/B,KACEQ,OAAOR,0BAA2BU,EAAG,GAAK,KAE5C,MAAMoH,GACJ9H,GAA2B,EAuI7B,GAAI0R,KAEJ,WAYE,QAASF,GAAgBG,GACvB,MAAIC,GACKC,EAAkB,GAAIC,QAAOH,GAAiB7V,SAAS,UACxC,mBAARiW,MACPF,EAAkBE,KAAKC,SAASC,mBAAmBN,KAEnD,GAGX,QAASO,GAAUvL,EAAMwL,GACvB,GAAIC,GAAgBzL,EAAKhC,OAAO9J,YAAY,KAGhB,WAAxB8L,EAAKgC,SAAS0J,SAChBF,GAAO,EAET,IAAIzB,GAAY/J,EAAKgC,SAAS+H,SAC9B,IAAIA,EAAW,CACb,GAAwB,gBAAbA,GACT,KAAM,IAAIhX,WAAU,oDAEtBgX,GAAY4B,KAAKC,UAAU7B,GAG7B,OAAQyB,EAAO,gCAAkC,IAAMxL,EAAKhC,QAAUwN,EAAO,wBAA0B,KAEvD,oBAAzCxL,EAAKhC,OAAOpI,OAAO6V,EAAe,IACjC,mBAAqBzL,EAAKoC,SAAW2H,EAAY,cAAgB,IAAM,KAExEA,GAAac,EAAgBd,IAAc,IAoBpD,QAAS8B,GAAQ3T,EAAQ8H,GACvB8L,EAAU9L,EACW,GAAjB+L,MACFC,EAAYpX,EAAS8R,QACvB9R,EAAS8R,OAAS9R,EAASqX,SAAW/T,EAExC,QAASgU,KACc,KAAfH,IACJnX,EAAS8R,OAAS9R,EAASqX,SAAWD,GACxCF,EAAUhY,OAuCZ,QAASqY,GAAWnM,GACboM,IACHA,EAAOvL,SAASuL,MAAQvL,SAASwL,MAAQxL,SAASyL,gBAEpD,IAAI3C,GAAS9I,SAAS0L,cAAc,SACpC5C,GAAOb,KAAOyC,EAAUvL,GAAM,EAC9B,IACImB,GADAqG,EAAU7G,OAAO6G,OAkBrB,IAhBA7G,OAAO6G,QAAU,SAASgF,GACxBrL,EAAItM,EAAW2X,EAAI,cAAgBxM,EAAKoC,SACpCoF,GACFA,EAAQiF,MAAMjY,KAAMkY,YAExBb,EAAQrX,KAAMwL,GAEVA,EAAKgC,SAAS2K,WAChBhD,EAAOiD,aAAa,YAAa5M,EAAKgC,SAAS2K,WAC7C3M,EAAKgC,SAAS6K,OAChBlD,EAAOiD,aAAa,QAAS5M,EAAKgC,SAAS6K,OAE7CT,EAAKU,YAAYnD,GACjByC,EAAKW,YAAYpD,GACjBuC,IACAvL,OAAO6G,QAAUA,EACbrG,EACF,KAAMA,GApIV,GAAI8J,GAA6B,mBAAVE,OACvB,KACMF,GAAmD,QAAtC,GAAIE,QAAO,KAAKhW,SAAS,YACxC8V,GAAY,GAEhB,MAAM9J,GACJ8J,GAAY,EAGd,GAiCIa,GAjCAZ,EAAkB,sDAqCtB9T,GAAK,gBAAiB,WACpB,MAAO,UAAS4V,GACd,QAAKlB,IAGLtX,KAAKyY,gBAAgBnB,EAASkB,IACvB,KAKX,IAAIhB,GAcAkB,EACAC,EAdApB,EAAc,CAelBhB,IAAS,SAAS/K,GAChB,GAAKA,EAAKhC,OAAV,CAEA,IAAKgC,EAAKgC,SAAS2K,WAAa3M,EAAKgC,SAAS6K,QAAUO,EACtD,MAAOjB,GAAWnV,KAAKxC,KAAMwL,EAC/B,KACE6L,EAAQrX,KAAMwL,GACd8L,EAAU9L,GAELmN,GAAM3Y,KAAKmI,eACdwQ,EAAK3Y,KAAKmI,aAAa,MACvBuQ,EAAQC,EAAGE,iBAAiB,6CAA+C7Y,MAEzE0Y,EACFC,EAAGE,iBAAiB9B,EAAUvL,GAAM,IAAS6J,SAAU7J,EAAKoC,SAAWpC,EAAKgC,SAAS+H,UAAY,cAAgB,OAEjH,EAAIuD,MAAM/B,EAAUvL,GAAM,IAC5BkM,IAEF,MAAM/K,GAEJ,KADA+K,KACMrX,EAAWsM,EAAG,cAAgBnB,EAAKoC,WAI7C,IAAIgL,IAAqB,CACrBvX,IAAgC,mBAAZgL,WAA2BA,SAASS,uBACpDX,OAAO4M,QAAU5M,OAAO4M,OAAOC,WAAaC,UAAUC,UAAUva,MAAM,eAC1Eia,GAAqB,GAKzB,IAAIhB,KA+DN,IAAI7P,GAYJhF,GAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MAGjBA,KAAK1B,QAAUgF,EAGftD,KAAKoG,OAGsB,mBAAhBpF,gBACThB,KAAKmZ,UAAYnY,aAAaE,KAGhClB,KAAKiH,UAAW,EAChBjH,KAAKoZ,qBAAsB,EAC3BpZ,KAAKqZ,aAAc,EACnBrZ,KAAKsZ,kBAAmB,EAQxBtZ,KAAK8H,IAAI,SAAU9H,KAAKgI,eAExBL,EAAcnF,KAAKxC,MAAM,GAAO,MAKd,mBAAX2I,UAA4C,mBAAX2D,UAA2BA,QAAQrE,UAC7E1F,EAAeO,UAAUqF,aAAeQ,QAgB1C,IAAIF,GAqDJ7F,GAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAY2Q,GAChC,GAAIC,GAAWhT,EAAYhE,KAAKxC,KAAM6C,EAAM+F,EAG5C,QAFI5I,KAAKoZ,qBAAwBG,GAAsD,OAA3CC,EAASpY,OAAOoY,EAASzY,OAAS,EAAG,IAAgBoC,EAAQqW,KACvGA,GAAY,OACPA,IAKX,IAAIC,IAAuC,mBAAlBrH,eACzBxP,GAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,MAAOK,SAAQC,QAAQ0C,EAAOhM,KAAKxC,KAAMwL,IACxCF,KAAK,SAASsC,GACb,MAAI6L,IACK7L,EAAQlP,QAAQ,KAAM,OACxBkP,OAQbhL,EAAK,QAAS,WACZ,MAAO,UAAS4I,GACd,MAAO,IAAIK,SAAQ,SAASC,EAASuC,GACnC8D,EAAiB3G,EAAKoC,QAASpC,EAAKgC,SAAS6E,cAAevG,EAASuC,QAmB3EzL,EAAK,SAAU,SAAS8W,GACtB,MAAO,UAAS7W,EAAM+F,EAAY6I,GAGhC,MAFI7I,IAAcA,EAAW/F,MAC3B4D,EAAKjE,KAAKxC,KAAM,oHAAsH6C,EAAO,SAAW+F,EAAW/F,MAC9J6W,EAAalX,KAAKxC,KAAM6C,EAAM+F,EAAY6I,GAAenG,KAAK,SAASlB,GAC5E,MAAOA,GAAOsK,aAAetK,EAAgB,QAAIA,OAQvDxH,EAAK,YAAa,SAAS+W,GACzB,MAAO,UAASnO,GAGd,MAF4B,UAAxBA,EAAKgC,SAAS0J,SAChB1L,EAAKgC,SAAS0J,OAAS5X,QAClBqa,EAAgB1B,MAAMjY,KAAMkY,cA0BvCtV,EAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACd,GAA4B,QAAxBA,EAAKgC,SAAS0J,SAAqBlX,KAAK+I,QAAS,CACnD,GAAI6Q,GAAQpO,EAAKgC,SAASoM,MAAQjQ,GAClCiQ,GAAMvV,QACNuV,EAAM9P,QAAU,WACd,IACE,MAAOqN,MAAK0C,MAAMrO,EAAKhC,QAEzB,MAAMmD,GACJ,KAAM,IAAIlL,OAAM,qBAAuB+J,EAAK3I,YAsDtDN,EAAeO,UAAUgX,UAAY,SAASjX,GAC5C,GAAI8D,MACAjD,EAAS1D,IACb,KAAK,GAAIJ,KAAK8D,GACRA,EAAOK,iBAAmBL,EAAOK,eAAenE,IAAMA,IAAK2C,GAAeO,WAAkB,cAALlD,GAEvFqB,EAAQuB,MAAM,UAAW,YAAa,aAAc,UAAW,SAAU,UAAW,SAAU5C,KAAM,IACtG+G,EAAI/G,GAAK8D,EAAO9D,GAGpB,OADA+G,GAAIyB,WAAaL,GAAUK,WACpBzB,EAGT,IAAIoT,GACJxX,GAAeO,UAAUkX,OAAS,SAASrT,EAAKsT,GAiC1C,QAASC,GAAetN,GACtB,IAAK,GAAIhN,KAAKgN,GACZ,GAAIA,EAAI7I,eAAenE,GACrB,OAAO,EAnCjB,GAAI8D,GAAS1D,IAoBb,IAlBI,oBAAsB2G,KACxBoT,GAAe/Y,aACX2F,EAAI2S,iBACNtY,aAAe1B,OAEf0B,aAAe+Y,IAGf,YAAcpT,KAChBjD,EAAOuD,SAAWN,EAAIM,UAGpBN,EAAIwT,qBAAsB,IAC5BzW,EAAO3B,QAAQqY,yBAA0B,IAEvC,cAAgBzT,IAAO,SAAWA,KACpCgB,EAAcnF,KAAKkB,IAAUiD,EAAIyB,cAAezB,EAAI2B,OAASP,IAAaA,GAAUO,SAEjF2R,EAAa,CAGhB,GAAI3b,EAOJ,IANA0K,EAAOtF,EAAQiD,EAAK,SAASA,GAC3BrI,EAAUA,GAAWqI,EAAIrI,UAE3BA,EAAUA,GAAWqI,EAAIrI,QAGZ,CAOX,GAAI4b,EAAexW,EAAOoD,WAAaoT,EAAexW,EAAO2C,OAAS6T,EAAexW,EAAO4C,WAAa4T,EAAexW,EAAO2W,UAAYH,EAAexW,EAAO4W,oBAC/J,KAAM,IAAI/b,WAAU,qGAEtByB,MAAK1B,QAAUA,EACfoJ,EAAelF,KAAKxC,MAYtB,GATI2G,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,OAE3BuG,EAAOtF,EAAQiD,EAAK,SAASA,GACvBA,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,SAIzBzC,KAAKiH,SACP,IAAK,GAAIrH,KAAK8D,GAAOjB,MACf7C,EAAEqB,QAAQ,OAAQ,GACpBwF,EAAKjE,KAAKkB,EAAQ,wBAA0B9D,EAAI,SAAW8D,EAAOjB,MAAM7C,GAAK,yGAYrF,GARI+G,EAAIyS,sBACN1V,EAAO0V,oBAAsBzS,EAAIyS,oBACjC3S,EAAKjE,KAAKkB,EAAQ,oGAGhBiD,EAAI0S,cACN3V,EAAO2V,YAAc1S,EAAI0S,aAEvB1S,EAAIP,IACN,IAAK,GAAIxG,KAAK+G,GAAIP,IAAK,CACrB,GAAImU,GAAI5T,EAAIP,IAAIxG,EAGhB,IAAiB,gBAAN2a,GAAgB,CACzB,GAAIC,GAAqB9W,EAAO0V,qBAAoD,OAA7BxZ,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAO+W,eAAe7a,EAC7B4a,IAAyD,OAAnCrU,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,GAGtC,IAAI2Z,GAAW,EACf,KAAK,GAAI7T,KAAOnD,GAAOoD,SACjBX,EAAK/E,OAAO,EAAGyF,EAAI9F,SAAW8F,KACzBV,EAAKU,EAAI9F,SAA+B,KAApBoF,EAAKU,EAAI9F,UAC/B2Z,EAAS9Z,MAAM,KAAKG,OAAS8F,EAAIjG,MAAM,KAAKG,SACjD2Z,EAAW7T,EAEX6T,IAAYhX,EAAOoD,SAAS4T,GAAU1T,OACxCb,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS2C,EAAOoD,SAAS4T,GAAU1T,KAAKjG,OAAS,GAE9E,IAAI8F,GAAMnD,EAAOoD,SAASX,GAAQzC,EAAOoD,SAASX,MAClDU,GAAIT,IAAMmU,MAGV7W,GAAO0C,IAAIxG,GAAK2a,EAKtB,GAAI5T,EAAI2T,mBAAoB,CAE1B,IAAK,GADDA,MACKxZ,EAAI,EAAGA,EAAI6F,EAAI2T,mBAAmBvZ,OAAQD,IAAK,CACtD,GAAIkD,GAAO2C,EAAI2T,mBAAmBxZ,GAC9B6Z,EAAgBC,KAAKC,IAAI7W,EAAKtE,YAAY,KAAO,EAAGsE,EAAKtE,YAAY,MACrEob,EAAatU,EAAYhE,KAAKkB,EAAQM,EAAK5C,OAAO,EAAGuZ,GACzDL,GAAmBxZ,GAAKga,EAAa9W,EAAK5C,OAAOuZ,GAEnDjX,EAAO4W,mBAAqBA,EAG9B,GAAI3T,EAAI0T,QACN,IAAK,GAAIza,KAAK+G,GAAI0T,QAAS,CAEzB,IAAK,GADDU,MACKja,EAAI,EAAGA,EAAI6F,EAAI0T,QAAQza,GAAGmB,OAAQD,IAAK,CAC9C,GAAI0Z,GAAqB9W,EAAO0V,qBAAoF,OAA7DzS,EAAI0T,QAAQza,GAAGkB,GAAGM,OAAOuF,EAAI0T,QAAQza,GAAGkB,GAAGC,OAAS,EAAG,GAC1Gia,EAAsBtX,EAAO+W,eAAe9T,EAAI0T,QAAQza,GAAGkB,GAC3D0Z,IAAuF,OAAjEQ,EAAoB5Z,OAAO4Z,EAAoBja,OAAS,EAAG,KACnFia,EAAsBA,EAAoB5Z,OAAO,EAAG4Z,EAAoBja,OAAS,IACnFga,EAAOjb,KAAKkb,GAEdtX,EAAO2W,QAAQza,GAAKmb,EAIxB,GAAIpU,EAAIG,SACN,IAAK,GAAIlH,KAAK+G,GAAIG,SAAU,CAC1B,GAAIlH,EAAEjB,MAAM,oBACV,KAAM,IAAIJ,WAAU,IAAMqB,EAAI,iCAEhC,IAAIuG,GAAOK,EAAYhE,KAAKkB,EAAQ9D,EAGP,MAAzBuG,EAAKA,EAAKpF,OAAS,KACrBoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IAEtC2F,EAAahD,EAAQyC,EAAMQ,EAAIG,SAASlH,IAAI,GAIhD,IAAK,GAAIqb,KAAKtU,GAAK,CACjB,GAAI4T,GAAI5T,EAAIsU,EAEZ,IAAIha,EAAQuB,MAAM,UAAW,MAAO,WAAY,UAAW,QAAS,WAAY,qBAC1E,mBAAoB,gBAAiB,aAAc,YAAa,cAAe,oBAAqByY,KAAM,EAGhH,GAAgB,gBAALV,IAAiBA,YAAa3U,OACvClC,EAAOuX,GAAKV,MAET,CACH7W,EAAOuX,GAAKvX,EAAOuX,MAEnB,KAAK,GAAIrb,KAAK2a,GAEZ,GAAS,QAALU,GAAuB,KAARrb,EAAE,GACnBmF,EAAOrB,EAAOuX,GAAGrb,GAAK8D,EAAOuX,GAAGrb,OAAU2a,EAAE3a,QAEzC,IAAS,QAALqb,EAAa,CAEpB,GAAIzB,GAAWhT,EAAYhE,KAAKkB,EAAQ9D,EACpC8D,GAAO0V,qBAAkE,OAA3CI,EAASpY,OAAOoY,EAASzY,OAAS,EAAG,KAAgBoC,EAAQqW,KAC7FA,GAAY,OACdzU,EAAOrB,EAAOuX,GAAGzB,GAAY9V,EAAOuX,GAAGzB,OAAiBe,EAAE3a,QAEvD,IAAS,YAALqb,EAAiB,CACxB,GAAIT,GAAqB9W,EAAO0V,qBAAoD,OAA7BxZ,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAO+W,eAAe7a,EAC7B4a,IAAyD,OAAnCrU,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IACtC2C,EAAOuX,GAAG9U,MAAWN,OAAO0U,EAAE3a,QAG9B8D,GAAOuX,GAAGrb,GAAK2a,EAAE3a,IAMzBoJ,EAAOtF,EAAQiD,EAAK,SAASA,GAC3BjD,EAAOsW,OAAOrT,GAAK,MA6FvB,WAUE,QAASuU,GAAWxX,EAAQoX,GAE1B,GAAIK,GAAuBC,EAAfC,EAAY,CACxB,KAAK,GAAIzb,KAAK8D,GAAOoD,SACfgU,EAAW1Z,OAAO,EAAGxB,EAAEmB,UAAYnB,GAAMkb,EAAW/Z,SAAWnB,EAAEmB,QAAmC,MAAzB+Z,EAAWlb,EAAEmB,UAC1Fqa,EAASxb,EAAEgB,MAAM,KAAKG,OAClBqa,EAASC,IACXF,EAASvb,EACTyb,EAAYD,GAIlB,OAAOD,GAGT,QAASG,GAAoB5X,EAAQmD,EAAKZ,EAASsV,EAASC,GAE1D,IAAKD,GAA0C,KAA/BA,EAAQA,EAAQxa,OAAS,IAAaya,GAAkB3U,EAAI4U,oBAAqB,EAC/F,MAAOF,EAET,IAAIG,IAAY,CAgBhB,IAbI7U,EAAIR,MACNsV,EAAe9U,EAAIR,KAAMkV,EAAS,SAASK,EAAaC,EAAWC,GACjE,GAAkB,GAAdA,GAAmBF,EAAYlc,YAAY,MAAQkc,EAAY7a,OAAS,EAC1E,MAAO2a,IAAY,KAIpBA,GAAahY,EAAO2C,MACvBsV,EAAejY,EAAO2C,KAAMJ,EAAU,IAAMsV,EAAS,SAASK,EAAaC,EAAWC,GACpF,GAAkB,GAAdA,GAAmBF,EAAYlc,YAAY,MAAQkc,EAAY7a,OAAS,EAC1E,MAAO2a,IAAY,IAGrBA,EACF,MAAOH,EAIT,IAAIE,GAAmB,KAAO5U,EAAI4U,kBAAoB,KACtD,OAAIF,GAAQna,OAAOma,EAAQxa,OAAS0a,EAAiB1a,SAAW0a,EACvDF,EAAUE,EAEVF,EAGX,QAASQ,GAAuBrY,EAAQmD,EAAKZ,EAASsV,EAASC,GAE7D,IAAKD,EAAS,CACZ,IAAI1U,EAAIG,KAMN,MAAOf,IAAWvC,EAAO0V,oBAAsB,MAAQ,GALvDmC,GAAmC,MAAzB1U,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAIH,EAAIT,IAAK,CACX,GAAI4V,GAAU,KAAOT,EAEjB1S,EAAWvB,EAAYT,EAAIT,IAAK4V,EAQpC,IALKnT,IACHmT,EAAU,KAAOV,EAAoB5X,EAAQmD,EAAKZ,EAASsV,EAASC,GAChEQ,GAAW,KAAOT,IACpB1S,EAAWvB,EAAYT,EAAIT,IAAK4V,KAEhCnT,EAAU,CACZ,GAAIoT,GAASC,EAAUxY,EAAQmD,EAAKZ,EAAS4C,EAAUmT,EAASR,EAChE,IAAIS,EACF,MAAOA,IAKb,MAAOhW,GAAU,IAAMqV,EAAoB5X,EAAQmD,EAAKZ,EAASsV,EAASC,GAG5E,QAASW,GAAatT,EAAUoT,EAAQhW,EAASjC,GAE/C,GAAgB,KAAZ6E,EACF,KAAM,IAAIpH,OAAM,WAAawE,EAAU,mDAIzC,SAAIgW,EAAO7a,OAAO,EAAGyH,EAAS9H,SAAW8H,GAAY7E,EAAKjD,OAAS8H,EAAS9H,QAM9E,QAASmb,GAAUxY,EAAQmD,EAAKZ,EAAS4C,EAAU7E,EAAMwX,GAC1B,KAAzBxX,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GACtC,IAAIkb,GAASpV,EAAIT,IAAIyC,EAErB,IAAqB,gBAAVoT,GACT,KAAM,IAAIxa,OAAM,wEAA0EoH,EAAW,OAAS5C,EAEhH,IAAKkW,EAAatT,EAAUoT,EAAQhW,EAASjC,IAA0B,gBAAViY,GAA7D,CAIA,GAAc,KAAVA,EACFA,EAAShW,MAGN,IAA2B,MAAvBgW,EAAO7a,OAAO,EAAG,GACxB,MAAO6E,GAAU,IAAMqV,EAAoB5X,EAAQmD,EAAKZ,EAASgW,EAAO7a,OAAO,GAAK4C,EAAK5C,OAAOyH,EAAS9H,QAASya,EAGpH,OAAO9X,GAAO0Y,cAAcH,EAASjY,EAAK5C,OAAOyH,EAAS9H,QAASkF,EAAU,MAG/E,QAASoW,GAAmB3Y,EAAQmD,EAAKZ,EAASsV,EAASC,GAEzD,IAAKD,EAAS,CACZ,IAAI1U,EAAIG,KAMN,MAAO6E,SAAQC,QAAQ7F,GAAWvC,EAAO0V,oBAAsB,MAAQ,IALvEmC,GAAmC,MAAzB1U,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAIgV,GAASnT,CAcb,OAZIhC,GAAIT,MACN4V,EAAU,KAAOT,EACjB1S,EAAWvB,EAAYT,EAAIT,IAAK4V,GAG3BnT,IACHmT,EAAU,KAAOV,EAAoB5X,EAAQmD,EAAKZ,EAASsV,EAASC,GAChEQ,GAAW,KAAOT,IACpB1S,EAAWvB,EAAYT,EAAIT,IAAK4V,OAI9BnT,EAAWyT,EAAM5Y,EAAQmD,EAAKZ,EAAS4C,EAAUmT,EAASR,GAAkB3P,QAAQC,WAC3FR,KAAK,SAAS2Q,GACb,MAAIA,GACKpQ,QAAQC,QAAQmQ,GAGlBpQ,QAAQC,QAAQ7F,EAAU,IAAMqV,EAAoB5X,EAAQmD,EAAKZ,EAASsV,EAASC,MAI9F,QAASe,GAAY7Y,EAAQmD,EAAKZ,EAAS4C,EAAUoT,EAAQjY,EAAMwX,GAGjE,GAAc,KAAVS,EACFA,EAAShW,MAGN,IAA2B,MAAvBgW,EAAO7a,OAAO,EAAG,GACxB,MAAOyK,SAAQC,QAAQ7F,EAAU,IAAMqV,EAAoB5X,EAAQmD,EAAKZ,EAASgW,EAAO7a,OAAO,GAAK4C,EAAK5C,OAAOyH,EAAS9H,QAASya,IACjIlQ,KAAK,SAASzI,GACb,MAAO6I,GAAuBlJ,KAAKkB,EAAQb,EAAMoD,EAAU,MAI/D,OAAOvC,GAAO2H,UAAU4Q,EAASjY,EAAK5C,OAAOyH,EAAS9H,QAASkF,EAAU,KAG3E,QAASqW,GAAM5Y,EAAQmD,EAAKZ,EAAS4C,EAAU7E,EAAMwX,GACtB,KAAzBxX,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GAEtC,IAAIkb,GAASpV,EAAIT,IAAIyC,EAErB,IAAqB,gBAAVoT,GACT,MAAKE,GAAatT,EAAUoT,EAAQhW,EAASjC,GAEtCuY,EAAY7Y,EAAQmD,EAAKZ,EAAS4C,EAAUoT,EAAQjY,EAAMwX,GADxD3P,QAAQC,SAKnB,IAAIpI,EAAOqF,QACT,MAAO8C,SAAQC,QAAQ7F,EAAU,MAAQjC,EAG3C,IAAIwY,MACAC,IACJ,KAAK,GAAI9P,KAAKsP,GAAQ,CACpB,GAAIhB,GAAIxQ,EAAekC,EACvB8P,GAAW3c,MACT4K,UAAWuQ,EACX7U,IAAK6V,EAAOtP,KAEd6P,EAAkB1c,KAAK4D,EAAe,OAAEuX,EAAE7Q,OAAQnE,IAIpD,MAAO4F,SAAQsD,IAAIqN,GAClBlR,KAAK,SAASoR,GAEb,IAAK,GAAI5b,GAAI,EAAGA,EAAI2b,EAAW1b,OAAQD,IAAK,CAC1C,GAAIma,GAAIwB,EAAW3b,GAAG4J,UAClB1F,EAAQmC,EAAqB8T,EAAE9U,KAAMuW,EAAgB5b,GACzD,KAAKma,EAAEjQ,QAAUhG,GAASiW,EAAEjQ,SAAWhG,EACrC,MAAOyX,GAAW3b,GAAGsF,OAG1BkF,KAAK,SAAS2Q,GACb,GAAIA,EAAQ,CACV,IAAKE,EAAatT,EAAUoT,EAAQhW,EAASjC,GAC3C,MACF,OAAOuY,GAAY7Y,EAAQmD,EAAKZ,EAAS4C,EAAUoT,EAAQjY,EAAMwX,MA8JvE,QAASmB,GAAuB3Y,GAC9B,GAAI4Y,GAAe5Y,EAAKtE,YAAY,KAChCqB,EAAS6Z,KAAKC,IAAI+B,EAAe,EAAG5Y,EAAKtE,YAAY,KACzD,QACEqB,OAAQA,EACR8b,MAAO,GAAIC,QAAO,KAAO9Y,EAAK5C,OAAO,EAAGL,GAAQrC,QAAQ,qBAAsB,QAAQA,QAAQ,MAAO,WAAa,YAClHiF,SAAUiZ,IAAgB,GAK9B,QAASG,GAAsBrZ,EAAQoX,GAErC,IAAK,GADD7U,GAA6B+W,EAApBC,GAAa,EACjBnc,EAAI,EAAGA,EAAI4C,EAAO4W,mBAAmBvZ,OAAQD,IAAK,CACzD,GAAIoc,GAAoBxZ,EAAO4W,mBAAmBxZ,GAC9ClB,EAAI0a,EAAmB4C,KAAuB5C,EAAmB4C,GAAqBP,EAAuBO,GACjH,MAAIpC,EAAW/Z,OAASnB,EAAEmB,QAA1B,CAEA,GAAIpC,GAAQmc,EAAWnc,MAAMiB,EAAEid,QAC3Ble,GAAWsH,IAAcgX,GAAcrd,EAAE+D,YAAasC,EAAQlF,OAASpC,EAAM,GAAGoC,WAClFkF,EAAUtH,EAAM,GAChBse,GAAcrd,EAAE+D,SAChBqZ,EAAa/W,EAAUiX,EAAkB9b,OAAOxB,EAAEmB,UAItD,GAAKkF,EAGL,OACEkX,YAAalX,EACb+W,WAAYA,GAIhB,QAASI,GAAsB1Z,EAAQuC,EAASoX,GAC9C,GAAIC,GAAe5Z,EAAO+Q,cAAgB/Q,CAM1C,QAHC4Z,EAAajX,KAAKgX,GAAiBC,EAAajX,KAAKgX,QAAsBnG,OAAS,OACrFoG,EAAajX,KAAKgX,GAAe3Z,OAAS,KAEnC4Z,EAAa9R,KAAK6R,GACxB/R,KAAK,WACJ,GAAI3E,GAAM2W,EAAahb,IAAI+a,GAAwB,OAYnD,OATI1W,GAAI4W,WACN5W,EAAMA,EAAI4W,UAGR5W,EAAIzE,UACNyE,EAAIN,KAAOM,EAAIzE,QACfuE,EAAKjE,KAAKkB,EAAQ,uBAAyB2Z,EAAgB,yFAGtD3W,EAAahD,EAAQuC,EAASU,GAAK,KAI9C,QAASgV,GAAe6B,EAASjC,EAASkC,GAExC,GACIC,EACJ,KAAK,GAAItT,KAAUoT,GAAS,CAE1B,GAAIG,GAAgC,MAAvBvT,EAAOhJ,OAAO,EAAG,GAAa,KAAO,EAKlD,IAJIuc,IACFvT,EAASA,EAAOhJ,OAAO,IAEzBsc,EAAgBtT,EAAOnJ,QAAQ,KAC3Byc,KAAkB,GAGlBtT,EAAOhJ,OAAO,EAAGsc,IAAkBnC,EAAQna,OAAO,EAAGsc,IAClDtT,EAAOhJ,OAAOsc,EAAgB,IAAMnC,EAAQna,OAAOma,EAAQxa,OAASqJ,EAAOrJ,OAAS2c,EAAgB,IAErGD,EAAQrT,EAAQoT,EAAQG,EAASvT,GAASA,EAAOxJ,MAAM,KAAKG,QAC9D,OAIN,GAAI6c,GAAYJ,EAAQjC,IAAYiC,EAAQzZ,gBAAkByZ,EAAQzZ,eAAewX,GAAWiC,EAAQjC,GAAWiC,EAAQ,KAAOjC,EAC9HqC,IACFH,EAAQG,EAAWA,EAAW,GAldlC7a,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MACjBA,KAAK8G,YACL9G,KAAKsa,yBAoOT/X,EAAeO,UAAUsZ,cAAgB7Z,EAAeO,UAAU2X,eAAiBlY,EAAeO,UAAUuI,UAI5GzI,EAAK,iBAAkB,SAAS6X,GAC9B,MAAO,UAAS5X,EAAM+F,GACpB,GAAI5I,KAAK+I,QACP,MAAO0R,GAAejY,KAAKxC,KAAM6C,EAAM+F,GAAY,EAErD,IAAIiV,GAAkBpD,EAAejY,KAAKxC,KAAM6C,EAAM+F,GAAY,EAElE,KAAK5I,KAAKoZ,oBACR,MAAOyE,EAET,IAAI5X,GAAUiV,EAAWlb,KAAM6d,GAE3BhX,EAAM7G,KAAK8G,SAASb,GACpBwV,EAAmB5U,GAAOA,EAAI4U,gBAalC,OAXwBnc,SAApBmc,GAAiC5U,GAAOA,EAAIR,MAC9CsV,EAAe9U,EAAIR,KAAMwX,EAAgBzc,OAAO6E,GAAU,SAAS2V,EAAaC,EAAWC,GACzF,GAAkB,GAAdA,GAAmBF,EAAYlc,YAAY,MAAQkc,EAAY7a,OAAS,EAE1E,MADA0a,IAAmB,GACZ,KAIRA,KAAqB,GAASA,GAAwC,OAApBA,IAAiE,OAAnC5Y,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,IAAwE,OAAzD8c,EAAgBzc,OAAOyc,EAAgB9c,OAAS,EAAG,KAClL8c,EAAkBA,EAAgBzc,OAAO,EAAGyc,EAAgB9c,OAAS,IAEhE8c,KAIXjb,EAAK,gBAAiB,SAASwZ,GAC7B,MAAO,UAASvZ,EAAM+F,EAAYkV,GAChC,GAAIpa,GAAS1D,IAKb,IAJA8d,EAAWA,KAAa,EAIpBlV,EACF,GAAImV,GAAoB7C,EAAWxX,EAAQkF,IACvClF,EAAO0V,qBAAsE,OAA/CxQ,EAAWxH,OAAOwH,EAAW7H,OAAS,EAAG,IACvEma,EAAWxX,EAAQkF,EAAWxH,OAAO,EAAGwH,EAAW7H,OAAS,GAElE,IAAIid,GAAgBD,GAAqBra,EAAOoD,SAASiX,EAGzD,IAAIC,GAA4B,KAAXnb,EAAK,GAAW,CACnC,GAAIob,GAAYD,EAAc5X,IAC1B8X,EAAiBD,GAAa3W,EAAY2W,EAAWpb,EAEzD,IAAIqb,GAAsD,gBAA7BD,GAAUC,GAA6B,CAClE,GAAIjC,GAASC,EAAUxY,EAAQsa,EAAeD,EAAmBG,EAAgBrb,EAAMib,EACvF,IAAI7B,EACF,MAAOA,IAIb,GAAIzB,GAAqB9W,EAAO0V,qBAA0D,OAAnCvW,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhF+Z,EAAasB,EAAc5Z,KAAKkB,EAAQb,EAAM+F,GAAY,EAG1D4R,IAAqE,OAA/CM,EAAW1Z,OAAO0Z,EAAW/Z,OAAS,EAAG,KACjEyZ,GAAqB,GACnBA,IACFM,EAAaA,EAAW1Z,OAAO,EAAG0Z,EAAW/Z,OAAS,GAExD,IAAIod,GAAiBpB,EAAsBrZ,EAAQoX,GAC/C7U,EAAUkY,GAAkBA,EAAehB,aAAejC,EAAWxX,EAAQoX;AAEjF,IAAK7U,EACH,MAAO6U,IAAcN,EAAqB,MAAQ,GAEpD,IAAIe,GAAUT,EAAW1Z,OAAO6E,EAAQlF,OAAS,EAEjD,OAAOgb,GAAuBrY,EAAQA,EAAOoD,SAASb,OAAgBA,EAASsV,EAASuC,MAI5Flb,EAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAYkV,GAChC,GAAIpa,GAAS1D,IAGb,OAFA8d,GAAWA,KAAa,EAEjBjS,QAAQC,UACdR,KAAK,WAGJ,GAAI1C,EACF,GAAImV,GAAoB7C,EAAWxX,EAAQkF,IACvClF,EAAO0V,qBAAsE,OAA/CxQ,EAAWxH,OAAOwH,EAAW7H,OAAS,EAAG,IACvEma,EAAWxX,EAAQkF,EAAWxH,OAAO,EAAGwH,EAAW7H,OAAS,GAElE,IAAIid,GAAgBD,GAAqBra,EAAOoD,SAASiX,EAGzD,IAAIC,GAAsC,MAArBnb,EAAKzB,OAAO,EAAG,GAAY,CAC9C,GAAI6c,GAAYD,EAAc5X,IAC1B8X,EAAiBD,GAAa3W,EAAY2W,EAAWpb,EAEzD,IAAIqb,EACF,MAAO5B,GAAM5Y,EAAQsa,EAAeD,EAAmBG,EAAgBrb,EAAMib,GAGjF,MAAOjS,SAAQC,YAEhBR,KAAK,SAAS2Q,GACb,GAAIA,EACF,MAAOA,EAET,IAAIzB,GAAqB9W,EAAO0V,qBAA0D,OAAnCvW,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhF+Z,EAAazP,EAAU7I,KAAKkB,EAAQb,EAAM+F,GAAY,EAGtD4R,IAAqE,OAA/CM,EAAW1Z,OAAO0Z,EAAW/Z,OAAS,EAAG,KACjEyZ,GAAqB,GACnBA,IACFM,EAAaA,EAAW1Z,OAAO,EAAG0Z,EAAW/Z,OAAS,GAExD,IAAIod,GAAiBpB,EAAsBrZ,EAAQoX,GAC/C7U,EAAUkY,GAAkBA,EAAehB,aAAejC,EAAWxX,EAAQoX,EAEjF,KAAK7U,EACH,MAAO4F,SAAQC,QAAQgP,GAAcN,EAAqB,MAAQ,IAEpE,IAAI3T,GAAMnD,EAAOoD,SAASb,GAGtBmY,EAAevX,IAAQA,EAAIwX,aAAeF,EAC9C,QAAQC,EAAevS,QAAQC,QAAQjF,GAAOuW,EAAsB1Z,EAAQuC,EAASkY,EAAenB,aACnG1R,KAAK,SAASzE,GACb,GAAI0U,GAAUT,EAAW1Z,OAAO6E,EAAQlF,OAAS,EAEjD,OAAOsb,GAAmB3Y,EAAQmD,EAAKZ,EAASsV,EAASuC,SAQjE,IAAIxD,KA0FJ1X,GAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAAI9H,GAAS1D,IACb,OAAO6L,SAAQC,QAAQ0C,EAAOhM,KAAKxC,KAAMwL,IACxCF,KAAK,SAASsC,GACb,GAAI3H,GAAUiV,EAAWxX,EAAQ8H,EAAK3I,KACtC,IAAIoD,EAAS,CACX,GAAIY,GAAMnD,EAAOoD,SAASb,GACtBsV,EAAU/P,EAAK3I,KAAKzB,OAAO6E,EAAQlF,OAAS,GAE5CsF,IACJ,IAAIQ,EAAIR,KAAM,CACZ,GAAIiY,GAAY,CAGhB3C,GAAe9U,EAAIR,KAAMkV,EAAS,SAASK,EAAaC,EAAWC,GAC7DA,EAAawC,IACfA,EAAYxC,GACdpW,EAAWW,EAAMwV,EAAWC,GAAcwC,EAAYxC,KAGxDpW,EAAW8F,EAAKgC,SAAUnH,GAIxBQ,EAAIqQ,SAAW1L,EAAKgC,SAAS9J,SAC/B8H,EAAKgC,SAAS0J,OAAS1L,EAAKgC,SAAS0J,QAAUrQ,EAAIqQ,QAGvD,MAAOtJ,WAWf,WAsBE,QAAS2Q,KACP,GAAIC,GAA6D,gBAAxCA,EAAkBrJ,OAAO9B,WAChD,MAAOmL,GAAkBhT,IAE3B,KAAK,GAAI1K,GAAI,EAAGA,EAAI2d,EAA0B1d,OAAQD,IACpD,GAAsD,eAAlD2d,EAA0B3d,GAAGqU,OAAO9B,WAEtC,MADAmL,GAAoBC,EAA0B3d,GACvC0d,EAAkBhT,KA0C/B,QAASkT,GAAgBhb,EAAQ8H,GAC/B,MAAO,IAAIK,SAAQ,SAASC,EAASuC,GAC/B7C,EAAKgC,SAAS2K,WAChB9J,EAAO,GAAI5M,OAAM,oEAEnBkd,EAAanT,CACb,KACEY,cAAcZ,EAAKoC,SAErB,MAAMjB,GACJgS,EAAa,KACbtQ,EAAO1B,GAETgS,EAAa,KAGRnT,EAAKgC,SAASoM,OACjBvL,EAAO,GAAI5M,OAAM+J,EAAKoC,QAAU,+GAElC9B,EAAQ,MAxFZ,GAAuB,mBAAZO,UACT,GAAIuL,GAAOvL,SAASS,qBAAqB,QAAQ,EAEnD,IAAI0K,GACAoH,EAeAJ,EAZAG,EAAa,KAGbE,EAAWjH,GAAQ,WACrB,GAAIkH,GAAIzS,SAAS0L,cAAc,UAC3BgH,EAA2B,mBAAVC,QAA8C,mBAArBA,MAAMre,UACpD,OAAOme,GAAEG,eAAiBH,EAAEG,YAAYte,UAAYme,EAAEG,YAAYte,WAAWM,QAAQ,gBAAkB,KAAO8d,KAK5GN,KAkBAS,EAAa,EACbC,IACJvc,GAAK,gBAAiB,SAASwc,GAC7B,MAAO,UAAS5G,GAEd,OAAI4G,EAAa5c,KAAKxC,KAAMwY,KAIxBmG,EACF3e,KAAKyY,gBAAgBkG,EAAYnG,GAI1BqG,EACP7e,KAAKyY,gBAAgB8F,IAA4B/F,GAI1C0G,EACPC,EAAcrf,KAAK0Y,GAOnBxY,KAAKyY,gBAAgB,KAAMD,IAEtB,MA4BX5V,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,GAAI9H,GAAS1D,IAEb,OAA4B,QAAxBwL,EAAKgC,SAAS0J,QAAqB1L,EAAKgC,SAAS6R,aAAgBhe,GAAc6K,GAG/EA,EACKwS,EAAgBhb,EAAQ8H,GAE1B,GAAIK,SAAQ,SAASC,EAASuC,GA+BnC,QAASiR,GAASC,GAChB,IAAIT,EAAEzL,YAA8B,UAAhByL,EAAEzL,YAA0C,YAAhByL,EAAEzL,WAAlD,CAOA,GAJA6L,IAIK1T,EAAKgC,SAASoM,OAAUuF,EAAcpe,QAGtC,IAAK8d,EAAU,CAClB,IAAK,GAAI/d,GAAI,EAAGA,EAAIqe,EAAcpe,OAAQD,IACxC4C,EAAO+U,gBAAgBjN,EAAM2T,EAAcre,GAC7Cqe,WALAzb,GAAO+U,gBAAgBjN,EAQzBgU,KAGKhU,EAAKgC,SAASoM,OAAUpO,EAAKgC,SAASuN,QACzC1M,EAAO,GAAI5M,OAAM+J,EAAK3I,KAAO,kKAE/BiJ,EAAQ,KAGV,QAASmE,GAAMsP,GACbC,IACAnR,EAAO,GAAI5M,OAAM,yBAA2B+J,EAAKoC,UAGnD,QAAS4R,KAIP,GAHApf,EAAS8R,OAASsF,EAClBpX,EAASuI,QAAUiW,EAEfE,EAAEW,YAAa,CACjBX,EAAEW,YAAY,qBAAsBH,EACpC,KAAK,GAAIxe,GAAI,EAAGA,EAAI2d,EAA0B1d,OAAQD,IAChD2d,EAA0B3d,GAAGqU,QAAU2J,IACrCN,GAAqBA,EAAkBrJ,QAAU2J,IACnDN,EAAoB,MACtBC,EAA0B9N,OAAO7P,EAAG,QAIxCge,GAAEY,oBAAoB,OAAQJ,GAAU,GACxCR,EAAEY,oBAAoB,QAASzP,GAAO,EAGxC2H,GAAKW,YAAYuG,GA/EnB,GAAIA,GAAIzS,SAAS0L,cAAc,SAE/B+G,GAAEa,OAAQ,EAENnU,EAAKgC,SAASoS,cAChBd,EAAEc,YAAcpU,EAAKgC,SAASoS,aAE5BpU,EAAKgC,SAAS2K,WAChB2G,EAAE1G,aAAa,YAAa5M,EAAKgC,SAAS2K,WAExC0G,GACFC,EAAEG,YAAY,qBAAsBK,GACpCb,EAA0B3e,MACxBqV,OAAQ2J,EACRtT,KAAMA,MAIRsT,EAAExL,iBAAiB,OAAQgM,GAAU,GACrCR,EAAExL,iBAAiB,QAASrD,GAAO,IAGrCiP,IAEA1H,EAAYpX,EAAS8R,OACrB0M,EAAaxe,EAASuI,QAEtBmW,EAAE5d,IAAMsK,EAAKoC,QACbgK,EAAKU,YAAYwG,KAlCVpQ,EAAMlM,KAAKxC,KAAMwL,QAgJhC,IAAI9B,IAA6B,2FAwBjC,WAsGE,QAASmW,GAAYjG,EAAOlW,EAAQoc,GAGlC,GAFAA,EAAOlG,EAAM1P,YAAc4V,EAAOlG,EAAM1P,gBAEpCjJ,EAAQuB,KAAKsd,EAAOlG,EAAM1P,YAAa0P,KAAU,EAArD,CAGAkG,EAAOlG,EAAM1P,YAAYpK,KAAK8Z,EAE9B,KAAK,GAAI9Y,GAAI,EAAG0D,EAAIoV,EAAM3P,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAAIif,GAAUnG,EAAM3P,eAAenJ,GAC/Bkf,EAAWtc,EAAOuc,QAAQF,EAG9B,IAAKC,IAAYA,EAAS7V,UAA1B,CAIA,GAAI+V,GAAgBtG,EAAM1P,YAAc8V,EAAShW,aAAe4P,EAAM5P,YAGtE,IAA4B,OAAxBgW,EAAS9V,YAAuB8V,EAAS9V,WAAagW,EAAe,CAGvE,GAA4B,OAAxBF,EAAS9V,aACX4V,EAAOE,EAAS9V,YAAYyG,OAAO1P,EAAQuB,KAAKsd,EAAOE,EAAS9V,YAAa8V,GAAW,GAG9C,GAAtCF,EAAOE,EAAS9V,YAAYnJ,QAC9B,KAAM,IAAIU,OAAM,kCAGpBue,GAAS9V,WAAagW,EAGxBL,EAAYG,EAAUtc,EAAQoc,MAIlC,QAAS5P,GAAKrN,EAAMsd,EAAYzc,GAE9B,IAAIyc,EAAW/V,OAAf,CAGA+V,EAAWjW,WAAa,CAExB,IAAI4V,KAEJD,GAAYM,EAAYzc,EAAQoc,EAGhC,KAAK,GADDM,KAAwBD,EAAWnW,aAAe8V,EAAO/e,OAAS,EAC7DD,EAAIgf,EAAO/e,OAAS,EAAGD,GAAK,EAAGA,IAAK,CAE3C,IAAK,GADDsD,GAAQ0b,EAAOhf,GACViP,EAAI,EAAGA,EAAI3L,EAAMrD,OAAQgP,IAAK,CACrC,GAAI6J,GAAQxV,EAAM2L,EAGdqQ,GACFC,EAAsBzG,EAAOlW,GAE7B4c,EAAkB1G,EAAOlW,GAE7B0c,GAAuBA,IAK3B,QAASG,MAOT,QAASC,GAAwB3d,EAAMT,GACrC,MAAOA,GAAcS,KAAUT,EAAcS,IAC3CA,KAAMA,EACN0K,gBACA5I,QAAS,GAAI4b,GACbE,eAIJ,QAASJ,GAAsBzG,EAAOlW,GAEpC,IAAIkW,EAAMxP,OAAV,CAGA,GAAIhI,GAAgBsB,EAAO3B,QAAQK,cAC/BgI,EAASwP,EAAMxP,OAASoW,EAAwB5G,EAAM/W,KAAMT,GAC5DuC,EAAUiV,EAAMxP,OAAOzF,QAEvB+b,EAAc9G,EAAM/P,QAAQrH,KAAKpC,EAAU,SAASyC,EAAMmC,GAG5D,GAFAoF,EAAOuW,QAAS,EAEG,gBAAR9d,GACT,IAAK,GAAIjD,KAAKiD,GACZ8B,EAAQ/E,GAAKiD,EAAKjD,OAGpB+E,GAAQ9B,GAAQmC,CAGlB,KAAK,GAAIlE,GAAI,EAAG0D,EAAI4F,EAAOqW,UAAU1f,OAAQD,EAAI0D,EAAG1D,IAAK,CACvD,GAAI8f,GAAiBxW,EAAOqW,UAAU3f,EACtC,KAAK8f,EAAeD,OAAQ,CAC1B,GAAIE,GAAgB5f,EAAQuB,KAAKoe,EAAerT,aAAcnD,GAC1D0W,EAASF,EAAeG,QAAQF,EAChCC,IACFA,EAAOnc,IAKb,MADAyF,GAAOuW,QAAS,EACT3b,IACJgc,GAAIpH,EAAM/W,MAWf,IAT0B,kBAAf6d,KACTA,GAAgBK,WAAajX,QAAS4W,IAGxCA,EAAcA,IAAiBK,WAAajX,QAAS,cAErDM,EAAO2W,QAAUL,EAAYK,QAC7B3W,EAAON,QAAU4W,EAAY5W,SAExBM,EAAO2W,UAAY3W,EAAON,QAC7B,KAAM,IAAIvL,WAAU,oCAAsCqb,EAAM/W,KAIlE,KAAK,GAAI/B,GAAI,EAAG0D,EAAIoV,EAAM3P,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAKImgB,GALAlB,EAAUnG,EAAM3P,eAAenJ,GAC/Bkf,EAAWtc,EAAOuc,QAAQF,GAC1BmB,EAAY9e,EAAc2d,EAK1BmB,GACFD,EAAaC,EAAUvc,QAGhBqb,IAAaA,EAAShW,YAC7BiX,EAAajB,EAASpb,SAGdob,GAKRK,EAAsBL,EAAUtc,GAChCwd,EAAYlB,EAAS5V,OACrB6W,EAAaC,EAAUvc,SANvBsc,EAAavd,EAAOpB,IAAIyd,GAUtBmB,GAAaA,EAAUT,WACzBS,EAAUT,UAAU3gB,KAAKsK,GACzBA,EAAOmD,aAAazN,KAAKohB,IAGzB9W,EAAOmD,aAAazN,KAAK,KAK3B,KAAK,GADD8J,GAAkBgQ,EAAMhQ,gBAAgB9I,GACnCiP,EAAI,EAAGoR,EAAMvX,EAAgB7I,OAAQgP,EAAIoR,IAAOpR,EAAG,CAC1D,GAAItL,GAAQmF,EAAgBmG,EACxB3F,GAAO2W,QAAQtc,IACjB2F,EAAO2W,QAAQtc,GAAOwc,MAO9B,QAASG,GAAUve,EAAMa,GACvB,GAAIiB,GACAiV,EAAQlW,EAAOuc,QAAQpd,EAE3B,IAAK+W,EAOCA,EAAM5P,YACRqX,EAAgBxe,EAAM+W,KAAWlW,GAEzBkW,EAAMzP,WACdmW,EAAkB1G,EAAOlW,GAE3BiB,EAAUiV,EAAMxP,OAAOzF,YAXvB,IADAA,EAAUjB,EAAOpB,IAAIO,IAChB8B,EACH,KAAM,IAAIlD,OAAM,6BAA+BoB,EAAO,IAa1D,SAAM+W,GAASA,EAAM5P,cAAgBrF,GAAWA,EAAQ+P,aAC/C/P,EAAiB,QAEnBA,EAGT,QAAS2b,GAAkB1G,EAAOlW,GAChC,IAAIkW,EAAMxP,OAAV,CAGA,GAAIzF,MAEAyF,EAASwP,EAAMxP,QAAWzF,QAASA,EAASqc,GAAIpH,EAAM/W,KAG1D,KAAK+W,EAAM7P,iBACT,IAAK,GAAIjJ,GAAI,EAAG0D,EAAIoV,EAAM3P,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAAIif,GAAUnG,EAAM3P,eAAenJ,GAE/Bkf,EAAWtc,EAAOuc,QAAQF,EAC1BC,IACFM,EAAkBN,EAAUtc,GAKlCkW,EAAMzP,WAAY,CAClB,IAAIxK,GAASia,EAAM9P,QAAQtH,KAAKpC,EAAU,SAASyC,GACjD,IAAK,GAAI/B,GAAI,EAAG0D,EAAIoV,EAAMvV,KAAKtD,OAAQD,EAAI0D,EAAG1D,IAC5C,GAAI8Y,EAAMvV,KAAKvD,IAAM+B,EAErB,MAAOue,GAAUxH,EAAM3P,eAAenJ,GAAI4C,EAG5C,IAAI4d,GAAiB5d,EAAO0Y,cAAcvZ,EAAM+W,EAAM/W,KACtD,IAAI5B,EAAQuB,KAAKoX,EAAM3P,eAAgBqX,KAAmB,EACxD,MAAOF,GAAUE,EAAgB5d,EAEnC,MAAM,IAAIjC,OAAM,UAAYoB,EAAO,oCAAsC+W,EAAM/W,OAC9E8B,EAASyF,EAEG9K,UAAXK,IACFyK,EAAOzF,QAAUhF,GAGnBgF,EAAUyF,EAAOzF,QAGbA,IAAYA,EAAQ4c,YAAc5c,YAAmB/C,IACvDgY,EAAMhV,SAAWlB,EAAOsE,UAAUrD,GAE3BiV,EAAMvP,YAAc1F,IAAYvE,EACvCwZ,EAAMhV,SAAWlB,EAAOsE,UAAUtD,EAAYC,IAG9CiV,EAAMhV,SAAWlB,EAAOsE,WAAYO,QAAW5D,EAAS+P,cAAc,KAY1E,QAAS2M,GAAgBxT,EAAY+L,EAAO4H,EAAM9d,GAEhD,GAAKkW,IAASA,EAAMzP,WAAcyP,EAAM5P,YAAxC,CAKAwX,EAAK1hB,KAAK+N,EAEV,KAAK,GAAI/M,GAAI,EAAG0D,EAAIoV,EAAM3P,eAAelJ,OAAQD,EAAI0D,EAAG1D,IAAK,CAC3D,GAAIif,GAAUnG,EAAM3P,eAAenJ,EAC/BG,GAAQuB,KAAKgf,EAAMzB,KAAY,IAC5Brc,EAAOuc,QAAQF,GAGlBsB,EAAgBtB,EAASrc,EAAOuc,QAAQF,GAAUyB,EAAM9d,GAFxDA,EAAOpB,IAAIyd,IAMbnG,EAAMzP,YAGVyP,EAAMzP,WAAY,EAClByP,EAAMxP,OAAON,QAAQtH,KAAKpC,KAvX5BmC,EAAeO,UAAU0V,SAAW,SAAS3V,EAAMwB,EAAMwF,GASvD,GARmB,gBAARhH,KACTgH,EAAUxF,EACVA,EAAOxB,EACPA,EAAO,MAKa,iBAAXgH,GACT,MAAO7J,MAAKyhB,gBAAgBxJ,MAAMjY,KAAMkY,UAE1C,IAAI0B,GAAQjQ,GAIZiQ,GAAM/W,KAAOA,IAAS7C,KAAKya,gBAAkBza,KAAKqL,WAAW7I,KAAKxC,KAAM6C,GACxE+W,EAAM5P,aAAc,EACpB4P,EAAMvV,KAAOA,EACbuV,EAAM/P,QAAUA,EAEhB7J,KAAK0hB,eACHC,KAAK,EACL/H,MAAOA,KAGXrX,EAAeO,UAAU2e,gBAAkB,SAAS5e,EAAMwB,EAAMwF,EAASC,GACpD,gBAARjH,KACTiH,EAAUD,EACVA,EAAUxF,EACVA,EAAOxB,EACPA,EAAO,KAIT,IAAI+W,GAAQjQ,GACZiQ,GAAM/W,KAAOA,IAAS7C,KAAKya,gBAAkBza,KAAKqL,WAAW7I,KAAKxC,KAAM6C,GACxE+W,EAAMvV,KAAOA,EACbuV,EAAM9P,QAAUA,EAChB8P,EAAM7P,iBAAmBF,EAEzB7J,KAAK0hB,eACHC,KAAK,EACL/H,MAAOA,KAGXhX,EAAK,kBAAmB,WACtB,MAAO,UAAS4I,EAAMgN,GACpB,GAAKA,EAAL,CAGA,GAAIoB,GAAQpB,EAASoB,MACjBgI,EAAUpW,GAAQA,EAAKgC,QAW3B,IARIoM,EAAM/W,OACF+W,EAAM/W,OAAQ7C,MAAKigB,UACvBjgB,KAAKigB,QAAQrG,EAAM/W,MAAQ+W,GAEzBgI,IACFA,EAAQ7G,QAAS,KAGhBnB,EAAM/W,MAAQ2I,IAASoW,EAAQhI,OAASA,EAAM/W,MAAQ2I,EAAK3I,KAAM,CACpE,IAAK+e,EACH,KAAM,IAAIrjB,WAAU,+IACtB,IAAIqjB,EAAQhI,MACV,KAAsB,YAAlBgI,EAAQ1K,OACJ,GAAIzV,OAAM,sDAAwD+J,EAAK3I,KAAO,0EAE9E,GAAIpB,OAAM,UAAY+J,EAAK3I,KAAO,mBAAqB+e,EAAQ1K,OAAS,8CAE7E0K,GAAQ1K,SACX0K,EAAQ1K,OAAS,YACnB0K,EAAQhI,MAAQA,OAKtB7W,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MAEjBA,KAAKigB,WACLjgB,KAAK+B,QAAQK,oBAuEjBC,EAAeke,EAAc,YAC3Bvb,MAAO,WACL,MAAO,YA8NXpC,EAAK,SAAU,SAASif,GACtB,MAAO,UAAShf,GAGd,aAFO7C,MAAK+B,QAAQK,cAAcS,SAC3B7C,MAAKigB,QAAQpd,GACbgf,EAAIrf,KAAKxC,KAAM6C,MAI1BD,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,MAAIxL,MAAKigB,QAAQzU,EAAK3I,OACpB2I,EAAKgC,SAAS0J,OAAS,UAChB,KAGT1L,EAAKgC,SAASnJ,KAAOmH,EAAKgC,SAASnJ,SAE5BqK,EAAMlM,KAAKxC,KAAMwL,OAI5B5I,EAAK,YAAa,SAAS+L,GAEzB,MAAO,UAASnD,GAEd,MADAA,GAAKgC,SAASnJ,KAAOmH,EAAKgC,SAASnJ,SAC5BwH,QAAQC,QAAQ6C,EAAUsJ,MAAMjY,KAAMkY,YAAY5M,KAAK,SAAS9B,GAIrE,OAF4B,YAAxBgC,EAAKgC,SAAS0J,SAAyB1L,EAAKgC,SAAS0J,QAAU3N,EAAqBiC,EAAKhC,WAC3FgC,EAAKgC,SAAS0J,OAAS,YAClB1N,OAMb5G,EAAK,OAAQ,SAASkf,GACpB,MAAO,UAAShH,GACd,GAAIpX,GAAS1D,KACT4Z,EAAQlW,EAAOuc,QAAQnF,EAE3B,QAAKlB,GAASA,EAAMvV,KAAKtD,OAChB+gB,EAAO7J,MAAMjY,KAAMkY,YAE5B0B,EAAMhQ,gBAAkBgQ,EAAM3P,kBAI9BiG,EAAK4K,EAAYlB,EAAOlW,GAGxB2d,EAAgBvG,EAAYlB,KAAWlW,GAClCkW,EAAMhV,WACTgV,EAAMhV,SAAWlB,EAAOsE,UAAU4R,EAAMxP,OAAOzF,UAG5CjB,EAAOmN,QACVnN,EAAOuc,QAAQnF,GAAcxb,QAG/BoE,EAAOoE,IAAIgT,EAAYlB,EAAMhV,UAEtBiH,QAAQC,cAInBlJ,EAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACc,UAAxBA,EAAKgC,SAAS0J,SAChB1L,EAAKgC,SAAS0J,OAAS5X,QAIzBsP,EAAYpM,KAAKxC,KAAMwL,EAEvB,IAEIoO,GAFAlW,EAAS1D,IAKb,IAAI0D,EAAOuc,QAAQzU,EAAK3I,MACtB+W,EAAQlW,EAAOuc,QAAQzU,EAAK3I,MAEvB+W,EAAM5P,cACT4P,EAAMvV,KAAOuV,EAAMvV,KAAKwB,OAAO2F,EAAKgC,SAASnJ,OAC/CuV,EAAMvV,KAAOuV,EAAMvV,KAAKwB,OAAO2F,EAAKgC,SAASnJ,UAK1C,IAAImH,EAAKgC,SAASoM,MACrBA,EAAQpO,EAAKgC,SAASoM,MACtBA,EAAMvV,KAAOuV,EAAMvV,KAAKwB,OAAO2F,EAAKgC,SAASnJ,UAK1C,MAAMX,EAAOqF,SAAWyC,EAAKgC,SAASuN,QACX,YAAxBvP,EAAKgC,SAAS0J,QAAgD,OAAxB1L,EAAKgC,SAAS0J,QAA2C,OAAxB1L,EAAKgC,SAAS0J,QAAkB,CAK7G,GAHqB,mBAAVX,KACTA,GAAO/T,KAAKkB,EAAQ8H,IAEjBA,EAAKgC,SAASoM,QAAUpO,EAAKgC,SAASuN,OACzC,KAAM,IAAItZ,OAAM+J,EAAK3I,KAAO,gBAAkB2I,EAAKgC,SAAS0J,OAAS,uBAEvE0C,GAAQpO,EAAKgC,SAASoM,MAGlBA,GAASpO,EAAKgC,SAASnJ,OACzBuV,EAAMvV,KAAOuV,EAAMvV,KAAKwB,OAAO2F,EAAKgC,SAASnJ,OAI5CuV,IACHA,EAAQjQ,IACRiQ,EAAMvV,KAAOmH,EAAKgC,SAASnJ,KAC3BuV,EAAM9P,QAAU,cAIlBpG,EAAOuc,QAAQzU,EAAK3I,MAAQ+W,CAE5B,IAAImI,GAAU3d,EAAMwV,EAAMvV,KAE1BuV,GAAMvV,KAAO0d,EAAQzd,MACrBsV,EAAMhQ,gBAAkBmY,EAAQxd,QAChCqV,EAAM/W,KAAO2I,EAAK3I,KAClB+W,EAAMvP,WAAamB,EAAKgC,SAASnD,cAAe,CAIhD,KAAK,GADD2X,MACKlhB,EAAI,EAAG0D,EAAIoV,EAAMvV,KAAKtD,OAAQD,EAAI0D,EAAG1D,IAC5CkhB,EAAkBliB,KAAK+L,QAAQC,QAAQpI,EAAO2H,UAAUuO,EAAMvV,KAAKvD,GAAI0K,EAAK3I,OAE9E,OAAOgJ,SAAQsD,IAAI6S,GAAmB1W,KAAK,SAASrB,GAIlD,MAFA2P,GAAM3P,eAAiBA,GAGrB5F,KAAMuV,EAAMvV,KACZyF,QAAS,WAgBP,MAbAoG,GAAK1E,EAAK3I,KAAM+W,EAAOlW,GAGvB2d,EAAgB7V,EAAK3I,KAAM+W,KAAWlW,GAEjCkW,EAAMhV,WACTgV,EAAMhV,SAAWlB,EAAOsE,UAAU4R,EAAMxP,OAAOzF,UAG5CjB,EAAOmN,QACVnN,EAAOuc,QAAQzU,EAAK3I,MAAQvD,QAGvBsa,EAAMhV,mBAUzB,WAEE,GAAIqd,GAAW,gLAEXC,EAAsB,wBACtBC,EAAoB,mBAExBvf,GAAK,YAAa,SAAS+L,GACzB,MAAO,UAASnD,GACd,GAAI9H,GAAS1D,KACToiB,EAAOlK,SACX,OAAOvJ,GAAUsJ,MAAMvU,EAAQ0e,GAC9B9W,KAAK,SAAS9B,GAEb,GAA4B,OAAxBgC,EAAKgC,SAAS0J,QAA2C,OAAxB1L,EAAKgC,SAAS0J,SAAoB1L,EAAKgC,SAAS0J,QAAU1N,EAAO7K,MAAMsjB,GAAW,CAMrH,GAL4B,OAAxBzW,EAAKgC,SAAS0J,QAChBzQ,EAAKjE,KAAKkB,EAAQ,UAAY8H,EAAK3I,KAAO,qGAE5C2I,EAAKgC,SAAS0J,OAAS,MAEnB1L,EAAKgC,SAASnJ,KAAM,CAEtB,IAAK,GADDge,GAAY,GACPvhB,EAAI,EAAGA,EAAI0K,EAAKgC,SAASnJ,KAAKtD,OAAQD,IAC7CuhB,GAAa,WAAa7W,EAAKgC,SAASnJ,KAAKvD,GAAK,KACpD0K,GAAKhC,OAAS6Y,EAAY7Y,EAG5B,GAAI9F,EAAO8Q,cAAe,EAAO,CAE/B,GAAI9Q,EAAOqF,QACT,MAAOS,EACT,MAAM,IAAIjL,WAAU,kFAUtB,MALAmF,GAAO3B,QAAQugB,iBAAmB5e,EAAO3B,QAAQugB,mBAAoB,EACjE5e,EAAO+Q,eACT/Q,EAAO+Q,aAAa1S,QAAQugB,iBAAmB5e,EAAO3B,QAAQugB,mBAAoB,IAG5E5e,EAAO3B,QAAQwgB,oBACrB7e,EAAO3B,QAAQwgB,kBAAoB1W,QAAQC,QACzC1L,EAA8B,cAArBsD,EAAO8Q,WAA6B,KAAO9Q,EAAO8Q,cAAgB9Q,EAAO+Q,cAAgB/Q,GAAgB,OAAEA,EAAO8Q,eAC3HlJ,KAAK,SAASkJ,GAIhB,MAHA9Q,GAAO3B,QAAQqY,yBAA0B,EAGrC5F,EAAW7F,UAET6F,GAAchJ,EAAKgC,SAASgV,aACvBhX,EAAKhC,QAGwB,gBAA3BgC,GAAKgC,SAAS+H,YACvB/J,EAAKgC,SAAS+H,UAAY4B,KAAK0C,MAAMrO,EAAKgC,SAAS+H,YAE9C1J,QAAQC,QAAQ0I,EAAW7F,UAAUsJ,MAAMvU,EAAQ0e,IACzD9W,KAAK,SAAS9B,GAEb,GAAI+L,GAAY/J,EAAKgC,SAAS+H,SAC9B,IAAIA,GAAiC,gBAAbA,GAAuB,CAC7C,GAAIkN,GAAejX,EAAKoC,QAAQhN,MAAM,KAAK,EAGtC2U,GAAUmN,MAAQnN,EAAUmN,MAAQlX,EAAKoC,UAC5C2H,EAAUmN,KAAOD,EAAe,iBAG7BlN,EAAUoN,SAAWpN,EAAUoN,QAAQ5hB,QAAU,KAAOwU,EAAUoN,QAAQ,IAAMpN,EAAUoN,QAAQ,IAAMnX,EAAKoC,YAChH2H,EAAUoN,SAAWF,IAKzB,MAF4B,OAAxBjX,EAAKgC,SAAS0J,SAAoBxT,EAAOqF,SAAWQ,EAAqBC,KAC3EgC,EAAKgC,SAAS0J,OAAS,YAClB1N,MAKP9F,EAAOqF,UACTyC,EAAKgC,SAASoV,eAAiBpX,EAAKhC,QAG/B+K,EAAU/R,KAAKkB,EAAQ8H,GAC7BF,KAAK,SAAS9B,GAGb,MADAgC,GAAKgC,SAAS+H,UAAYjW,OACnBkK,MAER,SAASlJ,GACV,KAAMD,GAAWC,EAAK,0CAA4CkL,EAAK3I,QAK3E,GAAIa,EAAO8Q,cAAe,EACxB,MAAOhL,EA+BT,IA5BI9F,EAAO3B,QAAQugB,oBAAqB,GAA+B,WAArB5e,EAAO8Q,YAAgD,cAArB9Q,EAAO8Q,YAAmD,SAArB9Q,EAAO8Q,YACzHhJ,EAAK3I,MAAQa,EAAO0Y,cAAc1Y,EAAO8Q,cAG1ChL,EAAOzI,OAAS,MAAQyK,EAAKgC,SAAS0J,SACxC1L,EAAKgC,SAAS0J,OAAS,SAEG,YAAtBxT,EAAO8Q,aACThJ,EAAKgC,SAAS7I,QAAU,WACA,eAAtBjB,EAAO8Q,aACThJ,EAAKgC,SAAS7I,QAAU,OAG5BjB,EAAO3B,QAAQugB,kBAAmB,GAIhC5e,EAAO3B,QAAQqY,2BAA4B,IACzC5O,EAAK3I,MAAQa,EAAO0Y,cAAc,oBAC/B5Q,EAAK3I,MAAQa,EAAO0Y,cAAc,6BACnC5S,EAAOzI,OAAS,MAClByK,EAAKgC,SAAS0J,OAAS1L,EAAKgC,SAAS0J,QAAU,UAEjDxT,EAAO3B,QAAQqY,yBAA0B,KAKhB,YAAxB5O,EAAKgC,SAAS0J,QAAwB1L,EAAKgC,SAASuN,SAAWrX,EAAO3B,QAAQqY,2BAA4B,EAAM,CACnH,GAAyB,WAArB1W,EAAO8Q,aAA4BpU,EAASyiB,iBAAmBrX,EAAKhC,OAAO7K,MAAMujB,GAEnF,MADAxe,GAAO3B,QAAQqY,wBAA0B1W,EAAO3B,QAAQqY,0BAA2B,EAC5E1W,EAAe,OAAE,mBAAmB4H,KAAK,WAC9C,MAAO9B,IAGX,IAAyB,SAArB9F,EAAO8Q,aAA0BpU,EAAS0iB,cAAgBtX,EAAKhC,OAAO7K,MAAMwjB,GAE9E,MADAze,GAAO3B,QAAQqY,wBAA0B1W,EAAO3B,QAAQqY,0BAA2B,EAC5E1W,EAAe,OAAE,0BAA0B4H,KAAK,WACrD,MAAO9B,KAKb,MAAOA,UAgBf,IAAIuZ,IAA8B,mBAAR5iB,MAAsB,OAAS,QAEzDyC,GAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GAGd,MAFIA,GAAKgC,SAAS7I,UAAY6G,EAAKgC,SAAS0J,SAC1C1L,EAAKgC,SAAS0J,OAAS,UAClBxI,EAAMlM,KAAKxC,KAAMwL,MAQ5B5I,EAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACd,GAAI9H,GAAS1D,IAMb,IAJKwL,EAAKgC,SAAS0J,SACjB1L,EAAKgC,SAAS0J,OAAS,UAGG,UAAxB1L,EAAKgC,SAAS0J,SAAuB1L,EAAKgC,SAASoM,MAAO,CAE5D,GAAIA,GAAQjQ,GAEZ6B,GAAKgC,SAASoM,MAAQA,EAEtBA,EAAMvV,OAEN,KAAK,GAAI2e,KAAKxX,GAAKgC,SAASyV,QAAS,CACnC,GAAIC,GAAK1X,EAAKgC,SAASyV,QAAQD,EAC3BE,IACFtJ,EAAMvV,KAAKvE,KAAKojB,GAGpBtJ,EAAM9P,QAAU,SAASnB,EAAShE,EAASyF,GAEzC,GAAI6Y,EACJ,IAAIzX,EAAKgC,SAASyV,QAAS,CACzBA,IACA,KAAK,GAAID,KAAKxX,GAAKgC,SAASyV,QACtBzX,EAAKgC,SAASyV,QAAQD,KACxBC,EAAQD,GAAKra,EAAQ6C,EAAKgC,SAASyV,QAAQD,KAGjD,GAAIG,GAAa3X,EAAKgC,SAAS7I,OAE3Bwe,KACF3X,EAAKhC,QAAU,KAAOuZ,GAAe,KAAOI,EAAa,QAAUA,EAAa,IAElF,IAAIC,GAAiB1f,EAAOpB,IAAI,oBAAoB+gB,cAAcjZ,EAAO4W,GAAImC,EAAYF,IAAWzX,EAAKgC,SAAS8V,kBAGlH,OAFA/M,IAAO/T,KAAKkB,EAAQ8H,GAEb4X,KAGX,MAAOxU,GAAYpM,KAAKxC,KAAMwL,MAyBlC5I,EAAK,kBAAmB,SAAS2gB,GAC/B,MAAO,UAAS/X,EAAMgN,GACpB,GAAIA,IAAchN,EAAKgC,SAAS7I,WAAauH,GAAoC,UAAxBV,EAAKgC,SAAS0J,QACrE,MAAOqM,GAAe/gB,KAAKxC,KAAMwL,EAAMgN,EAEzChN,GAAKgC,SAAS0J,OAAS,QACvB,IAAI0C,GAAQpO,EAAKgC,SAASoM,MAAQjQ,GAClCiQ,GAAMvV,KAAOmH,EAAKgC,SAASnJ,IAC3B,IAAIkG,GAAcD,EAAekB,EAAKgC,SAAS7I,QAC/CiV,GAAM9P,QAAU,WACd,MAAOS,OAKbxH,EAAgB,SAASsO,GACvB,MAAO,YAYL,QAASmS,GAAcC,GACrB,GAAIpe,OAAOqe,KACTre,OAAOqe,KAAKtjB,GAAU2Q,QAAQ0S,OAE9B,KAAK,GAAIT,KAAK5iB,GACP2D,EAAevB,KAAKpC,EAAU4iB,IAEnCS,EAAST,GAIf,QAASW,GAAmBF,GAC1BD,EAAc,SAASI,GACrB,GAAI3iB,EAAQuB,KAAKqhB,EAAoBD,KAAe,EAApD,CAEA,IACE,GAAI5e,GAAQ5E,EAASwjB,GAEvB,MAAOjX,GACLkX,EAAmB/jB,KAAK8jB,GAE1BH,EAASG,EAAY5e,MAhCzB,GAAItB,GAAS1D,IACbqR,GAAY7O,KAAKkB,EAEjB,IAMIogB,GANA/f,EAAiBsB,OAAOvC,UAAUiB,eAGlC8f,GAAsB,KAAM,iBAAkB,eAAgB,gBAAiB,SAAU,eAAgB,WAC3G,wBAAyB,oBAAqB,kBAAmB,kBAAmB,kBA6BtFngB,GAAOoE,IAAI,mBAAoBpE,EAAOsE,WACpCqb,cAAe,SAASxV,EAAYlJ,EAASse,EAASc,GAEpD,GAAIC,GAAY5jB,EAASkR,MAEzBlR,GAASkR,OAAShS,MAGlB,IAAI2kB,EACJ,IAAIhB,EAAS,CACXgB,IACA,KAAK,GAAIjB,KAAKC,GACZgB,EAAWjB,GAAK5iB,EAAS4iB,GACzB5iB,EAAS4iB,GAAKC,EAAQD,GAc1B,MATKre,KACHmf,KAEAH,EAAmB,SAAS9gB,EAAMmC,GAChC8e,EAAejhB,GAAQmC,KAKpB,WACL,GAEIkf,GAFA3Z,EAAc5F,EAAU2F,EAAe3F,MAGvCwf,IAAoBxf,CA6BxB,IA3BKA,IAAWof,GACdJ,EAAmB,SAAS9gB,EAAMmC,GAC5B8e,EAAejhB,KAAUmC,GAET,mBAATA,KAIP+e,IACF3jB,EAASyC,GAAQvD,QAEdqF,IACH4F,EAAY1H,GAAQmC,EAEO,mBAAhBkf,GACJC,GAAmBD,IAAiBlf,IACvCmf,GAAkB,GAGpBD,EAAelf,MAKvBuF,EAAc4Z,EAAkB5Z,EAAc2Z,EAG1CD,EACF,IAAK,GAAIjB,KAAKiB,GACZ7jB,EAAS4iB,GAAKiB,EAAWjB,EAI7B,OAFA5iB,GAASkR,OAAS0S,EAEXzZ,UASjB,WAaE,QAAS6Z,GAAW5a,GAUlB,QAAS6a,GAAWC,EAAW3lB,GAC7B,IAAK,GAAImC,GAAI,EAAGA,EAAIwjB,EAAUvjB,OAAQD,IACpC,GAAIwjB,EAAUxjB,GAAG,GAAKnC,EAAM8F,OAAS6f,EAAUxjB,GAAG,GAAKnC,EAAM8F,MAC3D,OAAO,CACX,QAAO,EAbT8f,EAAgBC,UAAYC,EAAaD,UAAYE,EAAYF,UAAY,CAE7E,IAEI7lB,GAFA0F,KAKAsgB,KAAsBC,IAS1B,IAAIpb,EAAOzI,OAASyI,EAAO5I,MAAM,MAAMG,OAAS,IAAK,CACnD,KAAOpC,EAAQ+lB,EAAY7R,KAAKrJ,IAC9Bmb,EAAgB7kB,MAAMnB,EAAM8F,MAAO9F,EAAM8F,MAAQ9F,EAAM,GAAGoC,QAI5D,MAAOpC,EAAQ8lB,EAAa5R,KAAKrJ,IAE1B6a,EAAWM,EAAiBhmB,IAC/BimB,EAAiB9kB,MAAMnB,EAAM8F,MAAQ9F,EAAM,GAAGoC,OAAQpC,EAAM8F,MAAQ9F,EAAM,GAAGoC,OAAS,IAI5F,KAAOpC,EAAQ4lB,EAAgB1R,KAAKrJ,IAElC,IAAK6a,EAAWM,EAAiBhmB,KAAW0lB,EAAWO,EAAkBjmB,GAAQ,CAC/E,GAAI6R,GAAM7R,EAAM,GAAGyC,OAAO,EAAGzC,EAAM,GAAGoC,OAAS,EAE/C,IAAIyP,EAAI7R,MAAM,OACZ,QAEyB,MAAvB6R,EAAIA,EAAIzP,OAAS,KACnByP,EAAMA,EAAIpP,OAAO,EAAGoP,EAAIzP,OAAS,IACnCsD,EAAKvE,KAAK0Q,GAId,MAAOnM,GAtDT,GAAIwgB,GAAkB,8HAElBN,EAAkB,iHAClBE,EAAe,oDAEfC,EAAc,mEAGdI,EAAgB,SAiDpBliB,GAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACd,GAAI9H,GAAS1D,IAQb,IAPKwL,EAAKgC,SAAS0J,SACjB2N,EAAgBL,UAAY,EAC5BD,EAAgBC,UAAY,GACxBD,EAAgB1R,KAAKrH,EAAKhC,SAAWqb,EAAgBhS,KAAKrH,EAAKhC,WACjEgC,EAAKgC,SAAS0J,OAAS,QAGC,OAAxB1L,EAAKgC,SAAS0J,OAAiB,CACjC,GAAI6N,GAAWvZ,EAAKgC,SAASnJ,KACzBA,EAAOmH,EAAKgC,SAASwX,uBAAwB,KAAaZ,EAAW5Y,EAAKhC,OAE9E,KAAK,GAAIwZ,KAAKxX,GAAKgC,SAASyV,QACtBzX,EAAKgC,SAASyV,QAAQD,IACxB3e,EAAKvE,KAAK0L,EAAKgC,SAASyV,QAAQD,GAEpC,IAAIpJ,GAAQjQ,GAEZ6B,GAAKgC,SAASoM,MAAQA,EAEtBA,EAAMvV,KAAOA,EACbuV,EAAM7P,kBAAmB,EACzB6P,EAAM9P,QAAU,SAASmb,EAAUtgB,EAASyF,GAC1C,QAASzB,GAAQ9F,GAGf,MAF6B,KAAzBA,EAAKA,EAAK9B,OAAS,KACrB8B,EAAOA,EAAKzB,OAAO,EAAGyB,EAAK9B,OAAS,IAC/BkkB,EAAShN,MAAMjY,KAAMkY,WAU9B,GARAvP,EAAQmD,QAAU,SAASjJ,GACzB,MAAOa,GAAOpB,IAAI,iBAAiB4iB,eAAeriB,EAAMuH,EAAO4W,KAGjE5W,EAAO3H,SACP2H,EAAOzB,QAAUsc,GAGZzZ,EAAKgC,SAAS2X,oBACjB,IAAK,GAAIrkB,GAAI,EAAGA,EAAIikB,EAAShkB,OAAQD,IACnC6H,EAAQoc,EAASjkB,GAErB,IAAIskB,GAAW1hB,EAAOpB,IAAI,iBAAiB+iB,YAAYjb,EAAO4W,IAC1DsE,GACF3gB,QAASA,EACTyd,MAAOzZ,EAAShE,EAASyF,EAAQgb,EAAS/P,SAAU+P,EAASG,QAASnlB,EAAUA,IAG9EolB,EAAa,2EAGjB,IAAIha,EAAKgC,SAASyV,QAChB,IAAK,GAAID,KAAKxX,GAAKgC,SAASyV,QAC1BqC,EAAalD,KAAKtiB,KAAK6I,EAAQ6C,EAAKgC,SAASyV,QAAQD,KACrDwC,GAAc,KAAOxC,CAIzB,IAAI1R,GAASlR,EAASkR,MACtBlR,GAASkR,OAAShS,OAClBc,EAASklB,aAAeA,EAExB9Z,EAAKhC,OAASgc,EAAa,MAAQha,EAAKhC,OAAO9K,QAAQomB,EAAe,IAAM,uDAE5EvO,GAAO/T,KAAKkB,EAAQ8H,GAEpBpL,EAASklB,aAAehmB,OACxBc,EAASkR,OAASA,GAItB,MAAO1C,GAAYpM,KAAKkB,EAAQ8H,SAItCzI,EAAgB,SAASsO,GACvB,MAAO,YAOL,QAASoU,GAAYzhB,GACnB,MAAyB,YAArBA,EAAK5C,OAAO,EAAG,GACV4C,EAAK5C,OAAO,IAAME,GAEvBokB,GAAgB1hB,EAAK5C,OAAO,EAAGskB,EAAa3kB,SAAW2kB,EAClD1hB,EAAK5C,OAAOskB,EAAa3kB,QAE3BiD,EAbT,GAAIN,GAAS1D,IAGb,IAFAqR,EAAY7O,KAAKkB,GAEI,mBAAVyI,SAA4C,mBAAZE,WAA2BF,OAAOa,SAC3E,GAAI0Y,GAAe1Y,SAASnO,SAAW,KAAOmO,SAAS/N,UAAY+N,SAAS9N,KAAO,IAAM8N,SAAS9N,KAAO,GAY3GwE,GAAOoE,IAAI,gBAAiBpE,EAAOsE,WACjCkd,eAAgB,SAAShX,EAASyX,GAChC,MAAOF,GAAY/hB,EAAO0Y,cAAclO,EAASyX,KAEnDN,YAAa,SAASO,GAEpB,GACIvQ,GADAwQ,EAAcD,EAASlmB,YAAY,IAGrC2V,GADEwQ,IAAe,EACND,EAASxkB,OAAO,EAAGykB,GAEnBD,CAEb,IAAIL,GAAUlQ,EAASzU,MAAM,IAI7B,OAHA2kB,GAAQ1lB,MACR0lB,EAAUA,EAAQxlB,KAAK,MAGrBsV,SAAUoQ,EAAYpQ,GACtBkQ,QAASE,EAAYF,WAW/B3iB,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GAId,MAFIA,GAAKgC,SAAS6R,YAAche,IAC9BjB,EAASkR,OAAStR,KAAK8lB,WAClBpX,EAAMlM,KAAKxC,KAAMwL,MAI5BzI,EAAgB,SAASsO,GACvB,MAAO,YAYL,QAAS+S,GAAW5a,EAAQuc,GAG1Bvc,EAASA,EAAO9K,QAAQ+lB,EAAc,GAGtC,IAAIuB,GAASxc,EAAO7K,MAAMsnB,GACtBC,GAAgBF,EAAO,GAAGplB,MAAM,KAAKmlB,IAAiB,WAAWrnB,QAAQynB,EAAS,IAGlFC,EAAeC,EAAcH,KAAkBG,EAAcH,GAAgB,GAAIpJ,QAAOwJ,EAAgBJ,EAAeK,EAAgB,KAE3IH,GAAa5B,UAAY,CAKzB,KAHA,GAEI7lB,GAFA0F,KAGG1F,EAAQynB,EAAavT,KAAKrJ,IAC/BnF,EAAKvE,KAAKnB,EAAM,IAAMA,EAAM,GAE9B,OAAO0F,GAOT,QAASsE,GAAQrE,EAAOmf,EAAU+C,EAASC,GAEzC,GAAoB,gBAATniB,MAAuBA,YAAiBsB,QACjD,MAAO+C,GAAQsP,MAAM,KAAMrS,MAAM9C,UAAU6N,OAAOnO,KAAK0V,UAAW,EAAGA,UAAUnX,OAAS,GAK1F,IAFoB,gBAATuD,IAAwC,kBAAZmf,KACrCnf,GAASA,MACPA,YAAiBsB,QAWhB,CAAA,GAAoB,gBAATtB,GAAmB,CACjC,GAAIkW,GAAqB9W,EAAO0V,qBAA4D,OAArC9U,EAAMlD,OAAOkD,EAAMvD,OAAS,EAAG,GAClF+Z,EAAapX,EAAO+W,eAAenW,EAAOmiB,EAC1CjM,IAAqE,OAA/CM,EAAW1Z,OAAO0Z,EAAW/Z,OAAS,EAAG,KACjE+Z,EAAaA,EAAW1Z,OAAO,EAAG0Z,EAAW/Z,OAAS,GACxD,IAAIqJ,GAAS1G,EAAOpB,IAAIwY,EACxB,KAAK1Q,EACH,KAAM,IAAI3I,OAAM,sCAAwC6C,EAAQ,QAAUwW,GAAc2L,EAAU,UAAYA,EAAU,KAAO,KACjI,OAAOrc,GAAOsK,aAAetK,EAAgB,QAAIA,EAIjD,KAAM,IAAI7L,WAAU,mBArBpB,IAAK,GADDmoB,MACK5lB,EAAI,EAAGA,EAAIwD,EAAMvD,OAAQD,IAChC4lB,EAAgB5mB,KAAK4D,EAAe,OAAEY,EAAMxD,GAAI2lB,GAClD5a,SAAQsD,IAAIuX,GAAiBpb,KAAK,SAASpJ,GACrCuhB,GACFA,EAASxL,MAAM,KAAM/V,IACtBskB,GAmBP,QAASlV,GAAOzO,EAAMwB,EAAMsiB,GAuC1B,QAAS7c,GAAQ8c,EAAKjiB,EAASyF,GAiB3B,QAASyc,GAAkBviB,EAAOmf,EAAU+C,GAC1C,MAAoB,gBAATliB,IAAwC,kBAAZmf,GAC9BmD,EAAItiB,GACNqE,EAAQnG,KAAKkB,EAAQY,EAAOmf,EAAU+C,EAASpc,EAAO4W,IAlBjE,IAAK,GADD8F,MACKhmB,EAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/BgmB,EAAUhnB,KAAK8mB,EAAIviB,EAAKvD,IAE1BsJ,GAAO2c,IAAM3c,EAAO4W,GAEpB5W,EAAO4P,OAAS,aAGZgN,IAAe,GACjBF,EAAUnW,OAAOqW,EAAa,EAAG5c,GAE/B6c,IAAgB,GAClBH,EAAUnW,OAAOsW,EAAc,EAAGtiB,GAEhCohB,IAAgB,IAMlBc,EAAkBK,MAAQ,SAASrkB,GAEjC,GAAI2X,GAAqB9W,EAAO0V,qBAA0D,OAAnCvW,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAChF1C,EAAMqF,EAAO+W,eAAe5X,EAAMuH,EAAO4W,GAG7C,OAFIxG,IAAuD,OAAjCnc,EAAI+C,OAAO/C,EAAI0C,OAAS,EAAG,KACnD1C,EAAMA,EAAI+C,OAAO,EAAG/C,EAAI0C,OAAS,IAC5B1C,GAETyoB,EAAUnW,OAAOoV,EAAc,EAAGc,GAIpC,IAAIjI,GAAaxe,EAASuI,OAC1BvI,GAASuI,QAAUA,CAEnB,IAAIhJ,GAASgnB,EAAQ1O,MAAMgP,IAAgB,EAAK7mB,EAAWuE,EAASmiB,EAOpE,IALA1mB,EAASuI,QAAUiW,EAEE,mBAAVjf,IAAyByK,IAClCzK,EAASyK,EAAOzF,SAEG,mBAAVhF,GACT,MAAOA,GAnFQ,gBAARkD,KACT8jB,EAAUtiB,EACVA,EAAOxB,EACPA,EAAO,MAEHwB,YAAgBuB,SACpB+gB,EAAUtiB,EACVA,GAAQ,UAAW,UAAW,UAAUsM,OAAO,EAAGgW,EAAQ5lB,SAGtC,kBAAX4lB,KACTA,EAAU,SAAUA,GAClB,MAAO,YAAa,MAAOA,KAC1BA,IAGyBrnB,SAA1B+E,EAAKA,EAAKtD,OAAS,IACrBsD,EAAKxE,KAGP,IAAIkmB,GAAckB,EAAcD,GAE3BjB,EAAe9kB,EAAQuB,KAAK6B,EAAM,cAAe,IAEpDA,EAAKsM,OAAOoV,EAAc,GAIrBljB,IACHwB,EAAOA,EAAKwB,OAAOue,EAAWuC,EAAQhmB,WAAYolB,OAGjDkB,EAAehmB,EAAQuB,KAAK6B,EAAM,cAAe,GACpDA,EAAKsM,OAAOsW,EAAc,IAEvBD,EAAc/lB,EAAQuB,KAAK6B,EAAM,aAAc,GAClDA,EAAKsM,OAAOqW,EAAa,EAkD3B,IAAIpN,GAAQjQ,GACZiQ,GAAM/W,KAAOA,IAASa,EAAO+W,gBAAkB/W,EAAO2H,WAAW7I,KAAKkB,EAAQb,GAC9E+W,EAAMvV,KAAOA,EACbuV,EAAM9P,QAAUA,EAEhBpG,EAAOge,eACLC,KAAK,EACL/H,MAAOA,IAtKX,GAAIlW,GAAS1D,IACbqR,GAAY7O,KAAKxC,KAEjB,IAAIykB,GAAe,2CACf6B,EAAgB,kCAChBC,EAAiB,6CACjBN,EAAiB,eACjBE,EAAU,aAEVE,IAgKJ/U,GAAOqQ,OAGP/e,EAAK,kBAAmB,SAAS2gB,GAC/B,MAAO,UAAS/X,EAAMgN,GAEpB,IAAKA,IAAaA,EAASmJ,IACzB,MAAO4B,GAAe/gB,KAAKxC,KAAMwL,EAAMgN,EAEzC,IAAIoJ,GAAUpW,GAAQA,EAAKgC,SACvBoM,EAAQpB,EAASoB,KAErB,IAAIgI,EACF,GAAKA,EAAQ1K,QAA4B,UAAlB0K,EAAQ1K,QAE1B,IAAK0C,EAAM/W,MAA0B,OAAlB+e,EAAQ1K,OAC9B,KAAM,IAAIzV,OAAM,qCAAuCmgB,EAAQ1K,OAAS,WAAa1L,EAAK3I,UAF1F+e,GAAQ1K,OAAS,KAMrB,IAAK0C,EAAM/W,KAkBL+e,IACGA,EAAQhI,OAAUgI,EAAQ7G,OAEtB6G,EAAQhI,OAASgI,EAAQhI,MAAM/W,MAAQ+e,EAAQhI,MAAM/W,MAAQ2I,EAAK3I,OACzE+e,EAAQhI,MAAQta,QAFhBsiB,EAAQhI,MAAQA,EAKlBgI,EAAQ7G,QAAS,GAIbnB,EAAM/W,OAAQ7C,MAAKigB,UACvBjgB,KAAKigB,QAAQrG,EAAM/W,MAAQ+W,OA9Bd,CACf,IAAKgI,EACH,KAAM,IAAIrjB,WAAU,mCAEtB,IAAIqjB,EAAQhI,QAAUgI,EAAQhI,MAAM/W,KAClC,KAAM,IAAIpB,OAAM,wCAA0C+J,EAAK3I,KAEjE+e,GAAQhI,MAAQA,MA4BtBlW,EAAOoiB,UAAYxU,EACnB5N,EAAOyjB,WAAaxe,KAKxB,WAIE,GAAIye,GAAW,yRAEfxkB,GAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACd,GAAI9H,GAAS1D,IAEb,IAA4B,OAAxBwL,EAAKgC,SAAS0J,SAAoB1L,EAAKgC,SAAS0J,QAAU1L,EAAKhC,OAAO7K,MAAMyoB,GAG9E,GAFA5b,EAAKgC,SAAS0J,OAAS,MAElBxT,EAAOqF,SAAWrF,EAAOoG,WAAY,EAexC0B,EAAKgC,SAAS1D,QAAU,WACtB,MAAO0B,GAAKgC,SAAS6Z,eAAepP,MAAMjY,KAAMkY,gBAhBH,CAC/C,GAAI8L,GAAY5jB,EAASkR,MACzBlR,GAASkR,OAAStR,KAAK8lB,SAEvB,KACEvP,GAAO/T,KAAKkB,EAAQ8H,GAEtB,QACEpL,EAASkR,OAAS0S,EAGpB,IAAKxY,EAAKgC,SAASoM,QAAUpO,EAAKgC,SAASuN,OACzC,KAAM,IAAIxc,WAAU,cAAgBiN,EAAK3I,KAAO,mBAStD,MAAO+L,GAAYpM,KAAKkB,EAAQ8H,SActC,WACE,QAAS8b,GAAc5jB,EAAQkF,GAE7B,GAAIA,EAAY,CACd,GAAI2e,EACJ,IAAI7jB,EAAO2V,aACT,IAAKkO,EAAoB3e,EAAWlJ,YAAY,QAAS,EACvD,MAAOkJ,GAAWxH,OAAOmmB,EAAoB,OAG/C,KAAKA,EAAoB3e,EAAW3H,QAAQ,QAAS,EACnD,MAAO2H,GAAWxH,OAAO,EAAGmmB,EAGhC,OAAO3e,IAIX,QAAS4e,GAAY9jB,EAAQb,GAC3B,GAAI4kB,GACAC,EAEA7B,EAAchjB,EAAKnD,YAAY,IAEnC,IAAImmB,IAAe,EAYnB,MATIniB,GAAO2V,aACToO,EAAe5kB,EAAKzB,OAAOykB,EAAc,GACzC6B,EAAa7kB,EAAKzB,OAAO,EAAGykB,KAG5B4B,EAAe5kB,EAAKzB,OAAO,EAAGykB,GAC9B6B,EAAa7kB,EAAKzB,OAAOykB,EAAc,IAAM4B,EAAarmB,OAAOqmB,EAAa/nB,YAAY,KAAO,KAIjGioB,SAAUF,EACVG,OAAQF,GAKZ,QAASG,GAAmBnkB,EAAQ+jB,EAAcC,EAAYjM,GAI5D,MAHIA,IAAuE,OAAnDgM,EAAarmB,OAAOqmB,EAAa1mB,OAAS,EAAG,KACnE0mB,EAAeA,EAAarmB,OAAO,EAAGqmB,EAAa1mB,OAAS,IAE1D2C,EAAO2V,YACFqO,EAAa,IAAMD,EAGnBA,EAAe,IAAMC,EAOhC,QAASI,GAAsBpkB,EAAQqkB,GACrC,MAAOrkB,GAAO0V,qBAAwD,OAAjC2O,EAAI3mB,OAAO2mB,EAAIhnB,OAAS,EAAG,GAGlE,QAASinB,GAAoB5L,GAC3B,MAAO,UAASvZ,EAAM+F,EAAYkV,GAChC,GAAIpa,GAAS1D,KAETioB,EAAST,EAAY9jB,EAAQb,EAGjC,IAFA+F,EAAa0e,EAActnB,KAAM4I,IAE5Bqf,EACH,MAAO7L,GAAc5Z,KAAKxC,KAAM6C,EAAM+F,EAAYkV,EAGpD,IAAI2J,GAAe/jB,EAAO0Y,cAAc6L,EAAON,SAAU/e,GAAY,GACjE8e,EAAahkB,EAAO0Y,cAAc6L,EAAOL,OAAQhf,GAAY,EACjE,OAAOif,GAAmBnkB,EAAQ+jB,EAAcC,EAAYI,EAAsBpkB,EAAQukB,EAAON,YAIrG/kB,EAAK,iBAAkBolB,GACvBplB,EAAK,gBAAiBolB,GAEtBplB,EAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAYkV,GAChC,GAAIpa,GAAS1D,IAEb4I,GAAa0e,EAActnB,KAAM4I,EAEjC,IAAIqf,GAAST,EAAY9jB,EAAQb,EAEjC,OAAKolB,GAGEpc,QAAQsD,KACbzL,EAAO2H,UAAU4c,EAAON,SAAU/e,GAAY,GAC9ClF,EAAO2H,UAAU4c,EAAOL,OAAQhf,GAAY,KAE7C0C,KAAK,SAASwP,GACb,MAAO+M,GAAmBnkB,EAAQoX,EAAW,GAAIA,EAAW,GAAIgN,EAAsBpkB,EAAQukB,EAAON,aAP9Ftc,EAAU7I,KAAKkB,EAAQb,EAAM+F,EAAYkV,MAYtDlb,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAKI0c,GALAxkB,EAAS1D,KAET6C,EAAO2I,EAAK3I,IAiBhB,OAbIa,GAAO2V,aACJ6O,EAAoBrlB,EAAK5B,QAAQ,QAAS,IAC7CuK,EAAKgC,SAAS9J,OAASb,EAAKzB,OAAO,EAAG8mB,GACtC1c,EAAK3I,KAAOA,EAAKzB,OAAO8mB,EAAoB,KAIzCA,EAAoBrlB,EAAKnD,YAAY,QAAS,IACjD8L,EAAKgC,SAAS9J,OAASb,EAAKzB,OAAO8mB,EAAoB,GACvD1c,EAAK3I,KAAOA,EAAKzB,OAAO,EAAG8mB,IAIxB1Z,EAAOhM,KAAKkB,EAAQ8H,GAC1BF,KAAK,SAASsC,GACb,MAAIsa,KAAqB,GAAO1c,EAAKgC,SAAS9J,QAKtCA,EAAO+Q,cAAgB/Q,GAAQ2H,UAAUG,EAAKgC,SAAS9J,OAAQ8H,EAAK3I,MAC3EyI,KAAK,SAAS6c,GAEb,MADA3c,GAAKgC,SAAS9J,OAASykB,EAChBva,IAPAA,IAUVtC,KAAK,SAASsC,GACb,GAAIga,GAASpc,EAAKgC,SAAS9J,MAE3B,KAAKkkB,EACH,MAAOha,EAGT,IAAIpC,EAAK3I,MAAQ+kB,EACf,KAAM,IAAInmB,OAAM,UAAYmmB,EAAS,sHAGvC,IAAIlkB,EAAOuc,SAAWvc,EAAOuc,QAAQpd,GACnC,MAAO+K,EAET,IAAI6G,GAAe/Q,EAAO+Q,cAAgB/Q,CAG1C,OAAO+Q,GAAqB,OAAEmT,GAC7Btc,KAAK,SAASkX,GAKb,MAHAhX,GAAKgC,SAASgV,aAAeA,EAE7BhX,EAAKoC,QAAUA,EACX4U,EAAahU,OACRgU,EAAahU,OAAOhM,KAAKkB,EAAQ8H,GAEnCoC,SAMfhL,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,GAAI9H,GAAS1D,IACb,OAAIwL,GAAKgC,SAASgV,cAAgBhX,EAAKgC,SAASgV,aAAa9T,OAAiC,WAAxBlD,EAAKgC,SAAS0J,QAClF1L,EAAKgC,SAAS6R,YAAa,EACpB7T,EAAKgC,SAASgV,aAAa9T,MAAMlM,KAAKkB,EAAQ8H,EAAM,SAASA,GAClE,MAAOkD,GAAMlM,KAAKkB,EAAQ8H,MAIrBkD,EAAMlM,KAAKkB,EAAQ8H,MAKhC5I,EAAK,YAAa,SAAS+L,GACzB,MAAO,UAASnD,GACd,GAAI9H,GAAS1D,KACToiB,EAAOlK,SACX,OAAI1M,GAAKgC,SAASgV,cAAgBhX,EAAKgC,SAASgV,aAAa7T,WAAqC,WAAxBnD,EAAKgC,SAAS0J,OAC/ErL,QAAQC,QAAQN,EAAKgC,SAASgV,aAAa7T,UAAUsJ,MAAMvU,EAAQ0e,IAAO9W,KAAK,SAAS8c,GAC7F,GAAI7S,GAAY/J,EAAKgC,SAAS+H,SAG9B,IAAIA,EAAW,CACb,GAAwB,gBAAbA,GACT,KAAM,IAAI9T,OAAM,oDAElB,IAAIghB,GAAejX,EAAKoC,QAAQhN,MAAM,KAAK,EAGtC2U,GAAUmN,MAAQnN,EAAUmN,MAAQlX,EAAKoC,UAC5C2H,EAAUmN,KAAOD,EAAe,iBAG7BlN,EAAUoN,SAAWpN,EAAUoN,QAAQ5hB,QAAU,KAAOwU,EAAUoN,QAAQ,IAAMpN,EAAUoN,QAAQ,IAAMnX,EAAKoC,YAChH2H,EAAUoN,SAAWF,IASzB,MAHqB,gBAAV2F,KACT5c,EAAKhC,OAAS4e,GAETzZ,EAAUsJ,MAAMvU,EAAQ0e,KAI1BzT,EAAUsJ,MAAMvU,EAAQ0e,MAKrCxf,EAAK,cAAe,SAASgM,GAC3B,MAAO,UAASpD,GACd,GAAI9H,GAAS1D,KACTqoB,GAAoB,CAExB,OAAI7c,GAAKgC,SAASgV,cAAgBhX,EAAKgC,SAASgV,aAAa5T,cAAgBlL,EAAOqF,SAAmC,WAAxByC,EAAKgC,SAAS0J,OACpGrL,QAAQC,QAAQN,EAAKgC,SAASgV,aAAa5T,YAAYpM,KAAKkB,EAAQ8H,EAAM,SAASA,GACxF,GAAI6c,EACF,KAAM,IAAI5mB,OAAM,wCAElB,OADA4mB,IAAoB,EACbzZ,EAAYpM,KAAKkB,EAAQ8H,MAC9BF,KAAK,SAAS8c,GAChB,MAAIC,GACKD,GAEM9oB,SAAX8oB,IACF5c,EAAKgC,SAASoM,MAAQjQ,IACtB6B,EAAKgC,SAASoM,MAAM9P,QAAU,WAC5B,MAAOse,IAET5c,EAAKgC,SAASoM,MAAMvV,KAAOmH,EAAKgC,SAASnJ,KACzCmH,EAAKgC,SAAS0J,OAAS,WAElBtI,EAAYpM,KAAKkB,EAAQ8H,MAG3BoD,EAAYpM,KAAKkB,EAAQ8H,QA6CtC,IAAIT,KAAiB,UAAW,OAAQ,MAAO,QAAS,aAAc,WAuDlEa,GAAqB,aAsDzBhJ,GAAK,YAAa,SAASyI,GACzB,MAAO,UAASxI,EAAM+F,EAAY2Q,GAChC,GAAI7V,GAAS1D,IACb,OAAOgM,GAAmBxJ,KAAKkB,EAAQb,EAAM+F,GAC5C0C,KAAK,SAASzI,GACb,MAAOwI,GAAU7I,KAAKkB,EAAQb,EAAM+F,EAAY2Q,KAEjDjO,KAAK,SAASwP,GACb,MAAOpP,GAAuBlJ,KAAKkB,EAAQoX,EAAYlS,QAY/D,WAEEhG,EAAK,QAAS,SAAS8L,GACrB,MAAO,UAASlD,GACd,GAAI8c,GAAQ9c,EAAKgC,SAAS8a,MACtBC,EAAY/c,EAAKgC,SAASnJ,QAC9B,IAAIikB,EAAO,CACT9c,EAAKgC,SAAS0J,OAAS,SACvB,IAAI0C,GAAQjQ,GAeZ,OAdA3J,MAAKigB,QAAQzU,EAAK3I,MAAQ+W,EAC1BA,EAAM5P,aAAc,EACpB4P,EAAMvV,KAAOkkB,EAAU1iB,QAAQyiB,IAC/B1O,EAAM/P,QAAU,SAAS2e,GACvB,OACEzH,SAAU,SAAS3W,GACjB,IAAK,GAAIxK,KAAKwK,GACZoe,EAAQ5oB,EAAGwK,EAAOxK,GAChBwK,GAAOsK,eACTkF,EAAMxP,OAAOzF,QAAQ+P,cAAe,KAExC5K,QAAS,eAGN,GAGT,MAAO4E,GAAMlM,KAAKxC,KAAMwL,SA8C9B,WA8CE,QAASid,GAAgBvS,EAAQtW,EAAGoF,GAGlC,IAFA,GACI0jB,GADAthB,EAASxH,EAAEgB,MAAM,KAEdwG,EAAOrG,OAAS,GACrB2nB,EAAUthB,EAAOC,QACjB6O,EAASA,EAAOwS,GAAWxS,EAAOwS,MAEpCA,GAAUthB,EAAOC,QACXqhB,IAAWxS,KACfA,EAAOwS,GAAW1jB,GArDtBjC,EAAgB,SAASsO,GACvB,MAAO,YACLrR,KAAKqG,QACLgL,EAAY7O,KAAKxC,SAIrB4C,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAQIkS,GARArX,EAAOrG,KAAKqG,KACZxD,EAAO2I,EAAK3I,KAMZyb,EAAY,CAEhB,KAAK,GAAIlU,KAAU/D,GAEjB,GADAqX,EAAgBtT,EAAOnJ,QAAQ,KAC3Byc,KAAkB,GAElBtT,EAAOhJ,OAAO,EAAGsc,KAAmB7a,EAAKzB,OAAO,EAAGsc,IAChDtT,EAAOhJ,OAAOsc,EAAgB,KAAO7a,EAAKzB,OAAOyB,EAAK9B,OAASqJ,EAAOrJ,OAAS2c,EAAgB,GAAI,CACxG,GAAIiL,GAAQve,EAAOxJ,MAAM,KAAKG,MAC1B4nB,GAAQrK,IACVA,EAAYqK,GACdjjB,EAAW8F,EAAKgC,SAAUnH,EAAK+D,GAASkU,GAAaqK,GAQzD,MAHItiB,GAAKxD,IACP6C,EAAW8F,EAAKgC,SAAUnH,EAAKxD,IAE1B2L,EAAOhM,KAAKxC,KAAMwL,KAM7B,IAAIod,GAAY,uFACZC,EAAgB,uEAcpBjmB,GAAK,YAAa,SAAS+L,GACzB,MAAO,UAASnD,GAEd,GAA4B,WAAxBA,EAAKgC,SAAS0J,OAEhB,MADA1L,GAAKgC,SAASnJ,KAAOmH,EAAKgC,SAASnJ,SAC5BwH,QAAQC,QAAQN,EAAKhC,OAI9B,IAAInD,GAAOmF,EAAKhC,OAAO7K,MAAMiqB,EAC7B,IAAIviB,EAGF,IAAK,GAFDyiB,GAAYziB,EAAK,GAAG1H,MAAMkqB,GAErB/nB,EAAI,EAAGA,EAAIgoB,EAAU/nB,OAAQD,IAAK,CACzC,GAAI4nB,GAAUI,EAAUhoB,GACpBqgB,EAAMuH,EAAQ3nB,OAEdgoB,EAAYL,EAAQtnB,OAAO,EAAG,EAIlC,IAHkC,KAA9BsnB,EAAQtnB,OAAO+f,EAAM,EAAG,IAC1BA,IAEe,KAAb4H,GAAiC,KAAbA,EAAxB,CAGA,GAAIC,GAAaN,EAAQtnB,OAAO,EAAGsnB,EAAQ3nB,OAAS,GAChDkoB,EAAWD,EAAW5nB,OAAO,EAAG4nB,EAAW/nB,QAAQ,KAEvD,IAAIgoB,EAAU,CACZ,GAAIC,GAAYF,EAAW5nB,OAAO6nB,EAASloB,OAAS,EAAGioB,EAAWjoB,OAASkoB,EAASloB,OAAS,EAE9C,OAA3CkoB,EAAS7nB,OAAO6nB,EAASloB,OAAS,EAAG,IACvCkoB,EAAWA,EAAS7nB,OAAO,EAAG6nB,EAASloB,OAAS,GAChDyK,EAAKgC,SAASyb,GAAYzd,EAAKgC,SAASyb,OACxCzd,EAAKgC,SAASyb,GAAUnpB,KAAKopB,IAEtB1d,EAAKgC,SAASyb,YAAqBrjB,QAE1Ca,EAAKjE,KAAKxC,KAAM,UAAYwL,EAAK3I,KAAO,8BAAgCqmB,EAAY,qDAAuDA,EAAY,gCACvJ1d,EAAKgC,SAASyb,GAAUnpB,KAAKopB,IAG7BT,EAAgBjd,EAAKgC,SAAUyb,EAAUC,OAI3C1d,GAAKgC,SAASwb,IAAc,GAKlC,MAAOra,GAAUsJ,MAAMjY,KAAMkY,iBAmBnC,WAMEnV,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MACjBA,KAAKqa,WACLra,KAAK+B,QAAQonB,oBAKjBvmB,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAAI9H,GAAS1D,KACTopB,GAAU,CAEd,MAAM5d,EAAK3I,OAAQa,GAAOuc,SACxB,IAAK,GAAIza,KAAK9B,GAAO2W,QAAS,CAC5B,IAAK,GAAIvZ,GAAI,EAAGA,EAAI4C,EAAO2W,QAAQ7U,GAAGzE,OAAQD,IAAK,CACjD,GAAIuoB,GAAY3lB,EAAO2W,QAAQ7U,GAAG1E,EAElC,IAAIuoB,GAAa7d,EAAK3I,KAAM,CAC1BumB,GAAU,CACV,OAIF,GAAIC,EAAUpoB,QAAQ,OAAQ,EAAI,CAChC,GAAIqoB,GAAQD,EAAUzoB,MAAM,IAC5B,IAAoB,GAAhB0oB,EAAMvoB,OAAa,CACrB2C,EAAO2W,QAAQ7U,GAAGmL,OAAO7P,IAAK,EAC9B,UAGF,GAAI0K,EAAK3I,KAAK0mB,UAAU,EAAGD,EAAM,GAAGvoB,SAAWuoB,EAAM,IACjD9d,EAAK3I,KAAKzB,OAAOoK,EAAK3I,KAAK9B,OAASuoB,EAAM,GAAGvoB,OAAQuoB,EAAM,GAAGvoB,SAAWuoB,EAAM,IAC/E9d,EAAK3I,KAAKzB,OAAOkoB,EAAM,GAAGvoB,OAAQyK,EAAK3I,KAAK9B,OAASuoB,EAAM,GAAGvoB,OAASuoB,EAAM,GAAGvoB,QAAQE,QAAQ,OAAQ,EAAI,CAC9GmoB,GAAU,CACV,SAKN,GAAIA,EACF,MAAO1lB,GAAe,OAAE8B,GACvB8F,KAAK,WACJ,MAAOkD,GAAOhM,KAAKkB,EAAQ8H,KAInC,MAAOgD,GAAOhM,KAAKkB,EAAQ8H,SA0BjC,WACEzI,EAAgB,SAASsO,GACvB,MAAO,YACLA,EAAY7O,KAAKxC,MACjBA,KAAKsG,eAIT1D,EAAK,SAAU,SAAS4L,GACtB,MAAO,UAAShD,GACd,GAAI9H,GAAS1D,KAETqE,EAAOX,EAAO4C,SAASkF,EAAK3I,KAChC,IAAIwB,EACF,IAAK,GAAIvD,GAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/B4C,EAAe,OAAEW,EAAKvD,GAAI0K,EAAK3I,KAEnC,OAAO2L,GAAOhM,KAAKkB,EAAQ8H,SAKjC0G,EAAS,GAAI3P,GAEbnC,EAASqX,SAAWvF,EACpBA,EAAOsX,QAAU,mBACM,gBAAVpf,SAAsBA,OAAOzF,SAA6B,gBAAXA,WACxDyF,OAAOzF,QAAUuN,GAEnB9R,EAAS8R,OAASA,GAEF,mBAAR/R,MAAsBA,KAAOhC,QAGvC,GAAIsrB,GAAgC,mBAAZ5d,QAGxB,IAAwB,mBAAbQ,UAA0B,CACnC,GAAIqd,GAAUrd,SAASS,qBAAqB,SAM5C,IALA9L,aAAe0oB,EAAQA,EAAQ3oB,OAAS,GACpCsL,SAASsd,gBAAkB3oB,aAAa4oB,OAAS5oB,aAAa2e,SAChE3e,aAAeqL,SAASsd,eACrB3oB,aAAaE,MAChBF,aAAe1B,QACbmqB,EAAY,CACd,GAAII,GAAU7oB,aAAaE,IACvB4oB,EAAWD,EAAQzoB,OAAO,EAAGyoB,EAAQnqB,YAAY,KAAO,EAC5DyM,QAAO4d,kBAAoB7rB,EAC3BmO,SAAS2d,MACP,uCAA8CF,EAAW,sCAI3D5rB,SAIC,IAA6B,mBAAlBkO,eAA+B,CAC7C,GAAI0d,GAAW,EACf,KACE,KAAM,IAAIroB,OAAM,KAChB,MAAOkL,GACPA,EAAElM,MAAM/B,QAAQ,iCAAkC,SAASF,EAAGH,GAC5D2C,cAAiBE,IAAK7C,GACtByrB,EAAWzrB,EAAIK,QAAQ,YAAa,OAGpC+qB,GACFrd,cAAc0d,EAAW,uBAC3B5rB,QAGA8C,cAAoC,mBAAdipB,aAA8B/oB,IAAK+oB,YAAe,KACxE/rB"} \ No newline at end of file +{"version":3,"sources":["system.src.js"],"names":["bootstrap","global","URLPolyfill","url","baseURL","TypeError","m","String","replace","match","RangeError","protocol","username","password","host","hostname","port","pathname","search","hash","undefined","base","flag","slice","lastIndexOf","output","p","pop","push","join","this","origin","href","self","__global","addToError","err","msg","originalErr","stack","message","toString","split","newStack","i","length","$__curScript","indexOf","src","newMsg","substr","isBrowser","isWindows","newErr","errArgs","Error","fileName","lineNumber","Module","Loader","options","_loader","loaderObj","loads","modules","importPromises","moduleRecords","defineProperty","get","SystemJSLoader","call","paths","systemJSConstructor","SystemProto","hook","name","prototype","hookConstructor","isAbsolute","absURLRegEx","isRel","isPlain","urlResolve","parent","baseURI","URL","baseURIObj","applyPaths","loader","wildcard","pathMatch","maxWildcardPrefixLen","pathsCache","hasOwnProperty","path","pathParts","wildcardPrefixLen","outPath","group","deps","names","indices","l","index","getESModule","exports","esModule","getOwnPropertyDescriptor","defineOrCopyProperty","extend","value","targetObj","sourceObj","propName","d","Object","ex","a","b","prepend","extendMeta","val","Array","concat","extendPkgConfig","pkgCfgA","pkgCfgB","pkgName","warnInvalidProperties","prop","map","meta","depCache","dNormalized","coreResolve","warn","setPkgConfig","cfg","prependConfig","pkg","packages","basePkg","main","warnings","console","createInstantiate","load","result","metadata","entry","createEntry","execute","format","readMemberExpression","pParts","shift","getMapMatch","bestMatch","bestMatchLength","curMatchLength","prepareBaseURL","setProduction","isProduction","isBuilder","set","envModule","newModule","browser","node","_nodeRequire","production","dev","build","default","getNodeModule","parentModuleContext","_nodeModulePaths","require","parentName","mapMatch","has","builder","envSet","envCallback","browserConfig","nodeConfig","devConfig","buildConfig","productionConfig","detectRegisterFormat","source","leadingCommentAndMeta","leadingCommentAndMetaRegEx","originalIndices","declare","executingRequire","declarative","normalizedDeps","groupIndex","evaluated","module","esmExports","getGlobalValue","globalValue","first","parseCondition","condition","conditionExport","conditionModule","negation","conditionExportIndex","sysConditions","negate","serializeCondition","conditionObj","resolveCondition","bool","normalize","then","normalizedCondition","q","interpolateConditional","conditionalMatch","interpolationRegEx","Promise","resolve","conditionValue","booleanConditional","booleanIndex","isWorker","window","importScripts","document","process","platform","assert","item","thisLen","e","obj","opt","getElementsByTagName","bases","location","cwd","nativeURL","createLoad","status","anonCnt","linkSets","dependencies","loadModule","asyncStartLoadPartwayThrough","step","address","moduleName","moduleMetadata","moduleSource","moduleAddress","requestLoad","request","refererName","refererAddress","reject","proceedToLocate","proceedToFetch","locate","proceedToTranslate","fetch","translate","instantiate","instantiateResult","depsList","loadPromises","depLoad","key","addLoadToLinkSet","all","updateLinkSetOnLoad","exc","exception","linkSetFailed","stepState","existingLoad","done","linkSet","createLinkSet","startingLoad","loadingCount","j","doLink","error","link","_newModule","finishLoad","abrupt","checkError","pLoad","dep","failed","linkIndex","splice","globalLoadsIndex","trace","depMap","forEach","loadIndex","doDynamicExecute","linkError","createImportPromise","promise","constructor","define","delete","import","parentAddress","sourcePromise","pNames","getOwnPropertyNames","configurable","enumerable","freeze","referrerName","referrerAddress","System","fetchTextFromURL","XMLHttpRequest","authorization","fulfill","xhr","responseText","statusText","sameDomain","doTimeout","domainCheck","exec","XDomainRequest","onload","onerror","ontimeout","onprogress","timeout","onreadystatechange","readyState","addEventListener","open","setRequestHeader","withCredentials","setTimeout","send","fs","readFile","data","dataString","opts","headers","Accept","credentials","r","ok","text","transpile","transpiler","pluginLoader","__useDefault","transpileFunction","Compiler","traceurTranspile","createLanguageService","typescriptTranspile","babelTranspile","traceur","traceurOptions","script","sourceMaps","filename","inputSourceMap","sourceMap","compiler","doTraceurCompile","compile","babel","babelOptions","code","ast","transform","ts","typescriptOptions","target","ScriptTarget","ES5","inlineSourceMap","ModuleKind","__exec","sourceMapString","hasBuffer","sourceMapPrefix","Buffer","btoa","unescape","encodeURIComponent","getSource","wrap","lastLineIndex","JSON","stringify","preExec","curLoad","callCounter","curSystem","SystemJS","postExec","scriptExec","head","body","documentElement","createElement","_e","apply","arguments","integrity","setAttribute","nonce","appendChild","removeChild","register","reduceRegister_","useVm","vm","supportsScriptExec","runInThisContext","eval","chrome","extension","navigator","userAgent","scriptSrc","defaultJSExtensions","pluginFirst","loaderErrorStack","skipExt","resolved","httpRequest","systemImport","systemTranslate","parse","getConfig","curCurScript","config","isEnvConfig","checkHasConfig","transpilerRuntime","loadedTranspilerRuntime","bundles","packageConfigPaths","v","defaultJSExtension","decanonicalize","pkgMatch","packageLength","Math","max","normalized","bundle","normalizedBundleDep","c","getPackage","curPkg","pkgLen","curPkgLen","addDefaultExtension","subPath","skipExtensions","defaultExtension","metaMatch","getMetaMatches","metaPattern","matchMeta","matchDepth","applyPackageConfigSync","mapPath","mapped","doMapSync","validMapping","normalizeSync","applyPackageConfig","doMap","doStringMap","conditionPromises","conditions","conditionValues","createPkgConfigPathObj","lastWildcard","regEx","RegExp","getPackageConfigMatch","configPath","exactMatch","packageConfigPath","packageName","loadPackageConfigPath","pkgConfigPath","configLoader","systemjs","pkgMeta","matchFn","wildcardIndex","dotRel","exactMeta","decanonicalized","isPlugin","parentPackageName","parentPackage","parentMap","parentMapMatch","pkgConfigMatch","isConfigured","configured","bestDepth","getInteractiveScriptLoad","interactiveScript","interactiveLoadingScripts","webWorkerImport","workerLoad","curRequire","ieEvents","s","isOpera","opera","attachEvent","loadingCnt","registerQueue","pushRegister","scriptLoad","complete","evt","cleanup","detachEvent","removeEventListener","async","crossOrigin","buildGroups","groups","depName","depEntry","defined","depGroupIndex","startEntry","curGroupDeclarative","linkDeclarativeModule","linkDynamicModule","ModuleRecord","getOrCreateModuleRecord","importers","declaration","locked","importerModule","importerIndex","setter","setters","id","depExports","depModule","len","getModule","ensureEvaluated","nameNormalized","__esModule","seen","registerDynamic","pushRegister_","amd","curMeta","del","doLoad","grouped","normalizePromises","esmRegEx","traceurRuntimeRegEx","babelHelpersRegEx","args","depInject","loadedTranspiler","transpilerPromise","transpilerNormalized","loaderModule","originalName","file","sources","originalSource","$traceurRuntime","babelHelpers","__globalName","g","globals","gl","exportName","retrieveGlobal","prepareGlobal","encapsulateGlobal","reduceRegister","forEachGlobal","callback","keys","forEachGlobalValue","globalName","ignoredGlobalProps","globalSnapshot","encapsulate","curDefine","oldGlobals","singleGlobal","multipleExports","getCJSDeps","inLocation","locations","cjsRequireRegEx","lastIndex","commentRegEx","stringRegEx","stringLocations","commentLocations","cjsExportsRegEx","hashBangRegEx","metaDeps","cjsRequireDetection","_require","requireResolve","cjsDeferDepsExecute","pathVars","getPathVars","__cjsWrapper","dirname","cjsWrapper","stripOrigin","windowOrigin","parentId","moduleId","pluginIndex","amdDefine","requireIndex","params","fnBracketRegEx","requireAlias","wsRegEx","requireRegEx","requireRegExs","cjsRequirePre","cjsRequirePost","errback","referer","dynamicRequires","factory","req","contextualRequire","depValues","uri","moduleIndex","exportsIndex","toUrl","amdRequire","amdRegEx","builderExecute","getParentName","parentPluginIndex","parsePlugin","argumentName","pluginName","argument","plugin","combinePluginParts","checkDefaultExtension","arg","createNormalizeSync","parsed","pluginSyntaxIndex","loaderNormalized","calledInstantiate","alias","aliasDeps","_export","setMetaProperty","curPart","depth","metaRegEx","metaPartRegEx","metaParts","firstChar","metaString","metaName","metaValue","loadedBundles","matched","curModule","parts","substring","version","doPolyfill","scripts","currentScript","defer","curPath","basePath","systemJSBootstrap","write","__filename"],"mappings":";;;CAGA,WACA,QAASA,MACT,SAAUC,GACV,QAASC,GAAYC,EAAKC,GACxB,GAAkB,gBAAPD,GACT,KAAM,IAAIE,WAAU,uBACtB,IAAIC,GAAIC,OAAOJ,GAAKK,QAAQ,aAAc,IAAIA,QAAQ,MAAO,KAAKC,MAAM,mHACxE,KAAKH,EACH,KAAM,IAAII,YAAW,qBACvB,IAAIC,GAAWL,EAAE,IAAM,GACnBM,EAAWN,EAAE,IAAM,GACnBO,EAAWP,EAAE,IAAM,GACnBQ,EAAOR,EAAE,IAAM,GACfS,EAAWT,EAAE,IAAM,GACnBU,EAAOV,EAAE,IAAM,GACfW,EAAWX,EAAE,IAAM,GACnBY,EAASZ,EAAE,IAAM,GACjBa,EAAOb,EAAE,IAAM,EACnB,IAAgBc,SAAZhB,EAAuB,CACzB,GAAIiB,GAAOjB,YAAmBF,GAAcE,EAAU,GAAIF,GAAYE,GAClEkB,GAAQX,IAAaG,IAASF,GAC9BU,GAASL,GAAaC,IACxBA,EAASG,EAAKH,QACZI,GAAwB,MAAhBL,EAAS,KACnBA,EAAYA,IAAcI,EAAKP,OAAQO,EAAKT,UAAcS,EAAKJ,SAAiB,GAAN,KAAYI,EAAKJ,SAASM,MAAM,EAAGF,EAAKJ,SAASO,YAAY,KAAO,GAAKP,EAAYI,EAAKJ,SAEtK,IAAIQ,KACJR,GAAST,QAAQ,kBAAmB,IACjCA,QAAQ,iBAAkB,KAC1BA,QAAQ,UAAW,QACnBA,QAAQ,aAAc,SAAUkB,GACrB,QAANA,EACFD,EAAOE,MAEPF,EAAOG,KAAKF,KAElBT,EAAWQ,EAAOI,KAAK,IAAIrB,QAAQ,MAAuB,MAAhBS,EAAS,GAAa,IAAM,IAClEK,IACFN,EAAOK,EAAKL,KACZD,EAAWM,EAAKN,SAChBD,EAAOO,EAAKP,KACZD,EAAWQ,EAAKR,SAChBD,EAAWS,EAAKT,UAEbD,IACHA,EAAWU,EAAKV,UAIpBM,EAAWA,EAAST,QAAQ,MAAO,KAEnCsB,KAAKC,OAASjB,EAAOH,GAAyB,KAAbA,GAA4B,KAATG,EAAc,KAAO,IAAMA,EAAO,GACtFgB,KAAKE,KAAOrB,GAAYA,GAAYG,GAAoB,SAAZH,EAAsB,KAAO,KAAoB,KAAbC,EAAkBA,GAAyB,KAAbC,EAAkB,IAAMA,EAAW,IAAM,IAAM,IAAMC,EAAOG,EAAWC,EAASC,EAC9LW,KAAKnB,SAAWA,EAChBmB,KAAKlB,SAAWA,EAChBkB,KAAKjB,SAAWA,EAChBiB,KAAKhB,KAAOA,EACZgB,KAAKf,SAAWA,EAChBe,KAAKd,KAAOA,EACZc,KAAKb,SAAWA,EAChBa,KAAKZ,OAASA,EACdY,KAAKX,KAAOA,EAEdlB,EAAOC,YAAcA,GACH,mBAAR+B,MAAsBA,KAAOhC,QACvC,SAAUiC,GAqCR,QAASC,GAAWC,EAAKC,GAEvB,IAAKD,EAAIE,YAGP,IAAK,GAFDC,KAAUH,EAAII,SAAWJ,IAAQA,EAAIG,MAAQ,KAAOH,EAAIG,MAAQ,KAAKE,WAAWC,MAAM,MACtFC,KACKC,EAAI,EAAGA,EAAIL,EAAMM,OAAQD,KACL,mBAAhBE,eAAqE,IAAtCP,EAAMK,GAAGG,QAAQD,aAAaE,OACtEL,EAASf,KAAKW,EAAMK,GAI1B,IAAIK,GAAS,eAAiBN,EAAWA,EAASd,KAAK,OAAUO,EAAII,QAAQU,OAAO,KAAO,MAASb,CAG/Fc,KACHF,EAASA,EAAOzC,QAAQ4C,EAAY,eAAiB,aAAc,IAErE,IAAIC,GAASC,EAAU,GAAIC,OAAMN,EAAQb,EAAIoB,SAAUpB,EAAIqB,YAAc,GAAIF,OAAMN,EAOnF,OALAI,GAAOd,MAAQU,EAGfI,EAAOf,YAAcF,EAAIE,aAAeF,EAEjCiB,EAoEX,QAASK,MAOT,QAASC,GAAOC,GACd9B,KAAK+B,SACHC,UAAWhC,KACXiC,SACAC,WACAC,kBACAC,kBAIFC,EAAerC,KAAM,UACnBsC,IAAK,WACH,MAAOlC,MAw8Bb,QAASmC,KACPV,EAAOW,KAAKxC,MAEZA,KAAKyC,SACLzC,KAAK+B,QAAQU,SAEbC,EAAoBF,KAAKxC,MAI3B,QAAS2C,MAOT,QAASC,GAAKC,EAAMD,GAClBL,EAAeO,UAAUD,GAAQD,EAAKL,EAAeO,UAAUD,IAAS,cAE1E,QAASE,GAAgBH,GACvBF,EAAsBE,EAAKF,GAAuB,cAKpD,QAASM,GAAWH,GAClB,MAAOA,GAAKlE,MAAMsE,GAEpB,QAASC,GAAML,GACb,MAAmB,KAAXA,EAAK,MAAeA,EAAK,IAAiB,KAAXA,EAAK,IAAwB,KAAXA,EAAK,KAA0B,KAAXA,EAAK,GAEpF,QAASM,GAAQN,GACf,OAAQK,EAAML,KAAUG,EAAWH,GAKrC,QAASO,GAAWP,EAAMQ,GAExB,GAAe,KAAXR,EAAK,IAEP,GAAe,KAAXA,EAAK,IAAwB,KAAXA,EAAK,GACzB,OAAQQ,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,EAAKzB,OAAO,OAEzF,IAAe,KAAXyB,EAAK,IAAkC,IAArBA,EAAK5B,QAAQ,KAEtC,OAAQoC,GAAUA,EAAOjC,OAAO,EAAGiC,EAAO3D,YAAY,KAAO,IAAM4D,GAAWT,CAGhF,OAAO,IAAIU,GAAIV,EAAMQ,GAAUA,EAAO3E,QAAQ,KAAM,QAAU8E,IAAYtD,KAAKxB,QAAQ,OAAQ,KAIjG,QAAS+E,GAAWC,EAAQb,GAE1B,GAAoBc,GAAhBC,EAAY,GAAcC,EAAuB,EAEjDpB,EAAQiB,EAAOjB,MACfqB,EAAaJ,EAAO3B,QAAQU,KAGhC,KAAK,GAAI7C,KAAK6C,GACZ,IAAIA,EAAMsB,gBAAmBtB,EAAMsB,eAAenE,GAAlD,CAIA,GAAIoE,GAAOvB,EAAM7C,EAKjB,IAJIoE,IAASF,EAAWlE,KACtBoE,EAAOvB,EAAM7C,GAAKkE,EAAWlE,GAAKwD,EAAWX,EAAM7C,GAAIsD,EAAMT,EAAM7C,IAAM0D,EAAUI,EAAOpF,UAGrE,KAAnBsB,EAAEqB,QAAQ,KAAa,CACzB,GAAI4B,GAAQjD,EACV,MAAO6C,GAAM7C,EAGV,IAAIiD,EAAKzB,OAAO,EAAGxB,EAAEmB,OAAS,IAAMnB,EAAEwB,OAAO,EAAGxB,EAAEmB,OAAS,KAAO8B,EAAK9B,OAASnB,EAAEmB,QAAU8B,EAAKjD,EAAEmB,OAAS,IAAMnB,EAAEA,EAAEmB,OAAS,MAAyC,KAAjC0B,EAAM7C,GAAG6C,EAAM7C,GAAGmB,OAAS,IAAyB,IAAZ0B,EAAM7C,IACxL,MAAO6C,GAAM7C,GAAGwB,OAAO,EAAGqB,EAAM7C,GAAGmB,OAAS,IAAM8B,EAAK9B,OAASnB,EAAEmB,QAAU0B,EAAM7C,IAAM,KAAO,IAAMiD,EAAKzB,OAAOxB,EAAEmB,QAAU,QAI5H,CACH,GAAIkD,GAAYrE,EAAEgB,MAAM,IACxB,IAAIqD,EAAUlD,OAAS,EACrB,KAAM,IAAIxC,WAAU,2CAEtB,IAAI2F,GAAoBD,EAAU,GAAGlD,MACjCmD,IAAqBL,GACrBhB,EAAKzB,OAAO,EAAG6C,EAAU,GAAGlD,SAAWkD,EAAU,IACjDpB,EAAKzB,OAAOyB,EAAK9B,OAASkD,EAAU,GAAGlD,SAAWkD,EAAU,KAC1DJ,EAAuBK,EACvBN,EAAYhE,EACZ+D,EAAWd,EAAKzB,OAAO6C,EAAU,GAAGlD,OAAQ8B,EAAK9B,OAASkD,EAAU,GAAGlD,OAASkD,EAAU,GAAGlD,UAKvG,GAAIoD,GAAU1B,EAAMmB,EAIpB,OAHuB,gBAAZD,KACTQ,EAAUA,EAAQzF,QAAQ,IAAKiF,IAE1BQ,EAWT,QAASC,GAAMC,GAGb,IAAK,GAFDC,MACAC,KACKzD,EAAI,EAAG0D,EAAIH,EAAKtD,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3C,GAAI2D,GAAQxD,EAAQuB,KAAK8B,EAAOD,EAAKvD,GACvB,MAAV2D,GACFH,EAAMxE,KAAKuE,EAAKvD,IAChByD,EAAQzE,MAAMgB,KAGdyD,EAAQE,GAAO3E,KAAKgB,GAGxB,OAASwD,MAAOA,EAAOC,QAASA,GAYlC,QAASG,GAAYC,GACnB,GAAIC,KAEJ,KAAuB,gBAAXD,IAAyC,kBAAXA,KAA0BA,IAAYvE,EAC5E,GAAIyE,GACF,IAAK,GAAIjF,KAAK+E,GAEF,YAAN/E,GAEJkF,EAAqBF,EAAUD,EAAS/E,OAI1CmF,GAAOH,EAAUD,EAOvB,OAJAC,GAAS,WAAaD,EACtBtC,EAAeuC,EAAU,gBACvBI,OAAO,IAEFJ,EAGT,QAASE,GAAqBG,EAAWC,EAAWC,GAClD,IACE,GAAIC,IACAA,EAAIC,OAAOR,yBAAyBK,EAAWC,KACjD9C,EAAe4C,EAAWE,EAAUC,GAExC,MAAOE,GAIL,MADAL,GAAUE,GAAYD,EAAUC,IACzB,GAIX,QAASJ,GAAOQ,EAAGC,EAAGC,GACpB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,KACRzB,GAAmByB,EAAEzB,eAAenE,MAEnC6F,GAAa7F,IAAK2F,KACrBA,EAAE3F,GAAK4F,EAAE5F,IAEb,OAAO2F,GAOT,QAASG,GAAWH,EAAGC,EAAGC,GACxB,GAAI1B,GAAiByB,GAAKA,EAAEzB,cAC5B,KAAK,GAAInE,KAAK4F,GACZ,IAAIzB,GAAmByB,EAAEzB,eAAenE,GAAxC,CAEA,GAAI+F,GAAMH,EAAE5F,EACNA,KAAK2F,GAEFI,YAAeC,QAASL,EAAE3F,YAAcgG,OAC/CL,EAAE3F,MAAQiG,OAAOJ,EAAUE,EAAMJ,EAAE3F,IAAIiG,OAAOJ,EAAUF,EAAE3F,GAAK+F,GAC1C,gBAAPA,IAA2B,OAARA,GAA+B,gBAARJ,GAAE3F,GAC1D2F,EAAE3F,GAAKmF,EAAOA,KAAWQ,EAAE3F,IAAK+F,EAAKF,GAC7BA,IACRF,EAAE3F,GAAK+F,GANPJ,EAAE3F,GAAK+F,GAUb,QAASG,GAAgBC,EAASC,EAASC,EAASvC,EAAQwC,GAC1D,IAAK,GAAIC,KAAQH,GACf,GAA8E,IAA1E/E,EAAQuB,MAAM,OAAQ,SAAU,mBAAoB,YAAa2D,GACnEJ,EAAQI,GAAQH,EAAQG,OAErB,IAAY,OAARA,EACPpB,EAAOgB,EAAQK,IAAML,EAAQK,QAAWJ,EAAQI,SAE7C,IAAY,QAARD,EACPpB,EAAOgB,EAAQM,KAAON,EAAQM,SAAYL,EAAQK,UAE/C,IAAY,YAARF,EACP,IAAK,GAAIf,KAAKY,GAAQM,SAAU,CAC9B,GAAIC,EAGFA,GADoB,MAAlBnB,EAAEhE,OAAO,EAAG,GACA6E,EAAU,IAAMb,EAAEhE,OAAO,GAEzBoF,EAAYhE,KAAKkB,EAAQ0B,GACzC1B,EAAO4C,SAASC,IAAgB7C,EAAO4C,SAASC,QAAoBV,OAAOG,EAAQM,SAASlB,SAGvFc,GAAiH,IAAxFjF,EAAQuB,MAAM,gBAAiB,aAAc,YAAa,oBAAqB2D,IAC3GH,EAAQjC,iBAAkBiC,EAAQjC,eAAeoC,IACrDM,EAAKjE,KAAKkB,EAAQ,IAAMyC,EAAO,4DAA8DF,GAMnG,QAASS,GAAahD,EAAQuC,EAASU,EAAKC,GAC1C,GAAIC,EAGJ,IAAKnD,EAAOoD,SAASb,GAGhB,CACH,GAAIc,GAAUrD,EAAOoD,SAASb,EAC9BY,GAAMnD,EAAOoD,SAASb,MAEtBH,EAAgBe,EAAKD,EAAgBD,EAAMI,EAASd,EAASvC,EAAQkD,GACrEd,EAAgBe,EAAKD,EAAgBG,EAAUJ,EAAKV,EAASvC,GAASkD,OAPtEC,GAAMnD,EAAOoD,SAASb,GAAWU,CAkBnC,OAPuB,gBAAZE,GAAIG,OACbH,EAAIT,IAAMS,EAAIT,QACdS,EAAIT,IAAI,WAAaS,EAAIG,KACzBH,EAAIG,KAAK,WAAaH,EAAIG,KAAK,YAAc,KAC7CH,EAAIG,KAAO,SAGNH,EAGT,QAASJ,GAAKlG,GACRP,KAAKiH,UAA8B,mBAAXC,UAA0BA,QAAQT,MAC5DS,QAAQT,KAAKlG,GAGjB,QAAS4G,GAAmBC,EAAMC,GAChCD,EAAKE,SAASC,MAAQC,IACtBJ,EAAKE,SAASC,MAAME,QAAU,WAC5B,MAAOJ,IAETD,EAAKE,SAASC,MAAMlD,QACpB+C,EAAKE,SAASI,OAAS,UAgJzB,QAASC,GAAqB/H,EAAGoF,GAE/B,IADA,GAAI4C,GAAShI,EAAEgB,MAAM,KACdgH,EAAO7G,QACZiE,EAAQA,EAAM4C,EAAOC,QACvB,OAAO7C,GAGT,QAAS8C,GAAY1B,EAAKvD,GACxB,GAAIkF,GAAWC,EAAkB,CAEjC,KAAK,GAAIpI,KAAKwG,GACZ,GAAIvD,EAAKzB,OAAO,EAAGxB,EAAEmB,SAAWnB,IAAMiD,EAAK9B,QAAUnB,EAAEmB,QAA4B,KAAlB8B,EAAKjD,EAAEmB,SAAiB,CACvF,GAAIkH,GAAiBrI,EAAEgB,MAAM,KAAKG,MAClC,IAAsBiH,GAAlBC,EACF,QACFF,GAAYnI,EACZoI,EAAkBC,EAItB,MAAOF,GAGT,QAASG,GAAexE,GAElB1D,KAAK+B,QAAQzD,UAAY0B,KAAK1B,UACa,KAAzC0B,KAAK1B,QAAQ0B,KAAK1B,QAAQyC,OAAS,KACrCf,KAAK1B,SAAW,KAElB0B,KAAK+B,QAAQzD,QAAU0B,KAAK1B,QAAU,GAAIiF,GAAIvD,KAAK1B,QAASkF,IAAYtD,MAK5E,QAASiI,GAAcC,EAAcC,GACnCrI,KAAKsI,IAAI,cAAeC,GAAYvI,KAAKwI,WACvCC,QAASpH,EACTqH,OAAQ1I,KAAK2I,aACbC,YAAaP,GAAaD,EAC1BS,IAAKR,IAAcD,EACnBU,MAAOT,EACPU,WAAW,KAuDf,QAASC,GAAcnG,EAAMvE,GAC3B,IAAK6E,EAAQN,GACX,KAAM,IAAIpB,OAAM,eAAiBoB,EAAO,mDAE1C,KAAKoG,GAAqB,CACxB,GAAIrH,GAAS5B,KAAK2I,aAAa,UAC3BpJ,EAAOjB,EAAQ8C,OAAOE,EAAY,EAAI,EAC1C2H,IAAsB,GAAIrH,GAAOrC,GACjC0J,GAAoBxG,MAAQb,EAAOsH,iBAAiB3J,GAEtD,MAAO0J,IAAoBE,QAAQtG,GAGrC,QAAS2D,GAAY3D,EAAMuG,GAEzB,GAAIlG,EAAML,GACR,MAAOO,GAAWP,EAAMuG,EACrB,IAAIpG,EAAWH,GAClB,MAAOA,EAGT,IAAIwG,GAAWvB,EAAY9H,KAAKoG,IAAKvD,EAErC,IAAIwG,EAAU,CAGZ,GAFAxG,EAAO7C,KAAKoG,IAAIiD,GAAYxG,EAAKzB,OAAOiI,EAAStI,QAE7CmC,EAAML,GACR,MAAOO,GAAWP,EACf,IAAIG,EAAWH,GAClB,MAAOA,GAGX,GAAI7C,KAAKsJ,IAAIzG,GACX,MAAOA,EAGT,IAAyB,UAArBA,EAAKzB,OAAO,EAAG,GAAgB,CACjC,IAAKpB,KAAK2I,aACR,KAAM,IAAIpK,WAAU,iBAAmBsE,EAAO,6CAKhD,OAJI7C,MAAKuJ,QACPvJ,KAAKsI,IAAIzF,EAAM7C,KAAKwI,eAEpBxI,KAAKsI,IAAIzF,EAAM7C,KAAKwI,UAAU9D,EAAYsE,EAAcxG,KAAKxC,KAAM6C,EAAKzB,OAAO,GAAIpB,KAAK1B,YACnFuE,EAMT,MAFAqF,GAAe1F,KAAKxC,MAEbyD,EAAWzD,KAAM6C,IAAS7C,KAAK1B,QAAUuE,EAgJlD,QAAS2G,GAAO9F,EAAQiD,EAAK8C,GACvBlB,GAAUE,SAAW9B,EAAI+C,eAC3BD,EAAY9C,EAAI+C,eACdnB,GAAUG,MAAQ/B,EAAIgD,YACxBF,EAAY9C,EAAIgD,YACdpB,GAAUM,KAAOlC,EAAIiD,WACvBH,EAAY9C,EAAIiD,WACdrB,GAAUO,OAASnC,EAAIkD,aACzBJ,EAAY9C,EAAIkD,aACdtB,GAAUK,YAAcjC,EAAImD,kBAC9BL,EAAY9C,EAAImD,kBAshCpB,QAASC,GAAqBC,GAC5B,GAAIC,GAAwBD,EAAOrL,MAAMuL,GACzC,OAAOD,IAA+E,mBAAtDD,EAAO5I,OAAO6I,EAAsB,GAAGlJ,OAAQ,IAGjF,QAASyG,KACP,OACE3E,KAAM,KACNwB,KAAM,KACN8F,gBAAiB,KACjBC,QAAS,KACT3C,QAAS,KACT4C,kBAAkB,EAClBC,aAAa,EACbC,eAAgB,KAChBC,WAAY,KACZC,WAAW,EACXC,OAAQ,KACR9F,SAAU,KACV+F,YAAY,GAkyBhB,QAASC,GAAejG,GACtB,GAAsB,gBAAXA,GACT,MAAOgD,GAAqBhD,EAASvE,EAEvC,MAAMuE,YAAmBiB,QACvB,KAAM,IAAInE,OAAM,4CAIlB,KAAK,GAFDoJ,MACAC,GAAQ,EACHhK,EAAI,EAAGA,EAAI6D,EAAQ5D,OAAQD,IAAK,CACvC,GAAI6E,GAAMgC,EAAqBhD,EAAQ7D,GAAIV,EACvC0K,KACFD,EAAY,WAAalF,EACzBmF,GAAQ,GAEVD,EAAYlG,EAAQ7D,GAAGF,MAAM,KAAKf,OAAS8F,EAE7C,MAAOkF,GAo4BP,QAASE,GAAeC,GACtB,GAAIC,GAAiBC,EAAiBC,EAElCA,EAA2B,KAAhBH,EAAU,GACrBI,EAAuBJ,EAAUtL,YAAY,IAsBjD,OArB4B,IAAxB0L,GACFH,EAAkBD,EAAU5J,OAAOgK,EAAuB,GAC1DF,EAAkBF,EAAU5J,OAAO+J,EAAUC,EAAuBD,GAEhEA,GACF1E,EAAKjE,KAAKxC,KAAM,4BAA8BgL,EAAY,wBAA0BE,EAAkB,KAAOD,EAAkB,KAEvG,KAAtBA,EAAgB,KAClBE,GAAW,EACXF,EAAkBA,EAAgB7J,OAAO,MAI3C6J,EAAkB,UAClBC,EAAkBF,EAAU5J,OAAO+J,GACW,IAA1CE,GAAcpK,QAAQiK,KACxBD,EAAkBC,EAClBA,EAAkB,QAKpBR,OAAQQ,GAAmB,cAC3B/E,KAAM8E,EACNK,OAAQH,GAIZ,QAASI,GAAmBC,GAC1B,MAAOA,GAAad,OAAS,KAAOc,EAAaF,OAAS,IAAM,IAAME,EAAarF,KAGrF,QAASsF,GAAiBD,EAAcpC,EAAYsC,GAClD,GAAIvL,GAAOH,IACX,OAAOA,MAAK2L,UAAUH,EAAad,OAAQtB,GAC1CwC,KAAK,SAASC,GACb,MAAO1L,GAAKiH,KAAKyE,GAChBD,KAAK,SAASE,GACb,GAAItN,GAAImJ,EAAqB6D,EAAarF,KAAMhG,EAAKmC,IAAIuJ,GAEzD,IAAIH,GAAoB,iBAALlN,GACjB,KAAM,IAAID,WAAU,aAAegN,EAAmBC,GAAgB,iCAExE,OAAOA,GAAaF,QAAU9M,EAAIA,MAMxC,QAASuN,GAAuBlJ,EAAMuG,GAEpC,GAAI4C,GAAmBnJ,EAAKlE,MAAMsN,GAElC,KAAKD,EACH,MAAOE,SAAQC,QAAQtJ,EAEzB,IAAI2I,GAAeT,EAAevI,KAAKxC,KAAMgM,EAAiB,GAAG5K,OAAO,EAAG4K,EAAiB,GAAGjL,OAAS,GAGxG,OAAIf,MAAKuJ,QACAvJ,KAAgB,UAAEwL,EAAad,OAAQtB,GAC7CwC,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACfrI,EAAKnE,QAAQuN,GAAoB,KAAOV,EAAmBC,GAAgB,OAG/EC,EAAiBjJ,KAAKxC,KAAMwL,EAAcpC,GAAY,GAC5DwC,KAAK,SAASQ,GACb,GAA8B,gBAAnBA,GACT,KAAM,IAAI7N,WAAU,2BAA6BsE,EAAO,gCAE1D,IAAmC,IAA/BuJ,EAAenL,QAAQ,KACzB,KAAM,IAAI1C,WAAU,sCAAwCsE,GAAQuG,EAAa,OAASA,EAAa,IAAM,0BAA6BgD,EAAiB,mCAE7J,OAAOvJ,GAAKnE,QAAQuN,GAAoBG,KAI5C,QAASC,GAAmBxJ,EAAMuG,GAEhC,GAAIkD,GAAezJ,EAAKnD,YAAY,KAEpC,IAAoB,IAAhB4M,EACF,MAAOJ,SAAQC,QAAQtJ,EAEzB,IAAI2I,GAAeT,EAAevI,KAAKxC,KAAM6C,EAAKzB,OAAOkL,EAAe,GAGxE,OAAItM,MAAKuJ,QACAvJ,KAAgB,UAAEwL,EAAad,OAAQtB,GAC7CwC,KAAK,SAASV,GAEb,MADAM,GAAad,OAASQ,EACfrI,EAAKzB,OAAO,EAAGkL,GAAgB,KAAOf,EAAmBC,KAG7DC,EAAiBjJ,KAAKxC,KAAMwL,EAAcpC,GAAY,GAC5DwC,KAAK,SAASQ,GACb,MAAOA,GAAiBvJ,EAAKzB,OAAO,EAAGkL,GAAgB,WA7mJ3D,GAAIC,GAA4B,mBAAVC,SAAwC,mBAARrM,OAA+C,mBAAjBsM,eAChFpL,EAA6B,mBAAVmL,SAA4C,mBAAZE,UACnDpL,EAA8B,mBAAXqL,UAAqD,mBAApBA,SAAQC,YAA6BD,QAAQC,SAASjO,MAAM,OAE/GyB,GAAS8G,UACZ9G,EAAS8G,SAAY2F,OAAQ,cAG/B,IASIxK,GATApB,EAAU2E,MAAM9C,UAAU7B,SAAW,SAAS6L,GAChD,IAAK,GAAIhM,GAAI,EAAGiM,EAAU/M,KAAKe,OAAYgM,EAAJjM,EAAaA,IAClD,GAAId,KAAKc,KAAOgM,EACd,MAAOhM,EAGX,OAAO,KAIT,WACE,IACQuE,OAAOhD,kBAAmB,UAC9BA,EAAiBgD,OAAOhD,gBAE5B,MAAO2K,GACL3K,EAAiB,SAAS4K,EAAK9G,EAAM+G,GACnC,IACED,EAAI9G,GAAQ+G,EAAIlI,OAASkI,EAAI5K,IAAIE,KAAKyK,GAExC,MAAMD,SAKZ,IAsCI1J,GAtCA9B,EAAwC,KAA9B,GAAIC,OAAM,EAAG,KAAKC,QAyChC,IAAuB,mBAAZgL,WAA2BA,SAASS,sBAG7C,GAFA7J,EAAUoJ,SAASpJ,SAEdA,EAAS,CACZ,GAAI8J,GAAQV,SAASS,qBAAqB,OAC1C7J,GAAU8J,EAAM,IAAMA,EAAM,GAAGlN,MAAQsM,OAAOa,SAASnN,UAG/B,mBAAZmN,YACd/J,EAAUlD,EAASiN,SAASnN,KAI9B,IAAIoD,EACFA,EAAUA,EAAQ1C,MAAM,KAAK,GAAGA,MAAM,KAAK,GAC3C0C,EAAUA,EAAQlC,OAAO,EAAGkC,EAAQ5D,YAAY,KAAO,OAEpD,CAAA,GAAsB,mBAAXiN,WAA0BA,QAAQW,IAMhD,KAAM,IAAI/O,WAAU,yBALpB+E,GAAU,WAAahC,EAAY,IAAM,IAAMqL,QAAQW,MAAQ,IAC3DhM,IACFgC,EAAUA,EAAQ5E,QAAQ,MAAO,MAMrC,IACE,GAAI6O,GAAqD,SAAzC,GAAInN,GAASmD,IAAI,YAAY1E,SAE/C,MAAMmO,IAEN,GAAIzJ,GAAMgK,EAAYnN,EAASmD,IAAMnD,EAAShC,WAwBhDiE,GAAeT,EAAOkB,UAAW,YAC/BkC,MAAO,WACL,MAAO,YAsBX,WAsGE,QAASwI,GAAW3K,GAClB,OACE4K,OAAQ,UACR5K,KAAMA,GAAQ,gBAAiB6K,EAAU,IACzCC,YACAC,gBACAtG,aASJ,QAASuG,GAAWnK,EAAQb,EAAMf,GAChC,MAAO,IAAIoK,SAAQ4B,GACjBC,KAAMjM,EAAQkM,QAAU,QAAU,SAClCtK,OAAQA,EACRuK,WAAYpL,EAEZqL,eAAgBpM,GAAWA,EAAQwF,aACnC6G,aAAcrM,EAAQkI,OACtBoE,cAAetM,EAAQkM,WAK3B,QAASK,GAAY3K,EAAQ4K,EAASC,EAAaC,GAEjD,MAAO,IAAItC,SAAQ,SAASC,EAASsC,GACnCtC,EAAQzI,EAAO1B,UAAU2J,UAAU2C,EAASC,EAAaC,MAG1D5C,KAAK,SAAS/I,GACb,GAAIuE,EACJ,IAAI1D,EAAOxB,QAAQW,GAKjB,MAJAuE,GAAOoG,EAAW3K,GAClBuE,EAAKqG,OAAS,SAEdrG,EAAKsD,OAAShH,EAAOxB,QAAQW,GACtBuE,CAGT,KAAK,GAAItG,GAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAYyD,EAAJ1D,EAAOA,IAE9C,GADAsG,EAAO1D,EAAOzB,MAAMnB,GAChBsG,EAAKvE,MAAQA,EAEjB,MAAOuE,EAQT,OALAA,GAAOoG,EAAW3K,GAClBa,EAAOzB,MAAMnC,KAAKsH,GAElBsH,EAAgBhL,EAAQ0D,GAEjBA,IAKX,QAASsH,GAAgBhL,EAAQ0D,GAC/BuH,EAAejL,EAAQ0D,EACrB8E,QAAQC,UAEPP,KAAK,WACJ,MAAOlI,GAAO1B,UAAU4M,QAAS/L,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,cAMvE,QAASqH,GAAejL,EAAQ0D,EAAMxH,GACpCiP,EAAmBnL,EAAQ0D,EACzBxH,EAECgM,KAAK,SAASoC,GAEb,MAAmB,WAAf5G,EAAKqG,QAETrG,EAAK4G,QAAUA,EAERtK,EAAO1B,UAAU8M,OAAQjM,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,SAAU0G,QAASA,KAJnF,UAUN,QAASa,GAAmBnL,EAAQ0D,EAAMxH,GACxCA,EAECgM,KAAK,SAAS5B,GACb,MAAmB,WAAf5C,EAAKqG,QAGTrG,EAAK4G,QAAU5G,EAAK4G,SAAW5G,EAAKvE,KAE7BqJ,QAAQC,QAAQzI,EAAO1B,UAAU+M,WAAYlM,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,SAAU0G,QAAS5G,EAAK4G,QAAShE,OAAQA,KAG5H4B,KAAK,SAAS5B,GAEb,MADA5C,GAAK4C,OAASA,EACPtG,EAAO1B,UAAUgN,aAAcnM,KAAMuE,EAAKvE,KAAMyE,SAAUF,EAAKE,SAAU0G,QAAS5G,EAAK4G,QAAShE,OAAQA,MAIhH4B,KAAK,SAASqD,GACb,GAA0B3P,SAAtB2P,EACF,KAAM,IAAI1Q,WAAU,mDAEtB,IAAgC,gBAArB0Q,GACT,KAAM,IAAI1Q,WAAU,mCAEtB6I,GAAK8H,SAAWD,EAAkB5K,SAClC+C,EAAKK,QAAUwH,EAAkBxH,UAGlCmE,KAAK,WACJxE,EAAKwG,eAIL,KAAK,GAHDsB,GAAW9H,EAAK8H,SAEhBC,KACKrO,EAAI,EAAG0D,EAAI0K,EAASnO,OAAYyD,EAAJ1D,EAAOA,KAAK,SAAUwN,EAAS7J,GAClE0K,EAAarP,KACXuO,EAAY3K,EAAQ4K,EAASlH,EAAKvE,KAAMuE,EAAK4G,SAG5CpC,KAAK,SAASwD,GASb,GALAhI,EAAKwG,aAAanJ,IAChB4K,IAAKf,EACLtJ,MAAOoK,EAAQvM,MAGK,UAAlBuM,EAAQ3B,OAEV,IAAK,GADDE,GAAWvG,EAAKuG,SAAS9H,WACpB/E,EAAI,EAAG0D,EAAImJ,EAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC1CwO,EAAiB3B,EAAS7M,GAAIsO,QAOrCF,EAASpO,GAAIA,EAEhB,OAAOoL,SAAQqD,IAAIJ,KAIpBvD,KAAK,WAIJxE,EAAKqG,OAAS,QAGd,KAAK,GADDE,GAAWvG,EAAKuG,SAAS9H,WACpB/E,EAAI,EAAG0D,EAAImJ,EAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC1C0O,EAAoB7B,EAAS7M,GAAIsG,MApErC,SAwED,SAAS,SAASqI,GACjBrI,EAAKqG,OAAS,SACdrG,EAAKsI,UAAYD,CAGjB,KAAK,GADD9B,GAAWvG,EAAKuG,SAAS9H,WACpB/E,EAAI,EAAG0D,EAAImJ,EAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC1C6O,EAAchC,EAAS7M,GAAIsG,EAAMqI,KAQvC,QAAS3B,GAA6B8B,GACpC,MAAO,UAASzD,EAASsC,GACvB,GAAI/K,GAASkM,EAAUlM,OACnBb,EAAO+M,EAAU3B,WACjBF,EAAO6B,EAAU7B,IAErB,IAAIrK,EAAOxB,QAAQW,GACjB,KAAM,IAAItE,WAAU,IAAMsE,EAAO,uCAInC,KAAK,GADDgN,GACK/O,EAAI,EAAG0D,EAAId,EAAOzB,MAAMlB,OAAYyD,EAAJ1D,EAAOA,IAC9C,GAAI4C,EAAOzB,MAAMnB,GAAG+B,MAAQA,IAC1BgN,EAAenM,EAAOzB,MAAMnB,GAEhB,aAARiN,GAAwB8B,EAAa7F,SACvC6F,EAAa7B,QAAU4B,EAAUxB,cACjCS,EAAmBnL,EAAQmM,EAAc3D,QAAQC,QAAQyD,EAAUzB,gBAKjE0B,EAAalC,SAAS5M,QAAU8O,EAAalC,SAAS,GAAG1L,MAAM,GAAGY,MAAQgN,EAAahN,MACzF,MAAOgN,GAAalC,SAAS,GAAGmC,KAAKlE,KAAK,WACxCO,EAAQ0D,IAKhB,IAAIzI,GAAOyI,GAAgBrC,EAAW3K,EAEtCuE,GAAKE,SAAWsI,EAAU1B,cAE1B,IAAI6B,GAAUC,EAActM,EAAQ0D,EAEpC1D,GAAOzB,MAAMnC,KAAKsH,GAElB+E,EAAQ4D,EAAQD,MAEJ,UAAR/B,EACFW,EAAgBhL,EAAQ0D,GAET,SAAR2G,EACPY,EAAejL,EAAQ0D,EAAM8E,QAAQC,QAAQyD,EAAUxB,iBAGvDhH,EAAK4G,QAAU4B,EAAUxB,cACzBS,EAAmBnL,EAAQ0D,EAAM8E,QAAQC,QAAQyD,EAAUzB,iBAWjE,QAAS6B,GAActM,EAAQuM,GAC7B,GAAIF,IACFrM,OAAQA,EACRzB,SACAgO,aAAcA,EACdC,aAAc,EAOhB,OALAH,GAAQD,KAAO,GAAI5D,SAAQ,SAASC,EAASsC,GAC3CsB,EAAQ5D,QAAUA,EAClB4D,EAAQtB,OAASA,IAEnBa,EAAiBS,EAASE,GACnBF,EAGT,QAAST,GAAiBS,EAAS3I,GACjC,GAAmB,UAAfA,EAAKqG,OAAT,CAGA,IAAK,GAAI3M,GAAI,EAAG0D,EAAIuL,EAAQ9N,MAAMlB,OAAYyD,EAAJ1D,EAAOA,IAC/C,GAAIiP,EAAQ9N,MAAMnB,IAAMsG,EACtB,MAEJ2I,GAAQ9N,MAAMnC,KAAKsH,GACnBA,EAAKuG,SAAS7N,KAAKiQ,GAGA,UAAf3I,EAAKqG,QACPsC,EAAQG,cAKV,KAAK,GAFDxM,GAASqM,EAAQrM,OAEZ5C,EAAI,EAAG0D,EAAI4C,EAAKwG,aAAa7M,OAAYyD,EAAJ1D,EAAOA,IACnD,GAAKsG,EAAKwG,aAAa9M,GAAvB,CAGA,GAAI+B,GAAOuE,EAAKwG,aAAa9M,GAAGkE,KAEhC,KAAItB,EAAOxB,QAAQW,GAGnB,IAAK,GAAIsN,GAAI,EAAG/K,EAAI1B,EAAOzB,MAAMlB,OAAYqE,EAAJ+K,EAAOA,IAC9C,GAAIzM,EAAOzB,MAAMkO,GAAGtN,MAAQA,EAA5B,CAGAyM,EAAiBS,EAASrM,EAAOzB,MAAMkO,GACvC,UASN,QAASC,GAAOL,GACd,GAAIM,IAAQ,CACZ,KACEC,EAAKP,EAAS,SAAS3I,EAAMqI,GAC3BE,EAAcI,EAAS3I,EAAMqI,GAC7BY,GAAQ,IAGZ,MAAMrD,GACJ2C,EAAcI,EAAS,KAAM/C,GAC7BqD,GAAQ,EAEV,MAAOA,GAIT,QAASb,GAAoBO,EAAS3I,GAKpC,GAFA2I,EAAQG,iBAEJH,EAAQG,aAAe,GAA3B,CAIA,GAAID,GAAeF,EAAQE,YAK3B,IAAIF,EAAQrM,OAAO1B,UAAUyF,WAAY,EAAO,CAE9C,IAAK,GADDxF,MAAW4D,OAAOkK,EAAQ9N,OACrBnB,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC5C,GAAIsG,GAAOnF,EAAMnB,EACjBsG,GAAKsD,QACH7H,KAAMuE,EAAKvE,KACX6H,OAAQ6F,MACR9F,WAAW,GAEbrD,EAAKqG,OAAS,SACd+C,EAAWT,EAAQrM,OAAQ0D,GAE7B,MAAO2I,GAAQ5D,QAAQ8D,GAIzB,GAAIQ,GAASL,EAAOL,EAEhBU,IAGJV,EAAQ5D,QAAQ8D,IAIlB,QAASN,GAAcI,EAAS3I,EAAMqI,GACpC,GAAI/L,GAASqM,EAAQrM,MAGrBgN,GACA,GAAItJ,EACF,GAAI2I,EAAQ9N,MAAM,GAAGY,MAAQuE,EAAKvE,KAChC4M,EAAMpP,EAAWoP,EAAK,iBAAmBrI,EAAKvE,UAE3C,CACH,IAAK,GAAI/B,GAAI,EAAGA,EAAIiP,EAAQ9N,MAAMlB,OAAQD,IAExC,IAAK,GADD6P,GAAQZ,EAAQ9N,MAAMnB,GACjBqP,EAAI,EAAGA,EAAIQ,EAAM/C,aAAa7M,OAAQoP,IAAK,CAClD,GAAIS,GAAMD,EAAM/C,aAAauC,EAC7B,IAAIS,EAAI5L,OAASoC,EAAKvE,KAAM,CAC1B4M,EAAMpP,EAAWoP,EAAK,iBAAmBrI,EAAKvE,KAAO,QAAU+N,EAAIvB,IAAM,UAAYsB,EAAM9N,KAC3F,MAAM6N,IAIZjB,EAAMpP,EAAWoP,EAAK,iBAAmBrI,EAAKvE,KAAO,SAAWkN,EAAQ9N,MAAM,GAAGY,UAInF4M,GAAMpP,EAAWoP,EAAK,iBAAmBM,EAAQ9N,MAAM,GAAGY,KAK5D,KAAK,GADDZ,GAAQ8N,EAAQ9N,MAAM4D,WACjB/E,EAAI,EAAG0D,EAAIvC,EAAMlB,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC5C,GAAIsG,GAAOnF,EAAMnB,EAGjB4C,GAAO1B,UAAU6O,OAASnN,EAAO1B,UAAU6O,WACQ,IAA/C5P,EAAQuB,KAAKkB,EAAO1B,UAAU6O,OAAQzJ,IACxC1D,EAAO1B,UAAU6O,OAAO/Q,KAAKsH,EAE/B,IAAI0J,GAAY7P,EAAQuB,KAAK4E,EAAKuG,SAAUoC,EAE5C,IADA3I,EAAKuG,SAASoD,OAAOD,EAAW,GACJ,GAAxB1J,EAAKuG,SAAS5M,OAAa,CAC7B,GAAIiQ,GAAmB/P,EAAQuB,KAAKuN,EAAQrM,OAAOzB,MAAOmF,EAClC,KAApB4J,GACFjB,EAAQrM,OAAOzB,MAAM8O,OAAOC,EAAkB,IAGpDjB,EAAQtB,OAAOgB,GAIjB,QAASe,GAAW9M,EAAQ0D,GAE1B,GAAI1D,EAAO1B,UAAUiP,MAAO,CACrBvN,EAAO1B,UAAUC,QACpByB,EAAO1B,UAAUC,SACnB,IAAIiP,KACJ9J,GAAKwG,aAAauD,QAAQ,SAASP,GACjCM,EAAON,EAAIvB,KAAOuB,EAAI5L,QAExBtB,EAAO1B,UAAUC,MAAMmF,EAAKvE,OAC1BA,KAAMuE,EAAKvE,KACXwB,KAAM+C,EAAKwG,aAAaxH,IAAI,SAASwK,GAAM,MAAOA,GAAIvB,MACtD6B,OAAQA,EACRlD,QAAS5G,EAAK4G,QACd1G,SAAUF,EAAKE,SACf0C,OAAQ5C,EAAK4C,QAIb5C,EAAKvE,OACPa,EAAOxB,QAAQkF,EAAKvE,MAAQuE,EAAKsD,OAEnC,IAAI0G,GAAYnQ,EAAQuB,KAAKkB,EAAOzB,MAAOmF,EAC1B,KAAbgK,GACF1N,EAAOzB,MAAM8O,OAAOK,EAAW,EACjC,KAAK,GAAItQ,GAAI,EAAG0D,EAAI4C,EAAKuG,SAAS5M,OAAYyD,EAAJ1D,EAAOA,IAC/CsQ,EAAYnQ,EAAQuB,KAAK4E,EAAKuG,SAAS7M,GAAGmB,MAAOmF,GAChC,IAAbgK,GACFhK,EAAKuG,SAAS7M,GAAGmB,MAAM8O,OAAOK,EAAW,EAE7ChK,GAAKuG,SAASoD,OAAO,EAAG3J,EAAKuG,SAAS5M,QAGxC,QAASsQ,GAAiBtB,EAAS3I,EAAMkK,GACvC,IACE,GAAI5G,GAAStD,EAAKK,UAEpB,MAAMuF,GAEJ,WADAsE,GAAUlK,EAAM4F,GAGlB,MAAKtC,IAAYA,YAAkB9I,GAG1B8I,MAFP4G,GAAUlK,EAAM,GAAI7I,WAAU,4CAWlC,QAASgT,GAAoB7N,EAAQb,EAAM2O,GACzC,GAAIrP,GAAiBuB,EAAO3B,QAAQI,cACpC,OAAOA,GAAeU,GAAQ2O,EAAQ5F,KAAK,SAASpN,GAElD,MADA2D,GAAeU,GAAQvD,OAChBd,GACN,SAASwO,GAEV,KADA7K,GAAeU,GAAQvD,OACjB0N,IAmKV,QAASsD,GAAKP,EAASuB,GAErB,GAAI5N,GAASqM,EAAQrM,MAErB,IAAKqM,EAAQ9N,MAAMlB,OAKnB,IAAK,GAFDkB,GAAQ8N,EAAQ9N,MAAM4D,WAEjB/E,EAAI,EAAGA,EAAImB,EAAMlB,OAAQD,IAAK,CACrC,GAAIsG,GAAOnF,EAAMnB,GAEb4J,EAAS2G,EAAiBtB,EAAS3I,EAAMkK,EAC7C,KAAK5G,EACH,MACFtD,GAAKsD,QACH7H,KAAMuE,EAAKvE,KACX6H,OAAQA,GAEVtD,EAAKqG,OAAS,SAEd+C,EAAW9M,EAAQ0D,IAnoBvB,GAAIsG,GAAU,CA+cd7L,GAAOiB,WAEL2O,YAAa5P,EAEb6P,OAAQ,SAAS7O,EAAMmH,EAAQlI,GAE7B,GAAI9B,KAAK+B,QAAQI,eAAeU,GAC9B,KAAM,IAAItE,WAAU,6BACtB,OAAOgT,GAAoBvR,KAAM6C,EAAM,GAAIqJ,SAAQ4B,GACjDC,KAAM,YACNrK,OAAQ1D,KAAK+B,QACbkM,WAAYpL,EACZqL,eAAgBpM,GAAWA,EAAQwF,aACnC6G,aAAcnE,EACdoE,cAAetM,GAAWA,EAAQkM,aAItC2D,SAAU,SAAS9O,GACjB,GAAIa,GAAS1D,KAAK+B,OAGlB,cAFO2B,GAAOvB,eAAeU,SACtBa,GAAOtB,cAAcS,GACrBa,EAAOxB,QAAQW,SAAea,GAAOxB,QAAQW,IAAQ,GAI9DP,IAAK,SAAS+M,GACZ,MAAKrP,MAAK+B,QAAQG,QAAQmN,GAEnBrP,KAAK+B,QAAQG,QAAQmN,GAAK3E,OAFjC,QAKFpB,IAAK,SAASzG,GACZ,QAAS7C,KAAK+B,QAAQG,QAAQW,IAGhC+O,SAAU,SAAS/O,EAAMuG,EAAYyI,GACV,gBAAdzI,KACTA,EAAaA,EAAWvG,KAG1B,IAAIb,GAAYhC,IAGhB,OAAOkM,SAAQC,QAAQnK,EAAU2J,UAAU9I,EAAMuG,IAChDwC,KAAK,SAAS/I,GACb,GAAIa,GAAS1B,EAAUD,OAEvB,OAAI2B,GAAOxB,QAAQW,GACVa,EAAOxB,QAAQW,GAAM6H,OAEvBhH,EAAOvB,eAAeU,IAAS0O,EAAoBvP,EAAWa,EACnEgL,EAAWnK,EAAQb,MAClB+I,KAAK,SAASxE,GAEb,aADO1D,GAAOvB,eAAeU,GACtBuE,EAAKsD,OAAOA,aAM3BtD,KAAM,SAASvE,GACb,GAAIa,GAAS1D,KAAK+B,OAClB,OAAI2B,GAAOxB,QAAQW,GACVqJ,QAAQC,WACTzI,EAAOvB,eAAeU,IAAS0O,EAAoBvR,KAAM6C,EAAM,GAAIqJ,SAAQ4B,GACjFC,KAAM,SACNrK,OAAQA,EACRuK,WAAYpL,EACZqL,kBACAC,aAAc7O,OACd8O,cAAe9O,UAEhBsM,KAAK,SAASxE,GAEb,aADO1D,GAAOvB,eAAeU,GACtBuE,EAAKsD,OAAOA,WAEpBkB,KAAK,eAGRlB,OAAQ,SAASV,EAAQlI,GACvB,GAAIsF,GAAOoG,GACXpG,GAAK4G,QAAUlM,GAAWA,EAAQkM,OAClC,IAAI+B,GAAUC,EAAchQ,KAAK+B,QAASqF,GACtC0K,EAAgB5F,QAAQC,QAAQnC,GAChCtG,EAAS1D,KAAK+B,QACdnC,EAAImQ,EAAQD,KAAKlE,KAAK,WACxB,MAAOxE,GAAKsD,OAAOA,QAGrB,OADAmE,GAAmBnL,EAAQ0D,EAAM0K,GAC1BlS,GAGT4I,UAAW,SAAUyE,GACnB,GAAkB,gBAAPA,GACT,KAAM,IAAI1O,WAAU,kBAEtB,IAAIC,GAAI,GAAIoD,GAERmQ,IACJ,IAAI1M,OAAO2M,qBAA8B,MAAP/E,EAChC8E,EAAS1M,OAAO2M,oBAAoB/E,OAEpC,KAAK,GAAIoC,KAAOpC,GACd8E,EAAOjS,KAAKuP,EAEhB,KAAK,GAAIvO,GAAI,EAAGA,EAAIiR,EAAOhR,OAAQD,KAAK,SAAUuO,GAChDhN,EAAe7D,EAAG6Q,GAChB4C,cAAc,EACdC,YAAY,EACZ5P,IAAK,WACH,MAAO2K,GAAIoC,IAEb/G,IAAK,WACH,KAAM,IAAI7G,OAAM,qDAGnBsQ,EAAOjR,GAKV,OAHIuE,QAAO8M,QACT9M,OAAO8M,OAAO3T,GAETA,GAGT8J,IAAK,SAASzF,EAAM6H,GAClB,KAAMA,YAAkB9I,IACtB,KAAM,IAAIrD,WAAU,cAAgBsE,EAAO,6BAC7C7C,MAAK+B,QAAQG,QAAQW,IACnB6H,OAAQA,IAQZiB,UAAW,SAAS9I,EAAMuP,EAAcC,KAExCzD,OAAQ,SAASxH,GACf,MAAOA,GAAKvE,MAGdiM,MAAO,SAAS1H,KAGhB2H,UAAW,SAAS3H,GAClB,MAAOA,GAAK4C,QAGdgF,YAAa,SAAS5H,KAIxB,IAAImJ,GAAa1O,EAAOiB,UAAU0F,YAgCpC,IAAI8J,GACEC,CACJ,IAA6B,mBAAlBC,gBACTD,EAAmB,SAASlU,EAAKoU,EAAeC,EAASjE,GAsBvD,QAASrH,KACPsL,EAAQC,EAAIC,cAEd,QAASvC,KACP5B,EAAO,GAAIhN,OAAM,aAAekR,EAAIlF,OAAS,KAAOkF,EAAIlF,QAAUkF,EAAIE,WAAa,IAAMF,EAAIE,WAAc,IAAM,IAAM,IAAM,YAAcxU,IAzB7I,GAAIsU,GAAM,GAAIH,gBACVM,GAAa,EACbC,GAAY,CAChB,MAAM,mBAAqBJ,IAAM,CAE/B,GAAIK,GAAc,uBAAuBC,KAAK5U,EAC1C2U,KACFF,EAAaE,EAAY,KAAOxG,OAAOa,SAASrO,KAC5CgU,EAAY,KACdF,GAAcE,EAAY,KAAOxG,OAAOa,SAASxO,WAGlDiU,GAAuC,mBAAlBI,kBACxBP,EAAM,GAAIO,gBACVP,EAAIQ,OAAS/L,EACbuL,EAAIS,QAAU/C,EACdsC,EAAIU,UAAYhD,EAChBsC,EAAIW,WAAa,aACjBX,EAAIY,QAAU,EACdR,GAAY,GASdJ,EAAIa,mBAAqB,WACA,IAAnBb,EAAIc,aAEY,GAAdd,EAAIlF,OACFkF,EAAIC,aACNxL,KAKAuL,EAAIe,iBAAiB,QAASrD,GAC9BsC,EAAIe,iBAAiB,OAAQtM,IAGT,MAAfuL,EAAIlF,OACXrG,IAGAiJ,MAINsC,EAAIgB,KAAK,MAAOtV,GAAK,GAEjBsU,EAAIiB,mBACNjB,EAAIiB,iBAAiB,SAAU,gCAE3BnB,IAC0B,gBAAjBA,IACTE,EAAIiB,iBAAiB,gBAAiBnB,GACxCE,EAAIkB,iBAAkB,IAItBd,EACFe,WAAW,WACTnB,EAAIoB,QACH,GAEHpB,EAAIoB,KAAK,WAIV,IAAsB,mBAAX5K,UAA4C,mBAAXwD,SAAwB,CACvE,GAAIqH,EACJzB,GAAmB,SAASlU,EAAKoU,EAAeC,EAASjE,GACvD,GAAwB,YAApBpQ,EAAI+C,OAAO,EAAG,GAChB,KAAM,IAAIK,OAAM,oBAAsBpD,EAAM,kEAM9C,OALA2V,GAAKA,GAAM7K,QAAQ,MAEjB9K,EADEiD,EACIjD,EAAIK,QAAQ,MAAO,MAAM0C,OAAO,GAEhC/C,EAAI+C,OAAO,GACZ4S,EAAGC,SAAS5V,EAAK,SAASiC,EAAK4T,GACpC,GAAI5T,EACF,MAAOmO,GAAOnO,EAId,IAAI6T,GAAaD,EAAO,EACF,YAAlBC,EAAW,KACbA,EAAaA,EAAW/S,OAAO,IAEjCsR,EAAQyB,UAKX,CAAA,GAAmB,mBAARhU,OAA4C,mBAAdA,MAAK2O,MAwBjD,KAAM,IAAIvQ,WAAU,sCAvBpBgU,GAAmB,SAASlU,EAAKoU,EAAeC,EAASjE,GACvD,GAAI2F,IACFC,SAAUC,OAAU,gCAGlB7B,KAC0B,gBAAjBA,KACT2B,EAAKC,QAAuB,cAAI5B,GAClC2B,EAAKG,YAAc,WAGrBzF,MAAMzQ,EAAK+V,GACRxI,KAAK,SAAU4I,GACd,GAAIA,EAAEC,GACJ,MAAOD,GAAEE,MAET,MAAM,IAAIjT,OAAM,gBAAkB+S,EAAE/G,OAAS,IAAM+G,EAAE3B,cAGxDjH,KAAK8G,EAASjE,IASvB,GAAIkG,GAAY,WAKd,QAASA,GAAUvN,GACjB,GAAIjH,GAAOH,IAEX,OAAOkM,SAAQC,QAAQ/L,EAA4B,cAAnBD,EAAKyU,WAA6B,KAAOzU,EAAKyU,cACtEzU,EAAK0U,cAAgB1U,GAAM,UAAUA,EAAKyU,aACjDhJ,KAAK,SAASgJ,GACTA,EAAWE,eACbF,EAAaA,EAAW,WAE1B,IAAIG,EASJ,OAPEA,GADEH,EAAWI,SACOC,EACbL,EAAWM,sBACEC,EAEAC,EAGf,2BAA6BL,EAAkBvS,KAAKrC,EAAMiH,EAAMwN,GAAc,SAAWxN,EAAKvE,KAAO,sBAAwBuE,EAAK4G,QAAU,gBAIvJ,QAASiH,GAAiB7N,EAAMiO,GAC9B,GAAIvT,GAAU9B,KAAKsV,kBACnBxT,GAAQI,QAAU,cAClBJ,EAAQyT,QAAS,EACUjW,SAAvBwC,EAAQ0T,aACV1T,EAAQ0T,WAAa,UACvB1T,EAAQ2T,SAAWrO,EAAK4G,QACxBlM,EAAQ4T,eAAiBtO,EAAKE,SAASqO,UACvC7T,EAAQmM,YAAa,CAErB,IAAI2H,GAAW,GAAIP,GAAQL,SAASlT,EAEpC,OAAO+T,GAAiBzO,EAAK4C,OAAQ4L,EAAU9T,EAAQ2T,UAEzD,QAASI,GAAiB7L,EAAQ4L,EAAUH,GAC1C,IACE,MAAOG,GAASE,QAAQ9L,EAAQyL,GAElC,MAAMzI,GAGJ,GAAIA,EAAEjM,OACJ,KAAMiM,GAAE,EAEV,MAAMA,IAIV,QAASoI,GAAehO,EAAM2O,GAC5B,GAAIjU,GAAU9B,KAAKgW,gBASnB,OARAlU,GAAQI,QAAU,SACQ5C,SAAtBwC,EAAQ6T,YACV7T,EAAQ6T,UAAY,UACtB7T,EAAQ4T,eAAiBtO,EAAKE,SAASqO,UACvC7T,EAAQ2T,SAAWrO,EAAK4G,QACxBlM,EAAQmU,MAAO,EACfnU,EAAQoU,KAAM,EAEPH,EAAMI,UAAU/O,EAAK4C,OAAQlI,GAASmU,KAG/C,QAASd,GAAoB/N,EAAMgP,GACjC,GAAItU,GAAU9B,KAAKqW,qBASnB,OARAvU,GAAQwU,OAASxU,EAAQwU,QAAUF,EAAGG,aAAaC,IACzBlX,SAAtBwC,EAAQ6T,YACV7T,EAAQ6T,WAAY,GAClB7T,EAAQ6T,WAAa7T,EAAQ2U,mBAAoB,IACnD3U,EAAQ2U,iBAAkB,GAE5B3U,EAAQ4I,OAAS0L,EAAGM,WAAWpE,OAExB8D,EAAGzB,UAAUvN,EAAK4C,OAAQlI,EAASsF,EAAK4G,SAGjD,MA9EAnM,GAAOiB,UAAU8R,WAAa,UA8EvBD,IAcThS,GAAYG,UAAYjB,EAAOiB,UAC/BP,EAAeO,UAAY,GAAIH,GAC/BJ,EAAeO,UAAU2O,YAAclP,CAEvC,IAAIG,GAUAO,EAAc,eAWdO,GAAa,GAAID,GAAID,GA6FrBuB,IAA2B,CAC/B,KACEQ,OAAOR,0BAA2BU,EAAG,GAAK,KAE5C,MAAMyH,GACJnI,IAA2B,EAgJ7B,GAAI8R,KAEJ,WAYE,QAASF,GAAgBG,GACvB,MAAIC,GACKC,EAAkB,GAAIC,QAAOH,GAAiBjW,SAAS,UACxC,mBAARqW,MACPF,EAAkBE,KAAKC,SAASC,mBAAmBN,KAEnD,GAGX,QAASO,GAAU/P,EAAMgQ,GACvB,GAAIC,GAAgBjQ,EAAK4C,OAAOtK,YAAY,KAGhB,WAAxB0H,EAAKE,SAASI,SAChB0P,GAAO,EAET,IAAIzB,GAAYvO,EAAKE,SAASqO,SAC9B,IAAIA,EAAW,CACb,GAAwB,gBAAbA,GACT,KAAM,IAAIpX,WAAU,oDAEtBoX,GAAY2B,KAAKC,UAAU5B,GAG7B,OAAQyB,EAAO,gCAAkC,IAAMhQ,EAAK4C,QAAUoN,EAAO,wBAA0B,KAEvD,oBAAzChQ,EAAK4C,OAAO5I,OAAOiW,EAAe,IACjC,mBAAqBjQ,EAAK4G,SAAW2H,EAAY,cAAgB,IAAM,KAExEA,GAAac,EAAgBd,IAAc,IAoBpD,QAAS6B,GAAQ9T,EAAQ0D,GACvBqQ,EAAUrQ,EACW,GAAjBsQ,MACFC,EAAYvX,EAASkS,QACvBlS,EAASkS,OAASlS,EAASwX,SAAWlU,EAExC,QAASmU,KACc,KAAfH,IACJtX,EAASkS,OAASlS,EAASwX,SAAWD,GACxCF,EAAUnY,OAuCZ,QAASwY,GAAW1Q,GACb2Q,IACHA,EAAOrL,SAASqL,MAAQrL,SAASsL,MAAQtL,SAASuL,gBAEpD,IAAI1C,GAAS7I,SAASwL,cAAc,SACpC3C,GAAOb,KAAOyC,EAAU/P,GAAM,EAC9B,IACI4F,GADAoG,EAAU5G,OAAO4G,OAkBrB,IAhBA5G,OAAO4G,QAAU,SAAS+E,GACxBnL,EAAI3M,EAAW8X,EAAI,cAAgB/Q,EAAK4G,SACpCoF,GACFA,EAAQgF,MAAMpY,KAAMqY,YAExBb,EAAQxX,KAAMoH,GAEVA,EAAKE,SAASgR,WAChB/C,EAAOgD,aAAa,YAAanR,EAAKE,SAASgR,WAC7ClR,EAAKE,SAASkR,OAChBjD,EAAOgD,aAAa,QAASnR,EAAKE,SAASkR,OAE7CT,EAAKU,YAAYlD,GACjBwC,EAAKW,YAAYnD,GACjBsC,IACArL,OAAO4G,QAAUA,EACbpG,EACF,KAAMA,GApIV,GAAI6J,GAA6B,mBAAVE,OACvB,KACMF,GAAmD,QAAtC,GAAIE,QAAO,KAAKpW,SAAS,YACxCkW,GAAY,GAEhB,MAAM7J,GACJ6J,GAAY,EAGd,GAiCIY,GAjCAX,EAAkB,sDAqCtBlU,GAAK,gBAAiB,WACpB,MAAO,UAAS+V,GACd,MAAKlB,IAGLzX,KAAK4Y,gBAAgBnB,EAASkB,IACvB,IAHE,IAQb,IAAIhB,GAcAkB,EACAC,EAdApB,EAAc,CAelBf,IAAS,SAASvP,GAChB,GAAKA,EAAK4C,OAAV,CAEA,IAAK5C,EAAKE,SAASgR,WAAalR,EAAKE,SAASkR,QAAUO,EACtD,MAAOjB,GAAWtV,KAAKxC,KAAMoH,EAC/B,KACEoQ,EAAQxX,KAAMoH,GACdqQ,EAAUrQ,GAEL0R,GAAM9Y,KAAK2I,eACdmQ,EAAK9Y,KAAK2I,aAAa,MACvBkQ,EAAQC,EAAGE,iBAAiB,6CAA+ChZ,MAEzE6Y,EACFC,EAAGE,iBAAiB7B,EAAU/P,GAAM,IAASqO,SAAUrO,EAAK4G,SAAW5G,EAAKE,SAASqO,UAAY,cAAgB,OAEhH,EAAGsD,MAAM9B,EAAU/P,GAAM,IAC5ByQ,IAEF,MAAM7K,GAEJ,KADA6K,KACMxX,EAAW2M,EAAG,cAAgB5F,EAAK4G,WAI7C,IAAI+K,IAAqB,CACrB1X,IAAgC,mBAAZqL,WAA2BA,SAASS,uBACpDX,OAAO0M,QAAU1M,OAAO0M,OAAOC,WAAaC,UAAUC,UAAU1a,MAAM,eAC1Eoa,GAAqB,GAKzB,IAAIhB,KA+DN,IAAIxP,GAYJxF,GAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MAGjBA,KAAK1B,QAAUgF,EAGftD,KAAKoG,OAGsB,mBAAhBpF,gBACThB,KAAKsZ,UAAYtY,aAAaE,KAGhClB,KAAKiH,UAAW,EAChBjH,KAAKuZ,qBAAsB,EAC3BvZ,KAAKwZ,aAAc,EACnBxZ,KAAKyZ,kBAAmB,EAQxBzZ,KAAKsI,IAAI,SAAUtI,KAAKwI,eAExBL,EAAc3F,KAAKxC,MAAM,GAAO,MAKd,mBAAXmJ,UAA4C,mBAAXwD,UAA2BA,QAAQlE,UAC7ElG,EAAeO,UAAU6F,aAAeQ,QAgB1C,IAAIF,GAqDJrG,GAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAYsQ,GAChC,GAAIC,GAAWnT,EAAYhE,KAAKxC,KAAM6C,EAAMuG,EAG5C,QAFIpJ,KAAKuZ,qBAAwBG,GAAsD,OAA3CC,EAASvY,OAAOuY,EAAS5Y,OAAS,EAAG,IAAgBoC,EAAQwW,KACvGA,GAAY,OACPA,IAKX,IAAIC,IAAuC,mBAAlBpH,eACzB5P,GAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,MAAO8E,SAAQC,QAAQyC,EAAOpM,KAAKxC,KAAMoH,IACxCwE,KAAK,SAASoC,GACb,MAAI4L,IACK5L,EAAQtP,QAAQ,KAAM,OACxBsP,OAQbpL,EAAK,QAAS,WACZ,MAAO,UAASwE,GACd,MAAO,IAAI8E,SAAQ,SAASC,EAASsC,GACnC8D,EAAiBnL,EAAK4G,QAAS5G,EAAKE,SAASmL,cAAetG,EAASsC,QAmB3E7L,EAAK,SAAU,SAASiX,GACtB,MAAO,UAAShX,EAAMuG,EAAYyI,GAGhC,MAFIzI,IAAcA,EAAWvG,MAC3B4D,EAAKjE,KAAKxC,KAAM,oHAAsH6C,EAAO,SAAWuG,EAAWvG,MAC9JgX,EAAarX,KAAKxC,KAAM6C,EAAMuG,EAAYyI,GAAejG,KAAK,SAASlB,GAC5E,MAAOA,GAAOoK,aAAepK,EAAO,WAAaA,OAQvD9H,EAAK,YAAa,SAASkX,GACzB,MAAO,UAAS1S,GAGd,MAF4B,UAAxBA,EAAKE,SAASI,SAChBN,EAAKE,SAASI,OAASpI,QAClBwa,EAAgB1B,MAAMpY,KAAMqY,cA0BvCzV,EAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACd,GAA4B,QAAxBA,EAAKE,SAASI,SAAqB1H,KAAKuJ,QAAS,CACnD,GAAIhC,GAAQH,EAAKE,SAASC,MAAQC,GAClCD,GAAMlD,QACNkD,EAAME,QAAU,WACd,IACE,MAAO6P,MAAKyC,MAAM3S,EAAK4C,QAEzB,MAAMgD,GACJ,KAAM,IAAIvL,OAAM,qBAAuB2F,EAAKvE,YAsDtDN,EAAeO,UAAUkX,UAAY,SAASnX,GAC5C,GAAI8D,MACAjD,EAAS1D,IACb,KAAK,GAAIJ,KAAK8D,GACRA,EAAOK,iBAAmBL,EAAOK,eAAenE,IAAMA,IAAK2C,GAAeO,WAAkB,cAALlD,GAEa,IAApGqB,EAAQuB,MAAM,UAAW,YAAa,aAAc,UAAW,SAAU,UAAW,SAAU5C,KAChG+G,EAAI/G,GAAK8D,EAAO9D,GAGpB,OADA+G,GAAIiC,WAAaL,GAAUK,WACpBjC,EAGT,IAAIsT,GACJ1X,GAAeO,UAAUoX,OAAS,SAASvT,EAAKwT,GAiC1C,QAASC,GAAenN,GACtB,IAAK,GAAIrN,KAAKqN,GACZ,GAAIA,EAAIlJ,eAAenE,GACrB,OAAO,EAnCjB,GAAI8D,GAAS1D,IAoBb,IAlBI,oBAAsB2G,KACxBsT,GAAejZ,aACX2F,EAAI8S,iBACNzY,aAAe1B,OAEf0B,aAAeiZ,IAGf,YAActT,KAChBjD,EAAOuD,SAAWN,EAAIM,UAGpBN,EAAI0T,qBAAsB,IAC5B3W,EAAO3B,QAAQuY,yBAA0B,IAEvC,cAAgB3T,IAAO,SAAWA,KACpCwB,EAAc3F,KAAKkB,IAAUiD,EAAIiC,cAAejC,EAAImC,OAASP,IAAaA,GAAUO,SAEjFqR,EAAa,CAGhB,GAAI7b,EAOJ,IANAkL,EAAO9F,EAAQiD,EAAK,SAASA,GAC3BrI,EAAUA,GAAWqI,EAAIrI,UAE3BA,EAAUA,GAAWqI,EAAIrI,QAGZ,CAOX,GAAI8b,EAAe1W,EAAOoD,WAAasT,EAAe1W,EAAO2C,OAAS+T,EAAe1W,EAAO4C,WAAa8T,EAAe1W,EAAO6W,UAAYH,EAAe1W,EAAO8W,oBAC/J,KAAM,IAAIjc,WAAU,qGAEtByB,MAAK1B,QAAUA,EACf4J,EAAe1F,KAAKxC,MAYtB,GATI2G,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,OAE3B+G,EAAO9F,EAAQiD,EAAK,SAASA,GACvBA,EAAIlE,OACNsC,EAAOrB,EAAOjB,MAAOkE,EAAIlE,SAIzBzC,KAAKiH,SACP,IAAK,GAAIrH,KAAK8D,GAAOjB,MACG,IAAlB7C,EAAEqB,QAAQ,MACZwF,EAAKjE,KAAKkB,EAAQ,wBAA0B9D,EAAI,SAAW8D,EAAOjB,MAAM7C,GAAK,yGAYrF,GARI+G,EAAI4S,sBACN7V,EAAO6V,oBAAsB5S,EAAI4S,oBACjC9S,EAAKjE,KAAKkB,EAAQ,oGAGhBiD,EAAI6S,cACN9V,EAAO8V,YAAc7S,EAAI6S,aAEvB7S,EAAIP,IACN,IAAK,GAAIxG,KAAK+G,GAAIP,IAAK,CACrB,GAAIqU,GAAI9T,EAAIP,IAAIxG,EAGhB,IAAiB,gBAAN6a,GAAgB,CACzB,GAAIC,GAAqBhX,EAAO6V,qBAAoD,OAA7B3Z,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAOiX,eAAe/a,EAC7B8a,IAAyD,OAAnCvU,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,GAGtC,IAAI6Z,GAAW,EACf,KAAK,GAAI/T,KAAOnD,GAAOoD,SACjBX,EAAK/E,OAAO,EAAGyF,EAAI9F,SAAW8F,KACzBV,EAAKU,EAAI9F,SAA+B,KAApBoF,EAAKU,EAAI9F,UAC/B6Z,EAASha,MAAM,KAAKG,OAAS8F,EAAIjG,MAAM,KAAKG,SACjD6Z,EAAW/T,EAEX+T,IAAYlX,EAAOoD,SAAS8T,GAAU5T,OACxCb,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS2C,EAAOoD,SAAS8T,GAAU5T,KAAKjG,OAAS,GAE9E,IAAI8F,GAAMnD,EAAOoD,SAASX,GAAQzC,EAAOoD,SAASX,MAClDU,GAAIT,IAAMqU,MAGV/W,GAAO0C,IAAIxG,GAAK6a,EAKtB,GAAI9T,EAAI6T,mBAAoB,CAE1B,IAAK,GADDA,MACK1Z,EAAI,EAAGA,EAAI6F,EAAI6T,mBAAmBzZ,OAAQD,IAAK,CACtD,GAAIkD,GAAO2C,EAAI6T,mBAAmB1Z,GAC9B+Z,EAAgBC,KAAKC,IAAI/W,EAAKtE,YAAY,KAAO,EAAGsE,EAAKtE,YAAY,MACrEsb,EAAaxU,EAAYhE,KAAKkB,EAAQM,EAAK5C,OAAO,EAAGyZ,GACzDL,GAAmB1Z,GAAKka,EAAahX,EAAK5C,OAAOyZ,GAEnDnX,EAAO8W,mBAAqBA,EAG9B,GAAI7T,EAAI4T,QACN,IAAK,GAAI3a,KAAK+G,GAAI4T,QAAS,CAEzB,IAAK,GADDU,MACKna,EAAI,EAAGA,EAAI6F,EAAI4T,QAAQ3a,GAAGmB,OAAQD,IAAK,CAC9C,GAAI4Z,GAAqBhX,EAAO6V,qBAAoF,OAA7D5S,EAAI4T,QAAQ3a,GAAGkB,GAAGM,OAAOuF,EAAI4T,QAAQ3a,GAAGkB,GAAGC,OAAS,EAAG,GAC1Gma,EAAsBxX,EAAOiX,eAAehU,EAAI4T,QAAQ3a,GAAGkB,GAC3D4Z,IAAuF,OAAjEQ,EAAoB9Z,OAAO8Z,EAAoBna,OAAS,EAAG,KACnFma,EAAsBA,EAAoB9Z,OAAO,EAAG8Z,EAAoBna,OAAS,IACnFka,EAAOnb,KAAKob,GAEdxX,EAAO6W,QAAQ3a,GAAKqb,EAIxB,GAAItU,EAAIG,SACN,IAAK,GAAIlH,KAAK+G,GAAIG,SAAU,CAC1B,GAAIlH,EAAEjB,MAAM,oBACV,KAAM,IAAIJ,WAAU,IAAMqB,EAAI,iCAEhC,IAAIuG,GAAOK,EAAYhE,KAAKkB,EAAQ9D,EAGP,MAAzBuG,EAAKA,EAAKpF,OAAS,KACrBoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IAEtC2F,EAAahD,EAAQyC,EAAMQ,EAAIG,SAASlH,IAAI,GAIhD,IAAK,GAAIub,KAAKxU,GAAK,CACjB,GAAI8T,GAAI9T,EAAIwU,EAEZ,IACgH,IAD5Gla,EAAQuB,MAAM,UAAW,MAAO,WAAY,UAAW,QAAS,WAAY,qBAC1E,mBAAoB,gBAAiB,aAAc,YAAa,cAAe,oBAAqB2Y,GAG1G,GAAgB,gBAALV,IAAiBA,YAAa7U,OACvClC,EAAOyX,GAAKV,MAET,CACH/W,EAAOyX,GAAKzX,EAAOyX,MAEnB,KAAK,GAAIvb,KAAK6a,GAEZ,GAAS,QAALU,GAAuB,KAARvb,EAAE,GACnBmF,EAAOrB,EAAOyX,GAAGvb,GAAK8D,EAAOyX,GAAGvb,OAAU6a,EAAE7a,QAEzC,IAAS,QAALub,EAAa,CAEpB,GAAIxB,GAAWnT,EAAYhE,KAAKkB,EAAQ9D,EACpC8D,GAAO6V,qBAAkE,OAA3CI,EAASvY,OAAOuY,EAAS5Y,OAAS,EAAG,KAAgBoC,EAAQwW,KAC7FA,GAAY,OACd5U,EAAOrB,EAAOyX,GAAGxB,GAAYjW,EAAOyX,GAAGxB,OAAiBc,EAAE7a,QAEvD,IAAS,YAALub,EAAiB,CACxB,GAAIT,GAAqBhX,EAAO6V,qBAAoD,OAA7B3Z,EAAEwB,OAAOxB,EAAEmB,OAAS,EAAG,GAC1EoF,EAAOzC,EAAOiX,eAAe/a,EAC7B8a,IAAyD,OAAnCvU,EAAK/E,OAAO+E,EAAKpF,OAAS,EAAG,KACrDoF,EAAOA,EAAK/E,OAAO,EAAG+E,EAAKpF,OAAS,IACtC2C,EAAOyX,GAAGhV,MAAWN,OAAO4U,EAAE7a,QAG9B8D,GAAOyX,GAAGvb,GAAK6a,EAAE7a,IAMzB4J,EAAO9F,EAAQiD,EAAK,SAASA,GAC3BjD,EAAOwW,OAAOvT,GAAK,MA6FvB,WAUE,QAASyU,GAAW1X,EAAQsX,GAE1B,GAAIK,GAAuBC,EAAfC,EAAY,CACxB,KAAK,GAAI3b,KAAK8D,GAAOoD,SACfkU,EAAW5Z,OAAO,EAAGxB,EAAEmB,UAAYnB,GAAMob,EAAWja,SAAWnB,EAAEmB,QAAmC,MAAzBia,EAAWpb,EAAEmB,UAC1Fua,EAAS1b,EAAEgB,MAAM,KAAKG,OAClBua,EAASC,IACXF,EAASzb,EACT2b,EAAYD,GAIlB,OAAOD,GAGT,QAASG,GAAoB9X,EAAQmD,EAAKZ,EAASwV,EAASC,GAE1D,IAAKD,GAA0C,KAA/BA,EAAQA,EAAQ1a,OAAS,IAAa2a,GAAkB7U,EAAI8U,oBAAqB,EAC/F,MAAOF,EAET,IAAIG,IAAY,CAgBhB,IAbI/U,EAAIR,MACNwV,EAAehV,EAAIR,KAAMoV,EAAS,SAASK,EAAaC,EAAWC,GACjE,MAAkB,IAAdA,GAAmBF,EAAYpc,YAAY,MAAQoc,EAAY/a,OAAS,EACnE6a,GAAY,EADrB,UAKCA,GAAalY,EAAO2C,MACvBwV,EAAenY,EAAO2C,KAAMJ,EAAU,IAAMwV,EAAS,SAASK,EAAaC,EAAWC,GACpF,MAAkB,IAAdA,GAAmBF,EAAYpc,YAAY,MAAQoc,EAAY/a,OAAS,EACnE6a,GAAY,EADrB,SAIAA,EACF,MAAOH,EAIT,IAAIE,GAAmB,KAAO9U,EAAI8U,kBAAoB,KACtD,OAAIF,GAAQra,OAAOqa,EAAQ1a,OAAS4a,EAAiB5a,SAAW4a,EACvDF,EAAUE,EAEVF,EAGX,QAASQ,GAAuBvY,EAAQmD,EAAKZ,EAASwV,EAASC,GAE7D,IAAKD,EAAS,CACZ,IAAI5U,EAAIG,KAMN,MAAOf,IAAWvC,EAAO6V,oBAAsB,MAAQ,GALvDkC,GAAmC,MAAzB5U,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAIH,EAAIT,IAAK,CACX,GAAI8V,GAAU,KAAOT,EAEjBpS,EAAWvB,EAAYjB,EAAIT,IAAK8V,EAQpC,IALK7S,IACH6S,EAAU,KAAOV,EAAoB9X,EAAQmD,EAAKZ,EAASwV,EAASC,GAChEQ,GAAW,KAAOT,IACpBpS,EAAWvB,EAAYjB,EAAIT,IAAK8V,KAEhC7S,EAAU,CACZ,GAAI8S,GAASC,EAAU1Y,EAAQmD,EAAKZ,EAASoD,EAAU6S,EAASR,EAChE,IAAIS,EACF,MAAOA,IAKb,MAAOlW,GAAU,IAAMuV,EAAoB9X,EAAQmD,EAAKZ,EAASwV,EAASC,GAG5E,QAASW,GAAahT,EAAU8S,EAAQlW,EAASjC,GAE/C,GAAgB,KAAZqF,EACF,KAAM,IAAI5H,OAAM,WAAawE,EAAU,mDAIzC,OAAIkW,GAAO/a,OAAO,EAAGiI,EAAStI,SAAWsI,GAAYrF,EAAKjD,OAASsI,EAAStI,QACnE,GAEF,EAGT,QAASqb,GAAU1Y,EAAQmD,EAAKZ,EAASoD,EAAUrF,EAAM0X,GAC1B,KAAzB1X,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GACtC,IAAIob,GAAStV,EAAIT,IAAIiD,EAErB,IAAqB,gBAAV8S,GACT,KAAM,IAAI1a,OAAM,wEAA0E4H,EAAW,OAASpD,EAEhH,IAAKoW,EAAahT,EAAU8S,EAAQlW,EAASjC,IAA0B,gBAAVmY,GAA7D,CAIA,GAAc,KAAVA,EACFA,EAASlW,MAGN,IAA2B,MAAvBkW,EAAO/a,OAAO,EAAG,GACxB,MAAO6E,GAAU,IAAMuV,EAAoB9X,EAAQmD,EAAKZ,EAASkW,EAAO/a,OAAO,GAAK4C,EAAK5C,OAAOiI,EAAStI,QAAS2a,EAGpH,OAAOhY,GAAO4Y,cAAcH,EAASnY,EAAK5C,OAAOiI,EAAStI,QAASkF,EAAU,MAG/E,QAASsW,GAAmB7Y,EAAQmD,EAAKZ,EAASwV,EAASC,GAEzD,IAAKD,EAAS,CACZ,IAAI5U,EAAIG,KAMN,MAAOkF,SAAQC,QAAQlG,GAAWvC,EAAO6V,oBAAsB,MAAQ,IALvEkC,GAAmC,MAAzB5U,EAAIG,KAAK5F,OAAO,EAAG,GAAayF,EAAIG,KAAK5F,OAAO,GAAKyF,EAAIG,KASvE,GAAIkV,GAAS7S,CAcb,OAZIxC,GAAIT,MACN8V,EAAU,KAAOT,EACjBpS,EAAWvB,EAAYjB,EAAIT,IAAK8V,GAG3B7S,IACH6S,EAAU,KAAOV,EAAoB9X,EAAQmD,EAAKZ,EAASwV,EAASC,GAChEQ,GAAW,KAAOT,IACpBpS,EAAWvB,EAAYjB,EAAIT,IAAK8V,OAI9B7S,EAAWmT,EAAM9Y,EAAQmD,EAAKZ,EAASoD,EAAU6S,EAASR,GAAkBxP,QAAQC,WAC3FP,KAAK,SAASuQ,GACb,MAAIA,GACKjQ,QAAQC,QAAQgQ,GAGlBjQ,QAAQC,QAAQlG,EAAU,IAAMuV,EAAoB9X,EAAQmD,EAAKZ,EAASwV,EAASC,MAI9F,QAASe,GAAY/Y,EAAQmD,EAAKZ,EAASoD,EAAU8S,EAAQnY,EAAM0X,GAGjE,GAAc,KAAVS,EACFA,EAASlW,MAGN,IAA2B,MAAvBkW,EAAO/a,OAAO,EAAG,GACxB,MAAO8K,SAAQC,QAAQlG,EAAU,IAAMuV,EAAoB9X,EAAQmD,EAAKZ,EAASkW,EAAO/a,OAAO,GAAK4C,EAAK5C,OAAOiI,EAAStI,QAAS2a,IACjI9P,KAAK,SAAS/I,GACb,MAAOkJ,GAAuBvJ,KAAKkB,EAAQb,EAAMoD,EAAU,MAI/D,OAAOvC,GAAOiI,UAAUwQ,EAASnY,EAAK5C,OAAOiI,EAAStI,QAASkF,EAAU,KAG3E,QAASuW,GAAM9Y,EAAQmD,EAAKZ,EAASoD,EAAUrF,EAAM0X,GACtB,KAAzB1X,EAAKA,EAAKjD,OAAS,KACrBiD,EAAOA,EAAK5C,OAAO,EAAG4C,EAAKjD,OAAS,GAEtC,IAAIob,GAAStV,EAAIT,IAAIiD,EAErB,IAAqB,gBAAV8S,GACT,MAAKE,GAAahT,EAAU8S,EAAQlW,EAASjC,GAEtCyY,EAAY/Y,EAAQmD,EAAKZ,EAASoD,EAAU8S,EAAQnY,EAAM0X,GADxDxP,QAAQC,SAKnB,IAAIzI,EAAO6F,QACT,MAAO2C,SAAQC,QAAQlG,EAAU,MAAQjC,EAG3C,IAAI0Y,MACAC,IACJ,KAAK,GAAI3P,KAAKmP,GAAQ,CACpB,GAAIhB,GAAIpQ,EAAeiC,EACvB2P,GAAW7c,MACTkL,UAAWmQ,EACX/U,IAAK+V,EAAOnP,KAEd0P,EAAkB5c,KAAK4D,EAAO,UAAUyX,EAAEzQ,OAAQzE,IAIpD,MAAOiG,SAAQqD,IAAImN,GAClB9Q,KAAK,SAASgR,GAEb,IAAK,GAAI9b,GAAI,EAAGA,EAAI6b,EAAW5b,OAAQD,IAAK,CAC1C,GAAIqa,GAAIwB,EAAW7b,GAAGkK,UAClBhG,EAAQ2C,EAAqBwT,EAAEhV,KAAMyW,EAAgB9b,GACzD,KAAKqa,EAAE7P,QAAUtG,GAASmW,EAAE7P,SAAWtG,EACrC,MAAO2X,GAAW7b,GAAGsF,OAG1BwF,KAAK,SAASuQ,GACb,GAAIA,EAAQ,CACV,IAAKE,EAAahT,EAAU8S,EAAQlW,EAASjC,GAC3C,MACF,OAAOyY,GAAY/Y,EAAQmD,EAAKZ,EAASoD,EAAU8S,EAAQnY,EAAM0X,MA8JvE,QAASmB,GAAuB7Y,GAC9B,GAAI8Y,GAAe9Y,EAAKtE,YAAY,KAChCqB,EAAS+Z,KAAKC,IAAI+B,EAAe,EAAG9Y,EAAKtE,YAAY,KACzD,QACEqB,OAAQA,EACRgc,MAAO,GAAIC,QAAO,KAAOhZ,EAAK5C,OAAO,EAAGL,GAAQrC,QAAQ,qBAAsB,QAAQA,QAAQ,MAAO,WAAa,YAClHiF,SAA0B,IAAhBmZ,GAKd,QAASG,GAAsBvZ,EAAQsX,GAErC,IAAK,GADD/U,GAA6BiX,EAApBC,GAAa,EACjBrc,EAAI,EAAGA,EAAI4C,EAAO8W,mBAAmBzZ,OAAQD,IAAK,CACzD,GAAIsc,GAAoB1Z,EAAO8W,mBAAmB1Z,GAC9ClB,EAAI4a,EAAmB4C,KAAuB5C,EAAmB4C,GAAqBP,EAAuBO,GACjH,MAAIpC,EAAWja,OAASnB,EAAEmB,QAA1B,CAEA,GAAIpC,GAAQqc,EAAWrc,MAAMiB,EAAEmd,QAC3Bpe,GAAWsH,IAAckX,GAAcvd,EAAE+D,YAAasC,EAAQlF,OAASpC,EAAM,GAAGoC,WAClFkF,EAAUtH,EAAM,GAChBwe,GAAcvd,EAAE+D,SAChBuZ,EAAajX,EAAUmX,EAAkBhc,OAAOxB,EAAEmB,UAItD,MAAKkF,IAIHoX,YAAapX,EACbiX,WAAYA,GALd,OASF,QAASI,GAAsB5Z,EAAQuC,EAASsX,GAC9C,GAAIC,GAAe9Z,EAAOmR,cAAgBnR,CAM1C,QAHC8Z,EAAanX,KAAKkX,GAAiBC,EAAanX,KAAKkX,QAAsB7V,OAAS,OACrF8V,EAAanX,KAAKkX,GAAe7Z,OAAS,KAEnC8Z,EAAapW,KAAKmW,GACxB3R,KAAK,WACJ,GAAIjF,GAAM6W,EAAalb,IAAIib,GAAe,UAY1C,OATI5W,GAAI8W,WACN9W,EAAMA,EAAI8W,UAGR9W,EAAIzE,UACNyE,EAAIN,KAAOM,EAAIzE,QACfuE,EAAKjE,KAAKkB,EAAQ,uBAAyB6Z,EAAgB,yFAGtD7W,EAAahD,EAAQuC,EAASU,GAAK,KAI9C,QAASkV,GAAe6B,EAASjC,EAASkC,GAExC,GACIC,EACJ,KAAK,GAAIlT,KAAUgT,GAAS,CAE1B,GAAIG,GAAgC,MAAvBnT,EAAOtJ,OAAO,EAAG,GAAa,KAAO,EAKlD,IAJIyc,IACFnT,EAASA,EAAOtJ,OAAO,IAEzBwc,EAAgBlT,EAAOzJ,QAAQ,KACT,KAAlB2c,GAGAlT,EAAOtJ,OAAO,EAAGwc,IAAkBnC,EAAQra,OAAO,EAAGwc,IAClDlT,EAAOtJ,OAAOwc,EAAgB,IAAMnC,EAAQra,OAAOqa,EAAQ1a,OAAS2J,EAAO3J,OAAS6c,EAAgB,IAErGD,EAAQjT,EAAQgT,EAAQG,EAASnT,GAASA,EAAO9J,MAAM,KAAKG,QAC9D,OAIN,GAAI+c,GAAYJ,EAAQjC,IAAYiC,EAAQ3Z,gBAAkB2Z,EAAQ3Z,eAAe0X,GAAWiC,EAAQjC,GAAWiC,EAAQ,KAAOjC,EAC9HqC,IACFH,EAAQG,EAAWA,EAAW,GAldlC/a,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MACjBA,KAAK8G,YACL9G,KAAKwa,yBAoOTjY,EAAeO,UAAUwZ,cAAgB/Z,EAAeO,UAAU6X,eAAiBpY,EAAeO,UAAU6I,UAI5G/I,EAAK,iBAAkB,SAAS+X,GAC9B,MAAO,UAAS9X,EAAMuG,GACpB,GAAIpJ,KAAKuJ,QACP,MAAOoR,GAAenY,KAAKxC,KAAM6C,EAAMuG,GAAY,EAErD,IAAI2U,GAAkBpD,EAAenY,KAAKxC,KAAM6C,EAAMuG,GAAY,EAElE,KAAKpJ,KAAKuZ,oBACR,MAAOwE,EAET,IAAI9X,GAAUmV,EAAWpb,KAAM+d,GAE3BlX,EAAM7G,KAAK8G,SAASb,GACpB0V,EAAmB9U,GAAOA,EAAI8U,gBAalC,OAXwBrc,SAApBqc,GAAiC9U,GAAOA,EAAIR,MAC9CwV,EAAehV,EAAIR,KAAM0X,EAAgB3c,OAAO6E,GAAU,SAAS6V,EAAaC,EAAWC,GACzF,MAAkB,IAAdA,GAAmBF,EAAYpc,YAAY,MAAQoc,EAAY/a,OAAS,GAC1E4a,GAAmB,GACZ,GAFT,UAMCA,KAAqB,GAASA,GAAwC,OAApBA,IAAiE,OAAnC9Y,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,IAAwE,OAAzDgd,EAAgB3c,OAAO2c,EAAgBhd,OAAS,EAAG,KAClLgd,EAAkBA,EAAgB3c,OAAO,EAAG2c,EAAgBhd,OAAS,IAEhEgd,KAIXnb,EAAK,gBAAiB,SAAS0Z,GAC7B,MAAO,UAASzZ,EAAMuG,EAAY4U,GAChC,GAAIta,GAAS1D,IAKb,IAJAge,EAAWA,KAAa,EAIpB5U,EACF,GAAI6U,GAAoB7C,EAAW1X,EAAQ0F,IACvC1F,EAAO6V,qBAAsE,OAA/CnQ,EAAWhI,OAAOgI,EAAWrI,OAAS,EAAG,IACvEqa,EAAW1X,EAAQ0F,EAAWhI,OAAO,EAAGgI,EAAWrI,OAAS;AAElE,GAAImd,GAAgBD,GAAqBva,EAAOoD,SAASmX,EAGzD,IAAIC,GAA4B,KAAXrb,EAAK,GAAW,CACnC,GAAIsb,GAAYD,EAAc9X,IAC1BgY,EAAiBD,GAAarW,EAAYqW,EAAWtb,EAEzD,IAAIub,GAAsD,gBAA7BD,GAAUC,GAA6B,CAClE,GAAIjC,GAASC,EAAU1Y,EAAQwa,EAAeD,EAAmBG,EAAgBvb,EAAMmb,EACvF,IAAI7B,EACF,MAAOA,IAIb,GAAIzB,GAAqBhX,EAAO6V,qBAA0D,OAAnC1W,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhFia,EAAasB,EAAc9Z,KAAKkB,EAAQb,EAAMuG,GAAY,EAG1DsR,IAAqE,OAA/CM,EAAW5Z,OAAO4Z,EAAWja,OAAS,EAAG,KACjE2Z,GAAqB,GACnBA,IACFM,EAAaA,EAAW5Z,OAAO,EAAG4Z,EAAWja,OAAS,GAExD,IAAIsd,GAAiBpB,EAAsBvZ,EAAQsX,GAC/C/U,EAAUoY,GAAkBA,EAAehB,aAAejC,EAAW1X,EAAQsX,EAEjF,KAAK/U,EACH,MAAO+U,IAAcN,EAAqB,MAAQ,GAEpD,IAAIe,GAAUT,EAAW5Z,OAAO6E,EAAQlF,OAAS,EAEjD,OAAOkb,GAAuBvY,EAAQA,EAAOoD,SAASb,OAAgBA,EAASwV,EAASuC,MAI5Fpb,EAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAY4U,GAChC,GAAIta,GAAS1D,IAGb,OAFAge,GAAWA,KAAa,EAEjB9R,QAAQC,UACdP,KAAK,WAGJ,GAAIxC,EACF,GAAI6U,GAAoB7C,EAAW1X,EAAQ0F,IACvC1F,EAAO6V,qBAAsE,OAA/CnQ,EAAWhI,OAAOgI,EAAWrI,OAAS,EAAG,IACvEqa,EAAW1X,EAAQ0F,EAAWhI,OAAO,EAAGgI,EAAWrI,OAAS,GAElE,IAAImd,GAAgBD,GAAqBva,EAAOoD,SAASmX,EAGzD,IAAIC,GAAsC,MAArBrb,EAAKzB,OAAO,EAAG,GAAY,CAC9C,GAAI+c,GAAYD,EAAc9X,IAC1BgY,EAAiBD,GAAarW,EAAYqW,EAAWtb,EAEzD,IAAIub,EACF,MAAO5B,GAAM9Y,EAAQwa,EAAeD,EAAmBG,EAAgBvb,EAAMmb,GAGjF,MAAO9R,SAAQC,YAEhBP,KAAK,SAASuQ,GACb,GAAIA,EACF,MAAOA,EAET,IAAIzB,GAAqBhX,EAAO6V,qBAA0D,OAAnC1W,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAGhFia,EAAarP,EAAUnJ,KAAKkB,EAAQb,EAAMuG,GAAY,EAGtDsR,IAAqE,OAA/CM,EAAW5Z,OAAO4Z,EAAWja,OAAS,EAAG,KACjE2Z,GAAqB,GACnBA,IACFM,EAAaA,EAAW5Z,OAAO,EAAG4Z,EAAWja,OAAS,GAExD,IAAIsd,GAAiBpB,EAAsBvZ,EAAQsX,GAC/C/U,EAAUoY,GAAkBA,EAAehB,aAAejC,EAAW1X,EAAQsX,EAEjF,KAAK/U,EACH,MAAOiG,SAAQC,QAAQ6O,GAAcN,EAAqB,MAAQ,IAEpE,IAAI7T,GAAMnD,EAAOoD,SAASb,GAGtBqY,EAAezX,IAAQA,EAAI0X,aAAeF,EAC9C,QAAQC,EAAepS,QAAQC,QAAQtF,GAAOyW,EAAsB5Z,EAAQuC,EAASoY,EAAenB,aACnGtR,KAAK,SAAS/E,GACb,GAAI4U,GAAUT,EAAW5Z,OAAO6E,EAAQlF,OAAS,EAEjD,OAAOwb,GAAmB7Y,EAAQmD,EAAKZ,EAASwV,EAASuC,SAQjE,IAAIxD,KA0FJ5X,GAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAAI1D,GAAS1D,IACb,OAAOkM,SAAQC,QAAQyC,EAAOpM,KAAKxC,KAAMoH,IACxCwE,KAAK,SAASoC,GACb,GAAI/H,GAAUmV,EAAW1X,EAAQ0D,EAAKvE,KACtC,IAAIoD,EAAS,CACX,GAAIY,GAAMnD,EAAOoD,SAASb,GACtBwV,EAAUrU,EAAKvE,KAAKzB,OAAO6E,EAAQlF,OAAS,GAE5CsF,IACJ,IAAIQ,EAAIR,KAAM,CACZ,GAAImY,GAAY,CAGhB3C,GAAehV,EAAIR,KAAMoV,EAAS,SAASK,EAAaC,EAAWC,GAC7DA,EAAawC,IACfA,EAAYxC,GACdtW,EAAWW,EAAM0V,EAAWC,GAAcwC,EAAYxC,KAGxDtW,EAAW0B,EAAKE,SAAUjB,GAIxBQ,EAAIa,SAAWN,EAAKE,SAAS5D,SAC/B0D,EAAKE,SAASI,OAASN,EAAKE,SAASI,QAAUb,EAAIa,QAGvD,MAAOsG,WAWf,WAsBE,QAASyQ,KACP,GAAIC,GAA6D,gBAAxCA,EAAkBnJ,OAAO9B,WAChD,MAAOiL,GAAkBtX,IAE3B,KAAK,GAAItG,GAAI,EAAGA,EAAI6d,EAA0B5d,OAAQD,IACpD,GAAsD,eAAlD6d,EAA0B7d,GAAGyU,OAAO9B,WAEtC,MADAiL,GAAoBC,EAA0B7d,GACvC4d,EAAkBtX,KA0C/B,QAASwX,GAAgBlb,EAAQ0D,GAC/B,MAAO,IAAI8E,SAAQ,SAASC,EAASsC,GAC/BrH,EAAKE,SAASgR,WAChB7J,EAAO,GAAIhN,OAAM,oEAEnBod,EAAazX,CACb,KACEqF,cAAcrF,EAAK4G,SAErB,MAAMhB,GACJ6R,EAAa,KACbpQ,EAAOzB,GAET6R,EAAa,KAGRzX,EAAKE,SAASC,OACjBkH,EAAO,GAAIhN,OAAM2F,EAAK4G,QAAU,+GAElC7B,EAAQ,MAxFZ,GAAuB,mBAAZO,UACT,GAAIqL,GAAOrL,SAASS,qBAAqB,QAAQ,EAEnD,IAAIwK,GACAmH,EAeAJ,EAZAG,EAAa,KAGbE,EAAWhH,GAAQ,WACrB,GAAIiH,GAAItS,SAASwL,cAAc,UAC3B+G,EAA2B,mBAAVC,QAA8C,mBAArBA,MAAMve,UACpD,OAAOqe,GAAEG,eAAiBH,EAAEG,YAAYxe,UAAYqe,EAAEG,YAAYxe,WAAWM,QAAQ,gBAAkB,KAAOge,KAK5GN,KAkBAS,EAAa,EACbC,IACJzc,GAAK,gBAAiB,SAAS0c,GAC7B,MAAO,UAAS3G,GAEd,MAAI2G,GAAa9c,KAAKxC,KAAM2Y,IACnB,GAGLkG,EACF7e,KAAK4Y,gBAAgBiG,EAAYlG,GAI1BoG,EACP/e,KAAK4Y,gBAAgB6F,IAA4B9F,GAI1CyG,EACPC,EAAcvf,KAAK6Y,GAOnB3Y,KAAK4Y,gBAAgB,KAAMD,IAEtB,MA4BX/V,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,GAAI1D,GAAS1D,IAEb,OAA4B,QAAxBoH,EAAKE,SAASI,QAAqBN,EAAKE,SAASiY,aAAgBle,GAAckL,GAG/EA,EACKqS,EAAgBlb,EAAQ0D,GAE1B,GAAI8E,SAAQ,SAASC,EAASsC,GA+BnC,QAAS+Q,GAASC,GAChB,IAAIT,EAAEvL,YAA8B,UAAhBuL,EAAEvL,YAA0C,YAAhBuL,EAAEvL,WAAlD,CAOA,GAJA2L,IAIKhY,EAAKE,SAASC,OAAU8X,EAActe,QAGtC,IAAKge,EAAU,CAClB,IAAK,GAAIje,GAAI,EAAGA,EAAIue,EAActe,OAAQD,IACxC4C,EAAOkV,gBAAgBxR,EAAMiY,EAAcve,GAC7Cue,WALA3b,GAAOkV,gBAAgBxR,EAQzBsY,KAGKtY,EAAKE,SAASC,OAAUH,EAAKE,SAAS2T,QACzCxM,EAAO,GAAIhN,OAAM2F,EAAKvE,KAAO,kKAE/BsJ,EAAQ,KAGV,QAASkE,GAAMoP,GACbC,IACAjR,EAAO,GAAIhN,OAAM,yBAA2B2F,EAAK4G,UAGnD,QAAS0R,KAIP,GAHAtf,EAASkS,OAASqF,EAClBvX,EAAS+I,QAAU2V,EAEfE,EAAEW,YAAa,CACjBX,EAAEW,YAAY,qBAAsBH,EACpC,KAAK,GAAI1e,GAAI,EAAGA,EAAI6d,EAA0B5d,OAAQD,IAChD6d,EAA0B7d,GAAGyU,QAAUyJ,IACrCN,GAAqBA,EAAkBnJ,QAAUyJ,IACnDN,EAAoB,MACtBC,EAA0B5N,OAAOjQ,EAAG,QAIxCke,GAAEY,oBAAoB,OAAQJ,GAAU,GACxCR,EAAEY,oBAAoB,QAASvP,GAAO,EAGxC0H,GAAKW,YAAYsG,GA/EnB,GAAIA,GAAItS,SAASwL,cAAc,SAE/B8G,GAAEa,OAAQ,EAENzY,EAAKE,SAASwY,cAChBd,EAAEc,YAAc1Y,EAAKE,SAASwY,aAE5B1Y,EAAKE,SAASgR,WAChB0G,EAAEzG,aAAa,YAAanR,EAAKE,SAASgR,WAExCyG,GACFC,EAAEG,YAAY,qBAAsBK,GACpCb,EAA0B7e,MACxByV,OAAQyJ,EACR5X,KAAMA,MAIR4X,EAAEtL,iBAAiB,OAAQ8L,GAAU,GACrCR,EAAEtL,iBAAiB,QAASrD,GAAO,IAGrC+O,IAEAzH,EAAYvX,EAASkS,OACrBwM,EAAa1e,EAAS+I,QAEtB6V,EAAE9d,IAAMkG,EAAK4G,QACb+J,EAAKU,YAAYuG,KAlCVlQ,EAAMtM,KAAKxC,KAAMoH,QAgJhC,IAAI8C,IAA6B,2FAwBjC,WAsGE,QAAS6V,GAAYxY,EAAO7D,EAAQsc,GAGlC,GAFAA,EAAOzY,EAAMiD,YAAcwV,EAAOzY,EAAMiD,gBAEa,IAAjDvJ,EAAQuB,KAAKwd,EAAOzY,EAAMiD,YAAajD,GAA3C,CAGAyY,EAAOzY,EAAMiD,YAAY1K,KAAKyH,EAE9B,KAAK,GAAIzG,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAAImf,GAAU1Y,EAAMgD,eAAezJ,GAC/Bof,EAAWxc,EAAOyc,QAAQF,EAG9B,IAAKC,IAAYA,EAASzV,UAA1B,CAIA,GAAI2V,GAAgB7Y,EAAMiD,YAAc0V,EAAS5V,aAAe/C,EAAM+C,YAGtE,IAA4B,OAAxB4V,EAAS1V,YAAuB0V,EAAS1V,WAAa4V,EAAe,CAGvE,GAA4B,OAAxBF,EAAS1V,aACXwV,EAAOE,EAAS1V,YAAYuG,OAAO9P,EAAQuB,KAAKwd,EAAOE,EAAS1V,YAAa0V,GAAW,GAG9C,GAAtCF,EAAOE,EAAS1V,YAAYzJ,QAC9B,KAAM,IAAIU,OAAM,kCAGpBye,GAAS1V,WAAa4V,EAGxBL,EAAYG,EAAUxc,EAAQsc,MAIlC,QAAS1P,GAAKzN,EAAMwd,EAAY3c,GAE9B,IAAI2c,EAAW3V,OAAf,CAGA2V,EAAW7V,WAAa,CAExB,IAAIwV,KAEJD,GAAYM,EAAY3c,EAAQsc,EAGhC,KAAK,GADDM,KAAwBD,EAAW/V,aAAe0V,EAAOjf,OAAS,EAC7DD,EAAIkf,EAAOjf,OAAS,EAAGD,GAAK,EAAGA,IAAK,CAE3C,IAAK,GADDsD,GAAQ4b,EAAOlf,GACVqP,EAAI,EAAGA,EAAI/L,EAAMrD,OAAQoP,IAAK,CACrC,GAAI5I,GAAQnD,EAAM+L,EAGdmQ,GACFC,EAAsBhZ,EAAO7D,GAE7B8c,EAAkBjZ,EAAO7D,GAE7B4c,GAAuBA,IAK3B,QAASG,MAOT,QAASC,GAAwB7d,EAAMT,GACrC,MAAOA,GAAcS,KAAUT,EAAcS,IAC3CA,KAAMA,EACN+K,gBACAjJ,QAAS,GAAI8b,GACbE,eAIJ,QAASJ,GAAsBhZ,EAAO7D,GAEpC,IAAI6D,EAAMmD,OAAV,CAGA,GAAItI,GAAgBsB,EAAO3B,QAAQK,cAC/BsI,EAASnD,EAAMmD,OAASgW,EAAwBnZ,EAAM1E,KAAMT,GAC5DuC,EAAU4C,EAAMmD,OAAO/F,QAEvBic,EAAcrZ,EAAM6C,QAAQ5H,KAAKpC,EAAU,SAASyC,EAAMmC,GAG5D,GAFA0F,EAAOmW,QAAS,EAEG,gBAARhe,GACT,IAAK,GAAIjD,KAAKiD,GACZ8B,EAAQ/E,GAAKiD,EAAKjD,OAGpB+E,GAAQ9B,GAAQmC,CAGlB,KAAK,GAAIlE,GAAI,EAAG0D,EAAIkG,EAAOiW,UAAU5f,OAAYyD,EAAJ1D,EAAOA,IAAK,CACvD,GAAIggB,GAAiBpW,EAAOiW,UAAU7f,EACtC,KAAKggB,EAAeD,OAAQ,CAC1B,GAAIE,GAAgB9f,EAAQuB,KAAKse,EAAelT,aAAclD,GAC1DsW,EAASF,EAAeG,QAAQF,EAChCC,IACFA,EAAOrc,IAKb,MADA+F,GAAOmW,QAAS,EACT7b,IACJkc,GAAI3Z,EAAM1E,MAWf,IAT0B,kBAAf+d,KACTA,GAAgBK,WAAaxZ,QAASmZ,IAGxCA,EAAcA,IAAiBK,WAAaxZ,QAAS,cAErDiD,EAAOuW,QAAUL,EAAYK,QAC7BvW,EAAOjD,QAAUmZ,EAAYnZ,SAExBiD,EAAOuW,UAAYvW,EAAOjD,QAC7B,KAAM,IAAIlJ,WAAU,oCAAsCgJ,EAAM1E,KAIlE,KAAK,GAAI/B,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAKIqgB,GALAlB,EAAU1Y,EAAMgD,eAAezJ,GAC/Bof,EAAWxc,EAAOyc,QAAQF,GAC1BmB,EAAYhf,EAAc6d,EAK1BmB,GACFD,EAAaC,EAAUzc,QAGhBub,IAAaA,EAAS5V,YAC7B6W,EAAajB,EAAStb,SAGdsb,GAKRK,EAAsBL,EAAUxc,GAChC0d,EAAYlB,EAASxV,OACrByW,EAAaC,EAAUzc,SANvBwc,EAAazd,EAAOpB,IAAI2d,GAUtBmB,GAAaA,EAAUT,WACzBS,EAAUT,UAAU7gB,KAAK4K,GACzBA,EAAOkD,aAAa9N,KAAKshB,IAGzB1W,EAAOkD,aAAa9N,KAAK,KAK3B,KAAK,GADDqK,GAAkB5C,EAAM4C,gBAAgBrJ,GACnCqP,EAAI,EAAGkR,EAAMlX,EAAgBpJ,OAAYsgB,EAAJlR,IAAWA,EAAG,CAC1D,GAAI1L,GAAQ0F,EAAgBgG,EACxBzF,GAAOuW,QAAQxc,IACjBiG,EAAOuW,QAAQxc,GAAO0c,MAO9B,QAASG,GAAUze,EAAMa,GACvB,GAAIiB,GACA4C,EAAQ7D,EAAOyc,QAAQtd,EAE3B,IAAK0E,EAOCA,EAAM+C,YACRiX,EAAgB1e,EAAM0E,KAAW7D,GAEzB6D,EAAMkD,WACd+V,EAAkBjZ,EAAO7D,GAE3BiB,EAAU4C,EAAMmD,OAAO/F,YAXvB,IADAA,EAAUjB,EAAOpB,IAAIO,IAChB8B,EACH,KAAM,IAAIlD,OAAM,6BAA+BoB,EAAO,IAa1D,SAAM0E,GAASA,EAAM+C,cAAgB3F,GAAWA,EAAQmQ,aAC/CnQ,EAAQ,WAEVA,EAGT,QAAS6b,GAAkBjZ,EAAO7D,GAChC,IAAI6D,EAAMmD,OAAV,CAGA,GAAI/F,MAEA+F,EAASnD,EAAMmD,QAAW/F,QAASA,EAASuc,GAAI3Z,EAAM1E,KAG1D,KAAK0E,EAAM8C,iBACT,IAAK,GAAIvJ,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAAImf,GAAU1Y,EAAMgD,eAAezJ,GAE/Bof,EAAWxc,EAAOyc,QAAQF,EAC1BC,IACFM,EAAkBN,EAAUxc,GAKlC6D,EAAMkD,WAAY,CAClB,IAAI9K,GAAS4H,EAAME,QAAQjF,KAAKpC,EAAU,SAASyC,GACjD,IAAK,GAAI/B,GAAI,EAAG0D,EAAI+C,EAAMlD,KAAKtD,OAAYyD,EAAJ1D,EAAOA,IAC5C,GAAIyG,EAAMlD,KAAKvD,IAAM+B,EAErB,MAAOye,GAAU/Z,EAAMgD,eAAezJ,GAAI4C,EAG5C,IAAI8d,GAAiB9d,EAAO4Y,cAAczZ,EAAM0E,EAAM1E,KACtD,IAA0D,IAAtD5B,EAAQuB,KAAK+E,EAAMgD,eAAgBiX,GACrC,MAAOF,GAAUE,EAAgB9d,EAEnC,MAAM,IAAIjC,OAAM,UAAYoB,EAAO,oCAAsC0E,EAAM1E,OAC9E8B,EAAS+F,EAEGpL,UAAXK,IACF+K,EAAO/F,QAAUhF,GAGnBgF,EAAU+F,EAAO/F,QAGbA,IAAYA,EAAQ8c,YAAc9c,YAAmB/C,IACvD2F,EAAM3C,SAAWlB,EAAO8E,UAAU7D,GAE3B4C,EAAMoD,YAAchG,IAAYvE,EACvCmH,EAAM3C,SAAWlB,EAAO8E,UAAU9D,EAAYC,IAG9C4C,EAAM3C,SAAWlB,EAAO8E,WAAYO,UAAWpE,EAASmQ,cAAc,KAY1E,QAASyM,GAAgBtT,EAAY1G,EAAOma,EAAMhe,GAEhD,GAAK6D,IAASA,EAAMkD,WAAclD,EAAM+C,YAAxC,CAKAoX,EAAK5hB,KAAKmO,EAEV,KAAK,GAAInN,GAAI,EAAG0D,EAAI+C,EAAMgD,eAAexJ,OAAYyD,EAAJ1D,EAAOA,IAAK,CAC3D,GAAImf,GAAU1Y,EAAMgD,eAAezJ,EACA,KAA/BG,EAAQuB,KAAKkf,EAAMzB,KAChBvc,EAAOyc,QAAQF,GAGlBsB,EAAgBtB,EAASvc,EAAOyc,QAAQF,GAAUyB,EAAMhe,GAFxDA,EAAOpB,IAAI2d,IAMb1Y,EAAMkD,YAGVlD,EAAMkD,WAAY,EAClBlD,EAAMmD,OAAOjD,QAAQjF,KAAKpC,KAvX5BmC,EAAeO,UAAU6V,SAAW,SAAS9V,EAAMwB,EAAM+F,GASvD,GARmB,gBAARvH,KACTuH,EAAU/F,EACVA,EAAOxB,EACPA,EAAO,MAKa,iBAAXuH,GACT,MAAOpK,MAAK2hB,gBAAgBvJ,MAAMpY,KAAMqY,UAE1C,IAAI9Q,GAAQC,GAIZD,GAAM1E,KAAOA,IAAS7C,KAAK2a,gBAAkB3a,KAAK2L,WAAWnJ,KAAKxC,KAAM6C,GACxE0E,EAAM+C,aAAc,EACpB/C,EAAMlD,KAAOA,EACbkD,EAAM6C,QAAUA,EAEhBpK,KAAK4hB,eACHC,KAAK,EACLta,MAAOA,KAGXhF,EAAeO,UAAU6e,gBAAkB,SAAS9e,EAAMwB,EAAM+F,EAAS3C,GACpD,gBAAR5E,KACT4E,EAAU2C,EACVA,EAAU/F,EACVA,EAAOxB,EACPA,EAAO,KAIT,IAAI0E,GAAQC,GACZD,GAAM1E,KAAOA,IAAS7C,KAAK2a,gBAAkB3a,KAAK2L,WAAWnJ,KAAKxC,KAAM6C,GACxE0E,EAAMlD,KAAOA,EACbkD,EAAME,QAAUA,EAChBF,EAAM8C,iBAAmBD,EAEzBpK,KAAK4hB,eACHC,KAAK,EACLta,MAAOA,KAGX3E,EAAK,kBAAmB,WACtB,MAAO,UAASwE,EAAMuR,GACpB,GAAKA,EAAL,CAGA,GAAIpR,GAAQoR,EAASpR,MACjBua,EAAU1a,GAAQA,EAAKE,QAW3B,IARIC,EAAM1E,OACF0E,EAAM1E,OAAQ7C,MAAKmgB,UACvBngB,KAAKmgB,QAAQ5Y,EAAM1E,MAAQ0E,GAEzBua,IACFA,EAAQ7G,QAAS,KAGhB1T,EAAM1E,MAAQuE,IAAS0a,EAAQva,OAASA,EAAM1E,MAAQuE,EAAKvE,KAAM,CACpE,IAAKif,EACH,KAAM,IAAIvjB,WAAU,+IACtB,IAAIujB,EAAQva,MACV,KAAsB,YAAlBua,EAAQpa,OACJ,GAAIjG,OAAM,sDAAwD2F,EAAKvE,KAAO,0EAE9E,GAAIpB,OAAM,UAAY2F,EAAKvE,KAAO,mBAAqBif,EAAQpa,OAAS,8CAE7Eoa,GAAQpa,SACXoa,EAAQpa,OAAS,YACnBoa,EAAQva,MAAQA,OAKtBxE,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MAEjBA,KAAKmgB,WACLngB,KAAK+B,QAAQK,oBAuEjBC,EAAeoe,EAAc,YAC3Bzb,MAAO,WACL,MAAO,YA8NXpC,EAAK,SAAU,SAASmf,GACtB,MAAO,UAASlf,GAGd,aAFO7C,MAAK+B,QAAQK,cAAcS,SAC3B7C,MAAKmgB,QAAQtd,GACbkf,EAAIvf,KAAKxC,KAAM6C,MAI1BD,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,MAAIpH,MAAKmgB,QAAQ/Y,EAAKvE,OACpBuE,EAAKE,SAASI,OAAS,UAChB,KAGTN,EAAKE,SAASjD,KAAO+C,EAAKE,SAASjD,SAE5ByK,EAAMtM,KAAKxC,KAAMoH,OAI5BxE,EAAK,YAAa,SAASmM,GAEzB,MAAO,UAAS3H,GAEd,MADAA,GAAKE,SAASjD,KAAO+C,EAAKE,SAASjD,SAC5B6H,QAAQC,QAAQ4C,EAAUqJ,MAAMpY,KAAMqY,YAAYzM,KAAK,SAAS5B,GAIrE,OAF4B,YAAxB5C,EAAKE,SAASI,QAAgD,UAAxBN,EAAKE,SAASI,SAAuBN,EAAKE,SAASI,QAAUqC,EAAqB3C,EAAK4C,WAC/H5C,EAAKE,SAASI,OAAS,YAClBsC,OAMbpH,EAAK,OAAQ,SAASof,GACpB,MAAO,UAAShH,GACd,GAAItX,GAAS1D,KACTuH,EAAQ7D,EAAOyc,QAAQnF,EAE3B,QAAKzT,GAASA,EAAMlD,KAAKtD,OAChBihB,EAAO5J,MAAMpY,KAAMqY,YAE5B9Q,EAAM4C,gBAAkB5C,EAAMgD,kBAI9B+F,EAAK0K,EAAYzT,EAAO7D,GAGxB6d,EAAgBvG,EAAYzT,KAAW7D,GAClC6D,EAAM3C,WACT2C,EAAM3C,SAAWlB,EAAO8E,UAAUjB,EAAMmD,OAAO/F,UAG5CjB,EAAOuN,QACVvN,EAAOyc,QAAQnF,GAAc1b,QAG/BoE,EAAO4E,IAAI0S,EAAYzT,EAAM3C,UAEtBsH,QAAQC,cAInBvJ,EAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACc,UAAxBA,EAAKE,SAASI,SAChBN,EAAKE,SAASI,OAASpI,QAIzB0P,EAAYxM,KAAKxC,KAAMoH,EAEvB,IAEIG,GAFA7D,EAAS1D,IAKb,IAAI0D,EAAOyc,QAAQ/Y,EAAKvE,MACtB0E,EAAQ7D,EAAOyc,QAAQ/Y,EAAKvE,MAEvB0E,EAAM+C,cACT/C,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,OAC/CkD,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,UAK1C,IAAI+C,EAAKE,SAASC,MACrBA,EAAQH,EAAKE,SAASC,MACtBA,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,UAK1C,MAAMX,EAAO6F,SAAWnC,EAAKE,SAAS2T,QACX,YAAxB7T,EAAKE,SAASI,QAAgD,OAAxBN,EAAKE,SAASI,QAA2C,OAAxBN,EAAKE,SAASI,QAAkB,CAK7G,GAHqB,mBAAViP,KACTA,GAAOnU,KAAKkB,EAAQ0D,IAEjBA,EAAKE,SAASC,QAAUH,EAAKE,SAAS2T,OACzC,KAAM,IAAIxZ,OAAM2F,EAAKvE,KAAO,gBAAkBuE,EAAKE,SAASI,OAAS,uBAEvEH,GAAQH,EAAKE,SAASC,MAGlBA,GAASH,EAAKE,SAASjD,OACzBkD,EAAMlD,KAAOkD,EAAMlD,KAAKwB,OAAOuB,EAAKE,SAASjD,OAI5CkD,IACHA,EAAQC,IACRD,EAAMlD,KAAO+C,EAAKE,SAASjD,KAC3BkD,EAAME,QAAU,cAIlB/D,EAAOyc,QAAQ/Y,EAAKvE,MAAQ0E,CAE5B,IAAI0a,GAAU7d,EAAMmD,EAAMlD,KAE1BkD,GAAMlD,KAAO4d,EAAQ3d,MACrBiD,EAAM4C,gBAAkB8X,EAAQ1d,QAChCgD,EAAM1E,KAAOuE,EAAKvE,KAClB0E,EAAMoD,WAAavD,EAAKE,SAASqD,cAAe,CAIhD,KAAK,GADDuX,MACKphB,EAAI,EAAG0D,EAAI+C,EAAMlD,KAAKtD,OAAYyD,EAAJ1D,EAAOA,IAC5CohB,EAAkBpiB,KAAKoM,QAAQC,QAAQzI,EAAOiI,UAAUpE,EAAMlD,KAAKvD,GAAIsG,EAAKvE,OAE9E,OAAOqJ,SAAQqD,IAAI2S,GAAmBtW,KAAK,SAASrB,GAIlD,MAFAhD,GAAMgD,eAAiBA,GAGrBlG,KAAMkD,EAAMlD,KACZoD,QAAS,WAgBP,MAbA6I,GAAKlJ,EAAKvE,KAAM0E,EAAO7D,GAGvB6d,EAAgBna,EAAKvE,KAAM0E,KAAW7D,GAEjC6D,EAAM3C,WACT2C,EAAM3C,SAAWlB,EAAO8E,UAAUjB,EAAMmD,OAAO/F,UAG5CjB,EAAOuN,QACVvN,EAAOyc,QAAQ/Y,EAAKvE,MAAQvD,QAGvBiI,EAAM3C,mBAUzB,WAEE,GAAIud,GAAW,gLAEXC,EAAsB,wBACtBC,EAAoB,mBAExBzf,GAAK,YAAa,SAASmM,GACzB,MAAO,UAAS3H,GACd,GAAI1D,GAAS1D,KACTsiB,EAAOjK,SACX,OAAOtJ,GAAUqJ,MAAM1U,EAAQ4e,GAC9B1W,KAAK,SAAS5B,GAEb,GAA4B,OAAxB5C,EAAKE,SAASI,QAA2C,OAAxBN,EAAKE,SAASI,SAAoBN,EAAKE,SAASI,QAAUsC,EAAOrL,MAAMwjB,GAAW,CAMrH,GAL4B,OAAxB/a,EAAKE,SAASI,QAChBjB,EAAKjE,KAAKkB,EAAQ,UAAY0D,EAAKvE,KAAO,qGAE5CuE,EAAKE,SAASI,OAAS,MAEnBN,EAAKE,SAASjD,KAAM,CAEtB,IAAK,GADDke,GAAY,GACPzhB,EAAI,EAAGA,EAAIsG,EAAKE,SAASjD,KAAKtD,OAAQD,IAC7CyhB,GAAa,WAAanb,EAAKE,SAASjD,KAAKvD,GAAK,KACpDsG,GAAK4C,OAASuY,EAAYvY,EAG5B,GAAItG,EAAOkR,cAAe,EAAO,CAE/B,GAAIlR,EAAO6F,QACT,MAAOS,EACT,MAAM,IAAIzL,WAAU,kFAUtB,MALAmF,GAAO3B,QAAQygB,iBAAmB9e,EAAO3B,QAAQygB,mBAAoB,EACjE9e,EAAOmR,eACTnR,EAAOmR,aAAa9S,QAAQygB,iBAAmB9e,EAAO3B,QAAQygB,mBAAoB,IAG5E9e,EAAO3B,QAAQ0gB,oBACrB/e,EAAO3B,QAAQ0gB,kBAAoBvW,QAAQC,QACzC/L,EAA8B,cAArBsD,EAAOkR,WAA6B,KAAOlR,EAAOkR,cAAgBlR,EAAOmR,cAAgBnR,GAAQiI,UAAUjI,EAAOkR,YAC1HhJ,KAAK,SAASoP,GAEb,MADAtX,GAAO3B,QAAQ2gB,qBAAuB1H,GAC9BtX,EAAOmR,cAAgBnR,GAAQ0D,KAAK4T,GAC3CpP,KAAK,WACJ,OAAQlI,EAAOmR,cAAgBnR,GAAQpB,IAAI0Y,UAG/CpP,KAAK,SAASgJ,GAGhB,MAFAlR,GAAO3B,QAAQuY,yBAA0B,EAEP,kBAAvB1F,GAAAA,YAAsCxU,EAA8B,cAArBsD,EAAOkR,WAA6B,KAAOlR,EAAOkR,YAYxGA,EAAW7F,UAET6F,GAAcxN,EAAKE,SAASqb,aACvBvb,EAAK4C,QAGwB,gBAA3B5C,GAAKE,SAASqO,YACvBvO,EAAKE,SAASqO,UAAY2B,KAAKyC,MAAM3S,EAAKE,SAASqO,YAE9CzJ,QAAQC,QAAQyI,EAAW7F,UAAUqJ,MAAM1U,EAAQ4e,IACzD1W,KAAK,SAAS5B,GAEb,GAAI2L,GAAYvO,EAAKE,SAASqO,SAC9B,IAAIA,GAAiC,gBAAbA,GAAuB,CAC7C,GAAIiN,GAAexb,EAAK4G,QAAQpN,MAAM,KAAK,EAGtC+U,GAAUkN,MAAQlN,EAAUkN,MAAQzb,EAAK4G,UAC5C2H,EAAUkN,KAAOD,EAAe,iBAG7BjN,EAAUmN,SAAWnN,EAAUmN,QAAQ/hB,QAAU,KAAO4U,EAAUmN,QAAQ,IAAMnN,EAAUmN,QAAQ,IAAM1b,EAAK4G,YAChH2H,EAAUmN,SAAWF,IAKzB,MAF4B,OAAxBxb,EAAKE,SAASI,SAAoBhE,EAAO6F,SAAWQ,EAAqBC,KAC3E5C,EAAKE,SAASI,OAAS,YAClBsC,MAKPtG,EAAO6F,UACTnC,EAAKE,SAASyb,eAAiB3b,EAAK4C,QAG/B2K,EAAUnS,KAAKkB,EAAQ0D,GAC7BwE,KAAK,SAAS5B,GAGb,MADA5C,GAAKE,SAASqO,UAAYrW,OACnB0K,KAlDHtG,EAAO6F,QACFS,EACFkC,QAAQC,QAAQyI,EAAAA,WAAmBpS,KAAKkB,EAAQ0D,EAAK4G,QAAS5G,EAAKvE,OACzE+I,KAAK,SAAUvE,GAEd,MADAF,GAAkBC,EAAMC,GACjB,MA+CV,SAAS/G,GACV,KAAMD,GAAWC,EAAK,0CAA4C8G,EAAKvE,QAK3E,GAAIa,EAAOkR,cAAe,EACxB,MAAO5K,EA+BT,IA5BItG,EAAO3B,QAAQygB,oBAAqB,GAA+B,WAArB9e,EAAOkR,YAAgD,cAArBlR,EAAOkR,YAAmD,SAArBlR,EAAOkR,YACzHxN,EAAKvE,MAAQa,EAAO4Y,cAAc5Y,EAAOkR,cAG1C5K,EAAOjJ,OAAS,MAAQqG,EAAKE,SAASI,SACxCN,EAAKE,SAASI,OAAS,SAEG,YAAtBhE,EAAOkR,aACTxN,EAAKE,SAAS3C,QAAU,WACA,eAAtBjB,EAAOkR,aACTxN,EAAKE,SAAS3C,QAAU,OAG5BjB,EAAO3B,QAAQygB,kBAAmB,GAIhC9e,EAAO3B,QAAQuY,2BAA4B,IACzClT,EAAKvE,MAAQa,EAAO4Y,cAAc,oBAC/BlV,EAAKvE,MAAQa,EAAO4Y,cAAc,8BACnCtS,EAAOjJ,OAAS,MAClBqG,EAAKE,SAASI,OAASN,EAAKE,SAASI,QAAU,UAEjDhE,EAAO3B,QAAQuY,yBAA0B,IAKhB,YAAxBlT,EAAKE,SAASI,QAAwBN,EAAKE,SAAS2T,SAAWvX,EAAO3B,QAAQuY,2BAA4B,EAAM,CACnH,GAAyB,WAArB5W,EAAOkR,aAA4BxU,EAAS4iB,iBAAmB5b,EAAK4C,OAAOrL,MAAMyjB,GAEnF,MADA1e,GAAO3B,QAAQuY,wBAA0B5W,EAAO3B,QAAQuY,0BAA2B,EAC5E5W,EAAO,UAAU,mBAAmBkI,KAAK,WAC9C,MAAO5B,IAGX,IAAyB,SAArBtG,EAAOkR,aAA0BxU,EAAS6iB,cAAgB7b,EAAK4C,OAAOrL,MAAM0jB,GAE9E,MADA3e,GAAO3B,QAAQuY,wBAA0B5W,EAAO3B,QAAQuY,0BAA2B,EAC5E5W,EAAO,UAAU,0BAA0BkI,KAAK,WACrD,MAAO5B,KAKb,MAAOA,UAgBf,IAAIkZ,IAA8B,mBAAR/iB,MAAsB,OAAS,QAEzDyC,GAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GAGd,MAFIA,GAAKE,SAAS3C,UAAYyC,EAAKE,SAASI,SAC1CN,EAAKE,SAASI,OAAS,UAClBoH,EAAMtM,KAAKxC,KAAMoH,MAQ5BxE,EAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACd,GAAI1D,GAAS1D,IAMb,IAJKoH,EAAKE,SAASI,SACjBN,EAAKE,SAASI,OAAS,UAGG,UAAxBN,EAAKE,SAASI,SAAuBN,EAAKE,SAASC,MAAO,CAE5D,GAAIA,GAAQC,GAEZJ,GAAKE,SAASC,MAAQA,EAEtBA,EAAMlD,OAEN,KAAK,GAAI8e,KAAK/b,GAAKE,SAAS8b,QAAS,CACnC,GAAIC,GAAKjc,EAAKE,SAAS8b,QAAQD,EAC3BE,IACF9b,EAAMlD,KAAKvE,KAAKujB,GAGpB9b,EAAME,QAAU,SAAS0B,EAASxE,EAAS+F,GAEzC,GAAI0Y,EACJ,IAAIhc,EAAKE,SAAS8b,QAAS,CACzBA,IACA,KAAK,GAAID,KAAK/b,GAAKE,SAAS8b,QACtBhc,EAAKE,SAAS8b,QAAQD,KACxBC,EAAQD,GAAKha,EAAQ/B,EAAKE,SAAS8b,QAAQD,KAGjD,GAAIG,GAAalc,EAAKE,SAAS3C,OAE3B2e,KACFlc,EAAK4C,QAAU,KAAOkZ,GAAe,KAAOI,EAAa,QAAUA,EAAa,IAElF,IAAIC,GAAiB7f,EAAOpB,IAAI,oBAAoBkhB,cAAc9Y,EAAOwW,GAAIoC,EAAYF,IAAWhc,EAAKE,SAASmc,kBAGlH,OAFA9M,IAAOnU,KAAKkB,EAAQ0D,GAEbmc,KAGX,MAAOvU,GAAYxM,KAAKxC,KAAMoH,MAyBlCxE,EAAK,kBAAmB,SAAS8gB,GAC/B,MAAO,UAAStc,EAAMuR,GACpB,GAAIA,IAAcvR,EAAKE,SAAS3C,WAAa4H,GAAoC,UAAxBnF,EAAKE,SAASI,QACrE,MAAOgc,GAAelhB,KAAKxC,KAAMoH,EAAMuR,EAEzCvR,GAAKE,SAASI,OAAS,QACvB,IAAIH,GAAQH,EAAKE,SAASC,MAAQC,GAClCD,GAAMlD,KAAO+C,EAAKE,SAASjD,IAC3B,IAAIwG,GAAcD,EAAexD,EAAKE,SAAS3C,QAC/C4C,GAAME,QAAU,WACd,MAAOoD,OAKb9H,EAAgB,SAAS0O,GACvB,MAAO,YAYL,QAASkS,GAAcC,GACrB,GAAIve,OAAOwe,KACTxe,OAAOwe,KAAKzjB,GAAU+Q,QAAQyS,OAE9B,KAAK,GAAIT,KAAK/iB,GACP2D,EAAevB,KAAKpC,EAAU+iB,IAEnCS,EAAST,GAIf,QAASW,GAAmBF,GAC1BD,EAAc,SAASI,GACrB,GAAoD,IAAhD9iB,EAAQuB,KAAKwhB,EAAoBD,GAArC,CAEA,IACE,GAAI/e,GAAQ5E,EAAS2jB,GAEvB,MAAO/W,GACLgX,EAAmBlkB,KAAKikB,GAE1BH,EAASG,EAAY/e,MAhCzB,GAAItB,GAAS1D,IACbyR,GAAYjP,KAAKkB,EAEjB,IAMIugB,GANAlgB,EAAiBsB,OAAOvC,UAAUiB,eAGlCigB,GAAsB,KAAM,iBAAkB,eAAgB,gBAAiB,SAAU,eAAgB,WAC3G,wBAAyB,oBAAqB,kBAAmB,kBAAmB,kBA6BtFtgB,GAAO4E,IAAI,mBAAoB5E,EAAO8E,WACpCgb,cAAe,SAASvV,EAAYtJ,EAASye,EAASc,GAEpD,GAAIC,GAAY/jB,EAASsR,MAEzBtR,GAASsR,OAASpS,MAGlB,IAAI8kB,EACJ,IAAIhB,EAAS,CACXgB,IACA,KAAK,GAAIjB,KAAKC,GACZgB,EAAWjB,GAAK/iB,EAAS+iB,GACzB/iB,EAAS+iB,GAAKC,EAAQD,GAc1B,MATKxe,KACHsf,KAEAH,EAAmB,SAASjhB,EAAMmC,GAChCif,EAAephB,GAAQmC,KAKpB,WACL,GAEIqf,GAFAxZ,EAAclG,EAAUiG,EAAejG,MAGvC2f,IAAoB3f,CA6BxB,MA3BKA,GAAWuf,IACdJ,EAAmB,SAASjhB,EAAMmC,GAC5Bif,EAAephB,KAAUmC,GAET,mBAATA,KAIPkf,IACF9jB,EAASyC,GAAQvD,QAEdqF,IACHkG,EAAYhI,GAAQmC,EAEO,mBAAhBqf,GACJC,GAAmBD,IAAiBrf,IACvCsf,GAAkB,GAGpBD,EAAerf,MAKvB6F,EAAcyZ,EAAkBzZ,EAAcwZ,EAG1CD,EACF,IAAK,GAAIjB,KAAKiB,GACZhkB,EAAS+iB,GAAKiB,EAAWjB,EAI7B,OAFA/iB,GAASsR,OAASyS,EAEXtZ,UASjB,WAaE,QAAS0Z,GAAWva,GAUlB,QAASwa,GAAWC,EAAW9lB,GAC7B,IAAK,GAAImC,GAAI,EAAGA,EAAI2jB,EAAU1jB,OAAQD,IACpC,GAAI2jB,EAAU3jB,GAAG,GAAKnC,EAAM8F,OAASggB,EAAU3jB,GAAG,GAAKnC,EAAM8F,MAC3D,OAAO,CACX,QAAO,EAbTigB,EAAgBC,UAAYC,EAAaD,UAAYE,EAAYF,UAAY,CAE7E,IAEIhmB,GAFA0F,KAKAygB,KAAsBC,IAS1B,IAAI/a,EAAOjJ,OAASiJ,EAAOpJ,MAAM,MAAMG,OAAS,IAAK,CACnD,KAAOpC,EAAQkmB,EAAY5R,KAAKjJ,IAC9B8a,EAAgBhlB,MAAMnB,EAAM8F,MAAO9F,EAAM8F,MAAQ9F,EAAM,GAAGoC,QAI5D,MAAOpC,EAAQimB,EAAa3R,KAAKjJ,IAE1Bwa,EAAWM,EAAiBnmB,IAC/BomB,EAAiBjlB,MAAMnB,EAAM8F,MAAQ9F,EAAM,GAAGoC,OAAQpC,EAAM8F,MAAQ9F,EAAM,GAAGoC,OAAS,IAI5F,KAAOpC,EAAQ+lB,EAAgBzR,KAAKjJ,IAElC,IAAKwa,EAAWM,EAAiBnmB,KAAW6lB,EAAWO,EAAkBpmB,GAAQ,CAC/E,GAAIiS,GAAMjS,EAAM,GAAGyC,OAAO,EAAGzC,EAAM,GAAGoC,OAAS,EAE/C,IAAI6P,EAAIjS,MAAM,OACZ,QAEyB,MAAvBiS,EAAIA,EAAI7P,OAAS,KACnB6P,EAAMA,EAAIxP,OAAO,EAAGwP,EAAI7P,OAAS,IACnCsD,EAAKvE,KAAK8Q,GAId,MAAOvM,GAtDT,GAAI2gB,GAAkB,8HAElBN,EAAkB,iHAClBE,EAAe,oDAEfC,EAAc,mEAGdI,EAAgB,SAiDpBriB,GAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACd,GAAI1D,GAAS1D,IAQb,IAPKoH,EAAKE,SAASI,SACjBsd,EAAgBL,UAAY,EAC5BD,EAAgBC,UAAY,GACxBD,EAAgBzR,KAAK7L,EAAK4C,SAAWgb,EAAgB/R,KAAK7L,EAAK4C,WACjE5C,EAAKE,SAASI,OAAS,QAGC,OAAxBN,EAAKE,SAASI,OAAiB,CACjC,GAAIwd,GAAW9d,EAAKE,SAASjD,KACzBA,EAAO+C,EAAKE,SAAS6d,uBAAwB,KAAaZ,EAAWnd,EAAK4C,OAE9E,KAAK,GAAImZ,KAAK/b,GAAKE,SAAS8b,QACtBhc,EAAKE,SAAS8b,QAAQD,IACxB9e,EAAKvE,KAAKsH,EAAKE,SAAS8b,QAAQD,GAEpC,IAAI5b,GAAQC,GAEZJ,GAAKE,SAASC,MAAQA,EAEtBA,EAAMlD,KAAOA,EACbkD,EAAM8C,kBAAmB,EACzB9C,EAAME,QAAU,SAAS2d,EAAUzgB,EAAS+F,GAC1C,QAASvB,GAAQtG,GAGf,MAF6B,KAAzBA,EAAKA,EAAK9B,OAAS,KACrB8B,EAAOA,EAAKzB,OAAO,EAAGyB,EAAK9B,OAAS,IAC/BqkB,EAAShN,MAAMpY,KAAMqY,WAU9B,GARAlP,EAAQgD,QAAU,SAAStJ,GACzB,MAAOa,GAAOpB,IAAI,iBAAiB+iB,eAAexiB,EAAM6H,EAAOwW,KAGjExW,EAAOjI,SACPiI,EAAOvB,QAAUic,GAGZhe,EAAKE,SAASge,oBACjB,IAAK,GAAIxkB,GAAI,EAAGA,EAAIokB,EAASnkB,OAAQD,IACnCqI,EAAQ+b,EAASpkB,GAErB,IAAIykB,GAAW7hB,EAAOpB,IAAI,iBAAiBkjB,YAAY9a,EAAOwW,IAC1DuE,GACF9gB,QAASA,EACT2d,MAAOnZ,EAASxE,EAAS+F,EAAQ6a,EAAS9P,SAAU8P,EAASG,QAAStlB,EAAUA,IAG9EulB,EAAa,2EAGjB,IAAIve,EAAKE,SAAS8b,QAChB,IAAK,GAAID,KAAK/b,GAAKE,SAAS8b,QAC1BqC,EAAanD,KAAKxiB,KAAKqJ,EAAQ/B,EAAKE,SAAS8b,QAAQD,KACrDwC,GAAc,KAAOxC,CAIzB,IAAIzR,GAAStR,EAASsR,MACtBtR,GAASsR,OAASpS,OAClBc,EAASqlB,aAAeA,EAExBre,EAAK4C,OAAS2b,EAAa,MAAQve,EAAK4C,OAAOtL,QAAQumB,EAAe,IAAM,uDAE5EtO,GAAOnU,KAAKkB,EAAQ0D,GAEpBhH,EAASqlB,aAAenmB,OACxBc,EAASsR,OAASA,GAItB,MAAO1C,GAAYxM,KAAKkB,EAAQ0D,SAItCrE,EAAgB,SAAS0O,GACvB,MAAO,YAOL,QAASmU,GAAY5hB,GACnB,MAAyB,YAArBA,EAAK5C,OAAO,EAAG,GACV4C,EAAK5C,OAAO,IAAME,GAEvBukB,GAAgB7hB,EAAK5C,OAAO,EAAGykB,EAAa9kB,SAAW8kB,EAClD7hB,EAAK5C,OAAOykB,EAAa9kB,QAE3BiD,EAbT,GAAIN,GAAS1D,IAGb,IAFAyR,EAAYjP,KAAKkB,GAEI,mBAAV8I,SAA4C,mBAAZE,WAA2BF,OAAOa,SAC3E,GAAIwY,GAAexY,SAASxO,SAAW,KAAOwO,SAASpO,UAAYoO,SAASnO,KAAO,IAAMmO,SAASnO,KAAO,GAY3GwE,GAAO4E,IAAI,gBAAiB5E,EAAO8E,WACjC6c,eAAgB,SAAS/W,EAASwX,GAChC,MAAOF,GAAYliB,EAAO4Y,cAAchO,EAASwX,KAEnDN,YAAa,SAASO,GAEpB,GACItQ,GADAuQ,EAAcD,EAASrmB,YAAY,IAGrC+V,GADiB,IAAfuQ,EACSD,EAAS3kB,OAAO,EAAG4kB,GAEnBD,CAEb,IAAIL,GAAUjQ,EAAS7U,MAAM,IAI7B,OAHA8kB,GAAQ7lB,MACR6lB,EAAUA,EAAQ3lB,KAAK,MAGrB0V,SAAUmQ,EAAYnQ,GACtBiQ,QAASE,EAAYF,WAW/B9iB,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GAId,MAFIA,GAAKE,SAASiY,YAAcle,IAC9BjB,EAASsR,OAAS1R,KAAKimB,WAClBnX,EAAMtM,KAAKxC,KAAMoH,MAI5BrE,EAAgB,SAAS0O,GACvB,MAAO,YAYL,QAAS8S,GAAWva,EAAQkc,GAG1Blc,EAASA,EAAOtL,QAAQkmB,EAAc,GAGtC,IAAIuB,GAASnc,EAAOrL,MAAMynB,GACtBC,GAAgBF,EAAO,GAAGvlB,MAAM,KAAKslB,IAAiB,WAAWxnB,QAAQ4nB,EAAS,IAGlFC,EAAeC,EAAcH,KAAkBG,EAAcH,GAAgB,GAAIrJ,QAAOyJ,EAAgBJ,EAAeK,EAAgB,KAE3IH,GAAa5B,UAAY,CAKzB,KAHA,GAEIhmB,GAFA0F,KAGG1F,EAAQ4nB,EAAatT,KAAKjJ,IAC/B3F,EAAKvE,KAAKnB,EAAM,IAAMA,EAAM,GAE9B,OAAO0F,GAOT,QAAS8E,GAAQ7E,EAAOsf,EAAU+C,EAASC,GAEzC,GAAoB,gBAATtiB,MAAuBA,YAAiBsB,QACjD,MAAOuD,GAAQiP,MAAM,KAAMxS,MAAM9C,UAAUiO,OAAOvO,KAAK6V,UAAW,EAAGA,UAAUtX,OAAS,GAK1F,IAFoB,gBAATuD,IAAwC,kBAAZsf,KACrCtf,GAASA,MACPA,YAAiBsB,QAWhB,CAAA,GAAoB,gBAATtB,GAAmB,CACjC,GAAIoW,GAAqBhX,EAAO6V,qBAA4D,OAArCjV,EAAMlD,OAAOkD,EAAMvD,OAAS,EAAG,GAClFia,EAAatX,EAAOiX,eAAerW,EAAOsiB,EAC1ClM,IAAqE,OAA/CM,EAAW5Z,OAAO4Z,EAAWja,OAAS,EAAG,KACjEia,EAAaA,EAAW5Z,OAAO,EAAG4Z,EAAWja,OAAS,GACxD,IAAI2J,GAAShH,EAAOpB,IAAI0Y,EACxB,KAAKtQ,EACH,KAAM,IAAIjJ,OAAM,sCAAwC6C,EAAQ,QAAU0W,GAAc4L,EAAU,UAAYA,EAAU,KAAO,KACjI,OAAOlc,GAAOoK,aAAepK,EAAO,WAAaA,EAIjD,KAAM,IAAInM,WAAU,mBArBpB,IAAK,GADDsoB,MACK/lB,EAAI,EAAGA,EAAIwD,EAAMvD,OAAQD,IAChC+lB,EAAgB/mB,KAAK4D,EAAO,UAAUY,EAAMxD,GAAI8lB,GAClD1a,SAAQqD,IAAIsX,GAAiBjb,KAAK,SAAS1J,GACrC0hB,GACFA,EAASxL,MAAM,KAAMlW,IACtBykB,GAmBP,QAASjV,GAAO7O,EAAMwB,EAAMyiB,GAuC1B,QAASrf,GAAQsf,EAAKpiB,EAAS+F,GAiB3B,QAASsc,GAAkB1iB,EAAOsf,EAAU+C,GAC1C,MAAoB,gBAATriB,IAAwC,kBAAZsf,GAC9BmD,EAAIziB,GACN6E,EAAQ3G,KAAKkB,EAAQY,EAAOsf,EAAU+C,EAASjc,EAAOwW,IAlBjE,IAAK,GADD+F,MACKnmB,EAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/BmmB,EAAUnnB,KAAKinB,EAAI1iB,EAAKvD,IAE1B4J,GAAOwc,IAAMxc,EAAOwW,GAEpBxW,EAAOwP,OAAS,aAGG,IAAfiN,GACFF,EAAUlW,OAAOoW,EAAa,EAAGzc,GAEf,IAAhB0c,GACFH,EAAUlW,OAAOqW,EAAc,EAAGziB,GAEhB,IAAhBuhB,IAMFc,EAAkBK,MAAQ,SAASxkB,GAEjC,GAAI6X,GAAqBhX,EAAO6V,qBAA0D,OAAnC1W,EAAKzB,OAAOyB,EAAK9B,OAAS,EAAG,GAChF1C,EAAMqF,EAAOiX,eAAe9X,EAAM6H,EAAOwW,GAG7C,OAFIxG,IAAuD,OAAjCrc,EAAI+C,OAAO/C,EAAI0C,OAAS,EAAG,KACnD1C,EAAMA,EAAI+C,OAAO,EAAG/C,EAAI0C,OAAS,IAC5B1C,GAET4oB,EAAUlW,OAAOmV,EAAc,EAAGc,GAIpC,IAAIlI,GAAa1e,EAAS+I,OAC1B/I,GAAS+I,QAAUA,CAEnB,IAAIxJ,GAASmnB,EAAQ1O,MAAsB,IAAhBgP,EAAqBhnB,EAAWuE,EAASsiB,EAOpE,OALA7mB,GAAS+I,QAAU2V,EAEE,mBAAVnf,IAAyB+K,IAClC/K,EAAS+K,EAAO/F,SAEG,mBAAVhF,GACFA,EADT,OAlFiB,gBAARkD,KACTikB,EAAUziB,EACVA,EAAOxB,EACPA,EAAO,MAEHwB,YAAgBuB,SACpBkhB,EAAUziB,EACVA,GAAQ,UAAW,UAAW,UAAU0M,OAAO,EAAG+V,EAAQ/lB,SAGtC,kBAAX+lB,KACTA,EAAU,SAAUA,GAClB,MAAO,YAAa,MAAOA,KAC1BA,IAGyBxnB,SAA1B+E,EAAKA,EAAKtD,OAAS,IACrBsD,EAAKxE,KAGP,IAAIqmB,GAAckB,EAAcD,CAEsB,MAAjDjB,EAAejlB,EAAQuB,KAAK6B,EAAM,cAErCA,EAAK0M,OAAOmV,EAAc,GAIrBrjB,IACHwB,EAAOA,EAAKwB,OAAO0e,EAAWuC,EAAQnmB,WAAYulB,MAGA,KAAjDkB,EAAenmB,EAAQuB,KAAK6B,EAAM,aACrCA,EAAK0M,OAAOqW,EAAc,GAEwB,KAA/CD,EAAclmB,EAAQuB,KAAK6B,EAAM,YACpCA,EAAK0M,OAAOoW,EAAa,EAkD3B,IAAI5f,GAAQC,GACZD,GAAM1E,KAAOA,IAASa,EAAOiX,gBAAkBjX,EAAOiI,WAAWnJ,KAAKkB,EAAQb,GAC9E0E,EAAMlD,KAAOA,EACbkD,EAAME,QAAUA,EAEhB/D,EAAOke,eACLC,KAAK,EACLta,MAAOA,IAtKX,GAAI7D,GAAS1D,IACbyR,GAAYjP,KAAKxC,KAEjB,IAAI4kB,GAAe,2CACf6B,EAAgB,kCAChBC,EAAiB,6CACjBN,EAAiB,eACjBE,EAAU,aAEVE,IAgKJ9U,GAAOmQ,OAGPjf,EAAK,kBAAmB,SAAS8gB,GAC/B,MAAO,UAAStc,EAAMuR,GAEpB,IAAKA,IAAaA,EAASkJ,IACzB,MAAO6B,GAAelhB,KAAKxC,KAAMoH,EAAMuR,EAEzC,IAAImJ,GAAU1a,GAAQA,EAAKE,SACvBC,EAAQoR,EAASpR,KAErB,IAAIua,EACF,GAAKA,EAAQpa,QAA4B,UAAlBoa,EAAQpa,QAE1B,IAAKH,EAAM1E,MAA0B,OAAlBif,EAAQpa,OAC9B,KAAM,IAAIjG,OAAM,qCAAuCqgB,EAAQpa,OAAS,WAAaN,EAAKvE,UAF1Fif,GAAQpa,OAAS,KAMrB,IAAKH,EAAM1E,KAkBLif,IACGA,EAAQva,OAAUua,EAAQ7G,OAEtB6G,EAAQva,OAASua,EAAQva,MAAM1E,MAAQif,EAAQva,MAAM1E,MAAQuE,EAAKvE,OACzEif,EAAQva,MAAQjI,QAFhBwiB,EAAQva,MAAQA,EAKlBua,EAAQ7G,QAAS,GAIb1T,EAAM1E,OAAQ7C,MAAKmgB,UACvBngB,KAAKmgB,QAAQ5Y,EAAM1E,MAAQ0E,OA9Bd,CACf,IAAKua,EACH,KAAM,IAAIvjB,WAAU,mCAEtB,IAAIujB,EAAQva,QAAUua,EAAQva,MAAM1E,KAClC,KAAM,IAAIpB,OAAM,wCAA0C2F,EAAKvE,KAEjEif,GAAQva,MAAQA,MA4BtB7D,EAAOuiB,UAAYvU,EACnBhO,EAAO4jB,WAAane,KAKxB,WAIE,GAAIoe,GAAW,yRAEf3kB,GAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACd,GAAI1D,GAAS1D,IAEb,IAA4B,OAAxBoH,EAAKE,SAASI,SAAoBN,EAAKE,SAASI,QAAUN,EAAK4C,OAAOrL,MAAM4oB,GAG9E,GAFAngB,EAAKE,SAASI,OAAS,MAElBhE,EAAO6F,SAAW7F,EAAO+D,WAAY,EAexCL,EAAKE,SAASG,QAAU,WACtB,MAAOL,GAAKE,SAASkgB,eAAepP,MAAMpY,KAAMqY,gBAhBH,CAC/C,GAAI8L,GAAY/jB,EAASsR,MACzBtR,GAASsR,OAAS1R,KAAKimB,SAEvB,KACEtP,GAAOnU,KAAKkB,EAAQ0D,GAEtB,QACEhH,EAASsR,OAASyS,EAGpB,IAAK/c,EAAKE,SAASC,QAAUH,EAAKE,SAAS2T,OACzC,KAAM,IAAI1c,WAAU,cAAgB6I,EAAKvE,KAAO,mBAStD,MAAOmM,GAAYxM,KAAKkB,EAAQ0D,SActC,WACE,QAASqgB,GAAc/jB,EAAQ0F,GAE7B,GAAIA,EAAY,CACd,GAAIse,EACJ,IAAIhkB,EAAO8V,aACT,GAAyD,KAApDkO,EAAoBte,EAAW1J,YAAY,MAC9C,MAAO0J,GAAWhI,OAAOsmB,EAAoB,OAG/C,IAAqD,KAAhDA,EAAoBte,EAAWnI,QAAQ,MAC1C,MAAOmI,GAAWhI,OAAO,EAAGsmB,EAGhC,OAAOte,IAIX,QAASue,GAAYjkB,EAAQb,GAC3B,GAAI+kB,GACAC,EAEA7B,EAAcnjB,EAAKnD,YAAY,IAEnC,OAAmB,IAAfsmB,GAGAtiB,EAAO8V,aACToO,EAAe/kB,EAAKzB,OAAO4kB,EAAc,GACzC6B,EAAahlB,EAAKzB,OAAO,EAAG4kB,KAG5B4B,EAAe/kB,EAAKzB,OAAO,EAAG4kB,GAC9B6B,EAAahlB,EAAKzB,OAAO4kB,EAAc,IAAM4B,EAAaxmB,OAAOwmB,EAAaloB,YAAY,KAAO,KAIjGooB,SAAUF,EACVG,OAAQF,IAdV,OAmBF,QAASG,GAAmBtkB,EAAQkkB,EAAcC,EAAYlM,GAI5D,MAHIA,IAAuE,OAAnDiM,EAAaxmB,OAAOwmB,EAAa7mB,OAAS,EAAG,KACnE6mB,EAAeA,EAAaxmB,OAAO,EAAGwmB,EAAa7mB,OAAS,IAE1D2C,EAAO8V,YACFqO,EAAa,IAAMD,EAGnBA,EAAe,IAAMC,EAOhC,QAASI,GAAsBvkB,EAAQwkB,GACrC,MAAOxkB,GAAO6V,qBAAwD,OAAjC2O,EAAI9mB,OAAO8mB,EAAInnB,OAAS,EAAG,GAGlE,QAASonB,GAAoB7L,GAC3B,MAAO,UAASzZ,EAAMuG,EAAY4U,GAChC,GAAIta,GAAS1D,KAETooB,EAAST,EAAYjkB,EAAQb,EAGjC,IAFAuG,EAAaqe,EAAcznB,KAAMoJ,IAE5Bgf,EACH,MAAO9L,GAAc9Z,KAAKxC,KAAM6C,EAAMuG,EAAY4U,EAGpD,IAAI4J,GAAelkB,EAAO4Y,cAAc8L,EAAON,SAAU1e,GAAY,GACjEye,EAAankB,EAAO4Y,cAAc8L,EAAOL,OAAQ3e,GAAY,EACjE,OAAO4e,GAAmBtkB,EAAQkkB,EAAcC,EAAYI,EAAsBvkB,EAAQ0kB,EAAON,YAIrGllB,EAAK,iBAAkBulB,GACvBvlB,EAAK,gBAAiBulB,GAEtBvlB,EAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAY4U,GAChC,GAAIta,GAAS1D,IAEboJ,GAAaqe,EAAcznB,KAAMoJ,EAEjC,IAAIgf,GAAST,EAAYjkB,EAAQb,EAEjC,OAAKulB,GAGElc,QAAQqD,KACb7L,EAAOiI,UAAUyc,EAAON,SAAU1e,GAAY,GAC9C1F,EAAOiI,UAAUyc,EAAOL,OAAQ3e,GAAY,KAE7CwC,KAAK,SAASoP,GACb,MAAOgN,GAAmBtkB,EAAQsX,EAAW,GAAIA,EAAW,GAAIiN,EAAsBvkB,EAAQ0kB,EAAON,aAP9Fnc,EAAUnJ,KAAKkB,EAAQb,EAAMuG,EAAY4U,MAYtDpb,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAKIihB,GALA3kB,EAAS1D,KAET6C,EAAOuE,EAAKvE,IAiBhB,OAbIa,GAAO8V,YACsC,KAA1C6O,EAAoBxlB,EAAK5B,QAAQ,QACpCmG,EAAKE,SAAS5D,OAASb,EAAKzB,OAAO,EAAGinB,GACtCjhB,EAAKvE,KAAOA,EAAKzB,OAAOinB,EAAoB,IAIK,KAA9CA,EAAoBxlB,EAAKnD,YAAY,QACxC0H,EAAKE,SAAS5D,OAASb,EAAKzB,OAAOinB,EAAoB,GACvDjhB,EAAKvE,KAAOA,EAAKzB,OAAO,EAAGinB,IAIxBzZ,EAAOpM,KAAKkB,EAAQ0D,GAC1BwE,KAAK,SAASoC,GACb,MAAyB,IAArBqa,GAA4BjhB,EAAKE,SAAS5D,QAKtCA,EAAOmR,cAAgBnR,GAAQiI,UAAUvE,EAAKE,SAAS5D,OAAQ0D,EAAKvE,MAC3E+I,KAAK,SAAS0c,GAEb,MADAlhB,GAAKE,SAAS5D,OAAS4kB,EAChBta,IAPAA,IAUVpC,KAAK,SAASoC,GACb,GAAI+Z,GAAS3gB,EAAKE,SAAS5D,MAE3B,KAAKqkB,EACH,MAAO/Z,EAGT,IAAI5G,EAAKvE,MAAQklB,EACf,KAAM,IAAItmB,OAAM,UAAYsmB,EAAS,sHAGvC,IAAIrkB,EAAOyc,SAAWzc,EAAOyc,QAAQtd,GACnC,MAAOmL,EAET,IAAI6G,GAAenR,EAAOmR,cAAgBnR,CAG1C,OAAOmR,GAAa,UAAUkT,GAC7Bnc,KAAK,SAAS+W,GAKb,MAHAvb,GAAKE,SAASqb,aAAeA,EAE7Bvb,EAAK4G,QAAUA,EACX2U,EAAa/T,OACR+T,EAAa/T,OAAOpM,KAAKkB,EAAQ0D,GAEnC4G,SAMfpL,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,GAAI1D,GAAS1D,IACb,IAAIoH,EAAKE,SAASqb,cAAwC,WAAxBvb,EAAKE,SAASI,OAAqB,CACnE,GAA0C,kBAA/BN,GAAKE,SAASqb,cAA+Bvb,EAAKE,SAASqb,uBAAwB/gB,IAAwD,kBAAvCwF,GAAKE,SAASqb,aAAdvb,WAC7G,MAAO,EAET,IADAA,EAAKE,SAASiY,YAAa,EACvBnY,EAAKE,SAASqb,aAAa7T,MAC7B,MAAO1H,GAAKE,SAASqb,aAAa7T,MAAMtM,KAAKkB,EAAQ0D,EAAM,SAASA,GAClE,MAAO0H,GAAMtM,KAAKkB,EAAQ0D,KAGhC,MAAO0H,GAAMtM,KAAKkB,EAAQ0D,MAI9BxE,EAAK,YAAa,SAASmM,GACzB,MAAO,UAAS3H,GACd,GAAI1D,GAAS1D,KACTsiB,EAAOjK,SACX,OAAIjR,GAAKE,SAASqb,cAAgBvb,EAAKE,SAASqb,aAAa5T,WAAqC,WAAxB3H,EAAKE,SAASI,OAC/EwE,QAAQC,QAAQ/E,EAAKE,SAASqb,aAAa5T,UAAUqJ,MAAM1U,EAAQ4e,IAAO1W,KAAK,SAASvE,GAC7F,GAAIsO,GAAYvO,EAAKE,SAASqO,SAG9B,IAAIA,EAAW,CACb,GAAwB,gBAAbA,GACT,KAAM,IAAIlU,OAAM,oDAElB,IAAImhB,GAAexb,EAAK4G,QAAQpN,MAAM,KAAK,EAGtC+U,GAAUkN,MAAQlN,EAAUkN,MAAQzb,EAAK4G,UAC5C2H,EAAUkN,KAAOD,EAAe,iBAG7BjN,EAAUmN,SAAWnN,EAAUmN,QAAQ/hB,QAAU,KAAO4U,EAAUmN,QAAQ,IAAMnN,EAAUmN,QAAQ,IAAM1b,EAAK4G,YAChH2H,EAAUmN,SAAWF,IASzB,MAHqB,gBAAVvb,KACTD,EAAK4C,OAAS3C,GAET0H,EAAUqJ,MAAM1U,EAAQ4e,KAG5BvT,EAAUqJ,MAAM1U,EAAQ4e,MAInC1f,EAAK,cAAe,SAASoM,GAC3B,MAAO,UAAS5H,GACd,GAAI1D,GAAS1D,KACTuoB,GAAoB,CAExB,IAAInhB,EAAKE,SAASqb,eAAiBjf,EAAO6F,SAAmC,WAAxBnC,EAAKE,SAASI,OAAqB,CACtF,GAAIN,EAAKE,SAASqb,aAAa3T,YAC7B,MAAO9C,SAAQC,QAAQ/E,EAAKE,SAASqb,aAAa3T,YAAYxM,KAAKkB,EAAQ0D,EAAM,SAASA,GACxF,GAAImhB,EACF,KAAM,IAAI9mB,OAAM,wCAElB,OADA8mB,IAAoB,EACbvZ,EAAYxM,KAAKkB,EAAQ0D,MAC9BwE,KAAK,SAASvE,GAChB,MAAIkhB,GACKlhB,GAEM/H,SAAX+H,GACFF,EAAkBC,EAAMC,GACnB2H,EAAYxM,KAAKkB,EAAQ0D,KAE/B,IAA0C,kBAA/BA,GAAKE,SAASqb,cAA+Bvb,EAAKE,SAASqb,uBAAwB/gB,IAAwD,kBAAvCwF,GAAKE,SAASqb,aAAdvb,WAClH,MAAO8E,SAAQC,SAAS/E,EAAKE,SAASqb,aAAdvb,YAAsCA,EAAKE,SAASqb,cAAcngB,KAAKkB,EAAQ0D,EAAK4G,QAAS5G,EAAKvE,OACzH+I,KAAK,SAAUvE,GAGd,MAFe/H,UAAX+H,GACFF,EAAkBC,EAAMC,GACnB2H,EAAYxM,KAAKkB,EAAQ0D,KAGtC,MAAO4H,GAAYxM,KAAKkB,EAAQ0D,QA6CpC,IAAIiE,KAAiB,UAAW,OAAQ,MAAO,QAAS,aAAc,WAuDlEY,GAAqB,aAsDzBrJ,GAAK,YAAa,SAAS+I,GACzB,MAAO,UAAS9I,EAAMuG,EAAYsQ,GAChC,GAAIhW,GAAS1D,IACb,OAAOqM,GAAmB7J,KAAKkB,EAAQb,EAAMuG,GAC5CwC,KAAK,SAAS/I,GACb,MAAO8I,GAAUnJ,KAAKkB,EAAQb,EAAMuG,EAAYsQ,KAEjD9N,KAAK,SAASoP,GACb,MAAOjP,GAAuBvJ,KAAKkB,EAAQsX,EAAY5R,QAY/D,WAEExG,EAAK,QAAS,SAASkM,GACrB,MAAO,UAAS1H,GACd,GAAIohB,GAAQphB,EAAKE,SAASkhB,MACtBC,EAAYrhB,EAAKE,SAASjD,QAC9B,IAAImkB,EAAO,CACTphB,EAAKE,SAASI,OAAS,SACvB,IAAIH,GAAQC,GAeZ,OAdAxH,MAAKmgB,QAAQ/Y,EAAKvE,MAAQ0E,EAC1BA,EAAM+C,aAAc,EACpB/C,EAAMlD,KAAOokB,EAAU5iB,QAAQ2iB,IAC/BjhB,EAAM6C,QAAU,SAASse,GACvB,OACEzH,SAAU,SAASvW,GACjB,IAAK,GAAI9K,KAAK8K,GACZge,EAAQ9oB,EAAG8K,EAAO9K,GAChB8K,GAAOoK,eACTvN,EAAMmD,OAAO/F,QAAQmQ,cAAe,KAExCrN,QAAS,eAGN,GAGT,MAAOqH,GAAMtM,KAAKxC,KAAMoH,SA8C9B,WA8CE,QAASuhB,GAAgBrS,EAAQ1W,EAAGoF,GAGlC,IAFA,GACI4jB,GADAhhB,EAAShI,EAAEgB,MAAM,KAEdgH,EAAO7G,OAAS,GACrB6nB,EAAUhhB,EAAOC,QACjByO,EAASA,EAAOsS,GAAWtS,EAAOsS,MAEpCA,GAAUhhB,EAAOC,QACX+gB,IAAWtS,KACfA,EAAOsS,GAAW5jB,GArDtBjC,EAAgB,SAAS0O,GACvB,MAAO,YACLzR,KAAKqG,QACLoL,EAAYjP,KAAKxC,SAIrB4C,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAQIwW,GARAvX,EAAOrG,KAAKqG,KACZxD,EAAOuE,EAAKvE,KAMZ2b,EAAY,CAEhB,KAAK,GAAI9T,KAAUrE,GAEjB,GADAuX,EAAgBlT,EAAOzJ,QAAQ,KACT,KAAlB2c,GAEAlT,EAAOtJ,OAAO,EAAGwc,KAAmB/a,EAAKzB,OAAO,EAAGwc,IAChDlT,EAAOtJ,OAAOwc,EAAgB,KAAO/a,EAAKzB,OAAOyB,EAAK9B,OAAS2J,EAAO3J,OAAS6c,EAAgB,GAAI,CACxG,GAAIiL,GAAQne,EAAO9J,MAAM,KAAKG,MAC1B8nB,GAAQrK,IACVA,EAAYqK,GACdnjB,EAAW0B,EAAKE,SAAUjB,EAAKqE,GAAS8T,GAAaqK,GAQzD,MAHIxiB,GAAKxD,IACP6C,EAAW0B,EAAKE,SAAUjB,EAAKxD,IAE1B+L,EAAOpM,KAAKxC,KAAMoH,KAM7B,IAAI0hB,GAAY,uFACZC,EAAgB,uEAcpBnmB,GAAK,YAAa,SAASmM,GACzB,MAAO,UAAS3H,GAEd,GAA4B,WAAxBA,EAAKE,SAASI,OAEhB,MADAN,GAAKE,SAASjD,KAAO+C,EAAKE,SAASjD,SAC5B6H,QAAQC,QAAQ/E,EAAK4C,OAI9B,IAAI3D,GAAOe,EAAK4C,OAAOrL,MAAMmqB,EAC7B,IAAIziB,EAGF,IAAK,GAFD2iB,GAAY3iB,EAAK,GAAG1H,MAAMoqB,GAErBjoB,EAAI,EAAGA,EAAIkoB,EAAUjoB,OAAQD,IAAK,CACzC,GAAI8nB,GAAUI,EAAUloB,GACpBugB,EAAMuH,EAAQ7nB,OAEdkoB,EAAYL,EAAQxnB,OAAO,EAAG,EAIlC,IAHkC,KAA9BwnB,EAAQxnB,OAAOigB,EAAM,EAAG,IAC1BA,IAEe,KAAb4H,GAAiC,KAAbA,EAAxB,CAGA,GAAIC,GAAaN,EAAQxnB,OAAO,EAAGwnB,EAAQ7nB,OAAS,GAChDooB,EAAWD,EAAW9nB,OAAO,EAAG8nB,EAAWjoB,QAAQ,KAEvD,IAAIkoB,EAAU,CACZ,GAAIC,GAAYF,EAAW9nB,OAAO+nB,EAASpoB,OAAS,EAAGmoB,EAAWnoB,OAASooB,EAASpoB,OAAS,EAE9C,OAA3CooB,EAAS/nB,OAAO+nB,EAASpoB,OAAS,EAAG,IACvCooB,EAAWA,EAAS/nB,OAAO,EAAG+nB,EAASpoB,OAAS,GAChDqG,EAAKE,SAAS6hB,GAAY/hB,EAAKE,SAAS6hB,OACxC/hB,EAAKE,SAAS6hB,GAAUrpB,KAAKspB,IAEtBhiB,EAAKE,SAAS6hB,YAAqBvjB,QAE1Ca,EAAKjE,KAAKxC,KAAM,UAAYoH,EAAKvE,KAAO,8BAAgCumB,EAAY,qDAAuDA,EAAY,gCACvJhiB,EAAKE,SAAS6hB,GAAUrpB,KAAKspB,IAG7BT,EAAgBvhB,EAAKE,SAAU6hB,EAAUC,OAI3ChiB,GAAKE,SAAS4hB,IAAc,GAKlC,MAAOna,GAAUqJ,MAAMpY,KAAMqY,iBAmBnC,WAMEtV,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MACjBA,KAAKua,WACLva,KAAK+B,QAAQsnB,oBAKjBzmB,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAAI1D,GAAS1D,KACTspB,GAAU,CAEd,MAAMliB,EAAKvE,OAAQa,GAAOyc,SACxB,IAAK,GAAI3a,KAAK9B,GAAO6W,QAAS,CAC5B,IAAK,GAAIzZ,GAAI,EAAGA,EAAI4C,EAAO6W,QAAQ/U,GAAGzE,OAAQD,IAAK,CACjD,GAAIyoB,GAAY7lB,EAAO6W,QAAQ/U,GAAG1E,EAElC,IAAIyoB,GAAaniB,EAAKvE,KAAM,CAC1BymB,GAAU,CACV,OAIF,GAA8B,IAA1BC,EAAUtoB,QAAQ,KAAY,CAChC,GAAIuoB,GAAQD,EAAU3oB,MAAM,IAC5B,IAAoB,GAAhB4oB,EAAMzoB,OAAa,CACrB2C,EAAO6W,QAAQ/U,GAAGuL,OAAOjQ,IAAK,EAC9B,UAGF,GAAIsG,EAAKvE,KAAK4mB,UAAU,EAAGD,EAAM,GAAGzoB,SAAWyoB,EAAM,IACjDpiB,EAAKvE,KAAKzB,OAAOgG,EAAKvE,KAAK9B,OAASyoB,EAAM,GAAGzoB,OAAQyoB,EAAM,GAAGzoB,SAAWyoB,EAAM,IACyB,IAAxGpiB,EAAKvE,KAAKzB,OAAOooB,EAAM,GAAGzoB,OAAQqG,EAAKvE,KAAK9B,OAASyoB,EAAM,GAAGzoB,OAASyoB,EAAM,GAAGzoB,QAAQE,QAAQ,KAAY,CAC9GqoB,GAAU,CACV,SAKN,GAAIA,EACF,MAAO5lB,GAAO,UAAU8B,GACvBoG,KAAK,WACJ,MAAOgD,GAAOpM,KAAKkB,EAAQ0D,KAInC,MAAOwH,GAAOpM,KAAKkB,EAAQ0D,SA0BjC,WACErE,EAAgB,SAAS0O,GACvB,MAAO,YACLA,EAAYjP,KAAKxC,MACjBA,KAAKsG,eAIT1D,EAAK,SAAU,SAASgM,GACtB,MAAO,UAASxH,GACd,GAAI1D,GAAS1D,KAETqE,EAAOX,EAAO4C,SAASc,EAAKvE,KAChC,IAAIwB,EACF,IAAK,GAAIvD,GAAI,EAAGA,EAAIuD,EAAKtD,OAAQD,IAC/B4C,EAAO,UAAUW,EAAKvD,GAAIsG,EAAKvE,KAEnC,OAAO+L,GAAOpM,KAAKkB,EAAQ0D,SAKjCkL,EAAS,GAAI/P,GAEbnC,EAASwX,SAAWtF,EACpBA,EAAOoX,QAAU,mBACM,gBAAVhf,SAAsBA,OAAO/F,SAA6B,gBAAXA,WACxD+F,OAAO/F,QAAU2N,GAEnBlS,EAASkS,OAASA,GAEF,mBAARnS,MAAsBA,KAAOhC,QAGvC,GAAIwrB,GAAgC,mBAAZzd,QAGxB,IAAwB,mBAAbQ,UAA0B,CACnC,GAAIkd,GAAUld,SAASS,qBAAqB,SAM5C,IALAnM,aAAe4oB,EAAQA,EAAQ7oB,OAAS,GACpC2L,SAASmd,gBAAkB7oB,aAAa8oB,OAAS9oB,aAAa6e,SAChE7e,aAAe0L,SAASmd,eACrB7oB,aAAaE,MAChBF,aAAe1B,QACbqqB,EAAY,CACd,GAAII,GAAU/oB,aAAaE,IACvB8oB,EAAWD,EAAQ3oB,OAAO,EAAG2oB,EAAQrqB,YAAY,KAAO,EAC5D8M,QAAOyd,kBAAoB/rB,EAC3BwO,SAASwd,MACP,uCAA8CF,EAAW,sCAI3D9rB,SAIC,IAA6B,mBAAlBuO,eAA+B,CAC7C,GAAIud,GAAW,EACf,KACE,KAAM,IAAIvoB,OAAM,KAChB,MAAOuL,GACPA,EAAEvM,MAAM/B,QAAQ,iCAAkC,SAASF,EAAGH,GAC5D2C,cAAiBE,IAAK7C,GACtB2rB,EAAW3rB,EAAIK,QAAQ,YAAa,OAGpCirB,GACFld,cAAcud,EAAW,uBAC3B9rB,QAGA8C,cAAoC,mBAAdmpB,aAA8BjpB,IAAKipB,YAAe,KACxEjsB"} \ No newline at end of file diff --git a/node_modules/systemjs/dist/system.src.js b/node_modules/systemjs/dist/system.src.js index 13dbc2fe5..e7e59edc3 100644 --- a/node_modules/systemjs/dist/system.src.js +++ b/node_modules/systemjs/dist/system.src.js @@ -1,5 +1,5 @@ /* - * SystemJS v0.19.41 + * SystemJS v0.19.47 */ (function() { function bootstrap() {// from https://gist.github.com/Yaffle/1088850 @@ -7,7 +7,7 @@ function bootstrap() {// from https://gist.github.com/Yaffle/1088850 function URLPolyfill(url, baseURL) { if (typeof url != 'string') throw new TypeError('URL must be a string'); - var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); + var m = String(url).replace(/^\s+|\s+$/g, "").replace(/\\/g, '/').match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); if (!m) throw new RangeError('Invalid URL format'); var protocol = m[1] || ""; @@ -65,7 +65,8 @@ function URLPolyfill(url, baseURL) { this.hash = hash; } global.URLPolyfill = URLPolyfill; -})(typeof self != 'undefined' ? self : global);(function(__global) { +})(typeof self != 'undefined' ? self : global); +(function(__global) { var isWorker = typeof window == 'undefined' && typeof self != 'undefined' && typeof importScripts != 'undefined'; var isBrowser = typeof window != 'undefined' && typeof document != 'undefined'; @@ -83,7 +84,7 @@ global.URLPolyfill = URLPolyfill; } return -1; }; - + var defineProperty; (function () { try { @@ -120,9 +121,9 @@ global.URLPolyfill = URLPolyfill; newMsg = newMsg.replace(isWindows ? /file:\/\/\//g : /file:\/\//g, ''); var newErr = errArgs ? new Error(newMsg, err.fileName, err.lineNumber) : new Error(newMsg); - + newErr.stack = newMsg; - + // track the original error newErr.originalErr = err.originalErr || err; @@ -431,7 +432,7 @@ function logloads(loads) { .then(function(instantiateResult) { if (instantiateResult === undefined) throw new TypeError('Declarative modules unsupported in the polyfill.'); - + if (typeof instantiateResult != 'object') throw new TypeError('Invalid instantiate return value'); @@ -494,8 +495,6 @@ function logloads(loads) { for (var i = 0, l = linkSets.length; i < l; i++) { linkSetFailed(linkSets[i], load, exc); } - - console.assert(load.linkSets.length == 0, 'linkSets not removed'); }); } @@ -548,7 +547,6 @@ function logloads(loads) { proceedToFetch(loader, load, Promise.resolve(stepState.moduleAddress)); else { - console.assert(step == 'translate', 'translate step'); load.address = stepState.moduleAddress; proceedToTranslate(loader, load, Promise.resolve(stepState.moduleSource)); } @@ -636,9 +634,6 @@ function logloads(loads) { function updateLinkSetOnLoad(linkSet, load) { // console.log('update linkset on load ' + load.name); // snapshot(linkSet.loader); - - console.assert(load.status == 'loaded' || load.status == 'linked', 'loaded or linked'); - linkSet.loadingCount--; if (linkSet.loadingCount > 0) @@ -671,8 +666,6 @@ function logloads(loads) { if (abrupt) return; - console.assert(linkSet.loads.length == 0, 'loads cleared'); - linkSet.resolve(startingLoad); } @@ -681,7 +674,7 @@ function logloads(loads) { var loader = linkSet.loader; var requests; - checkError: + checkError: if (load) { if (linkSet.loads[0].name == load.name) { exc = addToError(exc, 'Error loading ' + load.name); @@ -715,7 +708,6 @@ function logloads(loads) { loader.loaderObj.failed.push(load); var linkIndex = indexOf.call(load.linkSets, linkSet); - console.assert(linkIndex != -1, 'link not present'); load.linkSets.splice(linkIndex, 1); if (load.linkSets.length == 0) { var globalLoadsIndex = indexOf.call(linkSet.loader.loads, load); @@ -747,7 +739,6 @@ function logloads(loads) { } // if not anonymous, add to the module table if (load.name) { - console.assert(!loader.modules[load.name] || loader.modules[load.name].module === load.module.module, 'load not in module table'); loader.modules[load.name] = load.module; } var loadIndex = indexOf.call(loader.loads, load); @@ -857,7 +848,7 @@ function logloads(loads) { var loader = this._loader; if (loader.modules[name]) return Promise.resolve(); - return loader.importPromises[name] || createImportPromise(this, name, new Promise(asyncStartLoadPartwayThrough({ + return (loader.importPromises[name] || createImportPromise(this, name, new Promise(asyncStartLoadPartwayThrough({ step: 'locate', loader: loader, moduleName: name, @@ -865,9 +856,11 @@ function logloads(loads) { moduleSource: undefined, moduleAddress: undefined })) - .then(function() { + .then(function(load) { delete loader.importPromises[name]; - })); + return load.module.module; + }))) + .then(function () {}); }, // 26.3.3.11 module: function(source, options) { @@ -977,7 +970,6 @@ function logloads(loads) { })(); var System; - var fetchTextFromURL; if (typeof XMLHttpRequest != 'undefined') { fetchTextFromURL = function(url, authorization, fulfill, reject) { @@ -1265,7 +1257,7 @@ function applyPaths(loader, name) { if (p.indexOf('*') === -1) { if (name == p) return paths[p]; - + // support trailing / in paths rules else if (name.substr(0, p.length - 1) == p.substr(0, p.length - 1) && (name.length < p.length || name[p.length - 1] == p[p.length - 1]) && (paths[p][paths[p].length - 1] == '/' || paths[p] == '')) { return paths[p].substr(0, paths[p].length - 1) + (name.length > p.length ? (paths[p] && '/' || '') + name.substr(p.length) : ''); @@ -1419,7 +1411,7 @@ function extendPkgConfig(pkgCfgA, pkgCfgB, pkgName, loader, warnInvalidPropertie loader.depCache[dNormalized] = (loader.depCache[dNormalized] || []).concat(pkgCfgB.depCache[d]); } } - else if (warnInvalidProperties && indexOf.call(['browserConfig', 'nodeConfig', 'devConfig', 'productionConfig'], prop) == -1 && + else if (warnInvalidProperties && indexOf.call(['browserConfig', 'nodeConfig', 'devConfig', 'productionConfig'], prop) == -1 && (!pkgCfgB.hasOwnProperty || pkgCfgB.hasOwnProperty(prop))) { warn.call(loader, '"' + prop + '" is not a valid package configuration option in package ' + pkgName); } @@ -1441,7 +1433,7 @@ function setPkgConfig(loader, pkgName, cfg, prependConfig) { extendPkgConfig(pkg, prependConfig ? cfg : basePkg, pkgName, loader, prependConfig); extendPkgConfig(pkg, prependConfig ? basePkg : cfg, pkgName, loader, !prependConfig); } - + // main object becomes main map if (typeof pkg.main == 'object') { pkg.map = pkg.map || {}; @@ -1457,6 +1449,15 @@ function warn(msg) { if (this.warnings && typeof console != 'undefined' && console.warn) console.warn(msg); } + +function createInstantiate (load, result) { + load.metadata.entry = createEntry(); + load.metadata.entry.execute = function() { + return result; + } + load.metadata.entry.deps = []; + load.metadata.format = 'defined'; +} // we define a __exec for globally-scoped execution // used by module format implementations var __exec; @@ -2902,7 +2903,7 @@ SystemJSLoader.prototype.config = function(cfg, isEnvConfig) { * * * The code here replicates the ES6 linking groups algorithm to ensure that - * circular ES6 compiled into System.register can work alongside circular AMD + * circular ES6 compiled into System.register can work alongside circular AMD * and CommonJS, identically to the actual ES6 loader. * */ @@ -2912,7 +2913,7 @@ SystemJSLoader.prototype.config = function(cfg, isEnvConfig) { * Registry side table entries in loader.defined * Registry Entry Contains: * - name - * - deps + * - deps * - declare for declarative modules * - execute for dynamic modules, different to declarative execute on module * - executingRequire indicates require drives execution for circularity of dynamic modules @@ -2930,7 +2931,7 @@ SystemJSLoader.prototype.config = function(cfg, isEnvConfig) { * For dynamic we track the es module with: * - esModule actual es module value * - esmExports whether to extend the esModule with named exports - * + * * Then for declarative only we track dynamic bindings with the 'module' records: * - name * - exports @@ -2975,7 +2976,7 @@ function createEntry() { * see https://github.com/ModuleLoader/es6-module-loader/wiki/System.register-Explained * * 2. System.registerDynamic for dynamic modules (3-4 params) - System.registerDynamic([name, ]deps, executingRequire, execute) - * the true or false statement + * the true or false statement * * this extension implements the linking algorithm for the two variations identical to the spec * allowing compiled ES6 circular references to work alongside AMD and CJS circular references. @@ -2994,7 +2995,7 @@ function createEntry() { return this.registerDynamic.apply(this, arguments); var entry = createEntry(); - // ideally wouldn't apply map config to bundle names but + // ideally wouldn't apply map config to bundle names but // dependencies go through map regardless so we can't restrict // could reconsider in shift to new spec entry.name = name && (this.decanonicalize || this.normalize).call(this, name); @@ -3080,17 +3081,17 @@ function createEntry() { for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { var depName = entry.normalizedDeps[i]; var depEntry = loader.defined[depName]; - + // not in the registry means already linked / ES6 if (!depEntry || depEntry.evaluated) continue; - + // now we know the entry is in our unlinked linkage group var depGroupIndex = entry.groupIndex + (depEntry.declarative != entry.declarative); // the group index of an entry is always the maximum if (depEntry.groupIndex === null || depEntry.groupIndex < depGroupIndex) { - + // if already in a group, remove from the old group if (depEntry.groupIndex !== null) { groups[depEntry.groupIndex].splice(indexOf.call(groups[depEntry.groupIndex], depEntry), 1); @@ -3130,7 +3131,7 @@ function createEntry() { else linkDynamicModule(entry, loader); } - curGroupDeclarative = !curGroupDeclarative; + curGroupDeclarative = !curGroupDeclarative; } } @@ -3190,7 +3191,7 @@ function createEntry() { // allowing undefined declaration was a mistake! To be deprecated. declaration = declaration || { setters: [], execute: function() {} }; - + module.setters = declaration.setters; module.execute = declaration.execute; @@ -3233,7 +3234,7 @@ function createEntry() { else { module.dependencies.push(null); } - + // run setters for all entries with the matching dependency name var originalIndices = entry.originalIndices[i]; for (var j = 0, len = originalIndices.length; j < len; ++j) { @@ -3259,7 +3260,7 @@ function createEntry() { else { if (entry.declarative) ensureEvaluated(name, entry, [], loader); - + else if (!entry.evaluated) linkDynamicModule(entry, loader); @@ -3268,7 +3269,7 @@ function createEntry() { if ((!entry || entry.declarative) && exports && exports.__useDefault) return exports['default']; - + return exports; } @@ -3306,7 +3307,7 @@ function createEntry() { throw new Error('Module ' + name + ' not declared as a dependency of ' + entry.name); }, exports, module); - + if (output !== undefined) module.exports = output; @@ -3330,7 +3331,7 @@ function createEntry() { * (unless one is a circular dependency already in the list of seen * modules, in which case we execute it) * - * Then we evaluate the module itself depth-first left to right + * Then we evaluate the module itself depth-first left to right * execution to match ES6 modules */ function ensureEvaluated(moduleName, entry, seen, loader) { @@ -3376,7 +3377,7 @@ function createEntry() { } load.metadata.deps = load.metadata.deps || []; - + return fetch.call(this, load); }; }); @@ -3387,7 +3388,7 @@ function createEntry() { load.metadata.deps = load.metadata.deps || []; return Promise.resolve(translate.apply(this, arguments)).then(function(source) { // run detection for register format - if (load.metadata.format == 'register' || !load.metadata.format && detectRegisterFormat(load.source)) + if (load.metadata.format == 'register' || load.metadata.format == 'system' || !load.metadata.format && detectRegisterFormat(load.source)) load.metadata.format = 'register'; return source; }); @@ -3405,7 +3406,7 @@ function createEntry() { entry.originalIndices = entry.normalizedDeps = []; - // recursively ensure that the module and all its + // recursively ensure that the module and all its // dependencies are linked (with dependency group handling) link(normalized, entry, loader); @@ -3456,9 +3457,9 @@ function createEntry() { // Contains System.register calls // (dont run bundles in the builder) - else if (!(loader.builder && load.metadata.bundle) + else if (!(loader.builder && load.metadata.bundle) && (load.metadata.format == 'register' || load.metadata.format == 'esm' || load.metadata.format == 'es6')) { - + if (typeof __exec != 'undefined') __exec.call(loader, load); @@ -3481,9 +3482,9 @@ function createEntry() { // place this module onto defined for circular references loader.defined[load.name] = entry; - + var grouped = group(entry.deps); - + entry.deps = grouped.names; entry.originalIndices = grouped.indices; entry.name = load.name; @@ -3501,7 +3502,7 @@ function createEntry() { return { deps: entry.deps, execute: function() { - // recursively ensure that the module and all its + // recursively ensure that the module and all its // dependencies are linked (with dependency group handling) link(load.name, entry, loader); @@ -3569,10 +3570,28 @@ function createEntry() { // do transpilation return (loader._loader.transpilerPromise || ( loader._loader.transpilerPromise = Promise.resolve( - __global[loader.transpiler == 'typescript' ? 'ts' : loader.transpiler] || (loader.pluginLoader || loader)['import'](loader.transpiler) + __global[loader.transpiler == 'typescript' ? 'ts' : loader.transpiler] || (loader.pluginLoader || loader).normalize(loader.transpiler) + .then(function(normalized) { + loader._loader.transpilerNormalized = normalized; + return (loader.pluginLoader || loader).load(normalized) + .then(function() { + return (loader.pluginLoader || loader).get(normalized); + }); + }) ))).then(function(transpiler) { loader._loader.loadedTranspilerRuntime = true; + if (typeof transpiler.default === 'function' && !__global[loader.transpiler == 'typescript' ? 'ts' : loader.transpiler]) { + // instantiate plugins dont build + if (loader.builder) + return source; + return Promise.resolve(transpiler.default.call(loader, load.address, load.name)) + .then(function (result) { + createInstantiate(load, result); + return ''; + }); + } + // translate hooks means this is a transpiler plugin instead of a raw implementation if (transpiler.translate) { // if transpiler is the same as the plugin loader, then don't run twice @@ -3589,7 +3608,7 @@ function createEntry() { var sourceMap = load.metadata.sourceMap; if (sourceMap && typeof sourceMap == 'object') { var originalName = load.address.split('!')[0]; - + // force set the filename of the original file if (!sourceMap.file || sourceMap.file == load.address) sourceMap.file = originalName + '!transpiled'; @@ -3608,14 +3627,14 @@ function createEntry() { // legacy builder support if (loader.builder) load.metadata.originalSource = load.source; - + // defined in es6-module-loader/src/transpile.js return transpile.call(loader, load) .then(function(source) { // clear sourceMap as transpiler embeds it load.metadata.sourceMap = undefined; return source; - }); + }); }, function(err) { throw addToError(err, 'Unable to load transpiler to transpile ' + load.name); }); @@ -4539,15 +4558,16 @@ hookConstructor(function(constructor) { hook('fetch', function(fetch) { return function(load) { var loader = this; - if (load.metadata.loaderModule && load.metadata.loaderModule.fetch && load.metadata.format != 'defined') { + if (load.metadata.loaderModule && load.metadata.format != 'defined') { + if (typeof load.metadata.loaderModule === 'function' || load.metadata.loaderModule instanceof Module && typeof load.metadata.loaderModule.default === 'function') + return ''; load.metadata.scriptLoad = false; - return load.metadata.loaderModule.fetch.call(loader, load, function(load) { - return fetch.call(loader, load); - }); - } - else { - return fetch.call(loader, load); + if (load.metadata.loaderModule.fetch) + return load.metadata.loaderModule.fetch.call(loader, load, function(load) { + return fetch.call(loader, load); + }); } + return fetch.call(loader, load); }; }); @@ -4584,9 +4604,7 @@ hookConstructor(function(constructor) { return translate.apply(loader, args); }); } - else { - return translate.apply(loader, args); - } + return translate.apply(loader, args); }; }); @@ -4595,28 +4613,30 @@ hookConstructor(function(constructor) { var loader = this; var calledInstantiate = false; - if (load.metadata.loaderModule && load.metadata.loaderModule.instantiate && !loader.builder && load.metadata.format != 'defined') - return Promise.resolve(load.metadata.loaderModule.instantiate.call(loader, load, function(load) { - if (calledInstantiate) - throw new Error('Instantiate must only be called once.'); - calledInstantiate = true; - return instantiate.call(loader, load); - })).then(function(result) { - if (calledInstantiate) - return result; - - if (result !== undefined) { - load.metadata.entry = createEntry(); - load.metadata.entry.execute = function() { + if (load.metadata.loaderModule && !loader.builder && load.metadata.format != 'defined') { + if (load.metadata.loaderModule.instantiate) + return Promise.resolve(load.metadata.loaderModule.instantiate.call(loader, load, function(load) { + if (calledInstantiate) + throw new Error('Instantiate must only be called once.'); + calledInstantiate = true; + return instantiate.call(loader, load); + })).then(function(result) { + if (calledInstantiate) return result; - } - load.metadata.entry.deps = load.metadata.deps; - load.metadata.format = 'defined'; - } - return instantiate.call(loader, load); - }); - else - return instantiate.call(loader, load); + + if (result !== undefined) + createInstantiate(load, result); + return instantiate.call(loader, load); + }); + else if (typeof load.metadata.loaderModule === 'function' || load.metadata.loaderModule instanceof Module && typeof load.metadata.loaderModule.default === 'function') + return Promise.resolve((load.metadata.loaderModule.default || load.metadata.loaderModule).call(loader, load.address, load.name)) + .then(function (result) { + if (result !== undefined) + createInstantiate(load, result); + return instantiate.call(loader, load); + }); + } + return instantiate.call(loader, load); }; }); @@ -5094,7 +5114,7 @@ hookConstructor(function(constructor) { System = new SystemJSLoader(); __global.SystemJS = System; -System.version = '0.19.41 Standard'; +System.version = '0.19.47 Standard'; if (typeof module == 'object' && module.exports && typeof exports == 'object') module.exports = System; diff --git a/node_modules/systemjs/index.js b/node_modules/systemjs/index.js index 6a958ecff..f8ebe41f2 100644 --- a/node_modules/systemjs/index.js +++ b/node_modules/systemjs/index.js @@ -7,18 +7,17 @@ var isWindows = typeof process.platform != 'undefined' && process.platform.match // set transpiler paths in Node var nodeResolver = typeof process != 'undefined' && typeof require != 'undefined' && require.resolve; -function configNodePath(loader, module, nodeModule, wildcard) { +function configNodePath(loader, module, nodeModule) { if (loader.paths[module]) return; - var ext = wildcard ? '/package.json' : ''; try { - var match = nodeResolver(nodeModule + ext).replace(/\\/g, '/'); + var match = nodeResolver(nodeModule + (module[module.length - 1] === '/' ? 'package.json' : '')).replace(/\\/g, '/'); } catch(e) {} - + if (match) - loader.paths[module] = 'file://' + (isWindows ? '/' : '') + match.substr(0, match.length - ext.length) + (wildcard ? '/*.js' : ''); + loader.paths[module] = 'file://' + (isWindows ? '/' : '') + match.substr(0, match.length - (module[module.length - 1] === '/' ? 12 : 0)); } var SystemJSLoader = require('./dist/system.src').constructor; @@ -32,7 +31,7 @@ function SystemJSNodeLoader() { configNodePath(this, 'traceur-runtime', 'traceur/bin/traceur-runtime.js'); configNodePath(this, 'babel', 'babel-core/browser.js'); configNodePath(this, 'babel/external-helpers', 'babel-core/external-helpers.js'); - configNodePath(this, 'babel-runtime/*', 'babel-runtime', true); + configNodePath(this, 'babel-runtime/', 'babel-runtime/'); } } SystemJSNodeLoader.prototype = Object.create(SystemJSLoader.prototype); diff --git a/node_modules/systemjs/package.json b/node_modules/systemjs/package.json index a32d45585..f4ceb08da 100644 --- a/node_modules/systemjs/package.json +++ b/node_modules/systemjs/package.json @@ -1,6 +1,6 @@ { "name": "systemjs", - "version": "0.19.41", + "version": "0.19.47", "description": "Universal dynamic module loader", "repository": { "type": "git", diff --git a/node_modules/through2/LICENSE b/node_modules/through2/LICENSE deleted file mode 100644 index f6a0029de..000000000 --- a/node_modules/through2/LICENSE +++ /dev/null @@ -1,39 +0,0 @@ -Copyright 2013, Rod Vagg (the "Original Author") -All rights reserved. - -MIT +no-false-attribs 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. - -Distributions of all or part of the Software intended to be used -by the recipients as they would use the unmodified Software, -containing modifications that substantially alter, remove, or -disable functionality of the Software, outside of the documented -configuration mechanisms provided by the Software, shall be -modified such that the Original Author's bug reporting email -addresses and urls are either replaced with the contact information -of the parties responsible for the changes, or removed entirely. - -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. - - -Except where noted, this license applies to any and all software -programs and associated documentation files created by the -Original Author, when distributed with the Software. \ No newline at end of file diff --git a/node_modules/through2/README.md b/node_modules/through2/README.md index c84b3464a..a916f15ef 100644 --- a/node_modules/through2/README.md +++ b/node_modules/through2/README.md @@ -20,6 +20,9 @@ fs.createReadStream('ex.txt') callback() })) .pipe(fs.createWriteStream('out.txt')) + .on('finish', function () { + doSomethingSpecial() + }) ``` Or object streams: diff --git a/node_modules/through2/package.json b/node_modules/through2/package.json index c7afac7f0..12d8fd665 100644 --- a/node_modules/through2/package.json +++ b/node_modules/through2/package.json @@ -1,6 +1,6 @@ { "name": "through2", - "version": "2.0.1", + "version": "2.0.3", "description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise", "main": "through2.js", "scripts": { @@ -20,13 +20,13 @@ "author": "Rod Vagg (https://github.com/rvagg)", "license": "MIT", "dependencies": { - "readable-stream": "~2.0.0", - "xtend": "~4.0.0" + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" }, "devDependencies": { - "bl": "~0.9.4", + "bl": "~1.1.2", "faucet": "0.0.1", "stream-spigot": "~3.0.5", - "tape": "~4.0.0" + "tape": "~4.6.2" } } diff --git a/node_modules/typescript/.mailmap b/node_modules/typescript/.mailmap index cc101c051..73ebed0cc 100644 --- a/node_modules/typescript/.mailmap +++ b/node_modules/typescript/.mailmap @@ -1,18 +1,22 @@  AbubakerB # Abubaker Bashir Alexander # Alexander Kuvaev +Aluan Haddad Adam Freidin Adam Freidin Adi Dahiya Adi Dahiya Ahmad Farid ahmad-farid Alexander Rusakov Alex Eagle Anatoly Ressin -Anders Hejlsberg unknown unknown +Anders Hejlsberg unknown unknown Anders Hejlsberg +about-code # Andreas Martin Andrej Baran +Andrew Ochsner Andrew Z Allen Andy Hanson Andy Anil Anar Anton Tolmachev +Anubha Mathur anubmat Arnavion # Arnav Singh Arthur Ozga Arthur Ozga Arthur Ozga Arthur Ozga Arthur Ozga Asad Saeeduddin @@ -21,6 +25,7 @@ Basarat Ali Syed Basarat Syed basa Bill Ticehurst Bill Ticehurst Ben Duffield Ben Mosher +Benjamin Bock Blake Embrey Bowden Kelly Brett Mayen @@ -37,6 +42,7 @@ Dan Corder Dan Quirk Dan Quirk nknown Daniel Rosenwasser Daniel Rosenwasser Daniel Rosenwasser Daniel Rosenwasser Daniel Rosenwasser David Li +David Sheldrick David Souther Denis Nedelyaev Dick van den Brink unknown unknown @@ -45,6 +51,7 @@ Dirk Holtwick Dom Chen Doug Ilijev Erik Edrosa +Erik McClenney erictsangx # Eric Tsang Ethan Rubio Evan Martin @@ -52,6 +59,7 @@ Evan Sebastian Eyas # Eyas Sharaiha Fabian Cook falsandtru # @falsandtru +flowmemo # @flowmemo Frank Wallis FrantiÅ¡ek Žiacik FrantiÅ¡ek Žiacik Gabe Moothart @@ -62,13 +70,19 @@ Graeme Wicksted Guillaume Salles Guy Bedford guybedford Harald Niesche +Homa Wong +Hendrik Liebau Iain Monro +IgorNovozhilov # Igor Novozhilov Ingvar Stepanyan impinball # Isiah Meadows +Iwata Hidetaka Ivo Gabe de Wolff Jakub MÅ‚okosiewicz James Whitney +James Henry Jason Freeman Jason Freeman +Jason Jarrett Jason Killian Jason Ramsay jramsay Jed Mao @@ -81,7 +95,9 @@ Jonathan Park Jonathan Turner Jonathan Turner Jonathan Toland Jesse Schalken +Joel Day Josh Abernathy joshaber +Josh Goldberg Josh Kalderimis Josh Soref Juan Luis Boya García @@ -95,22 +111,31 @@ Kanchalai Tanglertsampan Yui T Kanchalai Tanglertsampan Yui Kanchalai Tanglertsampan Yui Kanchalai Tanglertsampan yui T +KÄrlis Gaņģis Keith Mashinter kmashint Ken Howard Kevin Lang kimamula # Kenji Imamula +Kitson Kelly +Klaus Meinhardt Kyle Kelley Lorant Pinter Lucien Greathouse Lukas Elmer Lukas Elmer +Magnus Hiie Martin Vseticka Martin VÅ¡eticka MartyIX gcnew # Marin Marinov vvakame # Masahiro Wakame -Matt McCutchen +Matt McCutchen Matt McCutchen +Matt Bierner +MANISH-GIRI # Manish Giri Max Deepfield Micah Zoltu Michael +Mike Busyrev +Mine Starks Mine Starks Mohamed Hegazy +ncoley # Natalie Coley Nathan Shively-Sanders Nathan Yee Nima Zahedi @@ -133,12 +158,14 @@ Rado Kirov Ron Buckton Ron Buckton rbuckton Rostislav Galimsky Richard Knoll Richard Knoll +Richard Karmazín Rowan Wyborn Ryan Cavanaugh Ryan Cavanaugh Ryan Cavanaugh Ryohei Ikegami Sarangan Rajamanickam Sébastien Arod Sergey Shandar +chico # Sergey Rubanov Sheetal Nandi Shengping Zhong shyyko.serhiy@gmail.com # Shyyko Serhiy @@ -146,6 +173,7 @@ Sam El-Husseini Simon Hürlimann Slawomir Sadziak Solal Pirelli +Soo Jae Hwang Stan Thomas Stanislav Sysoev Steve Lucco steveluc @@ -163,6 +191,7 @@ Torben Fitschen TruongSinh Tran-Nguyen vilicvane # Vilic Vane Vladimir Matveev vladima v2m +Vadi Taslim Wesley Wigham Wesley Wigham York Yao york yao yaoyao Yuichi Nukiyama YuichiNukiyama @@ -172,4 +201,51 @@ zhongsp # Patrick Zhong T18970237136 # @T18970237136 JBerger bootstraponline # @bootstraponline -yortus # @yortus \ No newline at end of file +yortus # @yortus +András Parditka +Anton Khlynovskiy +Charly POLY +Cotton Hou +Ethan Resnick +Marius Schulz +Mattias Buelens +Myles Megyesi +Tim Lancina +Aaron Holmes Aaron Holmes +Akshar Patel +Ali Sabzevari +Aliaksandr Radzivanovich +BuildTools # Franklin Tse +ChogyDan # Daniel Hollocher +Daniel Rosenwasser Daniel Rosenwasser +DLehenbauer # Daniel Lehenbauer +David Kmenta +E020873 # Nicolas Henry +Elisée Maurer +Emilio García-Pumarino dashaus +Guilherme Oenning +Herrington Darkholme +Ivo Gabe de Wolff +Joey Wilson +Jonathon Smith +Juan Luis Boya García +Kagami Sascha Rosylight +Lucien Greathouse +Martin Vseticka +Mattias Buelens +Michael Bromley +Paul Jolly +Perry Jiang +Peter Burns +Robert Coie +Thomas Loubiou +Tim Perry +Vidar Tonaas Fauske +Viktor Zozulyak +rix # Richard Sentino +rohitverma007 # Rohit Verma +rdosanjh # Raj Dosanjh +gdh1995 # Dahan Gong +cedvdb # @cedvdb +kpreisser # K. Preißer +e-cloud # @e-cloud \ No newline at end of file diff --git a/node_modules/typescript/.npmignore b/node_modules/typescript/.npmignore index 02d8fe428..d3c27afef 100644 --- a/node_modules/typescript/.npmignore +++ b/node_modules/typescript/.npmignore @@ -1,8 +1,11 @@ built doc +Gulpfile.ts internal issue_template.md +jenkins.sh lib/README.md +netci.groovy pull_request_template.md scripts src diff --git a/node_modules/typescript/AUTHORS.md b/node_modules/typescript/AUTHORS.md index 50f1ea12c..4772d5371 100644 --- a/node_modules/typescript/AUTHORS.md +++ b/node_modules/typescript/AUTHORS.md @@ -1,18 +1,28 @@ TypeScript is authored by: +* Aaron Holmes * Abubaker Bashir * Adam Freidin * Adi Dahiya * Ahmad Farid +* Akshar Patel * Alex Eagle * Alexander Kuvaev * Alexander Rusakov +* Ali Sabzevari +* Aliaksandr Radzivanovich +* Aluan Haddad * Anatoly Ressin * Anders Hejlsberg +* Andreas Martin * Andrej Baran +* Andrew Ochsner * Andrew Z Allen +* András Parditka * Andy Hanson * Anil Anar +* Anton Khlynovskiy * Anton Tolmachev +* Anubha Mathur * Arnav Singh * Arthur Ozga * Asad Saeeduddin @@ -20,6 +30,7 @@ TypeScript is authored by: * Basarat Ali Syed * Ben Duffield * Ben Mosher +* Benjamin Bock * Bill Ticehurst * Blake Embrey * @bootstraponline @@ -27,17 +38,25 @@ TypeScript is authored by: * Brett Mayen * Bryan Forbes * Caitlin Potter +* @cedvdb +* Charly POLY * Chris Bubernak * Christophe Vidal * Chuck Jazdzewski * Colby Russell * Colin Snover +* Cotton Hou * Cyrus Najmabadi * Dafrok Zhang +* Dahan Gong * Dan Corder * Dan Quirk +* Daniel Hollocher +* Daniel Lehenbauer * Daniel Rosenwasser +* David Kmenta * David Li +* David Sheldrick * David Souther * Denis Nedelyaev * Dick van den Brink @@ -45,32 +64,46 @@ TypeScript is authored by: * Dirk Holtwick * Dom Chen * Doug Ilijev +* @e-cloud +* Elisée Maurer +* Emilio García-Pumarino * Eric Tsang * Erik Edrosa +* Erik McClenney +* Ethan Resnick * Ethan Rubio * Evan Martin * Evan Sebastian * Eyas Sharaiha * Fabian Cook * @falsandtru +* @flowmemo * Frank Wallis +* Franklin Tse * FrantiÅ¡ek Žiacik * Gabe Moothart * Gabriel Isenberg * Gilad Peleg * Godfrey Chan * Graeme Wicksted +* Guilherme Oenning * Guillaume Salles * Guy Bedford * Harald Niesche +* Hendrik Liebau * Herrington Darkholme +* Homa Wong * Iain Monro +* Igor Novozhilov * Ingvar Stepanyan * Isiah Meadows * Ivo Gabe de Wolff +* Iwata Hidetaka * Jakub MÅ‚okosiewicz +* James Henry * James Whitney * Jason Freeman +* Jason Jarrett * Jason Killian * Jason Ramsay * JBerger @@ -78,39 +111,59 @@ TypeScript is authored by: * Jeffrey Morlan * Jesse Schalken * Jiri Tobisek +* Joel Day +* Joey Wilson * Johannes Rieken * John Vilk * Jonathan Bond-Caron * Jonathan Park * Jonathan Toland * Jonathan Turner +* Jonathon Smith * Josh Abernathy +* Josh Goldberg * Josh Kalderimis * Josh Soref * Juan Luis Boya García * Julian Williams * Justin Bay * Justin Johansson +* K. Preißer * Kagami Sascha Rosylight * Kanchalai Tanglertsampan * Keith Mashinter * Ken Howard * Kenji Imamula * Kevin Lang +* Kitson Kelly +* Klaus Meinhardt * Kyle Kelley +* KÄrlis Gaņģis * Lorant Pinter * Lucien Greathouse * Lukas Elmer +* Magnus Hiie +* Manish Giri * Marin Marinov +* Marius Schulz * Martin Vseticka * Masahiro Wakame +* Matt Bierner * Matt McCutchen +* Mattias Buelens +* Mattias Buelens * Max Deepfield * Micah Zoltu * Michael +* Michael Bromley +* Mike Busyrev +* Mine Starks * Mohamed Hegazy +* Myles Megyesi +* Natalie Coley * Nathan Shively-Sanders * Nathan Yee +* Nicolas Henry * Nima Zahedi * Noah Chen * Noj Vek @@ -119,9 +172,12 @@ TypeScript is authored by: * Omer Sheikh * Oskar Segersva¨rd * Patrick Zhong +* Paul Jolly * Paul van Brenk * @pcbro * Pedro Maltez +* Perry Jiang +* Peter Burns * Philip Bulley * Piero Cangianiello * @piloopin @@ -129,7 +185,12 @@ TypeScript is authored by: * @progre * Punya Biswal * Rado Kirov +* Raj Dosanjh +* Richard Karmazín * Richard Knoll +* Richard Sentino +* Robert Coie +* Rohit Verma * Ron Buckton * Rostislav Galimsky * Rowan Wyborn @@ -137,6 +198,7 @@ TypeScript is authored by: * Ryohei Ikegami * Sam El-Husseini * Sarangan Rajamanickam +* Sergey Rubanov * Sergey Shandar * Sheetal Nandi * Shengping Zhong @@ -144,6 +206,7 @@ TypeScript is authored by: * Simon Hürlimann * Slawomir Sadziak * Solal Pirelli +* Soo Jae Hwang * Stan Thomas * Stanislav Sysoev * Steve Lucco @@ -152,7 +215,9 @@ TypeScript is authored by: * @T18970237136 * Tarik Ozket * Tetsuharu Ohzeki +* Thomas Loubiou * Tien Hoanhtien +* Tim Lancina * Tim Perry * Tim Viiding-Spader * Tingan Ho @@ -161,6 +226,9 @@ TypeScript is authored by: * Tomas Grubliauskas * Torben Fitschen * TruongSinh Tran-Nguyen +* Vadi Taslim +* Vidar Tonaas Fauske +* Viktor Zozulyak * Vilic Vane * Vladimir Matveev * Wesley Wigham diff --git a/node_modules/typescript/Gulpfile.ts b/node_modules/typescript/Gulpfile.ts deleted file mode 100644 index 054e99c80..000000000 --- a/node_modules/typescript/Gulpfile.ts +++ /dev/null @@ -1,1046 +0,0 @@ -/// -import * as cp from "child_process"; -import * as path from "path"; -import * as fs from "fs"; -import originalGulp = require("gulp"); -import helpMaker = require("gulp-help"); -import runSequence = require("run-sequence"); -import concat = require("gulp-concat"); -import clone = require("gulp-clone"); -import newer = require("gulp-newer"); -import tsc = require("gulp-typescript"); -declare module "gulp-typescript" { - interface Settings { - pretty?: boolean; - newLine?: string; - noImplicitThis?: boolean; - stripInternal?: boolean; - types?: string[]; - } -} -import * as insert from "gulp-insert"; -import * as sourcemaps from "gulp-sourcemaps"; -import Q = require("q"); -declare global { - // `del` further depends on `Promise` (and is also not included), so we just, patch the global scope's Promise to Q's (which we already include in our deps because gulp depends on it) - type Promise = Q.Promise; -} -import del = require("del"); -import mkdirP = require("mkdirp"); -import minimist = require("minimist"); -import browserify = require("browserify"); -import through2 = require("through2"); -import merge2 = require("merge2"); -import intoStream = require("into-stream"); -import * as os from "os"; -import fold = require("travis-fold"); -const gulp = helpMaker(originalGulp); -const mochaParallel = require("./scripts/mocha-parallel.js"); -const {runTestsInParallel} = mochaParallel; - -Error.stackTraceLimit = 1000; - -const cmdLineOptions = minimist(process.argv.slice(2), { - boolean: ["debug", "light", "colors", "lint", "soft"], - string: ["browser", "tests", "host", "reporter", "stackTraceLimit"], - alias: { - d: "debug", - t: "tests", - test: "tests", - r: "reporter", - color: "colors", - f: "files", - file: "files" - }, - default: { - soft: false, - colors: process.env.colors || process.env.color || true, - debug: process.env.debug || process.env.d, - host: process.env.TYPESCRIPT_HOST || process.env.host || "node", - browser: process.env.browser || process.env.b || "IE", - tests: process.env.test || process.env.tests || process.env.t, - light: process.env.light || false, - reporter: process.env.reporter || process.env.r, - lint: process.env.lint || true, - files: process.env.f || process.env.file || process.env.files || "", - } -}); - -function exec(cmd: string, args: string[], complete: () => void = (() => { }), error: (e: any, status: number) => void = (() => { })) { - console.log(`${cmd} ${args.join(" ")}`); - // TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition - const subshellFlag = isWin ? "/c" : "-c"; - const command = isWin ? [possiblyQuote(cmd), ...args] : [`${cmd} ${args.join(" ")}`]; - const ex = cp.spawn(isWin ? "cmd" : "/bin/sh", [subshellFlag, ...command], { stdio: "inherit", windowsVerbatimArguments: true } as any); - ex.on("exit", (code) => code === 0 ? complete() : error(/*e*/ undefined, code)); - ex.on("error", error); -} - -function possiblyQuote(cmd: string) { - return cmd.indexOf(" ") >= 0 ? `"${cmd}"` : cmd; -} - -let useDebugMode = true; -let host = cmdLineOptions["host"]; - -// Constants -const compilerDirectory = "src/compiler/"; -const harnessDirectory = "src/harness/"; -const libraryDirectory = "src/lib/"; -const scriptsDirectory = "scripts/"; -const docDirectory = "doc/"; - -const builtDirectory = "built/"; -const builtLocalDirectory = "built/local/"; -const LKGDirectory = "lib/"; - -const copyright = "CopyrightNotice.txt"; - -const compilerFilename = "tsc.js"; -const LKGCompiler = path.join(LKGDirectory, compilerFilename); -const builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); - -const nodeModulesPathPrefix = path.resolve("./node_modules/.bin/"); -const isWin = /^win/.test(process.platform); -const mocha = path.join(nodeModulesPathPrefix, "mocha") + (isWin ? ".cmd" : ""); - -const es2015LibrarySources = [ - "es2015.core.d.ts", - "es2015.collection.d.ts", - "es2015.generator.d.ts", - "es2015.iterable.d.ts", - "es2015.promise.d.ts", - "es2015.proxy.d.ts", - "es2015.reflect.d.ts", - "es2015.symbol.d.ts", - "es2015.symbol.wellknown.d.ts" -]; - -const es2015LibrarySourceMap = es2015LibrarySources.map(function(source) { - return { target: "lib." + source, sources: ["header.d.ts", source] }; -}); - -const es2016LibrarySource = ["es2016.array.include.d.ts"]; - -const es2016LibrarySourceMap = es2016LibrarySource.map(function(source) { - return { target: "lib." + source, sources: ["header.d.ts", source] }; -}); - -const es2017LibrarySource = [ - "es2017.object.d.ts", - "es2017.sharedmemory.d.ts", - "es2017.string.d.ts", -]; - -const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) { - return { target: "lib." + source, sources: ["header.d.ts", source] }; -}); - -const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"]; - -const librarySourceMap = [ - // Host library - { target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"] }, - { target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"] }, - { target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"] }, - { target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"] }, - - // JavaScript library - { target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] }, - { target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] }, - { target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] }, - { target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] }, - - // JavaScript + all host library - { target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) }, - { target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") } -].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap); - -const libraryTargets = librarySourceMap.map(function(f) { - return path.join(builtLocalDirectory, f.target); -}); - -for (const i in libraryTargets) { - const entry = librarySourceMap[i]; - const target = libraryTargets[i]; - const sources = [copyright].concat(entry.sources.map(function(s) { - return path.join(libraryDirectory, s); - })); - gulp.task(target, false, [], function() { - return gulp.src(sources) - .pipe(newer(target)) - .pipe(concat(target, { newLine: "\n\n" })) - .pipe(gulp.dest(".")); - }); -} - -const configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js"); -const configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts"); -const packageJson = "package.json"; -const versionFile = path.join(compilerDirectory, "core.ts"); - -function needsUpdate(source: string | string[], dest: string | string[]): boolean { - if (typeof source === "string" && typeof dest === "string") { - if (fs.existsSync(dest)) { - const {mtime: outTime} = fs.statSync(dest); - const {mtime: inTime} = fs.statSync(source); - if (+inTime <= +outTime) { - return false; - } - } - } - else if (typeof source === "string" && typeof dest !== "string") { - const {mtime: inTime} = fs.statSync(source); - for (const filepath of dest) { - if (fs.existsSync(filepath)) { - const {mtime: outTime} = fs.statSync(filepath); - if (+inTime > +outTime) { - return true; - } - } - else { - return true; - } - } - return false; - } - else if (typeof source !== "string" && typeof dest === "string") { - if (fs.existsSync(dest)) { - const {mtime: outTime} = fs.statSync(dest); - for (const filepath of source) { - if (fs.existsSync(filepath)) { - const {mtime: inTime} = fs.statSync(filepath); - if (+inTime > +outTime) { - return true; - } - } - else { - return true; - } - } - return false; - } - } - else if (typeof source !== "string" && typeof dest !== "string") { - for (let i = 0; i < source.length; i++) { - if (!dest[i]) { - continue; - } - if (fs.existsSync(dest[i])) { - const {mtime: outTime} = fs.statSync(dest[i]); - const {mtime: inTime} = fs.statSync(source[i]); - if (+inTime > +outTime) { - return true; - } - } - else { - return true; - } - } - return false; - } - return true; -} - -function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): tsc.Settings { - const copy: tsc.Settings = {}; - copy.noEmitOnError = true; - copy.noImplicitAny = true; - copy.noImplicitThis = true; - copy.pretty = true; - copy.types = []; - for (const key in base) { - copy[key] = base[key]; - } - if (!useDebugMode) { - if (copy.removeComments === undefined) copy.removeComments = true; - copy.newLine = "lf"; - } - else { - copy.preserveConstEnums = true; - } - if (useBuiltCompiler === true) { - copy.typescript = require("./built/local/typescript.js"); - } - else if (useBuiltCompiler === false) { - copy.typescript = require("./lib/typescript.js"); - } - return copy; -} - -gulp.task(configureNightlyJs, false, [], () => { - const settings: tsc.Settings = { - declaration: false, - removeComments: true, - noResolve: false, - stripInternal: false, - }; - return gulp.src(configureNightlyTs) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(path.dirname(configureNightlyJs))) - .pipe(gulp.dest(path.dirname(configureNightlyJs))); -}); - - -// Nightly management tasks -gulp.task("configure-nightly", "Runs scripts/configureNightly.ts to prepare a build for nightly publishing", [configureNightlyJs], (done) => { - exec(host, [configureNightlyJs, packageJson, versionFile], done, done); -}); -gulp.task("publish-nightly", "Runs `npm publish --tag next` to create a new nightly build on npm", ["LKG"], () => { - return runSequence("clean", "useDebugMode", "runtests", (done) => { - exec("npm", ["publish", "--tag", "next"], done, done); - }); -}); - -const importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests"); -const importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js"); -const importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts"); - -gulp.task(importDefinitelyTypedTestsJs, false, [], () => { - const settings: tsc.Settings = getCompilerSettings({ - declaration: false, - removeComments: true, - noResolve: false, - stripInternal: false, - outFile: importDefinitelyTypedTestsJs - }, /*useBuiltCompiler*/ false); - return gulp.src(importDefinitelyTypedTestsTs) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -gulp.task("importDefinitelyTypedTests", "Runs scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts to copy DT's tests to the TS-internal RWC tests", [importDefinitelyTypedTestsJs], (done) => { - exec(host, [importDefinitelyTypedTestsJs, "./", "../DefinitelyTyped"], done, done); -}); - -gulp.task("lib", "Builds the library targets", libraryTargets); - - -// Generate diagnostics -const processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnosticMessages.js"); -const processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts"); -const diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json"); -const diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts"); -const generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json"); -const builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "diagnosticMessages.generated.json"); - -// processDiagnosticMessages script -gulp.task(processDiagnosticMessagesJs, false, [], () => { - const settings: tsc.Settings = getCompilerSettings({ - declaration: false, - removeComments: true, - noResolve: false, - stripInternal: false, - outFile: processDiagnosticMessagesJs - }, /*useBuiltCompiler*/ false); - return gulp.src(processDiagnosticMessagesTs) - .pipe(newer(processDiagnosticMessagesJs)) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -// The generated diagnostics map; built for the compiler and for the "generate-diagnostics" task -gulp.task(diagnosticInfoMapTs, [processDiagnosticMessagesJs], (done) => { - if (needsUpdate(diagnosticMessagesJson, [generatedDiagnosticMessagesJSON, diagnosticInfoMapTs])) { - exec(host, [processDiagnosticMessagesJs, diagnosticMessagesJson], done, done); - } - else { - done(); - } -}); - -gulp.task(builtGeneratedDiagnosticMessagesJSON, [diagnosticInfoMapTs], (done) => { - if (fs.existsSync(builtLocalDirectory) && needsUpdate(generatedDiagnosticMessagesJSON, builtGeneratedDiagnosticMessagesJSON)) { - fs.writeFileSync(builtGeneratedDiagnosticMessagesJSON, fs.readFileSync(generatedDiagnosticMessagesJSON)); - } - done(); -}); - -gulp.task("generate-diagnostics", "Generates a diagnostic file in TypeScript based on an input JSON file", [diagnosticInfoMapTs]); - - -const servicesFile = path.join(builtLocalDirectory, "typescriptServices.js"); -const standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); -const nodePackageFile = path.join(builtLocalDirectory, "typescript.js"); -const nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); -const nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts"); - -let copyrightContent: string; -function prependCopyright(outputCopyright: boolean = !useDebugMode) { - return insert.prepend(outputCopyright ? (copyrightContent || (copyrightContent = fs.readFileSync(copyright).toString())) : ""); -} - -gulp.task(builtLocalCompiler, false, [servicesFile], () => { - const localCompilerProject = tsc.createProject("src/compiler/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true)); - return localCompilerProject.src() - .pipe(newer(builtLocalCompiler)) - .pipe(sourcemaps.init()) - .pipe(localCompilerProject()) - .pipe(prependCopyright()) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => { - const servicesProject = tsc.createProject("src/services/tsconfig.json", getCompilerSettings({ removeComments: false }, /*useBuiltCompiler*/false)); - const {js, dts} = servicesProject.src() - .pipe(newer(servicesFile)) - .pipe(sourcemaps.init()) - .pipe(servicesProject()); - const completedJs = js.pipe(prependCopyright()) - .pipe(sourcemaps.write(".")); - const completedDts = dts.pipe(prependCopyright(/*outputCopyright*/true)) - .pipe(insert.transform((contents, file) => { - file.path = standaloneDefinitionsFile; - return contents.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, "$1$2enum $3 {$4"); - })); - return merge2([ - completedJs, - completedJs.pipe(clone()) - .pipe(insert.transform((content, file) => (file.path = nodePackageFile, content))), - completedDts, - completedDts.pipe(clone()) - .pipe(insert.transform((content, file) => { - file.path = nodeDefinitionsFile; - return content + "\r\nexport = ts;"; - })) - .pipe(gulp.dest(".")), - completedDts.pipe(clone()) - .pipe(insert.transform((content, file) => { - file.path = nodeStandaloneDefinitionsFile; - return content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"'); - })) - ]).pipe(gulp.dest(".")); -}); - -// cancellationToken.js -const cancellationTokenJs = path.join(builtLocalDirectory, "cancellationToken.js"); -gulp.task(cancellationTokenJs, false, [servicesFile], () => { - const cancellationTokenProject = tsc.createProject("src/server/cancellationToken/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true)); - return cancellationTokenProject.src() - .pipe(newer(cancellationTokenJs)) - .pipe(sourcemaps.init()) - .pipe(cancellationTokenProject()) - .pipe(prependCopyright()) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(builtLocalDirectory)); -}); - -// typingsInstallerFile.js -const typingsInstallerJs = path.join(builtLocalDirectory, "typingsInstaller.js"); -gulp.task(typingsInstallerJs, false, [servicesFile], () => { - const cancellationTokenProject = tsc.createProject("src/server/typingsInstaller/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true)); - return cancellationTokenProject.src() - .pipe(newer(typingsInstallerJs)) - .pipe(sourcemaps.init()) - .pipe(cancellationTokenProject()) - .pipe(prependCopyright()) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -const serverFile = path.join(builtLocalDirectory, "tsserver.js"); - -gulp.task(serverFile, false, [servicesFile, typingsInstallerJs, cancellationTokenJs], () => { - const serverProject = tsc.createProject("src/server/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true)); - return serverProject.src() - .pipe(newer(serverFile)) - .pipe(sourcemaps.init()) - .pipe(serverProject()) - .pipe(prependCopyright()) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js"); -const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts"); - -gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => { - const serverLibraryProject = tsc.createProject("src/server/tsconfig.library.json", getCompilerSettings({}, /*useBuiltCompiler*/ true)); - const {js, dts}: { js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream } = serverLibraryProject.src() - .pipe(sourcemaps.init()) - .pipe(newer(tsserverLibraryFile)) - .pipe(serverLibraryProject()); - - return merge2([ - js.pipe(prependCopyright()) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")), - dts.pipe(prependCopyright()) - .pipe(gulp.dest(".")) - ]); -}); - -gulp.task("lssl", "Builds language service server library", [tsserverLibraryFile]); -gulp.task("local", "Builds the full compiler and services", [builtLocalCompiler, servicesFile, serverFile, builtGeneratedDiagnosticMessagesJSON, tsserverLibraryFile]); -gulp.task("tsc", "Builds only the compiler", [builtLocalCompiler]); - -// Generate Markdown spec -const word2mdJs = path.join(scriptsDirectory, "word2md.js"); -const word2mdTs = path.join(scriptsDirectory, "word2md.ts"); -const specWord = path.join(docDirectory, "TypeScript Language Specification.docx"); -const specMd = path.join(docDirectory, "spec.md"); - -gulp.task(word2mdJs, false, [], () => { - const settings: tsc.Settings = getCompilerSettings({ - outFile: word2mdJs - }, /*useBuiltCompiler*/ false); - return gulp.src(word2mdTs) - .pipe(newer(word2mdJs)) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -gulp.task(specMd, false, [word2mdJs], (done) => { - const specWordFullPath = path.resolve(specWord); - const specMDFullPath = path.resolve(specMd); - const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\""; - console.log(cmd); - cp.exec(cmd, function() { - done(); - }); -}); - -gulp.task("generate-spec", "Generates a Markdown version of the Language Specification", [specMd]); - -gulp.task("clean", "Cleans the compiler output, declare files, and tests", [], () => { - return del([builtDirectory]); -}); - -gulp.task("useDebugMode", false, [], (done) => { useDebugMode = true; done(); }); -gulp.task("dontUseDebugMode", false, [], (done) => { useDebugMode = false; done(); }); - -gulp.task("VerifyLKG", false, [], () => { - const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, typingsInstallerJs, cancellationTokenJs].concat(libraryTargets); - const missingFiles = expectedFiles.filter(function(f) { - return !fs.existsSync(f); - }); - if (missingFiles.length > 0) { - throw new Error("Cannot replace the LKG unless all built targets are present in directory " + builtLocalDirectory + - ". The following files are missing:\n" + missingFiles.join("\n")); - } - // Copy all the targets into the LKG directory - return gulp.src(expectedFiles).pipe(gulp.dest(LKGDirectory)); -}); - -gulp.task("LKGInternal", false, ["lib", "local"]); - -gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUseDebugMode"], () => { - return runSequence("LKGInternal", "VerifyLKG"); -}); - - -// Task to build the tests infrastructure using the built compiler -const run = path.join(builtLocalDirectory, "run.js"); -gulp.task(run, false, [servicesFile], () => { - const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true)); - return testProject.src() - .pipe(newer(run)) - .pipe(sourcemaps.init()) - .pipe(testProject()) - .pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" })) - .pipe(gulp.dest(".")); -}); - -const internalTests = "internal/"; - -const localBaseline = "tests/baselines/local/"; -const refBaseline = "tests/baselines/reference/"; - -const localRwcBaseline = path.join(internalTests, "baselines/rwc/local"); -const refRwcBaseline = path.join(internalTests, "baselines/rwc/reference"); - -const localTest262Baseline = path.join(internalTests, "baselines/test262/local"); - -gulp.task("tests", "Builds the test infrastructure using the built compiler", [run]); -gulp.task("tests-debug", "Builds the test sources and automation in debug mode", () => { - return runSequence("useDebugMode", "tests"); -}); - -function deleteTemporaryProjectOutput() { - return del(path.join(localBaseline, "projectOutput/")); -} - -let savedNodeEnv: string; -function setNodeEnvToDevelopment() { - savedNodeEnv = process.env.NODE_ENV; - process.env.NODE_ENV = "development"; -} - -function restoreSavedNodeEnv() { - process.env.NODE_ENV = savedNodeEnv; -} - -let testTimeout = 40000; -function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) { - const lintFlag = cmdLineOptions["lint"]; - cleanTestDirs((err) => { - if (err) { console.error(err); failWithStatus(err, 1); } - const debug = cmdLineOptions["debug"]; - const tests = cmdLineOptions["tests"]; - const light = cmdLineOptions["light"]; - const stackTraceLimit = cmdLineOptions["stackTraceLimit"]; - const testConfigFile = "test.config"; - if (fs.existsSync(testConfigFile)) { - fs.unlinkSync(testConfigFile); - } - let workerCount, taskConfigsFolder; - if (runInParallel) { - // generate name to store task configuration files - const prefix = os.tmpdir() + "/ts-tests"; - let i = 1; - do { - taskConfigsFolder = prefix + i; - i++; - } while (fs.existsSync(taskConfigsFolder)); - fs.mkdirSync(taskConfigsFolder); - - workerCount = process.env.workerCount || os.cpus().length; - } - - if (tests || light || taskConfigsFolder) { - writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit); - } - - if (tests && tests.toLocaleLowerCase() === "rwc") { - testTimeout = 400000; - } - - const colors = cmdLineOptions["colors"]; - const reporter = cmdLineOptions["reporter"] || defaultReporter; - - // timeout normally isn"t necessary but Travis-CI has been timing out on compiler baselines occasionally - // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer - if (!runInParallel) { - const args = []; - if (debug) { - args.push("--debug-brk"); - } - args.push("-R", reporter); - if (tests) { - args.push("-g", `"${tests}"`); - } - if (colors) { - args.push("--colors"); - } - else { - args.push("--no-colors"); - } - args.push("-t", testTimeout); - args.push(run); - setNodeEnvToDevelopment(); - exec(mocha, args, lintThenFinish, function(e, status) { - finish(e, status); - }); - - } - else { - // run task to load all tests and partition them between workers - const args = []; - args.push("-R", "min"); - if (colors) { - args.push("--colors"); - } - else { - args.push("--no-colors"); - } - args.push(run); - setNodeEnvToDevelopment(); - runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function(err) { - // last worker clean everything and runs linter in case if there were no errors - del(taskConfigsFolder).then(() => { - if (!err) { - lintThenFinish(); - } - else { - finish(err); - } - }); - }); - } - }); - - function failWithStatus(err?: any, status?: number) { - if (err) { - console.log(err); - } - done(err || status); - process.exit(status); - } - - function lintThenFinish() { - if (lintFlag) { - runSequence("lint", finish); - } - else { - finish(); - } - } - - function finish(error?: any, errorStatus?: number) { - restoreSavedNodeEnv(); - deleteTemporaryProjectOutput().then(() => { - if (error !== undefined || errorStatus !== undefined) { - failWithStatus(error, errorStatus); - } - else { - done(); - } - }); - } -} - -gulp.task("runtests-parallel", "Runs all the tests in parallel using the built run.js file. Optional arguments are: --t[ests]=category1|category2|... --d[ebug]=true.", ["build-rules", "tests"], (done) => { - runConsoleTests("min", /*runInParallel*/ true, done); -}); -gulp.task("runtests", - "Runs the tests using the built run.js file. Optional arguments are: --t[ests]=regex --r[eporter]=[list|spec|json|] --d[ebug]=true --color[s]=false --lint=true.", - ["build-rules", "tests"], - (done) => { - runConsoleTests("mocha-fivemat-progress-reporter", /*runInParallel*/ false, done); - }); - -const nodeServerOutFile = "tests/webTestServer.js"; -const nodeServerInFile = "tests/webTestServer.ts"; -gulp.task(nodeServerOutFile, false, [servicesFile], () => { - const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ true); - return gulp.src(nodeServerInFile) - .pipe(newer(nodeServerOutFile)) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(path.dirname(nodeServerOutFile))); -}); - -import convertMap = require("convert-source-map"); -import sorcery = require("sorcery"); -declare module "convert-source-map" { - export function fromSource(source: string, largeSource?: boolean): SourceMapConverter; -} - -gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => { - const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "../../built/local/bundle.js" }, /*useBuiltCompiler*/ true)); - return testProject.src() - .pipe(newer("built/local/bundle.js")) - .pipe(sourcemaps.init()) - .pipe(testProject()) - .pipe(through2.obj((file, enc, next) => { - const originalMap = file.sourceMap; - const prebundledContent = file.contents.toString(); - // Make paths absolute to help sorcery deal with all the terrible paths being thrown around - originalMap.sources = originalMap.sources.map(s => path.resolve(s)); - // intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap - originalMap.file = "built/local/_stream_0.js"; - - browserify(intoStream(file.contents), { debug: true }) - .bundle((err, res) => { - // assumes file.contents is a Buffer - const maps = JSON.parse(convertMap.fromSource(res.toString(), /*largeSource*/true).toJSON()); - delete maps.sourceRoot; - maps.sources = maps.sources.map(s => path.resolve(s === "_stream_0.js" ? "built/local/_stream_0.js" : s)); - // Strip browserify's inline comments away (could probably just let sorcery do this, but then we couldn't fix the paths) - file.contents = new Buffer(convertMap.removeComments(res.toString())); - const chain = sorcery.loadSync("built/local/bundle.js", { - content: { - "built/local/_stream_0.js": prebundledContent, - "built/local/bundle.js": file.contents.toString() - }, - sourcemaps: { - "built/local/_stream_0.js": originalMap, - "built/local/bundle.js": maps, - "node_modules/source-map-support/source-map-support.js": undefined, - } - }); - const finalMap = chain.apply(); - file.sourceMap = finalMap; - next(undefined, file); - }); - })) - .pipe(sourcemaps.write(".", { includeContent: false })) - .pipe(gulp.dest(".")); -}); - - -function cleanTestDirs(done: (e?: any) => void) { - // Clean the local baselines & Rwc baselines directories - del([ - localBaseline, - localRwcBaseline, - ]).then(() => { - mkdirP(localRwcBaseline, (err) => { - if (err) done(err); - mkdirP(localTest262Baseline, () => { - if (err) done(err); - mkdirP(localBaseline, (err) => done(err)); - }); - }); - }); -} - -// used to pass data from jake command line directly to run.js -function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) { - const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder }); - console.log("Running tests with config: " + testConfigContents); - fs.writeFileSync("test.config", testConfigContents); -} - - -gulp.task("runtests-browser", "Runs the tests using the built run.js file like 'gulp runtests'. Syntax is gulp runtests-browser. Additional optional parameters --tests=[regex], --browser=[chrome|IE]", ["browserify", nodeServerOutFile], (done) => { - cleanTestDirs((err) => { - if (err) { console.error(err); done(err); process.exit(1); } - host = "node"; - const tests = cmdLineOptions["tests"]; - const light = cmdLineOptions["light"]; - const testConfigFile = "test.config"; - if (fs.existsSync(testConfigFile)) { - fs.unlinkSync(testConfigFile); - } - if (tests || light) { - writeTestConfigFile(tests, light); - } - - const args = [nodeServerOutFile]; - if (cmdLineOptions["browser"]) { - args.push(cmdLineOptions["browser"]); - } - if (tests) { - args.push(JSON.stringify(tests)); - } - exec(host, args, done, done); - }); -}); - -gulp.task("generate-code-coverage", "Generates code coverage data via istanbul", ["tests"], (done) => { - exec("istanbul", ["cover", "node_modules/mocha/bin/_mocha", "--", "-R", "min", "-t", testTimeout.toString(), run], done, done); -}); - - -function getDiffTool() { - const program = process.env["DIFF"]; - if (!program) { - console.error("Add the 'DIFF' environment variable to the path of the program you want to use."); - process.exit(1); - } - return program; -} - -gulp.task("diff", "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable", (done) => { - exec(getDiffTool(), [refBaseline, localBaseline], done, done); -}); -gulp.task("diff-rwc", "Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable", (done) => { - exec(getDiffTool(), [refRwcBaseline, localRwcBaseline], done, done); -}); - -gulp.task("baseline-accept", "Makes the most recent test results the new baseline, overwriting the old baseline", () => { - return baselineAccept(""); -}); - -function baselineAccept(subfolder = "") { - return merge2(baselineCopy(subfolder), baselineDelete(subfolder)); -} - -function baselineCopy(subfolder = "") { - return gulp.src([`tests/baselines/local/${subfolder}/**`, `!tests/baselines/local/${subfolder}/**/*.delete`]) - .pipe(gulp.dest(refBaseline)); -} - -function baselineDelete(subfolder = "") { - return gulp.src(["tests/baselines/local/**/*.delete"]) - .pipe(insert.transform((content, fileObj) => { - const target = path.join(refBaseline, fileObj.relative.substr(0, fileObj.relative.length - ".delete".length)); - del.sync(target); - del.sync(fileObj.path); - return ""; - })); -} - -gulp.task("baseline-accept-rwc", "Makes the most recent rwc test results the new baseline, overwriting the old baseline", () => { - return baselineAccept("rwc"); -}); - - -gulp.task("baseline-accept-test262", "Makes the most recent test262 test results the new baseline, overwriting the old baseline", () => { - return baselineAccept("test262"); -}); - - -// Webhost -const webhostPath = "tests/webhost/webtsc.ts"; -const webhostJsPath = "tests/webhost/webtsc.js"; -gulp.task(webhostJsPath, false, [servicesFile], () => { - const settings: tsc.Settings = getCompilerSettings({ - outFile: webhostJsPath - }, /*useBuiltCompiler*/ true); - return gulp.src(webhostPath) - .pipe(newer(webhostJsPath)) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(path.dirname(webhostJsPath))); -}); - -gulp.task("webhost", "Builds the tsc web host", [webhostJsPath], () => { - return gulp.src(path.join(builtLocalDirectory, "lib.d.ts")).pipe(gulp.dest("tests/webhost/")); -}); - - -// Perf compiler -const perftscPath = "tests/perftsc.ts"; -const perftscJsPath = "built/local/perftsc.js"; -gulp.task(perftscJsPath, false, [servicesFile], () => { - const settings: tsc.Settings = getCompilerSettings({ - outFile: perftscJsPath - }, /*useBuiltCompiler*/ true); - return gulp.src(perftscPath) - .pipe(newer(perftscJsPath)) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -gulp.task("perftsc", "Builds augmented version of the compiler for perf tests", [perftscJsPath]); - - -// Instrumented compiler -const loggedIOpath = path.join(harnessDirectory, "loggedIO.ts"); -const loggedIOJsPath = path.join(builtLocalDirectory, "loggedIO.js"); -gulp.task(loggedIOJsPath, false, [], (done) => { - const temp = path.join(builtLocalDirectory, "temp"); - mkdirP(temp, (err) => { - if (err) { console.error(err); done(err); process.exit(1); }; - exec(host, [LKGCompiler, "--types --outdir", temp, loggedIOpath], () => { - fs.renameSync(path.join(temp, "/harness/loggedIO.js"), loggedIOJsPath); - del(temp).then(() => done(), done); - }, done); - }); -}); - -const instrumenterPath = path.join(harnessDirectory, "instrumenter.ts"); -const instrumenterJsPath = path.join(builtLocalDirectory, "instrumenter.js"); -gulp.task(instrumenterJsPath, false, [servicesFile], () => { - const settings: tsc.Settings = getCompilerSettings({ - outFile: instrumenterJsPath - }, /*useBuiltCompiler*/ true); - return gulp.src(instrumenterPath) - .pipe(newer(instrumenterJsPath)) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(".")); -}); - -gulp.task("tsc-instrumented", "Builds an instrumented tsc.js", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => { - exec(host, [instrumenterJsPath, "record", "iocapture", builtLocalCompiler], done, done); -}); - -gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", serverFile], () => { - return gulp.src([serverFile, serverFile + ".map"]).pipe(gulp.dest("../TypeScript-Sublime-Plugin/tsserver/")); -}); - -gulp.task("build-rules", "Compiles tslint rules to js", () => { - const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ false); - const dest = path.join(builtLocalDirectory, "tslint"); - return gulp.src("scripts/tslint/**/*.ts") - .pipe(newer({ - dest, - ext: ".js" - })) - .pipe(sourcemaps.init()) - .pipe(tsc(settings)) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(dest)); -}); - -const lintTargets = [ - "Gulpfile.ts", - "src/compiler/**/*.ts", - "src/harness/**/*.ts", - "!src/harness/unittests/services/formatting/**/*.ts", - "src/server/**/*.ts", - "scripts/tslint/**/*.ts", - "src/services/**/*.ts", - "tests/*.ts", "tests/webhost/*.ts" // Note: does *not* descend recursively -]; - -function sendNextFile(files: {path: string}[], child: cp.ChildProcess, callback: (failures: number) => void, failures: number) { - const file = files.pop(); - if (file) { - console.log(`Linting '${file.path}'.`); - child.send({ kind: "file", name: file.path }); - } - else { - child.send({ kind: "close" }); - callback(failures); - } -} - -function spawnLintWorker(files: {path: string}[], callback: (failures: number) => void) { - const child = cp.fork("./scripts/parallel-lint"); - let failures = 0; - child.on("message", function(data) { - switch (data.kind) { - case "result": - if (data.failures > 0) { - failures += data.failures; - console.log(data.output); - } - sendNextFile(files, child, callback, failures); - break; - case "error": - console.error(data.error); - failures++; - sendNextFile(files, child, callback, failures); - break; - } - }); - sendNextFile(files, child, callback, failures); -} - -gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => { - const fileMatcher = RegExp(cmdLineOptions["files"]); - if (fold.isTravis()) console.log(fold.start("lint")); - - let files: {stat: fs.Stats, path: string}[] = []; - return gulp.src(lintTargets, { read: false }) - .pipe(through2.obj((chunk, enc, cb) => { - files.push(chunk); - cb(); - }, (cb) => { - files = files.filter(file => fileMatcher.test(file.path)).sort((filea, fileb) => filea.stat.size - fileb.stat.size); - const workerCount = (process.env.workerCount && +process.env.workerCount) || os.cpus().length; - for (let i = 0; i < workerCount; i++) { - spawnLintWorker(files, finished); - } - - let completed = 0; - let failures = 0; - function finished(fails) { - completed++; - failures += fails; - if (completed === workerCount) { - if (fold.isTravis()) console.log(fold.end("lint")); - if (failures > 0) { - throw new Error(`Linter errors: ${failures}`); - } - else { - cb(); - } - } - } - })); -}); - - -gulp.task("default", "Runs 'local'", ["local"]); - -gulp.task("watch", "Watches the src/ directory for changes and executes runtests-parallel.", [], () => { - gulp.watch("src/**/*.*", ["runtests-parallel"]); -}); diff --git a/node_modules/typescript/README.md b/node_modules/typescript/README.md index 2f631439e..053d03641 100644 --- a/node_modules/typescript/README.md +++ b/node_modules/typescript/README.md @@ -1,6 +1,6 @@ [![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript) [![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript) -[![Downloads](https://img.shields.io/npm/dm/TypeScript.svg)](https://www.npmjs.com/package/typescript) +[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript) # TypeScript @@ -39,8 +39,8 @@ with any additional questions or comments. ## Documentation -* [Quick tutorial](http://www.typescriptlang.org/Tutorial) -* [Programming handbook](http://www.typescriptlang.org/Handbook) +* [Quick tutorial](http://www.typescriptlang.org/docs/tutorial.html) +* [Programming handbook](http://www.typescriptlang.org/docs/handbook/basic-types.html) * [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) * [Homepage](http://www.typescriptlang.org/) @@ -95,4 +95,4 @@ node built/local/tsc.js hello.ts ## Roadmap -For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap). \ No newline at end of file +For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap). diff --git a/node_modules/typescript/lib/README.md b/node_modules/typescript/lib/README.md index 852d449f1..0a85a9e7b 100644 --- a/node_modules/typescript/lib/README.md +++ b/node_modules/typescript/lib/README.md @@ -1,5 +1,5 @@ -# Read This! - -**These files are not meant to be edited by hand.** -If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. -Running `jake LKG` will then appropriately update the files in this directory. +# Read This! + +**These files are not meant to be edited by hand.** +If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. +Running `jake LKG` will then appropriately update the files in this directory. diff --git a/node_modules/typescript/lib/cancellationToken.js b/node_modules/typescript/lib/cancellationToken.js index 8af21172d..f40321990 100644 --- a/node_modules/typescript/lib/cancellationToken.js +++ b/node_modules/typescript/lib/cancellationToken.js @@ -15,6 +15,15 @@ and limitations under the License. "use strict"; var fs = require("fs"); +function pipeExists(name) { + try { + fs.statSync(name); + return true; + } + catch (e) { + return false; + } +} function createCancellationToken(args) { var cancellationPipeName; for (var i = 0; i < args.length - 1; i++) { @@ -24,18 +33,39 @@ function createCancellationToken(args) { } } if (!cancellationPipeName) { - return { isCancellationRequested: function () { return false; } }; + return { + isCancellationRequested: function () { return false; }, + setRequest: function (_requestId) { return void 0; }, + resetRequest: function (_requestId) { return void 0; } + }; } - return { - isCancellationRequested: function () { - try { - fs.statSync(cancellationPipeName); - return true; - } - catch (e) { - return false; - } + if (cancellationPipeName.charAt(cancellationPipeName.length - 1) === "*") { + var namePrefix_1 = cancellationPipeName.slice(0, -1); + if (namePrefix_1.length === 0 || namePrefix_1.indexOf("*") >= 0) { + throw new Error("Invalid name for template cancellation pipe: it should have length greater than 2 characters and contain only one '*'."); } - }; + var perRequestPipeName_1; + var currentRequestId_1; + return { + isCancellationRequested: function () { return perRequestPipeName_1 !== undefined && pipeExists(perRequestPipeName_1); }, + setRequest: function (requestId) { + currentRequestId_1 = requestId; + perRequestPipeName_1 = namePrefix_1 + requestId; + }, + resetRequest: function (requestId) { + if (currentRequestId_1 !== requestId) { + throw new Error("Mismatched request id, expected " + currentRequestId_1 + ", actual " + requestId); + } + perRequestPipeName_1 = undefined; + } + }; + } + else { + return { + isCancellationRequested: function () { return pipeExists(cancellationPipeName); }, + setRequest: function (_requestId) { return void 0; }, + resetRequest: function (_requestId) { return void 0; } + }; + } } module.exports = createCancellationToken; diff --git a/node_modules/typescript/lib/lib.d.ts b/node_modules/typescript/lib/lib.d.ts index ed066deeb..cb9294153 100644 --- a/node_modules/typescript/lib/lib.d.ts +++ b/node_modules/typescript/lib/lib.d.ts @@ -1,18215 +1,19680 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has null prototype. - * @param o Object to use as a prototype. May be null - */ - create(o: null): any; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - */ - create(o: T): T; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(a: T[]): ReadonlyArray; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(f: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): Readonly; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(this: Function, thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(this: Function, thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(this: Function, thisArg: any, ...argArray: any[]): any; - - /** Returns a string representation of a function. */ - toString(): string; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray | null; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray | null; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare const Number: NumberConstructor; - -interface TemplateStringsArray extends ReadonlyArray { - readonly raw: ReadonlyArray -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): this; -} - -interface RegExpConstructor { - new (pattern: RegExp): RegExp; - new (pattern: string, flags?: string): RegExp; - (pattern: RegExp): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} - -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => value is S, thisArg?: any): S[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T | undefined; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T | undefined; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Make all properties in T optional - */ -type Partial = { - [P in keyof T]?: T[P]; -}; - -/** - * Make all properties in T readonly - */ -type Readonly = { - readonly [P in keyof T]: T[P]; -}; - -/** - * From T pick a set of properties K - */ -type Pick = { - [P in K]: T[P]; -} - -/** - * Construct a type with a set of properties K of type T - */ -type Record = { - [P in K]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; - -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string | string[], options?: CollatorOptions): Collator; - (locales?: string | string[], options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current or specified locale. - * @param that String to compare to target string - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} - - - -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainLongRange extends LongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface EventInit { - scoped?: boolean; - bubbles?: boolean; - cancelable?: boolean; -} - -interface EventModifierInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierOS?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends EventModifierInit { - code?: string; - key?: string; - location?: number; - repeat?: boolean; -} - -interface LongRange { - max?: number; - min?: number; -} - -interface MSAccountInfo { - rpDisplayName?: string; - userDisplayName?: string; - accountName?: string; - userId?: string; - accountImageUri?: string; -} - -interface MSAudioLocalClientEvent extends MSLocalClientEventBase { - networkSendQualityEventRatio?: number; - networkDelayEventRatio?: number; - cpuInsufficientEventRatio?: number; - deviceHalfDuplexAECEventRatio?: number; - deviceRenderNotFunctioningEventRatio?: number; - deviceCaptureNotFunctioningEventRatio?: number; - deviceGlitchesEventRatio?: number; - deviceLowSNREventRatio?: number; - deviceLowSpeechLevelEventRatio?: number; - deviceClippingEventRatio?: number; - deviceEchoEventRatio?: number; - deviceNearEndToEchoRatioEventRatio?: number; - deviceRenderZeroVolumeEventRatio?: number; - deviceRenderMuteEventRatio?: number; - deviceMultipleEndpointsEventCount?: number; - deviceHowlingEventCount?: number; -} - -interface MSAudioRecvPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioRecvSignal; - packetReorderRatio?: number; - packetReorderDepthAvg?: number; - packetReorderDepthMax?: number; - burstLossLength1?: number; - burstLossLength2?: number; - burstLossLength3?: number; - burstLossLength4?: number; - burstLossLength5?: number; - burstLossLength6?: number; - burstLossLength7?: number; - burstLossLength8OrHigher?: number; - fecRecvDistance1?: number; - fecRecvDistance2?: number; - fecRecvDistance3?: number; - ratioConcealedSamplesAvg?: number; - ratioStretchedSamplesAvg?: number; - ratioCompressedSamplesAvg?: number; -} - -interface MSAudioRecvSignal { - initialSignalLevelRMS?: number; - recvSignalLevelCh1?: number; - recvNoiseLevelCh1?: number; - renderSignalLevel?: number; - renderNoiseLevel?: number; - renderLoopbackSignalLevel?: number; -} - -interface MSAudioSendPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioSendSignal; - audioFECUsed?: boolean; - sendMutePercent?: number; -} - -interface MSAudioSendSignal { - noiseLevel?: number; - sendSignalLevelCh1?: number; - sendNoiseLevelCh1?: number; -} - -interface MSConnectivity { - iceType?: string; - iceWarningFlags?: MSIceWarningFlags; - relayAddress?: MSRelayAddress; -} - -interface MSCredentialFilter { - accept?: MSCredentialSpec[]; -} - -interface MSCredentialParameters { - type?: string; -} - -interface MSCredentialSpec { - type?: string; - id?: string; -} - -interface MSDelay { - roundTrip?: number; - roundTripMax?: number; -} - -interface MSDescription extends RTCStats { - connectivity?: MSConnectivity; - transport?: string; - networkconnectivity?: MSNetworkConnectivityInfo; - localAddr?: MSIPAddressInfo; - remoteAddr?: MSIPAddressInfo; - deviceDevName?: string; - reflexiveLocalIPAddr?: MSIPAddressInfo; -} - -interface MSFIDOCredentialParameters extends MSCredentialParameters { - algorithm?: string | Algorithm; - authenticators?: AAGUID[]; -} - -interface MSIPAddressInfo { - ipAddr?: string; - port?: number; - manufacturerMacAddrMask?: string; -} - -interface MSIceWarningFlags { - turnTcpTimedOut?: boolean; - turnUdpAllocateFailed?: boolean; - turnUdpSendFailed?: boolean; - turnTcpAllocateFailed?: boolean; - turnTcpSendFailed?: boolean; - udpLocalConnectivityFailed?: boolean; - udpNatConnectivityFailed?: boolean; - udpRelayConnectivityFailed?: boolean; - tcpNatConnectivityFailed?: boolean; - tcpRelayConnectivityFailed?: boolean; - connCheckMessageIntegrityFailed?: boolean; - allocationMessageIntegrityFailed?: boolean; - connCheckOtherError?: boolean; - turnAuthUnknownUsernameError?: boolean; - noRelayServersConfigured?: boolean; - multipleRelayServersAttempted?: boolean; - portRangeExhausted?: boolean; - alternateServerReceived?: boolean; - pseudoTLSFailure?: boolean; - turnTurnTcpConnectivityFailed?: boolean; - useCandidateChecksFailed?: boolean; - fipsAllocationFailure?: boolean; -} - -interface MSJitter { - interArrival?: number; - interArrivalMax?: number; - interArrivalSD?: number; -} - -interface MSLocalClientEventBase extends RTCStats { - networkReceiveQualityEventRatio?: number; - networkBandwidthLowEventRatio?: number; -} - -interface MSNetwork extends RTCStats { - jitter?: MSJitter; - delay?: MSDelay; - packetLoss?: MSPacketLoss; - utilization?: MSUtilization; -} - -interface MSNetworkConnectivityInfo { - vpn?: boolean; - linkspeed?: number; - networkConnectionDetails?: string; -} - -interface MSNetworkInterfaceType { - interfaceTypeEthernet?: boolean; - interfaceTypeWireless?: boolean; - interfaceTypePPP?: boolean; - interfaceTypeTunnel?: boolean; - interfaceTypeWWAN?: boolean; -} - -interface MSOutboundNetwork extends MSNetwork { - appliedBandwidthLimit?: number; -} - -interface MSPacketLoss { - lossRate?: number; - lossRateMax?: number; -} - -interface MSPayloadBase extends RTCStats { - payloadDescription?: string; -} - -interface MSRelayAddress { - relayAddress?: string; - port?: number; -} - -interface MSSignatureParameters { - userPrompt?: string; -} - -interface MSTransportDiagnosticsStats extends RTCStats { - baseAddress?: string; - localAddress?: string; - localSite?: string; - networkName?: string; - remoteAddress?: string; - remoteSite?: string; - localMR?: string; - remoteMR?: string; - iceWarningFlags?: MSIceWarningFlags; - portRangeMin?: number; - portRangeMax?: number; - localMRTCPPort?: number; - remoteMRTCPPort?: number; - stunVer?: number; - numConsentReqSent?: number; - numConsentReqReceived?: number; - numConsentRespSent?: number; - numConsentRespReceived?: number; - interfaces?: MSNetworkInterfaceType; - baseInterface?: MSNetworkInterfaceType; - protocol?: string; - localInterface?: MSNetworkInterfaceType; - localAddrType?: string; - remoteAddrType?: string; - iceRole?: string; - rtpRtcpMux?: boolean; - allocationTimeInMs?: number; - msRtcEngineVersion?: string; -} - -interface MSUtilization { - packets?: number; - bandwidthEstimation?: number; - bandwidthEstimationMin?: number; - bandwidthEstimationMax?: number; - bandwidthEstimationStdDev?: number; - bandwidthEstimationAvg?: number; -} - -interface MSVideoPayload extends MSPayloadBase { - resoluton?: string; - videoBitRateAvg?: number; - videoBitRateMax?: number; - videoFrameRateAvg?: number; - videoPacketLossRate?: number; - durationSeconds?: number; -} - -interface MSVideoRecvPayload extends MSVideoPayload { - videoFrameLossRate?: number; - recvCodecType?: string; - recvResolutionWidth?: number; - recvResolutionHeight?: number; - videoResolutions?: MSVideoResolutionDistribution; - recvFrameRateAverage?: number; - recvBitRateMaximum?: number; - recvBitRateAverage?: number; - recvVideoStreamsMax?: number; - recvVideoStreamsMin?: number; - recvVideoStreamsMode?: number; - videoPostFECPLR?: number; - lowBitRateCallPercent?: number; - lowFrameRateCallPercent?: number; - reorderBufferTotalPackets?: number; - recvReorderBufferReorderedPackets?: number; - recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; - recvReorderBufferMaxSuccessfullyOrderedExtent?: number; - recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; - recvReorderBufferPacketsDroppedDueToTimeout?: number; - recvFpsHarmonicAverage?: number; - recvNumResSwitches?: number; -} - -interface MSVideoResolutionDistribution { - cifQuality?: number; - vgaQuality?: number; - h720Quality?: number; - h1080Quality?: number; - h1440Quality?: number; - h2160Quality?: number; -} - -interface MSVideoSendPayload extends MSVideoPayload { - sendFrameRateAverage?: number; - sendBitRateMaximum?: number; - sendBitRateAverage?: number; - sendVideoStreamsMax?: number; - sendResolutionWidth?: number; - sendResolutionHeight?: number; -} - -interface MediaEncryptedEventInit extends EventInit { - initDataType?: string; - initData?: ArrayBuffer; -} - -interface MediaKeyMessageEventInit extends EventInit { - messageType?: string; - message?: ArrayBuffer; -} - -interface MediaKeySystemConfiguration { - initDataTypes?: string[]; - audioCapabilities?: MediaKeySystemMediaCapability[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: string; - persistentState?: string; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaStreamConstraints { - video?: boolean | MediaTrackConstraints; - audio?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError; -} - -interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - width?: number | LongRange; - height?: number | LongRange; - aspectRatio?: number | DoubleRange; - frameRate?: number | DoubleRange; - facingMode?: string; - volume?: number | DoubleRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - echoCancellation?: boolean[]; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackConstraintSet { - width?: number | ConstrainLongRange; - height?: number | ConstrainLongRange; - aspectRatio?: number | ConstrainDoubleRange; - frameRate?: number | ConstrainDoubleRange; - facingMode?: string | string[] | ConstrainDOMStringParameters; - volume?: number | ConstrainDoubleRange; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - echoCancelation?: boolean | ConstrainBooleanParameters; - deviceId?: string | string[] | ConstrainDOMStringParameters; - groupId?: string | string[] | ConstrainDOMStringParameters; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - width?: number; - height?: number; - aspectRatio?: number; - frameRate?: number; - facingMode?: string; - volume?: number; - sampleRate?: number; - sampleSize?: number; - echoCancellation?: boolean; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackSupportedConstraints { - width?: boolean; - height?: boolean; - aspectRatio?: boolean; - frameRate?: boolean; - facingMode?: boolean; - volume?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - echoCancellation?: boolean; - deviceId?: boolean; - groupId?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - role?: string; - fingerprints?: RTCDtlsFingerprint[]; -} - -interface RTCIceCandidate { - foundation?: string; - priority?: number; - ip?: string; - protocol?: string; - port?: number; - type?: string; - tcpType?: string; - relatedAddress?: string; - relatedPort?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - ipAddress?: string; - portNumber?: number; - transport?: string; - candidateType?: string; - priority?: number; - addressSourceUrl?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - transportId?: string; - localCandidateId?: string; - remoteCandidateId?: string; - state?: string; - priority?: number; - nominated?: boolean; - writable?: boolean; - readable?: boolean; - bytesSent?: number; - bytesReceived?: number; - roundTripTime?: number; - availableOutgoingBitrate?: number; - availableIncomingBitrate?: number; -} - -interface RTCIceGatherOptions { - gatherPolicy?: string; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - usernameFragment?: string; - password?: string; -} - -interface RTCIceServer { - urls?: any; - username?: string; - credential?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - packetsReceived?: number; - bytesReceived?: number; - packetsLost?: number; - jitter?: number; - fractionLost?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - trackIdentifier?: string; - remoteSource?: boolean; - ssrcIds?: string[]; - frameWidth?: number; - frameHeight?: number; - framesPerSecond?: number; - framesSent?: number; - framesReceived?: number; - framesDecoded?: number; - framesDropped?: number; - framesCorrupted?: number; - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - packetsSent?: number; - bytesSent?: number; - targetBitrate?: number; - roundTripTime?: number; -} - -interface RTCRTPStreamStats extends RTCStats { - ssrc?: string; - associateStatsId?: string; - isRemote?: boolean; - mediaTrackId?: string; - transportId?: string; - codecId?: string; - firCount?: number; - pliCount?: number; - nackCount?: number; - sliCount?: number; -} - -interface RTCRtcpFeedback { - type?: string; - parameter?: string; -} - -interface RTCRtcpParameters { - ssrc?: number; - cname?: string; - reducedSize?: boolean; - mux?: boolean; -} - -interface RTCRtpCapabilities { - codecs?: RTCRtpCodecCapability[]; - headerExtensions?: RTCRtpHeaderExtension[]; - fecMechanisms?: string[]; -} - -interface RTCRtpCodecCapability { - name?: string; - kind?: string; - clockRate?: number; - preferredPayloadType?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; - options?: any; - maxTemporalLayers?: number; - maxSpatialLayers?: number; - svcMultiStreamSupport?: boolean; -} - -interface RTCRtpCodecParameters { - name?: string; - payloadType?: any; - clockRate?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; -} - -interface RTCRtpContributingSource { - timestamp?: number; - csrc?: number; - audioLevel?: number; -} - -interface RTCRtpEncodingParameters { - ssrc?: number; - codecPayloadType?: number; - fec?: RTCRtpFecParameters; - rtx?: RTCRtpRtxParameters; - priority?: number; - maxBitrate?: number; - minQuality?: number; - framerateBias?: number; - resolutionScale?: number; - framerateScale?: number; - active?: boolean; - encodingId?: string; - dependencyEncodingIds?: string[]; - ssrcRange?: RTCSsrcRange; -} - -interface RTCRtpFecParameters { - ssrc?: number; - mechanism?: string; -} - -interface RTCRtpHeaderExtension { - kind?: string; - uri?: string; - preferredId?: number; - preferredEncrypt?: boolean; -} - -interface RTCRtpHeaderExtensionParameters { - uri?: string; - id?: number; - encrypt?: boolean; -} - -interface RTCRtpParameters { - muxId?: string; - codecs?: RTCRtpCodecParameters[]; - headerExtensions?: RTCRtpHeaderExtensionParameters[]; - encodings?: RTCRtpEncodingParameters[]; - rtcp?: RTCRtcpParameters; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpUnhandled { - ssrc?: number; - payloadType?: number; - muxId?: string; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiValue?: number; - mkiLength?: number; -} - -interface RTCSrtpSdesParameters { - tag?: number; - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; -} - -interface RTCSsrcRange { - min?: number; - max?: number; -} - -interface RTCStats { - timestamp?: number; - type?: string; - id?: string; - msType?: string; -} - -interface RTCStatsReport { -} - -interface RTCTransportStats extends RTCStats { - bytesSent?: number; - bytesReceived?: number; - rtcpTransportStatsId?: string; - activeConnection?: boolean; - selectedCandidatePairId?: string; - localCertificateId?: string; - remoteCertificateId?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - failIfMajorPerformanceCaveat?: boolean; - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCacheEventMap { - "cached": Event; - "checking": Event; - "downloading": Event; - "error": ErrorEvent; - "noupdate": Event; - "obsolete": Event; - "progress": ProgressEvent; - "updateready": Event; -} - -interface ApplicationCache extends EventTarget { - oncached: (this: ApplicationCache, ev: Event) => any; - onchecking: (this: ApplicationCache, ev: Event) => any; - ondownloading: (this: ApplicationCache, ev: Event) => any; - onerror: (this: ApplicationCache, ev: ErrorEvent) => any; - onnoupdate: (this: ApplicationCache, ev: Event) => any; - onobsolete: (this: ApplicationCache, ev: Event) => any; - onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; - onupdateready: (this: ApplicationCache, ev: Event) => any; - readonly status: number; - abort(): void; - swapCache(): void; - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - readonly attributeName: string; - attributeValue: string | null; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - readonly name: string; - readonly ownerElement: Element; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNodeEventMap { - "ended": MediaStreamErrorEvent; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - readonly sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - readonly context: AudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - readonly defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - readonly id: string; - kind: string; - readonly label: string; - language: string; - readonly sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackListEventMap { - "addtrack": TrackEvent; - "change": Event; - "removetrack": TrackEvent; -} - -interface AudioTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; - onchange: (this: AudioTrackList, ev: Event) => any; - onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack | null; - item(index: number): AudioTrack; - addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - readonly pseudoClass: string; - readonly selector: string; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule; - readonly parentStyleSheet: CSSStyleSheet; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; - alignmentBaseline: string | null; - animation: string | null; - animationDelay: string | null; - animationDirection: string | null; - animationDuration: string | null; - animationFillMode: string | null; - animationIterationCount: string | null; - animationName: string | null; - animationPlayState: string | null; - animationTimingFunction: string | null; - backfaceVisibility: string | null; - background: string | null; - backgroundAttachment: string | null; - backgroundClip: string | null; - backgroundColor: string | null; - backgroundImage: string | null; - backgroundOrigin: string | null; - backgroundPosition: string | null; - backgroundPositionX: string | null; - backgroundPositionY: string | null; - backgroundRepeat: string | null; - backgroundSize: string | null; - baselineShift: string | null; - border: string | null; - borderBottom: string | null; - borderBottomColor: string | null; - borderBottomLeftRadius: string | null; - borderBottomRightRadius: string | null; - borderBottomStyle: string | null; - borderBottomWidth: string | null; - borderCollapse: string | null; - borderColor: string | null; - borderImage: string | null; - borderImageOutset: string | null; - borderImageRepeat: string | null; - borderImageSlice: string | null; - borderImageSource: string | null; - borderImageWidth: string | null; - borderLeft: string | null; - borderLeftColor: string | null; - borderLeftStyle: string | null; - borderLeftWidth: string | null; - borderRadius: string | null; - borderRight: string | null; - borderRightColor: string | null; - borderRightStyle: string | null; - borderRightWidth: string | null; - borderSpacing: string | null; - borderStyle: string | null; - borderTop: string | null; - borderTopColor: string | null; - borderTopLeftRadius: string | null; - borderTopRightRadius: string | null; - borderTopStyle: string | null; - borderTopWidth: string | null; - borderWidth: string | null; - bottom: string | null; - boxShadow: string | null; - boxSizing: string | null; - breakAfter: string | null; - breakBefore: string | null; - breakInside: string | null; - captionSide: string | null; - clear: string | null; - clip: string | null; - clipPath: string | null; - clipRule: string | null; - color: string | null; - colorInterpolationFilters: string | null; - columnCount: any; - columnFill: string | null; - columnGap: any; - columnRule: string | null; - columnRuleColor: any; - columnRuleStyle: string | null; - columnRuleWidth: any; - columnSpan: string | null; - columnWidth: any; - columns: string | null; - content: string | null; - counterIncrement: string | null; - counterReset: string | null; - cssFloat: string | null; - cssText: string; - cursor: string | null; - direction: string | null; - display: string | null; - dominantBaseline: string | null; - emptyCells: string | null; - enableBackground: string | null; - fill: string | null; - fillOpacity: string | null; - fillRule: string | null; - filter: string | null; - flex: string | null; - flexBasis: string | null; - flexDirection: string | null; - flexFlow: string | null; - flexGrow: string | null; - flexShrink: string | null; - flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; - height: string | null; - imeMode: string | null; - justifyContent: string | null; - kerning: string | null; - left: string | null; - readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineHeight: string | null; - listStyle: string | null; - listStyleImage: string | null; - listStylePosition: string | null; - listStyleType: string | null; - margin: string | null; - marginBottom: string | null; - marginLeft: string | null; - marginRight: string | null; - marginTop: string | null; - marker: string | null; - markerEnd: string | null; - markerMid: string | null; - markerStart: string | null; - mask: string | null; - maxHeight: string | null; - maxWidth: string | null; - minHeight: string | null; - minWidth: string | null; - msContentZoomChaining: string | null; - msContentZoomLimit: string | null; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string | null; - msContentZoomSnapPoints: string | null; - msContentZoomSnapType: string | null; - msContentZooming: string | null; - msFlowFrom: string | null; - msFlowInto: string | null; - msFontFeatureSettings: string | null; - msGridColumn: any; - msGridColumnAlign: string | null; - msGridColumnSpan: any; - msGridColumns: string | null; - msGridRow: any; - msGridRowAlign: string | null; - msGridRowSpan: any; - msGridRows: string | null; - msHighContrastAdjust: string | null; - msHyphenateLimitChars: string | null; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string | null; - msImeAlign: string | null; - msOverflowStyle: string | null; - msScrollChaining: string | null; - msScrollLimit: string | null; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string | null; - msScrollSnapPointsX: string | null; - msScrollSnapPointsY: string | null; - msScrollSnapType: string | null; - msScrollSnapX: string | null; - msScrollSnapY: string | null; - msScrollTranslation: string | null; - msTextCombineHorizontal: string | null; - msTextSizeAdjust: any; - msTouchAction: string | null; - msTouchSelect: string | null; - msUserSelect: string | null; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string | null; - order: string | null; - orphans: string | null; - outline: string | null; - outlineColor: string | null; - outlineStyle: string | null; - outlineWidth: string | null; - overflow: string | null; - overflowX: string | null; - overflowY: string | null; - padding: string | null; - paddingBottom: string | null; - paddingLeft: string | null; - paddingRight: string | null; - paddingTop: string | null; - pageBreakAfter: string | null; - pageBreakBefore: string | null; - pageBreakInside: string | null; - readonly parentRule: CSSRule; - perspective: string | null; - perspectiveOrigin: string | null; - pointerEvents: string | null; - position: string | null; - quotes: string | null; - right: string | null; - rubyAlign: string | null; - rubyOverhang: string | null; - rubyPosition: string | null; - stopColor: string | null; - stopOpacity: string | null; - stroke: string | null; - strokeDasharray: string | null; - strokeDashoffset: string | null; - strokeLinecap: string | null; - strokeLinejoin: string | null; - strokeMiterlimit: string | null; - strokeOpacity: string | null; - strokeWidth: string | null; - tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; - textAnchor: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; - textKashida: string | null; - textKashidaSpace: string | null; - textOverflow: string | null; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; - top: string | null; - touchAction: string | null; - transform: string | null; - transformOrigin: string | null; - transformStyle: string | null; - transition: string | null; - transitionDelay: string | null; - transitionDuration: string | null; - transitionProperty: string | null; - transitionTimingFunction: string | null; - unicodeBidi: string | null; - verticalAlign: string | null; - visibility: string | null; - webkitAlignContent: string | null; - webkitAlignItems: string | null; - webkitAlignSelf: string | null; - webkitAnimation: string | null; - webkitAnimationDelay: string | null; - webkitAnimationDirection: string | null; - webkitAnimationDuration: string | null; - webkitAnimationFillMode: string | null; - webkitAnimationIterationCount: string | null; - webkitAnimationName: string | null; - webkitAnimationPlayState: string | null; - webkitAnimationTimingFunction: string | null; - webkitAppearance: string | null; - webkitBackfaceVisibility: string | null; - webkitBackgroundClip: string | null; - webkitBackgroundOrigin: string | null; - webkitBackgroundSize: string | null; - webkitBorderBottomLeftRadius: string | null; - webkitBorderBottomRightRadius: string | null; - webkitBorderImage: string | null; - webkitBorderRadius: string | null; - webkitBorderTopLeftRadius: string | null; - webkitBorderTopRightRadius: string | null; - webkitBoxAlign: string | null; - webkitBoxDirection: string | null; - webkitBoxFlex: string | null; - webkitBoxOrdinalGroup: string | null; - webkitBoxOrient: string | null; - webkitBoxPack: string | null; - webkitBoxSizing: string | null; - webkitColumnBreakAfter: string | null; - webkitColumnBreakBefore: string | null; - webkitColumnBreakInside: string | null; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string | null; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string | null; - webkitColumnRuleWidth: any; - webkitColumnSpan: string | null; - webkitColumnWidth: any; - webkitColumns: string | null; - webkitFilter: string | null; - webkitFlex: string | null; - webkitFlexBasis: string | null; - webkitFlexDirection: string | null; - webkitFlexFlow: string | null; - webkitFlexGrow: string | null; - webkitFlexShrink: string | null; - webkitFlexWrap: string | null; - webkitJustifyContent: string | null; - webkitOrder: string | null; - webkitPerspective: string | null; - webkitPerspectiveOrigin: string | null; - webkitTapHighlightColor: string | null; - webkitTextFillColor: string | null; - webkitTextSizeAdjust: any; - webkitTransform: string | null; - webkitTransformOrigin: string | null; - webkitTransformStyle: string | null; - webkitTransition: string | null; - webkitTransitionDelay: string | null; - webkitTransitionDuration: string | null; - webkitTransitionProperty: string | null; - webkitTransitionTimingFunction: string | null; - webkitUserModify: string | null; - webkitUserSelect: string | null; - webkitWritingMode: string | null; - whiteSpace: string | null; - widows: string | null; - width: string | null; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; - zIndex: string | null; - zoom: string | null; - resize: string | null; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readonly readOnly: boolean; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - cssText: string; - readonly href: string; - readonly id: string; - readonly imports: StyleSheetList; - readonly isAlternate: boolean; - readonly isPrefAlternate: boolean; - readonly ownerRule: CSSRule; - readonly owningElement: Element; - readonly pages: StyleSheetPageList; - readonly readOnly: boolean; - readonly rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { - setTransform(matrix: SVGMatrix): void; -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D extends Object, CanvasPathMethods { - readonly canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - mozImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - beginPath(): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - measureText(text: string): TextMetrics; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - readonly length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - readonly commandName: string; - readonly detail: string | null; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - readonly subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - readonly detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string | null, version: string | null): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - readonly length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; - addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - readonly files: FileList; - readonly items: DataTransferItemList; - readonly types: string[]; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - readonly kind: string; - readonly type: string; - getAsFile(): File | null; - getAsString(_callback: FunctionStringCallback | null): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - readonly length: number; - add(data: File): DataTransferItem | null; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: string; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -} - -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceAcceleration | null; - readonly accelerationIncludingGravity: DeviceAcceleration | null; - readonly interval: number | null; - readonly rotationRate: DeviceRotationRate | null; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface DocumentEventMap extends GlobalEventHandlersEventMap { - "abort": UIEvent; - "activate": UIEvent; - "beforeactivate": UIEvent; - "beforedeactivate": UIEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "contextmenu": PointerEvent; - "dblclick": MouseEvent; - "deactivate": UIEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "fullscreenchange": Event; - "fullscreenerror": Event; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "mousedown": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSContentZoom": UIEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSInertiaStart": MSGestureEvent; - "MSManipulationStateChanged": MSManipulationEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "mssitemodejumplistitemremoved": MSSiteModeEvent; - "msthumbnailclick": MSSiteModeEvent; - "pause": Event; - "play": Event; - "playing": Event; - "pointerlockchange": Event; - "pointerlockerror": Event; - "progress": ProgressEvent; - "ratechange": Event; - "readystatechange": ProgressEvent; - "reset": Event; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "selectionchange": Event; - "selectstart": Event; - "stalled": Event; - "stop": Event; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "touchcancel": TouchEvent; - "touchend": TouchEvent; - "touchmove": TouchEvent; - "touchstart": TouchEvent; - "volumechange": Event; - "waiting": Event; - "webkitfullscreenchange": Event; - "webkitfullscreenerror": Event; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - readonly URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - readonly activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - cookie: string; - readonly currentScript: HTMLScriptElement | SVGScriptElement; - /** - * Gets the default character set from the current regional language settings. - */ - readonly defaultCharset: string; - readonly defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollectionOf; - readonly fullscreenElement: Element | null; - readonly fullscreenEnabled: boolean; - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string | null; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - readonly location: Location; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (this: Document, ev: UIEvent) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (this: Document, ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (this: Document, ev: Event) => any; - oncanplaythrough: (this: Document, ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (this: Document, ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (this: Document, ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (this: Document, ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (this: Document, ev: DragEvent) => any; - ondrop: (this: Document, ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (this: Document, ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (this: Document, ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (this: Document, ev: MediaStreamErrorEvent) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (this: Document, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (this: Document, ev: FocusEvent) => any; - onfullscreenchange: (this: Document, ev: Event) => any; - onfullscreenerror: (this: Document, ev: Event) => any; - oninput: (this: Document, ev: Event) => any; - oninvalid: (this: Document, ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (this: Document, ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (this: Document, ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (this: Document, ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (this: Document, ev: WheelEvent) => any; - onmscontentzoom: (this: Document, ev: UIEvent) => any; - onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; - onmsgestureend: (this: Document, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; - onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; - onmspointercancel: (this: Document, ev: MSPointerEvent) => any; - onmspointerdown: (this: Document, ev: MSPointerEvent) => any; - onmspointerenter: (this: Document, ev: MSPointerEvent) => any; - onmspointerleave: (this: Document, ev: MSPointerEvent) => any; - onmspointermove: (this: Document, ev: MSPointerEvent) => any; - onmspointerout: (this: Document, ev: MSPointerEvent) => any; - onmspointerover: (this: Document, ev: MSPointerEvent) => any; - onmspointerup: (this: Document, ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (this: Document, ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (this: Document, ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (this: Document, ev: Event) => any; - onpointerlockchange: (this: Document, ev: Event) => any; - onpointerlockerror: (this: Document, ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (this: Document, ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (this: Document, ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (this: Document, ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (this: Document, ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (this: Document, ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (this: Document, ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (this: Document, ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (this: Document, ev: UIEvent) => any; - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (this: Document, ev: Event) => any; - onselectstart: (this: Document, ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (this: Document, ev: Event) => any; - onsubmit: (this: Document, ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (this: Document, ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (this: Document, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (this: Document, ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (this: Document, ev: Event) => any; - onwebkitfullscreenchange: (this: Document, ev: Event) => any; - onwebkitfullscreenerror: (this: Document, ev: Event) => any; - plugins: HTMLCollectionOf; - readonly pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - readonly rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - readonly webkitCurrentFullScreenElement: Element | null; - readonly webkitFullscreenElement: Element | null; - readonly webkitFullscreenEnabled: boolean; - readonly webkitIsFullScreen: boolean; - readonly xmlEncoding: string | null; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string | null; - adoptNode(source: Node): Node; - captureEvents(): void; - caretRangeFromPoint(x: number, y: number): Range; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: K): HTMLElementTagNameMap[K]; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string | null, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement | null; - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: K): ElementListTagNameMap[K]; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeListOf; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): void; - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector, ParentNode { -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - readonly entities: NamedNodeMap; - readonly internalSubset: string | null; - readonly name: string; - readonly notations: NamedNodeMap; - readonly publicId: string | null; - readonly systemId: string | null; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - readonly dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: AudioParam; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_frag_depth { -} - -declare var EXT_frag_depth: { - prototype: EXT_frag_depth; - new(): EXT_frag_depth; -} - -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface ElementEventMap extends GlobalEventHandlersEventMap { - "ariarequest": AriaRequestEvent; - "command": CommandEvent; - "gotpointercapture": PointerEvent; - "lostpointercapture": PointerEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSGotPointerCapture": MSPointerEvent; - "MSInertiaStart": MSGestureEvent; - "MSLostPointerCapture": MSPointerEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "touchcancel": TouchEvent; - "touchend": TouchEvent; - "touchmove": TouchEvent; - "touchstart": TouchEvent; - "webkitfullscreenchange": Event; - "webkitfullscreenerror": Event; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { - readonly classList: DOMTokenList; - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - id: string; - msContentZoomFactor: number; - readonly msRegionOverflow: string; - onariarequest: (this: Element, ev: AriaRequestEvent) => any; - oncommand: (this: Element, ev: CommandEvent) => any; - ongotpointercapture: (this: Element, ev: PointerEvent) => any; - onlostpointercapture: (this: Element, ev: PointerEvent) => any; - onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; - onmsgestureend: (this: Element, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; - onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; - onmspointercancel: (this: Element, ev: MSPointerEvent) => any; - onmspointerdown: (this: Element, ev: MSPointerEvent) => any; - onmspointerenter: (this: Element, ev: MSPointerEvent) => any; - onmspointerleave: (this: Element, ev: MSPointerEvent) => any; - onmspointermove: (this: Element, ev: MSPointerEvent) => any; - onmspointerout: (this: Element, ev: MSPointerEvent) => any; - onmspointerover: (this: Element, ev: MSPointerEvent) => any; - onmspointerup: (this: Element, ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: Element, ev: Event) => any; - onwebkitfullscreenerror: (this: Element, ev: Event) => any; - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - readonly tagName: string; - innerHTML: string; - readonly assignedSlot: HTMLSlotElement | null; - slot: string; - readonly shadowRoot: ShadowRoot | null; - getAttribute(name: string): string | null; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: K): ElementListTagNameMap[K]; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - matches(selector: string): boolean; - closest(selector: string): Element | null; - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; - scroll(options?: ScrollToOptions): void; - scroll(x: number, y: number): void; - scrollTo(options?: ScrollToOptions): void; - scrollTo(x: number, y: number): void; - scrollBy(options?: ScrollToOptions): void; - scrollBy(x: number, y: number): void; - insertAdjacentElement(position: string, insertedElement: Element): Element | null; - insertAdjacentHTML(where: string, html: string): void; - insertAdjacentText(where: string, text: string): void; - attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; - addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: Element | null; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - readonly scoped: boolean; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - deepPath(): EventTarget[]; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - readonly axes: number[]; - readonly buttons: GamepadButton[]; - readonly connected: boolean; - readonly id: string; - readonly index: number; - readonly mapping: string; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - readonly pressed: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - readonly mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - readonly nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - readonly protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string | null; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { - addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBodyElementEventMap extends HTMLElementEventMap { - "afterprint": Event; - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "load": Event; - "message": MessageEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "popstate": PopStateEvent; - "resize": UIEvent; - "storage": StorageEvent; - "unload": Event; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (this: HTMLBodyElement, ev: Event) => any; - onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; - onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; - onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; - onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; - onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; - onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; - onload: (this: HTMLBodyElement, ev: Event) => any; - onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; - onoffline: (this: HTMLBodyElement, ev: Event) => any; - ononline: (this: HTMLBodyElement, ev: Event) => any; - onorientationchange: (this: HTMLBodyElement, ev: Event) => any; - onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; - onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; - onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; - onresize: (this: HTMLBodyElement, ev: UIEvent) => any; - onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; - onunload: (this: HTMLBodyElement, ev: Event) => any; - text: any; - vLink: any; - addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. - */ - toDataURL(type?: string, ...args: any[]): string; - toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Retrieves an object from various collections. - */ - item(index: number): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollectionOf; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElementEventMap extends ElementEventMap { - "abort": UIEvent; - "activate": UIEvent; - "beforeactivate": UIEvent; - "beforecopy": ClipboardEvent; - "beforecut": ClipboardEvent; - "beforedeactivate": UIEvent; - "beforepaste": ClipboardEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "contextmenu": PointerEvent; - "copy": ClipboardEvent; - "cuechange": Event; - "cut": ClipboardEvent; - "dblclick": MouseEvent; - "deactivate": UIEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "mousedown": MouseEvent; - "mouseenter": MouseEvent; - "mouseleave": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSContentZoom": UIEvent; - "MSManipulationStateChanged": MSManipulationEvent; - "paste": ClipboardEvent; - "pause": Event; - "play": Event; - "playing": Event; - "progress": ProgressEvent; - "ratechange": Event; - "reset": Event; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "selectstart": Event; - "stalled": Event; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "volumechange": Event; - "waiting": Event; -} - -interface HTMLElement extends Element { - accessKey: string; - readonly children: HTMLCollection; - contentEditable: string; - readonly dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - readonly isContentEditable: boolean; - lang: string; - readonly offsetHeight: number; - readonly offsetLeft: number; - readonly offsetParent: Element; - readonly offsetTop: number; - readonly offsetWidth: number; - onabort: (this: HTMLElement, ev: UIEvent) => any; - onactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; - onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; - onblur: (this: HTMLElement, ev: FocusEvent) => any; - oncanplay: (this: HTMLElement, ev: Event) => any; - oncanplaythrough: (this: HTMLElement, ev: Event) => any; - onchange: (this: HTMLElement, ev: Event) => any; - onclick: (this: HTMLElement, ev: MouseEvent) => any; - oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; - oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; - oncuechange: (this: HTMLElement, ev: Event) => any; - oncut: (this: HTMLElement, ev: ClipboardEvent) => any; - ondblclick: (this: HTMLElement, ev: MouseEvent) => any; - ondeactivate: (this: HTMLElement, ev: UIEvent) => any; - ondrag: (this: HTMLElement, ev: DragEvent) => any; - ondragend: (this: HTMLElement, ev: DragEvent) => any; - ondragenter: (this: HTMLElement, ev: DragEvent) => any; - ondragleave: (this: HTMLElement, ev: DragEvent) => any; - ondragover: (this: HTMLElement, ev: DragEvent) => any; - ondragstart: (this: HTMLElement, ev: DragEvent) => any; - ondrop: (this: HTMLElement, ev: DragEvent) => any; - ondurationchange: (this: HTMLElement, ev: Event) => any; - onemptied: (this: HTMLElement, ev: Event) => any; - onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; - onerror: (this: HTMLElement, ev: ErrorEvent) => any; - onfocus: (this: HTMLElement, ev: FocusEvent) => any; - oninput: (this: HTMLElement, ev: Event) => any; - oninvalid: (this: HTMLElement, ev: Event) => any; - onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; - onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; - onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; - onload: (this: HTMLElement, ev: Event) => any; - onloadeddata: (this: HTMLElement, ev: Event) => any; - onloadedmetadata: (this: HTMLElement, ev: Event) => any; - onloadstart: (this: HTMLElement, ev: Event) => any; - onmousedown: (this: HTMLElement, ev: MouseEvent) => any; - onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; - onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; - onmousemove: (this: HTMLElement, ev: MouseEvent) => any; - onmouseout: (this: HTMLElement, ev: MouseEvent) => any; - onmouseover: (this: HTMLElement, ev: MouseEvent) => any; - onmouseup: (this: HTMLElement, ev: MouseEvent) => any; - onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; - onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; - onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; - onpause: (this: HTMLElement, ev: Event) => any; - onplay: (this: HTMLElement, ev: Event) => any; - onplaying: (this: HTMLElement, ev: Event) => any; - onprogress: (this: HTMLElement, ev: ProgressEvent) => any; - onratechange: (this: HTMLElement, ev: Event) => any; - onreset: (this: HTMLElement, ev: Event) => any; - onscroll: (this: HTMLElement, ev: UIEvent) => any; - onseeked: (this: HTMLElement, ev: Event) => any; - onseeking: (this: HTMLElement, ev: Event) => any; - onselect: (this: HTMLElement, ev: UIEvent) => any; - onselectstart: (this: HTMLElement, ev: Event) => any; - onstalled: (this: HTMLElement, ev: Event) => any; - onsubmit: (this: HTMLElement, ev: Event) => any; - onsuspend: (this: HTMLElement, ev: Event) => any; - ontimeupdate: (this: HTMLElement, ev: Event) => any; - onvolumechange: (this: HTMLElement, ev: Event) => any; - onwaiting: (this: HTMLElement, ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - readonly style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - msGetInputContext(): MSInputMethodContext; - setActive(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - readonly palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - readonly pluginspage: string; - readonly readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - readonly elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElementEventMap extends HTMLElementEventMap { - "load": Event; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: HTMLFrameElement, ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "load": Event; - "message": MessageEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "resize": UIEvent; - "storage": StorageEvent; - "unload": Event; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; - onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; - onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; - onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; - onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; - onload: (this: HTMLFrameSetElement, ev: Event) => any; - onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; - onoffline: (this: HTMLFrameSetElement, ev: Event) => any; - ononline: (this: HTMLFrameSetElement, ev: Event) => any; - onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; - onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; - onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; - onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; - onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; - onunload: (this: HTMLFrameSetElement, ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElementEventMap extends HTMLElementEventMap { - "load": Event; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: HTMLIFrameElement, ev: Event) => any; - readonly sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - crossOrigin: string; - readonly currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - lowsrc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - readonly naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - readonly naturalWidth: number; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - readonly x: number; - readonly y: number; - msGetAsCastingSource(): any; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - readonly files: FileList | null; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - readonly list: HTMLElement; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - selectionDirection: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - webkitdirectory: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start?: number, end?: number, direction?: string): void; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - import?: Document; - integrity: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - readonly areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { - "bounce": Event; - "finish": Event; - "start": Event; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (this: HTMLMarqueeElement, ev: Event) => any; - onfinish: (this: HTMLMarqueeElement, ev: Event) => any; - onstart: (this: HTMLMarqueeElement, ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): void; - addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElementEventMap extends HTMLElementEventMap { - "encrypted": MediaEncryptedEvent; - "msneedkey": MSMediaKeyNeededEvent; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - readonly audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - readonly buffered: TimeRanges; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - crossOrigin: string; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - readonly currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - readonly duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - readonly ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - readonly error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - readonly mediaKeys: MediaKeys | null; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - readonly msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - readonly msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - readonly networkState: number; - onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - readonly paused: boolean; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - readonly played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - readonly seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - readonly seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcObject: MediaStream | null; - readonly textTracks: TextTrackList; - readonly videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Resets the audio or video object and loads a new media resource. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; - addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLMeterElement extends HTMLElement { - high: number; - low: number; - max: number; - min: number; - optimum: number; - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMeterElement: { - prototype: HTMLMeterElement; - new(): HTMLMeterElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - readonly object: any; - readonly readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - readonly text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLOptionsCollection extends HTMLCollectionOf { - length: number; - selectedIndex: number; - add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; - remove(index: number): void; -} - -declare var HTMLOptionsCollection: { - prototype: HTMLOptionsCollection; - new(): HTMLOptionsCollection; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPictureElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - readonly position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - integrity: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - readonly options: HTMLOptionsCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - selectedOptions: HTMLCollectionOf; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - disabled: boolean; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - readonly cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollectionOf; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollectionOf; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - readonly rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - readonly sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableDataCellElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTemplateElement extends HTMLElement { - readonly content: DocumentFragment; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readonly readyState: number; - src: string; - srclang: string; - readonly track: TextTrack; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { - "MSVideoFormatChanged": Event; - "MSVideoFrameStepCompleted": Event; - "MSVideoOptimalLayoutChanged": Event; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - readonly msIsLayoutOptimalForPlayback: boolean; - readonly msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoWidth: number; - readonly webkitDisplayingFullscreen: boolean; - readonly webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): void; - addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - readonly newURL: string | null; - readonly oldURL: string | null; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - readonly length: number; - readonly state: any; - scrollRestoration: ScrollRestoration; - back(): void; - forward(): void; - go(delta?: number): void; - pushState(data: any, title: string, url?: string | null): void; - replaceState(data: any, title: string, url?: string | null): void; -} - -declare var History: { - prototype: History; - new(): History; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabaseEventMap { - "abort": Event; - "error": ErrorEvent; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: IDBDatabase, ev: Event) => any; - onerror: (this: IDBDatabase, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; - "upgradeneeded": IDBVersionChangeEvent; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: IDBOpenDBRequest, ev: Event) => any; - onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; - addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequestEventMap { - "error": ErrorEvent; - "success": Event; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: IDBRequest, ev: ErrorEvent) => any; - onsuccess: (this: IDBRequest, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransactionEventMap { - "abort": Event; - "complete": Event; - "error": ErrorEvent; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: IDBTransaction, ev: Event) => any; - oncomplete: (this: IDBTransaction, ev: Event) => any; - onerror: (this: IDBTransaction, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - readonly altKey: boolean; - readonly char: string | null; - readonly charCode: number; - readonly ctrlKey: boolean; - readonly key: string; - readonly keyCode: number; - readonly locale: string; - readonly location: number; - readonly metaKey: boolean; - readonly repeat: boolean; - readonly shiftKey: boolean; - readonly which: number; - readonly code: string; - getModifierState(keyArg: string): boolean; - initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -interface ListeningStateChangedEvent extends Event { - readonly label: string; - readonly state: string; -} - -declare var ListeningStateChangedEvent: { - prototype: ListeningStateChangedEvent; - new(): ListeningStateChangedEvent; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - readonly executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperationEventMap { - "complete": Event; - "error": ErrorEvent; -} - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; - onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSAssertion { - readonly id: string; - readonly type: string; -} - -declare var MSAssertion: { - prototype: MSAssertion; - new(): MSAssertion; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; -} - -declare var MSCredentials: { - prototype: MSCredentials; - new(): MSCredentials; -} - -interface MSFIDOCredentialAssertion extends MSAssertion { - readonly algorithm: string | Algorithm; - readonly attestation: any; - readonly publicKey: string; - readonly transportHints: string[]; -} - -declare var MSFIDOCredentialAssertion: { - prototype: MSFIDOCredentialAssertion; - new(): MSFIDOCredentialAssertion; -} - -interface MSFIDOSignature { - readonly authnrData: string; - readonly clientData: string; - readonly signature: string; -} - -declare var MSFIDOSignature: { - prototype: MSFIDOSignature; - new(): MSFIDOSignature; -} - -interface MSFIDOSignatureAssertion extends MSAssertion { - readonly signature: MSFIDOSignature; -} - -declare var MSFIDOSignatureAssertion: { - prototype: MSFIDOSignatureAssertion; - new(): MSFIDOSignatureAssertion; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - readonly clientX: number; - readonly clientY: number; - readonly expansion: number; - readonly gestureObject: any; - readonly hwTimestamp: number; - readonly offsetX: number; - readonly offsetY: number; - readonly rotation: number; - readonly scale: number; - readonly screenX: number; - readonly screenY: number; - readonly translationX: number; - readonly translationY: number; - readonly velocityAngular: number; - readonly velocityExpansion: number; - readonly velocityX: number; - readonly velocityY: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - readonly constrictionActive: boolean; - readonly status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - readonly canGoBack: boolean; - readonly canGoForward: boolean; - readonly containsFullScreenElement: boolean; - readonly documentTitle: string; - height: number; - readonly settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContextEventMap { - "MSCandidateWindowHide": Event; - "MSCandidateWindowShow": Event; - "MSCandidateWindowUpdate": Event; -} - -interface MSInputMethodContext extends EventTarget { - readonly compositionEndOffset: number; - readonly compositionStartOffset: number; - oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; - oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; - oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; - readonly target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - readonly currentState: number; - readonly inertiaDestinationX: number; - readonly inertiaDestinationY: number; - readonly lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - readonly code: number; - readonly systemCode: number; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - readonly destinationURL: string | null; - readonly message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - readonly initData: Uint8Array | null; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - readonly error: MSMediaKeyError | null; - readonly keySystem: string; - readonly sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - readonly keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; - isTypeSupportedWithFeatures(keySystem: string, type?: string): string; -} - -interface MSPointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - readonly length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - readonly actionURL: string; - readonly buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperationEventMap { - "complete": Event; - "error": ErrorEvent; -} - -interface MSWebViewAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; - onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - readonly target: MSHTMLWebViewElement; - readonly type: number; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaDeviceInfo { - readonly deviceId: string; - readonly groupId: string; - readonly kind: string; - readonly label: string; -} - -declare var MediaDeviceInfo: { - prototype: MediaDeviceInfo; - new(): MediaDeviceInfo; -} - -interface MediaDevicesEventMap { - "devicechange": Event; -} - -interface MediaDevices extends EventTarget { - ondevicechange: (this: MediaDevices, ev: Event) => any; - enumerateDevices(): any; - getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaDevices: { - prototype: MediaDevices; - new(): MediaDevices; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaEncryptedEvent extends Event { - readonly initData: ArrayBuffer | null; - readonly initDataType: string; -} - -declare var MediaEncryptedEvent: { - prototype: MediaEncryptedEvent; - new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; -} - -interface MediaError { - readonly code: number; - readonly msExtendedCode: number; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaKeyMessageEvent extends Event { - readonly message: ArrayBuffer; - readonly messageType: string; -} - -declare var MediaKeyMessageEvent: { - prototype: MediaKeyMessageEvent; - new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; -} - -interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; - readonly expiration: number; - readonly keyStatuses: MediaKeyStatusMap; - readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; -} - -declare var MediaKeySession: { - prototype: MediaKeySession; - new(): MediaKeySession; -} - -interface MediaKeyStatusMap { - readonly size: number; - forEach(callback: ForEachCallback): void; - get(keyId: any): string; - has(keyId: any): boolean; -} - -declare var MediaKeyStatusMap: { - prototype: MediaKeyStatusMap; - new(): MediaKeyStatusMap; -} - -interface MediaKeySystemAccess { - readonly keySystem: string; - createMediaKeys(): PromiseLike; - getConfiguration(): MediaKeySystemConfiguration; -} - -declare var MediaKeySystemAccess: { - prototype: MediaKeySystemAccess; - new(): MediaKeySystemAccess; -} - -interface MediaKeys { - createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; -} - -declare var MediaKeys: { - prototype: MediaKeys; - new(): MediaKeys; -} - -interface MediaList { - readonly length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - readonly activeSourceBuffers: SourceBufferList; - duration: number; - readonly readyState: string; - readonly sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MediaStreamEventMap { - "active": Event; - "addtrack": TrackEvent; - "inactive": Event; - "removetrack": TrackEvent; -} - -interface MediaStream extends EventTarget { - readonly active: boolean; - readonly id: string; - onactive: (this: MediaStream, ev: Event) => any; - onaddtrack: (this: MediaStream, ev: TrackEvent) => any; - oninactive: (this: MediaStream, ev: Event) => any; - onremovetrack: (this: MediaStream, ev: TrackEvent) => any; - addTrack(track: MediaStreamTrack): void; - clone(): MediaStream; - getAudioTracks(): MediaStreamTrack[]; - getTrackById(trackId: string): MediaStreamTrack | null; - getTracks(): MediaStreamTrack[]; - getVideoTracks(): MediaStreamTrack[]; - removeTrack(track: MediaStreamTrack): void; - stop(): void; - addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStream: { - prototype: MediaStream; - new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; -} - -interface MediaStreamAudioSourceNode extends AudioNode { -} - -declare var MediaStreamAudioSourceNode: { - prototype: MediaStreamAudioSourceNode; - new(): MediaStreamAudioSourceNode; -} - -interface MediaStreamError { - readonly constraintName: string | null; - readonly message: string | null; - readonly name: string; -} - -declare var MediaStreamError: { - prototype: MediaStreamError; - new(): MediaStreamError; -} - -interface MediaStreamErrorEvent extends Event { - readonly error: MediaStreamError | null; -} - -declare var MediaStreamErrorEvent: { - prototype: MediaStreamErrorEvent; - new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; -} - -interface MediaStreamTrackEventMap { - "ended": MediaStreamErrorEvent; - "mute": Event; - "overconstrained": MediaStreamErrorEvent; - "unmute": Event; -} - -interface MediaStreamTrack extends EventTarget { - enabled: boolean; - readonly id: string; - readonly kind: string; - readonly label: string; - readonly muted: boolean; - onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; - onmute: (this: MediaStreamTrack, ev: Event) => any; - onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; - onunmute: (this: MediaStreamTrack, ev: Event) => any; - readonly readonly: boolean; - readonly readyState: string; - readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; - clone(): MediaStreamTrack; - getCapabilities(): MediaTrackCapabilities; - getConstraints(): MediaTrackConstraints; - getSettings(): MediaTrackSettings; - stop(): void; - addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStreamTrack: { - prototype: MediaStreamTrack; - new(): MediaStreamTrack; -} - -interface MediaStreamTrackEvent extends Event { - readonly track: MediaStreamTrack; -} - -declare var MediaStreamTrackEvent: { - prototype: MediaStreamTrackEvent; - new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePortEventMap { - "message": MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: MessagePort, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - readonly description: string; - readonly enabledPlugin: Plugin; - readonly suffixes: string; - readonly type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - readonly length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - readonly altKey: boolean; - readonly button: number; - readonly buttons: number; - readonly clientX: number; - readonly clientY: number; - readonly ctrlKey: boolean; - readonly fromElement: Element; - readonly layerX: number; - readonly layerY: number; - readonly metaKey: boolean; - readonly movementX: number; - readonly movementY: number; - readonly offsetX: number; - readonly offsetY: number; - readonly pageX: number; - readonly pageY: number; - readonly relatedTarget: EventTarget; - readonly screenX: number; - readonly screenY: number; - readonly shiftKey: boolean; - readonly toElement: Element; - readonly which: number; - readonly x: number; - readonly y: number; - getModifierState(keyArg: string): boolean; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MutationEvent extends Event { - readonly attrChange: number; - readonly attrName: string; - readonly newValue: string; - readonly prevValue: string; - readonly relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - readonly addedNodes: NodeList; - readonly attributeName: string | null; - readonly attributeNamespace: string | null; - readonly nextSibling: Node | null; - readonly oldValue: string | null; - readonly previousSibling: Node | null; - readonly removedNodes: NodeList; - readonly target: Node; - readonly type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - readonly length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - readonly isSuccess: boolean; - readonly webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - readonly uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - readonly referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { - readonly appCodeName: string; - readonly cookieEnabled: boolean; - readonly language: string; - readonly maxTouchPoints: number; - readonly mimeTypes: MimeTypeArray; - readonly msManipulationViewsEnabled: boolean; - readonly msMaxTouchPoints: number; - readonly msPointerEnabled: boolean; - readonly plugins: PluginArray; - readonly pointerEnabled: boolean; - readonly webdriver: boolean; - readonly hardwareConcurrency: number; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; - vibrate(pattern: number | number[]): boolean; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - readonly attributes: NamedNodeMap; - readonly baseURI: string | null; - readonly childNodes: NodeList; - readonly firstChild: Node | null; - readonly lastChild: Node | null; - readonly localName: string | null; - readonly namespaceURI: string | null; - readonly nextSibling: Node | null; - readonly nodeName: string; - readonly nodeType: number; - nodeValue: string | null; - readonly ownerDocument: Document; - readonly parentElement: HTMLElement | null; - readonly parentNode: Node | null; - readonly previousSibling: Node | null; - textContent: string | null; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - contains(child: Node): boolean; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; - isDefaultNamespace(namespaceURI: string | null): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string | null): string | null; - lookupPrefix(namespaceURI: string | null): string | null; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - readonly FILTER_ACCEPT: number; - readonly FILTER_REJECT: number; - readonly FILTER_SKIP: number; - readonly SHOW_ALL: number; - readonly SHOW_ATTRIBUTE: number; - readonly SHOW_CDATA_SECTION: number; - readonly SHOW_COMMENT: number; - readonly SHOW_DOCUMENT: number; - readonly SHOW_DOCUMENT_FRAGMENT: number; - readonly SHOW_DOCUMENT_TYPE: number; - readonly SHOW_ELEMENT: number; - readonly SHOW_ENTITY: number; - readonly SHOW_ENTITY_REFERENCE: number; - readonly SHOW_NOTATION: number; - readonly SHOW_PROCESSING_INSTRUCTION: number; - readonly SHOW_TEXT: number; -} - -interface NodeIterator { - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - readonly length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - readonly renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContextEventMap { - "complete": Event; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (this: OfflineAudioContext, ev: Event) => any; - startRendering(): PromiseLike; - addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNodeEventMap { - "ended": MediaStreamErrorEvent; -} - -interface OscillatorNode extends AudioNode { - readonly detune: AudioParam; - readonly frequency: AudioParam; - onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface OverflowEvent extends UIEvent { - readonly horizontalOverflow: boolean; - readonly orient: number; - readonly verticalOverflow: boolean; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -declare var OverflowEvent: { - prototype: OverflowEvent; - new(): OverflowEvent; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -interface PageTransitionEvent extends Event { - readonly persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - readonly activeNetworkRequestCount: number; - readonly averageFrameTime: number; - readonly averagePaintTime: number; - readonly extraInformationEnabled: boolean; - readonly independentRenderingEnabled: boolean; - readonly irDisablingContentString: string; - readonly irStatusAvailable: boolean; - readonly maxCpuSpeed: number; - readonly paintRequestsPerSecond: number; - readonly performanceCounter: number; - readonly performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number | null): any; - getRecentFrames(last: number | null): any; - getRecentMemoryUsage(last: number | null): any; - getRecentPaintRequests(last: number | null): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - readonly navigation: PerformanceNavigation; - readonly timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - readonly duration: number; - readonly entryType: string; - readonly name: string; - readonly startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - readonly redirectCount: number; - readonly type: number; - toJSON(): any; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly navigationStart: number; - readonly redirectCount: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly type: string; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly initiatorType: string; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly msFirstPaint: number; - readonly navigationStart: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; - readonly secureConnectionStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - readonly state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - readonly permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - readonly description: string; - readonly filename: string; - readonly length: number; - readonly name: string; - readonly version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - readonly length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - readonly state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - readonly target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface RTCDTMFToneChangeEvent extends Event { - readonly tone: string; -} - -declare var RTCDTMFToneChangeEvent: { - prototype: RTCDTMFToneChangeEvent; - new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; -} - -interface RTCDtlsTransportEventMap { - "dtlsstatechange": RTCDtlsTransportStateChangedEvent; - "error": ErrorEvent; -} - -interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null; - readonly state: string; - readonly transport: RTCIceTransport; - getLocalParameters(): RTCDtlsParameters; - getRemoteCertificates(): ArrayBuffer[]; - getRemoteParameters(): RTCDtlsParameters | null; - start(remoteParameters: RTCDtlsParameters): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtlsTransport: { - prototype: RTCDtlsTransport; - new(transport: RTCIceTransport): RTCDtlsTransport; -} - -interface RTCDtlsTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCDtlsTransportStateChangedEvent: { - prototype: RTCDtlsTransportStateChangedEvent; - new(): RTCDtlsTransportStateChangedEvent; -} - -interface RTCDtmfSenderEventMap { - "tonechange": RTCDTMFToneChangeEvent; -} - -interface RTCDtmfSender extends EventTarget { - readonly canInsertDTMF: boolean; - readonly duration: number; - readonly interToneGap: number; - ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; - readonly sender: RTCRtpSender; - readonly toneBuffer: string; - insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtmfSender: { - prototype: RTCDtmfSender; - new(sender: RTCRtpSender): RTCDtmfSender; -} - -interface RTCIceCandidatePairChangedEvent extends Event { - readonly pair: RTCIceCandidatePair; -} - -declare var RTCIceCandidatePairChangedEvent: { - prototype: RTCIceCandidatePairChangedEvent; - new(): RTCIceCandidatePairChangedEvent; -} - -interface RTCIceGathererEventMap { - "error": ErrorEvent; - "localcandidate": RTCIceGathererEvent; -} - -interface RTCIceGatherer extends RTCStatsProvider { - readonly component: string; - onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; - createAssociatedGatherer(): RTCIceGatherer; - getLocalCandidates(): RTCIceCandidate[]; - getLocalParameters(): RTCIceParameters; - addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceGatherer: { - prototype: RTCIceGatherer; - new(options: RTCIceGatherOptions): RTCIceGatherer; -} - -interface RTCIceGathererEvent extends Event { - readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; -} - -declare var RTCIceGathererEvent: { - prototype: RTCIceGathererEvent; - new(): RTCIceGathererEvent; -} - -interface RTCIceTransportEventMap { - "candidatepairchange": RTCIceCandidatePairChangedEvent; - "icestatechange": RTCIceTransportStateChangedEvent; -} - -interface RTCIceTransport extends RTCStatsProvider { - readonly component: string; - readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; - readonly role: string; - readonly state: string; - addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; - createAssociatedTransport(): RTCIceTransport; - getNominatedCandidatePair(): RTCIceCandidatePair | null; - getRemoteCandidates(): RTCIceCandidate[]; - getRemoteParameters(): RTCIceParameters | null; - setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; - start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceTransport: { - prototype: RTCIceTransport; - new(): RTCIceTransport; -} - -interface RTCIceTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCIceTransportStateChangedEvent: { - prototype: RTCIceTransportStateChangedEvent; - new(): RTCIceTransportStateChangedEvent; -} - -interface RTCRtpReceiverEventMap { - "error": ErrorEvent; -} - -interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack | null; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - getContributingSources(): RTCRtpContributingSource[]; - receive(parameters: RTCRtpParameters): void; - requestSendCSRC(csrc: number): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpReceiver: { - prototype: RTCRtpReceiver; - new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCRtpSenderEventMap { - "error": ErrorEvent; - "ssrcconflict": RTCSsrcConflictEvent; -} - -interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - send(parameters: RTCRtpParameters): void; - setTrack(track: MediaStreamTrack): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpSender: { - prototype: RTCRtpSender; - new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCSrtpSdesTransportEventMap { - "error": ErrorEvent; -} - -interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null; - readonly transport: RTCIceTransport; - addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCSrtpSdesTransport: { - prototype: RTCSrtpSdesTransport; - new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; - getLocalParameters(): RTCSrtpSdesParameters[]; -} - -interface RTCSsrcConflictEvent extends Event { - readonly ssrc: number; -} - -declare var RTCSsrcConflictEvent: { - prototype: RTCSsrcConflictEvent; - new(): RTCSsrcConflictEvent; -} - -interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; -} - -declare var RTCStatsProvider: { - prototype: RTCStatsProvider; - new(): RTCStatsProvider; -} - -interface Range { - readonly collapsed: boolean; - readonly commonAncestorContainer: Node; - readonly endContainer: Node; - readonly endOffset: number; - readonly startContainer: Node; - readonly startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly target: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - readonly animVal: SVGAngle; - readonly baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - readonly animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - readonly animVal: SVGLength; - readonly baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - readonly animVal: SVGLengthList; - readonly baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - readonly animVal: SVGNumberList; - readonly baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - readonly animVal: SVGPreserveAspectRatio; - readonly baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - readonly animVal: SVGRect; - readonly baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - readonly animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - readonly animVal: SVGTransformList; - readonly baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - readonly amplitude: SVGAnimatedNumber; - readonly exponent: SVGAnimatedNumber; - readonly intercept: SVGAnimatedNumber; - readonly offset: SVGAnimatedNumber; - readonly slope: SVGAnimatedNumber; - readonly tableValues: SVGAnimatedNumberList; - readonly type: SVGAnimatedEnumeration; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElementEventMap extends ElementEventMap { - "click": MouseEvent; - "dblclick": MouseEvent; - "focusin": FocusEvent; - "focusout": FocusEvent; - "load": Event; - "mousedown": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; -} - -interface SVGElement extends Element { - onclick: (this: SVGElement, ev: MouseEvent) => any; - ondblclick: (this: SVGElement, ev: MouseEvent) => any; - onfocusin: (this: SVGElement, ev: FocusEvent) => any; - onfocusout: (this: SVGElement, ev: FocusEvent) => any; - onload: (this: SVGElement, ev: Event) => any; - onmousedown: (this: SVGElement, ev: MouseEvent) => any; - onmousemove: (this: SVGElement, ev: MouseEvent) => any; - onmouseout: (this: SVGElement, ev: MouseEvent) => any; - onmouseover: (this: SVGElement, ev: MouseEvent) => any; - onmouseup: (this: SVGElement, ev: MouseEvent) => any; - readonly ownerSVGElement: SVGSVGElement; - readonly viewportElement: SVGElement; - xmlbase: string; - className: any; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - readonly childNodes: SVGElementInstanceList; - readonly correspondingElement: SVGElement; - readonly correspondingUseElement: SVGUseElement; - readonly firstChild: SVGElementInstance; - readonly lastChild: SVGElementInstance; - readonly nextSibling: SVGElementInstance; - readonly parentNode: SVGElementInstance; - readonly previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - readonly length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly mode: SVGAnimatedEnumeration; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly type: SVGAnimatedEnumeration; - readonly values: SVGAnimatedNumberList; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly k1: SVGAnimatedNumber; - readonly k2: SVGAnimatedNumber; - readonly k3: SVGAnimatedNumber; - readonly k4: SVGAnimatedNumber; - readonly operator: SVGAnimatedEnumeration; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly bias: SVGAnimatedNumber; - readonly divisor: SVGAnimatedNumber; - readonly edgeMode: SVGAnimatedEnumeration; - readonly in1: SVGAnimatedString; - readonly kernelMatrix: SVGAnimatedNumberList; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly orderX: SVGAnimatedInteger; - readonly orderY: SVGAnimatedInteger; - readonly preserveAlpha: SVGAnimatedBoolean; - readonly targetX: SVGAnimatedInteger; - readonly targetY: SVGAnimatedInteger; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly diffuseConstant: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly scale: SVGAnimatedNumber; - readonly xChannelSelector: SVGAnimatedEnumeration; - readonly yChannelSelector: SVGAnimatedEnumeration; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - readonly azimuth: SVGAnimatedNumber; - readonly elevation: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly stdDeviationX: SVGAnimatedNumber; - readonly stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly operator: SVGAnimatedEnumeration; - readonly radiusX: SVGAnimatedNumber; - readonly radiusY: SVGAnimatedNumber; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly dx: SVGAnimatedNumber; - readonly dy: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly specularConstant: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - readonly limitingConeAngle: SVGAnimatedNumber; - readonly pointsAtX: SVGAnimatedNumber; - readonly pointsAtY: SVGAnimatedNumber; - readonly pointsAtZ: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly baseFrequencyX: SVGAnimatedNumber; - readonly baseFrequencyY: SVGAnimatedNumber; - readonly numOctaves: SVGAnimatedInteger; - readonly seed: SVGAnimatedNumber; - readonly stitchTiles: SVGAnimatedEnumeration; - readonly type: SVGAnimatedEnumeration; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly filterResX: SVGAnimatedInteger; - readonly filterResY: SVGAnimatedInteger; - readonly filterUnits: SVGAnimatedEnumeration; - readonly height: SVGAnimatedLength; - readonly primitiveUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - readonly gradientTransform: SVGAnimatedTransformList; - readonly gradientUnits: SVGAnimatedEnumeration; - readonly spreadMethod: SVGAnimatedEnumeration; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly height: SVGAnimatedLength; - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - readonly numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - readonly markerHeight: SVGAnimatedLength; - readonly markerUnits: SVGAnimatedEnumeration; - readonly markerWidth: SVGAnimatedLength; - readonly orientAngle: SVGAnimatedAngle; - readonly orientType: SVGAnimatedEnumeration; - readonly refX: SVGAnimatedLength; - readonly refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly maskContentUnits: SVGAnimatedEnumeration; - readonly maskUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - readonly numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - readonly pathSegType: number; - readonly pathSegTypeAsLetter: string; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - readonly numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly patternContentUnits: SVGAnimatedEnumeration; - readonly patternTransform: SVGAnimatedTransformList; - readonly patternUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - readonly numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly fx: SVGAnimatedLength; - readonly fy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElementEventMap extends SVGElementEventMap { - "SVGAbort": Event; - "SVGError": Event; - "resize": UIEvent; - "scroll": UIEvent; - "SVGUnload": Event; - "SVGZoom": SVGZoomEvent; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - readonly currentTranslate: SVGPoint; - readonly height: SVGAnimatedLength; - onabort: (this: SVGSVGElement, ev: Event) => any; - onerror: (this: SVGSVGElement, ev: Event) => any; - onresize: (this: SVGSVGElement, ev: UIEvent) => any; - onscroll: (this: SVGSVGElement, ev: UIEvent) => any; - onunload: (this: SVGSVGElement, ev: Event) => any; - onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; - readonly pixelUnitToMillimeterX: number; - readonly pixelUnitToMillimeterY: number; - readonly screenPixelToMillimeterX: number; - readonly screenPixelToMillimeterY: number; - readonly viewport: SVGRect; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): void; - addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - readonly offset: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - readonly numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - disabled: boolean; - media: string; - title: string; - type: string; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly lengthAdjust: SVGAnimatedEnumeration; - readonly textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - readonly method: SVGAnimatedEnumeration; - readonly spacing: SVGAnimatedEnumeration; - readonly startOffset: SVGAnimatedLength; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - readonly dx: SVGAnimatedLengthList; - readonly dy: SVGAnimatedLengthList; - readonly rotate: SVGAnimatedNumberList; - readonly x: SVGAnimatedLengthList; - readonly y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - readonly angle: number; - readonly matrix: SVGMatrix; - readonly type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - readonly numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - readonly SVG_UNIT_TYPE_UNKNOWN: number; - readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly animatedInstanceRoot: SVGElementInstance; - readonly height: SVGAnimatedLength; - readonly instanceRoot: SVGElementInstance; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - readonly viewTarget: SVGStringList; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - readonly zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - readonly SVG_ZOOMANDPAN_DISABLE: number; - readonly SVG_ZOOMANDPAN_MAGNIFY: number; - readonly SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - readonly newScale: number; - readonly newTranslate: SVGPoint; - readonly previousScale: number; - readonly previousTranslate: SVGPoint; - readonly zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface ScreenEventMap { - "MSOrientationChange": Event; -} - -interface Screen extends EventTarget { - readonly availHeight: number; - readonly availWidth: number; - bufferDepth: number; - readonly colorDepth: number; - readonly deviceXDPI: number; - readonly deviceYDPI: number; - readonly fontSmoothingEnabled: boolean; - readonly height: number; - readonly logicalXDPI: number; - readonly logicalYDPI: number; - readonly msOrientation: string; - onmsorientationchange: (this: Screen, ev: Event) => any; - readonly pixelDepth: number; - readonly systemXDPI: number; - readonly systemYDPI: number; - readonly width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - readonly callingUri: string; - readonly value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNodeEventMap { - "audioprocess": AudioProcessingEvent; -} - -interface ScriptProcessorNode extends AudioNode { - readonly bufferSize: number; - onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; - addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - readonly anchorNode: Node; - readonly anchorOffset: number; - readonly focusNode: Node; - readonly focusOffset: number; - readonly isCollapsed: boolean; - readonly rangeCount: number; - readonly type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - readonly audioTracks: AudioTrackList; - readonly buffered: TimeRanges; - mode: string; - timestampOffset: number; - readonly updating: boolean; - readonly videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - readonly length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - readonly pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - readonly length: number; - clear(): void; - getItem(key: string): string | null; - key(index: number): string | null; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - readonly url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - readonly type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - readonly href: string; - readonly media: MediaList; - readonly ownerNode: Node; - readonly parentStyleSheet: StyleSheet; - readonly title: string; - readonly type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - readonly length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - readonly length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; - deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; - encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - exportKey(format: "jwk", key: CryptoKey): PromiseLike; - exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; - exportKey(format: string, key: CryptoKey): PromiseLike; - generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; - unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; - verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - readonly wholeText: string; - readonly assignedSlot: HTMLSlotElement | null; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - readonly data: string; - readonly inputMethod: number; - readonly locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - readonly width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextTrackEventMap { - "cuechange": Event; - "error": ErrorEvent; - "load": Event; -} - -interface TextTrack extends EventTarget { - readonly activeCues: TextTrackCueList; - readonly cues: TextTrackCueList; - readonly inBandMetadataTrackDispatchType: string; - readonly kind: string; - readonly label: string; - readonly language: string; - mode: any; - oncuechange: (this: TextTrack, ev: Event) => any; - onerror: (this: TextTrack, ev: ErrorEvent) => any; - onload: (this: TextTrack, ev: Event) => any; - readonly readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; - addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; -} - -interface TextTrackCueEventMap { - "enter": Event; - "exit": Event; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (this: TextTrackCue, ev: Event) => any; - onexit: (this: TextTrackCue, ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - readonly track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - readonly length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackListEventMap { - "addtrack": TrackEvent; -} - -interface TextTrackList extends EventTarget { - readonly length: number; - onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; - item(index: number): TextTrack; - addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - readonly length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - readonly clientX: number; - readonly clientY: number; - readonly identifier: number; - readonly pageX: number; - readonly pageY: number; - readonly screenX: number; - readonly screenY: number; - readonly target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - readonly altKey: boolean; - readonly changedTouches: TouchList; - readonly ctrlKey: boolean; - readonly metaKey: boolean; - readonly shiftKey: boolean; - readonly targetTouches: TouchList; - readonly touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - readonly length: number; - item(index: number): Touch | null; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - readonly track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - readonly elapsedTime: number; - readonly propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - readonly detail: number; - readonly view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - toString(): string; -} - -declare var URL: { - prototype: URL; - new(url: string, base?: string): URL; - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - readonly mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - readonly badInput: boolean; - readonly customError: boolean; - readonly patternMismatch: boolean; - readonly rangeOverflow: boolean; - readonly rangeUnderflow: boolean; - readonly stepMismatch: boolean; - readonly tooLong: boolean; - readonly typeMismatch: boolean; - readonly valid: boolean; - readonly valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - readonly corruptedVideoFrames: number; - readonly creationTime: number; - readonly droppedVideoFrames: number; - readonly totalFrameDelay: number; - readonly totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - readonly id: string; - kind: string; - readonly label: string; - language: string; - selected: boolean; - readonly sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackListEventMap { - "addtrack": TrackEvent; - "change": Event; - "removetrack": TrackEvent; -} - -interface VideoTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; - onchange: (this: VideoTrackList, ev: Event) => any; - onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; - readonly selectedIndex: number; - getTrackById(id: string): VideoTrack | null; - item(index: number): VideoTrack; - addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array | null; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - readonly name: string; - readonly size: number; - readonly type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - readonly statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - readonly canvas: HTMLCanvasElement; - readonly drawingBufferHeight: number; - readonly drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer | null): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; - bindTexture(target: number, texture: WebGLTexture | null): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader | null): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer | null; - createFramebuffer(): WebGLFramebuffer | null; - createProgram(): WebGLProgram | null; - createRenderbuffer(): WebGLRenderbuffer | null; - createShader(type: number): WebGLShader | null; - createTexture(): WebGLTexture | null; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer | null): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; - deleteProgram(program: WebGLProgram | null): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; - deleteShader(shader: WebGLShader | null): void; - deleteTexture(texture: WebGLTexture | null): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; - getAttribLocation(program: WebGLProgram | null, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram | null): string | null; - getProgramParameter(program: WebGLProgram | null, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader | null): string | null; - getShaderParameter(shader: WebGLShader | null, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; - getShaderSource(shader: WebGLShader | null): string | null; - getSupportedExtensions(): string[] | null; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; - getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer | null): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; - isProgram(program: WebGLProgram | null): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; - isShader(shader: WebGLShader | null): boolean; - isTexture(texture: WebGLTexture | null): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram | null): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader | null, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - useProgram(program: WebGLProgram | null): void; - validateProgram(program: WebGLProgram | null): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - readonly precision: number; - readonly rangeMax: number; - readonly rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocketEventMap { - "close": CloseEvent; - "error": ErrorEvent; - "message": MessageEvent; - "open": Event; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: WebSocket, ev: CloseEvent) => any; - onerror: (this: WebSocket, ev: ErrorEvent) => any; - onmessage: (this: WebSocket, ev: MessageEvent) => any; - onopen: (this: WebSocket, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WheelEvent extends MouseEvent { - readonly deltaMode: number; - readonly deltaX: number; - readonly deltaY: number; - readonly deltaZ: number; - readonly wheelDelta: number; - readonly wheelDeltaX: number; - readonly wheelDeltaY: number; - getCurrentPoint(element: Element): void; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -interface WindowEventMap extends GlobalEventHandlersEventMap { - "abort": UIEvent; - "afterprint": Event; - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "compassneedscalibration": Event; - "contextmenu": PointerEvent; - "dblclick": MouseEvent; - "devicelight": DeviceLightEvent; - "devicemotion": DeviceMotionEvent; - "deviceorientation": DeviceOrientationEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "message": MessageEvent; - "mousedown": MouseEvent; - "mouseenter": MouseEvent; - "mouseleave": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSInertiaStart": MSGestureEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "pause": Event; - "play": Event; - "playing": Event; - "popstate": PopStateEvent; - "progress": ProgressEvent; - "ratechange": Event; - "readystatechange": ProgressEvent; - "reset": Event; - "resize": UIEvent; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "stalled": Event; - "storage": StorageEvent; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "unload": Event; - "volumechange": Event; - "waiting": Event; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - readonly applicationCache: ApplicationCache; - readonly clientInformation: Navigator; - readonly closed: boolean; - readonly crypto: Crypto; - defaultStatus: string; - readonly devicePixelRatio: number; - readonly doNotTrack: string; - readonly document: Document; - event: Event | undefined; - readonly external: External; - readonly frameElement: Element; - readonly frames: Window; - readonly history: History; - readonly innerHeight: number; - readonly innerWidth: number; - readonly length: number; - readonly location: Location; - readonly locationbar: BarProp; - readonly menubar: BarProp; - readonly msCredentials: MSCredentials; - name: string; - readonly navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (this: Window, ev: UIEvent) => any; - onafterprint: (this: Window, ev: Event) => any; - onbeforeprint: (this: Window, ev: Event) => any; - onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; - onblur: (this: Window, ev: FocusEvent) => any; - oncanplay: (this: Window, ev: Event) => any; - oncanplaythrough: (this: Window, ev: Event) => any; - onchange: (this: Window, ev: Event) => any; - onclick: (this: Window, ev: MouseEvent) => any; - oncompassneedscalibration: (this: Window, ev: Event) => any; - oncontextmenu: (this: Window, ev: PointerEvent) => any; - ondblclick: (this: Window, ev: MouseEvent) => any; - ondevicelight: (this: Window, ev: DeviceLightEvent) => any; - ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; - ondrag: (this: Window, ev: DragEvent) => any; - ondragend: (this: Window, ev: DragEvent) => any; - ondragenter: (this: Window, ev: DragEvent) => any; - ondragleave: (this: Window, ev: DragEvent) => any; - ondragover: (this: Window, ev: DragEvent) => any; - ondragstart: (this: Window, ev: DragEvent) => any; - ondrop: (this: Window, ev: DragEvent) => any; - ondurationchange: (this: Window, ev: Event) => any; - onemptied: (this: Window, ev: Event) => any; - onended: (this: Window, ev: MediaStreamErrorEvent) => any; - onerror: ErrorEventHandler; - onfocus: (this: Window, ev: FocusEvent) => any; - onhashchange: (this: Window, ev: HashChangeEvent) => any; - oninput: (this: Window, ev: Event) => any; - oninvalid: (this: Window, ev: Event) => any; - onkeydown: (this: Window, ev: KeyboardEvent) => any; - onkeypress: (this: Window, ev: KeyboardEvent) => any; - onkeyup: (this: Window, ev: KeyboardEvent) => any; - onload: (this: Window, ev: Event) => any; - onloadeddata: (this: Window, ev: Event) => any; - onloadedmetadata: (this: Window, ev: Event) => any; - onloadstart: (this: Window, ev: Event) => any; - onmessage: (this: Window, ev: MessageEvent) => any; - onmousedown: (this: Window, ev: MouseEvent) => any; - onmouseenter: (this: Window, ev: MouseEvent) => any; - onmouseleave: (this: Window, ev: MouseEvent) => any; - onmousemove: (this: Window, ev: MouseEvent) => any; - onmouseout: (this: Window, ev: MouseEvent) => any; - onmouseover: (this: Window, ev: MouseEvent) => any; - onmouseup: (this: Window, ev: MouseEvent) => any; - onmousewheel: (this: Window, ev: WheelEvent) => any; - onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; - onmsgestureend: (this: Window, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; - onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; - onmspointercancel: (this: Window, ev: MSPointerEvent) => any; - onmspointerdown: (this: Window, ev: MSPointerEvent) => any; - onmspointerenter: (this: Window, ev: MSPointerEvent) => any; - onmspointerleave: (this: Window, ev: MSPointerEvent) => any; - onmspointermove: (this: Window, ev: MSPointerEvent) => any; - onmspointerout: (this: Window, ev: MSPointerEvent) => any; - onmspointerover: (this: Window, ev: MSPointerEvent) => any; - onmspointerup: (this: Window, ev: MSPointerEvent) => any; - onoffline: (this: Window, ev: Event) => any; - ononline: (this: Window, ev: Event) => any; - onorientationchange: (this: Window, ev: Event) => any; - onpagehide: (this: Window, ev: PageTransitionEvent) => any; - onpageshow: (this: Window, ev: PageTransitionEvent) => any; - onpause: (this: Window, ev: Event) => any; - onplay: (this: Window, ev: Event) => any; - onplaying: (this: Window, ev: Event) => any; - onpopstate: (this: Window, ev: PopStateEvent) => any; - onprogress: (this: Window, ev: ProgressEvent) => any; - onratechange: (this: Window, ev: Event) => any; - onreadystatechange: (this: Window, ev: ProgressEvent) => any; - onreset: (this: Window, ev: Event) => any; - onresize: (this: Window, ev: UIEvent) => any; - onscroll: (this: Window, ev: UIEvent) => any; - onseeked: (this: Window, ev: Event) => any; - onseeking: (this: Window, ev: Event) => any; - onselect: (this: Window, ev: UIEvent) => any; - onstalled: (this: Window, ev: Event) => any; - onstorage: (this: Window, ev: StorageEvent) => any; - onsubmit: (this: Window, ev: Event) => any; - onsuspend: (this: Window, ev: Event) => any; - ontimeupdate: (this: Window, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onunload: (this: Window, ev: Event) => any; - onvolumechange: (this: Window, ev: Event) => any; - onwaiting: (this: Window, ev: Event) => any; - opener: any; - orientation: string | number; - readonly outerHeight: number; - readonly outerWidth: number; - readonly pageXOffset: number; - readonly pageYOffset: number; - readonly parent: Window; - readonly performance: Performance; - readonly personalbar: BarProp; - readonly screen: Screen; - readonly screenLeft: number; - readonly screenTop: number; - readonly screenX: number; - readonly screenY: number; - readonly scrollX: number; - readonly scrollY: number; - readonly scrollbars: BarProp; - readonly self: Window; - status: string; - readonly statusbar: BarProp; - readonly styleMedia: StyleMedia; - readonly toolbar: BarProp; - readonly top: Window; - readonly window: Window; - URL: typeof URL; - Blob: typeof Blob; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, transfer?: any[]): void; - print(): void; - prompt(message?: string, _default?: string): string | null; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitCancelAnimationFrame(handle: number): void; - webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; - webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; - webkitRequestAnimationFrame(callback: FrameRequestCallback): number; - scroll(options?: ScrollToOptions): void; - scrollTo(options?: ScrollToOptions): void; - scrollBy(options?: ScrollToOptions): void; - addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface WorkerEventMap extends AbstractWorkerEventMap { - "message": MessageEvent; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: Worker, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { - "readystatechange": Event; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - readonly booleanValue: boolean; - readonly invalidIteratorState: boolean; - readonly numberValue: number; - readonly resultType: number; - readonly singleNodeValue: Node; - readonly snapshotLength: number; - readonly stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorkerEventMap { - "error": ErrorEvent; -} - -interface AbstractWorker { - onerror: (this: AbstractWorker, ev: ErrorEvent) => any; - addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface CanvasPathMethods { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"OverflowEvent"): OverflowEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - readonly childElementCount: number; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly nextElementSibling: Element; - readonly previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlersEventMap { - "pointercancel": PointerEvent; - "pointerdown": PointerEvent; - "pointerenter": PointerEvent; - "pointerleave": PointerEvent; - "pointermove": PointerEvent; - "pointerout": PointerEvent; - "pointerover": PointerEvent; - "pointerup": PointerEvent; - "wheel": WheelEvent; -} - -interface GlobalEventHandlers { - onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; - addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - readonly indexedDB: IDBFactory; -} - -interface LinkStyle { - readonly sheet: StyleSheet; -} - -interface MSBaseReaderEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; -} - -interface MSBaseReader { - onabort: (this: MSBaseReader, ev: Event) => any; - onerror: (this: MSBaseReader, ev: ErrorEvent) => any; - onload: (this: MSBaseReader, ev: Event) => any; - onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; - onloadstart: (this: MSBaseReader, ev: Event) => any; - onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: number; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - readonly geolocation: Geolocation; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NavigatorUserMedia { - readonly mediaDevices: MediaDevices; - getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; -} - -interface NodeSelector { - querySelector(selectors: K): ElementTagNameMap[K] | null; - querySelector(selectors: string): Element | null; - querySelectorAll(selectors: K): ElementListTagNameMap[K]; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - readonly pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - readonly animatedPoints: SVGPointList; - readonly points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - readonly externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - readonly height: SVGAnimatedLength; - readonly result: SVGAnimatedString; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - readonly farthestViewportElement: SVGElement; - readonly nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - readonly style: CSSStyleDeclaration; -} - -interface SVGTests { - readonly requiredExtensions: SVGStringList; - readonly requiredFeatures: SVGStringList; - readonly systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - readonly transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - readonly href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface WindowLocalStorage { - readonly localStorage: Storage; -} - -interface WindowSessionStorage { - readonly sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTargetEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; - "timeout": ProgressEvent; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; - onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface Canvas2DContextAttributes { - alpha?: boolean; - willReadFrequently?: boolean; - storage?: boolean; - [attribute: string]: boolean | string | undefined; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface HTMLCollectionOf extends HTMLCollection { - item(index: number): T; - namedItem(name: string): T; - [index: number]: T; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface ScrollOptions { - behavior?: ScrollBehavior; -} - -interface ScrollToOptions extends ScrollOptions { - left?: number; - top?: number; -} - -interface ScrollIntoViewOptions extends ScrollOptions { - block?: ScrollLogicalPosition; - inline?: ScrollLogicalPosition; -} - -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -interface ParentNode { - readonly children: HTMLCollection; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly childElementCount: number; -} - -interface DocumentOrShadowRoot { - readonly activeElement: Element | null; - readonly stylesheets: StyleSheetList; - getSelection(): Selection | null; - elementFromPoint(x: number, y: number): Element | null; - elementsFromPoint(x: number, y: number): Element[]; -} - -interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { - readonly host: Element; - innerHTML: string; -} - -interface ShadowRootInit { - mode: 'open'|'closed'; - delegatesFocus?: boolean; -} - -interface HTMLSlotElement extends HTMLElement { - name: string; - assignedNodes(options?: AssignedNodesOptions): Node[]; -} - -interface AssignedNodesOptions { - flatten?: boolean; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -interface NavigatorUserMediaSuccessCallback { - (stream: MediaStream): void; -} -interface NavigatorUserMediaErrorCallback { - (error: MediaStreamError): void; -} -interface ForEachCallback { - (keyId: any, status: string): void; -} -interface HTMLElementTagNameMap { - "a": HTMLAnchorElement; - "applet": HTMLAppletElement; - "area": HTMLAreaElement; - "audio": HTMLAudioElement; - "base": HTMLBaseElement; - "basefont": HTMLBaseFontElement; - "blockquote": HTMLQuoteElement; - "body": HTMLBodyElement; - "br": HTMLBRElement; - "button": HTMLButtonElement; - "canvas": HTMLCanvasElement; - "caption": HTMLTableCaptionElement; - "col": HTMLTableColElement; - "colgroup": HTMLTableColElement; - "datalist": HTMLDataListElement; - "del": HTMLModElement; - "dir": HTMLDirectoryElement; - "div": HTMLDivElement; - "dl": HTMLDListElement; - "embed": HTMLEmbedElement; - "fieldset": HTMLFieldSetElement; - "font": HTMLFontElement; - "form": HTMLFormElement; - "frame": HTMLFrameElement; - "frameset": HTMLFrameSetElement; - "h1": HTMLHeadingElement; - "h2": HTMLHeadingElement; - "h3": HTMLHeadingElement; - "h4": HTMLHeadingElement; - "h5": HTMLHeadingElement; - "h6": HTMLHeadingElement; - "head": HTMLHeadElement; - "hr": HTMLHRElement; - "html": HTMLHtmlElement; - "iframe": HTMLIFrameElement; - "img": HTMLImageElement; - "input": HTMLInputElement; - "ins": HTMLModElement; - "isindex": HTMLUnknownElement; - "label": HTMLLabelElement; - "legend": HTMLLegendElement; - "li": HTMLLIElement; - "link": HTMLLinkElement; - "listing": HTMLPreElement; - "map": HTMLMapElement; - "marquee": HTMLMarqueeElement; - "menu": HTMLMenuElement; - "meta": HTMLMetaElement; - "meter": HTMLMeterElement; - "nextid": HTMLUnknownElement; - "object": HTMLObjectElement; - "ol": HTMLOListElement; - "optgroup": HTMLOptGroupElement; - "option": HTMLOptionElement; - "p": HTMLParagraphElement; - "param": HTMLParamElement; - "picture": HTMLPictureElement; - "pre": HTMLPreElement; - "progress": HTMLProgressElement; - "q": HTMLQuoteElement; - "script": HTMLScriptElement; - "select": HTMLSelectElement; - "source": HTMLSourceElement; - "span": HTMLSpanElement; - "style": HTMLStyleElement; - "table": HTMLTableElement; - "tbody": HTMLTableSectionElement; - "td": HTMLTableDataCellElement; - "template": HTMLTemplateElement; - "textarea": HTMLTextAreaElement; - "tfoot": HTMLTableSectionElement; - "th": HTMLTableHeaderCellElement; - "thead": HTMLTableSectionElement; - "title": HTMLTitleElement; - "tr": HTMLTableRowElement; - "track": HTMLTrackElement; - "ul": HTMLUListElement; - "video": HTMLVideoElement; - "x-ms-webview": MSHTMLWebViewElement; - "xmp": HTMLPreElement; -} - -interface ElementTagNameMap { - "a": HTMLAnchorElement; - "abbr": HTMLElement; - "acronym": HTMLElement; - "address": HTMLElement; - "applet": HTMLAppletElement; - "area": HTMLAreaElement; - "article": HTMLElement; - "aside": HTMLElement; - "audio": HTMLAudioElement; - "b": HTMLElement; - "base": HTMLBaseElement; - "basefont": HTMLBaseFontElement; - "bdo": HTMLElement; - "big": HTMLElement; - "blockquote": HTMLQuoteElement; - "body": HTMLBodyElement; - "br": HTMLBRElement; - "button": HTMLButtonElement; - "canvas": HTMLCanvasElement; - "caption": HTMLTableCaptionElement; - "center": HTMLElement; - "circle": SVGCircleElement; - "cite": HTMLElement; - "clippath": SVGClipPathElement; - "code": HTMLElement; - "col": HTMLTableColElement; - "colgroup": HTMLTableColElement; - "datalist": HTMLDataListElement; - "dd": HTMLElement; - "defs": SVGDefsElement; - "del": HTMLModElement; - "desc": SVGDescElement; - "dfn": HTMLElement; - "dir": HTMLDirectoryElement; - "div": HTMLDivElement; - "dl": HTMLDListElement; - "dt": HTMLElement; - "ellipse": SVGEllipseElement; - "em": HTMLElement; - "embed": HTMLEmbedElement; - "feblend": SVGFEBlendElement; - "fecolormatrix": SVGFEColorMatrixElement; - "fecomponenttransfer": SVGFEComponentTransferElement; - "fecomposite": SVGFECompositeElement; - "feconvolvematrix": SVGFEConvolveMatrixElement; - "fediffuselighting": SVGFEDiffuseLightingElement; - "fedisplacementmap": SVGFEDisplacementMapElement; - "fedistantlight": SVGFEDistantLightElement; - "feflood": SVGFEFloodElement; - "fefunca": SVGFEFuncAElement; - "fefuncb": SVGFEFuncBElement; - "fefuncg": SVGFEFuncGElement; - "fefuncr": SVGFEFuncRElement; - "fegaussianblur": SVGFEGaussianBlurElement; - "feimage": SVGFEImageElement; - "femerge": SVGFEMergeElement; - "femergenode": SVGFEMergeNodeElement; - "femorphology": SVGFEMorphologyElement; - "feoffset": SVGFEOffsetElement; - "fepointlight": SVGFEPointLightElement; - "fespecularlighting": SVGFESpecularLightingElement; - "fespotlight": SVGFESpotLightElement; - "fetile": SVGFETileElement; - "feturbulence": SVGFETurbulenceElement; - "fieldset": HTMLFieldSetElement; - "figcaption": HTMLElement; - "figure": HTMLElement; - "filter": SVGFilterElement; - "font": HTMLFontElement; - "footer": HTMLElement; - "foreignobject": SVGForeignObjectElement; - "form": HTMLFormElement; - "frame": HTMLFrameElement; - "frameset": HTMLFrameSetElement; - "g": SVGGElement; - "h1": HTMLHeadingElement; - "h2": HTMLHeadingElement; - "h3": HTMLHeadingElement; - "h4": HTMLHeadingElement; - "h5": HTMLHeadingElement; - "h6": HTMLHeadingElement; - "head": HTMLHeadElement; - "header": HTMLElement; - "hgroup": HTMLElement; - "hr": HTMLHRElement; - "html": HTMLHtmlElement; - "i": HTMLElement; - "iframe": HTMLIFrameElement; - "image": SVGImageElement; - "img": HTMLImageElement; - "input": HTMLInputElement; - "ins": HTMLModElement; - "isindex": HTMLUnknownElement; - "kbd": HTMLElement; - "keygen": HTMLElement; - "label": HTMLLabelElement; - "legend": HTMLLegendElement; - "li": HTMLLIElement; - "line": SVGLineElement; - "lineargradient": SVGLinearGradientElement; - "link": HTMLLinkElement; - "listing": HTMLPreElement; - "map": HTMLMapElement; - "mark": HTMLElement; - "marker": SVGMarkerElement; - "marquee": HTMLMarqueeElement; - "mask": SVGMaskElement; - "menu": HTMLMenuElement; - "meta": HTMLMetaElement; - "metadata": SVGMetadataElement; - "meter": HTMLMeterElement; - "nav": HTMLElement; - "nextid": HTMLUnknownElement; - "nobr": HTMLElement; - "noframes": HTMLElement; - "noscript": HTMLElement; - "object": HTMLObjectElement; - "ol": HTMLOListElement; - "optgroup": HTMLOptGroupElement; - "option": HTMLOptionElement; - "p": HTMLParagraphElement; - "param": HTMLParamElement; - "path": SVGPathElement; - "pattern": SVGPatternElement; - "picture": HTMLPictureElement; - "plaintext": HTMLElement; - "polygon": SVGPolygonElement; - "polyline": SVGPolylineElement; - "pre": HTMLPreElement; - "progress": HTMLProgressElement; - "q": HTMLQuoteElement; - "radialgradient": SVGRadialGradientElement; - "rect": SVGRectElement; - "rt": HTMLElement; - "ruby": HTMLElement; - "s": HTMLElement; - "samp": HTMLElement; - "script": HTMLScriptElement; - "section": HTMLElement; - "select": HTMLSelectElement; - "small": HTMLElement; - "source": HTMLSourceElement; - "span": HTMLSpanElement; - "stop": SVGStopElement; - "strike": HTMLElement; - "strong": HTMLElement; - "style": HTMLStyleElement; - "sub": HTMLElement; - "sup": HTMLElement; - "svg": SVGSVGElement; - "switch": SVGSwitchElement; - "symbol": SVGSymbolElement; - "table": HTMLTableElement; - "tbody": HTMLTableSectionElement; - "td": HTMLTableDataCellElement; - "template": HTMLTemplateElement; - "text": SVGTextElement; - "textpath": SVGTextPathElement; - "textarea": HTMLTextAreaElement; - "tfoot": HTMLTableSectionElement; - "th": HTMLTableHeaderCellElement; - "thead": HTMLTableSectionElement; - "title": HTMLTitleElement; - "tr": HTMLTableRowElement; - "track": HTMLTrackElement; - "tspan": SVGTSpanElement; - "tt": HTMLElement; - "u": HTMLElement; - "ul": HTMLUListElement; - "use": SVGUseElement; - "var": HTMLElement; - "video": HTMLVideoElement; - "view": SVGViewElement; - "wbr": HTMLElement; - "x-ms-webview": MSHTMLWebViewElement; - "xmp": HTMLPreElement; -} - -interface ElementListTagNameMap { - "a": NodeListOf; - "abbr": NodeListOf; - "acronym": NodeListOf; - "address": NodeListOf; - "applet": NodeListOf; - "area": NodeListOf; - "article": NodeListOf; - "aside": NodeListOf; - "audio": NodeListOf; - "b": NodeListOf; - "base": NodeListOf; - "basefont": NodeListOf; - "bdo": NodeListOf; - "big": NodeListOf; - "blockquote": NodeListOf; - "body": NodeListOf; - "br": NodeListOf; - "button": NodeListOf; - "canvas": NodeListOf; - "caption": NodeListOf; - "center": NodeListOf; - "circle": NodeListOf; - "cite": NodeListOf; - "clippath": NodeListOf; - "code": NodeListOf; - "col": NodeListOf; - "colgroup": NodeListOf; - "datalist": NodeListOf; - "dd": NodeListOf; - "defs": NodeListOf; - "del": NodeListOf; - "desc": NodeListOf; - "dfn": NodeListOf; - "dir": NodeListOf; - "div": NodeListOf; - "dl": NodeListOf; - "dt": NodeListOf; - "ellipse": NodeListOf; - "em": NodeListOf; - "embed": NodeListOf; - "feblend": NodeListOf; - "fecolormatrix": NodeListOf; - "fecomponenttransfer": NodeListOf; - "fecomposite": NodeListOf; - "feconvolvematrix": NodeListOf; - "fediffuselighting": NodeListOf; - "fedisplacementmap": NodeListOf; - "fedistantlight": NodeListOf; - "feflood": NodeListOf; - "fefunca": NodeListOf; - "fefuncb": NodeListOf; - "fefuncg": NodeListOf; - "fefuncr": NodeListOf; - "fegaussianblur": NodeListOf; - "feimage": NodeListOf; - "femerge": NodeListOf; - "femergenode": NodeListOf; - "femorphology": NodeListOf; - "feoffset": NodeListOf; - "fepointlight": NodeListOf; - "fespecularlighting": NodeListOf; - "fespotlight": NodeListOf; - "fetile": NodeListOf; - "feturbulence": NodeListOf; - "fieldset": NodeListOf; - "figcaption": NodeListOf; - "figure": NodeListOf; - "filter": NodeListOf; - "font": NodeListOf; - "footer": NodeListOf; - "foreignobject": NodeListOf; - "form": NodeListOf; - "frame": NodeListOf; - "frameset": NodeListOf; - "g": NodeListOf; - "h1": NodeListOf; - "h2": NodeListOf; - "h3": NodeListOf; - "h4": NodeListOf; - "h5": NodeListOf; - "h6": NodeListOf; - "head": NodeListOf; - "header": NodeListOf; - "hgroup": NodeListOf; - "hr": NodeListOf; - "html": NodeListOf; - "i": NodeListOf; - "iframe": NodeListOf; - "image": NodeListOf; - "img": NodeListOf; - "input": NodeListOf; - "ins": NodeListOf; - "isindex": NodeListOf; - "kbd": NodeListOf; - "keygen": NodeListOf; - "label": NodeListOf; - "legend": NodeListOf; - "li": NodeListOf; - "line": NodeListOf; - "lineargradient": NodeListOf; - "link": NodeListOf; - "listing": NodeListOf; - "map": NodeListOf; - "mark": NodeListOf; - "marker": NodeListOf; - "marquee": NodeListOf; - "mask": NodeListOf; - "menu": NodeListOf; - "meta": NodeListOf; - "metadata": NodeListOf; - "meter": NodeListOf; - "nav": NodeListOf; - "nextid": NodeListOf; - "nobr": NodeListOf; - "noframes": NodeListOf; - "noscript": NodeListOf; - "object": NodeListOf; - "ol": NodeListOf; - "optgroup": NodeListOf; - "option": NodeListOf; - "p": NodeListOf; - "param": NodeListOf; - "path": NodeListOf; - "pattern": NodeListOf; - "picture": NodeListOf; - "plaintext": NodeListOf; - "polygon": NodeListOf; - "polyline": NodeListOf; - "pre": NodeListOf; - "progress": NodeListOf; - "q": NodeListOf; - "radialgradient": NodeListOf; - "rect": NodeListOf; - "rt": NodeListOf; - "ruby": NodeListOf; - "s": NodeListOf; - "samp": NodeListOf; - "script": NodeListOf; - "section": NodeListOf; - "select": NodeListOf; - "small": NodeListOf; - "source": NodeListOf; - "span": NodeListOf; - "stop": NodeListOf; - "strike": NodeListOf; - "strong": NodeListOf; - "style": NodeListOf; - "sub": NodeListOf; - "sup": NodeListOf; - "svg": NodeListOf; - "switch": NodeListOf; - "symbol": NodeListOf; - "table": NodeListOf; - "tbody": NodeListOf; - "td": NodeListOf; - "template": NodeListOf; - "text": NodeListOf; - "textpath": NodeListOf; - "textarea": NodeListOf; - "tfoot": NodeListOf; - "th": NodeListOf; - "thead": NodeListOf; - "title": NodeListOf; - "tr": NodeListOf; - "track": NodeListOf; - "tspan": NodeListOf; - "tt": NodeListOf; - "u": NodeListOf; - "ul": NodeListOf; - "use": NodeListOf; - "var": NodeListOf; - "video": NodeListOf; - "view": NodeListOf; - "wbr": NodeListOf; - "x-ms-webview": NodeListOf; - "xmp": NodeListOf; -} - -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event | undefined; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msCredentials: MSCredentials; -declare const name: never; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (this: Window, ev: UIEvent) => any; -declare var onafterprint: (this: Window, ev: Event) => any; -declare var onbeforeprint: (this: Window, ev: Event) => any; -declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; -declare var onblur: (this: Window, ev: FocusEvent) => any; -declare var oncanplay: (this: Window, ev: Event) => any; -declare var oncanplaythrough: (this: Window, ev: Event) => any; -declare var onchange: (this: Window, ev: Event) => any; -declare var onclick: (this: Window, ev: MouseEvent) => any; -declare var oncompassneedscalibration: (this: Window, ev: Event) => any; -declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; -declare var ondblclick: (this: Window, ev: MouseEvent) => any; -declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; -declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; -declare var ondrag: (this: Window, ev: DragEvent) => any; -declare var ondragend: (this: Window, ev: DragEvent) => any; -declare var ondragenter: (this: Window, ev: DragEvent) => any; -declare var ondragleave: (this: Window, ev: DragEvent) => any; -declare var ondragover: (this: Window, ev: DragEvent) => any; -declare var ondragstart: (this: Window, ev: DragEvent) => any; -declare var ondrop: (this: Window, ev: DragEvent) => any; -declare var ondurationchange: (this: Window, ev: Event) => any; -declare var onemptied: (this: Window, ev: Event) => any; -declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (this: Window, ev: FocusEvent) => any; -declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; -declare var oninput: (this: Window, ev: Event) => any; -declare var oninvalid: (this: Window, ev: Event) => any; -declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; -declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; -declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; -declare var onload: (this: Window, ev: Event) => any; -declare var onloadeddata: (this: Window, ev: Event) => any; -declare var onloadedmetadata: (this: Window, ev: Event) => any; -declare var onloadstart: (this: Window, ev: Event) => any; -declare var onmessage: (this: Window, ev: MessageEvent) => any; -declare var onmousedown: (this: Window, ev: MouseEvent) => any; -declare var onmouseenter: (this: Window, ev: MouseEvent) => any; -declare var onmouseleave: (this: Window, ev: MouseEvent) => any; -declare var onmousemove: (this: Window, ev: MouseEvent) => any; -declare var onmouseout: (this: Window, ev: MouseEvent) => any; -declare var onmouseover: (this: Window, ev: MouseEvent) => any; -declare var onmouseup: (this: Window, ev: MouseEvent) => any; -declare var onmousewheel: (this: Window, ev: WheelEvent) => any; -declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; -declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; -declare var onoffline: (this: Window, ev: Event) => any; -declare var ononline: (this: Window, ev: Event) => any; -declare var onorientationchange: (this: Window, ev: Event) => any; -declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; -declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; -declare var onpause: (this: Window, ev: Event) => any; -declare var onplay: (this: Window, ev: Event) => any; -declare var onplaying: (this: Window, ev: Event) => any; -declare var onpopstate: (this: Window, ev: PopStateEvent) => any; -declare var onprogress: (this: Window, ev: ProgressEvent) => any; -declare var onratechange: (this: Window, ev: Event) => any; -declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; -declare var onreset: (this: Window, ev: Event) => any; -declare var onresize: (this: Window, ev: UIEvent) => any; -declare var onscroll: (this: Window, ev: UIEvent) => any; -declare var onseeked: (this: Window, ev: Event) => any; -declare var onseeking: (this: Window, ev: Event) => any; -declare var onselect: (this: Window, ev: UIEvent) => any; -declare var onstalled: (this: Window, ev: Event) => any; -declare var onstorage: (this: Window, ev: StorageEvent) => any; -declare var onsubmit: (this: Window, ev: Event) => any; -declare var onsuspend: (this: Window, ev: Event) => any; -declare var ontimeupdate: (this: Window, ev: Event) => any; -declare var ontouchcancel: (ev: TouchEvent) => any; -declare var ontouchend: (ev: TouchEvent) => any; -declare var ontouchmove: (ev: TouchEvent) => any; -declare var ontouchstart: (ev: TouchEvent) => any; -declare var onunload: (this: Window, ev: Event) => any; -declare var onvolumechange: (this: Window, ev: Event) => any; -declare var onwaiting: (this: Window, ev: Event) => any; -declare var opener: any; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string | null; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -declare function webkitCancelAnimationFrame(handle: number): void; -declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; -declare function scroll(options?: ScrollToOptions): void; -declare function scrollTo(options?: ScrollToOptions): void; -declare function scrollBy(options?: ScrollToOptions): void; -declare function toString(): string; -declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (this: Window, ev: PointerEvent) => any; -declare var onpointerdown: (this: Window, ev: PointerEvent) => any; -declare var onpointerenter: (this: Window, ev: PointerEvent) => any; -declare var onpointerleave: (this: Window, ev: PointerEvent) => any; -declare var onpointermove: (this: Window, ev: PointerEvent) => any; -declare var onpointerout: (this: Window, ev: PointerEvent) => any; -declare var onpointerover: (this: Window, ev: PointerEvent) => any; -declare var onpointerup: (this: Window, ev: PointerEvent) => any; -declare var onwheel: (this: Window, ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AAGUID = string; -type AlgorithmIdentifier = string | Algorithm; -type ConstrainBoolean = boolean | ConstrainBooleanParameters; -type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; -type ConstrainDouble = number | ConstrainDoubleRange; -type ConstrainLong = number | ConstrainLongRange; -type CryptoOperationData = ArrayBufferView; -type GLbitfield = number; -type GLboolean = boolean; -type GLbyte = number; -type GLclampf = number; -type GLenum = number; -type GLfloat = number; -type GLint = number; -type GLintptr = number; -type GLshort = number; -type GLsizei = number; -type GLsizeiptr = number; -type GLubyte = number; -type GLuint = number; -type GLushort = number; -type IDBKeyPath = string; -type KeyFormat = string; -type KeyType = string; -type KeyUsage = string; -type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; -type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; -type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; -type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; -type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; -type payloadtype = number; -type ScrollBehavior = "auto" | "instant" | "smooth"; -type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; -type IDBValidKey = number | string | Date | IDBArrayKey; -type BufferSource = ArrayBuffer | ArrayBufferView; -type MouseWheelEvent = WheelEvent; +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare const NaN: number; +declare const Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype or that has null prototype. + * @param o Object to use as a prototype. May be null. + */ + create(o: object | null): any; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor & ThisType): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare const Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare const Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string | RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string | RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string | RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string | RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare const String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + readonly prototype: Boolean; +} + +declare const Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare const Number: NumberConstructor; + +interface TemplateStringsArray extends ReadonlyArray { + readonly raw: ReadonlyArray; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare const Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare const Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): this; +} + +interface RegExpConstructor { + new (pattern: RegExp | string): RegExp; + new (pattern: string, flags?: string): RegExp; + (pattern: RegExp | string): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare const RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare const Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare const EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare const RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare const ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare const SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare const TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare const URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare const JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[][]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | T[])[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean): boolean; + every(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: Z): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean): boolean; + some(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: Z): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => void): void; + forEach(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => void, thisArg: Z): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => U): U[]; + map(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => U, thisArg: undefined): U[]; + map(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => U, thisArg: Z): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => value is S): S[]; + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => value is S, thisArg: undefined): S[]; + filter(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => value is S, thisArg: Z): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => any): T[]; + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => any, thisArg: undefined): T[]; + filter(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => any, thisArg: Z): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T | undefined; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[][]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | T[])[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T | undefined; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + */ + splice(start: number, deleteCount?: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean): boolean; + every(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: T, index: number, array: T[]) => boolean, thisArg: Z): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean): boolean; + some(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: T, index: number, array: T[]) => boolean, thisArg: Z): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: T, index: number, array: T[]) => void): void; + forEach(callbackfn: (this: void, value: T, index: number, array: T[]) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: T, index: number, array: T[]) => void, thisArg: Z): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U, U, U]; + map(this: [T, T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U, U, U]; + map(this: [T, T, T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U, U]; + map(this: [T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U, U]; + map(this: [T, T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U]; + map(this: [T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U]; + map(this: [T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U]; + map(this: [T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U]; + map(this: [T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: T, index: number, array: T[]) => U): U[]; + map(callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): U[]; + map(callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => any): T[]; + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => any, thisArg: undefined): T[]; + filter(callbackfn: (this: Z, value: T, index: number, array: T[]) => any, thisArg: Z): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + readonly prototype: Array; +} + +declare const Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +} + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} + +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; + +/** + * From T pick a set of properties K + */ +type Pick = { + [P in K]: T[P]; +}; + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +}; + +/** + * Marker for contextual 'this' type + */ +interface ThisType { } + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare const ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare const DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int8Array) => any): Int8Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int8Array) => any, thisArg: undefined): Int8Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => any, thisArg: Z): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int8Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int8Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int8Array) => number): Int8Array; + map(callbackfn: (this: void, value: number, index: number, array: Int8Array) => number, thisArg: undefined): Int8Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => number, thisArg: Z): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int8Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int8Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int8Array; + + from(arrayLike: ArrayLike): Int8Array; + +} +declare const Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => any): Uint8Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => any, thisArg: undefined): Uint8Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => any, thisArg: Z): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => number): Uint8Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => number, thisArg: undefined): Uint8Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => number, thisArg: Z): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint8Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8Array; + + from(arrayLike: ArrayLike): Uint8Array; + +} +declare const Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => any): Uint8ClampedArray; + filter(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => any, thisArg: undefined): Uint8ClampedArray; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => any, thisArg: Z): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => number): Uint8ClampedArray; + map(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => number, thisArg: undefined): Uint8ClampedArray; + map(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => number, thisArg: Z): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint8ClampedArray; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8ClampedArray; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8ClampedArray; + + from(arrayLike: ArrayLike): Uint8ClampedArray; +} +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int16Array) => any): Int16Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int16Array) => any, thisArg: undefined): Int16Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => any, thisArg: Z): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int16Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int16Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int16Array) => number): Int16Array; + map(callbackfn: (this: void, value: number, index: number, array: Int16Array) => number, thisArg: undefined): Int16Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => number, thisArg: Z): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int16Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int16Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int16Array; + + from(arrayLike: ArrayLike): Int16Array; + +} +declare const Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => any): Uint16Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => any, thisArg: undefined): Uint16Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => any, thisArg: Z): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => number): Uint16Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => number, thisArg: undefined): Uint16Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => number, thisArg: Z): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint16Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint16Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint16Array; + + from(arrayLike: ArrayLike): Uint16Array; + +} +declare const Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int32Array) => any): Int32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int32Array) => any, thisArg: undefined): Int32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => any, thisArg: Z): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int32Array) => number): Int32Array; + map(callbackfn: (this: void, value: number, index: number, array: Int32Array) => number, thisArg: undefined): Int32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => number, thisArg: Z): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int32Array; + + from(arrayLike: ArrayLike): Int32Array; +} +declare const Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => any): Uint32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => any, thisArg: undefined): Uint32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => any, thisArg: Z): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => number): Uint32Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => number, thisArg: undefined): Uint32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => number, thisArg: Z): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint32Array; + + from(arrayLike: ArrayLike): Uint32Array; +} +declare const Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Float32Array) => any): Float32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Float32Array) => any, thisArg: undefined): Float32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => any, thisArg: Z): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Float32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Float32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Float32Array) => number): Float32Array; + map(callbackfn: (this: void, value: number, index: number, array: Float32Array) => number, thisArg: undefined): Float32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => number, thisArg: Z): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Float32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float32Array; + + from(arrayLike: ArrayLike): Float32Array; + +} +declare const Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Float64Array) => any): Float64Array; + filter(callbackfn: (this: void, value: number, index: number, array: Float64Array) => any, thisArg: undefined): Float64Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => any, thisArg: Z): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Float64Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Float64Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Float64Array) => number): Float64Array; + map(callbackfn: (this: void, value: number, index: number, array: Float64Array) => number, thisArg: undefined): Float64Array; + map(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => number, thisArg: Z): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Float64Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float64Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float64Array; + + from(arrayLike: ArrayLike): Float64Array; +} +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare namespace Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + }; + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + }; + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; + }; +} + +interface String { + /** + * Determines whether two strings are equivalent in the current or specified locale. + * @param that String to compare to target string + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} + + + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + +interface Account { + rpDisplayName?: string; + displayName?: string; + id?: string; + name?: string; + imageURL?: string; +} + +interface Algorithm { + name: string; +} + +interface AnimationEventInit extends EventInit { + animationName?: string; + elapsedTime?: number; +} + +interface AssertionOptions { + timeoutSeconds?: number; + rpId?: USVString; + allowList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; +} + +interface CacheQueryOptions { + ignoreSearch?: boolean; + ignoreMethod?: boolean; + ignoreVary?: boolean; + cacheName?: string; +} + +interface ClientData { + challenge?: string; + origin?: string; + rpId?: string; + hashAlg?: string | Algorithm; + tokenBinding?: string; + extensions?: WebAuthnExtensions; +} + +interface CloseEventInit extends EventInit { + wasClean?: boolean; + code?: number; + reason?: string; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: VideoFacingModeEnum | VideoFacingModeEnum[]; + ideal?: VideoFacingModeEnum | VideoFacingModeEnum[]; +} + +interface CustomEventInit extends EventInit { + detail?: any; +} + +interface DOMRectInit { + x?: any; + y?: any; + width?: any; + height?: any; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface DeviceLightEventInit extends EventInit { + value?: number; +} + +interface DeviceMotionEventInit extends EventInit { + acceleration?: DeviceAccelerationDict; + accelerationIncludingGravity?: DeviceAccelerationDict; + rotationRate?: DeviceRotationRateDict; + interval?: number; +} + +interface DeviceOrientationEventInit extends EventInit { + alpha?: number; + beta?: number; + gamma?: number; + absolute?: boolean; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface ErrorEventInit extends EventInit { + message?: string; + filename?: string; + lineno?: number; + colno?: number; + error?: any; +} + +interface EventInit { + scoped?: boolean; + bubbles?: boolean; + cancelable?: boolean; +} + +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget; +} + +interface FocusNavigationEventInit extends EventInit { + navigationReason?: string; + originLeft?: number; + originTop?: number; + originWidth?: number; + originHeight?: number; +} + +interface FocusNavigationOrigin { + originLeft?: number; + originTop?: number; + originWidth?: number; + originHeight?: number; +} + +interface GamepadEventInit extends EventInit { + gamepad?: Gamepad; +} + +interface GetNotificationOptions { + tag?: string; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface IntersectionObserverEntryInit { + time?: number; + rootBounds?: DOMRectInit; + boundingClientRect?: DOMRectInit; + intersectionRect?: DOMRectInit; + target?: Element; +} + +interface IntersectionObserverInit { + root?: Element; + rootMargin?: string; + threshold?: number | number[]; +} + +interface KeyAlgorithm { + name?: string; +} + +interface KeyboardEventInit extends EventModifierInit { + code?: string; + key?: string; + location?: number; + repeat?: boolean; +} + +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: MSIceType; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: MSCredentialType; +} + +interface MSCredentialSpec { + type?: MSCredentialType; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: RTCIceProtocol; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSPortRange { + min?: number; + max?: number; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: RTCIceProtocol; + localInterface?: MSNetworkInterfaceType; + localAddrType?: MSIceAddrType; + remoteAddrType?: MSIceAddrType; + iceRole?: RTCIceRole; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resolution?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: MediaKeyMessageType; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: MediaKeysRequirement; + persistentState?: MediaKeysRequirement; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamEventInit extends EventInit { + stream?: MediaStream; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MessageEventInit extends EventInit { + lastEventId?: string; + channel?: string; + data?: any; + origin?: string; + source?: Window; + ports?: MessagePort[]; +} + +interface MouseEventInit extends EventModifierInit { + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface NotificationOptions { + dir?: NotificationDirection; + lang?: string; + body?: string; + tag?: string; + icon?: string; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface PaymentCurrencyAmount { + currency?: string; + value?: string; + currencySystem?: string; +} + +interface PaymentDetails { + total?: PaymentItem; + displayItems?: PaymentItem[]; + shippingOptions?: PaymentShippingOption[]; + modifiers?: PaymentDetailsModifier[]; + error?: string; +} + +interface PaymentDetailsModifier { + supportedMethods?: string[]; + total?: PaymentItem; + additionalDisplayItems?: PaymentItem[]; + data?: any; +} + +interface PaymentItem { + label?: string; + amount?: PaymentCurrencyAmount; + pending?: boolean; +} + +interface PaymentMethodData { + supportedMethods?: string[]; + data?: any; +} + +interface PaymentOptions { + requestPayerName?: boolean; + requestPayerEmail?: boolean; + requestPayerPhone?: boolean; + requestShipping?: boolean; + shippingType?: string; +} + +interface PaymentRequestUpdateEventInit extends EventInit { +} + +interface PaymentShippingOption { + id?: string; + label?: string; + amount?: PaymentCurrencyAmount; + selected?: boolean; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface PopStateEventInit extends EventInit { + state?: any; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface PushSubscriptionOptionsInit { + userVisibleOnly?: boolean; + applicationServerKey?: any; +} + +interface RTCConfiguration { + iceServers?: RTCIceServer[]; + iceTransportPolicy?: RTCIceTransportPolicy; + bundlePolicy?: RTCBundlePolicy; + peerIdentity?: string; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: RTCDtlsRole; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: RTCStatsIceCandidateType; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidateDictionary { + foundation?: string; + priority?: number; + ip?: string; + protocol?: RTCIceProtocol; + port?: number; + type?: RTCIceCandidateType; + tcpType?: RTCIceTcpCandidateType; + relatedAddress?: string; + relatedPort?: number; + msMTurnSessionId?: string; +} + +interface RTCIceCandidateInit { + candidate?: string; + sdpMid?: string; + sdpMLineIndex?: number; +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidateDictionary; + remote?: RTCIceCandidateDictionary; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: RTCStatsIceCandidatePairState; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: RTCIceGatherPolicy; + iceservers?: RTCIceServer[]; + portRange?: MSPortRange; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; + iceLite?: boolean; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOfferOptions { + offerToReceiveVideo?: number; + offerToReceiveAudio?: number; + voiceActivityDetection?: boolean; + iceRestart?: boolean; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCPeerConnectionIceEventInit extends EventInit { + candidate?: RTCIceCandidate; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + ptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + ptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + resolutionScale?: number; + framerateScale?: number; + maxFramerate?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; + degradationPreference?: RTCDegradationPreference; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSessionDescriptionInit { + type?: RTCSdpType; + sdp?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: RTCStatsType; + id?: string; + msType?: MSStatsType; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; +} + +interface RegistrationOptions { + scope?: string; +} + +interface RequestInit { + method?: string; + headers?: any; + body?: any; + referrer?: string; + referrerPolicy?: ReferrerPolicy; + mode?: RequestMode; + credentials?: RequestCredentials; + cache?: RequestCache; + redirect?: RequestRedirect; + integrity?: string; + keepalive?: boolean; + window?: any; +} + +interface ResponseInit { + status?: number; + statusText?: string; + headers?: any; +} + +interface ScopedCredentialDescriptor { + type?: ScopedCredentialType; + id?: any; + transports?: Transport[]; +} + +interface ScopedCredentialOptions { + timeoutSeconds?: number; + rpId?: USVString; + excludeList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; +} + +interface ScopedCredentialParameters { + type?: ScopedCredentialType; + algorithm?: string | Algorithm; +} + +interface ServiceWorkerMessageEventInit extends EventInit { + data?: any; + origin?: string; + lastEventId?: string; + source?: ServiceWorker | MessagePort; + ports?: MessagePort[]; +} + +interface SpeechSynthesisEventInit extends EventInit { + utterance?: SpeechSynthesisUtterance; + charIndex?: number; + elapsedTime?: number; + name?: string; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface TrackEventInit extends EventInit { + track?: VideoTrack | AudioTrack | TextTrack; +} + +interface TransitionEventInit extends EventInit { + propertyName?: string; + elapsedTime?: number; +} + +interface UIEventInit extends EventInit { + view?: Window; + detail?: number; +} + +interface WebAuthnExtensions { +} + +interface WebGLContextAttributes { + failIfMajorPerformanceCaveat?: boolean; + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WheelEventInit extends MouseEventInit { + deltaX?: number; + deltaY?: number; + deltaZ?: number; + deltaMode?: number; +} + +interface EventListener { + (evt: Event): void; +} + +interface WebKitEntriesCallback { + (evt: Event): void; +} + +interface WebKitErrorCallback { + (evt: Event): void; +} + +interface WebKitFileCallback { + (evt: Event): void; +} + +interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; + drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; + vertexAttribDivisorANGLE(index: number, divisor: number): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +declare var ANGLE_instanced_arrays: { + prototype: ANGLE_instanced_arrays; + new(): ANGLE_instanced_arrays; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(): AnalyserNode; +} + +interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(typeArg: string, eventInitDict?: AnimationEventInit): AnimationEvent; +} + +interface ApplicationCacheEventMap { + "cached": Event; + "checking": Event; + "downloading": Event; + "error": Event; + "noupdate": Event; + "obsolete": Event; + "progress": ProgressEvent; + "updateready": Event; +} + +interface ApplicationCache extends EventTarget { + oncached: (this: ApplicationCache, ev: Event) => any; + onchecking: (this: ApplicationCache, ev: Event) => any; + ondownloading: (this: ApplicationCache, ev: Event) => any; + onerror: (this: ApplicationCache, ev: Event) => any; + onnoupdate: (this: ApplicationCache, ev: Event) => any; + onobsolete: (this: ApplicationCache, ev: Event) => any; + onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; + onupdateready: (this: ApplicationCache, ev: Event) => any; + readonly status: number; + abort(): void; + swapCache(): void; + update(): void; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; + addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; +} + +interface Attr extends Node { + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface AudioBufferSourceNodeEventMap { + "ended": MediaStreamErrorEvent; +} + +interface AudioBufferSourceNode extends AudioNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(): AudioBufferSourceNode; +} + +interface AudioContextEventMap { + "statechange": Event; +} + +interface AudioContextBase extends EventTarget { + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + onstatechange: (this: AudioContext, ev: Event) => any; + readonly sampleRate: number; + readonly state: AudioContextState; + close(): Promise; + createAnalyser(): AnalyserNode; + createBiquadFilter(): BiquadFilterNode; + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + createBufferSource(): AudioBufferSourceNode; + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + createConvolver(): ConvolverNode; + createDelay(maxDelayTime?: number): DelayNode; + createDynamicsCompressor(): DynamicsCompressorNode; + createGain(): GainNode; + createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + createOscillator(): OscillatorNode; + createPanner(): PannerNode; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createStereoPanner(): StereoPannerNode; + createWaveShaper(): WaveShaperNode; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): Promise; + resume(): Promise; + addEventListener(type: K, listener: (this: AudioContext, ev: AudioContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface AudioContext extends AudioContextBase { + suspend(): Promise; +} + +declare var AudioContext: { + prototype: AudioContext; + new(): AudioContext; +} + +interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +} + +interface AudioListener { + dopplerFactor: number; + speedOfSound: number; + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +} + +interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: ChannelCountMode; + channelInterpretation: ChannelInterpretation; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destination: AudioNode, output?: number, input?: number): AudioNode; + connect(destination: AudioParam, output?: number): void; + disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +} + +interface AudioParam { + readonly defaultValue: number; + value: number; + cancelScheduledValues(startTime: number): AudioParam; + exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; + linearRampToValueAtTime(value: number, endTime: number): AudioParam; + setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; + setValueAtTime(value: number, startTime: number): AudioParam; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): AudioParam; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +} + +interface AudioProcessingEvent extends Event { + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; +} + +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(): AudioProcessingEvent; +} + +interface AudioTrack { + enabled: boolean; + readonly id: string; + kind: string; + readonly label: string; + language: string; + readonly sourceBuffer: SourceBuffer; +} + +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface AudioTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + +interface AudioTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; + onchange: (this: AudioTrackList, ev: Event) => any; + onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; + getTrackById(id: string): AudioTrack | null; + item(index: number): AudioTrack; + addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: AudioTrack; +} + +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface BarProp { + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +} + +interface BeforeUnloadEvent extends Event { + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface BiquadFilterNode extends AudioNode { + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; + type: BiquadFilterType; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(): BiquadFilterNode; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface CSS { + supports(property: string, value?: string): boolean; +} +declare var CSS: CSS; + +interface CSSConditionRule extends CSSGroupingRule { + conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +} + +interface CSSFontFaceRule extends CSSRule { + readonly style: CSSStyleDeclaration; +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface CSSGroupingRule extends CSSRule { + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +} + +interface CSSImportRule extends CSSRule { + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface CSSKeyframesRule extends CSSRule { + readonly cssRules: CSSRuleList; + name: string; + appendRule(rule: string): void; + deleteRule(rule: string): void; + findRule(rule: string): CSSKeyframeRule; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface CSSMediaRule extends CSSConditionRule { + readonly media: MediaList; +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface CSSNamespaceRule extends CSSRule { + readonly namespaceURI: string; + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface CSSPageRule extends CSSRule { + readonly pseudoClass: string; + readonly selector: string; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface CSSRule { + cssText: string; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +interface CSSRuleList { + readonly length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface CSSStyleDeclaration { + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; + columnCount: any; + columnFill: string | null; + columnGap: any; + columnRule: string | null; + columnRuleColor: any; + columnRuleStyle: string | null; + columnRuleWidth: any; + columnSpan: string | null; + columnWidth: any; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; + cssText: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + layoutGrid: string | null; + layoutGridChar: string | null; + layoutGridLine: string | null; + layoutGridMode: string | null; + layoutGridType: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineBreak: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; + msContentZoomLimitMax: any; + msContentZoomLimitMin: any; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; + msGridColumn: any; + msGridColumnAlign: string | null; + msGridColumnSpan: any; + msGridColumns: string | null; + msGridRow: any; + msGridRowAlign: string | null; + msGridRowSpan: any; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; + msHyphenateLimitLines: any; + msHyphenateLimitZone: any; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; + msScrollLimitXMax: any; + msScrollLimitXMin: any; + msScrollLimitYMax: any; + msScrollLimitYMin: any; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; + msTextSizeAdjust: any; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; + msWrapFlow: string; + msWrapMargin: any; + msWrapThrough: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineOffset: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rotate: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + scale: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + translate: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; + webkitColumnCount: any; + webkitColumnGap: any; + webkitColumnRule: string | null; + webkitColumnRuleColor: any; + webkitColumnRuleStyle: string | null; + webkitColumnRuleWidth: any; + webkitColumnSpan: string | null; + webkitColumnWidth: any; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; + webkitTextSizeAdjust: any; + webkitTextStroke: string | null; + webkitTextStrokeColor: string | null; + webkitTextStrokeWidth: string | null; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; + resize: string | null; + userSelect: string | null; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + item(index: number): string; + removeProperty(propertyName: string): string; + setProperty(propertyName: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface CSSStyleRule extends CSSRule { + readonly readOnly: boolean; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface CSSStyleSheet extends StyleSheet { + readonly cssRules: CSSRuleList; + cssText: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + deleteRule(index?: number): void; + insertRule(rule: string, index?: number): number; + removeImport(lIndex: number): void; + removeRule(lIndex: number): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +} + +interface Cache { + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; + keys(request?: RequestInfo, options?: CacheQueryOptions): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; + put(request: RequestInfo, response: Response): Promise; +} + +declare var Cache: { + prototype: Cache; + new(): Cache; +} + +interface CacheStorage { + delete(cacheName: string): Promise; + has(cacheName: string): Promise; + keys(): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; +} + +declare var CacheStorage: { + prototype: CacheStorage; + new(): CacheStorage; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface CanvasPattern { + setTransform(matrix: SVGMatrix): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; + fillStyle: string | CanvasGradient | CanvasPattern; + font: string; + globalAlpha: number; + globalCompositeOperation: string; + imageSmoothingEnabled: boolean; + lineCap: string; + lineDashOffset: number; + lineJoin: string; + lineWidth: number; + miterLimit: number; + msFillRule: CanvasFillRule; + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; + strokeStyle: string | CanvasGradient | CanvasPattern; + textAlign: string; + textBaseline: string; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + beginPath(): void; + clearRect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: CanvasFillRule): void; + createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + drawFocusIfNeeded(element: Element): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number, dstW: number, dstH: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, srcX: number, srcY: number, srcW: number, srcH: number, dstX: number, dstY: number, dstW: number, dstH: number): void; + fill(fillRule?: CanvasFillRule): void; + fillRect(x: number, y: number, w: number, h: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + getLineDash(): number[]; + isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; + measureText(text: string): TextMetrics; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + restore(): void; + rotate(angle: number): void; + save(): void; + scale(x: number, y: number): void; + setLineDash(segments: number[]): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(path?: Path2D): void; + strokeRect(x: number, y: number, w: number, h: number): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + translate(x: number, y: number): void; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(): ChannelMergerNode; +} + +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(): ChannelSplitterNode; +} + +interface CharacterData extends Node, ChildNode { + data: string; + readonly length: number; + appendData(arg: string): void; + deleteData(offset: number, count: number): void; + insertData(offset: number, arg: string): void; + replaceData(offset: number, count: number, arg: string): void; + substringData(offset: number, count: number): string; +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface ClientRect { + bottom: number; + readonly height: number; + left: number; + right: number; + top: number; + readonly width: number; +} + +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface ClientRectList { + readonly length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} + +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface ClipboardEvent extends Event { + readonly clipboardData: DataTransfer; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(typeArg: string, eventInitDict?: CloseEventInit): CloseEvent; +} + +interface Comment extends CharacterData { + text: string; +} + +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface CompositionEvent extends UIEvent { + readonly data: string; + readonly locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: any, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: Element): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface ConvolverNode extends AudioNode { + buffer: AudioBuffer | null; + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(): ConvolverNode; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface Crypto extends Object, RandomSource { + readonly subtle: SubtleCrypto; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface CryptoKeyPair { + privateKey: CryptoKey; + publicKey: CryptoKey; +} + +declare var CryptoKeyPair: { + prototype: CryptoKeyPair; + new(): CryptoKeyPair; +} + +interface CustomEvent extends Event { + readonly detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMImplementation { + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document; + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createHTMLDocument(title: string): Document; + hasFeature(feature: string | null, version: string | null): boolean; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} + +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface DOMStringMap { + [name: string]: string | undefined; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DOMTokenList { + readonly length: number; + add(...token: string[]): void; + contains(token: string): boolean; + item(index: number): string; + remove(...token: string[]): void; + toString(): string; + toggle(token: string, force?: boolean): boolean; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface DataCue extends TextTrackCue { + data: ArrayBuffer; + addEventListener(type: K, listener: (this: DataCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DataCue: { + prototype: DataCue; + new(): DataCue; +} + +interface DataTransfer { + dropEffect: string; + effectAllowed: string; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: string[]; + clearData(format?: string): boolean; + getData(format: string): string; + setData(format: string, data: string): boolean; + setDragImage(image: Element, x: number, y: number): void; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface DataTransferItem { + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; + webkitGetAsEntry(): any; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +} + +interface DataTransferItemList { + readonly length: number; + add(data: File): DataTransferItem | null; + clear(): void; + item(index: number): DataTransferItem; + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +} + +interface DeferredPermissionRequest { + readonly id: number; + readonly type: MSWebViewPermissionType; + readonly uri: string; + allow(): void; + deny(): void; +} + +declare var DeferredPermissionRequest: { + prototype: DeferredPermissionRequest; + new(): DeferredPermissionRequest; +} + +interface DelayNode extends AudioNode { + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(): DelayNode; +} + +interface DeviceAcceleration { + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; +} + +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(typeArg: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + +interface DeviceMotionEvent extends Event { + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(typeArg: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; +} + +interface DeviceOrientationEvent extends Event { + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(typeArg: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent; +} + +interface DeviceRotationRate { + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface DocumentEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforedeactivate": UIEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "fullscreenchange": Event; + "fullscreenerror": Event; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "mssitemodejumplistitemremoved": MSSiteModeEvent; + "msthumbnailclick": MSSiteModeEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectionchange": Event; + "selectstart": Event; + "stalled": Event; + "stop": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "volumechange": Event; + "waiting": Event; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { + /** + * Sets or gets the URL for the current document. + */ + readonly URL: string; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + readonly URLUnencoded: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + readonly activeElement: Element; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Returns a reference to the collection of elements contained by the object. + */ + readonly all: HTMLAllCollection; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollectionOf; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollectionOf; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + readonly characterSet: string; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + readonly compatMode: string; + cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; + readonly defaultView: Window; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + readonly doctype: DocumentType; + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollectionOf; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollectionOf; + /** + * Gets the implementation object of the current document. + */ + readonly implementation: DOMImplementation; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + readonly inputEncoding: string | null; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + readonly lastModified: string; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollectionOf; + /** + * Contains information about the current URL. + */ + readonly location: Location; + msCSSOMElementFloatMetrics: boolean; + msCapsLockWarningOff: boolean; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (this: Document, ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (this: Document, ev: FocusEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (this: Document, ev: Event) => any; + oncanplaythrough: (this: Document, ev: Event) => any; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (this: Document, ev: PointerEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (this: Document, ev: DragEvent) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (this: Document, ev: DragEvent) => any; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (this: Document, ev: DragEvent) => any; + ondrop: (this: Document, ev: DragEvent) => any; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (this: Document, ev: Event) => any; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (this: Document, ev: Event) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (this: Document, ev: MediaStreamErrorEvent) => any; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (this: Document, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (this: Document, ev: FocusEvent) => any; + onfullscreenchange: (this: Document, ev: Event) => any; + onfullscreenerror: (this: Document, ev: Event) => any; + oninput: (this: Document, ev: Event) => any; + oninvalid: (this: Document, ev: Event) => any; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (this: Document, ev: Event) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (this: Document, ev: Event) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (this: Document, ev: Event) => any; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (this: Document, ev: WheelEvent) => any; + onmscontentzoom: (this: Document, ev: UIEvent) => any; + onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; + onmsgestureend: (this: Document, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; + onmspointercancel: (this: Document, ev: MSPointerEvent) => any; + onmspointerdown: (this: Document, ev: MSPointerEvent) => any; + onmspointerenter: (this: Document, ev: MSPointerEvent) => any; + onmspointerleave: (this: Document, ev: MSPointerEvent) => any; + onmspointermove: (this: Document, ev: MSPointerEvent) => any; + onmspointerout: (this: Document, ev: MSPointerEvent) => any; + onmspointerover: (this: Document, ev: MSPointerEvent) => any; + onmspointerup: (this: Document, ev: MSPointerEvent) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (this: Document, ev: Event) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (this: Document, ev: Event) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (this: Document, ev: Event) => any; + onpointerlockchange: (this: Document, ev: Event) => any; + onpointerlockerror: (this: Document, ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (this: Document, ev: ProgressEvent) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (this: Document, ev: Event) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (this: Document, ev: Event) => any; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (this: Document, ev: Event) => any; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (this: Document, ev: UIEvent) => any; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (this: Document, ev: Event) => any; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (this: Document, ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (this: Document, ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (this: Document, ev: Event) => any; + onselectstart: (this: Document, ev: Event) => any; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (this: Document, ev: Event) => any; + onsubmit: (this: Document, ev: Event) => any; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (this: Document, ev: Event) => any; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (this: Document, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (this: Document, ev: Event) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (this: Document, ev: Event) => any; + onwebkitfullscreenchange: (this: Document, ev: Event) => any; + onwebkitfullscreenerror: (this: Document, ev: Event) => any; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; + /** + * Retrieves a value that indicates the current state of the object. + */ + readonly readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + readonly referrer: string; + /** + * Gets the root svg element in the document hierarchy. + */ + readonly rootElement: SVGSVGElement; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + readonly styleSheets: StyleSheetList; + /** + * Contains the title of the document. + */ + title: string; + readonly visibilityState: VisibilityState; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; + xmlStandalone: boolean; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string | null; + adoptNode(source: T): T; + captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; + clear(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; + createCDATASection(data: string): CDATASection; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: K): HTMLElementTagNameMap[K]; + createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver: Node): XPathNSResolver; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouchList(...touches: Touch[]): TouchList; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + exitFullscreen(): void; + exitPointerLock(): void; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement | null; + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeListOf; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(tagname: K): ElementListTagNameMap[K]; + getElementsByTagName(tagname: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + importNode(importedNode: T, deep: boolean): T; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): Document; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + releaseEvents(): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + webkitCancelFullScreen(): void; + webkitExitFullscreen(): void; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Document: { + prototype: Document; + new(): Document; +} + +interface DocumentFragment extends Node, NodeSelector, ParentNode { + getElementById(elementId: string): HTMLElement | null; +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface DocumentType extends Node, ChildNode { + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string; + readonly systemId: string; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface DragEvent extends MouseEvent { + readonly dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} + +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface DynamicsCompressorNode extends AudioNode { + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: number; + readonly release: AudioParam; + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(): DynamicsCompressorNode; +} + +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + +interface EXT_texture_filter_anisotropic { + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +interface ElementEventMap extends GlobalEventHandlersEventMap { + "ariarequest": Event; + "command": Event; + "gotpointercapture": PointerEvent; + "lostpointercapture": PointerEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSGotPointerCapture": MSPointerEvent; + "MSInertiaStart": MSGestureEvent; + "MSLostPointerCapture": MSPointerEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; + innerHTML: string; + msContentZoomFactor: number; + readonly msRegionOverflow: string; + onariarequest: (this: Element, ev: Event) => any; + oncommand: (this: Element, ev: Event) => any; + ongotpointercapture: (this: Element, ev: PointerEvent) => any; + onlostpointercapture: (this: Element, ev: PointerEvent) => any; + onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; + onmsgestureend: (this: Element, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmspointercancel: (this: Element, ev: MSPointerEvent) => any; + onmspointerdown: (this: Element, ev: MSPointerEvent) => any; + onmspointerenter: (this: Element, ev: MSPointerEvent) => any; + onmspointerleave: (this: Element, ev: MSPointerEvent) => any; + onmspointermove: (this: Element, ev: MSPointerEvent) => any; + onmspointerout: (this: Element, ev: MSPointerEvent) => any; + onmspointerover: (this: Element, ev: MSPointerEvent) => any; + onmspointerup: (this: Element, ev: MSPointerEvent) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onwebkitfullscreenchange: (this: Element, ev: Event) => any; + onwebkitfullscreenerror: (this: Element, ev: Event) => any; + outerHTML: string; + readonly prefix: string | null; + readonly scrollHeight: number; + scrollLeft: number; + scrollTop: number; + readonly scrollWidth: number; + readonly tagName: string; + readonly assignedSlot: HTMLSlotElement | null; + slot: string; + readonly shadowRoot: ShadowRoot | null; + getAttribute(name: string): string | null; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNode(name: string): Attr; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + getElementsByTagName(name: K): ElementListTagNameMap[K]; + getElementsByTagName(name: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + hasAttribute(name: string): boolean; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + msGetRegionContent(): MSRangeCollection; + msGetUntransformedBounds(): ClientRect; + msMatchesSelector(selectors: string): boolean; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + releasePointerCapture(pointerId: number): void; + removeAttribute(qualifiedName: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + removeAttributeNode(oldAttr: Attr): Attr; + requestFullscreen(): void; + requestPointerLock(): void; + setAttribute(name: string, value: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + setAttributeNode(newAttr: Attr): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + setPointerCapture(pointerId: number): void; + webkitMatchesSelector(selectors: string): boolean; + webkitRequestFullScreen(): void; + webkitRequestFullscreen(): void; + getElementsByClassName(classNames: string): NodeListOf; + matches(selector: string): boolean; + closest(selector: string): Element | null; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; + insertAdjacentElement(position: string, insertedElement: Element): Element | null; + insertAdjacentHTML(where: string, html: string): void; + insertAdjacentText(where: string, text: string): void; + attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Element: { + prototype: Element; + new(): Element; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(type: string, errorEventInitDict?: ErrorEventInit): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + readonly scoped: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + deepPath(): EventTarget[]; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(typeArg: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface ExtensionScriptApis { + extensionIdToShortId(extensionId: string): number; + fireExtensionApiTelemetry(functionName: string, isSucceeded: boolean, isSupported: boolean): void; + genericFunction(routerAddress: any, parameters?: string, callbackId?: number): void; + genericSynchronousFunction(functionId: number, parameters?: string): string; + getExtensionId(): string; + registerGenericFunctionCallbackHandler(callbackHandler: any): void; + registerGenericPersistentCallbackHandler(callbackHandler: any): void; +} + +declare var ExtensionScriptApis: { + prototype: ExtensionScriptApis; + new(): ExtensionScriptApis; +} + +interface External { +} + +declare var External: { + prototype: External; + new(): External; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: FileReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface FocusEvent extends UIEvent { + readonly relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; +} + +interface FocusNavigationEvent extends Event { + readonly navigationReason: NavigationReason; + readonly originHeight: number; + readonly originLeft: number; + readonly originTop: number; + readonly originWidth: number; + requestFocus(): void; +} + +declare var FocusNavigationEvent: { + prototype: FocusNavigationEvent; + new(type: string, eventInitDict?: FocusNavigationEventInit): FocusNavigationEvent; +} + +interface FormData { + append(name: string, value: string | Blob, fileName?: string): void; + delete(name: string): void; + get(name: string): FormDataEntryValue | null; + getAll(name: string): FormDataEntryValue[]; + has(name: string): boolean; + set(name: string, value: string | Blob, fileName?: string): void; +} + +declare var FormData: { + prototype: FormData; + new (form?: HTMLFormElement): FormData; +} + +interface GainNode extends AudioNode { + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(): GainNode; +} + +interface Gamepad { + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +} + +interface GamepadButton { + readonly pressed: boolean; + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +} + +interface GamepadEvent extends Event { + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(typeArg: string, eventInitDict?: GamepadEventInit): GamepadEvent; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface HTMLAllCollection { + readonly length: number; + item(nameOrIndex?: string): HTMLCollection | Element | null; + namedItem(name: string): HTMLCollection | Element | null; + [index: number]: Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface HTMLAnchorElement extends HTMLElement { + Methods: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + readonly mimeType: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + readonly nameProp: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + readonly protocolLong: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + type: string; + urn: string; + /** + * Returns a string representation of an object. + */ + toString(): string; + addEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLAppletElement extends HTMLElement { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + object: string | null; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + vspace: number; + width: number; + addEventListener(type: K, listener: (this: HTMLAppletElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + rel: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns a string representation of an object. + */ + toString(): string; + addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface HTMLAreasCollection extends HTMLCollectionBase { +} + +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface HTMLAudioElement extends HTMLMediaElement { + addEventListener(type: K, listener: (this: HTMLAudioElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; + addEventListener(type: K, listener: (this: HTMLBRElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + addEventListener(type: K, listener: (this: HTMLBaseElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; + addEventListener(type: K, listener: (this: HTMLBaseFontElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLBodyElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "scroll": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + +interface HTMLBodyElement extends HTMLElement { + aLink: any; + background: string; + bgColor: any; + bgProperties: string; + link: any; + noWrap: boolean; + onafterprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; + onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; + onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; + onload: (this: HTMLBodyElement, ev: Event) => any; + onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; + onoffline: (this: HTMLBodyElement, ev: Event) => any; + ononline: (this: HTMLBodyElement, ev: Event) => any; + onorientationchange: (this: HTMLBodyElement, ev: Event) => any; + onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; + onresize: (this: HTMLBodyElement, ev: UIEvent) => any; + onscroll: (this: HTMLBodyElement, ev: UIEvent) => any; + onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; + onunload: (this: HTMLBodyElement, ev: Event) => any; + text: any; + vLink: any; + addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface HTMLButtonElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + status: any; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLButtonElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; + getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. + */ + toDataURL(type?: string, ...args: any[]): string; + toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; + addEventListener(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface HTMLCollectionBase { + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Retrieves an object from various collections. + */ + item(index: number): Element; + [index: number]: Element; +} + +interface HTMLCollection extends HTMLCollectionBase { + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element | null; +} + +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface HTMLDListElement extends HTMLElement { + compact: boolean; + addEventListener(type: K, listener: (this: HTMLDListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface HTMLDataElement extends HTMLElement { + value: string; + addEventListener(type: K, listener: (this: HTMLDataElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDataElement: { + prototype: HTMLDataElement; + new(): HTMLDataElement; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollectionOf; + addEventListener(type: K, listener: (this: HTMLDataListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface HTMLDirectoryElement extends HTMLElement { + compact: boolean; + addEventListener(type: K, listener: (this: HTMLDirectoryElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface HTMLDivElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + addEventListener(type: K, listener: (this: HTMLDivElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface HTMLDocument extends Document { + addEventListener(type: K, listener: (this: HTMLDocument, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface HTMLElementEventMap extends ElementEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforecopy": ClipboardEvent; + "beforecut": ClipboardEvent; + "beforedeactivate": UIEvent; + "beforepaste": ClipboardEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "copy": ClipboardEvent; + "cuechange": Event; + "cut": ClipboardEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "paste": ClipboardEvent; + "pause": Event; + "play": Event; + "playing": Event; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectstart": Event; + "stalled": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "volumechange": Event; + "waiting": Event; +} + +interface HTMLElement extends Element { + accessKey: string; + readonly children: HTMLCollection; + contentEditable: string; + readonly dataset: DOMStringMap; + dir: string; + draggable: boolean; + hidden: boolean; + hideFocus: boolean; + innerText: string; + readonly isContentEditable: boolean; + lang: string; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; + onabort: (this: HTMLElement, ev: UIEvent) => any; + onactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onblur: (this: HTMLElement, ev: FocusEvent) => any; + oncanplay: (this: HTMLElement, ev: Event) => any; + oncanplaythrough: (this: HTMLElement, ev: Event) => any; + onchange: (this: HTMLElement, ev: Event) => any; + onclick: (this: HTMLElement, ev: MouseEvent) => any; + oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; + oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; + oncuechange: (this: HTMLElement, ev: Event) => any; + oncut: (this: HTMLElement, ev: ClipboardEvent) => any; + ondblclick: (this: HTMLElement, ev: MouseEvent) => any; + ondeactivate: (this: HTMLElement, ev: UIEvent) => any; + ondrag: (this: HTMLElement, ev: DragEvent) => any; + ondragend: (this: HTMLElement, ev: DragEvent) => any; + ondragenter: (this: HTMLElement, ev: DragEvent) => any; + ondragleave: (this: HTMLElement, ev: DragEvent) => any; + ondragover: (this: HTMLElement, ev: DragEvent) => any; + ondragstart: (this: HTMLElement, ev: DragEvent) => any; + ondrop: (this: HTMLElement, ev: DragEvent) => any; + ondurationchange: (this: HTMLElement, ev: Event) => any; + onemptied: (this: HTMLElement, ev: Event) => any; + onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; + onerror: (this: HTMLElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLElement, ev: FocusEvent) => any; + oninput: (this: HTMLElement, ev: Event) => any; + oninvalid: (this: HTMLElement, ev: Event) => any; + onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; + onload: (this: HTMLElement, ev: Event) => any; + onloadeddata: (this: HTMLElement, ev: Event) => any; + onloadedmetadata: (this: HTMLElement, ev: Event) => any; + onloadstart: (this: HTMLElement, ev: Event) => any; + onmousedown: (this: HTMLElement, ev: MouseEvent) => any; + onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; + onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; + onmousemove: (this: HTMLElement, ev: MouseEvent) => any; + onmouseout: (this: HTMLElement, ev: MouseEvent) => any; + onmouseover: (this: HTMLElement, ev: MouseEvent) => any; + onmouseup: (this: HTMLElement, ev: MouseEvent) => any; + onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; + onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; + onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onpause: (this: HTMLElement, ev: Event) => any; + onplay: (this: HTMLElement, ev: Event) => any; + onplaying: (this: HTMLElement, ev: Event) => any; + onprogress: (this: HTMLElement, ev: ProgressEvent) => any; + onratechange: (this: HTMLElement, ev: Event) => any; + onreset: (this: HTMLElement, ev: Event) => any; + onscroll: (this: HTMLElement, ev: UIEvent) => any; + onseeked: (this: HTMLElement, ev: Event) => any; + onseeking: (this: HTMLElement, ev: Event) => any; + onselect: (this: HTMLElement, ev: UIEvent) => any; + onselectstart: (this: HTMLElement, ev: Event) => any; + onstalled: (this: HTMLElement, ev: Event) => any; + onsubmit: (this: HTMLElement, ev: Event) => any; + onsuspend: (this: HTMLElement, ev: Event) => any; + ontimeupdate: (this: HTMLElement, ev: Event) => any; + onvolumechange: (this: HTMLElement, ev: Event) => any; + onwaiting: (this: HTMLElement, ev: Event) => any; + outerText: string; + spellcheck: boolean; + readonly style: CSSStyleDeclaration; + tabIndex: number; + title: string; + blur(): void; + click(): void; + dragDrop(): boolean; + focus(): void; + msGetInputContext(): MSInputMethodContext; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the height of the object. + */ + height: string; + hidden: any; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the palette used for the embedded document. + */ + readonly palette: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + readonly pluginspage: string; + readonly readyState: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLEmbedElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + name: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLFieldSetElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + addEventListener(type: K, listener: (this: HTMLFontElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface HTMLFormControlsCollection extends HTMLCollectionBase { + namedItem(name: string): HTMLCollection | Element | null; +} + +declare var HTMLFormControlsCollection: { + prototype: HTMLFormControlsCollection; + new(): HTMLFormControlsCollection; +} + +interface HTMLFormElement extends HTMLElement { + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + readonly elements: HTMLFormControlsCollection; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [name: string]: any; +} + +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface HTMLFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument { + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string | number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: HTMLFrameElement, ev: Event) => any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the width of the object. + */ + width: string | number; + addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "scroll": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + +interface HTMLFrameSetElement extends HTMLElement { + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + name: string; + onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; + /** + * Fires when the object loses the input focus. + */ + onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + */ + onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; + onload: (this: HTMLFrameSetElement, ev: Event) => any; + onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; + onoffline: (this: HTMLFrameSetElement, ev: Event) => any; + ononline: (this: HTMLFrameSetElement, ev: Event) => any; + onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; + onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLFrameSetElement, ev: PopStateEvent) => any; + onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onscroll: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; + onunload: (this: HTMLFrameSetElement, ev: Event) => any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: number; + addEventListener(type: K, listener: (this: HTMLHRElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; + addEventListener(type: K, listener: (this: HTMLHeadElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + addEventListener(type: K, listener: (this: HTMLHeadingElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; + addEventListener(type: K, listener: (this: HTMLHtmlElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface HTMLIFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + allowFullscreen: boolean; + allowPaymentRequest: boolean; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: HTMLIFrameElement, ev: Event) => any; + readonly sandbox: DOMSettableTokenList; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface HTMLImageElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + crossOrigin: string | null; + readonly currentSrc: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + lowsrc: string; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * The original height of the image resource before sizing. + */ + readonly naturalHeight: number; + /** + * The original width of the image resource before sizing. + */ + readonly naturalWidth: number; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: number; + readonly x: number; + readonly y: number; + msGetAsCastingSource(): any; + addEventListener(type: K, listener: (this: HTMLImageElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; +} + +interface HTMLInputElement extends HTMLElement { + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Returns a FileList object on a file type input object. + */ + readonly files: FileList | null; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + indeterminate: boolean; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + readonly list: HTMLElement; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + selectionDirection: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + size: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + status: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + valueAsDate: Date; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + webkitdirectory: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start?: number, end?: number, direction?: string): void; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; + addEventListener(type: K, listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLLIElement extends HTMLElement { + type: string; + /** + * Sets or retrieves the value of a list item. + */ + value: number; + addEventListener(type: K, listener: (this: HTMLLIElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface HTMLLabelElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; + addEventListener(type: K, listener: (this: HTMLLabelElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface HTMLLegendElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + addEventListener(type: K, listener: (this: HTMLLegendElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + disabled: boolean; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + import?: Document; + integrity: string; + addEventListener(type: K, listener: (this: HTMLLinkElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + readonly areas: HTMLAreasCollection; + /** + * Sets or retrieves the name of the object. + */ + name: string; + addEventListener(type: K, listener: (this: HTMLMapElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { + "bounce": Event; + "finish": Event; + "start": Event; +} + +interface HTMLMarqueeElement extends HTMLElement { + behavior: string; + bgColor: any; + direction: string; + height: string; + hspace: number; + loop: number; + onbounce: (this: HTMLMarqueeElement, ev: Event) => any; + onfinish: (this: HTMLMarqueeElement, ev: Event) => any; + onstart: (this: HTMLMarqueeElement, ev: Event) => any; + scrollAmount: number; + scrollDelay: number; + trueSpeed: boolean; + vspace: number; + width: string; + start(): void; + stop(): void; + addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface HTMLMediaElementEventMap extends HTMLElementEventMap { + "encrypted": MediaEncryptedEvent; + "msneedkey": MSMediaKeyNeededEvent; +} + +interface HTMLMediaElement extends HTMLElement { + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + readonly audioTracks: AudioTrackList; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets a collection of buffered time ranges. + */ + readonly buffered: TimeRanges; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + crossOrigin: string | null; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + readonly currentSrc: string; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + defaultMuted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + readonly duration: number; + /** + * Gets information about whether the playback has ended or not. + */ + readonly ended: boolean; + /** + * Returns an object representing the current error state of the audio or video element. + */ + readonly error: MediaError; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + readonly mediaKeys: MediaKeys | null; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + readonly msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + readonly msKeys: MSMediaKeys; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets the current network activity for the element. + */ + readonly networkState: number; + onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; + /** + * Gets a flag that specifies whether playback is paused. + */ + readonly paused: boolean; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + readonly played: TimeRanges; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + readyState: number; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + readonly seekable: TimeRanges; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + readonly seeking: boolean; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Resets the audio or video object and loads a new media resource. + */ + load(): void; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + msGetAsCastingSource(): any; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + setMediaKeys(mediaKeys: MediaKeys | null): Promise; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; +} + +interface HTMLMenuElement extends HTMLElement { + compact: boolean; + type: string; + addEventListener(type: K, listener: (this: HTMLMenuElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; + addEventListener(type: K, listener: (this: HTMLMetaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; + addEventListener(type: K, listener: (this: HTMLMeterElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + addEventListener(type: K, listener: (this: HTMLModElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface HTMLOListElement extends HTMLElement { + compact: boolean; + /** + * The starting number. + */ + start: number; + type: string; + addEventListener(type: K, listener: (this: HTMLOListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + declare: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly readyState: number; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLObjectElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLOptGroupElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + readonly text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + addEventListener(type: K, listener: (this: HTMLOptGroupElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLOptionElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + addEventListener(type: K, listener: (this: HTMLOptionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; +} + +interface HTMLOptionsCollection extends HTMLCollectionOf { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + +interface HTMLOutputElement extends HTMLElement { + defaultValue: string; + readonly form: HTMLFormElement; + readonly htmlFor: DOMSettableTokenList; + name: string; + readonly type: string; + readonly validationMessage: string; + readonly validity: ValidityState; + value: string; + readonly willValidate: boolean; + checkValidity(): boolean; + reportValidity(): boolean; + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLOutputElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOutputElement: { + prototype: HTMLOutputElement; + new(): HTMLOutputElement; +} + +interface HTMLParagraphElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + clear: string; + addEventListener(type: K, listener: (this: HTMLParagraphElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; + addEventListener(type: K, listener: (this: HTMLParamElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface HTMLPictureElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLPictureElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; +} + +interface HTMLPreElement extends HTMLElement { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; + addEventListener(type: K, listener: (this: HTMLPreElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + readonly position: number; + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; + addEventListener(type: K, listener: (this: HTMLProgressElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + addEventListener(type: K, listener: (this: HTMLQuoteElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface HTMLScriptElement extends HTMLElement { + async: boolean; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + crossOrigin: string | null; + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + integrity: string; + addEventListener(type: K, listener: (this: HTMLScriptElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLSelectElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly options: HTMLOptionsCollection; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + selectedOptions: HTMLCollectionOf; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLSelectElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [name: string]: any; +} + +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + msKeySystem: string; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; + addEventListener(type: K, listener: (this: HTMLSourceElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface HTMLSpanElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLSpanElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; + addEventListener(type: K, listener: (this: HTMLStyleElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; + addEventListener(type: K, listener: (this: HTMLTableCaptionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + bgColor: any; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + readonly cellIndex: number; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLTableCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; + /** + * Sets or retrieves the width of the object. + */ + width: any; + addEventListener(type: K, listener: (this: HTMLTableColElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { + addEventListener(type: K, listener: (this: HTMLTableDataCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLTableElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + bgColor: any; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollectionOf; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLTableCaptionElement; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLTableSectionElement; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLTableSectionElement; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLTableSectionElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLTableElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + addEventListener(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + bgColor: any; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollectionOf; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the position of the object in the rows collection for the table. + */ + readonly rowIndex: number; + /** + * Retrieves the position of the object in the collection. + */ + readonly sectionRowIndex: number; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: K, listener: (this: HTMLTableRowElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLTableSectionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; + addEventListener(type: K, listener: (this: HTMLTemplateElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + +interface HTMLTextAreaElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves the type of control. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + addEventListener(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface HTMLTimeElement extends HTMLElement { + dateTime: string; + addEventListener(type: K, listener: (this: HTMLTimeElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTimeElement: { + prototype: HTMLTimeElement; + new(): HTMLTimeElement; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + addEventListener(type: K, listener: (this: HTMLTitleElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLTrackElement extends HTMLElement { + default: boolean; + kind: string; + label: string; + readonly readyState: number; + src: string; + srclang: string; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + addEventListener(type: K, listener: (this: HTMLTrackElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +interface HTMLUListElement extends HTMLElement { + compact: boolean; + type: string; + addEventListener(type: K, listener: (this: HTMLUListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface HTMLUnknownElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLUnknownElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { + "MSVideoFormatChanged": Event; + "MSVideoFrameStepCompleted": Event; + "MSVideoOptimalLayoutChanged": Event; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the height of the video element. + */ + height: number; + msHorizontalMirror: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; + msStereo3DPackingMode: string; + msStereo3DRenderMode: string; + msZoom: boolean; + onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoHeight: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; + /** + * Gets or sets the width of the video element. + */ + width: number; + getVideoPlaybackQuality(): VideoPlaybackQuality; + msFrameStep(forward: boolean): void; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + webkitEnterFullScreen(): void; + webkitEnterFullscreen(): void; + webkitExitFullScreen(): void; + webkitExitFullscreen(): void; + addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface HashChangeEvent extends Event { + readonly newURL: string | null; + readonly oldURL: string | null; +} + +declare var HashChangeEvent: { + prototype: HashChangeEvent; + new(typeArg: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; +} + +interface Headers { + append(name: string, value: string): void; + delete(name: string): void; + forEach(callback: ForEachCallback): void; + get(name: string): string | null; + has(name: string): boolean; + set(name: string, value: string): void; +} + +declare var Headers: { + prototype: Headers; + new(init?: any): Headers; +} + +interface History { + readonly length: number; + readonly state: any; + scrollRestoration: ScrollRestoration; + back(): void; + forward(): void; + go(delta?: number): void; + pushState(data: any, title: string, url?: string | null): void; + replaceState(data: any, title: string, url?: string | null): void; +} + +declare var History: { + prototype: History; + new(): History; +} + +interface IDBCursor { + readonly direction: IDBCursorDirection; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabaseEventMap { + "abort": Event; + "error": Event; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: Event) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequestEventMap { + "error": Event; + "success": Event; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: IDBRequest, ev: Event) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; + readonly readyState: IDBRequestReadyState; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": Event; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: IDBTransactionMode; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: Event) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface IIRFilterNode extends AudioNode { + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var IIRFilterNode: { + prototype: IIRFilterNode; + new(): IIRFilterNode; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface IntersectionObserver { + readonly root: Element | null; + readonly rootMargin: string; + readonly thresholds: number[]; + disconnect(): void; + observe(target: Element): void; + takeRecords(): IntersectionObserverEntry[]; + unobserve(target: Element): void; +} + +declare var IntersectionObserver: { + prototype: IntersectionObserver; + new(callback: IntersectionObserverCallback, options?: IntersectionObserverInit): IntersectionObserver; +} + +interface IntersectionObserverEntry { + readonly boundingClientRect: ClientRect; + readonly intersectionRatio: number; + readonly intersectionRect: ClientRect; + readonly rootBounds: ClientRect; + readonly target: Element; + readonly time: number; +} + +declare var IntersectionObserverEntry: { + prototype: IntersectionObserverEntry; + new(intersectionObserverEntryInit: IntersectionObserverEntryInit): IntersectionObserverEntry; +} + +interface KeyboardEvent extends UIEvent { + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; + readonly code: string; + getModifierState(keyArg: string): boolean; + initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: ListeningState; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; +} + +interface Location { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + pathname: string; + port: string; + protocol: string; + search: string; + assign(url: string): void; + reload(forcedReload?: boolean): void; + replace(url: string): void; + toString(): string; +} + +declare var Location: { + prototype: Location; + new(): Location; +} + +interface LongRunningScriptDetectedEvent extends Event { + readonly executionTime: number; + stopPageScriptExecution: boolean; +} + +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSApp { + clearTemporaryWebDataAsync(): MSAppAsyncOperation; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createDataPackage(object: any): any; + createDataPackageFromSelection(): any; + createFileFromStorageFile(storageFile: any): File; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + getCurrentPriority(): string; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): Promise; + getViewId(view: any): any; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + pageHandlesAllApplicationActivations(enabled: boolean): void; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + terminateApp(exceptionObject: any): void; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; +} +declare var MSApp: MSApp; + +interface MSAppAsyncOperationEventMap { + "complete": Event; + "error": Event; +} + +interface MSAppAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; + onerror: (this: MSAppAsyncOperation, ev: Event) => any; + readonly readyState: number; + readonly result: any; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: MSCredentialType; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} + +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): Promise; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): Promise; +} + +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: MSTransportType[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} + +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface MSGestureEvent extends UIEvent { + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +interface MSGraphicsTrust { + readonly constrictionActive: boolean; + readonly status: string; +} + +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface MSHTMLWebViewElement extends HTMLElement { + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; + height: number; + readonly settings: MSWebViewSettings; + src: string; + width: number; + addWebAllowedObject(name: string, applicationObject: any): void; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; + getDeferredPermissionRequests(): DeferredPermissionRequest[]; + goBack(): void; + goForward(): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + navigate(uri: string): void; + navigateFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + navigateToString(contents: string): void; + navigateWithHttpRequestMessage(requestMessage: any): void; + refresh(): void; + stop(): void; + addEventListener(type: K, listener: (this: MSHTMLWebViewElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface MSInputMethodContextEventMap { + "MSCandidateWindowHide": Event; + "MSCandidateWindowShow": Event; + "MSCandidateWindowUpdate": Event; +} + +interface MSInputMethodContext extends EventTarget { + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; + oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; + readonly target: HTMLElement; + getCandidateWindowClientRect(): ClientRect; + getCompositionAlternatives(): string[]; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface MSManipulationEvent extends UIEvent { + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +interface MSMediaKeyError { + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +interface MSMediaKeyMessageEvent extends Event { + readonly destinationURL: string | null; + readonly message: Uint8Array; +} + +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSMediaKeyNeededEvent extends Event { + readonly initData: Uint8Array | null; +} + +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface MSMediaKeySession extends EventTarget { + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; + close(): void; + update(key: Uint8Array): void; +} + +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface MSMediaKeys { + readonly keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} + +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; +} + +interface MSPointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; +} + +interface MSRangeCollection { + readonly length: number; + item(index: number): Range; + [index: number]: Range; +} + +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface MSSiteModeEvent extends Event { + readonly actionURL: string; + readonly buttonID: number; +} + +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface MSStream { + readonly type: string; + msClose(): void; + msDetachStream(): any; +} + +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSStreamReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBinaryString(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: K, listener: (this: MSStreamReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MSWebViewAsyncOperationEventMap { + "complete": Event; + "error": Event; +} + +interface MSWebViewAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; + onerror: (this: MSWebViewAsyncOperation, ev: Event) => any; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; + addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; +} + +interface MSWebViewSettings { + isIndexedDBEnabled: boolean; + isJavaScriptEnabled: boolean; +} + +declare var MSWebViewSettings: { + prototype: MSWebViewSettings; + new(): MSWebViewSettings; +} + +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: MediaDeviceKind; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevicesEventMap { + "devicechange": Event; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (this: MediaDevices, ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): Promise; + addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + +interface MediaElementAudioSourceNode extends AudioNode { +} + +declare var MediaElementAudioSourceNode: { + prototype: MediaElementAudioSourceNode; + new(): MediaElementAudioSourceNode; +} + +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + +interface MediaError { + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: MediaKeyMessageType; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: Promise; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): Promise; + generateRequest(initDataType: string, initData: any): Promise; + load(sessionId: string): Promise; + remove(): Promise; + update(response: any): Promise; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): MediaKeyStatus; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): Promise; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: MediaKeySessionType): MediaKeySession; + setServerCertificate(serverCertificate: any): Promise; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; +} + +interface MediaList { + readonly length: number; + mediaText: string; + appendMedium(newMedium: string): void; + deleteMedium(oldMedium: string): void; + item(index: number): string; + toString(): string; + [index: number]: string; +} + +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface MediaQueryList { + readonly matches: boolean; + readonly media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface MediaSource extends EventTarget { + readonly activeSourceBuffers: SourceBufferList; + duration: number; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: number): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} + +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface MediaStreamEventMap { + "active": Event; + "addtrack": MediaStreamTrackEvent; + "inactive": Event; + "removetrack": MediaStreamTrackEvent; +} + +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (this: MediaStream, ev: Event) => any; + onaddtrack: (this: MediaStream, ev: MediaStreamTrackEvent) => any; + oninactive: (this: MediaStream, ev: Event) => any; + onremovetrack: (this: MediaStream, ev: MediaStreamTrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(typeArg: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamEvent extends Event { + readonly stream: MediaStream | null; +} + +declare var MediaStreamEvent: { + prototype: MediaStreamEvent; + new(type: string, eventInitDict: MediaStreamEventInit): MediaStreamEvent; +} + +interface MediaStreamTrackEventMap { + "ended": MediaStreamErrorEvent; + "mute": Event; + "overconstrained": MediaStreamErrorEvent; + "unmute": Event; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onmute: (this: MediaStreamTrack, ev: Event) => any; + onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onunmute: (this: MediaStreamTrack, ev: Event) => any; + readonly readonly: boolean; + readonly readyState: MediaStreamTrackState; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): Promise; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(typeArg: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePortEventMap { + "message": MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: MessagePort, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, transfer?: any[]): void; + start(): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface MimeType { + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; +} + +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface MimeTypeArray { + readonly length: number; + item(index: number): Plugin; + namedItem(type: string): Plugin; + [index: number]: Plugin; +} + +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface MouseEvent extends UIEvent { + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; + getModifierState(keyArg: string): boolean; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; +} + +declare var MouseEvent: { + prototype: MouseEvent; + new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; +} + +interface MutationEvent extends Event { + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +interface MutationObserver { + disconnect(): void; + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; +} + +declare var MutationObserver: { + prototype: MutationObserver; + new(callback: MutationCallback): MutationObserver; +} + +interface MutationRecord { + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; +} + +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface NamedNodeMap { + readonly length: number; + getNamedItem(name: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + item(index: number): Attr; + removeNamedItem(name: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + setNamedItem(arg: Attr): Attr; + setNamedItemNS(arg: Attr): Attr; + [index: number]: Attr; +} + +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface NavigationCompletedEvent extends NavigationEvent { + readonly isSuccess: boolean; + readonly webErrorStatus: number; +} + +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface NavigationEvent extends Event { + readonly uri: string; +} + +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface NavigationEventWithReferrer extends NavigationEvent { + readonly referer: string; +} + +declare var NavigationEventWithReferrer: { + prototype: NavigationEventWithReferrer; + new(): NavigationEventWithReferrer; +} + +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia { + readonly authentication: WebAuthentication; + readonly cookieEnabled: boolean; + gamepadInputEmulation: GamepadInputEmulationType; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly serviceWorker: ServiceWorkerContainer; + readonly webdriver: boolean; + readonly hardwareConcurrency: number; + getGamepads(): Gamepad[]; + javaEnabled(): boolean; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; + vibrate(pattern: number | number[]): boolean; +} + +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface Node extends EventTarget { + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node | null; + readonly lastChild: Node | null; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node | null; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement | null; + readonly parentNode: Node | null; + readonly previousSibling: Node | null; + textContent: string | null; + appendChild(newChild: T): T; + cloneNode(deep?: boolean): Node; + compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; + hasAttributes(): boolean; + hasChildNodes(): boolean; + insertBefore(newChild: T, refChild: Node | null): T; + isDefaultNamespace(namespaceURI: string | null): boolean; + isEqualNode(arg: Node): boolean; + isSameNode(other: Node): boolean; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; + normalize(): void; + removeChild(oldChild: T): T; + replaceChild(newChild: Node, oldChild: T): T; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +declare var Node: { + prototype: Node; + new(): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; +} + +interface NodeIterator { + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + detach(): void; + nextNode(): Node; + previousNode(): Node; +} + +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface NodeList { + readonly length: number; + item(index: number): Node; + [index: number]: Node; +} + +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface NotificationEventMap { + "click": Event; + "close": Event; + "error": Event; + "show": Event; +} + +interface Notification extends EventTarget { + readonly body: string; + readonly dir: NotificationDirection; + readonly icon: string; + readonly lang: string; + onclick: (this: Notification, ev: Event) => any; + onclose: (this: Notification, ev: Event) => any; + onerror: (this: Notification, ev: Event) => any; + onshow: (this: Notification, ev: Event) => any; + readonly permission: NotificationPermission; + readonly tag: string; + readonly title: string; + close(): void; + addEventListener(type: K, listener: (this: Notification, ev: NotificationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Notification: { + prototype: Notification; + new(title: string, options?: NotificationOptions): Notification; + requestPermission(callback?: NotificationPermissionCallback): Promise; +} + +interface OES_element_index_uint { +} + +declare var OES_element_index_uint: { + prototype: OES_element_index_uint; + new(): OES_element_index_uint; +} + +interface OES_standard_derivatives { + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface OES_texture_float { +} + +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface OES_texture_float_linear { +} + +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface OES_texture_half_float { + readonly HALF_FLOAT_OES: number; +} + +declare var OES_texture_half_float: { + prototype: OES_texture_half_float; + new(): OES_texture_half_float; + readonly HALF_FLOAT_OES: number; +} + +interface OES_texture_half_float_linear { +} + +declare var OES_texture_half_float_linear: { + prototype: OES_texture_half_float_linear; + new(): OES_texture_half_float_linear; +} + +interface OfflineAudioCompletionEvent extends Event { + readonly renderedBuffer: AudioBuffer; +} + +declare var OfflineAudioCompletionEvent: { + prototype: OfflineAudioCompletionEvent; + new(): OfflineAudioCompletionEvent; +} + +interface OfflineAudioContextEventMap extends AudioContextEventMap { + "complete": OfflineAudioCompletionEvent; +} + +interface OfflineAudioContext extends AudioContextBase { + readonly length: number; + oncomplete: (this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any; + startRendering(): Promise; + suspend(suspendTime: number): Promise; + addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OfflineAudioContext: { + prototype: OfflineAudioContext; + new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; +} + +interface OscillatorNodeEventMap { + "ended": MediaStreamErrorEvent; +} + +interface OscillatorNode extends AudioNode { + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; + type: OscillatorType; + setPeriodicWave(periodicWave: PeriodicWave): void; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OscillatorNode: { + prototype: OscillatorNode; + new(): OscillatorNode; +} + +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +interface PageTransitionEvent extends Event { + readonly persisted: boolean; +} + +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface PannerNode extends AudioNode { + coneInnerAngle: number; + coneOuterAngle: number; + coneOuterGain: number; + distanceModel: DistanceModelType; + maxDistance: number; + panningModel: PanningModelType; + refDistance: number; + rolloffFactor: number; + setOrientation(x: number, y: number, z: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var PannerNode: { + prototype: PannerNode; + new(): PannerNode; +} + +interface Path2D extends Object, CanvasPathMethods { +} + +declare var Path2D: { + prototype: Path2D; + new(path?: Path2D): Path2D; +} + +interface PaymentAddress { + readonly addressLine: string[]; + readonly city: string; + readonly country: string; + readonly dependentLocality: string; + readonly languageCode: string; + readonly organization: string; + readonly phone: string; + readonly postalCode: string; + readonly recipient: string; + readonly region: string; + readonly sortingCode: string; + toJSON(): any; +} + +declare var PaymentAddress: { + prototype: PaymentAddress; + new(): PaymentAddress; +} + +interface PaymentRequestEventMap { + "shippingaddresschange": Event; + "shippingoptionchange": Event; +} + +interface PaymentRequest extends EventTarget { + onshippingaddresschange: (this: PaymentRequest, ev: Event) => any; + onshippingoptionchange: (this: PaymentRequest, ev: Event) => any; + readonly shippingAddress: PaymentAddress | null; + readonly shippingOption: string | null; + readonly shippingType: PaymentShippingType | null; + abort(): Promise; + show(): Promise; + addEventListener(type: K, listener: (this: PaymentRequest, ev: PaymentRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var PaymentRequest: { + prototype: PaymentRequest; + new(methodData: PaymentMethodData[], details: PaymentDetails, options?: PaymentOptions): PaymentRequest; +} + +interface PaymentRequestUpdateEvent extends Event { + updateWith(d: Promise): void; +} + +declare var PaymentRequestUpdateEvent: { + prototype: PaymentRequestUpdateEvent; + new(type: string, eventInitDict?: PaymentRequestUpdateEventInit): PaymentRequestUpdateEvent; +} + +interface PaymentResponse { + readonly details: any; + readonly methodName: string; + readonly payerEmail: string | null; + readonly payerName: string | null; + readonly payerPhone: string | null; + readonly shippingAddress: PaymentAddress | null; + readonly shippingOption: string | null; + complete(result?: PaymentComplete): Promise; + toJSON(): any; +} + +declare var PaymentResponse: { + prototype: PaymentResponse; + new(): PaymentResponse; +} + +interface PerfWidgetExternal { + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; + addEventListener(eventType: string, callback: Function): void; + getMemoryUsage(): number; + getProcessCpuUsage(): number; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; + removeEventListener(eventType: string, callback: Function): void; + repositionWindow(x: number, y: number): void; + resizeWindow(width: number, height: number): void; +} + +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface Performance { + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; + clearMarks(markName?: string): void; + clearMeasures(measureName?: string): void; + clearResourceTimings(): void; + getEntries(): any; + getEntriesByName(name: string, entryType?: string): any; + getEntriesByType(entryType: string): any; + getMarks(markName?: string): any; + getMeasures(measureName?: string): any; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): any; +} + +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface PerformanceEntry { + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; +} + +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface PerformanceMark extends PerformanceEntry { +} + +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface PerformanceMeasure extends PerformanceEntry { +} + +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface PerformanceNavigation { + readonly redirectCount: number; + readonly type: number; + toJSON(): any; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: NavigationType; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; +} + +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; +} + +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface PerformanceTiming { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; + readonly secureConnectionStart: number; + toJSON(): any; +} + +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface PeriodicWave { +} + +declare var PeriodicWave: { + prototype: PeriodicWave; + new(): PeriodicWave; +} + +interface PermissionRequest extends DeferredPermissionRequest { + readonly state: MSWebViewPermissionState; + defer(): void; +} + +declare var PermissionRequest: { + prototype: PermissionRequest; + new(): PermissionRequest; +} + +interface PermissionRequestedEvent extends Event { + readonly permissionRequest: PermissionRequest; +} + +declare var PermissionRequestedEvent: { + prototype: PermissionRequestedEvent; + new(): PermissionRequestedEvent; +} + +interface Plugin { + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; + item(index: number): MimeType; + namedItem(type: string): MimeType; + [index: number]: MimeType; +} + +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface PluginArray { + readonly length: number; + item(index: number): Plugin; + namedItem(name: string): Plugin; + refresh(reload?: boolean): void; + [index: number]: Plugin; +} + +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface PointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var PointerEvent: { + prototype: PointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; +} + +interface PopStateEvent extends Event { + readonly state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} + +declare var PopStateEvent: { + prototype: PopStateEvent; + new(typeArg: string, eventInitDict?: PopStateEventInit): PopStateEvent; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProcessingInstruction extends CharacterData { + readonly target: string; +} + +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface PushManager { + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; +} + +declare var PushManager: { + prototype: PushManager; + new(): PushManager; +} + +interface PushSubscription { + readonly endpoint: USVString; + readonly options: PushSubscriptionOptions; + getKey(name: PushEncryptionKeyName): ArrayBuffer | null; + toJSON(): any; + unsubscribe(): Promise; +} + +declare var PushSubscription: { + prototype: PushSubscription; + new(): PushSubscription; +} + +interface PushSubscriptionOptions { + readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; +} + +declare var PushSubscriptionOptions: { + prototype: PushSubscriptionOptions; + new(): PushSubscriptionOptions; +} + +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(typeArg: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransportEventMap { + "dtlsstatechange": RTCDtlsTransportStateChangedEvent; + "error": Event; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: RTCDtlsTransport, ev: Event) => any) | null; + readonly state: RTCDtlsTransportState; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: RTCDtlsTransportState; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSenderEventMap { + "tonechange": RTCDTMFToneChangeEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidate { + candidate: string | null; + sdpMLineIndex: number | null; + sdpMid: string | null; + toJSON(): any; +} + +declare var RTCIceCandidate: { + prototype: RTCIceCandidate; + new(candidateInitDict?: RTCIceCandidateInit): RTCIceCandidate; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGathererEventMap { + "error": Event; + "localcandidate": RTCIceGathererEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: RTCIceComponent; + onerror: ((this: RTCIceGatherer, ev: Event) => any) | null; + onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidateDictionary[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidateDictionary | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransportEventMap { + "candidatepairchange": RTCIceCandidatePairChangedEvent; + "icestatechange": RTCIceTransportStateChangedEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: RTCIceComponent; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: RTCIceRole; + readonly state: RTCIceTransportState; + addRemoteCandidate(remoteCandidate: RTCIceCandidateDictionary | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidateDictionary[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidateDictionary[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: RTCIceRole): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: RTCIceTransportState; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCPeerConnectionEventMap { + "addstream": MediaStreamEvent; + "icecandidate": RTCPeerConnectionIceEvent; + "iceconnectionstatechange": Event; + "icegatheringstatechange": Event; + "negotiationneeded": Event; + "removestream": MediaStreamEvent; + "signalingstatechange": Event; +} + +interface RTCPeerConnection extends EventTarget { + readonly canTrickleIceCandidates: boolean | null; + readonly iceConnectionState: RTCIceConnectionState; + readonly iceGatheringState: RTCIceGatheringState; + readonly localDescription: RTCSessionDescription | null; + onaddstream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any; + onicecandidate: (this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any; + oniceconnectionstatechange: (this: RTCPeerConnection, ev: Event) => any; + onicegatheringstatechange: (this: RTCPeerConnection, ev: Event) => any; + onnegotiationneeded: (this: RTCPeerConnection, ev: Event) => any; + onremovestream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any; + onsignalingstatechange: (this: RTCPeerConnection, ev: Event) => any; + readonly remoteDescription: RTCSessionDescription | null; + readonly signalingState: RTCSignalingState; + addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + addStream(stream: MediaStream): void; + close(): void; + createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise; + getConfiguration(): RTCConfiguration; + getLocalStreams(): MediaStream[]; + getRemoteStreams(): MediaStream[]; + getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + getStreamById(streamId: string): MediaStream | null; + removeStream(stream: MediaStream): void; + setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + addEventListener(type: K, listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCPeerConnection: { + prototype: RTCPeerConnection; + new(configuration: RTCConfiguration): RTCPeerConnection; +} + +interface RTCPeerConnectionIceEvent extends Event { + readonly candidate: RTCIceCandidate; +} + +declare var RTCPeerConnectionIceEvent: { + prototype: RTCPeerConnectionIceEvent; + new(type: string, eventInitDict: RTCPeerConnectionIceEventInit): RTCPeerConnectionIceEvent; +} + +interface RTCRtpReceiverEventMap { + "error": Event; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((this: RTCRtpReceiver, ev: Event) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSenderEventMap { + "error": Event; + "ssrcconflict": RTCSsrcConflictEvent; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((this: RTCRtpSender, ev: Event) => any) | null; + onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSessionDescription { + sdp: string | null; + type: RTCSdpType | null; + toJSON(): any; +} + +declare var RTCSessionDescription: { + prototype: RTCSessionDescription; + new(descriptionInitDict?: RTCSessionDescriptionInit): RTCSessionDescription; +} + +interface RTCSrtpSdesTransportEventMap { + "error": Event; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((this: RTCSrtpSdesTransport, ev: Event) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): Promise; + msGetStats(): Promise; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + +interface Range { + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; + cloneContents(): DocumentFragment; + cloneRange(): Range; + collapse(toStart: boolean): void; + compareBoundaryPoints(how: number, sourceRange: Range): number; + createContextualFragment(fragment: string): DocumentFragment; + deleteContents(): void; + detach(): void; + expand(Unit: ExpandGranularity): boolean; + extractContents(): DocumentFragment; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + insertNode(newNode: Node): void; + selectNode(refNode: Node): void; + selectNodeContents(refNode: Node): void; + setEnd(refNode: Node, offset: number): void; + setEndAfter(refNode: Node): void; + setEndBefore(refNode: Node): void; + setStart(refNode: Node, offset: number): void; + setStartAfter(refNode: Node): void; + setStartBefore(refNode: Node): void; + surroundContents(newParent: Node): void; + toString(): string; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +declare var Range: { + prototype: Range; + new(): Range; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +interface ReadableStream { + readonly locked: boolean; + cancel(): Promise; + getReader(): ReadableStreamReader; +} + +declare var ReadableStream: { + prototype: ReadableStream; + new(): ReadableStream; +} + +interface ReadableStreamReader { + cancel(): Promise; + read(): Promise; + releaseLock(): void; +} + +declare var ReadableStreamReader: { + prototype: ReadableStreamReader; + new(): ReadableStreamReader; +} + +interface Request extends Object, Body { + readonly cache: RequestCache; + readonly credentials: RequestCredentials; + readonly destination: RequestDestination; + readonly headers: Headers; + readonly integrity: string; + readonly keepalive: boolean; + readonly method: string; + readonly mode: RequestMode; + readonly redirect: RequestRedirect; + readonly referrer: string; + readonly referrerPolicy: ReferrerPolicy; + readonly type: RequestType; + readonly url: string; + clone(): Request; +} + +declare var Request: { + prototype: Request; + new(input: Request | string, init?: RequestInit): Request; +} + +interface Response extends Object, Body { + readonly body: ReadableStream | null; + readonly headers: Headers; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly type: ResponseType; + readonly url: string; + clone(): Response; +} + +declare var Response: { + prototype: Response; + new(body?: any, init?: ResponseInit): Response; +} + +interface SVGAElement extends SVGGraphicsElement, SVGURIReference { + readonly target: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGAElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGAngle { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +interface SVGAnimatedAngle { + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; +} + +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface SVGAnimatedBoolean { + readonly animVal: boolean; + baseVal: boolean; +} + +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface SVGAnimatedEnumeration { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface SVGAnimatedInteger { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGAnimatedLength { + readonly animVal: SVGLength; + readonly baseVal: SVGLength; +} + +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedLengthList { + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; +} + +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedNumber { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface SVGAnimatedNumberList { + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; +} + +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGAnimatedPreserveAspectRatio { + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; +} + +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface SVGAnimatedRect { + readonly animVal: SVGRect; + readonly baseVal: SVGRect; +} + +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface SVGAnimatedString { + readonly animVal: string; + baseVal: string; +} + +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface SVGAnimatedTransformList { + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; +} + +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface SVGCircleElement extends SVGGraphicsElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGCircleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface SVGClipPathElement extends SVGGraphicsElement, SVGUnitTypes { + readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: K, listener: (this: SVGClipPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGComponentTransferFunctionElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +interface SVGDefsElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGDefsElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface SVGDescElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGDescElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface SVGElementEventMap extends ElementEventMap { + "click": MouseEvent; + "dblclick": MouseEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "load": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; +} + +interface SVGElement extends Element { + className: any; + onclick: (this: SVGElement, ev: MouseEvent) => any; + ondblclick: (this: SVGElement, ev: MouseEvent) => any; + onfocusin: (this: SVGElement, ev: FocusEvent) => any; + onfocusout: (this: SVGElement, ev: FocusEvent) => any; + onload: (this: SVGElement, ev: Event) => any; + onmousedown: (this: SVGElement, ev: MouseEvent) => any; + onmousemove: (this: SVGElement, ev: MouseEvent) => any; + onmouseout: (this: SVGElement, ev: MouseEvent) => any; + onmouseover: (this: SVGElement, ev: MouseEvent) => any; + onmouseup: (this: SVGElement, ev: MouseEvent) => any; + readonly ownerSVGElement: SVGSVGElement; + readonly style: CSSStyleDeclaration; + readonly viewportElement: SVGElement; + xmlbase: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface SVGElementInstance extends EventTarget { + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; +} + +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface SVGElementInstanceList { + readonly length: number; + item(index: number): SVGElementInstance; +} + +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface SVGEllipseElement extends SVGGraphicsElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGEllipseElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEBlendElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEColorMatrixElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; +} + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEComponentTransferElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: K, listener: (this: SVGFECompositeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: K, listener: (this: SVGFEConvolveMatrixElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEDiffuseLightingElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; +} + +interface SVGFEDistantLightElement extends SVGElement { + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEDistantLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGFEFloodElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncAElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncBElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncRElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGFEGaussianBlurElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGURIReference { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: K, listener: (this: SVGFEImageElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGFEMergeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface SVGFEMergeNodeElement extends SVGElement { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEMergeNodeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEMorphologyElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEOffsetElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface SVGFEPointLightElement extends SVGElement { + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEPointLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFESpecularLightingElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface SVGFESpotLightElement extends SVGElement { + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFESpotLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFETileElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFETurbulenceElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGURIReference { + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: K, listener: (this: SVGFilterElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface SVGForeignObjectElement extends SVGGraphicsElement { + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGForeignObjectElement: { + prototype: SVGForeignObjectElement; + new(): SVGForeignObjectElement; +} + +interface SVGGElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGURIReference { + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; +} + +interface SVGGraphicsElement extends SVGElement, SVGTests { + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; + readonly transform: SVGAnimatedTransformList; + getBBox(): SVGRect; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; + getTransformToElement(element: SVGElement): SVGMatrix; + addEventListener(type: K, listener: (this: SVGGraphicsElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGraphicsElement: { + prototype: SVGGraphicsElement; + new(): SVGGraphicsElement; +} + +interface SVGImageElement extends SVGGraphicsElement, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGImageElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGLength { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +interface SVGLengthList { + readonly numberOfItems: number; + appendItem(newItem: SVGLength): SVGLength; + clear(): void; + getItem(index: number): SVGLength; + initialize(newItem: SVGLength): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; + removeItem(index: number): SVGLength; + replaceItem(newItem: SVGLength, index: number): SVGLength; +} + +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface SVGLineElement extends SVGGraphicsElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGLineElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGLinearGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface SVGMarkerElement extends SVGElement, SVGFitToViewBox { + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGMarkerElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; +} + +interface SVGMaskElement extends SVGElement, SVGTests, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGMaskElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface SVGMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + flipX(): SVGMatrix; + flipY(): SVGMatrix; + inverse(): SVGMatrix; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + rotate(angle: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + skewX(angle: number): SVGMatrix; + skewY(angle: number): SVGMatrix; + translate(x: number, y: number): SVGMatrix; +} + +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface SVGMetadataElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGMetadataElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGNumber { + value: number; +} + +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGNumberList { + readonly numberOfItems: number; + appendItem(newItem: SVGNumber): SVGNumber; + clear(): void; + getItem(index: number): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; + removeItem(index: number): SVGNumber; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; +} + +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface SVGPathElement extends SVGGraphicsElement { + readonly pathSegList: SVGPathSegList; + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + getTotalLength(): number; + addEventListener(type: K, listener: (this: SVGPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface SVGPathSeg { + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} + +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGPathSegList { + readonly numberOfItems: number; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + clear(): void; + getItem(index: number): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; +} + +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGPatternElement extends SVGElement, SVGTests, SVGUnitTypes, SVGFitToViewBox, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGPatternElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGPoint { + x: number; + y: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} + +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface SVGPointList { + readonly numberOfItems: number; + appendItem(newItem: SVGPoint): SVGPoint; + clear(): void; + getItem(index: number): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; + removeItem(index: number): SVGPoint; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; +} + +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGPolygonElement extends SVGGraphicsElement, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGPolygonElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface SVGPolylineElement extends SVGGraphicsElement, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGPolylineElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGRadialGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface SVGRect { + height: number; + width: number; + x: number; + y: number; +} + +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface SVGRectElement extends SVGGraphicsElement { + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGRectElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface SVGSVGElementEventMap extends SVGElementEventMap { + "SVGAbort": Event; + "SVGError": Event; + "resize": UIEvent; + "scroll": UIEvent; + "SVGUnload": Event; + "SVGZoom": SVGZoomEvent; +} + +interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewBox, SVGZoomAndPan { + contentScriptType: string; + contentStyleType: string; + currentScale: number; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; + onabort: (this: SVGSVGElement, ev: Event) => any; + onerror: (this: SVGSVGElement, ev: Event) => any; + onresize: (this: SVGSVGElement, ev: UIEvent) => any; + onscroll: (this: SVGSVGElement, ev: UIEvent) => any; + onunload: (this: SVGSVGElement, ev: Event) => any; + onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + createSVGAngle(): SVGAngle; + createSVGLength(): SVGLength; + createSVGMatrix(): SVGMatrix; + createSVGNumber(): SVGNumber; + createSVGPoint(): SVGPoint; + createSVGRect(): SVGRect; + createSVGTransform(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + deselectAll(): void; + forceRedraw(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getCurrentTime(): number; + getElementById(elementId: string): Element; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + pauseAnimations(): void; + setCurrentTime(seconds: number): void; + suspendRedraw(maxWaitMilliseconds: number): number; + unpauseAnimations(): void; + unsuspendRedraw(suspendHandleID: number): void; + unsuspendRedrawAll(): void; + addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface SVGScriptElement extends SVGElement, SVGURIReference { + type: string; + addEventListener(type: K, listener: (this: SVGScriptElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface SVGStopElement extends SVGElement { + readonly offset: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGStopElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface SVGStringList { + readonly numberOfItems: number; + appendItem(newItem: string): string; + clear(): void; + getItem(index: number): string; + initialize(newItem: string): string; + insertItemBefore(newItem: string, index: number): string; + removeItem(index: number): string; + replaceItem(newItem: string, index: number): string; +} + +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface SVGStyleElement extends SVGElement { + disabled: boolean; + media: string; + title: string; + type: string; + addEventListener(type: K, listener: (this: SVGStyleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface SVGSwitchElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGSwitchElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGSymbolElement extends SVGElement, SVGFitToViewBox { + addEventListener(type: K, listener: (this: SVGSymbolElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { + addEventListener(type: K, listener: (this: SVGTSpanElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface SVGTextContentElement extends SVGGraphicsElement { + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; + getCharNumAtPosition(point: SVGPoint): number; + getComputedTextLength(): number; + getEndPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGTextContentElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; +} + +interface SVGTextElement extends SVGTextPositioningElement { + addEventListener(type: K, listener: (this: SVGTextElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGTextPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; + addEventListener(type: K, listener: (this: SVGTextPositioningElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface SVGTitleElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGTitleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface SVGTransform { + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; + setMatrix(matrix: SVGMatrix): void; + setRotate(angle: number, cx: number, cy: number): void; + setScale(sx: number, sy: number): void; + setSkewX(angle: number): void; + setSkewY(angle: number): void; + setTranslate(tx: number, ty: number): void; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +interface SVGTransformList { + readonly numberOfItems: number; + appendItem(newItem: SVGTransform): SVGTransform; + clear(): void; + consolidate(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getItem(index: number): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + removeItem(index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; +} + +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface SVGUnitTypes { + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface SVGUseElement extends SVGGraphicsElement, SVGURIReference { + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGUseElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox { + readonly viewTarget: SVGStringList; + addEventListener(type: K, listener: (this: SVGViewElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface SVGZoomAndPan { + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; +} + +interface SVGZoomEvent extends UIEvent { + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; +} + +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface ScopedCredential { + readonly id: ArrayBuffer; + readonly type: ScopedCredentialType; +} + +declare var ScopedCredential: { + prototype: ScopedCredential; + new(): ScopedCredential; +} + +interface ScopedCredentialInfo { + readonly credential: ScopedCredential; + readonly publicKey: CryptoKey; +} + +declare var ScopedCredentialInfo: { + prototype: ScopedCredentialInfo; + new(): ScopedCredentialInfo; +} + +interface ScreenEventMap { + "MSOrientationChange": Event; +} + +interface Screen extends EventTarget { + readonly availHeight: number; + readonly availWidth: number; + bufferDepth: number; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; + onmsorientationchange: (this: Screen, ev: Event) => any; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; + msLockOrientation(orientations: string | string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface ScriptNotifyEvent extends Event { + readonly callingUri: string; + readonly value: string; +} + +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface ScriptProcessorNodeEventMap { + "audioprocess": AudioProcessingEvent; +} + +interface ScriptProcessorNode extends AudioNode { + readonly bufferSize: number; + onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; + addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ScriptProcessorNode: { + prototype: ScriptProcessorNode; + new(): ScriptProcessorNode; +} + +interface Selection { + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly baseNode: Node; + readonly baseOffset: number; + readonly extentNode: Node; + readonly extentOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; + addRange(range: Range): void; + collapse(parentNode: Node, offset: number): void; + collapseToEnd(): void; + collapseToStart(): void; + containsNode(node: Node, partlyContained: boolean): boolean; + deleteFromDocument(): void; + empty(): void; + extend(newNode: Node, offset: number): void; + getRangeAt(index: number): Range; + removeAllRanges(): void; + removeRange(range: Range): void; + selectAllChildren(parentNode: Node): void; + setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; + setPosition(parentNode: Node, offset: number): void; + toString(): string; +} + +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface ServiceWorkerEventMap extends AbstractWorkerEventMap { + "statechange": Event; +} + +interface ServiceWorker extends EventTarget, AbstractWorker { + onstatechange: (this: ServiceWorker, ev: Event) => any; + readonly scriptURL: USVString; + readonly state: ServiceWorkerState; + postMessage(message: any, transfer?: any[]): void; + addEventListener(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorker: { + prototype: ServiceWorker; + new(): ServiceWorker; +} + +interface ServiceWorkerContainerEventMap { + "controllerchange": Event; + "message": ServiceWorkerMessageEvent; +} + +interface ServiceWorkerContainer extends EventTarget { + readonly controller: ServiceWorker | null; + oncontrollerchange: (this: ServiceWorkerContainer, ev: Event) => any; + onmessage: (this: ServiceWorkerContainer, ev: ServiceWorkerMessageEvent) => any; + readonly ready: Promise; + getRegistration(clientURL?: USVString): Promise; + getRegistrations(): any; + register(scriptURL: USVString, options?: RegistrationOptions): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerContainer: { + prototype: ServiceWorkerContainer; + new(): ServiceWorkerContainer; +} + +interface ServiceWorkerMessageEvent extends Event { + readonly data: any; + readonly lastEventId: string; + readonly origin: string; + readonly ports: MessagePort[] | null; + readonly source: ServiceWorker | MessagePort | null; +} + +declare var ServiceWorkerMessageEvent: { + prototype: ServiceWorkerMessageEvent; + new(type: string, eventInitDict?: ServiceWorkerMessageEventInit): ServiceWorkerMessageEvent; +} + +interface ServiceWorkerRegistrationEventMap { + "updatefound": Event; +} + +interface ServiceWorkerRegistration extends EventTarget { + readonly active: ServiceWorker | null; + readonly installing: ServiceWorker | null; + onupdatefound: (this: ServiceWorkerRegistration, ev: Event) => any; + readonly pushManager: PushManager; + readonly scope: USVString; + readonly sync: SyncManager; + readonly waiting: ServiceWorker | null; + getNotifications(filter?: GetNotificationOptions): any; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerRegistration: { + prototype: ServiceWorkerRegistration; + new(): ServiceWorkerRegistration; +} + +interface SourceBuffer extends EventTarget { + appendWindowEnd: number; + appendWindowStart: number; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; + mode: AppendMode; + timestampOffset: number; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; + abort(): void; + appendBuffer(data: ArrayBuffer | ArrayBufferView): void; + appendStream(stream: MSStream, maxSize?: number): void; + remove(start: number, end: number): void; +} + +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface SourceBufferList extends EventTarget { + readonly length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} + +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface SpeechSynthesisEventMap { + "voiceschanged": Event; +} + +interface SpeechSynthesis extends EventTarget { + onvoiceschanged: (this: SpeechSynthesis, ev: Event) => any; + readonly paused: boolean; + readonly pending: boolean; + readonly speaking: boolean; + cancel(): void; + getVoices(): SpeechSynthesisVoice[]; + pause(): void; + resume(): void; + speak(utterance: SpeechSynthesisUtterance): void; + addEventListener(type: K, listener: (this: SpeechSynthesis, ev: SpeechSynthesisEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SpeechSynthesis: { + prototype: SpeechSynthesis; + new(): SpeechSynthesis; +} + +interface SpeechSynthesisEvent extends Event { + readonly charIndex: number; + readonly elapsedTime: number; + readonly name: string; + readonly utterance: SpeechSynthesisUtterance | null; +} + +declare var SpeechSynthesisEvent: { + prototype: SpeechSynthesisEvent; + new(type: string, eventInitDict?: SpeechSynthesisEventInit): SpeechSynthesisEvent; +} + +interface SpeechSynthesisUtteranceEventMap { + "boundary": Event; + "end": Event; + "error": Event; + "mark": Event; + "pause": Event; + "resume": Event; + "start": Event; +} + +interface SpeechSynthesisUtterance extends EventTarget { + lang: string; + onboundary: (this: SpeechSynthesisUtterance, ev: Event) => any; + onend: (this: SpeechSynthesisUtterance, ev: Event) => any; + onerror: (this: SpeechSynthesisUtterance, ev: Event) => any; + onmark: (this: SpeechSynthesisUtterance, ev: Event) => any; + onpause: (this: SpeechSynthesisUtterance, ev: Event) => any; + onresume: (this: SpeechSynthesisUtterance, ev: Event) => any; + onstart: (this: SpeechSynthesisUtterance, ev: Event) => any; + pitch: number; + rate: number; + text: string; + voice: SpeechSynthesisVoice; + volume: number; + addEventListener(type: K, listener: (this: SpeechSynthesisUtterance, ev: SpeechSynthesisUtteranceEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SpeechSynthesisUtterance: { + prototype: SpeechSynthesisUtterance; + new(text?: string): SpeechSynthesisUtterance; +} + +interface SpeechSynthesisVoice { + readonly default: boolean; + readonly lang: string; + readonly localService: boolean; + readonly name: string; + readonly voiceURI: string; +} + +declare var SpeechSynthesisVoice: { + prototype: SpeechSynthesisVoice; + new(): SpeechSynthesisVoice; +} + +interface StereoPannerNode extends AudioNode { + readonly pan: AudioParam; +} + +declare var StereoPannerNode: { + prototype: StereoPannerNode; + new(): StereoPannerNode; +} + +interface Storage { + readonly length: number; + clear(): void; + getItem(key: string): string | null; + key(index: number): string | null; + removeItem(key: string): void; + setItem(key: string, data: string): void; + [key: string]: any; + [index: number]: string; +} + +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface StorageEvent extends Event { + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; +} + +declare var StorageEvent: { + prototype: StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; +} + +interface StyleMedia { + readonly type: string; + matchMedium(mediaquery: string): boolean; +} + +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface StyleSheet { + disabled: boolean; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; +} + +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface StyleSheetList { + readonly length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} + +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface StyleSheetPageList { + readonly length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} + +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface SubtleCrypto { + decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; + encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + exportKey(format: "jwk", key: CryptoKey): PromiseLike; + exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; + unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; +} + +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface SyncManager { + getTags(): any; + register(tag: string): Promise; +} + +declare var SyncManager: { + prototype: SyncManager; + new(): SyncManager; +} + +interface Text extends CharacterData { + readonly wholeText: string; + readonly assignedSlot: HTMLSlotElement | null; + splitText(offset: number): Text; +} + +declare var Text: { + prototype: Text; + new(data?: string): Text; +} + +interface TextEvent extends UIEvent { + readonly data: string; + readonly inputMethod: number; + readonly locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +interface TextMetrics { + readonly width: number; +} + +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface TextTrackEventMap { + "cuechange": Event; + "error": Event; + "load": Event; +} + +interface TextTrack extends EventTarget { + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; + mode: any; + oncuechange: (this: TextTrack, ev: Event) => any; + onerror: (this: TextTrack, ev: Event) => any; + onload: (this: TextTrack, ev: Event) => any; + readonly readyState: number; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; + addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; +} + +interface TextTrackCueEventMap { + "enter": Event; + "exit": Event; +} + +interface TextTrackCue extends EventTarget { + endTime: number; + id: string; + onenter: (this: TextTrackCue, ev: Event) => any; + onexit: (this: TextTrackCue, ev: Event) => any; + pauseOnExit: boolean; + startTime: number; + text: string; + readonly track: TextTrack; + getCueAsHTML(): DocumentFragment; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface TextTrackCueList { + readonly length: number; + getCueById(id: string): TextTrackCue; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; +} + +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface TextTrackListEventMap { + "addtrack": TrackEvent; +} + +interface TextTrackList extends EventTarget { + readonly length: number; + onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; + item(index: number): TextTrack; + addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: TextTrack; +} + +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface TimeRanges { + readonly length: number; + end(index: number): number; + start(index: number): number; +} + +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface Touch { + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; +} + +declare var Touch: { + prototype: Touch; + new(): Touch; +} + +interface TouchEvent extends UIEvent { + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly keyCode: number; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; + readonly which: number; +} + +declare var TouchEvent: { + prototype: TouchEvent; + new(type: string, touchEventInit?: TouchEventInit): TouchEvent; +} + +interface TouchList { + readonly length: number; + item(index: number): Touch | null; + [index: number]: Touch; +} + +declare var TouchList: { + prototype: TouchList; + new(): TouchList; +} + +interface TrackEvent extends Event { + readonly track: VideoTrack | AudioTrack | TextTrack | null; +} + +declare var TrackEvent: { + prototype: TrackEvent; + new(typeArg: string, eventInitDict?: TrackEventInit): TrackEvent; +} + +interface TransitionEvent extends Event { + readonly elapsedTime: number; + readonly propertyName: string; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} + +declare var TransitionEvent: { + prototype: TransitionEvent; + new(typeArg: string, eventInitDict?: TransitionEventInit): TransitionEvent; +} + +interface TreeWalker { + currentNode: Node; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + firstChild(): Node; + lastChild(): Node; + nextNode(): Node; + nextSibling(): Node; + parentNode(): Node; + previousNode(): Node; + previousSibling(): Node; +} + +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface UIEvent extends Event { + readonly detail: number; + readonly view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} + +declare var UIEvent: { + prototype: UIEvent; + new(typeArg: string, eventInitDict?: UIEventInit): UIEvent; +} + +interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + readonly searchParams: URLSearchParams; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; + createObjectURL(object: any, options?: ObjectURLOptions): string; + revokeObjectURL(url: string): void; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { + readonly mediaType: string; +} + +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface ValidityState { + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; +} + +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface VideoPlaybackQuality { + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; +} + +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface VideoTrack { + readonly id: string; + kind: string; + readonly label: string; + language: string; + selected: boolean; + readonly sourceBuffer: SourceBuffer; +} + +declare var VideoTrack: { + prototype: VideoTrack; + new(): VideoTrack; +} + +interface VideoTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + +interface VideoTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; + onchange: (this: VideoTrackList, ev: Event) => any; + onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; + item(index: number): VideoTrack; + addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: VideoTrack; +} + +declare var VideoTrackList: { + prototype: VideoTrackList; + new(): VideoTrackList; +} + +interface WEBGL_compressed_texture_s3tc { + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WEBGL_debug_renderer_info { + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +declare var WEBGL_debug_renderer_info: { + prototype: WEBGL_debug_renderer_info; + new(): WEBGL_debug_renderer_info; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +interface WEBGL_depth_texture { + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +declare var WEBGL_depth_texture: { + prototype: WEBGL_depth_texture; + new(): WEBGL_depth_texture; + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +interface WaveShaperNode extends AudioNode { + curve: Float32Array | null; + oversample: OverSampleType; +} + +declare var WaveShaperNode: { + prototype: WaveShaperNode; + new(): WaveShaperNode; +} + +interface WebAuthentication { + getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise; + makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise; +} + +declare var WebAuthentication: { + prototype: WebAuthentication; + new(): WebAuthentication; +} + +interface WebAuthnAssertion { + readonly authenticatorData: ArrayBuffer; + readonly clientData: ArrayBuffer; + readonly credential: ScopedCredential; + readonly signature: ArrayBuffer; +} + +declare var WebAuthnAssertion: { + prototype: WebAuthnAssertion; + new(): WebAuthnAssertion; +} + +interface WebGLActiveInfo { + readonly name: string; + readonly size: number; + readonly type: number; +} + +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WebGLBuffer extends WebGLObject { +} + +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLContextEvent extends Event { + readonly statusMessage: string; +} + +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(typeArg: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; +} + +interface WebGLFramebuffer extends WebGLObject { +} + +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLObject { +} + +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLProgram extends WebGLObject { +} + +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface WebGLRenderbuffer extends WebGLObject { +} + +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLRenderingContext { + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; + activeTexture(texture: number): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + blendEquation(mode: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + blendFunc(sfactor: number, dfactor: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; + checkFramebufferStatus(target: number): number; + clear(mask: number): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + clearDepth(depth: number): void; + clearStencil(s: number): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compileShader(shader: WebGLShader | null): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; + cullFace(mode: number): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; + depthFunc(func: number): void; + depthMask(flag: boolean): void; + depthRange(zNear: number, zFar: number): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + disable(cap: number): void; + disableVertexAttribArray(index: number): void; + drawArrays(mode: number, first: number, count: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + enable(cap: number): void; + enableVertexAttribArray(index: number): void; + finish(): void; + flush(): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; + frontFace(mode: number): void; + generateMipmap(target: number): void; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; + getBufferParameter(target: number, pname: number): any; + getContextAttributes(): WebGLContextAttributes; + getError(): number; + getExtension(name: string): any; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + getParameter(pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; + getRenderbufferParameter(target: number, pname: number): any; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; + getTexParameter(target: number, pname: number): any; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; + getVertexAttrib(index: number, pname: number): any; + getVertexAttribOffset(index: number, pname: number): number; + hint(target: number, mode: number): void; + isBuffer(buffer: WebGLBuffer | null): boolean; + isContextLost(): boolean; + isEnabled(cap: number): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; + lineWidth(width: number): void; + linkProgram(program: WebGLProgram | null): void; + pixelStorei(pname: number, param: number | boolean): void; + polygonOffset(factor: number, units: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + sampleCoverage(value: number, invert: boolean): void; + scissor(x: number, y: number, width: number, height: number): void; + shaderSource(shader: WebGLShader | null, source: string): void; + stencilFunc(func: number, ref: number, mask: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + stencilMask(mask: number): void; + stencilMaskSeparate(face: number, mask: number): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texParameterf(target: number, pname: number, param: number): void; + texParameteri(target: number, pname: number, param: number): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; + vertexAttrib1f(indx: number, x: number): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib2f(indx: number, x: number, y: number): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + viewport(x: number, y: number, width: number, height: number): void; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +interface WebGLShader extends WebGLObject { +} + +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface WebGLShaderPrecisionFormat { + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; +} + +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface WebGLTexture extends WebGLObject { +} + +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface WebGLUniformLocation { +} + +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebKitCSSMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m13: number; + m14: number; + m21: number; + m22: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m41: number; + m42: number; + m43: number; + m44: number; + inverse(): WebKitCSSMatrix; + multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; + rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; + setMatrixValue(value: string): void; + skewX(angle: number): WebKitCSSMatrix; + skewY(angle: number): WebKitCSSMatrix; + toString(): string; + translate(x: number, y: number, z?: number): WebKitCSSMatrix; +} + +declare var WebKitCSSMatrix: { + prototype: WebKitCSSMatrix; + new(text?: string): WebKitCSSMatrix; +} + +interface WebKitDirectoryEntry extends WebKitEntry { + createReader(): WebKitDirectoryReader; +} + +declare var WebKitDirectoryEntry: { + prototype: WebKitDirectoryEntry; + new(): WebKitDirectoryEntry; +} + +interface WebKitDirectoryReader { + readEntries(successCallback: WebKitEntriesCallback, errorCallback?: WebKitErrorCallback): void; +} + +declare var WebKitDirectoryReader: { + prototype: WebKitDirectoryReader; + new(): WebKitDirectoryReader; +} + +interface WebKitEntry { + readonly filesystem: WebKitFileSystem; + readonly fullPath: string; + readonly isDirectory: boolean; + readonly isFile: boolean; + readonly name: string; +} + +declare var WebKitEntry: { + prototype: WebKitEntry; + new(): WebKitEntry; +} + +interface WebKitFileEntry extends WebKitEntry { + file(successCallback: WebKitFileCallback, errorCallback?: WebKitErrorCallback): void; +} + +declare var WebKitFileEntry: { + prototype: WebKitFileEntry; + new(): WebKitFileEntry; +} + +interface WebKitFileSystem { + readonly name: string; + readonly root: WebKitDirectoryEntry; +} + +declare var WebKitFileSystem: { + prototype: WebKitFileSystem; + new(): WebKitFileSystem; +} + +interface WebKitPoint { + x: number; + y: number; +} + +declare var WebKitPoint: { + prototype: WebKitPoint; + new(x?: number, y?: number): WebKitPoint; +} + +interface WebSocketEventMap { + "close": CloseEvent; + "error": Event; + "message": MessageEvent; + "open": Event; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: Event) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface WheelEvent extends MouseEvent { + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; + getCurrentPoint(element: Element): void; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +declare var WheelEvent: { + prototype: WheelEvent; + new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +interface WindowEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "compassneedscalibration": Event; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "devicelight": DeviceLightEvent; + "devicemotion": DeviceMotionEvent; + "deviceorientation": DeviceOrientationEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "message": MessageEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "pause": Event; + "play": Event; + "playing": Event; + "popstate": PopStateEvent; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "resize": UIEvent; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "stalled": Event; + "storage": StorageEvent; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "unload": Event; + "volumechange": Event; + "waiting": Event; +} + +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch { + readonly applicationCache: ApplicationCache; + readonly caches: CacheStorage; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; + defaultStatus: string; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; + event: Event | undefined; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly isSecureContext: boolean; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msContentScript: ExtensionScriptApis; + readonly msCredentials: MSCredentials; + name: string; + readonly navigator: Navigator; + offscreenBuffering: string | boolean; + onabort: (this: Window, ev: UIEvent) => any; + onafterprint: (this: Window, ev: Event) => any; + onbeforeprint: (this: Window, ev: Event) => any; + onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; + onblur: (this: Window, ev: FocusEvent) => any; + oncanplay: (this: Window, ev: Event) => any; + oncanplaythrough: (this: Window, ev: Event) => any; + onchange: (this: Window, ev: Event) => any; + onclick: (this: Window, ev: MouseEvent) => any; + oncompassneedscalibration: (this: Window, ev: Event) => any; + oncontextmenu: (this: Window, ev: PointerEvent) => any; + ondblclick: (this: Window, ev: MouseEvent) => any; + ondevicelight: (this: Window, ev: DeviceLightEvent) => any; + ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; + ondrag: (this: Window, ev: DragEvent) => any; + ondragend: (this: Window, ev: DragEvent) => any; + ondragenter: (this: Window, ev: DragEvent) => any; + ondragleave: (this: Window, ev: DragEvent) => any; + ondragover: (this: Window, ev: DragEvent) => any; + ondragstart: (this: Window, ev: DragEvent) => any; + ondrop: (this: Window, ev: DragEvent) => any; + ondurationchange: (this: Window, ev: Event) => any; + onemptied: (this: Window, ev: Event) => any; + onended: (this: Window, ev: MediaStreamErrorEvent) => any; + onerror: ErrorEventHandler; + onfocus: (this: Window, ev: FocusEvent) => any; + onhashchange: (this: Window, ev: HashChangeEvent) => any; + oninput: (this: Window, ev: Event) => any; + oninvalid: (this: Window, ev: Event) => any; + onkeydown: (this: Window, ev: KeyboardEvent) => any; + onkeypress: (this: Window, ev: KeyboardEvent) => any; + onkeyup: (this: Window, ev: KeyboardEvent) => any; + onload: (this: Window, ev: Event) => any; + onloadeddata: (this: Window, ev: Event) => any; + onloadedmetadata: (this: Window, ev: Event) => any; + onloadstart: (this: Window, ev: Event) => any; + onmessage: (this: Window, ev: MessageEvent) => any; + onmousedown: (this: Window, ev: MouseEvent) => any; + onmouseenter: (this: Window, ev: MouseEvent) => any; + onmouseleave: (this: Window, ev: MouseEvent) => any; + onmousemove: (this: Window, ev: MouseEvent) => any; + onmouseout: (this: Window, ev: MouseEvent) => any; + onmouseover: (this: Window, ev: MouseEvent) => any; + onmouseup: (this: Window, ev: MouseEvent) => any; + onmousewheel: (this: Window, ev: WheelEvent) => any; + onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; + onmsgestureend: (this: Window, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; + onmspointercancel: (this: Window, ev: MSPointerEvent) => any; + onmspointerdown: (this: Window, ev: MSPointerEvent) => any; + onmspointerenter: (this: Window, ev: MSPointerEvent) => any; + onmspointerleave: (this: Window, ev: MSPointerEvent) => any; + onmspointermove: (this: Window, ev: MSPointerEvent) => any; + onmspointerout: (this: Window, ev: MSPointerEvent) => any; + onmspointerover: (this: Window, ev: MSPointerEvent) => any; + onmspointerup: (this: Window, ev: MSPointerEvent) => any; + onoffline: (this: Window, ev: Event) => any; + ononline: (this: Window, ev: Event) => any; + onorientationchange: (this: Window, ev: Event) => any; + onpagehide: (this: Window, ev: PageTransitionEvent) => any; + onpageshow: (this: Window, ev: PageTransitionEvent) => any; + onpause: (this: Window, ev: Event) => any; + onplay: (this: Window, ev: Event) => any; + onplaying: (this: Window, ev: Event) => any; + onpopstate: (this: Window, ev: PopStateEvent) => any; + onprogress: (this: Window, ev: ProgressEvent) => any; + onratechange: (this: Window, ev: Event) => any; + onreadystatechange: (this: Window, ev: ProgressEvent) => any; + onreset: (this: Window, ev: Event) => any; + onresize: (this: Window, ev: UIEvent) => any; + onscroll: (this: Window, ev: UIEvent) => any; + onseeked: (this: Window, ev: Event) => any; + onseeking: (this: Window, ev: Event) => any; + onselect: (this: Window, ev: UIEvent) => any; + onstalled: (this: Window, ev: Event) => any; + onstorage: (this: Window, ev: StorageEvent) => any; + onsubmit: (this: Window, ev: Event) => any; + onsuspend: (this: Window, ev: Event) => any; + ontimeupdate: (this: Window, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onunload: (this: Window, ev: Event) => any; + onvolumechange: (this: Window, ev: Event) => any; + onwaiting: (this: Window, ev: Event) => any; + opener: any; + orientation: string | number; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; + readonly speechSynthesis: SpeechSynthesis; + status: string; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; + URLSearchParams: typeof URLSearchParams; + Blob: typeof Blob; + customElements: CustomElementRegistry; + alert(message?: any): void; + blur(): void; + cancelAnimationFrame(handle: number): void; + captureEvents(): void; + close(): void; + confirm(message?: string): boolean; + departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; + focus(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; + getSelection(): Selection; + matchMedia(mediaQuery: string): MediaQueryList; + moveBy(x?: number, y?: number): void; + moveTo(x?: number, y?: number): void; + msWriteProfilerMark(profilerMarkName: string): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; + print(): void; + prompt(message?: string, _default?: string): string | null; + releaseEvents(): void; + requestAnimationFrame(callback: FrameRequestCallback): number; + resizeBy(x?: number, y?: number): void; + resizeTo(x?: number, y?: number): void; + scroll(x?: number, y?: number): void; + scrollBy(x?: number, y?: number): void; + scrollTo(x?: number, y?: number): void; + stop(): void; + webkitCancelAnimationFrame(handle: number): void; + webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; + webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; + scroll(options?: ScrollToOptions): void; + scrollTo(options?: ScrollToOptions): void; + scrollBy(options?: ScrollToOptions): void; + addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Window: { + prototype: Window; + new(): Window; +} + +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: Worker, ev: MessageEvent) => any; + postMessage(message: any, transfer?: any[]): void; + terminate(): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLDocument extends Document { + addEventListener(type: K, listener: (this: XMLDocument, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: XMLHttpRequestResponseType; + readonly responseURL: string; + readonly responseXML: Document | null; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: Document): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} + +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface XPathEvaluator { + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver?: Node): XPathNSResolver; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; +} + +declare var XPathEvaluator: { + prototype: XPathEvaluator; + new(): XPathEvaluator; +} + +interface XPathExpression { + evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; +} + +declare var XPathExpression: { + prototype: XPathExpression; + new(): XPathExpression; +} + +interface XPathNSResolver { + lookupNamespaceURI(prefix: string): string; +} + +declare var XPathNSResolver: { + prototype: XPathNSResolver; + new(): XPathNSResolver; +} + +interface XPathResult { + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; + iterateNext(): Node; + snapshotItem(index: number): Node; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +declare var XPathResult: { + prototype: XPathResult; + new(): XPathResult; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +interface XSLTProcessor { + clearParameters(): void; + getParameter(namespaceURI: string, localName: string): any; + importStylesheet(style: Node): void; + removeParameter(namespaceURI: string, localName: string): void; + reset(): void; + setParameter(namespaceURI: string, localName: string, value: any): void; + transformToDocument(source: Node): Document; + transformToFragment(source: Node, document: Document): DocumentFragment; +} + +declare var XSLTProcessor: { + prototype: XSLTProcessor; + new(): XSLTProcessor; +} + +interface webkitRTCPeerConnection extends RTCPeerConnection { + addEventListener(type: K, listener: (this: webkitRTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var webkitRTCPeerConnection: { + prototype: webkitRTCPeerConnection; + new(configuration: RTCConfiguration): webkitRTCPeerConnection; +} + +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + +interface AbstractWorker { + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface Body { + readonly bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; + formData(): Promise; +} + +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + +interface ChildNode { + remove(): void; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface DocumentEvent { + createEvent(eventInterface:"AnimationEvent"): AnimationEvent; + createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface:"CloseEvent"): CloseEvent; + createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; + createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface:"DragEvent"): DragEvent; + createEvent(eventInterface:"ErrorEvent"): ErrorEvent; + createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; + createEvent(eventInterface:"FocusEvent"): FocusEvent; + createEvent(eventInterface:"FocusNavigationEvent"): FocusNavigationEvent; + createEvent(eventInterface:"GamepadEvent"): GamepadEvent; + createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; + createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; + createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; + createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamEvent"): MediaStreamEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface:"MessageEvent"): MessageEvent; + createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; + createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; + createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface:"NavigationEvent"): NavigationEvent; + createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; + createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; + createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface:"PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; + createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; + createEvent(eventInterface:"PointerEvent"): PointerEvent; + createEvent(eventInterface:"PopStateEvent"): PopStateEvent; + createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; + createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; + createEvent(eventInterface:"ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent; + createEvent(eventInterface:"SpeechSynthesisEvent"): SpeechSynthesisEvent; + createEvent(eventInterface:"StorageEvent"): StorageEvent; + createEvent(eventInterface:"TextEvent"): TextEvent; + createEvent(eventInterface:"TouchEvent"): TouchEvent; + createEvent(eventInterface:"TrackEvent"): TrackEvent; + createEvent(eventInterface:"TransitionEvent"): TransitionEvent; + createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; + createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface:"WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface ElementTraversal { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; + readonly nextElementSibling: Element | null; + readonly previousElementSibling: Element | null; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface GlobalEventHandlersEventMap { + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerup": PointerEvent; + "wheel": WheelEvent; +} + +interface GlobalEventHandlers { + onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface GlobalFetch { + fetch(input: RequestInfo, init?: RequestInit): Promise; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; +} + +interface IDBEnvironment { + readonly indexedDB: IDBFactory; +} + +interface LinkStyle { + readonly sheet: StyleSheet; +} + +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + +interface MSBaseReader { + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSNavigatorDoNotTrack { + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; +} + +interface NavigatorBeacon { + sendBeacon(url: USVString, data?: BodyInit): boolean; +} + +interface NavigatorConcurrentHardware { + readonly hardwareConcurrency: number; +} + +interface NavigatorContentUtils { +} + +interface NavigatorGeolocation { + readonly geolocation: Geolocation; +} + +interface NavigatorID { + readonly appCodeName: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface NavigatorStorageUtils { +} + +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + +interface NodeSelector { + querySelector(selectors: K): ElementTagNameMap[K] | null; + querySelector(selectors: string): Element | null; + querySelectorAll(selectors: K): ElementListTagNameMap[K]; + querySelectorAll(selectors: string): NodeListOf; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SVGAnimatedPoints { + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; +} + +interface SVGFilterPrimitiveStandardAttributes { + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; +} + +interface SVGFitToViewBox { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; +} + +interface SVGTests { + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface SVGURIReference { + readonly href: SVGAnimatedString; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface WindowLocalStorage { + readonly localStorage: Storage; +} + +interface WindowSessionStorage { + readonly sessionStorage: Storage; +} + +interface WindowTimers extends Object, WindowTimersExtension { + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface WindowTimersExtension { + clearImmediate(handle: number): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; +} + +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface ErrorEventInit { + message?: string; + filename?: string; + lineno?: number; + conlno?: number; + error?: any; +} + +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + +interface Canvas2DContextAttributes { + alpha?: boolean; + willReadFrequently?: boolean; + storage?: boolean; + [attribute: string]: boolean | string | undefined; +} + +interface ImageBitmapOptions { + imageOrientation?: "none" | "flipY"; + premultiplyAlpha?: "none" | "premultiply" | "default"; + colorSpaceConversion?: "none" | "default"; + resizeWidth?: number; + resizeHeight?: number; + resizeQuality?: "pixelated" | "low" | "medium" | "high"; +} + +interface ImageBitmap { + readonly width: number; + readonly height: number; + close(): void; +} + +interface URLSearchParams { + /** + * Appends a specified key/value pair as a new search parameter. + */ + append(name: string, value: string): void; + /** + * Deletes the given search parameter, and its associated value, from the list of all search parameters. + */ + delete(name: string): void; + /** + * Returns the first value associated to the given search parameter. + */ + get(name: string): string | null; + /** + * Returns all the values association with a given search parameter. + */ + getAll(name: string): string[]; + /** + * Returns a Boolean indicating if such a search parameter exists. + */ + has(name: string): boolean; + /** + * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. + */ + set(name: string, value: string): void; +} + +declare var URLSearchParams: { + prototype: URLSearchParams; + /** + * Constructor returning a URLSearchParams object. + */ + new (init?: string | URLSearchParams): URLSearchParams; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface ScrollOptions { + behavior?: ScrollBehavior; +} + +interface ScrollToOptions extends ScrollOptions { + left?: number; + top?: number; +} + +interface ScrollIntoViewOptions extends ScrollOptions { + block?: ScrollLogicalPosition; + inline?: ScrollLogicalPosition; +} + +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +interface ParentNode { + readonly children: HTMLCollection; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; + readonly childElementCount: number; +} + +interface DocumentOrShadowRoot { + readonly activeElement: Element | null; + readonly stylesheets: StyleSheetList; + getSelection(): Selection | null; + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; +} + +interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { + readonly host: Element; + innerHTML: string; +} + +interface ShadowRootInit { + mode: 'open'|'closed'; + delegatesFocus?: boolean; +} + +interface HTMLSlotElement extends HTMLElement { + name: string; + assignedNodes(options?: AssignedNodesOptions): Node[]; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + +interface ElementDefinitionOptions { + extends: string; +} + +interface CustomElementRegistry { + define(name: string, constructor: Function, options?: ElementDefinitionOptions): void; + get(name: string): any; + whenDefined(name: string): PromiseLike; +} + +interface PromiseRejectionEvent extends Event { + readonly promise: PromiseLike; + readonly reason: any; +} + +interface PromiseRejectionEventInit extends EventInit { + promise: PromiseLike; + reason?: any; +} + +interface EventListenerOptions { + capture?: boolean; +} + +interface AddEventListenerOptions extends EventListenerOptions { + passive?: boolean; + once?: boolean; +} + +interface TouchEventInit extends EventModifierInit { + touches?: Touch[]; + targetTouches?: Touch[]; + changedTouches?: Touch[]; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} +interface MSLaunchUriCallback { + (): void; +} +interface FrameRequestCallback { + (time: number): void; +} +interface MSUnsafeFunctionCallback { + (): any; +} +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface VoidFunction { + (): void; +} +interface RTCSessionDescriptionCallback { + (sdp: RTCSessionDescription): void; +} +interface RTCPeerConnectionErrorCallback { + (error: DOMError): void; +} +interface RTCStatsCallback { + (report: RTCStatsReport): void; +} +interface FunctionStringCallback { + (data: string): void; +} +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: MediaKeyStatus): void; +} +interface NotificationPermissionCallback { + (permission: NotificationPermission): void; +} +interface IntersectionObserverCallback { + (entries: IntersectionObserverEntry[], observer: IntersectionObserver): void; +} +interface HTMLElementTagNameMap { + "a": HTMLAnchorElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "audio": HTMLAudioElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "data": HTMLDataElement; + "datalist": HTMLDataListElement; + "del": HTMLModElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "embed": HTMLEmbedElement; + "fieldset": HTMLFieldSetElement; + "font": HTMLFontElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "iframe": HTMLIFrameElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "marquee": HTMLMarqueeElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "meter": HTMLMeterElement; + "nextid": HTMLUnknownElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "output": HTMLOutputElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "picture": HTMLPictureElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "script": HTMLScriptElement; + "select": HTMLSelectElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "style": HTMLStyleElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "time": HTMLTimeElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "ul": HTMLUListElement; + "video": HTMLVideoElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementTagNameMap { + "a": HTMLAnchorElement; + "abbr": HTMLElement; + "acronym": HTMLElement; + "address": HTMLElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "article": HTMLElement; + "aside": HTMLElement; + "audio": HTMLAudioElement; + "b": HTMLElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "bdo": HTMLElement; + "big": HTMLElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "center": HTMLElement; + "circle": SVGCircleElement; + "cite": HTMLElement; + "clippath": SVGClipPathElement; + "code": HTMLElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "data": HTMLDataElement; + "datalist": HTMLDataListElement; + "dd": HTMLElement; + "defs": SVGDefsElement; + "del": HTMLModElement; + "desc": SVGDescElement; + "dfn": HTMLElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "dt": HTMLElement; + "ellipse": SVGEllipseElement; + "em": HTMLElement; + "embed": HTMLEmbedElement; + "feblend": SVGFEBlendElement; + "fecolormatrix": SVGFEColorMatrixElement; + "fecomponenttransfer": SVGFEComponentTransferElement; + "fecomposite": SVGFECompositeElement; + "feconvolvematrix": SVGFEConvolveMatrixElement; + "fediffuselighting": SVGFEDiffuseLightingElement; + "fedisplacementmap": SVGFEDisplacementMapElement; + "fedistantlight": SVGFEDistantLightElement; + "feflood": SVGFEFloodElement; + "fefunca": SVGFEFuncAElement; + "fefuncb": SVGFEFuncBElement; + "fefuncg": SVGFEFuncGElement; + "fefuncr": SVGFEFuncRElement; + "fegaussianblur": SVGFEGaussianBlurElement; + "feimage": SVGFEImageElement; + "femerge": SVGFEMergeElement; + "femergenode": SVGFEMergeNodeElement; + "femorphology": SVGFEMorphologyElement; + "feoffset": SVGFEOffsetElement; + "fepointlight": SVGFEPointLightElement; + "fespecularlighting": SVGFESpecularLightingElement; + "fespotlight": SVGFESpotLightElement; + "fetile": SVGFETileElement; + "feturbulence": SVGFETurbulenceElement; + "fieldset": HTMLFieldSetElement; + "figcaption": HTMLElement; + "figure": HTMLElement; + "filter": SVGFilterElement; + "font": HTMLFontElement; + "footer": HTMLElement; + "foreignobject": SVGForeignObjectElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "g": SVGGElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "header": HTMLElement; + "hgroup": HTMLElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "i": HTMLElement; + "iframe": HTMLIFrameElement; + "image": SVGImageElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "kbd": HTMLElement; + "keygen": HTMLElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "line": SVGLineElement; + "lineargradient": SVGLinearGradientElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "mark": HTMLElement; + "marker": SVGMarkerElement; + "marquee": HTMLMarqueeElement; + "mask": SVGMaskElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "metadata": SVGMetadataElement; + "meter": HTMLMeterElement; + "nav": HTMLElement; + "nextid": HTMLUnknownElement; + "nobr": HTMLElement; + "noframes": HTMLElement; + "noscript": HTMLElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "output": HTMLOutputElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "path": SVGPathElement; + "pattern": SVGPatternElement; + "picture": HTMLPictureElement; + "plaintext": HTMLElement; + "polygon": SVGPolygonElement; + "polyline": SVGPolylineElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "radialgradient": SVGRadialGradientElement; + "rect": SVGRectElement; + "rt": HTMLElement; + "ruby": HTMLElement; + "s": HTMLElement; + "samp": HTMLElement; + "script": HTMLScriptElement; + "section": HTMLElement; + "select": HTMLSelectElement; + "small": HTMLElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "stop": SVGStopElement; + "strike": HTMLElement; + "strong": HTMLElement; + "style": HTMLStyleElement; + "sub": HTMLElement; + "sup": HTMLElement; + "svg": SVGSVGElement; + "switch": SVGSwitchElement; + "symbol": SVGSymbolElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "text": SVGTextElement; + "textpath": SVGTextPathElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "time": HTMLTimeElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "tspan": SVGTSpanElement; + "tt": HTMLElement; + "u": HTMLElement; + "ul": HTMLUListElement; + "use": SVGUseElement; + "var": HTMLElement; + "video": HTMLVideoElement; + "view": SVGViewElement; + "wbr": HTMLElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementListTagNameMap { + "a": NodeListOf; + "abbr": NodeListOf; + "acronym": NodeListOf; + "address": NodeListOf; + "applet": NodeListOf; + "area": NodeListOf; + "article": NodeListOf; + "aside": NodeListOf; + "audio": NodeListOf; + "b": NodeListOf; + "base": NodeListOf; + "basefont": NodeListOf; + "bdo": NodeListOf; + "big": NodeListOf; + "blockquote": NodeListOf; + "body": NodeListOf; + "br": NodeListOf; + "button": NodeListOf; + "canvas": NodeListOf; + "caption": NodeListOf; + "center": NodeListOf; + "circle": NodeListOf; + "cite": NodeListOf; + "clippath": NodeListOf; + "code": NodeListOf; + "col": NodeListOf; + "colgroup": NodeListOf; + "data": NodeListOf; + "datalist": NodeListOf; + "dd": NodeListOf; + "defs": NodeListOf; + "del": NodeListOf; + "desc": NodeListOf; + "dfn": NodeListOf; + "dir": NodeListOf; + "div": NodeListOf; + "dl": NodeListOf; + "dt": NodeListOf; + "ellipse": NodeListOf; + "em": NodeListOf; + "embed": NodeListOf; + "feblend": NodeListOf; + "fecolormatrix": NodeListOf; + "fecomponenttransfer": NodeListOf; + "fecomposite": NodeListOf; + "feconvolvematrix": NodeListOf; + "fediffuselighting": NodeListOf; + "fedisplacementmap": NodeListOf; + "fedistantlight": NodeListOf; + "feflood": NodeListOf; + "fefunca": NodeListOf; + "fefuncb": NodeListOf; + "fefuncg": NodeListOf; + "fefuncr": NodeListOf; + "fegaussianblur": NodeListOf; + "feimage": NodeListOf; + "femerge": NodeListOf; + "femergenode": NodeListOf; + "femorphology": NodeListOf; + "feoffset": NodeListOf; + "fepointlight": NodeListOf; + "fespecularlighting": NodeListOf; + "fespotlight": NodeListOf; + "fetile": NodeListOf; + "feturbulence": NodeListOf; + "fieldset": NodeListOf; + "figcaption": NodeListOf; + "figure": NodeListOf; + "filter": NodeListOf; + "font": NodeListOf; + "footer": NodeListOf; + "foreignobject": NodeListOf; + "form": NodeListOf; + "frame": NodeListOf; + "frameset": NodeListOf; + "g": NodeListOf; + "h1": NodeListOf; + "h2": NodeListOf; + "h3": NodeListOf; + "h4": NodeListOf; + "h5": NodeListOf; + "h6": NodeListOf; + "head": NodeListOf; + "header": NodeListOf; + "hgroup": NodeListOf; + "hr": NodeListOf; + "html": NodeListOf; + "i": NodeListOf; + "iframe": NodeListOf; + "image": NodeListOf; + "img": NodeListOf; + "input": NodeListOf; + "ins": NodeListOf; + "isindex": NodeListOf; + "kbd": NodeListOf; + "keygen": NodeListOf; + "label": NodeListOf; + "legend": NodeListOf; + "li": NodeListOf; + "line": NodeListOf; + "lineargradient": NodeListOf; + "link": NodeListOf; + "listing": NodeListOf; + "map": NodeListOf; + "mark": NodeListOf; + "marker": NodeListOf; + "marquee": NodeListOf; + "mask": NodeListOf; + "menu": NodeListOf; + "meta": NodeListOf; + "metadata": NodeListOf; + "meter": NodeListOf; + "nav": NodeListOf; + "nextid": NodeListOf; + "nobr": NodeListOf; + "noframes": NodeListOf; + "noscript": NodeListOf; + "object": NodeListOf; + "ol": NodeListOf; + "optgroup": NodeListOf; + "option": NodeListOf; + "output": NodeListOf; + "p": NodeListOf; + "param": NodeListOf; + "path": NodeListOf; + "pattern": NodeListOf; + "picture": NodeListOf; + "plaintext": NodeListOf; + "polygon": NodeListOf; + "polyline": NodeListOf; + "pre": NodeListOf; + "progress": NodeListOf; + "q": NodeListOf; + "radialgradient": NodeListOf; + "rect": NodeListOf; + "rt": NodeListOf; + "ruby": NodeListOf; + "s": NodeListOf; + "samp": NodeListOf; + "script": NodeListOf; + "section": NodeListOf; + "select": NodeListOf; + "small": NodeListOf; + "source": NodeListOf; + "span": NodeListOf; + "stop": NodeListOf; + "strike": NodeListOf; + "strong": NodeListOf; + "style": NodeListOf; + "sub": NodeListOf; + "sup": NodeListOf; + "svg": NodeListOf; + "switch": NodeListOf; + "symbol": NodeListOf; + "table": NodeListOf; + "tbody": NodeListOf; + "td": NodeListOf; + "template": NodeListOf; + "text": NodeListOf; + "textpath": NodeListOf; + "textarea": NodeListOf; + "tfoot": NodeListOf; + "th": NodeListOf; + "thead": NodeListOf; + "time": NodeListOf; + "title": NodeListOf; + "tr": NodeListOf; + "track": NodeListOf; + "tspan": NodeListOf; + "tt": NodeListOf; + "u": NodeListOf; + "ul": NodeListOf; + "use": NodeListOf; + "var": NodeListOf; + "video": NodeListOf; + "view": NodeListOf; + "wbr": NodeListOf; + "x-ms-webview": NodeListOf; + "xmp": NodeListOf; +} + +declare var Audio: {new(src?: string): HTMLAudioElement; }; +declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; +declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; +declare var applicationCache: ApplicationCache; +declare var caches: CacheStorage; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var crypto: Crypto; +declare var defaultStatus: string; +declare var devicePixelRatio: number; +declare var doNotTrack: string; +declare var document: Document; +declare var event: Event | undefined; +declare var external: External; +declare var frameElement: Element; +declare var frames: Window; +declare var history: History; +declare var innerHeight: number; +declare var innerWidth: number; +declare var isSecureContext: boolean; +declare var length: number; +declare var location: Location; +declare var locationbar: BarProp; +declare var menubar: BarProp; +declare var msContentScript: ExtensionScriptApis; +declare var msCredentials: MSCredentials; +declare const name: never; +declare var navigator: Navigator; +declare var offscreenBuffering: string | boolean; +declare var onabort: (this: Window, ev: UIEvent) => any; +declare var onafterprint: (this: Window, ev: Event) => any; +declare var onbeforeprint: (this: Window, ev: Event) => any; +declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; +declare var onblur: (this: Window, ev: FocusEvent) => any; +declare var oncanplay: (this: Window, ev: Event) => any; +declare var oncanplaythrough: (this: Window, ev: Event) => any; +declare var onchange: (this: Window, ev: Event) => any; +declare var onclick: (this: Window, ev: MouseEvent) => any; +declare var oncompassneedscalibration: (this: Window, ev: Event) => any; +declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; +declare var ondblclick: (this: Window, ev: MouseEvent) => any; +declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; +declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; +declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; +declare var ondrag: (this: Window, ev: DragEvent) => any; +declare var ondragend: (this: Window, ev: DragEvent) => any; +declare var ondragenter: (this: Window, ev: DragEvent) => any; +declare var ondragleave: (this: Window, ev: DragEvent) => any; +declare var ondragover: (this: Window, ev: DragEvent) => any; +declare var ondragstart: (this: Window, ev: DragEvent) => any; +declare var ondrop: (this: Window, ev: DragEvent) => any; +declare var ondurationchange: (this: Window, ev: Event) => any; +declare var onemptied: (this: Window, ev: Event) => any; +declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; +declare var onerror: ErrorEventHandler; +declare var onfocus: (this: Window, ev: FocusEvent) => any; +declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; +declare var oninput: (this: Window, ev: Event) => any; +declare var oninvalid: (this: Window, ev: Event) => any; +declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; +declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; +declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; +declare var onload: (this: Window, ev: Event) => any; +declare var onloadeddata: (this: Window, ev: Event) => any; +declare var onloadedmetadata: (this: Window, ev: Event) => any; +declare var onloadstart: (this: Window, ev: Event) => any; +declare var onmessage: (this: Window, ev: MessageEvent) => any; +declare var onmousedown: (this: Window, ev: MouseEvent) => any; +declare var onmouseenter: (this: Window, ev: MouseEvent) => any; +declare var onmouseleave: (this: Window, ev: MouseEvent) => any; +declare var onmousemove: (this: Window, ev: MouseEvent) => any; +declare var onmouseout: (this: Window, ev: MouseEvent) => any; +declare var onmouseover: (this: Window, ev: MouseEvent) => any; +declare var onmouseup: (this: Window, ev: MouseEvent) => any; +declare var onmousewheel: (this: Window, ev: WheelEvent) => any; +declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; +declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; +declare var onoffline: (this: Window, ev: Event) => any; +declare var ononline: (this: Window, ev: Event) => any; +declare var onorientationchange: (this: Window, ev: Event) => any; +declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; +declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; +declare var onpause: (this: Window, ev: Event) => any; +declare var onplay: (this: Window, ev: Event) => any; +declare var onplaying: (this: Window, ev: Event) => any; +declare var onpopstate: (this: Window, ev: PopStateEvent) => any; +declare var onprogress: (this: Window, ev: ProgressEvent) => any; +declare var onratechange: (this: Window, ev: Event) => any; +declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; +declare var onreset: (this: Window, ev: Event) => any; +declare var onresize: (this: Window, ev: UIEvent) => any; +declare var onscroll: (this: Window, ev: UIEvent) => any; +declare var onseeked: (this: Window, ev: Event) => any; +declare var onseeking: (this: Window, ev: Event) => any; +declare var onselect: (this: Window, ev: UIEvent) => any; +declare var onstalled: (this: Window, ev: Event) => any; +declare var onstorage: (this: Window, ev: StorageEvent) => any; +declare var onsubmit: (this: Window, ev: Event) => any; +declare var onsuspend: (this: Window, ev: Event) => any; +declare var ontimeupdate: (this: Window, ev: Event) => any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; +declare var onunload: (this: Window, ev: Event) => any; +declare var onvolumechange: (this: Window, ev: Event) => any; +declare var onwaiting: (this: Window, ev: Event) => any; +declare var opener: any; +declare var orientation: string | number; +declare var outerHeight: number; +declare var outerWidth: number; +declare var pageXOffset: number; +declare var pageYOffset: number; +declare var parent: Window; +declare var performance: Performance; +declare var personalbar: BarProp; +declare var screen: Screen; +declare var screenLeft: number; +declare var screenTop: number; +declare var screenX: number; +declare var screenY: number; +declare var scrollX: number; +declare var scrollY: number; +declare var scrollbars: BarProp; +declare var self: Window; +declare var speechSynthesis: SpeechSynthesis; +declare var status: string; +declare var statusbar: BarProp; +declare var styleMedia: StyleMedia; +declare var toolbar: BarProp; +declare var top: Window; +declare var window: Window; +declare var customElements: CustomElementRegistry; +declare function alert(message?: any): void; +declare function blur(): void; +declare function cancelAnimationFrame(handle: number): void; +declare function captureEvents(): void; +declare function close(): void; +declare function confirm(message?: string): boolean; +declare function departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; +declare function focus(): void; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; +declare function getSelection(): Selection; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function moveBy(x?: number, y?: number): void; +declare function moveTo(x?: number, y?: number): void; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string | null; +declare function releaseEvents(): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function resizeBy(x?: number, y?: number): void; +declare function resizeTo(x?: number, y?: number): void; +declare function scroll(x?: number, y?: number): void; +declare function scrollBy(x?: number, y?: number): void; +declare function scrollTo(x?: number, y?: number): void; +declare function stop(): void; +declare function webkitCancelAnimationFrame(handle: number): void; +declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; +declare function scroll(options?: ScrollToOptions): void; +declare function scrollTo(options?: ScrollToOptions): void; +declare function scrollBy(options?: ScrollToOptions): void; +declare function toString(): string; +declare function dispatchEvent(evt: Event): boolean; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare var sessionStorage: Storage; +declare var localStorage: Storage; +declare var console: Console; +declare var onpointercancel: (this: Window, ev: PointerEvent) => any; +declare var onpointerdown: (this: Window, ev: PointerEvent) => any; +declare var onpointerenter: (this: Window, ev: PointerEvent) => any; +declare var onpointerleave: (this: Window, ev: PointerEvent) => any; +declare var onpointermove: (this: Window, ev: PointerEvent) => any; +declare var onpointerout: (this: Window, ev: PointerEvent) => any; +declare var onpointerover: (this: Window, ev: PointerEvent) => any; +declare var onpointerup: (this: Window, ev: PointerEvent) => any; +declare var onwheel: (this: Window, ev: WheelEvent) => any; +declare var indexedDB: IDBFactory; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; +declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type BodyInit = any; +type ByteString = string; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type HeadersInit = any; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidateDictionary | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type RequestInfo = Request | string; +type USVString = string; +type payloadtype = number; +type ScrollBehavior = "auto" | "instant" | "smooth"; +type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; +type IDBValidKey = number | string | Date | IDBArrayKey; +type BufferSource = ArrayBuffer | ArrayBufferView; +type MouseWheelEvent = WheelEvent; type ScrollRestoration = "auto" | "manual"; +type FormDataEntryValue = string | File; +type AppendMode = "segments" | "sequence"; +type AudioContextState = "suspended" | "running" | "closed"; +type BiquadFilterType = "lowpass" | "highpass" | "bandpass" | "lowshelf" | "highshelf" | "peaking" | "notch" | "allpass"; +type CanvasFillRule = "nonzero" | "evenodd"; +type ChannelCountMode = "max" | "clamped-max" | "explicit"; +type ChannelInterpretation = "speakers" | "discrete"; +type DistanceModelType = "linear" | "inverse" | "exponential"; +type ExpandGranularity = "character" | "word" | "sentence" | "textedit"; +type GamepadInputEmulationType = "mouse" | "keyboard" | "gamepad"; +type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; +type IDBRequestReadyState = "pending" | "done"; +type IDBTransactionMode = "readonly" | "readwrite" | "versionchange"; +type ListeningState = "inactive" | "active" | "disambiguation"; +type MSCredentialType = "FIDO_2_0"; +type MSIceAddrType = "os" | "stun" | "turn" | "peer-derived"; +type MSIceType = "failed" | "direct" | "relay"; +type MSStatsType = "description" | "localclientevent" | "inbound-network" | "outbound-network" | "inbound-payload" | "outbound-payload" | "transportdiagnostics"; +type MSTransportType = "Embedded" | "USB" | "NFC" | "BT"; +type MSWebViewPermissionState = "unknown" | "defer" | "allow" | "deny"; +type MSWebViewPermissionType = "geolocation" | "unlimitedIndexedDBQuota" | "media" | "pointerlock" | "webnotifications"; +type MediaDeviceKind = "audioinput" | "audiooutput" | "videoinput"; +type MediaKeyMessageType = "license-request" | "license-renewal" | "license-release" | "individualization-request"; +type MediaKeySessionType = "temporary" | "persistent-license" | "persistent-release-message"; +type MediaKeyStatus = "usable" | "expired" | "output-downscaled" | "output-not-allowed" | "status-pending" | "internal-error"; +type MediaKeysRequirement = "required" | "optional" | "not-allowed"; +type MediaStreamTrackState = "live" | "ended"; +type NavigationReason = "up" | "down" | "left" | "right"; +type NavigationType = "navigate" | "reload" | "back_forward" | "prerender"; +type NotificationDirection = "auto" | "ltr" | "rtl"; +type NotificationPermission = "default" | "denied" | "granted"; +type OscillatorType = "sine" | "square" | "sawtooth" | "triangle" | "custom"; +type OverSampleType = "none" | "2x" | "4x"; +type PanningModelType = "equalpower"; +type PaymentComplete = "success" | "fail" | ""; +type PaymentShippingType = "shipping" | "delivery" | "pickup"; +type PushEncryptionKeyName = "p256dh" | "auth"; +type PushPermissionState = "granted" | "denied" | "prompt"; +type RTCBundlePolicy = "balanced" | "max-compat" | "max-bundle"; +type RTCDegradationPreference = "maintain-framerate" | "maintain-resolution" | "balanced"; +type RTCDtlsRole = "auto" | "client" | "server"; +type RTCDtlsTransportState = "new" | "connecting" | "connected" | "closed"; +type RTCIceCandidateType = "host" | "srflx" | "prflx" | "relay"; +type RTCIceComponent = "RTP" | "RTCP"; +type RTCIceConnectionState = "new" | "checking" | "connected" | "completed" | "failed" | "disconnected" | "closed"; +type RTCIceGatherPolicy = "all" | "nohost" | "relay"; +type RTCIceGathererState = "new" | "gathering" | "complete"; +type RTCIceGatheringState = "new" | "gathering" | "complete"; +type RTCIceProtocol = "udp" | "tcp"; +type RTCIceRole = "controlling" | "controlled"; +type RTCIceTcpCandidateType = "active" | "passive" | "so"; +type RTCIceTransportPolicy = "none" | "relay" | "all"; +type RTCIceTransportState = "new" | "checking" | "connected" | "completed" | "disconnected" | "closed"; +type RTCSdpType = "offer" | "pranswer" | "answer"; +type RTCSignalingState = "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer" | "closed"; +type RTCStatsIceCandidatePairState = "frozen" | "waiting" | "inprogress" | "failed" | "succeeded" | "cancelled"; +type RTCStatsIceCandidateType = "host" | "serverreflexive" | "peerreflexive" | "relayed"; +type RTCStatsType = "inboundrtp" | "outboundrtp" | "session" | "datachannel" | "track" | "transport" | "candidatepair" | "localcandidate" | "remotecandidate"; +type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url"; +type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache"; +type RequestCredentials = "omit" | "same-origin" | "include"; +type RequestDestination = "" | "document" | "sharedworker" | "subresource" | "unknown" | "worker"; +type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; +type RequestRedirect = "follow" | "error" | "manual"; +type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video"; +type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; +type ScopedCredentialType = "ScopedCred"; +type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant"; +type Transport = "usb" | "nfc" | "ble"; +type VideoFacingModeEnum = "user" | "environment" | "left" | "right"; +type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded"; +type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text"; + + +///////////////////////////// +/// WorkerGlobalScope APIs +///////////////////////////// +// These are only available in a Web Worker +declare function importScripts(...urls: string[]): void; + + + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: any): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: any): VBArray; + new (safeArray: any): VBArray; +} + +declare var VBArray: VBArrayConstructor; + +/** + * Automation date (VT_DATE) + */ +interface VarDate { } + +interface DateConstructor { + new (vd: VarDate): Date; +} - -///////////////////////////// -/// WorkerGlobalScope APIs -///////////////////////////// -// These are only available in a Web Worker -declare function importScripts(...urls: string[]): void; - - - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; - -/** - * Automation date (VT_DATE) - */ -interface VarDate { } - -interface DateConstructor { - new (vd: VarDate): Date; -} - -interface Date { - getVarDate: () => VarDate; -} +interface Date { + getVarDate: () => VarDate; +} diff --git a/node_modules/typescript/lib/lib.dom.d.ts b/node_modules/typescript/lib/lib.dom.d.ts index 8fb1b0b0a..94fb13c32 100644 --- a/node_modules/typescript/lib/lib.dom.d.ts +++ b/node_modules/typescript/lib/lib.dom.d.ts @@ -1,13738 +1,15056 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - - -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainLongRange extends LongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface EventInit { - scoped?: boolean; - bubbles?: boolean; - cancelable?: boolean; -} - -interface EventModifierInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierOS?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends EventModifierInit { - code?: string; - key?: string; - location?: number; - repeat?: boolean; -} - -interface LongRange { - max?: number; - min?: number; -} - -interface MSAccountInfo { - rpDisplayName?: string; - userDisplayName?: string; - accountName?: string; - userId?: string; - accountImageUri?: string; -} - -interface MSAudioLocalClientEvent extends MSLocalClientEventBase { - networkSendQualityEventRatio?: number; - networkDelayEventRatio?: number; - cpuInsufficientEventRatio?: number; - deviceHalfDuplexAECEventRatio?: number; - deviceRenderNotFunctioningEventRatio?: number; - deviceCaptureNotFunctioningEventRatio?: number; - deviceGlitchesEventRatio?: number; - deviceLowSNREventRatio?: number; - deviceLowSpeechLevelEventRatio?: number; - deviceClippingEventRatio?: number; - deviceEchoEventRatio?: number; - deviceNearEndToEchoRatioEventRatio?: number; - deviceRenderZeroVolumeEventRatio?: number; - deviceRenderMuteEventRatio?: number; - deviceMultipleEndpointsEventCount?: number; - deviceHowlingEventCount?: number; -} - -interface MSAudioRecvPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioRecvSignal; - packetReorderRatio?: number; - packetReorderDepthAvg?: number; - packetReorderDepthMax?: number; - burstLossLength1?: number; - burstLossLength2?: number; - burstLossLength3?: number; - burstLossLength4?: number; - burstLossLength5?: number; - burstLossLength6?: number; - burstLossLength7?: number; - burstLossLength8OrHigher?: number; - fecRecvDistance1?: number; - fecRecvDistance2?: number; - fecRecvDistance3?: number; - ratioConcealedSamplesAvg?: number; - ratioStretchedSamplesAvg?: number; - ratioCompressedSamplesAvg?: number; -} - -interface MSAudioRecvSignal { - initialSignalLevelRMS?: number; - recvSignalLevelCh1?: number; - recvNoiseLevelCh1?: number; - renderSignalLevel?: number; - renderNoiseLevel?: number; - renderLoopbackSignalLevel?: number; -} - -interface MSAudioSendPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioSendSignal; - audioFECUsed?: boolean; - sendMutePercent?: number; -} - -interface MSAudioSendSignal { - noiseLevel?: number; - sendSignalLevelCh1?: number; - sendNoiseLevelCh1?: number; -} - -interface MSConnectivity { - iceType?: string; - iceWarningFlags?: MSIceWarningFlags; - relayAddress?: MSRelayAddress; -} - -interface MSCredentialFilter { - accept?: MSCredentialSpec[]; -} - -interface MSCredentialParameters { - type?: string; -} - -interface MSCredentialSpec { - type?: string; - id?: string; -} - -interface MSDelay { - roundTrip?: number; - roundTripMax?: number; -} - -interface MSDescription extends RTCStats { - connectivity?: MSConnectivity; - transport?: string; - networkconnectivity?: MSNetworkConnectivityInfo; - localAddr?: MSIPAddressInfo; - remoteAddr?: MSIPAddressInfo; - deviceDevName?: string; - reflexiveLocalIPAddr?: MSIPAddressInfo; -} - -interface MSFIDOCredentialParameters extends MSCredentialParameters { - algorithm?: string | Algorithm; - authenticators?: AAGUID[]; -} - -interface MSIPAddressInfo { - ipAddr?: string; - port?: number; - manufacturerMacAddrMask?: string; -} - -interface MSIceWarningFlags { - turnTcpTimedOut?: boolean; - turnUdpAllocateFailed?: boolean; - turnUdpSendFailed?: boolean; - turnTcpAllocateFailed?: boolean; - turnTcpSendFailed?: boolean; - udpLocalConnectivityFailed?: boolean; - udpNatConnectivityFailed?: boolean; - udpRelayConnectivityFailed?: boolean; - tcpNatConnectivityFailed?: boolean; - tcpRelayConnectivityFailed?: boolean; - connCheckMessageIntegrityFailed?: boolean; - allocationMessageIntegrityFailed?: boolean; - connCheckOtherError?: boolean; - turnAuthUnknownUsernameError?: boolean; - noRelayServersConfigured?: boolean; - multipleRelayServersAttempted?: boolean; - portRangeExhausted?: boolean; - alternateServerReceived?: boolean; - pseudoTLSFailure?: boolean; - turnTurnTcpConnectivityFailed?: boolean; - useCandidateChecksFailed?: boolean; - fipsAllocationFailure?: boolean; -} - -interface MSJitter { - interArrival?: number; - interArrivalMax?: number; - interArrivalSD?: number; -} - -interface MSLocalClientEventBase extends RTCStats { - networkReceiveQualityEventRatio?: number; - networkBandwidthLowEventRatio?: number; -} - -interface MSNetwork extends RTCStats { - jitter?: MSJitter; - delay?: MSDelay; - packetLoss?: MSPacketLoss; - utilization?: MSUtilization; -} - -interface MSNetworkConnectivityInfo { - vpn?: boolean; - linkspeed?: number; - networkConnectionDetails?: string; -} - -interface MSNetworkInterfaceType { - interfaceTypeEthernet?: boolean; - interfaceTypeWireless?: boolean; - interfaceTypePPP?: boolean; - interfaceTypeTunnel?: boolean; - interfaceTypeWWAN?: boolean; -} - -interface MSOutboundNetwork extends MSNetwork { - appliedBandwidthLimit?: number; -} - -interface MSPacketLoss { - lossRate?: number; - lossRateMax?: number; -} - -interface MSPayloadBase extends RTCStats { - payloadDescription?: string; -} - -interface MSRelayAddress { - relayAddress?: string; - port?: number; -} - -interface MSSignatureParameters { - userPrompt?: string; -} - -interface MSTransportDiagnosticsStats extends RTCStats { - baseAddress?: string; - localAddress?: string; - localSite?: string; - networkName?: string; - remoteAddress?: string; - remoteSite?: string; - localMR?: string; - remoteMR?: string; - iceWarningFlags?: MSIceWarningFlags; - portRangeMin?: number; - portRangeMax?: number; - localMRTCPPort?: number; - remoteMRTCPPort?: number; - stunVer?: number; - numConsentReqSent?: number; - numConsentReqReceived?: number; - numConsentRespSent?: number; - numConsentRespReceived?: number; - interfaces?: MSNetworkInterfaceType; - baseInterface?: MSNetworkInterfaceType; - protocol?: string; - localInterface?: MSNetworkInterfaceType; - localAddrType?: string; - remoteAddrType?: string; - iceRole?: string; - rtpRtcpMux?: boolean; - allocationTimeInMs?: number; - msRtcEngineVersion?: string; -} - -interface MSUtilization { - packets?: number; - bandwidthEstimation?: number; - bandwidthEstimationMin?: number; - bandwidthEstimationMax?: number; - bandwidthEstimationStdDev?: number; - bandwidthEstimationAvg?: number; -} - -interface MSVideoPayload extends MSPayloadBase { - resoluton?: string; - videoBitRateAvg?: number; - videoBitRateMax?: number; - videoFrameRateAvg?: number; - videoPacketLossRate?: number; - durationSeconds?: number; -} - -interface MSVideoRecvPayload extends MSVideoPayload { - videoFrameLossRate?: number; - recvCodecType?: string; - recvResolutionWidth?: number; - recvResolutionHeight?: number; - videoResolutions?: MSVideoResolutionDistribution; - recvFrameRateAverage?: number; - recvBitRateMaximum?: number; - recvBitRateAverage?: number; - recvVideoStreamsMax?: number; - recvVideoStreamsMin?: number; - recvVideoStreamsMode?: number; - videoPostFECPLR?: number; - lowBitRateCallPercent?: number; - lowFrameRateCallPercent?: number; - reorderBufferTotalPackets?: number; - recvReorderBufferReorderedPackets?: number; - recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; - recvReorderBufferMaxSuccessfullyOrderedExtent?: number; - recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; - recvReorderBufferPacketsDroppedDueToTimeout?: number; - recvFpsHarmonicAverage?: number; - recvNumResSwitches?: number; -} - -interface MSVideoResolutionDistribution { - cifQuality?: number; - vgaQuality?: number; - h720Quality?: number; - h1080Quality?: number; - h1440Quality?: number; - h2160Quality?: number; -} - -interface MSVideoSendPayload extends MSVideoPayload { - sendFrameRateAverage?: number; - sendBitRateMaximum?: number; - sendBitRateAverage?: number; - sendVideoStreamsMax?: number; - sendResolutionWidth?: number; - sendResolutionHeight?: number; -} - -interface MediaEncryptedEventInit extends EventInit { - initDataType?: string; - initData?: ArrayBuffer; -} - -interface MediaKeyMessageEventInit extends EventInit { - messageType?: string; - message?: ArrayBuffer; -} - -interface MediaKeySystemConfiguration { - initDataTypes?: string[]; - audioCapabilities?: MediaKeySystemMediaCapability[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: string; - persistentState?: string; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaStreamConstraints { - video?: boolean | MediaTrackConstraints; - audio?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError; -} - -interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - width?: number | LongRange; - height?: number | LongRange; - aspectRatio?: number | DoubleRange; - frameRate?: number | DoubleRange; - facingMode?: string; - volume?: number | DoubleRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - echoCancellation?: boolean[]; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackConstraintSet { - width?: number | ConstrainLongRange; - height?: number | ConstrainLongRange; - aspectRatio?: number | ConstrainDoubleRange; - frameRate?: number | ConstrainDoubleRange; - facingMode?: string | string[] | ConstrainDOMStringParameters; - volume?: number | ConstrainDoubleRange; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - echoCancelation?: boolean | ConstrainBooleanParameters; - deviceId?: string | string[] | ConstrainDOMStringParameters; - groupId?: string | string[] | ConstrainDOMStringParameters; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - width?: number; - height?: number; - aspectRatio?: number; - frameRate?: number; - facingMode?: string; - volume?: number; - sampleRate?: number; - sampleSize?: number; - echoCancellation?: boolean; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackSupportedConstraints { - width?: boolean; - height?: boolean; - aspectRatio?: boolean; - frameRate?: boolean; - facingMode?: boolean; - volume?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - echoCancellation?: boolean; - deviceId?: boolean; - groupId?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - role?: string; - fingerprints?: RTCDtlsFingerprint[]; -} - -interface RTCIceCandidate { - foundation?: string; - priority?: number; - ip?: string; - protocol?: string; - port?: number; - type?: string; - tcpType?: string; - relatedAddress?: string; - relatedPort?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - ipAddress?: string; - portNumber?: number; - transport?: string; - candidateType?: string; - priority?: number; - addressSourceUrl?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - transportId?: string; - localCandidateId?: string; - remoteCandidateId?: string; - state?: string; - priority?: number; - nominated?: boolean; - writable?: boolean; - readable?: boolean; - bytesSent?: number; - bytesReceived?: number; - roundTripTime?: number; - availableOutgoingBitrate?: number; - availableIncomingBitrate?: number; -} - -interface RTCIceGatherOptions { - gatherPolicy?: string; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - usernameFragment?: string; - password?: string; -} - -interface RTCIceServer { - urls?: any; - username?: string; - credential?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - packetsReceived?: number; - bytesReceived?: number; - packetsLost?: number; - jitter?: number; - fractionLost?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - trackIdentifier?: string; - remoteSource?: boolean; - ssrcIds?: string[]; - frameWidth?: number; - frameHeight?: number; - framesPerSecond?: number; - framesSent?: number; - framesReceived?: number; - framesDecoded?: number; - framesDropped?: number; - framesCorrupted?: number; - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - packetsSent?: number; - bytesSent?: number; - targetBitrate?: number; - roundTripTime?: number; -} - -interface RTCRTPStreamStats extends RTCStats { - ssrc?: string; - associateStatsId?: string; - isRemote?: boolean; - mediaTrackId?: string; - transportId?: string; - codecId?: string; - firCount?: number; - pliCount?: number; - nackCount?: number; - sliCount?: number; -} - -interface RTCRtcpFeedback { - type?: string; - parameter?: string; -} - -interface RTCRtcpParameters { - ssrc?: number; - cname?: string; - reducedSize?: boolean; - mux?: boolean; -} - -interface RTCRtpCapabilities { - codecs?: RTCRtpCodecCapability[]; - headerExtensions?: RTCRtpHeaderExtension[]; - fecMechanisms?: string[]; -} - -interface RTCRtpCodecCapability { - name?: string; - kind?: string; - clockRate?: number; - preferredPayloadType?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; - options?: any; - maxTemporalLayers?: number; - maxSpatialLayers?: number; - svcMultiStreamSupport?: boolean; -} - -interface RTCRtpCodecParameters { - name?: string; - payloadType?: any; - clockRate?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; -} - -interface RTCRtpContributingSource { - timestamp?: number; - csrc?: number; - audioLevel?: number; -} - -interface RTCRtpEncodingParameters { - ssrc?: number; - codecPayloadType?: number; - fec?: RTCRtpFecParameters; - rtx?: RTCRtpRtxParameters; - priority?: number; - maxBitrate?: number; - minQuality?: number; - framerateBias?: number; - resolutionScale?: number; - framerateScale?: number; - active?: boolean; - encodingId?: string; - dependencyEncodingIds?: string[]; - ssrcRange?: RTCSsrcRange; -} - -interface RTCRtpFecParameters { - ssrc?: number; - mechanism?: string; -} - -interface RTCRtpHeaderExtension { - kind?: string; - uri?: string; - preferredId?: number; - preferredEncrypt?: boolean; -} - -interface RTCRtpHeaderExtensionParameters { - uri?: string; - id?: number; - encrypt?: boolean; -} - -interface RTCRtpParameters { - muxId?: string; - codecs?: RTCRtpCodecParameters[]; - headerExtensions?: RTCRtpHeaderExtensionParameters[]; - encodings?: RTCRtpEncodingParameters[]; - rtcp?: RTCRtcpParameters; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpUnhandled { - ssrc?: number; - payloadType?: number; - muxId?: string; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiValue?: number; - mkiLength?: number; -} - -interface RTCSrtpSdesParameters { - tag?: number; - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; -} - -interface RTCSsrcRange { - min?: number; - max?: number; -} - -interface RTCStats { - timestamp?: number; - type?: string; - id?: string; - msType?: string; -} - -interface RTCStatsReport { -} - -interface RTCTransportStats extends RTCStats { - bytesSent?: number; - bytesReceived?: number; - rtcpTransportStatsId?: string; - activeConnection?: boolean; - selectedCandidatePairId?: string; - localCertificateId?: string; - remoteCertificateId?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - failIfMajorPerformanceCaveat?: boolean; - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCacheEventMap { - "cached": Event; - "checking": Event; - "downloading": Event; - "error": ErrorEvent; - "noupdate": Event; - "obsolete": Event; - "progress": ProgressEvent; - "updateready": Event; -} - -interface ApplicationCache extends EventTarget { - oncached: (this: ApplicationCache, ev: Event) => any; - onchecking: (this: ApplicationCache, ev: Event) => any; - ondownloading: (this: ApplicationCache, ev: Event) => any; - onerror: (this: ApplicationCache, ev: ErrorEvent) => any; - onnoupdate: (this: ApplicationCache, ev: Event) => any; - onobsolete: (this: ApplicationCache, ev: Event) => any; - onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; - onupdateready: (this: ApplicationCache, ev: Event) => any; - readonly status: number; - abort(): void; - swapCache(): void; - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - readonly attributeName: string; - attributeValue: string | null; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - readonly name: string; - readonly ownerElement: Element; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNodeEventMap { - "ended": MediaStreamErrorEvent; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - readonly sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - readonly context: AudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - readonly defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - readonly id: string; - kind: string; - readonly label: string; - language: string; - readonly sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackListEventMap { - "addtrack": TrackEvent; - "change": Event; - "removetrack": TrackEvent; -} - -interface AudioTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; - onchange: (this: AudioTrackList, ev: Event) => any; - onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack | null; - item(index: number): AudioTrack; - addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - readonly pseudoClass: string; - readonly selector: string; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule; - readonly parentStyleSheet: CSSStyleSheet; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; - alignmentBaseline: string | null; - animation: string | null; - animationDelay: string | null; - animationDirection: string | null; - animationDuration: string | null; - animationFillMode: string | null; - animationIterationCount: string | null; - animationName: string | null; - animationPlayState: string | null; - animationTimingFunction: string | null; - backfaceVisibility: string | null; - background: string | null; - backgroundAttachment: string | null; - backgroundClip: string | null; - backgroundColor: string | null; - backgroundImage: string | null; - backgroundOrigin: string | null; - backgroundPosition: string | null; - backgroundPositionX: string | null; - backgroundPositionY: string | null; - backgroundRepeat: string | null; - backgroundSize: string | null; - baselineShift: string | null; - border: string | null; - borderBottom: string | null; - borderBottomColor: string | null; - borderBottomLeftRadius: string | null; - borderBottomRightRadius: string | null; - borderBottomStyle: string | null; - borderBottomWidth: string | null; - borderCollapse: string | null; - borderColor: string | null; - borderImage: string | null; - borderImageOutset: string | null; - borderImageRepeat: string | null; - borderImageSlice: string | null; - borderImageSource: string | null; - borderImageWidth: string | null; - borderLeft: string | null; - borderLeftColor: string | null; - borderLeftStyle: string | null; - borderLeftWidth: string | null; - borderRadius: string | null; - borderRight: string | null; - borderRightColor: string | null; - borderRightStyle: string | null; - borderRightWidth: string | null; - borderSpacing: string | null; - borderStyle: string | null; - borderTop: string | null; - borderTopColor: string | null; - borderTopLeftRadius: string | null; - borderTopRightRadius: string | null; - borderTopStyle: string | null; - borderTopWidth: string | null; - borderWidth: string | null; - bottom: string | null; - boxShadow: string | null; - boxSizing: string | null; - breakAfter: string | null; - breakBefore: string | null; - breakInside: string | null; - captionSide: string | null; - clear: string | null; - clip: string | null; - clipPath: string | null; - clipRule: string | null; - color: string | null; - colorInterpolationFilters: string | null; - columnCount: any; - columnFill: string | null; - columnGap: any; - columnRule: string | null; - columnRuleColor: any; - columnRuleStyle: string | null; - columnRuleWidth: any; - columnSpan: string | null; - columnWidth: any; - columns: string | null; - content: string | null; - counterIncrement: string | null; - counterReset: string | null; - cssFloat: string | null; - cssText: string; - cursor: string | null; - direction: string | null; - display: string | null; - dominantBaseline: string | null; - emptyCells: string | null; - enableBackground: string | null; - fill: string | null; - fillOpacity: string | null; - fillRule: string | null; - filter: string | null; - flex: string | null; - flexBasis: string | null; - flexDirection: string | null; - flexFlow: string | null; - flexGrow: string | null; - flexShrink: string | null; - flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; - height: string | null; - imeMode: string | null; - justifyContent: string | null; - kerning: string | null; - left: string | null; - readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineHeight: string | null; - listStyle: string | null; - listStyleImage: string | null; - listStylePosition: string | null; - listStyleType: string | null; - margin: string | null; - marginBottom: string | null; - marginLeft: string | null; - marginRight: string | null; - marginTop: string | null; - marker: string | null; - markerEnd: string | null; - markerMid: string | null; - markerStart: string | null; - mask: string | null; - maxHeight: string | null; - maxWidth: string | null; - minHeight: string | null; - minWidth: string | null; - msContentZoomChaining: string | null; - msContentZoomLimit: string | null; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string | null; - msContentZoomSnapPoints: string | null; - msContentZoomSnapType: string | null; - msContentZooming: string | null; - msFlowFrom: string | null; - msFlowInto: string | null; - msFontFeatureSettings: string | null; - msGridColumn: any; - msGridColumnAlign: string | null; - msGridColumnSpan: any; - msGridColumns: string | null; - msGridRow: any; - msGridRowAlign: string | null; - msGridRowSpan: any; - msGridRows: string | null; - msHighContrastAdjust: string | null; - msHyphenateLimitChars: string | null; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string | null; - msImeAlign: string | null; - msOverflowStyle: string | null; - msScrollChaining: string | null; - msScrollLimit: string | null; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string | null; - msScrollSnapPointsX: string | null; - msScrollSnapPointsY: string | null; - msScrollSnapType: string | null; - msScrollSnapX: string | null; - msScrollSnapY: string | null; - msScrollTranslation: string | null; - msTextCombineHorizontal: string | null; - msTextSizeAdjust: any; - msTouchAction: string | null; - msTouchSelect: string | null; - msUserSelect: string | null; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string | null; - order: string | null; - orphans: string | null; - outline: string | null; - outlineColor: string | null; - outlineStyle: string | null; - outlineWidth: string | null; - overflow: string | null; - overflowX: string | null; - overflowY: string | null; - padding: string | null; - paddingBottom: string | null; - paddingLeft: string | null; - paddingRight: string | null; - paddingTop: string | null; - pageBreakAfter: string | null; - pageBreakBefore: string | null; - pageBreakInside: string | null; - readonly parentRule: CSSRule; - perspective: string | null; - perspectiveOrigin: string | null; - pointerEvents: string | null; - position: string | null; - quotes: string | null; - right: string | null; - rubyAlign: string | null; - rubyOverhang: string | null; - rubyPosition: string | null; - stopColor: string | null; - stopOpacity: string | null; - stroke: string | null; - strokeDasharray: string | null; - strokeDashoffset: string | null; - strokeLinecap: string | null; - strokeLinejoin: string | null; - strokeMiterlimit: string | null; - strokeOpacity: string | null; - strokeWidth: string | null; - tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; - textAnchor: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; - textKashida: string | null; - textKashidaSpace: string | null; - textOverflow: string | null; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; - top: string | null; - touchAction: string | null; - transform: string | null; - transformOrigin: string | null; - transformStyle: string | null; - transition: string | null; - transitionDelay: string | null; - transitionDuration: string | null; - transitionProperty: string | null; - transitionTimingFunction: string | null; - unicodeBidi: string | null; - verticalAlign: string | null; - visibility: string | null; - webkitAlignContent: string | null; - webkitAlignItems: string | null; - webkitAlignSelf: string | null; - webkitAnimation: string | null; - webkitAnimationDelay: string | null; - webkitAnimationDirection: string | null; - webkitAnimationDuration: string | null; - webkitAnimationFillMode: string | null; - webkitAnimationIterationCount: string | null; - webkitAnimationName: string | null; - webkitAnimationPlayState: string | null; - webkitAnimationTimingFunction: string | null; - webkitAppearance: string | null; - webkitBackfaceVisibility: string | null; - webkitBackgroundClip: string | null; - webkitBackgroundOrigin: string | null; - webkitBackgroundSize: string | null; - webkitBorderBottomLeftRadius: string | null; - webkitBorderBottomRightRadius: string | null; - webkitBorderImage: string | null; - webkitBorderRadius: string | null; - webkitBorderTopLeftRadius: string | null; - webkitBorderTopRightRadius: string | null; - webkitBoxAlign: string | null; - webkitBoxDirection: string | null; - webkitBoxFlex: string | null; - webkitBoxOrdinalGroup: string | null; - webkitBoxOrient: string | null; - webkitBoxPack: string | null; - webkitBoxSizing: string | null; - webkitColumnBreakAfter: string | null; - webkitColumnBreakBefore: string | null; - webkitColumnBreakInside: string | null; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string | null; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string | null; - webkitColumnRuleWidth: any; - webkitColumnSpan: string | null; - webkitColumnWidth: any; - webkitColumns: string | null; - webkitFilter: string | null; - webkitFlex: string | null; - webkitFlexBasis: string | null; - webkitFlexDirection: string | null; - webkitFlexFlow: string | null; - webkitFlexGrow: string | null; - webkitFlexShrink: string | null; - webkitFlexWrap: string | null; - webkitJustifyContent: string | null; - webkitOrder: string | null; - webkitPerspective: string | null; - webkitPerspectiveOrigin: string | null; - webkitTapHighlightColor: string | null; - webkitTextFillColor: string | null; - webkitTextSizeAdjust: any; - webkitTransform: string | null; - webkitTransformOrigin: string | null; - webkitTransformStyle: string | null; - webkitTransition: string | null; - webkitTransitionDelay: string | null; - webkitTransitionDuration: string | null; - webkitTransitionProperty: string | null; - webkitTransitionTimingFunction: string | null; - webkitUserModify: string | null; - webkitUserSelect: string | null; - webkitWritingMode: string | null; - whiteSpace: string | null; - widows: string | null; - width: string | null; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; - zIndex: string | null; - zoom: string | null; - resize: string | null; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readonly readOnly: boolean; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - cssText: string; - readonly href: string; - readonly id: string; - readonly imports: StyleSheetList; - readonly isAlternate: boolean; - readonly isPrefAlternate: boolean; - readonly ownerRule: CSSRule; - readonly owningElement: Element; - readonly pages: StyleSheetPageList; - readonly readOnly: boolean; - readonly rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { - setTransform(matrix: SVGMatrix): void; -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D extends Object, CanvasPathMethods { - readonly canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - mozImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - beginPath(): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - measureText(text: string): TextMetrics; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - readonly length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - readonly commandName: string; - readonly detail: string | null; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - readonly subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - readonly detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string | null, version: string | null): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - readonly length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; - addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - readonly files: FileList; - readonly items: DataTransferItemList; - readonly types: string[]; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - readonly kind: string; - readonly type: string; - getAsFile(): File | null; - getAsString(_callback: FunctionStringCallback | null): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - readonly length: number; - add(data: File): DataTransferItem | null; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: string; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -} - -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceAcceleration | null; - readonly accelerationIncludingGravity: DeviceAcceleration | null; - readonly interval: number | null; - readonly rotationRate: DeviceRotationRate | null; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface DocumentEventMap extends GlobalEventHandlersEventMap { - "abort": UIEvent; - "activate": UIEvent; - "beforeactivate": UIEvent; - "beforedeactivate": UIEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "contextmenu": PointerEvent; - "dblclick": MouseEvent; - "deactivate": UIEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "fullscreenchange": Event; - "fullscreenerror": Event; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "mousedown": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSContentZoom": UIEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSInertiaStart": MSGestureEvent; - "MSManipulationStateChanged": MSManipulationEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "mssitemodejumplistitemremoved": MSSiteModeEvent; - "msthumbnailclick": MSSiteModeEvent; - "pause": Event; - "play": Event; - "playing": Event; - "pointerlockchange": Event; - "pointerlockerror": Event; - "progress": ProgressEvent; - "ratechange": Event; - "readystatechange": ProgressEvent; - "reset": Event; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "selectionchange": Event; - "selectstart": Event; - "stalled": Event; - "stop": Event; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "touchcancel": TouchEvent; - "touchend": TouchEvent; - "touchmove": TouchEvent; - "touchstart": TouchEvent; - "volumechange": Event; - "waiting": Event; - "webkitfullscreenchange": Event; - "webkitfullscreenerror": Event; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - readonly URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - readonly activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - cookie: string; - readonly currentScript: HTMLScriptElement | SVGScriptElement; - /** - * Gets the default character set from the current regional language settings. - */ - readonly defaultCharset: string; - readonly defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollectionOf; - readonly fullscreenElement: Element | null; - readonly fullscreenEnabled: boolean; - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string | null; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - readonly location: Location; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (this: Document, ev: UIEvent) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (this: Document, ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (this: Document, ev: Event) => any; - oncanplaythrough: (this: Document, ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (this: Document, ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (this: Document, ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (this: Document, ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (this: Document, ev: DragEvent) => any; - ondrop: (this: Document, ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (this: Document, ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (this: Document, ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (this: Document, ev: MediaStreamErrorEvent) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (this: Document, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (this: Document, ev: FocusEvent) => any; - onfullscreenchange: (this: Document, ev: Event) => any; - onfullscreenerror: (this: Document, ev: Event) => any; - oninput: (this: Document, ev: Event) => any; - oninvalid: (this: Document, ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (this: Document, ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (this: Document, ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (this: Document, ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (this: Document, ev: WheelEvent) => any; - onmscontentzoom: (this: Document, ev: UIEvent) => any; - onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; - onmsgestureend: (this: Document, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; - onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; - onmspointercancel: (this: Document, ev: MSPointerEvent) => any; - onmspointerdown: (this: Document, ev: MSPointerEvent) => any; - onmspointerenter: (this: Document, ev: MSPointerEvent) => any; - onmspointerleave: (this: Document, ev: MSPointerEvent) => any; - onmspointermove: (this: Document, ev: MSPointerEvent) => any; - onmspointerout: (this: Document, ev: MSPointerEvent) => any; - onmspointerover: (this: Document, ev: MSPointerEvent) => any; - onmspointerup: (this: Document, ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (this: Document, ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (this: Document, ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (this: Document, ev: Event) => any; - onpointerlockchange: (this: Document, ev: Event) => any; - onpointerlockerror: (this: Document, ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (this: Document, ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (this: Document, ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (this: Document, ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (this: Document, ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (this: Document, ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (this: Document, ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (this: Document, ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (this: Document, ev: UIEvent) => any; - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (this: Document, ev: Event) => any; - onselectstart: (this: Document, ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (this: Document, ev: Event) => any; - onsubmit: (this: Document, ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (this: Document, ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (this: Document, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (this: Document, ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (this: Document, ev: Event) => any; - onwebkitfullscreenchange: (this: Document, ev: Event) => any; - onwebkitfullscreenerror: (this: Document, ev: Event) => any; - plugins: HTMLCollectionOf; - readonly pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - readonly rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - readonly webkitCurrentFullScreenElement: Element | null; - readonly webkitFullscreenElement: Element | null; - readonly webkitFullscreenEnabled: boolean; - readonly webkitIsFullScreen: boolean; - readonly xmlEncoding: string | null; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string | null; - adoptNode(source: Node): Node; - captureEvents(): void; - caretRangeFromPoint(x: number, y: number): Range; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: K): HTMLElementTagNameMap[K]; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string | null, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement | null; - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: K): ElementListTagNameMap[K]; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeListOf; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): void; - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector, ParentNode { -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - readonly entities: NamedNodeMap; - readonly internalSubset: string | null; - readonly name: string; - readonly notations: NamedNodeMap; - readonly publicId: string | null; - readonly systemId: string | null; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - readonly dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: AudioParam; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_frag_depth { -} - -declare var EXT_frag_depth: { - prototype: EXT_frag_depth; - new(): EXT_frag_depth; -} - -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface ElementEventMap extends GlobalEventHandlersEventMap { - "ariarequest": AriaRequestEvent; - "command": CommandEvent; - "gotpointercapture": PointerEvent; - "lostpointercapture": PointerEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSGotPointerCapture": MSPointerEvent; - "MSInertiaStart": MSGestureEvent; - "MSLostPointerCapture": MSPointerEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "touchcancel": TouchEvent; - "touchend": TouchEvent; - "touchmove": TouchEvent; - "touchstart": TouchEvent; - "webkitfullscreenchange": Event; - "webkitfullscreenerror": Event; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { - readonly classList: DOMTokenList; - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - id: string; - msContentZoomFactor: number; - readonly msRegionOverflow: string; - onariarequest: (this: Element, ev: AriaRequestEvent) => any; - oncommand: (this: Element, ev: CommandEvent) => any; - ongotpointercapture: (this: Element, ev: PointerEvent) => any; - onlostpointercapture: (this: Element, ev: PointerEvent) => any; - onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; - onmsgestureend: (this: Element, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; - onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; - onmspointercancel: (this: Element, ev: MSPointerEvent) => any; - onmspointerdown: (this: Element, ev: MSPointerEvent) => any; - onmspointerenter: (this: Element, ev: MSPointerEvent) => any; - onmspointerleave: (this: Element, ev: MSPointerEvent) => any; - onmspointermove: (this: Element, ev: MSPointerEvent) => any; - onmspointerout: (this: Element, ev: MSPointerEvent) => any; - onmspointerover: (this: Element, ev: MSPointerEvent) => any; - onmspointerup: (this: Element, ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: Element, ev: Event) => any; - onwebkitfullscreenerror: (this: Element, ev: Event) => any; - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - readonly tagName: string; - innerHTML: string; - readonly assignedSlot: HTMLSlotElement | null; - slot: string; - readonly shadowRoot: ShadowRoot | null; - getAttribute(name: string): string | null; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: K): ElementListTagNameMap[K]; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - matches(selector: string): boolean; - closest(selector: string): Element | null; - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; - scroll(options?: ScrollToOptions): void; - scroll(x: number, y: number): void; - scrollTo(options?: ScrollToOptions): void; - scrollTo(x: number, y: number): void; - scrollBy(options?: ScrollToOptions): void; - scrollBy(x: number, y: number): void; - insertAdjacentElement(position: string, insertedElement: Element): Element | null; - insertAdjacentHTML(where: string, html: string): void; - insertAdjacentText(where: string, text: string): void; - attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; - addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: Element | null; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - readonly scoped: boolean; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - deepPath(): EventTarget[]; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - readonly axes: number[]; - readonly buttons: GamepadButton[]; - readonly connected: boolean; - readonly id: string; - readonly index: number; - readonly mapping: string; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - readonly pressed: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - readonly mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - readonly nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - readonly protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string | null; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { - addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBodyElementEventMap extends HTMLElementEventMap { - "afterprint": Event; - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "load": Event; - "message": MessageEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "popstate": PopStateEvent; - "resize": UIEvent; - "storage": StorageEvent; - "unload": Event; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (this: HTMLBodyElement, ev: Event) => any; - onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; - onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; - onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; - onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; - onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; - onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; - onload: (this: HTMLBodyElement, ev: Event) => any; - onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; - onoffline: (this: HTMLBodyElement, ev: Event) => any; - ononline: (this: HTMLBodyElement, ev: Event) => any; - onorientationchange: (this: HTMLBodyElement, ev: Event) => any; - onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; - onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; - onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; - onresize: (this: HTMLBodyElement, ev: UIEvent) => any; - onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; - onunload: (this: HTMLBodyElement, ev: Event) => any; - text: any; - vLink: any; - addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. - */ - toDataURL(type?: string, ...args: any[]): string; - toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Retrieves an object from various collections. - */ - item(index: number): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollectionOf; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElementEventMap extends ElementEventMap { - "abort": UIEvent; - "activate": UIEvent; - "beforeactivate": UIEvent; - "beforecopy": ClipboardEvent; - "beforecut": ClipboardEvent; - "beforedeactivate": UIEvent; - "beforepaste": ClipboardEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "contextmenu": PointerEvent; - "copy": ClipboardEvent; - "cuechange": Event; - "cut": ClipboardEvent; - "dblclick": MouseEvent; - "deactivate": UIEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "mousedown": MouseEvent; - "mouseenter": MouseEvent; - "mouseleave": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSContentZoom": UIEvent; - "MSManipulationStateChanged": MSManipulationEvent; - "paste": ClipboardEvent; - "pause": Event; - "play": Event; - "playing": Event; - "progress": ProgressEvent; - "ratechange": Event; - "reset": Event; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "selectstart": Event; - "stalled": Event; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "volumechange": Event; - "waiting": Event; -} - -interface HTMLElement extends Element { - accessKey: string; - readonly children: HTMLCollection; - contentEditable: string; - readonly dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - readonly isContentEditable: boolean; - lang: string; - readonly offsetHeight: number; - readonly offsetLeft: number; - readonly offsetParent: Element; - readonly offsetTop: number; - readonly offsetWidth: number; - onabort: (this: HTMLElement, ev: UIEvent) => any; - onactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; - onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; - onblur: (this: HTMLElement, ev: FocusEvent) => any; - oncanplay: (this: HTMLElement, ev: Event) => any; - oncanplaythrough: (this: HTMLElement, ev: Event) => any; - onchange: (this: HTMLElement, ev: Event) => any; - onclick: (this: HTMLElement, ev: MouseEvent) => any; - oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; - oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; - oncuechange: (this: HTMLElement, ev: Event) => any; - oncut: (this: HTMLElement, ev: ClipboardEvent) => any; - ondblclick: (this: HTMLElement, ev: MouseEvent) => any; - ondeactivate: (this: HTMLElement, ev: UIEvent) => any; - ondrag: (this: HTMLElement, ev: DragEvent) => any; - ondragend: (this: HTMLElement, ev: DragEvent) => any; - ondragenter: (this: HTMLElement, ev: DragEvent) => any; - ondragleave: (this: HTMLElement, ev: DragEvent) => any; - ondragover: (this: HTMLElement, ev: DragEvent) => any; - ondragstart: (this: HTMLElement, ev: DragEvent) => any; - ondrop: (this: HTMLElement, ev: DragEvent) => any; - ondurationchange: (this: HTMLElement, ev: Event) => any; - onemptied: (this: HTMLElement, ev: Event) => any; - onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; - onerror: (this: HTMLElement, ev: ErrorEvent) => any; - onfocus: (this: HTMLElement, ev: FocusEvent) => any; - oninput: (this: HTMLElement, ev: Event) => any; - oninvalid: (this: HTMLElement, ev: Event) => any; - onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; - onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; - onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; - onload: (this: HTMLElement, ev: Event) => any; - onloadeddata: (this: HTMLElement, ev: Event) => any; - onloadedmetadata: (this: HTMLElement, ev: Event) => any; - onloadstart: (this: HTMLElement, ev: Event) => any; - onmousedown: (this: HTMLElement, ev: MouseEvent) => any; - onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; - onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; - onmousemove: (this: HTMLElement, ev: MouseEvent) => any; - onmouseout: (this: HTMLElement, ev: MouseEvent) => any; - onmouseover: (this: HTMLElement, ev: MouseEvent) => any; - onmouseup: (this: HTMLElement, ev: MouseEvent) => any; - onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; - onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; - onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; - onpause: (this: HTMLElement, ev: Event) => any; - onplay: (this: HTMLElement, ev: Event) => any; - onplaying: (this: HTMLElement, ev: Event) => any; - onprogress: (this: HTMLElement, ev: ProgressEvent) => any; - onratechange: (this: HTMLElement, ev: Event) => any; - onreset: (this: HTMLElement, ev: Event) => any; - onscroll: (this: HTMLElement, ev: UIEvent) => any; - onseeked: (this: HTMLElement, ev: Event) => any; - onseeking: (this: HTMLElement, ev: Event) => any; - onselect: (this: HTMLElement, ev: UIEvent) => any; - onselectstart: (this: HTMLElement, ev: Event) => any; - onstalled: (this: HTMLElement, ev: Event) => any; - onsubmit: (this: HTMLElement, ev: Event) => any; - onsuspend: (this: HTMLElement, ev: Event) => any; - ontimeupdate: (this: HTMLElement, ev: Event) => any; - onvolumechange: (this: HTMLElement, ev: Event) => any; - onwaiting: (this: HTMLElement, ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - readonly style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - msGetInputContext(): MSInputMethodContext; - setActive(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - readonly palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - readonly pluginspage: string; - readonly readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - readonly elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElementEventMap extends HTMLElementEventMap { - "load": Event; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: HTMLFrameElement, ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "load": Event; - "message": MessageEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "resize": UIEvent; - "storage": StorageEvent; - "unload": Event; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; - onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; - onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; - onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; - onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; - onload: (this: HTMLFrameSetElement, ev: Event) => any; - onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; - onoffline: (this: HTMLFrameSetElement, ev: Event) => any; - ononline: (this: HTMLFrameSetElement, ev: Event) => any; - onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; - onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; - onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; - onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; - onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; - onunload: (this: HTMLFrameSetElement, ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElementEventMap extends HTMLElementEventMap { - "load": Event; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: HTMLIFrameElement, ev: Event) => any; - readonly sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - crossOrigin: string; - readonly currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - lowsrc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - readonly naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - readonly naturalWidth: number; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - readonly x: number; - readonly y: number; - msGetAsCastingSource(): any; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - readonly files: FileList | null; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - readonly list: HTMLElement; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - selectionDirection: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - webkitdirectory: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start?: number, end?: number, direction?: string): void; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - import?: Document; - integrity: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - readonly areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { - "bounce": Event; - "finish": Event; - "start": Event; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (this: HTMLMarqueeElement, ev: Event) => any; - onfinish: (this: HTMLMarqueeElement, ev: Event) => any; - onstart: (this: HTMLMarqueeElement, ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): void; - addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElementEventMap extends HTMLElementEventMap { - "encrypted": MediaEncryptedEvent; - "msneedkey": MSMediaKeyNeededEvent; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - readonly audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - readonly buffered: TimeRanges; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - crossOrigin: string; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - readonly currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - readonly duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - readonly ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - readonly error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - readonly mediaKeys: MediaKeys | null; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - readonly msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - readonly msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - readonly networkState: number; - onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - readonly paused: boolean; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - readonly played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - readonly seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - readonly seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcObject: MediaStream | null; - readonly textTracks: TextTrackList; - readonly videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Resets the audio or video object and loads a new media resource. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; - addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLMeterElement extends HTMLElement { - high: number; - low: number; - max: number; - min: number; - optimum: number; - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMeterElement: { - prototype: HTMLMeterElement; - new(): HTMLMeterElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - readonly object: any; - readonly readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - readonly text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLOptionsCollection extends HTMLCollectionOf { - length: number; - selectedIndex: number; - add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; - remove(index: number): void; -} - -declare var HTMLOptionsCollection: { - prototype: HTMLOptionsCollection; - new(): HTMLOptionsCollection; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPictureElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - readonly position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - integrity: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - readonly options: HTMLOptionsCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - selectedOptions: HTMLCollectionOf; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - disabled: boolean; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - readonly cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollectionOf; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollectionOf; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - readonly rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - readonly sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableDataCellElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTemplateElement extends HTMLElement { - readonly content: DocumentFragment; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readonly readyState: number; - src: string; - srclang: string; - readonly track: TextTrack; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { - "MSVideoFormatChanged": Event; - "MSVideoFrameStepCompleted": Event; - "MSVideoOptimalLayoutChanged": Event; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - readonly msIsLayoutOptimalForPlayback: boolean; - readonly msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoWidth: number; - readonly webkitDisplayingFullscreen: boolean; - readonly webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): void; - addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - readonly newURL: string | null; - readonly oldURL: string | null; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - readonly length: number; - readonly state: any; - scrollRestoration: ScrollRestoration; - back(): void; - forward(): void; - go(delta?: number): void; - pushState(data: any, title: string, url?: string | null): void; - replaceState(data: any, title: string, url?: string | null): void; -} - -declare var History: { - prototype: History; - new(): History; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabaseEventMap { - "abort": Event; - "error": ErrorEvent; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: IDBDatabase, ev: Event) => any; - onerror: (this: IDBDatabase, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; - "upgradeneeded": IDBVersionChangeEvent; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: IDBOpenDBRequest, ev: Event) => any; - onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; - addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequestEventMap { - "error": ErrorEvent; - "success": Event; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: IDBRequest, ev: ErrorEvent) => any; - onsuccess: (this: IDBRequest, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransactionEventMap { - "abort": Event; - "complete": Event; - "error": ErrorEvent; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: IDBTransaction, ev: Event) => any; - oncomplete: (this: IDBTransaction, ev: Event) => any; - onerror: (this: IDBTransaction, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - readonly altKey: boolean; - readonly char: string | null; - readonly charCode: number; - readonly ctrlKey: boolean; - readonly key: string; - readonly keyCode: number; - readonly locale: string; - readonly location: number; - readonly metaKey: boolean; - readonly repeat: boolean; - readonly shiftKey: boolean; - readonly which: number; - readonly code: string; - getModifierState(keyArg: string): boolean; - initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -interface ListeningStateChangedEvent extends Event { - readonly label: string; - readonly state: string; -} - -declare var ListeningStateChangedEvent: { - prototype: ListeningStateChangedEvent; - new(): ListeningStateChangedEvent; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - readonly executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperationEventMap { - "complete": Event; - "error": ErrorEvent; -} - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; - onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSAssertion { - readonly id: string; - readonly type: string; -} - -declare var MSAssertion: { - prototype: MSAssertion; - new(): MSAssertion; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; -} - -declare var MSCredentials: { - prototype: MSCredentials; - new(): MSCredentials; -} - -interface MSFIDOCredentialAssertion extends MSAssertion { - readonly algorithm: string | Algorithm; - readonly attestation: any; - readonly publicKey: string; - readonly transportHints: string[]; -} - -declare var MSFIDOCredentialAssertion: { - prototype: MSFIDOCredentialAssertion; - new(): MSFIDOCredentialAssertion; -} - -interface MSFIDOSignature { - readonly authnrData: string; - readonly clientData: string; - readonly signature: string; -} - -declare var MSFIDOSignature: { - prototype: MSFIDOSignature; - new(): MSFIDOSignature; -} - -interface MSFIDOSignatureAssertion extends MSAssertion { - readonly signature: MSFIDOSignature; -} - -declare var MSFIDOSignatureAssertion: { - prototype: MSFIDOSignatureAssertion; - new(): MSFIDOSignatureAssertion; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - readonly clientX: number; - readonly clientY: number; - readonly expansion: number; - readonly gestureObject: any; - readonly hwTimestamp: number; - readonly offsetX: number; - readonly offsetY: number; - readonly rotation: number; - readonly scale: number; - readonly screenX: number; - readonly screenY: number; - readonly translationX: number; - readonly translationY: number; - readonly velocityAngular: number; - readonly velocityExpansion: number; - readonly velocityX: number; - readonly velocityY: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - readonly constrictionActive: boolean; - readonly status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - readonly canGoBack: boolean; - readonly canGoForward: boolean; - readonly containsFullScreenElement: boolean; - readonly documentTitle: string; - height: number; - readonly settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContextEventMap { - "MSCandidateWindowHide": Event; - "MSCandidateWindowShow": Event; - "MSCandidateWindowUpdate": Event; -} - -interface MSInputMethodContext extends EventTarget { - readonly compositionEndOffset: number; - readonly compositionStartOffset: number; - oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; - oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; - oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; - readonly target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - readonly currentState: number; - readonly inertiaDestinationX: number; - readonly inertiaDestinationY: number; - readonly lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - readonly code: number; - readonly systemCode: number; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - readonly destinationURL: string | null; - readonly message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - readonly initData: Uint8Array | null; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - readonly error: MSMediaKeyError | null; - readonly keySystem: string; - readonly sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - readonly keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; - isTypeSupportedWithFeatures(keySystem: string, type?: string): string; -} - -interface MSPointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - readonly length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - readonly actionURL: string; - readonly buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperationEventMap { - "complete": Event; - "error": ErrorEvent; -} - -interface MSWebViewAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; - onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - readonly target: MSHTMLWebViewElement; - readonly type: number; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaDeviceInfo { - readonly deviceId: string; - readonly groupId: string; - readonly kind: string; - readonly label: string; -} - -declare var MediaDeviceInfo: { - prototype: MediaDeviceInfo; - new(): MediaDeviceInfo; -} - -interface MediaDevicesEventMap { - "devicechange": Event; -} - -interface MediaDevices extends EventTarget { - ondevicechange: (this: MediaDevices, ev: Event) => any; - enumerateDevices(): any; - getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaDevices: { - prototype: MediaDevices; - new(): MediaDevices; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaEncryptedEvent extends Event { - readonly initData: ArrayBuffer | null; - readonly initDataType: string; -} - -declare var MediaEncryptedEvent: { - prototype: MediaEncryptedEvent; - new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; -} - -interface MediaError { - readonly code: number; - readonly msExtendedCode: number; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaKeyMessageEvent extends Event { - readonly message: ArrayBuffer; - readonly messageType: string; -} - -declare var MediaKeyMessageEvent: { - prototype: MediaKeyMessageEvent; - new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; -} - -interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; - readonly expiration: number; - readonly keyStatuses: MediaKeyStatusMap; - readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; -} - -declare var MediaKeySession: { - prototype: MediaKeySession; - new(): MediaKeySession; -} - -interface MediaKeyStatusMap { - readonly size: number; - forEach(callback: ForEachCallback): void; - get(keyId: any): string; - has(keyId: any): boolean; -} - -declare var MediaKeyStatusMap: { - prototype: MediaKeyStatusMap; - new(): MediaKeyStatusMap; -} - -interface MediaKeySystemAccess { - readonly keySystem: string; - createMediaKeys(): PromiseLike; - getConfiguration(): MediaKeySystemConfiguration; -} - -declare var MediaKeySystemAccess: { - prototype: MediaKeySystemAccess; - new(): MediaKeySystemAccess; -} - -interface MediaKeys { - createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; -} - -declare var MediaKeys: { - prototype: MediaKeys; - new(): MediaKeys; -} - -interface MediaList { - readonly length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - readonly activeSourceBuffers: SourceBufferList; - duration: number; - readonly readyState: string; - readonly sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MediaStreamEventMap { - "active": Event; - "addtrack": TrackEvent; - "inactive": Event; - "removetrack": TrackEvent; -} - -interface MediaStream extends EventTarget { - readonly active: boolean; - readonly id: string; - onactive: (this: MediaStream, ev: Event) => any; - onaddtrack: (this: MediaStream, ev: TrackEvent) => any; - oninactive: (this: MediaStream, ev: Event) => any; - onremovetrack: (this: MediaStream, ev: TrackEvent) => any; - addTrack(track: MediaStreamTrack): void; - clone(): MediaStream; - getAudioTracks(): MediaStreamTrack[]; - getTrackById(trackId: string): MediaStreamTrack | null; - getTracks(): MediaStreamTrack[]; - getVideoTracks(): MediaStreamTrack[]; - removeTrack(track: MediaStreamTrack): void; - stop(): void; - addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStream: { - prototype: MediaStream; - new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; -} - -interface MediaStreamAudioSourceNode extends AudioNode { -} - -declare var MediaStreamAudioSourceNode: { - prototype: MediaStreamAudioSourceNode; - new(): MediaStreamAudioSourceNode; -} - -interface MediaStreamError { - readonly constraintName: string | null; - readonly message: string | null; - readonly name: string; -} - -declare var MediaStreamError: { - prototype: MediaStreamError; - new(): MediaStreamError; -} - -interface MediaStreamErrorEvent extends Event { - readonly error: MediaStreamError | null; -} - -declare var MediaStreamErrorEvent: { - prototype: MediaStreamErrorEvent; - new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; -} - -interface MediaStreamTrackEventMap { - "ended": MediaStreamErrorEvent; - "mute": Event; - "overconstrained": MediaStreamErrorEvent; - "unmute": Event; -} - -interface MediaStreamTrack extends EventTarget { - enabled: boolean; - readonly id: string; - readonly kind: string; - readonly label: string; - readonly muted: boolean; - onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; - onmute: (this: MediaStreamTrack, ev: Event) => any; - onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; - onunmute: (this: MediaStreamTrack, ev: Event) => any; - readonly readonly: boolean; - readonly readyState: string; - readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; - clone(): MediaStreamTrack; - getCapabilities(): MediaTrackCapabilities; - getConstraints(): MediaTrackConstraints; - getSettings(): MediaTrackSettings; - stop(): void; - addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStreamTrack: { - prototype: MediaStreamTrack; - new(): MediaStreamTrack; -} - -interface MediaStreamTrackEvent extends Event { - readonly track: MediaStreamTrack; -} - -declare var MediaStreamTrackEvent: { - prototype: MediaStreamTrackEvent; - new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePortEventMap { - "message": MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: MessagePort, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - readonly description: string; - readonly enabledPlugin: Plugin; - readonly suffixes: string; - readonly type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - readonly length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - readonly altKey: boolean; - readonly button: number; - readonly buttons: number; - readonly clientX: number; - readonly clientY: number; - readonly ctrlKey: boolean; - readonly fromElement: Element; - readonly layerX: number; - readonly layerY: number; - readonly metaKey: boolean; - readonly movementX: number; - readonly movementY: number; - readonly offsetX: number; - readonly offsetY: number; - readonly pageX: number; - readonly pageY: number; - readonly relatedTarget: EventTarget; - readonly screenX: number; - readonly screenY: number; - readonly shiftKey: boolean; - readonly toElement: Element; - readonly which: number; - readonly x: number; - readonly y: number; - getModifierState(keyArg: string): boolean; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MutationEvent extends Event { - readonly attrChange: number; - readonly attrName: string; - readonly newValue: string; - readonly prevValue: string; - readonly relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - readonly addedNodes: NodeList; - readonly attributeName: string | null; - readonly attributeNamespace: string | null; - readonly nextSibling: Node | null; - readonly oldValue: string | null; - readonly previousSibling: Node | null; - readonly removedNodes: NodeList; - readonly target: Node; - readonly type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - readonly length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - readonly isSuccess: boolean; - readonly webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - readonly uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - readonly referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { - readonly appCodeName: string; - readonly cookieEnabled: boolean; - readonly language: string; - readonly maxTouchPoints: number; - readonly mimeTypes: MimeTypeArray; - readonly msManipulationViewsEnabled: boolean; - readonly msMaxTouchPoints: number; - readonly msPointerEnabled: boolean; - readonly plugins: PluginArray; - readonly pointerEnabled: boolean; - readonly webdriver: boolean; - readonly hardwareConcurrency: number; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; - vibrate(pattern: number | number[]): boolean; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - readonly attributes: NamedNodeMap; - readonly baseURI: string | null; - readonly childNodes: NodeList; - readonly firstChild: Node | null; - readonly lastChild: Node | null; - readonly localName: string | null; - readonly namespaceURI: string | null; - readonly nextSibling: Node | null; - readonly nodeName: string; - readonly nodeType: number; - nodeValue: string | null; - readonly ownerDocument: Document; - readonly parentElement: HTMLElement | null; - readonly parentNode: Node | null; - readonly previousSibling: Node | null; - textContent: string | null; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - contains(child: Node): boolean; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; - isDefaultNamespace(namespaceURI: string | null): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string | null): string | null; - lookupPrefix(namespaceURI: string | null): string | null; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - readonly FILTER_ACCEPT: number; - readonly FILTER_REJECT: number; - readonly FILTER_SKIP: number; - readonly SHOW_ALL: number; - readonly SHOW_ATTRIBUTE: number; - readonly SHOW_CDATA_SECTION: number; - readonly SHOW_COMMENT: number; - readonly SHOW_DOCUMENT: number; - readonly SHOW_DOCUMENT_FRAGMENT: number; - readonly SHOW_DOCUMENT_TYPE: number; - readonly SHOW_ELEMENT: number; - readonly SHOW_ENTITY: number; - readonly SHOW_ENTITY_REFERENCE: number; - readonly SHOW_NOTATION: number; - readonly SHOW_PROCESSING_INSTRUCTION: number; - readonly SHOW_TEXT: number; -} - -interface NodeIterator { - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - readonly length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - readonly renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContextEventMap { - "complete": Event; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (this: OfflineAudioContext, ev: Event) => any; - startRendering(): PromiseLike; - addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNodeEventMap { - "ended": MediaStreamErrorEvent; -} - -interface OscillatorNode extends AudioNode { - readonly detune: AudioParam; - readonly frequency: AudioParam; - onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface OverflowEvent extends UIEvent { - readonly horizontalOverflow: boolean; - readonly orient: number; - readonly verticalOverflow: boolean; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -declare var OverflowEvent: { - prototype: OverflowEvent; - new(): OverflowEvent; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -interface PageTransitionEvent extends Event { - readonly persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - readonly activeNetworkRequestCount: number; - readonly averageFrameTime: number; - readonly averagePaintTime: number; - readonly extraInformationEnabled: boolean; - readonly independentRenderingEnabled: boolean; - readonly irDisablingContentString: string; - readonly irStatusAvailable: boolean; - readonly maxCpuSpeed: number; - readonly paintRequestsPerSecond: number; - readonly performanceCounter: number; - readonly performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number | null): any; - getRecentFrames(last: number | null): any; - getRecentMemoryUsage(last: number | null): any; - getRecentPaintRequests(last: number | null): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - readonly navigation: PerformanceNavigation; - readonly timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - readonly duration: number; - readonly entryType: string; - readonly name: string; - readonly startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - readonly redirectCount: number; - readonly type: number; - toJSON(): any; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly navigationStart: number; - readonly redirectCount: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly type: string; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly initiatorType: string; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly msFirstPaint: number; - readonly navigationStart: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; - readonly secureConnectionStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - readonly state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - readonly permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - readonly description: string; - readonly filename: string; - readonly length: number; - readonly name: string; - readonly version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - readonly length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - readonly state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - readonly target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface RTCDTMFToneChangeEvent extends Event { - readonly tone: string; -} - -declare var RTCDTMFToneChangeEvent: { - prototype: RTCDTMFToneChangeEvent; - new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; -} - -interface RTCDtlsTransportEventMap { - "dtlsstatechange": RTCDtlsTransportStateChangedEvent; - "error": ErrorEvent; -} - -interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null; - readonly state: string; - readonly transport: RTCIceTransport; - getLocalParameters(): RTCDtlsParameters; - getRemoteCertificates(): ArrayBuffer[]; - getRemoteParameters(): RTCDtlsParameters | null; - start(remoteParameters: RTCDtlsParameters): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtlsTransport: { - prototype: RTCDtlsTransport; - new(transport: RTCIceTransport): RTCDtlsTransport; -} - -interface RTCDtlsTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCDtlsTransportStateChangedEvent: { - prototype: RTCDtlsTransportStateChangedEvent; - new(): RTCDtlsTransportStateChangedEvent; -} - -interface RTCDtmfSenderEventMap { - "tonechange": RTCDTMFToneChangeEvent; -} - -interface RTCDtmfSender extends EventTarget { - readonly canInsertDTMF: boolean; - readonly duration: number; - readonly interToneGap: number; - ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; - readonly sender: RTCRtpSender; - readonly toneBuffer: string; - insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtmfSender: { - prototype: RTCDtmfSender; - new(sender: RTCRtpSender): RTCDtmfSender; -} - -interface RTCIceCandidatePairChangedEvent extends Event { - readonly pair: RTCIceCandidatePair; -} - -declare var RTCIceCandidatePairChangedEvent: { - prototype: RTCIceCandidatePairChangedEvent; - new(): RTCIceCandidatePairChangedEvent; -} - -interface RTCIceGathererEventMap { - "error": ErrorEvent; - "localcandidate": RTCIceGathererEvent; -} - -interface RTCIceGatherer extends RTCStatsProvider { - readonly component: string; - onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; - createAssociatedGatherer(): RTCIceGatherer; - getLocalCandidates(): RTCIceCandidate[]; - getLocalParameters(): RTCIceParameters; - addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceGatherer: { - prototype: RTCIceGatherer; - new(options: RTCIceGatherOptions): RTCIceGatherer; -} - -interface RTCIceGathererEvent extends Event { - readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; -} - -declare var RTCIceGathererEvent: { - prototype: RTCIceGathererEvent; - new(): RTCIceGathererEvent; -} - -interface RTCIceTransportEventMap { - "candidatepairchange": RTCIceCandidatePairChangedEvent; - "icestatechange": RTCIceTransportStateChangedEvent; -} - -interface RTCIceTransport extends RTCStatsProvider { - readonly component: string; - readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; - readonly role: string; - readonly state: string; - addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; - createAssociatedTransport(): RTCIceTransport; - getNominatedCandidatePair(): RTCIceCandidatePair | null; - getRemoteCandidates(): RTCIceCandidate[]; - getRemoteParameters(): RTCIceParameters | null; - setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; - start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceTransport: { - prototype: RTCIceTransport; - new(): RTCIceTransport; -} - -interface RTCIceTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCIceTransportStateChangedEvent: { - prototype: RTCIceTransportStateChangedEvent; - new(): RTCIceTransportStateChangedEvent; -} - -interface RTCRtpReceiverEventMap { - "error": ErrorEvent; -} - -interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack | null; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - getContributingSources(): RTCRtpContributingSource[]; - receive(parameters: RTCRtpParameters): void; - requestSendCSRC(csrc: number): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpReceiver: { - prototype: RTCRtpReceiver; - new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCRtpSenderEventMap { - "error": ErrorEvent; - "ssrcconflict": RTCSsrcConflictEvent; -} - -interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - send(parameters: RTCRtpParameters): void; - setTrack(track: MediaStreamTrack): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpSender: { - prototype: RTCRtpSender; - new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCSrtpSdesTransportEventMap { - "error": ErrorEvent; -} - -interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null; - readonly transport: RTCIceTransport; - addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCSrtpSdesTransport: { - prototype: RTCSrtpSdesTransport; - new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; - getLocalParameters(): RTCSrtpSdesParameters[]; -} - -interface RTCSsrcConflictEvent extends Event { - readonly ssrc: number; -} - -declare var RTCSsrcConflictEvent: { - prototype: RTCSsrcConflictEvent; - new(): RTCSsrcConflictEvent; -} - -interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; -} - -declare var RTCStatsProvider: { - prototype: RTCStatsProvider; - new(): RTCStatsProvider; -} - -interface Range { - readonly collapsed: boolean; - readonly commonAncestorContainer: Node; - readonly endContainer: Node; - readonly endOffset: number; - readonly startContainer: Node; - readonly startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly target: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - readonly animVal: SVGAngle; - readonly baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - readonly animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - readonly animVal: SVGLength; - readonly baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - readonly animVal: SVGLengthList; - readonly baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - readonly animVal: SVGNumberList; - readonly baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - readonly animVal: SVGPreserveAspectRatio; - readonly baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - readonly animVal: SVGRect; - readonly baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - readonly animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - readonly animVal: SVGTransformList; - readonly baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - readonly amplitude: SVGAnimatedNumber; - readonly exponent: SVGAnimatedNumber; - readonly intercept: SVGAnimatedNumber; - readonly offset: SVGAnimatedNumber; - readonly slope: SVGAnimatedNumber; - readonly tableValues: SVGAnimatedNumberList; - readonly type: SVGAnimatedEnumeration; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElementEventMap extends ElementEventMap { - "click": MouseEvent; - "dblclick": MouseEvent; - "focusin": FocusEvent; - "focusout": FocusEvent; - "load": Event; - "mousedown": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; -} - -interface SVGElement extends Element { - onclick: (this: SVGElement, ev: MouseEvent) => any; - ondblclick: (this: SVGElement, ev: MouseEvent) => any; - onfocusin: (this: SVGElement, ev: FocusEvent) => any; - onfocusout: (this: SVGElement, ev: FocusEvent) => any; - onload: (this: SVGElement, ev: Event) => any; - onmousedown: (this: SVGElement, ev: MouseEvent) => any; - onmousemove: (this: SVGElement, ev: MouseEvent) => any; - onmouseout: (this: SVGElement, ev: MouseEvent) => any; - onmouseover: (this: SVGElement, ev: MouseEvent) => any; - onmouseup: (this: SVGElement, ev: MouseEvent) => any; - readonly ownerSVGElement: SVGSVGElement; - readonly viewportElement: SVGElement; - xmlbase: string; - className: any; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - readonly childNodes: SVGElementInstanceList; - readonly correspondingElement: SVGElement; - readonly correspondingUseElement: SVGUseElement; - readonly firstChild: SVGElementInstance; - readonly lastChild: SVGElementInstance; - readonly nextSibling: SVGElementInstance; - readonly parentNode: SVGElementInstance; - readonly previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - readonly length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly mode: SVGAnimatedEnumeration; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly type: SVGAnimatedEnumeration; - readonly values: SVGAnimatedNumberList; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly k1: SVGAnimatedNumber; - readonly k2: SVGAnimatedNumber; - readonly k3: SVGAnimatedNumber; - readonly k4: SVGAnimatedNumber; - readonly operator: SVGAnimatedEnumeration; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly bias: SVGAnimatedNumber; - readonly divisor: SVGAnimatedNumber; - readonly edgeMode: SVGAnimatedEnumeration; - readonly in1: SVGAnimatedString; - readonly kernelMatrix: SVGAnimatedNumberList; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly orderX: SVGAnimatedInteger; - readonly orderY: SVGAnimatedInteger; - readonly preserveAlpha: SVGAnimatedBoolean; - readonly targetX: SVGAnimatedInteger; - readonly targetY: SVGAnimatedInteger; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly diffuseConstant: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly scale: SVGAnimatedNumber; - readonly xChannelSelector: SVGAnimatedEnumeration; - readonly yChannelSelector: SVGAnimatedEnumeration; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - readonly azimuth: SVGAnimatedNumber; - readonly elevation: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly stdDeviationX: SVGAnimatedNumber; - readonly stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly operator: SVGAnimatedEnumeration; - readonly radiusX: SVGAnimatedNumber; - readonly radiusY: SVGAnimatedNumber; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly dx: SVGAnimatedNumber; - readonly dy: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly specularConstant: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - readonly limitingConeAngle: SVGAnimatedNumber; - readonly pointsAtX: SVGAnimatedNumber; - readonly pointsAtY: SVGAnimatedNumber; - readonly pointsAtZ: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly baseFrequencyX: SVGAnimatedNumber; - readonly baseFrequencyY: SVGAnimatedNumber; - readonly numOctaves: SVGAnimatedInteger; - readonly seed: SVGAnimatedNumber; - readonly stitchTiles: SVGAnimatedEnumeration; - readonly type: SVGAnimatedEnumeration; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly filterResX: SVGAnimatedInteger; - readonly filterResY: SVGAnimatedInteger; - readonly filterUnits: SVGAnimatedEnumeration; - readonly height: SVGAnimatedLength; - readonly primitiveUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - readonly gradientTransform: SVGAnimatedTransformList; - readonly gradientUnits: SVGAnimatedEnumeration; - readonly spreadMethod: SVGAnimatedEnumeration; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly height: SVGAnimatedLength; - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - readonly numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - readonly markerHeight: SVGAnimatedLength; - readonly markerUnits: SVGAnimatedEnumeration; - readonly markerWidth: SVGAnimatedLength; - readonly orientAngle: SVGAnimatedAngle; - readonly orientType: SVGAnimatedEnumeration; - readonly refX: SVGAnimatedLength; - readonly refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly maskContentUnits: SVGAnimatedEnumeration; - readonly maskUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - readonly numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - readonly pathSegType: number; - readonly pathSegTypeAsLetter: string; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - readonly numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly patternContentUnits: SVGAnimatedEnumeration; - readonly patternTransform: SVGAnimatedTransformList; - readonly patternUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - readonly numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly fx: SVGAnimatedLength; - readonly fy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElementEventMap extends SVGElementEventMap { - "SVGAbort": Event; - "SVGError": Event; - "resize": UIEvent; - "scroll": UIEvent; - "SVGUnload": Event; - "SVGZoom": SVGZoomEvent; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - readonly currentTranslate: SVGPoint; - readonly height: SVGAnimatedLength; - onabort: (this: SVGSVGElement, ev: Event) => any; - onerror: (this: SVGSVGElement, ev: Event) => any; - onresize: (this: SVGSVGElement, ev: UIEvent) => any; - onscroll: (this: SVGSVGElement, ev: UIEvent) => any; - onunload: (this: SVGSVGElement, ev: Event) => any; - onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; - readonly pixelUnitToMillimeterX: number; - readonly pixelUnitToMillimeterY: number; - readonly screenPixelToMillimeterX: number; - readonly screenPixelToMillimeterY: number; - readonly viewport: SVGRect; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): void; - addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - readonly offset: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - readonly numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - disabled: boolean; - media: string; - title: string; - type: string; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly lengthAdjust: SVGAnimatedEnumeration; - readonly textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - readonly method: SVGAnimatedEnumeration; - readonly spacing: SVGAnimatedEnumeration; - readonly startOffset: SVGAnimatedLength; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - readonly dx: SVGAnimatedLengthList; - readonly dy: SVGAnimatedLengthList; - readonly rotate: SVGAnimatedNumberList; - readonly x: SVGAnimatedLengthList; - readonly y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - readonly angle: number; - readonly matrix: SVGMatrix; - readonly type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - readonly numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - readonly SVG_UNIT_TYPE_UNKNOWN: number; - readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly animatedInstanceRoot: SVGElementInstance; - readonly height: SVGAnimatedLength; - readonly instanceRoot: SVGElementInstance; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - readonly viewTarget: SVGStringList; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - readonly zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - readonly SVG_ZOOMANDPAN_DISABLE: number; - readonly SVG_ZOOMANDPAN_MAGNIFY: number; - readonly SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - readonly newScale: number; - readonly newTranslate: SVGPoint; - readonly previousScale: number; - readonly previousTranslate: SVGPoint; - readonly zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface ScreenEventMap { - "MSOrientationChange": Event; -} - -interface Screen extends EventTarget { - readonly availHeight: number; - readonly availWidth: number; - bufferDepth: number; - readonly colorDepth: number; - readonly deviceXDPI: number; - readonly deviceYDPI: number; - readonly fontSmoothingEnabled: boolean; - readonly height: number; - readonly logicalXDPI: number; - readonly logicalYDPI: number; - readonly msOrientation: string; - onmsorientationchange: (this: Screen, ev: Event) => any; - readonly pixelDepth: number; - readonly systemXDPI: number; - readonly systemYDPI: number; - readonly width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - readonly callingUri: string; - readonly value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNodeEventMap { - "audioprocess": AudioProcessingEvent; -} - -interface ScriptProcessorNode extends AudioNode { - readonly bufferSize: number; - onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; - addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - readonly anchorNode: Node; - readonly anchorOffset: number; - readonly focusNode: Node; - readonly focusOffset: number; - readonly isCollapsed: boolean; - readonly rangeCount: number; - readonly type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - readonly audioTracks: AudioTrackList; - readonly buffered: TimeRanges; - mode: string; - timestampOffset: number; - readonly updating: boolean; - readonly videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - readonly length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - readonly pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - readonly length: number; - clear(): void; - getItem(key: string): string | null; - key(index: number): string | null; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - readonly url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - readonly type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - readonly href: string; - readonly media: MediaList; - readonly ownerNode: Node; - readonly parentStyleSheet: StyleSheet; - readonly title: string; - readonly type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - readonly length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - readonly length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; - deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; - encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - exportKey(format: "jwk", key: CryptoKey): PromiseLike; - exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; - exportKey(format: string, key: CryptoKey): PromiseLike; - generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; - unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; - verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - readonly wholeText: string; - readonly assignedSlot: HTMLSlotElement | null; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - readonly data: string; - readonly inputMethod: number; - readonly locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - readonly width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextTrackEventMap { - "cuechange": Event; - "error": ErrorEvent; - "load": Event; -} - -interface TextTrack extends EventTarget { - readonly activeCues: TextTrackCueList; - readonly cues: TextTrackCueList; - readonly inBandMetadataTrackDispatchType: string; - readonly kind: string; - readonly label: string; - readonly language: string; - mode: any; - oncuechange: (this: TextTrack, ev: Event) => any; - onerror: (this: TextTrack, ev: ErrorEvent) => any; - onload: (this: TextTrack, ev: Event) => any; - readonly readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; - addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; -} - -interface TextTrackCueEventMap { - "enter": Event; - "exit": Event; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (this: TextTrackCue, ev: Event) => any; - onexit: (this: TextTrackCue, ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - readonly track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - readonly length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackListEventMap { - "addtrack": TrackEvent; -} - -interface TextTrackList extends EventTarget { - readonly length: number; - onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; - item(index: number): TextTrack; - addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - readonly length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - readonly clientX: number; - readonly clientY: number; - readonly identifier: number; - readonly pageX: number; - readonly pageY: number; - readonly screenX: number; - readonly screenY: number; - readonly target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - readonly altKey: boolean; - readonly changedTouches: TouchList; - readonly ctrlKey: boolean; - readonly metaKey: boolean; - readonly shiftKey: boolean; - readonly targetTouches: TouchList; - readonly touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - readonly length: number; - item(index: number): Touch | null; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - readonly track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - readonly elapsedTime: number; - readonly propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - readonly detail: number; - readonly view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - toString(): string; -} - -declare var URL: { - prototype: URL; - new(url: string, base?: string): URL; - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - readonly mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - readonly badInput: boolean; - readonly customError: boolean; - readonly patternMismatch: boolean; - readonly rangeOverflow: boolean; - readonly rangeUnderflow: boolean; - readonly stepMismatch: boolean; - readonly tooLong: boolean; - readonly typeMismatch: boolean; - readonly valid: boolean; - readonly valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - readonly corruptedVideoFrames: number; - readonly creationTime: number; - readonly droppedVideoFrames: number; - readonly totalFrameDelay: number; - readonly totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - readonly id: string; - kind: string; - readonly label: string; - language: string; - selected: boolean; - readonly sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackListEventMap { - "addtrack": TrackEvent; - "change": Event; - "removetrack": TrackEvent; -} - -interface VideoTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; - onchange: (this: VideoTrackList, ev: Event) => any; - onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; - readonly selectedIndex: number; - getTrackById(id: string): VideoTrack | null; - item(index: number): VideoTrack; - addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array | null; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - readonly name: string; - readonly size: number; - readonly type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - readonly statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - readonly canvas: HTMLCanvasElement; - readonly drawingBufferHeight: number; - readonly drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer | null): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; - bindTexture(target: number, texture: WebGLTexture | null): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader | null): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer | null; - createFramebuffer(): WebGLFramebuffer | null; - createProgram(): WebGLProgram | null; - createRenderbuffer(): WebGLRenderbuffer | null; - createShader(type: number): WebGLShader | null; - createTexture(): WebGLTexture | null; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer | null): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; - deleteProgram(program: WebGLProgram | null): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; - deleteShader(shader: WebGLShader | null): void; - deleteTexture(texture: WebGLTexture | null): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; - getAttribLocation(program: WebGLProgram | null, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram | null): string | null; - getProgramParameter(program: WebGLProgram | null, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader | null): string | null; - getShaderParameter(shader: WebGLShader | null, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; - getShaderSource(shader: WebGLShader | null): string | null; - getSupportedExtensions(): string[] | null; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; - getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer | null): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; - isProgram(program: WebGLProgram | null): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; - isShader(shader: WebGLShader | null): boolean; - isTexture(texture: WebGLTexture | null): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram | null): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader | null, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - useProgram(program: WebGLProgram | null): void; - validateProgram(program: WebGLProgram | null): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - readonly precision: number; - readonly rangeMax: number; - readonly rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocketEventMap { - "close": CloseEvent; - "error": ErrorEvent; - "message": MessageEvent; - "open": Event; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: WebSocket, ev: CloseEvent) => any; - onerror: (this: WebSocket, ev: ErrorEvent) => any; - onmessage: (this: WebSocket, ev: MessageEvent) => any; - onopen: (this: WebSocket, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WheelEvent extends MouseEvent { - readonly deltaMode: number; - readonly deltaX: number; - readonly deltaY: number; - readonly deltaZ: number; - readonly wheelDelta: number; - readonly wheelDeltaX: number; - readonly wheelDeltaY: number; - getCurrentPoint(element: Element): void; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -interface WindowEventMap extends GlobalEventHandlersEventMap { - "abort": UIEvent; - "afterprint": Event; - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "compassneedscalibration": Event; - "contextmenu": PointerEvent; - "dblclick": MouseEvent; - "devicelight": DeviceLightEvent; - "devicemotion": DeviceMotionEvent; - "deviceorientation": DeviceOrientationEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "message": MessageEvent; - "mousedown": MouseEvent; - "mouseenter": MouseEvent; - "mouseleave": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSInertiaStart": MSGestureEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "pause": Event; - "play": Event; - "playing": Event; - "popstate": PopStateEvent; - "progress": ProgressEvent; - "ratechange": Event; - "readystatechange": ProgressEvent; - "reset": Event; - "resize": UIEvent; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "stalled": Event; - "storage": StorageEvent; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "unload": Event; - "volumechange": Event; - "waiting": Event; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - readonly applicationCache: ApplicationCache; - readonly clientInformation: Navigator; - readonly closed: boolean; - readonly crypto: Crypto; - defaultStatus: string; - readonly devicePixelRatio: number; - readonly doNotTrack: string; - readonly document: Document; - event: Event | undefined; - readonly external: External; - readonly frameElement: Element; - readonly frames: Window; - readonly history: History; - readonly innerHeight: number; - readonly innerWidth: number; - readonly length: number; - readonly location: Location; - readonly locationbar: BarProp; - readonly menubar: BarProp; - readonly msCredentials: MSCredentials; - name: string; - readonly navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (this: Window, ev: UIEvent) => any; - onafterprint: (this: Window, ev: Event) => any; - onbeforeprint: (this: Window, ev: Event) => any; - onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; - onblur: (this: Window, ev: FocusEvent) => any; - oncanplay: (this: Window, ev: Event) => any; - oncanplaythrough: (this: Window, ev: Event) => any; - onchange: (this: Window, ev: Event) => any; - onclick: (this: Window, ev: MouseEvent) => any; - oncompassneedscalibration: (this: Window, ev: Event) => any; - oncontextmenu: (this: Window, ev: PointerEvent) => any; - ondblclick: (this: Window, ev: MouseEvent) => any; - ondevicelight: (this: Window, ev: DeviceLightEvent) => any; - ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; - ondrag: (this: Window, ev: DragEvent) => any; - ondragend: (this: Window, ev: DragEvent) => any; - ondragenter: (this: Window, ev: DragEvent) => any; - ondragleave: (this: Window, ev: DragEvent) => any; - ondragover: (this: Window, ev: DragEvent) => any; - ondragstart: (this: Window, ev: DragEvent) => any; - ondrop: (this: Window, ev: DragEvent) => any; - ondurationchange: (this: Window, ev: Event) => any; - onemptied: (this: Window, ev: Event) => any; - onended: (this: Window, ev: MediaStreamErrorEvent) => any; - onerror: ErrorEventHandler; - onfocus: (this: Window, ev: FocusEvent) => any; - onhashchange: (this: Window, ev: HashChangeEvent) => any; - oninput: (this: Window, ev: Event) => any; - oninvalid: (this: Window, ev: Event) => any; - onkeydown: (this: Window, ev: KeyboardEvent) => any; - onkeypress: (this: Window, ev: KeyboardEvent) => any; - onkeyup: (this: Window, ev: KeyboardEvent) => any; - onload: (this: Window, ev: Event) => any; - onloadeddata: (this: Window, ev: Event) => any; - onloadedmetadata: (this: Window, ev: Event) => any; - onloadstart: (this: Window, ev: Event) => any; - onmessage: (this: Window, ev: MessageEvent) => any; - onmousedown: (this: Window, ev: MouseEvent) => any; - onmouseenter: (this: Window, ev: MouseEvent) => any; - onmouseleave: (this: Window, ev: MouseEvent) => any; - onmousemove: (this: Window, ev: MouseEvent) => any; - onmouseout: (this: Window, ev: MouseEvent) => any; - onmouseover: (this: Window, ev: MouseEvent) => any; - onmouseup: (this: Window, ev: MouseEvent) => any; - onmousewheel: (this: Window, ev: WheelEvent) => any; - onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; - onmsgestureend: (this: Window, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; - onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; - onmspointercancel: (this: Window, ev: MSPointerEvent) => any; - onmspointerdown: (this: Window, ev: MSPointerEvent) => any; - onmspointerenter: (this: Window, ev: MSPointerEvent) => any; - onmspointerleave: (this: Window, ev: MSPointerEvent) => any; - onmspointermove: (this: Window, ev: MSPointerEvent) => any; - onmspointerout: (this: Window, ev: MSPointerEvent) => any; - onmspointerover: (this: Window, ev: MSPointerEvent) => any; - onmspointerup: (this: Window, ev: MSPointerEvent) => any; - onoffline: (this: Window, ev: Event) => any; - ononline: (this: Window, ev: Event) => any; - onorientationchange: (this: Window, ev: Event) => any; - onpagehide: (this: Window, ev: PageTransitionEvent) => any; - onpageshow: (this: Window, ev: PageTransitionEvent) => any; - onpause: (this: Window, ev: Event) => any; - onplay: (this: Window, ev: Event) => any; - onplaying: (this: Window, ev: Event) => any; - onpopstate: (this: Window, ev: PopStateEvent) => any; - onprogress: (this: Window, ev: ProgressEvent) => any; - onratechange: (this: Window, ev: Event) => any; - onreadystatechange: (this: Window, ev: ProgressEvent) => any; - onreset: (this: Window, ev: Event) => any; - onresize: (this: Window, ev: UIEvent) => any; - onscroll: (this: Window, ev: UIEvent) => any; - onseeked: (this: Window, ev: Event) => any; - onseeking: (this: Window, ev: Event) => any; - onselect: (this: Window, ev: UIEvent) => any; - onstalled: (this: Window, ev: Event) => any; - onstorage: (this: Window, ev: StorageEvent) => any; - onsubmit: (this: Window, ev: Event) => any; - onsuspend: (this: Window, ev: Event) => any; - ontimeupdate: (this: Window, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onunload: (this: Window, ev: Event) => any; - onvolumechange: (this: Window, ev: Event) => any; - onwaiting: (this: Window, ev: Event) => any; - opener: any; - orientation: string | number; - readonly outerHeight: number; - readonly outerWidth: number; - readonly pageXOffset: number; - readonly pageYOffset: number; - readonly parent: Window; - readonly performance: Performance; - readonly personalbar: BarProp; - readonly screen: Screen; - readonly screenLeft: number; - readonly screenTop: number; - readonly screenX: number; - readonly screenY: number; - readonly scrollX: number; - readonly scrollY: number; - readonly scrollbars: BarProp; - readonly self: Window; - status: string; - readonly statusbar: BarProp; - readonly styleMedia: StyleMedia; - readonly toolbar: BarProp; - readonly top: Window; - readonly window: Window; - URL: typeof URL; - Blob: typeof Blob; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, transfer?: any[]): void; - print(): void; - prompt(message?: string, _default?: string): string | null; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitCancelAnimationFrame(handle: number): void; - webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; - webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; - webkitRequestAnimationFrame(callback: FrameRequestCallback): number; - scroll(options?: ScrollToOptions): void; - scrollTo(options?: ScrollToOptions): void; - scrollBy(options?: ScrollToOptions): void; - addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface WorkerEventMap extends AbstractWorkerEventMap { - "message": MessageEvent; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: Worker, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { - "readystatechange": Event; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - readonly booleanValue: boolean; - readonly invalidIteratorState: boolean; - readonly numberValue: number; - readonly resultType: number; - readonly singleNodeValue: Node; - readonly snapshotLength: number; - readonly stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorkerEventMap { - "error": ErrorEvent; -} - -interface AbstractWorker { - onerror: (this: AbstractWorker, ev: ErrorEvent) => any; - addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface CanvasPathMethods { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"OverflowEvent"): OverflowEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - readonly childElementCount: number; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly nextElementSibling: Element; - readonly previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlersEventMap { - "pointercancel": PointerEvent; - "pointerdown": PointerEvent; - "pointerenter": PointerEvent; - "pointerleave": PointerEvent; - "pointermove": PointerEvent; - "pointerout": PointerEvent; - "pointerover": PointerEvent; - "pointerup": PointerEvent; - "wheel": WheelEvent; -} - -interface GlobalEventHandlers { - onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; - addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - readonly indexedDB: IDBFactory; -} - -interface LinkStyle { - readonly sheet: StyleSheet; -} - -interface MSBaseReaderEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; -} - -interface MSBaseReader { - onabort: (this: MSBaseReader, ev: Event) => any; - onerror: (this: MSBaseReader, ev: ErrorEvent) => any; - onload: (this: MSBaseReader, ev: Event) => any; - onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; - onloadstart: (this: MSBaseReader, ev: Event) => any; - onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: number; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - readonly geolocation: Geolocation; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NavigatorUserMedia { - readonly mediaDevices: MediaDevices; - getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; -} - -interface NodeSelector { - querySelector(selectors: K): ElementTagNameMap[K] | null; - querySelector(selectors: string): Element | null; - querySelectorAll(selectors: K): ElementListTagNameMap[K]; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - readonly pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - readonly animatedPoints: SVGPointList; - readonly points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - readonly externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - readonly height: SVGAnimatedLength; - readonly result: SVGAnimatedString; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - readonly farthestViewportElement: SVGElement; - readonly nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - readonly style: CSSStyleDeclaration; -} - -interface SVGTests { - readonly requiredExtensions: SVGStringList; - readonly requiredFeatures: SVGStringList; - readonly systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - readonly transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - readonly href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface WindowLocalStorage { - readonly localStorage: Storage; -} - -interface WindowSessionStorage { - readonly sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTargetEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; - "timeout": ProgressEvent; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; - onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface Canvas2DContextAttributes { - alpha?: boolean; - willReadFrequently?: boolean; - storage?: boolean; - [attribute: string]: boolean | string | undefined; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface HTMLCollectionOf extends HTMLCollection { - item(index: number): T; - namedItem(name: string): T; - [index: number]: T; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface ScrollOptions { - behavior?: ScrollBehavior; -} - -interface ScrollToOptions extends ScrollOptions { - left?: number; - top?: number; -} - -interface ScrollIntoViewOptions extends ScrollOptions { - block?: ScrollLogicalPosition; - inline?: ScrollLogicalPosition; -} - -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -interface ParentNode { - readonly children: HTMLCollection; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly childElementCount: number; -} - -interface DocumentOrShadowRoot { - readonly activeElement: Element | null; - readonly stylesheets: StyleSheetList; - getSelection(): Selection | null; - elementFromPoint(x: number, y: number): Element | null; - elementsFromPoint(x: number, y: number): Element[]; -} - -interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { - readonly host: Element; - innerHTML: string; -} - -interface ShadowRootInit { - mode: 'open'|'closed'; - delegatesFocus?: boolean; -} - -interface HTMLSlotElement extends HTMLElement { - name: string; - assignedNodes(options?: AssignedNodesOptions): Node[]; -} - -interface AssignedNodesOptions { - flatten?: boolean; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -interface NavigatorUserMediaSuccessCallback { - (stream: MediaStream): void; -} -interface NavigatorUserMediaErrorCallback { - (error: MediaStreamError): void; -} -interface ForEachCallback { - (keyId: any, status: string): void; -} -interface HTMLElementTagNameMap { - "a": HTMLAnchorElement; - "applet": HTMLAppletElement; - "area": HTMLAreaElement; - "audio": HTMLAudioElement; - "base": HTMLBaseElement; - "basefont": HTMLBaseFontElement; - "blockquote": HTMLQuoteElement; - "body": HTMLBodyElement; - "br": HTMLBRElement; - "button": HTMLButtonElement; - "canvas": HTMLCanvasElement; - "caption": HTMLTableCaptionElement; - "col": HTMLTableColElement; - "colgroup": HTMLTableColElement; - "datalist": HTMLDataListElement; - "del": HTMLModElement; - "dir": HTMLDirectoryElement; - "div": HTMLDivElement; - "dl": HTMLDListElement; - "embed": HTMLEmbedElement; - "fieldset": HTMLFieldSetElement; - "font": HTMLFontElement; - "form": HTMLFormElement; - "frame": HTMLFrameElement; - "frameset": HTMLFrameSetElement; - "h1": HTMLHeadingElement; - "h2": HTMLHeadingElement; - "h3": HTMLHeadingElement; - "h4": HTMLHeadingElement; - "h5": HTMLHeadingElement; - "h6": HTMLHeadingElement; - "head": HTMLHeadElement; - "hr": HTMLHRElement; - "html": HTMLHtmlElement; - "iframe": HTMLIFrameElement; - "img": HTMLImageElement; - "input": HTMLInputElement; - "ins": HTMLModElement; - "isindex": HTMLUnknownElement; - "label": HTMLLabelElement; - "legend": HTMLLegendElement; - "li": HTMLLIElement; - "link": HTMLLinkElement; - "listing": HTMLPreElement; - "map": HTMLMapElement; - "marquee": HTMLMarqueeElement; - "menu": HTMLMenuElement; - "meta": HTMLMetaElement; - "meter": HTMLMeterElement; - "nextid": HTMLUnknownElement; - "object": HTMLObjectElement; - "ol": HTMLOListElement; - "optgroup": HTMLOptGroupElement; - "option": HTMLOptionElement; - "p": HTMLParagraphElement; - "param": HTMLParamElement; - "picture": HTMLPictureElement; - "pre": HTMLPreElement; - "progress": HTMLProgressElement; - "q": HTMLQuoteElement; - "script": HTMLScriptElement; - "select": HTMLSelectElement; - "source": HTMLSourceElement; - "span": HTMLSpanElement; - "style": HTMLStyleElement; - "table": HTMLTableElement; - "tbody": HTMLTableSectionElement; - "td": HTMLTableDataCellElement; - "template": HTMLTemplateElement; - "textarea": HTMLTextAreaElement; - "tfoot": HTMLTableSectionElement; - "th": HTMLTableHeaderCellElement; - "thead": HTMLTableSectionElement; - "title": HTMLTitleElement; - "tr": HTMLTableRowElement; - "track": HTMLTrackElement; - "ul": HTMLUListElement; - "video": HTMLVideoElement; - "x-ms-webview": MSHTMLWebViewElement; - "xmp": HTMLPreElement; -} - -interface ElementTagNameMap { - "a": HTMLAnchorElement; - "abbr": HTMLElement; - "acronym": HTMLElement; - "address": HTMLElement; - "applet": HTMLAppletElement; - "area": HTMLAreaElement; - "article": HTMLElement; - "aside": HTMLElement; - "audio": HTMLAudioElement; - "b": HTMLElement; - "base": HTMLBaseElement; - "basefont": HTMLBaseFontElement; - "bdo": HTMLElement; - "big": HTMLElement; - "blockquote": HTMLQuoteElement; - "body": HTMLBodyElement; - "br": HTMLBRElement; - "button": HTMLButtonElement; - "canvas": HTMLCanvasElement; - "caption": HTMLTableCaptionElement; - "center": HTMLElement; - "circle": SVGCircleElement; - "cite": HTMLElement; - "clippath": SVGClipPathElement; - "code": HTMLElement; - "col": HTMLTableColElement; - "colgroup": HTMLTableColElement; - "datalist": HTMLDataListElement; - "dd": HTMLElement; - "defs": SVGDefsElement; - "del": HTMLModElement; - "desc": SVGDescElement; - "dfn": HTMLElement; - "dir": HTMLDirectoryElement; - "div": HTMLDivElement; - "dl": HTMLDListElement; - "dt": HTMLElement; - "ellipse": SVGEllipseElement; - "em": HTMLElement; - "embed": HTMLEmbedElement; - "feblend": SVGFEBlendElement; - "fecolormatrix": SVGFEColorMatrixElement; - "fecomponenttransfer": SVGFEComponentTransferElement; - "fecomposite": SVGFECompositeElement; - "feconvolvematrix": SVGFEConvolveMatrixElement; - "fediffuselighting": SVGFEDiffuseLightingElement; - "fedisplacementmap": SVGFEDisplacementMapElement; - "fedistantlight": SVGFEDistantLightElement; - "feflood": SVGFEFloodElement; - "fefunca": SVGFEFuncAElement; - "fefuncb": SVGFEFuncBElement; - "fefuncg": SVGFEFuncGElement; - "fefuncr": SVGFEFuncRElement; - "fegaussianblur": SVGFEGaussianBlurElement; - "feimage": SVGFEImageElement; - "femerge": SVGFEMergeElement; - "femergenode": SVGFEMergeNodeElement; - "femorphology": SVGFEMorphologyElement; - "feoffset": SVGFEOffsetElement; - "fepointlight": SVGFEPointLightElement; - "fespecularlighting": SVGFESpecularLightingElement; - "fespotlight": SVGFESpotLightElement; - "fetile": SVGFETileElement; - "feturbulence": SVGFETurbulenceElement; - "fieldset": HTMLFieldSetElement; - "figcaption": HTMLElement; - "figure": HTMLElement; - "filter": SVGFilterElement; - "font": HTMLFontElement; - "footer": HTMLElement; - "foreignobject": SVGForeignObjectElement; - "form": HTMLFormElement; - "frame": HTMLFrameElement; - "frameset": HTMLFrameSetElement; - "g": SVGGElement; - "h1": HTMLHeadingElement; - "h2": HTMLHeadingElement; - "h3": HTMLHeadingElement; - "h4": HTMLHeadingElement; - "h5": HTMLHeadingElement; - "h6": HTMLHeadingElement; - "head": HTMLHeadElement; - "header": HTMLElement; - "hgroup": HTMLElement; - "hr": HTMLHRElement; - "html": HTMLHtmlElement; - "i": HTMLElement; - "iframe": HTMLIFrameElement; - "image": SVGImageElement; - "img": HTMLImageElement; - "input": HTMLInputElement; - "ins": HTMLModElement; - "isindex": HTMLUnknownElement; - "kbd": HTMLElement; - "keygen": HTMLElement; - "label": HTMLLabelElement; - "legend": HTMLLegendElement; - "li": HTMLLIElement; - "line": SVGLineElement; - "lineargradient": SVGLinearGradientElement; - "link": HTMLLinkElement; - "listing": HTMLPreElement; - "map": HTMLMapElement; - "mark": HTMLElement; - "marker": SVGMarkerElement; - "marquee": HTMLMarqueeElement; - "mask": SVGMaskElement; - "menu": HTMLMenuElement; - "meta": HTMLMetaElement; - "metadata": SVGMetadataElement; - "meter": HTMLMeterElement; - "nav": HTMLElement; - "nextid": HTMLUnknownElement; - "nobr": HTMLElement; - "noframes": HTMLElement; - "noscript": HTMLElement; - "object": HTMLObjectElement; - "ol": HTMLOListElement; - "optgroup": HTMLOptGroupElement; - "option": HTMLOptionElement; - "p": HTMLParagraphElement; - "param": HTMLParamElement; - "path": SVGPathElement; - "pattern": SVGPatternElement; - "picture": HTMLPictureElement; - "plaintext": HTMLElement; - "polygon": SVGPolygonElement; - "polyline": SVGPolylineElement; - "pre": HTMLPreElement; - "progress": HTMLProgressElement; - "q": HTMLQuoteElement; - "radialgradient": SVGRadialGradientElement; - "rect": SVGRectElement; - "rt": HTMLElement; - "ruby": HTMLElement; - "s": HTMLElement; - "samp": HTMLElement; - "script": HTMLScriptElement; - "section": HTMLElement; - "select": HTMLSelectElement; - "small": HTMLElement; - "source": HTMLSourceElement; - "span": HTMLSpanElement; - "stop": SVGStopElement; - "strike": HTMLElement; - "strong": HTMLElement; - "style": HTMLStyleElement; - "sub": HTMLElement; - "sup": HTMLElement; - "svg": SVGSVGElement; - "switch": SVGSwitchElement; - "symbol": SVGSymbolElement; - "table": HTMLTableElement; - "tbody": HTMLTableSectionElement; - "td": HTMLTableDataCellElement; - "template": HTMLTemplateElement; - "text": SVGTextElement; - "textpath": SVGTextPathElement; - "textarea": HTMLTextAreaElement; - "tfoot": HTMLTableSectionElement; - "th": HTMLTableHeaderCellElement; - "thead": HTMLTableSectionElement; - "title": HTMLTitleElement; - "tr": HTMLTableRowElement; - "track": HTMLTrackElement; - "tspan": SVGTSpanElement; - "tt": HTMLElement; - "u": HTMLElement; - "ul": HTMLUListElement; - "use": SVGUseElement; - "var": HTMLElement; - "video": HTMLVideoElement; - "view": SVGViewElement; - "wbr": HTMLElement; - "x-ms-webview": MSHTMLWebViewElement; - "xmp": HTMLPreElement; -} - -interface ElementListTagNameMap { - "a": NodeListOf; - "abbr": NodeListOf; - "acronym": NodeListOf; - "address": NodeListOf; - "applet": NodeListOf; - "area": NodeListOf; - "article": NodeListOf; - "aside": NodeListOf; - "audio": NodeListOf; - "b": NodeListOf; - "base": NodeListOf; - "basefont": NodeListOf; - "bdo": NodeListOf; - "big": NodeListOf; - "blockquote": NodeListOf; - "body": NodeListOf; - "br": NodeListOf; - "button": NodeListOf; - "canvas": NodeListOf; - "caption": NodeListOf; - "center": NodeListOf; - "circle": NodeListOf; - "cite": NodeListOf; - "clippath": NodeListOf; - "code": NodeListOf; - "col": NodeListOf; - "colgroup": NodeListOf; - "datalist": NodeListOf; - "dd": NodeListOf; - "defs": NodeListOf; - "del": NodeListOf; - "desc": NodeListOf; - "dfn": NodeListOf; - "dir": NodeListOf; - "div": NodeListOf; - "dl": NodeListOf; - "dt": NodeListOf; - "ellipse": NodeListOf; - "em": NodeListOf; - "embed": NodeListOf; - "feblend": NodeListOf; - "fecolormatrix": NodeListOf; - "fecomponenttransfer": NodeListOf; - "fecomposite": NodeListOf; - "feconvolvematrix": NodeListOf; - "fediffuselighting": NodeListOf; - "fedisplacementmap": NodeListOf; - "fedistantlight": NodeListOf; - "feflood": NodeListOf; - "fefunca": NodeListOf; - "fefuncb": NodeListOf; - "fefuncg": NodeListOf; - "fefuncr": NodeListOf; - "fegaussianblur": NodeListOf; - "feimage": NodeListOf; - "femerge": NodeListOf; - "femergenode": NodeListOf; - "femorphology": NodeListOf; - "feoffset": NodeListOf; - "fepointlight": NodeListOf; - "fespecularlighting": NodeListOf; - "fespotlight": NodeListOf; - "fetile": NodeListOf; - "feturbulence": NodeListOf; - "fieldset": NodeListOf; - "figcaption": NodeListOf; - "figure": NodeListOf; - "filter": NodeListOf; - "font": NodeListOf; - "footer": NodeListOf; - "foreignobject": NodeListOf; - "form": NodeListOf; - "frame": NodeListOf; - "frameset": NodeListOf; - "g": NodeListOf; - "h1": NodeListOf; - "h2": NodeListOf; - "h3": NodeListOf; - "h4": NodeListOf; - "h5": NodeListOf; - "h6": NodeListOf; - "head": NodeListOf; - "header": NodeListOf; - "hgroup": NodeListOf; - "hr": NodeListOf; - "html": NodeListOf; - "i": NodeListOf; - "iframe": NodeListOf; - "image": NodeListOf; - "img": NodeListOf; - "input": NodeListOf; - "ins": NodeListOf; - "isindex": NodeListOf; - "kbd": NodeListOf; - "keygen": NodeListOf; - "label": NodeListOf; - "legend": NodeListOf; - "li": NodeListOf; - "line": NodeListOf; - "lineargradient": NodeListOf; - "link": NodeListOf; - "listing": NodeListOf; - "map": NodeListOf; - "mark": NodeListOf; - "marker": NodeListOf; - "marquee": NodeListOf; - "mask": NodeListOf; - "menu": NodeListOf; - "meta": NodeListOf; - "metadata": NodeListOf; - "meter": NodeListOf; - "nav": NodeListOf; - "nextid": NodeListOf; - "nobr": NodeListOf; - "noframes": NodeListOf; - "noscript": NodeListOf; - "object": NodeListOf; - "ol": NodeListOf; - "optgroup": NodeListOf; - "option": NodeListOf; - "p": NodeListOf; - "param": NodeListOf; - "path": NodeListOf; - "pattern": NodeListOf; - "picture": NodeListOf; - "plaintext": NodeListOf; - "polygon": NodeListOf; - "polyline": NodeListOf; - "pre": NodeListOf; - "progress": NodeListOf; - "q": NodeListOf; - "radialgradient": NodeListOf; - "rect": NodeListOf; - "rt": NodeListOf; - "ruby": NodeListOf; - "s": NodeListOf; - "samp": NodeListOf; - "script": NodeListOf; - "section": NodeListOf; - "select": NodeListOf; - "small": NodeListOf; - "source": NodeListOf; - "span": NodeListOf; - "stop": NodeListOf; - "strike": NodeListOf; - "strong": NodeListOf; - "style": NodeListOf; - "sub": NodeListOf; - "sup": NodeListOf; - "svg": NodeListOf; - "switch": NodeListOf; - "symbol": NodeListOf; - "table": NodeListOf; - "tbody": NodeListOf; - "td": NodeListOf; - "template": NodeListOf; - "text": NodeListOf; - "textpath": NodeListOf; - "textarea": NodeListOf; - "tfoot": NodeListOf; - "th": NodeListOf; - "thead": NodeListOf; - "title": NodeListOf; - "tr": NodeListOf; - "track": NodeListOf; - "tspan": NodeListOf; - "tt": NodeListOf; - "u": NodeListOf; - "ul": NodeListOf; - "use": NodeListOf; - "var": NodeListOf; - "video": NodeListOf; - "view": NodeListOf; - "wbr": NodeListOf; - "x-ms-webview": NodeListOf; - "xmp": NodeListOf; -} - -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event | undefined; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msCredentials: MSCredentials; -declare const name: never; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (this: Window, ev: UIEvent) => any; -declare var onafterprint: (this: Window, ev: Event) => any; -declare var onbeforeprint: (this: Window, ev: Event) => any; -declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; -declare var onblur: (this: Window, ev: FocusEvent) => any; -declare var oncanplay: (this: Window, ev: Event) => any; -declare var oncanplaythrough: (this: Window, ev: Event) => any; -declare var onchange: (this: Window, ev: Event) => any; -declare var onclick: (this: Window, ev: MouseEvent) => any; -declare var oncompassneedscalibration: (this: Window, ev: Event) => any; -declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; -declare var ondblclick: (this: Window, ev: MouseEvent) => any; -declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; -declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; -declare var ondrag: (this: Window, ev: DragEvent) => any; -declare var ondragend: (this: Window, ev: DragEvent) => any; -declare var ondragenter: (this: Window, ev: DragEvent) => any; -declare var ondragleave: (this: Window, ev: DragEvent) => any; -declare var ondragover: (this: Window, ev: DragEvent) => any; -declare var ondragstart: (this: Window, ev: DragEvent) => any; -declare var ondrop: (this: Window, ev: DragEvent) => any; -declare var ondurationchange: (this: Window, ev: Event) => any; -declare var onemptied: (this: Window, ev: Event) => any; -declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (this: Window, ev: FocusEvent) => any; -declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; -declare var oninput: (this: Window, ev: Event) => any; -declare var oninvalid: (this: Window, ev: Event) => any; -declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; -declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; -declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; -declare var onload: (this: Window, ev: Event) => any; -declare var onloadeddata: (this: Window, ev: Event) => any; -declare var onloadedmetadata: (this: Window, ev: Event) => any; -declare var onloadstart: (this: Window, ev: Event) => any; -declare var onmessage: (this: Window, ev: MessageEvent) => any; -declare var onmousedown: (this: Window, ev: MouseEvent) => any; -declare var onmouseenter: (this: Window, ev: MouseEvent) => any; -declare var onmouseleave: (this: Window, ev: MouseEvent) => any; -declare var onmousemove: (this: Window, ev: MouseEvent) => any; -declare var onmouseout: (this: Window, ev: MouseEvent) => any; -declare var onmouseover: (this: Window, ev: MouseEvent) => any; -declare var onmouseup: (this: Window, ev: MouseEvent) => any; -declare var onmousewheel: (this: Window, ev: WheelEvent) => any; -declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; -declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; -declare var onoffline: (this: Window, ev: Event) => any; -declare var ononline: (this: Window, ev: Event) => any; -declare var onorientationchange: (this: Window, ev: Event) => any; -declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; -declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; -declare var onpause: (this: Window, ev: Event) => any; -declare var onplay: (this: Window, ev: Event) => any; -declare var onplaying: (this: Window, ev: Event) => any; -declare var onpopstate: (this: Window, ev: PopStateEvent) => any; -declare var onprogress: (this: Window, ev: ProgressEvent) => any; -declare var onratechange: (this: Window, ev: Event) => any; -declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; -declare var onreset: (this: Window, ev: Event) => any; -declare var onresize: (this: Window, ev: UIEvent) => any; -declare var onscroll: (this: Window, ev: UIEvent) => any; -declare var onseeked: (this: Window, ev: Event) => any; -declare var onseeking: (this: Window, ev: Event) => any; -declare var onselect: (this: Window, ev: UIEvent) => any; -declare var onstalled: (this: Window, ev: Event) => any; -declare var onstorage: (this: Window, ev: StorageEvent) => any; -declare var onsubmit: (this: Window, ev: Event) => any; -declare var onsuspend: (this: Window, ev: Event) => any; -declare var ontimeupdate: (this: Window, ev: Event) => any; -declare var ontouchcancel: (ev: TouchEvent) => any; -declare var ontouchend: (ev: TouchEvent) => any; -declare var ontouchmove: (ev: TouchEvent) => any; -declare var ontouchstart: (ev: TouchEvent) => any; -declare var onunload: (this: Window, ev: Event) => any; -declare var onvolumechange: (this: Window, ev: Event) => any; -declare var onwaiting: (this: Window, ev: Event) => any; -declare var opener: any; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string | null; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -declare function webkitCancelAnimationFrame(handle: number): void; -declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; -declare function scroll(options?: ScrollToOptions): void; -declare function scrollTo(options?: ScrollToOptions): void; -declare function scrollBy(options?: ScrollToOptions): void; -declare function toString(): string; -declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (this: Window, ev: PointerEvent) => any; -declare var onpointerdown: (this: Window, ev: PointerEvent) => any; -declare var onpointerenter: (this: Window, ev: PointerEvent) => any; -declare var onpointerleave: (this: Window, ev: PointerEvent) => any; -declare var onpointermove: (this: Window, ev: PointerEvent) => any; -declare var onpointerout: (this: Window, ev: PointerEvent) => any; -declare var onpointerover: (this: Window, ev: PointerEvent) => any; -declare var onpointerup: (this: Window, ev: PointerEvent) => any; -declare var onwheel: (this: Window, ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AAGUID = string; -type AlgorithmIdentifier = string | Algorithm; -type ConstrainBoolean = boolean | ConstrainBooleanParameters; -type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; -type ConstrainDouble = number | ConstrainDoubleRange; -type ConstrainLong = number | ConstrainLongRange; -type CryptoOperationData = ArrayBufferView; -type GLbitfield = number; -type GLboolean = boolean; -type GLbyte = number; -type GLclampf = number; -type GLenum = number; -type GLfloat = number; -type GLint = number; -type GLintptr = number; -type GLshort = number; -type GLsizei = number; -type GLsizeiptr = number; -type GLubyte = number; -type GLuint = number; -type GLushort = number; -type IDBKeyPath = string; -type KeyFormat = string; -type KeyType = string; -type KeyUsage = string; -type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; -type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; -type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; -type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; -type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; -type payloadtype = number; -type ScrollBehavior = "auto" | "instant" | "smooth"; -type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; -type IDBValidKey = number | string | Date | IDBArrayKey; -type BufferSource = ArrayBuffer | ArrayBufferView; -type MouseWheelEvent = WheelEvent; -type ScrollRestoration = "auto" | "manual"; \ No newline at end of file +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + +interface Account { + rpDisplayName?: string; + displayName?: string; + id?: string; + name?: string; + imageURL?: string; +} + +interface Algorithm { + name: string; +} + +interface AnimationEventInit extends EventInit { + animationName?: string; + elapsedTime?: number; +} + +interface AssertionOptions { + timeoutSeconds?: number; + rpId?: USVString; + allowList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; +} + +interface CacheQueryOptions { + ignoreSearch?: boolean; + ignoreMethod?: boolean; + ignoreVary?: boolean; + cacheName?: string; +} + +interface ClientData { + challenge?: string; + origin?: string; + rpId?: string; + hashAlg?: string | Algorithm; + tokenBinding?: string; + extensions?: WebAuthnExtensions; +} + +interface CloseEventInit extends EventInit { + wasClean?: boolean; + code?: number; + reason?: string; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: VideoFacingModeEnum | VideoFacingModeEnum[]; + ideal?: VideoFacingModeEnum | VideoFacingModeEnum[]; +} + +interface CustomEventInit extends EventInit { + detail?: any; +} + +interface DOMRectInit { + x?: any; + y?: any; + width?: any; + height?: any; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface DeviceLightEventInit extends EventInit { + value?: number; +} + +interface DeviceMotionEventInit extends EventInit { + acceleration?: DeviceAccelerationDict; + accelerationIncludingGravity?: DeviceAccelerationDict; + rotationRate?: DeviceRotationRateDict; + interval?: number; +} + +interface DeviceOrientationEventInit extends EventInit { + alpha?: number; + beta?: number; + gamma?: number; + absolute?: boolean; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface ErrorEventInit extends EventInit { + message?: string; + filename?: string; + lineno?: number; + colno?: number; + error?: any; +} + +interface EventInit { + scoped?: boolean; + bubbles?: boolean; + cancelable?: boolean; +} + +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget; +} + +interface FocusNavigationEventInit extends EventInit { + navigationReason?: string; + originLeft?: number; + originTop?: number; + originWidth?: number; + originHeight?: number; +} + +interface FocusNavigationOrigin { + originLeft?: number; + originTop?: number; + originWidth?: number; + originHeight?: number; +} + +interface GamepadEventInit extends EventInit { + gamepad?: Gamepad; +} + +interface GetNotificationOptions { + tag?: string; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface IntersectionObserverEntryInit { + time?: number; + rootBounds?: DOMRectInit; + boundingClientRect?: DOMRectInit; + intersectionRect?: DOMRectInit; + target?: Element; +} + +interface IntersectionObserverInit { + root?: Element; + rootMargin?: string; + threshold?: number | number[]; +} + +interface KeyAlgorithm { + name?: string; +} + +interface KeyboardEventInit extends EventModifierInit { + code?: string; + key?: string; + location?: number; + repeat?: boolean; +} + +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: MSIceType; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: MSCredentialType; +} + +interface MSCredentialSpec { + type?: MSCredentialType; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: RTCIceProtocol; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSPortRange { + min?: number; + max?: number; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: RTCIceProtocol; + localInterface?: MSNetworkInterfaceType; + localAddrType?: MSIceAddrType; + remoteAddrType?: MSIceAddrType; + iceRole?: RTCIceRole; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resolution?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: MediaKeyMessageType; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: MediaKeysRequirement; + persistentState?: MediaKeysRequirement; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamEventInit extends EventInit { + stream?: MediaStream; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MessageEventInit extends EventInit { + lastEventId?: string; + channel?: string; + data?: any; + origin?: string; + source?: Window; + ports?: MessagePort[]; +} + +interface MouseEventInit extends EventModifierInit { + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface NotificationOptions { + dir?: NotificationDirection; + lang?: string; + body?: string; + tag?: string; + icon?: string; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface PaymentCurrencyAmount { + currency?: string; + value?: string; + currencySystem?: string; +} + +interface PaymentDetails { + total?: PaymentItem; + displayItems?: PaymentItem[]; + shippingOptions?: PaymentShippingOption[]; + modifiers?: PaymentDetailsModifier[]; + error?: string; +} + +interface PaymentDetailsModifier { + supportedMethods?: string[]; + total?: PaymentItem; + additionalDisplayItems?: PaymentItem[]; + data?: any; +} + +interface PaymentItem { + label?: string; + amount?: PaymentCurrencyAmount; + pending?: boolean; +} + +interface PaymentMethodData { + supportedMethods?: string[]; + data?: any; +} + +interface PaymentOptions { + requestPayerName?: boolean; + requestPayerEmail?: boolean; + requestPayerPhone?: boolean; + requestShipping?: boolean; + shippingType?: string; +} + +interface PaymentRequestUpdateEventInit extends EventInit { +} + +interface PaymentShippingOption { + id?: string; + label?: string; + amount?: PaymentCurrencyAmount; + selected?: boolean; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface PopStateEventInit extends EventInit { + state?: any; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface PushSubscriptionOptionsInit { + userVisibleOnly?: boolean; + applicationServerKey?: any; +} + +interface RTCConfiguration { + iceServers?: RTCIceServer[]; + iceTransportPolicy?: RTCIceTransportPolicy; + bundlePolicy?: RTCBundlePolicy; + peerIdentity?: string; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: RTCDtlsRole; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: RTCStatsIceCandidateType; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidateDictionary { + foundation?: string; + priority?: number; + ip?: string; + protocol?: RTCIceProtocol; + port?: number; + type?: RTCIceCandidateType; + tcpType?: RTCIceTcpCandidateType; + relatedAddress?: string; + relatedPort?: number; + msMTurnSessionId?: string; +} + +interface RTCIceCandidateInit { + candidate?: string; + sdpMid?: string; + sdpMLineIndex?: number; +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidateDictionary; + remote?: RTCIceCandidateDictionary; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: RTCStatsIceCandidatePairState; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: RTCIceGatherPolicy; + iceservers?: RTCIceServer[]; + portRange?: MSPortRange; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; + iceLite?: boolean; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOfferOptions { + offerToReceiveVideo?: number; + offerToReceiveAudio?: number; + voiceActivityDetection?: boolean; + iceRestart?: boolean; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCPeerConnectionIceEventInit extends EventInit { + candidate?: RTCIceCandidate; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + ptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + ptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + resolutionScale?: number; + framerateScale?: number; + maxFramerate?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; + degradationPreference?: RTCDegradationPreference; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSessionDescriptionInit { + type?: RTCSdpType; + sdp?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: RTCStatsType; + id?: string; + msType?: MSStatsType; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; +} + +interface RegistrationOptions { + scope?: string; +} + +interface RequestInit { + method?: string; + headers?: any; + body?: any; + referrer?: string; + referrerPolicy?: ReferrerPolicy; + mode?: RequestMode; + credentials?: RequestCredentials; + cache?: RequestCache; + redirect?: RequestRedirect; + integrity?: string; + keepalive?: boolean; + window?: any; +} + +interface ResponseInit { + status?: number; + statusText?: string; + headers?: any; +} + +interface ScopedCredentialDescriptor { + type?: ScopedCredentialType; + id?: any; + transports?: Transport[]; +} + +interface ScopedCredentialOptions { + timeoutSeconds?: number; + rpId?: USVString; + excludeList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; +} + +interface ScopedCredentialParameters { + type?: ScopedCredentialType; + algorithm?: string | Algorithm; +} + +interface ServiceWorkerMessageEventInit extends EventInit { + data?: any; + origin?: string; + lastEventId?: string; + source?: ServiceWorker | MessagePort; + ports?: MessagePort[]; +} + +interface SpeechSynthesisEventInit extends EventInit { + utterance?: SpeechSynthesisUtterance; + charIndex?: number; + elapsedTime?: number; + name?: string; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface TrackEventInit extends EventInit { + track?: VideoTrack | AudioTrack | TextTrack; +} + +interface TransitionEventInit extends EventInit { + propertyName?: string; + elapsedTime?: number; +} + +interface UIEventInit extends EventInit { + view?: Window; + detail?: number; +} + +interface WebAuthnExtensions { +} + +interface WebGLContextAttributes { + failIfMajorPerformanceCaveat?: boolean; + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WheelEventInit extends MouseEventInit { + deltaX?: number; + deltaY?: number; + deltaZ?: number; + deltaMode?: number; +} + +interface EventListener { + (evt: Event): void; +} + +interface WebKitEntriesCallback { + (evt: Event): void; +} + +interface WebKitErrorCallback { + (evt: Event): void; +} + +interface WebKitFileCallback { + (evt: Event): void; +} + +interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; + drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; + vertexAttribDivisorANGLE(index: number, divisor: number): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +declare var ANGLE_instanced_arrays: { + prototype: ANGLE_instanced_arrays; + new(): ANGLE_instanced_arrays; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(): AnalyserNode; +} + +interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(typeArg: string, eventInitDict?: AnimationEventInit): AnimationEvent; +} + +interface ApplicationCacheEventMap { + "cached": Event; + "checking": Event; + "downloading": Event; + "error": Event; + "noupdate": Event; + "obsolete": Event; + "progress": ProgressEvent; + "updateready": Event; +} + +interface ApplicationCache extends EventTarget { + oncached: (this: ApplicationCache, ev: Event) => any; + onchecking: (this: ApplicationCache, ev: Event) => any; + ondownloading: (this: ApplicationCache, ev: Event) => any; + onerror: (this: ApplicationCache, ev: Event) => any; + onnoupdate: (this: ApplicationCache, ev: Event) => any; + onobsolete: (this: ApplicationCache, ev: Event) => any; + onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; + onupdateready: (this: ApplicationCache, ev: Event) => any; + readonly status: number; + abort(): void; + swapCache(): void; + update(): void; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; + addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; +} + +interface Attr extends Node { + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface AudioBufferSourceNodeEventMap { + "ended": MediaStreamErrorEvent; +} + +interface AudioBufferSourceNode extends AudioNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(): AudioBufferSourceNode; +} + +interface AudioContextEventMap { + "statechange": Event; +} + +interface AudioContextBase extends EventTarget { + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + onstatechange: (this: AudioContext, ev: Event) => any; + readonly sampleRate: number; + readonly state: AudioContextState; + close(): Promise; + createAnalyser(): AnalyserNode; + createBiquadFilter(): BiquadFilterNode; + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + createBufferSource(): AudioBufferSourceNode; + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + createConvolver(): ConvolverNode; + createDelay(maxDelayTime?: number): DelayNode; + createDynamicsCompressor(): DynamicsCompressorNode; + createGain(): GainNode; + createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + createOscillator(): OscillatorNode; + createPanner(): PannerNode; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createStereoPanner(): StereoPannerNode; + createWaveShaper(): WaveShaperNode; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): Promise; + resume(): Promise; + addEventListener(type: K, listener: (this: AudioContext, ev: AudioContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface AudioContext extends AudioContextBase { + suspend(): Promise; +} + +declare var AudioContext: { + prototype: AudioContext; + new(): AudioContext; +} + +interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +} + +interface AudioListener { + dopplerFactor: number; + speedOfSound: number; + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +} + +interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: ChannelCountMode; + channelInterpretation: ChannelInterpretation; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destination: AudioNode, output?: number, input?: number): AudioNode; + connect(destination: AudioParam, output?: number): void; + disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +} + +interface AudioParam { + readonly defaultValue: number; + value: number; + cancelScheduledValues(startTime: number): AudioParam; + exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; + linearRampToValueAtTime(value: number, endTime: number): AudioParam; + setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; + setValueAtTime(value: number, startTime: number): AudioParam; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): AudioParam; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +} + +interface AudioProcessingEvent extends Event { + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; +} + +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(): AudioProcessingEvent; +} + +interface AudioTrack { + enabled: boolean; + readonly id: string; + kind: string; + readonly label: string; + language: string; + readonly sourceBuffer: SourceBuffer; +} + +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface AudioTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + +interface AudioTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; + onchange: (this: AudioTrackList, ev: Event) => any; + onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; + getTrackById(id: string): AudioTrack | null; + item(index: number): AudioTrack; + addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: AudioTrack; +} + +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface BarProp { + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +} + +interface BeforeUnloadEvent extends Event { + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface BiquadFilterNode extends AudioNode { + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; + type: BiquadFilterType; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(): BiquadFilterNode; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface CSS { + supports(property: string, value?: string): boolean; +} +declare var CSS: CSS; + +interface CSSConditionRule extends CSSGroupingRule { + conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +} + +interface CSSFontFaceRule extends CSSRule { + readonly style: CSSStyleDeclaration; +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface CSSGroupingRule extends CSSRule { + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +} + +interface CSSImportRule extends CSSRule { + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface CSSKeyframesRule extends CSSRule { + readonly cssRules: CSSRuleList; + name: string; + appendRule(rule: string): void; + deleteRule(rule: string): void; + findRule(rule: string): CSSKeyframeRule; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface CSSMediaRule extends CSSConditionRule { + readonly media: MediaList; +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface CSSNamespaceRule extends CSSRule { + readonly namespaceURI: string; + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface CSSPageRule extends CSSRule { + readonly pseudoClass: string; + readonly selector: string; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface CSSRule { + cssText: string; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +interface CSSRuleList { + readonly length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface CSSStyleDeclaration { + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; + columnCount: any; + columnFill: string | null; + columnGap: any; + columnRule: string | null; + columnRuleColor: any; + columnRuleStyle: string | null; + columnRuleWidth: any; + columnSpan: string | null; + columnWidth: any; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; + cssText: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + layoutGrid: string | null; + layoutGridChar: string | null; + layoutGridLine: string | null; + layoutGridMode: string | null; + layoutGridType: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineBreak: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; + msContentZoomLimitMax: any; + msContentZoomLimitMin: any; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; + msGridColumn: any; + msGridColumnAlign: string | null; + msGridColumnSpan: any; + msGridColumns: string | null; + msGridRow: any; + msGridRowAlign: string | null; + msGridRowSpan: any; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; + msHyphenateLimitLines: any; + msHyphenateLimitZone: any; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; + msScrollLimitXMax: any; + msScrollLimitXMin: any; + msScrollLimitYMax: any; + msScrollLimitYMin: any; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; + msTextSizeAdjust: any; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; + msWrapFlow: string; + msWrapMargin: any; + msWrapThrough: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineOffset: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rotate: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + scale: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + translate: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; + webkitColumnCount: any; + webkitColumnGap: any; + webkitColumnRule: string | null; + webkitColumnRuleColor: any; + webkitColumnRuleStyle: string | null; + webkitColumnRuleWidth: any; + webkitColumnSpan: string | null; + webkitColumnWidth: any; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; + webkitTextSizeAdjust: any; + webkitTextStroke: string | null; + webkitTextStrokeColor: string | null; + webkitTextStrokeWidth: string | null; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; + resize: string | null; + userSelect: string | null; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + item(index: number): string; + removeProperty(propertyName: string): string; + setProperty(propertyName: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface CSSStyleRule extends CSSRule { + readonly readOnly: boolean; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface CSSStyleSheet extends StyleSheet { + readonly cssRules: CSSRuleList; + cssText: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + deleteRule(index?: number): void; + insertRule(rule: string, index?: number): number; + removeImport(lIndex: number): void; + removeRule(lIndex: number): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +} + +interface Cache { + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; + keys(request?: RequestInfo, options?: CacheQueryOptions): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; + put(request: RequestInfo, response: Response): Promise; +} + +declare var Cache: { + prototype: Cache; + new(): Cache; +} + +interface CacheStorage { + delete(cacheName: string): Promise; + has(cacheName: string): Promise; + keys(): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; +} + +declare var CacheStorage: { + prototype: CacheStorage; + new(): CacheStorage; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface CanvasPattern { + setTransform(matrix: SVGMatrix): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; + fillStyle: string | CanvasGradient | CanvasPattern; + font: string; + globalAlpha: number; + globalCompositeOperation: string; + imageSmoothingEnabled: boolean; + lineCap: string; + lineDashOffset: number; + lineJoin: string; + lineWidth: number; + miterLimit: number; + msFillRule: CanvasFillRule; + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; + strokeStyle: string | CanvasGradient | CanvasPattern; + textAlign: string; + textBaseline: string; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + beginPath(): void; + clearRect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: CanvasFillRule): void; + createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + drawFocusIfNeeded(element: Element): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number, dstW: number, dstH: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, srcX: number, srcY: number, srcW: number, srcH: number, dstX: number, dstY: number, dstW: number, dstH: number): void; + fill(fillRule?: CanvasFillRule): void; + fillRect(x: number, y: number, w: number, h: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + getLineDash(): number[]; + isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; + measureText(text: string): TextMetrics; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + restore(): void; + rotate(angle: number): void; + save(): void; + scale(x: number, y: number): void; + setLineDash(segments: number[]): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(path?: Path2D): void; + strokeRect(x: number, y: number, w: number, h: number): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + translate(x: number, y: number): void; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(): ChannelMergerNode; +} + +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(): ChannelSplitterNode; +} + +interface CharacterData extends Node, ChildNode { + data: string; + readonly length: number; + appendData(arg: string): void; + deleteData(offset: number, count: number): void; + insertData(offset: number, arg: string): void; + replaceData(offset: number, count: number, arg: string): void; + substringData(offset: number, count: number): string; +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface ClientRect { + bottom: number; + readonly height: number; + left: number; + right: number; + top: number; + readonly width: number; +} + +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface ClientRectList { + readonly length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} + +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface ClipboardEvent extends Event { + readonly clipboardData: DataTransfer; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(typeArg: string, eventInitDict?: CloseEventInit): CloseEvent; +} + +interface Comment extends CharacterData { + text: string; +} + +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface CompositionEvent extends UIEvent { + readonly data: string; + readonly locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: any, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: Element): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface ConvolverNode extends AudioNode { + buffer: AudioBuffer | null; + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(): ConvolverNode; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface Crypto extends Object, RandomSource { + readonly subtle: SubtleCrypto; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface CryptoKeyPair { + privateKey: CryptoKey; + publicKey: CryptoKey; +} + +declare var CryptoKeyPair: { + prototype: CryptoKeyPair; + new(): CryptoKeyPair; +} + +interface CustomEvent extends Event { + readonly detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMImplementation { + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document; + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createHTMLDocument(title: string): Document; + hasFeature(feature: string | null, version: string | null): boolean; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} + +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface DOMStringMap { + [name: string]: string | undefined; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DOMTokenList { + readonly length: number; + add(...token: string[]): void; + contains(token: string): boolean; + item(index: number): string; + remove(...token: string[]): void; + toString(): string; + toggle(token: string, force?: boolean): boolean; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface DataCue extends TextTrackCue { + data: ArrayBuffer; + addEventListener(type: K, listener: (this: DataCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DataCue: { + prototype: DataCue; + new(): DataCue; +} + +interface DataTransfer { + dropEffect: string; + effectAllowed: string; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: string[]; + clearData(format?: string): boolean; + getData(format: string): string; + setData(format: string, data: string): boolean; + setDragImage(image: Element, x: number, y: number): void; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface DataTransferItem { + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; + webkitGetAsEntry(): any; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +} + +interface DataTransferItemList { + readonly length: number; + add(data: File): DataTransferItem | null; + clear(): void; + item(index: number): DataTransferItem; + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +} + +interface DeferredPermissionRequest { + readonly id: number; + readonly type: MSWebViewPermissionType; + readonly uri: string; + allow(): void; + deny(): void; +} + +declare var DeferredPermissionRequest: { + prototype: DeferredPermissionRequest; + new(): DeferredPermissionRequest; +} + +interface DelayNode extends AudioNode { + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(): DelayNode; +} + +interface DeviceAcceleration { + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; +} + +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(typeArg: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + +interface DeviceMotionEvent extends Event { + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(typeArg: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; +} + +interface DeviceOrientationEvent extends Event { + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(typeArg: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent; +} + +interface DeviceRotationRate { + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface DocumentEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforedeactivate": UIEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "fullscreenchange": Event; + "fullscreenerror": Event; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "mssitemodejumplistitemremoved": MSSiteModeEvent; + "msthumbnailclick": MSSiteModeEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectionchange": Event; + "selectstart": Event; + "stalled": Event; + "stop": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "volumechange": Event; + "waiting": Event; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { + /** + * Sets or gets the URL for the current document. + */ + readonly URL: string; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + readonly URLUnencoded: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + readonly activeElement: Element; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Returns a reference to the collection of elements contained by the object. + */ + readonly all: HTMLAllCollection; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollectionOf; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollectionOf; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + readonly characterSet: string; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + readonly compatMode: string; + cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; + readonly defaultView: Window; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + readonly doctype: DocumentType; + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollectionOf; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollectionOf; + /** + * Gets the implementation object of the current document. + */ + readonly implementation: DOMImplementation; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + readonly inputEncoding: string | null; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + readonly lastModified: string; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollectionOf; + /** + * Contains information about the current URL. + */ + readonly location: Location; + msCSSOMElementFloatMetrics: boolean; + msCapsLockWarningOff: boolean; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (this: Document, ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (this: Document, ev: FocusEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (this: Document, ev: Event) => any; + oncanplaythrough: (this: Document, ev: Event) => any; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (this: Document, ev: PointerEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (this: Document, ev: DragEvent) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (this: Document, ev: DragEvent) => any; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (this: Document, ev: DragEvent) => any; + ondrop: (this: Document, ev: DragEvent) => any; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (this: Document, ev: Event) => any; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (this: Document, ev: Event) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (this: Document, ev: MediaStreamErrorEvent) => any; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (this: Document, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (this: Document, ev: FocusEvent) => any; + onfullscreenchange: (this: Document, ev: Event) => any; + onfullscreenerror: (this: Document, ev: Event) => any; + oninput: (this: Document, ev: Event) => any; + oninvalid: (this: Document, ev: Event) => any; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (this: Document, ev: Event) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (this: Document, ev: Event) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (this: Document, ev: Event) => any; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (this: Document, ev: WheelEvent) => any; + onmscontentzoom: (this: Document, ev: UIEvent) => any; + onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; + onmsgestureend: (this: Document, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; + onmspointercancel: (this: Document, ev: MSPointerEvent) => any; + onmspointerdown: (this: Document, ev: MSPointerEvent) => any; + onmspointerenter: (this: Document, ev: MSPointerEvent) => any; + onmspointerleave: (this: Document, ev: MSPointerEvent) => any; + onmspointermove: (this: Document, ev: MSPointerEvent) => any; + onmspointerout: (this: Document, ev: MSPointerEvent) => any; + onmspointerover: (this: Document, ev: MSPointerEvent) => any; + onmspointerup: (this: Document, ev: MSPointerEvent) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (this: Document, ev: Event) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (this: Document, ev: Event) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (this: Document, ev: Event) => any; + onpointerlockchange: (this: Document, ev: Event) => any; + onpointerlockerror: (this: Document, ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (this: Document, ev: ProgressEvent) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (this: Document, ev: Event) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (this: Document, ev: Event) => any; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (this: Document, ev: Event) => any; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (this: Document, ev: UIEvent) => any; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (this: Document, ev: Event) => any; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (this: Document, ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (this: Document, ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (this: Document, ev: Event) => any; + onselectstart: (this: Document, ev: Event) => any; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (this: Document, ev: Event) => any; + onsubmit: (this: Document, ev: Event) => any; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (this: Document, ev: Event) => any; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (this: Document, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (this: Document, ev: Event) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (this: Document, ev: Event) => any; + onwebkitfullscreenchange: (this: Document, ev: Event) => any; + onwebkitfullscreenerror: (this: Document, ev: Event) => any; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; + /** + * Retrieves a value that indicates the current state of the object. + */ + readonly readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + readonly referrer: string; + /** + * Gets the root svg element in the document hierarchy. + */ + readonly rootElement: SVGSVGElement; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + readonly styleSheets: StyleSheetList; + /** + * Contains the title of the document. + */ + title: string; + readonly visibilityState: VisibilityState; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; + xmlStandalone: boolean; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string | null; + adoptNode(source: T): T; + captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; + clear(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; + createCDATASection(data: string): CDATASection; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: K): HTMLElementTagNameMap[K]; + createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver: Node): XPathNSResolver; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouchList(...touches: Touch[]): TouchList; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + exitFullscreen(): void; + exitPointerLock(): void; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement | null; + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeListOf; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(tagname: K): ElementListTagNameMap[K]; + getElementsByTagName(tagname: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + importNode(importedNode: T, deep: boolean): T; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): Document; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + releaseEvents(): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + webkitCancelFullScreen(): void; + webkitExitFullscreen(): void; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Document: { + prototype: Document; + new(): Document; +} + +interface DocumentFragment extends Node, NodeSelector, ParentNode { + getElementById(elementId: string): HTMLElement | null; +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface DocumentType extends Node, ChildNode { + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string; + readonly systemId: string; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface DragEvent extends MouseEvent { + readonly dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} + +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface DynamicsCompressorNode extends AudioNode { + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: number; + readonly release: AudioParam; + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(): DynamicsCompressorNode; +} + +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + +interface EXT_texture_filter_anisotropic { + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +interface ElementEventMap extends GlobalEventHandlersEventMap { + "ariarequest": Event; + "command": Event; + "gotpointercapture": PointerEvent; + "lostpointercapture": PointerEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSGotPointerCapture": MSPointerEvent; + "MSInertiaStart": MSGestureEvent; + "MSLostPointerCapture": MSPointerEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; + innerHTML: string; + msContentZoomFactor: number; + readonly msRegionOverflow: string; + onariarequest: (this: Element, ev: Event) => any; + oncommand: (this: Element, ev: Event) => any; + ongotpointercapture: (this: Element, ev: PointerEvent) => any; + onlostpointercapture: (this: Element, ev: PointerEvent) => any; + onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; + onmsgestureend: (this: Element, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmspointercancel: (this: Element, ev: MSPointerEvent) => any; + onmspointerdown: (this: Element, ev: MSPointerEvent) => any; + onmspointerenter: (this: Element, ev: MSPointerEvent) => any; + onmspointerleave: (this: Element, ev: MSPointerEvent) => any; + onmspointermove: (this: Element, ev: MSPointerEvent) => any; + onmspointerout: (this: Element, ev: MSPointerEvent) => any; + onmspointerover: (this: Element, ev: MSPointerEvent) => any; + onmspointerup: (this: Element, ev: MSPointerEvent) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onwebkitfullscreenchange: (this: Element, ev: Event) => any; + onwebkitfullscreenerror: (this: Element, ev: Event) => any; + outerHTML: string; + readonly prefix: string | null; + readonly scrollHeight: number; + scrollLeft: number; + scrollTop: number; + readonly scrollWidth: number; + readonly tagName: string; + readonly assignedSlot: HTMLSlotElement | null; + slot: string; + readonly shadowRoot: ShadowRoot | null; + getAttribute(name: string): string | null; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNode(name: string): Attr; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + getElementsByTagName(name: K): ElementListTagNameMap[K]; + getElementsByTagName(name: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + hasAttribute(name: string): boolean; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + msGetRegionContent(): MSRangeCollection; + msGetUntransformedBounds(): ClientRect; + msMatchesSelector(selectors: string): boolean; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + releasePointerCapture(pointerId: number): void; + removeAttribute(qualifiedName: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + removeAttributeNode(oldAttr: Attr): Attr; + requestFullscreen(): void; + requestPointerLock(): void; + setAttribute(name: string, value: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + setAttributeNode(newAttr: Attr): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + setPointerCapture(pointerId: number): void; + webkitMatchesSelector(selectors: string): boolean; + webkitRequestFullScreen(): void; + webkitRequestFullscreen(): void; + getElementsByClassName(classNames: string): NodeListOf; + matches(selector: string): boolean; + closest(selector: string): Element | null; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; + insertAdjacentElement(position: string, insertedElement: Element): Element | null; + insertAdjacentHTML(where: string, html: string): void; + insertAdjacentText(where: string, text: string): void; + attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Element: { + prototype: Element; + new(): Element; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(type: string, errorEventInitDict?: ErrorEventInit): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + readonly scoped: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + deepPath(): EventTarget[]; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(typeArg: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface ExtensionScriptApis { + extensionIdToShortId(extensionId: string): number; + fireExtensionApiTelemetry(functionName: string, isSucceeded: boolean, isSupported: boolean): void; + genericFunction(routerAddress: any, parameters?: string, callbackId?: number): void; + genericSynchronousFunction(functionId: number, parameters?: string): string; + getExtensionId(): string; + registerGenericFunctionCallbackHandler(callbackHandler: any): void; + registerGenericPersistentCallbackHandler(callbackHandler: any): void; +} + +declare var ExtensionScriptApis: { + prototype: ExtensionScriptApis; + new(): ExtensionScriptApis; +} + +interface External { +} + +declare var External: { + prototype: External; + new(): External; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: FileReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface FocusEvent extends UIEvent { + readonly relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; +} + +interface FocusNavigationEvent extends Event { + readonly navigationReason: NavigationReason; + readonly originHeight: number; + readonly originLeft: number; + readonly originTop: number; + readonly originWidth: number; + requestFocus(): void; +} + +declare var FocusNavigationEvent: { + prototype: FocusNavigationEvent; + new(type: string, eventInitDict?: FocusNavigationEventInit): FocusNavigationEvent; +} + +interface FormData { + append(name: string, value: string | Blob, fileName?: string): void; + delete(name: string): void; + get(name: string): FormDataEntryValue | null; + getAll(name: string): FormDataEntryValue[]; + has(name: string): boolean; + set(name: string, value: string | Blob, fileName?: string): void; +} + +declare var FormData: { + prototype: FormData; + new (form?: HTMLFormElement): FormData; +} + +interface GainNode extends AudioNode { + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(): GainNode; +} + +interface Gamepad { + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +} + +interface GamepadButton { + readonly pressed: boolean; + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +} + +interface GamepadEvent extends Event { + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(typeArg: string, eventInitDict?: GamepadEventInit): GamepadEvent; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface HTMLAllCollection { + readonly length: number; + item(nameOrIndex?: string): HTMLCollection | Element | null; + namedItem(name: string): HTMLCollection | Element | null; + [index: number]: Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface HTMLAnchorElement extends HTMLElement { + Methods: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + readonly mimeType: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + readonly nameProp: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + readonly protocolLong: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + type: string; + urn: string; + /** + * Returns a string representation of an object. + */ + toString(): string; + addEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLAppletElement extends HTMLElement { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + object: string | null; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + vspace: number; + width: number; + addEventListener(type: K, listener: (this: HTMLAppletElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + rel: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns a string representation of an object. + */ + toString(): string; + addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface HTMLAreasCollection extends HTMLCollectionBase { +} + +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface HTMLAudioElement extends HTMLMediaElement { + addEventListener(type: K, listener: (this: HTMLAudioElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; + addEventListener(type: K, listener: (this: HTMLBRElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + addEventListener(type: K, listener: (this: HTMLBaseElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; + addEventListener(type: K, listener: (this: HTMLBaseFontElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLBodyElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "scroll": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + +interface HTMLBodyElement extends HTMLElement { + aLink: any; + background: string; + bgColor: any; + bgProperties: string; + link: any; + noWrap: boolean; + onafterprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; + onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; + onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; + onload: (this: HTMLBodyElement, ev: Event) => any; + onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; + onoffline: (this: HTMLBodyElement, ev: Event) => any; + ononline: (this: HTMLBodyElement, ev: Event) => any; + onorientationchange: (this: HTMLBodyElement, ev: Event) => any; + onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; + onresize: (this: HTMLBodyElement, ev: UIEvent) => any; + onscroll: (this: HTMLBodyElement, ev: UIEvent) => any; + onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; + onunload: (this: HTMLBodyElement, ev: Event) => any; + text: any; + vLink: any; + addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface HTMLButtonElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + status: any; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLButtonElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; + getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. + */ + toDataURL(type?: string, ...args: any[]): string; + toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; + addEventListener(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface HTMLCollectionBase { + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Retrieves an object from various collections. + */ + item(index: number): Element; + [index: number]: Element; +} + +interface HTMLCollection extends HTMLCollectionBase { + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element | null; +} + +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface HTMLDListElement extends HTMLElement { + compact: boolean; + addEventListener(type: K, listener: (this: HTMLDListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface HTMLDataElement extends HTMLElement { + value: string; + addEventListener(type: K, listener: (this: HTMLDataElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDataElement: { + prototype: HTMLDataElement; + new(): HTMLDataElement; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollectionOf; + addEventListener(type: K, listener: (this: HTMLDataListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface HTMLDirectoryElement extends HTMLElement { + compact: boolean; + addEventListener(type: K, listener: (this: HTMLDirectoryElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface HTMLDivElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + addEventListener(type: K, listener: (this: HTMLDivElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface HTMLDocument extends Document { + addEventListener(type: K, listener: (this: HTMLDocument, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface HTMLElementEventMap extends ElementEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforecopy": ClipboardEvent; + "beforecut": ClipboardEvent; + "beforedeactivate": UIEvent; + "beforepaste": ClipboardEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "copy": ClipboardEvent; + "cuechange": Event; + "cut": ClipboardEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "paste": ClipboardEvent; + "pause": Event; + "play": Event; + "playing": Event; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectstart": Event; + "stalled": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "volumechange": Event; + "waiting": Event; +} + +interface HTMLElement extends Element { + accessKey: string; + readonly children: HTMLCollection; + contentEditable: string; + readonly dataset: DOMStringMap; + dir: string; + draggable: boolean; + hidden: boolean; + hideFocus: boolean; + innerText: string; + readonly isContentEditable: boolean; + lang: string; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; + onabort: (this: HTMLElement, ev: UIEvent) => any; + onactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onblur: (this: HTMLElement, ev: FocusEvent) => any; + oncanplay: (this: HTMLElement, ev: Event) => any; + oncanplaythrough: (this: HTMLElement, ev: Event) => any; + onchange: (this: HTMLElement, ev: Event) => any; + onclick: (this: HTMLElement, ev: MouseEvent) => any; + oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; + oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; + oncuechange: (this: HTMLElement, ev: Event) => any; + oncut: (this: HTMLElement, ev: ClipboardEvent) => any; + ondblclick: (this: HTMLElement, ev: MouseEvent) => any; + ondeactivate: (this: HTMLElement, ev: UIEvent) => any; + ondrag: (this: HTMLElement, ev: DragEvent) => any; + ondragend: (this: HTMLElement, ev: DragEvent) => any; + ondragenter: (this: HTMLElement, ev: DragEvent) => any; + ondragleave: (this: HTMLElement, ev: DragEvent) => any; + ondragover: (this: HTMLElement, ev: DragEvent) => any; + ondragstart: (this: HTMLElement, ev: DragEvent) => any; + ondrop: (this: HTMLElement, ev: DragEvent) => any; + ondurationchange: (this: HTMLElement, ev: Event) => any; + onemptied: (this: HTMLElement, ev: Event) => any; + onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; + onerror: (this: HTMLElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLElement, ev: FocusEvent) => any; + oninput: (this: HTMLElement, ev: Event) => any; + oninvalid: (this: HTMLElement, ev: Event) => any; + onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; + onload: (this: HTMLElement, ev: Event) => any; + onloadeddata: (this: HTMLElement, ev: Event) => any; + onloadedmetadata: (this: HTMLElement, ev: Event) => any; + onloadstart: (this: HTMLElement, ev: Event) => any; + onmousedown: (this: HTMLElement, ev: MouseEvent) => any; + onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; + onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; + onmousemove: (this: HTMLElement, ev: MouseEvent) => any; + onmouseout: (this: HTMLElement, ev: MouseEvent) => any; + onmouseover: (this: HTMLElement, ev: MouseEvent) => any; + onmouseup: (this: HTMLElement, ev: MouseEvent) => any; + onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; + onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; + onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onpause: (this: HTMLElement, ev: Event) => any; + onplay: (this: HTMLElement, ev: Event) => any; + onplaying: (this: HTMLElement, ev: Event) => any; + onprogress: (this: HTMLElement, ev: ProgressEvent) => any; + onratechange: (this: HTMLElement, ev: Event) => any; + onreset: (this: HTMLElement, ev: Event) => any; + onscroll: (this: HTMLElement, ev: UIEvent) => any; + onseeked: (this: HTMLElement, ev: Event) => any; + onseeking: (this: HTMLElement, ev: Event) => any; + onselect: (this: HTMLElement, ev: UIEvent) => any; + onselectstart: (this: HTMLElement, ev: Event) => any; + onstalled: (this: HTMLElement, ev: Event) => any; + onsubmit: (this: HTMLElement, ev: Event) => any; + onsuspend: (this: HTMLElement, ev: Event) => any; + ontimeupdate: (this: HTMLElement, ev: Event) => any; + onvolumechange: (this: HTMLElement, ev: Event) => any; + onwaiting: (this: HTMLElement, ev: Event) => any; + outerText: string; + spellcheck: boolean; + readonly style: CSSStyleDeclaration; + tabIndex: number; + title: string; + blur(): void; + click(): void; + dragDrop(): boolean; + focus(): void; + msGetInputContext(): MSInputMethodContext; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the height of the object. + */ + height: string; + hidden: any; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the palette used for the embedded document. + */ + readonly palette: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + readonly pluginspage: string; + readonly readyState: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLEmbedElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + name: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLFieldSetElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + addEventListener(type: K, listener: (this: HTMLFontElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface HTMLFormControlsCollection extends HTMLCollectionBase { + namedItem(name: string): HTMLCollection | Element | null; +} + +declare var HTMLFormControlsCollection: { + prototype: HTMLFormControlsCollection; + new(): HTMLFormControlsCollection; +} + +interface HTMLFormElement extends HTMLElement { + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + readonly elements: HTMLFormControlsCollection; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [name: string]: any; +} + +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface HTMLFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument { + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string | number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: HTMLFrameElement, ev: Event) => any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the width of the object. + */ + width: string | number; + addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "scroll": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + +interface HTMLFrameSetElement extends HTMLElement { + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + name: string; + onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; + /** + * Fires when the object loses the input focus. + */ + onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + */ + onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; + onload: (this: HTMLFrameSetElement, ev: Event) => any; + onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; + onoffline: (this: HTMLFrameSetElement, ev: Event) => any; + ononline: (this: HTMLFrameSetElement, ev: Event) => any; + onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; + onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLFrameSetElement, ev: PopStateEvent) => any; + onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onscroll: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; + onunload: (this: HTMLFrameSetElement, ev: Event) => any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: number; + addEventListener(type: K, listener: (this: HTMLHRElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; + addEventListener(type: K, listener: (this: HTMLHeadElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + addEventListener(type: K, listener: (this: HTMLHeadingElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; + addEventListener(type: K, listener: (this: HTMLHtmlElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface HTMLIFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + allowFullscreen: boolean; + allowPaymentRequest: boolean; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: HTMLIFrameElement, ev: Event) => any; + readonly sandbox: DOMSettableTokenList; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface HTMLImageElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + crossOrigin: string | null; + readonly currentSrc: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + lowsrc: string; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * The original height of the image resource before sizing. + */ + readonly naturalHeight: number; + /** + * The original width of the image resource before sizing. + */ + readonly naturalWidth: number; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: number; + readonly x: number; + readonly y: number; + msGetAsCastingSource(): any; + addEventListener(type: K, listener: (this: HTMLImageElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; +} + +interface HTMLInputElement extends HTMLElement { + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Returns a FileList object on a file type input object. + */ + readonly files: FileList | null; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + indeterminate: boolean; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + readonly list: HTMLElement; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + selectionDirection: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + size: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + status: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + valueAsDate: Date; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + webkitdirectory: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start?: number, end?: number, direction?: string): void; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; + addEventListener(type: K, listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLLIElement extends HTMLElement { + type: string; + /** + * Sets or retrieves the value of a list item. + */ + value: number; + addEventListener(type: K, listener: (this: HTMLLIElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface HTMLLabelElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; + addEventListener(type: K, listener: (this: HTMLLabelElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface HTMLLegendElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + addEventListener(type: K, listener: (this: HTMLLegendElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + disabled: boolean; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + import?: Document; + integrity: string; + addEventListener(type: K, listener: (this: HTMLLinkElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + readonly areas: HTMLAreasCollection; + /** + * Sets or retrieves the name of the object. + */ + name: string; + addEventListener(type: K, listener: (this: HTMLMapElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { + "bounce": Event; + "finish": Event; + "start": Event; +} + +interface HTMLMarqueeElement extends HTMLElement { + behavior: string; + bgColor: any; + direction: string; + height: string; + hspace: number; + loop: number; + onbounce: (this: HTMLMarqueeElement, ev: Event) => any; + onfinish: (this: HTMLMarqueeElement, ev: Event) => any; + onstart: (this: HTMLMarqueeElement, ev: Event) => any; + scrollAmount: number; + scrollDelay: number; + trueSpeed: boolean; + vspace: number; + width: string; + start(): void; + stop(): void; + addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface HTMLMediaElementEventMap extends HTMLElementEventMap { + "encrypted": MediaEncryptedEvent; + "msneedkey": MSMediaKeyNeededEvent; +} + +interface HTMLMediaElement extends HTMLElement { + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + readonly audioTracks: AudioTrackList; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets a collection of buffered time ranges. + */ + readonly buffered: TimeRanges; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + crossOrigin: string | null; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + readonly currentSrc: string; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + defaultMuted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + readonly duration: number; + /** + * Gets information about whether the playback has ended or not. + */ + readonly ended: boolean; + /** + * Returns an object representing the current error state of the audio or video element. + */ + readonly error: MediaError; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + readonly mediaKeys: MediaKeys | null; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + readonly msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + readonly msKeys: MSMediaKeys; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets the current network activity for the element. + */ + readonly networkState: number; + onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; + /** + * Gets a flag that specifies whether playback is paused. + */ + readonly paused: boolean; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + readonly played: TimeRanges; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + readyState: number; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + readonly seekable: TimeRanges; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + readonly seeking: boolean; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Resets the audio or video object and loads a new media resource. + */ + load(): void; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + msGetAsCastingSource(): any; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + setMediaKeys(mediaKeys: MediaKeys | null): Promise; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; +} + +interface HTMLMenuElement extends HTMLElement { + compact: boolean; + type: string; + addEventListener(type: K, listener: (this: HTMLMenuElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; + addEventListener(type: K, listener: (this: HTMLMetaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; + addEventListener(type: K, listener: (this: HTMLMeterElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + addEventListener(type: K, listener: (this: HTMLModElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface HTMLOListElement extends HTMLElement { + compact: boolean; + /** + * The starting number. + */ + start: number; + type: string; + addEventListener(type: K, listener: (this: HTMLOListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + declare: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly readyState: number; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLObjectElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLOptGroupElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + readonly text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + addEventListener(type: K, listener: (this: HTMLOptGroupElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLOptionElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + addEventListener(type: K, listener: (this: HTMLOptionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; +} + +interface HTMLOptionsCollection extends HTMLCollectionOf { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + +interface HTMLOutputElement extends HTMLElement { + defaultValue: string; + readonly form: HTMLFormElement; + readonly htmlFor: DOMSettableTokenList; + name: string; + readonly type: string; + readonly validationMessage: string; + readonly validity: ValidityState; + value: string; + readonly willValidate: boolean; + checkValidity(): boolean; + reportValidity(): boolean; + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLOutputElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOutputElement: { + prototype: HTMLOutputElement; + new(): HTMLOutputElement; +} + +interface HTMLParagraphElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + clear: string; + addEventListener(type: K, listener: (this: HTMLParagraphElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; + addEventListener(type: K, listener: (this: HTMLParamElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface HTMLPictureElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLPictureElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; +} + +interface HTMLPreElement extends HTMLElement { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; + addEventListener(type: K, listener: (this: HTMLPreElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + readonly position: number; + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; + addEventListener(type: K, listener: (this: HTMLProgressElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + addEventListener(type: K, listener: (this: HTMLQuoteElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface HTMLScriptElement extends HTMLElement { + async: boolean; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + crossOrigin: string | null; + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + integrity: string; + addEventListener(type: K, listener: (this: HTMLScriptElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLSelectElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly options: HTMLOptionsCollection; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + selectedOptions: HTMLCollectionOf; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLSelectElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [name: string]: any; +} + +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + msKeySystem: string; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; + addEventListener(type: K, listener: (this: HTMLSourceElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface HTMLSpanElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLSpanElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; + addEventListener(type: K, listener: (this: HTMLStyleElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; + addEventListener(type: K, listener: (this: HTMLTableCaptionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + bgColor: any; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + readonly cellIndex: number; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLTableCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; + /** + * Sets or retrieves the width of the object. + */ + width: any; + addEventListener(type: K, listener: (this: HTMLTableColElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { + addEventListener(type: K, listener: (this: HTMLTableDataCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLTableElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + bgColor: any; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollectionOf; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLTableCaptionElement; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLTableSectionElement; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLTableSectionElement; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLTableSectionElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLTableElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + addEventListener(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + bgColor: any; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollectionOf; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the position of the object in the rows collection for the table. + */ + readonly rowIndex: number; + /** + * Retrieves the position of the object in the collection. + */ + readonly sectionRowIndex: number; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: K, listener: (this: HTMLTableRowElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLTableSectionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; + addEventListener(type: K, listener: (this: HTMLTemplateElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + +interface HTMLTextAreaElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves the type of control. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + addEventListener(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface HTMLTimeElement extends HTMLElement { + dateTime: string; + addEventListener(type: K, listener: (this: HTMLTimeElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTimeElement: { + prototype: HTMLTimeElement; + new(): HTMLTimeElement; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + addEventListener(type: K, listener: (this: HTMLTitleElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLTrackElement extends HTMLElement { + default: boolean; + kind: string; + label: string; + readonly readyState: number; + src: string; + srclang: string; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + addEventListener(type: K, listener: (this: HTMLTrackElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +interface HTMLUListElement extends HTMLElement { + compact: boolean; + type: string; + addEventListener(type: K, listener: (this: HTMLUListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface HTMLUnknownElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLUnknownElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { + "MSVideoFormatChanged": Event; + "MSVideoFrameStepCompleted": Event; + "MSVideoOptimalLayoutChanged": Event; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the height of the video element. + */ + height: number; + msHorizontalMirror: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; + msStereo3DPackingMode: string; + msStereo3DRenderMode: string; + msZoom: boolean; + onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoHeight: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; + /** + * Gets or sets the width of the video element. + */ + width: number; + getVideoPlaybackQuality(): VideoPlaybackQuality; + msFrameStep(forward: boolean): void; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + webkitEnterFullScreen(): void; + webkitEnterFullscreen(): void; + webkitExitFullScreen(): void; + webkitExitFullscreen(): void; + addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface HashChangeEvent extends Event { + readonly newURL: string | null; + readonly oldURL: string | null; +} + +declare var HashChangeEvent: { + prototype: HashChangeEvent; + new(typeArg: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; +} + +interface Headers { + append(name: string, value: string): void; + delete(name: string): void; + forEach(callback: ForEachCallback): void; + get(name: string): string | null; + has(name: string): boolean; + set(name: string, value: string): void; +} + +declare var Headers: { + prototype: Headers; + new(init?: any): Headers; +} + +interface History { + readonly length: number; + readonly state: any; + scrollRestoration: ScrollRestoration; + back(): void; + forward(): void; + go(delta?: number): void; + pushState(data: any, title: string, url?: string | null): void; + replaceState(data: any, title: string, url?: string | null): void; +} + +declare var History: { + prototype: History; + new(): History; +} + +interface IDBCursor { + readonly direction: IDBCursorDirection; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabaseEventMap { + "abort": Event; + "error": Event; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: Event) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequestEventMap { + "error": Event; + "success": Event; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: IDBRequest, ev: Event) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; + readonly readyState: IDBRequestReadyState; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": Event; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: IDBTransactionMode; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: Event) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface IIRFilterNode extends AudioNode { + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var IIRFilterNode: { + prototype: IIRFilterNode; + new(): IIRFilterNode; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface IntersectionObserver { + readonly root: Element | null; + readonly rootMargin: string; + readonly thresholds: number[]; + disconnect(): void; + observe(target: Element): void; + takeRecords(): IntersectionObserverEntry[]; + unobserve(target: Element): void; +} + +declare var IntersectionObserver: { + prototype: IntersectionObserver; + new(callback: IntersectionObserverCallback, options?: IntersectionObserverInit): IntersectionObserver; +} + +interface IntersectionObserverEntry { + readonly boundingClientRect: ClientRect; + readonly intersectionRatio: number; + readonly intersectionRect: ClientRect; + readonly rootBounds: ClientRect; + readonly target: Element; + readonly time: number; +} + +declare var IntersectionObserverEntry: { + prototype: IntersectionObserverEntry; + new(intersectionObserverEntryInit: IntersectionObserverEntryInit): IntersectionObserverEntry; +} + +interface KeyboardEvent extends UIEvent { + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; + readonly code: string; + getModifierState(keyArg: string): boolean; + initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: ListeningState; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; +} + +interface Location { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + pathname: string; + port: string; + protocol: string; + search: string; + assign(url: string): void; + reload(forcedReload?: boolean): void; + replace(url: string): void; + toString(): string; +} + +declare var Location: { + prototype: Location; + new(): Location; +} + +interface LongRunningScriptDetectedEvent extends Event { + readonly executionTime: number; + stopPageScriptExecution: boolean; +} + +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSApp { + clearTemporaryWebDataAsync(): MSAppAsyncOperation; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createDataPackage(object: any): any; + createDataPackageFromSelection(): any; + createFileFromStorageFile(storageFile: any): File; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + getCurrentPriority(): string; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): Promise; + getViewId(view: any): any; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + pageHandlesAllApplicationActivations(enabled: boolean): void; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + terminateApp(exceptionObject: any): void; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; +} +declare var MSApp: MSApp; + +interface MSAppAsyncOperationEventMap { + "complete": Event; + "error": Event; +} + +interface MSAppAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; + onerror: (this: MSAppAsyncOperation, ev: Event) => any; + readonly readyState: number; + readonly result: any; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: MSCredentialType; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} + +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): Promise; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): Promise; +} + +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: MSTransportType[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} + +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface MSGestureEvent extends UIEvent { + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +interface MSGraphicsTrust { + readonly constrictionActive: boolean; + readonly status: string; +} + +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface MSHTMLWebViewElement extends HTMLElement { + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; + height: number; + readonly settings: MSWebViewSettings; + src: string; + width: number; + addWebAllowedObject(name: string, applicationObject: any): void; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; + getDeferredPermissionRequests(): DeferredPermissionRequest[]; + goBack(): void; + goForward(): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + navigate(uri: string): void; + navigateFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + navigateToString(contents: string): void; + navigateWithHttpRequestMessage(requestMessage: any): void; + refresh(): void; + stop(): void; + addEventListener(type: K, listener: (this: MSHTMLWebViewElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface MSInputMethodContextEventMap { + "MSCandidateWindowHide": Event; + "MSCandidateWindowShow": Event; + "MSCandidateWindowUpdate": Event; +} + +interface MSInputMethodContext extends EventTarget { + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; + oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; + readonly target: HTMLElement; + getCandidateWindowClientRect(): ClientRect; + getCompositionAlternatives(): string[]; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface MSManipulationEvent extends UIEvent { + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +interface MSMediaKeyError { + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +interface MSMediaKeyMessageEvent extends Event { + readonly destinationURL: string | null; + readonly message: Uint8Array; +} + +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSMediaKeyNeededEvent extends Event { + readonly initData: Uint8Array | null; +} + +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface MSMediaKeySession extends EventTarget { + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; + close(): void; + update(key: Uint8Array): void; +} + +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface MSMediaKeys { + readonly keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} + +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; +} + +interface MSPointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; +} + +interface MSRangeCollection { + readonly length: number; + item(index: number): Range; + [index: number]: Range; +} + +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface MSSiteModeEvent extends Event { + readonly actionURL: string; + readonly buttonID: number; +} + +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface MSStream { + readonly type: string; + msClose(): void; + msDetachStream(): any; +} + +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSStreamReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBinaryString(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: K, listener: (this: MSStreamReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MSWebViewAsyncOperationEventMap { + "complete": Event; + "error": Event; +} + +interface MSWebViewAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; + onerror: (this: MSWebViewAsyncOperation, ev: Event) => any; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; + addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; +} + +interface MSWebViewSettings { + isIndexedDBEnabled: boolean; + isJavaScriptEnabled: boolean; +} + +declare var MSWebViewSettings: { + prototype: MSWebViewSettings; + new(): MSWebViewSettings; +} + +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: MediaDeviceKind; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevicesEventMap { + "devicechange": Event; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (this: MediaDevices, ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): Promise; + addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + +interface MediaElementAudioSourceNode extends AudioNode { +} + +declare var MediaElementAudioSourceNode: { + prototype: MediaElementAudioSourceNode; + new(): MediaElementAudioSourceNode; +} + +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + +interface MediaError { + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: MediaKeyMessageType; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: Promise; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): Promise; + generateRequest(initDataType: string, initData: any): Promise; + load(sessionId: string): Promise; + remove(): Promise; + update(response: any): Promise; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): MediaKeyStatus; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): Promise; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: MediaKeySessionType): MediaKeySession; + setServerCertificate(serverCertificate: any): Promise; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; +} + +interface MediaList { + readonly length: number; + mediaText: string; + appendMedium(newMedium: string): void; + deleteMedium(oldMedium: string): void; + item(index: number): string; + toString(): string; + [index: number]: string; +} + +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface MediaQueryList { + readonly matches: boolean; + readonly media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface MediaSource extends EventTarget { + readonly activeSourceBuffers: SourceBufferList; + duration: number; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: number): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} + +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface MediaStreamEventMap { + "active": Event; + "addtrack": MediaStreamTrackEvent; + "inactive": Event; + "removetrack": MediaStreamTrackEvent; +} + +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (this: MediaStream, ev: Event) => any; + onaddtrack: (this: MediaStream, ev: MediaStreamTrackEvent) => any; + oninactive: (this: MediaStream, ev: Event) => any; + onremovetrack: (this: MediaStream, ev: MediaStreamTrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(typeArg: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamEvent extends Event { + readonly stream: MediaStream | null; +} + +declare var MediaStreamEvent: { + prototype: MediaStreamEvent; + new(type: string, eventInitDict: MediaStreamEventInit): MediaStreamEvent; +} + +interface MediaStreamTrackEventMap { + "ended": MediaStreamErrorEvent; + "mute": Event; + "overconstrained": MediaStreamErrorEvent; + "unmute": Event; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onmute: (this: MediaStreamTrack, ev: Event) => any; + onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onunmute: (this: MediaStreamTrack, ev: Event) => any; + readonly readonly: boolean; + readonly readyState: MediaStreamTrackState; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): Promise; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(typeArg: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePortEventMap { + "message": MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: MessagePort, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, transfer?: any[]): void; + start(): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface MimeType { + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; +} + +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface MimeTypeArray { + readonly length: number; + item(index: number): Plugin; + namedItem(type: string): Plugin; + [index: number]: Plugin; +} + +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface MouseEvent extends UIEvent { + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; + getModifierState(keyArg: string): boolean; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; +} + +declare var MouseEvent: { + prototype: MouseEvent; + new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; +} + +interface MutationEvent extends Event { + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +interface MutationObserver { + disconnect(): void; + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; +} + +declare var MutationObserver: { + prototype: MutationObserver; + new(callback: MutationCallback): MutationObserver; +} + +interface MutationRecord { + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; +} + +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface NamedNodeMap { + readonly length: number; + getNamedItem(name: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + item(index: number): Attr; + removeNamedItem(name: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + setNamedItem(arg: Attr): Attr; + setNamedItemNS(arg: Attr): Attr; + [index: number]: Attr; +} + +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface NavigationCompletedEvent extends NavigationEvent { + readonly isSuccess: boolean; + readonly webErrorStatus: number; +} + +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface NavigationEvent extends Event { + readonly uri: string; +} + +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface NavigationEventWithReferrer extends NavigationEvent { + readonly referer: string; +} + +declare var NavigationEventWithReferrer: { + prototype: NavigationEventWithReferrer; + new(): NavigationEventWithReferrer; +} + +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia { + readonly authentication: WebAuthentication; + readonly cookieEnabled: boolean; + gamepadInputEmulation: GamepadInputEmulationType; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly serviceWorker: ServiceWorkerContainer; + readonly webdriver: boolean; + readonly hardwareConcurrency: number; + getGamepads(): Gamepad[]; + javaEnabled(): boolean; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; + vibrate(pattern: number | number[]): boolean; +} + +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface Node extends EventTarget { + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node | null; + readonly lastChild: Node | null; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node | null; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement | null; + readonly parentNode: Node | null; + readonly previousSibling: Node | null; + textContent: string | null; + appendChild(newChild: T): T; + cloneNode(deep?: boolean): Node; + compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; + hasAttributes(): boolean; + hasChildNodes(): boolean; + insertBefore(newChild: T, refChild: Node | null): T; + isDefaultNamespace(namespaceURI: string | null): boolean; + isEqualNode(arg: Node): boolean; + isSameNode(other: Node): boolean; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; + normalize(): void; + removeChild(oldChild: T): T; + replaceChild(newChild: Node, oldChild: T): T; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +declare var Node: { + prototype: Node; + new(): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; +} + +interface NodeIterator { + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + detach(): void; + nextNode(): Node; + previousNode(): Node; +} + +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface NodeList { + readonly length: number; + item(index: number): Node; + [index: number]: Node; +} + +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface NotificationEventMap { + "click": Event; + "close": Event; + "error": Event; + "show": Event; +} + +interface Notification extends EventTarget { + readonly body: string; + readonly dir: NotificationDirection; + readonly icon: string; + readonly lang: string; + onclick: (this: Notification, ev: Event) => any; + onclose: (this: Notification, ev: Event) => any; + onerror: (this: Notification, ev: Event) => any; + onshow: (this: Notification, ev: Event) => any; + readonly permission: NotificationPermission; + readonly tag: string; + readonly title: string; + close(): void; + addEventListener(type: K, listener: (this: Notification, ev: NotificationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Notification: { + prototype: Notification; + new(title: string, options?: NotificationOptions): Notification; + requestPermission(callback?: NotificationPermissionCallback): Promise; +} + +interface OES_element_index_uint { +} + +declare var OES_element_index_uint: { + prototype: OES_element_index_uint; + new(): OES_element_index_uint; +} + +interface OES_standard_derivatives { + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface OES_texture_float { +} + +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface OES_texture_float_linear { +} + +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface OES_texture_half_float { + readonly HALF_FLOAT_OES: number; +} + +declare var OES_texture_half_float: { + prototype: OES_texture_half_float; + new(): OES_texture_half_float; + readonly HALF_FLOAT_OES: number; +} + +interface OES_texture_half_float_linear { +} + +declare var OES_texture_half_float_linear: { + prototype: OES_texture_half_float_linear; + new(): OES_texture_half_float_linear; +} + +interface OfflineAudioCompletionEvent extends Event { + readonly renderedBuffer: AudioBuffer; +} + +declare var OfflineAudioCompletionEvent: { + prototype: OfflineAudioCompletionEvent; + new(): OfflineAudioCompletionEvent; +} + +interface OfflineAudioContextEventMap extends AudioContextEventMap { + "complete": OfflineAudioCompletionEvent; +} + +interface OfflineAudioContext extends AudioContextBase { + readonly length: number; + oncomplete: (this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any; + startRendering(): Promise; + suspend(suspendTime: number): Promise; + addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OfflineAudioContext: { + prototype: OfflineAudioContext; + new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; +} + +interface OscillatorNodeEventMap { + "ended": MediaStreamErrorEvent; +} + +interface OscillatorNode extends AudioNode { + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; + type: OscillatorType; + setPeriodicWave(periodicWave: PeriodicWave): void; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OscillatorNode: { + prototype: OscillatorNode; + new(): OscillatorNode; +} + +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +interface PageTransitionEvent extends Event { + readonly persisted: boolean; +} + +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface PannerNode extends AudioNode { + coneInnerAngle: number; + coneOuterAngle: number; + coneOuterGain: number; + distanceModel: DistanceModelType; + maxDistance: number; + panningModel: PanningModelType; + refDistance: number; + rolloffFactor: number; + setOrientation(x: number, y: number, z: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var PannerNode: { + prototype: PannerNode; + new(): PannerNode; +} + +interface Path2D extends Object, CanvasPathMethods { +} + +declare var Path2D: { + prototype: Path2D; + new(path?: Path2D): Path2D; +} + +interface PaymentAddress { + readonly addressLine: string[]; + readonly city: string; + readonly country: string; + readonly dependentLocality: string; + readonly languageCode: string; + readonly organization: string; + readonly phone: string; + readonly postalCode: string; + readonly recipient: string; + readonly region: string; + readonly sortingCode: string; + toJSON(): any; +} + +declare var PaymentAddress: { + prototype: PaymentAddress; + new(): PaymentAddress; +} + +interface PaymentRequestEventMap { + "shippingaddresschange": Event; + "shippingoptionchange": Event; +} + +interface PaymentRequest extends EventTarget { + onshippingaddresschange: (this: PaymentRequest, ev: Event) => any; + onshippingoptionchange: (this: PaymentRequest, ev: Event) => any; + readonly shippingAddress: PaymentAddress | null; + readonly shippingOption: string | null; + readonly shippingType: PaymentShippingType | null; + abort(): Promise; + show(): Promise; + addEventListener(type: K, listener: (this: PaymentRequest, ev: PaymentRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var PaymentRequest: { + prototype: PaymentRequest; + new(methodData: PaymentMethodData[], details: PaymentDetails, options?: PaymentOptions): PaymentRequest; +} + +interface PaymentRequestUpdateEvent extends Event { + updateWith(d: Promise): void; +} + +declare var PaymentRequestUpdateEvent: { + prototype: PaymentRequestUpdateEvent; + new(type: string, eventInitDict?: PaymentRequestUpdateEventInit): PaymentRequestUpdateEvent; +} + +interface PaymentResponse { + readonly details: any; + readonly methodName: string; + readonly payerEmail: string | null; + readonly payerName: string | null; + readonly payerPhone: string | null; + readonly shippingAddress: PaymentAddress | null; + readonly shippingOption: string | null; + complete(result?: PaymentComplete): Promise; + toJSON(): any; +} + +declare var PaymentResponse: { + prototype: PaymentResponse; + new(): PaymentResponse; +} + +interface PerfWidgetExternal { + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; + addEventListener(eventType: string, callback: Function): void; + getMemoryUsage(): number; + getProcessCpuUsage(): number; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; + removeEventListener(eventType: string, callback: Function): void; + repositionWindow(x: number, y: number): void; + resizeWindow(width: number, height: number): void; +} + +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface Performance { + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; + clearMarks(markName?: string): void; + clearMeasures(measureName?: string): void; + clearResourceTimings(): void; + getEntries(): any; + getEntriesByName(name: string, entryType?: string): any; + getEntriesByType(entryType: string): any; + getMarks(markName?: string): any; + getMeasures(measureName?: string): any; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): any; +} + +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface PerformanceEntry { + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; +} + +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface PerformanceMark extends PerformanceEntry { +} + +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface PerformanceMeasure extends PerformanceEntry { +} + +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface PerformanceNavigation { + readonly redirectCount: number; + readonly type: number; + toJSON(): any; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: NavigationType; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; +} + +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; +} + +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface PerformanceTiming { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; + readonly secureConnectionStart: number; + toJSON(): any; +} + +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface PeriodicWave { +} + +declare var PeriodicWave: { + prototype: PeriodicWave; + new(): PeriodicWave; +} + +interface PermissionRequest extends DeferredPermissionRequest { + readonly state: MSWebViewPermissionState; + defer(): void; +} + +declare var PermissionRequest: { + prototype: PermissionRequest; + new(): PermissionRequest; +} + +interface PermissionRequestedEvent extends Event { + readonly permissionRequest: PermissionRequest; +} + +declare var PermissionRequestedEvent: { + prototype: PermissionRequestedEvent; + new(): PermissionRequestedEvent; +} + +interface Plugin { + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; + item(index: number): MimeType; + namedItem(type: string): MimeType; + [index: number]: MimeType; +} + +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface PluginArray { + readonly length: number; + item(index: number): Plugin; + namedItem(name: string): Plugin; + refresh(reload?: boolean): void; + [index: number]: Plugin; +} + +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface PointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var PointerEvent: { + prototype: PointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; +} + +interface PopStateEvent extends Event { + readonly state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} + +declare var PopStateEvent: { + prototype: PopStateEvent; + new(typeArg: string, eventInitDict?: PopStateEventInit): PopStateEvent; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProcessingInstruction extends CharacterData { + readonly target: string; +} + +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface PushManager { + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; +} + +declare var PushManager: { + prototype: PushManager; + new(): PushManager; +} + +interface PushSubscription { + readonly endpoint: USVString; + readonly options: PushSubscriptionOptions; + getKey(name: PushEncryptionKeyName): ArrayBuffer | null; + toJSON(): any; + unsubscribe(): Promise; +} + +declare var PushSubscription: { + prototype: PushSubscription; + new(): PushSubscription; +} + +interface PushSubscriptionOptions { + readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; +} + +declare var PushSubscriptionOptions: { + prototype: PushSubscriptionOptions; + new(): PushSubscriptionOptions; +} + +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(typeArg: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransportEventMap { + "dtlsstatechange": RTCDtlsTransportStateChangedEvent; + "error": Event; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: RTCDtlsTransport, ev: Event) => any) | null; + readonly state: RTCDtlsTransportState; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: RTCDtlsTransportState; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSenderEventMap { + "tonechange": RTCDTMFToneChangeEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidate { + candidate: string | null; + sdpMLineIndex: number | null; + sdpMid: string | null; + toJSON(): any; +} + +declare var RTCIceCandidate: { + prototype: RTCIceCandidate; + new(candidateInitDict?: RTCIceCandidateInit): RTCIceCandidate; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGathererEventMap { + "error": Event; + "localcandidate": RTCIceGathererEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: RTCIceComponent; + onerror: ((this: RTCIceGatherer, ev: Event) => any) | null; + onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidateDictionary[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidateDictionary | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransportEventMap { + "candidatepairchange": RTCIceCandidatePairChangedEvent; + "icestatechange": RTCIceTransportStateChangedEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: RTCIceComponent; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: RTCIceRole; + readonly state: RTCIceTransportState; + addRemoteCandidate(remoteCandidate: RTCIceCandidateDictionary | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidateDictionary[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidateDictionary[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: RTCIceRole): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: RTCIceTransportState; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCPeerConnectionEventMap { + "addstream": MediaStreamEvent; + "icecandidate": RTCPeerConnectionIceEvent; + "iceconnectionstatechange": Event; + "icegatheringstatechange": Event; + "negotiationneeded": Event; + "removestream": MediaStreamEvent; + "signalingstatechange": Event; +} + +interface RTCPeerConnection extends EventTarget { + readonly canTrickleIceCandidates: boolean | null; + readonly iceConnectionState: RTCIceConnectionState; + readonly iceGatheringState: RTCIceGatheringState; + readonly localDescription: RTCSessionDescription | null; + onaddstream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any; + onicecandidate: (this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any; + oniceconnectionstatechange: (this: RTCPeerConnection, ev: Event) => any; + onicegatheringstatechange: (this: RTCPeerConnection, ev: Event) => any; + onnegotiationneeded: (this: RTCPeerConnection, ev: Event) => any; + onremovestream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any; + onsignalingstatechange: (this: RTCPeerConnection, ev: Event) => any; + readonly remoteDescription: RTCSessionDescription | null; + readonly signalingState: RTCSignalingState; + addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + addStream(stream: MediaStream): void; + close(): void; + createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise; + getConfiguration(): RTCConfiguration; + getLocalStreams(): MediaStream[]; + getRemoteStreams(): MediaStream[]; + getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + getStreamById(streamId: string): MediaStream | null; + removeStream(stream: MediaStream): void; + setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + addEventListener(type: K, listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCPeerConnection: { + prototype: RTCPeerConnection; + new(configuration: RTCConfiguration): RTCPeerConnection; +} + +interface RTCPeerConnectionIceEvent extends Event { + readonly candidate: RTCIceCandidate; +} + +declare var RTCPeerConnectionIceEvent: { + prototype: RTCPeerConnectionIceEvent; + new(type: string, eventInitDict: RTCPeerConnectionIceEventInit): RTCPeerConnectionIceEvent; +} + +interface RTCRtpReceiverEventMap { + "error": Event; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((this: RTCRtpReceiver, ev: Event) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSenderEventMap { + "error": Event; + "ssrcconflict": RTCSsrcConflictEvent; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((this: RTCRtpSender, ev: Event) => any) | null; + onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSessionDescription { + sdp: string | null; + type: RTCSdpType | null; + toJSON(): any; +} + +declare var RTCSessionDescription: { + prototype: RTCSessionDescription; + new(descriptionInitDict?: RTCSessionDescriptionInit): RTCSessionDescription; +} + +interface RTCSrtpSdesTransportEventMap { + "error": Event; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((this: RTCSrtpSdesTransport, ev: Event) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): Promise; + msGetStats(): Promise; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + +interface Range { + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; + cloneContents(): DocumentFragment; + cloneRange(): Range; + collapse(toStart: boolean): void; + compareBoundaryPoints(how: number, sourceRange: Range): number; + createContextualFragment(fragment: string): DocumentFragment; + deleteContents(): void; + detach(): void; + expand(Unit: ExpandGranularity): boolean; + extractContents(): DocumentFragment; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + insertNode(newNode: Node): void; + selectNode(refNode: Node): void; + selectNodeContents(refNode: Node): void; + setEnd(refNode: Node, offset: number): void; + setEndAfter(refNode: Node): void; + setEndBefore(refNode: Node): void; + setStart(refNode: Node, offset: number): void; + setStartAfter(refNode: Node): void; + setStartBefore(refNode: Node): void; + surroundContents(newParent: Node): void; + toString(): string; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +declare var Range: { + prototype: Range; + new(): Range; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +interface ReadableStream { + readonly locked: boolean; + cancel(): Promise; + getReader(): ReadableStreamReader; +} + +declare var ReadableStream: { + prototype: ReadableStream; + new(): ReadableStream; +} + +interface ReadableStreamReader { + cancel(): Promise; + read(): Promise; + releaseLock(): void; +} + +declare var ReadableStreamReader: { + prototype: ReadableStreamReader; + new(): ReadableStreamReader; +} + +interface Request extends Object, Body { + readonly cache: RequestCache; + readonly credentials: RequestCredentials; + readonly destination: RequestDestination; + readonly headers: Headers; + readonly integrity: string; + readonly keepalive: boolean; + readonly method: string; + readonly mode: RequestMode; + readonly redirect: RequestRedirect; + readonly referrer: string; + readonly referrerPolicy: ReferrerPolicy; + readonly type: RequestType; + readonly url: string; + clone(): Request; +} + +declare var Request: { + prototype: Request; + new(input: Request | string, init?: RequestInit): Request; +} + +interface Response extends Object, Body { + readonly body: ReadableStream | null; + readonly headers: Headers; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly type: ResponseType; + readonly url: string; + clone(): Response; +} + +declare var Response: { + prototype: Response; + new(body?: any, init?: ResponseInit): Response; +} + +interface SVGAElement extends SVGGraphicsElement, SVGURIReference { + readonly target: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGAElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGAngle { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +interface SVGAnimatedAngle { + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; +} + +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface SVGAnimatedBoolean { + readonly animVal: boolean; + baseVal: boolean; +} + +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface SVGAnimatedEnumeration { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface SVGAnimatedInteger { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGAnimatedLength { + readonly animVal: SVGLength; + readonly baseVal: SVGLength; +} + +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedLengthList { + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; +} + +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedNumber { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface SVGAnimatedNumberList { + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; +} + +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGAnimatedPreserveAspectRatio { + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; +} + +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface SVGAnimatedRect { + readonly animVal: SVGRect; + readonly baseVal: SVGRect; +} + +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface SVGAnimatedString { + readonly animVal: string; + baseVal: string; +} + +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface SVGAnimatedTransformList { + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; +} + +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface SVGCircleElement extends SVGGraphicsElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGCircleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface SVGClipPathElement extends SVGGraphicsElement, SVGUnitTypes { + readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: K, listener: (this: SVGClipPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGComponentTransferFunctionElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +interface SVGDefsElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGDefsElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface SVGDescElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGDescElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface SVGElementEventMap extends ElementEventMap { + "click": MouseEvent; + "dblclick": MouseEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "load": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; +} + +interface SVGElement extends Element { + className: any; + onclick: (this: SVGElement, ev: MouseEvent) => any; + ondblclick: (this: SVGElement, ev: MouseEvent) => any; + onfocusin: (this: SVGElement, ev: FocusEvent) => any; + onfocusout: (this: SVGElement, ev: FocusEvent) => any; + onload: (this: SVGElement, ev: Event) => any; + onmousedown: (this: SVGElement, ev: MouseEvent) => any; + onmousemove: (this: SVGElement, ev: MouseEvent) => any; + onmouseout: (this: SVGElement, ev: MouseEvent) => any; + onmouseover: (this: SVGElement, ev: MouseEvent) => any; + onmouseup: (this: SVGElement, ev: MouseEvent) => any; + readonly ownerSVGElement: SVGSVGElement; + readonly style: CSSStyleDeclaration; + readonly viewportElement: SVGElement; + xmlbase: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface SVGElementInstance extends EventTarget { + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; +} + +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface SVGElementInstanceList { + readonly length: number; + item(index: number): SVGElementInstance; +} + +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface SVGEllipseElement extends SVGGraphicsElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGEllipseElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEBlendElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEColorMatrixElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; +} + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEComponentTransferElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: K, listener: (this: SVGFECompositeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: K, listener: (this: SVGFEConvolveMatrixElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEDiffuseLightingElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; +} + +interface SVGFEDistantLightElement extends SVGElement { + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEDistantLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGFEFloodElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncAElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncBElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncRElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGFEGaussianBlurElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGURIReference { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: K, listener: (this: SVGFEImageElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGFEMergeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface SVGFEMergeNodeElement extends SVGElement { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEMergeNodeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEMorphologyElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEOffsetElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface SVGFEPointLightElement extends SVGElement { + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEPointLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFESpecularLightingElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface SVGFESpotLightElement extends SVGElement { + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFESpotLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFETileElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFETurbulenceElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGURIReference { + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: K, listener: (this: SVGFilterElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface SVGForeignObjectElement extends SVGGraphicsElement { + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGForeignObjectElement: { + prototype: SVGForeignObjectElement; + new(): SVGForeignObjectElement; +} + +interface SVGGElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGURIReference { + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; +} + +interface SVGGraphicsElement extends SVGElement, SVGTests { + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; + readonly transform: SVGAnimatedTransformList; + getBBox(): SVGRect; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; + getTransformToElement(element: SVGElement): SVGMatrix; + addEventListener(type: K, listener: (this: SVGGraphicsElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGraphicsElement: { + prototype: SVGGraphicsElement; + new(): SVGGraphicsElement; +} + +interface SVGImageElement extends SVGGraphicsElement, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGImageElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGLength { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +interface SVGLengthList { + readonly numberOfItems: number; + appendItem(newItem: SVGLength): SVGLength; + clear(): void; + getItem(index: number): SVGLength; + initialize(newItem: SVGLength): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; + removeItem(index: number): SVGLength; + replaceItem(newItem: SVGLength, index: number): SVGLength; +} + +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface SVGLineElement extends SVGGraphicsElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGLineElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGLinearGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface SVGMarkerElement extends SVGElement, SVGFitToViewBox { + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGMarkerElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; +} + +interface SVGMaskElement extends SVGElement, SVGTests, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGMaskElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface SVGMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + flipX(): SVGMatrix; + flipY(): SVGMatrix; + inverse(): SVGMatrix; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + rotate(angle: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + skewX(angle: number): SVGMatrix; + skewY(angle: number): SVGMatrix; + translate(x: number, y: number): SVGMatrix; +} + +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface SVGMetadataElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGMetadataElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGNumber { + value: number; +} + +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGNumberList { + readonly numberOfItems: number; + appendItem(newItem: SVGNumber): SVGNumber; + clear(): void; + getItem(index: number): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; + removeItem(index: number): SVGNumber; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; +} + +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface SVGPathElement extends SVGGraphicsElement { + readonly pathSegList: SVGPathSegList; + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + getTotalLength(): number; + addEventListener(type: K, listener: (this: SVGPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface SVGPathSeg { + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} + +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGPathSegList { + readonly numberOfItems: number; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + clear(): void; + getItem(index: number): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; +} + +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGPatternElement extends SVGElement, SVGTests, SVGUnitTypes, SVGFitToViewBox, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGPatternElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGPoint { + x: number; + y: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} + +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface SVGPointList { + readonly numberOfItems: number; + appendItem(newItem: SVGPoint): SVGPoint; + clear(): void; + getItem(index: number): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; + removeItem(index: number): SVGPoint; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; +} + +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGPolygonElement extends SVGGraphicsElement, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGPolygonElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface SVGPolylineElement extends SVGGraphicsElement, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGPolylineElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGRadialGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface SVGRect { + height: number; + width: number; + x: number; + y: number; +} + +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface SVGRectElement extends SVGGraphicsElement { + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGRectElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface SVGSVGElementEventMap extends SVGElementEventMap { + "SVGAbort": Event; + "SVGError": Event; + "resize": UIEvent; + "scroll": UIEvent; + "SVGUnload": Event; + "SVGZoom": SVGZoomEvent; +} + +interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewBox, SVGZoomAndPan { + contentScriptType: string; + contentStyleType: string; + currentScale: number; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; + onabort: (this: SVGSVGElement, ev: Event) => any; + onerror: (this: SVGSVGElement, ev: Event) => any; + onresize: (this: SVGSVGElement, ev: UIEvent) => any; + onscroll: (this: SVGSVGElement, ev: UIEvent) => any; + onunload: (this: SVGSVGElement, ev: Event) => any; + onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + createSVGAngle(): SVGAngle; + createSVGLength(): SVGLength; + createSVGMatrix(): SVGMatrix; + createSVGNumber(): SVGNumber; + createSVGPoint(): SVGPoint; + createSVGRect(): SVGRect; + createSVGTransform(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + deselectAll(): void; + forceRedraw(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getCurrentTime(): number; + getElementById(elementId: string): Element; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + pauseAnimations(): void; + setCurrentTime(seconds: number): void; + suspendRedraw(maxWaitMilliseconds: number): number; + unpauseAnimations(): void; + unsuspendRedraw(suspendHandleID: number): void; + unsuspendRedrawAll(): void; + addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface SVGScriptElement extends SVGElement, SVGURIReference { + type: string; + addEventListener(type: K, listener: (this: SVGScriptElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface SVGStopElement extends SVGElement { + readonly offset: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGStopElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface SVGStringList { + readonly numberOfItems: number; + appendItem(newItem: string): string; + clear(): void; + getItem(index: number): string; + initialize(newItem: string): string; + insertItemBefore(newItem: string, index: number): string; + removeItem(index: number): string; + replaceItem(newItem: string, index: number): string; +} + +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface SVGStyleElement extends SVGElement { + disabled: boolean; + media: string; + title: string; + type: string; + addEventListener(type: K, listener: (this: SVGStyleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface SVGSwitchElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGSwitchElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGSymbolElement extends SVGElement, SVGFitToViewBox { + addEventListener(type: K, listener: (this: SVGSymbolElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { + addEventListener(type: K, listener: (this: SVGTSpanElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface SVGTextContentElement extends SVGGraphicsElement { + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; + getCharNumAtPosition(point: SVGPoint): number; + getComputedTextLength(): number; + getEndPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGTextContentElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; +} + +interface SVGTextElement extends SVGTextPositioningElement { + addEventListener(type: K, listener: (this: SVGTextElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGTextPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; + addEventListener(type: K, listener: (this: SVGTextPositioningElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface SVGTitleElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGTitleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface SVGTransform { + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; + setMatrix(matrix: SVGMatrix): void; + setRotate(angle: number, cx: number, cy: number): void; + setScale(sx: number, sy: number): void; + setSkewX(angle: number): void; + setSkewY(angle: number): void; + setTranslate(tx: number, ty: number): void; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +interface SVGTransformList { + readonly numberOfItems: number; + appendItem(newItem: SVGTransform): SVGTransform; + clear(): void; + consolidate(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getItem(index: number): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + removeItem(index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; +} + +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface SVGUnitTypes { + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface SVGUseElement extends SVGGraphicsElement, SVGURIReference { + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGUseElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox { + readonly viewTarget: SVGStringList; + addEventListener(type: K, listener: (this: SVGViewElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface SVGZoomAndPan { + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; +} + +interface SVGZoomEvent extends UIEvent { + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; +} + +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface ScopedCredential { + readonly id: ArrayBuffer; + readonly type: ScopedCredentialType; +} + +declare var ScopedCredential: { + prototype: ScopedCredential; + new(): ScopedCredential; +} + +interface ScopedCredentialInfo { + readonly credential: ScopedCredential; + readonly publicKey: CryptoKey; +} + +declare var ScopedCredentialInfo: { + prototype: ScopedCredentialInfo; + new(): ScopedCredentialInfo; +} + +interface ScreenEventMap { + "MSOrientationChange": Event; +} + +interface Screen extends EventTarget { + readonly availHeight: number; + readonly availWidth: number; + bufferDepth: number; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; + onmsorientationchange: (this: Screen, ev: Event) => any; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; + msLockOrientation(orientations: string | string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface ScriptNotifyEvent extends Event { + readonly callingUri: string; + readonly value: string; +} + +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface ScriptProcessorNodeEventMap { + "audioprocess": AudioProcessingEvent; +} + +interface ScriptProcessorNode extends AudioNode { + readonly bufferSize: number; + onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; + addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ScriptProcessorNode: { + prototype: ScriptProcessorNode; + new(): ScriptProcessorNode; +} + +interface Selection { + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly baseNode: Node; + readonly baseOffset: number; + readonly extentNode: Node; + readonly extentOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; + addRange(range: Range): void; + collapse(parentNode: Node, offset: number): void; + collapseToEnd(): void; + collapseToStart(): void; + containsNode(node: Node, partlyContained: boolean): boolean; + deleteFromDocument(): void; + empty(): void; + extend(newNode: Node, offset: number): void; + getRangeAt(index: number): Range; + removeAllRanges(): void; + removeRange(range: Range): void; + selectAllChildren(parentNode: Node): void; + setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; + setPosition(parentNode: Node, offset: number): void; + toString(): string; +} + +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface ServiceWorkerEventMap extends AbstractWorkerEventMap { + "statechange": Event; +} + +interface ServiceWorker extends EventTarget, AbstractWorker { + onstatechange: (this: ServiceWorker, ev: Event) => any; + readonly scriptURL: USVString; + readonly state: ServiceWorkerState; + postMessage(message: any, transfer?: any[]): void; + addEventListener(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorker: { + prototype: ServiceWorker; + new(): ServiceWorker; +} + +interface ServiceWorkerContainerEventMap { + "controllerchange": Event; + "message": ServiceWorkerMessageEvent; +} + +interface ServiceWorkerContainer extends EventTarget { + readonly controller: ServiceWorker | null; + oncontrollerchange: (this: ServiceWorkerContainer, ev: Event) => any; + onmessage: (this: ServiceWorkerContainer, ev: ServiceWorkerMessageEvent) => any; + readonly ready: Promise; + getRegistration(clientURL?: USVString): Promise; + getRegistrations(): any; + register(scriptURL: USVString, options?: RegistrationOptions): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerContainer: { + prototype: ServiceWorkerContainer; + new(): ServiceWorkerContainer; +} + +interface ServiceWorkerMessageEvent extends Event { + readonly data: any; + readonly lastEventId: string; + readonly origin: string; + readonly ports: MessagePort[] | null; + readonly source: ServiceWorker | MessagePort | null; +} + +declare var ServiceWorkerMessageEvent: { + prototype: ServiceWorkerMessageEvent; + new(type: string, eventInitDict?: ServiceWorkerMessageEventInit): ServiceWorkerMessageEvent; +} + +interface ServiceWorkerRegistrationEventMap { + "updatefound": Event; +} + +interface ServiceWorkerRegistration extends EventTarget { + readonly active: ServiceWorker | null; + readonly installing: ServiceWorker | null; + onupdatefound: (this: ServiceWorkerRegistration, ev: Event) => any; + readonly pushManager: PushManager; + readonly scope: USVString; + readonly sync: SyncManager; + readonly waiting: ServiceWorker | null; + getNotifications(filter?: GetNotificationOptions): any; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerRegistration: { + prototype: ServiceWorkerRegistration; + new(): ServiceWorkerRegistration; +} + +interface SourceBuffer extends EventTarget { + appendWindowEnd: number; + appendWindowStart: number; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; + mode: AppendMode; + timestampOffset: number; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; + abort(): void; + appendBuffer(data: ArrayBuffer | ArrayBufferView): void; + appendStream(stream: MSStream, maxSize?: number): void; + remove(start: number, end: number): void; +} + +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface SourceBufferList extends EventTarget { + readonly length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} + +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface SpeechSynthesisEventMap { + "voiceschanged": Event; +} + +interface SpeechSynthesis extends EventTarget { + onvoiceschanged: (this: SpeechSynthesis, ev: Event) => any; + readonly paused: boolean; + readonly pending: boolean; + readonly speaking: boolean; + cancel(): void; + getVoices(): SpeechSynthesisVoice[]; + pause(): void; + resume(): void; + speak(utterance: SpeechSynthesisUtterance): void; + addEventListener(type: K, listener: (this: SpeechSynthesis, ev: SpeechSynthesisEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SpeechSynthesis: { + prototype: SpeechSynthesis; + new(): SpeechSynthesis; +} + +interface SpeechSynthesisEvent extends Event { + readonly charIndex: number; + readonly elapsedTime: number; + readonly name: string; + readonly utterance: SpeechSynthesisUtterance | null; +} + +declare var SpeechSynthesisEvent: { + prototype: SpeechSynthesisEvent; + new(type: string, eventInitDict?: SpeechSynthesisEventInit): SpeechSynthesisEvent; +} + +interface SpeechSynthesisUtteranceEventMap { + "boundary": Event; + "end": Event; + "error": Event; + "mark": Event; + "pause": Event; + "resume": Event; + "start": Event; +} + +interface SpeechSynthesisUtterance extends EventTarget { + lang: string; + onboundary: (this: SpeechSynthesisUtterance, ev: Event) => any; + onend: (this: SpeechSynthesisUtterance, ev: Event) => any; + onerror: (this: SpeechSynthesisUtterance, ev: Event) => any; + onmark: (this: SpeechSynthesisUtterance, ev: Event) => any; + onpause: (this: SpeechSynthesisUtterance, ev: Event) => any; + onresume: (this: SpeechSynthesisUtterance, ev: Event) => any; + onstart: (this: SpeechSynthesisUtterance, ev: Event) => any; + pitch: number; + rate: number; + text: string; + voice: SpeechSynthesisVoice; + volume: number; + addEventListener(type: K, listener: (this: SpeechSynthesisUtterance, ev: SpeechSynthesisUtteranceEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SpeechSynthesisUtterance: { + prototype: SpeechSynthesisUtterance; + new(text?: string): SpeechSynthesisUtterance; +} + +interface SpeechSynthesisVoice { + readonly default: boolean; + readonly lang: string; + readonly localService: boolean; + readonly name: string; + readonly voiceURI: string; +} + +declare var SpeechSynthesisVoice: { + prototype: SpeechSynthesisVoice; + new(): SpeechSynthesisVoice; +} + +interface StereoPannerNode extends AudioNode { + readonly pan: AudioParam; +} + +declare var StereoPannerNode: { + prototype: StereoPannerNode; + new(): StereoPannerNode; +} + +interface Storage { + readonly length: number; + clear(): void; + getItem(key: string): string | null; + key(index: number): string | null; + removeItem(key: string): void; + setItem(key: string, data: string): void; + [key: string]: any; + [index: number]: string; +} + +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface StorageEvent extends Event { + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; +} + +declare var StorageEvent: { + prototype: StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; +} + +interface StyleMedia { + readonly type: string; + matchMedium(mediaquery: string): boolean; +} + +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface StyleSheet { + disabled: boolean; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; +} + +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface StyleSheetList { + readonly length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} + +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface StyleSheetPageList { + readonly length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} + +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface SubtleCrypto { + decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; + encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + exportKey(format: "jwk", key: CryptoKey): PromiseLike; + exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; + unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; +} + +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface SyncManager { + getTags(): any; + register(tag: string): Promise; +} + +declare var SyncManager: { + prototype: SyncManager; + new(): SyncManager; +} + +interface Text extends CharacterData { + readonly wholeText: string; + readonly assignedSlot: HTMLSlotElement | null; + splitText(offset: number): Text; +} + +declare var Text: { + prototype: Text; + new(data?: string): Text; +} + +interface TextEvent extends UIEvent { + readonly data: string; + readonly inputMethod: number; + readonly locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +interface TextMetrics { + readonly width: number; +} + +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface TextTrackEventMap { + "cuechange": Event; + "error": Event; + "load": Event; +} + +interface TextTrack extends EventTarget { + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; + mode: any; + oncuechange: (this: TextTrack, ev: Event) => any; + onerror: (this: TextTrack, ev: Event) => any; + onload: (this: TextTrack, ev: Event) => any; + readonly readyState: number; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; + addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; +} + +interface TextTrackCueEventMap { + "enter": Event; + "exit": Event; +} + +interface TextTrackCue extends EventTarget { + endTime: number; + id: string; + onenter: (this: TextTrackCue, ev: Event) => any; + onexit: (this: TextTrackCue, ev: Event) => any; + pauseOnExit: boolean; + startTime: number; + text: string; + readonly track: TextTrack; + getCueAsHTML(): DocumentFragment; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface TextTrackCueList { + readonly length: number; + getCueById(id: string): TextTrackCue; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; +} + +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface TextTrackListEventMap { + "addtrack": TrackEvent; +} + +interface TextTrackList extends EventTarget { + readonly length: number; + onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; + item(index: number): TextTrack; + addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: TextTrack; +} + +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface TimeRanges { + readonly length: number; + end(index: number): number; + start(index: number): number; +} + +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface Touch { + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; +} + +declare var Touch: { + prototype: Touch; + new(): Touch; +} + +interface TouchEvent extends UIEvent { + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly keyCode: number; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; + readonly which: number; +} + +declare var TouchEvent: { + prototype: TouchEvent; + new(type: string, touchEventInit?: TouchEventInit): TouchEvent; +} + +interface TouchList { + readonly length: number; + item(index: number): Touch | null; + [index: number]: Touch; +} + +declare var TouchList: { + prototype: TouchList; + new(): TouchList; +} + +interface TrackEvent extends Event { + readonly track: VideoTrack | AudioTrack | TextTrack | null; +} + +declare var TrackEvent: { + prototype: TrackEvent; + new(typeArg: string, eventInitDict?: TrackEventInit): TrackEvent; +} + +interface TransitionEvent extends Event { + readonly elapsedTime: number; + readonly propertyName: string; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} + +declare var TransitionEvent: { + prototype: TransitionEvent; + new(typeArg: string, eventInitDict?: TransitionEventInit): TransitionEvent; +} + +interface TreeWalker { + currentNode: Node; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + firstChild(): Node; + lastChild(): Node; + nextNode(): Node; + nextSibling(): Node; + parentNode(): Node; + previousNode(): Node; + previousSibling(): Node; +} + +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface UIEvent extends Event { + readonly detail: number; + readonly view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} + +declare var UIEvent: { + prototype: UIEvent; + new(typeArg: string, eventInitDict?: UIEventInit): UIEvent; +} + +interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + readonly searchParams: URLSearchParams; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; + createObjectURL(object: any, options?: ObjectURLOptions): string; + revokeObjectURL(url: string): void; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { + readonly mediaType: string; +} + +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface ValidityState { + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; +} + +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface VideoPlaybackQuality { + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; +} + +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface VideoTrack { + readonly id: string; + kind: string; + readonly label: string; + language: string; + selected: boolean; + readonly sourceBuffer: SourceBuffer; +} + +declare var VideoTrack: { + prototype: VideoTrack; + new(): VideoTrack; +} + +interface VideoTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + +interface VideoTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; + onchange: (this: VideoTrackList, ev: Event) => any; + onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; + item(index: number): VideoTrack; + addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: VideoTrack; +} + +declare var VideoTrackList: { + prototype: VideoTrackList; + new(): VideoTrackList; +} + +interface WEBGL_compressed_texture_s3tc { + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WEBGL_debug_renderer_info { + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +declare var WEBGL_debug_renderer_info: { + prototype: WEBGL_debug_renderer_info; + new(): WEBGL_debug_renderer_info; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +interface WEBGL_depth_texture { + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +declare var WEBGL_depth_texture: { + prototype: WEBGL_depth_texture; + new(): WEBGL_depth_texture; + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +interface WaveShaperNode extends AudioNode { + curve: Float32Array | null; + oversample: OverSampleType; +} + +declare var WaveShaperNode: { + prototype: WaveShaperNode; + new(): WaveShaperNode; +} + +interface WebAuthentication { + getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise; + makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise; +} + +declare var WebAuthentication: { + prototype: WebAuthentication; + new(): WebAuthentication; +} + +interface WebAuthnAssertion { + readonly authenticatorData: ArrayBuffer; + readonly clientData: ArrayBuffer; + readonly credential: ScopedCredential; + readonly signature: ArrayBuffer; +} + +declare var WebAuthnAssertion: { + prototype: WebAuthnAssertion; + new(): WebAuthnAssertion; +} + +interface WebGLActiveInfo { + readonly name: string; + readonly size: number; + readonly type: number; +} + +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WebGLBuffer extends WebGLObject { +} + +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLContextEvent extends Event { + readonly statusMessage: string; +} + +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(typeArg: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; +} + +interface WebGLFramebuffer extends WebGLObject { +} + +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLObject { +} + +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLProgram extends WebGLObject { +} + +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface WebGLRenderbuffer extends WebGLObject { +} + +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLRenderingContext { + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; + activeTexture(texture: number): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + blendEquation(mode: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + blendFunc(sfactor: number, dfactor: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; + checkFramebufferStatus(target: number): number; + clear(mask: number): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + clearDepth(depth: number): void; + clearStencil(s: number): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compileShader(shader: WebGLShader | null): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; + cullFace(mode: number): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; + depthFunc(func: number): void; + depthMask(flag: boolean): void; + depthRange(zNear: number, zFar: number): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + disable(cap: number): void; + disableVertexAttribArray(index: number): void; + drawArrays(mode: number, first: number, count: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + enable(cap: number): void; + enableVertexAttribArray(index: number): void; + finish(): void; + flush(): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; + frontFace(mode: number): void; + generateMipmap(target: number): void; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; + getBufferParameter(target: number, pname: number): any; + getContextAttributes(): WebGLContextAttributes; + getError(): number; + getExtension(name: string): any; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + getParameter(pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; + getRenderbufferParameter(target: number, pname: number): any; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; + getTexParameter(target: number, pname: number): any; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; + getVertexAttrib(index: number, pname: number): any; + getVertexAttribOffset(index: number, pname: number): number; + hint(target: number, mode: number): void; + isBuffer(buffer: WebGLBuffer | null): boolean; + isContextLost(): boolean; + isEnabled(cap: number): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; + lineWidth(width: number): void; + linkProgram(program: WebGLProgram | null): void; + pixelStorei(pname: number, param: number | boolean): void; + polygonOffset(factor: number, units: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + sampleCoverage(value: number, invert: boolean): void; + scissor(x: number, y: number, width: number, height: number): void; + shaderSource(shader: WebGLShader | null, source: string): void; + stencilFunc(func: number, ref: number, mask: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + stencilMask(mask: number): void; + stencilMaskSeparate(face: number, mask: number): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texParameterf(target: number, pname: number, param: number): void; + texParameteri(target: number, pname: number, param: number): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; + vertexAttrib1f(indx: number, x: number): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib2f(indx: number, x: number, y: number): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + viewport(x: number, y: number, width: number, height: number): void; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +interface WebGLShader extends WebGLObject { +} + +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface WebGLShaderPrecisionFormat { + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; +} + +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface WebGLTexture extends WebGLObject { +} + +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface WebGLUniformLocation { +} + +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebKitCSSMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m13: number; + m14: number; + m21: number; + m22: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m41: number; + m42: number; + m43: number; + m44: number; + inverse(): WebKitCSSMatrix; + multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; + rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; + setMatrixValue(value: string): void; + skewX(angle: number): WebKitCSSMatrix; + skewY(angle: number): WebKitCSSMatrix; + toString(): string; + translate(x: number, y: number, z?: number): WebKitCSSMatrix; +} + +declare var WebKitCSSMatrix: { + prototype: WebKitCSSMatrix; + new(text?: string): WebKitCSSMatrix; +} + +interface WebKitDirectoryEntry extends WebKitEntry { + createReader(): WebKitDirectoryReader; +} + +declare var WebKitDirectoryEntry: { + prototype: WebKitDirectoryEntry; + new(): WebKitDirectoryEntry; +} + +interface WebKitDirectoryReader { + readEntries(successCallback: WebKitEntriesCallback, errorCallback?: WebKitErrorCallback): void; +} + +declare var WebKitDirectoryReader: { + prototype: WebKitDirectoryReader; + new(): WebKitDirectoryReader; +} + +interface WebKitEntry { + readonly filesystem: WebKitFileSystem; + readonly fullPath: string; + readonly isDirectory: boolean; + readonly isFile: boolean; + readonly name: string; +} + +declare var WebKitEntry: { + prototype: WebKitEntry; + new(): WebKitEntry; +} + +interface WebKitFileEntry extends WebKitEntry { + file(successCallback: WebKitFileCallback, errorCallback?: WebKitErrorCallback): void; +} + +declare var WebKitFileEntry: { + prototype: WebKitFileEntry; + new(): WebKitFileEntry; +} + +interface WebKitFileSystem { + readonly name: string; + readonly root: WebKitDirectoryEntry; +} + +declare var WebKitFileSystem: { + prototype: WebKitFileSystem; + new(): WebKitFileSystem; +} + +interface WebKitPoint { + x: number; + y: number; +} + +declare var WebKitPoint: { + prototype: WebKitPoint; + new(x?: number, y?: number): WebKitPoint; +} + +interface WebSocketEventMap { + "close": CloseEvent; + "error": Event; + "message": MessageEvent; + "open": Event; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: Event) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface WheelEvent extends MouseEvent { + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; + getCurrentPoint(element: Element): void; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +declare var WheelEvent: { + prototype: WheelEvent; + new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +interface WindowEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "compassneedscalibration": Event; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "devicelight": DeviceLightEvent; + "devicemotion": DeviceMotionEvent; + "deviceorientation": DeviceOrientationEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "message": MessageEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "pause": Event; + "play": Event; + "playing": Event; + "popstate": PopStateEvent; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "resize": UIEvent; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "stalled": Event; + "storage": StorageEvent; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "unload": Event; + "volumechange": Event; + "waiting": Event; +} + +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch { + readonly applicationCache: ApplicationCache; + readonly caches: CacheStorage; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; + defaultStatus: string; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; + event: Event | undefined; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly isSecureContext: boolean; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msContentScript: ExtensionScriptApis; + readonly msCredentials: MSCredentials; + name: string; + readonly navigator: Navigator; + offscreenBuffering: string | boolean; + onabort: (this: Window, ev: UIEvent) => any; + onafterprint: (this: Window, ev: Event) => any; + onbeforeprint: (this: Window, ev: Event) => any; + onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; + onblur: (this: Window, ev: FocusEvent) => any; + oncanplay: (this: Window, ev: Event) => any; + oncanplaythrough: (this: Window, ev: Event) => any; + onchange: (this: Window, ev: Event) => any; + onclick: (this: Window, ev: MouseEvent) => any; + oncompassneedscalibration: (this: Window, ev: Event) => any; + oncontextmenu: (this: Window, ev: PointerEvent) => any; + ondblclick: (this: Window, ev: MouseEvent) => any; + ondevicelight: (this: Window, ev: DeviceLightEvent) => any; + ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; + ondrag: (this: Window, ev: DragEvent) => any; + ondragend: (this: Window, ev: DragEvent) => any; + ondragenter: (this: Window, ev: DragEvent) => any; + ondragleave: (this: Window, ev: DragEvent) => any; + ondragover: (this: Window, ev: DragEvent) => any; + ondragstart: (this: Window, ev: DragEvent) => any; + ondrop: (this: Window, ev: DragEvent) => any; + ondurationchange: (this: Window, ev: Event) => any; + onemptied: (this: Window, ev: Event) => any; + onended: (this: Window, ev: MediaStreamErrorEvent) => any; + onerror: ErrorEventHandler; + onfocus: (this: Window, ev: FocusEvent) => any; + onhashchange: (this: Window, ev: HashChangeEvent) => any; + oninput: (this: Window, ev: Event) => any; + oninvalid: (this: Window, ev: Event) => any; + onkeydown: (this: Window, ev: KeyboardEvent) => any; + onkeypress: (this: Window, ev: KeyboardEvent) => any; + onkeyup: (this: Window, ev: KeyboardEvent) => any; + onload: (this: Window, ev: Event) => any; + onloadeddata: (this: Window, ev: Event) => any; + onloadedmetadata: (this: Window, ev: Event) => any; + onloadstart: (this: Window, ev: Event) => any; + onmessage: (this: Window, ev: MessageEvent) => any; + onmousedown: (this: Window, ev: MouseEvent) => any; + onmouseenter: (this: Window, ev: MouseEvent) => any; + onmouseleave: (this: Window, ev: MouseEvent) => any; + onmousemove: (this: Window, ev: MouseEvent) => any; + onmouseout: (this: Window, ev: MouseEvent) => any; + onmouseover: (this: Window, ev: MouseEvent) => any; + onmouseup: (this: Window, ev: MouseEvent) => any; + onmousewheel: (this: Window, ev: WheelEvent) => any; + onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; + onmsgestureend: (this: Window, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; + onmspointercancel: (this: Window, ev: MSPointerEvent) => any; + onmspointerdown: (this: Window, ev: MSPointerEvent) => any; + onmspointerenter: (this: Window, ev: MSPointerEvent) => any; + onmspointerleave: (this: Window, ev: MSPointerEvent) => any; + onmspointermove: (this: Window, ev: MSPointerEvent) => any; + onmspointerout: (this: Window, ev: MSPointerEvent) => any; + onmspointerover: (this: Window, ev: MSPointerEvent) => any; + onmspointerup: (this: Window, ev: MSPointerEvent) => any; + onoffline: (this: Window, ev: Event) => any; + ononline: (this: Window, ev: Event) => any; + onorientationchange: (this: Window, ev: Event) => any; + onpagehide: (this: Window, ev: PageTransitionEvent) => any; + onpageshow: (this: Window, ev: PageTransitionEvent) => any; + onpause: (this: Window, ev: Event) => any; + onplay: (this: Window, ev: Event) => any; + onplaying: (this: Window, ev: Event) => any; + onpopstate: (this: Window, ev: PopStateEvent) => any; + onprogress: (this: Window, ev: ProgressEvent) => any; + onratechange: (this: Window, ev: Event) => any; + onreadystatechange: (this: Window, ev: ProgressEvent) => any; + onreset: (this: Window, ev: Event) => any; + onresize: (this: Window, ev: UIEvent) => any; + onscroll: (this: Window, ev: UIEvent) => any; + onseeked: (this: Window, ev: Event) => any; + onseeking: (this: Window, ev: Event) => any; + onselect: (this: Window, ev: UIEvent) => any; + onstalled: (this: Window, ev: Event) => any; + onstorage: (this: Window, ev: StorageEvent) => any; + onsubmit: (this: Window, ev: Event) => any; + onsuspend: (this: Window, ev: Event) => any; + ontimeupdate: (this: Window, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onunload: (this: Window, ev: Event) => any; + onvolumechange: (this: Window, ev: Event) => any; + onwaiting: (this: Window, ev: Event) => any; + opener: any; + orientation: string | number; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; + readonly speechSynthesis: SpeechSynthesis; + status: string; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; + URLSearchParams: typeof URLSearchParams; + Blob: typeof Blob; + customElements: CustomElementRegistry; + alert(message?: any): void; + blur(): void; + cancelAnimationFrame(handle: number): void; + captureEvents(): void; + close(): void; + confirm(message?: string): boolean; + departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; + focus(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; + getSelection(): Selection; + matchMedia(mediaQuery: string): MediaQueryList; + moveBy(x?: number, y?: number): void; + moveTo(x?: number, y?: number): void; + msWriteProfilerMark(profilerMarkName: string): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; + print(): void; + prompt(message?: string, _default?: string): string | null; + releaseEvents(): void; + requestAnimationFrame(callback: FrameRequestCallback): number; + resizeBy(x?: number, y?: number): void; + resizeTo(x?: number, y?: number): void; + scroll(x?: number, y?: number): void; + scrollBy(x?: number, y?: number): void; + scrollTo(x?: number, y?: number): void; + stop(): void; + webkitCancelAnimationFrame(handle: number): void; + webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; + webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; + scroll(options?: ScrollToOptions): void; + scrollTo(options?: ScrollToOptions): void; + scrollBy(options?: ScrollToOptions): void; + addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Window: { + prototype: Window; + new(): Window; +} + +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: Worker, ev: MessageEvent) => any; + postMessage(message: any, transfer?: any[]): void; + terminate(): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLDocument extends Document { + addEventListener(type: K, listener: (this: XMLDocument, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: XMLHttpRequestResponseType; + readonly responseURL: string; + readonly responseXML: Document | null; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: Document): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} + +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface XPathEvaluator { + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver?: Node): XPathNSResolver; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; +} + +declare var XPathEvaluator: { + prototype: XPathEvaluator; + new(): XPathEvaluator; +} + +interface XPathExpression { + evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; +} + +declare var XPathExpression: { + prototype: XPathExpression; + new(): XPathExpression; +} + +interface XPathNSResolver { + lookupNamespaceURI(prefix: string): string; +} + +declare var XPathNSResolver: { + prototype: XPathNSResolver; + new(): XPathNSResolver; +} + +interface XPathResult { + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; + iterateNext(): Node; + snapshotItem(index: number): Node; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +declare var XPathResult: { + prototype: XPathResult; + new(): XPathResult; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +interface XSLTProcessor { + clearParameters(): void; + getParameter(namespaceURI: string, localName: string): any; + importStylesheet(style: Node): void; + removeParameter(namespaceURI: string, localName: string): void; + reset(): void; + setParameter(namespaceURI: string, localName: string, value: any): void; + transformToDocument(source: Node): Document; + transformToFragment(source: Node, document: Document): DocumentFragment; +} + +declare var XSLTProcessor: { + prototype: XSLTProcessor; + new(): XSLTProcessor; +} + +interface webkitRTCPeerConnection extends RTCPeerConnection { + addEventListener(type: K, listener: (this: webkitRTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var webkitRTCPeerConnection: { + prototype: webkitRTCPeerConnection; + new(configuration: RTCConfiguration): webkitRTCPeerConnection; +} + +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + +interface AbstractWorker { + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface Body { + readonly bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; + formData(): Promise; +} + +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + +interface ChildNode { + remove(): void; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface DocumentEvent { + createEvent(eventInterface:"AnimationEvent"): AnimationEvent; + createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface:"CloseEvent"): CloseEvent; + createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; + createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface:"DragEvent"): DragEvent; + createEvent(eventInterface:"ErrorEvent"): ErrorEvent; + createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; + createEvent(eventInterface:"FocusEvent"): FocusEvent; + createEvent(eventInterface:"FocusNavigationEvent"): FocusNavigationEvent; + createEvent(eventInterface:"GamepadEvent"): GamepadEvent; + createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; + createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; + createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; + createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamEvent"): MediaStreamEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface:"MessageEvent"): MessageEvent; + createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; + createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; + createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface:"NavigationEvent"): NavigationEvent; + createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; + createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; + createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface:"PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; + createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; + createEvent(eventInterface:"PointerEvent"): PointerEvent; + createEvent(eventInterface:"PopStateEvent"): PopStateEvent; + createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; + createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; + createEvent(eventInterface:"ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent; + createEvent(eventInterface:"SpeechSynthesisEvent"): SpeechSynthesisEvent; + createEvent(eventInterface:"StorageEvent"): StorageEvent; + createEvent(eventInterface:"TextEvent"): TextEvent; + createEvent(eventInterface:"TouchEvent"): TouchEvent; + createEvent(eventInterface:"TrackEvent"): TrackEvent; + createEvent(eventInterface:"TransitionEvent"): TransitionEvent; + createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; + createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface:"WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface ElementTraversal { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; + readonly nextElementSibling: Element | null; + readonly previousElementSibling: Element | null; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface GlobalEventHandlersEventMap { + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerup": PointerEvent; + "wheel": WheelEvent; +} + +interface GlobalEventHandlers { + onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface GlobalFetch { + fetch(input: RequestInfo, init?: RequestInit): Promise; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; +} + +interface IDBEnvironment { + readonly indexedDB: IDBFactory; +} + +interface LinkStyle { + readonly sheet: StyleSheet; +} + +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + +interface MSBaseReader { + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSNavigatorDoNotTrack { + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; +} + +interface NavigatorBeacon { + sendBeacon(url: USVString, data?: BodyInit): boolean; +} + +interface NavigatorConcurrentHardware { + readonly hardwareConcurrency: number; +} + +interface NavigatorContentUtils { +} + +interface NavigatorGeolocation { + readonly geolocation: Geolocation; +} + +interface NavigatorID { + readonly appCodeName: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface NavigatorStorageUtils { +} + +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + +interface NodeSelector { + querySelector(selectors: K): ElementTagNameMap[K] | null; + querySelector(selectors: string): Element | null; + querySelectorAll(selectors: K): ElementListTagNameMap[K]; + querySelectorAll(selectors: string): NodeListOf; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SVGAnimatedPoints { + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; +} + +interface SVGFilterPrimitiveStandardAttributes { + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; +} + +interface SVGFitToViewBox { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; +} + +interface SVGTests { + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface SVGURIReference { + readonly href: SVGAnimatedString; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface WindowLocalStorage { + readonly localStorage: Storage; +} + +interface WindowSessionStorage { + readonly sessionStorage: Storage; +} + +interface WindowTimers extends Object, WindowTimersExtension { + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface WindowTimersExtension { + clearImmediate(handle: number): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; +} + +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface ErrorEventInit { + message?: string; + filename?: string; + lineno?: number; + conlno?: number; + error?: any; +} + +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + +interface Canvas2DContextAttributes { + alpha?: boolean; + willReadFrequently?: boolean; + storage?: boolean; + [attribute: string]: boolean | string | undefined; +} + +interface ImageBitmapOptions { + imageOrientation?: "none" | "flipY"; + premultiplyAlpha?: "none" | "premultiply" | "default"; + colorSpaceConversion?: "none" | "default"; + resizeWidth?: number; + resizeHeight?: number; + resizeQuality?: "pixelated" | "low" | "medium" | "high"; +} + +interface ImageBitmap { + readonly width: number; + readonly height: number; + close(): void; +} + +interface URLSearchParams { + /** + * Appends a specified key/value pair as a new search parameter. + */ + append(name: string, value: string): void; + /** + * Deletes the given search parameter, and its associated value, from the list of all search parameters. + */ + delete(name: string): void; + /** + * Returns the first value associated to the given search parameter. + */ + get(name: string): string | null; + /** + * Returns all the values association with a given search parameter. + */ + getAll(name: string): string[]; + /** + * Returns a Boolean indicating if such a search parameter exists. + */ + has(name: string): boolean; + /** + * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. + */ + set(name: string, value: string): void; +} + +declare var URLSearchParams: { + prototype: URLSearchParams; + /** + * Constructor returning a URLSearchParams object. + */ + new (init?: string | URLSearchParams): URLSearchParams; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface ScrollOptions { + behavior?: ScrollBehavior; +} + +interface ScrollToOptions extends ScrollOptions { + left?: number; + top?: number; +} + +interface ScrollIntoViewOptions extends ScrollOptions { + block?: ScrollLogicalPosition; + inline?: ScrollLogicalPosition; +} + +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +interface ParentNode { + readonly children: HTMLCollection; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; + readonly childElementCount: number; +} + +interface DocumentOrShadowRoot { + readonly activeElement: Element | null; + readonly stylesheets: StyleSheetList; + getSelection(): Selection | null; + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; +} + +interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { + readonly host: Element; + innerHTML: string; +} + +interface ShadowRootInit { + mode: 'open'|'closed'; + delegatesFocus?: boolean; +} + +interface HTMLSlotElement extends HTMLElement { + name: string; + assignedNodes(options?: AssignedNodesOptions): Node[]; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + +interface ElementDefinitionOptions { + extends: string; +} + +interface CustomElementRegistry { + define(name: string, constructor: Function, options?: ElementDefinitionOptions): void; + get(name: string): any; + whenDefined(name: string): PromiseLike; +} + +interface PromiseRejectionEvent extends Event { + readonly promise: PromiseLike; + readonly reason: any; +} + +interface PromiseRejectionEventInit extends EventInit { + promise: PromiseLike; + reason?: any; +} + +interface EventListenerOptions { + capture?: boolean; +} + +interface AddEventListenerOptions extends EventListenerOptions { + passive?: boolean; + once?: boolean; +} + +interface TouchEventInit extends EventModifierInit { + touches?: Touch[]; + targetTouches?: Touch[]; + changedTouches?: Touch[]; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} +interface MSLaunchUriCallback { + (): void; +} +interface FrameRequestCallback { + (time: number): void; +} +interface MSUnsafeFunctionCallback { + (): any; +} +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface VoidFunction { + (): void; +} +interface RTCSessionDescriptionCallback { + (sdp: RTCSessionDescription): void; +} +interface RTCPeerConnectionErrorCallback { + (error: DOMError): void; +} +interface RTCStatsCallback { + (report: RTCStatsReport): void; +} +interface FunctionStringCallback { + (data: string): void; +} +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: MediaKeyStatus): void; +} +interface NotificationPermissionCallback { + (permission: NotificationPermission): void; +} +interface IntersectionObserverCallback { + (entries: IntersectionObserverEntry[], observer: IntersectionObserver): void; +} +interface HTMLElementTagNameMap { + "a": HTMLAnchorElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "audio": HTMLAudioElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "data": HTMLDataElement; + "datalist": HTMLDataListElement; + "del": HTMLModElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "embed": HTMLEmbedElement; + "fieldset": HTMLFieldSetElement; + "font": HTMLFontElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "iframe": HTMLIFrameElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "marquee": HTMLMarqueeElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "meter": HTMLMeterElement; + "nextid": HTMLUnknownElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "output": HTMLOutputElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "picture": HTMLPictureElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "script": HTMLScriptElement; + "select": HTMLSelectElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "style": HTMLStyleElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "time": HTMLTimeElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "ul": HTMLUListElement; + "video": HTMLVideoElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementTagNameMap { + "a": HTMLAnchorElement; + "abbr": HTMLElement; + "acronym": HTMLElement; + "address": HTMLElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "article": HTMLElement; + "aside": HTMLElement; + "audio": HTMLAudioElement; + "b": HTMLElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "bdo": HTMLElement; + "big": HTMLElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "center": HTMLElement; + "circle": SVGCircleElement; + "cite": HTMLElement; + "clippath": SVGClipPathElement; + "code": HTMLElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "data": HTMLDataElement; + "datalist": HTMLDataListElement; + "dd": HTMLElement; + "defs": SVGDefsElement; + "del": HTMLModElement; + "desc": SVGDescElement; + "dfn": HTMLElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "dt": HTMLElement; + "ellipse": SVGEllipseElement; + "em": HTMLElement; + "embed": HTMLEmbedElement; + "feblend": SVGFEBlendElement; + "fecolormatrix": SVGFEColorMatrixElement; + "fecomponenttransfer": SVGFEComponentTransferElement; + "fecomposite": SVGFECompositeElement; + "feconvolvematrix": SVGFEConvolveMatrixElement; + "fediffuselighting": SVGFEDiffuseLightingElement; + "fedisplacementmap": SVGFEDisplacementMapElement; + "fedistantlight": SVGFEDistantLightElement; + "feflood": SVGFEFloodElement; + "fefunca": SVGFEFuncAElement; + "fefuncb": SVGFEFuncBElement; + "fefuncg": SVGFEFuncGElement; + "fefuncr": SVGFEFuncRElement; + "fegaussianblur": SVGFEGaussianBlurElement; + "feimage": SVGFEImageElement; + "femerge": SVGFEMergeElement; + "femergenode": SVGFEMergeNodeElement; + "femorphology": SVGFEMorphologyElement; + "feoffset": SVGFEOffsetElement; + "fepointlight": SVGFEPointLightElement; + "fespecularlighting": SVGFESpecularLightingElement; + "fespotlight": SVGFESpotLightElement; + "fetile": SVGFETileElement; + "feturbulence": SVGFETurbulenceElement; + "fieldset": HTMLFieldSetElement; + "figcaption": HTMLElement; + "figure": HTMLElement; + "filter": SVGFilterElement; + "font": HTMLFontElement; + "footer": HTMLElement; + "foreignobject": SVGForeignObjectElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "g": SVGGElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "header": HTMLElement; + "hgroup": HTMLElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "i": HTMLElement; + "iframe": HTMLIFrameElement; + "image": SVGImageElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "kbd": HTMLElement; + "keygen": HTMLElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "line": SVGLineElement; + "lineargradient": SVGLinearGradientElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "mark": HTMLElement; + "marker": SVGMarkerElement; + "marquee": HTMLMarqueeElement; + "mask": SVGMaskElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "metadata": SVGMetadataElement; + "meter": HTMLMeterElement; + "nav": HTMLElement; + "nextid": HTMLUnknownElement; + "nobr": HTMLElement; + "noframes": HTMLElement; + "noscript": HTMLElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "output": HTMLOutputElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "path": SVGPathElement; + "pattern": SVGPatternElement; + "picture": HTMLPictureElement; + "plaintext": HTMLElement; + "polygon": SVGPolygonElement; + "polyline": SVGPolylineElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "radialgradient": SVGRadialGradientElement; + "rect": SVGRectElement; + "rt": HTMLElement; + "ruby": HTMLElement; + "s": HTMLElement; + "samp": HTMLElement; + "script": HTMLScriptElement; + "section": HTMLElement; + "select": HTMLSelectElement; + "small": HTMLElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "stop": SVGStopElement; + "strike": HTMLElement; + "strong": HTMLElement; + "style": HTMLStyleElement; + "sub": HTMLElement; + "sup": HTMLElement; + "svg": SVGSVGElement; + "switch": SVGSwitchElement; + "symbol": SVGSymbolElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "text": SVGTextElement; + "textpath": SVGTextPathElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "time": HTMLTimeElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "tspan": SVGTSpanElement; + "tt": HTMLElement; + "u": HTMLElement; + "ul": HTMLUListElement; + "use": SVGUseElement; + "var": HTMLElement; + "video": HTMLVideoElement; + "view": SVGViewElement; + "wbr": HTMLElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementListTagNameMap { + "a": NodeListOf; + "abbr": NodeListOf; + "acronym": NodeListOf; + "address": NodeListOf; + "applet": NodeListOf; + "area": NodeListOf; + "article": NodeListOf; + "aside": NodeListOf; + "audio": NodeListOf; + "b": NodeListOf; + "base": NodeListOf; + "basefont": NodeListOf; + "bdo": NodeListOf; + "big": NodeListOf; + "blockquote": NodeListOf; + "body": NodeListOf; + "br": NodeListOf; + "button": NodeListOf; + "canvas": NodeListOf; + "caption": NodeListOf; + "center": NodeListOf; + "circle": NodeListOf; + "cite": NodeListOf; + "clippath": NodeListOf; + "code": NodeListOf; + "col": NodeListOf; + "colgroup": NodeListOf; + "data": NodeListOf; + "datalist": NodeListOf; + "dd": NodeListOf; + "defs": NodeListOf; + "del": NodeListOf; + "desc": NodeListOf; + "dfn": NodeListOf; + "dir": NodeListOf; + "div": NodeListOf; + "dl": NodeListOf; + "dt": NodeListOf; + "ellipse": NodeListOf; + "em": NodeListOf; + "embed": NodeListOf; + "feblend": NodeListOf; + "fecolormatrix": NodeListOf; + "fecomponenttransfer": NodeListOf; + "fecomposite": NodeListOf; + "feconvolvematrix": NodeListOf; + "fediffuselighting": NodeListOf; + "fedisplacementmap": NodeListOf; + "fedistantlight": NodeListOf; + "feflood": NodeListOf; + "fefunca": NodeListOf; + "fefuncb": NodeListOf; + "fefuncg": NodeListOf; + "fefuncr": NodeListOf; + "fegaussianblur": NodeListOf; + "feimage": NodeListOf; + "femerge": NodeListOf; + "femergenode": NodeListOf; + "femorphology": NodeListOf; + "feoffset": NodeListOf; + "fepointlight": NodeListOf; + "fespecularlighting": NodeListOf; + "fespotlight": NodeListOf; + "fetile": NodeListOf; + "feturbulence": NodeListOf; + "fieldset": NodeListOf; + "figcaption": NodeListOf; + "figure": NodeListOf; + "filter": NodeListOf; + "font": NodeListOf; + "footer": NodeListOf; + "foreignobject": NodeListOf; + "form": NodeListOf; + "frame": NodeListOf; + "frameset": NodeListOf; + "g": NodeListOf; + "h1": NodeListOf; + "h2": NodeListOf; + "h3": NodeListOf; + "h4": NodeListOf; + "h5": NodeListOf; + "h6": NodeListOf; + "head": NodeListOf; + "header": NodeListOf; + "hgroup": NodeListOf; + "hr": NodeListOf; + "html": NodeListOf; + "i": NodeListOf; + "iframe": NodeListOf; + "image": NodeListOf; + "img": NodeListOf; + "input": NodeListOf; + "ins": NodeListOf; + "isindex": NodeListOf; + "kbd": NodeListOf; + "keygen": NodeListOf; + "label": NodeListOf; + "legend": NodeListOf; + "li": NodeListOf; + "line": NodeListOf; + "lineargradient": NodeListOf; + "link": NodeListOf; + "listing": NodeListOf; + "map": NodeListOf; + "mark": NodeListOf; + "marker": NodeListOf; + "marquee": NodeListOf; + "mask": NodeListOf; + "menu": NodeListOf; + "meta": NodeListOf; + "metadata": NodeListOf; + "meter": NodeListOf; + "nav": NodeListOf; + "nextid": NodeListOf; + "nobr": NodeListOf; + "noframes": NodeListOf; + "noscript": NodeListOf; + "object": NodeListOf; + "ol": NodeListOf; + "optgroup": NodeListOf; + "option": NodeListOf; + "output": NodeListOf; + "p": NodeListOf; + "param": NodeListOf; + "path": NodeListOf; + "pattern": NodeListOf; + "picture": NodeListOf; + "plaintext": NodeListOf; + "polygon": NodeListOf; + "polyline": NodeListOf; + "pre": NodeListOf; + "progress": NodeListOf; + "q": NodeListOf; + "radialgradient": NodeListOf; + "rect": NodeListOf; + "rt": NodeListOf; + "ruby": NodeListOf; + "s": NodeListOf; + "samp": NodeListOf; + "script": NodeListOf; + "section": NodeListOf; + "select": NodeListOf; + "small": NodeListOf; + "source": NodeListOf; + "span": NodeListOf; + "stop": NodeListOf; + "strike": NodeListOf; + "strong": NodeListOf; + "style": NodeListOf; + "sub": NodeListOf; + "sup": NodeListOf; + "svg": NodeListOf; + "switch": NodeListOf; + "symbol": NodeListOf; + "table": NodeListOf; + "tbody": NodeListOf; + "td": NodeListOf; + "template": NodeListOf; + "text": NodeListOf; + "textpath": NodeListOf; + "textarea": NodeListOf; + "tfoot": NodeListOf; + "th": NodeListOf; + "thead": NodeListOf; + "time": NodeListOf; + "title": NodeListOf; + "tr": NodeListOf; + "track": NodeListOf; + "tspan": NodeListOf; + "tt": NodeListOf; + "u": NodeListOf; + "ul": NodeListOf; + "use": NodeListOf; + "var": NodeListOf; + "video": NodeListOf; + "view": NodeListOf; + "wbr": NodeListOf; + "x-ms-webview": NodeListOf; + "xmp": NodeListOf; +} + +declare var Audio: {new(src?: string): HTMLAudioElement; }; +declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; +declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; +declare var applicationCache: ApplicationCache; +declare var caches: CacheStorage; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var crypto: Crypto; +declare var defaultStatus: string; +declare var devicePixelRatio: number; +declare var doNotTrack: string; +declare var document: Document; +declare var event: Event | undefined; +declare var external: External; +declare var frameElement: Element; +declare var frames: Window; +declare var history: History; +declare var innerHeight: number; +declare var innerWidth: number; +declare var isSecureContext: boolean; +declare var length: number; +declare var location: Location; +declare var locationbar: BarProp; +declare var menubar: BarProp; +declare var msContentScript: ExtensionScriptApis; +declare var msCredentials: MSCredentials; +declare const name: never; +declare var navigator: Navigator; +declare var offscreenBuffering: string | boolean; +declare var onabort: (this: Window, ev: UIEvent) => any; +declare var onafterprint: (this: Window, ev: Event) => any; +declare var onbeforeprint: (this: Window, ev: Event) => any; +declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; +declare var onblur: (this: Window, ev: FocusEvent) => any; +declare var oncanplay: (this: Window, ev: Event) => any; +declare var oncanplaythrough: (this: Window, ev: Event) => any; +declare var onchange: (this: Window, ev: Event) => any; +declare var onclick: (this: Window, ev: MouseEvent) => any; +declare var oncompassneedscalibration: (this: Window, ev: Event) => any; +declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; +declare var ondblclick: (this: Window, ev: MouseEvent) => any; +declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; +declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; +declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; +declare var ondrag: (this: Window, ev: DragEvent) => any; +declare var ondragend: (this: Window, ev: DragEvent) => any; +declare var ondragenter: (this: Window, ev: DragEvent) => any; +declare var ondragleave: (this: Window, ev: DragEvent) => any; +declare var ondragover: (this: Window, ev: DragEvent) => any; +declare var ondragstart: (this: Window, ev: DragEvent) => any; +declare var ondrop: (this: Window, ev: DragEvent) => any; +declare var ondurationchange: (this: Window, ev: Event) => any; +declare var onemptied: (this: Window, ev: Event) => any; +declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; +declare var onerror: ErrorEventHandler; +declare var onfocus: (this: Window, ev: FocusEvent) => any; +declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; +declare var oninput: (this: Window, ev: Event) => any; +declare var oninvalid: (this: Window, ev: Event) => any; +declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; +declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; +declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; +declare var onload: (this: Window, ev: Event) => any; +declare var onloadeddata: (this: Window, ev: Event) => any; +declare var onloadedmetadata: (this: Window, ev: Event) => any; +declare var onloadstart: (this: Window, ev: Event) => any; +declare var onmessage: (this: Window, ev: MessageEvent) => any; +declare var onmousedown: (this: Window, ev: MouseEvent) => any; +declare var onmouseenter: (this: Window, ev: MouseEvent) => any; +declare var onmouseleave: (this: Window, ev: MouseEvent) => any; +declare var onmousemove: (this: Window, ev: MouseEvent) => any; +declare var onmouseout: (this: Window, ev: MouseEvent) => any; +declare var onmouseover: (this: Window, ev: MouseEvent) => any; +declare var onmouseup: (this: Window, ev: MouseEvent) => any; +declare var onmousewheel: (this: Window, ev: WheelEvent) => any; +declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; +declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; +declare var onoffline: (this: Window, ev: Event) => any; +declare var ononline: (this: Window, ev: Event) => any; +declare var onorientationchange: (this: Window, ev: Event) => any; +declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; +declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; +declare var onpause: (this: Window, ev: Event) => any; +declare var onplay: (this: Window, ev: Event) => any; +declare var onplaying: (this: Window, ev: Event) => any; +declare var onpopstate: (this: Window, ev: PopStateEvent) => any; +declare var onprogress: (this: Window, ev: ProgressEvent) => any; +declare var onratechange: (this: Window, ev: Event) => any; +declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; +declare var onreset: (this: Window, ev: Event) => any; +declare var onresize: (this: Window, ev: UIEvent) => any; +declare var onscroll: (this: Window, ev: UIEvent) => any; +declare var onseeked: (this: Window, ev: Event) => any; +declare var onseeking: (this: Window, ev: Event) => any; +declare var onselect: (this: Window, ev: UIEvent) => any; +declare var onstalled: (this: Window, ev: Event) => any; +declare var onstorage: (this: Window, ev: StorageEvent) => any; +declare var onsubmit: (this: Window, ev: Event) => any; +declare var onsuspend: (this: Window, ev: Event) => any; +declare var ontimeupdate: (this: Window, ev: Event) => any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; +declare var onunload: (this: Window, ev: Event) => any; +declare var onvolumechange: (this: Window, ev: Event) => any; +declare var onwaiting: (this: Window, ev: Event) => any; +declare var opener: any; +declare var orientation: string | number; +declare var outerHeight: number; +declare var outerWidth: number; +declare var pageXOffset: number; +declare var pageYOffset: number; +declare var parent: Window; +declare var performance: Performance; +declare var personalbar: BarProp; +declare var screen: Screen; +declare var screenLeft: number; +declare var screenTop: number; +declare var screenX: number; +declare var screenY: number; +declare var scrollX: number; +declare var scrollY: number; +declare var scrollbars: BarProp; +declare var self: Window; +declare var speechSynthesis: SpeechSynthesis; +declare var status: string; +declare var statusbar: BarProp; +declare var styleMedia: StyleMedia; +declare var toolbar: BarProp; +declare var top: Window; +declare var window: Window; +declare var customElements: CustomElementRegistry; +declare function alert(message?: any): void; +declare function blur(): void; +declare function cancelAnimationFrame(handle: number): void; +declare function captureEvents(): void; +declare function close(): void; +declare function confirm(message?: string): boolean; +declare function departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; +declare function focus(): void; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; +declare function getSelection(): Selection; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function moveBy(x?: number, y?: number): void; +declare function moveTo(x?: number, y?: number): void; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string | null; +declare function releaseEvents(): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function resizeBy(x?: number, y?: number): void; +declare function resizeTo(x?: number, y?: number): void; +declare function scroll(x?: number, y?: number): void; +declare function scrollBy(x?: number, y?: number): void; +declare function scrollTo(x?: number, y?: number): void; +declare function stop(): void; +declare function webkitCancelAnimationFrame(handle: number): void; +declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; +declare function scroll(options?: ScrollToOptions): void; +declare function scrollTo(options?: ScrollToOptions): void; +declare function scrollBy(options?: ScrollToOptions): void; +declare function toString(): string; +declare function dispatchEvent(evt: Event): boolean; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare var sessionStorage: Storage; +declare var localStorage: Storage; +declare var console: Console; +declare var onpointercancel: (this: Window, ev: PointerEvent) => any; +declare var onpointerdown: (this: Window, ev: PointerEvent) => any; +declare var onpointerenter: (this: Window, ev: PointerEvent) => any; +declare var onpointerleave: (this: Window, ev: PointerEvent) => any; +declare var onpointermove: (this: Window, ev: PointerEvent) => any; +declare var onpointerout: (this: Window, ev: PointerEvent) => any; +declare var onpointerover: (this: Window, ev: PointerEvent) => any; +declare var onpointerup: (this: Window, ev: PointerEvent) => any; +declare var onwheel: (this: Window, ev: WheelEvent) => any; +declare var indexedDB: IDBFactory; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; +declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type BodyInit = any; +type ByteString = string; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type HeadersInit = any; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidateDictionary | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type RequestInfo = Request | string; +type USVString = string; +type payloadtype = number; +type ScrollBehavior = "auto" | "instant" | "smooth"; +type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; +type IDBValidKey = number | string | Date | IDBArrayKey; +type BufferSource = ArrayBuffer | ArrayBufferView; +type MouseWheelEvent = WheelEvent; +type ScrollRestoration = "auto" | "manual"; +type FormDataEntryValue = string | File; +type AppendMode = "segments" | "sequence"; +type AudioContextState = "suspended" | "running" | "closed"; +type BiquadFilterType = "lowpass" | "highpass" | "bandpass" | "lowshelf" | "highshelf" | "peaking" | "notch" | "allpass"; +type CanvasFillRule = "nonzero" | "evenodd"; +type ChannelCountMode = "max" | "clamped-max" | "explicit"; +type ChannelInterpretation = "speakers" | "discrete"; +type DistanceModelType = "linear" | "inverse" | "exponential"; +type ExpandGranularity = "character" | "word" | "sentence" | "textedit"; +type GamepadInputEmulationType = "mouse" | "keyboard" | "gamepad"; +type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; +type IDBRequestReadyState = "pending" | "done"; +type IDBTransactionMode = "readonly" | "readwrite" | "versionchange"; +type ListeningState = "inactive" | "active" | "disambiguation"; +type MSCredentialType = "FIDO_2_0"; +type MSIceAddrType = "os" | "stun" | "turn" | "peer-derived"; +type MSIceType = "failed" | "direct" | "relay"; +type MSStatsType = "description" | "localclientevent" | "inbound-network" | "outbound-network" | "inbound-payload" | "outbound-payload" | "transportdiagnostics"; +type MSTransportType = "Embedded" | "USB" | "NFC" | "BT"; +type MSWebViewPermissionState = "unknown" | "defer" | "allow" | "deny"; +type MSWebViewPermissionType = "geolocation" | "unlimitedIndexedDBQuota" | "media" | "pointerlock" | "webnotifications"; +type MediaDeviceKind = "audioinput" | "audiooutput" | "videoinput"; +type MediaKeyMessageType = "license-request" | "license-renewal" | "license-release" | "individualization-request"; +type MediaKeySessionType = "temporary" | "persistent-license" | "persistent-release-message"; +type MediaKeyStatus = "usable" | "expired" | "output-downscaled" | "output-not-allowed" | "status-pending" | "internal-error"; +type MediaKeysRequirement = "required" | "optional" | "not-allowed"; +type MediaStreamTrackState = "live" | "ended"; +type NavigationReason = "up" | "down" | "left" | "right"; +type NavigationType = "navigate" | "reload" | "back_forward" | "prerender"; +type NotificationDirection = "auto" | "ltr" | "rtl"; +type NotificationPermission = "default" | "denied" | "granted"; +type OscillatorType = "sine" | "square" | "sawtooth" | "triangle" | "custom"; +type OverSampleType = "none" | "2x" | "4x"; +type PanningModelType = "equalpower"; +type PaymentComplete = "success" | "fail" | ""; +type PaymentShippingType = "shipping" | "delivery" | "pickup"; +type PushEncryptionKeyName = "p256dh" | "auth"; +type PushPermissionState = "granted" | "denied" | "prompt"; +type RTCBundlePolicy = "balanced" | "max-compat" | "max-bundle"; +type RTCDegradationPreference = "maintain-framerate" | "maintain-resolution" | "balanced"; +type RTCDtlsRole = "auto" | "client" | "server"; +type RTCDtlsTransportState = "new" | "connecting" | "connected" | "closed"; +type RTCIceCandidateType = "host" | "srflx" | "prflx" | "relay"; +type RTCIceComponent = "RTP" | "RTCP"; +type RTCIceConnectionState = "new" | "checking" | "connected" | "completed" | "failed" | "disconnected" | "closed"; +type RTCIceGatherPolicy = "all" | "nohost" | "relay"; +type RTCIceGathererState = "new" | "gathering" | "complete"; +type RTCIceGatheringState = "new" | "gathering" | "complete"; +type RTCIceProtocol = "udp" | "tcp"; +type RTCIceRole = "controlling" | "controlled"; +type RTCIceTcpCandidateType = "active" | "passive" | "so"; +type RTCIceTransportPolicy = "none" | "relay" | "all"; +type RTCIceTransportState = "new" | "checking" | "connected" | "completed" | "disconnected" | "closed"; +type RTCSdpType = "offer" | "pranswer" | "answer"; +type RTCSignalingState = "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer" | "closed"; +type RTCStatsIceCandidatePairState = "frozen" | "waiting" | "inprogress" | "failed" | "succeeded" | "cancelled"; +type RTCStatsIceCandidateType = "host" | "serverreflexive" | "peerreflexive" | "relayed"; +type RTCStatsType = "inboundrtp" | "outboundrtp" | "session" | "datachannel" | "track" | "transport" | "candidatepair" | "localcandidate" | "remotecandidate"; +type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url"; +type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache"; +type RequestCredentials = "omit" | "same-origin" | "include"; +type RequestDestination = "" | "document" | "sharedworker" | "subresource" | "unknown" | "worker"; +type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; +type RequestRedirect = "follow" | "error" | "manual"; +type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video"; +type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; +type ScopedCredentialType = "ScopedCred"; +type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant"; +type Transport = "usb" | "nfc" | "ble"; +type VideoFacingModeEnum = "user" | "environment" | "left" | "right"; +type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded"; +type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text"; \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.dom.iterable.d.ts b/node_modules/typescript/lib/lib.dom.iterable.d.ts index 2b6205476..95bb1465d 100644 --- a/node_modules/typescript/lib/lib.dom.iterable.d.ts +++ b/node_modules/typescript/lib/lib.dom.iterable.d.ts @@ -1,33 +1,92 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -/// - -interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +/// + +interface DOMTokenList { + [Symbol.iterator](): IterableIterator; +} + +interface FormData { + /** + * Returns an array of key, value pairs for every entry in the list + */ + entries(): IterableIterator<[string, string | File]>; + /** + * Returns a list of keys in the list + */ + keys(): IterableIterator; + /** + * Returns a list of values in the list + */ + values(): IterableIterator; + + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + /** + * Returns an array of key, value pairs for every entry in the list + */ + entries(): IterableIterator<[number, Node]>; + /** + * Performs the specified action for each node in an list. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: Node, index: number, listObj: NodeList) => void, thisArg?: any): void; + /** + * Returns an list of keys in the list + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the list + */ + values(): IterableIterator; + + + [Symbol.iterator](): IterableIterator; +} + +interface NodeListOf { + + /** + * Returns an array of key, value pairs for every entry in the list + */ + entries(): IterableIterator<[number, TNode]>; + + /** + * Performs the specified action for each node in an list. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: TNode, index: number, listObj: NodeListOf) => void, thisArg?: any): void; + /** + * Returns an list of keys in the list + */ + keys(): IterableIterator; + /** + * Returns an list of values in the list + */ + values(): IterableIterator; + + [Symbol.iterator](): IterableIterator; +} diff --git a/node_modules/typescript/lib/lib.es2015.collection.d.ts b/node_modules/typescript/lib/lib.es2015.collection.d.ts index eabd6319d..37ebed50a 100644 --- a/node_modules/typescript/lib/lib.es2015.collection.d.ts +++ b/node_modules/typescript/lib/lib.es2015.collection.d.ts @@ -1,92 +1,92 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; - readonly size: number; -} - -interface MapConstructor { - new (): Map; - new (entries?: [K, V][]): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface ReadonlyMap { - forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; - get(key: K): V|undefined; - has(key: K): boolean; - readonly size: number; -} - -interface WeakMap { - delete(key: K): boolean; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (entries?: [K, V][]): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): this; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface SetConstructor { - new (): Set; - new (values?: T[]): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface ReadonlySet { - forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface WeakSet { - add(value: T): this; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (values?: T[]): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value: V): this; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (entries?: [K, V][]): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface ReadonlyMap { + forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + readonly size: number; +} + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value: V): this; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (entries?: [K, V][]): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface SetConstructor { + new (): Set; + new (values?: T[]): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface ReadonlySet { + forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface WeakSet { + add(value: T): this; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (values?: T[]): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; diff --git a/node_modules/typescript/lib/lib.es2015.core.d.ts b/node_modules/typescript/lib/lib.es2015.core.d.ts index 499d0de52..bf2edb82c 100644 --- a/node_modules/typescript/lib/lib.es2015.core.d.ts +++ b/node_modules/typescript/lib/lib.es2015.core.d.ts @@ -1,544 +1,554 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -declare type PropertyKey = string | number | symbol; - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): this; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface DateConstructor { - new (value: Date): Date; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface ReadonlyArray { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: ReadonlyArray) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): number; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - new (pattern: RegExp, flags?: string): RegExp; - (pattern: RegExp, flags?: string): RegExp; -} - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number | undefined; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: T, index: number, obj: Array) => boolean): T | undefined; + find(predicate: (this: void, value: T, index: number, obj: Array) => boolean, thisArg: undefined): T | undefined; + find(predicate: (this: Z, value: T, index: number, obj: Array) => boolean, thisArg: Z): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: T, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): this; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: T, k: number) => U): Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array; + + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface DateConstructor { + new (value: Date): Date; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: object, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: object | null): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface ReadonlyArray { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray) => boolean): T | undefined; + find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray) => boolean, thisArg: undefined): T | undefined; + find(predicate: (this: Z, value: T, index: number, obj: ReadonlyArray) => boolean, thisArg: Z): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: T, index: number, obj: Array) => boolean, thisArg: Z): number; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface RegExpConstructor { + new (pattern: RegExp, flags?: string): RegExp; + (pattern: RegExp, flags?: string): RegExp; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string; + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} diff --git a/node_modules/typescript/lib/lib.es2015.d.ts b/node_modules/typescript/lib/lib.es2015.d.ts index ff5c555bf..a536e9c89 100644 --- a/node_modules/typescript/lib/lib.es2015.d.ts +++ b/node_modules/typescript/lib/lib.es2015.d.ts @@ -1,30 +1,30 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -/// -/// -/// -/// -/// -/// -/// -/// -/// + +/// +/// +/// +/// +/// +/// +/// +/// +/// /// \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.es2015.generator.d.ts b/node_modules/typescript/lib/lib.es2015.generator.d.ts index 20d6725f6..d331a58b5 100644 --- a/node_modules/typescript/lib/lib.es2015.generator.d.ts +++ b/node_modules/typescript/lib/lib.es2015.generator.d.ts @@ -1,32 +1,72 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -interface GeneratorFunction extends Function { } - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; + +interface Generator extends Iterator { } + +interface GeneratorFunction { + /** + * Creates a new Generator object. + * @param args A list of arguments the function accepts. + */ + new (...args: any[]): Generator; + /** + * Creates a new Generator object. + * @param args A list of arguments the function accepts. + */ + (...args: any[]): Generator; + /** + * The length of the arguments. + */ + readonly length: number; + /** + * Returns the name of the function. + */ + readonly name: string; + /** + * A reference to the prototype. + */ + readonly prototype: Generator; +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + (...args: string[]): GeneratorFunction; + /** + * The length of the arguments. + */ + readonly length: number; + /** + * Returns the name of the function. + */ + readonly name: string; + /** + * A reference to the prototype. + */ + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; diff --git a/node_modules/typescript/lib/lib.es2015.iterable.d.ts b/node_modules/typescript/lib/lib.es2015.iterable.d.ts index cb92cb4b8..e083a89f7 100644 --- a/node_modules/typescript/lib/lib.es2015.iterable.d.ts +++ b/node_modules/typescript/lib/lib.es2015.iterable.d.ts @@ -1,465 +1,503 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -/// - -interface SymbolConstructor { - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; -} - -interface IteratorResult { - done: boolean; - value: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; -} - -interface ReadonlyArray { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface Map { - [Symbol.iterator](): IterableIterator<[K,V]>; - entries(): IterableIterator<[K, V]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface MapConstructor { - new (iterable: Iterable<[K, V]>): Map; -} - -interface WeakMap { } - -interface WeakMapConstructor { - new (iterable: Iterable<[K, V]>): WeakMap; -} - -interface Set { - [Symbol.iterator](): IterableIterator; - entries(): IterableIterator<[T, T]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface SetConstructor { - new (iterable: Iterable): Set; -} - -interface WeakSet { } - -interface WeakSetConstructor { - new (iterable: Iterable): WeakSet; -} - -interface Promise { } - -interface PromiseConstructor { - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; -} - -declare namespace Reflect { - function enumerate(target: any): IterableIterator; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} \ No newline at end of file +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (this: void, v: T, k: number) => U): Array; + from(iterable: Iterable, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array; + from(iterable: Iterable, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface ReadonlyArray { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + [Symbol.iterator](): IterableIterator<[K, V]>; + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + [Symbol.iterator](): IterableIterator; + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: object): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Int8Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int8Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int8Array; + + from(arrayLike: Iterable): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint8Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8Array; + + from(arrayLike: Iterable): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint8ClampedArray; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8ClampedArray; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8ClampedArray; + + from(arrayLike: Iterable): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Int16Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int16Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int16Array; + + from(arrayLike: Iterable): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint16Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint16Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint16Array; + + from(arrayLike: Iterable): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Int32Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int32Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int32Array; + + from(arrayLike: Iterable): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint32Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint32Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint32Array; + + from(arrayLike: Iterable): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Float32Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float32Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float32Array; + + from(arrayLike: Iterable): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Float64Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float64Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float64Array; + + from(arrayLike: Iterable): Float64Array; +} diff --git a/node_modules/typescript/lib/lib.es2015.promise.d.ts b/node_modules/typescript/lib/lib.es2015.promise.d.ts index 02352da40..81118e89d 100644 --- a/node_modules/typescript/lib/lib.es2015.promise.d.ts +++ b/node_modules/typescript/lib/lib.es2015.promise.d.ts @@ -1,274 +1,223 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// + + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - declare var Promise: PromiseConstructor; \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.es2015.proxy.d.ts b/node_modules/typescript/lib/lib.es2015.proxy.d.ts index 6f01f10bf..29b12d91e 100644 --- a/node_modules/typescript/lib/lib.es2015.proxy.d.ts +++ b/node_modules/typescript/lib/lib.es2015.proxy.d.ts @@ -1,42 +1,42 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -interface ProxyHandler { - getPrototypeOf? (target: T): {} | null; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, argArray: any, newTarget?: any): {}; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; + +interface ProxyHandler { + getPrototypeOf? (target: T): object | null; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, argArray: any, newTarget?: any): object; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T; +} +declare var Proxy: ProxyConstructor; diff --git a/node_modules/typescript/lib/lib.es2015.reflect.d.ts b/node_modules/typescript/lib/lib.es2015.reflect.d.ts index b6a685345..2bea5f1e5 100644 --- a/node_modules/typescript/lib/lib.es2015.reflect.d.ts +++ b/node_modules/typescript/lib/lib.es2015.reflect.d.ts @@ -1,35 +1,35 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} \ No newline at end of file + +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: object, propertyKey: PropertyKey): boolean; + function get(target: object, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: object): object; + function has(target: object, propertyKey: PropertyKey): boolean; + function isExtensible(target: object): boolean; + function ownKeys(target: object): Array; + function preventExtensions(target: object): boolean; + function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: object, proto: any): boolean; +} diff --git a/node_modules/typescript/lib/lib.es2015.symbol.d.ts b/node_modules/typescript/lib/lib.es2015.symbol.d.ts index c0474aec0..a9cce3309 100644 --- a/node_modules/typescript/lib/lib.es2015.symbol.d.ts +++ b/node_modules/typescript/lib/lib.es2015.symbol.d.ts @@ -1,56 +1,56 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string | undefined; -} - +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): symbol; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string | number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + declare var Symbol: SymbolConstructor; \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts b/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts index 42299fe7d..869da0561 100644 --- a/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +++ b/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts @@ -1,347 +1,347 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -/// - -interface SymbolConstructor { - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} - -interface Symbol { - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface Array { - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface Map { - readonly [Symbol.toStringTag]: "Map"; -} - -interface WeakMap{ - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface Set { - readonly [Symbol.toStringTag]: "Set"; -} - -interface WeakSet { - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -interface Function { - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface Math { - readonly [Symbol.toStringTag]: "Math"; -} - -interface Promise { - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - readonly [Symbol.species]: Function; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray | null; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface String { - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - readonly [Symbol.toStringTag]: "Int8Array"; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - readonly [Symbol.toStringTag]: "Int16Array"; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - readonly [Symbol.toStringTag]: "Int32Array"; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - readonly [Symbol.toStringTag]: "Float32Array"; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - readonly [Symbol.toStringTag]: "Float64Array"; -} \ No newline at end of file +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; +} diff --git a/node_modules/typescript/lib/lib.es2016.array.include.d.ts b/node_modules/typescript/lib/lib.es2016.array.include.d.ts index 42b95c478..734fa450d 100644 --- a/node_modules/typescript/lib/lib.es2016.array.include.d.ts +++ b/node_modules/typescript/lib/lib.es2016.array.include.d.ts @@ -1,109 +1,118 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -interface Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: T, fromIndex?: number): boolean; -} - -interface Int8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8ClampedArray { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float64Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; + +interface Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + +interface ReadonlyArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + +interface Int8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8ClampedArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float64Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; } \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.es2016.d.ts b/node_modules/typescript/lib/lib.es2016.d.ts index 5921e060d..50fdffa85 100644 --- a/node_modules/typescript/lib/lib.es2016.d.ts +++ b/node_modules/typescript/lib/lib.es2016.d.ts @@ -1,22 +1,22 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -/// + +/// /// \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.es2017.d.ts b/node_modules/typescript/lib/lib.es2017.d.ts index 94c75a1b4..a0d3a0aff 100644 --- a/node_modules/typescript/lib/lib.es2017.d.ts +++ b/node_modules/typescript/lib/lib.es2017.d.ts @@ -1,24 +1,24 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - +/*! ***************************************************************************** +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. +***************************************************************************** */ -/// +/// -/// -/// -/// -/// + +/// +/// +/// +/// \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.es2017.object.d.ts b/node_modules/typescript/lib/lib.es2017.object.d.ts index dc3806835..00c11be27 100644 --- a/node_modules/typescript/lib/lib.es2017.object.d.ts +++ b/node_modules/typescript/lib/lib.es2017.object.d.ts @@ -1,34 +1,45 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -interface ObjectConstructor { - /** - * Returns an array of values of the enumerable properties of an object - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - values(o: { [s: string]: T }): T[]; - values(o: any): any[]; - /** - * Returns an array of key/values of the enumerable properties of an object - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - entries(o: T): [keyof T, T[K]][]; - entries(o: any): [string, any][]; -} +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +interface ObjectConstructor { + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: { [s: string]: T }): T[]; + + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + values(o: any): any[]; + + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: { [s: string]: T }): [string, T][]; + + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: any): [string, any][]; +} diff --git a/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts b/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts index c59e12555..c0254f1dc 100644 --- a/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +++ b/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts @@ -1,47 +1,47 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -/// -/// - -interface SharedArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /* - * The SharedArrayBuffer constructor's length property whose value is 1. - */ - length: number; - /** - * Returns a section of an SharedArrayBuffer. - */ - slice(begin:number, end?:number): SharedArrayBuffer; - readonly [Symbol.species]: SharedArrayBuffer; - readonly [Symbol.toStringTag]: "SharedArrayBuffer"; -} - -interface SharedArrayBufferConstructor { - readonly prototype: SharedArrayBuffer; - new (byteLength: number): SharedArrayBuffer; -} - +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +/// +/// + +interface SharedArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /* + * The SharedArrayBuffer constructor's length property whose value is 1. + */ + length: number; + /** + * Returns a section of an SharedArrayBuffer. + */ + slice(begin: number, end?: number): SharedArrayBuffer; + readonly [Symbol.species]: SharedArrayBuffer; + readonly [Symbol.toStringTag]: "SharedArrayBuffer"; +} + +interface SharedArrayBufferConstructor { + readonly prototype: SharedArrayBuffer; + new (byteLength: number): SharedArrayBuffer; +} + declare var SharedArrayBuffer: SharedArrayBufferConstructor; \ No newline at end of file diff --git a/node_modules/typescript/lib/lib.es5.d.ts b/node_modules/typescript/lib/lib.es5.d.ts index 8e8b3b1b8..f43d062ad 100644 --- a/node_modules/typescript/lib/lib.es5.d.ts +++ b/node_modules/typescript/lib/lib.es5.d.ts @@ -1,4195 +1,4342 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has null prototype. - * @param o Object to use as a prototype. May be null - */ - create(o: null): any; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - */ - create(o: T): T; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(a: T[]): ReadonlyArray; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(f: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): Readonly; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(this: Function, thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(this: Function, thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(this: Function, thisArg: any, ...argArray: any[]): any; - - /** Returns a string representation of a function. */ - toString(): string; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray | null; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray | null; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare const Number: NumberConstructor; - -interface TemplateStringsArray extends ReadonlyArray { - readonly raw: ReadonlyArray -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): this; -} - -interface RegExpConstructor { - new (pattern: RegExp): RegExp; - new (pattern: string, flags?: string): RegExp; - (pattern: RegExp): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} - -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => value is S, thisArg?: any): S[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T | undefined; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T | undefined; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Make all properties in T optional - */ -type Partial = { - [P in keyof T]?: T[P]; -}; - -/** - * Make all properties in T readonly - */ -type Readonly = { - readonly [P in keyof T]: T[P]; -}; - -/** - * From T pick a set of properties K - */ -type Pick = { - [P in K]: T[P]; -} - -/** - * Construct a type with a set of properties K of type T - */ -type Record = { - [P in K]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; - -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string | string[], options?: CollatorOptions): Collator; - (locales?: string | string[], options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current or specified locale. - * @param that String to compare to target string - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare const NaN: number; +declare const Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype or that has null prototype. + * @param o Object to use as a prototype. May be null. + */ + create(o: object | null): any; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor & ThisType): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare const Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare const Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string | RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string | RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string | RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string | RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare const String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + readonly prototype: Boolean; +} + +declare const Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare const Number: NumberConstructor; + +interface TemplateStringsArray extends ReadonlyArray { + readonly raw: ReadonlyArray; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare const Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare const Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): this; +} + +interface RegExpConstructor { + new (pattern: RegExp | string): RegExp; + new (pattern: string, flags?: string): RegExp; + (pattern: RegExp | string): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare const RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare const Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare const EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare const RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare const ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare const SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare const TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare const URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare const JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[][]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | T[])[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean): boolean; + every(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: Z): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean): boolean; + some(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: Z): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => void): void; + forEach(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => void, thisArg: Z): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => U): U[]; + map(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => U, thisArg: undefined): U[]; + map(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => U, thisArg: Z): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => value is S): S[]; + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => value is S, thisArg: undefined): S[]; + filter(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => value is S, thisArg: Z): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => any): T[]; + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => any, thisArg: undefined): T[]; + filter(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => any, thisArg: Z): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T | undefined; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[][]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | T[])[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T | undefined; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + */ + splice(start: number, deleteCount?: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean): boolean; + every(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: T, index: number, array: T[]) => boolean, thisArg: Z): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean): boolean; + some(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: T, index: number, array: T[]) => boolean, thisArg: Z): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: T, index: number, array: T[]) => void): void; + forEach(callbackfn: (this: void, value: T, index: number, array: T[]) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: T, index: number, array: T[]) => void, thisArg: Z): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U, U, U]; + map(this: [T, T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U, U, U]; + map(this: [T, T, T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U, U]; + map(this: [T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U, U]; + map(this: [T, T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U]; + map(this: [T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U]; + map(this: [T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U]; + map(this: [T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U]; + map(this: [T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: T, index: number, array: T[]) => U): U[]; + map(callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): U[]; + map(callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => any): T[]; + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => any, thisArg: undefined): T[]; + filter(callbackfn: (this: Z, value: T, index: number, array: T[]) => any, thisArg: Z): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + readonly prototype: Array; +} + +declare const Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +} + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} + +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; + +/** + * From T pick a set of properties K + */ +type Pick = { + [P in K]: T[P]; +}; + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +}; + +/** + * Marker for contextual 'this' type + */ +interface ThisType { } + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare const ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare const DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int8Array) => any): Int8Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int8Array) => any, thisArg: undefined): Int8Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => any, thisArg: Z): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int8Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int8Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int8Array) => number): Int8Array; + map(callbackfn: (this: void, value: number, index: number, array: Int8Array) => number, thisArg: undefined): Int8Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => number, thisArg: Z): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int8Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int8Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int8Array; + + from(arrayLike: ArrayLike): Int8Array; + +} +declare const Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => any): Uint8Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => any, thisArg: undefined): Uint8Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => any, thisArg: Z): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => number): Uint8Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => number, thisArg: undefined): Uint8Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => number, thisArg: Z): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint8Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8Array; + + from(arrayLike: ArrayLike): Uint8Array; + +} +declare const Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => any): Uint8ClampedArray; + filter(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => any, thisArg: undefined): Uint8ClampedArray; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => any, thisArg: Z): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => number): Uint8ClampedArray; + map(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => number, thisArg: undefined): Uint8ClampedArray; + map(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => number, thisArg: Z): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint8ClampedArray; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8ClampedArray; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8ClampedArray; + + from(arrayLike: ArrayLike): Uint8ClampedArray; +} +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int16Array) => any): Int16Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int16Array) => any, thisArg: undefined): Int16Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => any, thisArg: Z): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int16Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int16Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int16Array) => number): Int16Array; + map(callbackfn: (this: void, value: number, index: number, array: Int16Array) => number, thisArg: undefined): Int16Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => number, thisArg: Z): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int16Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int16Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int16Array; + + from(arrayLike: ArrayLike): Int16Array; + +} +declare const Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => any): Uint16Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => any, thisArg: undefined): Uint16Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => any, thisArg: Z): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => number): Uint16Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => number, thisArg: undefined): Uint16Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => number, thisArg: Z): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint16Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint16Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint16Array; + + from(arrayLike: ArrayLike): Uint16Array; + +} +declare const Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int32Array) => any): Int32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int32Array) => any, thisArg: undefined): Int32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => any, thisArg: Z): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int32Array) => number): Int32Array; + map(callbackfn: (this: void, value: number, index: number, array: Int32Array) => number, thisArg: undefined): Int32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => number, thisArg: Z): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int32Array; + + from(arrayLike: ArrayLike): Int32Array; +} +declare const Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => any): Uint32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => any, thisArg: undefined): Uint32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => any, thisArg: Z): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => number): Uint32Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => number, thisArg: undefined): Uint32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => number, thisArg: Z): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint32Array; + + from(arrayLike: ArrayLike): Uint32Array; +} +declare const Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Float32Array) => any): Float32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Float32Array) => any, thisArg: undefined): Float32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => any, thisArg: Z): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Float32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Float32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Float32Array) => number): Float32Array; + map(callbackfn: (this: void, value: number, index: number, array: Float32Array) => number, thisArg: undefined): Float32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => number, thisArg: Z): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Float32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float32Array; + + from(arrayLike: ArrayLike): Float32Array; + +} +declare const Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Float64Array) => any): Float64Array; + filter(callbackfn: (this: void, value: number, index: number, array: Float64Array) => any, thisArg: undefined): Float64Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => any, thisArg: Z): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Float64Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Float64Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Float64Array) => number): Float64Array; + map(callbackfn: (this: void, value: number, index: number, array: Float64Array) => number, thisArg: undefined): Float64Array; + map(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => number, thisArg: Z): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Float64Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float64Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float64Array; + + from(arrayLike: ArrayLike): Float64Array; +} +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare namespace Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + }; + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + }; + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; + }; +} + +interface String { + /** + * Determines whether two strings are equivalent in the current or specified locale. + * @param that String to compare to target string + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} diff --git a/node_modules/typescript/lib/lib.es6.d.ts b/node_modules/typescript/lib/lib.es6.d.ts index e2b9565d8..9136af437 100644 --- a/node_modules/typescript/lib/lib.es6.d.ts +++ b/node_modules/typescript/lib/lib.es6.d.ts @@ -1,19950 +1,21514 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has null prototype. - * @param o Object to use as a prototype. May be null - */ - create(o: null): any; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - */ - create(o: T): T; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(a: T[]): ReadonlyArray; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(f: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): Readonly; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(this: Function, thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(this: Function, thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(this: Function, thisArg: any, ...argArray: any[]): any; - - /** Returns a string representation of a function. */ - toString(): string; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray | null; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray | null; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare const Number: NumberConstructor; - -interface TemplateStringsArray extends ReadonlyArray { - readonly raw: ReadonlyArray -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): this; -} - -interface RegExpConstructor { - new (pattern: RegExp): RegExp; - new (pattern: string, flags?: string): RegExp; - (pattern: RegExp): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} - -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => value is S, thisArg?: any): S[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T | undefined; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[][]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T | undefined; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U]; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Make all properties in T optional - */ -type Partial = { - [P in keyof T]?: T[P]; -}; - -/** - * Make all properties in T readonly - */ -type Readonly = { - readonly [P in keyof T]: T[P]; -}; - -/** - * From T pick a set of properties K - */ -type Pick = { - [P in K]: T[P]; -} - -/** - * Construct a type with a set of properties K of type T - */ -type Record = { - [P in K]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): this; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; - -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string | string[], options?: CollatorOptions): Collator; - (locales?: string | string[], options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current or specified locale. - * @param that String to compare to target string - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} - - -declare type PropertyKey = string | number | symbol; - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): this; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): this; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface DateConstructor { - new (value: Date): Date; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface ReadonlyArray { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: ReadonlyArray) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): number; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - new (pattern: RegExp, flags?: string): RegExp; - (pattern: RegExp, flags?: string): RegExp; -} - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number | undefined; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - - -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; - readonly size: number; -} - -interface MapConstructor { - new (): Map; - new (entries?: [K, V][]): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface ReadonlyMap { - forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; - get(key: K): V|undefined; - has(key: K): boolean; - readonly size: number; -} - -interface WeakMap { - delete(key: K): boolean; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): this; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (entries?: [K, V][]): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): this; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface SetConstructor { - new (): Set; - new (values?: T[]): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface ReadonlySet { - forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; - has(value: T): boolean; - readonly size: number; -} - -interface WeakSet { - add(value: T): this; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (values?: T[]): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - - -interface GeneratorFunction extends Function { } - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - - -/// - -interface SymbolConstructor { - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; -} - -interface IteratorResult { - done: boolean; - value: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; -} - -interface ReadonlyArray { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface Map { - [Symbol.iterator](): IterableIterator<[K,V]>; - entries(): IterableIterator<[K, V]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface MapConstructor { - new (iterable: Iterable<[K, V]>): Map; -} - -interface WeakMap { } - -interface WeakMapConstructor { - new (iterable: Iterable<[K, V]>): WeakMap; -} - -interface Set { - [Symbol.iterator](): IterableIterator; - entries(): IterableIterator<[T, T]>; - keys(): IterableIterator; - values(): IterableIterator; -} - -interface SetConstructor { - new (iterable: Iterable): Set; -} - -interface WeakSet { } - -interface WeakSetConstructor { - new (iterable: Iterable): WeakSet; -} - -interface Promise { } - -interface PromiseConstructor { - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; -} - -declare namespace Reflect { - function enumerate(target: any): IterableIterator; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - [Symbol.iterator](): IterableIterator; - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare const NaN: number; +declare const Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype or that has null prototype. + * @param o Object to use as a prototype. May be null. + */ + create(o: object | null): any; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor & ThisType): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare const Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare const Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string | RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string | RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string | RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string | RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare const String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + readonly prototype: Boolean; +} + +declare const Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare const Number: NumberConstructor; + +interface TemplateStringsArray extends ReadonlyArray { + readonly raw: ReadonlyArray; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare const Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare const Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): this; +} + +interface RegExpConstructor { + new (pattern: RegExp | string): RegExp; + new (pattern: string, flags?: string): RegExp; + (pattern: RegExp | string): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare const RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare const Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare const EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare const RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare const ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare const SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare const TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare const URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare const JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat>(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[][]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | T[])[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean): boolean; + every(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: Z): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean): boolean; + some(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => boolean, thisArg: Z): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => void): void; + forEach(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => void, thisArg: Z): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => U): U[]; + map(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => U, thisArg: undefined): U[]; + map(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => U, thisArg: Z): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => value is S): S[]; + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => value is S, thisArg: undefined): S[]; + filter(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => value is S, thisArg: Z): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => any): T[]; + filter(callbackfn: (this: void, value: T, index: number, array: ReadonlyArray) => any, thisArg: undefined): T[]; + filter(callbackfn: (this: Z, value: T, index: number, array: ReadonlyArray) => any, thisArg: Z): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T | undefined; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[][]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | T[])[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T | undefined; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + */ + splice(start: number, deleteCount?: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean): boolean; + every(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: T, index: number, array: T[]) => boolean, thisArg: Z): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean): boolean; + some(callbackfn: (this: void, value: T, index: number, array: T[]) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: T, index: number, array: T[]) => boolean, thisArg: Z): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: T, index: number, array: T[]) => void): void; + forEach(callbackfn: (this: void, value: T, index: number, array: T[]) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: T, index: number, array: T[]) => void, thisArg: Z): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U, U, U]; + map(this: [T, T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U, U, U]; + map(this: [T, T, T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U, U]; + map(this: [T, T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U, U]; + map(this: [T, T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U, U]; + map(this: [T, T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U, U]; + map(this: [T, T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(this: [T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U): [U, U]; + map(this: [T, T], callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): [U, U]; + map(this: [T, T], callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): [U, U]; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: T, index: number, array: T[]) => U): U[]; + map(callbackfn: (this: void, value: T, index: number, array: T[]) => U, thisArg: undefined): U[]; + map(callbackfn: (this: Z, value: T, index: number, array: T[]) => U, thisArg: Z): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => any): T[]; + filter(callbackfn: (this: void, value: T, index: number, array: T[]) => any, thisArg: undefined): T[]; + filter(callbackfn: (this: Z, value: T, index: number, array: T[]) => any, thisArg: Z): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + readonly prototype: Array; +} + +declare const Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +} + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} + +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; + +/** + * From T pick a set of properties K + */ +type Pick = { + [P in K]: T[P]; +}; + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +}; + +/** + * Marker for contextual 'this' type + */ +interface ThisType { } + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare const ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare const DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int8Array) => any): Int8Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int8Array) => any, thisArg: undefined): Int8Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => any, thisArg: Z): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int8Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int8Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int8Array) => number): Int8Array; + map(callbackfn: (this: void, value: number, index: number, array: Int8Array) => number, thisArg: undefined): Int8Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => number, thisArg: Z): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int8Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int8Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int8Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int8Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int8Array; + + from(arrayLike: ArrayLike): Int8Array; + +} +declare const Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => any): Uint8Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => any, thisArg: undefined): Uint8Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => any, thisArg: Z): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => number): Uint8Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => number, thisArg: undefined): Uint8Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => number, thisArg: Z): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint8Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint8Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint8Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8Array; + + from(arrayLike: ArrayLike): Uint8Array; + +} +declare const Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => any): Uint8ClampedArray; + filter(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => any, thisArg: undefined): Uint8ClampedArray; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => any, thisArg: Z): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => number): Uint8ClampedArray; + map(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => number, thisArg: undefined): Uint8ClampedArray; + map(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => number, thisArg: Z): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint8ClampedArray; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8ClampedArray; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8ClampedArray; + + from(arrayLike: ArrayLike): Uint8ClampedArray; +} +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int16Array) => any): Int16Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int16Array) => any, thisArg: undefined): Int16Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => any, thisArg: Z): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int16Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int16Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int16Array) => number): Int16Array; + map(callbackfn: (this: void, value: number, index: number, array: Int16Array) => number, thisArg: undefined): Int16Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => number, thisArg: Z): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int16Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int16Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int16Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int16Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int16Array; + + from(arrayLike: ArrayLike): Int16Array; + +} +declare const Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => any): Uint16Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => any, thisArg: undefined): Uint16Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => any, thisArg: Z): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => number): Uint16Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => number, thisArg: undefined): Uint16Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => number, thisArg: Z): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint16Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint16Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint16Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint16Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint16Array; + + from(arrayLike: ArrayLike): Uint16Array; + +} +declare const Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Int32Array) => any): Int32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Int32Array) => any, thisArg: undefined): Int32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => any, thisArg: Z): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Int32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Int32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Int32Array) => number): Int32Array; + map(callbackfn: (this: void, value: number, index: number, array: Int32Array) => number, thisArg: undefined): Int32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => number, thisArg: Z): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Int32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Int32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Int32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int32Array; + + from(arrayLike: ArrayLike): Int32Array; +} +declare const Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => any): Uint32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => any, thisArg: undefined): Uint32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => any, thisArg: Z): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => number): Uint32Array; + map(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => number, thisArg: undefined): Uint32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => number, thisArg: Z): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Uint32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Uint32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Uint32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint32Array; + + from(arrayLike: ArrayLike): Uint32Array; +} +declare const Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Float32Array) => any): Float32Array; + filter(callbackfn: (this: void, value: number, index: number, array: Float32Array) => any, thisArg: undefined): Float32Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => any, thisArg: Z): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Float32Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Float32Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Float32Array) => number): Float32Array; + map(callbackfn: (this: void, value: number, index: number, array: Float32Array) => number, thisArg: undefined): Float32Array; + map(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => number, thisArg: Z): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Float32Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Float32Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Float32Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float32Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float32Array; + + from(arrayLike: ArrayLike): Float32Array; + +} +declare const Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean): boolean; + every(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean, thisArg: undefined): boolean; + every(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => boolean, thisArg: Z): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (this: void, value: number, index: number, array: Float64Array) => any): Float64Array; + filter(callbackfn: (this: void, value: number, index: number, array: Float64Array) => any, thisArg: undefined): Float64Array; + filter(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => any, thisArg: Z): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number | undefined; + find(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number | undefined; + find(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: number, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: number, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (this: void, value: number, index: number, array: Float64Array) => void): void; + forEach(callbackfn: (this: void, value: number, index: number, array: Float64Array) => void, thisArg: undefined): void; + forEach(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => void, thisArg: Z): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (this: void, value: number, index: number, array: Float64Array) => number): Float64Array; + map(callbackfn: (this: void, value: number, index: number, array: Float64Array) => number, thisArg: undefined): Float64Array; + map(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => number, thisArg: Z): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean): boolean; + some(callbackfn: (this: void, value: number, index: number, array: Float64Array) => boolean, thisArg: undefined): boolean; + some(callbackfn: (this: Z, value: number, index: number, array: Float64Array) => boolean, thisArg: Z): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number): Float64Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float64Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float64Array; + + from(arrayLike: ArrayLike): Float64Array; +} +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare namespace Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + }; + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + }; + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; + }; +} + +interface String { + /** + * Determines whether two strings are equivalent in the current or specified locale. + * @param that String to compare to target string + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} + + +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: T, index: number, obj: Array) => boolean): T | undefined; + find(predicate: (this: void, value: T, index: number, obj: Array) => boolean, thisArg: undefined): T | undefined; + find(predicate: (this: Z, value: T, index: number, obj: Array) => boolean, thisArg: Z): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: T, index: number, obj: Array) => boolean, thisArg: Z): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): this; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (this: void, v: T, k: number) => U): Array; + from(arrayLike: ArrayLike, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array; + from(arrayLike: ArrayLike, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array; + + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface DateConstructor { + new (value: Date): Date; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: object, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: object | null): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface ReadonlyArray { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray) => boolean): T | undefined; + find(predicate: (this: void, value: T, index: number, obj: ReadonlyArray) => boolean, thisArg: undefined): T | undefined; + find(predicate: (this: Z, value: T, index: number, obj: ReadonlyArray) => boolean, thisArg: Z): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean): number; + findIndex(predicate: (this: void, value: T, index: number, obj: Array) => boolean, thisArg: undefined): number; + findIndex(predicate: (this: Z, value: T, index: number, obj: Array) => boolean, thisArg: Z): number; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface RegExpConstructor { + new (pattern: RegExp, flags?: string): RegExp; + (pattern: RegExp, flags?: string): RegExp; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string; + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value: V): this; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (entries?: [K, V][]): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface ReadonlyMap { + forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + readonly size: number; +} + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value: V): this; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (entries?: [K, V][]): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface SetConstructor { + new (): Set; + new (values?: T[]): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface ReadonlySet { + forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface WeakSet { + add(value: T): this; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (values?: T[]): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + + +interface Generator extends Iterator { } + +interface GeneratorFunction { + /** + * Creates a new Generator object. + * @param args A list of arguments the function accepts. + */ + new (...args: any[]): Generator; + /** + * Creates a new Generator object. + * @param args A list of arguments the function accepts. + */ + (...args: any[]): Generator; + /** + * The length of the arguments. + */ + readonly length: number; + /** + * Returns the name of the function. + */ + readonly name: string; + /** + * A reference to the prototype. + */ + readonly prototype: Generator; +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + (...args: string[]): GeneratorFunction; + /** + * The length of the arguments. + */ + readonly length: number; + /** + * Returns the name of the function. + */ + readonly name: string; + /** + * A reference to the prototype. + */ + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + + +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (this: void, v: T, k: number) => U): Array; + from(iterable: Iterable, mapfn: (this: void, v: T, k: number) => U, thisArg: undefined): Array; + from(iterable: Iterable, mapfn: (this: Z, v: T, k: number) => U, thisArg: Z): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface ReadonlyArray { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + [Symbol.iterator](): IterableIterator<[K, V]>; + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + [Symbol.iterator](): IterableIterator; + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: object): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Int8Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int8Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int8Array; + + from(arrayLike: Iterable): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint8Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8Array; + + from(arrayLike: Iterable): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint8ClampedArray; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint8ClampedArray; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint8ClampedArray; + + from(arrayLike: Iterable): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Int16Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int16Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int16Array; + + from(arrayLike: Iterable): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint16Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint16Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint16Array; + + from(arrayLike: Iterable): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Int32Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Int32Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Int32Array; + + from(arrayLike: Iterable): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Uint32Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Uint32Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Uint32Array; + + from(arrayLike: Iterable): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Float32Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float32Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float32Array; + + from(arrayLike: Iterable): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number): Float64Array; + from(arrayLike: Iterable, mapfn: (this: void, v: number, k: number) => number, thisArg: undefined): Float64Array; + from(arrayLike: Iterable, mapfn: (this: Z, v: number, k: number) => number, thisArg: Z): Float64Array; + + from(arrayLike: Iterable): Float64Array; +} + + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + declare var Promise: PromiseConstructor; -interface ProxyHandler { - getPrototypeOf? (target: T): {} | null; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, argArray: any, newTarget?: any): {}; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string | undefined; -} - -declare var Symbol: SymbolConstructor; +interface ProxyHandler { + getPrototypeOf? (target: T): object | null; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, argArray: any, newTarget?: any): object; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T; +} +declare var Proxy: ProxyConstructor; + + +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: object, propertyKey: PropertyKey): boolean; + function get(target: object, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: object): object; + function has(target: object, propertyKey: PropertyKey): boolean; + function isExtensible(target: object): boolean; + function ownKeys(target: object): Array; + function preventExtensions(target: object): boolean; + function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: object, proto: any): boolean; +} + + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): symbol; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string | number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor; + +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; +} + + + +///////////////////////////// +/// IE DOM APIs +///////////////////////////// + +interface Account { + rpDisplayName?: string; + displayName?: string; + id?: string; + name?: string; + imageURL?: string; +} + +interface Algorithm { + name: string; +} + +interface AnimationEventInit extends EventInit { + animationName?: string; + elapsedTime?: number; +} + +interface AssertionOptions { + timeoutSeconds?: number; + rpId?: USVString; + allowList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; +} + +interface CacheQueryOptions { + ignoreSearch?: boolean; + ignoreMethod?: boolean; + ignoreVary?: boolean; + cacheName?: string; +} + +interface ClientData { + challenge?: string; + origin?: string; + rpId?: string; + hashAlg?: string | Algorithm; + tokenBinding?: string; + extensions?: WebAuthnExtensions; +} + +interface CloseEventInit extends EventInit { + wasClean?: boolean; + code?: number; + reason?: string; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: VideoFacingModeEnum | VideoFacingModeEnum[]; + ideal?: VideoFacingModeEnum | VideoFacingModeEnum[]; +} + +interface CustomEventInit extends EventInit { + detail?: any; +} + +interface DOMRectInit { + x?: any; + y?: any; + width?: any; + height?: any; +} + +interface DeviceAccelerationDict { + x?: number; + y?: number; + z?: number; +} + +interface DeviceLightEventInit extends EventInit { + value?: number; +} + +interface DeviceMotionEventInit extends EventInit { + acceleration?: DeviceAccelerationDict; + accelerationIncludingGravity?: DeviceAccelerationDict; + rotationRate?: DeviceRotationRateDict; + interval?: number; +} + +interface DeviceOrientationEventInit extends EventInit { + alpha?: number; + beta?: number; + gamma?: number; + absolute?: boolean; +} + +interface DeviceRotationRateDict { + alpha?: number; + beta?: number; + gamma?: number; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface ErrorEventInit extends EventInit { + message?: string; + filename?: string; + lineno?: number; + colno?: number; + error?: any; +} + +interface EventInit { + scoped?: boolean; + bubbles?: boolean; + cancelable?: boolean; +} + +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + +interface ExceptionInformation { + domain?: string; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget; +} + +interface FocusNavigationEventInit extends EventInit { + navigationReason?: string; + originLeft?: number; + originTop?: number; + originWidth?: number; + originHeight?: number; +} + +interface FocusNavigationOrigin { + originLeft?: number; + originTop?: number; + originWidth?: number; + originHeight?: number; +} + +interface GamepadEventInit extends EventInit { + gamepad?: Gamepad; +} + +interface GetNotificationOptions { + tag?: string; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface IntersectionObserverEntryInit { + time?: number; + rootBounds?: DOMRectInit; + boundingClientRect?: DOMRectInit; + intersectionRect?: DOMRectInit; + target?: Element; +} + +interface IntersectionObserverInit { + root?: Element; + rootMargin?: string; + threshold?: number | number[]; +} + +interface KeyAlgorithm { + name?: string; +} + +interface KeyboardEventInit extends EventModifierInit { + code?: string; + key?: string; + location?: number; + repeat?: boolean; +} + +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: MSIceType; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: MSCredentialType; +} + +interface MSCredentialSpec { + type?: MSCredentialType; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: RTCIceProtocol; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSPortRange { + min?: number; + max?: number; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: RTCIceProtocol; + localInterface?: MSNetworkInterfaceType; + localAddrType?: MSIceAddrType; + remoteAddrType?: MSIceAddrType; + iceRole?: RTCIceRole; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resolution?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: MediaKeyMessageType; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: MediaKeysRequirement; + persistentState?: MediaKeysRequirement; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamEventInit extends EventInit { + stream?: MediaStream; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MessageEventInit extends EventInit { + lastEventId?: string; + channel?: string; + data?: any; + origin?: string; + source?: Window; + ports?: MessagePort[]; +} + +interface MouseEventInit extends EventModifierInit { + screenX?: number; + screenY?: number; + clientX?: number; + clientY?: number; + button?: number; + buttons?: number; + relatedTarget?: EventTarget; +} + +interface MsZoomToOptions { + contentX?: number; + contentY?: number; + viewportX?: string; + viewportY?: string; + scaleFactor?: number; + animate?: string; +} + +interface MutationObserverInit { + childList?: boolean; + attributes?: boolean; + characterData?: boolean; + subtree?: boolean; + attributeOldValue?: boolean; + characterDataOldValue?: boolean; + attributeFilter?: string[]; +} + +interface NotificationOptions { + dir?: NotificationDirection; + lang?: string; + body?: string; + tag?: string; + icon?: string; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface PaymentCurrencyAmount { + currency?: string; + value?: string; + currencySystem?: string; +} + +interface PaymentDetails { + total?: PaymentItem; + displayItems?: PaymentItem[]; + shippingOptions?: PaymentShippingOption[]; + modifiers?: PaymentDetailsModifier[]; + error?: string; +} + +interface PaymentDetailsModifier { + supportedMethods?: string[]; + total?: PaymentItem; + additionalDisplayItems?: PaymentItem[]; + data?: any; +} + +interface PaymentItem { + label?: string; + amount?: PaymentCurrencyAmount; + pending?: boolean; +} + +interface PaymentMethodData { + supportedMethods?: string[]; + data?: any; +} + +interface PaymentOptions { + requestPayerName?: boolean; + requestPayerEmail?: boolean; + requestPayerPhone?: boolean; + requestShipping?: boolean; + shippingType?: string; +} + +interface PaymentRequestUpdateEventInit extends EventInit { +} + +interface PaymentShippingOption { + id?: string; + label?: string; + amount?: PaymentCurrencyAmount; + selected?: boolean; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PointerEventInit extends MouseEventInit { + pointerId?: number; + width?: number; + height?: number; + pressure?: number; + tiltX?: number; + tiltY?: number; + pointerType?: string; + isPrimary?: boolean; +} + +interface PopStateEventInit extends EventInit { + state?: any; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface PushSubscriptionOptionsInit { + userVisibleOnly?: boolean; + applicationServerKey?: any; +} + +interface RTCConfiguration { + iceServers?: RTCIceServer[]; + iceTransportPolicy?: RTCIceTransportPolicy; + bundlePolicy?: RTCBundlePolicy; + peerIdentity?: string; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: RTCDtlsRole; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: RTCStatsIceCandidateType; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidateDictionary { + foundation?: string; + priority?: number; + ip?: string; + protocol?: RTCIceProtocol; + port?: number; + type?: RTCIceCandidateType; + tcpType?: RTCIceTcpCandidateType; + relatedAddress?: string; + relatedPort?: number; + msMTurnSessionId?: string; +} + +interface RTCIceCandidateInit { + candidate?: string; + sdpMid?: string; + sdpMLineIndex?: number; +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidateDictionary; + remote?: RTCIceCandidateDictionary; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: RTCStatsIceCandidatePairState; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: RTCIceGatherPolicy; + iceservers?: RTCIceServer[]; + portRange?: MSPortRange; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; + iceLite?: boolean; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOfferOptions { + offerToReceiveVideo?: number; + offerToReceiveAudio?: number; + voiceActivityDetection?: boolean; + iceRestart?: boolean; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCPeerConnectionIceEventInit extends EventInit { + candidate?: RTCIceCandidate; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + ptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + ptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + resolutionScale?: number; + framerateScale?: number; + maxFramerate?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; + degradationPreference?: RTCDegradationPreference; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSessionDescriptionInit { + type?: RTCSdpType; + sdp?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: RTCStatsType; + id?: string; + msType?: MSStatsType; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; +} + +interface RegistrationOptions { + scope?: string; +} + +interface RequestInit { + method?: string; + headers?: any; + body?: any; + referrer?: string; + referrerPolicy?: ReferrerPolicy; + mode?: RequestMode; + credentials?: RequestCredentials; + cache?: RequestCache; + redirect?: RequestRedirect; + integrity?: string; + keepalive?: boolean; + window?: any; +} + +interface ResponseInit { + status?: number; + statusText?: string; + headers?: any; +} + +interface ScopedCredentialDescriptor { + type?: ScopedCredentialType; + id?: any; + transports?: Transport[]; +} + +interface ScopedCredentialOptions { + timeoutSeconds?: number; + rpId?: USVString; + excludeList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; +} + +interface ScopedCredentialParameters { + type?: ScopedCredentialType; + algorithm?: string | Algorithm; +} + +interface ServiceWorkerMessageEventInit extends EventInit { + data?: any; + origin?: string; + lastEventId?: string; + source?: ServiceWorker | MessagePort; + ports?: MessagePort[]; +} + +interface SpeechSynthesisEventInit extends EventInit { + utterance?: SpeechSynthesisUtterance; + charIndex?: number; + elapsedTime?: number; + name?: string; +} + +interface StoreExceptionsInformation extends ExceptionInformation { + siteName?: string; + explanationString?: string; + detailURI?: string; +} + +interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +interface TrackEventInit extends EventInit { + track?: VideoTrack | AudioTrack | TextTrack; +} + +interface TransitionEventInit extends EventInit { + propertyName?: string; + elapsedTime?: number; +} + +interface UIEventInit extends EventInit { + view?: Window; + detail?: number; +} + +interface WebAuthnExtensions { +} + +interface WebGLContextAttributes { + failIfMajorPerformanceCaveat?: boolean; + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WheelEventInit extends MouseEventInit { + deltaX?: number; + deltaY?: number; + deltaZ?: number; + deltaMode?: number; +} + +interface EventListener { + (evt: Event): void; +} + +interface WebKitEntriesCallback { + (evt: Event): void; +} + +interface WebKitErrorCallback { + (evt: Event): void; +} + +interface WebKitFileCallback { + (evt: Event): void; +} + +interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; + drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; + vertexAttribDivisorANGLE(index: number, divisor: number): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +declare var ANGLE_instanced_arrays: { + prototype: ANGLE_instanced_arrays; + new(): ANGLE_instanced_arrays; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; +} + +interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(): AnalyserNode; +} + +interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(typeArg: string, eventInitDict?: AnimationEventInit): AnimationEvent; +} + +interface ApplicationCacheEventMap { + "cached": Event; + "checking": Event; + "downloading": Event; + "error": Event; + "noupdate": Event; + "obsolete": Event; + "progress": ProgressEvent; + "updateready": Event; +} + +interface ApplicationCache extends EventTarget { + oncached: (this: ApplicationCache, ev: Event) => any; + onchecking: (this: ApplicationCache, ev: Event) => any; + ondownloading: (this: ApplicationCache, ev: Event) => any; + onerror: (this: ApplicationCache, ev: Event) => any; + onnoupdate: (this: ApplicationCache, ev: Event) => any; + onobsolete: (this: ApplicationCache, ev: Event) => any; + onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; + onupdateready: (this: ApplicationCache, ev: Event) => any; + readonly status: number; + abort(): void; + swapCache(): void; + update(): void; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; + addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ApplicationCache: { + prototype: ApplicationCache; + new(): ApplicationCache; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; +} + +interface Attr extends Node { + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface AudioBufferSourceNodeEventMap { + "ended": MediaStreamErrorEvent; +} + +interface AudioBufferSourceNode extends AudioNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(): AudioBufferSourceNode; +} + +interface AudioContextEventMap { + "statechange": Event; +} + +interface AudioContextBase extends EventTarget { + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + onstatechange: (this: AudioContext, ev: Event) => any; + readonly sampleRate: number; + readonly state: AudioContextState; + close(): Promise; + createAnalyser(): AnalyserNode; + createBiquadFilter(): BiquadFilterNode; + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + createBufferSource(): AudioBufferSourceNode; + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + createConvolver(): ConvolverNode; + createDelay(maxDelayTime?: number): DelayNode; + createDynamicsCompressor(): DynamicsCompressorNode; + createGain(): GainNode; + createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + createOscillator(): OscillatorNode; + createPanner(): PannerNode; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createStereoPanner(): StereoPannerNode; + createWaveShaper(): WaveShaperNode; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): Promise; + resume(): Promise; + addEventListener(type: K, listener: (this: AudioContext, ev: AudioContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface AudioContext extends AudioContextBase { + suspend(): Promise; +} + +declare var AudioContext: { + prototype: AudioContext; + new(): AudioContext; +} + +interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +} + +interface AudioListener { + dopplerFactor: number; + speedOfSound: number; + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +} + +interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: ChannelCountMode; + channelInterpretation: ChannelInterpretation; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destination: AudioNode, output?: number, input?: number): AudioNode; + connect(destination: AudioParam, output?: number): void; + disconnect(output?: number): void; + disconnect(destination: AudioNode, output?: number, input?: number): void; + disconnect(destination: AudioParam, output?: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +} + +interface AudioParam { + readonly defaultValue: number; + value: number; + cancelScheduledValues(startTime: number): AudioParam; + exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; + linearRampToValueAtTime(value: number, endTime: number): AudioParam; + setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; + setValueAtTime(value: number, startTime: number): AudioParam; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): AudioParam; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +} + +interface AudioProcessingEvent extends Event { + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; +} + +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(): AudioProcessingEvent; +} + +interface AudioTrack { + enabled: boolean; + readonly id: string; + kind: string; + readonly label: string; + language: string; + readonly sourceBuffer: SourceBuffer; +} + +declare var AudioTrack: { + prototype: AudioTrack; + new(): AudioTrack; +} + +interface AudioTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + +interface AudioTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; + onchange: (this: AudioTrackList, ev: Event) => any; + onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; + getTrackById(id: string): AudioTrack | null; + item(index: number): AudioTrack; + addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: AudioTrack; +} + +declare var AudioTrackList: { + prototype: AudioTrackList; + new(): AudioTrackList; +} + +interface BarProp { + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +} + +interface BeforeUnloadEvent extends Event { + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +} + +interface BiquadFilterNode extends AudioNode { + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; + type: BiquadFilterType; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(): BiquadFilterNode; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +} + +interface CSS { + supports(property: string, value?: string): boolean; +} +declare var CSS: CSS; + +interface CSSConditionRule extends CSSGroupingRule { + conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +} + +interface CSSFontFaceRule extends CSSRule { + readonly style: CSSStyleDeclaration; +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +} + +interface CSSGroupingRule extends CSSRule { + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +} + +interface CSSImportRule extends CSSRule { + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +} + +interface CSSKeyframeRule extends CSSRule { + keyText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +} + +interface CSSKeyframesRule extends CSSRule { + readonly cssRules: CSSRuleList; + name: string; + appendRule(rule: string): void; + deleteRule(rule: string): void; + findRule(rule: string): CSSKeyframeRule; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +} + +interface CSSMediaRule extends CSSConditionRule { + readonly media: MediaList; +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +} + +interface CSSNamespaceRule extends CSSRule { + readonly namespaceURI: string; + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +} + +interface CSSPageRule extends CSSRule { + readonly pseudoClass: string; + readonly selector: string; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +} + +interface CSSRule { + cssText: string; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; +} + +interface CSSRuleList { + readonly length: number; + item(index: number): CSSRule; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +} + +interface CSSStyleDeclaration { + alignContent: string | null; + alignItems: string | null; + alignSelf: string | null; + alignmentBaseline: string | null; + animation: string | null; + animationDelay: string | null; + animationDirection: string | null; + animationDuration: string | null; + animationFillMode: string | null; + animationIterationCount: string | null; + animationName: string | null; + animationPlayState: string | null; + animationTimingFunction: string | null; + backfaceVisibility: string | null; + background: string | null; + backgroundAttachment: string | null; + backgroundClip: string | null; + backgroundColor: string | null; + backgroundImage: string | null; + backgroundOrigin: string | null; + backgroundPosition: string | null; + backgroundPositionX: string | null; + backgroundPositionY: string | null; + backgroundRepeat: string | null; + backgroundSize: string | null; + baselineShift: string | null; + border: string | null; + borderBottom: string | null; + borderBottomColor: string | null; + borderBottomLeftRadius: string | null; + borderBottomRightRadius: string | null; + borderBottomStyle: string | null; + borderBottomWidth: string | null; + borderCollapse: string | null; + borderColor: string | null; + borderImage: string | null; + borderImageOutset: string | null; + borderImageRepeat: string | null; + borderImageSlice: string | null; + borderImageSource: string | null; + borderImageWidth: string | null; + borderLeft: string | null; + borderLeftColor: string | null; + borderLeftStyle: string | null; + borderLeftWidth: string | null; + borderRadius: string | null; + borderRight: string | null; + borderRightColor: string | null; + borderRightStyle: string | null; + borderRightWidth: string | null; + borderSpacing: string | null; + borderStyle: string | null; + borderTop: string | null; + borderTopColor: string | null; + borderTopLeftRadius: string | null; + borderTopRightRadius: string | null; + borderTopStyle: string | null; + borderTopWidth: string | null; + borderWidth: string | null; + bottom: string | null; + boxShadow: string | null; + boxSizing: string | null; + breakAfter: string | null; + breakBefore: string | null; + breakInside: string | null; + captionSide: string | null; + clear: string | null; + clip: string | null; + clipPath: string | null; + clipRule: string | null; + color: string | null; + colorInterpolationFilters: string | null; + columnCount: any; + columnFill: string | null; + columnGap: any; + columnRule: string | null; + columnRuleColor: any; + columnRuleStyle: string | null; + columnRuleWidth: any; + columnSpan: string | null; + columnWidth: any; + columns: string | null; + content: string | null; + counterIncrement: string | null; + counterReset: string | null; + cssFloat: string | null; + cssText: string; + cursor: string | null; + direction: string | null; + display: string | null; + dominantBaseline: string | null; + emptyCells: string | null; + enableBackground: string | null; + fill: string | null; + fillOpacity: string | null; + fillRule: string | null; + filter: string | null; + flex: string | null; + flexBasis: string | null; + flexDirection: string | null; + flexFlow: string | null; + flexGrow: string | null; + flexShrink: string | null; + flexWrap: string | null; + floodColor: string | null; + floodOpacity: string | null; + font: string | null; + fontFamily: string | null; + fontFeatureSettings: string | null; + fontSize: string | null; + fontSizeAdjust: string | null; + fontStretch: string | null; + fontStyle: string | null; + fontVariant: string | null; + fontWeight: string | null; + glyphOrientationHorizontal: string | null; + glyphOrientationVertical: string | null; + height: string | null; + imeMode: string | null; + justifyContent: string | null; + kerning: string | null; + layoutGrid: string | null; + layoutGridChar: string | null; + layoutGridLine: string | null; + layoutGridMode: string | null; + layoutGridType: string | null; + left: string | null; + readonly length: number; + letterSpacing: string | null; + lightingColor: string | null; + lineBreak: string | null; + lineHeight: string | null; + listStyle: string | null; + listStyleImage: string | null; + listStylePosition: string | null; + listStyleType: string | null; + margin: string | null; + marginBottom: string | null; + marginLeft: string | null; + marginRight: string | null; + marginTop: string | null; + marker: string | null; + markerEnd: string | null; + markerMid: string | null; + markerStart: string | null; + mask: string | null; + maxHeight: string | null; + maxWidth: string | null; + minHeight: string | null; + minWidth: string | null; + msContentZoomChaining: string | null; + msContentZoomLimit: string | null; + msContentZoomLimitMax: any; + msContentZoomLimitMin: any; + msContentZoomSnap: string | null; + msContentZoomSnapPoints: string | null; + msContentZoomSnapType: string | null; + msContentZooming: string | null; + msFlowFrom: string | null; + msFlowInto: string | null; + msFontFeatureSettings: string | null; + msGridColumn: any; + msGridColumnAlign: string | null; + msGridColumnSpan: any; + msGridColumns: string | null; + msGridRow: any; + msGridRowAlign: string | null; + msGridRowSpan: any; + msGridRows: string | null; + msHighContrastAdjust: string | null; + msHyphenateLimitChars: string | null; + msHyphenateLimitLines: any; + msHyphenateLimitZone: any; + msHyphens: string | null; + msImeAlign: string | null; + msOverflowStyle: string | null; + msScrollChaining: string | null; + msScrollLimit: string | null; + msScrollLimitXMax: any; + msScrollLimitXMin: any; + msScrollLimitYMax: any; + msScrollLimitYMin: any; + msScrollRails: string | null; + msScrollSnapPointsX: string | null; + msScrollSnapPointsY: string | null; + msScrollSnapType: string | null; + msScrollSnapX: string | null; + msScrollSnapY: string | null; + msScrollTranslation: string | null; + msTextCombineHorizontal: string | null; + msTextSizeAdjust: any; + msTouchAction: string | null; + msTouchSelect: string | null; + msUserSelect: string | null; + msWrapFlow: string; + msWrapMargin: any; + msWrapThrough: string; + opacity: string | null; + order: string | null; + orphans: string | null; + outline: string | null; + outlineColor: string | null; + outlineOffset: string | null; + outlineStyle: string | null; + outlineWidth: string | null; + overflow: string | null; + overflowX: string | null; + overflowY: string | null; + padding: string | null; + paddingBottom: string | null; + paddingLeft: string | null; + paddingRight: string | null; + paddingTop: string | null; + pageBreakAfter: string | null; + pageBreakBefore: string | null; + pageBreakInside: string | null; + readonly parentRule: CSSRule; + perspective: string | null; + perspectiveOrigin: string | null; + pointerEvents: string | null; + position: string | null; + quotes: string | null; + right: string | null; + rotate: string | null; + rubyAlign: string | null; + rubyOverhang: string | null; + rubyPosition: string | null; + scale: string | null; + stopColor: string | null; + stopOpacity: string | null; + stroke: string | null; + strokeDasharray: string | null; + strokeDashoffset: string | null; + strokeLinecap: string | null; + strokeLinejoin: string | null; + strokeMiterlimit: string | null; + strokeOpacity: string | null; + strokeWidth: string | null; + tableLayout: string | null; + textAlign: string | null; + textAlignLast: string | null; + textAnchor: string | null; + textDecoration: string | null; + textIndent: string | null; + textJustify: string | null; + textKashida: string | null; + textKashidaSpace: string | null; + textOverflow: string | null; + textShadow: string | null; + textTransform: string | null; + textUnderlinePosition: string | null; + top: string | null; + touchAction: string | null; + transform: string | null; + transformOrigin: string | null; + transformStyle: string | null; + transition: string | null; + transitionDelay: string | null; + transitionDuration: string | null; + transitionProperty: string | null; + transitionTimingFunction: string | null; + translate: string | null; + unicodeBidi: string | null; + verticalAlign: string | null; + visibility: string | null; + webkitAlignContent: string | null; + webkitAlignItems: string | null; + webkitAlignSelf: string | null; + webkitAnimation: string | null; + webkitAnimationDelay: string | null; + webkitAnimationDirection: string | null; + webkitAnimationDuration: string | null; + webkitAnimationFillMode: string | null; + webkitAnimationIterationCount: string | null; + webkitAnimationName: string | null; + webkitAnimationPlayState: string | null; + webkitAnimationTimingFunction: string | null; + webkitAppearance: string | null; + webkitBackfaceVisibility: string | null; + webkitBackgroundClip: string | null; + webkitBackgroundOrigin: string | null; + webkitBackgroundSize: string | null; + webkitBorderBottomLeftRadius: string | null; + webkitBorderBottomRightRadius: string | null; + webkitBorderImage: string | null; + webkitBorderRadius: string | null; + webkitBorderTopLeftRadius: string | null; + webkitBorderTopRightRadius: string | null; + webkitBoxAlign: string | null; + webkitBoxDirection: string | null; + webkitBoxFlex: string | null; + webkitBoxOrdinalGroup: string | null; + webkitBoxOrient: string | null; + webkitBoxPack: string | null; + webkitBoxSizing: string | null; + webkitColumnBreakAfter: string | null; + webkitColumnBreakBefore: string | null; + webkitColumnBreakInside: string | null; + webkitColumnCount: any; + webkitColumnGap: any; + webkitColumnRule: string | null; + webkitColumnRuleColor: any; + webkitColumnRuleStyle: string | null; + webkitColumnRuleWidth: any; + webkitColumnSpan: string | null; + webkitColumnWidth: any; + webkitColumns: string | null; + webkitFilter: string | null; + webkitFlex: string | null; + webkitFlexBasis: string | null; + webkitFlexDirection: string | null; + webkitFlexFlow: string | null; + webkitFlexGrow: string | null; + webkitFlexShrink: string | null; + webkitFlexWrap: string | null; + webkitJustifyContent: string | null; + webkitOrder: string | null; + webkitPerspective: string | null; + webkitPerspectiveOrigin: string | null; + webkitTapHighlightColor: string | null; + webkitTextFillColor: string | null; + webkitTextSizeAdjust: any; + webkitTextStroke: string | null; + webkitTextStrokeColor: string | null; + webkitTextStrokeWidth: string | null; + webkitTransform: string | null; + webkitTransformOrigin: string | null; + webkitTransformStyle: string | null; + webkitTransition: string | null; + webkitTransitionDelay: string | null; + webkitTransitionDuration: string | null; + webkitTransitionProperty: string | null; + webkitTransitionTimingFunction: string | null; + webkitUserModify: string | null; + webkitUserSelect: string | null; + webkitWritingMode: string | null; + whiteSpace: string | null; + widows: string | null; + width: string | null; + wordBreak: string | null; + wordSpacing: string | null; + wordWrap: string | null; + writingMode: string | null; + zIndex: string | null; + zoom: string | null; + resize: string | null; + userSelect: string | null; + getPropertyPriority(propertyName: string): string; + getPropertyValue(propertyName: string): string; + item(index: number): string; + removeProperty(propertyName: string): string; + setProperty(propertyName: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +} + +interface CSSStyleRule extends CSSRule { + readonly readOnly: boolean; + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +} + +interface CSSStyleSheet extends StyleSheet { + readonly cssRules: CSSRuleList; + cssText: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; + addImport(bstrURL: string, lIndex?: number): number; + addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; + addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; + deleteRule(index?: number): void; + insertRule(rule: string, index?: number): number; + removeImport(lIndex: number): void; + removeRule(lIndex: number): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(): CSSStyleSheet; +} + +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +} + +interface Cache { + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; + keys(request?: RequestInfo, options?: CacheQueryOptions): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; + put(request: RequestInfo, response: Response): Promise; +} + +declare var Cache: { + prototype: Cache; + new(): Cache; +} + +interface CacheStorage { + delete(cacheName: string): Promise; + has(cacheName: string): Promise; + keys(): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; +} + +declare var CacheStorage: { + prototype: CacheStorage; + new(): CacheStorage; +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +} + +interface CanvasPattern { + setTransform(matrix: SVGMatrix): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +} + +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; + fillStyle: string | CanvasGradient | CanvasPattern; + font: string; + globalAlpha: number; + globalCompositeOperation: string; + imageSmoothingEnabled: boolean; + lineCap: string; + lineDashOffset: number; + lineJoin: string; + lineWidth: number; + miterLimit: number; + msFillRule: CanvasFillRule; + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; + strokeStyle: string | CanvasGradient | CanvasPattern; + textAlign: string; + textBaseline: string; + mozImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + beginPath(): void; + clearRect(x: number, y: number, w: number, h: number): void; + clip(fillRule?: CanvasFillRule): void; + createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; + drawFocusIfNeeded(element: Element): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, dstX: number, dstY: number, dstW: number, dstH: number): void; + drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, srcX: number, srcY: number, srcW: number, srcH: number, dstX: number, dstY: number, dstW: number, dstH: number): void; + fill(fillRule?: CanvasFillRule): void; + fillRect(x: number, y: number, w: number, h: number): void; + fillText(text: string, x: number, y: number, maxWidth?: number): void; + getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; + getLineDash(): number[]; + isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; + measureText(text: string): TextMetrics; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; + restore(): void; + rotate(angle: number): void; + save(): void; + scale(x: number, y: number): void; + setLineDash(segments: number[]): void; + setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + stroke(path?: Path2D): void; + strokeRect(x: number, y: number, w: number, h: number): void; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; + transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; + translate(x: number, y: number): void; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +} + +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(): ChannelMergerNode; +} + +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(): ChannelSplitterNode; +} + +interface CharacterData extends Node, ChildNode { + data: string; + readonly length: number; + appendData(arg: string): void; + deleteData(offset: number, count: number): void; + insertData(offset: number, arg: string): void; + replaceData(offset: number, count: number, arg: string): void; + substringData(offset: number, count: number): string; +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +} + +interface ClientRect { + bottom: number; + readonly height: number; + left: number; + right: number; + top: number; + readonly width: number; +} + +declare var ClientRect: { + prototype: ClientRect; + new(): ClientRect; +} + +interface ClientRectList { + readonly length: number; + item(index: number): ClientRect; + [index: number]: ClientRect; +} + +declare var ClientRectList: { + prototype: ClientRectList; + new(): ClientRectList; +} + +interface ClipboardEvent extends Event { + readonly clipboardData: DataTransfer; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(typeArg: string, eventInitDict?: CloseEventInit): CloseEvent; +} + +interface Comment extends CharacterData { + text: string; +} + +declare var Comment: { + prototype: Comment; + new(): Comment; +} + +interface CompositionEvent extends UIEvent { + readonly data: string; + readonly locale: string; + initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: any, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: Element): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: Element): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface ConvolverNode extends AudioNode { + buffer: AudioBuffer | null; + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(): ConvolverNode; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface Crypto extends Object, RandomSource { + readonly subtle: SubtleCrypto; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface CryptoKeyPair { + privateKey: CryptoKey; + publicKey: CryptoKey; +} + +declare var CryptoKeyPair: { + prototype: CryptoKeyPair; + new(): CryptoKeyPair; +} + +interface CustomEvent extends Event { + readonly detail: any; + initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMImplementation { + createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document; + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createHTMLDocument(title: string): Document; + hasFeature(feature: string | null, version: string | null): boolean; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +} + +interface DOMParser { + parseFromString(source: string, mimeType: string): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +} + +interface DOMSettableTokenList extends DOMTokenList { + value: string; +} + +declare var DOMSettableTokenList: { + prototype: DOMSettableTokenList; + new(): DOMSettableTokenList; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface DOMStringMap { + [name: string]: string | undefined; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +} + +interface DOMTokenList { + readonly length: number; + add(...token: string[]): void; + contains(token: string): boolean; + item(index: number): string; + remove(...token: string[]): void; + toString(): string; + toggle(token: string, force?: boolean): boolean; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +} + +interface DataCue extends TextTrackCue { + data: ArrayBuffer; + addEventListener(type: K, listener: (this: DataCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DataCue: { + prototype: DataCue; + new(): DataCue; +} + +interface DataTransfer { + dropEffect: string; + effectAllowed: string; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: string[]; + clearData(format?: string): boolean; + getData(format: string): string; + setData(format: string, data: string): boolean; + setDragImage(image: Element, x: number, y: number): void; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +} + +interface DataTransferItem { + readonly kind: string; + readonly type: string; + getAsFile(): File | null; + getAsString(_callback: FunctionStringCallback | null): void; + webkitGetAsEntry(): any; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +} + +interface DataTransferItemList { + readonly length: number; + add(data: File): DataTransferItem | null; + clear(): void; + item(index: number): DataTransferItem; + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +} + +interface DeferredPermissionRequest { + readonly id: number; + readonly type: MSWebViewPermissionType; + readonly uri: string; + allow(): void; + deny(): void; +} + +declare var DeferredPermissionRequest: { + prototype: DeferredPermissionRequest; + new(): DeferredPermissionRequest; +} + +interface DelayNode extends AudioNode { + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(): DelayNode; +} + +interface DeviceAcceleration { + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; +} + +declare var DeviceAcceleration: { + prototype: DeviceAcceleration; + new(): DeviceAcceleration; +} + +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(typeArg: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + +interface DeviceMotionEvent extends Event { + readonly acceleration: DeviceAcceleration | null; + readonly accelerationIncludingGravity: DeviceAcceleration | null; + readonly interval: number | null; + readonly rotationRate: DeviceRotationRate | null; + initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(typeArg: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; +} + +interface DeviceOrientationEvent extends Event { + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; + initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(typeArg: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent; +} + +interface DeviceRotationRate { + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +declare var DeviceRotationRate: { + prototype: DeviceRotationRate; + new(): DeviceRotationRate; +} + +interface DocumentEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforedeactivate": UIEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "fullscreenchange": Event; + "fullscreenerror": Event; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "mssitemodejumplistitemremoved": MSSiteModeEvent; + "msthumbnailclick": MSSiteModeEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectionchange": Event; + "selectstart": Event; + "stalled": Event; + "stop": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "volumechange": Event; + "waiting": Event; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { + /** + * Sets or gets the URL for the current document. + */ + readonly URL: string; + /** + * Gets the URL for the document, stripped of any character encoding. + */ + readonly URLUnencoded: string; + /** + * Gets the object that has the focus when the parent document has focus. + */ + readonly activeElement: Element; + /** + * Sets or gets the color of all active links in the document. + */ + alinkColor: string; + /** + * Returns a reference to the collection of elements contained by the object. + */ + readonly all: HTMLAllCollection; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + */ + anchors: HTMLCollectionOf; + /** + * Retrieves a collection of all applet objects in the document. + */ + applets: HTMLCollectionOf; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + */ + bgColor: string; + /** + * Specifies the beginning and end of the document body. + */ + body: HTMLElement; + readonly characterSet: string; + /** + * Gets or sets the character set used to encode the object. + */ + charset: string; + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + */ + readonly compatMode: string; + cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; + readonly defaultView: Window; + /** + * Sets or gets a value that indicates whether the document can be edited. + */ + designMode: string; + /** + * Sets or retrieves a value that indicates the reading order of the object. + */ + dir: string; + /** + * Gets an object representing the document type declaration associated with the current document. + */ + readonly doctype: DocumentType; + /** + * Gets a reference to the root node of the document. + */ + documentElement: HTMLElement; + /** + * Sets or gets the security domain of the document. + */ + domain: string; + /** + * Retrieves a collection of all embed objects in the document. + */ + embeds: HTMLCollectionOf; + /** + * Sets or gets the foreground (text) color of the document. + */ + fgColor: string; + /** + * Retrieves a collection, in source order, of all form objects in the document. + */ + forms: HTMLCollectionOf; + readonly fullscreenElement: Element | null; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; + /** + * Retrieves a collection, in source order, of img objects in the document. + */ + images: HTMLCollectionOf; + /** + * Gets the implementation object of the current document. + */ + readonly implementation: DOMImplementation; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + */ + readonly inputEncoding: string | null; + /** + * Gets the date that the page was last modified, if the page supplies one. + */ + readonly lastModified: string; + /** + * Sets or gets the color of the document links. + */ + linkColor: string; + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + */ + links: HTMLCollectionOf; + /** + * Contains information about the current URL. + */ + readonly location: Location; + msCSSOMElementFloatMetrics: boolean; + msCapsLockWarningOff: boolean; + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: (this: Document, ev: UIEvent) => any; + /** + * Fires when the object is set as the active element. + * @param ev The event. + */ + onactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires immediately before the object is set as the active element. + * @param ev The event. + */ + onbeforeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires immediately before the activeElement is changed from the current object to another object in the parent document. + * @param ev The event. + */ + onbeforedeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: (this: Document, ev: FocusEvent) => any; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: (this: Document, ev: Event) => any; + oncanplaythrough: (this: Document, ev: Event) => any; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: (this: Document, ev: PointerEvent) => any; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the activeElement is changed from the current object to another object in the parent document. + * @param ev The UI Event + */ + ondeactivate: (this: Document, ev: UIEvent) => any; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: (this: Document, ev: DragEvent) => any; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: (this: Document, ev: DragEvent) => any; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: (this: Document, ev: DragEvent) => any; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: (this: Document, ev: DragEvent) => any; + ondrop: (this: Document, ev: DragEvent) => any; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: (this: Document, ev: Event) => any; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: (this: Document, ev: Event) => any; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: (this: Document, ev: MediaStreamErrorEvent) => any; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: (this: Document, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: (this: Document, ev: FocusEvent) => any; + onfullscreenchange: (this: Document, ev: Event) => any; + onfullscreenerror: (this: Document, ev: Event) => any; + oninput: (this: Document, ev: Event) => any; + oninvalid: (this: Document, ev: Event) => any; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + */ + onkeypress: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: (this: Document, ev: KeyboardEvent) => any; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: (this: Document, ev: Event) => any; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: (this: Document, ev: Event) => any; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: (this: Document, ev: Event) => any; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: (this: Document, ev: MouseEvent) => any; + /** + * Fires when the wheel button is rotated. + * @param ev The mouse event + */ + onmousewheel: (this: Document, ev: WheelEvent) => any; + onmscontentzoom: (this: Document, ev: UIEvent) => any; + onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; + onmsgestureend: (this: Document, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; + onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; + onmspointercancel: (this: Document, ev: MSPointerEvent) => any; + onmspointerdown: (this: Document, ev: MSPointerEvent) => any; + onmspointerenter: (this: Document, ev: MSPointerEvent) => any; + onmspointerleave: (this: Document, ev: MSPointerEvent) => any; + onmspointermove: (this: Document, ev: MSPointerEvent) => any; + onmspointerout: (this: Document, ev: MSPointerEvent) => any; + onmspointerover: (this: Document, ev: MSPointerEvent) => any; + onmspointerup: (this: Document, ev: MSPointerEvent) => any; + /** + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * @param ev The event. + */ + onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; + /** + * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. + * @param ev The event. + */ + onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: (this: Document, ev: Event) => any; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: (this: Document, ev: Event) => any; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: (this: Document, ev: Event) => any; + onpointerlockchange: (this: Document, ev: Event) => any; + onpointerlockerror: (this: Document, ev: Event) => any; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: (this: Document, ev: ProgressEvent) => any; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: (this: Document, ev: Event) => any; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: (this: Document, ev: Event) => any; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: (this: Document, ev: Event) => any; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: (this: Document, ev: UIEvent) => any; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: (this: Document, ev: Event) => any; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: (this: Document, ev: Event) => any; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: (this: Document, ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (this: Document, ev: Event) => any; + onselectstart: (this: Document, ev: Event) => any; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: (this: Document, ev: Event) => any; + /** + * Fires when the user clicks the Stop button or leaves the Web page. + * @param ev The event. + */ + onstop: (this: Document, ev: Event) => any; + onsubmit: (this: Document, ev: Event) => any; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: (this: Document, ev: Event) => any; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: (this: Document, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: (this: Document, ev: Event) => any; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: (this: Document, ev: Event) => any; + onwebkitfullscreenchange: (this: Document, ev: Event) => any; + onwebkitfullscreenerror: (this: Document, ev: Event) => any; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; + /** + * Retrieves a value that indicates the current state of the object. + */ + readonly readyState: string; + /** + * Gets the URL of the location that referred the user to the current page. + */ + readonly referrer: string; + /** + * Gets the root svg element in the document hierarchy. + */ + readonly rootElement: SVGSVGElement; + /** + * Retrieves a collection of all script objects in the document. + */ + scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + */ + readonly styleSheets: StyleSheetList; + /** + * Contains the title of the document. + */ + title: string; + readonly visibilityState: VisibilityState; + /** + * Sets or gets the color of the links that the user has visited. + */ + vlinkColor: string; + readonly webkitCurrentFullScreenElement: Element | null; + readonly webkitFullscreenElement: Element | null; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string | null; + xmlStandalone: boolean; + /** + * Gets or sets the version attribute specified in the declaration of an XML document. + */ + xmlVersion: string | null; + adoptNode(source: T): T; + captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; + clear(): void; + /** + * Closes an output stream and forces the sent data to display. + */ + close(): void; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(name: string): Attr; + createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; + createCDATASection(data: string): CDATASection; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** + * Creates a new document. + */ + createDocumentFragment(): DocumentFragment; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: K): HTMLElementTagNameMap[K]; + createElement(tagName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement + createElementNS(namespaceURI: string | null, qualifiedName: string): Element; + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver: Node): XPathNSResolver; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + */ + createRange(): Range; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouchList(...touches: Touch[]): TouchList; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + */ + execCommand(commandId: string, showUI?: boolean, value?: any): boolean; + /** + * Displays help information for the given command identifier. + * @param commandId Displays help information for the given command identifier. + */ + execCommandShowHelp(commandId: string): boolean; + exitFullscreen(): void; + exitPointerLock(): void; + /** + * Causes the element to receive the focus and executes the code specified by the onfocus event. + */ + focus(): void; + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. + */ + getElementById(elementId: string): HTMLElement | null; + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeListOf; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(tagname: K): ElementListTagNameMap[K]; + getElementsByTagName(tagname: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + */ + getSelection(): Selection; + /** + * Gets a value indicating whether the object currently has focus. + */ + hasFocus(): boolean; + importNode(importedNode: T, deep: boolean): T; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): Document; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + */ + queryCommandState(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + */ + queryCommandSupported(commandId: string): boolean; + /** + * Retrieves the string associated with a command. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + */ + queryCommandText(commandId: string): string; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + releaseEvents(): void; + /** + * Allows updating the print settings for the page. + */ + updateSettings(): void; + webkitCancelFullScreen(): void; + webkitExitFullscreen(): void; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...content: string[]): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...content: string[]): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Document: { + prototype: Document; + new(): Document; +} + +interface DocumentFragment extends Node, NodeSelector, ParentNode { + getElementById(elementId: string): HTMLElement | null; +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +} + +interface DocumentType extends Node, ChildNode { + readonly entities: NamedNodeMap; + readonly internalSubset: string | null; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string; + readonly systemId: string; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +} + +interface DragEvent extends MouseEvent { + readonly dataTransfer: DataTransfer; + initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; + msConvertURL(file: File, targetType: string, targetURL?: string): void; +} + +declare var DragEvent: { + prototype: DragEvent; + new(): DragEvent; +} + +interface DynamicsCompressorNode extends AudioNode { + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: number; + readonly release: AudioParam; + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(): DynamicsCompressorNode; +} + +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + +interface EXT_texture_filter_anisotropic { + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +declare var EXT_texture_filter_anisotropic: { + prototype: EXT_texture_filter_anisotropic; + new(): EXT_texture_filter_anisotropic; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; +} + +interface ElementEventMap extends GlobalEventHandlersEventMap { + "ariarequest": Event; + "command": Event; + "gotpointercapture": PointerEvent; + "lostpointercapture": PointerEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSGotPointerCapture": MSPointerEvent; + "MSInertiaStart": MSGestureEvent; + "MSLostPointerCapture": MSPointerEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "webkitfullscreenchange": Event; + "webkitfullscreenerror": Event; +} + +interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; + innerHTML: string; + msContentZoomFactor: number; + readonly msRegionOverflow: string; + onariarequest: (this: Element, ev: Event) => any; + oncommand: (this: Element, ev: Event) => any; + ongotpointercapture: (this: Element, ev: PointerEvent) => any; + onlostpointercapture: (this: Element, ev: PointerEvent) => any; + onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; + onmsgestureend: (this: Element, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; + onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; + onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; + onmspointercancel: (this: Element, ev: MSPointerEvent) => any; + onmspointerdown: (this: Element, ev: MSPointerEvent) => any; + onmspointerenter: (this: Element, ev: MSPointerEvent) => any; + onmspointerleave: (this: Element, ev: MSPointerEvent) => any; + onmspointermove: (this: Element, ev: MSPointerEvent) => any; + onmspointerout: (this: Element, ev: MSPointerEvent) => any; + onmspointerover: (this: Element, ev: MSPointerEvent) => any; + onmspointerup: (this: Element, ev: MSPointerEvent) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onwebkitfullscreenchange: (this: Element, ev: Event) => any; + onwebkitfullscreenerror: (this: Element, ev: Event) => any; + outerHTML: string; + readonly prefix: string | null; + readonly scrollHeight: number; + scrollLeft: number; + scrollTop: number; + readonly scrollWidth: number; + readonly tagName: string; + readonly assignedSlot: HTMLSlotElement | null; + slot: string; + readonly shadowRoot: ShadowRoot | null; + getAttribute(name: string): string | null; + getAttributeNS(namespaceURI: string, localName: string): string; + getAttributeNode(name: string): Attr; + getAttributeNodeNS(namespaceURI: string, localName: string): Attr; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + getElementsByTagName(name: K): ElementListTagNameMap[K]; + getElementsByTagName(name: string): NodeListOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; + hasAttribute(name: string): boolean; + hasAttributeNS(namespaceURI: string, localName: string): boolean; + msGetRegionContent(): MSRangeCollection; + msGetUntransformedBounds(): ClientRect; + msMatchesSelector(selectors: string): boolean; + msReleasePointerCapture(pointerId: number): void; + msSetPointerCapture(pointerId: number): void; + msZoomTo(args: MsZoomToOptions): void; + releasePointerCapture(pointerId: number): void; + removeAttribute(qualifiedName: string): void; + removeAttributeNS(namespaceURI: string, localName: string): void; + removeAttributeNode(oldAttr: Attr): Attr; + requestFullscreen(): void; + requestPointerLock(): void; + setAttribute(name: string, value: string): void; + setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; + setAttributeNode(newAttr: Attr): Attr; + setAttributeNodeNS(newAttr: Attr): Attr; + setPointerCapture(pointerId: number): void; + webkitMatchesSelector(selectors: string): boolean; + webkitRequestFullScreen(): void; + webkitRequestFullscreen(): void; + getElementsByClassName(classNames: string): NodeListOf; + matches(selector: string): boolean; + closest(selector: string): Element | null; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; + insertAdjacentElement(position: string, insertedElement: Element): Element | null; + insertAdjacentHTML(where: string, html: string): void; + insertAdjacentText(where: string, text: string): void; + attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Element: { + prototype: Element; + new(): Element; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(type: string, errorEventInitDict?: ErrorEventInit): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: Element | null; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + readonly scoped: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + deepPath(): EventTarget[]; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(typeArg: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface ExtensionScriptApis { + extensionIdToShortId(extensionId: string): number; + fireExtensionApiTelemetry(functionName: string, isSucceeded: boolean, isSupported: boolean): void; + genericFunction(routerAddress: any, parameters?: string, callbackId?: number): void; + genericSynchronousFunction(functionId: number, parameters?: string): string; + getExtensionId(): string; + registerGenericFunctionCallbackHandler(callbackHandler: any): void; + registerGenericPersistentCallbackHandler(callbackHandler: any): void; +} + +declare var ExtensionScriptApis: { + prototype: ExtensionScriptApis; + new(): ExtensionScriptApis; +} + +interface External { +} + +declare var External: { + prototype: External; + new(): External; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: FileReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface FocusEvent extends UIEvent { + readonly relatedTarget: EventTarget; + initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; +} + +interface FocusNavigationEvent extends Event { + readonly navigationReason: NavigationReason; + readonly originHeight: number; + readonly originLeft: number; + readonly originTop: number; + readonly originWidth: number; + requestFocus(): void; +} + +declare var FocusNavigationEvent: { + prototype: FocusNavigationEvent; + new(type: string, eventInitDict?: FocusNavigationEventInit): FocusNavigationEvent; +} + +interface FormData { + append(name: string, value: string | Blob, fileName?: string): void; + delete(name: string): void; + get(name: string): FormDataEntryValue | null; + getAll(name: string): FormDataEntryValue[]; + has(name: string): boolean; + set(name: string, value: string | Blob, fileName?: string): void; +} + +declare var FormData: { + prototype: FormData; + new (form?: HTMLFormElement): FormData; +} + +interface GainNode extends AudioNode { + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(): GainNode; +} + +interface Gamepad { + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +} + +interface GamepadButton { + readonly pressed: boolean; + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +} + +interface GamepadEvent extends Event { + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(typeArg: string, eventInitDict?: GamepadEventInit): GamepadEvent; +} + +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +} + +interface HTMLAllCollection { + readonly length: number; + item(nameOrIndex?: string): HTMLCollection | Element | null; + namedItem(name: string): HTMLCollection | Element | null; + [index: number]: Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +} + +interface HTMLAnchorElement extends HTMLElement { + Methods: string; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Contains the anchor portion of the URL including the hash sign (#). + */ + hash: string; + /** + * Contains the hostname and port values of the URL. + */ + host: string; + /** + * Contains the hostname of a URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + readonly mimeType: string; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + readonly nameProp: string; + /** + * Contains the pathname of the URL. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Contains the protocol of the URL. + */ + protocol: string; + readonly protocolLong: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + type: string; + urn: string; + /** + * Returns a string representation of an object. + */ + toString(): string; + addEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +} + +interface HTMLAppletElement extends HTMLElement { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + /** + * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. + */ + declare: boolean; + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Sets or retrieves the shape of the object. + */ + name: string; + object: string | null; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + vspace: number; + width: number; + addEventListener(type: K, listener: (this: HTMLAppletElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAppletElement: { + prototype: HTMLAppletElement; + new(): HTMLAppletElement; +} + +interface HTMLAreaElement extends HTMLElement { + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Sets or retrieves the coordinates of the object. + */ + coords: string; + download: string; + /** + * Sets or retrieves the subsection of the href property that follows the number sign (#). + */ + hash: string; + /** + * Sets or retrieves the hostname and port number of the location or URL. + */ + host: string; + /** + * Sets or retrieves the host name part of the location or URL. + */ + hostname: string; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or gets whether clicks in this region cause action. + */ + noHref: boolean; + /** + * Sets or retrieves the file name or path specified by the object. + */ + pathname: string; + /** + * Sets or retrieves the port number associated with a URL. + */ + port: string; + /** + * Sets or retrieves the protocol portion of a URL. + */ + protocol: string; + rel: string; + /** + * Sets or retrieves the substring of the href property that follows the question mark. + */ + search: string; + /** + * Sets or retrieves the shape of the object. + */ + shape: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns a string representation of an object. + */ + toString(): string; + addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +} + +interface HTMLAreasCollection extends HTMLCollectionBase { +} + +declare var HTMLAreasCollection: { + prototype: HTMLAreasCollection; + new(): HTMLAreasCollection; +} + +interface HTMLAudioElement extends HTMLMediaElement { + addEventListener(type: K, listener: (this: HTMLAudioElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +} + +interface HTMLBRElement extends HTMLElement { + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + */ + clear: string; + addEventListener(type: K, listener: (this: HTMLBRElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +} + +interface HTMLBaseElement extends HTMLElement { + /** + * Gets or sets the baseline URL on which relative links are based. + */ + href: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + addEventListener(type: K, listener: (this: HTMLBaseElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +} + +interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + /** + * Sets or retrieves the font size of the object. + */ + size: number; + addEventListener(type: K, listener: (this: HTMLBaseFontElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBaseFontElement: { + prototype: HTMLBaseFontElement; + new(): HTMLBaseFontElement; +} + +interface HTMLBodyElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "scroll": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + +interface HTMLBodyElement extends HTMLElement { + aLink: any; + background: string; + bgColor: any; + bgProperties: string; + link: any; + noWrap: boolean; + onafterprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; + onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; + onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; + onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; + onload: (this: HTMLBodyElement, ev: Event) => any; + onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; + onoffline: (this: HTMLBodyElement, ev: Event) => any; + ononline: (this: HTMLBodyElement, ev: Event) => any; + onorientationchange: (this: HTMLBodyElement, ev: Event) => any; + onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; + onresize: (this: HTMLBodyElement, ev: UIEvent) => any; + onscroll: (this: HTMLBodyElement, ev: UIEvent) => any; + onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; + onunload: (this: HTMLBodyElement, ev: Event) => any; + text: any; + vLink: any; + addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +} + +interface HTMLButtonElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + status: any; + /** + * Gets the classification and default behavior of the button. + */ + type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the default or selected value of the control. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLButtonElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLButtonElement: { + prototype: HTMLButtonElement; + new(): HTMLButtonElement; +} + +interface HTMLCanvasElement extends HTMLElement { + /** + * Gets or sets the height of a canvas element on a document. + */ + height: number; + /** + * Gets or sets the width of a canvas element on a document. + */ + width: number; + /** + * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. + * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); + */ + getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; + getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; + /** + * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. + */ + msToBlob(): Blob; + /** + * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. + * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. + */ + toDataURL(type?: string, ...args: any[]): string; + toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; + addEventListener(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLCanvasElement: { + prototype: HTMLCanvasElement; + new(): HTMLCanvasElement; +} + +interface HTMLCollectionBase { + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Retrieves an object from various collections. + */ + item(index: number): Element; + [index: number]: Element; +} + +interface HTMLCollection extends HTMLCollectionBase { + /** + * Retrieves a select object or an object from an options collection. + */ + namedItem(name: string): Element | null; +} + +declare var HTMLCollection: { + prototype: HTMLCollection; + new(): HTMLCollection; +} + +interface HTMLDListElement extends HTMLElement { + compact: boolean; + addEventListener(type: K, listener: (this: HTMLDListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDListElement: { + prototype: HTMLDListElement; + new(): HTMLDListElement; +} + +interface HTMLDataElement extends HTMLElement { + value: string; + addEventListener(type: K, listener: (this: HTMLDataElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDataElement: { + prototype: HTMLDataElement; + new(): HTMLDataElement; +} + +interface HTMLDataListElement extends HTMLElement { + options: HTMLCollectionOf; + addEventListener(type: K, listener: (this: HTMLDataListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDataListElement: { + prototype: HTMLDataListElement; + new(): HTMLDataListElement; +} + +interface HTMLDirectoryElement extends HTMLElement { + compact: boolean; + addEventListener(type: K, listener: (this: HTMLDirectoryElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDirectoryElement: { + prototype: HTMLDirectoryElement; + new(): HTMLDirectoryElement; +} + +interface HTMLDivElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + addEventListener(type: K, listener: (this: HTMLDivElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDivElement: { + prototype: HTMLDivElement; + new(): HTMLDivElement; +} + +interface HTMLDocument extends Document { + addEventListener(type: K, listener: (this: HTMLDocument, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLDocument: { + prototype: HTMLDocument; + new(): HTMLDocument; +} + +interface HTMLElementEventMap extends ElementEventMap { + "abort": UIEvent; + "activate": UIEvent; + "beforeactivate": UIEvent; + "beforecopy": ClipboardEvent; + "beforecut": ClipboardEvent; + "beforedeactivate": UIEvent; + "beforepaste": ClipboardEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "contextmenu": PointerEvent; + "copy": ClipboardEvent; + "cuechange": Event; + "cut": ClipboardEvent; + "dblclick": MouseEvent; + "deactivate": UIEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSContentZoom": UIEvent; + "MSManipulationStateChanged": MSManipulationEvent; + "paste": ClipboardEvent; + "pause": Event; + "play": Event; + "playing": Event; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "selectstart": Event; + "stalled": Event; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "volumechange": Event; + "waiting": Event; +} + +interface HTMLElement extends Element { + accessKey: string; + readonly children: HTMLCollection; + contentEditable: string; + readonly dataset: DOMStringMap; + dir: string; + draggable: boolean; + hidden: boolean; + hideFocus: boolean; + innerText: string; + readonly isContentEditable: boolean; + lang: string; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; + onabort: (this: HTMLElement, ev: UIEvent) => any; + onactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; + onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; + onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onblur: (this: HTMLElement, ev: FocusEvent) => any; + oncanplay: (this: HTMLElement, ev: Event) => any; + oncanplaythrough: (this: HTMLElement, ev: Event) => any; + onchange: (this: HTMLElement, ev: Event) => any; + onclick: (this: HTMLElement, ev: MouseEvent) => any; + oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; + oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; + oncuechange: (this: HTMLElement, ev: Event) => any; + oncut: (this: HTMLElement, ev: ClipboardEvent) => any; + ondblclick: (this: HTMLElement, ev: MouseEvent) => any; + ondeactivate: (this: HTMLElement, ev: UIEvent) => any; + ondrag: (this: HTMLElement, ev: DragEvent) => any; + ondragend: (this: HTMLElement, ev: DragEvent) => any; + ondragenter: (this: HTMLElement, ev: DragEvent) => any; + ondragleave: (this: HTMLElement, ev: DragEvent) => any; + ondragover: (this: HTMLElement, ev: DragEvent) => any; + ondragstart: (this: HTMLElement, ev: DragEvent) => any; + ondrop: (this: HTMLElement, ev: DragEvent) => any; + ondurationchange: (this: HTMLElement, ev: Event) => any; + onemptied: (this: HTMLElement, ev: Event) => any; + onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; + onerror: (this: HTMLElement, ev: ErrorEvent) => any; + onfocus: (this: HTMLElement, ev: FocusEvent) => any; + oninput: (this: HTMLElement, ev: Event) => any; + oninvalid: (this: HTMLElement, ev: Event) => any; + onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; + onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; + onload: (this: HTMLElement, ev: Event) => any; + onloadeddata: (this: HTMLElement, ev: Event) => any; + onloadedmetadata: (this: HTMLElement, ev: Event) => any; + onloadstart: (this: HTMLElement, ev: Event) => any; + onmousedown: (this: HTMLElement, ev: MouseEvent) => any; + onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; + onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; + onmousemove: (this: HTMLElement, ev: MouseEvent) => any; + onmouseout: (this: HTMLElement, ev: MouseEvent) => any; + onmouseover: (this: HTMLElement, ev: MouseEvent) => any; + onmouseup: (this: HTMLElement, ev: MouseEvent) => any; + onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; + onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; + onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; + onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; + onpause: (this: HTMLElement, ev: Event) => any; + onplay: (this: HTMLElement, ev: Event) => any; + onplaying: (this: HTMLElement, ev: Event) => any; + onprogress: (this: HTMLElement, ev: ProgressEvent) => any; + onratechange: (this: HTMLElement, ev: Event) => any; + onreset: (this: HTMLElement, ev: Event) => any; + onscroll: (this: HTMLElement, ev: UIEvent) => any; + onseeked: (this: HTMLElement, ev: Event) => any; + onseeking: (this: HTMLElement, ev: Event) => any; + onselect: (this: HTMLElement, ev: UIEvent) => any; + onselectstart: (this: HTMLElement, ev: Event) => any; + onstalled: (this: HTMLElement, ev: Event) => any; + onsubmit: (this: HTMLElement, ev: Event) => any; + onsuspend: (this: HTMLElement, ev: Event) => any; + ontimeupdate: (this: HTMLElement, ev: Event) => any; + onvolumechange: (this: HTMLElement, ev: Event) => any; + onwaiting: (this: HTMLElement, ev: Event) => any; + outerText: string; + spellcheck: boolean; + readonly style: CSSStyleDeclaration; + tabIndex: number; + title: string; + blur(): void; + click(): void; + dragDrop(): boolean; + focus(): void; + msGetInputContext(): MSInputMethodContext; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLElement: { + prototype: HTMLElement; + new(): HTMLElement; +} + +interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves the height of the object. + */ + height: string; + hidden: any; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Retrieves the palette used for the embedded document. + */ + readonly palette: string; + /** + * Retrieves the URL of the plug-in used to view an embedded document. + */ + readonly pluginspage: string; + readonly readyState: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the height and width units of the embed object. + */ + units: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLEmbedElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLEmbedElement: { + prototype: HTMLEmbedElement; + new(): HTMLEmbedElement; +} + +interface HTMLFieldSetElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + name: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLFieldSetElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFieldSetElement: { + prototype: HTMLFieldSetElement; + new(): HTMLFieldSetElement; +} + +interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves the current typeface family. + */ + face: string; + addEventListener(type: K, listener: (this: HTMLFontElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFontElement: { + prototype: HTMLFontElement; + new(): HTMLFontElement; +} + +interface HTMLFormControlsCollection extends HTMLCollectionBase { + namedItem(name: string): HTMLCollection | Element | null; +} + +declare var HTMLFormControlsCollection: { + prototype: HTMLFormControlsCollection; + new(): HTMLFormControlsCollection; +} + +interface HTMLFormElement extends HTMLElement { + /** + * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. + */ + acceptCharset: string; + /** + * Sets or retrieves the URL to which the form content is sent for processing. + */ + action: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Retrieves a collection, in source order, of all controls in a given form. + */ + readonly elements: HTMLFormControlsCollection; + /** + * Sets or retrieves the MIME encoding for the form. + */ + encoding: string; + /** + * Sets or retrieves the encoding type for the form. + */ + enctype: string; + /** + * Sets or retrieves the number of objects in a collection. + */ + readonly length: number; + /** + * Sets or retrieves how to send the form data to the server. + */ + method: string; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Designates a form that is not validated when submitted. + */ + noValidate: boolean; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a form object or an object from an elements collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a form object or an object from an elements collection. + */ + namedItem(name: string): any; + /** + * Fires when the user resets a form. + */ + reset(): void; + /** + * Fires when a FORM is about to be submitted. + */ + submit(): void; + addEventListener(type: K, listener: (this: HTMLFormElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [name: string]: any; +} + +declare var HTMLFormElement: { + prototype: HTMLFormElement; + new(): HTMLFormElement; +} + +interface HTMLFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + +interface HTMLFrameElement extends HTMLElement, GetSVGDocument { + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string | number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: HTMLFrameElement, ev: Event) => any; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the width of the object. + */ + width: string | number; + addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFrameElement: { + prototype: HTMLFrameElement; + new(): HTMLFrameElement; +} + +interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "error": ErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "load": Event; + "message": MessageEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "popstate": PopStateEvent; + "resize": UIEvent; + "scroll": UIEvent; + "storage": StorageEvent; + "unload": Event; +} + +interface HTMLFrameSetElement extends HTMLElement { + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Sets or retrieves the frame widths of the object. + */ + cols: string; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + name: string; + onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; + onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; + /** + * Fires when the object loses the input focus. + */ + onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; + /** + * Fires when the object receives focus. + */ + onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; + onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; + onload: (this: HTMLFrameSetElement, ev: Event) => any; + onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; + onoffline: (this: HTMLFrameSetElement, ev: Event) => any; + ononline: (this: HTMLFrameSetElement, ev: Event) => any; + onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; + onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; + onpopstate: (this: HTMLFrameSetElement, ev: PopStateEvent) => any; + onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onscroll: (this: HTMLFrameSetElement, ev: UIEvent) => any; + onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; + onunload: (this: HTMLFrameSetElement, ev: Event) => any; + /** + * Sets or retrieves the frame heights of the object. + */ + rows: string; + addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLFrameSetElement: { + prototype: HTMLFrameSetElement; + new(): HTMLFrameSetElement; +} + +interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. + */ + noShade: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: number; + addEventListener(type: K, listener: (this: HTMLHRElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHRElement: { + prototype: HTMLHRElement; + new(): HTMLHRElement; +} + +interface HTMLHeadElement extends HTMLElement { + profile: string; + addEventListener(type: K, listener: (this: HTMLHeadElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHeadElement: { + prototype: HTMLHeadElement; + new(): HTMLHeadElement; +} + +interface HTMLHeadingElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + addEventListener(type: K, listener: (this: HTMLHeadingElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHeadingElement: { + prototype: HTMLHeadingElement; + new(): HTMLHeadingElement; +} + +interface HTMLHtmlElement extends HTMLElement { + /** + * Sets or retrieves the DTD version that governs the current document. + */ + version: string; + addEventListener(type: K, listener: (this: HTMLHtmlElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLHtmlElement: { + prototype: HTMLHtmlElement; + new(): HTMLHtmlElement; +} + +interface HTMLIFrameElementEventMap extends HTMLElementEventMap { + "load": Event; +} + +interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + allowFullscreen: boolean; + allowPaymentRequest: boolean; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Retrieves the object of the specified. + */ + readonly contentWindow: Window; + /** + * Sets or retrieves whether to display a border for the frame. + */ + frameBorder: string; + /** + * Sets or retrieves the amount of additional space between the frames. + */ + frameSpacing: any; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the horizontal margin for the object. + */ + hspace: number; + /** + * Sets or retrieves a URI to a long description of the object. + */ + longDesc: string; + /** + * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. + */ + marginHeight: string; + /** + * Sets or retrieves the left and right margin widths before displaying the text in a frame. + */ + marginWidth: string; + /** + * Sets or retrieves the frame name. + */ + name: string; + /** + * Sets or retrieves whether the user can resize the frame. + */ + noResize: boolean; + /** + * Raised when the object has been completely received from the server. + */ + onload: (this: HTMLIFrameElement, ev: Event) => any; + readonly sandbox: DOMSettableTokenList; + /** + * Sets or retrieves whether the frame can be scrolled. + */ + scrolling: string; + /** + * Sets or retrieves a URL to be loaded by the object. + */ + src: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLIFrameElement: { + prototype: HTMLIFrameElement; + new(): HTMLIFrameElement; +} + +interface HTMLImageElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies the properties of a border drawn around an object. + */ + border: string; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + crossOrigin: string | null; + readonly currentSrc: string; + /** + * Sets or retrieves the height of the object. + */ + height: number; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + /** + * Sets or retrieves whether the image is a server-side image map. + */ + isMap: boolean; + /** + * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. + */ + longDesc: string; + lowsrc: string; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * The original height of the image resource before sizing. + */ + readonly naturalHeight: number; + /** + * The original width of the image resource before sizing. + */ + readonly naturalWidth: number; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: number; + readonly x: number; + readonly y: number; + msGetAsCastingSource(): any; + addEventListener(type: K, listener: (this: HTMLImageElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLImageElement: { + prototype: HTMLImageElement; + new(): HTMLImageElement; +} + +interface HTMLInputElement extends HTMLElement { + /** + * Sets or retrieves a comma-separated list of content types. + */ + accept: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Specifies whether autocomplete is applied to an editable text field. + */ + autocomplete: string; + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the state of the check box or radio button. + */ + checked: boolean; + /** + * Retrieves whether the object is fully loaded. + */ + readonly complete: boolean; + /** + * Sets or retrieves the state of the check box or radio button. + */ + defaultChecked: boolean; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Returns a FileList object on a file type input object. + */ + readonly files: FileList | null; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Overrides the action attribute (where the data on a form is sent) on the parent form element. + */ + formAction: string; + /** + * Used to override the encoding (formEnctype attribute) specified on the form element. + */ + formEnctype: string; + /** + * Overrides the submit method attribute previously specified on a form element. + */ + formMethod: string; + /** + * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. + */ + formNoValidate: string; + /** + * Overrides the target attribute on a form element. + */ + formTarget: string; + /** + * Sets or retrieves the height of the object. + */ + height: string; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + hspace: number; + indeterminate: boolean; + /** + * Specifies the ID of a pre-defined datalist of options for an input element. + */ + readonly list: HTMLElement; + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + */ + max: string; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + */ + min: string; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a string containing a regular expression that the user's input must match. + */ + pattern: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + selectionDirection: string; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + size: number; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + status: boolean; + /** + * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. + */ + step: string; + /** + * Returns the content type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Returns the value of the data at the cursor's current position. + */ + value: string; + valueAsDate: Date; + /** + * Returns the input field value as a number. + */ + valueAsNumber: number; + /** + * Sets or retrieves the vertical margin for the object. + */ + vspace: number; + webkitdirectory: boolean; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Makes the selection equal to the current object. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start?: number, end?: number, direction?: string): void; + /** + * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. + * @param n Value to decrement the value by. + */ + stepDown(n?: number): void; + /** + * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. + * @param n Value to increment the value by. + */ + stepUp(n?: number): void; + addEventListener(type: K, listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLInputElement: { + prototype: HTMLInputElement; + new(): HTMLInputElement; +} + +interface HTMLLIElement extends HTMLElement { + type: string; + /** + * Sets or retrieves the value of a list item. + */ + value: number; + addEventListener(type: K, listener: (this: HTMLLIElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLIElement: { + prototype: HTMLLIElement; + new(): HTMLLIElement; +} + +interface HTMLLabelElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the object to which the given label object is assigned. + */ + htmlFor: string; + addEventListener(type: K, listener: (this: HTMLLabelElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLabelElement: { + prototype: HTMLLabelElement; + new(): HTMLLabelElement; +} + +interface HTMLLegendElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + align: string; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + addEventListener(type: K, listener: (this: HTMLLegendElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLegendElement: { + prototype: HTMLLegendElement; + new(): HTMLLegendElement; +} + +interface HTMLLinkElement extends HTMLElement, LinkStyle { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + disabled: boolean; + /** + * Sets or retrieves a destination URL or an anchor point. + */ + href: string; + /** + * Sets or retrieves the language code of the object. + */ + hreflang: string; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rel: string; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + */ + rev: string; + /** + * Sets or retrieves the window or frame at which to target content. + */ + target: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + import?: Document; + integrity: string; + addEventListener(type: K, listener: (this: HTMLLinkElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLLinkElement: { + prototype: HTMLLinkElement; + new(): HTMLLinkElement; +} + +interface HTMLMapElement extends HTMLElement { + /** + * Retrieves a collection of the area objects defined for the given map object. + */ + readonly areas: HTMLAreasCollection; + /** + * Sets or retrieves the name of the object. + */ + name: string; + addEventListener(type: K, listener: (this: HTMLMapElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMapElement: { + prototype: HTMLMapElement; + new(): HTMLMapElement; +} + +interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { + "bounce": Event; + "finish": Event; + "start": Event; +} + +interface HTMLMarqueeElement extends HTMLElement { + behavior: string; + bgColor: any; + direction: string; + height: string; + hspace: number; + loop: number; + onbounce: (this: HTMLMarqueeElement, ev: Event) => any; + onfinish: (this: HTMLMarqueeElement, ev: Event) => any; + onstart: (this: HTMLMarqueeElement, ev: Event) => any; + scrollAmount: number; + scrollDelay: number; + trueSpeed: boolean; + vspace: number; + width: string; + start(): void; + stop(): void; + addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMarqueeElement: { + prototype: HTMLMarqueeElement; + new(): HTMLMarqueeElement; +} + +interface HTMLMediaElementEventMap extends HTMLElementEventMap { + "encrypted": MediaEncryptedEvent; + "msneedkey": MSMediaKeyNeededEvent; +} + +interface HTMLMediaElement extends HTMLElement { + /** + * Returns an AudioTrackList object with the audio tracks for a given video element. + */ + readonly audioTracks: AudioTrackList; + /** + * Gets or sets a value that indicates whether to start playing the media automatically. + */ + autoplay: boolean; + /** + * Gets a collection of buffered time ranges. + */ + readonly buffered: TimeRanges; + /** + * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). + */ + controls: boolean; + crossOrigin: string | null; + /** + * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. + */ + readonly currentSrc: string; + /** + * Gets or sets the current playback position, in seconds. + */ + currentTime: number; + defaultMuted: boolean; + /** + * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. + */ + defaultPlaybackRate: number; + /** + * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. + */ + readonly duration: number; + /** + * Gets information about whether the playback has ended or not. + */ + readonly ended: boolean; + /** + * Returns an object representing the current error state of the audio or video element. + */ + readonly error: MediaError; + /** + * Gets or sets a flag to specify whether playback should restart after it completes. + */ + loop: boolean; + readonly mediaKeys: MediaKeys | null; + /** + * Specifies the purpose of the audio or video media, such as background audio or alerts. + */ + msAudioCategory: string; + /** + * Specifies the output device id that the audio will be sent to. + */ + msAudioDeviceType: string; + readonly msGraphicsTrustStatus: MSGraphicsTrust; + /** + * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. + */ + readonly msKeys: MSMediaKeys; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Specifies whether or not to enable low-latency playback on the media element. + */ + msRealTime: boolean; + /** + * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. + */ + muted: boolean; + /** + * Gets the current network activity for the element. + */ + readonly networkState: number; + onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; + onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; + /** + * Gets a flag that specifies whether playback is paused. + */ + readonly paused: boolean; + /** + * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. + */ + playbackRate: number; + /** + * Gets TimeRanges for the current media resource that has been played. + */ + readonly played: TimeRanges; + /** + * Gets or sets the current playback position, in seconds. + */ + preload: string; + readyState: number; + /** + * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. + */ + readonly seekable: TimeRanges; + /** + * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. + */ + readonly seeking: boolean; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcObject: MediaStream | null; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; + /** + * Gets or sets the volume level for audio portions of the media element. + */ + volume: number; + addTextTrack(kind: string, label?: string, language?: string): TextTrack; + /** + * Returns a string that specifies whether the client can play a given media resource type. + */ + canPlayType(type: string): string; + /** + * Resets the audio or video object and loads a new media resource. + */ + load(): void; + /** + * Clears all effects from the media pipeline. + */ + msClearEffects(): void; + msGetAsCastingSource(): any; + /** + * Inserts the specified audio effect into media pipeline. + */ + msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetMediaKeys(mediaKeys: MSMediaKeys): void; + /** + * Specifies the media protection manager for a given media pipeline. + */ + msSetMediaProtectionManager(mediaProtectionManager?: any): void; + /** + * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. + */ + pause(): void; + /** + * Loads and starts playback of a media resource. + */ + play(): void; + setMediaKeys(mediaKeys: MediaKeys | null): Promise; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; + addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMediaElement: { + prototype: HTMLMediaElement; + new(): HTMLMediaElement; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; +} + +interface HTMLMenuElement extends HTMLElement { + compact: boolean; + type: string; + addEventListener(type: K, listener: (this: HTMLMenuElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMenuElement: { + prototype: HTMLMenuElement; + new(): HTMLMenuElement; +} + +interface HTMLMetaElement extends HTMLElement { + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + /** + * Gets or sets meta-information to associate with httpEquiv or name. + */ + content: string; + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + */ + httpEquiv: string; + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + */ + name: string; + /** + * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. + */ + scheme: string; + /** + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + */ + url: string; + addEventListener(type: K, listener: (this: HTMLMetaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMetaElement: { + prototype: HTMLMetaElement; + new(): HTMLMetaElement; +} + +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; + addEventListener(type: K, listener: (this: HTMLMeterElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + +interface HTMLModElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + /** + * Sets or retrieves the date and time of a modification to the object. + */ + dateTime: string; + addEventListener(type: K, listener: (this: HTMLModElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLModElement: { + prototype: HTMLModElement; + new(): HTMLModElement; +} + +interface HTMLOListElement extends HTMLElement { + compact: boolean; + /** + * The starting number. + */ + start: number; + type: string; + addEventListener(type: K, listener: (this: HTMLOListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOListElement: { + prototype: HTMLOListElement; + new(): HTMLOListElement; +} + +interface HTMLObjectElement extends HTMLElement, GetSVGDocument { + /** + * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. + */ + readonly BaseHref: string; + align: string; + /** + * Sets or retrieves a text alternative to the graphic. + */ + alt: string; + /** + * Gets or sets the optional alternative HTML script to execute if the object fails to load. + */ + altHtml: string; + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + */ + archive: string; + border: string; + /** + * Sets or retrieves the URL of the file containing the compiled Java class. + */ + code: string; + /** + * Sets or retrieves the URL of the component. + */ + codeBase: string; + /** + * Sets or retrieves the Internet media type for the code associated with the object. + */ + codeType: string; + /** + * Retrieves the document object of the page or frame. + */ + readonly contentDocument: Document; + /** + * Sets or retrieves the URL that references the data of the object. + */ + data: string; + declare: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the height of the object. + */ + height: string; + hspace: number; + /** + * Gets or sets whether the DLNA PlayTo device is available. + */ + msPlayToDisabled: boolean; + /** + * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. + */ + msPlayToPreferredSourceUri: string; + /** + * Gets or sets the primary DLNA PlayTo device. + */ + msPlayToPrimary: boolean; + /** + * Gets the source associated with the media element for use by the PlayToManager. + */ + readonly msPlayToSource: any; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly readyState: number; + /** + * Sets or retrieves a message to be displayed while an object is loading. + */ + standby: string; + /** + * Sets or retrieves the MIME type of the object. + */ + type: string; + /** + * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + */ + useMap: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + vspace: number; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLObjectElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLObjectElement: { + prototype: HTMLObjectElement; + new(): HTMLObjectElement; +} + +interface HTMLOptGroupElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + readonly text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + addEventListener(type: K, listener: (this: HTMLOptGroupElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOptGroupElement: { + prototype: HTMLOptGroupElement; + new(): HTMLOptGroupElement; +} + +interface HTMLOptionElement extends HTMLElement { + /** + * Sets or retrieves the status of an option. + */ + defaultSelected: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the ordinal position of an option in a list box. + */ + readonly index: number; + /** + * Sets or retrieves a value that you can use to implement your own label functionality for the object. + */ + label: string; + /** + * Sets or retrieves whether the option in the list box is the default item. + */ + selected: boolean; + /** + * Sets or retrieves the text string specified by the option tag. + */ + text: string; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + addEventListener(type: K, listener: (this: HTMLOptionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOptionElement: { + prototype: HTMLOptionElement; + new(): HTMLOptionElement; +} + +interface HTMLOptionsCollection extends HTMLCollectionOf { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + +interface HTMLOutputElement extends HTMLElement { + defaultValue: string; + readonly form: HTMLFormElement; + readonly htmlFor: DOMSettableTokenList; + name: string; + readonly type: string; + readonly validationMessage: string; + readonly validity: ValidityState; + value: string; + readonly willValidate: boolean; + checkValidity(): boolean; + reportValidity(): boolean; + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLOutputElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLOutputElement: { + prototype: HTMLOutputElement; + new(): HTMLOutputElement; +} + +interface HTMLParagraphElement extends HTMLElement { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + clear: string; + addEventListener(type: K, listener: (this: HTMLParagraphElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLParagraphElement: { + prototype: HTMLParagraphElement; + new(): HTMLParagraphElement; +} + +interface HTMLParamElement extends HTMLElement { + /** + * Sets or retrieves the name of an input parameter for an element. + */ + name: string; + /** + * Sets or retrieves the content type of the resource designated by the value attribute. + */ + type: string; + /** + * Sets or retrieves the value of an input parameter for an element. + */ + value: string; + /** + * Sets or retrieves the data type of the value attribute. + */ + valueType: string; + addEventListener(type: K, listener: (this: HTMLParamElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLParamElement: { + prototype: HTMLParamElement; + new(): HTMLParamElement; +} + +interface HTMLPictureElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLPictureElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; +} + +interface HTMLPreElement extends HTMLElement { + /** + * Sets or gets a value that you can use to implement your own width functionality for the object. + */ + width: number; + addEventListener(type: K, listener: (this: HTMLPreElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLPreElement: { + prototype: HTMLPreElement; + new(): HTMLPreElement; +} + +interface HTMLProgressElement extends HTMLElement { + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Defines the maximum, or "done" value for a progress element. + */ + max: number; + /** + * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). + */ + readonly position: number; + /** + * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. + */ + value: number; + addEventListener(type: K, listener: (this: HTMLProgressElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLProgressElement: { + prototype: HTMLProgressElement; + new(): HTMLProgressElement; +} + +interface HTMLQuoteElement extends HTMLElement { + /** + * Sets or retrieves reference information about the object. + */ + cite: string; + addEventListener(type: K, listener: (this: HTMLQuoteElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLQuoteElement: { + prototype: HTMLQuoteElement; + new(): HTMLQuoteElement; +} + +interface HTMLScriptElement extends HTMLElement { + async: boolean; + /** + * Sets or retrieves the character set used to encode the object. + */ + charset: string; + crossOrigin: string | null; + /** + * Sets or retrieves the status of the script. + */ + defer: boolean; + /** + * Sets or retrieves the event for which the script is written. + */ + event: string; + /** + * Sets or retrieves the object that is bound to the event script. + */ + htmlFor: string; + /** + * Retrieves the URL to an external file that contains the source code or data. + */ + src: string; + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + /** + * Sets or retrieves the MIME type for the associated scripting engine. + */ + type: string; + integrity: string; + addEventListener(type: K, listener: (this: HTMLScriptElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLScriptElement: { + prototype: HTMLScriptElement; + new(): HTMLScriptElement; +} + +interface HTMLSelectElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the number of objects in a collection. + */ + length: number; + /** + * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. + */ + multiple: boolean; + /** + * Sets or retrieves the name of the object. + */ + name: string; + readonly options: HTMLOptionsCollection; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the index of the selected option in a select object. + */ + selectedIndex: number; + selectedOptions: HTMLCollectionOf; + /** + * Sets or retrieves the number of rows in the list box. + */ + size: number; + /** + * Retrieves the type of select control based on the value of the MULTIPLE attribute. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Sets or retrieves the value which is returned to the server when the form control is submitted. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Adds an element to the areas, controlRange, or options collection. + * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + */ + add(element: HTMLElement, before?: HTMLElement | number): void; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Retrieves a select object or an object from an options collection. + * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. + * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. + */ + item(name?: any, index?: any): any; + /** + * Retrieves a select object or an object from an options collection. + * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. + */ + namedItem(name: string): any; + /** + * Removes an element from the collection. + * @param index Number that specifies the zero-based index of the element to remove from the collection. + */ + remove(index?: number): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + addEventListener(type: K, listener: (this: HTMLSelectElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [name: string]: any; +} + +declare var HTMLSelectElement: { + prototype: HTMLSelectElement; + new(): HTMLSelectElement; +} + +interface HTMLSourceElement extends HTMLElement { + /** + * Gets or sets the intended media type of the media source. + */ + media: string; + msKeySystem: string; + sizes: string; + /** + * The address or URL of the a media resource that is to be considered. + */ + src: string; + srcset: string; + /** + * Gets or sets the MIME type of a media resource. + */ + type: string; + addEventListener(type: K, listener: (this: HTMLSourceElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLSourceElement: { + prototype: HTMLSourceElement; + new(): HTMLSourceElement; +} + +interface HTMLSpanElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLSpanElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLSpanElement: { + prototype: HTMLSpanElement; + new(): HTMLSpanElement; +} + +interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; + /** + * Sets or retrieves the media type. + */ + media: string; + /** + * Retrieves the CSS language in which the style sheet is written. + */ + type: string; + addEventListener(type: K, listener: (this: HTMLStyleElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLStyleElement: { + prototype: HTMLStyleElement; + new(): HTMLStyleElement; +} + +interface HTMLTableCaptionElement extends HTMLElement { + /** + * Sets or retrieves the alignment of the caption or legend. + */ + align: string; + /** + * Sets or retrieves whether the caption appears at the top or bottom of the table. + */ + vAlign: string; + addEventListener(type: K, listener: (this: HTMLTableCaptionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCaptionElement: { + prototype: HTMLTableCaptionElement; + new(): HTMLTableCaptionElement; +} + +interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves abbreviated text for the object. + */ + abbr: string; + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + /** + * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. + */ + axis: string; + bgColor: any; + /** + * Retrieves the position of the object in the cells collection of a row. + */ + readonly cellIndex: number; + /** + * Sets or retrieves the number columns in the table that the object should span. + */ + colSpan: number; + /** + * Sets or retrieves a list of header cells that provide information for the object. + */ + headers: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves whether the browser automatically performs wordwrap. + */ + noWrap: boolean; + /** + * Sets or retrieves how many rows in a table the cell should span. + */ + rowSpan: number; + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + /** + * Sets or retrieves the width of the object. + */ + width: string; + addEventListener(type: K, listener: (this: HTMLTableCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableCellElement: { + prototype: HTMLTableCellElement; + new(): HTMLTableCellElement; +} + +interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves the alignment of the object relative to the display or table. + */ + align: string; + /** + * Sets or retrieves the number of columns in the group. + */ + span: number; + /** + * Sets or retrieves the width of the object. + */ + width: any; + addEventListener(type: K, listener: (this: HTMLTableColElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableColElement: { + prototype: HTMLTableColElement; + new(): HTMLTableColElement; +} + +interface HTMLTableDataCellElement extends HTMLTableCellElement { + addEventListener(type: K, listener: (this: HTMLTableDataCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableDataCellElement: { + prototype: HTMLTableDataCellElement; + new(): HTMLTableDataCellElement; +} + +interface HTMLTableElement extends HTMLElement { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + bgColor: any; + /** + * Sets or retrieves the width of the border to draw around the object. + */ + border: string; + /** + * Sets or retrieves the border color of the object. + */ + borderColor: any; + /** + * Retrieves the caption object of a table. + */ + caption: HTMLTableCaptionElement; + /** + * Sets or retrieves the amount of space between the border of the cell and the content of the cell. + */ + cellPadding: string; + /** + * Sets or retrieves the amount of space between cells in a table. + */ + cellSpacing: string; + /** + * Sets or retrieves the number of columns in the table. + */ + cols: number; + /** + * Sets or retrieves the way the border frame around the table is displayed. + */ + frame: string; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Sets or retrieves which dividing lines (inner borders) are displayed. + */ + rules: string; + /** + * Sets or retrieves a description and/or structure of the object. + */ + summary: string; + /** + * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. + */ + tBodies: HTMLCollectionOf; + /** + * Retrieves the tFoot object of the table. + */ + tFoot: HTMLTableSectionElement; + /** + * Retrieves the tHead object of the table. + */ + tHead: HTMLTableSectionElement; + /** + * Sets or retrieves the width of the object. + */ + width: string; + /** + * Creates an empty caption element in the table. + */ + createCaption(): HTMLTableCaptionElement; + /** + * Creates an empty tBody element in the table. + */ + createTBody(): HTMLTableSectionElement; + /** + * Creates an empty tFoot element in the table. + */ + createTFoot(): HTMLTableSectionElement; + /** + * Returns the tHead element object if successful, or null otherwise. + */ + createTHead(): HTMLTableSectionElement; + /** + * Deletes the caption element and its contents from the table. + */ + deleteCaption(): void; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Deletes the tFoot element and its contents from the table. + */ + deleteTFoot(): void; + /** + * Deletes the tHead element and its contents from the table. + */ + deleteTHead(): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLTableElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableElement: { + prototype: HTMLTableElement; + new(): HTMLTableElement; +} + +interface HTMLTableHeaderCellElement extends HTMLTableCellElement { + /** + * Sets or retrieves the group of cells in a table to which the object's information applies. + */ + scope: string; + addEventListener(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableHeaderCellElement: { + prototype: HTMLTableHeaderCellElement; + new(): HTMLTableHeaderCellElement; +} + +interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves how the object is aligned with adjacent text. + */ + align: string; + bgColor: any; + /** + * Retrieves a collection of all cells in the table row. + */ + cells: HTMLCollectionOf; + /** + * Sets or retrieves the height of the object. + */ + height: any; + /** + * Retrieves the position of the object in the rows collection for the table. + */ + readonly rowIndex: number; + /** + * Retrieves the position of the object in the collection. + */ + readonly sectionRowIndex: number; + /** + * Removes the specified cell from the table row, as well as from the cells collection. + * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. + */ + deleteCell(index?: number): void; + /** + * Creates a new cell in the table row, and adds the cell to the cells collection. + * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. + */ + insertCell(index?: number): HTMLTableDataCellElement; + addEventListener(type: K, listener: (this: HTMLTableRowElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableRowElement: { + prototype: HTMLTableRowElement; + new(): HTMLTableRowElement; +} + +interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { + /** + * Sets or retrieves a value that indicates the table alignment. + */ + align: string; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: HTMLCollectionOf; + /** + * Removes the specified row (tr) from the element and from the rows collection. + * @param index Number that specifies the zero-based position in the rows collection of the row to remove. + */ + deleteRow(index?: number): void; + /** + * Creates a new row (tr) in the table, and adds the row to the rows collection. + * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. + */ + insertRow(index?: number): HTMLTableRowElement; + addEventListener(type: K, listener: (this: HTMLTableSectionElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTableSectionElement: { + prototype: HTMLTableSectionElement; + new(): HTMLTableSectionElement; +} + +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; + addEventListener(type: K, listener: (this: HTMLTemplateElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + +interface HTMLTextAreaElement extends HTMLElement { + /** + * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. + */ + autofocus: boolean; + /** + * Sets or retrieves the width of the object. + */ + cols: number; + /** + * Sets or retrieves the initial contents of the object. + */ + defaultValue: string; + disabled: boolean; + /** + * Retrieves a reference to the form that the object is embedded in. + */ + readonly form: HTMLFormElement; + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + */ + maxLength: number; + /** + * Sets or retrieves the name of the object. + */ + name: string; + /** + * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. + */ + placeholder: string; + /** + * Sets or retrieves the value indicated whether the content of the object is read-only. + */ + readOnly: boolean; + /** + * When present, marks an element that can't be submitted without a value. + */ + required: boolean; + /** + * Sets or retrieves the number of horizontal rows contained in the object. + */ + rows: number; + /** + * Gets or sets the end position or offset of a text selection. + */ + selectionEnd: number; + /** + * Gets or sets the starting position or offset of a text selection. + */ + selectionStart: number; + /** + * Sets or retrieves the value indicating whether the control is selected. + */ + status: any; + /** + * Retrieves the type of control. + */ + readonly type: string; + /** + * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. + */ + readonly validationMessage: string; + /** + * Returns a ValidityState object that represents the validity states of an element. + */ + readonly validity: ValidityState; + /** + * Retrieves or sets the text in the entry field of the textArea element. + */ + value: string; + /** + * Returns whether an element will successfully validate based on forms validation rules and constraints. + */ + readonly willValidate: boolean; + /** + * Sets or retrieves how to handle wordwrapping in the object. + */ + wrap: string; + minLength: number; + /** + * Returns whether a form will validate when it is submitted, without having to submit it. + */ + checkValidity(): boolean; + /** + * Highlights the input area of a form element. + */ + select(): void; + /** + * Sets a custom error message that is displayed when a form is submitted. + * @param error Sets a custom error message that is displayed when a form is submitted. + */ + setCustomValidity(error: string): void; + /** + * Sets the start and end positions of a selection in a text field. + * @param start The offset into the text field for the start of the selection. + * @param end The offset into the text field for the end of the selection. + */ + setSelectionRange(start: number, end: number): void; + addEventListener(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTextAreaElement: { + prototype: HTMLTextAreaElement; + new(): HTMLTextAreaElement; +} + +interface HTMLTimeElement extends HTMLElement { + dateTime: string; + addEventListener(type: K, listener: (this: HTMLTimeElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTimeElement: { + prototype: HTMLTimeElement; + new(): HTMLTimeElement; +} + +interface HTMLTitleElement extends HTMLElement { + /** + * Retrieves or sets the text of the object as a string. + */ + text: string; + addEventListener(type: K, listener: (this: HTMLTitleElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTitleElement: { + prototype: HTMLTitleElement; + new(): HTMLTitleElement; +} + +interface HTMLTrackElement extends HTMLElement { + default: boolean; + kind: string; + label: string; + readonly readyState: number; + src: string; + srclang: string; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + addEventListener(type: K, listener: (this: HTMLTrackElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLTrackElement: { + prototype: HTMLTrackElement; + new(): HTMLTrackElement; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; +} + +interface HTMLUListElement extends HTMLElement { + compact: boolean; + type: string; + addEventListener(type: K, listener: (this: HTMLUListElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLUListElement: { + prototype: HTMLUListElement; + new(): HTMLUListElement; +} + +interface HTMLUnknownElement extends HTMLElement { + addEventListener(type: K, listener: (this: HTMLUnknownElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLUnknownElement: { + prototype: HTMLUnknownElement; + new(): HTMLUnknownElement; +} + +interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { + "MSVideoFormatChanged": Event; + "MSVideoFrameStepCompleted": Event; + "MSVideoOptimalLayoutChanged": Event; +} + +interface HTMLVideoElement extends HTMLMediaElement { + /** + * Gets or sets the height of the video element. + */ + height: number; + msHorizontalMirror: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; + msStereo3DPackingMode: string; + msStereo3DRenderMode: string; + msZoom: boolean; + onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; + onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; + /** + * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. + */ + poster: string; + /** + * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoHeight: number; + /** + * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. + */ + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; + /** + * Gets or sets the width of the video element. + */ + width: number; + getVideoPlaybackQuality(): VideoPlaybackQuality; + msFrameStep(forward: boolean): void; + msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; + msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; + webkitEnterFullScreen(): void; + webkitEnterFullscreen(): void; + webkitExitFullScreen(): void; + webkitExitFullscreen(): void; + addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var HTMLVideoElement: { + prototype: HTMLVideoElement; + new(): HTMLVideoElement; +} + +interface HashChangeEvent extends Event { + readonly newURL: string | null; + readonly oldURL: string | null; +} + +declare var HashChangeEvent: { + prototype: HashChangeEvent; + new(typeArg: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; +} + +interface Headers { + append(name: string, value: string): void; + delete(name: string): void; + forEach(callback: ForEachCallback): void; + get(name: string): string | null; + has(name: string): boolean; + set(name: string, value: string): void; +} + +declare var Headers: { + prototype: Headers; + new(init?: any): Headers; +} + +interface History { + readonly length: number; + readonly state: any; + scrollRestoration: ScrollRestoration; + back(): void; + forward(): void; + go(delta?: number): void; + pushState(data: any, title: string, url?: string | null): void; + replaceState(data: any, title: string, url?: string | null): void; +} + +declare var History: { + prototype: History; + new(): History; +} + +interface IDBCursor { + readonly direction: IDBCursorDirection; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabaseEventMap { + "abort": Event; + "error": Event; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: Event) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequestEventMap { + "error": Event; + "success": Event; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: IDBRequest, ev: Event) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; + readonly readyState: IDBRequestReadyState; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": Event; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: IDBTransactionMode; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: Event) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface IIRFilterNode extends AudioNode { + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var IIRFilterNode: { + prototype: IIRFilterNode; + new(): IIRFilterNode; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface IntersectionObserver { + readonly root: Element | null; + readonly rootMargin: string; + readonly thresholds: number[]; + disconnect(): void; + observe(target: Element): void; + takeRecords(): IntersectionObserverEntry[]; + unobserve(target: Element): void; +} + +declare var IntersectionObserver: { + prototype: IntersectionObserver; + new(callback: IntersectionObserverCallback, options?: IntersectionObserverInit): IntersectionObserver; +} + +interface IntersectionObserverEntry { + readonly boundingClientRect: ClientRect; + readonly intersectionRatio: number; + readonly intersectionRect: ClientRect; + readonly rootBounds: ClientRect; + readonly target: Element; + readonly time: number; +} + +declare var IntersectionObserverEntry: { + prototype: IntersectionObserverEntry; + new(intersectionObserverEntryInit: IntersectionObserverEntryInit): IntersectionObserverEntry; +} + +interface KeyboardEvent extends UIEvent { + readonly altKey: boolean; + readonly char: string | null; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; + readonly code: string; + getModifierState(keyArg: string): boolean; + initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +declare var KeyboardEvent: { + prototype: KeyboardEvent; + new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: ListeningState; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; +} + +interface Location { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + pathname: string; + port: string; + protocol: string; + search: string; + assign(url: string): void; + reload(forcedReload?: boolean): void; + replace(url: string): void; + toString(): string; +} + +declare var Location: { + prototype: Location; + new(): Location; +} + +interface LongRunningScriptDetectedEvent extends Event { + readonly executionTime: number; + stopPageScriptExecution: boolean; +} + +declare var LongRunningScriptDetectedEvent: { + prototype: LongRunningScriptDetectedEvent; + new(): LongRunningScriptDetectedEvent; +} + +interface MSApp { + clearTemporaryWebDataAsync(): MSAppAsyncOperation; + createBlobFromRandomAccessStream(type: string, seeker: any): Blob; + createDataPackage(object: any): any; + createDataPackageFromSelection(): any; + createFileFromStorageFile(storageFile: any): File; + createStreamFromInputStream(type: string, inputStream: any): MSStream; + execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; + execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; + getCurrentPriority(): string; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): Promise; + getViewId(view: any): any; + isTaskScheduledAtPriorityOrHigher(priority: string): boolean; + pageHandlesAllApplicationActivations(enabled: boolean): void; + suppressSubdownloadCredentialPrompts(suppress: boolean): void; + terminateApp(exceptionObject: any): void; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; +} +declare var MSApp: MSApp; + +interface MSAppAsyncOperationEventMap { + "complete": Event; + "error": Event; +} + +interface MSAppAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; + onerror: (this: MSAppAsyncOperation, ev: Event) => any; + readonly readyState: number; + readonly result: any; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: MSCredentialType; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; +} + +interface MSBlobBuilder { + append(data: any, endings?: string): void; + getBlob(contentType?: string): Blob; +} + +declare var MSBlobBuilder: { + prototype: MSBlobBuilder; + new(): MSBlobBuilder; +} + +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): Promise; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): Promise; +} + +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: MSTransportType[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; +} + +interface MSGesture { + target: Element; + addPointer(pointerId: number): void; + stop(): void; +} + +declare var MSGesture: { + prototype: MSGesture; + new(): MSGesture; +} + +interface MSGestureEvent extends UIEvent { + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; + initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +declare var MSGestureEvent: { + prototype: MSGestureEvent; + new(): MSGestureEvent; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; +} + +interface MSGraphicsTrust { + readonly constrictionActive: boolean; + readonly status: string; +} + +declare var MSGraphicsTrust: { + prototype: MSGraphicsTrust; + new(): MSGraphicsTrust; +} + +interface MSHTMLWebViewElement extends HTMLElement { + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; + height: number; + readonly settings: MSWebViewSettings; + src: string; + width: number; + addWebAllowedObject(name: string, applicationObject: any): void; + buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; + capturePreviewToBlobAsync(): MSWebViewAsyncOperation; + captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; + getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; + getDeferredPermissionRequests(): DeferredPermissionRequest[]; + goBack(): void; + goForward(): void; + invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; + navigate(uri: string): void; + navigateFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; + navigateToLocalStreamUri(source: string, streamResolver: any): void; + navigateToString(contents: string): void; + navigateWithHttpRequestMessage(requestMessage: any): void; + refresh(): void; + stop(): void; + addEventListener(type: K, listener: (this: MSHTMLWebViewElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSHTMLWebViewElement: { + prototype: MSHTMLWebViewElement; + new(): MSHTMLWebViewElement; +} + +interface MSInputMethodContextEventMap { + "MSCandidateWindowHide": Event; + "MSCandidateWindowShow": Event; + "MSCandidateWindowUpdate": Event; +} + +interface MSInputMethodContext extends EventTarget { + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; + oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; + oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; + readonly target: HTMLElement; + getCandidateWindowClientRect(): ClientRect; + getCompositionAlternatives(): string[]; + hasComposition(): boolean; + isCandidateWindowVisible(): boolean; + addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSInputMethodContext: { + prototype: MSInputMethodContext; + new(): MSInputMethodContext; +} + +interface MSManipulationEvent extends UIEvent { + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; + initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +declare var MSManipulationEvent: { + prototype: MSManipulationEvent; + new(): MSManipulationEvent; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; +} + +interface MSMediaKeyError { + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +declare var MSMediaKeyError: { + prototype: MSMediaKeyError; + new(): MSMediaKeyError; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; +} + +interface MSMediaKeyMessageEvent extends Event { + readonly destinationURL: string | null; + readonly message: Uint8Array; +} + +declare var MSMediaKeyMessageEvent: { + prototype: MSMediaKeyMessageEvent; + new(): MSMediaKeyMessageEvent; +} + +interface MSMediaKeyNeededEvent extends Event { + readonly initData: Uint8Array | null; +} + +declare var MSMediaKeyNeededEvent: { + prototype: MSMediaKeyNeededEvent; + new(): MSMediaKeyNeededEvent; +} + +interface MSMediaKeySession extends EventTarget { + readonly error: MSMediaKeyError | null; + readonly keySystem: string; + readonly sessionId: string; + close(): void; + update(key: Uint8Array): void; +} + +declare var MSMediaKeySession: { + prototype: MSMediaKeySession; + new(): MSMediaKeySession; +} + +interface MSMediaKeys { + readonly keySystem: string; + createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; +} + +declare var MSMediaKeys: { + prototype: MSMediaKeys; + new(keySystem: string): MSMediaKeys; + isTypeSupported(keySystem: string, type?: string): boolean; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; +} + +interface MSPointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var MSPointerEvent: { + prototype: MSPointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; +} + +interface MSRangeCollection { + readonly length: number; + item(index: number): Range; + [index: number]: Range; +} + +declare var MSRangeCollection: { + prototype: MSRangeCollection; + new(): MSRangeCollection; +} + +interface MSSiteModeEvent extends Event { + readonly actionURL: string; + readonly buttonID: number; +} + +declare var MSSiteModeEvent: { + prototype: MSSiteModeEvent; + new(): MSSiteModeEvent; +} + +interface MSStream { + readonly type: string; + msClose(): void; + msDetachStream(): any; +} + +declare var MSStream: { + prototype: MSStream; + new(): MSStream; +} + +interface MSStreamReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(stream: MSStream, size?: number): void; + readAsBinaryString(stream: MSStream, size?: number): void; + readAsBlob(stream: MSStream, size?: number): void; + readAsDataURL(stream: MSStream, size?: number): void; + readAsText(stream: MSStream, encoding?: string, size?: number): void; + addEventListener(type: K, listener: (this: MSStreamReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSStreamReader: { + prototype: MSStreamReader; + new(): MSStreamReader; +} + +interface MSWebViewAsyncOperationEventMap { + "complete": Event; + "error": Event; +} + +interface MSWebViewAsyncOperation extends EventTarget { + readonly error: DOMError; + oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; + onerror: (this: MSWebViewAsyncOperation, ev: Event) => any; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; + start(): void; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; + addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSWebViewAsyncOperation: { + prototype: MSWebViewAsyncOperation; + new(): MSWebViewAsyncOperation; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; +} + +interface MSWebViewSettings { + isIndexedDBEnabled: boolean; + isJavaScriptEnabled: boolean; +} + +declare var MSWebViewSettings: { + prototype: MSWebViewSettings; + new(): MSWebViewSettings; +} + +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: MediaDeviceKind; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevicesEventMap { + "devicechange": Event; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (this: MediaDevices, ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): Promise; + addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + +interface MediaElementAudioSourceNode extends AudioNode { +} + +declare var MediaElementAudioSourceNode: { + prototype: MediaElementAudioSourceNode; + new(): MediaElementAudioSourceNode; +} + +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer | null; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + +interface MediaError { + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +declare var MediaError: { + prototype: MediaError; + new(): MediaError; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: MediaKeyMessageType; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: Promise; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): Promise; + generateRequest(initDataType: string, initData: any): Promise; + load(sessionId: string): Promise; + remove(): Promise; + update(response: any): Promise; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): MediaKeyStatus; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): Promise; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: MediaKeySessionType): MediaKeySession; + setServerCertificate(serverCertificate: any): Promise; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; +} + +interface MediaList { + readonly length: number; + mediaText: string; + appendMedium(newMedium: string): void; + deleteMedium(oldMedium: string): void; + item(index: number): string; + toString(): string; + [index: number]: string; +} + +declare var MediaList: { + prototype: MediaList; + new(): MediaList; +} + +interface MediaQueryList { + readonly matches: boolean; + readonly media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + +interface MediaSource extends EventTarget { + readonly activeSourceBuffers: SourceBufferList; + duration: number; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; + addSourceBuffer(type: string): SourceBuffer; + endOfStream(error?: number): void; + removeSourceBuffer(sourceBuffer: SourceBuffer): void; +} + +declare var MediaSource: { + prototype: MediaSource; + new(): MediaSource; + isTypeSupported(type: string): boolean; +} + +interface MediaStreamEventMap { + "active": Event; + "addtrack": MediaStreamTrackEvent; + "inactive": Event; + "removetrack": MediaStreamTrackEvent; +} + +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (this: MediaStream, ev: Event) => any; + onaddtrack: (this: MediaStream, ev: MediaStreamTrackEvent) => any; + oninactive: (this: MediaStream, ev: Event) => any; + onremovetrack: (this: MediaStream, ev: MediaStreamTrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack | null; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string | null; + readonly message: string | null; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError | null; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(typeArg: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamEvent extends Event { + readonly stream: MediaStream | null; +} + +declare var MediaStreamEvent: { + prototype: MediaStreamEvent; + new(type: string, eventInitDict: MediaStreamEventInit): MediaStreamEvent; +} + +interface MediaStreamTrackEventMap { + "ended": MediaStreamErrorEvent; + "mute": Event; + "overconstrained": MediaStreamErrorEvent; + "unmute": Event; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onmute: (this: MediaStreamTrack, ev: Event) => any; + onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; + onunmute: (this: MediaStreamTrack, ev: Event) => any; + readonly readonly: boolean; + readonly readyState: MediaStreamTrackState; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): Promise; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(typeArg: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePortEventMap { + "message": MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: MessagePort, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, transfer?: any[]): void; + start(): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface MimeType { + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; +} + +declare var MimeType: { + prototype: MimeType; + new(): MimeType; +} + +interface MimeTypeArray { + readonly length: number; + item(index: number): Plugin; + namedItem(type: string): Plugin; + [index: number]: Plugin; +} + +declare var MimeTypeArray: { + prototype: MimeTypeArray; + new(): MimeTypeArray; +} + +interface MouseEvent extends UIEvent { + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; + getModifierState(keyArg: string): boolean; + initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; +} + +declare var MouseEvent: { + prototype: MouseEvent; + new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; +} + +interface MutationEvent extends Event { + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; + initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +declare var MutationEvent: { + prototype: MutationEvent; + new(): MutationEvent; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; +} + +interface MutationObserver { + disconnect(): void; + observe(target: Node, options: MutationObserverInit): void; + takeRecords(): MutationRecord[]; +} + +declare var MutationObserver: { + prototype: MutationObserver; + new(callback: MutationCallback): MutationObserver; +} + +interface MutationRecord { + readonly addedNodes: NodeList; + readonly attributeName: string | null; + readonly attributeNamespace: string | null; + readonly nextSibling: Node | null; + readonly oldValue: string | null; + readonly previousSibling: Node | null; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; +} + +declare var MutationRecord: { + prototype: MutationRecord; + new(): MutationRecord; +} + +interface NamedNodeMap { + readonly length: number; + getNamedItem(name: string): Attr; + getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + item(index: number): Attr; + removeNamedItem(name: string): Attr; + removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; + setNamedItem(arg: Attr): Attr; + setNamedItemNS(arg: Attr): Attr; + [index: number]: Attr; +} + +declare var NamedNodeMap: { + prototype: NamedNodeMap; + new(): NamedNodeMap; +} + +interface NavigationCompletedEvent extends NavigationEvent { + readonly isSuccess: boolean; + readonly webErrorStatus: number; +} + +declare var NavigationCompletedEvent: { + prototype: NavigationCompletedEvent; + new(): NavigationCompletedEvent; +} + +interface NavigationEvent extends Event { + readonly uri: string; +} + +declare var NavigationEvent: { + prototype: NavigationEvent; + new(): NavigationEvent; +} + +interface NavigationEventWithReferrer extends NavigationEvent { + readonly referer: string; +} + +declare var NavigationEventWithReferrer: { + prototype: NavigationEventWithReferrer; + new(): NavigationEventWithReferrer; +} + +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia { + readonly authentication: WebAuthentication; + readonly cookieEnabled: boolean; + gamepadInputEmulation: GamepadInputEmulationType; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly serviceWorker: ServiceWorkerContainer; + readonly webdriver: boolean; + readonly hardwareConcurrency: number; + getGamepads(): Gamepad[]; + javaEnabled(): boolean; + msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; + vibrate(pattern: number | number[]): boolean; +} + +declare var Navigator: { + prototype: Navigator; + new(): Navigator; +} + +interface Node extends EventTarget { + readonly attributes: NamedNodeMap; + readonly baseURI: string | null; + readonly childNodes: NodeList; + readonly firstChild: Node | null; + readonly lastChild: Node | null; + readonly localName: string | null; + readonly namespaceURI: string | null; + readonly nextSibling: Node | null; + readonly nodeName: string; + readonly nodeType: number; + nodeValue: string | null; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement | null; + readonly parentNode: Node | null; + readonly previousSibling: Node | null; + textContent: string | null; + appendChild(newChild: T): T; + cloneNode(deep?: boolean): Node; + compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; + hasAttributes(): boolean; + hasChildNodes(): boolean; + insertBefore(newChild: T, refChild: Node | null): T; + isDefaultNamespace(namespaceURI: string | null): boolean; + isEqualNode(arg: Node): boolean; + isSameNode(other: Node): boolean; + lookupNamespaceURI(prefix: string | null): string | null; + lookupPrefix(namespaceURI: string | null): string | null; + normalize(): void; + removeChild(oldChild: T): T; + replaceChild(newChild: Node, oldChild: T): T; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +declare var Node: { + prototype: Node; + new(): Node; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; +} + +interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; +} + +interface NodeIterator { + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + detach(): void; + nextNode(): Node; + previousNode(): Node; +} + +declare var NodeIterator: { + prototype: NodeIterator; + new(): NodeIterator; +} + +interface NodeList { + readonly length: number; + item(index: number): Node; + [index: number]: Node; +} + +declare var NodeList: { + prototype: NodeList; + new(): NodeList; +} + +interface NotificationEventMap { + "click": Event; + "close": Event; + "error": Event; + "show": Event; +} + +interface Notification extends EventTarget { + readonly body: string; + readonly dir: NotificationDirection; + readonly icon: string; + readonly lang: string; + onclick: (this: Notification, ev: Event) => any; + onclose: (this: Notification, ev: Event) => any; + onerror: (this: Notification, ev: Event) => any; + onshow: (this: Notification, ev: Event) => any; + readonly permission: NotificationPermission; + readonly tag: string; + readonly title: string; + close(): void; + addEventListener(type: K, listener: (this: Notification, ev: NotificationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Notification: { + prototype: Notification; + new(title: string, options?: NotificationOptions): Notification; + requestPermission(callback?: NotificationPermissionCallback): Promise; +} + +interface OES_element_index_uint { +} + +declare var OES_element_index_uint: { + prototype: OES_element_index_uint; + new(): OES_element_index_uint; +} + +interface OES_standard_derivatives { + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +declare var OES_standard_derivatives: { + prototype: OES_standard_derivatives; + new(): OES_standard_derivatives; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; +} + +interface OES_texture_float { +} + +declare var OES_texture_float: { + prototype: OES_texture_float; + new(): OES_texture_float; +} + +interface OES_texture_float_linear { +} + +declare var OES_texture_float_linear: { + prototype: OES_texture_float_linear; + new(): OES_texture_float_linear; +} + +interface OES_texture_half_float { + readonly HALF_FLOAT_OES: number; +} + +declare var OES_texture_half_float: { + prototype: OES_texture_half_float; + new(): OES_texture_half_float; + readonly HALF_FLOAT_OES: number; +} + +interface OES_texture_half_float_linear { +} + +declare var OES_texture_half_float_linear: { + prototype: OES_texture_half_float_linear; + new(): OES_texture_half_float_linear; +} + +interface OfflineAudioCompletionEvent extends Event { + readonly renderedBuffer: AudioBuffer; +} + +declare var OfflineAudioCompletionEvent: { + prototype: OfflineAudioCompletionEvent; + new(): OfflineAudioCompletionEvent; +} + +interface OfflineAudioContextEventMap extends AudioContextEventMap { + "complete": OfflineAudioCompletionEvent; +} + +interface OfflineAudioContext extends AudioContextBase { + readonly length: number; + oncomplete: (this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any; + startRendering(): Promise; + suspend(suspendTime: number): Promise; + addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OfflineAudioContext: { + prototype: OfflineAudioContext; + new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; +} + +interface OscillatorNodeEventMap { + "ended": MediaStreamErrorEvent; +} + +interface OscillatorNode extends AudioNode { + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; + type: OscillatorType; + setPeriodicWave(periodicWave: PeriodicWave): void; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var OscillatorNode: { + prototype: OscillatorNode; + new(): OscillatorNode; +} + +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +interface PageTransitionEvent extends Event { + readonly persisted: boolean; +} + +declare var PageTransitionEvent: { + prototype: PageTransitionEvent; + new(): PageTransitionEvent; +} + +interface PannerNode extends AudioNode { + coneInnerAngle: number; + coneOuterAngle: number; + coneOuterGain: number; + distanceModel: DistanceModelType; + maxDistance: number; + panningModel: PanningModelType; + refDistance: number; + rolloffFactor: number; + setOrientation(x: number, y: number, z: number): void; + setPosition(x: number, y: number, z: number): void; + setVelocity(x: number, y: number, z: number): void; +} + +declare var PannerNode: { + prototype: PannerNode; + new(): PannerNode; +} + +interface Path2D extends Object, CanvasPathMethods { +} + +declare var Path2D: { + prototype: Path2D; + new(path?: Path2D): Path2D; +} + +interface PaymentAddress { + readonly addressLine: string[]; + readonly city: string; + readonly country: string; + readonly dependentLocality: string; + readonly languageCode: string; + readonly organization: string; + readonly phone: string; + readonly postalCode: string; + readonly recipient: string; + readonly region: string; + readonly sortingCode: string; + toJSON(): any; +} + +declare var PaymentAddress: { + prototype: PaymentAddress; + new(): PaymentAddress; +} + +interface PaymentRequestEventMap { + "shippingaddresschange": Event; + "shippingoptionchange": Event; +} + +interface PaymentRequest extends EventTarget { + onshippingaddresschange: (this: PaymentRequest, ev: Event) => any; + onshippingoptionchange: (this: PaymentRequest, ev: Event) => any; + readonly shippingAddress: PaymentAddress | null; + readonly shippingOption: string | null; + readonly shippingType: PaymentShippingType | null; + abort(): Promise; + show(): Promise; + addEventListener(type: K, listener: (this: PaymentRequest, ev: PaymentRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var PaymentRequest: { + prototype: PaymentRequest; + new(methodData: PaymentMethodData[], details: PaymentDetails, options?: PaymentOptions): PaymentRequest; +} + +interface PaymentRequestUpdateEvent extends Event { + updateWith(d: Promise): void; +} + +declare var PaymentRequestUpdateEvent: { + prototype: PaymentRequestUpdateEvent; + new(type: string, eventInitDict?: PaymentRequestUpdateEventInit): PaymentRequestUpdateEvent; +} + +interface PaymentResponse { + readonly details: any; + readonly methodName: string; + readonly payerEmail: string | null; + readonly payerName: string | null; + readonly payerPhone: string | null; + readonly shippingAddress: PaymentAddress | null; + readonly shippingOption: string | null; + complete(result?: PaymentComplete): Promise; + toJSON(): any; +} + +declare var PaymentResponse: { + prototype: PaymentResponse; + new(): PaymentResponse; +} + +interface PerfWidgetExternal { + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; + addEventListener(eventType: string, callback: Function): void; + getMemoryUsage(): number; + getProcessCpuUsage(): number; + getRecentCpuUsage(last: number | null): any; + getRecentFrames(last: number | null): any; + getRecentMemoryUsage(last: number | null): any; + getRecentPaintRequests(last: number | null): any; + removeEventListener(eventType: string, callback: Function): void; + repositionWindow(x: number, y: number): void; + resizeWindow(width: number, height: number): void; +} + +declare var PerfWidgetExternal: { + prototype: PerfWidgetExternal; + new(): PerfWidgetExternal; +} + +interface Performance { + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; + clearMarks(markName?: string): void; + clearMeasures(measureName?: string): void; + clearResourceTimings(): void; + getEntries(): any; + getEntriesByName(name: string, entryType?: string): any; + getEntriesByType(entryType: string): any; + getMarks(markName?: string): any; + getMeasures(measureName?: string): any; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): any; +} + +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface PerformanceEntry { + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; +} + +declare var PerformanceEntry: { + prototype: PerformanceEntry; + new(): PerformanceEntry; +} + +interface PerformanceMark extends PerformanceEntry { +} + +declare var PerformanceMark: { + prototype: PerformanceMark; + new(): PerformanceMark; +} + +interface PerformanceMeasure extends PerformanceEntry { +} + +declare var PerformanceMeasure: { + prototype: PerformanceMeasure; + new(): PerformanceMeasure; +} + +interface PerformanceNavigation { + readonly redirectCount: number; + readonly type: number; + toJSON(): any; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +interface PerformanceNavigationTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: NavigationType; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; +} + +declare var PerformanceNavigationTiming: { + prototype: PerformanceNavigationTiming; + new(): PerformanceNavigationTiming; +} + +interface PerformanceResourceTiming extends PerformanceEntry { + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; +} + +declare var PerformanceResourceTiming: { + prototype: PerformanceResourceTiming; + new(): PerformanceResourceTiming; +} + +interface PerformanceTiming { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; + readonly secureConnectionStart: number; + toJSON(): any; +} + +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface PeriodicWave { +} + +declare var PeriodicWave: { + prototype: PeriodicWave; + new(): PeriodicWave; +} + +interface PermissionRequest extends DeferredPermissionRequest { + readonly state: MSWebViewPermissionState; + defer(): void; +} + +declare var PermissionRequest: { + prototype: PermissionRequest; + new(): PermissionRequest; +} + +interface PermissionRequestedEvent extends Event { + readonly permissionRequest: PermissionRequest; +} + +declare var PermissionRequestedEvent: { + prototype: PermissionRequestedEvent; + new(): PermissionRequestedEvent; +} + +interface Plugin { + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; + item(index: number): MimeType; + namedItem(type: string): MimeType; + [index: number]: MimeType; +} + +declare var Plugin: { + prototype: Plugin; + new(): Plugin; +} + +interface PluginArray { + readonly length: number; + item(index: number): Plugin; + namedItem(name: string): Plugin; + refresh(reload?: boolean): void; + [index: number]: Plugin; +} + +declare var PluginArray: { + prototype: PluginArray; + new(): PluginArray; +} + +interface PointerEvent extends MouseEvent { + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; + getCurrentPoint(element: Element): void; + getIntermediatePoints(element: Element): void; + initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; +} + +declare var PointerEvent: { + prototype: PointerEvent; + new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; +} + +interface PopStateEvent extends Event { + readonly state: any; + initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; +} + +declare var PopStateEvent: { + prototype: PopStateEvent; + new(typeArg: string, eventInitDict?: PopStateEventInit): PopStateEvent; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProcessingInstruction extends CharacterData { + readonly target: string; +} + +declare var ProcessingInstruction: { + prototype: ProcessingInstruction; + new(): ProcessingInstruction; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface PushManager { + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; +} + +declare var PushManager: { + prototype: PushManager; + new(): PushManager; +} + +interface PushSubscription { + readonly endpoint: USVString; + readonly options: PushSubscriptionOptions; + getKey(name: PushEncryptionKeyName): ArrayBuffer | null; + toJSON(): any; + unsubscribe(): Promise; +} + +declare var PushSubscription: { + prototype: PushSubscription; + new(): PushSubscription; +} + +interface PushSubscriptionOptions { + readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; +} + +declare var PushSubscriptionOptions: { + prototype: PushSubscriptionOptions; + new(): PushSubscriptionOptions; +} + +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(typeArg: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransportEventMap { + "dtlsstatechange": RTCDtlsTransportStateChangedEvent; + "error": Event; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; + onerror: ((this: RTCDtlsTransport, ev: Event) => any) | null; + readonly state: RTCDtlsTransportState; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters | null; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: RTCDtlsTransportState; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSenderEventMap { + "tonechange": RTCDTMFToneChangeEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidate { + candidate: string | null; + sdpMLineIndex: number | null; + sdpMid: string | null; + toJSON(): any; +} + +declare var RTCIceCandidate: { + prototype: RTCIceCandidate; + new(candidateInitDict?: RTCIceCandidateInit): RTCIceCandidate; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGathererEventMap { + "error": Event; + "localcandidate": RTCIceGathererEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: RTCIceComponent; + onerror: ((this: RTCIceGatherer, ev: Event) => any) | null; + onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidateDictionary[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidateDictionary | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransportEventMap { + "candidatepairchange": RTCIceCandidatePairChangedEvent; + "icestatechange": RTCIceTransportStateChangedEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: RTCIceComponent; + readonly iceGatherer: RTCIceGatherer | null; + oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; + onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; + readonly role: RTCIceRole; + readonly state: RTCIceTransportState; + addRemoteCandidate(remoteCandidate: RTCIceCandidateDictionary | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair | null; + getRemoteCandidates(): RTCIceCandidateDictionary[]; + getRemoteParameters(): RTCIceParameters | null; + setRemoteCandidates(remoteCandidates: RTCIceCandidateDictionary[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: RTCIceRole): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: RTCIceTransportState; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCPeerConnectionEventMap { + "addstream": MediaStreamEvent; + "icecandidate": RTCPeerConnectionIceEvent; + "iceconnectionstatechange": Event; + "icegatheringstatechange": Event; + "negotiationneeded": Event; + "removestream": MediaStreamEvent; + "signalingstatechange": Event; +} + +interface RTCPeerConnection extends EventTarget { + readonly canTrickleIceCandidates: boolean | null; + readonly iceConnectionState: RTCIceConnectionState; + readonly iceGatheringState: RTCIceGatheringState; + readonly localDescription: RTCSessionDescription | null; + onaddstream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any; + onicecandidate: (this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any; + oniceconnectionstatechange: (this: RTCPeerConnection, ev: Event) => any; + onicegatheringstatechange: (this: RTCPeerConnection, ev: Event) => any; + onnegotiationneeded: (this: RTCPeerConnection, ev: Event) => any; + onremovestream: (this: RTCPeerConnection, ev: MediaStreamEvent) => any; + onsignalingstatechange: (this: RTCPeerConnection, ev: Event) => any; + readonly remoteDescription: RTCSessionDescription | null; + readonly signalingState: RTCSignalingState; + addIceCandidate(candidate: RTCIceCandidate, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + addStream(stream: MediaStream): void; + close(): void; + createAnswer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + createOffer(successCallback?: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, options?: RTCOfferOptions): Promise; + getConfiguration(): RTCConfiguration; + getLocalStreams(): MediaStream[]; + getRemoteStreams(): MediaStream[]; + getStats(selector: MediaStreamTrack | null, successCallback?: RTCStatsCallback, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + getStreamById(streamId: string): MediaStream | null; + removeStream(stream: MediaStream): void; + setLocalDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + setRemoteDescription(description: RTCSessionDescription, successCallback?: VoidFunction, failureCallback?: RTCPeerConnectionErrorCallback): Promise; + addEventListener(type: K, listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCPeerConnection: { + prototype: RTCPeerConnection; + new(configuration: RTCConfiguration): RTCPeerConnection; +} + +interface RTCPeerConnectionIceEvent extends Event { + readonly candidate: RTCIceCandidate; +} + +declare var RTCPeerConnectionIceEvent: { + prototype: RTCPeerConnectionIceEvent; + new(type: string, eventInitDict: RTCPeerConnectionIceEventInit): RTCPeerConnectionIceEvent; +} + +interface RTCRtpReceiverEventMap { + "error": Event; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: ((this: RTCRtpReceiver, ev: Event) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack | null; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSenderEventMap { + "error": Event; + "ssrcconflict": RTCSsrcConflictEvent; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: ((this: RTCRtpSender, ev: Event) => any) | null; + onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSessionDescription { + sdp: string | null; + type: RTCSdpType | null; + toJSON(): any; +} + +declare var RTCSessionDescription: { + prototype: RTCSessionDescription; + new(descriptionInitDict?: RTCSessionDescriptionInit): RTCSessionDescription; +} + +interface RTCSrtpSdesTransportEventMap { + "error": Event; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: ((this: RTCSrtpSdesTransport, ev: Event) => any) | null; + readonly transport: RTCIceTransport; + addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): Promise; + msGetStats(): Promise; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + +interface Range { + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; + cloneContents(): DocumentFragment; + cloneRange(): Range; + collapse(toStart: boolean): void; + compareBoundaryPoints(how: number, sourceRange: Range): number; + createContextualFragment(fragment: string): DocumentFragment; + deleteContents(): void; + detach(): void; + expand(Unit: ExpandGranularity): boolean; + extractContents(): DocumentFragment; + getBoundingClientRect(): ClientRect; + getClientRects(): ClientRectList; + insertNode(newNode: Node): void; + selectNode(refNode: Node): void; + selectNodeContents(refNode: Node): void; + setEnd(refNode: Node, offset: number): void; + setEndAfter(refNode: Node): void; + setEndBefore(refNode: Node): void; + setStart(refNode: Node, offset: number): void; + setStartAfter(refNode: Node): void; + setStartBefore(refNode: Node): void; + surroundContents(newParent: Node): void; + toString(): string; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +declare var Range: { + prototype: Range; + new(): Range; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; +} + +interface ReadableStream { + readonly locked: boolean; + cancel(): Promise; + getReader(): ReadableStreamReader; +} + +declare var ReadableStream: { + prototype: ReadableStream; + new(): ReadableStream; +} + +interface ReadableStreamReader { + cancel(): Promise; + read(): Promise; + releaseLock(): void; +} + +declare var ReadableStreamReader: { + prototype: ReadableStreamReader; + new(): ReadableStreamReader; +} + +interface Request extends Object, Body { + readonly cache: RequestCache; + readonly credentials: RequestCredentials; + readonly destination: RequestDestination; + readonly headers: Headers; + readonly integrity: string; + readonly keepalive: boolean; + readonly method: string; + readonly mode: RequestMode; + readonly redirect: RequestRedirect; + readonly referrer: string; + readonly referrerPolicy: ReferrerPolicy; + readonly type: RequestType; + readonly url: string; + clone(): Request; +} + +declare var Request: { + prototype: Request; + new(input: Request | string, init?: RequestInit): Request; +} + +interface Response extends Object, Body { + readonly body: ReadableStream | null; + readonly headers: Headers; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly type: ResponseType; + readonly url: string; + clone(): Response; +} + +declare var Response: { + prototype: Response; + new(body?: any, init?: ResponseInit): Response; +} + +interface SVGAElement extends SVGGraphicsElement, SVGURIReference { + readonly target: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGAElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGAElement: { + prototype: SVGAElement; + new(): SVGAElement; +} + +interface SVGAngle { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +declare var SVGAngle: { + prototype: SVGAngle; + new(): SVGAngle; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; +} + +interface SVGAnimatedAngle { + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; +} + +declare var SVGAnimatedAngle: { + prototype: SVGAnimatedAngle; + new(): SVGAnimatedAngle; +} + +interface SVGAnimatedBoolean { + readonly animVal: boolean; + baseVal: boolean; +} + +declare var SVGAnimatedBoolean: { + prototype: SVGAnimatedBoolean; + new(): SVGAnimatedBoolean; +} + +interface SVGAnimatedEnumeration { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedEnumeration: { + prototype: SVGAnimatedEnumeration; + new(): SVGAnimatedEnumeration; +} + +interface SVGAnimatedInteger { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedInteger: { + prototype: SVGAnimatedInteger; + new(): SVGAnimatedInteger; +} + +interface SVGAnimatedLength { + readonly animVal: SVGLength; + readonly baseVal: SVGLength; +} + +declare var SVGAnimatedLength: { + prototype: SVGAnimatedLength; + new(): SVGAnimatedLength; +} + +interface SVGAnimatedLengthList { + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; +} + +declare var SVGAnimatedLengthList: { + prototype: SVGAnimatedLengthList; + new(): SVGAnimatedLengthList; +} + +interface SVGAnimatedNumber { + readonly animVal: number; + baseVal: number; +} + +declare var SVGAnimatedNumber: { + prototype: SVGAnimatedNumber; + new(): SVGAnimatedNumber; +} + +interface SVGAnimatedNumberList { + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; +} + +declare var SVGAnimatedNumberList: { + prototype: SVGAnimatedNumberList; + new(): SVGAnimatedNumberList; +} + +interface SVGAnimatedPreserveAspectRatio { + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; +} + +declare var SVGAnimatedPreserveAspectRatio: { + prototype: SVGAnimatedPreserveAspectRatio; + new(): SVGAnimatedPreserveAspectRatio; +} + +interface SVGAnimatedRect { + readonly animVal: SVGRect; + readonly baseVal: SVGRect; +} + +declare var SVGAnimatedRect: { + prototype: SVGAnimatedRect; + new(): SVGAnimatedRect; +} + +interface SVGAnimatedString { + readonly animVal: string; + baseVal: string; +} + +declare var SVGAnimatedString: { + prototype: SVGAnimatedString; + new(): SVGAnimatedString; +} + +interface SVGAnimatedTransformList { + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; +} + +declare var SVGAnimatedTransformList: { + prototype: SVGAnimatedTransformList; + new(): SVGAnimatedTransformList; +} + +interface SVGCircleElement extends SVGGraphicsElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGCircleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGCircleElement: { + prototype: SVGCircleElement; + new(): SVGCircleElement; +} + +interface SVGClipPathElement extends SVGGraphicsElement, SVGUnitTypes { + readonly clipPathUnits: SVGAnimatedEnumeration; + addEventListener(type: K, listener: (this: SVGClipPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGClipPathElement: { + prototype: SVGClipPathElement; + new(): SVGClipPathElement; +} + +interface SVGComponentTransferFunctionElement extends SVGElement { + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGComponentTransferFunctionElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGComponentTransferFunctionElement: { + prototype: SVGComponentTransferFunctionElement; + new(): SVGComponentTransferFunctionElement; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; +} + +interface SVGDefsElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGDefsElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDefsElement: { + prototype: SVGDefsElement; + new(): SVGDefsElement; +} + +interface SVGDescElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGDescElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGDescElement: { + prototype: SVGDescElement; + new(): SVGDescElement; +} + +interface SVGElementEventMap extends ElementEventMap { + "click": MouseEvent; + "dblclick": MouseEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "load": Event; + "mousedown": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; +} + +interface SVGElement extends Element { + className: any; + onclick: (this: SVGElement, ev: MouseEvent) => any; + ondblclick: (this: SVGElement, ev: MouseEvent) => any; + onfocusin: (this: SVGElement, ev: FocusEvent) => any; + onfocusout: (this: SVGElement, ev: FocusEvent) => any; + onload: (this: SVGElement, ev: Event) => any; + onmousedown: (this: SVGElement, ev: MouseEvent) => any; + onmousemove: (this: SVGElement, ev: MouseEvent) => any; + onmouseout: (this: SVGElement, ev: MouseEvent) => any; + onmouseover: (this: SVGElement, ev: MouseEvent) => any; + onmouseup: (this: SVGElement, ev: MouseEvent) => any; + readonly ownerSVGElement: SVGSVGElement; + readonly style: CSSStyleDeclaration; + readonly viewportElement: SVGElement; + xmlbase: string; + addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGElement: { + prototype: SVGElement; + new(): SVGElement; +} + +interface SVGElementInstance extends EventTarget { + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; +} + +declare var SVGElementInstance: { + prototype: SVGElementInstance; + new(): SVGElementInstance; +} + +interface SVGElementInstanceList { + readonly length: number; + item(index: number): SVGElementInstance; +} + +declare var SVGElementInstanceList: { + prototype: SVGElementInstanceList; + new(): SVGElementInstanceList; +} + +interface SVGEllipseElement extends SVGGraphicsElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGEllipseElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGEllipseElement: { + prototype: SVGEllipseElement; + new(): SVGEllipseElement; +} + +interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEBlendElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEBlendElement: { + prototype: SVGFEBlendElement; + new(): SVGFEBlendElement; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; +} + +interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEColorMatrixElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEColorMatrixElement: { + prototype: SVGFEColorMatrixElement; + new(): SVGFEColorMatrixElement; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; +} + +interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEComponentTransferElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEComponentTransferElement: { + prototype: SVGFEComponentTransferElement; + new(): SVGFEComponentTransferElement; +} + +interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; + addEventListener(type: K, listener: (this: SVGFECompositeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFECompositeElement: { + prototype: SVGFECompositeElement; + new(): SVGFECompositeElement; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; +} + +interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; + addEventListener(type: K, listener: (this: SVGFEConvolveMatrixElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEConvolveMatrixElement: { + prototype: SVGFEConvolveMatrixElement; + new(): SVGFEConvolveMatrixElement; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; +} + +interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEDiffuseLightingElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDiffuseLightingElement: { + prototype: SVGFEDiffuseLightingElement; + new(): SVGFEDiffuseLightingElement; +} + +interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEDisplacementMapElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDisplacementMapElement: { + prototype: SVGFEDisplacementMapElement; + new(): SVGFEDisplacementMapElement; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; +} + +interface SVGFEDistantLightElement extends SVGElement { + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEDistantLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEDistantLightElement: { + prototype: SVGFEDistantLightElement; + new(): SVGFEDistantLightElement; +} + +interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGFEFloodElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFloodElement: { + prototype: SVGFEFloodElement; + new(): SVGFEFloodElement; +} + +interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncAElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncAElement: { + prototype: SVGFEFuncAElement; + new(): SVGFEFuncAElement; +} + +interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncBElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncBElement: { + prototype: SVGFEFuncBElement; + new(): SVGFEFuncBElement; +} + +interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncGElement: { + prototype: SVGFEFuncGElement; + new(): SVGFEFuncGElement; +} + +interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { + addEventListener(type: K, listener: (this: SVGFEFuncRElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEFuncRElement: { + prototype: SVGFEFuncRElement; + new(): SVGFEFuncRElement; +} + +interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; + setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; + addEventListener(type: K, listener: (this: SVGFEGaussianBlurElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEGaussianBlurElement: { + prototype: SVGFEGaussianBlurElement; + new(): SVGFEGaussianBlurElement; +} + +interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGURIReference { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + addEventListener(type: K, listener: (this: SVGFEImageElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEImageElement: { + prototype: SVGFEImageElement; + new(): SVGFEImageElement; +} + +interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + addEventListener(type: K, listener: (this: SVGFEMergeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeElement: { + prototype: SVGFEMergeElement; + new(): SVGFEMergeElement; +} + +interface SVGFEMergeNodeElement extends SVGElement { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEMergeNodeElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMergeNodeElement: { + prototype: SVGFEMergeNodeElement; + new(): SVGFEMergeNodeElement; +} + +interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFEMorphologyElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEMorphologyElement: { + prototype: SVGFEMorphologyElement; + new(): SVGFEMorphologyElement; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; +} + +interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFEOffsetElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEOffsetElement: { + prototype: SVGFEOffsetElement; + new(): SVGFEOffsetElement; +} + +interface SVGFEPointLightElement extends SVGElement { + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFEPointLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFEPointLightElement: { + prototype: SVGFEPointLightElement; + new(): SVGFEPointLightElement; +} + +interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFESpecularLightingElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpecularLightingElement: { + prototype: SVGFESpecularLightingElement; + new(): SVGFESpecularLightingElement; +} + +interface SVGFESpotLightElement extends SVGElement { + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGFESpotLightElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFESpotLightElement: { + prototype: SVGFESpotLightElement; + new(): SVGFESpotLightElement; +} + +interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly in1: SVGAnimatedString; + addEventListener(type: K, listener: (this: SVGFETileElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETileElement: { + prototype: SVGFETileElement; + new(): SVGFETileElement; +} + +interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGFETurbulenceElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFETurbulenceElement: { + prototype: SVGFETurbulenceElement; + new(): SVGFETurbulenceElement; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; +} + +interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGURIReference { + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + setFilterRes(filterResX: number, filterResY: number): void; + addEventListener(type: K, listener: (this: SVGFilterElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGFilterElement: { + prototype: SVGFilterElement; + new(): SVGFilterElement; +} + +interface SVGForeignObjectElement extends SVGGraphicsElement { + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGForeignObjectElement: { + prototype: SVGForeignObjectElement; + new(): SVGForeignObjectElement; +} + +interface SVGGElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGElement: { + prototype: SVGGElement; + new(): SVGGElement; +} + +interface SVGGradientElement extends SVGElement, SVGUnitTypes, SVGURIReference { + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGradientElement: { + prototype: SVGGradientElement; + new(): SVGGradientElement; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; +} + +interface SVGGraphicsElement extends SVGElement, SVGTests { + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; + readonly transform: SVGAnimatedTransformList; + getBBox(): SVGRect; + getCTM(): SVGMatrix; + getScreenCTM(): SVGMatrix; + getTransformToElement(element: SVGElement): SVGMatrix; + addEventListener(type: K, listener: (this: SVGGraphicsElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGGraphicsElement: { + prototype: SVGGraphicsElement; + new(): SVGGraphicsElement; +} + +interface SVGImageElement extends SVGGraphicsElement, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGImageElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGImageElement: { + prototype: SVGImageElement; + new(): SVGImageElement; +} + +interface SVGLength { + readonly unitType: number; + value: number; + valueAsString: string; + valueInSpecifiedUnits: number; + convertToSpecifiedUnits(unitType: number): void; + newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +declare var SVGLength: { + prototype: SVGLength; + new(): SVGLength; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; +} + +interface SVGLengthList { + readonly numberOfItems: number; + appendItem(newItem: SVGLength): SVGLength; + clear(): void; + getItem(index: number): SVGLength; + initialize(newItem: SVGLength): SVGLength; + insertItemBefore(newItem: SVGLength, index: number): SVGLength; + removeItem(index: number): SVGLength; + replaceItem(newItem: SVGLength, index: number): SVGLength; +} + +declare var SVGLengthList: { + prototype: SVGLengthList; + new(): SVGLengthList; +} + +interface SVGLineElement extends SVGGraphicsElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGLineElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLineElement: { + prototype: SVGLineElement; + new(): SVGLineElement; +} + +interface SVGLinearGradientElement extends SVGGradientElement { + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGLinearGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGLinearGradientElement: { + prototype: SVGLinearGradientElement; + new(): SVGLinearGradientElement; +} + +interface SVGMarkerElement extends SVGElement, SVGFitToViewBox { + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; + setOrientToAngle(angle: SVGAngle): void; + setOrientToAuto(): void; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGMarkerElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMarkerElement: { + prototype: SVGMarkerElement; + new(): SVGMarkerElement; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; +} + +interface SVGMaskElement extends SVGElement, SVGTests, SVGUnitTypes { + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGMaskElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMaskElement: { + prototype: SVGMaskElement; + new(): SVGMaskElement; +} + +interface SVGMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + flipX(): SVGMatrix; + flipY(): SVGMatrix; + inverse(): SVGMatrix; + multiply(secondMatrix: SVGMatrix): SVGMatrix; + rotate(angle: number): SVGMatrix; + rotateFromVector(x: number, y: number): SVGMatrix; + scale(scaleFactor: number): SVGMatrix; + scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; + skewX(angle: number): SVGMatrix; + skewY(angle: number): SVGMatrix; + translate(x: number, y: number): SVGMatrix; +} + +declare var SVGMatrix: { + prototype: SVGMatrix; + new(): SVGMatrix; +} + +interface SVGMetadataElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGMetadataElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGMetadataElement: { + prototype: SVGMetadataElement; + new(): SVGMetadataElement; +} + +interface SVGNumber { + value: number; +} + +declare var SVGNumber: { + prototype: SVGNumber; + new(): SVGNumber; +} + +interface SVGNumberList { + readonly numberOfItems: number; + appendItem(newItem: SVGNumber): SVGNumber; + clear(): void; + getItem(index: number): SVGNumber; + initialize(newItem: SVGNumber): SVGNumber; + insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; + removeItem(index: number): SVGNumber; + replaceItem(newItem: SVGNumber, index: number): SVGNumber; +} + +declare var SVGNumberList: { + prototype: SVGNumberList; + new(): SVGNumberList; +} + +interface SVGPathElement extends SVGGraphicsElement { + readonly pathSegList: SVGPathSegList; + createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; + createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; + createSVGPathSegClosePath(): SVGPathSegClosePath; + createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; + createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; + createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; + createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; + createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; + createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; + createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; + createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; + createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; + createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; + createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; + createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; + createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; + createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; + createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; + createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; + getPathSegAtLength(distance: number): number; + getPointAtLength(distance: number): SVGPoint; + getTotalLength(): number; + addEventListener(type: K, listener: (this: SVGPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPathElement: { + prototype: SVGPathElement; + new(): SVGPathElement; +} + +interface SVGPathSeg { + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +declare var SVGPathSeg: { + prototype: SVGPathSeg; + new(): SVGPathSeg; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; +} + +interface SVGPathSegArcAbs extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcAbs: { + prototype: SVGPathSegArcAbs; + new(): SVGPathSegArcAbs; +} + +interface SVGPathSegArcRel extends SVGPathSeg { + angle: number; + largeArcFlag: boolean; + r1: number; + r2: number; + sweepFlag: boolean; + x: number; + y: number; +} + +declare var SVGPathSegArcRel: { + prototype: SVGPathSegArcRel; + new(): SVGPathSegArcRel; +} + +interface SVGPathSegClosePath extends SVGPathSeg { +} + +declare var SVGPathSegClosePath: { + prototype: SVGPathSegClosePath; + new(): SVGPathSegClosePath; +} + +interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicAbs: { + prototype: SVGPathSegCurvetoCubicAbs; + new(): SVGPathSegCurvetoCubicAbs; +} + +interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { + x: number; + x1: number; + x2: number; + y: number; + y1: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicRel: { + prototype: SVGPathSegCurvetoCubicRel; + new(): SVGPathSegCurvetoCubicRel; +} + +interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothAbs: { + prototype: SVGPathSegCurvetoCubicSmoothAbs; + new(): SVGPathSegCurvetoCubicSmoothAbs; +} + +interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { + x: number; + x2: number; + y: number; + y2: number; +} + +declare var SVGPathSegCurvetoCubicSmoothRel: { + prototype: SVGPathSegCurvetoCubicSmoothRel; + new(): SVGPathSegCurvetoCubicSmoothRel; +} + +interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticAbs: { + prototype: SVGPathSegCurvetoQuadraticAbs; + new(): SVGPathSegCurvetoQuadraticAbs; +} + +interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { + x: number; + x1: number; + y: number; + y1: number; +} + +declare var SVGPathSegCurvetoQuadraticRel: { + prototype: SVGPathSegCurvetoQuadraticRel; + new(): SVGPathSegCurvetoQuadraticRel; +} + +interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothAbs: { + prototype: SVGPathSegCurvetoQuadraticSmoothAbs; + new(): SVGPathSegCurvetoQuadraticSmoothAbs; +} + +interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegCurvetoQuadraticSmoothRel: { + prototype: SVGPathSegCurvetoQuadraticSmoothRel; + new(): SVGPathSegCurvetoQuadraticSmoothRel; +} + +interface SVGPathSegLinetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoAbs: { + prototype: SVGPathSegLinetoAbs; + new(): SVGPathSegLinetoAbs; +} + +interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalAbs: { + prototype: SVGPathSegLinetoHorizontalAbs; + new(): SVGPathSegLinetoHorizontalAbs; +} + +interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { + x: number; +} + +declare var SVGPathSegLinetoHorizontalRel: { + prototype: SVGPathSegLinetoHorizontalRel; + new(): SVGPathSegLinetoHorizontalRel; +} + +interface SVGPathSegLinetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegLinetoRel: { + prototype: SVGPathSegLinetoRel; + new(): SVGPathSegLinetoRel; +} + +interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalAbs: { + prototype: SVGPathSegLinetoVerticalAbs; + new(): SVGPathSegLinetoVerticalAbs; +} + +interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { + y: number; +} + +declare var SVGPathSegLinetoVerticalRel: { + prototype: SVGPathSegLinetoVerticalRel; + new(): SVGPathSegLinetoVerticalRel; +} + +interface SVGPathSegList { + readonly numberOfItems: number; + appendItem(newItem: SVGPathSeg): SVGPathSeg; + clear(): void; + getItem(index: number): SVGPathSeg; + initialize(newItem: SVGPathSeg): SVGPathSeg; + insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; + removeItem(index: number): SVGPathSeg; + replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; +} + +declare var SVGPathSegList: { + prototype: SVGPathSegList; + new(): SVGPathSegList; +} + +interface SVGPathSegMovetoAbs extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoAbs: { + prototype: SVGPathSegMovetoAbs; + new(): SVGPathSegMovetoAbs; +} + +interface SVGPathSegMovetoRel extends SVGPathSeg { + x: number; + y: number; +} + +declare var SVGPathSegMovetoRel: { + prototype: SVGPathSegMovetoRel; + new(): SVGPathSegMovetoRel; +} + +interface SVGPatternElement extends SVGElement, SVGTests, SVGUnitTypes, SVGFitToViewBox, SVGURIReference { + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGPatternElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPatternElement: { + prototype: SVGPatternElement; + new(): SVGPatternElement; +} + +interface SVGPoint { + x: number; + y: number; + matrixTransform(matrix: SVGMatrix): SVGPoint; +} + +declare var SVGPoint: { + prototype: SVGPoint; + new(): SVGPoint; +} + +interface SVGPointList { + readonly numberOfItems: number; + appendItem(newItem: SVGPoint): SVGPoint; + clear(): void; + getItem(index: number): SVGPoint; + initialize(newItem: SVGPoint): SVGPoint; + insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; + removeItem(index: number): SVGPoint; + replaceItem(newItem: SVGPoint, index: number): SVGPoint; +} + +declare var SVGPointList: { + prototype: SVGPointList; + new(): SVGPointList; +} + +interface SVGPolygonElement extends SVGGraphicsElement, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGPolygonElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolygonElement: { + prototype: SVGPolygonElement; + new(): SVGPolygonElement; +} + +interface SVGPolylineElement extends SVGGraphicsElement, SVGAnimatedPoints { + addEventListener(type: K, listener: (this: SVGPolylineElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGPolylineElement: { + prototype: SVGPolylineElement; + new(): SVGPolylineElement; +} + +interface SVGPreserveAspectRatio { + align: number; + meetOrSlice: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +declare var SVGPreserveAspectRatio: { + prototype: SVGPreserveAspectRatio; + new(): SVGPreserveAspectRatio; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; +} + +interface SVGRadialGradientElement extends SVGGradientElement { + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGRadialGradientElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRadialGradientElement: { + prototype: SVGRadialGradientElement; + new(): SVGRadialGradientElement; +} + +interface SVGRect { + height: number; + width: number; + x: number; + y: number; +} + +declare var SVGRect: { + prototype: SVGRect; + new(): SVGRect; +} + +interface SVGRectElement extends SVGGraphicsElement { + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGRectElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGRectElement: { + prototype: SVGRectElement; + new(): SVGRectElement; +} + +interface SVGSVGElementEventMap extends SVGElementEventMap { + "SVGAbort": Event; + "SVGError": Event; + "resize": UIEvent; + "scroll": UIEvent; + "SVGUnload": Event; + "SVGZoom": SVGZoomEvent; +} + +interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewBox, SVGZoomAndPan { + contentScriptType: string; + contentStyleType: string; + currentScale: number; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; + onabort: (this: SVGSVGElement, ev: Event) => any; + onerror: (this: SVGSVGElement, ev: Event) => any; + onresize: (this: SVGSVGElement, ev: UIEvent) => any; + onscroll: (this: SVGSVGElement, ev: UIEvent) => any; + onunload: (this: SVGSVGElement, ev: Event) => any; + onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + checkEnclosure(element: SVGElement, rect: SVGRect): boolean; + checkIntersection(element: SVGElement, rect: SVGRect): boolean; + createSVGAngle(): SVGAngle; + createSVGLength(): SVGLength; + createSVGMatrix(): SVGMatrix; + createSVGNumber(): SVGNumber; + createSVGPoint(): SVGPoint; + createSVGRect(): SVGRect; + createSVGTransform(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + deselectAll(): void; + forceRedraw(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getCurrentTime(): number; + getElementById(elementId: string): Element; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + pauseAnimations(): void; + setCurrentTime(seconds: number): void; + suspendRedraw(maxWaitMilliseconds: number): number; + unpauseAnimations(): void; + unsuspendRedraw(suspendHandleID: number): void; + unsuspendRedrawAll(): void; + addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSVGElement: { + prototype: SVGSVGElement; + new(): SVGSVGElement; +} + +interface SVGScriptElement extends SVGElement, SVGURIReference { + type: string; + addEventListener(type: K, listener: (this: SVGScriptElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGScriptElement: { + prototype: SVGScriptElement; + new(): SVGScriptElement; +} + +interface SVGStopElement extends SVGElement { + readonly offset: SVGAnimatedNumber; + addEventListener(type: K, listener: (this: SVGStopElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStopElement: { + prototype: SVGStopElement; + new(): SVGStopElement; +} + +interface SVGStringList { + readonly numberOfItems: number; + appendItem(newItem: string): string; + clear(): void; + getItem(index: number): string; + initialize(newItem: string): string; + insertItemBefore(newItem: string, index: number): string; + removeItem(index: number): string; + replaceItem(newItem: string, index: number): string; +} + +declare var SVGStringList: { + prototype: SVGStringList; + new(): SVGStringList; +} + +interface SVGStyleElement extends SVGElement { + disabled: boolean; + media: string; + title: string; + type: string; + addEventListener(type: K, listener: (this: SVGStyleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGStyleElement: { + prototype: SVGStyleElement; + new(): SVGStyleElement; +} + +interface SVGSwitchElement extends SVGGraphicsElement { + addEventListener(type: K, listener: (this: SVGSwitchElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSwitchElement: { + prototype: SVGSwitchElement; + new(): SVGSwitchElement; +} + +interface SVGSymbolElement extends SVGElement, SVGFitToViewBox { + addEventListener(type: K, listener: (this: SVGSymbolElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGSymbolElement: { + prototype: SVGSymbolElement; + new(): SVGSymbolElement; +} + +interface SVGTSpanElement extends SVGTextPositioningElement { + addEventListener(type: K, listener: (this: SVGTSpanElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTSpanElement: { + prototype: SVGTSpanElement; + new(): SVGTSpanElement; +} + +interface SVGTextContentElement extends SVGGraphicsElement { + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; + getCharNumAtPosition(point: SVGPoint): number; + getComputedTextLength(): number; + getEndPositionOfChar(charnum: number): SVGPoint; + getExtentOfChar(charnum: number): SVGRect; + getNumberOfChars(): number; + getRotationOfChar(charnum: number): number; + getStartPositionOfChar(charnum: number): SVGPoint; + getSubStringLength(charnum: number, nchars: number): number; + selectSubString(charnum: number, nchars: number): void; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGTextContentElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextContentElement: { + prototype: SVGTextContentElement; + new(): SVGTextContentElement; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; +} + +interface SVGTextElement extends SVGTextPositioningElement { + addEventListener(type: K, listener: (this: SVGTextElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextElement: { + prototype: SVGTextElement; + new(): SVGTextElement; +} + +interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; + addEventListener(type: K, listener: (this: SVGTextPathElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPathElement: { + prototype: SVGTextPathElement; + new(): SVGTextPathElement; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; +} + +interface SVGTextPositioningElement extends SVGTextContentElement { + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; + addEventListener(type: K, listener: (this: SVGTextPositioningElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTextPositioningElement: { + prototype: SVGTextPositioningElement; + new(): SVGTextPositioningElement; +} + +interface SVGTitleElement extends SVGElement { + addEventListener(type: K, listener: (this: SVGTitleElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGTitleElement: { + prototype: SVGTitleElement; + new(): SVGTitleElement; +} + +interface SVGTransform { + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; + setMatrix(matrix: SVGMatrix): void; + setRotate(angle: number, cx: number, cy: number): void; + setScale(sx: number, sy: number): void; + setSkewX(angle: number): void; + setSkewY(angle: number): void; + setTranslate(tx: number, ty: number): void; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +declare var SVGTransform: { + prototype: SVGTransform; + new(): SVGTransform; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; +} + +interface SVGTransformList { + readonly numberOfItems: number; + appendItem(newItem: SVGTransform): SVGTransform; + clear(): void; + consolidate(): SVGTransform; + createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; + getItem(index: number): SVGTransform; + initialize(newItem: SVGTransform): SVGTransform; + insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; + removeItem(index: number): SVGTransform; + replaceItem(newItem: SVGTransform, index: number): SVGTransform; +} + +declare var SVGTransformList: { + prototype: SVGTransformList; + new(): SVGTransformList; +} + +interface SVGUnitTypes { + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; +} +declare var SVGUnitTypes: SVGUnitTypes; + +interface SVGUseElement extends SVGGraphicsElement, SVGURIReference { + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; + addEventListener(type: K, listener: (this: SVGUseElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGUseElement: { + prototype: SVGUseElement; + new(): SVGUseElement; +} + +interface SVGViewElement extends SVGElement, SVGZoomAndPan, SVGFitToViewBox { + readonly viewTarget: SVGStringList; + addEventListener(type: K, listener: (this: SVGViewElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SVGViewElement: { + prototype: SVGViewElement; + new(): SVGViewElement; +} + +interface SVGZoomAndPan { + readonly zoomAndPan: number; +} + +declare var SVGZoomAndPan: { + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; +} + +interface SVGZoomEvent extends UIEvent { + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; +} + +declare var SVGZoomEvent: { + prototype: SVGZoomEvent; + new(): SVGZoomEvent; +} + +interface ScopedCredential { + readonly id: ArrayBuffer; + readonly type: ScopedCredentialType; +} + +declare var ScopedCredential: { + prototype: ScopedCredential; + new(): ScopedCredential; +} + +interface ScopedCredentialInfo { + readonly credential: ScopedCredential; + readonly publicKey: CryptoKey; +} + +declare var ScopedCredentialInfo: { + prototype: ScopedCredentialInfo; + new(): ScopedCredentialInfo; +} + +interface ScreenEventMap { + "MSOrientationChange": Event; +} + +interface Screen extends EventTarget { + readonly availHeight: number; + readonly availWidth: number; + bufferDepth: number; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; + onmsorientationchange: (this: Screen, ev: Event) => any; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; + msLockOrientation(orientations: string | string[]): boolean; + msUnlockOrientation(): void; + addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Screen: { + prototype: Screen; + new(): Screen; +} + +interface ScriptNotifyEvent extends Event { + readonly callingUri: string; + readonly value: string; +} + +declare var ScriptNotifyEvent: { + prototype: ScriptNotifyEvent; + new(): ScriptNotifyEvent; +} + +interface ScriptProcessorNodeEventMap { + "audioprocess": AudioProcessingEvent; +} + +interface ScriptProcessorNode extends AudioNode { + readonly bufferSize: number; + onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; + addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ScriptProcessorNode: { + prototype: ScriptProcessorNode; + new(): ScriptProcessorNode; +} + +interface Selection { + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly baseNode: Node; + readonly baseOffset: number; + readonly extentNode: Node; + readonly extentOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; + addRange(range: Range): void; + collapse(parentNode: Node, offset: number): void; + collapseToEnd(): void; + collapseToStart(): void; + containsNode(node: Node, partlyContained: boolean): boolean; + deleteFromDocument(): void; + empty(): void; + extend(newNode: Node, offset: number): void; + getRangeAt(index: number): Range; + removeAllRanges(): void; + removeRange(range: Range): void; + selectAllChildren(parentNode: Node): void; + setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; + setPosition(parentNode: Node, offset: number): void; + toString(): string; +} + +declare var Selection: { + prototype: Selection; + new(): Selection; +} + +interface ServiceWorkerEventMap extends AbstractWorkerEventMap { + "statechange": Event; +} + +interface ServiceWorker extends EventTarget, AbstractWorker { + onstatechange: (this: ServiceWorker, ev: Event) => any; + readonly scriptURL: USVString; + readonly state: ServiceWorkerState; + postMessage(message: any, transfer?: any[]): void; + addEventListener(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorker: { + prototype: ServiceWorker; + new(): ServiceWorker; +} + +interface ServiceWorkerContainerEventMap { + "controllerchange": Event; + "message": ServiceWorkerMessageEvent; +} + +interface ServiceWorkerContainer extends EventTarget { + readonly controller: ServiceWorker | null; + oncontrollerchange: (this: ServiceWorkerContainer, ev: Event) => any; + onmessage: (this: ServiceWorkerContainer, ev: ServiceWorkerMessageEvent) => any; + readonly ready: Promise; + getRegistration(clientURL?: USVString): Promise; + getRegistrations(): any; + register(scriptURL: USVString, options?: RegistrationOptions): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerContainer: { + prototype: ServiceWorkerContainer; + new(): ServiceWorkerContainer; +} + +interface ServiceWorkerMessageEvent extends Event { + readonly data: any; + readonly lastEventId: string; + readonly origin: string; + readonly ports: MessagePort[] | null; + readonly source: ServiceWorker | MessagePort | null; +} + +declare var ServiceWorkerMessageEvent: { + prototype: ServiceWorkerMessageEvent; + new(type: string, eventInitDict?: ServiceWorkerMessageEventInit): ServiceWorkerMessageEvent; +} + +interface ServiceWorkerRegistrationEventMap { + "updatefound": Event; +} + +interface ServiceWorkerRegistration extends EventTarget { + readonly active: ServiceWorker | null; + readonly installing: ServiceWorker | null; + onupdatefound: (this: ServiceWorkerRegistration, ev: Event) => any; + readonly pushManager: PushManager; + readonly scope: USVString; + readonly sync: SyncManager; + readonly waiting: ServiceWorker | null; + getNotifications(filter?: GetNotificationOptions): any; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerRegistration: { + prototype: ServiceWorkerRegistration; + new(): ServiceWorkerRegistration; +} + +interface SourceBuffer extends EventTarget { + appendWindowEnd: number; + appendWindowStart: number; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; + mode: AppendMode; + timestampOffset: number; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; + abort(): void; + appendBuffer(data: ArrayBuffer | ArrayBufferView): void; + appendStream(stream: MSStream, maxSize?: number): void; + remove(start: number, end: number): void; +} + +declare var SourceBuffer: { + prototype: SourceBuffer; + new(): SourceBuffer; +} + +interface SourceBufferList extends EventTarget { + readonly length: number; + item(index: number): SourceBuffer; + [index: number]: SourceBuffer; +} + +declare var SourceBufferList: { + prototype: SourceBufferList; + new(): SourceBufferList; +} + +interface SpeechSynthesisEventMap { + "voiceschanged": Event; +} + +interface SpeechSynthesis extends EventTarget { + onvoiceschanged: (this: SpeechSynthesis, ev: Event) => any; + readonly paused: boolean; + readonly pending: boolean; + readonly speaking: boolean; + cancel(): void; + getVoices(): SpeechSynthesisVoice[]; + pause(): void; + resume(): void; + speak(utterance: SpeechSynthesisUtterance): void; + addEventListener(type: K, listener: (this: SpeechSynthesis, ev: SpeechSynthesisEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SpeechSynthesis: { + prototype: SpeechSynthesis; + new(): SpeechSynthesis; +} + +interface SpeechSynthesisEvent extends Event { + readonly charIndex: number; + readonly elapsedTime: number; + readonly name: string; + readonly utterance: SpeechSynthesisUtterance | null; +} + +declare var SpeechSynthesisEvent: { + prototype: SpeechSynthesisEvent; + new(type: string, eventInitDict?: SpeechSynthesisEventInit): SpeechSynthesisEvent; +} + +interface SpeechSynthesisUtteranceEventMap { + "boundary": Event; + "end": Event; + "error": Event; + "mark": Event; + "pause": Event; + "resume": Event; + "start": Event; +} + +interface SpeechSynthesisUtterance extends EventTarget { + lang: string; + onboundary: (this: SpeechSynthesisUtterance, ev: Event) => any; + onend: (this: SpeechSynthesisUtterance, ev: Event) => any; + onerror: (this: SpeechSynthesisUtterance, ev: Event) => any; + onmark: (this: SpeechSynthesisUtterance, ev: Event) => any; + onpause: (this: SpeechSynthesisUtterance, ev: Event) => any; + onresume: (this: SpeechSynthesisUtterance, ev: Event) => any; + onstart: (this: SpeechSynthesisUtterance, ev: Event) => any; + pitch: number; + rate: number; + text: string; + voice: SpeechSynthesisVoice; + volume: number; + addEventListener(type: K, listener: (this: SpeechSynthesisUtterance, ev: SpeechSynthesisUtteranceEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var SpeechSynthesisUtterance: { + prototype: SpeechSynthesisUtterance; + new(text?: string): SpeechSynthesisUtterance; +} + +interface SpeechSynthesisVoice { + readonly default: boolean; + readonly lang: string; + readonly localService: boolean; + readonly name: string; + readonly voiceURI: string; +} + +declare var SpeechSynthesisVoice: { + prototype: SpeechSynthesisVoice; + new(): SpeechSynthesisVoice; +} + +interface StereoPannerNode extends AudioNode { + readonly pan: AudioParam; +} + +declare var StereoPannerNode: { + prototype: StereoPannerNode; + new(): StereoPannerNode; +} + +interface Storage { + readonly length: number; + clear(): void; + getItem(key: string): string | null; + key(index: number): string | null; + removeItem(key: string): void; + setItem(key: string, data: string): void; + [key: string]: any; + [index: number]: string; +} + +declare var Storage: { + prototype: Storage; + new(): Storage; +} + +interface StorageEvent extends Event { + readonly url: string; + key?: string; + oldValue?: string; + newValue?: string; + storageArea?: Storage; +} + +declare var StorageEvent: { + prototype: StorageEvent; + new (type: string, eventInitDict?: StorageEventInit): StorageEvent; +} + +interface StyleMedia { + readonly type: string; + matchMedium(mediaquery: string): boolean; +} + +declare var StyleMedia: { + prototype: StyleMedia; + new(): StyleMedia; +} + +interface StyleSheet { + disabled: boolean; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; +} + +declare var StyleSheet: { + prototype: StyleSheet; + new(): StyleSheet; +} + +interface StyleSheetList { + readonly length: number; + item(index?: number): StyleSheet; + [index: number]: StyleSheet; +} + +declare var StyleSheetList: { + prototype: StyleSheetList; + new(): StyleSheetList; +} + +interface StyleSheetPageList { + readonly length: number; + item(index: number): CSSPageRule; + [index: number]: CSSPageRule; +} + +declare var StyleSheetPageList: { + prototype: StyleSheetPageList; + new(): StyleSheetPageList; +} + +interface SubtleCrypto { + decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; + encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; + exportKey(format: "jwk", key: CryptoKey): PromiseLike; + exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; + unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; +} + +declare var SubtleCrypto: { + prototype: SubtleCrypto; + new(): SubtleCrypto; +} + +interface SyncManager { + getTags(): any; + register(tag: string): Promise; +} + +declare var SyncManager: { + prototype: SyncManager; + new(): SyncManager; +} + +interface Text extends CharacterData { + readonly wholeText: string; + readonly assignedSlot: HTMLSlotElement | null; + splitText(offset: number): Text; +} + +declare var Text: { + prototype: Text; + new(data?: string): Text; +} + +interface TextEvent extends UIEvent { + readonly data: string; + readonly inputMethod: number; + readonly locale: string; + initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +declare var TextEvent: { + prototype: TextEvent; + new(): TextEvent; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; +} + +interface TextMetrics { + readonly width: number; +} + +declare var TextMetrics: { + prototype: TextMetrics; + new(): TextMetrics; +} + +interface TextTrackEventMap { + "cuechange": Event; + "error": Event; + "load": Event; +} + +interface TextTrack extends EventTarget { + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; + mode: any; + oncuechange: (this: TextTrack, ev: Event) => any; + onerror: (this: TextTrack, ev: Event) => any; + onload: (this: TextTrack, ev: Event) => any; + readonly readyState: number; + addCue(cue: TextTrackCue): void; + removeCue(cue: TextTrackCue): void; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; + addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrack: { + prototype: TextTrack; + new(): TextTrack; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; +} + +interface TextTrackCueEventMap { + "enter": Event; + "exit": Event; +} + +interface TextTrackCue extends EventTarget { + endTime: number; + id: string; + onenter: (this: TextTrackCue, ev: Event) => any; + onexit: (this: TextTrackCue, ev: Event) => any; + pauseOnExit: boolean; + startTime: number; + text: string; + readonly track: TextTrack; + getCueAsHTML(): DocumentFragment; + addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var TextTrackCue: { + prototype: TextTrackCue; + new(startTime: number, endTime: number, text: string): TextTrackCue; +} + +interface TextTrackCueList { + readonly length: number; + getCueById(id: string): TextTrackCue; + item(index: number): TextTrackCue; + [index: number]: TextTrackCue; +} + +declare var TextTrackCueList: { + prototype: TextTrackCueList; + new(): TextTrackCueList; +} + +interface TextTrackListEventMap { + "addtrack": TrackEvent; +} + +interface TextTrackList extends EventTarget { + readonly length: number; + onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; + item(index: number): TextTrack; + addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: TextTrack; +} + +declare var TextTrackList: { + prototype: TextTrackList; + new(): TextTrackList; +} + +interface TimeRanges { + readonly length: number; + end(index: number): number; + start(index: number): number; +} + +declare var TimeRanges: { + prototype: TimeRanges; + new(): TimeRanges; +} + +interface Touch { + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; +} + +declare var Touch: { + prototype: Touch; + new(): Touch; +} + +interface TouchEvent extends UIEvent { + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly keyCode: number; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; + readonly which: number; +} + +declare var TouchEvent: { + prototype: TouchEvent; + new(type: string, touchEventInit?: TouchEventInit): TouchEvent; +} + +interface TouchList { + readonly length: number; + item(index: number): Touch | null; + [index: number]: Touch; +} + +declare var TouchList: { + prototype: TouchList; + new(): TouchList; +} + +interface TrackEvent extends Event { + readonly track: VideoTrack | AudioTrack | TextTrack | null; +} + +declare var TrackEvent: { + prototype: TrackEvent; + new(typeArg: string, eventInitDict?: TrackEventInit): TrackEvent; +} + +interface TransitionEvent extends Event { + readonly elapsedTime: number; + readonly propertyName: string; + initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; +} + +declare var TransitionEvent: { + prototype: TransitionEvent; + new(typeArg: string, eventInitDict?: TransitionEventInit): TransitionEvent; +} + +interface TreeWalker { + currentNode: Node; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; + firstChild(): Node; + lastChild(): Node; + nextNode(): Node; + nextSibling(): Node; + parentNode(): Node; + previousNode(): Node; + previousSibling(): Node; +} + +declare var TreeWalker: { + prototype: TreeWalker; + new(): TreeWalker; +} + +interface UIEvent extends Event { + readonly detail: number; + readonly view: Window; + initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; +} + +declare var UIEvent: { + prototype: UIEvent; + new(typeArg: string, eventInitDict?: UIEventInit): UIEvent; +} + +interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + readonly searchParams: URLSearchParams; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; + createObjectURL(object: any, options?: ObjectURLOptions): string; + revokeObjectURL(url: string): void; +} + +interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { + readonly mediaType: string; +} + +declare var UnviewableContentIdentifiedEvent: { + prototype: UnviewableContentIdentifiedEvent; + new(): UnviewableContentIdentifiedEvent; +} + +interface ValidityState { + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; +} + +declare var ValidityState: { + prototype: ValidityState; + new(): ValidityState; +} + +interface VideoPlaybackQuality { + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; +} + +declare var VideoPlaybackQuality: { + prototype: VideoPlaybackQuality; + new(): VideoPlaybackQuality; +} + +interface VideoTrack { + readonly id: string; + kind: string; + readonly label: string; + language: string; + selected: boolean; + readonly sourceBuffer: SourceBuffer; +} + +declare var VideoTrack: { + prototype: VideoTrack; + new(): VideoTrack; +} + +interface VideoTrackListEventMap { + "addtrack": TrackEvent; + "change": Event; + "removetrack": TrackEvent; +} + +interface VideoTrackList extends EventTarget { + readonly length: number; + onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; + onchange: (this: VideoTrackList, ev: Event) => any; + onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; + readonly selectedIndex: number; + getTrackById(id: string): VideoTrack | null; + item(index: number): VideoTrack; + addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + [index: number]: VideoTrack; +} + +declare var VideoTrackList: { + prototype: VideoTrackList; + new(): VideoTrackList; +} + +interface WEBGL_compressed_texture_s3tc { + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +declare var WEBGL_compressed_texture_s3tc: { + prototype: WEBGL_compressed_texture_s3tc; + new(): WEBGL_compressed_texture_s3tc; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; +} + +interface WEBGL_debug_renderer_info { + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +declare var WEBGL_debug_renderer_info: { + prototype: WEBGL_debug_renderer_info; + new(): WEBGL_debug_renderer_info; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; +} + +interface WEBGL_depth_texture { + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +declare var WEBGL_depth_texture: { + prototype: WEBGL_depth_texture; + new(): WEBGL_depth_texture; + readonly UNSIGNED_INT_24_8_WEBGL: number; +} + +interface WaveShaperNode extends AudioNode { + curve: Float32Array | null; + oversample: OverSampleType; +} + +declare var WaveShaperNode: { + prototype: WaveShaperNode; + new(): WaveShaperNode; +} + +interface WebAuthentication { + getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise; + makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise; +} + +declare var WebAuthentication: { + prototype: WebAuthentication; + new(): WebAuthentication; +} + +interface WebAuthnAssertion { + readonly authenticatorData: ArrayBuffer; + readonly clientData: ArrayBuffer; + readonly credential: ScopedCredential; + readonly signature: ArrayBuffer; +} + +declare var WebAuthnAssertion: { + prototype: WebAuthnAssertion; + new(): WebAuthnAssertion; +} + +interface WebGLActiveInfo { + readonly name: string; + readonly size: number; + readonly type: number; +} + +declare var WebGLActiveInfo: { + prototype: WebGLActiveInfo; + new(): WebGLActiveInfo; +} + +interface WebGLBuffer extends WebGLObject { +} + +declare var WebGLBuffer: { + prototype: WebGLBuffer; + new(): WebGLBuffer; +} + +interface WebGLContextEvent extends Event { + readonly statusMessage: string; +} + +declare var WebGLContextEvent: { + prototype: WebGLContextEvent; + new(typeArg: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; +} + +interface WebGLFramebuffer extends WebGLObject { +} + +declare var WebGLFramebuffer: { + prototype: WebGLFramebuffer; + new(): WebGLFramebuffer; +} + +interface WebGLObject { +} + +declare var WebGLObject: { + prototype: WebGLObject; + new(): WebGLObject; +} + +interface WebGLProgram extends WebGLObject { +} + +declare var WebGLProgram: { + prototype: WebGLProgram; + new(): WebGLProgram; +} + +interface WebGLRenderbuffer extends WebGLObject { +} + +declare var WebGLRenderbuffer: { + prototype: WebGLRenderbuffer; + new(): WebGLRenderbuffer; +} + +interface WebGLRenderingContext { + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; + activeTexture(texture: number): void; + attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; + bindBuffer(target: number, buffer: WebGLBuffer | null): void; + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; + bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; + bindTexture(target: number, texture: WebGLTexture | null): void; + blendColor(red: number, green: number, blue: number, alpha: number): void; + blendEquation(mode: number): void; + blendEquationSeparate(modeRGB: number, modeAlpha: number): void; + blendFunc(sfactor: number, dfactor: number): void; + blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; + bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; + bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; + checkFramebufferStatus(target: number): number; + clear(mask: number): void; + clearColor(red: number, green: number, blue: number, alpha: number): void; + clearDepth(depth: number): void; + clearStencil(s: number): void; + colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; + compileShader(shader: WebGLShader | null): void; + compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; + compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; + copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; + copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; + createBuffer(): WebGLBuffer | null; + createFramebuffer(): WebGLFramebuffer | null; + createProgram(): WebGLProgram | null; + createRenderbuffer(): WebGLRenderbuffer | null; + createShader(type: number): WebGLShader | null; + createTexture(): WebGLTexture | null; + cullFace(mode: number): void; + deleteBuffer(buffer: WebGLBuffer | null): void; + deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; + deleteProgram(program: WebGLProgram | null): void; + deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; + deleteShader(shader: WebGLShader | null): void; + deleteTexture(texture: WebGLTexture | null): void; + depthFunc(func: number): void; + depthMask(flag: boolean): void; + depthRange(zNear: number, zFar: number): void; + detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; + disable(cap: number): void; + disableVertexAttribArray(index: number): void; + drawArrays(mode: number, first: number, count: number): void; + drawElements(mode: number, count: number, type: number, offset: number): void; + enable(cap: number): void; + enableVertexAttribArray(index: number): void; + finish(): void; + flush(): void; + framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; + framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; + frontFace(mode: number): void; + generateMipmap(target: number): void; + getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; + getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; + getAttribLocation(program: WebGLProgram | null, name: string): number; + getBufferParameter(target: number, pname: number): any; + getContextAttributes(): WebGLContextAttributes; + getError(): number; + getExtension(name: string): any; + getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; + getParameter(pname: number): any; + getProgramInfoLog(program: WebGLProgram | null): string | null; + getProgramParameter(program: WebGLProgram | null, pname: number): any; + getRenderbufferParameter(target: number, pname: number): any; + getShaderInfoLog(shader: WebGLShader | null): string | null; + getShaderParameter(shader: WebGLShader | null, pname: number): any; + getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; + getShaderSource(shader: WebGLShader | null): string | null; + getSupportedExtensions(): string[] | null; + getTexParameter(target: number, pname: number): any; + getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; + getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; + getVertexAttrib(index: number, pname: number): any; + getVertexAttribOffset(index: number, pname: number): number; + hint(target: number, mode: number): void; + isBuffer(buffer: WebGLBuffer | null): boolean; + isContextLost(): boolean; + isEnabled(cap: number): boolean; + isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; + isProgram(program: WebGLProgram | null): boolean; + isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; + isShader(shader: WebGLShader | null): boolean; + isTexture(texture: WebGLTexture | null): boolean; + lineWidth(width: number): void; + linkProgram(program: WebGLProgram | null): void; + pixelStorei(pname: number, param: number | boolean): void; + polygonOffset(factor: number, units: number): void; + readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; + sampleCoverage(value: number, invert: boolean): void; + scissor(x: number, y: number, width: number, height: number): void; + shaderSource(shader: WebGLShader | null, source: string): void; + stencilFunc(func: number, ref: number, mask: number): void; + stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; + stencilMask(mask: number): void; + stencilMaskSeparate(face: number, mask: number): void; + stencilOp(fail: number, zfail: number, zpass: number): void; + stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; + texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + texParameterf(target: number, pname: number, param: number): void; + texParameteri(target: number, pname: number, param: number): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; + texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; + uniform1f(location: WebGLUniformLocation | null, x: number): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform1i(location: WebGLUniformLocation | null, x: number): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; + uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + useProgram(program: WebGLProgram | null): void; + validateProgram(program: WebGLProgram | null): void; + vertexAttrib1f(indx: number, x: number): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib2f(indx: number, x: number, y: number): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib3f(indx: number, x: number, y: number, z: number): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; + vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; + vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; + viewport(x: number, y: number, width: number, height: number): void; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +declare var WebGLRenderingContext: { + prototype: WebGLRenderingContext; + new(): WebGLRenderingContext; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; +} + +interface WebGLShader extends WebGLObject { +} + +declare var WebGLShader: { + prototype: WebGLShader; + new(): WebGLShader; +} + +interface WebGLShaderPrecisionFormat { + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; +} + +declare var WebGLShaderPrecisionFormat: { + prototype: WebGLShaderPrecisionFormat; + new(): WebGLShaderPrecisionFormat; +} + +interface WebGLTexture extends WebGLObject { +} + +declare var WebGLTexture: { + prototype: WebGLTexture; + new(): WebGLTexture; +} + +interface WebGLUniformLocation { +} + +declare var WebGLUniformLocation: { + prototype: WebGLUniformLocation; + new(): WebGLUniformLocation; +} + +interface WebKitCSSMatrix { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m13: number; + m14: number; + m21: number; + m22: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m41: number; + m42: number; + m43: number; + m44: number; + inverse(): WebKitCSSMatrix; + multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; + rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; + rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; + scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; + setMatrixValue(value: string): void; + skewX(angle: number): WebKitCSSMatrix; + skewY(angle: number): WebKitCSSMatrix; + toString(): string; + translate(x: number, y: number, z?: number): WebKitCSSMatrix; +} + +declare var WebKitCSSMatrix: { + prototype: WebKitCSSMatrix; + new(text?: string): WebKitCSSMatrix; +} + +interface WebKitDirectoryEntry extends WebKitEntry { + createReader(): WebKitDirectoryReader; +} + +declare var WebKitDirectoryEntry: { + prototype: WebKitDirectoryEntry; + new(): WebKitDirectoryEntry; +} + +interface WebKitDirectoryReader { + readEntries(successCallback: WebKitEntriesCallback, errorCallback?: WebKitErrorCallback): void; +} + +declare var WebKitDirectoryReader: { + prototype: WebKitDirectoryReader; + new(): WebKitDirectoryReader; +} + +interface WebKitEntry { + readonly filesystem: WebKitFileSystem; + readonly fullPath: string; + readonly isDirectory: boolean; + readonly isFile: boolean; + readonly name: string; +} + +declare var WebKitEntry: { + prototype: WebKitEntry; + new(): WebKitEntry; +} + +interface WebKitFileEntry extends WebKitEntry { + file(successCallback: WebKitFileCallback, errorCallback?: WebKitErrorCallback): void; +} + +declare var WebKitFileEntry: { + prototype: WebKitFileEntry; + new(): WebKitFileEntry; +} + +interface WebKitFileSystem { + readonly name: string; + readonly root: WebKitDirectoryEntry; +} + +declare var WebKitFileSystem: { + prototype: WebKitFileSystem; + new(): WebKitFileSystem; +} + +interface WebKitPoint { + x: number; + y: number; +} + +declare var WebKitPoint: { + prototype: WebKitPoint; + new(x?: number, y?: number): WebKitPoint; +} + +interface WebSocketEventMap { + "close": CloseEvent; + "error": Event; + "message": MessageEvent; + "open": Event; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: Event) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface WheelEvent extends MouseEvent { + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; + getCurrentPoint(element: Element): void; + initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +declare var WheelEvent: { + prototype: WheelEvent; + new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; +} + +interface WindowEventMap extends GlobalEventHandlersEventMap { + "abort": UIEvent; + "afterprint": Event; + "beforeprint": Event; + "beforeunload": BeforeUnloadEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "compassneedscalibration": Event; + "contextmenu": PointerEvent; + "dblclick": MouseEvent; + "devicelight": DeviceLightEvent; + "devicemotion": DeviceMotionEvent; + "deviceorientation": DeviceOrientationEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": MediaStreamErrorEvent; + "focus": FocusEvent; + "hashchange": HashChangeEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "message": MessageEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "mousewheel": WheelEvent; + "MSGestureChange": MSGestureEvent; + "MSGestureDoubleTap": MSGestureEvent; + "MSGestureEnd": MSGestureEvent; + "MSGestureHold": MSGestureEvent; + "MSGestureStart": MSGestureEvent; + "MSGestureTap": MSGestureEvent; + "MSInertiaStart": MSGestureEvent; + "MSPointerCancel": MSPointerEvent; + "MSPointerDown": MSPointerEvent; + "MSPointerEnter": MSPointerEvent; + "MSPointerLeave": MSPointerEvent; + "MSPointerMove": MSPointerEvent; + "MSPointerOut": MSPointerEvent; + "MSPointerOver": MSPointerEvent; + "MSPointerUp": MSPointerEvent; + "offline": Event; + "online": Event; + "orientationchange": Event; + "pagehide": PageTransitionEvent; + "pageshow": PageTransitionEvent; + "pause": Event; + "play": Event; + "playing": Event; + "popstate": PopStateEvent; + "progress": ProgressEvent; + "ratechange": Event; + "readystatechange": ProgressEvent; + "reset": Event; + "resize": UIEvent; + "scroll": UIEvent; + "seeked": Event; + "seeking": Event; + "select": UIEvent; + "stalled": Event; + "storage": StorageEvent; + "submit": Event; + "suspend": Event; + "timeupdate": Event; + "unload": Event; + "volumechange": Event; + "waiting": Event; +} + +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch { + readonly applicationCache: ApplicationCache; + readonly caches: CacheStorage; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; + defaultStatus: string; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; + event: Event | undefined; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly isSecureContext: boolean; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msContentScript: ExtensionScriptApis; + readonly msCredentials: MSCredentials; + name: string; + readonly navigator: Navigator; + offscreenBuffering: string | boolean; + onabort: (this: Window, ev: UIEvent) => any; + onafterprint: (this: Window, ev: Event) => any; + onbeforeprint: (this: Window, ev: Event) => any; + onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; + onblur: (this: Window, ev: FocusEvent) => any; + oncanplay: (this: Window, ev: Event) => any; + oncanplaythrough: (this: Window, ev: Event) => any; + onchange: (this: Window, ev: Event) => any; + onclick: (this: Window, ev: MouseEvent) => any; + oncompassneedscalibration: (this: Window, ev: Event) => any; + oncontextmenu: (this: Window, ev: PointerEvent) => any; + ondblclick: (this: Window, ev: MouseEvent) => any; + ondevicelight: (this: Window, ev: DeviceLightEvent) => any; + ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; + ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; + ondrag: (this: Window, ev: DragEvent) => any; + ondragend: (this: Window, ev: DragEvent) => any; + ondragenter: (this: Window, ev: DragEvent) => any; + ondragleave: (this: Window, ev: DragEvent) => any; + ondragover: (this: Window, ev: DragEvent) => any; + ondragstart: (this: Window, ev: DragEvent) => any; + ondrop: (this: Window, ev: DragEvent) => any; + ondurationchange: (this: Window, ev: Event) => any; + onemptied: (this: Window, ev: Event) => any; + onended: (this: Window, ev: MediaStreamErrorEvent) => any; + onerror: ErrorEventHandler; + onfocus: (this: Window, ev: FocusEvent) => any; + onhashchange: (this: Window, ev: HashChangeEvent) => any; + oninput: (this: Window, ev: Event) => any; + oninvalid: (this: Window, ev: Event) => any; + onkeydown: (this: Window, ev: KeyboardEvent) => any; + onkeypress: (this: Window, ev: KeyboardEvent) => any; + onkeyup: (this: Window, ev: KeyboardEvent) => any; + onload: (this: Window, ev: Event) => any; + onloadeddata: (this: Window, ev: Event) => any; + onloadedmetadata: (this: Window, ev: Event) => any; + onloadstart: (this: Window, ev: Event) => any; + onmessage: (this: Window, ev: MessageEvent) => any; + onmousedown: (this: Window, ev: MouseEvent) => any; + onmouseenter: (this: Window, ev: MouseEvent) => any; + onmouseleave: (this: Window, ev: MouseEvent) => any; + onmousemove: (this: Window, ev: MouseEvent) => any; + onmouseout: (this: Window, ev: MouseEvent) => any; + onmouseover: (this: Window, ev: MouseEvent) => any; + onmouseup: (this: Window, ev: MouseEvent) => any; + onmousewheel: (this: Window, ev: WheelEvent) => any; + onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; + onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; + onmsgestureend: (this: Window, ev: MSGestureEvent) => any; + onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; + onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; + onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; + onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; + onmspointercancel: (this: Window, ev: MSPointerEvent) => any; + onmspointerdown: (this: Window, ev: MSPointerEvent) => any; + onmspointerenter: (this: Window, ev: MSPointerEvent) => any; + onmspointerleave: (this: Window, ev: MSPointerEvent) => any; + onmspointermove: (this: Window, ev: MSPointerEvent) => any; + onmspointerout: (this: Window, ev: MSPointerEvent) => any; + onmspointerover: (this: Window, ev: MSPointerEvent) => any; + onmspointerup: (this: Window, ev: MSPointerEvent) => any; + onoffline: (this: Window, ev: Event) => any; + ononline: (this: Window, ev: Event) => any; + onorientationchange: (this: Window, ev: Event) => any; + onpagehide: (this: Window, ev: PageTransitionEvent) => any; + onpageshow: (this: Window, ev: PageTransitionEvent) => any; + onpause: (this: Window, ev: Event) => any; + onplay: (this: Window, ev: Event) => any; + onplaying: (this: Window, ev: Event) => any; + onpopstate: (this: Window, ev: PopStateEvent) => any; + onprogress: (this: Window, ev: ProgressEvent) => any; + onratechange: (this: Window, ev: Event) => any; + onreadystatechange: (this: Window, ev: ProgressEvent) => any; + onreset: (this: Window, ev: Event) => any; + onresize: (this: Window, ev: UIEvent) => any; + onscroll: (this: Window, ev: UIEvent) => any; + onseeked: (this: Window, ev: Event) => any; + onseeking: (this: Window, ev: Event) => any; + onselect: (this: Window, ev: UIEvent) => any; + onstalled: (this: Window, ev: Event) => any; + onstorage: (this: Window, ev: StorageEvent) => any; + onsubmit: (this: Window, ev: Event) => any; + onsuspend: (this: Window, ev: Event) => any; + ontimeupdate: (this: Window, ev: Event) => any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; + onunload: (this: Window, ev: Event) => any; + onvolumechange: (this: Window, ev: Event) => any; + onwaiting: (this: Window, ev: Event) => any; + opener: any; + orientation: string | number; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; + readonly speechSynthesis: SpeechSynthesis; + status: string; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; + URLSearchParams: typeof URLSearchParams; + Blob: typeof Blob; + customElements: CustomElementRegistry; + alert(message?: any): void; + blur(): void; + cancelAnimationFrame(handle: number): void; + captureEvents(): void; + close(): void; + confirm(message?: string): boolean; + departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; + focus(): void; + getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; + getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; + getSelection(): Selection; + matchMedia(mediaQuery: string): MediaQueryList; + moveBy(x?: number, y?: number): void; + moveTo(x?: number, y?: number): void; + msWriteProfilerMark(profilerMarkName: string): void; + open(url?: string, target?: string, features?: string, replace?: boolean): Window; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; + print(): void; + prompt(message?: string, _default?: string): string | null; + releaseEvents(): void; + requestAnimationFrame(callback: FrameRequestCallback): number; + resizeBy(x?: number, y?: number): void; + resizeTo(x?: number, y?: number): void; + scroll(x?: number, y?: number): void; + scrollBy(x?: number, y?: number): void; + scrollTo(x?: number, y?: number): void; + stop(): void; + webkitCancelAnimationFrame(handle: number): void; + webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; + webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; + scroll(options?: ScrollToOptions): void; + scrollTo(options?: ScrollToOptions): void; + scrollBy(options?: ScrollToOptions): void; + addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Window: { + prototype: Window; + new(): Window; +} + +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: Worker, ev: MessageEvent) => any; + postMessage(message: any, transfer?: any[]): void; + terminate(): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLDocument extends Document { + addEventListener(type: K, listener: (this: XMLDocument, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLDocument: { + prototype: XMLDocument; + new(): XMLDocument; +} + +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: XMLHttpRequestResponseType; + readonly responseURL: string; + readonly responseXML: Document | null; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: Document): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface XMLSerializer { + serializeToString(target: Node): string; +} + +declare var XMLSerializer: { + prototype: XMLSerializer; + new(): XMLSerializer; +} + +interface XPathEvaluator { + createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; + createNSResolver(nodeResolver?: Node): XPathNSResolver; + evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; +} + +declare var XPathEvaluator: { + prototype: XPathEvaluator; + new(): XPathEvaluator; +} + +interface XPathExpression { + evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; +} + +declare var XPathExpression: { + prototype: XPathExpression; + new(): XPathExpression; +} + +interface XPathNSResolver { + lookupNamespaceURI(prefix: string): string; +} + +declare var XPathNSResolver: { + prototype: XPathNSResolver; + new(): XPathNSResolver; +} + +interface XPathResult { + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; + iterateNext(): Node; + snapshotItem(index: number): Node; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +declare var XPathResult: { + prototype: XPathResult; + new(): XPathResult; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; +} + +interface XSLTProcessor { + clearParameters(): void; + getParameter(namespaceURI: string, localName: string): any; + importStylesheet(style: Node): void; + removeParameter(namespaceURI: string, localName: string): void; + reset(): void; + setParameter(namespaceURI: string, localName: string, value: any): void; + transformToDocument(source: Node): Document; + transformToFragment(source: Node, document: Document): DocumentFragment; +} + +declare var XSLTProcessor: { + prototype: XSLTProcessor; + new(): XSLTProcessor; +} + +interface webkitRTCPeerConnection extends RTCPeerConnection { + addEventListener(type: K, listener: (this: webkitRTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var webkitRTCPeerConnection: { + prototype: webkitRTCPeerConnection; + new(configuration: RTCConfiguration): webkitRTCPeerConnection; +} + +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + +interface AbstractWorker { + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface Body { + readonly bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; + formData(): Promise; +} + +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + +interface ChildNode { + remove(): void; +} + +interface DOML2DeprecatedColorProperty { + color: string; +} + +interface DOML2DeprecatedSizeProperty { + size: number; +} + +interface DocumentEvent { + createEvent(eventInterface:"AnimationEvent"): AnimationEvent; + createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface:"CloseEvent"): CloseEvent; + createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; + createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface:"DragEvent"): DragEvent; + createEvent(eventInterface:"ErrorEvent"): ErrorEvent; + createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; + createEvent(eventInterface:"FocusEvent"): FocusEvent; + createEvent(eventInterface:"FocusNavigationEvent"): FocusNavigationEvent; + createEvent(eventInterface:"GamepadEvent"): GamepadEvent; + createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; + createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; + createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; + createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; + createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamEvent"): MediaStreamEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface:"MessageEvent"): MessageEvent; + createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; + createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; + createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; + createEvent(eventInterface:"NavigationEvent"): NavigationEvent; + createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; + createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; + createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface:"PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; + createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; + createEvent(eventInterface:"PointerEvent"): PointerEvent; + createEvent(eventInterface:"PopStateEvent"): PopStateEvent; + createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; + createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; + createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; + createEvent(eventInterface:"ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent; + createEvent(eventInterface:"SpeechSynthesisEvent"): SpeechSynthesisEvent; + createEvent(eventInterface:"StorageEvent"): StorageEvent; + createEvent(eventInterface:"TextEvent"): TextEvent; + createEvent(eventInterface:"TouchEvent"): TouchEvent; + createEvent(eventInterface:"TrackEvent"): TrackEvent; + createEvent(eventInterface:"TransitionEvent"): TransitionEvent; + createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; + createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; + createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface:"WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; +} + +interface ElementTraversal { + readonly childElementCount: number; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; + readonly nextElementSibling: Element | null; + readonly previousElementSibling: Element | null; +} + +interface GetSVGDocument { + getSVGDocument(): Document; +} + +interface GlobalEventHandlersEventMap { + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerup": PointerEvent; + "wheel": WheelEvent; +} + +interface GlobalEventHandlers { + onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; + onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface GlobalFetch { + fetch(input: RequestInfo, init?: RequestInit): Promise; +} + +interface HTMLTableAlignment { + /** + * Sets or retrieves a value that you can use to implement your own ch functionality for the object. + */ + ch: string; + /** + * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. + */ + chOff: string; + /** + * Sets or retrieves how text and other content are vertically aligned within the object that contains them. + */ + vAlign: string; +} + +interface IDBEnvironment { + readonly indexedDB: IDBFactory; +} + +interface LinkStyle { + readonly sheet: StyleSheet; +} + +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + +interface MSBaseReader { + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface MSFileSaver { + msSaveBlob(blob: any, defaultName?: string): boolean; + msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; +} + +interface MSNavigatorDoNotTrack { + confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; + confirmWebWideTrackingException(args: ExceptionInformation): boolean; + removeSiteSpecificTrackingException(args: ExceptionInformation): void; + removeWebWideTrackingException(args: ExceptionInformation): void; + storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; + storeWebWideTrackingException(args: StoreExceptionsInformation): void; +} + +interface NavigatorBeacon { + sendBeacon(url: USVString, data?: BodyInit): boolean; +} + +interface NavigatorConcurrentHardware { + readonly hardwareConcurrency: number; +} + +interface NavigatorContentUtils { +} + +interface NavigatorGeolocation { + readonly geolocation: Geolocation; +} + +interface NavigatorID { + readonly appCodeName: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface NavigatorStorageUtils { +} + +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + +interface NodeSelector { + querySelector(selectors: K): ElementTagNameMap[K] | null; + querySelector(selectors: string): Element | null; + querySelectorAll(selectors: K): ElementListTagNameMap[K]; + querySelectorAll(selectors: string): NodeListOf; +} + +interface RandomSource { + getRandomValues(array: ArrayBufferView): ArrayBufferView; +} + +interface SVGAnimatedPoints { + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; +} + +interface SVGFilterPrimitiveStandardAttributes { + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; +} + +interface SVGFitToViewBox { + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; +} + +interface SVGTests { + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; + hasExtension(extension: string): boolean; +} + +interface SVGURIReference { + readonly href: SVGAnimatedString; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface WindowLocalStorage { + readonly localStorage: Storage; +} + +interface WindowSessionStorage { + readonly sessionStorage: Storage; +} + +interface WindowTimers extends Object, WindowTimersExtension { + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface WindowTimersExtension { + clearImmediate(handle: number): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; +} + +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface ErrorEventInit { + message?: string; + filename?: string; + lineno?: number; + conlno?: number; + error?: any; +} + +interface StorageEventInit extends EventInit { + key?: string; + oldValue?: string; + newValue?: string; + url: string; + storageArea?: Storage; +} + +interface Canvas2DContextAttributes { + alpha?: boolean; + willReadFrequently?: boolean; + storage?: boolean; + [attribute: string]: boolean | string | undefined; +} + +interface ImageBitmapOptions { + imageOrientation?: "none" | "flipY"; + premultiplyAlpha?: "none" | "premultiply" | "default"; + colorSpaceConversion?: "none" | "default"; + resizeWidth?: number; + resizeHeight?: number; + resizeQuality?: "pixelated" | "low" | "medium" | "high"; +} + +interface ImageBitmap { + readonly width: number; + readonly height: number; + close(): void; +} + +interface URLSearchParams { + /** + * Appends a specified key/value pair as a new search parameter. + */ + append(name: string, value: string): void; + /** + * Deletes the given search parameter, and its associated value, from the list of all search parameters. + */ + delete(name: string): void; + /** + * Returns the first value associated to the given search parameter. + */ + get(name: string): string | null; + /** + * Returns all the values association with a given search parameter. + */ + getAll(name: string): string[]; + /** + * Returns a Boolean indicating if such a search parameter exists. + */ + has(name: string): boolean; + /** + * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. + */ + set(name: string, value: string): void; +} + +declare var URLSearchParams: { + prototype: URLSearchParams; + /** + * Constructor returning a URLSearchParams object. + */ + new (init?: string | URLSearchParams): URLSearchParams; +} + +interface NodeListOf extends NodeList { + length: number; + item(index: number): TNode; + [index: number]: TNode; +} + +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface ScrollOptions { + behavior?: ScrollBehavior; +} + +interface ScrollToOptions extends ScrollOptions { + left?: number; + top?: number; +} + +interface ScrollIntoViewOptions extends ScrollOptions { + block?: ScrollLogicalPosition; + inline?: ScrollLogicalPosition; +} + +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +interface ParentNode { + readonly children: HTMLCollection; + readonly firstElementChild: Element | null; + readonly lastElementChild: Element | null; + readonly childElementCount: number; +} + +interface DocumentOrShadowRoot { + readonly activeElement: Element | null; + readonly stylesheets: StyleSheetList; + getSelection(): Selection | null; + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; +} + +interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { + readonly host: Element; + innerHTML: string; +} + +interface ShadowRootInit { + mode: 'open'|'closed'; + delegatesFocus?: boolean; +} + +interface HTMLSlotElement extends HTMLElement { + name: string; + assignedNodes(options?: AssignedNodesOptions): Node[]; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + +interface ElementDefinitionOptions { + extends: string; +} + +interface CustomElementRegistry { + define(name: string, constructor: Function, options?: ElementDefinitionOptions): void; + get(name: string): any; + whenDefined(name: string): PromiseLike; +} + +interface PromiseRejectionEvent extends Event { + readonly promise: PromiseLike; + readonly reason: any; +} + +interface PromiseRejectionEventInit extends EventInit { + promise: PromiseLike; + reason?: any; +} + +interface EventListenerOptions { + capture?: boolean; +} + +interface AddEventListenerOptions extends EventListenerOptions { + passive?: boolean; + once?: boolean; +} + +interface TouchEventInit extends EventModifierInit { + touches?: Touch[]; + targetTouches?: Touch[]; + changedTouches?: Touch[]; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface MediaQueryListListener { + (mql: MediaQueryList): void; +} +interface MSLaunchUriCallback { + (): void; +} +interface FrameRequestCallback { + (time: number): void; +} +interface MSUnsafeFunctionCallback { + (): any; +} +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; +} +interface MutationCallback { + (mutations: MutationRecord[], observer: MutationObserver): void; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface VoidFunction { + (): void; +} +interface RTCSessionDescriptionCallback { + (sdp: RTCSessionDescription): void; +} +interface RTCPeerConnectionErrorCallback { + (error: DOMError): void; +} +interface RTCStatsCallback { + (report: RTCStatsReport): void; +} +interface FunctionStringCallback { + (data: string): void; +} +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: MediaKeyStatus): void; +} +interface NotificationPermissionCallback { + (permission: NotificationPermission): void; +} +interface IntersectionObserverCallback { + (entries: IntersectionObserverEntry[], observer: IntersectionObserver): void; +} +interface HTMLElementTagNameMap { + "a": HTMLAnchorElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "audio": HTMLAudioElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "data": HTMLDataElement; + "datalist": HTMLDataListElement; + "del": HTMLModElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "embed": HTMLEmbedElement; + "fieldset": HTMLFieldSetElement; + "font": HTMLFontElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "iframe": HTMLIFrameElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "marquee": HTMLMarqueeElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "meter": HTMLMeterElement; + "nextid": HTMLUnknownElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "output": HTMLOutputElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "picture": HTMLPictureElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "script": HTMLScriptElement; + "select": HTMLSelectElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "style": HTMLStyleElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "time": HTMLTimeElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "ul": HTMLUListElement; + "video": HTMLVideoElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementTagNameMap { + "a": HTMLAnchorElement; + "abbr": HTMLElement; + "acronym": HTMLElement; + "address": HTMLElement; + "applet": HTMLAppletElement; + "area": HTMLAreaElement; + "article": HTMLElement; + "aside": HTMLElement; + "audio": HTMLAudioElement; + "b": HTMLElement; + "base": HTMLBaseElement; + "basefont": HTMLBaseFontElement; + "bdo": HTMLElement; + "big": HTMLElement; + "blockquote": HTMLQuoteElement; + "body": HTMLBodyElement; + "br": HTMLBRElement; + "button": HTMLButtonElement; + "canvas": HTMLCanvasElement; + "caption": HTMLTableCaptionElement; + "center": HTMLElement; + "circle": SVGCircleElement; + "cite": HTMLElement; + "clippath": SVGClipPathElement; + "code": HTMLElement; + "col": HTMLTableColElement; + "colgroup": HTMLTableColElement; + "data": HTMLDataElement; + "datalist": HTMLDataListElement; + "dd": HTMLElement; + "defs": SVGDefsElement; + "del": HTMLModElement; + "desc": SVGDescElement; + "dfn": HTMLElement; + "dir": HTMLDirectoryElement; + "div": HTMLDivElement; + "dl": HTMLDListElement; + "dt": HTMLElement; + "ellipse": SVGEllipseElement; + "em": HTMLElement; + "embed": HTMLEmbedElement; + "feblend": SVGFEBlendElement; + "fecolormatrix": SVGFEColorMatrixElement; + "fecomponenttransfer": SVGFEComponentTransferElement; + "fecomposite": SVGFECompositeElement; + "feconvolvematrix": SVGFEConvolveMatrixElement; + "fediffuselighting": SVGFEDiffuseLightingElement; + "fedisplacementmap": SVGFEDisplacementMapElement; + "fedistantlight": SVGFEDistantLightElement; + "feflood": SVGFEFloodElement; + "fefunca": SVGFEFuncAElement; + "fefuncb": SVGFEFuncBElement; + "fefuncg": SVGFEFuncGElement; + "fefuncr": SVGFEFuncRElement; + "fegaussianblur": SVGFEGaussianBlurElement; + "feimage": SVGFEImageElement; + "femerge": SVGFEMergeElement; + "femergenode": SVGFEMergeNodeElement; + "femorphology": SVGFEMorphologyElement; + "feoffset": SVGFEOffsetElement; + "fepointlight": SVGFEPointLightElement; + "fespecularlighting": SVGFESpecularLightingElement; + "fespotlight": SVGFESpotLightElement; + "fetile": SVGFETileElement; + "feturbulence": SVGFETurbulenceElement; + "fieldset": HTMLFieldSetElement; + "figcaption": HTMLElement; + "figure": HTMLElement; + "filter": SVGFilterElement; + "font": HTMLFontElement; + "footer": HTMLElement; + "foreignobject": SVGForeignObjectElement; + "form": HTMLFormElement; + "frame": HTMLFrameElement; + "frameset": HTMLFrameSetElement; + "g": SVGGElement; + "h1": HTMLHeadingElement; + "h2": HTMLHeadingElement; + "h3": HTMLHeadingElement; + "h4": HTMLHeadingElement; + "h5": HTMLHeadingElement; + "h6": HTMLHeadingElement; + "head": HTMLHeadElement; + "header": HTMLElement; + "hgroup": HTMLElement; + "hr": HTMLHRElement; + "html": HTMLHtmlElement; + "i": HTMLElement; + "iframe": HTMLIFrameElement; + "image": SVGImageElement; + "img": HTMLImageElement; + "input": HTMLInputElement; + "ins": HTMLModElement; + "isindex": HTMLUnknownElement; + "kbd": HTMLElement; + "keygen": HTMLElement; + "label": HTMLLabelElement; + "legend": HTMLLegendElement; + "li": HTMLLIElement; + "line": SVGLineElement; + "lineargradient": SVGLinearGradientElement; + "link": HTMLLinkElement; + "listing": HTMLPreElement; + "map": HTMLMapElement; + "mark": HTMLElement; + "marker": SVGMarkerElement; + "marquee": HTMLMarqueeElement; + "mask": SVGMaskElement; + "menu": HTMLMenuElement; + "meta": HTMLMetaElement; + "metadata": SVGMetadataElement; + "meter": HTMLMeterElement; + "nav": HTMLElement; + "nextid": HTMLUnknownElement; + "nobr": HTMLElement; + "noframes": HTMLElement; + "noscript": HTMLElement; + "object": HTMLObjectElement; + "ol": HTMLOListElement; + "optgroup": HTMLOptGroupElement; + "option": HTMLOptionElement; + "output": HTMLOutputElement; + "p": HTMLParagraphElement; + "param": HTMLParamElement; + "path": SVGPathElement; + "pattern": SVGPatternElement; + "picture": HTMLPictureElement; + "plaintext": HTMLElement; + "polygon": SVGPolygonElement; + "polyline": SVGPolylineElement; + "pre": HTMLPreElement; + "progress": HTMLProgressElement; + "q": HTMLQuoteElement; + "radialgradient": SVGRadialGradientElement; + "rect": SVGRectElement; + "rt": HTMLElement; + "ruby": HTMLElement; + "s": HTMLElement; + "samp": HTMLElement; + "script": HTMLScriptElement; + "section": HTMLElement; + "select": HTMLSelectElement; + "small": HTMLElement; + "source": HTMLSourceElement; + "span": HTMLSpanElement; + "stop": SVGStopElement; + "strike": HTMLElement; + "strong": HTMLElement; + "style": HTMLStyleElement; + "sub": HTMLElement; + "sup": HTMLElement; + "svg": SVGSVGElement; + "switch": SVGSwitchElement; + "symbol": SVGSymbolElement; + "table": HTMLTableElement; + "tbody": HTMLTableSectionElement; + "td": HTMLTableDataCellElement; + "template": HTMLTemplateElement; + "text": SVGTextElement; + "textpath": SVGTextPathElement; + "textarea": HTMLTextAreaElement; + "tfoot": HTMLTableSectionElement; + "th": HTMLTableHeaderCellElement; + "thead": HTMLTableSectionElement; + "time": HTMLTimeElement; + "title": HTMLTitleElement; + "tr": HTMLTableRowElement; + "track": HTMLTrackElement; + "tspan": SVGTSpanElement; + "tt": HTMLElement; + "u": HTMLElement; + "ul": HTMLUListElement; + "use": SVGUseElement; + "var": HTMLElement; + "video": HTMLVideoElement; + "view": SVGViewElement; + "wbr": HTMLElement; + "x-ms-webview": MSHTMLWebViewElement; + "xmp": HTMLPreElement; +} + +interface ElementListTagNameMap { + "a": NodeListOf; + "abbr": NodeListOf; + "acronym": NodeListOf; + "address": NodeListOf; + "applet": NodeListOf; + "area": NodeListOf; + "article": NodeListOf; + "aside": NodeListOf; + "audio": NodeListOf; + "b": NodeListOf; + "base": NodeListOf; + "basefont": NodeListOf; + "bdo": NodeListOf; + "big": NodeListOf; + "blockquote": NodeListOf; + "body": NodeListOf; + "br": NodeListOf; + "button": NodeListOf; + "canvas": NodeListOf; + "caption": NodeListOf; + "center": NodeListOf; + "circle": NodeListOf; + "cite": NodeListOf; + "clippath": NodeListOf; + "code": NodeListOf; + "col": NodeListOf; + "colgroup": NodeListOf; + "data": NodeListOf; + "datalist": NodeListOf; + "dd": NodeListOf; + "defs": NodeListOf; + "del": NodeListOf; + "desc": NodeListOf; + "dfn": NodeListOf; + "dir": NodeListOf; + "div": NodeListOf; + "dl": NodeListOf; + "dt": NodeListOf; + "ellipse": NodeListOf; + "em": NodeListOf; + "embed": NodeListOf; + "feblend": NodeListOf; + "fecolormatrix": NodeListOf; + "fecomponenttransfer": NodeListOf; + "fecomposite": NodeListOf; + "feconvolvematrix": NodeListOf; + "fediffuselighting": NodeListOf; + "fedisplacementmap": NodeListOf; + "fedistantlight": NodeListOf; + "feflood": NodeListOf; + "fefunca": NodeListOf; + "fefuncb": NodeListOf; + "fefuncg": NodeListOf; + "fefuncr": NodeListOf; + "fegaussianblur": NodeListOf; + "feimage": NodeListOf; + "femerge": NodeListOf; + "femergenode": NodeListOf; + "femorphology": NodeListOf; + "feoffset": NodeListOf; + "fepointlight": NodeListOf; + "fespecularlighting": NodeListOf; + "fespotlight": NodeListOf; + "fetile": NodeListOf; + "feturbulence": NodeListOf; + "fieldset": NodeListOf; + "figcaption": NodeListOf; + "figure": NodeListOf; + "filter": NodeListOf; + "font": NodeListOf; + "footer": NodeListOf; + "foreignobject": NodeListOf; + "form": NodeListOf; + "frame": NodeListOf; + "frameset": NodeListOf; + "g": NodeListOf; + "h1": NodeListOf; + "h2": NodeListOf; + "h3": NodeListOf; + "h4": NodeListOf; + "h5": NodeListOf; + "h6": NodeListOf; + "head": NodeListOf; + "header": NodeListOf; + "hgroup": NodeListOf; + "hr": NodeListOf; + "html": NodeListOf; + "i": NodeListOf; + "iframe": NodeListOf; + "image": NodeListOf; + "img": NodeListOf; + "input": NodeListOf; + "ins": NodeListOf; + "isindex": NodeListOf; + "kbd": NodeListOf; + "keygen": NodeListOf; + "label": NodeListOf; + "legend": NodeListOf; + "li": NodeListOf; + "line": NodeListOf; + "lineargradient": NodeListOf; + "link": NodeListOf; + "listing": NodeListOf; + "map": NodeListOf; + "mark": NodeListOf; + "marker": NodeListOf; + "marquee": NodeListOf; + "mask": NodeListOf; + "menu": NodeListOf; + "meta": NodeListOf; + "metadata": NodeListOf; + "meter": NodeListOf; + "nav": NodeListOf; + "nextid": NodeListOf; + "nobr": NodeListOf; + "noframes": NodeListOf; + "noscript": NodeListOf; + "object": NodeListOf; + "ol": NodeListOf; + "optgroup": NodeListOf; + "option": NodeListOf; + "output": NodeListOf; + "p": NodeListOf; + "param": NodeListOf; + "path": NodeListOf; + "pattern": NodeListOf; + "picture": NodeListOf; + "plaintext": NodeListOf; + "polygon": NodeListOf; + "polyline": NodeListOf; + "pre": NodeListOf; + "progress": NodeListOf; + "q": NodeListOf; + "radialgradient": NodeListOf; + "rect": NodeListOf; + "rt": NodeListOf; + "ruby": NodeListOf; + "s": NodeListOf; + "samp": NodeListOf; + "script": NodeListOf; + "section": NodeListOf; + "select": NodeListOf; + "small": NodeListOf; + "source": NodeListOf; + "span": NodeListOf; + "stop": NodeListOf; + "strike": NodeListOf; + "strong": NodeListOf; + "style": NodeListOf; + "sub": NodeListOf; + "sup": NodeListOf; + "svg": NodeListOf; + "switch": NodeListOf; + "symbol": NodeListOf; + "table": NodeListOf; + "tbody": NodeListOf; + "td": NodeListOf; + "template": NodeListOf; + "text": NodeListOf; + "textpath": NodeListOf; + "textarea": NodeListOf; + "tfoot": NodeListOf; + "th": NodeListOf; + "thead": NodeListOf; + "time": NodeListOf; + "title": NodeListOf; + "tr": NodeListOf; + "track": NodeListOf; + "tspan": NodeListOf; + "tt": NodeListOf; + "u": NodeListOf; + "ul": NodeListOf; + "use": NodeListOf; + "var": NodeListOf; + "video": NodeListOf; + "view": NodeListOf; + "wbr": NodeListOf; + "x-ms-webview": NodeListOf; + "xmp": NodeListOf; +} -/// - -interface SymbolConstructor { - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} - -interface Symbol { - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface Array { - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface Map { - readonly [Symbol.toStringTag]: "Map"; -} - -interface WeakMap{ - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface Set { - readonly [Symbol.toStringTag]: "Set"; -} - -interface WeakSet { - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -interface Function { - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface Math { - readonly [Symbol.toStringTag]: "Math"; -} - -interface Promise { - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - readonly [Symbol.species]: Function; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray | null; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface String { - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - readonly [Symbol.toStringTag]: "Int8Array"; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - readonly [Symbol.toStringTag]: "Int16Array"; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - readonly [Symbol.toStringTag]: "Int32Array"; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - readonly [Symbol.toStringTag]: "Float32Array"; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - readonly [Symbol.toStringTag]: "Float64Array"; -} - - -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface ConstrainBooleanParameters { - exact?: boolean; - ideal?: boolean; -} - -interface ConstrainDOMStringParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface ConstrainDoubleRange extends DoubleRange { - exact?: number; - ideal?: number; -} - -interface ConstrainLongRange extends LongRange { - exact?: number; - ideal?: number; -} - -interface ConstrainVideoFacingModeParameters { - exact?: string | string[]; - ideal?: string | string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceLightEventInit extends EventInit { - value?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface DoubleRange { - max?: number; - min?: number; -} - -interface EventInit { - scoped?: boolean; - bubbles?: boolean; - cancelable?: boolean; -} - -interface EventModifierInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - modifierAltGraph?: boolean; - modifierCapsLock?: boolean; - modifierFn?: boolean; - modifierFnLock?: boolean; - modifierHyper?: boolean; - modifierNumLock?: boolean; - modifierOS?: boolean; - modifierScrollLock?: boolean; - modifierSuper?: boolean; - modifierSymbol?: boolean; - modifierSymbolLock?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends EventModifierInit { - code?: string; - key?: string; - location?: number; - repeat?: boolean; -} - -interface LongRange { - max?: number; - min?: number; -} - -interface MSAccountInfo { - rpDisplayName?: string; - userDisplayName?: string; - accountName?: string; - userId?: string; - accountImageUri?: string; -} - -interface MSAudioLocalClientEvent extends MSLocalClientEventBase { - networkSendQualityEventRatio?: number; - networkDelayEventRatio?: number; - cpuInsufficientEventRatio?: number; - deviceHalfDuplexAECEventRatio?: number; - deviceRenderNotFunctioningEventRatio?: number; - deviceCaptureNotFunctioningEventRatio?: number; - deviceGlitchesEventRatio?: number; - deviceLowSNREventRatio?: number; - deviceLowSpeechLevelEventRatio?: number; - deviceClippingEventRatio?: number; - deviceEchoEventRatio?: number; - deviceNearEndToEchoRatioEventRatio?: number; - deviceRenderZeroVolumeEventRatio?: number; - deviceRenderMuteEventRatio?: number; - deviceMultipleEndpointsEventCount?: number; - deviceHowlingEventCount?: number; -} - -interface MSAudioRecvPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioRecvSignal; - packetReorderRatio?: number; - packetReorderDepthAvg?: number; - packetReorderDepthMax?: number; - burstLossLength1?: number; - burstLossLength2?: number; - burstLossLength3?: number; - burstLossLength4?: number; - burstLossLength5?: number; - burstLossLength6?: number; - burstLossLength7?: number; - burstLossLength8OrHigher?: number; - fecRecvDistance1?: number; - fecRecvDistance2?: number; - fecRecvDistance3?: number; - ratioConcealedSamplesAvg?: number; - ratioStretchedSamplesAvg?: number; - ratioCompressedSamplesAvg?: number; -} - -interface MSAudioRecvSignal { - initialSignalLevelRMS?: number; - recvSignalLevelCh1?: number; - recvNoiseLevelCh1?: number; - renderSignalLevel?: number; - renderNoiseLevel?: number; - renderLoopbackSignalLevel?: number; -} - -interface MSAudioSendPayload extends MSPayloadBase { - samplingRate?: number; - signal?: MSAudioSendSignal; - audioFECUsed?: boolean; - sendMutePercent?: number; -} - -interface MSAudioSendSignal { - noiseLevel?: number; - sendSignalLevelCh1?: number; - sendNoiseLevelCh1?: number; -} - -interface MSConnectivity { - iceType?: string; - iceWarningFlags?: MSIceWarningFlags; - relayAddress?: MSRelayAddress; -} - -interface MSCredentialFilter { - accept?: MSCredentialSpec[]; -} - -interface MSCredentialParameters { - type?: string; -} - -interface MSCredentialSpec { - type?: string; - id?: string; -} - -interface MSDelay { - roundTrip?: number; - roundTripMax?: number; -} - -interface MSDescription extends RTCStats { - connectivity?: MSConnectivity; - transport?: string; - networkconnectivity?: MSNetworkConnectivityInfo; - localAddr?: MSIPAddressInfo; - remoteAddr?: MSIPAddressInfo; - deviceDevName?: string; - reflexiveLocalIPAddr?: MSIPAddressInfo; -} - -interface MSFIDOCredentialParameters extends MSCredentialParameters { - algorithm?: string | Algorithm; - authenticators?: AAGUID[]; -} - -interface MSIPAddressInfo { - ipAddr?: string; - port?: number; - manufacturerMacAddrMask?: string; -} - -interface MSIceWarningFlags { - turnTcpTimedOut?: boolean; - turnUdpAllocateFailed?: boolean; - turnUdpSendFailed?: boolean; - turnTcpAllocateFailed?: boolean; - turnTcpSendFailed?: boolean; - udpLocalConnectivityFailed?: boolean; - udpNatConnectivityFailed?: boolean; - udpRelayConnectivityFailed?: boolean; - tcpNatConnectivityFailed?: boolean; - tcpRelayConnectivityFailed?: boolean; - connCheckMessageIntegrityFailed?: boolean; - allocationMessageIntegrityFailed?: boolean; - connCheckOtherError?: boolean; - turnAuthUnknownUsernameError?: boolean; - noRelayServersConfigured?: boolean; - multipleRelayServersAttempted?: boolean; - portRangeExhausted?: boolean; - alternateServerReceived?: boolean; - pseudoTLSFailure?: boolean; - turnTurnTcpConnectivityFailed?: boolean; - useCandidateChecksFailed?: boolean; - fipsAllocationFailure?: boolean; -} - -interface MSJitter { - interArrival?: number; - interArrivalMax?: number; - interArrivalSD?: number; -} - -interface MSLocalClientEventBase extends RTCStats { - networkReceiveQualityEventRatio?: number; - networkBandwidthLowEventRatio?: number; -} - -interface MSNetwork extends RTCStats { - jitter?: MSJitter; - delay?: MSDelay; - packetLoss?: MSPacketLoss; - utilization?: MSUtilization; -} - -interface MSNetworkConnectivityInfo { - vpn?: boolean; - linkspeed?: number; - networkConnectionDetails?: string; -} - -interface MSNetworkInterfaceType { - interfaceTypeEthernet?: boolean; - interfaceTypeWireless?: boolean; - interfaceTypePPP?: boolean; - interfaceTypeTunnel?: boolean; - interfaceTypeWWAN?: boolean; -} - -interface MSOutboundNetwork extends MSNetwork { - appliedBandwidthLimit?: number; -} - -interface MSPacketLoss { - lossRate?: number; - lossRateMax?: number; -} - -interface MSPayloadBase extends RTCStats { - payloadDescription?: string; -} - -interface MSRelayAddress { - relayAddress?: string; - port?: number; -} - -interface MSSignatureParameters { - userPrompt?: string; -} - -interface MSTransportDiagnosticsStats extends RTCStats { - baseAddress?: string; - localAddress?: string; - localSite?: string; - networkName?: string; - remoteAddress?: string; - remoteSite?: string; - localMR?: string; - remoteMR?: string; - iceWarningFlags?: MSIceWarningFlags; - portRangeMin?: number; - portRangeMax?: number; - localMRTCPPort?: number; - remoteMRTCPPort?: number; - stunVer?: number; - numConsentReqSent?: number; - numConsentReqReceived?: number; - numConsentRespSent?: number; - numConsentRespReceived?: number; - interfaces?: MSNetworkInterfaceType; - baseInterface?: MSNetworkInterfaceType; - protocol?: string; - localInterface?: MSNetworkInterfaceType; - localAddrType?: string; - remoteAddrType?: string; - iceRole?: string; - rtpRtcpMux?: boolean; - allocationTimeInMs?: number; - msRtcEngineVersion?: string; -} - -interface MSUtilization { - packets?: number; - bandwidthEstimation?: number; - bandwidthEstimationMin?: number; - bandwidthEstimationMax?: number; - bandwidthEstimationStdDev?: number; - bandwidthEstimationAvg?: number; -} - -interface MSVideoPayload extends MSPayloadBase { - resoluton?: string; - videoBitRateAvg?: number; - videoBitRateMax?: number; - videoFrameRateAvg?: number; - videoPacketLossRate?: number; - durationSeconds?: number; -} - -interface MSVideoRecvPayload extends MSVideoPayload { - videoFrameLossRate?: number; - recvCodecType?: string; - recvResolutionWidth?: number; - recvResolutionHeight?: number; - videoResolutions?: MSVideoResolutionDistribution; - recvFrameRateAverage?: number; - recvBitRateMaximum?: number; - recvBitRateAverage?: number; - recvVideoStreamsMax?: number; - recvVideoStreamsMin?: number; - recvVideoStreamsMode?: number; - videoPostFECPLR?: number; - lowBitRateCallPercent?: number; - lowFrameRateCallPercent?: number; - reorderBufferTotalPackets?: number; - recvReorderBufferReorderedPackets?: number; - recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; - recvReorderBufferMaxSuccessfullyOrderedExtent?: number; - recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; - recvReorderBufferPacketsDroppedDueToTimeout?: number; - recvFpsHarmonicAverage?: number; - recvNumResSwitches?: number; -} - -interface MSVideoResolutionDistribution { - cifQuality?: number; - vgaQuality?: number; - h720Quality?: number; - h1080Quality?: number; - h1440Quality?: number; - h2160Quality?: number; -} - -interface MSVideoSendPayload extends MSVideoPayload { - sendFrameRateAverage?: number; - sendBitRateMaximum?: number; - sendBitRateAverage?: number; - sendVideoStreamsMax?: number; - sendResolutionWidth?: number; - sendResolutionHeight?: number; -} - -interface MediaEncryptedEventInit extends EventInit { - initDataType?: string; - initData?: ArrayBuffer; -} - -interface MediaKeyMessageEventInit extends EventInit { - messageType?: string; - message?: ArrayBuffer; -} - -interface MediaKeySystemConfiguration { - initDataTypes?: string[]; - audioCapabilities?: MediaKeySystemMediaCapability[]; - videoCapabilities?: MediaKeySystemMediaCapability[]; - distinctiveIdentifier?: string; - persistentState?: string; -} - -interface MediaKeySystemMediaCapability { - contentType?: string; - robustness?: string; -} - -interface MediaStreamConstraints { - video?: boolean | MediaTrackConstraints; - audio?: boolean | MediaTrackConstraints; -} - -interface MediaStreamErrorEventInit extends EventInit { - error?: MediaStreamError; -} - -interface MediaStreamTrackEventInit extends EventInit { - track?: MediaStreamTrack; -} - -interface MediaTrackCapabilities { - width?: number | LongRange; - height?: number | LongRange; - aspectRatio?: number | DoubleRange; - frameRate?: number | DoubleRange; - facingMode?: string; - volume?: number | DoubleRange; - sampleRate?: number | LongRange; - sampleSize?: number | LongRange; - echoCancellation?: boolean[]; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackConstraintSet { - width?: number | ConstrainLongRange; - height?: number | ConstrainLongRange; - aspectRatio?: number | ConstrainDoubleRange; - frameRate?: number | ConstrainDoubleRange; - facingMode?: string | string[] | ConstrainDOMStringParameters; - volume?: number | ConstrainDoubleRange; - sampleRate?: number | ConstrainLongRange; - sampleSize?: number | ConstrainLongRange; - echoCancelation?: boolean | ConstrainBooleanParameters; - deviceId?: string | string[] | ConstrainDOMStringParameters; - groupId?: string | string[] | ConstrainDOMStringParameters; -} - -interface MediaTrackConstraints extends MediaTrackConstraintSet { - advanced?: MediaTrackConstraintSet[]; -} - -interface MediaTrackSettings { - width?: number; - height?: number; - aspectRatio?: number; - frameRate?: number; - facingMode?: string; - volume?: number; - sampleRate?: number; - sampleSize?: number; - echoCancellation?: boolean; - deviceId?: string; - groupId?: string; -} - -interface MediaTrackSupportedConstraints { - width?: boolean; - height?: boolean; - aspectRatio?: boolean; - frameRate?: boolean; - facingMode?: boolean; - volume?: boolean; - sampleRate?: boolean; - sampleSize?: boolean; - echoCancellation?: boolean; - deviceId?: boolean; - groupId?: boolean; -} - -interface MouseEventInit extends EventModifierInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PeriodicWaveConstraints { - disableNormalization?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface RTCDTMFToneChangeEventInit extends EventInit { - tone?: string; -} - -interface RTCDtlsFingerprint { - algorithm?: string; - value?: string; -} - -interface RTCDtlsParameters { - role?: string; - fingerprints?: RTCDtlsFingerprint[]; -} - -interface RTCIceCandidate { - foundation?: string; - priority?: number; - ip?: string; - protocol?: string; - port?: number; - type?: string; - tcpType?: string; - relatedAddress?: string; - relatedPort?: number; -} - -interface RTCIceCandidateAttributes extends RTCStats { - ipAddress?: string; - portNumber?: number; - transport?: string; - candidateType?: string; - priority?: number; - addressSourceUrl?: string; -} - -interface RTCIceCandidateComplete { -} - -interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; -} - -interface RTCIceCandidatePairStats extends RTCStats { - transportId?: string; - localCandidateId?: string; - remoteCandidateId?: string; - state?: string; - priority?: number; - nominated?: boolean; - writable?: boolean; - readable?: boolean; - bytesSent?: number; - bytesReceived?: number; - roundTripTime?: number; - availableOutgoingBitrate?: number; - availableIncomingBitrate?: number; -} - -interface RTCIceGatherOptions { - gatherPolicy?: string; - iceservers?: RTCIceServer[]; -} - -interface RTCIceParameters { - usernameFragment?: string; - password?: string; -} - -interface RTCIceServer { - urls?: any; - username?: string; - credential?: string; -} - -interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { - packetsReceived?: number; - bytesReceived?: number; - packetsLost?: number; - jitter?: number; - fractionLost?: number; -} - -interface RTCMediaStreamTrackStats extends RTCStats { - trackIdentifier?: string; - remoteSource?: boolean; - ssrcIds?: string[]; - frameWidth?: number; - frameHeight?: number; - framesPerSecond?: number; - framesSent?: number; - framesReceived?: number; - framesDecoded?: number; - framesDropped?: number; - framesCorrupted?: number; - audioLevel?: number; - echoReturnLoss?: number; - echoReturnLossEnhancement?: number; -} - -interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { - packetsSent?: number; - bytesSent?: number; - targetBitrate?: number; - roundTripTime?: number; -} - -interface RTCRTPStreamStats extends RTCStats { - ssrc?: string; - associateStatsId?: string; - isRemote?: boolean; - mediaTrackId?: string; - transportId?: string; - codecId?: string; - firCount?: number; - pliCount?: number; - nackCount?: number; - sliCount?: number; -} - -interface RTCRtcpFeedback { - type?: string; - parameter?: string; -} - -interface RTCRtcpParameters { - ssrc?: number; - cname?: string; - reducedSize?: boolean; - mux?: boolean; -} - -interface RTCRtpCapabilities { - codecs?: RTCRtpCodecCapability[]; - headerExtensions?: RTCRtpHeaderExtension[]; - fecMechanisms?: string[]; -} - -interface RTCRtpCodecCapability { - name?: string; - kind?: string; - clockRate?: number; - preferredPayloadType?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; - options?: any; - maxTemporalLayers?: number; - maxSpatialLayers?: number; - svcMultiStreamSupport?: boolean; -} - -interface RTCRtpCodecParameters { - name?: string; - payloadType?: any; - clockRate?: number; - maxptime?: number; - numChannels?: number; - rtcpFeedback?: RTCRtcpFeedback[]; - parameters?: any; -} - -interface RTCRtpContributingSource { - timestamp?: number; - csrc?: number; - audioLevel?: number; -} - -interface RTCRtpEncodingParameters { - ssrc?: number; - codecPayloadType?: number; - fec?: RTCRtpFecParameters; - rtx?: RTCRtpRtxParameters; - priority?: number; - maxBitrate?: number; - minQuality?: number; - framerateBias?: number; - resolutionScale?: number; - framerateScale?: number; - active?: boolean; - encodingId?: string; - dependencyEncodingIds?: string[]; - ssrcRange?: RTCSsrcRange; -} - -interface RTCRtpFecParameters { - ssrc?: number; - mechanism?: string; -} - -interface RTCRtpHeaderExtension { - kind?: string; - uri?: string; - preferredId?: number; - preferredEncrypt?: boolean; -} - -interface RTCRtpHeaderExtensionParameters { - uri?: string; - id?: number; - encrypt?: boolean; -} - -interface RTCRtpParameters { - muxId?: string; - codecs?: RTCRtpCodecParameters[]; - headerExtensions?: RTCRtpHeaderExtensionParameters[]; - encodings?: RTCRtpEncodingParameters[]; - rtcp?: RTCRtcpParameters; -} - -interface RTCRtpRtxParameters { - ssrc?: number; -} - -interface RTCRtpUnhandled { - ssrc?: number; - payloadType?: number; - muxId?: string; -} - -interface RTCSrtpKeyParam { - keyMethod?: string; - keySalt?: string; - lifetime?: string; - mkiValue?: number; - mkiLength?: number; -} - -interface RTCSrtpSdesParameters { - tag?: number; - cryptoSuite?: string; - keyParams?: RTCSrtpKeyParam[]; - sessionParams?: string[]; -} - -interface RTCSsrcRange { - min?: number; - max?: number; -} - -interface RTCStats { - timestamp?: number; - type?: string; - id?: string; - msType?: string; -} - -interface RTCStatsReport { -} - -interface RTCTransportStats extends RTCStats { - bytesSent?: number; - bytesReceived?: number; - rtcpTransportStatsId?: string; - activeConnection?: boolean; - selectedCandidatePairId?: string; - localCertificateId?: string; - remoteCertificateId?: string; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - failIfMajorPerformanceCaveat?: boolean; - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - readonly frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - readonly animationName: string; - readonly elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCacheEventMap { - "cached": Event; - "checking": Event; - "downloading": Event; - "error": ErrorEvent; - "noupdate": Event; - "obsolete": Event; - "progress": ProgressEvent; - "updateready": Event; -} - -interface ApplicationCache extends EventTarget { - oncached: (this: ApplicationCache, ev: Event) => any; - onchecking: (this: ApplicationCache, ev: Event) => any; - ondownloading: (this: ApplicationCache, ev: Event) => any; - onerror: (this: ApplicationCache, ev: ErrorEvent) => any; - onnoupdate: (this: ApplicationCache, ev: Event) => any; - onobsolete: (this: ApplicationCache, ev: Event) => any; - onprogress: (this: ApplicationCache, ev: ProgressEvent) => any; - onupdateready: (this: ApplicationCache, ev: Event) => any; - readonly status: number; - abort(): void; - swapCache(): void; - update(): void; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; - addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - readonly CHECKING: number; - readonly DOWNLOADING: number; - readonly IDLE: number; - readonly OBSOLETE: number; - readonly UNCACHED: number; - readonly UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - readonly attributeName: string; - attributeValue: string | null; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - readonly name: string; - readonly ownerElement: Element; - readonly prefix: string | null; - readonly specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNodeEventMap { - "ended": MediaStreamErrorEvent; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer | null; - readonly detune: AudioParam; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any; - readonly playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - readonly currentTime: number; - readonly destination: AudioDestinationNode; - readonly listener: AudioListener; - readonly sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - readonly maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - readonly context: AudioContext; - readonly numberOfInputs: number; - readonly numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - readonly defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - readonly inputBuffer: AudioBuffer; - readonly outputBuffer: AudioBuffer; - readonly playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - readonly id: string; - kind: string; - readonly label: string; - language: string; - readonly sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackListEventMap { - "addtrack": TrackEvent; - "change": Event; - "removetrack": TrackEvent; -} - -interface AudioTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any; - onchange: (this: AudioTrackList, ev: Event) => any; - onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack | null; - item(index: number): AudioTrack; - addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - readonly visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - readonly Q: AudioParam; - readonly detune: AudioParam; - readonly frequency: AudioParam; - readonly gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - readonly style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - readonly cssRules: CSSRuleList; - deleteRule(index: number): void; - insertRule(rule: string, index: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - readonly href: string; - readonly media: MediaList; - readonly styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - readonly cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - readonly media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - readonly namespaceURI: string; - readonly prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - readonly pseudoClass: string; - readonly selector: string; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - readonly parentRule: CSSRule; - readonly parentStyleSheet: CSSStyleSheet; - readonly type: number; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - readonly CHARSET_RULE: number; - readonly FONT_FACE_RULE: number; - readonly IMPORT_RULE: number; - readonly KEYFRAMES_RULE: number; - readonly KEYFRAME_RULE: number; - readonly MEDIA_RULE: number; - readonly NAMESPACE_RULE: number; - readonly PAGE_RULE: number; - readonly STYLE_RULE: number; - readonly SUPPORTS_RULE: number; - readonly UNKNOWN_RULE: number; - readonly VIEWPORT_RULE: number; -} - -interface CSSRuleList { - readonly length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; - alignmentBaseline: string | null; - animation: string | null; - animationDelay: string | null; - animationDirection: string | null; - animationDuration: string | null; - animationFillMode: string | null; - animationIterationCount: string | null; - animationName: string | null; - animationPlayState: string | null; - animationTimingFunction: string | null; - backfaceVisibility: string | null; - background: string | null; - backgroundAttachment: string | null; - backgroundClip: string | null; - backgroundColor: string | null; - backgroundImage: string | null; - backgroundOrigin: string | null; - backgroundPosition: string | null; - backgroundPositionX: string | null; - backgroundPositionY: string | null; - backgroundRepeat: string | null; - backgroundSize: string | null; - baselineShift: string | null; - border: string | null; - borderBottom: string | null; - borderBottomColor: string | null; - borderBottomLeftRadius: string | null; - borderBottomRightRadius: string | null; - borderBottomStyle: string | null; - borderBottomWidth: string | null; - borderCollapse: string | null; - borderColor: string | null; - borderImage: string | null; - borderImageOutset: string | null; - borderImageRepeat: string | null; - borderImageSlice: string | null; - borderImageSource: string | null; - borderImageWidth: string | null; - borderLeft: string | null; - borderLeftColor: string | null; - borderLeftStyle: string | null; - borderLeftWidth: string | null; - borderRadius: string | null; - borderRight: string | null; - borderRightColor: string | null; - borderRightStyle: string | null; - borderRightWidth: string | null; - borderSpacing: string | null; - borderStyle: string | null; - borderTop: string | null; - borderTopColor: string | null; - borderTopLeftRadius: string | null; - borderTopRightRadius: string | null; - borderTopStyle: string | null; - borderTopWidth: string | null; - borderWidth: string | null; - bottom: string | null; - boxShadow: string | null; - boxSizing: string | null; - breakAfter: string | null; - breakBefore: string | null; - breakInside: string | null; - captionSide: string | null; - clear: string | null; - clip: string | null; - clipPath: string | null; - clipRule: string | null; - color: string | null; - colorInterpolationFilters: string | null; - columnCount: any; - columnFill: string | null; - columnGap: any; - columnRule: string | null; - columnRuleColor: any; - columnRuleStyle: string | null; - columnRuleWidth: any; - columnSpan: string | null; - columnWidth: any; - columns: string | null; - content: string | null; - counterIncrement: string | null; - counterReset: string | null; - cssFloat: string | null; - cssText: string; - cursor: string | null; - direction: string | null; - display: string | null; - dominantBaseline: string | null; - emptyCells: string | null; - enableBackground: string | null; - fill: string | null; - fillOpacity: string | null; - fillRule: string | null; - filter: string | null; - flex: string | null; - flexBasis: string | null; - flexDirection: string | null; - flexFlow: string | null; - flexGrow: string | null; - flexShrink: string | null; - flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; - height: string | null; - imeMode: string | null; - justifyContent: string | null; - kerning: string | null; - left: string | null; - readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineHeight: string | null; - listStyle: string | null; - listStyleImage: string | null; - listStylePosition: string | null; - listStyleType: string | null; - margin: string | null; - marginBottom: string | null; - marginLeft: string | null; - marginRight: string | null; - marginTop: string | null; - marker: string | null; - markerEnd: string | null; - markerMid: string | null; - markerStart: string | null; - mask: string | null; - maxHeight: string | null; - maxWidth: string | null; - minHeight: string | null; - minWidth: string | null; - msContentZoomChaining: string | null; - msContentZoomLimit: string | null; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string | null; - msContentZoomSnapPoints: string | null; - msContentZoomSnapType: string | null; - msContentZooming: string | null; - msFlowFrom: string | null; - msFlowInto: string | null; - msFontFeatureSettings: string | null; - msGridColumn: any; - msGridColumnAlign: string | null; - msGridColumnSpan: any; - msGridColumns: string | null; - msGridRow: any; - msGridRowAlign: string | null; - msGridRowSpan: any; - msGridRows: string | null; - msHighContrastAdjust: string | null; - msHyphenateLimitChars: string | null; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string | null; - msImeAlign: string | null; - msOverflowStyle: string | null; - msScrollChaining: string | null; - msScrollLimit: string | null; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string | null; - msScrollSnapPointsX: string | null; - msScrollSnapPointsY: string | null; - msScrollSnapType: string | null; - msScrollSnapX: string | null; - msScrollSnapY: string | null; - msScrollTranslation: string | null; - msTextCombineHorizontal: string | null; - msTextSizeAdjust: any; - msTouchAction: string | null; - msTouchSelect: string | null; - msUserSelect: string | null; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string | null; - order: string | null; - orphans: string | null; - outline: string | null; - outlineColor: string | null; - outlineStyle: string | null; - outlineWidth: string | null; - overflow: string | null; - overflowX: string | null; - overflowY: string | null; - padding: string | null; - paddingBottom: string | null; - paddingLeft: string | null; - paddingRight: string | null; - paddingTop: string | null; - pageBreakAfter: string | null; - pageBreakBefore: string | null; - pageBreakInside: string | null; - readonly parentRule: CSSRule; - perspective: string | null; - perspectiveOrigin: string | null; - pointerEvents: string | null; - position: string | null; - quotes: string | null; - right: string | null; - rubyAlign: string | null; - rubyOverhang: string | null; - rubyPosition: string | null; - stopColor: string | null; - stopOpacity: string | null; - stroke: string | null; - strokeDasharray: string | null; - strokeDashoffset: string | null; - strokeLinecap: string | null; - strokeLinejoin: string | null; - strokeMiterlimit: string | null; - strokeOpacity: string | null; - strokeWidth: string | null; - tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; - textAnchor: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; - textKashida: string | null; - textKashidaSpace: string | null; - textOverflow: string | null; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; - top: string | null; - touchAction: string | null; - transform: string | null; - transformOrigin: string | null; - transformStyle: string | null; - transition: string | null; - transitionDelay: string | null; - transitionDuration: string | null; - transitionProperty: string | null; - transitionTimingFunction: string | null; - unicodeBidi: string | null; - verticalAlign: string | null; - visibility: string | null; - webkitAlignContent: string | null; - webkitAlignItems: string | null; - webkitAlignSelf: string | null; - webkitAnimation: string | null; - webkitAnimationDelay: string | null; - webkitAnimationDirection: string | null; - webkitAnimationDuration: string | null; - webkitAnimationFillMode: string | null; - webkitAnimationIterationCount: string | null; - webkitAnimationName: string | null; - webkitAnimationPlayState: string | null; - webkitAnimationTimingFunction: string | null; - webkitAppearance: string | null; - webkitBackfaceVisibility: string | null; - webkitBackgroundClip: string | null; - webkitBackgroundOrigin: string | null; - webkitBackgroundSize: string | null; - webkitBorderBottomLeftRadius: string | null; - webkitBorderBottomRightRadius: string | null; - webkitBorderImage: string | null; - webkitBorderRadius: string | null; - webkitBorderTopLeftRadius: string | null; - webkitBorderTopRightRadius: string | null; - webkitBoxAlign: string | null; - webkitBoxDirection: string | null; - webkitBoxFlex: string | null; - webkitBoxOrdinalGroup: string | null; - webkitBoxOrient: string | null; - webkitBoxPack: string | null; - webkitBoxSizing: string | null; - webkitColumnBreakAfter: string | null; - webkitColumnBreakBefore: string | null; - webkitColumnBreakInside: string | null; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string | null; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string | null; - webkitColumnRuleWidth: any; - webkitColumnSpan: string | null; - webkitColumnWidth: any; - webkitColumns: string | null; - webkitFilter: string | null; - webkitFlex: string | null; - webkitFlexBasis: string | null; - webkitFlexDirection: string | null; - webkitFlexFlow: string | null; - webkitFlexGrow: string | null; - webkitFlexShrink: string | null; - webkitFlexWrap: string | null; - webkitJustifyContent: string | null; - webkitOrder: string | null; - webkitPerspective: string | null; - webkitPerspectiveOrigin: string | null; - webkitTapHighlightColor: string | null; - webkitTextFillColor: string | null; - webkitTextSizeAdjust: any; - webkitTransform: string | null; - webkitTransformOrigin: string | null; - webkitTransformStyle: string | null; - webkitTransition: string | null; - webkitTransitionDelay: string | null; - webkitTransitionDuration: string | null; - webkitTransitionProperty: string | null; - webkitTransitionTimingFunction: string | null; - webkitUserModify: string | null; - webkitUserSelect: string | null; - webkitWritingMode: string | null; - whiteSpace: string | null; - widows: string | null; - width: string | null; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; - zIndex: string | null; - zoom: string | null; - resize: string | null; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string | null, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readonly readOnly: boolean; - selectorText: string; - readonly style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - readonly cssRules: CSSRuleList; - cssText: string; - readonly href: string; - readonly id: string; - readonly imports: StyleSheetList; - readonly isAlternate: boolean; - readonly isPrefAlternate: boolean; - readonly ownerRule: CSSRule; - readonly owningElement: Element; - readonly pages: StyleSheetPageList; - readonly readOnly: boolean; - readonly rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { - setTransform(matrix: SVGMatrix): void; -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D extends Object, CanvasPathMethods { - readonly canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - mozImageSmoothingEnabled: boolean; - webkitImageSmoothingEnabled: boolean; - oImageSmoothingEnabled: boolean; - beginPath(): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - measureText(text: string): TextMetrics; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - readonly length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - readonly height: number; - left: number; - right: number; - top: number; - readonly width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - readonly length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - readonly clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - readonly commandName: string; - readonly detail: string | null; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer | null; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - readonly subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - readonly detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string | null, version: string | null): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - readonly length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; - addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - readonly files: FileList; - readonly items: DataTransferItemList; - readonly types: string[]; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - readonly kind: string; - readonly type: string; - getAsFile(): File | null; - getAsString(_callback: FunctionStringCallback | null): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - readonly length: number; - add(data: File): DataTransferItem | null; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - readonly id: number; - readonly type: string; - readonly uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - readonly delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - readonly x: number | null; - readonly y: number | null; - readonly z: number | null; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceLightEvent extends Event { - readonly value: number; -} - -declare var DeviceLightEvent: { - prototype: DeviceLightEvent; - new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; -} - -interface DeviceMotionEvent extends Event { - readonly acceleration: DeviceAcceleration | null; - readonly accelerationIncludingGravity: DeviceAcceleration | null; - readonly interval: number | null; - readonly rotationRate: DeviceRotationRate | null; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - readonly absolute: boolean; - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - readonly alpha: number | null; - readonly beta: number | null; - readonly gamma: number | null; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface DocumentEventMap extends GlobalEventHandlersEventMap { - "abort": UIEvent; - "activate": UIEvent; - "beforeactivate": UIEvent; - "beforedeactivate": UIEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "contextmenu": PointerEvent; - "dblclick": MouseEvent; - "deactivate": UIEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "fullscreenchange": Event; - "fullscreenerror": Event; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "mousedown": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSContentZoom": UIEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSInertiaStart": MSGestureEvent; - "MSManipulationStateChanged": MSManipulationEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "mssitemodejumplistitemremoved": MSSiteModeEvent; - "msthumbnailclick": MSSiteModeEvent; - "pause": Event; - "play": Event; - "playing": Event; - "pointerlockchange": Event; - "pointerlockerror": Event; - "progress": ProgressEvent; - "ratechange": Event; - "readystatechange": ProgressEvent; - "reset": Event; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "selectionchange": Event; - "selectstart": Event; - "stalled": Event; - "stop": Event; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "touchcancel": TouchEvent; - "touchend": TouchEvent; - "touchmove": TouchEvent; - "touchstart": TouchEvent; - "volumechange": Event; - "waiting": Event; - "webkitfullscreenchange": Event; - "webkitfullscreenerror": Event; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot { - /** - * Sets or gets the URL for the current document. - */ - readonly URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - readonly URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - readonly activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - readonly compatMode: string; - cookie: string; - readonly currentScript: HTMLScriptElement | SVGScriptElement; - /** - * Gets the default character set from the current regional language settings. - */ - readonly defaultCharset: string; - readonly defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - readonly doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollectionOf; - readonly fullscreenElement: Element | null; - readonly fullscreenEnabled: boolean; - readonly head: HTMLHeadElement; - readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. - */ - readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - readonly inputEncoding: string | null; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - readonly lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollectionOf; - /** - * Contains information about the current URL. - */ - readonly location: Location; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (this: Document, ev: UIEvent) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (this: Document, ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (this: Document, ev: Event) => any; - oncanplaythrough: (this: Document, ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (this: Document, ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (this: Document, ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (this: Document, ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (this: Document, ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (this: Document, ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (this: Document, ev: DragEvent) => any; - ondrop: (this: Document, ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (this: Document, ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (this: Document, ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (this: Document, ev: MediaStreamErrorEvent) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (this: Document, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (this: Document, ev: FocusEvent) => any; - onfullscreenchange: (this: Document, ev: Event) => any; - onfullscreenerror: (this: Document, ev: Event) => any; - oninput: (this: Document, ev: Event) => any; - oninvalid: (this: Document, ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (this: Document, ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (this: Document, ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (this: Document, ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (this: Document, ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (this: Document, ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (this: Document, ev: WheelEvent) => any; - onmscontentzoom: (this: Document, ev: UIEvent) => any; - onmsgesturechange: (this: Document, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any; - onmsgestureend: (this: Document, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Document, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Document, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Document, ev: MSGestureEvent) => any; - onmsinertiastart: (this: Document, ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any; - onmspointercancel: (this: Document, ev: MSPointerEvent) => any; - onmspointerdown: (this: Document, ev: MSPointerEvent) => any; - onmspointerenter: (this: Document, ev: MSPointerEvent) => any; - onmspointerleave: (this: Document, ev: MSPointerEvent) => any; - onmspointermove: (this: Document, ev: MSPointerEvent) => any; - onmspointerout: (this: Document, ev: MSPointerEvent) => any; - onmspointerover: (this: Document, ev: MSPointerEvent) => any; - onmspointerup: (this: Document, ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (this: Document, ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (this: Document, ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (this: Document, ev: Event) => any; - onpointerlockchange: (this: Document, ev: Event) => any; - onpointerlockerror: (this: Document, ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (this: Document, ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (this: Document, ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (this: Document, ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (this: Document, ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (this: Document, ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (this: Document, ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (this: Document, ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (this: Document, ev: UIEvent) => any; - /** - * Fires when the selection state of a document changes. - * @param ev The event. - */ - onselectionchange: (this: Document, ev: Event) => any; - onselectstart: (this: Document, ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (this: Document, ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (this: Document, ev: Event) => any; - onsubmit: (this: Document, ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (this: Document, ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (this: Document, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (this: Document, ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (this: Document, ev: Event) => any; - onwebkitfullscreenchange: (this: Document, ev: Event) => any; - onwebkitfullscreenerror: (this: Document, ev: Event) => any; - plugins: HTMLCollectionOf; - readonly pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readonly readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - readonly referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - readonly rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollectionOf; - readonly scrollingElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - readonly styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - readonly visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - readonly webkitCurrentFullScreenElement: Element | null; - readonly webkitFullscreenElement: Element | null; - readonly webkitFullscreenEnabled: boolean; - readonly webkitIsFullScreen: boolean; - readonly xmlEncoding: string | null; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string | null; - adoptNode(source: Node): Node; - captureEvents(): void; - caretRangeFromPoint(x: number, y: number): Range; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: K): HTMLElementTagNameMap[K]; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string | null, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement | null; - getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: K): ElementListTagNameMap[K]; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeListOf; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): void; - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector, ParentNode { -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - readonly entities: NamedNodeMap; - readonly internalSubset: string | null; - readonly name: string; - readonly notations: NamedNodeMap; - readonly publicId: string | null; - readonly systemId: string | null; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - readonly dataTransfer: DataTransfer; - initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - readonly attack: AudioParam; - readonly knee: AudioParam; - readonly ratio: AudioParam; - readonly reduction: AudioParam; - readonly release: AudioParam; - readonly threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_frag_depth { -} - -declare var EXT_frag_depth: { - prototype: EXT_frag_depth; - new(): EXT_frag_depth; -} - -interface EXT_texture_filter_anisotropic { - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - readonly TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface ElementEventMap extends GlobalEventHandlersEventMap { - "ariarequest": AriaRequestEvent; - "command": CommandEvent; - "gotpointercapture": PointerEvent; - "lostpointercapture": PointerEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSGotPointerCapture": MSPointerEvent; - "MSInertiaStart": MSGestureEvent; - "MSLostPointerCapture": MSPointerEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "touchcancel": TouchEvent; - "touchend": TouchEvent; - "touchmove": TouchEvent; - "touchstart": TouchEvent; - "webkitfullscreenchange": Event; - "webkitfullscreenerror": Event; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode { - readonly classList: DOMTokenList; - className: string; - readonly clientHeight: number; - readonly clientLeft: number; - readonly clientTop: number; - readonly clientWidth: number; - id: string; - msContentZoomFactor: number; - readonly msRegionOverflow: string; - onariarequest: (this: Element, ev: AriaRequestEvent) => any; - oncommand: (this: Element, ev: CommandEvent) => any; - ongotpointercapture: (this: Element, ev: PointerEvent) => any; - onlostpointercapture: (this: Element, ev: PointerEvent) => any; - onmsgesturechange: (this: Element, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any; - onmsgestureend: (this: Element, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Element, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Element, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Element, ev: MSGestureEvent) => any; - onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any; - onmsinertiastart: (this: Element, ev: MSGestureEvent) => any; - onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any; - onmspointercancel: (this: Element, ev: MSPointerEvent) => any; - onmspointerdown: (this: Element, ev: MSPointerEvent) => any; - onmspointerenter: (this: Element, ev: MSPointerEvent) => any; - onmspointerleave: (this: Element, ev: MSPointerEvent) => any; - onmspointermove: (this: Element, ev: MSPointerEvent) => any; - onmspointerout: (this: Element, ev: MSPointerEvent) => any; - onmspointerover: (this: Element, ev: MSPointerEvent) => any; - onmspointerup: (this: Element, ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (this: Element, ev: Event) => any; - onwebkitfullscreenerror: (this: Element, ev: Event) => any; - readonly prefix: string | null; - readonly scrollHeight: number; - scrollLeft: number; - scrollTop: number; - readonly scrollWidth: number; - readonly tagName: string; - innerHTML: string; - readonly assignedSlot: HTMLSlotElement | null; - slot: string; - readonly shadowRoot: ShadowRoot | null; - getAttribute(name: string): string | null; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: K): ElementListTagNameMap[K]; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - matches(selector: string): boolean; - closest(selector: string): Element | null; - scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; - scroll(options?: ScrollToOptions): void; - scroll(x: number, y: number): void; - scrollTo(options?: ScrollToOptions): void; - scrollTo(x: number, y: number): void; - scrollBy(options?: ScrollToOptions): void; - scrollBy(x: number, y: number): void; - insertAdjacentElement(position: string, insertedElement: Element): Element | null; - insertAdjacentHTML(where: string, html: string): void; - insertAdjacentText(where: string, text: string): void; - attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot; - addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: Element | null; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - readonly scoped: boolean; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - deepPath(): EventTarget[]; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - readonly gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - readonly axes: number[]; - readonly buttons: GamepadButton[]; - readonly connected: boolean; - readonly id: string; - readonly index: number; - readonly mapping: string; - readonly timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - readonly pressed: boolean; - readonly value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - readonly gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - readonly mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - readonly nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - readonly protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string | null; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - download: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { - addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBodyElementEventMap extends HTMLElementEventMap { - "afterprint": Event; - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "load": Event; - "message": MessageEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "popstate": PopStateEvent; - "resize": UIEvent; - "storage": StorageEvent; - "unload": Event; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (this: HTMLBodyElement, ev: Event) => any; - onbeforeprint: (this: HTMLBodyElement, ev: Event) => any; - onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any; - onblur: (this: HTMLBodyElement, ev: FocusEvent) => any; - onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any; - onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any; - onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any; - onload: (this: HTMLBodyElement, ev: Event) => any; - onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any; - onoffline: (this: HTMLBodyElement, ev: Event) => any; - ononline: (this: HTMLBodyElement, ev: Event) => any; - onorientationchange: (this: HTMLBodyElement, ev: Event) => any; - onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; - onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any; - onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any; - onresize: (this: HTMLBodyElement, ev: UIEvent) => any; - onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any; - onunload: (this: HTMLBodyElement, ev: Event) => any; - text: any; - vLink: any; - addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. - * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); - */ - getContext(contextId: "2d", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null; - getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; - getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. - */ - toDataURL(type?: string, ...args: any[]): string; - toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Retrieves an object from various collections. - */ - item(index: number): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollectionOf; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElementEventMap extends ElementEventMap { - "abort": UIEvent; - "activate": UIEvent; - "beforeactivate": UIEvent; - "beforecopy": ClipboardEvent; - "beforecut": ClipboardEvent; - "beforedeactivate": UIEvent; - "beforepaste": ClipboardEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "contextmenu": PointerEvent; - "copy": ClipboardEvent; - "cuechange": Event; - "cut": ClipboardEvent; - "dblclick": MouseEvent; - "deactivate": UIEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "mousedown": MouseEvent; - "mouseenter": MouseEvent; - "mouseleave": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSContentZoom": UIEvent; - "MSManipulationStateChanged": MSManipulationEvent; - "paste": ClipboardEvent; - "pause": Event; - "play": Event; - "playing": Event; - "progress": ProgressEvent; - "ratechange": Event; - "reset": Event; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "selectstart": Event; - "stalled": Event; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "volumechange": Event; - "waiting": Event; -} - -interface HTMLElement extends Element { - accessKey: string; - readonly children: HTMLCollection; - contentEditable: string; - readonly dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - readonly isContentEditable: boolean; - lang: string; - readonly offsetHeight: number; - readonly offsetLeft: number; - readonly offsetParent: Element; - readonly offsetTop: number; - readonly offsetWidth: number; - onabort: (this: HTMLElement, ev: UIEvent) => any; - onactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any; - onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any; - onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any; - onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any; - onblur: (this: HTMLElement, ev: FocusEvent) => any; - oncanplay: (this: HTMLElement, ev: Event) => any; - oncanplaythrough: (this: HTMLElement, ev: Event) => any; - onchange: (this: HTMLElement, ev: Event) => any; - onclick: (this: HTMLElement, ev: MouseEvent) => any; - oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any; - oncopy: (this: HTMLElement, ev: ClipboardEvent) => any; - oncuechange: (this: HTMLElement, ev: Event) => any; - oncut: (this: HTMLElement, ev: ClipboardEvent) => any; - ondblclick: (this: HTMLElement, ev: MouseEvent) => any; - ondeactivate: (this: HTMLElement, ev: UIEvent) => any; - ondrag: (this: HTMLElement, ev: DragEvent) => any; - ondragend: (this: HTMLElement, ev: DragEvent) => any; - ondragenter: (this: HTMLElement, ev: DragEvent) => any; - ondragleave: (this: HTMLElement, ev: DragEvent) => any; - ondragover: (this: HTMLElement, ev: DragEvent) => any; - ondragstart: (this: HTMLElement, ev: DragEvent) => any; - ondrop: (this: HTMLElement, ev: DragEvent) => any; - ondurationchange: (this: HTMLElement, ev: Event) => any; - onemptied: (this: HTMLElement, ev: Event) => any; - onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any; - onerror: (this: HTMLElement, ev: ErrorEvent) => any; - onfocus: (this: HTMLElement, ev: FocusEvent) => any; - oninput: (this: HTMLElement, ev: Event) => any; - oninvalid: (this: HTMLElement, ev: Event) => any; - onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any; - onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any; - onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any; - onload: (this: HTMLElement, ev: Event) => any; - onloadeddata: (this: HTMLElement, ev: Event) => any; - onloadedmetadata: (this: HTMLElement, ev: Event) => any; - onloadstart: (this: HTMLElement, ev: Event) => any; - onmousedown: (this: HTMLElement, ev: MouseEvent) => any; - onmouseenter: (this: HTMLElement, ev: MouseEvent) => any; - onmouseleave: (this: HTMLElement, ev: MouseEvent) => any; - onmousemove: (this: HTMLElement, ev: MouseEvent) => any; - onmouseout: (this: HTMLElement, ev: MouseEvent) => any; - onmouseover: (this: HTMLElement, ev: MouseEvent) => any; - onmouseup: (this: HTMLElement, ev: MouseEvent) => any; - onmousewheel: (this: HTMLElement, ev: WheelEvent) => any; - onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any; - onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any; - onpaste: (this: HTMLElement, ev: ClipboardEvent) => any; - onpause: (this: HTMLElement, ev: Event) => any; - onplay: (this: HTMLElement, ev: Event) => any; - onplaying: (this: HTMLElement, ev: Event) => any; - onprogress: (this: HTMLElement, ev: ProgressEvent) => any; - onratechange: (this: HTMLElement, ev: Event) => any; - onreset: (this: HTMLElement, ev: Event) => any; - onscroll: (this: HTMLElement, ev: UIEvent) => any; - onseeked: (this: HTMLElement, ev: Event) => any; - onseeking: (this: HTMLElement, ev: Event) => any; - onselect: (this: HTMLElement, ev: UIEvent) => any; - onselectstart: (this: HTMLElement, ev: Event) => any; - onstalled: (this: HTMLElement, ev: Event) => any; - onsubmit: (this: HTMLElement, ev: Event) => any; - onsuspend: (this: HTMLElement, ev: Event) => any; - ontimeupdate: (this: HTMLElement, ev: Event) => any; - onvolumechange: (this: HTMLElement, ev: Event) => any; - onwaiting: (this: HTMLElement, ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - readonly style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - msGetInputContext(): MSInputMethodContext; - setActive(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - readonly palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - readonly pluginspage: string; - readonly readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - readonly elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - readonly length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElementEventMap extends HTMLElementEventMap { - "load": Event; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: HTMLFrameElement, ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElementEventMap extends HTMLElementEventMap { - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "error": ErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "load": Event; - "message": MessageEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "resize": UIEvent; - "storage": StorageEvent; - "unload": Event; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (this: HTMLFrameSetElement, ev: Event) => any; - onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any; - onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any; - onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any; - onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any; - onload: (this: HTMLFrameSetElement, ev: Event) => any; - onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any; - onoffline: (this: HTMLFrameSetElement, ev: Event) => any; - ononline: (this: HTMLFrameSetElement, ev: Event) => any; - onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any; - onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; - onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any; - onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any; - onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any; - onunload: (this: HTMLFrameSetElement, ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElementEventMap extends HTMLElementEventMap { - "load": Event; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - readonly contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (this: HTMLIFrameElement, ev: Event) => any; - readonly sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - crossOrigin: string; - readonly currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - lowsrc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - readonly naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - readonly naturalWidth: number; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - readonly x: number; - readonly y: number; - msGetAsCastingSource(): any; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - readonly complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - readonly files: FileList | null; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - readonly list: HTMLElement; - /** - * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - selectionDirection: string; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - webkitdirectory: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start?: number, end?: number, direction?: string): void; - /** - * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - import?: Document; - integrity: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - readonly areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { - "bounce": Event; - "finish": Event; - "start": Event; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (this: HTMLMarqueeElement, ev: Event) => any; - onfinish: (this: HTMLMarqueeElement, ev: Event) => any; - onstart: (this: HTMLMarqueeElement, ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): void; - addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElementEventMap extends HTMLElementEventMap { - "encrypted": MediaEncryptedEvent; - "msneedkey": MSMediaKeyNeededEvent; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - readonly audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - readonly buffered: TimeRanges; - /** - * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player). - */ - controls: boolean; - crossOrigin: string; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - readonly currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming. - */ - readonly duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - readonly ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - readonly error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - readonly mediaKeys: MediaKeys | null; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - readonly msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - readonly msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - readonly networkState: number; - onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any; - onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - readonly paused: boolean; - /** - * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - readonly played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - readonly seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - readonly seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcObject: MediaStream | null; - readonly textTracks: TextTrackList; - readonly videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Resets the audio or video object and loads a new media resource. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; - addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - readonly HAVE_CURRENT_DATA: number; - readonly HAVE_ENOUGH_DATA: number; - readonly HAVE_FUTURE_DATA: number; - readonly HAVE_METADATA: number; - readonly HAVE_NOTHING: number; - readonly NETWORK_EMPTY: number; - readonly NETWORK_IDLE: number; - readonly NETWORK_LOADING: number; - readonly NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLMeterElement extends HTMLElement { - high: number; - low: number; - max: number; - min: number; - optimum: number; - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMeterElement: { - prototype: HTMLMeterElement; - new(): HTMLMeterElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element. - */ - readonly BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - readonly contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - readonly msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - readonly object: any; - readonly readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - readonly text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - readonly index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLOptionsCollection extends HTMLCollectionOf { - length: number; - selectedIndex: number; - add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; - remove(index: number): void; -} - -declare var HTMLOptionsCollection: { - prototype: HTMLOptionsCollection; - new(): HTMLOptionsCollection; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPictureElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar). - */ - readonly position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; - integrity: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - readonly options: HTMLOptionsCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - selectedOptions: HTMLCollectionOf; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - sizes: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - disabled: boolean; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - readonly cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollectionOf; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollectionOf; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - readonly rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - readonly sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableDataCellElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollectionOf; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTemplateElement extends HTMLElement { - readonly content: DocumentFragment; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - readonly form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - readonly type: string; - /** - * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. - */ - readonly validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - readonly validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - readonly willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - minLength: number; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readonly readyState: number; - src: string; - srclang: string; - readonly track: TextTrack; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - readonly ERROR: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap { - "MSVideoFormatChanged": Event; - "MSVideoFrameStepCompleted": Event; - "MSVideoOptimalLayoutChanged": Event; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - readonly msIsLayoutOptimalForPlayback: boolean; - readonly msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any; - onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any; - onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - readonly videoWidth: number; - readonly webkitDisplayingFullscreen: boolean; - readonly webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): void; - addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - readonly newURL: string | null; - readonly oldURL: string | null; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - readonly length: number; - readonly state: any; - scrollRestoration: ScrollRestoration; - back(): void; - forward(): void; - go(delta?: number): void; - pushState(data: any, title: string, url?: string | null): void; - replaceState(data: any, title: string, url?: string | null): void; -} - -declare var History: { - prototype: History; - new(): History; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabaseEventMap { - "abort": Event; - "error": ErrorEvent; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: IDBDatabase, ev: Event) => any; - onerror: (this: IDBDatabase, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; - "upgradeneeded": IDBVersionChangeEvent; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: IDBOpenDBRequest, ev: Event) => any; - onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; - addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequestEventMap { - "error": ErrorEvent; - "success": Event; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: IDBRequest, ev: ErrorEvent) => any; - onsuccess: (this: IDBRequest, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransactionEventMap { - "abort": Event; - "complete": Event; - "error": ErrorEvent; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: IDBTransaction, ev: Event) => any; - oncomplete: (this: IDBTransaction, ev: Event) => any; - onerror: (this: IDBTransaction, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - readonly altKey: boolean; - readonly char: string | null; - readonly charCode: number; - readonly ctrlKey: boolean; - readonly key: string; - readonly keyCode: number; - readonly locale: string; - readonly location: number; - readonly metaKey: boolean; - readonly repeat: boolean; - readonly shiftKey: boolean; - readonly which: number; - readonly code: string; - getModifierState(keyArg: string): boolean; - initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - readonly DOM_KEY_LOCATION_JOYSTICK: number; - readonly DOM_KEY_LOCATION_LEFT: number; - readonly DOM_KEY_LOCATION_MOBILE: number; - readonly DOM_KEY_LOCATION_NUMPAD: number; - readonly DOM_KEY_LOCATION_RIGHT: number; - readonly DOM_KEY_LOCATION_STANDARD: number; -} - -interface ListeningStateChangedEvent extends Event { - readonly label: string; - readonly state: string; -} - -declare var ListeningStateChangedEvent: { - prototype: ListeningStateChangedEvent; - new(): ListeningStateChangedEvent; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - readonly executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperationEventMap { - "complete": Event; - "error": ErrorEvent; -} - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; - onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSAssertion { - readonly id: string; - readonly type: string; -} - -declare var MSAssertion: { - prototype: MSAssertion; - new(): MSAssertion; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCredentials { - getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; - makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; -} - -declare var MSCredentials: { - prototype: MSCredentials; - new(): MSCredentials; -} - -interface MSFIDOCredentialAssertion extends MSAssertion { - readonly algorithm: string | Algorithm; - readonly attestation: any; - readonly publicKey: string; - readonly transportHints: string[]; -} - -declare var MSFIDOCredentialAssertion: { - prototype: MSFIDOCredentialAssertion; - new(): MSFIDOCredentialAssertion; -} - -interface MSFIDOSignature { - readonly authnrData: string; - readonly clientData: string; - readonly signature: string; -} - -declare var MSFIDOSignature: { - prototype: MSFIDOSignature; - new(): MSFIDOSignature; -} - -interface MSFIDOSignatureAssertion extends MSAssertion { - readonly signature: MSFIDOSignature; -} - -declare var MSFIDOSignatureAssertion: { - prototype: MSFIDOSignatureAssertion; - new(): MSFIDOSignatureAssertion; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - readonly clientX: number; - readonly clientY: number; - readonly expansion: number; - readonly gestureObject: any; - readonly hwTimestamp: number; - readonly offsetX: number; - readonly offsetY: number; - readonly rotation: number; - readonly scale: number; - readonly screenX: number; - readonly screenY: number; - readonly translationX: number; - readonly translationY: number; - readonly velocityAngular: number; - readonly velocityExpansion: number; - readonly velocityX: number; - readonly velocityY: number; - initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - readonly MSGESTURE_FLAG_BEGIN: number; - readonly MSGESTURE_FLAG_CANCEL: number; - readonly MSGESTURE_FLAG_END: number; - readonly MSGESTURE_FLAG_INERTIA: number; - readonly MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - readonly constrictionActive: boolean; - readonly status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - readonly canGoBack: boolean; - readonly canGoForward: boolean; - readonly containsFullScreenElement: boolean; - readonly documentTitle: string; - height: number; - readonly settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContextEventMap { - "MSCandidateWindowHide": Event; - "MSCandidateWindowShow": Event; - "MSCandidateWindowUpdate": Event; -} - -interface MSInputMethodContext extends EventTarget { - readonly compositionEndOffset: number; - readonly compositionStartOffset: number; - oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any; - oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any; - oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any; - readonly target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - readonly currentState: number; - readonly inertiaDestinationX: number; - readonly inertiaDestinationY: number; - readonly lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - readonly MS_MANIPULATION_STATE_ACTIVE: number; - readonly MS_MANIPULATION_STATE_CANCELLED: number; - readonly MS_MANIPULATION_STATE_COMMITTED: number; - readonly MS_MANIPULATION_STATE_DRAGGING: number; - readonly MS_MANIPULATION_STATE_INERTIA: number; - readonly MS_MANIPULATION_STATE_PRESELECT: number; - readonly MS_MANIPULATION_STATE_SELECTING: number; - readonly MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - readonly code: number; - readonly systemCode: number; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - readonly MS_MEDIA_KEYERR_CLIENT: number; - readonly MS_MEDIA_KEYERR_DOMAIN: number; - readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; - readonly MS_MEDIA_KEYERR_OUTPUT: number; - readonly MS_MEDIA_KEYERR_SERVICE: number; - readonly MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - readonly destinationURL: string | null; - readonly message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - readonly initData: Uint8Array | null; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - readonly error: MSMediaKeyError | null; - readonly keySystem: string; - readonly sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - readonly keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; - isTypeSupportedWithFeatures(keySystem: string, type?: string): string; -} - -interface MSPointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - readonly length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - readonly actionURL: string; - readonly buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperationEventMap { - "complete": Event; - "error": ErrorEvent; -} - -interface MSWebViewAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any; - onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - readonly target: MSHTMLWebViewElement; - readonly type: number; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; - addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - readonly TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaDeviceInfo { - readonly deviceId: string; - readonly groupId: string; - readonly kind: string; - readonly label: string; -} - -declare var MediaDeviceInfo: { - prototype: MediaDeviceInfo; - new(): MediaDeviceInfo; -} - -interface MediaDevicesEventMap { - "devicechange": Event; -} - -interface MediaDevices extends EventTarget { - ondevicechange: (this: MediaDevices, ev: Event) => any; - enumerateDevices(): any; - getSupportedConstraints(): MediaTrackSupportedConstraints; - getUserMedia(constraints: MediaStreamConstraints): PromiseLike; - addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaDevices: { - prototype: MediaDevices; - new(): MediaDevices; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaEncryptedEvent extends Event { - readonly initData: ArrayBuffer | null; - readonly initDataType: string; -} - -declare var MediaEncryptedEvent: { - prototype: MediaEncryptedEvent; - new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; -} - -interface MediaError { - readonly code: number; - readonly msExtendedCode: number; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - readonly MEDIA_ERR_ABORTED: number; - readonly MEDIA_ERR_DECODE: number; - readonly MEDIA_ERR_NETWORK: number; - readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; - readonly MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaKeyMessageEvent extends Event { - readonly message: ArrayBuffer; - readonly messageType: string; -} - -declare var MediaKeyMessageEvent: { - prototype: MediaKeyMessageEvent; - new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; -} - -interface MediaKeySession extends EventTarget { - readonly closed: PromiseLike; - readonly expiration: number; - readonly keyStatuses: MediaKeyStatusMap; - readonly sessionId: string; - close(): PromiseLike; - generateRequest(initDataType: string, initData: any): PromiseLike; - load(sessionId: string): PromiseLike; - remove(): PromiseLike; - update(response: any): PromiseLike; -} - -declare var MediaKeySession: { - prototype: MediaKeySession; - new(): MediaKeySession; -} - -interface MediaKeyStatusMap { - readonly size: number; - forEach(callback: ForEachCallback): void; - get(keyId: any): string; - has(keyId: any): boolean; -} - -declare var MediaKeyStatusMap: { - prototype: MediaKeyStatusMap; - new(): MediaKeyStatusMap; -} - -interface MediaKeySystemAccess { - readonly keySystem: string; - createMediaKeys(): PromiseLike; - getConfiguration(): MediaKeySystemConfiguration; -} - -declare var MediaKeySystemAccess: { - prototype: MediaKeySystemAccess; - new(): MediaKeySystemAccess; -} - -interface MediaKeys { - createSession(sessionType?: string): MediaKeySession; - setServerCertificate(serverCertificate: any): PromiseLike; -} - -declare var MediaKeys: { - prototype: MediaKeys; - new(): MediaKeys; -} - -interface MediaList { - readonly length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - readonly activeSourceBuffers: SourceBufferList; - duration: number; - readonly readyState: string; - readonly sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MediaStreamEventMap { - "active": Event; - "addtrack": TrackEvent; - "inactive": Event; - "removetrack": TrackEvent; -} - -interface MediaStream extends EventTarget { - readonly active: boolean; - readonly id: string; - onactive: (this: MediaStream, ev: Event) => any; - onaddtrack: (this: MediaStream, ev: TrackEvent) => any; - oninactive: (this: MediaStream, ev: Event) => any; - onremovetrack: (this: MediaStream, ev: TrackEvent) => any; - addTrack(track: MediaStreamTrack): void; - clone(): MediaStream; - getAudioTracks(): MediaStreamTrack[]; - getTrackById(trackId: string): MediaStreamTrack | null; - getTracks(): MediaStreamTrack[]; - getVideoTracks(): MediaStreamTrack[]; - removeTrack(track: MediaStreamTrack): void; - stop(): void; - addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStream: { - prototype: MediaStream; - new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; -} - -interface MediaStreamAudioSourceNode extends AudioNode { -} - -declare var MediaStreamAudioSourceNode: { - prototype: MediaStreamAudioSourceNode; - new(): MediaStreamAudioSourceNode; -} - -interface MediaStreamError { - readonly constraintName: string | null; - readonly message: string | null; - readonly name: string; -} - -declare var MediaStreamError: { - prototype: MediaStreamError; - new(): MediaStreamError; -} - -interface MediaStreamErrorEvent extends Event { - readonly error: MediaStreamError | null; -} - -declare var MediaStreamErrorEvent: { - prototype: MediaStreamErrorEvent; - new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; -} - -interface MediaStreamTrackEventMap { - "ended": MediaStreamErrorEvent; - "mute": Event; - "overconstrained": MediaStreamErrorEvent; - "unmute": Event; -} - -interface MediaStreamTrack extends EventTarget { - enabled: boolean; - readonly id: string; - readonly kind: string; - readonly label: string; - readonly muted: boolean; - onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; - onmute: (this: MediaStreamTrack, ev: Event) => any; - onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any; - onunmute: (this: MediaStreamTrack, ev: Event) => any; - readonly readonly: boolean; - readonly readyState: string; - readonly remote: boolean; - applyConstraints(constraints: MediaTrackConstraints): PromiseLike; - clone(): MediaStreamTrack; - getCapabilities(): MediaTrackCapabilities; - getConstraints(): MediaTrackConstraints; - getSettings(): MediaTrackSettings; - stop(): void; - addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MediaStreamTrack: { - prototype: MediaStreamTrack; - new(): MediaStreamTrack; -} - -interface MediaStreamTrackEvent extends Event { - readonly track: MediaStreamTrack; -} - -declare var MediaStreamTrackEvent: { - prototype: MediaStreamTrackEvent; - new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePortEventMap { - "message": MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: MessagePort, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - readonly description: string; - readonly enabledPlugin: Plugin; - readonly suffixes: string; - readonly type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - readonly length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - readonly altKey: boolean; - readonly button: number; - readonly buttons: number; - readonly clientX: number; - readonly clientY: number; - readonly ctrlKey: boolean; - readonly fromElement: Element; - readonly layerX: number; - readonly layerY: number; - readonly metaKey: boolean; - readonly movementX: number; - readonly movementY: number; - readonly offsetX: number; - readonly offsetY: number; - readonly pageX: number; - readonly pageY: number; - readonly relatedTarget: EventTarget; - readonly screenX: number; - readonly screenY: number; - readonly shiftKey: boolean; - readonly toElement: Element; - readonly which: number; - readonly x: number; - readonly y: number; - getModifierState(keyArg: string): boolean; - initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MutationEvent extends Event { - readonly attrChange: number; - readonly attrName: string; - readonly newValue: string; - readonly prevValue: string; - readonly relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - readonly ADDITION: number; - readonly MODIFICATION: number; - readonly REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - readonly addedNodes: NodeList; - readonly attributeName: string | null; - readonly attributeNamespace: string | null; - readonly nextSibling: Node | null; - readonly oldValue: string | null; - readonly previousSibling: Node | null; - readonly removedNodes: NodeList; - readonly target: Node; - readonly type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - readonly length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - readonly isSuccess: boolean; - readonly webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - readonly uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - readonly referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { - readonly appCodeName: string; - readonly cookieEnabled: boolean; - readonly language: string; - readonly maxTouchPoints: number; - readonly mimeTypes: MimeTypeArray; - readonly msManipulationViewsEnabled: boolean; - readonly msMaxTouchPoints: number; - readonly msPointerEnabled: boolean; - readonly plugins: PluginArray; - readonly pointerEnabled: boolean; - readonly webdriver: boolean; - readonly hardwareConcurrency: number; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; - vibrate(pattern: number | number[]): boolean; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - readonly attributes: NamedNodeMap; - readonly baseURI: string | null; - readonly childNodes: NodeList; - readonly firstChild: Node | null; - readonly lastChild: Node | null; - readonly localName: string | null; - readonly namespaceURI: string | null; - readonly nextSibling: Node | null; - readonly nodeName: string; - readonly nodeType: number; - nodeValue: string | null; - readonly ownerDocument: Document; - readonly parentElement: HTMLElement | null; - readonly parentNode: Node | null; - readonly previousSibling: Node | null; - textContent: string | null; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - contains(child: Node): boolean; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; - isDefaultNamespace(namespaceURI: string | null): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string | null): string | null; - lookupPrefix(namespaceURI: string | null): string | null; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - readonly ATTRIBUTE_NODE: number; - readonly CDATA_SECTION_NODE: number; - readonly COMMENT_NODE: number; - readonly DOCUMENT_FRAGMENT_NODE: number; - readonly DOCUMENT_NODE: number; - readonly DOCUMENT_POSITION_CONTAINED_BY: number; - readonly DOCUMENT_POSITION_CONTAINS: number; - readonly DOCUMENT_POSITION_DISCONNECTED: number; - readonly DOCUMENT_POSITION_FOLLOWING: number; - readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - readonly DOCUMENT_POSITION_PRECEDING: number; - readonly DOCUMENT_TYPE_NODE: number; - readonly ELEMENT_NODE: number; - readonly ENTITY_NODE: number; - readonly ENTITY_REFERENCE_NODE: number; - readonly NOTATION_NODE: number; - readonly PROCESSING_INSTRUCTION_NODE: number; - readonly TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - readonly FILTER_ACCEPT: number; - readonly FILTER_REJECT: number; - readonly FILTER_SKIP: number; - readonly SHOW_ALL: number; - readonly SHOW_ATTRIBUTE: number; - readonly SHOW_CDATA_SECTION: number; - readonly SHOW_COMMENT: number; - readonly SHOW_DOCUMENT: number; - readonly SHOW_DOCUMENT_FRAGMENT: number; - readonly SHOW_DOCUMENT_TYPE: number; - readonly SHOW_ELEMENT: number; - readonly SHOW_ENTITY: number; - readonly SHOW_ENTITY_REFERENCE: number; - readonly SHOW_NOTATION: number; - readonly SHOW_PROCESSING_INSTRUCTION: number; - readonly SHOW_TEXT: number; -} - -interface NodeIterator { - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - readonly length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - readonly renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContextEventMap { - "complete": Event; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (this: OfflineAudioContext, ev: Event) => any; - startRendering(): PromiseLike; - addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNodeEventMap { - "ended": MediaStreamErrorEvent; -} - -interface OscillatorNode extends AudioNode { - readonly detune: AudioParam; - readonly frequency: AudioParam; - onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface OverflowEvent extends UIEvent { - readonly horizontalOverflow: boolean; - readonly orient: number; - readonly verticalOverflow: boolean; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -declare var OverflowEvent: { - prototype: OverflowEvent; - new(): OverflowEvent; - readonly BOTH: number; - readonly HORIZONTAL: number; - readonly VERTICAL: number; -} - -interface PageTransitionEvent extends Event { - readonly persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - readonly activeNetworkRequestCount: number; - readonly averageFrameTime: number; - readonly averagePaintTime: number; - readonly extraInformationEnabled: boolean; - readonly independentRenderingEnabled: boolean; - readonly irDisablingContentString: string; - readonly irStatusAvailable: boolean; - readonly maxCpuSpeed: number; - readonly paintRequestsPerSecond: number; - readonly performanceCounter: number; - readonly performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number | null): any; - getRecentFrames(last: number | null): any; - getRecentMemoryUsage(last: number | null): any; - getRecentPaintRequests(last: number | null): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - readonly navigation: PerformanceNavigation; - readonly timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - readonly duration: number; - readonly entryType: string; - readonly name: string; - readonly startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - readonly redirectCount: number; - readonly type: number; - toJSON(): any; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - readonly TYPE_BACK_FORWARD: number; - readonly TYPE_NAVIGATE: number; - readonly TYPE_RELOAD: number; - readonly TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly navigationStart: number; - readonly redirectCount: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly type: string; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - readonly connectEnd: number; - readonly connectStart: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly initiatorType: string; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - readonly connectEnd: number; - readonly connectStart: number; - readonly domComplete: number; - readonly domContentLoadedEventEnd: number; - readonly domContentLoadedEventStart: number; - readonly domInteractive: number; - readonly domLoading: number; - readonly domainLookupEnd: number; - readonly domainLookupStart: number; - readonly fetchStart: number; - readonly loadEventEnd: number; - readonly loadEventStart: number; - readonly msFirstPaint: number; - readonly navigationStart: number; - readonly redirectEnd: number; - readonly redirectStart: number; - readonly requestStart: number; - readonly responseEnd: number; - readonly responseStart: number; - readonly unloadEventEnd: number; - readonly unloadEventStart: number; - readonly secureConnectionStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - readonly state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - readonly permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - readonly description: string; - readonly filename: string; - readonly length: number; - readonly name: string; - readonly version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - readonly length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - readonly currentPoint: any; - readonly height: number; - readonly hwTimestamp: number; - readonly intermediatePoints: any; - readonly isPrimary: boolean; - readonly pointerId: number; - readonly pointerType: any; - readonly pressure: number; - readonly rotation: number; - readonly tiltX: number; - readonly tiltY: number; - readonly width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - readonly state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - readonly target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface RTCDTMFToneChangeEvent extends Event { - readonly tone: string; -} - -declare var RTCDTMFToneChangeEvent: { - prototype: RTCDTMFToneChangeEvent; - new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; -} - -interface RTCDtlsTransportEventMap { - "dtlsstatechange": RTCDtlsTransportStateChangedEvent; - "error": ErrorEvent; -} - -interface RTCDtlsTransport extends RTCStatsProvider { - ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null; - onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null; - readonly state: string; - readonly transport: RTCIceTransport; - getLocalParameters(): RTCDtlsParameters; - getRemoteCertificates(): ArrayBuffer[]; - getRemoteParameters(): RTCDtlsParameters | null; - start(remoteParameters: RTCDtlsParameters): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtlsTransport: { - prototype: RTCDtlsTransport; - new(transport: RTCIceTransport): RTCDtlsTransport; -} - -interface RTCDtlsTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCDtlsTransportStateChangedEvent: { - prototype: RTCDtlsTransportStateChangedEvent; - new(): RTCDtlsTransportStateChangedEvent; -} - -interface RTCDtmfSenderEventMap { - "tonechange": RTCDTMFToneChangeEvent; -} - -interface RTCDtmfSender extends EventTarget { - readonly canInsertDTMF: boolean; - readonly duration: number; - readonly interToneGap: number; - ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any; - readonly sender: RTCRtpSender; - readonly toneBuffer: string; - insertDTMF(tones: string, duration?: number, interToneGap?: number): void; - addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCDtmfSender: { - prototype: RTCDtmfSender; - new(sender: RTCRtpSender): RTCDtmfSender; -} - -interface RTCIceCandidatePairChangedEvent extends Event { - readonly pair: RTCIceCandidatePair; -} - -declare var RTCIceCandidatePairChangedEvent: { - prototype: RTCIceCandidatePairChangedEvent; - new(): RTCIceCandidatePairChangedEvent; -} - -interface RTCIceGathererEventMap { - "error": ErrorEvent; - "localcandidate": RTCIceGathererEvent; -} - -interface RTCIceGatherer extends RTCStatsProvider { - readonly component: string; - onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null; - onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null; - createAssociatedGatherer(): RTCIceGatherer; - getLocalCandidates(): RTCIceCandidate[]; - getLocalParameters(): RTCIceParameters; - addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceGatherer: { - prototype: RTCIceGatherer; - new(options: RTCIceGatherOptions): RTCIceGatherer; -} - -interface RTCIceGathererEvent extends Event { - readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; -} - -declare var RTCIceGathererEvent: { - prototype: RTCIceGathererEvent; - new(): RTCIceGathererEvent; -} - -interface RTCIceTransportEventMap { - "candidatepairchange": RTCIceCandidatePairChangedEvent; - "icestatechange": RTCIceTransportStateChangedEvent; -} - -interface RTCIceTransport extends RTCStatsProvider { - readonly component: string; - readonly iceGatherer: RTCIceGatherer | null; - oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null; - onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null; - readonly role: string; - readonly state: string; - addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; - createAssociatedTransport(): RTCIceTransport; - getNominatedCandidatePair(): RTCIceCandidatePair | null; - getRemoteCandidates(): RTCIceCandidate[]; - getRemoteParameters(): RTCIceParameters | null; - setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; - start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCIceTransport: { - prototype: RTCIceTransport; - new(): RTCIceTransport; -} - -interface RTCIceTransportStateChangedEvent extends Event { - readonly state: string; -} - -declare var RTCIceTransportStateChangedEvent: { - prototype: RTCIceTransportStateChangedEvent; - new(): RTCIceTransportStateChangedEvent; -} - -interface RTCRtpReceiverEventMap { - "error": ErrorEvent; -} - -interface RTCRtpReceiver extends RTCStatsProvider { - onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack | null; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - getContributingSources(): RTCRtpContributingSource[]; - receive(parameters: RTCRtpParameters): void; - requestSendCSRC(csrc: number): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpReceiver: { - prototype: RTCRtpReceiver; - new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCRtpSenderEventMap { - "error": ErrorEvent; - "ssrcconflict": RTCSsrcConflictEvent; -} - -interface RTCRtpSender extends RTCStatsProvider { - onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null; - onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null; - readonly rtcpTransport: RTCDtlsTransport; - readonly track: MediaStreamTrack; - readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; - send(parameters: RTCRtpParameters): void; - setTrack(track: MediaStreamTrack): void; - setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; - stop(): void; - addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCRtpSender: { - prototype: RTCRtpSender; - new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; - getCapabilities(kind?: string): RTCRtpCapabilities; -} - -interface RTCSrtpSdesTransportEventMap { - "error": ErrorEvent; -} - -interface RTCSrtpSdesTransport extends EventTarget { - onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null; - readonly transport: RTCIceTransport; - addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var RTCSrtpSdesTransport: { - prototype: RTCSrtpSdesTransport; - new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; - getLocalParameters(): RTCSrtpSdesParameters[]; -} - -interface RTCSsrcConflictEvent extends Event { - readonly ssrc: number; -} - -declare var RTCSsrcConflictEvent: { - prototype: RTCSsrcConflictEvent; - new(): RTCSsrcConflictEvent; -} - -interface RTCStatsProvider extends EventTarget { - getStats(): PromiseLike; - msGetStats(): PromiseLike; -} - -declare var RTCStatsProvider: { - prototype: RTCStatsProvider; - new(): RTCStatsProvider; -} - -interface Range { - readonly collapsed: boolean; - readonly commonAncestorContainer: Node; - readonly endContainer: Node; - readonly endOffset: number; - readonly startContainer: Node; - readonly startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - readonly END_TO_END: number; - readonly END_TO_START: number; - readonly START_TO_END: number; - readonly START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly target: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - readonly SVG_ANGLETYPE_DEG: number; - readonly SVG_ANGLETYPE_GRAD: number; - readonly SVG_ANGLETYPE_RAD: number; - readonly SVG_ANGLETYPE_UNKNOWN: number; - readonly SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - readonly animVal: SVGAngle; - readonly baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - readonly animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - readonly animVal: SVGLength; - readonly baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - readonly animVal: SVGLengthList; - readonly baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - readonly animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - readonly animVal: SVGNumberList; - readonly baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - readonly animVal: SVGPreserveAspectRatio; - readonly baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - readonly animVal: SVGRect; - readonly baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - readonly animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - readonly animVal: SVGTransformList; - readonly baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - readonly amplitude: SVGAnimatedNumber; - readonly exponent: SVGAnimatedNumber; - readonly intercept: SVGAnimatedNumber; - readonly offset: SVGAnimatedNumber; - readonly slope: SVGAnimatedNumber; - readonly tableValues: SVGAnimatedNumberList; - readonly type: SVGAnimatedEnumeration; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElementEventMap extends ElementEventMap { - "click": MouseEvent; - "dblclick": MouseEvent; - "focusin": FocusEvent; - "focusout": FocusEvent; - "load": Event; - "mousedown": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; -} - -interface SVGElement extends Element { - onclick: (this: SVGElement, ev: MouseEvent) => any; - ondblclick: (this: SVGElement, ev: MouseEvent) => any; - onfocusin: (this: SVGElement, ev: FocusEvent) => any; - onfocusout: (this: SVGElement, ev: FocusEvent) => any; - onload: (this: SVGElement, ev: Event) => any; - onmousedown: (this: SVGElement, ev: MouseEvent) => any; - onmousemove: (this: SVGElement, ev: MouseEvent) => any; - onmouseout: (this: SVGElement, ev: MouseEvent) => any; - onmouseover: (this: SVGElement, ev: MouseEvent) => any; - onmouseup: (this: SVGElement, ev: MouseEvent) => any; - readonly ownerSVGElement: SVGSVGElement; - readonly viewportElement: SVGElement; - xmlbase: string; - className: any; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - readonly childNodes: SVGElementInstanceList; - readonly correspondingElement: SVGElement; - readonly correspondingUseElement: SVGUseElement; - readonly firstChild: SVGElementInstance; - readonly lastChild: SVGElementInstance; - readonly nextSibling: SVGElementInstance; - readonly parentNode: SVGElementInstance; - readonly previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - readonly length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly mode: SVGAnimatedEnumeration; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - readonly SVG_FEBLEND_MODE_COLOR: number; - readonly SVG_FEBLEND_MODE_COLOR_BURN: number; - readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; - readonly SVG_FEBLEND_MODE_DARKEN: number; - readonly SVG_FEBLEND_MODE_DIFFERENCE: number; - readonly SVG_FEBLEND_MODE_EXCLUSION: number; - readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; - readonly SVG_FEBLEND_MODE_HUE: number; - readonly SVG_FEBLEND_MODE_LIGHTEN: number; - readonly SVG_FEBLEND_MODE_LUMINOSITY: number; - readonly SVG_FEBLEND_MODE_MULTIPLY: number; - readonly SVG_FEBLEND_MODE_NORMAL: number; - readonly SVG_FEBLEND_MODE_OVERLAY: number; - readonly SVG_FEBLEND_MODE_SATURATION: number; - readonly SVG_FEBLEND_MODE_SCREEN: number; - readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; - readonly SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly type: SVGAnimatedEnumeration; - readonly values: SVGAnimatedNumberList; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; - readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; - readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly k1: SVGAnimatedNumber; - readonly k2: SVGAnimatedNumber; - readonly k3: SVGAnimatedNumber; - readonly k4: SVGAnimatedNumber; - readonly operator: SVGAnimatedEnumeration; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; - readonly SVG_FECOMPOSITE_OPERATOR_IN: number; - readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; - readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; - readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly bias: SVGAnimatedNumber; - readonly divisor: SVGAnimatedNumber; - readonly edgeMode: SVGAnimatedEnumeration; - readonly in1: SVGAnimatedString; - readonly kernelMatrix: SVGAnimatedNumberList; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly orderX: SVGAnimatedInteger; - readonly orderY: SVGAnimatedInteger; - readonly preserveAlpha: SVGAnimatedBoolean; - readonly targetX: SVGAnimatedInteger; - readonly targetY: SVGAnimatedInteger; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - readonly SVG_EDGEMODE_DUPLICATE: number; - readonly SVG_EDGEMODE_NONE: number; - readonly SVG_EDGEMODE_UNKNOWN: number; - readonly SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly diffuseConstant: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly in2: SVGAnimatedString; - readonly scale: SVGAnimatedNumber; - readonly xChannelSelector: SVGAnimatedEnumeration; - readonly yChannelSelector: SVGAnimatedEnumeration; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - readonly SVG_CHANNEL_A: number; - readonly SVG_CHANNEL_B: number; - readonly SVG_CHANNEL_G: number; - readonly SVG_CHANNEL_R: number; - readonly SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - readonly azimuth: SVGAnimatedNumber; - readonly elevation: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly stdDeviationX: SVGAnimatedNumber; - readonly stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly operator: SVGAnimatedEnumeration; - readonly radiusX: SVGAnimatedNumber; - readonly radiusY: SVGAnimatedNumber; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; - readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; - readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly dx: SVGAnimatedNumber; - readonly dy: SVGAnimatedNumber; - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - readonly kernelUnitLengthX: SVGAnimatedNumber; - readonly kernelUnitLengthY: SVGAnimatedNumber; - readonly specularConstant: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly surfaceScale: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - readonly limitingConeAngle: SVGAnimatedNumber; - readonly pointsAtX: SVGAnimatedNumber; - readonly pointsAtY: SVGAnimatedNumber; - readonly pointsAtZ: SVGAnimatedNumber; - readonly specularExponent: SVGAnimatedNumber; - readonly x: SVGAnimatedNumber; - readonly y: SVGAnimatedNumber; - readonly z: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly in1: SVGAnimatedString; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - readonly baseFrequencyX: SVGAnimatedNumber; - readonly baseFrequencyY: SVGAnimatedNumber; - readonly numOctaves: SVGAnimatedInteger; - readonly seed: SVGAnimatedNumber; - readonly stitchTiles: SVGAnimatedEnumeration; - readonly type: SVGAnimatedEnumeration; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - readonly SVG_STITCHTYPE_NOSTITCH: number; - readonly SVG_STITCHTYPE_STITCH: number; - readonly SVG_STITCHTYPE_UNKNOWN: number; - readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; - readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - readonly filterResX: SVGAnimatedInteger; - readonly filterResY: SVGAnimatedInteger; - readonly filterUnits: SVGAnimatedEnumeration; - readonly height: SVGAnimatedLength; - readonly primitiveUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - readonly gradientTransform: SVGAnimatedTransformList; - readonly gradientUnits: SVGAnimatedEnumeration; - readonly spreadMethod: SVGAnimatedEnumeration; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - readonly SVG_SPREADMETHOD_PAD: number; - readonly SVG_SPREADMETHOD_REFLECT: number; - readonly SVG_SPREADMETHOD_REPEAT: number; - readonly SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly height: SVGAnimatedLength; - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - readonly unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - readonly SVG_LENGTHTYPE_CM: number; - readonly SVG_LENGTHTYPE_EMS: number; - readonly SVG_LENGTHTYPE_EXS: number; - readonly SVG_LENGTHTYPE_IN: number; - readonly SVG_LENGTHTYPE_MM: number; - readonly SVG_LENGTHTYPE_NUMBER: number; - readonly SVG_LENGTHTYPE_PC: number; - readonly SVG_LENGTHTYPE_PERCENTAGE: number; - readonly SVG_LENGTHTYPE_PT: number; - readonly SVG_LENGTHTYPE_PX: number; - readonly SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - readonly numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - readonly x1: SVGAnimatedLength; - readonly x2: SVGAnimatedLength; - readonly y1: SVGAnimatedLength; - readonly y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - readonly markerHeight: SVGAnimatedLength; - readonly markerUnits: SVGAnimatedEnumeration; - readonly markerWidth: SVGAnimatedLength; - readonly orientAngle: SVGAnimatedAngle; - readonly orientType: SVGAnimatedEnumeration; - readonly refX: SVGAnimatedLength; - readonly refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - readonly SVG_MARKERUNITS_STROKEWIDTH: number; - readonly SVG_MARKERUNITS_UNKNOWN: number; - readonly SVG_MARKERUNITS_USERSPACEONUSE: number; - readonly SVG_MARKER_ORIENT_ANGLE: number; - readonly SVG_MARKER_ORIENT_AUTO: number; - readonly SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly maskContentUnits: SVGAnimatedEnumeration; - readonly maskUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - readonly numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - readonly pathSegType: number; - readonly pathSegTypeAsLetter: string; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - readonly PATHSEG_ARC_ABS: number; - readonly PATHSEG_ARC_REL: number; - readonly PATHSEG_CLOSEPATH: number; - readonly PATHSEG_CURVETO_CUBIC_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_REL: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_REL: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - readonly PATHSEG_LINETO_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; - readonly PATHSEG_LINETO_HORIZONTAL_REL: number; - readonly PATHSEG_LINETO_REL: number; - readonly PATHSEG_LINETO_VERTICAL_ABS: number; - readonly PATHSEG_LINETO_VERTICAL_REL: number; - readonly PATHSEG_MOVETO_ABS: number; - readonly PATHSEG_MOVETO_REL: number; - readonly PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - readonly numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - readonly height: SVGAnimatedLength; - readonly patternContentUnits: SVGAnimatedEnumeration; - readonly patternTransform: SVGAnimatedTransformList; - readonly patternUnits: SVGAnimatedEnumeration; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - readonly numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - readonly SVG_MEETORSLICE_MEET: number; - readonly SVG_MEETORSLICE_SLICE: number; - readonly SVG_MEETORSLICE_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_NONE: number; - readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; - readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - readonly cx: SVGAnimatedLength; - readonly cy: SVGAnimatedLength; - readonly fx: SVGAnimatedLength; - readonly fy: SVGAnimatedLength; - readonly r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly height: SVGAnimatedLength; - readonly rx: SVGAnimatedLength; - readonly ry: SVGAnimatedLength; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElementEventMap extends SVGElementEventMap { - "SVGAbort": Event; - "SVGError": Event; - "resize": UIEvent; - "scroll": UIEvent; - "SVGUnload": Event; - "SVGZoom": SVGZoomEvent; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - readonly currentTranslate: SVGPoint; - readonly height: SVGAnimatedLength; - onabort: (this: SVGSVGElement, ev: Event) => any; - onerror: (this: SVGSVGElement, ev: Event) => any; - onresize: (this: SVGSVGElement, ev: UIEvent) => any; - onscroll: (this: SVGSVGElement, ev: UIEvent) => any; - onunload: (this: SVGSVGElement, ev: Event) => any; - onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any; - readonly pixelUnitToMillimeterX: number; - readonly pixelUnitToMillimeterY: number; - readonly screenPixelToMillimeterX: number; - readonly screenPixelToMillimeterY: number; - readonly viewport: SVGRect; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): void; - addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - readonly offset: SVGAnimatedNumber; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - readonly numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - disabled: boolean; - media: string; - title: string; - type: string; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - readonly lengthAdjust: SVGAnimatedEnumeration; - readonly textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - readonly LENGTHADJUST_SPACING: number; - readonly LENGTHADJUST_SPACINGANDGLYPHS: number; - readonly LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - readonly method: SVGAnimatedEnumeration; - readonly spacing: SVGAnimatedEnumeration; - readonly startOffset: SVGAnimatedLength; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - readonly TEXTPATH_METHODTYPE_ALIGN: number; - readonly TEXTPATH_METHODTYPE_STRETCH: number; - readonly TEXTPATH_METHODTYPE_UNKNOWN: number; - readonly TEXTPATH_SPACINGTYPE_AUTO: number; - readonly TEXTPATH_SPACINGTYPE_EXACT: number; - readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - readonly dx: SVGAnimatedLengthList; - readonly dy: SVGAnimatedLengthList; - readonly rotate: SVGAnimatedNumberList; - readonly x: SVGAnimatedLengthList; - readonly y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - readonly angle: number; - readonly matrix: SVGMatrix; - readonly type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - readonly SVG_TRANSFORM_MATRIX: number; - readonly SVG_TRANSFORM_ROTATE: number; - readonly SVG_TRANSFORM_SCALE: number; - readonly SVG_TRANSFORM_SKEWX: number; - readonly SVG_TRANSFORM_SKEWY: number; - readonly SVG_TRANSFORM_TRANSLATE: number; - readonly SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - readonly numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - readonly SVG_UNIT_TYPE_UNKNOWN: number; - readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - readonly animatedInstanceRoot: SVGElementInstance; - readonly height: SVGAnimatedLength; - readonly instanceRoot: SVGElementInstance; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - readonly viewTarget: SVGStringList; - addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - readonly zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - readonly SVG_ZOOMANDPAN_DISABLE: number; - readonly SVG_ZOOMANDPAN_MAGNIFY: number; - readonly SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - readonly newScale: number; - readonly newTranslate: SVGPoint; - readonly previousScale: number; - readonly previousTranslate: SVGPoint; - readonly zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface ScreenEventMap { - "MSOrientationChange": Event; -} - -interface Screen extends EventTarget { - readonly availHeight: number; - readonly availWidth: number; - bufferDepth: number; - readonly colorDepth: number; - readonly deviceXDPI: number; - readonly deviceYDPI: number; - readonly fontSmoothingEnabled: boolean; - readonly height: number; - readonly logicalXDPI: number; - readonly logicalYDPI: number; - readonly msOrientation: string; - onmsorientationchange: (this: Screen, ev: Event) => any; - readonly pixelDepth: number; - readonly systemXDPI: number; - readonly systemYDPI: number; - readonly width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - readonly callingUri: string; - readonly value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNodeEventMap { - "audioprocess": AudioProcessingEvent; -} - -interface ScriptProcessorNode extends AudioNode { - readonly bufferSize: number; - onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any; - addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - readonly anchorNode: Node; - readonly anchorOffset: number; - readonly focusNode: Node; - readonly focusOffset: number; - readonly isCollapsed: boolean; - readonly rangeCount: number; - readonly type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - readonly audioTracks: AudioTrackList; - readonly buffered: TimeRanges; - mode: string; - timestampOffset: number; - readonly updating: boolean; - readonly videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - readonly length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - readonly pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - readonly length: number; - clear(): void; - getItem(key: string): string | null; - key(index: number): string | null; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - readonly url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - readonly type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - readonly href: string; - readonly media: MediaList; - readonly ownerNode: Node; - readonly parentStyleSheet: StyleSheet; - readonly title: string; - readonly type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - readonly length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - readonly length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike; - deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike; - encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike; - exportKey(format: "jwk", key: CryptoKey): PromiseLike; - exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike; - exportKey(format: string, key: CryptoKey): PromiseLike; - generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike; - generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike; - importKey(format: "jwk", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: "raw" | "pkcs8" | "spki", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike; - sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike; - unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike; - verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - readonly wholeText: string; - readonly assignedSlot: HTMLSlotElement | null; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - readonly data: string; - readonly inputMethod: number; - readonly locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - readonly DOM_INPUT_METHOD_DROP: number; - readonly DOM_INPUT_METHOD_HANDWRITING: number; - readonly DOM_INPUT_METHOD_IME: number; - readonly DOM_INPUT_METHOD_KEYBOARD: number; - readonly DOM_INPUT_METHOD_MULTIMODAL: number; - readonly DOM_INPUT_METHOD_OPTION: number; - readonly DOM_INPUT_METHOD_PASTE: number; - readonly DOM_INPUT_METHOD_SCRIPT: number; - readonly DOM_INPUT_METHOD_UNKNOWN: number; - readonly DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - readonly width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextTrackEventMap { - "cuechange": Event; - "error": ErrorEvent; - "load": Event; -} - -interface TextTrack extends EventTarget { - readonly activeCues: TextTrackCueList; - readonly cues: TextTrackCueList; - readonly inBandMetadataTrackDispatchType: string; - readonly kind: string; - readonly label: string; - readonly language: string; - mode: any; - oncuechange: (this: TextTrack, ev: Event) => any; - onerror: (this: TextTrack, ev: ErrorEvent) => any; - onload: (this: TextTrack, ev: Event) => any; - readonly readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; - addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - readonly DISABLED: number; - readonly ERROR: number; - readonly HIDDEN: number; - readonly LOADED: number; - readonly LOADING: number; - readonly NONE: number; - readonly SHOWING: number; -} - -interface TextTrackCueEventMap { - "enter": Event; - "exit": Event; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (this: TextTrackCue, ev: Event) => any; - onexit: (this: TextTrackCue, ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - readonly track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - readonly length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackListEventMap { - "addtrack": TrackEvent; -} - -interface TextTrackList extends EventTarget { - readonly length: number; - onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null; - item(index: number): TextTrack; - addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - readonly length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - readonly clientX: number; - readonly clientY: number; - readonly identifier: number; - readonly pageX: number; - readonly pageY: number; - readonly screenX: number; - readonly screenY: number; - readonly target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - readonly altKey: boolean; - readonly changedTouches: TouchList; - readonly ctrlKey: boolean; - readonly metaKey: boolean; - readonly shiftKey: boolean; - readonly targetTouches: TouchList; - readonly touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - readonly length: number; - item(index: number): Touch | null; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - readonly track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - readonly elapsedTime: number; - readonly propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - readonly expandEntityReferences: boolean; - readonly filter: NodeFilter; - readonly root: Node; - readonly whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - readonly detail: number; - readonly view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - hash: string; - host: string; - hostname: string; - href: string; - readonly origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - toString(): string; -} - -declare var URL: { - prototype: URL; - new(url: string, base?: string): URL; - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - readonly mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - readonly badInput: boolean; - readonly customError: boolean; - readonly patternMismatch: boolean; - readonly rangeOverflow: boolean; - readonly rangeUnderflow: boolean; - readonly stepMismatch: boolean; - readonly tooLong: boolean; - readonly typeMismatch: boolean; - readonly valid: boolean; - readonly valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - readonly corruptedVideoFrames: number; - readonly creationTime: number; - readonly droppedVideoFrames: number; - readonly totalFrameDelay: number; - readonly totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - readonly id: string; - kind: string; - readonly label: string; - language: string; - selected: boolean; - readonly sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackListEventMap { - "addtrack": TrackEvent; - "change": Event; - "removetrack": TrackEvent; -} - -interface VideoTrackList extends EventTarget { - readonly length: number; - onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any; - onchange: (this: VideoTrackList, ev: Event) => any; - onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any; - readonly selectedIndex: number; - getTrackById(id: string): VideoTrack | null; - item(index: number): VideoTrack; - addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - readonly UNMASKED_RENDERER_WEBGL: number; - readonly UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - readonly UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array | null; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - readonly name: string; - readonly size: number; - readonly type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - readonly statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - readonly canvas: HTMLCanvasElement; - readonly drawingBufferHeight: number; - readonly drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer | null): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void; - bindTexture(target: number, texture: WebGLTexture | null): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader | null): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer | null; - createFramebuffer(): WebGLFramebuffer | null; - createProgram(): WebGLProgram | null; - createRenderbuffer(): WebGLRenderbuffer | null; - createShader(type: number): WebGLShader | null; - createTexture(): WebGLTexture | null; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer | null): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void; - deleteProgram(program: WebGLProgram | null): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void; - deleteShader(shader: WebGLShader | null): void; - deleteTexture(texture: WebGLTexture | null): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null; - getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null; - getAttribLocation(program: WebGLProgram | null, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram | null): string | null; - getProgramParameter(program: WebGLProgram | null, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader | null): string | null; - getShaderParameter(shader: WebGLShader | null, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null; - getShaderSource(shader: WebGLShader | null): string | null; - getSupportedExtensions(): string[] | null; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any; - getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer | null): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean; - isProgram(program: WebGLProgram | null): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean; - isShader(shader: WebGLShader | null): boolean; - isTexture(texture: WebGLTexture | null): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram | null): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader | null, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; - uniform1f(location: WebGLUniformLocation | null, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform1i(location: WebGLUniformLocation | null, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; - uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; - useProgram(program: WebGLProgram | null): void; - validateProgram(program: WebGLProgram | null): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - readonly ACTIVE_ATTRIBUTES: number; - readonly ACTIVE_TEXTURE: number; - readonly ACTIVE_UNIFORMS: number; - readonly ALIASED_LINE_WIDTH_RANGE: number; - readonly ALIASED_POINT_SIZE_RANGE: number; - readonly ALPHA: number; - readonly ALPHA_BITS: number; - readonly ALWAYS: number; - readonly ARRAY_BUFFER: number; - readonly ARRAY_BUFFER_BINDING: number; - readonly ATTACHED_SHADERS: number; - readonly BACK: number; - readonly BLEND: number; - readonly BLEND_COLOR: number; - readonly BLEND_DST_ALPHA: number; - readonly BLEND_DST_RGB: number; - readonly BLEND_EQUATION: number; - readonly BLEND_EQUATION_ALPHA: number; - readonly BLEND_EQUATION_RGB: number; - readonly BLEND_SRC_ALPHA: number; - readonly BLEND_SRC_RGB: number; - readonly BLUE_BITS: number; - readonly BOOL: number; - readonly BOOL_VEC2: number; - readonly BOOL_VEC3: number; - readonly BOOL_VEC4: number; - readonly BROWSER_DEFAULT_WEBGL: number; - readonly BUFFER_SIZE: number; - readonly BUFFER_USAGE: number; - readonly BYTE: number; - readonly CCW: number; - readonly CLAMP_TO_EDGE: number; - readonly COLOR_ATTACHMENT0: number; - readonly COLOR_BUFFER_BIT: number; - readonly COLOR_CLEAR_VALUE: number; - readonly COLOR_WRITEMASK: number; - readonly COMPILE_STATUS: number; - readonly COMPRESSED_TEXTURE_FORMATS: number; - readonly CONSTANT_ALPHA: number; - readonly CONSTANT_COLOR: number; - readonly CONTEXT_LOST_WEBGL: number; - readonly CULL_FACE: number; - readonly CULL_FACE_MODE: number; - readonly CURRENT_PROGRAM: number; - readonly CURRENT_VERTEX_ATTRIB: number; - readonly CW: number; - readonly DECR: number; - readonly DECR_WRAP: number; - readonly DELETE_STATUS: number; - readonly DEPTH_ATTACHMENT: number; - readonly DEPTH_BITS: number; - readonly DEPTH_BUFFER_BIT: number; - readonly DEPTH_CLEAR_VALUE: number; - readonly DEPTH_COMPONENT: number; - readonly DEPTH_COMPONENT16: number; - readonly DEPTH_FUNC: number; - readonly DEPTH_RANGE: number; - readonly DEPTH_STENCIL: number; - readonly DEPTH_STENCIL_ATTACHMENT: number; - readonly DEPTH_TEST: number; - readonly DEPTH_WRITEMASK: number; - readonly DITHER: number; - readonly DONT_CARE: number; - readonly DST_ALPHA: number; - readonly DST_COLOR: number; - readonly DYNAMIC_DRAW: number; - readonly ELEMENT_ARRAY_BUFFER: number; - readonly ELEMENT_ARRAY_BUFFER_BINDING: number; - readonly EQUAL: number; - readonly FASTEST: number; - readonly FLOAT: number; - readonly FLOAT_MAT2: number; - readonly FLOAT_MAT3: number; - readonly FLOAT_MAT4: number; - readonly FLOAT_VEC2: number; - readonly FLOAT_VEC3: number; - readonly FLOAT_VEC4: number; - readonly FRAGMENT_SHADER: number; - readonly FRAMEBUFFER: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - readonly FRAMEBUFFER_BINDING: number; - readonly FRAMEBUFFER_COMPLETE: number; - readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - readonly FRAMEBUFFER_UNSUPPORTED: number; - readonly FRONT: number; - readonly FRONT_AND_BACK: number; - readonly FRONT_FACE: number; - readonly FUNC_ADD: number; - readonly FUNC_REVERSE_SUBTRACT: number; - readonly FUNC_SUBTRACT: number; - readonly GENERATE_MIPMAP_HINT: number; - readonly GEQUAL: number; - readonly GREATER: number; - readonly GREEN_BITS: number; - readonly HIGH_FLOAT: number; - readonly HIGH_INT: number; - readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; - readonly IMPLEMENTATION_COLOR_READ_TYPE: number; - readonly INCR: number; - readonly INCR_WRAP: number; - readonly INT: number; - readonly INT_VEC2: number; - readonly INT_VEC3: number; - readonly INT_VEC4: number; - readonly INVALID_ENUM: number; - readonly INVALID_FRAMEBUFFER_OPERATION: number; - readonly INVALID_OPERATION: number; - readonly INVALID_VALUE: number; - readonly INVERT: number; - readonly KEEP: number; - readonly LEQUAL: number; - readonly LESS: number; - readonly LINEAR: number; - readonly LINEAR_MIPMAP_LINEAR: number; - readonly LINEAR_MIPMAP_NEAREST: number; - readonly LINES: number; - readonly LINE_LOOP: number; - readonly LINE_STRIP: number; - readonly LINE_WIDTH: number; - readonly LINK_STATUS: number; - readonly LOW_FLOAT: number; - readonly LOW_INT: number; - readonly LUMINANCE: number; - readonly LUMINANCE_ALPHA: number; - readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; - readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; - readonly MAX_RENDERBUFFER_SIZE: number; - readonly MAX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_TEXTURE_SIZE: number; - readonly MAX_VARYING_VECTORS: number; - readonly MAX_VERTEX_ATTRIBS: number; - readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - readonly MAX_VERTEX_UNIFORM_VECTORS: number; - readonly MAX_VIEWPORT_DIMS: number; - readonly MEDIUM_FLOAT: number; - readonly MEDIUM_INT: number; - readonly MIRRORED_REPEAT: number; - readonly NEAREST: number; - readonly NEAREST_MIPMAP_LINEAR: number; - readonly NEAREST_MIPMAP_NEAREST: number; - readonly NEVER: number; - readonly NICEST: number; - readonly NONE: number; - readonly NOTEQUAL: number; - readonly NO_ERROR: number; - readonly ONE: number; - readonly ONE_MINUS_CONSTANT_ALPHA: number; - readonly ONE_MINUS_CONSTANT_COLOR: number; - readonly ONE_MINUS_DST_ALPHA: number; - readonly ONE_MINUS_DST_COLOR: number; - readonly ONE_MINUS_SRC_ALPHA: number; - readonly ONE_MINUS_SRC_COLOR: number; - readonly OUT_OF_MEMORY: number; - readonly PACK_ALIGNMENT: number; - readonly POINTS: number; - readonly POLYGON_OFFSET_FACTOR: number; - readonly POLYGON_OFFSET_FILL: number; - readonly POLYGON_OFFSET_UNITS: number; - readonly RED_BITS: number; - readonly RENDERBUFFER: number; - readonly RENDERBUFFER_ALPHA_SIZE: number; - readonly RENDERBUFFER_BINDING: number; - readonly RENDERBUFFER_BLUE_SIZE: number; - readonly RENDERBUFFER_DEPTH_SIZE: number; - readonly RENDERBUFFER_GREEN_SIZE: number; - readonly RENDERBUFFER_HEIGHT: number; - readonly RENDERBUFFER_INTERNAL_FORMAT: number; - readonly RENDERBUFFER_RED_SIZE: number; - readonly RENDERBUFFER_STENCIL_SIZE: number; - readonly RENDERBUFFER_WIDTH: number; - readonly RENDERER: number; - readonly REPEAT: number; - readonly REPLACE: number; - readonly RGB: number; - readonly RGB565: number; - readonly RGB5_A1: number; - readonly RGBA: number; - readonly RGBA4: number; - readonly SAMPLER_2D: number; - readonly SAMPLER_CUBE: number; - readonly SAMPLES: number; - readonly SAMPLE_ALPHA_TO_COVERAGE: number; - readonly SAMPLE_BUFFERS: number; - readonly SAMPLE_COVERAGE: number; - readonly SAMPLE_COVERAGE_INVERT: number; - readonly SAMPLE_COVERAGE_VALUE: number; - readonly SCISSOR_BOX: number; - readonly SCISSOR_TEST: number; - readonly SHADER_TYPE: number; - readonly SHADING_LANGUAGE_VERSION: number; - readonly SHORT: number; - readonly SRC_ALPHA: number; - readonly SRC_ALPHA_SATURATE: number; - readonly SRC_COLOR: number; - readonly STATIC_DRAW: number; - readonly STENCIL_ATTACHMENT: number; - readonly STENCIL_BACK_FAIL: number; - readonly STENCIL_BACK_FUNC: number; - readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; - readonly STENCIL_BACK_PASS_DEPTH_PASS: number; - readonly STENCIL_BACK_REF: number; - readonly STENCIL_BACK_VALUE_MASK: number; - readonly STENCIL_BACK_WRITEMASK: number; - readonly STENCIL_BITS: number; - readonly STENCIL_BUFFER_BIT: number; - readonly STENCIL_CLEAR_VALUE: number; - readonly STENCIL_FAIL: number; - readonly STENCIL_FUNC: number; - readonly STENCIL_INDEX: number; - readonly STENCIL_INDEX8: number; - readonly STENCIL_PASS_DEPTH_FAIL: number; - readonly STENCIL_PASS_DEPTH_PASS: number; - readonly STENCIL_REF: number; - readonly STENCIL_TEST: number; - readonly STENCIL_VALUE_MASK: number; - readonly STENCIL_WRITEMASK: number; - readonly STREAM_DRAW: number; - readonly SUBPIXEL_BITS: number; - readonly TEXTURE: number; - readonly TEXTURE0: number; - readonly TEXTURE1: number; - readonly TEXTURE10: number; - readonly TEXTURE11: number; - readonly TEXTURE12: number; - readonly TEXTURE13: number; - readonly TEXTURE14: number; - readonly TEXTURE15: number; - readonly TEXTURE16: number; - readonly TEXTURE17: number; - readonly TEXTURE18: number; - readonly TEXTURE19: number; - readonly TEXTURE2: number; - readonly TEXTURE20: number; - readonly TEXTURE21: number; - readonly TEXTURE22: number; - readonly TEXTURE23: number; - readonly TEXTURE24: number; - readonly TEXTURE25: number; - readonly TEXTURE26: number; - readonly TEXTURE27: number; - readonly TEXTURE28: number; - readonly TEXTURE29: number; - readonly TEXTURE3: number; - readonly TEXTURE30: number; - readonly TEXTURE31: number; - readonly TEXTURE4: number; - readonly TEXTURE5: number; - readonly TEXTURE6: number; - readonly TEXTURE7: number; - readonly TEXTURE8: number; - readonly TEXTURE9: number; - readonly TEXTURE_2D: number; - readonly TEXTURE_BINDING_2D: number; - readonly TEXTURE_BINDING_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; - readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; - readonly TEXTURE_MAG_FILTER: number; - readonly TEXTURE_MIN_FILTER: number; - readonly TEXTURE_WRAP_S: number; - readonly TEXTURE_WRAP_T: number; - readonly TRIANGLES: number; - readonly TRIANGLE_FAN: number; - readonly TRIANGLE_STRIP: number; - readonly UNPACK_ALIGNMENT: number; - readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - readonly UNPACK_FLIP_Y_WEBGL: number; - readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - readonly UNSIGNED_BYTE: number; - readonly UNSIGNED_INT: number; - readonly UNSIGNED_SHORT: number; - readonly UNSIGNED_SHORT_4_4_4_4: number; - readonly UNSIGNED_SHORT_5_5_5_1: number; - readonly UNSIGNED_SHORT_5_6_5: number; - readonly VALIDATE_STATUS: number; - readonly VENDOR: number; - readonly VERSION: number; - readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; - readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - readonly VERTEX_ATTRIB_ARRAY_POINTER: number; - readonly VERTEX_ATTRIB_ARRAY_SIZE: number; - readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; - readonly VERTEX_ATTRIB_ARRAY_TYPE: number; - readonly VERTEX_SHADER: number; - readonly VIEWPORT: number; - readonly ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - readonly precision: number; - readonly rangeMax: number; - readonly rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocketEventMap { - "close": CloseEvent; - "error": ErrorEvent; - "message": MessageEvent; - "open": Event; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: WebSocket, ev: CloseEvent) => any; - onerror: (this: WebSocket, ev: ErrorEvent) => any; - onmessage: (this: WebSocket, ev: MessageEvent) => any; - onopen: (this: WebSocket, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WheelEvent extends MouseEvent { - readonly deltaMode: number; - readonly deltaX: number; - readonly deltaY: number; - readonly deltaZ: number; - readonly wheelDelta: number; - readonly wheelDeltaX: number; - readonly wheelDeltaY: number; - getCurrentPoint(element: Element): void; - initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - readonly DOM_DELTA_LINE: number; - readonly DOM_DELTA_PAGE: number; - readonly DOM_DELTA_PIXEL: number; -} - -interface WindowEventMap extends GlobalEventHandlersEventMap { - "abort": UIEvent; - "afterprint": Event; - "beforeprint": Event; - "beforeunload": BeforeUnloadEvent; - "blur": FocusEvent; - "canplay": Event; - "canplaythrough": Event; - "change": Event; - "click": MouseEvent; - "compassneedscalibration": Event; - "contextmenu": PointerEvent; - "dblclick": MouseEvent; - "devicelight": DeviceLightEvent; - "devicemotion": DeviceMotionEvent; - "deviceorientation": DeviceOrientationEvent; - "drag": DragEvent; - "dragend": DragEvent; - "dragenter": DragEvent; - "dragleave": DragEvent; - "dragover": DragEvent; - "dragstart": DragEvent; - "drop": DragEvent; - "durationchange": Event; - "emptied": Event; - "ended": MediaStreamErrorEvent; - "focus": FocusEvent; - "hashchange": HashChangeEvent; - "input": Event; - "invalid": Event; - "keydown": KeyboardEvent; - "keypress": KeyboardEvent; - "keyup": KeyboardEvent; - "load": Event; - "loadeddata": Event; - "loadedmetadata": Event; - "loadstart": Event; - "message": MessageEvent; - "mousedown": MouseEvent; - "mouseenter": MouseEvent; - "mouseleave": MouseEvent; - "mousemove": MouseEvent; - "mouseout": MouseEvent; - "mouseover": MouseEvent; - "mouseup": MouseEvent; - "mousewheel": WheelEvent; - "MSGestureChange": MSGestureEvent; - "MSGestureDoubleTap": MSGestureEvent; - "MSGestureEnd": MSGestureEvent; - "MSGestureHold": MSGestureEvent; - "MSGestureStart": MSGestureEvent; - "MSGestureTap": MSGestureEvent; - "MSInertiaStart": MSGestureEvent; - "MSPointerCancel": MSPointerEvent; - "MSPointerDown": MSPointerEvent; - "MSPointerEnter": MSPointerEvent; - "MSPointerLeave": MSPointerEvent; - "MSPointerMove": MSPointerEvent; - "MSPointerOut": MSPointerEvent; - "MSPointerOver": MSPointerEvent; - "MSPointerUp": MSPointerEvent; - "offline": Event; - "online": Event; - "orientationchange": Event; - "pagehide": PageTransitionEvent; - "pageshow": PageTransitionEvent; - "pause": Event; - "play": Event; - "playing": Event; - "popstate": PopStateEvent; - "progress": ProgressEvent; - "ratechange": Event; - "readystatechange": ProgressEvent; - "reset": Event; - "resize": UIEvent; - "scroll": UIEvent; - "seeked": Event; - "seeking": Event; - "select": UIEvent; - "stalled": Event; - "storage": StorageEvent; - "submit": Event; - "suspend": Event; - "timeupdate": Event; - "unload": Event; - "volumechange": Event; - "waiting": Event; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - readonly applicationCache: ApplicationCache; - readonly clientInformation: Navigator; - readonly closed: boolean; - readonly crypto: Crypto; - defaultStatus: string; - readonly devicePixelRatio: number; - readonly doNotTrack: string; - readonly document: Document; - event: Event | undefined; - readonly external: External; - readonly frameElement: Element; - readonly frames: Window; - readonly history: History; - readonly innerHeight: number; - readonly innerWidth: number; - readonly length: number; - readonly location: Location; - readonly locationbar: BarProp; - readonly menubar: BarProp; - readonly msCredentials: MSCredentials; - name: string; - readonly navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (this: Window, ev: UIEvent) => any; - onafterprint: (this: Window, ev: Event) => any; - onbeforeprint: (this: Window, ev: Event) => any; - onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; - onblur: (this: Window, ev: FocusEvent) => any; - oncanplay: (this: Window, ev: Event) => any; - oncanplaythrough: (this: Window, ev: Event) => any; - onchange: (this: Window, ev: Event) => any; - onclick: (this: Window, ev: MouseEvent) => any; - oncompassneedscalibration: (this: Window, ev: Event) => any; - oncontextmenu: (this: Window, ev: PointerEvent) => any; - ondblclick: (this: Window, ev: MouseEvent) => any; - ondevicelight: (this: Window, ev: DeviceLightEvent) => any; - ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; - ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; - ondrag: (this: Window, ev: DragEvent) => any; - ondragend: (this: Window, ev: DragEvent) => any; - ondragenter: (this: Window, ev: DragEvent) => any; - ondragleave: (this: Window, ev: DragEvent) => any; - ondragover: (this: Window, ev: DragEvent) => any; - ondragstart: (this: Window, ev: DragEvent) => any; - ondrop: (this: Window, ev: DragEvent) => any; - ondurationchange: (this: Window, ev: Event) => any; - onemptied: (this: Window, ev: Event) => any; - onended: (this: Window, ev: MediaStreamErrorEvent) => any; - onerror: ErrorEventHandler; - onfocus: (this: Window, ev: FocusEvent) => any; - onhashchange: (this: Window, ev: HashChangeEvent) => any; - oninput: (this: Window, ev: Event) => any; - oninvalid: (this: Window, ev: Event) => any; - onkeydown: (this: Window, ev: KeyboardEvent) => any; - onkeypress: (this: Window, ev: KeyboardEvent) => any; - onkeyup: (this: Window, ev: KeyboardEvent) => any; - onload: (this: Window, ev: Event) => any; - onloadeddata: (this: Window, ev: Event) => any; - onloadedmetadata: (this: Window, ev: Event) => any; - onloadstart: (this: Window, ev: Event) => any; - onmessage: (this: Window, ev: MessageEvent) => any; - onmousedown: (this: Window, ev: MouseEvent) => any; - onmouseenter: (this: Window, ev: MouseEvent) => any; - onmouseleave: (this: Window, ev: MouseEvent) => any; - onmousemove: (this: Window, ev: MouseEvent) => any; - onmouseout: (this: Window, ev: MouseEvent) => any; - onmouseover: (this: Window, ev: MouseEvent) => any; - onmouseup: (this: Window, ev: MouseEvent) => any; - onmousewheel: (this: Window, ev: WheelEvent) => any; - onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; - onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; - onmsgestureend: (this: Window, ev: MSGestureEvent) => any; - onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; - onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; - onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; - onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; - onmspointercancel: (this: Window, ev: MSPointerEvent) => any; - onmspointerdown: (this: Window, ev: MSPointerEvent) => any; - onmspointerenter: (this: Window, ev: MSPointerEvent) => any; - onmspointerleave: (this: Window, ev: MSPointerEvent) => any; - onmspointermove: (this: Window, ev: MSPointerEvent) => any; - onmspointerout: (this: Window, ev: MSPointerEvent) => any; - onmspointerover: (this: Window, ev: MSPointerEvent) => any; - onmspointerup: (this: Window, ev: MSPointerEvent) => any; - onoffline: (this: Window, ev: Event) => any; - ononline: (this: Window, ev: Event) => any; - onorientationchange: (this: Window, ev: Event) => any; - onpagehide: (this: Window, ev: PageTransitionEvent) => any; - onpageshow: (this: Window, ev: PageTransitionEvent) => any; - onpause: (this: Window, ev: Event) => any; - onplay: (this: Window, ev: Event) => any; - onplaying: (this: Window, ev: Event) => any; - onpopstate: (this: Window, ev: PopStateEvent) => any; - onprogress: (this: Window, ev: ProgressEvent) => any; - onratechange: (this: Window, ev: Event) => any; - onreadystatechange: (this: Window, ev: ProgressEvent) => any; - onreset: (this: Window, ev: Event) => any; - onresize: (this: Window, ev: UIEvent) => any; - onscroll: (this: Window, ev: UIEvent) => any; - onseeked: (this: Window, ev: Event) => any; - onseeking: (this: Window, ev: Event) => any; - onselect: (this: Window, ev: UIEvent) => any; - onstalled: (this: Window, ev: Event) => any; - onstorage: (this: Window, ev: StorageEvent) => any; - onsubmit: (this: Window, ev: Event) => any; - onsuspend: (this: Window, ev: Event) => any; - ontimeupdate: (this: Window, ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onunload: (this: Window, ev: Event) => any; - onvolumechange: (this: Window, ev: Event) => any; - onwaiting: (this: Window, ev: Event) => any; - opener: any; - orientation: string | number; - readonly outerHeight: number; - readonly outerWidth: number; - readonly pageXOffset: number; - readonly pageYOffset: number; - readonly parent: Window; - readonly performance: Performance; - readonly personalbar: BarProp; - readonly screen: Screen; - readonly screenLeft: number; - readonly screenTop: number; - readonly screenX: number; - readonly screenY: number; - readonly scrollX: number; - readonly scrollY: number; - readonly scrollbars: BarProp; - readonly self: Window; - status: string; - readonly statusbar: BarProp; - readonly styleMedia: StyleMedia; - readonly toolbar: BarProp; - readonly top: Window; - readonly window: Window; - URL: typeof URL; - Blob: typeof Blob; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, transfer?: any[]): void; - print(): void; - prompt(message?: string, _default?: string): string | null; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitCancelAnimationFrame(handle: number): void; - webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; - webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; - webkitRequestAnimationFrame(callback: FrameRequestCallback): number; - scroll(options?: ScrollToOptions): void; - scrollTo(options?: ScrollToOptions): void; - scrollBy(options?: ScrollToOptions): void; - addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface WorkerEventMap extends AbstractWorkerEventMap { - "message": MessageEvent; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: Worker, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { - addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { - "readystatechange": Event; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - readonly booleanValue: boolean; - readonly invalidIteratorState: boolean; - readonly numberValue: number; - readonly resultType: number; - readonly singleNodeValue: Node; - readonly snapshotLength: number; - readonly stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - readonly ANY_TYPE: number; - readonly ANY_UNORDERED_NODE_TYPE: number; - readonly BOOLEAN_TYPE: number; - readonly FIRST_ORDERED_NODE_TYPE: number; - readonly NUMBER_TYPE: number; - readonly ORDERED_NODE_ITERATOR_TYPE: number; - readonly ORDERED_NODE_SNAPSHOT_TYPE: number; - readonly STRING_TYPE: number; - readonly UNORDERED_NODE_ITERATOR_TYPE: number; - readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorkerEventMap { - "error": ErrorEvent; -} - -interface AbstractWorker { - onerror: (this: AbstractWorker, ev: ErrorEvent) => any; - addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface CanvasPathMethods { - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - closePath(): void; - ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; - createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; - createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; - createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"OverflowEvent"): OverflowEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; - createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; - createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; - createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; - createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; - createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - readonly childElementCount: number; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly nextElementSibling: Element; - readonly previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlersEventMap { - "pointercancel": PointerEvent; - "pointerdown": PointerEvent; - "pointerenter": PointerEvent; - "pointerleave": PointerEvent; - "pointermove": PointerEvent; - "pointerout": PointerEvent; - "pointerover": PointerEvent; - "pointerup": PointerEvent; - "wheel": WheelEvent; -} - -interface GlobalEventHandlers { - onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any; - onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any; - addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - readonly indexedDB: IDBFactory; -} - -interface LinkStyle { - readonly sheet: StyleSheet; -} - -interface MSBaseReaderEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; -} - -interface MSBaseReader { - onabort: (this: MSBaseReader, ev: Event) => any; - onerror: (this: MSBaseReader, ev: ErrorEvent) => any; - onload: (this: MSBaseReader, ev: Event) => any; - onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; - onloadstart: (this: MSBaseReader, ev: Event) => any; - onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: number; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - readonly geolocation: Geolocation; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NavigatorUserMedia { - readonly mediaDevices: MediaDevices; - getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; -} - -interface NodeSelector { - querySelector(selectors: K): ElementTagNameMap[K] | null; - querySelector(selectors: string): Element | null; - querySelectorAll(selectors: K): ElementListTagNameMap[K]; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - readonly pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - readonly animatedPoints: SVGPointList; - readonly points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - readonly externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - readonly height: SVGAnimatedLength; - readonly result: SVGAnimatedString; - readonly width: SVGAnimatedLength; - readonly x: SVGAnimatedLength; - readonly y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - readonly viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - readonly farthestViewportElement: SVGElement; - readonly nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - readonly style: CSSStyleDeclaration; -} - -interface SVGTests { - readonly requiredExtensions: SVGStringList; - readonly requiredFeatures: SVGStringList; - readonly systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - readonly transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - readonly href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface WindowLocalStorage { - readonly localStorage: Storage; -} - -interface WindowSessionStorage { - readonly sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTargetEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; - "timeout": ProgressEvent; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; - onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface Canvas2DContextAttributes { - alpha?: boolean; - willReadFrequently?: boolean; - storage?: boolean; - [attribute: string]: boolean | string | undefined; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface HTMLCollectionOf extends HTMLCollection { - item(index: number): T; - namedItem(name: string): T; - [index: number]: T; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface ScrollOptions { - behavior?: ScrollBehavior; -} - -interface ScrollToOptions extends ScrollOptions { - left?: number; - top?: number; -} - -interface ScrollIntoViewOptions extends ScrollOptions { - block?: ScrollLogicalPosition; - inline?: ScrollLogicalPosition; -} - -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -interface ParentNode { - readonly children: HTMLCollection; - readonly firstElementChild: Element; - readonly lastElementChild: Element; - readonly childElementCount: number; -} - -interface DocumentOrShadowRoot { - readonly activeElement: Element | null; - readonly stylesheets: StyleSheetList; - getSelection(): Selection | null; - elementFromPoint(x: number, y: number): Element | null; - elementsFromPoint(x: number, y: number): Element[]; -} - -interface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment { - readonly host: Element; - innerHTML: string; -} - -interface ShadowRootInit { - mode: 'open'|'closed'; - delegatesFocus?: boolean; -} - -interface HTMLSlotElement extends HTMLElement { - name: string; - assignedNodes(options?: AssignedNodesOptions): Node[]; -} - -interface AssignedNodesOptions { - flatten?: boolean; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -interface NavigatorUserMediaSuccessCallback { - (stream: MediaStream): void; -} -interface NavigatorUserMediaErrorCallback { - (error: MediaStreamError): void; -} -interface ForEachCallback { - (keyId: any, status: string): void; -} -interface HTMLElementTagNameMap { - "a": HTMLAnchorElement; - "applet": HTMLAppletElement; - "area": HTMLAreaElement; - "audio": HTMLAudioElement; - "base": HTMLBaseElement; - "basefont": HTMLBaseFontElement; - "blockquote": HTMLQuoteElement; - "body": HTMLBodyElement; - "br": HTMLBRElement; - "button": HTMLButtonElement; - "canvas": HTMLCanvasElement; - "caption": HTMLTableCaptionElement; - "col": HTMLTableColElement; - "colgroup": HTMLTableColElement; - "datalist": HTMLDataListElement; - "del": HTMLModElement; - "dir": HTMLDirectoryElement; - "div": HTMLDivElement; - "dl": HTMLDListElement; - "embed": HTMLEmbedElement; - "fieldset": HTMLFieldSetElement; - "font": HTMLFontElement; - "form": HTMLFormElement; - "frame": HTMLFrameElement; - "frameset": HTMLFrameSetElement; - "h1": HTMLHeadingElement; - "h2": HTMLHeadingElement; - "h3": HTMLHeadingElement; - "h4": HTMLHeadingElement; - "h5": HTMLHeadingElement; - "h6": HTMLHeadingElement; - "head": HTMLHeadElement; - "hr": HTMLHRElement; - "html": HTMLHtmlElement; - "iframe": HTMLIFrameElement; - "img": HTMLImageElement; - "input": HTMLInputElement; - "ins": HTMLModElement; - "isindex": HTMLUnknownElement; - "label": HTMLLabelElement; - "legend": HTMLLegendElement; - "li": HTMLLIElement; - "link": HTMLLinkElement; - "listing": HTMLPreElement; - "map": HTMLMapElement; - "marquee": HTMLMarqueeElement; - "menu": HTMLMenuElement; - "meta": HTMLMetaElement; - "meter": HTMLMeterElement; - "nextid": HTMLUnknownElement; - "object": HTMLObjectElement; - "ol": HTMLOListElement; - "optgroup": HTMLOptGroupElement; - "option": HTMLOptionElement; - "p": HTMLParagraphElement; - "param": HTMLParamElement; - "picture": HTMLPictureElement; - "pre": HTMLPreElement; - "progress": HTMLProgressElement; - "q": HTMLQuoteElement; - "script": HTMLScriptElement; - "select": HTMLSelectElement; - "source": HTMLSourceElement; - "span": HTMLSpanElement; - "style": HTMLStyleElement; - "table": HTMLTableElement; - "tbody": HTMLTableSectionElement; - "td": HTMLTableDataCellElement; - "template": HTMLTemplateElement; - "textarea": HTMLTextAreaElement; - "tfoot": HTMLTableSectionElement; - "th": HTMLTableHeaderCellElement; - "thead": HTMLTableSectionElement; - "title": HTMLTitleElement; - "tr": HTMLTableRowElement; - "track": HTMLTrackElement; - "ul": HTMLUListElement; - "video": HTMLVideoElement; - "x-ms-webview": MSHTMLWebViewElement; - "xmp": HTMLPreElement; -} - -interface ElementTagNameMap { - "a": HTMLAnchorElement; - "abbr": HTMLElement; - "acronym": HTMLElement; - "address": HTMLElement; - "applet": HTMLAppletElement; - "area": HTMLAreaElement; - "article": HTMLElement; - "aside": HTMLElement; - "audio": HTMLAudioElement; - "b": HTMLElement; - "base": HTMLBaseElement; - "basefont": HTMLBaseFontElement; - "bdo": HTMLElement; - "big": HTMLElement; - "blockquote": HTMLQuoteElement; - "body": HTMLBodyElement; - "br": HTMLBRElement; - "button": HTMLButtonElement; - "canvas": HTMLCanvasElement; - "caption": HTMLTableCaptionElement; - "center": HTMLElement; - "circle": SVGCircleElement; - "cite": HTMLElement; - "clippath": SVGClipPathElement; - "code": HTMLElement; - "col": HTMLTableColElement; - "colgroup": HTMLTableColElement; - "datalist": HTMLDataListElement; - "dd": HTMLElement; - "defs": SVGDefsElement; - "del": HTMLModElement; - "desc": SVGDescElement; - "dfn": HTMLElement; - "dir": HTMLDirectoryElement; - "div": HTMLDivElement; - "dl": HTMLDListElement; - "dt": HTMLElement; - "ellipse": SVGEllipseElement; - "em": HTMLElement; - "embed": HTMLEmbedElement; - "feblend": SVGFEBlendElement; - "fecolormatrix": SVGFEColorMatrixElement; - "fecomponenttransfer": SVGFEComponentTransferElement; - "fecomposite": SVGFECompositeElement; - "feconvolvematrix": SVGFEConvolveMatrixElement; - "fediffuselighting": SVGFEDiffuseLightingElement; - "fedisplacementmap": SVGFEDisplacementMapElement; - "fedistantlight": SVGFEDistantLightElement; - "feflood": SVGFEFloodElement; - "fefunca": SVGFEFuncAElement; - "fefuncb": SVGFEFuncBElement; - "fefuncg": SVGFEFuncGElement; - "fefuncr": SVGFEFuncRElement; - "fegaussianblur": SVGFEGaussianBlurElement; - "feimage": SVGFEImageElement; - "femerge": SVGFEMergeElement; - "femergenode": SVGFEMergeNodeElement; - "femorphology": SVGFEMorphologyElement; - "feoffset": SVGFEOffsetElement; - "fepointlight": SVGFEPointLightElement; - "fespecularlighting": SVGFESpecularLightingElement; - "fespotlight": SVGFESpotLightElement; - "fetile": SVGFETileElement; - "feturbulence": SVGFETurbulenceElement; - "fieldset": HTMLFieldSetElement; - "figcaption": HTMLElement; - "figure": HTMLElement; - "filter": SVGFilterElement; - "font": HTMLFontElement; - "footer": HTMLElement; - "foreignobject": SVGForeignObjectElement; - "form": HTMLFormElement; - "frame": HTMLFrameElement; - "frameset": HTMLFrameSetElement; - "g": SVGGElement; - "h1": HTMLHeadingElement; - "h2": HTMLHeadingElement; - "h3": HTMLHeadingElement; - "h4": HTMLHeadingElement; - "h5": HTMLHeadingElement; - "h6": HTMLHeadingElement; - "head": HTMLHeadElement; - "header": HTMLElement; - "hgroup": HTMLElement; - "hr": HTMLHRElement; - "html": HTMLHtmlElement; - "i": HTMLElement; - "iframe": HTMLIFrameElement; - "image": SVGImageElement; - "img": HTMLImageElement; - "input": HTMLInputElement; - "ins": HTMLModElement; - "isindex": HTMLUnknownElement; - "kbd": HTMLElement; - "keygen": HTMLElement; - "label": HTMLLabelElement; - "legend": HTMLLegendElement; - "li": HTMLLIElement; - "line": SVGLineElement; - "lineargradient": SVGLinearGradientElement; - "link": HTMLLinkElement; - "listing": HTMLPreElement; - "map": HTMLMapElement; - "mark": HTMLElement; - "marker": SVGMarkerElement; - "marquee": HTMLMarqueeElement; - "mask": SVGMaskElement; - "menu": HTMLMenuElement; - "meta": HTMLMetaElement; - "metadata": SVGMetadataElement; - "meter": HTMLMeterElement; - "nav": HTMLElement; - "nextid": HTMLUnknownElement; - "nobr": HTMLElement; - "noframes": HTMLElement; - "noscript": HTMLElement; - "object": HTMLObjectElement; - "ol": HTMLOListElement; - "optgroup": HTMLOptGroupElement; - "option": HTMLOptionElement; - "p": HTMLParagraphElement; - "param": HTMLParamElement; - "path": SVGPathElement; - "pattern": SVGPatternElement; - "picture": HTMLPictureElement; - "plaintext": HTMLElement; - "polygon": SVGPolygonElement; - "polyline": SVGPolylineElement; - "pre": HTMLPreElement; - "progress": HTMLProgressElement; - "q": HTMLQuoteElement; - "radialgradient": SVGRadialGradientElement; - "rect": SVGRectElement; - "rt": HTMLElement; - "ruby": HTMLElement; - "s": HTMLElement; - "samp": HTMLElement; - "script": HTMLScriptElement; - "section": HTMLElement; - "select": HTMLSelectElement; - "small": HTMLElement; - "source": HTMLSourceElement; - "span": HTMLSpanElement; - "stop": SVGStopElement; - "strike": HTMLElement; - "strong": HTMLElement; - "style": HTMLStyleElement; - "sub": HTMLElement; - "sup": HTMLElement; - "svg": SVGSVGElement; - "switch": SVGSwitchElement; - "symbol": SVGSymbolElement; - "table": HTMLTableElement; - "tbody": HTMLTableSectionElement; - "td": HTMLTableDataCellElement; - "template": HTMLTemplateElement; - "text": SVGTextElement; - "textpath": SVGTextPathElement; - "textarea": HTMLTextAreaElement; - "tfoot": HTMLTableSectionElement; - "th": HTMLTableHeaderCellElement; - "thead": HTMLTableSectionElement; - "title": HTMLTitleElement; - "tr": HTMLTableRowElement; - "track": HTMLTrackElement; - "tspan": SVGTSpanElement; - "tt": HTMLElement; - "u": HTMLElement; - "ul": HTMLUListElement; - "use": SVGUseElement; - "var": HTMLElement; - "video": HTMLVideoElement; - "view": SVGViewElement; - "wbr": HTMLElement; - "x-ms-webview": MSHTMLWebViewElement; - "xmp": HTMLPreElement; -} - -interface ElementListTagNameMap { - "a": NodeListOf; - "abbr": NodeListOf; - "acronym": NodeListOf; - "address": NodeListOf; - "applet": NodeListOf; - "area": NodeListOf; - "article": NodeListOf; - "aside": NodeListOf; - "audio": NodeListOf; - "b": NodeListOf; - "base": NodeListOf; - "basefont": NodeListOf; - "bdo": NodeListOf; - "big": NodeListOf; - "blockquote": NodeListOf; - "body": NodeListOf; - "br": NodeListOf; - "button": NodeListOf; - "canvas": NodeListOf; - "caption": NodeListOf; - "center": NodeListOf; - "circle": NodeListOf; - "cite": NodeListOf; - "clippath": NodeListOf; - "code": NodeListOf; - "col": NodeListOf; - "colgroup": NodeListOf; - "datalist": NodeListOf; - "dd": NodeListOf; - "defs": NodeListOf; - "del": NodeListOf; - "desc": NodeListOf; - "dfn": NodeListOf; - "dir": NodeListOf; - "div": NodeListOf; - "dl": NodeListOf; - "dt": NodeListOf; - "ellipse": NodeListOf; - "em": NodeListOf; - "embed": NodeListOf; - "feblend": NodeListOf; - "fecolormatrix": NodeListOf; - "fecomponenttransfer": NodeListOf; - "fecomposite": NodeListOf; - "feconvolvematrix": NodeListOf; - "fediffuselighting": NodeListOf; - "fedisplacementmap": NodeListOf; - "fedistantlight": NodeListOf; - "feflood": NodeListOf; - "fefunca": NodeListOf; - "fefuncb": NodeListOf; - "fefuncg": NodeListOf; - "fefuncr": NodeListOf; - "fegaussianblur": NodeListOf; - "feimage": NodeListOf; - "femerge": NodeListOf; - "femergenode": NodeListOf; - "femorphology": NodeListOf; - "feoffset": NodeListOf; - "fepointlight": NodeListOf; - "fespecularlighting": NodeListOf; - "fespotlight": NodeListOf; - "fetile": NodeListOf; - "feturbulence": NodeListOf; - "fieldset": NodeListOf; - "figcaption": NodeListOf; - "figure": NodeListOf; - "filter": NodeListOf; - "font": NodeListOf; - "footer": NodeListOf; - "foreignobject": NodeListOf; - "form": NodeListOf; - "frame": NodeListOf; - "frameset": NodeListOf; - "g": NodeListOf; - "h1": NodeListOf; - "h2": NodeListOf; - "h3": NodeListOf; - "h4": NodeListOf; - "h5": NodeListOf; - "h6": NodeListOf; - "head": NodeListOf; - "header": NodeListOf; - "hgroup": NodeListOf; - "hr": NodeListOf; - "html": NodeListOf; - "i": NodeListOf; - "iframe": NodeListOf; - "image": NodeListOf; - "img": NodeListOf; - "input": NodeListOf; - "ins": NodeListOf; - "isindex": NodeListOf; - "kbd": NodeListOf; - "keygen": NodeListOf; - "label": NodeListOf; - "legend": NodeListOf; - "li": NodeListOf; - "line": NodeListOf; - "lineargradient": NodeListOf; - "link": NodeListOf; - "listing": NodeListOf; - "map": NodeListOf; - "mark": NodeListOf; - "marker": NodeListOf; - "marquee": NodeListOf; - "mask": NodeListOf; - "menu": NodeListOf; - "meta": NodeListOf; - "metadata": NodeListOf; - "meter": NodeListOf; - "nav": NodeListOf; - "nextid": NodeListOf; - "nobr": NodeListOf; - "noframes": NodeListOf; - "noscript": NodeListOf; - "object": NodeListOf; - "ol": NodeListOf; - "optgroup": NodeListOf; - "option": NodeListOf; - "p": NodeListOf; - "param": NodeListOf; - "path": NodeListOf; - "pattern": NodeListOf; - "picture": NodeListOf; - "plaintext": NodeListOf; - "polygon": NodeListOf; - "polyline": NodeListOf; - "pre": NodeListOf; - "progress": NodeListOf; - "q": NodeListOf; - "radialgradient": NodeListOf; - "rect": NodeListOf; - "rt": NodeListOf; - "ruby": NodeListOf; - "s": NodeListOf; - "samp": NodeListOf; - "script": NodeListOf; - "section": NodeListOf; - "select": NodeListOf; - "small": NodeListOf; - "source": NodeListOf; - "span": NodeListOf; - "stop": NodeListOf; - "strike": NodeListOf; - "strong": NodeListOf; - "style": NodeListOf; - "sub": NodeListOf; - "sup": NodeListOf; - "svg": NodeListOf; - "switch": NodeListOf; - "symbol": NodeListOf; - "table": NodeListOf; - "tbody": NodeListOf; - "td": NodeListOf; - "template": NodeListOf; - "text": NodeListOf; - "textpath": NodeListOf; - "textarea": NodeListOf; - "tfoot": NodeListOf; - "th": NodeListOf; - "thead": NodeListOf; - "title": NodeListOf; - "tr": NodeListOf; - "track": NodeListOf; - "tspan": NodeListOf; - "tt": NodeListOf; - "u": NodeListOf; - "ul": NodeListOf; - "use": NodeListOf; - "var": NodeListOf; - "video": NodeListOf; - "view": NodeListOf; - "wbr": NodeListOf; - "x-ms-webview": NodeListOf; - "xmp": NodeListOf; -} - -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event | undefined; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msCredentials: MSCredentials; -declare const name: never; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (this: Window, ev: UIEvent) => any; -declare var onafterprint: (this: Window, ev: Event) => any; -declare var onbeforeprint: (this: Window, ev: Event) => any; -declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; -declare var onblur: (this: Window, ev: FocusEvent) => any; -declare var oncanplay: (this: Window, ev: Event) => any; -declare var oncanplaythrough: (this: Window, ev: Event) => any; -declare var onchange: (this: Window, ev: Event) => any; -declare var onclick: (this: Window, ev: MouseEvent) => any; -declare var oncompassneedscalibration: (this: Window, ev: Event) => any; -declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; -declare var ondblclick: (this: Window, ev: MouseEvent) => any; -declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; -declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; -declare var ondrag: (this: Window, ev: DragEvent) => any; -declare var ondragend: (this: Window, ev: DragEvent) => any; -declare var ondragenter: (this: Window, ev: DragEvent) => any; -declare var ondragleave: (this: Window, ev: DragEvent) => any; -declare var ondragover: (this: Window, ev: DragEvent) => any; -declare var ondragstart: (this: Window, ev: DragEvent) => any; -declare var ondrop: (this: Window, ev: DragEvent) => any; -declare var ondurationchange: (this: Window, ev: Event) => any; -declare var onemptied: (this: Window, ev: Event) => any; -declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (this: Window, ev: FocusEvent) => any; -declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; -declare var oninput: (this: Window, ev: Event) => any; -declare var oninvalid: (this: Window, ev: Event) => any; -declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; -declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; -declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; -declare var onload: (this: Window, ev: Event) => any; -declare var onloadeddata: (this: Window, ev: Event) => any; -declare var onloadedmetadata: (this: Window, ev: Event) => any; -declare var onloadstart: (this: Window, ev: Event) => any; -declare var onmessage: (this: Window, ev: MessageEvent) => any; -declare var onmousedown: (this: Window, ev: MouseEvent) => any; -declare var onmouseenter: (this: Window, ev: MouseEvent) => any; -declare var onmouseleave: (this: Window, ev: MouseEvent) => any; -declare var onmousemove: (this: Window, ev: MouseEvent) => any; -declare var onmouseout: (this: Window, ev: MouseEvent) => any; -declare var onmouseover: (this: Window, ev: MouseEvent) => any; -declare var onmouseup: (this: Window, ev: MouseEvent) => any; -declare var onmousewheel: (this: Window, ev: WheelEvent) => any; -declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; -declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; -declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; -declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; -declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; -declare var onoffline: (this: Window, ev: Event) => any; -declare var ononline: (this: Window, ev: Event) => any; -declare var onorientationchange: (this: Window, ev: Event) => any; -declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; -declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; -declare var onpause: (this: Window, ev: Event) => any; -declare var onplay: (this: Window, ev: Event) => any; -declare var onplaying: (this: Window, ev: Event) => any; -declare var onpopstate: (this: Window, ev: PopStateEvent) => any; -declare var onprogress: (this: Window, ev: ProgressEvent) => any; -declare var onratechange: (this: Window, ev: Event) => any; -declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; -declare var onreset: (this: Window, ev: Event) => any; -declare var onresize: (this: Window, ev: UIEvent) => any; -declare var onscroll: (this: Window, ev: UIEvent) => any; -declare var onseeked: (this: Window, ev: Event) => any; -declare var onseeking: (this: Window, ev: Event) => any; -declare var onselect: (this: Window, ev: UIEvent) => any; -declare var onstalled: (this: Window, ev: Event) => any; -declare var onstorage: (this: Window, ev: StorageEvent) => any; -declare var onsubmit: (this: Window, ev: Event) => any; -declare var onsuspend: (this: Window, ev: Event) => any; -declare var ontimeupdate: (this: Window, ev: Event) => any; -declare var ontouchcancel: (ev: TouchEvent) => any; -declare var ontouchend: (ev: TouchEvent) => any; -declare var ontouchmove: (ev: TouchEvent) => any; -declare var ontouchstart: (ev: TouchEvent) => any; -declare var onunload: (this: Window, ev: Event) => any; -declare var onvolumechange: (this: Window, ev: Event) => any; -declare var onwaiting: (this: Window, ev: Event) => any; -declare var opener: any; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string | null; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -declare function webkitCancelAnimationFrame(handle: number): void; -declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; -declare function scroll(options?: ScrollToOptions): void; -declare function scrollTo(options?: ScrollToOptions): void; -declare function scrollBy(options?: ScrollToOptions): void; -declare function toString(): string; -declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (this: Window, ev: PointerEvent) => any; -declare var onpointerdown: (this: Window, ev: PointerEvent) => any; -declare var onpointerenter: (this: Window, ev: PointerEvent) => any; -declare var onpointerleave: (this: Window, ev: PointerEvent) => any; -declare var onpointermove: (this: Window, ev: PointerEvent) => any; -declare var onpointerout: (this: Window, ev: PointerEvent) => any; -declare var onpointerover: (this: Window, ev: PointerEvent) => any; -declare var onpointerup: (this: Window, ev: PointerEvent) => any; -declare var onwheel: (this: Window, ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AAGUID = string; -type AlgorithmIdentifier = string | Algorithm; -type ConstrainBoolean = boolean | ConstrainBooleanParameters; -type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; -type ConstrainDouble = number | ConstrainDoubleRange; -type ConstrainLong = number | ConstrainLongRange; -type CryptoOperationData = ArrayBufferView; -type GLbitfield = number; -type GLboolean = boolean; -type GLbyte = number; -type GLclampf = number; -type GLenum = number; -type GLfloat = number; -type GLint = number; -type GLintptr = number; -type GLshort = number; -type GLsizei = number; -type GLsizeiptr = number; -type GLubyte = number; -type GLuint = number; -type GLushort = number; -type IDBKeyPath = string; -type KeyFormat = string; -type KeyType = string; -type KeyUsage = string; -type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; -type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; -type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; -type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; -type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; -type payloadtype = number; -type ScrollBehavior = "auto" | "instant" | "smooth"; -type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; -type IDBValidKey = number | string | Date | IDBArrayKey; -type BufferSource = ArrayBuffer | ArrayBufferView; -type MouseWheelEvent = WheelEvent; +declare var Audio: {new(src?: string): HTMLAudioElement; }; +declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; +declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; +declare var applicationCache: ApplicationCache; +declare var caches: CacheStorage; +declare var clientInformation: Navigator; +declare var closed: boolean; +declare var crypto: Crypto; +declare var defaultStatus: string; +declare var devicePixelRatio: number; +declare var doNotTrack: string; +declare var document: Document; +declare var event: Event | undefined; +declare var external: External; +declare var frameElement: Element; +declare var frames: Window; +declare var history: History; +declare var innerHeight: number; +declare var innerWidth: number; +declare var isSecureContext: boolean; +declare var length: number; +declare var location: Location; +declare var locationbar: BarProp; +declare var menubar: BarProp; +declare var msContentScript: ExtensionScriptApis; +declare var msCredentials: MSCredentials; +declare const name: never; +declare var navigator: Navigator; +declare var offscreenBuffering: string | boolean; +declare var onabort: (this: Window, ev: UIEvent) => any; +declare var onafterprint: (this: Window, ev: Event) => any; +declare var onbeforeprint: (this: Window, ev: Event) => any; +declare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any; +declare var onblur: (this: Window, ev: FocusEvent) => any; +declare var oncanplay: (this: Window, ev: Event) => any; +declare var oncanplaythrough: (this: Window, ev: Event) => any; +declare var onchange: (this: Window, ev: Event) => any; +declare var onclick: (this: Window, ev: MouseEvent) => any; +declare var oncompassneedscalibration: (this: Window, ev: Event) => any; +declare var oncontextmenu: (this: Window, ev: PointerEvent) => any; +declare var ondblclick: (this: Window, ev: MouseEvent) => any; +declare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any; +declare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any; +declare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any; +declare var ondrag: (this: Window, ev: DragEvent) => any; +declare var ondragend: (this: Window, ev: DragEvent) => any; +declare var ondragenter: (this: Window, ev: DragEvent) => any; +declare var ondragleave: (this: Window, ev: DragEvent) => any; +declare var ondragover: (this: Window, ev: DragEvent) => any; +declare var ondragstart: (this: Window, ev: DragEvent) => any; +declare var ondrop: (this: Window, ev: DragEvent) => any; +declare var ondurationchange: (this: Window, ev: Event) => any; +declare var onemptied: (this: Window, ev: Event) => any; +declare var onended: (this: Window, ev: MediaStreamErrorEvent) => any; +declare var onerror: ErrorEventHandler; +declare var onfocus: (this: Window, ev: FocusEvent) => any; +declare var onhashchange: (this: Window, ev: HashChangeEvent) => any; +declare var oninput: (this: Window, ev: Event) => any; +declare var oninvalid: (this: Window, ev: Event) => any; +declare var onkeydown: (this: Window, ev: KeyboardEvent) => any; +declare var onkeypress: (this: Window, ev: KeyboardEvent) => any; +declare var onkeyup: (this: Window, ev: KeyboardEvent) => any; +declare var onload: (this: Window, ev: Event) => any; +declare var onloadeddata: (this: Window, ev: Event) => any; +declare var onloadedmetadata: (this: Window, ev: Event) => any; +declare var onloadstart: (this: Window, ev: Event) => any; +declare var onmessage: (this: Window, ev: MessageEvent) => any; +declare var onmousedown: (this: Window, ev: MouseEvent) => any; +declare var onmouseenter: (this: Window, ev: MouseEvent) => any; +declare var onmouseleave: (this: Window, ev: MouseEvent) => any; +declare var onmousemove: (this: Window, ev: MouseEvent) => any; +declare var onmouseout: (this: Window, ev: MouseEvent) => any; +declare var onmouseover: (this: Window, ev: MouseEvent) => any; +declare var onmouseup: (this: Window, ev: MouseEvent) => any; +declare var onmousewheel: (this: Window, ev: WheelEvent) => any; +declare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any; +declare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any; +declare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any; +declare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointermove: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerout: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerover: (this: Window, ev: MSPointerEvent) => any; +declare var onmspointerup: (this: Window, ev: MSPointerEvent) => any; +declare var onoffline: (this: Window, ev: Event) => any; +declare var ononline: (this: Window, ev: Event) => any; +declare var onorientationchange: (this: Window, ev: Event) => any; +declare var onpagehide: (this: Window, ev: PageTransitionEvent) => any; +declare var onpageshow: (this: Window, ev: PageTransitionEvent) => any; +declare var onpause: (this: Window, ev: Event) => any; +declare var onplay: (this: Window, ev: Event) => any; +declare var onplaying: (this: Window, ev: Event) => any; +declare var onpopstate: (this: Window, ev: PopStateEvent) => any; +declare var onprogress: (this: Window, ev: ProgressEvent) => any; +declare var onratechange: (this: Window, ev: Event) => any; +declare var onreadystatechange: (this: Window, ev: ProgressEvent) => any; +declare var onreset: (this: Window, ev: Event) => any; +declare var onresize: (this: Window, ev: UIEvent) => any; +declare var onscroll: (this: Window, ev: UIEvent) => any; +declare var onseeked: (this: Window, ev: Event) => any; +declare var onseeking: (this: Window, ev: Event) => any; +declare var onselect: (this: Window, ev: UIEvent) => any; +declare var onstalled: (this: Window, ev: Event) => any; +declare var onstorage: (this: Window, ev: StorageEvent) => any; +declare var onsubmit: (this: Window, ev: Event) => any; +declare var onsuspend: (this: Window, ev: Event) => any; +declare var ontimeupdate: (this: Window, ev: Event) => any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; +declare var onunload: (this: Window, ev: Event) => any; +declare var onvolumechange: (this: Window, ev: Event) => any; +declare var onwaiting: (this: Window, ev: Event) => any; +declare var opener: any; +declare var orientation: string | number; +declare var outerHeight: number; +declare var outerWidth: number; +declare var pageXOffset: number; +declare var pageYOffset: number; +declare var parent: Window; +declare var performance: Performance; +declare var personalbar: BarProp; +declare var screen: Screen; +declare var screenLeft: number; +declare var screenTop: number; +declare var screenX: number; +declare var screenY: number; +declare var scrollX: number; +declare var scrollY: number; +declare var scrollbars: BarProp; +declare var self: Window; +declare var speechSynthesis: SpeechSynthesis; +declare var status: string; +declare var statusbar: BarProp; +declare var styleMedia: StyleMedia; +declare var toolbar: BarProp; +declare var top: Window; +declare var window: Window; +declare var customElements: CustomElementRegistry; +declare function alert(message?: any): void; +declare function blur(): void; +declare function cancelAnimationFrame(handle: number): void; +declare function captureEvents(): void; +declare function close(): void; +declare function confirm(message?: string): boolean; +declare function departFocus(navigationReason: NavigationReason, origin: FocusNavigationOrigin): void; +declare function focus(): void; +declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; +declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; +declare function getSelection(): Selection; +declare function matchMedia(mediaQuery: string): MediaQueryList; +declare function moveBy(x?: number, y?: number): void; +declare function moveTo(x?: number, y?: number): void; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; +declare function print(): void; +declare function prompt(message?: string, _default?: string): string | null; +declare function releaseEvents(): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; +declare function resizeBy(x?: number, y?: number): void; +declare function resizeTo(x?: number, y?: number): void; +declare function scroll(x?: number, y?: number): void; +declare function scrollBy(x?: number, y?: number): void; +declare function scrollTo(x?: number, y?: number): void; +declare function stop(): void; +declare function webkitCancelAnimationFrame(handle: number): void; +declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; +declare function scroll(options?: ScrollToOptions): void; +declare function scrollTo(options?: ScrollToOptions): void; +declare function scrollBy(options?: ScrollToOptions): void; +declare function toString(): string; +declare function dispatchEvent(evt: Event): boolean; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function clearImmediate(handle: number): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare var sessionStorage: Storage; +declare var localStorage: Storage; +declare var console: Console; +declare var onpointercancel: (this: Window, ev: PointerEvent) => any; +declare var onpointerdown: (this: Window, ev: PointerEvent) => any; +declare var onpointerenter: (this: Window, ev: PointerEvent) => any; +declare var onpointerleave: (this: Window, ev: PointerEvent) => any; +declare var onpointermove: (this: Window, ev: PointerEvent) => any; +declare var onpointerout: (this: Window, ev: PointerEvent) => any; +declare var onpointerover: (this: Window, ev: PointerEvent) => any; +declare var onpointerup: (this: Window, ev: PointerEvent) => any; +declare var onwheel: (this: Window, ev: WheelEvent) => any; +declare var indexedDB: IDBFactory; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; +declare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type BodyInit = any; +type ByteString = string; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type HeadersInit = any; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidateDictionary | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type RequestInfo = Request | string; +type USVString = string; +type payloadtype = number; +type ScrollBehavior = "auto" | "instant" | "smooth"; +type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; +type IDBValidKey = number | string | Date | IDBArrayKey; +type BufferSource = ArrayBuffer | ArrayBufferView; +type MouseWheelEvent = WheelEvent; type ScrollRestoration = "auto" | "manual"; +type FormDataEntryValue = string | File; +type AppendMode = "segments" | "sequence"; +type AudioContextState = "suspended" | "running" | "closed"; +type BiquadFilterType = "lowpass" | "highpass" | "bandpass" | "lowshelf" | "highshelf" | "peaking" | "notch" | "allpass"; +type CanvasFillRule = "nonzero" | "evenodd"; +type ChannelCountMode = "max" | "clamped-max" | "explicit"; +type ChannelInterpretation = "speakers" | "discrete"; +type DistanceModelType = "linear" | "inverse" | "exponential"; +type ExpandGranularity = "character" | "word" | "sentence" | "textedit"; +type GamepadInputEmulationType = "mouse" | "keyboard" | "gamepad"; +type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; +type IDBRequestReadyState = "pending" | "done"; +type IDBTransactionMode = "readonly" | "readwrite" | "versionchange"; +type ListeningState = "inactive" | "active" | "disambiguation"; +type MSCredentialType = "FIDO_2_0"; +type MSIceAddrType = "os" | "stun" | "turn" | "peer-derived"; +type MSIceType = "failed" | "direct" | "relay"; +type MSStatsType = "description" | "localclientevent" | "inbound-network" | "outbound-network" | "inbound-payload" | "outbound-payload" | "transportdiagnostics"; +type MSTransportType = "Embedded" | "USB" | "NFC" | "BT"; +type MSWebViewPermissionState = "unknown" | "defer" | "allow" | "deny"; +type MSWebViewPermissionType = "geolocation" | "unlimitedIndexedDBQuota" | "media" | "pointerlock" | "webnotifications"; +type MediaDeviceKind = "audioinput" | "audiooutput" | "videoinput"; +type MediaKeyMessageType = "license-request" | "license-renewal" | "license-release" | "individualization-request"; +type MediaKeySessionType = "temporary" | "persistent-license" | "persistent-release-message"; +type MediaKeyStatus = "usable" | "expired" | "output-downscaled" | "output-not-allowed" | "status-pending" | "internal-error"; +type MediaKeysRequirement = "required" | "optional" | "not-allowed"; +type MediaStreamTrackState = "live" | "ended"; +type NavigationReason = "up" | "down" | "left" | "right"; +type NavigationType = "navigate" | "reload" | "back_forward" | "prerender"; +type NotificationDirection = "auto" | "ltr" | "rtl"; +type NotificationPermission = "default" | "denied" | "granted"; +type OscillatorType = "sine" | "square" | "sawtooth" | "triangle" | "custom"; +type OverSampleType = "none" | "2x" | "4x"; +type PanningModelType = "equalpower"; +type PaymentComplete = "success" | "fail" | ""; +type PaymentShippingType = "shipping" | "delivery" | "pickup"; +type PushEncryptionKeyName = "p256dh" | "auth"; +type PushPermissionState = "granted" | "denied" | "prompt"; +type RTCBundlePolicy = "balanced" | "max-compat" | "max-bundle"; +type RTCDegradationPreference = "maintain-framerate" | "maintain-resolution" | "balanced"; +type RTCDtlsRole = "auto" | "client" | "server"; +type RTCDtlsTransportState = "new" | "connecting" | "connected" | "closed"; +type RTCIceCandidateType = "host" | "srflx" | "prflx" | "relay"; +type RTCIceComponent = "RTP" | "RTCP"; +type RTCIceConnectionState = "new" | "checking" | "connected" | "completed" | "failed" | "disconnected" | "closed"; +type RTCIceGatherPolicy = "all" | "nohost" | "relay"; +type RTCIceGathererState = "new" | "gathering" | "complete"; +type RTCIceGatheringState = "new" | "gathering" | "complete"; +type RTCIceProtocol = "udp" | "tcp"; +type RTCIceRole = "controlling" | "controlled"; +type RTCIceTcpCandidateType = "active" | "passive" | "so"; +type RTCIceTransportPolicy = "none" | "relay" | "all"; +type RTCIceTransportState = "new" | "checking" | "connected" | "completed" | "disconnected" | "closed"; +type RTCSdpType = "offer" | "pranswer" | "answer"; +type RTCSignalingState = "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer" | "closed"; +type RTCStatsIceCandidatePairState = "frozen" | "waiting" | "inprogress" | "failed" | "succeeded" | "cancelled"; +type RTCStatsIceCandidateType = "host" | "serverreflexive" | "peerreflexive" | "relayed"; +type RTCStatsType = "inboundrtp" | "outboundrtp" | "session" | "datachannel" | "track" | "transport" | "candidatepair" | "localcandidate" | "remotecandidate"; +type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url"; +type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache"; +type RequestCredentials = "omit" | "same-origin" | "include"; +type RequestDestination = "" | "document" | "sharedworker" | "subresource" | "unknown" | "worker"; +type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; +type RequestRedirect = "follow" | "error" | "manual"; +type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video"; +type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; +type ScopedCredentialType = "ScopedCred"; +type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant"; +type Transport = "usb" | "nfc" | "ble"; +type VideoFacingModeEnum = "user" | "environment" | "left" | "right"; +type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded"; +type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text"; + + +///////////////////////////// +/// WorkerGlobalScope APIs +///////////////////////////// +// These are only available in a Web Worker +declare function importScripts(...urls: string[]): void; + + + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} - -///////////////////////////// -/// WorkerGlobalScope APIs -///////////////////////////// -// These are only available in a Web Worker -declare function importScripts(...urls: string[]): void; - - - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; - -/** - * Automation date (VT_DATE) - */ -interface VarDate { } - -interface DateConstructor { - new (vd: VarDate): Date; -} - -interface Date { - getVarDate: () => VarDate; -} - - -/// - -interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: any): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: any): VBArray; + new (safeArray: any): VBArray; +} + +declare var VBArray: VBArrayConstructor; + +/** + * Automation date (VT_DATE) + */ +interface VarDate { } + +interface DateConstructor { + new (vd: VarDate): Date; +} + +interface Date { + getVarDate: () => VarDate; +} + + +/// + +interface DOMTokenList { + [Symbol.iterator](): IterableIterator; +} + +interface FormData { + /** + * Returns an array of key, value pairs for every entry in the list + */ + entries(): IterableIterator<[string, string | File]>; + /** + * Returns a list of keys in the list + */ + keys(): IterableIterator; + /** + * Returns a list of values in the list + */ + values(): IterableIterator; + + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + /** + * Returns an array of key, value pairs for every entry in the list + */ + entries(): IterableIterator<[number, Node]>; + /** + * Performs the specified action for each node in an list. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: Node, index: number, listObj: NodeList) => void, thisArg?: any): void; + /** + * Returns an list of keys in the list + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the list + */ + values(): IterableIterator; + + + [Symbol.iterator](): IterableIterator; +} + +interface NodeListOf { + + /** + * Returns an array of key, value pairs for every entry in the list + */ + entries(): IterableIterator<[number, TNode]>; + + /** + * Performs the specified action for each node in an list. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: TNode, index: number, listObj: NodeListOf) => void, thisArg?: any): void; + /** + * Returns an list of keys in the list + */ + keys(): IterableIterator; + /** + * Returns an list of values in the list + */ + values(): IterableIterator; + + [Symbol.iterator](): IterableIterator; +} diff --git a/node_modules/typescript/lib/lib.scripthost.d.ts b/node_modules/typescript/lib/lib.scripthost.d.ts index 2d2f4df3b..47cfaa7fb 100644 --- a/node_modules/typescript/lib/lib.scripthost.d.ts +++ b/node_modules/typescript/lib/lib.scripthost.d.ts @@ -1,311 +1,311 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; - -/** - * Automation date (VT_DATE) - */ -interface VarDate { } - -interface DateConstructor { - new (vd: VarDate): Date; -} - -interface Date { - getVarDate: () => VarDate; -} +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + + + +///////////////////////////// +/// Windows Script Host APIS +///////////////////////////// + + +interface ActiveXObject { + new (s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: any): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: any): VBArray; + new (safeArray: any): VBArray; +} + +declare var VBArray: VBArrayConstructor; + +/** + * Automation date (VT_DATE) + */ +interface VarDate { } + +interface DateConstructor { + new (vd: VarDate): Date; +} + +interface Date { + getVarDate: () => VarDate; +} diff --git a/node_modules/typescript/lib/lib.webworker.d.ts b/node_modules/typescript/lib/lib.webworker.d.ts index 97eb9814e..4e7672f79 100644 --- a/node_modules/typescript/lib/lib.webworker.d.ts +++ b/node_modules/typescript/lib/lib.webworker.d.ts @@ -1,1274 +1,1861 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - - - -/// - - - -///////////////////////////// -/// IE Worker APIs -///////////////////////////// - -interface Algorithm { - name: string; -} - -interface EventInit { - scoped?: boolean; - bubbles?: boolean; - cancelable?: boolean; -} - -interface IDBIndexParameters { - multiEntry?: boolean; - unique?: boolean; -} - -interface IDBObjectStoreParameters { - autoIncrement?: boolean; - keyPath?: IDBKeyPath; -} - -interface KeyAlgorithm { - name?: string; -} - -interface EventListener { - (evt: Event): void; -} - -interface AudioBuffer { - readonly duration: number; - readonly length: number; - readonly numberOfChannels: number; - readonly sampleRate: number; - copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; - copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CloseEvent extends Event { - readonly code: number; - readonly reason: string; - readonly wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - exception(message?: string, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: any): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: any): void; - table(...data: any[]): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface Coordinates { - readonly accuracy: number; - readonly altitude: number | null; - readonly altitudeAccuracy: number | null; - readonly heading: number | null; - readonly latitude: number; - readonly longitude: number; - readonly speed: number | null; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface CryptoKey { - readonly algorithm: KeyAlgorithm; - readonly extractable: boolean; - readonly type: string; - readonly usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface DOMError { - readonly name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - readonly code: number; - readonly message: string; - readonly name: string; - toString(): string; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - readonly ABORT_ERR: number; - readonly DATA_CLONE_ERR: number; - readonly DOMSTRING_SIZE_ERR: number; - readonly HIERARCHY_REQUEST_ERR: number; - readonly INDEX_SIZE_ERR: number; - readonly INUSE_ATTRIBUTE_ERR: number; - readonly INVALID_ACCESS_ERR: number; - readonly INVALID_CHARACTER_ERR: number; - readonly INVALID_MODIFICATION_ERR: number; - readonly INVALID_NODE_TYPE_ERR: number; - readonly INVALID_STATE_ERR: number; - readonly NAMESPACE_ERR: number; - readonly NETWORK_ERR: number; - readonly NOT_FOUND_ERR: number; - readonly NOT_SUPPORTED_ERR: number; - readonly NO_DATA_ALLOWED_ERR: number; - readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; - readonly QUOTA_EXCEEDED_ERR: number; - readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; - readonly SYNTAX_ERR: number; - readonly TIMEOUT_ERR: number; - readonly TYPE_MISMATCH_ERR: number; - readonly URL_MISMATCH_ERR: number; - readonly VALIDATION_ERR: number; - readonly WRONG_DOCUMENT_ERR: number; -} - -interface DOMStringList { - readonly length: number; - contains(str: string): boolean; - item(index: number): string | null; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface ErrorEvent extends Event { - readonly colno: number; - readonly error: any; - readonly filename: string; - readonly lineno: number; - readonly message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - readonly bubbles: boolean; - cancelBubble: boolean; - readonly cancelable: boolean; - readonly currentTarget: EventTarget; - readonly defaultPrevented: boolean; - readonly eventPhase: number; - readonly isTrusted: boolean; - returnValue: boolean; - readonly srcElement: any; - readonly target: EventTarget; - readonly timeStamp: number; - readonly type: string; - readonly scoped: boolean; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - deepPath(): EventTarget[]; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - readonly AT_TARGET: number; - readonly BUBBLING_PHASE: number; - readonly CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface File extends Blob { - readonly lastModifiedDate: any; - readonly name: string; - readonly webkitRelativePath: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - readonly length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface IDBCursor { - readonly direction: string; - key: IDBKeyRange | IDBValidKey; - readonly primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: IDBKeyRange | IDBValidKey): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - readonly NEXT: string; - readonly NEXT_NO_DUPLICATE: string; - readonly PREV: string; - readonly PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - readonly value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabaseEventMap { - "abort": Event; - "error": ErrorEvent; -} - -interface IDBDatabase extends EventTarget { - readonly name: string; - readonly objectStoreNames: DOMStringList; - onabort: (this: IDBDatabase, ev: Event) => any; - onerror: (this: IDBDatabase, ev: ErrorEvent) => any; - version: number; - onversionchange: (ev: IDBVersionChangeEvent) => any; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - readonly name: string; - readonly objectStore: IDBObjectStore; - readonly unique: boolean; - multiEntry: boolean; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - get(key: IDBKeyRange | IDBValidKey): IDBRequest; - getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - readonly lower: any; - readonly lowerOpen: boolean; - readonly upper: any; - readonly upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(lower: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(upper: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - readonly indexNames: DOMStringList; - keyPath: string | string[]; - readonly name: string; - readonly transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; - clear(): IDBRequest; - count(key?: IDBKeyRange | IDBValidKey): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: IDBKeyRange | IDBValidKey): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; - put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; - "upgradeneeded": IDBVersionChangeEvent; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (this: IDBOpenDBRequest, ev: Event) => any; - onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; - addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequestEventMap { - "error": ErrorEvent; - "success": Event; -} - -interface IDBRequest extends EventTarget { - readonly error: DOMError; - onerror: (this: IDBRequest, ev: ErrorEvent) => any; - onsuccess: (this: IDBRequest, ev: Event) => any; - readonly readyState: string; - readonly result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - readonly transaction: IDBTransaction; - addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransactionEventMap { - "abort": Event; - "complete": Event; - "error": ErrorEvent; -} - -interface IDBTransaction extends EventTarget { - readonly db: IDBDatabase; - readonly error: DOMError; - readonly mode: string; - onabort: (this: IDBTransaction, ev: Event) => any; - oncomplete: (this: IDBTransaction, ev: Event) => any; - onerror: (this: IDBTransaction, ev: ErrorEvent) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; - addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - readonly READ_ONLY: string; - readonly READ_WRITE: string; - readonly VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - readonly newVersion: number | null; - readonly oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - readonly height: number; - readonly width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - readonly CURRENT: string; - readonly HIGH: string; - readonly IDLE: string; - readonly NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperationEventMap { - "complete": Event; - "error": ErrorEvent; -} - -interface MSAppAsyncOperation extends EventTarget { - readonly error: DOMError; - oncomplete: (this: MSAppAsyncOperation, ev: Event) => any; - onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any; - readonly readyState: number; - readonly result: any; - start(): void; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; - addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - readonly COMPLETED: number; - readonly ERROR: number; - readonly STARTED: number; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSStream { - readonly type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - readonly error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MediaQueryList { - readonly matches: boolean; - readonly media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MessageChannel { - readonly port1: MessagePort; - readonly port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - readonly data: any; - readonly origin: string; - readonly ports: any; - readonly source: any; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePortEventMap { - "message": MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (this: MessagePort, ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface Position { - readonly coords: Coordinates; - readonly timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - readonly code: number; - readonly message: string; - toString(): string; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - readonly PERMISSION_DENIED: number; - readonly POSITION_UNAVAILABLE: number; - readonly TIMEOUT: number; -} - -interface ProgressEvent extends Event { - readonly lengthComputable: boolean; - readonly loaded: number; - readonly total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface WebSocketEventMap { - "close": CloseEvent; - "error": ErrorEvent; - "message": MessageEvent; - "open": Event; -} - -interface WebSocket extends EventTarget { - binaryType: string; - readonly bufferedAmount: number; - readonly extensions: string; - onclose: (this: WebSocket, ev: CloseEvent) => any; - onerror: (this: WebSocket, ev: ErrorEvent) => any; - onmessage: (this: WebSocket, ev: MessageEvent) => any; - onopen: (this: WebSocket, ev: Event) => any; - readonly protocol: string; - readonly readyState: number; - readonly url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; - addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - readonly CLOSED: number; - readonly CLOSING: number; - readonly CONNECTING: number; - readonly OPEN: number; -} - -interface WorkerEventMap extends AbstractWorkerEventMap { - "message": MessageEvent; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (this: Worker, ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { - "readystatechange": Event; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; - readonly readyState: number; - readonly response: any; - readonly responseText: string; - responseType: string; - readonly responseXML: any; - readonly status: number; - readonly statusText: string; - timeout: number; - readonly upload: XMLHttpRequestUpload; - withCredentials: boolean; - msCaching?: string; - readonly responseURL: string; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string | null; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - readonly DONE: number; - readonly HEADERS_RECEIVED: number; - readonly LOADING: number; - readonly OPENED: number; - readonly UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface AbstractWorkerEventMap { - "error": ErrorEvent; -} - -interface AbstractWorker { - onerror: (this: AbstractWorker, ev: ErrorEvent) => any; - addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSBaseReaderEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; -} - -interface MSBaseReader { - onabort: (this: MSBaseReader, ev: Event) => any; - onerror: (this: MSBaseReader, ev: ErrorEvent) => any; - onload: (this: MSBaseReader, ev: Event) => any; - onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; - onloadstart: (this: MSBaseReader, ev: Event) => any; - onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; - readonly readyState: number; - readonly result: any; - abort(): void; - readonly DONE: number; - readonly EMPTY: number; - readonly LOADING: number; - addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface NavigatorID { - readonly appName: string; - readonly appVersion: string; - readonly platform: string; - readonly product: string; - readonly productSub: string; - readonly userAgent: string; - readonly vendor: string; - readonly vendorSub: string; -} - -interface NavigatorOnLine { - readonly onLine: boolean; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - readonly console: Console; -} - -interface XMLHttpRequestEventTargetEventMap { - "abort": Event; - "error": ErrorEvent; - "load": Event; - "loadend": ProgressEvent; - "loadstart": Event; - "progress": ProgressEvent; - "timeout": ProgressEvent; -} - -interface XMLHttpRequestEventTarget { - onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; - onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; - onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; - addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface FileReaderSync { - readAsArrayBuffer(blob: Blob): any; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): string; - readAsText(blob: Blob, encoding?: string): string; -} - -declare var FileReaderSync: { - prototype: FileReaderSync; - new(): FileReaderSync; -} - -interface WorkerGlobalScopeEventMap extends DedicatedWorkerGlobalScopeEventMap { - "error": ErrorEvent; -} - -interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { - readonly location: WorkerLocation; - onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any; - readonly self: WorkerGlobalScope; - close(): void; - msWriteProfilerMark(profilerMarkName: string): void; - toString(): string; - addEventListener(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WorkerGlobalScope: { - prototype: WorkerGlobalScope; - new(): WorkerGlobalScope; -} - -interface WorkerLocation { - readonly hash: string; - readonly host: string; - readonly hostname: string; - readonly href: string; - readonly pathname: string; - readonly port: string; - readonly protocol: string; - readonly search: string; - toString(): string; -} - -declare var WorkerLocation: { - prototype: WorkerLocation; - new(): WorkerLocation; -} - -interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine { - readonly hardwareConcurrency: number; -} - -declare var WorkerNavigator: { - prototype: WorkerNavigator; - new(): WorkerNavigator; -} - -interface DedicatedWorkerGlobalScopeEventMap { - "message": MessageEvent; -} - -interface DedicatedWorkerGlobalScope { - onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any; - postMessage(data: any): void; - addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface WorkerUtils extends Object, WindowBase64 { - readonly indexedDB: IDBFactory; - readonly msIndexedDB: IDBFactory; - readonly navigator: WorkerNavigator; - clearImmediate(handle: number): void; - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - importScripts(...urls: string[]): void; - setImmediate(handler: (...args: any[]) => void): number; - setImmediate(handler: any, ...args: any[]): number; - setInterval(handler: (...args: any[]) => void, timeout: number): number; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: (...args: any[]) => void, timeout: number): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface IDBArrayKey extends Array { -} - -interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: AlgorithmIdentifier; -} - -interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: Uint8Array; -} - -interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: AlgorithmIdentifier; -} - -interface RsaHashedImportParams { - hash: AlgorithmIdentifier; -} - -interface RsaPssParams { - saltLength: number; -} - -interface RsaOaepParams extends Algorithm { - label?: BufferSource; -} - -interface EcdsaParams extends Algorithm { - hash: AlgorithmIdentifier; -} - -interface EcKeyGenParams extends Algorithm { - namedCurve: string; -} - -interface EcKeyAlgorithm extends KeyAlgorithm { - typedCurve: string; -} - -interface EcKeyImportParams { - namedCurve: string; -} - -interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; -} - -interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; -} - -interface AesKeyGenParams extends Algorithm { - length: number; -} - -interface AesDerivedKeyParams extends Algorithm { - length: number; -} - -interface AesCbcParams extends Algorithm { - iv: BufferSource; -} - -interface AesCmacParams extends Algorithm { - length: number; -} - -interface AesGcmParams extends Algorithm { - iv: BufferSource; - additionalData?: BufferSource; - tagLength?: number; -} - -interface AesCfbParams extends Algorithm { - iv: BufferSource; -} - -interface HmacImportParams extends Algorithm { - hash?: AlgorithmIdentifier; - length?: number; -} - -interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: AlgorithmIdentifier; - length: number; -} - -interface HmacKeyGenParams extends Algorithm { - hash: AlgorithmIdentifier; - length?: number; -} - -interface DhKeyGenParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyAlgorithm extends KeyAlgorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface DhKeyDeriveParams extends Algorithm { - public: CryptoKey; -} - -interface DhImportKeyParams extends Algorithm { - prime: Uint8Array; - generator: Uint8Array; -} - -interface ConcatParams extends Algorithm { - hash?: AlgorithmIdentifier; - algorithmId: Uint8Array; - partyUInfo: Uint8Array; - partyVInfo: Uint8Array; - publicInfo?: Uint8Array; - privateInfo?: Uint8Array; -} - -interface HkdfCtrParams extends Algorithm { - hash: AlgorithmIdentifier; - label: BufferSource; - context: BufferSource; -} - -interface Pbkdf2Params extends Algorithm { - salt: BufferSource; - iterations: number; - hash: AlgorithmIdentifier; -} - -interface RsaOtherPrimesInfo { - r: string; - d: string; - t: string; -} - -interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - kid?: string; - x5u?: string; - x5c?: string; - x5t?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -declare var location: WorkerLocation; -declare var onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any; -declare var self: WorkerGlobalScope; -declare function close(): void; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function toString(): string; -declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; -declare var navigator: WorkerNavigator; -declare function clearImmediate(handle: number): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function importScripts(...urls: string[]): void; -declare function setImmediate(handler: (...args: any[]) => void): number; -declare function setImmediate(handler: any, ...args: any[]): number; -declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare var onmessage: (this: WorkerGlobalScope, ev: MessageEvent) => any; -declare function postMessage(data: any): void; -declare var console: Console; -declare function addEventListener(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -type AlgorithmIdentifier = string | Algorithm; -type IDBKeyPath = string; -type IDBValidKey = number | string | Date | IDBArrayKey; -type BufferSource = ArrayBuffer | ArrayBufferView; \ No newline at end of file +/*! ***************************************************************************** +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. +***************************************************************************** */ + + + +/// + + + +///////////////////////////// +/// IE Worker APIs +///////////////////////////// + +interface Algorithm { + name: string; +} + +interface CacheQueryOptions { + ignoreSearch?: boolean; + ignoreMethod?: boolean; + ignoreVary?: boolean; + cacheName?: string; +} + +interface CloseEventInit extends EventInit { + wasClean?: boolean; + code?: number; + reason?: string; +} + +interface EventInit { + scoped?: boolean; + bubbles?: boolean; + cancelable?: boolean; +} + +interface GetNotificationOptions { + tag?: string; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + +interface KeyAlgorithm { + name?: string; +} + +interface MessageEventInit extends EventInit { + lastEventId?: string; + channel?: string; + data?: any; + origin?: string; + source?: any; + ports?: MessagePort[]; +} + +interface NotificationOptions { + dir?: NotificationDirection; + lang?: string; + body?: string; + tag?: string; + icon?: string; +} + +interface ObjectURLOptions { + oneTimeOnly?: boolean; +} + +interface PushSubscriptionOptionsInit { + userVisibleOnly?: boolean; + applicationServerKey?: any; +} + +interface RequestInit { + method?: string; + headers?: any; + body?: any; + referrer?: string; + referrerPolicy?: ReferrerPolicy; + mode?: RequestMode; + credentials?: RequestCredentials; + cache?: RequestCache; + redirect?: RequestRedirect; + integrity?: string; + keepalive?: boolean; + window?: any; +} + +interface ResponseInit { + status?: number; + statusText?: string; + headers?: any; +} + +interface ClientQueryOptions { + includeUncontrolled?: boolean; + type?: ClientType; +} + +interface ExtendableEventInit extends EventInit { +} + +interface ExtendableMessageEventInit extends ExtendableEventInit { + data?: any; + origin?: string; + lastEventId?: string; + source?: Client | ServiceWorker | MessagePort; + ports?: MessagePort[]; +} + +interface FetchEventInit extends ExtendableEventInit { + request?: Request; + clientId?: string; + isReload?: boolean; +} + +interface NotificationEventInit extends ExtendableEventInit { + notification?: Notification; + action?: string; +} + +interface PushEventInit extends ExtendableEventInit { + data?: any; +} + +interface SyncEventInit extends ExtendableEventInit { + tag?: string; + lastChance?: boolean; +} + +interface EventListener { + (evt: Event): void; +} + +interface WebKitEntriesCallback { + (evt: Event): void; +} + +interface WebKitErrorCallback { + (evt: Event): void; +} + +interface WebKitFileCallback { + (evt: Event): void; +} + +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + +interface Blob { + readonly size: number; + readonly type: string; + msClose(): void; + msDetachStream(): any; + slice(start?: number, end?: number, contentType?: string): Blob; +} + +declare var Blob: { + prototype: Blob; + new (blobParts?: any[], options?: BlobPropertyBag): Blob; +} + +interface Cache { + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; + keys(request?: RequestInfo, options?: CacheQueryOptions): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + matchAll(request?: RequestInfo, options?: CacheQueryOptions): any; + put(request: RequestInfo, response: Response): Promise; +} + +declare var Cache: { + prototype: Cache; + new(): Cache; +} + +interface CacheStorage { + delete(cacheName: string): Promise; + has(cacheName: string): Promise; + keys(): any; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + open(cacheName: string): Promise; +} + +declare var CacheStorage: { + prototype: CacheStorage; + new(): CacheStorage; +} + +interface CloseEvent extends Event { + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; + initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(typeArg: string, eventInitDict?: CloseEventInit): CloseEvent; +} + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: any, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string): void; + groupCollapsed(groupTitle?: string): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + msIsIndependentlyComposed(element: any): boolean; + profile(reportName?: string): void; + profileEnd(): void; + select(element: any): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +} + +interface Coordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +} + +interface DOMError { + readonly name: string; + toString(): string; +} + +declare var DOMError: { + prototype: DOMError; + new(): DOMError; +} + +interface DOMException { + readonly code: number; + readonly message: string; + readonly name: string; + toString(): string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +interface DOMStringList { + readonly length: number; + contains(str: string): boolean; + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +} + +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; + initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(type: string, errorEventInitDict?: ErrorEventInit): ErrorEvent; +} + +interface Event { + readonly bubbles: boolean; + cancelBubble: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; + returnValue: boolean; + readonly srcElement: any; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; + readonly scoped: boolean; + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; + preventDefault(): void; + stopImmediatePropagation(): void; + stopPropagation(): void; + deepPath(): EventTarget[]; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +declare var Event: { + prototype: Event; + new(typeArg: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; +} + +interface EventTarget { + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +} + +interface File extends Blob { + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; +} + +interface FileList { + readonly length: number; + item(index: number): File; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +} + +interface FileReader extends EventTarget, MSBaseReader { + readonly error: DOMError; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + addEventListener(type: K, listener: (this: FileReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; +} + +interface Headers { + append(name: string, value: string): void; + delete(name: string): void; + forEach(callback: ForEachCallback): void; + get(name: string): string | null; + has(name: string): boolean; + set(name: string, value: string): void; +} + +declare var Headers: { + prototype: Headers; + new(init?: any): Headers; +} + +interface IDBCursor { + readonly direction: IDBCursorDirection; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; + source: IDBObjectStore | IDBIndex; + advance(count: number): void; + continue(key?: IDBKeyRange | IDBValidKey): void; + delete(): IDBRequest; + update(value: any): IDBRequest; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +declare var IDBCursor: { + prototype: IDBCursor; + new(): IDBCursor; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; +} + +interface IDBCursorWithValue extends IDBCursor { + readonly value: any; +} + +declare var IDBCursorWithValue: { + prototype: IDBCursorWithValue; + new(): IDBCursorWithValue; +} + +interface IDBDatabaseEventMap { + "abort": Event; + "error": Event; +} + +interface IDBDatabase extends EventTarget { + readonly name: string; + readonly objectStoreNames: DOMStringList; + onabort: (this: IDBDatabase, ev: Event) => any; + onerror: (this: IDBDatabase, ev: Event) => any; + version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; + close(): void; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; + deleteObjectStore(name: string): void; + transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBDatabase: { + prototype: IDBDatabase; + new(): IDBDatabase; +} + +interface IDBFactory { + cmp(first: any, second: any): number; + deleteDatabase(name: string): IDBOpenDBRequest; + open(name: string, version?: number): IDBOpenDBRequest; +} + +declare var IDBFactory: { + prototype: IDBFactory; + new(): IDBFactory; +} + +interface IDBIndex { + keyPath: string | string[]; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; + multiEntry: boolean; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; +} + +declare var IDBIndex: { + prototype: IDBIndex; + new(): IDBIndex; +} + +interface IDBKeyRange { + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; +} + +declare var IDBKeyRange: { + prototype: IDBKeyRange; + new(): IDBKeyRange; + bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; + only(value: any): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; +} + +interface IDBObjectStore { + readonly indexNames: DOMStringList; + keyPath: string | string[]; + readonly name: string; + readonly transaction: IDBTransaction; + autoIncrement: boolean; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; + clear(): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; + deleteIndex(indexName: string): void; + get(key: any): IDBRequest; + index(name: string): IDBIndex; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; +} + +declare var IDBObjectStore: { + prototype: IDBObjectStore; + new(): IDBObjectStore; +} + +interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { + "blocked": Event; + "upgradeneeded": IDBVersionChangeEvent; +} + +interface IDBOpenDBRequest extends IDBRequest { + onblocked: (this: IDBOpenDBRequest, ev: Event) => any; + onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any; + addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBOpenDBRequest: { + prototype: IDBOpenDBRequest; + new(): IDBOpenDBRequest; +} + +interface IDBRequestEventMap { + "error": Event; + "success": Event; +} + +interface IDBRequest extends EventTarget { + readonly error: DOMError; + onerror: (this: IDBRequest, ev: Event) => any; + onsuccess: (this: IDBRequest, ev: Event) => any; + readonly readyState: IDBRequestReadyState; + readonly result: any; + source: IDBObjectStore | IDBIndex | IDBCursor; + readonly transaction: IDBTransaction; + addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBRequest: { + prototype: IDBRequest; + new(): IDBRequest; +} + +interface IDBTransactionEventMap { + "abort": Event; + "complete": Event; + "error": Event; +} + +interface IDBTransaction extends EventTarget { + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: IDBTransactionMode; + onabort: (this: IDBTransaction, ev: Event) => any; + oncomplete: (this: IDBTransaction, ev: Event) => any; + onerror: (this: IDBTransaction, ev: Event) => any; + abort(): void; + objectStore(name: string): IDBObjectStore; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; + addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var IDBTransaction: { + prototype: IDBTransaction; + new(): IDBTransaction; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; +} + +interface IDBVersionChangeEvent extends Event { + readonly newVersion: number | null; + readonly oldVersion: number; +} + +declare var IDBVersionChangeEvent: { + prototype: IDBVersionChangeEvent; + new(): IDBVersionChangeEvent; +} + +interface ImageData { + data: Uint8ClampedArray; + readonly height: number; + readonly width: number; +} + +declare var ImageData: { + prototype: ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; +} + +interface MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; +} + +declare var MessageChannel: { + prototype: MessageChannel; + new(): MessageChannel; +} + +interface MessageEvent extends Event { + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: any; + initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; +} + +declare var MessageEvent: { + prototype: MessageEvent; + new(type: string, eventInitDict?: MessageEventInit): MessageEvent; +} + +interface MessagePortEventMap { + "message": MessageEvent; +} + +interface MessagePort extends EventTarget { + onmessage: (this: MessagePort, ev: MessageEvent) => any; + close(): void; + postMessage(message?: any, transfer?: any[]): void; + start(): void; + addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MessagePort: { + prototype: MessagePort; + new(): MessagePort; +} + +interface NotificationEventMap { + "click": Event; + "close": Event; + "error": Event; + "show": Event; +} + +interface Notification extends EventTarget { + readonly body: string; + readonly dir: NotificationDirection; + readonly icon: string; + readonly lang: string; + onclick: (this: Notification, ev: Event) => any; + onclose: (this: Notification, ev: Event) => any; + onerror: (this: Notification, ev: Event) => any; + onshow: (this: Notification, ev: Event) => any; + readonly permission: NotificationPermission; + readonly tag: string; + readonly title: string; + close(): void; + addEventListener(type: K, listener: (this: Notification, ev: NotificationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Notification: { + prototype: Notification; + new(title: string, options?: NotificationOptions): Notification; + requestPermission(callback?: NotificationPermissionCallback): Promise; +} + +interface Performance { + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; + clearMarks(markName?: string): void; + clearMeasures(measureName?: string): void; + clearResourceTimings(): void; + getEntries(): any; + getEntriesByName(name: string, entryType?: string): any; + getEntriesByType(entryType: string): any; + getMarks(markName?: string): any; + getMeasures(measureName?: string): any; + mark(markName: string): void; + measure(measureName: string, startMarkName?: string, endMarkName?: string): void; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + toJSON(): any; +} + +declare var Performance: { + prototype: Performance; + new(): Performance; +} + +interface PerformanceNavigation { + readonly redirectCount: number; + readonly type: number; + toJSON(): any; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +declare var PerformanceNavigation: { + prototype: PerformanceNavigation; + new(): PerformanceNavigation; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; +} + +interface PerformanceTiming { + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; + readonly secureConnectionStart: number; + toJSON(): any; +} + +declare var PerformanceTiming: { + prototype: PerformanceTiming; + new(): PerformanceTiming; +} + +interface Position { + readonly coords: Coordinates; + readonly timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + readonly code: number; + readonly message: string; + toString(): string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +interface ProgressEvent extends Event { + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; + initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; +} + +declare var ProgressEvent: { + prototype: ProgressEvent; + new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; +} + +interface PushManager { + getSubscription(): Promise; + permissionState(options?: PushSubscriptionOptionsInit): Promise; + subscribe(options?: PushSubscriptionOptionsInit): Promise; +} + +declare var PushManager: { + prototype: PushManager; + new(): PushManager; +} + +interface PushSubscription { + readonly endpoint: USVString; + readonly options: PushSubscriptionOptions; + getKey(name: PushEncryptionKeyName): ArrayBuffer | null; + toJSON(): any; + unsubscribe(): Promise; +} + +declare var PushSubscription: { + prototype: PushSubscription; + new(): PushSubscription; +} + +interface PushSubscriptionOptions { + readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; +} + +declare var PushSubscriptionOptions: { + prototype: PushSubscriptionOptions; + new(): PushSubscriptionOptions; +} + +interface ReadableStream { + readonly locked: boolean; + cancel(): Promise; + getReader(): ReadableStreamReader; +} + +declare var ReadableStream: { + prototype: ReadableStream; + new(): ReadableStream; +} + +interface ReadableStreamReader { + cancel(): Promise; + read(): Promise; + releaseLock(): void; +} + +declare var ReadableStreamReader: { + prototype: ReadableStreamReader; + new(): ReadableStreamReader; +} + +interface Request extends Object, Body { + readonly cache: RequestCache; + readonly credentials: RequestCredentials; + readonly destination: RequestDestination; + readonly headers: Headers; + readonly integrity: string; + readonly keepalive: boolean; + readonly method: string; + readonly mode: RequestMode; + readonly redirect: RequestRedirect; + readonly referrer: string; + readonly referrerPolicy: ReferrerPolicy; + readonly type: RequestType; + readonly url: string; + clone(): Request; +} + +declare var Request: { + prototype: Request; + new(input: Request | string, init?: RequestInit): Request; +} + +interface Response extends Object, Body { + readonly body: ReadableStream | null; + readonly headers: Headers; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly type: ResponseType; + readonly url: string; + clone(): Response; +} + +declare var Response: { + prototype: Response; + new(body?: any, init?: ResponseInit): Response; +} + +interface ServiceWorkerEventMap extends AbstractWorkerEventMap { + "statechange": Event; +} + +interface ServiceWorker extends EventTarget, AbstractWorker { + onstatechange: (this: ServiceWorker, ev: Event) => any; + readonly scriptURL: USVString; + readonly state: ServiceWorkerState; + postMessage(message: any, transfer?: any[]): void; + addEventListener(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorker: { + prototype: ServiceWorker; + new(): ServiceWorker; +} + +interface ServiceWorkerRegistrationEventMap { + "updatefound": Event; +} + +interface ServiceWorkerRegistration extends EventTarget { + readonly active: ServiceWorker | null; + readonly installing: ServiceWorker | null; + onupdatefound: (this: ServiceWorkerRegistration, ev: Event) => any; + readonly pushManager: PushManager; + readonly scope: USVString; + readonly sync: SyncManager; + readonly waiting: ServiceWorker | null; + getNotifications(filter?: GetNotificationOptions): any; + showNotification(title: string, options?: NotificationOptions): Promise; + unregister(): Promise; + update(): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerRegistration: { + prototype: ServiceWorkerRegistration; + new(): ServiceWorkerRegistration; +} + +interface SyncManager { + getTags(): any; + register(tag: string): Promise; +} + +declare var SyncManager: { + prototype: SyncManager; + new(): SyncManager; +} + +interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + readonly searchParams: URLSearchParams; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; + createObjectURL(object: any, options?: ObjectURLOptions): string; + revokeObjectURL(url: string): void; +} + +interface WebSocketEventMap { + "close": CloseEvent; + "error": Event; + "message": MessageEvent; + "open": Event; +} + +interface WebSocket extends EventTarget { + binaryType: string; + readonly bufferedAmount: number; + readonly extensions: string; + onclose: (this: WebSocket, ev: CloseEvent) => any; + onerror: (this: WebSocket, ev: Event) => any; + onmessage: (this: WebSocket, ev: MessageEvent) => any; + onopen: (this: WebSocket, ev: Event) => any; + readonly protocol: string; + readonly readyState: number; + readonly url: string; + close(code?: number, reason?: string): void; + send(data: any): void; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WebSocket: { + prototype: WebSocket; + new(url: string, protocols?: string | string[]): WebSocket; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; +} + +interface WorkerEventMap extends AbstractWorkerEventMap { + "message": MessageEvent; +} + +interface Worker extends EventTarget, AbstractWorker { + onmessage: (this: Worker, ev: MessageEvent) => any; + postMessage(message: any, transfer?: any[]): void; + terminate(): void; + addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Worker: { + prototype: Worker; + new(stringUrl: string): Worker; +} + +interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { + "readystatechange": Event; +} + +interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { + onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; + readonly readyState: number; + readonly response: any; + readonly responseText: string; + responseType: XMLHttpRequestResponseType; + readonly responseURL: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; + timeout: number; + readonly upload: XMLHttpRequestUpload; + withCredentials: boolean; + msCaching?: string; + abort(): void; + getAllResponseHeaders(): string; + getResponseHeader(header: string): string | null; + msCachingEnabled(): boolean; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + overrideMimeType(mime: string): void; + send(data?: string): void; + send(data?: any): void; + setRequestHeader(header: string, value: string): void; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; + addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequest: { + prototype: XMLHttpRequest; + new(): XMLHttpRequest; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; +} + +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + +interface AbstractWorker { + onerror: (this: AbstractWorker, ev: ErrorEvent) => any; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface Body { + readonly bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; +} + +interface GlobalFetch { + fetch(input: RequestInfo, init?: RequestInit): Promise; +} + +interface MSBaseReaderEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; +} + +interface MSBaseReader { + onabort: (this: MSBaseReader, ev: Event) => any; + onerror: (this: MSBaseReader, ev: ErrorEvent) => any; + onload: (this: MSBaseReader, ev: Event) => any; + onloadend: (this: MSBaseReader, ev: ProgressEvent) => any; + onloadstart: (this: MSBaseReader, ev: Event) => any; + onprogress: (this: MSBaseReader, ev: ProgressEvent) => any; + readonly readyState: number; + readonly result: any; + abort(): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; + addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface NavigatorBeacon { + sendBeacon(url: USVString, data?: BodyInit): boolean; +} + +interface NavigatorConcurrentHardware { + readonly hardwareConcurrency: number; +} + +interface NavigatorID { + readonly appCodeName: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; +} + +interface NavigatorOnLine { + readonly onLine: boolean; +} + +interface WindowBase64 { + atob(encodedString: string): string; + btoa(rawString: string): string; +} + +interface WindowConsole { + readonly console: Console; +} + +interface XMLHttpRequestEventTargetEventMap { + "abort": Event; + "error": ErrorEvent; + "load": Event; + "loadend": ProgressEvent; + "loadstart": Event; + "progress": ProgressEvent; + "timeout": ProgressEvent; +} + +interface XMLHttpRequestEventTarget { + onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; + onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; + onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; + addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +interface Client { + readonly frameType: FrameType; + readonly id: string; + readonly url: USVString; + postMessage(message: any, transfer?: any[]): void; +} + +declare var Client: { + prototype: Client; + new(): Client; +} + +interface Clients { + claim(): Promise; + get(id: string): Promise; + matchAll(options?: ClientQueryOptions): any; + openWindow(url: USVString): Promise; +} + +declare var Clients: { + prototype: Clients; + new(): Clients; +} + +interface DedicatedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap { + "message": MessageEvent; +} + +interface DedicatedWorkerGlobalScope extends WorkerGlobalScope { + onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any; + close(): void; + postMessage(message: any, transfer?: any[]): void; + addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var DedicatedWorkerGlobalScope: { + prototype: DedicatedWorkerGlobalScope; + new(): DedicatedWorkerGlobalScope; +} + +interface ExtendableEvent extends Event { + waitUntil(f: Promise): void; +} + +declare var ExtendableEvent: { + prototype: ExtendableEvent; + new(type: string, eventInitDict?: ExtendableEventInit): ExtendableEvent; +} + +interface ExtendableMessageEvent extends ExtendableEvent { + readonly data: any; + readonly lastEventId: string; + readonly origin: string; + readonly ports: MessagePort[] | null; + readonly source: Client | ServiceWorker | MessagePort | null; +} + +declare var ExtendableMessageEvent: { + prototype: ExtendableMessageEvent; + new(type: string, eventInitDict?: ExtendableMessageEventInit): ExtendableMessageEvent; +} + +interface FetchEvent extends ExtendableEvent { + readonly clientId: string | null; + readonly isReload: boolean; + readonly request: Request; + respondWith(r: Promise): void; +} + +declare var FetchEvent: { + prototype: FetchEvent; + new(type: string, eventInitDict: FetchEventInit): FetchEvent; +} + +interface FileReaderSync { + readAsArrayBuffer(blob: Blob): any; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): string; + readAsText(blob: Blob, encoding?: string): string; +} + +declare var FileReaderSync: { + prototype: FileReaderSync; + new(): FileReaderSync; +} + +interface NotificationEvent extends ExtendableEvent { + readonly action: string; + readonly notification: Notification; +} + +declare var NotificationEvent: { + prototype: NotificationEvent; + new(type: string, eventInitDict: NotificationEventInit): NotificationEvent; +} + +interface PushEvent extends ExtendableEvent { + readonly data: PushMessageData | null; +} + +declare var PushEvent: { + prototype: PushEvent; + new(type: string, eventInitDict?: PushEventInit): PushEvent; +} + +interface PushMessageData { + arrayBuffer(): ArrayBuffer; + blob(): Blob; + json(): JSON; + text(): USVString; +} + +declare var PushMessageData: { + prototype: PushMessageData; + new(): PushMessageData; +} + +interface ServiceWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap { + "activate": ExtendableEvent; + "fetch": FetchEvent; + "install": ExtendableEvent; + "message": ExtendableMessageEvent; + "notificationclick": NotificationEvent; + "notificationclose": NotificationEvent; + "push": PushEvent; + "pushsubscriptionchange": ExtendableEvent; + "sync": SyncEvent; +} + +interface ServiceWorkerGlobalScope extends WorkerGlobalScope { + readonly clients: Clients; + onactivate: (this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any; + onfetch: (this: ServiceWorkerGlobalScope, ev: FetchEvent) => any; + oninstall: (this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any; + onmessage: (this: ServiceWorkerGlobalScope, ev: ExtendableMessageEvent) => any; + onnotificationclick: (this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any; + onnotificationclose: (this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any; + onpush: (this: ServiceWorkerGlobalScope, ev: PushEvent) => any; + onpushsubscriptionchange: (this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any; + onsync: (this: ServiceWorkerGlobalScope, ev: SyncEvent) => any; + readonly registration: ServiceWorkerRegistration; + skipWaiting(): Promise; + addEventListener(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var ServiceWorkerGlobalScope: { + prototype: ServiceWorkerGlobalScope; + new(): ServiceWorkerGlobalScope; +} + +interface SyncEvent extends ExtendableEvent { + readonly lastChance: boolean; + readonly tag: string; +} + +declare var SyncEvent: { + prototype: SyncEvent; + new(type: string, init: SyncEventInit): SyncEvent; +} + +interface WindowClient extends Client { + readonly focused: boolean; + readonly visibilityState: VisibilityState; + focus(): Promise; + navigate(url: USVString): Promise; +} + +declare var WindowClient: { + prototype: WindowClient; + new(): WindowClient; +} + +interface WorkerGlobalScopeEventMap { + "error": ErrorEvent; +} + +interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, GlobalFetch { + readonly caches: CacheStorage; + readonly isSecureContext: boolean; + readonly location: WorkerLocation; + onerror: (this: WorkerGlobalScope, ev: ErrorEvent) => any; + readonly performance: Performance; + readonly self: WorkerGlobalScope; + msWriteProfilerMark(profilerMarkName: string): void; + createImageBitmap(image: ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; + addEventListener(type: K, listener: (this: WorkerGlobalScope, ev: WorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var WorkerGlobalScope: { + prototype: WorkerGlobalScope; + new(): WorkerGlobalScope; +} + +interface WorkerLocation { + readonly hash: string; + readonly host: string; + readonly hostname: string; + readonly href: string; + readonly origin: string; + readonly pathname: string; + readonly port: string; + readonly protocol: string; + readonly search: string; + toString(): string; +} + +declare var WorkerLocation: { + prototype: WorkerLocation; + new(): WorkerLocation; +} + +interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine, NavigatorBeacon, NavigatorConcurrentHardware { + readonly hardwareConcurrency: number; +} + +declare var WorkerNavigator: { + prototype: WorkerNavigator; + new(): WorkerNavigator; +} + +interface WorkerUtils extends Object, WindowBase64 { + readonly indexedDB: IDBFactory; + readonly msIndexedDB: IDBFactory; + readonly navigator: WorkerNavigator; + clearImmediate(handle: number): void; + clearInterval(handle: number): void; + clearTimeout(handle: number): void; + importScripts(...urls: string[]): void; + setImmediate(handler: (...args: any[]) => void): number; + setImmediate(handler: any, ...args: any[]): number; + setInterval(handler: (...args: any[]) => void, timeout: number): number; + setInterval(handler: any, timeout?: any, ...args: any[]): number; + setTimeout(handler: (...args: any[]) => void, timeout: number): number; + setTimeout(handler: any, timeout?: any, ...args: any[]): number; +} + +interface ErrorEventInit { + message?: string; + filename?: string; + lineno?: number; + conlno?: number; + error?: any; +} + +interface ImageBitmapOptions { + imageOrientation?: "none" | "flipY"; + premultiplyAlpha?: "none" | "premultiply" | "default"; + colorSpaceConversion?: "none" | "default"; + resizeWidth?: number; + resizeHeight?: number; + resizeQuality?: "pixelated" | "low" | "medium" | "high"; +} + +interface ImageBitmap { + readonly width: number; + readonly height: number; + close(): void; +} + +interface URLSearchParams { + /** + * Appends a specified key/value pair as a new search parameter. + */ + append(name: string, value: string): void; + /** + * Deletes the given search parameter, and its associated value, from the list of all search parameters. + */ + delete(name: string): void; + /** + * Returns the first value associated to the given search parameter. + */ + get(name: string): string | null; + /** + * Returns all the values association with a given search parameter. + */ + getAll(name: string): string[]; + /** + * Returns a Boolean indicating if such a search parameter exists. + */ + has(name: string): boolean; + /** + * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. + */ + set(name: string, value: string): void; +} + +declare var URLSearchParams: { + prototype: URLSearchParams; + /** + * Constructor returning a URLSearchParams object. + */ + new (init?: string | URLSearchParams): URLSearchParams; +} + +interface BlobPropertyBag { + type?: string; + endings?: string; +} + +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + +interface EventListenerObject { + handleEvent(evt: Event): void; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface IDBArrayKey extends Array { +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: AlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: Uint8Array; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: AlgorithmIdentifier; +} + +interface RsaHashedImportParams { + hash: AlgorithmIdentifier; +} + +interface RsaPssParams { + saltLength: number; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface EcdsaParams extends Algorithm { + hash: AlgorithmIdentifier; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: string; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + typedCurve: string; +} + +interface EcKeyImportParams { + namedCurve: string; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCmacParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + iv: BufferSource; + additionalData?: BufferSource; + tagLength?: number; +} + +interface AesCfbParams extends Algorithm { + iv: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash?: AlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: AlgorithmIdentifier; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: AlgorithmIdentifier; + length?: number; +} + +interface DhKeyGenParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyAlgorithm extends KeyAlgorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface DhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface DhImportKeyParams extends Algorithm { + prime: Uint8Array; + generator: Uint8Array; +} + +interface ConcatParams extends Algorithm { + hash?: AlgorithmIdentifier; + algorithmId: Uint8Array; + partyUInfo: Uint8Array; + partyVInfo: Uint8Array; + publicInfo?: Uint8Array; + privateInfo?: Uint8Array; +} + +interface HkdfCtrParams extends Algorithm { + hash: AlgorithmIdentifier; + label: BufferSource; + context: BufferSource; +} + +interface Pbkdf2Params extends Algorithm { + salt: BufferSource; + iterations: number; + hash: AlgorithmIdentifier; +} + +interface RsaOtherPrimesInfo { + r: string; + d: string; + t: string; +} + +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + kid?: string; + x5u?: string; + x5c?: string; + x5t?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} + +interface EventListenerOptions { + capture?: boolean; +} + +interface AddEventListenerOptions extends EventListenerOptions { + passive?: boolean; + once?: boolean; +} + +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + +interface ErrorEventHandler { + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; +} +interface PositionCallback { + (position: Position): void; +} +interface PositionErrorCallback { + (error: PositionError): void; +} +interface DecodeSuccessCallback { + (decodedData: AudioBuffer): void; +} +interface DecodeErrorCallback { + (error: DOMException): void; +} +interface FunctionStringCallback { + (data: string): void; +} +interface ForEachCallback { + (keyId: any, status: MediaKeyStatus): void; +} +interface NotificationPermissionCallback { + (permission: NotificationPermission): void; +} +declare var onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any; +declare function close(): void; +declare function postMessage(message: any, transfer?: any[]): void; +declare var caches: CacheStorage; +declare var isSecureContext: boolean; +declare var location: WorkerLocation; +declare var onerror: (this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any; +declare var performance: Performance; +declare var self: WorkerGlobalScope; +declare function msWriteProfilerMark(profilerMarkName: string): void; +declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: ImageBitmap | ImageData | Blob, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; +declare function dispatchEvent(evt: Event): boolean; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +declare var indexedDB: IDBFactory; +declare var msIndexedDB: IDBFactory; +declare var navigator: WorkerNavigator; +declare function clearImmediate(handle: number): void; +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function importScripts(...urls: string[]): void; +declare function setImmediate(handler: (...args: any[]) => void): number; +declare function setImmediate(handler: any, ...args: any[]): number; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; +declare var console: Console; +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; +declare function dispatchEvent(evt: Event): boolean; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +declare function addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AlgorithmIdentifier = string | Algorithm; +type BodyInit = any; +type IDBKeyPath = string; +type RequestInfo = Request | string; +type USVString = string; +type IDBValidKey = number | string | Date | IDBArrayKey; +type BufferSource = ArrayBuffer | ArrayBufferView; +type FormDataEntryValue = string | File; +type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; +type IDBRequestReadyState = "pending" | "done"; +type IDBTransactionMode = "readonly" | "readwrite" | "versionchange"; +type MediaKeyStatus = "usable" | "expired" | "output-downscaled" | "output-not-allowed" | "status-pending" | "internal-error"; +type NotificationDirection = "auto" | "ltr" | "rtl"; +type NotificationPermission = "default" | "denied" | "granted"; +type PushEncryptionKeyName = "p256dh" | "auth"; +type PushPermissionState = "granted" | "denied" | "prompt"; +type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url"; +type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache"; +type RequestCredentials = "omit" | "same-origin" | "include"; +type RequestDestination = "" | "document" | "sharedworker" | "subresource" | "unknown" | "worker"; +type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; +type RequestRedirect = "follow" | "error" | "manual"; +type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video"; +type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; +type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant"; +type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded"; +type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text"; +type ClientType = "window" | "worker" | "sharedworker" | "all"; +type FrameType = "auxiliary" | "top-level" | "nested" | "none"; \ No newline at end of file diff --git a/node_modules/typescript/lib/protocol.d.ts b/node_modules/typescript/lib/protocol.d.ts index c2577c247..0afebe0bc 100644 --- a/node_modules/typescript/lib/protocol.d.ts +++ b/node_modules/typescript/lib/protocol.d.ts @@ -1,6 +1,6 @@ /** - * Declaration module describing the TypeScript Server protocol - */ + * Declaration module describing the TypeScript Server protocol + */ declare namespace ts.server.protocol { namespace CommandTypes { type Brace = "brace"; @@ -49,82 +49,82 @@ declare namespace ts.server.protocol { type GetSupportedCodeFixes = "getSupportedCodeFixes"; } /** - * A TypeScript Server message - */ + * A TypeScript Server message + */ interface Message { /** - * Sequence number of the message - */ + * Sequence number of the message + */ seq: number; /** - * One of "request", "response", or "event" - */ + * One of "request", "response", or "event" + */ type: "request" | "response" | "event"; } /** - * Client-initiated request message - */ + * Client-initiated request message + */ interface Request extends Message { /** - * The command to execute - */ + * The command to execute + */ command: string; /** - * Object containing arguments for the command - */ + * Object containing arguments for the command + */ arguments?: any; } /** - * Request to reload the project structure for all the opened files - */ + * Request to reload the project structure for all the opened files + */ interface ReloadProjectsRequest extends Message { command: CommandTypes.ReloadProjects; } /** - * Server-initiated event message - */ + * Server-initiated event message + */ interface Event extends Message { /** - * Name of event - */ + * Name of event + */ event: string; /** - * Event-specific information - */ + * Event-specific information + */ body?: any; } /** - * Response by server to client request message. - */ + * Response by server to client request message. + */ interface Response extends Message { /** - * Sequence number of the request message. - */ + * Sequence number of the request message. + */ request_seq: number; /** - * Outcome of the request. - */ + * Outcome of the request. + */ success: boolean; /** - * The command requested. - */ + * The command requested. + */ command: string; /** - * Contains error message if success === false. - */ + * Contains error message if success === false. + */ message?: string; /** - * Contains message body if success === true. - */ + * Contains message body if success === true. + */ body?: any; } /** - * Arguments for FileRequest messages. - */ + * Arguments for FileRequest messages. + */ interface FileRequestArgs { /** - * The file for the request (absolute pathname required). - */ + * The file for the request (absolute pathname required). + */ file: string; projectFileName?: string; } @@ -199,17 +199,17 @@ declare namespace ts.server.protocol { options?: EditorSettings; } /** - * Arguments for ProjectInfoRequest request. - */ + * Arguments for ProjectInfoRequest request. + */ interface ProjectInfoRequestArgs extends FileRequestArgs { /** - * Indicate if the file name list of the project is needed - */ + * Indicate if the file name list of the project is needed + */ needFileNameList: boolean; } /** - * A request to get the project information of the current file. - */ + * A request to get the project information of the current file. + */ interface ProjectInfoRequest extends Request { command: CommandTypes.ProjectInfo; arguments: ProjectInfoRequestArgs; @@ -230,21 +230,21 @@ declare namespace ts.server.protocol { projectFileName: string; } /** - * Response message body for "projectInfo" request - */ + * Response message body for "projectInfo" request + */ interface ProjectInfo { /** - * For configured project, this is the normalized path of the 'tsconfig.json' file - * For inferred project, this is undefined - */ + * For configured project, this is the normalized path of the 'tsconfig.json' file + * For inferred project, this is undefined + */ configFileName: string; /** - * The list of normalized file name in the project, including 'lib.d.ts' - */ + * The list of normalized file name in the project, including 'lib.d.ts' + */ fileNames?: string[]; /** - * Indicates if the project has a active language service instance - */ + * Indicates if the project has a active language service instance + */ languageServiceDisabled?: boolean; } /** @@ -262,61 +262,61 @@ declare namespace ts.server.protocol { code: number; } /** - * Response message for "projectInfo" request - */ + * Response message for "projectInfo" request + */ interface ProjectInfoResponse extends Response { body?: ProjectInfo; } /** - * Request whose sole parameter is a file name. - */ + * Request whose sole parameter is a file name. + */ interface FileRequest extends Request { arguments: FileRequestArgs; } /** - * Instances of this interface specify a location in a source file: - * (file, line, character offset), where line and character offset are 1-based. - */ + * Instances of this interface specify a location in a source file: + * (file, line, character offset), where line and character offset are 1-based. + */ interface FileLocationRequestArgs extends FileRequestArgs { /** - * The line number for the request (1-based). - */ + * The line number for the request (1-based). + */ line: number; /** - * The character offset (on the line) for the request (1-based). - */ + * The character offset (on the line) for the request (1-based). + */ offset: number; } /** - * Request for the available codefixes at a specific position. - */ + * Request for the available codefixes at a specific position. + */ interface CodeFixRequest extends Request { command: CommandTypes.GetCodeFixes; arguments: CodeFixRequestArgs; } /** - * Instances of this interface specify errorcodes on a specific location in a sourcefile. - */ + * Instances of this interface specify errorcodes on a specific location in a sourcefile. + */ interface CodeFixRequestArgs extends FileRequestArgs { /** - * The line number for the request (1-based). - */ + * The line number for the request (1-based). + */ startLine: number; /** - * The character offset (on the line) for the request (1-based). - */ + * The character offset (on the line) for the request (1-based). + */ startOffset: number; /** - * The line number for the request (1-based). - */ + * The line number for the request (1-based). + */ endLine: number; /** - * The character offset (on the line) for the request (1-based). - */ + * The character offset (on the line) for the request (1-based). + */ endOffset: number; /** - * Errorcodes we want to get the fixes for. - */ + * Errorcodes we want to get the fixes for. + */ errorCodes?: number[]; } /** @@ -326,8 +326,8 @@ declare namespace ts.server.protocol { body?: CodeAction[]; } /** - * A request whose arguments specify a file location (file, line, col). - */ + * A request whose arguments specify a file location (file, line, col). + */ interface FileLocationRequest extends FileRequest { arguments: FileLocationRequestArgs; } @@ -360,9 +360,9 @@ declare namespace ts.server.protocol { length: number; } /** - * Arguments in document highlight request; include: filesToSearch, file, - * line, offset. - */ + * Arguments in document highlight request; include: filesToSearch, file, + * line, offset. + */ interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { /** * List of files to search for document highlights. @@ -370,73 +370,73 @@ declare namespace ts.server.protocol { filesToSearch: string[]; } /** - * Go to definition request; value of command field is - * "definition". Return response giving the file locations that - * define the symbol found in file at location line, col. - */ + * Go to definition request; value of command field is + * "definition". Return response giving the file locations that + * define the symbol found in file at location line, col. + */ interface DefinitionRequest extends FileLocationRequest { command: CommandTypes.Definition; } /** - * Go to type request; value of command field is - * "typeDefinition". Return response giving the file locations that - * define the type for the symbol found in file at location line, col. - */ + * Go to type request; value of command field is + * "typeDefinition". Return response giving the file locations that + * define the type for the symbol found in file at location line, col. + */ interface TypeDefinitionRequest extends FileLocationRequest { command: CommandTypes.TypeDefinition; } /** - * Go to implementation request; value of command field is - * "implementation". Return response giving the file locations that - * implement the symbol found in file at location line, col. - */ + * Go to implementation request; value of command field is + * "implementation". Return response giving the file locations that + * implement the symbol found in file at location line, col. + */ interface ImplementationRequest extends FileLocationRequest { command: CommandTypes.Implementation; } /** - * Location in source code expressed as (one-based) line and character offset. - */ + * Location in source code expressed as (one-based) line and character offset. + */ interface Location { line: number; offset: number; } /** - * Object found in response messages defining a span of text in source code. - */ + * Object found in response messages defining a span of text in source code. + */ interface TextSpan { /** - * First character of the definition. - */ + * First character of the definition. + */ start: Location; /** - * One character past last character of the definition. - */ + * One character past last character of the definition. + */ end: Location; } /** - * Object found in response messages defining a span of text in a specific source file. - */ + * Object found in response messages defining a span of text in a specific source file. + */ interface FileSpan extends TextSpan { /** - * File containing text span. - */ + * File containing text span. + */ file: string; } /** - * Definition response message. Gives text range for definition. - */ + * Definition response message. Gives text range for definition. + */ interface DefinitionResponse extends Response { body?: FileSpan[]; } /** - * Definition response message. Gives text range for definition. - */ + * Definition response message. Gives text range for definition. + */ interface TypeDefinitionResponse extends Response { body?: FileSpan[]; } /** - * Implementation response message. Gives text range for implementations. - */ + * Implementation response message. Gives text range for implementations. + */ interface ImplementationResponse extends Response { body?: FileSpan[]; } @@ -457,27 +457,31 @@ declare namespace ts.server.protocol { openingBrace: string; } /** - * Get occurrences request; value of command field is - * "occurrences". Return response giving spans that are relevant - * in the file at a given line and column. - */ + * Get occurrences request; value of command field is + * "occurrences". Return response giving spans that are relevant + * in the file at a given line and column. + */ interface OccurrencesRequest extends FileLocationRequest { command: CommandTypes.Occurrences; } interface OccurrencesResponseItem extends FileSpan { /** - * True if the occurrence is a write location, false otherwise. - */ + * True if the occurrence is a write location, false otherwise. + */ isWriteAccess: boolean; + /** + * True if the occurrence is in a string, undefined otherwise; + */ + isInString?: true; } interface OccurrencesResponse extends Response { body?: OccurrencesResponseItem[]; } /** - * Get document highlights request; value of command field is - * "documentHighlights". Return response giving spans that are relevant - * in the file at a given line and column. - */ + * Get document highlights request; value of command field is + * "documentHighlights". Return response giving spans that are relevant + * in the file at a given line and column. + */ interface DocumentHighlightsRequest extends FileLocationRequest { command: CommandTypes.DocumentHighlights; arguments: DocumentHighlightsRequestArgs; @@ -494,12 +498,12 @@ declare namespace ts.server.protocol { */ interface DocumentHighlightsItem { /** - * File containing highlight spans. - */ + * File containing highlight spans. + */ file: string; /** - * Spans to highlight in file. - */ + * Spans to highlight in file. + */ highlightSpans: HighlightSpan[]; } /** @@ -509,23 +513,23 @@ declare namespace ts.server.protocol { body?: DocumentHighlightsItem[]; } /** - * Find references request; value of command field is - * "references". Return response giving the file locations that - * reference the symbol found in file at location line, col. - */ + * Find references request; value of command field is + * "references". Return response giving the file locations that + * reference the symbol found in file at location line, col. + */ interface ReferencesRequest extends FileLocationRequest { command: CommandTypes.References; } interface ReferencesResponseItem extends FileSpan { /** Text of line containing the reference. Including this - * with the response avoids latency of editor loading files - * to show text of reference line (the server already has - * loaded the referencing files). - */ + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has + * loaded the referencing files). + */ lineText: string; /** - * True if reference is a write location, false otherwise. - */ + * True if reference is a write location, false otherwise. + */ isWriteAccess: boolean; /** * True if reference is a definition, false otherwise. @@ -533,29 +537,29 @@ declare namespace ts.server.protocol { isDefinition: boolean; } /** - * The body of a "references" response message. - */ + * The body of a "references" response message. + */ interface ReferencesResponseBody { /** - * The file locations referencing the symbol. - */ + * The file locations referencing the symbol. + */ refs: ReferencesResponseItem[]; /** - * The name of the symbol. - */ + * The name of the symbol. + */ symbolName: string; /** - * The start character offset of the symbol (on the line provided by the references request). - */ + * The start character offset of the symbol (on the line provided by the references request). + */ symbolStartOffset: number; /** - * The full display name of the symbol. - */ + * The full display name of the symbol. + */ symbolDisplayString: string; } /** - * Response to "references" request. - */ + * Response to "references" request. + */ interface ReferencesResponse extends Response { body?: ReferencesResponseBody; } @@ -573,42 +577,42 @@ declare namespace ts.server.protocol { findInStrings?: boolean; } /** - * Rename request; value of command field is "rename". Return - * response giving the file locations that reference the symbol - * found in file at location line, col. Also return full display - * name of the symbol so that client can print it unambiguously. - */ + * Rename request; value of command field is "rename". Return + * response giving the file locations that reference the symbol + * found in file at location line, col. Also return full display + * name of the symbol so that client can print it unambiguously. + */ interface RenameRequest extends FileLocationRequest { command: CommandTypes.Rename; arguments: RenameRequestArgs; } /** - * Information about the item to be renamed. - */ + * Information about the item to be renamed. + */ interface RenameInfo { /** - * True if item can be renamed. - */ + * True if item can be renamed. + */ canRename: boolean; /** - * Error message if item can not be renamed. - */ + * Error message if item can not be renamed. + */ localizedErrorMessage?: string; /** - * Display name of the item to be renamed. - */ + * Display name of the item to be renamed. + */ displayName: string; /** - * Full display name of item to be renamed. - */ + * Full display name of item to be renamed. + */ fullDisplayName: string; /** - * The items's kind (such as 'className' or 'parameterName' or plain 'text'). - */ + * The items's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; } /** @@ -631,8 +635,8 @@ declare namespace ts.server.protocol { locs: SpanGroup[]; } /** - * Rename response message. - */ + * Rename response message. + */ interface RenameResponse extends Response { body?: RenameResponseBody; } @@ -640,7 +644,7 @@ declare namespace ts.server.protocol { * Represents a file in external project. * External project is project whose set of files, compilation options and open\close state * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio). - * External project will exist even if all files in it are closed and should be closed explicity. + * External project will exist even if all files in it are closed and should be closed explicitly. * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will * create configured project for every config file but will maintain a link that these projects were created * as a result of opening external project so they should be removed once external project is closed. @@ -711,42 +715,50 @@ declare namespace ts.server.protocol { * List of removed files */ removed: string[]; + /** + * List of updated files + */ + updated: string[]; } /** - * Information found in a configure request. - */ + * Information found in a configure request. + */ interface ConfigureRequestArguments { /** - * Information about the host, for example 'Emacs 24.4' or - * 'Sublime Text version 3075' - */ + * Information about the host, for example 'Emacs 24.4' or + * 'Sublime Text version 3075' + */ hostInfo?: string; /** - * If present, tab settings apply only to this file. - */ + * If present, tab settings apply only to this file. + */ file?: string; /** * The format options to use during formatting and other code editing features. */ formatOptions?: FormatCodeSettings; + /** + * The host's additional supported .js file extensions + */ + extraFileExtensions?: JsFileExtensionInfo[]; } /** - * Configure request; value of command field is "configure". Specifies - * host information, such as host type, tab size, and indent size. - */ + * Configure request; value of command field is "configure". Specifies + * host information, such as host type, tab size, and indent size. + */ interface ConfigureRequest extends Request { command: CommandTypes.Configure; arguments: ConfigureRequestArguments; } /** - * Response to "configure" request. This is just an acknowledgement, so - * no body field is required. - */ + * Response to "configure" request. This is just an acknowledgement, so + * no body field is required. + */ interface ConfigureResponse extends Response { } /** - * Information found in an "open" request. - */ + * Information found in an "open" request. + */ interface OpenRequestArgs extends FileRequestArgs { /** * Used when a version of the file content is known to be more up to date than the one on disk. @@ -761,13 +773,13 @@ declare namespace ts.server.protocol { } type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; /** - * Open request; value of command field is "open". Notify the - * server that the client has file open. The server will not - * monitor the filesystem for changes in this file and will assume - * that the client is updating the server (using the change and/or - * reload messages) when the file changes. Server does not currently - * send a response to an open request. - */ + * Open request; value of command field is "open". Notify the + * server that the client has file open. The server will not + * monitor the filesystem for changes in this file and will assume + * that the client is updating the server (using the change and/or + * reload messages) when the file changes. Server does not currently + * send a response to an open request. + */ interface OpenRequest extends Request { command: CommandTypes.Open; arguments: OpenRequestArgs; @@ -856,25 +868,25 @@ declare namespace ts.server.protocol { options: ExternalProjectCompilerOptions; } /** - * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so - * no body field is required. - */ + * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so + * no body field is required. + */ interface SetCompilerOptionsForInferredProjectsResponse extends Response { } /** - * Exit request; value of command field is "exit". Ask the server process - * to exit. - */ + * Exit request; value of command field is "exit". Ask the server process + * to exit. + */ interface ExitRequest extends Request { command: CommandTypes.Exit; } /** - * Close request; value of command field is "close". Notify the - * server that the client has closed a previously open file. If - * file is still referenced by open files, the server will resume - * monitoring the filesystem for changes to file. Server does not - * currently send a response to a close request. - */ + * Close request; value of command field is "close". Notify the + * server that the client has closed a previously open file. If + * file is still referenced by open files, the server will resume + * monitoring the filesystem for changes to file. Server does not + * currently send a response to a close request. + */ interface CloseRequest extends FileRequest { command: CommandTypes.Close; } @@ -897,6 +909,10 @@ declare namespace ts.server.protocol { * List of files names that should be recompiled */ fileNames: string[]; + /** + * true if project uses outFile or out compiler option + */ + projectUsesOutFile: boolean; } /** * Response for CompileOnSaveAffectedFileListRequest request; @@ -921,60 +937,64 @@ declare namespace ts.server.protocol { forced?: boolean; } /** - * Quickinfo request; value of command field is - * "quickinfo". Return response giving a quick type and - * documentation string for the symbol found in file at location - * line, col. - */ + * Quickinfo request; value of command field is + * "quickinfo". Return response giving a quick type and + * documentation string for the symbol found in file at location + * line, col. + */ interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; } /** - * Body of QuickInfoResponse. - */ + * Body of QuickInfoResponse. + */ interface QuickInfoResponseBody { /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; /** - * Starting file location of symbol. - */ + * Starting file location of symbol. + */ start: Location; /** - * One past last character of symbol. - */ + * One past last character of symbol. + */ end: Location; /** - * Type and kind of symbol. - */ + * Type and kind of symbol. + */ displayString: string; /** - * Documentation associated with symbol. - */ + * Documentation associated with symbol. + */ documentation: string; + /** + * JSDoc tags associated with symbol. + */ + tags: JSDocTagInfo[]; } /** - * Quickinfo response message. - */ + * Quickinfo response message. + */ interface QuickInfoResponse extends Response { body?: QuickInfoResponseBody; } /** - * Arguments for format messages. - */ + * Arguments for format messages. + */ interface FormatRequestArgs extends FileLocationRequestArgs { /** - * Last line of range for which to format text in file. - */ + * Last line of range for which to format text in file. + */ endLine: number; /** - * Character offset on last line of range for which to format text in file. - */ + * Character offset on last line of range for which to format text in file. + */ endOffset: number; /** * Format options to be used. @@ -982,36 +1002,36 @@ declare namespace ts.server.protocol { options?: FormatCodeSettings; } /** - * Format request; value of command field is "format". Return - * response giving zero or more edit instructions. The edit - * instructions will be sorted in file order. Applying the edit - * instructions in reverse to file will result in correctly - * reformatted text. - */ + * Format request; value of command field is "format". Return + * response giving zero or more edit instructions. The edit + * instructions will be sorted in file order. Applying the edit + * instructions in reverse to file will result in correctly + * reformatted text. + */ interface FormatRequest extends FileLocationRequest { command: CommandTypes.Format; arguments: FormatRequestArgs; } /** - * Object found in response messages defining an editing - * instruction for a span of text in source code. The effect of - * this instruction is to replace the text starting at start and - * ending one character before end with newText. For an insertion, - * the text span is empty. For a deletion, newText is empty. - */ + * Object found in response messages defining an editing + * instruction for a span of text in source code. The effect of + * this instruction is to replace the text starting at start and + * ending one character before end with newText. For an insertion, + * the text span is empty. For a deletion, newText is empty. + */ interface CodeEdit { /** - * First character of the text span to edit. - */ + * First character of the text span to edit. + */ start: Location; /** - * One character past last character of the text span to edit. - */ + * One character past last character of the text span to edit. + */ end: Location; /** - * Replace the span defined above with this string (may be - * the empty string). - */ + * Replace the span defined above with this string (may be + * the empty string). + */ newText: string; } interface FileCodeEdits { @@ -1029,99 +1049,99 @@ declare namespace ts.server.protocol { changes: FileCodeEdits[]; } /** - * Format and format on key response message. - */ + * Format and format on key response message. + */ interface FormatResponse extends Response { body?: CodeEdit[]; } /** - * Arguments for format on key messages. - */ + * Arguments for format on key messages. + */ interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { /** - * Key pressed (';', '\n', or '}'). - */ + * Key pressed (';', '\n', or '}'). + */ key: string; options?: FormatCodeSettings; } /** - * Format on key request; value of command field is - * "formatonkey". Given file location and key typed (as string), - * return response giving zero or more edit instructions. The - * edit instructions will be sorted in file order. Applying the - * edit instructions in reverse to file will result in correctly - * reformatted text. - */ + * Format on key request; value of command field is + * "formatonkey". Given file location and key typed (as string), + * return response giving zero or more edit instructions. The + * edit instructions will be sorted in file order. Applying the + * edit instructions in reverse to file will result in correctly + * reformatted text. + */ interface FormatOnKeyRequest extends FileLocationRequest { command: CommandTypes.Formatonkey; arguments: FormatOnKeyRequestArgs; } /** - * Arguments for completions messages. - */ + * Arguments for completions messages. + */ interface CompletionsRequestArgs extends FileLocationRequestArgs { /** - * Optional prefix to apply to possible completions. - */ + * Optional prefix to apply to possible completions. + */ prefix?: string; } /** - * Completions request; value of command field is "completions". - * Given a file location (file, line, col) and a prefix (which may - * be the empty string), return the possible completions that - * begin with prefix. - */ + * Completions request; value of command field is "completions". + * Given a file location (file, line, col) and a prefix (which may + * be the empty string), return the possible completions that + * begin with prefix. + */ interface CompletionsRequest extends FileLocationRequest { command: CommandTypes.Completions; arguments: CompletionsRequestArgs; } /** - * Arguments for completion details request. - */ + * Arguments for completion details request. + */ interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { /** - * Names of one or more entries for which to obtain details. - */ + * Names of one or more entries for which to obtain details. + */ entryNames: string[]; } /** - * Completion entry details request; value of command field is - * "completionEntryDetails". Given a file location (file, line, - * col) and an array of completion entry names return more - * detailed information for each completion entry. - */ + * Completion entry details request; value of command field is + * "completionEntryDetails". Given a file location (file, line, + * col) and an array of completion entry names return more + * detailed information for each completion entry. + */ interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; } /** - * Part of a symbol description. - */ + * Part of a symbol description. + */ interface SymbolDisplayPart { /** - * Text of an item describing the symbol. - */ + * Text of an item describing the symbol. + */ text: string; /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; } /** - * An item found in a completion response. - */ + * An item found in a completion response. + */ interface CompletionEntry { /** - * The symbol's name. - */ + * The symbol's name. + */ name: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; /** * A string that is used for comparing completion items so that they can be ordered. This @@ -1135,29 +1155,33 @@ declare namespace ts.server.protocol { replacementSpan?: TextSpan; } /** - * Additional completion entry details, available on demand - */ + * Additional completion entry details, available on demand + */ interface CompletionEntryDetails { /** - * The symbol's name. - */ + * The symbol's name. + */ name: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; /** - * Display parts of the symbol (similar to quick info). - */ + * Display parts of the symbol (similar to quick info). + */ displayParts: SymbolDisplayPart[]; /** - * Documentation strings for the symbol. - */ + * Documentation strings for the symbol. + */ documentation: SymbolDisplayPart[]; + /** + * JSDoc tags for the symbol. + */ + tags: JSDocTagInfo[]; } interface CompletionsResponse extends Response { body?: CompletionEntry[]; @@ -1174,12 +1198,12 @@ declare namespace ts.server.protocol { */ name: string; /** - * Documentation of the parameter. - */ + * Documentation of the parameter. + */ documentation: SymbolDisplayPart[]; /** - * Display parts of the parameter. - */ + * Display parts of the parameter. + */ displayParts: SymbolDisplayPart[]; /** * Whether the parameter is optional or not. @@ -1214,6 +1238,10 @@ declare namespace ts.server.protocol { * The signature's documentation */ documentation: SymbolDisplayPart[]; + /** + * The signature's JSDoc tags + */ + tags: JSDocTagInfo[]; } /** * Signature help items found in the response of a signature help request. @@ -1246,10 +1274,10 @@ declare namespace ts.server.protocol { interface SignatureHelpRequestArgs extends FileLocationRequestArgs { } /** - * Signature help request; value of command field is "signatureHelp". - * Given a file location (file, line, col), return the signature - * help. - */ + * Signature help request; value of command field is "signatureHelp". + * Given a file location (file, line, col), return the signature + * help. + */ interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; @@ -1261,8 +1289,8 @@ declare namespace ts.server.protocol { body?: SignatureHelpItems; } /** - * Synchronous request for semantic diagnostics of one file. - */ + * Synchronous request for semantic diagnostics of one file. + */ interface SemanticDiagnosticsSyncRequest extends FileRequest { command: CommandTypes.SemanticDiagnosticsSync; arguments: SemanticDiagnosticsSyncRequestArgs; @@ -1271,14 +1299,14 @@ declare namespace ts.server.protocol { includeLinePosition?: boolean; } /** - * Response object for synchronous sematic diagnostics request. - */ + * Response object for synchronous sematic diagnostics request. + */ interface SemanticDiagnosticsSyncResponse extends Response { body?: Diagnostic[] | DiagnosticWithLinePosition[]; } /** - * Synchronous request for syntactic diagnostics of one file. - */ + * Synchronous request for syntactic diagnostics of one file. + */ interface SyntacticDiagnosticsSyncRequest extends FileRequest { command: CommandTypes.SyntacticDiagnosticsSync; arguments: SyntacticDiagnosticsSyncRequestArgs; @@ -1287,98 +1315,109 @@ declare namespace ts.server.protocol { includeLinePosition?: boolean; } /** - * Response object for synchronous syntactic diagnostics request. - */ + * Response object for synchronous syntactic diagnostics request. + */ interface SyntacticDiagnosticsSyncResponse extends Response { body?: Diagnostic[] | DiagnosticWithLinePosition[]; } /** - * Arguments for GeterrForProject request. - */ + * Arguments for GeterrForProject request. + */ interface GeterrForProjectRequestArgs { /** - * the file requesting project error list - */ + * the file requesting project error list + */ file: string; /** - * Delay in milliseconds to wait before starting to compute - * errors for the files in the file list - */ + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ delay: number; } /** - * GeterrForProjectRequest request; value of command field is - * "geterrForProject". It works similarly with 'Geterr', only - * it request for every file in this project. - */ + * GeterrForProjectRequest request; value of command field is + * "geterrForProject". It works similarly with 'Geterr', only + * it request for every file in this project. + */ interface GeterrForProjectRequest extends Request { command: CommandTypes.GeterrForProject; arguments: GeterrForProjectRequestArgs; } /** - * Arguments for geterr messages. - */ + * Arguments for geterr messages. + */ interface GeterrRequestArgs { /** - * List of file names for which to compute compiler errors. - * The files will be checked in list order. - */ + * List of file names for which to compute compiler errors. + * The files will be checked in list order. + */ files: string[]; /** - * Delay in milliseconds to wait before starting to compute - * errors for the files in the file list - */ + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ delay: number; } /** - * Geterr request; value of command field is "geterr". Wait for - * delay milliseconds and then, if during the wait no change or - * reload messages have arrived for the first file in the files - * list, get the syntactic errors for the file, field requests, - * and then get the semantic errors for the file. Repeat with a - * smaller delay for each subsequent file on the files list. Best - * practice for an editor is to send a file list containing each - * file that is currently visible, in most-recently-used order. - */ + * Geterr request; value of command field is "geterr". Wait for + * delay milliseconds and then, if during the wait no change or + * reload messages have arrived for the first file in the files + * list, get the syntactic errors for the file, field requests, + * and then get the semantic errors for the file. Repeat with a + * smaller delay for each subsequent file on the files list. Best + * practice for an editor is to send a file list containing each + * file that is currently visible, in most-recently-used order. + */ interface GeterrRequest extends Request { command: CommandTypes.Geterr; arguments: GeterrRequestArgs; } + type RequestCompletedEventName = "requestCompleted"; + /** + * Event that is sent when server have finished processing request with specified id. + */ + interface RequestCompletedEvent extends Event { + event: RequestCompletedEventName; + body: RequestCompletedEventBody; + } + interface RequestCompletedEventBody { + request_seq: number; + } /** - * Item of diagnostic information found in a DiagnosticEvent message. - */ + * Item of diagnostic information found in a DiagnosticEvent message. + */ interface Diagnostic { /** - * Starting file location at which text applies. - */ + * Starting file location at which text applies. + */ start: Location; /** - * The last file location at which the text applies. - */ + * The last file location at which the text applies. + */ end: Location; /** - * Text of diagnostic message. - */ + * Text of diagnostic message. + */ text: string; /** - * The error code of the diagnostic message. - */ + * The error code of the diagnostic message. + */ code?: number; } interface DiagnosticEventBody { /** - * The file for which diagnostic information is reported. - */ + * The file for which diagnostic information is reported. + */ file: string; /** - * An array of diagnostic information items. - */ + * An array of diagnostic information items. + */ diagnostics: Diagnostic[]; } /** - * Event message for "syntaxDiag" and "semanticDiag" event types. - * These events provide syntactic and semantic errors for a file. - */ + * Event message for "syntaxDiag" and "semanticDiag" event types. + * These events provide syntactic and semantic errors for a file. + */ interface DiagnosticEvent extends Event { body?: DiagnosticEventBody; } @@ -1424,172 +1463,172 @@ declare namespace ts.server.protocol { languageServiceEnabled: boolean; } /** - * Arguments for reload request. - */ + * Arguments for reload request. + */ interface ReloadRequestArgs extends FileRequestArgs { /** - * Name of temporary file from which to reload file - * contents. May be same as file. - */ + * Name of temporary file from which to reload file + * contents. May be same as file. + */ tmpfile: string; } /** - * Reload request message; value of command field is "reload". - * Reload contents of file with name given by the 'file' argument - * from temporary file with name given by the 'tmpfile' argument. - * The two names can be identical. - */ + * Reload request message; value of command field is "reload". + * Reload contents of file with name given by the 'file' argument + * from temporary file with name given by the 'tmpfile' argument. + * The two names can be identical. + */ interface ReloadRequest extends FileRequest { command: CommandTypes.Reload; arguments: ReloadRequestArgs; } /** - * Response to "reload" request. This is just an acknowledgement, so - * no body field is required. - */ + * Response to "reload" request. This is just an acknowledgement, so + * no body field is required. + */ interface ReloadResponse extends Response { } /** - * Arguments for saveto request. - */ + * Arguments for saveto request. + */ interface SavetoRequestArgs extends FileRequestArgs { /** - * Name of temporary file into which to save server's view of - * file contents. - */ + * Name of temporary file into which to save server's view of + * file contents. + */ tmpfile: string; } /** - * Saveto request message; value of command field is "saveto". - * For debugging purposes, save to a temporaryfile (named by - * argument 'tmpfile') the contents of file named by argument - * 'file'. The server does not currently send a response to a - * "saveto" request. - */ + * Saveto request message; value of command field is "saveto". + * For debugging purposes, save to a temporaryfile (named by + * argument 'tmpfile') the contents of file named by argument + * 'file'. The server does not currently send a response to a + * "saveto" request. + */ interface SavetoRequest extends FileRequest { command: CommandTypes.Saveto; arguments: SavetoRequestArgs; } /** - * Arguments for navto request message. - */ + * Arguments for navto request message. + */ interface NavtoRequestArgs extends FileRequestArgs { /** - * Search term to navigate to from current location; term can - * be '.*' or an identifier prefix. - */ + * Search term to navigate to from current location; term can + * be '.*' or an identifier prefix. + */ searchValue: string; /** - * Optional limit on the number of items to return. - */ + * Optional limit on the number of items to return. + */ maxResultCount?: number; /** - * Optional flag to indicate we want results for just the current file - * or the entire project. - */ + * Optional flag to indicate we want results for just the current file + * or the entire project. + */ currentFileOnly?: boolean; projectFileName?: string; } /** - * Navto request message; value of command field is "navto". - * Return list of objects giving file locations and symbols that - * match the search term given in argument 'searchTerm'. The - * context for the search is given by the named file. - */ + * Navto request message; value of command field is "navto". + * Return list of objects giving file locations and symbols that + * match the search term given in argument 'searchTerm'. The + * context for the search is given by the named file. + */ interface NavtoRequest extends FileRequest { command: CommandTypes.Navto; arguments: NavtoRequestArgs; } /** - * An item found in a navto response. - */ + * An item found in a navto response. + */ interface NavtoItem { /** - * The symbol's name. - */ + * The symbol's name. + */ name: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * exact, substring, or prefix. - */ + * exact, substring, or prefix. + */ matchKind?: string; /** - * If this was a case sensitive or insensitive match. - */ + * If this was a case sensitive or insensitive match. + */ isCaseSensitive?: boolean; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; /** - * The file in which the symbol is found. - */ + * The file in which the symbol is found. + */ file: string; /** - * The location within file at which the symbol is found. - */ + * The location within file at which the symbol is found. + */ start: Location; /** - * One past the last character of the symbol. - */ + * One past the last character of the symbol. + */ end: Location; /** - * Name of symbol's container symbol (if any); for example, - * the class name if symbol is a class member. - */ + * Name of symbol's container symbol (if any); for example, + * the class name if symbol is a class member. + */ containerName?: string; /** - * Kind of symbol's container symbol (if any). - */ + * Kind of symbol's container symbol (if any). + */ containerKind?: string; } /** - * Navto response message. Body is an array of navto items. Each - * item gives a symbol that matched the search term. - */ + * Navto response message. Body is an array of navto items. Each + * item gives a symbol that matched the search term. + */ interface NavtoResponse extends Response { body?: NavtoItem[]; } /** - * Arguments for change request message. - */ + * Arguments for change request message. + */ interface ChangeRequestArgs extends FormatRequestArgs { /** - * Optional string to insert at location (file, line, offset). - */ + * Optional string to insert at location (file, line, offset). + */ insertString?: string; } /** - * Change request message; value of command field is "change". - * Update the server's view of the file named by argument 'file'. - * Server does not currently send a response to a change request. - */ + * Change request message; value of command field is "change". + * Update the server's view of the file named by argument 'file'. + * Server does not currently send a response to a change request. + */ interface ChangeRequest extends FileLocationRequest { command: CommandTypes.Change; arguments: ChangeRequestArgs; } /** - * Response to "brace" request. - */ + * Response to "brace" request. + */ interface BraceResponse extends Response { body?: TextSpan[]; } /** - * Brace matching request; value of command field is "brace". - * Return response giving the file locations of matching braces - * found in file at location line, offset. - */ + * Brace matching request; value of command field is "brace". + * Return response giving the file locations of matching braces + * found in file at location line, offset. + */ interface BraceRequest extends FileLocationRequest { command: CommandTypes.Brace; } /** - * NavBar items request; value of command field is "navbar". - * Return response giving the list of navigation bar entries - * extracted from the requested file. - */ + * NavBar items request; value of command field is "navbar". + * Return response giving the list of navigation bar entries + * extracted from the requested file. + */ interface NavBarRequest extends FileRequest { command: CommandTypes.NavBar; } @@ -1602,28 +1641,28 @@ declare namespace ts.server.protocol { } interface NavigationBarItem { /** - * The item's display text. - */ + * The item's display text. + */ text: string; /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; /** - * Optional modifiers for the kind (such as 'public'). - */ + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; /** - * The definition locations of the item. - */ + * The definition locations of the item. + */ spans: TextSpan[]; /** - * Optional children. - */ + * Optional children. + */ childItems?: NavigationBarItem[]; /** - * Number of levels deep this item should appear. - */ + * Number of levels deep this item should appear. + */ indent: number; } /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */ @@ -1643,6 +1682,14 @@ declare namespace ts.server.protocol { telemetryEventName: string; payload: any; } + type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed"; + interface TypesInstallerInitializationFailedEvent extends Event { + event: TypesInstallerInitializationFailedEventName; + body: TypesInstallerInitializationFailedEventBody; + } + interface TypesInstallerInitializationFailedEventBody { + message: string; + } type TypingsInstalledTelemetryEventName = "typingsInstalled"; interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { telemetryEventName: TypingsInstalledTelemetryEventName; @@ -1662,6 +1709,34 @@ declare namespace ts.server.protocol { */ typingsInstallerVersion: string; } + type BeginInstallTypesEventName = "beginInstallTypes"; + type EndInstallTypesEventName = "endInstallTypes"; + interface BeginInstallTypesEvent extends Event { + event: BeginInstallTypesEventName; + body: BeginInstallTypesEventBody; + } + interface EndInstallTypesEvent extends Event { + event: EndInstallTypesEventName; + body: EndInstallTypesEventBody; + } + interface InstallTypesEventBody { + /** + * correlation id to match begin and end events + */ + eventId: number; + /** + * list of packages to install + */ + packages: ReadonlyArray; + } + interface BeginInstallTypesEventBody extends InstallTypesEventBody { + } + interface EndInstallTypesEventBody extends InstallTypesEventBody { + /** + * true if installation succeeded, otherwise false + */ + success: boolean; + } interface NavBarResponse extends Response { body?: NavigationBarItem[]; } @@ -1686,12 +1761,15 @@ declare namespace ts.server.protocol { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } @@ -1737,6 +1815,7 @@ declare namespace ts.server.protocol { outDir?: string; outFile?: string; paths?: MapLike; + plugins?: PluginImport[]; preserveConstEnums?: boolean; project?: string; reactNamespace?: string; @@ -1760,9 +1839,10 @@ declare namespace ts.server.protocol { namespace JsxEmit { type None = "None"; type Preserve = "Preserve"; + type ReactNative = "ReactNative"; type React = "React"; } - type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; + type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative; namespace ModuleKind { type None = "None"; type CommonJS = "CommonJS"; @@ -1818,11 +1898,30 @@ declare namespace ts.server.protocol { [option: string]: string[] | boolean | undefined; } + interface JsFileExtensionInfo { + extension: string; + isMixedContent: boolean; + } + + interface JSDocTagInfo { + name: string; + text?: string; + } + + /** + * Type of objects whose values are all of the same type. + * The `in` and `for-in` operators can *not* be safely used, + * since `Object.prototype` may be modified by outside code. + */ interface MapLike { [index: string]: T; } - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike; + interface PluginImport { + name: string; + } + + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[]; } declare namespace ts { // these types are empty stubs for types from services and should not be used directly diff --git a/node_modules/typescript/lib/tsc.js b/node_modules/typescript/lib/tsc.js index e08661bd1..a690d219d 100644 --- a/node_modules/typescript/lib/tsc.js +++ b/node_modules/typescript/lib/tsc.js @@ -27,6 +27,16 @@ var ts; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var NodeBuilderFlags; + (function (NodeBuilderFlags) { + NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None"; + NodeBuilderFlags[NodeBuilderFlags["allowThisInObjectLiteral"] = 1] = "allowThisInObjectLiteral"; + NodeBuilderFlags[NodeBuilderFlags["allowQualifedNameInPlaceOfIdentifier"] = 2] = "allowQualifedNameInPlaceOfIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowTypeParameterInQualifiedName"] = 4] = "allowTypeParameterInQualifiedName"; + NodeBuilderFlags[NodeBuilderFlags["allowAnonymousIdentifier"] = 8] = "allowAnonymousIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyUnionOrIntersection"] = 16] = "allowEmptyUnionOrIntersection"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyTuple"] = 32] = "allowEmptyTuple"; + })(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {})); var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown"; @@ -88,32 +98,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -132,22 +142,96 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.2.0-dev.20161127"; + ts.version = "2.3.0-dev.20170419"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -160,32 +244,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -199,9 +278,13 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -211,6 +294,20 @@ var ts; return undefined; } ts.forEach = forEach; + function findAncestor(node, callback) { + while (node) { + var result = callback(node); + if (result === "quit") { + return undefined; + } + else if (result) { + return node; + } + node = node.parent; + } + return undefined; + } + ts.findAncestor = findAncestor; function zipWith(arrayA, arrayB, callback) { Debug.assert(arrayA.length === arrayB.length); for (var i = 0; i < arrayA.length; i++) { @@ -220,7 +317,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -230,7 +327,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -239,8 +336,17 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -263,7 +369,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -273,7 +379,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -460,21 +566,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -758,38 +861,55 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator, map) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(map ? map(value) : value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function convertToArray(iterator, f) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(f(value)); } - return false; + return result; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.convertToArray = convertToArray; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } + } + return undefined; + var _b; } - ts.appendProperty = appendProperty; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); + } + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -797,31 +917,14 @@ var ts; } for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { var arg = args_1[_a]; - for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) { - var p = _c[_b]; - t[p] = arg[p]; - } + for (var p in arg) + if (hasProperty(arg, p)) { + t[p] = arg[p]; + } } return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -846,23 +949,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -889,27 +983,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -985,6 +1084,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -1086,8 +1186,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1469,36 +1571,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1568,6 +1660,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1580,34 +1673,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } + } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1623,14 +1730,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -1668,8 +1775,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = allSupportedExtensions.slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (extensions.indexOf(extInfo.extension) === -1) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1680,11 +1798,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1696,30 +1814,30 @@ var ts; function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--) { if (fileExtensionIs(path, supportedExtensions[i])) { - return adjustExtensionPriority(i); + return adjustExtensionPriority(i, supportedExtensions); } } return 0; } ts.getExtensionPriority = getExtensionPriority; - function adjustExtensionPriority(extensionPriority) { + function adjustExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 0; } - else if (extensionPriority < 5) { + else if (extensionPriority < supportedExtensions.length) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.adjustExtensionPriority = adjustExtensionPriority; - function getNextLowestExtensionPriority(extensionPriority) { + function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority; @@ -1928,136 +2046,29 @@ var ts; } } ts.tryGetExtensionFromPath = tryGetExtensionFromPath; + function isCheckJsEnabledForFile(sourceFile, compilerOptions) { + return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; + } + ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile; })(ts || (ts = {})); var ts; (function (ts) { - ts.sys = (function () { - function getWScriptSystem() { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - var shell = new ActiveXObject("WScript.Shell"); - var fileStream = new ActiveXObject("ADODB.Stream"); - fileStream.Type = 2; - var binaryStream = new ActiveXObject("ADODB.Stream"); - binaryStream.Type = 1; - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); - } - function readFile(fileName, encoding) { - if (!fso.FileExists(fileName)) { - return undefined; - } - fileStream.Open(); - try { - if (encoding) { - fileStream.Charset = encoding; - fileStream.LoadFromFile(fileName); - } - else { - fileStream.Charset = "x-ansi"; - fileStream.LoadFromFile(fileName); - var bom = fileStream.ReadText(2) || ""; - fileStream.Position = 0; - fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; - } - return fileStream.ReadText(); - } - catch (e) { - throw e; - } - finally { - fileStream.Close(); - } - } - function writeFile(fileName, data, writeByteOrderMark) { - fileStream.Open(); - binaryStream.Open(); - try { - fileStream.Charset = "utf-8"; - fileStream.WriteText(data); - if (writeByteOrderMark) { - fileStream.Position = 0; - } - else { - fileStream.Position = 3; - } - fileStream.CopyTo(binaryStream); - binaryStream.SaveToFile(fileName, 2); - } - finally { - binaryStream.Close(); - fileStream.Close(); - } - } - function getNames(collection) { - var result = []; - for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { - result.push(e.item().Name); - } - return result.sort(); - } - function getDirectories(path) { - var folder = fso.GetFolder(path); - return getNames(folder.subfolders); - } - function getAccessibleFileSystemEntries(path) { - try { - var folder = fso.GetFolder(path || "."); - var files = getNames(folder.files); - var directories = getNames(folder.subfolders); - return { files: files, directories: directories }; - } - catch (e) { - return { files: [], directories: [] }; - } - } - function readDirectory(path, extensions, excludes, includes) { - return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries); - } - var wscriptSystem = { - args: args, - newLine: "\r\n", - useCaseSensitiveFileNames: false, - write: function (s) { - WScript.StdOut.Write(s); - }, - readFile: readFile, - writeFile: writeFile, - resolvePath: function (path) { - return fso.GetAbsolutePathName(path); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - createDirectory: function (directoryName) { - if (!wscriptSystem.directoryExists(directoryName)) { - fso.CreateFolder(directoryName); - } - }, - getExecutingFilePath: function () { - return WScript.ScriptFullName; - }, - getCurrentDirectory: function () { - return shell.CurrentDirectory; - }, - getDirectories: getDirectories, - getEnvironmentVariable: function (name) { - return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%" + name + "%"); - }, - readDirectory: readDirectory, - exit: function (exitCode) { - try { - WScript.Quit(exitCode); - } - catch (e) { - } - } - }; - return wscriptSystem; + function getNodeMajorVersion() { + if (typeof process === "undefined") { + return undefined; + } + var version = process.version; + if (!version) { + return undefined; + } + var dot = version.indexOf("."); + if (dot === -1) { + return undefined; } + return parseInt(version.substring(1, dot)); + } + ts.getNodeMajorVersion = getNodeMajorVersion; + ts.sys = (function () { function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); @@ -2066,32 +2077,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2103,24 +2114,26 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } } var watchedFileSet = createWatchedFileSet(); - function isNode4OrLater() { - return parseInt(process.version.charAt(1)) >= 4; - } + var nodeVersion = getNodeMajorVersion(); + var isNode4OrLater = nodeVersion >= 4; function isFileSystemCaseSensitive() { if (platform === "win32" || platform === "win64") { return false; @@ -2177,10 +2190,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2257,7 +2270,7 @@ var ts; if (!directoryExists(directoryName)) { return noOpFileWatcher; } - if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } else { @@ -2267,7 +2280,6 @@ var ts; if (eventName === "rename") { callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } - ; }); }, resolvePath: function (path) { @@ -2384,9 +2396,6 @@ var ts; if (typeof ChakraHost !== "undefined") { sys = getChakraSystem(); } - else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - sys = getWScriptSystem(); - } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { sys = getNodeSystem(); } @@ -2455,11 +2464,11 @@ var ts; Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, - Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: "Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059", message: "Return expression in async function does not have a valid callable 'then' member." }, - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: "Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060", message: "Expression body for async arrow function does not have a valid callable 'then' member." }, + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", message: "The return type of an async function must either be a valid promise or must not contain a callable 'then' member." }, + A_promise_must_have_a_then_method: { code: 1059, category: ts.DiagnosticCategory.Error, key: "A_promise_must_have_a_then_method_1059", message: "A promise must have a 'then' method." }, + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: { code: 1060, category: ts.DiagnosticCategory.Error, key: "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", message: "The first parameter of the 'then' method of a promise must be a callback." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, @@ -2468,7 +2477,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2484,6 +2493,7 @@ var ts; Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, + A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: { code: 1103, category: ts.DiagnosticCategory.Error, key: "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", message: "A 'for-await-of' statement is only allowed within an async function or async generator." }, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, @@ -2491,7 +2501,7 @@ var ts; Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, + Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'." }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, @@ -2523,9 +2533,9 @@ var ts; Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", message: "Cannot use imports, exports, or module augmentations when '--module' is 'none'." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing." }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, + const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized." }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, @@ -2574,11 +2584,12 @@ var ts; Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode" }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." }, @@ -2624,6 +2635,11 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1320, category: ts.DiagnosticCategory.Error, key: "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", message: "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1321, category: ts.DiagnosticCategory.Error, key: "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", message: "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1322, category: ts.DiagnosticCategory.Error, key: "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", message: "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2667,6 +2683,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2677,19 +2694,20 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter." }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, + Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'." }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, @@ -2729,12 +2747,12 @@ var ts; The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class." }, The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, + Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'." }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, @@ -2743,19 +2761,19 @@ var ts; Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, + Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'." }, All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, + Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'." }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged." }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged." }, Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'" }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name." }, + Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'." }, Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'" }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, @@ -2764,18 +2782,20 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, + Class_0_used_before_its_declaration: { code: 2449, category: ts.DiagnosticCategory.Error, key: "Class_0_used_before_its_declaration_2449", message: "Class '{0}' used before its declaration." }, + Enum_0_used_before_its_declaration: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Enum_0_used_before_its_declaration_2450", message: "Enum '{0}' used before its declaration." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, + Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'." }, An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" }, + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern." }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, @@ -2796,13 +2816,13 @@ var ts; let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'." }, The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause" }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause." }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, @@ -2814,6 +2834,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, + Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: { code: 2504, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", message: "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator." }, A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, @@ -2828,6 +2849,7 @@ var ts; All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, + An_async_iterator_must_have_a_next_method: { code: 2519, category: ts.DiagnosticCategory.Error, key: "An_async_iterator_must_have_a_next_method_2519", message: "An async iterator must have a 'next()' method." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, @@ -2851,23 +2873,33 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, + Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." }, + The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: { code: 2547, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", message: "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property." }, + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2548, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", message: "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2549, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", message: "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: { code: 2550, category: ts.DiagnosticCategory.Error, key: "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", message: "Generic type instantiation is excessively deep and possibly infinite." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, + Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'." }, JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, - Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property." }, + The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property." }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, + Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React." }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, - Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element." }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'." }, super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, @@ -2899,7 +2931,6 @@ var ts; All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, - A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." }, An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, @@ -2908,9 +2939,17 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference." }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property." }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, + Required_type_parameters_may_not_follow_optional_type_parameters: { code: 2706, category: ts.DiagnosticCategory.Error, key: "Required_type_parameters_may_not_follow_optional_type_parameters_2706", message: "Required type parameters may not follow optional type parameters." }, + Generic_type_0_requires_between_1_and_2_type_arguments: { code: 2707, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_between_1_and_2_type_arguments_2707", message: "Generic type '{0}' requires between {1} and {2} type arguments." }, + Cannot_use_namespace_0_as_a_value: { code: 2708, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_value_2708", message: "Cannot use namespace '{0}' as a value." }, + Cannot_use_namespace_0_as_a_type: { code: 2709, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_type_2709", message: "Cannot use namespace '{0}' as a type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2921,8 +2960,8 @@ var ts; Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "'extends' clause of exported class '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "'extends' clause of exported interface '{0}' has or is using private name '{1}'." }, Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, @@ -2983,16 +3022,18 @@ var ts; Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced: { code: 4093, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced_4093", message: "'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", message: "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported_file_encoding_5013", message: "Unsupported file encoding." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}." }, Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}" }, + Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", message: "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, @@ -3001,12 +3042,12 @@ var ts; A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, - The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'." }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'." }, Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, - Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character." }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character." }, Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_should_be_an_array_5063", message: "Substitutions for pattern '{0}' should be an array." }, Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, @@ -3024,11 +3065,11 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'." }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3043,11 +3084,12 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -3069,17 +3111,18 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context (experimental)." }, Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'." }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", message: "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit" }, Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, @@ -3090,23 +3133,23 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, + package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, - Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, - Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, - Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, - Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'." }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'." }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'." }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'." }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'." }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed." }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, @@ -3116,32 +3159,67 @@ var ts; Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, - Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'." }, Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, - Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'." }, Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, - Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'." }, Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." }, - File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" }, + File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it." }, _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." }, Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" }, - No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" }, + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files." }, Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" }, + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file." }, Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, + Show_diagnostic_information: { code: 6149, category: ts.DiagnosticCategory.Message, key: "Show_diagnostic_information_6149", message: "Show diagnostic information." }, + Show_verbose_diagnostic_information: { code: 6150, category: ts.DiagnosticCategory.Message, key: "Show_verbose_diagnostic_information_6150", message: "Show verbose diagnostic information." }, + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: { code: 6151, category: ts.DiagnosticCategory.Message, key: "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", message: "Emit a single file with source maps instead of having a separate file." }, + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: { code: 6152, category: ts.DiagnosticCategory.Message, key: "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", message: "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set." }, + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: { code: 6153, category: ts.DiagnosticCategory.Message, key: "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", message: "Transpile each file as a separate module (similar to 'ts.transpileModule')." }, + Print_names_of_generated_files_part_of_the_compilation: { code: 6154, category: ts.DiagnosticCategory.Message, key: "Print_names_of_generated_files_part_of_the_compilation_6154", message: "Print names of generated files part of the compilation." }, + Print_names_of_files_part_of_the_compilation: { code: 6155, category: ts.DiagnosticCategory.Message, key: "Print_names_of_files_part_of_the_compilation_6155", message: "Print names of files part of the compilation." }, + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: { code: 6156, category: ts.DiagnosticCategory.Message, key: "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", message: "The locale used when displaying messages to the user (e.g. 'en-us')" }, + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: { code: 6157, category: ts.DiagnosticCategory.Message, key: "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", message: "Do not generate custom helper functions like '__extends' in compiled output." }, + Do_not_include_the_default_library_file_lib_d_ts: { code: 6158, category: ts.DiagnosticCategory.Message, key: "Do_not_include_the_default_library_file_lib_d_ts_6158", message: "Do not include the default library file (lib.d.ts)." }, + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: { code: 6159, category: ts.DiagnosticCategory.Message, key: "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", message: "Do not add triple-slash references or imported modules to the list of compiled files." }, + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: { code: 6160, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", message: "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files." }, + List_of_folders_to_include_type_definitions_from: { code: 6161, category: ts.DiagnosticCategory.Message, key: "List_of_folders_to_include_type_definitions_from_6161", message: "List of folders to include type definitions from." }, + Disable_size_limitations_on_JavaScript_projects: { code: 6162, category: ts.DiagnosticCategory.Message, key: "Disable_size_limitations_on_JavaScript_projects_6162", message: "Disable size limitations on JavaScript projects." }, + The_character_set_of_the_input_files: { code: 6163, category: ts.DiagnosticCategory.Message, key: "The_character_set_of_the_input_files_6163", message: "The character set of the input files." }, + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: { code: 6164, category: ts.DiagnosticCategory.Message, key: "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", message: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files." }, + Do_not_truncate_error_messages: { code: 6165, category: ts.DiagnosticCategory.Message, key: "Do_not_truncate_error_messages_6165", message: "Do not truncate error messages." }, + Output_directory_for_generated_declaration_files: { code: 6166, category: ts.DiagnosticCategory.Message, key: "Output_directory_for_generated_declaration_files_6166", message: "Output directory for generated declaration files." }, + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: { code: 6167, category: ts.DiagnosticCategory.Message, key: "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", message: "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'." }, + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: { code: 6168, category: ts.DiagnosticCategory.Message, key: "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", message: "List of root folders whose combined content represents the structure of the project at runtime." }, + Show_all_compiler_options: { code: 6169, category: ts.DiagnosticCategory.Message, key: "Show_all_compiler_options_6169", message: "Show all compiler options." }, + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: { code: 6170, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", message: "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file" }, + Command_line_Options: { code: 6171, category: ts.DiagnosticCategory.Message, key: "Command_line_Options_6171", message: "Command-line Options" }, + Basic_Options: { code: 6172, category: ts.DiagnosticCategory.Message, key: "Basic_Options_6172", message: "Basic Options" }, + Strict_Type_Checking_Options: { code: 6173, category: ts.DiagnosticCategory.Message, key: "Strict_Type_Checking_Options_6173", message: "Strict Type-Checking Options" }, + Module_Resolution_Options: { code: 6174, category: ts.DiagnosticCategory.Message, key: "Module_Resolution_Options_6174", message: "Module Resolution Options" }, + Source_Map_Options: { code: 6175, category: ts.DiagnosticCategory.Message, key: "Source_Map_Options_6175", message: "Source Map Options" }, + Additional_Checks: { code: 6176, category: ts.DiagnosticCategory.Message, key: "Additional_Checks_6176", message: "Additional Checks" }, + Experimental_Options: { code: 6177, category: ts.DiagnosticCategory.Message, key: "Experimental_Options_6177", message: "Experimental Options" }, + Advanced_Options: { code: 6178, category: ts.DiagnosticCategory.Message, key: "Advanced_Options_6178", message: "Advanced Options" }, + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: { code: 6179, category: ts.DiagnosticCategory.Message, key: "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", message: "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'." }, + Enable_all_strict_type_checking_options: { code: 6180, category: ts.DiagnosticCategory.Message, key: "Enable_all_strict_type_checking_options_6180", message: "Enable all strict type-checking options." }, + List_of_language_service_plugins: { code: 6181, category: ts.DiagnosticCategory.Message, key: "List_of_language_service_plugins_6181", message: "List of language service plugins." }, + Scoped_package_detected_looking_in_0: { code: 6182, category: ts.DiagnosticCategory.Message, key: "Scoped_package_detected_looking_in_0_6182", message: "Scoped package detected, looking in '{0}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3159,7 +3237,7 @@ var ts; _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists." }, Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, @@ -3183,7 +3261,7 @@ var ts; parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -3191,28 +3269,40 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'." }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: '{0}'." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig." }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, - Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, - Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, - Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}." }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}." }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." }, + Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." }, + Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'." }, + Disable_checking_for_this_file: { code: 90018, category: ts.DiagnosticCategory.Message, key: "Disable_checking_for_this_file_90018", message: "Disable checking for this file." }, + Ignore_this_error_message: { code: 90019, category: ts.DiagnosticCategory.Message, key: "Ignore_this_error_message_90019", message: "Ignore this error message." }, + Initialize_property_0_in_the_constructor: { code: 90020, category: ts.DiagnosticCategory.Message, key: "Initialize_property_0_in_the_constructor_90020", message: "Initialize property '{0}' in the constructor." }, + Initialize_static_property_0: { code: 90021, category: ts.DiagnosticCategory.Message, key: "Initialize_static_property_0_90021", message: "Initialize static property '{0}'." }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, + Report_errors_in_js_files: { code: 8019, category: ts.DiagnosticCategory.Message, key: "Report_errors_in_js_files_8019", message: "Report errors in .js files." }, }; })(ts || (ts = {})); var ts; @@ -3221,7 +3311,7 @@ var ts; return token >= 70; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116, "any": 118, "as": 117, @@ -3245,7 +3335,7 @@ var ts; "false": 85, "finally": 86, "for": 87, - "from": 138, + "from": 139, "function": 88, "get": 124, "if": 89, @@ -3263,27 +3353,28 @@ var ts; "new": 93, "null": 94, "number": 132, + "object": 133, "package": 110, "private": 111, "protected": 112, "public": 113, "readonly": 130, "require": 131, - "global": 139, + "global": 140, "return": 95, - "set": 133, + "set": 134, "static": 114, - "string": 134, + "string": 135, "super": 96, "switch": 97, - "symbol": 135, + "symbol": 136, "this": 98, "throw": 99, "true": 100, "try": 101, - "type": 136, + "type": 137, "typeof": 102, - "undefined": 137, + "undefined": 138, "var": 103, "void": 104, "while": 105, @@ -3291,7 +3382,7 @@ var ts; "yield": 115, "async": 119, "await": 120, - "of": 140, + "of": 141, "{": 16, "}": 17, "(": 18, @@ -3386,9 +3477,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -3397,7 +3488,7 @@ var ts; } ts.tokenToString = tokenToString; function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; function computeLineStarts(text) { @@ -3457,7 +3548,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -3593,7 +3683,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -3746,7 +3836,7 @@ var ts; if (!comments) { comments = []; } - comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); return comments; } function getLeadingCommentRanges(text, pos) { @@ -3779,7 +3869,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -3798,6 +3888,7 @@ var ts; var precedingLineBreak; var hasExtendedUnicodeEscape; var tokenIsUnterminated; + var numericLiteralFlags; setText(text, start, length); return { getStartPos: function () { return startPos; }, @@ -3811,6 +3902,7 @@ var ts; isIdentifier: function () { return token === 70 || token > 106; }, isReservedWord: function () { return token >= 71 && token <= 106; }, isUnterminated: function () { return tokenIsUnterminated; }, + getNumericLiteralFlags: function () { return numericLiteralFlags; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -3847,6 +3939,7 @@ var ts; var end = pos; if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { pos++; + numericLiteralFlags = 2; if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) pos++; if (isDigit(text.charCodeAt(pos))) { @@ -4116,8 +4209,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70; @@ -4146,6 +4242,7 @@ var ts; hasExtendedUnicodeEscape = false; precedingLineBreak = false; tokenIsUnterminated = false; + numericLiteralFlags = 0; while (true) { tokenPos = pos; if (pos >= end) { @@ -4327,6 +4424,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 8; return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { @@ -4337,6 +4435,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 16; return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { @@ -4347,10 +4446,12 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 32; return token = 8; } if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); + numericLiteralFlags = 4; return token = 8; } case 49: @@ -4597,7 +4698,14 @@ var ts; while (pos < end) { pos++; char = text.charCodeAt(pos); - if ((char === 123) || (char === 60)) { + if (char === 123) { + break; + } + if (char === 60) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7; + } break; } } @@ -4783,6 +4891,19 @@ var ts; return undefined; } ts.getDeclarationOfKind = getDeclarationOfKind; + function findDeclaration(symbol, predicate) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + if (predicate(declaration)) { + return declaration; + } + } + } + return undefined; + } + ts.findDeclaration = findDeclaration; var stringWriters = []; function getSingleLineStringWriter() { if (stringWriters.length === 0) { @@ -4796,13 +4917,15 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, writeLine: function () { return str_1 += " "; }, increaseIndent: ts.noop, decreaseIndent: ts.noop, clear: function () { return str_1 = ""; }, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; } return stringWriters.pop(); @@ -4818,25 +4941,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; function moduleResolutionIsEqualTo(oldResolution, newResolution) { @@ -4855,7 +4978,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -4868,21 +4991,21 @@ var ts; ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304) !== 0; + return (node.flags & 131072) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608)) { - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576) !== 0) || + if (!(node.flags & 262144)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304; + node.flags |= 131072; } - node.flags |= 8388608; + node.flags |= 262144; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261) { + while (node && node.kind !== 264) { node = node.parent; } return node; @@ -4890,11 +5013,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204: - case 232: - case 211: - case 212: + case 206: + case 234: case 213: + case 214: + case 215: return true; } return false; @@ -4949,6 +5072,10 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; + function isToken(n) { + return n.kind >= 0 && n.kind <= 141; + } + ts.isToken = isToken; function getTokenPosOfNode(node, sourceFile, includeJsDoc) { if (nodeIsMissing(node)) { return node.pos; @@ -4959,18 +5086,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 292 && node._children.length > 0) { + if (node.kind === 293 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 288; + return node.kind >= 266 && node.kind <= 292; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 291; + return node.kind >= 282 && node.kind <= 292; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -5001,16 +5128,9 @@ var ts; return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; - function getLiteralText(node, sourceFile, languageVersion) { - if (languageVersion < 2 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); - } + function getLiteralText(node, sourceFile) { if (!nodeIsSynthesized(node) && node.parent) { - var text = getSourceTextOfNodeFromSourceFile(sourceFile, node); - if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { - return node.text; - } - return text; + return getSourceTextOfNodeFromSourceFile(sourceFile, node); } switch (node.kind) { case 9: @@ -5029,19 +5149,6 @@ var ts; ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); } ts.getLiteralText = getLiteralText; - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98: - case 66: - case 111: - case 79: - return true; - } - } - return false; - } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -5049,10 +5156,6 @@ var ts; return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; } ts.escapeIdentifier = escapeIdentifier; - function unescapeIdentifier(identifier) { - return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; - } - ts.unescapeIdentifier = unescapeIdentifier; function makeIdentifierFromModuleName(moduleName) { return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } @@ -5064,11 +5167,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 && node.parent.kind === 256; + return node.kind === 225 && node.parent.kind === 259; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 && + return node && node.kind === 232 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -5077,11 +5180,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 230 && (!node.body); + return node && node.kind === 232 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 || - node.kind === 230 || + return node.kind === 264 || + node.kind === 232 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -5094,32 +5197,36 @@ var ts; return false; } switch (node.parent.kind) { - case 261: + case 264: return ts.isExternalModule(node.parent); - case 231: + case 233: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261: + case 264: + case 234: + case 259: case 232: - case 256: - case 230: - case 211: - case 212: case 213: - case 150: - case 149: + case 214: + case 215: case 151: + case 150: case 152: - case 225: - case 184: + case 153: + case 227: case 185: + case 186: return true; - case 204: + case 206: return parentNode && !isFunctionLike(parentNode); } return false; @@ -5139,6 +5246,10 @@ var ts; return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); } ts.declarationNameToString = declarationNameToString; + function getNameFromIndexInfo(info) { + return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined; + } + ts.getNameFromIndexInfo = getNameFromIndexInfo; function getTextOfPropertyName(name) { switch (name.kind) { case 70: @@ -5146,7 +5257,7 @@ var ts; case 9: case 8: return name.text; - case 142: + case 143: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -5157,10 +5268,10 @@ var ts; function entityNameToString(name) { switch (name.kind) { case 70: - return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141: + return getFullWidth(name) === 0 ? ts.unescapeIdentifier(name.text) : getTextOfNode(name); + case 142: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177: + case 178: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -5197,7 +5308,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204) { + if (node.body && node.body.kind === 206) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -5209,29 +5320,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261: + case 264: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 223: - case 174: - case 226: - case 197: - case 227: - case 230: - case 229: - case 260: case 225: - case 184: - case 149: - case 151: - case 152: + case 175: case 228: + case 198: + case 229: + case 232: + case 231: + case 263: + case 227: + case 185: + case 150: + case 152: + case 153: + case 230: errorNode = node.name; break; - case 185: + case 186: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -5252,7 +5363,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 && isConst(node); + return node.kind === 231 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -5265,11 +5376,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 && n.expression.kind === 96; + return n.kind === 180 && n.expression.kind === 96; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 + return node.kind === 209 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -5282,10 +5393,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 || - node.kind === 143 || - node.kind === 184 || - node.kind === 185) ? + var commentRanges = (node.kind === 145 || + node.kind === 144 || + node.kind === 185 || + node.kind === 186) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, function (comment) { @@ -5299,96 +5410,110 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 <= node.kind && node.kind <= 171) { + if (157 <= node.kind && node.kind <= 172) { return true; } switch (node.kind) { case 118: case 132: - case 134: - case 121: case 135: - case 137: + case 121: + case 136: + case 138: case 129: return true; case 104: - return node.parent.kind !== 188; - case 199: + return node.parent.kind !== 189; + case 200: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 70: - if (node.parent.kind === 141 && node.parent.right === node) { + if (node.parent.kind === 142 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 && node.parent.name === node) { + else if (node.parent.kind === 178 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141: - case 177: + ts.Debug.assert(node.kind === 70 || node.kind === 142 || node.kind === 178, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142: + case 178: case 98: - var parent_1 = node.parent; - if (parent_1.kind === 160) { + var parent = node.parent; + if (parent.kind === 161) { return false; } - if (156 <= parent_1.kind && parent_1.kind <= 171) { + if (157 <= parent.kind && parent.kind <= 172) { return true; } - switch (parent_1.kind) { - case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143: - return node === parent_1.constraint; - case 147: - case 146: + switch (parent.kind) { + case 200: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 144: - case 223: - return node === parent_1.type; + return node === parent.constraint; + case 148: + case 147: + case 145: case 225: - case 184: + return node === parent.type; + case 227: case 185: + case 186: + case 151: case 150: case 149: - case 148: - case 151: case 152: - return node === parent_1.type; case 153: + return node === parent.type; case 154: case 155: - return node === parent_1.type; - case 182: - return node === parent_1.type; - case 179: + case 156: + return node === parent.type; + case 183: + return node === parent.type; case 180: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 181: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182: return false; } } return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 191; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216: + case 218: return visitor(node); - case 232: - case 204: - case 208: - case 209: + case 234: + case 206: case 210: case 211: case 212: case 213: - case 217: - case 218: - case 253: - case 254: + case 214: + case 215: case 219: - case 221: + case 220: case 256: + case 257: + case 221: + case 223: + case 259: return ts.forEachChild(node, traverse); } } @@ -5398,24 +5523,25 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195: + case 196: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } + return; + case 231: case 229: - case 227: + case 232: case 230: case 228: - case 226: - case 197: + case 198: return; default: if (isFunctionLike(node)) { - var name_5 = node.name; - if (name_5 && name_5.kind === 142) { - traverse(name_5.expression); + var name = node.name; + if (name && name.kind === 143) { + traverse(name.expression); return; } } @@ -5426,17 +5552,29 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + function getRestParameterElementType(node) { + if (node && node.kind === 163) { + return node.elementType; + } + else if (node && node.kind === 158) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174: + case 175: + case 263: + case 145: case 260: - case 144: - case 257: + case 148: case 147: - case 146: - case 258: - case 223: + case 261: + case 225: return true; } } @@ -5444,11 +5582,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 || node.kind === 152); + return node && (node.kind === 152 || node.kind === 153); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 || node.kind === 197); + return node && (node.kind === 228 || node.kind === 198); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -5457,19 +5595,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150: - case 184: - case 225: + case 151: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return true; } return false; @@ -5477,13 +5615,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 225: - case 184: + case 153: + case 227: + case 185: return true; } return false; @@ -5491,30 +5629,42 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 213: + case 214: + case 215: case 211: case 212: - case 213: - case 209: - case 210: return true; - case 219: + case 221: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 221) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 && isFunctionLike(node.parent); + return node && node.kind === 206 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 && node.parent.kind === 176; + return node && node.kind === 150 && node.parent.kind === 177; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 && - (node.parent.kind === 176 || - node.parent.kind === 197); + return node.kind === 150 && + (node.parent.kind === 177 || + node.parent.kind === 198); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -5550,44 +5700,57 @@ var ts; return undefined; } switch (node.kind) { - case 142: + case 143: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 185: + case 186: if (!includeArrowFunctions) { continue; } - case 225: - case 184: - case 230: - case 147: - case 146: - case 149: + case 227: + case 185: + case 232: case 148: + case 147: case 150: + case 149: case 151: case 152: case 153: case 154: case 155: - case 229: - case 261: + case 156: + case 231: + case 264: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, false); + if (container) { + switch (container.kind) { + case 151: + case 227: + case 185: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; @@ -5595,25 +5758,25 @@ var ts; return node; } switch (node.kind) { - case 142: + case 143: node = node.parent; break; - case 225: - case 184: + case 227: case 185: + case 186: if (!stopOnFunctions) { continue; } - case 147: - case 146: - case 149: case 148: + case 147: case 150: + case 149: case 151: case 152: + case 153: return node; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { @@ -5625,36 +5788,36 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 || func.kind === 185) { + if (func.kind === 185 || func.kind === 186) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent = func.parent; + while (parent.kind === 184) { + prev = parent; + parent = parent.parent; } - if (parent_2.kind === 179 && parent_2.expression === prev) { - return parent_2; + if (parent.kind === 180 && parent.expression === prev) { + return parent; } } } ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 || kind === 178) + return (kind === 178 || kind === 179) && node.expression.kind === 96; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157: - case 272: + case 158: + case 276: return node.typeName; - case 199: + case 200: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70: - case 141: + case 142: return node; } return undefined; @@ -5662,10 +5825,12 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179: + case 250: + case 249: case 180: case 181: - case 145: + case 182: + case 146: return true; default: return false; @@ -5673,29 +5838,32 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181) { + if (node.kind === 182) { return node.tag; } + else if (isJsxOpeningLikeElement(node)) { + return node.tagName; + } return node.expression; } ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226: + case 228: return true; - case 147: - return node.parent.kind === 226; - case 151: + case 148: + return node.parent.kind === 228; case 152: - case 149: + case 153: + case 150: return node.body !== undefined - && node.parent.kind === 226; - case 144: + && node.parent.kind === 228; + case 145: return node.parent.body !== undefined - && (node.parent.kind === 150 - || node.parent.kind === 149 - || node.parent.kind === 152) - && node.parent.parent.kind === 226; + && (node.parent.kind === 151 + || node.parent.kind === 150 + || node.parent.kind === 153) + && node.parent.parent.kind === 228; } return false; } @@ -5711,19 +5879,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226: + case 228: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149: - case 152: + case 150: + case 153: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 || - parent.kind === 247 || - parent.kind === 249) { + if (parent.kind === 250 || + parent.kind === 249 || + parent.kind === 251) { return parent.tagName === node; } return false; @@ -5737,95 +5905,96 @@ var ts; case 100: case 85: case 11: - case 175: case 176: case 177: case 178: case 179: case 180: case 181: - case 200: case 182: case 201: case 183: + case 202: case 184: - case 197: case 185: - case 188: + case 198: case 186: + case 189: case 187: - case 190: + case 188: case 191: case 192: case 193: - case 196: case 194: - case 12: - case 198: - case 246: - case 247: + case 197: case 195: - case 189: + case 12: + case 199: + case 248: + case 249: + case 196: + case 190: + case 203: return true; - case 141: - while (node.parent.kind === 141) { + case 142: + while (node.parent.kind === 142) { node = node.parent; } - return node.parent.kind === 160 || isJSXTagName(node); + return node.parent.kind === 161 || isJSXTagName(node); case 70: - if (node.parent.kind === 160 || isJSXTagName(node)) { + if (node.parent.kind === 161 || isJSXTagName(node)) { return true; } case 8: case 9: case 98: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 223: - case 144: + var parent = node.parent; + switch (parent.kind) { + case 225: + case 145: + case 148: case 147: - case 146: + case 263: case 260: - case 257: - case 174: - return parent_3.initializer === node; - case 207: - case 208: + case 175: + return parent.initializer === node; case 209: case 210: - case 216: - case 217: + case 211: + case 212: case 218: - case 253: + case 219: case 220: - case 218: - return parent_3.expression === node; - case 211: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224) || + case 256: + case 222: + case 220: + return parent.expression === node; + case 213: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226) || forStatement.condition === node || forStatement.incrementor === node; - case 212: - case 213: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) || + case 214: + case 215: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226) || forInStatement.expression === node; - case 182: - case 200: - return node === parent_3.expression; - case 202: - return node === parent_3.expression; - case 142: - return node === parent_3.expression; - case 145: - case 252: - case 251: - case 259: + case 183: + case 201: + return node === parent.expression; + case 204: + return node === parent.expression; + case 143: + return node === parent.expression; + case 146: + case 255: + case 254: + case 262: return true; - case 199: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + case 200: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent)) { return true; } } @@ -5840,7 +6009,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind === 245; + return node.kind === 236 && node.moduleReference.kind === 247; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5849,7 +6018,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind !== 245; + return node.kind === 236 && node.moduleReference.kind !== 247; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5857,38 +6026,57 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152); + return node && !!(node.flags & 65536); } ts.isInJavaScriptFile = isInJavaScriptFile; - function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 179 && - expression.expression.kind === 70 && - expression.expression.text === "require" && - expression.arguments.length === 1; - return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9); + function isRequireCall(callExpression, checkArgumentIsStringLiteral) { + if (callExpression.kind !== 180) { + return false; + } + var _a = callExpression, expression = _a.expression, args = _a.arguments; + if (expression.kind !== 70 || expression.text !== "require") { + return false; + } + if (args.length !== 1) { + return false; + } + var arg = args[0]; + return !checkArgumentIsStringLiteral || arg.kind === 9 || arg.kind === 12; } ts.isRequireCall = isRequireCall; function isSingleOrDoubleQuote(charCode) { return charCode === 39 || charCode === 34; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; - function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223) { + function isDeclarationOfFunctionOrClassExpression(s) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184; + return declaration.initializer && (declaration.initializer.kind === 185 || declaration.initializer.kind === 198); } return false; } - ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression; + ts.isDeclarationOfFunctionOrClassExpression = isDeclarationOfFunctionOrClassExpression; + function getRightMostAssignedExpression(node) { + while (isAssignmentExpression(node, true)) { + node = node.right; + } + return node; + } + ts.getRightMostAssignedExpression = getRightMostAssignedExpression; + function isExportsIdentifier(node) { + return isIdentifier(node) && node.text === "exports"; + } + ts.isExportsIdentifier = isExportsIdentifier; + function isModuleExportsPropertyAccessExpression(node) { + return isPropertyAccessExpression(node) && isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports"; + } + ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression; function getSpecialPropertyAssignmentKind(expression) { if (!isInJavaScriptFile(expression)) { return 0; } - if (expression.kind !== 192) { - return 0; - } var expr = expression; - if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) { + if (expr.operatorToken.kind !== 57 || expr.left.kind !== 178) { return 0; } var lhs = expr.left; @@ -5900,11 +6088,14 @@ var ts; else if (lhsId.text === "module" && lhs.name.text === "exports") { return 2; } + else { + return 5; + } } else if (lhs.expression.kind === 98) { return 4; } - else if (lhs.expression.kind === 177) { + else if (lhs.expression.kind === 178) { var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70) { var innerPropertyAccessIdentifier = innerPropertyAccess.expression; @@ -5920,35 +6111,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235) { + if (node.kind === 237) { return node.moduleSpecifier; } - if (node.kind === 234) { + if (node.kind === 236) { var reference = node.moduleReference; - if (reference.kind === 245) { + if (reference.kind === 247) { return reference.expression; } } - if (node.kind === 241) { + if (node.kind === 243) { return node.moduleSpecifier; } - if (node.kind === 230 && node.name.kind === 9) { + if (node.kind === 232 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234) { + if (node.kind === 236) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 + return node.kind === 237 && node.importClause && !!node.importClause.name; } @@ -5956,13 +6147,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144: + case 145: + case 150: case 149: + case 261: + case 260: case 148: - case 258: - case 257: case 147: - case 146: return node.questionToken !== undefined; } } @@ -5970,28 +6161,36 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 && + return node.kind === 278 && node.parameters.length > 0 && - node.parameters[0].type.kind === 276; + node.parameters[0].type.kind === 280; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function hasJSDocParameterTags(node) { + var parameterTags = getJSDocTags(node, 285); + return parameterTags && parameterTags.length > 0; + } + ts.hasJSDocParameterTags = hasJSDocParameterTags; function getJSDocTags(node, kind) { var docs = getJSDocs(node); if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281) { + if (doc.kind === 285) { if (doc.kind === kind) { result.push(doc); } } else { - result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); + var tags = doc.tags; + if (tags) { + result.push.apply(result, ts.filter(tags, function (tag) { return tag.kind === kind; })); + } } } return result; @@ -6011,9 +6210,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205; + parent.parent.parent.kind === 207; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205; + parent.parent.kind === 207; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -6021,19 +6220,19 @@ var ts; getJSDocsWorker(variableStatementNode); } var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 && + parent.kind === 193 && parent.operatorToken.kind === 57 && - parent.parent.kind === 207; + parent.parent.kind === 209; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 && - parent && parent.kind === 230; - var isPropertyAssignmentExpression = parent && parent.kind === 257; + var isModuleDeclaration = node.kind === 232 && + parent && parent.kind === 232; + var isPropertyAssignmentExpression = parent && parent.kind === 260; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } - if (node.kind === 144) { + if (node.kind === 145) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -6042,22 +6241,23 @@ var ts; cache = ts.concatenate(cache, node.jsDoc); } } + ts.getJSDocs = getJSDocs; function getJSDocParameterTags(param) { if (!isParameter(param)) { return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281); + var tags = getJSDocTags(func, 285); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 285; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { - var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_6; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 285 && tag.parameterName.text === name_1; }); } else { return undefined; @@ -6065,8 +6265,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283); - if (!tag && node.kind === 144) { + var tag = getFirstJSDocTag(node, 287); + if (!tag && node.kind === 145) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -6076,15 +6276,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 284); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 286); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284); + return getFirstJSDocTag(node, 288); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -6096,9 +6296,9 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152)) { - if (node.type && node.type.kind === 275 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { + if (node && (node.flags & 65536)) { + if (node.type && node.type.kind === 279 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 279; })) { return true; } } @@ -6113,28 +6313,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192: + case 193: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 ? 1 : 2 : 0; - case 190: case 191: + case 192: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 212: - case 213: + case 214: + case 215: return parent.initializer === node ? 1 : 0; - case 183: - case 175: - case 196: + case 184: + case 176: + case 197: node = parent; break; - case 258: + case 261: if (parent.name !== node) { return 0; } - case 257: + node = parent.parent; + break; + case 260: + if (parent.name === node) { + return 0; + } node = parent.parent; break; default: @@ -6148,6 +6353,17 @@ var ts; return getAssignmentTargetKind(node) !== 0; } ts.isAssignmentTarget = isAssignmentTarget; + function isDeleteTarget(node) { + if (node.kind !== 178 && node.kind !== 179) { + return false; + } + node = node.parent; + while (node && node.kind === 184) { + node = node.parent; + } + return node && node.kind === 187; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -6159,7 +6375,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 264 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -6172,7 +6388,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 || parent.kind === 243) { + if (parent.kind === 241 || parent.kind === 245) { if (parent.propertyName) { return true; } @@ -6185,48 +6401,48 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 || node.kind === 8) && - node.parent.kind === 142 && + node.parent.kind === 143 && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 151: case 152: + case 153: + case 263: case 260: - case 257: - case 177: + case 178: return parent.name === node; - case 141: + case 142: if (parent.right === node) { - while (parent.kind === 141) { + while (parent.kind === 142) { parent = parent.parent; } - return parent.kind === 160; + return parent.kind === 161; } return false; - case 174: - case 239: + case 175: + case 241: return parent.propertyName === node; - case 243: + case 245: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 234 || - node.kind === 233 || - node.kind === 236 && !!node.name || - node.kind === 237 || + return node.kind === 236 || + node.kind === 235 || + node.kind === 238 && !!node.name || node.kind === 239 || - node.kind === 243 || - node.kind === 240 && exportAssignmentIsAlias(node); + node.kind === 241 || + node.kind === 245 || + node.kind === 242 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -6312,17 +6528,51 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 <= token && token <= 140; + return 71 <= token && token <= 141; } ts.isKeyword = isKeyword; function isTrivia(token) { return 2 <= token && token <= 7; } ts.isTrivia = isTrivia; - function isAsyncFunctionLike(node) { - return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node); + function getFunctionFlags(node) { + var flags = 0; + switch (node.kind) { + case 227: + case 185: + case 150: + if (node.asteriskToken) { + flags |= 1; + } + case 186: + if (hasModifier(node, 256)) { + flags |= 2; + } + break; + } + if (!node.body) { + flags |= 4; + } + return flags; } - ts.isAsyncFunctionLike = isAsyncFunctionLike; + ts.getFunctionFlags = getFunctionFlags; + function isAsyncFunction(node) { + switch (node.kind) { + case 227: + case 185: + case 186: + case 150: + return node.body !== undefined + && node.asteriskToken === undefined + && hasModifier(node, 256); + } + return false; + } + ts.isAsyncFunction = isAsyncFunction; + function isNumericLiteral(node) { + return node.kind === 8; + } + ts.isNumericLiteral = isNumericLiteral; function isStringOrNumericLiteral(node) { var kind = node.kind; return kind === 9 @@ -6334,7 +6584,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 && + return name.kind === 143 && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -6344,10 +6594,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) { + if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 145) { return name.text; } - if (name.kind === 142) { + if (name.kind === 143) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6392,11 +6642,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144; + return root.kind === 145; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174) { + while (node.kind === 175) { node = node.parent.parent; } return node; @@ -6404,15 +6654,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 - || kind === 184 - || kind === 225 + return kind === 151 || kind === 185 - || kind === 149 - || kind === 151 + || kind === 227 + || kind === 186 + || kind === 150 || kind === 152 - || kind === 230 - || kind === 261; + || kind === 153 + || kind === 232 + || kind === 264; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -6420,66 +6670,44 @@ var ts; || ts.positionIsSynthesized(node.end); } ts.nodeIsSynthesized = nodeIsSynthesized; - function getOriginalNode(node, nodeTest) { - if (node) { - while (node.original !== undefined) { - node = node.original; - } + function getOriginalSourceFileOrBundle(sourceFileOrBundle) { + if (sourceFileOrBundle.kind === 265) { + return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, getOriginalSourceFile)); } - return !nodeTest || nodeTest(node) ? node : undefined; + return getOriginalSourceFile(sourceFileOrBundle); } - ts.getOriginalNode = getOriginalNode; - function isParseTreeNode(node) { - return (node.flags & 8) === 0; + ts.getOriginalSourceFileOrBundle = getOriginalSourceFileOrBundle; + function getOriginalSourceFile(sourceFile) { + return ts.getParseTreeNode(sourceFile, isSourceFile) || sourceFile; } - ts.isParseTreeNode = isParseTreeNode; - function getParseTreeNode(node, nodeTest) { - if (isParseTreeNode(node)) { - return node; - } - node = getOriginalNode(node); - if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { - return node; - } - return undefined; - } - ts.getParseTreeNode = getParseTreeNode; function getOriginalSourceFiles(sourceFiles) { - var originalSourceFiles = []; - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; - var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile); - if (originalSourceFile) { - originalSourceFiles.push(originalSourceFile); - } - } - return originalSourceFiles; + return ts.sameMap(sourceFiles, getOriginalSourceFile); } ts.getOriginalSourceFiles = getOriginalSourceFiles; function getOriginalNodeId(node) { - node = getOriginalNode(node); + node = ts.getOriginalNode(node); return node ? ts.getNodeId(node) : 0; } ts.getOriginalNodeId = getOriginalNodeId; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180: + case 181: return hasArguments ? 0 : 1; - case 190: - case 187: + case 191: case 188: - case 186: case 189: - case 193: - case 195: + case 187: + case 190: + case 194: + case 196: return 1; - case 192: + case 193: switch (operator) { case 39: case 57: @@ -6503,15 +6731,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192) { + if (expression.kind === 193) { return expression.operatorToken.kind; } - else if (expression.kind === 190 || expression.kind === 191) { + else if (expression.kind === 191 || expression.kind === 192) { return expression.operator; } else { @@ -6529,37 +6757,36 @@ var ts; case 85: case 8: case 9: - case 175: case 176: - case 184: + case 177: case 185: - case 197: - case 246: - case 247: + case 186: + case 198: + case 248: + case 249: case 11: case 12: - case 194: - case 183: - case 198: - case 297: + case 195: + case 184: + case 199: return 19; - case 181: - case 177: + case 182: case 178: + case 179: return 18; - case 180: + case 181: return hasArguments ? 18 : 17; - case 179: + case 180: return 17; - case 191: + case 192: return 16; - case 190: - case 187: + case 191: case 188: - case 186: case 189: + case 187: + case 190: return 15; - case 192: + case 193: switch (operatorKind) { case 50: case 51: @@ -6617,11 +6844,11 @@ var ts; default: return -1; } - case 193: + case 194: return 4; - case 195: - return 2; case 196: + return 2; + case 197: return 1; default: return -1; @@ -6644,21 +6871,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -6675,16 +6896,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -6693,14 +6914,14 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -6715,13 +6936,12 @@ var ts; "\u0085": "\\u0085" }); function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -6864,129 +7084,62 @@ var ts; ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); - } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); - } - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); if (options.outFile || options.out) { - onBundledEmit(sourceFiles); - } - else { - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false); - } - function onBundledEmit(sourceFiles) { if (sourceFiles.length) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : ""; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, ts.createBundle(sourceFiles), emitOnlyDtsFiles); + } + } + else { + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFile, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1) { + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -7011,7 +7164,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 && nodeIsPresent(member.body)) { + if (member.kind === 151 && nodeIsPresent(member.body)) { return member; } }); @@ -7052,10 +7205,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151) { + if (accessor.kind === 152) { getAccessor = accessor; } - else if (accessor.kind === 152) { + else if (accessor.kind === 153) { setAccessor = accessor; } else { @@ -7064,7 +7217,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 || member.kind === 152) + if ((member.kind === 152 || member.kind === 153) && hasModifier(member, 32) === hasModifier(accessor, 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -7075,10 +7228,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 && !getAccessor) { + if (member.kind === 152 && !getAccessor) { getAccessor = member; } - if (member.kind === 152 && !setAccessor) { + if (member.kind === 153 && !setAccessor) { setAccessor = member; } } @@ -7296,7 +7449,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 && + if (node.kind === 200 && node.parent.token === 84 && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -7314,8 +7467,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 176 - || kind === 175; + return kind === 177 + || kind === 176; } return false; } @@ -7339,31 +7492,42 @@ var ts; return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; + function isExpressionWithTypeArgumentsInClassImplementsClause(node) { + return node.kind === 200 + && isEntityNameExpression(node.expression) + && node.parent + && node.parent.token === 107 + && node.parent.parent + && isClassLike(node.parent.parent); + } + ts.isExpressionWithTypeArgumentsInClassImplementsClause = isExpressionWithTypeArgumentsInClassImplementsClause; function isEntityNameExpression(node) { return node.kind === 70 || - node.kind === 177 && isEntityNameExpression(node.expression); + node.kind === 178 && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 && node.parent.right === node) || - (node.parent.kind === 177 && node.parent.name === node); + return (node.parent.kind === 142 && node.parent.right === node) || + (node.parent.kind === 178 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; - function isEmptyObjectLiteralOrArrayLiteral(expression) { - var kind = expression.kind; - if (kind === 176) { - return expression.properties.length === 0; - } - if (kind === 175) { - return expression.elements.length === 0; - } - return false; + function isEmptyObjectLiteral(expression) { + return expression.kind === 177 && + expression.properties.length === 0; + } + ts.isEmptyObjectLiteral = isEmptyObjectLiteral; + function isEmptyArrayLiteral(expression) { + return expression.kind === 176 && + expression.elements.length === 0; } - ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; + ts.isEmptyArrayLiteral = isEmptyArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512); + } function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } @@ -7397,39 +7561,6 @@ var ts; } return output; } - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - function stringifyFallback(value) { - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function convertToBase64(input) { var result = ""; @@ -7488,39 +7619,39 @@ var ts; || kind === 94) { return true; } - else if (kind === 177) { + else if (kind === 178) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178) { + else if (kind === 179) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 - || kind === 191) { + else if (kind === 191 + || kind === 192) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192) { + else if (kind === 193) { return node.operatorToken.kind !== 39 && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193) { + else if (kind === 194) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 - || kind === 187 - || kind === 186) { + else if (kind === 189 + || kind === 188 + || kind === 187) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175) { + else if (kind === 176) { return node.elements.length === 0; } - else if (kind === 176) { + else if (kind === 177) { return node.properties.length === 0; } - else if (kind === 179) { + else if (kind === 180) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -7535,16 +7666,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_7 in syntaxKindEnum) { - if (syntaxKindEnum[name_7] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_7 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -7553,6 +7687,14 @@ var ts; } } ts.formatSyntaxKind = formatSyntaxKind; + function getRangePos(range) { + return range ? range.pos : -1; + } + ts.getRangePos = getRangePos; + function getRangeEnd(range) { + return range ? range.end : -1; + } + ts.getRangeEnd = getRangeEnd; function movePos(pos, value) { return ts.positionIsSynthesized(pos) ? -1 : pos + value; } @@ -7627,11 +7769,11 @@ var ts; } ts.getStartPositionOfRange = getStartPositionOfRange; function isDeclarationNameOfEnumOrNamespace(node) { - var parseNode = getParseTreeNode(node); + var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229: - case 230: + case 231: + case 232: return parseNode === parseNode.parent.name; } } @@ -7649,7 +7791,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 && declaration !== node) { + if (declaration.kind === 228 && declaration !== node) { return true; } } @@ -7700,6 +7842,10 @@ var ts; return node.kind === 70; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 189; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { return isIdentifier(node) && node.autoGenerateKind > 0; } @@ -7709,16 +7855,16 @@ var ts; } ts.isModifier = isModifier; function isQualifiedName(node) { - return node.kind === 141; + return node.kind === 142; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142; + return node.kind === 143; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 + return kind === 142 || kind === 70; } ts.isEntityName = isEntityName; @@ -7727,7 +7873,7 @@ var ts; return kind === 70 || kind === 9 || kind === 8 - || kind === 142; + || kind === 143; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -7739,101 +7885,105 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 - || kind === 172 - || kind === 173; + || kind === 173 + || kind === 174; } ts.isBindingName = isBindingName; function isTypeParameter(node) { - return node.kind === 143; + return node.kind === 144; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144; + return node.kind === 145; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145; + return node.kind === 146; } ts.isDecorator = isDecorator; function isMethodDeclaration(node) { - return node.kind === 149; + return node.kind === 150; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 - || kind === 147 - || kind === 149 - || kind === 151 + return kind === 151 + || kind === 148 + || kind === 150 || kind === 152 - || kind === 155 - || kind === 203; + || kind === 153 + || kind === 156 + || kind === 205; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 - || kind === 258 - || kind === 259 - || kind === 149 - || kind === 151 + return kind === 260 + || kind === 261 + || kind === 262 + || kind === 150 || kind === 152 - || kind === 244; + || kind === 153 + || kind === 246; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 156 && kind <= 171) + return (kind >= 157 && kind <= 172) || kind === 118 || kind === 132 + || kind === 133 || kind === 121 - || kind === 134 || kind === 135 + || kind === 136 + || kind === 98 || kind === 104 + || kind === 138 + || kind === 94 || kind === 129 - || kind === 199; + || kind === 200; } function isTypeNode(node) { return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; function isArrayBindingPattern(node) { - return node.kind === 173; + return node.kind === 174; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172; + return node.kind === 173; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 - || kind === 172; + return kind === 174 + || kind === 173; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 - || kind === 176; + return kind === 176 + || kind === 177; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174; + return node.kind === 175; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 - || kind === 198; + return kind === 175 + || kind === 199; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223: - case 144: - case 174: + case 225: + case 145: + case 175: return true; } return false; @@ -7846,8 +7996,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172: - case 176: + case 173: + case 177: return true; } return false; @@ -7855,94 +8005,100 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: + case 174: + case 176: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { - return node.kind === 175; + return node.kind === 176; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176; + return node.kind === 177; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177; + return node.kind === 178; } ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isPropertyAccessOrQualifiedName(node) { + var kind = node.kind; + return kind === 178 + || kind === 142; + } + ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isElementAccessExpression(node) { - return node.kind === 178; + return node.kind === 179; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179; + return node.kind === 180; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 + return kind === 195 || kind === 12; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199; + return node.kind === 200; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 - || kind === 178 - || kind === 180 + return kind === 178 || kind === 179 - || kind === 246 - || kind === 247 || kind === 181 - || kind === 175 - || kind === 183 + || kind === 180 + || kind === 248 + || kind === 249 + || kind === 182 || kind === 176 - || kind === 197 || kind === 184 + || kind === 177 + || kind === 198 + || kind === 185 || kind === 70 || kind === 11 || kind === 8 || kind === 9 || kind === 12 - || kind === 194 + || kind === 195 || kind === 85 || kind === 94 || kind === 98 || kind === 100 || kind === 96 - || kind === 201 - || kind === 297; + || kind === 202 + || kind === 203; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 - || kind === 191 - || kind === 186 + return kind === 191 + || kind === 192 || kind === 187 || kind === 188 || kind === 189 - || kind === 182 + || kind === 190 + || kind === 183 || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -7950,14 +8106,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 - || kind === 195 - || kind === 185 - || kind === 192 + return kind === 194 || kind === 196 - || kind === 200 - || kind === 198 - || kind === 297 + || kind === 186 + || kind === 193 + || kind === 197 + || kind === 201 + || kind === 199 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -7966,16 +8121,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 - || kind === 200; + return kind === 183 + || kind === 201; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294; + return node.kind === 295; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293; + return node.kind === 294; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -7984,15 +8139,15 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 202; + return node.kind === 204; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 204; + return node.kind === 206; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -8010,121 +8165,135 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223; + return node.kind === 225; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224; + return node.kind === 226; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232; + return node.kind === 234; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 - || kind === 230; + return kind === 233 + || kind === 232 + || kind === 70; } ts.isModuleBody = isModuleBody; + function isNamespaceBody(node) { + var kind = node.kind; + return kind === 233 + || kind === 232; + } + ts.isNamespaceBody = isNamespaceBody; + function isJSDocNamespaceBody(node) { + var kind = node.kind; + return kind === 70 + || kind === 232; + } + ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isImportEqualsDeclaration(node) { - return node.kind === 234; + return node.kind === 236; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236; + return node.kind === 238; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 240 + || kind === 239; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239; + return node.kind === 241; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242; + return node.kind === 244; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243; + return node.kind === 245; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 || node.kind === 229; + return node.kind === 232 || node.kind === 231; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 - || kind === 174 - || kind === 226 - || kind === 197 - || kind === 150 - || kind === 229 - || kind === 260 - || kind === 243 - || kind === 225 - || kind === 184 + return kind === 186 + || kind === 175 + || kind === 228 + || kind === 198 || kind === 151 - || kind === 236 - || kind === 234 - || kind === 239 + || kind === 231 + || kind === 263 + || kind === 245 || kind === 227 + || kind === 185 + || kind === 152 + || kind === 238 + || kind === 236 + || kind === 241 + || kind === 229 + || kind === 252 + || kind === 150 || kind === 149 + || kind === 232 + || kind === 235 + || kind === 239 + || kind === 145 + || kind === 260 || kind === 148 + || kind === 147 + || kind === 153 + || kind === 261 || kind === 230 - || kind === 233 - || kind === 237 || kind === 144 - || kind === 257 - || kind === 147 - || kind === 146 - || kind === 152 - || kind === 258 - || kind === 228 - || kind === 143 - || kind === 223 - || kind === 285; + || kind === 225 + || kind === 289; } function isDeclarationStatementKind(kind) { - return kind === 225 - || kind === 244 - || kind === 226 - || kind === 227 + return kind === 227 + || kind === 246 || kind === 228 || kind === 229 || kind === 230 - || kind === 235 - || kind === 234 - || kind === 241 - || kind === 240 - || kind === 233; + || kind === 231 + || kind === 232 + || kind === 237 + || kind === 236 + || kind === 243 + || kind === 242 + || kind === 235; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 + return kind === 217 + || kind === 216 + || kind === 224 + || kind === 211 + || kind === 209 + || kind === 208 || kind === 214 + || kind === 215 + || kind === 213 + || kind === 210 + || kind === 221 + || kind === 218 + || kind === 220 || kind === 222 - || kind === 209 + || kind === 223 || kind === 207 - || kind === 206 || kind === 212 - || kind === 213 - || kind === 211 - || kind === 208 || kind === 219 - || kind === 216 - || kind === 218 - || kind === 220 - || kind === 221 - || kind === 205 - || kind === 210 - || kind === 217 - || kind === 293 - || kind === 296 - || kind === 295; + || kind === 294 + || kind === 297 + || kind === 296; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -8142,87 +8311,98 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204; + || kind === 206; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 245 - || kind === 141 + return kind === 247 + || kind === 142 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 248; + return node.kind === 250; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249; + return node.kind === 251; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 || kind === 70 - || kind === 177; + || kind === 178; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 - || kind === 252 - || kind === 247 + return kind === 248 + || kind === 255 + || kind === 249 || kind === 10; } ts.isJsxChild = isJsxChild; + function isJsxAttributes(node) { + var kind = node.kind; + return kind === 253; + } + ts.isJsxAttributes = isJsxAttributes; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 - || kind === 251; + return kind === 252 + || kind === 254; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251; + return node.kind === 254; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250; + return node.kind === 252; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 252; + || kind === 255; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; + function isJsxOpeningLikeElement(node) { + var kind = node.kind; + return kind === 250 + || kind === 249; + } + ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 - || kind === 254; + return kind === 256 + || kind === 257; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255; + return node.kind === 258; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256; + return node.kind === 259; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 257; + return node.kind === 260; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 261; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 260; + return node.kind === 263; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 261; + return node.kind === 264; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -8234,10 +8414,11 @@ var ts; function getDefaultLibFileName(options) { switch (options.target) { case 5: + return "lib.esnext.full.d.ts"; case 4: - return "lib.es2017.d.ts"; + return "lib.es2017.full.d.ts"; case 3: - return "lib.es2016.d.ts"; + return "lib.es2016.full.d.ts"; case 2: return "lib.es6.d.ts"; default: @@ -8361,9 +8542,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143) { + if (d && d.kind === 144) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229) { return current; } } @@ -8371,11 +8552,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92) && node.parent.kind === 151 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -8383,14 +8564,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 226) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 207) { flags |= ts.getModifierFlags(node); } return flags; @@ -8399,14 +8580,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 226) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 207) { flags |= node.flags; } return flags; @@ -8459,24 +8640,46 @@ var ts; } } ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; + function getOriginalNode(node, nodeTest) { + if (node) { + while (node.original !== undefined) { + node = node.original; + } + } + return !nodeTest || nodeTest(node) ? node : undefined; + } + ts.getOriginalNode = getOriginalNode; + function isParseTreeNode(node) { + return (node.flags & 8) === 0; + } + ts.isParseTreeNode = isParseTreeNode; + function getParseTreeNode(node, nodeTest) { + if (node === undefined || isParseTreeNode(node)) { + return node; + } + node = getOriginalNode(node); + if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { + return node; + } + return undefined; + } + ts.getParseTreeNode = getParseTreeNode; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; })(ts || (ts = {})); var ts; (function (ts) { - var NodeConstructor; - var SourceFileConstructor; - function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 - ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) - : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); - var node = location - ? new ConstructorForKind(kind, location.pos, location.end) - : new ConstructorForKind(kind, -1, -1); - node.flags = flags | 8; + function createSynthesizedNode(kind) { + var node = ts.createNode(kind, -1, -1); + node.flags |= 8; return node; } function updateNode(updated, original) { if (updated !== original) { setOriginalNode(updated, original); + setTextRange(updated, original); if (original.startsOnNewLine) { updated.startsOnNewLine = true; } @@ -8485,7 +8688,7 @@ var ts; return updated; } ts.updateNode = updateNode; - function createNodeArray(elements, location, hasTrailingComma) { + function createNodeArray(elements, hasTrailingComma) { if (elements) { if (ts.isNodeArray(elements)) { return elements; @@ -8495,32 +8698,15 @@ var ts; elements = []; } var array = elements; - if (location) { - array.pos = location.pos; - array.end = location.end; - } - else { - array.pos = -1; - array.end = -1; - } - if (hasTrailingComma) { - array.hasTrailingComma = true; - } + array.pos = -1; + array.end = -1; + array.hasTrailingComma = hasTrailingComma; return array; } ts.createNodeArray = createNodeArray; - function createSynthesizedNode(kind, startsOnNewLine) { - var node = createNode(kind, undefined); - node.startsOnNewLine = startsOnNewLine; - return node; - } - ts.createSynthesizedNode = createSynthesizedNode; - function createSynthesizedNodeArray(elements) { - return createNodeArray(elements, undefined); - } - ts.createSynthesizedNodeArray = createSynthesizedNodeArray; function getSynthesizedClone(node) { - var clone = createNode(node.kind, undefined, node.flags); + var clone = createSynthesizedNode(node.kind); + clone.flags |= node.flags; setOriginalNode(clone, node); for (var key in node) { if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { @@ -8531,50 +8717,48 @@ var ts; return clone; } ts.getSynthesizedClone = getSynthesizedClone; - function getMutableClone(node) { - var clone = getSynthesizedClone(node); - clone.pos = node.pos; - clone.end = node.end; - clone.parent = node.parent; - return clone; - } - ts.getMutableClone = getMutableClone; - function createLiteral(value, location) { + function createLiteral(value) { if (typeof value === "number") { - var node = createNode(8, location, undefined); - node.text = value.toString(); - return node; + return createNumericLiteral(value + ""); } - else if (typeof value === "boolean") { - return createNode(value ? 100 : 85, location, undefined); + if (typeof value === "boolean") { + return value ? createTrue() : createFalse(); } - else if (typeof value === "string") { - var node = createNode(9, location, undefined); - node.text = value; - return node; - } - else if (value) { - var node = createNode(9, location, undefined); - node.textSourceNode = value; - node.text = value.text; - return node; + if (typeof value === "string") { + return createStringLiteral(value); } + return createLiteralFromNode(value); } ts.createLiteral = createLiteral; - var nextAutoGenerateId = 0; - function createIdentifier(text, location) { - var node = createNode(70, location); + function createNumericLiteral(value) { + var node = createSynthesizedNode(8); + node.text = value; + node.numericLiteralFlags = 0; + return node; + } + ts.createNumericLiteral = createNumericLiteral; + function createStringLiteral(text) { + var node = createSynthesizedNode(9); + node.text = text; + return node; + } + function createLiteralFromNode(sourceNode) { + var node = createStringLiteral(sourceNode.text); + node.textSourceNode = sourceNode; + return node; + } + function createIdentifier(text) { + var node = createSynthesizedNode(70); node.text = ts.escapeIdentifier(text); - node.originalKeywordKind = ts.stringToToken(text); + node.originalKeywordKind = text ? ts.stringToToken(text) : 0; node.autoGenerateKind = 0; node.autoGenerateId = 0; return node; } ts.createIdentifier = createIdentifier; - function createTempVariable(recordTempVariable, location) { - var name = createNode(70, location); - name.text = ""; - name.originalKeywordKind = 0; + var nextAutoGenerateId = 0; + function createTempVariable(recordTempVariable) { + var name = createIdentifier(""); name.autoGenerateKind = 1; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; @@ -8584,93 +8768,387 @@ var ts; return name; } ts.createTempVariable = createTempVariable; - function createLoopVariable(location) { - var name = createNode(70, location); - name.text = ""; - name.originalKeywordKind = 0; + function createLoopVariable() { + var name = createIdentifier(""); name.autoGenerateKind = 2; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createLoopVariable = createLoopVariable; - function createUniqueName(text, location) { - var name = createNode(70, location); - name.text = text; - name.originalKeywordKind = 0; + function createUniqueName(text) { + var name = createIdentifier(text); name.autoGenerateKind = 3; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createUniqueName = createUniqueName; - function getGeneratedNameForNode(node, location) { - var name = createNode(70, location); - name.original = node; - name.text = ""; - name.originalKeywordKind = 0; + function getGeneratedNameForNode(node) { + var name = createIdentifier(""); name.autoGenerateKind = 4; name.autoGenerateId = nextAutoGenerateId; + name.original = node; nextAutoGenerateId++; return name; } ts.getGeneratedNameForNode = getGeneratedNameForNode; function createToken(token) { - return createNode(token); + return createSynthesizedNode(token); } ts.createToken = createToken; function createSuper() { - var node = createNode(96); - return node; + return createSynthesizedNode(96); } ts.createSuper = createSuper; - function createThis(location) { - var node = createNode(98, location); - return node; + function createThis() { + return createSynthesizedNode(98); } ts.createThis = createThis; function createNull() { - var node = createNode(94); - return node; + return createSynthesizedNode(94); } ts.createNull = createNull; - function createComputedPropertyName(expression, location) { - var node = createNode(142, location); + function createTrue() { + return createSynthesizedNode(100); + } + ts.createTrue = createTrue; + function createFalse() { + return createSynthesizedNode(85); + } + ts.createFalse = createFalse; + function createQualifiedName(left, right) { + var node = createSynthesizedNode(142); + node.left = left; + node.right = asName(right); + return node; + } + ts.createQualifiedName = createQualifiedName; + function updateQualifiedName(node, left, right) { + return node.left !== left + || node.right !== right + ? updateNode(createQualifiedName(left, right), node) + : node; + } + ts.updateQualifiedName = updateQualifiedName; + function createComputedPropertyName(expression) { + var node = createSynthesizedNode(143); node.expression = expression; return node; } ts.createComputedPropertyName = createComputedPropertyName; function updateComputedPropertyName(node, expression) { - if (node.expression !== expression) { - return updateNode(createComputedPropertyName(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createComputedPropertyName(expression), node) + : node; } ts.updateComputedPropertyName = updateComputedPropertyName; - function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createSignatureDeclaration(kind, typeParameters, parameters, type) { + var signatureDeclaration = createSynthesizedNode(kind); + signatureDeclaration.typeParameters = asNodeArray(typeParameters); + signatureDeclaration.parameters = asNodeArray(parameters); + signatureDeclaration.type = type; + return signatureDeclaration; + } + ts.createSignatureDeclaration = createSignatureDeclaration; + function updateSignatureDeclaration(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) + : node; + } + function createFunctionTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(159, typeParameters, parameters, type); + } + ts.createFunctionTypeNode = createFunctionTypeNode; + function updateFunctionTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateFunctionTypeNode = updateFunctionTypeNode; + function createConstructorTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(160, typeParameters, parameters, type); + } + ts.createConstructorTypeNode = createConstructorTypeNode; + function updateConstructorTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructorTypeNode = updateConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(154, typeParameters, parameters, type); + } + ts.createCallSignatureDeclaration = createCallSignatureDeclaration; + function updateCallSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateCallSignatureDeclaration = updateCallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(155, typeParameters, parameters, type); + } + ts.createConstructSignatureDeclaration = createConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructSignatureDeclaration = updateConstructSignatureDeclaration; + function createMethodSignature(typeParameters, parameters, type, name, questionToken) { + var methodSignature = createSignatureDeclaration(149, typeParameters, parameters, type); + methodSignature.name = asName(name); + methodSignature.questionToken = questionToken; + return methodSignature; + } + ts.createMethodSignature = createMethodSignature; + function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.name !== name + || node.questionToken !== questionToken + ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) + : node; + } + ts.updateMethodSignature = updateMethodSignature; + function createKeywordTypeNode(kind) { + return createSynthesizedNode(kind); + } + ts.createKeywordTypeNode = createKeywordTypeNode; + function createThisTypeNode() { + return createSynthesizedNode(168); + } + ts.createThisTypeNode = createThisTypeNode; + function createLiteralTypeNode(literal) { + var literalTypeNode = createSynthesizedNode(172); + literalTypeNode.literal = literal; + return literalTypeNode; + } + ts.createLiteralTypeNode = createLiteralTypeNode; + function updateLiteralTypeNode(node, literal) { + return node.literal !== literal + ? updateNode(createLiteralTypeNode(literal), node) + : node; + } + ts.updateLiteralTypeNode = updateLiteralTypeNode; + function createTypeReferenceNode(typeName, typeArguments) { + var typeReference = createSynthesizedNode(158); + typeReference.typeName = asName(typeName); + typeReference.typeArguments = asNodeArray(typeArguments); + return typeReference; + } + ts.createTypeReferenceNode = createTypeReferenceNode; + function updateTypeReferenceNode(node, typeName, typeArguments) { + return node.typeName !== typeName + || node.typeArguments !== typeArguments + ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) + : node; + } + ts.updateTypeReferenceNode = updateTypeReferenceNode; + function createTypePredicateNode(parameterName, type) { + var typePredicateNode = createSynthesizedNode(157); + typePredicateNode.parameterName = asName(parameterName); + typePredicateNode.type = type; + return typePredicateNode; + } + ts.createTypePredicateNode = createTypePredicateNode; + function updateTypePredicateNode(node, parameterName, type) { + return node.parameterName !== parameterName + || node.type !== type + ? updateNode(createTypePredicateNode(parameterName, type), node) + : node; + } + ts.updateTypePredicateNode = updateTypePredicateNode; + function createTypeQueryNode(exprName) { + var typeQueryNode = createSynthesizedNode(161); + typeQueryNode.exprName = exprName; + return typeQueryNode; + } + ts.createTypeQueryNode = createTypeQueryNode; + function updateTypeQueryNode(node, exprName) { + return node.exprName !== exprName ? updateNode(createTypeQueryNode(exprName), node) : node; + } + ts.updateTypeQueryNode = updateTypeQueryNode; + function createArrayTypeNode(elementType) { + var arrayTypeNode = createSynthesizedNode(163); + arrayTypeNode.elementType = elementType; + return arrayTypeNode; + } + ts.createArrayTypeNode = createArrayTypeNode; + function updateArrayTypeNode(node, elementType) { + return node.elementType !== elementType + ? updateNode(createArrayTypeNode(elementType), node) + : node; + } + ts.updateArrayTypeNode = updateArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind, types) { + var unionTypeNode = createSynthesizedNode(kind); + unionTypeNode.types = createNodeArray(types); + return unionTypeNode; + } + ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node, types) { + return node.types !== types + ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) + : node; + } + ts.updateUnionOrIntersectionTypeNode = updateUnionOrIntersectionTypeNode; + function createTypeLiteralNode(members) { + var typeLiteralNode = createSynthesizedNode(162); + typeLiteralNode.members = createNodeArray(members); + return typeLiteralNode; + } + ts.createTypeLiteralNode = createTypeLiteralNode; + function updateTypeLiteralNode(node, members) { + return node.members !== members + ? updateNode(createTypeLiteralNode(members), node) + : node; + } + ts.updateTypeLiteralNode = updateTypeLiteralNode; + function createTupleTypeNode(elementTypes) { + var tupleTypeNode = createSynthesizedNode(164); + tupleTypeNode.elementTypes = createNodeArray(elementTypes); + return tupleTypeNode; + } + ts.createTupleTypeNode = createTupleTypeNode; + function updateTypleTypeNode(node, elementTypes) { + return node.elementTypes !== elementTypes + ? updateNode(createTupleTypeNode(elementTypes), node) + : node; + } + ts.updateTypleTypeNode = updateTypleTypeNode; + function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { + var mappedTypeNode = createSynthesizedNode(171); + mappedTypeNode.readonlyToken = readonlyToken; + mappedTypeNode.typeParameter = typeParameter; + mappedTypeNode.questionToken = questionToken; + mappedTypeNode.type = type; + return mappedTypeNode; + } + ts.createMappedTypeNode = createMappedTypeNode; + function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { + return node.readonlyToken !== readonlyToken + || node.typeParameter !== typeParameter + || node.questionToken !== questionToken + || node.type !== type + ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) + : node; + } + ts.updateMappedTypeNode = updateMappedTypeNode; + function createTypeOperatorNode(type) { + var typeOperatorNode = createSynthesizedNode(169); + typeOperatorNode.operator = 126; + typeOperatorNode.type = type; + return typeOperatorNode; + } + ts.createTypeOperatorNode = createTypeOperatorNode; + function updateTypeOperatorNode(node, type) { + return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; + } + ts.updateTypeOperatorNode = updateTypeOperatorNode; + function createIndexedAccessTypeNode(objectType, indexType) { + var indexedAccessTypeNode = createSynthesizedNode(170); + indexedAccessTypeNode.objectType = objectType; + indexedAccessTypeNode.indexType = indexType; + return indexedAccessTypeNode; + } + ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node, objectType, indexType) { + return node.objectType !== objectType + || node.indexType !== indexType + ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) + : node; + } + ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; + function createTypeParameterDeclaration(name, constraint, defaultType) { + var typeParameter = createSynthesizedNode(144); + typeParameter.name = asName(name); + typeParameter.constraint = constraint; + typeParameter.default = defaultType; + return typeParameter; + } + ts.createTypeParameterDeclaration = createTypeParameterDeclaration; + function updateTypeParameterDeclaration(node, name, constraint, defaultType) { + return node.name !== name + || node.constraint !== constraint + || node.default !== defaultType + ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) + : node; + } + ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; + function createPropertySignature(name, questionToken, type, initializer) { + var propertySignature = createSynthesizedNode(147); + propertySignature.name = asName(name); + propertySignature.questionToken = questionToken; + propertySignature.type = type; + propertySignature.initializer = initializer; + return propertySignature; + } + ts.createPropertySignature = createPropertySignature; + function updatePropertySignature(node, name, questionToken, type, initializer) { + return node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createPropertySignature(name, questionToken, type, initializer), node) + : node; + } + ts.updatePropertySignature = updatePropertySignature; + function createIndexSignatureDeclaration(decorators, modifiers, parameters, type) { + var indexSignature = createSynthesizedNode(156); + indexSignature.decorators = asNodeArray(decorators); + indexSignature.modifiers = asNodeArray(modifiers); + indexSignature.parameters = createNodeArray(parameters); + indexSignature.type = type; + return indexSignature; + } + ts.createIndexSignatureDeclaration = createIndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node, decorators, modifiers, parameters, type) { + return node.parameters !== parameters + || node.type !== type + || node.decorators !== decorators + || node.modifiers !== modifiers + ? updateNode(createIndexSignatureDeclaration(decorators, modifiers, parameters, type), node) + : node; + } + ts.updateIndexSignatureDeclaration = updateIndexSignatureDeclaration; + function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + var node = createSynthesizedNode(145); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.name = asName(name); node.questionToken = questionToken; node.type = type; - node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); - } - return node; + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer), node) + : node; } ts.updateParameter = updateParameter; - function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createDecorator(expression) { + var node = createSynthesizedNode(146); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createDecorator = createDecorator; + function updateDecorator(node, expression) { + return node.expression !== expression + ? updateNode(createDecorator(expression), node) + : node; + } + ts.updateDecorator = updateDecorator; + function createProperty(decorators, modifiers, name, questionToken, type, initializer) { + var node = createSynthesizedNode(148); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.questionToken = questionToken; node.type = type; node.initializer = initializer; @@ -8678,36 +9156,46 @@ var ts; } ts.createProperty = createProperty; function updateProperty(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer), node) + : node; } ts.updateProperty = updateProperty; - function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(150); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.questionToken = questionToken; + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } - ts.createMethod = createMethod; - function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + ts.createMethodDeclaration = createMethodDeclaration; + function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) + : node; } ts.updateMethod = updateMethod; - function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createConstructor(decorators, modifiers, parameters, body) { + var node = createSynthesizedNode(151); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = undefined; @@ -8716,17 +9204,19 @@ var ts; } ts.createConstructor = createConstructor; function updateConstructor(node, decorators, modifiers, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) { - return updateNode(createConstructor(decorators, modifiers, parameters, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.parameters !== parameters + || node.body !== body + ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) + : node; } ts.updateConstructor = updateConstructor; - function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createGetAccessor(decorators, modifiers, name, parameters, type, body) { + var node = createSynthesizedNode(152); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = type; @@ -8735,17 +9225,21 @@ var ts; } ts.createGetAccessor = createGetAccessor; function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) + : node; } ts.updateGetAccessor = updateGetAccessor; - function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createSetAccessor(decorators, modifiers, name, parameters, body) { + var node = createSynthesizedNode(153); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.body = body; @@ -8753,57 +9247,60 @@ var ts; } ts.createSetAccessor = createSetAccessor; function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) { - return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.body !== body + ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) + : node; } ts.updateSetAccessor = updateSetAccessor; - function createObjectBindingPattern(elements, location) { - var node = createNode(172, location); + function createObjectBindingPattern(elements) { + var node = createSynthesizedNode(173); node.elements = createNodeArray(elements); return node; } ts.createObjectBindingPattern = createObjectBindingPattern; function updateObjectBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createObjectBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createObjectBindingPattern(elements), node) + : node; } ts.updateObjectBindingPattern = updateObjectBindingPattern; - function createArrayBindingPattern(elements, location) { - var node = createNode(173, location); + function createArrayBindingPattern(elements) { + var node = createSynthesizedNode(174); node.elements = createNodeArray(elements); return node; } ts.createArrayBindingPattern = createArrayBindingPattern; function updateArrayBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayBindingPattern(elements), node) + : node; } ts.updateArrayBindingPattern = updateArrayBindingPattern; - function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174, location); - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createBindingElement(dotDotDotToken, propertyName, name, initializer) { + var node = createSynthesizedNode(175); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.propertyName = asName(propertyName); + node.name = asName(name); node.initializer = initializer; return node; } ts.createBindingElement = createBindingElement; function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); - } - return node; + return node.propertyName !== propertyName + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.initializer !== initializer + ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) + : node; } ts.updateBindingElement = updateBindingElement; - function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175, location); - node.elements = parenthesizeListElements(createNodeArray(elements)); + function createArrayLiteral(elements, multiLine) { + var node = createSynthesizedNode(176); + node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; } @@ -8811,14 +9308,13 @@ var ts; } ts.createArrayLiteral = createArrayLiteral; function updateArrayLiteral(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayLiteral(elements, node, node.multiLine), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayLiteral(elements, node.multiLine), node) + : node; } ts.updateArrayLiteral = updateArrayLiteral; - function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176, location); + function createObjectLiteral(properties, multiLine) { + var node = createSynthesizedNode(177); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -8827,431 +9323,461 @@ var ts; } ts.createObjectLiteral = createObjectLiteral; function updateObjectLiteral(node, properties) { - if (node.properties !== properties) { - return updateNode(createObjectLiteral(properties, node, node.multiLine), node); - } - return node; + return node.properties !== properties + ? updateNode(createObjectLiteral(properties, node.multiLine), node) + : node; } ts.updateObjectLiteral = updateObjectLiteral; - function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177, location, flags); - node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 65536; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAccess(expression, name) { + var node = createSynthesizedNode(178); + node.expression = ts.parenthesizeForAccess(expression); + node.name = asName(name); + setEmitFlags(node, 65536); return node; } ts.createPropertyAccess = createPropertyAccess; function updatePropertyAccess(node, expression, name) { - if (node.expression !== expression || node.name !== name) { - var propertyAccess = createPropertyAccess(expression, name, node, node.flags); - (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node); - return updateNode(propertyAccess, node); - } - return node; + return node.expression !== expression + || node.name !== name + ? updateNode(setEmitFlags(createPropertyAccess(expression, name), getEmitFlags(node)), node) + : node; } ts.updatePropertyAccess = updatePropertyAccess; - function createElementAccess(expression, index, location) { - var node = createNode(178, location); - node.expression = parenthesizeForAccess(expression); - node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; + function createElementAccess(expression, index) { + var node = createSynthesizedNode(179); + node.expression = ts.parenthesizeForAccess(expression); + node.argumentExpression = asExpression(index); return node; } ts.createElementAccess = createElementAccess; function updateElementAccess(node, expression, argumentExpression) { - if (node.expression !== expression || node.argumentExpression !== argumentExpression) { - return updateNode(createElementAccess(expression, argumentExpression, node), node); - } - return node; + return node.expression !== expression + || node.argumentExpression !== argumentExpression + ? updateNode(createElementAccess(expression, argumentExpression), node) + : node; } ts.updateElementAccess = updateElementAccess; - function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179, location, flags); - node.expression = parenthesizeForAccess(expression); - if (typeArguments) { - node.typeArguments = createNodeArray(typeArguments); - } - node.arguments = parenthesizeListElements(createNodeArray(argumentsArray)); + function createCall(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(180); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); return node; } ts.createCall = createCall; function updateCall(node, expression, typeArguments, argumentsArray) { - if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) { - return updateNode(createCall(expression, typeArguments, argumentsArray, node, node.flags), node); - } - return node; + return expression !== node.expression + || typeArguments !== node.typeArguments + || argumentsArray !== node.arguments + ? updateNode(createCall(expression, typeArguments, argumentsArray), node) + : node; } ts.updateCall = updateCall; - function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180, location, flags); - node.expression = parenthesizeForNew(expression); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; + function createNew(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(181); + node.expression = ts.parenthesizeForNew(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; return node; } ts.createNew = createNew; function updateNew(node, expression, typeArguments, argumentsArray) { - if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) { - return updateNode(createNew(expression, typeArguments, argumentsArray, node, node.flags), node); - } - return node; + return node.expression !== expression + || node.typeArguments !== typeArguments + || node.arguments !== argumentsArray + ? updateNode(createNew(expression, typeArguments, argumentsArray), node) + : node; } ts.updateNew = updateNew; - function createTaggedTemplate(tag, template, location) { - var node = createNode(181, location); - node.tag = parenthesizeForAccess(tag); + function createTaggedTemplate(tag, template) { + var node = createSynthesizedNode(182); + node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; } ts.createTaggedTemplate = createTaggedTemplate; function updateTaggedTemplate(node, tag, template) { - if (node.tag !== tag || node.template !== template) { - return updateNode(createTaggedTemplate(tag, template, node), node); - } - return node; + return node.tag !== tag + || node.template !== template + ? updateNode(createTaggedTemplate(tag, template), node) + : node; } ts.updateTaggedTemplate = updateTaggedTemplate; - function createParen(expression, location) { - var node = createNode(183, location); + function createTypeAssertion(type, expression) { + var node = createSynthesizedNode(183); + node.type = type; + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeAssertion = createTypeAssertion; + function updateTypeAssertion(node, type, expression) { + return node.type !== type + || node.expression !== expression + ? updateNode(createTypeAssertion(type, expression), node) + : node; + } + ts.updateTypeAssertion = updateTypeAssertion; + function createParen(expression) { + var node = createSynthesizedNode(184); node.expression = expression; return node; } ts.createParen = createParen; function updateParen(node, expression) { - if (node.expression !== expression) { - return updateNode(createParen(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createParen(expression), node) + : node; } ts.updateParen = updateParen; - function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(185); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionExpression = createFunctionExpression; - function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) { - if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.name !== name + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionExpression = updateFunctionExpression; - function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + var node = createSynthesizedNode(186); + node.modifiers = asNodeArray(modifiers); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35); - node.body = parenthesizeConciseBody(body); + node.body = ts.parenthesizeConciseBody(body); return node; } ts.createArrowFunction = createArrowFunction; function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) { - if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body), node) + : node; } ts.updateArrowFunction = updateArrowFunction; - function createDelete(expression, location) { - var node = createNode(186, location); - node.expression = parenthesizePrefixOperand(expression); + function createDelete(expression) { + var node = createSynthesizedNode(187); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createDelete = createDelete; function updateDelete(node, expression) { - if (node.expression !== expression) { - return updateNode(createDelete(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createDelete(expression), node) + : node; } ts.updateDelete = updateDelete; - function createTypeOf(expression, location) { - var node = createNode(187, location); - node.expression = parenthesizePrefixOperand(expression); + function createTypeOf(expression) { + var node = createSynthesizedNode(188); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createTypeOf = createTypeOf; function updateTypeOf(node, expression) { - if (node.expression !== expression) { - return updateNode(createTypeOf(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createTypeOf(expression), node) + : node; } ts.updateTypeOf = updateTypeOf; - function createVoid(expression, location) { - var node = createNode(188, location); - node.expression = parenthesizePrefixOperand(expression); + function createVoid(expression) { + var node = createSynthesizedNode(189); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createVoid = createVoid; function updateVoid(node, expression) { - if (node.expression !== expression) { - return updateNode(createVoid(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createVoid(expression), node) + : node; } ts.updateVoid = updateVoid; - function createAwait(expression, location) { - var node = createNode(189, location); - node.expression = parenthesizePrefixOperand(expression); + function createAwait(expression) { + var node = createSynthesizedNode(190); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createAwait = createAwait; function updateAwait(node, expression) { - if (node.expression !== expression) { - return updateNode(createAwait(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createAwait(expression), node) + : node; } ts.updateAwait = updateAwait; - function createPrefix(operator, operand, location) { - var node = createNode(190, location); + function createPrefix(operator, operand) { + var node = createSynthesizedNode(191); node.operator = operator; - node.operand = parenthesizePrefixOperand(operand); + node.operand = ts.parenthesizePrefixOperand(operand); return node; } ts.createPrefix = createPrefix; function updatePrefix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPrefix(node.operator, operand, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPrefix(node.operator, operand), node) + : node; } ts.updatePrefix = updatePrefix; - function createPostfix(operand, operator, location) { - var node = createNode(191, location); - node.operand = parenthesizePostfixOperand(operand); + function createPostfix(operand, operator) { + var node = createSynthesizedNode(192); + node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; } ts.createPostfix = createPostfix; function updatePostfix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPostfix(operand, node.operator, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPostfix(operand, node.operator), node) + : node; } ts.updatePostfix = updatePostfix; - function createBinary(left, operator, right, location) { - var operatorToken = typeof operator === "number" ? createToken(operator) : operator; + function createBinary(left, operator, right) { + var node = createSynthesizedNode(193); + var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; - var node = createNode(192, location); - node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined); + node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined); node.operatorToken = operatorToken; - node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left); + node.right = ts.parenthesizeBinaryOperand(operatorKind, right, false, node.left); return node; } ts.createBinary = createBinary; function updateBinary(node, left, right) { - if (node.left !== left || node.right !== right) { - return updateNode(createBinary(left, node.operatorToken, right, node), node); - } - return node; + return node.left !== left + || node.right !== right + ? updateNode(createBinary(left, node.operatorToken, right), node) + : node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193, whenFalse ? location : colonTokenOrLocation); - node.condition = parenthesizeForConditionalHead(condition); - if (whenFalse) { - node.questionToken = questionTokenOrWhenTrue; - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - node.colonToken = colonTokenOrLocation; - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); - } - else { - node.questionToken = createToken(54); - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); - node.colonToken = createToken(55); - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - } + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { + var node = createSynthesizedNode(194); + node.condition = ts.parenthesizeForConditionalHead(condition); + node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(54); + node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); + node.colonToken = whenFalse ? colonToken : createToken(55); + node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse); return node; } ts.createConditional = createConditional; function updateConditional(node, condition, whenTrue, whenFalse) { - if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) { - return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node); - } - return node; + return node.condition !== condition + || node.whenTrue !== whenTrue + || node.whenFalse !== whenFalse + ? updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse), node) + : node; } ts.updateConditional = updateConditional; - function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194, location); + function createTemplateExpression(head, templateSpans) { + var node = createSynthesizedNode(195); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; } ts.createTemplateExpression = createTemplateExpression; function updateTemplateExpression(node, head, templateSpans) { - if (node.head !== head || node.templateSpans !== templateSpans) { - return updateNode(createTemplateExpression(head, templateSpans, node), node); - } - return node; + return node.head !== head + || node.templateSpans !== templateSpans + ? updateNode(createTemplateExpression(head, templateSpans), node) + : node; } ts.updateTemplateExpression = updateTemplateExpression; - function createYield(asteriskToken, expression, location) { - var node = createNode(195, location); - node.asteriskToken = asteriskToken; - node.expression = expression; + function createYield(asteriskTokenOrExpression, expression) { + var node = createSynthesizedNode(196); + node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 38 ? asteriskTokenOrExpression : undefined; + node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 38 ? asteriskTokenOrExpression : expression; return node; } ts.createYield = createYield; - function updateYield(node, expression) { - if (node.expression !== expression) { - return updateNode(createYield(node.asteriskToken, expression, node), node); - } - return node; + function updateYield(node, asteriskToken, expression) { + return node.expression !== expression + || node.asteriskToken !== asteriskToken + ? updateNode(createYield(asteriskToken, expression), node) + : node; } ts.updateYield = updateYield; - function createSpread(expression, location) { - var node = createNode(196, location); - node.expression = parenthesizeExpressionForList(expression); + function createSpread(expression) { + var node = createSynthesizedNode(197); + node.expression = ts.parenthesizeExpressionForList(expression); return node; } ts.createSpread = createSpread; function updateSpread(node, expression) { - if (node.expression !== expression) { - return updateNode(createSpread(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createSpread(expression), node) + : node; } ts.updateSpread = updateSpread; - function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197, location); + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(198); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassExpression = createClassExpression; function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { - if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassExpression = updateClassExpression; - function createOmittedExpression(location) { - var node = createNode(198, location); - return node; + function createOmittedExpression() { + return createSynthesizedNode(199); } ts.createOmittedExpression = createOmittedExpression; - function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199, location); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.expression = parenthesizeForAccess(expression); + function createExpressionWithTypeArguments(typeArguments, expression) { + var node = createSynthesizedNode(200); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); return node; } ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; function updateExpressionWithTypeArguments(node, typeArguments, expression) { - if (node.typeArguments !== typeArguments || node.expression !== expression) { - return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node); - } - return node; + return node.typeArguments !== typeArguments + || node.expression !== expression + ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) + : node; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; - function createTemplateSpan(expression, literal, location) { - var node = createNode(202, location); + function createAsExpression(expression, type) { + var node = createSynthesizedNode(201); + node.expression = expression; + node.type = type; + return node; + } + ts.createAsExpression = createAsExpression; + function updateAsExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? updateNode(createAsExpression(expression, type), node) + : node; + } + ts.updateAsExpression = updateAsExpression; + function createNonNullExpression(expression) { + var node = createSynthesizedNode(202); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createNonNullExpression = createNonNullExpression; + function updateNonNullExpression(node, expression) { + return node.expression !== expression + ? updateNode(createNonNullExpression(expression), node) + : node; + } + ts.updateNonNullExpression = updateNonNullExpression; + function createTemplateSpan(expression, literal) { + var node = createSynthesizedNode(204); node.expression = expression; node.literal = literal; return node; } ts.createTemplateSpan = createTemplateSpan; function updateTemplateSpan(node, expression, literal) { - if (node.expression !== expression || node.literal !== literal) { - return updateNode(createTemplateSpan(expression, literal, node), node); - } - return node; + return node.expression !== expression + || node.literal !== literal + ? updateNode(createTemplateSpan(expression, literal), node) + : node; } ts.updateTemplateSpan = updateTemplateSpan; - function createBlock(statements, location, multiLine, flags) { - var block = createNode(204, location, flags); + function createBlock(statements, multiLine) { + var block = createSynthesizedNode(206); block.statements = createNodeArray(statements); - if (multiLine) { - block.multiLine = true; - } + if (multiLine) + block.multiLine = multiLine; return block; } ts.createBlock = createBlock; function updateBlock(node, statements) { - if (statements !== node.statements) { - return updateNode(createBlock(statements, node, node.multiLine, node.flags), node); - } - return node; + return statements !== node.statements + ? updateNode(createBlock(statements, node.multiLine), node) + : node; } ts.updateBlock = updateBlock; - function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205, location, flags); + function createVariableStatement(modifiers, declarationList) { + var node = createSynthesizedNode(207); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; return node; } ts.createVariableStatement = createVariableStatement; function updateVariableStatement(node, modifiers, declarationList) { - if (node.modifiers !== modifiers || node.declarationList !== declarationList) { - return updateNode(createVariableStatement(modifiers, declarationList, node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.declarationList !== declarationList + ? updateNode(createVariableStatement(modifiers, declarationList), node) + : node; } ts.updateVariableStatement = updateVariableStatement; - function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224, location, flags); + function createVariableDeclarationList(declarations, flags) { + var node = createSynthesizedNode(226); + node.flags |= flags; node.declarations = createNodeArray(declarations); return node; } ts.createVariableDeclarationList = createVariableDeclarationList; function updateVariableDeclarationList(node, declarations) { - if (node.declarations !== declarations) { - return updateNode(createVariableDeclarationList(declarations, node, node.flags), node); - } - return node; + return node.declarations !== declarations + ? updateNode(createVariableDeclarationList(declarations, node.flags), node) + : node; } ts.updateVariableDeclarationList = updateVariableDeclarationList; - function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223, location, flags); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createVariableDeclaration(name, type, initializer) { + var node = createSynthesizedNode(225); + node.name = asName(name); node.type = type; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createVariableDeclaration = createVariableDeclaration; function updateVariableDeclaration(node, name, type, initializer) { - if (node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createVariableDeclaration(name, type, initializer, node, node.flags), node); - } - return node; + return node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createVariableDeclaration(name, type, initializer), node) + : node; } ts.updateVariableDeclaration = updateVariableDeclaration; - function createEmptyStatement(location) { - return createNode(206, location); + function createEmptyStatement() { + return createSynthesizedNode(208); } ts.createEmptyStatement = createEmptyStatement; - function createStatement(expression, location, flags) { - var node = createNode(207, location, flags); - node.expression = parenthesizeExpressionForExpressionStatement(expression); + function createStatement(expression) { + var node = createSynthesizedNode(209); + node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } ts.createStatement = createStatement; function updateStatement(node, expression) { - if (node.expression !== expression) { - return updateNode(createStatement(expression, node, node.flags), node); - } - return node; + return node.expression !== expression + ? updateNode(createStatement(expression), node) + : node; } ts.updateStatement = updateStatement; - function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208, location); + function createIf(expression, thenStatement, elseStatement) { + var node = createSynthesizedNode(210); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -9259,42 +9785,43 @@ var ts; } ts.createIf = createIf; function updateIf(node, expression, thenStatement, elseStatement) { - if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) { - return updateNode(createIf(expression, thenStatement, elseStatement, node), node); - } - return node; + return node.expression !== expression + || node.thenStatement !== thenStatement + || node.elseStatement !== elseStatement + ? updateNode(createIf(expression, thenStatement, elseStatement), node) + : node; } ts.updateIf = updateIf; - function createDo(statement, expression, location) { - var node = createNode(209, location); + function createDo(statement, expression) { + var node = createSynthesizedNode(211); node.statement = statement; node.expression = expression; return node; } ts.createDo = createDo; function updateDo(node, statement, expression) { - if (node.statement !== statement || node.expression !== expression) { - return updateNode(createDo(statement, expression, node), node); - } - return node; + return node.statement !== statement + || node.expression !== expression + ? updateNode(createDo(statement, expression), node) + : node; } ts.updateDo = updateDo; - function createWhile(expression, statement, location) { - var node = createNode(210, location); + function createWhile(expression, statement) { + var node = createSynthesizedNode(212); node.expression = expression; node.statement = statement; return node; } ts.createWhile = createWhile; function updateWhile(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWhile(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWhile(expression, statement), node) + : node; } ts.updateWhile = updateWhile; - function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211, location, undefined); + function createFor(initializer, condition, incrementor, statement) { + var node = createSynthesizedNode(213); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -9303,14 +9830,16 @@ var ts; } ts.createFor = createFor; function updateFor(node, initializer, condition, incrementor, statement) { - if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) { - return updateNode(createFor(initializer, condition, incrementor, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.condition !== condition + || node.incrementor !== incrementor + || node.statement !== statement + ? updateNode(createFor(initializer, condition, incrementor, statement), node) + : node; } ts.updateFor = updateFor; - function createForIn(initializer, expression, statement, location) { - var node = createNode(212, location); + function createForIn(initializer, expression, statement) { + var node = createSynthesizedNode(214); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -9318,127 +9847,123 @@ var ts; } ts.createForIn = createForIn; function updateForIn(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForIn(initializer, expression, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForIn(initializer, expression, statement), node) + : node; } ts.updateForIn = updateForIn; - function createForOf(initializer, expression, statement, location) { - var node = createNode(213, location); + function createForOf(awaitModifier, initializer, expression, statement) { + var node = createSynthesizedNode(215); + node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; node.statement = statement; return node; } ts.createForOf = createForOf; - function updateForOf(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForOf(initializer, expression, statement, node), node); - } - return node; + function updateForOf(node, awaitModifier, initializer, expression, statement) { + return node.awaitModifier !== awaitModifier + || node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) + : node; } ts.updateForOf = updateForOf; - function createContinue(label, location) { - var node = createNode(214, location); - if (label) { - node.label = label; - } + function createContinue(label) { + var node = createSynthesizedNode(216); + node.label = asName(label); return node; } ts.createContinue = createContinue; function updateContinue(node, label) { - if (node.label !== label) { - return updateNode(createContinue(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createContinue(label), node) + : node; } ts.updateContinue = updateContinue; - function createBreak(label, location) { - var node = createNode(215, location); - if (label) { - node.label = label; - } + function createBreak(label) { + var node = createSynthesizedNode(217); + node.label = asName(label); return node; } ts.createBreak = createBreak; function updateBreak(node, label) { - if (node.label !== label) { - return updateNode(createBreak(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createBreak(label), node) + : node; } ts.updateBreak = updateBreak; - function createReturn(expression, location) { - var node = createNode(216, location); + function createReturn(expression) { + var node = createSynthesizedNode(218); node.expression = expression; return node; } ts.createReturn = createReturn; function updateReturn(node, expression) { - if (node.expression !== expression) { - return updateNode(createReturn(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createReturn(expression), node) + : node; } ts.updateReturn = updateReturn; - function createWith(expression, statement, location) { - var node = createNode(217, location); + function createWith(expression, statement) { + var node = createSynthesizedNode(219); node.expression = expression; node.statement = statement; return node; } ts.createWith = createWith; function updateWith(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWith(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWith(expression, statement), node) + : node; } ts.updateWith = updateWith; - function createSwitch(expression, caseBlock, location) { - var node = createNode(218, location); - node.expression = parenthesizeExpressionForList(expression); + function createSwitch(expression, caseBlock) { + var node = createSynthesizedNode(220); + node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; } ts.createSwitch = createSwitch; function updateSwitch(node, expression, caseBlock) { - if (node.expression !== expression || node.caseBlock !== caseBlock) { - return updateNode(createSwitch(expression, caseBlock, node), node); - } - return node; + return node.expression !== expression + || node.caseBlock !== caseBlock + ? updateNode(createSwitch(expression, caseBlock), node) + : node; } ts.updateSwitch = updateSwitch; - function createLabel(label, statement, location) { - var node = createNode(219, location); - node.label = typeof label === "string" ? createIdentifier(label) : label; + function createLabel(label, statement) { + var node = createSynthesizedNode(221); + node.label = asName(label); node.statement = statement; return node; } ts.createLabel = createLabel; function updateLabel(node, label, statement) { - if (node.label !== label || node.statement !== statement) { - return updateNode(createLabel(label, statement, node), node); - } - return node; + return node.label !== label + || node.statement !== statement + ? updateNode(createLabel(label, statement), node) + : node; } ts.updateLabel = updateLabel; - function createThrow(expression, location) { - var node = createNode(220, location); + function createThrow(expression) { + var node = createSynthesizedNode(222); node.expression = expression; return node; } ts.createThrow = createThrow; function updateThrow(node, expression) { - if (node.expression !== expression) { - return updateNode(createThrow(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createThrow(expression), node) + : node; } ts.updateThrow = updateThrow; - function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221, location); + function createTry(tryBlock, catchClause, finallyBlock) { + var node = createSynthesizedNode(223); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -9446,194 +9971,284 @@ var ts; } ts.createTry = createTry; function updateTry(node, tryBlock, catchClause, finallyBlock) { - if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) { - return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node); - } - return node; + return node.tryBlock !== tryBlock + || node.catchClause !== catchClause + || node.finallyBlock !== finallyBlock + ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) + : node; } ts.updateTry = updateTry; - function createCaseBlock(clauses, location) { - var node = createNode(232, location); - node.clauses = createNodeArray(clauses); - return node; - } - ts.createCaseBlock = createCaseBlock; - function updateCaseBlock(node, clauses) { - if (node.clauses !== clauses) { - return updateNode(createCaseBlock(clauses, node), node); - } - return node; - } - ts.updateCaseBlock = updateCaseBlock; - function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(227); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionDeclaration = createFunctionDeclaration; - function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionDeclaration = updateFunctionDeclaration; - function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(228); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassDeclaration = createClassDeclaration; function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassDeclaration = updateClassDeclaration; - function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createEnumDeclaration(decorators, modifiers, name, members) { + var node = createSynthesizedNode(231); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.members = createNodeArray(members); + return node; + } + ts.createEnumDeclaration = createEnumDeclaration; + function updateEnumDeclaration(node, decorators, modifiers, name, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.members !== members + ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) + : node; + } + ts.updateEnumDeclaration = updateEnumDeclaration; + function createModuleDeclaration(decorators, modifiers, name, body, flags) { + var node = createSynthesizedNode(232); + node.flags |= flags; + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = name; + node.body = body; + return node; + } + ts.createModuleDeclaration = createModuleDeclaration; + function updateModuleDeclaration(node, decorators, modifiers, name, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.body !== body + ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) + : node; + } + ts.updateModuleDeclaration = updateModuleDeclaration; + function createModuleBlock(statements) { + var node = createSynthesizedNode(233); + node.statements = createNodeArray(statements); + return node; + } + ts.createModuleBlock = createModuleBlock; + function updateModuleBlock(node, statements) { + return node.statements !== statements + ? updateNode(createModuleBlock(statements), node) + : node; + } + ts.updateModuleBlock = updateModuleBlock; + function createCaseBlock(clauses) { + var node = createSynthesizedNode(234); + node.clauses = createNodeArray(clauses); + return node; + } + ts.createCaseBlock = createCaseBlock; + function updateCaseBlock(node, clauses) { + return node.clauses !== clauses + ? updateNode(createCaseBlock(clauses), node) + : node; + } + ts.updateCaseBlock = updateCaseBlock; + function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { + var node = createSynthesizedNode(236); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.moduleReference = moduleReference; + return node; + } + ts.createImportEqualsDeclaration = createImportEqualsDeclaration; + function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.moduleReference !== moduleReference + ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) + : node; + } + ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; + function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { + var node = createSynthesizedNode(237); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createImportDeclaration = createImportDeclaration; function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) + : node; } ts.updateImportDeclaration = updateImportDeclaration; - function createImportClause(name, namedBindings, location) { - var node = createNode(236, location); + function createImportClause(name, namedBindings) { + var node = createSynthesizedNode(238); node.name = name; node.namedBindings = namedBindings; return node; } ts.createImportClause = createImportClause; function updateImportClause(node, name, namedBindings) { - if (node.name !== name || node.namedBindings !== namedBindings) { - return updateNode(createImportClause(name, namedBindings, node), node); - } - return node; + return node.name !== name + || node.namedBindings !== namedBindings + ? updateNode(createImportClause(name, namedBindings), node) + : node; } ts.updateImportClause = updateImportClause; - function createNamespaceImport(name, location) { - var node = createNode(237, location); + function createNamespaceImport(name) { + var node = createSynthesizedNode(239); node.name = name; return node; } ts.createNamespaceImport = createNamespaceImport; function updateNamespaceImport(node, name) { - if (node.name !== name) { - return updateNode(createNamespaceImport(name, node), node); - } - return node; + return node.name !== name + ? updateNode(createNamespaceImport(name), node) + : node; } ts.updateNamespaceImport = updateNamespaceImport; - function createNamedImports(elements, location) { - var node = createNode(238, location); + function createNamedImports(elements) { + var node = createSynthesizedNode(240); node.elements = createNodeArray(elements); return node; } ts.createNamedImports = createNamedImports; function updateNamedImports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedImports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedImports(elements), node) + : node; } ts.updateNamedImports = updateNamedImports; - function createImportSpecifier(propertyName, name, location) { - var node = createNode(239, location); + function createImportSpecifier(propertyName, name) { + var node = createSynthesizedNode(241); node.propertyName = propertyName; node.name = name; return node; } ts.createImportSpecifier = createImportSpecifier; function updateImportSpecifier(node, propertyName, name) { - if (node.propertyName !== propertyName || node.name !== name) { - return updateNode(createImportSpecifier(propertyName, name, node), node); - } - return node; + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createImportSpecifier(propertyName, name), node) + : node; } ts.updateImportSpecifier = updateImportSpecifier; - function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportAssignment(decorators, modifiers, isExportEquals, expression) { + var node = createSynthesizedNode(242); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = expression; return node; } ts.createExportAssignment = createExportAssignment; function updateExportAssignment(node, decorators, modifiers, expression) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) { - return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.expression !== expression + ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) + : node; } ts.updateExportAssignment = updateExportAssignment; - function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { + var node = createSynthesizedNode(243); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createExportDeclaration = createExportDeclaration; function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.exportClause !== exportClause + || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) + : node; } ts.updateExportDeclaration = updateExportDeclaration; - function createNamedExports(elements, location) { - var node = createNode(242, location); + function createNamedExports(elements) { + var node = createSynthesizedNode(244); node.elements = createNodeArray(elements); return node; } ts.createNamedExports = createNamedExports; function updateNamedExports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedExports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedExports(elements), node) + : node; } ts.updateNamedExports = updateNamedExports; - function createExportSpecifier(name, propertyName, location) { - var node = createNode(243, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createExportSpecifier(propertyName, name) { + var node = createSynthesizedNode(245); + node.propertyName = asName(propertyName); + node.name = asName(name); return node; } ts.createExportSpecifier = createExportSpecifier; - function updateExportSpecifier(node, name, propertyName) { - if (node.name !== name || node.propertyName !== propertyName) { - return updateNode(createExportSpecifier(name, propertyName, node), node); - } - return node; + function updateExportSpecifier(node, propertyName, name) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createExportSpecifier(propertyName, name), node) + : node; } ts.updateExportSpecifier = updateExportSpecifier; - function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246, location); + function createExternalModuleReference(expression) { + var node = createSynthesizedNode(247); + node.expression = expression; + return node; + } + ts.createExternalModuleReference = createExternalModuleReference; + function updateExternalModuleReference(node, expression) { + return node.expression !== expression + ? updateNode(createExternalModuleReference(expression), node) + : node; + } + ts.updateExternalModuleReference = updateExternalModuleReference; + function createJsxElement(openingElement, children, closingElement) { + var node = createSynthesizedNode(248); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -9641,95 +10256,107 @@ var ts; } ts.createJsxElement = createJsxElement; function updateJsxElement(node, openingElement, children, closingElement) { - if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) { - return updateNode(createJsxElement(openingElement, children, closingElement, node), node); - } - return node; + return node.openingElement !== openingElement + || node.children !== children + || node.closingElement !== closingElement + ? updateNode(createJsxElement(openingElement, children, closingElement), node) + : node; } ts.updateJsxElement = updateJsxElement; - function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247, location); + function createJsxSelfClosingElement(tagName, attributes) { + var node = createSynthesizedNode(249); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxSelfClosingElement = createJsxSelfClosingElement; function updateJsxSelfClosingElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxSelfClosingElement(tagName, attributes), node) + : node; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; - function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248, location); + function createJsxOpeningElement(tagName, attributes) { + var node = createSynthesizedNode(250); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxOpeningElement = createJsxOpeningElement; function updateJsxOpeningElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxOpeningElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxOpeningElement(tagName, attributes), node) + : node; } ts.updateJsxOpeningElement = updateJsxOpeningElement; - function createJsxClosingElement(tagName, location) { - var node = createNode(249, location); + function createJsxClosingElement(tagName) { + var node = createSynthesizedNode(251); node.tagName = tagName; return node; } ts.createJsxClosingElement = createJsxClosingElement; function updateJsxClosingElement(node, tagName) { - if (node.tagName !== tagName) { - return updateNode(createJsxClosingElement(tagName, node), node); - } - return node; + return node.tagName !== tagName + ? updateNode(createJsxClosingElement(tagName), node) + : node; } ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer, location) { - var node = createNode(250, location); + function createJsxAttributes(properties) { + var jsxAttributes = createSynthesizedNode(253); + jsxAttributes.properties = createNodeArray(properties); + return jsxAttributes; + } + ts.createJsxAttributes = createJsxAttributes; + function updateJsxAttributes(jsxAttributes, properties) { + if (jsxAttributes.properties !== properties) { + return updateNode(createJsxAttributes(properties), jsxAttributes); + } + return jsxAttributes; + } + ts.updateJsxAttributes = updateJsxAttributes; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(252); node.name = name; node.initializer = initializer; return node; } ts.createJsxAttribute = createJsxAttribute; function updateJsxAttribute(node, name, initializer) { - if (node.name !== name || node.initializer !== initializer) { - return updateNode(createJsxAttribute(name, initializer, node), node); - } - return node; + return node.name !== name + || node.initializer !== initializer + ? updateNode(createJsxAttribute(name, initializer), node) + : node; } ts.updateJsxAttribute = updateJsxAttribute; - function createJsxSpreadAttribute(expression, location) { - var node = createNode(251, location); + function createJsxSpreadAttribute(expression) { + var node = createSynthesizedNode(254); node.expression = expression; return node; } ts.createJsxSpreadAttribute = createJsxSpreadAttribute; function updateJsxSpreadAttribute(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxSpreadAttribute(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxSpreadAttribute(expression), node) + : node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252, location); + function createJsxExpression(dotDotDotToken, expression) { + var node = createSynthesizedNode(255); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) + : node; } ts.updateJsxExpression = updateJsxExpression; - function createHeritageClause(token, types, location) { - var node = createNode(255, location); + function createHeritageClause(token, types) { + var node = createSynthesizedNode(258); node.token = token; node.types = createNodeArray(types); return node; @@ -9737,40 +10364,40 @@ var ts; ts.createHeritageClause = createHeritageClause; function updateHeritageClause(node, types) { if (node.types !== types) { - return updateNode(createHeritageClause(node.token, types, node), node); + return updateNode(createHeritageClause(node.token, types), node); } return node; } ts.updateHeritageClause = updateHeritageClause; - function createCaseClause(expression, statements, location) { - var node = createNode(253, location); - node.expression = parenthesizeExpressionForList(expression); + function createCaseClause(expression, statements) { + var node = createSynthesizedNode(256); + node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; } ts.createCaseClause = createCaseClause; function updateCaseClause(node, expression, statements) { if (node.expression !== expression || node.statements !== statements) { - return updateNode(createCaseClause(expression, statements, node), node); + return updateNode(createCaseClause(expression, statements), node); } return node; } ts.updateCaseClause = updateCaseClause; - function createDefaultClause(statements, location) { - var node = createNode(254, location); + function createDefaultClause(statements) { + var node = createSynthesizedNode(257); node.statements = createNodeArray(statements); return node; } ts.createDefaultClause = createDefaultClause; function updateDefaultClause(node, statements) { if (node.statements !== statements) { - return updateNode(createDefaultClause(statements, node), node); + return updateNode(createDefaultClause(statements), node); } return node; } ts.updateDefaultClause = updateDefaultClause; - function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256, location); + function createCatchClause(variableDeclaration, block) { + var node = createSynthesizedNode(259); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -9778,56 +10405,71 @@ var ts; ts.createCatchClause = createCatchClause; function updateCatchClause(node, variableDeclaration, block) { if (node.variableDeclaration !== variableDeclaration || node.block !== block) { - return updateNode(createCatchClause(variableDeclaration, block, node), node); + return updateNode(createCatchClause(variableDeclaration, block), node); } return node; } ts.updateCatchClause = updateCatchClause; - function createPropertyAssignment(name, initializer, location) { - var node = createNode(257, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAssignment(name, initializer) { + var node = createSynthesizedNode(260); + node.name = asName(name); node.questionToken = undefined; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createPropertyAssignment = createPropertyAssignment; function updatePropertyAssignment(node, name, initializer) { if (node.name !== name || node.initializer !== initializer) { - return updateNode(createPropertyAssignment(name, initializer, node), node); + return updateNode(createPropertyAssignment(name, initializer), node); } return node; } ts.updatePropertyAssignment = updatePropertyAssignment; - function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; + function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { + var node = createSynthesizedNode(261); + node.name = asName(name); + node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; - function createSpreadAssignment(expression, location) { - var node = createNode(259, location); - node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; - return node; - } - ts.createSpreadAssignment = createSpreadAssignment; function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) { - return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node); + return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node); } return node; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; + function createSpreadAssignment(expression) { + var node = createSynthesizedNode(262); + node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; + return node; + } + ts.createSpreadAssignment = createSpreadAssignment; function updateSpreadAssignment(node, expression) { if (node.expression !== expression) { - return updateNode(createSpreadAssignment(expression, node), node); + return updateNode(createSpreadAssignment(expression), node); } return node; } ts.updateSpreadAssignment = updateSpreadAssignment; + function createEnumMember(name, initializer) { + var node = createSynthesizedNode(263); + node.name = asName(name); + node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); + return node; + } + ts.createEnumMember = createEnumMember; + function updateEnumMember(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createEnumMember(name, initializer), node) + : node; + } + ts.updateEnumMember = updateEnumMember; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261, node, node.flags); + var updated = createSynthesizedNode(264); + updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -9886,56 +10528,73 @@ var ts; return node; } ts.updateSourceFileNode = updateSourceFileNode; + function getMutableClone(node) { + var clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + clone.parent = node.parent; + return clone; + } + ts.getMutableClone = getMutableClone; function createNotEmittedStatement(original) { - var node = createNode(293, original); + var node = createSynthesizedNode(294); node.original = original; + setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(296); + var node = createSynthesizedNode(297); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(295); + var node = createSynthesizedNode(296); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; - function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294, location || original); + function createPartiallyEmittedExpression(expression, original) { + var node = createSynthesizedNode(295); node.expression = expression; node.original = original; + setTextRange(node, original); return node; } ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; function updatePartiallyEmittedExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node); + return updateNode(createPartiallyEmittedExpression(expression, node.original), node); } return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - function createRawExpression(text) { - var node = createNode(297); - node.text = text; + function createBundle(sourceFiles) { + var node = ts.createNode(265); + node.sourceFiles = sourceFiles; return node; } - ts.createRawExpression = createRawExpression; + ts.createBundle = createBundle; + function updateBundle(node, sourceFiles) { + if (node.sourceFiles !== sourceFiles) { + return createBundle(sourceFiles); + } + return node; + } + ts.updateBundle = updateBundle; function createComma(left, right) { return createBinary(left, 25, right); } ts.createComma = createComma; - function createLessThan(left, right, location) { - return createBinary(left, 26, right, location); + function createLessThan(left, right) { + return createBinary(left, 26, right); } ts.createLessThan = createLessThan; - function createAssignment(left, right, location) { - return createBinary(left, 57, right, location); + function createAssignment(left, right) { + return createBinary(left, 57, right); } ts.createAssignment = createAssignment; function createStrictEquality(left, right) { @@ -9954,8 +10613,8 @@ var ts; return createBinary(left, 37, right); } ts.createSubtract = createSubtract; - function createPostfixIncrement(operand, location) { - return createPostfix(operand, 42, location); + function createPostfixIncrement(operand) { + return createPostfix(operand, 42); } ts.createPostfixIncrement = createPostfixIncrement; function createLogicalAnd(left, right) { @@ -9974,54 +10633,305 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createExportDefault(expression) { + return createExportAssignment(undefined, undefined, false, expression); + } + ts.createExportDefault = createExportDefault; + function createExternalModuleExport(exportName) { + return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(undefined, exportName)])); + } + ts.createExternalModuleExport = createExternalModuleExport; + function asName(name) { + return typeof name === "string" ? createIdentifier(name) : name; + } + function asExpression(value) { + return typeof value === "string" || typeof value === "number" ? createLiteral(value) : value; + } + function asNodeArray(array) { + return array ? createNodeArray(array) : undefined; + } + function asToken(value) { + return typeof value === "number" ? createToken(value) : value; + } + function disposeEmitNodes(sourceFile) { + sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); + var emitNode = sourceFile && sourceFile.emitNode; + var annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = undefined; + } + } + } + ts.disposeEmitNodes = disposeEmitNodes; + function getOrCreateEmitNode(node) { + if (!node.emitNode) { + if (ts.isParseTreeNode(node)) { + if (node.kind === 264) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = ts.getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } + return node.emitNode; + } + ts.getOrCreateEmitNode = getOrCreateEmitNode; + function setTextRange(range, location) { + if (location) { + range.pos = location.pos; + range.end = location.end; + } + return range; + } + ts.setTextRange = setTextRange; + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + ts.getEmitFlags = getEmitFlags; + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + ts.setEmitFlags = setEmitFlags; + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; + function setSourceMapRange(node, range) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + ts.setSourceMapRange = setSourceMapRange; + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; + function setTokenSourceMapRange(node, token, range) { + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); + tokenSourceMapRanges[token] = range; + return node; + } + ts.setTokenSourceMapRange = setTokenSourceMapRange; + function getCommentRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + ts.getCommentRange = getCommentRange; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + ts.setCommentRange = setCommentRange; + function getSyntheticLeadingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.leadingComments; + } + ts.getSyntheticLeadingComments = getSyntheticLeadingComments; + function setSyntheticLeadingComments(node, comments) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + ts.setSyntheticLeadingComments = setSyntheticLeadingComments; + function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticLeadingComment = addSyntheticLeadingComment; + function getSyntheticTrailingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.trailingComments; + } + ts.getSyntheticTrailingComments = getSyntheticTrailingComments; + function setSyntheticTrailingComments(node, comments) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + ts.setSyntheticTrailingComments = setSyntheticTrailingComments; + function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticTrailingComment = addSyntheticTrailingComment; + function getConstantValue(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + ts.getConstantValue = getConstantValue; + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + ts.setConstantValue = setConstantValue; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === undefined) + return 1; + if (y.priority === undefined) + return -1; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) + destEmitNode = {}; + if (leadingComments) + destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) + destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments); + if (flags) + destEmitNode.flags = flags; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) + destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); + return destEmitNode; + } + function mergeTokenSourceMapRanges(sourceRanges, destRanges) { + if (!destRanges) + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } + return destRanges; + } +})(ts || (ts = {})); +(function (ts) { function createTypeCheck(value, tag) { return tag === "undefined" - ? createStrictEquality(value, createVoidZero()) - : createStrictEquality(createTypeOf(value), createLiteral(tag)); + ? ts.createStrictEquality(value, ts.createVoidZero()) + : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)); } ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { - return createElementAccess(target, memberName.expression, location); + return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); } else { - var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 64; + var expression = ts.setTextRange(ts.isIdentifier(memberName) + ? ts.createPropertyAccess(target, memberName) + : ts.createElementAccess(target, memberName), memberName); + ts.getOrCreateEmitNode(expression).flags |= 64; return expression; } } ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; function createFunctionCall(func, thisArg, argumentsList, location) { - return createCall(createPropertyAccess(func, "call"), undefined, [ + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), undefined, [ thisArg - ].concat(argumentsList), location); + ].concat(argumentsList)), location); } ts.createFunctionCall = createFunctionCall; function createFunctionApply(func, thisArg, argumentsExpression, location) { - return createCall(createPropertyAccess(func, "apply"), undefined, [ + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), undefined, [ thisArg, argumentsExpression - ], location); + ]), location); } ts.createFunctionApply = createFunctionApply; function createArraySlice(array, start) { var argumentsList = []; if (start !== undefined) { - argumentsList.push(typeof start === "number" ? createLiteral(start) : start); + argumentsList.push(typeof start === "number" ? ts.createLiteral(start) : start); } - return createCall(createPropertyAccess(array, "slice"), undefined, argumentsList); + return ts.createCall(ts.createPropertyAccess(array, "slice"), undefined, argumentsList); } ts.createArraySlice = createArraySlice; function createArrayConcat(array, values) { - return createCall(createPropertyAccess(array, "concat"), undefined, values); + return ts.createCall(ts.createPropertyAccess(array, "concat"), undefined, values); } ts.createArrayConcat = createArrayConcat; function createMathPow(left, right, location) { - return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), undefined, [left, right], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), undefined, [left, right]), location); } ts.createMathPow = createMathPow; function createReactNamespace(reactNamespace, parent) { - var react = createIdentifier(reactNamespace || "React"); + var react = ts.createIdentifier(reactNamespace || "React"); react.flags &= ~8; react.parent = ts.getParseTreeNode(parent); return react; @@ -10029,9 +10939,9 @@ var ts; function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); - var right = createSynthesizedNode(70); + var right = ts.createIdentifier(jsxFactory.right.text); right.text = jsxFactory.right.text; - return createPropertyAccess(left, right); + return ts.createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -10040,7 +10950,7 @@ var ts; function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : - createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); } function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { var argumentsList = [tagName]; @@ -10049,7 +10959,7 @@ var ts; } if (children && children.length > 0) { if (!props) { - argumentsList.push(createNull()); + argumentsList.push(ts.createNull()); } if (children.length > 1) { for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { @@ -10062,33 +10972,80 @@ var ts; argumentsList.push(children[0]); } } - return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList, location); + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; - function createExportDefault(expression) { - return createExportAssignment(undefined, undefined, false, expression); - } - ts.createExportDefault = createExportDefault; - function createExternalModuleExport(exportName) { - return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(exportName)])); + function getHelperName(name) { + return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2); } - ts.createExternalModuleExport = createExternalModuleExport; - function createLetStatement(name, initializer, location) { - return createVariableStatement(undefined, createLetDeclarationList([createVariableDeclaration(name, undefined, initializer)]), location); + ts.getHelperName = getHelperName; + var valuesHelper = { + name: "typescript:values", + scoped: false, + text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n " + }; + function createValuesHelper(context, expression, location) { + context.requestEmitHelper(valuesHelper); + return ts.setTextRange(ts.createCall(getHelperName("__values"), undefined, [expression]), location); } - ts.createLetStatement = createLetStatement; - function createLetDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 1); + ts.createValuesHelper = createValuesHelper; + var readHelper = { + name: "typescript:read", + scoped: false, + text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n " + }; + function createReadHelper(context, iteratorRecord, count, location) { + context.requestEmitHelper(readHelper); + return ts.setTextRange(ts.createCall(getHelperName("__read"), undefined, count !== undefined + ? [iteratorRecord, ts.createLiteral(count)] + : [iteratorRecord]), location); + } + ts.createReadHelper = createReadHelper; + var spreadHelper = { + name: "typescript:spread", + scoped: false, + text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" + }; + function createSpreadHelper(context, argumentList, location) { + context.requestEmitHelper(readHelper); + context.requestEmitHelper(spreadHelper); + return ts.setTextRange(ts.createCall(getHelperName("__spread"), undefined, argumentList), location); + } + ts.createSpreadHelper = createSpreadHelper; + function createForOfBindingStatement(node, boundValue) { + if (ts.isVariableDeclarationList(node)) { + var firstDeclaration = ts.firstOrUndefined(node.declarations); + var updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, undefined, boundValue); + return ts.setTextRange(ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(node, [updatedDeclaration])), node); + } + else { + var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), node); + return ts.setTextRange(ts.createStatement(updatedExpression), node); + } } - ts.createLetDeclarationList = createLetDeclarationList; - function createConstDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 2); + ts.createForOfBindingStatement = createForOfBindingStatement; + function insertLeadingStatement(dest, source) { + if (ts.isBlock(dest)) { + return ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)); + } + else { + return ts.createBlock(ts.createNodeArray([dest, source]), true); + } } - ts.createConstDeclarationList = createConstDeclarationList; - function getHelperName(name) { - return setEmitFlags(createIdentifier(name), 4096 | 2); + ts.insertLeadingStatement = insertLeadingStatement; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; } - ts.getHelperName = getHelperName; + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -10098,13 +11055,13 @@ var ts; case 8: case 9: return false; - case 175: + case 176: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176: + case 177: return target.properties.length > 0; default: return true; @@ -10115,19 +11072,26 @@ var ts; var thisArg; var target; if (ts.isSuperProperty(callee)) { - thisArg = createThis(); + thisArg = ts.createThis(); target = callee; } else if (callee.kind === 96) { - thisArg = createThis(); - target = languageVersion < 2 ? createIdentifier("_super", callee) : callee; + thisArg = ts.createThis(); + target = languageVersion < 2 + ? ts.setTextRange(ts.createIdentifier("_super"), callee) + : callee; + } + else if (ts.getEmitFlags(callee) & 4096) { + thisArg = ts.createVoidZero(); + target = parenthesizeForAccess(callee); } else { switch (callee.kind) { - case 177: { + case 178: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = createTempVariable(recordTempVariable); - target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -10135,10 +11099,11 @@ var ts; } break; } - case 178: { + case 179: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = createTempVariable(recordTempVariable); - target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -10147,7 +11112,7 @@ var ts; break; } default: { - thisArg = createVoidZero(); + thisArg = ts.createVoidZero(); target = parenthesizeForAccess(expression); break; } @@ -10157,42 +11122,42 @@ var ts; } ts.createCallBinding = createCallBinding; function inlineExpressions(expressions) { - return ts.reduceLeft(expressions, createComma); + return ts.reduceLeft(expressions, ts.createComma); } ts.inlineExpressions = inlineExpressions; function createExpressionFromEntityName(node) { if (ts.isQualifiedName(node)) { var left = createExpressionFromEntityName(node.left); - var right = getMutableClone(node.right); - return createPropertyAccess(left, right, node); + var right = ts.getMutableClone(node.right); + return ts.setTextRange(ts.createPropertyAccess(left, right), node); } else { - return getMutableClone(node); + return ts.getMutableClone(node); } } ts.createExpressionFromEntityName = createExpressionFromEntityName; function createExpressionForPropertyName(memberName) { if (ts.isIdentifier(memberName)) { - return createLiteral(memberName, undefined); + return ts.createLiteral(memberName); } else if (ts.isComputedPropertyName(memberName)) { - return getMutableClone(memberName.expression); + return ts.getMutableClone(memberName.expression); } else { - return getMutableClone(memberName); + return ts.getMutableClone(memberName); } } ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151: case 152: + case 153: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257: + case 260: return createExpressionForPropertyAssignment(property, receiver); - case 258: + case 261: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149: + case 150: return createExpressionForMethodDeclaration(property, receiver); } } @@ -10202,43 +11167,45 @@ var ts; if (property === firstAccessor) { var properties_1 = []; if (getAccessor) { - var getterFunction = createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor); - setOriginalNode(getterFunction, getAccessor); - var getter = createPropertyAssignment("get", getterFunction); + var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body); + ts.setTextRange(getterFunction, getAccessor); + ts.setOriginalNode(getterFunction, getAccessor); + var getter = ts.createPropertyAssignment("get", getterFunction); properties_1.push(getter); } if (setAccessor) { - var setterFunction = createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor); - setOriginalNode(setterFunction, setAccessor); - var setter = createPropertyAssignment("set", setterFunction); + var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body); + ts.setTextRange(setterFunction, setAccessor); + ts.setOriginalNode(setterFunction, setAccessor); + var setter = ts.createPropertyAssignment("set", setterFunction); properties_1.push(setter); } - properties_1.push(createPropertyAssignment("enumerable", createLiteral(true))); - properties_1.push(createPropertyAssignment("configurable", createLiteral(true))); - var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), undefined, [ + properties_1.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); + properties_1.push(ts.createPropertyAssignment("configurable", ts.createTrue())); + var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ receiver, createExpressionForPropertyName(property.name), - createObjectLiteral(properties_1, undefined, multiLine) - ], firstAccessor); + ts.createObjectLiteral(properties_1, multiLine) + ]), firstAccessor); return ts.aggregateTransformFlags(expression); } return undefined; } function createExpressionForPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer, property), property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer), property), property)); } function createExpressionForShorthandPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), ts.getSynthesizedClone(property.name)), property), property)); } function createExpressionForMethodDeclaration(method, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body), method), method)), method), method)); } function getLocalName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 16384); } ts.getLocalName = getLocalName; function isLocalName(node) { - return (getEmitFlags(node) & 16384) !== 0; + return (ts.getEmitFlags(node) & 16384) !== 0; } ts.isLocalName = isLocalName; function getExportName(node, allowComments, allowSourceMaps) { @@ -10246,7 +11213,7 @@ var ts; } ts.getExportName = getExportName; function isExportName(node) { - return (getEmitFlags(node) & 8192) !== 0; + return (ts.getEmitFlags(node) & 8192) !== 0; } ts.isExportName = isExportName; function getDeclarationName(node, allowComments, allowSourceMaps) { @@ -10255,17 +11222,17 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_8 = getMutableClone(node.name); - emitFlags |= getEmitFlags(node.name); + var name = ts.getMutableClone(node.name); + emitFlags |= ts.getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_8, emitFlags); - return name_8; + ts.setEmitFlags(name, emitFlags); + return name; } - return getGeneratedNameForNode(node); + return ts.getGeneratedNameForNode(node); } function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { if (ns && ts.hasModifier(node, 1)) { @@ -10275,25 +11242,31 @@ var ts; } ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName; function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { - var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name); + var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); + ts.setTextRange(qualifiedName, name); var emitFlags; if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(qualifiedName, emitFlags); + ts.setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; function convertToFunctionBody(node, multiLine) { - return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine); + return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node); } ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } - function addPrologueDirectives(target, source, ensureUseStrict, visitor) { + function addPrologue(target, source, ensureUseStrict, visitor) { + var offset = addStandardPrologue(target, source, ensureUseStrict); + return addCustomPrologue(target, source, offset, visitor); + } + ts.addPrologue = addPrologue; + function addStandardPrologue(target, source, ensureUseStrict) { ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); var foundUseStrict = false; var statementOffset = 0; @@ -10312,11 +11285,16 @@ var ts; statementOffset++; } if (ensureUseStrict && !foundUseStrict) { - target.push(startOnNewLine(createStatement(createLiteral("use strict")))); + target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))); } + return statementOffset; + } + ts.addStandardPrologue = addStandardPrologue; + function addCustomPrologue(target, source, statementOffset, visitor) { + var numStatements = source.length; while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 524288) { + if (ts.getEmitFlags(statement) & 524288) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -10326,7 +11304,7 @@ var ts; } return statementOffset; } - ts.addPrologueDirectives = addPrologueDirectives; + ts.addCustomPrologue = addCustomPrologue; function startsWithUseStrict(statements) { var firstStatement = ts.firstOrUndefined(statements); return firstStatement !== undefined @@ -10349,33 +11327,43 @@ var ts; } } if (!foundUseStrict) { - return createNodeArray([ - startOnNewLine(createStatement(createLiteral("use strict"))) - ].concat(statements), statements); + return ts.setTextRange(ts.createNodeArray([ + startOnNewLine(ts.createStatement(ts.createLiteral("use strict"))) + ].concat(statements)), statements); } return statements; } ts.ensureUseStrict = ensureUseStrict; + function parenthesizeConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { + return ts.createParen(condition); + } + return condition; + } + ts.parenthesizeConditionalHead = parenthesizeConditionalHead; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 183) { + if (skipped.kind === 184) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) - ? createParen(operand) + ? ts.createParen(operand) : operand; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 195) { + && operand.kind === 196) { return false; } return true; @@ -10414,7 +11402,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 && node.operatorToken.kind === 36) { + if (node.kind === 193 && node.operatorToken.kind === 36) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -10429,29 +11417,30 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { - return createParen(condition); + return ts.createParen(condition); } return condition; } ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { - return e.kind === 192 && e.operatorToken.kind === 25 - ? createParen(e) + return e.kind === 193 && e.operatorToken.kind === 25 + ? ts.createParen(e) : e; } + ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179: - return createParen(expression); case 180: + return ts.createParen(expression); + case 181: return emittedExpression.arguments ? expression - : createParen(expression); + : ts.createParen(expression); } return parenthesizeForAccess(expression); } @@ -10459,23 +11448,22 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 || emittedExpression.arguments) - && emittedExpression.kind !== 8) { + && (emittedExpression.kind !== 181 || emittedExpression.arguments)) { return expression; } - return createParen(expression, expression); + return ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeForAccess = parenthesizeForAccess; function parenthesizePostfixOperand(operand) { return ts.isLeftHandSideExpression(operand) ? operand - : createParen(operand, operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePostfixOperand = parenthesizePostfixOperand; function parenthesizePrefixOperand(operand) { return ts.isUnaryExpression(operand) ? operand - : createParen(operand, operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePrefixOperand = parenthesizePrefixOperand; function parenthesizeListElements(elements) { @@ -10490,17 +11478,18 @@ var ts; } } if (result !== undefined) { - return createNodeArray(result, elements, elements.hasTrailingComma); + return ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements); } return elements; } + ts.parenthesizeListElements = parenthesizeListElements; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192, 25); + var commaPrecedence = ts.getOperatorPrecedence(193, 25); return expressionPrecedence > commaPrecedence ? expression - : createParen(expression, expression); + : ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeExpressionForList = parenthesizeExpressionForList; function parenthesizeExpressionForExpressionStatement(expression) { @@ -10508,16 +11497,16 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 || kind === 185) { - var mutableCall = getMutableClone(emittedExpression); - mutableCall.expression = createParen(callee, callee); + if (kind === 185 || kind === 186) { + var mutableCall = ts.getMutableClone(emittedExpression); + mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); } } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) { - return createParen(expression, expression); + if (leftmostExpressionKind === 177 || leftmostExpressionKind === 185) { + return ts.setTextRange(ts.createParen(expression), expression); } } return expression; @@ -10525,7 +11514,7 @@ var ts; ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement; function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) { if (ts.isPartiallyEmittedExpression(originalOuterExpression)) { - var clone_1 = getMutableClone(originalOuterExpression); + var clone_1 = ts.getMutableClone(originalOuterExpression); clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression); return clone_1; } @@ -10534,21 +11523,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191: + case 192: node = node.operand; continue; - case 192: + case 193: node = node.left; continue; - case 193: + case 194: node = node.condition; continue; + case 180: case 179: case 178: - case 177: node = node.expression; continue; - case 294: + case 295: node = node.expression; continue; } @@ -10556,9 +11545,8 @@ var ts; } } function parenthesizeConciseBody(body) { - var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176) { - return createParen(body, body); + if (!ts.isBlock(body) && getLeftmostExpression(body).kind === 177) { + return ts.setTextRange(ts.createParen(body), body); } return body; } @@ -10582,7 +11570,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183) { + while (node.kind === 184) { node = node.expression; } return node; @@ -10596,7 +11584,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294) { + while (node.kind === 295) { node = node.expression; } return node; @@ -10607,120 +11595,6 @@ var ts; return node; } ts.startOnNewLine = startOnNewLine; - function setOriginalNode(node, original) { - node.original = original; - if (original) { - var emitNode = original.emitNode; - if (emitNode) - node.emitNode = mergeEmitNode(emitNode, node.emitNode); - } - return node; - } - ts.setOriginalNode = setOriginalNode; - function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; - if (!destEmitNode) - destEmitNode = {}; - if (flags) - destEmitNode.flags = flags; - if (commentRange) - destEmitNode.commentRange = commentRange; - if (sourceMapRange) - destEmitNode.sourceMapRange = sourceMapRange; - if (tokenSourceMapRanges) - destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); - if (constantValue !== undefined) - destEmitNode.constantValue = constantValue; - if (helpers) - destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); - return destEmitNode; - } - function mergeTokenSourceMapRanges(sourceRanges, destRanges) { - if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); - return destRanges; - } - function disposeEmitNodes(sourceFile) { - sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); - var emitNode = sourceFile && sourceFile.emitNode; - var annotatedNodes = emitNode && emitNode.annotatedNodes; - if (annotatedNodes) { - for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { - var node = annotatedNodes_1[_i]; - node.emitNode = undefined; - } - } - } - ts.disposeEmitNodes = disposeEmitNodes; - function getOrCreateEmitNode(node) { - if (!node.emitNode) { - if (ts.isParseTreeNode(node)) { - if (node.kind === 261) { - return node.emitNode = { annotatedNodes: [node] }; - } - var sourceFile = ts.getSourceFileOfNode(node); - getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); - } - node.emitNode = {}; - } - return node.emitNode; - } - ts.getOrCreateEmitNode = getOrCreateEmitNode; - function getEmitFlags(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.flags; - } - ts.getEmitFlags = getEmitFlags; - function setEmitFlags(node, emitFlags) { - getOrCreateEmitNode(node).flags = emitFlags; - return node; - } - ts.setEmitFlags = setEmitFlags; - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; - } - ts.getSourceMapRange = getSourceMapRange; - function setSourceMapRange(node, range) { - getOrCreateEmitNode(node).sourceMapRange = range; - return node; - } - ts.setSourceMapRange = setSourceMapRange; - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; - function setTokenSourceMapRange(node, token, range) { - var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); - tokenSourceMapRanges[token] = range; - return node; - } - ts.setTokenSourceMapRange = setTokenSourceMapRange; - function getCommentRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.commentRange) || node; - } - ts.getCommentRange = getCommentRange; - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; - function getConstantValue(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.constantValue; - } - ts.getConstantValue = getConstantValue; - function setConstantValue(node, value) { - var emitNode = getOrCreateEmitNode(node); - emitNode.constantValue = value; - return node; - } - ts.setConstantValue = setConstantValue; function getExternalHelpersModuleName(node) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); var emitNode = parseNode && parseNode.emitNode; @@ -10733,125 +11607,31 @@ var ts; if (externalHelpersModuleName) { return externalHelpersModuleName; } - var helpers = getEmitHelpers(node); + var helpers = ts.getEmitHelpers(node); if (helpers) { - for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { - var helper = helpers_1[_i]; + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; if (!helper.scoped) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); - var emitNode = getOrCreateEmitNode(parseNode); - return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + var emitNode = ts.getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)); } } } } } ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; - function addEmitHelper(node, helper) { - var emitNode = getOrCreateEmitNode(node); - emitNode.helpers = ts.append(emitNode.helpers, helper); - return node; - } - ts.addEmitHelper = addEmitHelper; - function addEmitHelpers(node, helpers) { - if (ts.some(helpers)) { - var emitNode = getOrCreateEmitNode(node); - for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { - var helper = helpers_2[_i]; - if (!ts.contains(emitNode.helpers, helper)) { - emitNode.helpers = ts.append(emitNode.helpers, helper); - } - } - } - return node; - } - ts.addEmitHelpers = addEmitHelpers; - function removeEmitHelper(node, helper) { - var emitNode = node.emitNode; - if (emitNode) { - var helpers = emitNode.helpers; - if (helpers) { - return ts.orderedRemoveItem(helpers, helper); - } - } - return false; - } - ts.removeEmitHelper = removeEmitHelper; - function getEmitHelpers(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.helpers; - } - ts.getEmitHelpers = getEmitHelpers; - function moveEmitHelpers(source, target, predicate) { - var sourceEmitNode = source.emitNode; - var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; - if (!ts.some(sourceEmitHelpers)) - return; - var targetEmitNode = getOrCreateEmitNode(target); - var helpersRemoved = 0; - for (var i = 0; i < sourceEmitHelpers.length; i++) { - var helper = sourceEmitHelpers[i]; - if (predicate(helper)) { - helpersRemoved++; - if (!ts.contains(targetEmitNode.helpers, helper)) { - targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); - } - } - else if (helpersRemoved > 0) { - sourceEmitHelpers[i - helpersRemoved] = helper; - } - } - if (helpersRemoved > 0) { - sourceEmitHelpers.length -= helpersRemoved; - } - } - ts.moveEmitHelpers = moveEmitHelpers; - function compareEmitHelpers(x, y) { - if (x === y) - return 0; - if (x.priority === y.priority) - return 0; - if (x.priority === undefined) - return 1; - if (y.priority === undefined) - return -1; - return ts.compareValues(x.priority, y.priority); - } - ts.compareEmitHelpers = compareEmitHelpers; - function setTextRange(node, location) { - if (location) { - node.pos = location.pos; - node.end = location.end; - } - return node; - } - ts.setTextRange = setTextRange; - function setNodeFlags(node, flags) { - node.flags = flags; - return node; - } - ts.setNodeFlags = setNodeFlags; - function setMultiLine(node, multiLine) { - node.multiLine = multiLine; - return node; - } - ts.setMultiLine = setMultiLine; - function setHasTrailingComma(nodes, hasTrailingComma) { - nodes.hasTrailingComma = hasTrailingComma; - return nodes; - } - ts.setHasTrailingComma = setHasTrailingComma; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_9 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 && node.importClause) { - return getGeneratedNameForNode(node); + if (node.kind === 237 && node.importClause) { + return ts.getGeneratedNameForNode(node); } - if (node.kind === 241 && node.moduleSpecifier) { - return getGeneratedNameForNode(node); + if (node.kind === 243 && node.moduleSpecifier) { + return ts.getGeneratedNameForNode(node); } return undefined; } @@ -10861,26 +11641,24 @@ var ts; if (moduleName.kind === 9) { return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) || tryRenameExternalModule(moduleName, sourceFile) - || getSynthesizedClone(moduleName); + || ts.getSynthesizedClone(moduleName); } return undefined; } ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && ts.createLiteral(rename); } function tryGetModuleNameFromFile(file, host, options) { if (!file) { return undefined; } if (file.moduleName) { - return createLiteral(file.moduleName); + return ts.createLiteral(file.moduleName); } if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) { - return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); + return ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); } return undefined; } @@ -10914,11 +11692,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257: + case 260: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 258: + case 261: return bindingElement.name; - case 259: + case 262: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -10934,11 +11712,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144: - case 174: + case 145: + case 175: return bindingElement.dotDotDotToken; - case 196: - case 259: + case 197: + case 262: return bindingElement; } return undefined; @@ -10946,7 +11724,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174: + case 175: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -10954,7 +11732,7 @@ var ts; : propertyName; } break; - case 257: + case 260: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -10962,7 +11740,7 @@ var ts; : propertyName; } break; - case 259: + case 262: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -10976,11 +11754,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172: case 173: - case 175: - return name.elements; + case 174: case 176: + return name.elements; + case 177: return name.properties; } } @@ -10989,10 +11767,12 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpread(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); } var expression = convertToAssignmentElementTarget(element.name); - return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + return element.initializer + ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) + : expression; } ts.Debug.assertNode(element, ts.isExpression); return element; @@ -11002,14 +11782,14 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpreadAssignment(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); } if (element.propertyName) { var expression = convertToAssignmentElementTarget(element.name); - return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element); } ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element); } ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); return element; @@ -11017,18 +11797,18 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: - return convertToArrayAssignmentPattern(node); - case 172: + case 174: case 176: + return convertToArrayAssignmentPattern(node); + case 173: + case 177: return convertToObjectAssignmentPattern(node); } } ts.convertToAssignmentPattern = convertToAssignmentPattern; function convertToObjectAssignmentPattern(node) { if (ts.isObjectBindingPattern(node)) { - return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isObjectLiteralExpression); return node; @@ -11036,7 +11816,7 @@ var ts; ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; function convertToArrayAssignmentPattern(node) { if (ts.isArrayBindingPattern(node)) { - return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isArrayLiteralExpression); return node; @@ -11052,30 +11832,30 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; var exportEquals = undefined; var hasExportStarsToExportValues = false; var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); - var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); if (externalHelpersImportDeclaration) { externalImports.push(externalHelpersImportDeclaration); } for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235: + case 237: externalImports.push(node); break; - case 234: - if (node.moduleReference.kind === 245) { + case 236: + if (node.moduleReference.kind === 247) { externalImports.push(node); } break; - case 241: + case 243: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -11088,26 +11868,26 @@ var ts; else { for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 240: + case 242: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 205: + case 207: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -11115,38 +11895,38 @@ var ts; } } break; - case 225: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = true; - exportedNames = ts.append(exportedNames, name_11); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 226: + case 228: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = true; - exportedNames = ts.append(exportedNames, name_12); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -11166,13 +11946,23 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); var ts; (function (ts) { @@ -11181,13 +11971,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261) { + if (kind === 264) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141) { + else if (kind < 142) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -11223,28 +12013,29 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141: + case 142: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143: + case 144: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 258: + case 261: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259: + case 262: return visitNode(cbNode, node.expression); - case 144: + case 145: + case 148: case 147: - case 146: - case 257: - case 223: - case 174: + case 260: + case 225: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -11253,24 +12044,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158: case 159: - case 153: + case 160: case 154: case 155: + case 156: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 225: + case 153: case 185: + case 227: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -11281,320 +12072,326 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157: + case 158: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156: + case 157: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160: - return visitNode(cbNode, node.exprName); case 161: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 162: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 163: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 164: + return visitNodes(cbNodes, node.elementTypes); case 165: - return visitNodes(cbNodes, node.types); case 166: - case 168: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); + case 167: case 169: + return visitNode(cbNode, node.type); + case 170: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170: + case 171: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171: - return visitNode(cbNode, node.literal); case 172: + return visitNode(cbNode, node.literal); case 173: - return visitNodes(cbNodes, node.elements); - case 175: + case 174: return visitNodes(cbNodes, node.elements); case 176: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 177: + return visitNodes(cbNodes, node.properties); + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178: + case 179: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179: case 180: + case 181: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181: + case 182: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182: + case 183: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.expression); - case 186: + case 184: return visitNode(cbNode, node.expression); case 187: return visitNode(cbNode, node.expression); case 188: return visitNode(cbNode, node.expression); - case 190: - return visitNode(cbNode, node.operand); - case 195: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 189: return visitNode(cbNode, node.expression); case 191: return visitNode(cbNode, node.operand); + case 196: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 190: + return visitNode(cbNode, node.expression); case 192: + return visitNode(cbNode, node.operand); + case 193: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200: + case 201: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201: + case 202: return visitNode(cbNode, node.expression); - case 193: + case 203: + return visitNode(cbNode, node.name); + case 194: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196: + case 197: return visitNode(cbNode, node.expression); - case 204: - case 231: + case 206: + case 233: return visitNodes(cbNodes, node.statements); - case 261: + case 264: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205: + case 207: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224: + case 226: return visitNodes(cbNodes, node.declarations); - case 207: + case 209: return visitNode(cbNode, node.expression); - case 208: + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209: + case 211: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210: + case 212: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 211: + case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 212: + case 214: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213: - return visitNode(cbNode, node.initializer) || + case 215: + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214: - case 215: - return visitNode(cbNode, node.label); case 216: - return visitNode(cbNode, node.expression); case 217: + return visitNode(cbNode, node.label); + case 218: + return visitNode(cbNode, node.expression); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218: + case 220: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232: + case 234: return visitNodes(cbNodes, node.clauses); - case 253: + case 256: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254: + case 257: return visitNodes(cbNodes, node.statements); - case 219: + case 221: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220: + case 222: return visitNode(cbNode, node.expression); - case 221: + case 223: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256: + case 259: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145: + case 146: return visitNode(cbNode, node.expression); - case 226: - case 197: + case 228: + case 198: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 227: + case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 228: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 229: + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 260: + case 263: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 230: + case 232: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235: + case 237: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233: + case 235: return visitNode(cbNode, node.name); - case 237: + case 239: return visitNode(cbNode, node.name); - case 238: - case 242: + case 240: + case 244: return visitNodes(cbNodes, node.elements); - case 241: + case 243: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239: - case 243: + case 241: + case 245: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194: + case 195: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142: + case 143: return visitNode(cbNode, node.expression); - case 255: + case 258: return visitNodes(cbNodes, node.types); - case 199: + case 200: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245: + case 247: return visitNode(cbNode, node.expression); - case 244: - return visitNodes(cbNodes, node.decorators); case 246: + return visitNodes(cbNodes, node.decorators); + case 248: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247: - case 248: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNodes, node.attributes); + case 249: case 250: + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.attributes); + case 253: + return visitNodes(cbNodes, node.properties); + case 252: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251: - return visitNode(cbNode, node.expression); - case 252: + case 254: return visitNode(cbNode, node.expression); - case 249: + case 255: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 251: return visitNode(cbNode, node.tagName); - case 262: - return visitNode(cbNode, node.type); case 266: + return visitNode(cbNode, node.type); + case 270: return visitNodes(cbNodes, node.types); - case 267: + case 271: return visitNodes(cbNodes, node.types); - case 265: - return visitNode(cbNode, node.elementType); case 269: + return visitNode(cbNode, node.elementType); + case 273: return visitNode(cbNode, node.type); - case 268: + case 272: return visitNode(cbNode, node.type); - case 270: + case 274: return visitNode(cbNode, node.literal); - case 272: + case 276: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273: + case 277: return visitNode(cbNode, node.type); - case 274: + case 278: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275: + case 279: return visitNode(cbNode, node.type); - case 276: + case 280: return visitNode(cbNode, node.type); - case 277: + case 281: return visitNode(cbNode, node.type); - case 271: + case 275: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278: + case 282: return visitNodes(cbNodes, node.tags); - case 281: + case 285: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282: - return visitNode(cbNode, node.typeExpression); - case 283: + case 286: return visitNode(cbNode, node.typeExpression); - case 280: + case 287: return visitNode(cbNode, node.typeExpression); case 284: + return visitNode(cbNode, node.typeExpression); + case 288: return visitNodes(cbNodes, node.typeParameters); - case 285: + case 289: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287: + case 291: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286: + case 290: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294: + case 295: return visitNode(cbNode, node.expression); - case 288: + case 292: return visitNode(cbNode, node.literal); } } @@ -11635,7 +12432,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(5, true); - var disallowInAndDecoratorContext = 65536 | 262144; + var disallowInAndDecoratorContext = 2048 | 8192; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -11683,7 +12480,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 || scriptKind === 2 ? 2097152 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -11758,7 +12555,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(261, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(264, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -11778,16 +12575,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536); + setContextFlag(val, 2048); } function setYieldContext(val) { - setContextFlag(val, 131072); + setContextFlag(val, 4096); } function setDecoratorContext(val) { - setContextFlag(val, 262144); + setContextFlag(val, 8192); } function setAwaitContext(val) { - setContextFlag(val, 524288); + setContextFlag(val, 16384); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -11810,40 +12607,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536, func); + return doOutsideOfContext(2048, func); } function disallowInAnd(func) { - return doInsideOfContext(65536, func); + return doInsideOfContext(2048, func); } function doInYieldContext(func) { - return doInsideOfContext(131072, func); + return doInsideOfContext(4096, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144, func); + return doInsideOfContext(8192, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288, func); + return doInsideOfContext(16384, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288, func); + return doOutsideOfContext(16384, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 | 524288, func); + return doInsideOfContext(4096 | 16384, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072); + return inContext(4096); } function inDisallowInContext() { - return inContext(65536); + return inContext(2048); } function inDecoratorContext() { - return inContext(262144); + return inContext(8192); } function inAwaitContext() { - return inContext(524288); + return inContext(16384); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -11985,7 +12782,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 ? new NodeConstructor(kind, pos, pos) : kind === 70 ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -12005,7 +12802,7 @@ var ts; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576; + node.flags |= 32768; } return node; } @@ -12022,7 +12819,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; @@ -12067,7 +12868,7 @@ var ts; return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token()); } function parseComputedPropertyName() { - var node = createNode(142); + var node = createNode(143); parseExpected(20); node.expression = allowInAnd(parseExpression); parseExpected(21); @@ -12116,6 +12917,7 @@ var ts; function nextTokenIsClassOrFunctionOrAsync() { nextToken(); return token() === 74 || token() === 88 || + (token() === 116 && lookAhead(nextTokenIsClassKeywordOnSameLine)) || (token() === 119 && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } function isListElement(parsingContext, inErrorRecovery) { @@ -12323,7 +13125,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 3080192; + var nodeContextFlags = node.flags & 96256; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -12372,14 +13174,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150: - case 155: case 151: + case 156: case 152: - case 147: - case 203: + case 153: + case 148: + case 205: return true; - case 149: + case 150: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 70 && methodDeclaration.name.originalKeywordKind === 122; @@ -12391,8 +13193,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253: - case 254: + case 256: + case 257: return true; } } @@ -12401,65 +13203,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225: - case 205: - case 204: - case 208: + case 227: case 207: + case 206: + case 210: + case 209: + case 222: + case 218: case 220: + case 217: case 216: - case 218: - case 215: case 214: - case 212: + case 215: case 213: - case 211: - case 210: - case 217: - case 206: - case 221: + case 212: case 219: - case 209: - case 222: - case 235: - case 234: - case 241: - case 240: - case 230: - case 226: - case 227: - case 229: + case 208: + case 223: + case 221: + case 211: + case 224: + case 237: + case 236: + case 243: + case 242: + case 232: case 228: + case 229: + case 231: + case 230: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260; + return node.kind === 263; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154: - case 148: case 155: - case 146: - case 153: + case 149: + case 156: + case 147: + case 154: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223) { + if (node.kind !== 225) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144) { + if (node.kind !== 145) { return false; } var parameter = node; @@ -12504,7 +13306,6 @@ var ts; case 25: return ts.Diagnostics.Property_assignment_expected; } } - ; function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; @@ -12555,7 +13356,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22)) { - var node = createNode(141, entity.pos); + var node = createNode(142, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -12572,7 +13373,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194); + var template = createNode(195); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -12584,7 +13385,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202); + var span = createNode(204); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -12620,20 +13421,16 @@ var ts; if (scanner.isUnterminated()) { node.isUnterminated = true; } - var tokenPos = scanner.getTokenPos(); + if (node.kind === 8) { + node.numericLiteralFlags = scanner.getNumericLiteralFlags(); + } nextToken(); finishNode(node); - if (node.kind === 8 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.isOctalLiteral = true; - } return node; } function parseTypeReference() { - var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(157, typeName.pos); - node.typeName = typeName; + var node = createNode(158); + node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); } @@ -12641,24 +13438,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156, lhs.pos); + var node = createNode(157, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167); + var node = createNode(168); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160); + var node = createNode(161); parseExpected(102); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); if (parseOptional(84)) { if (isStartOfType() || !isStartOfExpression()) { @@ -12668,6 +13465,9 @@ var ts; node.expression = parseUnaryExpressionOrHigher(); } } + if (parseOptional(57)) { + node.default = parseType(); + } return finishNode(node); } function parseTypeParameters() { @@ -12685,9 +13485,9 @@ var ts; return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98; } function parseParameter() { - var node = createNode(144); + var node = createNode(145); if (token() === 98) { - node.name = createIdentifier(true, undefined); + node.name = createIdentifier(true); node.type = parseParameterType(); return finishNode(node); } @@ -12745,7 +13545,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154) { + if (kind === 155) { parseExpected(93); } fillSignature(55, false, false, false, node); @@ -12785,7 +13585,7 @@ var ts; return token() === 55 || token() === 25 || token() === 21; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155, fullStart); + var node = createNode(156, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16, parseParameter, 20, 21); @@ -12797,7 +13597,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54); if (token() === 18 || token() === 26) { - var method = createNode(148, fullStart); + var method = createNode(149, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -12806,7 +13606,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146, fullStart); + var property = createNode(147, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -12819,19 +13619,19 @@ var ts; } } function isTypeMemberStart() { - var idToken; if (token() === 18 || token() === 26) { return true; } + var idToken; while (ts.isModifierKind(token())) { - idToken = token(); + idToken = true; nextToken(); } if (token() === 20) { return true; } if (isLiteralPropertyName()) { - idToken = token(); + idToken = true; nextToken(); } if (idToken) { @@ -12846,10 +13646,10 @@ var ts; } function parseTypeMember() { if (token() === 18 || token() === 26) { - return parseSignatureMember(153); + return parseSignatureMember(154); } if (token() === 93 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154); + return parseSignatureMember(155); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -12863,7 +13663,7 @@ var ts; return token() === 18 || token() === 26; } function parseTypeLiteral() { - var node = createNode(161); + var node = createNode(162); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -12886,14 +13686,14 @@ var ts; return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91; } function parseMappedTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); parseExpected(91); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170); + var node = createNode(171); parseExpected(16); node.readonlyToken = parseOptionalToken(130); parseExpected(20); @@ -12906,12 +13706,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163); + var node = createNode(164); node.elementTypes = parseBracketedList(20, parseType, 20, 21); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166); + var node = createNode(167); parseExpected(18); node.type = parseType(); parseExpected(19); @@ -12919,7 +13719,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159) { + if (kind === 160) { parseExpected(93); } fillSignature(35, false, false, false, node); @@ -12930,7 +13730,7 @@ var ts; return token() === 22 ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171); + var node = createNode(172); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -12941,12 +13741,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: - case 137: + case 136: + case 138: case 129: + case 133: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: @@ -12983,12 +13784,12 @@ var ts; function isStartOfType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: - case 137: + case 138: case 94: case 98: case 102: @@ -12996,11 +13797,14 @@ var ts; case 16: case 20: case 26: + case 48: + case 47: case 93: case 9: case 8: case 100: case 85: + case 133: return true; case 37: return lookAhead(nextTokenIsNumericLiteral); @@ -13018,14 +13822,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) { if (isStartOfType()) { - var node = createNode(169, type.pos); + var node = createNode(170, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21); type = finishNode(node); } else { - var node = createNode(162, type.pos); + var node = createNode(163, type.pos); node.elementType = type; parseExpected(21); type = finishNode(node); @@ -13034,7 +13838,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168); + var node = createNode(169); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -13048,6 +13852,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -13062,10 +13867,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47); + return parseUnionOrIntersectionType(166, parseTypeOperatorOrHigher, 47); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48); + return parseUnionOrIntersectionType(165, parseIntersectionTypeOrHigher, 48); } function isStartOfFunctionType() { if (token() === 26) { @@ -13111,7 +13916,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156, typePredicateVariable.pos); + var node = createNode(157, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -13128,14 +13933,14 @@ var ts; } } function parseType() { - return doOutsideOfContext(655360, parseTypeWorker); + return doOutsideOfContext(20480, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158); + return parseFunctionOrConstructorType(159); } if (token() === 93) { - return parseFunctionOrConstructorType(159); + return parseFunctionOrConstructorType(160); } return parseUnionTypeOrHigher(); } @@ -13254,7 +14059,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 38 || isStartOfExpression())) { @@ -13270,13 +14075,13 @@ var ts; ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185, asyncModifier.pos); + node = createNode(186, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185, identifier.pos); + node = createNode(186, identifier.pos); } - var parameter = createNode(144, identifier.pos); + var parameter = createNode(145, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -13410,7 +14215,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185); + var node = createNode(186); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256); fillSignature(55, false, isAsync, !allowAmbiguity, node); @@ -13442,7 +14247,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(193, leftOperand.pos); + var node = createNode(194, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -13455,7 +14260,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 || t === 140; + return t === 91 || t === 141; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -13533,39 +14338,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192, left.pos); + var node = createNode(193, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200, left.pos); + var node = createNode(201, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186); + var node = createNode(187); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187); + var node = createNode(188); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -13580,7 +14385,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189); + var node = createNode(190); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -13596,7 +14401,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182) { + if (simpleUnaryExpression.kind === 183) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -13649,7 +14454,7 @@ var ts; } function parseIncrementExpression() { if (token() === 42 || token() === 43) { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -13661,7 +14466,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191, expression.pos); + var node = createNode(192, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -13684,7 +14489,7 @@ var ts; if (token() === 18 || token() === 22 || token() === 20) { return expression; } - var node = createNode(177, expression.pos); + var node = createNode(178, expression.pos); node.expression = expression; parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -13706,8 +14511,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248) { - var node = createNode(246, opening.pos); + if (opening.kind === 250) { + var node = createNode(248, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -13717,14 +14522,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247); + ts.Debug.assert(opening.kind === 249); result = opening; } if (inExpressionContext && token() === 26) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192, result.pos); + var badNode = createNode(193, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -13764,20 +14569,28 @@ var ts; parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } + else if (token() === 7) { + break; + } result.push(parseJsxChild()); } result.end = scanner.getTokenPos(); parsingContext = saveParsingContext; return result; } + function parseJsxAttributes() { + var jsxAttributes = createNode(253); + jsxAttributes.properties = parseList(13, parseJsxAttribute); + return finishNode(jsxAttributes); + } function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(26); var tagName = parseJsxElementName(); - var attributes = parseList(13, parseJsxAttribute); + var attributes = parseJsxAttributes(); var node; if (token() === 28) { - node = createNode(248, fullStart); + node = createNode(250, fullStart); scanJsxText(); } else { @@ -13789,7 +14602,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(247, fullStart); + node = createNode(249, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -13800,7 +14613,7 @@ var ts; var expression = token() === 98 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22)) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -13808,9 +14621,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252); + var node = createNode(255); parseExpected(16); if (token() !== 17) { + node.dotDotDotToken = parseOptionalToken(23); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -13827,7 +14641,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250); + var node = createNode(252); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -13842,7 +14656,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251); + var node = createNode(254); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -13850,7 +14664,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249); + var node = createNode(251); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -13863,7 +14677,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182); + var node = createNode(183); parseExpected(26); node.type = parseType(); parseExpected(28); @@ -13874,7 +14688,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22); if (dotToken) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -13882,13 +14696,13 @@ var ts; } if (token() === 50 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201, expression.pos); + var nonNullExpression = createNode(202, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(20)) { - var indexedAccess = createNode(178, expression.pos); + var indexedAccess = createNode(179, expression.pos); indexedAccess.expression = expression; if (token() !== 21) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -13902,7 +14716,7 @@ var ts; continue; } if (token() === 12 || token() === 13) { - var tagExpression = createNode(181, expression.pos); + var tagExpression = createNode(182, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 ? parseLiteralNode() @@ -13921,7 +14735,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -13929,7 +14743,7 @@ var ts; continue; } else if (token() === 18) { - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -14024,28 +14838,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183); + var node = createNode(184); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196); + var node = createNode(197); parseExpected(23); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 ? parseSpreadElement() : - token() === 25 ? createNode(198) : + token() === 25 ? createNode(199) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175); + var node = createNode(176); parseExpected(20); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14056,18 +14870,18 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124)) { - return parseAccessorDeclaration(151, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(133)) { return parseAccessorDeclaration(152, fullStart, decorators, modifiers); } + else if (parseContextualModifier(134)) { + return parseAccessorDeclaration(153, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(259, fullStart); + var spreadElement = createNode(262, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -14086,7 +14900,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258, fullStart); + var shorthandDeclaration = createNode(261, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -14097,7 +14911,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257, fullStart); + var propertyAssignment = createNode(260, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -14107,7 +14921,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(16); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14121,7 +14935,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(184); + var node = createNode(185); node.modifiers = parseModifiers(); parseExpected(88); node.asteriskToken = parseOptionalToken(38); @@ -14143,8 +14957,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180); + var fullStart = scanner.getStartPos(); parseExpected(93); + if (parseOptional(22)) { + var node_1 = createNode(203, fullStart); + node_1.keywordToken = 93; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(181, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -14153,7 +14974,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204); + var node = createNode(206); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14184,12 +15005,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206); + var node = createNode(208); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(208); + var node = createNode(210); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14199,7 +15020,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209); + var node = createNode(211); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -14210,7 +15031,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210); + var node = createNode(212); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14221,6 +15042,7 @@ var ts; function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(87); + var awaitToken = parseOptionalToken(120); parseExpected(18); var initializer = undefined; if (token() !== 24) { @@ -14232,22 +15054,23 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(91)) { - var forInStatement = createNode(212, pos); - forInStatement.initializer = initializer; - forInStatement.expression = allowInAnd(parseExpression); - parseExpected(19); - forOrForInOrForOfStatement = forInStatement; - } - else if (parseOptional(140)) { - var forOfStatement = createNode(213, pos); + if (awaitToken ? parseExpected(141) : parseOptional(141)) { + var forOfStatement = createNode(215, pos); + forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } + else if (parseOptional(91)) { + var forInStatement = createNode(214, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(19); + forOrForInOrForOfStatement = forInStatement; + } else { - var forStatement = createNode(211, pos); + var forStatement = createNode(213, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -14265,7 +15088,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 ? 71 : 76); + parseExpected(kind === 217 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -14273,7 +15096,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216); + var node = createNode(218); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -14282,7 +15105,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217); + var node = createNode(219); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14291,7 +15114,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253); + var node = createNode(256); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -14299,7 +15122,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254); + var node = createNode(257); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -14309,12 +15132,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218); + var node = createNode(220); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(232, scanner.getStartPos()); + var caseBlock = createNode(234, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -14322,14 +15145,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(220); + var node = createNode(222); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(221); + var node = createNode(223); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -14340,7 +15163,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256); + var result = createNode(259); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -14350,7 +15173,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222); + var node = createNode(224); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -14359,13 +15182,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(219, fullStart); + var labeledStatement = createNode(221, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207, fullStart); + var expressionStatement = createNode(209, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -14375,6 +15198,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak(); } + function nextTokenIsClassKeywordOnSameLine() { + nextToken(); + return token() === 74 && !scanner.hasPrecedingLineBreak(); + } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); return token() === 88 && !scanner.hasPrecedingLineBreak(); @@ -14394,7 +15221,7 @@ var ts; case 82: return true; case 108: - case 136: + case 137: return nextTokenIsIdentifierOnSameLine(); case 127: case 128: @@ -14411,7 +15238,7 @@ var ts; return false; } continue; - case 139: + case 140: nextToken(); return token() === 16 || token() === 70 || token() === 83; case 90: @@ -14471,8 +15298,8 @@ var ts; case 108: case 127: case 128: - case 136: - case 139: + case 137: + case 140: return true; case 113: case 111: @@ -14517,9 +15344,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(214); + return parseBreakOrContinueStatement(216); case 71: - return parseBreakOrContinueStatement(215); + return parseBreakOrContinueStatement(217); case 95: return parseReturnStatement(); case 106: @@ -14538,7 +15365,7 @@ var ts; return parseDeclaration(); case 119: case 108: - case 136: + case 137: case 127: case 128: case 123: @@ -14552,7 +15379,7 @@ var ts; case 116: case 114: case 130: - case 139: + case 140: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -14575,11 +15402,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136: + case 137: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139: + case 140: case 127: case 128: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -14598,7 +15425,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -14619,16 +15446,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 25) { - return createNode(198); + return createNode(199); } - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -14644,14 +15471,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172); + var node = createNode(173); parseExpected(16); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(17); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173); + var node = createNode(174); parseExpected(20); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(21); @@ -14670,7 +15497,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223); + var node = createNode(225); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -14679,7 +15506,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224); + var node = createNode(226); switch (token()) { case 103: break; @@ -14693,7 +15520,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -14708,7 +15535,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(207, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -14716,7 +15543,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -14729,7 +15556,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150, pos); + var node = createNode(151, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122); @@ -14738,7 +15565,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149, fullStart); + var method = createNode(150, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -14751,7 +15578,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147, fullStart); + var property = createNode(148, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -14759,7 +15586,7 @@ var ts; property.type = parseTypeAnnotation(); property.initializer = ts.hasModifier(property, 32) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 | 65536, parseNonParameterInitializer); + : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -14821,7 +15648,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) { + if (!ts.isKeyword(idToken) || idToken === 134 || idToken === 124) { return true; } switch (token()) { @@ -14844,7 +15671,7 @@ var ts; if (!parseOptional(56)) { break; } - var decorator = createNode(145, decoratorStart); + var decorator = createNode(146, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -14901,7 +15728,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(203); + var result = createNode(205); nextToken(); return finishNode(result); } @@ -14926,16 +15753,16 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_13 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, undefined); + var name = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 198); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -14969,9 +15796,10 @@ var ts; return undefined; } function parseHeritageClause() { - if (token() === 84 || token() === 107) { - var node = createNode(255); - node.token = token(); + var tok = token(); + if (tok === 84 || tok === 107) { + var node = createNode(258); + node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); return finishNode(node); @@ -14979,7 +15807,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199); + var node = createNode(200); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -14993,7 +15821,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -15004,10 +15832,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136); + parseExpected(137); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57); @@ -15016,13 +15844,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(260, scanner.getStartPos()); + var node = createNode(263, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -15037,7 +15865,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231, scanner.getStartPos()); + var node = createNode(233, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -15048,7 +15876,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230, fullStart); + var node = createNode(232, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -15060,10 +15888,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(232, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139) { + if (token() === 140) { node.name = parseIdentifier(); node.flags |= 512; } @@ -15080,7 +15908,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139) { + if (token() === 140) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(128)) { @@ -15105,7 +15933,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233, fullStart); + var exportDeclaration = createNode(235, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -15120,38 +15948,41 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(234, fullStart); - importEqualsDeclaration.decorators = decorators; - importEqualsDeclaration.modifiers = modifiers; - importEqualsDeclaration.name = identifier; - parseExpected(57); - importEqualsDeclaration.moduleReference = parseModuleReference(); - parseSemicolon(); - return addJSDocComment(finishNode(importEqualsDeclaration)); - } - } - var importDeclaration = createNode(235, fullStart); + if (token() !== 25 && token() !== 139) { + return parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier); + } + } + var importDeclaration = createNode(237, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || token() === 38 || token() === 16) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138); + parseExpected(139); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } + function parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier) { + var importEqualsDeclaration = createNode(236, fullStart); + importEqualsDeclaration.decorators = decorators; + importEqualsDeclaration.modifiers = modifiers; + importEqualsDeclaration.name = identifier; + parseExpected(57); + importEqualsDeclaration.moduleReference = parseModuleReference(); + parseSemicolon(); + return addJSDocComment(finishNode(importEqualsDeclaration)); + } function parseImportClause(identifier, fullStart) { - var importClause = createNode(236, fullStart); + var importClause = createNode(238, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(240); } return finishNode(importClause); } @@ -15161,7 +15992,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(245); + var node = createNode(247); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -15179,7 +16010,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(237); + var namespaceImport = createNode(239); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -15187,14 +16018,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 240 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243); + return parseImportOrExportSpecifier(245); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239); + return parseImportOrExportSpecifier(241); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -15213,23 +16044,23 @@ var ts; else { node.name = identifierName; } - if (kind === 239 && checkIdentifierIsKeyword) { + if (kind === 241 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(243, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { - parseExpected(138); + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242); - if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(138); + node.exportClause = parseNamedImportsOrExports(244); + if (token() === 139 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -15237,7 +16068,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -15256,6 +16087,7 @@ var ts; var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; + var checkJsDirective = undefined; while (true) { var kind = triviaScanner.scan(); if (kind !== 2) { @@ -15266,7 +16098,11 @@ var ts; break; } } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; + var range = { + kind: triviaScanner.getToken(), + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -15306,20 +16142,30 @@ var ts; amdDependencies.push(amdDependency); } } + var checkJsDirectiveRegEx = /^\/\/\/?\s*(@ts-check|@ts-nocheck)\s*$/gim; + var checkJsDirectiveMatchResult = checkJsDirectiveRegEx.exec(comment); + if (checkJsDirectiveMatchResult) { + checkJsDirective = { + enabled: ts.compareStrings(checkJsDirectiveMatchResult[1], "@ts-check", true) === 0, + end: range.end, + pos: range.pos + }; + } } } sourceFile.referencedFiles = referencedFiles; sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; + sourceFile.checkJsDirective = checkJsDirective; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 234 && node.moduleReference.kind === 245 - || node.kind === 235 - || node.kind === 240 - || node.kind === 241 + || node.kind === 236 && node.moduleReference.kind === 247 + || node.kind === 237 + || node.kind === 242 + || node.kind === 243 ? node : undefined; }); @@ -15355,7 +16201,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(262, scanner.getTokenPos()); + var result = createNode(266, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -15366,12 +16212,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(266, type.pos); + var unionType = createNode(270, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(273, type.pos); + var optionalType = createNode(277, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -15382,20 +16228,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(265, type.pos); + var arrayType = createNode(269, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(268, type.pos); + var nullableType = createNode(272, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(269, type.pos); + var nonNullableType = createNode(273, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -15429,14 +16275,15 @@ var ts; case 98: return parseJSDocThisType(); case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: case 94: - case 137: + case 138: case 129: + case 133: return parseTokenNode(); case 9: case 8: @@ -15447,27 +16294,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277); + var result = createNode(281); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276); + var result = createNode(280); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275); + var result = createNode(279); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274); + var result = createNode(278); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -15480,7 +16327,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144); + var parameter = createNode(145); parameter.type = parseJSDocType(); if (parseOptional(57)) { parameter.questionToken = createNode(57); @@ -15488,7 +16335,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272); + var result = createNode(276); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -15522,24 +16369,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141, left.pos); + var result = createNode(142, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270); + var result = createNode(274); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269); + var result = createNode(273); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267); + var result = createNode(271); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -15553,7 +16400,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266); + var result = createNode(270); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -15569,12 +16416,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263); + var result = createNode(267); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288); + var result = createNode(292); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -15587,11 +16434,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(264, pos); + var result = createNode(268, pos); return finishNode(result); } else { - var result = createNode(268, pos); + var result = createNode(272, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -15676,7 +16523,7 @@ var ts; break; case 38: var asterisk = scanner.getTokenText(); - if (state === 1) { + if (state === 1 || state === 2) { state = 2; pushComment(asterisk); } @@ -15691,7 +16538,10 @@ var ts; break; case 5: var whitespace = scanner.getTokenText(); - if (state === 2 || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -15699,6 +16549,7 @@ var ts; case 1: break; default: + state = 2; pushComment(scanner.getTokenText()); break; } @@ -15731,7 +16582,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(278, start); + var result = createNode(282, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -15788,7 +16639,7 @@ var ts; } function parseTagComments(indent) { var comments = []; - var state = 1; + var state = 0; var margin; function pushComment(text) { if (!margin) { @@ -15841,7 +16692,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -15896,7 +16747,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -15907,20 +16758,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 287; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(287, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -15935,7 +16786,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286, atToken.pos); + var result = createNode(290, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -15944,7 +16795,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -15953,25 +16804,28 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285, atToken.pos); + var typedefTag = createNode(289, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70) { + while (true) { + if (rightNode.kind === 70 || !rightNode.body) { + typedefTag.name = rightNode.kind === 70 ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272) { + if (typeExpression.type.kind === 276) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_14 = jsDocTypeReference.name; - if (name_14.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -15985,7 +16839,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(291, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -16015,6 +16869,7 @@ var ts; break; case 70: canParseTag = false; + break; case 1: break; } @@ -16026,7 +16881,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(230, pos); + var jsDocNamespaceNode = createNode(232, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -16070,19 +16925,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 288; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_15 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_15) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_15.pos); - typeParameter.name = name_15; + var typeParameter = createNode(144, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -16093,7 +16948,7 @@ var ts; break; } } - var result = createNode(284, atToken.pos); + var result = createNode(288, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -16385,7 +17240,7 @@ var ts; } function visitArray(array) { if (position >= array.pos && position < array.end) { - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -16412,16 +17267,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 227 || node.kind === 228) { + if (node.kind === 229 || node.kind === 230) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 237 || node.kind === 236) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 231) { + else if (node.kind === 233) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -16437,7 +17292,7 @@ var ts; }); return state_1; } - else if (node.kind === 230) { + else if (node.kind === 232) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -16519,7 +17374,7 @@ var ts; } return bindSourceFile; function bindInStrictMode(file, opts) { - if (opts.alwaysStrict && !ts.isDeclarationFile(file)) { + if ((opts.alwaysStrict === undefined ? opts.strict : opts.alwaysStrict) && !ts.isDeclarationFile(file)) { return true; } else { @@ -16546,7 +17401,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232)) { symbol.valueDeclaration = node; } } @@ -16556,7 +17411,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -16567,46 +17422,47 @@ var ts; return node.name.text; } switch (node.kind) { - case 150: + case 151: return "__constructor"; - case 158: - case 153: - return "__call"; case 159: case 154: - return "__new"; + return "__call"; + case 160: case 155: + return "__new"; + case 156: return "__index"; - case 241: + case 243: return "__export"; - case 240: + case 242: return node.isExportEquals ? "export=" : "default"; - case 192: + case 193: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; case 1: case 4: + case 5: return node.left.name.text; case 3: return node.left.expression.name.text; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225: - case 226: + case 227: + case 228: return ts.hasModifier(node, 512) ? "default" : undefined; - case 274: + case 278: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144: - ts.Debug.assert(node.parent.kind === 274); + case 145: + ts.Debug.assert(node.parent.kind === 278); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285: + case 289: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -16629,13 +17485,16 @@ var ts; symbol = createSymbol(0, "__missing"); } else { - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0, name)); + } if (name && (includes & 788448)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { - symbol = symbolTable[name] = createSymbol(0, name); + symbolTable.set(name, symbol = createSymbol(0, name)); } else { if (node.name) { @@ -16650,7 +17509,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -16670,7 +17529,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) { + if (node.kind === 245 || (node.kind === 236 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -16678,7 +17537,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 285 && + var isJSDocTypedefInJSDocNamespace = node.kind === 289 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -16733,13 +17592,13 @@ var ts; activeLabels = undefined; hasExplicitReturn = false; bindChildren(node); - node.flags &= ~64896; + node.flags &= ~1408; if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) { node.flags |= 128; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 261) { + if (node.kind === 264) { node.flags |= emitFlags; } if (isIIFE) { @@ -16815,66 +17674,72 @@ var ts; return; } switch (node.kind) { - case 210: + case 212: bindWhileStatement(node); break; - case 209: + case 211: bindDoStatement(node); break; - case 211: + case 213: bindForStatement(node); break; - case 212: - case 213: + case 214: + case 215: bindForInOrForOfStatement(node); break; - case 208: + case 210: bindIfStatement(node); break; - case 216: - case 220: + case 218: + case 222: bindReturnOrThrow(node); break; - case 215: - case 214: + case 217: + case 216: bindBreakOrContinueStatement(node); break; - case 221: + case 223: bindTryStatement(node); break; - case 218: + case 220: bindSwitchStatement(node); break; - case 232: + case 234: bindCaseBlock(node); break; - case 253: + case 256: bindCaseClause(node); break; - case 219: + case 221: bindLabeledStatement(node); break; - case 190: + case 191: bindPrefixUnaryExpressionFlow(node); break; - case 191: + case 192: bindPostfixUnaryExpressionFlow(node); break; - case 192: + case 193: bindBinaryExpressionFlow(node); break; - case 186: + case 187: bindDeleteExpressionFlow(node); break; - case 193: + case 194: bindConditionalExpressionFlow(node); break; - case 223: + case 225: bindVariableDeclarationFlow(node); break; - case 179: + case 180: bindCallExpressionFlow(node); break; + case 282: + bindJSDocComment(node); + break; + case 289: + bindJSDocTypedefTag(node); + break; default: bindEachChild(node); break; @@ -16884,15 +17749,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return isNarrowableReference(expr); - case 179: + case 180: return hasNarrowableArgument(expr); - case 183: + case 184: return isNarrowingExpression(expr.expression); - case 192: + case 193: return isNarrowingBinaryExpression(expr); - case 190: + case 191: return expr.operator === 50 && isNarrowingExpression(expr.operand); } return false; @@ -16900,7 +17765,8 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 || expr.kind === 98 || - expr.kind === 177 && isNarrowableReference(expr.expression); + expr.kind === 96 || + expr.kind === 178 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -16911,14 +17777,14 @@ var ts; } } } - if (expr.expression.kind === 177 && + if (expr.expression.kind === 178 && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; + return expr1.kind === 188 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -16939,9 +17805,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183: + case 184: return isNarrowableOperand(expr.expression); - case 192: + case 193: switch (expr.operatorToken.kind) { case 57: return isNarrowableOperand(expr.left); @@ -17035,33 +17901,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208: case 210: - case 209: - return parent.expression === node; + case 212: case 211: - case 193: + return parent.expression === node; + case 213: + case 194: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183) { + if (node.kind === 184) { node = node.expression; } - else if (node.kind === 190 && node.operator === 50) { + else if (node.kind === 191 && node.operator === 50) { node = node.operand; } else { - return node.kind === 192 && (node.operatorToken.kind === 52 || + return node.kind === 193 && (node.operatorToken.kind === 52 || node.operatorToken.kind === 53); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 || - node.parent.kind === 190 && + while (node.parent.kind === 184 || + node.parent.kind === 191 && node.parent.operator === 50) { node = node.parent; } @@ -17103,7 +17969,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 + var enclosingLabeledStatement = node.parent.kind === 221 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -17135,10 +18001,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; + if (node.kind === 215) { + bind(node.awaitModifier); + } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224) { + if (node.initializer.kind !== 226) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -17160,7 +18029,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216) { + if (node.kind === 218) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -17180,7 +18049,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -17213,7 +18082,8 @@ var ts; flowAfterCatch = currentFlow; } if (node.finallyBlock) { - addAntecedent(preFinallyLabel, preTryFlow); + var preFinallyFlow = { flags: 2048, antecedent: preTryFlow, lock: {} }; + addAntecedent(preFinallyLabel, preFinallyFlow); currentFlow = finishFlowLabel(preFinallyLabel); bind(node.finallyBlock); if (!(currentFlow.flags & 1)) { @@ -17223,6 +18093,11 @@ var ts; : unreachableFlow; } } + if (!(currentFlow.flags & 1)) { + var afterFinallyFlow = { flags: 4096, antecedent: currentFlow }; + preFinallyFlow.lock = afterFinallyFlow; + currentFlow = afterFinallyFlow; + } } else { currentFlow = finishFlowLabel(preFinallyLabel); @@ -17237,7 +18112,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 257; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -17302,13 +18177,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209) { + if (!node.statement || node.statement.kind !== 211) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 && node.operatorToken.kind === 57) { + if (node.kind === 193 && node.operatorToken.kind === 57) { bindAssignmentTargetFlow(node.left); } else { @@ -17319,10 +18194,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175) { + else if (node.kind === 176) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196) { + if (e.kind === 197) { bindAssignmentTargetFlow(e.expression); } else { @@ -17330,16 +18205,16 @@ var ts; } } } - else if (node.kind === 176) { + else if (node.kind === 177) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257) { + if (p.kind === 260) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258) { + else if (p.kind === 261) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259) { + else if (p.kind === 262) { bindAssignmentTargetFlow(p.expression); } } @@ -17395,7 +18270,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 && node.left.kind === 178) { + if (operator === 57 && node.left.kind === 179) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -17406,7 +18281,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { bindAssignmentTargetFlow(node.expression); } } @@ -17439,16 +18314,31 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { + if (node.initializer || node.parent.parent.kind === 214 || node.parent.parent.kind === 215) { bindInitializedVariableFlow(node); } } + function bindJSDocComment(node) { + ts.forEachChild(node, function (n) { + if (n.kind !== 289) { + bind(n); + } + }); + } + function bindJSDocTypedefTag(node) { + ts.forEachChild(node, function (n) { + if (node.fullName && n === node.name && node.fullName.kind !== 70) { + return; + } + bind(n); + }); + } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 183) { + while (expr.kind === 184) { expr = expr.expression; } - if (expr.kind === 184 || expr.kind === 185) { + if (expr.kind === 185 || expr.kind === 186) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -17456,7 +18346,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -17465,52 +18355,53 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197: - case 226: - case 229: - case 176: - case 161: - case 287: - case 270: + case 198: + case 228: + case 231: + case 177: + case 162: + case 291: + case 274: + case 253: return 1; - case 227: + case 229: return 1 | 64; - case 274: + case 278: + case 232: case 230: - case 228: - case 170: + case 171: return 1 | 32; - case 261: + case 264: return 1 | 4 | 32; - case 149: + case 150: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } - case 150: - case 225: - case 148: case 151: + case 227: + case 149: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return 1 | 4 | 32 | 8; - case 184: case 185: + case 186: return 1 | 4 | 32 | 8 | 16; - case 231: + case 233: return 4; - case 147: + case 148: return node.initializer ? 4 : 0; - case 256: - case 211: - case 212: + case 259: case 213: - case 232: + case 214: + case 215: + case 234: return 2; - case 204: + case 206: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -17526,37 +18417,38 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 230: + case 232: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261: + case 264: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197: - case 226: + case 198: + case 228: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229: + case 231: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161: - case 176: - case 227: - case 270: - case 287: + case 162: + case 177: + case 229: + case 274: + case 291: + case 253: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158: case 159: - case 153: + case 160: case 154: case 155: - case 149: - case 148: + case 156: case 150: + case 149: case 151: case 152: - case 225: - case 184: + case 153: + case 227: case 185: - case 274: - case 228: - case 170: + case 186: + case 278: + case 230: + case 171: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -17571,11 +18463,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 ? node : node.body; - if (body && (body.kind === 261 || body.kind === 231)) { + var body = node.kind === 264 ? node : node.body; + if (body && (body.kind === 264 || body.kind === 233)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 || stat.kind === 240) { + if (stat.kind === 243 || stat.kind === 242) { return true; } } @@ -17597,7 +18489,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -17617,12 +18509,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); - } - else { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + var state = declareModuleSymbol(node); + if (state !== 0) { if (node.symbol.flags & (16 | 32 | 256)) { node.symbol.constEnumOnlyModule = false; } @@ -17638,29 +18526,35 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 106639 : 0); + return state; + } function bindFunctionOrConstructorType(node) { var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { if (inStrictMode) { var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 || prop.name.kind !== 70) { + if (prop.kind === 262 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149 + var currentKind = prop.kind === 260 || prop.kind === 261 || prop.kind === 150 ? 1 : 2; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 && existingKind === 1) { @@ -17671,16 +18565,22 @@ var ts; } return bindAnonymousDeclaration(node, 4096, "__object"); } + function bindJsxAttributes(node) { + return bindAnonymousDeclaration(node, 4096, "__jsxAttributes"); + } + function bindJsxAttribute(node, symbolFlags, symbolExcludes) { + return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } function bindAnonymousDeclaration(node, symbolFlags, name) { var symbol = createSymbol(symbolFlags, name); addDeclarationToSymbol(symbol, node, symbolFlags); } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230: + case 232: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261: + case 264: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -17770,8 +18670,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 261 && - blockScopeContainer.kind !== 230 && + if (blockScopeContainer.kind !== 264 && + blockScopeContainer.kind !== 232 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -17779,7 +18679,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.isOctalLiteral) { + if (inStrictMode && node.numericLiteralFlags & 4) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -17813,8 +18713,11 @@ var ts; } node.parent = parent; var saveInStrictMode = inStrictMode; + if (ts.isInJavaScriptFile(node)) { + bindJSDocTypedefTagIfAny(node); + } bindWorker(node); - if (node.kind > 140) { + if (node.kind > 141) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -17831,6 +18734,26 @@ var ts; } inStrictMode = saveInStrictMode; } + function bindJSDocTypedefTagIfAny(node) { + if (!node.jsDoc) { + return; + } + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (!jsDoc.tags) { + continue; + } + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { + var tag = _c[_b]; + if (tag.kind === 289) { + var savedParent = parent; + parent = jsDoc; + bind(tag); + parent = savedParent; + } + } + } + } function updateStrictModeStatementList(statements) { if (!inStrictMode) { for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { @@ -17854,90 +18777,88 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285) { + while (parentNode && parentNode.kind !== 289) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 261)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177: + case 178: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192: - if (ts.isInJavaScriptFile(node)) { - var specialKind = ts.getSpecialPropertyAssignmentKind(node); - switch (specialKind) { - case 1: - bindExportsPropertyAssignment(node); - break; - case 2: - bindModuleExportsAssignment(node); - break; - case 3: - bindPrototypePropertyAssignment(node); - break; - case 4: - bindThisPropertyAssignment(node); - break; - case 0: - break; - default: - ts.Debug.fail("Unknown special property assignment kind"); - } + case 193: + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1: + bindExportsPropertyAssignment(node); + break; + case 2: + bindModuleExportsAssignment(node); + break; + case 3: + bindPrototypePropertyAssignment(node); + break; + case 4: + bindThisPropertyAssignment(node); + break; + case 5: + bindStaticPropertyAssignment(node); + break; + case 0: + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 256: + case 259: return checkStrictModeCatchClause(node); - case 186: + case 187: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 191: + case 192: return checkStrictModePostfixUnaryExpression(node); - case 190: + case 191: return checkStrictModePrefixUnaryExpression(node); - case 217: + case 219: return checkStrictModeWithStatement(node); - case 167: + case 168: seenThisKeyword = true; return; - case 156: + case 157: return checkTypePredicate(node); - case 143: - return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: + return declareSymbolAndAddToSymbolTable(node, 262144, 530920); + case 145: return bindParameter(node); - case 223: - case 174: - if (node.dotDotDotToken && node.parent.kind === 172) { - emitFlags |= 32768; - } + case 225: + case 175: return bindVariableDeclarationOrBindingElement(node); + case 148: case 147: - case 146: - case 271: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 286: + case 275: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0); + case 290: return bindJSDocProperty(node); - case 257: - case 258: - return bindPropertyOrMethodOrAccessor(node, 4, 0); case 260: + case 261: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 263: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 259: - case 251: + case 262: + case 254: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 && - root.parent.kind === 192 && + if (root.kind === 177 && + root.parent.kind === 193 && root.parent.operatorToken.kind === 57 && root.parent.left === root) { hasRest = true; @@ -17945,80 +18866,83 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 : 16384; return; - case 153: case 154: case 155: + case 156: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 150: case 149: - case 148: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 225: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 67108864 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); + case 227: return bindFunctionDeclaration(node); - case 150: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 151: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 152: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 153: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 158: case 159: - case 274: + case 160: + case 278: return bindFunctionOrConstructorType(node); - case 161: - case 170: - case 287: - case 270: + case 162: + case 171: + case 291: + case 274: return bindAnonymousDeclaration(node, 2048, "__type"); - case 176: + case 177: return bindObjectLiteralExpression(node); - case 184: case 185: + case 186: return bindFunctionExpression(node); - case 179: + case 180: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 197: - case 226: + case 198: + case 228: inStrictMode = true; return bindClassLikeDeclaration(node); - case 227: + case 229: return bindBlockScopedDeclaration(node, 64, 792968); - case 285: + case 289: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 228: + case 230: return bindBlockScopedDeclaration(node, 524288, 793064); - case 229: + case 231: return bindEnumDeclaration(node); - case 230: + case 232: return bindModuleDeclaration(node); - case 234: - case 237: + case 253: + return bindJsxAttributes(node); + case 252: + return bindJsxAttribute(node, 4, 0); + case 236: case 239: - case 243: + case 241: + case 245: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 233: + case 235: return bindNamespaceExportDeclaration(node); - case 236: + case 238: return bindImportClause(node); - case 241: + case 243: return bindExportDeclaration(node); - case 240: + case 242: return bindExportAssignment(node); - case 261: + case 264: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204: + case 206: if (!ts.isFunctionLike(node.parent)) { return; } - case 231: + case 233: return updateStrictModeStatementList(node.statements); } } @@ -18027,7 +18951,7 @@ var ts; if (parameterName && parameterName.kind === 70) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167) { + if (parameterName && parameterName.kind === 168) { seenThisKeyword = true; } bind(type); @@ -18046,7 +18970,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -18056,17 +18980,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261) { + if (node.parent.kind !== 264) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -18076,10 +19000,10 @@ var ts; } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { - bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); + bindAnonymousDeclaration(node, 33554432, getDeclarationName(node)); } else if (!node.exportClause) { - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); + declareSymbol(container.symbol.exports, container.symbol, node, 33554432, 0); } } function bindImportClause(node) { @@ -18099,24 +19023,56 @@ var ts; setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); } + function isExportsOrModuleExportsOrAlias(node) { + return ts.isExportsIdentifier(node) || + ts.isModuleExportsPropertyAccessExpression(node) || + isNameOfExportsOrModuleExportsAliasDeclaration(node); + } + function isNameOfExportsOrModuleExportsAliasDeclaration(node) { + if (node.kind === 70) { + var symbol = lookupSymbolForName(node.text); + if (symbol && symbol.valueDeclaration && symbol.valueDeclaration.kind === 225) { + var declaration = symbol.valueDeclaration; + if (declaration.initializer) { + return isExportsOrModuleExportsOrAliasOrAssignemnt(declaration.initializer); + } + } + } + return false; + } + function isExportsOrModuleExportsOrAliasOrAssignemnt(node) { + return isExportsOrModuleExportsOrAlias(node) || + (ts.isAssignmentExpression(node, true) && (isExportsOrModuleExportsOrAliasOrAssignemnt(node.left) || isExportsOrModuleExportsOrAliasOrAssignemnt(node.right))); + } function bindModuleExportsAssignment(node) { + var assignedExpression = ts.getRightMostAssignedExpression(node.right); + if (ts.isEmptyObjectLiteral(assignedExpression) || isExportsOrModuleExportsOrAlias(assignedExpression)) { + setCommonJsModuleIndicator(node); + return; + } setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 225 || container.kind === 184) { - container.symbol.members = container.symbol.members || ts.createMap(); - declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); - } - else if (container.kind === 150) { - var saveContainer = container; - container = container.parent; - var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0); - if (symbol) { - symbol.isReplaceableByMethod = true; - } - container = saveContainer; + var container = ts.getThisContainer(node, false); + switch (container.kind) { + case 227: + case 185: + container.symbol.members = container.symbol.members || ts.createMap(); + declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); + break; + case 151: + case 148: + case 150: + case 152: + case 153: + var containingClass = container.parent; + var symbol = declareSymbol(ts.hasModifier(container, 32) ? containingClass.symbol.exports : containingClass.symbol.members, containingClass.symbol, node, 4, 0); + if (symbol) { + symbol.isReplaceableByMethod = true; + } + break; } } function bindPrototypePropertyAssignment(node) { @@ -18126,14 +19082,35 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; - if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { - return; + bindPropertyAssignment(constructorFunction.text, leftSideOfAssignment, true); + } + function bindStaticPropertyAssignment(node) { + var leftSideOfAssignment = node.left; + var target = leftSideOfAssignment.expression; + leftSideOfAssignment.parent = node; + target.parent = leftSideOfAssignment; + if (isNameOfExportsOrModuleExportsAliasDeclaration(target)) { + bindExportsPropertyAssignment(node); } - if (!funcSymbol.members) { - funcSymbol.members = ts.createMap(); + else { + bindPropertyAssignment(target.text, leftSideOfAssignment, false); } - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 0); + } + function lookupSymbolForName(name) { + return (container.symbol && container.symbol.exports && container.symbol.exports.get(name)) || (container.locals && container.locals.get(name)); + } + function bindPropertyAssignment(functionName, propertyAccessExpression, isPrototypeProperty) { + var targetSymbol = lookupSymbolForName(functionName); + if (targetSymbol && ts.isDeclarationOfFunctionOrClassExpression(targetSymbol)) { + targetSymbol = targetSymbol.valueDeclaration.initializer.symbol; + } + if (!targetSymbol || !(targetSymbol.flags & (16 | 32))) { + return; + } + var symbolTable = isPrototypeProperty ? + (targetSymbol.members || (targetSymbol.members = ts.createMap())) : + (targetSymbol.exports || (targetSymbol.exports = ts.createMap())); + declareSymbol(symbolTable, targetSymbol, propertyAccessExpression, 4, 0); } function bindCallExpression(node) { if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) { @@ -18141,33 +19118,26 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; - } - } - if (node.kind === 226) { + if (node.kind === 228) { bindBlockScopedDeclaration(node, 32, 899519); } else { var bindingName = node.name ? node.name.text : "__class"; bindAnonymousDeclaration(node, 32, bindingName); if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; - var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var prototypeSymbol = createSymbol(4 | 16777216, "prototype"); + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -18192,11 +19162,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 | 4096); - } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -18208,13 +19173,13 @@ var ts; } if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 536870912 : 0), 0); + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 67108864 : 0), 0); } } function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } checkStrictModeFunctionName(node); @@ -18228,8 +19193,8 @@ var ts; } function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } if (currentFlow) { @@ -18241,11 +19206,8 @@ var ts; } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -18267,15 +19229,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) || - node.kind === 226 || - (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 208) || + node.kind === 228 || + (node.kind === 232 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 || + (node.kind !== 207 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -18289,56 +19251,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179: - return computeCallExpression(node, subtreeFlags); case 180: + return computeCallExpression(node, subtreeFlags); + case 181: return computeNewExpression(node, subtreeFlags); - case 230: + case 232: return computeModuleDeclaration(node, subtreeFlags); - case 183: + case 184: return computeParenthesizedExpression(node, subtreeFlags); - case 192: + case 193: return computeBinaryExpression(node, subtreeFlags); - case 207: + case 209: return computeExpressionStatement(node, subtreeFlags); - case 144: + case 145: return computeParameter(node, subtreeFlags); - case 185: + case 186: return computeArrowFunction(node, subtreeFlags); - case 184: + case 185: return computeFunctionExpression(node, subtreeFlags); - case 225: + case 227: return computeFunctionDeclaration(node, subtreeFlags); - case 223: + case 225: return computeVariableDeclaration(node, subtreeFlags); - case 224: + case 226: return computeVariableDeclarationList(node, subtreeFlags); - case 205: + case 207: return computeVariableStatement(node, subtreeFlags); - case 219: + case 221: return computeLabeledStatement(node, subtreeFlags); - case 226: + case 228: return computeClassDeclaration(node, subtreeFlags); - case 197: + case 198: return computeClassExpression(node, subtreeFlags); - case 255: + case 258: return computeHeritageClause(node, subtreeFlags); - case 256: + case 259: return computeCatchClause(node, subtreeFlags); - case 199: + case 200: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150: + case 151: return computeConstructor(node, subtreeFlags); - case 147: + case 148: return computePropertyDeclaration(node, subtreeFlags); - case 149: + case 150: return computeMethod(node, subtreeFlags); - case 151: case 152: + case 153: return computeAccessor(node, subtreeFlags); - case 234: + case 236: return computeImportEquals(node, subtreeFlags); - case 177: + case 178: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -18363,8 +19325,8 @@ var ts; switch (kind) { case 96: return true; - case 177: case 178: + case 179: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96; @@ -18386,10 +19348,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 && leftKind === 176) { + if (operatorTokenKind === 57 && leftKind === 177) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 57 && leftKind === 175) { + else if (operatorTokenKind === 57 && leftKind === 176) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 @@ -18428,8 +19390,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 200 - || expressionKind === 182) { + if (expressionKind === 201 + || expressionKind === 183) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -18526,9 +19488,9 @@ var ts; transformFlags |= 8; } if (ts.hasModifier(node, 256)) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; @@ -18571,7 +19533,7 @@ var ts; transformFlags |= 3; } if (modifierFlags & 256) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } if (subtreeFlags & 1048576) { transformFlags |= 8; @@ -18579,7 +19541,7 @@ var ts; if (subtreeFlags & 163840) { transformFlags |= 192; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } } @@ -18594,7 +19556,7 @@ var ts; transformFlags |= 3; } if (ts.hasModifier(node, 256)) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } if (subtreeFlags & 1048576) { transformFlags |= 8; @@ -18602,7 +19564,7 @@ var ts; if (subtreeFlags & 163840) { transformFlags |= 192; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; @@ -18715,8 +19677,8 @@ var ts; var excludeFlags = 536872257; switch (kind) { case 119: - case 189: - transformFlags |= 16; + case 190: + transformFlags |= 8 | 16; break; case 113: case 111: @@ -18724,50 +19686,66 @@ var ts; case 116: case 123: case 75: - case 229: - case 260: - case 182: - case 200: + case 231: + case 263: + case 183: case 201: + case 202: case 130: transformFlags |= 3; break; - case 246: - case 247: case 248: - case 10: case 249: case 250: + case 10: case 251: case 252: + case 253: + case 254: + case 255: transformFlags |= 4; break; - case 213: - transformFlags |= 8; case 12: case 13: case 14: case 15: - case 194: - case 181: - case 258: + case 195: + case 182: + case 261: case 114: + case 203: transformFlags |= 192; break; - case 195: - transformFlags |= 192 | 16777216; + case 9: + if (node.hasExtendedUnicodeEscape) { + transformFlags |= 192; + } + break; + case 8: + if (node.numericLiteralFlags & 48) { + transformFlags |= 192; + } + break; + case 215: + if (node.awaitModifier) { + transformFlags |= 8; + } + transformFlags |= 192; + break; + case 196: + transformFlags |= 8 | 192 | 16777216; break; case 118: case 132: case 129: - case 134: - case 121: + case 133: case 135: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: case 156: @@ -18781,26 +19759,27 @@ var ts; case 164: case 165: case 166: - case 227: - case 228: case 167: + case 229: + case 230: case 168: case 169: case 170: case 171: + case 172: transformFlags = 3; excludeFlags = -3; break; - case 142: + case 143: transformFlags |= 2097152; if (subtreeFlags & 16384) { transformFlags |= 65536; } break; - case 196: + case 197: transformFlags |= 192 | 524288; break; - case 259: + case 262: transformFlags |= 8 | 1048576; break; case 96: @@ -18809,27 +19788,27 @@ var ts; case 98: transformFlags |= 16384; break; - case 172: + case 173: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 537396545; break; - case 173: + case 174: transformFlags |= 192 | 8388608; excludeFlags = 537396545; break; - case 174: + case 175: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; } break; - case 145: + case 146: transformFlags |= 3 | 4096; break; - case 176: + case 177: excludeFlags = 540087617; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -18841,29 +19820,29 @@ var ts; transformFlags |= 8; } break; - case 175: - case 180: + case 176: + case 181: excludeFlags = 537396545; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 209: - case 210: case 211: case 212: + case 213: + case 214: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 261: + case 264: if (subtreeFlags & 32768) { transformFlags |= 192; } break; + case 218: case 216: - case 214: - case 215: + case 217: transformFlags |= 33554432; break; } @@ -18871,56 +19850,57 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 && kind <= 171) { + if (kind >= 157 && kind <= 172) { return -3; } switch (kind) { - case 179: case 180: - case 175: + case 181: + case 176: return 537396545; - case 230: + case 232: return 574674241; - case 144: + case 145: return 536872257; - case 185: + case 186: return 601249089; - case 184: - case 225: + case 185: + case 227: return 601281857; - case 224: - return 546309441; case 226: - case 197: + return 546309441; + case 228: + case 198: return 539358529; - case 150: - return 601015617; - case 149: case 151: + return 601015617; + case 150: case 152: + case 153: return 601015617; case 118: case 132: case 129: - case 134: - case 121: case 135: + case 133: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: - case 227: - case 228: + case 156: + case 229: + case 230: return -3; - case 176: + case 177: return 540087617; - case 256: + case 259: return 537920833; - case 172: case 173: + case 174: return 537396545; default: return 536872257; @@ -18938,6 +19918,12 @@ var ts; return compilerOptions.traceResolution && host.trace !== undefined; } ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); function resolvedTypeScriptOnly(resolved) { if (!resolved) { return undefined; @@ -18945,9 +19931,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; @@ -18959,37 +19942,28 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); - switch (extensions) { - case 2: - case 0: - return tryReadFromField("typings") || tryReadFromField("types"); - case 1: - if (typeof jsonContent.main === "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); - } - return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main)); - } - return undefined; - } + return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); function tryReadFromField(fieldName) { - if (ts.hasProperty(jsonContent, fieldName)) { - var typesFile = jsonContent[fieldName]; - if (typeof typesFile === "string") { - var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); - } - return typesFilePath; + if (!ts.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); - } + return; + } + var fileName = jsonContent[fieldName]; + if (typeof fileName !== "string") { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); } + return; } + var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); + } + return path; } } function readJson(path, host) { @@ -19022,11 +19996,12 @@ var ts; return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; } var typeRoots; - forEachAncestorDirectory(currentDirectory, function (directory) { + forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -19081,7 +20056,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -19097,7 +20076,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -19138,31 +20118,116 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); + if (!perModuleNameCache) { + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + if (current === commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache.get(moduleName); + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache.set(moduleName, result); + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -19287,37 +20352,43 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, false); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + function nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, jsOnly) { + if (jsOnly === void 0) { jsOnly = false; } var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { - var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); + var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, true); }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state, true); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } - ts.nodeModuleNameResolver = nodeModuleNameResolver; + ts.nodeModuleNameResolverWorker = nodeModuleNameResolverWorker; function realpath(path, host, traceEnabled) { if (!host.realpath) { return path; @@ -19328,12 +20399,35 @@ var ts; } return real; } - function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName); @@ -19361,11 +20455,11 @@ var ts; } } switch (extensions) { - case 2: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -19374,113 +20468,181 @@ var ts; } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var packageJsonPath = pathToPackageJson(candidate); + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { considerPackageJson = true; } var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); - } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + if (considerPackageJson) { + var packageJsonPath = pathToPackageJson(candidate); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state); + if (fromPackageJson) { + return fromPackageJson; } } else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field); + if (directoryExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } + failedLookupLocations.push(packageJsonPath); } } - else { + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state); + if (!file) { + return undefined; + } + var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); + var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); + if (fromFile) { + var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + if (resolved) { + return resolved; + } if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); } - failedLookupLocations.push(packageJsonPath); } - return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; + return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, false); + } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); + } + } + function mangleScopedPackage(moduleName, state) { + if (ts.startsWith(moduleName, "@")) { + var replaceSlash = moduleName.replace(ts.directorySeparator, "__"); + if (replaceSlash !== moduleName) { + var mangled = replaceSlash.slice(1); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; + } } + return moduleName; } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); }); if (resolved_3) { return resolved_3; } - if (extensions === 0) { + if (extensions === Extensions.TypeScript) { return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); } } } @@ -19492,10 +20654,13 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } function forEachAncestorDirectory(directory, callback) { while (true) { var result = callback(directory); @@ -19535,23 +20700,29 @@ var ts; ts.getSymbolId = getSymbolId; function createTypeChecker(host, produceDiagnostics) { var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; var symbolCount = 0; + var symbolInstantiationDepth = 0; var emptyArray = []; var emptySymbols = ts.createMap(); var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); var modulekind = ts.getEmitModuleKind(compilerOptions); var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters; var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; - var strictNullChecks = compilerOptions.strictNullChecks; + var strictNullChecks = compilerOptions.strictNullChecks === undefined ? compilerOptions.strict : compilerOptions.strictNullChecks; + var noImplicitAny = compilerOptions.noImplicitAny === undefined ? compilerOptions.strict : compilerOptions.noImplicitAny; + var noImplicitThis = compilerOptions.noImplicitThis === undefined ? compilerOptions.strict : compilerOptions.noImplicitThis; var emitResolver = createResolver(); - var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var nodeBuilder = createNodeBuilder(); + var undefinedSymbol = createSymbol(4, "undefined"); undefinedSymbol.declarations = []; - var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); + var argumentsSymbol = createSymbol(4, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, @@ -19560,47 +20731,127 @@ var ts; isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, + getMergedSymbol: getMergedSymbol, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, - getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, + getTypeOfSymbolAtLocation: function (symbol, location) { + location = ts.getParseTreeNode(location); + return location ? getTypeOfSymbolAtLocation(symbol, location) : unknownType; + }, + getSymbolsOfParameterPropertyDeclaration: function (parameter, parameterName) { + parameter = ts.getParseTreeNode(parameter, ts.isParameter); + ts.Debug.assert(parameter !== undefined, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); + return getSymbolsOfParameterPropertyDeclaration(parameter, parameterName); + }, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getBaseTypeOfLiteralType: getBaseTypeOfLiteralType, + getWidenedType: getWidenedType, + getTypeFromTypeNode: function (node) { + node = ts.getParseTreeNode(node, ts.isTypeNode); + return node ? getTypeFromTypeNode(node) : unknownType; + }, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, - getSymbolsInScope: getSymbolsInScope, - getSymbolAtLocation: getSymbolAtLocation, - getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, - getTypeAtLocation: getTypeOfNode, - getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, - typeToString: typeToString, + typeToTypeNode: nodeBuilder.typeToTypeNode, + indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, + signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, + getSymbolsInScope: function (location, meaning) { + location = ts.getParseTreeNode(location); + return location ? getSymbolsInScope(location, meaning) : []; + }, + getSymbolAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getSymbolAtLocation(node) : undefined; + }, + getShorthandAssignmentValueSymbol: function (node) { + node = ts.getParseTreeNode(node); + return node ? getShorthandAssignmentValueSymbol(node) : undefined; + }, + getExportSpecifierLocalTargetSymbol: function (node) { + node = ts.getParseTreeNode(node, ts.isExportSpecifier); + return node ? getExportSpecifierLocalTargetSymbol(node) : undefined; + }, + getTypeAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getTypeOfNode(node) : unknownType; + }, + getPropertySymbolOfDestructuringAssignment: function (location) { + location = ts.getParseTreeNode(location, ts.isIdentifier); + return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; + }, + signatureToString: function (signature, enclosingDeclaration, flags, kind) { + return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind); + }, + typeToString: function (type, enclosingDeclaration, flags) { + return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags); + }, getSymbolDisplayBuilder: getSymbolDisplayBuilder, - symbolToString: symbolToString, + symbolToString: function (symbol, enclosingDeclaration, meaning) { + return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning); + }, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: function (node) { + node = ts.getParseTreeNode(node, ts.isExpression); + return node ? getContextualType(node) : undefined; + }, getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: getResolvedSignature, - getConstantValue: getConstantValue, - isValidPropertyAccess: isValidPropertyAccess, - getSignatureFromDeclaration: getSignatureFromDeclaration, - isImplementationOfOverload: isImplementationOfOverload, + getResolvedSignature: function (node, candidatesOutArray) { + node = ts.getParseTreeNode(node, ts.isCallLikeExpression); + return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + }, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, + isValidPropertyAccess: function (node, propertyName) { + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + return node ? isValidPropertyAccess(node, propertyName) : false; + }, + getSignatureFromDeclaration: function (declaration) { + declaration = ts.getParseTreeNode(declaration, ts.isFunctionLike); + return declaration ? getSignatureFromDeclaration(declaration) : undefined; + }, + isImplementationOfOverload: function (node) { + node = ts.getParseTreeNode(node, ts.isFunctionLike); + return node ? isImplementationOfOverload(node) : undefined; + }, + getImmediateAliasedSymbol: function (symbol) { + ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.immediateTarget) { + var node = getDeclarationOfAliasSymbol(symbol); + ts.Debug.assert(!!node); + links.immediateTarget = getTargetOfAliasDeclaration(node, true); + } + return links.immediateTarget; + }, getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, - getJsxElementAttributesType: getJsxElementAttributesType, + getAllAttributesTypeFromJsxOpeningLikeElement: function (node) { + node = ts.getParseTreeNode(node, ts.isJsxOpeningLikeElement); + return node ? getAllAttributesTypeFromJsxOpeningLikeElement(node) : undefined; + }, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, - isOptionalParameter: isOptionalParameter, + isOptionalParameter: function (node) { + node = ts.getParseTreeNode(node, ts.isParameter); + return node ? isOptionalParameter(node) : false; + }, tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -19609,8 +20860,8 @@ var ts; var numericLiteralTypes = ts.createMap(); var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; - var unknownSymbol = createSymbol(4 | 67108864, "unknown"); - var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var unknownSymbol = createSymbol(4, "unknown"); + var resolvingSymbol = createSymbol(0, "__resolving__"); var anyType = createIntrinsicType(1, "any"); var autoType = createIntrinsicType(1, "any"); var unknownType = createIntrinsicType(1, "unknown"); @@ -19627,8 +20878,9 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); + var nonPrimitiveType = createIntrinsicType(16777216, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); + var emptyTypeLiteralSymbol = createSymbol(2048, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -19636,16 +20888,15 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, undefined, 0, false, false); var enumNumberIndexInfo = createIndexInfo(stringType, true); + var jsObjectLiteralIndexInfo = createIndexInfo(anyType, false); var globals = ts.createMap(); var patternAmbientModules; - var getGlobalESSymbolConstructorSymbol; - var getGlobalPromiseConstructorSymbol; - var tryGetGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -19654,26 +20905,26 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var globalThisType; var anyArrayType; var autoArrayType; var anyReadonlyArrayType; - var getGlobalTemplateStringsArrayType; - var getGlobalESSymbolType; - var getGlobalIterableType; - var getGlobalIteratorType; - var getGlobalIterableIteratorType; - var getGlobalClassDecoratorType; - var getGlobalParameterDecoratorType; - var getGlobalPropertyDecoratorType; - var getGlobalMethodDecoratorType; - var getGlobalTypedPropertyDescriptorType; - var getGlobalPromiseType; - var tryGetGlobalPromiseType; - var getGlobalPromiseLikeType; - var getInstantiatedGlobalPromiseLikeType; - var getGlobalPromiseConstructorLikeType; - var getGlobalThenableType; - var jsxElementClassType; + var deferredGlobalESSymbolConstructorSymbol; + var deferredGlobalESSymbolType; + var deferredGlobalTypedPropertyDescriptorType; + var deferredGlobalPromiseType; + var deferredGlobalPromiseConstructorSymbol; + var deferredGlobalPromiseConstructorLikeType; + var deferredGlobalIterableType; + var deferredGlobalIteratorType; + var deferredGlobalIterableIteratorType; + var deferredGlobalAsyncIterableType; + var deferredGlobalAsyncIteratorType; + var deferredGlobalAsyncIterableIteratorType; + var deferredGlobalTemplateStringsArrayType; + var deferredJsxElementClassType; + var deferredJsxElementType; + var deferredJsxStatelessElementType; var deferredNodes; var deferredUnusedIdentifierNodes; var flowLoopStart = 0; @@ -19694,9 +20945,10 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1, "number": 2, "boolean": 4, @@ -19705,7 +20957,7 @@ var ts; "object": 16, "function": 32 }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128, "number": 256, "boolean": 512, @@ -19714,14 +20966,14 @@ var ts; "object": 2048, "function": 4096 }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, "symbol": esSymbolType, "undefined": undefinedType }); - var jsxElementType; + var typeofType = createTypeofType(); var _jsxNamespace; var _jsxFactoryEntity; var jsxTypes = ts.createMap(); @@ -19741,7 +20993,7 @@ var ts; var enumRelation = ts.createMap(); var _displayBuilder; var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -19771,7 +21023,12 @@ var ts; } function createSymbol(flags, name) { symbolCount++; - return new Symbol(flags, name); + var symbol = (new Symbol(flags | 134217728, name)); + symbol.checkFlags = 0; + return symbol; + } + function isTransientSymbol(symbol) { + return (symbol.flags & 134217728) !== 0; } function getExcludedSymbolFlags(flags) { var result = 0; @@ -19817,7 +21074,7 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 33554432, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) @@ -19839,12 +21096,10 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { + (target.valueDeclaration.kind === 232 && source.valueDeclaration.kind !== 232))) { target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -19857,6 +21112,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -19869,18 +21127,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { - if (!(targetSymbol.flags & 33554432)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + if (!(targetSymbol.flags & 134217728)) { + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -19901,7 +21160,7 @@ var ts; } mainModule = resolveExternalModuleSymbol(mainModule); if (mainModule.flags & 1920) { - mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule); + mainModule = mainModule.flags & 134217728 ? mainModule : cloneSymbol(mainModule); mergeSymbol(mainModule, moduleAugmentation.symbol); } else { @@ -19910,20 +21169,21 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } } function getSymbolLinks(symbol) { - if (symbol.flags & 67108864) + if (symbol.flags & 134217728) return symbol; var id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}); @@ -19935,14 +21195,17 @@ var ts; function getObjectFlags(type) { return type.flags & 32768 ? type.objectFlags : 0; } + function getCheckFlags(symbol) { + return symbol.flags & 134217728 ? symbol.checkFlags : 0; + } function isGlobalSourceFile(node) { - return node.kind === 261 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 264 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } @@ -19973,57 +21236,76 @@ var ts; (!compilerOptions.outFile && !compilerOptions.out)) { return true; } - if (isUsedInFunctionOrNonStaticProperty(usage)) { + if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { return true; } var sourceFiles = host.getSourceFiles(); return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 223 || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 175) { + var errorBindingElement = ts.getAncestor(usage, 175); + if (errorBindingElement) { + return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || + declaration.pos < errorBindingElement.pos; + } + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225), usage); + } + else if (declaration.kind === 225) { + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; + } + if (usage.parent.kind === 245) { + return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); - return isUsedInFunctionOrNonStaticProperty(usage, container); + return isInTypeQuery(usage) || isUsedInFunctionOrInstanceProperty(usage, declaration, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205: - case 211: + case 207: case 213: + case 215: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 212: - case 213: + case 214: + case 215: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } } return false; } - function isUsedInFunctionOrNonStaticProperty(usage, container) { - var current = usage; - while (current) { + function isUsedInFunctionOrInstanceProperty(usage, declaration, container) { + return !!ts.findAncestor(usage, function (current) { if (current === container) { - return false; + return "quit"; } if (ts.isFunctionLike(current)) { return true; } - var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 && - (ts.getModifierFlags(current.parent) & 32) === 0 && + var initializerOfProperty = current.parent && + current.parent.kind === 148 && current.parent.initializer === current; - if (initializerOfNonStaticProperty) { - return true; + if (initializerOfProperty) { + if (ts.getModifierFlags(current.parent) & 32) { + if (declaration.kind === 150) { + return true; + } + } + else { + var isDeclarationInstanceProperty = declaration.kind === 148 && !(ts.getModifierFlags(declaration) & 32); + if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { + return true; + } + } } - current = current.parent; - } - return false; + }); } } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { @@ -20038,18 +21320,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 282) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 144 || - lastLocation.kind === 143 + lastLocation.kind === 145 || + lastLocation.kind === 144 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 144 || + lastLocation.kind === 145 || (lastLocation === location.type && - result.valueDeclaration.kind === 144); + result.valueDeclaration.kind === 145); } } if (useResult) { @@ -20061,23 +21343,24 @@ var ts; } } switch (location.kind) { - case 261: + case 264: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230: + case 232: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 || ts.isAmbientModule(location)) { - if (result = moduleExports["default"]) { + if (location.kind === 264 || ts.isAmbientModule(location)) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; } - if (moduleExports[name] && - moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 243)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 && + ts.getDeclarationOfKind(moduleExport, 245)) { break; } } @@ -20085,13 +21368,13 @@ var ts; break loop; } break; - case 229: + case 231: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 148: case 147: - case 146: if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -20101,17 +21384,21 @@ var ts; } } break; - case 226: - case 197: - case 227: + case 228: + case 198: + case 229: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { + if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { + result = undefined; + break; + } if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } break loop; } - if (location.kind === 197 && meaning & 32) { + if (location.kind === 198 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -20119,28 +21406,28 @@ var ts; } } break; - case 142: + case 143: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 225: - case 185: + case 153: + case 227: + case 186: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184: + case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -20153,8 +21440,8 @@ var ts; } } break; - case 145: - if (location.parent && location.parent.kind === 144) { + case 146: + if (location.parent && location.parent.kind === 145) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -20177,7 +21464,8 @@ var ts; !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && - !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { + !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && + !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } } @@ -20189,21 +21477,31 @@ var ts; error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } - if (meaning & 2) { + if (meaning & 2 || + ((meaning & 32 || meaning & 384) && (meaning & 107455) === 107455)) { var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); - if (exportOrLocalSymbol.flags & 2) { + if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233) { + if (decls && decls.length === 1 && decls[0].kind === 235) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } } return result; } + function isTypeParameterSymbolDeclaredInContainer(symbol, container) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.kind === 144 && decl.parent === container) { + return true; + } + } + return false; + } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { if ((errorLocation.kind === 70 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { return false; @@ -20244,9 +21542,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70: - case 177: + case 178: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199: + case 200: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -20273,65 +21571,84 @@ var ts; } return false; } - function checkResolvedBlockScopedVariable(result, errorLocation) { - ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); - } - } - function isSameScopeDescendentOf(initial, parent, stopAt) { - if (!parent) { - return false; + function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { + if (meaning & (107455 & ~1024 & ~793064)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~107455, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, name); + return true; + } } - for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { - if (current === parent) { + else if (meaning & (793064 & ~1024 & ~107455)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~793064, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, name); return true; } } return false; } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384)); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 231) ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + if (result.flags & 2) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 32) { + error(errorLocation, ts.Diagnostics.Class_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 384) { + error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + return parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent; }); + } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234) { + if (node.kind === 236) { return node; } - while (node && node.kind !== 235) { - node = node.parent; - } - return node; + return ts.findAncestor(node, function (n) { return n.kind === 237; }); } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } - function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245) { + function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { + if (node.moduleReference.kind === 247) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } - return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); } - function getTargetOfImportClause(node) { + function getTargetOfImportClause(node, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default"), dontResolveAlias); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { - return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } return exportDefaultSymbol; } } - function getTargetOfNamespaceImport(node) { + function getTargetOfNamespaceImport(node, dontResolveAlias) { var moduleSpecifier = node.parent.parent.moduleSpecifier; - return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); + return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier, dontResolveAlias); } function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { if (valueSymbol.flags & (793064 | 1920)) { @@ -20348,12 +21665,9 @@ var ts; result.exports = valueSymbol.exports; return result; } - function getExportOfModule(symbol, name) { + function getExportOfModule(symbol, name, dontResolveAlias) { if (symbol.flags & 1536) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; - if (exportedSymbol) { - return resolveSymbol(exportedSymbol); - } + return resolveSymbol(getExportsOfSymbol(symbol).get(name), dontResolveAlias); } } function getPropertyOfVariable(symbol, name) { @@ -20364,71 +21678,72 @@ var ts; } } } - function getExternalModuleMember(node, specifier) { + function getExternalModuleMember(node, specifier, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); + var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier, dontResolveAlias); if (targetSymbol) { - var name_16 = specifier.propertyName || specifier.name; - if (name_16.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } - symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { - symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); + var symbolFromModule = getExportOfModule(targetSymbol, name.text, dontResolveAlias); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { + symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } } } - function getTargetOfImportSpecifier(node) { - return getExternalModuleMember(node.parent.parent.parent, node); + function getTargetOfImportSpecifier(node, dontResolveAlias) { + return getExternalModuleMember(node.parent.parent.parent, node, dontResolveAlias); } - function getTargetOfNamespaceExportDeclaration(node) { - return resolveExternalModuleSymbol(node.parent.symbol); + function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) { + return resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias); } - function getTargetOfExportSpecifier(node) { + function getTargetOfExportSpecifier(node, dontResolveAlias) { return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920); + getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : + resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920, false, dontResolveAlias); } - function getTargetOfExportAssignment(node) { - return resolveEntityName(node.expression, 107455 | 793064 | 1920); + function getTargetOfExportAssignment(node, dontResolveAlias) { + return resolveEntityName(node.expression, 107455 | 793064 | 1920, false, dontResolveAlias); } - function getTargetOfAliasDeclaration(node) { + function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 234: - return getTargetOfImportEqualsDeclaration(node); case 236: - return getTargetOfImportClause(node); - case 237: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); + case 238: + return getTargetOfImportClause(node, dontRecursivelyResolve); case 239: - return getTargetOfImportSpecifier(node); - case 243: - return getTargetOfExportSpecifier(node); - case 240: - return getTargetOfExportAssignment(node); - case 233: - return getTargetOfNamespaceExportDeclaration(node); + return getTargetOfNamespaceImport(node, dontRecursivelyResolve); + case 241: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 245: + return getTargetOfExportSpecifier(node, dontRecursivelyResolve); + case 242: + return getTargetOfExportAssignment(node, dontRecursivelyResolve); + case 235: + return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } - function resolveSymbol(symbol) { - return symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)) ? resolveAlias(symbol) : symbol; + function resolveSymbol(symbol, dontResolveAlias) { + var shouldResolve = !dontResolveAlias && symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)); + return shouldResolve ? resolveAlias(symbol) : symbol; } function resolveAlias(symbol) { ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); @@ -20467,10 +21782,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240) { + if (node.kind === 242) { checkExpressionCached(node.expression); } - else if (node.kind === 243) { + else if (node.kind === 245) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -20482,11 +21797,11 @@ var ts; if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 70 || entityName.parent.kind === 141) { + if (entityName.kind === 70 || entityName.parent.kind === 142) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 234); + ts.Debug.assert(entityName.parent.kind === 236); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -20505,9 +21820,19 @@ var ts; return undefined; } } - else if (name.kind === 141 || name.kind === 177) { - var left = name.kind === 141 ? name.left : name.expression; - var right = name.kind === 141 ? name.right : name.name; + else if (name.kind === 142 || name.kind === 178) { + var left = void 0; + if (name.kind === 142) { + left = name.left; + } + else if (name.kind === 178 && + (name.expression.kind === 184 || ts.isEntityNameExpression(name.expression))) { + left = name.expression; + } + else { + return undefined; + } + var right = name.kind === 142 ? name.right : name.name; var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -20523,10 +21848,15 @@ var ts; return undefined; } } + else if (name.kind === 184) { + return ts.isEntityNameExpression(name.expression) ? + resolveEntityName(name.expression, meaning, ignoreErrors, dontResolveAlias, location) : + undefined; + } else { ts.Debug.fail("Unknown entity name kind."); } - ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { @@ -20534,7 +21864,7 @@ var ts; } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { if (isForAugmentation === void 0) { isForAugmentation = false; } - if (moduleReferenceExpression.kind !== 9) { + if (moduleReferenceExpression.kind !== 9 && moduleReferenceExpression.kind !== 12) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -20571,11 +21901,10 @@ var ts; } if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } - else if (compilerOptions.noImplicitAny && moduleNotFoundError) { + else if (noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); } return undefined; @@ -20597,27 +21926,35 @@ var ts; } return undefined; } - function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias)) || moduleSymbol; } - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { - var symbol = resolveExternalModuleSymbol(moduleSymbol); - if (symbol && !(symbol.flags & (1536 | 3))) { + function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); + if (!dontResolveAlias && symbol && !(symbol.flags & (1536 | 3))) { error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -20628,24 +21965,28 @@ var ts; return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -20657,26 +21998,26 @@ var ts; } visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -20698,22 +22039,13 @@ var ts; : symbol; } function symbolIsValue(symbol) { - if (symbol.flags & 16777216) { - return symbolIsValue(getSymbolLinks(symbol).target); - } - if (symbol.flags & 107455) { - return true; - } - if (symbol.flags & 8388608) { - return (resolveAlias(symbol).flags & 107455) !== 0; - } - return false; + return !!(symbol.flags & 107455 || symbol.flags & 8388608 && resolveAlias(symbol).flags & 107455); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 && ts.nodeIsPresent(member.body)) { return member; } } @@ -20741,6 +22073,9 @@ var ts; type.symbol = symbol; return type; } + function createTypeofType() { + return getUnionType(ts.convertToArray(typeofEQFacts.keys(), function (s) { return getLiteralTypeForText(32, s); })); + } function isReservedMemberName(name) { return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && @@ -20749,16 +22084,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -20777,19 +22111,19 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 261: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 264: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -20802,6 +22136,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { return true; @@ -20815,26 +22159,28 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + if (isAccessible(symbols.get(symbol.name))) { + return [symbol]; + } + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -20845,14 +22191,14 @@ var ts; function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { return false; } if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -20866,10 +22212,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147: - case 149: - case 151: + case 148: + case 150: case 152: + case 153: continue; default: return false; @@ -20917,15 +22263,12 @@ var ts; } return { accessibility: 0 }; function getExternalModuleContainer(declaration) { - for (; declaration; declaration = declaration.parent) { - if (hasExternalModuleSymbol(declaration)) { - return getSymbolOfNode(declaration); - } - } + var node = ts.findAncestor(declaration, hasExternalModuleSymbol); + return node && getSymbolOfNode(node); } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 264 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -20959,11 +22302,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 234) { + else if (entityName.kind === 142 || entityName.kind === 178 || + entityName.parent.kind === 236) { meaning = 1920; } else { @@ -21011,6 +22354,483 @@ var ts; } return result; } + function createNodeBuilder() { + var context; + return { + typeToTypeNode: function (type, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = typeToTypeNodeHelper(type); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + indexInfoToIndexSignatureDeclaration: function (indexInfo, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + signatureToSignatureDeclaration: function (signature, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = signatureToSignatureDeclarationHelper(signature, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + } + }; + function createNodeBuilderContext(enclosingDeclaration, flags) { + return { + enclosingDeclaration: enclosingDeclaration, + flags: flags, + encounteredError: false, + inObjectTypeLiteral: false, + checkAlias: true, + symbolStack: undefined + }; + } + function typeToTypeNodeHelper(type) { + if (!type) { + context.encounteredError = true; + return undefined; + } + if (type.flags & 1) { + return ts.createKeywordTypeNode(118); + } + if (type.flags & 2) { + return ts.createKeywordTypeNode(135); + } + if (type.flags & 4) { + return ts.createKeywordTypeNode(132); + } + if (type.flags & 8) { + return ts.createKeywordTypeNode(121); + } + if (type.flags & 16) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & (32)) { + return ts.createLiteralTypeNode((ts.createLiteral(type.text))); + } + if (type.flags & (64)) { + return ts.createLiteralTypeNode((ts.createNumericLiteral(type.text))); + } + if (type.flags & 128) { + return type.intrinsicName === "true" ? ts.createTrue() : ts.createFalse(); + } + if (type.flags & 256) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & 1024) { + return ts.createKeywordTypeNode(104); + } + if (type.flags & 2048) { + return ts.createKeywordTypeNode(138); + } + if (type.flags & 4096) { + return ts.createKeywordTypeNode(94); + } + if (type.flags & 8192) { + return ts.createKeywordTypeNode(129); + } + if (type.flags & 512) { + return ts.createKeywordTypeNode(136); + } + if (type.flags & 16777216) { + return ts.createKeywordTypeNode(133); + } + if (type.flags & 16384 && type.isThisType) { + if (context.inObjectTypeLiteral) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowThisInObjectLiteral)) { + context.encounteredError = true; + } + } + return ts.createThis(); + } + var objectFlags = getObjectFlags(type); + if (objectFlags & 4) { + ts.Debug.assert(!!(type.flags & 32768)); + return typeReferenceToTypeNode(type); + } + if (objectFlags & 3) { + ts.Debug.assert(!!(type.flags & 32768)); + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & 16384) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (context.checkAlias && type.aliasSymbol) { + var name = symbolToName(type.aliasSymbol, false); + var typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments); + return ts.createTypeReferenceNode(name, typeArgumentNodes); + } + context.checkAlias = false; + if (type.flags & 65536) { + var formattedUnionTypes = formatUnionTypes(type.types); + var unionTypeNodes = formattedUnionTypes && mapToTypeNodeArray(formattedUnionTypes); + if (unionTypeNodes && unionTypeNodes.length > 0) { + return ts.createUnionOrIntersectionTypeNode(165, unionTypeNodes); + } + else { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyUnionOrIntersection)) { + context.encounteredError = true; + } + return undefined; + } + } + if (type.flags & 131072) { + return ts.createUnionOrIntersectionTypeNode(166, mapToTypeNodeArray(type.types)); + } + if (objectFlags & (16 | 32)) { + ts.Debug.assert(!!(type.flags & 32768)); + return createAnonymousTypeNode(type); + } + if (type.flags & 262144) { + var indexedType = type.type; + var indexTypeNode = typeToTypeNodeHelper(indexedType); + return ts.createTypeOperatorNode(indexTypeNode); + } + if (type.flags & 524288) { + var objectTypeNode = typeToTypeNodeHelper(type.objectType); + var indexTypeNode = typeToTypeNodeHelper(type.indexType); + return ts.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); + } + ts.Debug.fail("Should be unreachable."); + function mapToTypeNodeArray(types) { + var result = []; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type_1 = types_1[_i]; + var typeNode = typeToTypeNodeHelper(type_1); + if (typeNode) { + result.push(typeNode); + } + } + return result; + } + function createMappedTypeNodeFromType(type) { + ts.Debug.assert(!!(type.flags & 32768)); + var typeParameter = getTypeParameterFromMappedType(type); + var typeParameterNode = typeParameterToDeclaration(typeParameter); + var templateType = getTemplateTypeFromMappedType(type); + var templateTypeNode = typeToTypeNodeHelper(templateType); + var readonlyToken = type.declaration && type.declaration.readonlyToken ? ts.createToken(130) : undefined; + var questionToken = type.declaration && type.declaration.questionToken ? ts.createToken(54) : undefined; + return ts.createMappedTypeNode(readonlyToken, typeParameterNode, questionToken, templateTypeNode); + } + function createAnonymousTypeNode(type) { + var symbol = type.symbol; + if (symbol) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512) || + shouldWriteTypeOfFunctionSymbol()) { + return createTypeQueryNodeFromSymbol(symbol); + } + else if (ts.contains(context.symbolStack, symbol)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + var entityName = symbolToName(typeAlias, false); + return ts.createTypeReferenceNode(entityName, undefined); + } + else { + return ts.createKeywordTypeNode(118); + } + } + else { + if (!context.symbolStack) { + context.symbolStack = []; + } + context.symbolStack.push(symbol); + var result = createTypeNodeFromObjectType(type); + context.symbolStack.pop(); + return result; + } + } + else { + return createTypeNodeFromObjectType(type); + } + function shouldWriteTypeOfFunctionSymbol() { + var isStaticMethodSymbol = !!(symbol.flags & 8192 && + ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32; })); + var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && + (symbol.parent || + ts.forEach(symbol.declarations, function (declaration) { + return declaration.parent.kind === 264 || declaration.parent.kind === 233; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return ts.contains(context.symbolStack, symbol); + } + } + } + function createTypeNodeFromObjectType(type) { + if (type.objectFlags & 32) { + if (getConstraintTypeFromMappedType(type).flags & (16384 | 262144)) { + return createMappedTypeNodeFromType(type); + } + } + var resolved = resolveStructuredTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + return ts.createTypeLiteralNode(undefined); + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + var signature = resolved.callSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 159); + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + var signature = resolved.constructSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 160); + } + } + var saveInObjectTypeLiteral = context.inObjectTypeLiteral; + context.inObjectTypeLiteral = true; + var members = createTypeNodesFromResolvedType(resolved); + context.inObjectTypeLiteral = saveInObjectTypeLiteral; + return ts.createTypeLiteralNode(members); + } + function createTypeQueryNodeFromSymbol(symbol) { + var entityName = symbolToName(symbol, false); + return ts.createTypeQueryNode(entityName); + } + function typeReferenceToTypeNode(type) { + var typeArguments = type.typeArguments || emptyArray; + if (type.target === globalArrayType) { + var elementType = typeToTypeNodeHelper(typeArguments[0]); + return ts.createArrayTypeNode(elementType); + } + else if (type.target.objectFlags & 8) { + if (typeArguments.length > 0) { + var tupleConstituentNodes = mapToTypeNodeArray(typeArguments.slice(0, getTypeReferenceArity(type))); + if (tupleConstituentNodes && tupleConstituentNodes.length > 0) { + return ts.createTupleTypeNode(tupleConstituentNodes); + } + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyTuple)) { + context.encounteredError = true; + } + return undefined; + } + else { + var outerTypeParameters = type.target.outerTypeParameters; + var i = 0; + var qualifiedName = undefined; + if (outerTypeParameters) { + var length_1 = outerTypeParameters.length; + while (i < length_1) { + var start = i; + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + do { + i++; + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { + var qualifiedNamePart = symbolToName(parent, true); + if (!qualifiedName) { + qualifiedName = ts.createQualifiedName(qualifiedNamePart, undefined); + } + else { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = qualifiedNamePart; + qualifiedName = ts.createQualifiedName(qualifiedName, undefined); + } + } + } + } + var entityName = undefined; + var nameIdentifier = symbolToName(type.symbol, true); + if (qualifiedName) { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = nameIdentifier; + entityName = qualifiedName; + } + else { + entityName = nameIdentifier; + } + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + var typeArgumentNodes = ts.some(typeArguments) ? mapToTypeNodeArray(typeArguments.slice(i, typeParameterCount - i)) : undefined; + return ts.createTypeReferenceNode(entityName, typeArgumentNodes); + } + } + function createTypeNodesFromResolvedType(resolvedType) { + var typeElements = []; + for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 154)); + } + for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 155)); + } + if (resolvedType.stringIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.stringIndexInfo, 0)); + } + if (resolvedType.numberIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.numberIndexInfo, 1)); + } + var properties = resolvedType.properties; + if (!properties) { + return typeElements; + } + for (var _d = 0, properties_2 = properties; _d < properties_2.length; _d++) { + var propertySymbol = properties_2[_d]; + var propertyType = getTypeOfSymbol(propertySymbol); + var oldDeclaration = propertySymbol.declarations && propertySymbol.declarations[0]; + if (!oldDeclaration) { + return; + } + var propertyName = oldDeclaration.name; + var optionalToken = propertySymbol.flags & 67108864 ? ts.createToken(54) : undefined; + if (propertySymbol.flags & (16 | 8192) && !getPropertiesOfObjectType(propertyType).length) { + var signatures = getSignaturesOfType(propertyType, 0); + for (var _e = 0, signatures_1 = signatures; _e < signatures_1.length; _e++) { + var signature = signatures_1[_e]; + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 149); + methodDeclaration.name = propertyName; + methodDeclaration.questionToken = optionalToken; + typeElements.push(methodDeclaration); + } + } + else { + var propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType) : ts.createKeywordTypeNode(118); + typeElements.push(ts.createPropertySignature(propertyName, optionalToken, propertyTypeNode, undefined)); + } + } + return typeElements.length ? typeElements : undefined; + } + } + function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind) { + var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 ? 135 : 132); + var name = ts.getNameFromIndexInfo(indexInfo); + var indexingParameter = ts.createParameter(undefined, undefined, undefined, name, undefined, indexerTypeNode, undefined); + var typeNode = typeToTypeNodeHelper(indexInfo.type); + return ts.createIndexSignatureDeclaration(undefined, indexInfo.isReadonly ? [ts.createToken(130)] : undefined, [indexingParameter], typeNode); + } + function signatureToSignatureDeclarationHelper(signature, kind) { + var typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter); }); + var returnTypeNode; + if (signature.typePredicate) { + var typePredicate = signature.typePredicate; + var parameterName = typePredicate.kind === 1 ? ts.createIdentifier(typePredicate.parameterName) : ts.createThisTypeNode(); + var typeNode = typeToTypeNodeHelper(typePredicate.type); + returnTypeNode = ts.createTypePredicateNode(parameterName, typeNode); + } + else { + var returnType = getReturnTypeOfSignature(signature); + returnTypeNode = returnType && typeToTypeNodeHelper(returnType); + } + var returnTypeNodeExceptAny = returnTypeNode && returnTypeNode.kind !== 118 ? returnTypeNode : undefined; + return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNodeExceptAny); + } + function typeParameterToDeclaration(type) { + var constraint = getConstraintFromTypeParameter(type); + var constraintNode = constraint && typeToTypeNodeHelper(constraint); + var defaultParameter = getDefaultFromTypeParameter(type); + var defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter); + var name = symbolToName(type.symbol, true); + return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); + } + function symbolToParameterDeclaration(parameterSymbol) { + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 145); + var parameterType = getTypeOfSymbol(parameterSymbol); + var parameterTypeNode = typeToTypeNodeHelper(parameterType); + var parameterNode = ts.createParameter(parameterDeclaration.decorators, parameterDeclaration.modifiers, parameterDeclaration.dotDotDotToken && ts.createToken(23), ts.getSynthesizedClone(parameterDeclaration.name), parameterDeclaration.questionToken && ts.createToken(54), parameterTypeNode, parameterDeclaration.initializer); + return parameterNode; + } + function symbolToName(symbol, expectsIdentifier) { + var chain; + var isTypeParameter = symbol.flags & 262144; + if (!isTypeParameter && context.enclosingDeclaration) { + chain = getSymbolChain(symbol, 0, true); + ts.Debug.assert(chain && chain.length > 0); + } + else { + chain = [symbol]; + } + if (expectsIdentifier && chain.length !== 1 + && !context.encounteredError + && !(context.flags & ts.NodeBuilderFlags.allowQualifedNameInPlaceOfIdentifier)) { + context.encounteredError = true; + } + return createEntityNameFromSymbolChain(chain, chain.length - 1); + function createEntityNameFromSymbolChain(chain, index) { + ts.Debug.assert(chain && 0 <= index && index < chain.length); + var symbol = chain[index]; + var typeParameterString = ""; + if (index > 0) { + var parentSymbol = chain[index - 1]; + var typeParameters = void 0; + if (getCheckFlags(symbol) & 1) { + typeParameters = getTypeParametersOfClassOrInterface(parentSymbol); + } + else { + var targetSymbol = getTargetSymbol(parentSymbol); + if (targetSymbol.flags & (32 | 64 | 524288)) { + typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + } + } + if (typeParameters && typeParameters.length > 0) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowTypeParameterInQualifiedName)) { + context.encounteredError = true; + } + var writer = ts.getSingleLineStringWriter(); + var displayBuilder = getSymbolDisplayBuilder(); + displayBuilder.buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, context.enclosingDeclaration, 0); + typeParameterString = writer.string(); + ts.releaseStringWriter(writer); + } + } + var symbolName = getNameOfSymbol(symbol); + var symbolNameWithTypeParameters = typeParameterString.length > 0 ? symbolName + "<" + typeParameterString + ">" : symbolName; + var identifier = ts.createIdentifier(symbolNameWithTypeParameters); + return index > 0 ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier; + } + function getSymbolChain(symbol, meaning, endOfChain) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, false); + var parentSymbol; + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + var parentChain = getSymbolChain(parent, getQualifiedLeftMeaning(meaning), false); + if (parentChain) { + parentSymbol = parent; + accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [symbol]); + } + } + } + if (accessibleSymbolChain) { + return accessibleSymbolChain; + } + if (endOfChain || + !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) && + !(symbol.flags & (2048 | 4096))) { + return [symbol]; + } + } + function getNameOfSymbol(symbol) { + var declaration = ts.firstOrUndefined(symbol.declarations); + if (declaration) { + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225) { + return ts.declarationNameToString(declaration.parent.name); + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowAnonymousIdentifier)) { + context.encounteredError = true; + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; + } + } + return symbol.name; + } + } + } function typePredicateToString(typePredicate, enclosingDeclaration, flags) { var writer = ts.getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); @@ -21054,11 +22874,8 @@ var ts; } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { - var node = type.symbol.declarations[0].parent; - while (node.kind === 166) { - node = node.parent; - } - if (node.kind === 228) { + var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 167; }); + if (node.kind === 230) { return getSymbolOfNode(node); } } @@ -21066,29 +22883,32 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 && + node.parent.kind === 233 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197: - return "(Anonymous class)"; - case 184: - case 185: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225) { + return ts.declarationNameToString(declaration.parent.name); + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } @@ -21116,7 +22936,7 @@ var ts; function appendParentTypeArgumentsAndSymbolName(symbol) { if (parentSymbol) { if (flags & 1) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { @@ -21135,9 +22955,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -21167,7 +22987,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { var nextFlags = flags & ~512; - if (type.flags & 16015) { + if (type.flags & 16793231) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -21192,7 +23012,7 @@ var ts; else if (!(flags & 512) && type.aliasSymbol && isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) { var typeArguments = type.aliasTypeArguments; - writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); + writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, ts.length(typeArguments), nextFlags); } else if (type.flags & 196608) { writeUnionOrIntersectionType(type, nextFlags); @@ -21267,15 +23087,15 @@ var ts; var outerTypeParameters = type.target.outerTypeParameters; var i = 0; if (outerTypeParameters) { - var length_1 = outerTypeParameters.length; - while (i < length_1) { + var length_2 = outerTypeParameters.length; + while (i < length_2) { var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -21301,7 +23121,8 @@ var ts; function writeAnonymousType(type, flags) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & (32 | 384 | 512)) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -21334,7 +23155,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 || declaration.parent.kind === 231; + return declaration.parent.kind === 264 || declaration.parent.kind === 233; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -21347,32 +23168,13 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130); - writeSpace(writer); - } - writePunctuation(writer, 20); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21); - writePunctuation(writer, 55); - writeSpace(writer); - writeType(info.type, 0); - writePunctuation(writer, 24); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130); writeSpace(writer); } buildSymbolDisplay(prop, writer); - if (prop.flags & 536870912) { + if (prop.flags & 67108864) { writePunctuation(writer, 54); } } @@ -21448,15 +23250,15 @@ var ts; writePunctuation(writer, 24); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134); - writeIndexSignature(resolved.numberIndexInfo, 132); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { - var signature = signatures_1[_f]; + for (var _f = 0, signatures_2 = signatures; _f < signatures_2.length; _f++) { + var signature = signatures_2[_f]; writePropertyWithModifiers(p); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); writePunctuation(writer, 24); @@ -21515,32 +23317,43 @@ var ts; writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } + var defaultType = getDefaultFromTypeParameter(tp); + if (defaultType) { + writeSpace(writer); + writePunctuation(writer, 57); + writeSpace(writer); + buildTypeDisplay(defaultType, writer, enclosingDeclaration, flags, symbolStack); + } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; - if (ts.isRestParameter(parameterNode)) { + if (parameterNode ? ts.isRestParameter(parameterNode) : isTransientSymbol(p) && p.isRestParameter) { writePunctuation(writer, 23); } - if (ts.isBindingPattern(parameterNode.name)) { + if (parameterNode && ts.isBindingPattern(parameterNode.name)) { buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); } else { appendSymbolNameOnly(p, writer); } - if (isOptionalParameter(parameterNode)) { + if (parameterNode && isOptionalParameter(parameterNode)) { writePunctuation(writer, 54); } writePunctuation(writer, 55); writeSpace(writer); - buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); + var type = getTypeOfSymbol(p); + if (parameterNode && isRequiredInitializedParameter(parameterNode)) { + type = includeFalsyTypes(type, 2048); + } + buildTypeDisplay(type, writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { writePunctuation(writer, 16); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { writePunctuation(writer, 20); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -21554,9 +23367,9 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174); + ts.Debug.assert(bindingElement.kind === 175); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); writeSpace(writer); } @@ -21628,6 +23441,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 && isTypeAny(returnType)) { + return; + } if (flags & 8) { writeSpace(writer); writePunctuation(writer, 35); @@ -21640,7 +23457,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -21658,6 +23474,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130); + writeSpace(writer); + } + writePunctuation(writer, 20); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55); + writeSpace(writer); + switch (kind) { + case 1: + writeKeyword(writer, 132); + break; + case 0: + writeKeyword(writer, 135); + break; + } + writePunctuation(writer, 21); + writePunctuation(writer, 55); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -21668,6 +23510,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -21682,63 +23525,63 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174: + case 175: return isDeclarationVisible(node.parent.parent); - case 223: + case 225: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 230: - case 226: - case 227: + case 232: case 228: - case 225: case 229: - case 234: + case 230: + case 227: + case 231: + case 236: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 236 && parent.kind !== 264 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent); + case 148: case 147: - case 146: - case 151: case 152: + case 153: + case 150: case 149: - case 148: if (ts.getModifierFlags(node) & (8 | 16)) { return false; } - case 150: - case 154: - case 153: + case 151: case 155: - case 144: - case 231: - case 158: + case 154: + case 156: + case 145: + case 233: case 159: - case 161: - case 157: + case 160: case 162: + case 158: case 163: case 164: case 165: case 166: + case 167: return isDeclarationVisible(node.parent); - case 236: - case 237: + case 238: case 239: + case 241: return false; - case 143: - case 261: - case 233: + case 144: + case 264: + case 235: return true; - case 240: + case 242: return false; default: return false; @@ -21747,10 +23590,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240) { + if (node.parent && node.parent.kind === 242) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243) { + else if (node.parent.kind === 245) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -21782,8 +23625,8 @@ var ts; function pushTypeResolution(target, propertyName) { var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); if (resolutionCycleStartIndex >= 0) { - var length_2 = resolutionTargets.length; - for (var i = resolutionCycleStartIndex; i < length_2; i++) { + var length_3 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_3; i++) { resolutionResults[i] = false; } return false; @@ -21825,21 +23668,20 @@ var ts; return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = ts.getRootDeclaration(node); - while (node) { + node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 223: - case 224: + case 225: + case 226: + case 241: + case 240: case 239: case 238: - case 237: - case 236: - node = node.parent; - break; + return false; default: - return node.parent; + return true; } - } + }); + return node && node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); @@ -21852,32 +23694,34 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192) !== 0; - } function getTypeForBindingElementParent(node) { var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144); }); + if (source.flags & 8192) { + return emptyObjectType; + } + if (source.flags & 65536) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); - for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_17 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_17)] = true; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var name = properties_3[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16); - var isMethod = prop.flags & 8192; var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0); @@ -21897,9 +23741,9 @@ var ts; return parentType; } var type; - if (pattern.kind === 172) { + if (pattern.kind === 173) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } @@ -21913,25 +23757,25 @@ var ts; type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_18 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_18)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_18); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } } else { - var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); + var elementType = checkIteratedTypeOrElementType(parentType, pattern, false, false); if (declaration.dotDotDotToken) { type = createArrayType(elementType); } @@ -21958,7 +23802,7 @@ var ts; getUnionType([type, checkExpressionCached(declaration.initializer)], true) : type; } - function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + function getTypeForDeclarationFromJSDocComment(declaration) { var jsdocType = ts.getJSDocType(declaration); if (jsdocType) { return getTypeFromTypeNode(jsdocType); @@ -21971,33 +23815,35 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 && expr.elements.length === 0; + return expr.kind === 176 && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152) { - var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (declaration.flags & 65536) { + var type = getTypeForDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } - if (declaration.parent.parent.kind === 212) { + if (declaration.parent.parent.kind === 214) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213) { - return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; + if (declaration.parent.parent.kind === 215) { + var forOfStatement = declaration.parent.parent; + return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); + var declaredType = getTypeFromTypeNode(declaration.type); + return addOptionality(declaredType, declaration.questionToken && includeOptionality); } - if ((compilerOptions.noImplicitAny || declaration.flags & 2097152) && - declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + if ((noImplicitAny || declaration.flags & 65536) && + declaration.kind === 225 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -22006,10 +23852,10 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var func = declaration.parent; - if (func.kind === 152 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151); + if (func.kind === 153 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -22035,7 +23881,10 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 258) { + if (ts.isJsxAttribute(declaration)) { + return trueType; + } + if (declaration.kind === 261) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -22043,6 +23892,37 @@ var ts; } return undefined; } + function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol) { + var types = []; + var definedInConstructor = false; + var definedInMethod = false; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var expression = declaration.kind === 193 ? declaration : + declaration.kind === 178 ? ts.getAncestor(declaration, 193) : + undefined; + if (!expression) { + return unknownType; + } + if (ts.isPropertyAccessExpression(expression.left) && expression.left.expression.kind === 98) { + if (ts.getThisContainer(expression, false).kind === 151) { + definedInConstructor = true; + } + else { + definedInMethod = true; + } + } + if (expression.flags & 65536) { + var type = getTypeForDeclarationFromJSDocComment(expression.parent); + if (type && type !== unknownType) { + types.push(getWidenedType(type)); + continue; + } + } + types.push(getWidenedLiteralType(checkExpressionCached(expression.right))); + } + return getWidenedType(addOptionality(getUnionType(types, true), definedInMethod && !definedInConstructor)); + } function getTypeFromBindingElement(element, includePatternInType, reportErrors) { if (element.initializer) { return checkDeclarationInitializer(element); @@ -22050,28 +23930,33 @@ var ts; if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); } - if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + if (reportErrors && noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAnyError(element, anyType); } return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { + if (isComputedNonLiteralName(name)) { hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, false); + return; + } var text = ts.getTextOfPropertyName(name); - var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); + var flags = 4 | (e.initializer ? 67108864 : 0); var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -22095,7 +23980,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 + return pattern.kind === 173 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -22105,13 +23990,13 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 257) { + if (declaration.kind === 260) { return type; } return getWidenedType(type); } type = declaration.dotDotDotToken ? anyArrayType : anyType; - if (reportErrors && compilerOptions.noImplicitAny) { + if (reportErrors && noImplicitAny) { if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } @@ -22120,56 +24005,38 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 ? root.parent : root; + var memberDeclaration = root.kind === 145 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.flags & 134217728) { + if (symbol.flags & 16777216) { return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 240) { + if (declaration.kind === 242) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 && declaration.kind === 286 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 290 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = void 0; - if (declaration.kind === 192 || - declaration.kind === 177 && declaration.parent.kind === 192) { - if (declaration.flags & 2097152) { - var jsdocType = ts.getJSDocType(declaration.parent); - if (jsdocType) { - return links.type = getTypeFromTypeNode(jsdocType); - } - } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? - checkExpressionCached(decl.right) : - checkExpressionCached(decl.parent.right); }); - type = getUnionType(declaredTypes, true); + if (declaration.kind === 193 || + declaration.kind === 178 && declaration.parent.kind === 193) { + type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else { type = getWidenedTypeForVariableLikeDeclaration(declaration, true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -22177,7 +24044,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151) { + if (accessor.kind === 152) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -22197,10 +24064,10 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151); - var setter = ts.getDeclarationOfKind(symbol, 152); - if (getter && getter.flags & 2097152) { - var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + var getter = ts.getDeclarationOfKind(symbol, 152); + var setter = ts.getDeclarationOfKind(symbol, 153); + if (getter && getter.flags & 65536) { + var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; } @@ -22223,7 +24090,7 @@ var ts; type = getReturnTypeFromBody(getter); } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { if (setter) { error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); } @@ -22238,8 +24105,8 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151); + if (noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 152); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -22247,6 +24114,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -22255,8 +24126,13 @@ var ts; } else { var type = createObjectType(16, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 ? - includeFalsyTypes(type, 2048) : type; + if (symbol.flags & 32) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 67108864 ? includeFalsyTypes(type, 2048) : type; + } } } return links.type; @@ -22281,12 +24157,37 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (symbolInstantiationDepth === 100) { + error(symbol.valueDeclaration, ts.Diagnostics.Generic_type_instantiation_is_excessively_deep_and_possibly_infinite); + links.type = unknownType; + } + else { + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + symbolInstantiationDepth++; + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + symbolInstantiationDepth--; + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; + } } return links.type; } + function reportCircularityError(symbol) { + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + if (noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { return getTypeOfInstantiatedSymbol(symbol); } if (symbol.flags & (3 | 4)) { @@ -22306,19 +24207,30 @@ var ts; } return unknownType; } + function isReferenceToType(type, target) { + return type !== undefined + && target !== undefined + && (getObjectFlags(type) & 4) !== 0 + && type.target === target; + } function getTargetType(type) { return getObjectFlags(type) & 4 ? type.target : type; } function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 | 4)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072) { + return ts.forEach(type.types, check); + } } } function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { - var declaration = declarations_2[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -22335,9 +24247,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 || node.kind === 197 || - node.kind === 225 || node.kind === 184 || - node.kind === 149 || node.kind === 185) { + if (node.kind === 228 || node.kind === 198 || + node.kind === 227 || node.kind === 185 || + node.kind === 150 || node.kind === 186) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -22346,15 +24258,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 || node.kind === 226 || - node.kind === 197 || node.kind === 228) { + if (node.kind === 229 || node.kind === 228 || + node.kind === 198 || node.kind === 230) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -22366,18 +24278,34 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1).length > 0) { + return true; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type); + return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); } - function getConstructorsForTypeArguments(type, typeArgumentNodes) { - var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; - return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; }); + function getConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var typeArgCount = ts.length(typeArgumentNodes); + var isJavaScript = ts.isInJavaScriptFile(location); + return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (isJavaScript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts.length(sig.typeParameters); }); } - function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { - var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); + function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location); if (typeArgumentNodes) { var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); @@ -22394,14 +24322,14 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); return type.resolvedBaseConstructorType = unknownType; } - if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { + if (!(baseConstructorType.flags & 1) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); return type.resolvedBaseConstructorType = unknownType; } @@ -22430,8 +24358,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 | 131072 | 1))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -22441,8 +24369,11 @@ var ts; areAllOuterTypeParametersApplied(originalBaseType)) { baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } + else if (baseConstructorType.flags & 1) { + baseType = baseConstructorType; + } else { - var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -22459,7 +24390,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -22483,16 +24414,20 @@ var ts; } return true; } + function isValidBaseType(type) { + return type.flags & (32768 | 16777216 | 1) && !isGenericMappedType(type) || + type.flags & 131072 && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -22516,7 +24451,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227) { + if (declaration.kind === 229) { if (declaration.flags & 64) { return false; } @@ -22549,7 +24484,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -22566,7 +24501,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285); + var declaration = ts.getDeclarationOfKind(symbol, 289); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -22577,7 +24512,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228); + declaration = ts.getDeclarationOfKind(symbol, 230); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -22585,7 +24520,7 @@ var ts; if (typeParameters) { links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -22602,14 +24537,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8 || - expr.kind === 70 && !!symbol.exports[expr.text]; + expr.kind === 70 && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 231) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -22634,10 +24569,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 231) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -22654,7 +24589,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -22675,9 +24610,6 @@ var ts; if (!links.declaredType) { var type = createType(16384); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -22690,7 +24622,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0); if (symbol.flags & (32 | 64)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -22725,19 +24656,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: + case 133: case 104: - case 137: + case 138: case 94: case 129: - case 171: + case 172: return true; - case 162: + case 163: return isIndependentType(node.elementType); - case 157: + case 158: return isIndependentTypeReference(node); } return false; @@ -22746,7 +24678,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -22762,12 +24694,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { + case 148: case 147: - case 146: return isIndependentVariableLikeDeclaration(declaration); - case 149: - case 148: case 150: + case 149: + case 151: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -22778,7 +24710,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -22786,15 +24718,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -22802,8 +24734,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } @@ -22811,7 +24743,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -22847,10 +24786,14 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); + if (!stringIndexInfo) { + stringIndexInfo = instantiatedBaseType === anyType ? + createIndexInfo(anyType, false) : + getIndexInfoOfType(instantiatedBaseType, 0); + } numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1); } } @@ -22889,14 +24832,16 @@ var ts; return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); + var isJavaScript = ts.isInJavaScriptFile(baseTypeNode); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); - var typeArgCount = typeArguments ? typeArguments.length : 0; + var typeArgCount = ts.length(typeArguments); var result = []; for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { var baseSig = baseSignatures_1[_i]; - var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; - if (typeParamCount === typeArgCount) { - var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + var minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters); + var typeParamCount = ts.length(baseSig.typeParameters); + if ((isJavaScript || typeArgCount >= minTypeArgumentCount) && typeArgCount <= typeParamCount) { + var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, baseTypeNode)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; sig.resolvedReturnType = classType; result.push(sig); @@ -22950,7 +24895,7 @@ var ts; s = cloneSignature(signature); if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) { var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), true); - s.thisParameter = createTransientSymbol(signature.thisParameter, thisType); + s.thisParameter = createSymbolWithType(signature.thisParameter, thisType); } s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -22965,8 +24910,8 @@ var ts; function getUnionIndexInfo(types, kind) { var indexTypes = []; var isAnyReadonly = false; - for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { - var type = types_1[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type = types_2[_i]; var indexInfo = getIndexInfoOfType(type, kind); if (!indexInfo) { return undefined; @@ -22992,17 +24937,44 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -23018,8 +24990,8 @@ var ts; } else if (symbol.flags & 2048) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -23027,23 +24999,27 @@ var ts; else { var members = emptySymbols; var constructSignatures = emptyArray; - if (symbol.flags & 1952) { + var stringIndexInfo = undefined; + if (symbol.exports) { members = getExportsOfSymbol(symbol); } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072 | 540672)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); + } + else if (baseConstructorType === anyType) { + stringIndexInfo = createIndexInfo(anyType, false); } } var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; - setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, constructSignatures, stringIndexInfo, numberIndexInfo); if (symbol.flags & (16 | 8192)) { type.callSignatures = getSignaturesOfSymbol(symbol); } @@ -23052,37 +25028,48 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 169) { + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } + if (getIndexInfoOfType(modifiersType, 0)) { + addMemberForKeyType(stringType); + } + } + else { + var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t, propertySymbol) { + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - if (t.flags & (32 | 64 | 256)) { + if (t.flags & 32) { var propName = t.text; - var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; - members[propName] = prop; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 67108864); + var prop = createSymbol(4 | (isOptional ? 67108864 : 0), propName); + prop.checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? 8 : 0; + prop.type = propType; + if (propertySymbol) { + prop.syntheticOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -23095,16 +25082,28 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 169) { + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint && constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 | 262144)); + return maybeTypeOfKind(constraintType, 540672 | 262144); } return false; } @@ -23142,35 +25141,33 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - if (type.flags & 65536) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - if (!(prop.flags & 268435456 && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + if (type.flags & 65536) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -23178,41 +25175,126 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeParameter(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); - while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeParameter(constraintType); + function getConstraintOfType(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : + type.flags & 524288 ? getConstraintOfIndexedAccess(type) : + getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getConstraintOfIndexedAccess(type) { + var baseObjectType = getBaseConstraintOfType(type.objectType); + var baseIndexType = getBaseConstraintOfType(type.indexType); + return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; + } + function getBaseConstraintOfType(type) { + if (type.flags & (540672 | 196608)) { + var constraint = getResolvedBaseConstraint(type); + if (constraint !== noConstraintType && constraint !== circularConstraintType) { + return constraint; + } + } + else if (type.flags & 262144) { + return stringType; + } + return undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type_2 = types_3[_i]; + var baseType = getBaseConstraint(type_2); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144) { + return stringType; + } + if (t.flags & 524288) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; } - return type.resolvedApparentType; } - function getApparentTypeOfIndexedAccess(type) { - return getIndexTypeOfType(getApparentType(type.objectType), 0) || type; + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); + } + function getDefaultFromTypeParameter(typeParameter) { + if (!typeParameter.default) { + if (typeParameter.target) { + var targetDefault = getDefaultFromTypeParameter(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType; + } + else { + var defaultDeclaration = typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameter(decl) && decl.default; }); + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; + } + } + return typeParameter.default === noConstraintType ? undefined : typeParameter.default; } function getApparentType(type) { - var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : - type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) : - type; - return t.flags & 262178 ? globalStringType : - t.flags & 340 ? globalNumberType : - t.flags & 136 ? globalBooleanType : - t.flags & 512 ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 ? globalStringType : + t.flags & 340 ? globalNumberType : + t.flags & 136 ? globalBooleanType : + t.flags & 512 ? getGlobalESSymbolType(languageVersion >= 2) : + t.flags & 16777216 ? emptyObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { - var types = containingType.types; var props; - var commonFlags = (containingType.flags & 131072) ? 536870912 : 0; - var isReadonly = false; - var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + var types = containingType.types; + var isUnion = containingType.flags & 65536; + var excludeModifiers = isUnion ? 24 : 0; + var commonFlags = isUnion ? 0 : 67108864; + var syntheticFlag = 4; + var checkFlags = 0; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var current = types_4[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) { + var modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; + if (prop && !(modifiers & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -23220,25 +25302,29 @@ var ts; else if (!ts.contains(props, prop)) { props.push(prop); } - if (isReadonlySymbol(prop)) { - isReadonly = true; + checkFlags |= (isReadonlySymbol(prop) ? 8 : 0) | + (!(modifiers & 24) ? 64 : 0) | + (modifiers & 16 ? 128 : 0) | + (modifiers & 8 ? 256 : 0) | + (modifiers & 32 ? 512 : 0); + if (!isMethodLike(prop)) { + syntheticFlag = 2; } } - else if (containingType.flags & 65536) { - isPartial = true; + else if (isUnion) { + checkFlags |= 16; } } } if (!props) { return undefined; } - if (props.length === 1 && !isPartial) { + if (props.length === 1 && !(checkFlags & 16)) { return props[0]; } var propTypes = []; var declarations = []; var commonType = undefined; - var hasNonUniformType = false; for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { var prop = props_1[_a]; if (prop.declarations) { @@ -23249,39 +25335,37 @@ var ts; commonType = type; } else if (type !== commonType) { - hasNonUniformType = true; + checkFlags |= 32; } propTypes.push(type); } - var result = createSymbol(4 | 67108864 | 268435456 | commonFlags, name); + var result = createSymbol(4 | commonFlags, name); + result.checkFlags = syntheticFlag | checkFlags; result.containingType = containingType; - result.hasNonUniformType = hasNonUniformType; - result.isPartial = isPartial; result.declarations = declarations; - result.isReadonly = isReadonly; - result.type = containingType.flags & 65536 ? getUnionType(propTypes) : getIntersectionType(propTypes); + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); return result; } function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; } function getPropertyOfUnionOrIntersectionType(type, name) { var property = getUnionOrIntersectionProperty(type, name); - return property && !(property.flags & 268435456 && property.isPartial) ? property : undefined; + return property && !(getCheckFlags(property) & 16) ? property : undefined; } function getPropertyOfType(type, name) { type = getApparentType(type); if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -23340,7 +25424,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -23360,16 +25444,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152) { - if (node.type && node.type.kind === 273) { + if (node.flags & 65536) { + if (node.type && node.type.kind === 277) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -23380,7 +25464,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + return paramTag.typeExpression.type.kind === 277; } } } @@ -23404,6 +25488,12 @@ var ts; ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } + var iife = ts.getImmediatelyInvokedFunctionExpression(node.parent); + if (iife) { + return !node.type && + !node.dotDotDotToken && + ts.indexOf(node.parent.parameters, node) >= iife.arguments.length; + } return false; } function createTypePredicateFromTypePredicateNode(node) { @@ -23423,16 +25513,50 @@ var ts; }; } } + function getMinTypeArgumentCount(typeParameters) { + var minTypeArgumentCount = 0; + if (typeParameters) { + for (var i = 0; i < typeParameters.length; i++) { + if (!getDefaultFromTypeParameter(typeParameters[i])) { + minTypeArgumentCount = i + 1; + } + } + } + return minTypeArgumentCount; + } + function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, location) { + var numTypeParameters = ts.length(typeParameters); + if (numTypeParameters) { + var numTypeArguments = ts.length(typeArguments); + var isJavaScript = ts.isInJavaScriptFile(location); + if ((isJavaScript || numTypeArguments >= minTypeArgumentCount) && numTypeArguments <= numTypeParameters) { + if (!typeArguments) { + typeArguments = []; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + typeArguments[i] = isJavaScript ? anyType : emptyObjectType; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + var mapper = createTypeMapper(typeParameters, typeArguments); + var defaultType = getDefaultFromTypeParameter(typeParameters[i]); + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : isJavaScript ? anyType : emptyObjectType; + } + } + } + return typeArguments; + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + var isUntypedSignatureInJSFile = !iife && !isJSConstructSignature && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration); + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { @@ -23446,41 +25570,34 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171) { + if (param.type && param.type.kind === 172) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - minArgumentCount = -1; + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param) || + isUntypedSignatureInJSFile; + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } - if ((declaration.kind === 151 || declaration.kind === 152) && + if ((declaration.kind === 152 || declaration.kind === 153) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 ? 152 : 151; + var otherKind = declaration.kind === 152 ? 153 : 152; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 ? + var classType = declaration.kind === 151 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 ? + var typePredicate = declaration.type && declaration.type.kind === 157 ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -23497,41 +25614,69 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } - if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152); + if (declaration.kind === 152 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { return anyType; } } + function containsArgumentsReference(declaration) { + var links = getNodeLinks(declaration); + if (links.containsArgumentsReference === undefined) { + if (links.flags & 8192) { + links.containsArgumentsReference = true; + } + else { + links.containsArgumentsReference = traverse(declaration.body); + } + } + return links.containsArgumentsReference; + function traverse(node) { + if (!node) + return false; + switch (node.kind) { + case 70: + return node.text === "arguments" && ts.isPartOfExpression(node); + case 148: + case 150: + case 152: + case 153: + return node.name.kind === 143 + && traverse(node.name); + default: + return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && ts.forEachChild(node, traverse); + } + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158: case 159: - case 225: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 274: + case 186: + case 278: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -23575,7 +25720,7 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { var declaration = signature.declaration; if (declaration.name) { error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); @@ -23599,9 +25744,14 @@ var ts; return anyType; } function getSignatureInstantiation(signature, typeArguments) { + typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters)); var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); @@ -23616,7 +25766,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154; + var isConstructor = signature.declaration.kind === 151 || signature.declaration.kind === 155; var type = createObjectType(16); type.members = emptySymbols; type.properties = emptyArray; @@ -23627,10 +25777,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 132 : 134; + var syntaxKind = kind === 1 ? 132 : 135; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -23657,21 +25807,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143).constraint; + return ts.getDeclarationOfKind(type.symbol, 144).constraint; } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; - } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -23679,28 +25817,23 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144).parent); } function getTypeListId(types) { var result = ""; if (types) { - var length_3 = types.length; + var length_4 = types.length; var i = 0; - while (i < length_3) { + while (i < length_4) { var startId = types[i].id; var count = 1; - while (i + count < length_3 && types[i + count].id === startId + count) { + while (i + count < length_4 && types[i + count].id === startId + count) { count++; } if (result.length) { @@ -23717,8 +25850,8 @@ var ts; } function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -23727,9 +25860,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4, target.symbol); + type = createObjectType(4, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -23745,17 +25879,22 @@ var ts; return type; } function getTypeReferenceArity(type) { - return type.target.typeParameters ? type.target.typeParameters.length : 0; + return ts.length(type.target.typeParameters); } function getTypeFromClassOrInterfaceReference(node, symbol) { var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (!ts.isInJavaScriptFile(node) && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, typeToString(type, undefined, 1), minTypeArgumentCount, typeParameters.length); return unknownType; } - return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode))); + var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, minTypeArgumentCount, node)); + return createTypeReference(type, typeArguments); } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); @@ -23768,14 +25907,22 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); + } + return instantiation; } function getTypeFromTypeAliasReference(node, symbol) { var type = getDeclaredTypeOfSymbol(symbol); var typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length); return unknownType; } var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode); @@ -23796,11 +25943,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157: + case 158: return node.typeName; - case 272: + case 276: return node.name; - case 199: + case 200: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -23824,23 +25971,58 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 272) { + if (symbol.flags & 107455 && node.kind === 276) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); } + function getPrimitiveTypeFromJSDocTypeReference(node) { + if (ts.isIdentifier(node.name)) { + switch (node.name.text) { + case "String": + return stringType; + case "Number": + return numberType; + case "Boolean": + return booleanType; + case "Void": + return voidType; + case "Undefined": + return undefinedType; + case "Null": + return nullType; + case "Object": + return anyType; + case "Function": + return anyFunctionType; + case "Array": + case "array": + return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined; + case "Promise": + case "promise": + return !node.typeArguments || !node.typeArguments.length ? createPromiseType(anyType) : undefined; + } + } + } + function getTypeFromJSDocNullableTypeNode(node) { + var type = getTypeFromTypeNode(node.type); + return strictNullChecks ? getUnionType([type, nullType]) : type; + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272) { - var typeReferenceName = getTypeReferenceName(node); - symbol = resolveTypeReferenceName(typeReferenceName); - type = getTypeReferenceType(node, symbol); + if (node.kind === 276) { + type = getPrimitiveTypeFromJSDocTypeReference(node); + if (!type) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(typeReferenceName); + type = getTypeReferenceType(node, symbol); + } } else { - var typeNameOrExpression = node.kind === 157 + var typeNameOrExpression = node.kind === 158 ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -23866,12 +26048,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { - var declaration = declarations_3[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var declaration = declarations_4[_i]; switch (declaration.kind) { - case 226: - case 227: + case 228: case 229: + case 231: return declaration; } } @@ -23884,44 +26066,91 @@ var ts; error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return arity ? emptyGenericType : emptyObjectType; } - if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + if (ts.length(type.typeParameters) !== arity) { error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); return arity ? emptyGenericType : emptyObjectType; } return type; } - function getGlobalValueSymbol(name) { - return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + function getGlobalValueSymbol(name, reportErrors) { + return getGlobalSymbol(name, 107455, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined); } - function getGlobalTypeSymbol(name) { - return getGlobalSymbol(name, 793064, ts.Diagnostics.Cannot_find_global_type_0); + function getGlobalTypeSymbol(name, reportErrors) { + return getGlobalSymbol(name, 793064, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined); } function getGlobalSymbol(name, meaning, diagnostic) { return resolveName(undefined, name, meaning, diagnostic, name); } - function getGlobalType(name, arity) { + function getGlobalType(name, arity, reportErrors) { + var symbol = getGlobalTypeSymbol(name, reportErrors); + return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : undefined; + } + function getGlobalTypedPropertyDescriptorType() { + return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", 1, true)) || emptyGenericType; + } + function getGlobalTemplateStringsArrayType() { + return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", 0, true)) || emptyObjectType; + } + function getGlobalESSymbolConstructorSymbol(reportErrors) { + return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)); + } + function getGlobalESSymbolType(reportErrors) { + return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", 0, reportErrors)) || emptyObjectType; + } + function getGlobalPromiseType(reportErrors) { + return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", 1, reportErrors)) || emptyGenericType; + } + function getGlobalPromiseConstructorSymbol(reportErrors) { + return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)); + } + function getGlobalPromiseConstructorLikeType(reportErrors) { + return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", 0, reportErrors)) || emptyObjectType; + } + function getGlobalAsyncIterableType(reportErrors) { + return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIteratorType(reportErrors) { + return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIterableIteratorType(reportErrors) { + return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableType(reportErrors) { + return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIteratorType(reportErrors) { + return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableIteratorType(reportErrors) { + return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalTypeOrUndefined(name, arity) { if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); + var symbol = getGlobalSymbol(name, 793064, undefined); + return symbol && getTypeOfGlobalSymbol(symbol, arity); } function getExportedTypeFromNamespace(namespace, name) { var namespaceSymbol = getGlobalSymbol(namespace, 1920, undefined); var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function createTypedPropertyDescriptorType(propertyType) { - var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyGenericType - ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) - : emptyObjectType; - } function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } - function createIterableType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); + function createTypedPropertyDescriptorType(propertyType) { + return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); + } + function createAsyncIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableType(true), [iteratedType]); + } + function createAsyncIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableIteratorType(true), [iteratedType]); + } + function createIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableType(true), [iteratedType]); } - function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); + function createIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(true), [iteratedType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -23939,7 +26168,7 @@ var ts; for (var i = 0; i < arity; i++) { var typeParameter = createType(16384); typeParameters.push(typeParameter); - var property = createSymbol(4 | 67108864, "" + i); + var property = createSymbol(4, "" + i); property.type = typeParameter; properties.push(property); } @@ -23948,7 +26177,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -24030,14 +26259,14 @@ var ts; } } function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -24045,8 +26274,9 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -24124,10 +26354,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144); - type = unionTypes[id] = createType(65536 | propagatedFlags); + type = createType(65536 | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -24148,13 +26379,25 @@ var ts; else if (type.flags & 1) { typeSet.containsAny = true; } + else if (getObjectFlags(type) & 16 && isEmptyObjectType(type)) { + typeSet.containsEmptyObject = true; + } else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) { - typeSet.push(type); + if (type.flags & 32768) { + typeSet.containsObjectType = true; + } + if (type.flags & 65536 && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } + if (!(type.flags & 32768 && type.objectFlags & 16 && + type.symbol && type.symbol.flags & (16 | 8192) && containsIdenticalType(typeSet, type))) { + typeSet.push(type); + } } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var type = types_9[_i]; addTypeToIntersection(typeSet, type); } } @@ -24162,30 +26405,28 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { return anyType; } + if (typeSet.containsEmptyObject && !typeSet.containsObjectType) { + typeSet.push(emptyObjectType); + } if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144); - type = intersectionTypes[id] = createType(131072 | propagatedFlags); + type = createType(131072 | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -24199,7 +26440,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144); type.resolvedIndexType.type = type; @@ -24215,7 +26456,7 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 ? getIndexTypeForTypeParameter(type) : + return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) : getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) : type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromPropertyNames(type); @@ -24238,7 +26479,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? @@ -24267,14 +26508,14 @@ var ts; getIndexInfoOfType(objectType, 0) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } return indexInfo.type; } if (accessExpression && !isConstEnumObjectType(objectType)) { - if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { if (getIndexTypeOfType(objectType, 1)) { error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); } @@ -24286,7 +26527,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -24296,34 +26537,36 @@ var ts; else { error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); } + return unknownType; } - return unknownType; + return anyType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; - return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken); + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384 || - objectType.flags & 16384 && indexType.flags & 262144 || + if (maybeTypeOfKind(indexType, 540672 | 262144) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 179) || isGenericMappedType(objectType)) { - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } + if (objectType.flags & 1) { + return objectType; } if (isGenericMappedType(objectType)) { return getIndexedAccessForMappedType(objectType, indexType, accessNode); } var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { @@ -24363,7 +26606,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -24376,17 +26619,33 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } - function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 | 1)) && !!(right.flags & (32768 | 1)), "Only object types may be spread."); + function getSpreadType(left, right) { if (left.flags & 1 || right.flags & 1) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144); }); + if (left.flags & 8192) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144); }); + if (right.flags & 8192) { + return left; + } + if (left.flags & 65536) { + return mapType(left, function (t) { return getSpreadType(t, right); }); + } + if (right.flags & 65536) { + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216) { + return emptyObjectType; + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -24401,42 +26660,55 @@ var ts; } for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; - var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, getNonReadonlySymbol(rightProp)); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 && !(leftProp.flags & 32768) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); - if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) { + if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 67108864) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); - var flags = 4 | 67108864 | (leftProp.flags & 536870912); + var flags = 4 | (leftProp.flags & 67108864); var result = createSymbol(flags, leftProp.name); result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072)]); result.leftSpread = leftProp; result.rightSpread = rightProp; result.declarations = declarations; - result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, getNonReadonlySymbol(leftProp)); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function getNonReadonlySymbol(prop) { + if (!isReadonlySymbol(prop)) { + return prop; + } + var flags = 4 | (prop.flags & 67108864); + var result = createSymbol(flags, prop.name); + result.type = getTypeOfSymbol(prop); + result.declarations = prop.declarations; + result.syntheticOrigin = prop; + return result; + } + function isClassMethod(prop) { + return prop.flags & 8192 && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -24458,7 +26730,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -24486,9 +26762,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229)) { if (!(ts.getModifierFlags(container) & 32) && - (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -24505,85 +26781,82 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 263: - case 264: + case 267: + case 268: return anyType; - case 134: + case 135: return stringType; case 132: return numberType; case 121: return booleanType; - case 135: + case 136: return esSymbolType; case 104: return voidType; - case 137: + case 138: return undefinedType; case 94: return nullType; case 129: return neverType; - case 289: - return nullType; - case 290: - return undefinedType; - case 291: - return neverType; - case 167: + case 133: + return nonPrimitiveType; + case 168: case 98: return getTypeFromThisTypeNode(node); - case 171: + case 172: return getTypeFromLiteralTypeNode(node); - case 288: + case 292: return getTypeFromLiteralTypeNode(node.literal); - case 157: - case 272: + case 158: + case 276: return getTypeFromTypeReference(node); - case 156: + case 157: return booleanType; - case 199: + case 200: return getTypeFromTypeReference(node); - case 160: + case 161: return getTypeFromTypeQueryNode(node); - case 162: - case 265: - return getTypeFromArrayTypeNode(node); case 163: - return getTypeFromTupleTypeNode(node); + case 269: + return getTypeFromArrayTypeNode(node); case 164: - case 266: - return getTypeFromUnionTypeNode(node); + return getTypeFromTupleTypeNode(node); case 165: - return getTypeFromIntersectionTypeNode(node); + case 270: + return getTypeFromUnionTypeNode(node); case 166: - case 268: - case 269: - case 276: - case 277: + return getTypeFromIntersectionTypeNode(node); + case 272: + return getTypeFromJSDocNullableTypeNode(node); + case 167: case 273: + case 280: + case 281: + case 277: return getTypeFromTypeNode(node.type); - case 270: + case 274: return getTypeFromTypeNode(node.literal); - case 158: case 159: - case 161: - case 287: - case 274: + case 160: + case 162: + case 291: + case 278: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168: - return getTypeFromTypeOperatorNode(node); case 169: - return getTypeFromIndexedAccessTypeNode(node); + return getTypeFromTypeOperatorNode(node); case 170: + return getTypeFromIndexedAccessTypeNode(node); + case 171: return getTypeFromMappedTypeNode(node); case 70: - case 141: + case 142: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267: + case 271: return getTypeFromJSDocTupleType(node); - case 275: + case 279: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -24610,13 +26883,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -24627,16 +26900,20 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } function createTypeEraser(sources) { return createTypeMapper(sources, undefined); } + function createBackreferenceMapper(typeParameters, index) { + var mapper = function (t) { return ts.indexOf(typeParameters, t) >= index ? emptyObjectType : t; }; + mapper.mappedTypes = typeParameters; + return mapper; + } function getInferenceMapper(context) { if (!context.mapper) { var mapper = function (t) { @@ -24660,7 +26937,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -24705,12 +26987,13 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { var links = getSymbolLinks(symbol); symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); + result.checkFlags = 1; result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -24731,18 +27014,17 @@ var ts; function instantiateMappedType(type, mapper) { var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144) { - var typeParameter_1 = constraintType.type; - var mappedTypeParameter = mapper(typeParameter_1); - if (typeParameter_1 !== mappedTypeParameter) { - return mapType(mappedTypeParameter, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeParameter_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + var typeVariable_1 = constraintType.type; + if (typeVariable_1.flags & 16384) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -24763,26 +27045,28 @@ var ts; return false; } var mappedTypes = mapper.mappedTypes; - var node = symbol.declarations[0].parent; - while (node) { + return !!ts.findAncestor(symbol.declarations[0], function (node) { + if (node.kind === 232 || node.kind === 264) { + return "quit"; + } switch (node.kind) { - case 158: case 159: - case 225: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 226: - case 197: - case 227: + case 186: case 228: + case 198: + case 229: + case 230: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -24792,25 +27076,34 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227) { + if (ts.isClassLike(node) || node.kind === 229) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230: - case 261: - return false; + case 171: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 278: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; } - node = node.parent; - } - return false; + }); } function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 || parentKind === 231; + return parentKind === 264 || parentKind === 233; } return false; } @@ -24862,28 +27155,34 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184: case 185: + case 186: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return ts.forEach(node.properties, isContextSensitive); - case 175: + case 176: return ts.forEach(node.elements, isContextSensitive); - case 193: + case 194: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192: + case 193: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257: + case 260: return isContextSensitive(node.initializer); + case 150: case 149: - case 148: return isContextSensitiveFunctionLikeDeclaration(node); - case 183: + case 184: return isContextSensitive(node.expression); + case 253: + return ts.forEach(node.properties, isContextSensitive); + case 252: + return node.initializer && isContextSensitive(node.initializer); + case 255: + return node.expression && isContextSensitive(node.expression); } return false; } @@ -24894,7 +27193,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !p.type; })) { return true; } - if (node.kind === 185) { + if (node.kind === 186) { return false; } var parameter = ts.firstOrUndefined(node.parameters); @@ -24912,9 +27211,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } function isTypeIdenticalTo(source, target) { @@ -24933,7 +27235,7 @@ var ts; return isTypeRelatedTo(source, target, assignableRelation); } function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -24951,9 +27253,9 @@ var ts; return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { - return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; + return compareSignaturesRelated(source, target, false, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; } - function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + function compareSignaturesRelated(source, target, checkAsCallback, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { if (source === target) { return -1; } @@ -24984,9 +27286,15 @@ var ts; var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); + var sourceType = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var targetType = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var sourceSig = getSingleCallSignature(getNonNullableType(sourceType)); + var targetSig = getSingleCallSignature(getNonNullableType(targetType)); + var callbacks = sourceSig && targetSig && !sourceSig.typePredicate && !targetSig.typePredicate && + (getFalsyFlags(sourceType) & 6144) === (getFalsyFlags(targetType) & 6144); + var related = callbacks ? + compareSignaturesRelated(targetSig, sourceSig, true, false, reportErrors, errorReporter, compareTypes) : + !checkAsCallback && compareTypes(sourceType, targetType, false) || compareTypes(targetType, sourceType, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -25013,7 +27321,8 @@ var ts; } } else { - result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + result &= checkAsCallback && compareTypes(targetReturnType, sourceReturnType, false) || + compareTypes(sourceReturnType, targetReturnType, reportErrors); } } return result; @@ -25076,18 +27385,33 @@ var ts; sourceNonRestParamCount; } } + function isEmptyResolvedType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } + function isEmptyObjectType(type) { + return type.flags & 32768 ? isEmptyResolvedType(resolveStructuredTypeMembers(type)) : + type.flags & 65536 ? ts.forEach(type.types, isEmptyObjectType) : + type.flags & 131072 ? !ts.forEach(type.types, function (t) { return !isEmptyObjectType(t); }) : + false; + } function isEnumTypeRelatedTo(source, target, errorReporter) { if (source === target) { return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256) || (source.flags & 65536) !== (target.flags & 65536)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -25098,11 +27422,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192) @@ -25123,6 +27449,8 @@ var ts; return true; if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096)) return true; + if (source.flags & 32768 && target.flags & 16777216) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1) return true; @@ -25154,13 +27482,13 @@ var ts; } if (source.flags & 32768 && target.flags & 32768) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1; } } - if (source.flags & 507904 || target.flags & 507904) { - return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); + if (source.flags & 1032192 || target.flags & 1032192) { + return checkTypeRelatedTo(source, target, relation, undefined); } return false; } @@ -25214,10 +27542,27 @@ var ts; if ((globalStringType === source && stringType === target) || (globalNumberType === source && numberType === target) || (globalBooleanType === source && booleanType === target) || - (getGlobalESSymbolType() === source && esSymbolType === target)) { + (getGlobalESSymbolType(false) === source && esSymbolType === target)) { reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608)) { + return false; + } + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 && source.flags & 1048576) { @@ -25240,7 +27585,7 @@ var ts; } return 0; } - if (target.flags & 196608) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -25256,91 +27601,24 @@ var ts; return result; } } - else if (target.flags & 65536) { - if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) { - return result; - } - } - else if (target.flags & 131072) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { - return result; - } - } - else if (source.flags & 131072) { - if (result = someTypeRelatedToType(source, target, false)) { - return result; - } - } - if (target.flags & 16384) { - if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { - if (!source.declaration.questionToken) { - var templateType = getTemplateTypeFromMappedType(source); - var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); - if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { - return result; - } - } - } - else { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } - } - else if (target.flags & 262144) { - if (source.flags & 262144) { - if (result = isRelatedTo(target.type, source.type, false)) { - return result; - } - } - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } - } - } - else if (target.flags & 524288) { - if (source.flags & 524288 && source.indexType === target.indexType) { - if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { - return result; - } - } - } - if (source.flags & 16384) { - if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { - var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); - var templateType = getTemplateTypeFromMappedType(target); - if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + else { + if (target.flags & 65536) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) { return result; } } - else { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; - } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; + else if (target.flags & 131072) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - } - else { - if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { - if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + else if (source.flags & 131072) { + if (result = someTypeRelatedToType(source, target, false)) { return result; } } - var apparentSource = getApparentType(source); - if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + if (source.flags & 1032192 || target.flags & 1032192) { + if (result = recursiveTypeRelatedTo(source, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -25360,12 +27638,7 @@ var ts; function isIdenticalTo(source, target) { var result; if (source.flags & 32768 && target.flags & 32768) { - if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { - if (result = typeArgumentsRelatedTo(source, target, false)) { - return result; - } - } - return objectTypeRelatedTo(source, source, target, false); + return recursiveTypeRelatedTo(source, target, false); } if (source.flags & 65536 && target.flags & 65536 || source.flags & 131072 && target.flags & 131072) { @@ -25377,42 +27650,43 @@ var ts; } return 0; } - function isKnownProperty(type, name) { + function isKnownProperty(type, name, isComparingJsxAttributes) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || - resolved.stringIndexInfo || - (resolved.numberIndexInfo && isNumericLiteralName(name)) || - getPropertyOfType(type, name)) { + if (resolved.stringIndexInfo || resolved.numberIndexInfo && isNumericLiteralName(name) || + getPropertyOfType(type, name) || isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) { return true; } } else if (type.flags & 196608) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; - if (isKnownProperty(t, name)) { + if (isKnownProperty(t, name, isComparingJsxAttributes)) { return true; } } } return false; } - function isEmptyObjectType(t) { - return t.properties.length === 0 && - t.callSignatures.length === 0 && - t.constructSignatures.length === 0 && - !t.stringIndexInfo && - !t.numberIndexInfo; - } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) { + var isComparingJsxAttributes = !!(source.flags & 33554432); + if ((relation === assignableRelation || relation === comparableRelation) && + (isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) { + return false; + } for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (!isKnownProperty(target, prop.name)) { + if (!isKnownProperty(target, prop.name, isComparingJsxAttributes)) { if (reportErrors) { ts.Debug.assert(!!errorNode); - errorNode = prop.valueDeclaration; - reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + if (ts.isJsxAttributes(errorNode)) { + reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target)); + } + else { + errorNode = prop.valueDeclaration; + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } } return true; } @@ -25438,20 +27712,42 @@ var ts; if (target.flags & 65536 && containsType(targetTypes, source)) { return -1; } - var len = targetTypes.length; - for (var i = 0; i < len; i++) { - var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var type = targetTypes_1[_i]; + var related = isRelatedTo(source, type, false); if (related) { return related; } } + if (reportErrors) { + var discriminantType = findMatchingDiscriminantType(source, target); + isRelatedTo(source, discriminantType || targetTypes[targetTypes.length - 1], true); + } return 0; } + function findMatchingDiscriminantType(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + if (sourceProperties) { + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProperty = sourceProperties_1[_i]; + if (isDiscriminantProperty(target, sourceProperty.name)) { + var sourceType = getTypeOfSymbol(sourceProperty); + for (var _a = 0, _b = target.types; _a < _b.length; _a++) { + var type = _b[_a]; + var targetType = getTypeOfPropertyOfType(type, sourceProperty.name); + if (targetType && isRelatedTo(sourceType, targetType)) { + return type; + } + } + } + } + } + } function typeRelatedToEachType(source, target, reportErrors) { var result = -1; var targetTypes = target.types; - for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { - var targetType = targetTypes_1[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var targetType = targetTypes_2[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0; @@ -25504,15 +27800,15 @@ var ts; } return result; } - function objectTypeRelatedTo(source, originalSource, target, reportErrors) { + function recursiveTypeRelatedTo(source, target, reportErrors) { if (overflow) { return 0; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2) { - relation[id] = 3; + relation.set(id, 3); } else { return related === 1 ? -1 : 0; @@ -25520,7 +27816,7 @@ var ts; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1; } } @@ -25538,71 +27834,165 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1; + maybeStack[depth].set(id, 1); depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth)) expandingFlags |= 1; - if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) + if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, depth)) expandingFlags |= 2; + var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors) : 1; + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + ts.copyEntries(maybeCache, destinationCache); + } + else { + relation.set(id, reportErrors ? 3 : 2); + } + return result; + } + function structuredTypeRelatedTo(source, target, reportErrors) { var result; - if (expandingFlags === 3) { - result = 1; + var saveErrorInfo = errorInfo; + if (target.flags & 16384) { + if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } + } + else if (target.flags & 262144) { + if (source.flags & 262144) { + if (result = isRelatedTo(target.type, source.type, false)) { + return result; + } + } + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } } - else if (isGenericMappedType(source) || isGenericMappedType(target)) { - result = mappedTypeRelatedTo(source, target, reportErrors); + else if (target.flags & 524288) { + var constraint = getConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + if (source.flags & 16384) { + if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else { + var constraint = getConstraintOfTypeParameter(source); + if (constraint || !(target.flags & 16777216)) { + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + } + else if (source.flags & 524288) { + var constraint = getConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else if (target.flags & 524288 && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } } else { - result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + return result; + } + } + var sourceIsPrimitive = !!(source.flags & 8190); + if (relation !== identityRelation) { + source = getApparentType(source); + } + if (source.flags & (32768 | 131072) && target.flags & 32768) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; + if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportStructuralErrors); + } + else { + result = propertiesRelatedTo(source, target, reportStructuralErrors); if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors); + result &= signaturesRelatedTo(source, target, 0, reportStructuralErrors); if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors); + result &= signaturesRelatedTo(source, target, 1, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 0, sourceIsPrimitive, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 1, sourceIsPrimitive, reportStructuralErrors); + } + } } } } + if (result) { + errorInfo = saveErrorInfo; + return result; + } } } - expandingFlags = saveExpandingFlags; - depth--; - if (result) { - var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); - } - else { - relation[id] = reportErrors ? 3 : 2; - } - return result; + return 0; } function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1; + } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + return -1; + } } return 0; } @@ -25613,22 +28003,28 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128); - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var targetProp = properties_3[_i]; + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var targetProp = properties_4[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (!(targetProp.flags & 536870912) || requireOptionalProperties) { + if (!(targetProp.flags & 67108864) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } return 0; } } - else if (!(targetProp.flags & 134217728)) { + else if (!(targetProp.flags & 16777216)) { var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & 8 || targetPropFlags & 8) { + if (getCheckFlags(sourceProp) & 256) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); + } + return 0; + } if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { if (sourcePropFlags & 8 && targetPropFlags & 8) { @@ -25642,12 +28038,9 @@ var ts; } } else if (targetPropFlags & 16) { - var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; - var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); - if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (!isValidOverrideOf(sourceProp, targetProp)) { if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)); } return 0; } @@ -25666,7 +28059,7 @@ var ts; return 0; } result &= related; - if (relation !== comparableRelation && sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { + if (relation !== comparableRelation && sourceProp.flags & 67108864 && !(targetProp.flags & 67108864)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -25687,8 +28080,8 @@ var ts; return 0; } var result = -1; - for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { - var sourceProp = sourceProperties_1[_i]; + for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { + var sourceProp = sourceProperties_2[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -25744,7 +28137,7 @@ var ts; return result; } function signatureRelatedTo(source, target, reportErrors) { - return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo); + return compareSignaturesRelated(source, target, false, false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -25753,7 +28146,7 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; @@ -25786,12 +28179,12 @@ var ts; } return related; } - function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + function indexTypesRelatedTo(source, target, kind, sourceIsPrimitive, reportErrors) { if (relation === identityRelation) { return indexTypesIdenticalTo(source, target, kind); } var targetInfo = getIndexInfoOfType(target, kind); - if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 8190))) { + if (!targetInfo || targetInfo.type.flags & 1 && !sourceIsPrimitive) { return -1; } var sourceInfo = getIndexInfoOfType(source, kind) || @@ -25849,6 +28242,37 @@ var ts; return false; } } + function forEachProperty(prop, callback) { + if (getCheckFlags(prop) & 6) { + for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { + var t = _a[_i]; + var p = getPropertyOfType(t, prop.name); + var result = p && forEachProperty(p, callback); + if (result) { + return result; + } + } + return undefined; + } + return callback(prop); + } + function getDeclaringClass(prop) { + return prop.parent && prop.parent.flags & 32 ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : undefined; + } + function isPropertyInClassDerivedFrom(prop, baseClass) { + return forEachProperty(prop, function (sp) { + var sourceClass = getDeclaringClass(sp); + return sourceClass ? hasBaseType(sourceClass, baseClass) : false; + }); + } + function isValidOverrideOf(sourceProp, targetProp) { + return !forEachProperty(targetProp, function (tp) { return getDeclarationModifierFlagsFromSymbol(tp) & 16 ? + !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; }); + } + function isClassDerivedFromDeclaringClasses(checkClass, prop) { + return forEachProperty(prop, function (p) { return getDeclarationModifierFlagsFromSymbol(p) & 16 ? + !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass; + } function isAbstractConstructorType(type) { if (getObjectFlags(type) & 16) { var symbol = type.symbol; @@ -25861,16 +28285,18 @@ var ts; } return false; } - function isDeeplyNestedGeneric(type, stack, depth) { - if (getObjectFlags(type) & (4 | 64) && depth >= 5) { + function isDeeplyNestedType(type, stack, depth) { + if (depth >= 5 && type.flags & 32768) { var symbol = type.symbol; - var count = 0; - for (var i = 0; i < depth; i++) { - var t = stack[i]; - if (getObjectFlags(t) & (4 | 64) && t.symbol === symbol) { - count++; - if (count >= 5) - return true; + if (symbol) { + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 32768 && t.symbol === symbol) { + count++; + if (count >= 5) + return true; + } } } } @@ -25894,7 +28320,7 @@ var ts; } } else { - if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) { + if ((sourceProp.flags & 67108864) !== (targetProp.flags & 67108864)) { return 0; } } @@ -25924,7 +28350,7 @@ var ts; if (!(isMatchingSignature(source, target, partialMatch))) { return 0; } - if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { + if (ts.length(source.typeParameters) !== ts.length(target.typeParameters)) { return 0; } source = getErasedSignature(source); @@ -25962,8 +28388,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -25971,8 +28397,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -26063,8 +28489,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getFalsyFlags(t); } return result; @@ -26093,7 +28519,7 @@ var ts; types.push(undefinedType); if (flags & 4096) types.push(nullType); - return getUnionType(types, true); + return getUnionType(types); } function removeDefinitelyFalsyTypes(type) { return getFalsyFlags(type) & 7392 ? @@ -26108,8 +28534,8 @@ var ts; getSignaturesOfType(type, 0).length === 0 && getSignaturesOfType(type, 1).length === 0; } - function createTransientSymbol(source, type) { - var symbol = createSymbol(source.flags | 67108864, source.name); + function createSymbolWithType(source, type) { + var symbol = createSymbol(source.flags, source.name); symbol.declarations = source.declarations; symbol.parent = source.parent; symbol.type = type; @@ -26125,9 +28551,8 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createSymbolWithType(property, updated)); } - ; return members; } function getRegularTypeOfObjectLiteral(type) { @@ -26146,11 +28571,17 @@ var ts; type.regularType = regularNew; return regularNew; } + function getWidenedProperty(prop) { + var original = getTypeOfSymbol(prop); + var widened = getWidenedType(original); + return widened === original ? prop : createSymbolWithType(prop, widened); + } function getWidenedTypeOfObjectLiteral(type) { - var members = transformTypeOfMembers(type, function (prop) { - var widened = getWidenedType(prop); - return prop === widened ? prop : widened; - }); + var members = ts.createMap(); + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + members.set(prop.name, prop.flags & 4 ? getWidenedProperty(prop) : prop); + } var stringIndexInfo = getIndexInfoOfType(type, 0); var numberIndexInfo = getIndexInfoOfType(type, 1); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); @@ -26211,25 +28642,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 148: case 147: - case 146: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144: + case 145: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174: + case 175: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 184: + case 153: case 185: + case 186: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -26242,7 +28673,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) { + if (produceDiagnostics && noImplicitAny && type.flags & 2097152) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -26268,13 +28699,14 @@ var ts; callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } - function createInferenceContext(signature, inferUnionTypes) { + function createInferenceContext(signature, inferUnionTypes, useAnyForNoInferences) { var inferences = ts.map(signature.typeParameters, createTypeInferencesObject); return { signature: signature, inferUnionTypes: inferUnionTypes, inferences: inferences, inferredTypes: new Array(signature.typeParameters.length), + useAnyForNoInferences: useAnyForNoInferences }; } function createTypeInferencesObject() { @@ -26285,25 +28717,69 @@ var ts; isFixed: false, }; } - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 || - objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 || + objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) || objectFlags & 32 || - type.flags & 196608 && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 67108864; + var members = createSymbolTable(properties); + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var prop = properties_5[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.name); + inferredProp.checkFlags = readonlyMask && isReadonlySymbol(prop) ? 8 : 0; + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + members.set(prop.name, inferredProp); + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -26319,7 +28795,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -26358,13 +28834,13 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384) { + if (target.flags & 540672) { if (source.flags & 8388608) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : @@ -26372,7 +28848,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -26390,21 +28866,21 @@ var ts; } else if (target.flags & 196608) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { - var t = targetTypes_2[_d]; - if (t.flags & 16384 && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + var typeVariableCount = 0; + var typeVariable = void 0; + for (var _d = 0, targetTypes_3 = targetTypes; _d < targetTypes_3.length; _d++) { + var t = targetTypes_3[_d]; + if (t.flags & 540672 && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -26421,14 +28897,14 @@ var ts; if (isInProcess(source, target)) { return; } - if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { + if (isDeeplyNestedType(source, sourceStack, depth) && isDeeplyNestedType(target, targetStack, depth)) { return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -26444,9 +28920,16 @@ var ts; function inferFromObjectTypes(source, target) { if (getObjectFlags(target) & 32) { var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); + if (constraintType.flags & 262144) { + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } return; } if (constraintType.flags & 16384) { @@ -26462,8 +28945,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var targetProp = properties_6[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -26513,8 +28996,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -26555,7 +29038,13 @@ var ts; inferenceSucceeded = !!unionOrSuperType; } else { - inferredType = emptyObjectType; + var defaultType = getDefaultFromTypeParameter(context.signature.typeParameters[index]); + if (defaultType) { + inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context.signature.typeParameters, index), getInferenceMapper(context))); + } + else { + inferredType = context.useAnyForNoInferences ? anyType : emptyObjectType; + } inferenceSucceeded = true; } context.inferredTypes[index] = inferredType; @@ -26588,19 +29077,7 @@ var ts; return links.resolvedSymbol; } function isInTypeQuery(node) { - while (node) { - switch (node.kind) { - case 160: - return true; - case 70: - case 141: - node = node.parent; - continue; - default: - return false; - } - } - ts.Debug.fail("should not get here"); + return !!ts.findAncestor(node, function (n) { return n.kind === 161 ? true : n.kind === 70 || n.kind === 142 ? false : "quit"; }); } function getFlowCacheKey(node) { if (node.kind === 70) { @@ -26610,7 +29087,7 @@ var ts; if (node.kind === 98) { return "0"; } - if (node.kind === 177) { + if (node.kind === 178) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -26621,7 +29098,7 @@ var ts; case 70: case 98: return node; - case 177: + case 178: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -26630,19 +29107,21 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 || target.kind === 174) && + (target.kind === 225 || target.kind === 175) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; - case 177: - return target.kind === 177 && + case 96: + return target.kind === 96; + case 178: + return target.kind === 178 && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177) { + while (source.kind === 178) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -26651,7 +29130,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 && + return target.kind === 178 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -26659,7 +29138,7 @@ var ts; if (expr.kind === 70) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177) { + if (expr.kind === 178) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -26668,9 +29147,9 @@ var ts; function isDiscriminantProperty(type, name) { if (type && type.flags & 65536) { var prop = getUnionOrIntersectionProperty(type, name); - if (prop && prop.flags & 268435456) { + if (prop && getCheckFlags(prop) & 2) { if (prop.isDiscriminantProperty === undefined) { - prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop)); + prop.isDiscriminantProperty = prop.checkFlags & 32 && isLiteralType(getTypeOfSymbol(prop)); } return prop.isDiscriminantProperty; } @@ -26689,7 +29168,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 && + if (callExpression.expression.kind === 178 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -26728,8 +29207,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; result |= getTypeFacts(t); } return result; @@ -26737,7 +29216,7 @@ var ts; function isFunctionObjectType(type) { var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -26780,9 +29259,11 @@ var ts; if (flags & 512) { return strictNullChecks ? 1981320 : 4193160; } - if (flags & 16384) { - var constraint = getConstraintOfTypeParameter(type); - return getTypeFacts(constraint || emptyObjectType); + if (flags & 16777216) { + return strictNullChecks ? 6166480 : 8378320; + } + if (flags & 540672) { + return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType); } if (flags & 196608) { return getTypeFactsOfTypes(type.types); @@ -26808,17 +29289,23 @@ var ts; } function getTypeOfDestructuredArrayElement(type, index) { return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || - checkIteratedTypeOrElementType(type, undefined, false) || + checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType; } function getTypeOfDestructuredSpreadExpression(type) { - return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); + return createArrayType(checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 257 ? + var isDestructuringDefaultAssignment = node.parent.kind === 176 && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 260 && isDestructuringAssignmentTarget(node.parent.parent); + return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } + function isDestructuringAssignmentTarget(parent) { + return parent.parent.kind === 193 && parent.parent.left === parent || + parent.parent.kind === 215 && parent.parent.initializer === parent; + } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); } @@ -26834,21 +29321,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212: + case 214: return stringType; - case 213: - return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192: + case 215: + return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; + case 193: return getAssignedTypeOfBinaryExpression(parent); - case 186: + case 187: return undefinedType; - case 175: + case 176: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196: + case 197: return getAssignedTypeOfSpreadExpression(parent); - case 257: + case 260: return getAssignedTypeOfPropertyAssignment(parent); - case 258: + case 261: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -26856,7 +29343,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 ? + var type = pattern.kind === 173 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -26871,35 +29358,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 214) { return stringType; } - if (node.parent.parent.kind === 213) { - return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + if (node.parent.parent.kind === 215) { + return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 ? + return node.kind === 225 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 || node.kind === 174 ? + return node.kind === 225 || node.kind === 175 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 && node.initializer && + return node.kind === 225 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 && node.parent.kind === 192 && + node.kind !== 175 && node.parent.kind === 193 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183: + case 184: return getReferenceCandidate(node.expression); - case 192: + case 193: switch (node.operatorToken.kind) { case 57: return getReferenceCandidate(node.left); @@ -26911,13 +29398,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 || - parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node || - parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ? + return parent.kind === 184 || + parent.kind === 193 && parent.operatorToken.kind === 57 && parent.left === node || + parent.kind === 193 && parent.operatorToken.kind === 25 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253) { + if (clause.kind === 256) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -26963,8 +29450,29 @@ var ts; } return f(type) ? type : neverType; } - function mapType(type, f) { - return type.flags & 65536 ? getUnionType(ts.map(type.types, f)) : f(type); + function mapType(type, mapper) { + if (!(type.flags & 65536)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; + var t = mapper(current); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; } function extractTypesOfKind(type, kind) { return filterType(type, function (t) { return (t.flags & kind) !== 0; }); @@ -26998,7 +29506,7 @@ var ts; return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); } function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); + var elementType = getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -27019,8 +29527,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -27038,11 +29546,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === "length" || - parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 && + var isLengthPushOrUnshift = parent.kind === 178 && (parent.name.text === "length" || + parent.parent.kind === 180 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 && parent.expression === root && - parent.parent.kind === 192 && + parent.parent.kind === 193 && parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -27069,19 +29577,17 @@ var ts; } return false; } - function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { + function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) { + if (initialType === void 0) { initialType = declaredType; } var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) { + if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & 17810431)) { return declaredType; } - var initialType = assumeInitialized ? declaredType : - declaredType === autoType || declaredType === autoArrayType ? undefinedType : - includeFalsyTypes(declaredType, 2048); var visitedFlowStart = visitedFlowCount; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) { + if (reference.parent.kind === 202 && getTypeWithFacts(resultType, 524288).flags & 8192) { return declaredType; } return resultType; @@ -27095,7 +29601,16 @@ var ts; } } var type = void 0; - if (flow.flags & 16) { + if (flow.flags & 4096) { + flow.locked = true; + type = getTypeAtFlowNode(flow.antecedent); + flow.locked = false; + } + else if (flow.flags & 2048) { + flow = flow.antecedent; + continue; + } + else if (flow.flags & 16) { type = getTypeAtFlowAssignment(flow); if (!type) { flow = flow.antecedent; @@ -27126,7 +29641,7 @@ var ts; } else if (flow.flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177) { + if (container && container !== flowContainer && reference.kind !== 178 && reference.kind !== 98) { flow = container.flowNode; continue; } @@ -27169,7 +29684,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 ? + var expr = node.kind === 180 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -27177,7 +29692,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 179) { + if (node.kind === 180) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -27229,6 +29744,9 @@ var ts; var seenIncomplete = false; for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { var antecedent = _a[_i]; + if (antecedent.flags & 2048 && antecedent.lock.locked) { + continue; + } var flowType = getTypeAtFlowNode(antecedent); var type = getTypeFromFlowType(flowType); if (type === declaredType && declaredType === initialType) { @@ -27252,8 +29770,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } for (var i = flowLoopStart; i < flowLoopCount; i++) { if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) { @@ -27275,8 +29794,9 @@ var ts; firstAntecedentType = flowType; } var type = getTypeFromFlowType(flowType); - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -27292,10 +29812,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 && + return expr.kind === 178 && declaredType.flags & 65536 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -27329,10 +29850,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 && right_1.kind === 9) { + if (left_1.kind === 188 && right_1.kind === 9) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 && left_1.kind === 9) { + if (right_1.kind === 188 && left_1.kind === 9) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -27378,7 +29899,7 @@ var ts; assumeTrue ? 16384 : 131072; return getTypeWithFacts(type, facts); } - if (type.flags & 33281) { + if (type.flags & 16810497) { return type; } if (assumeTrue) { @@ -27403,14 +29924,22 @@ var ts; assumeTrue = !assumeTrue; } if (assumeTrue && !(type.flags & 65536)) { - var targetType = typeofTypesByName[literal.text]; - if (targetType && isTypeSubtypeOf(targetType, type)) { - return targetType; + var targetType = typeofTypesByName.get(literal.text); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type) || anyType; + if (isTypeSubtypeOf(targetType, constraint)) { + return getIntersectionType([type, targetType]); + } + } } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 : - typeofNEFacts[literal.text] || 8192; + typeofEQFacts.get(literal.text) || 64 : + typeofNEFacts.get(literal.text) || 8192; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -27479,10 +30008,9 @@ var ts; return assignableType; } } - var targetType = type.flags & 16384 ? getApparentType(type) : type; return isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : - isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); } function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { @@ -27510,7 +30038,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 || invokedExpression.kind === 177) { + if (invokedExpression.kind === 179 || invokedExpression.kind === 178) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -27527,15 +30055,16 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 96: + case 178: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179: + case 180: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183: + case 184: return narrowType(type, expr.expression, assumeTrue); - case 192: + case 193: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190: + case 191: if (expr.operator === 50) { return narrowType(type, expr.operand, !assumeTrue); } @@ -27559,15 +30088,12 @@ var ts; return getTypeOfSymbol(symbol); } function getControlFlowContainer(node) { - while (true) { - node = node.parent; - if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 || - node.kind === 261 || - node.kind === 147) { - return node; - } - } + return ts.findAncestor(node.parent, function (node) { + return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || + node.kind === 233 || + node.kind === 264 || + node.kind === 148; + }); } function isParameterAssigned(symbol) { var func = ts.getRootDeclaration(symbol.valueDeclaration).parent; @@ -27581,21 +30107,13 @@ var ts; return symbol.isAssigned || false; } function hasParentWithAssignmentsMarked(node) { - while (true) { - node = node.parent; - if (!node) { - return false; - } - if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304) { - return true; - } - } + return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 4194304); }); } function markParameterAssignments(node) { if (node.kind === 70) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145) { symbol.isAssigned = true; } } @@ -27607,6 +30125,14 @@ var ts; function isConstVariable(symbol) { return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType; } + function removeOptionalityFromDeclaredType(declaredType, declaration) { + var annotationIncludesUndefined = strictNullChecks && + declaration.kind === 145 && + declaration.initializer && + getFalsyFlags(declaredType) & 2048 && + !(getFalsyFlags(checkExpression(declaration.initializer)) & 2048); + return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 131072) : declaredType; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === unknownSymbol) { @@ -27615,16 +30141,14 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 185) { + if (container.kind === 186) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288) { - getNodeLinks(container).flags |= 8192; - } + getNodeLinks(container).flags |= 8192; return getTypeOfSymbol(symbol); } if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -27633,7 +30157,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 226 + if (declaration_1.kind === 228 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -27645,11 +30169,11 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197) { + else if (declaration_1.kind === 198) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 && ts.hasModifier(container, 32)) { + if (container.kind === 148 && ts.hasModifier(container, 32)) { getNodeLinks(declaration_1).flags |= 8388608; getNodeLinks(node).flags |= 16777216; } @@ -27661,6 +30185,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -27678,22 +30203,25 @@ var ts; if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) { return type; } - var isParameter = ts.getRootDeclaration(declaration).kind === 144; + var isParameter = ts.getRootDeclaration(declaration).kind === 145; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 || - flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 || + flowContainer.kind === 186 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); - var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); + var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, ts.getRootDeclaration(declaration)) : type) : + type === autoType || type === autoArrayType ? undefinedType : + includeFalsyTypes(type, 2048); + var flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized); if (type === autoType || type === autoArrayType) { if (flowType === autoType || flowType === autoArrayType) { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } @@ -27707,19 +30235,12 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isInsideFunction(node, threshold) { - var current = node; - while (current && current !== threshold) { - if (ts.isFunctionLike(current)) { - return true; - } - current = current.parent; - } - return false; + return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n); }); } function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 256) { + symbol.valueDeclaration.parent.kind === 259) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -27737,8 +30258,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 211 && - ts.getAncestor(symbol.valueDeclaration, 224).parent === container && + if (container.kind === 213 && + ts.getAncestor(symbol.valueDeclaration, 226).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -27750,33 +30271,25 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 183) { + while (current.parent.kind === 184) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 || current.parent.kind === 191)) { + else if ((current.parent.kind === 191 || current.parent.kind === 192)) { var expr = current.parent; isAssigned = expr.operator === 42 || expr.operator === 43; } if (!isAssigned) { return false; } - while (current !== container) { - if (current === container.statement) { - return true; - } - else { - current = current.parent; - } - } - return false; + return !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement; }); } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 147 || container.kind === 150) { + if (container.kind === 148 || container.kind === 151) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -27807,42 +30320,45 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - if (!superCall || superCall.end > node.pos) { - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + if (container.kind === 151) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 185) { + if (container.kind === 186) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 230: + case 232: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 229: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 150: + case 151: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 148: case 147: - case 146: if (ts.getModifierFlags(container) & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142: + case 143: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -27851,8 +30367,8 @@ var ts; } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 184 && - ts.isInJavaScriptFile(container.parent) && + if (container.kind === 185 && + container.parent.kind === 193 && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent .left @@ -27871,7 +30387,7 @@ var ts; if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); var type = ts.hasModifier(container, 32) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; - return getFlowTypeOfReference(node, type, true, undefined); + return getFlowTypeOfReference(node, type); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); @@ -27879,34 +30395,29 @@ var ts; return type; } } - if (compilerOptions.noImplicitThis) { + if (noImplicitThis) { error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } return anyType; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274) { + if (jsdocType && jsdocType.kind === 278) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 281) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { - for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144) { - return true; - } - } - return false; + return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 145; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 185) { + while (container && container.kind === 186) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -27914,17 +30425,14 @@ var ts; var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; if (!canUseSuperExpression) { - var current = node; - while (current && current !== container && current.kind !== 142) { - current = current.parent; - } - if (current && current.kind === 142) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 143; }); + if (current && current.kind === 143) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -27932,6 +30440,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 151) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { nodeCheckFlag = 512; } @@ -27939,7 +30450,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 149 && ts.getModifierFlags(container) & 256) { + if (container.kind === 150 && ts.getModifierFlags(container) & 256) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -27950,7 +30461,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176) { + if (container.parent.kind === 177) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -27968,7 +30479,7 @@ var ts; } return unknownType; } - if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -27980,32 +30491,50 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 150; + return container.kind === 151; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 176) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177) { if (ts.getModifierFlags(container) & 32) { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || - container.kind === 152; + return container.kind === 150 || + container.kind === 149 || + container.kind === 152 || + container.kind === 153; } else { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || + return container.kind === 150 || + container.kind === 149 || container.kind === 152 || + container.kind === 153 || + container.kind === 148 || container.kind === 147 || - container.kind === 146 || - container.kind === 150; + container.kind === 151; } } } return false; } } + function getContainingObjectLiteral(func) { + return (func.kind === 150 || + func.kind === 152 || + func.kind === 153) && func.parent.kind === 177 ? func.parent : + func.kind === 185 && func.parent.kind === 260 ? func.parent.parent : + undefined; + } + function getThisTypeArgument(type) { + return getObjectFlags(type) & 4 && type.target === globalThisType ? type.typeArguments[0] : undefined; + } + function getThisTypeFromContextualType(type) { + return mapType(type, function (t) { + return t.flags & 131072 ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + }); + } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) { + if (func.kind === 186) { + return undefined; + } + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -28014,29 +30543,55 @@ var ts; } } } + if (noImplicitThis) { + var containingLiteral = getContainingObjectLiteral(func); + if (containingLiteral) { + var contextualType = getApparentTypeOfContextualType(containingLiteral); + var literal = containingLiteral; + var type = contextualType; + while (type) { + var thisType = getThisTypeFromContextualType(type); + if (thisType) { + return instantiateType(thisType, getContextualMapper(containingLiteral)); + } + if (literal.parent.kind !== 260) { + break; + } + literal = literal.parent.parent; + type = getApparentTypeOfContextualType(literal); + } + return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral); + } + if (func.parent.kind === 193 && func.parent.operatorToken.kind === 57) { + var target = func.parent.left; + if (target.kind === 178 || target.kind === 179) { + return checkExpressionCached(target.expression); + } + } + } return undefined; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -28061,7 +30616,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -28072,11 +30627,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_19 = declaration.propertyName || declaration.name; - if (ts.isVariableLike(parentDeclaration) && + var name = declaration.propertyName || declaration.name; + if (parentDeclaration.kind !== 175 && parentDeclaration.type && - !ts.isBindingPattern(name_19)) { - var text = ts.getTextOfPropertyName(name_19); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -28087,33 +30642,34 @@ var ts; } function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); - if (ts.isAsyncFunctionLike(func)) { - var contextualReturnType = getContextualReturnType(func); - if (contextualReturnType) { - return getPromisedType(contextualReturnType); + if (func) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1) { + return undefined; } - return undefined; - } - if (func && !func.asteriskToken) { - return getContextualReturnType(func); + var contextualReturnType = getContextualReturnType(func); + return functionFlags & 2 + ? contextualReturnType && getAwaitedTypeOfPromise(contextualReturnType) + : contextualReturnType; } return undefined; } function getContextualTypeForYieldOperand(node) { var func = ts.getContainingFunction(node); if (func) { + var functionFlags = ts.getFunctionFlags(func); var contextualReturnType = getContextualReturnType(func); if (contextualReturnType) { return node.asteriskToken ? contextualReturnType - : getElementTypeOfIterableIterator(contextualReturnType); + : getIteratedTypeOfGenerator(contextualReturnType, (functionFlags & 2) !== 0); } } return undefined; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 && node.parent.initializer === node) { + if (node.parent.kind === 145 && node.parent.initializer === node) { return true; } node = node.parent; @@ -28122,8 +30678,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 150 || - functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) { + functionDecl.kind === 151 || + functionDecl.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -28142,7 +30698,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181) { + if (template.parent.kind === 182) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -28172,38 +30728,14 @@ var ts; } return undefined; } - function applyToContextualType(type, mapper) { - if (!(type.flags & 65536)) { - return mapper(type); - } - var types = type.types; - var mappedType; - var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; - var t = mapper(current); - if (t) { - if (!mappedType) { - mappedType = t; - } - else if (!mappedTypes) { - mappedTypes = [mappedType, t]; - } - else { - mappedTypes.push(t); - } - } - } - return mappedTypes ? getUnionType(mappedTypes) : mappedType; - } function getTypeOfPropertyOfContextualType(type, name) { - return applyToContextualType(type, function (t) { + return mapType(type, function (t) { var prop = t.flags & 229376 ? getPropertyOfType(t, name) : undefined; return prop ? getTypeOfSymbol(prop) : undefined; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); + return mapType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 65536 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); @@ -28238,7 +30770,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? getElementTypeOfIterable(type, undefined) : undefined); + || getIteratedTypeOrElementType(type, undefined, false, false, false); } return undefined; } @@ -28247,19 +30779,16 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxAttribute(attribute) { - var kind = attribute.kind; - var jsxElement = attribute.parent; - var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250) { - if (!attrsType || isTypeAny(attrsType)) { + var attributesType = getContextualType(attribute.parent); + if (ts.isJsxAttribute(attribute)) { + if (!attributesType || isTypeAny(attributesType)) { return undefined; } - return getTypeOfPropertyOfType(attrsType, attribute.name.text); + return getTypeOfPropertyOfType(attributesType, attribute.name.text); } - else if (attribute.kind === 251) { - return attrsType; + else { + return attributesType; } - ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } function getApparentTypeOfContextualType(node) { var type = getContextualType(node); @@ -28274,45 +30803,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223: - case 144: + case 225: + case 145: + case 148: case 147: - case 146: - case 174: + case 175: return getContextualTypeForInitializerExpression(node); - case 185: - case 216: + case 186: + case 218: return getContextualTypeForReturnExpression(node); - case 195: + case 196: return getContextualTypeForYieldOperand(parent); - case 179: case 180: + case 181: return getContextualTypeForArgument(parent, node); - case 182: - case 200: + case 183: + case 201: return getTypeFromTypeNode(parent.type); - case 192: + case 193: return getContextualTypeForBinaryOperand(node); - case 257: - case 258: + case 260: + case 261: return getContextualTypeForObjectLiteralElement(parent); - case 175: + case 176: return getContextualTypeForElementExpression(node); - case 193: + case 194: return getContextualTypeForConditionalOperand(node); - case 202: - ts.Debug.assert(parent.parent.kind === 194); + case 204: + ts.Debug.assert(parent.parent.kind === 195); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183: + case 184: return getContextualType(parent); - case 252: + case 255: return getContextualType(parent); - case 250: - case 251: + case 252: + case 254: return getContextualTypeForJsxAttribute(parent); + case 250: + case 249: + return getAttributesTypeFromJsxOpeningLikeElement(parent); } return undefined; } + function getContextualMapper(node) { + node = ts.findAncestor(node, function (n) { return !!n.contextualMapper; }); + return node ? node.contextualMapper : identityMapper; + } function getNonGenericSignature(type, node) { var signatures = getSignaturesOfStructuredType(type, 0); if (signatures.length === 1) { @@ -28337,7 +30873,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 || node.kind === 185; + return node.kind === 185 || node.kind === 186; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -28350,7 +30886,7 @@ var ts; getApparentTypeOfContextualType(node); } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -28360,8 +30896,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var current = types_17[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -28383,37 +30919,37 @@ var ts; } return result; } - function isInferentialContext(mapper) { - return mapper && mapper.context; - } - function checkSpreadExpression(node, contextualMapper) { - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); + function checkSpreadExpression(node, checkMode) { + if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 1536); + } + var arrayOrIterableType = checkExpression(node.expression, checkMode); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false, false); } function hasDefaultValue(node) { - return (node.kind === 174 && !!node.initializer) || - (node.kind === 192 && node.operatorToken.kind === 57); + return (node.kind === 175 && !!node.initializer) || + (node.kind === 193 && node.operatorToken.kind === 57); } - function checkArrayLiteral(node, contextualMapper) { + function checkArrayLiteral(node, checkMode) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196) { - var restArrayType = checkExpression(e.expression, contextualMapper); + if (inDestructuringPattern && e.kind === 197) { + var restArrayType = checkExpression(e.expression, checkMode); var restElementType = getIndexTypeOfType(restArrayType, 1) || - (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); + getIteratedTypeOrElementType(restArrayType, undefined, false, false, false); if (restElementType) { elementTypes.push(restElementType); } } else { - var type = checkExpressionForMutableLocation(e, contextualMapper); + var type = checkExpressionForMutableLocation(e, checkMode); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196; + hasSpreadElement = hasSpreadElement || e.kind === 197; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -28424,7 +30960,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 173 || pattern.kind === 175)) { + if (pattern && (pattern.kind === 174 || pattern.kind === 176)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -28432,7 +30968,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198) { + if (patternElement.kind !== 199) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -28449,7 +30985,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340); @@ -28486,7 +31022,7 @@ var ts; var unionType = propTypes.length ? getUnionType(propTypes, true) : undefinedType; return createIndexInfo(unionType, false); } - function checkObjectLiteral(node, contextualMapper) { + function checkObjectLiteral(node, checkMode) { var inDestructuringPattern = ts.isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = ts.createMap(); @@ -28495,7 +31031,8 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176); + (contextualType.pattern.kind === 173 || contextualType.pattern.kind === 177); + var isJSObjectLiteral = !contextualType && ts.isInJavaScriptFile(node); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -28504,27 +31041,27 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 || - memberDecl.kind === 258 || + if (memberDecl.kind === 260 || + memberDecl.kind === 261 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257) { - type = checkPropertyAssignment(memberDecl, contextualMapper); + if (memberDecl.kind === 260) { + type = checkPropertyAssignment(memberDecl, checkMode); } - else if (memberDecl.kind === 149) { - type = checkObjectLiteralMethod(memberDecl, contextualMapper); + else if (memberDecl.kind === 150) { + type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 258); - type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 261); + type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } typeFlags |= type.flags; - var prop = createSymbol(4 | 67108864 | member.flags, member.name); + var prop = createSymbol(4 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 260 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 261 && memberDecl.objectAssignmentInitializer); if (isOptional) { - prop.flags |= 536870912; + prop.flags |= 67108864; } if (ts.hasDynamicName(memberDecl)) { patternWithComputedProperties = true; @@ -28533,9 +31070,9 @@ var ts; else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512)) { var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { - prop.flags |= impliedProp.flags & 536870912; + prop.flags |= impliedProp.flags & 67108864; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -28548,9 +31085,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259) { + else if (memberDecl.kind === 262) { + if (languageVersion < 2) { + checkExternalEmitHelpers(memberDecl, 2); + } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -28558,17 +31098,17 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 | 1))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } else { - ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152); - checkAccessorDeclaration(memberDecl); + ts.Debug.assert(memberDecl.kind === 152 || memberDecl.kind === 153); + checkNodeDeferred(memberDecl); } if (ts.hasDynamicName(memberDecl)) { if (isNumericName(memberDecl.name)) { @@ -28579,34 +31119,36 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { - if (!(prop.flags & 536870912)) { + if (!propertiesTable.get(prop.name)) { + if (!(prop.flags & 67108864)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); + } + if (spread.flags & 32768) { + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; + var stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); @@ -28623,9 +31165,14 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 | 4096 | 2048 | 16777216) || + type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { checkJsxOpeningLikeElement(node.openingElement); @@ -28638,85 +31185,105 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252: + case 255: checkJsxExpression(child); break; - case 246: + case 248: checkJsxElement(child); break; - case 247: + case 249: checkJsxSelfClosingElement(child); break; } } - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function isUnhyphenatedJsxName(name) { return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 177 || tagName.kind === 98) { + if (tagName.kind === 178 || tagName.kind === 98) { return false; } else { return ts.isIntrinsicJsxName(tagName.text); } } - function checkJsxAttribute(node, elementAttributesType, nameTable) { - var correspondingPropType = undefined; - if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { - error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); - } - else if (elementAttributesType && !isTypeAny(elementAttributesType)) { - var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); - correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - if (isUnhyphenatedJsxName(node.name.text)) { - var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0); - if (attributeType) { - correspondingPropType = attributeType; + function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, filter, checkMode) { + var attributes = openingLikeElement.attributes; + var attributesTable = ts.createMap(); + var spread = emptyObjectType; + var attributesArray = []; + for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { + var attributeDecl = _a[_i]; + var member = attributeDecl.symbol; + if (ts.isJsxAttribute(attributeDecl)) { + var exprType = attributeDecl.initializer ? + checkExpression(attributeDecl.initializer, checkMode) : + trueType; + var attributeSymbol = createSymbol(4 | 134217728 | member.flags, member.name); + attributeSymbol.declarations = member.declarations; + attributeSymbol.parent = member.parent; + if (member.valueDeclaration) { + attributeSymbol.valueDeclaration = member.valueDeclaration; } - else { - if (!correspondingPropType) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; - } + attributeSymbol.type = exprType; + attributeSymbol.target = member; + attributesTable.set(attributeSymbol.name, attributeSymbol); + attributesArray.push(attributeSymbol); + } + else { + ts.Debug.assert(attributeDecl.kind === 254); + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + var exprType = checkExpression(attributeDecl.expression); + if (!isValidSpreadType(exprType)) { + error(attributeDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); + return anyType; + } + if (isTypeAny(exprType)) { + return anyType; } + spread = getSpreadType(spread, exprType); } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); + if (spread !== emptyObjectType) { + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + attributesArray = getPropertiesOfType(spread); } - else { - exprType = booleanType; + attributesTable = ts.createMap(); + if (attributesArray) { + ts.forEach(attributesArray, function (attr) { + if (!filter || filter(attr)) { + attributesTable.set(attr.name, attr); + } + }); } - if (correspondingPropType) { - checkTypeAssignableTo(exprType, correspondingPropType, node); + return createJsxAttributesType(attributes.symbol, attributesTable); + function createJsxAttributesType(symbol, attributesTable) { + var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, undefined, undefined); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; + result.flags |= 33554432 | 4194304 | freshObjectLiteralFlag; + result.objectFlags |= 128; + return result; } - nameTable[node.name.text] = true; - return exprType; } - function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { - var type = checkExpression(node.expression); - var props = getPropertiesOfType(type); - for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { - var prop = props_2[_i]; - if (!nameTable[prop.name]) { - var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); - if (targetPropSym) { - var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); - checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); - } - nameTable[prop.name] = true; - } - } - return type; + function checkJsxAttributes(node, checkMode) { + return createJsxAttributesTypeFromAttributesProperty(node.parent, undefined, checkMode); } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); @@ -28737,7 +31304,7 @@ var ts; return links.resolvedSymbol = unknownSymbol; } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } return links.resolvedSymbol = unknownSymbol; @@ -28781,23 +31348,86 @@ var ts; return undefined; } } - function getResolvedJsxType(node, elemType, elemClassType) { - if (!elemType) { - elemType = checkExpression(node.tagName); + function defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + var callSignature = getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, undefined); + if (callSignature !== unknownSignature) { + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + } + return undefined; + } + function tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + var candidatesOutArray = []; + getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray); + var result = void 0; + var allMatchingAttributesType = void 0; + for (var _i = 0, candidatesOutArray_1 = candidatesOutArray; _i < candidatesOutArray_1.length; _i++) { + var candidate = candidatesOutArray_1[_i]; + var callReturnType = getReturnTypeOfSignature(candidate); + var paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var shouldBeCandidate = true; + for (var _a = 0, _b = openingLikeElement.attributes.properties; _a < _b.length; _a++) { + var attribute = _b[_a]; + if (ts.isJsxAttribute(attribute) && + isUnhyphenatedJsxName(attribute.name.text) && + !getPropertyOfType(paramType, attribute.name.text)) { + shouldBeCandidate = false; + break; + } + } + if (shouldBeCandidate) { + result = intersectTypes(result, paramType); + } + allMatchingAttributesType = intersectTypes(allMatchingAttributesType, paramType); + } + } + if (!result) { + result = allMatchingAttributesType; + } + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + result = intersectTypes(intrinsicAttributes, result); + } + return result; + } + } + return undefined; + } + function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) { + if (!elementType) { + elementType = checkExpression(openingLikeElement.tagName); } - if (elemType.flags & 65536) { - var types = elemType.types; - return getUnionType(ts.map(types, function (type) { - return getResolvedJsxType(node, type, elemClassType); + if (elementType.flags & 65536) { + var types = elementType.types; + return getUnionType(types.map(function (type) { + return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), true); } - if (elemType.flags & 2) { + if (elementType.flags & 2) { return anyType; } - else if (elemType.flags & 32) { + else if (elementType.flags & 32) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { - var stringLiteralTypeName = elemType.text; + var stringLiteralTypeName = elementType.text; var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName); if (intrinsicProp) { return getTypeOfSymbol(intrinsicProp); @@ -28806,28 +31436,19 @@ var ts; if (indexSignatureType) { return indexSignatureType; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); + error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); } return anyType; } - var elemInstanceType = getJsxElementInstanceType(node, elemType); - if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { - if (jsxElementType) { - var callSignatures = elemType && getSignaturesOfType(elemType, 0); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); - } - return paramType; - } - } + var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? + tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : + defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); + if (statelessAttributesType) { + return statelessAttributesType; } - if (elemClassType) { - checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + if (elementClassType) { + checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } if (isTypeAny(elemInstanceType)) { return elemInstanceType; @@ -28847,10 +31468,6 @@ var ts; else if (isTypeAny(attributesType) || (attributesType === unknownType)) { return attributesType; } - else if (attributesType.flags & 65536) { - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); - return anyType; - } else { var apparentAttributesType = attributesType; var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); @@ -28873,38 +31490,72 @@ var ts; } } } - function getJsxElementAttributesType(node) { + function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { + ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); var links = getNodeLinks(node); - if (!links.resolvedJsxType) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - var symbol = getIntrinsicTagSymbol(node); - if (links.jsxFlags & 1) { - return links.resolvedJsxType = getTypeOfSymbol(symbol); - } - else if (links.jsxFlags & 2) { - return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type; - } - else { - return links.resolvedJsxType = unknownType; - } + if (!links.resolvedJsxElementAttributesType) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1) { + return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol); + } + else if (links.jsxFlags & 2) { + return links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, 0).type; } else { - var elemClassType = getJsxGlobalElementClassType(); - return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); + return links.resolvedJsxElementAttributesType = unknownType; } } - return links.resolvedJsxType; + return links.resolvedJsxElementAttributesType; + } + function getCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType) { + var links = getNodeLinks(node); + if (!links.resolvedJsxElementAttributesType) { + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxElementAttributesType = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, undefined, elemClassType); + } + return links.resolvedJsxElementAttributesType; + } + function getAllAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, true); + } + } + function getAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, false); + } } function getJsxAttributePropertySymbol(attrib) { - var attributesType = getJsxElementAttributesType(attrib.parent); + var attributesType = getAttributesTypeFromJsxOpeningLikeElement(attrib.parent.parent); var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } function getJsxGlobalElementClassType() { - if (!jsxElementClassType) { - jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + if (!deferredJsxElementClassType) { + deferredJsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + } + return deferredJsxElementClassType; + } + function getJsxGlobalElementType() { + if (!deferredJsxElementType) { + deferredJsxElementType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.Element); + } + return deferredJsxElementType; + } + function getJsxGlobalStatelessElementType() { + if (!deferredJsxStatelessElementType) { + var jsxElementType = getJsxGlobalElementType(); + if (jsxElementType) { + deferredJsxStatelessElementType = getUnionType([jsxElementType, nullType]); + } } - return jsxElementClassType; + return deferredJsxStatelessElementType; } function getJsxIntrinsicTagNames() { var intrinsics = getJsxType(JsxNames.IntrinsicElements); @@ -28914,8 +31565,8 @@ var ts; if ((compilerOptions.jsx || 0) === 0) { error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); } - if (jsxElementType === undefined) { - if (compilerOptions.noImplicitAny) { + if (getJsxGlobalElementType() === undefined) { + if (noImplicitAny) { error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); } } @@ -28932,61 +31583,83 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - var targetAttributesType = getJsxElementAttributesType(node); - var nameTable = ts.createMap(); - var sawSpreadedAny = false; - for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250) { - checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); - } - else { - ts.Debug.assert(node.attributes[i].kind === 251); - var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); - if (isTypeAny(spreadType)) { - sawSpreadedAny = true; - } - } + checkJsxAttributesAssignableToTagNameAttributes(node); + } + function checkJsxAttributesAssignableToTagNameAttributes(openingLikeElement) { + var targetAttributesType = isJsxIntrinsicIdentifier(openingLikeElement.tagName) ? + getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : + getCustomJsxElementAttributesType(openingLikeElement, false); + var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, function (attribute) { + return isUnhyphenatedJsxName(attribute.name) || !!(getPropertyOfType(targetAttributesType, attribute.name)); + }); + if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || sourceAttributesType.properties.length > 0)) { + error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } - if (targetAttributesType && !sawSpreadedAny) { - var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); - } - } + else { + checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); } } - function checkJsxExpression(node) { + function checkJsxExpression(node, checkMode) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression, checkMode); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147; + return s.valueDeclaration ? s.valueDeclaration.kind : 148; } function getDeclarationModifierFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; + if (s.valueDeclaration) { + var flags = ts.getCombinedModifierFlags(s.valueDeclaration); + return s.parent && s.parent.flags & 32 ? flags : flags & ~28; + } + if (getCheckFlags(s) & 6) { + var checkFlags = s.checkFlags; + var accessModifier = checkFlags & 256 ? 8 : + checkFlags & 64 ? 4 : + 16; + var staticModifier = checkFlags & 512 ? 32 : 0; + return accessModifier | staticModifier; + } + if (s.flags & 16777216) { + return 4 | 32; + } + return 0; } function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function checkClassPropertyAccess(node, left, type, prop) { + function isMethodLike(symbol) { + return !!(symbol.flags & 8192 || getCheckFlags(symbol) & 4); + } + function checkPropertyAccessibility(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 223 ? + var errorNode = node.kind === 178 || node.kind === 225 ? node.name : node.right; + if (getCheckFlags(prop) & 256) { + error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); + return false; + } if (left.kind === 96) { - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) { - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2) { + var hasNonMethodDeclaration = forEachProperty(prop, function (p) { + var propKind = getDeclarationKindFromSymbol(p); + return propKind !== 150 && propKind !== 149; + }); + if (hasNonMethodDeclaration) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128) { - error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } } @@ -28996,7 +31669,7 @@ var ts; if (flags & 8) { var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (!isNodeWithinClass(node, declaringClassDeclaration)) { - error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } return true; @@ -29006,10 +31679,10 @@ var ts; } var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); - return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + return isClassDerivedFromDeclaringClasses(enclosingClass, prop) ? enclosingClass : undefined; }); if (!enclosingClass) { - error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || type)); return false; } if (flags & 32) { @@ -29025,16 +31698,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144; - if (kind) { - error(node, kind & 2048 ? kind & 4096 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144; + if (kind) { + error(errorNode, kind & 2048 ? kind & 4096 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 | 8192) ? unknownType : t; } return type; } @@ -29063,7 +31737,7 @@ var ts; noUnusedIdentifiers && (prop.flags & 106500) && prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8)) { - if (prop.flags & 16777216) { + if (getCheckFlags(prop) & 1) { getSymbolLinks(prop).target.isReferenced = true; } else { @@ -29071,6 +31745,15 @@ var ts; } } } + function isInPropertyInitializer(node) { + while (node) { + if (node.parent && node.parent.kind === 148 && node.parent.initializer === node) { + return true; + } + node = node.parent; + } + return false; + } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { var type = checkNonNullExpression(left); if (isTypeAny(type) || type === silentNeverType) { @@ -29082,16 +31765,30 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type); } return unknownType; } + if (prop.valueDeclaration) { + if (isInPropertyInitializer(node) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + } + if (prop.valueDeclaration.kind === 228 && + node.parent && node.parent.kind !== 158 && + !ts.isInAmbientContext(prop.valueDeclaration) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Class_0_used_before_its_declaration, right.text); + } + } markPropertyAsReferenced(prop); getNodeLinks(node).resolvedSymbol = prop; - if (prop.parent && prop.parent.flags & 32) { - checkClassPropertyAccess(node, left, apparentType, prop); - } + checkPropertyAccessibility(node, left, apparentType, prop); var propType = getTypeOfSymbol(prop); var assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { @@ -29100,30 +31797,30 @@ var ts; return unknownType; } } - if (node.kind !== 177 || assignmentKind === 1 || + if (node.kind !== 178 || assignmentKind === 1 || !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 65536)) { return propType; } - var flowType = getFlowTypeOfReference(node, propType, true, undefined); + var flowType = getFlowTypeOfReference(node, propType); return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 + var left = node.kind === 178 ? node.expression : node.left; var type = checkExpression(left); if (type !== unknownType && !isTypeAny(type)) { var prop = getPropertyOfType(getWidenedType(type), propertyName); - if (prop && prop.parent && prop.parent.flags & 32) { - return checkClassPropertyAccess(node, left, type, prop); + if (prop) { + return checkPropertyAccessibility(node, left, type, prop); } } return true; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224) { + if (initializer.kind === 226) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -29145,7 +31842,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 && + if (node.kind === 214 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -29163,7 +31860,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 && node.parent.expression === node) { + if (node.parent.kind === 181 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -29183,7 +31880,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -29203,7 +31900,7 @@ var ts; if (!leftHandSideSymbol) { return false; } - var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + var globalESSymbol = getGlobalESSymbolConstructorSymbol(true); if (!globalESSymbol) { return false; } @@ -29216,10 +31913,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181) { + if (node.kind === 182) { checkExpression(node.template); } - else if (node.kind !== 145) { + else if (node.kind !== 146) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -29238,22 +31935,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { - var signature = signatures_2[_i]; + for (var _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) { + var signature = signatures_3[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -29270,7 +31967,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196) { + if (arg && arg.kind === 197) { return i; } } @@ -29283,11 +31980,14 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181) { + if (ts.isJsxOpeningLikeElement(node)) { + return true; + } + if (node.kind === 182) { var tagExpression = node; argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194) { + if (tagExpression.template.kind === 195) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -29299,7 +31999,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145) { + else if (node.kind === 146) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, undefined, signature); @@ -29307,7 +32007,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 180); + ts.Debug.assert(callExpression.kind === 181); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -29315,8 +32015,10 @@ var ts; typeArguments = callExpression.typeArguments; spreadArgIndex = getSpreadArgumentIndex(args); } + var numTypeParameters = ts.length(signature.typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + (typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { return false; } @@ -29340,9 +32042,9 @@ var ts; return undefined; } function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature, true); + var context = createInferenceContext(signature, true, false); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -29361,19 +32063,19 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } if (excludeArgument) { @@ -29381,7 +32083,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -29391,7 +32093,7 @@ var ts; var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; var mapper; - for (var i = 0; i < typeParameters.length; i++) { + for (var i = 0; i < typeArgumentNodes.length; i++) { if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -29411,9 +32113,29 @@ var ts; } return typeArgumentsAreAssignable; } + function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation) { + var callIsIncomplete = node.attributes.end === node.end; + if (callIsIncomplete) { + return true; + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; + var paramType = getTypeAtPosition(signature, 0); + var attributesType = checkExpressionWithContextualType(node.attributes, paramType, undefined); + var argProperties = getPropertiesOfType(attributesType); + for (var _i = 0, argProperties_1 = argProperties; _i < argProperties_1.length; _i++) { + var arg = argProperties_1[_i]; + if (!getPropertyOfType(paramType, arg.name) && isUnhyphenatedJsxName(arg.name)) { + return false; + } + } + return checkTypeRelatedTo(attributesType, paramType, relation, undefined, headMessage); + } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (ts.isJsxOpeningLikeElement(node)) { + return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); + } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180) { + if (thisType && thisType !== voidType && node.kind !== 181) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -29426,7 +32148,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -29441,51 +32163,54 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 179) { + if (node.kind === 180) { var callee = node.expression; - if (callee.kind === 177) { + if (callee.kind === 178) { return callee.expression; } - else if (callee.kind === 178) { + else if (callee.kind === 179) { return callee.expression; } } } function getEffectiveCallArguments(node) { var args; - if (node.kind === 181) { + if (node.kind === 182) { var template = node.template; args = [undefined]; - if (template.kind === 194) { + if (template.kind === 195) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145) { + else if (node.kind === 146) { return undefined; } + else if (ts.isJsxOpeningLikeElement(node)) { + args = node.attributes.properties.length > 0 ? [node.attributes] : emptyArray; + } else { args = node.arguments || emptyArray; } return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145) { + if (node.kind === 146) { switch (node.parent.kind) { - case 226: - case 197: + case 228: + case 198: return 1; - case 147: + case 148: return 2; - case 149: - case 151: + case 150: case 152: + case 153: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 144: + case 145: return 3; } } @@ -29494,48 +32219,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { return anyType; } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var element = node; switch (element.name.kind) { case 70: case 8: case 9: return getLiteralTypeForText(32, element.name.text); - case 142: + case 143: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512)) { return nameType; @@ -29552,20 +32277,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { return numberType; } - if (node.kind === 147) { + if (node.kind === 148) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -29586,26 +32311,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex) { - if (node.kind === 145) { + if (node.kind === 146) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 145 || - (argIndex === 0 && node.kind === 181)) { + if (node.kind === 146 || + (argIndex === 0 && node.kind === 182)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145) { + if (node.kind === 146) { return node.expression; } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return node.template; } else { @@ -29613,15 +32338,30 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181; - var isDecorator = node.kind === 145; + var isTaggedTemplate = node.kind === 182; + var isDecorator = node.kind === 146; + var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; - if (!isTaggedTemplate && !isDecorator) { + if (!isTaggedTemplate && !isDecorator && !isJsxOpeningOrSelfClosingElement) { typeArguments = node.typeArguments; if (node.expression.kind !== 96) { ts.forEach(typeArguments, checkSourceElement); } } + if (signatures.length === 1) { + var declaration = signatures[0].declaration; + if (declaration && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration)) { + if (containsArgumentsReference(declaration)) { + var signatureWithRest = cloneSignature(signatures[0]); + var syntheticArgsSymbol = createSymbol(3, "args"); + syntheticArgsSymbol.type = anyArrayType; + syntheticArgsSymbol.isRestParameter = true; + signatureWithRest.parameters = ts.concatenate(signatureWithRest.parameters, [syntheticArgsSymbol]); + signatureWithRest.hasRestParameter = true; + signatures = [signatureWithRest]; + } + } + } var candidates = candidatesOutArray || []; reorderCandidates(signatures, candidates); if (!candidates.length) { @@ -29644,7 +32384,7 @@ var ts; var candidateForTypeArgumentError; var resultOfFailedInference; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -29658,6 +32398,9 @@ var ts; return result; } if (candidateForArgumentError) { + if (isJsxOpeningOrSelfClosingElement) { + return candidateForArgumentError; + } checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); } else if (candidateForTypeArgumentError) { @@ -29673,7 +32416,7 @@ var ts; if (headMessage) { diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); } - reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + reportNoCommonSupertypeError(inferenceCandidates, node.tagName || node.expression || node.tag, diagnosticChainHead); } } else { @@ -29709,20 +32452,20 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate, false) + ? createInferenceContext(originalCandidate, false, ts.isInJavaScriptFile(node)) : undefined; while (true) { candidate = originalCandidate; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); + typeArgumentTypes = fillMissingTypeArguments(ts.map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, getMinTypeArgumentCount(candidate.typeParameters)); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); - typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; + typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; } if (!typeArgumentsAreValid) { break; @@ -29764,7 +32507,7 @@ var ts; if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); if (baseTypeNode) { - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode); return resolveCall(node, baseConstructors, candidatesOutArray); } } @@ -29875,12 +32618,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8) { @@ -29912,16 +32656,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226: - case 197: + case 228: + case 198: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144: + case 145: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147: + case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149: - case 151: + case 150: case 152: + case 153: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -29946,16 +32690,42 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) { + ts.Debug.assert(!(elementType.flags & 65536)); + var callSignature = resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray); + return callSignature; + } + function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) { + if (elementType.flags & 65536) { + var types = elementType.types; + var result = void 0; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var type = types_18[_i]; + result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray); + } + return result; + } + var callSignatures = elementType && getSignaturesOfType(elementType, 0); + if (callSignatures && callSignatures.length > 0) { + var callSignature = void 0; + callSignature = resolveCall(openingLikeElement, callSignatures, candidatesOutArray); + return callSignature; + } + return undefined; + } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179: - return resolveCallExpression(node, candidatesOutArray); case 180: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 181: + return resolveNewExpression(node, candidatesOutArray); + case 182: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145: + case 146: return resolveDecorator(node, candidatesOutArray); + case 250: + case 249: + return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); } @@ -29986,20 +32756,23 @@ var ts; if (node.expression.kind === 96) { return voidType; } - if (node.kind === 180) { + if (node.kind === 181) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 && - declaration.kind !== 154 && - declaration.kind !== 159 && + declaration.kind !== 151 && + declaration.kind !== 155 && + declaration.kind !== 160 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = node.expression.kind === 70 ? getResolvedSymbol(node.expression) : checkExpression(node.expression).symbol; - if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { + if (funcSymbol && ts.isDeclarationOfFunctionOrClassExpression(funcSymbol)) { + funcSymbol = getSymbolOfNode(funcSymbol.valueDeclaration.initializer); + } + if (funcSymbol && funcSymbol.members && funcSymbol.flags & 16) { return getInferredClassType(funcSymbol); } - else if (compilerOptions.noImplicitAny) { + else if (noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; @@ -30022,9 +32795,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 225 + ? 227 : resolvedRequire.flags & 3 - ? 223 + ? 225 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -30050,6 +32823,22 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 151) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -30065,13 +32854,16 @@ var ts; pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } - function assignContextualParameterTypes(signature, context, mapper) { + function getTypeOfFirstParameterOfSignature(signature) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + } + function assignContextualParameterTypes(signature, context, mapper, checkMode) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); - if (isInferentialContext(mapper)) { + if (checkMode === 2) { for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -30079,23 +32871,23 @@ var ts; var parameter = signature.thisParameter; if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { if (!parameter) { - signature.thisParameter = createTransientSymbol(context.thisParameter, undefined); + signature.thisParameter = createSymbolWithType(context.thisParameter, undefined); } - assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper); + assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper, checkMode); } } for (var i = 0; i < len; i++) { var parameter = signature.parameters[i]; if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeAtPosition(context, i); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } } @@ -30112,19 +32904,19 @@ var ts; } } } - function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper, checkMode) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 || - parameter.valueDeclaration.name.kind === 173)) { + (parameter.valueDeclaration.name.kind === 173 || + parameter.valueDeclaration.name.kind === 174)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); } - else if (isInferentialContext(mapper)) { - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + else if (checkMode === 2) { + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -30135,9 +32927,9 @@ var ts; return undefined; } function createPromiseType(promisedType) { - var globalPromiseType = getGlobalPromiseType(); + var globalPromiseType = getGlobalPromiseType(true); if (globalPromiseType !== emptyGenericType) { - promisedType = getAwaitedType(promisedType); + promisedType = getAwaitedType(promisedType) || emptyObjectType; return createTypeReference(globalPromiseType, [promisedType]); } return emptyObjectType; @@ -30148,46 +32940,56 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol(true)) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } - function getReturnTypeFromBody(func, contextualMapper) { + function getReturnTypeFromBody(func, checkMode) { var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); if (!func.body) { return unknownType; } - var isAsync = ts.isAsyncFunctionLike(func); + var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 204) { - type = checkExpressionCached(func.body, contextualMapper); - if (isAsync) { - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (func.body.kind !== 206) { + type = checkExpressionCached(func.body, checkMode); + if (functionFlags & 2) { + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } } else { var types = void 0; - var funcIsGenerator = !!func.asteriskToken; - if (funcIsGenerator) { - types = checkAndAggregateYieldOperandTypes(func, contextualMapper); - if (types.length === 0) { - var iterableIteratorAny = createIterableIteratorType(anyType); - if (compilerOptions.noImplicitAny) { + if (functionFlags & 1) { + types = ts.concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), checkAndAggregateReturnExpressionTypes(func, checkMode)); + if (!types || types.length === 0) { + var iterableIteratorAny = functionFlags & 2 + ? createAsyncIterableIteratorType(anyType) + : createIterableIteratorType(anyType); + if (noImplicitAny) { error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)); } return iterableIteratorAny; } } else { - types = checkAndAggregateReturnExpressionTypes(func, contextualMapper); + types = checkAndAggregateReturnExpressionTypes(func, checkMode); if (!types) { - return isAsync ? createPromiseReturnType(func, neverType) : neverType; + return functionFlags & 2 + ? createPromiseReturnType(func, neverType) + : neverType; } if (types.length === 0) { - return isAsync ? createPromiseReturnType(func, voidType) : voidType; + return functionFlags & 2 + ? createPromiseReturnType(func, voidType) + : voidType; } } type = getUnionType(types, true); - if (funcIsGenerator) { - type = createIterableIteratorType(type); + if (functionFlags & 1) { + type = functionFlags & 2 + ? createAsyncIterableIteratorType(type) + : createIterableIteratorType(type); } } if (!contextualSignature) { @@ -30199,16 +33001,24 @@ var ts; type = getWidenedLiteralType(type); } var widenedType = getWidenedType(type); - return isAsync ? createPromiseReturnType(func, widenedType) : widenedType; + return (functionFlags & 3) === 2 + ? createPromiseReturnType(func, widenedType) + : widenedType; } - function checkAndAggregateYieldOperandTypes(func, contextualMapper) { + function checkAndAggregateYieldOperandTypes(func, checkMode) { var aggregatedTypes = []; + var functionFlags = ts.getFunctionFlags(func); ts.forEachYieldExpression(func.body, function (yieldExpression) { var expr = yieldExpression.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); + var type = checkExpressionCached(expr, checkMode); if (yieldExpression.asteriskToken) { - type = checkElementTypeOfIterable(type, yieldExpression.expression); + type = checkIteratedTypeOrElementType(type, yieldExpression.expression, false, (functionFlags & 2) !== 0); + } + if (functionFlags & 2) { + type = checkAwaitedType(type, expr, yieldExpression.asteriskToken + ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (!ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); @@ -30229,29 +33039,29 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128)) { return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; } - function checkAndAggregateReturnExpressionTypes(func, contextualMapper) { - var isAsync = ts.isAsyncFunctionLike(func); + function checkAndAggregateReturnExpressionTypes(func, checkMode) { + var functionFlags = ts.getFunctionFlags(func); var aggregatedTypes = []; var hasReturnWithNoExpression = functionHasImplicitReturn(func); var hasReturnOfTypeNever = false; ts.forEachReturnStatement(func.body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); - if (isAsync) { - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var type = checkExpressionCached(expr, checkMode); + if (functionFlags & 2) { + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (type.flags & 8192) { hasReturnOfTypeNever = true; @@ -30265,7 +33075,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 || func.kind === 185)) { + func.kind === 185 || func.kind === 186)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -30282,7 +33092,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -30308,20 +33118,20 @@ var ts; error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); } } - function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184) { + if (!hasGrammarError && node.kind === 185) { checkGrammarForGenerator(node); } - if (contextualMapper === identityMapper && isContextSensitive(node)) { + if (checkMode === 1 && isContextSensitive(node)) { checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); - var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + var mightFixTypeParameters = contextSensitive && checkMode === 2; if (mightFixTypeParameters || !(links.flags & 1024)) { var contextualSignature = getContextualSignature(node); var contextChecked = !!(links.flags & 1024); @@ -30330,10 +33140,10 @@ var ts; if (contextualSignature) { var signature = getSignaturesOfType(type, 0)[0]; if (contextSensitive) { - assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + assignContextualParameterTypes(signature, contextualSignature, getContextualMapper(node), checkMode); } if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { - var returnType = getReturnTypeFromBody(node, contextualMapper); + var returnType = getReturnTypeFromBody(node, checkMode); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } @@ -30345,31 +33155,35 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149) { + if (produceDiagnostics && node.kind !== 150) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); - var isAsync = ts.isAsyncFunctionLike(node); - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); - if (!node.asteriskToken) { + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); + var functionFlags = ts.getFunctionFlags(node); + var returnOrPromisedType = node.type && + ((functionFlags & 3) === 2 ? + checkAsyncFunctionReturnType(node) : + getTypeFromTypeNode(node.type)); + if ((functionFlags & 1) === 0) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (node.body) { if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204) { + if (node.body.kind === 206) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (returnOrPromisedType) { - if (isAsync) { - var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); + if ((functionFlags & 3) === 2) { + var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { @@ -30388,19 +33202,19 @@ var ts; return true; } function isReadonlySymbol(symbol) { - return symbol.isReadonly || - symbol.flags & 4 && (getDeclarationModifierFlagsFromSymbol(symbol) & 64) !== 0 || - symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 || + return !!(getCheckFlags(symbol) & 8 || + symbol.flags & 4 && getDeclarationModifierFlagsFromSymbol(symbol) & 64 || + symbol.flags & 3 && getDeclarationNodeFlagsFromSymbol(symbol) & 2 || symbol.flags & 98304 && !(symbol.flags & 65536) || - (symbol.flags & 8) !== 0; + symbol.flags & 8); } function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 177 || expr.kind === 178) && + (expr.kind === 178 || expr.kind === 179) && expr.expression.kind === 98) { var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150)) + if (!(func && func.kind === 151)) return true; return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent); } @@ -30409,13 +33223,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 || expr.kind === 178) { + if (expr.kind === 178 || expr.kind === 179) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237; + return declaration && declaration.kind === 239; } } } @@ -30423,7 +33237,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipParentheses(expr); - if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 70 && node.kind !== 178 && node.kind !== 179) { error(expr, invalidReferenceMessage); return false; } @@ -30431,11 +33245,21 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 178 && expr.kind !== 179) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { checkExpression(node.expression); - return stringType; + return typeofType; } function checkVoidExpression(node) { checkExpression(node.expression); @@ -30443,7 +33267,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 524288)) { + if (!(node.flags & 16384)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -30451,7 +33275,7 @@ var ts; } } var operandType = checkExpression(node.expression); - return checkAwaitedType(operandType, node); + return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); @@ -30465,6 +33289,7 @@ var ts; case 36: case 37: case 51: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -30476,7 +33301,7 @@ var ts; booleanType; case 42: case 43: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } @@ -30489,7 +33314,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } @@ -30501,8 +33326,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_19 = types; _i < types_19.length; _i++) { + var t = types_19[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -30516,8 +33341,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_20 = types; _i < types_20.length; _i++) { + var t = types_20[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -30526,8 +33351,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_21 = types; _a < types_21.length; _a++) { + var t = types_21[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -30548,7 +33373,10 @@ var ts; if (isTypeOfKind(leftType, 8190)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0).length || + getSignaturesOfType(rightType, 1).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -30557,39 +33385,41 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; + for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { + var p = properties_7[_i]; checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 || property.kind === 258) { - var name_20 = property.name; - if (name_20.kind === 142) { - checkComputedPropertyName(name_20); + if (property.kind === 260 || property.kind === 261) { + var name = property.name; + if (name.kind === 143) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_20)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 258) { + if (property.kind === 261) { return checkDestructuringAssignment(property, type); } else { @@ -30597,10 +33427,13 @@ var ts; } } else { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 259) { + else if (property.kind === 262) { + if (languageVersion < 5) { + checkExternalEmitHelpers(property, 4); + } var nonRestNames = []; if (allProperties) { for (var i = 0; i < allProperties.length - 1; i++) { @@ -30614,19 +33447,22 @@ var ts; error(property, ts.Diagnostics.Property_assignment_expected); } } - function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { - var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; + function checkArrayLiteralAssignment(node, sourceType, checkMode) { + if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512); + } + var elementType = checkIteratedTypeOrElementType(sourceType, node, false, false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } return sourceType; } - function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198) { - if (element.kind !== 196) { + if (element.kind !== 199) { + if (element.kind !== 197) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -30634,7 +33470,7 @@ var ts; ? getTypeOfPropertyOfType(sourceType, propName) : elementType; if (type) { - return checkDestructuringAssignment(element, type, contextualMapper); + return checkDestructuringAssignment(element, type, checkMode); } else { checkExpression(element); @@ -30652,48 +33488,48 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) { + if (restExpression.kind === 193 && restExpression.operatorToken.kind === 57) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { - return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); + return checkDestructuringAssignment(restExpression, createArrayType(elementType), checkMode); } } } } return undefined; } - function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 258) { + if (exprOrAssignment.kind === 261) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048)) { sourceType = getTypeWithFacts(sourceType, 131072); } - checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode); } target = exprOrAssignment.name; } else { target = exprOrAssignment; } - if (target.kind === 192 && target.operatorToken.kind === 57) { - checkBinaryExpression(target, contextualMapper); + if (target.kind === 193 && target.operatorToken.kind === 57) { + checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 176) { + if (target.kind === 177) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175) { - return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + if (target.kind === 176) { + return checkArrayLiteralAssignment(target, sourceType, checkMode); } - return checkReferenceAssignment(target, sourceType, contextualMapper); + return checkReferenceAssignment(target, sourceType, checkMode); } - function checkReferenceAssignment(target, sourceType, contextualMapper) { - var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 ? + function checkReferenceAssignment(target, sourceType, checkMode) { + var targetType = checkExpression(target, checkMode); + var error = target.parent.kind === 262 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -30707,35 +33543,35 @@ var ts; case 70: case 9: case 11: - case 181: - case 194: + case 182: + case 195: case 12: case 8: case 100: case 85: case 94: - case 137: - case 184: - case 197: + case 138: case 185: - case 175: + case 198: + case 186: case 176: - case 187: - case 201: - case 247: - case 246: + case 177: + case 188: + case 202: + case 249: + case 248: return true; - case 193: + case 194: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192: + case 193: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190: case 191: + case 192: switch (node.operator) { case 50: case 36: @@ -30744,9 +33580,9 @@ var ts; return true; } return false; - case 188: - case 182: - case 200: + case 189: + case 183: + case 201: default: return false; } @@ -30761,16 +33597,16 @@ var ts; firstAssignableToSecond && !secondAssignableToFirst ? type2 : getUnionType([type1, type2], true); } - function checkBinaryExpression(node, contextualMapper) { - return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + function checkBinaryExpression(node, checkMode) { + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, checkMode, node); } - function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 57 && (left.kind === 176 || left.kind === 175)) { - return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); + if (operator === 57 && (left.kind === 177 || left.kind === 176)) { + return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } - var leftType = checkExpression(left, contextualMapper); - var rightType = checkExpression(right, contextualMapper); + var leftType = checkExpression(left, checkMode); + var rightType = checkExpression(right, checkMode); switch (operator) { case 38: case 39: @@ -30797,12 +33633,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; if ((leftType.flags & 136) && (rightType.flags & 136) && @@ -30822,12 +33654,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 | 262178) && !isTypeOfKind(rightType, 1 | 262178)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) { resultType = numberType; @@ -30856,8 +33686,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -30893,11 +33723,14 @@ var ts; checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 25: - if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) { error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType; } + function isEvalNode(node) { + return node.kind === 70 && node.text === "eval"; + } function checkForDisallowedESSymbolOperand(operator) { var offendingSymbolOperand = maybeTypeOfKind(leftType, 512) ? left : maybeTypeOfKind(rightType, 512) ? right : @@ -30951,7 +33784,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 131072) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -30960,30 +33793,45 @@ var ts; } if (node.expression) { var func = ts.getContainingFunction(node); - if (func && func.asteriskToken) { + var functionFlags = func && ts.getFunctionFlags(func); + if (node.asteriskToken) { + if (functionFlags & 2) { + if (languageVersion < 4) { + checkExternalEmitHelpers(node, 4096); + } + } + else if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256); + } + } + if (functionFlags & 1) { var expressionType = checkExpressionCached(node.expression, undefined); var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { - expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); + expressionElementType = checkIteratedTypeOrElementType(expressionType, node.expression, false, (functionFlags & 2) !== 0); } if (func.type) { - var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; + var signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(func.type), (functionFlags & 2) !== 0) || anyType; if (nodeIsYieldStar) { - checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(functionFlags & 2 + ? getAwaitedType(expressionElementType, node.expression, ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionElementType, signatureElementType, node.expression, undefined); } else { - checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(functionFlags & 2 + ? getAwaitedType(expressionType, node.expression, ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionType, signatureElementType, node.expression, undefined); } } } } return anyType; } - function checkConditionalExpression(node, contextualMapper) { + function checkConditionalExpression(node, checkMode) { checkExpression(node.condition); - var type1 = checkExpression(node.whenTrue, contextualMapper); - var type2 = checkExpression(node.whenFalse, contextualMapper); + var type1 = checkExpression(node.whenTrue, checkMode); + var type2 = checkExpression(node.whenFalse, checkMode); return getBestChoiceType(type1, type2); } function checkLiteralExpression(node) { @@ -31009,107 +33857,119 @@ var ts; } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var saveContextualType = node.contextualType; + var saveContextualMapper = node.contextualMapper; node.contextualType = contextualType; - var result = checkExpression(node, contextualMapper); + node.contextualMapper = contextualMapper; + var checkMode = contextualMapper === identityMapper ? 1 : + contextualMapper ? 2 : 0; + var result = checkExpression(node, checkMode); node.contextualType = saveContextualType; + node.contextualMapper = saveContextualMapper; return result; } - function checkExpressionCached(node, contextualMapper) { + function checkExpressionCached(node, checkMode) { var links = getNodeLinks(node); if (!links.resolvedType) { var saveFlowLoopStart = flowLoopStart; flowLoopStart = flowLoopCount; - links.resolvedType = checkExpression(node, contextualMapper); + links.resolvedType = checkExpression(node, checkMode); flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 || node.kind === 200; + return node.kind === 183 || node.kind === 201; } function checkDeclarationInitializer(declaration) { - var type = checkExpressionCached(declaration.initializer); + var type = getTypeOfExpression(declaration.initializer, true); return ts.getCombinedNodeFlags(declaration) & 2 || ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); - if (apparentType.flags & (2 | 4 | 8 | 16)) { + if (contextualType.flags & 540672) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + if (constraint.flags & (2 | 4 | 8 | 16)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 | 262144)); } return false; } - function checkExpressionForMutableLocation(node, contextualMapper) { - var type = checkExpression(node, contextualMapper); + function checkExpressionForMutableLocation(node, checkMode) { + var type = checkExpression(node, checkMode); return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } - function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 142) { + function checkPropertyAssignment(node, checkMode) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } - return checkExpressionForMutableLocation(node.initializer, contextualMapper); + return checkExpressionForMutableLocation(node.initializer, checkMode); } - function checkObjectLiteralMethod(node, contextualMapper) { + function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } - var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } - function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (isInferentialContext(contextualMapper)) { + function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { + if (checkMode === 2) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { - return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, getContextualMapper(node))); } } } } return type; } - function getTypeOfExpression(node) { - if (node.kind === 179 && node.expression.kind !== 96) { + function getTypeOfExpression(node, cache) { + if (node.kind === 180 && node.expression.kind !== 96 && !ts.isRequireCall(node, true)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { return getReturnTypeOfSignature(signature); } } - return checkExpression(node); + return cache ? checkExpressionCached(node) : checkExpression(node); + } + function getContextFreeTypeOfExpression(node) { + var saveContextualType = node.contextualType; + node.contextualType = anyType; + var type = getTypeOfExpression(node); + node.contextualType = saveContextualType; + return type; } - function checkExpression(node, contextualMapper) { + function checkExpression(node, checkMode) { var type; - if (node.kind === 141) { + if (node.kind === 142) { type = checkQualifiedName(node); } else { - var uninstantiatedType = checkExpressionWorker(node, contextualMapper); - type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkExpressionWorker(node, checkMode); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 177 && node.parent.expression === node) || - (node.parent.kind === 178 && node.parent.expression === node) || - ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 && node.parent.expression === node) || + (node.parent.kind === 179 && node.parent.expression === node) || + ((node.kind === 70 || node.kind === 142) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } } return type; } - function checkExpressionWorker(node, contextualMapper) { + function checkExpressionWorker(node, checkMode) { switch (node.kind) { case 70: return checkIdentifier(node); @@ -31124,66 +33984,70 @@ var ts; case 100: case 85: return checkLiteralExpression(node); - case 194: + case 195: return checkTemplateExpression(node); case 12: return stringType; case 11: return globalRegExpType; - case 175: - return checkArrayLiteral(node, contextualMapper); case 176: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, checkMode); case 177: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, checkMode); case 178: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 179: + return checkIndexedAccess(node); case 180: - return checkCallExpression(node); case 181: + return checkCallExpression(node); + case 182: return checkTaggedTemplateExpression(node); - case 183: - return checkExpression(node.expression, contextualMapper); - case 197: - return checkClassExpression(node); case 184: + return checkExpression(node.expression, checkMode); + case 198: + return checkClassExpression(node); case 185: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187: + case 186: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 188: return checkTypeOfExpression(node); - case 182: - case 200: - return checkAssertion(node); + case 183: case 201: + return checkAssertion(node); + case 202: return checkNonNullAssertion(node); - case 186: + case 203: + return checkMetaProperty(node); + case 187: return checkDeleteExpression(node); - case 188: - return checkVoidExpression(node); case 189: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 190: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 191: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 192: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 193: - return checkConditionalExpression(node, contextualMapper); - case 196: - return checkSpreadExpression(node, contextualMapper); - case 198: + return checkBinaryExpression(node, checkMode); + case 194: + return checkConditionalExpression(node, checkMode); + case 197: + return checkSpreadExpression(node, checkMode); + case 199: return undefinedWideningType; - case 195: + case 196: return checkYieldExpression(node); - case 252: - return checkJsxExpression(node); - case 246: + case 255: + return checkJsxExpression(node, checkMode); + case 248: return checkJsxElement(node); - case 247: + case 249: return checkJsxSelfClosingElement(node); - case 248: + case 253: + return checkJsxAttributes(node, checkMode); + case 250: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -31193,7 +34057,16 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); - getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); + checkSourceElement(node.default); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } + var constraintType = getConstraintOfTypeParameter(typeParameter); + var defaultType = getDefaultFromTypeParameter(typeParameter); + if (constraintType && defaultType) { + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } @@ -31204,7 +34077,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -31215,7 +34088,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 || func.kind === 154 || func.kind === 159) { + if (func.kind === 151 || func.kind === 155 || func.kind === 160) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -31223,14 +34096,6 @@ var ts; error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } } - function isSyntacticallyValidGenerator(node) { - if (!node.asteriskToken || !node.body) { - return false; - } - return node.kind === 149 || - node.kind === 225 || - node.kind === 184; - } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { @@ -31270,9 +34135,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_21 = _a[_i].name; - if (ts.isBindingPattern(name_21) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -31285,16 +34150,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 186: + case 154: + case 227: case 185: - case 153: - case 225: - case 184: - case 158: + case 159: + case 150: case 149: - case 148: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -31304,29 +34169,44 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_22 = element.name; - if (name_22.kind === 70 && - name_22.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_22.kind === 173 || - name_22.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 || + name.kind === 173) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 155) { + if (node.kind === 156) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 225 || node.kind === 159 || - node.kind === 153 || node.kind === 150 || - node.kind === 154) { + else if (node.kind === 159 || node.kind === 227 || node.kind === 160 || + node.kind === 154 || node.kind === 151 || + node.kind === 155) { checkGrammarFunctionLikeDeclaration(node); } + var functionFlags = ts.getFunctionFlags(node); + if ((functionFlags & 7) === 2 && languageVersion < 4) { + checkExternalEmitHelpers(node, 64); + if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } + if ((functionFlags & 5) === 1) { + if (functionFlags & 2 && languageVersion < 4) { + checkExternalEmitHelpers(node, 2048); + } + else if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -31334,29 +34214,32 @@ var ts; } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); - if (compilerOptions.noImplicitAny && !node.type) { + if (noImplicitAny && !node.type) { switch (node.kind) { - case 154: + case 155: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153: + case 154: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } } if (node.type) { - if (languageVersion >= 2 && isSyntacticallyValidGenerator(node)) { + var functionFlags_1 = ts.getFunctionFlags(node); + if ((functionFlags_1 & 5) === 1) { var returnType = getTypeFromTypeNode(node.type); if (returnType === voidType) { error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); } else { - var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType; - var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType); + var generatorElementType = getIteratedTypeOfGenerator(returnType, (functionFlags_1 & 2) !== 0) || anyType; + var iterableIteratorInstantiation = functionFlags_1 & 2 + ? createAsyncIterableIteratorType(generatorElementType) + : createIterableIteratorType(generatorElementType); checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } - else if (ts.isAsyncFunctionLike(node)) { + else if ((functionFlags_1 & 3) === 2) { checkAsyncFunctionReturnType(node); } } @@ -31370,7 +34253,7 @@ var ts; var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -31379,36 +34262,65 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; }); + var isStatic = ts.getModifierFlags(member) & 32; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151: + case 152: addName(names, member.name, memberName, 1); break; - case 152: + case 153: addName(names, member.name, memberName, 2); break; - case 147: + case 148: addName(names, member.name, memberName, 3); break; + case 150: + addName(names, member.name, memberName, 4); + break; } } } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4) { + if (meaning !== 4) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -31416,7 +34328,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146) { + if (member.kind === 147) { var memberName = void 0; switch (member.name.kind) { case 9: @@ -31427,18 +34339,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227) { + if (node.kind === 229) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -31453,7 +34365,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134: + case 135: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -31520,12 +34432,12 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 225) { + else if (n.kind !== 185 && n.kind !== 227) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 && + return n.kind === 148 && !(ts.getModifierFlags(n) & 32) && !!n.initializer; } @@ -31545,7 +34457,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -31568,18 +34480,18 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151) { + if (node.kind === 152) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) { if (!(node.flags & 256)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 151 ? 152 : 151; + var otherKind = node.kind === 152 ? 153 : 152; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) { @@ -31593,17 +34505,12 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151) { + if (node.kind === 152) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } - else { - checkNodeDeferred(node); - } + checkSourceElement(node.body); + registerForUnusedIdentifiersCheck(node); } function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { var firstType = getAnnotatedType(first); @@ -31612,14 +34519,11 @@ var ts; error(first, message); } } - function checkAccessorDeferred(node) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } function checkMissingDeclaration(node) { checkDecorators(node); } function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); var typeArguments; var mapper; var result = true; @@ -31627,7 +34531,7 @@ var ts; var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { if (!typeArguments) { - typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + typeArguments = fillMissingTypeArguments(ts.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, minTypeArgumentCount); mapper = createTypeMapper(typeParameters, typeArguments); } var typeArgument = typeArguments[i]; @@ -31678,25 +34582,42 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288)) { + return type; + } + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + if (maybeTypeOfKind(objectType, 540672) && isTypeOfKind(indexType, 340)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 227 && - n.parent.kind !== 226 && - n.parent.kind !== 197 && + if (n.parent.kind !== 229 && + n.parent.kind !== 228 && + n.parent.kind !== 198 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -31773,7 +34694,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 149 || node.kind === 148) && + var reportError = (node.kind === 150 || node.kind === 149) && (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32); if (reportError) { var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -31802,15 +34723,15 @@ var ts; } var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { - var current = declarations_4[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var current = declarations_5[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 || node.parent.kind === 162 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 227 || node.kind === 150 || node.kind === 149 || node.kind === 151) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -31861,8 +34782,8 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; + for (var _a = 0, signatures_4 = signatures; _a < signatures_4.length; _a++) { + var signature = signatures_4[_a]; if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -31921,16 +34842,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227: + case 229: return 2097152; - case 230: + case 232: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 226: - case 229: + case 228: + case 231: return 2097152 | 1048576; - case 234: + case 236: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -31940,87 +34861,92 @@ var ts; } } } - function checkNonThenableType(type, location, message) { - type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { - if (location) { - if (!message) { - message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; - } - error(location, message); - } - return unknownType; - } - return type; + function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage) { + var promisedType = getPromisedTypeOfPromise(type, errorNode); + return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage); } - function getPromisedType(promise) { + function getPromisedTypeOfPromise(promise, errorNode) { if (isTypeAny(promise)) { return undefined; } - if (getObjectFlags(promise) & 4) { - if (promise.target === tryGetGlobalPromiseType() - || promise.target === getGlobalPromiseLikeType()) { - return promise.typeArguments[0]; - } + var typeAsPromise = promise; + if (typeAsPromise.promisedTypeOfPromise) { + return typeAsPromise.promisedTypeOfPromise; } - var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType(); - if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) { - return undefined; + if (isReferenceToType(promise, getGlobalPromiseType(false))) { + return typeAsPromise.promisedTypeOfPromise = promise.typeArguments[0]; } var thenFunction = getTypeOfPropertyOfType(promise, "then"); - if (!thenFunction || isTypeAny(thenFunction)) { + if (isTypeAny(thenFunction)) { return undefined; } - var thenSignatures = getSignaturesOfType(thenFunction, 0); + var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : emptyArray; if (thenSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method); + } return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288); if (isTypeAny(onfulfilledParameterType)) { return undefined; } var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0); if (onfulfilledParameterSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + } return undefined; } - return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true); + return typeAsPromise.promisedTypeOfPromise = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true); } - function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; - } - function getAwaitedType(type) { - return checkAwaitedType(type, undefined, undefined); + function checkAwaitedType(type, errorNode, diagnosticMessage) { + return getAwaitedType(type, errorNode, diagnosticMessage) || unknownType; } - function checkAwaitedType(type, location, message) { - return checkAwaitedTypeWorker(type); - function checkAwaitedTypeWorker(type) { - if (type.flags & 65536) { - var types = []; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var constituentType = _a[_i]; - types.push(checkAwaitedTypeWorker(constituentType)); - } - return getUnionType(types, true); + function getAwaitedType(type, errorNode, diagnosticMessage) { + var typeAsAwaitable = type; + if (typeAsAwaitable.awaitedTypeOfType) { + return typeAsAwaitable.awaitedTypeOfType; + } + if (isTypeAny(type)) { + return typeAsAwaitable.awaitedTypeOfType = type; + } + if (type.flags & 65536) { + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var constituentType = _a[_i]; + types = ts.append(types, getAwaitedType(constituentType, errorNode, diagnosticMessage)); } - else { - var promisedType = getPromisedType(type); - if (promisedType === undefined) { - return checkNonThenableType(type, location, message); - } - else { - if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { - if (location) { - error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); - } - return unknownType; - } - awaitedTypeStack.push(type.id); - var awaitedType = checkAwaitedTypeWorker(promisedType); - awaitedTypeStack.pop(); - return awaitedType; + if (!types) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, true); + } + var promisedType = getPromisedTypeOfPromise(type); + if (promisedType) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); } + return undefined; } + awaitedTypeStack.push(type.id); + var awaitedType = getAwaitedType(promisedType, errorNode, diagnosticMessage); + awaitedTypeStack.pop(); + if (!awaitedType) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = awaitedType; + } + var thenFunction = getTypeOfPropertyOfType(type, "then"); + if (thenFunction && getSignaturesOfType(thenFunction, 0).length > 0) { + if (errorNode) { + ts.Debug.assert(!!diagnosticMessage); + error(errorNode, diagnosticMessage); + } + return undefined; } + return typeAsAwaitable.awaitedTypeOfType = type; } function checkAsyncFunctionReturnType(node) { var returnType = getTypeFromTypeNode(node.type); @@ -32028,8 +34954,8 @@ var ts; if (returnType === unknownType) { return unknownType; } - var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) { + var globalPromiseType = getGlobalPromiseType(true); + if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) { error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); return unknownType; } @@ -32047,10 +34973,15 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 && promiseConstructorName.text === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } - var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(true); if (globalPromiseConstructorLikeType === emptyObjectType) { error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); return unknownType; @@ -32065,7 +34996,7 @@ var ts; return unknownType; } } - return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return checkAwaitedType(returnType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkDecorator(node) { var signature = getResolvedSignature(node); @@ -32077,22 +35008,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226: + case 228: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147: + case 148: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149: - case 151: + case 150: case 152: + case 153: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -32111,6 +35042,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } function checkDecorators(node) { if (!node.decorators) { return; @@ -32121,28 +35055,36 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8); + if (node.kind === 145) { + checkExternalEmitHelpers(firstDecorator, 32); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 226: + case 228: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; - case 149: - case 151: + case 150: case 152: + case 153: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147: - case 144: + case 148: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; + case 145: markTypeNodeAsReferenced(node.type); break; } @@ -32154,6 +35096,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -32161,8 +35104,8 @@ var ts; function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); - var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 142) { + var functionFlags = ts.getFunctionFlags(node); + if (node.name && node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -32180,15 +35123,17 @@ var ts; } } checkSourceElement(node.body); - if (!node.asteriskToken) { - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if ((functionFlags & 1) === 0) { + var returnOrPromisedType = node.type && (functionFlags & 2 + ? checkAsyncFunctionReturnType(node) + : getTypeFromTypeNode(node.type)); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { - if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { + if (noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } - if (node.asteriskToken && ts.nodeIsPresent(node.body)) { + if (functionFlags & 1 && ts.nodeIsPresent(node.body)) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } } @@ -32204,56 +35149,54 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261: - case 230: + case 264: + case 232: checkUnusedModuleMembers(node); break; - case 226: - case 197: + case 228: + case 198: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227: + case 229: checkUnusedTypeParameters(node); break; - case 204: - case 232: - case 211: - case 212: + case 206: + case 234: case 213: + case 214: + case 215: checkUnusedLocalsAndParameters(node); break; - case 150: - case 184: - case 225: - case 185: - case 149: case 151: + case 185: + case 227: + case 186: + case 150: case 152: + case 153: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148: - case 153: + case 149: case 154: case 155: - case 158: + case 156: case 159: + case 160: checkUnusedTypeParameters(node); break; } - ; } } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -32266,22 +35209,28 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_3(key); - } + }); } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 && - (declaration.parent.parent.kind === 212 || - declaration.parent.parent.kind === 213)) { + if (declaration.kind === 225 && + (declaration.parent.parent.kind === 214 || + declaration.parent.parent.kind === 215)) { return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -32294,12 +35243,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 || member.kind === 147) { + if (member.kind === 150 || member.kind === 148) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150) { + else if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) { @@ -32330,21 +35279,20 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } - } + }); } } function checkBlock(node) { - if (node.kind === 204) { + if (node.kind === 206) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -32366,19 +35314,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 || - node.kind === 146 || + if (node.kind === 148 || + node.kind === 147 || + node.kind === 150 || node.kind === 149 || - node.kind === 148 || - node.kind === 151 || - node.kind === 152) { + node.kind === 152 || + node.kind === 153) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -32388,9 +35336,13 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } function checkIfThisIsCapturedInEnclosingScope(node) { - var current = node; - while (current) { + ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4) { var isDeclaration_1 = node.kind !== 70; if (isDeclaration_1) { @@ -32399,10 +35351,23 @@ var ts; else { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); } - return; + return true; } - current = current.parent; - } + }); + } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + ts.findAncestor(node, function (current) { + if (getNodeCheckFlags(current) & 8) { + var isDeclaration_2 = node.kind !== 70; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return true; + } + }); } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { @@ -32413,8 +35378,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -32429,23 +35394,23 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 264 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192) { + if (parent.kind === 264 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -32453,7 +35418,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 223 && !node.initializer) { + if (node.kind === 225 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -32463,25 +35428,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224); - var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226); + var container = varDeclList.parent.kind === 207 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 204 && ts.isFunctionLike(container.parent) || - container.kind === 231 || - container.kind === 230 || - container.kind === 261); + (container.kind === 206 && ts.isFunctionLike(container.parent) || + container.kind === 233 || + container.kind === 232 || + container.kind === 264); if (!namesShareScope) { - var name_23 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144) { + if (ts.getRootDeclaration(node).kind !== 145) { return; } var func = ts.getContainingFunction(node); @@ -32490,7 +35455,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 177) { + if (n.kind === 178) { return visit(n.expression); } else if (n.kind === 70) { @@ -32504,21 +35469,21 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144) { + if (symbol.valueDeclaration.kind === 145 || + symbol.valueDeclaration.kind === 175) { if (symbol.valueDeclaration.pos < node.pos) { return; } - var current = n; - while (current !== node.initializer) { - if (ts.isFunctionLike(current.parent)) { - return; - } - if (current.parent.kind === 147 && - !(ts.hasModifier(current.parent, 32)) && - ts.isClassLike(current.parent.parent)) { - return; + if (ts.findAncestor(n, function (current) { + if (current === node.initializer) { + return "quit"; } - current = current.parent; + return ts.isFunctionLike(current.parent) || + (current.parent.kind === 148 && + !(ts.hasModifier(current.parent, 32)) && + ts.isClassLike(current.parent.parent)); + })) { + return; } } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); @@ -32535,34 +35500,40 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174) { - if (node.propertyName && node.propertyName.kind === 142) { + if (node.kind === 175) { + if (node.parent.kind === 173 && languageVersion < 5) { + checkExternalEmitHelpers(node, 4); + } + if (node.propertyName && node.propertyName.kind === 143) { checkComputedPropertyName(node.propertyName); } - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); - var name_24 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent.initializer && property) { + checkPropertyAccessibility(parent, parent.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { + if (node.name.kind === 174 && languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512); + } ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -32571,7 +35542,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -32589,20 +35560,21 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 && node.kind !== 146) { + if (node.kind !== 148 && node.kind !== 147) { checkExportsOnMergedDeclarations(node); - if (node.kind === 223 || node.kind === 174) { + if (node.kind === 225 || node.kind === 175) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 223) || - (left.kind === 223 && right.kind === 144)) { + if ((left.kind === 145 && right.kind === 225) || + (left.kind === 225 && right.kind === 145)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -32629,8 +35601,8 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 176) { - if (ts.isAsyncFunctionLike(node)) { + if (node.modifiers && node.parent.kind === 177) { + if (ts.getFunctionFlags(node) & 2) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } @@ -32648,7 +35620,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206) { + if (node.thenStatement.kind === 208) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -32665,12 +35637,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224) { + if (node.initializer && node.initializer.kind === 226) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224) { + if (node.initializer.kind === 226) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -32688,13 +35660,23 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 224) { + if (node.kind === 215) { + if (node.awaitModifier) { + if (languageVersion < 4) { + checkExternalEmitHelpers(node, 8192); + } + } + else if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256); + } + } + if (node.initializer.kind === 226) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 175 || varExpr.kind === 176) { + var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); + if (varExpr.kind === 176 || varExpr.kind === 177) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -32713,7 +35695,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 226) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -32723,7 +35705,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -32733,7 +35715,7 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -32748,161 +35730,199 @@ var ts; checkVariableDeclaration(decl); } } - function checkRightHandSideOfForOf(rhsExpression) { + function checkRightHandSideOfForOf(rhsExpression, awaitModifier) { var expressionType = checkNonNullExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, true, awaitModifier !== undefined); } - function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { + function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable) { if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= 2) { - return checkElementTypeOfIterable(inputType, errorNode); + return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, true) || anyType; + } + function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, checkAssignability) { + var uplevelIteration = languageVersion >= 2; + var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; + if (uplevelIteration || downlevelIteration || allowAsyncIterable) { + var iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterable, allowAsyncIterable, checkAssignability); + if (iteratedType || uplevelIteration) { + return iteratedType; + } } + var arrayType = inputType; + var reportedError = false; + var hasStringConstituent = false; if (allowStringInput) { - return checkElementTypeOfArrayOrString(inputType, errorNode); - } - if (isArrayLikeType(inputType)) { - var indexType = getIndexTypeOfType(inputType, 1); - if (indexType) { - return indexType; + if (arrayType.flags & 65536) { + var arrayTypes = inputType.types; + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); + if (filteredTypes !== arrayTypes) { + arrayType = getUnionType(filteredTypes, true); + } + } + else if (arrayType.flags & 262178) { + arrayType = neverType; + } + hasStringConstituent = arrayType !== inputType; + if (hasStringConstituent) { + if (languageVersion < 1) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + } + if (arrayType.flags & 8192) { + return stringType; + } } } - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (!isArrayLikeType(arrayType)) { + if (errorNode && !reportedError) { + var diagnostic = !allowStringInput || hasStringConstituent + ? downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type + : downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(errorNode, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : undefined; } - return unknownType; - } - function checkElementTypeOfIterable(iterable, errorNode) { - var elementType = getElementTypeOfIterable(iterable, errorNode); - if (errorNode && elementType) { - checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode); + var arrayElementType = getIndexTypeOfType(arrayType, 1); + if (hasStringConstituent && arrayElementType) { + if (arrayElementType.flags & 262178) { + return stringType; + } + return getUnionType([arrayElementType, stringType], true); } - return elementType || anyType; + return arrayElementType; } - function getElementTypeOfIterable(type, errorNode) { + function getIteratedTypeOfIterable(type, errorNode, isAsyncIterable, allowNonAsyncIterables, checkAssignability) { if (isTypeAny(type)) { return undefined; } var typeAsIterable = type; - if (!typeAsIterable.iterableElementType) { - if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableType()) { - typeAsIterable.iterableElementType = type.typeArguments[0]; + if (isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable) { + return isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable; + } + if (isAsyncIterable) { + if (isReferenceToType(type, getGlobalAsyncIterableType(false)) || + isReferenceToType(type, getGlobalAsyncIterableIteratorType(false))) { + return typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0]; } - else { - var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); - if (isTypeAny(iteratorFunction)) { - return undefined; - } - var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0) : emptyArray; - if (iteratorFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); - } - return undefined; - } - typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), true), errorNode); + } + if (!isAsyncIterable || allowNonAsyncIterables) { + if (isReferenceToType(type, getGlobalIterableType(false)) || + isReferenceToType(type, getGlobalIterableIteratorType(false))) { + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0] + : typeAsIterable.iteratedTypeOfIterable = type.typeArguments[0]; } } - return typeAsIterable.iterableElementType; - } - function getElementTypeOfIterator(type, errorNode) { - if (isTypeAny(type)) { - return undefined; + var iteratorMethodSignatures; + var mayBeIterable = false; + if (isAsyncIterable) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("asyncIterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; + } + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0); } - var typeAsIterator = type; - if (!typeAsIterator.iteratorElementType) { - if ((getObjectFlags(type) & 4) && type.target === getGlobalIteratorType()) { - typeAsIterator.iteratorElementType = type.typeArguments[0]; + if (!isAsyncIterable || (allowNonAsyncIterables && !ts.some(iteratorMethodSignatures))) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; } - else { - var iteratorNextFunction = getTypeOfPropertyOfType(type, "next"); - if (isTypeAny(iteratorNextFunction)) { - return undefined; - } - var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0) : emptyArray; - if (iteratorNextFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method); - } - return undefined; - } - var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), true); - if (isTypeAny(iteratorNextResult)) { - return undefined; - } - var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); - if (!iteratorNextValue) { - if (errorNode) { - error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); - } - return undefined; - } - typeAsIterator.iteratorElementType = iteratorNextValue; + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0); + mayBeIterable = true; + } + if (ts.some(iteratorMethodSignatures)) { + var iteratorMethodReturnType = getUnionType(ts.map(iteratorMethodSignatures, getReturnTypeOfSignature), true); + var iteratedType = getIteratedTypeOfIterator(iteratorMethodReturnType, errorNode, false); + if (checkAssignability && errorNode && iteratedType) { + checkTypeAssignableTo(type, mayBeIterable + ? createIterableType(iteratedType) + : createAsyncIterableType(iteratedType), errorNode); } + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType + : typeAsIterable.iteratedTypeOfIterable = iteratedType; } - return typeAsIterator.iteratorElementType; + if (errorNode) { + error(errorNode, isAsyncIterable + ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); + } + return undefined; } - function getElementTypeOfIterableIterator(type) { + function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (isTypeAny(type)) { return undefined; } - if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableIteratorType()) { - return type.typeArguments[0]; + var typeAsIterator = type; + if (isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator) { + return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator; } - return getElementTypeOfIterable(type, undefined) || - getElementTypeOfIterator(type, undefined); - } - function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { - ts.Debug.assert(languageVersion < 2); - var arrayType = arrayOrStringType; - if (arrayOrStringType.flags & 65536) { - var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); - if (filteredTypes !== arrayTypes) { - arrayType = getUnionType(filteredTypes, true); - } + var getIteratorType = isAsyncIterator ? getGlobalAsyncIteratorType : getGlobalIteratorType; + if (isReferenceToType(type, getIteratorType(false))) { + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = type.typeArguments[0] + : typeAsIterator.iteratedTypeOfIterator = type.typeArguments[0]; } - else if (arrayOrStringType.flags & 262178) { - arrayType = neverType; + var nextMethod = getTypeOfPropertyOfType(type, "next"); + if (isTypeAny(nextMethod)) { + return undefined; } - var hasStringConstituent = arrayOrStringType !== arrayType; - var reportedError = false; - if (hasStringConstituent) { - if (languageVersion < 1) { - error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - reportedError = true; - } - if (arrayType.flags & 8192) { - return stringType; + var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0) : emptyArray; + if (nextMethodSignatures.length === 0) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.An_async_iterator_must_have_a_next_method + : ts.Diagnostics.An_iterator_must_have_a_next_method); } + return undefined; } - if (!isArrayLikeType(arrayType)) { - if (!reportedError) { - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; - error(errorNode, diagnostic, typeToString(arrayType)); + var nextResult = getUnionType(ts.map(nextMethodSignatures, getReturnTypeOfSignature), true); + if (isTypeAny(nextResult)) { + return undefined; + } + if (isAsyncIterator) { + nextResult = getAwaitedTypeOfPromise(nextResult, errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property); + if (isTypeAny(nextResult)) { + return undefined; } - return hasStringConstituent ? stringType : unknownType; } - var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; - if (hasStringConstituent) { - if (arrayElementType.flags & 262178) { - return stringType; + var nextValue = nextResult && getTypeOfPropertyOfType(nextResult, "value"); + if (!nextValue) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property + : ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); } - return getUnionType([arrayElementType, stringType], true); + return undefined; } - return arrayElementType; + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = nextValue + : typeAsIterator.iteratedTypeOfIterator = nextValue; + } + function getIteratedTypeOfGenerator(returnType, isAsyncGenerator) { + if (isTypeAny(returnType)) { + return undefined; + } + return getIteratedTypeOfIterable(returnType, undefined, isAsyncGenerator, false, false) + || getIteratedTypeOfIterator(returnType, undefined, isAsyncGenerator); } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152))); + return !!(node.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { - var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + var unwrappedReturnType = (ts.getFunctionFlags(func) & 3) === 2 + ? getPromisedTypeOfPromise(returnType) + : returnType; return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 | 1); } function checkReturnStatement(node) { @@ -32918,40 +35938,41 @@ var ts; var returnType = getReturnTypeOfSignature(signature); if (strictNullChecks || node.expression || returnType.flags & 8192) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (func.asteriskToken) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1) { return; } - if (func.kind === 152) { + if (func.kind === 153) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { - if (ts.isAsyncFunctionLike(func)) { - var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (functionFlags & 2) { + var promisedType = getPromisedTypeOfPromise(returnType); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288) { + if (node.flags & 16384) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -32970,7 +35991,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 254 && !hasDuplicateDefaultClause) { + if (clause.kind === 257 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -32982,7 +36003,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253) { + if (produceDiagnostics && clause.kind === 256) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -33003,18 +36024,16 @@ var ts; } function checkLabeledStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - var current = node.parent; - while (current) { + ts.findAncestor(node.parent, function (current) { if (ts.isFunctionLike(current)) { - break; + return "quit"; } - if (current.kind === 219 && current.label.text === node.label.text) { + if (current.kind === 221 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); - break; + return true; } - current = current.parent; - } + }); } checkSourceElement(node.statement); } @@ -33041,14 +36060,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -33096,12 +36115,13 @@ var ts; if (!indexType) { return; } - if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + var propDeclaration = prop.valueDeclaration; + if (indexKind === 1 && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } var errorNode; - if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -33126,15 +36146,23 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + var seenDefault = false; + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { + if (node.default) { + seenDefault = true; + } + else if (seenDefault) { + error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + } for (var j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); @@ -33144,22 +36172,56 @@ var ts; } } } - function checkTypeParameterListsIdentical(node, symbol) { + function checkTypeParameterListsIdentical(symbol) { if (symbol.declarations.length === 1) { return; } - var firstDecl; - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 226 || declaration.kind === 227) { - if (!firstDecl) { - firstDecl = declaration; + var links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (declarations.length <= 1) { + return; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { + var name = symbolToString(symbol); + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); } - else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + function areTypeParametersIdentical(declarations, typeParameters) { + var maxTypeArgumentCount = ts.length(typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var numTypeParameters = ts.length(declaration.typeParameters); + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + return false; + } + for (var i = 0; i < numTypeParameters; i++) { + var source = declaration.typeParameters[i]; + var target = typeParameters[i]; + if (source.name.text !== target.symbol.name) { + return false; + } + var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); + var targetConstraint = getConstraintFromTypeParameter(target); + if ((sourceConstraint || targetConstraint) && + (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { + return false; + } + var sourceDefault = source.default && getTypeFromTypeNode(source.default); + var targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + return false; } } } + return true; } function checkClassExpression(node) { checkClassLikeDeclaration(node); @@ -33179,11 +36241,12 @@ var ts; registerForUnusedIdentifiersCheck(node); } function checkClassLikeDeclaration(node) { - checkGrammarClassDeclarationHeritageClauses(node); + checkGrammarClassLikeDeclaration(node); checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -33193,19 +36256,26 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); checkClassForDuplicateDeclarations(node); + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2) { + checkExternalEmitHelpers(baseTypeNode.parent, 1); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); - for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { + for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) { var constructor = _a[_i]; if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { break; @@ -33214,15 +36284,11 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && - !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226) { - if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { - error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); - } + if (baseConstructorType.flags & 540672 && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { - var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 540672)) { + var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } @@ -33241,8 +36307,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 ? t.target : t; - if (getObjectFlags(declaredType) & 3) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -33270,17 +36335,22 @@ var ts; } } function getTargetSymbol(s) { - return s.flags & 16777216 ? getSymbolLinks(s).target : s; + return getCheckFlags(s) & 1 ? s.target : s; } function getClassLikeDeclarationOfSymbol(symbol) { return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } + function getClassOrInterfaceDeclarationsOfSymbol(symbol) { + return ts.filter(symbol.declarations, function (d) { + return d.kind === 228 || d.kind === 229; + }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); - if (base.flags & 134217728) { + if (base.flags & 16777216) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); @@ -33290,7 +36360,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) { - if (derivedClassDecl.kind === 197) { + if (derivedClassDecl.kind === 198) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -33300,66 +36370,37 @@ var ts; } else { var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) { + if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) { continue; } if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) { continue; } - if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { + if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 && derived.flags & 98308) { continue; } var errorMessage = void 0; - if (base.flags & 8192) { + if (isMethodLike(base)) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert((derived.flags & 4) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & 4) { - ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert((base.flags & 98304) !== 0); - ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } - error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + error(derived.valueDeclaration.name || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } } } } function isAccessor(kind) { - return kind === 151 || kind === 152; - } - function areTypeParametersIdentical(list1, list2) { - if (!list1 && !list2) { - return true; - } - if (!list1 || !list2 || list1.length !== list2.length) { - return false; - } - for (var i = 0, len = list1.length; i < len; i++) { - var tp1 = list1[i]; - var tp2 = list2[i]; - if (tp1.name.text !== tp2.name.text) { - return false; - } - if (!tp1.constraint && !tp2.constraint) { - continue; - } - if (!tp1.constraint || !tp2.constraint) { - return false; - } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { - return false; - } - } - return true; + return kind === 152 || kind === 153; } function checkInheritedPropertiesAreIdentical(type, typeNode) { var baseTypes = getBaseTypes(type); @@ -33367,16 +36408,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; - var existing = seen[prop.name]; + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_8 = properties; _a < properties_8.length; _a++) { + var prop = properties_8[_a]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -33400,8 +36441,8 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227); + checkTypeParameterListsIdentical(symbol); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -33497,7 +36538,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190: + case 191: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -33508,7 +36549,7 @@ var ts; case 51: return ~value_1; } return undefined; - case 192: + case 193: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -33532,12 +36573,13 @@ var ts; } return undefined; case 8: + checkGrammarNumericLiteral(e); return +e.text; - case 183: + case 184: return evalConstant(e.expression); case 70: + case 179: case 178: - case 177: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -33548,7 +36590,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178) { + if (e.kind === 179) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -33565,7 +36607,7 @@ var ts; if (current.kind === 70) { break; } - else if (current.kind === 177) { + else if (current.kind === 178) { current = current.expression; } else { @@ -33605,6 +36647,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -33625,7 +36668,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 229) { + if (declaration.kind !== 231) { return false; } var enumDeclaration = declaration; @@ -33646,10 +36689,10 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { - var declaration = declarations_5[_i]; - if ((declaration.kind === 226 || - (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) && + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + if ((declaration.kind === 228 || + (declaration.kind === 227 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -33708,7 +36751,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 226); + var mergedClass = ts.getDeclarationOfKind(symbol, 228); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -33716,7 +36759,7 @@ var ts; } if (isAmbientExternalModule) { if (ts.isExternalModuleAugmentation(node)) { - var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432); + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 134217728); if (checkBody && node.body) { for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { var statement = _a[_i]; @@ -33751,42 +36794,42 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205: + case 207: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240: - case 241: + case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234: - case 235: + case 236: + case 237: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174: - case 223: - var name_25 = node.name; - if (ts.isBindingPattern(name_25)) { - for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { + case 175: + case 225: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 226: - case 229: - case 225: + case 228: + case 231: case 227: + case 229: + case 232: case 230: - case 228: if (isGlobalAugmentation) { return; } var symbol = getSymbolOfNode(node); if (symbol) { - var reportError = !(symbol.flags & 33554432); + var reportError = !(symbol.flags & 134217728); if (!reportError) { reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } @@ -33798,12 +36841,12 @@ var ts; switch (node.kind) { case 70: return node; - case 141: + case 142: do { node = node.left; } while (node.kind !== 70); return node; - case 177: + case 178: do { node = node.expression; } while (node.kind !== 70); @@ -33816,9 +36859,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 ? + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 264 && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -33839,7 +36882,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 ? + var message = node.kind === 245 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -33866,7 +36909,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 239) { checkImportBinding(importClause.namedBindings); } else { @@ -33917,8 +36960,10 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 264 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -33931,7 +36976,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230; + var isInAppropriateContext = node.parent.kind === 264 || node.parent.kind === 233 || node.parent.kind === 232; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -33954,9 +36999,14 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 261 ? node.parent : node.parent.parent; - if (container.kind === 230 && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 264 ? node.parent : node.parent.parent; + if (container.kind === 232 && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { @@ -33979,18 +37029,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -33998,31 +37043,31 @@ var ts; } } var exports = getExportsOfModule(moduleSymbol); - for (var id in exports) { + exports && exports.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports[id], declarations = _a.declarations, flags = _a.flags; if (flags & (1920 | 64 | 384)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 && exportedDeclarationsCount <= 2) { - continue; + return; } if (exportedDeclarationsCount > 1) { - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; if (isNotOverload(declaration)) { diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 && declaration.kind !== 149) || + return (declaration.kind !== 227 && declaration.kind !== 150) || !!declaration.body; } } @@ -34033,123 +37078,123 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 230: - case 226: + case 232: + case 228: + case 229: case 227: - case 225: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143: - return checkTypeParameter(node); case 144: + return checkTypeParameter(node); + case 145: return checkParameter(node); + case 148: case 147: - case 146: return checkPropertyDeclaration(node); - case 158: case 159: - case 153: + case 160: case 154: - return checkSignatureDeclaration(node); case 155: return checkSignatureDeclaration(node); + case 156: + return checkSignatureDeclaration(node); + case 150: case 149: - case 148: return checkMethodDeclaration(node); - case 150: - return checkConstructorDeclaration(node); case 151: + return checkConstructorDeclaration(node); case 152: + case 153: return checkAccessorDeclaration(node); - case 157: + case 158: return checkTypeReferenceNode(node); - case 156: + case 157: return checkTypePredicate(node); - case 160: - return checkTypeQuery(node); case 161: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 162: - return checkArrayType(node); + return checkTypeLiteral(node); case 163: - return checkTupleType(node); + return checkArrayType(node); case 164: + return checkTupleType(node); case 165: - return checkUnionOrIntersectionType(node); case 166: - case 168: - return checkSourceElement(node.type); + return checkUnionOrIntersectionType(node); + case 167: case 169: - return checkIndexedAccessType(node); + return checkSourceElement(node.type); case 170: + return checkIndexedAccessType(node); + case 171: return checkMappedType(node); - case 225: + case 227: return checkFunctionDeclaration(node); - case 204: - case 231: + case 206: + case 233: return checkBlock(node); - case 205: - return checkVariableStatement(node); case 207: - return checkExpressionStatement(node); - case 208: - return checkIfStatement(node); + return checkVariableStatement(node); case 209: - return checkDoStatement(node); + return checkExpressionStatement(node); case 210: - return checkWhileStatement(node); + return checkIfStatement(node); case 211: - return checkForStatement(node); + return checkDoStatement(node); case 212: - return checkForInStatement(node); + return checkWhileStatement(node); case 213: - return checkForOfStatement(node); + return checkForStatement(node); case 214: + return checkForInStatement(node); case 215: - return checkBreakOrContinueStatement(node); + return checkForOfStatement(node); case 216: - return checkReturnStatement(node); case 217: - return checkWithStatement(node); + return checkBreakOrContinueStatement(node); case 218: - return checkSwitchStatement(node); + return checkReturnStatement(node); case 219: - return checkLabeledStatement(node); + return checkWithStatement(node); case 220: - return checkThrowStatement(node); + return checkSwitchStatement(node); case 221: - return checkTryStatement(node); + return checkLabeledStatement(node); + case 222: + return checkThrowStatement(node); case 223: + return checkTryStatement(node); + case 225: return checkVariableDeclaration(node); - case 174: + case 175: return checkBindingElement(node); - case 226: + case 228: return checkClassDeclaration(node); - case 227: + case 229: return checkInterfaceDeclaration(node); - case 228: + case 230: return checkTypeAliasDeclaration(node); - case 229: + case 231: return checkEnumDeclaration(node); - case 230: + case 232: return checkModuleDeclaration(node); - case 235: + case 237: return checkImportDeclaration(node); - case 234: + case 236: return checkImportEqualsDeclaration(node); - case 241: + case 243: return checkExportDeclaration(node); - case 240: + case 242: return checkExportAssignment(node); - case 206: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 222: + case 224: checkGrammarStatementInAmbientContext(node); return; - case 244: + case 246: return checkMissingDeclaration(node); } } @@ -34162,17 +37207,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184: case 185: + case 186: + case 150: case 149: - case 148: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151: case 152: - checkAccessorDeferred(node); + case 153: + checkAccessorDeclaration(node); break; - case 197: + case 198: checkClassExpressionDeferred(node); break; } @@ -34192,6 +37237,7 @@ var ts; } checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -34211,6 +37257,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1; } } @@ -34255,7 +37305,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 && node.parent.statement === node) { + if (node.parent.kind === 219 && node.parent.statement === node) { return true; } node = node.parent; @@ -34264,11 +37314,11 @@ var ts; return false; } function getSymbolsInScope(location, meaning) { - var symbols = ts.createMap(); - var memberFlags = 0; if (isInsideWithStatementBody(location)) { return []; } + var symbols = ts.createMap(); + var memberFlags = 0; populateSymbols(); return symbolsToArray(symbols); function populateSymbols() { @@ -34277,28 +37327,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261: + case 264: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: + case 232: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 229: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 197: + case 198: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 226: - case 227: + case 228: + case 229: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } break; - case 184: + case 185: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -34316,17 +37366,16 @@ var ts; function copySymbol(symbol, meaning) { if (symbol.flags & meaning) { var id = symbol.name; - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -34337,27 +37386,27 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143: - case 226: - case 227: + case 144: case 228: case 229: + case 230: + case 231: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141) { + while (node.parent && node.parent.kind === 142) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 272); + return node.parent && (node.parent.kind === 158 || node.parent.kind === 276); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177) { + while (node.parent && node.parent.kind === 178) { node = node.parent; } - return node.parent && node.parent.kind === 199; + return node.parent && node.parent.kind === 200; } function forEachEnclosingClass(node, callback) { var result; @@ -34374,13 +37423,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141) { + while (nodeOnRightSide.parent.kind === 142) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234) { + if (nodeOnRightSide.parent.kind === 236) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -34388,27 +37437,35 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } + function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1: + case 3: + return getSymbolOfNode(entityName.parent); + case 4: + case 2: + case 5: + return getSymbolOfNode(entityName.parent.parent); + } + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) { - var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); - switch (specialPropertyAssignmentKind) { - case 1: - case 3: - return getSymbolOfNode(entityName.parent); - case 4: - case 2: - return getSymbolOfNode(entityName.parent.parent); - default: + if (ts.isInJavaScriptFile(entityName) && + entityName.parent.kind === 178 && + entityName.parent === entityName.parent.parent.left) { + var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); + if (specialPropertyAssignmentSymbol) { + return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } - if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 234); + if (entityName.kind !== 178 && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 236); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -34417,7 +37474,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 199) { + if (entityName.parent.kind === 200) { meaning = 793064; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -34427,9 +37484,12 @@ var ts; meaning = 1920; } meaning |= 8388608; - return resolveEntityName(entityName, meaning); + var entityNameSymbol = resolveEntityName(entityName, meaning); + if (entityNameSymbol) { + return entityNameSymbol; + } } - else if (ts.isPartOfExpression(entityName)) { + if (ts.isPartOfExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } @@ -34439,14 +37499,14 @@ var ts; } return resolveEntityName(entityName, 107455, false, true); } - else if (entityName.kind === 177) { + else if (entityName.kind === 178) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141) { + else if (entityName.kind === 142) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -34455,19 +37515,19 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 158 || entityName.parent.kind === 276) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 250) { + else if (entityName.parent.kind === 252) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261) { + if (node.kind === 264) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -34483,8 +37543,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 && - node.parent.parent.kind === 172 && + else if (node.parent.kind === 175 && + node.parent.parent.kind === 173 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -34495,8 +37555,8 @@ var ts; } switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98: var container = ts.getThisContainer(node, false); @@ -34509,18 +37569,18 @@ var ts; case 96: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167: + case 168: return getTypeFromTypeNode(node).symbol; case 122: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150) { + if (constructorDeclaration && constructorDeclaration.kind === 151) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 || node.parent.kind === 241) && + ((node.parent.kind === 237 || node.parent.kind === 243) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -34528,7 +37588,7 @@ var ts; return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 178 && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -34542,7 +37602,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 258) { + if (location && location.kind === 261) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -34557,13 +37617,22 @@ var ts; return unknownType; } if (ts.isPartOfTypeNode(node)) { - return getTypeFromTypeNode(node); + var typeFromTypeNode = getTypeFromTypeNode(node); + if (typeFromTypeNode && ts.isExpressionWithTypeArgumentsInClassImplementsClause(node)) { + var containingClass = ts.getContainingClass(node); + var classType = getTypeOfNode(containingClass); + typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType); + } + return typeFromTypeNode; } if (ts.isPartOfExpression(node)) { return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { - return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; + var classNode = ts.getContainingClass(node); + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)); + var baseType = getBaseTypes(classType)[0]; + return baseType && getTypeWithThisArgument(baseType, classType.thisType); } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); @@ -34592,22 +37661,22 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 213) { - var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + ts.Debug.assert(expr.kind === 177 || expr.kind === 176); + if (expr.parent.kind === 215) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 192) { + if (expr.parent.kind === 193) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 257) { + if (expr.parent.kind === 260) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 175); + ts.Debug.assert(expr.parent.kind === 176); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); } function getPropertySymbolOfDestructuringAssignment(location) { @@ -34631,29 +37700,32 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 268435456) { + if (getCheckFlags(symbol) & 6) { var symbols_3 = []; - var name_26 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_26); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } }); return symbols_3; } - else if (symbol.flags & 67108864) { + else if (symbol.flags & 134217728) { if (symbol.leftSpread) { var links = symbol; - return [links.leftSpread, links.rightSpread]; + return getRootSymbols(links.leftSpread).concat(getRootSymbols(links.rightSpread)); + } + if (symbol.syntheticOrigin) { + return getRootSymbols(symbol.syntheticOrigin); } var target = void 0; var next = symbol; @@ -34670,7 +37742,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -34686,7 +37759,7 @@ var ts; if (symbolLinks.exportsSomeValue === undefined) { symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -34710,19 +37783,15 @@ var ts; } symbol = exportSymbol; } - var parentSymbol = getParentOfSymbol(symbol); - if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) { - var symbolFile = parentSymbol.valueDeclaration; + var parentSymbol_1 = getParentOfSymbol(symbol); + if (parentSymbol_1) { + if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 264) { + var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; return symbolIsUmdExport ? undefined : symbolFile; } - for (var n = node.parent; n; n = n.parent) { - if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) { - return n; - } - } + return ts.findAncestor(node.parent, function (n) { return ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1; }); } } } @@ -34750,7 +37819,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 206 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -34785,21 +37854,17 @@ var ts; return false; } function isValueAliasDeclaration(node) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - return true; - } switch (node.kind) { - case 234: case 236: - case 237: + case 238: case 239: - case 243: - return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); case 241: + case 245: + return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); + case 243: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240: + case 242: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -34809,7 +37874,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 264 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -34827,10 +37892,6 @@ var ts; return isConstEnumSymbol(s) || s.constEnumOnlyModule; } function isReferencedAliasDeclaration(node, checkChildren) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - return true; - } if (ts.isAliasSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node); if (symbol && getSymbolLinks(symbol).referenced) { @@ -34851,16 +37912,30 @@ var ts; } return false; } + function isRequiredInitializedParameter(parameter) { + return strictNullChecks && + !isOptionalParameter(parameter) && + parameter.initializer && + !(ts.getModifierFlags(parameter) & 92); + } function getNodeCheckFlags(node) { - node = ts.getParseTreeNode(node); - return node ? getNodeLinks(node).flags : undefined; + return getNodeLinks(node).flags; } function getEnumMemberValue(node) { computeEnumMemberValues(node.parent); return getNodeLinks(node).enumMemberValue; } + function canHaveConstantValue(node) { + switch (node.kind) { + case 263: + case 178: + case 179: + return true; + } + return false; + } function getConstantValue(node) { - if (node.kind === 260) { + if (node.kind === 263) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -34876,15 +37951,17 @@ var ts; } function getTypeReferenceSerializationKind(typeName, location) { var valueSymbol = resolveEntityName(typeName, 107455, true, false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } var typeSymbol = resolveEntityName(typeName, 793064, true, false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(false); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; } @@ -34928,6 +38005,9 @@ var ts; var type = symbol && !(symbol.flags & (2048 | 131072)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : unknownType; + if (flags & 4096) { + type = includeFalsyTypes(type, 2048); + } getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -34942,10 +38022,13 @@ var ts; var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); resolveBaseTypesOfClass(classType); var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + if (!baseType.symbol) { + writer.reportIllegalExtends(); + } getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -34954,9 +38037,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -34989,34 +38072,46 @@ var ts; var fileToDirective; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, isDeclarationWithCollidingName: isDeclarationWithCollidingName, - isValueAliasDeclaration: isValueAliasDeclaration, + isValueAliasDeclaration: function (node) { + node = ts.getParseTreeNode(node); + return node ? isValueAliasDeclaration(node) : true; + }, hasGlobalName: hasGlobalName, - isReferencedAliasDeclaration: isReferencedAliasDeclaration, - getNodeCheckFlags: getNodeCheckFlags, + isReferencedAliasDeclaration: function (node, checkChildren) { + node = ts.getParseTreeNode(node); + return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + }, + getNodeCheckFlags: function (node) { + node = ts.getParseTreeNode(node); + return node ? getNodeCheckFlags(node) : undefined; + }, isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, + isRequiredInitializedParameter: isRequiredInitializedParameter, writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, - getConstantValue: getConstantValue, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, collectLinkedAliases: collectLinkedAliases, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, @@ -35034,7 +38129,7 @@ var ts; if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node)) + var meaning = (node.kind === 178) || (node.kind === 70 && isInTypeQuery(node)) ? 107455 | 1048576 : 793064 | 1920; var symbol = resolveEntityName(node, meaning, true); @@ -35069,15 +38164,15 @@ var ts; } var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 264 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -35096,7 +38191,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261); + return ts.getDeclarationOfKind(moduleSymbol, 264); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -35104,8 +38199,6 @@ var ts; ts.bindSourceFile(file, compilerOptions); } var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -35119,20 +38212,11 @@ var ts; } if (file.symbol && file.symbol.globalExports) { var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; - } - } - } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } if (augmentations) { @@ -35146,116 +38230,80 @@ var ts; } addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedWideningType; - getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", 0, true); getSymbolLinks(unknownSymbol).type = unknownType; - globalArrayType = getGlobalType("Array", 1); - globalObjectType = getGlobalType("Object"); - globalFunctionType = getGlobalType("Function"); - globalStringType = getGlobalType("String"); - globalNumberType = getGlobalType("Number"); - globalBooleanType = getGlobalType("Boolean"); - globalRegExpType = getGlobalType("RegExp"); - jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); - getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); }); - getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); - getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); - getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); - getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); - getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); - getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); - tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793064, undefined) && getGlobalPromiseType(); }); - getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); - getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); - getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); - tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol("Promise", 107455, undefined) && getGlobalPromiseConstructorSymbol(); }); - getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); - getGlobalThenableType = ts.memoize(createThenableType); - getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); - if (languageVersion >= 2) { - getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); - getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); - getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); - getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); - } - else { - getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); - getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); - } + globalArrayType = getGlobalType("Array", 1, true); + globalObjectType = getGlobalType("Object", 0, true); + globalFunctionType = getGlobalType("Function", 0, true); + globalStringType = getGlobalType("String", 0, true); + globalNumberType = getGlobalType("Number", 0, true); + globalBooleanType = getGlobalType("Boolean", 0, true); + globalRegExpType = getGlobalType("RegExp", 0, true); anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); - var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined); - globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); + globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, undefined); - if (helpersModule) { - var exports = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 && languageVersion < 2) { - verifyHelperSymbol(exports, "__extends", 107455); - } - if (requestedExternalEmitHelpers & 16384 && - (languageVersion < 5 || compilerOptions.jsx === 2)) { - verifyHelperSymbol(exports, "__assign", 107455); - } - if (languageVersion < 5 && requestedExternalEmitHelpers & 32768) { - verifyHelperSymbol(exports, "__rest", 107455); - } - if (requestedExternalEmitHelpers & 2048) { - verifyHelperSymbol(exports, "__decorate", 107455); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", 107455); - } - } - if (requestedExternalEmitHelpers & 4096) { - verifyHelperSymbol(exports, "__param", 107455); - } - if (requestedExternalEmitHelpers & 8192) { - verifyHelperSymbol(exports, "__awaiter", 107455); - if (languageVersion < 2) { - verifyHelperSymbol(exports, "__generator", 107455); + globalThisType = getGlobalTypeOrUndefined("ThisType", 1); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !ts.isInAmbientContext(location)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1; helper <= 8192; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1: return "__extends"; + case 2: return "__assign"; + case 4: return "__rest"; + case 8: return "__decorate"; + case 16: return "__metadata"; + case 32: return "__param"; + case 64: return "__awaiter"; + case 128: return "__generator"; + case 256: return "__values"; + case 512: return "__read"; + case 1024: return "__spread"; + case 2048: return "__asyncGenerator"; + case 4096: return "__asyncDelegator"; + case 8192: return "__asyncValues"; + default: ts.Debug.fail("Unrecognized helper."); } } - function createInstantiatedPromiseLikeType() { - var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyGenericType) { - return createTypeReference(promiseLikeType, [anyType]); + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; } - return emptyObjectType; - } - function createThenableType() { - var thenPropertySymbol = createSymbol(67108864 | 4, "then"); - getSymbolLinks(thenPropertySymbol).type = globalFunctionType; - var thenableType = createObjectType(16); - thenableType.properties = [thenPropertySymbol]; - thenableType.members = createSymbolTable(thenableType.properties); - thenableType.callSignatures = []; - thenableType.constructSignatures = []; - return thenableType; + return externalHelpersModule; } function checkGrammarDecorators(node) { if (!node.decorators) { return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 || node.kind === 152) { + else if (node.kind === 152 || node.kind === 153) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -35273,16 +38321,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130) { - if (node.kind === 146 || node.kind === 148) { + if (node.kind === 147 || node.kind === 149) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155) { + if (node.kind === 156) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75: - if (node.kind !== 229 && node.parent.kind === 226) { + if (node.kind !== 231 && node.parent.kind === 228) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -35308,7 +38356,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 233 || node.parent.kind === 264) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -35331,10 +38379,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 233 || node.parent.kind === 264) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -35347,7 +38395,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) { + else if (node.kind !== 148 && node.kind !== 147 && node.kind !== 156 && node.kind !== 145) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -35366,10 +38414,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -35381,13 +38429,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -35397,14 +38445,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226) { - if (node.kind !== 149 && - node.kind !== 147 && - node.kind !== 151 && - node.kind !== 152) { + if (node.kind !== 228) { + if (node.kind !== 150 && + node.kind !== 148 && + node.kind !== 152 && + node.kind !== 153) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 228 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -35423,7 +38471,7 @@ var ts; else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -35431,7 +38479,7 @@ var ts; break; } } - if (node.kind === 150) { + if (node.kind === 151) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -35446,13 +38494,13 @@ var ts; } return; } - else if ((node.kind === 235 || node.kind === 234) && flags & 2) { + else if ((node.kind === 237 || node.kind === 236) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) { + else if (node.kind === 145 && (flags & 92) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256) { @@ -35468,37 +38516,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151: case 152: - case 150: + case 153: + case 151: + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 155: - case 230: - case 235: - case 234: - case 241: - case 240: - case 184: + case 156: + case 232: + case 237: + case 236: + case 243: + case 242: case 185: - case 144: + case 186: + case 145: return false; default: - if (node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 233 || node.parent.kind === 264) { return false; } switch (node.kind) { - case 225: - return nodeHasAnyModifiersExcept(node, 119); - case 226: - return nodeHasAnyModifiersExcept(node, 116); case 227: - case 205: + return nodeHasAnyModifiersExcept(node, 119); case 228: - return true; + return nodeHasAnyModifiersExcept(node, 116); case 229: + case 207: + case 230: + return true; + case 231: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -35511,14 +38559,11 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149: - case 225: - case 184: + case 150: + case 227: case 185: - if (!node.asteriskToken) { - return false; - } - break; + case 186: + return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } @@ -35575,8 +38620,12 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } + function checkGrammarClassLikeDeclaration(node) { + var file = ts.getSourceFileOfNode(node); + return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file); + } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185) { + if (node.kind === 186) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -35611,7 +38660,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 134 && parameter.type.kind !== 132) { + if (parameter.type.kind !== 135 && parameter.type.kind !== 132) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -35638,7 +38687,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198) { + if (arg.kind === 199) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -35708,28 +38757,25 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 142) { + if (node.kind !== 143) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) { + if (computedPropertyName.expression.kind === 193 && computedPropertyName.expression.operatorToken.kind === 25) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 || - node.kind === 184 || - node.kind === 149); + ts.Debug.assert(node.kind === 227 || + node.kind === 185 || + node.kind === 150); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } - if (languageVersion < 2) { - return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher); - } } } function checkGrammarForInvalidQuestionMark(questionToken, message) { @@ -35745,87 +38791,87 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259) { + if (prop.kind === 262) { continue; } - var name_27 = prop.name; - if (name_27.kind === 142) { - checkGrammarComputedPropertyName(name_27); + var name = prop.name; + if (name.kind === 143) { + checkGrammarComputedPropertyName(name); } - if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 261 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 || prop.kind !== 149) { + if (mod.kind !== 119 || prop.kind !== 150) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } } var currentKind = void 0; - if (prop.kind === 257 || prop.kind === 258) { + if (prop.kind === 260 || prop.kind === 261) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_27.kind === 8) { - checkGrammarNumericLiteral(name_27); + if (name.kind === 8) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149) { + else if (prop.kind === 150) { currentKind = Property; } - else if (prop.kind === 151) { + else if (prop.kind === 152) { currentKind = GetAccessor; } - else if (prop.kind === 152) { + else if (prop.kind === 153) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_27); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_27, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_27)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } } function checkGrammarJsxElement(node) { var seen = ts.createMap(); - for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { + for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251) { + if (attr.kind === 254) { continue; } var jsxAttr = attr; - var name_28 = jsxAttr.name; - if (!seen[name_28.text]) { - seen[name_28.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 && !initializer.expression) { + if (initializer && initializer.kind === 255 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -35834,7 +38880,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224) { + if (forInOrOfStatement.kind === 215 && forInOrOfStatement.awaitModifier) { + if ((forInOrOfStatement.flags & 16384) === 0) { + return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + } + } + if (forInOrOfStatement.initializer.kind === 226) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -35842,20 +38893,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -35875,15 +38926,18 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 ? + return grammarErrorOnNode(accessor.name, kind === 152 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152) { + else if (kind === 153) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -35902,10 +38956,10 @@ var ts; } } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -35920,7 +38974,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176) { + if (node.parent.kind === 177) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -35936,10 +38990,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 229) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -35950,9 +39004,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219: + case 221: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 214 + var isMisplacedContinueLabel = node.kind === 216 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -35960,8 +39014,8 @@ var ts; return false; } break; - case 218: - if (node.kind === 215 && !node.label) { + case 220: + if (node.kind === 217 && !node.label) { return false; } break; @@ -35974,13 +39028,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 + var message = node.kind === 217 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 215 + var message = node.kind === 217 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -35992,7 +39046,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 || node.name.kind === 172) { + if (node.name.kind === 174 || node.name.kind === 173) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -36002,11 +39056,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) { + if (node.parent.parent.kind !== 214 && node.parent.parent.kind !== 215) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -36033,9 +39087,29 @@ var ts; } } } + if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && + !ts.isInAmbientContext(node.parent.parent) && ts.hasModifier(node.parent.parent, 1)) { + checkESModuleMarker(node.name); + } var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } + function checkESModuleMarker(name) { + if (name.kind === 70) { + if (ts.unescapeIdentifier(name.text) === "__esModule") { + return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); + } + } + else { + var elements = name.elements; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; + if (!ts.isOmittedExpression(element)) { + return checkESModuleMarker(element.name); + } + } + } + } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 70) { if (name.originalKeywordKind === 109) { @@ -36044,8 +39118,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { - var element = elements_2[_i]; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var element = elements_3[_i]; if (!ts.isOmittedExpression(element)) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -36063,15 +39137,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208: - case 209: case 210: - case 217: case 211: case 212: + case 219: case 213: + case 214: + case 215: return false; - case 219: + case 221: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -36086,6 +39160,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -36126,7 +39207,7 @@ var ts; return true; } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 229) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -36134,7 +39215,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -36147,13 +39228,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 227 || - node.kind === 228 || + if (node.kind === 229 || + node.kind === 230 || + node.kind === 237 || + node.kind === 236 || + node.kind === 243 || + node.kind === 242 || node.kind === 235 || - node.kind === 234 || - node.kind === 241 || - node.kind === 240 || - node.kind === 233 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -36162,7 +39243,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205) { + if (ts.isDeclaration(decl) || decl.kind === 207) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -36181,7 +39262,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 204 || node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 206 || node.parent.kind === 233 || node.parent.kind === 264) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -36192,8 +39273,22 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.isOctalLiteral && languageVersion >= 1) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.numericLiteralFlags & 4) { + var diagnosticMessage = void 0; + if (languageVersion >= 1) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 172)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 263)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -36206,11 +39301,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -36218,55 +39313,359 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ; - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[229] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[230] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[231] = [ - { name: "statements", test: ts.isStatement } - ], - _a[234] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[245] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[260] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); + function visitNode(node, visitor, test, lift) { + if (node === undefined || visitor === undefined) { + return node; + } + ts.aggregateTransformFlags(node); + var visited = visitor(node); + if (visited === node) { + return node; + } + var visitedNode; + if (visited === undefined) { + return undefined; + } + else if (ts.isArray(visited)) { + visitedNode = (lift || extractSingleNode)(visited); + } + else { + visitedNode = visited; + } + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); + return visitedNode; + } + ts.visitNode = visitNode; + function visitNodes(nodes, visitor, test, start, count) { + if (nodes === undefined || visitor === undefined) { + return nodes; + } + var updated; + var length = nodes.length; + if (start === undefined || start < 0) { + start = 0; + } + if (count === undefined || count > length - start) { + count = length - start; + } + if (start > 0 || count < length) { + updated = ts.createNodeArray([], nodes.hasTrailingComma && start + count === length); + } + for (var i = 0; i < count; i++) { + var node = nodes[i + start]; + ts.aggregateTransformFlags(node); + var visited = node !== undefined ? visitor(node) : undefined; + if (updated !== undefined || visited === undefined || visited !== node) { + if (updated === undefined) { + updated = ts.createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma); + ts.setTextRange(updated, nodes); + } + if (visited) { + if (ts.isArray(visited)) { + for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { + var visitedNode = visited_1[_i]; + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); + updated.push(visitedNode); + } + } + else { + ts.Debug.assertNode(visited, test); + ts.aggregateTransformFlags(visited); + updated.push(visited); + } + } + } + } + return updated || nodes; + } + ts.visitNodes = visitNodes; + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, ts.isStatement, start); + if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { + statements = ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements)), statements); + } + var declarations = context.endLexicalEnvironment(); + return ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements); + } + ts.visitLexicalEnvironment = visitLexicalEnvironment; + function visitParameterList(nodes, visitor, context, nodesVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + context.startLexicalEnvironment(); + var updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + ts.visitParameterList = visitParameterList; + function visitFunctionBody(node, visitor, context) { + context.resumeLexicalEnvironment(); + var updated = visitNode(node, visitor, ts.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(updated); + var statements = ts.mergeLexicalEnvironment(block.statements, declarations); + return ts.updateBlock(block, statements); + } + return updated; + } + ts.visitFunctionBody = visitFunctionBody; + function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + if (node === undefined) { + return undefined; + } + var kind = node.kind; + if ((kind > 0 && kind <= 141) || kind === 168) { + return node; + } + switch (node.kind) { + case 205: + case 208: + case 199: + case 224: + case 297: + case 246: + return node; + case 142: + return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier)); + case 143: + return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); + case 159: + return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 160: + return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 154: + return ts.updateCallSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 155: + return ts.updateConstructSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 149: + return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); + case 156: + return ts.updateIndexSignatureDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 145: + return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 146: + return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression)); + case 158: + return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + case 157: + return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 161: + return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName)); + case 162: + return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor)); + case 163: + return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode)); + case 164: + return ts.updateTypleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode)); + case 165: + case 166: + return ts.updateUnionOrIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + case 167: + throw ts.Debug.fail("not implemented."); + case 169: + return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode)); + case 170: + return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode)); + case 171: + return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameter), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); + case 172: + return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); + case 144: + return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode)); + case 147: + return ts.updatePropertySignature(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 148: + return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 150: + return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 151: + return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); + case 152: + return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 153: + return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); + case 173: + return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + case 174: + return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + case 175: + return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); + case 176: + return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + case 177: + return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + case 178: + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + case 179: + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + case 180: + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 181: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 182: + return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); + case 183: + return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 184: + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); + case 185: + return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 186: + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 187: + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + case 188: + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + case 189: + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + case 190: + return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); + case 193: + return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); + case 191: + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 192: + return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 194: + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); + case 195: + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + case 196: + return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); + case 197: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 198: + return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 200: + return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 201: + return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); + case 202: + return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + case 204: + return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + case 206: + return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 207: + return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); + case 209: + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); + case 210: + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); + case 211: + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + case 212: + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 213: + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 214: + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 215: + return ts.updateForOf(node, node.awaitModifier, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 216: + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 217: + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 218: + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); + case 219: + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 220: + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + case 221: + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 222: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 223: + return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); + case 225: + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 226: + return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + case 227: + return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 228: + return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 231: + return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + case 232: + return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); + case 233: + return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 234: + return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + case 236: + return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); + case 237: + return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 238: + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); + case 239: + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + case 240: + return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + case 241: + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + case 242: + return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + case 243: + return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 244: + return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + case 245: + return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + case 247: + return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); + case 248: + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + case 253: + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + case 249: + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 250: + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 251: + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + case 252: + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + case 254: + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + case 255: + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + case 256: + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + case 257: + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 258: + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + case 259: + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + case 260: + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 261: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 262: + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + case 263: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 264: + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); + case 295: + return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + default: + return node; + } + } + ts.visitEachChild = visitEachChild; + function extractSingleNode(nodes) { + ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return ts.singleOrUndefined(nodes); + } +})(ts || (ts = {})); +(function (ts) { function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } @@ -36280,41 +39679,45 @@ var ts; var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return initial; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return initial; } var result = initial; switch (node.kind) { - case 203: - case 206: - case 198: - case 222: - case 293: + case 205: + case 208: + case 199: + case 224: + case 294: break; case 142: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 143: result = reduceNode(node.expression, cbNode, result); break; - case 144: + case 145: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 145: + case 146: result = reduceNode(node.expression, cbNode, result); break; - case 147: + case 148: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 149: + case 150: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36323,12 +39726,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 150: + case 151: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 151: + case 152: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36336,51 +39739,55 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 152: + case 153: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 172: case 173: + case 174: result = reduceNodes(node.elements, cbNodes, result); break; - case 174: + case 175: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 175: + case 176: result = reduceNodes(node.elements, cbNodes, result); break; - case 176: + case 177: result = reduceNodes(node.properties, cbNodes, result); break; - case 177: + case 178: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 178: + case 179: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 179: + case 180: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 180: + case 181: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 181: + case 182: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 184: + case 183: + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 185: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -36388,117 +39795,124 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 185: + case 186: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 183: - case 186: + case 184: case 187: case 188: case 189: - case 195: + case 190: case 196: - case 201: + case 197: + case 202: result = reduceNode(node.expression, cbNode, result); break; - case 190: case 191: + case 192: result = reduceNode(node.operand, cbNode, result); break; - case 192: + case 193: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 193: + case 194: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 194: + case 195: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 197: + case 198: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 199: + case 200: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; + case 201: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.type, cbNode, result); + break; case 202: result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.literal, cbNode, result); break; case 204: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); + break; + case 206: result = reduceNodes(node.statements, cbNodes, result); break; - case 205: + case 207: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 207: + case 209: result = reduceNode(node.expression, cbNode, result); break; - case 208: + case 210: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 209: + case 211: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 210: - case 217: + case 212: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 211: + case 213: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: - case 213: + case 214: + case 215: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 216: - case 220: + case 218: + case 222: result = reduceNode(node.expression, cbNode, result); break; - case 218: + case 220: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 219: + case 221: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 221: + case 223: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 223: + case 225: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 224: + case 226: result = reduceNodes(node.declarations, cbNodes, result); break; - case 225: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36507,7 +39921,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 226: + case 228: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36515,455 +39929,145 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; + case 231: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.members, cbNodes, result); + break; case 232: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 233: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 234: result = reduceNodes(node.clauses, cbNodes, result); break; - case 235: + case 236: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.moduleReference, cbNode, result); + break; + case 237: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 236: + case 238: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 237: + case 239: result = reduceNode(node.name, cbNode, result); break; - case 238: - case 242: + case 240: + case 244: result = reduceNodes(node.elements, cbNodes, result); break; - case 239: - case 243: + case 241: + case 245: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 240: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 241: + case 243: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 246: + case 247: + result = reduceNode(node.expression, cbNode, result); + break; + case 248: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 247: - case 248: + case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); - result = reduceNodes(node.attributes, cbNodes, result); + result = reduceNode(node.attributes, cbNode, result); break; - case 249: + case 253: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 251: result = reduceNode(node.tagName, cbNode, result); break; - case 250: + case 252: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 251: + case 254: result = reduceNode(node.expression, cbNode, result); break; - case 252: + case 255: result = reduceNode(node.expression, cbNode, result); break; - case 253: + case 256: result = reduceNode(node.expression, cbNode, result); - case 254: + case 257: result = reduceNodes(node.statements, cbNodes, result); break; - case 255: + case 258: result = reduceNodes(node.types, cbNodes, result); break; - case 256: + case 259: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 257: + case 260: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 258: + case 261: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 259: + case 262: result = reduceNode(node.expression, cbNode, result); break; - case 261: + case 263: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 264: result = reduceNodes(node.statements, cbNodes, result); break; - case 294: + case 295: result = reduceNode(node.expression, cbNode, result); break; default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { - var edge = edgeTraversalPath_1[_i]; - var value = node[edge.name]; - if (value !== undefined) { - result = ts.isArray(value) - ? reduceNodes(value, cbNodes, result) - : cbNode(result, value); - } - } - } break; } return result; } ts.reduceEachChild = reduceEachChild; - function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { - if (node === undefined || visitor === undefined) { - return node; - } - aggregateTransformFlags(node); - var visited = visitor(node); - if (visited === node) { - return node; - } - var visitedNode; - if (visited === undefined) { - if (!optional) { - Debug.failNotOptional(); - } - return undefined; - } - else if (ts.isArray(visited)) { - visitedNode = (lift || extractSingleNode)(visited); - } - else { - visitedNode = visited; - } - if (parenthesize !== undefined) { - visitedNode = parenthesize(visitedNode, parentNode); + function mergeLexicalEnvironment(statements, declarations) { + if (!ts.some(declarations)) { + return statements; } - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - return visitedNode; - } - ts.visitNode = visitNode; - function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) { - if (nodes === undefined) { - return undefined; - } - var updated; - var length = nodes.length; - if (start === undefined || start < 0) { - start = 0; - } - if (count === undefined || count > length - start) { - count = length - start; - } - if (start > 0 || count < length) { - updated = ts.createNodeArray([], undefined, nodes.hasTrailingComma && start + count === length); - } - for (var i = 0; i < count; i++) { - var node = nodes[i + start]; - aggregateTransformFlags(node); - var visited = node !== undefined ? visitor(node) : undefined; - if (updated !== undefined || visited === undefined || visited !== node) { - if (updated === undefined) { - updated = ts.createNodeArray(nodes.slice(0, i), nodes, nodes.hasTrailingComma); - } - if (visited) { - if (ts.isArray(visited)) { - for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { - var visitedNode = visited_1[_i]; - visitedNode = parenthesize - ? parenthesize(visitedNode, parentNode) - : visitedNode; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); - } - } - else { - var visitedNode = parenthesize - ? parenthesize(visited, parentNode) - : visited; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); - } - } - } - } - return updated || nodes; - } - ts.visitNodes = visitNodes; - function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { - context.startLexicalEnvironment(); - statements = visitNodes(statements, visitor, ts.isStatement, start); - if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { - statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); - } - var declarations = context.endLexicalEnvironment(); - return ts.createNodeArray(ts.concatenate(statements, declarations), statements); - } - ts.visitLexicalEnvironment = visitLexicalEnvironment; - function visitParameterList(nodes, visitor, context) { - context.startLexicalEnvironment(); - var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); - context.suspendLexicalEnvironment(); - return updated; - } - ts.visitParameterList = visitParameterList; - function visitFunctionBody(node, visitor, context) { - context.resumeLexicalEnvironment(); - var updated = visitNode(node, visitor, ts.isConciseBody); - var declarations = context.endLexicalEnvironment(); - if (ts.some(declarations)) { - var block = ts.convertToFunctionBody(updated); - var statements = mergeLexicalEnvironment(block.statements, declarations); - return ts.updateBlock(block, statements); - } - return updated; - } - ts.visitFunctionBody = visitFunctionBody; - function visitEachChild(node, visitor, context) { - if (node === undefined) { - return undefined; - } - var kind = node.kind; - if ((kind > 0 && kind <= 140)) { - return node; - } - if ((kind >= 156 && kind <= 171)) { - return node; - } - switch (node.kind) { - case 203: - case 206: - case 198: - case 222: - return node; - case 142: - return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); - case 144: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 147: - return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 152: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 172: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); - case 173: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); - case 174: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 175: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); - case 176: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 177: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 178: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 179: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 180: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 181: - return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 186: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 187: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 188: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 189: - return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192: - return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 191: - return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 194: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); - case 195: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 197: - return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199: - return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 202: - return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 204: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 205: - return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); - case 209: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 210: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 211: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 212: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 213: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 214: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); - case 215: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); - case 216: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); - case 217: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 218: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 219: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 220: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 221: - return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 223: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 224: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 226: - return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232: - return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 236: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); - case 237: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 238: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 239: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 240: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 241: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); - case 242: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 243: - return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 246: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 247: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 248: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 250: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 251: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 252: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 253: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 254: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 255: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 256: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); - case 257: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 258: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 259: - return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 261: - return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 294: - return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - default: - var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { - var edge = edgeTraversalPath_2[_i]; - var value = node[edge.name]; - if (value !== undefined) { - var visited = ts.isArray(value) - ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node) - : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node); - if (updated !== undefined || visited !== value) { - if (updated === undefined) { - updated = ts.getMutableClone(node); - } - if (visited !== value) { - updated[edge.name] = visited; - } - } - } - } - } - return updated ? ts.updateNode(updated, node) : node; - } - } - ts.visitEachChild = visitEachChild; - function mergeLexicalEnvironment(statements, declarations) { - if (!ts.some(declarations)) { - return statements; - } - return ts.isNodeArray(statements) - ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) - : ts.addRange(statements, declarations); + return ts.isNodeArray(statements) + ? ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements) + : ts.addRange(statements, declarations); } ts.mergeLexicalEnvironment = mergeLexicalEnvironment; - function mergeFunctionBodyLexicalEnvironment(body, declarations) { - if (body && declarations !== undefined && declarations.length > 0) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements)); - } - else { - return ts.createBlock(ts.createNodeArray([ts.createReturn(body, body)].concat(declarations), body), body, true); - } - } - return body; - } - ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment; function liftToBlock(nodes) { Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block."); return ts.singleOrUndefined(nodes) || ts.createBlock(nodes); } ts.liftToBlock = liftToBlock; - function extractSingleNode(nodes) { - Debug.assert(nodes.length <= 1, "Too many nodes written to output."); - return ts.singleOrUndefined(nodes); - } function aggregateTransformFlags(node) { aggregateTransformFlagsForNode(node); return node; @@ -36994,7 +40098,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 200)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -37007,9 +40111,6 @@ var ts; } var Debug; (function (Debug) { - Debug.failNotOptional = Debug.shouldAssert(1) - ? function (message) { return Debug.assert(false, message || "Node not optional."); } - : ts.noop; Debug.failBadSyntaxKind = Debug.shouldAssert(1) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; @@ -37042,7 +40143,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); var ts; (function (ts) { @@ -37051,7 +40151,7 @@ var ts; var value; if (ts.isDestructuringAssignment(node)) { value = node.right; - while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + while (ts.isEmptyArrayLiteral(node.left) || ts.isEmptyObjectLiteral(node.left)) { if (ts.isDestructuringAssignment(value)) { location = node = value; value = node.right; @@ -37065,6 +40165,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: true, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -37099,7 +40200,7 @@ var ts; ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); var expression = createAssignmentCallback ? createAssignmentCallback(target, value, location) - : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + : ts.setTextRange(ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value), location); expression.original = original; emitExpression(expression); } @@ -37112,6 +40213,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: hoistTempVariables, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -37137,10 +40239,11 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_29 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_29, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value); variable.original = original; - if (ts.isIdentifier(name_29)) { + ts.setTextRange(variable, location); + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64); } ts.aggregateTransformFlags(variable); @@ -37228,7 +40331,12 @@ var ts; function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); var numElements = elements.length; - if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { + if (flattenContext.level < 1 && flattenContext.downlevelIteration) { + value = ensureIdentifier(flattenContext, ts.createReadHelper(flattenContext.context, value, numElements > 0 && ts.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) + ? undefined + : numElements, location), false, location); + } + else if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); } @@ -37286,8 +40394,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_30 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_30); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { @@ -37298,7 +40406,7 @@ var ts; var temp = ts.createTempVariable(undefined); if (flattenContext.hoistTempVariables) { flattenContext.context.hoistVariableDeclaration(temp); - flattenContext.emitExpression(ts.createAssignment(temp, value, location)); + flattenContext.emitExpression(ts.setTextRange(ts.createAssignment(temp, value), location)); } else { flattenContext.emitBindingOrAssignment(temp, value, location, undefined); @@ -37329,7 +40437,7 @@ var ts; var restHelper = { name: "typescript:rest", scoped: false, - text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" }; function createRestCall(context, value, elements, computedTempVariables, location) { context.requestEmitHelper(restHelper); @@ -37348,7 +40456,10 @@ var ts; } } } - return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + return ts.createCall(ts.getHelperName("__rest"), undefined, [ + value, + ts.setTextRange(ts.createArrayLiteral(propertyNames), location) + ]); } })(ts || (ts = {})); var ts; @@ -37364,8 +40475,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); context.enableSubstitution(178); + context.enableSubstitution(179); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -37398,15 +40509,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 261: - case 232: - case 231: - case 204: + case 264: + case 234: + case 233: + case 206: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 226: - case 225: + case 228: + case 227: if (ts.hasModifier(node, 2)) { break; } @@ -37431,13 +40542,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 240: + case 242: return visitExportAssignment(node); - case 241: + case 243: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -37447,11 +40558,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 241 || - node.kind === 235 || - node.kind === 236 || - (node.kind === 234 && - node.moduleReference.kind === 245)) { + if (node.kind === 243 || + node.kind === 237 || + node.kind === 238 || + (node.kind === 236 && + node.moduleReference.kind === 247)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -37467,15 +40578,15 @@ var ts; } function classElementVisitorWorker(node) { switch (node.kind) { - case 150: - return undefined; - case 147: - case 155: case 151: + return undefined; + case 148: + case 156: case 152: - case 149: + case 153: + case 150: return visitorWorker(node); - case 203: + case 205: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -37506,23 +40617,22 @@ var ts; case 75: case 123: case 130: - case 162: case 163: - case 161: - case 156: - case 143: + case 164: + case 162: + case 157: + case 144: case 118: case 121: - case 134: + case 135: case 132: case 129: case 104: - case 135: + case 136: + case 160: case 159: + case 161: case 158: - case 160: - case 157: - case 164: case 165: case 166: case 167: @@ -37530,56 +40640,58 @@ var ts; case 169: case 170: case 171: - case 155: - case 145: - case 228: - case 147: - case 150: + case 172: + case 156: + case 146: + case 230: + case 148: + return undefined; + case 151: return visitConstructor(node); - case 227: + case 229: return ts.createNotEmittedStatement(node); - case 226: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 255: + case 258: return visitHeritageClause(node); - case 199: + case 200: return visitExpressionWithTypeArguments(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessor(node); case 152: + return visitGetAccessor(node); + case 153: return visitSetAccessor(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 183: + case 184: return visitParenthesizedExpression(node); - case 182: - case 200: + case 183: + case 201: return visitAssertionExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 201: + case 202: return visitNonNullExpression(node); - case 229: + case 231: return visitEnumDeclaration(node); - case 205: + case 207: return visitVariableStatement(node); - case 223: + case 225: return visitVariableDeclaration(node); - case 230: + case 232: return visitModuleDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -37587,7 +40699,8 @@ var ts; } } function visitSourceFile(node) { - var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + var alwaysStrict = (compilerOptions.alwaysStrict === undefined ? compilerOptions.strict : compilerOptions.alwaysStrict) && + !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)); } function shouldEmitDecorateCallForClass(node) { @@ -37639,11 +40752,12 @@ var ts; return ts.singleOrMany(statements); } function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) { - var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); + var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause)); var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { emitFlags |= 32; } + ts.setTextRange(classDeclaration, node); ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); return classDeclaration; @@ -37654,10 +40768,14 @@ var ts; var declName = ts.getLocalName(node, false, true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, hasExtendsClause); - var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members, location); + var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members); ts.setOriginalNode(classExpression, node); - var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location); + ts.setTextRange(classExpression, location); + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declName, undefined, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression) + ], 1)); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, location); ts.setCommentRange(statement, node); return statement; } @@ -37665,7 +40783,9 @@ var ts; var staticProperties = getInitializedProperties(node, true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84; })); - var classExpression = ts.setOriginalNode(ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members, node), node); + var classExpression = ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members); + ts.setOriginalNode(classExpression, node); + ts.setTextRange(classExpression, node); if (staticProperties.length > 0) { var expressions = []; var temp = ts.createTempVariable(hoistVariableDeclaration); @@ -37688,7 +40808,7 @@ var ts; members.push(constructor); } ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement)); - return ts.createNodeArray(members, node.members); + return ts.setTextRange(ts.createNodeArray(members), node.members); } function transformConstructor(node, hasExtendsClause) { var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); @@ -37699,7 +40819,7 @@ var ts; } var parameters = transformConstructorParameters(constructor); var body = transformConstructorBody(node, constructor, hasExtendsClause); - return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor)); + return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(ts.createConstructor(undefined, undefined, parameters, body), constructor || node), constructor)); } function transformConstructorParameters(constructor) { return ts.visitParameterList(constructor && constructor.parameters, visitor, context) @@ -37722,18 +40842,18 @@ var ts; if (constructor) { ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } - ts.addRange(statements, endLexicalEnvironment()); - return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true); + statements = ts.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + return ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined); } function addPrologueDirectivesAndInitialSuperCall(ctor, result) { if (ctor.body) { var statements = ctor.body.statements; - var index = ts.addPrologueDirectives(result, statements, false, visitor); + var index = ts.addPrologue(result, statements, false, visitor); if (index === statements.length) { return index; } var statement = statements[index]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -37755,7 +40875,7 @@ var ts; ts.setEmitFlags(propertyName, 1536 | 48); var localName = ts.getMutableClone(name); ts.setEmitFlags(localName, 1536); - return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1))); + return ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createThis(), propertyName), node.name), localName)), ts.moveRangePos(node, -1))); } function getInitializedProperties(node, isStatic) { return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty); @@ -37767,13 +40887,13 @@ var ts; return isInitializedProperty(member, false); } function isInitializedProperty(member, isStatic) { - return member.kind === 147 + return member.kind === 148 && isStatic === ts.hasModifier(member, 32) && member.initializer !== undefined; } function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -37782,8 +40902,8 @@ var ts; } function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { + var property = properties_10[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -37840,12 +40960,12 @@ var ts; } function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151: case 152: + case 153: return getAllDecoratorsOfAccessors(node, member); - case 149: + case 150: return getAllDecoratorsOfMethod(member); - case 147: + case 148: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -37856,10 +40976,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -37884,14 +41005,14 @@ var ts; } return { decorators: decorators }; } - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } function addClassElementDecorationStatements(statements, node, isStatic) { @@ -37916,14 +41037,14 @@ var ts; } function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, true); var descriptor = languageVersion > 0 - ? member.kind === 147 + ? member.kind === 148 ? ts.createVoidZero() : ts.createNull() : undefined; @@ -37939,7 +41060,7 @@ var ts; } function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -37967,90 +41088,83 @@ var ts; } return expressions; } - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, true))); } } } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 - || kind === 151 + return kind === 150 || kind === 152 - || kind === 147; + || kind === 153 + || kind === 148; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 149; + return node.kind === 150; } function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 - || kind === 197 - || kind === 149 - || kind === 151 - || kind === 152; + switch (node.kind) { + case 228: + case 198: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 150: + case 152: + case 153: + return true; + } + return false; } function serializeTypeOfNode(node) { switch (node.kind) { - case 147: - case 144: - case 151: - return serializeTypeNode(node.type); + case 148: + case 145: case 152: + return serializeTypeNode(node.type); + case 153: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226: - case 197: - case 149: + case 228: + case 198: + case 150: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); } } - function getRestParameterElementType(node) { - if (node && node.kind === 162) { - return node.elementType; - } - else if (node && node.kind === 157) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -38058,7 +41172,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -38066,7 +41180,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -38075,11 +41189,20 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 152) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } function serializeReturnTypeOfNode(node) { if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } - else if (ts.isAsyncFunctionLike(node)) { + else if (ts.isAsyncFunction(node)) { return ts.createIdentifier("Promise"); } return ts.createVoidZero(); @@ -38090,21 +41213,26 @@ var ts; } switch (node.kind) { case 104: + case 138: + case 94: + case 129: return ts.createVoidZero(); - case 166: + case 167: return serializeTypeNode(node.type); - case 158: case 159: + case 160: return ts.createIdentifier("Function"); - case 162: case 163: + case 164: return ts.createIdentifier("Array"); - case 156: + case 157: case 121: return ts.createIdentifier("Boolean"); - case 134: + case 135: return ts.createIdentifier("String"); - case 171: + case 133: + return ts.createIdentifier("Object"); + case 172: switch (node.literal.kind) { case 9: return ts.createIdentifier("String"); @@ -38120,44 +41248,22 @@ var ts; break; case 132: return ts.createIdentifier("Number"); - case 135: + case 136: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157: + case 158: return serializeTypeReferenceNode(node); + case 166: case 165: - case 164: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - if (serializedIndividual.kind !== 70) { - serializedUnion = undefined; - break; - } - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - if (serializedUnion) { - return serializedUnion; - } - } - case 160: - case 168: + return serializeUnionOrIntersectionType(node); + case 161: case 169: case 170: - case 161: + case 171: + case 162: case 118: - case 167: + case 168: break; default: ts.Debug.failBadSyntaxKind(node); @@ -38165,6 +41271,32 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + serializedUnion = serializedIndividual; + } + } + return serializedUnion; + } function serializeTypeReferenceNode(node) { switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { case ts.TypeReferenceSerializationKind.Unknown: @@ -38199,15 +41331,15 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_31 = ts.getMutableClone(node); - name_31.flags &= ~8; - name_31.original = undefined; - name_31.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_31), ts.createLiteral("undefined")), name_31); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_31; - case 141: + return name; + case 142: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -38236,7 +41368,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -38251,7 +41383,7 @@ var ts; hoistVariableDeclaration(generatedName); expression = ts.createAssignment(generatedName, expression); } - return ts.setOriginalNode(ts.createComputedPropertyName(expression, name), name); + return ts.updateComputedPropertyName(name, expression); } else { return name; @@ -38260,13 +41392,12 @@ var ts; function visitHeritageClause(node) { if (node.token === 84) { var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1); - return ts.createHeritageClause(84, types, node); + return ts.setTextRange(ts.createHeritageClause(84, types), node); } return undefined; } function visitExpressionWithTypeArguments(node) { - var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); - return ts.createExpressionWithTypeArguments(undefined, expression, node); + return ts.updateExpressionWithTypeArguments(node, undefined, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); } function shouldEmitFunctionLikeDeclaration(node) { return !ts.nodeIsMissing(node.body); @@ -38275,13 +41406,13 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - return ts.visitEachChild(node, visitor, context); + return ts.updateConstructor(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), ts.visitNodes(node.modifiers, visitor, ts.isModifier), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context)); } function visitMethodDeclaration(node) { if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); if (updated !== node) { ts.setCommentRange(updated, node); ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); @@ -38317,7 +41448,7 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { var statements = [updated]; addExportMemberAssignment(statements, node); @@ -38326,10 +41457,10 @@ var ts; return updated; } function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { + if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createOmittedExpression(); } - var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated; } function visitArrowFunction(node) { @@ -38340,8 +41471,9 @@ var ts; if (ts.parameterIsThisKeyword(node)) { return undefined; } - var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), ts.moveRangePastModifiers(node)); + var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); ts.setOriginalNode(parameter, node); + ts.setTextRange(parameter, ts.moveRangePastModifiers(node)); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); ts.setEmitFlags(parameter.name, 32); @@ -38353,7 +41485,7 @@ var ts; if (variables.length === 0) { return undefined; } - return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node); + return ts.setTextRange(ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))), node); } else { return ts.visitEachChild(node, visitor, context); @@ -38365,7 +41497,7 @@ var ts; return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression); } else { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression)), node); } } function visitVariableDeclaration(node) { @@ -38419,8 +41551,9 @@ var ts; var localName = ts.getLocalName(node, false, true); moduleArg = ts.createAssignment(localName, moduleArg); } - var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg]), node); + var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg])); ts.setOriginalNode(enumStatement, node); + ts.setTextRange(enumStatement, node); ts.setEmitFlags(enumStatement, emitFlags); statements.push(enumStatement); statements.push(ts.createEndOfDeclarationMarker(node)); @@ -38434,11 +41567,11 @@ var ts; ts.addRange(statements, ts.map(node.members, transformEnumMember)); ts.addRange(statements, endLexicalEnvironment()); currentNamespaceContainerName = savedCurrentNamespaceLocalName; - return ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); + return ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true); } function transformEnumMember(member) { var name = getExpressionForPropertyName(member, false); - return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, member), member); + return ts.setTextRange(ts.createStatement(ts.setTextRange(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name), member)), member); } function transformEnumMemberDeclarationValue(member) { var value = resolver.getConstantValue(member); @@ -38470,16 +41603,16 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_32 = node.symbol && node.symbol.name; - if (name_32) { - return currentScopeFirstDeclarationsOfName[name_32] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -38491,7 +41624,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 229) { + if (node.kind === 231) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -38532,8 +41665,9 @@ var ts; var localName = ts.getLocalName(node, false, true); moduleArg = ts.createAssignment(localName, moduleArg); } - var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node); + var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg])); ts.setOriginalNode(moduleStatement, node); + ts.setTextRange(moduleStatement, node); ts.setEmitFlags(moduleStatement, emitFlags); statements.push(moduleStatement); statements.push(ts.createEndOfDeclarationMarker(node)); @@ -38551,8 +41685,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 233) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -38573,14 +41707,15 @@ var ts; currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 231) { + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true); + ts.setTextRange(block, blockLocation); + if (body.kind !== 233) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230) { + if (moduleDeclaration.body.kind === 232) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -38589,18 +41724,18 @@ var ts; if (!node.importClause) { return node; } - var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, true); + var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause); return importClause ? ts.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier) : undefined; } function visitImportClause(node) { var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined; - var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, true); + var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings); return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 237) { + if (node.kind === 239) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -38623,7 +41758,7 @@ var ts; if (!resolver.isValueAliasDeclaration(node)) { return undefined; } - var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, true); + var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports); return exportClause ? ts.updateExportDeclaration(node, undefined, undefined, exportClause, node.moduleSpecifier) : undefined; @@ -38652,9 +41787,9 @@ var ts; var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); ts.setEmitFlags(moduleReference, 1536 | 2048); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { - return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ + return ts.setOriginalNode(ts.setTextRange(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node) - ]), node), node); + ])), node), node); } else { return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node); @@ -38675,7 +41810,7 @@ var ts; && ts.hasModifier(node, 512); } function expressionToStatement(expression) { - return ts.createStatement(expression, undefined); + return ts.createStatement(expression); } function addExportMemberAssignment(statements, node) { var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), ts.getLocalName(node)); @@ -38685,10 +41820,10 @@ var ts; statements.push(statement); } function createNamespaceExport(exportName, exportValue, location) { - return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue), location); + return ts.setTextRange(ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue)), location); } function createNamespaceExportExpression(exportName, exportValue, location) { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location); } function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { return ts.getNamespaceMemberName(currentNamespaceContainerName, name, false, true); @@ -38704,7 +41839,7 @@ var ts; function getClassAliasIfNeeded(node) { if (resolver.getNodeCheckFlags(node) & 8388608) { enableSubstitutionForClassAliases(); - var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default"); + var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.unescapeIdentifier(node.name.text) : "default"); classAliases[ts.getOriginalNodeId(node)] = classAlias; hoistVariableDeclaration(classAlias); return classAlias; @@ -38728,37 +41863,42 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(70); - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(258); - context.enableEmitNotification(230); + context.enableSubstitution(261); + context.enableEmitNotification(232); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 232; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229; + return ts.getOriginalNode(node).kind === 231; } - function onEmitNode(emitContext, node, emitCallback) { + function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; + var savedCurrentSourceFile = currentSourceFile; + if (ts.isSourceFile(node)) { + currentSourceFile = node; + } if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) { applicableSubstitutions |= 2; } if (enabledSubstitutions & 8 && isTransformedEnumDeclaration(node)) { applicableSubstitutions |= 8; } - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); applicableSubstitutions = savedApplicableSubstitutions; + currentSourceFile = savedCurrentSourceFile; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } else if (ts.isShorthandPropertyAssignment(node)) { @@ -38768,14 +41908,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_33 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_33); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_33, initializer, node); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); } - return ts.createPropertyAssignment(name_33, exportedName, node); + return ts.setTextRange(ts.createPropertyAssignment(name, exportedName), node); } } return node; @@ -38784,9 +41924,9 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 177: - return substitutePropertyAccessExpression(node); case 178: + return substitutePropertyAccessExpression(node); + case 179: return substituteElementAccessExpression(node); } return node; @@ -38816,11 +41956,11 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 261) { - var substitute = (applicableSubstitutions & 2 && container.kind === 230) || - (applicableSubstitutions & 8 && container.kind === 229); + if (container && container.kind !== 264) { + var substitute = (applicableSubstitutions & 2 && container.kind === 232) || + (applicableSubstitutions & 8 && container.kind === 231); if (substitute) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), node); } } } @@ -38835,16 +41975,14 @@ var ts; function substituteConstantValue(node) { var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { + ts.setConstantValue(node, constantValue); var substitute = ts.createLiteral(constantValue); - ts.setSourceMapRange(substitute, node); - ts.setCommentRange(substitute, node); if (!compilerOptions.removeComments) { var propertyName = ts.isPropertyAccessExpression(node) ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - substitute.trailingComment = " " + propertyName + " "; + ts.addSyntheticTrailingComment(substitute, 3, " " + propertyName + " "); } - ts.setConstantValue(node, constantValue); return substitute; } return node; @@ -38859,24 +41997,24 @@ var ts; } } ts.transformTypeScript = transformTypeScript; - var paramHelper = { - name: "typescript:param", - scoped: false, - priority: 4, - text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" - }; - function createParamHelper(context, expression, parameterOffset, location) { - context.requestEmitHelper(paramHelper); - return ts.createCall(ts.getHelperName("__param"), undefined, [ - ts.createLiteral(parameterOffset), - expression - ], location); + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + context.requestEmitHelper(decorateHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray), location); } - var metadataHelper = { - name: "typescript:metadata", + var decorateHelper = { + name: "typescript:decorate", scoped: false, - priority: 3, - text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" }; function createMetadataHelper(context, metadataKey, metadataValue) { context.requestEmitHelper(metadataHelper); @@ -38885,30 +42023,281 @@ var ts; metadataValue ]); } - var decorateHelper = { - name: "typescript:decorate", + var metadataHelper = { + name: "typescript:metadata", scoped: false, - priority: 2, - text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" }; - function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { - context.requestEmitHelper(decorateHelper); - var argumentsArray = []; - argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__param"), undefined, [ + ts.createLiteral(parameterOffset), + expression + ]), location); + } + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + function transformES2017(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var currentSourceFile; + var enabledSubstitutions; + var enclosingSuperContainerFlags = 0; + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; + } + function visitor(node) { + if ((node.transformFlags & 16) === 0) { + return node; + } + switch (node.kind) { + case 119: + return undefined; + case 190: + return visitAwaitExpression(node); + case 150: + return visitMethodDeclaration(node); + case 227: + return visitFunctionDeclaration(node); + case 185: + return visitFunctionExpression(node); + case 186: + return visitArrowFunction(node); + default: + return ts.visitEachChild(node, visitor, context); } } - return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location); + function visitAwaitExpression(node) { + return ts.setOriginalNode(ts.setTextRange(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); + var original = ts.getOriginalNode(node, ts.isFunctionLike); + var nodeType = original.type; + var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; + var isArrowFunction = node.kind === 186; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; + if (!isArrowFunction) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.createBlock(statements, true); + ts.setTextRange(block, node.body); + if (languageVersion >= 2) { + if (resolver.getNodeCheckFlags(node) & 4096) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; + } + else { + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(ts.concatenate(block.statements, declarations)), block.statements)); + } + return expression; + } + } + function transformFunctionBodyWorker(body, start) { + if (ts.isBlock(body)) { + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); + } + else { + startLexicalEnvironment(); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); + var declarations = endLexicalEnvironment(); + return ts.updateBlock(visited, ts.setTextRange(ts.createNodeArray(ts.concatenate(visited.statements, declarations)), visited.statements)); + } + } + function getPromiseConstructor(type) { + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; + } + } + return undefined; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution(180); + context.enableSubstitution(178); + context.enableSubstitution(179); + context.enableEmitNotification(228); + context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); + } + } + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178: + return substitutePropertyAccessExpression(node); + case 179: + return substituteElementAccessExpression(node); + case 180: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 + || kind === 151 + || kind === 150 + || kind === 152 + || kind === 153; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); + } + } + } + ts.transformES2017 = transformES2017; + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); } + ts.asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];\n " + }; + ts.advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);\n " + }; })(ts || (ts = {})); var ts; (function (ts) { function transformESNext(context) { - var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var enabledSubstitutions; + var enclosingFunctionFlags; + var enclosingSuperContainerFlags = 0; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { @@ -38924,53 +42313,93 @@ var ts; function visitorNoDestructuringValue(node) { return visitorWorker(node, true); } + function visitorNoAsyncModifier(node) { + if (node.kind === 119) { + return undefined; + } + return node; + } function visitorWorker(node, noDestructuringValue) { if ((node.transformFlags & 8) === 0) { return node; } switch (node.kind) { - case 176: + case 190: + return visitAwaitExpression(node); + case 196: + return visitYieldExpression(node); + case 221: + return visitLabeledStatement(node); + case 177: return visitObjectLiteralExpression(node); - case 192: + case 193: return visitBinaryExpression(node, noDestructuringValue); - case 223: + case 225: return visitVariableDeclaration(node); + case 215: + return visitForOfStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 211: return visitForStatement(node); - case 188: + case 189: return visitVoidExpression(node); - case 150: + case 151: return visitConstructorDeclaration(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessorDeclaration(node); case 152: + return visitGetAccessorDeclaration(node); + case 153: return visitSetAccessorDeclaration(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 207: + case 209: return visitExpressionStatement(node); - case 183: + case 184: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); } } + function visitAwaitExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.setOriginalNode(ts.setTextRange(ts.createYield(undefined, ts.createArrayLiteral([ts.createLiteral("await"), expression])), node), node); + } + return ts.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.updateYield(node, node.asteriskToken, node.asteriskToken + ? createAsyncDelegatorHelper(context, expression, expression) + : ts.createArrayLiteral(expression + ? [ts.createLiteral("yield"), expression] + : [ts.createLiteral("yield")])); + } + return ts.visitEachChild(node, visitor, context); + } + function visitLabeledStatement(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var statement = ts.unwrapInnermostStatementOfLabel(node); + if (statement.kind === 215 && statement.awaitModifier) { + return visitForOfStatement(statement, node); + } + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), node); + } + return ts.visitEachChild(node, visitor, context); + } function chunkObjectLiteralElements(elements) { var chunkObject; var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259) { + for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { + var e = elements_4[_i]; + if (e.kind === 262) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -38982,7 +42411,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257) { + if (e.kind === 260) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -38999,7 +42428,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 1048576) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { + if (objects.length && objects[0].kind !== 177) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -39033,68 +42462,202 @@ var ts; function visitVoidExpression(node) { return ts.visitEachChild(node, visitorNoDestructuringValue, context); } - function visitForOfStatement(node) { - var leadingStatements; - var temp; - var initializer = ts.skipParentheses(node.initializer); - if (initializer.transformFlags & 1048576) { - if (ts.isVariableDeclarationList(initializer)) { - temp = ts.createTempVariable(undefined); - var firstDeclaration = ts.firstOrUndefined(initializer.declarations); - var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true); - if (ts.some(declarations)) { - var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer); - leadingStatements = ts.append(leadingStatements, statement); - } - } - else if (ts.isAssignmentPattern(initializer)) { - temp = ts.createTempVariable(undefined); - var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1); - leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer)); + function visitForOfStatement(node, outermostLabeledStatement) { + if (node.initializer.transformFlags & 1048576) { + node = transformForOfStatementWithObjectRest(node); + } + if (node.awaitModifier) { + return transformForAwaitOfStatement(node, outermostLabeledStatement); + } + else { + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement); + } + } + function transformForOfStatementWithObjectRest(node) { + var initializerWithoutParens = ts.skipParentheses(node.initializer); + if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) { + var bodyLocation = void 0; + var statementsLocation = void 0; + var temp = ts.createTempVariable(undefined); + var statements = [ts.createForOfBindingStatement(initializerWithoutParens, temp)]; + if (ts.isBlock(node.statement)) { + ts.addRange(statements, node.statement.statements); + bodyLocation = node.statement; + statementsLocation = node.statement.statements; } + return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) + ], 1), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation)); } - if (temp) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - var block = ts.isBlock(statement) - ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) - : ts.createBlock(ts.append(leadingStatements, statement), statement, true); - return ts.updateForOf(node, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(temp, undefined, undefined, node.initializer) - ], node.initializer, 1), expression, block); + return node; + } + function convertForOfStatementHead(node, boundValue) { + var binding = ts.createForOfBindingStatement(node.initializer, boundValue); + var bodyLocation; + var statementsLocation; + var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; } - return ts.visitEachChild(node, visitor, context); + else { + statements.push(statement); + } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + } + function transformForAwaitOfStatement(node, outermostLabeledStatement) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(undefined); + var values = createAsyncValuesHelper(context, expression, node.expression); + var next = ts.createYield(undefined, enclosingFunctionFlags & 1 + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, []) + ]) + : ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, [])); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, values), node.expression), + ts.createVariableDeclaration(result, undefined, next) + ]), node.expression), 1048576), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"))), node), 256); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1)), ts.createBlock([ + ts.createTry(ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createYield(undefined, enclosingFunctionFlags & 1 + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createFunctionCall(returnMethod, iterator, []) + ]) + : ts.createFunctionCall(returnMethod, iterator, [])))), 1) + ]), undefined, ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1) + ]), 1)) + ])); } function visitParameter(node) { if (node.transformFlags & 1048576) { - return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); } return ts.visitEachChild(node, visitor, context); } function visitConstructorDeclaration(node) { - return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitGetAccessorDeclaration(node) { - return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitSetAccessorDeclaration(node) { - return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitMethodDeclaration(node) { - return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateMethod(node, undefined, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(undefined, visitor, ts.isToken), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionDeclaration(node, undefined, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitArrowFunction(node) { - return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionExpression(node, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function transformAsyncGeneratorFunctionBody(node) { + resumeLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor); + appendObjectRestAssignmentsIfNeeded(statements, node); + statements.push(ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression(undefined, ts.createToken(38), node.name && ts.getGeneratedNameForNode(node.name), undefined, [], undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.updateBlock(node.body, statements); + if (languageVersion >= 2) { + if (resolver.getNodeCheckFlags(node) & 4096) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; } function transformFunctionBody(node) { resumeLexicalEnvironment(); - var leadingStatements; + var statementOffset = 0; + var statements = []; + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologue(statements, body.statements, false, visitor); + } + ts.addRange(statements, appendObjectRestAssignmentsIfNeeded(undefined, node)); + var trailingStatements = endLexicalEnvironment(); + if (statementOffset > 0 || ts.some(statements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, true); + ts.addRange(statements, block.statements.slice(statementOffset)); + ts.addRange(statements, trailingStatements); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(statements), block.statements)); + } + return body; + } + function appendObjectRestAssignmentsIfNeeded(statements, node) { for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; if (parameter.transformFlags & 1048576) { @@ -39103,17 +42666,95 @@ var ts; if (ts.some(declarations)) { var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations)); ts.setEmitFlags(statement, 524288); - leadingStatements = ts.append(leadingStatements, statement); + statements = ts.append(statements, statement); } } } - var body = ts.visitNode(node.body, visitor, ts.isConciseBody); - var trailingStatements = endLexicalEnvironment(); - if (ts.some(leadingStatements) || ts.some(trailingStatements)) { - var block = ts.convertToFunctionBody(body, true); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + return statements; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution(180); + context.enableSubstitution(178); + context.enableSubstitution(179); + context.enableEmitNotification(228); + context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); + } + } + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178: + return substitutePropertyAccessExpression(node); + case 179: + return substituteElementAccessExpression(node); + case 180: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 + || kind === 151 + || kind === 150 + || kind === 152 + || kind === 153; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); } - return body; } } ts.transformESNext = transformESNext; @@ -39124,25 +42765,57 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); } ts.createAssignHelper = createAssignHelper; + var asyncGeneratorHelper = { + name: "typescript:asyncGenerator", + scoped: false, + text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), q = [], c, i;\n return i = { next: verb(\"next\"), \"throw\": verb(\"throw\"), \"return\": verb(\"return\") }, i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }\n function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }\n function step(r) { r.done ? settle(c[2], r) : Promise.resolve(r.value[1]).then(r.value[0] === \"yield\" ? _yield : r.value[0] === \"delegate\" ? delegate : fulfill, reject); }\n function _yield(value) { settle(c[2], { value: value, done: false }); }\n function delegate(r) { step(r.done ? r : { value: [\"yield\", r.value], done: false }); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { c = void 0, f(v), next(); }\n };\n " + }; + function createAsyncGeneratorHelper(context, generatorFunc) { + context.requestEmitHelper(asyncGeneratorHelper); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__asyncGenerator"), undefined, [ + ts.createThis(), + ts.createIdentifier("arguments"), + generatorFunc + ]); + } + var asyncDelegator = { + name: "typescript:asyncDelegator", + scoped: false, + text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i = { next: verb(\"next\"), \"throw\": verb(\"throw\", function (e) { throw e; }), \"return\": verb(\"return\", function (v) { return { value: v, done: true }; }) };\n return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { return function (v) { return { value: [\"delegate\", (o[n] || f).call(o, v)], done: false }; }; }\n };\n " + }; + function createAsyncDelegatorHelper(context, expression, location) { + context.requestEmitHelper(asyncDelegator); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"), undefined, [expression]), location); + } + var asyncValues = { + name: "typescript:asyncValues", + scoped: false, + text: "\n var __asyncValues = (this && this.__asyncIterator) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator];\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\n };\n " + }; + function createAsyncValuesHelper(context, expression, location) { + context.requestEmitHelper(asyncValues); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"), undefined, [expression]), location); + } })(ts || (ts = {})); var ts; (function (ts) { function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); - var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFile = node; var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; return visited; } function visitor(node) { @@ -39155,11 +42828,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246: + case 248: return visitJsxElement(node, false); - case 247: + case 249: return visitJsxSelfClosingElement(node, false); - case 252: + case 255: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -39169,11 +42842,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 252: + case 255: return visitJsxExpression(node); - case 246: + case 248: return visitJsxElement(node, true); - case 247: + case 249: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -39189,7 +42862,7 @@ var ts; function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; - var attrs = node.attributes; + var attrs = node.attributes.properties; if (attrs.length === 0) { objectProperties = ts.createNull(); } @@ -39221,13 +42894,16 @@ var ts; } function transformJsxAttributeInitializer(node) { if (node === undefined) { - return ts.createLiteral(true); + return ts.createTrue(); } else if (node.kind === 9) { var decoded = tryDecodeEntities(node.text); - return decoded ? ts.createLiteral(decoded, node) : node; + return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 252) { + else if (node.kind === 255) { + if (node.expression === undefined) { + return ts.createTrue(); + } return visitJsxExpression(node); } else { @@ -39235,43 +42911,35 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + function fixupWhitespaceAndDecodeEntities(text) { + var acc; var firstNonWhitespace = 0; var lastNonWhitespace = -1; for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } function decodeEntities(text) { return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { @@ -39282,7 +42950,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); return ch ? String.fromCharCode(ch) : match; } }); @@ -39292,16 +42960,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246) { + if (node.kind === 248) { return getTagName(node.openingElement); } else { - var name_34 = node.tagName; - if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) { - return ts.createLiteral(name_34.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_34); + return ts.createExpressionFromEntityName(name); } } } @@ -39319,7 +42987,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -39576,263 +43244,6 @@ var ts; }); })(ts || (ts = {})); var ts; -(function (ts) { - function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; - var resolver = context.getEmitResolver(); - var compilerOptions = context.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var currentSourceFile; - var enabledSubstitutions; - var currentSuperContainer; - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; - } - currentSourceFile = node; - var visited = ts.visitEachChild(node, visitor, context); - ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; - return visited; - } - function visitor(node) { - if ((node.transformFlags & 16) === 0) { - return node; - } - switch (node.kind) { - case 119: - return undefined; - case 189: - return visitAwaitExpression(node); - case 149: - return visitMethodDeclaration(node); - case 225: - return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); - case 185: - return visitArrowFunction(node); - default: - return ts.visitEachChild(node, visitor, context); - } - } - function visitAwaitExpression(node) { - return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node); - } - function visitMethodDeclaration(node) { - return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { - return ts.createOmittedExpression(); - } - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function visitArrowFunction(node) { - return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function transformAsyncFunctionBody(node) { - resumeLexicalEnvironment(); - var original = ts.getOriginalNode(node, ts.isFunctionLike); - var nodeType = original.type; - var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; - if (!isArrowFunction) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor); - statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); - ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(statements, node.body, true); - if (languageVersion >= 2) { - if (resolver.getNodeCheckFlags(node) & 4096) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, advancedAsyncSuperHelper); - } - else if (resolver.getNodeCheckFlags(node) & 2048) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, asyncSuperHelper); - } - } - return block; - } - else { - var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); - var declarations = endLexicalEnvironment(); - if (ts.some(declarations)) { - var block = ts.convertToFunctionBody(expression); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); - } - return expression; - } - } - function transformFunctionBodyWorker(body, start) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); - } - else { - startLexicalEnvironment(); - var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); - var declarations = endLexicalEnvironment(); - return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); - } - } - function getPromiseConstructor(type) { - var typeName = type && ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } - } - return undefined; - } - function enableSubstitutionForAsyncMethodsWithSuper() { - if ((enabledSubstitutions & 1) === 0) { - enabledSubstitutions |= 1; - context.enableSubstitution(179); - context.enableSubstitution(177); - context.enableSubstitution(178); - context.enableEmitNotification(226); - context.enableEmitNotification(149); - context.enableEmitNotification(151); - context.enableEmitNotification(152); - context.enableEmitNotification(150); - } - } - function substituteExpression(node) { - switch (node.kind) { - case 177: - return substitutePropertyAccessExpression(node); - case 178: - return substituteElementAccessExpression(node); - case 179: - if (enabledSubstitutions & 1) { - return substituteCallExpression(node); - } - break; - } - return node; - } - function substitutePropertyAccessExpression(node) { - if (enabledSubstitutions & 1 && node.expression.kind === 96) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node); - } - } - return node; - } - function substituteElementAccessExpression(node) { - if (enabledSubstitutions & 1 && node.expression.kind === 96) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node); - } - } - return node; - } - function substituteCallExpression(node) { - var expression = node.expression; - if (ts.isSuperProperty(expression)) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - var argumentExpression = ts.isPropertyAccessExpression(expression) - ? substitutePropertyAccessExpression(expression) - : substituteElementAccessExpression(expression); - return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ - ts.createThis() - ].concat(node.arguments)); - } - } - return node; - } - function isSuperContainer(node) { - var kind = node.kind; - return kind === 226 - || kind === 150 - || kind === 149 - || kind === 151 - || kind === 152; - } - function onEmitNode(emitContext, node, emitCallback) { - if (enabledSubstitutions & 1 && isSuperContainer(node)) { - var savedCurrentSuperContainer = currentSuperContainer; - currentSuperContainer = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSuperContainer = savedCurrentSuperContainer; - } - else { - previousOnEmitNode(emitContext, node, emitCallback); - } - } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { - return substituteExpression(node); - } - return node; - } - function createSuperAccessInAsyncMethod(argumentExpression, flags, location) { - if (flags & 4096) { - return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value", location); - } - else { - return ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression], location); - } - } - function getSuperContainerAsyncMethodFlags() { - return currentSuperContainer !== undefined - && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096); - } - } - ts.transformES2017 = transformES2017; - function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { - context.requestEmitHelper(awaiterHelper); - var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; - return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ - ts.createThis(), - hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), - promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), - generatorFunc - ]); - } - var awaiterHelper = { - name: "typescript:awaiter", - scoped: false, - priority: 5, - text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };" - }; - var asyncSuperHelper = { - name: "typescript:async-super", - scoped: true, - text: "\n const _super = name => super[name];" - }; - var advancedAsyncSuperHelper = { - name: "typescript:advanced-async-super", - scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" - }; -})(ts || (ts = {})); -var ts; (function (ts) { function transformES2016(context) { var hoistVariableDeclaration = context.hoistVariableDeclaration; @@ -39848,7 +43259,7 @@ var ts; return node; } switch (node.kind) { - case 192: + case 193: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -39872,19 +43283,19 @@ var ts; if (ts.isElementAccessExpression(left)) { var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); + target = ts.setTextRange(ts.createElementAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), ts.setTextRange(ts.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left); + value = ts.setTextRange(ts.createElementAccess(expressionTemp, argumentExpressionTemp), left); } else if (ts.isPropertyAccessExpression(left)) { var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); - value = ts.createPropertyAccess(expressionTemp, left.name, left); + target = ts.setTextRange(ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), left.name), left); + value = ts.setTextRange(ts.createPropertyAccess(expressionTemp, left.name), left); } else { target = left; value = left; } - return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + return ts.setTextRange(ts.createAssignment(target, ts.createMathPow(value, right, node)), node); } function visitExponentiationExpression(node) { var left = ts.visitNode(node.left, visitor, ts.isExpression); @@ -39898,6 +43309,7 @@ var ts; (function (ts) { function transformES2015(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -39905,15 +43317,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; var convertedLoopState; var enabledSubstitutions; return transformSourceFile; @@ -39923,247 +43327,207 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); - } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383; + return ancestorFacts; } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; + return hierarchyFacts & 4096 + && node.kind === 218 + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64) !== 0 || - node.kind === 219 || - (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 && ts.isStatement(node)) + || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205: - return visitVariableStatement(node); - case 218: - return visitSwitchStatement(node); - case 215: - case 214: - return visitBreakOrContinueStatement(node); - case 98: - return visitThisKeyword(node); - case 70: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96) { + return visitSuperKeyword(true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114: return undefined; - case 226: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 144: + case 145: return visitParameter(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 185: + case 186: return visitArrowFunction(node); - case 184: + case 185: return visitFunctionExpression(node); - case 223: + case 225: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 224: + case 226: return visitVariableDeclarationList(node); - case 219: + case 220: + return visitSwitchStatement(node); + case 234: + return visitCaseBlock(node); + case 206: + return visitBlock(node, false); + case 217: + case 216: + return visitBreakOrContinueStatement(node); + case 221: return visitLabeledStatement(node); - case 209: - return visitDoStatement(node); - case 210: - return visitWhileStatement(node); case 211: - return visitForStatement(node); case 212: - return visitForInStatement(node); + return visitDoOrWhileStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 207: + return visitForStatement(node, undefined); + case 214: + return visitForInStatement(node, undefined); + case 215: + return visitForOfStatement(node, undefined); + case 209: return visitExpressionStatement(node); - case 176: + case 177: return visitObjectLiteralExpression(node); - case 256: + case 259: return visitCatchClause(node); - case 258: + case 261: return visitShorthandPropertyAssignment(node); - case 175: + case 143: + return visitComputedPropertyName(node); + case 176: return visitArrayLiteralExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 183: + case 184: return visitParenthesizedExpression(node, true); - case 192: + case 193: return visitBinaryExpression(node, true); case 12: case 13: case 14: case 15: return visitTemplateLiteral(node); - case 181: + case 9: + return visitStringLiteral(node); + case 8: + return visitNumericLiteral(node); + case 182: return visitTaggedTemplateExpression(node); - case 194: - return visitTemplateExpression(node); case 195: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 196: + return visitYieldExpression(node); + case 197: return visitSpreadElement(node); case 96: - return visitSuperKeyword(); - case 195: - return ts.visitEachChild(node, visitor, context); - case 149: + return visitSuperKeyword(false); + case 98: + return visitThisKeyword(node); + case 203: + return visitMetaProperty(node); + case 150: return visitMethodDeclaration(node); - case 205: + case 152: + case 153: + return visitAccessorDeclaration(node); + case 207: return visitVariableStatement(node); + case 218: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968, 64); var statements = []; startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); + var statementOffset = ts.addStandardPrologue(statements, node.statements, false); addCaptureThisForNodeIfNeeded(statements, node); + statementOffset = ts.addCustomPrologue(statements, node.statements, statementOffset, visitor); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + exitSubtree(ancestorFacts, 0, 0); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - convertedLoopState.allowedNonLabeledJumps |= 2; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032, 0); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185) { - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2) { + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -40172,20 +43536,20 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 215 ? 2 : 4; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 ? 2 : 4; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215) { + if (node.kind === 217) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -40195,7 +43559,7 @@ var ts; } } else { - if (node.kind === 215) { + if (node.kind === 217) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -40228,8 +43592,9 @@ var ts; var variable = ts.createVariableDeclaration(ts.getLocalName(node, true), undefined, transformClassLikeDeclarationToExpression(node)); ts.setOriginalNode(variable, node); var statements = []; - var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable]), node); + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable])); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, node); ts.startOnNewLine(statement); statements.push(statement); if (ts.hasModifier(node, 1)) { @@ -40284,23 +43649,29 @@ var ts; ts.setEmitFlags(statement, 1536 | 384); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true); ts.setEmitFlags(block, 1536); return block; } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement)); + statements.push(ts.setTextRange(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node))), extendsClauseElement)); } } function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278, 73); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); - var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); + var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper)); + ts.setTextRange(constructorFunction, constructor || node); if (extendsClauseElement) { ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; } function transformConstructorParameters(constructor, hasSynthesizedSuper) { return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) @@ -40314,48 +43685,55 @@ var ts; statementOffset = 0; } else if (constructor) { - statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor); + statementOffset = ts.addStandardPrologue(statements, constructor.body.statements, false); } if (constructor) { addDefaultValueAssignmentsIfNeeded(statements, constructor); addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + if (!hasSynthesizedSuper) { + statementOffset = ts.addCustomPrologue(statements, constructor.body.statements, statementOffset, visitor); + } ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); if (superCaptureStatus === 1 || superCaptureStatus === 2) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1) { + hierarchyFacts |= 4096; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset)); } - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, false); + } + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true); + ts.setTextRange(block, constructor ? constructor.body : node); if (!constructor) { ts.setEmitFlags(block, 1536); } return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 216) { + if (statement.kind === 218) { return true; } - else if (statement.kind === 208) { + else if (statement.kind === 210) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204) { + else if (statement.kind === 206) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -40363,8 +43741,8 @@ var ts; } return false; } - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { - if (!hasExtendsClause) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -40384,42 +43762,43 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 209 && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } - if (superCallExpression && statementOffset === ctorStatements.length - 1) { + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 - || superCallExpression.left.kind !== 179) { + if (superCallExpression.kind !== 193 + || superCallExpression.left.kind !== 180) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); statements.push(returnStatement); return 2; } - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); if (superCallExpression) { return 1; } return 0; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { return undefined; } else if (ts.isBindingPattern(node.name)) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined, node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined), node), node); } else if (node.initializer) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined, node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined), node), node); } else { return node; @@ -40434,15 +43813,15 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_35 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_35)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_35, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_35, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -40457,10 +43836,11 @@ var ts; } function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ - ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter)) - ], parameter), 1 | 32 | 384), undefined, parameter); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.setTextRange(ts.createBlock([ + ts.createStatement(ts.setTextRange(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer))), parameter)) + ]), parameter), 1 | 32 | 384)); statement.startsOnNewLine = true; + ts.setTextRange(statement, parameter); ts.setEmitFlags(statement, 384 | 32 | 524288); statements.push(statement); } @@ -40477,22 +43857,22 @@ var ts; var expressionName = ts.getSynthesizedClone(parameter.name); var restIndex = node.parameters.length - 1; var temp = ts.createLoopVariable(); - statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + statements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([])) - ]), parameter), 524288)); - var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ])), parameter), 524288)); + var forStatement = ts.createFor(ts.setTextRange(ts.createVariableDeclarationList([ ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex)) - ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([ - ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ]), parameter), ts.setTextRange(ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length")), parameter), ts.setTextRange(ts.createPostfixIncrement(temp), parameter), ts.createBlock([ + ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 ? temp - : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter)) + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp))), parameter)) ])); ts.setEmitFlags(forStatement, 524288); ts.startOnNewLine(forStatement); statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 185) { + if (node.transformFlags & 32768 && node.kind !== 186) { captureThisForNode(statements, node, ts.createThis()); } } @@ -40500,29 +43880,62 @@ var ts; enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("_this", undefined, initializer) - ]), originalStatement); + ])); ts.setEmitFlags(captureThisStatement, 1536 | 524288); + ts.setTextRange(captureThisStatement, originalStatement); ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384) { + var newTarget = void 0; + switch (node.kind) { + case 186: + return statements; + case 150: + case 152: + case 153: + newTarget = ts.createVoidZero(); + break; + case 151: + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); + break; + case 227: + case 185: + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203: + case 205: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + case 150: + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150: + case 151: break; default: ts.Debug.failBadSyntaxKind(node); @@ -40531,28 +43944,32 @@ var ts; } } function transformSemicolonClassElementToStatement(member) { - return ts.createEmptyStatement(member); + return ts.setTextRange(ts.createEmptyStatement(), member); } - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0, 0); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); - var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined, container); ts.setEmitFlags(memberFunction, 1536); ts.setSourceMapRange(memberFunction, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); + var statement = ts.setTextRange(ts.createStatement(ts.createAssignment(memberName, memberFunction)), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); ts.setEmitFlags(statement, 48); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return statement; } - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, false)); ts.setEmitFlags(statement, 1536); + ts.setSourceMapRange(statement, ts.getSourceMapRange(accessors.firstAccessor)); return statement; } - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0, 0); var target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); @@ -40561,7 +43978,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -40569,51 +43986,86 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); } - properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true))); + properties.push(ts.createPropertyAssignment("enumerable", ts.createTrue()), ts.createPropertyAssignment("configurable", ts.createTrue())); var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ target, propertyName, - ts.createObjectLiteral(properties, undefined, true) + ts.createObjectLiteral(properties, true) ]); if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return call; } function visitArrowFunction(node) { if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } - var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256, 66); + var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + ts.setTextRange(func, node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8); + exitSubtree(ancestorFacts, 0, 0); + convertedLoopState = savedConvertedLoopState; return func; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var ancestorFacts = ts.getEmitFlags(node) & 131072 + ? enterSubtree(16278, 69) + : enterSubtree(16286, 65); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, undefined, node.asteriskToken, name, undefined, parameters, undefined, body); } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, undefined, parameters, undefined, body); } - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32) + ? enterSubtree(16286, 65 | 8) + : enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 && !name && (node.kind === 227 || node.kind === 185)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body), location), node); } function transformFunctionBody(node) { var multiLine = false; @@ -40625,7 +44077,7 @@ var ts; var statementOffset; resumeLexicalEnvironment(); if (ts.isBlock(body)) { - statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + statementOffset = ts.addStandardPrologue(statements, body.statements, false); } addCaptureThisForNodeIfNeeded(statements, node); addDefaultValueAssignmentsIfNeeded(statements, node); @@ -40634,6 +44086,7 @@ var ts; multiLine = true; } if (ts.isBlock(body)) { + statementOffset = ts.addCustomPrologue(statements, body.statements, statementOffset, visitor); statementsLocation = body.statements; ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); if (!multiLine && body.multiLine) { @@ -40641,7 +44094,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185); + ts.Debug.assert(node.kind === 186); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -40653,17 +44106,20 @@ var ts; } } var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = ts.createReturn(expression, body); + var returnStatement = ts.createReturn(expression); + ts.setTextRange(returnStatement, body); ts.setEmitFlags(returnStatement, 384 | 32 | 1024); statements.push(returnStatement); closeBraceLocation = body; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, false); if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), multiLine); + ts.setTextRange(block, node.body); if (!multiLine && singleLine) { ts.setEmitFlags(block, 1); } @@ -40673,11 +44129,26 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.setTextRange(ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, true)), updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 + ? enterSubtree(4032, 512) + : enterSubtree(3904, 128); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -40685,9 +44156,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -40697,9 +44168,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { + var ancestorFacts = enterSubtree(0, ts.hasModifier(node, 1) ? 32 : 0); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3) === 0) { var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; @@ -40712,53 +44186,59 @@ var ts; else { assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression)); } - (assignments || (assignments = [])).push(assignment); + assignments = ts.append(assignments, assignment); } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); + updated = ts.setTextRange(ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); })), node); } else { - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function visitVariableDeclarationList(node) { - if (node.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64) { + if (node.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations); + ts.setOriginalNode(declarationList, node); + ts.setTextRange(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } function shouldEmitExplicitInitializerForLetDeclaration(node) { var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, false)); + && (hierarchyFacts & 512) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 - && enclosingBlockScopeContainer.kind !== 213 + && (hierarchyFacts & 2048) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, false))); + && (hierarchyFacts & (1024 | 2048)) === 0)); return emitExplicitInitializer; } function visitVariableDeclarationInLetDeclarationList(node) { @@ -40774,84 +44254,94 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { + var ancestorFacts = enterSubtree(32, 0); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, (ancestorFacts & 32) !== 0); } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels.set(node.label.text, node.label.text); + } + function resetLabel(node) { + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); - } - else { - result = ts.visitEachChild(node, visitor, context); + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + var statement = ts.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, false) + ? visitIterationStatement(statement, node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 211: + case 212: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 213: + return visitForStatement(node, outermostLabeledStatement); + case 214: + return visitForInStatement(node, outermostLabeledStatement); + case 215: + return visitForOfStatement(node, outermostLabeledStatement); } - return result; } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0, 0); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement); } - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } - function convertForOfToFor(node, convertedLoopBodyStatements) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; + function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { var statements = []; - var counter = ts.createLoopVariable(); - var rhsReference = expression.kind === 70 - ? ts.createUniqueName(expression.text) - : ts.createTempVariable(undefined); - var elementAccess = ts.createElementAccess(rhsReference, counter); - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3) { + if (ts.isVariableDeclarationList(node.initializer)) { + if (node.initializer.flags & 3) { enableSubstitutionsForBlockScopedBindings(); } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + var firstOriginalDeclaration = ts.firstOrUndefined(node.initializer.declarations); if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess); - var declarationList = ts.createVariableDeclarationList(declarations, initializer); - ts.setOriginalNode(declarationList, initializer); + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, boundValue); + var declarationList = ts.setTextRange(ts.createVariableDeclarationList(declarations), node.initializer); + ts.setOriginalNode(declarationList, node.initializer); var firstDeclaration = declarations[0]; var lastDeclaration = ts.lastOrUndefined(declarations); ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); statements.push(ts.createVariableStatement(undefined, declarationList)); } else { - statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter)) - ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); + statements.push(ts.setTextRange(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.setTextRange(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, boundValue) + ]), ts.moveRangePos(node.initializer, -1)), node.initializer)), ts.moveRangeEnd(node.initializer, -1))); } } else { - var assignment = ts.createAssignment(initializer, elementAccess); + var assignment = ts.createAssignment(node.initializer, boundValue); if (ts.isDestructuringAssignment(assignment)) { - statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0))); + ts.aggregateTransformFlags(assignment); + statements.push(ts.createStatement(visitBinaryExpression(assignment, false))); } else { - assignment.end = initializer.end; - statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1))); + assignment.end = node.initializer.end; + statements.push(ts.setTextRange(ts.createStatement(ts.visitNode(assignment, visitor, ts.isExpression)), ts.moveRangeEnd(node.initializer, -1))); } } var bodyLocation; @@ -40860,7 +44350,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -40870,39 +44360,82 @@ var ts; statements.push(statement); } } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + } + function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var counter = ts.createLoopVariable(); + var rhsReference = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression)); - var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation); - ts.setEmitFlags(body, 48 | 384); - var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)), - ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) - ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); + var forStatement = ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0)), ts.moveRangePos(node.expression, -1)), + ts.setTextRange(ts.createVariableDeclaration(rhsReference, undefined, expression), node.expression) + ]), node.expression), 1048576), ts.setTextRange(ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length")), node.expression), ts.setTextRange(ts.createPostfixIncrement(counter), node.expression), convertForOfStatementHead(node, ts.createElementAccess(rhsReference, counter), convertedLoopBodyStatements)), node); ts.setEmitFlags(forStatement, 256); - return forStatement; + ts.setTextRange(forStatement, node); + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(undefined); + var values = ts.createValuesHelper(context, expression, node.expression); + var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, []); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, values), node.expression), + ts.createVariableDeclaration(result, undefined, next) + ]), node.expression), 1048576), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"), convertedLoopBodyStatements)), node), 256); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1)), ts.createBlock([ + ts.createTry(ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createFunctionCall(returnMethod, iterator, []))), 1), + ]), undefined, ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1) + ]), 1)) + ])); } function visitObjectLiteralExpression(node) { var properties = node.properties; var numProperties = properties.length; var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 - || property.name.kind === 142) { + if ((property.transformFlags & 16777216 && hierarchyFacts & 4) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 143) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - var temp = ts.createTempVariable(hoistVariableDeclaration); - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + var temp = ts.createTempVariable(hoistVariableDeclaration); + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), 32768)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536) !== 0; @@ -40926,14 +44459,16 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 | 4; } - var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -40942,11 +44477,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211: - case 212: case 213: + case 214: + case 215: var initializer = node.initializer; - if (initializer && initializer.kind === 224) { + if (initializer && initializer.kind === 226) { loopInitializer = initializer; } break; @@ -40972,19 +44507,26 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + startLexicalEnvironment(); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1, statements_4); - loopBody = ts.createBlock(statements_4, undefined, true); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, true); } - if (!ts.isBlock(loopBody)) { - loopBody = ts.createBlock([loopBody], undefined, true); + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + else { + loopBody = ts.createBlock([loopBody], true); + } + var isAsyncBlockContainingAwait = hierarchyFacts & 4 && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -41043,19 +44585,18 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); - loop.statement = undefined; - loop = ts.visitEachChild(loop, visitor, context); - loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); - } - statements.push(currentParent.kind === 219 - ? ts.createLabel(currentParent.label, loop) - : loop); + var clone_4 = ts.getMutableClone(node); + clone_4.statement = undefined; + clone_4 = ts.visitEachChild(clone_4, visitor, context); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, true); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); + } + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -41076,7 +44617,9 @@ var ts; !state.labeledNonLocalBreaks && !state.labeledNonLocalContinues; var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; })); - var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38), call) : call; + var callResult = isAsyncBlockContainingAwait + ? ts.createYield(ts.createToken(38), ts.setEmitFlags(call, 4194304)) + : call; if (isSimpleLoop) { statements.push(ts.createStatement(callResult)); copyOutParameters(state.loopOutParameters, 0, statements); @@ -41114,23 +44657,22 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -41139,7 +44681,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -41154,7 +44696,7 @@ var ts; else { loopParameters.push(ts.createParameter(undefined, undefined, undefined, name)); if (resolver.getNodeCheckFlags(decl) & 2097152) { - var outParamName = ts.createUniqueName("out_" + name.text); + var outParamName = ts.createUniqueName("out_" + ts.unescapeIdentifier(name.text)); loopOutParameters.push({ originalName: name, outParamName: outParamName }); } } @@ -41165,22 +44707,22 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257: + case 150: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 260: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 258: + case 261: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; default: ts.Debug.failBadSyntaxKind(node); break; @@ -41188,34 +44730,49 @@ var ts; } } function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } return expression; } function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } return expression; } - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0, 0); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined, container)); + ts.setTextRange(expression, method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); - var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032, 0); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp); + ts.setTextRange(newVariableDeclaration, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); + var list = ts.createVariableDeclarationList(vars); + ts.setTextRange(list, node.variableDeclaration); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -41223,21 +44780,43 @@ var ts; } function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); + var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined, undefined); ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); - return ts.createPropertyAssignment(node.name, functionExpression, node); + return ts.setTextRange(ts.createPropertyAssignment(node.name, functionExpression), node); + } + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return updated; } function visitShorthandPropertyAssignment(node) { - return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node); + return ts.setTextRange(ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name)), node); + } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0, 8192); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 32768 : 0); + return updated; } function visitYieldExpression(node) { return ts.visitEachChild(node, visitor, context); } function visitArrayLiteralExpression(node) { - return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + if (node.transformFlags & 64) { + return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + if (node.transformFlags & 64) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, false); @@ -41249,38 +44828,54 @@ var ts; } var resultingCall; if (node.transformFlags & 524288) { - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); } if (node.expression.kind === 96) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 524288) !== 0); - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + if (node.transformFlags & 524288) { + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + } + return ts.visitEachChild(node, visitor, context); } function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { var numElements = elements.length; var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) { return visitPartition(partition, multiLine, hasTrailingComma && end === numElements); })); - if (segments.length === 1) { - var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 - ? ts.createArraySlice(segments[0]) - : segments[0]; + if (compilerOptions.downlevelIteration) { + if (segments.length === 1) { + var firstSegment = segments[0]; + if (ts.isCallExpression(firstSegment) + && ts.isIdentifier(firstSegment.expression) + && (ts.getEmitFlags(firstSegment.expression) & 4096) + && firstSegment.expression.text === "___spread") { + return segments[0]; + } + } + return ts.createSpreadHelper(context, segments); + } + else { + if (segments.length === 1) { + var firstElement = elements[0]; + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 + ? ts.createArraySlice(segments[0]) + : segments[0]; + } + return ts.createArrayConcat(segments.shift(), segments); } - return ts.createArrayConcat(segments.shift(), segments); } function partitionSpread(node) { return ts.isSpreadExpression(node) @@ -41291,7 +44886,7 @@ var ts; return ts.map(chunk, visitExpressionOfSpread); } function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { - return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine); + return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, hasTrailingComma), visitor, ts.isExpression), multiLine); } function visitSpreadElement(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); @@ -41300,7 +44895,19 @@ var ts; return ts.visitNode(node.expression, visitor, ts.isExpression); } function visitTemplateLiteral(node) { - return ts.createLiteral(node.text, node); + return ts.setTextRange(ts.createLiteral(node.text), node); + } + function visitStringLiteral(node) { + if (node.hasExtendedUnicodeEscape) { + return ts.setTextRange(ts.createLiteral(node.text), node); + } + return node; + } + function visitNumericLiteral(node) { + if (node.numericLiteralFlags & 48) { + return ts.setTextRange(ts.createNumericLiteral(node.text), node); + } + return node; } function visitTaggedTemplateExpression(node) { var tag = ts.visitNode(node.tag, visitor, ts.isExpression); @@ -41334,7 +44941,7 @@ var ts; var isLast = node.kind === 12 || node.kind === 15; text = text.substring(1, text.length - (isLast ? 1 : 2)); text = text.replace(/\r\n?/g, "\n"); - return ts.createLiteral(text, node); + return ts.setTextRange(ts.createLiteral(text), node); } function visitTemplateExpression(node) { var expressions = []; @@ -41342,7 +44949,8 @@ var ts; addTemplateSpans(expressions, node); var expression = ts.reduceLeft(expressions, ts.createAdd); if (ts.nodeIsSynthesized(expression)) { - ts.setTextRange(expression, node); + expression.pos = node.pos; + expression.end = node.end; } return expression; } @@ -41365,21 +44973,34 @@ var ts; } } } - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32) - && currentParent.kind !== 179 + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; + function visitMetaProperty(node) { + if (node.keywordToken === 93 && node.name.text === "target") { + if (hierarchyFacts & 8192) { + hierarchyFacts |= 32768; + } + else { + hierarchyFacts |= 16384; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } + function onEmitNode(hint, node, emitCallback) { if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286, ts.getEmitFlags(node) & 8 + ? 65 | 16 + : 65); + previousOnEmitNode(hint, node, emitCallback); + exitSubtree(ancestorFacts, 0, 0); + return; } - previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; + previousOnEmitNode(hint, node, emitCallback); } function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2) === 0) { @@ -41391,18 +45012,18 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(98); - context.enableEmitNotification(150); - context.enableEmitNotification(149); context.enableEmitNotification(151); + context.enableEmitNotification(150); context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(186); context.enableEmitNotification(185); - context.enableEmitNotification(184); - context.enableEmitNotification(225); + context.enableEmitNotification(227); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } if (ts.isIdentifier(node)) { @@ -41414,7 +45035,7 @@ var ts; if (enabledSubstitutions & 2) { var original = ts.getParseTreeNode(node, ts.isIdentifier); if (original && isNameOfDeclarationWithCollidingName(original)) { - return ts.getGeneratedNameForNode(original); + return ts.setTextRange(ts.getGeneratedNameForNode(original), node); } } return node; @@ -41422,10 +45043,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174: - case 226: - case 229: - case 223: + case 175: + case 228: + case 231: + case 225: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -41444,16 +45065,15 @@ var ts; if (enabledSubstitutions & 2) { var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { - return ts.getGeneratedNameForNode(declaration.name); + return ts.setTextRange(ts.getGeneratedNameForNode(declaration.name), node); } } return node; } function substituteThisKeyword(node) { if (enabledSubstitutions & 1 - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8) { - return ts.createIdentifier("_this", node); + && hierarchyFacts & 16) { + return ts.setTextRange(ts.createIdentifier("_this"), node); } return node; } @@ -41469,11 +45089,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180) { return false; } var callTarget = statementExpression.expression; @@ -41481,7 +45101,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197) { return false; } var expression = callArgument.expression; @@ -41500,18 +45120,90 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); var ts; (function (ts) { - var instructionNames = ts.createMap((_a = {}, - _a[2] = "return", - _a[3] = "break", - _a[4] = "yield", - _a[5] = "yield*", - _a[7] = "endfinally", - _a)); + function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(250); + context.enableEmitNotification(251); + context.enableEmitNotification(249); + noSubstitution = []; + } + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + context.enableSubstitution(178); + context.enableSubstitution(260); + return transformSourceFile; + function transformSourceFile(node) { + return node; + } + function onEmitNode(hint, node, emitCallback) { + switch (node.kind) { + case 250: + case 251: + case 249: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(hint, node); + } + node = previousOnSubstituteNode(hint, node); + if (ts.isPropertyAccessExpression(node)) { + return substitutePropertyAccessExpression(node); + } + else if (ts.isPropertyAssignment(node)) { + return substitutePropertyAssignment(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + var literalName = trySubstituteReservedName(node.name); + if (literalName) { + return ts.setTextRange(ts.createElementAccess(node.expression, literalName), node); + } + return node; + } + function substitutePropertyAssignment(node) { + var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); + if (literalName) { + return ts.updatePropertyAssignment(node, literalName, node.initializer); + } + return node; + } + function trySubstituteReservedName(name) { + var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); + if (token >= 71 && token <= 106) { + return ts.setTextRange(ts.createLiteral(name), name); + } + return undefined; + } + } + ts.transformES5 = transformES5; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getInstructionName(instruction) { + switch (instruction) { + case 2: return "return"; + case 3: return "break"; + case 4: return "yield"; + case 5: return "yield*"; + case 7: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -41577,13 +45269,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209: + case 211: return visitDoStatement(node); - case 210: + case 212: return visitWhileStatement(node); - case 218: + case 220: return visitSwitchStatement(node); - case 219: + case 221: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -41591,24 +45283,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 205: + case 207: return visitVariableStatement(node); - case 211: + case 213: return visitForStatement(node); - case 212: + case 214: return visitForInStatement(node); - case 215: + case 217: return visitBreakStatement(node); - case 214: - return visitContinueStatement(node); case 216: + return visitContinueStatement(node); + case 218: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -41624,21 +45316,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192: - return visitBinaryExpression(node); case 193: + return visitBinaryExpression(node); + case 194: return visitConditionalExpression(node); - case 195: + case 196: return visitYieldExpression(node); - case 175: - return visitArrayLiteralExpression(node); case 176: + return visitArrayLiteralExpression(node); + case 177: return visitObjectLiteralExpression(node); - case 178: - return visitElementAccessExpression(node); case 179: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -41646,9 +45338,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -41656,8 +45348,8 @@ var ts; } } function visitFunctionDeclaration(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { - node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -41677,8 +45369,8 @@ var ts; } } function visitFunctionExpression(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { - node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -41730,7 +45422,7 @@ var ts; operationLocations = undefined; state = ts.createTempVariable(undefined); resumeLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + var statementOffset = ts.addPrologue(statements, body.statements, false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); ts.addRange(statements, endLexicalEnvironment()); @@ -41748,7 +45440,7 @@ var ts; operationArguments = savedOperationArguments; operationLocations = savedOperationLocations; state = savedState; - return ts.createBlock(statements, body, body.multiLine); + return ts.setTextRange(ts.createBlock(statements, body.multiLine), body); } function visitVariableStatement(node) { if (node.transformFlags & 16777216) { @@ -41805,10 +45497,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177: + case 178: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178: + case 179: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -41817,7 +45509,7 @@ var ts; } var operator = node.operatorToken.kind; if (isCompoundAssignment(operator)) { - return ts.createBinary(target, 57, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node); + return ts.setTextRange(ts.createAssignment(target, ts.setTextRange(ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node); } else { return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression)); @@ -41833,10 +45525,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -41892,38 +45584,43 @@ var ts; var resumeLabel = defineLabel(); var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (node.asteriskToken) { - emitYieldStar(expression, node); + var iterator = (ts.getEmitFlags(node.expression) & 4194304) === 0 + ? ts.createValuesHelper(context, expression, node) + : expression; + emitYieldStar(iterator, node); } else { emitYield(expression, node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(node); } function visitArrayLiteralExpression(node) { return visitElements(node.elements, undefined, undefined, node.multiLine); } function visitElements(elements, leadingElement, location, multiLine) { var numInitialElements = countInitialNodesWithoutYield(elements); - var temp = declareLocal(); - var hasAssignedTemp = false; + var temp; if (numInitialElements > 0) { + temp = declareLocal(); var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); emitAssignment(temp, ts.createArrayLiteral(leadingElement ? [leadingElement].concat(initialElements) : initialElements)); leadingElement = undefined; - hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); - return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); + return temp + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.setTextRange(ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine), location); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { + var hasAssignedTemp = temp !== undefined; + if (!temp) { + temp = declareLocal(); + } emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine)); - hasAssignedTemp = true; + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine)); leadingElement = undefined; expressions = []; } @@ -41936,7 +45633,7 @@ var ts; var multiLine = node.multiLine; var numInitialProperties = countInitialNodesWithoutYield(properties); var temp = declareLocal(); - emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, multiLine)); + emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), multiLine)); var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties); expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); return ts.inlineExpressions(expressions); @@ -41958,10 +45655,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -41975,7 +45672,7 @@ var ts; function visitNewExpression(node) { if (ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, []), node), node); } return ts.visitEachChild(node, visitor, context); } @@ -42004,38 +45701,38 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204: + case 206: return transformAndEmitBlock(node); - case 207: + case 209: return transformAndEmitExpressionStatement(node); - case 208: + case 210: return transformAndEmitIfStatement(node); - case 209: + case 211: return transformAndEmitDoStatement(node); - case 210: + case 212: return transformAndEmitWhileStatement(node); - case 211: + case 213: return transformAndEmitForStatement(node); - case 212: - return transformAndEmitForInStatement(node); case 214: + return transformAndEmitForInStatement(node); + case 216: return transformAndEmitContinueStatement(node); - case 215: + case 217: return transformAndEmitBreakStatement(node); - case 216: + case 218: return transformAndEmitReturnStatement(node); - case 217: + case 219: return transformAndEmitWithStatement(node); - case 218: + case 220: return transformAndEmitSwitchStatement(node); - case 219: + case 221: return transformAndEmitLabeledStatement(node); - case 220: + case 222: return transformAndEmitThrowStatement(node); - case 221: + case 223: return transformAndEmitTryStatement(node); default: - return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); + return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); } } function transformAndEmitBlock(node) { @@ -42052,7 +45749,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -42082,7 +45781,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -42161,7 +45860,7 @@ var ts; transformAndEmitVariableDeclarationList(initializer); } else { - emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), initializer)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer)); } } markLabel(conditionLabel); @@ -42171,7 +45870,7 @@ var ts; transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); if (node.incrementor) { - emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), node.incrementor)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor)); } emitBreak(conditionLabel); endLoopBlock(); @@ -42185,7 +45884,7 @@ var ts; beginScriptLoopBlock(); } var initializer = node.initializer; - if (ts.isVariableDeclarationList(initializer)) { + if (initializer && ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name); @@ -42193,7 +45892,7 @@ var ts; var variables = ts.getInitializedVariables(initializer); node = ts.updateFor(node, variables.length > 0 ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable)) - : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, true), ts.visitNode(node.incrementor, visitor, ts.isExpression, true), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock)); + : undefined, ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -42251,7 +45950,7 @@ var ts; var variable = _a[_i]; hoistVariableDeclaration(variable.name); } - node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock)); + node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -42290,10 +45989,10 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitReturnStatement(node) { - emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node); + emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node); } function visitReturnStatement(node) { - return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node); + return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node); } function transformAndEmitWithStatement(node) { if (containsYield(node)) { @@ -42316,7 +46015,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 && defaultClauseIndex === -1) { + if (clause.kind === 257 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -42326,7 +46025,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253) { + if (clause.kind === 256) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -42428,9 +46127,9 @@ var ts; } return -1; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } return node; @@ -42442,17 +46141,17 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_36 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_36) { - var clone_6 = ts.getMutableClone(name_36); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -42461,7 +46160,7 @@ var ts; } function cacheExpression(node) { var temp; - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.getEmitFlags(node) & 4096) { return node; } temp = ts.createTempVariable(hoistVariableDeclaration); @@ -42553,15 +46252,22 @@ var ts; } function beginCatchBlock(variable) { ts.Debug.assert(peekBlockKind() === 0); - var text = variable.name.text; - var name = declareLocal(text); - if (!renamedCatchVariables) { - renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); - context.enableSubstitution(70); + var name; + if (ts.isGeneratedIdentifier(variable.name)) { + name = variable.name; + hoistVariableDeclaration(variable.name); + } + else { + var text = variable.name.text; + name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = ts.createMap(); + renamedCatchVariableDeclarations = []; + context.enableSubstitution(70); + } + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; } - renamedCatchVariables[text] = true; - renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1); var endLabel = exception.endLabel; @@ -42761,23 +46467,23 @@ var ts; } function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + ts.addSyntheticTrailingComment(literal, 3, getInstructionName(instruction)); return literal; } function createInlineBreak(label, location) { ts.Debug.assert(label > 0, "Invalid label: " + label); - return ts.createReturn(ts.createArrayLiteral([ + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), location); + ])), location); } function createInlineReturn(expression, location) { - return ts.createReturn(ts.createArrayLiteral(expression + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), location); + : [createInstruction(2)])), location); } function createGeneratorResume(location) { - return ts.createCall(ts.createPropertyAccess(state, "sent"), undefined, [], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(state, "sent"), undefined, []), location); } function emitNop() { emitWorker(0); @@ -42843,7 +46549,7 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144)); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, buildResult.length > 0)), 262144)); } function buildStatements() { if (operations) { @@ -43052,51 +46758,51 @@ var ts; } } function writeAssign(left, right, operationLocation) { - writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation)); + writeStatement(ts.setTextRange(ts.createStatement(ts.createAssignment(left, right)), operationLocation)); } function writeThrow(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createThrow(expression, operationLocation)); + writeStatement(ts.setTextRange(ts.createThrow(expression), operationLocation)); } function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), operationLocation)); + : [createInstruction(2)])), operationLocation), 384)); } function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation)); + ])), operationLocation), 384)); } function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384)), 1)); } function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384)), 1)); } function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4), expression] - : [createInstruction(4)]), operationLocation)); + : [createInstruction(4)])), operationLocation), 384)); } function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(5), expression - ]), operationLocation)); + ])), operationLocation), 384)); } function writeEndfinally() { lastOperationWasAbrupt = true; @@ -43114,363 +46820,238 @@ var ts; name: "typescript:generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; -})(ts || (ts = {})); -var ts; -(function (ts) { - function transformES5(context) { - var previousOnSubstituteNode = context.onSubstituteNode; - context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); - context.enableSubstitution(257); - return transformSourceFile; - function transformSourceFile(node) { - return node; - } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isPropertyAccessExpression(node)) { - return substitutePropertyAccessExpression(node); - } - else if (ts.isPropertyAssignment(node)) { - return substitutePropertyAssignment(node); - } - return node; - } - function substitutePropertyAccessExpression(node) { - var literalName = trySubstituteReservedName(node.name); - if (literalName) { - return ts.createElementAccess(node.expression, literalName, node); - } - return node; - } - function substitutePropertyAssignment(node) { - var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); - if (literalName) { - return ts.updatePropertyAssignment(node, literalName, node.initializer); - } - return node; - } - function trySubstituteReservedName(name) { - var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); - if (token >= 71 && token <= 106) { - return ts.createLiteral(name, name); - } - return undefined; - } - } - ts.transformES5 = transformES5; })(ts || (ts = {})); var ts; (function (ts) { - function transformES2015Module(context) { - var compilerOptions = context.getCompilerOptions(); - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261); - context.enableSubstitution(70); - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; - } - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); - if (externalHelpersModuleName) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements); - ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); - ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - } - else { - return ts.visitEachChild(node, visitor, context); - } - } - return node; - } - function visitor(node) { - switch (node.kind) { - case 234: - return undefined; - case 240: - return visitExportAssignment(node); - } - return node; - } - function visitExportAssignment(node) { - return node.isExportEquals ? undefined : node; - } - function onEmitNode(emitContext, node, emitCallback) { - if (ts.isSourceFile(node)) { - currentSourceFile = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSourceFile = undefined; - } - else { - previousOnEmitNode(emitContext, node, emitCallback); - } - } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isIdentifier(node) && emitContext === 1) { - return substituteExpressionIdentifier(node); - } - return node; - } - function substituteExpressionIdentifier(node) { - if (ts.getEmitFlags(node) & 4096) { - var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); - if (externalHelpersModuleName) { - return ts.createPropertyAccess(externalHelpersModuleName, node); - } + function transformModule(context) { + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; } - return node; } - } - ts.transformES2015Module = transformES2015Module; -})(ts || (ts = {})); -var ts; -(function (ts) { - function transformSystemModule(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var moduleKind = ts.getEmitModuleKind(compilerOptions); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableEmitNotification(261); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); - var exportFunctionsMap = ts.createMap(); - var noSubstitutionMap = ts.createMap(); + context.enableSubstitution(192); + context.enableSubstitution(261); + context.enableEmitNotification(264); + var moduleInfoMap = []; + var deferredExports = []; var currentSourceFile; - var moduleInfo; - var exportFunction; - var contextObject; - var hoistedStatements; - var enclosingBlockScopedContainer; + var currentModuleInfo; var noSubstitution; return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node) - || !(ts.isExternalModule(node) - || compilerOptions.isolatedModules)) { + if (ts.isDeclarationFile(node) || !(ts.isExternalModule(node) || compilerOptions.isolatedModules)) { return node; } - var id = ts.getOriginalNodeId(node); currentSourceFile = node; - enclosingBlockScopedContainer = node; - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); - contextObject = ts.createUniqueName("context"); - var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); - var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); - var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ - ts.createParameter(undefined, undefined, undefined, exportFunction), - ts.createParameter(undefined, undefined, undefined, contextObject) - ], undefined, moduleBodyBlock); - var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ - ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName - ? [moduleName, dependencies, moduleBodyFunction] - : [dependencies, moduleBodyFunction])) - ], node.statements)); - if (!(compilerOptions.outFile || compilerOptions.out)) { - ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); - } - if (noSubstitution) { - noSubstitutionMap[id] = noSubstitution; - noSubstitution = undefined; - } + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + var transformModule = getTransformModuleDelegate(moduleKind); + var updated = transformModule(node); currentSourceFile = undefined; - moduleInfo = undefined; - exportFunction = undefined; - contextObject = undefined; - hoistedStatements = undefined; - enclosingBlockScopedContainer = undefined; + currentModuleInfo = undefined; return ts.aggregateTransformFlags(updated); } - function collectDependencyGroups(externalImports) { - var groupIndices = ts.createMap(); - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; i++) { - var externalImport = externalImports[i]; - var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); - var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].externalImports.push(externalImport); - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push({ - name: externalModuleName, - externalImports: [externalImport] - }); - } + function shouldEmitUnderscoreUnderscoreESModule() { + if (!currentModuleInfo.exportEquals && ts.isExternalModule(currentSourceFile)) { + return true; } - return dependencyGroups; + return false; } - function createSystemModuleBody(node, dependencyGroups) { - var statements = []; + function transformCommonJSModule(node) { startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) - ]))); - ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true); - var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); - ts.addRange(statements, hoistedStatements); + var statements = []; + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); + } + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); + ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); + addExportEqualsIfNeeded(statements, false); ts.addRange(statements, endLexicalEnvironment()); - var exportStarFunction = addExportStarIfNeeded(statements); - statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([ - ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), - ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true))) - ]), true))); - return ts.createBlock(statements, undefined, true); - } - function addExportStarIfNeeded(statements) { - if (!moduleInfo.hasExportStarsToExportValues) { - return; + var updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); + if (currentModuleInfo.hasExportStarsToExportValues) { + ts.addEmitHelper(updated, exportStarHelper); } - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { - var hasExportDeclarationWithExportClause = false; - for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { - var externalImport = _a[_i]; - if (externalImport.kind === 241 && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } + return updated; + } + function transformAMDModule(node) { + var define = ts.createIdentifier("define"); + var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); + var _a = collectAsynchronousDependencies(node, true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, "require"), + ts.createParameter(undefined, undefined, undefined, "exports") + ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) + ]))) + ]), node.statements)); + } + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, "factory")], undefined, ts.setTextRange(ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement(undefined, [ + ts.createVariableDeclaration("v", undefined, ts.createCall(ts.createIdentifier("factory"), undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], true), undefined)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, undefined, [ + ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, "require"), + ts.createParameter(undefined, undefined, undefined, "exports") + ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) + ])) + ]), node.statements)); + } + function collectAsynchronousDependencies(node, includeNonAmdDependencies) { + var aliasedModuleNames = []; + var unaliasedModuleNames = []; + var importAliasNames = []; + for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { + var amdDependency = _a[_i]; + if (amdDependency.name) { + aliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + importAliasNames.push(ts.createParameter(undefined, undefined, undefined, amdDependency.name)); } - if (!hasExportDeclarationWithExportClause) { - var exportStarFunction_1 = createExportStarFunction(undefined); - statements.push(exportStarFunction_1); - return exportStarFunction_1.name; + else { + unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)); } } - var exportedNames = []; - if (moduleInfo.exportedNames) { - for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { - var exportedLocalName = _c[_b]; - if (exportedLocalName.text === "default") { - continue; + for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { + var importNode = _c[_b]; + var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); + if (externalModuleName) { + if (includeNonAmdDependencies && importAliasName) { + ts.setEmitFlags(importAliasName, 4); + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); + } + else { + unaliasedModuleNames.push(externalModuleName); } - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true))); - } - } - for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { - var externalImport = _e[_d]; - if (externalImport.kind !== 241) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - continue; - } - for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { - var element = _g[_f]; - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true))); } } - var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); - statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, undefined, true)) - ]))); - var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); - statements.push(exportStarFunction); - return exportStarFunction.name; + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; } - function createExportStarFunction(localNames) { - var exportStarFunction = ts.createUniqueName("exportStar"); - var m = ts.createIdentifier("m"); - var n = ts.createIdentifier("n"); - var exports = ts.createIdentifier("exports"); - var condition = ts.createStrictInequality(n, ts.createLiteral("default")); - if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n]))); + function transformAsynchronousModuleBody(node) { + startLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); } - return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([ - ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exports, undefined, ts.createObjectLiteral([])) - ])), - ts.createForIn(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(n, undefined) - ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1) - ])), - ts.createStatement(ts.createCall(exportFunction, undefined, [exports])) - ], undefined, true)); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); + ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); + addExportEqualsIfNeeded(statements, true); + ts.addRange(statements, endLexicalEnvironment()); + var body = ts.createBlock(statements, true); + if (currentModuleInfo.hasExportStarsToExportValues) { + ts.addEmitHelper(body, exportStarHelper); + } + return body; } - function createSettersArray(exportStarFunction, dependencyGroups) { - var setters = []; - for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { - var group = dependencyGroups_1[_i]; - var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); }); - var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""); - var statements = []; - for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) { - var entry = _b[_a]; - var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); - switch (entry.kind) { - case 235: - if (!entry.importClause) { - break; - } - case 234: - ts.Debug.assert(importVariableName !== undefined); - statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); - break; - case 241: - ts.Debug.assert(importVariableName !== undefined); - if (entry.exportClause) { - var properties = []; - for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { - var e = _d[_c]; - properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); - } - statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, undefined, true)]))); - } - else { - statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName]))); - } - break; - } + function addExportEqualsIfNeeded(statements, emitAsReturn) { + if (currentModuleInfo.exportEquals) { + if (emitAsReturn) { + var statement = ts.createReturn(currentModuleInfo.exportEquals.expression); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 384 | 1536); + statements.push(statement); + } + else { + var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression)); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 1536); + statements.push(statement); } - setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, undefined, true))); } - return ts.createArrayLiteral(setters, undefined, true); } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 241: - return undefined; - case 240: + case 243: + return visitExportDeclaration(node); + case 242: return visitExportAssignment(node); + case 207: + return visitVariableStatement(node); + case 227: + return visitFunctionDeclaration(node); + case 228: + return visitClassDeclaration(node); + case 296: + return visitMergeDeclarationMarker(node); + case 297: + return visitEndOfDeclarationMarker(node); default: - return nestedElementVisitor(node); + return node; } } function visitImportDeclaration(node) { var statements; - if (node.importClause) { - hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); + var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); + if (moduleKind !== ts.ModuleKind.AMD) { + if (!node.importClause) { + return ts.setTextRange(ts.createStatement(createRequireCall(node)), node); + } + else { + var variables = []; + if (namespaceDeclaration && !ts.isDefaultImport(node)) { + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, createRequireCall(node))); + } + else { + variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), undefined, createRequireCall(node))); + if (namespaceDeclaration && ts.isDefaultImport(node)) { + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node))); + } + } + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, languageVersion >= 2 ? 2 : 0)), node)); + } + } + else if (namespaceDeclaration && ts.isDefaultImport(node)) { + statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node)), node) + ], languageVersion >= 2 ? 2 : 0))); } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); @@ -43481,10 +47062,32 @@ var ts; } return ts.singleOrMany(statements); } + function createRequireCall(importNode) { + var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + var args = []; + if (moduleName) { + args.push(moduleName); + } + return ts.createCall(ts.createIdentifier("require"), undefined, args); + } function visitImportEqualsDeclaration(node) { ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); var statements; - hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); + if (moduleKind !== ts.ModuleKind.AMD) { + if (ts.hasModifier(node, 1)) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(node.name, createRequireCall(node))), node)); + } + else { + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node)) + ], languageVersion >= 2 ? 2 : 0)), node)); + } + } + else { + if (ts.hasModifier(node, 1)) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node))), node)); + } + } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); @@ -43494,41 +47097,73 @@ var ts; } return ts.singleOrMany(statements); } + function visitExportDeclaration(node) { + if (!node.moduleSpecifier) { + return undefined; + } + var generatedName = ts.getGeneratedNameForNode(node); + if (node.exportClause) { + var statements = []; + if (moduleKind !== ts.ModuleKind.AMD) { + statements.push(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node)) + ])), node)); + } + for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { + var specifier = _a[_i]; + var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); + statements.push(ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue)), specifier)); + } + return ts.singleOrMany(statements); + } + else { + return ts.setTextRange(ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [ + moduleKind !== ts.ModuleKind.AMD + ? createRequireCall(node) + : generatedName + ])), node); + } + } function visitExportAssignment(node) { if (node.isExportEquals) { return undefined; } - var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression); + var statements; var original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, true); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, node, true); } else { - return createExportStatement(ts.createIdentifier("default"), expression, true); + statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, node, true); } + return ts.singleOrMany(statements); } function visitFunctionDeclaration(node) { + var statements; if (ts.hasModifier(node, 1)) { - hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body), node), node)); } else { - hoistedStatements = ts.append(hoistedStatements, node); + statements = ts.append(statements, node); } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { - hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); + statements = appendExportsOfHoistedDeclaration(statements, node); } - return undefined; + return ts.singleOrMany(statements); } function visitClassDeclaration(node) { var statements; - var name = ts.getLocalName(node); - hoistVariableDeclaration(name); - statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), node)), node)); + if (ts.hasModifier(node, 1)) { + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members), node), node)); + } + else { + statements = ts.append(statements, node); + } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); @@ -43539,75 +47174,54 @@ var ts; return ts.singleOrMany(statements); } function visitVariableStatement(node) { - if (!shouldHoistVariableDeclarationList(node.declarationList)) { - return ts.visitNode(node, destructuringVisitor, ts.isStatement); - } + var statements; + var variables; var expressions; - var isExportedDeclaration = ts.hasModifier(node, 1); - var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); - for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - if (variable.initializer) { - expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); + if (ts.hasModifier(node, 1)) { + var modifiers = void 0; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) { + if (!modifiers) { + modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier); + } + variables = ts.append(variables, variable); + } + else if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable)); + } } - else { - hoistBindingElement(variable); + if (variables) { + statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); + } + if (expressions) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } } - var statements; - if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node)); + else { + statements = ts.append(statements, node); } - if (isMarkedDeclaration) { + if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); } else { - statements = appendExportsOfVariableStatement(statements, node, false); + statements = appendExportsOfVariableStatement(statements, node); } return ts.singleOrMany(statements); } - function hoistBindingElement(node) { + function transformInitializedVariable(node) { if (ts.isBindingPattern(node.name)) { - for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!ts.isOmittedExpression(element)) { - hoistBindingElement(element); - } - } + return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression); } else { - hoistVariableDeclaration(ts.getSynthesizedClone(node.name)); + return ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name), node.name), node.initializer); } } - function shouldHoistVariableDeclarationList(node) { - return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 261 - || (ts.getOriginalNode(node).flags & 3) === 0); - } - function transformInitializedVariable(node, isExportedDeclaration) { - var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; - return ts.isBindingPattern(node.name) - ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); - } - function createExportedVariableAssignment(name, value, location) { - return createVariableAssignment(name, value, location, true); - } - function createNonExportedVariableAssignment(name, value, location) { - return createVariableAssignment(name, value, location, false); - } - function createVariableAssignment(name, value, location, isExportedDeclaration) { - hoistVariableDeclaration(ts.getSynthesizedClone(name)); - return isExportedDeclaration - ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location))) - : preventSubstitution(ts.createAssignment(name, value, location)); - } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); - var isExportedDeclaration = ts.hasModifier(node.original, 1); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } return node; } @@ -43624,7 +47238,7 @@ var ts; return node; } function appendExportsOfImportDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } var importClause = decl.importClause; @@ -43637,10 +47251,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -43651,263 +47265,93 @@ var ts; return statements; } function appendExportsOfImportEqualsDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } return appendExportsOfDeclaration(statements, decl); } - function appendExportsOfVariableStatement(statements, node, exportSelf) { - if (moduleInfo.exportEquals) { + function appendExportsOfVariableStatement(statements, node) { + if (currentModuleInfo.exportEquals) { return statements; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.initializer || exportSelf) { - statements = appendExportsOfBindingElement(statements, decl, exportSelf); - } + statements = appendExportsOfBindingElement(statements, decl); } return statements; } - function appendExportsOfBindingElement(statements, decl, exportSelf) { - if (moduleInfo.exportEquals) { + function appendExportsOfBindingElement(statements, decl) { + if (currentModuleInfo.exportEquals) { return statements; } if (ts.isBindingPattern(decl.name)) { for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { - statements = appendExportsOfBindingElement(statements, element, exportSelf); + statements = appendExportsOfBindingElement(statements, element); } } } else if (!ts.isGeneratedIdentifier(decl.name)) { - var excludeName = void 0; - if (exportSelf) { - statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); - excludeName = decl.name.text; - } - statements = appendExportsOfDeclaration(statements, decl, excludeName); + statements = appendExportsOfDeclaration(statements, decl); } return statements; } function appendExportsOfHoistedDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } - var excludeName; if (ts.hasModifier(decl, 1)) { - var exportName = ts.hasModifier(decl, 512) ? ts.createLiteral("default") : decl.name; - statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); - excludeName = exportName.text; + var exportName = ts.hasModifier(decl, 512) ? ts.createIdentifier("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), decl); } if (decl.name) { - statements = appendExportsOfDeclaration(statements, decl, excludeName); + statements = appendExportsOfDeclaration(statements, decl); } return statements; } - function appendExportsOfDeclaration(statements, decl, excludeName) { - if (moduleInfo.exportEquals) { - return statements; - } + function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; - if (exportSpecifier.name.text !== excludeName) { - statements = appendExportStatement(statements, exportSpecifier.name, name); - } + statements = appendExportStatement(statements, exportSpecifier.name, name, exportSpecifier.name); } } return statements; } - function appendExportStatement(statements, exportName, expression, allowComments) { - statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)); + function appendExportStatement(statements, exportName, expression, location, allowComments) { + statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); return statements; } - function createExportStatement(name, value, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value)); - ts.startOnNewLine(statement); - if (!allowComments) { - ts.setEmitFlags(statement, 1536); - } - return statement; - } - function createExportExpression(name, value) { - var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; - return ts.createCall(exportFunction, undefined, [exportName, value]); - } - function nestedElementVisitor(node) { - switch (node.kind) { - case 205: - return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); - case 226: - return visitClassDeclaration(node); - case 211: - return visitForStatement(node); - case 212: - return visitForInStatement(node); - case 213: - return visitForOfStatement(node); - case 209: - return visitDoStatement(node); - case 210: - return visitWhileStatement(node); - case 219: - return visitLabeledStatement(node); - case 217: - return visitWithStatement(node); - case 218: - return visitSwitchStatement(node); - case 232: - return visitCaseBlock(node); - case 253: - return visitCaseClause(node); - case 254: - return visitDefaultClause(node); - case 221: - return visitTryStatement(node); - case 256: - return visitCatchClause(node); - case 204: - return visitBlock(node); - case 295: - return visitMergeDeclarationMarker(node); - case 296: - return visitEndOfDeclarationMarker(node); - default: - return destructuringVisitor(node); - } - } - function visitForStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - function visitForInStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - function visitForOfStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - function shouldHoistForInitializer(node) { - return ts.isVariableDeclarationList(node) - && shouldHoistVariableDeclarationList(node); - } - function visitForInitializer(node) { - if (shouldHoistForInitializer(node)) { - var expressions = void 0; - for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - expressions = ts.append(expressions, transformInitializedVariable(variable, false)); - } - return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); - } - else { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - } - function visitDoStatement(node) { - return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); - } - function visitWhileStatement(node) { - return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); - } - function visitLabeledStatement(node) { - return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); - } - function visitWithStatement(node) { - return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); - } - function visitSwitchStatement(node) { - return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); - } - function visitCaseBlock(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - function visitCaseClause(node) { - return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)); - } - function visitDefaultClause(node) { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - function visitTryStatement(node) { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - function visitCatchClause(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - function visitBlock(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.visitEachChild(node, nestedElementVisitor, context); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - function destructuringVisitor(node) { - if (node.transformFlags & 1024 - && node.kind === 192) { - return visitDestructuringAssignment(node); - } - else if (node.transformFlags & 2048) { - return ts.visitEachChild(node, destructuringVisitor, context); + function createUnderscoreUnderscoreESModule() { + var statement; + if (languageVersion === 0) { + statement = ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true))); } else { - return node; + statement = ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ + ts.createIdentifier("exports"), + ts.createLiteral("__esModule"), + ts.createObjectLiteral([ + ts.createPropertyAssignment("value", ts.createLiteral(true)) + ]) + ])); } + ts.setEmitFlags(statement, 524288); + return statement; } - function visitDestructuringAssignment(node) { - if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true); + function createExportStatement(name, value, location, allowComments) { + var statement = ts.setTextRange(ts.createStatement(createExportExpression(name, value)), location); + ts.startOnNewLine(statement); + if (!allowComments) { + ts.setEmitFlags(statement, 1536); } - return ts.visitEachChild(node, destructuringVisitor, context); + return statement; } - function hasExportedReferenceInDestructuringTarget(node) { - if (ts.isAssignmentExpression(node)) { - return hasExportedReferenceInDestructuringTarget(node.left); - } - else if (ts.isSpreadExpression(node)) { - return hasExportedReferenceInDestructuringTarget(node.expression); - } - else if (ts.isObjectLiteralExpression(node)) { - return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); - } - else if (ts.isArrayLiteralExpression(node)) { - return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); - } - else if (ts.isShorthandPropertyAssignment(node)) { - return hasExportedReferenceInDestructuringTarget(node.name); - } - else if (ts.isPropertyAssignment(node)) { - return hasExportedReferenceInDestructuringTarget(node.initializer); - } - else if (ts.isIdentifier(node)) { - var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261; - } - else { - return false; - } + function createExportExpression(name, value, location) { + return ts.setTextRange(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value), location); } function modifierVisitor(node) { switch (node.kind) { @@ -43917,43 +47361,52 @@ var ts; } return node; } - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { - var id = ts.getOriginalNodeId(node); + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264) { currentSourceFile = node; - moduleInfo = moduleInfoMap[id]; - exportFunction = exportFunctionsMap[id]; - noSubstitution = noSubstitutionMap[id]; - if (noSubstitution) { - delete noSubstitutionMap[id]; - } - previousOnEmitNode(emitContext, node, emitCallback); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; + noSubstitution = []; + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; - moduleInfo = undefined; - exportFunction = undefined; + currentModuleInfo = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (isSubstitutionPrevented(node)) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (node.id && noSubstitution[node.id]) { return node; } - if (emitContext === 1) { + if (hint === 1) { return substituteExpression(node); } + else if (ts.isShorthandPropertyAssignment(node)) { + return substituteShorthandPropertyAssignment(node); + } + return node; + } + function substituteShorthandPropertyAssignment(node) { + var name = node.name; + var exportedOrImportedName = substituteExpressionIdentifier(name); + if (exportedOrImportedName !== name) { + if (node.objectAssignmentInitializer) { + var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); + } + return ts.setTextRange(ts.createPropertyAssignment(name, exportedOrImportedName), node); + } return node; } function substituteExpression(node) { switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); - case 190: + case 192: case 191: return substituteUnaryExpression(node); } @@ -43968,13 +47421,18 @@ var ts; return node; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { + var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); + if (exportContainer && exportContainer.kind === 264) { + return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); + } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); } else if (ts.isImportSpecifier(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), node); + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name)), node); } } } @@ -43991,7 +47449,8 @@ var ts; var expression = node; for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) { var exportName = exportedNames_1[_i]; - expression = createExportExpression(exportName, preventSubstitution(expression)); + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression, node); } return expression; } @@ -44006,17 +47465,13 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 - ? ts.createPrefix(node.operator, node.operand, node) + var expression = node.kind === 192 + ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1)), node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { var exportName = exportedNames_2[_i]; - expression = createExportExpression(exportName, preventSubstitution(expression)); - } - if (node.kind === 191) { - expression = node.operator === 42 - ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) - : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression); } return expression; } @@ -44024,61 +47479,49 @@ var ts; return node; } function getExports(name) { - var exportedNames; if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { - var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 261) { - exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); - } - exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); + return currentModuleInfo + && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; } } - return exportedNames; - } - function preventSubstitution(node) { - if (noSubstitution === undefined) - noSubstitution = ts.createMap(); - noSubstitution[ts.getNodeId(node)] = true; - return node; - } - function isSubstitutionPrevented(node) { - return noSubstitution && node.id && noSubstitution[node.id]; } } - ts.transformSystemModule = transformSystemModule; + ts.transformModule = transformModule; + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; })(ts || (ts = {})); var ts; (function (ts) { - function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + function transformSystemModule(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableSubstitution(258); - context.enableEmitNotification(261); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); + context.enableSubstitution(192); + context.enableEmitNotification(264); + var moduleInfoMap = []; + var deferredExports = []; + var exportFunctionsMap = []; + var noSubstitutionMap = []; var currentSourceFile; - var currentModuleInfo; + var moduleInfo; + var exportFunction; + var contextObject; + var hoistedStatements; + var enclosingBlockScopedContainer; var noSubstitution; return transformSourceFile; function transformSourceFile(node) { @@ -44087,158 +47530,214 @@ var ts; || compilerOptions.isolatedModules)) { return node; } + var id = ts.getOriginalNodeId(node); currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; - var updated = transformModule(node); + enclosingBlockScopedContainer = node; + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; + contextObject = ts.createUniqueName("context"); + var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); + var moduleBodyFunction = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, exportFunction), + ts.createParameter(undefined, undefined, undefined, contextObject) + ], undefined, moduleBodyBlock); + var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); + var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName + ? [moduleName, dependencies, moduleBodyFunction] + : [dependencies, moduleBodyFunction])) + ]), node.statements)), 1024); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } + if (noSubstitution) { + noSubstitutionMap[id] = noSubstitution; + noSubstitution = undefined; + } currentSourceFile = undefined; - currentModuleInfo = undefined; + moduleInfo = undefined; + exportFunction = undefined; + contextObject = undefined; + hoistedStatements = undefined; + enclosingBlockScopedContainer = undefined; return ts.aggregateTransformFlags(updated); } - function transformCommonJSModule(node) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - addExportEqualsIfNeeded(statements, false); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - if (currentModuleInfo.hasExportStarsToExportValues) { - ts.addEmitHelper(updated, exportStarHelper); + function collectDependencyGroups(externalImports) { + var groupIndices = ts.createMap(); + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; i++) { + var externalImport = externalImports[i]; + var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); + if (externalModuleName) { + var text = externalModuleName.text; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { + dependencyGroups[groupIndex].externalImports.push(externalImport); + } + else { + groupIndices.set(text, dependencyGroups.length); + dependencyGroups.push({ + name: externalModuleName, + externalImports: [externalImport] + }); + } + } } - return updated; - } - function transformAMDModule(node) { - var define = ts.createIdentifier("define"); - var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, true); - } - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, undefined, false); + return dependencyGroups; } - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; - return ts.updateSourceFileNode(node, ts.createNodeArray([ - ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([ - ts.createArrayLiteral([ - ts.createLiteral("require"), - ts.createLiteral("exports") - ].concat(aliasedModuleNames, unaliasedModuleNames)), - ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ - ts.createParameter(undefined, undefined, undefined, "require"), - ts.createParameter(undefined, undefined, undefined, "exports") - ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) - ]))) - ], node.statements)); + function createSystemModuleBody(node, dependencyGroups) { + var statements = []; + startLexicalEnvironment(); + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) + ]))); + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement); + var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); + ts.addRange(statements, hoistedStatements); + ts.addRange(statements, endLexicalEnvironment()); + var exportStarFunction = addExportStarIfNeeded(statements); + var moduleObject = ts.createObjectLiteral([ + ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), + ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, true))) + ]); + moduleObject.multiLine = true; + statements.push(ts.createReturn(moduleObject)); + return ts.createBlock(statements, true); } - function collectAsynchronousDependencies(node, includeNonAmdDependencies) { - var aliasedModuleNames = []; - var unaliasedModuleNames = []; - var importAliasNames = []; - for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { - var amdDependency = _a[_i]; - if (amdDependency.name) { - aliasedModuleNames.push(ts.createLiteral(amdDependency.path)); - importAliasNames.push(ts.createParameter(undefined, undefined, undefined, amdDependency.name)); + function addExportStarIfNeeded(statements) { + if (!moduleInfo.hasExportStarsToExportValues) { + return; + } + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { + var hasExportDeclarationWithExportClause = false; + for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { + var externalImport = _a[_i]; + if (externalImport.kind === 243 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } } - else { - unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + if (!hasExportDeclarationWithExportClause) { + var exportStarFunction_1 = createExportStarFunction(undefined); + statements.push(exportStarFunction_1); + return exportStarFunction_1.name; } } - for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { - var importNode = _c[_b]; - var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); - var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); - if (includeNonAmdDependencies && importAliasName) { - ts.setEmitFlags(importAliasName, 4); - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); + var exportedNames = []; + if (moduleInfo.exportedNames) { + for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { + var exportedLocalName = _c[_b]; + if (exportedLocalName.text === "default") { + continue; + } + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createTrue())); } - else { - unaliasedModuleNames.push(externalModuleName); + } + for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { + var externalImport = _e[_d]; + if (externalImport.kind !== 243) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + continue; + } + for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { + var element = _g[_f]; + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createTrue())); } } - return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); + statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, true)) + ]))); + var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); + statements.push(exportStarFunction); + return exportStarFunction.name; } - function transformAsynchronousModuleBody(node) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - addExportEqualsIfNeeded(statements, true); - var body = ts.createBlock(statements, undefined, true); - if (currentModuleInfo.hasExportStarsToExportValues) { - ts.addEmitHelper(body, exportStarHelper); + function createExportStarFunction(localNames) { + var exportStarFunction = ts.createUniqueName("exportStar"); + var m = ts.createIdentifier("m"); + var n = ts.createIdentifier("n"); + var exports = ts.createIdentifier("exports"); + var condition = ts.createStrictInequality(n, ts.createLiteral("default")); + if (localNames) { + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), undefined, [n]))); } - return body; + return ts.createFunctionDeclaration(undefined, undefined, undefined, exportStarFunction, undefined, [ts.createParameter(undefined, undefined, undefined, m)], undefined, ts.createBlock([ + ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exports, undefined, ts.createObjectLiteral([])) + ])), + ts.createForIn(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(n, undefined) + ]), m, ts.createBlock([ + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1) + ])), + ts.createStatement(ts.createCall(exportFunction, undefined, [exports])) + ], true)); } - function addExportEqualsIfNeeded(statements, emitAsReturn) { - if (currentModuleInfo.exportEquals) { - if (emitAsReturn) { - var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 384 | 1536); - statements.push(statement); - } - else { - var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 1536); - statements.push(statement); + function createSettersArray(exportStarFunction, dependencyGroups) { + var setters = []; + for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { + var group = dependencyGroups_1[_i]; + var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); }); + var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""); + var statements = []; + for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) { + var entry = _b[_a]; + var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); + switch (entry.kind) { + case 237: + if (!entry.importClause) { + break; + } + case 236: + ts.Debug.assert(importVariableName !== undefined); + statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); + break; + case 243: + ts.Debug.assert(importVariableName !== undefined); + if (entry.exportClause) { + var properties = []; + for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); + } + statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, true)]))); + } + else { + statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName]))); + } + break; + } } + setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, true))); } + return ts.createArrayLiteral(setters, true); } function sourceElementVisitor(node) { switch (node.kind) { - case 235: - return visitImportDeclaration(node); - case 234: - return visitImportEqualsDeclaration(node); - case 241: - return visitExportDeclaration(node); - case 240: - return visitExportAssignment(node); - case 205: - return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); - case 226: - return visitClassDeclaration(node); - case 295: - return visitMergeDeclarationMarker(node); - case 296: - return visitEndOfDeclarationMarker(node); - default: - return node; - } - } - function visitImportDeclaration(node) { - var statements; - var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); - if (moduleKind !== ts.ModuleKind.AMD) { - if (!node.importClause) { - return ts.createStatement(createRequireCall(node), node); - } - else { - var variables = []; - if (namespaceDeclaration && !ts.isDefaultImport(node)) { - variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, createRequireCall(node))); - } - else { - variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), undefined, createRequireCall(node))); - if (namespaceDeclaration && ts.isDefaultImport(node)) { - variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node))); - } - } - statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, undefined, languageVersion >= 2 ? 2 : 0), node)); - } + case 237: + return visitImportDeclaration(node); + case 236: + return visitImportEqualsDeclaration(node); + case 243: + return undefined; + case 242: + return visitExportAssignment(node); + default: + return nestedElementVisitor(node); } - else if (namespaceDeclaration && ts.isDefaultImport(node)) { - statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node), node) - ], undefined, languageVersion >= 2 ? 2 : 0))); + } + function visitImportDeclaration(node) { + var statements; + if (node.importClause) { + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); @@ -44249,32 +47748,10 @@ var ts; } return ts.singleOrMany(statements); } - function createRequireCall(importNode) { - var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); - var args = []; - if (moduleName) { - args.push(moduleName); - } - return ts.createCall(ts.createIdentifier("require"), undefined, args); - } function visitImportEqualsDeclaration(node) { ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); var statements; - if (moduleKind !== ts.ModuleKind.AMD) { - if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), node)); - } - else { - statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node)) - ], undefined, languageVersion >= 2 ? 2 : 0), node)); - } - } - else { - if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), node)); - } - } + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); @@ -44284,73 +47761,41 @@ var ts; } return ts.singleOrMany(statements); } - function visitExportDeclaration(node) { - if (!node.moduleSpecifier) { - return undefined; - } - var generatedName = ts.getGeneratedNameForNode(node); - if (node.exportClause) { - var statements = []; - if (moduleKind !== ts.ModuleKind.AMD) { - statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node)) - ]), node)); - } - for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { - var specifier = _a[_i]; - var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); - statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), specifier)); - } - return ts.singleOrMany(statements); - } - else { - return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [ - moduleKind !== ts.ModuleKind.AMD - ? createRequireCall(node) - : generatedName - ]), node); - } - } function visitExportAssignment(node) { if (node.isExportEquals) { return undefined; } - var statements; + var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression); var original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, node, true); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, true); } else { - statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, node, true); + return createExportStatement(ts.createIdentifier("default"), expression, true); } - return ts.singleOrMany(statements); } function visitFunctionDeclaration(node) { - var statements; if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body, node), node)); + hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); } else { - statements = ts.append(statements, node); + hoistedStatements = ts.append(hoistedStatements, node); } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { - statements = appendExportsOfHoistedDeclaration(statements, node); + hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); } - return ts.singleOrMany(statements); + return undefined; } function visitClassDeclaration(node) { var statements; - if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members, node), node)); - } - else { - statements = ts.append(statements, node); - } + var name = ts.getLocalName(node); + hoistVariableDeclaration(name); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.createAssignment(name, ts.setTextRange(ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement)), node))), node)); if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); @@ -44361,54 +47806,75 @@ var ts; return ts.singleOrMany(statements); } function visitVariableStatement(node) { - var statements; - var variables; + if (!shouldHoistVariableDeclarationList(node.declarationList)) { + return ts.visitNode(node, destructuringVisitor, ts.isStatement); + } var expressions; - if (ts.hasModifier(node, 1)) { - var modifiers = void 0; - for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) { - if (!modifiers) { - modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier); - } - variables = ts.append(variables, variable); - } - else if (variable.initializer) { - expressions = ts.append(expressions, transformInitializedVariable(variable)); - } - } - if (variables) { - statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); + var isExportedDeclaration = ts.hasModifier(node, 1); + var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); } - if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node)); + else { + hoistBindingElement(variable); } } - else { - statements = ts.append(statements, node); + var statements; + if (expressions) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { + if (isMarkedDeclaration) { var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); } else { - statements = appendExportsOfVariableStatement(statements, node); + statements = appendExportsOfVariableStatement(statements, node, false); } return ts.singleOrMany(statements); } - function transformInitializedVariable(node) { + function hoistBindingElement(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression); + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + hoistBindingElement(element); + } + } } else { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer); + hoistVariableDeclaration(ts.getSynthesizedClone(node.name)); } } + function shouldHoistVariableDeclarationList(node) { + return (ts.getEmitFlags(node) & 1048576) === 0 + && (enclosingBlockScopedContainer.kind === 264 + || (ts.getOriginalNode(node).flags & 3) === 0); + } + function transformInitializedVariable(node, isExportedDeclaration) { + var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; + return ts.isBindingPattern(node.name) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, false, createAssignment) + : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); + } + function createExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, true); + } + function createNonExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, false); + } + function createVariableAssignment(name, value, location, isExportedDeclaration) { + hoistVariableDeclaration(ts.getSynthesizedClone(name)); + return isExportedDeclaration + ? createExportExpression(name, preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location))) + : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)); + } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); + var isExportedDeclaration = ts.hasModifier(node.original, 1); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); } return node; } @@ -44425,7 +47891,7 @@ var ts; return node; } function appendExportsOfImportDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } var importClause = decl.importClause; @@ -44438,10 +47904,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -44452,93 +47918,266 @@ var ts; return statements; } function appendExportsOfImportEqualsDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } return appendExportsOfDeclaration(statements, decl); } - function appendExportsOfVariableStatement(statements, node) { - if (currentModuleInfo.exportEquals) { + function appendExportsOfVariableStatement(statements, node, exportSelf) { + if (moduleInfo.exportEquals) { return statements; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - statements = appendExportsOfBindingElement(statements, decl); + if (decl.initializer || exportSelf) { + statements = appendExportsOfBindingElement(statements, decl, exportSelf); + } } return statements; } - function appendExportsOfBindingElement(statements, decl) { - if (currentModuleInfo.exportEquals) { + function appendExportsOfBindingElement(statements, decl, exportSelf) { + if (moduleInfo.exportEquals) { return statements; } if (ts.isBindingPattern(decl.name)) { for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { - statements = appendExportsOfBindingElement(statements, element); + statements = appendExportsOfBindingElement(statements, element, exportSelf); } } } else if (!ts.isGeneratedIdentifier(decl.name)) { - statements = appendExportsOfDeclaration(statements, decl); + var excludeName = void 0; + if (exportSelf) { + statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); + excludeName = decl.name.text; + } + statements = appendExportsOfDeclaration(statements, decl, excludeName); } return statements; } function appendExportsOfHoistedDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } + var excludeName; if (ts.hasModifier(decl, 1)) { - var exportName = ts.hasModifier(decl, 512) ? ts.createIdentifier("default") : decl.name; - statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), decl); + var exportName = ts.hasModifier(decl, 512) ? ts.createLiteral("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); + excludeName = exportName.text; } if (decl.name) { - statements = appendExportsOfDeclaration(statements, decl); + statements = appendExportsOfDeclaration(statements, decl, excludeName); } return statements; } - function appendExportsOfDeclaration(statements, decl) { + function appendExportsOfDeclaration(statements, decl, excludeName) { + if (moduleInfo.exportEquals) { + return statements; + } var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; - statements = appendExportStatement(statements, exportSpecifier.name, name, exportSpecifier.name); + if (exportSpecifier.name.text !== excludeName) { + statements = appendExportStatement(statements, exportSpecifier.name, name); + } } } return statements; } - function appendExportStatement(statements, exportName, expression, location, allowComments) { - if (exportName.text === "default") { - var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 0) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); - } - else { - statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ - ts.createIdentifier("exports"), - ts.createLiteral("__esModule"), - ts.createObjectLiteral([ - ts.createPropertyAssignment("value", ts.createLiteral(true)) - ]) - ]))); - } - } - } - statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); + function appendExportStatement(statements, exportName, expression, allowComments) { + statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)); return statements; } - function createExportStatement(name, value, location, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value), location); + function createExportStatement(name, value, allowComments) { + var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { ts.setEmitFlags(statement, 1536); } return statement; } - function createExportExpression(name, value, location) { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value, location); + function createExportExpression(name, value) { + var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; + return ts.createCall(exportFunction, undefined, [exportName, value]); + } + function nestedElementVisitor(node) { + switch (node.kind) { + case 207: + return visitVariableStatement(node); + case 227: + return visitFunctionDeclaration(node); + case 228: + return visitClassDeclaration(node); + case 213: + return visitForStatement(node); + case 214: + return visitForInStatement(node); + case 215: + return visitForOfStatement(node); + case 211: + return visitDoStatement(node); + case 212: + return visitWhileStatement(node); + case 221: + return visitLabeledStatement(node); + case 219: + return visitWithStatement(node); + case 220: + return visitSwitchStatement(node); + case 234: + return visitCaseBlock(node); + case 256: + return visitCaseClause(node); + case 257: + return visitDefaultClause(node); + case 223: + return visitTryStatement(node); + case 259: + return visitCatchClause(node); + case 206: + return visitBlock(node); + case 296: + return visitMergeDeclarationMarker(node); + case 297: + return visitEndOfDeclarationMarker(node); + default: + return destructuringVisitor(node); + } + } + function visitForStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitForInStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitForOfStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForOf(node, node.awaitModifier, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function shouldHoistForInitializer(node) { + return ts.isVariableDeclarationList(node) + && shouldHoistVariableDeclarationList(node); + } + function visitForInitializer(node) { + if (!node) { + return node; + } + if (shouldHoistForInitializer(node)) { + var expressions = void 0; + for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + expressions = ts.append(expressions, transformInitializedVariable(variable, false)); + } + return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); + } + else { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + } + function visitDoStatement(node) { + return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); + } + function visitWhileStatement(node) { + return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + function visitLabeledStatement(node) { + return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + function visitWithStatement(node) { + return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + function visitSwitchStatement(node) { + return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); + } + function visitCaseBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitCaseClause(node) { + return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)); + } + function visitDefaultClause(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + function visitTryStatement(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + function visitCatchClause(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function visitBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.visitEachChild(node, nestedElementVisitor, context); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + function destructuringVisitor(node) { + if (node.transformFlags & 1024 + && node.kind === 193) { + return visitDestructuringAssignment(node); + } + else if (node.transformFlags & 2048) { + return ts.visitEachChild(node, destructuringVisitor, context); + } + else { + return node; + } + } + function visitDestructuringAssignment(node) { + if (hasExportedReferenceInDestructuringTarget(node.left)) { + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0, true); + } + return ts.visitEachChild(node, destructuringVisitor, context); + } + function hasExportedReferenceInDestructuringTarget(node) { + if (ts.isAssignmentExpression(node, true)) { + return hasExportedReferenceInDestructuringTarget(node.left); + } + else if (ts.isSpreadExpression(node)) { + return hasExportedReferenceInDestructuringTarget(node.expression); + } + else if (ts.isObjectLiteralExpression(node)) { + return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isArrayLiteralExpression(node)) { + return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isShorthandPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.name); + } + else if (ts.isPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.initializer); + } + else if (ts.isIdentifier(node)) { + var container = resolver.getReferencedExportContainer(node); + return container !== undefined && container.kind === 264; + } + else { + return false; + } } function modifierVisitor(node) { switch (node.kind) { @@ -44548,53 +48187,44 @@ var ts; } return node; } - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264) { + var id = ts.getOriginalNodeId(node); currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); - previousOnEmitNode(emitContext, node, emitCallback); + moduleInfo = moduleInfoMap[id]; + exportFunction = exportFunctionsMap[id]; + noSubstitution = noSubstitutionMap[id]; + if (noSubstitution) { + delete noSubstitutionMap[id]; + } + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; - currentModuleInfo = undefined; + moduleInfo = undefined; + exportFunction = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (node.id && noSubstitution[node.id]) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (isSubstitutionPrevented(node)) { return node; } - if (emitContext === 1) { + if (hint === 1) { return substituteExpression(node); } - else if (ts.isShorthandPropertyAssignment(node)) { - return substituteShorthandPropertyAssignment(node); - } - return node; - } - function substituteShorthandPropertyAssignment(node) { - var name = node.name; - var exportedOrImportedName = substituteExpressionIdentifier(name); - if (exportedOrImportedName !== name) { - if (node.objectAssignmentInitializer) { - var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name, initializer, node); - } - return ts.createPropertyAssignment(name, exportedOrImportedName, node); - } return node; } function substituteExpression(node) { switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); case 191: - case 190: + case 192: return substituteUnaryExpression(node); } return node; @@ -44608,18 +48238,13 @@ var ts; return node; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { - var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261) { - return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); - } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_37 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_37), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name)), node); } } } @@ -44636,8 +48261,7 @@ var ts; var expression = node; for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) { var exportName = exportedNames_3[_i]; - noSubstitution[ts.getNodeId(expression)] = true; - expression = createExportExpression(exportName, expression, node); + expression = createExportExpression(exportName, preventSubstitution(expression)); } return expression; } @@ -44652,13 +48276,17 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 - ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node) + var expression = node.kind === 192 + ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; - noSubstitution[ts.getNodeId(expression)] = true; - expression = createExportExpression(exportName, expression); + expression = createExportExpression(exportName, preventSubstitution(expression)); + } + if (node.kind === 192) { + expression = node.operator === 42 + ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) + : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); } return expression; } @@ -44666,40 +48294,122 @@ var ts; return node; } function getExports(name) { + var exportedNames; if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { - return currentModuleInfo - && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; + var exportContainer = resolver.getReferencedExportContainer(name, false); + if (exportContainer && exportContainer.kind === 264) { + exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); + } + exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); } } + return exportedNames; + } + function preventSubstitution(node) { + if (noSubstitution === undefined) + noSubstitution = []; + noSubstitution[ts.getNodeId(node)] = true; + return node; + } + function isSubstitutionPrevented(node) { + return noSubstitution && node.id && noSubstitution[node.id]; } - var _a; } - ts.transformModule = transformModule; - var exportStarHelper = { - name: "typescript:export-star", - scoped: true, - text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" - }; - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; + ts.transformSystemModule = transformSystemModule; +})(ts || (ts = {})); +var ts; +(function (ts) { + function transformES2015Module(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(264); + context.enableSubstitution(70); + var currentSourceFile; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.statements); + ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } + } + return node; + } + function visitor(node) { + switch (node.kind) { + case 236: + return undefined; + case 242: + return visitExportAssignment(node); + } + return node; + } + function visitExportAssignment(node) { + return node.isExportEquals ? undefined : node; + } + function onEmitNode(hint, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(hint, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(hint, node, emitCallback); + } + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (ts.isIdentifier(node) && hint === 1) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } + } + ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); - function getTransformers(compilerOptions) { + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } + function getTransformers(compilerOptions, customTransformers) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var transformers = []; + ts.addRange(transformers, customTransformers && customTransformers.before); transformers.push(ts.transformTypeScript); if (jsx === 2) { transformers.push(ts.transformJsx); @@ -44717,16 +48427,16 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); if (languageVersion < 1) { transformers.push(ts.transformES5); } + ts.addRange(transformers, customTransformers && customTransformers.after); return transformers; } ts.getTransformers = getTransformers; - function transformFiles(resolver, host, sourceFiles, transformers) { + function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { var enabledSyntaxKindFeatures = new Array(298); - var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -44734,8 +48444,11 @@ var ts; var lexicalEnvironmentStackOffset = 0; var lexicalEnvironmentSuspended = false; var emitHelpers; + var onSubstituteNode = function (_, node) { return node; }; + var onEmitNode = function (hint, node, callback) { return callback(hint, node); }; + var state = 0; var context = { - getCompilerOptions: function () { return host.getCompilerOptions(); }, + getCompilerOptions: function () { return options; }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, startLexicalEnvironment: startLexicalEnvironment, @@ -44746,65 +48459,77 @@ var ts; hoistFunctionDeclaration: hoistFunctionDeclaration, requestEmitHelper: requestEmitHelper, readEmitHelpers: readEmitHelpers, - onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, - isSubstitutionEnabled: isSubstitutionEnabled, - onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); }, enableEmitNotification: enableEmitNotification, - isEmitNotificationEnabled: isEmitNotificationEnabled + isSubstitutionEnabled: isSubstitutionEnabled, + isEmitNotificationEnabled: isEmitNotificationEnabled, + get onSubstituteNode() { return onSubstituteNode; }, + set onSubstituteNode(value) { + ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onSubstituteNode = value; + }, + get onEmitNode() { return onEmitNode; }, + set onEmitNode(value) { + ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onEmitNode = value; + } }; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + ts.performance.mark("beforeTransform"); var transformation = ts.chain.apply(void 0, transformers)(context); - var transformed = ts.map(sourceFiles, transformSourceFile); - lexicalEnvironmentDisabled = true; + state = 1; + var transformed = ts.map(nodes, allowDtsFiles ? transformation : transformRoot); + state = 2; + ts.performance.mark("afterTransform"); + ts.performance.measure("transformTime", "beforeTransform", "afterTransform"); return { transformed: transformed, - emitNodeWithSubstitution: emitNodeWithSubstitution, - emitNodeWithNotification: emitNodeWithNotification + substituteNode: substituteNode, + emitNodeWithNotification: emitNodeWithNotification, + dispose: dispose }; - function transformSourceFile(sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return sourceFile; - } - return transformation(sourceFile); + function transformRoot(node) { + return node && (!ts.isSourceFile(node) || !ts.isDeclarationFile(node)) ? transformation(node) : node; } function enableSubstitution(kind) { + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 1; } function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0 && (ts.getEmitFlags(node) & 4) === 0; } - function emitNodeWithSubstitution(emitContext, node, emitCallback) { - if (node) { - if (isSubstitutionEnabled(node)) { - var substitute = context.onSubstituteNode(emitContext, node); - if (substitute && substitute !== node) { - emitCallback(emitContext, substitute); - return; - } - } - emitCallback(emitContext, node); - } + function substituteNode(hint, node) { + ts.Debug.assert(state < 3, "Cannot substitute a node after the result is disposed."); + return node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node; } function enableEmitNotification(kind) { + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 2; } function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0 || (ts.getEmitFlags(node) & 2) !== 0; } - function emitNodeWithNotification(emitContext, node, emitCallback) { + function emitNodeWithNotification(hint, node, emitCallback) { + ts.Debug.assert(state < 3, "Cannot invoke TransformationResult callbacks after the result is disposed."); if (node) { if (isEmitNotificationEnabled(node)) { - context.onEmitNode(emitContext, node, emitCallback); + onEmitNode(hint, node, emitCallback); } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } } } function hoistVariableDeclaration(name) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); var decl = ts.createVariableDeclaration(name); if (!lexicalEnvironmentVariableDeclarations) { lexicalEnvironmentVariableDeclarations = [decl]; @@ -44814,7 +48539,8 @@ var ts; } } function hoistFunctionDeclaration(func) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); if (!lexicalEnvironmentFunctionDeclarations) { lexicalEnvironmentFunctionDeclarations = [func]; } @@ -44823,7 +48549,8 @@ var ts; } } function startLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; @@ -44832,17 +48559,20 @@ var ts; lexicalEnvironmentFunctionDeclarations = undefined; } function suspendLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); lexicalEnvironmentSuspended = true; } function resumeLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); lexicalEnvironmentSuspended = false; } function endLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { @@ -44869,19 +48599,36 @@ var ts; return statements; } function requestEmitHelper(helper) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); emitHelpers = ts.append(emitHelpers, helper); } function readEmitHelpers() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); var helpers = emitHelpers; emitHelpers = undefined; return helpers; } + function dispose() { + if (state < 3) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentVariableDeclarationsStack = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + lexicalEnvironmentFunctionDeclarationsStack = undefined; + onSubstituteNode = undefined; + onEmitNode = undefined; + emitHelpers = undefined; + state = 3; + } + } } - ts.transformFiles = transformFiles; - var _a; + ts.transformNodes = transformNodes; })(ts || (ts = {})); var ts; (function (ts) { @@ -44915,7 +48662,7 @@ var ts; getText: getText, getSourceMappingURL: getSourceMappingURL, }; - function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + function initialize(filePath, sourceMapFilePath, sourceFileOrBundle) { if (disabled) { return; } @@ -44946,9 +48693,8 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (!isBundledEmit) { - ts.Debug.assert(sourceFiles.length === 1); - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + if (sourceFileOrBundle.kind === 264) { + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); @@ -45039,28 +48785,28 @@ var ts; ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); } } - function emitNodeWithSourceMap(emitContext, node, emitCallback) { + function emitNodeWithSourceMap(hint, node, emitCallback) { if (disabled) { - return emitCallback(emitContext, node); + return emitCallback(hint, node); } if (node) { var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } if (emitFlags & 64) { disabled = true; - emitCallback(emitContext, node); + emitCallback(hint, node); disabled = false; } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -45109,7 +48855,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -45161,11 +48907,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function createCommentWriter(host, writer, sourceMap) { - var compilerOptions = host.getCompilerOptions(); - var extendedDiagnostics = compilerOptions.extendedDiagnostics; - var newLine = host.getNewLine(); - var emitPos = sourceMap.emitPos; + function createCommentWriter(printerOptions, emitPos) { + var extendedDiagnostics = printerOptions.extendedDiagnostics; + var newLine = ts.getNewLineCharacter(printerOptions); + var writer; var containerPos = -1; var containerEnd = -1; var declarationListContainerEnd = -1; @@ -45174,37 +48919,34 @@ var ts; var currentLineMap; var detachedCommentsInfo; var hasWrittenComment = false; - var disabled = compilerOptions.removeComments; + var disabled = printerOptions.removeComments; return { reset: reset, + setWriter: setWriter, setSourceFile: setSourceFile, emitNodeWithComments: emitNodeWithComments, emitBodyWithDetachedComments: emitBodyWithDetachedComments, emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition, + emitLeadingCommentsOfPosition: emitLeadingCommentsOfPosition, }; - function emitNodeWithComments(emitContext, node, emitCallback) { + function emitNodeWithComments(hint, node, emitCallback) { if (disabled) { - emitCallback(emitContext, node); + emitCallback(hint, node); return; } if (node) { - var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; - var emitFlags = ts.getEmitFlags(node); + hasWrittenComment = false; + var emitNode = node.emitNode; + var emitFlags = emitNode && emitNode.flags; + var _a = emitNode && emitNode.commentRange || node, pos = _a.pos, end = _a.end; if ((pos < 0 && end < 0) || (pos === end)) { - if (emitFlags & 2048) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); } else { if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293; + var isEmittedNode = node.kind !== 294; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -45218,23 +48960,16 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 224) { + if (node.kind === 226) { declarationListContainerEnd = end; } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 2048) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); if (extendedDiagnostics) { - ts.performance.mark("beginEmitNodeWithComment"); + ts.performance.mark("postEmitNodeWithComment"); } containerPos = savedContainerPos; containerEnd = savedContainerEnd; @@ -45243,11 +48978,75 @@ var ts; emitTrailingComments(end); } if (extendedDiagnostics) { - ts.performance.measure("commentTime", "beginEmitNodeWithComment"); + ts.performance.measure("commentTime", "postEmitNodeWithComment"); } } } } + function emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback) { + var leadingComments = emitNode && emitNode.leadingComments; + if (ts.some(leadingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("preEmitNodeWithSynthesizedComments"); + } + ts.forEach(leadingComments, emitLeadingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "preEmitNodeWithSynthesizedComments"); + } + } + emitNodeWithNestedComments(hint, node, emitFlags, emitCallback); + var trailingComments = emitNode && emitNode.trailingComments; + if (ts.some(trailingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("postEmitNodeWithSynthesizedComments"); + } + ts.forEach(trailingComments, emitTrailingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "postEmitNodeWithSynthesizedComments"); + } + } + } + function emitLeadingSynthesizedComment(comment) { + if (comment.kind === 2) { + writer.writeLine(); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine || comment.kind === 2) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + function emitTrailingSynthesizedComment(comment) { + if (!writer.isAtStartOfLine()) { + writer.write(" "); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + } + function writeSynthesizedComment(comment) { + var text = formatSynthesizedComment(comment); + var lineMap = comment.kind === 3 ? ts.computeLineStarts(text) : undefined; + ts.writeCommentRange(text, lineMap, writer, 0, text.length, newLine); + } + function formatSynthesizedComment(comment) { + return comment.kind === 3 + ? "/*" + comment.text + "*/" + : "//" + comment.text; + } + function emitNodeWithNestedComments(hint, node, emitFlags, emitCallback) { + if (emitFlags & 2048) { + disabled = true; + emitCallback(hint, node); + disabled = false; + } + else { + emitCallback(hint, node); + } + } function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { if (extendedDiagnostics) { ts.performance.mark("preEmitBodyWithDetachedComments"); @@ -45275,6 +49074,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -45299,9 +49101,11 @@ var ts; ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos); hasWrittenComment = true; } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -45309,6 +49113,12 @@ var ts; writer.write(" "); } } + function emitLeadingCommentsOfPosition(pos) { + if (disabled || pos === -1) { + return; + } + emitLeadingComments(pos, true); + } function emitTrailingComments(pos) { forEachTrailingCommentToEmit(pos, emitTrailingComment); } @@ -45316,9 +49126,11 @@ var ts; if (!writer.isAtStartOfLine()) { writer.write(" "); } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -45336,9 +49148,11 @@ var ts; } } function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -45367,6 +49181,9 @@ var ts; currentLineMap = undefined; detachedCommentsInfo = undefined; } + function setWriter(output) { + writer = output; + } function setSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = currentSourceFile.text; @@ -45398,9 +49215,11 @@ var ts; } } function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); } function isTripleSlashComment(commentPos, commentEnd) { if (currentText.charCodeAt(commentPos + 1) === 47 && @@ -45420,15 +49239,17 @@ var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + function getDeclarationDiagnosticsFromFile(_a, sourceFileOrBundle) { var declarationFilePath = _a.declarationFilePath; - emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, false); + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sourceFileOrBundle, false); } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { + var sourceFiles = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 265; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -45490,7 +49311,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235); + ts.Debug.assert(aliasEmitInfo.node.kind === 237); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -45513,9 +49334,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -45540,12 +49361,14 @@ var ts; var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.reportIllegalExtends = reportIllegalExtends; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -45561,10 +49384,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223) { + if (declaration.kind === 225) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) { + else if (declaration.kind === 240 || declaration.kind === 241 || declaration.kind === 238) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -45575,7 +49398,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235) { + if (moduleElementEmitInfo.node.kind === 237) { moduleElementEmitInfo.isVisible = true; } else { @@ -45583,12 +49406,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 232) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 232) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -45607,8 +49430,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -45635,6 +49458,12 @@ var ts; handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true)); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } + function reportIllegalExtends() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, ts.declarationNameToString(errorNameNode))); + } + } function reportInaccessibleThisError() { if (errorNameNode) { reportedDeclarationError = true; @@ -45644,12 +49473,16 @@ var ts; function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); - if (type) { + var shouldUseResolverType = declaration.kind === 145 && + resolver.isRequiredInitializedParameter(declaration); + if (type && !shouldUseResolverType) { emitType(type); } else { errorNameNode = declaration.name; - resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer); + var format = 2 | 1024 | + (shouldUseResolverType ? 4096 : 0); + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, format, writer); errorNameNode = undefined; } } @@ -45666,15 +49499,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { - var node = nodes_4[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var node = nodes_6[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -45701,49 +49534,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 133: + case 136: case 104: - case 137: + case 138: case 94: case 129: - case 167: - case 171: + case 168: + case 172: return writeTextOfNode(currentText, type); - case 199: + case 200: return emitExpressionWithTypeArguments(type); - case 157: + case 158: return emitTypeReference(type); - case 160: + case 161: return emitTypeQuery(type); - case 162: - return emitArrayType(type); case 163: - return emitTupleType(type); + return emitArrayType(type); case 164: - return emitUnionType(type); + return emitTupleType(type); case 165: - return emitIntersectionType(type); + return emitUnionType(type); case 166: + return emitIntersectionType(type); + case 167: return emitParenType(type); - case 168: - return emitTypeOperator(type); case 169: - return emitIndexedAccessType(type); + return emitTypeOperator(type); case 170: + return emitIndexedAccessType(type); + case 171: return emitMappedType(type); - case 158: case 159: + case 160: return emitSignatureDeclarationWithJsDocComments(type); - case 161: + case 162: return emitTypeLiteral(type); case 70: return emitEntityName(type); - case 141: + case 142: return emitEntityName(type); - case 156: + case 157: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -45751,22 +49585,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 ? entityName.left : entityName.expression; - var right = entityName.kind === 141 ? entityName.right : entityName.name; + var left = entityName.kind === 142 ? entityName.left : entityName.expression; + var right = entityName.kind === 142 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 236 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177); + ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 178); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -45870,15 +49704,15 @@ var ts; } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_38 = baseName + "_" + count; - if (!(name_38 in currentIdentifiers)) { - return name_38; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -45922,10 +49756,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 || - (node.parent.kind === 261 && isCurrentFileExternalModule)) { + else if (node.kind === 236 || + (node.parent.kind === 264 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 264) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -45934,7 +49768,7 @@ var ts; }); } else { - if (node.kind === 235) { + if (node.kind === 237) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -45952,30 +49786,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225: + case 227: return writeFunctionDeclaration(node); - case 205: + case 207: return writeVariableStatement(node); - case 227: + case 229: return writeInterfaceDeclaration(node); - case 226: - return writeClassDeclaration(node); case 228: + return writeClassDeclaration(node); + case 230: return writeTypeAliasDeclaration(node); - case 229: + case 231: return writeEnumDeclaration(node); - case 230: + case 232: return writeModuleDeclaration(node); - case 234: + case 236: return writeImportEqualsDeclaration(node); - case 235: + case 237: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 261) { + if (node.parent.kind === 264) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -45983,7 +49817,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 227 && !noDeclare) { + else if (node.kind !== 229 && !noDeclare) { write("declare "); } } @@ -46033,7 +49867,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 239) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -46056,7 +49890,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 237) { + if (node.importClause.namedBindings.kind === 239) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -46073,13 +49907,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232; var moduleSpecifier; - if (parent.kind === 234) { + if (parent.kind === 236) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230) { + else if (parent.kind === 232) { moduleSpecifier = parent.name; } else { @@ -46147,7 +49981,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231) { + while (node.body && node.body.kind !== 233) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -46217,7 +50051,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 && ts.hasModifier(node.parent, 8); + return node.parent.kind === 150 && ts.hasModifier(node.parent, 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -46227,52 +50061,69 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - (node.parent.parent && node.parent.parent.kind === 161)) { - ts.Debug.assert(node.parent.kind === 149 || - node.parent.kind === 148 || - node.parent.kind === 158 || + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || node.parent.kind === 159 || - node.parent.kind === 153 || - node.parent.kind === 154); + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } + if (node.default && !isPrivateMethodTypeParameter(node)) { + write(" = "); + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || + node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); + emitType(node.default); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.default, getTypeParameterConstraintVisibilityError); + } + } function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 226: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154: + case 155: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153: + case 154: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 228) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228: + case 230: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -46291,7 +50142,7 @@ var ts; write(">"); } } - function emitHeritageClause(typeReferences, isImplementsList) { + function emitHeritageClause(className, typeReferences, isImplementsList) { if (typeReferences) { write(isImplementsList ? " implements " : " extends "); emitCommaList(typeReferences, emitTypeOfTypeReference); @@ -46305,17 +50156,19 @@ var ts; } else { writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + errorNameNode = className; resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer); + errorNameNode = undefined; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 226) { + if (node.parent.parent.kind === 228) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { - diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + diagnosticMessage = ts.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -46347,9 +50200,10 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + node.name; + emitHeritageClause(node.name, [baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); + emitHeritageClause(node.name, ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -46370,7 +50224,7 @@ var ts; emitTypeParameters(node.typeParameters); var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); if (interfaceExtendsTypes && interfaceExtendsTypes.length) { - emitHeritageClause(interfaceExtendsTypes, false); + emitHeritageClause(node.name, interfaceExtendsTypes, false); } write(" {"); writeLine(); @@ -46392,17 +50246,17 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 223 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 147 || node.kind === 146 || - (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 || node.kind === 147 || + (node.kind === 145 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) { + if ((node.kind === 148 || node.kind === 147) && node.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -46415,14 +50269,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223) { + if (node.kind === 225) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 147 || node.kind === 146) { + else if (node.kind === 148 || node.kind === 147) { if (ts.hasModifier(node, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -46430,7 +50284,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -46456,7 +50310,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198) { + if (element.kind !== 199) { elements.push(element); } } @@ -46522,7 +50376,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -46535,7 +50389,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 + return accessor.kind === 152 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -46544,7 +50398,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152) { + if (accessorWithTypeAnnotation.kind === 153) { if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -46590,17 +50444,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225) { + if (node.kind === 227) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 || node.kind === 150) { + else if (node.kind === 150 || node.kind === 151) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225) { + if (node.kind === 227) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150) { + else if (node.kind === 151) { write("constructor"); } else { @@ -46620,15 +50474,15 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155) { + if (node.kind === 156) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { - if (node.kind === 154 || node.kind === 159) { + if (node.kind === 155 || node.kind === 160) { write("new "); } - else if (node.kind === 158) { + else if (node.kind === 159) { var currentOutput = writer.getText(); if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { closeParenthesizedFunctionType = true; @@ -46639,20 +50493,20 @@ var ts; write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155) { + if (node.kind === 156) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161) { + var isFunctionTypeOrConstructorType = node.kind === 159 || node.kind === 160; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 && !ts.hasModifier(node, 8)) { + else if (node.kind !== 151 && !ts.hasModifier(node, 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -46666,23 +50520,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154: + case 155: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 153: + case 154: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 155: + case 156: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; + case 150: case 149: - case 148: if (ts.hasModifier(node, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -46690,7 +50544,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -46703,7 +50557,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225: + case 227: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -46735,9 +50589,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - node.parent.parent.kind === 161) { + if (node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8)) { @@ -46753,22 +50607,26 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150: + case 151: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 154: + case 155: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 153: + case 154: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 156: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -46776,7 +50634,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -46788,7 +50646,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 225: + case 227: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -46799,12 +50657,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -46815,10 +50673,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198) { + if (bindingElement.kind === 199) { write(" "); } - else if (bindingElement.kind === 174) { + else if (bindingElement.kind === 175) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -46840,39 +50698,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225: - case 230: - case 234: case 227: - case 226: - case 228: + case 232: + case 236: case 229: + case 228: + case 230: + case 231: return emitModuleElement(node, isModuleElementVisible(node)); - case 205: + case 207: return emitModuleElement(node, isVariableStatementVisible(node)); - case 235: + case 237: return emitModuleElement(node, !node.importClause); - case 241: + case 243: return emitExportDeclaration(node); + case 151: case 150: case 149: - case 148: return writeFunctionDeclaration(node); - case 154: - case 153: case 155: + case 154: + case 156: return emitSignatureDeclarationWithJsDocComments(node); - case 151: case 152: + case 153: return emitAccessorDeclaration(node); + case 148: case 147: - case 146: return emitPropertyDeclaration(node); - case 260: + case 263: return emitEnumMemberDeclaration(node); - case 240: + case 242: return emitExportAssignment(node); - case 261: + case 264: return emitSourceFile(node); } } @@ -46883,14 +50741,15 @@ var ts; declFileName = referencedFile.fileName; } else { - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencesOutput += "/// " + newLine; } return addedBundledEmitReference; - function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) { + function getDeclFileName(emitFileNames, sourceFileOrBundle) { + var isBundledEmit = sourceFileOrBundle.kind === 265; if (isBundledEmit && !addBundledFileReference) { return; } @@ -46900,10 +50759,11 @@ var ts; } } } - function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { - var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles); + function writeDeclarationFile(declarationFilePath, sourceFileOrBundle, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { + var sourceFiles = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -46927,63 +50787,55 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var id = function (s) { return s; }; - var nullTransformers = [function (_) { return id; }]; - function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { - var delimiters = createDelimiterMap(); - var brackets = createBracketsMap(); + var delimiters = createDelimiterMap(); + var brackets = createBracketsMap(); + function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); var newLine = host.getNewLine(); - var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions); var writer = ts.createTextWriter(newLine); - var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var sourceMap = ts.createSourceMapWriter(host, writer); - var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap; - var comments = ts.createCommentWriter(host, writer, sourceMap); - var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition; - var nodeIdToGeneratedName; - var autoGeneratedIdToGeneratedName; - var generatedNameSet; - var tempFlags; var currentSourceFile; - var currentText; - var currentFileIdentifiers; var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); - ts.performance.mark("beforeTransform"); - var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; - ts.performance.measure("transformTime", "beforeTransform"); + var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, false); + var printer = createPrinter(compilerOptions, { + hasGlobalName: resolver.hasGlobalName, + onEmitNode: transform.emitNodeWithNotification, + substituteNode: transform.substituteNode, + onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, + onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, + onEmitSourceMapOfPosition: sourceMap.emitPos, + onEmitHelpers: emitHelpers, + onSetSourceFile: setSourceFile, + }); ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; - ts.disposeEmitNodes(sourceFile); - } + transform.dispose(); return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitSourceFileOrBundle(_a, sourceFileOrBundle) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { - printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle); } } else { emitSkipped = true; } if (declarationFilePath) { - emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; + emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; } if (!emitSkipped && emittedFilesList) { if (!emitOnlyDtsFiles) { @@ -46997,24 +50849,24 @@ var ts; } } } - function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { - sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); - nodeIdToGeneratedName = []; - autoGeneratedIdToGeneratedName = []; - generatedNameSet = ts.createMap(); - bundledHelpers = isBundledEmit ? ts.createMap() : undefined; - isOwnFileEmit = !isBundledEmit; - if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; - emitHelpers(sourceFile, true); - } + function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { + var bundle = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 264 ? sourceFileOrBundle : undefined; + var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); + if (bundle) { + bundledHelpers = ts.createMap(); + isOwnFileEmit = false; + printer.writeBundle(bundle, writer); } - ts.forEach(sourceFiles, printSourceFile); - writeLine(); + else { + isOwnFileEmit = true; + printer.writeFile(sourceFile, writer); + } + writer.writeLine(); var sourceMappingURL = sourceMap.getSourceMappingURL(); if (sourceMappingURL) { - write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); + writer.write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); } if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); @@ -47024,20 +50876,164 @@ var ts; } ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); - comments.reset(); writer.reset(); - tempFlags = 0; currentSourceFile = undefined; - currentText = undefined; + bundledHelpers = undefined; isOwnFileEmit = false; } - function printSourceFile(node) { + function setSourceFile(node) { currentSourceFile = node; - currentText = node.text; - currentFileIdentifiers = node.identifiers; sourceMap.setSourceFile(node); - comments.setSourceFile(node); - pipelineEmitWithNotification(0, node); + } + function emitHelpers(node, writeLines) { + var helpersEmitted = false; + var bundle = node.kind === 265 ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; + } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + continue; + } + writeLines(helper.text); + helpersEmitted = true; + } + } + } + return helpersEmitted; + } + } + ts.emitFiles = emitFiles; + function createPrinter(printerOptions, handlers) { + if (printerOptions === void 0) { printerOptions = {}; } + if (handlers === void 0) { handlers = {}; } + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray; + var newLine = ts.getNewLineCharacter(printerOptions); + var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); + var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; + var currentSourceFile; + var nodeIdToGeneratedName; + var autoGeneratedIdToGeneratedName; + var generatedNames; + var tempFlagsStack; + var tempFlags; + var writer; + var ownWriter; + reset(); + return { + printNode: printNode, + printFile: printFile, + printBundle: printBundle, + writeNode: writeNode, + writeFile: writeFile, + writeBundle: writeBundle + }; + function printNode(hint, node, sourceFile) { + switch (hint) { + case 0: + ts.Debug.assert(ts.isSourceFile(node), "Expected a SourceFile node."); + break; + case 2: + ts.Debug.assert(ts.isIdentifier(node), "Expected an Identifier node."); + break; + case 1: + ts.Debug.assert(ts.isExpression(node), "Expected an Expression node."); + break; + } + switch (node.kind) { + case 264: return printFile(node); + case 265: return printBundle(node); + } + writeNode(hint, node, sourceFile, beginPrint()); + return endPrint(); + } + function printBundle(bundle) { + writeBundle(bundle, beginPrint()); + return endPrint(); + } + function printFile(sourceFile) { + writeFile(sourceFile, beginPrint()); + return endPrint(); + } + function writeNode(hint, node, sourceFile, output) { + var previousWriter = writer; + setWriter(output); + print(hint, node, sourceFile); + reset(); + writer = previousWriter; + } + function writeBundle(bundle, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(bundle); + emitPrologueDirectivesIfNeeded(bundle); + emitHelpersIndirect(bundle); + for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + print(0, sourceFile, sourceFile); + } + reset(); + writer = previousWriter; + } + function writeFile(sourceFile, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(sourceFile); + emitPrologueDirectivesIfNeeded(sourceFile); + print(0, sourceFile, sourceFile); + reset(); + writer = previousWriter; + } + function beginPrint() { + return ownWriter || (ownWriter = ts.createTextWriter(newLine)); + } + function endPrint() { + var text = ownWriter.getText(); + ownWriter.reset(); + return text; + } + function print(hint, node, sourceFile) { + setSourceFile(sourceFile); + pipelineEmitWithNotification(hint, node); + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + comments.setSourceFile(sourceFile); + if (onSetSourceFile) { + onSetSourceFile(sourceFile); + } + } + function setWriter(output) { + writer = output; + comments.setWriter(output); + } + function reset() { + nodeIdToGeneratedName = []; + autoGeneratedIdToGeneratedName = []; + generatedNames = ts.createMap(); + tempFlagsStack = []; + tempFlags = 0; + comments.reset(); + setWriter(undefined); } function emit(node) { pipelineEmitWithNotification(3, node); @@ -47048,51 +51044,53 @@ var ts; function emitExpression(node) { pipelineEmitWithNotification(1, node); } - function pipelineEmitWithNotification(emitContext, node) { - emitNodeWithNotification(emitContext, node, pipelineEmitWithComments); - } - function pipelineEmitWithComments(emitContext, node) { - if (emitContext === 0) { - pipelineEmitWithSourceMap(emitContext, node); - return; + function pipelineEmitWithNotification(hint, node) { + if (onEmitNode) { + onEmitNode(hint, node, pipelineEmitWithComments); } - emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap); - } - function pipelineEmitWithSourceMap(emitContext, node) { - if (emitContext === 0 - || emitContext === 2) { - pipelineEmitWithSubstitution(emitContext, node); - return; + else { + pipelineEmitWithComments(hint, node); } - emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution); } - function pipelineEmitWithSubstitution(emitContext, node) { - emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext); - } - function pipelineEmitForContext(emitContext, node) { - switch (emitContext) { - case 0: return pipelineEmitInSourceFileContext(node); - case 2: return pipelineEmitInIdentifierNameContext(node); - case 3: return pipelineEmitInUnspecifiedContext(node); - case 1: return pipelineEmitInExpressionContext(node); + function pipelineEmitWithComments(hint, node) { + node = trySubstituteNode(hint, node); + if (emitNodeWithComments && hint !== 0) { + emitNodeWithComments(hint, node, pipelineEmitWithSourceMap); + } + else { + pipelineEmitWithSourceMap(hint, node); } } - function pipelineEmitInSourceFileContext(node) { - var kind = node.kind; - switch (kind) { - case 261: - return emitSourceFile(node); + function pipelineEmitWithSourceMap(hint, node) { + if (onEmitSourceMapOfNode && hint !== 0 && hint !== 2) { + onEmitSourceMapOfNode(hint, node, pipelineEmitWithHint); + } + else { + pipelineEmitWithHint(hint, node); } } - function pipelineEmitInIdentifierNameContext(node) { - var kind = node.kind; - switch (kind) { - case 70: - return emitIdentifier(node); + function pipelineEmitWithHint(hint, node) { + switch (hint) { + case 0: return pipelineEmitSourceFile(node); + case 2: return pipelineEmitIdentifierName(node); + case 1: return pipelineEmitExpression(node); + case 3: return pipelineEmitUnspecified(node); } } - function pipelineEmitInUnspecifiedContext(node) { + function pipelineEmitSourceFile(node) { + ts.Debug.assertNode(node, ts.isSourceFile); + emitSourceFile(node); + } + function pipelineEmitIdentifierName(node) { + ts.Debug.assertNode(node, ts.isIdentifier); + emitIdentifier(node); + } + function pipelineEmitUnspecified(node) { var kind = node.kind; + if (ts.isKeyword(kind)) { + writeTokenText(kind); + return; + } switch (kind) { case 13: case 14: @@ -47100,229 +51098,201 @@ var ts; return emitLiteral(node); case 70: return emitIdentifier(node); - case 75: - case 78: - case 83: - case 104: - case 111: - case 112: - case 113: - case 114: - case 116: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: - case 124: - case 125: - case 127: - case 128: - case 129: - case 130: - case 131: - case 132: - case 133: - case 134: - case 135: - case 136: - case 137: - case 138: - case 139: - case 140: - writeTokenText(kind); - return; - case 141: - return emitQualifiedName(node); case 142: - return emitComputedPropertyName(node); + return emitQualifiedName(node); case 143: - return emitTypeParameter(node); + return emitComputedPropertyName(node); case 144: - return emitParameter(node); + return emitTypeParameter(node); case 145: - return emitDecorator(node); + return emitParameter(node); case 146: - return emitPropertySignature(node); + return emitDecorator(node); case 147: - return emitPropertyDeclaration(node); + return emitPropertySignature(node); case 148: - return emitMethodSignature(node); + return emitPropertyDeclaration(node); case 149: - return emitMethodDeclaration(node); + return emitMethodSignature(node); case 150: - return emitConstructor(node); + return emitMethodDeclaration(node); case 151: + return emitConstructor(node); case 152: - return emitAccessorDeclaration(node); case 153: - return emitCallSignature(node); + return emitAccessorDeclaration(node); case 154: - return emitConstructSignature(node); + return emitCallSignature(node); case 155: - return emitIndexSignature(node); + return emitConstructSignature(node); case 156: - return emitTypePredicate(node); + return emitIndexSignature(node); case 157: - return emitTypeReference(node); + return emitTypePredicate(node); case 158: - return emitFunctionType(node); + return emitTypeReference(node); case 159: - return emitConstructorType(node); + return emitFunctionType(node); case 160: - return emitTypeQuery(node); + return emitConstructorType(node); case 161: - return emitTypeLiteral(node); + return emitTypeQuery(node); case 162: - return emitArrayType(node); + return emitTypeLiteral(node); case 163: - return emitTupleType(node); + return emitArrayType(node); case 164: - return emitUnionType(node); + return emitTupleType(node); case 165: - return emitIntersectionType(node); + return emitUnionType(node); case 166: + return emitIntersectionType(node); + case 167: return emitParenthesizedType(node); - case 199: + case 200: return emitExpressionWithTypeArguments(node); - case 167: - return emitThisType(); case 168: - return emitTypeOperator(node); + return emitThisType(); case 169: - return emitIndexedAccessType(node); + return emitTypeOperator(node); case 170: - return emitMappedType(node); + return emitIndexedAccessType(node); case 171: - return emitLiteralType(node); + return emitMappedType(node); case 172: - return emitObjectBindingPattern(node); + return emitLiteralType(node); case 173: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 174: + return emitArrayBindingPattern(node); + case 175: return emitBindingElement(node); - case 202: + case 204: return emitTemplateSpan(node); - case 203: + case 205: return emitSemicolonClassElement(); - case 204: + case 206: return emitBlock(node); - case 205: + case 207: return emitVariableStatement(node); - case 206: + case 208: return emitEmptyStatement(); - case 207: + case 209: return emitExpressionStatement(node); - case 208: + case 210: return emitIfStatement(node); - case 209: + case 211: return emitDoStatement(node); - case 210: + case 212: return emitWhileStatement(node); - case 211: + case 213: return emitForStatement(node); - case 212: + case 214: return emitForInStatement(node); - case 213: + case 215: return emitForOfStatement(node); - case 214: + case 216: return emitContinueStatement(node); - case 215: + case 217: return emitBreakStatement(node); - case 216: + case 218: return emitReturnStatement(node); - case 217: + case 219: return emitWithStatement(node); - case 218: + case 220: return emitSwitchStatement(node); - case 219: + case 221: return emitLabeledStatement(node); - case 220: + case 222: return emitThrowStatement(node); - case 221: + case 223: return emitTryStatement(node); - case 222: + case 224: return emitDebuggerStatement(node); - case 223: + case 225: return emitVariableDeclaration(node); - case 224: + case 226: return emitVariableDeclarationList(node); - case 225: + case 227: return emitFunctionDeclaration(node); - case 226: + case 228: return emitClassDeclaration(node); - case 227: + case 229: return emitInterfaceDeclaration(node); - case 228: + case 230: return emitTypeAliasDeclaration(node); - case 229: + case 231: return emitEnumDeclaration(node); - case 230: + case 232: return emitModuleDeclaration(node); - case 231: + case 233: return emitModuleBlock(node); - case 232: - return emitCaseBlock(node); case 234: + return emitCaseBlock(node); + case 236: return emitImportEqualsDeclaration(node); - case 235: + case 237: return emitImportDeclaration(node); - case 236: + case 238: return emitImportClause(node); - case 237: + case 239: return emitNamespaceImport(node); - case 238: + case 240: return emitNamedImports(node); - case 239: + case 241: return emitImportSpecifier(node); - case 240: + case 242: return emitExportAssignment(node); - case 241: + case 243: return emitExportDeclaration(node); - case 242: + case 244: return emitNamedExports(node); - case 243: + case 245: return emitExportSpecifier(node); - case 244: + case 246: return; - case 245: + case 247: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 248: + case 250: return emitJsxOpeningElement(node); - case 249: + case 251: return emitJsxClosingElement(node); - case 250: + case 252: return emitJsxAttribute(node); - case 251: + case 253: + return emitJsxAttributes(node); + case 254: return emitJsxSpreadAttribute(node); - case 252: + case 255: return emitJsxExpression(node); - case 253: + case 256: return emitCaseClause(node); - case 254: + case 257: return emitDefaultClause(node); - case 255: + case 258: return emitHeritageClause(node); - case 256: + case 259: return emitCatchClause(node); - case 257: + case 260: return emitPropertyAssignment(node); - case 258: + case 261: return emitShorthandPropertyAssignment(node); - case 259: + case 262: return emitSpreadAssignment(node); - case 260: + case 263: return emitEnumMember(node); } if (ts.isExpression(node)) { - return pipelineEmitWithSubstitution(1, node); + return pipelineEmitExpression(trySubstituteNode(1, node)); + } + if (ts.isToken(node)) { + writeTokenText(kind); + return; } } - function pipelineEmitInExpressionContext(node) { + function pipelineEmitExpression(node) { var kind = node.kind; switch (kind) { case 8: @@ -47340,77 +51310,82 @@ var ts; case 98: writeTokenText(kind); return; - case 175: - return emitArrayLiteralExpression(node); case 176: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 177: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 178: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 179: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 180: - return emitNewExpression(node); + return emitCallExpression(node); case 181: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 182: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 183: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 184: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 185: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 186: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 187: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 188: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 189: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 190: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 191: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 192: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 193: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 194: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 195: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 196: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 197: - return emitClassExpression(node); + return emitSpreadExpression(node); case 198: + return emitClassExpression(node); + case 199: return; - case 200: - return emitAsExpression(node); case 201: + return emitAsExpression(node); + case 202: return emitNonNullExpression(node); - case 246: + case 203: + return emitMetaProperty(node); + case 248: return emitJsxElement(node); - case 247: + case 249: return emitJsxSelfClosingElement(node); - case 294: + case 295: return emitPartiallyEmittedExpression(node); - case 297: - return writeLines(node.text); + } + } + function trySubstituteNode(hint, node) { + return node && substituteNode && substituteNode(hint, node) || node; + } + function emitHelpersIndirect(node) { + if (onEmitHelpers) { + onEmitHelpers(node, writeLines); } } function emitNumericLiteral(node) { emitLiteral(node); - if (node.trailingComment) { - write(" /*" + node.trailingComment + "*/"); - } } function emitLiteral(node) { var text = getLiteralTextOfNode(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) + if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -47449,8 +51424,8 @@ var ts; writeIfPresent(node.dotDotDotToken, "..."); emit(node.name); writeIfPresent(node.questionToken, "?"); - emitExpressionWithPrefix(" = ", node.initializer); emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { write("@"); @@ -47497,7 +51472,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 ? "get " : "set "); + write(node.kind === 152 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -47597,17 +51572,13 @@ var ts; write("{"); writeLine(); increaseIndent(); - if (node.readonlyToken) { - write("readonly "); - } + writeIfPresent(node.readonlyToken, "readonly "); write("["); emit(node.typeParameter.name); write(" in "); emit(node.typeParameter.constraint); write("]"); - if (node.questionToken) { - write("?"); - } + writeIfPresent(node.questionToken, "?"); write(": "); emit(node.type); write(";"); @@ -47667,7 +51638,7 @@ var ts; increaseIndent(); } var preferNewLine = node.multiLine ? 32768 : 0; - var allowTrailingComma = languageVersion >= 1 ? 32 : 0; + var allowTrailingComma = currentSourceFile.languageVersion >= 1 ? 32 : 0; emitList(node, properties, 978 | allowTrailingComma | preferNewLine); if (indentedFlag) { decreaseIndent(); @@ -47679,7 +51650,7 @@ var ts; var indentAfterDot = false; if (!(ts.getEmitFlags(node) & 65536)) { var dotRangeStart = node.expression.end; - var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; + var dotRangeEnd = ts.skipTrivia(currentSourceFile.text, node.expression.end) + 1; var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd }; indentBeforeDot = needsIndentation(node, node.expression, dotToken); indentAfterDot = needsIndentation(node, dotToken, node.name); @@ -47693,15 +51664,17 @@ var ts; decreaseIndentIf(indentBeforeDot, indentAfterDot); } function needsDotDotForPropertyAccess(expression) { - if (expression.kind === 8) { + expression = ts.skipPartiallyEmittedExpressions(expression); + if (ts.isNumericLiteral(expression)) { var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22)) < 0; + return !expression.numericLiteralFlags + && text.indexOf(ts.tokenToString(22)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { var constantValue = ts.getConstantValue(expression); return isFinite(constantValue) && Math.floor(constantValue) === constantValue - && compilerOptions.removeComments; + && printerOptions.removeComments; } } function emitElementAccessExpression(node) { @@ -47727,11 +51700,9 @@ var ts; emitExpression(node.template); } function emitTypeAssertionExpression(node) { - if (node.type) { - write("<"); - emit(node.type); - write(">"); - } + write("<"); + emit(node.type); + write(">"); emitExpression(node.expression); } function emitParenthesizedExpression(node) { @@ -47778,7 +51749,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 190 + return operand.kind === 191 && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43))); } @@ -47844,6 +51815,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } function emitTemplateSpan(node) { emitExpression(node.expression); emit(node.literal); @@ -47857,6 +51833,9 @@ var ts; else { writeToken(16, node.pos, node); emitBlockStatements(node); + increaseIndent(); + emitLeadingCommentsOfPosition(node.statements.end); + decreaseIndent(); writeToken(17, node.statements.end, node); } } @@ -47886,27 +51865,27 @@ var ts; writeToken(18, openParenPos, node); emitExpression(node.expression); writeToken(19, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 208) { + if (node.elseStatement.kind === 210) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -47916,7 +51895,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -47928,7 +51907,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -47938,21 +51917,22 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87, node.pos); write(" "); + emitWithSuffix(node.awaitModifier, " "); writeToken(18, openParenPos); emitForBinding(node.initializer); write(" of "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224) { + if (node.kind === 226) { emit(node); } else { @@ -47979,7 +51959,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97, node.pos); @@ -48003,9 +51983,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -48033,6 +52016,9 @@ var ts; emitIdentifierName(node.name); emitSignatureAndBody(node, emitSignatureHead); } + function emitBlockCallback(_hint, body) { + emitBlockFunctionBody(body); + } function emitSignatureAndBody(node, emitSignatureHead) { var body = node.body; if (body) { @@ -48043,14 +52029,23 @@ var ts; } if (ts.getEmitFlags(node) & 262144) { emitSignatureHead(node); - emitBlockFunctionBody(body); + if (onEmitNode) { + onEmitNode(3, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); emitSignatureHead(node); - emitBlockFunctionBody(body); - tempFlags = savedTempFlags; + if (onEmitNode) { + onEmitNode(3, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } + popNameGenerationScope(); } if (indentedFlag) { decreaseIndent(); @@ -48099,9 +52094,15 @@ var ts; function emitBlockFunctionBody(body) { write(" {"); increaseIndent(); - emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body) + var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine - : emitBlockFunctionBodyWorker); + : emitBlockFunctionBodyWorker; + if (emitBodyWithDetachedComments) { + emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody); + } + else { + emitBlockFunctionBody(body); + } decreaseIndent(); writeToken(17, body.statements.end, body); } @@ -48110,8 +52111,9 @@ var ts; } function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { var statementOffset = emitPrologueDirectives(body.statements, true); - var helpersEmitted = emitHelpers(body); - if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) { + var pos = writer.getTextPos(); + emitHelpersIndirect(body); + if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384); increaseIndent(); @@ -48134,15 +52136,14 @@ var ts; } emitTypeParameters(node, node.typeParameters); emitList(node, node.heritageClauses, 256); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 65); write("}"); + popNameGenerationScope(); if (indentedFlag) { decreaseIndent(); } - tempFlags = savedTempFlags; } function emitInterfaceDeclaration(node) { emitDecorators(node, node.decorators); @@ -48169,19 +52170,18 @@ var ts; emitModifiers(node, node.modifiers); write("enum "); emit(node.name); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 81); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } function emitModuleDeclaration(node) { emitModifiers(node, node.modifiers); write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230) { + while (body.kind === 232) { write("."); emit(body.name); body = body.body; @@ -48194,13 +52194,11 @@ var ts; write("{ }"); } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write("{"); - increaseIndent(); emitBlockStatements(node); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } } function emitCaseBlock(node) { @@ -48302,14 +52300,18 @@ var ts; write("<"); emitJsxTagName(node.tagName); write(" "); - emitList(node, node.attributes, 131328); + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write("/>"); } function emitJsxOpeningElement(node) { write("<"); emitJsxTagName(node.tagName); - writeIfAny(node.attributes, " "); - emitList(node, node.attributes, 131328); + writeIfAny(node.attributes.properties, " "); + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write(">"); } function emitJsxText(node) { @@ -48320,6 +52322,9 @@ var ts; emitJsxTagName(node.tagName); write(">"); } + function emitJsxAttributes(node) { + emitList(node, node.properties, 131328); + } function emitJsxAttribute(node) { emit(node.name); emitWithPrefix("=", node.initializer); @@ -48332,6 +52337,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -48374,7 +52382,6 @@ var ts; emitList(node, node.types, 272); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73, node.pos); write(" "); writeToken(18, openParenPos); @@ -48387,7 +52394,7 @@ var ts; emit(node.name); write(": "); var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 512) === 0) { + if (emitTrailingCommentsOfPosition && (ts.getEmitFlags(initializer) & 512) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -48412,28 +52419,43 @@ var ts; } function emitSourceFile(node) { writeLine(); - emitShebang(); - emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker); + var statements = node.statements; + if (emitBodyWithDetachedComments) { + var shouldEmitDetachedComment = statements.length === 0 || + !ts.isPrologueDirective(statements[0]) || + ts.nodeIsSynthesized(statements[0]); + if (shouldEmitDetachedComment) { + emitBodyWithDetachedComments(node, statements, emitSourceFileWorker); + return; + } + } + emitSourceFileWorker(node); } function emitSourceFileWorker(node) { var statements = node.statements; - var statementOffset = emitPrologueDirectives(statements); - var savedTempFlags = tempFlags; - tempFlags = 0; - emitHelpers(node); - emitList(node, statements, 1, statementOffset); - tempFlags = savedTempFlags; + pushNameGenerationScope(); + emitHelpersIndirect(node); + var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); + emitList(node, statements, 1, index === -1 ? statements.length : index); + popNameGenerationScope(); } function emitPartiallyEmittedExpression(node) { emitExpression(node.expression); } - function emitPrologueDirectives(statements, startWithNewLine) { + function emitPrologueDirectives(statements, startWithNewLine, seenPrologueDirectives) { for (var i = 0; i < statements.length; i++) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); + var statement = statements[i]; + if (ts.isPrologueDirective(statement)) { + var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true; + if (shouldEmitPrologueDirective) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statement); + if (seenPrologueDirectives) { + seenPrologueDirectives.set(statement.expression.text, statement.expression.text); + } } - emit(statements[i]); } else { return i; @@ -48441,71 +52463,37 @@ var ts; } return statements.length; } - function emitHelpers(node, isBundle) { - var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); - var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; - var helpersEmitted = false; - var helpers = ts.getEmitHelpers(node); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - if (shouldSkip) - continue; - if (shouldBundle) { - if (bundledHelpers[helper.name]) { - continue; - } - bundledHelpers[helper.name] = true; - } - } - else if (isBundle) { - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } + function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + setSourceFile(sourceFileOrBundle); + emitPrologueDirectives(sourceFileOrBundle.statements); } - if (helpersEmitted) { - writeLine(); + else { + var seenPrologueDirectives = ts.createMap(); + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + setSourceFile(sourceFile); + emitPrologueDirectives(sourceFile.statements, true, seenPrologueDirectives); + } } - return helpersEmitted; } - function writeLines(text) { - var lines = text.split(/\r\n?|\n/g); - var indentation = guessIndentation(lines); - for (var i = 0; i < lines.length; i++) { - var line = indentation ? lines[i].slice(indentation) : lines[i]; - if (line.length) { - if (i > 0) { - writeLine(); - } - write(line); + function emitShebangIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + var shebang = ts.getShebang(sourceFileOrBundle.text); + if (shebang) { + write(shebang); + writeLine(); + return true; } } - } - function guessIndentation(lines) { - var indentation; - for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { - var line = lines_1[_a]; - for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { - if (!ts.isWhiteSpace(line.charCodeAt(i))) { - if (indentation === undefined || i < indentation) { - indentation = i; - break; - } + else { + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + if (emitShebangIfNeeded(sourceFile)) { + break; } } } - return indentation; - } - function emitShebang() { - var shebang = ts.getShebang(currentText); - if (shebang) { - write(shebang); - writeLine(); - } } function emitModifiers(node, modifiers) { if (modifiers && modifiers.length) { @@ -48531,8 +52519,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1) { write(" "); emit(node); } @@ -48589,6 +52577,9 @@ var ts; if (format & 7680) { write(getOpeningBracket(format)); } + if (onBeforeEmitNodeArray) { + onBeforeEmitNodeArray(children); + } if (isEmpty) { if (format & 1) { writeLine(); @@ -48616,6 +52607,9 @@ var ts; for (var i = 0; i < count; i++) { var child = children[start + i]; if (previousSibling) { + if (delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } write(delimiter); if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) { if ((format & (3 | 64)) === 0) { @@ -48630,8 +52624,10 @@ var ts; } } if (shouldEmitInterveningComments) { - var commentRange = ts.getCommentRange(child); - emitTrailingCommentsOfPosition(commentRange.pos); + if (emitTrailingCommentsOfPosition) { + var commentRange = ts.getCommentRange(child); + emitTrailingCommentsOfPosition(commentRange.pos); + } } else { shouldEmitInterveningComments = mayEmitInterveningComments; @@ -48647,6 +52643,9 @@ var ts; if (format & 16 && hasTrailingComma) { write(","); } + if (previousSibling && delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } if (format & 64) { decreaseIndent(); } @@ -48657,28 +52656,80 @@ var ts; write(" "); } } + if (onAfterEmitNodeArray) { + onAfterEmitNodeArray(children); + } if (format & 7680) { write(getClosingBracket(format)); } } + function write(s) { + writer.write(s); + } + function writeLine() { + writer.writeLine(); + } + function increaseIndent() { + writer.increaseIndent(); + } + function decreaseIndent() { + writer.decreaseIndent(); + } function writeIfAny(nodes, text) { - if (nodes && nodes.length > 0) { + if (ts.some(nodes)) { write(text); } } function writeIfPresent(node, text) { - if (node !== undefined) { + if (node) { write(text); } } function writeToken(token, pos, contextNode) { - return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText); + return onEmitSourceMapOfToken + ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) + : writeTokenText(token, pos); } function writeTokenText(token, pos) { var tokenString = ts.tokenToString(token); write(tokenString); return pos < 0 ? pos : pos + tokenString.length; } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1) { + write(" "); + } + else { + writeLine(); + } + } + function writeLines(text) { + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); + for (var i = 0; i < lines.length; i++) { + var line = indentation ? lines[i].slice(indentation) : lines[i]; + if (line.length) { + writeLine(); + write(line); + writeLine(); + } + } + } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } function increaseIndentIf(value, valueToWriteWhenNotIndenting) { if (value) { increaseIndent(); @@ -48783,15 +52834,23 @@ var ts; && !ts.nodeIsSynthesized(node2) && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } + function isSingleLineEmptyBlock(block) { + return !block.multiLine + && isEmptyBlock(block); + } + function isEmptyBlock(block) { + return block.statements.length === 0 + && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + } function skipSynthesizedParentheses(node) { - while (node.kind === 183 && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { if (ts.isGeneratedIdentifier(node)) { - return getGeneratedIdentifier(node); + return generateName(node); } else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { return ts.unescapeIdentifier(node.text); @@ -48814,25 +52873,39 @@ var ts; return getLiteralTextOfNode(textSourceNode); } } - return ts.getLiteralText(node, currentSourceFile, languageVersion); + return ts.getLiteralText(node, currentSourceFile); } - function isSingleLineEmptyBlock(block) { - return !block.multiLine - && isEmptyBlock(block); + function pushNameGenerationScope() { + tempFlagsStack.push(tempFlags); + tempFlags = 0; } - function isEmptyBlock(block) { - return block.statements.length === 0 - && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + function popNameGenerationScope() { + tempFlags = tempFlagsStack.pop(); + } + function generateName(name) { + if (name.autoGenerateKind === 4) { + var node = getNodeForGeneratedName(name); + return generateNameCached(node); + } + else { + var autoGenerateId = name.autoGenerateId; + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(makeName(name))); + } + } + function generateNameCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); } function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name) + && !generatedNames.has(name); } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + if (node.locals) { + var local = node.locals.get(name); + if (local && local.flags & (107455 | 1048576 | 8388608)) { return false; } } @@ -48841,21 +52914,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_39 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_39)) { + var name = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_39; + return name; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_40 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_40)) { - return name_40; + if (isUniqueName(name)) { + return name; } } } @@ -48868,7 +52941,8 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNames.set(generatedName, generatedName); + return generatedName; } i++; } @@ -48889,34 +52963,44 @@ var ts; function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameCached(node.name); + } + return makeTempVariableName(0); + } function generateNameForNode(node) { switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); - case 230: - case 229: + case 232: + case 231: return generateNameForModuleOrEnum(node); - case 235: - case 241: + case 237: + case 243: return generateNameForImportOrExportDeclaration(node); - case 225: - case 226: - case 240: + case 227: + case 228: + case 242: return generateNameForExportDefault(); - case 197: + case 198: return generateNameForClassExpression(); + case 150: + case 152: + case 153: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); } } - function generateName(name) { + function makeName(name) { switch (name.autoGenerateKind) { case 1: return makeTempVariableName(0); case 2: return makeTempVariableName(268435456); case 3: - return makeUniqueName(name.text); + return makeUniqueName(ts.unescapeIdentifier(name.text)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -48935,48 +53019,38 @@ var ts; } return node; } - function getGeneratedIdentifier(name) { - if (name.autoGenerateKind === 4) { - var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); - } - else { - var autoGenerateId = name.autoGenerateId; - return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name))); - } - } - function createDelimiterMap() { - var delimiters = []; - delimiters[0] = ""; - delimiters[16] = ","; - delimiters[4] = " |"; - delimiters[8] = " &"; - return delimiters; - } - function getDelimiter(format) { - return delimiters[format & 28]; - } - function createBracketsMap() { - var brackets = []; - brackets[512] = ["{", "}"]; - brackets[1024] = ["(", ")"]; - brackets[2048] = ["<", ">"]; - brackets[4096] = ["[", "]"]; - return brackets; - } - function getOpeningBracket(format) { - return brackets[format & 7680][0]; - } - function getClosingBracket(format) { - return brackets[format & 7680][1]; - } } - ts.emitFiles = emitFiles; + ts.createPrinter = createPrinter; + function createDelimiterMap() { + var delimiters = []; + delimiters[0] = ""; + delimiters[16] = ","; + delimiters[4] = " |"; + delimiters[8] = " &"; + return delimiters; + } + function getDelimiter(format) { + return delimiters[format & 28]; + } + function createBracketsMap() { + var brackets = []; + brackets[512] = ["{", "}"]; + brackets[1024] = ["(", ")"]; + brackets[2048] = ["<", ">"]; + brackets[4096] = ["[", "]"]; + return brackets; + } + function getOpeningBracket(format) { + return brackets[format & 7680][0]; + } + function getClosingBracket(format) { + return brackets[format & 7680][1]; + } })(ts || (ts = {})); var ts; (function (ts) { var emptyArray = []; + var ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } while (true) { @@ -49008,7 +53082,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { return true; @@ -49035,7 +53110,6 @@ var ts; function getCanonicalFileName(fileName) { return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { var text; try { @@ -49046,20 +53120,18 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.message); } text = ""; } return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -49078,9 +53150,10 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -49088,11 +53161,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -49191,10 +53264,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_41 = names_1[_i]; - var result = name_41 in cache - ? cache[name_41] - : cache[name_41] = loader(name_41, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -49206,6 +53283,8 @@ var ts; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; + var cachedSemanticDiagnosticsForFile = {}; + var cachedDeclarationDiagnosticsForFile = {}; var resolvedTypeReferenceDirectives = ts.createMap(); var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; @@ -49219,6 +53298,7 @@ var ts; var currentDirectory = host.getCurrentDirectory(); var supportedExtensions = ts.getSupportedExtensions(options); var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -49231,7 +53311,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -49267,6 +53348,7 @@ var ts; } } } + moduleResolutionCache = undefined; oldProgram = undefined; program = { getRootFileNames: function () { return rootNames; }, @@ -49300,7 +53382,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } @@ -49319,7 +53401,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -49362,7 +53444,7 @@ var ts; : emptyArray; var j = 0; for (var i = 0; i < result.length; i++) { - if (result[i] == predictedToResolveToAmbientModuleMarker) { + if (result[i] === predictedToResolveToAmbientModuleMarker) { result[i] = undefined; } else { @@ -49473,7 +53555,7 @@ var ts; newSourceFile.resolvedModules = oldSourceFile.resolvedModules; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -49502,7 +53584,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); @@ -49513,13 +53595,13 @@ var ts; function getTypeChecker() { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); } - function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { - return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); }); + function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers) { + return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers); }); } function isEmitBlocked(emitFileName) { return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); } - function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { + function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers) { var declarationDiagnostics = []; if (options.noEmit) { return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; @@ -49540,7 +53622,8 @@ var ts; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); ts.performance.mark("beforeEmit"); - var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles); + var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers); ts.performance.mark("afterEmit"); ts.performance.measure("Emit", "beforeEmit", "afterEmit"); return emitResult; @@ -49601,16 +53684,42 @@ var ts; } } function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedSemanticDiagnosticsForFile, getSemanticDiagnosticsForFileNoCache); + } + function getSemanticDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken); + var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + return ts.isSourceFileJavaScript(sourceFile) + ? ts.filter(diagnostics, shouldReportDiagnostic) + : diagnostics; }); } + function shouldReportDiagnostic(diagnostic) { + var file = diagnostic.file, start = diagnostic.start; + if (file) { + var lineStarts = ts.getLineStarts(file); + var line = ts.computeLineAndCharacterOfPosition(lineStarts, start).line; + while (line > 0) { + var previousLineText = file.text.slice(lineStarts[line - 1], lineStarts[line]); + var result = ignoreDiagnosticCommentRegEx.exec(previousLineText); + if (!result) { + return true; + } + if (result[3]) { + return false; + } + line--; + } + } + return true; + } function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { return runWithCancellationToken(function () { var diagnostics = []; @@ -49619,57 +53728,57 @@ var ts; return diagnostics; function walk(node) { switch (parent.kind) { - case 144: - case 147: + case 145: + case 148: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 225: + case 153: case 185: + case 227: + case 186: + case 227: case 225: - case 223: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 234: + case 236: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240: + case 242: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255: + case 258: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230: + case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182: + case 183: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -49684,26 +53793,26 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226: - case 149: - case 148: + case 228: case 150: + case 149: case 151: case 152: - case 184: - case 225: + case 153: case 185: - case 225: + case 227: + case 186: + case 227: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 205: + case 207: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205); + return checkModifiers(nodes, parent.kind === 207); } break; - case 147: + case 148: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; @@ -49714,23 +53823,23 @@ var ts; return; } break; - case 144: + case 145: if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179: case 180: - case 199: + case 181: + case 200: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; } break; } - for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { - var node = nodes_6[_b]; + for (var _b = 0, nodes_8 = nodes; _b < nodes_8.length; _b++) { + var node = nodes_8[_b]; walk(node); } } @@ -49766,11 +53875,33 @@ var ts; }); } function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache); + } + function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile); }); } + function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) { + var cachedResult = sourceFile + ? cache.perFile && cache.perFile.get(sourceFile.path) + : cache.allDiagnostics; + if (cachedResult) { + return cachedResult; + } + var result = getDiagnostics(sourceFile, cancellationToken) || emptyArray; + if (sourceFile) { + if (!cache.perFile) { + cache.perFile = ts.createFileMap(); + } + cache.perFile.set(sourceFile.path, result); + } + else { + cache.allDiagnostics = result; + } + return result; + } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); } @@ -49810,11 +53941,10 @@ var ts; if (options.importHelpers && (options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) { - var externalHelpersModuleReference = ts.createSynthesizedNode(9); - externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235); - importDecl.parent = file; + var externalHelpersModuleReference = ts.createLiteral(ts.externalHelpersModuleNameText); + var importDecl = ts.createImportDeclaration(undefined, undefined, undefined); externalHelpersModuleReference.parent = importDecl; + importDecl.parent = file; imports = [externalHelpersModuleReference]; } for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { @@ -49830,9 +53960,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 235: - case 234: - case 241: + case 237: + case 236: + case 243: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -49844,7 +53974,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230: + case 232: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -49928,18 +54058,18 @@ var ts; if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth === 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -49955,7 +54085,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(path); @@ -49999,7 +54129,7 @@ var ts; } } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -50027,7 +54157,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -50068,7 +54198,7 @@ var ts; var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -50086,8 +54216,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -50098,8 +54228,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -50192,7 +54322,7 @@ var ts; if (options.lib && options.noLib) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } - if (options.noImplicitUseStrict && options.alwaysStrict) { + if (options.noImplicitUseStrict && (options.alwaysStrict === undefined ? options.strict : options.alwaysStrict)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); } var languageVersion = options.target || 0; @@ -50232,6 +54362,9 @@ var ts; if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } + if (options.checkJs && !options.allowJs) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")); + } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); @@ -50250,7 +54383,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -50307,40 +54440,12 @@ var ts; (function (ts) { ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; ts.optionDeclarations = [ - { - name: "charset", - type: "string", - }, - ts.compileOnSaveCommandLineOption, - { - name: "declaration", - shortName: "d", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "diagnostics", - type: "boolean", - }, - { - name: "extendedDiagnostics", - type: "boolean", - experimental: true - }, - { - name: "emitBOM", - type: "boolean" - }, { name: "help", shortName: "h", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, }, { @@ -50349,218 +54454,56 @@ var ts; type: "boolean" }, { - name: "init", - type: "boolean", - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, - }, - { - name: "inlineSourceMap", - type: "boolean", - }, - { - name: "inlineSources", + name: "all", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Show_all_compiler_options, }, { - name: "jsx", - type: ts.createMap({ - "preserve": 1, - "react": 2 - }), - paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - }, - { - name: "reactNamespace", - type: "string", - description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit - }, - { - name: "jsxFactory", - type: "string", - description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h - }, - { - name: "listFiles", - type: "boolean", - }, - { - name: "locale", - type: "string", - }, - { - name: "mapRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: ts.Diagnostics.LOCATION, - }, - { - name: "module", - shortName: "m", - type: ts.createMap({ - "none": ts.ModuleKind.None, - "commonjs": ts.ModuleKind.CommonJS, - "amd": ts.ModuleKind.AMD, - "system": ts.ModuleKind.System, - "umd": ts.ModuleKind.UMD, - "es6": ts.ModuleKind.ES2015, - "es2015": ts.ModuleKind.ES2015, - }), - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - }, - { - name: "newLine", - type: ts.createMap({ - "crlf": 0, - "lf": 1 - }), - description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - }, - { - name: "noEmit", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs, - }, - { - name: "noEmitHelpers", - type: "boolean" - }, - { - name: "noEmitOnError", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "noErrorTruncation", - type: "boolean" - }, - { - name: "noImplicitAny", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "noImplicitThis", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "noUnusedLocals", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_locals, - }, - { - name: "noUnusedParameters", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_parameters, - }, - { - name: "noLib", - type: "boolean", - }, - { - name: "noResolve", - type: "boolean", - }, - { - name: "skipDefaultLibCheck", - type: "boolean", - }, - { - name: "skipLibCheck", + name: "version", + shortName: "v", type: "boolean", - description: ts.Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "out", - type: "string", - isFilePath: false, - paramType: ts.Diagnostics.FILE, - }, - { - name: "outFile", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, - paramType: ts.Diagnostics.FILE, - }, - { - name: "outDir", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Redirect_output_structure_to_the_directory, - paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_the_compiler_s_version, }, { - name: "preserveConstEnums", + name: "init", type: "boolean", - description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "pretty", - description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, - type: "boolean" + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, }, { name: "project", shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY - }, - { - name: "removeComments", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_comments_to_output, - }, - { - name: "rootDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.LOCATION, - description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - }, - { - name: "isolatedModules", - type: "boolean", - }, - { - name: "sourceMap", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_map_file, - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: ts.Diagnostics.LOCATION, - }, - { - name: "suppressExcessPropertyErrors", - type: "boolean", - description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, - experimental: true + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY, + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, }, { - name: "suppressImplicitAnyIndexErrors", + name: "pretty", type: "boolean", - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental }, { - name: "stripInternal", + name: "watch", + shortName: "w", type: "boolean", - description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - experimental: true + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Watch_input_files, }, { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0, "es5": 1, "es6": 2, @@ -50569,146 +54512,41 @@ var ts; "es2017": 4, "esnext": 5, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, paramType: ts.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, }, { - name: "version", - shortName: "v", - type: "boolean", - description: ts.Diagnostics.Print_the_compiler_s_version, - }, - { - name: "watch", - shortName: "w", - type: "boolean", - description: ts.Diagnostics.Watch_input_files, - }, - { - name: "experimentalDecorators", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators - }, - { - name: "emitDecoratorMetadata", - type: "boolean", - experimental: true, - description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators - }, - { - name: "moduleResolution", - type: ts.createMap({ - "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic, + name: "module", + shortName: "m", + type: ts.createMapFromTemplate({ + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES2015, + "es2015": ts.ModuleKind.ES2015, }), - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - paramType: ts.Diagnostics.STRATEGY, - }, - { - name: "allowUnusedLabels", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unused_labels - }, - { - name: "noImplicitReturns", - type: "boolean", - description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value - }, - { - name: "noFallthroughCasesInSwitch", - type: "boolean", - description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement - }, - { - name: "allowUnreachableCode", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, - { - name: "baseUrl", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names - }, - { - name: "paths", - type: "object", - isTSConfigOnly: true - }, - { - name: "rootDirs", - type: "list", - isTSConfigOnly: true, - element: { - name: "rootDirs", - type: "string", - isFilePath: true - } - }, - { - name: "typeRoots", - type: "list", - element: { - name: "typeRoots", - type: "string", - isFilePath: true - } - }, - { - name: "types", - type: "list", - element: { - name: "types", - type: "string" - }, - description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation - }, - { - name: "traceResolution", - type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process - }, - { - name: "allowJs", - type: "boolean", - description: ts.Diagnostics.Allow_javascript_files_to_be_compiled - }, - { - name: "allowSyntheticDefaultImports", - type: "boolean", - description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking - }, - { - name: "noImplicitUseStrict", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output - }, - { - name: "maxNodeModuleJsDepth", - type: "number", - description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files - }, - { - name: "listEmittedFiles", - type: "boolean" + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, }, { name: "lib", type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", "es2015": "lib.es2015.d.ts", "es7": "lib.es2016.d.ts", "es2016": "lib.es2016.d.ts", "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", "dom": "lib.dom.d.ts", "dom.iterable": "lib.dom.iterable.d.ts", "webworker": "lib.webworker.d.ts", @@ -50726,28 +54564,475 @@ var ts; "es2017.object": "lib.es2017.object.d.ts", "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", "es2017.string": "lib.es2017.string.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", }), }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon }, { - name: "disableSizeLimit", - type: "boolean" + name: "allowJs", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled }, { - name: "strictNullChecks", + name: "checkJs", type: "boolean", - description: ts.Diagnostics.Enable_strict_null_checks + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Report_errors_in_js_files + }, + { + name: "jsx", + type: ts.createMapFromTemplate({ + "preserve": 1, + "react-native": 3, + "react": 2 + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_d_ts_file, + }, + { + name: "sourceMap", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_map_file, + }, + { + name: "outFile", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + }, + { + name: "outDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + }, + { + name: "rootDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + }, + { + name: "removeComments", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_comments_to_output, + }, + { + name: "noEmit", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_outputs, }, { name: "importHelpers", type: "boolean", + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Import_emit_helpers_from_tslib }, + { + name: "downlevelIteration", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 + }, + { + name: "isolatedModules", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule + }, + { + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_all_strict_type_checking_options + }, + { + name: "noImplicitAny", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, + }, + { + name: "strictNullChecks", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_strict_null_checks + }, + { + name: "noImplicitThis", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, { name: "alwaysStrict", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + }, + { + name: "noUnusedLocals", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_locals, + }, + { + name: "noUnusedParameters", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_parameters, + }, + { + name: "noImplicitReturns", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "moduleResolution", + type: ts.createMapFromTemplate({ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic, + }), + paramType: ts.Diagnostics.STRATEGY, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + name: "paths", + type: "object", + isTSConfigOnly: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl + }, + { + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime + }, + { + name: "typeRoots", + type: "list", + element: { + name: "typeRoots", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + }, + { + name: "inlineSources", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + }, + { + name: "experimentalDecorators", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + { + name: "jsxFactory", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_verbose_diagnostic_information + }, + { + name: "traceResolution", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "listFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation + }, + { + name: "listEmittedFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation + }, + { + name: "out", + type: "string", + isFilePath: false, + category: ts.Diagnostics.Advanced_Options, + paramType: ts.Diagnostics.FILE, + description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + }, + { + name: "charset", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_character_set_of_the_input_files + }, + { + name: "emitBOM", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + }, + { + name: "locale", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: ts.createMapFromTemplate({ + "crlf": 0, + "lf": 1 + }), + paramType: ts.Diagnostics.NEWLINE, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + }, + { + name: "disableSizeLimit", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects + }, + { + name: "noImplicitUseStrict", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "noEmitHelpers", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + }, + { + name: "noEmitOnError", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, + }, + { + name: "preserveConstEnums", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, + }, + { + name: "allowUnusedLabels", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "allowUnreachableCode", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + }, + { + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts.Diagnostics.List_of_language_service_plugins } ]; ts.typeAcquisitionDeclarations = [ @@ -50779,8 +55064,7 @@ var ts; ts.defaultInitCompilerOptions = { module: ts.ModuleKind.CommonJS, target: 1, - noImplicitAny: false, - sourceMap: false, + strict: true }; var optionNameMapCache; function convertEnableAutoDiscoveryToEnable(typeAcquisition) { @@ -50802,9 +55086,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -50812,19 +55096,12 @@ var ts; } ts.getOptionNameMap = getOptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; function parseListTypeOption(opt, value, errors) { @@ -50868,11 +55145,12 @@ var ts; } else if (s.charCodeAt(0) === 45) { s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -50977,7 +55255,7 @@ var ts; } } ts.parseConfigFileTextToJson = parseConfigFileTextToJson; - function generateTSConfig(options, fileNames) { + function generateTSConfig(options, fileNames, newLine) { var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); var configurations = { compilerOptions: serializeCompilerOptions(compilerOptions) @@ -50985,7 +55263,7 @@ var ts; if (fileNames && fileNames.length) { configurations.files = fileNames; } - return configurations; + return writeConfigurations(); function getCustomTypeMapOfCommandLineOption(optionDefinition) { if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { return undefined; @@ -50998,53 +55276,121 @@ var ts; } } function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_42 in options) { - if (ts.hasProperty(options, name_42)) { - switch (name_42) { - case "init": - case "watch": - case "version": - case "help": - case "project": - break; - default: - var value = options[name_42]; - var optionDefinition = optionsNameMap[name_42.toLowerCase()]; - if (optionDefinition) { - var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - result[name_42] = value; - } - else { - if (optionDefinition.type === "list") { - var convertedValue = []; - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name_42] = convertedValue; - } - else { - result[name_42] = getNameOfCompilerOptionValue(value, customTypeMap); - } + for (var name in options) { + if (ts.hasProperty(options, name)) { + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { + continue; + } + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap) { + result[name] = value; + } + else { + if (optionDefinition.type === "list") { + var convertedValue = []; + for (var _i = 0, _a = value; _i < _a.length; _i++) { + var element = _a[_i]; + convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } + result[name] = convertedValue; } - break; + else { + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); + } + } } } } return result; } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return ts.arrayFrom(option.type.keys())[0]; + } + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function writeConfigurations() { + var categorizedOptions = ts.reduceLeft(ts.filter(ts.optionDeclarations, function (o) { return o.category !== ts.Diagnostics.Command_line_Options && o.category !== ts.Diagnostics.Advanced_Options; }), function (memo, value) { + if (value.category) { + var name = ts.getLocaleSpecificMessage(value.category); + (memo[name] || (memo[name] = [])).push(value); + } + return memo; + }, {}); + var marginLength = 0; + var seenKnownKeys = 0; + var nameColumn = []; + var descriptionColumn = []; + var knownKeysCount = ts.getOwnKeys(configurations.compilerOptions).length; + for (var category in categorizedOptions) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push("/* " + category + " */"); + descriptionColumn.push(""); + for (var _i = 0, _a = categorizedOptions[category]; _i < _a.length; _i++) { + var option = _a[_i]; + var optionName = void 0; + if (ts.hasProperty(configurations.compilerOptions, option.name)) { + optionName = "\"" + option.name + "\": " + JSON.stringify(configurations.compilerOptions[option.name]) + ((seenKnownKeys += 1) === knownKeysCount ? "" : ","); + } + else { + optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; + } + nameColumn.push(optionName); + descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); + marginLength = Math.max(optionName.length, marginLength); + } + } + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push(tab + "\"compilerOptions\": {"); + for (var i = 0; i < nameColumn.length; i++) { + var optionName = nameColumn[i]; + var description = descriptionColumn[i]; + result.push(tab + tab + optionName + makePadding(marginLength - optionName.length + 2) + description); + } + if (configurations.files && configurations.files.length) { + result.push(tab + "},"); + result.push(tab + "\"files\": ["); + for (var i = 0; i < configurations.files.length; i++) { + result.push("" + tab + tab + JSON.stringify(configurations.files[i]) + (i === configurations.files.length - 1 ? "" : ",")); + } + result.push(tab + "]"); + } + else { + result.push(tab + "}"); + } + result.push("}"); + return result.join(newLine); + } } ts.generateTSConfig = generateTSConfig; function removeComments(jsonText) { @@ -51064,10 +55410,12 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -51189,7 +55537,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -51240,8 +55588,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -51275,8 +55623,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -51293,7 +55642,7 @@ var ts; var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; var literalFileMap = ts.createMap(); @@ -51305,12 +55654,12 @@ var ts; exclude = validateSpecs(exclude, errors, true); } var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -51321,14 +55670,13 @@ var ts; } removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -51336,8 +55684,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -51356,7 +55704,7 @@ var ts; function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -51377,14 +55725,15 @@ var ts; } } } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } } return wildcardDirectories; } @@ -51403,11 +55752,11 @@ var ts; } function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority); + var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); for (var i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -51415,17 +55764,13 @@ var ts; } function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority); + var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - function addFileToOutput(output, file) { - output.push(file); - return output; - } function caseSensitiveKeyMapper(key) { return key; } @@ -51451,7 +55796,7 @@ var ts; } } function reportEmittedFiles(files) { - if (!files || files.length == 0) { + if (!files || files.length === 0) { return; } var currentDir = ts.sys.getCurrentDirectory(); @@ -51486,20 +55831,22 @@ var ts; var gutterSeparator = " "; var resetEscapeSequence = "\u001b[0m"; var ellipsis = "..."; - var categoryFormatMap = ts.createMap((_a = {}, - _a[ts.DiagnosticCategory.Warning] = yellowForegroundEscapeSequence, - _a[ts.DiagnosticCategory.Error] = redForegroundEscapeSequence, - _a[ts.DiagnosticCategory.Message] = blueForegroundEscapeSequence, - _a)); + function getCategoryFormat(category) { + switch (category) { + case ts.DiagnosticCategory.Warning: return yellowForegroundEscapeSequence; + case ts.DiagnosticCategory.Error: return redForegroundEscapeSequence; + case ts.DiagnosticCategory.Message: return blueForegroundEscapeSequence; + } + } function formatAndReset(text, formatStyle) { return formatStyle + text + resetEscapeSequence; } function reportDiagnosticWithColorAndContext(diagnostic, host) { var output = ""; if (diagnostic.file) { - var start = diagnostic.start, length_4 = diagnostic.length, file = diagnostic.file; + var start = diagnostic.start, length_5 = diagnostic.length, file = diagnostic.file; var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; - var _b = ts.getLineAndCharacterOfPosition(file, start + length_4), lastLine = _b.line, lastLineChar = _b.character; + var _b = ts.getLineAndCharacterOfPosition(file, start + length_5), lastLine = _b.line, lastLineChar = _b.character; var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line; var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName; var hasMoreThanFiveLines = (lastLine - firstLine) >= 4; @@ -51539,7 +55886,7 @@ var ts; output += ts.sys.newLine; output += relativeFileName + "(" + (firstLine + 1) + "," + (firstLineChar + 1) + "): "; } - var categoryColor = categoryFormatMap[diagnostic.category]; + var categoryColor = getCategoryFormat(diagnostic.category); var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); output += formatAndReset(category, categoryColor) + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine); output += ts.sys.newLine + ts.sys.newLine; @@ -51551,7 +55898,7 @@ var ts; var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; } - output += "" + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; + output += "" + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + (ts.sys.newLine + ts.sys.newLine + ts.sys.newLine); ts.sys.write(output); } function padLeft(s, length) { @@ -51603,9 +55950,9 @@ var ts; printVersion(); return ts.sys.exit(ts.ExitStatus.Success); } - if (commandLine.options.help) { + if (commandLine.options.help || commandLine.options.all) { printVersion(); - printHelp(); + printHelp(commandLine.options.all); return ts.sys.exit(ts.ExitStatus.Success); } if (commandLine.options.project) { @@ -51639,7 +55986,7 @@ var ts; } if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); - printHelp(); + printHelp(commandLine.options.all); return ts.sys.exit(ts.ExitStatus.Success); } if (ts.isWatchSet(commandLine.options)) { @@ -51652,7 +55999,7 @@ var ts; } if (ts.sys.watchDirectory && configFileName) { var directory = ts.getDirectoryPath(configFileName); - directoryWatcher = ts.sys.watchDirectory(directory == "" ? "." : directory, watchedDirectoryChanged, true); + directoryWatcher = ts.sys.watchDirectory(directory === "" ? "." : directory, watchedDirectoryChanged, true); } } performCompilation(); @@ -51695,9 +56042,8 @@ var ts; } if (!directoryWatcher && ts.sys.watchDirectory && configFileName) { var directory = ts.getDirectoryPath(configFileName); - directoryWatcher = ts.sys.watchDirectory(directory == "" ? "." : directory, watchedDirectoryChanged, true); + directoryWatcher = ts.sys.watchDirectory(directory === "" ? "." : directory, watchedDirectoryChanged, true); } - ; } return configParseResult; } @@ -51730,9 +56076,11 @@ var ts; reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); } function cachedFileExists(fileName) { - return fileName in cachedExistingFiles - ? cachedExistingFiles[fileName] - : cachedExistingFiles[fileName] = hostFileExists(fileName); + var fileExists = cachedExistingFiles.get(fileName); + if (fileExists === undefined) { + cachedExistingFiles.set(fileName, fileExists = hostFileExists(fileName)); + } + return fileExists; } function getSourceFile(fileName, languageVersion, onError) { if (cachedProgram) { @@ -51884,17 +56232,17 @@ var ts; var nameSize = 0; var valueSize = 0; for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { - var _a = statistics_1[_i], name_43 = _a.name, value = _a.value; - if (name_43.length > nameSize) { - nameSize = name_43.length; + var _a = statistics_1[_i], name = _a.name, value = _a.value; + if (name.length > nameSize) { + nameSize = name.length; } if (value.length > valueSize) { valueSize = value.length; } } for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) { - var _c = statistics_2[_b], name_44 = _c.name, value = _c.value; - ts.sys.write(padRight(name_44 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); + var _c = statistics_2[_b], name = _c.name, value = _c.value; + ts.sys.write(padRight(name + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); } } function reportStatisticalValue(name, value) { @@ -51910,7 +56258,7 @@ var ts; function printVersion() { ts.sys.write(getDiagnosticText(ts.Diagnostics.Version_0, ts.version) + ts.sys.newLine); } - function printHelp() { + function printHelp(showAllOptions) { var output = []; var syntaxLength = getDiagnosticText(ts.Diagnostics.Syntax_Colon_0, "").length; var examplesLength = getDiagnosticText(ts.Diagnostics.Examples_Colon_0, "").length; @@ -51925,8 +56273,9 @@ var ts; output.push(padding + "tsc @args.txt" + ts.sys.newLine); output.push(ts.sys.newLine); output.push(getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine); - var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; }); - optsList.sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); }); + var optsList = showAllOptions ? + ts.optionDeclarations.slice().sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); }) : + ts.filter(ts.optionDeclarations.slice(), function (v) { return v.showInSimplifiedHelpView; }); marginLength = 0; var usageColumn = []; var descriptionColumn = []; @@ -51948,13 +56297,9 @@ var ts; var description = void 0; if (option.name === "lib") { description = getDiagnosticText(option.description); - var options = []; var element = option.element; var typeMap = element.type; - for (var key in typeMap) { - options.push("'" + key + "'"); - } - optionsDescriptionMap[description] = options; + optionsDescriptionMap.set(description, ts.arrayFrom(typeMap.keys()).map(function (key) { return "'" + key + "'"; })); } else { description = getDiagnosticText(option.description); @@ -51969,7 +56314,7 @@ var ts; for (var i = 0; i < usageColumn.length; i++) { var usage = usageColumn[i]; var description = descriptionColumn[i]; - var kindsList = optionsDescriptionMap[description]; + var kindsList = optionsDescriptionMap.get(description); output.push(usage + makePadding(marginLength - usage.length + 2) + description + ts.sys.newLine); if (kindsList) { output.push(makePadding(marginLength + 4)); @@ -52002,12 +56347,11 @@ var ts; reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), undefined); } else { - ts.sys.writeFile(file, JSON.stringify(ts.generateTSConfig(options, fileNames), undefined, 4)); + ts.sys.writeFile(file, ts.generateTSConfig(options, fileNames, ts.sys.newLine)); reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Successfully_created_a_tsconfig_json_file), undefined); } return; } - var _a; })(ts || (ts = {})); if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) { ts.sys.tryEnableSourceMapsForHost(); diff --git a/node_modules/typescript/lib/tsserver.js b/node_modules/typescript/lib/tsserver.js index 51ba6b309..65d4969da 100644 --- a/node_modules/typescript/lib/tsserver.js +++ b/node_modules/typescript/lib/tsserver.js @@ -13,13 +13,455 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +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; }; +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 __()); + }; +})(); var ts; (function (ts) { + var SyntaxKind; + (function (SyntaxKind) { + SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; + SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["ShebangTrivia"] = 6] = "ShebangTrivia"; + SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral"; + SyntaxKind[SyntaxKind["JsxText"] = 10] = "JsxText"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 11] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 12] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["TemplateHead"] = 13] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 14] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 15] = "TemplateTail"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 16] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 17] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 18] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 19] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 20] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 21] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 22] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 23] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 24] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 25] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 26] = "LessThanToken"; + SyntaxKind[SyntaxKind["LessThanSlashToken"] = 27] = "LessThanSlashToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 28] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 29] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 30] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 31] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 32] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 33] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 34] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 35] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 36] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 37] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 38] = "AsteriskToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 39] = "AsteriskAsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 40] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 41] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 42] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 43] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 44] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 46] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 47] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 48] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 49] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 50] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 51] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 52] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 53] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 54] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 55] = "ColonToken"; + SyntaxKind[SyntaxKind["AtToken"] = 56] = "AtToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 57] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 58] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 59] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 60] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 61] = "AsteriskAsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 62] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 63] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 64] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 66] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 67] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 68] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 69] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 70] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 71] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 72] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 73] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 74] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 75] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 76] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 77] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 78] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 79] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 80] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 81] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 82] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 83] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 84] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 85] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 86] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 87] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 88] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 89] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 90] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 91] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 92] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 93] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 94] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 95] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 96] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 97] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 98] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 99] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 100] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 101] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 102] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 103] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 104] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 105] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 106] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 107] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 108] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 109] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 110] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 111] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 112] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 113] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 114] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 115] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 116] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 117] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 118] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 119] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 120] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 121] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 122] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 123] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 124] = "GetKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 125] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 126] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 127] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 128] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 129] = "NeverKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 133] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 134] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 135] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 136] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 137] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 138] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 139] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 140] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 141] = "OfKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 142] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 143] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 144] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 145] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 146] = "Decorator"; + SyntaxKind[SyntaxKind["PropertySignature"] = 147] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 148] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 149] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 150] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 151] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 152] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 153] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 154] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 155] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 156] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypePredicate"] = 157] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 158] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 159] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 160] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 161] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 162] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 163] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 164] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 165] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 166] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 167] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 168] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 169] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 170] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 171] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 172] = "LiteralType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 173] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 174] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 175] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 176] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 177] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 179] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 180] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 181] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 182] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 183] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 184] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 185] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 186] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 187] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 188] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 189] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 190] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 191] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 192] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 193] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 194] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 195] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 196] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 197] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 198] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 199] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 200] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 201] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 202] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 203] = "MetaProperty"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 204] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 205] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 206] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 207] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 208] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 209] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 210] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 211] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 212] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 213] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 214] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 215] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 216] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 217] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 218] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 219] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 220] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 221] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 222] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 223] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 224] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 226] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 227] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 228] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 229] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 230] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 231] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 232] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 233] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 234] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 235] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 236] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 237] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 238] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 239] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 240] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 241] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 242] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 243] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 244] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 245] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 246] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 247] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["JsxElement"] = 248] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 249] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 250] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 251] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 252] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 253] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 254] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 255] = "JsxExpression"; + SyntaxKind[SyntaxKind["CaseClause"] = 256] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 257] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 258] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 259] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 260] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 261] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 262] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 263] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 264] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 265] = "Bundle"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 266] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 267] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 268] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 269] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 270] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 271] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 272] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 273] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 274] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 275] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 276] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 277] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 278] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 279] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 280] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 281] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 283] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 284] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 285] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 286] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 287] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 288] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 289] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 290] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 291] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 292] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 58] = "FirstCompoundAssignment"; + SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 69] = "LastCompoundAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 141] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 157] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 172] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; + SyntaxKind[SyntaxKind["LastToken"] = 141] = "LastToken"; + SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; + SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 12] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 12] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 142] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 266] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 282] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); + var NodeFlags; + (function (NodeFlags) { + NodeFlags[NodeFlags["None"] = 0] = "None"; + NodeFlags[NodeFlags["Let"] = 1] = "Let"; + NodeFlags[NodeFlags["Const"] = 2] = "Const"; + NodeFlags[NodeFlags["NestedNamespace"] = 4] = "NestedNamespace"; + NodeFlags[NodeFlags["Synthesized"] = 8] = "Synthesized"; + NodeFlags[NodeFlags["Namespace"] = 16] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 32] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 64] = "ContainsThis"; + NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn"; + NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn"; + NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 1024] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 2048] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 4096] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 8192] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 16384] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 32768] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; + NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; + NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 96256] = "ContextFlags"; + NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags"; + })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); + var ModifierFlags; + (function (ModifierFlags) { + ModifierFlags[ModifierFlags["None"] = 0] = "None"; + ModifierFlags[ModifierFlags["Export"] = 1] = "Export"; + ModifierFlags[ModifierFlags["Ambient"] = 2] = "Ambient"; + ModifierFlags[ModifierFlags["Public"] = 4] = "Public"; + ModifierFlags[ModifierFlags["Private"] = 8] = "Private"; + ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; + ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; + ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; + ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; + ModifierFlags[ModifierFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags"; + ModifierFlags[ModifierFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; + ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier"; + ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 2270] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; + })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); + var JsxFlags; + (function (JsxFlags) { + JsxFlags[JsxFlags["None"] = 0] = "None"; + JsxFlags[JsxFlags["IntrinsicNamedElement"] = 1] = "IntrinsicNamedElement"; + JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement"; + JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement"; + })(JsxFlags = ts.JsxFlags || (ts.JsxFlags = {})); + var RelationComparisonResult; + (function (RelationComparisonResult) { + RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded"; + RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed"; + RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; + })(RelationComparisonResult = ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); + var GeneratedIdentifierKind; + (function (GeneratedIdentifierKind) { + GeneratedIdentifierKind[GeneratedIdentifierKind["None"] = 0] = "None"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Auto"] = 1] = "Auto"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Loop"] = 2] = "Loop"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node"; + })(GeneratedIdentifierKind = ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {})); + var NumericLiteralFlags; + (function (NumericLiteralFlags) { + NumericLiteralFlags[NumericLiteralFlags["None"] = 0] = "None"; + NumericLiteralFlags[NumericLiteralFlags["Scientific"] = 2] = "Scientific"; + NumericLiteralFlags[NumericLiteralFlags["Octal"] = 4] = "Octal"; + NumericLiteralFlags[NumericLiteralFlags["HexSpecifier"] = 8] = "HexSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinarySpecifier"] = 16] = "BinarySpecifier"; + NumericLiteralFlags[NumericLiteralFlags["OctalSpecifier"] = 32] = "OctalSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctalSpecifier"] = 48] = "BinaryOrOctalSpecifier"; + })(NumericLiteralFlags = ts.NumericLiteralFlags || (ts.NumericLiteralFlags = {})); + var FlowFlags; + (function (FlowFlags) { + FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable"; + FlowFlags[FlowFlags["Start"] = 2] = "Start"; + FlowFlags[FlowFlags["BranchLabel"] = 4] = "BranchLabel"; + FlowFlags[FlowFlags["LoopLabel"] = 8] = "LoopLabel"; + FlowFlags[FlowFlags["Assignment"] = 16] = "Assignment"; + FlowFlags[FlowFlags["TrueCondition"] = 32] = "TrueCondition"; + FlowFlags[FlowFlags["FalseCondition"] = 64] = "FalseCondition"; + FlowFlags[FlowFlags["SwitchClause"] = 128] = "SwitchClause"; + FlowFlags[FlowFlags["ArrayMutation"] = 256] = "ArrayMutation"; + FlowFlags[FlowFlags["Referenced"] = 512] = "Referenced"; + FlowFlags[FlowFlags["Shared"] = 1024] = "Shared"; + FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally"; + FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally"; + FlowFlags[FlowFlags["Label"] = 12] = "Label"; + FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; + })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {})); var OperationCanceledException = (function () { function OperationCanceledException() { } @@ -32,6 +474,55 @@ var ts; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var NodeBuilderFlags; + (function (NodeBuilderFlags) { + NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None"; + NodeBuilderFlags[NodeBuilderFlags["allowThisInObjectLiteral"] = 1] = "allowThisInObjectLiteral"; + NodeBuilderFlags[NodeBuilderFlags["allowQualifedNameInPlaceOfIdentifier"] = 2] = "allowQualifedNameInPlaceOfIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowTypeParameterInQualifiedName"] = 4] = "allowTypeParameterInQualifiedName"; + NodeBuilderFlags[NodeBuilderFlags["allowAnonymousIdentifier"] = 8] = "allowAnonymousIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyUnionOrIntersection"] = 16] = "allowEmptyUnionOrIntersection"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyTuple"] = 32] = "allowEmptyTuple"; + })(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {})); + var TypeFormatFlags; + (function (TypeFormatFlags) { + TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; + TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType"; + TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 2] = "UseTypeOfFunction"; + TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 4] = "NoTruncation"; + TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 8] = "WriteArrowStyleSignature"; + TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 16] = "WriteOwnNameForAnyLike"; + TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; + TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType"; + TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType"; + TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; + TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias"; + TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue"; + TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 2048] = "SuppressAnyReturnType"; + TypeFormatFlags[TypeFormatFlags["AddUndefined"] = 4096] = "AddUndefined"; + })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); + var SymbolFormatFlags; + (function (SymbolFormatFlags) { + SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None"; + SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments"; + SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing"; + })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); + var SymbolAccessibility; + (function (SymbolAccessibility) { + SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible"; + SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible"; + SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; + })(SymbolAccessibility = ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); + var SyntheticSymbolKind; + (function (SyntheticSymbolKind) { + SyntheticSymbolKind[SyntheticSymbolKind["UnionOrIntersection"] = 0] = "UnionOrIntersection"; + SyntheticSymbolKind[SyntheticSymbolKind["Spread"] = 1] = "Spread"; + })(SyntheticSymbolKind = ts.SyntheticSymbolKind || (ts.SyntheticSymbolKind = {})); + var TypePredicateKind; + (function (TypePredicateKind) { + TypePredicateKind[TypePredicateKind["This"] = 0] = "This"; + TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier"; + })(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {})); var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown"; @@ -46,6 +537,191 @@ var ts; TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 9] = "TypeWithCallSignature"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType"; })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); + var SymbolFlags; + (function (SymbolFlags) { + SymbolFlags[SymbolFlags["None"] = 0] = "None"; + SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable"; + SymbolFlags[SymbolFlags["BlockScopedVariable"] = 2] = "BlockScopedVariable"; + SymbolFlags[SymbolFlags["Property"] = 4] = "Property"; + SymbolFlags[SymbolFlags["EnumMember"] = 8] = "EnumMember"; + SymbolFlags[SymbolFlags["Function"] = 16] = "Function"; + SymbolFlags[SymbolFlags["Class"] = 32] = "Class"; + SymbolFlags[SymbolFlags["Interface"] = 64] = "Interface"; + SymbolFlags[SymbolFlags["ConstEnum"] = 128] = "ConstEnum"; + SymbolFlags[SymbolFlags["RegularEnum"] = 256] = "RegularEnum"; + SymbolFlags[SymbolFlags["ValueModule"] = 512] = "ValueModule"; + SymbolFlags[SymbolFlags["NamespaceModule"] = 1024] = "NamespaceModule"; + SymbolFlags[SymbolFlags["TypeLiteral"] = 2048] = "TypeLiteral"; + SymbolFlags[SymbolFlags["ObjectLiteral"] = 4096] = "ObjectLiteral"; + SymbolFlags[SymbolFlags["Method"] = 8192] = "Method"; + SymbolFlags[SymbolFlags["Constructor"] = 16384] = "Constructor"; + SymbolFlags[SymbolFlags["GetAccessor"] = 32768] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 65536] = "SetAccessor"; + SymbolFlags[SymbolFlags["Signature"] = 131072] = "Signature"; + SymbolFlags[SymbolFlags["TypeParameter"] = 262144] = "TypeParameter"; + SymbolFlags[SymbolFlags["TypeAlias"] = 524288] = "TypeAlias"; + SymbolFlags[SymbolFlags["ExportValue"] = 1048576] = "ExportValue"; + SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType"; + SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace"; + SymbolFlags[SymbolFlags["Alias"] = 8388608] = "Alias"; + SymbolFlags[SymbolFlags["Prototype"] = 16777216] = "Prototype"; + SymbolFlags[SymbolFlags["ExportStar"] = 33554432] = "ExportStar"; + SymbolFlags[SymbolFlags["Optional"] = 67108864] = "Optional"; + SymbolFlags[SymbolFlags["Transient"] = 134217728] = "Transient"; + SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; + SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; + SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; + SymbolFlags[SymbolFlags["Type"] = 793064] = "Type"; + SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace"; + SymbolFlags[SymbolFlags["Module"] = 1536] = "Module"; + SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor"; + SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 107454] = "FunctionScopedVariableExcludes"; + SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 107455] = "BlockScopedVariableExcludes"; + SymbolFlags[SymbolFlags["ParameterExcludes"] = 107455] = "ParameterExcludes"; + SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes"; + SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes"; + SymbolFlags[SymbolFlags["FunctionExcludes"] = 106927] = "FunctionExcludes"; + SymbolFlags[SymbolFlags["ClassExcludes"] = 899519] = "ClassExcludes"; + SymbolFlags[SymbolFlags["InterfaceExcludes"] = 792968] = "InterfaceExcludes"; + SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes"; + SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes"; + SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 106639] = "ValueModuleExcludes"; + SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; + SymbolFlags[SymbolFlags["MethodExcludes"] = 99263] = "MethodExcludes"; + SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 41919] = "GetAccessorExcludes"; + SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 530920] = "TypeParameterExcludes"; + SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 793064] = "TypeAliasExcludes"; + SymbolFlags[SymbolFlags["AliasExcludes"] = 8388608] = "AliasExcludes"; + SymbolFlags[SymbolFlags["ModuleMember"] = 8914931] = "ModuleMember"; + SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal"; + SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports"; + SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers"; + SymbolFlags[SymbolFlags["BlockScoped"] = 418] = "BlockScoped"; + SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor"; + SymbolFlags[SymbolFlags["Export"] = 7340032] = "Export"; + SymbolFlags[SymbolFlags["ClassMember"] = 106500] = "ClassMember"; + SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable"; + })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {})); + var CheckFlags; + (function (CheckFlags) { + CheckFlags[CheckFlags["Instantiated"] = 1] = "Instantiated"; + CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty"; + CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod"; + CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly"; + CheckFlags[CheckFlags["Partial"] = 16] = "Partial"; + CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType"; + CheckFlags[CheckFlags["ContainsPublic"] = 64] = "ContainsPublic"; + CheckFlags[CheckFlags["ContainsProtected"] = 128] = "ContainsProtected"; + CheckFlags[CheckFlags["ContainsPrivate"] = 256] = "ContainsPrivate"; + CheckFlags[CheckFlags["ContainsStatic"] = 512] = "ContainsStatic"; + CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic"; + })(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {})); + var NodeCheckFlags; + (function (NodeCheckFlags) { + NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; + NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; + NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["CaptureNewTarget"] = 8] = "CaptureNewTarget"; + NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; + NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; + NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; + NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; + NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; + NodeCheckFlags[NodeCheckFlags["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["CapturedBlockScopedBinding"] = 131072] = "CapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 262144] = "BlockScopedBindingInLoop"; + NodeCheckFlags[NodeCheckFlags["ClassWithBodyScopedClassBinding"] = 524288] = "ClassWithBodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["BodyScopedClassBinding"] = 1048576] = "BodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 2097152] = "NeedsLoopOutParameter"; + NodeCheckFlags[NodeCheckFlags["AssignmentsMarked"] = 4194304] = "AssignmentsMarked"; + NodeCheckFlags[NodeCheckFlags["ClassWithConstructorReference"] = 8388608] = "ClassWithConstructorReference"; + NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 16777216] = "ConstructorReferenceInClass"; + })(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); + var TypeFlags; + (function (TypeFlags) { + TypeFlags[TypeFlags["Any"] = 1] = "Any"; + TypeFlags[TypeFlags["String"] = 2] = "String"; + TypeFlags[TypeFlags["Number"] = 4] = "Number"; + TypeFlags[TypeFlags["Boolean"] = 8] = "Boolean"; + TypeFlags[TypeFlags["Enum"] = 16] = "Enum"; + TypeFlags[TypeFlags["StringLiteral"] = 32] = "StringLiteral"; + TypeFlags[TypeFlags["NumberLiteral"] = 64] = "NumberLiteral"; + TypeFlags[TypeFlags["BooleanLiteral"] = 128] = "BooleanLiteral"; + TypeFlags[TypeFlags["EnumLiteral"] = 256] = "EnumLiteral"; + TypeFlags[TypeFlags["ESSymbol"] = 512] = "ESSymbol"; + TypeFlags[TypeFlags["Void"] = 1024] = "Void"; + TypeFlags[TypeFlags["Undefined"] = 2048] = "Undefined"; + TypeFlags[TypeFlags["Null"] = 4096] = "Null"; + TypeFlags[TypeFlags["Never"] = 8192] = "Never"; + TypeFlags[TypeFlags["TypeParameter"] = 16384] = "TypeParameter"; + TypeFlags[TypeFlags["Object"] = 32768] = "Object"; + TypeFlags[TypeFlags["Union"] = 65536] = "Union"; + TypeFlags[TypeFlags["Intersection"] = 131072] = "Intersection"; + TypeFlags[TypeFlags["Index"] = 262144] = "Index"; + TypeFlags[TypeFlags["IndexedAccess"] = 524288] = "IndexedAccess"; + TypeFlags[TypeFlags["FreshLiteral"] = 1048576] = "FreshLiteral"; + TypeFlags[TypeFlags["ContainsWideningType"] = 2097152] = "ContainsWideningType"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; + TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["NonPrimitive"] = 16777216] = "NonPrimitive"; + TypeFlags[TypeFlags["JsxAttributes"] = 33554432] = "JsxAttributes"; + TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable"; + TypeFlags[TypeFlags["Literal"] = 480] = "Literal"; + TypeFlags[TypeFlags["StringOrNumberLiteral"] = 96] = "StringOrNumberLiteral"; + TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy"; + TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy"; + TypeFlags[TypeFlags["Intrinsic"] = 16793231] = "Intrinsic"; + TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; + TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; + TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike"; + TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike"; + TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; + TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; + TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; + TypeFlags[TypeFlags["StructuredOrTypeVariable"] = 1032192] = "StructuredOrTypeVariable"; + TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; + TypeFlags[TypeFlags["Narrowable"] = 17810431] = "Narrowable"; + TypeFlags[TypeFlags["NotUnionOrUnit"] = 16810497] = "NotUnionOrUnit"; + TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; + TypeFlags[TypeFlags["PropagatingFlags"] = 14680064] = "PropagatingFlags"; + })(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {})); + var ObjectFlags; + (function (ObjectFlags) { + ObjectFlags[ObjectFlags["Class"] = 1] = "Class"; + ObjectFlags[ObjectFlags["Interface"] = 2] = "Interface"; + ObjectFlags[ObjectFlags["Reference"] = 4] = "Reference"; + ObjectFlags[ObjectFlags["Tuple"] = 8] = "Tuple"; + ObjectFlags[ObjectFlags["Anonymous"] = 16] = "Anonymous"; + ObjectFlags[ObjectFlags["Mapped"] = 32] = "Mapped"; + ObjectFlags[ObjectFlags["Instantiated"] = 64] = "Instantiated"; + ObjectFlags[ObjectFlags["ObjectLiteral"] = 128] = "ObjectLiteral"; + ObjectFlags[ObjectFlags["EvolvingArray"] = 256] = "EvolvingArray"; + ObjectFlags[ObjectFlags["ObjectLiteralPatternWithComputedProperties"] = 512] = "ObjectLiteralPatternWithComputedProperties"; + ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface"; + })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {})); + var SignatureKind; + (function (SignatureKind) { + SignatureKind[SignatureKind["Call"] = 0] = "Call"; + SignatureKind[SignatureKind["Construct"] = 1] = "Construct"; + })(SignatureKind = ts.SignatureKind || (ts.SignatureKind = {})); + var IndexKind; + (function (IndexKind) { + IndexKind[IndexKind["String"] = 0] = "String"; + IndexKind[IndexKind["Number"] = 1] = "Number"; + })(IndexKind = ts.IndexKind || (ts.IndexKind = {})); + var SpecialPropertyAssignmentKind; + (function (SpecialPropertyAssignmentKind) { + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ExportsProperty"] = 1] = "ExportsProperty"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ModuleExports"] = 2] = "ModuleExports"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["Property"] = 5] = "Property"; + })(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); var DiagnosticCategory; (function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; @@ -66,6 +742,179 @@ var ts; ModuleKind[ModuleKind["System"] = 4] = "System"; ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015"; })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {})); + var JsxEmit; + (function (JsxEmit) { + JsxEmit[JsxEmit["None"] = 0] = "None"; + JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve"; + JsxEmit[JsxEmit["React"] = 2] = "React"; + JsxEmit[JsxEmit["ReactNative"] = 3] = "ReactNative"; + })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); + var NewLineKind; + (function (NewLineKind) { + NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed"; + NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed"; + })(NewLineKind = ts.NewLineKind || (ts.NewLineKind = {})); + var ScriptKind; + (function (ScriptKind) { + ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown"; + ScriptKind[ScriptKind["JS"] = 1] = "JS"; + ScriptKind[ScriptKind["JSX"] = 2] = "JSX"; + ScriptKind[ScriptKind["TS"] = 3] = "TS"; + ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; + ScriptKind[ScriptKind["External"] = 5] = "External"; + })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {})); + var ScriptTarget; + (function (ScriptTarget) { + ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; + ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; + ScriptTarget[ScriptTarget["ES2015"] = 2] = "ES2015"; + ScriptTarget[ScriptTarget["ES2016"] = 3] = "ES2016"; + ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017"; + ScriptTarget[ScriptTarget["ESNext"] = 5] = "ESNext"; + ScriptTarget[ScriptTarget["Latest"] = 5] = "Latest"; + })(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {})); + var LanguageVariant; + (function (LanguageVariant) { + LanguageVariant[LanguageVariant["Standard"] = 0] = "Standard"; + LanguageVariant[LanguageVariant["JSX"] = 1] = "JSX"; + })(LanguageVariant = ts.LanguageVariant || (ts.LanguageVariant = {})); + var DiagnosticStyle; + (function (DiagnosticStyle) { + DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple"; + DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty"; + })(DiagnosticStyle = ts.DiagnosticStyle || (ts.DiagnosticStyle = {})); + var WatchDirectoryFlags; + (function (WatchDirectoryFlags) { + WatchDirectoryFlags[WatchDirectoryFlags["None"] = 0] = "None"; + WatchDirectoryFlags[WatchDirectoryFlags["Recursive"] = 1] = "Recursive"; + })(WatchDirectoryFlags = ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {})); + var CharacterCodes; + (function (CharacterCodes) { + CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; + CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; + CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; + CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; + CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator"; + CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator"; + CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine"; + CharacterCodes[CharacterCodes["space"] = 32] = "space"; + CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace"; + CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad"; + CharacterCodes[CharacterCodes["emQuad"] = 8193] = "emQuad"; + CharacterCodes[CharacterCodes["enSpace"] = 8194] = "enSpace"; + CharacterCodes[CharacterCodes["emSpace"] = 8195] = "emSpace"; + CharacterCodes[CharacterCodes["threePerEmSpace"] = 8196] = "threePerEmSpace"; + CharacterCodes[CharacterCodes["fourPerEmSpace"] = 8197] = "fourPerEmSpace"; + CharacterCodes[CharacterCodes["sixPerEmSpace"] = 8198] = "sixPerEmSpace"; + CharacterCodes[CharacterCodes["figureSpace"] = 8199] = "figureSpace"; + CharacterCodes[CharacterCodes["punctuationSpace"] = 8200] = "punctuationSpace"; + CharacterCodes[CharacterCodes["thinSpace"] = 8201] = "thinSpace"; + CharacterCodes[CharacterCodes["hairSpace"] = 8202] = "hairSpace"; + CharacterCodes[CharacterCodes["zeroWidthSpace"] = 8203] = "zeroWidthSpace"; + CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace"; + CharacterCodes[CharacterCodes["ideographicSpace"] = 12288] = "ideographicSpace"; + CharacterCodes[CharacterCodes["mathematicalSpace"] = 8287] = "mathematicalSpace"; + CharacterCodes[CharacterCodes["ogham"] = 5760] = "ogham"; + CharacterCodes[CharacterCodes["_"] = 95] = "_"; + CharacterCodes[CharacterCodes["$"] = 36] = "$"; + CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; + CharacterCodes[CharacterCodes["_1"] = 49] = "_1"; + CharacterCodes[CharacterCodes["_2"] = 50] = "_2"; + CharacterCodes[CharacterCodes["_3"] = 51] = "_3"; + CharacterCodes[CharacterCodes["_4"] = 52] = "_4"; + CharacterCodes[CharacterCodes["_5"] = 53] = "_5"; + CharacterCodes[CharacterCodes["_6"] = 54] = "_6"; + CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; + CharacterCodes[CharacterCodes["_8"] = 56] = "_8"; + CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; + CharacterCodes[CharacterCodes["a"] = 97] = "a"; + CharacterCodes[CharacterCodes["b"] = 98] = "b"; + CharacterCodes[CharacterCodes["c"] = 99] = "c"; + CharacterCodes[CharacterCodes["d"] = 100] = "d"; + CharacterCodes[CharacterCodes["e"] = 101] = "e"; + CharacterCodes[CharacterCodes["f"] = 102] = "f"; + CharacterCodes[CharacterCodes["g"] = 103] = "g"; + CharacterCodes[CharacterCodes["h"] = 104] = "h"; + CharacterCodes[CharacterCodes["i"] = 105] = "i"; + CharacterCodes[CharacterCodes["j"] = 106] = "j"; + CharacterCodes[CharacterCodes["k"] = 107] = "k"; + CharacterCodes[CharacterCodes["l"] = 108] = "l"; + CharacterCodes[CharacterCodes["m"] = 109] = "m"; + CharacterCodes[CharacterCodes["n"] = 110] = "n"; + CharacterCodes[CharacterCodes["o"] = 111] = "o"; + CharacterCodes[CharacterCodes["p"] = 112] = "p"; + CharacterCodes[CharacterCodes["q"] = 113] = "q"; + CharacterCodes[CharacterCodes["r"] = 114] = "r"; + CharacterCodes[CharacterCodes["s"] = 115] = "s"; + CharacterCodes[CharacterCodes["t"] = 116] = "t"; + CharacterCodes[CharacterCodes["u"] = 117] = "u"; + CharacterCodes[CharacterCodes["v"] = 118] = "v"; + CharacterCodes[CharacterCodes["w"] = 119] = "w"; + CharacterCodes[CharacterCodes["x"] = 120] = "x"; + CharacterCodes[CharacterCodes["y"] = 121] = "y"; + CharacterCodes[CharacterCodes["z"] = 122] = "z"; + CharacterCodes[CharacterCodes["A"] = 65] = "A"; + CharacterCodes[CharacterCodes["B"] = 66] = "B"; + CharacterCodes[CharacterCodes["C"] = 67] = "C"; + CharacterCodes[CharacterCodes["D"] = 68] = "D"; + CharacterCodes[CharacterCodes["E"] = 69] = "E"; + CharacterCodes[CharacterCodes["F"] = 70] = "F"; + CharacterCodes[CharacterCodes["G"] = 71] = "G"; + CharacterCodes[CharacterCodes["H"] = 72] = "H"; + CharacterCodes[CharacterCodes["I"] = 73] = "I"; + CharacterCodes[CharacterCodes["J"] = 74] = "J"; + CharacterCodes[CharacterCodes["K"] = 75] = "K"; + CharacterCodes[CharacterCodes["L"] = 76] = "L"; + CharacterCodes[CharacterCodes["M"] = 77] = "M"; + CharacterCodes[CharacterCodes["N"] = 78] = "N"; + CharacterCodes[CharacterCodes["O"] = 79] = "O"; + CharacterCodes[CharacterCodes["P"] = 80] = "P"; + CharacterCodes[CharacterCodes["Q"] = 81] = "Q"; + CharacterCodes[CharacterCodes["R"] = 82] = "R"; + CharacterCodes[CharacterCodes["S"] = 83] = "S"; + CharacterCodes[CharacterCodes["T"] = 84] = "T"; + CharacterCodes[CharacterCodes["U"] = 85] = "U"; + CharacterCodes[CharacterCodes["V"] = 86] = "V"; + CharacterCodes[CharacterCodes["W"] = 87] = "W"; + CharacterCodes[CharacterCodes["X"] = 88] = "X"; + CharacterCodes[CharacterCodes["Y"] = 89] = "Y"; + CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; + CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; + CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; + CharacterCodes[CharacterCodes["at"] = 64] = "at"; + CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick"; + CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; + CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; + CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; + CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; + CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; + CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; + CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; + CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; + CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; + CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; + CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; + CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; + CharacterCodes[CharacterCodes["hash"] = 35] = "hash"; + CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; + CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; + CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; + CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; + CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; + CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; + CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; + CharacterCodes[CharacterCodes["question"] = 63] = "question"; + CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; + CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; + CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; + CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; + CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; + CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; + CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark"; + CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; + CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; + })(CharacterCodes = ts.CharacterCodes || (ts.CharacterCodes = {})); var Extension; (function (Extension) { Extension[Extension["Ts"] = 0] = "Ts"; @@ -75,6 +924,121 @@ var ts; Extension[Extension["Jsx"] = 4] = "Jsx"; Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension"; })(Extension = ts.Extension || (ts.Extension = {})); + var TransformFlags; + (function (TransformFlags) { + TransformFlags[TransformFlags["None"] = 0] = "None"; + TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript"; + TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript"; + TransformFlags[TransformFlags["ContainsJsx"] = 4] = "ContainsJsx"; + TransformFlags[TransformFlags["ContainsESNext"] = 8] = "ContainsESNext"; + TransformFlags[TransformFlags["ContainsES2017"] = 16] = "ContainsES2017"; + TransformFlags[TransformFlags["ContainsES2016"] = 32] = "ContainsES2016"; + TransformFlags[TransformFlags["ES2015"] = 64] = "ES2015"; + TransformFlags[TransformFlags["ContainsES2015"] = 128] = "ContainsES2015"; + TransformFlags[TransformFlags["Generator"] = 256] = "Generator"; + TransformFlags[TransformFlags["ContainsGenerator"] = 512] = "ContainsGenerator"; + TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment"; + TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment"; + TransformFlags[TransformFlags["ContainsDecorators"] = 4096] = "ContainsDecorators"; + TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 8192] = "ContainsPropertyInitializer"; + TransformFlags[TransformFlags["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis"; + TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 32768] = "ContainsCapturedLexicalThis"; + TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 65536] = "ContainsLexicalThisInComputedPropertyName"; + TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 131072] = "ContainsDefaultValueAssignments"; + TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 262144] = "ContainsParameterPropertyAssignments"; + TransformFlags[TransformFlags["ContainsSpread"] = 524288] = "ContainsSpread"; + TransformFlags[TransformFlags["ContainsObjectSpread"] = 1048576] = "ContainsObjectSpread"; + TransformFlags[TransformFlags["ContainsRest"] = 524288] = "ContainsRest"; + TransformFlags[TransformFlags["ContainsObjectRest"] = 1048576] = "ContainsObjectRest"; + TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName"; + TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding"; + TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern"; + TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield"; + TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion"; + TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags"; + TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript"; + TransformFlags[TransformFlags["AssertJsx"] = 4] = "AssertJsx"; + TransformFlags[TransformFlags["AssertESNext"] = 8] = "AssertESNext"; + TransformFlags[TransformFlags["AssertES2017"] = 16] = "AssertES2017"; + TransformFlags[TransformFlags["AssertES2016"] = 32] = "AssertES2016"; + TransformFlags[TransformFlags["AssertES2015"] = 192] = "AssertES2015"; + TransformFlags[TransformFlags["AssertGenerator"] = 768] = "AssertGenerator"; + TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 3072] = "AssertDestructuringAssignment"; + TransformFlags[TransformFlags["NodeExcludes"] = 536872257] = "NodeExcludes"; + TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 601249089] = "ArrowFunctionExcludes"; + TransformFlags[TransformFlags["FunctionExcludes"] = 601281857] = "FunctionExcludes"; + TransformFlags[TransformFlags["ConstructorExcludes"] = 601015617] = "ConstructorExcludes"; + TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 601015617] = "MethodOrAccessorExcludes"; + TransformFlags[TransformFlags["ClassExcludes"] = 539358529] = "ClassExcludes"; + TransformFlags[TransformFlags["ModuleExcludes"] = 574674241] = "ModuleExcludes"; + TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes"; + TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 540087617] = "ObjectLiteralExcludes"; + TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537396545] = "ArrayLiteralOrCallOrNewExcludes"; + TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 546309441] = "VariableDeclarationListExcludes"; + TransformFlags[TransformFlags["ParameterExcludes"] = 536872257] = "ParameterExcludes"; + TransformFlags[TransformFlags["CatchClauseExcludes"] = 537920833] = "CatchClauseExcludes"; + TransformFlags[TransformFlags["BindingPatternExcludes"] = 537396545] = "BindingPatternExcludes"; + TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask"; + TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask"; + })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); + var EmitFlags; + (function (EmitFlags) { + EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine"; + EmitFlags[EmitFlags["AdviseOnEmitNode"] = 2] = "AdviseOnEmitNode"; + EmitFlags[EmitFlags["NoSubstitution"] = 4] = "NoSubstitution"; + EmitFlags[EmitFlags["CapturesThis"] = 8] = "CapturesThis"; + EmitFlags[EmitFlags["NoLeadingSourceMap"] = 16] = "NoLeadingSourceMap"; + EmitFlags[EmitFlags["NoTrailingSourceMap"] = 32] = "NoTrailingSourceMap"; + EmitFlags[EmitFlags["NoSourceMap"] = 48] = "NoSourceMap"; + EmitFlags[EmitFlags["NoNestedSourceMaps"] = 64] = "NoNestedSourceMaps"; + EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 128] = "NoTokenLeadingSourceMaps"; + EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 256] = "NoTokenTrailingSourceMaps"; + EmitFlags[EmitFlags["NoTokenSourceMaps"] = 384] = "NoTokenSourceMaps"; + EmitFlags[EmitFlags["NoLeadingComments"] = 512] = "NoLeadingComments"; + EmitFlags[EmitFlags["NoTrailingComments"] = 1024] = "NoTrailingComments"; + EmitFlags[EmitFlags["NoComments"] = 1536] = "NoComments"; + EmitFlags[EmitFlags["NoNestedComments"] = 2048] = "NoNestedComments"; + EmitFlags[EmitFlags["HelperName"] = 4096] = "HelperName"; + EmitFlags[EmitFlags["ExportName"] = 8192] = "ExportName"; + EmitFlags[EmitFlags["LocalName"] = 16384] = "LocalName"; + EmitFlags[EmitFlags["Indented"] = 32768] = "Indented"; + EmitFlags[EmitFlags["NoIndentation"] = 65536] = "NoIndentation"; + EmitFlags[EmitFlags["AsyncFunctionBody"] = 131072] = "AsyncFunctionBody"; + EmitFlags[EmitFlags["ReuseTempVariableScope"] = 262144] = "ReuseTempVariableScope"; + EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue"; + EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting"; + EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker"; + EmitFlags[EmitFlags["Iterator"] = 4194304] = "Iterator"; + })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); + var ExternalEmitHelpers; + (function (ExternalEmitHelpers) { + ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends"; + ExternalEmitHelpers[ExternalEmitHelpers["Assign"] = 2] = "Assign"; + ExternalEmitHelpers[ExternalEmitHelpers["Rest"] = 4] = "Rest"; + ExternalEmitHelpers[ExternalEmitHelpers["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers[ExternalEmitHelpers["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers[ExternalEmitHelpers["Param"] = 32] = "Param"; + ExternalEmitHelpers[ExternalEmitHelpers["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers[ExternalEmitHelpers["Generator"] = 128] = "Generator"; + ExternalEmitHelpers[ExternalEmitHelpers["Values"] = 256] = "Values"; + ExternalEmitHelpers[ExternalEmitHelpers["Read"] = 512] = "Read"; + ExternalEmitHelpers[ExternalEmitHelpers["Spread"] = 1024] = "Spread"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncGenerator"] = 2048] = "AsyncGenerator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncDelegator"] = 4096] = "AsyncDelegator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncValues"] = 8192] = "AsyncValues"; + ExternalEmitHelpers[ExternalEmitHelpers["ForOfIncludes"] = 256] = "ForOfIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["ForAwaitOfIncludes"] = 8192] = "ForAwaitOfIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["SpreadIncludes"] = 1536] = "SpreadIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 8192] = "LastEmitHelper"; + })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); + var EmitHint; + (function (EmitHint) { + EmitHint[EmitHint["SourceFile"] = 0] = "SourceFile"; + EmitHint[EmitHint["Expression"] = 1] = "Expression"; + EmitHint[EmitHint["IdentifierName"] = 2] = "IdentifierName"; + EmitHint[EmitHint["Unspecified"] = 3] = "Unspecified"; + })(EmitHint = ts.EmitHint || (ts.EmitHint = {})); })(ts || (ts = {})); var ts; (function (ts) { @@ -93,32 +1057,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -137,22 +1101,102 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.2.0-dev.20161127"; + ts.version = "2.3.0-dev.20170419"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + var Ternary; + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(Ternary = ts.Ternary || (ts.Ternary = {})); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -165,32 +1209,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -204,9 +1243,19 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + var Comparison; + (function (Comparison) { + Comparison[Comparison["LessThan"] = -1] = "LessThan"; + Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; + Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; + })(Comparison = ts.Comparison || (ts.Comparison = {})); + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -216,6 +1265,20 @@ var ts; return undefined; } ts.forEach = forEach; + function findAncestor(node, callback) { + while (node) { + var result = callback(node); + if (result === "quit") { + return undefined; + } + else if (result) { + return node; + } + node = node.parent; + } + return undefined; + } + ts.findAncestor = findAncestor; function zipWith(arrayA, arrayB, callback) { Debug.assert(arrayA.length === arrayB.length); for (var i = 0; i < arrayA.length; i++) { @@ -225,7 +1288,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -235,7 +1298,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -244,8 +1307,17 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -268,7 +1340,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -278,7 +1350,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -465,21 +1537,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -763,38 +1832,55 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator, map) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(map ? map(value) : value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function convertToArray(iterator, f) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(f(value)); } - return false; + return result; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.convertToArray = convertToArray; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } + } + return undefined; + var _b; } - ts.appendProperty = appendProperty; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); + } + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -802,31 +1888,14 @@ var ts; } for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { var arg = args_1[_a]; - for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) { - var p = _c[_b]; - t[p] = arg[p]; - } + for (var p in arg) + if (hasProperty(arg, p)) { + t[p] = arg[p]; + } } return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -851,23 +1920,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -894,27 +1954,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -990,6 +2055,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -1091,8 +2157,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1474,36 +2542,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1573,6 +2631,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1585,34 +2644,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } + } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1628,14 +2701,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -1673,8 +2746,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = allSupportedExtensions.slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (extensions.indexOf(extInfo.extension) === -1) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1685,11 +2769,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1698,33 +2782,40 @@ var ts; return false; } ts.isSupportedSourceFileName = isSupportedSourceFileName; + var ExtensionPriority; + (function (ExtensionPriority) { + ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles"; + ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles"; + ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest"; + ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest"; + })(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {})); function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--) { if (fileExtensionIs(path, supportedExtensions[i])) { - return adjustExtensionPriority(i); + return adjustExtensionPriority(i, supportedExtensions); } } return 0; } ts.getExtensionPriority = getExtensionPriority; - function adjustExtensionPriority(extensionPriority) { + function adjustExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 0; } - else if (extensionPriority < 5) { + else if (extensionPriority < supportedExtensions.length) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.adjustExtensionPriority = adjustExtensionPriority; - function getNextLowestExtensionPriority(extensionPriority) { + function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority; @@ -1782,6 +2873,13 @@ var ts; getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } }; + var AssertionLevel; + (function (AssertionLevel) { + AssertionLevel[AssertionLevel["None"] = 0] = "None"; + AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; + AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; + AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; + })(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {})); var Debug; (function (Debug) { Debug.currentAssertionLevel = 0; @@ -1933,136 +3031,29 @@ var ts; } } ts.tryGetExtensionFromPath = tryGetExtensionFromPath; + function isCheckJsEnabledForFile(sourceFile, compilerOptions) { + return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; + } + ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile; })(ts || (ts = {})); var ts; (function (ts) { - ts.sys = (function () { - function getWScriptSystem() { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - var shell = new ActiveXObject("WScript.Shell"); - var fileStream = new ActiveXObject("ADODB.Stream"); - fileStream.Type = 2; - var binaryStream = new ActiveXObject("ADODB.Stream"); - binaryStream.Type = 1; - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); - } - function readFile(fileName, encoding) { - if (!fso.FileExists(fileName)) { - return undefined; - } - fileStream.Open(); - try { - if (encoding) { - fileStream.Charset = encoding; - fileStream.LoadFromFile(fileName); - } - else { - fileStream.Charset = "x-ansi"; - fileStream.LoadFromFile(fileName); - var bom = fileStream.ReadText(2) || ""; - fileStream.Position = 0; - fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; - } - return fileStream.ReadText(); - } - catch (e) { - throw e; - } - finally { - fileStream.Close(); - } - } - function writeFile(fileName, data, writeByteOrderMark) { - fileStream.Open(); - binaryStream.Open(); - try { - fileStream.Charset = "utf-8"; - fileStream.WriteText(data); - if (writeByteOrderMark) { - fileStream.Position = 0; - } - else { - fileStream.Position = 3; - } - fileStream.CopyTo(binaryStream); - binaryStream.SaveToFile(fileName, 2); - } - finally { - binaryStream.Close(); - fileStream.Close(); - } - } - function getNames(collection) { - var result = []; - for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { - result.push(e.item().Name); - } - return result.sort(); - } - function getDirectories(path) { - var folder = fso.GetFolder(path); - return getNames(folder.subfolders); - } - function getAccessibleFileSystemEntries(path) { - try { - var folder = fso.GetFolder(path || "."); - var files = getNames(folder.files); - var directories = getNames(folder.subfolders); - return { files: files, directories: directories }; - } - catch (e) { - return { files: [], directories: [] }; - } - } - function readDirectory(path, extensions, excludes, includes) { - return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries); - } - var wscriptSystem = { - args: args, - newLine: "\r\n", - useCaseSensitiveFileNames: false, - write: function (s) { - WScript.StdOut.Write(s); - }, - readFile: readFile, - writeFile: writeFile, - resolvePath: function (path) { - return fso.GetAbsolutePathName(path); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - createDirectory: function (directoryName) { - if (!wscriptSystem.directoryExists(directoryName)) { - fso.CreateFolder(directoryName); - } - }, - getExecutingFilePath: function () { - return WScript.ScriptFullName; - }, - getCurrentDirectory: function () { - return shell.CurrentDirectory; - }, - getDirectories: getDirectories, - getEnvironmentVariable: function (name) { - return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%" + name + "%"); - }, - readDirectory: readDirectory, - exit: function (exitCode) { - try { - WScript.Quit(exitCode); - } - catch (e) { - } - } - }; - return wscriptSystem; + function getNodeMajorVersion() { + if (typeof process === "undefined") { + return undefined; + } + var version = process.version; + if (!version) { + return undefined; + } + var dot = version.indexOf("."); + if (dot === -1) { + return undefined; } + return parseInt(version.substring(1, dot)); + } + ts.getNodeMajorVersion = getNodeMajorVersion; + ts.sys = (function () { function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); @@ -2071,32 +3062,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2108,24 +3099,26 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } } var watchedFileSet = createWatchedFileSet(); - function isNode4OrLater() { - return parseInt(process.version.charAt(1)) >= 4; - } + var nodeVersion = getNodeMajorVersion(); + var isNode4OrLater = nodeVersion >= 4; function isFileSystemCaseSensitive() { if (platform === "win32" || platform === "win64") { return false; @@ -2182,10 +3175,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2206,6 +3199,11 @@ var ts; function readDirectory(path, extensions, excludes, includes) { return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries); } + var FileSystemEntryKind; + (function (FileSystemEntryKind) { + FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; + FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; + })(FileSystemEntryKind || (FileSystemEntryKind = {})); function fileSystemEntryExists(path, entryKind) { try { var stat = _fs.statSync(path); @@ -2262,7 +3260,7 @@ var ts; if (!directoryExists(directoryName)) { return noOpFileWatcher; } - if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } else { @@ -2272,7 +3270,6 @@ var ts; if (eventName === "rename") { callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } - ; }); }, resolvePath: function (path) { @@ -2389,9 +3386,6 @@ var ts; if (typeof ChakraHost !== "undefined") { sys = getChakraSystem(); } - else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - sys = getWScriptSystem(); - } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { sys = getNodeSystem(); } @@ -2460,11 +3454,11 @@ var ts; Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, - Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: "Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059", message: "Return expression in async function does not have a valid callable 'then' member." }, - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: "Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060", message: "Expression body for async arrow function does not have a valid callable 'then' member." }, + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", message: "The return type of an async function must either be a valid promise or must not contain a callable 'then' member." }, + A_promise_must_have_a_then_method: { code: 1059, category: ts.DiagnosticCategory.Error, key: "A_promise_must_have_a_then_method_1059", message: "A promise must have a 'then' method." }, + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: { code: 1060, category: ts.DiagnosticCategory.Error, key: "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", message: "The first parameter of the 'then' method of a promise must be a callback." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, @@ -2473,7 +3467,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2489,6 +3483,7 @@ var ts; Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, + A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: { code: 1103, category: ts.DiagnosticCategory.Error, key: "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", message: "A 'for-await-of' statement is only allowed within an async function or async generator." }, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, @@ -2496,7 +3491,7 @@ var ts; Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, + Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'." }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, @@ -2528,9 +3523,9 @@ var ts; Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", message: "Cannot use imports, exports, or module augmentations when '--module' is 'none'." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing." }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, + const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized." }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, @@ -2579,11 +3574,12 @@ var ts; Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode" }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." }, @@ -2629,6 +3625,11 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1320, category: ts.DiagnosticCategory.Error, key: "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", message: "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1321, category: ts.DiagnosticCategory.Error, key: "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", message: "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1322, category: ts.DiagnosticCategory.Error, key: "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", message: "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2672,6 +3673,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2682,19 +3684,20 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter." }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, + Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'." }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, @@ -2734,12 +3737,12 @@ var ts; The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class." }, The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, + Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'." }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, @@ -2748,19 +3751,19 @@ var ts; Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, + Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'." }, All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, + Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'." }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged." }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged." }, Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'" }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name." }, + Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'." }, Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'" }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, @@ -2769,18 +3772,20 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, + Class_0_used_before_its_declaration: { code: 2449, category: ts.DiagnosticCategory.Error, key: "Class_0_used_before_its_declaration_2449", message: "Class '{0}' used before its declaration." }, + Enum_0_used_before_its_declaration: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Enum_0_used_before_its_declaration_2450", message: "Enum '{0}' used before its declaration." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, + Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'." }, An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" }, + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern." }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, @@ -2801,13 +3806,13 @@ var ts; let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'." }, The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause" }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause." }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, @@ -2819,6 +3824,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, + Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: { code: 2504, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", message: "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator." }, A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, @@ -2833,6 +3839,7 @@ var ts; All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, + An_async_iterator_must_have_a_next_method: { code: 2519, category: ts.DiagnosticCategory.Error, key: "An_async_iterator_must_have_a_next_method_2519", message: "An async iterator must have a 'next()' method." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, @@ -2856,23 +3863,33 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, + Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." }, + The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: { code: 2547, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", message: "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property." }, + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2548, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", message: "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2549, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", message: "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: { code: 2550, category: ts.DiagnosticCategory.Error, key: "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", message: "Generic type instantiation is excessively deep and possibly infinite." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, + Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'." }, JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, - Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property." }, + The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property." }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, + Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React." }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, - Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element." }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'." }, super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, @@ -2904,7 +3921,6 @@ var ts; All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, - A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." }, An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, @@ -2913,9 +3929,17 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference." }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property." }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, + Required_type_parameters_may_not_follow_optional_type_parameters: { code: 2706, category: ts.DiagnosticCategory.Error, key: "Required_type_parameters_may_not_follow_optional_type_parameters_2706", message: "Required type parameters may not follow optional type parameters." }, + Generic_type_0_requires_between_1_and_2_type_arguments: { code: 2707, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_between_1_and_2_type_arguments_2707", message: "Generic type '{0}' requires between {1} and {2} type arguments." }, + Cannot_use_namespace_0_as_a_value: { code: 2708, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_value_2708", message: "Cannot use namespace '{0}' as a value." }, + Cannot_use_namespace_0_as_a_type: { code: 2709, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_type_2709", message: "Cannot use namespace '{0}' as a type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2926,8 +3950,8 @@ var ts; Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "'extends' clause of exported class '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "'extends' clause of exported interface '{0}' has or is using private name '{1}'." }, Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, @@ -2988,16 +4012,18 @@ var ts; Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced: { code: 4093, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced_4093", message: "'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", message: "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported_file_encoding_5013", message: "Unsupported file encoding." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}." }, Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}" }, + Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", message: "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, @@ -3006,12 +4032,12 @@ var ts; A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, - The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'." }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'." }, Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, - Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character." }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character." }, Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_should_be_an_array_5063", message: "Substitutions for pattern '{0}' should be an array." }, Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, @@ -3029,11 +4055,11 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'." }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3048,11 +4074,12 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -3074,17 +4101,18 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context (experimental)." }, Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'." }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", message: "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit" }, Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, @@ -3095,23 +4123,23 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, + package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, - Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, - Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, - Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, - Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'." }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'." }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'." }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'." }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'." }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed." }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, @@ -3121,32 +4149,67 @@ var ts; Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, - Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'." }, Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, - Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'." }, Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, - Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'." }, Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." }, - File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" }, + File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it." }, _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." }, Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" }, - No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" }, + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files." }, Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" }, + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file." }, Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, + Show_diagnostic_information: { code: 6149, category: ts.DiagnosticCategory.Message, key: "Show_diagnostic_information_6149", message: "Show diagnostic information." }, + Show_verbose_diagnostic_information: { code: 6150, category: ts.DiagnosticCategory.Message, key: "Show_verbose_diagnostic_information_6150", message: "Show verbose diagnostic information." }, + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: { code: 6151, category: ts.DiagnosticCategory.Message, key: "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", message: "Emit a single file with source maps instead of having a separate file." }, + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: { code: 6152, category: ts.DiagnosticCategory.Message, key: "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", message: "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set." }, + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: { code: 6153, category: ts.DiagnosticCategory.Message, key: "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", message: "Transpile each file as a separate module (similar to 'ts.transpileModule')." }, + Print_names_of_generated_files_part_of_the_compilation: { code: 6154, category: ts.DiagnosticCategory.Message, key: "Print_names_of_generated_files_part_of_the_compilation_6154", message: "Print names of generated files part of the compilation." }, + Print_names_of_files_part_of_the_compilation: { code: 6155, category: ts.DiagnosticCategory.Message, key: "Print_names_of_files_part_of_the_compilation_6155", message: "Print names of files part of the compilation." }, + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: { code: 6156, category: ts.DiagnosticCategory.Message, key: "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", message: "The locale used when displaying messages to the user (e.g. 'en-us')" }, + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: { code: 6157, category: ts.DiagnosticCategory.Message, key: "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", message: "Do not generate custom helper functions like '__extends' in compiled output." }, + Do_not_include_the_default_library_file_lib_d_ts: { code: 6158, category: ts.DiagnosticCategory.Message, key: "Do_not_include_the_default_library_file_lib_d_ts_6158", message: "Do not include the default library file (lib.d.ts)." }, + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: { code: 6159, category: ts.DiagnosticCategory.Message, key: "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", message: "Do not add triple-slash references or imported modules to the list of compiled files." }, + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: { code: 6160, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", message: "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files." }, + List_of_folders_to_include_type_definitions_from: { code: 6161, category: ts.DiagnosticCategory.Message, key: "List_of_folders_to_include_type_definitions_from_6161", message: "List of folders to include type definitions from." }, + Disable_size_limitations_on_JavaScript_projects: { code: 6162, category: ts.DiagnosticCategory.Message, key: "Disable_size_limitations_on_JavaScript_projects_6162", message: "Disable size limitations on JavaScript projects." }, + The_character_set_of_the_input_files: { code: 6163, category: ts.DiagnosticCategory.Message, key: "The_character_set_of_the_input_files_6163", message: "The character set of the input files." }, + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: { code: 6164, category: ts.DiagnosticCategory.Message, key: "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", message: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files." }, + Do_not_truncate_error_messages: { code: 6165, category: ts.DiagnosticCategory.Message, key: "Do_not_truncate_error_messages_6165", message: "Do not truncate error messages." }, + Output_directory_for_generated_declaration_files: { code: 6166, category: ts.DiagnosticCategory.Message, key: "Output_directory_for_generated_declaration_files_6166", message: "Output directory for generated declaration files." }, + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: { code: 6167, category: ts.DiagnosticCategory.Message, key: "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", message: "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'." }, + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: { code: 6168, category: ts.DiagnosticCategory.Message, key: "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", message: "List of root folders whose combined content represents the structure of the project at runtime." }, + Show_all_compiler_options: { code: 6169, category: ts.DiagnosticCategory.Message, key: "Show_all_compiler_options_6169", message: "Show all compiler options." }, + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: { code: 6170, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", message: "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file" }, + Command_line_Options: { code: 6171, category: ts.DiagnosticCategory.Message, key: "Command_line_Options_6171", message: "Command-line Options" }, + Basic_Options: { code: 6172, category: ts.DiagnosticCategory.Message, key: "Basic_Options_6172", message: "Basic Options" }, + Strict_Type_Checking_Options: { code: 6173, category: ts.DiagnosticCategory.Message, key: "Strict_Type_Checking_Options_6173", message: "Strict Type-Checking Options" }, + Module_Resolution_Options: { code: 6174, category: ts.DiagnosticCategory.Message, key: "Module_Resolution_Options_6174", message: "Module Resolution Options" }, + Source_Map_Options: { code: 6175, category: ts.DiagnosticCategory.Message, key: "Source_Map_Options_6175", message: "Source Map Options" }, + Additional_Checks: { code: 6176, category: ts.DiagnosticCategory.Message, key: "Additional_Checks_6176", message: "Additional Checks" }, + Experimental_Options: { code: 6177, category: ts.DiagnosticCategory.Message, key: "Experimental_Options_6177", message: "Experimental Options" }, + Advanced_Options: { code: 6178, category: ts.DiagnosticCategory.Message, key: "Advanced_Options_6178", message: "Advanced Options" }, + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: { code: 6179, category: ts.DiagnosticCategory.Message, key: "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", message: "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'." }, + Enable_all_strict_type_checking_options: { code: 6180, category: ts.DiagnosticCategory.Message, key: "Enable_all_strict_type_checking_options_6180", message: "Enable all strict type-checking options." }, + List_of_language_service_plugins: { code: 6181, category: ts.DiagnosticCategory.Message, key: "List_of_language_service_plugins_6181", message: "List of language service plugins." }, + Scoped_package_detected_looking_in_0: { code: 6182, category: ts.DiagnosticCategory.Message, key: "Scoped_package_detected_looking_in_0_6182", message: "Scoped package detected, looking in '{0}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3164,7 +4227,7 @@ var ts; _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists." }, Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, @@ -3188,7 +4251,7 @@ var ts; parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -3196,7382 +4259,6205 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'." }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: '{0}'." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig." }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, - Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, - Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, - Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}." }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}." }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." }, + Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." }, + Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'." }, + Disable_checking_for_this_file: { code: 90018, category: ts.DiagnosticCategory.Message, key: "Disable_checking_for_this_file_90018", message: "Disable checking for this file." }, + Ignore_this_error_message: { code: 90019, category: ts.DiagnosticCategory.Message, key: "Ignore_this_error_message_90019", message: "Ignore this error message." }, + Initialize_property_0_in_the_constructor: { code: 90020, category: ts.DiagnosticCategory.Message, key: "Initialize_property_0_in_the_constructor_90020", message: "Initialize property '{0}' in the constructor." }, + Initialize_static_property_0: { code: 90021, category: ts.DiagnosticCategory.Message, key: "Initialize_static_property_0_90021", message: "Initialize static property '{0}'." }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, + Report_errors_in_js_files: { code: 8019, category: ts.DiagnosticCategory.Message, key: "Report_errors_in_js_files_8019", message: "Report errors in .js files." }, }; })(ts || (ts = {})); var ts; (function (ts) { - function tokenIsIdentifierOrKeyword(token) { - return token >= 70; - } - ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ - "abstract": 116, - "any": 118, - "as": 117, - "boolean": 121, - "break": 71, - "case": 72, - "catch": 73, - "class": 74, - "continue": 76, - "const": 75, - "constructor": 122, - "debugger": 77, - "declare": 123, - "default": 78, - "delete": 79, - "do": 80, - "else": 81, - "enum": 82, - "export": 83, - "extends": 84, - "false": 85, - "finally": 86, - "for": 87, - "from": 138, - "function": 88, - "get": 124, - "if": 89, - "implements": 107, - "import": 90, - "in": 91, - "instanceof": 92, - "interface": 108, - "is": 125, - "keyof": 126, - "let": 109, - "module": 127, - "namespace": 128, - "never": 129, - "new": 93, - "null": 94, - "number": 132, - "package": 110, - "private": 111, - "protected": 112, - "public": 113, - "readonly": 130, - "require": 131, - "global": 139, - "return": 95, - "set": 133, - "static": 114, - "string": 134, - "super": 96, - "switch": 97, - "symbol": 135, - "this": 98, - "throw": 99, - "true": 100, - "try": 101, - "type": 136, - "typeof": 102, - "undefined": 137, - "var": 103, - "void": 104, - "while": 105, - "with": 106, - "yield": 115, - "async": 119, - "await": 120, - "of": 140, - "{": 16, - "}": 17, - "(": 18, - ")": 19, - "[": 20, - "]": 21, - ".": 22, - "...": 23, - ";": 24, - ",": 25, - "<": 26, - ">": 28, - "<=": 29, - ">=": 30, - "==": 31, - "!=": 32, - "===": 33, - "!==": 34, - "=>": 35, - "+": 36, - "-": 37, - "**": 39, - "*": 38, - "/": 40, - "%": 41, - "++": 42, - "--": 43, - "<<": 44, - ">": 45, - ">>>": 46, - "&": 47, - "|": 48, - "^": 49, - "!": 50, - "~": 51, - "&&": 52, - "||": 53, - "?": 54, - ":": 55, - "=": 57, - "+=": 58, - "-=": 59, - "*=": 60, - "**=": 61, - "/=": 62, - "%=": 63, - "<<=": 64, - ">>=": 65, - ">>>=": 66, - "&=": 67, - "|=": 68, - "^=": 69, - "@": 56, - }); - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - function lookupInUnicodeMap(code, map) { - if (code < map[0]) { - return false; - } - var lo = 0; - var hi = map.length; - var mid; - while (lo + 1 < hi) { - mid = lo + (hi - lo) / 2; - mid -= mid % 2; - if (map[mid] <= code && code <= map[mid + 1]) { - return true; - } - if (code < map[mid]) { - hi = mid; - } - else { - lo = mid + 2; - } - } - return false; - } - function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + function trace(host) { + host.trace(ts.formatMessage.apply(undefined, arguments)); } - ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; - function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); + ts.trace = trace; + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; } - function makeReverseMap(source) { - var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; + ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); + function resolvedTypeScriptOnly(resolved) { + if (!resolved) { + return undefined; } - return result; + ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); + return resolved.path; } - var tokenStrings = makeReverseMap(textToToken); - function tokenToString(t) { - return tokenStrings[t]; + function resolvedModuleFromResolved(_a, isExternalLibraryImport) { + var path = _a.path, extension = _a.extension; + return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; } - ts.tokenToString = tokenToString; - function stringToToken(s) { - return textToToken[s]; + function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations }; } - ts.stringToToken = stringToToken; - function computeLineStarts(text) { - var result = new Array(); - var pos = 0; - var lineStart = 0; - while (pos < text.length) { - var ch = text.charCodeAt(pos); - pos++; - switch (ch) { - case 13: - if (text.charCodeAt(pos) === 10) { - pos++; - } - case 10: - result.push(lineStart); - lineStart = pos; - break; - default: - if (ch > 127 && isLineBreak(ch)) { - result.push(lineStart); - lineStart = pos; - } - break; + function moduleHasNonRelativeName(moduleName) { + return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); + } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; + function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) { + var jsonContent = readJson(packageJsonPath, state.host); + return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); + function tryReadFromField(fieldName) { + if (!ts.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); + } + return; + } + var fileName = jsonContent[fieldName]; + if (typeof fileName !== "string") { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); + } + return; + } + var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); } + return path; } - result.push(lineStart); - return result; - } - ts.computeLineStarts = computeLineStarts; - function getPositionOfLineAndCharacter(sourceFile, line, character) { - return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); - } - ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; - function computePositionOfLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line >= 0 && line < lineStarts.length); - return lineStarts[line] + character; - } - ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; - function getLineStarts(sourceFile) { - return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } - ts.getLineStarts = getLineStarts; - function computeLineAndCharacterOfPosition(lineStarts, position) { - var lineNumber = ts.binarySearch(lineStarts, position); - if (lineNumber < 0) { - lineNumber = ~lineNumber - 1; - ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); + function readJson(path, host) { + try { + var jsonText = host.readFile(path); + return jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + return {}; } - return { - line: lineNumber, - character: position - lineStarts[lineNumber] - }; } - ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; - function getLineAndCharacterOfPosition(sourceFile, position) { - return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + function getEffectiveTypeRoots(options, host) { + if (options.typeRoots) { + return options.typeRoots; + } + var currentDirectory; + if (options.configFilePath) { + currentDirectory = ts.getDirectoryPath(options.configFilePath); + } + else if (host.getCurrentDirectory) { + currentDirectory = host.getCurrentDirectory(); + } + if (currentDirectory !== undefined) { + return getDefaultTypeRoots(currentDirectory, host); + } } - ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; - function isWhiteSpace(ch) { - return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); + ts.getEffectiveTypeRoots = getEffectiveTypeRoots; + function getDefaultTypeRoots(currentDirectory, host) { + if (!host.directoryExists) { + return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; + } + var typeRoots; + forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { + var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); + if (host.directoryExists(atTypes)) { + (typeRoots || (typeRoots = [])).push(atTypes); + } + return undefined; + }); + return typeRoots; } - ts.isWhiteSpace = isWhiteSpace; - function isWhiteSpaceSingleLine(ch) { - return ch === 32 || - ch === 9 || - ch === 11 || - ch === 12 || - ch === 160 || - ch === 133 || - ch === 5760 || - ch >= 8192 && ch <= 8203 || - ch === 8239 || - ch === 8287 || - ch === 12288 || - ch === 65279; - } - ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine; - function isLineBreak(ch) { - return ch === 10 || - ch === 13 || - ch === 8232 || - ch === 8233; - } - ts.isLineBreak = isLineBreak; - function isDigit(ch) { - return ch >= 48 && ch <= 57; - } - function isOctalDigit(ch) { - return ch >= 48 && ch <= 55; - } - ts.isOctalDigit = isOctalDigit; - function couldStartTrivia(text, pos) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13: - case 10: - case 9: - case 11: - case 12: - case 32: - case 47: - case 60: - case 61: - case 62: - return true; - case 35: - return pos === 0; - default: - return ch > 127; + var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + traceEnabled: traceEnabled + }; + var typeRoots = getEffectiveTypeRoots(options, host); + if (traceEnabled) { + if (containingFile === undefined) { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); + } + } + else { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); + } + } } - } - ts.couldStartTrivia = couldStartTrivia; - function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) { - if (stopAtComments === void 0) { stopAtComments = false; } - if (ts.positionIsSynthesized(pos)) { - return pos; + var failedLookupLocations = []; + var resolved = primaryLookup(); + var primary = true; + if (!resolved) { + resolved = secondaryLookup(); + primary = false; } - while (true) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13: - if (text.charCodeAt(pos + 1) === 10) { - pos++; - } - case 10: - pos++; - if (stopAfterLineBreak) { - return pos; - } - continue; - case 9: - case 11: - case 12: - case 32: - pos++; - continue; - case 47: - if (stopAtComments) { - break; - } - if (text.charCodeAt(pos + 1) === 47) { - pos += 2; - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - continue; - } - if (text.charCodeAt(pos + 1) === 42) { - pos += 2; - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { - pos += 2; - break; - } - pos++; - } - continue; - } - break; - case 60: - case 61: - case 62: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos); - continue; - } - break; - case 35: - if (pos === 0 && isShebangTrivia(text, pos)) { - pos = scanShebangTrivia(text, pos); - continue; - } - break; - default: - if (ch > 127 && (isWhiteSpace(ch))) { - pos++; - continue; - } - break; + var resolvedTypeReferenceDirective; + if (resolved) { + resolved = realpath(resolved, host, traceEnabled); + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary); } - return pos; + resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved }; } - } - ts.skipTrivia = skipTrivia; - var mergeConflictMarkerLength = "<<<<<<<".length; - function isConflictMarkerTrivia(text, pos) { - ts.Debug.assert(pos >= 0); - if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { - var ch = text.charCodeAt(pos); - if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { - if (text.charCodeAt(pos + i) !== ch) { - return false; + return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations }; + function primaryLookup() { + if (typeRoots && typeRoots.length) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); + } + return ts.forEach(typeRoots, function (typeRoot) { + var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); + }); + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } - return false; - } - function scanConflictMarkerTrivia(text, pos, error) { - if (error) { - error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); - } - var ch = text.charCodeAt(pos); - var len = text.length; - if (ch === 60 || ch === 62) { - while (pos < len && !isLineBreak(text.charCodeAt(pos))) { - pos++; + function secondaryLookup() { + var resolvedFile; + var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); + if (initialLocationForSecondaryLookup !== undefined) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); + if (!resolvedFile && traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + return resolvedFile; } - } - else { - ts.Debug.assert(ch === 61); - while (pos < len) { - var ch_1 = text.charCodeAt(pos); - if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) { - break; + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); } - pos++; } } - return pos; - } - var shebangTriviaRegex = /^#!.*/; - function isShebangTrivia(text, pos) { - ts.Debug.assert(pos === 0); - return shebangTriviaRegex.test(text); - } - function scanShebangTrivia(text, pos) { - var shebang = shebangTriviaRegex.exec(text)[0]; - pos = pos + shebang.length; - return pos; } - function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) { - var pendingPos; - var pendingEnd; - var pendingKind; - var pendingHasTrailingNewLine; - var hasPendingCommentRange = false; - var collecting = trailing || pos === 0; - var accumulator = initial; - scan: while (pos >= 0 && pos < text.length) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13: - if (text.charCodeAt(pos + 1) === 10) { - pos++; - } - case 10: - pos++; - if (trailing) { - break scan; - } - collecting = true; - if (hasPendingCommentRange) { - pendingHasTrailingNewLine = true; - } - continue; - case 9: - case 11: - case 12: - case 32: - pos++; - continue; - case 47: - var nextChar = text.charCodeAt(pos + 1); - var hasTrailingNewLine = false; - if (nextChar === 47 || nextChar === 42) { - var kind = nextChar === 47 ? 2 : 3; - var startPos = pos; - pos += 2; - if (nextChar === 47) { - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - hasTrailingNewLine = true; - break; - } - pos++; - } - } - else { - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { - pos += 2; - break; - } - pos++; - } - } - if (collecting) { - if (hasPendingCommentRange) { - accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); - if (!reduce && accumulator) { - return accumulator; - } - hasPendingCommentRange = false; + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function getAutomaticTypeDirectiveNames(options, host) { + if (options.types) { + return options.types; + } + var result = []; + if (host.directoryExists && host.getDirectories) { + var typeRoots = getEffectiveTypeRoots(options, host); + if (typeRoots) { + for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { + var root = typeRoots_1[_i]; + if (host.directoryExists(root)) { + for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { + var typeDirectivePath = _b[_a]; + var normalized = ts.normalizePath(typeDirectivePath); + var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); + var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; + if (!isNotNeededPackage) { + result.push(ts.getBaseFileName(normalized)); } - pendingPos = startPos; - pendingEnd = pos; - pendingKind = kind; - pendingHasTrailingNewLine = hasTrailingNewLine; - hasPendingCommentRange = true; - } - continue; - } - break scan; - default: - if (ch > 127 && (isWhiteSpace(ch))) { - if (hasPendingCommentRange && isLineBreak(ch)) { - pendingHasTrailingNewLine = true; } - pos++; - continue; } - break scan; + } } } - if (hasPendingCommentRange) { - accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); - } - return accumulator; - } - function forEachLeadingCommentRange(text, pos, cb, state) { - return iterateCommentRanges(false, text, pos, false, cb, state); - } - ts.forEachLeadingCommentRange = forEachLeadingCommentRange; - function forEachTrailingCommentRange(text, pos, cb, state) { - return iterateCommentRanges(false, text, pos, true, cb, state); - } - ts.forEachTrailingCommentRange = forEachTrailingCommentRange; - function reduceEachLeadingCommentRange(text, pos, cb, state, initial) { - return iterateCommentRanges(true, text, pos, false, cb, state, initial); - } - ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange; - function reduceEachTrailingCommentRange(text, pos, cb, state, initial) { - return iterateCommentRanges(true, text, pos, true, cb, state, initial); - } - ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange; - function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) { - if (!comments) { - comments = []; - } - comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); - return comments; - } - function getLeadingCommentRanges(text, pos) { - return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); - } - ts.getLeadingCommentRanges = getLeadingCommentRanges; - function getTrailingCommentRanges(text, pos) { - return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); - } - ts.getTrailingCommentRanges = getTrailingCommentRanges; - function getShebang(text) { - return shebangTriviaRegex.test(text) - ? shebangTriviaRegex.exec(text)[0] - : undefined; - } - ts.getShebang = getShebang; - function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); - } - ts.isIdentifierStart = isIdentifierStart; - function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return result; } - ts.isIdentifierPart = isIdentifierPart; - function isIdentifierText(name, languageVersion) { - if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { - return false; - } - for (var i = 1, n = name.length; i < n; i++) { - if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { - return false; + ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; } - } - return true; - } - ts.isIdentifierText = isIdentifierText; - function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { - if (languageVariant === void 0) { languageVariant = 0; } - var pos; - var end; - var startPos; - var tokenPos; - var token; - var tokenValue; - var precedingLineBreak; - var hasExtendedUnicodeEscape; - var tokenIsUnterminated; - setText(text, start, length); - return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 70 || token > 106; }, - isReservedWord: function () { return token >= 71 && token <= 106; }, - isUnterminated: function () { return tokenIsUnterminated; }, - reScanGreaterToken: reScanGreaterToken, - reScanSlashToken: reScanSlashToken, - reScanTemplateToken: reScanTemplateToken, - scanJsxIdentifier: scanJsxIdentifier, - scanJsxAttributeValue: scanJsxAttributeValue, - reScanJsxToken: reScanJsxToken, - scanJsxToken: scanJsxToken, - scanJSDocToken: scanJSDocToken, - scan: scan, - getText: getText, - setText: setText, - setScriptTarget: setScriptTarget, - setLanguageVariant: setLanguageVariant, - setOnError: setOnError, - setTextPos: setTextPos, - tryScan: tryScan, - lookAhead: lookAhead, - scanRange: scanRange, - }; - function error(message, length) { - if (onError) { - onError(message, length || 0); + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); + if (!perModuleNameCache) { + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); } + return perModuleNameCache; } - function scanNumber() { - var start = pos; - while (isDigit(text.charCodeAt(pos))) - pos++; - if (text.charCodeAt(pos) === 46) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); } - var end = pos; - if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { - pos++; - if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) - pos++; - if (isDigit(text.charCodeAt(pos))) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; - end = pos; + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { + return; } - else { - error(ts.Diagnostics.Digit_expected); + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + if (current === commonPrefix) { + break; + } } } - return "" + +(text.substring(start, end)); - } - function scanOctalDigits() { - var start = pos; - while (isOctalDigit(text.charCodeAt(pos))) { - pos++; + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); } - return +(text.substring(start, pos)); } - function scanExactNumberOfHexDigits(count) { - return scanHexDigits(count, false); + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - function scanMinimumNumberOfHexDigits(count) { - return scanHexDigits(count, true); + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache.get(moduleName); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } } - function scanHexDigits(minCount, scanAsManyAsPossible) { - var digits = 0; - var value = 0; - while (digits < minCount || scanAsManyAsPossible) { - var ch = text.charCodeAt(pos); - if (ch >= 48 && ch <= 57) { - value = value * 16 + ch - 48; - } - else if (ch >= 65 && ch <= 70) { - value = value * 16 + ch - 65 + 10; + else { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); } - else if (ch >= 97 && ch <= 102) { - value = value * 16 + ch - 97 + 10; + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); } - else { + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); break; + } + if (perFolderCache) { + perFolderCache.set(moduleName, result); + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); } - pos++; - digits++; } - if (digits < minCount) { - value = -1; + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); } - return value; } - function scanString(allowEscapes) { - if (allowEscapes === void 0) { allowEscapes = true; } - var quote = text.charCodeAt(pos); - pos++; - var result = ""; - var start = pos; - while (true) { - if (pos >= end) { - result += text.substring(start, pos); - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_string_literal); - break; - } - var ch = text.charCodeAt(pos); - if (ch === quote) { - result += text.substring(start, pos); - pos++; - break; - } - if (ch === 92 && allowEscapes) { - result += text.substring(start, pos); - result += scanEscapeSequence(); - start = pos; + return result; + } + ts.resolveModuleName = resolveModuleName; + function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { + if (moduleHasNonRelativeName(moduleName)) { + return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state); + } + else { + return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); + } + } + function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { continue; } - if (isLineBreak(ch)) { - result += text.substring(start, pos); - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_string_literal); - break; + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; } - pos++; } - return result; + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } } - function scanTemplateAndSetTokenValue() { - var startedWithBacktick = text.charCodeAt(pos) === 96; - pos++; - var start = pos; - var contents = ""; - var resultingToken; - while (true) { - if (pos >= end) { - contents += text.substring(start, pos); - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 12 : 15; - break; - } - var currChar = text.charCodeAt(pos); - if (currChar === 96) { - contents += text.substring(start, pos); - pos++; - resultingToken = startedWithBacktick ? 12 : 15; - break; + return undefined; + } + function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + var matchedPattern = undefined; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName); + } + if (matchedPattern) { + var matchedStar_1 = typeof matchedPattern === "string" ? undefined : ts.matchedText(matchedPattern, moduleName); + var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : ts.patternText(matchedPattern); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); + } + return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) { + var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); } - if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { - contents += text.substring(start, pos); - pos += 2; - resultingToken = startedWithBacktick ? 13 : 14; - break; + var tsExtension = ts.tryGetExtensionFromPath(candidate); + if (tsExtension !== undefined) { + var path_1 = tryFile(candidate, failedLookupLocations, false, state); + return path_1 && { path: path_1, extension: tsExtension }; } - if (currChar === 92) { - contents += text.substring(start, pos); - contents += scanEscapeSequence(); - start = pos; - continue; + return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + }); + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, false); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + function nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, jsOnly) { + if (jsOnly === void 0) { jsOnly = false; } + var containingDirectory = ts.getDirectoryPath(containingFile); + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; + return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); + } + return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; + function tryResolve(extensions) { + var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, true); }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); + if (resolved) { + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); + } + if (moduleHasNonRelativeName(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - if (currChar === 13) { - contents += text.substring(start, pos); - pos++; - if (pos < end && text.charCodeAt(pos) === 10) { - pos++; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state, true); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); + } + } + } + ts.nodeModuleNameResolverWorker = nodeModuleNameResolverWorker; + function realpath(path, host, traceEnabled) { + if (!host.realpath) { + return path; + } + var real = ts.normalizePath(host.realpath(path)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); + } + return real; + } + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); + } + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); } - contents += "\n"; - start = pos; - continue; + onlyRecordFailures = true; } - pos++; } - ts.Debug.assert(resultingToken !== undefined); - tokenValue = contents; - return resultingToken; + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } } - function scanEscapeSequence() { - pos++; - if (pos >= end) { - error(ts.Diagnostics.Unexpected_end_of_text); - return ""; + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; } - var ch = text.charCodeAt(pos); - pos++; - switch (ch) { - case 48: - return "\0"; - case 98: - return "\b"; - case 116: - return "\t"; - case 110: - return "\n"; - case 118: - return "\v"; - case 102: - return "\f"; - case 114: - return "\r"; - case 39: - return "\'"; - case 34: - return "\""; - case 117: - if (pos < end && text.charCodeAt(pos) === 123) { - hasExtendedUnicodeEscape = true; - pos++; - return scanExtendedUnicodeEscape(); - } - return scanHexadecimalEscape(4); - case 120: - return scanHexadecimalEscape(2); - case 13: - if (pos < end && text.charCodeAt(pos) === 10) { - pos++; - } - case 10: - case 8232: - case 8233: - return ""; - default: - return String.fromCharCode(ch); + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); + } + function directoryProbablyExists(directoryName, host) { + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state); + if (resolvedByAddingExtension) { + return resolvedByAddingExtension; + } + if (ts.hasJavaScriptFileExtension(candidate)) { + var extensionless = ts.removeFileExtension(candidate); + if (state.traceEnabled) { + var extension = candidate.substring(extensionless.length); + trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension); } + return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state); } - function scanHexadecimalEscape(numDigits) { - var escapedValue = scanExactNumberOfHexDigits(numDigits); - if (escapedValue >= 0) { - return String.fromCharCode(escapedValue); + } + function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } + switch (extensions) { + case Extensions.DtsOnly: + return tryExtension(".d.ts", ts.Extension.Dts); + case Extensions.TypeScript: + return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); + case Extensions.JavaScript: + return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); + } + function tryExtension(ext, extension) { + var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state); + return path && { path: path, extension: extension }; + } + } + function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } else { - error(ts.Diagnostics.Hexadecimal_digit_expected); - return ""; + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } } - function scanExtendedUnicodeEscape() { - var escapedValue = scanMinimumNumberOfHexDigits(1); - var isInvalidExtendedEscape = false; - if (escapedValue < 0) { - error(ts.Diagnostics.Hexadecimal_digit_expected); - isInvalidExtendedEscape = true; + failedLookupLocations.push(fileName); + return undefined; + } + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { considerPackageJson = true; } + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + if (considerPackageJson) { + var packageJsonPath = pathToPackageJson(candidate); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state); + if (fromPackageJson) { + return fromPackageJson; + } } - else if (escapedValue > 0x10FFFF) { - error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); - isInvalidExtendedEscape = true; + else { + if (directoryExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } + failedLookupLocations.push(packageJsonPath); } - if (pos >= end) { - error(ts.Diagnostics.Unexpected_end_of_text); - isInvalidExtendedEscape = true; + } + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state); + if (!file) { + return undefined; + } + var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); + var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); + if (fromFile) { + var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + if (resolved) { + return resolved; } - else if (text.charCodeAt(pos) === 125) { - pos++; + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); } - else { - error(ts.Diagnostics.Unterminated_Unicode_escape_sequence); - isInvalidExtendedEscape = true; + } + var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; + return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, false); + } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } + } + function pathToPackageJson(directory) { + return ts.combinePaths(directory, "package.json"); + } + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || + loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + } + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); + } + function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); + } + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); + return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { + if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } - if (isInvalidExtendedEscape) { - return ""; + }); + } + function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + if (typesOnly === void 0) { typesOnly = false; } + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); + if (packageResult) { + return packageResult; + } + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; } - return utf16EncodeAsString(escapedValue); + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); } - function utf16EncodeAsString(codePoint) { - ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF); - if (codePoint <= 65535) { - return String.fromCharCode(codePoint); + } + function mangleScopedPackage(moduleName, state) { + if (ts.startsWith(moduleName, "@")) { + var replaceSlash = moduleName.replace(ts.directorySeparator, "__"); + if (replaceSlash !== moduleName) { + var mangled = replaceSlash.slice(1); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; } - var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800; - var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00; - return String.fromCharCode(codeUnit1, codeUnit2); } - function peekUnicodeEscape() { - if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) { - var start_1 = pos; - pos += 2; - var value = scanExactNumberOfHexDigits(4); - pos = start_1; - return value; + return moduleName; + } + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } - return -1; + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; } - function scanIdentifierParts() { - var result = ""; - var start = pos; - while (pos < end) { - var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch, languageVersion)) { - pos++; - } - else if (ch === 92) { - ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { - break; + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var failedLookupLocations = []; + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); + function tryResolve(extensions) { + var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); + if (resolvedUsingSettings) { + return { value: resolvedUsingSettings }; + } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); + if (moduleHasNonRelativeName(moduleName)) { + var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; } - result += text.substring(start, pos); - result += String.fromCharCode(ch); - pos += 6; - start = pos; + var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); + }); + if (resolved_3) { + return resolved_3; } - else { - break; + if (extensions === Extensions.TypeScript) { + return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } - result += text.substring(start, pos); - return result; + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); + } } - function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { - var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; - } + } + ts.classicNameResolver = classicNameResolver; + function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache); + } + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var failedLookupLocations = []; + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); + return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); + } + ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } + function forEachAncestorDirectory(directory, callback) { + while (true) { + var result = callback(directory); + if (result !== undefined) { + return result; } - return token = 70; + var parentPath = ts.getDirectoryPath(directory); + if (parentPath === directory) { + return undefined; + } + directory = parentPath; } - function scanBinaryOrOctalDigits(base) { - ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8"); - var value = 0; - var numberOfDigits = 0; - while (true) { - var ch = text.charCodeAt(pos); - var valueOfCh = ch - 48; - if (!isDigit(ch) || valueOfCh >= base) { - break; + } +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.externalHelpersModuleNameText = "tslib"; + function getDeclarationOfKind(symbol, kind) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { + var declaration = declarations_1[_i]; + if (declaration.kind === kind) { + return declaration; } - value = value * base + valueOfCh; - pos++; - numberOfDigits++; - } - if (numberOfDigits === 0) { - return -1; } - return value; } - function scan() { - startPos = pos; - hasExtendedUnicodeEscape = false; - precedingLineBreak = false; - tokenIsUnterminated = false; - while (true) { - tokenPos = pos; - if (pos >= end) { - return token = 1; - } - var ch = text.charCodeAt(pos); - if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { - pos = scanShebangTrivia(text, pos); - if (skipTrivia) { - continue; - } - else { - return token = 6; - } - } - switch (ch) { - case 10: - case 13: - precedingLineBreak = true; - if (skipTrivia) { - pos++; - continue; - } - else { - if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) { - pos += 2; - } - else { - pos++; - } - return token = 4; - } - case 9: - case 11: - case 12: - case 32: - if (skipTrivia) { - pos++; - continue; - } - else { - while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { - pos++; - } - return token = 5; - } - case 33: - if (text.charCodeAt(pos + 1) === 61) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 34; - } - return pos += 2, token = 32; - } - pos++; - return token = 50; - case 34: - case 39: - tokenValue = scanString(); - return token = 9; - case 96: - return token = scanTemplateAndSetTokenValue(); - case 37: - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 63; - } - pos++; - return token = 41; - case 38: - if (text.charCodeAt(pos + 1) === 38) { - return pos += 2, token = 52; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 67; - } - pos++; - return token = 47; - case 40: - pos++; - return token = 18; - case 41: - pos++; - return token = 19; - case 42: - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 60; - } - if (text.charCodeAt(pos + 1) === 42) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 61; - } - return pos += 2, token = 39; - } - pos++; - return token = 38; - case 43: - if (text.charCodeAt(pos + 1) === 43) { - return pos += 2, token = 42; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 58; - } - pos++; - return token = 36; - case 44: - pos++; - return token = 25; - case 45: - if (text.charCodeAt(pos + 1) === 45) { - return pos += 2, token = 43; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 59; - } - pos++; - return token = 37; - case 46: - if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = scanNumber(); - return token = 8; - } - if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { - return pos += 3, token = 23; - } - pos++; - return token = 22; - case 47: - if (text.charCodeAt(pos + 1) === 47) { - pos += 2; - while (pos < end) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - if (skipTrivia) { - continue; - } - else { - return token = 2; - } - } - if (text.charCodeAt(pos + 1) === 42) { - pos += 2; - var commentClosed = false; - while (pos < end) { - var ch_2 = text.charCodeAt(pos); - if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) { - pos += 2; - commentClosed = true; - break; - } - if (isLineBreak(ch_2)) { - precedingLineBreak = true; - } - pos++; - } - if (!commentClosed) { - error(ts.Diagnostics.Asterisk_Slash_expected); - } - if (skipTrivia) { - continue; - } - else { - tokenIsUnterminated = !commentClosed; - return token = 3; - } - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 62; - } - pos++; - return token = 40; - case 48: - if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { - pos += 2; - var value = scanMinimumNumberOfHexDigits(1); - if (value < 0) { - error(ts.Diagnostics.Hexadecimal_digit_expected); - value = 0; - } - tokenValue = "" + value; - return token = 8; - } - else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { - pos += 2; - var value = scanBinaryOrOctalDigits(2); - if (value < 0) { - error(ts.Diagnostics.Binary_digit_expected); - value = 0; - } - tokenValue = "" + value; - return token = 8; - } - else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { - pos += 2; - var value = scanBinaryOrOctalDigits(8); - if (value < 0) { - error(ts.Diagnostics.Octal_digit_expected); - value = 0; - } - tokenValue = "" + value; - return token = 8; - } - if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanOctalDigits(); - return token = 8; - } - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - tokenValue = scanNumber(); - return token = 8; - case 58: - pos++; - return token = 55; - case 59: - pos++; - return token = 24; - case 60: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - if (skipTrivia) { - continue; - } - else { - return token = 7; - } - } - if (text.charCodeAt(pos + 1) === 60) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 64; - } - return pos += 2, token = 44; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 29; - } - if (languageVariant === 1 && - text.charCodeAt(pos + 1) === 47 && - text.charCodeAt(pos + 2) !== 42) { - return pos += 2, token = 27; - } - pos++; - return token = 26; - case 61: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - if (skipTrivia) { - continue; - } - else { - return token = 7; - } - } - if (text.charCodeAt(pos + 1) === 61) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 33; - } - return pos += 2, token = 31; - } - if (text.charCodeAt(pos + 1) === 62) { - return pos += 2, token = 35; - } - pos++; - return token = 57; - case 62: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - if (skipTrivia) { - continue; - } - else { - return token = 7; - } - } - pos++; - return token = 28; - case 63: - pos++; - return token = 54; - case 91: - pos++; - return token = 20; - case 93: - pos++; - return token = 21; - case 94: - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 69; - } - pos++; - return token = 49; - case 123: - pos++; - return token = 16; - case 124: - if (text.charCodeAt(pos + 1) === 124) { - return pos += 2, token = 53; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 68; - } - pos++; - return token = 48; - case 125: - pos++; - return token = 17; - case 126: - pos++; - return token = 51; - case 64: - pos++; - return token = 56; - case 92: - var cookedChar = peekUnicodeEscape(); - if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { - pos += 6; - tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); - return token = getIdentifierToken(); - } - error(ts.Diagnostics.Invalid_character); - pos++; - return token = 0; - default: - if (isIdentifierStart(ch, languageVersion)) { - pos++; - while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) - pos++; - tokenValue = text.substring(tokenPos, pos); - if (ch === 92) { - tokenValue += scanIdentifierParts(); - } - return token = getIdentifierToken(); - } - else if (isWhiteSpaceSingleLine(ch)) { - pos++; - continue; - } - else if (isLineBreak(ch)) { - precedingLineBreak = true; - pos++; - continue; - } - error(ts.Diagnostics.Invalid_character); - pos++; - return token = 0; + return undefined; + } + ts.getDeclarationOfKind = getDeclarationOfKind; + function findDeclaration(symbol, predicate) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + if (predicate(declaration)) { + return declaration; } } } - function reScanGreaterToken() { - if (token === 28) { - if (text.charCodeAt(pos) === 62) { - if (text.charCodeAt(pos + 1) === 62) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 66; - } - return pos += 2, token = 46; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 65; - } - pos++; - return token = 45; - } - if (text.charCodeAt(pos) === 61) { - pos++; - return token = 30; - } - } - return token; + return undefined; + } + ts.findDeclaration = findDeclaration; + var stringWriters = []; + function getSingleLineStringWriter() { + if (stringWriters.length === 0) { + var str_1 = ""; + var writeText = function (text) { return str_1 += text; }; + return { + string: function () { return str_1; }, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeParameter: writeText, + writeProperty: writeText, + writeSymbol: writeText, + writeLine: function () { return str_1 += " "; }, + increaseIndent: ts.noop, + decreaseIndent: ts.noop, + clear: function () { return str_1 = ""; }, + trackSymbol: ts.noop, + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop + }; } - function reScanSlashToken() { - if (token === 40 || token === 62) { - var p = tokenPos + 1; - var inEscape = false; - var inCharacterClass = false; - while (true) { - if (p >= end) { - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_regular_expression_literal); - break; - } - var ch = text.charCodeAt(p); - if (isLineBreak(ch)) { - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_regular_expression_literal); - break; - } - if (inEscape) { - inEscape = false; - } - else if (ch === 47 && !inCharacterClass) { - p++; - break; - } - else if (ch === 91) { - inCharacterClass = true; - } - else if (ch === 92) { - inEscape = true; - } - else if (ch === 93) { - inCharacterClass = false; - } - p++; - } - while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { - p++; - } - pos = p; - tokenValue = text.substring(tokenPos, pos); - token = 11; - } - return token; + return stringWriters.pop(); + } + ts.getSingleLineStringWriter = getSingleLineStringWriter; + function releaseStringWriter(writer) { + writer.clear(); + stringWriters.push(writer); + } + ts.releaseStringWriter = releaseStringWriter; + function getFullWidth(node) { + return node.end - node.pos; + } + ts.getFullWidth = getFullWidth; + function hasResolvedModule(sourceFile, moduleNameText) { + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); + } + ts.hasResolvedModule = hasResolvedModule; + function getResolvedModule(sourceFile, moduleNameText) { + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; + } + ts.getResolvedModule = getResolvedModule; + function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = ts.createMap(); } - function reScanTemplateToken() { - ts.Debug.assert(token === 17, "'reScanTemplateToken' should only be called on a '}'"); - pos = tokenPos; - return token = scanTemplateAndSetTokenValue(); + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); + } + ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - function reScanJsxToken() { - pos = tokenPos = startPos; - return token = scanJsxToken(); + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && + oldResolution.extension === newResolution.extension && + oldResolution.resolvedFileName === newResolution.resolvedFileName; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; } - function scanJsxToken() { - startPos = tokenPos = pos; - if (pos >= end) { - return token = 1; - } - var char = text.charCodeAt(pos); - if (char === 60) { - if (text.charCodeAt(pos + 1) === 47) { - pos += 2; - return token = 27; - } - pos++; - return token = 26; - } - if (char === 123) { - pos++; - return token = 16; - } - while (pos < end) { - pos++; - char = text.charCodeAt(pos); - if ((char === 123) || (char === 60)) { - break; - } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; } - return token = 10; } - function scanJsxIdentifier() { - if (tokenIsIdentifierOrKeyword(token)) { - var firstCharPosition = pos; - while (pos < end) { - var ch = text.charCodeAt(pos); - if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { - pos++; - } - else { - break; - } - } - tokenValue += text.substr(firstCharPosition, pos - firstCharPosition); + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; + function containsParseError(node) { + aggregateChildData(node); + return (node.flags & 131072) !== 0; + } + ts.containsParseError = containsParseError; + function aggregateChildData(node) { + if (!(node.flags & 262144)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) || + ts.forEachChild(node, containsParseError); + if (thisNodeOrAnySubNodesHasError) { + node.flags |= 131072; } - return token; + node.flags |= 262144; } - function scanJsxAttributeValue() { - startPos = pos; - switch (text.charCodeAt(pos)) { - case 34: - case 39: - tokenValue = scanString(false); - return token = 9; - default: - return scan(); - } + } + function getSourceFileOfNode(node) { + while (node && node.kind !== 264) { + node = node.parent; } - function scanJSDocToken() { - if (pos >= end) { - return token = 1; - } - startPos = pos; - tokenPos = pos; - var ch = text.charCodeAt(pos); - switch (ch) { - case 9: - case 11: - case 12: - case 32: - while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { - pos++; - } - return token = 5; - case 64: - pos++; - return token = 56; - case 10: - case 13: - pos++; - return token = 4; - case 42: - pos++; - return token = 38; - case 123: - pos++; - return token = 16; - case 125: - pos++; - return token = 17; - case 91: - pos++; - return token = 20; - case 93: - pos++; - return token = 21; - case 61: - pos++; - return token = 57; - case 44: - pos++; - return token = 25; - case 46: - pos++; - return token = 22; - } - if (isIdentifierStart(ch, 5)) { - pos++; - while (isIdentifierPart(text.charCodeAt(pos), 5) && pos < end) { - pos++; - } - return token = 70; - } - else { - return pos += 1, token = 0; - } + return node; + } + ts.getSourceFileOfNode = getSourceFileOfNode; + function isStatementWithLocals(node) { + switch (node.kind) { + case 206: + case 234: + case 213: + case 214: + case 215: + return true; } - function speculationHelper(callback, isLookahead) { - var savePos = pos; - var saveStartPos = startPos; - var saveTokenPos = tokenPos; - var saveToken = token; - var saveTokenValue = tokenValue; - var savePrecedingLineBreak = precedingLineBreak; - var result = callback(); - if (!result || isLookahead) { - pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; - token = saveToken; - tokenValue = saveTokenValue; - precedingLineBreak = savePrecedingLineBreak; + return false; + } + ts.isStatementWithLocals = isStatementWithLocals; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; + function nodePosToString(node) { + var file = getSourceFileOfNode(node); + var loc = ts.getLineAndCharacterOfPosition(file, node.pos); + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; + } + ts.nodePosToString = nodePosToString; + function getStartPosOfNode(node) { + return node.pos; + } + ts.getStartPosOfNode = getStartPosOfNode; + function isDefined(value) { + return value !== undefined; + } + ts.isDefined = isDefined; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + return sourceText.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; } - return result; + return pos; } - function scanRange(start, length, callback) { - var saveEnd = end; - var savePos = pos; - var saveStartPos = startPos; - var saveTokenPos = tokenPos; - var saveToken = token; - var savePrecedingLineBreak = precedingLineBreak; - var saveTokenValue = tokenValue; - var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; - var saveTokenIsUnterminated = tokenIsUnterminated; - setText(text, start, length); - var result = callback(); - end = saveEnd; - pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; - token = saveToken; - precedingLineBreak = savePrecedingLineBreak; - tokenValue = saveTokenValue; - hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; - tokenIsUnterminated = saveTokenIsUnterminated; - return result; + } + ts.getEndLinePosition = getEndLinePosition; + function nodeIsMissing(node) { + if (node === undefined) { + return true; } - function lookAhead(callback) { - return speculationHelper(callback, true); + return node.pos === node.end && node.pos >= 0 && node.kind !== 1; + } + ts.nodeIsMissing = nodeIsMissing; + function nodeIsPresent(node) { + return !nodeIsMissing(node); + } + ts.nodeIsPresent = nodeIsPresent; + function isToken(n) { + return n.kind >= 0 && n.kind <= 141; + } + ts.isToken = isToken; + function getTokenPosOfNode(node, sourceFile, includeJsDoc) { + if (nodeIsMissing(node)) { + return node.pos; } - function tryScan(callback) { - return speculationHelper(callback, false); + if (isJSDocNode(node)) { + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true); } - function getText() { - return text; + if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { + return getTokenPosOfNode(node.jsDoc[0]); } - function setText(newText, start, length) { - text = newText || ""; - end = length === undefined ? text.length : start + length; - setTextPos(start || 0); + if (node.kind === 293 && node._children.length > 0) { + return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } - function setOnError(errorCallback) { - onError = errorCallback; + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); + } + ts.getTokenPosOfNode = getTokenPosOfNode; + function isJSDocNode(node) { + return node.kind >= 266 && node.kind <= 292; + } + ts.isJSDocNode = isJSDocNode; + function isJSDocTag(node) { + return node.kind >= 282 && node.kind <= 292; + } + ts.isJSDocTag = isJSDocTag; + function getNonDecoratorTokenPosOfNode(node, sourceFile) { + if (nodeIsMissing(node) || !node.decorators) { + return getTokenPosOfNode(node, sourceFile); } - function setScriptTarget(scriptTarget) { - languageVersion = scriptTarget; + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end); + } + ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode; + function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { + if (includeTrivia === void 0) { includeTrivia = false; } + if (nodeIsMissing(node)) { + return ""; } - function setLanguageVariant(variant) { - languageVariant = variant; + var text = sourceFile.text; + return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end); + } + ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; + function getTextOfNodeFromSourceText(sourceText, node) { + if (nodeIsMissing(node)) { + return ""; } - function setTextPos(textPos) { - ts.Debug.assert(textPos >= 0); - pos = textPos; - startPos = textPos; - tokenPos = textPos; - token = 0; - precedingLineBreak = false; - tokenValue = undefined; - hasExtendedUnicodeEscape = false; - tokenIsUnterminated = false; + return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + } + ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; + function getTextOfNode(node, includeTrivia) { + if (includeTrivia === void 0) { includeTrivia = false; } + return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); + } + ts.getTextOfNode = getTextOfNode; + function getLiteralText(node, sourceFile) { + if (!nodeIsSynthesized(node) && node.parent) { + return getSourceTextOfNodeFromSourceFile(sourceFile, node); + } + switch (node.kind) { + case 9: + return getQuotedEscapedLiteralText('"', node.text, '"'); + case 12: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 13: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 14: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 15: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8: + return node.text; } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); } - ts.createScanner = createScanner; -})(ts || (ts = {})); -var ts; -(function (ts) { - ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; - ts.optionDeclarations = [ - { - name: "charset", - type: "string", - }, - ts.compileOnSaveCommandLineOption, - { - name: "declaration", - shortName: "d", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "diagnostics", - type: "boolean", - }, - { - name: "extendedDiagnostics", - type: "boolean", - experimental: true - }, - { - name: "emitBOM", - type: "boolean" - }, - { - name: "help", - shortName: "h", - type: "boolean", - description: ts.Diagnostics.Print_this_message, - }, - { - name: "help", - shortName: "?", - type: "boolean" - }, - { - name: "init", - type: "boolean", - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, - }, - { - name: "inlineSourceMap", - type: "boolean", - }, - { - name: "inlineSources", - type: "boolean", - }, - { - name: "jsx", - type: ts.createMap({ - "preserve": 1, - "react": 2 - }), - paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - }, - { - name: "reactNamespace", - type: "string", - description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit - }, - { - name: "jsxFactory", - type: "string", - description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h - }, - { - name: "listFiles", - type: "boolean", - }, - { - name: "locale", - type: "string", - }, - { - name: "mapRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: ts.Diagnostics.LOCATION, - }, - { - name: "module", - shortName: "m", - type: ts.createMap({ - "none": ts.ModuleKind.None, - "commonjs": ts.ModuleKind.CommonJS, - "amd": ts.ModuleKind.AMD, - "system": ts.ModuleKind.System, - "umd": ts.ModuleKind.UMD, - "es6": ts.ModuleKind.ES2015, - "es2015": ts.ModuleKind.ES2015, - }), - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - }, - { - name: "newLine", - type: ts.createMap({ - "crlf": 0, - "lf": 1 - }), - description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - }, - { - name: "noEmit", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs, - }, - { - name: "noEmitHelpers", - type: "boolean" - }, - { - name: "noEmitOnError", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "noErrorTruncation", - type: "boolean" - }, - { - name: "noImplicitAny", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "noImplicitThis", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "noUnusedLocals", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_locals, - }, - { - name: "noUnusedParameters", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_parameters, - }, - { - name: "noLib", - type: "boolean", - }, - { - name: "noResolve", - type: "boolean", - }, - { - name: "skipDefaultLibCheck", - type: "boolean", - }, - { - name: "skipLibCheck", - type: "boolean", - description: ts.Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "out", - type: "string", - isFilePath: false, - paramType: ts.Diagnostics.FILE, - }, - { - name: "outFile", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, - paramType: ts.Diagnostics.FILE, - }, - { - name: "outDir", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Redirect_output_structure_to_the_directory, - paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "preserveConstEnums", - type: "boolean", - description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "pretty", - description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, - type: "boolean" - }, - { - name: "project", - shortName: "p", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY - }, - { - name: "removeComments", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_comments_to_output, - }, - { - name: "rootDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.LOCATION, - description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - }, - { - name: "isolatedModules", - type: "boolean", - }, - { - name: "sourceMap", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_map_file, - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: ts.Diagnostics.LOCATION, - }, - { - name: "suppressExcessPropertyErrors", - type: "boolean", - description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, - experimental: true - }, - { - name: "suppressImplicitAnyIndexErrors", - type: "boolean", - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, - }, - { - name: "stripInternal", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - experimental: true - }, - { - name: "target", - shortName: "t", - type: ts.createMap({ - "es3": 0, - "es5": 1, - "es6": 2, - "es2015": 2, - "es2016": 3, - "es2017": 4, - "esnext": 5, - }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, - paramType: ts.Diagnostics.VERSION, - }, - { - name: "version", - shortName: "v", - type: "boolean", - description: ts.Diagnostics.Print_the_compiler_s_version, - }, - { - name: "watch", - shortName: "w", - type: "boolean", - description: ts.Diagnostics.Watch_input_files, - }, - { - name: "experimentalDecorators", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators - }, - { - name: "emitDecoratorMetadata", - type: "boolean", - experimental: true, - description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators - }, - { - name: "moduleResolution", - type: ts.createMap({ - "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic, - }), - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - paramType: ts.Diagnostics.STRATEGY, - }, - { - name: "allowUnusedLabels", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unused_labels - }, - { - name: "noImplicitReturns", - type: "boolean", - description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value - }, - { - name: "noFallthroughCasesInSwitch", - type: "boolean", - description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement - }, - { - name: "allowUnreachableCode", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, - { - name: "baseUrl", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names - }, - { - name: "paths", - type: "object", - isTSConfigOnly: true - }, - { - name: "rootDirs", - type: "list", - isTSConfigOnly: true, - element: { - name: "rootDirs", - type: "string", - isFilePath: true - } - }, - { - name: "typeRoots", - type: "list", - element: { - name: "typeRoots", - type: "string", - isFilePath: true - } - }, - { - name: "types", - type: "list", - element: { - name: "types", - type: "string" - }, - description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation - }, - { - name: "traceResolution", - type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process - }, - { - name: "allowJs", - type: "boolean", - description: ts.Diagnostics.Allow_javascript_files_to_be_compiled - }, - { - name: "allowSyntheticDefaultImports", - type: "boolean", - description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking - }, - { - name: "noImplicitUseStrict", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output - }, - { - name: "maxNodeModuleJsDepth", - type: "number", - description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files - }, - { - name: "listEmittedFiles", - type: "boolean" - }, - { - name: "lib", - type: "list", - element: { - name: "lib", - type: ts.createMap({ - "es5": "lib.es5.d.ts", - "es6": "lib.es2015.d.ts", - "es2015": "lib.es2015.d.ts", - "es7": "lib.es2016.d.ts", - "es2016": "lib.es2016.d.ts", - "es2017": "lib.es2017.d.ts", - "dom": "lib.dom.d.ts", - "dom.iterable": "lib.dom.iterable.d.ts", - "webworker": "lib.webworker.d.ts", - "scripthost": "lib.scripthost.d.ts", - "es2015.core": "lib.es2015.core.d.ts", - "es2015.collection": "lib.es2015.collection.d.ts", - "es2015.generator": "lib.es2015.generator.d.ts", - "es2015.iterable": "lib.es2015.iterable.d.ts", - "es2015.promise": "lib.es2015.promise.d.ts", - "es2015.proxy": "lib.es2015.proxy.d.ts", - "es2015.reflect": "lib.es2015.reflect.d.ts", - "es2015.symbol": "lib.es2015.symbol.d.ts", - "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", - "es2016.array.include": "lib.es2016.array.include.d.ts", - "es2017.object": "lib.es2017.object.d.ts", - "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", - "es2017.string": "lib.es2017.string.d.ts", - }), - }, - description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon - }, - { - name: "disableSizeLimit", - type: "boolean" - }, - { - name: "strictNullChecks", - type: "boolean", - description: ts.Diagnostics.Enable_strict_null_checks - }, - { - name: "importHelpers", - type: "boolean", - description: ts.Diagnostics.Import_emit_helpers_from_tslib - }, - { - name: "alwaysStrict", - type: "boolean", - description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file - } - ]; - ts.typeAcquisitionDeclarations = [ - { - name: "enableAutoDiscovery", - type: "boolean", - }, - { - name: "enable", - type: "boolean", - }, - { - name: "include", - type: "list", - element: { - name: "include", - type: "string" - } - }, - { - name: "exclude", - type: "list", - element: { - name: "exclude", - type: "string" - } - } - ]; - ts.defaultInitCompilerOptions = { - module: ts.ModuleKind.CommonJS, - target: 1, - noImplicitAny: false, - sourceMap: false, - }; - var optionNameMapCache; - function convertEnableAutoDiscoveryToEnable(typeAcquisition) { - if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { - var result = { - enable: typeAcquisition.enableAutoDiscovery, - include: typeAcquisition.include || [], - exclude: typeAcquisition.exclude || [] - }; - return result; - } - return typeAcquisition; + ts.getLiteralText = getLiteralText; + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } - ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; - function getOptionNameMap() { - if (optionNameMapCache) { - return optionNameMapCache; - } - var optionNameMap = ts.createMap(); - var shortOptionNames = ts.createMap(); - ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; - if (option.shortName) { - shortOptionNames[option.shortName] = option.name; - } - }); - optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; - return optionNameMapCache; + function escapeIdentifier(identifier) { + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; } - ts.getOptionNameMap = getOptionNameMap; - function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); - return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + ts.escapeIdentifier = escapeIdentifier; + function makeIdentifierFromModuleName(moduleName) { + return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } - ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; - function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; + function isBlockOrCatchScoped(declaration) { + return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 || + isCatchClauseVariableDeclarationOrBindingElement(declaration); } - ts.parseCustomTypeOption = parseCustomTypeOption; - function parseListTypeOption(opt, value, errors) { - if (value === void 0) { value = ""; } - value = trimString(value); - if (ts.startsWith(value, "-")) { - return undefined; + ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isCatchClauseVariableDeclarationOrBindingElement(declaration) { + var node = getRootDeclaration(declaration); + return node.kind === 225 && node.parent.kind === 259; + } + ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; + function isAmbientModule(node) { + return node && node.kind === 232 && + (node.name.kind === 9 || isGlobalScopeAugmentation(node)); + } + ts.isAmbientModule = isAmbientModule; + function isShorthandAmbientModuleSymbol(moduleSymbol) { + return isShorthandAmbientModule(moduleSymbol.valueDeclaration); + } + ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; + function isShorthandAmbientModule(node) { + return node && node.kind === 232 && (!node.body); + } + function isBlockScopedContainerTopLevel(node) { + return node.kind === 264 || + node.kind === 232 || + isFunctionLike(node); + } + ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; + function isGlobalScopeAugmentation(module) { + return !!(module.flags & 512); + } + ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; + function isExternalModuleAugmentation(node) { + if (!node || !isAmbientModule(node)) { + return false; } - if (value === "") { - return []; + switch (node.parent.kind) { + case 264: + return ts.isExternalModule(node.parent); + case 233: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } - var values = value.split(","); - switch (opt.element.type) { - case "number": - return ts.map(values, parseInt); - case "string": - return ts.map(values, function (v) { return v || ""; }); - default: - return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + return false; + } + ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; + function isBlockScope(node, parentNode) { + switch (node.kind) { + case 264: + case 234: + case 259: + case 232: + case 213: + case 214: + case 215: + case 151: + case 150: + case 152: + case 153: + case 227: + case 185: + case 186: + return true; + case 206: + return parentNode && !isFunctionLike(parentNode); } + return false; } - ts.parseListTypeOption = parseListTypeOption; - function parseCommandLine(commandLine, readFile) { - var options = {}; - var fileNames = []; - var errors = []; - var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames; - parseStrings(commandLine); - return { - options: options, - fileNames: fileNames, - errors: errors - }; - function parseStrings(args) { - var i = 0; - while (i < args.length) { - var s = args[i]; - i++; - if (s.charCodeAt(0) === 64) { - parseResponseFile(s.slice(1)); - } - else if (s.charCodeAt(0) === 45) { - s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; - } - if (s in optionNameMap) { - var opt = optionNameMap[s]; - if (opt.isTSConfigOnly) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); - } - else { - if (!args[i] && opt.type !== "boolean") { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); - } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i]); - i++; - break; - case "boolean": - var optValue = args[i]; - options[opt.name] = optValue !== "false"; - if (optValue === "false" || optValue === "true") { - i++; - } - break; - case "string": - options[opt.name] = args[i] || ""; - i++; - break; - case "list": - var result = parseListTypeOption(opt, args[i], errors); - options[opt.name] = result || []; - if (result) { - i++; - } - break; - default: - options[opt.name] = parseCustomTypeOption(opt, args[i], errors); - i++; - break; - } - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); - } - } - else { - fileNames.push(s); - } + ts.isBlockScope = isBlockScope; + function getEnclosingBlockScopeContainer(node) { + var current = node.parent; + while (current) { + if (isBlockScope(current, current.parent)) { + return current; } + current = current.parent; } - function parseResponseFile(fileName) { - var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); - if (!text) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); - return; - } - var args = []; - var pos = 0; - while (true) { - while (pos < text.length && text.charCodeAt(pos) <= 32) - pos++; - if (pos >= text.length) - break; - var start = pos; - if (text.charCodeAt(start) === 34) { - pos++; - while (pos < text.length && text.charCodeAt(pos) !== 34) - pos++; - if (pos < text.length) { - args.push(text.substring(start + 1, pos)); - pos++; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); - } - } - else { - while (text.charCodeAt(pos) > 32) - pos++; - args.push(text.substring(start, pos)); + } + ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; + function declarationNameToString(name) { + return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + } + ts.declarationNameToString = declarationNameToString; + function getNameFromIndexInfo(info) { + return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined; + } + ts.getNameFromIndexInfo = getNameFromIndexInfo; + function getTextOfPropertyName(name) { + switch (name.kind) { + case 70: + return name.text; + case 9: + case 8: + return name.text; + case 143: + if (isStringOrNumericLiteral(name.expression)) { + return name.expression.text; } - } - parseStrings(args); } + return undefined; } - ts.parseCommandLine = parseCommandLine; - function readConfigFile(fileName, readFile) { - var text = ""; - try { - text = readFile(fileName); - } - catch (e) { - return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; + ts.getTextOfPropertyName = getTextOfPropertyName; + function entityNameToString(name) { + switch (name.kind) { + case 70: + return getFullWidth(name) === 0 ? ts.unescapeIdentifier(name.text) : getTextOfNode(name); + case 142: + return entityNameToString(name.left) + "." + entityNameToString(name.right); + case 178: + return entityNameToString(name.expression) + "." + entityNameToString(name.name); } - return parseConfigFileTextToJson(fileName, text); } - ts.readConfigFile = readConfigFile; - function parseConfigFileTextToJson(fileName, jsonText, stripComments) { - if (stripComments === void 0) { stripComments = true; } - try { - var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText; - return { config: /\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} }; - } - catch (e) { - return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; - } + ts.entityNameToString = entityNameToString; + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + var sourceFile = getSourceFileOfNode(node); + return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); } - ts.parseConfigFileTextToJson = parseConfigFileTextToJson; - function generateTSConfig(options, fileNames) { - var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); - var configurations = { - compilerOptions: serializeCompilerOptions(compilerOptions) - }; - if (fileNames && fileNames.length) { - configurations.files = fileNames; - } - return configurations; - function getCustomTypeMapOfCommandLineOption(optionDefinition) { - if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { - return undefined; - } - else if (optionDefinition.type === "list") { - return getCustomTypeMapOfCommandLineOption(optionDefinition.element); - } - else { - return optionDefinition.type; + ts.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) { + var span = getErrorSpanForNode(sourceFile, node); + return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); + } + ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile; + function createDiagnosticForNodeFromMessageChain(node, messageChain) { + var sourceFile = getSourceFileOfNode(node); + var span = getErrorSpanForNode(sourceFile, node); + return { + file: sourceFile, + start: span.start, + length: span.length, + code: messageChain.code, + category: messageChain.category, + messageText: messageChain.next ? messageChain : messageChain.messageText + }; + } + ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; + function getSpanOfTokenAtPosition(sourceFile, pos) { + var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos); + scanner.scan(); + var start = scanner.getTokenPos(); + return ts.createTextSpanFromBounds(start, scanner.getTextPos()); + } + ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 206) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); } } - function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { - return key; + return ts.createTextSpanFromBounds(pos, node.end); + } + function getErrorSpanForNode(sourceFile, node) { + var errorNode = node; + switch (node.kind) { + case 264: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + if (pos_1 === sourceFile.text.length) { + return ts.createTextSpan(0, 0); } - } - return undefined; + return getSpanOfTokenAtPosition(sourceFile, pos_1); + case 225: + case 175: + case 228: + case 198: + case 229: + case 232: + case 231: + case 263: + case 227: + case 185: + case 150: + case 152: + case 153: + case 230: + errorNode = node.name; + break; + case 186: + return getErrorSpanForArrowFunction(sourceFile, node); } - function serializeCompilerOptions(options) { - var result = ts.createMap(); - var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_5 in options) { - if (ts.hasProperty(options, name_5)) { - switch (name_5) { - case "init": - case "watch": - case "version": - case "help": - case "project": - break; - default: - var value = options[name_5]; - var optionDefinition = optionsNameMap[name_5.toLowerCase()]; - if (optionDefinition) { - var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - result[name_5] = value; - } - else { - if (optionDefinition.type === "list") { - var convertedValue = []; - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name_5] = convertedValue; - } - else { - result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap); - } - } - } - break; - } - } - } - return result; + if (errorNode === undefined) { + return getSpanOfTokenAtPosition(sourceFile, node.pos); } + var pos = nodeIsMissing(errorNode) + ? errorNode.pos + : ts.skipTrivia(sourceFile.text, errorNode.pos); + return ts.createTextSpanFromBounds(pos, errorNode.end); } - ts.generateTSConfig = generateTSConfig; - function removeComments(jsonText) { - var output = ""; - var scanner = ts.createScanner(1, false, 0, jsonText); - var token; - while ((token = scanner.scan()) !== 1) { - switch (token) { - case 2: - case 3: - output += scanner.getTokenText().replace(/\S/g, " "); - break; - default: - output += scanner.getTokenText(); - break; - } - } - return output; + ts.getErrorSpanForNode = getErrorSpanForNode; + function isExternalOrCommonJsModule(file) { + return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { - if (existingOptions === void 0) { existingOptions = {}; } - if (resolutionStack === void 0) { resolutionStack = []; } - var errors = []; - var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); - var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); - if (resolutionStack.indexOf(resolvedPath) >= 0) { - return { - options: {}, - fileNames: [], - typeAcquisition: {}, - raw: json, - errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], - wildcardDirectories: {} - }; - } - var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; - var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); - if (json["extends"]) { - var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; - if (typeof json["extends"] === "string") { - _b = (tryExtendsName(json["extends"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3]; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); - } - if (include && !json["include"]) { - json["include"] = include; - } - if (exclude && !json["exclude"]) { - json["exclude"] = exclude; - } - if (files && !json["files"]) { - json["files"] = files; - } - options = ts.assign({}, baseOptions, options); - } - options = ts.extend(existingOptions, options); - options.configFilePath = configFileName; - var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories; - var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); - return { - options: options, - fileNames: fileNames, - typeAcquisition: typeAcquisition, - raw: json, - errors: errors, - wildcardDirectories: wildcardDirectories, - compileOnSave: compileOnSave - }; - function tryExtendsName(extendedConfig) { - if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); - return; - } - var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); - if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) { - extendedConfigPath = extendedConfigPath + ".json"; - if (!host.fileExists(extendedConfigPath)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig)); - return; - } - } - var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); }); - if (extendedResult.error) { - errors.push(extendedResult.error); - return; - } - var extendedDirname = ts.getDirectoryPath(extendedConfigPath); - var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName); - var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); }; - var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath])); - errors.push.apply(errors, result.errors); - var _a = ts.map(["include", "exclude", "files"], function (key) { - if (!json[key] && extendedResult.config[key]) { - return ts.map(extendedResult.config[key], updatePath); - } - }), include = _a[0], exclude = _a[1], files = _a[2]; - return [include, exclude, files, result.options]; + ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; + function isDeclarationFile(file) { + return file.isDeclarationFile; + } + ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return node.kind === 231 && isConst(node); + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; + function isConst(node) { + return !!(ts.getCombinedNodeFlags(node) & 2) + || !!(ts.getCombinedModifierFlags(node) & 2048); + } + ts.isConst = isConst; + function isLet(node) { + return !!(ts.getCombinedNodeFlags(node) & 1); + } + ts.isLet = isLet; + function isSuperCall(n) { + return n.kind === 180 && n.expression.kind === 96; + } + ts.isSuperCall = isSuperCall; + function isPrologueDirective(node) { + return node.kind === 209 + && node.expression.kind === 9; + } + ts.isPrologueDirective = isPrologueDirective; + function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + } + ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getLeadingCommentRangesOfNodeFromText(node, text) { + return ts.getLeadingCommentRanges(text, node.pos); + } + ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; + function getJSDocCommentRanges(node, text) { + var commentRanges = (node.kind === 145 || + node.kind === 144 || + node.kind === 185 || + node.kind === 186) ? + ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : + getLeadingCommentRangesOfNodeFromText(node, text); + return ts.filter(commentRanges, function (comment) { + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 42 && + text.charCodeAt(comment.pos + 3) !== 47; + }); + } + ts.getJSDocCommentRanges = getJSDocCommentRanges; + ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; + function isPartOfTypeNode(node) { + if (157 <= node.kind && node.kind <= 172) { + return true; } - function getFileNames(errors) { - var fileNames; - if (ts.hasProperty(json, "files")) { - if (ts.isArray(json["files"])) { - fileNames = json["files"]; - if (fileNames.length === 0) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json")); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); - } - } - var includeSpecs; - if (ts.hasProperty(json, "include")) { - if (ts.isArray(json["include"])) { - includeSpecs = json["include"]; + switch (node.kind) { + case 118: + case 132: + case 135: + case 121: + case 136: + case 138: + case 129: + return true; + case 104: + return node.parent.kind !== 189; + case 200: + return !isExpressionWithTypeArgumentsInClassExtendsClause(node); + case 70: + if (node.parent.kind === 142 && node.parent.right === node) { + node = node.parent; } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array")); + else if (node.parent.kind === 178 && node.parent.name === node) { + node = node.parent; } - } - var excludeSpecs; - if (ts.hasProperty(json, "exclude")) { - if (ts.isArray(json["exclude"])) { - excludeSpecs = json["exclude"]; + ts.Debug.assert(node.kind === 70 || node.kind === 142 || node.kind === 178, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142: + case 178: + case 98: + var parent = node.parent; + if (parent.kind === 161) { + return false; } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array")); + if (157 <= parent.kind && parent.kind <= 172) { + return true; } - } - else if (ts.hasProperty(json, "excludes")) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); - } - else { - excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; - var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; - if (outDir) { - excludeSpecs.push(outDir); + switch (parent.kind) { + case 200: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); + case 144: + return node === parent.constraint; + case 148: + case 147: + case 145: + case 225: + return node === parent.type; + case 227: + case 185: + case 186: + case 151: + case 150: + case 149: + case 152: + case 153: + return node === parent.type; + case 154: + case 155: + case 156: + return node === parent.type; + case 183: + return node === parent.type; + case 180: + case 181: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182: + return false; } - } - if (fileNames === undefined && includeSpecs === undefined) { - includeSpecs = ["**/*"]; - } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); - if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); - } - return result; } - var _b; + return false; } - ts.parseJsonConfigFileContent = parseJsonConfigFileContent; - function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) { - if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) { - return false; - } - var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors); - if (typeof result === "boolean" && result) { - return result; + ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; } return false; } - ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson; - function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { - var errors = []; - var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); - return { options: options, errors: errors }; - } - ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { - var errors = []; - var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); - return { options: options, errors: errors }; - } - ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; - function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = ts.getBaseFileName(configFileName) === "jsconfig.json" - ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } - : {}; - convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); - return options; - } - function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); - convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); - return options; + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 191; } - function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { - if (!jsonOptions) { - return; - } - var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; - defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); - } - else { - errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 218: + return visitor(node); + case 234: + case 206: + case 210: + case 211: + case 212: + case 213: + case 214: + case 215: + case 219: + case 220: + case 256: + case 257: + case 221: + case 223: + case 259: + return ts.forEachChild(node, traverse); } } } - function convertJsonOption(opt, value, basePath, errors) { - var optType = opt.type; - var expectedType = typeof optType === "string" ? optType : "string"; - if (optType === "list" && ts.isArray(value)) { - return convertJsonOptionOfListType(opt, value, basePath, errors); - } - else if (typeof value === expectedType) { - if (typeof optType !== "string") { - return convertJsonOptionOfCustomType(opt, value, errors); - } - else { - if (opt.isFilePath) { - value = ts.normalizePath(ts.combinePaths(basePath, value)); - if (value === "") { - value = "."; + ts.forEachReturnStatement = forEachReturnStatement; + function forEachYieldExpression(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 196: + visitor(node); + var operand = node.expression; + if (operand) { + traverse(operand); + } + return; + case 231: + case 229: + case 232: + case 230: + case 228: + case 198: + return; + default: + if (isFunctionLike(node)) { + var name = node.name; + if (name && name.kind === 143) { + traverse(name.expression); + return; + } + } + else if (!isPartOfTypeNode(node)) { + ts.forEachChild(node, traverse); } - } } - return value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); } } - function convertJsonOptionOfCustomType(opt, value, errors) { - var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + ts.forEachYieldExpression = forEachYieldExpression; + function getRestParameterElementType(node) { + if (node && node.kind === 163) { + return node.elementType; + } + else if (node && node.kind === 158) { + return ts.singleOrUndefined(node.typeArguments); } else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + return undefined; } } - function convertJsonOptionOfListType(option, values, basePath, errors) { - return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); - } - function trimString(s) { - return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); - } - var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/; - var invalidMultipleRecursionPatterns = /(^|\/)\*\*\/(.*\/)?\*\*($|\/)/; - var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; - var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; - var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { - basePath = ts.normalizePath(basePath); - var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; - var literalFileMap = ts.createMap(); - var wildcardFileMap = ts.createMap(); - if (include) { - include = validateSpecs(include, errors, false); - } - if (exclude) { - exclude = validateSpecs(exclude, errors, true); - } - var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); - if (fileNames) { - for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { - var fileName = fileNames_1[_i]; - var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; - } - } - if (include && include.length > 0) { - for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) { - var file = _b[_a]; - if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) { - continue; - } - removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); - var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; - } + ts.getRestParameterElementType = getRestParameterElementType; + function isVariableLike(node) { + if (node) { + switch (node.kind) { + case 175: + case 263: + case 145: + case 260: + case 148: + case 147: + case 261: + case 225: + return true; } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); - return { - fileNames: literalFiles.concat(wildcardFiles), - wildcardDirectories: wildcardDirectories - }; + return false; } - function validateSpecs(specs, errors, allowTrailingRecursion) { - var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; - if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); - } - else if (invalidMultipleRecursionPatterns.test(spec)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec)); - } - else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); - } - else { - validSpecs.push(spec); - } - } - return validSpecs; + ts.isVariableLike = isVariableLike; + function isAccessor(node) { + return node && (node.kind === 152 || node.kind === 153); } - function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { - var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); - var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); - if (include !== undefined) { - var recursiveKeys = []; - for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { - var file = include_1[_i]; - var spec = ts.normalizePath(ts.combinePaths(path, file)); - if (excludeRegex && excludeRegex.test(spec)) { - continue; - } - var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); - if (match) { - var key = match.key, flags = match.flags; - var existingFlags = wildcardDirectories[key]; - if (existingFlags === undefined || existingFlags < flags) { - wildcardDirectories[key] = flags; - if (flags === 1) { - recursiveKeys.push(key); - } - } - } - } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; - } - } - } - } - return wildcardDirectories; + ts.isAccessor = isAccessor; + function isClassLike(node) { + return node && (node.kind === 228 || node.kind === 198); } - function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { - var match = wildcardDirectoryPattern.exec(spec); - if (match) { - return { - key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(), - flags: watchRecursivePattern.test(spec) ? 1 : 0 - }; + ts.isClassLike = isClassLike; + function isFunctionLike(node) { + return node && isFunctionLikeKind(node.kind); + } + ts.isFunctionLike = isFunctionLike; + function isFunctionLikeKind(kind) { + switch (kind) { + case 151: + case 185: + case 227: + case 186: + case 150: + case 149: + case 152: + case 153: + case 154: + case 155: + case 156: + case 159: + case 160: + return true; } - if (ts.isImplicitGlob(spec)) { - return { key: spec, flags: 1 }; + return false; + } + ts.isFunctionLikeKind = isFunctionLikeKind; + function introducesArgumentsExoticObject(node) { + switch (node.kind) { + case 150: + case 149: + case 151: + case 152: + case 153: + case 227: + case 185: + return true; } - return undefined; + return false; } - function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { - var extensionPriority = ts.getExtensionPriority(file, extensions); - var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority); - for (var i = 0; i < adjustedExtensionPriority; i++) { - var higherPriorityExtension = extensions[i]; - var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; + function isIterationStatement(node, lookInLabeledStatements) { + switch (node.kind) { + case 213: + case 214: + case 215: + case 211: + case 212: return true; - } + case 221: + return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } - function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { - var extensionPriority = ts.getExtensionPriority(file, extensions); - var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority); - for (var i = nextExtensionPriority; i < extensions.length; i++) { - var lowerPriorityExtension = extensions[i]; - var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 221) { + return node.statement; + } + node = node.statement; } } - function addFileToOutput(output, file) { - output.push(file); - return output; + ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; + function isFunctionBlock(node) { + return node && node.kind === 206 && isFunctionLike(node.parent); } - function caseSensitiveKeyMapper(key) { - return key; + ts.isFunctionBlock = isFunctionBlock; + function isObjectLiteralMethod(node) { + return node && node.kind === 150 && node.parent.kind === 177; } - function caseInsensitiveKeyMapper(key) { - return key.toLowerCase(); + ts.isObjectLiteralMethod = isObjectLiteralMethod; + function isObjectLiteralOrClassExpressionMethod(node) { + return node.kind === 150 && + (node.parent.kind === 177 || + node.parent.kind === 198); } -})(ts || (ts = {})); -var ts; -(function (ts) { - var JsTyping; - (function (JsTyping) { - ; - ; - var safeList; - var EmptySafeList = ts.createMap(); - JsTyping.nodeCoreModuleList = [ - "buffer", "querystring", "events", "http", "cluster", - "zlib", "os", "https", "punycode", "repl", "readline", - "vm", "child_process", "url", "dns", "net", - "dgram", "fs", "path", "string_decoder", "tls", - "crypto", "stream", "util", "assert", "tty", "domain", - "constants", "process", "v8", "timers", "console" - ]; - var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { - var inferredTypings = ts.createMap(); - if (!typeAcquisition || !typeAcquisition.enable) { - return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; - } - fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { - var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); - return kind === 1 || kind === 2; - }); - if (!safeList) { - var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; - } - var filesToWatch = []; - var searchDirs = []; - var exclude = []; - mergeTypings(typeAcquisition.include); - exclude = typeAcquisition.exclude || []; - var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); - if (projectRootPath) { - possibleSearchDirs.push(projectRootPath); - } - searchDirs = ts.deduplicate(possibleSearchDirs); - for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { - var searchDir = searchDirs_1[_i]; - var packageJsonPath = ts.combinePaths(searchDir, "package.json"); - getTypingNamesFromJson(packageJsonPath, filesToWatch); - var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); - getTypingNamesFromJson(bowerJsonPath, filesToWatch); - var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromNodeModuleFolder(nodeModulesPath); - } - getTypingNamesFromSourceFileNames(fileNames); - if (unresolvedImports) { - for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { - var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; - } - } - } - for (var name_6 in packageNameToTypingLocation) { - if (name_6 in inferredTypings && !inferredTypings[name_6]) { - inferredTypings[name_6] = packageNameToTypingLocation[name_6]; - } - } - for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { - var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; + function isIdentifierTypePredicate(predicate) { + return predicate && predicate.kind === 1; + } + ts.isIdentifierTypePredicate = isIdentifierTypePredicate; + function isThisTypePredicate(predicate) { + return predicate && predicate.kind === 0; + } + ts.isThisTypePredicate = isThisTypePredicate; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isFunctionLike(node)) { + return node; } - var newTypingNames = []; - var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); - } - else { - newTypingNames.push(typing); - } + } + } + ts.getContainingFunction = getContainingFunction; + function getContainingClass(node) { + while (true) { + node = node.parent; + if (!node || isClassLike(node)) { + return node; } - return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; - function mergeTypings(typingNames) { - if (!typingNames) { - return; - } - for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { - var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; - } - } + } + } + ts.getContainingClass = getContainingClass; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; } - function getTypingNamesFromJson(jsonPath, filesToWatch) { - if (host.fileExists(jsonPath)) { - filesToWatch.push(jsonPath); - } - var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); - if (result.config) { - var jsonConfig = result.config; - if (jsonConfig.dependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); + switch (node.kind) { + case 143: + if (isClassLike(node.parent.parent)) { + return node; } - if (jsonConfig.devDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); + node = node.parent; + break; + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { + node = node.parent.parent; } - if (jsonConfig.optionalDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); + else if (isClassElement(node.parent)) { + node = node.parent; } - if (jsonConfig.peerDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); + break; + case 186: + if (!includeArrowFunctions) { + continue; } - } + case 227: + case 185: + case 232: + case 148: + case 147: + case 150: + case 149: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 231: + case 264: + return node; } - function getTypingNamesFromSourceFileNames(fileNames) { - var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); - var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); - var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); - if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); - } - var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); - if (hasJsxFile) { - mergeTypings(["react"]); - } + } + } + ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, false); + if (container) { + switch (container.kind) { + case 151: + case 227: + case 185: + return container; } - function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { - if (!host.directoryExists(nodeModulesPath)) { - return; - } - var typingNames = []; - var fileNames = host.readDirectory(nodeModulesPath, [".json"], undefined, undefined, 2); - for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { - var fileName = fileNames_2[_i]; - var normalizedFileName = ts.normalizePath(fileName); - if (ts.getBaseFileName(normalizedFileName) !== "package.json") { - continue; - } - var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); - if (!result.config) { - continue; - } - var packageJson = result.config; - if (packageJson._requiredBy && - ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { - continue; - } - if (!packageJson.name) { + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; + function getSuperContainer(node, stopOnFunctions) { + while (true) { + node = node.parent; + if (!node) { + return node; + } + switch (node.kind) { + case 143: + node = node.parent; + break; + case 227: + case 185: + case 186: + if (!stopOnFunctions) { continue; } - if (packageJson.typings) { - var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + case 148: + case 147: + case 150: + case 149: + case 151: + case 152: + case 153: + return node; + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { + node = node.parent.parent; } - else { - typingNames.push(packageJson.name); + else if (isClassElement(node.parent)) { + node = node.parent; } - } - mergeTypings(typingNames); - } - } - JsTyping.discoverTypings = discoverTypings; - })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - server.ActionSet = "action::set"; - server.ActionInvalidate = "action::invalidate"; - server.EventInstall = "event::install"; - var Arguments; - (function (Arguments) { - Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; - Arguments.LogFile = "--logFile"; - Arguments.EnableTelemetry = "--enableTelemetry"; - })(Arguments = server.Arguments || (server.Arguments = {})); - function hasArgument(argumentName) { - return ts.sys.args.indexOf(argumentName) >= 0; - } - server.hasArgument = hasArgument; - function findArgument(argumentName) { - var index = ts.sys.args.indexOf(argumentName); - return index >= 0 && index < ts.sys.args.length - 1 - ? ts.sys.args[index + 1] - : undefined; - } - server.findArgument = findArgument; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - var LogLevel; - (function (LogLevel) { - LogLevel[LogLevel["terse"] = 0] = "terse"; - LogLevel[LogLevel["normal"] = 1] = "normal"; - LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; - LogLevel[LogLevel["verbose"] = 3] = "verbose"; - })(LogLevel = server.LogLevel || (server.LogLevel = {})); - server.emptyArray = []; - var Msg; - (function (Msg) { - Msg.Err = "Err"; - Msg.Info = "Info"; - Msg.Perf = "Perf"; - })(Msg = server.Msg || (server.Msg = {})); - function getProjectRootPath(project) { - switch (project.projectKind) { - case server.ProjectKind.Configured: - return ts.getDirectoryPath(project.getProjectName()); - case server.ProjectKind.Inferred: - return ""; - case server.ProjectKind.External: - var projectName = ts.normalizeSlashes(project.getProjectName()); - return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; + break; } } - function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { - return { - projectName: project.getProjectName(), - fileNames: project.getFileNames(true), - compilerOptions: project.getCompilerOptions(), - typeAcquisition: typeAcquisition, - unresolvedImports: unresolvedImports, - projectRootPath: getProjectRootPath(project), - cachePath: cachePath, - kind: "discover" - }; - } - server.createInstallTypingsRequest = createInstallTypingsRequest; - var Errors; - (function (Errors) { - function ThrowNoProject() { - throw new Error("No Project."); - } - Errors.ThrowNoProject = ThrowNoProject; - function ThrowProjectLanguageServiceDisabled() { - throw new Error("The project's language service is disabled."); - } - Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; - function ThrowProjectDoesNotContainDocument(fileName, project) { - throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); + } + ts.getSuperContainer = getSuperContainer; + function getImmediatelyInvokedFunctionExpression(func) { + if (func.kind === 185 || func.kind === 186) { + var prev = func; + var parent = func.parent; + while (parent.kind === 184) { + prev = parent; + parent = parent.parent; } - Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; - })(Errors = server.Errors || (server.Errors = {})); - function getDefaultFormatCodeSettings(host) { - return { - indentSize: 4, - tabSize: 4, - newLineCharacter: host.newLine || "\n", - convertTabsToSpaces: true, - indentStyle: ts.IndentStyle.Smart, - insertSpaceAfterCommaDelimiter: true, - insertSpaceAfterSemicolonInForStatements: true, - insertSpaceBeforeAndAfterBinaryOperators: true, - insertSpaceAfterKeywordsInControlFlowStatements: true, - insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, - placeOpenBraceOnNewLineForFunctions: false, - placeOpenBraceOnNewLineForControlBlocks: false, - }; - } - server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; - function mergeMaps(target, source) { - for (var key in source) { - if (ts.hasProperty(source, key)) { - target[key] = source[key]; - } + if (parent.kind === 180 && parent.expression === prev) { + return parent; } } - server.mergeMaps = mergeMaps; - function removeItemFromSet(items, itemToRemove) { - if (items.length === 0) { - return; - } - var index = items.indexOf(itemToRemove); - if (index < 0) { - return; - } - if (index === items.length - 1) { - items.pop(); - } - else { - items[index] = items.pop(); - } + } + ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; + function isSuperProperty(node) { + var kind = node.kind; + return (kind === 178 || kind === 179) + && node.expression.kind === 96; + } + ts.isSuperProperty = isSuperProperty; + function getEntityNameFromTypeNode(node) { + switch (node.kind) { + case 158: + case 276: + return node.typeName; + case 200: + return isEntityNameExpression(node.expression) + ? node.expression + : undefined; + case 70: + case 142: + return node; } - server.removeItemFromSet = removeItemFromSet; - function toNormalizedPath(fileName) { - return ts.normalizePath(fileName); + return undefined; + } + ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; + function isCallLikeExpression(node) { + switch (node.kind) { + case 250: + case 249: + case 180: + case 181: + case 182: + case 146: + return true; + default: + return false; } - server.toNormalizedPath = toNormalizedPath; - function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { - var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); - return getCanonicalFileName(f); + } + ts.isCallLikeExpression = isCallLikeExpression; + function getInvokedExpression(node) { + if (node.kind === 182) { + return node.tag; } - server.normalizedPathToPath = normalizedPathToPath; - function asNormalizedPath(fileName) { - return fileName; + else if (isJsxOpeningLikeElement(node)) { + return node.tagName; } - server.asNormalizedPath = asNormalizedPath; - function createNormalizedPathMap() { - var map = Object.create(null); - return { - get: function (path) { - return map[path]; - }, - set: function (path, value) { - map[path] = value; - }, - contains: function (path) { - return ts.hasProperty(map, path); - }, - remove: function (path) { - delete map[path]; - } - }; - } - server.createNormalizedPathMap = createNormalizedPathMap; - function isInferredProjectName(name) { - return /dev\/null\/inferredProject\d+\*/.test(name); + return node.expression; + } + ts.getInvokedExpression = getInvokedExpression; + function nodeCanBeDecorated(node) { + switch (node.kind) { + case 228: + return true; + case 148: + return node.parent.kind === 228; + case 152: + case 153: + case 150: + return node.body !== undefined + && node.parent.kind === 228; + case 145: + return node.parent.body !== undefined + && (node.parent.kind === 151 + || node.parent.kind === 150 + || node.parent.kind === 153) + && node.parent.parent.kind === 228; } - server.isInferredProjectName = isInferredProjectName; - function makeInferredProjectName(counter) { - return "/dev/null/inferredProject" + counter + "*"; + return false; + } + ts.nodeCanBeDecorated = nodeCanBeDecorated; + function nodeIsDecorated(node) { + return node.decorators !== undefined + && nodeCanBeDecorated(node); + } + ts.nodeIsDecorated = nodeIsDecorated; + function nodeOrChildIsDecorated(node) { + return nodeIsDecorated(node) || childIsDecorated(node); + } + ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function childIsDecorated(node) { + switch (node.kind) { + case 228: + return ts.forEach(node.members, nodeOrChildIsDecorated); + case 150: + case 153: + return ts.forEach(node.parameters, nodeIsDecorated); } - server.makeInferredProjectName = makeInferredProjectName; - function toSortedReadonlyArray(arr) { - arr.sort(); - return arr; + } + ts.childIsDecorated = childIsDecorated; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 250 || + parent.kind === 249 || + parent.kind === 251) { + return parent.tagName === node; } - server.toSortedReadonlyArray = toSortedReadonlyArray; - var ThrottledOperations = (function () { - function ThrottledOperations(host) { - this.host = host; - this.pendingTimeouts = ts.createMap(); - } - ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { - if (ts.hasProperty(this.pendingTimeouts, operationId)) { - this.host.clearTimeout(this.pendingTimeouts[operationId]); + return false; + } + ts.isJSXTagName = isJSXTagName; + function isPartOfExpression(node) { + switch (node.kind) { + case 98: + case 96: + case 94: + case 100: + case 85: + case 11: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 201: + case 183: + case 202: + case 184: + case 185: + case 198: + case 186: + case 189: + case 187: + case 188: + case 191: + case 192: + case 193: + case 194: + case 197: + case 195: + case 12: + case 199: + case 248: + case 249: + case 196: + case 190: + case 203: + return true; + case 142: + while (node.parent.kind === 142) { + node = node.parent; } - this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); - }; - ThrottledOperations.run = function (self, operationId, cb) { - delete self.pendingTimeouts[operationId]; - cb(); - }; - return ThrottledOperations; - }()); - server.ThrottledOperations = ThrottledOperations; - var GcTimer = (function () { - function GcTimer(host, delay, logger) { - this.host = host; - this.delay = delay; - this.logger = logger; - } - GcTimer.prototype.scheduleCollect = function () { - if (!this.host.gc || this.timerId != undefined) { - return; + return node.parent.kind === 161 || isJSXTagName(node); + case 70: + if (node.parent.kind === 161 || isJSXTagName(node)) { + return true; } - this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); - }; - GcTimer.run = function (self) { - self.timerId = undefined; - var log = self.logger.hasLevel(LogLevel.requestTime); - var before = log && self.host.getMemoryUsage(); - self.host.gc(); - if (log) { - var after = self.host.getMemoryUsage(); - self.logger.perftrc("GC::before " + before + ", after " + after); + case 8: + case 9: + case 98: + var parent = node.parent; + switch (parent.kind) { + case 225: + case 145: + case 148: + case 147: + case 263: + case 260: + case 175: + return parent.initializer === node; + case 209: + case 210: + case 211: + case 212: + case 218: + case 219: + case 220: + case 256: + case 222: + case 220: + return parent.expression === node; + case 213: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226) || + forStatement.condition === node || + forStatement.incrementor === node; + case 214: + case 215: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226) || + forInStatement.expression === node; + case 183: + case 201: + return node === parent.expression; + case 204: + return node === parent.expression; + case 143: + return node === parent.expression; + case 146: + case 255: + case 254: + case 262: + return true; + case 200: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); + default: + if (isPartOfExpression(parent)) { + return true; + } } - }; - return GcTimer; - }()); - server.GcTimer = GcTimer; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - function trace(host) { - host.trace(ts.formatMessage.apply(undefined, arguments)); + } + return false; } - ts.trace = trace; - function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceResolution && host.trace !== undefined; + ts.isPartOfExpression = isPartOfExpression; + function isInstantiatedModule(node, preserveConstEnums) { + var moduleState = ts.getModuleInstanceState(node); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } - ts.isTraceEnabled = isTraceEnabled; - function resolvedTypeScriptOnly(resolved) { - if (!resolved) { - return undefined; + ts.isInstantiatedModule = isInstantiatedModule; + function isExternalModuleImportEqualsDeclaration(node) { + return node.kind === 236 && node.moduleReference.kind === 247; + } + ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; + function getExternalModuleImportEqualsDeclarationExpression(node) { + ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node)); + return node.moduleReference.expression; + } + ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; + function isInternalModuleImportEqualsDeclaration(node) { + return node.kind === 236 && node.moduleReference.kind !== 247; + } + ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; + function isSourceFileJavaScript(file) { + return isInJavaScriptFile(file); + } + ts.isSourceFileJavaScript = isSourceFileJavaScript; + function isInJavaScriptFile(node) { + return node && !!(node.flags & 65536); + } + ts.isInJavaScriptFile = isInJavaScriptFile; + function isRequireCall(callExpression, checkArgumentIsStringLiteral) { + if (callExpression.kind !== 180) { + return false; } - ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); - return resolved.path; + var _a = callExpression, expression = _a.expression, args = _a.arguments; + if (expression.kind !== 70 || expression.text !== "require") { + return false; + } + if (args.length !== 1) { + return false; + } + var arg = args[0]; + return !checkArgumentIsStringLiteral || arg.kind === 9 || arg.kind === 12; } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; + ts.isRequireCall = isRequireCall; + function isSingleOrDoubleQuote(charCode) { + return charCode === 39 || charCode === 34; } - function resolvedModuleFromResolved(_a, isExternalLibraryImport) { - var path = _a.path, extension = _a.extension; - return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; + ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; + function isDeclarationOfFunctionOrClassExpression(s) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225) { + var declaration = s.valueDeclaration; + return declaration.initializer && (declaration.initializer.kind === 185 || declaration.initializer.kind === 198); + } + return false; } - function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) { - return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations }; + ts.isDeclarationOfFunctionOrClassExpression = isDeclarationOfFunctionOrClassExpression; + function getRightMostAssignedExpression(node) { + while (isAssignmentExpression(node, true)) { + node = node.right; + } + return node; } - function moduleHasNonRelativeName(moduleName) { - return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); + ts.getRightMostAssignedExpression = getRightMostAssignedExpression; + function isExportsIdentifier(node) { + return isIdentifier(node) && node.text === "exports"; } - ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { - var jsonContent = readJson(packageJsonPath, state.host); - switch (extensions) { - case 2: - case 0: - return tryReadFromField("typings") || tryReadFromField("types"); - case 1: - if (typeof jsonContent.main === "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); - } - return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main)); - } - return undefined; + ts.isExportsIdentifier = isExportsIdentifier; + function isModuleExportsPropertyAccessExpression(node) { + return isPropertyAccessExpression(node) && isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports"; + } + ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression; + function getSpecialPropertyAssignmentKind(expression) { + if (!isInJavaScriptFile(expression)) { + return 0; } - function tryReadFromField(fieldName) { - if (ts.hasProperty(jsonContent, fieldName)) { - var typesFile = jsonContent[fieldName]; - if (typeof typesFile === "string") { - var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); - } - return typesFilePath; + var expr = expression; + if (expr.operatorToken.kind !== 57 || expr.left.kind !== 178) { + return 0; + } + var lhs = expr.left; + if (lhs.expression.kind === 70) { + var lhsId = lhs.expression; + if (lhsId.text === "exports") { + return 1; + } + else if (lhsId.text === "module" && lhs.name.text === "exports") { + return 2; + } + else { + return 5; + } + } + else if (lhs.expression.kind === 98) { + return 4; + } + else if (lhs.expression.kind === 178) { + var innerPropertyAccess = lhs.expression; + if (innerPropertyAccess.expression.kind === 70) { + var innerPropertyAccessIdentifier = innerPropertyAccess.expression; + if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { + return 1; } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); - } + if (innerPropertyAccess.name.text === "prototype") { + return 3; } } } + return 0; } - function readJson(path, host) { - try { - var jsonText = host.readFile(path); - return jsonText ? JSON.parse(jsonText) : {}; + ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; + function getExternalModuleName(node) { + if (node.kind === 237) { + return node.moduleSpecifier; } - catch (e) { - return {}; + if (node.kind === 236) { + var reference = node.moduleReference; + if (reference.kind === 247) { + return reference.expression; + } } - } - function getEffectiveTypeRoots(options, host) { - if (options.typeRoots) { - return options.typeRoots; + if (node.kind === 243) { + return node.moduleSpecifier; } - var currentDirectory; - if (options.configFilePath) { - currentDirectory = ts.getDirectoryPath(options.configFilePath); + if (node.kind === 232 && node.name.kind === 9) { + return node.name; } - else if (host.getCurrentDirectory) { - currentDirectory = host.getCurrentDirectory(); + } + ts.getExternalModuleName = getExternalModuleName; + function getNamespaceDeclarationNode(node) { + if (node.kind === 236) { + return node; } - if (currentDirectory !== undefined) { - return getDefaultTypeRoots(currentDirectory, host); + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239) { + return importClause.namedBindings; } } - ts.getEffectiveTypeRoots = getEffectiveTypeRoots; - function getDefaultTypeRoots(currentDirectory, host) { - if (!host.directoryExists) { - return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; - } - var typeRoots; - forEachAncestorDirectory(currentDirectory, function (directory) { - var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); - if (host.directoryExists(atTypes)) { - (typeRoots || (typeRoots = [])).push(atTypes); - } - }); - return typeRoots; + ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; + function isDefaultImport(node) { + return node.kind === 237 + && node.importClause + && !!node.importClause.name; } - var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); - function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { - var traceEnabled = isTraceEnabled(options, host); - var moduleResolutionState = { - compilerOptions: options, - host: host, - traceEnabled: traceEnabled - }; - var typeRoots = getEffectiveTypeRoots(options, host); - if (traceEnabled) { - if (containingFile === undefined) { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); - } - else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); - } + ts.isDefaultImport = isDefaultImport; + function hasQuestionToken(node) { + if (node) { + switch (node.kind) { + case 145: + case 150: + case 149: + case 261: + case 260: + case 148: + case 147: + return node.questionToken !== undefined; } - else { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + return false; + } + ts.hasQuestionToken = hasQuestionToken; + function isJSDocConstructSignature(node) { + return node.kind === 278 && + node.parameters.length > 0 && + node.parameters[0].type.kind === 280; + } + ts.isJSDocConstructSignature = isJSDocConstructSignature; + function getCommentsFromJSDoc(node) { + return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); + } + ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function hasJSDocParameterTags(node) { + var parameterTags = getJSDocTags(node, 285); + return parameterTags && parameterTags.length > 0; + } + ts.hasJSDocParameterTags = hasJSDocParameterTags; + function getJSDocTags(node, kind) { + var docs = getJSDocs(node); + if (docs) { + var result = []; + for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { + var doc = docs_1[_i]; + if (doc.kind === 285) { + if (doc.kind === kind) { + result.push(doc); + } } else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); + var tags = doc.tags; + if (tags) { + result.push.apply(result, ts.filter(tags, function (tag) { return tag.kind === kind; })); + } } } + return result; } - var failedLookupLocations = []; - var resolved = primaryLookup(); - var primary = true; - if (!resolved) { - resolved = secondaryLookup(); - primary = false; + } + function getFirstJSDocTag(node, kind) { + return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + } + function getJSDocs(node) { + var cache = node.jsDocCache; + if (!cache) { + getJSDocsWorker(node); + node.jsDocCache = cache; } - var resolvedTypeReferenceDirective; - if (resolved) { - resolved = realpath(resolved, host, traceEnabled); - if (traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary); + return cache; + function getJSDocsWorker(node) { + var parent = node.parent; + var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && + parent.initializer === node && + parent.parent.parent.kind === 207; + var isVariableOfVariableDeclarationStatement = isVariableLike(node) && + parent.parent.kind === 207; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : + undefined; + if (variableStatementNode) { + getJSDocsWorker(variableStatementNode); } - resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved }; - } - return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations }; - function primaryLookup() { - if (typeRoots && typeRoots.length) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); - } - return ts.forEach(typeRoots, function (typeRoot) { - var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); - var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); - }); + var isSourceOfAssignmentExpressionStatement = parent && parent.parent && + parent.kind === 193 && + parent.operatorToken.kind === 57 && + parent.parent.kind === 209; + if (isSourceOfAssignmentExpressionStatement) { + getJSDocsWorker(parent.parent); } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); - } + var isModuleDeclaration = node.kind === 232 && + parent && parent.kind === 232; + var isPropertyAssignmentExpression = parent && parent.kind === 260; + if (isModuleDeclaration || isPropertyAssignmentExpression) { + getJSDocsWorker(parent); } - } - function secondaryLookup() { - var resolvedFile; - var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); - if (initialLocationForSecondaryLookup !== undefined) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); - } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); - if (!resolvedFile && traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); - } - return resolvedFile; + if (node.kind === 145) { + cache = ts.concatenate(cache, getJSDocParameterTags(node)); } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); - } + if (isVariableLike(node) && node.initializer) { + cache = ts.concatenate(cache, node.initializer.jsDoc); } + cache = ts.concatenate(cache, node.jsDoc); } } - ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; - function getAutomaticTypeDirectiveNames(options, host) { - if (options.types) { - return options.types; + ts.getJSDocs = getJSDocs; + function getJSDocParameterTags(param) { + if (!isParameter(param)) { + return undefined; } - var result = []; - if (host.directoryExists && host.getDirectories) { - var typeRoots = getEffectiveTypeRoots(options, host); - if (typeRoots) { - for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { - var root = typeRoots_1[_i]; - if (host.directoryExists(root)) { - for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { - var typeDirectivePath = _b[_a]; - var normalized = ts.normalizePath(typeDirectivePath); - var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); - var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; - if (!isNotNeededPackage) { - result.push(ts.getBaseFileName(normalized)); - } - } - } - } + var func = param.parent; + var tags = getJSDocTags(func, 285); + if (!param.name) { + var i = func.parameters.indexOf(param); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 285; }); + if (paramTags && 0 <= i && i < paramTags.length) { + return [paramTags[i]]; } } - return result; - } - ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); - } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; - if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); - } + else if (param.name.kind === 70) { + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 285 && tag.parameterName.text === name_1; }); } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + return undefined; + } + } + ts.getJSDocParameterTags = getJSDocParameterTags; + function getJSDocType(node) { + var tag = getFirstJSDocTag(node, 287); + if (!tag && node.kind === 145) { + var paramTags = getJSDocParameterTags(node); + if (paramTags) { + tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); } } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; - } - if (traceEnabled) { - if (result.resolvedModule) { - trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); - } - else { - trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + return tag && tag.typeExpression && tag.typeExpression.type; + } + ts.getJSDocType = getJSDocType; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, 284); + } + ts.getJSDocAugmentsTag = getJSDocAugmentsTag; + function getJSDocReturnTag(node) { + return getFirstJSDocTag(node, 286); + } + ts.getJSDocReturnTag = getJSDocReturnTag; + function getJSDocTemplateTag(node) { + return getFirstJSDocTag(node, 288); + } + ts.getJSDocTemplateTag = getJSDocTemplateTag; + function hasRestParameter(s) { + return isRestParameter(ts.lastOrUndefined(s.parameters)); + } + ts.hasRestParameter = hasRestParameter; + function hasDeclaredRestParameter(s) { + return isDeclaredRestParam(ts.lastOrUndefined(s.parameters)); + } + ts.hasDeclaredRestParameter = hasDeclaredRestParameter; + function isRestParameter(node) { + if (node && (node.flags & 65536)) { + if (node.type && node.type.kind === 279 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 279; })) { + return true; } } - return result; + return isDeclaredRestParam(node); } - ts.resolveModuleName = resolveModuleName; - function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { - if (moduleHasNonRelativeName(moduleName)) { - return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state); - } - else { - return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); + ts.isRestParameter = isRestParameter; + function isDeclaredRestParam(node) { + return node && node.dotDotDotToken !== undefined; + } + ts.isDeclaredRestParam = isDeclaredRestParam; + var AssignmentKind; + (function (AssignmentKind) { + AssignmentKind[AssignmentKind["None"] = 0] = "None"; + AssignmentKind[AssignmentKind["Definite"] = 1] = "Definite"; + AssignmentKind[AssignmentKind["Compound"] = 2] = "Compound"; + })(AssignmentKind = ts.AssignmentKind || (ts.AssignmentKind = {})); + function getAssignmentTargetKind(node) { + var parent = node.parent; + while (true) { + switch (parent.kind) { + case 193: + var binaryOperator = parent.operatorToken.kind; + return isAssignmentOperator(binaryOperator) && parent.left === node ? + binaryOperator === 57 ? 1 : 2 : + 0; + case 191: + case 192: + var unaryOperator = parent.operator; + return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; + case 214: + case 215: + return parent.initializer === node ? 1 : 0; + case 184: + case 176: + case 197: + node = parent; + break; + case 261: + if (parent.name !== node) { + return 0; + } + node = parent.parent; + break; + case 260: + if (parent.name === node) { + return 0; + } + node = parent.parent; + break; + default: + return 0; + } + parent = node.parent; } } - function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { - if (!state.compilerOptions.rootDirs) { - return undefined; + ts.getAssignmentTargetKind = getAssignmentTargetKind; + function isAssignmentTarget(node) { + return getAssignmentTargetKind(node) !== 0; + } + ts.isAssignmentTarget = isAssignmentTarget; + function isDeleteTarget(node) { + if (node.kind !== 178 && node.kind !== 179) { + return false; } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + node = node.parent; + while (node && node.kind === 184) { + node = node.parent; } - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var matchedRootDir; - var matchedNormalizedPrefix; - for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { - var rootDir = _a[_i]; - var normalizedRoot = ts.normalizePath(rootDir); - if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { - normalizedRoot += ts.directorySeparator; - } - var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && - (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); - } - if (isLongestMatchingPrefix) { - matchedNormalizedPrefix = normalizedRoot; - matchedRootDir = rootDir; - } + return node && node.kind === 187; + } + ts.isDeleteTarget = isDeleteTarget; + function isNodeDescendantOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; } - if (matchedNormalizedPrefix) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); - } - var suffix = candidate.substr(matchedNormalizedPrefix.length); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); - } - var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); - if (resolvedFileName) { - return resolvedFileName; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); - } - for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { - var rootDir = _c[_b]; - if (rootDir === matchedRootDir) { - continue; - } - var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); - } - var baseDirectory = ts.getDirectoryPath(candidate_1); - var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); - if (resolvedFileName_1) { - return resolvedFileName_1; - } - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + return false; + } + ts.isNodeDescendantOf = isNodeDescendantOf; + function isInAmbientContext(node) { + while (node) { + if (hasModifier(node, 2) || (node.kind === 264 && node.isDeclarationFile)) { + return true; } + node = node.parent; } - return undefined; + return false; } - function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) { - if (!state.compilerOptions.baseUrl) { - return undefined; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); - } - var matchedPattern = undefined; - if (state.compilerOptions.paths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); - } - matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName); + ts.isInAmbientContext = isInAmbientContext; + function isDeclarationName(name) { + if (name.kind !== 70 && name.kind !== 9 && name.kind !== 8) { + return false; } - if (matchedPattern) { - var matchedStar_1 = typeof matchedPattern === "string" ? undefined : ts.matchedText(matchedPattern, moduleName); - var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : ts.patternText(matchedPattern); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); + var parent = name.parent; + if (parent.kind === 241 || parent.kind === 245) { + if (parent.propertyName) { + return true; } - return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) { - var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst; - var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); - } - var tsExtension = ts.tryGetExtensionFromPath(candidate); - if (tsExtension !== undefined) { - var path_1 = tryFile(candidate, failedLookupLocations, false, state); - return path_1 && { path: path_1, extension: tsExtension }; - } - return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); - }); } - else { - var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); - } - return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + if (isDeclaration(parent)) { + return parent.name === name; } + return false; } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { - var containingDirectory = ts.getDirectoryPath(containingFile); - var traceEnabled = isTraceEnabled(compilerOptions, host); - var failedLookupLocations = []; - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; - return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); - } - return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; - function tryResolve(extensions) { - var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); - if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; - } - if (moduleHasNonRelativeName(moduleName)) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + ts.isDeclarationName = isDeclarationName; + function isLiteralComputedPropertyDeclarationName(node) { + return (node.kind === 9 || node.kind === 8) && + node.parent.kind === 143 && + isDeclaration(node.parent.parent); + } + ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; + function isIdentifierName(node) { + var parent = node.parent; + switch (parent.kind) { + case 148: + case 147: + case 150: + case 149: + case 152: + case 153: + case 263: + case 260: + case 178: + return parent.name === node; + case 142: + if (parent.right === node) { + while (parent.kind === 142) { + parent = parent.parent; + } + return parent.kind === 161; } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; - } - else { - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; - } + return false; + case 175: + case 241: + return parent.propertyName === node; + case 245: + return true; } + return false; } - ts.nodeModuleNameResolver = nodeModuleNameResolver; - function realpath(path, host, traceEnabled) { - if (!host.realpath) { - return path; - } - var real = ts.normalizePath(host.realpath(path)); - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); - } - return real; + ts.isIdentifierName = isIdentifierName; + function isAliasSymbolDeclaration(node) { + return node.kind === 236 || + node.kind === 235 || + node.kind === 238 && !!node.name || + node.kind === 239 || + node.kind === 241 || + node.kind === 245 || + node.kind === 242 && exportAssignmentIsAlias(node); } - function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); - } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; + function exportAssignmentIsAlias(node) { + return isEntityNameExpression(node.expression); } - function directoryProbablyExists(directoryName, host) { - return !host.directoryExists || host.directoryExists(directoryName); + ts.exportAssignmentIsAlias = exportAssignmentIsAlias; + function getClassExtendsHeritageClauseElement(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 84); + return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } - ts.directoryProbablyExists = directoryProbablyExists; - function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state); - if (resolvedByAddingExtension) { - return resolvedByAddingExtension; - } - if (ts.hasJavaScriptFileExtension(candidate)) { - var extensionless = ts.removeFileExtension(candidate); - if (state.traceEnabled) { - var extension = candidate.substring(extensionless.length); - trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension); - } - return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state); - } + ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; + function getClassImplementsHeritageClauseElements(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 107); + return heritageClause ? heritageClause.types : undefined; } - function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures) { - var directory = ts.getDirectoryPath(candidate); - if (directory) { - onlyRecordFailures = !directoryProbablyExists(directory, state.host); + ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; + function getInterfaceBaseTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 84); + return heritageClause ? heritageClause.types : undefined; + } + ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; + function getHeritageClause(clauses, kind) { + if (clauses) { + for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { + var clause = clauses_1[_i]; + if (clause.token === kind) { + return clause; + } } } - switch (extensions) { - case 2: - return tryExtension(".d.ts", ts.Extension.Dts); - case 0: - return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: - return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); - } - function tryExtension(ext, extension) { - var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state); - return path && { path: path, extension: extension }; - } + return undefined; } - function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); - } - return fileName; + ts.getHeritageClause = getHeritageClause; + function tryResolveScriptReference(host, sourceFile, reference) { + if (!host.getCompilerOptions().noResolve) { + var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); + return host.getSourceFile(referenceFileName); } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } + ts.tryResolveScriptReference = tryResolveScriptReference; + function getAncestor(node, kind) { + while (node) { + if (node.kind === kind) { + return node; } - failedLookupLocations.push(fileName); - return undefined; + node = node.parent; } + return undefined; } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var packageJsonPath = pathToPackageJson(candidate); - var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); - } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; - } + ts.getAncestor = getAncestor; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.test(comment)) { + if (isNoDefaultLibRegEx.test(comment)) { + return { + isNoDefaultLib: true + }; } else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field); + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { + var start = commentRange.pos; + var end = commentRange.end; + return { + fileReference: { + pos: start, + end: end, + fileName: (refMatchResult || refLibResult)[3] + }, + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult + }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); - } - failedLookupLocations.push(packageJsonPath); - } - return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); - } - function pathToPackageJson(directory) { - return ts.combinePaths(directory, "package.json"); - } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || - loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); - } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); - } - function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return undefined; } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { - return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { - if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); - } - }); + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; + function isKeyword(token) { + return 71 <= token && token <= 141; } - function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { - if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); - if (packageResult) { - return packageResult; - } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); - } + ts.isKeyword = isKeyword; + function isTrivia(token) { + return 2 <= token && token <= 7; } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var failedLookupLocations = []; - var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); - function tryResolve(extensions) { - var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); - if (resolvedUsingSettings) { - return resolvedUsingSettings; - } - if (moduleHasNonRelativeName(moduleName)) { - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { - var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); - }); - if (resolved_3) { - return resolved_3; + ts.isTrivia = isTrivia; + var FunctionFlags; + (function (FunctionFlags) { + FunctionFlags[FunctionFlags["Normal"] = 0] = "Normal"; + FunctionFlags[FunctionFlags["Generator"] = 1] = "Generator"; + FunctionFlags[FunctionFlags["Async"] = 2] = "Async"; + FunctionFlags[FunctionFlags["AsyncOrAsyncGenerator"] = 3] = "AsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["Invalid"] = 4] = "Invalid"; + FunctionFlags[FunctionFlags["InvalidAsyncOrAsyncGenerator"] = 7] = "InvalidAsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["InvalidGenerator"] = 5] = "InvalidGenerator"; + })(FunctionFlags = ts.FunctionFlags || (ts.FunctionFlags = {})); + function getFunctionFlags(node) { + var flags = 0; + switch (node.kind) { + case 227: + case 185: + case 150: + if (node.asteriskToken) { + flags |= 1; } - if (extensions === 0) { - return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); + case 186: + if (hasModifier(node, 256)) { + flags |= 2; } - } - else { - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); - } + break; } - } - ts.classicNameResolver = classicNameResolver; - function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - if (traceEnabled) { - trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache); + if (!node.body) { + flags |= 4; } - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); - return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); + return flags; } - ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; - function forEachAncestorDirectory(directory, callback) { - while (true) { - var result = callback(directory); - if (result !== undefined) { - return result; - } - var parentPath = ts.getDirectoryPath(directory); - if (parentPath === directory) { - return undefined; - } - directory = parentPath; + ts.getFunctionFlags = getFunctionFlags; + function isAsyncFunction(node) { + switch (node.kind) { + case 227: + case 185: + case 186: + case 150: + return node.body !== undefined + && node.asteriskToken === undefined + && hasModifier(node, 256); } + return false; } -})(ts || (ts = {})); -var ts; -(function (ts) { - ts.externalHelpersModuleNameText = "tslib"; - function getDeclarationOfKind(symbol, kind) { - var declarations = symbol.declarations; - if (declarations) { - for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) { - var declaration = declarations_1[_i]; - if (declaration.kind === kind) { - return declaration; - } + ts.isAsyncFunction = isAsyncFunction; + function isNumericLiteral(node) { + return node.kind === 8; + } + ts.isNumericLiteral = isNumericLiteral; + function isStringOrNumericLiteral(node) { + var kind = node.kind; + return kind === 9 + || kind === 8; + } + ts.isStringOrNumericLiteral = isStringOrNumericLiteral; + function hasDynamicName(declaration) { + return declaration.name && isDynamicName(declaration.name); + } + ts.hasDynamicName = hasDynamicName; + function isDynamicName(name) { + return name.kind === 143 && + !isStringOrNumericLiteral(name.expression) && + !isWellKnownSymbolSyntactically(name.expression); + } + ts.isDynamicName = isDynamicName; + function isWellKnownSymbolSyntactically(node) { + return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 145) { + return name.text; + } + if (name.kind === 143) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + else if (nameExpression.kind === 9 || nameExpression.kind === 8) { + return nameExpression.text; } } return undefined; } - ts.getDeclarationOfKind = getDeclarationOfKind; - var stringWriters = []; - function getSingleLineStringWriter() { - if (stringWriters.length === 0) { - var str_1 = ""; - var writeText = function (text) { return str_1 += text; }; - return { - string: function () { return str_1; }, - writeKeyword: writeText, - writeOperator: writeText, - writePunctuation: writeText, - writeSpace: writeText, - writeStringLiteral: writeText, - writeParameter: writeText, - writeSymbol: writeText, - writeLine: function () { return str_1 += " "; }, - increaseIndent: ts.noop, - decreaseIndent: ts.noop, - clear: function () { return str_1 = ""; }, - trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop - }; - } - return stringWriters.pop(); - } - ts.getSingleLineStringWriter = getSingleLineStringWriter; - function releaseStringWriter(writer) { - writer.clear(); - stringWriters.push(writer); - } - ts.releaseStringWriter = releaseStringWriter; - function getFullWidth(node) { - return node.end - node.pos; - } - ts.getFullWidth = getFullWidth; - function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); - } - ts.hasResolvedModule = hasResolvedModule; - function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; - } - ts.getResolvedModule = getResolvedModule; - function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { - if (!sourceFile.resolvedModules) { - sourceFile.resolvedModules = ts.createMap(); - } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; - } - ts.setResolvedModule = setResolvedModule; - function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { - if (!sourceFile.resolvedTypeReferenceDirectiveNames) { - sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); - } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; } - ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; - function moduleResolutionIsEqualTo(oldResolution, newResolution) { - return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && - oldResolution.extension === newResolution.extension && - oldResolution.resolvedFileName === newResolution.resolvedFileName; + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 70 && node.text === "Symbol"; } - ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; - function typeDirectiveIsEqualTo(oldResolution, newResolution) { - return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + ts.isESSymbolIdentifier = isESSymbolIdentifier; + function isPushOrUnshiftIdentifier(node) { + return node.text === "push" || node.text === "unshift"; } - ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; - function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { - if (names.length !== newResolutions.length) { - return false; - } - for (var i = 0; i < names.length; i++) { - var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; - var changed = oldResolution - ? !newResolution || !comparer(oldResolution, newResolution) - : newResolution; - if (changed) { + ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; + function isModifierKind(token) { + switch (token) { + case 116: + case 119: + case 75: + case 123: + case 78: + case 83: + case 113: + case 111: + case 112: + case 130: + case 114: return true; - } } return false; } - ts.hasChangesInResolutions = hasChangesInResolutions; - function containsParseError(node) { - aggregateChildData(node); - return (node.flags & 4194304) !== 0; - } - ts.containsParseError = containsParseError; - function aggregateChildData(node) { - if (!(node.flags & 8388608)) { - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576) !== 0) || - ts.forEachChild(node, containsParseError); - if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304; - } - node.flags |= 8388608; - } + ts.isModifierKind = isModifierKind; + function isParameterDeclaration(node) { + var root = getRootDeclaration(node); + return root.kind === 145; } - function getSourceFileOfNode(node) { - while (node && node.kind !== 261) { - node = node.parent; + ts.isParameterDeclaration = isParameterDeclaration; + function getRootDeclaration(node) { + while (node.kind === 175) { + node = node.parent.parent; } return node; } - ts.getSourceFileOfNode = getSourceFileOfNode; - function isStatementWithLocals(node) { - switch (node.kind) { - case 204: - case 232: - case 211: - case 212: - case 213: - return true; - } - return false; + ts.getRootDeclaration = getRootDeclaration; + function nodeStartsNewLexicalEnvironment(node) { + var kind = node.kind; + return kind === 151 + || kind === 185 + || kind === 227 + || kind === 186 + || kind === 150 + || kind === 152 + || kind === 153 + || kind === 232 + || kind === 264; } - ts.isStatementWithLocals = isStatementWithLocals; - function getStartPositionOfLine(line, sourceFile) { - ts.Debug.assert(line >= 0); - return ts.getLineStarts(sourceFile)[line]; + ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; + function nodeIsSynthesized(node) { + return ts.positionIsSynthesized(node.pos) + || ts.positionIsSynthesized(node.end); } - ts.getStartPositionOfLine = getStartPositionOfLine; - function nodePosToString(node) { - var file = getSourceFileOfNode(node); - var loc = ts.getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; + ts.nodeIsSynthesized = nodeIsSynthesized; + function getOriginalSourceFileOrBundle(sourceFileOrBundle) { + if (sourceFileOrBundle.kind === 265) { + return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, getOriginalSourceFile)); + } + return getOriginalSourceFile(sourceFileOrBundle); } - ts.nodePosToString = nodePosToString; - function getStartPosOfNode(node) { - return node.pos; + ts.getOriginalSourceFileOrBundle = getOriginalSourceFileOrBundle; + function getOriginalSourceFile(sourceFile) { + return ts.getParseTreeNode(sourceFile, isSourceFile) || sourceFile; } - ts.getStartPosOfNode = getStartPosOfNode; - function isDefined(value) { - return value !== undefined; + function getOriginalSourceFiles(sourceFiles) { + return ts.sameMap(sourceFiles, getOriginalSourceFile); } - ts.isDefined = isDefined; - function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 0); - var lineStarts = ts.getLineStarts(sourceFile); - var lineIndex = line; - var sourceText = sourceFile.text; - if (lineIndex + 1 === lineStarts.length) { - return sourceText.length - 1; - } - else { - var start = lineStarts[lineIndex]; - var pos = lineStarts[lineIndex + 1] - 1; - ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); - while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { - pos--; - } - return pos; - } + ts.getOriginalSourceFiles = getOriginalSourceFiles; + function getOriginalNodeId(node) { + node = ts.getOriginalNode(node); + return node ? ts.getNodeId(node) : 0; } - ts.getEndLinePosition = getEndLinePosition; - function nodeIsMissing(node) { - if (node === undefined) { - return true; + ts.getOriginalNodeId = getOriginalNodeId; + var Associativity; + (function (Associativity) { + Associativity[Associativity["Left"] = 0] = "Left"; + Associativity[Associativity["Right"] = 1] = "Right"; + })(Associativity = ts.Associativity || (ts.Associativity = {})); + function getExpressionAssociativity(expression) { + var operator = getOperator(expression); + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; + return getOperatorAssociativity(expression.kind, operator, hasArguments); + } + ts.getExpressionAssociativity = getExpressionAssociativity; + function getOperatorAssociativity(kind, operator, hasArguments) { + switch (kind) { + case 181: + return hasArguments ? 0 : 1; + case 191: + case 188: + case 189: + case 187: + case 190: + case 194: + case 196: + return 1; + case 193: + switch (operator) { + case 39: + case 57: + case 58: + case 59: + case 61: + case 60: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 69: + case 68: + return 1; + } } - return node.pos === node.end && node.pos >= 0 && node.kind !== 1; + return 0; } - ts.nodeIsMissing = nodeIsMissing; - function nodeIsPresent(node) { - return !nodeIsMissing(node); + ts.getOperatorAssociativity = getOperatorAssociativity; + function getExpressionPrecedence(expression) { + var operator = getOperator(expression); + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; + return getOperatorPrecedence(expression.kind, operator, hasArguments); } - ts.nodeIsPresent = nodeIsPresent; - function getTokenPosOfNode(node, sourceFile, includeJsDoc) { - if (nodeIsMissing(node)) { - return node.pos; - } - if (isJSDocNode(node)) { - return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, true); - } - if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { - return getTokenPosOfNode(node.jsDoc[0]); + ts.getExpressionPrecedence = getExpressionPrecedence; + function getOperator(expression) { + if (expression.kind === 193) { + return expression.operatorToken.kind; } - if (node.kind === 292 && node._children.length > 0) { - return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); + else if (expression.kind === 191 || expression.kind === 192) { + return expression.operator; } - return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); - } - ts.getTokenPosOfNode = getTokenPosOfNode; - function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 288; - } - ts.isJSDocNode = isJSDocNode; - function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 291; - } - ts.isJSDocTag = isJSDocTag; - function getNonDecoratorTokenPosOfNode(node, sourceFile) { - if (nodeIsMissing(node) || !node.decorators) { - return getTokenPosOfNode(node, sourceFile); + else { + return expression.kind; } - return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end); } - ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode; - function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } - if (nodeIsMissing(node)) { - return ""; + ts.getOperator = getOperator; + function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { + switch (nodeKind) { + case 98: + case 96: + case 70: + case 94: + case 100: + case 85: + case 8: + case 9: + case 176: + case 177: + case 185: + case 186: + case 198: + case 248: + case 249: + case 11: + case 12: + case 195: + case 184: + case 199: + return 19; + case 182: + case 178: + case 179: + return 18; + case 181: + return hasArguments ? 18 : 17; + case 180: + return 17; + case 192: + return 16; + case 191: + case 188: + case 189: + case 187: + case 190: + return 15; + case 193: + switch (operatorKind) { + case 50: + case 51: + return 15; + case 39: + case 38: + case 40: + case 41: + return 14; + case 36: + case 37: + return 13; + case 44: + case 45: + case 46: + return 12; + case 26: + case 29: + case 28: + case 30: + case 91: + case 92: + return 11; + case 31: + case 33: + case 32: + case 34: + return 10; + case 47: + return 9; + case 49: + return 8; + case 48: + return 7; + case 52: + return 6; + case 53: + return 5; + case 57: + case 58: + case 59: + case 61: + case 60: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 69: + case 68: + return 3; + case 25: + return 0; + default: + return -1; + } + case 194: + return 4; + case 196: + return 2; + case 197: + return 1; + default: + return -1; } - var text = sourceFile.text; - return text.substring(includeTrivia ? node.pos : ts.skipTrivia(text, node.pos), node.end); } - ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; - function getTextOfNodeFromSourceText(sourceText, node) { - if (nodeIsMissing(node)) { - return ""; + ts.getOperatorPrecedence = getOperatorPrecedence; + function createDiagnosticCollection() { + var nonFileDiagnostics = []; + var fileDiagnostics = ts.createMap(); + var diagnosticsModified = false; + var modificationCount = 0; + return { + add: add, + getGlobalDiagnostics: getGlobalDiagnostics, + getDiagnostics: getDiagnostics, + getModificationCount: getModificationCount, + reattachFileDiagnostics: reattachFileDiagnostics + }; + function getModificationCount() { + return modificationCount; } - return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); - } - ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; - function getTextOfNode(node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } - return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); - } - ts.getTextOfNode = getTextOfNode; - function getLiteralText(node, sourceFile, languageVersion) { - if (languageVersion < 2 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); + function reattachFileDiagnostics(newFile) { + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } - if (!nodeIsSynthesized(node) && node.parent) { - var text = getSourceTextOfNodeFromSourceFile(sourceFile, node); - if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { - return node.text; + function add(diagnostic) { + var diagnostics; + if (diagnostic.file) { + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); + if (!diagnostics) { + diagnostics = []; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); + } } - return text; + else { + diagnostics = nonFileDiagnostics; + } + diagnostics.push(diagnostic); + diagnosticsModified = true; + modificationCount++; } - switch (node.kind) { - case 9: - return getQuotedEscapedLiteralText('"', node.text, '"'); - case 12: - return getQuotedEscapedLiteralText("`", node.text, "`"); - case 13: - return getQuotedEscapedLiteralText("`", node.text, "${"); - case 14: - return getQuotedEscapedLiteralText("}", node.text, "${"); - case 15: - return getQuotedEscapedLiteralText("}", node.text, "`"); - case 8: - return node.text; + function getGlobalDiagnostics() { + sortAndDeduplicate(); + return nonFileDiagnostics; } - ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); - } - ts.getLiteralText = getLiteralText; - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98: - case 66: - case 111: - case 79: - return true; + function getDiagnostics(fileName) { + sortAndDeduplicate(); + if (fileName) { + return fileDiagnostics.get(fileName) || []; + } + var allDiagnostics = []; + function pushDiagnostic(d) { + allDiagnostics.push(d); } + ts.forEach(nonFileDiagnostics, pushDiagnostic); + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function sortAndDeduplicate() { + if (!diagnosticsModified) { + return; + } + diagnosticsModified = false; + nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } - return false; } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; - function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { - return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; + ts.createDiagnosticCollection = createDiagnosticCollection; + var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + var escapedCharsMap = ts.createMapFromTemplate({ + "\0": "\\0", + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\r": "\\r", + "\n": "\\n", + "\\": "\\\\", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }); + function escapeString(s) { + return s.replace(escapedCharsRegExp, getReplacement); } - function escapeIdentifier(identifier) { - return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; + ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } - ts.escapeIdentifier = escapeIdentifier; - function unescapeIdentifier(identifier) { - return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; + function isIntrinsicJsxName(name) { + var ch = name.substr(0, 1); + return ch.toLowerCase() === ch; } - ts.unescapeIdentifier = unescapeIdentifier; - function makeIdentifierFromModuleName(moduleName) { - return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); + ts.isIntrinsicJsxName = isIntrinsicJsxName; + function get16BitUnicodeEscapeSequence(charCode) { + var hexCharCode = charCode.toString(16).toUpperCase(); + var paddedHexCode = ("0000" + hexCharCode).slice(-4); + return "\\u" + paddedHexCode; } - ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; - function isBlockOrCatchScoped(declaration) { - return (ts.getCombinedNodeFlags(declaration) & 3) !== 0 || - isCatchClauseVariableDeclarationOrBindingElement(declaration); + var nonAsciiCharacters = /[^\u0000-\u007F]/g; + function escapeNonAsciiCharacters(s) { + return nonAsciiCharacters.test(s) ? + s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : + s; } - ts.isBlockOrCatchScoped = isBlockOrCatchScoped; - function isCatchClauseVariableDeclarationOrBindingElement(declaration) { - var node = getRootDeclaration(declaration); - return node.kind === 223 && node.parent.kind === 256; + ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; + var indentStrings = ["", " "]; + function getIndentString(level) { + if (indentStrings[level] === undefined) { + indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + } + return indentStrings[level]; } - ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; - function isAmbientModule(node) { - return node && node.kind === 230 && - (node.name.kind === 9 || isGlobalScopeAugmentation(node)); + ts.getIndentString = getIndentString; + function getIndentSize() { + return indentStrings[1].length; } - ts.isAmbientModule = isAmbientModule; - function isShorthandAmbientModuleSymbol(moduleSymbol) { - return isShorthandAmbientModule(moduleSymbol.valueDeclaration); - } - ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; - function isShorthandAmbientModule(node) { - return node.kind === 230 && (!node.body); - } - function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 || - node.kind === 230 || - isFunctionLike(node); - } - ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; - function isGlobalScopeAugmentation(module) { - return !!(module.flags & 512); - } - ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; - function isExternalModuleAugmentation(node) { - if (!node || !isAmbientModule(node)) { - return false; + ts.getIndentSize = getIndentSize; + function createTextWriter(newLine) { + var output; + var indent; + var lineStart; + var lineCount; + var linePos; + function write(s) { + if (s && s.length) { + if (lineStart) { + output += getIndentString(indent); + lineStart = false; + } + output += s; + } } - switch (node.parent.kind) { - case 261: - return ts.isExternalModule(node.parent); - case 231: - return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); + function reset() { + output = ""; + indent = 0; + lineStart = true; + lineCount = 0; + linePos = 0; } - return false; - } - ts.isExternalModuleAugmentation = isExternalModuleAugmentation; - function isBlockScope(node, parentNode) { - switch (node.kind) { - case 261: - case 232: - case 256: - case 230: - case 211: - case 212: - case 213: - case 150: - case 149: - case 151: - case 152: - case 225: - case 184: - case 185: - return true; - case 204: - return parentNode && !isFunctionLike(parentNode); + function rawWrite(s) { + if (s !== undefined) { + if (lineStart) { + lineStart = false; + } + output += s; + } } - return false; - } - ts.isBlockScope = isBlockScope; - function getEnclosingBlockScopeContainer(node) { - var current = node.parent; - while (current) { - if (isBlockScope(current, current.parent)) { - return current; + function writeLiteral(s) { + if (s && s.length) { + write(s); + var lineStartsOfS = ts.computeLineStarts(s); + if (lineStartsOfS.length > 1) { + lineCount = lineCount + lineStartsOfS.length - 1; + linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS); + } + } + } + function writeLine() { + if (!lineStart) { + output += newLine; + lineCount++; + linePos = output.length; + lineStart = true; } - current = current.parent; } + function writeTextOfNode(text, node) { + write(getTextOfNodeFromSourceText(text, node)); + } + reset(); + return { + write: write, + rawWrite: rawWrite, + writeTextOfNode: writeTextOfNode, + writeLiteral: writeLiteral, + writeLine: writeLine, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; }, + isAtStartOfLine: function () { return lineStart; }, + reset: reset + }; } - ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; - function declarationNameToString(name) { - return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + ts.createTextWriter = createTextWriter; + function getResolvedExternalModuleName(host, file) { + return file.moduleName || getExternalModuleNameFromPath(host, file.fileName); } - ts.declarationNameToString = declarationNameToString; - function getTextOfPropertyName(name) { - switch (name.kind) { - case 70: - return name.text; - case 9: - case 8: - return name.text; - case 142: - if (isStringOrNumericLiteral(name.expression)) { - return name.expression.text; - } + ts.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || isDeclarationFile(file)) { + return undefined; } - return undefined; + return getResolvedExternalModuleName(host, file); } - ts.getTextOfPropertyName = getTextOfPropertyName; - function entityNameToString(name) { - switch (name.kind) { - case 70: - return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141: - return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177: - return entityNameToString(name.expression) + "." + entityNameToString(name.name); - } + ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; + function getExternalModuleNameFromPath(host, fileName) { + var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); }; + var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false); + return ts.removeFileExtension(relativePath); } - ts.entityNameToString = entityNameToString; - function createDiagnosticForNode(node, message, arg0, arg1, arg2) { - var sourceFile = getSourceFileOfNode(node); - return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); + ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; + function getOwnEmitOutputFilePath(sourceFile, host, extension) { + var compilerOptions = host.getCompilerOptions(); + var emitOutputFilePathWithoutExtension; + if (compilerOptions.outDir) { + emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + } + else { + emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + } + return emitOutputFilePathWithoutExtension + extension; } - ts.createDiagnosticForNode = createDiagnosticForNode; - function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) { - var span = getErrorSpanForNode(sourceFile, node); - return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); + ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; + var path = outputDir + ? getSourceFilePathInNewDir(sourceFile, host, outputDir) + : sourceFile.fileName; + return ts.removeFileExtension(path) + ".d.ts"; } - ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile; - function createDiagnosticForNodeFromMessageChain(node, messageChain) { - var sourceFile = getSourceFileOfNode(node); - var span = getErrorSpanForNode(sourceFile, node); - return { - file: sourceFile, - start: span.start, - length: span.length, - code: messageChain.code, - category: messageChain.category, - messageText: messageChain.next ? messageChain : messageChain.messageText - }; + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; + function getSourceFilesToEmit(host, targetSourceFile) { + var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; + if (options.outFile || options.out) { + var moduleKind = ts.getEmitModuleKind(options); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); + } + else { + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); + } } - ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; - function getSpanOfTokenAtPosition(sourceFile, pos) { - var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos); - scanner.scan(); - var start = scanner.getTokenPos(); - return ts.createTextSpanFromBounds(start, scanner.getTextPos()); + ts.getSourceFilesToEmit = getSourceFilesToEmit; + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } - ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; - function getErrorSpanForArrowFunction(sourceFile, node) { - var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204) { - var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; - var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; - if (startLine < endLine) { - return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); + var options = host.getCompilerOptions(); + if (options.outFile || options.out) { + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : ""; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, ts.createBundle(sourceFiles), emitOnlyDtsFiles); + } + } + else { + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFile, emitOnlyDtsFiles); } } - return ts.createTextSpanFromBounds(pos, node.end); } - function getErrorSpanForNode(sourceFile, node) { - var errorNode = node; - switch (node.kind) { - case 261: - var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); - if (pos_1 === sourceFile.text.length) { - return ts.createTextSpan(0, 0); + ts.forEachEmittedFile = forEachEmittedFile; + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } - return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 223: - case 174: - case 226: - case 197: - case 227: - case 230: - case 229: - case 260: - case 225: - case 184: - case 149: - case 151: - case 152: - case 228: - errorNode = node.name; - break; - case 185: - return getErrorSpanForArrowFunction(sourceFile, node); - } - if (errorNode === undefined) { - return getSpanOfTokenAtPosition(sourceFile, node.pos); + } + else if (sourceFile.languageVariant === 1) { + return ".jsx"; + } } - var pos = nodeIsMissing(errorNode) - ? errorNode.pos - : ts.skipTrivia(sourceFile.text, errorNode.pos); - return ts.createTextSpanFromBounds(pos, errorNode.end); + return ".js"; } - ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalOrCommonJsModule(file) { - return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; + function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); + var commonSourceDirectory = host.getCommonSourceDirectory(); + var isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0; + sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath; + return ts.combinePaths(newDirPath, sourceFilePath); } - ts.isExternalOrCommonJsModule = isExternalOrCommonJsModule; - function isDeclarationFile(file) { - return file.isDeclarationFile; + ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { + host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }, sourceFiles); } - ts.isDeclarationFile = isDeclarationFile; - function isConstEnumDeclaration(node) { - return node.kind === 229 && isConst(node); + ts.writeFile = writeFile; + function getLineOfLocalPosition(currentSourceFile, pos) { + return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } - ts.isConstEnumDeclaration = isConstEnumDeclaration; - function isConst(node) { - return !!(ts.getCombinedNodeFlags(node) & 2) - || !!(ts.getCombinedModifierFlags(node) & 2048); + ts.getLineOfLocalPosition = getLineOfLocalPosition; + function getLineOfLocalPositionFromLineMap(lineMap, pos) { + return ts.computeLineAndCharacterOfPosition(lineMap, pos).line; } - ts.isConst = isConst; - function isLet(node) { - return !!(ts.getCombinedNodeFlags(node) & 1); + ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; + function getFirstConstructorWithBody(node) { + return ts.forEach(node.members, function (member) { + if (member.kind === 151 && nodeIsPresent(member.body)) { + return member; + } + }); } - ts.isLet = isLet; - function isSuperCall(n) { - return n.kind === 179 && n.expression.kind === 96; + ts.getFirstConstructorWithBody = getFirstConstructorWithBody; + function getSetAccessorTypeAnnotationNode(accessor) { + if (accessor && accessor.parameters.length > 0) { + var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]); + return accessor.parameters[hasThis ? 1 : 0].type; + } } - ts.isSuperCall = isSuperCall; - function isPrologueDirective(node) { - return node.kind === 207 - && node.expression.kind === 9; + ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; + function getThisParameter(signature) { + if (signature.parameters.length) { + var thisParameter = signature.parameters[0]; + if (parameterIsThisKeyword(thisParameter)) { + return thisParameter; + } + } } - ts.isPrologueDirective = isPrologueDirective; - function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + ts.getThisParameter = getThisParameter; + function parameterIsThisKeyword(parameter) { + return isThisIdentifier(parameter.name); } - ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; - function getLeadingCommentRangesOfNodeFromText(node, text) { - return ts.getLeadingCommentRanges(text, node.pos); + ts.parameterIsThisKeyword = parameterIsThisKeyword; + function isThisIdentifier(node) { + return node && node.kind === 70 && identifierIsThisKeyword(node); } - ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; - function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 || - node.kind === 143 || - node.kind === 184 || - node.kind === 185) ? - ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : - getLeadingCommentRangesOfNodeFromText(node, text); - return ts.filter(commentRanges, function (comment) { - return text.charCodeAt(comment.pos + 1) === 42 && - text.charCodeAt(comment.pos + 2) === 42 && - text.charCodeAt(comment.pos + 3) !== 47; - }); + ts.isThisIdentifier = isThisIdentifier; + function identifierIsThisKeyword(id) { + return id.originalKeywordKind === 98; } - ts.getJSDocCommentRanges = getJSDocCommentRanges; - ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; - ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; - ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; - function isPartOfTypeNode(node) { - if (156 <= node.kind && node.kind <= 171) { - return true; + ts.identifierIsThisKeyword = identifierIsThisKeyword; + function getAllAccessorDeclarations(declarations, accessor) { + var firstAccessor; + var secondAccessor; + var getAccessor; + var setAccessor; + if (hasDynamicName(accessor)) { + firstAccessor = accessor; + if (accessor.kind === 152) { + getAccessor = accessor; + } + else if (accessor.kind === 153) { + setAccessor = accessor; + } + else { + ts.Debug.fail("Accessor has wrong kind"); + } } - switch (node.kind) { - case 118: - case 132: - case 134: - case 121: - case 135: - case 137: - case 129: - return true; - case 104: - return node.parent.kind !== 188; - case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 70: - if (node.parent.kind === 141 && node.parent.right === node) { - node = node.parent; - } - else if (node.parent.kind === 177 && node.parent.name === node) { - node = node.parent; + else { + ts.forEach(declarations, function (member) { + if ((member.kind === 152 || member.kind === 153) + && hasModifier(member, 32) === hasModifier(accessor, 32)) { + var memberName = getPropertyNameForPropertyNameNode(member.name); + var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + else if (!secondAccessor) { + secondAccessor = member; + } + if (member.kind === 152 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 153 && !setAccessor) { + setAccessor = member; + } + } } - ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141: - case 177: - case 98: - var parent_1 = node.parent; - if (parent_1.kind === 160) { - return false; + }); + } + return { + firstAccessor: firstAccessor, + secondAccessor: secondAccessor, + getAccessor: getAccessor, + setAccessor: setAccessor + }; + } + ts.getAllAccessorDeclarations = getAllAccessorDeclarations; + function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { + emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments); + } + ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; + function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) { + if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos && + getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { + writer.writeLine(); + } + } + ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition; + function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) { + if (pos !== commentPos && + getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) { + writer.writeLine(); + } + } + ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition; + function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) { + if (comments && comments.length > 0) { + if (leadingSeparator) { + writer.write(" "); + } + var emitInterveningSeparator = false; + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + if (emitInterveningSeparator) { + writer.write(" "); + emitInterveningSeparator = false; } - if (156 <= parent_1.kind && parent_1.kind <= 171) { - return true; + writeComment(text, lineMap, writer, comment.pos, comment.end, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); } - switch (parent_1.kind) { - case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143: - return node === parent_1.constraint; - case 147: - case 146: - case 144: - case 223: - return node === parent_1.type; - case 225: - case 184: - case 185: - case 150: - case 149: - case 148: - case 151: - case 152: - return node === parent_1.type; - case 153: - case 154: - case 155: - return node === parent_1.type; - case 182: - return node === parent_1.type; - case 179: - case 180: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 181: - return false; + else { + emitInterveningSeparator = true; } + } + if (emitInterveningSeparator && trailingSeparator) { + writer.write(" "); + } } - return false; } - ts.isPartOfTypeNode = isPartOfTypeNode; - function forEachReturnStatement(body, visitor) { - return traverse(body); - function traverse(node) { - switch (node.kind) { - case 216: - return visitor(node); - case 232: - case 204: - case 208: - case 209: - case 210: - case 211: - case 212: - case 213: - case 217: - case 218: - case 253: - case 254: - case 219: - case 221: - case 256: - return ts.forEachChild(node, traverse); + ts.emitComments = emitComments; + function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { + var leadingComments; + var currentDetachedCommentInfo; + if (removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); } } - } - ts.forEachReturnStatement = forEachReturnStatement; - function forEachYieldExpression(body, visitor) { - return traverse(body); - function traverse(node) { - switch (node.kind) { - case 195: - visitor(node); - var operand = node.expression; - if (operand) { - traverse(operand); + else { + leadingComments = ts.getLeadingCommentRanges(text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment = void 0; + for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { + var comment = leadingComments_1[_i]; + if (lastComment) { + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); + var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); + if (commentLine >= lastCommentLine + 2) { + break; } - case 229: - case 227: - case 230: - case 228: - case 226: - case 197: - return; - default: - if (isFunctionLike(node)) { - var name_7 = node.name; - if (name_7 && name_7.kind === 142) { - traverse(name_7.expression); - return; + } + detachedComments.push(comment); + lastComment = comment; + } + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end); + var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); + emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment); + currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + } + } + } + return currentDetachedCommentInfo; + function isPinnedComment(comment) { + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 33; + } + } + ts.emitDetachedComments = emitDetachedComments; + function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) { + if (text.charCodeAt(commentPos + 1) === 42) { + var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos); + var lineCount = lineMap.length; + var firstCommentLineIndent = void 0; + for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) { + var nextLineStart = (currentLine + 1) === lineCount + ? text.length + 1 + : lineMap[currentLine + 1]; + if (pos !== commentPos) { + if (firstCommentLineIndent === undefined) { + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos); + } + var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); + if (spacesToEmit > 0) { + var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + writer.rawWrite(indentSizeSpaceString); + while (numberOfSingleSpacesToEmit) { + writer.rawWrite(" "); + numberOfSingleSpacesToEmit--; } } - else if (!isPartOfTypeNode(node)) { - ts.forEachChild(node, traverse); + else { + writer.rawWrite(""); } + } + writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart); + pos = nextLineStart; } } + else { + writer.write(text.substring(commentPos, commentEnd)); + } } - ts.forEachYieldExpression = forEachYieldExpression; - function isVariableLike(node) { - if (node) { - switch (node.kind) { - case 174: - case 260: - case 144: - case 257: - case 147: - case 146: - case 258: - case 223: - return true; + ts.writeCommentRange = writeCommentRange; + function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) { + var end = Math.min(commentEnd, nextLineStart - 1); + var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); + if (currentLineText) { + writer.write(currentLineText); + if (end !== commentEnd) { + writer.writeLine(); } } - return false; + else { + writer.writeLiteral(newLine); + } } - ts.isVariableLike = isVariableLike; - function isAccessor(node) { - return node && (node.kind === 151 || node.kind === 152); + function calculateIndent(text, pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) { + if (text.charCodeAt(pos) === 9) { + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + currentLineIndent++; + } + } + return currentLineIndent; } - ts.isAccessor = isAccessor; - function isClassLike(node) { - return node && (node.kind === 226 || node.kind === 197); + function hasModifiers(node) { + return getModifierFlags(node) !== 0; } - ts.isClassLike = isClassLike; - function isFunctionLike(node) { - return node && isFunctionLikeKind(node.kind); + ts.hasModifiers = hasModifiers; + function hasModifier(node, flags) { + return (getModifierFlags(node) & flags) !== 0; } - ts.isFunctionLike = isFunctionLike; - function isFunctionLikeKind(kind) { - switch (kind) { - case 150: - case 184: - case 225: - case 185: - case 149: - case 148: - case 151: - case 152: - case 153: - case 154: - case 155: - case 158: - case 159: - return true; + ts.hasModifier = hasModifier; + function getModifierFlags(node) { + if (node.modifierFlagsCache & 536870912) { + return node.modifierFlagsCache & ~536870912; } - return false; + var flags = 0; + if (node.modifiers) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; + flags |= modifierToFlag(modifier.kind); + } + } + if (node.flags & 4 || (node.kind === 70 && node.isInJSDocNamespace)) { + flags |= 1; + } + node.modifierFlagsCache = flags | 536870912; + return flags; } - ts.isFunctionLikeKind = isFunctionLikeKind; - function introducesArgumentsExoticObject(node) { - switch (node.kind) { - case 149: - case 148: - case 150: - case 151: - case 152: - case 225: - case 184: - return true; + ts.getModifierFlags = getModifierFlags; + function modifierToFlag(token) { + switch (token) { + case 114: return 32; + case 113: return 4; + case 112: return 16; + case 111: return 8; + case 116: return 128; + case 83: return 1; + case 123: return 2; + case 75: return 2048; + case 78: return 512; + case 119: return 256; + case 130: return 64; } - return false; + return 0; } - ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; - function isIterationStatement(node, lookInLabeledStatements) { - switch (node.kind) { - case 211: - case 212: - case 213: - case 209: - case 210: - return true; - case 219: - return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); + ts.modifierToFlag = modifierToFlag; + function isLogicalOperator(token) { + return token === 53 + || token === 52 + || token === 50; + } + ts.isLogicalOperator = isLogicalOperator; + function isAssignmentOperator(token) { + return token >= 57 && token <= 69; + } + ts.isAssignmentOperator = isAssignmentOperator; + function tryGetClassExtendingExpressionWithTypeArguments(node) { + if (node.kind === 200 && + node.parent.token === 84 && + isClassLike(node.parent.parent)) { + return node.parent.parent; + } + } + ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; + function isAssignmentExpression(node, excludeCompoundAssignment) { + return isBinaryExpression(node) + && (excludeCompoundAssignment + ? node.operatorToken.kind === 57 + : isAssignmentOperator(node.operatorToken.kind)) + && isLeftHandSideExpression(node.left); + } + ts.isAssignmentExpression = isAssignmentExpression; + function isDestructuringAssignment(node) { + if (isAssignmentExpression(node, true)) { + var kind = node.left.kind; + return kind === 177 + || kind === 176; } return false; } - ts.isIterationStatement = isIterationStatement; - function isFunctionBlock(node) { - return node && node.kind === 204 && isFunctionLike(node.parent); + ts.isDestructuringAssignment = isDestructuringAssignment; + function isSupportedExpressionWithTypeArguments(node) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } - ts.isFunctionBlock = isFunctionBlock; - function isObjectLiteralMethod(node) { - return node && node.kind === 149 && node.parent.kind === 176; + ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; + function isSupportedExpressionWithTypeArgumentsRest(node) { + if (node.kind === 70) { + return true; + } + else if (isPropertyAccessExpression(node)) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); + } + else { + return false; + } } - ts.isObjectLiteralMethod = isObjectLiteralMethod; - function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 && - (node.parent.kind === 176 || - node.parent.kind === 197); + function isExpressionWithTypeArgumentsInClassExtendsClause(node) { + return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; } - ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; - function isIdentifierTypePredicate(predicate) { - return predicate && predicate.kind === 1; + ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; + function isExpressionWithTypeArgumentsInClassImplementsClause(node) { + return node.kind === 200 + && isEntityNameExpression(node.expression) + && node.parent + && node.parent.token === 107 + && node.parent.parent + && isClassLike(node.parent.parent); + } + ts.isExpressionWithTypeArgumentsInClassImplementsClause = isExpressionWithTypeArgumentsInClassImplementsClause; + function isEntityNameExpression(node) { + return node.kind === 70 || + node.kind === 178 && isEntityNameExpression(node.expression); } - ts.isIdentifierTypePredicate = isIdentifierTypePredicate; - function isThisTypePredicate(predicate) { - return predicate && predicate.kind === 0; + ts.isEntityNameExpression = isEntityNameExpression; + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 142 && node.parent.right === node) || + (node.parent.kind === 178 && node.parent.name === node); } - ts.isThisTypePredicate = isThisTypePredicate; - function getContainingFunction(node) { - while (true) { - node = node.parent; - if (!node || isFunctionLike(node)) { - return node; - } - } + ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function isEmptyObjectLiteral(expression) { + return expression.kind === 177 && + expression.properties.length === 0; } - ts.getContainingFunction = getContainingFunction; - function getContainingClass(node) { - while (true) { - node = node.parent; - if (!node || isClassLike(node)) { - return node; + ts.isEmptyObjectLiteral = isEmptyObjectLiteral; + function isEmptyArrayLiteral(expression) { + return expression.kind === 176 && + expression.elements.length === 0; + } + ts.isEmptyArrayLiteral = isEmptyArrayLiteral; + function getLocalSymbolForExportDefault(symbol) { + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; + } + ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512); + } + function tryExtractTypeScriptExtension(fileName) { + return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); + } + ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension; + function getExpandedCharCodes(input) { + var output = []; + var length = input.length; + for (var i = 0; i < length; i++) { + var charCode = input.charCodeAt(i); + if (charCode < 0x80) { + output.push(charCode); + } + else if (charCode < 0x800) { + output.push((charCode >> 6) | 192); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x10000) { + output.push((charCode >> 12) | 224); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x20000) { + output.push((charCode >> 18) | 240); + output.push(((charCode >> 12) & 63) | 128); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else { + ts.Debug.assert(false, "Unexpected code point"); } } + return output; } - ts.getContainingClass = getContainingClass; - function getThisContainer(node, includeArrowFunctions) { - while (true) { - node = node.parent; - if (!node) { - return undefined; + var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + function convertToBase64(input) { + var result = ""; + var charCodes = getExpandedCharCodes(input); + var i = 0; + var length = charCodes.length; + var byte1, byte2, byte3, byte4; + while (i < length) { + byte1 = charCodes[i] >> 2; + byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4; + byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6; + byte4 = charCodes[i + 2] & 63; + if (i + 1 >= length) { + byte3 = byte4 = 64; } - switch (node.kind) { - case 142: - if (isClassLike(node.parent.parent)) { - return node; - } - node = node.parent; - break; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { - node = node.parent.parent; - } - else if (isClassElement(node.parent)) { - node = node.parent; - } - break; - case 185: - if (!includeArrowFunctions) { - continue; - } - case 225: - case 184: - case 230: - case 147: - case 146: - case 149: - case 148: - case 150: - case 151: - case 152: - case 153: - case 154: - case 155: - case 229: - case 261: - return node; + else if (i + 2 >= length) { + byte4 = 64; } + result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); + i += 3; } + return result; } - ts.getThisContainer = getThisContainer; - function getSuperContainer(node, stopOnFunctions) { - while (true) { - node = node.parent; - if (!node) { - return node; + ts.convertToBase64 = convertToBase64; + var carriageReturnLineFeed = "\r\n"; + var lineFeed = "\n"; + function getNewLineCharacter(options) { + if (options.newLine === 0) { + return carriageReturnLineFeed; + } + else if (options.newLine === 1) { + return lineFeed; + } + else if (ts.sys) { + return ts.sys.newLine; + } + return carriageReturnLineFeed; + } + ts.getNewLineCharacter = getNewLineCharacter; + function isSimpleExpression(node) { + return isSimpleExpressionWorker(node, 0); + } + ts.isSimpleExpression = isSimpleExpression; + function isSimpleExpressionWorker(node, depth) { + if (depth <= 5) { + var kind = node.kind; + if (kind === 9 + || kind === 8 + || kind === 11 + || kind === 12 + || kind === 70 + || kind === 98 + || kind === 96 + || kind === 100 + || kind === 85 + || kind === 94) { + return true; } - switch (node.kind) { - case 142: - node = node.parent; - break; - case 225: - case 184: - case 185: - if (!stopOnFunctions) { - continue; - } - case 147: - case 146: - case 149: - case 148: - case 150: - case 151: - case 152: - return node; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { - node = node.parent.parent; - } - else if (isClassElement(node.parent)) { - node = node.parent; + else if (kind === 178) { + return isSimpleExpressionWorker(node.expression, depth + 1); + } + else if (kind === 179) { + return isSimpleExpressionWorker(node.expression, depth + 1) + && isSimpleExpressionWorker(node.argumentExpression, depth + 1); + } + else if (kind === 191 + || kind === 192) { + return isSimpleExpressionWorker(node.operand, depth + 1); + } + else if (kind === 193) { + return node.operatorToken.kind !== 39 + && isSimpleExpressionWorker(node.left, depth + 1) + && isSimpleExpressionWorker(node.right, depth + 1); + } + else if (kind === 194) { + return isSimpleExpressionWorker(node.condition, depth + 1) + && isSimpleExpressionWorker(node.whenTrue, depth + 1) + && isSimpleExpressionWorker(node.whenFalse, depth + 1); + } + else if (kind === 189 + || kind === 188 + || kind === 187) { + return isSimpleExpressionWorker(node.expression, depth + 1); + } + else if (kind === 176) { + return node.elements.length === 0; + } + else if (kind === 177) { + return node.properties.length === 0; + } + else if (kind === 180) { + if (!isSimpleExpressionWorker(node.expression, depth + 1)) { + return false; + } + for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (!isSimpleExpressionWorker(argument, depth + 1)) { + return false; } - break; + } + return true; } } + return false; } - ts.getSuperContainer = getSuperContainer; - function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 || func.kind === 185) { - var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183) { - prev = parent_2; - parent_2 = parent_2.parent; + var syntaxKindCache = []; + function formatSyntaxKind(kind) { + var syntaxKindEnum = ts.SyntaxKind; + if (syntaxKindEnum) { + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - if (parent_2.kind === 179 && parent_2.expression === prev) { - return parent_2; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; + } } } - } - ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; - function isSuperProperty(node) { - var kind = node.kind; - return (kind === 177 || kind === 178) - && node.expression.kind === 96; - } - ts.isSuperProperty = isSuperProperty; - function getEntityNameFromTypeNode(node) { - switch (node.kind) { - case 157: - case 272: - return node.typeName; - case 199: - return isEntityNameExpression(node.expression) - ? node.expression - : undefined; - case 70: - case 141: - return node; + else { + return kind.toString(); } - return undefined; } - ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; - function isCallLikeExpression(node) { - switch (node.kind) { - case 179: - case 180: - case 181: - case 145: - return true; - default: - return false; - } + ts.formatSyntaxKind = formatSyntaxKind; + function getRangePos(range) { + return range ? range.pos : -1; } - ts.isCallLikeExpression = isCallLikeExpression; - function getInvokedExpression(node) { - if (node.kind === 181) { - return node.tag; - } - return node.expression; - } - ts.getInvokedExpression = getInvokedExpression; - function nodeCanBeDecorated(node) { - switch (node.kind) { - case 226: - return true; - case 147: - return node.parent.kind === 226; - case 151: - case 152: - case 149: - return node.body !== undefined - && node.parent.kind === 226; - case 144: - return node.parent.body !== undefined - && (node.parent.kind === 150 - || node.parent.kind === 149 - || node.parent.kind === 152) - && node.parent.parent.kind === 226; - } - return false; - } - ts.nodeCanBeDecorated = nodeCanBeDecorated; - function nodeIsDecorated(node) { - return node.decorators !== undefined - && nodeCanBeDecorated(node); + ts.getRangePos = getRangePos; + function getRangeEnd(range) { + return range ? range.end : -1; } - ts.nodeIsDecorated = nodeIsDecorated; - function nodeOrChildIsDecorated(node) { - return nodeIsDecorated(node) || childIsDecorated(node); + ts.getRangeEnd = getRangeEnd; + function movePos(pos, value) { + return ts.positionIsSynthesized(pos) ? -1 : pos + value; } - ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; - function childIsDecorated(node) { - switch (node.kind) { - case 226: - return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149: - case 152: - return ts.forEach(node.parameters, nodeIsDecorated); - } + ts.movePos = movePos; + function createRange(pos, end) { + return { pos: pos, end: end }; } - ts.childIsDecorated = childIsDecorated; - function isJSXTagName(node) { - var parent = node.parent; - if (parent.kind === 248 || - parent.kind === 247 || - parent.kind === 249) { - return parent.tagName === node; - } - return false; + ts.createRange = createRange; + function moveRangeEnd(range, end) { + return createRange(range.pos, end); } - ts.isJSXTagName = isJSXTagName; - function isPartOfExpression(node) { - switch (node.kind) { - case 98: - case 96: - case 94: - case 100: - case 85: - case 11: - case 175: - case 176: - case 177: - case 178: - case 179: - case 180: - case 181: - case 200: - case 182: - case 201: - case 183: - case 184: - case 197: - case 185: - case 188: - case 186: - case 187: - case 190: - case 191: - case 192: - case 193: - case 196: - case 194: - case 12: - case 198: - case 246: - case 247: - case 195: - case 189: - return true; - case 141: - while (node.parent.kind === 141) { - node = node.parent; - } - return node.parent.kind === 160 || isJSXTagName(node); - case 70: - if (node.parent.kind === 160 || isJSXTagName(node)) { - return true; - } - case 8: - case 9: - case 98: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 223: - case 144: - case 147: - case 146: - case 260: - case 257: - case 174: - return parent_3.initializer === node; - case 207: - case 208: - case 209: - case 210: - case 216: - case 217: - case 218: - case 253: - case 220: - case 218: - return parent_3.expression === node; - case 211: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224) || - forStatement.condition === node || - forStatement.incrementor === node; - case 212: - case 213: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) || - forInStatement.expression === node; - case 182: - case 200: - return node === parent_3.expression; - case 202: - return node === parent_3.expression; - case 142: - return node === parent_3.expression; - case 145: - case 252: - case 251: - case 259: - return true; - case 199: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); - default: - if (isPartOfExpression(parent_3)) { - return true; - } - } - } - return false; + ts.moveRangeEnd = moveRangeEnd; + function moveRangePos(range, pos) { + return createRange(pos, range.end); } - ts.isPartOfExpression = isPartOfExpression; - function isInstantiatedModule(node, preserveConstEnums) { - var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); + ts.moveRangePos = moveRangePos; + function moveRangePastDecorators(node) { + return node.decorators && node.decorators.length > 0 + ? moveRangePos(node, node.decorators.end) + : node; } - ts.isInstantiatedModule = isInstantiatedModule; - function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind === 245; + ts.moveRangePastDecorators = moveRangePastDecorators; + function moveRangePastModifiers(node) { + return node.modifiers && node.modifiers.length > 0 + ? moveRangePos(node, node.modifiers.end) + : moveRangePastDecorators(node); } - ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; - function getExternalModuleImportEqualsDeclarationExpression(node) { - ts.Debug.assert(isExternalModuleImportEqualsDeclaration(node)); - return node.moduleReference.expression; + ts.moveRangePastModifiers = moveRangePastModifiers; + function isCollapsedRange(range) { + return range.pos === range.end; } - ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; - function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind !== 245; + ts.isCollapsedRange = isCollapsedRange; + function collapseRangeToStart(range) { + return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos); } - ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; - function isSourceFileJavaScript(file) { - return isInJavaScriptFile(file); + ts.collapseRangeToStart = collapseRangeToStart; + function collapseRangeToEnd(range) { + return isCollapsedRange(range) ? range : moveRangePos(range, range.end); } - ts.isSourceFileJavaScript = isSourceFileJavaScript; - function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152); + ts.collapseRangeToEnd = collapseRangeToEnd; + function createTokenRange(pos, token) { + return createRange(pos, pos + ts.tokenToString(token).length); } - ts.isInJavaScriptFile = isInJavaScriptFile; - function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 179 && - expression.expression.kind === 70 && - expression.expression.text === "require" && - expression.arguments.length === 1; - return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9); + ts.createTokenRange = createTokenRange; + function rangeIsOnSingleLine(range, sourceFile) { + return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile); } - ts.isRequireCall = isRequireCall; - function isSingleOrDoubleQuote(charCode) { - return charCode === 39 || charCode === 34; + ts.rangeIsOnSingleLine = rangeIsOnSingleLine; + function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) { + return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile); } - ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; - function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223) { - var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184; - } - return false; + ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine; + function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) { + return positionsAreOnSameLine(range1.end, range2.end, sourceFile); } - ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression; - function getSpecialPropertyAssignmentKind(expression) { - if (!isInJavaScriptFile(expression)) { - return 0; - } - if (expression.kind !== 192) { - return 0; - } - var expr = expression; - if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) { - return 0; - } - var lhs = expr.left; - if (lhs.expression.kind === 70) { - var lhsId = lhs.expression; - if (lhsId.text === "exports") { - return 1; - } - else if (lhsId.text === "module" && lhs.name.text === "exports") { - return 2; - } - } - else if (lhs.expression.kind === 98) { - return 4; - } - else if (lhs.expression.kind === 177) { - var innerPropertyAccess = lhs.expression; - if (innerPropertyAccess.expression.kind === 70) { - var innerPropertyAccessIdentifier = innerPropertyAccess.expression; - if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { - return 1; - } - if (innerPropertyAccess.name.text === "prototype") { - return 3; - } - } - } - return 0; + ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine; + function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) { + return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile); } - ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; - function getExternalModuleName(node) { - if (node.kind === 235) { - return node.moduleSpecifier; - } - if (node.kind === 234) { - var reference = node.moduleReference; - if (reference.kind === 245) { - return reference.expression; - } - } - if (node.kind === 241) { - return node.moduleSpecifier; - } - if (node.kind === 230 && node.name.kind === 9) { - return node.name; - } + ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd; + function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) { + return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile); } - ts.getExternalModuleName = getExternalModuleName; - function getNamespaceDeclarationNode(node) { - if (node.kind === 234) { - return node; - } - var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) { - return importClause.namedBindings; - } + ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart; + function positionsAreOnSameLine(pos1, pos2, sourceFile) { + return pos1 === pos2 || + getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2); } - ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; - function isDefaultImport(node) { - return node.kind === 235 - && node.importClause - && !!node.importClause.name; + ts.positionsAreOnSameLine = positionsAreOnSameLine; + function getStartPositionOfRange(range, sourceFile) { + return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); } - ts.isDefaultImport = isDefaultImport; - function hasQuestionToken(node) { - if (node) { - switch (node.kind) { - case 144: - case 149: - case 148: - case 258: - case 257: - case 147: - case 146: - return node.questionToken !== undefined; + ts.getStartPositionOfRange = getStartPositionOfRange; + function isDeclarationNameOfEnumOrNamespace(node) { + var parseNode = ts.getParseTreeNode(node); + if (parseNode) { + switch (parseNode.parent.kind) { + case 231: + case 232: + return parseNode === parseNode.parent.name; } } return false; } - ts.hasQuestionToken = hasQuestionToken; - function isJSDocConstructSignature(node) { - return node.kind === 274 && - node.parameters.length > 0 && - node.parameters[0].type.kind === 276; + ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace; + function getInitializedVariables(node) { + return ts.filter(node.declarations, isInitializedVariable); } - ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getCommentsFromJSDoc(node) { - return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); + ts.getInitializedVariables = getInitializedVariables; + function isInitializedVariable(node) { + return node.initializer !== undefined; } - ts.getCommentsFromJSDoc = getCommentsFromJSDoc; - function getJSDocTags(node, kind) { - var docs = getJSDocs(node); - if (docs) { - var result = []; - for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { - var doc = docs_1[_i]; - if (doc.kind === 281) { - if (doc.kind === kind) { - result.push(doc); - } - } - else { - result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); + function isMergedWithClass(node) { + if (node.symbol) { + for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 228 && declaration !== node) { + return true; } } - return result; } + return false; } - function getFirstJSDocTag(node, kind) { - return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + ts.isMergedWithClass = isMergedWithClass; + function isFirstDeclarationOfKind(node, kind) { + return node.symbol && getDeclarationOfKind(node.symbol, kind) === node; } - function getJSDocs(node) { - var cache = node.jsDocCache; - if (!cache) { - getJSDocsWorker(node); - node.jsDocCache = cache; - } - return cache; - function getJSDocsWorker(node) { - var parent = node.parent; - var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && - parent.initializer === node && - parent.parent.parent.kind === 205; - var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205; - var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : - isVariableOfVariableDeclarationStatement ? parent.parent : - undefined; - if (variableStatementNode) { - getJSDocsWorker(variableStatementNode); - } - var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 && - parent.operatorToken.kind === 57 && - parent.parent.kind === 207; - if (isSourceOfAssignmentExpressionStatement) { - getJSDocsWorker(parent.parent); - } - var isModuleDeclaration = node.kind === 230 && - parent && parent.kind === 230; - var isPropertyAssignmentExpression = parent && parent.kind === 257; - if (isModuleDeclaration || isPropertyAssignmentExpression) { - getJSDocsWorker(parent); - } - if (node.kind === 144) { - cache = ts.concatenate(cache, getJSDocParameterTags(node)); - } - if (isVariableLike(node) && node.initializer) { - cache = ts.concatenate(cache, node.initializer.jsDoc); - } - cache = ts.concatenate(cache, node.jsDoc); - } + ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind; + function isNodeArray(array) { + return array.hasOwnProperty("pos") + && array.hasOwnProperty("end"); } - function getJSDocParameterTags(param) { - if (!isParameter(param)) { - return undefined; - } - var func = param.parent; - var tags = getJSDocTags(func, 281); - if (!param.name) { - var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); - if (paramTags && 0 <= i && i < paramTags.length) { - return [paramTags[i]]; - } - } - else if (param.name.kind === 70) { - var name_8 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; }); - } - else { - return undefined; - } + ts.isNodeArray = isNodeArray; + function isNoSubstitutionTemplateLiteral(node) { + return node.kind === 12; } - ts.getJSDocParameterTags = getJSDocParameterTags; - function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283); - if (!tag && node.kind === 144) { - var paramTags = getJSDocParameterTags(node); - if (paramTags) { - tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); - } - } - return tag && tag.typeExpression && tag.typeExpression.type; + ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral; + function isLiteralKind(kind) { + return 8 <= kind && kind <= 12; } - ts.getJSDocType = getJSDocType; - function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280); + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 9 || kind === 12; } - ts.getJSDocAugmentsTag = getJSDocAugmentsTag; - function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282); + ts.isTextualLiteralKind = isTextualLiteralKind; + function isLiteralExpression(node) { + return isLiteralKind(node.kind); } - ts.getJSDocReturnTag = getJSDocReturnTag; - function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284); + ts.isLiteralExpression = isLiteralExpression; + function isTemplateLiteralKind(kind) { + return 12 <= kind && kind <= 15; } - ts.getJSDocTemplateTag = getJSDocTemplateTag; - function hasRestParameter(s) { - return isRestParameter(ts.lastOrUndefined(s.parameters)); + ts.isTemplateLiteralKind = isTemplateLiteralKind; + function isTemplateHead(node) { + return node.kind === 13; } - ts.hasRestParameter = hasRestParameter; - function hasDeclaredRestParameter(s) { - return isDeclaredRestParam(ts.lastOrUndefined(s.parameters)); + ts.isTemplateHead = isTemplateHead; + function isTemplateMiddleOrTemplateTail(node) { + var kind = node.kind; + return kind === 14 + || kind === 15; } - ts.hasDeclaredRestParameter = hasDeclaredRestParameter; - function isRestParameter(node) { - if (node && (node.flags & 2097152)) { - if (node.type && node.type.kind === 275 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { - return true; - } - } - return isDeclaredRestParam(node); + ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail; + function isIdentifier(node) { + return node.kind === 70; } - ts.isRestParameter = isRestParameter; - function isDeclaredRestParam(node) { - return node && node.dotDotDotToken !== undefined; + ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 189; } - ts.isDeclaredRestParam = isDeclaredRestParam; - function getAssignmentTargetKind(node) { - var parent = node.parent; - while (true) { - switch (parent.kind) { - case 192: - var binaryOperator = parent.operatorToken.kind; - return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 57 ? 1 : 2 : - 0; - case 190: - case 191: - var unaryOperator = parent.operator; - return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 212: - case 213: - return parent.initializer === node ? 1 : 0; - case 183: - case 175: - case 196: - node = parent; - break; - case 258: - if (parent.name !== node) { - return 0; - } - case 257: - node = parent.parent; - break; - default: - return 0; - } - parent = node.parent; - } + ts.isVoidExpression = isVoidExpression; + function isGeneratedIdentifier(node) { + return isIdentifier(node) && node.autoGenerateKind > 0; } - ts.getAssignmentTargetKind = getAssignmentTargetKind; - function isAssignmentTarget(node) { - return getAssignmentTargetKind(node) !== 0; + ts.isGeneratedIdentifier = isGeneratedIdentifier; + function isModifier(node) { + return isModifierKind(node.kind); } - ts.isAssignmentTarget = isAssignmentTarget; - function isNodeDescendantOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; + ts.isModifier = isModifier; + function isQualifiedName(node) { + return node.kind === 142; } - ts.isNodeDescendantOf = isNodeDescendantOf; - function isInAmbientContext(node) { - while (node) { - if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) { - return true; - } - node = node.parent; - } - return false; + ts.isQualifiedName = isQualifiedName; + function isComputedPropertyName(node) { + return node.kind === 143; } - ts.isInAmbientContext = isInAmbientContext; - function isDeclarationName(name) { - if (name.kind !== 70 && name.kind !== 9 && name.kind !== 8) { - return false; - } - var parent = name.parent; - if (parent.kind === 239 || parent.kind === 243) { - if (parent.propertyName) { - return true; - } - } - if (isDeclaration(parent)) { - return parent.name === name; - } - return false; + ts.isComputedPropertyName = isComputedPropertyName; + function isEntityName(node) { + var kind = node.kind; + return kind === 142 + || kind === 70; } - ts.isDeclarationName = isDeclarationName; - function isLiteralComputedPropertyDeclarationName(node) { - return (node.kind === 9 || node.kind === 8) && - node.parent.kind === 142 && - isDeclaration(node.parent.parent); + ts.isEntityName = isEntityName; + function isPropertyName(node) { + var kind = node.kind; + return kind === 70 + || kind === 9 + || kind === 8 + || kind === 143; } - ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; - function isIdentifierName(node) { - var parent = node.parent; - switch (parent.kind) { - case 147: - case 146: - case 149: - case 148: - case 151: - case 152: - case 260: - case 257: - case 177: - return parent.name === node; - case 141: - if (parent.right === node) { - while (parent.kind === 141) { - parent = parent.parent; - } - return parent.kind === 160; - } - return false; - case 174: - case 239: - return parent.propertyName === node; - case 243: - return true; - } - return false; + ts.isPropertyName = isPropertyName; + function isModuleName(node) { + var kind = node.kind; + return kind === 70 + || kind === 9; } - ts.isIdentifierName = isIdentifierName; - function isAliasSymbolDeclaration(node) { - return node.kind === 234 || - node.kind === 233 || - node.kind === 236 && !!node.name || - node.kind === 237 || - node.kind === 239 || - node.kind === 243 || - node.kind === 240 && exportAssignmentIsAlias(node); + ts.isModuleName = isModuleName; + function isBindingName(node) { + var kind = node.kind; + return kind === 70 + || kind === 173 + || kind === 174; } - ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; - function exportAssignmentIsAlias(node) { - return isEntityNameExpression(node.expression); + ts.isBindingName = isBindingName; + function isTypeParameter(node) { + return node.kind === 144; } - ts.exportAssignmentIsAlias = exportAssignmentIsAlias; - function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 84); - return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; + ts.isTypeParameter = isTypeParameter; + function isParameter(node) { + return node.kind === 145; } - ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; - function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 107); - return heritageClause ? heritageClause.types : undefined; + ts.isParameter = isParameter; + function isDecorator(node) { + return node.kind === 146; } - ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; - function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 84); - return heritageClause ? heritageClause.types : undefined; + ts.isDecorator = isDecorator; + function isMethodDeclaration(node) { + return node.kind === 150; } - ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; - function getHeritageClause(clauses, kind) { - if (clauses) { - for (var _i = 0, clauses_1 = clauses; _i < clauses_1.length; _i++) { - var clause = clauses_1[_i]; - if (clause.token === kind) { - return clause; - } - } - } - return undefined; + ts.isMethodDeclaration = isMethodDeclaration; + function isClassElement(node) { + var kind = node.kind; + return kind === 151 + || kind === 148 + || kind === 150 + || kind === 152 + || kind === 153 + || kind === 156 + || kind === 205; } - ts.getHeritageClause = getHeritageClause; - function tryResolveScriptReference(host, sourceFile, reference) { - if (!host.getCompilerOptions().noResolve) { - var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); - return host.getSourceFile(referenceFileName); - } + ts.isClassElement = isClassElement; + function isObjectLiteralElementLike(node) { + var kind = node.kind; + return kind === 260 + || kind === 261 + || kind === 262 + || kind === 150 + || kind === 152 + || kind === 153 + || kind === 246; } - ts.tryResolveScriptReference = tryResolveScriptReference; - function getAncestor(node, kind) { - while (node) { - if (node.kind === kind) { - return node; - } - node = node.parent; - } - return undefined; + ts.isObjectLiteralElementLike = isObjectLiteralElementLike; + function isTypeNodeKind(kind) { + return (kind >= 157 && kind <= 172) + || kind === 118 + || kind === 132 + || kind === 133 + || kind === 121 + || kind === 135 + || kind === 136 + || kind === 98 + || kind === 104 + || kind === 138 + || kind === 94 + || kind === 129 + || kind === 200; } - ts.getAncestor = getAncestor; - function getFileReferenceFromReferencePath(comment, commentRange) { - var simpleReferenceRegEx = /^\/\/\/\s*/gim; - if (simpleReferenceRegEx.test(comment)) { - if (isNoDefaultLibRegEx.test(comment)) { - return { - isNoDefaultLib: true - }; - } - else { - var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); - if (refMatchResult || refLibResult) { - var start = commentRange.pos; - var end = commentRange.end; - return { - fileReference: { - pos: start, - end: end, - fileName: (refMatchResult || refLibResult)[3] - }, - isNoDefaultLib: false, - isTypeReferenceDirective: !!refLibResult - }; - } - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false - }; - } - } - return undefined; + function isTypeNode(node) { + return isTypeNodeKind(node.kind); } - ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; - function isKeyword(token) { - return 71 <= token && token <= 140; + ts.isTypeNode = isTypeNode; + function isArrayBindingPattern(node) { + return node.kind === 174; } - ts.isKeyword = isKeyword; - function isTrivia(token) { - return 2 <= token && token <= 7; + ts.isArrayBindingPattern = isArrayBindingPattern; + function isObjectBindingPattern(node) { + return node.kind === 173; } - ts.isTrivia = isTrivia; - function isAsyncFunctionLike(node) { - return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node); + ts.isObjectBindingPattern = isObjectBindingPattern; + function isBindingPattern(node) { + if (node) { + var kind = node.kind; + return kind === 174 + || kind === 173; + } + return false; } - ts.isAsyncFunctionLike = isAsyncFunctionLike; - function isStringOrNumericLiteral(node) { + ts.isBindingPattern = isBindingPattern; + function isAssignmentPattern(node) { var kind = node.kind; - return kind === 9 - || kind === 8; - } - ts.isStringOrNumericLiteral = isStringOrNumericLiteral; - function hasDynamicName(declaration) { - return declaration.name && isDynamicName(declaration.name); + return kind === 176 + || kind === 177; } - ts.hasDynamicName = hasDynamicName; - function isDynamicName(name) { - return name.kind === 142 && - !isStringOrNumericLiteral(name.expression) && - !isWellKnownSymbolSyntactically(name.expression); + ts.isAssignmentPattern = isAssignmentPattern; + function isBindingElement(node) { + return node.kind === 175; } - ts.isDynamicName = isDynamicName; - function isWellKnownSymbolSyntactically(node) { - return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); + ts.isBindingElement = isBindingElement; + function isArrayBindingElement(node) { + var kind = node.kind; + return kind === 175 + || kind === 199; } - ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; - function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) { - return name.text; - } - if (name.kind === 142) { - var nameExpression = name.expression; - if (isWellKnownSymbolSyntactically(nameExpression)) { - var rightHandSideName = nameExpression.name.text; - return getPropertyNameForKnownSymbolName(rightHandSideName); - } - else if (nameExpression.kind === 9 || nameExpression.kind === 8) { - return nameExpression.text; - } + ts.isArrayBindingElement = isArrayBindingElement; + function isDeclarationBindingElement(bindingElement) { + switch (bindingElement.kind) { + case 225: + case 145: + case 175: + return true; } - return undefined; - } - ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; - function getPropertyNameForKnownSymbolName(symbolName) { - return "__@" + symbolName; + return false; } - ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; - function isESSymbolIdentifier(node) { - return node.kind === 70 && node.text === "Symbol"; + ts.isDeclarationBindingElement = isDeclarationBindingElement; + function isBindingOrAssignmentPattern(node) { + return isObjectBindingOrAssignmentPattern(node) + || isArrayBindingOrAssignmentPattern(node); } - ts.isESSymbolIdentifier = isESSymbolIdentifier; - function isPushOrUnshiftIdentifier(node) { - return node.text === "push" || node.text === "unshift"; + ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; + function isObjectBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 173: + case 177: + return true; + } + return false; } - ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; - function isModifierKind(token) { - switch (token) { - case 116: - case 119: - case 75: - case 123: - case 78: - case 83: - case 113: - case 111: - case 112: - case 130: - case 114: + ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; + function isArrayBindingOrAssignmentPattern(node) { + switch (node.kind) { + case 174: + case 176: return true; } return false; } - ts.isModifierKind = isModifierKind; - function isParameterDeclaration(node) { - var root = getRootDeclaration(node); - return root.kind === 144; + ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; + function isArrayLiteralExpression(node) { + return node.kind === 176; } - ts.isParameterDeclaration = isParameterDeclaration; - function getRootDeclaration(node) { - while (node.kind === 174) { - node = node.parent.parent; - } - return node; + ts.isArrayLiteralExpression = isArrayLiteralExpression; + function isObjectLiteralExpression(node) { + return node.kind === 177; } - ts.getRootDeclaration = getRootDeclaration; - function nodeStartsNewLexicalEnvironment(node) { + ts.isObjectLiteralExpression = isObjectLiteralExpression; + function isPropertyAccessExpression(node) { + return node.kind === 178; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isPropertyAccessOrQualifiedName(node) { + var kind = node.kind; + return kind === 178 + || kind === 142; + } + ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; + function isElementAccessExpression(node) { + return node.kind === 179; + } + ts.isElementAccessExpression = isElementAccessExpression; + function isBinaryExpression(node) { + return node.kind === 193; + } + ts.isBinaryExpression = isBinaryExpression; + function isConditionalExpression(node) { + return node.kind === 194; + } + ts.isConditionalExpression = isConditionalExpression; + function isCallExpression(node) { + return node.kind === 180; + } + ts.isCallExpression = isCallExpression; + function isTemplateLiteral(node) { var kind = node.kind; - return kind === 150 + return kind === 195 + || kind === 12; + } + ts.isTemplateLiteral = isTemplateLiteral; + function isSpreadExpression(node) { + return node.kind === 197; + } + ts.isSpreadExpression = isSpreadExpression; + function isExpressionWithTypeArguments(node) { + return node.kind === 200; + } + ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; + function isLeftHandSideExpressionKind(kind) { + return kind === 178 + || kind === 179 + || kind === 181 + || kind === 180 + || kind === 248 + || kind === 249 + || kind === 182 + || kind === 176 || kind === 184 - || kind === 225 + || kind === 177 + || kind === 198 || kind === 185 - || kind === 149 - || kind === 151 - || kind === 152 - || kind === 230 - || kind === 261; + || kind === 70 + || kind === 11 + || kind === 8 + || kind === 9 + || kind === 12 + || kind === 195 + || kind === 85 + || kind === 94 + || kind === 98 + || kind === 100 + || kind === 96 + || kind === 202 + || kind === 203; } - ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; - function nodeIsSynthesized(node) { - return ts.positionIsSynthesized(node.pos) - || ts.positionIsSynthesized(node.end); + function isLeftHandSideExpression(node) { + return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } - ts.nodeIsSynthesized = nodeIsSynthesized; - function getOriginalNode(node, nodeTest) { - if (node) { - while (node.original !== undefined) { - node = node.original; - } - } - return !nodeTest || nodeTest(node) ? node : undefined; + ts.isLeftHandSideExpression = isLeftHandSideExpression; + function isUnaryExpressionKind(kind) { + return kind === 191 + || kind === 192 + || kind === 187 + || kind === 188 + || kind === 189 + || kind === 190 + || kind === 183 + || isLeftHandSideExpressionKind(kind); } - ts.getOriginalNode = getOriginalNode; - function isParseTreeNode(node) { - return (node.flags & 8) === 0; + function isUnaryExpression(node) { + return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } - ts.isParseTreeNode = isParseTreeNode; - function getParseTreeNode(node, nodeTest) { - if (isParseTreeNode(node)) { - return node; - } - node = getOriginalNode(node); - if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { - return node; - } - return undefined; + ts.isUnaryExpression = isUnaryExpression; + function isExpressionKind(kind) { + return kind === 194 + || kind === 196 + || kind === 186 + || kind === 193 + || kind === 197 + || kind === 201 + || kind === 199 + || isUnaryExpressionKind(kind); } - ts.getParseTreeNode = getParseTreeNode; - function getOriginalSourceFiles(sourceFiles) { - var originalSourceFiles = []; - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; - var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile); - if (originalSourceFile) { - originalSourceFiles.push(originalSourceFile); - } - } - return originalSourceFiles; + function isExpression(node) { + return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } - ts.getOriginalSourceFiles = getOriginalSourceFiles; - function getOriginalNodeId(node) { - node = getOriginalNode(node); - return node ? ts.getNodeId(node) : 0; + ts.isExpression = isExpression; + function isAssertionExpression(node) { + var kind = node.kind; + return kind === 183 + || kind === 201; } - ts.getOriginalNodeId = getOriginalNodeId; - function getExpressionAssociativity(expression) { - var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; - return getOperatorAssociativity(expression.kind, operator, hasArguments); + ts.isAssertionExpression = isAssertionExpression; + function isPartiallyEmittedExpression(node) { + return node.kind === 295; } - ts.getExpressionAssociativity = getExpressionAssociativity; - function getOperatorAssociativity(kind, operator, hasArguments) { - switch (kind) { - case 180: - return hasArguments ? 0 : 1; - case 190: - case 187: - case 188: - case 186: - case 189: - case 193: - case 195: - return 1; - case 192: - switch (operator) { - case 39: - case 57: - case 58: - case 59: - case 61: - case 60: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 69: - case 68: - return 1; - } - } - return 0; + ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; + function isNotEmittedStatement(node) { + return node.kind === 294; } - ts.getOperatorAssociativity = getOperatorAssociativity; - function getExpressionPrecedence(expression) { - var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; - return getOperatorPrecedence(expression.kind, operator, hasArguments); + ts.isNotEmittedStatement = isNotEmittedStatement; + function isNotEmittedOrPartiallyEmittedNode(node) { + return isNotEmittedStatement(node) + || isPartiallyEmittedExpression(node); } - ts.getExpressionPrecedence = getExpressionPrecedence; - function getOperator(expression) { - if (expression.kind === 192) { - return expression.operatorToken.kind; - } - else if (expression.kind === 190 || expression.kind === 191) { - return expression.operator; - } - else { - return expression.kind; - } + ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; + function isOmittedExpression(node) { + return node.kind === 199; } - ts.getOperator = getOperator; - function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { - switch (nodeKind) { - case 98: - case 96: - case 70: - case 94: - case 100: - case 85: - case 8: - case 9: - case 175: - case 176: - case 184: - case 185: - case 197: - case 246: - case 247: - case 11: - case 12: - case 194: - case 183: - case 198: - case 297: - return 19; - case 181: - case 177: - case 178: - return 18; - case 180: - return hasArguments ? 18 : 17; - case 179: - return 17; - case 191: - return 16; - case 190: - case 187: - case 188: - case 186: - case 189: - return 15; - case 192: - switch (operatorKind) { - case 50: - case 51: - return 15; - case 39: - case 38: - case 40: - case 41: - return 14; - case 36: - case 37: - return 13; - case 44: - case 45: - case 46: - return 12; - case 26: - case 29: - case 28: - case 30: - case 91: - case 92: - return 11; - case 31: - case 33: - case 32: - case 34: - return 10; - case 47: - return 9; - case 49: - return 8; - case 48: - return 7; - case 52: - return 6; - case 53: - return 5; - case 57: - case 58: - case 59: - case 61: - case 60: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 69: - case 68: - return 3; - case 25: - return 0; - default: - return -1; - } - case 193: - return 4; - case 195: - return 2; - case 196: - return 1; - default: - return -1; - } + ts.isOmittedExpression = isOmittedExpression; + function isTemplateSpan(node) { + return node.kind === 204; } - ts.getOperatorPrecedence = getOperatorPrecedence; - function createDiagnosticCollection() { - var nonFileDiagnostics = []; - var fileDiagnostics = ts.createMap(); - var diagnosticsModified = false; - var modificationCount = 0; - return { - add: add, - getGlobalDiagnostics: getGlobalDiagnostics, - getDiagnostics: getDiagnostics, - getModificationCount: getModificationCount, - reattachFileDiagnostics: reattachFileDiagnostics - }; - function getModificationCount() { - return modificationCount; - } - function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } - } - function add(diagnostic) { - var diagnostics; - if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; - if (!diagnostics) { - diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; - } - } - else { - diagnostics = nonFileDiagnostics; - } - diagnostics.push(diagnostic); - diagnosticsModified = true; - modificationCount++; - } - function getGlobalDiagnostics() { - sortAndDeduplicate(); - return nonFileDiagnostics; - } - function getDiagnostics(fileName) { - sortAndDeduplicate(); - if (fileName) { - return fileDiagnostics[fileName] || []; - } - var allDiagnostics = []; - function pushDiagnostic(d) { - allDiagnostics.push(d); - } - ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } - return ts.sortAndDeduplicateDiagnostics(allDiagnostics); - } - function sortAndDeduplicate() { - if (!diagnosticsModified) { - return; - } - diagnosticsModified = false; - nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } - } + ts.isTemplateSpan = isTemplateSpan; + function isBlock(node) { + return node.kind === 206; } - ts.createDiagnosticCollection = createDiagnosticCollection; - var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ - "\0": "\\0", - "\t": "\\t", - "\v": "\\v", - "\f": "\\f", - "\b": "\\b", - "\r": "\\r", - "\n": "\\n", - "\\": "\\\\", - "\"": "\\\"", - "\u2028": "\\u2028", - "\u2029": "\\u2029", - "\u0085": "\\u0085" - }); - function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + ts.isBlock = isBlock; + function isConciseBody(node) { + return isBlock(node) + || isExpression(node); } - ts.escapeString = escapeString; - function isIntrinsicJsxName(name) { - var ch = name.substr(0, 1); - return ch.toLowerCase() === ch; + ts.isConciseBody = isConciseBody; + function isFunctionBody(node) { + return isBlock(node); } - ts.isIntrinsicJsxName = isIntrinsicJsxName; - function get16BitUnicodeEscapeSequence(charCode) { - var hexCharCode = charCode.toString(16).toUpperCase(); - var paddedHexCode = ("0000" + hexCharCode).slice(-4); - return "\\u" + paddedHexCode; + ts.isFunctionBody = isFunctionBody; + function isForInitializer(node) { + return isVariableDeclarationList(node) + || isExpression(node); } - var nonAsciiCharacters = /[^\u0000-\u007F]/g; - function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? - s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : - s; + ts.isForInitializer = isForInitializer; + function isVariableDeclaration(node) { + return node.kind === 225; } - ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; - var indentStrings = ["", " "]; - function getIndentString(level) { - if (indentStrings[level] === undefined) { - indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; - } - return indentStrings[level]; + ts.isVariableDeclaration = isVariableDeclaration; + function isVariableDeclarationList(node) { + return node.kind === 226; } - ts.getIndentString = getIndentString; - function getIndentSize() { - return indentStrings[1].length; + ts.isVariableDeclarationList = isVariableDeclarationList; + function isCaseBlock(node) { + return node.kind === 234; } - ts.getIndentSize = getIndentSize; - function createTextWriter(newLine) { - var output; - var indent; - var lineStart; - var lineCount; - var linePos; - function write(s) { - if (s && s.length) { - if (lineStart) { - output += getIndentString(indent); - lineStart = false; - } - output += s; - } - } - function reset() { - output = ""; - indent = 0; - lineStart = true; - lineCount = 0; - linePos = 0; - } - function rawWrite(s) { - if (s !== undefined) { - if (lineStart) { - lineStart = false; - } - output += s; - } - } - function writeLiteral(s) { - if (s && s.length) { - write(s); - var lineStartsOfS = ts.computeLineStarts(s); - if (lineStartsOfS.length > 1) { - lineCount = lineCount + lineStartsOfS.length - 1; - linePos = output.length - s.length + ts.lastOrUndefined(lineStartsOfS); - } - } - } - function writeLine() { - if (!lineStart) { - output += newLine; - lineCount++; - linePos = output.length; - lineStart = true; - } - } - function writeTextOfNode(text, node) { - write(getTextOfNodeFromSourceText(text, node)); - } - reset(); - return { - write: write, - rawWrite: rawWrite, - writeTextOfNode: writeTextOfNode, - writeLiteral: writeLiteral, - writeLine: writeLine, - increaseIndent: function () { indent++; }, - decreaseIndent: function () { indent--; }, - getIndent: function () { return indent; }, - getTextPos: function () { return output.length; }, - getLine: function () { return lineCount + 1; }, - getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; }, - isAtStartOfLine: function () { return lineStart; }, - reset: reset - }; + ts.isCaseBlock = isCaseBlock; + function isModuleBody(node) { + var kind = node.kind; + return kind === 233 + || kind === 232 + || kind === 70; } - ts.createTextWriter = createTextWriter; - function getResolvedExternalModuleName(host, file) { - return file.moduleName || getExternalModuleNameFromPath(host, file.fileName); + ts.isModuleBody = isModuleBody; + function isNamespaceBody(node) { + var kind = node.kind; + return kind === 233 + || kind === 232; } - ts.getResolvedExternalModuleName = getResolvedExternalModuleName; - function getExternalModuleNameFromDeclaration(host, resolver, declaration) { - var file = resolver.getExternalModuleFileFromDeclaration(declaration); - if (!file || isDeclarationFile(file)) { - return undefined; - } - return getResolvedExternalModuleName(host, file); + ts.isNamespaceBody = isNamespaceBody; + function isJSDocNamespaceBody(node) { + var kind = node.kind; + return kind === 70 + || kind === 232; } - ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; - function getExternalModuleNameFromPath(host, fileName) { - var getCanonicalFileName = function (f) { return host.getCanonicalFileName(f); }; - var dir = ts.toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); - var filePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); - var relativePath = ts.getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, false); - return ts.removeFileExtension(relativePath); + ts.isJSDocNamespaceBody = isJSDocNamespaceBody; + function isImportEqualsDeclaration(node) { + return node.kind === 236; } - ts.getExternalModuleNameFromPath = getExternalModuleNameFromPath; - function getOwnEmitOutputFilePath(sourceFile, host, extension) { - var compilerOptions = host.getCompilerOptions(); - var emitOutputFilePathWithoutExtension; - if (compilerOptions.outDir) { - emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); - } - else { - emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); - } - return emitOutputFilePathWithoutExtension + extension; + ts.isImportEqualsDeclaration = isImportEqualsDeclaration; + function isImportClause(node) { + return node.kind === 238; } - ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; - function getDeclarationEmitOutputFilePath(sourceFile, host) { - var options = host.getCompilerOptions(); - var outputDir = options.declarationDir || options.outDir; - var path = outputDir - ? getSourceFilePathInNewDir(sourceFile, host, outputDir) - : sourceFile.fileName; - return ts.removeFileExtension(path) + ".d.ts"; + ts.isImportClause = isImportClause; + function isNamedImportBindings(node) { + var kind = node.kind; + return kind === 240 + || kind === 239; } - ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; - function getSourceFilesToEmit(host, targetSourceFile) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); - } - else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); - } + ts.isNamedImportBindings = isNamedImportBindings; + function isImportSpecifier(node) { + return node.kind === 241; } - ts.getSourceFilesToEmit = getSourceFilesToEmit; - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); + ts.isImportSpecifier = isImportSpecifier; + function isNamedExports(node) { + return node.kind === 244; } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); + ts.isNamedExports = isNamedExports; + function isExportSpecifier(node) { + return node.kind === 245; } - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); + ts.isExportSpecifier = isExportSpecifier; + function isModuleOrEnumDeclaration(node) { + return node.kind === 232 || node.kind === 231; } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); + ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; + function isDeclarationKind(kind) { + return kind === 186 + || kind === 175 + || kind === 228 + || kind === 198 + || kind === 151 + || kind === 231 + || kind === 263 + || kind === 245 + || kind === 227 + || kind === 185 + || kind === 152 + || kind === 238 + || kind === 236 + || kind === 241 + || kind === 229 + || kind === 252 + || kind === 150 + || kind === 149 + || kind === 232 + || kind === 235 + || kind === 239 + || kind === 145 + || kind === 260 + || kind === 148 + || kind === 147 + || kind === 153 + || kind === 261 + || kind === 230 + || kind === 144 + || kind === 225 + || kind === 289; } - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - onBundledEmit(sourceFiles); - } - else { - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false); - } - function onBundledEmit(sourceFiles) { - if (sourceFiles.length) { - var jsFilePath = options.outFile || options.out; - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true); - } - } + function isDeclarationStatementKind(kind) { + return kind === 227 + || kind === 246 + || kind === 228 + || kind === 229 + || kind === 230 + || kind === 231 + || kind === 232 + || kind === 237 + || kind === 236 + || kind === 243 + || kind === 242 + || kind === 235; } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; - function getSourceMapFilePath(jsFilePath, options) { - return options.sourceMap ? jsFilePath + ".map" : undefined; + function isStatementKindButNotDeclarationKind(kind) { + return kind === 217 + || kind === 216 + || kind === 224 + || kind === 211 + || kind === 209 + || kind === 208 + || kind === 214 + || kind === 215 + || kind === 213 + || kind === 210 + || kind === 221 + || kind === 218 + || kind === 220 + || kind === 222 + || kind === 223 + || kind === 207 + || kind === 212 + || kind === 219 + || kind === 294 + || kind === 297 + || kind === 296; } - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, true, emitOnlyDtsFiles); - } - } + function isDeclaration(node) { + return isDeclarationKind(node.kind); } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; - function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { - var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); - var commonSourceDirectory = host.getCommonSourceDirectory(); - var isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0; - sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath; - return ts.combinePaths(newDirPath, sourceFilePath); + ts.isDeclaration = isDeclaration; + function isDeclarationStatement(node) { + return isDeclarationStatementKind(node.kind); } - ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { - host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }, sourceFiles); + ts.isDeclarationStatement = isDeclarationStatement; + function isStatementButNotDeclaration(node) { + return isStatementKindButNotDeclarationKind(node.kind); } - ts.writeFile = writeFile; - function getLineOfLocalPosition(currentSourceFile, pos) { - return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; + ts.isStatementButNotDeclaration = isStatementButNotDeclaration; + function isStatement(node) { + var kind = node.kind; + return isStatementKindButNotDeclarationKind(kind) + || isDeclarationStatementKind(kind) + || kind === 206; } - ts.getLineOfLocalPosition = getLineOfLocalPosition; - function getLineOfLocalPositionFromLineMap(lineMap, pos) { - return ts.computeLineAndCharacterOfPosition(lineMap, pos).line; + ts.isStatement = isStatement; + function isModuleReference(node) { + var kind = node.kind; + return kind === 247 + || kind === 142 + || kind === 70; } - ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; - function getFirstConstructorWithBody(node) { - return ts.forEach(node.members, function (member) { - if (member.kind === 150 && nodeIsPresent(member.body)) { - return member; - } - }); + ts.isModuleReference = isModuleReference; + function isJsxOpeningElement(node) { + return node.kind === 250; } - ts.getFirstConstructorWithBody = getFirstConstructorWithBody; - function getSetAccessorTypeAnnotationNode(accessor) { - if (accessor && accessor.parameters.length > 0) { - var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]); - return accessor.parameters[hasThis ? 1 : 0].type; - } + ts.isJsxOpeningElement = isJsxOpeningElement; + function isJsxClosingElement(node) { + return node.kind === 251; } - ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; - function getThisParameter(signature) { - if (signature.parameters.length) { - var thisParameter = signature.parameters[0]; - if (parameterIsThisKeyword(thisParameter)) { - return thisParameter; - } - } + ts.isJsxClosingElement = isJsxClosingElement; + function isJsxTagNameExpression(node) { + var kind = node.kind; + return kind === 98 + || kind === 70 + || kind === 178; } - ts.getThisParameter = getThisParameter; - function parameterIsThisKeyword(parameter) { - return isThisIdentifier(parameter.name); + ts.isJsxTagNameExpression = isJsxTagNameExpression; + function isJsxChild(node) { + var kind = node.kind; + return kind === 248 + || kind === 255 + || kind === 249 + || kind === 10; } - ts.parameterIsThisKeyword = parameterIsThisKeyword; - function isThisIdentifier(node) { - return node && node.kind === 70 && identifierIsThisKeyword(node); + ts.isJsxChild = isJsxChild; + function isJsxAttributes(node) { + var kind = node.kind; + return kind === 253; } - ts.isThisIdentifier = isThisIdentifier; - function identifierIsThisKeyword(id) { - return id.originalKeywordKind === 98; + ts.isJsxAttributes = isJsxAttributes; + function isJsxAttributeLike(node) { + var kind = node.kind; + return kind === 252 + || kind === 254; } - ts.identifierIsThisKeyword = identifierIsThisKeyword; - function getAllAccessorDeclarations(declarations, accessor) { - var firstAccessor; - var secondAccessor; - var getAccessor; - var setAccessor; - if (hasDynamicName(accessor)) { - firstAccessor = accessor; - if (accessor.kind === 151) { - getAccessor = accessor; - } - else if (accessor.kind === 152) { - setAccessor = accessor; - } - else { - ts.Debug.fail("Accessor has wrong kind"); - } - } - else { - ts.forEach(declarations, function (member) { - if ((member.kind === 151 || member.kind === 152) - && hasModifier(member, 32) === hasModifier(accessor, 32)) { - var memberName = getPropertyNameForPropertyNameNode(member.name); - var accessorName = getPropertyNameForPropertyNameNode(accessor.name); - if (memberName === accessorName) { - if (!firstAccessor) { - firstAccessor = member; - } - else if (!secondAccessor) { - secondAccessor = member; - } - if (member.kind === 151 && !getAccessor) { - getAccessor = member; - } - if (member.kind === 152 && !setAccessor) { - setAccessor = member; - } - } - } - }); - } - return { - firstAccessor: firstAccessor, - secondAccessor: secondAccessor, - getAccessor: getAccessor, - setAccessor: setAccessor - }; + ts.isJsxAttributeLike = isJsxAttributeLike; + function isJsxSpreadAttribute(node) { + return node.kind === 254; } - ts.getAllAccessorDeclarations = getAllAccessorDeclarations; - function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { - emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments); + ts.isJsxSpreadAttribute = isJsxSpreadAttribute; + function isJsxAttribute(node) { + return node.kind === 252; } - ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; - function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) { - if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos && - getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { - writer.writeLine(); - } + ts.isJsxAttribute = isJsxAttribute; + function isStringLiteralOrJsxExpression(node) { + var kind = node.kind; + return kind === 9 + || kind === 255; } - ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition; - function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) { - if (pos !== commentPos && - getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) { - writer.writeLine(); - } + ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; + function isJsxOpeningLikeElement(node) { + var kind = node.kind; + return kind === 250 + || kind === 249; } - ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition; - function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) { - if (comments && comments.length > 0) { - if (leadingSeparator) { - writer.write(" "); - } - var emitInterveningSeparator = false; - for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { - var comment = comments_1[_i]; - if (emitInterveningSeparator) { - writer.write(" "); - emitInterveningSeparator = false; - } - writeComment(text, lineMap, writer, comment.pos, comment.end, newLine); - if (comment.hasTrailingNewLine) { - writer.writeLine(); - } - else { - emitInterveningSeparator = true; - } - } - if (emitInterveningSeparator && trailingSeparator) { - writer.write(" "); - } - } + ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; + function isCaseOrDefaultClause(node) { + var kind = node.kind; + return kind === 256 + || kind === 257; } - ts.emitComments = emitComments; - function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) { - var leadingComments; - var currentDetachedCommentInfo; - if (removeComments) { - if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); - } - } - else { - leadingComments = ts.getLeadingCommentRanges(text, node.pos); - } - if (leadingComments) { - var detachedComments = []; - var lastComment = void 0; - for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { - var comment = leadingComments_1[_i]; - if (lastComment) { - var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end); - var commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos); - if (commentLine >= lastCommentLine + 2) { - break; - } - } - detachedComments.push(comment); - lastComment = comment; - } - if (detachedComments.length) { - var lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, ts.lastOrUndefined(detachedComments).end); - var nodeLine = getLineOfLocalPositionFromLineMap(lineMap, ts.skipTrivia(text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); - emitComments(text, lineMap, writer, detachedComments, false, true, newLine, writeComment); - currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - } - } - } - return currentDetachedCommentInfo; - function isPinnedComment(comment) { - return text.charCodeAt(comment.pos + 1) === 42 && - text.charCodeAt(comment.pos + 2) === 33; - } + ts.isCaseOrDefaultClause = isCaseOrDefaultClause; + function isHeritageClause(node) { + return node.kind === 258; } - ts.emitDetachedComments = emitDetachedComments; - function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) { - if (text.charCodeAt(commentPos + 1) === 42) { - var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos); - var lineCount = lineMap.length; - var firstCommentLineIndent = void 0; - for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount - ? text.length + 1 - : lineMap[currentLine + 1]; - if (pos !== commentPos) { - if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos); - } - var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); - var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart); - if (spacesToEmit > 0) { - var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); - var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); - writer.rawWrite(indentSizeSpaceString); - while (numberOfSingleSpacesToEmit) { - writer.rawWrite(" "); - numberOfSingleSpacesToEmit--; - } - } - else { - writer.rawWrite(""); - } - } - writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart); - pos = nextLineStart; - } - } - else { - writer.write(text.substring(commentPos, commentEnd)); - } + ts.isHeritageClause = isHeritageClause; + function isCatchClause(node) { + return node.kind === 259; } - ts.writeCommentRange = writeCommentRange; - function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) { - var end = Math.min(commentEnd, nextLineStart - 1); - var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); - if (currentLineText) { - writer.write(currentLineText); - if (end !== commentEnd) { - writer.writeLine(); - } - } - else { - writer.writeLiteral(newLine); - } + ts.isCatchClause = isCatchClause; + function isPropertyAssignment(node) { + return node.kind === 260; } - function calculateIndent(text, pos, end) { - var currentLineIndent = 0; - for (; pos < end && ts.isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) { - if (text.charCodeAt(pos) === 9) { - currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); - } - else { - currentLineIndent++; - } - } - return currentLineIndent; + ts.isPropertyAssignment = isPropertyAssignment; + function isShorthandPropertyAssignment(node) { + return node.kind === 261; } - function hasModifiers(node) { - return getModifierFlags(node) !== 0; + ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; + function isEnumMember(node) { + return node.kind === 263; } - ts.hasModifiers = hasModifiers; - function hasModifier(node, flags) { - return (getModifierFlags(node) & flags) !== 0; + ts.isEnumMember = isEnumMember; + function isSourceFile(node) { + return node.kind === 264; } - ts.hasModifier = hasModifier; - function getModifierFlags(node) { - if (node.modifierFlagsCache & 536870912) { - return node.modifierFlagsCache & ~536870912; - } - var flags = 0; - if (node.modifiers) { - for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { - var modifier = _a[_i]; - flags |= modifierToFlag(modifier.kind); - } - } - if (node.flags & 4 || (node.kind === 70 && node.isInJSDocNamespace)) { - flags |= 1; - } - node.modifierFlagsCache = flags | 536870912; - return flags; + ts.isSourceFile = isSourceFile; + function isWatchSet(options) { + return options.watch && options.hasOwnProperty("watch"); } - ts.getModifierFlags = getModifierFlags; - function modifierToFlag(token) { - switch (token) { - case 114: return 32; - case 113: return 4; - case 112: return 16; - case 111: return 8; - case 116: return 128; - case 83: return 1; - case 123: return 2; - case 75: return 2048; - case 78: return 512; - case 119: return 256; - case 130: return 64; + ts.isWatchSet = isWatchSet; +})(ts || (ts = {})); +(function (ts) { + function getDefaultLibFileName(options) { + switch (options.target) { + case 5: + return "lib.esnext.full.d.ts"; + case 4: + return "lib.es2017.full.d.ts"; + case 3: + return "lib.es2016.full.d.ts"; + case 2: + return "lib.es6.d.ts"; + default: + return "lib.d.ts"; } - return 0; } - ts.modifierToFlag = modifierToFlag; - function isLogicalOperator(token) { - return token === 53 - || token === 52 - || token === 50; + ts.getDefaultLibFileName = getDefaultLibFileName; + function textSpanEnd(span) { + return span.start + span.length; } - ts.isLogicalOperator = isLogicalOperator; - function isAssignmentOperator(token) { - return token >= 57 && token <= 69; + ts.textSpanEnd = textSpanEnd; + function textSpanIsEmpty(span) { + return span.length === 0; } - ts.isAssignmentOperator = isAssignmentOperator; - function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 && - node.parent.token === 84 && - isClassLike(node.parent.parent)) { - return node.parent.parent; - } + ts.textSpanIsEmpty = textSpanIsEmpty; + function textSpanContainsPosition(span, position) { + return position >= span.start && position < textSpanEnd(span); } - ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; - function isAssignmentExpression(node, excludeCompoundAssignment) { - return isBinaryExpression(node) - && (excludeCompoundAssignment - ? node.operatorToken.kind === 57 - : isAssignmentOperator(node.operatorToken.kind)) - && isLeftHandSideExpression(node.left); + ts.textSpanContainsPosition = textSpanContainsPosition; + function textSpanContainsTextSpan(span, other) { + return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); } - ts.isAssignmentExpression = isAssignmentExpression; - function isDestructuringAssignment(node) { - if (isAssignmentExpression(node, true)) { - var kind = node.left.kind; - return kind === 176 - || kind === 175; + ts.textSpanContainsTextSpan = textSpanContainsTextSpan; + function textSpanOverlapsWith(span, other) { + var overlapStart = Math.max(span.start, other.start); + var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other)); + return overlapStart < overlapEnd; + } + ts.textSpanOverlapsWith = textSpanOverlapsWith; + function textSpanOverlap(span1, span2) { + var overlapStart = Math.max(span1.start, span2.start); + var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (overlapStart < overlapEnd) { + return createTextSpanFromBounds(overlapStart, overlapEnd); } - return false; + return undefined; } - ts.isDestructuringAssignment = isDestructuringAssignment; - function isSupportedExpressionWithTypeArguments(node) { - return isSupportedExpressionWithTypeArgumentsRest(node.expression); + ts.textSpanOverlap = textSpanOverlap; + function textSpanIntersectsWithTextSpan(span, other) { + return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start; } - ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; - function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 70) { - return true; + ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan; + function textSpanIntersectsWith(span, start, length) { + var end = start + length; + return start <= textSpanEnd(span) && end >= span.start; + } + ts.textSpanIntersectsWith = textSpanIntersectsWith; + function decodedTextSpanIntersectsWith(start1, length1, start2, length2) { + var end1 = start1 + length1; + var end2 = start2 + length2; + return start2 <= end1 && end2 >= start1; + } + ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith; + function textSpanIntersectsWithPosition(span, position) { + return position <= textSpanEnd(span) && position >= span.start; + } + ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition; + function textSpanIntersection(span1, span2) { + var intersectStart = Math.max(span1.start, span2.start); + var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (intersectStart <= intersectEnd) { + return createTextSpanFromBounds(intersectStart, intersectEnd); } - else if (isPropertyAccessExpression(node)) { - return isSupportedExpressionWithTypeArgumentsRest(node.expression); + return undefined; + } + ts.textSpanIntersection = textSpanIntersection; + function createTextSpan(start, length) { + if (start < 0) { + throw new Error("start < 0"); } - else { - return false; + if (length < 0) { + throw new Error("length < 0"); } + return { start: start, length: length }; } - function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; + ts.createTextSpan = createTextSpan; + function createTextSpanFromBounds(start, end) { + return createTextSpan(start, end - start); } - ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; - function isEntityNameExpression(node) { - return node.kind === 70 || - node.kind === 177 && isEntityNameExpression(node.expression); + ts.createTextSpanFromBounds = createTextSpanFromBounds; + function textChangeRangeNewSpan(range) { + return createTextSpan(range.span.start, range.newLength); } - ts.isEntityNameExpression = isEntityNameExpression; - function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 && node.parent.right === node) || - (node.parent.kind === 177 && node.parent.name === node); + ts.textChangeRangeNewSpan = textChangeRangeNewSpan; + function textChangeRangeIsUnchanged(range) { + return textSpanIsEmpty(range.span) && range.newLength === 0; } - ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; - function isEmptyObjectLiteralOrArrayLiteral(expression) { - var kind = expression.kind; - if (kind === 176) { - return expression.properties.length === 0; + ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged; + function createTextChangeRange(span, newLength) { + if (newLength < 0) { + throw new Error("newLength < 0"); + } + return { span: span, newLength: newLength }; + } + ts.createTextChangeRange = createTextChangeRange; + ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); + function collapseTextChangeRangesAcrossMultipleVersions(changes) { + if (changes.length === 0) { + return ts.unchangedTextChangeRange; } - if (kind === 175) { - return expression.elements.length === 0; + if (changes.length === 1) { + return changes[0]; } - return false; + var change0 = changes[0]; + var oldStartN = change0.span.start; + var oldEndN = textSpanEnd(change0.span); + var newEndN = oldStartN + change0.newLength; + for (var i = 1; i < changes.length; i++) { + var nextChange = changes[i]; + var oldStart1 = oldStartN; + var oldEnd1 = oldEndN; + var newEnd1 = newEndN; + var oldStart2 = nextChange.span.start; + var oldEnd2 = textSpanEnd(nextChange.span); + var newEnd2 = oldStart2 + nextChange.newLength; + oldStartN = Math.min(oldStart1, oldStart2); + oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); + newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); + } + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN); } - ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; - function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined; + ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; + function getTypeParameterOwner(d) { + if (d && d.kind === 144) { + for (var current = d; current; current = current.parent) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229) { + return current; + } + } + } } - ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function tryExtractTypeScriptExtension(fileName) { - return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); + ts.getTypeParameterOwner = getTypeParameterOwner; + function isParameterPropertyDeclaration(node) { + return ts.hasModifier(node, 92) && node.parent.kind === 151 && ts.isClassLike(node.parent.parent); } - ts.tryExtractTypeScriptExtension = tryExtractTypeScriptExtension; - function getExpandedCharCodes(input) { - var output = []; - var length = input.length; - for (var i = 0; i < length; i++) { - var charCode = input.charCodeAt(i); - if (charCode < 0x80) { - output.push(charCode); + ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function walkUpBindingElementsAndPatterns(node) { + while (node && (node.kind === 175 || ts.isBindingPattern(node))) { + node = node.parent; + } + return node; + } + function getCombinedModifierFlags(node) { + node = walkUpBindingElementsAndPatterns(node); + var flags = ts.getModifierFlags(node); + if (node.kind === 225) { + node = node.parent; + } + if (node && node.kind === 226) { + flags |= ts.getModifierFlags(node); + node = node.parent; + } + if (node && node.kind === 207) { + flags |= ts.getModifierFlags(node); + } + return flags; + } + ts.getCombinedModifierFlags = getCombinedModifierFlags; + function getCombinedNodeFlags(node) { + node = walkUpBindingElementsAndPatterns(node); + var flags = node.flags; + if (node.kind === 225) { + node = node.parent; + } + if (node && node.kind === 226) { + flags |= node.flags; + node = node.parent; + } + if (node && node.kind === 207) { + flags |= node.flags; + } + return flags; + } + ts.getCombinedNodeFlags = getCombinedNodeFlags; + function validateLocaleAndSetLanguage(locale, sys, errors) { + var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + if (!matchResult) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); } - else if (charCode < 0x800) { - output.push((charCode >> 6) | 192); - output.push((charCode & 63) | 128); + return; + } + var language = matchResult[1]; + var territory = matchResult[3]; + if (!trySetLanguageAndTerritory(language, territory, errors)) { + trySetLanguageAndTerritory(language, undefined, errors); + } + function trySetLanguageAndTerritory(language, territory, errors) { + var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); + var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); + var filePath = ts.combinePaths(containingDirectoryPath, language); + if (territory) { + filePath = filePath + "-" + territory; } - else if (charCode < 0x10000) { - output.push((charCode >> 12) | 224); - output.push(((charCode >> 6) & 63) | 128); - output.push((charCode & 63) | 128); + filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); + if (!sys.fileExists(filePath)) { + return false; } - else if (charCode < 0x20000) { - output.push((charCode >> 18) | 240); - output.push(((charCode >> 12) & 63) | 128); - output.push(((charCode >> 6) & 63) | 128); - output.push((charCode & 63) | 128); + var fileContents = ""; + try { + fileContents = sys.readFile(filePath); } - else { - ts.Debug.assert(false, "Unexpected code point"); + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); } + catch (e) { + if (errors) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + return true; } - return output; } - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - function stringifyFallback(value) { - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; + ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; + function getOriginalNode(node, nodeTest) { + if (node) { + while (node.original !== undefined) { + node = node.original; + } + } + return !nodeTest || nodeTest(node) ? node : undefined; } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; + ts.getOriginalNode = getOriginalNode; + function isParseTreeNode(node) { + return (node.flags & 8) === 0; } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); + ts.isParseTreeNode = isParseTreeNode; + function getParseTreeNode(node, nodeTest) { + if (node === undefined || isParseTreeNode(node)) { + return node; + } + node = getOriginalNode(node); + if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { + return node; + } + return undefined; } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; + ts.getParseTreeNode = getParseTreeNode; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); + ts.unescapeIdentifier = unescapeIdentifier; +})(ts || (ts = {})); +var ts; +(function (ts) { + function tokenIsIdentifierOrKeyword(token) { + return token >= 70; } - var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - function convertToBase64(input) { - var result = ""; - var charCodes = getExpandedCharCodes(input); - var i = 0; - var length = charCodes.length; - var byte1, byte2, byte3, byte4; - while (i < length) { - byte1 = charCodes[i] >> 2; - byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4; - byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6; - byte4 = charCodes[i + 2] & 63; - if (i + 1 >= length) { - byte3 = byte4 = 64; - } - else if (i + 2 >= length) { - byte4 = 64; - } - result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); - i += 3; - } - return result; - } - ts.convertToBase64 = convertToBase64; - var carriageReturnLineFeed = "\r\n"; - var lineFeed = "\n"; - function getNewLineCharacter(options) { - if (options.newLine === 0) { - return carriageReturnLineFeed; - } - else if (options.newLine === 1) { - return lineFeed; - } - else if (ts.sys) { - return ts.sys.newLine; + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + var textToToken = ts.createMapFromTemplate({ + "abstract": 116, + "any": 118, + "as": 117, + "boolean": 121, + "break": 71, + "case": 72, + "catch": 73, + "class": 74, + "continue": 76, + "const": 75, + "constructor": 122, + "debugger": 77, + "declare": 123, + "default": 78, + "delete": 79, + "do": 80, + "else": 81, + "enum": 82, + "export": 83, + "extends": 84, + "false": 85, + "finally": 86, + "for": 87, + "from": 139, + "function": 88, + "get": 124, + "if": 89, + "implements": 107, + "import": 90, + "in": 91, + "instanceof": 92, + "interface": 108, + "is": 125, + "keyof": 126, + "let": 109, + "module": 127, + "namespace": 128, + "never": 129, + "new": 93, + "null": 94, + "number": 132, + "object": 133, + "package": 110, + "private": 111, + "protected": 112, + "public": 113, + "readonly": 130, + "require": 131, + "global": 140, + "return": 95, + "set": 134, + "static": 114, + "string": 135, + "super": 96, + "switch": 97, + "symbol": 136, + "this": 98, + "throw": 99, + "true": 100, + "try": 101, + "type": 137, + "typeof": 102, + "undefined": 138, + "var": 103, + "void": 104, + "while": 105, + "with": 106, + "yield": 115, + "async": 119, + "await": 120, + "of": 141, + "{": 16, + "}": 17, + "(": 18, + ")": 19, + "[": 20, + "]": 21, + ".": 22, + "...": 23, + ";": 24, + ",": 25, + "<": 26, + ">": 28, + "<=": 29, + ">=": 30, + "==": 31, + "!=": 32, + "===": 33, + "!==": 34, + "=>": 35, + "+": 36, + "-": 37, + "**": 39, + "*": 38, + "/": 40, + "%": 41, + "++": 42, + "--": 43, + "<<": 44, + ">": 45, + ">>>": 46, + "&": 47, + "|": 48, + "^": 49, + "!": 50, + "~": 51, + "&&": 52, + "||": 53, + "?": 54, + ":": 55, + "=": 57, + "+=": 58, + "-=": 59, + "*=": 60, + "**=": 61, + "/=": 62, + "%=": 63, + "<<=": 64, + ">>=": 65, + ">>>=": 66, + "&=": 67, + "|=": 68, + "^=": 69, + "@": 56, + }); + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; } - return carriageReturnLineFeed; - } - ts.getNewLineCharacter = getNewLineCharacter; - function isSimpleExpression(node) { - return isSimpleExpressionWorker(node, 0); - } - ts.isSimpleExpression = isSimpleExpression; - function isSimpleExpressionWorker(node, depth) { - if (depth <= 5) { - var kind = node.kind; - if (kind === 9 - || kind === 8 - || kind === 11 - || kind === 12 - || kind === 70 - || kind === 98 - || kind === 96 - || kind === 100 - || kind === 85 - || kind === 94) { + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { return true; } - else if (kind === 177) { - return isSimpleExpressionWorker(node.expression, depth + 1); - } - else if (kind === 178) { - return isSimpleExpressionWorker(node.expression, depth + 1) - && isSimpleExpressionWorker(node.argumentExpression, depth + 1); - } - else if (kind === 190 - || kind === 191) { - return isSimpleExpressionWorker(node.operand, depth + 1); - } - else if (kind === 192) { - return node.operatorToken.kind !== 39 - && isSimpleExpressionWorker(node.left, depth + 1) - && isSimpleExpressionWorker(node.right, depth + 1); - } - else if (kind === 193) { - return isSimpleExpressionWorker(node.condition, depth + 1) - && isSimpleExpressionWorker(node.whenTrue, depth + 1) - && isSimpleExpressionWorker(node.whenFalse, depth + 1); - } - else if (kind === 188 - || kind === 187 - || kind === 186) { - return isSimpleExpressionWorker(node.expression, depth + 1); - } - else if (kind === 175) { - return node.elements.length === 0; - } - else if (kind === 176) { - return node.properties.length === 0; + if (code < map[mid]) { + hi = mid; } - else if (kind === 179) { - if (!isSimpleExpressionWorker(node.expression, depth + 1)) { - return false; - } - for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { - var argument = _a[_i]; - if (!isSimpleExpressionWorker(argument, depth + 1)) { - return false; - } - } - return true; + else { + lo = mid + 2; } } return false; } - var syntaxKindCache = ts.createMap(); - function formatSyntaxKind(kind) { - var syntaxKindEnum = ts.SyntaxKind; - if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; - } - for (var name_9 in syntaxKindEnum) { - if (syntaxKindEnum[name_9] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_9 + ")"; - } - } - } - else { - return kind.toString(); - } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); } - ts.formatSyntaxKind = formatSyntaxKind; - function movePos(pos, value) { - return ts.positionIsSynthesized(pos) ? -1 : pos + value; + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierPart) : + lookupInUnicodeMap(code, unicodeES3IdentifierPart); } - ts.movePos = movePos; - function createRange(pos, end) { - return { pos: pos, end: end }; + function makeReverseMap(source) { + var result = []; + source.forEach(function (value, name) { + result[value] = name; + }); + return result; } - ts.createRange = createRange; - function moveRangeEnd(range, end) { - return createRange(range.pos, end); + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; } - ts.moveRangeEnd = moveRangeEnd; - function moveRangePos(range, pos) { - return createRange(pos, range.end); + ts.tokenToString = tokenToString; + function stringToToken(s) { + return textToToken.get(s); } - ts.moveRangePos = moveRangePos; - function moveRangePastDecorators(node) { - return node.decorators && node.decorators.length > 0 - ? moveRangePos(node, node.decorators.end) - : node; + ts.stringToToken = stringToToken; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 13: + if (text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; } - ts.moveRangePastDecorators = moveRangePastDecorators; - function moveRangePastModifiers(node) { - return node.modifiers && node.modifiers.length > 0 - ? moveRangePos(node, node.modifiers.end) - : moveRangePastDecorators(node); + ts.computeLineStarts = computeLineStarts; + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - ts.moveRangePastModifiers = moveRangePastModifiers; - function isCollapsedRange(range) { - return range.pos === range.end; + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } - ts.isCollapsedRange = isCollapsedRange; - function collapseRangeToStart(range) { - return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos); + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; + function getLineStarts(sourceFile) { + return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } - ts.collapseRangeToStart = collapseRangeToStart; - function collapseRangeToEnd(range) { - return isCollapsedRange(range) ? range : moveRangePos(range, range.end); + ts.getLineStarts = getLineStarts; + function computeLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = ~lineNumber - 1; + ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); + } + return { + line: lineNumber, + character: position - lineStarts[lineNumber] + }; } - ts.collapseRangeToEnd = collapseRangeToEnd; - function createTokenRange(pos, token) { - return createRange(pos, pos + ts.tokenToString(token).length); + ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; + function getLineAndCharacterOfPosition(sourceFile, position) { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } - ts.createTokenRange = createTokenRange; - function rangeIsOnSingleLine(range, sourceFile) { - return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile); + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + function isWhiteSpace(ch) { + return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } - ts.rangeIsOnSingleLine = rangeIsOnSingleLine; - function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) { - return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile); + ts.isWhiteSpace = isWhiteSpace; + function isWhiteSpaceSingleLine(ch) { + return ch === 32 || + ch === 9 || + ch === 11 || + ch === 12 || + ch === 160 || + ch === 133 || + ch === 5760 || + ch >= 8192 && ch <= 8203 || + ch === 8239 || + ch === 8287 || + ch === 12288 || + ch === 65279; } - ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine; - function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) { - return positionsAreOnSameLine(range1.end, range2.end, sourceFile); + ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine; + function isLineBreak(ch) { + return ch === 10 || + ch === 13 || + ch === 8232 || + ch === 8233; } - ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine; - function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) { - return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile); + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 && ch <= 57; } - ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd; - function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) { - return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile); + function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; } - ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart; - function positionsAreOnSameLine(pos1, pos2, sourceFile) { - return pos1 === pos2 || - getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2); + ts.isOctalDigit = isOctalDigit; + function couldStartTrivia(text, pos) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + case 10: + case 9: + case 11: + case 12: + case 32: + case 47: + case 60: + case 61: + case 62: + return true; + case 35: + return pos === 0; + default: + return ch > 127; + } } - ts.positionsAreOnSameLine = positionsAreOnSameLine; - function getStartPositionOfRange(range, sourceFile) { - return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); + ts.couldStartTrivia = couldStartTrivia; + function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) { + if (stopAtComments === void 0) { stopAtComments = false; } + if (ts.positionIsSynthesized(pos)) { + return pos; + } + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (stopAfterLineBreak) { + return pos; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + if (stopAtComments) { + break; + } + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + case 60: + case 61: + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + continue; + } + break; + case 35: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + continue; + } + break; + default: + if (ch > 127 && (isWhiteSpace(ch))) { + pos++; + continue; + } + break; + } + return pos; + } } - ts.getStartPositionOfRange = getStartPositionOfRange; - function isDeclarationNameOfEnumOrNamespace(node) { - var parseNode = getParseTreeNode(node); - if (parseNode) { - switch (parseNode.parent.kind) { - case 229: - case 230: - return parseNode === parseNode.parent.name; + ts.skipTrivia = skipTrivia; + var mergeConflictMarkerLength = "<<<<<<<".length; + function isConflictMarkerTrivia(text, pos) { + ts.Debug.assert(pos >= 0); + if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { + var ch = text.charCodeAt(pos); + if ((pos + mergeConflictMarkerLength) < text.length) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { + if (text.charCodeAt(pos + i) !== ch) { + return false; + } + } + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; } - ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace; - function getInitializedVariables(node) { - return ts.filter(node.declarations, isInitializedVariable); - } - ts.getInitializedVariables = getInitializedVariables; - function isInitializedVariable(node) { - return node.initializer !== undefined; - } - function isMergedWithClass(node) { - if (node.symbol) { - for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 226 && declaration !== node) { - return true; + function scanConflictMarkerTrivia(text, pos, error) { + if (error) { + error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); + } + var ch = text.charCodeAt(pos); + var len = text.length; + if (ch === 60 || ch === 62) { + while (pos < len && !isLineBreak(text.charCodeAt(pos))) { + pos++; + } + } + else { + ts.Debug.assert(ch === 61); + while (pos < len) { + var ch_1 = text.charCodeAt(pos); + if (ch_1 === 62 && isConflictMarkerTrivia(text, pos)) { + break; } + pos++; } } - return false; - } - ts.isMergedWithClass = isMergedWithClass; - function isFirstDeclarationOfKind(node, kind) { - return node.symbol && getDeclarationOfKind(node.symbol, kind) === node; - } - ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind; - function isNodeArray(array) { - return array.hasOwnProperty("pos") - && array.hasOwnProperty("end"); - } - ts.isNodeArray = isNodeArray; - function isNoSubstitutionTemplateLiteral(node) { - return node.kind === 12; - } - ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral; - function isLiteralKind(kind) { - return 8 <= kind && kind <= 12; - } - ts.isLiteralKind = isLiteralKind; - function isTextualLiteralKind(kind) { - return kind === 9 || kind === 12; - } - ts.isTextualLiteralKind = isTextualLiteralKind; - function isLiteralExpression(node) { - return isLiteralKind(node.kind); - } - ts.isLiteralExpression = isLiteralExpression; - function isTemplateLiteralKind(kind) { - return 12 <= kind && kind <= 15; - } - ts.isTemplateLiteralKind = isTemplateLiteralKind; - function isTemplateHead(node) { - return node.kind === 13; - } - ts.isTemplateHead = isTemplateHead; - function isTemplateMiddleOrTemplateTail(node) { - var kind = node.kind; - return kind === 14 - || kind === 15; - } - ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail; - function isIdentifier(node) { - return node.kind === 70; - } - ts.isIdentifier = isIdentifier; - function isGeneratedIdentifier(node) { - return isIdentifier(node) && node.autoGenerateKind > 0; - } - ts.isGeneratedIdentifier = isGeneratedIdentifier; - function isModifier(node) { - return isModifierKind(node.kind); - } - ts.isModifier = isModifier; - function isQualifiedName(node) { - return node.kind === 141; - } - ts.isQualifiedName = isQualifiedName; - function isComputedPropertyName(node) { - return node.kind === 142; - } - ts.isComputedPropertyName = isComputedPropertyName; - function isEntityName(node) { - var kind = node.kind; - return kind === 141 - || kind === 70; + return pos; } - ts.isEntityName = isEntityName; - function isPropertyName(node) { - var kind = node.kind; - return kind === 70 - || kind === 9 - || kind === 8 - || kind === 142; + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + ts.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); } - ts.isPropertyName = isPropertyName; - function isModuleName(node) { - var kind = node.kind; - return kind === 70 - || kind === 9; + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; } - ts.isModuleName = isModuleName; - function isBindingName(node) { - var kind = node.kind; - return kind === 70 - || kind === 172 - || kind === 173; + function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) { + var pendingPos; + var pendingEnd; + var pendingKind; + var pendingHasTrailingNewLine; + var hasPendingCommentRange = false; + var collecting = trailing || pos === 0; + var accumulator = initial; + scan: while (pos >= 0 && pos < text.length) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (trailing) { + break scan; + } + collecting = true; + if (hasPendingCommentRange) { + pendingHasTrailingNewLine = true; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 || nextChar === 42) { + var kind = nextChar === 47 ? 2 : 3; + var startPos = pos; + pos += 2; + if (nextChar === 47) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + if (!reduce && accumulator) { + return accumulator; + } + hasPendingCommentRange = false; + } + pendingPos = startPos; + pendingEnd = pos; + pendingKind = kind; + pendingHasTrailingNewLine = hasTrailingNewLine; + hasPendingCommentRange = true; + } + continue; + } + break scan; + default: + if (ch > 127 && (isWhiteSpace(ch))) { + if (hasPendingCommentRange && isLineBreak(ch)) { + pendingHasTrailingNewLine = true; + } + pos++; + continue; + } + break scan; + } + } + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + } + return accumulator; } - ts.isBindingName = isBindingName; - function isTypeParameter(node) { - return node.kind === 143; + function forEachLeadingCommentRange(text, pos, cb, state) { + return iterateCommentRanges(false, text, pos, false, cb, state); } - ts.isTypeParameter = isTypeParameter; - function isParameter(node) { - return node.kind === 144; + ts.forEachLeadingCommentRange = forEachLeadingCommentRange; + function forEachTrailingCommentRange(text, pos, cb, state) { + return iterateCommentRanges(false, text, pos, true, cb, state); } - ts.isParameter = isParameter; - function isDecorator(node) { - return node.kind === 145; + ts.forEachTrailingCommentRange = forEachTrailingCommentRange; + function reduceEachLeadingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges(true, text, pos, false, cb, state, initial); } - ts.isDecorator = isDecorator; - function isMethodDeclaration(node) { - return node.kind === 149; + ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange; + function reduceEachTrailingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges(true, text, pos, true, cb, state, initial); } - ts.isMethodDeclaration = isMethodDeclaration; - function isClassElement(node) { - var kind = node.kind; - return kind === 150 - || kind === 147 - || kind === 149 - || kind === 151 - || kind === 152 - || kind === 155 - || kind === 203; + ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange; + function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) { + if (!comments) { + comments = []; + } + comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); + return comments; } - ts.isClassElement = isClassElement; - function isObjectLiteralElementLike(node) { - var kind = node.kind; - return kind === 257 - || kind === 258 - || kind === 259 - || kind === 149 - || kind === 151 - || kind === 152 - || kind === 244; + function getLeadingCommentRanges(text, pos) { + return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); } - ts.isObjectLiteralElementLike = isObjectLiteralElementLike; - function isTypeNodeKind(kind) { - return (kind >= 156 && kind <= 171) - || kind === 118 - || kind === 132 - || kind === 121 - || kind === 134 - || kind === 135 - || kind === 104 - || kind === 129 - || kind === 199; + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); } - function isTypeNode(node) { - return isTypeNodeKind(node.kind); + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function getShebang(text) { + return shebangTriviaRegex.test(text) + ? shebangTriviaRegex.exec(text)[0] + : undefined; } - ts.isTypeNode = isTypeNode; - function isArrayBindingPattern(node) { - return node.kind === 173; + ts.getShebang = getShebang; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } - ts.isArrayBindingPattern = isArrayBindingPattern; - function isObjectBindingPattern(node) { - return node.kind === 172; + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } - ts.isObjectBindingPattern = isObjectBindingPattern; - function isBindingPattern(node) { - if (node) { - var kind = node.kind; - return kind === 173 - || kind === 172; + ts.isIdentifierPart = isIdentifierPart; + function isIdentifierText(name, languageVersion) { + if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { + return false; } - return false; - } - ts.isBindingPattern = isBindingPattern; - function isAssignmentPattern(node) { - var kind = node.kind; - return kind === 175 - || kind === 176; - } - ts.isAssignmentPattern = isAssignmentPattern; - function isBindingElement(node) { - return node.kind === 174; - } - ts.isBindingElement = isBindingElement; - function isArrayBindingElement(node) { - var kind = node.kind; - return kind === 174 - || kind === 198; - } - ts.isArrayBindingElement = isArrayBindingElement; - function isDeclarationBindingElement(bindingElement) { - switch (bindingElement.kind) { - case 223: - case 144: - case 174: - return true; + for (var i = 1; i < name.length; i++) { + if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { + return false; + } } - return false; - } - ts.isDeclarationBindingElement = isDeclarationBindingElement; - function isBindingOrAssignmentPattern(node) { - return isObjectBindingOrAssignmentPattern(node) - || isArrayBindingOrAssignmentPattern(node); + return true; } - ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; - function isObjectBindingOrAssignmentPattern(node) { - switch (node.kind) { - case 172: - case 176: - return true; + ts.isIdentifierText = isIdentifierText; + function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { + if (languageVariant === void 0) { languageVariant = 0; } + var pos; + var end; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + var hasExtendedUnicodeEscape; + var tokenIsUnterminated; + var numericLiteralFlags; + setText(text, start, length); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 70 || token > 106; }, + isReservedWord: function () { return token >= 71 && token <= 106; }, + isUnterminated: function () { return tokenIsUnterminated; }, + getNumericLiteralFlags: function () { return numericLiteralFlags; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scanJsxIdentifier: scanJsxIdentifier, + scanJsxAttributeValue: scanJsxAttributeValue, + reScanJsxToken: reScanJsxToken, + scanJsxToken: scanJsxToken, + scanJSDocToken: scanJSDocToken, + scan: scan, + getText: getText, + setText: setText, + setScriptTarget: setScriptTarget, + setLanguageVariant: setLanguageVariant, + setOnError: setOnError, + setTextPos: setTextPos, + tryScan: tryScan, + lookAhead: lookAhead, + scanRange: scanRange, + }; + function error(message, length) { + if (onError) { + onError(message, length || 0); + } } - return false; - } - ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; - function isArrayBindingOrAssignmentPattern(node) { - switch (node.kind) { - case 173: - case 175: - return true; + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { + pos++; + numericLiteralFlags = 2; + if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return "" + +(text.substring(start, end)); } - return false; - } - ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; - function isArrayLiteralExpression(node) { - return node.kind === 175; - } - ts.isArrayLiteralExpression = isArrayLiteralExpression; - function isObjectLiteralExpression(node) { - return node.kind === 176; - } - ts.isObjectLiteralExpression = isObjectLiteralExpression; - function isPropertyAccessExpression(node) { - return node.kind === 177; - } - ts.isPropertyAccessExpression = isPropertyAccessExpression; - function isElementAccessExpression(node) { - return node.kind === 178; - } - ts.isElementAccessExpression = isElementAccessExpression; - function isBinaryExpression(node) { - return node.kind === 192; - } - ts.isBinaryExpression = isBinaryExpression; - function isConditionalExpression(node) { - return node.kind === 193; - } - ts.isConditionalExpression = isConditionalExpression; - function isCallExpression(node) { - return node.kind === 179; - } - ts.isCallExpression = isCallExpression; - function isTemplateLiteral(node) { - var kind = node.kind; - return kind === 194 - || kind === 12; - } - ts.isTemplateLiteral = isTemplateLiteral; - function isSpreadExpression(node) { - return node.kind === 196; - } - ts.isSpreadExpression = isSpreadExpression; - function isExpressionWithTypeArguments(node) { - return node.kind === 199; - } - ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; - function isLeftHandSideExpressionKind(kind) { - return kind === 177 - || kind === 178 - || kind === 180 - || kind === 179 - || kind === 246 - || kind === 247 - || kind === 181 - || kind === 175 - || kind === 183 - || kind === 176 - || kind === 197 - || kind === 184 - || kind === 70 - || kind === 11 - || kind === 8 - || kind === 9 - || kind === 12 - || kind === 194 - || kind === 85 - || kind === 94 - || kind === 98 - || kind === 100 - || kind === 96 - || kind === 201 - || kind === 297; - } - function isLeftHandSideExpression(node) { - return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); - } - ts.isLeftHandSideExpression = isLeftHandSideExpression; - function isUnaryExpressionKind(kind) { - return kind === 190 - || kind === 191 - || kind === 186 - || kind === 187 - || kind === 188 - || kind === 189 - || kind === 182 - || isLeftHandSideExpressionKind(kind); - } - function isUnaryExpression(node) { - return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); - } - ts.isUnaryExpression = isUnaryExpression; - function isExpressionKind(kind) { - return kind === 193 - || kind === 195 - || kind === 185 - || kind === 192 - || kind === 196 - || kind === 200 - || kind === 198 - || kind === 297 - || isUnaryExpressionKind(kind); - } - function isExpression(node) { - return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); - } - ts.isExpression = isExpression; - function isAssertionExpression(node) { - var kind = node.kind; - return kind === 182 - || kind === 200; - } - ts.isAssertionExpression = isAssertionExpression; - function isPartiallyEmittedExpression(node) { - return node.kind === 294; - } - ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; - function isNotEmittedStatement(node) { - return node.kind === 293; - } - ts.isNotEmittedStatement = isNotEmittedStatement; - function isNotEmittedOrPartiallyEmittedNode(node) { - return isNotEmittedStatement(node) - || isPartiallyEmittedExpression(node); - } - ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; - function isOmittedExpression(node) { - return node.kind === 198; - } - ts.isOmittedExpression = isOmittedExpression; - function isTemplateSpan(node) { - return node.kind === 202; - } - ts.isTemplateSpan = isTemplateSpan; - function isBlock(node) { - return node.kind === 204; - } - ts.isBlock = isBlock; - function isConciseBody(node) { - return isBlock(node) - || isExpression(node); - } - ts.isConciseBody = isConciseBody; - function isFunctionBody(node) { - return isBlock(node); - } - ts.isFunctionBody = isFunctionBody; - function isForInitializer(node) { - return isVariableDeclarationList(node) - || isExpression(node); - } - ts.isForInitializer = isForInitializer; - function isVariableDeclaration(node) { - return node.kind === 223; - } - ts.isVariableDeclaration = isVariableDeclaration; - function isVariableDeclarationList(node) { - return node.kind === 224; - } - ts.isVariableDeclarationList = isVariableDeclarationList; - function isCaseBlock(node) { - return node.kind === 232; - } - ts.isCaseBlock = isCaseBlock; - function isModuleBody(node) { - var kind = node.kind; - return kind === 231 - || kind === 230; - } - ts.isModuleBody = isModuleBody; - function isImportEqualsDeclaration(node) { - return node.kind === 234; - } - ts.isImportEqualsDeclaration = isImportEqualsDeclaration; - function isImportClause(node) { - return node.kind === 236; - } - ts.isImportClause = isImportClause; - function isNamedImportBindings(node) { - var kind = node.kind; - return kind === 238 - || kind === 237; - } - ts.isNamedImportBindings = isNamedImportBindings; - function isImportSpecifier(node) { - return node.kind === 239; - } - ts.isImportSpecifier = isImportSpecifier; - function isNamedExports(node) { - return node.kind === 242; - } - ts.isNamedExports = isNamedExports; - function isExportSpecifier(node) { - return node.kind === 243; - } - ts.isExportSpecifier = isExportSpecifier; - function isModuleOrEnumDeclaration(node) { - return node.kind === 230 || node.kind === 229; - } - ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; - function isDeclarationKind(kind) { - return kind === 185 - || kind === 174 - || kind === 226 - || kind === 197 - || kind === 150 - || kind === 229 - || kind === 260 - || kind === 243 - || kind === 225 - || kind === 184 - || kind === 151 - || kind === 236 - || kind === 234 - || kind === 239 - || kind === 227 - || kind === 149 - || kind === 148 - || kind === 230 - || kind === 233 - || kind === 237 - || kind === 144 - || kind === 257 - || kind === 147 - || kind === 146 - || kind === 152 - || kind === 258 - || kind === 228 - || kind === 143 - || kind === 223 - || kind === 285; - } - function isDeclarationStatementKind(kind) { - return kind === 225 - || kind === 244 - || kind === 226 - || kind === 227 - || kind === 228 - || kind === 229 - || kind === 230 - || kind === 235 - || kind === 234 - || kind === 241 - || kind === 240 - || kind === 233; - } - function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 - || kind === 214 - || kind === 222 - || kind === 209 - || kind === 207 - || kind === 206 - || kind === 212 - || kind === 213 - || kind === 211 - || kind === 208 - || kind === 219 - || kind === 216 - || kind === 218 - || kind === 220 - || kind === 221 - || kind === 205 - || kind === 210 - || kind === 217 - || kind === 293 - || kind === 296 - || kind === 295; - } - function isDeclaration(node) { - return isDeclarationKind(node.kind); - } - ts.isDeclaration = isDeclaration; - function isDeclarationStatement(node) { - return isDeclarationStatementKind(node.kind); - } - ts.isDeclarationStatement = isDeclarationStatement; - function isStatementButNotDeclaration(node) { - return isStatementKindButNotDeclarationKind(node.kind); - } - ts.isStatementButNotDeclaration = isStatementButNotDeclaration; - function isStatement(node) { - var kind = node.kind; - return isStatementKindButNotDeclarationKind(kind) - || isDeclarationStatementKind(kind) - || kind === 204; - } - ts.isStatement = isStatement; - function isModuleReference(node) { - var kind = node.kind; - return kind === 245 - || kind === 141 - || kind === 70; - } - ts.isModuleReference = isModuleReference; - function isJsxOpeningElement(node) { - return node.kind === 248; - } - ts.isJsxOpeningElement = isJsxOpeningElement; - function isJsxClosingElement(node) { - return node.kind === 249; - } - ts.isJsxClosingElement = isJsxClosingElement; - function isJsxTagNameExpression(node) { - var kind = node.kind; - return kind === 98 - || kind === 70 - || kind === 177; - } - ts.isJsxTagNameExpression = isJsxTagNameExpression; - function isJsxChild(node) { - var kind = node.kind; - return kind === 246 - || kind === 252 - || kind === 247 - || kind === 10; - } - ts.isJsxChild = isJsxChild; - function isJsxAttributeLike(node) { - var kind = node.kind; - return kind === 250 - || kind === 251; - } - ts.isJsxAttributeLike = isJsxAttributeLike; - function isJsxSpreadAttribute(node) { - return node.kind === 251; - } - ts.isJsxSpreadAttribute = isJsxSpreadAttribute; - function isJsxAttribute(node) { - return node.kind === 250; - } - ts.isJsxAttribute = isJsxAttribute; - function isStringLiteralOrJsxExpression(node) { - var kind = node.kind; - return kind === 9 - || kind === 252; - } - ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; - function isCaseOrDefaultClause(node) { - var kind = node.kind; - return kind === 253 - || kind === 254; - } - ts.isCaseOrDefaultClause = isCaseOrDefaultClause; - function isHeritageClause(node) { - return node.kind === 255; - } - ts.isHeritageClause = isHeritageClause; - function isCatchClause(node) { - return node.kind === 256; - } - ts.isCatchClause = isCatchClause; - function isPropertyAssignment(node) { - return node.kind === 257; - } - ts.isPropertyAssignment = isPropertyAssignment; - function isShorthandPropertyAssignment(node) { - return node.kind === 258; - } - ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; - function isEnumMember(node) { - return node.kind === 260; - } - ts.isEnumMember = isEnumMember; - function isSourceFile(node) { - return node.kind === 261; - } - ts.isSourceFile = isSourceFile; - function isWatchSet(options) { - return options.watch && options.hasOwnProperty("watch"); - } - ts.isWatchSet = isWatchSet; -})(ts || (ts = {})); -(function (ts) { - function getDefaultLibFileName(options) { - switch (options.target) { - case 5: - case 4: - return "lib.es2017.d.ts"; - case 3: - return "lib.es2016.d.ts"; - case 2: - return "lib.es6.d.ts"; - default: - return "lib.d.ts"; + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); } - } - ts.getDefaultLibFileName = getDefaultLibFileName; - function textSpanEnd(span) { - return span.start + span.length; - } - ts.textSpanEnd = textSpanEnd; - function textSpanIsEmpty(span) { - return span.length === 0; - } - ts.textSpanIsEmpty = textSpanIsEmpty; - function textSpanContainsPosition(span, position) { - return position >= span.start && position < textSpanEnd(span); - } - ts.textSpanContainsPosition = textSpanContainsPosition; - function textSpanContainsTextSpan(span, other) { - return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); - } - ts.textSpanContainsTextSpan = textSpanContainsTextSpan; - function textSpanOverlapsWith(span, other) { - var overlapStart = Math.max(span.start, other.start); - var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other)); - return overlapStart < overlapEnd; - } - ts.textSpanOverlapsWith = textSpanOverlapsWith; - function textSpanOverlap(span1, span2) { - var overlapStart = Math.max(span1.start, span2.start); - var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); - if (overlapStart < overlapEnd) { - return createTextSpanFromBounds(overlapStart, overlapEnd); + function scanExactNumberOfHexDigits(count) { + return scanHexDigits(count, false); } - return undefined; - } - ts.textSpanOverlap = textSpanOverlap; - function textSpanIntersectsWithTextSpan(span, other) { - return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start; - } - ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan; - function textSpanIntersectsWith(span, start, length) { - var end = start + length; - return start <= textSpanEnd(span) && end >= span.start; - } - ts.textSpanIntersectsWith = textSpanIntersectsWith; - function decodedTextSpanIntersectsWith(start1, length1, start2, length2) { - var end1 = start1 + length1; - var end2 = start2 + length2; - return start2 <= end1 && end2 >= start1; - } - ts.decodedTextSpanIntersectsWith = decodedTextSpanIntersectsWith; - function textSpanIntersectsWithPosition(span, position) { - return position <= textSpanEnd(span) && position >= span.start; - } - ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition; - function textSpanIntersection(span1, span2) { - var intersectStart = Math.max(span1.start, span2.start); - var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); - if (intersectStart <= intersectEnd) { - return createTextSpanFromBounds(intersectStart, intersectEnd); + function scanMinimumNumberOfHexDigits(count) { + return scanHexDigits(count, true); + } + function scanHexDigits(minCount, scanAsManyAsPossible) { + var digits = 0; + var value = 0; + while (digits < minCount || scanAsManyAsPossible) { + var ch = text.charCodeAt(pos); + if (ch >= 48 && ch <= 57) { + value = value * 16 + ch - 48; + } + else if (ch >= 65 && ch <= 70) { + value = value * 16 + ch - 65 + 10; + } + else if (ch >= 97 && ch <= 102) { + value = value * 16 + ch - 97 + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < minCount) { + value = -1; + } + return value; + } + function scanString(allowEscapes) { + if (allowEscapes === void 0) { allowEscapes = true; } + var quote = text.charCodeAt(pos); + pos++; + var result = ""; + var start = pos; + while (true) { + if (pos >= end) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92 && allowEscapes) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= end) { + contents += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 12 : 15; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 12 : 15; + break; + } + if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 13 : 14; + break; + } + if (currChar === 92) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13) { + contents += text.substring(start, pos); + pos++; + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= end) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 48: + return "\0"; + case 98: + return "\b"; + case 116: + return "\t"; + case 110: + return "\n"; + case 118: + return "\v"; + case 102: + return "\f"; + case 114: + return "\r"; + case 39: + return "\'"; + case 34: + return "\""; + case 117: + if (pos < end && text.charCodeAt(pos) === 123) { + hasExtendedUnicodeEscape = true; + pos++; + return scanExtendedUnicodeEscape(); + } + return scanHexadecimalEscape(4); + case 120: + return scanHexadecimalEscape(2); + case 13: + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + case 8232: + case 8233: + return ""; + default: + return String.fromCharCode(ch); + } + } + function scanHexadecimalEscape(numDigits) { + var escapedValue = scanExactNumberOfHexDigits(numDigits); + if (escapedValue >= 0) { + return String.fromCharCode(escapedValue); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + } + function scanExtendedUnicodeEscape() { + var escapedValue = scanMinimumNumberOfHexDigits(1); + var isInvalidExtendedEscape = false; + if (escapedValue < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + isInvalidExtendedEscape = true; + } + else if (escapedValue > 0x10FFFF) { + error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); + isInvalidExtendedEscape = true; + } + if (pos >= end) { + error(ts.Diagnostics.Unexpected_end_of_text); + isInvalidExtendedEscape = true; + } + else if (text.charCodeAt(pos) === 125) { + pos++; + } + else { + error(ts.Diagnostics.Unterminated_Unicode_escape_sequence); + isInvalidExtendedEscape = true; + } + if (isInvalidExtendedEscape) { + return ""; + } + return utf16EncodeAsString(escapedValue); + } + function utf16EncodeAsString(codePoint) { + ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF); + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); + } + var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800; + var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00; + return String.fromCharCode(codeUnit1, codeUnit2); + } + function peekUnicodeEscape() { + if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) { + var start_1 = pos; + pos += 2; + var value = scanExactNumberOfHexDigits(4); + pos = start_1; + return value; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < end) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch, languageVersion)) { + pos++; + } + else if (ch === 92) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } + } + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } + } + } + return token = 70; + } + function scanBinaryOrOctalDigits(base) { + ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8"); + var value = 0; + var numberOfDigits = 0; + while (true) { + var ch = text.charCodeAt(pos); + var valueOfCh = ch - 48; + if (!isDigit(ch) || valueOfCh >= base) { + break; + } + value = value * base + valueOfCh; + pos++; + numberOfDigits++; + } + if (numberOfDigits === 0) { + return -1; + } + return value; + } + function scan() { + startPos = pos; + hasExtendedUnicodeEscape = false; + precedingLineBreak = false; + tokenIsUnterminated = false; + numericLiteralFlags = 0; + while (true) { + tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var ch = text.charCodeAt(pos); + if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + switch (ch) { + case 10: + case 13: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) { + pos += 2; + } + else { + pos++; + } + return token = 4; + } + case 9: + case 11: + case 12: + case 32: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + } + case 33: + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 34; + } + return pos += 2, token = 32; + } + pos++; + return token = 50; + case 34: + case 39: + tokenValue = scanString(); + return token = 9; + case 96: + return token = scanTemplateAndSetTokenValue(); + case 37: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 63; + } + pos++; + return token = 41; + case 38: + if (text.charCodeAt(pos + 1) === 38) { + return pos += 2, token = 52; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 67; + } + pos++; + return token = 47; + case 40: + pos++; + return token = 18; + case 41: + pos++; + return token = 19; + case 42: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 60; + } + if (text.charCodeAt(pos + 1) === 42) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 61; + } + return pos += 2, token = 39; + } + pos++; + return token = 38; + case 43: + if (text.charCodeAt(pos + 1) === 43) { + return pos += 2, token = 42; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 58; + } + pos++; + return token = 36; + case 44: + pos++; + return token = 25; + case 45: + if (text.charCodeAt(pos + 1) === 45) { + return pos += 2, token = 43; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 59; + } + pos++; + return token = 37; + case 46: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = scanNumber(); + return token = 8; + } + if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { + return pos += 3, token = 23; + } + pos++; + return token = 22; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < end) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + if (skipTrivia) { + continue; + } + else { + return token = 2; + } + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + var commentClosed = false; + while (pos < end) { + var ch_2 = text.charCodeAt(pos); + if (ch_2 === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch_2)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia) { + continue; + } + else { + tokenIsUnterminated = !commentClosed; + return token = 3; + } + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 62; + } + pos++; + return token = 40; + case 48: + if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { + pos += 2; + var value = scanMinimumNumberOfHexDigits(1); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + numericLiteralFlags = 8; + return token = 8; + } + else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { + pos += 2; + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { + error(ts.Diagnostics.Binary_digit_expected); + value = 0; + } + tokenValue = "" + value; + numericLiteralFlags = 16; + return token = 8; + } + else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { + pos += 2; + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { + error(ts.Diagnostics.Octal_digit_expected); + value = 0; + } + tokenValue = "" + value; + numericLiteralFlags = 32; + return token = 8; + } + if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + numericLiteralFlags = 4; + return token = 8; + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + tokenValue = scanNumber(); + return token = 8; + case 58: + pos++; + return token = 55; + case 59: + pos++; + return token = 24; + case 60: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 60) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 64; + } + return pos += 2, token = 44; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 29; + } + if (languageVariant === 1 && + text.charCodeAt(pos + 1) === 47 && + text.charCodeAt(pos + 2) !== 42) { + return pos += 2, token = 27; + } + pos++; + return token = 26; + case 61: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 33; + } + return pos += 2, token = 31; + } + if (text.charCodeAt(pos + 1) === 62) { + return pos += 2, token = 35; + } + pos++; + return token = 57; + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + pos++; + return token = 28; + case 63: + pos++; + return token = 54; + case 91: + pos++; + return token = 20; + case 93: + pos++; + return token = 21; + case 94: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 69; + } + pos++; + return token = 49; + case 123: + pos++; + return token = 16; + case 124: + if (text.charCodeAt(pos + 1) === 124) { + return pos += 2, token = 53; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 68; + } + pos++; + return token = 48; + case 125: + pos++; + return token = 17; + case 126: + pos++; + return token = 51; + case 64: + pos++; + return token = 56; + case 92: + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { + pos += 6; + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + pos++; + return token = 0; + default: + if (isIdentifierStart(ch, languageVersion)) { + pos++; + while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpaceSingleLine(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + pos++; + return token = 0; + } + } + } + function reScanGreaterToken() { + if (token === 28) { + if (text.charCodeAt(pos) === 62) { + if (text.charCodeAt(pos + 1) === 62) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 66; + } + return pos += 2, token = 46; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 65; + } + pos++; + return token = 45; + } + if (text.charCodeAt(pos) === 61) { + pos++; + return token = 30; + } + } + return token; } - return undefined; - } - ts.textSpanIntersection = textSpanIntersection; - function createTextSpan(start, length) { - if (start < 0) { - throw new Error("start < 0"); + function reScanSlashToken() { + if (token === 40 || token === 62) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= end) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 && !inCharacterClass) { + p++; + break; + } + else if (ch === 91) { + inCharacterClass = true; + } + else if (ch === 92) { + inEscape = true; + } + else if (ch === 93) { + inCharacterClass = false; + } + p++; + } + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 11; + } + return token; } - if (length < 0) { - throw new Error("length < 0"); + function reScanTemplateToken() { + ts.Debug.assert(token === 17, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); } - return { start: start, length: length }; - } - ts.createTextSpan = createTextSpan; - function createTextSpanFromBounds(start, end) { - return createTextSpan(start, end - start); - } - ts.createTextSpanFromBounds = createTextSpanFromBounds; - function textChangeRangeNewSpan(range) { - return createTextSpan(range.span.start, range.newLength); - } - ts.textChangeRangeNewSpan = textChangeRangeNewSpan; - function textChangeRangeIsUnchanged(range) { - return textSpanIsEmpty(range.span) && range.newLength === 0; - } - ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged; - function createTextChangeRange(span, newLength) { - if (newLength < 0) { - throw new Error("newLength < 0"); + function reScanJsxToken() { + pos = tokenPos = startPos; + return token = scanJsxToken(); } - return { span: span, newLength: newLength }; - } - ts.createTextChangeRange = createTextChangeRange; - ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); - function collapseTextChangeRangesAcrossMultipleVersions(changes) { - if (changes.length === 0) { - return ts.unchangedTextChangeRange; + function scanJsxToken() { + startPos = tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var char = text.charCodeAt(pos); + if (char === 60) { + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + return token = 27; + } + pos++; + return token = 26; + } + if (char === 123) { + pos++; + return token = 16; + } + while (pos < end) { + pos++; + char = text.charCodeAt(pos); + if (char === 123) { + break; + } + if (char === 60) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7; + } + break; + } + } + return token = 10; } - if (changes.length === 1) { - return changes[0]; + function scanJsxIdentifier() { + if (tokenIsIdentifierOrKeyword(token)) { + var firstCharPosition = pos; + while (pos < end) { + var ch = text.charCodeAt(pos); + if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { + pos++; + } + else { + break; + } + } + tokenValue += text.substr(firstCharPosition, pos - firstCharPosition); + } + return token; } - var change0 = changes[0]; - var oldStartN = change0.span.start; - var oldEndN = textSpanEnd(change0.span); - var newEndN = oldStartN + change0.newLength; - for (var i = 1; i < changes.length; i++) { - var nextChange = changes[i]; - var oldStart1 = oldStartN; - var oldEnd1 = oldEndN; - var newEnd1 = newEndN; - var oldStart2 = nextChange.span.start; - var oldEnd2 = textSpanEnd(nextChange.span); - var newEnd2 = oldStart2 + nextChange.newLength; - oldStartN = Math.min(oldStart1, oldStart2); - oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); - newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); + function scanJsxAttributeValue() { + startPos = pos; + switch (text.charCodeAt(pos)) { + case 34: + case 39: + tokenValue = scanString(false); + return token = 9; + default: + return scan(); + } } - return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN); - } - ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; - function getTypeParameterOwner(d) { - if (d && d.kind === 143) { - for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) { - return current; + function scanJSDocToken() { + if (pos >= end) { + return token = 1; + } + startPos = pos; + tokenPos = pos; + var ch = text.charCodeAt(pos); + switch (ch) { + case 9: + case 11: + case 12: + case 32: + while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + case 64: + pos++; + return token = 56; + case 10: + case 13: + pos++; + return token = 4; + case 42: + pos++; + return token = 38; + case 123: + pos++; + return token = 16; + case 125: + pos++; + return token = 17; + case 91: + pos++; + return token = 20; + case 93: + pos++; + return token = 21; + case 61: + pos++; + return token = 57; + case 44: + pos++; + return token = 25; + case 46: + pos++; + return token = 22; + } + if (isIdentifierStart(ch, 5)) { + pos++; + while (isIdentifierPart(text.charCodeAt(pos), 5) && pos < end) { + pos++; } + return token = 70; + } + else { + return pos += 1, token = 0; } } - } - ts.getTypeParameterOwner = getTypeParameterOwner; - function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent); - } - ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; - function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 || ts.isBindingPattern(node))) { - node = node.parent; + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; } - return node; - } - function getCombinedModifierFlags(node) { - node = walkUpBindingElementsAndPatterns(node); - var flags = ts.getModifierFlags(node); - if (node.kind === 223) { - node = node.parent; + function scanRange(start, length, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var savePrecedingLineBreak = precedingLineBreak; + var saveTokenValue = tokenValue; + var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + var saveTokenIsUnterminated = tokenIsUnterminated; + setText(text, start, length); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + precedingLineBreak = savePrecedingLineBreak; + tokenValue = saveTokenValue; + hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; + tokenIsUnterminated = saveTokenIsUnterminated; + return result; } - if (node && node.kind === 224) { - flags |= ts.getModifierFlags(node); - node = node.parent; + function lookAhead(callback) { + return speculationHelper(callback, true); } - if (node && node.kind === 205) { - flags |= ts.getModifierFlags(node); + function tryScan(callback) { + return speculationHelper(callback, false); } - return flags; - } - ts.getCombinedModifierFlags = getCombinedModifierFlags; - function getCombinedNodeFlags(node) { - node = walkUpBindingElementsAndPatterns(node); - var flags = node.flags; - if (node.kind === 223) { - node = node.parent; + function getText() { + return text; } - if (node && node.kind === 224) { - flags |= node.flags; - node = node.parent; + function setText(newText, start, length) { + text = newText || ""; + end = length === undefined ? text.length : start + length; + setTextPos(start || 0); } - if (node && node.kind === 205) { - flags |= node.flags; + function setOnError(errorCallback) { + onError = errorCallback; } - return flags; - } - ts.getCombinedNodeFlags = getCombinedNodeFlags; - function validateLocaleAndSetLanguage(locale, sys, errors) { - var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); - if (!matchResult) { - if (errors) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); - } - return; + function setScriptTarget(scriptTarget) { + languageVersion = scriptTarget; } - var language = matchResult[1]; - var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors)) { - trySetLanguageAndTerritory(language, undefined, errors); + function setLanguageVariant(variant) { + languageVariant = variant; } - function trySetLanguageAndTerritory(language, territory, errors) { - var compilerFilePath = ts.normalizePath(sys.getExecutingFilePath()); - var containingDirectoryPath = ts.getDirectoryPath(compilerFilePath); - var filePath = ts.combinePaths(containingDirectoryPath, language); - if (territory) { - filePath = filePath + "-" + territory; - } - filePath = sys.resolvePath(ts.combinePaths(filePath, "diagnosticMessages.generated.json")); - if (!sys.fileExists(filePath)) { - return false; - } - var fileContents = ""; - try { - fileContents = sys.readFile(filePath); - } - catch (e) { - if (errors) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, filePath)); - } - return false; - } - try { - ts.localizedDiagnosticMessages = JSON.parse(fileContents); - } - catch (e) { - if (errors) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Corrupted_locale_file_0, filePath)); - } - return false; - } - return true; + function setTextPos(textPos) { + ts.Debug.assert(textPos >= 0); + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0; + precedingLineBreak = false; + tokenValue = undefined; + hasExtendedUnicodeEscape = false; + tokenIsUnterminated = false; } } - ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; + ts.createScanner = createScanner; })(ts || (ts = {})); var ts; (function (ts) { - var NodeConstructor; - var SourceFileConstructor; - function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 - ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) - : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); - var node = location - ? new ConstructorForKind(kind, location.pos, location.end) - : new ConstructorForKind(kind, -1, -1); - node.flags = flags | 8; + function createSynthesizedNode(kind) { + var node = ts.createNode(kind, -1, -1); + node.flags |= 8; return node; } function updateNode(updated, original) { if (updated !== original) { setOriginalNode(updated, original); + setTextRange(updated, original); if (original.startsOnNewLine) { updated.startsOnNewLine = true; } @@ -10580,7 +10466,7 @@ var ts; return updated; } ts.updateNode = updateNode; - function createNodeArray(elements, location, hasTrailingComma) { + function createNodeArray(elements, hasTrailingComma) { if (elements) { if (ts.isNodeArray(elements)) { return elements; @@ -10590,32 +10476,15 @@ var ts; elements = []; } var array = elements; - if (location) { - array.pos = location.pos; - array.end = location.end; - } - else { - array.pos = -1; - array.end = -1; - } - if (hasTrailingComma) { - array.hasTrailingComma = true; - } + array.pos = -1; + array.end = -1; + array.hasTrailingComma = hasTrailingComma; return array; } ts.createNodeArray = createNodeArray; - function createSynthesizedNode(kind, startsOnNewLine) { - var node = createNode(kind, undefined); - node.startsOnNewLine = startsOnNewLine; - return node; - } - ts.createSynthesizedNode = createSynthesizedNode; - function createSynthesizedNodeArray(elements) { - return createNodeArray(elements, undefined); - } - ts.createSynthesizedNodeArray = createSynthesizedNodeArray; function getSynthesizedClone(node) { - var clone = createNode(node.kind, undefined, node.flags); + var clone = createSynthesizedNode(node.kind); + clone.flags |= node.flags; setOriginalNode(clone, node); for (var key in node) { if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { @@ -10626,50 +10495,48 @@ var ts; return clone; } ts.getSynthesizedClone = getSynthesizedClone; - function getMutableClone(node) { - var clone = getSynthesizedClone(node); - clone.pos = node.pos; - clone.end = node.end; - clone.parent = node.parent; - return clone; - } - ts.getMutableClone = getMutableClone; - function createLiteral(value, location) { + function createLiteral(value) { if (typeof value === "number") { - var node = createNode(8, location, undefined); - node.text = value.toString(); - return node; - } - else if (typeof value === "boolean") { - return createNode(value ? 100 : 85, location, undefined); + return createNumericLiteral(value + ""); } - else if (typeof value === "string") { - var node = createNode(9, location, undefined); - node.text = value; - return node; + if (typeof value === "boolean") { + return value ? createTrue() : createFalse(); } - else if (value) { - var node = createNode(9, location, undefined); - node.textSourceNode = value; - node.text = value.text; - return node; + if (typeof value === "string") { + return createStringLiteral(value); } + return createLiteralFromNode(value); } ts.createLiteral = createLiteral; - var nextAutoGenerateId = 0; - function createIdentifier(text, location) { - var node = createNode(70, location); + function createNumericLiteral(value) { + var node = createSynthesizedNode(8); + node.text = value; + node.numericLiteralFlags = 0; + return node; + } + ts.createNumericLiteral = createNumericLiteral; + function createStringLiteral(text) { + var node = createSynthesizedNode(9); + node.text = text; + return node; + } + function createLiteralFromNode(sourceNode) { + var node = createStringLiteral(sourceNode.text); + node.textSourceNode = sourceNode; + return node; + } + function createIdentifier(text) { + var node = createSynthesizedNode(70); node.text = ts.escapeIdentifier(text); - node.originalKeywordKind = ts.stringToToken(text); + node.originalKeywordKind = text ? ts.stringToToken(text) : 0; node.autoGenerateKind = 0; node.autoGenerateId = 0; return node; } ts.createIdentifier = createIdentifier; - function createTempVariable(recordTempVariable, location) { - var name = createNode(70, location); - name.text = ""; - name.originalKeywordKind = 0; + var nextAutoGenerateId = 0; + function createTempVariable(recordTempVariable) { + var name = createIdentifier(""); name.autoGenerateKind = 1; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; @@ -10679,93 +10546,387 @@ var ts; return name; } ts.createTempVariable = createTempVariable; - function createLoopVariable(location) { - var name = createNode(70, location); - name.text = ""; - name.originalKeywordKind = 0; + function createLoopVariable() { + var name = createIdentifier(""); name.autoGenerateKind = 2; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createLoopVariable = createLoopVariable; - function createUniqueName(text, location) { - var name = createNode(70, location); - name.text = text; - name.originalKeywordKind = 0; + function createUniqueName(text) { + var name = createIdentifier(text); name.autoGenerateKind = 3; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createUniqueName = createUniqueName; - function getGeneratedNameForNode(node, location) { - var name = createNode(70, location); - name.original = node; - name.text = ""; - name.originalKeywordKind = 0; + function getGeneratedNameForNode(node) { + var name = createIdentifier(""); name.autoGenerateKind = 4; name.autoGenerateId = nextAutoGenerateId; + name.original = node; nextAutoGenerateId++; return name; } ts.getGeneratedNameForNode = getGeneratedNameForNode; function createToken(token) { - return createNode(token); + return createSynthesizedNode(token); } ts.createToken = createToken; function createSuper() { - var node = createNode(96); - return node; + return createSynthesizedNode(96); } ts.createSuper = createSuper; - function createThis(location) { - var node = createNode(98, location); - return node; + function createThis() { + return createSynthesizedNode(98); } ts.createThis = createThis; function createNull() { - var node = createNode(94); - return node; + return createSynthesizedNode(94); } ts.createNull = createNull; - function createComputedPropertyName(expression, location) { - var node = createNode(142, location); + function createTrue() { + return createSynthesizedNode(100); + } + ts.createTrue = createTrue; + function createFalse() { + return createSynthesizedNode(85); + } + ts.createFalse = createFalse; + function createQualifiedName(left, right) { + var node = createSynthesizedNode(142); + node.left = left; + node.right = asName(right); + return node; + } + ts.createQualifiedName = createQualifiedName; + function updateQualifiedName(node, left, right) { + return node.left !== left + || node.right !== right + ? updateNode(createQualifiedName(left, right), node) + : node; + } + ts.updateQualifiedName = updateQualifiedName; + function createComputedPropertyName(expression) { + var node = createSynthesizedNode(143); node.expression = expression; return node; } ts.createComputedPropertyName = createComputedPropertyName; function updateComputedPropertyName(node, expression) { - if (node.expression !== expression) { - return updateNode(createComputedPropertyName(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createComputedPropertyName(expression), node) + : node; } ts.updateComputedPropertyName = updateComputedPropertyName; - function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createSignatureDeclaration(kind, typeParameters, parameters, type) { + var signatureDeclaration = createSynthesizedNode(kind); + signatureDeclaration.typeParameters = asNodeArray(typeParameters); + signatureDeclaration.parameters = asNodeArray(parameters); + signatureDeclaration.type = type; + return signatureDeclaration; + } + ts.createSignatureDeclaration = createSignatureDeclaration; + function updateSignatureDeclaration(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) + : node; + } + function createFunctionTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(159, typeParameters, parameters, type); + } + ts.createFunctionTypeNode = createFunctionTypeNode; + function updateFunctionTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateFunctionTypeNode = updateFunctionTypeNode; + function createConstructorTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(160, typeParameters, parameters, type); + } + ts.createConstructorTypeNode = createConstructorTypeNode; + function updateConstructorTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructorTypeNode = updateConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(154, typeParameters, parameters, type); + } + ts.createCallSignatureDeclaration = createCallSignatureDeclaration; + function updateCallSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateCallSignatureDeclaration = updateCallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(155, typeParameters, parameters, type); + } + ts.createConstructSignatureDeclaration = createConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructSignatureDeclaration = updateConstructSignatureDeclaration; + function createMethodSignature(typeParameters, parameters, type, name, questionToken) { + var methodSignature = createSignatureDeclaration(149, typeParameters, parameters, type); + methodSignature.name = asName(name); + methodSignature.questionToken = questionToken; + return methodSignature; + } + ts.createMethodSignature = createMethodSignature; + function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.name !== name + || node.questionToken !== questionToken + ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) + : node; + } + ts.updateMethodSignature = updateMethodSignature; + function createKeywordTypeNode(kind) { + return createSynthesizedNode(kind); + } + ts.createKeywordTypeNode = createKeywordTypeNode; + function createThisTypeNode() { + return createSynthesizedNode(168); + } + ts.createThisTypeNode = createThisTypeNode; + function createLiteralTypeNode(literal) { + var literalTypeNode = createSynthesizedNode(172); + literalTypeNode.literal = literal; + return literalTypeNode; + } + ts.createLiteralTypeNode = createLiteralTypeNode; + function updateLiteralTypeNode(node, literal) { + return node.literal !== literal + ? updateNode(createLiteralTypeNode(literal), node) + : node; + } + ts.updateLiteralTypeNode = updateLiteralTypeNode; + function createTypeReferenceNode(typeName, typeArguments) { + var typeReference = createSynthesizedNode(158); + typeReference.typeName = asName(typeName); + typeReference.typeArguments = asNodeArray(typeArguments); + return typeReference; + } + ts.createTypeReferenceNode = createTypeReferenceNode; + function updateTypeReferenceNode(node, typeName, typeArguments) { + return node.typeName !== typeName + || node.typeArguments !== typeArguments + ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) + : node; + } + ts.updateTypeReferenceNode = updateTypeReferenceNode; + function createTypePredicateNode(parameterName, type) { + var typePredicateNode = createSynthesizedNode(157); + typePredicateNode.parameterName = asName(parameterName); + typePredicateNode.type = type; + return typePredicateNode; + } + ts.createTypePredicateNode = createTypePredicateNode; + function updateTypePredicateNode(node, parameterName, type) { + return node.parameterName !== parameterName + || node.type !== type + ? updateNode(createTypePredicateNode(parameterName, type), node) + : node; + } + ts.updateTypePredicateNode = updateTypePredicateNode; + function createTypeQueryNode(exprName) { + var typeQueryNode = createSynthesizedNode(161); + typeQueryNode.exprName = exprName; + return typeQueryNode; + } + ts.createTypeQueryNode = createTypeQueryNode; + function updateTypeQueryNode(node, exprName) { + return node.exprName !== exprName ? updateNode(createTypeQueryNode(exprName), node) : node; + } + ts.updateTypeQueryNode = updateTypeQueryNode; + function createArrayTypeNode(elementType) { + var arrayTypeNode = createSynthesizedNode(163); + arrayTypeNode.elementType = elementType; + return arrayTypeNode; + } + ts.createArrayTypeNode = createArrayTypeNode; + function updateArrayTypeNode(node, elementType) { + return node.elementType !== elementType + ? updateNode(createArrayTypeNode(elementType), node) + : node; + } + ts.updateArrayTypeNode = updateArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind, types) { + var unionTypeNode = createSynthesizedNode(kind); + unionTypeNode.types = createNodeArray(types); + return unionTypeNode; + } + ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node, types) { + return node.types !== types + ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) + : node; + } + ts.updateUnionOrIntersectionTypeNode = updateUnionOrIntersectionTypeNode; + function createTypeLiteralNode(members) { + var typeLiteralNode = createSynthesizedNode(162); + typeLiteralNode.members = createNodeArray(members); + return typeLiteralNode; + } + ts.createTypeLiteralNode = createTypeLiteralNode; + function updateTypeLiteralNode(node, members) { + return node.members !== members + ? updateNode(createTypeLiteralNode(members), node) + : node; + } + ts.updateTypeLiteralNode = updateTypeLiteralNode; + function createTupleTypeNode(elementTypes) { + var tupleTypeNode = createSynthesizedNode(164); + tupleTypeNode.elementTypes = createNodeArray(elementTypes); + return tupleTypeNode; + } + ts.createTupleTypeNode = createTupleTypeNode; + function updateTypleTypeNode(node, elementTypes) { + return node.elementTypes !== elementTypes + ? updateNode(createTupleTypeNode(elementTypes), node) + : node; + } + ts.updateTypleTypeNode = updateTypleTypeNode; + function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { + var mappedTypeNode = createSynthesizedNode(171); + mappedTypeNode.readonlyToken = readonlyToken; + mappedTypeNode.typeParameter = typeParameter; + mappedTypeNode.questionToken = questionToken; + mappedTypeNode.type = type; + return mappedTypeNode; + } + ts.createMappedTypeNode = createMappedTypeNode; + function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { + return node.readonlyToken !== readonlyToken + || node.typeParameter !== typeParameter + || node.questionToken !== questionToken + || node.type !== type + ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) + : node; + } + ts.updateMappedTypeNode = updateMappedTypeNode; + function createTypeOperatorNode(type) { + var typeOperatorNode = createSynthesizedNode(169); + typeOperatorNode.operator = 126; + typeOperatorNode.type = type; + return typeOperatorNode; + } + ts.createTypeOperatorNode = createTypeOperatorNode; + function updateTypeOperatorNode(node, type) { + return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; + } + ts.updateTypeOperatorNode = updateTypeOperatorNode; + function createIndexedAccessTypeNode(objectType, indexType) { + var indexedAccessTypeNode = createSynthesizedNode(170); + indexedAccessTypeNode.objectType = objectType; + indexedAccessTypeNode.indexType = indexType; + return indexedAccessTypeNode; + } + ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node, objectType, indexType) { + return node.objectType !== objectType + || node.indexType !== indexType + ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) + : node; + } + ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; + function createTypeParameterDeclaration(name, constraint, defaultType) { + var typeParameter = createSynthesizedNode(144); + typeParameter.name = asName(name); + typeParameter.constraint = constraint; + typeParameter.default = defaultType; + return typeParameter; + } + ts.createTypeParameterDeclaration = createTypeParameterDeclaration; + function updateTypeParameterDeclaration(node, name, constraint, defaultType) { + return node.name !== name + || node.constraint !== constraint + || node.default !== defaultType + ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) + : node; + } + ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; + function createPropertySignature(name, questionToken, type, initializer) { + var propertySignature = createSynthesizedNode(147); + propertySignature.name = asName(name); + propertySignature.questionToken = questionToken; + propertySignature.type = type; + propertySignature.initializer = initializer; + return propertySignature; + } + ts.createPropertySignature = createPropertySignature; + function updatePropertySignature(node, name, questionToken, type, initializer) { + return node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createPropertySignature(name, questionToken, type, initializer), node) + : node; + } + ts.updatePropertySignature = updatePropertySignature; + function createIndexSignatureDeclaration(decorators, modifiers, parameters, type) { + var indexSignature = createSynthesizedNode(156); + indexSignature.decorators = asNodeArray(decorators); + indexSignature.modifiers = asNodeArray(modifiers); + indexSignature.parameters = createNodeArray(parameters); + indexSignature.type = type; + return indexSignature; + } + ts.createIndexSignatureDeclaration = createIndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node, decorators, modifiers, parameters, type) { + return node.parameters !== parameters + || node.type !== type + || node.decorators !== decorators + || node.modifiers !== modifiers + ? updateNode(createIndexSignatureDeclaration(decorators, modifiers, parameters, type), node) + : node; + } + ts.updateIndexSignatureDeclaration = updateIndexSignatureDeclaration; + function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + var node = createSynthesizedNode(145); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.name = asName(name); node.questionToken = questionToken; node.type = type; - node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); - } - return node; + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer), node) + : node; } ts.updateParameter = updateParameter; - function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createDecorator(expression) { + var node = createSynthesizedNode(146); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createDecorator = createDecorator; + function updateDecorator(node, expression) { + return node.expression !== expression + ? updateNode(createDecorator(expression), node) + : node; + } + ts.updateDecorator = updateDecorator; + function createProperty(decorators, modifiers, name, questionToken, type, initializer) { + var node = createSynthesizedNode(148); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.questionToken = questionToken; node.type = type; node.initializer = initializer; @@ -10773,36 +10934,46 @@ var ts; } ts.createProperty = createProperty; function updateProperty(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer), node) + : node; } ts.updateProperty = updateProperty; - function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(150); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.questionToken = questionToken; + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } - ts.createMethod = createMethod; - function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + ts.createMethodDeclaration = createMethodDeclaration; + function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) + : node; } ts.updateMethod = updateMethod; - function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createConstructor(decorators, modifiers, parameters, body) { + var node = createSynthesizedNode(151); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = undefined; @@ -10811,17 +10982,19 @@ var ts; } ts.createConstructor = createConstructor; function updateConstructor(node, decorators, modifiers, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) { - return updateNode(createConstructor(decorators, modifiers, parameters, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.parameters !== parameters + || node.body !== body + ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) + : node; } ts.updateConstructor = updateConstructor; - function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createGetAccessor(decorators, modifiers, name, parameters, type, body) { + var node = createSynthesizedNode(152); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = type; @@ -10830,17 +11003,21 @@ var ts; } ts.createGetAccessor = createGetAccessor; function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) + : node; } ts.updateGetAccessor = updateGetAccessor; - function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createSetAccessor(decorators, modifiers, name, parameters, body) { + var node = createSynthesizedNode(153); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.body = body; @@ -10848,57 +11025,60 @@ var ts; } ts.createSetAccessor = createSetAccessor; function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) { - return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.body !== body + ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) + : node; } ts.updateSetAccessor = updateSetAccessor; - function createObjectBindingPattern(elements, location) { - var node = createNode(172, location); + function createObjectBindingPattern(elements) { + var node = createSynthesizedNode(173); node.elements = createNodeArray(elements); return node; } ts.createObjectBindingPattern = createObjectBindingPattern; function updateObjectBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createObjectBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createObjectBindingPattern(elements), node) + : node; } ts.updateObjectBindingPattern = updateObjectBindingPattern; - function createArrayBindingPattern(elements, location) { - var node = createNode(173, location); + function createArrayBindingPattern(elements) { + var node = createSynthesizedNode(174); node.elements = createNodeArray(elements); return node; } ts.createArrayBindingPattern = createArrayBindingPattern; function updateArrayBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayBindingPattern(elements), node) + : node; } ts.updateArrayBindingPattern = updateArrayBindingPattern; - function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174, location); - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createBindingElement(dotDotDotToken, propertyName, name, initializer) { + var node = createSynthesizedNode(175); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.propertyName = asName(propertyName); + node.name = asName(name); node.initializer = initializer; return node; } ts.createBindingElement = createBindingElement; function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); - } - return node; + return node.propertyName !== propertyName + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.initializer !== initializer + ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) + : node; } ts.updateBindingElement = updateBindingElement; - function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175, location); - node.elements = parenthesizeListElements(createNodeArray(elements)); + function createArrayLiteral(elements, multiLine) { + var node = createSynthesizedNode(176); + node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; } @@ -10906,14 +11086,13 @@ var ts; } ts.createArrayLiteral = createArrayLiteral; function updateArrayLiteral(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayLiteral(elements, node, node.multiLine), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayLiteral(elements, node.multiLine), node) + : node; } ts.updateArrayLiteral = updateArrayLiteral; - function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176, location); + function createObjectLiteral(properties, multiLine) { + var node = createSynthesizedNode(177); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -10922,431 +11101,461 @@ var ts; } ts.createObjectLiteral = createObjectLiteral; function updateObjectLiteral(node, properties) { - if (node.properties !== properties) { - return updateNode(createObjectLiteral(properties, node, node.multiLine), node); - } - return node; + return node.properties !== properties + ? updateNode(createObjectLiteral(properties, node.multiLine), node) + : node; } ts.updateObjectLiteral = updateObjectLiteral; - function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177, location, flags); - node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 65536; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAccess(expression, name) { + var node = createSynthesizedNode(178); + node.expression = ts.parenthesizeForAccess(expression); + node.name = asName(name); + setEmitFlags(node, 65536); return node; } ts.createPropertyAccess = createPropertyAccess; function updatePropertyAccess(node, expression, name) { - if (node.expression !== expression || node.name !== name) { - var propertyAccess = createPropertyAccess(expression, name, node, node.flags); - (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node); - return updateNode(propertyAccess, node); - } - return node; + return node.expression !== expression + || node.name !== name + ? updateNode(setEmitFlags(createPropertyAccess(expression, name), getEmitFlags(node)), node) + : node; } ts.updatePropertyAccess = updatePropertyAccess; - function createElementAccess(expression, index, location) { - var node = createNode(178, location); - node.expression = parenthesizeForAccess(expression); - node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; + function createElementAccess(expression, index) { + var node = createSynthesizedNode(179); + node.expression = ts.parenthesizeForAccess(expression); + node.argumentExpression = asExpression(index); return node; } ts.createElementAccess = createElementAccess; function updateElementAccess(node, expression, argumentExpression) { - if (node.expression !== expression || node.argumentExpression !== argumentExpression) { - return updateNode(createElementAccess(expression, argumentExpression, node), node); - } - return node; + return node.expression !== expression + || node.argumentExpression !== argumentExpression + ? updateNode(createElementAccess(expression, argumentExpression), node) + : node; } ts.updateElementAccess = updateElementAccess; - function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179, location, flags); - node.expression = parenthesizeForAccess(expression); - if (typeArguments) { - node.typeArguments = createNodeArray(typeArguments); - } - node.arguments = parenthesizeListElements(createNodeArray(argumentsArray)); + function createCall(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(180); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); return node; } ts.createCall = createCall; function updateCall(node, expression, typeArguments, argumentsArray) { - if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) { - return updateNode(createCall(expression, typeArguments, argumentsArray, node, node.flags), node); - } - return node; + return expression !== node.expression + || typeArguments !== node.typeArguments + || argumentsArray !== node.arguments + ? updateNode(createCall(expression, typeArguments, argumentsArray), node) + : node; } ts.updateCall = updateCall; - function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180, location, flags); - node.expression = parenthesizeForNew(expression); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; + function createNew(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(181); + node.expression = ts.parenthesizeForNew(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; return node; } ts.createNew = createNew; function updateNew(node, expression, typeArguments, argumentsArray) { - if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) { - return updateNode(createNew(expression, typeArguments, argumentsArray, node, node.flags), node); - } - return node; + return node.expression !== expression + || node.typeArguments !== typeArguments + || node.arguments !== argumentsArray + ? updateNode(createNew(expression, typeArguments, argumentsArray), node) + : node; } ts.updateNew = updateNew; - function createTaggedTemplate(tag, template, location) { - var node = createNode(181, location); - node.tag = parenthesizeForAccess(tag); + function createTaggedTemplate(tag, template) { + var node = createSynthesizedNode(182); + node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; } ts.createTaggedTemplate = createTaggedTemplate; function updateTaggedTemplate(node, tag, template) { - if (node.tag !== tag || node.template !== template) { - return updateNode(createTaggedTemplate(tag, template, node), node); - } - return node; + return node.tag !== tag + || node.template !== template + ? updateNode(createTaggedTemplate(tag, template), node) + : node; } ts.updateTaggedTemplate = updateTaggedTemplate; - function createParen(expression, location) { - var node = createNode(183, location); + function createTypeAssertion(type, expression) { + var node = createSynthesizedNode(183); + node.type = type; + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeAssertion = createTypeAssertion; + function updateTypeAssertion(node, type, expression) { + return node.type !== type + || node.expression !== expression + ? updateNode(createTypeAssertion(type, expression), node) + : node; + } + ts.updateTypeAssertion = updateTypeAssertion; + function createParen(expression) { + var node = createSynthesizedNode(184); node.expression = expression; return node; } ts.createParen = createParen; function updateParen(node, expression) { - if (node.expression !== expression) { - return updateNode(createParen(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createParen(expression), node) + : node; } ts.updateParen = updateParen; - function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(185); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionExpression = createFunctionExpression; - function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) { - if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.name !== name + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionExpression = updateFunctionExpression; - function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + var node = createSynthesizedNode(186); + node.modifiers = asNodeArray(modifiers); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35); - node.body = parenthesizeConciseBody(body); + node.body = ts.parenthesizeConciseBody(body); return node; } ts.createArrowFunction = createArrowFunction; function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) { - if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body), node) + : node; } ts.updateArrowFunction = updateArrowFunction; - function createDelete(expression, location) { - var node = createNode(186, location); - node.expression = parenthesizePrefixOperand(expression); + function createDelete(expression) { + var node = createSynthesizedNode(187); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createDelete = createDelete; function updateDelete(node, expression) { - if (node.expression !== expression) { - return updateNode(createDelete(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createDelete(expression), node) + : node; } ts.updateDelete = updateDelete; - function createTypeOf(expression, location) { - var node = createNode(187, location); - node.expression = parenthesizePrefixOperand(expression); + function createTypeOf(expression) { + var node = createSynthesizedNode(188); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createTypeOf = createTypeOf; function updateTypeOf(node, expression) { - if (node.expression !== expression) { - return updateNode(createTypeOf(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createTypeOf(expression), node) + : node; } ts.updateTypeOf = updateTypeOf; - function createVoid(expression, location) { - var node = createNode(188, location); - node.expression = parenthesizePrefixOperand(expression); + function createVoid(expression) { + var node = createSynthesizedNode(189); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createVoid = createVoid; function updateVoid(node, expression) { - if (node.expression !== expression) { - return updateNode(createVoid(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createVoid(expression), node) + : node; } ts.updateVoid = updateVoid; - function createAwait(expression, location) { - var node = createNode(189, location); - node.expression = parenthesizePrefixOperand(expression); + function createAwait(expression) { + var node = createSynthesizedNode(190); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createAwait = createAwait; function updateAwait(node, expression) { - if (node.expression !== expression) { - return updateNode(createAwait(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createAwait(expression), node) + : node; } ts.updateAwait = updateAwait; - function createPrefix(operator, operand, location) { - var node = createNode(190, location); + function createPrefix(operator, operand) { + var node = createSynthesizedNode(191); node.operator = operator; - node.operand = parenthesizePrefixOperand(operand); + node.operand = ts.parenthesizePrefixOperand(operand); return node; } ts.createPrefix = createPrefix; function updatePrefix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPrefix(node.operator, operand, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPrefix(node.operator, operand), node) + : node; } ts.updatePrefix = updatePrefix; - function createPostfix(operand, operator, location) { - var node = createNode(191, location); - node.operand = parenthesizePostfixOperand(operand); + function createPostfix(operand, operator) { + var node = createSynthesizedNode(192); + node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; } ts.createPostfix = createPostfix; function updatePostfix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPostfix(operand, node.operator, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPostfix(operand, node.operator), node) + : node; } ts.updatePostfix = updatePostfix; - function createBinary(left, operator, right, location) { - var operatorToken = typeof operator === "number" ? createToken(operator) : operator; + function createBinary(left, operator, right) { + var node = createSynthesizedNode(193); + var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; - var node = createNode(192, location); - node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined); + node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined); node.operatorToken = operatorToken; - node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left); + node.right = ts.parenthesizeBinaryOperand(operatorKind, right, false, node.left); return node; } ts.createBinary = createBinary; function updateBinary(node, left, right) { - if (node.left !== left || node.right !== right) { - return updateNode(createBinary(left, node.operatorToken, right, node), node); - } - return node; + return node.left !== left + || node.right !== right + ? updateNode(createBinary(left, node.operatorToken, right), node) + : node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193, whenFalse ? location : colonTokenOrLocation); - node.condition = parenthesizeForConditionalHead(condition); - if (whenFalse) { - node.questionToken = questionTokenOrWhenTrue; - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - node.colonToken = colonTokenOrLocation; - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); - } - else { - node.questionToken = createToken(54); - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); - node.colonToken = createToken(55); - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - } + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { + var node = createSynthesizedNode(194); + node.condition = ts.parenthesizeForConditionalHead(condition); + node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(54); + node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); + node.colonToken = whenFalse ? colonToken : createToken(55); + node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse); return node; } ts.createConditional = createConditional; function updateConditional(node, condition, whenTrue, whenFalse) { - if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) { - return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node); - } - return node; + return node.condition !== condition + || node.whenTrue !== whenTrue + || node.whenFalse !== whenFalse + ? updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse), node) + : node; } ts.updateConditional = updateConditional; - function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194, location); + function createTemplateExpression(head, templateSpans) { + var node = createSynthesizedNode(195); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; } ts.createTemplateExpression = createTemplateExpression; function updateTemplateExpression(node, head, templateSpans) { - if (node.head !== head || node.templateSpans !== templateSpans) { - return updateNode(createTemplateExpression(head, templateSpans, node), node); - } - return node; + return node.head !== head + || node.templateSpans !== templateSpans + ? updateNode(createTemplateExpression(head, templateSpans), node) + : node; } ts.updateTemplateExpression = updateTemplateExpression; - function createYield(asteriskToken, expression, location) { - var node = createNode(195, location); - node.asteriskToken = asteriskToken; - node.expression = expression; + function createYield(asteriskTokenOrExpression, expression) { + var node = createSynthesizedNode(196); + node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 38 ? asteriskTokenOrExpression : undefined; + node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 38 ? asteriskTokenOrExpression : expression; return node; } ts.createYield = createYield; - function updateYield(node, expression) { - if (node.expression !== expression) { - return updateNode(createYield(node.asteriskToken, expression, node), node); - } - return node; + function updateYield(node, asteriskToken, expression) { + return node.expression !== expression + || node.asteriskToken !== asteriskToken + ? updateNode(createYield(asteriskToken, expression), node) + : node; } ts.updateYield = updateYield; - function createSpread(expression, location) { - var node = createNode(196, location); - node.expression = parenthesizeExpressionForList(expression); + function createSpread(expression) { + var node = createSynthesizedNode(197); + node.expression = ts.parenthesizeExpressionForList(expression); return node; } ts.createSpread = createSpread; function updateSpread(node, expression) { - if (node.expression !== expression) { - return updateNode(createSpread(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createSpread(expression), node) + : node; } ts.updateSpread = updateSpread; - function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197, location); + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(198); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassExpression = createClassExpression; function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { - if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassExpression = updateClassExpression; - function createOmittedExpression(location) { - var node = createNode(198, location); - return node; + function createOmittedExpression() { + return createSynthesizedNode(199); } ts.createOmittedExpression = createOmittedExpression; - function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199, location); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.expression = parenthesizeForAccess(expression); + function createExpressionWithTypeArguments(typeArguments, expression) { + var node = createSynthesizedNode(200); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); return node; } ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; function updateExpressionWithTypeArguments(node, typeArguments, expression) { - if (node.typeArguments !== typeArguments || node.expression !== expression) { - return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node); - } - return node; + return node.typeArguments !== typeArguments + || node.expression !== expression + ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) + : node; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; - function createTemplateSpan(expression, literal, location) { - var node = createNode(202, location); + function createAsExpression(expression, type) { + var node = createSynthesizedNode(201); + node.expression = expression; + node.type = type; + return node; + } + ts.createAsExpression = createAsExpression; + function updateAsExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? updateNode(createAsExpression(expression, type), node) + : node; + } + ts.updateAsExpression = updateAsExpression; + function createNonNullExpression(expression) { + var node = createSynthesizedNode(202); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createNonNullExpression = createNonNullExpression; + function updateNonNullExpression(node, expression) { + return node.expression !== expression + ? updateNode(createNonNullExpression(expression), node) + : node; + } + ts.updateNonNullExpression = updateNonNullExpression; + function createTemplateSpan(expression, literal) { + var node = createSynthesizedNode(204); node.expression = expression; node.literal = literal; return node; } ts.createTemplateSpan = createTemplateSpan; function updateTemplateSpan(node, expression, literal) { - if (node.expression !== expression || node.literal !== literal) { - return updateNode(createTemplateSpan(expression, literal, node), node); - } - return node; + return node.expression !== expression + || node.literal !== literal + ? updateNode(createTemplateSpan(expression, literal), node) + : node; } ts.updateTemplateSpan = updateTemplateSpan; - function createBlock(statements, location, multiLine, flags) { - var block = createNode(204, location, flags); + function createBlock(statements, multiLine) { + var block = createSynthesizedNode(206); block.statements = createNodeArray(statements); - if (multiLine) { - block.multiLine = true; - } + if (multiLine) + block.multiLine = multiLine; return block; } ts.createBlock = createBlock; function updateBlock(node, statements) { - if (statements !== node.statements) { - return updateNode(createBlock(statements, node, node.multiLine, node.flags), node); - } - return node; + return statements !== node.statements + ? updateNode(createBlock(statements, node.multiLine), node) + : node; } ts.updateBlock = updateBlock; - function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205, location, flags); + function createVariableStatement(modifiers, declarationList) { + var node = createSynthesizedNode(207); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; return node; } ts.createVariableStatement = createVariableStatement; function updateVariableStatement(node, modifiers, declarationList) { - if (node.modifiers !== modifiers || node.declarationList !== declarationList) { - return updateNode(createVariableStatement(modifiers, declarationList, node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.declarationList !== declarationList + ? updateNode(createVariableStatement(modifiers, declarationList), node) + : node; } ts.updateVariableStatement = updateVariableStatement; - function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224, location, flags); + function createVariableDeclarationList(declarations, flags) { + var node = createSynthesizedNode(226); + node.flags |= flags; node.declarations = createNodeArray(declarations); return node; } ts.createVariableDeclarationList = createVariableDeclarationList; function updateVariableDeclarationList(node, declarations) { - if (node.declarations !== declarations) { - return updateNode(createVariableDeclarationList(declarations, node, node.flags), node); - } - return node; + return node.declarations !== declarations + ? updateNode(createVariableDeclarationList(declarations, node.flags), node) + : node; } ts.updateVariableDeclarationList = updateVariableDeclarationList; - function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223, location, flags); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createVariableDeclaration(name, type, initializer) { + var node = createSynthesizedNode(225); + node.name = asName(name); node.type = type; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createVariableDeclaration = createVariableDeclaration; function updateVariableDeclaration(node, name, type, initializer) { - if (node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createVariableDeclaration(name, type, initializer, node, node.flags), node); - } - return node; + return node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createVariableDeclaration(name, type, initializer), node) + : node; } ts.updateVariableDeclaration = updateVariableDeclaration; - function createEmptyStatement(location) { - return createNode(206, location); + function createEmptyStatement() { + return createSynthesizedNode(208); } ts.createEmptyStatement = createEmptyStatement; - function createStatement(expression, location, flags) { - var node = createNode(207, location, flags); - node.expression = parenthesizeExpressionForExpressionStatement(expression); + function createStatement(expression) { + var node = createSynthesizedNode(209); + node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } ts.createStatement = createStatement; function updateStatement(node, expression) { - if (node.expression !== expression) { - return updateNode(createStatement(expression, node, node.flags), node); - } - return node; + return node.expression !== expression + ? updateNode(createStatement(expression), node) + : node; } ts.updateStatement = updateStatement; - function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208, location); + function createIf(expression, thenStatement, elseStatement) { + var node = createSynthesizedNode(210); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11354,42 +11563,43 @@ var ts; } ts.createIf = createIf; function updateIf(node, expression, thenStatement, elseStatement) { - if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) { - return updateNode(createIf(expression, thenStatement, elseStatement, node), node); - } - return node; + return node.expression !== expression + || node.thenStatement !== thenStatement + || node.elseStatement !== elseStatement + ? updateNode(createIf(expression, thenStatement, elseStatement), node) + : node; } ts.updateIf = updateIf; - function createDo(statement, expression, location) { - var node = createNode(209, location); + function createDo(statement, expression) { + var node = createSynthesizedNode(211); node.statement = statement; node.expression = expression; return node; } ts.createDo = createDo; function updateDo(node, statement, expression) { - if (node.statement !== statement || node.expression !== expression) { - return updateNode(createDo(statement, expression, node), node); - } - return node; + return node.statement !== statement + || node.expression !== expression + ? updateNode(createDo(statement, expression), node) + : node; } ts.updateDo = updateDo; - function createWhile(expression, statement, location) { - var node = createNode(210, location); + function createWhile(expression, statement) { + var node = createSynthesizedNode(212); node.expression = expression; node.statement = statement; return node; } ts.createWhile = createWhile; function updateWhile(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWhile(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWhile(expression, statement), node) + : node; } ts.updateWhile = updateWhile; - function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211, location, undefined); + function createFor(initializer, condition, incrementor, statement) { + var node = createSynthesizedNode(213); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11398,14 +11608,16 @@ var ts; } ts.createFor = createFor; function updateFor(node, initializer, condition, incrementor, statement) { - if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) { - return updateNode(createFor(initializer, condition, incrementor, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.condition !== condition + || node.incrementor !== incrementor + || node.statement !== statement + ? updateNode(createFor(initializer, condition, incrementor, statement), node) + : node; } ts.updateFor = updateFor; - function createForIn(initializer, expression, statement, location) { - var node = createNode(212, location); + function createForIn(initializer, expression, statement) { + var node = createSynthesizedNode(214); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11413,127 +11625,123 @@ var ts; } ts.createForIn = createForIn; function updateForIn(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForIn(initializer, expression, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForIn(initializer, expression, statement), node) + : node; } ts.updateForIn = updateForIn; - function createForOf(initializer, expression, statement, location) { - var node = createNode(213, location); + function createForOf(awaitModifier, initializer, expression, statement) { + var node = createSynthesizedNode(215); + node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; node.statement = statement; return node; } ts.createForOf = createForOf; - function updateForOf(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForOf(initializer, expression, statement, node), node); - } - return node; + function updateForOf(node, awaitModifier, initializer, expression, statement) { + return node.awaitModifier !== awaitModifier + || node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) + : node; } ts.updateForOf = updateForOf; - function createContinue(label, location) { - var node = createNode(214, location); - if (label) { - node.label = label; - } + function createContinue(label) { + var node = createSynthesizedNode(216); + node.label = asName(label); return node; } ts.createContinue = createContinue; function updateContinue(node, label) { - if (node.label !== label) { - return updateNode(createContinue(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createContinue(label), node) + : node; } ts.updateContinue = updateContinue; - function createBreak(label, location) { - var node = createNode(215, location); - if (label) { - node.label = label; - } + function createBreak(label) { + var node = createSynthesizedNode(217); + node.label = asName(label); return node; } ts.createBreak = createBreak; function updateBreak(node, label) { - if (node.label !== label) { - return updateNode(createBreak(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createBreak(label), node) + : node; } ts.updateBreak = updateBreak; - function createReturn(expression, location) { - var node = createNode(216, location); + function createReturn(expression) { + var node = createSynthesizedNode(218); node.expression = expression; return node; } ts.createReturn = createReturn; function updateReturn(node, expression) { - if (node.expression !== expression) { - return updateNode(createReturn(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createReturn(expression), node) + : node; } ts.updateReturn = updateReturn; - function createWith(expression, statement, location) { - var node = createNode(217, location); + function createWith(expression, statement) { + var node = createSynthesizedNode(219); node.expression = expression; node.statement = statement; return node; } ts.createWith = createWith; function updateWith(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWith(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWith(expression, statement), node) + : node; } ts.updateWith = updateWith; - function createSwitch(expression, caseBlock, location) { - var node = createNode(218, location); - node.expression = parenthesizeExpressionForList(expression); + function createSwitch(expression, caseBlock) { + var node = createSynthesizedNode(220); + node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; } ts.createSwitch = createSwitch; function updateSwitch(node, expression, caseBlock) { - if (node.expression !== expression || node.caseBlock !== caseBlock) { - return updateNode(createSwitch(expression, caseBlock, node), node); - } - return node; + return node.expression !== expression + || node.caseBlock !== caseBlock + ? updateNode(createSwitch(expression, caseBlock), node) + : node; } ts.updateSwitch = updateSwitch; - function createLabel(label, statement, location) { - var node = createNode(219, location); - node.label = typeof label === "string" ? createIdentifier(label) : label; + function createLabel(label, statement) { + var node = createSynthesizedNode(221); + node.label = asName(label); node.statement = statement; return node; } ts.createLabel = createLabel; function updateLabel(node, label, statement) { - if (node.label !== label || node.statement !== statement) { - return updateNode(createLabel(label, statement, node), node); - } - return node; + return node.label !== label + || node.statement !== statement + ? updateNode(createLabel(label, statement), node) + : node; } ts.updateLabel = updateLabel; - function createThrow(expression, location) { - var node = createNode(220, location); + function createThrow(expression) { + var node = createSynthesizedNode(222); node.expression = expression; return node; } ts.createThrow = createThrow; function updateThrow(node, expression) { - if (node.expression !== expression) { - return updateNode(createThrow(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createThrow(expression), node) + : node; } ts.updateThrow = updateThrow; - function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221, location); + function createTry(tryBlock, catchClause, finallyBlock) { + var node = createSynthesizedNode(223); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11541,194 +11749,284 @@ var ts; } ts.createTry = createTry; function updateTry(node, tryBlock, catchClause, finallyBlock) { - if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) { - return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node); - } - return node; + return node.tryBlock !== tryBlock + || node.catchClause !== catchClause + || node.finallyBlock !== finallyBlock + ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) + : node; } ts.updateTry = updateTry; - function createCaseBlock(clauses, location) { - var node = createNode(232, location); - node.clauses = createNodeArray(clauses); - return node; - } - ts.createCaseBlock = createCaseBlock; - function updateCaseBlock(node, clauses) { - if (node.clauses !== clauses) { - return updateNode(createCaseBlock(clauses, node), node); - } - return node; - } - ts.updateCaseBlock = updateCaseBlock; - function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(227); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionDeclaration = createFunctionDeclaration; - function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionDeclaration = updateFunctionDeclaration; - function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(228); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassDeclaration = createClassDeclaration; function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassDeclaration = updateClassDeclaration; - function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createEnumDeclaration(decorators, modifiers, name, members) { + var node = createSynthesizedNode(231); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.members = createNodeArray(members); + return node; + } + ts.createEnumDeclaration = createEnumDeclaration; + function updateEnumDeclaration(node, decorators, modifiers, name, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.members !== members + ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) + : node; + } + ts.updateEnumDeclaration = updateEnumDeclaration; + function createModuleDeclaration(decorators, modifiers, name, body, flags) { + var node = createSynthesizedNode(232); + node.flags |= flags; + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = name; + node.body = body; + return node; + } + ts.createModuleDeclaration = createModuleDeclaration; + function updateModuleDeclaration(node, decorators, modifiers, name, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.body !== body + ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) + : node; + } + ts.updateModuleDeclaration = updateModuleDeclaration; + function createModuleBlock(statements) { + var node = createSynthesizedNode(233); + node.statements = createNodeArray(statements); + return node; + } + ts.createModuleBlock = createModuleBlock; + function updateModuleBlock(node, statements) { + return node.statements !== statements + ? updateNode(createModuleBlock(statements), node) + : node; + } + ts.updateModuleBlock = updateModuleBlock; + function createCaseBlock(clauses) { + var node = createSynthesizedNode(234); + node.clauses = createNodeArray(clauses); + return node; + } + ts.createCaseBlock = createCaseBlock; + function updateCaseBlock(node, clauses) { + return node.clauses !== clauses + ? updateNode(createCaseBlock(clauses), node) + : node; + } + ts.updateCaseBlock = updateCaseBlock; + function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { + var node = createSynthesizedNode(236); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.moduleReference = moduleReference; + return node; + } + ts.createImportEqualsDeclaration = createImportEqualsDeclaration; + function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.moduleReference !== moduleReference + ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) + : node; + } + ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; + function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { + var node = createSynthesizedNode(237); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createImportDeclaration = createImportDeclaration; function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) + : node; } ts.updateImportDeclaration = updateImportDeclaration; - function createImportClause(name, namedBindings, location) { - var node = createNode(236, location); + function createImportClause(name, namedBindings) { + var node = createSynthesizedNode(238); node.name = name; node.namedBindings = namedBindings; return node; } ts.createImportClause = createImportClause; function updateImportClause(node, name, namedBindings) { - if (node.name !== name || node.namedBindings !== namedBindings) { - return updateNode(createImportClause(name, namedBindings, node), node); - } - return node; + return node.name !== name + || node.namedBindings !== namedBindings + ? updateNode(createImportClause(name, namedBindings), node) + : node; } ts.updateImportClause = updateImportClause; - function createNamespaceImport(name, location) { - var node = createNode(237, location); + function createNamespaceImport(name) { + var node = createSynthesizedNode(239); node.name = name; return node; } ts.createNamespaceImport = createNamespaceImport; function updateNamespaceImport(node, name) { - if (node.name !== name) { - return updateNode(createNamespaceImport(name, node), node); - } - return node; + return node.name !== name + ? updateNode(createNamespaceImport(name), node) + : node; } ts.updateNamespaceImport = updateNamespaceImport; - function createNamedImports(elements, location) { - var node = createNode(238, location); + function createNamedImports(elements) { + var node = createSynthesizedNode(240); node.elements = createNodeArray(elements); return node; } ts.createNamedImports = createNamedImports; function updateNamedImports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedImports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedImports(elements), node) + : node; } ts.updateNamedImports = updateNamedImports; - function createImportSpecifier(propertyName, name, location) { - var node = createNode(239, location); + function createImportSpecifier(propertyName, name) { + var node = createSynthesizedNode(241); node.propertyName = propertyName; node.name = name; return node; } ts.createImportSpecifier = createImportSpecifier; function updateImportSpecifier(node, propertyName, name) { - if (node.propertyName !== propertyName || node.name !== name) { - return updateNode(createImportSpecifier(propertyName, name, node), node); - } - return node; + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createImportSpecifier(propertyName, name), node) + : node; } ts.updateImportSpecifier = updateImportSpecifier; - function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportAssignment(decorators, modifiers, isExportEquals, expression) { + var node = createSynthesizedNode(242); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = expression; return node; } ts.createExportAssignment = createExportAssignment; function updateExportAssignment(node, decorators, modifiers, expression) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) { - return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.expression !== expression + ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) + : node; } ts.updateExportAssignment = updateExportAssignment; - function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { + var node = createSynthesizedNode(243); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createExportDeclaration = createExportDeclaration; function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.exportClause !== exportClause + || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) + : node; } ts.updateExportDeclaration = updateExportDeclaration; - function createNamedExports(elements, location) { - var node = createNode(242, location); + function createNamedExports(elements) { + var node = createSynthesizedNode(244); node.elements = createNodeArray(elements); return node; } ts.createNamedExports = createNamedExports; function updateNamedExports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedExports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedExports(elements), node) + : node; } ts.updateNamedExports = updateNamedExports; - function createExportSpecifier(name, propertyName, location) { - var node = createNode(243, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createExportSpecifier(propertyName, name) { + var node = createSynthesizedNode(245); + node.propertyName = asName(propertyName); + node.name = asName(name); return node; } ts.createExportSpecifier = createExportSpecifier; - function updateExportSpecifier(node, name, propertyName) { - if (node.name !== name || node.propertyName !== propertyName) { - return updateNode(createExportSpecifier(name, propertyName, node), node); - } - return node; + function updateExportSpecifier(node, propertyName, name) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createExportSpecifier(propertyName, name), node) + : node; } ts.updateExportSpecifier = updateExportSpecifier; - function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246, location); + function createExternalModuleReference(expression) { + var node = createSynthesizedNode(247); + node.expression = expression; + return node; + } + ts.createExternalModuleReference = createExternalModuleReference; + function updateExternalModuleReference(node, expression) { + return node.expression !== expression + ? updateNode(createExternalModuleReference(expression), node) + : node; + } + ts.updateExternalModuleReference = updateExternalModuleReference; + function createJsxElement(openingElement, children, closingElement) { + var node = createSynthesizedNode(248); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11736,95 +12034,107 @@ var ts; } ts.createJsxElement = createJsxElement; function updateJsxElement(node, openingElement, children, closingElement) { - if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) { - return updateNode(createJsxElement(openingElement, children, closingElement, node), node); - } - return node; + return node.openingElement !== openingElement + || node.children !== children + || node.closingElement !== closingElement + ? updateNode(createJsxElement(openingElement, children, closingElement), node) + : node; } ts.updateJsxElement = updateJsxElement; - function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247, location); + function createJsxSelfClosingElement(tagName, attributes) { + var node = createSynthesizedNode(249); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxSelfClosingElement = createJsxSelfClosingElement; function updateJsxSelfClosingElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxSelfClosingElement(tagName, attributes), node) + : node; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; - function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248, location); + function createJsxOpeningElement(tagName, attributes) { + var node = createSynthesizedNode(250); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxOpeningElement = createJsxOpeningElement; function updateJsxOpeningElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxOpeningElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxOpeningElement(tagName, attributes), node) + : node; } ts.updateJsxOpeningElement = updateJsxOpeningElement; - function createJsxClosingElement(tagName, location) { - var node = createNode(249, location); + function createJsxClosingElement(tagName) { + var node = createSynthesizedNode(251); node.tagName = tagName; return node; } ts.createJsxClosingElement = createJsxClosingElement; function updateJsxClosingElement(node, tagName) { - if (node.tagName !== tagName) { - return updateNode(createJsxClosingElement(tagName, node), node); - } - return node; + return node.tagName !== tagName + ? updateNode(createJsxClosingElement(tagName), node) + : node; } ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer, location) { - var node = createNode(250, location); + function createJsxAttributes(properties) { + var jsxAttributes = createSynthesizedNode(253); + jsxAttributes.properties = createNodeArray(properties); + return jsxAttributes; + } + ts.createJsxAttributes = createJsxAttributes; + function updateJsxAttributes(jsxAttributes, properties) { + if (jsxAttributes.properties !== properties) { + return updateNode(createJsxAttributes(properties), jsxAttributes); + } + return jsxAttributes; + } + ts.updateJsxAttributes = updateJsxAttributes; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(252); node.name = name; node.initializer = initializer; return node; } ts.createJsxAttribute = createJsxAttribute; function updateJsxAttribute(node, name, initializer) { - if (node.name !== name || node.initializer !== initializer) { - return updateNode(createJsxAttribute(name, initializer, node), node); - } - return node; + return node.name !== name + || node.initializer !== initializer + ? updateNode(createJsxAttribute(name, initializer), node) + : node; } ts.updateJsxAttribute = updateJsxAttribute; - function createJsxSpreadAttribute(expression, location) { - var node = createNode(251, location); + function createJsxSpreadAttribute(expression) { + var node = createSynthesizedNode(254); node.expression = expression; return node; } ts.createJsxSpreadAttribute = createJsxSpreadAttribute; function updateJsxSpreadAttribute(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxSpreadAttribute(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxSpreadAttribute(expression), node) + : node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252, location); + function createJsxExpression(dotDotDotToken, expression) { + var node = createSynthesizedNode(255); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) + : node; } ts.updateJsxExpression = updateJsxExpression; - function createHeritageClause(token, types, location) { - var node = createNode(255, location); + function createHeritageClause(token, types) { + var node = createSynthesizedNode(258); node.token = token; node.types = createNodeArray(types); return node; @@ -11832,40 +12142,40 @@ var ts; ts.createHeritageClause = createHeritageClause; function updateHeritageClause(node, types) { if (node.types !== types) { - return updateNode(createHeritageClause(node.token, types, node), node); + return updateNode(createHeritageClause(node.token, types), node); } return node; } ts.updateHeritageClause = updateHeritageClause; - function createCaseClause(expression, statements, location) { - var node = createNode(253, location); - node.expression = parenthesizeExpressionForList(expression); + function createCaseClause(expression, statements) { + var node = createSynthesizedNode(256); + node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; } ts.createCaseClause = createCaseClause; function updateCaseClause(node, expression, statements) { if (node.expression !== expression || node.statements !== statements) { - return updateNode(createCaseClause(expression, statements, node), node); + return updateNode(createCaseClause(expression, statements), node); } return node; } ts.updateCaseClause = updateCaseClause; - function createDefaultClause(statements, location) { - var node = createNode(254, location); + function createDefaultClause(statements) { + var node = createSynthesizedNode(257); node.statements = createNodeArray(statements); return node; } ts.createDefaultClause = createDefaultClause; function updateDefaultClause(node, statements) { if (node.statements !== statements) { - return updateNode(createDefaultClause(statements, node), node); + return updateNode(createDefaultClause(statements), node); } return node; } ts.updateDefaultClause = updateDefaultClause; - function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256, location); + function createCatchClause(variableDeclaration, block) { + var node = createSynthesizedNode(259); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11873,56 +12183,71 @@ var ts; ts.createCatchClause = createCatchClause; function updateCatchClause(node, variableDeclaration, block) { if (node.variableDeclaration !== variableDeclaration || node.block !== block) { - return updateNode(createCatchClause(variableDeclaration, block, node), node); + return updateNode(createCatchClause(variableDeclaration, block), node); } return node; } ts.updateCatchClause = updateCatchClause; - function createPropertyAssignment(name, initializer, location) { - var node = createNode(257, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAssignment(name, initializer) { + var node = createSynthesizedNode(260); + node.name = asName(name); node.questionToken = undefined; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createPropertyAssignment = createPropertyAssignment; function updatePropertyAssignment(node, name, initializer) { if (node.name !== name || node.initializer !== initializer) { - return updateNode(createPropertyAssignment(name, initializer, node), node); + return updateNode(createPropertyAssignment(name, initializer), node); } return node; } ts.updatePropertyAssignment = updatePropertyAssignment; - function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; + function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { + var node = createSynthesizedNode(261); + node.name = asName(name); + node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; - function createSpreadAssignment(expression, location) { - var node = createNode(259, location); - node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; - return node; - } - ts.createSpreadAssignment = createSpreadAssignment; function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) { - return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node); + return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node); } return node; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; + function createSpreadAssignment(expression) { + var node = createSynthesizedNode(262); + node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; + return node; + } + ts.createSpreadAssignment = createSpreadAssignment; function updateSpreadAssignment(node, expression) { if (node.expression !== expression) { - return updateNode(createSpreadAssignment(expression, node), node); + return updateNode(createSpreadAssignment(expression), node); } return node; } ts.updateSpreadAssignment = updateSpreadAssignment; + function createEnumMember(name, initializer) { + var node = createSynthesizedNode(263); + node.name = asName(name); + node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); + return node; + } + ts.createEnumMember = createEnumMember; + function updateEnumMember(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createEnumMember(name, initializer), node) + : node; + } + ts.updateEnumMember = updateEnumMember; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261, node, node.flags); + var updated = createSynthesizedNode(264); + updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -11981,56 +12306,73 @@ var ts; return node; } ts.updateSourceFileNode = updateSourceFileNode; + function getMutableClone(node) { + var clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + clone.parent = node.parent; + return clone; + } + ts.getMutableClone = getMutableClone; function createNotEmittedStatement(original) { - var node = createNode(293, original); + var node = createSynthesizedNode(294); node.original = original; + setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(296); + var node = createSynthesizedNode(297); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(295); + var node = createSynthesizedNode(296); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; - function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294, location || original); + function createPartiallyEmittedExpression(expression, original) { + var node = createSynthesizedNode(295); node.expression = expression; node.original = original; + setTextRange(node, original); return node; } ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; function updatePartiallyEmittedExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node); + return updateNode(createPartiallyEmittedExpression(expression, node.original), node); } return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - function createRawExpression(text) { - var node = createNode(297); - node.text = text; + function createBundle(sourceFiles) { + var node = ts.createNode(265); + node.sourceFiles = sourceFiles; + return node; + } + ts.createBundle = createBundle; + function updateBundle(node, sourceFiles) { + if (node.sourceFiles !== sourceFiles) { + return createBundle(sourceFiles); + } return node; } - ts.createRawExpression = createRawExpression; + ts.updateBundle = updateBundle; function createComma(left, right) { return createBinary(left, 25, right); } ts.createComma = createComma; - function createLessThan(left, right, location) { - return createBinary(left, 26, right, location); + function createLessThan(left, right) { + return createBinary(left, 26, right); } ts.createLessThan = createLessThan; - function createAssignment(left, right, location) { - return createBinary(left, 57, right, location); + function createAssignment(left, right) { + return createBinary(left, 57, right); } ts.createAssignment = createAssignment; function createStrictEquality(left, right) { @@ -12049,8 +12391,8 @@ var ts; return createBinary(left, 37, right); } ts.createSubtract = createSubtract; - function createPostfixIncrement(operand, location) { - return createPostfix(operand, 42, location); + function createPostfixIncrement(operand) { + return createPostfix(operand, 42); } ts.createPostfixIncrement = createPostfixIncrement; function createLogicalAnd(left, right) { @@ -12069,54 +12411,305 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createExportDefault(expression) { + return createExportAssignment(undefined, undefined, false, expression); + } + ts.createExportDefault = createExportDefault; + function createExternalModuleExport(exportName) { + return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(undefined, exportName)])); + } + ts.createExternalModuleExport = createExternalModuleExport; + function asName(name) { + return typeof name === "string" ? createIdentifier(name) : name; + } + function asExpression(value) { + return typeof value === "string" || typeof value === "number" ? createLiteral(value) : value; + } + function asNodeArray(array) { + return array ? createNodeArray(array) : undefined; + } + function asToken(value) { + return typeof value === "number" ? createToken(value) : value; + } + function disposeEmitNodes(sourceFile) { + sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); + var emitNode = sourceFile && sourceFile.emitNode; + var annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = undefined; + } + } + } + ts.disposeEmitNodes = disposeEmitNodes; + function getOrCreateEmitNode(node) { + if (!node.emitNode) { + if (ts.isParseTreeNode(node)) { + if (node.kind === 264) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = ts.getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } + return node.emitNode; + } + ts.getOrCreateEmitNode = getOrCreateEmitNode; + function setTextRange(range, location) { + if (location) { + range.pos = location.pos; + range.end = location.end; + } + return range; + } + ts.setTextRange = setTextRange; + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + ts.getEmitFlags = getEmitFlags; + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + ts.setEmitFlags = setEmitFlags; + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; + function setSourceMapRange(node, range) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + ts.setSourceMapRange = setSourceMapRange; + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; + function setTokenSourceMapRange(node, token, range) { + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); + tokenSourceMapRanges[token] = range; + return node; + } + ts.setTokenSourceMapRange = setTokenSourceMapRange; + function getCommentRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + ts.getCommentRange = getCommentRange; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + ts.setCommentRange = setCommentRange; + function getSyntheticLeadingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.leadingComments; + } + ts.getSyntheticLeadingComments = getSyntheticLeadingComments; + function setSyntheticLeadingComments(node, comments) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + ts.setSyntheticLeadingComments = setSyntheticLeadingComments; + function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticLeadingComment = addSyntheticLeadingComment; + function getSyntheticTrailingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.trailingComments; + } + ts.getSyntheticTrailingComments = getSyntheticTrailingComments; + function setSyntheticTrailingComments(node, comments) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + ts.setSyntheticTrailingComments = setSyntheticTrailingComments; + function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticTrailingComment = addSyntheticTrailingComment; + function getConstantValue(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + ts.getConstantValue = getConstantValue; + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + ts.setConstantValue = setConstantValue; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === undefined) + return 1; + if (y.priority === undefined) + return -1; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) + destEmitNode = {}; + if (leadingComments) + destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) + destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments); + if (flags) + destEmitNode.flags = flags; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) + destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); + return destEmitNode; + } + function mergeTokenSourceMapRanges(sourceRanges, destRanges) { + if (!destRanges) + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } + return destRanges; + } +})(ts || (ts = {})); +(function (ts) { function createTypeCheck(value, tag) { return tag === "undefined" - ? createStrictEquality(value, createVoidZero()) - : createStrictEquality(createTypeOf(value), createLiteral(tag)); + ? ts.createStrictEquality(value, ts.createVoidZero()) + : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)); } ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { - return createElementAccess(target, memberName.expression, location); + return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); } else { - var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 64; + var expression = ts.setTextRange(ts.isIdentifier(memberName) + ? ts.createPropertyAccess(target, memberName) + : ts.createElementAccess(target, memberName), memberName); + ts.getOrCreateEmitNode(expression).flags |= 64; return expression; } } ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; function createFunctionCall(func, thisArg, argumentsList, location) { - return createCall(createPropertyAccess(func, "call"), undefined, [ + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), undefined, [ thisArg - ].concat(argumentsList), location); + ].concat(argumentsList)), location); } ts.createFunctionCall = createFunctionCall; function createFunctionApply(func, thisArg, argumentsExpression, location) { - return createCall(createPropertyAccess(func, "apply"), undefined, [ + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), undefined, [ thisArg, argumentsExpression - ], location); + ]), location); } ts.createFunctionApply = createFunctionApply; function createArraySlice(array, start) { var argumentsList = []; if (start !== undefined) { - argumentsList.push(typeof start === "number" ? createLiteral(start) : start); + argumentsList.push(typeof start === "number" ? ts.createLiteral(start) : start); } - return createCall(createPropertyAccess(array, "slice"), undefined, argumentsList); + return ts.createCall(ts.createPropertyAccess(array, "slice"), undefined, argumentsList); } ts.createArraySlice = createArraySlice; function createArrayConcat(array, values) { - return createCall(createPropertyAccess(array, "concat"), undefined, values); + return ts.createCall(ts.createPropertyAccess(array, "concat"), undefined, values); } ts.createArrayConcat = createArrayConcat; function createMathPow(left, right, location) { - return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), undefined, [left, right], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), undefined, [left, right]), location); } ts.createMathPow = createMathPow; function createReactNamespace(reactNamespace, parent) { - var react = createIdentifier(reactNamespace || "React"); + var react = ts.createIdentifier(reactNamespace || "React"); react.flags &= ~8; react.parent = ts.getParseTreeNode(parent); return react; @@ -12124,9 +12717,9 @@ var ts; function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); - var right = createSynthesizedNode(70); + var right = ts.createIdentifier(jsxFactory.right.text); right.text = jsxFactory.right.text; - return createPropertyAccess(left, right); + return ts.createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12135,7 +12728,7 @@ var ts; function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : - createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); } function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { var argumentsList = [tagName]; @@ -12144,7 +12737,7 @@ var ts; } if (children && children.length > 0) { if (!props) { - argumentsList.push(createNull()); + argumentsList.push(ts.createNull()); } if (children.length > 1) { for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { @@ -12157,33 +12750,80 @@ var ts; argumentsList.push(children[0]); } } - return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList, location); + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; - function createExportDefault(expression) { - return createExportAssignment(undefined, undefined, false, expression); - } - ts.createExportDefault = createExportDefault; - function createExternalModuleExport(exportName) { - return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(exportName)])); + function getHelperName(name) { + return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2); } - ts.createExternalModuleExport = createExternalModuleExport; - function createLetStatement(name, initializer, location) { - return createVariableStatement(undefined, createLetDeclarationList([createVariableDeclaration(name, undefined, initializer)]), location); + ts.getHelperName = getHelperName; + var valuesHelper = { + name: "typescript:values", + scoped: false, + text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n " + }; + function createValuesHelper(context, expression, location) { + context.requestEmitHelper(valuesHelper); + return ts.setTextRange(ts.createCall(getHelperName("__values"), undefined, [expression]), location); } - ts.createLetStatement = createLetStatement; - function createLetDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 1); + ts.createValuesHelper = createValuesHelper; + var readHelper = { + name: "typescript:read", + scoped: false, + text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n " + }; + function createReadHelper(context, iteratorRecord, count, location) { + context.requestEmitHelper(readHelper); + return ts.setTextRange(ts.createCall(getHelperName("__read"), undefined, count !== undefined + ? [iteratorRecord, ts.createLiteral(count)] + : [iteratorRecord]), location); + } + ts.createReadHelper = createReadHelper; + var spreadHelper = { + name: "typescript:spread", + scoped: false, + text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" + }; + function createSpreadHelper(context, argumentList, location) { + context.requestEmitHelper(readHelper); + context.requestEmitHelper(spreadHelper); + return ts.setTextRange(ts.createCall(getHelperName("__spread"), undefined, argumentList), location); + } + ts.createSpreadHelper = createSpreadHelper; + function createForOfBindingStatement(node, boundValue) { + if (ts.isVariableDeclarationList(node)) { + var firstDeclaration = ts.firstOrUndefined(node.declarations); + var updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, undefined, boundValue); + return ts.setTextRange(ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(node, [updatedDeclaration])), node); + } + else { + var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), node); + return ts.setTextRange(ts.createStatement(updatedExpression), node); + } } - ts.createLetDeclarationList = createLetDeclarationList; - function createConstDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 2); + ts.createForOfBindingStatement = createForOfBindingStatement; + function insertLeadingStatement(dest, source) { + if (ts.isBlock(dest)) { + return ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)); + } + else { + return ts.createBlock(ts.createNodeArray([dest, source]), true); + } } - ts.createConstDeclarationList = createConstDeclarationList; - function getHelperName(name) { - return setEmitFlags(createIdentifier(name), 4096 | 2); + ts.insertLeadingStatement = insertLeadingStatement; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; } - ts.getHelperName = getHelperName; + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12193,13 +12833,13 @@ var ts; case 8: case 9: return false; - case 175: + case 176: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176: + case 177: return target.properties.length > 0; default: return true; @@ -12210,19 +12850,26 @@ var ts; var thisArg; var target; if (ts.isSuperProperty(callee)) { - thisArg = createThis(); + thisArg = ts.createThis(); target = callee; } else if (callee.kind === 96) { - thisArg = createThis(); - target = languageVersion < 2 ? createIdentifier("_super", callee) : callee; + thisArg = ts.createThis(); + target = languageVersion < 2 + ? ts.setTextRange(ts.createIdentifier("_super"), callee) + : callee; + } + else if (ts.getEmitFlags(callee) & 4096) { + thisArg = ts.createVoidZero(); + target = parenthesizeForAccess(callee); } else { switch (callee.kind) { - case 177: { + case 178: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = createTempVariable(recordTempVariable); - target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12230,10 +12877,11 @@ var ts; } break; } - case 178: { + case 179: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = createTempVariable(recordTempVariable); - target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12242,7 +12890,7 @@ var ts; break; } default: { - thisArg = createVoidZero(); + thisArg = ts.createVoidZero(); target = parenthesizeForAccess(expression); break; } @@ -12252,42 +12900,42 @@ var ts; } ts.createCallBinding = createCallBinding; function inlineExpressions(expressions) { - return ts.reduceLeft(expressions, createComma); + return ts.reduceLeft(expressions, ts.createComma); } ts.inlineExpressions = inlineExpressions; function createExpressionFromEntityName(node) { if (ts.isQualifiedName(node)) { var left = createExpressionFromEntityName(node.left); - var right = getMutableClone(node.right); - return createPropertyAccess(left, right, node); + var right = ts.getMutableClone(node.right); + return ts.setTextRange(ts.createPropertyAccess(left, right), node); } else { - return getMutableClone(node); + return ts.getMutableClone(node); } } ts.createExpressionFromEntityName = createExpressionFromEntityName; function createExpressionForPropertyName(memberName) { if (ts.isIdentifier(memberName)) { - return createLiteral(memberName, undefined); + return ts.createLiteral(memberName); } else if (ts.isComputedPropertyName(memberName)) { - return getMutableClone(memberName.expression); + return ts.getMutableClone(memberName.expression); } else { - return getMutableClone(memberName); + return ts.getMutableClone(memberName); } } ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151: case 152: + case 153: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257: + case 260: return createExpressionForPropertyAssignment(property, receiver); - case 258: + case 261: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149: + case 150: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12297,43 +12945,45 @@ var ts; if (property === firstAccessor) { var properties_1 = []; if (getAccessor) { - var getterFunction = createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor); - setOriginalNode(getterFunction, getAccessor); - var getter = createPropertyAssignment("get", getterFunction); + var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body); + ts.setTextRange(getterFunction, getAccessor); + ts.setOriginalNode(getterFunction, getAccessor); + var getter = ts.createPropertyAssignment("get", getterFunction); properties_1.push(getter); } if (setAccessor) { - var setterFunction = createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor); - setOriginalNode(setterFunction, setAccessor); - var setter = createPropertyAssignment("set", setterFunction); + var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body); + ts.setTextRange(setterFunction, setAccessor); + ts.setOriginalNode(setterFunction, setAccessor); + var setter = ts.createPropertyAssignment("set", setterFunction); properties_1.push(setter); } - properties_1.push(createPropertyAssignment("enumerable", createLiteral(true))); - properties_1.push(createPropertyAssignment("configurable", createLiteral(true))); - var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), undefined, [ + properties_1.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); + properties_1.push(ts.createPropertyAssignment("configurable", ts.createTrue())); + var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ receiver, createExpressionForPropertyName(property.name), - createObjectLiteral(properties_1, undefined, multiLine) - ], firstAccessor); + ts.createObjectLiteral(properties_1, multiLine) + ]), firstAccessor); return ts.aggregateTransformFlags(expression); } return undefined; } function createExpressionForPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer, property), property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer), property), property)); } function createExpressionForShorthandPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), ts.getSynthesizedClone(property.name)), property), property)); } function createExpressionForMethodDeclaration(method, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body), method), method)), method), method)); } function getLocalName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 16384); } ts.getLocalName = getLocalName; function isLocalName(node) { - return (getEmitFlags(node) & 16384) !== 0; + return (ts.getEmitFlags(node) & 16384) !== 0; } ts.isLocalName = isLocalName; function getExportName(node, allowComments, allowSourceMaps) { @@ -12341,7 +12991,7 @@ var ts; } ts.getExportName = getExportName; function isExportName(node) { - return (getEmitFlags(node) & 8192) !== 0; + return (ts.getEmitFlags(node) & 8192) !== 0; } ts.isExportName = isExportName; function getDeclarationName(node, allowComments, allowSourceMaps) { @@ -12350,17 +13000,17 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_10 = getMutableClone(node.name); - emitFlags |= getEmitFlags(node.name); + var name = ts.getMutableClone(node.name); + emitFlags |= ts.getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_10, emitFlags); - return name_10; + ts.setEmitFlags(name, emitFlags); + return name; } - return getGeneratedNameForNode(node); + return ts.getGeneratedNameForNode(node); } function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { if (ns && ts.hasModifier(node, 1)) { @@ -12370,25 +13020,31 @@ var ts; } ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName; function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { - var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name); + var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); + ts.setTextRange(qualifiedName, name); var emitFlags; if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(qualifiedName, emitFlags); + ts.setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; function convertToFunctionBody(node, multiLine) { - return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine); + return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node); } ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } - function addPrologueDirectives(target, source, ensureUseStrict, visitor) { + function addPrologue(target, source, ensureUseStrict, visitor) { + var offset = addStandardPrologue(target, source, ensureUseStrict); + return addCustomPrologue(target, source, offset, visitor); + } + ts.addPrologue = addPrologue; + function addStandardPrologue(target, source, ensureUseStrict) { ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); var foundUseStrict = false; var statementOffset = 0; @@ -12407,11 +13063,16 @@ var ts; statementOffset++; } if (ensureUseStrict && !foundUseStrict) { - target.push(startOnNewLine(createStatement(createLiteral("use strict")))); + target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))); } + return statementOffset; + } + ts.addStandardPrologue = addStandardPrologue; + function addCustomPrologue(target, source, statementOffset, visitor) { + var numStatements = source.length; while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 524288) { + if (ts.getEmitFlags(statement) & 524288) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12421,7 +13082,7 @@ var ts; } return statementOffset; } - ts.addPrologueDirectives = addPrologueDirectives; + ts.addCustomPrologue = addCustomPrologue; function startsWithUseStrict(statements) { var firstStatement = ts.firstOrUndefined(statements); return firstStatement !== undefined @@ -12444,33 +13105,43 @@ var ts; } } if (!foundUseStrict) { - return createNodeArray([ - startOnNewLine(createStatement(createLiteral("use strict"))) - ].concat(statements), statements); + return ts.setTextRange(ts.createNodeArray([ + startOnNewLine(ts.createStatement(ts.createLiteral("use strict"))) + ].concat(statements)), statements); } return statements; } ts.ensureUseStrict = ensureUseStrict; + function parenthesizeConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { + return ts.createParen(condition); + } + return condition; + } + ts.parenthesizeConditionalHead = parenthesizeConditionalHead; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 183) { + if (skipped.kind === 184) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) - ? createParen(operand) + ? ts.createParen(operand) : operand; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 195) { + && operand.kind === 196) { return false; } return true; @@ -12509,7 +13180,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 && node.operatorToken.kind === 36) { + if (node.kind === 193 && node.operatorToken.kind === 36) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12524,29 +13195,30 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { - return createParen(condition); + return ts.createParen(condition); } return condition; } ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { - return e.kind === 192 && e.operatorToken.kind === 25 - ? createParen(e) + return e.kind === 193 && e.operatorToken.kind === 25 + ? ts.createParen(e) : e; } + ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179: - return createParen(expression); case 180: + return ts.createParen(expression); + case 181: return emittedExpression.arguments ? expression - : createParen(expression); + : ts.createParen(expression); } return parenthesizeForAccess(expression); } @@ -12554,23 +13226,22 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 || emittedExpression.arguments) - && emittedExpression.kind !== 8) { + && (emittedExpression.kind !== 181 || emittedExpression.arguments)) { return expression; } - return createParen(expression, expression); + return ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeForAccess = parenthesizeForAccess; function parenthesizePostfixOperand(operand) { return ts.isLeftHandSideExpression(operand) ? operand - : createParen(operand, operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePostfixOperand = parenthesizePostfixOperand; function parenthesizePrefixOperand(operand) { return ts.isUnaryExpression(operand) ? operand - : createParen(operand, operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePrefixOperand = parenthesizePrefixOperand; function parenthesizeListElements(elements) { @@ -12585,17 +13256,18 @@ var ts; } } if (result !== undefined) { - return createNodeArray(result, elements, elements.hasTrailingComma); + return ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements); } return elements; } + ts.parenthesizeListElements = parenthesizeListElements; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192, 25); + var commaPrecedence = ts.getOperatorPrecedence(193, 25); return expressionPrecedence > commaPrecedence ? expression - : createParen(expression, expression); + : ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeExpressionForList = parenthesizeExpressionForList; function parenthesizeExpressionForExpressionStatement(expression) { @@ -12603,16 +13275,16 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 || kind === 185) { - var mutableCall = getMutableClone(emittedExpression); - mutableCall.expression = createParen(callee, callee); + if (kind === 185 || kind === 186) { + var mutableCall = ts.getMutableClone(emittedExpression); + mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); } } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) { - return createParen(expression, expression); + if (leftmostExpressionKind === 177 || leftmostExpressionKind === 185) { + return ts.setTextRange(ts.createParen(expression), expression); } } return expression; @@ -12620,7 +13292,7 @@ var ts; ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement; function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) { if (ts.isPartiallyEmittedExpression(originalOuterExpression)) { - var clone_1 = getMutableClone(originalOuterExpression); + var clone_1 = ts.getMutableClone(originalOuterExpression); clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression); return clone_1; } @@ -12629,21 +13301,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191: + case 192: node = node.operand; continue; - case 192: + case 193: node = node.left; continue; - case 193: + case 194: node = node.condition; continue; + case 180: case 179: case 178: - case 177: node = node.expression; continue; - case 294: + case 295: node = node.expression; continue; } @@ -12651,13 +13323,19 @@ var ts; } } function parenthesizeConciseBody(body) { - var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176) { - return createParen(body, body); + if (!ts.isBlock(body) && getLeftmostExpression(body).kind === 177) { + return ts.setTextRange(ts.createParen(body), body); } return body; } ts.parenthesizeConciseBody = parenthesizeConciseBody; + var OuterExpressionKinds; + (function (OuterExpressionKinds) { + OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses"; + OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions"; + OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions"; + OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All"; + })(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {})); function skipOuterExpressions(node, kinds) { if (kinds === void 0) { kinds = 7; } var previousNode; @@ -12677,7 +13355,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183) { + while (node.kind === 184) { node = node.expression; } return node; @@ -12691,7 +13369,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294) { + while (node.kind === 295) { node = node.expression; } return node; @@ -12702,120 +13380,6 @@ var ts; return node; } ts.startOnNewLine = startOnNewLine; - function setOriginalNode(node, original) { - node.original = original; - if (original) { - var emitNode = original.emitNode; - if (emitNode) - node.emitNode = mergeEmitNode(emitNode, node.emitNode); - } - return node; - } - ts.setOriginalNode = setOriginalNode; - function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; - if (!destEmitNode) - destEmitNode = {}; - if (flags) - destEmitNode.flags = flags; - if (commentRange) - destEmitNode.commentRange = commentRange; - if (sourceMapRange) - destEmitNode.sourceMapRange = sourceMapRange; - if (tokenSourceMapRanges) - destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); - if (constantValue !== undefined) - destEmitNode.constantValue = constantValue; - if (helpers) - destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); - return destEmitNode; - } - function mergeTokenSourceMapRanges(sourceRanges, destRanges) { - if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); - return destRanges; - } - function disposeEmitNodes(sourceFile) { - sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); - var emitNode = sourceFile && sourceFile.emitNode; - var annotatedNodes = emitNode && emitNode.annotatedNodes; - if (annotatedNodes) { - for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { - var node = annotatedNodes_1[_i]; - node.emitNode = undefined; - } - } - } - ts.disposeEmitNodes = disposeEmitNodes; - function getOrCreateEmitNode(node) { - if (!node.emitNode) { - if (ts.isParseTreeNode(node)) { - if (node.kind === 261) { - return node.emitNode = { annotatedNodes: [node] }; - } - var sourceFile = ts.getSourceFileOfNode(node); - getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); - } - node.emitNode = {}; - } - return node.emitNode; - } - ts.getOrCreateEmitNode = getOrCreateEmitNode; - function getEmitFlags(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.flags; - } - ts.getEmitFlags = getEmitFlags; - function setEmitFlags(node, emitFlags) { - getOrCreateEmitNode(node).flags = emitFlags; - return node; - } - ts.setEmitFlags = setEmitFlags; - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; - } - ts.getSourceMapRange = getSourceMapRange; - function setSourceMapRange(node, range) { - getOrCreateEmitNode(node).sourceMapRange = range; - return node; - } - ts.setSourceMapRange = setSourceMapRange; - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; - function setTokenSourceMapRange(node, token, range) { - var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); - tokenSourceMapRanges[token] = range; - return node; - } - ts.setTokenSourceMapRange = setTokenSourceMapRange; - function getCommentRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.commentRange) || node; - } - ts.getCommentRange = getCommentRange; - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; - function getConstantValue(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.constantValue; - } - ts.getConstantValue = getConstantValue; - function setConstantValue(node, value) { - var emitNode = getOrCreateEmitNode(node); - emitNode.constantValue = value; - return node; - } - ts.setConstantValue = setConstantValue; function getExternalHelpersModuleName(node) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); var emitNode = parseNode && parseNode.emitNode; @@ -12828,125 +13392,31 @@ var ts; if (externalHelpersModuleName) { return externalHelpersModuleName; } - var helpers = getEmitHelpers(node); + var helpers = ts.getEmitHelpers(node); if (helpers) { - for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { - var helper = helpers_1[_i]; + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; if (!helper.scoped) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); - var emitNode = getOrCreateEmitNode(parseNode); - return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + var emitNode = ts.getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)); } } } } } ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; - function addEmitHelper(node, helper) { - var emitNode = getOrCreateEmitNode(node); - emitNode.helpers = ts.append(emitNode.helpers, helper); - return node; - } - ts.addEmitHelper = addEmitHelper; - function addEmitHelpers(node, helpers) { - if (ts.some(helpers)) { - var emitNode = getOrCreateEmitNode(node); - for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { - var helper = helpers_2[_i]; - if (!ts.contains(emitNode.helpers, helper)) { - emitNode.helpers = ts.append(emitNode.helpers, helper); - } - } - } - return node; - } - ts.addEmitHelpers = addEmitHelpers; - function removeEmitHelper(node, helper) { - var emitNode = node.emitNode; - if (emitNode) { - var helpers = emitNode.helpers; - if (helpers) { - return ts.orderedRemoveItem(helpers, helper); - } - } - return false; - } - ts.removeEmitHelper = removeEmitHelper; - function getEmitHelpers(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.helpers; - } - ts.getEmitHelpers = getEmitHelpers; - function moveEmitHelpers(source, target, predicate) { - var sourceEmitNode = source.emitNode; - var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; - if (!ts.some(sourceEmitHelpers)) - return; - var targetEmitNode = getOrCreateEmitNode(target); - var helpersRemoved = 0; - for (var i = 0; i < sourceEmitHelpers.length; i++) { - var helper = sourceEmitHelpers[i]; - if (predicate(helper)) { - helpersRemoved++; - if (!ts.contains(targetEmitNode.helpers, helper)) { - targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); - } - } - else if (helpersRemoved > 0) { - sourceEmitHelpers[i - helpersRemoved] = helper; - } - } - if (helpersRemoved > 0) { - sourceEmitHelpers.length -= helpersRemoved; - } - } - ts.moveEmitHelpers = moveEmitHelpers; - function compareEmitHelpers(x, y) { - if (x === y) - return 0; - if (x.priority === y.priority) - return 0; - if (x.priority === undefined) - return 1; - if (y.priority === undefined) - return -1; - return ts.compareValues(x.priority, y.priority); - } - ts.compareEmitHelpers = compareEmitHelpers; - function setTextRange(node, location) { - if (location) { - node.pos = location.pos; - node.end = location.end; - } - return node; - } - ts.setTextRange = setTextRange; - function setNodeFlags(node, flags) { - node.flags = flags; - return node; - } - ts.setNodeFlags = setNodeFlags; - function setMultiLine(node, multiLine) { - node.multiLine = multiLine; - return node; - } - ts.setMultiLine = setMultiLine; - function setHasTrailingComma(nodes, hasTrailingComma) { - nodes.hasTrailingComma = hasTrailingComma; - return nodes; - } - ts.setHasTrailingComma = setHasTrailingComma; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_11 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 && node.importClause) { - return getGeneratedNameForNode(node); + if (node.kind === 237 && node.importClause) { + return ts.getGeneratedNameForNode(node); } - if (node.kind === 241 && node.moduleSpecifier) { - return getGeneratedNameForNode(node); + if (node.kind === 243 && node.moduleSpecifier) { + return ts.getGeneratedNameForNode(node); } return undefined; } @@ -12956,26 +13426,24 @@ var ts; if (moduleName.kind === 9) { return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) || tryRenameExternalModule(moduleName, sourceFile) - || getSynthesizedClone(moduleName); + || ts.getSynthesizedClone(moduleName); } return undefined; } ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && ts.createLiteral(rename); } function tryGetModuleNameFromFile(file, host, options) { if (!file) { return undefined; } if (file.moduleName) { - return createLiteral(file.moduleName); + return ts.createLiteral(file.moduleName); } if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) { - return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); + return ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); } return undefined; } @@ -13009,11 +13477,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257: + case 260: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 258: + case 261: return bindingElement.name; - case 259: + case 262: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -13029,11 +13497,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144: - case 174: + case 145: + case 175: return bindingElement.dotDotDotToken; - case 196: - case 259: + case 197: + case 262: return bindingElement; } return undefined; @@ -13041,7 +13509,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174: + case 175: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13049,7 +13517,7 @@ var ts; : propertyName; } break; - case 257: + case 260: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13057,7 +13525,7 @@ var ts; : propertyName; } break; - case 259: + case 262: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -13071,11 +13539,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172: case 173: - case 175: - return name.elements; + case 174: case 176: + return name.elements; + case 177: return name.properties; } } @@ -13084,10 +13552,12 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpread(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); } var expression = convertToAssignmentElementTarget(element.name); - return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + return element.initializer + ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) + : expression; } ts.Debug.assertNode(element, ts.isExpression); return element; @@ -13097,14 +13567,14 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpreadAssignment(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); } if (element.propertyName) { var expression = convertToAssignmentElementTarget(element.name); - return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element); } ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element); } ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); return element; @@ -13112,18 +13582,18 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: - return convertToArrayAssignmentPattern(node); - case 172: + case 174: case 176: + return convertToArrayAssignmentPattern(node); + case 173: + case 177: return convertToObjectAssignmentPattern(node); } } ts.convertToAssignmentPattern = convertToAssignmentPattern; function convertToObjectAssignmentPattern(node) { if (ts.isObjectBindingPattern(node)) { - return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isObjectLiteralExpression); return node; @@ -13131,7 +13601,7 @@ var ts; ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; function convertToArrayAssignmentPattern(node) { if (ts.isArrayBindingPattern(node)) { - return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isArrayLiteralExpression); return node; @@ -13147,30 +13617,30 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; var exportEquals = undefined; var hasExportStarsToExportValues = false; var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); - var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); if (externalHelpersImportDeclaration) { externalImports.push(externalHelpersImportDeclaration); } for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235: + case 237: externalImports.push(node); break; - case 234: - if (node.moduleReference.kind === 245) { + case 236: + if (node.moduleReference.kind === 247) { externalImports.push(node); } break; - case 241: + case 243: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -13183,26 +13653,26 @@ var ts; else { for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_12 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_12.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_12) - || resolver.getReferencedValueDeclaration(name_12); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 240: + case 242: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 205: + case 207: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13210,38 +13680,38 @@ var ts; } } break; - case 225: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_13 = node.name; - if (!uniqueExports[name_13.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); - uniqueExports[name_13.text] = true; - exportedNames = ts.append(exportedNames, name_13); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 226: + case 228: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_14 = node.name; - if (!uniqueExports[name_14.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14); - uniqueExports[name_14.text] = true; - exportedNames = ts.append(exportedNames, name_14); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13261,13 +13731,23 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); var ts; (function (ts) { @@ -13276,13 +13756,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261) { + if (kind === 264) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141) { + else if (kind < 142) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13318,28 +13798,29 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141: + case 142: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143: + case 144: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 258: + case 261: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259: + case 262: return visitNode(cbNode, node.expression); - case 144: + case 145: + case 148: case 147: - case 146: - case 257: - case 223: - case 174: + case 260: + case 225: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -13348,24 +13829,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158: case 159: - case 153: + case 160: case 154: case 155: + case 156: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 225: + case 153: case 185: + case 227: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -13376,320 +13857,326 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157: + case 158: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156: + case 157: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160: - return visitNode(cbNode, node.exprName); case 161: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 162: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 163: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 164: + return visitNodes(cbNodes, node.elementTypes); case 165: - return visitNodes(cbNodes, node.types); case 166: - case 168: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); + case 167: case 169: + return visitNode(cbNode, node.type); + case 170: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170: + case 171: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171: - return visitNode(cbNode, node.literal); case 172: + return visitNode(cbNode, node.literal); case 173: - return visitNodes(cbNodes, node.elements); - case 175: + case 174: return visitNodes(cbNodes, node.elements); case 176: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 177: + return visitNodes(cbNodes, node.properties); + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178: + case 179: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179: case 180: + case 181: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181: + case 182: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182: + case 183: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.expression); - case 186: + case 184: return visitNode(cbNode, node.expression); case 187: return visitNode(cbNode, node.expression); case 188: return visitNode(cbNode, node.expression); - case 190: - return visitNode(cbNode, node.operand); - case 195: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 189: return visitNode(cbNode, node.expression); case 191: return visitNode(cbNode, node.operand); + case 196: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 190: + return visitNode(cbNode, node.expression); case 192: + return visitNode(cbNode, node.operand); + case 193: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200: + case 201: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201: + case 202: return visitNode(cbNode, node.expression); - case 193: + case 203: + return visitNode(cbNode, node.name); + case 194: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196: + case 197: return visitNode(cbNode, node.expression); - case 204: - case 231: + case 206: + case 233: return visitNodes(cbNodes, node.statements); - case 261: + case 264: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205: + case 207: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224: + case 226: return visitNodes(cbNodes, node.declarations); - case 207: + case 209: return visitNode(cbNode, node.expression); - case 208: + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209: + case 211: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210: + case 212: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 211: + case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 212: + case 214: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213: - return visitNode(cbNode, node.initializer) || + case 215: + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214: - case 215: - return visitNode(cbNode, node.label); case 216: - return visitNode(cbNode, node.expression); case 217: + return visitNode(cbNode, node.label); + case 218: + return visitNode(cbNode, node.expression); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218: + case 220: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232: + case 234: return visitNodes(cbNodes, node.clauses); - case 253: + case 256: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254: + case 257: return visitNodes(cbNodes, node.statements); - case 219: + case 221: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220: + case 222: return visitNode(cbNode, node.expression); - case 221: + case 223: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256: + case 259: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145: + case 146: return visitNode(cbNode, node.expression); - case 226: - case 197: + case 228: + case 198: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 227: + case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 228: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 229: + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 260: + case 263: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 230: + case 232: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235: + case 237: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233: + case 235: return visitNode(cbNode, node.name); - case 237: + case 239: return visitNode(cbNode, node.name); - case 238: - case 242: + case 240: + case 244: return visitNodes(cbNodes, node.elements); - case 241: + case 243: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239: - case 243: + case 241: + case 245: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194: + case 195: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142: + case 143: return visitNode(cbNode, node.expression); - case 255: + case 258: return visitNodes(cbNodes, node.types); - case 199: + case 200: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245: + case 247: return visitNode(cbNode, node.expression); - case 244: - return visitNodes(cbNodes, node.decorators); case 246: + return visitNodes(cbNodes, node.decorators); + case 248: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247: - case 248: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNodes, node.attributes); + case 249: case 250: + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.attributes); + case 253: + return visitNodes(cbNodes, node.properties); + case 252: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251: - return visitNode(cbNode, node.expression); - case 252: + case 254: return visitNode(cbNode, node.expression); - case 249: + case 255: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 251: return visitNode(cbNode, node.tagName); - case 262: - return visitNode(cbNode, node.type); case 266: + return visitNode(cbNode, node.type); + case 270: return visitNodes(cbNodes, node.types); - case 267: + case 271: return visitNodes(cbNodes, node.types); - case 265: - return visitNode(cbNode, node.elementType); case 269: + return visitNode(cbNode, node.elementType); + case 273: return visitNode(cbNode, node.type); - case 268: + case 272: return visitNode(cbNode, node.type); - case 270: + case 274: return visitNode(cbNode, node.literal); - case 272: + case 276: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273: + case 277: return visitNode(cbNode, node.type); - case 274: + case 278: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275: + case 279: return visitNode(cbNode, node.type); - case 276: + case 280: return visitNode(cbNode, node.type); - case 277: + case 281: return visitNode(cbNode, node.type); - case 271: + case 275: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278: + case 282: return visitNodes(cbNodes, node.tags); - case 281: + case 285: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282: - return visitNode(cbNode, node.typeExpression); - case 283: + case 286: return visitNode(cbNode, node.typeExpression); - case 280: + case 287: return visitNode(cbNode, node.typeExpression); case 284: + return visitNode(cbNode, node.typeExpression); + case 288: return visitNodes(cbNodes, node.typeParameters); - case 285: + case 289: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287: + case 291: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286: + case 290: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294: + case 295: return visitNode(cbNode, node.expression); - case 288: + case 292: return visitNode(cbNode, node.literal); } } @@ -13730,7 +14217,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(5, true); - var disallowInAndDecoratorContext = 65536 | 262144; + var disallowInAndDecoratorContext = 2048 | 8192; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -13778,7 +14265,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 || scriptKind === 2 ? 2097152 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -13853,7 +14340,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(261, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(264, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -13873,16 +14360,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536); + setContextFlag(val, 2048); } function setYieldContext(val) { - setContextFlag(val, 131072); + setContextFlag(val, 4096); } function setDecoratorContext(val) { - setContextFlag(val, 262144); + setContextFlag(val, 8192); } function setAwaitContext(val) { - setContextFlag(val, 524288); + setContextFlag(val, 16384); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -13905,40 +14392,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536, func); + return doOutsideOfContext(2048, func); } function disallowInAnd(func) { - return doInsideOfContext(65536, func); + return doInsideOfContext(2048, func); } function doInYieldContext(func) { - return doInsideOfContext(131072, func); + return doInsideOfContext(4096, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144, func); + return doInsideOfContext(8192, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288, func); + return doInsideOfContext(16384, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288, func); + return doOutsideOfContext(16384, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 | 524288, func); + return doInsideOfContext(4096 | 16384, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072); + return inContext(4096); } function inDisallowInContext() { - return inContext(65536); + return inContext(2048); } function inDecoratorContext() { - return inContext(262144); + return inContext(8192); } function inAwaitContext() { - return inContext(524288); + return inContext(16384); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14080,7 +14567,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 ? new NodeConstructor(kind, pos, pos) : kind === 70 ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -14100,7 +14587,7 @@ var ts; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576; + node.flags |= 32768; } return node; } @@ -14117,7 +14604,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; @@ -14162,7 +14653,7 @@ var ts; return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token()); } function parseComputedPropertyName() { - var node = createNode(142); + var node = createNode(143); parseExpected(20); node.expression = allowInAnd(parseExpression); parseExpected(21); @@ -14211,6 +14702,7 @@ var ts; function nextTokenIsClassOrFunctionOrAsync() { nextToken(); return token() === 74 || token() === 88 || + (token() === 116 && lookAhead(nextTokenIsClassKeywordOnSameLine)) || (token() === 119 && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } function isListElement(parsingContext, inErrorRecovery) { @@ -14418,7 +14910,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 3080192; + var nodeContextFlags = node.flags & 96256; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -14467,14 +14959,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150: - case 155: case 151: + case 156: case 152: - case 147: - case 203: + case 153: + case 148: + case 205: return true; - case 149: + case 150: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 70 && methodDeclaration.name.originalKeywordKind === 122; @@ -14486,8 +14978,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253: - case 254: + case 256: + case 257: return true; } } @@ -14496,65 +14988,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225: - case 205: - case 204: - case 208: + case 227: case 207: + case 206: + case 210: + case 209: + case 222: + case 218: case 220: + case 217: case 216: - case 218: - case 215: case 214: - case 212: + case 215: case 213: - case 211: - case 210: - case 217: - case 206: - case 221: + case 212: case 219: - case 209: - case 222: - case 235: - case 234: - case 241: - case 240: - case 230: - case 226: - case 227: - case 229: + case 208: + case 223: + case 221: + case 211: + case 224: + case 237: + case 236: + case 243: + case 242: + case 232: case 228: + case 229: + case 231: + case 230: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260; + return node.kind === 263; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154: - case 148: case 155: - case 146: - case 153: + case 149: + case 156: + case 147: + case 154: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223) { + if (node.kind !== 225) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144) { + if (node.kind !== 145) { return false; } var parameter = node; @@ -14599,7 +15091,6 @@ var ts; case 25: return ts.Diagnostics.Property_assignment_expected; } } - ; function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; @@ -14650,7 +15141,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22)) { - var node = createNode(141, entity.pos); + var node = createNode(142, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -14667,7 +15158,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194); + var template = createNode(195); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -14679,7 +15170,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202); + var span = createNode(204); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -14715,20 +15206,16 @@ var ts; if (scanner.isUnterminated()) { node.isUnterminated = true; } - var tokenPos = scanner.getTokenPos(); + if (node.kind === 8) { + node.numericLiteralFlags = scanner.getNumericLiteralFlags(); + } nextToken(); finishNode(node); - if (node.kind === 8 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.isOctalLiteral = true; - } return node; } function parseTypeReference() { - var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(157, typeName.pos); - node.typeName = typeName; + var node = createNode(158); + node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); } @@ -14736,24 +15223,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156, lhs.pos); + var node = createNode(157, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167); + var node = createNode(168); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160); + var node = createNode(161); parseExpected(102); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); if (parseOptional(84)) { if (isStartOfType() || !isStartOfExpression()) { @@ -14763,6 +15250,9 @@ var ts; node.expression = parseUnaryExpressionOrHigher(); } } + if (parseOptional(57)) { + node.default = parseType(); + } return finishNode(node); } function parseTypeParameters() { @@ -14780,9 +15270,9 @@ var ts; return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98; } function parseParameter() { - var node = createNode(144); + var node = createNode(145); if (token() === 98) { - node.name = createIdentifier(true, undefined); + node.name = createIdentifier(true); node.type = parseParameterType(); return finishNode(node); } @@ -14840,7 +15330,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154) { + if (kind === 155) { parseExpected(93); } fillSignature(55, false, false, false, node); @@ -14880,7 +15370,7 @@ var ts; return token() === 55 || token() === 25 || token() === 21; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155, fullStart); + var node = createNode(156, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16, parseParameter, 20, 21); @@ -14892,7 +15382,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54); if (token() === 18 || token() === 26) { - var method = createNode(148, fullStart); + var method = createNode(149, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -14901,7 +15391,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146, fullStart); + var property = createNode(147, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -14914,19 +15404,19 @@ var ts; } } function isTypeMemberStart() { - var idToken; if (token() === 18 || token() === 26) { return true; } + var idToken; while (ts.isModifierKind(token())) { - idToken = token(); + idToken = true; nextToken(); } if (token() === 20) { return true; } if (isLiteralPropertyName()) { - idToken = token(); + idToken = true; nextToken(); } if (idToken) { @@ -14941,10 +15431,10 @@ var ts; } function parseTypeMember() { if (token() === 18 || token() === 26) { - return parseSignatureMember(153); + return parseSignatureMember(154); } if (token() === 93 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154); + return parseSignatureMember(155); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -14958,7 +15448,7 @@ var ts; return token() === 18 || token() === 26; } function parseTypeLiteral() { - var node = createNode(161); + var node = createNode(162); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -14981,14 +15471,14 @@ var ts; return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91; } function parseMappedTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); parseExpected(91); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170); + var node = createNode(171); parseExpected(16); node.readonlyToken = parseOptionalToken(130); parseExpected(20); @@ -15001,12 +15491,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163); + var node = createNode(164); node.elementTypes = parseBracketedList(20, parseType, 20, 21); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166); + var node = createNode(167); parseExpected(18); node.type = parseType(); parseExpected(19); @@ -15014,7 +15504,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159) { + if (kind === 160) { parseExpected(93); } fillSignature(35, false, false, false, node); @@ -15025,7 +15515,7 @@ var ts; return token() === 22 ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171); + var node = createNode(172); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -15036,12 +15526,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: - case 137: + case 136: + case 138: case 129: + case 133: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: @@ -15078,12 +15569,12 @@ var ts; function isStartOfType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: - case 137: + case 138: case 94: case 98: case 102: @@ -15091,11 +15582,14 @@ var ts; case 16: case 20: case 26: + case 48: + case 47: case 93: case 9: case 8: case 100: case 85: + case 133: return true; case 37: return lookAhead(nextTokenIsNumericLiteral); @@ -15113,14 +15607,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) { if (isStartOfType()) { - var node = createNode(169, type.pos); + var node = createNode(170, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21); type = finishNode(node); } else { - var node = createNode(162, type.pos); + var node = createNode(163, type.pos); node.elementType = type; parseExpected(21); type = finishNode(node); @@ -15129,7 +15623,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168); + var node = createNode(169); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -15143,6 +15637,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -15157,10 +15652,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47); + return parseUnionOrIntersectionType(166, parseTypeOperatorOrHigher, 47); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48); + return parseUnionOrIntersectionType(165, parseIntersectionTypeOrHigher, 48); } function isStartOfFunctionType() { if (token() === 26) { @@ -15206,7 +15701,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156, typePredicateVariable.pos); + var node = createNode(157, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -15223,14 +15718,14 @@ var ts; } } function parseType() { - return doOutsideOfContext(655360, parseTypeWorker); + return doOutsideOfContext(20480, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158); + return parseFunctionOrConstructorType(159); } if (token() === 93) { - return parseFunctionOrConstructorType(159); + return parseFunctionOrConstructorType(160); } return parseUnionTypeOrHigher(); } @@ -15349,7 +15844,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 38 || isStartOfExpression())) { @@ -15365,13 +15860,13 @@ var ts; ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185, asyncModifier.pos); + node = createNode(186, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185, identifier.pos); + node = createNode(186, identifier.pos); } - var parameter = createNode(144, identifier.pos); + var parameter = createNode(145, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -15505,7 +16000,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185); + var node = createNode(186); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256); fillSignature(55, false, isAsync, !allowAmbiguity, node); @@ -15537,7 +16032,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(193, leftOperand.pos); + var node = createNode(194, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -15550,7 +16045,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 || t === 140; + return t === 91 || t === 141; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -15628,39 +16123,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192, left.pos); + var node = createNode(193, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200, left.pos); + var node = createNode(201, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186); + var node = createNode(187); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187); + var node = createNode(188); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15675,7 +16170,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189); + var node = createNode(190); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15691,7 +16186,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182) { + if (simpleUnaryExpression.kind === 183) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -15744,7 +16239,7 @@ var ts; } function parseIncrementExpression() { if (token() === 42 || token() === 43) { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -15756,7 +16251,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191, expression.pos); + var node = createNode(192, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -15779,7 +16274,7 @@ var ts; if (token() === 18 || token() === 22 || token() === 20) { return expression; } - var node = createNode(177, expression.pos); + var node = createNode(178, expression.pos); node.expression = expression; parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -15801,8 +16296,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248) { - var node = createNode(246, opening.pos); + if (opening.kind === 250) { + var node = createNode(248, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -15812,14 +16307,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247); + ts.Debug.assert(opening.kind === 249); result = opening; } if (inExpressionContext && token() === 26) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192, result.pos); + var badNode = createNode(193, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -15859,20 +16354,28 @@ var ts; parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } + else if (token() === 7) { + break; + } result.push(parseJsxChild()); } result.end = scanner.getTokenPos(); parsingContext = saveParsingContext; return result; } + function parseJsxAttributes() { + var jsxAttributes = createNode(253); + jsxAttributes.properties = parseList(13, parseJsxAttribute); + return finishNode(jsxAttributes); + } function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(26); var tagName = parseJsxElementName(); - var attributes = parseList(13, parseJsxAttribute); + var attributes = parseJsxAttributes(); var node; if (token() === 28) { - node = createNode(248, fullStart); + node = createNode(250, fullStart); scanJsxText(); } else { @@ -15884,7 +16387,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(247, fullStart); + node = createNode(249, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -15895,7 +16398,7 @@ var ts; var expression = token() === 98 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22)) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -15903,9 +16406,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252); + var node = createNode(255); parseExpected(16); if (token() !== 17) { + node.dotDotDotToken = parseOptionalToken(23); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -15922,7 +16426,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250); + var node = createNode(252); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -15937,7 +16441,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251); + var node = createNode(254); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -15945,7 +16449,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249); + var node = createNode(251); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -15958,7 +16462,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182); + var node = createNode(183); parseExpected(26); node.type = parseType(); parseExpected(28); @@ -15969,7 +16473,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22); if (dotToken) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -15977,13 +16481,13 @@ var ts; } if (token() === 50 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201, expression.pos); + var nonNullExpression = createNode(202, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(20)) { - var indexedAccess = createNode(178, expression.pos); + var indexedAccess = createNode(179, expression.pos); indexedAccess.expression = expression; if (token() !== 21) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -15997,7 +16501,7 @@ var ts; continue; } if (token() === 12 || token() === 13) { - var tagExpression = createNode(181, expression.pos); + var tagExpression = createNode(182, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 ? parseLiteralNode() @@ -16016,7 +16520,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -16024,7 +16528,7 @@ var ts; continue; } else if (token() === 18) { - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -16119,28 +16623,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183); + var node = createNode(184); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196); + var node = createNode(197); parseExpected(23); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 ? parseSpreadElement() : - token() === 25 ? createNode(198) : + token() === 25 ? createNode(199) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175); + var node = createNode(176); parseExpected(20); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16151,18 +16655,18 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124)) { - return parseAccessorDeclaration(151, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(133)) { return parseAccessorDeclaration(152, fullStart, decorators, modifiers); } + else if (parseContextualModifier(134)) { + return parseAccessorDeclaration(153, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(259, fullStart); + var spreadElement = createNode(262, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16181,7 +16685,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258, fullStart); + var shorthandDeclaration = createNode(261, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -16192,7 +16696,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257, fullStart); + var propertyAssignment = createNode(260, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16202,7 +16706,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(16); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16216,7 +16720,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(184); + var node = createNode(185); node.modifiers = parseModifiers(); parseExpected(88); node.asteriskToken = parseOptionalToken(38); @@ -16238,8 +16742,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180); + var fullStart = scanner.getStartPos(); parseExpected(93); + if (parseOptional(22)) { + var node_1 = createNode(203, fullStart); + node_1.keywordToken = 93; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(181, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -16248,7 +16759,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204); + var node = createNode(206); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16279,12 +16790,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206); + var node = createNode(208); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(208); + var node = createNode(210); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16294,7 +16805,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209); + var node = createNode(211); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -16305,7 +16816,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210); + var node = createNode(212); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16316,6 +16827,7 @@ var ts; function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(87); + var awaitToken = parseOptionalToken(120); parseExpected(18); var initializer = undefined; if (token() !== 24) { @@ -16327,22 +16839,23 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(91)) { - var forInStatement = createNode(212, pos); - forInStatement.initializer = initializer; - forInStatement.expression = allowInAnd(parseExpression); - parseExpected(19); - forOrForInOrForOfStatement = forInStatement; - } - else if (parseOptional(140)) { - var forOfStatement = createNode(213, pos); + if (awaitToken ? parseExpected(141) : parseOptional(141)) { + var forOfStatement = createNode(215, pos); + forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } + else if (parseOptional(91)) { + var forInStatement = createNode(214, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(19); + forOrForInOrForOfStatement = forInStatement; + } else { - var forStatement = createNode(211, pos); + var forStatement = createNode(213, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -16360,7 +16873,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 ? 71 : 76); + parseExpected(kind === 217 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -16368,7 +16881,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216); + var node = createNode(218); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -16377,7 +16890,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217); + var node = createNode(219); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16386,7 +16899,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253); + var node = createNode(256); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -16394,7 +16907,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254); + var node = createNode(257); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -16404,12 +16917,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218); + var node = createNode(220); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(232, scanner.getStartPos()); + var caseBlock = createNode(234, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -16417,14 +16930,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(220); + var node = createNode(222); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(221); + var node = createNode(223); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -16435,7 +16948,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256); + var result = createNode(259); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -16445,7 +16958,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222); + var node = createNode(224); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -16454,13 +16967,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(219, fullStart); + var labeledStatement = createNode(221, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207, fullStart); + var expressionStatement = createNode(209, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -16470,6 +16983,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak(); } + function nextTokenIsClassKeywordOnSameLine() { + nextToken(); + return token() === 74 && !scanner.hasPrecedingLineBreak(); + } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); return token() === 88 && !scanner.hasPrecedingLineBreak(); @@ -16489,7 +17006,7 @@ var ts; case 82: return true; case 108: - case 136: + case 137: return nextTokenIsIdentifierOnSameLine(); case 127: case 128: @@ -16506,7 +17023,7 @@ var ts; return false; } continue; - case 139: + case 140: nextToken(); return token() === 16 || token() === 70 || token() === 83; case 90: @@ -16566,8 +17083,8 @@ var ts; case 108: case 127: case 128: - case 136: - case 139: + case 137: + case 140: return true; case 113: case 111: @@ -16612,9 +17129,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(214); + return parseBreakOrContinueStatement(216); case 71: - return parseBreakOrContinueStatement(215); + return parseBreakOrContinueStatement(217); case 95: return parseReturnStatement(); case 106: @@ -16633,7 +17150,7 @@ var ts; return parseDeclaration(); case 119: case 108: - case 136: + case 137: case 127: case 128: case 123: @@ -16647,7 +17164,7 @@ var ts; case 116: case 114: case 130: - case 139: + case 140: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -16670,11 +17187,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136: + case 137: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139: + case 140: case 127: case 128: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -16693,7 +17210,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -16714,16 +17231,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 25) { - return createNode(198); + return createNode(199); } - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -16739,14 +17256,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172); + var node = createNode(173); parseExpected(16); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(17); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173); + var node = createNode(174); parseExpected(20); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(21); @@ -16765,7 +17282,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223); + var node = createNode(225); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -16774,7 +17291,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224); + var node = createNode(226); switch (token()) { case 103: break; @@ -16788,7 +17305,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -16803,7 +17320,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(207, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -16811,7 +17328,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -16824,7 +17341,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150, pos); + var node = createNode(151, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122); @@ -16833,7 +17350,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149, fullStart); + var method = createNode(150, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -16846,7 +17363,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147, fullStart); + var property = createNode(148, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -16854,7 +17371,7 @@ var ts; property.type = parseTypeAnnotation(); property.initializer = ts.hasModifier(property, 32) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 | 65536, parseNonParameterInitializer); + : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -16916,7 +17433,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) { + if (!ts.isKeyword(idToken) || idToken === 134 || idToken === 124) { return true; } switch (token()) { @@ -16939,7 +17456,7 @@ var ts; if (!parseOptional(56)) { break; } - var decorator = createNode(145, decoratorStart); + var decorator = createNode(146, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -16996,7 +17513,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(203); + var result = createNode(205); nextToken(); return finishNode(result); } @@ -17021,16 +17538,16 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined); + var name = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 198); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -17064,9 +17581,10 @@ var ts; return undefined; } function parseHeritageClause() { - if (token() === 84 || token() === 107) { - var node = createNode(255); - node.token = token(); + var tok = token(); + if (tok === 84 || tok === 107) { + var node = createNode(258); + node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); return finishNode(node); @@ -17074,7 +17592,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199); + var node = createNode(200); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -17088,7 +17606,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -17099,10 +17617,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136); + parseExpected(137); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57); @@ -17111,13 +17629,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(260, scanner.getStartPos()); + var node = createNode(263, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -17132,7 +17650,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231, scanner.getStartPos()); + var node = createNode(233, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -17143,7 +17661,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230, fullStart); + var node = createNode(232, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -17155,10 +17673,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(232, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139) { + if (token() === 140) { node.name = parseIdentifier(); node.flags |= 512; } @@ -17175,7 +17693,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139) { + if (token() === 140) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(128)) { @@ -17200,7 +17718,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233, fullStart); + var exportDeclaration = createNode(235, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -17215,38 +17733,41 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(234, fullStart); - importEqualsDeclaration.decorators = decorators; - importEqualsDeclaration.modifiers = modifiers; - importEqualsDeclaration.name = identifier; - parseExpected(57); - importEqualsDeclaration.moduleReference = parseModuleReference(); - parseSemicolon(); - return addJSDocComment(finishNode(importEqualsDeclaration)); - } - } - var importDeclaration = createNode(235, fullStart); + if (token() !== 25 && token() !== 139) { + return parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier); + } + } + var importDeclaration = createNode(237, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || token() === 38 || token() === 16) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138); + parseExpected(139); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } + function parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier) { + var importEqualsDeclaration = createNode(236, fullStart); + importEqualsDeclaration.decorators = decorators; + importEqualsDeclaration.modifiers = modifiers; + importEqualsDeclaration.name = identifier; + parseExpected(57); + importEqualsDeclaration.moduleReference = parseModuleReference(); + parseSemicolon(); + return addJSDocComment(finishNode(importEqualsDeclaration)); + } function parseImportClause(identifier, fullStart) { - var importClause = createNode(236, fullStart); + var importClause = createNode(238, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(240); } return finishNode(importClause); } @@ -17256,7 +17777,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(245); + var node = createNode(247); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -17274,7 +17795,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(237); + var namespaceImport = createNode(239); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -17282,14 +17803,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 240 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243); + return parseImportOrExportSpecifier(245); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239); + return parseImportOrExportSpecifier(241); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -17308,23 +17829,23 @@ var ts; else { node.name = identifierName; } - if (kind === 239 && checkIdentifierIsKeyword) { + if (kind === 241 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(243, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { - parseExpected(138); + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242); - if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(138); + node.exportClause = parseNamedImportsOrExports(244); + if (token() === 139 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -17332,7 +17853,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -17351,6 +17872,7 @@ var ts; var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; + var checkJsDirective = undefined; while (true) { var kind = triviaScanner.scan(); if (kind !== 2) { @@ -17361,7 +17883,11 @@ var ts; break; } } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; + var range = { + kind: triviaScanner.getToken(), + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -17401,24 +17927,71 @@ var ts; amdDependencies.push(amdDependency); } } + var checkJsDirectiveRegEx = /^\/\/\/?\s*(@ts-check|@ts-nocheck)\s*$/gim; + var checkJsDirectiveMatchResult = checkJsDirectiveRegEx.exec(comment); + if (checkJsDirectiveMatchResult) { + checkJsDirective = { + enabled: ts.compareStrings(checkJsDirectiveMatchResult[1], "@ts-check", true) === 0, + end: range.end, + pos: range.pos + }; + } } } sourceFile.referencedFiles = referencedFiles; sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; + sourceFile.checkJsDirective = checkJsDirective; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 234 && node.moduleReference.kind === 245 - || node.kind === 235 - || node.kind === 240 - || node.kind === 241 + || node.kind === 236 && node.moduleReference.kind === 247 + || node.kind === 237 + || node.kind === 242 + || node.kind === 243 ? node : undefined; }); } + var ParsingContext; + (function (ParsingContext) { + ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements"; + ParsingContext[ParsingContext["BlockStatements"] = 1] = "BlockStatements"; + ParsingContext[ParsingContext["SwitchClauses"] = 2] = "SwitchClauses"; + ParsingContext[ParsingContext["SwitchClauseStatements"] = 3] = "SwitchClauseStatements"; + ParsingContext[ParsingContext["TypeMembers"] = 4] = "TypeMembers"; + ParsingContext[ParsingContext["ClassMembers"] = 5] = "ClassMembers"; + ParsingContext[ParsingContext["EnumMembers"] = 6] = "EnumMembers"; + ParsingContext[ParsingContext["HeritageClauseElement"] = 7] = "HeritageClauseElement"; + ParsingContext[ParsingContext["VariableDeclarations"] = 8] = "VariableDeclarations"; + ParsingContext[ParsingContext["ObjectBindingElements"] = 9] = "ObjectBindingElements"; + ParsingContext[ParsingContext["ArrayBindingElements"] = 10] = "ArrayBindingElements"; + ParsingContext[ParsingContext["ArgumentExpressions"] = 11] = "ArgumentExpressions"; + ParsingContext[ParsingContext["ObjectLiteralMembers"] = 12] = "ObjectLiteralMembers"; + ParsingContext[ParsingContext["JsxAttributes"] = 13] = "JsxAttributes"; + ParsingContext[ParsingContext["JsxChildren"] = 14] = "JsxChildren"; + ParsingContext[ParsingContext["ArrayLiteralMembers"] = 15] = "ArrayLiteralMembers"; + ParsingContext[ParsingContext["Parameters"] = 16] = "Parameters"; + ParsingContext[ParsingContext["RestProperties"] = 17] = "RestProperties"; + ParsingContext[ParsingContext["TypeParameters"] = 18] = "TypeParameters"; + ParsingContext[ParsingContext["TypeArguments"] = 19] = "TypeArguments"; + ParsingContext[ParsingContext["TupleElementTypes"] = 20] = "TupleElementTypes"; + ParsingContext[ParsingContext["HeritageClauses"] = 21] = "HeritageClauses"; + ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 22] = "ImportOrExportSpecifiers"; + ParsingContext[ParsingContext["JSDocFunctionParameters"] = 23] = "JSDocFunctionParameters"; + ParsingContext[ParsingContext["JSDocTypeArguments"] = 24] = "JSDocTypeArguments"; + ParsingContext[ParsingContext["JSDocRecordMembers"] = 25] = "JSDocRecordMembers"; + ParsingContext[ParsingContext["JSDocTupleTypes"] = 26] = "JSDocTupleTypes"; + ParsingContext[ParsingContext["Count"] = 27] = "Count"; + })(ParsingContext || (ParsingContext = {})); + var Tristate; + (function (Tristate) { + Tristate[Tristate["False"] = 0] = "False"; + Tristate[Tristate["True"] = 1] = "True"; + Tristate[Tristate["Unknown"] = 2] = "Unknown"; + })(Tristate || (Tristate = {})); var JSDocParser; (function (JSDocParser) { function isJSDocType() { @@ -17450,7 +18023,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(262, scanner.getTokenPos()); + var result = createNode(266, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -17461,12 +18034,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(266, type.pos); + var unionType = createNode(270, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(273, type.pos); + var optionalType = createNode(277, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -17477,20 +18050,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(265, type.pos); + var arrayType = createNode(269, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(268, type.pos); + var nullableType = createNode(272, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(269, type.pos); + var nonNullableType = createNode(273, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -17524,14 +18097,15 @@ var ts; case 98: return parseJSDocThisType(); case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: case 94: - case 137: + case 138: case 129: + case 133: return parseTokenNode(); case 9: case 8: @@ -17542,27 +18116,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277); + var result = createNode(281); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276); + var result = createNode(280); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275); + var result = createNode(279); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274); + var result = createNode(278); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -17575,7 +18149,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144); + var parameter = createNode(145); parameter.type = parseJSDocType(); if (parseOptional(57)) { parameter.questionToken = createNode(57); @@ -17583,7 +18157,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272); + var result = createNode(276); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -17617,24 +18191,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141, left.pos); + var result = createNode(142, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270); + var result = createNode(274); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269); + var result = createNode(273); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267); + var result = createNode(271); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -17648,7 +18222,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266); + var result = createNode(270); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -17664,12 +18238,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263); + var result = createNode(267); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288); + var result = createNode(292); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17682,11 +18256,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(264, pos); + var result = createNode(268, pos); return finishNode(result); } else { - var result = createNode(268, pos); + var result = createNode(272, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -17714,6 +18288,12 @@ var ts; return comment; } JSDocParser.parseJSDocComment = parseJSDocComment; + var JSDocState; + (function (JSDocState) { + JSDocState[JSDocState["BeginningOfLine"] = 0] = "BeginningOfLine"; + JSDocState[JSDocState["SawAsterisk"] = 1] = "SawAsterisk"; + JSDocState[JSDocState["SavingComments"] = 2] = "SavingComments"; + })(JSDocState || (JSDocState = {})); function parseJSDocCommentWorker(start, length) { var content = sourceText; start = start || 0; @@ -17771,7 +18351,7 @@ var ts; break; case 38: var asterisk = scanner.getTokenText(); - if (state === 1) { + if (state === 1 || state === 2) { state = 2; pushComment(asterisk); } @@ -17786,7 +18366,10 @@ var ts; break; case 5: var whitespace = scanner.getTokenText(); - if (state === 2 || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -17794,6 +18377,7 @@ var ts; case 1: break; default: + state = 2; pushComment(scanner.getTokenText()); break; } @@ -17826,7 +18410,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(278, start); + var result = createNode(282, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -17883,7 +18467,7 @@ var ts; } function parseTagComments(indent) { var comments = []; - var state = 1; + var state = 0; var margin; function pushComment(text) { if (!margin) { @@ -17936,7 +18520,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -17991,7 +18575,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -18002,20 +18586,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 287; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(287, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -18030,7 +18614,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286, atToken.pos); + var result = createNode(290, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -18039,7 +18623,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -18048,25 +18632,28 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285, atToken.pos); + var typedefTag = createNode(289, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70) { + while (true) { + if (rightNode.kind === 70 || !rightNode.body) { + typedefTag.name = rightNode.kind === 70 ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272) { + if (typeExpression.type.kind === 276) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_16 = jsDocTypeReference.name; - if (name_16.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -18080,7 +18667,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(291, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -18110,6 +18697,7 @@ var ts; break; case 70: canParseTag = false; + break; case 1: break; } @@ -18121,7 +18709,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(230, pos); + var jsDocNamespaceNode = createNode(232, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -18165,19 +18753,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 288; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_17 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_17) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_17.pos); - typeParameter.name = name_17; + var typeParameter = createNode(144, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -18188,7 +18776,7 @@ var ts; break; } } - var result = createNode(284, atToken.pos); + var result = createNode(288, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18480,7 +19068,7 @@ var ts; } function visitArray(array) { if (position >= array.pos && position < array.end) { - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -18502,21 +19090,31 @@ var ts; } } } + var InvalidPosition; + (function (InvalidPosition) { + InvalidPosition[InvalidPosition["Value"] = -1] = "Value"; + })(InvalidPosition || (InvalidPosition = {})); })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); var ts; (function (ts) { + var ModuleInstanceState; + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ModuleInstanceState = ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); function getModuleInstanceState(node) { - if (node.kind === 227 || node.kind === 228) { + if (node.kind === 229 || node.kind === 230) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 237 || node.kind === 236) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 231) { + else if (node.kind === 233) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -18532,7 +19130,7 @@ var ts; }); return state_1; } - else if (node.kind === 230) { + else if (node.kind === 232) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -18544,6 +19142,18 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; + var ContainerFlags; + (function (ContainerFlags) { + ContainerFlags[ContainerFlags["None"] = 0] = "None"; + ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer"; + ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; + ContainerFlags[ContainerFlags["IsControlFlowContainer"] = 4] = "IsControlFlowContainer"; + ContainerFlags[ContainerFlags["IsFunctionLike"] = 8] = "IsFunctionLike"; + ContainerFlags[ContainerFlags["IsFunctionExpression"] = 16] = "IsFunctionExpression"; + ContainerFlags[ContainerFlags["HasLocals"] = 32] = "HasLocals"; + ContainerFlags[ContainerFlags["IsInterface"] = 64] = "IsInterface"; + ContainerFlags[ContainerFlags["IsObjectLiteralOrClassExpressionMethod"] = 128] = "IsObjectLiteralOrClassExpressionMethod"; + })(ContainerFlags || (ContainerFlags = {})); var binder = createBinder(); function bindSourceFile(file, options) { ts.performance.mark("beforeBind"); @@ -18614,7 +19224,7 @@ var ts; } return bindSourceFile; function bindInStrictMode(file, opts) { - if (opts.alwaysStrict && !ts.isDeclarationFile(file)) { + if ((opts.alwaysStrict === undefined ? opts.strict : opts.alwaysStrict) && !ts.isDeclarationFile(file)) { return true; } else { @@ -18641,7 +19251,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232)) { symbol.valueDeclaration = node; } } @@ -18651,7 +19261,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -18662,46 +19272,47 @@ var ts; return node.name.text; } switch (node.kind) { - case 150: + case 151: return "__constructor"; - case 158: - case 153: - return "__call"; case 159: case 154: - return "__new"; + return "__call"; + case 160: case 155: + return "__new"; + case 156: return "__index"; - case 241: + case 243: return "__export"; - case 240: + case 242: return node.isExportEquals ? "export=" : "default"; - case 192: + case 193: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; case 1: case 4: + case 5: return node.left.name.text; case 3: return node.left.expression.name.text; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225: - case 226: + case 227: + case 228: return ts.hasModifier(node, 512) ? "default" : undefined; - case 274: + case 278: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144: - ts.Debug.assert(node.parent.kind === 274); + case 145: + ts.Debug.assert(node.parent.kind === 278); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285: + case 289: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -18724,13 +19335,16 @@ var ts; symbol = createSymbol(0, "__missing"); } else { - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0, name)); + } if (name && (includes & 788448)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { - symbol = symbolTable[name] = createSymbol(0, name); + symbolTable.set(name, symbol = createSymbol(0, name)); } else { if (node.name) { @@ -18745,7 +19359,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -18765,7 +19379,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) { + if (node.kind === 245 || (node.kind === 236 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -18773,7 +19387,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 285 && + var isJSDocTypedefInJSDocNamespace = node.kind === 289 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18828,13 +19442,13 @@ var ts; activeLabels = undefined; hasExplicitReturn = false; bindChildren(node); - node.flags &= ~64896; + node.flags &= ~1408; if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) { node.flags |= 128; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 261) { + if (node.kind === 264) { node.flags |= emitFlags; } if (isIIFE) { @@ -18910,66 +19524,72 @@ var ts; return; } switch (node.kind) { - case 210: + case 212: bindWhileStatement(node); break; - case 209: + case 211: bindDoStatement(node); break; - case 211: + case 213: bindForStatement(node); break; - case 212: - case 213: + case 214: + case 215: bindForInOrForOfStatement(node); break; - case 208: + case 210: bindIfStatement(node); break; - case 216: - case 220: + case 218: + case 222: bindReturnOrThrow(node); break; - case 215: - case 214: + case 217: + case 216: bindBreakOrContinueStatement(node); break; - case 221: + case 223: bindTryStatement(node); break; - case 218: + case 220: bindSwitchStatement(node); break; - case 232: + case 234: bindCaseBlock(node); break; - case 253: + case 256: bindCaseClause(node); break; - case 219: + case 221: bindLabeledStatement(node); break; - case 190: + case 191: bindPrefixUnaryExpressionFlow(node); break; - case 191: + case 192: bindPostfixUnaryExpressionFlow(node); break; - case 192: + case 193: bindBinaryExpressionFlow(node); break; - case 186: + case 187: bindDeleteExpressionFlow(node); break; - case 193: + case 194: bindConditionalExpressionFlow(node); break; - case 223: + case 225: bindVariableDeclarationFlow(node); break; - case 179: + case 180: bindCallExpressionFlow(node); break; + case 282: + bindJSDocComment(node); + break; + case 289: + bindJSDocTypedefTag(node); + break; default: bindEachChild(node); break; @@ -18979,15 +19599,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return isNarrowableReference(expr); - case 179: + case 180: return hasNarrowableArgument(expr); - case 183: + case 184: return isNarrowingExpression(expr.expression); - case 192: + case 193: return isNarrowingBinaryExpression(expr); - case 190: + case 191: return expr.operator === 50 && isNarrowingExpression(expr.operand); } return false; @@ -18995,7 +19615,8 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 || expr.kind === 98 || - expr.kind === 177 && isNarrowableReference(expr.expression); + expr.kind === 96 || + expr.kind === 178 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -19006,14 +19627,14 @@ var ts; } } } - if (expr.expression.kind === 177 && + if (expr.expression.kind === 178 && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; + return expr1.kind === 188 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -19034,9 +19655,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183: + case 184: return isNarrowableOperand(expr.expression); - case 192: + case 193: switch (expr.operatorToken.kind) { case 57: return isNarrowableOperand(expr.left); @@ -19130,33 +19751,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208: case 210: - case 209: - return parent.expression === node; + case 212: case 211: - case 193: + return parent.expression === node; + case 213: + case 194: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183) { + if (node.kind === 184) { node = node.expression; } - else if (node.kind === 190 && node.operator === 50) { + else if (node.kind === 191 && node.operator === 50) { node = node.operand; } else { - return node.kind === 192 && (node.operatorToken.kind === 52 || + return node.kind === 193 && (node.operatorToken.kind === 52 || node.operatorToken.kind === 53); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 || - node.parent.kind === 190 && + while (node.parent.kind === 184 || + node.parent.kind === 191 && node.parent.operator === 50) { node = node.parent; } @@ -19198,7 +19819,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 + var enclosingLabeledStatement = node.parent.kind === 221 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -19230,10 +19851,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; + if (node.kind === 215) { + bind(node.awaitModifier); + } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224) { + if (node.initializer.kind !== 226) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -19255,7 +19879,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216) { + if (node.kind === 218) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -19275,7 +19899,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -19308,7 +19932,8 @@ var ts; flowAfterCatch = currentFlow; } if (node.finallyBlock) { - addAntecedent(preFinallyLabel, preTryFlow); + var preFinallyFlow = { flags: 2048, antecedent: preTryFlow, lock: {} }; + addAntecedent(preFinallyLabel, preFinallyFlow); currentFlow = finishFlowLabel(preFinallyLabel); bind(node.finallyBlock); if (!(currentFlow.flags & 1)) { @@ -19318,6 +19943,11 @@ var ts; : unreachableFlow; } } + if (!(currentFlow.flags & 1)) { + var afterFinallyFlow = { flags: 4096, antecedent: currentFlow }; + preFinallyFlow.lock = afterFinallyFlow; + currentFlow = afterFinallyFlow; + } } else { currentFlow = finishFlowLabel(preFinallyLabel); @@ -19332,7 +19962,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 257; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -19397,13 +20027,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209) { + if (!node.statement || node.statement.kind !== 211) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 && node.operatorToken.kind === 57) { + if (node.kind === 193 && node.operatorToken.kind === 57) { bindAssignmentTargetFlow(node.left); } else { @@ -19414,10 +20044,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175) { + else if (node.kind === 176) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196) { + if (e.kind === 197) { bindAssignmentTargetFlow(e.expression); } else { @@ -19425,16 +20055,16 @@ var ts; } } } - else if (node.kind === 176) { + else if (node.kind === 177) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257) { + if (p.kind === 260) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258) { + else if (p.kind === 261) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259) { + else if (p.kind === 262) { bindAssignmentTargetFlow(p.expression); } } @@ -19490,7 +20120,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 && node.left.kind === 178) { + if (operator === 57 && node.left.kind === 179) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19501,7 +20131,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { bindAssignmentTargetFlow(node.expression); } } @@ -19534,16 +20164,31 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { + if (node.initializer || node.parent.parent.kind === 214 || node.parent.parent.kind === 215) { bindInitializedVariableFlow(node); } } + function bindJSDocComment(node) { + ts.forEachChild(node, function (n) { + if (n.kind !== 289) { + bind(n); + } + }); + } + function bindJSDocTypedefTag(node) { + ts.forEachChild(node, function (n) { + if (node.fullName && n === node.name && node.fullName.kind !== 70) { + return; + } + bind(n); + }); + } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 183) { + while (expr.kind === 184) { expr = expr.expression; } - if (expr.kind === 184 || expr.kind === 185) { + if (expr.kind === 185 || expr.kind === 186) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -19551,7 +20196,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19560,52 +20205,53 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197: - case 226: - case 229: - case 176: - case 161: - case 287: - case 270: + case 198: + case 228: + case 231: + case 177: + case 162: + case 291: + case 274: + case 253: return 1; - case 227: + case 229: return 1 | 64; - case 274: + case 278: + case 232: case 230: - case 228: - case 170: + case 171: return 1 | 32; - case 261: + case 264: return 1 | 4 | 32; - case 149: + case 150: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } - case 150: - case 225: - case 148: case 151: + case 227: + case 149: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return 1 | 4 | 32 | 8; - case 184: case 185: + case 186: return 1 | 4 | 32 | 8 | 16; - case 231: + case 233: return 4; - case 147: + case 148: return node.initializer ? 4 : 0; - case 256: - case 211: - case 212: + case 259: case 213: - case 232: + case 214: + case 215: + case 234: return 2; - case 204: + case 206: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -19621,37 +20267,38 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 230: + case 232: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261: + case 264: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197: - case 226: + case 198: + case 228: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229: + case 231: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161: - case 176: - case 227: - case 270: - case 287: + case 162: + case 177: + case 229: + case 274: + case 291: + case 253: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158: case 159: - case 153: + case 160: case 154: case 155: - case 149: - case 148: + case 156: case 150: + case 149: case 151: case 152: - case 225: - case 184: + case 153: + case 227: case 185: - case 274: - case 228: - case 170: + case 186: + case 278: + case 230: + case 171: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -19666,11 +20313,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 ? node : node.body; - if (body && (body.kind === 261 || body.kind === 231)) { + var body = node.kind === 264 ? node : node.body; + if (body && (body.kind === 264 || body.kind === 233)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 || stat.kind === 240) { + if (stat.kind === 243 || stat.kind === 242) { return true; } } @@ -19692,7 +20339,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -19712,12 +20359,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); - } - else { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + var state = declareModuleSymbol(node); + if (state !== 0) { if (node.symbol.flags & (16 | 32 | 256)) { node.symbol.constEnumOnlyModule = false; } @@ -19733,29 +20376,40 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 106639 : 0); + return state; + } function bindFunctionOrConstructorType(node) { var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { + var ElementKind; + (function (ElementKind) { + ElementKind[ElementKind["Property"] = 1] = "Property"; + ElementKind[ElementKind["Accessor"] = 2] = "Accessor"; + })(ElementKind || (ElementKind = {})); if (inStrictMode) { var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 || prop.name.kind !== 70) { + if (prop.kind === 262 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149 + var currentKind = prop.kind === 260 || prop.kind === 261 || prop.kind === 150 ? 1 : 2; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 && existingKind === 1) { @@ -19766,16 +20420,22 @@ var ts; } return bindAnonymousDeclaration(node, 4096, "__object"); } + function bindJsxAttributes(node) { + return bindAnonymousDeclaration(node, 4096, "__jsxAttributes"); + } + function bindJsxAttribute(node, symbolFlags, symbolExcludes) { + return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } function bindAnonymousDeclaration(node, symbolFlags, name) { var symbol = createSymbol(symbolFlags, name); addDeclarationToSymbol(symbol, node, symbolFlags); } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230: + case 232: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261: + case 264: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -19865,8 +20525,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 261 && - blockScopeContainer.kind !== 230 && + if (blockScopeContainer.kind !== 264 && + blockScopeContainer.kind !== 232 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -19874,7 +20534,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.isOctalLiteral) { + if (inStrictMode && node.numericLiteralFlags & 4) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -19908,8 +20568,11 @@ var ts; } node.parent = parent; var saveInStrictMode = inStrictMode; + if (ts.isInJavaScriptFile(node)) { + bindJSDocTypedefTagIfAny(node); + } bindWorker(node); - if (node.kind > 140) { + if (node.kind > 141) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -19926,6 +20589,26 @@ var ts; } inStrictMode = saveInStrictMode; } + function bindJSDocTypedefTagIfAny(node) { + if (!node.jsDoc) { + return; + } + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (!jsDoc.tags) { + continue; + } + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { + var tag = _c[_b]; + if (tag.kind === 289) { + var savedParent = parent; + parent = jsDoc; + bind(tag); + parent = savedParent; + } + } + } + } function updateStrictModeStatementList(statements) { if (!inStrictMode) { for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { @@ -19949,90 +20632,88 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285) { + while (parentNode && parentNode.kind !== 289) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 261)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177: + case 178: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192: - if (ts.isInJavaScriptFile(node)) { - var specialKind = ts.getSpecialPropertyAssignmentKind(node); - switch (specialKind) { - case 1: - bindExportsPropertyAssignment(node); - break; - case 2: - bindModuleExportsAssignment(node); - break; - case 3: - bindPrototypePropertyAssignment(node); - break; - case 4: - bindThisPropertyAssignment(node); - break; - case 0: - break; - default: - ts.Debug.fail("Unknown special property assignment kind"); - } + case 193: + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1: + bindExportsPropertyAssignment(node); + break; + case 2: + bindModuleExportsAssignment(node); + break; + case 3: + bindPrototypePropertyAssignment(node); + break; + case 4: + bindThisPropertyAssignment(node); + break; + case 5: + bindStaticPropertyAssignment(node); + break; + case 0: + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 256: + case 259: return checkStrictModeCatchClause(node); - case 186: + case 187: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 191: + case 192: return checkStrictModePostfixUnaryExpression(node); - case 190: + case 191: return checkStrictModePrefixUnaryExpression(node); - case 217: + case 219: return checkStrictModeWithStatement(node); - case 167: + case 168: seenThisKeyword = true; return; - case 156: + case 157: return checkTypePredicate(node); - case 143: - return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: + return declareSymbolAndAddToSymbolTable(node, 262144, 530920); + case 145: return bindParameter(node); - case 223: - case 174: - if (node.dotDotDotToken && node.parent.kind === 172) { - emitFlags |= 32768; - } + case 225: + case 175: return bindVariableDeclarationOrBindingElement(node); + case 148: case 147: - case 146: - case 271: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 286: + case 275: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0); + case 290: return bindJSDocProperty(node); - case 257: - case 258: - return bindPropertyOrMethodOrAccessor(node, 4, 0); case 260: + case 261: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 263: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 259: - case 251: + case 262: + case 254: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 && - root.parent.kind === 192 && + if (root.kind === 177 && + root.parent.kind === 193 && root.parent.operatorToken.kind === 57 && root.parent.left === root) { hasRest = true; @@ -20040,80 +20721,83 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 : 16384; return; - case 153: case 154: case 155: + case 156: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 150: case 149: - case 148: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 225: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 67108864 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); + case 227: return bindFunctionDeclaration(node); - case 150: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 151: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 152: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 153: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 158: case 159: - case 274: + case 160: + case 278: return bindFunctionOrConstructorType(node); - case 161: - case 170: - case 287: - case 270: + case 162: + case 171: + case 291: + case 274: return bindAnonymousDeclaration(node, 2048, "__type"); - case 176: + case 177: return bindObjectLiteralExpression(node); - case 184: case 185: + case 186: return bindFunctionExpression(node); - case 179: + case 180: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 197: - case 226: + case 198: + case 228: inStrictMode = true; return bindClassLikeDeclaration(node); - case 227: + case 229: return bindBlockScopedDeclaration(node, 64, 792968); - case 285: + case 289: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 228: + case 230: return bindBlockScopedDeclaration(node, 524288, 793064); - case 229: + case 231: return bindEnumDeclaration(node); - case 230: + case 232: return bindModuleDeclaration(node); - case 234: - case 237: + case 253: + return bindJsxAttributes(node); + case 252: + return bindJsxAttribute(node, 4, 0); + case 236: case 239: - case 243: + case 241: + case 245: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 233: + case 235: return bindNamespaceExportDeclaration(node); - case 236: + case 238: return bindImportClause(node); - case 241: + case 243: return bindExportDeclaration(node); - case 240: + case 242: return bindExportAssignment(node); - case 261: + case 264: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204: + case 206: if (!ts.isFunctionLike(node.parent)) { return; } - case 231: + case 233: return updateStrictModeStatementList(node.statements); } } @@ -20122,7 +20806,7 @@ var ts; if (parameterName && parameterName.kind === 70) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167) { + if (parameterName && parameterName.kind === 168) { seenThisKeyword = true; } bind(type); @@ -20141,7 +20825,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -20151,17 +20835,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261) { + if (node.parent.kind !== 264) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20171,10 +20855,10 @@ var ts; } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { - bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); + bindAnonymousDeclaration(node, 33554432, getDeclarationName(node)); } else if (!node.exportClause) { - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); + declareSymbol(container.symbol.exports, container.symbol, node, 33554432, 0); } } function bindImportClause(node) { @@ -20194,24 +20878,56 @@ var ts; setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); } + function isExportsOrModuleExportsOrAlias(node) { + return ts.isExportsIdentifier(node) || + ts.isModuleExportsPropertyAccessExpression(node) || + isNameOfExportsOrModuleExportsAliasDeclaration(node); + } + function isNameOfExportsOrModuleExportsAliasDeclaration(node) { + if (node.kind === 70) { + var symbol = lookupSymbolForName(node.text); + if (symbol && symbol.valueDeclaration && symbol.valueDeclaration.kind === 225) { + var declaration = symbol.valueDeclaration; + if (declaration.initializer) { + return isExportsOrModuleExportsOrAliasOrAssignemnt(declaration.initializer); + } + } + } + return false; + } + function isExportsOrModuleExportsOrAliasOrAssignemnt(node) { + return isExportsOrModuleExportsOrAlias(node) || + (ts.isAssignmentExpression(node, true) && (isExportsOrModuleExportsOrAliasOrAssignemnt(node.left) || isExportsOrModuleExportsOrAliasOrAssignemnt(node.right))); + } function bindModuleExportsAssignment(node) { + var assignedExpression = ts.getRightMostAssignedExpression(node.right); + if (ts.isEmptyObjectLiteral(assignedExpression) || isExportsOrModuleExportsOrAlias(assignedExpression)) { + setCommonJsModuleIndicator(node); + return; + } setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 225 || container.kind === 184) { - container.symbol.members = container.symbol.members || ts.createMap(); - declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); - } - else if (container.kind === 150) { - var saveContainer = container; - container = container.parent; - var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0); - if (symbol) { - symbol.isReplaceableByMethod = true; - } - container = saveContainer; + var container = ts.getThisContainer(node, false); + switch (container.kind) { + case 227: + case 185: + container.symbol.members = container.symbol.members || ts.createMap(); + declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); + break; + case 151: + case 148: + case 150: + case 152: + case 153: + var containingClass = container.parent; + var symbol = declareSymbol(ts.hasModifier(container, 32) ? containingClass.symbol.exports : containingClass.symbol.members, containingClass.symbol, node, 4, 0); + if (symbol) { + symbol.isReplaceableByMethod = true; + } + break; } } function bindPrototypePropertyAssignment(node) { @@ -20221,14 +20937,35 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; - if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { - return; + bindPropertyAssignment(constructorFunction.text, leftSideOfAssignment, true); + } + function bindStaticPropertyAssignment(node) { + var leftSideOfAssignment = node.left; + var target = leftSideOfAssignment.expression; + leftSideOfAssignment.parent = node; + target.parent = leftSideOfAssignment; + if (isNameOfExportsOrModuleExportsAliasDeclaration(target)) { + bindExportsPropertyAssignment(node); } - if (!funcSymbol.members) { - funcSymbol.members = ts.createMap(); + else { + bindPropertyAssignment(target.text, leftSideOfAssignment, false); } - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 0); + } + function lookupSymbolForName(name) { + return (container.symbol && container.symbol.exports && container.symbol.exports.get(name)) || (container.locals && container.locals.get(name)); + } + function bindPropertyAssignment(functionName, propertyAccessExpression, isPrototypeProperty) { + var targetSymbol = lookupSymbolForName(functionName); + if (targetSymbol && ts.isDeclarationOfFunctionOrClassExpression(targetSymbol)) { + targetSymbol = targetSymbol.valueDeclaration.initializer.symbol; + } + if (!targetSymbol || !(targetSymbol.flags & (16 | 32))) { + return; + } + var symbolTable = isPrototypeProperty ? + (targetSymbol.members || (targetSymbol.members = ts.createMap())) : + (targetSymbol.exports || (targetSymbol.exports = ts.createMap())); + declareSymbol(symbolTable, targetSymbol, propertyAccessExpression, 4, 0); } function bindCallExpression(node) { if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) { @@ -20236,33 +20973,26 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; - } - } - if (node.kind === 226) { + if (node.kind === 228) { bindBlockScopedDeclaration(node, 32, 899519); } else { var bindingName = node.name ? node.name.text : "__class"; bindAnonymousDeclaration(node, 32, bindingName); if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; - var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var prototypeSymbol = createSymbol(4 | 16777216, "prototype"); + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -20287,11 +21017,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 | 4096); - } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -20303,13 +21028,13 @@ var ts; } if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 536870912 : 0), 0); + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 67108864 : 0), 0); } } function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } checkStrictModeFunctionName(node); @@ -20323,8 +21048,8 @@ var ts; } function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } if (currentFlow) { @@ -20336,11 +21061,8 @@ var ts; } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -20362,15 +21084,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) || - node.kind === 226 || - (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 208) || + node.kind === 228 || + (node.kind === 232 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 || + (node.kind !== 207 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -20384,56 +21106,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179: - return computeCallExpression(node, subtreeFlags); case 180: + return computeCallExpression(node, subtreeFlags); + case 181: return computeNewExpression(node, subtreeFlags); - case 230: + case 232: return computeModuleDeclaration(node, subtreeFlags); - case 183: + case 184: return computeParenthesizedExpression(node, subtreeFlags); - case 192: + case 193: return computeBinaryExpression(node, subtreeFlags); - case 207: + case 209: return computeExpressionStatement(node, subtreeFlags); - case 144: + case 145: return computeParameter(node, subtreeFlags); - case 185: + case 186: return computeArrowFunction(node, subtreeFlags); - case 184: + case 185: return computeFunctionExpression(node, subtreeFlags); - case 225: + case 227: return computeFunctionDeclaration(node, subtreeFlags); - case 223: + case 225: return computeVariableDeclaration(node, subtreeFlags); - case 224: + case 226: return computeVariableDeclarationList(node, subtreeFlags); - case 205: + case 207: return computeVariableStatement(node, subtreeFlags); - case 219: + case 221: return computeLabeledStatement(node, subtreeFlags); - case 226: + case 228: return computeClassDeclaration(node, subtreeFlags); - case 197: + case 198: return computeClassExpression(node, subtreeFlags); - case 255: + case 258: return computeHeritageClause(node, subtreeFlags); - case 256: + case 259: return computeCatchClause(node, subtreeFlags); - case 199: + case 200: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150: + case 151: return computeConstructor(node, subtreeFlags); - case 147: + case 148: return computePropertyDeclaration(node, subtreeFlags); - case 149: + case 150: return computeMethod(node, subtreeFlags); - case 151: case 152: + case 153: return computeAccessor(node, subtreeFlags); - case 234: + case 236: return computeImportEquals(node, subtreeFlags); - case 177: + case 178: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -20458,8 +21180,8 @@ var ts; switch (kind) { case 96: return true; - case 177: case 178: + case 179: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96; @@ -20481,10 +21203,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 && leftKind === 176) { + if (operatorTokenKind === 57 && leftKind === 177) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 57 && leftKind === 175) { + else if (operatorTokenKind === 57 && leftKind === 176) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 @@ -20523,8 +21245,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 200 - || expressionKind === 182) { + if (expressionKind === 201 + || expressionKind === 183) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -20621,9 +21343,9 @@ var ts; transformFlags |= 8; } if (ts.hasModifier(node, 256)) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; @@ -20666,7 +21388,7 @@ var ts; transformFlags |= 3; } if (modifierFlags & 256) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } if (subtreeFlags & 1048576) { transformFlags |= 8; @@ -20674,7 +21396,7 @@ var ts; if (subtreeFlags & 163840) { transformFlags |= 192; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } } @@ -20689,7 +21411,7 @@ var ts; transformFlags |= 3; } if (ts.hasModifier(node, 256)) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } if (subtreeFlags & 1048576) { transformFlags |= 8; @@ -20697,7 +21419,7 @@ var ts; if (subtreeFlags & 163840) { transformFlags |= 192; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; @@ -20810,8 +21532,8 @@ var ts; var excludeFlags = 536872257; switch (kind) { case 119: - case 189: - transformFlags |= 16; + case 190: + transformFlags |= 8 | 16; break; case 113: case 111: @@ -20819,50 +21541,66 @@ var ts; case 116: case 123: case 75: - case 229: - case 260: - case 182: - case 200: + case 231: + case 263: + case 183: case 201: + case 202: case 130: transformFlags |= 3; break; - case 246: - case 247: case 248: - case 10: case 249: case 250: + case 10: case 251: case 252: + case 253: + case 254: + case 255: transformFlags |= 4; break; - case 213: - transformFlags |= 8; case 12: case 13: case 14: case 15: - case 194: - case 181: - case 258: + case 195: + case 182: + case 261: case 114: + case 203: transformFlags |= 192; break; - case 195: - transformFlags |= 192 | 16777216; + case 9: + if (node.hasExtendedUnicodeEscape) { + transformFlags |= 192; + } + break; + case 8: + if (node.numericLiteralFlags & 48) { + transformFlags |= 192; + } + break; + case 215: + if (node.awaitModifier) { + transformFlags |= 8; + } + transformFlags |= 192; + break; + case 196: + transformFlags |= 8 | 192 | 16777216; break; case 118: case 132: case 129: - case 134: - case 121: + case 133: case 135: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: case 156: @@ -20876,26 +21614,27 @@ var ts; case 164: case 165: case 166: - case 227: - case 228: case 167: + case 229: + case 230: case 168: case 169: case 170: case 171: + case 172: transformFlags = 3; excludeFlags = -3; break; - case 142: + case 143: transformFlags |= 2097152; if (subtreeFlags & 16384) { transformFlags |= 65536; } break; - case 196: + case 197: transformFlags |= 192 | 524288; break; - case 259: + case 262: transformFlags |= 8 | 1048576; break; case 96: @@ -20904,27 +21643,27 @@ var ts; case 98: transformFlags |= 16384; break; - case 172: + case 173: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 537396545; break; - case 173: + case 174: transformFlags |= 192 | 8388608; excludeFlags = 537396545; break; - case 174: + case 175: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; } break; - case 145: + case 146: transformFlags |= 3 | 4096; break; - case 176: + case 177: excludeFlags = 540087617; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -20936,29 +21675,29 @@ var ts; transformFlags |= 8; } break; - case 175: - case 180: + case 176: + case 181: excludeFlags = 537396545; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 209: - case 210: case 211: case 212: + case 213: + case 214: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 261: + case 264: if (subtreeFlags & 32768) { transformFlags |= 192; } break; + case 218: case 216: - case 214: - case 215: + case 217: transformFlags |= 33554432; break; } @@ -20966,56 +21705,57 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 && kind <= 171) { + if (kind >= 157 && kind <= 172) { return -3; } switch (kind) { - case 179: case 180: - case 175: + case 181: + case 176: return 537396545; - case 230: + case 232: return 574674241; - case 144: + case 145: return 536872257; - case 185: + case 186: return 601249089; - case 184: - case 225: + case 185: + case 227: return 601281857; - case 224: - return 546309441; case 226: - case 197: + return 546309441; + case 228: + case 198: return 539358529; - case 150: - return 601015617; - case 149: case 151: + return 601015617; + case 150: case 152: + case 153: return 601015617; case 118: case 132: case 129: - case 134: - case 121: case 135: + case 133: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: - case 227: - case 228: + case 156: + case 229: + case 230: return -3; - case 176: + case 177: return 540087617; - case 256: + case 259: return 537920833; - case 172: case 173: + case 174: return 537396545; default: return 536872257; @@ -21048,23 +21788,29 @@ var ts; ts.getSymbolId = getSymbolId; function createTypeChecker(host, produceDiagnostics) { var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; var symbolCount = 0; + var symbolInstantiationDepth = 0; var emptyArray = []; var emptySymbols = ts.createMap(); var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); var modulekind = ts.getEmitModuleKind(compilerOptions); var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters; var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; - var strictNullChecks = compilerOptions.strictNullChecks; + var strictNullChecks = compilerOptions.strictNullChecks === undefined ? compilerOptions.strict : compilerOptions.strictNullChecks; + var noImplicitAny = compilerOptions.noImplicitAny === undefined ? compilerOptions.strict : compilerOptions.noImplicitAny; + var noImplicitThis = compilerOptions.noImplicitThis === undefined ? compilerOptions.strict : compilerOptions.noImplicitThis; var emitResolver = createResolver(); - var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var nodeBuilder = createNodeBuilder(); + var undefinedSymbol = createSymbol(4, "undefined"); undefinedSymbol.declarations = []; - var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); + var argumentsSymbol = createSymbol(4, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, @@ -21073,47 +21819,127 @@ var ts; isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, + getMergedSymbol: getMergedSymbol, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, - getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, + getTypeOfSymbolAtLocation: function (symbol, location) { + location = ts.getParseTreeNode(location); + return location ? getTypeOfSymbolAtLocation(symbol, location) : unknownType; + }, + getSymbolsOfParameterPropertyDeclaration: function (parameter, parameterName) { + parameter = ts.getParseTreeNode(parameter, ts.isParameter); + ts.Debug.assert(parameter !== undefined, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); + return getSymbolsOfParameterPropertyDeclaration(parameter, parameterName); + }, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getBaseTypeOfLiteralType: getBaseTypeOfLiteralType, + getWidenedType: getWidenedType, + getTypeFromTypeNode: function (node) { + node = ts.getParseTreeNode(node, ts.isTypeNode); + return node ? getTypeFromTypeNode(node) : unknownType; + }, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, - getSymbolsInScope: getSymbolsInScope, - getSymbolAtLocation: getSymbolAtLocation, - getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, - getTypeAtLocation: getTypeOfNode, - getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, - typeToString: typeToString, + typeToTypeNode: nodeBuilder.typeToTypeNode, + indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, + signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, + getSymbolsInScope: function (location, meaning) { + location = ts.getParseTreeNode(location); + return location ? getSymbolsInScope(location, meaning) : []; + }, + getSymbolAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getSymbolAtLocation(node) : undefined; + }, + getShorthandAssignmentValueSymbol: function (node) { + node = ts.getParseTreeNode(node); + return node ? getShorthandAssignmentValueSymbol(node) : undefined; + }, + getExportSpecifierLocalTargetSymbol: function (node) { + node = ts.getParseTreeNode(node, ts.isExportSpecifier); + return node ? getExportSpecifierLocalTargetSymbol(node) : undefined; + }, + getTypeAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getTypeOfNode(node) : unknownType; + }, + getPropertySymbolOfDestructuringAssignment: function (location) { + location = ts.getParseTreeNode(location, ts.isIdentifier); + return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; + }, + signatureToString: function (signature, enclosingDeclaration, flags, kind) { + return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind); + }, + typeToString: function (type, enclosingDeclaration, flags) { + return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags); + }, getSymbolDisplayBuilder: getSymbolDisplayBuilder, - symbolToString: symbolToString, + symbolToString: function (symbol, enclosingDeclaration, meaning) { + return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning); + }, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: function (node) { + node = ts.getParseTreeNode(node, ts.isExpression); + return node ? getContextualType(node) : undefined; + }, getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: getResolvedSignature, - getConstantValue: getConstantValue, - isValidPropertyAccess: isValidPropertyAccess, - getSignatureFromDeclaration: getSignatureFromDeclaration, - isImplementationOfOverload: isImplementationOfOverload, + getResolvedSignature: function (node, candidatesOutArray) { + node = ts.getParseTreeNode(node, ts.isCallLikeExpression); + return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + }, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, + isValidPropertyAccess: function (node, propertyName) { + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + return node ? isValidPropertyAccess(node, propertyName) : false; + }, + getSignatureFromDeclaration: function (declaration) { + declaration = ts.getParseTreeNode(declaration, ts.isFunctionLike); + return declaration ? getSignatureFromDeclaration(declaration) : undefined; + }, + isImplementationOfOverload: function (node) { + node = ts.getParseTreeNode(node, ts.isFunctionLike); + return node ? isImplementationOfOverload(node) : undefined; + }, + getImmediateAliasedSymbol: function (symbol) { + ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.immediateTarget) { + var node = getDeclarationOfAliasSymbol(symbol); + ts.Debug.assert(!!node); + links.immediateTarget = getTargetOfAliasDeclaration(node, true); + } + return links.immediateTarget; + }, getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, - getJsxElementAttributesType: getJsxElementAttributesType, + getAllAttributesTypeFromJsxOpeningLikeElement: function (node) { + node = ts.getParseTreeNode(node, ts.isJsxOpeningLikeElement); + return node ? getAllAttributesTypeFromJsxOpeningLikeElement(node) : undefined; + }, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, - isOptionalParameter: isOptionalParameter, + isOptionalParameter: function (node) { + node = ts.getParseTreeNode(node, ts.isParameter); + return node ? isOptionalParameter(node) : false; + }, tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -21122,8 +21948,8 @@ var ts; var numericLiteralTypes = ts.createMap(); var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; - var unknownSymbol = createSymbol(4 | 67108864, "unknown"); - var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var unknownSymbol = createSymbol(4, "unknown"); + var resolvingSymbol = createSymbol(0, "__resolving__"); var anyType = createIntrinsicType(1, "any"); var autoType = createIntrinsicType(1, "any"); var unknownType = createIntrinsicType(1, "unknown"); @@ -21140,8 +21966,9 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); + var nonPrimitiveType = createIntrinsicType(16777216, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); + var emptyTypeLiteralSymbol = createSymbol(2048, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -21149,16 +21976,15 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, undefined, 0, false, false); var enumNumberIndexInfo = createIndexInfo(stringType, true); + var jsObjectLiteralIndexInfo = createIndexInfo(anyType, false); var globals = ts.createMap(); var patternAmbientModules; - var getGlobalESSymbolConstructorSymbol; - var getGlobalPromiseConstructorSymbol; - var tryGetGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -21167,26 +21993,26 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var globalThisType; var anyArrayType; var autoArrayType; var anyReadonlyArrayType; - var getGlobalTemplateStringsArrayType; - var getGlobalESSymbolType; - var getGlobalIterableType; - var getGlobalIteratorType; - var getGlobalIterableIteratorType; - var getGlobalClassDecoratorType; - var getGlobalParameterDecoratorType; - var getGlobalPropertyDecoratorType; - var getGlobalMethodDecoratorType; - var getGlobalTypedPropertyDescriptorType; - var getGlobalPromiseType; - var tryGetGlobalPromiseType; - var getGlobalPromiseLikeType; - var getInstantiatedGlobalPromiseLikeType; - var getGlobalPromiseConstructorLikeType; - var getGlobalThenableType; - var jsxElementClassType; + var deferredGlobalESSymbolConstructorSymbol; + var deferredGlobalESSymbolType; + var deferredGlobalTypedPropertyDescriptorType; + var deferredGlobalPromiseType; + var deferredGlobalPromiseConstructorSymbol; + var deferredGlobalPromiseConstructorLikeType; + var deferredGlobalIterableType; + var deferredGlobalIteratorType; + var deferredGlobalIterableIteratorType; + var deferredGlobalAsyncIterableType; + var deferredGlobalAsyncIteratorType; + var deferredGlobalAsyncIterableIteratorType; + var deferredGlobalTemplateStringsArrayType; + var deferredJsxElementClassType; + var deferredJsxElementType; + var deferredJsxStatelessElementType; var deferredNodes; var deferredUnusedIdentifierNodes; var flowLoopStart = 0; @@ -21207,9 +22033,70 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var typeofEQFacts = ts.createMap({ + var TypeFacts; + (function (TypeFacts) { + TypeFacts[TypeFacts["None"] = 0] = "None"; + TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString"; + TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber"; + TypeFacts[TypeFacts["TypeofEQBoolean"] = 4] = "TypeofEQBoolean"; + TypeFacts[TypeFacts["TypeofEQSymbol"] = 8] = "TypeofEQSymbol"; + TypeFacts[TypeFacts["TypeofEQObject"] = 16] = "TypeofEQObject"; + TypeFacts[TypeFacts["TypeofEQFunction"] = 32] = "TypeofEQFunction"; + TypeFacts[TypeFacts["TypeofEQHostObject"] = 64] = "TypeofEQHostObject"; + TypeFacts[TypeFacts["TypeofNEString"] = 128] = "TypeofNEString"; + TypeFacts[TypeFacts["TypeofNENumber"] = 256] = "TypeofNENumber"; + TypeFacts[TypeFacts["TypeofNEBoolean"] = 512] = "TypeofNEBoolean"; + TypeFacts[TypeFacts["TypeofNESymbol"] = 1024] = "TypeofNESymbol"; + TypeFacts[TypeFacts["TypeofNEObject"] = 2048] = "TypeofNEObject"; + TypeFacts[TypeFacts["TypeofNEFunction"] = 4096] = "TypeofNEFunction"; + TypeFacts[TypeFacts["TypeofNEHostObject"] = 8192] = "TypeofNEHostObject"; + TypeFacts[TypeFacts["EQUndefined"] = 16384] = "EQUndefined"; + TypeFacts[TypeFacts["EQNull"] = 32768] = "EQNull"; + TypeFacts[TypeFacts["EQUndefinedOrNull"] = 65536] = "EQUndefinedOrNull"; + TypeFacts[TypeFacts["NEUndefined"] = 131072] = "NEUndefined"; + TypeFacts[TypeFacts["NENull"] = 262144] = "NENull"; + TypeFacts[TypeFacts["NEUndefinedOrNull"] = 524288] = "NEUndefinedOrNull"; + TypeFacts[TypeFacts["Truthy"] = 1048576] = "Truthy"; + TypeFacts[TypeFacts["Falsy"] = 2097152] = "Falsy"; + TypeFacts[TypeFacts["Discriminatable"] = 4194304] = "Discriminatable"; + TypeFacts[TypeFacts["All"] = 8388607] = "All"; + TypeFacts[TypeFacts["BaseStringStrictFacts"] = 933633] = "BaseStringStrictFacts"; + TypeFacts[TypeFacts["BaseStringFacts"] = 3145473] = "BaseStringFacts"; + TypeFacts[TypeFacts["StringStrictFacts"] = 4079361] = "StringStrictFacts"; + TypeFacts[TypeFacts["StringFacts"] = 4194049] = "StringFacts"; + TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 3030785] = "EmptyStringStrictFacts"; + TypeFacts[TypeFacts["EmptyStringFacts"] = 3145473] = "EmptyStringFacts"; + TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 1982209] = "NonEmptyStringStrictFacts"; + TypeFacts[TypeFacts["NonEmptyStringFacts"] = 4194049] = "NonEmptyStringFacts"; + TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 933506] = "BaseNumberStrictFacts"; + TypeFacts[TypeFacts["BaseNumberFacts"] = 3145346] = "BaseNumberFacts"; + TypeFacts[TypeFacts["NumberStrictFacts"] = 4079234] = "NumberStrictFacts"; + TypeFacts[TypeFacts["NumberFacts"] = 4193922] = "NumberFacts"; + TypeFacts[TypeFacts["ZeroStrictFacts"] = 3030658] = "ZeroStrictFacts"; + TypeFacts[TypeFacts["ZeroFacts"] = 3145346] = "ZeroFacts"; + TypeFacts[TypeFacts["NonZeroStrictFacts"] = 1982082] = "NonZeroStrictFacts"; + TypeFacts[TypeFacts["NonZeroFacts"] = 4193922] = "NonZeroFacts"; + TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 933252] = "BaseBooleanStrictFacts"; + TypeFacts[TypeFacts["BaseBooleanFacts"] = 3145092] = "BaseBooleanFacts"; + TypeFacts[TypeFacts["BooleanStrictFacts"] = 4078980] = "BooleanStrictFacts"; + TypeFacts[TypeFacts["BooleanFacts"] = 4193668] = "BooleanFacts"; + TypeFacts[TypeFacts["FalseStrictFacts"] = 3030404] = "FalseStrictFacts"; + TypeFacts[TypeFacts["FalseFacts"] = 3145092] = "FalseFacts"; + TypeFacts[TypeFacts["TrueStrictFacts"] = 1981828] = "TrueStrictFacts"; + TypeFacts[TypeFacts["TrueFacts"] = 4193668] = "TrueFacts"; + TypeFacts[TypeFacts["SymbolStrictFacts"] = 1981320] = "SymbolStrictFacts"; + TypeFacts[TypeFacts["SymbolFacts"] = 4193160] = "SymbolFacts"; + TypeFacts[TypeFacts["ObjectStrictFacts"] = 6166480] = "ObjectStrictFacts"; + TypeFacts[TypeFacts["ObjectFacts"] = 8378320] = "ObjectFacts"; + TypeFacts[TypeFacts["FunctionStrictFacts"] = 6164448] = "FunctionStrictFacts"; + TypeFacts[TypeFacts["FunctionFacts"] = 8376288] = "FunctionFacts"; + TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; + TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; + })(TypeFacts || (TypeFacts = {})); + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1, "number": 2, "boolean": 4, @@ -21218,7 +22105,7 @@ var ts; "object": 16, "function": 32 }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128, "number": 256, "boolean": 512, @@ -21227,14 +22114,14 @@ var ts; "object": 2048, "function": 4096 }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, "symbol": esSymbolType, "undefined": undefinedType }); - var jsxElementType; + var typeofType = createTypeofType(); var _jsxNamespace; var _jsxFactoryEntity; var jsxTypes = ts.createMap(); @@ -21253,8 +22140,21 @@ var ts; var identityRelation = ts.createMap(); var enumRelation = ts.createMap(); var _displayBuilder; + var TypeSystemPropertyName; + (function (TypeSystemPropertyName) { + TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType"; + TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; + })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); + var CheckMode; + (function (CheckMode) { + CheckMode[CheckMode["Normal"] = 0] = "Normal"; + CheckMode[CheckMode["SkipContextSensitive"] = 1] = "SkipContextSensitive"; + CheckMode[CheckMode["Inferential"] = 2] = "Inferential"; + })(CheckMode || (CheckMode = {})); var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -21284,7 +22184,12 @@ var ts; } function createSymbol(flags, name) { symbolCount++; - return new Symbol(flags, name); + var symbol = (new Symbol(flags | 134217728, name)); + symbol.checkFlags = 0; + return symbol; + } + function isTransientSymbol(symbol) { + return (symbol.flags & 134217728) !== 0; } function getExcludedSymbolFlags(flags) { var result = 0; @@ -21330,7 +22235,7 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 33554432, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) @@ -21352,12 +22257,10 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { + (target.valueDeclaration.kind === 232 && source.valueDeclaration.kind !== 232))) { target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -21370,6 +22273,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -21382,18 +22288,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { - if (!(targetSymbol.flags & 33554432)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + if (!(targetSymbol.flags & 134217728)) { + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -21414,7 +22321,7 @@ var ts; } mainModule = resolveExternalModuleSymbol(mainModule); if (mainModule.flags & 1920) { - mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule); + mainModule = mainModule.flags & 134217728 ? mainModule : cloneSymbol(mainModule); mergeSymbol(mainModule, moduleAugmentation.symbol); } else { @@ -21423,20 +22330,21 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } } function getSymbolLinks(symbol) { - if (symbol.flags & 67108864) + if (symbol.flags & 134217728) return symbol; var id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}); @@ -21448,14 +22356,17 @@ var ts; function getObjectFlags(type) { return type.flags & 32768 ? type.objectFlags : 0; } + function getCheckFlags(symbol) { + return symbol.flags & 134217728 ? symbol.checkFlags : 0; + } function isGlobalSourceFile(node) { - return node.kind === 261 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 264 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } @@ -21486,57 +22397,76 @@ var ts; (!compilerOptions.outFile && !compilerOptions.out)) { return true; } - if (isUsedInFunctionOrNonStaticProperty(usage)) { + if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { return true; } var sourceFiles = host.getSourceFiles(); return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 223 || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 175) { + var errorBindingElement = ts.getAncestor(usage, 175); + if (errorBindingElement) { + return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || + declaration.pos < errorBindingElement.pos; + } + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225), usage); + } + else if (declaration.kind === 225) { + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; + } + if (usage.parent.kind === 245) { + return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); - return isUsedInFunctionOrNonStaticProperty(usage, container); + return isInTypeQuery(usage) || isUsedInFunctionOrInstanceProperty(usage, declaration, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205: - case 211: + case 207: case 213: + case 215: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 212: - case 213: + case 214: + case 215: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } } return false; } - function isUsedInFunctionOrNonStaticProperty(usage, container) { - var current = usage; - while (current) { + function isUsedInFunctionOrInstanceProperty(usage, declaration, container) { + return !!ts.findAncestor(usage, function (current) { if (current === container) { - return false; + return "quit"; } if (ts.isFunctionLike(current)) { return true; } - var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 && - (ts.getModifierFlags(current.parent) & 32) === 0 && + var initializerOfProperty = current.parent && + current.parent.kind === 148 && current.parent.initializer === current; - if (initializerOfNonStaticProperty) { - return true; + if (initializerOfProperty) { + if (ts.getModifierFlags(current.parent) & 32) { + if (declaration.kind === 150) { + return true; + } + } + else { + var isDeclarationInstanceProperty = declaration.kind === 148 && !(ts.getModifierFlags(declaration) & 32); + if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { + return true; + } + } } - current = current.parent; - } - return false; + }); } } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { @@ -21551,18 +22481,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 282) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 144 || - lastLocation.kind === 143 + lastLocation.kind === 145 || + lastLocation.kind === 144 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 144 || + lastLocation.kind === 145 || (lastLocation === location.type && - result.valueDeclaration.kind === 144); + result.valueDeclaration.kind === 145); } } if (useResult) { @@ -21574,23 +22504,24 @@ var ts; } } switch (location.kind) { - case 261: + case 264: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230: + case 232: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 || ts.isAmbientModule(location)) { - if (result = moduleExports["default"]) { + if (location.kind === 264 || ts.isAmbientModule(location)) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; } - if (moduleExports[name] && - moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 243)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 && + ts.getDeclarationOfKind(moduleExport, 245)) { break; } } @@ -21598,13 +22529,13 @@ var ts; break loop; } break; - case 229: + case 231: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 148: case 147: - case 146: if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -21614,17 +22545,21 @@ var ts; } } break; - case 226: - case 197: - case 227: + case 228: + case 198: + case 229: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { + if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { + result = undefined; + break; + } if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } break loop; } - if (location.kind === 197 && meaning & 32) { + if (location.kind === 198 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -21632,28 +22567,28 @@ var ts; } } break; - case 142: + case 143: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 225: - case 185: + case 153: + case 227: + case 186: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184: + case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -21666,8 +22601,8 @@ var ts; } } break; - case 145: - if (location.parent && location.parent.kind === 144) { + case 146: + if (location.parent && location.parent.kind === 145) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -21690,7 +22625,8 @@ var ts; !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && - !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { + !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && + !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } } @@ -21702,21 +22638,31 @@ var ts; error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } - if (meaning & 2) { + if (meaning & 2 || + ((meaning & 32 || meaning & 384) && (meaning & 107455) === 107455)) { var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); - if (exportOrLocalSymbol.flags & 2) { + if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233) { + if (decls && decls.length === 1 && decls[0].kind === 235) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } } return result; } + function isTypeParameterSymbolDeclaredInContainer(symbol, container) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.kind === 144 && decl.parent === container) { + return true; + } + } + return false; + } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { if ((errorLocation.kind === 70 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { return false; @@ -21757,9 +22703,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70: - case 177: + case 178: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199: + case 200: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -21786,65 +22732,84 @@ var ts; } return false; } - function checkResolvedBlockScopedVariable(result, errorLocation) { - ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); - } - } - function isSameScopeDescendentOf(initial, parent, stopAt) { - if (!parent) { - return false; + function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { + if (meaning & (107455 & ~1024 & ~793064)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~107455, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, name); + return true; + } } - for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { - if (current === parent) { + else if (meaning & (793064 & ~1024 & ~107455)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~793064, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, name); return true; } } return false; } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384)); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 231) ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + if (result.flags & 2) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 32) { + error(errorLocation, ts.Diagnostics.Class_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 384) { + error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + return parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent; }); + } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234) { + if (node.kind === 236) { return node; } - while (node && node.kind !== 235) { - node = node.parent; - } - return node; + return ts.findAncestor(node, function (n) { return n.kind === 237; }); } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } - function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245) { + function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { + if (node.moduleReference.kind === 247) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } - return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); } - function getTargetOfImportClause(node) { + function getTargetOfImportClause(node, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default"), dontResolveAlias); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { - return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } return exportDefaultSymbol; } } - function getTargetOfNamespaceImport(node) { + function getTargetOfNamespaceImport(node, dontResolveAlias) { var moduleSpecifier = node.parent.parent.moduleSpecifier; - return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); + return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier, dontResolveAlias); } function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { if (valueSymbol.flags & (793064 | 1920)) { @@ -21861,12 +22826,9 @@ var ts; result.exports = valueSymbol.exports; return result; } - function getExportOfModule(symbol, name) { + function getExportOfModule(symbol, name, dontResolveAlias) { if (symbol.flags & 1536) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; - if (exportedSymbol) { - return resolveSymbol(exportedSymbol); - } + return resolveSymbol(getExportsOfSymbol(symbol).get(name), dontResolveAlias); } } function getPropertyOfVariable(symbol, name) { @@ -21877,71 +22839,72 @@ var ts; } } } - function getExternalModuleMember(node, specifier) { + function getExternalModuleMember(node, specifier, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); + var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier, dontResolveAlias); if (targetSymbol) { - var name_18 = specifier.propertyName || specifier.name; - if (name_18.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } - symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_18.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") { - symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); + var symbolFromModule = getExportOfModule(targetSymbol, name.text, dontResolveAlias); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { + symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } } } - function getTargetOfImportSpecifier(node) { - return getExternalModuleMember(node.parent.parent.parent, node); + function getTargetOfImportSpecifier(node, dontResolveAlias) { + return getExternalModuleMember(node.parent.parent.parent, node, dontResolveAlias); } - function getTargetOfNamespaceExportDeclaration(node) { - return resolveExternalModuleSymbol(node.parent.symbol); + function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) { + return resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias); } - function getTargetOfExportSpecifier(node) { + function getTargetOfExportSpecifier(node, dontResolveAlias) { return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920); + getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : + resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920, false, dontResolveAlias); } - function getTargetOfExportAssignment(node) { - return resolveEntityName(node.expression, 107455 | 793064 | 1920); + function getTargetOfExportAssignment(node, dontResolveAlias) { + return resolveEntityName(node.expression, 107455 | 793064 | 1920, false, dontResolveAlias); } - function getTargetOfAliasDeclaration(node) { + function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 234: - return getTargetOfImportEqualsDeclaration(node); case 236: - return getTargetOfImportClause(node); - case 237: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); + case 238: + return getTargetOfImportClause(node, dontRecursivelyResolve); case 239: - return getTargetOfImportSpecifier(node); - case 243: - return getTargetOfExportSpecifier(node); - case 240: - return getTargetOfExportAssignment(node); - case 233: - return getTargetOfNamespaceExportDeclaration(node); + return getTargetOfNamespaceImport(node, dontRecursivelyResolve); + case 241: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 245: + return getTargetOfExportSpecifier(node, dontRecursivelyResolve); + case 242: + return getTargetOfExportAssignment(node, dontRecursivelyResolve); + case 235: + return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } - function resolveSymbol(symbol) { - return symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)) ? resolveAlias(symbol) : symbol; + function resolveSymbol(symbol, dontResolveAlias) { + var shouldResolve = !dontResolveAlias && symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)); + return shouldResolve ? resolveAlias(symbol) : symbol; } function resolveAlias(symbol) { ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); @@ -21980,10 +22943,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240) { + if (node.kind === 242) { checkExpressionCached(node.expression); } - else if (node.kind === 243) { + else if (node.kind === 245) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21995,11 +22958,11 @@ var ts; if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 70 || entityName.parent.kind === 141) { + if (entityName.kind === 70 || entityName.parent.kind === 142) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 234); + ts.Debug.assert(entityName.parent.kind === 236); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -22018,9 +22981,19 @@ var ts; return undefined; } } - else if (name.kind === 141 || name.kind === 177) { - var left = name.kind === 141 ? name.left : name.expression; - var right = name.kind === 141 ? name.right : name.name; + else if (name.kind === 142 || name.kind === 178) { + var left = void 0; + if (name.kind === 142) { + left = name.left; + } + else if (name.kind === 178 && + (name.expression.kind === 184 || ts.isEntityNameExpression(name.expression))) { + left = name.expression; + } + else { + return undefined; + } + var right = name.kind === 142 ? name.right : name.name; var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -22036,10 +23009,15 @@ var ts; return undefined; } } + else if (name.kind === 184) { + return ts.isEntityNameExpression(name.expression) ? + resolveEntityName(name.expression, meaning, ignoreErrors, dontResolveAlias, location) : + undefined; + } else { ts.Debug.fail("Unknown entity name kind."); } - ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { @@ -22047,7 +23025,7 @@ var ts; } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { if (isForAugmentation === void 0) { isForAugmentation = false; } - if (moduleReferenceExpression.kind !== 9) { + if (moduleReferenceExpression.kind !== 9 && moduleReferenceExpression.kind !== 12) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -22084,11 +23062,10 @@ var ts; } if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } - else if (compilerOptions.noImplicitAny && moduleNotFoundError) { + else if (noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); } return undefined; @@ -22110,27 +23087,35 @@ var ts; } return undefined; } - function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias)) || moduleSymbol; } - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { - var symbol = resolveExternalModuleSymbol(moduleSymbol); - if (symbol && !(symbol.flags & (1536 | 3))) { + function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); + if (!dontResolveAlias && symbol && !(symbol.flags & (1536 | 3))) { error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -22141,24 +23126,28 @@ var ts; return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -22170,26 +23159,26 @@ var ts; } visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -22211,22 +23200,13 @@ var ts; : symbol; } function symbolIsValue(symbol) { - if (symbol.flags & 16777216) { - return symbolIsValue(getSymbolLinks(symbol).target); - } - if (symbol.flags & 107455) { - return true; - } - if (symbol.flags & 8388608) { - return (resolveAlias(symbol).flags & 107455) !== 0; - } - return false; + return !!(symbol.flags & 107455 || symbol.flags & 8388608 && resolveAlias(symbol).flags & 107455); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 && ts.nodeIsPresent(member.body)) { return member; } } @@ -22254,6 +23234,9 @@ var ts; type.symbol = symbol; return type; } + function createTypeofType() { + return getUnionType(ts.convertToArray(typeofEQFacts.keys(), function (s) { return getLiteralTypeForText(32, s); })); + } function isReservedMemberName(name) { return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && @@ -22262,16 +23245,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -22290,19 +23272,19 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 261: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 264: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -22315,6 +23297,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { return true; @@ -22328,26 +23320,28 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + if (isAccessible(symbols.get(symbol.name))) { + return [symbol]; + } + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -22358,14 +23352,14 @@ var ts; function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { return false; } if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -22379,10 +23373,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147: - case 149: - case 151: + case 148: + case 150: case 152: + case 153: continue; default: return false; @@ -22430,15 +23424,12 @@ var ts; } return { accessibility: 0 }; function getExternalModuleContainer(declaration) { - for (; declaration; declaration = declaration.parent) { - if (hasExternalModuleSymbol(declaration)) { - return getSymbolOfNode(declaration); - } - } + var node = ts.findAncestor(declaration, hasExternalModuleSymbol); + return node && getSymbolOfNode(node); } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 264 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22472,11 +23463,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 234) { + else if (entityName.kind === 142 || entityName.kind === 178 || + entityName.parent.kind === 236) { meaning = 1920; } else { @@ -22524,6 +23515,483 @@ var ts; } return result; } + function createNodeBuilder() { + var context; + return { + typeToTypeNode: function (type, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = typeToTypeNodeHelper(type); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + indexInfoToIndexSignatureDeclaration: function (indexInfo, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + signatureToSignatureDeclaration: function (signature, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = signatureToSignatureDeclarationHelper(signature, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + } + }; + function createNodeBuilderContext(enclosingDeclaration, flags) { + return { + enclosingDeclaration: enclosingDeclaration, + flags: flags, + encounteredError: false, + inObjectTypeLiteral: false, + checkAlias: true, + symbolStack: undefined + }; + } + function typeToTypeNodeHelper(type) { + if (!type) { + context.encounteredError = true; + return undefined; + } + if (type.flags & 1) { + return ts.createKeywordTypeNode(118); + } + if (type.flags & 2) { + return ts.createKeywordTypeNode(135); + } + if (type.flags & 4) { + return ts.createKeywordTypeNode(132); + } + if (type.flags & 8) { + return ts.createKeywordTypeNode(121); + } + if (type.flags & 16) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & (32)) { + return ts.createLiteralTypeNode((ts.createLiteral(type.text))); + } + if (type.flags & (64)) { + return ts.createLiteralTypeNode((ts.createNumericLiteral(type.text))); + } + if (type.flags & 128) { + return type.intrinsicName === "true" ? ts.createTrue() : ts.createFalse(); + } + if (type.flags & 256) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & 1024) { + return ts.createKeywordTypeNode(104); + } + if (type.flags & 2048) { + return ts.createKeywordTypeNode(138); + } + if (type.flags & 4096) { + return ts.createKeywordTypeNode(94); + } + if (type.flags & 8192) { + return ts.createKeywordTypeNode(129); + } + if (type.flags & 512) { + return ts.createKeywordTypeNode(136); + } + if (type.flags & 16777216) { + return ts.createKeywordTypeNode(133); + } + if (type.flags & 16384 && type.isThisType) { + if (context.inObjectTypeLiteral) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowThisInObjectLiteral)) { + context.encounteredError = true; + } + } + return ts.createThis(); + } + var objectFlags = getObjectFlags(type); + if (objectFlags & 4) { + ts.Debug.assert(!!(type.flags & 32768)); + return typeReferenceToTypeNode(type); + } + if (objectFlags & 3) { + ts.Debug.assert(!!(type.flags & 32768)); + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & 16384) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (context.checkAlias && type.aliasSymbol) { + var name = symbolToName(type.aliasSymbol, false); + var typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments); + return ts.createTypeReferenceNode(name, typeArgumentNodes); + } + context.checkAlias = false; + if (type.flags & 65536) { + var formattedUnionTypes = formatUnionTypes(type.types); + var unionTypeNodes = formattedUnionTypes && mapToTypeNodeArray(formattedUnionTypes); + if (unionTypeNodes && unionTypeNodes.length > 0) { + return ts.createUnionOrIntersectionTypeNode(165, unionTypeNodes); + } + else { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyUnionOrIntersection)) { + context.encounteredError = true; + } + return undefined; + } + } + if (type.flags & 131072) { + return ts.createUnionOrIntersectionTypeNode(166, mapToTypeNodeArray(type.types)); + } + if (objectFlags & (16 | 32)) { + ts.Debug.assert(!!(type.flags & 32768)); + return createAnonymousTypeNode(type); + } + if (type.flags & 262144) { + var indexedType = type.type; + var indexTypeNode = typeToTypeNodeHelper(indexedType); + return ts.createTypeOperatorNode(indexTypeNode); + } + if (type.flags & 524288) { + var objectTypeNode = typeToTypeNodeHelper(type.objectType); + var indexTypeNode = typeToTypeNodeHelper(type.indexType); + return ts.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); + } + ts.Debug.fail("Should be unreachable."); + function mapToTypeNodeArray(types) { + var result = []; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type_1 = types_1[_i]; + var typeNode = typeToTypeNodeHelper(type_1); + if (typeNode) { + result.push(typeNode); + } + } + return result; + } + function createMappedTypeNodeFromType(type) { + ts.Debug.assert(!!(type.flags & 32768)); + var typeParameter = getTypeParameterFromMappedType(type); + var typeParameterNode = typeParameterToDeclaration(typeParameter); + var templateType = getTemplateTypeFromMappedType(type); + var templateTypeNode = typeToTypeNodeHelper(templateType); + var readonlyToken = type.declaration && type.declaration.readonlyToken ? ts.createToken(130) : undefined; + var questionToken = type.declaration && type.declaration.questionToken ? ts.createToken(54) : undefined; + return ts.createMappedTypeNode(readonlyToken, typeParameterNode, questionToken, templateTypeNode); + } + function createAnonymousTypeNode(type) { + var symbol = type.symbol; + if (symbol) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512) || + shouldWriteTypeOfFunctionSymbol()) { + return createTypeQueryNodeFromSymbol(symbol); + } + else if (ts.contains(context.symbolStack, symbol)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + var entityName = symbolToName(typeAlias, false); + return ts.createTypeReferenceNode(entityName, undefined); + } + else { + return ts.createKeywordTypeNode(118); + } + } + else { + if (!context.symbolStack) { + context.symbolStack = []; + } + context.symbolStack.push(symbol); + var result = createTypeNodeFromObjectType(type); + context.symbolStack.pop(); + return result; + } + } + else { + return createTypeNodeFromObjectType(type); + } + function shouldWriteTypeOfFunctionSymbol() { + var isStaticMethodSymbol = !!(symbol.flags & 8192 && + ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32; })); + var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && + (symbol.parent || + ts.forEach(symbol.declarations, function (declaration) { + return declaration.parent.kind === 264 || declaration.parent.kind === 233; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return ts.contains(context.symbolStack, symbol); + } + } + } + function createTypeNodeFromObjectType(type) { + if (type.objectFlags & 32) { + if (getConstraintTypeFromMappedType(type).flags & (16384 | 262144)) { + return createMappedTypeNodeFromType(type); + } + } + var resolved = resolveStructuredTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + return ts.createTypeLiteralNode(undefined); + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + var signature = resolved.callSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 159); + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + var signature = resolved.constructSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 160); + } + } + var saveInObjectTypeLiteral = context.inObjectTypeLiteral; + context.inObjectTypeLiteral = true; + var members = createTypeNodesFromResolvedType(resolved); + context.inObjectTypeLiteral = saveInObjectTypeLiteral; + return ts.createTypeLiteralNode(members); + } + function createTypeQueryNodeFromSymbol(symbol) { + var entityName = symbolToName(symbol, false); + return ts.createTypeQueryNode(entityName); + } + function typeReferenceToTypeNode(type) { + var typeArguments = type.typeArguments || emptyArray; + if (type.target === globalArrayType) { + var elementType = typeToTypeNodeHelper(typeArguments[0]); + return ts.createArrayTypeNode(elementType); + } + else if (type.target.objectFlags & 8) { + if (typeArguments.length > 0) { + var tupleConstituentNodes = mapToTypeNodeArray(typeArguments.slice(0, getTypeReferenceArity(type))); + if (tupleConstituentNodes && tupleConstituentNodes.length > 0) { + return ts.createTupleTypeNode(tupleConstituentNodes); + } + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyTuple)) { + context.encounteredError = true; + } + return undefined; + } + else { + var outerTypeParameters = type.target.outerTypeParameters; + var i = 0; + var qualifiedName = undefined; + if (outerTypeParameters) { + var length_1 = outerTypeParameters.length; + while (i < length_1) { + var start = i; + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + do { + i++; + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { + var qualifiedNamePart = symbolToName(parent, true); + if (!qualifiedName) { + qualifiedName = ts.createQualifiedName(qualifiedNamePart, undefined); + } + else { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = qualifiedNamePart; + qualifiedName = ts.createQualifiedName(qualifiedName, undefined); + } + } + } + } + var entityName = undefined; + var nameIdentifier = symbolToName(type.symbol, true); + if (qualifiedName) { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = nameIdentifier; + entityName = qualifiedName; + } + else { + entityName = nameIdentifier; + } + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + var typeArgumentNodes = ts.some(typeArguments) ? mapToTypeNodeArray(typeArguments.slice(i, typeParameterCount - i)) : undefined; + return ts.createTypeReferenceNode(entityName, typeArgumentNodes); + } + } + function createTypeNodesFromResolvedType(resolvedType) { + var typeElements = []; + for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 154)); + } + for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 155)); + } + if (resolvedType.stringIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.stringIndexInfo, 0)); + } + if (resolvedType.numberIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.numberIndexInfo, 1)); + } + var properties = resolvedType.properties; + if (!properties) { + return typeElements; + } + for (var _d = 0, properties_2 = properties; _d < properties_2.length; _d++) { + var propertySymbol = properties_2[_d]; + var propertyType = getTypeOfSymbol(propertySymbol); + var oldDeclaration = propertySymbol.declarations && propertySymbol.declarations[0]; + if (!oldDeclaration) { + return; + } + var propertyName = oldDeclaration.name; + var optionalToken = propertySymbol.flags & 67108864 ? ts.createToken(54) : undefined; + if (propertySymbol.flags & (16 | 8192) && !getPropertiesOfObjectType(propertyType).length) { + var signatures = getSignaturesOfType(propertyType, 0); + for (var _e = 0, signatures_1 = signatures; _e < signatures_1.length; _e++) { + var signature = signatures_1[_e]; + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 149); + methodDeclaration.name = propertyName; + methodDeclaration.questionToken = optionalToken; + typeElements.push(methodDeclaration); + } + } + else { + var propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType) : ts.createKeywordTypeNode(118); + typeElements.push(ts.createPropertySignature(propertyName, optionalToken, propertyTypeNode, undefined)); + } + } + return typeElements.length ? typeElements : undefined; + } + } + function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind) { + var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 ? 135 : 132); + var name = ts.getNameFromIndexInfo(indexInfo); + var indexingParameter = ts.createParameter(undefined, undefined, undefined, name, undefined, indexerTypeNode, undefined); + var typeNode = typeToTypeNodeHelper(indexInfo.type); + return ts.createIndexSignatureDeclaration(undefined, indexInfo.isReadonly ? [ts.createToken(130)] : undefined, [indexingParameter], typeNode); + } + function signatureToSignatureDeclarationHelper(signature, kind) { + var typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter); }); + var returnTypeNode; + if (signature.typePredicate) { + var typePredicate = signature.typePredicate; + var parameterName = typePredicate.kind === 1 ? ts.createIdentifier(typePredicate.parameterName) : ts.createThisTypeNode(); + var typeNode = typeToTypeNodeHelper(typePredicate.type); + returnTypeNode = ts.createTypePredicateNode(parameterName, typeNode); + } + else { + var returnType = getReturnTypeOfSignature(signature); + returnTypeNode = returnType && typeToTypeNodeHelper(returnType); + } + var returnTypeNodeExceptAny = returnTypeNode && returnTypeNode.kind !== 118 ? returnTypeNode : undefined; + return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNodeExceptAny); + } + function typeParameterToDeclaration(type) { + var constraint = getConstraintFromTypeParameter(type); + var constraintNode = constraint && typeToTypeNodeHelper(constraint); + var defaultParameter = getDefaultFromTypeParameter(type); + var defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter); + var name = symbolToName(type.symbol, true); + return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); + } + function symbolToParameterDeclaration(parameterSymbol) { + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 145); + var parameterType = getTypeOfSymbol(parameterSymbol); + var parameterTypeNode = typeToTypeNodeHelper(parameterType); + var parameterNode = ts.createParameter(parameterDeclaration.decorators, parameterDeclaration.modifiers, parameterDeclaration.dotDotDotToken && ts.createToken(23), ts.getSynthesizedClone(parameterDeclaration.name), parameterDeclaration.questionToken && ts.createToken(54), parameterTypeNode, parameterDeclaration.initializer); + return parameterNode; + } + function symbolToName(symbol, expectsIdentifier) { + var chain; + var isTypeParameter = symbol.flags & 262144; + if (!isTypeParameter && context.enclosingDeclaration) { + chain = getSymbolChain(symbol, 0, true); + ts.Debug.assert(chain && chain.length > 0); + } + else { + chain = [symbol]; + } + if (expectsIdentifier && chain.length !== 1 + && !context.encounteredError + && !(context.flags & ts.NodeBuilderFlags.allowQualifedNameInPlaceOfIdentifier)) { + context.encounteredError = true; + } + return createEntityNameFromSymbolChain(chain, chain.length - 1); + function createEntityNameFromSymbolChain(chain, index) { + ts.Debug.assert(chain && 0 <= index && index < chain.length); + var symbol = chain[index]; + var typeParameterString = ""; + if (index > 0) { + var parentSymbol = chain[index - 1]; + var typeParameters = void 0; + if (getCheckFlags(symbol) & 1) { + typeParameters = getTypeParametersOfClassOrInterface(parentSymbol); + } + else { + var targetSymbol = getTargetSymbol(parentSymbol); + if (targetSymbol.flags & (32 | 64 | 524288)) { + typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + } + } + if (typeParameters && typeParameters.length > 0) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowTypeParameterInQualifiedName)) { + context.encounteredError = true; + } + var writer = ts.getSingleLineStringWriter(); + var displayBuilder = getSymbolDisplayBuilder(); + displayBuilder.buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, context.enclosingDeclaration, 0); + typeParameterString = writer.string(); + ts.releaseStringWriter(writer); + } + } + var symbolName = getNameOfSymbol(symbol); + var symbolNameWithTypeParameters = typeParameterString.length > 0 ? symbolName + "<" + typeParameterString + ">" : symbolName; + var identifier = ts.createIdentifier(symbolNameWithTypeParameters); + return index > 0 ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier; + } + function getSymbolChain(symbol, meaning, endOfChain) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, false); + var parentSymbol; + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + var parentChain = getSymbolChain(parent, getQualifiedLeftMeaning(meaning), false); + if (parentChain) { + parentSymbol = parent; + accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [symbol]); + } + } + } + if (accessibleSymbolChain) { + return accessibleSymbolChain; + } + if (endOfChain || + !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) && + !(symbol.flags & (2048 | 4096))) { + return [symbol]; + } + } + function getNameOfSymbol(symbol) { + var declaration = ts.firstOrUndefined(symbol.declarations); + if (declaration) { + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225) { + return ts.declarationNameToString(declaration.parent.name); + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowAnonymousIdentifier)) { + context.encounteredError = true; + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; + } + } + return symbol.name; + } + } + } function typePredicateToString(typePredicate, enclosingDeclaration, flags) { var writer = ts.getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); @@ -22567,11 +24035,8 @@ var ts; } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { - var node = type.symbol.declarations[0].parent; - while (node.kind === 166) { - node = node.parent; - } - if (node.kind === 228) { + var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 167; }); + if (node.kind === 230) { return getSymbolOfNode(node); } } @@ -22579,29 +24044,32 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 && + node.parent.kind === 233 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197: - return "(Anonymous class)"; - case 184: - case 185: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225) { + return ts.declarationNameToString(declaration.parent.name); + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } @@ -22629,7 +24097,7 @@ var ts; function appendParentTypeArgumentsAndSymbolName(symbol) { if (parentSymbol) { if (flags & 1) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { @@ -22648,9 +24116,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22680,7 +24148,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { var nextFlags = flags & ~512; - if (type.flags & 16015) { + if (type.flags & 16793231) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -22705,7 +24173,7 @@ var ts; else if (!(flags & 512) && type.aliasSymbol && isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) { var typeArguments = type.aliasTypeArguments; - writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); + writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, ts.length(typeArguments), nextFlags); } else if (type.flags & 196608) { writeUnionOrIntersectionType(type, nextFlags); @@ -22780,15 +24248,15 @@ var ts; var outerTypeParameters = type.target.outerTypeParameters; var i = 0; if (outerTypeParameters) { - var length_1 = outerTypeParameters.length; - while (i < length_1) { + var length_2 = outerTypeParameters.length; + while (i < length_2) { var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22814,7 +24282,8 @@ var ts; function writeAnonymousType(type, flags) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & (32 | 384 | 512)) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -22847,7 +24316,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 || declaration.parent.kind === 231; + return declaration.parent.kind === 264 || declaration.parent.kind === 233; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -22860,32 +24329,13 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130); - writeSpace(writer); - } - writePunctuation(writer, 20); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21); - writePunctuation(writer, 55); - writeSpace(writer); - writeType(info.type, 0); - writePunctuation(writer, 24); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130); writeSpace(writer); } buildSymbolDisplay(prop, writer); - if (prop.flags & 536870912) { + if (prop.flags & 67108864) { writePunctuation(writer, 54); } } @@ -22961,15 +24411,15 @@ var ts; writePunctuation(writer, 24); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134); - writeIndexSignature(resolved.numberIndexInfo, 132); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { - var signature = signatures_1[_f]; + for (var _f = 0, signatures_2 = signatures; _f < signatures_2.length; _f++) { + var signature = signatures_2[_f]; writePropertyWithModifiers(p); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); writePunctuation(writer, 24); @@ -23028,32 +24478,43 @@ var ts; writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } + var defaultType = getDefaultFromTypeParameter(tp); + if (defaultType) { + writeSpace(writer); + writePunctuation(writer, 57); + writeSpace(writer); + buildTypeDisplay(defaultType, writer, enclosingDeclaration, flags, symbolStack); + } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; - if (ts.isRestParameter(parameterNode)) { + if (parameterNode ? ts.isRestParameter(parameterNode) : isTransientSymbol(p) && p.isRestParameter) { writePunctuation(writer, 23); } - if (ts.isBindingPattern(parameterNode.name)) { + if (parameterNode && ts.isBindingPattern(parameterNode.name)) { buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); } else { appendSymbolNameOnly(p, writer); } - if (isOptionalParameter(parameterNode)) { + if (parameterNode && isOptionalParameter(parameterNode)) { writePunctuation(writer, 54); } writePunctuation(writer, 55); writeSpace(writer); - buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); + var type = getTypeOfSymbol(p); + if (parameterNode && isRequiredInitializedParameter(parameterNode)) { + type = includeFalsyTypes(type, 2048); + } + buildTypeDisplay(type, writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { writePunctuation(writer, 16); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { writePunctuation(writer, 20); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -23067,9 +24528,9 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174); + ts.Debug.assert(bindingElement.kind === 175); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); writeSpace(writer); } @@ -23141,6 +24602,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 && isTypeAny(returnType)) { + return; + } if (flags & 8) { writeSpace(writer); writePunctuation(writer, 35); @@ -23153,7 +24618,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -23171,6 +24635,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130); + writeSpace(writer); + } + writePunctuation(writer, 20); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55); + writeSpace(writer); + switch (kind) { + case 1: + writeKeyword(writer, 132); + break; + case 0: + writeKeyword(writer, 135); + break; + } + writePunctuation(writer, 21); + writePunctuation(writer, 55); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -23181,6 +24671,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -23195,63 +24686,63 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174: + case 175: return isDeclarationVisible(node.parent.parent); - case 223: + case 225: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 230: - case 226: - case 227: + case 232: case 228: - case 225: case 229: - case 234: + case 230: + case 227: + case 231: + case 236: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 236 && parent.kind !== 264 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent); + case 148: case 147: - case 146: - case 151: case 152: + case 153: + case 150: case 149: - case 148: if (ts.getModifierFlags(node) & (8 | 16)) { return false; } - case 150: - case 154: - case 153: + case 151: case 155: - case 144: - case 231: - case 158: + case 154: + case 156: + case 145: + case 233: case 159: - case 161: - case 157: + case 160: case 162: + case 158: case 163: case 164: case 165: case 166: + case 167: return isDeclarationVisible(node.parent); - case 236: - case 237: + case 238: case 239: + case 241: return false; - case 143: - case 261: - case 233: + case 144: + case 264: + case 235: return true; - case 240: + case 242: return false; default: return false; @@ -23260,10 +24751,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240) { + if (node.parent && node.parent.kind === 242) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243) { + else if (node.parent.kind === 245) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -23295,8 +24786,8 @@ var ts; function pushTypeResolution(target, propertyName) { var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); if (resolutionCycleStartIndex >= 0) { - var length_2 = resolutionTargets.length; - for (var i = resolutionCycleStartIndex; i < length_2; i++) { + var length_3 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_3; i++) { resolutionResults[i] = false; } return false; @@ -23338,21 +24829,20 @@ var ts; return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = ts.getRootDeclaration(node); - while (node) { + node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 223: - case 224: + case 225: + case 226: + case 241: + case 240: case 239: case 238: - case 237: - case 236: - node = node.parent; - break; + return false; default: - return node.parent; + return true; } - } + }); + return node && node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); @@ -23365,32 +24855,34 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192) !== 0; - } function getTypeForBindingElementParent(node) { var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144); }); + if (source.flags & 8192) { + return emptyObjectType; + } + if (source.flags & 65536) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); - for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_19 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_19)] = true; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var name = properties_3[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16); - var isMethod = prop.flags & 8192; var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0); @@ -23410,9 +24902,9 @@ var ts; return parentType; } var type; - if (pattern.kind === 172) { + if (pattern.kind === 173) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } @@ -23426,25 +24918,25 @@ var ts; type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_20 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_20)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } } else { - var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); + var elementType = checkIteratedTypeOrElementType(parentType, pattern, false, false); if (declaration.dotDotDotToken) { type = createArrayType(elementType); } @@ -23471,7 +24963,7 @@ var ts; getUnionType([type, checkExpressionCached(declaration.initializer)], true) : type; } - function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + function getTypeForDeclarationFromJSDocComment(declaration) { var jsdocType = ts.getJSDocType(declaration); if (jsdocType) { return getTypeFromTypeNode(jsdocType); @@ -23484,33 +24976,35 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 && expr.elements.length === 0; + return expr.kind === 176 && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152) { - var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (declaration.flags & 65536) { + var type = getTypeForDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } - if (declaration.parent.parent.kind === 212) { + if (declaration.parent.parent.kind === 214) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213) { - return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; + if (declaration.parent.parent.kind === 215) { + var forOfStatement = declaration.parent.parent; + return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); + var declaredType = getTypeFromTypeNode(declaration.type); + return addOptionality(declaredType, declaration.questionToken && includeOptionality); } - if ((compilerOptions.noImplicitAny || declaration.flags & 2097152) && - declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + if ((noImplicitAny || declaration.flags & 65536) && + declaration.kind === 225 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23519,10 +25013,10 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var func = declaration.parent; - if (func.kind === 152 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151); + if (func.kind === 153 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -23548,7 +25042,10 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 258) { + if (ts.isJsxAttribute(declaration)) { + return trueType; + } + if (declaration.kind === 261) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -23556,6 +25053,37 @@ var ts; } return undefined; } + function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol) { + var types = []; + var definedInConstructor = false; + var definedInMethod = false; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var expression = declaration.kind === 193 ? declaration : + declaration.kind === 178 ? ts.getAncestor(declaration, 193) : + undefined; + if (!expression) { + return unknownType; + } + if (ts.isPropertyAccessExpression(expression.left) && expression.left.expression.kind === 98) { + if (ts.getThisContainer(expression, false).kind === 151) { + definedInConstructor = true; + } + else { + definedInMethod = true; + } + } + if (expression.flags & 65536) { + var type = getTypeForDeclarationFromJSDocComment(expression.parent); + if (type && type !== unknownType) { + types.push(getWidenedType(type)); + continue; + } + } + types.push(getWidenedLiteralType(checkExpressionCached(expression.right))); + } + return getWidenedType(addOptionality(getUnionType(types, true), definedInMethod && !definedInConstructor)); + } function getTypeFromBindingElement(element, includePatternInType, reportErrors) { if (element.initializer) { return checkDeclarationInitializer(element); @@ -23563,28 +25091,33 @@ var ts; if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); } - if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + if (reportErrors && noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAnyError(element, anyType); } return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { + if (isComputedNonLiteralName(name)) { hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, false); + return; + } var text = ts.getTextOfPropertyName(name); - var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); + var flags = 4 | (e.initializer ? 67108864 : 0); var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -23608,7 +25141,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 + return pattern.kind === 173 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -23618,13 +25151,13 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 257) { + if (declaration.kind === 260) { return type; } return getWidenedType(type); } type = declaration.dotDotDotToken ? anyArrayType : anyType; - if (reportErrors && compilerOptions.noImplicitAny) { + if (reportErrors && noImplicitAny) { if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } @@ -23633,56 +25166,38 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 ? root.parent : root; + var memberDeclaration = root.kind === 145 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.flags & 134217728) { + if (symbol.flags & 16777216) { return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 240) { + if (declaration.kind === 242) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 && declaration.kind === 286 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 290 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = void 0; - if (declaration.kind === 192 || - declaration.kind === 177 && declaration.parent.kind === 192) { - if (declaration.flags & 2097152) { - var jsdocType = ts.getJSDocType(declaration.parent); - if (jsdocType) { - return links.type = getTypeFromTypeNode(jsdocType); - } - } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? - checkExpressionCached(decl.right) : - checkExpressionCached(decl.parent.right); }); - type = getUnionType(declaredTypes, true); + if (declaration.kind === 193 || + declaration.kind === 178 && declaration.parent.kind === 193) { + type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else { type = getWidenedTypeForVariableLikeDeclaration(declaration, true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -23690,7 +25205,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151) { + if (accessor.kind === 152) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -23710,10 +25225,10 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151); - var setter = ts.getDeclarationOfKind(symbol, 152); - if (getter && getter.flags & 2097152) { - var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + var getter = ts.getDeclarationOfKind(symbol, 152); + var setter = ts.getDeclarationOfKind(symbol, 153); + if (getter && getter.flags & 65536) { + var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; } @@ -23736,7 +25251,7 @@ var ts; type = getReturnTypeFromBody(getter); } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { if (setter) { error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); } @@ -23751,8 +25266,8 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151); + if (noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 152); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -23760,6 +25275,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -23768,8 +25287,13 @@ var ts; } else { var type = createObjectType(16, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 ? - includeFalsyTypes(type, 2048) : type; + if (symbol.flags & 32) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 67108864 ? includeFalsyTypes(type, 2048) : type; + } } } return links.type; @@ -23794,12 +25318,37 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (symbolInstantiationDepth === 100) { + error(symbol.valueDeclaration, ts.Diagnostics.Generic_type_instantiation_is_excessively_deep_and_possibly_infinite); + links.type = unknownType; + } + else { + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + symbolInstantiationDepth++; + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + symbolInstantiationDepth--; + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; + } } return links.type; } + function reportCircularityError(symbol) { + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + if (noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { return getTypeOfInstantiatedSymbol(symbol); } if (symbol.flags & (3 | 4)) { @@ -23819,19 +25368,30 @@ var ts; } return unknownType; } + function isReferenceToType(type, target) { + return type !== undefined + && target !== undefined + && (getObjectFlags(type) & 4) !== 0 + && type.target === target; + } function getTargetType(type) { return getObjectFlags(type) & 4 ? type.target : type; } function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 | 4)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072) { + return ts.forEach(type.types, check); + } } } function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { - var declaration = declarations_2[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -23848,9 +25408,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 || node.kind === 197 || - node.kind === 225 || node.kind === 184 || - node.kind === 149 || node.kind === 185) { + if (node.kind === 228 || node.kind === 198 || + node.kind === 227 || node.kind === 185 || + node.kind === 150 || node.kind === 186) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -23859,15 +25419,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 || node.kind === 226 || - node.kind === 197 || node.kind === 228) { + if (node.kind === 229 || node.kind === 228 || + node.kind === 198 || node.kind === 230) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -23879,18 +25439,34 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1).length > 0) { + return true; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type); + return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); } - function getConstructorsForTypeArguments(type, typeArgumentNodes) { - var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; - return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; }); + function getConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var typeArgCount = ts.length(typeArgumentNodes); + var isJavaScript = ts.isInJavaScriptFile(location); + return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (isJavaScript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts.length(sig.typeParameters); }); } - function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { - var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); + function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location); if (typeArgumentNodes) { var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); @@ -23907,14 +25483,14 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); return type.resolvedBaseConstructorType = unknownType; } - if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { + if (!(baseConstructorType.flags & 1) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); return type.resolvedBaseConstructorType = unknownType; } @@ -23943,8 +25519,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 | 131072 | 1))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -23954,8 +25530,11 @@ var ts; areAllOuterTypeParametersApplied(originalBaseType)) { baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } + else if (baseConstructorType.flags & 1) { + baseType = baseConstructorType; + } else { - var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -23972,7 +25551,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -23996,16 +25575,20 @@ var ts; } return true; } + function isValidBaseType(type) { + return type.flags & (32768 | 16777216 | 1) && !isGenericMappedType(type) || + type.flags & 131072 && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -24029,7 +25612,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227) { + if (declaration.kind === 229) { if (declaration.flags & 64) { return false; } @@ -24062,7 +25645,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -24079,7 +25662,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285); + var declaration = ts.getDeclarationOfKind(symbol, 289); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24090,7 +25673,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228); + declaration = ts.getDeclarationOfKind(symbol, 230); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -24098,7 +25681,7 @@ var ts; if (typeParameters) { links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -24115,14 +25698,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8 || - expr.kind === 70 && !!symbol.exports[expr.text]; + expr.kind === 70 && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 231) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -24147,10 +25730,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 231) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -24167,7 +25750,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -24188,9 +25771,6 @@ var ts; if (!links.declaredType) { var type = createType(16384); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -24203,7 +25783,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0); if (symbol.flags & (32 | 64)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -24238,19 +25817,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: + case 133: case 104: - case 137: + case 138: case 94: case 129: - case 171: + case 172: return true; - case 162: + case 163: return isIndependentType(node.elementType); - case 157: + case 158: return isIndependentTypeReference(node); } return false; @@ -24259,7 +25839,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -24275,12 +25855,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { + case 148: case 147: - case 146: return isIndependentVariableLikeDeclaration(declaration); - case 149: - case 148: case 150: + case 149: + case 151: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -24291,7 +25871,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -24299,15 +25879,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -24315,8 +25895,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } @@ -24324,7 +25904,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -24360,10 +25947,14 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); + if (!stringIndexInfo) { + stringIndexInfo = instantiatedBaseType === anyType ? + createIndexInfo(anyType, false) : + getIndexInfoOfType(instantiatedBaseType, 0); + } numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1); } } @@ -24402,14 +25993,16 @@ var ts; return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); + var isJavaScript = ts.isInJavaScriptFile(baseTypeNode); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); - var typeArgCount = typeArguments ? typeArguments.length : 0; + var typeArgCount = ts.length(typeArguments); var result = []; for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { var baseSig = baseSignatures_1[_i]; - var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; - if (typeParamCount === typeArgCount) { - var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + var minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters); + var typeParamCount = ts.length(baseSig.typeParameters); + if ((isJavaScript || typeArgCount >= minTypeArgumentCount) && typeArgCount <= typeParamCount) { + var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, baseTypeNode)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; sig.resolvedReturnType = classType; result.push(sig); @@ -24463,7 +26056,7 @@ var ts; s = cloneSignature(signature); if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) { var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), true); - s.thisParameter = createTransientSymbol(signature.thisParameter, thisType); + s.thisParameter = createSymbolWithType(signature.thisParameter, thisType); } s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -24478,8 +26071,8 @@ var ts; function getUnionIndexInfo(types, kind) { var indexTypes = []; var isAnyReadonly = false; - for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { - var type = types_1[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type = types_2[_i]; var indexInfo = getIndexInfoOfType(type, kind); if (!indexInfo) { return undefined; @@ -24505,17 +26098,44 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -24531,8 +26151,8 @@ var ts; } else if (symbol.flags & 2048) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -24540,23 +26160,27 @@ var ts; else { var members = emptySymbols; var constructSignatures = emptyArray; - if (symbol.flags & 1952) { + var stringIndexInfo = undefined; + if (symbol.exports) { members = getExportsOfSymbol(symbol); } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072 | 540672)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); + } + else if (baseConstructorType === anyType) { + stringIndexInfo = createIndexInfo(anyType, false); } } var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; - setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, constructSignatures, stringIndexInfo, numberIndexInfo); if (symbol.flags & (16 | 8192)) { type.callSignatures = getSignaturesOfSymbol(symbol); } @@ -24565,37 +26189,48 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 169) { + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } + if (getIndexInfoOfType(modifiersType, 0)) { + addMemberForKeyType(stringType); + } + } + else { + var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t, propertySymbol) { + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - if (t.flags & (32 | 64 | 256)) { + if (t.flags & 32) { var propName = t.text; - var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; - members[propName] = prop; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 67108864); + var prop = createSymbol(4 | (isOptional ? 67108864 : 0), propName); + prop.checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? 8 : 0; + prop.type = propType; + if (propertySymbol) { + prop.syntheticOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -24608,16 +26243,28 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 169) { + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint && constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 | 262144)); + return maybeTypeOfKind(constraintType, 540672 | 262144); } return false; } @@ -24655,35 +26302,33 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - if (type.flags & 65536) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - if (!(prop.flags & 268435456 && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + if (type.flags & 65536) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -24691,41 +26336,126 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeParameter(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); - while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeParameter(constraintType); + function getConstraintOfType(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : + type.flags & 524288 ? getConstraintOfIndexedAccess(type) : + getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getConstraintOfIndexedAccess(type) { + var baseObjectType = getBaseConstraintOfType(type.objectType); + var baseIndexType = getBaseConstraintOfType(type.indexType); + return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; + } + function getBaseConstraintOfType(type) { + if (type.flags & (540672 | 196608)) { + var constraint = getResolvedBaseConstraint(type); + if (constraint !== noConstraintType && constraint !== circularConstraintType) { + return constraint; + } + } + else if (type.flags & 262144) { + return stringType; + } + return undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type_2 = types_3[_i]; + var baseType = getBaseConstraint(type_2); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144) { + return stringType; + } + if (t.flags & 524288) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + return t; } - return type.resolvedApparentType; } - function getApparentTypeOfIndexedAccess(type) { - return getIndexTypeOfType(getApparentType(type.objectType), 0) || type; + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); + } + function getDefaultFromTypeParameter(typeParameter) { + if (!typeParameter.default) { + if (typeParameter.target) { + var targetDefault = getDefaultFromTypeParameter(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType; + } + else { + var defaultDeclaration = typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameter(decl) && decl.default; }); + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; + } + } + return typeParameter.default === noConstraintType ? undefined : typeParameter.default; } function getApparentType(type) { - var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : - type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) : - type; - return t.flags & 262178 ? globalStringType : - t.flags & 340 ? globalNumberType : - t.flags & 136 ? globalBooleanType : - t.flags & 512 ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 ? globalStringType : + t.flags & 340 ? globalNumberType : + t.flags & 136 ? globalBooleanType : + t.flags & 512 ? getGlobalESSymbolType(languageVersion >= 2) : + t.flags & 16777216 ? emptyObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { - var types = containingType.types; var props; - var commonFlags = (containingType.flags & 131072) ? 536870912 : 0; - var isReadonly = false; - var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + var types = containingType.types; + var isUnion = containingType.flags & 65536; + var excludeModifiers = isUnion ? 24 : 0; + var commonFlags = isUnion ? 0 : 67108864; + var syntheticFlag = 4; + var checkFlags = 0; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var current = types_4[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) { + var modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; + if (prop && !(modifiers & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -24733,25 +26463,29 @@ var ts; else if (!ts.contains(props, prop)) { props.push(prop); } - if (isReadonlySymbol(prop)) { - isReadonly = true; + checkFlags |= (isReadonlySymbol(prop) ? 8 : 0) | + (!(modifiers & 24) ? 64 : 0) | + (modifiers & 16 ? 128 : 0) | + (modifiers & 8 ? 256 : 0) | + (modifiers & 32 ? 512 : 0); + if (!isMethodLike(prop)) { + syntheticFlag = 2; } } - else if (containingType.flags & 65536) { - isPartial = true; + else if (isUnion) { + checkFlags |= 16; } } } if (!props) { return undefined; } - if (props.length === 1 && !isPartial) { + if (props.length === 1 && !(checkFlags & 16)) { return props[0]; } var propTypes = []; var declarations = []; var commonType = undefined; - var hasNonUniformType = false; for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { var prop = props_1[_a]; if (prop.declarations) { @@ -24762,39 +26496,37 @@ var ts; commonType = type; } else if (type !== commonType) { - hasNonUniformType = true; + checkFlags |= 32; } propTypes.push(type); } - var result = createSymbol(4 | 67108864 | 268435456 | commonFlags, name); + var result = createSymbol(4 | commonFlags, name); + result.checkFlags = syntheticFlag | checkFlags; result.containingType = containingType; - result.hasNonUniformType = hasNonUniformType; - result.isPartial = isPartial; result.declarations = declarations; - result.isReadonly = isReadonly; - result.type = containingType.flags & 65536 ? getUnionType(propTypes) : getIntersectionType(propTypes); + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); return result; } function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; } function getPropertyOfUnionOrIntersectionType(type, name) { var property = getUnionOrIntersectionProperty(type, name); - return property && !(property.flags & 268435456 && property.isPartial) ? property : undefined; + return property && !(getCheckFlags(property) & 16) ? property : undefined; } function getPropertyOfType(type, name) { type = getApparentType(type); if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -24853,7 +26585,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -24873,16 +26605,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152) { - if (node.type && node.type.kind === 273) { + if (node.flags & 65536) { + if (node.type && node.type.kind === 277) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -24893,7 +26625,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + return paramTag.typeExpression.type.kind === 277; } } } @@ -24917,6 +26649,12 @@ var ts; ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } + var iife = ts.getImmediatelyInvokedFunctionExpression(node.parent); + if (iife) { + return !node.type && + !node.dotDotDotToken && + ts.indexOf(node.parent.parameters, node) >= iife.arguments.length; + } return false; } function createTypePredicateFromTypePredicateNode(node) { @@ -24936,16 +26674,50 @@ var ts; }; } } + function getMinTypeArgumentCount(typeParameters) { + var minTypeArgumentCount = 0; + if (typeParameters) { + for (var i = 0; i < typeParameters.length; i++) { + if (!getDefaultFromTypeParameter(typeParameters[i])) { + minTypeArgumentCount = i + 1; + } + } + } + return minTypeArgumentCount; + } + function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, location) { + var numTypeParameters = ts.length(typeParameters); + if (numTypeParameters) { + var numTypeArguments = ts.length(typeArguments); + var isJavaScript = ts.isInJavaScriptFile(location); + if ((isJavaScript || numTypeArguments >= minTypeArgumentCount) && numTypeArguments <= numTypeParameters) { + if (!typeArguments) { + typeArguments = []; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + typeArguments[i] = isJavaScript ? anyType : emptyObjectType; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + var mapper = createTypeMapper(typeParameters, typeArguments); + var defaultType = getDefaultFromTypeParameter(typeParameters[i]); + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : isJavaScript ? anyType : emptyObjectType; + } + } + } + return typeArguments; + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + var isUntypedSignatureInJSFile = !iife && !isJSConstructSignature && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration); + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { @@ -24959,41 +26731,34 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171) { + if (param.type && param.type.kind === 172) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - minArgumentCount = -1; + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param) || + isUntypedSignatureInJSFile; + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } - if ((declaration.kind === 151 || declaration.kind === 152) && + if ((declaration.kind === 152 || declaration.kind === 153) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 ? 152 : 151; + var otherKind = declaration.kind === 152 ? 153 : 152; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 ? + var classType = declaration.kind === 151 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 ? + var typePredicate = declaration.type && declaration.type.kind === 157 ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -25010,41 +26775,69 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } - if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152); + if (declaration.kind === 152 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { return anyType; } } + function containsArgumentsReference(declaration) { + var links = getNodeLinks(declaration); + if (links.containsArgumentsReference === undefined) { + if (links.flags & 8192) { + links.containsArgumentsReference = true; + } + else { + links.containsArgumentsReference = traverse(declaration.body); + } + } + return links.containsArgumentsReference; + function traverse(node) { + if (!node) + return false; + switch (node.kind) { + case 70: + return node.text === "arguments" && ts.isPartOfExpression(node); + case 148: + case 150: + case 152: + case 153: + return node.name.kind === 143 + && traverse(node.name); + default: + return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && ts.forEachChild(node, traverse); + } + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158: case 159: - case 225: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 274: + case 186: + case 278: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -25088,7 +26881,7 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { var declaration = signature.declaration; if (declaration.name) { error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); @@ -25112,9 +26905,14 @@ var ts; return anyType; } function getSignatureInstantiation(signature, typeArguments) { + typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters)); var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); @@ -25129,7 +26927,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154; + var isConstructor = signature.declaration.kind === 151 || signature.declaration.kind === 155; var type = createObjectType(16); type.members = emptySymbols; type.properties = emptyArray; @@ -25140,10 +26938,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 132 : 134; + var syntaxKind = kind === 1 ? 132 : 135; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -25170,21 +26968,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143).constraint; + return ts.getDeclarationOfKind(type.symbol, 144).constraint; } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; - } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -25192,28 +26978,23 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144).parent); } function getTypeListId(types) { var result = ""; if (types) { - var length_3 = types.length; + var length_4 = types.length; var i = 0; - while (i < length_3) { + while (i < length_4) { var startId = types[i].id; var count = 1; - while (i + count < length_3 && types[i + count].id === startId + count) { + while (i + count < length_4 && types[i + count].id === startId + count) { count++; } if (result.length) { @@ -25230,8 +27011,8 @@ var ts; } function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -25240,9 +27021,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4, target.symbol); + type = createObjectType(4, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -25258,17 +27040,22 @@ var ts; return type; } function getTypeReferenceArity(type) { - return type.target.typeParameters ? type.target.typeParameters.length : 0; + return ts.length(type.target.typeParameters); } function getTypeFromClassOrInterfaceReference(node, symbol) { var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (!ts.isInJavaScriptFile(node) && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, typeToString(type, undefined, 1), minTypeArgumentCount, typeParameters.length); return unknownType; } - return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode))); + var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, minTypeArgumentCount, node)); + return createTypeReference(type, typeArguments); } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); @@ -25281,14 +27068,22 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); + } + return instantiation; } function getTypeFromTypeAliasReference(node, symbol) { var type = getDeclaredTypeOfSymbol(symbol); var typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length); return unknownType; } var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode); @@ -25309,11 +27104,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157: + case 158: return node.typeName; - case 272: + case 276: return node.name; - case 199: + case 200: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -25337,23 +27132,58 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 272) { + if (symbol.flags & 107455 && node.kind === 276) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); } + function getPrimitiveTypeFromJSDocTypeReference(node) { + if (ts.isIdentifier(node.name)) { + switch (node.name.text) { + case "String": + return stringType; + case "Number": + return numberType; + case "Boolean": + return booleanType; + case "Void": + return voidType; + case "Undefined": + return undefinedType; + case "Null": + return nullType; + case "Object": + return anyType; + case "Function": + return anyFunctionType; + case "Array": + case "array": + return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined; + case "Promise": + case "promise": + return !node.typeArguments || !node.typeArguments.length ? createPromiseType(anyType) : undefined; + } + } + } + function getTypeFromJSDocNullableTypeNode(node) { + var type = getTypeFromTypeNode(node.type); + return strictNullChecks ? getUnionType([type, nullType]) : type; + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272) { - var typeReferenceName = getTypeReferenceName(node); - symbol = resolveTypeReferenceName(typeReferenceName); - type = getTypeReferenceType(node, symbol); + if (node.kind === 276) { + type = getPrimitiveTypeFromJSDocTypeReference(node); + if (!type) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(typeReferenceName); + type = getTypeReferenceType(node, symbol); + } } else { - var typeNameOrExpression = node.kind === 157 + var typeNameOrExpression = node.kind === 158 ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -25379,12 +27209,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { - var declaration = declarations_3[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var declaration = declarations_4[_i]; switch (declaration.kind) { - case 226: - case 227: + case 228: case 229: + case 231: return declaration; } } @@ -25397,44 +27227,91 @@ var ts; error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return arity ? emptyGenericType : emptyObjectType; } - if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + if (ts.length(type.typeParameters) !== arity) { error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); return arity ? emptyGenericType : emptyObjectType; } return type; } - function getGlobalValueSymbol(name) { - return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + function getGlobalValueSymbol(name, reportErrors) { + return getGlobalSymbol(name, 107455, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined); } - function getGlobalTypeSymbol(name) { - return getGlobalSymbol(name, 793064, ts.Diagnostics.Cannot_find_global_type_0); + function getGlobalTypeSymbol(name, reportErrors) { + return getGlobalSymbol(name, 793064, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined); } function getGlobalSymbol(name, meaning, diagnostic) { return resolveName(undefined, name, meaning, diagnostic, name); } - function getGlobalType(name, arity) { + function getGlobalType(name, arity, reportErrors) { + var symbol = getGlobalTypeSymbol(name, reportErrors); + return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : undefined; + } + function getGlobalTypedPropertyDescriptorType() { + return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", 1, true)) || emptyGenericType; + } + function getGlobalTemplateStringsArrayType() { + return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", 0, true)) || emptyObjectType; + } + function getGlobalESSymbolConstructorSymbol(reportErrors) { + return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)); + } + function getGlobalESSymbolType(reportErrors) { + return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", 0, reportErrors)) || emptyObjectType; + } + function getGlobalPromiseType(reportErrors) { + return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", 1, reportErrors)) || emptyGenericType; + } + function getGlobalPromiseConstructorSymbol(reportErrors) { + return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)); + } + function getGlobalPromiseConstructorLikeType(reportErrors) { + return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", 0, reportErrors)) || emptyObjectType; + } + function getGlobalAsyncIterableType(reportErrors) { + return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIteratorType(reportErrors) { + return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIterableIteratorType(reportErrors) { + return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableType(reportErrors) { + return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIteratorType(reportErrors) { + return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableIteratorType(reportErrors) { + return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalTypeOrUndefined(name, arity) { if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); + var symbol = getGlobalSymbol(name, 793064, undefined); + return symbol && getTypeOfGlobalSymbol(symbol, arity); } function getExportedTypeFromNamespace(namespace, name) { var namespaceSymbol = getGlobalSymbol(namespace, 1920, undefined); var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function createTypedPropertyDescriptorType(propertyType) { - var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyGenericType - ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) - : emptyObjectType; - } function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } - function createIterableType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); + function createTypedPropertyDescriptorType(propertyType) { + return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); + } + function createAsyncIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableType(true), [iteratedType]); + } + function createAsyncIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableIteratorType(true), [iteratedType]); } - function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); + function createIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableType(true), [iteratedType]); + } + function createIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(true), [iteratedType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -25452,7 +27329,7 @@ var ts; for (var i = 0; i < arity; i++) { var typeParameter = createType(16384); typeParameters.push(typeParameter); - var property = createSymbol(4 | 67108864, "" + i); + var property = createSymbol(4, "" + i); property.type = typeParameter; properties.push(property); } @@ -25461,7 +27338,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -25543,14 +27420,14 @@ var ts; } } function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -25558,8 +27435,9 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -25637,10 +27515,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144); - type = unionTypes[id] = createType(65536 | propagatedFlags); + type = createType(65536 | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25661,13 +27540,25 @@ var ts; else if (type.flags & 1) { typeSet.containsAny = true; } + else if (getObjectFlags(type) & 16 && isEmptyObjectType(type)) { + typeSet.containsEmptyObject = true; + } else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) { - typeSet.push(type); + if (type.flags & 32768) { + typeSet.containsObjectType = true; + } + if (type.flags & 65536 && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } + if (!(type.flags & 32768 && type.objectFlags & 16 && + type.symbol && type.symbol.flags & (16 | 8192) && containsIdenticalType(typeSet, type))) { + typeSet.push(type); + } } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var type = types_9[_i]; addTypeToIntersection(typeSet, type); } } @@ -25675,30 +27566,28 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { return anyType; } + if (typeSet.containsEmptyObject && !typeSet.containsObjectType) { + typeSet.push(emptyObjectType); + } if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144); - type = intersectionTypes[id] = createType(131072 | propagatedFlags); + type = createType(131072 | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25712,7 +27601,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144); type.resolvedIndexType.type = type; @@ -25728,7 +27617,7 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 ? getIndexTypeForTypeParameter(type) : + return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) : getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) : type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromPropertyNames(type); @@ -25751,7 +27640,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? @@ -25780,14 +27669,14 @@ var ts; getIndexInfoOfType(objectType, 0) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } return indexInfo.type; } if (accessExpression && !isConstEnumObjectType(objectType)) { - if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { if (getIndexTypeOfType(objectType, 1)) { error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); } @@ -25799,7 +27688,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -25809,34 +27698,36 @@ var ts; else { error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); } + return unknownType; } - return unknownType; + return anyType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; - return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken); + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384 || - objectType.flags & 16384 && indexType.flags & 262144 || + if (maybeTypeOfKind(indexType, 540672 | 262144) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 179) || isGenericMappedType(objectType)) { - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } + if (objectType.flags & 1) { + return objectType; } if (isGenericMappedType(objectType)) { return getIndexedAccessForMappedType(objectType, indexType, accessNode); } var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { @@ -25876,7 +27767,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -25889,17 +27780,33 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } - function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 | 1)) && !!(right.flags & (32768 | 1)), "Only object types may be spread."); + function getSpreadType(left, right) { if (left.flags & 1 || right.flags & 1) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144); }); + if (left.flags & 8192) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144); }); + if (right.flags & 8192) { + return left; + } + if (left.flags & 65536) { + return mapType(left, function (t) { return getSpreadType(t, right); }); + } + if (right.flags & 65536) { + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216) { + return emptyObjectType; + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -25914,42 +27821,55 @@ var ts; } for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; - var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, getNonReadonlySymbol(rightProp)); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 && !(leftProp.flags & 32768) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); - if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) { + if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 67108864) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); - var flags = 4 | 67108864 | (leftProp.flags & 536870912); + var flags = 4 | (leftProp.flags & 67108864); var result = createSymbol(flags, leftProp.name); result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072)]); result.leftSpread = leftProp; result.rightSpread = rightProp; result.declarations = declarations; - result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, getNonReadonlySymbol(leftProp)); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function getNonReadonlySymbol(prop) { + if (!isReadonlySymbol(prop)) { + return prop; + } + var flags = 4 | (prop.flags & 67108864); + var result = createSymbol(flags, prop.name); + result.type = getTypeOfSymbol(prop); + result.declarations = prop.declarations; + result.syntheticOrigin = prop; + return result; + } + function isClassMethod(prop) { + return prop.flags & 8192 && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -25971,7 +27891,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -25999,9 +27923,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229)) { if (!(ts.getModifierFlags(container) & 32) && - (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -26018,85 +27942,82 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 263: - case 264: + case 267: + case 268: return anyType; - case 134: + case 135: return stringType; case 132: return numberType; case 121: return booleanType; - case 135: + case 136: return esSymbolType; case 104: return voidType; - case 137: + case 138: return undefinedType; case 94: return nullType; case 129: return neverType; - case 289: - return nullType; - case 290: - return undefinedType; - case 291: - return neverType; - case 167: + case 133: + return nonPrimitiveType; + case 168: case 98: return getTypeFromThisTypeNode(node); - case 171: + case 172: return getTypeFromLiteralTypeNode(node); - case 288: + case 292: return getTypeFromLiteralTypeNode(node.literal); - case 157: - case 272: + case 158: + case 276: return getTypeFromTypeReference(node); - case 156: + case 157: return booleanType; - case 199: + case 200: return getTypeFromTypeReference(node); - case 160: + case 161: return getTypeFromTypeQueryNode(node); - case 162: - case 265: - return getTypeFromArrayTypeNode(node); case 163: - return getTypeFromTupleTypeNode(node); + case 269: + return getTypeFromArrayTypeNode(node); case 164: - case 266: - return getTypeFromUnionTypeNode(node); + return getTypeFromTupleTypeNode(node); case 165: - return getTypeFromIntersectionTypeNode(node); + case 270: + return getTypeFromUnionTypeNode(node); case 166: - case 268: - case 269: - case 276: - case 277: + return getTypeFromIntersectionTypeNode(node); + case 272: + return getTypeFromJSDocNullableTypeNode(node); + case 167: case 273: + case 280: + case 281: + case 277: return getTypeFromTypeNode(node.type); - case 270: + case 274: return getTypeFromTypeNode(node.literal); - case 158: case 159: - case 161: - case 287: - case 274: + case 160: + case 162: + case 291: + case 278: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168: - return getTypeFromTypeOperatorNode(node); case 169: - return getTypeFromIndexedAccessTypeNode(node); + return getTypeFromTypeOperatorNode(node); case 170: + return getTypeFromIndexedAccessTypeNode(node); + case 171: return getTypeFromMappedTypeNode(node); case 70: - case 141: + case 142: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267: + case 271: return getTypeFromJSDocTupleType(node); - case 275: + case 279: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -26123,13 +28044,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -26140,16 +28061,20 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } function createTypeEraser(sources) { return createTypeMapper(sources, undefined); } + function createBackreferenceMapper(typeParameters, index) { + var mapper = function (t) { return ts.indexOf(typeParameters, t) >= index ? emptyObjectType : t; }; + mapper.mappedTypes = typeParameters; + return mapper; + } function getInferenceMapper(context) { if (!context.mapper) { var mapper = function (t) { @@ -26173,7 +28098,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -26218,12 +28148,13 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { var links = getSymbolLinks(symbol); symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); + result.checkFlags = 1; result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -26244,18 +28175,17 @@ var ts; function instantiateMappedType(type, mapper) { var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144) { - var typeParameter_1 = constraintType.type; - var mappedTypeParameter = mapper(typeParameter_1); - if (typeParameter_1 !== mappedTypeParameter) { - return mapType(mappedTypeParameter, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeParameter_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + var typeVariable_1 = constraintType.type; + if (typeVariable_1.flags & 16384) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -26276,26 +28206,28 @@ var ts; return false; } var mappedTypes = mapper.mappedTypes; - var node = symbol.declarations[0].parent; - while (node) { + return !!ts.findAncestor(symbol.declarations[0], function (node) { + if (node.kind === 232 || node.kind === 264) { + return "quit"; + } switch (node.kind) { - case 158: case 159: - case 225: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 226: - case 197: - case 227: + case 186: case 228: + case 198: + case 229: + case 230: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -26305,25 +28237,34 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227) { + if (ts.isClassLike(node) || node.kind === 229) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230: - case 261: - return false; + case 171: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 278: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; } - node = node.parent; - } - return false; + }); } function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 || parentKind === 231; + return parentKind === 264 || parentKind === 233; } return false; } @@ -26375,28 +28316,34 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184: case 185: + case 186: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return ts.forEach(node.properties, isContextSensitive); - case 175: + case 176: return ts.forEach(node.elements, isContextSensitive); - case 193: + case 194: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192: + case 193: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257: + case 260: return isContextSensitive(node.initializer); + case 150: case 149: - case 148: return isContextSensitiveFunctionLikeDeclaration(node); - case 183: + case 184: return isContextSensitive(node.expression); + case 253: + return ts.forEach(node.properties, isContextSensitive); + case 252: + return node.initializer && isContextSensitive(node.initializer); + case 255: + return node.expression && isContextSensitive(node.expression); } return false; } @@ -26407,7 +28354,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !p.type; })) { return true; } - if (node.kind === 185) { + if (node.kind === 186) { return false; } var parameter = ts.firstOrUndefined(node.parameters); @@ -26425,9 +28372,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } function isTypeIdenticalTo(source, target) { @@ -26446,7 +28396,7 @@ var ts; return isTypeRelatedTo(source, target, assignableRelation); } function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -26464,9 +28414,9 @@ var ts; return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { - return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; + return compareSignaturesRelated(source, target, false, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; } - function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + function compareSignaturesRelated(source, target, checkAsCallback, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { if (source === target) { return -1; } @@ -26497,9 +28447,15 @@ var ts; var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); + var sourceType = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var targetType = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var sourceSig = getSingleCallSignature(getNonNullableType(sourceType)); + var targetSig = getSingleCallSignature(getNonNullableType(targetType)); + var callbacks = sourceSig && targetSig && !sourceSig.typePredicate && !targetSig.typePredicate && + (getFalsyFlags(sourceType) & 6144) === (getFalsyFlags(targetType) & 6144); + var related = callbacks ? + compareSignaturesRelated(targetSig, sourceSig, true, false, reportErrors, errorReporter, compareTypes) : + !checkAsCallback && compareTypes(sourceType, targetType, false) || compareTypes(targetType, sourceType, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -26526,7 +28482,8 @@ var ts; } } else { - result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + result &= checkAsCallback && compareTypes(targetReturnType, sourceReturnType, false) || + compareTypes(sourceReturnType, targetReturnType, reportErrors); } } return result; @@ -26589,18 +28546,33 @@ var ts; sourceNonRestParamCount; } } + function isEmptyResolvedType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } + function isEmptyObjectType(type) { + return type.flags & 32768 ? isEmptyResolvedType(resolveStructuredTypeMembers(type)) : + type.flags & 65536 ? ts.forEach(type.types, isEmptyObjectType) : + type.flags & 131072 ? !ts.forEach(type.types, function (t) { return !isEmptyObjectType(t); }) : + false; + } function isEnumTypeRelatedTo(source, target, errorReporter) { if (source === target) { return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256) || (source.flags & 65536) !== (target.flags & 65536)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -26611,11 +28583,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192) @@ -26636,6 +28610,8 @@ var ts; return true; if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096)) return true; + if (source.flags & 32768 && target.flags & 16777216) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1) return true; @@ -26667,13 +28643,13 @@ var ts; } if (source.flags & 32768 && target.flags & 32768) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1; } } - if (source.flags & 507904 || target.flags & 507904) { - return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); + if (source.flags & 1032192 || target.flags & 1032192) { + return checkTypeRelatedTo(source, target, relation, undefined); } return false; } @@ -26727,10 +28703,27 @@ var ts; if ((globalStringType === source && stringType === target) || (globalNumberType === source && numberType === target) || (globalBooleanType === source && booleanType === target) || - (getGlobalESSymbolType() === source && esSymbolType === target)) { + (getGlobalESSymbolType(false) === source && esSymbolType === target)) { reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608)) { + return false; + } + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 && source.flags & 1048576) { @@ -26753,7 +28746,7 @@ var ts; } return 0; } - if (target.flags & 196608) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -26769,91 +28762,24 @@ var ts; return result; } } - else if (target.flags & 65536) { - if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) { - return result; - } - } - else if (target.flags & 131072) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { - return result; - } - } - else if (source.flags & 131072) { - if (result = someTypeRelatedToType(source, target, false)) { - return result; - } - } - if (target.flags & 16384) { - if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { - if (!source.declaration.questionToken) { - var templateType = getTemplateTypeFromMappedType(source); - var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); - if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { - return result; - } - } - } - else { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } - } - else if (target.flags & 262144) { - if (source.flags & 262144) { - if (result = isRelatedTo(target.type, source.type, false)) { - return result; - } - } - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } - } - } - else if (target.flags & 524288) { - if (source.flags & 524288 && source.indexType === target.indexType) { - if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { - return result; - } - } - } - if (source.flags & 16384) { - if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { - var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); - var templateType = getTemplateTypeFromMappedType(target); - if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + else { + if (target.flags & 65536) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) { return result; } } - else { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; - } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; + else if (target.flags & 131072) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - } - else { - if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { - if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + else if (source.flags & 131072) { + if (result = someTypeRelatedToType(source, target, false)) { return result; } } - var apparentSource = getApparentType(source); - if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + if (source.flags & 1032192 || target.flags & 1032192) { + if (result = recursiveTypeRelatedTo(source, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -26873,12 +28799,7 @@ var ts; function isIdenticalTo(source, target) { var result; if (source.flags & 32768 && target.flags & 32768) { - if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { - if (result = typeArgumentsRelatedTo(source, target, false)) { - return result; - } - } - return objectTypeRelatedTo(source, source, target, false); + return recursiveTypeRelatedTo(source, target, false); } if (source.flags & 65536 && target.flags & 65536 || source.flags & 131072 && target.flags & 131072) { @@ -26890,42 +28811,43 @@ var ts; } return 0; } - function isKnownProperty(type, name) { + function isKnownProperty(type, name, isComparingJsxAttributes) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || - resolved.stringIndexInfo || - (resolved.numberIndexInfo && isNumericLiteralName(name)) || - getPropertyOfType(type, name)) { + if (resolved.stringIndexInfo || resolved.numberIndexInfo && isNumericLiteralName(name) || + getPropertyOfType(type, name) || isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) { return true; } } else if (type.flags & 196608) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; - if (isKnownProperty(t, name)) { + if (isKnownProperty(t, name, isComparingJsxAttributes)) { return true; } } } return false; } - function isEmptyObjectType(t) { - return t.properties.length === 0 && - t.callSignatures.length === 0 && - t.constructSignatures.length === 0 && - !t.stringIndexInfo && - !t.numberIndexInfo; - } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) { + var isComparingJsxAttributes = !!(source.flags & 33554432); + if ((relation === assignableRelation || relation === comparableRelation) && + (isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) { + return false; + } for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (!isKnownProperty(target, prop.name)) { + if (!isKnownProperty(target, prop.name, isComparingJsxAttributes)) { if (reportErrors) { ts.Debug.assert(!!errorNode); - errorNode = prop.valueDeclaration; - reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + if (ts.isJsxAttributes(errorNode)) { + reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target)); + } + else { + errorNode = prop.valueDeclaration; + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } } return true; } @@ -26951,20 +28873,42 @@ var ts; if (target.flags & 65536 && containsType(targetTypes, source)) { return -1; } - var len = targetTypes.length; - for (var i = 0; i < len; i++) { - var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var type = targetTypes_1[_i]; + var related = isRelatedTo(source, type, false); if (related) { return related; } } + if (reportErrors) { + var discriminantType = findMatchingDiscriminantType(source, target); + isRelatedTo(source, discriminantType || targetTypes[targetTypes.length - 1], true); + } return 0; } + function findMatchingDiscriminantType(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + if (sourceProperties) { + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProperty = sourceProperties_1[_i]; + if (isDiscriminantProperty(target, sourceProperty.name)) { + var sourceType = getTypeOfSymbol(sourceProperty); + for (var _a = 0, _b = target.types; _a < _b.length; _a++) { + var type = _b[_a]; + var targetType = getTypeOfPropertyOfType(type, sourceProperty.name); + if (targetType && isRelatedTo(sourceType, targetType)) { + return type; + } + } + } + } + } + } function typeRelatedToEachType(source, target, reportErrors) { var result = -1; var targetTypes = target.types; - for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { - var targetType = targetTypes_1[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var targetType = targetTypes_2[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0; @@ -27017,15 +28961,15 @@ var ts; } return result; } - function objectTypeRelatedTo(source, originalSource, target, reportErrors) { + function recursiveTypeRelatedTo(source, target, reportErrors) { if (overflow) { return 0; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2) { - relation[id] = 3; + relation.set(id, 3); } else { return related === 1 ? -1 : 0; @@ -27033,7 +28977,7 @@ var ts; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1; } } @@ -27051,71 +28995,165 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1; + maybeStack[depth].set(id, 1); depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth)) expandingFlags |= 1; - if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) + if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, depth)) expandingFlags |= 2; + var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors) : 1; + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + ts.copyEntries(maybeCache, destinationCache); + } + else { + relation.set(id, reportErrors ? 3 : 2); + } + return result; + } + function structuredTypeRelatedTo(source, target, reportErrors) { var result; - if (expandingFlags === 3) { - result = 1; + var saveErrorInfo = errorInfo; + if (target.flags & 16384) { + if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } } - else if (isGenericMappedType(source) || isGenericMappedType(target)) { - result = mappedTypeRelatedTo(source, target, reportErrors); + else if (target.flags & 262144) { + if (source.flags & 262144) { + if (result = isRelatedTo(target.type, source.type, false)) { + return result; + } + } + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + else if (target.flags & 524288) { + var constraint = getConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + if (source.flags & 16384) { + if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else { + var constraint = getConstraintOfTypeParameter(source); + if (constraint || !(target.flags & 16777216)) { + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + } + else if (source.flags & 524288) { + var constraint = getConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else if (target.flags & 524288 && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } } else { - result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + return result; + } + } + var sourceIsPrimitive = !!(source.flags & 8190); + if (relation !== identityRelation) { + source = getApparentType(source); + } + if (source.flags & (32768 | 131072) && target.flags & 32768) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; + if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportStructuralErrors); + } + else { + result = propertiesRelatedTo(source, target, reportStructuralErrors); if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors); + result &= signaturesRelatedTo(source, target, 0, reportStructuralErrors); if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors); + result &= signaturesRelatedTo(source, target, 1, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 0, sourceIsPrimitive, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 1, sourceIsPrimitive, reportStructuralErrors); + } + } } } } + if (result) { + errorInfo = saveErrorInfo; + return result; + } } } - expandingFlags = saveExpandingFlags; - depth--; - if (result) { - var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); - } - else { - relation[id] = reportErrors ? 3 : 2; - } - return result; + return 0; } function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1; + } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + return -1; + } } return 0; } @@ -27126,22 +29164,28 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128); - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var targetProp = properties_3[_i]; + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var targetProp = properties_4[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (!(targetProp.flags & 536870912) || requireOptionalProperties) { + if (!(targetProp.flags & 67108864) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } return 0; } } - else if (!(targetProp.flags & 134217728)) { + else if (!(targetProp.flags & 16777216)) { var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & 8 || targetPropFlags & 8) { + if (getCheckFlags(sourceProp) & 256) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); + } + return 0; + } if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { if (sourcePropFlags & 8 && targetPropFlags & 8) { @@ -27155,12 +29199,9 @@ var ts; } } else if (targetPropFlags & 16) { - var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; - var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); - if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (!isValidOverrideOf(sourceProp, targetProp)) { if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)); } return 0; } @@ -27179,7 +29220,7 @@ var ts; return 0; } result &= related; - if (relation !== comparableRelation && sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { + if (relation !== comparableRelation && sourceProp.flags & 67108864 && !(targetProp.flags & 67108864)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -27200,8 +29241,8 @@ var ts; return 0; } var result = -1; - for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { - var sourceProp = sourceProperties_1[_i]; + for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { + var sourceProp = sourceProperties_2[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -27257,7 +29298,7 @@ var ts; return result; } function signatureRelatedTo(source, target, reportErrors) { - return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo); + return compareSignaturesRelated(source, target, false, false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -27266,7 +29307,7 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; @@ -27299,12 +29340,12 @@ var ts; } return related; } - function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + function indexTypesRelatedTo(source, target, kind, sourceIsPrimitive, reportErrors) { if (relation === identityRelation) { return indexTypesIdenticalTo(source, target, kind); } var targetInfo = getIndexInfoOfType(target, kind); - if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 8190))) { + if (!targetInfo || targetInfo.type.flags & 1 && !sourceIsPrimitive) { return -1; } var sourceInfo = getIndexInfoOfType(source, kind) || @@ -27362,6 +29403,37 @@ var ts; return false; } } + function forEachProperty(prop, callback) { + if (getCheckFlags(prop) & 6) { + for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { + var t = _a[_i]; + var p = getPropertyOfType(t, prop.name); + var result = p && forEachProperty(p, callback); + if (result) { + return result; + } + } + return undefined; + } + return callback(prop); + } + function getDeclaringClass(prop) { + return prop.parent && prop.parent.flags & 32 ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : undefined; + } + function isPropertyInClassDerivedFrom(prop, baseClass) { + return forEachProperty(prop, function (sp) { + var sourceClass = getDeclaringClass(sp); + return sourceClass ? hasBaseType(sourceClass, baseClass) : false; + }); + } + function isValidOverrideOf(sourceProp, targetProp) { + return !forEachProperty(targetProp, function (tp) { return getDeclarationModifierFlagsFromSymbol(tp) & 16 ? + !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; }); + } + function isClassDerivedFromDeclaringClasses(checkClass, prop) { + return forEachProperty(prop, function (p) { return getDeclarationModifierFlagsFromSymbol(p) & 16 ? + !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass; + } function isAbstractConstructorType(type) { if (getObjectFlags(type) & 16) { var symbol = type.symbol; @@ -27374,16 +29446,18 @@ var ts; } return false; } - function isDeeplyNestedGeneric(type, stack, depth) { - if (getObjectFlags(type) & (4 | 64) && depth >= 5) { + function isDeeplyNestedType(type, stack, depth) { + if (depth >= 5 && type.flags & 32768) { var symbol = type.symbol; - var count = 0; - for (var i = 0; i < depth; i++) { - var t = stack[i]; - if (getObjectFlags(t) & (4 | 64) && t.symbol === symbol) { - count++; - if (count >= 5) - return true; + if (symbol) { + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 32768 && t.symbol === symbol) { + count++; + if (count >= 5) + return true; + } } } } @@ -27407,7 +29481,7 @@ var ts; } } else { - if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) { + if ((sourceProp.flags & 67108864) !== (targetProp.flags & 67108864)) { return 0; } } @@ -27437,7 +29511,7 @@ var ts; if (!(isMatchingSignature(source, target, partialMatch))) { return 0; } - if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { + if (ts.length(source.typeParameters) !== ts.length(target.typeParameters)) { return 0; } source = getErasedSignature(source); @@ -27475,8 +29549,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -27484,8 +29558,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -27576,8 +29650,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getFalsyFlags(t); } return result; @@ -27606,7 +29680,7 @@ var ts; types.push(undefinedType); if (flags & 4096) types.push(nullType); - return getUnionType(types, true); + return getUnionType(types); } function removeDefinitelyFalsyTypes(type) { return getFalsyFlags(type) & 7392 ? @@ -27621,8 +29695,8 @@ var ts; getSignaturesOfType(type, 0).length === 0 && getSignaturesOfType(type, 1).length === 0; } - function createTransientSymbol(source, type) { - var symbol = createSymbol(source.flags | 67108864, source.name); + function createSymbolWithType(source, type) { + var symbol = createSymbol(source.flags, source.name); symbol.declarations = source.declarations; symbol.parent = source.parent; symbol.type = type; @@ -27638,9 +29712,8 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createSymbolWithType(property, updated)); } - ; return members; } function getRegularTypeOfObjectLiteral(type) { @@ -27659,11 +29732,17 @@ var ts; type.regularType = regularNew; return regularNew; } + function getWidenedProperty(prop) { + var original = getTypeOfSymbol(prop); + var widened = getWidenedType(original); + return widened === original ? prop : createSymbolWithType(prop, widened); + } function getWidenedTypeOfObjectLiteral(type) { - var members = transformTypeOfMembers(type, function (prop) { - var widened = getWidenedType(prop); - return prop === widened ? prop : widened; - }); + var members = ts.createMap(); + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + members.set(prop.name, prop.flags & 4 ? getWidenedProperty(prop) : prop); + } var stringIndexInfo = getIndexInfoOfType(type, 0); var numberIndexInfo = getIndexInfoOfType(type, 1); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); @@ -27724,25 +29803,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 148: case 147: - case 146: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144: + case 145: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174: + case 175: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 184: + case 153: case 185: + case 186: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -27755,7 +29834,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) { + if (produceDiagnostics && noImplicitAny && type.flags & 2097152) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -27781,13 +29860,14 @@ var ts; callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } - function createInferenceContext(signature, inferUnionTypes) { + function createInferenceContext(signature, inferUnionTypes, useAnyForNoInferences) { var inferences = ts.map(signature.typeParameters, createTypeInferencesObject); return { signature: signature, inferUnionTypes: inferUnionTypes, inferences: inferences, inferredTypes: new Array(signature.typeParameters.length), + useAnyForNoInferences: useAnyForNoInferences }; } function createTypeInferencesObject() { @@ -27798,25 +29878,69 @@ var ts; isFixed: false, }; } - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 || - objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 || + objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) || objectFlags & 32 || - type.flags & 196608 && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 67108864; + var members = createSymbolTable(properties); + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var prop = properties_5[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.name); + inferredProp.checkFlags = readonlyMask && isReadonlySymbol(prop) ? 8 : 0; + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + members.set(prop.name, inferredProp); + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -27832,7 +29956,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -27871,13 +29995,13 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384) { + if (target.flags & 540672) { if (source.flags & 8388608) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : @@ -27885,7 +30009,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -27903,21 +30027,21 @@ var ts; } else if (target.flags & 196608) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { - var t = targetTypes_2[_d]; - if (t.flags & 16384 && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + var typeVariableCount = 0; + var typeVariable = void 0; + for (var _d = 0, targetTypes_3 = targetTypes; _d < targetTypes_3.length; _d++) { + var t = targetTypes_3[_d]; + if (t.flags & 540672 && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -27934,14 +30058,14 @@ var ts; if (isInProcess(source, target)) { return; } - if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { + if (isDeeplyNestedType(source, sourceStack, depth) && isDeeplyNestedType(target, targetStack, depth)) { return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -27957,9 +30081,16 @@ var ts; function inferFromObjectTypes(source, target) { if (getObjectFlags(target) & 32) { var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); + if (constraintType.flags & 262144) { + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } return; } if (constraintType.flags & 16384) { @@ -27975,8 +30106,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var targetProp = properties_6[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -28026,8 +30157,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -28068,7 +30199,13 @@ var ts; inferenceSucceeded = !!unionOrSuperType; } else { - inferredType = emptyObjectType; + var defaultType = getDefaultFromTypeParameter(context.signature.typeParameters[index]); + if (defaultType) { + inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context.signature.typeParameters, index), getInferenceMapper(context))); + } + else { + inferredType = context.useAnyForNoInferences ? anyType : emptyObjectType; + } inferenceSucceeded = true; } context.inferredTypes[index] = inferredType; @@ -28101,19 +30238,7 @@ var ts; return links.resolvedSymbol; } function isInTypeQuery(node) { - while (node) { - switch (node.kind) { - case 160: - return true; - case 70: - case 141: - node = node.parent; - continue; - default: - return false; - } - } - ts.Debug.fail("should not get here"); + return !!ts.findAncestor(node, function (n) { return n.kind === 161 ? true : n.kind === 70 || n.kind === 142 ? false : "quit"; }); } function getFlowCacheKey(node) { if (node.kind === 70) { @@ -28123,7 +30248,7 @@ var ts; if (node.kind === 98) { return "0"; } - if (node.kind === 177) { + if (node.kind === 178) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -28134,7 +30259,7 @@ var ts; case 70: case 98: return node; - case 177: + case 178: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -28143,19 +30268,21 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 || target.kind === 174) && + (target.kind === 225 || target.kind === 175) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; - case 177: - return target.kind === 177 && + case 96: + return target.kind === 96; + case 178: + return target.kind === 178 && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177) { + while (source.kind === 178) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -28164,7 +30291,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 && + return target.kind === 178 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -28172,7 +30299,7 @@ var ts; if (expr.kind === 70) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177) { + if (expr.kind === 178) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -28181,9 +30308,9 @@ var ts; function isDiscriminantProperty(type, name) { if (type && type.flags & 65536) { var prop = getUnionOrIntersectionProperty(type, name); - if (prop && prop.flags & 268435456) { + if (prop && getCheckFlags(prop) & 2) { if (prop.isDiscriminantProperty === undefined) { - prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop)); + prop.isDiscriminantProperty = prop.checkFlags & 32 && isLiteralType(getTypeOfSymbol(prop)); } return prop.isDiscriminantProperty; } @@ -28202,7 +30329,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 && + if (callExpression.expression.kind === 178 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -28241,8 +30368,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; result |= getTypeFacts(t); } return result; @@ -28250,7 +30377,7 @@ var ts; function isFunctionObjectType(type) { var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -28293,9 +30420,11 @@ var ts; if (flags & 512) { return strictNullChecks ? 1981320 : 4193160; } - if (flags & 16384) { - var constraint = getConstraintOfTypeParameter(type); - return getTypeFacts(constraint || emptyObjectType); + if (flags & 16777216) { + return strictNullChecks ? 6166480 : 8378320; + } + if (flags & 540672) { + return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType); } if (flags & 196608) { return getTypeFactsOfTypes(type.types); @@ -28321,17 +30450,23 @@ var ts; } function getTypeOfDestructuredArrayElement(type, index) { return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || - checkIteratedTypeOrElementType(type, undefined, false) || + checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType; } function getTypeOfDestructuredSpreadExpression(type) { - return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); + return createArrayType(checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 257 ? + var isDestructuringDefaultAssignment = node.parent.kind === 176 && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 260 && isDestructuringAssignmentTarget(node.parent.parent); + return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } + function isDestructuringAssignmentTarget(parent) { + return parent.parent.kind === 193 && parent.parent.left === parent || + parent.parent.kind === 215 && parent.parent.initializer === parent; + } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); } @@ -28347,21 +30482,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212: + case 214: return stringType; - case 213: - return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192: + case 215: + return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; + case 193: return getAssignedTypeOfBinaryExpression(parent); - case 186: + case 187: return undefinedType; - case 175: + case 176: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196: + case 197: return getAssignedTypeOfSpreadExpression(parent); - case 257: + case 260: return getAssignedTypeOfPropertyAssignment(parent); - case 258: + case 261: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -28369,7 +30504,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 ? + var type = pattern.kind === 173 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -28384,35 +30519,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 214) { return stringType; } - if (node.parent.parent.kind === 213) { - return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + if (node.parent.parent.kind === 215) { + return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 ? + return node.kind === 225 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 || node.kind === 174 ? + return node.kind === 225 || node.kind === 175 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 && node.initializer && + return node.kind === 225 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 && node.parent.kind === 192 && + node.kind !== 175 && node.parent.kind === 193 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183: + case 184: return getReferenceCandidate(node.expression); - case 192: + case 193: switch (node.operatorToken.kind) { case 57: return getReferenceCandidate(node.left); @@ -28424,13 +30559,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 || - parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node || - parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ? + return parent.kind === 184 || + parent.kind === 193 && parent.operatorToken.kind === 57 && parent.left === node || + parent.kind === 193 && parent.operatorToken.kind === 25 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253) { + if (clause.kind === 256) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -28476,8 +30611,29 @@ var ts; } return f(type) ? type : neverType; } - function mapType(type, f) { - return type.flags & 65536 ? getUnionType(ts.map(type.types, f)) : f(type); + function mapType(type, mapper) { + if (!(type.flags & 65536)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; + var t = mapper(current); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; } function extractTypesOfKind(type, kind) { return filterType(type, function (t) { return (t.flags & kind) !== 0; }); @@ -28511,7 +30667,7 @@ var ts; return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); } function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); + var elementType = getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -28532,8 +30688,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -28551,11 +30707,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === "length" || - parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 && + var isLengthPushOrUnshift = parent.kind === 178 && (parent.name.text === "length" || + parent.parent.kind === 180 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 && parent.expression === root && - parent.parent.kind === 192 && + parent.parent.kind === 193 && parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -28582,19 +30738,17 @@ var ts; } return false; } - function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { + function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) { + if (initialType === void 0) { initialType = declaredType; } var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) { + if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & 17810431)) { return declaredType; } - var initialType = assumeInitialized ? declaredType : - declaredType === autoType || declaredType === autoArrayType ? undefinedType : - includeFalsyTypes(declaredType, 2048); var visitedFlowStart = visitedFlowCount; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) { + if (reference.parent.kind === 202 && getTypeWithFacts(resultType, 524288).flags & 8192) { return declaredType; } return resultType; @@ -28608,7 +30762,16 @@ var ts; } } var type = void 0; - if (flow.flags & 16) { + if (flow.flags & 4096) { + flow.locked = true; + type = getTypeAtFlowNode(flow.antecedent); + flow.locked = false; + } + else if (flow.flags & 2048) { + flow = flow.antecedent; + continue; + } + else if (flow.flags & 16) { type = getTypeAtFlowAssignment(flow); if (!type) { flow = flow.antecedent; @@ -28639,7 +30802,7 @@ var ts; } else if (flow.flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177) { + if (container && container !== flowContainer && reference.kind !== 178 && reference.kind !== 98) { flow = container.flowNode; continue; } @@ -28682,7 +30845,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 ? + var expr = node.kind === 180 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -28690,7 +30853,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 179) { + if (node.kind === 180) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -28742,6 +30905,9 @@ var ts; var seenIncomplete = false; for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { var antecedent = _a[_i]; + if (antecedent.flags & 2048 && antecedent.lock.locked) { + continue; + } var flowType = getTypeAtFlowNode(antecedent); var type = getTypeFromFlowType(flowType); if (type === declaredType && declaredType === initialType) { @@ -28765,8 +30931,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } for (var i = flowLoopStart; i < flowLoopCount; i++) { if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) { @@ -28788,8 +30955,9 @@ var ts; firstAntecedentType = flowType; } var type = getTypeFromFlowType(flowType); - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -28805,10 +30973,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 && + return expr.kind === 178 && declaredType.flags & 65536 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -28842,10 +31011,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 && right_1.kind === 9) { + if (left_1.kind === 188 && right_1.kind === 9) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 && left_1.kind === 9) { + if (right_1.kind === 188 && left_1.kind === 9) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -28891,7 +31060,7 @@ var ts; assumeTrue ? 16384 : 131072; return getTypeWithFacts(type, facts); } - if (type.flags & 33281) { + if (type.flags & 16810497) { return type; } if (assumeTrue) { @@ -28916,14 +31085,22 @@ var ts; assumeTrue = !assumeTrue; } if (assumeTrue && !(type.flags & 65536)) { - var targetType = typeofTypesByName[literal.text]; - if (targetType && isTypeSubtypeOf(targetType, type)) { - return targetType; + var targetType = typeofTypesByName.get(literal.text); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type) || anyType; + if (isTypeSubtypeOf(targetType, constraint)) { + return getIntersectionType([type, targetType]); + } + } } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 : - typeofNEFacts[literal.text] || 8192; + typeofEQFacts.get(literal.text) || 64 : + typeofNEFacts.get(literal.text) || 8192; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -28992,10 +31169,9 @@ var ts; return assignableType; } } - var targetType = type.flags & 16384 ? getApparentType(type) : type; return isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : - isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); } function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { @@ -29023,7 +31199,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 || invokedExpression.kind === 177) { + if (invokedExpression.kind === 179 || invokedExpression.kind === 178) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -29040,15 +31216,16 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 96: + case 178: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179: + case 180: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183: + case 184: return narrowType(type, expr.expression, assumeTrue); - case 192: + case 193: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190: + case 191: if (expr.operator === 50) { return narrowType(type, expr.operand, !assumeTrue); } @@ -29072,15 +31249,12 @@ var ts; return getTypeOfSymbol(symbol); } function getControlFlowContainer(node) { - while (true) { - node = node.parent; - if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 || - node.kind === 261 || - node.kind === 147) { - return node; - } - } + return ts.findAncestor(node.parent, function (node) { + return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || + node.kind === 233 || + node.kind === 264 || + node.kind === 148; + }); } function isParameterAssigned(symbol) { var func = ts.getRootDeclaration(symbol.valueDeclaration).parent; @@ -29094,21 +31268,13 @@ var ts; return symbol.isAssigned || false; } function hasParentWithAssignmentsMarked(node) { - while (true) { - node = node.parent; - if (!node) { - return false; - } - if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304) { - return true; - } - } + return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 4194304); }); } function markParameterAssignments(node) { if (node.kind === 70) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145) { symbol.isAssigned = true; } } @@ -29120,6 +31286,14 @@ var ts; function isConstVariable(symbol) { return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType; } + function removeOptionalityFromDeclaredType(declaredType, declaration) { + var annotationIncludesUndefined = strictNullChecks && + declaration.kind === 145 && + declaration.initializer && + getFalsyFlags(declaredType) & 2048 && + !(getFalsyFlags(checkExpression(declaration.initializer)) & 2048); + return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 131072) : declaredType; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === unknownSymbol) { @@ -29128,16 +31302,14 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 185) { + if (container.kind === 186) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288) { - getNodeLinks(container).flags |= 8192; - } + getNodeLinks(container).flags |= 8192; return getTypeOfSymbol(symbol); } if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -29146,7 +31318,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 226 + if (declaration_1.kind === 228 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29158,11 +31330,11 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197) { + else if (declaration_1.kind === 198) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 && ts.hasModifier(container, 32)) { + if (container.kind === 148 && ts.hasModifier(container, 32)) { getNodeLinks(declaration_1).flags |= 8388608; getNodeLinks(node).flags |= 16777216; } @@ -29174,6 +31346,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -29191,22 +31364,25 @@ var ts; if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) { return type; } - var isParameter = ts.getRootDeclaration(declaration).kind === 144; + var isParameter = ts.getRootDeclaration(declaration).kind === 145; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 || - flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 || + flowContainer.kind === 186 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); - var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); + var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, ts.getRootDeclaration(declaration)) : type) : + type === autoType || type === autoArrayType ? undefinedType : + includeFalsyTypes(type, 2048); + var flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized); if (type === autoType || type === autoArrayType) { if (flowType === autoType || flowType === autoArrayType) { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } @@ -29220,19 +31396,12 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isInsideFunction(node, threshold) { - var current = node; - while (current && current !== threshold) { - if (ts.isFunctionLike(current)) { - return true; - } - current = current.parent; - } - return false; + return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n); }); } function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 256) { + symbol.valueDeclaration.parent.kind === 259) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -29250,8 +31419,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 211 && - ts.getAncestor(symbol.valueDeclaration, 224).parent === container && + if (container.kind === 213 && + ts.getAncestor(symbol.valueDeclaration, 226).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -29263,33 +31432,25 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 183) { + while (current.parent.kind === 184) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 || current.parent.kind === 191)) { + else if ((current.parent.kind === 191 || current.parent.kind === 192)) { var expr = current.parent; isAssigned = expr.operator === 42 || expr.operator === 43; } if (!isAssigned) { return false; } - while (current !== container) { - if (current === container.statement) { - return true; - } - else { - current = current.parent; - } - } - return false; + return !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement; }); } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 147 || container.kind === 150) { + if (container.kind === 148 || container.kind === 151) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -29320,42 +31481,45 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - if (!superCall || superCall.end > node.pos) { - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + if (container.kind === 151) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 185) { + if (container.kind === 186) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 230: + case 232: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 229: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 150: + case 151: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 148: case 147: - case 146: if (ts.getModifierFlags(container) & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142: + case 143: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -29364,8 +31528,8 @@ var ts; } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 184 && - ts.isInJavaScriptFile(container.parent) && + if (container.kind === 185 && + container.parent.kind === 193 && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent .left @@ -29384,7 +31548,7 @@ var ts; if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); var type = ts.hasModifier(container, 32) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; - return getFlowTypeOfReference(node, type, true, undefined); + return getFlowTypeOfReference(node, type); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); @@ -29392,34 +31556,29 @@ var ts; return type; } } - if (compilerOptions.noImplicitThis) { + if (noImplicitThis) { error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } return anyType; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274) { + if (jsdocType && jsdocType.kind === 278) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 281) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { - for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144) { - return true; - } - } - return false; + return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 145; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 185) { + while (container && container.kind === 186) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -29427,17 +31586,14 @@ var ts; var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; if (!canUseSuperExpression) { - var current = node; - while (current && current !== container && current.kind !== 142) { - current = current.parent; - } - if (current && current.kind === 142) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 143; }); + if (current && current.kind === 143) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -29445,6 +31601,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 151) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { nodeCheckFlag = 512; } @@ -29452,7 +31611,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 149 && ts.getModifierFlags(container) & 256) { + if (container.kind === 150 && ts.getModifierFlags(container) & 256) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -29463,7 +31622,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176) { + if (container.parent.kind === 177) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -29481,7 +31640,7 @@ var ts; } return unknownType; } - if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -29493,32 +31652,50 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 150; + return container.kind === 151; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 176) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177) { if (ts.getModifierFlags(container) & 32) { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || - container.kind === 152; + return container.kind === 150 || + container.kind === 149 || + container.kind === 152 || + container.kind === 153; } else { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || + return container.kind === 150 || + container.kind === 149 || container.kind === 152 || + container.kind === 153 || + container.kind === 148 || container.kind === 147 || - container.kind === 146 || - container.kind === 150; + container.kind === 151; } } } return false; } } + function getContainingObjectLiteral(func) { + return (func.kind === 150 || + func.kind === 152 || + func.kind === 153) && func.parent.kind === 177 ? func.parent : + func.kind === 185 && func.parent.kind === 260 ? func.parent.parent : + undefined; + } + function getThisTypeArgument(type) { + return getObjectFlags(type) & 4 && type.target === globalThisType ? type.typeArguments[0] : undefined; + } + function getThisTypeFromContextualType(type) { + return mapType(type, function (t) { + return t.flags & 131072 ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + }); + } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) { + if (func.kind === 186) { + return undefined; + } + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -29527,29 +31704,55 @@ var ts; } } } + if (noImplicitThis) { + var containingLiteral = getContainingObjectLiteral(func); + if (containingLiteral) { + var contextualType = getApparentTypeOfContextualType(containingLiteral); + var literal = containingLiteral; + var type = contextualType; + while (type) { + var thisType = getThisTypeFromContextualType(type); + if (thisType) { + return instantiateType(thisType, getContextualMapper(containingLiteral)); + } + if (literal.parent.kind !== 260) { + break; + } + literal = literal.parent.parent; + type = getApparentTypeOfContextualType(literal); + } + return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral); + } + if (func.parent.kind === 193 && func.parent.operatorToken.kind === 57) { + var target = func.parent.left; + if (target.kind === 178 || target.kind === 179) { + return checkExpressionCached(target.expression); + } + } + } return undefined; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -29574,7 +31777,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -29585,11 +31788,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_21 = declaration.propertyName || declaration.name; - if (ts.isVariableLike(parentDeclaration) && + var name = declaration.propertyName || declaration.name; + if (parentDeclaration.kind !== 175 && parentDeclaration.type && - !ts.isBindingPattern(name_21)) { - var text = ts.getTextOfPropertyName(name_21); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -29600,33 +31803,34 @@ var ts; } function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); - if (ts.isAsyncFunctionLike(func)) { - var contextualReturnType = getContextualReturnType(func); - if (contextualReturnType) { - return getPromisedType(contextualReturnType); + if (func) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1) { + return undefined; } - return undefined; - } - if (func && !func.asteriskToken) { - return getContextualReturnType(func); + var contextualReturnType = getContextualReturnType(func); + return functionFlags & 2 + ? contextualReturnType && getAwaitedTypeOfPromise(contextualReturnType) + : contextualReturnType; } return undefined; } function getContextualTypeForYieldOperand(node) { var func = ts.getContainingFunction(node); if (func) { + var functionFlags = ts.getFunctionFlags(func); var contextualReturnType = getContextualReturnType(func); if (contextualReturnType) { return node.asteriskToken ? contextualReturnType - : getElementTypeOfIterableIterator(contextualReturnType); + : getIteratedTypeOfGenerator(contextualReturnType, (functionFlags & 2) !== 0); } } return undefined; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 && node.parent.initializer === node) { + if (node.parent.kind === 145 && node.parent.initializer === node) { return true; } node = node.parent; @@ -29635,8 +31839,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 150 || - functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) { + functionDecl.kind === 151 || + functionDecl.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -29655,7 +31859,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181) { + if (template.parent.kind === 182) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -29685,38 +31889,14 @@ var ts; } return undefined; } - function applyToContextualType(type, mapper) { - if (!(type.flags & 65536)) { - return mapper(type); - } - var types = type.types; - var mappedType; - var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; - var t = mapper(current); - if (t) { - if (!mappedType) { - mappedType = t; - } - else if (!mappedTypes) { - mappedTypes = [mappedType, t]; - } - else { - mappedTypes.push(t); - } - } - } - return mappedTypes ? getUnionType(mappedTypes) : mappedType; - } function getTypeOfPropertyOfContextualType(type, name) { - return applyToContextualType(type, function (t) { + return mapType(type, function (t) { var prop = t.flags & 229376 ? getPropertyOfType(t, name) : undefined; return prop ? getTypeOfSymbol(prop) : undefined; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); + return mapType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 65536 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); @@ -29751,7 +31931,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? getElementTypeOfIterable(type, undefined) : undefined); + || getIteratedTypeOrElementType(type, undefined, false, false, false); } return undefined; } @@ -29760,19 +31940,16 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxAttribute(attribute) { - var kind = attribute.kind; - var jsxElement = attribute.parent; - var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250) { - if (!attrsType || isTypeAny(attrsType)) { + var attributesType = getContextualType(attribute.parent); + if (ts.isJsxAttribute(attribute)) { + if (!attributesType || isTypeAny(attributesType)) { return undefined; } - return getTypeOfPropertyOfType(attrsType, attribute.name.text); + return getTypeOfPropertyOfType(attributesType, attribute.name.text); } - else if (attribute.kind === 251) { - return attrsType; + else { + return attributesType; } - ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } function getApparentTypeOfContextualType(node) { var type = getContextualType(node); @@ -29787,45 +31964,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223: - case 144: + case 225: + case 145: + case 148: case 147: - case 146: - case 174: + case 175: return getContextualTypeForInitializerExpression(node); - case 185: - case 216: + case 186: + case 218: return getContextualTypeForReturnExpression(node); - case 195: + case 196: return getContextualTypeForYieldOperand(parent); - case 179: case 180: + case 181: return getContextualTypeForArgument(parent, node); - case 182: - case 200: + case 183: + case 201: return getTypeFromTypeNode(parent.type); - case 192: + case 193: return getContextualTypeForBinaryOperand(node); - case 257: - case 258: + case 260: + case 261: return getContextualTypeForObjectLiteralElement(parent); - case 175: + case 176: return getContextualTypeForElementExpression(node); - case 193: + case 194: return getContextualTypeForConditionalOperand(node); - case 202: - ts.Debug.assert(parent.parent.kind === 194); + case 204: + ts.Debug.assert(parent.parent.kind === 195); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183: + case 184: return getContextualType(parent); - case 252: + case 255: return getContextualType(parent); - case 250: - case 251: + case 252: + case 254: return getContextualTypeForJsxAttribute(parent); + case 250: + case 249: + return getAttributesTypeFromJsxOpeningLikeElement(parent); } return undefined; } + function getContextualMapper(node) { + node = ts.findAncestor(node, function (n) { return !!n.contextualMapper; }); + return node ? node.contextualMapper : identityMapper; + } function getNonGenericSignature(type, node) { var signatures = getSignaturesOfStructuredType(type, 0); if (signatures.length === 1) { @@ -29850,7 +32034,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 || node.kind === 185; + return node.kind === 185 || node.kind === 186; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -29863,7 +32047,7 @@ var ts; getApparentTypeOfContextualType(node); } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -29873,8 +32057,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var current = types_17[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -29896,37 +32080,37 @@ var ts; } return result; } - function isInferentialContext(mapper) { - return mapper && mapper.context; - } - function checkSpreadExpression(node, contextualMapper) { - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); + function checkSpreadExpression(node, checkMode) { + if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 1536); + } + var arrayOrIterableType = checkExpression(node.expression, checkMode); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false, false); } function hasDefaultValue(node) { - return (node.kind === 174 && !!node.initializer) || - (node.kind === 192 && node.operatorToken.kind === 57); + return (node.kind === 175 && !!node.initializer) || + (node.kind === 193 && node.operatorToken.kind === 57); } - function checkArrayLiteral(node, contextualMapper) { + function checkArrayLiteral(node, checkMode) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196) { - var restArrayType = checkExpression(e.expression, contextualMapper); + if (inDestructuringPattern && e.kind === 197) { + var restArrayType = checkExpression(e.expression, checkMode); var restElementType = getIndexTypeOfType(restArrayType, 1) || - (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); + getIteratedTypeOrElementType(restArrayType, undefined, false, false, false); if (restElementType) { elementTypes.push(restElementType); } } else { - var type = checkExpressionForMutableLocation(e, contextualMapper); + var type = checkExpressionForMutableLocation(e, checkMode); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196; + hasSpreadElement = hasSpreadElement || e.kind === 197; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -29937,7 +32121,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 173 || pattern.kind === 175)) { + if (pattern && (pattern.kind === 174 || pattern.kind === 176)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -29945,7 +32129,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198) { + if (patternElement.kind !== 199) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -29962,7 +32146,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340); @@ -29999,7 +32183,7 @@ var ts; var unionType = propTypes.length ? getUnionType(propTypes, true) : undefinedType; return createIndexInfo(unionType, false); } - function checkObjectLiteral(node, contextualMapper) { + function checkObjectLiteral(node, checkMode) { var inDestructuringPattern = ts.isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = ts.createMap(); @@ -30008,7 +32192,8 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176); + (contextualType.pattern.kind === 173 || contextualType.pattern.kind === 177); + var isJSObjectLiteral = !contextualType && ts.isInJavaScriptFile(node); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -30017,27 +32202,27 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 || - memberDecl.kind === 258 || + if (memberDecl.kind === 260 || + memberDecl.kind === 261 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257) { - type = checkPropertyAssignment(memberDecl, contextualMapper); + if (memberDecl.kind === 260) { + type = checkPropertyAssignment(memberDecl, checkMode); } - else if (memberDecl.kind === 149) { - type = checkObjectLiteralMethod(memberDecl, contextualMapper); + else if (memberDecl.kind === 150) { + type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 258); - type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 261); + type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } typeFlags |= type.flags; - var prop = createSymbol(4 | 67108864 | member.flags, member.name); + var prop = createSymbol(4 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 260 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 261 && memberDecl.objectAssignmentInitializer); if (isOptional) { - prop.flags |= 536870912; + prop.flags |= 67108864; } if (ts.hasDynamicName(memberDecl)) { patternWithComputedProperties = true; @@ -30046,9 +32231,9 @@ var ts; else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512)) { var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { - prop.flags |= impliedProp.flags & 536870912; + prop.flags |= impliedProp.flags & 67108864; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -30061,9 +32246,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259) { + else if (memberDecl.kind === 262) { + if (languageVersion < 2) { + checkExternalEmitHelpers(memberDecl, 2); + } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -30071,17 +32259,17 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 | 1))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } else { - ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152); - checkAccessorDeclaration(memberDecl); + ts.Debug.assert(memberDecl.kind === 152 || memberDecl.kind === 153); + checkNodeDeferred(memberDecl); } if (ts.hasDynamicName(memberDecl)) { if (isNumericName(memberDecl.name)) { @@ -30092,34 +32280,36 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { - if (!(prop.flags & 536870912)) { + if (!propertiesTable.get(prop.name)) { + if (!(prop.flags & 67108864)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); + } + if (spread.flags & 32768) { + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; + var stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); @@ -30136,9 +32326,14 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 | 4096 | 2048 | 16777216) || + type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { checkJsxOpeningLikeElement(node.openingElement); @@ -30151,85 +32346,105 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252: + case 255: checkJsxExpression(child); break; - case 246: + case 248: checkJsxElement(child); break; - case 247: + case 249: checkJsxSelfClosingElement(child); break; } } - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function isUnhyphenatedJsxName(name) { return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 177 || tagName.kind === 98) { + if (tagName.kind === 178 || tagName.kind === 98) { return false; } else { return ts.isIntrinsicJsxName(tagName.text); } } - function checkJsxAttribute(node, elementAttributesType, nameTable) { - var correspondingPropType = undefined; - if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { - error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); - } - else if (elementAttributesType && !isTypeAny(elementAttributesType)) { - var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); - correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - if (isUnhyphenatedJsxName(node.name.text)) { - var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0); - if (attributeType) { - correspondingPropType = attributeType; + function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, filter, checkMode) { + var attributes = openingLikeElement.attributes; + var attributesTable = ts.createMap(); + var spread = emptyObjectType; + var attributesArray = []; + for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { + var attributeDecl = _a[_i]; + var member = attributeDecl.symbol; + if (ts.isJsxAttribute(attributeDecl)) { + var exprType = attributeDecl.initializer ? + checkExpression(attributeDecl.initializer, checkMode) : + trueType; + var attributeSymbol = createSymbol(4 | 134217728 | member.flags, member.name); + attributeSymbol.declarations = member.declarations; + attributeSymbol.parent = member.parent; + if (member.valueDeclaration) { + attributeSymbol.valueDeclaration = member.valueDeclaration; } - else { - if (!correspondingPropType) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; - } + attributeSymbol.type = exprType; + attributeSymbol.target = member; + attributesTable.set(attributeSymbol.name, attributeSymbol); + attributesArray.push(attributeSymbol); + } + else { + ts.Debug.assert(attributeDecl.kind === 254); + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + var exprType = checkExpression(attributeDecl.expression); + if (!isValidSpreadType(exprType)) { + error(attributeDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); + return anyType; + } + if (isTypeAny(exprType)) { + return anyType; } + spread = getSpreadType(spread, exprType); } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); + if (spread !== emptyObjectType) { + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + attributesArray = getPropertiesOfType(spread); } - else { - exprType = booleanType; + attributesTable = ts.createMap(); + if (attributesArray) { + ts.forEach(attributesArray, function (attr) { + if (!filter || filter(attr)) { + attributesTable.set(attr.name, attr); + } + }); } - if (correspondingPropType) { - checkTypeAssignableTo(exprType, correspondingPropType, node); + return createJsxAttributesType(attributes.symbol, attributesTable); + function createJsxAttributesType(symbol, attributesTable) { + var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, undefined, undefined); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; + result.flags |= 33554432 | 4194304 | freshObjectLiteralFlag; + result.objectFlags |= 128; + return result; } - nameTable[node.name.text] = true; - return exprType; } - function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { - var type = checkExpression(node.expression); - var props = getPropertiesOfType(type); - for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { - var prop = props_2[_i]; - if (!nameTable[prop.name]) { - var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); - if (targetPropSym) { - var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); - checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); - } - nameTable[prop.name] = true; - } - } - return type; + function checkJsxAttributes(node, checkMode) { + return createJsxAttributesTypeFromAttributesProperty(node.parent, undefined, checkMode); } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); @@ -30250,7 +32465,7 @@ var ts; return links.resolvedSymbol = unknownSymbol; } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } return links.resolvedSymbol = unknownSymbol; @@ -30294,23 +32509,86 @@ var ts; return undefined; } } - function getResolvedJsxType(node, elemType, elemClassType) { - if (!elemType) { - elemType = checkExpression(node.tagName); + function defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + var callSignature = getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, undefined); + if (callSignature !== unknownSignature) { + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + } + return undefined; + } + function tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + var candidatesOutArray = []; + getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray); + var result = void 0; + var allMatchingAttributesType = void 0; + for (var _i = 0, candidatesOutArray_1 = candidatesOutArray; _i < candidatesOutArray_1.length; _i++) { + var candidate = candidatesOutArray_1[_i]; + var callReturnType = getReturnTypeOfSignature(candidate); + var paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var shouldBeCandidate = true; + for (var _a = 0, _b = openingLikeElement.attributes.properties; _a < _b.length; _a++) { + var attribute = _b[_a]; + if (ts.isJsxAttribute(attribute) && + isUnhyphenatedJsxName(attribute.name.text) && + !getPropertyOfType(paramType, attribute.name.text)) { + shouldBeCandidate = false; + break; + } + } + if (shouldBeCandidate) { + result = intersectTypes(result, paramType); + } + allMatchingAttributesType = intersectTypes(allMatchingAttributesType, paramType); + } + } + if (!result) { + result = allMatchingAttributesType; + } + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + result = intersectTypes(intrinsicAttributes, result); + } + return result; + } + } + return undefined; + } + function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) { + if (!elementType) { + elementType = checkExpression(openingLikeElement.tagName); } - if (elemType.flags & 65536) { - var types = elemType.types; - return getUnionType(ts.map(types, function (type) { - return getResolvedJsxType(node, type, elemClassType); + if (elementType.flags & 65536) { + var types = elementType.types; + return getUnionType(types.map(function (type) { + return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), true); } - if (elemType.flags & 2) { + if (elementType.flags & 2) { return anyType; } - else if (elemType.flags & 32) { + else if (elementType.flags & 32) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { - var stringLiteralTypeName = elemType.text; + var stringLiteralTypeName = elementType.text; var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName); if (intrinsicProp) { return getTypeOfSymbol(intrinsicProp); @@ -30319,28 +32597,19 @@ var ts; if (indexSignatureType) { return indexSignatureType; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); + error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); } return anyType; } - var elemInstanceType = getJsxElementInstanceType(node, elemType); - if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { - if (jsxElementType) { - var callSignatures = elemType && getSignaturesOfType(elemType, 0); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); - } - return paramType; - } - } + var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? + tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : + defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); + if (statelessAttributesType) { + return statelessAttributesType; } - if (elemClassType) { - checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + if (elementClassType) { + checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } if (isTypeAny(elemInstanceType)) { return elemInstanceType; @@ -30360,10 +32629,6 @@ var ts; else if (isTypeAny(attributesType) || (attributesType === unknownType)) { return attributesType; } - else if (attributesType.flags & 65536) { - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); - return anyType; - } else { var apparentAttributesType = attributesType; var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); @@ -30386,38 +32651,72 @@ var ts; } } } - function getJsxElementAttributesType(node) { + function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { + ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); var links = getNodeLinks(node); - if (!links.resolvedJsxType) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - var symbol = getIntrinsicTagSymbol(node); - if (links.jsxFlags & 1) { - return links.resolvedJsxType = getTypeOfSymbol(symbol); - } - else if (links.jsxFlags & 2) { - return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type; - } - else { - return links.resolvedJsxType = unknownType; - } + if (!links.resolvedJsxElementAttributesType) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1) { + return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol); + } + else if (links.jsxFlags & 2) { + return links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, 0).type; } else { - var elemClassType = getJsxGlobalElementClassType(); - return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); + return links.resolvedJsxElementAttributesType = unknownType; } } - return links.resolvedJsxType; + return links.resolvedJsxElementAttributesType; + } + function getCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType) { + var links = getNodeLinks(node); + if (!links.resolvedJsxElementAttributesType) { + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxElementAttributesType = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, undefined, elemClassType); + } + return links.resolvedJsxElementAttributesType; + } + function getAllAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, true); + } + } + function getAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, false); + } } function getJsxAttributePropertySymbol(attrib) { - var attributesType = getJsxElementAttributesType(attrib.parent); + var attributesType = getAttributesTypeFromJsxOpeningLikeElement(attrib.parent.parent); var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } function getJsxGlobalElementClassType() { - if (!jsxElementClassType) { - jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + if (!deferredJsxElementClassType) { + deferredJsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); } - return jsxElementClassType; + return deferredJsxElementClassType; + } + function getJsxGlobalElementType() { + if (!deferredJsxElementType) { + deferredJsxElementType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.Element); + } + return deferredJsxElementType; + } + function getJsxGlobalStatelessElementType() { + if (!deferredJsxStatelessElementType) { + var jsxElementType = getJsxGlobalElementType(); + if (jsxElementType) { + deferredJsxStatelessElementType = getUnionType([jsxElementType, nullType]); + } + } + return deferredJsxStatelessElementType; } function getJsxIntrinsicTagNames() { var intrinsics = getJsxType(JsxNames.IntrinsicElements); @@ -30427,8 +32726,8 @@ var ts; if ((compilerOptions.jsx || 0) === 0) { error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); } - if (jsxElementType === undefined) { - if (compilerOptions.noImplicitAny) { + if (getJsxGlobalElementType() === undefined) { + if (noImplicitAny) { error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); } } @@ -30445,61 +32744,83 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - var targetAttributesType = getJsxElementAttributesType(node); - var nameTable = ts.createMap(); - var sawSpreadedAny = false; - for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250) { - checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); - } - else { - ts.Debug.assert(node.attributes[i].kind === 251); - var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); - if (isTypeAny(spreadType)) { - sawSpreadedAny = true; - } - } + checkJsxAttributesAssignableToTagNameAttributes(node); + } + function checkJsxAttributesAssignableToTagNameAttributes(openingLikeElement) { + var targetAttributesType = isJsxIntrinsicIdentifier(openingLikeElement.tagName) ? + getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : + getCustomJsxElementAttributesType(openingLikeElement, false); + var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, function (attribute) { + return isUnhyphenatedJsxName(attribute.name) || !!(getPropertyOfType(targetAttributesType, attribute.name)); + }); + if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || sourceAttributesType.properties.length > 0)) { + error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } - if (targetAttributesType && !sawSpreadedAny) { - var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); - } - } + else { + checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); } } - function checkJsxExpression(node) { + function checkJsxExpression(node, checkMode) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression, checkMode); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147; + return s.valueDeclaration ? s.valueDeclaration.kind : 148; } function getDeclarationModifierFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; + if (s.valueDeclaration) { + var flags = ts.getCombinedModifierFlags(s.valueDeclaration); + return s.parent && s.parent.flags & 32 ? flags : flags & ~28; + } + if (getCheckFlags(s) & 6) { + var checkFlags = s.checkFlags; + var accessModifier = checkFlags & 256 ? 8 : + checkFlags & 64 ? 4 : + 16; + var staticModifier = checkFlags & 512 ? 32 : 0; + return accessModifier | staticModifier; + } + if (s.flags & 16777216) { + return 4 | 32; + } + return 0; } function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function checkClassPropertyAccess(node, left, type, prop) { + function isMethodLike(symbol) { + return !!(symbol.flags & 8192 || getCheckFlags(symbol) & 4); + } + function checkPropertyAccessibility(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 223 ? + var errorNode = node.kind === 178 || node.kind === 225 ? node.name : node.right; + if (getCheckFlags(prop) & 256) { + error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); + return false; + } if (left.kind === 96) { - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) { - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2) { + var hasNonMethodDeclaration = forEachProperty(prop, function (p) { + var propKind = getDeclarationKindFromSymbol(p); + return propKind !== 150 && propKind !== 149; + }); + if (hasNonMethodDeclaration) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128) { - error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } } @@ -30509,7 +32830,7 @@ var ts; if (flags & 8) { var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (!isNodeWithinClass(node, declaringClassDeclaration)) { - error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } return true; @@ -30519,10 +32840,10 @@ var ts; } var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); - return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + return isClassDerivedFromDeclaringClasses(enclosingClass, prop) ? enclosingClass : undefined; }); if (!enclosingClass) { - error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || type)); return false; } if (flags & 32) { @@ -30538,16 +32859,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144; - if (kind) { - error(node, kind & 2048 ? kind & 4096 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144; + if (kind) { + error(errorNode, kind & 2048 ? kind & 4096 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 | 8192) ? unknownType : t; } return type; } @@ -30576,7 +32898,7 @@ var ts; noUnusedIdentifiers && (prop.flags & 106500) && prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8)) { - if (prop.flags & 16777216) { + if (getCheckFlags(prop) & 1) { getSymbolLinks(prop).target.isReferenced = true; } else { @@ -30584,6 +32906,15 @@ var ts; } } } + function isInPropertyInitializer(node) { + while (node) { + if (node.parent && node.parent.kind === 148 && node.parent.initializer === node) { + return true; + } + node = node.parent; + } + return false; + } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { var type = checkNonNullExpression(left); if (isTypeAny(type) || type === silentNeverType) { @@ -30595,16 +32926,30 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type); } return unknownType; } + if (prop.valueDeclaration) { + if (isInPropertyInitializer(node) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + } + if (prop.valueDeclaration.kind === 228 && + node.parent && node.parent.kind !== 158 && + !ts.isInAmbientContext(prop.valueDeclaration) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Class_0_used_before_its_declaration, right.text); + } + } markPropertyAsReferenced(prop); getNodeLinks(node).resolvedSymbol = prop; - if (prop.parent && prop.parent.flags & 32) { - checkClassPropertyAccess(node, left, apparentType, prop); - } + checkPropertyAccessibility(node, left, apparentType, prop); var propType = getTypeOfSymbol(prop); var assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { @@ -30613,30 +32958,30 @@ var ts; return unknownType; } } - if (node.kind !== 177 || assignmentKind === 1 || + if (node.kind !== 178 || assignmentKind === 1 || !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 65536)) { return propType; } - var flowType = getFlowTypeOfReference(node, propType, true, undefined); + var flowType = getFlowTypeOfReference(node, propType); return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 + var left = node.kind === 178 ? node.expression : node.left; var type = checkExpression(left); if (type !== unknownType && !isTypeAny(type)) { var prop = getPropertyOfType(getWidenedType(type), propertyName); - if (prop && prop.parent && prop.parent.flags & 32) { - return checkClassPropertyAccess(node, left, type, prop); + if (prop) { + return checkPropertyAccessibility(node, left, type, prop); } } return true; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224) { + if (initializer.kind === 226) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -30658,7 +33003,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 && + if (node.kind === 214 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -30676,7 +33021,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 && node.parent.expression === node) { + if (node.parent.kind === 181 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -30696,7 +33041,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -30716,7 +33061,7 @@ var ts; if (!leftHandSideSymbol) { return false; } - var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + var globalESSymbol = getGlobalESSymbolConstructorSymbol(true); if (!globalESSymbol) { return false; } @@ -30729,10 +33074,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181) { + if (node.kind === 182) { checkExpression(node.template); } - else if (node.kind !== 145) { + else if (node.kind !== 146) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -30751,22 +33096,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { - var signature = signatures_2[_i]; + for (var _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) { + var signature = signatures_3[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -30783,7 +33128,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196) { + if (arg && arg.kind === 197) { return i; } } @@ -30796,11 +33141,14 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181) { + if (ts.isJsxOpeningLikeElement(node)) { + return true; + } + if (node.kind === 182) { var tagExpression = node; argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194) { + if (tagExpression.template.kind === 195) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -30812,7 +33160,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145) { + else if (node.kind === 146) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, undefined, signature); @@ -30820,7 +33168,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 180); + ts.Debug.assert(callExpression.kind === 181); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -30828,8 +33176,10 @@ var ts; typeArguments = callExpression.typeArguments; spreadArgIndex = getSpreadArgumentIndex(args); } + var numTypeParameters = ts.length(signature.typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + (typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { return false; } @@ -30853,9 +33203,9 @@ var ts; return undefined; } function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature, true); + var context = createInferenceContext(signature, true, false); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -30874,19 +33224,19 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } if (excludeArgument) { @@ -30894,7 +33244,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -30904,7 +33254,7 @@ var ts; var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; var mapper; - for (var i = 0; i < typeParameters.length; i++) { + for (var i = 0; i < typeArgumentNodes.length; i++) { if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -30924,9 +33274,29 @@ var ts; } return typeArgumentsAreAssignable; } + function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation) { + var callIsIncomplete = node.attributes.end === node.end; + if (callIsIncomplete) { + return true; + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; + var paramType = getTypeAtPosition(signature, 0); + var attributesType = checkExpressionWithContextualType(node.attributes, paramType, undefined); + var argProperties = getPropertiesOfType(attributesType); + for (var _i = 0, argProperties_1 = argProperties; _i < argProperties_1.length; _i++) { + var arg = argProperties_1[_i]; + if (!getPropertyOfType(paramType, arg.name) && isUnhyphenatedJsxName(arg.name)) { + return false; + } + } + return checkTypeRelatedTo(attributesType, paramType, relation, undefined, headMessage); + } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (ts.isJsxOpeningLikeElement(node)) { + return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); + } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180) { + if (thisType && thisType !== voidType && node.kind !== 181) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -30939,7 +33309,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -30954,51 +33324,54 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 179) { + if (node.kind === 180) { var callee = node.expression; - if (callee.kind === 177) { + if (callee.kind === 178) { return callee.expression; } - else if (callee.kind === 178) { + else if (callee.kind === 179) { return callee.expression; } } } function getEffectiveCallArguments(node) { var args; - if (node.kind === 181) { + if (node.kind === 182) { var template = node.template; args = [undefined]; - if (template.kind === 194) { + if (template.kind === 195) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145) { + else if (node.kind === 146) { return undefined; } + else if (ts.isJsxOpeningLikeElement(node)) { + args = node.attributes.properties.length > 0 ? [node.attributes] : emptyArray; + } else { args = node.arguments || emptyArray; } return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145) { + if (node.kind === 146) { switch (node.parent.kind) { - case 226: - case 197: + case 228: + case 198: return 1; - case 147: + case 148: return 2; - case 149: - case 151: + case 150: case 152: + case 153: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 144: + case 145: return 3; } } @@ -31007,48 +33380,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { return anyType; } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var element = node; switch (element.name.kind) { case 70: case 8: case 9: return getLiteralTypeForText(32, element.name.text); - case 142: + case 143: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512)) { return nameType; @@ -31065,20 +33438,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { return numberType; } - if (node.kind === 147) { + if (node.kind === 148) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -31099,26 +33472,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex) { - if (node.kind === 145) { + if (node.kind === 146) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 145 || - (argIndex === 0 && node.kind === 181)) { + if (node.kind === 146 || + (argIndex === 0 && node.kind === 182)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145) { + if (node.kind === 146) { return node.expression; } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return node.template; } else { @@ -31126,15 +33499,30 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181; - var isDecorator = node.kind === 145; + var isTaggedTemplate = node.kind === 182; + var isDecorator = node.kind === 146; + var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; - if (!isTaggedTemplate && !isDecorator) { + if (!isTaggedTemplate && !isDecorator && !isJsxOpeningOrSelfClosingElement) { typeArguments = node.typeArguments; if (node.expression.kind !== 96) { ts.forEach(typeArguments, checkSourceElement); } } + if (signatures.length === 1) { + var declaration = signatures[0].declaration; + if (declaration && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration)) { + if (containsArgumentsReference(declaration)) { + var signatureWithRest = cloneSignature(signatures[0]); + var syntheticArgsSymbol = createSymbol(3, "args"); + syntheticArgsSymbol.type = anyArrayType; + syntheticArgsSymbol.isRestParameter = true; + signatureWithRest.parameters = ts.concatenate(signatureWithRest.parameters, [syntheticArgsSymbol]); + signatureWithRest.hasRestParameter = true; + signatures = [signatureWithRest]; + } + } + } var candidates = candidatesOutArray || []; reorderCandidates(signatures, candidates); if (!candidates.length) { @@ -31157,7 +33545,7 @@ var ts; var candidateForTypeArgumentError; var resultOfFailedInference; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -31171,6 +33559,9 @@ var ts; return result; } if (candidateForArgumentError) { + if (isJsxOpeningOrSelfClosingElement) { + return candidateForArgumentError; + } checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); } else if (candidateForTypeArgumentError) { @@ -31186,7 +33577,7 @@ var ts; if (headMessage) { diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); } - reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + reportNoCommonSupertypeError(inferenceCandidates, node.tagName || node.expression || node.tag, diagnosticChainHead); } } else { @@ -31222,20 +33613,20 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate, false) + ? createInferenceContext(originalCandidate, false, ts.isInJavaScriptFile(node)) : undefined; while (true) { candidate = originalCandidate; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); + typeArgumentTypes = fillMissingTypeArguments(ts.map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, getMinTypeArgumentCount(candidate.typeParameters)); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); - typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; + typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; } if (!typeArgumentsAreValid) { break; @@ -31277,7 +33668,7 @@ var ts; if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); if (baseTypeNode) { - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode); return resolveCall(node, baseConstructors, candidatesOutArray); } } @@ -31388,12 +33779,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8) { @@ -31425,16 +33817,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226: - case 197: + case 228: + case 198: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144: + case 145: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147: + case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149: - case 151: + case 150: case 152: + case 153: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -31459,16 +33851,42 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) { + ts.Debug.assert(!(elementType.flags & 65536)); + var callSignature = resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray); + return callSignature; + } + function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) { + if (elementType.flags & 65536) { + var types = elementType.types; + var result = void 0; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var type = types_18[_i]; + result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray); + } + return result; + } + var callSignatures = elementType && getSignaturesOfType(elementType, 0); + if (callSignatures && callSignatures.length > 0) { + var callSignature = void 0; + callSignature = resolveCall(openingLikeElement, callSignatures, candidatesOutArray); + return callSignature; + } + return undefined; + } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179: - return resolveCallExpression(node, candidatesOutArray); case 180: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 181: + return resolveNewExpression(node, candidatesOutArray); + case 182: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145: + case 146: return resolveDecorator(node, candidatesOutArray); + case 250: + case 249: + return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); } @@ -31499,20 +33917,23 @@ var ts; if (node.expression.kind === 96) { return voidType; } - if (node.kind === 180) { + if (node.kind === 181) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 && - declaration.kind !== 154 && - declaration.kind !== 159 && + declaration.kind !== 151 && + declaration.kind !== 155 && + declaration.kind !== 160 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = node.expression.kind === 70 ? getResolvedSymbol(node.expression) : checkExpression(node.expression).symbol; - if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { + if (funcSymbol && ts.isDeclarationOfFunctionOrClassExpression(funcSymbol)) { + funcSymbol = getSymbolOfNode(funcSymbol.valueDeclaration.initializer); + } + if (funcSymbol && funcSymbol.members && funcSymbol.flags & 16) { return getInferredClassType(funcSymbol); } - else if (compilerOptions.noImplicitAny) { + else if (noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; @@ -31535,9 +33956,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 225 + ? 227 : resolvedRequire.flags & 3 - ? 223 + ? 225 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -31563,6 +33984,22 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 151) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -31578,13 +34015,16 @@ var ts; pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } - function assignContextualParameterTypes(signature, context, mapper) { + function getTypeOfFirstParameterOfSignature(signature) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + } + function assignContextualParameterTypes(signature, context, mapper, checkMode) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); - if (isInferentialContext(mapper)) { + if (checkMode === 2) { for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -31592,23 +34032,23 @@ var ts; var parameter = signature.thisParameter; if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { if (!parameter) { - signature.thisParameter = createTransientSymbol(context.thisParameter, undefined); + signature.thisParameter = createSymbolWithType(context.thisParameter, undefined); } - assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper); + assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper, checkMode); } } for (var i = 0; i < len; i++) { var parameter = signature.parameters[i]; if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeAtPosition(context, i); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } } @@ -31625,19 +34065,19 @@ var ts; } } } - function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper, checkMode) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 || - parameter.valueDeclaration.name.kind === 173)) { + (parameter.valueDeclaration.name.kind === 173 || + parameter.valueDeclaration.name.kind === 174)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); } - else if (isInferentialContext(mapper)) { - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + else if (checkMode === 2) { + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -31648,9 +34088,9 @@ var ts; return undefined; } function createPromiseType(promisedType) { - var globalPromiseType = getGlobalPromiseType(); + var globalPromiseType = getGlobalPromiseType(true); if (globalPromiseType !== emptyGenericType) { - promisedType = getAwaitedType(promisedType); + promisedType = getAwaitedType(promisedType) || emptyObjectType; return createTypeReference(globalPromiseType, [promisedType]); } return emptyObjectType; @@ -31661,46 +34101,56 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol(true)) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } - function getReturnTypeFromBody(func, contextualMapper) { + function getReturnTypeFromBody(func, checkMode) { var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); if (!func.body) { return unknownType; } - var isAsync = ts.isAsyncFunctionLike(func); + var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 204) { - type = checkExpressionCached(func.body, contextualMapper); - if (isAsync) { - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (func.body.kind !== 206) { + type = checkExpressionCached(func.body, checkMode); + if (functionFlags & 2) { + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } } else { var types = void 0; - var funcIsGenerator = !!func.asteriskToken; - if (funcIsGenerator) { - types = checkAndAggregateYieldOperandTypes(func, contextualMapper); - if (types.length === 0) { - var iterableIteratorAny = createIterableIteratorType(anyType); - if (compilerOptions.noImplicitAny) { + if (functionFlags & 1) { + types = ts.concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), checkAndAggregateReturnExpressionTypes(func, checkMode)); + if (!types || types.length === 0) { + var iterableIteratorAny = functionFlags & 2 + ? createAsyncIterableIteratorType(anyType) + : createIterableIteratorType(anyType); + if (noImplicitAny) { error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)); } return iterableIteratorAny; } } else { - types = checkAndAggregateReturnExpressionTypes(func, contextualMapper); + types = checkAndAggregateReturnExpressionTypes(func, checkMode); if (!types) { - return isAsync ? createPromiseReturnType(func, neverType) : neverType; + return functionFlags & 2 + ? createPromiseReturnType(func, neverType) + : neverType; } if (types.length === 0) { - return isAsync ? createPromiseReturnType(func, voidType) : voidType; + return functionFlags & 2 + ? createPromiseReturnType(func, voidType) + : voidType; } } type = getUnionType(types, true); - if (funcIsGenerator) { - type = createIterableIteratorType(type); + if (functionFlags & 1) { + type = functionFlags & 2 + ? createAsyncIterableIteratorType(type) + : createIterableIteratorType(type); } } if (!contextualSignature) { @@ -31712,16 +34162,24 @@ var ts; type = getWidenedLiteralType(type); } var widenedType = getWidenedType(type); - return isAsync ? createPromiseReturnType(func, widenedType) : widenedType; + return (functionFlags & 3) === 2 + ? createPromiseReturnType(func, widenedType) + : widenedType; } - function checkAndAggregateYieldOperandTypes(func, contextualMapper) { + function checkAndAggregateYieldOperandTypes(func, checkMode) { var aggregatedTypes = []; + var functionFlags = ts.getFunctionFlags(func); ts.forEachYieldExpression(func.body, function (yieldExpression) { var expr = yieldExpression.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); + var type = checkExpressionCached(expr, checkMode); if (yieldExpression.asteriskToken) { - type = checkElementTypeOfIterable(type, yieldExpression.expression); + type = checkIteratedTypeOrElementType(type, yieldExpression.expression, false, (functionFlags & 2) !== 0); + } + if (functionFlags & 2) { + type = checkAwaitedType(type, expr, yieldExpression.asteriskToken + ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (!ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); @@ -31742,29 +34200,29 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128)) { return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; } - function checkAndAggregateReturnExpressionTypes(func, contextualMapper) { - var isAsync = ts.isAsyncFunctionLike(func); + function checkAndAggregateReturnExpressionTypes(func, checkMode) { + var functionFlags = ts.getFunctionFlags(func); var aggregatedTypes = []; var hasReturnWithNoExpression = functionHasImplicitReturn(func); var hasReturnOfTypeNever = false; ts.forEachReturnStatement(func.body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); - if (isAsync) { - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var type = checkExpressionCached(expr, checkMode); + if (functionFlags & 2) { + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (type.flags & 8192) { hasReturnOfTypeNever = true; @@ -31778,7 +34236,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 || func.kind === 185)) { + func.kind === 185 || func.kind === 186)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -31795,7 +34253,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -31821,20 +34279,20 @@ var ts; error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); } } - function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184) { + if (!hasGrammarError && node.kind === 185) { checkGrammarForGenerator(node); } - if (contextualMapper === identityMapper && isContextSensitive(node)) { + if (checkMode === 1 && isContextSensitive(node)) { checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); - var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + var mightFixTypeParameters = contextSensitive && checkMode === 2; if (mightFixTypeParameters || !(links.flags & 1024)) { var contextualSignature = getContextualSignature(node); var contextChecked = !!(links.flags & 1024); @@ -31843,10 +34301,10 @@ var ts; if (contextualSignature) { var signature = getSignaturesOfType(type, 0)[0]; if (contextSensitive) { - assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + assignContextualParameterTypes(signature, contextualSignature, getContextualMapper(node), checkMode); } if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { - var returnType = getReturnTypeFromBody(node, contextualMapper); + var returnType = getReturnTypeFromBody(node, checkMode); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } @@ -31858,31 +34316,35 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149) { + if (produceDiagnostics && node.kind !== 150) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); - var isAsync = ts.isAsyncFunctionLike(node); - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); - if (!node.asteriskToken) { + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); + var functionFlags = ts.getFunctionFlags(node); + var returnOrPromisedType = node.type && + ((functionFlags & 3) === 2 ? + checkAsyncFunctionReturnType(node) : + getTypeFromTypeNode(node.type)); + if ((functionFlags & 1) === 0) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (node.body) { if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204) { + if (node.body.kind === 206) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (returnOrPromisedType) { - if (isAsync) { - var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); + if ((functionFlags & 3) === 2) { + var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { @@ -31901,19 +34363,19 @@ var ts; return true; } function isReadonlySymbol(symbol) { - return symbol.isReadonly || - symbol.flags & 4 && (getDeclarationModifierFlagsFromSymbol(symbol) & 64) !== 0 || - symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 || + return !!(getCheckFlags(symbol) & 8 || + symbol.flags & 4 && getDeclarationModifierFlagsFromSymbol(symbol) & 64 || + symbol.flags & 3 && getDeclarationNodeFlagsFromSymbol(symbol) & 2 || symbol.flags & 98304 && !(symbol.flags & 65536) || - (symbol.flags & 8) !== 0; + symbol.flags & 8); } function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 177 || expr.kind === 178) && + (expr.kind === 178 || expr.kind === 179) && expr.expression.kind === 98) { var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150)) + if (!(func && func.kind === 151)) return true; return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent); } @@ -31922,13 +34384,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 || expr.kind === 178) { + if (expr.kind === 178 || expr.kind === 179) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237; + return declaration && declaration.kind === 239; } } } @@ -31936,7 +34398,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipParentheses(expr); - if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 70 && node.kind !== 178 && node.kind !== 179) { error(expr, invalidReferenceMessage); return false; } @@ -31944,11 +34406,21 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 178 && expr.kind !== 179) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { checkExpression(node.expression); - return stringType; + return typeofType; } function checkVoidExpression(node) { checkExpression(node.expression); @@ -31956,7 +34428,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 524288)) { + if (!(node.flags & 16384)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -31964,7 +34436,7 @@ var ts; } } var operandType = checkExpression(node.expression); - return checkAwaitedType(operandType, node); + return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); @@ -31978,6 +34450,7 @@ var ts; case 36: case 37: case 51: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -31989,7 +34462,7 @@ var ts; booleanType; case 42: case 43: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } @@ -32002,7 +34475,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } @@ -32014,8 +34487,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_19 = types; _i < types_19.length; _i++) { + var t = types_19[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -32029,8 +34502,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_20 = types; _i < types_20.length; _i++) { + var t = types_20[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -32039,8 +34512,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_21 = types; _a < types_21.length; _a++) { + var t = types_21[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -32061,7 +34534,10 @@ var ts; if (isTypeOfKind(leftType, 8190)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0).length || + getSignaturesOfType(rightType, 1).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -32070,39 +34546,41 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; + for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { + var p = properties_7[_i]; checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 || property.kind === 258) { - var name_22 = property.name; - if (name_22.kind === 142) { - checkComputedPropertyName(name_22); + if (property.kind === 260 || property.kind === 261) { + var name = property.name; + if (name.kind === 143) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_22)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_22); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 258) { + if (property.kind === 261) { return checkDestructuringAssignment(property, type); } else { @@ -32110,10 +34588,13 @@ var ts; } } else { - error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 259) { + else if (property.kind === 262) { + if (languageVersion < 5) { + checkExternalEmitHelpers(property, 4); + } var nonRestNames = []; if (allProperties) { for (var i = 0; i < allProperties.length - 1; i++) { @@ -32127,19 +34608,22 @@ var ts; error(property, ts.Diagnostics.Property_assignment_expected); } } - function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { - var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; + function checkArrayLiteralAssignment(node, sourceType, checkMode) { + if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512); + } + var elementType = checkIteratedTypeOrElementType(sourceType, node, false, false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } return sourceType; } - function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198) { - if (element.kind !== 196) { + if (element.kind !== 199) { + if (element.kind !== 197) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -32147,7 +34631,7 @@ var ts; ? getTypeOfPropertyOfType(sourceType, propName) : elementType; if (type) { - return checkDestructuringAssignment(element, type, contextualMapper); + return checkDestructuringAssignment(element, type, checkMode); } else { checkExpression(element); @@ -32165,48 +34649,48 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) { + if (restExpression.kind === 193 && restExpression.operatorToken.kind === 57) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { - return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); + return checkDestructuringAssignment(restExpression, createArrayType(elementType), checkMode); } } } } return undefined; } - function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 258) { + if (exprOrAssignment.kind === 261) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048)) { sourceType = getTypeWithFacts(sourceType, 131072); } - checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode); } target = exprOrAssignment.name; } else { target = exprOrAssignment; } - if (target.kind === 192 && target.operatorToken.kind === 57) { - checkBinaryExpression(target, contextualMapper); + if (target.kind === 193 && target.operatorToken.kind === 57) { + checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 176) { + if (target.kind === 177) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175) { - return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + if (target.kind === 176) { + return checkArrayLiteralAssignment(target, sourceType, checkMode); } - return checkReferenceAssignment(target, sourceType, contextualMapper); + return checkReferenceAssignment(target, sourceType, checkMode); } - function checkReferenceAssignment(target, sourceType, contextualMapper) { - var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 ? + function checkReferenceAssignment(target, sourceType, checkMode) { + var targetType = checkExpression(target, checkMode); + var error = target.parent.kind === 262 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -32220,35 +34704,35 @@ var ts; case 70: case 9: case 11: - case 181: - case 194: + case 182: + case 195: case 12: case 8: case 100: case 85: case 94: - case 137: - case 184: - case 197: + case 138: case 185: - case 175: + case 198: + case 186: case 176: - case 187: - case 201: - case 247: - case 246: + case 177: + case 188: + case 202: + case 249: + case 248: return true; - case 193: + case 194: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192: + case 193: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190: case 191: + case 192: switch (node.operator) { case 50: case 36: @@ -32257,9 +34741,9 @@ var ts; return true; } return false; - case 188: - case 182: - case 200: + case 189: + case 183: + case 201: default: return false; } @@ -32274,16 +34758,16 @@ var ts; firstAssignableToSecond && !secondAssignableToFirst ? type2 : getUnionType([type1, type2], true); } - function checkBinaryExpression(node, contextualMapper) { - return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + function checkBinaryExpression(node, checkMode) { + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, checkMode, node); } - function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 57 && (left.kind === 176 || left.kind === 175)) { - return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); + if (operator === 57 && (left.kind === 177 || left.kind === 176)) { + return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } - var leftType = checkExpression(left, contextualMapper); - var rightType = checkExpression(right, contextualMapper); + var leftType = checkExpression(left, checkMode); + var rightType = checkExpression(right, checkMode); switch (operator) { case 38: case 39: @@ -32310,12 +34794,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; if ((leftType.flags & 136) && (rightType.flags & 136) && @@ -32335,12 +34815,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 | 262178) && !isTypeOfKind(rightType, 1 | 262178)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) { resultType = numberType; @@ -32369,8 +34847,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -32406,11 +34884,14 @@ var ts; checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 25: - if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) { error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType; } + function isEvalNode(node) { + return node.kind === 70 && node.text === "eval"; + } function checkForDisallowedESSymbolOperand(operator) { var offendingSymbolOperand = maybeTypeOfKind(leftType, 512) ? left : maybeTypeOfKind(rightType, 512) ? right : @@ -32464,7 +34945,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 131072) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -32473,30 +34954,45 @@ var ts; } if (node.expression) { var func = ts.getContainingFunction(node); - if (func && func.asteriskToken) { + var functionFlags = func && ts.getFunctionFlags(func); + if (node.asteriskToken) { + if (functionFlags & 2) { + if (languageVersion < 4) { + checkExternalEmitHelpers(node, 4096); + } + } + else if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256); + } + } + if (functionFlags & 1) { var expressionType = checkExpressionCached(node.expression, undefined); var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { - expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); + expressionElementType = checkIteratedTypeOrElementType(expressionType, node.expression, false, (functionFlags & 2) !== 0); } if (func.type) { - var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; + var signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(func.type), (functionFlags & 2) !== 0) || anyType; if (nodeIsYieldStar) { - checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(functionFlags & 2 + ? getAwaitedType(expressionElementType, node.expression, ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionElementType, signatureElementType, node.expression, undefined); } else { - checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(functionFlags & 2 + ? getAwaitedType(expressionType, node.expression, ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionType, signatureElementType, node.expression, undefined); } } } } return anyType; } - function checkConditionalExpression(node, contextualMapper) { + function checkConditionalExpression(node, checkMode) { checkExpression(node.condition); - var type1 = checkExpression(node.whenTrue, contextualMapper); - var type2 = checkExpression(node.whenFalse, contextualMapper); + var type1 = checkExpression(node.whenTrue, checkMode); + var type2 = checkExpression(node.whenFalse, checkMode); return getBestChoiceType(type1, type2); } function checkLiteralExpression(node) { @@ -32522,107 +35018,119 @@ var ts; } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var saveContextualType = node.contextualType; + var saveContextualMapper = node.contextualMapper; node.contextualType = contextualType; - var result = checkExpression(node, contextualMapper); + node.contextualMapper = contextualMapper; + var checkMode = contextualMapper === identityMapper ? 1 : + contextualMapper ? 2 : 0; + var result = checkExpression(node, checkMode); node.contextualType = saveContextualType; + node.contextualMapper = saveContextualMapper; return result; } - function checkExpressionCached(node, contextualMapper) { + function checkExpressionCached(node, checkMode) { var links = getNodeLinks(node); if (!links.resolvedType) { var saveFlowLoopStart = flowLoopStart; flowLoopStart = flowLoopCount; - links.resolvedType = checkExpression(node, contextualMapper); + links.resolvedType = checkExpression(node, checkMode); flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 || node.kind === 200; + return node.kind === 183 || node.kind === 201; } function checkDeclarationInitializer(declaration) { - var type = checkExpressionCached(declaration.initializer); + var type = getTypeOfExpression(declaration.initializer, true); return ts.getCombinedNodeFlags(declaration) & 2 || ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); - if (apparentType.flags & (2 | 4 | 8 | 16)) { + if (contextualType.flags & 540672) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + if (constraint.flags & (2 | 4 | 8 | 16)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 | 262144)); } return false; } - function checkExpressionForMutableLocation(node, contextualMapper) { - var type = checkExpression(node, contextualMapper); + function checkExpressionForMutableLocation(node, checkMode) { + var type = checkExpression(node, checkMode); return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } - function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 142) { + function checkPropertyAssignment(node, checkMode) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } - return checkExpressionForMutableLocation(node.initializer, contextualMapper); + return checkExpressionForMutableLocation(node.initializer, checkMode); } - function checkObjectLiteralMethod(node, contextualMapper) { + function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } - var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } - function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (isInferentialContext(contextualMapper)) { + function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { + if (checkMode === 2) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { - return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, getContextualMapper(node))); } } } } return type; } - function getTypeOfExpression(node) { - if (node.kind === 179 && node.expression.kind !== 96) { + function getTypeOfExpression(node, cache) { + if (node.kind === 180 && node.expression.kind !== 96 && !ts.isRequireCall(node, true)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { return getReturnTypeOfSignature(signature); } } - return checkExpression(node); + return cache ? checkExpressionCached(node) : checkExpression(node); + } + function getContextFreeTypeOfExpression(node) { + var saveContextualType = node.contextualType; + node.contextualType = anyType; + var type = getTypeOfExpression(node); + node.contextualType = saveContextualType; + return type; } - function checkExpression(node, contextualMapper) { + function checkExpression(node, checkMode) { var type; - if (node.kind === 141) { + if (node.kind === 142) { type = checkQualifiedName(node); } else { - var uninstantiatedType = checkExpressionWorker(node, contextualMapper); - type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkExpressionWorker(node, checkMode); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 177 && node.parent.expression === node) || - (node.parent.kind === 178 && node.parent.expression === node) || - ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 && node.parent.expression === node) || + (node.parent.kind === 179 && node.parent.expression === node) || + ((node.kind === 70 || node.kind === 142) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } } return type; } - function checkExpressionWorker(node, contextualMapper) { + function checkExpressionWorker(node, checkMode) { switch (node.kind) { case 70: return checkIdentifier(node); @@ -32637,66 +35145,70 @@ var ts; case 100: case 85: return checkLiteralExpression(node); - case 194: + case 195: return checkTemplateExpression(node); case 12: return stringType; case 11: return globalRegExpType; - case 175: - return checkArrayLiteral(node, contextualMapper); case 176: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, checkMode); case 177: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, checkMode); case 178: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 179: + return checkIndexedAccess(node); case 180: - return checkCallExpression(node); case 181: + return checkCallExpression(node); + case 182: return checkTaggedTemplateExpression(node); - case 183: - return checkExpression(node.expression, contextualMapper); - case 197: - return checkClassExpression(node); case 184: + return checkExpression(node.expression, checkMode); + case 198: + return checkClassExpression(node); case 185: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187: + case 186: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 188: return checkTypeOfExpression(node); - case 182: - case 200: - return checkAssertion(node); + case 183: case 201: + return checkAssertion(node); + case 202: return checkNonNullAssertion(node); - case 186: + case 203: + return checkMetaProperty(node); + case 187: return checkDeleteExpression(node); - case 188: - return checkVoidExpression(node); case 189: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 190: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 191: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 192: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 193: - return checkConditionalExpression(node, contextualMapper); - case 196: - return checkSpreadExpression(node, contextualMapper); - case 198: + return checkBinaryExpression(node, checkMode); + case 194: + return checkConditionalExpression(node, checkMode); + case 197: + return checkSpreadExpression(node, checkMode); + case 199: return undefinedWideningType; - case 195: + case 196: return checkYieldExpression(node); - case 252: - return checkJsxExpression(node); - case 246: + case 255: + return checkJsxExpression(node, checkMode); + case 248: return checkJsxElement(node); - case 247: + case 249: return checkJsxSelfClosingElement(node); - case 248: + case 253: + return checkJsxAttributes(node, checkMode); + case 250: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -32706,7 +35218,16 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); - getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); + checkSourceElement(node.default); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } + var constraintType = getConstraintOfTypeParameter(typeParameter); + var defaultType = getDefaultFromTypeParameter(typeParameter); + if (constraintType && defaultType) { + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } @@ -32717,7 +35238,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -32728,7 +35249,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 || func.kind === 154 || func.kind === 159) { + if (func.kind === 151 || func.kind === 155 || func.kind === 160) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -32736,14 +35257,6 @@ var ts; error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } } - function isSyntacticallyValidGenerator(node) { - if (!node.asteriskToken || !node.body) { - return false; - } - return node.kind === 149 || - node.kind === 225 || - node.kind === 184; - } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { @@ -32783,9 +35296,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_23 = _a[_i].name; - if (ts.isBindingPattern(name_23) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -32798,16 +35311,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 186: + case 154: + case 227: case 185: - case 153: - case 225: - case 184: - case 158: + case 159: + case 150: case 149: - case 148: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -32817,29 +35330,44 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_24 = element.name; - if (name_24.kind === 70 && - name_24.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_24.kind === 173 || - name_24.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 || + name.kind === 173) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 155) { + if (node.kind === 156) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 225 || node.kind === 159 || - node.kind === 153 || node.kind === 150 || - node.kind === 154) { + else if (node.kind === 159 || node.kind === 227 || node.kind === 160 || + node.kind === 154 || node.kind === 151 || + node.kind === 155) { checkGrammarFunctionLikeDeclaration(node); } + var functionFlags = ts.getFunctionFlags(node); + if ((functionFlags & 7) === 2 && languageVersion < 4) { + checkExternalEmitHelpers(node, 64); + if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } + if ((functionFlags & 5) === 1) { + if (functionFlags & 2 && languageVersion < 4) { + checkExternalEmitHelpers(node, 2048); + } + else if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -32847,29 +35375,32 @@ var ts; } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); - if (compilerOptions.noImplicitAny && !node.type) { + if (noImplicitAny && !node.type) { switch (node.kind) { - case 154: + case 155: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153: + case 154: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } } if (node.type) { - if (languageVersion >= 2 && isSyntacticallyValidGenerator(node)) { + var functionFlags_1 = ts.getFunctionFlags(node); + if ((functionFlags_1 & 5) === 1) { var returnType = getTypeFromTypeNode(node.type); if (returnType === voidType) { error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); } else { - var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType; - var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType); + var generatorElementType = getIteratedTypeOfGenerator(returnType, (functionFlags_1 & 2) !== 0) || anyType; + var iterableIteratorInstantiation = functionFlags_1 & 2 + ? createAsyncIterableIteratorType(generatorElementType) + : createIterableIteratorType(generatorElementType); checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } - else if (ts.isAsyncFunctionLike(node)) { + else if ((functionFlags_1 & 3) === 2) { checkAsyncFunctionReturnType(node); } } @@ -32879,11 +35410,18 @@ var ts; } } function checkClassForDuplicateDeclarations(node) { + var Declaration; + (function (Declaration) { + Declaration[Declaration["Getter"] = 1] = "Getter"; + Declaration[Declaration["Setter"] = 2] = "Setter"; + Declaration[Declaration["Method"] = 4] = "Method"; + Declaration[Declaration["Property"] = 3] = "Property"; + })(Declaration || (Declaration = {})); var instanceNames = ts.createMap(); var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -32892,36 +35430,65 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; }); + var isStatic = ts.getModifierFlags(member) & 32; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151: + case 152: addName(names, member.name, memberName, 1); break; - case 152: + case 153: addName(names, member.name, memberName, 2); break; - case 147: + case 148: addName(names, member.name, memberName, 3); break; + case 150: + addName(names, member.name, memberName, 4); + break; } } } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4) { + if (meaning !== 4) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -32929,7 +35496,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146) { + if (member.kind === 147) { var memberName = void 0; switch (member.name.kind) { case 9: @@ -32940,18 +35507,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227) { + if (node.kind === 229) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -32966,7 +35533,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134: + case 135: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -33033,12 +35600,12 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 225) { + else if (n.kind !== 185 && n.kind !== 227) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 && + return n.kind === 148 && !(ts.getModifierFlags(n) & 32) && !!n.initializer; } @@ -33058,7 +35625,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -33081,18 +35648,18 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151) { + if (node.kind === 152) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) { if (!(node.flags & 256)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 151 ? 152 : 151; + var otherKind = node.kind === 152 ? 153 : 152; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) { @@ -33106,17 +35673,12 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151) { + if (node.kind === 152) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } - else { - checkNodeDeferred(node); - } + checkSourceElement(node.body); + registerForUnusedIdentifiersCheck(node); } function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { var firstType = getAnnotatedType(first); @@ -33125,14 +35687,11 @@ var ts; error(first, message); } } - function checkAccessorDeferred(node) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } function checkMissingDeclaration(node) { checkDecorators(node); } function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); var typeArguments; var mapper; var result = true; @@ -33140,7 +35699,7 @@ var ts; var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { if (!typeArguments) { - typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + typeArguments = fillMissingTypeArguments(ts.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, minTypeArgumentCount); mapper = createTypeMapper(typeParameters, typeArguments); } var typeArgument = typeArguments[i]; @@ -33191,25 +35750,42 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288)) { + return type; + } + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + if (maybeTypeOfKind(objectType, 540672) && isTypeOfKind(indexType, 340)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 227 && - n.parent.kind !== 226 && - n.parent.kind !== 197 && + if (n.parent.kind !== 229 && + n.parent.kind !== 228 && + n.parent.kind !== 198 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -33286,7 +35862,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 149 || node.kind === 148) && + var reportError = (node.kind === 150 || node.kind === 149) && (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32); if (reportError) { var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -33315,15 +35891,15 @@ var ts; } var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { - var current = declarations_4[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var current = declarations_5[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 || node.parent.kind === 162 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 227 || node.kind === 150 || node.kind === 149 || node.kind === 151) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -33374,8 +35950,8 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; + for (var _a = 0, signatures_4 = signatures; _a < signatures_4.length; _a++) { + var signature = signatures_4[_a]; if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -33434,16 +36010,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227: + case 229: return 2097152; - case 230: + case 232: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 226: - case 229: + case 228: + case 231: return 2097152 | 1048576; - case 234: + case 236: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -33453,87 +36029,92 @@ var ts; } } } - function checkNonThenableType(type, location, message) { - type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { - if (location) { - if (!message) { - message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; - } - error(location, message); - } - return unknownType; - } - return type; + function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage) { + var promisedType = getPromisedTypeOfPromise(type, errorNode); + return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage); } - function getPromisedType(promise) { + function getPromisedTypeOfPromise(promise, errorNode) { if (isTypeAny(promise)) { return undefined; } - if (getObjectFlags(promise) & 4) { - if (promise.target === tryGetGlobalPromiseType() - || promise.target === getGlobalPromiseLikeType()) { - return promise.typeArguments[0]; - } + var typeAsPromise = promise; + if (typeAsPromise.promisedTypeOfPromise) { + return typeAsPromise.promisedTypeOfPromise; } - var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType(); - if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) { - return undefined; + if (isReferenceToType(promise, getGlobalPromiseType(false))) { + return typeAsPromise.promisedTypeOfPromise = promise.typeArguments[0]; } var thenFunction = getTypeOfPropertyOfType(promise, "then"); - if (!thenFunction || isTypeAny(thenFunction)) { + if (isTypeAny(thenFunction)) { return undefined; } - var thenSignatures = getSignaturesOfType(thenFunction, 0); + var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : emptyArray; if (thenSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method); + } return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288); if (isTypeAny(onfulfilledParameterType)) { return undefined; } var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0); if (onfulfilledParameterSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + } return undefined; } - return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true); + return typeAsPromise.promisedTypeOfPromise = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true); } - function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; - } - function getAwaitedType(type) { - return checkAwaitedType(type, undefined, undefined); + function checkAwaitedType(type, errorNode, diagnosticMessage) { + return getAwaitedType(type, errorNode, diagnosticMessage) || unknownType; } - function checkAwaitedType(type, location, message) { - return checkAwaitedTypeWorker(type); - function checkAwaitedTypeWorker(type) { - if (type.flags & 65536) { - var types = []; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var constituentType = _a[_i]; - types.push(checkAwaitedTypeWorker(constituentType)); - } - return getUnionType(types, true); + function getAwaitedType(type, errorNode, diagnosticMessage) { + var typeAsAwaitable = type; + if (typeAsAwaitable.awaitedTypeOfType) { + return typeAsAwaitable.awaitedTypeOfType; + } + if (isTypeAny(type)) { + return typeAsAwaitable.awaitedTypeOfType = type; + } + if (type.flags & 65536) { + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var constituentType = _a[_i]; + types = ts.append(types, getAwaitedType(constituentType, errorNode, diagnosticMessage)); } - else { - var promisedType = getPromisedType(type); - if (promisedType === undefined) { - return checkNonThenableType(type, location, message); - } - else { - if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { - if (location) { - error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); - } - return unknownType; - } - awaitedTypeStack.push(type.id); - var awaitedType = checkAwaitedTypeWorker(promisedType); - awaitedTypeStack.pop(); - return awaitedType; + if (!types) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, true); + } + var promisedType = getPromisedTypeOfPromise(type); + if (promisedType) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); } + return undefined; } + awaitedTypeStack.push(type.id); + var awaitedType = getAwaitedType(promisedType, errorNode, diagnosticMessage); + awaitedTypeStack.pop(); + if (!awaitedType) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = awaitedType; + } + var thenFunction = getTypeOfPropertyOfType(type, "then"); + if (thenFunction && getSignaturesOfType(thenFunction, 0).length > 0) { + if (errorNode) { + ts.Debug.assert(!!diagnosticMessage); + error(errorNode, diagnosticMessage); + } + return undefined; } + return typeAsAwaitable.awaitedTypeOfType = type; } function checkAsyncFunctionReturnType(node) { var returnType = getTypeFromTypeNode(node.type); @@ -33541,8 +36122,8 @@ var ts; if (returnType === unknownType) { return unknownType; } - var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) { + var globalPromiseType = getGlobalPromiseType(true); + if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) { error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); return unknownType; } @@ -33560,10 +36141,15 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 && promiseConstructorName.text === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } - var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(true); if (globalPromiseConstructorLikeType === emptyObjectType) { error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); return unknownType; @@ -33578,7 +36164,7 @@ var ts; return unknownType; } } - return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return checkAwaitedType(returnType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkDecorator(node) { var signature = getResolvedSignature(node); @@ -33590,22 +36176,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226: + case 228: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147: + case 148: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149: - case 151: + case 150: case 152: + case 153: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -33624,6 +36210,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } function checkDecorators(node) { if (!node.decorators) { return; @@ -33634,28 +36223,36 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8); + if (node.kind === 145) { + checkExternalEmitHelpers(firstDecorator, 32); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 226: + case 228: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; - case 149: - case 151: + case 150: case 152: + case 153: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147: - case 144: + case 148: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; + case 145: markTypeNodeAsReferenced(node.type); break; } @@ -33667,6 +36264,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -33674,8 +36272,8 @@ var ts; function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); - var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 142) { + var functionFlags = ts.getFunctionFlags(node); + if (node.name && node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -33693,15 +36291,17 @@ var ts; } } checkSourceElement(node.body); - if (!node.asteriskToken) { - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if ((functionFlags & 1) === 0) { + var returnOrPromisedType = node.type && (functionFlags & 2 + ? checkAsyncFunctionReturnType(node) + : getTypeFromTypeNode(node.type)); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { - if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { + if (noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } - if (node.asteriskToken && ts.nodeIsPresent(node.body)) { + if (functionFlags & 1 && ts.nodeIsPresent(node.body)) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } } @@ -33717,56 +36317,54 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261: - case 230: + case 264: + case 232: checkUnusedModuleMembers(node); break; - case 226: - case 197: + case 228: + case 198: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227: + case 229: checkUnusedTypeParameters(node); break; - case 204: - case 232: - case 211: - case 212: + case 206: + case 234: case 213: + case 214: + case 215: checkUnusedLocalsAndParameters(node); break; - case 150: - case 184: - case 225: - case 185: - case 149: case 151: + case 185: + case 227: + case 186: + case 150: case 152: + case 153: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148: - case 153: + case 149: case 154: case 155: - case 158: + case 156: case 159: + case 160: checkUnusedTypeParameters(node); break; } - ; } } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -33779,22 +36377,28 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_3(key); - } + }); } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 && - (declaration.parent.parent.kind === 212 || - declaration.parent.parent.kind === 213)) { + if (declaration.kind === 225 && + (declaration.parent.parent.kind === 214 || + declaration.parent.parent.kind === 215)) { return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -33807,12 +36411,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 || member.kind === 147) { + if (member.kind === 150 || member.kind === 148) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150) { + else if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) { @@ -33843,21 +36447,20 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } - } + }); } } function checkBlock(node) { - if (node.kind === 204) { + if (node.kind === 206) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -33879,19 +36482,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 || - node.kind === 146 || + if (node.kind === 148 || + node.kind === 147 || + node.kind === 150 || node.kind === 149 || - node.kind === 148 || - node.kind === 151 || - node.kind === 152) { + node.kind === 152 || + node.kind === 153) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -33901,9 +36504,13 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } function checkIfThisIsCapturedInEnclosingScope(node) { - var current = node; - while (current) { + ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4) { var isDeclaration_1 = node.kind !== 70; if (isDeclaration_1) { @@ -33912,10 +36519,23 @@ var ts; else { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); } - return; + return true; } - current = current.parent; - } + }); + } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + ts.findAncestor(node, function (current) { + if (getNodeCheckFlags(current) & 8) { + var isDeclaration_2 = node.kind !== 70; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return true; + } + }); } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { @@ -33926,8 +36546,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -33942,23 +36562,23 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 264 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192) { + if (parent.kind === 264 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -33966,7 +36586,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 223 && !node.initializer) { + if (node.kind === 225 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -33976,25 +36596,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224); - var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226); + var container = varDeclList.parent.kind === 207 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 204 && ts.isFunctionLike(container.parent) || - container.kind === 231 || - container.kind === 230 || - container.kind === 261); + (container.kind === 206 && ts.isFunctionLike(container.parent) || + container.kind === 233 || + container.kind === 232 || + container.kind === 264); if (!namesShareScope) { - var name_25 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144) { + if (ts.getRootDeclaration(node).kind !== 145) { return; } var func = ts.getContainingFunction(node); @@ -34003,7 +36623,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 177) { + if (n.kind === 178) { return visit(n.expression); } else if (n.kind === 70) { @@ -34017,21 +36637,21 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144) { + if (symbol.valueDeclaration.kind === 145 || + symbol.valueDeclaration.kind === 175) { if (symbol.valueDeclaration.pos < node.pos) { return; } - var current = n; - while (current !== node.initializer) { - if (ts.isFunctionLike(current.parent)) { - return; - } - if (current.parent.kind === 147 && - !(ts.hasModifier(current.parent, 32)) && - ts.isClassLike(current.parent.parent)) { - return; + if (ts.findAncestor(n, function (current) { + if (current === node.initializer) { + return "quit"; } - current = current.parent; + return ts.isFunctionLike(current.parent) || + (current.parent.kind === 148 && + !(ts.hasModifier(current.parent, 32)) && + ts.isClassLike(current.parent.parent)); + })) { + return; } } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); @@ -34048,34 +36668,40 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174) { - if (node.propertyName && node.propertyName.kind === 142) { + if (node.kind === 175) { + if (node.parent.kind === 173 && languageVersion < 5) { + checkExternalEmitHelpers(node, 4); + } + if (node.propertyName && node.propertyName.kind === 143) { checkComputedPropertyName(node.propertyName); } - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); - var name_26 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent.initializer && property) { + checkPropertyAccessibility(parent, parent.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { + if (node.name.kind === 174 && languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512); + } ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -34084,7 +36710,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -34102,20 +36728,21 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 && node.kind !== 146) { + if (node.kind !== 148 && node.kind !== 147) { checkExportsOnMergedDeclarations(node); - if (node.kind === 223 || node.kind === 174) { + if (node.kind === 225 || node.kind === 175) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 223) || - (left.kind === 223 && right.kind === 144)) { + if ((left.kind === 145 && right.kind === 225) || + (left.kind === 225 && right.kind === 145)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -34142,8 +36769,8 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 176) { - if (ts.isAsyncFunctionLike(node)) { + if (node.modifiers && node.parent.kind === 177) { + if (ts.getFunctionFlags(node) & 2) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } @@ -34161,7 +36788,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206) { + if (node.thenStatement.kind === 208) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -34178,12 +36805,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224) { + if (node.initializer && node.initializer.kind === 226) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224) { + if (node.initializer.kind === 226) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -34201,13 +36828,23 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 224) { + if (node.kind === 215) { + if (node.awaitModifier) { + if (languageVersion < 4) { + checkExternalEmitHelpers(node, 8192); + } + } + else if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256); + } + } + if (node.initializer.kind === 226) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 175 || varExpr.kind === 176) { + var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); + if (varExpr.kind === 176 || varExpr.kind === 177) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -34226,7 +36863,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 226) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -34236,7 +36873,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -34246,7 +36883,7 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -34261,161 +36898,199 @@ var ts; checkVariableDeclaration(decl); } } - function checkRightHandSideOfForOf(rhsExpression) { + function checkRightHandSideOfForOf(rhsExpression, awaitModifier) { var expressionType = checkNonNullExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, true, awaitModifier !== undefined); } - function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { + function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable) { if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= 2) { - return checkElementTypeOfIterable(inputType, errorNode); + return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, true) || anyType; + } + function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, checkAssignability) { + var uplevelIteration = languageVersion >= 2; + var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; + if (uplevelIteration || downlevelIteration || allowAsyncIterable) { + var iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterable, allowAsyncIterable, checkAssignability); + if (iteratedType || uplevelIteration) { + return iteratedType; + } } + var arrayType = inputType; + var reportedError = false; + var hasStringConstituent = false; if (allowStringInput) { - return checkElementTypeOfArrayOrString(inputType, errorNode); - } - if (isArrayLikeType(inputType)) { - var indexType = getIndexTypeOfType(inputType, 1); - if (indexType) { - return indexType; + if (arrayType.flags & 65536) { + var arrayTypes = inputType.types; + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); + if (filteredTypes !== arrayTypes) { + arrayType = getUnionType(filteredTypes, true); + } + } + else if (arrayType.flags & 262178) { + arrayType = neverType; + } + hasStringConstituent = arrayType !== inputType; + if (hasStringConstituent) { + if (languageVersion < 1) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + } + if (arrayType.flags & 8192) { + return stringType; + } } } - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (!isArrayLikeType(arrayType)) { + if (errorNode && !reportedError) { + var diagnostic = !allowStringInput || hasStringConstituent + ? downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type + : downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(errorNode, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : undefined; } - return unknownType; - } - function checkElementTypeOfIterable(iterable, errorNode) { - var elementType = getElementTypeOfIterable(iterable, errorNode); - if (errorNode && elementType) { - checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode); + var arrayElementType = getIndexTypeOfType(arrayType, 1); + if (hasStringConstituent && arrayElementType) { + if (arrayElementType.flags & 262178) { + return stringType; + } + return getUnionType([arrayElementType, stringType], true); } - return elementType || anyType; + return arrayElementType; } - function getElementTypeOfIterable(type, errorNode) { + function getIteratedTypeOfIterable(type, errorNode, isAsyncIterable, allowNonAsyncIterables, checkAssignability) { if (isTypeAny(type)) { return undefined; } var typeAsIterable = type; - if (!typeAsIterable.iterableElementType) { - if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableType()) { - typeAsIterable.iterableElementType = type.typeArguments[0]; + if (isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable) { + return isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable; + } + if (isAsyncIterable) { + if (isReferenceToType(type, getGlobalAsyncIterableType(false)) || + isReferenceToType(type, getGlobalAsyncIterableIteratorType(false))) { + return typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0]; } - else { - var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); - if (isTypeAny(iteratorFunction)) { - return undefined; - } - var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0) : emptyArray; - if (iteratorFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); - } - return undefined; - } - typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), true), errorNode); + } + if (!isAsyncIterable || allowNonAsyncIterables) { + if (isReferenceToType(type, getGlobalIterableType(false)) || + isReferenceToType(type, getGlobalIterableIteratorType(false))) { + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0] + : typeAsIterable.iteratedTypeOfIterable = type.typeArguments[0]; } } - return typeAsIterable.iterableElementType; - } - function getElementTypeOfIterator(type, errorNode) { - if (isTypeAny(type)) { - return undefined; + var iteratorMethodSignatures; + var mayBeIterable = false; + if (isAsyncIterable) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("asyncIterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; + } + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0); } - var typeAsIterator = type; - if (!typeAsIterator.iteratorElementType) { - if ((getObjectFlags(type) & 4) && type.target === getGlobalIteratorType()) { - typeAsIterator.iteratorElementType = type.typeArguments[0]; + if (!isAsyncIterable || (allowNonAsyncIterables && !ts.some(iteratorMethodSignatures))) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; } - else { - var iteratorNextFunction = getTypeOfPropertyOfType(type, "next"); - if (isTypeAny(iteratorNextFunction)) { - return undefined; - } - var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0) : emptyArray; - if (iteratorNextFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method); - } - return undefined; - } - var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), true); - if (isTypeAny(iteratorNextResult)) { - return undefined; - } - var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); - if (!iteratorNextValue) { - if (errorNode) { - error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); - } - return undefined; - } - typeAsIterator.iteratorElementType = iteratorNextValue; + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0); + mayBeIterable = true; + } + if (ts.some(iteratorMethodSignatures)) { + var iteratorMethodReturnType = getUnionType(ts.map(iteratorMethodSignatures, getReturnTypeOfSignature), true); + var iteratedType = getIteratedTypeOfIterator(iteratorMethodReturnType, errorNode, false); + if (checkAssignability && errorNode && iteratedType) { + checkTypeAssignableTo(type, mayBeIterable + ? createIterableType(iteratedType) + : createAsyncIterableType(iteratedType), errorNode); } + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType + : typeAsIterable.iteratedTypeOfIterable = iteratedType; } - return typeAsIterator.iteratorElementType; + if (errorNode) { + error(errorNode, isAsyncIterable + ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); + } + return undefined; } - function getElementTypeOfIterableIterator(type) { + function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (isTypeAny(type)) { return undefined; } - if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableIteratorType()) { - return type.typeArguments[0]; + var typeAsIterator = type; + if (isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator) { + return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator; } - return getElementTypeOfIterable(type, undefined) || - getElementTypeOfIterator(type, undefined); - } - function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { - ts.Debug.assert(languageVersion < 2); - var arrayType = arrayOrStringType; - if (arrayOrStringType.flags & 65536) { - var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); - if (filteredTypes !== arrayTypes) { - arrayType = getUnionType(filteredTypes, true); - } + var getIteratorType = isAsyncIterator ? getGlobalAsyncIteratorType : getGlobalIteratorType; + if (isReferenceToType(type, getIteratorType(false))) { + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = type.typeArguments[0] + : typeAsIterator.iteratedTypeOfIterator = type.typeArguments[0]; } - else if (arrayOrStringType.flags & 262178) { - arrayType = neverType; + var nextMethod = getTypeOfPropertyOfType(type, "next"); + if (isTypeAny(nextMethod)) { + return undefined; } - var hasStringConstituent = arrayOrStringType !== arrayType; - var reportedError = false; - if (hasStringConstituent) { - if (languageVersion < 1) { - error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - reportedError = true; - } - if (arrayType.flags & 8192) { - return stringType; + var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0) : emptyArray; + if (nextMethodSignatures.length === 0) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.An_async_iterator_must_have_a_next_method + : ts.Diagnostics.An_iterator_must_have_a_next_method); } + return undefined; } - if (!isArrayLikeType(arrayType)) { - if (!reportedError) { - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; - error(errorNode, diagnostic, typeToString(arrayType)); + var nextResult = getUnionType(ts.map(nextMethodSignatures, getReturnTypeOfSignature), true); + if (isTypeAny(nextResult)) { + return undefined; + } + if (isAsyncIterator) { + nextResult = getAwaitedTypeOfPromise(nextResult, errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property); + if (isTypeAny(nextResult)) { + return undefined; } - return hasStringConstituent ? stringType : unknownType; } - var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; - if (hasStringConstituent) { - if (arrayElementType.flags & 262178) { - return stringType; + var nextValue = nextResult && getTypeOfPropertyOfType(nextResult, "value"); + if (!nextValue) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property + : ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); } - return getUnionType([arrayElementType, stringType], true); + return undefined; } - return arrayElementType; + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = nextValue + : typeAsIterator.iteratedTypeOfIterator = nextValue; + } + function getIteratedTypeOfGenerator(returnType, isAsyncGenerator) { + if (isTypeAny(returnType)) { + return undefined; + } + return getIteratedTypeOfIterable(returnType, undefined, isAsyncGenerator, false, false) + || getIteratedTypeOfIterator(returnType, undefined, isAsyncGenerator); } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152))); + return !!(node.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { - var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + var unwrappedReturnType = (ts.getFunctionFlags(func) & 3) === 2 + ? getPromisedTypeOfPromise(returnType) + : returnType; return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 | 1); } function checkReturnStatement(node) { @@ -34431,40 +37106,41 @@ var ts; var returnType = getReturnTypeOfSignature(signature); if (strictNullChecks || node.expression || returnType.flags & 8192) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (func.asteriskToken) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1) { return; } - if (func.kind === 152) { + if (func.kind === 153) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { - if (ts.isAsyncFunctionLike(func)) { - var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (functionFlags & 2) { + var promisedType = getPromisedTypeOfPromise(returnType); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288) { + if (node.flags & 16384) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -34483,7 +37159,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 254 && !hasDuplicateDefaultClause) { + if (clause.kind === 257 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -34495,7 +37171,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253) { + if (produceDiagnostics && clause.kind === 256) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -34516,18 +37192,16 @@ var ts; } function checkLabeledStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - var current = node.parent; - while (current) { + ts.findAncestor(node.parent, function (current) { if (ts.isFunctionLike(current)) { - break; + return "quit"; } - if (current.kind === 219 && current.label.text === node.label.text) { + if (current.kind === 221 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); - break; + return true; } - current = current.parent; - } + }); } checkSourceElement(node.statement); } @@ -34554,14 +37228,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -34609,12 +37283,13 @@ var ts; if (!indexType) { return; } - if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + var propDeclaration = prop.valueDeclaration; + if (indexKind === 1 && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } var errorNode; - if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -34639,15 +37314,23 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + var seenDefault = false; + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { + if (node.default) { + seenDefault = true; + } + else if (seenDefault) { + error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + } for (var j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); @@ -34657,22 +37340,56 @@ var ts; } } } - function checkTypeParameterListsIdentical(node, symbol) { + function checkTypeParameterListsIdentical(symbol) { if (symbol.declarations.length === 1) { return; } - var firstDecl; - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 226 || declaration.kind === 227) { - if (!firstDecl) { - firstDecl = declaration; + var links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (declarations.length <= 1) { + return; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { + var name = symbolToString(symbol); + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); } - else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + function areTypeParametersIdentical(declarations, typeParameters) { + var maxTypeArgumentCount = ts.length(typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var numTypeParameters = ts.length(declaration.typeParameters); + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + return false; + } + for (var i = 0; i < numTypeParameters; i++) { + var source = declaration.typeParameters[i]; + var target = typeParameters[i]; + if (source.name.text !== target.symbol.name) { + return false; + } + var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); + var targetConstraint = getConstraintFromTypeParameter(target); + if ((sourceConstraint || targetConstraint) && + (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { + return false; + } + var sourceDefault = source.default && getTypeFromTypeNode(source.default); + var targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + return false; } } } + return true; } function checkClassExpression(node) { checkClassLikeDeclaration(node); @@ -34692,11 +37409,12 @@ var ts; registerForUnusedIdentifiersCheck(node); } function checkClassLikeDeclaration(node) { - checkGrammarClassDeclarationHeritageClauses(node); + checkGrammarClassLikeDeclaration(node); checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -34706,19 +37424,26 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); checkClassForDuplicateDeclarations(node); + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2) { + checkExternalEmitHelpers(baseTypeNode.parent, 1); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); - for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { + for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) { var constructor = _a[_i]; if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { break; @@ -34727,15 +37452,11 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && - !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226) { - if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { - error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); - } + if (baseConstructorType.flags & 540672 && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { - var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 540672)) { + var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } @@ -34754,8 +37475,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 ? t.target : t; - if (getObjectFlags(declaredType) & 3) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -34783,17 +37503,22 @@ var ts; } } function getTargetSymbol(s) { - return s.flags & 16777216 ? getSymbolLinks(s).target : s; + return getCheckFlags(s) & 1 ? s.target : s; } function getClassLikeDeclarationOfSymbol(symbol) { return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } + function getClassOrInterfaceDeclarationsOfSymbol(symbol) { + return ts.filter(symbol.declarations, function (d) { + return d.kind === 228 || d.kind === 229; + }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); - if (base.flags & 134217728) { + if (base.flags & 16777216) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); @@ -34803,7 +37528,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) { - if (derivedClassDecl.kind === 197) { + if (derivedClassDecl.kind === 198) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -34813,66 +37538,37 @@ var ts; } else { var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) { + if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) { continue; } if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) { continue; } - if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { + if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 && derived.flags & 98308) { continue; } var errorMessage = void 0; - if (base.flags & 8192) { + if (isMethodLike(base)) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert((derived.flags & 4) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & 4) { - ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert((base.flags & 98304) !== 0); - ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } - error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + error(derived.valueDeclaration.name || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } } } } function isAccessor(kind) { - return kind === 151 || kind === 152; - } - function areTypeParametersIdentical(list1, list2) { - if (!list1 && !list2) { - return true; - } - if (!list1 || !list2 || list1.length !== list2.length) { - return false; - } - for (var i = 0, len = list1.length; i < len; i++) { - var tp1 = list1[i]; - var tp2 = list2[i]; - if (tp1.name.text !== tp2.name.text) { - return false; - } - if (!tp1.constraint && !tp2.constraint) { - continue; - } - if (!tp1.constraint || !tp2.constraint) { - return false; - } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { - return false; - } - } - return true; + return kind === 152 || kind === 153; } function checkInheritedPropertiesAreIdentical(type, typeNode) { var baseTypes = getBaseTypes(type); @@ -34880,16 +37576,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; - var existing = seen[prop.name]; + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_8 = properties; _a < properties_8.length; _a++) { + var prop = properties_8[_a]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -34913,8 +37609,8 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227); + checkTypeParameterListsIdentical(symbol); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -35010,7 +37706,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190: + case 191: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -35021,7 +37717,7 @@ var ts; case 51: return ~value_1; } return undefined; - case 192: + case 193: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -35045,12 +37741,13 @@ var ts; } return undefined; case 8: + checkGrammarNumericLiteral(e); return +e.text; - case 183: + case 184: return evalConstant(e.expression); case 70: + case 179: case 178: - case 177: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -35061,7 +37758,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178) { + if (e.kind === 179) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -35078,7 +37775,7 @@ var ts; if (current.kind === 70) { break; } - else if (current.kind === 177) { + else if (current.kind === 178) { current = current.expression; } else { @@ -35118,6 +37815,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -35138,7 +37836,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 229) { + if (declaration.kind !== 231) { return false; } var enumDeclaration = declaration; @@ -35159,10 +37857,10 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { - var declaration = declarations_5[_i]; - if ((declaration.kind === 226 || - (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) && + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + if ((declaration.kind === 228 || + (declaration.kind === 227 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -35221,7 +37919,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 226); + var mergedClass = ts.getDeclarationOfKind(symbol, 228); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -35229,7 +37927,7 @@ var ts; } if (isAmbientExternalModule) { if (ts.isExternalModuleAugmentation(node)) { - var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432); + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 134217728); if (checkBody && node.body) { for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { var statement = _a[_i]; @@ -35264,42 +37962,42 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205: + case 207: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240: - case 241: + case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234: - case 235: + case 236: + case 237: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174: - case 223: - var name_27 = node.name; - if (ts.isBindingPattern(name_27)) { - for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { + case 175: + case 225: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 226: - case 229: - case 225: + case 228: + case 231: case 227: + case 229: + case 232: case 230: - case 228: if (isGlobalAugmentation) { return; } var symbol = getSymbolOfNode(node); if (symbol) { - var reportError = !(symbol.flags & 33554432); + var reportError = !(symbol.flags & 134217728); if (!reportError) { reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } @@ -35311,12 +38009,12 @@ var ts; switch (node.kind) { case 70: return node; - case 141: + case 142: do { node = node.left; } while (node.kind !== 70); return node; - case 177: + case 178: do { node = node.expression; } while (node.kind !== 70); @@ -35329,9 +38027,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 ? + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 264 && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -35352,7 +38050,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 ? + var message = node.kind === 245 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -35379,7 +38077,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 239) { checkImportBinding(importClause.namedBindings); } else { @@ -35430,8 +38128,10 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 264 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -35444,7 +38144,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230; + var isInAppropriateContext = node.parent.kind === 264 || node.parent.kind === 233 || node.parent.kind === 232; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -35467,9 +38167,14 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 261 ? node.parent : node.parent.parent; - if (container.kind === 230 && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 264 ? node.parent : node.parent.parent; + if (container.kind === 232 && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { @@ -35492,18 +38197,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -35511,31 +38211,31 @@ var ts; } } var exports_1 = getExportsOfModule(moduleSymbol); - for (var id in exports_1) { + exports_1 && exports_1.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports_1[id], declarations = _a.declarations, flags = _a.flags; if (flags & (1920 | 64 | 384)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 && exportedDeclarationsCount <= 2) { - continue; + return; } if (exportedDeclarationsCount > 1) { - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; if (isNotOverload(declaration)) { diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 && declaration.kind !== 149) || + return (declaration.kind !== 227 && declaration.kind !== 150) || !!declaration.body; } } @@ -35546,123 +38246,123 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 230: - case 226: + case 232: + case 228: + case 229: case 227: - case 225: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143: - return checkTypeParameter(node); case 144: + return checkTypeParameter(node); + case 145: return checkParameter(node); + case 148: case 147: - case 146: return checkPropertyDeclaration(node); - case 158: case 159: - case 153: + case 160: case 154: - return checkSignatureDeclaration(node); case 155: return checkSignatureDeclaration(node); + case 156: + return checkSignatureDeclaration(node); + case 150: case 149: - case 148: return checkMethodDeclaration(node); - case 150: - return checkConstructorDeclaration(node); case 151: + return checkConstructorDeclaration(node); case 152: + case 153: return checkAccessorDeclaration(node); - case 157: + case 158: return checkTypeReferenceNode(node); - case 156: + case 157: return checkTypePredicate(node); - case 160: - return checkTypeQuery(node); case 161: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 162: - return checkArrayType(node); + return checkTypeLiteral(node); case 163: - return checkTupleType(node); + return checkArrayType(node); case 164: + return checkTupleType(node); case 165: - return checkUnionOrIntersectionType(node); case 166: - case 168: - return checkSourceElement(node.type); + return checkUnionOrIntersectionType(node); + case 167: case 169: - return checkIndexedAccessType(node); + return checkSourceElement(node.type); case 170: + return checkIndexedAccessType(node); + case 171: return checkMappedType(node); - case 225: + case 227: return checkFunctionDeclaration(node); - case 204: - case 231: + case 206: + case 233: return checkBlock(node); - case 205: - return checkVariableStatement(node); case 207: - return checkExpressionStatement(node); - case 208: - return checkIfStatement(node); + return checkVariableStatement(node); case 209: - return checkDoStatement(node); + return checkExpressionStatement(node); case 210: - return checkWhileStatement(node); + return checkIfStatement(node); case 211: - return checkForStatement(node); + return checkDoStatement(node); case 212: - return checkForInStatement(node); + return checkWhileStatement(node); case 213: - return checkForOfStatement(node); + return checkForStatement(node); case 214: + return checkForInStatement(node); case 215: - return checkBreakOrContinueStatement(node); + return checkForOfStatement(node); case 216: - return checkReturnStatement(node); case 217: - return checkWithStatement(node); + return checkBreakOrContinueStatement(node); case 218: - return checkSwitchStatement(node); + return checkReturnStatement(node); case 219: - return checkLabeledStatement(node); + return checkWithStatement(node); case 220: - return checkThrowStatement(node); + return checkSwitchStatement(node); case 221: - return checkTryStatement(node); + return checkLabeledStatement(node); + case 222: + return checkThrowStatement(node); case 223: + return checkTryStatement(node); + case 225: return checkVariableDeclaration(node); - case 174: + case 175: return checkBindingElement(node); - case 226: + case 228: return checkClassDeclaration(node); - case 227: + case 229: return checkInterfaceDeclaration(node); - case 228: + case 230: return checkTypeAliasDeclaration(node); - case 229: + case 231: return checkEnumDeclaration(node); - case 230: + case 232: return checkModuleDeclaration(node); - case 235: + case 237: return checkImportDeclaration(node); - case 234: + case 236: return checkImportEqualsDeclaration(node); - case 241: + case 243: return checkExportDeclaration(node); - case 240: + case 242: return checkExportAssignment(node); - case 206: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 222: + case 224: checkGrammarStatementInAmbientContext(node); return; - case 244: + case 246: return checkMissingDeclaration(node); } } @@ -35675,17 +38375,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184: case 185: + case 186: + case 150: case 149: - case 148: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151: case 152: - checkAccessorDeferred(node); + case 153: + checkAccessorDeclaration(node); break; - case 197: + case 198: checkClassExpressionDeferred(node); break; } @@ -35705,6 +38405,7 @@ var ts; } checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -35724,6 +38425,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1; } } @@ -35768,7 +38473,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 && node.parent.statement === node) { + if (node.parent.kind === 219 && node.parent.statement === node) { return true; } node = node.parent; @@ -35777,11 +38482,11 @@ var ts; return false; } function getSymbolsInScope(location, meaning) { - var symbols = ts.createMap(); - var memberFlags = 0; if (isInsideWithStatementBody(location)) { return []; } + var symbols = ts.createMap(); + var memberFlags = 0; populateSymbols(); return symbolsToArray(symbols); function populateSymbols() { @@ -35790,28 +38495,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261: + case 264: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: + case 232: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 229: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 197: + case 198: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 226: - case 227: + case 228: + case 229: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } break; - case 184: + case 185: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -35829,17 +38534,16 @@ var ts; function copySymbol(symbol, meaning) { if (symbol.flags & meaning) { var id = symbol.name; - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -35850,27 +38554,27 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143: - case 226: - case 227: + case 144: case 228: case 229: + case 230: + case 231: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141) { + while (node.parent && node.parent.kind === 142) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 272); + return node.parent && (node.parent.kind === 158 || node.parent.kind === 276); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177) { + while (node.parent && node.parent.kind === 178) { node = node.parent; } - return node.parent && node.parent.kind === 199; + return node.parent && node.parent.kind === 200; } function forEachEnclosingClass(node, callback) { var result; @@ -35887,13 +38591,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141) { + while (nodeOnRightSide.parent.kind === 142) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234) { + if (nodeOnRightSide.parent.kind === 236) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -35901,27 +38605,35 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } + function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1: + case 3: + return getSymbolOfNode(entityName.parent); + case 4: + case 2: + case 5: + return getSymbolOfNode(entityName.parent.parent); + } + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) { - var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); - switch (specialPropertyAssignmentKind) { - case 1: - case 3: - return getSymbolOfNode(entityName.parent); - case 4: - case 2: - return getSymbolOfNode(entityName.parent.parent); - default: + if (ts.isInJavaScriptFile(entityName) && + entityName.parent.kind === 178 && + entityName.parent === entityName.parent.parent.left) { + var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); + if (specialPropertyAssignmentSymbol) { + return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } - if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 234); + if (entityName.kind !== 178 && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 236); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -35930,7 +38642,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 199) { + if (entityName.parent.kind === 200) { meaning = 793064; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -35940,9 +38652,12 @@ var ts; meaning = 1920; } meaning |= 8388608; - return resolveEntityName(entityName, meaning); + var entityNameSymbol = resolveEntityName(entityName, meaning); + if (entityNameSymbol) { + return entityNameSymbol; + } } - else if (ts.isPartOfExpression(entityName)) { + if (ts.isPartOfExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } @@ -35952,14 +38667,14 @@ var ts; } return resolveEntityName(entityName, 107455, false, true); } - else if (entityName.kind === 177) { + else if (entityName.kind === 178) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141) { + else if (entityName.kind === 142) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -35968,19 +38683,19 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 158 || entityName.parent.kind === 276) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 250) { + else if (entityName.parent.kind === 252) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261) { + if (node.kind === 264) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -35996,8 +38711,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 && - node.parent.parent.kind === 172 && + else if (node.parent.kind === 175 && + node.parent.parent.kind === 173 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -36008,8 +38723,8 @@ var ts; } switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98: var container = ts.getThisContainer(node, false); @@ -36022,18 +38737,18 @@ var ts; case 96: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167: + case 168: return getTypeFromTypeNode(node).symbol; case 122: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150) { + if (constructorDeclaration && constructorDeclaration.kind === 151) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 || node.parent.kind === 241) && + ((node.parent.kind === 237 || node.parent.kind === 243) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -36041,7 +38756,7 @@ var ts; return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 178 && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -36055,7 +38770,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 258) { + if (location && location.kind === 261) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -36070,13 +38785,22 @@ var ts; return unknownType; } if (ts.isPartOfTypeNode(node)) { - return getTypeFromTypeNode(node); + var typeFromTypeNode = getTypeFromTypeNode(node); + if (typeFromTypeNode && ts.isExpressionWithTypeArgumentsInClassImplementsClause(node)) { + var containingClass = ts.getContainingClass(node); + var classType = getTypeOfNode(containingClass); + typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType); + } + return typeFromTypeNode; } if (ts.isPartOfExpression(node)) { return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { - return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; + var classNode = ts.getContainingClass(node); + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)); + var baseType = getBaseTypes(classType)[0]; + return baseType && getTypeWithThisArgument(baseType, classType.thisType); } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); @@ -36105,22 +38829,22 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 213) { - var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + ts.Debug.assert(expr.kind === 177 || expr.kind === 176); + if (expr.parent.kind === 215) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 192) { + if (expr.parent.kind === 193) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 257) { + if (expr.parent.kind === 260) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 175); + ts.Debug.assert(expr.parent.kind === 176); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); } function getPropertySymbolOfDestructuringAssignment(location) { @@ -36144,29 +38868,32 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 268435456) { + if (getCheckFlags(symbol) & 6) { var symbols_3 = []; - var name_28 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_28); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } }); return symbols_3; } - else if (symbol.flags & 67108864) { + else if (symbol.flags & 134217728) { if (symbol.leftSpread) { var links = symbol; - return [links.leftSpread, links.rightSpread]; + return getRootSymbols(links.leftSpread).concat(getRootSymbols(links.rightSpread)); + } + if (symbol.syntheticOrigin) { + return getRootSymbols(symbol.syntheticOrigin); } var target = void 0; var next = symbol; @@ -36183,7 +38910,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -36199,7 +38927,7 @@ var ts; if (symbolLinks.exportsSomeValue === undefined) { symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -36223,19 +38951,15 @@ var ts; } symbol = exportSymbol; } - var parentSymbol = getParentOfSymbol(symbol); - if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) { - var symbolFile = parentSymbol.valueDeclaration; + var parentSymbol_1 = getParentOfSymbol(symbol); + if (parentSymbol_1) { + if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 264) { + var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; return symbolIsUmdExport ? undefined : symbolFile; } - for (var n = node.parent; n; n = n.parent) { - if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) { - return n; - } - } + return ts.findAncestor(node.parent, function (n) { return ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1; }); } } } @@ -36263,7 +38987,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 206 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -36298,21 +39022,17 @@ var ts; return false; } function isValueAliasDeclaration(node) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - return true; - } switch (node.kind) { - case 234: case 236: - case 237: + case 238: case 239: - case 243: - return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); case 241: + case 245: + return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); + case 243: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240: + case 242: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -36322,7 +39042,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 264 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -36340,10 +39060,6 @@ var ts; return isConstEnumSymbol(s) || s.constEnumOnlyModule; } function isReferencedAliasDeclaration(node, checkChildren) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - return true; - } if (ts.isAliasSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node); if (symbol && getSymbolLinks(symbol).referenced) { @@ -36364,16 +39080,30 @@ var ts; } return false; } + function isRequiredInitializedParameter(parameter) { + return strictNullChecks && + !isOptionalParameter(parameter) && + parameter.initializer && + !(ts.getModifierFlags(parameter) & 92); + } function getNodeCheckFlags(node) { - node = ts.getParseTreeNode(node); - return node ? getNodeLinks(node).flags : undefined; + return getNodeLinks(node).flags; } function getEnumMemberValue(node) { computeEnumMemberValues(node.parent); return getNodeLinks(node).enumMemberValue; } + function canHaveConstantValue(node) { + switch (node.kind) { + case 263: + case 178: + case 179: + return true; + } + return false; + } function getConstantValue(node) { - if (node.kind === 260) { + if (node.kind === 263) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -36389,15 +39119,17 @@ var ts; } function getTypeReferenceSerializationKind(typeName, location) { var valueSymbol = resolveEntityName(typeName, 107455, true, false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } var typeSymbol = resolveEntityName(typeName, 793064, true, false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(false); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; } @@ -36441,6 +39173,9 @@ var ts; var type = symbol && !(symbol.flags & (2048 | 131072)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : unknownType; + if (flags & 4096) { + type = includeFalsyTypes(type, 2048); + } getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -36455,10 +39190,13 @@ var ts; var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); resolveBaseTypesOfClass(classType); var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + if (!baseType.symbol) { + writer.reportIllegalExtends(); + } getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -36467,9 +39205,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36502,34 +39240,46 @@ var ts; var fileToDirective; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, isDeclarationWithCollidingName: isDeclarationWithCollidingName, - isValueAliasDeclaration: isValueAliasDeclaration, + isValueAliasDeclaration: function (node) { + node = ts.getParseTreeNode(node); + return node ? isValueAliasDeclaration(node) : true; + }, hasGlobalName: hasGlobalName, - isReferencedAliasDeclaration: isReferencedAliasDeclaration, - getNodeCheckFlags: getNodeCheckFlags, + isReferencedAliasDeclaration: function (node, checkChildren) { + node = ts.getParseTreeNode(node); + return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + }, + getNodeCheckFlags: function (node) { + node = ts.getParseTreeNode(node); + return node ? getNodeCheckFlags(node) : undefined; + }, isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, + isRequiredInitializedParameter: isRequiredInitializedParameter, writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, - getConstantValue: getConstantValue, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, collectLinkedAliases: collectLinkedAliases, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, @@ -36547,7 +39297,7 @@ var ts; if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node)) + var meaning = (node.kind === 178) || (node.kind === 70 && isInTypeQuery(node)) ? 107455 | 1048576 : 793064 | 1920; var symbol = resolveEntityName(node, meaning, true); @@ -36582,15 +39332,15 @@ var ts; } var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 264 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -36609,7 +39359,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261); + return ts.getDeclarationOfKind(moduleSymbol, 264); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -36617,8 +39367,6 @@ var ts; ts.bindSourceFile(file, compilerOptions); } var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -36632,20 +39380,11 @@ var ts; } if (file.symbol && file.symbol.globalExports) { var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } - } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } + }); } } if (augmentations) { @@ -36659,116 +39398,80 @@ var ts; } addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedWideningType; - getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", 0, true); getSymbolLinks(unknownSymbol).type = unknownType; - globalArrayType = getGlobalType("Array", 1); - globalObjectType = getGlobalType("Object"); - globalFunctionType = getGlobalType("Function"); - globalStringType = getGlobalType("String"); - globalNumberType = getGlobalType("Number"); - globalBooleanType = getGlobalType("Boolean"); - globalRegExpType = getGlobalType("RegExp"); - jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); - getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); }); - getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); - getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); - getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); - getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); - getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); - getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); - tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793064, undefined) && getGlobalPromiseType(); }); - getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); - getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); - getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); - tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol("Promise", 107455, undefined) && getGlobalPromiseConstructorSymbol(); }); - getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); - getGlobalThenableType = ts.memoize(createThenableType); - getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); - if (languageVersion >= 2) { - getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); - getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); - getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); - getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); - } - else { - getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); - getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); - } + globalArrayType = getGlobalType("Array", 1, true); + globalObjectType = getGlobalType("Object", 0, true); + globalFunctionType = getGlobalType("Function", 0, true); + globalStringType = getGlobalType("String", 0, true); + globalNumberType = getGlobalType("Number", 0, true); + globalBooleanType = getGlobalType("Boolean", 0, true); + globalRegExpType = getGlobalType("RegExp", 0, true); anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); - var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined); - globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); + globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, undefined); - if (helpersModule) { - var exports_2 = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 && languageVersion < 2) { - verifyHelperSymbol(exports_2, "__extends", 107455); - } - if (requestedExternalEmitHelpers & 16384 && - (languageVersion < 5 || compilerOptions.jsx === 2)) { - verifyHelperSymbol(exports_2, "__assign", 107455); - } - if (languageVersion < 5 && requestedExternalEmitHelpers & 32768) { - verifyHelperSymbol(exports_2, "__rest", 107455); - } - if (requestedExternalEmitHelpers & 2048) { - verifyHelperSymbol(exports_2, "__decorate", 107455); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports_2, "__metadata", 107455); - } - } - if (requestedExternalEmitHelpers & 4096) { - verifyHelperSymbol(exports_2, "__param", 107455); - } - if (requestedExternalEmitHelpers & 8192) { - verifyHelperSymbol(exports_2, "__awaiter", 107455); - if (languageVersion < 2) { - verifyHelperSymbol(exports_2, "__generator", 107455); + globalThisType = getGlobalTypeOrUndefined("ThisType", 1); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !ts.isInAmbientContext(location)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1; helper <= 8192; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1: return "__extends"; + case 2: return "__assign"; + case 4: return "__rest"; + case 8: return "__decorate"; + case 16: return "__metadata"; + case 32: return "__param"; + case 64: return "__awaiter"; + case 128: return "__generator"; + case 256: return "__values"; + case 512: return "__read"; + case 1024: return "__spread"; + case 2048: return "__asyncGenerator"; + case 4096: return "__asyncDelegator"; + case 8192: return "__asyncValues"; + default: ts.Debug.fail("Unrecognized helper."); } } - function createInstantiatedPromiseLikeType() { - var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyGenericType) { - return createTypeReference(promiseLikeType, [anyType]); + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; } - return emptyObjectType; - } - function createThenableType() { - var thenPropertySymbol = createSymbol(67108864 | 4, "then"); - getSymbolLinks(thenPropertySymbol).type = globalFunctionType; - var thenableType = createObjectType(16); - thenableType.properties = [thenPropertySymbol]; - thenableType.members = createSymbolTable(thenableType.properties); - thenableType.callSignatures = []; - thenableType.constructSignatures = []; - return thenableType; + return externalHelpersModule; } function checkGrammarDecorators(node) { if (!node.decorators) { return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 || node.kind === 152) { + else if (node.kind === 152 || node.kind === 153) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -36786,16 +39489,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130) { - if (node.kind === 146 || node.kind === 148) { + if (node.kind === 147 || node.kind === 149) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155) { + if (node.kind === 156) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75: - if (node.kind !== 229 && node.parent.kind === 226) { + if (node.kind !== 231 && node.parent.kind === 228) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -36821,7 +39524,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 233 || node.parent.kind === 264) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -36844,10 +39547,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 233 || node.parent.kind === 264) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -36860,7 +39563,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) { + else if (node.kind !== 148 && node.kind !== 147 && node.kind !== 156 && node.kind !== 145) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -36879,10 +39582,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -36894,13 +39597,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -36910,14 +39613,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226) { - if (node.kind !== 149 && - node.kind !== 147 && - node.kind !== 151 && - node.kind !== 152) { + if (node.kind !== 228) { + if (node.kind !== 150 && + node.kind !== 148 && + node.kind !== 152 && + node.kind !== 153) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 228 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -36936,7 +39639,7 @@ var ts; else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -36944,7 +39647,7 @@ var ts; break; } } - if (node.kind === 150) { + if (node.kind === 151) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -36959,13 +39662,13 @@ var ts; } return; } - else if ((node.kind === 235 || node.kind === 234) && flags & 2) { + else if ((node.kind === 237 || node.kind === 236) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) { + else if (node.kind === 145 && (flags & 92) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256) { @@ -36981,37 +39684,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151: case 152: - case 150: + case 153: + case 151: + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 155: - case 230: - case 235: - case 234: - case 241: - case 240: - case 184: + case 156: + case 232: + case 237: + case 236: + case 243: + case 242: case 185: - case 144: + case 186: + case 145: return false; default: - if (node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 233 || node.parent.kind === 264) { return false; } switch (node.kind) { - case 225: - return nodeHasAnyModifiersExcept(node, 119); - case 226: - return nodeHasAnyModifiersExcept(node, 116); case 227: - case 205: + return nodeHasAnyModifiersExcept(node, 119); case 228: - return true; + return nodeHasAnyModifiersExcept(node, 116); case 229: + case 207: + case 230: + return true; + case 231: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -37024,14 +39727,11 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149: - case 225: - case 184: + case 150: + case 227: case 185: - if (!node.asteriskToken) { - return false; - } - break; + case 186: + return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } @@ -37088,8 +39788,12 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } + function checkGrammarClassLikeDeclaration(node) { + var file = ts.getSourceFileOfNode(node); + return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file); + } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185) { + if (node.kind === 186) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -37124,7 +39828,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 134 && parameter.type.kind !== 132) { + if (parameter.type.kind !== 135 && parameter.type.kind !== 132) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -37151,7 +39855,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198) { + if (arg.kind === 199) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -37221,28 +39925,25 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 142) { + if (node.kind !== 143) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) { + if (computedPropertyName.expression.kind === 193 && computedPropertyName.expression.operatorToken.kind === 25) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 || - node.kind === 184 || - node.kind === 149); + ts.Debug.assert(node.kind === 227 || + node.kind === 185 || + node.kind === 150); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } - if (languageVersion < 2) { - return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher); - } } } function checkGrammarForInvalidQuestionMark(questionToken, message) { @@ -37258,87 +39959,87 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259) { + if (prop.kind === 262) { continue; } - var name_29 = prop.name; - if (name_29.kind === 142) { - checkGrammarComputedPropertyName(name_29); + var name = prop.name; + if (name.kind === 143) { + checkGrammarComputedPropertyName(name); } - if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 261 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 || prop.kind !== 149) { + if (mod.kind !== 119 || prop.kind !== 150) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } } var currentKind = void 0; - if (prop.kind === 257 || prop.kind === 258) { + if (prop.kind === 260 || prop.kind === 261) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_29.kind === 8) { - checkGrammarNumericLiteral(name_29); + if (name.kind === 8) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149) { + else if (prop.kind === 150) { currentKind = Property; } - else if (prop.kind === 151) { + else if (prop.kind === 152) { currentKind = GetAccessor; } - else if (prop.kind === 152) { + else if (prop.kind === 153) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_29); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_29, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_29)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } } function checkGrammarJsxElement(node) { var seen = ts.createMap(); - for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { + for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251) { + if (attr.kind === 254) { continue; } var jsxAttr = attr; - var name_30 = jsxAttr.name; - if (!seen[name_30.text]) { - seen[name_30.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_30, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 && !initializer.expression) { + if (initializer && initializer.kind === 255 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -37347,7 +40048,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224) { + if (forInOrOfStatement.kind === 215 && forInOrOfStatement.awaitModifier) { + if ((forInOrOfStatement.flags & 16384) === 0) { + return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + } + } + if (forInOrOfStatement.initializer.kind === 226) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -37355,20 +40061,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -37388,15 +40094,18 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 ? + return grammarErrorOnNode(accessor.name, kind === 152 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152) { + else if (kind === 153) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -37415,10 +40124,10 @@ var ts; } } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -37433,7 +40142,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176) { + if (node.parent.kind === 177) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -37449,10 +40158,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 229) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -37463,9 +40172,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219: + case 221: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 214 + var isMisplacedContinueLabel = node.kind === 216 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -37473,8 +40182,8 @@ var ts; return false; } break; - case 218: - if (node.kind === 215 && !node.label) { + case 220: + if (node.kind === 217 && !node.label) { return false; } break; @@ -37487,13 +40196,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 + var message = node.kind === 217 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 215 + var message = node.kind === 217 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -37505,7 +40214,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 || node.name.kind === 172) { + if (node.name.kind === 174 || node.name.kind === 173) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -37515,11 +40224,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) { + if (node.parent.parent.kind !== 214 && node.parent.parent.kind !== 215) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -37546,9 +40255,29 @@ var ts; } } } + if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && + !ts.isInAmbientContext(node.parent.parent) && ts.hasModifier(node.parent.parent, 1)) { + checkESModuleMarker(node.name); + } var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } + function checkESModuleMarker(name) { + if (name.kind === 70) { + if (ts.unescapeIdentifier(name.text) === "__esModule") { + return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); + } + } + else { + var elements = name.elements; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; + if (!ts.isOmittedExpression(element)) { + return checkESModuleMarker(element.name); + } + } + } + } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 70) { if (name.originalKeywordKind === 109) { @@ -37557,8 +40286,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { - var element = elements_2[_i]; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var element = elements_3[_i]; if (!ts.isOmittedExpression(element)) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -37576,15 +40305,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208: - case 209: case 210: - case 217: case 211: case 212: + case 219: case 213: + case 214: + case 215: return false; - case 219: + case 221: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -37599,6 +40328,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -37639,7 +40375,7 @@ var ts; return true; } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 229) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37647,7 +40383,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37660,13 +40396,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 227 || - node.kind === 228 || + if (node.kind === 229 || + node.kind === 230 || + node.kind === 237 || + node.kind === 236 || + node.kind === 243 || + node.kind === 242 || node.kind === 235 || - node.kind === 234 || - node.kind === 241 || - node.kind === 240 || - node.kind === 233 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -37675,7 +40411,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205) { + if (ts.isDeclaration(decl) || decl.kind === 207) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -37694,7 +40430,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 204 || node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 206 || node.parent.kind === 233 || node.parent.kind === 264) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -37705,8 +40441,22 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.isOctalLiteral && languageVersion >= 1) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.numericLiteralFlags & 4) { + var diagnosticMessage = void 0; + if (languageVersion >= 1) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 172)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 263)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -37719,11 +40469,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -37731,55 +40481,359 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ; - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[229] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[230] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[231] = [ - { name: "statements", test: ts.isStatement } - ], - _a[234] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[245] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[260] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); + function visitNode(node, visitor, test, lift) { + if (node === undefined || visitor === undefined) { + return node; + } + ts.aggregateTransformFlags(node); + var visited = visitor(node); + if (visited === node) { + return node; + } + var visitedNode; + if (visited === undefined) { + return undefined; + } + else if (ts.isArray(visited)) { + visitedNode = (lift || extractSingleNode)(visited); + } + else { + visitedNode = visited; + } + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); + return visitedNode; + } + ts.visitNode = visitNode; + function visitNodes(nodes, visitor, test, start, count) { + if (nodes === undefined || visitor === undefined) { + return nodes; + } + var updated; + var length = nodes.length; + if (start === undefined || start < 0) { + start = 0; + } + if (count === undefined || count > length - start) { + count = length - start; + } + if (start > 0 || count < length) { + updated = ts.createNodeArray([], nodes.hasTrailingComma && start + count === length); + } + for (var i = 0; i < count; i++) { + var node = nodes[i + start]; + ts.aggregateTransformFlags(node); + var visited = node !== undefined ? visitor(node) : undefined; + if (updated !== undefined || visited === undefined || visited !== node) { + if (updated === undefined) { + updated = ts.createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma); + ts.setTextRange(updated, nodes); + } + if (visited) { + if (ts.isArray(visited)) { + for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { + var visitedNode = visited_1[_i]; + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); + updated.push(visitedNode); + } + } + else { + ts.Debug.assertNode(visited, test); + ts.aggregateTransformFlags(visited); + updated.push(visited); + } + } + } + } + return updated || nodes; + } + ts.visitNodes = visitNodes; + function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, ts.isStatement, start); + if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { + statements = ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements)), statements); + } + var declarations = context.endLexicalEnvironment(); + return ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements); + } + ts.visitLexicalEnvironment = visitLexicalEnvironment; + function visitParameterList(nodes, visitor, context, nodesVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + context.startLexicalEnvironment(); + var updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + ts.visitParameterList = visitParameterList; + function visitFunctionBody(node, visitor, context) { + context.resumeLexicalEnvironment(); + var updated = visitNode(node, visitor, ts.isConciseBody); + var declarations = context.endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(updated); + var statements = ts.mergeLexicalEnvironment(block.statements, declarations); + return ts.updateBlock(block, statements); + } + return updated; + } + ts.visitFunctionBody = visitFunctionBody; + function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + if (node === undefined) { + return undefined; + } + var kind = node.kind; + if ((kind > 0 && kind <= 141) || kind === 168) { + return node; + } + switch (node.kind) { + case 205: + case 208: + case 199: + case 224: + case 297: + case 246: + return node; + case 142: + return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier)); + case 143: + return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); + case 159: + return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 160: + return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 154: + return ts.updateCallSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 155: + return ts.updateConstructSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 149: + return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); + case 156: + return ts.updateIndexSignatureDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 145: + return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 146: + return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression)); + case 158: + return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + case 157: + return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 161: + return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName)); + case 162: + return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor)); + case 163: + return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode)); + case 164: + return ts.updateTypleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode)); + case 165: + case 166: + return ts.updateUnionOrIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + case 167: + throw ts.Debug.fail("not implemented."); + case 169: + return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode)); + case 170: + return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode)); + case 171: + return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameter), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); + case 172: + return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); + case 144: + return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode)); + case 147: + return ts.updatePropertySignature(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 148: + return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 150: + return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 151: + return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); + case 152: + return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 153: + return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); + case 173: + return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + case 174: + return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + case 175: + return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); + case 176: + return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + case 177: + return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + case 178: + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + case 179: + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + case 180: + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 181: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 182: + return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); + case 183: + return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 184: + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); + case 185: + return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 186: + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 187: + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + case 188: + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + case 189: + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + case 190: + return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); + case 193: + return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); + case 191: + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 192: + return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 194: + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); + case 195: + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + case 196: + return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); + case 197: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 198: + return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 200: + return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 201: + return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); + case 202: + return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + case 204: + return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + case 206: + return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 207: + return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); + case 209: + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); + case 210: + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); + case 211: + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + case 212: + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 213: + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 214: + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 215: + return ts.updateForOf(node, node.awaitModifier, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 216: + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 217: + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 218: + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); + case 219: + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 220: + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + case 221: + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 222: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 223: + return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); + case 225: + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 226: + return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + case 227: + return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 228: + return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 231: + return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + case 232: + return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); + case 233: + return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 234: + return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + case 236: + return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); + case 237: + return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 238: + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); + case 239: + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + case 240: + return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + case 241: + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + case 242: + return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + case 243: + return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 244: + return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + case 245: + return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + case 247: + return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); + case 248: + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + case 253: + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + case 249: + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 250: + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 251: + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + case 252: + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + case 254: + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + case 255: + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + case 256: + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + case 257: + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 258: + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + case 259: + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + case 260: + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 261: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 262: + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + case 263: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 264: + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); + case 295: + return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + default: + return node; + } + } + ts.visitEachChild = visitEachChild; + function extractSingleNode(nodes) { + ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return ts.singleOrUndefined(nodes); + } +})(ts || (ts = {})); +(function (ts) { function reduceNode(node, f, initial) { return node ? f(initial, node) : initial; } @@ -37793,41 +40847,45 @@ var ts; var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; - if ((kind > 0 && kind <= 140)) { + if ((kind > 0 && kind <= 141)) { return initial; } - if ((kind >= 156 && kind <= 171)) { + if ((kind >= 157 && kind <= 172)) { return initial; } var result = initial; switch (node.kind) { - case 203: - case 206: - case 198: - case 222: - case 293: + case 205: + case 208: + case 199: + case 224: + case 294: break; case 142: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 143: result = reduceNode(node.expression, cbNode, result); break; - case 144: + case 145: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 145: + case 146: result = reduceNode(node.expression, cbNode, result); break; - case 147: + case 148: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 149: + case 150: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -37836,12 +40894,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 150: + case 151: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 151: + case 152: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -37849,51 +40907,55 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 152: + case 153: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 172: case 173: + case 174: result = reduceNodes(node.elements, cbNodes, result); break; - case 174: + case 175: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 175: + case 176: result = reduceNodes(node.elements, cbNodes, result); break; - case 176: + case 177: result = reduceNodes(node.properties, cbNodes, result); break; - case 177: + case 178: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 178: + case 179: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 179: + case 180: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 180: + case 181: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 181: + case 182: result = reduceNode(node.tag, cbNode, result); result = reduceNode(node.template, cbNode, result); break; - case 184: + case 183: + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 185: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -37901,117 +40963,124 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 185: + case 186: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 183: - case 186: + case 184: case 187: case 188: case 189: - case 195: + case 190: case 196: - case 201: + case 197: + case 202: result = reduceNode(node.expression, cbNode, result); break; - case 190: case 191: + case 192: result = reduceNode(node.operand, cbNode, result); break; - case 192: + case 193: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 193: + case 194: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 194: + case 195: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 197: + case 198: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 199: + case 200: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; + case 201: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.type, cbNode, result); + break; case 202: result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.literal, cbNode, result); break; case 204: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); + break; + case 206: result = reduceNodes(node.statements, cbNodes, result); break; - case 205: + case 207: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 207: + case 209: result = reduceNode(node.expression, cbNode, result); break; - case 208: + case 210: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 209: + case 211: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 210: - case 217: + case 212: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 211: + case 213: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: - case 213: + case 214: + case 215: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 216: - case 220: + case 218: + case 222: result = reduceNode(node.expression, cbNode, result); break; - case 218: + case 220: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 219: + case 221: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 221: + case 223: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 223: + case 225: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 224: + case 226: result = reduceNodes(node.declarations, cbNodes, result); break; - case 225: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38020,7 +41089,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 226: + case 228: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38028,455 +41097,145 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; + case 231: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.members, cbNodes, result); + break; case 232: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 233: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 234: result = reduceNodes(node.clauses, cbNodes, result); break; - case 235: + case 236: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.moduleReference, cbNode, result); + break; + case 237: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 236: + case 238: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 237: + case 239: result = reduceNode(node.name, cbNode, result); break; - case 238: - case 242: + case 240: + case 244: result = reduceNodes(node.elements, cbNodes, result); break; - case 239: - case 243: + case 241: + case 245: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 240: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 241: + case 243: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 246: + case 247: + result = reduceNode(node.expression, cbNode, result); + break; + case 248: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 247: - case 248: + case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); - result = reduceNodes(node.attributes, cbNodes, result); + result = reduceNode(node.attributes, cbNode, result); break; - case 249: + case 253: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 251: result = reduceNode(node.tagName, cbNode, result); break; - case 250: + case 252: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 251: + case 254: result = reduceNode(node.expression, cbNode, result); break; - case 252: + case 255: result = reduceNode(node.expression, cbNode, result); break; - case 253: + case 256: result = reduceNode(node.expression, cbNode, result); - case 254: + case 257: result = reduceNodes(node.statements, cbNodes, result); break; - case 255: + case 258: result = reduceNodes(node.types, cbNodes, result); break; - case 256: + case 259: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 257: + case 260: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 258: + case 261: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 259: + case 262: result = reduceNode(node.expression, cbNode, result); break; - case 261: + case 263: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 264: result = reduceNodes(node.statements, cbNodes, result); break; - case 294: + case 295: result = reduceNode(node.expression, cbNode, result); break; default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { - var edge = edgeTraversalPath_1[_i]; - var value = node[edge.name]; - if (value !== undefined) { - result = ts.isArray(value) - ? reduceNodes(value, cbNodes, result) - : cbNode(result, value); - } - } - } break; } return result; } ts.reduceEachChild = reduceEachChild; - function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { - if (node === undefined || visitor === undefined) { - return node; - } - aggregateTransformFlags(node); - var visited = visitor(node); - if (visited === node) { - return node; - } - var visitedNode; - if (visited === undefined) { - if (!optional) { - Debug.failNotOptional(); - } - return undefined; - } - else if (ts.isArray(visited)) { - visitedNode = (lift || extractSingleNode)(visited); - } - else { - visitedNode = visited; - } - if (parenthesize !== undefined) { - visitedNode = parenthesize(visitedNode, parentNode); - } - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - return visitedNode; - } - ts.visitNode = visitNode; - function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) { - if (nodes === undefined) { - return undefined; - } - var updated; - var length = nodes.length; - if (start === undefined || start < 0) { - start = 0; - } - if (count === undefined || count > length - start) { - count = length - start; - } - if (start > 0 || count < length) { - updated = ts.createNodeArray([], undefined, nodes.hasTrailingComma && start + count === length); - } - for (var i = 0; i < count; i++) { - var node = nodes[i + start]; - aggregateTransformFlags(node); - var visited = node !== undefined ? visitor(node) : undefined; - if (updated !== undefined || visited === undefined || visited !== node) { - if (updated === undefined) { - updated = ts.createNodeArray(nodes.slice(0, i), nodes, nodes.hasTrailingComma); - } - if (visited) { - if (ts.isArray(visited)) { - for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { - var visitedNode = visited_1[_i]; - visitedNode = parenthesize - ? parenthesize(visitedNode, parentNode) - : visitedNode; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); - } - } - else { - var visitedNode = parenthesize - ? parenthesize(visited, parentNode) - : visited; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); - } - } - } - } - return updated || nodes; - } - ts.visitNodes = visitNodes; - function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) { - context.startLexicalEnvironment(); - statements = visitNodes(statements, visitor, ts.isStatement, start); - if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { - statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); - } - var declarations = context.endLexicalEnvironment(); - return ts.createNodeArray(ts.concatenate(statements, declarations), statements); - } - ts.visitLexicalEnvironment = visitLexicalEnvironment; - function visitParameterList(nodes, visitor, context) { - context.startLexicalEnvironment(); - var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); - context.suspendLexicalEnvironment(); - return updated; - } - ts.visitParameterList = visitParameterList; - function visitFunctionBody(node, visitor, context) { - context.resumeLexicalEnvironment(); - var updated = visitNode(node, visitor, ts.isConciseBody); - var declarations = context.endLexicalEnvironment(); - if (ts.some(declarations)) { - var block = ts.convertToFunctionBody(updated); - var statements = mergeLexicalEnvironment(block.statements, declarations); - return ts.updateBlock(block, statements); - } - return updated; - } - ts.visitFunctionBody = visitFunctionBody; - function visitEachChild(node, visitor, context) { - if (node === undefined) { - return undefined; - } - var kind = node.kind; - if ((kind > 0 && kind <= 140)) { - return node; - } - if ((kind >= 156 && kind <= 171)) { - return node; - } - switch (node.kind) { - case 203: - case 206: - case 198: - case 222: - return node; - case 142: - return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); - case 144: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 147: - return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 152: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 172: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); - case 173: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); - case 174: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 175: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); - case 176: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 177: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 178: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 179: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 180: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 181: - return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 186: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 187: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 188: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 189: - return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192: - return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 191: - return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 194: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); - case 195: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 197: - return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199: - return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 202: - return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 204: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 205: - return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); - case 209: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 210: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 211: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 212: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 213: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 214: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); - case 215: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); - case 216: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); - case 217: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 218: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 219: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); - case 220: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 221: - return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 223: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 224: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); - case 226: - return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232: - return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 236: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); - case 237: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 238: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 239: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 240: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 241: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); - case 242: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 243: - return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 246: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 247: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 248: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 250: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 251: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 252: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 253: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 254: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 255: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 256: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); - case 257: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 258: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 259: - return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 261: - return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 294: - return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - default: - var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { - var edge = edgeTraversalPath_2[_i]; - var value = node[edge.name]; - if (value !== undefined) { - var visited = ts.isArray(value) - ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node) - : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node); - if (updated !== undefined || visited !== value) { - if (updated === undefined) { - updated = ts.getMutableClone(node); - } - if (visited !== value) { - updated[edge.name] = visited; - } - } - } - } - } - return updated ? ts.updateNode(updated, node) : node; - } - } - ts.visitEachChild = visitEachChild; function mergeLexicalEnvironment(statements, declarations) { if (!ts.some(declarations)) { return statements; } return ts.isNodeArray(statements) - ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + ? ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements) : ts.addRange(statements, declarations); } ts.mergeLexicalEnvironment = mergeLexicalEnvironment; - function mergeFunctionBodyLexicalEnvironment(body, declarations) { - if (body && declarations !== undefined && declarations.length > 0) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements)); - } - else { - return ts.createBlock(ts.createNodeArray([ts.createReturn(body, body)].concat(declarations), body), body, true); - } - } - return body; - } - ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment; function liftToBlock(nodes) { Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block."); return ts.singleOrUndefined(nodes) || ts.createBlock(nodes); } ts.liftToBlock = liftToBlock; - function extractSingleNode(nodes) { - Debug.assert(nodes.length <= 1, "Too many nodes written to output."); - return ts.singleOrUndefined(nodes); - } function aggregateTransformFlags(node) { aggregateTransformFlagsForNode(node); return node; @@ -38507,7 +41266,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 200)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -38520,9 +41279,6 @@ var ts; } var Debug; (function (Debug) { - Debug.failNotOptional = Debug.shouldAssert(1) - ? function (message) { return Debug.assert(false, message || "Node not optional."); } - : ts.noop; Debug.failBadSyntaxKind = Debug.shouldAssert(1) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; @@ -38555,16 +41311,20 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); var ts; (function (ts) { + var FlattenLevel; + (function (FlattenLevel) { + FlattenLevel[FlattenLevel["All"] = 0] = "All"; + FlattenLevel[FlattenLevel["ObjectRest"] = 1] = "ObjectRest"; + })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {})); function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { var location = node; var value; if (ts.isDestructuringAssignment(node)) { value = node.right; - while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + while (ts.isEmptyArrayLiteral(node.left) || ts.isEmptyObjectLiteral(node.left)) { if (ts.isDestructuringAssignment(value)) { location = node = value; value = node.right; @@ -38578,6 +41338,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: true, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -38612,7 +41373,7 @@ var ts; ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); var expression = createAssignmentCallback ? createAssignmentCallback(target, value, location) - : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + : ts.setTextRange(ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value), location); expression.original = original; emitExpression(expression); } @@ -38625,6 +41386,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: hoistTempVariables, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -38650,10 +41412,11 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_31 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_31, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value); variable.original = original; - if (ts.isIdentifier(name_31)) { + ts.setTextRange(variable, location); + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64); } ts.aggregateTransformFlags(variable); @@ -38741,7 +41504,12 @@ var ts; function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); var numElements = elements.length; - if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { + if (flattenContext.level < 1 && flattenContext.downlevelIteration) { + value = ensureIdentifier(flattenContext, ts.createReadHelper(flattenContext.context, value, numElements > 0 && ts.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) + ? undefined + : numElements, location), false, location); + } + else if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); } @@ -38799,8 +41567,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_32 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_32); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { @@ -38811,7 +41579,7 @@ var ts; var temp = ts.createTempVariable(undefined); if (flattenContext.hoistTempVariables) { flattenContext.context.hoistVariableDeclaration(temp); - flattenContext.emitExpression(ts.createAssignment(temp, value, location)); + flattenContext.emitExpression(ts.setTextRange(ts.createAssignment(temp, value), location)); } else { flattenContext.emitBindingOrAssignment(temp, value, location, undefined); @@ -38842,7 +41610,7 @@ var ts; var restHelper = { name: "typescript:rest", scoped: false, - text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" }; function createRestCall(context, value, elements, computedTempVariables, location) { context.requestEmitHelper(restHelper); @@ -38861,12 +41629,21 @@ var ts; } } } - return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + return ts.createCall(ts.getHelperName("__rest"), undefined, [ + value, + ts.setTextRange(ts.createArrayLiteral(propertyNames), location) + ]); } })(ts || (ts = {})); var ts; (function (ts) { var USE_NEW_TYPE_METADATA_FORMAT = false; + var TypeScriptSubstitutionFlags; + (function (TypeScriptSubstitutionFlags) { + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["ClassAliases"] = 1] = "ClassAliases"; + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NamespaceExports"] = 2] = "NamespaceExports"; + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers"; + })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {})); function transformTypeScript(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); @@ -38877,8 +41654,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); context.enableSubstitution(178); + context.enableSubstitution(179); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -38911,15 +41688,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 261: - case 232: - case 231: - case 204: + case 264: + case 234: + case 233: + case 206: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 226: - case 225: + case 228: + case 227: if (ts.hasModifier(node, 2)) { break; } @@ -38944,13 +41721,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 240: + case 242: return visitExportAssignment(node); - case 241: + case 243: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -38960,11 +41737,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 241 || - node.kind === 235 || - node.kind === 236 || - (node.kind === 234 && - node.moduleReference.kind === 245)) { + if (node.kind === 243 || + node.kind === 237 || + node.kind === 238 || + (node.kind === 236 && + node.moduleReference.kind === 247)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -38980,15 +41757,15 @@ var ts; } function classElementVisitorWorker(node) { switch (node.kind) { - case 150: - return undefined; - case 147: - case 155: case 151: + return undefined; + case 148: + case 156: case 152: - case 149: + case 153: + case 150: return visitorWorker(node); - case 203: + case 205: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -39019,23 +41796,22 @@ var ts; case 75: case 123: case 130: - case 162: case 163: - case 161: - case 156: - case 143: + case 164: + case 162: + case 157: + case 144: case 118: case 121: - case 134: + case 135: case 132: case 129: case 104: - case 135: + case 136: + case 160: case 159: + case 161: case 158: - case 160: - case 157: - case 164: case 165: case 166: case 167: @@ -39043,56 +41819,58 @@ var ts; case 169: case 170: case 171: - case 155: - case 145: - case 228: - case 147: - case 150: + case 172: + case 156: + case 146: + case 230: + case 148: + return undefined; + case 151: return visitConstructor(node); - case 227: + case 229: return ts.createNotEmittedStatement(node); - case 226: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 255: + case 258: return visitHeritageClause(node); - case 199: + case 200: return visitExpressionWithTypeArguments(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessor(node); case 152: + return visitGetAccessor(node); + case 153: return visitSetAccessor(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 183: + case 184: return visitParenthesizedExpression(node); - case 182: - case 200: + case 183: + case 201: return visitAssertionExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 201: + case 202: return visitNonNullExpression(node); - case 229: + case 231: return visitEnumDeclaration(node); - case 205: + case 207: return visitVariableStatement(node); - case 223: + case 225: return visitVariableDeclaration(node); - case 230: + case 232: return visitModuleDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -39100,7 +41878,8 @@ var ts; } } function visitSourceFile(node) { - var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + var alwaysStrict = (compilerOptions.alwaysStrict === undefined ? compilerOptions.strict : compilerOptions.alwaysStrict) && + !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)); } function shouldEmitDecorateCallForClass(node) { @@ -39152,11 +41931,12 @@ var ts; return ts.singleOrMany(statements); } function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) { - var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); + var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause)); var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { emitFlags |= 32; } + ts.setTextRange(classDeclaration, node); ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); return classDeclaration; @@ -39167,10 +41947,14 @@ var ts; var declName = ts.getLocalName(node, false, true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, hasExtendsClause); - var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members, location); + var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members); ts.setOriginalNode(classExpression, node); - var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location); + ts.setTextRange(classExpression, location); + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declName, undefined, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression) + ], 1)); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, location); ts.setCommentRange(statement, node); return statement; } @@ -39178,7 +41962,9 @@ var ts; var staticProperties = getInitializedProperties(node, true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84; })); - var classExpression = ts.setOriginalNode(ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members, node), node); + var classExpression = ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members); + ts.setOriginalNode(classExpression, node); + ts.setTextRange(classExpression, node); if (staticProperties.length > 0) { var expressions = []; var temp = ts.createTempVariable(hoistVariableDeclaration); @@ -39201,7 +41987,7 @@ var ts; members.push(constructor); } ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement)); - return ts.createNodeArray(members, node.members); + return ts.setTextRange(ts.createNodeArray(members), node.members); } function transformConstructor(node, hasExtendsClause) { var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); @@ -39212,7 +41998,7 @@ var ts; } var parameters = transformConstructorParameters(constructor); var body = transformConstructorBody(node, constructor, hasExtendsClause); - return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor)); + return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(ts.createConstructor(undefined, undefined, parameters, body), constructor || node), constructor)); } function transformConstructorParameters(constructor) { return ts.visitParameterList(constructor && constructor.parameters, visitor, context) @@ -39235,18 +42021,18 @@ var ts; if (constructor) { ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } - ts.addRange(statements, endLexicalEnvironment()); - return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true); + statements = ts.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + return ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined); } function addPrologueDirectivesAndInitialSuperCall(ctor, result) { if (ctor.body) { var statements = ctor.body.statements; - var index = ts.addPrologueDirectives(result, statements, false, visitor); + var index = ts.addPrologue(result, statements, false, visitor); if (index === statements.length) { return index; } var statement = statements[index]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -39268,7 +42054,7 @@ var ts; ts.setEmitFlags(propertyName, 1536 | 48); var localName = ts.getMutableClone(name); ts.setEmitFlags(localName, 1536); - return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1))); + return ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createThis(), propertyName), node.name), localName)), ts.moveRangePos(node, -1))); } function getInitializedProperties(node, isStatic) { return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty); @@ -39280,13 +42066,13 @@ var ts; return isInitializedProperty(member, false); } function isInitializedProperty(member, isStatic) { - return member.kind === 147 + return member.kind === 148 && isStatic === ts.hasModifier(member, 32) && member.initializer !== undefined; } function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -39295,8 +42081,8 @@ var ts; } function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { + var property = properties_10[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -39353,12 +42139,12 @@ var ts; } function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151: case 152: + case 153: return getAllDecoratorsOfAccessors(node, member); - case 149: + case 150: return getAllDecoratorsOfMethod(member); - case 147: + case 148: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -39369,10 +42155,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -39397,14 +42184,14 @@ var ts; } return { decorators: decorators }; } - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } function addClassElementDecorationStatements(statements, node, isStatic) { @@ -39429,14 +42216,14 @@ var ts; } function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, true); var descriptor = languageVersion > 0 - ? member.kind === 147 + ? member.kind === 148 ? ts.createVoidZero() : ts.createNull() : undefined; @@ -39452,7 +42239,7 @@ var ts; } function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -39480,90 +42267,83 @@ var ts; } return expressions; } - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, true))); } } } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 - || kind === 151 + return kind === 150 || kind === 152 - || kind === 147; + || kind === 153 + || kind === 148; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 149; + return node.kind === 150; } function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 - || kind === 197 - || kind === 149 - || kind === 151 - || kind === 152; + switch (node.kind) { + case 228: + case 198: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 150: + case 152: + case 153: + return true; + } + return false; } function serializeTypeOfNode(node) { switch (node.kind) { - case 147: - case 144: - case 151: - return serializeTypeNode(node.type); + case 148: + case 145: case 152: + return serializeTypeNode(node.type); + case 153: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226: - case 197: - case 149: + case 228: + case 198: + case 150: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); } } - function getRestParameterElementType(node) { - if (node && node.kind === 162) { - return node.elementType; - } - else if (node && node.kind === 157) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -39571,7 +42351,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -39579,7 +42359,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -39588,11 +42368,20 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 152) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } function serializeReturnTypeOfNode(node) { if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } - else if (ts.isAsyncFunctionLike(node)) { + else if (ts.isAsyncFunction(node)) { return ts.createIdentifier("Promise"); } return ts.createVoidZero(); @@ -39603,21 +42392,26 @@ var ts; } switch (node.kind) { case 104: + case 138: + case 94: + case 129: return ts.createVoidZero(); - case 166: + case 167: return serializeTypeNode(node.type); - case 158: case 159: + case 160: return ts.createIdentifier("Function"); - case 162: case 163: + case 164: return ts.createIdentifier("Array"); - case 156: + case 157: case 121: return ts.createIdentifier("Boolean"); - case 134: + case 135: return ts.createIdentifier("String"); - case 171: + case 133: + return ts.createIdentifier("Object"); + case 172: switch (node.literal.kind) { case 9: return ts.createIdentifier("String"); @@ -39633,44 +42427,22 @@ var ts; break; case 132: return ts.createIdentifier("Number"); - case 135: + case 136: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157: + case 158: return serializeTypeReferenceNode(node); + case 166: case 165: - case 164: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - if (serializedIndividual.kind !== 70) { - serializedUnion = undefined; - break; - } - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - if (serializedUnion) { - return serializedUnion; - } - } - case 160: - case 168: + return serializeUnionOrIntersectionType(node); + case 161: case 169: case 170: - case 161: + case 171: + case 162: case 118: - case 167: + case 168: break; default: ts.Debug.failBadSyntaxKind(node); @@ -39678,6 +42450,32 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + serializedUnion = serializedIndividual; + } + } + return serializedUnion; + } function serializeTypeReferenceNode(node) { switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { case ts.TypeReferenceSerializationKind.Unknown: @@ -39712,15 +42510,15 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_33 = ts.getMutableClone(node); - name_33.flags &= ~8; - name_33.original = undefined; - name_33.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_33), ts.createLiteral("undefined")), name_33); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_33; - case 141: + return name; + case 142: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -39749,7 +42547,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -39764,7 +42562,7 @@ var ts; hoistVariableDeclaration(generatedName); expression = ts.createAssignment(generatedName, expression); } - return ts.setOriginalNode(ts.createComputedPropertyName(expression, name), name); + return ts.updateComputedPropertyName(name, expression); } else { return name; @@ -39773,13 +42571,12 @@ var ts; function visitHeritageClause(node) { if (node.token === 84) { var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1); - return ts.createHeritageClause(84, types, node); + return ts.setTextRange(ts.createHeritageClause(84, types), node); } return undefined; } function visitExpressionWithTypeArguments(node) { - var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); - return ts.createExpressionWithTypeArguments(undefined, expression, node); + return ts.updateExpressionWithTypeArguments(node, undefined, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); } function shouldEmitFunctionLikeDeclaration(node) { return !ts.nodeIsMissing(node.body); @@ -39788,13 +42585,13 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - return ts.visitEachChild(node, visitor, context); + return ts.updateConstructor(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), ts.visitNodes(node.modifiers, visitor, ts.isModifier), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context)); } function visitMethodDeclaration(node) { if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); if (updated !== node) { ts.setCommentRange(updated, node); ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); @@ -39830,7 +42627,7 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { var statements = [updated]; addExportMemberAssignment(statements, node); @@ -39839,10 +42636,10 @@ var ts; return updated; } function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { + if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createOmittedExpression(); } - var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated; } function visitArrowFunction(node) { @@ -39853,8 +42650,9 @@ var ts; if (ts.parameterIsThisKeyword(node)) { return undefined; } - var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), ts.moveRangePastModifiers(node)); + var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); ts.setOriginalNode(parameter, node); + ts.setTextRange(parameter, ts.moveRangePastModifiers(node)); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); ts.setEmitFlags(parameter.name, 32); @@ -39866,7 +42664,7 @@ var ts; if (variables.length === 0) { return undefined; } - return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node); + return ts.setTextRange(ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))), node); } else { return ts.visitEachChild(node, visitor, context); @@ -39878,7 +42676,7 @@ var ts; return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression); } else { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression)), node); } } function visitVariableDeclaration(node) { @@ -39932,8 +42730,9 @@ var ts; var localName = ts.getLocalName(node, false, true); moduleArg = ts.createAssignment(localName, moduleArg); } - var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg]), node); + var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg])); ts.setOriginalNode(enumStatement, node); + ts.setTextRange(enumStatement, node); ts.setEmitFlags(enumStatement, emitFlags); statements.push(enumStatement); statements.push(ts.createEndOfDeclarationMarker(node)); @@ -39947,11 +42746,11 @@ var ts; ts.addRange(statements, ts.map(node.members, transformEnumMember)); ts.addRange(statements, endLexicalEnvironment()); currentNamespaceContainerName = savedCurrentNamespaceLocalName; - return ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); + return ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true); } function transformEnumMember(member) { var name = getExpressionForPropertyName(member, false); - return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, member), member); + return ts.setTextRange(ts.createStatement(ts.setTextRange(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name), member)), member); } function transformEnumMemberDeclarationValue(member) { var value = resolver.getConstantValue(member); @@ -39983,16 +42782,16 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_34 = node.symbol && node.symbol.name; - if (name_34) { - return currentScopeFirstDeclarationsOfName[name_34] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -40004,7 +42803,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 229) { + if (node.kind === 231) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -40045,8 +42844,9 @@ var ts; var localName = ts.getLocalName(node, false, true); moduleArg = ts.createAssignment(localName, moduleArg); } - var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node); + var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg])); ts.setOriginalNode(moduleStatement, node); + ts.setTextRange(moduleStatement, node); ts.setEmitFlags(moduleStatement, emitFlags); statements.push(moduleStatement); statements.push(ts.createEndOfDeclarationMarker(node)); @@ -40064,8 +42864,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 233) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -40086,14 +42886,15 @@ var ts; currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 231) { + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true); + ts.setTextRange(block, blockLocation); + if (body.kind !== 233) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230) { + if (moduleDeclaration.body.kind === 232) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -40102,18 +42903,18 @@ var ts; if (!node.importClause) { return node; } - var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, true); + var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause); return importClause ? ts.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier) : undefined; } function visitImportClause(node) { var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined; - var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, true); + var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings); return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 237) { + if (node.kind === 239) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -40136,7 +42937,7 @@ var ts; if (!resolver.isValueAliasDeclaration(node)) { return undefined; } - var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, true); + var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports); return exportClause ? ts.updateExportDeclaration(node, undefined, undefined, exportClause, node.moduleSpecifier) : undefined; @@ -40165,9 +42966,9 @@ var ts; var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); ts.setEmitFlags(moduleReference, 1536 | 2048); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { - return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ + return ts.setOriginalNode(ts.setTextRange(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node) - ]), node), node); + ])), node), node); } else { return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node); @@ -40188,7 +42989,7 @@ var ts; && ts.hasModifier(node, 512); } function expressionToStatement(expression) { - return ts.createStatement(expression, undefined); + return ts.createStatement(expression); } function addExportMemberAssignment(statements, node) { var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), ts.getLocalName(node)); @@ -40198,10 +42999,10 @@ var ts; statements.push(statement); } function createNamespaceExport(exportName, exportValue, location) { - return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue), location); + return ts.setTextRange(ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue)), location); } function createNamespaceExportExpression(exportName, exportValue, location) { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location); } function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { return ts.getNamespaceMemberName(currentNamespaceContainerName, name, false, true); @@ -40217,7 +43018,7 @@ var ts; function getClassAliasIfNeeded(node) { if (resolver.getNodeCheckFlags(node) & 8388608) { enableSubstitutionForClassAliases(); - var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default"); + var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.unescapeIdentifier(node.name.text) : "default"); classAliases[ts.getOriginalNodeId(node)] = classAlias; hoistVariableDeclaration(classAlias); return classAlias; @@ -40241,37 +43042,42 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(70); - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(258); - context.enableEmitNotification(230); + context.enableSubstitution(261); + context.enableEmitNotification(232); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 232; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229; + return ts.getOriginalNode(node).kind === 231; } - function onEmitNode(emitContext, node, emitCallback) { + function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; + var savedCurrentSourceFile = currentSourceFile; + if (ts.isSourceFile(node)) { + currentSourceFile = node; + } if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) { applicableSubstitutions |= 2; } if (enabledSubstitutions & 8 && isTransformedEnumDeclaration(node)) { applicableSubstitutions |= 8; } - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); applicableSubstitutions = savedApplicableSubstitutions; + currentSourceFile = savedCurrentSourceFile; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } else if (ts.isShorthandPropertyAssignment(node)) { @@ -40281,14 +43087,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_35 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_35); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_35, initializer, node); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); } - return ts.createPropertyAssignment(name_35, exportedName, node); + return ts.setTextRange(ts.createPropertyAssignment(name, exportedName), node); } } return node; @@ -40297,9 +43103,9 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 177: - return substitutePropertyAccessExpression(node); case 178: + return substitutePropertyAccessExpression(node); + case 179: return substituteElementAccessExpression(node); } return node; @@ -40329,11 +43135,11 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 261) { - var substitute = (applicableSubstitutions & 2 && container.kind === 230) || - (applicableSubstitutions & 8 && container.kind === 229); + if (container && container.kind !== 264) { + var substitute = (applicableSubstitutions & 2 && container.kind === 232) || + (applicableSubstitutions & 8 && container.kind === 231); if (substitute) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), node); } } } @@ -40348,16 +43154,14 @@ var ts; function substituteConstantValue(node) { var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { + ts.setConstantValue(node, constantValue); var substitute = ts.createLiteral(constantValue); - ts.setSourceMapRange(substitute, node); - ts.setCommentRange(substitute, node); if (!compilerOptions.removeComments) { var propertyName = ts.isPropertyAccessExpression(node) ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - substitute.trailingComment = " " + propertyName + " "; + ts.addSyntheticTrailingComment(substitute, 3, " " + propertyName + " "); } - ts.setConstantValue(node, constantValue); return substitute; } return node; @@ -40372,24 +43176,24 @@ var ts; } } ts.transformTypeScript = transformTypeScript; - var paramHelper = { - name: "typescript:param", - scoped: false, - priority: 4, - text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" - }; - function createParamHelper(context, expression, parameterOffset, location) { - context.requestEmitHelper(paramHelper); - return ts.createCall(ts.getHelperName("__param"), undefined, [ - ts.createLiteral(parameterOffset), - expression - ], location); + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + context.requestEmitHelper(decorateHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray), location); } - var metadataHelper = { - name: "typescript:metadata", + var decorateHelper = { + name: "typescript:decorate", scoped: false, - priority: 3, - text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" }; function createMetadataHelper(context, metadataKey, metadataValue) { context.requestEmitHelper(metadataHelper); @@ -40398,30 +43202,289 @@ var ts; metadataValue ]); } - var decorateHelper = { - name: "typescript:decorate", + var metadataHelper = { + name: "typescript:metadata", scoped: false, - priority: 2, - text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" }; - function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { - context.requestEmitHelper(decorateHelper); - var argumentsArray = []; - argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__param"), undefined, [ + ts.createLiteral(parameterOffset), + expression + ]), location); + } + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var ES2017SubstitutionFlags; + (function (ES2017SubstitutionFlags) { + ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); + function transformES2017(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var currentSourceFile; + var enabledSubstitutions; + var enclosingSuperContainerFlags = 0; + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; + } + function visitor(node) { + if ((node.transformFlags & 16) === 0) { + return node; + } + switch (node.kind) { + case 119: + return undefined; + case 190: + return visitAwaitExpression(node); + case 150: + return visitMethodDeclaration(node); + case 227: + return visitFunctionDeclaration(node); + case 185: + return visitFunctionExpression(node); + case 186: + return visitArrowFunction(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitAwaitExpression(node) { + return ts.setOriginalNode(ts.setTextRange(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); + var original = ts.getOriginalNode(node, ts.isFunctionLike); + var nodeType = original.type; + var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; + var isArrowFunction = node.kind === 186; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; + if (!isArrowFunction) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.createBlock(statements, true); + ts.setTextRange(block, node.body); + if (languageVersion >= 2) { + if (resolver.getNodeCheckFlags(node) & 4096) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; + } + else { + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(ts.concatenate(block.statements, declarations)), block.statements)); + } + return expression; + } + } + function transformFunctionBodyWorker(body, start) { + if (ts.isBlock(body)) { + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); + } + else { + startLexicalEnvironment(); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); + var declarations = endLexicalEnvironment(); + return ts.updateBlock(visited, ts.setTextRange(ts.createNodeArray(ts.concatenate(visited.statements, declarations)), visited.statements)); + } + } + function getPromiseConstructor(type) { + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; + } + } + return undefined; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution(180); + context.enableSubstitution(178); + context.enableSubstitution(179); + context.enableEmitNotification(228); + context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); } } - return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location); + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178: + return substitutePropertyAccessExpression(node); + case 179: + return substituteElementAccessExpression(node); + case 180: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 + || kind === 151 + || kind === 150 + || kind === 152 + || kind === 153; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); + } + } + } + ts.transformES2017 = transformES2017; + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); } + ts.asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];\n " + }; + ts.advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);\n " + }; })(ts || (ts = {})); var ts; (function (ts) { + var ESNextSubstitutionFlags; + (function (ESNextSubstitutionFlags) { + ESNextSubstitutionFlags[ESNextSubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ESNextSubstitutionFlags || (ESNextSubstitutionFlags = {})); function transformESNext(context) { - var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var enabledSubstitutions; + var enclosingFunctionFlags; + var enclosingSuperContainerFlags = 0; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { @@ -40437,53 +43500,93 @@ var ts; function visitorNoDestructuringValue(node) { return visitorWorker(node, true); } + function visitorNoAsyncModifier(node) { + if (node.kind === 119) { + return undefined; + } + return node; + } function visitorWorker(node, noDestructuringValue) { if ((node.transformFlags & 8) === 0) { return node; } switch (node.kind) { - case 176: + case 190: + return visitAwaitExpression(node); + case 196: + return visitYieldExpression(node); + case 221: + return visitLabeledStatement(node); + case 177: return visitObjectLiteralExpression(node); - case 192: + case 193: return visitBinaryExpression(node, noDestructuringValue); - case 223: + case 225: return visitVariableDeclaration(node); + case 215: + return visitForOfStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 211: return visitForStatement(node); - case 188: + case 189: return visitVoidExpression(node); - case 150: + case 151: return visitConstructorDeclaration(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessorDeclaration(node); case 152: + return visitGetAccessorDeclaration(node); + case 153: return visitSetAccessorDeclaration(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 207: + case 209: return visitExpressionStatement(node); - case 183: + case 184: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); } } + function visitAwaitExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.setOriginalNode(ts.setTextRange(ts.createYield(undefined, ts.createArrayLiteral([ts.createLiteral("await"), expression])), node), node); + } + return ts.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.updateYield(node, node.asteriskToken, node.asteriskToken + ? createAsyncDelegatorHelper(context, expression, expression) + : ts.createArrayLiteral(expression + ? [ts.createLiteral("yield"), expression] + : [ts.createLiteral("yield")])); + } + return ts.visitEachChild(node, visitor, context); + } + function visitLabeledStatement(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var statement = ts.unwrapInnermostStatementOfLabel(node); + if (statement.kind === 215 && statement.awaitModifier) { + return visitForOfStatement(statement, node); + } + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), node); + } + return ts.visitEachChild(node, visitor, context); + } function chunkObjectLiteralElements(elements) { var chunkObject; var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259) { + for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { + var e = elements_4[_i]; + if (e.kind === 262) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -40495,7 +43598,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257) { + if (e.kind === 260) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -40512,7 +43615,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 1048576) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { + if (objects.length && objects[0].kind !== 177) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -40546,68 +43649,202 @@ var ts; function visitVoidExpression(node) { return ts.visitEachChild(node, visitorNoDestructuringValue, context); } - function visitForOfStatement(node) { - var leadingStatements; - var temp; - var initializer = ts.skipParentheses(node.initializer); - if (initializer.transformFlags & 1048576) { - if (ts.isVariableDeclarationList(initializer)) { - temp = ts.createTempVariable(undefined); - var firstDeclaration = ts.firstOrUndefined(initializer.declarations); - var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true); - if (ts.some(declarations)) { - var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer); - leadingStatements = ts.append(leadingStatements, statement); - } - } - else if (ts.isAssignmentPattern(initializer)) { - temp = ts.createTempVariable(undefined); - var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1); - leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer)); + function visitForOfStatement(node, outermostLabeledStatement) { + if (node.initializer.transformFlags & 1048576) { + node = transformForOfStatementWithObjectRest(node); + } + if (node.awaitModifier) { + return transformForAwaitOfStatement(node, outermostLabeledStatement); + } + else { + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement); + } + } + function transformForOfStatementWithObjectRest(node) { + var initializerWithoutParens = ts.skipParentheses(node.initializer); + if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) { + var bodyLocation = void 0; + var statementsLocation = void 0; + var temp = ts.createTempVariable(undefined); + var statements = [ts.createForOfBindingStatement(initializerWithoutParens, temp)]; + if (ts.isBlock(node.statement)) { + ts.addRange(statements, node.statement.statements); + bodyLocation = node.statement; + statementsLocation = node.statement.statements; } + return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) + ], 1), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation)); } - if (temp) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - var block = ts.isBlock(statement) - ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) - : ts.createBlock(ts.append(leadingStatements, statement), statement, true); - return ts.updateForOf(node, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(temp, undefined, undefined, node.initializer) - ], node.initializer, 1), expression, block); + return node; + } + function convertForOfStatementHead(node, boundValue) { + var binding = ts.createForOfBindingStatement(node.initializer, boundValue); + var bodyLocation; + var statementsLocation; + var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; } - return ts.visitEachChild(node, visitor, context); + else { + statements.push(statement); + } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + } + function transformForAwaitOfStatement(node, outermostLabeledStatement) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(undefined); + var values = createAsyncValuesHelper(context, expression, node.expression); + var next = ts.createYield(undefined, enclosingFunctionFlags & 1 + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, []) + ]) + : ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, [])); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, values), node.expression), + ts.createVariableDeclaration(result, undefined, next) + ]), node.expression), 1048576), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"))), node), 256); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1)), ts.createBlock([ + ts.createTry(ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createYield(undefined, enclosingFunctionFlags & 1 + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createFunctionCall(returnMethod, iterator, []) + ]) + : ts.createFunctionCall(returnMethod, iterator, [])))), 1) + ]), undefined, ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1) + ]), 1)) + ])); } function visitParameter(node) { if (node.transformFlags & 1048576) { - return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); } return ts.visitEachChild(node, visitor, context); } function visitConstructorDeclaration(node) { - return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitGetAccessorDeclaration(node) { - return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitSetAccessorDeclaration(node) { - return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitMethodDeclaration(node) { - return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateMethod(node, undefined, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(undefined, visitor, ts.isToken), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionDeclaration(node, undefined, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitArrowFunction(node) { - return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionExpression(node, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function transformAsyncGeneratorFunctionBody(node) { + resumeLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor); + appendObjectRestAssignmentsIfNeeded(statements, node); + statements.push(ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression(undefined, ts.createToken(38), node.name && ts.getGeneratedNameForNode(node.name), undefined, [], undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.updateBlock(node.body, statements); + if (languageVersion >= 2) { + if (resolver.getNodeCheckFlags(node) & 4096) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; } function transformFunctionBody(node) { resumeLexicalEnvironment(); - var leadingStatements; + var statementOffset = 0; + var statements = []; + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologue(statements, body.statements, false, visitor); + } + ts.addRange(statements, appendObjectRestAssignmentsIfNeeded(undefined, node)); + var trailingStatements = endLexicalEnvironment(); + if (statementOffset > 0 || ts.some(statements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, true); + ts.addRange(statements, block.statements.slice(statementOffset)); + ts.addRange(statements, trailingStatements); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(statements), block.statements)); + } + return body; + } + function appendObjectRestAssignmentsIfNeeded(statements, node) { for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; if (parameter.transformFlags & 1048576) { @@ -40616,17 +43853,95 @@ var ts; if (ts.some(declarations)) { var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations)); ts.setEmitFlags(statement, 524288); - leadingStatements = ts.append(leadingStatements, statement); + statements = ts.append(statements, statement); } } } - var body = ts.visitNode(node.body, visitor, ts.isConciseBody); - var trailingStatements = endLexicalEnvironment(); - if (ts.some(leadingStatements) || ts.some(trailingStatements)) { - var block = ts.convertToFunctionBody(body, true); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + return statements; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution(180); + context.enableSubstitution(178); + context.enableSubstitution(179); + context.enableEmitNotification(228); + context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); + } + } + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178: + return substitutePropertyAccessExpression(node); + case 179: + return substituteElementAccessExpression(node); + case 180: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 + || kind === 151 + || kind === 150 + || kind === 152 + || kind === 153; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); } - return body; } } ts.transformESNext = transformESNext; @@ -40637,25 +43952,57 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); } ts.createAssignHelper = createAssignHelper; + var asyncGeneratorHelper = { + name: "typescript:asyncGenerator", + scoped: false, + text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), q = [], c, i;\n return i = { next: verb(\"next\"), \"throw\": verb(\"throw\"), \"return\": verb(\"return\") }, i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }\n function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }\n function step(r) { r.done ? settle(c[2], r) : Promise.resolve(r.value[1]).then(r.value[0] === \"yield\" ? _yield : r.value[0] === \"delegate\" ? delegate : fulfill, reject); }\n function _yield(value) { settle(c[2], { value: value, done: false }); }\n function delegate(r) { step(r.done ? r : { value: [\"yield\", r.value], done: false }); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { c = void 0, f(v), next(); }\n };\n " + }; + function createAsyncGeneratorHelper(context, generatorFunc) { + context.requestEmitHelper(asyncGeneratorHelper); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__asyncGenerator"), undefined, [ + ts.createThis(), + ts.createIdentifier("arguments"), + generatorFunc + ]); + } + var asyncDelegator = { + name: "typescript:asyncDelegator", + scoped: false, + text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i = { next: verb(\"next\"), \"throw\": verb(\"throw\", function (e) { throw e; }), \"return\": verb(\"return\", function (v) { return { value: v, done: true }; }) };\n return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { return function (v) { return { value: [\"delegate\", (o[n] || f).call(o, v)], done: false }; }; }\n };\n " + }; + function createAsyncDelegatorHelper(context, expression, location) { + context.requestEmitHelper(asyncDelegator); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"), undefined, [expression]), location); + } + var asyncValues = { + name: "typescript:asyncValues", + scoped: false, + text: "\n var __asyncValues = (this && this.__asyncIterator) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator];\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\n };\n " + }; + function createAsyncValuesHelper(context, expression, location) { + context.requestEmitHelper(asyncValues); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"), undefined, [expression]), location); + } })(ts || (ts = {})); var ts; (function (ts) { function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); - var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFile = node; var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; return visited; } function visitor(node) { @@ -40668,11 +44015,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246: + case 248: return visitJsxElement(node, false); - case 247: + case 249: return visitJsxSelfClosingElement(node, false); - case 252: + case 255: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -40682,11 +44029,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 252: + case 255: return visitJsxExpression(node); - case 246: + case 248: return visitJsxElement(node, true); - case 247: + case 249: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -40702,7 +44049,7 @@ var ts; function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; - var attrs = node.attributes; + var attrs = node.attributes.properties; if (attrs.length === 0) { objectProperties = ts.createNull(); } @@ -40734,13 +44081,16 @@ var ts; } function transformJsxAttributeInitializer(node) { if (node === undefined) { - return ts.createLiteral(true); + return ts.createTrue(); } else if (node.kind === 9) { var decoded = tryDecodeEntities(node.text); - return decoded ? ts.createLiteral(decoded, node) : node; + return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 252) { + else if (node.kind === 255) { + if (node.expression === undefined) { + return ts.createTrue(); + } return visitJsxExpression(node); } else { @@ -40748,43 +44098,35 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + function fixupWhitespaceAndDecodeEntities(text) { + var acc; var firstNonWhitespace = 0; var lastNonWhitespace = -1; for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } function decodeEntities(text) { return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { @@ -40795,7 +44137,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); return ch ? String.fromCharCode(ch) : match; } }); @@ -40805,16 +44147,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246) { + if (node.kind === 248) { return getTagName(node.openingElement); } else { - var name_36 = node.tagName; - if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) { - return ts.createLiteral(name_36.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_36); + return ts.createExpressionFromEntityName(name); } } } @@ -40832,7 +44174,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -41089,263 +44431,6 @@ var ts; }); })(ts || (ts = {})); var ts; -(function (ts) { - function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; - var resolver = context.getEmitResolver(); - var compilerOptions = context.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var currentSourceFile; - var enabledSubstitutions; - var currentSuperContainer; - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; - } - currentSourceFile = node; - var visited = ts.visitEachChild(node, visitor, context); - ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; - return visited; - } - function visitor(node) { - if ((node.transformFlags & 16) === 0) { - return node; - } - switch (node.kind) { - case 119: - return undefined; - case 189: - return visitAwaitExpression(node); - case 149: - return visitMethodDeclaration(node); - case 225: - return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); - case 185: - return visitArrowFunction(node); - default: - return ts.visitEachChild(node, visitor, context); - } - } - function visitAwaitExpression(node) { - return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node); - } - function visitMethodDeclaration(node) { - return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { - return ts.createOmittedExpression(); - } - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function visitArrowFunction(node) { - return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function transformAsyncFunctionBody(node) { - resumeLexicalEnvironment(); - var original = ts.getOriginalNode(node, ts.isFunctionLike); - var nodeType = original.type; - var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; - if (!isArrowFunction) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor); - statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); - ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(statements, node.body, true); - if (languageVersion >= 2) { - if (resolver.getNodeCheckFlags(node) & 4096) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, advancedAsyncSuperHelper); - } - else if (resolver.getNodeCheckFlags(node) & 2048) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, asyncSuperHelper); - } - } - return block; - } - else { - var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); - var declarations = endLexicalEnvironment(); - if (ts.some(declarations)) { - var block = ts.convertToFunctionBody(expression); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); - } - return expression; - } - } - function transformFunctionBodyWorker(body, start) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); - } - else { - startLexicalEnvironment(); - var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); - var declarations = endLexicalEnvironment(); - return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); - } - } - function getPromiseConstructor(type) { - var typeName = type && ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } - } - return undefined; - } - function enableSubstitutionForAsyncMethodsWithSuper() { - if ((enabledSubstitutions & 1) === 0) { - enabledSubstitutions |= 1; - context.enableSubstitution(179); - context.enableSubstitution(177); - context.enableSubstitution(178); - context.enableEmitNotification(226); - context.enableEmitNotification(149); - context.enableEmitNotification(151); - context.enableEmitNotification(152); - context.enableEmitNotification(150); - } - } - function substituteExpression(node) { - switch (node.kind) { - case 177: - return substitutePropertyAccessExpression(node); - case 178: - return substituteElementAccessExpression(node); - case 179: - if (enabledSubstitutions & 1) { - return substituteCallExpression(node); - } - break; - } - return node; - } - function substitutePropertyAccessExpression(node) { - if (enabledSubstitutions & 1 && node.expression.kind === 96) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node); - } - } - return node; - } - function substituteElementAccessExpression(node) { - if (enabledSubstitutions & 1 && node.expression.kind === 96) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node); - } - } - return node; - } - function substituteCallExpression(node) { - var expression = node.expression; - if (ts.isSuperProperty(expression)) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - var argumentExpression = ts.isPropertyAccessExpression(expression) - ? substitutePropertyAccessExpression(expression) - : substituteElementAccessExpression(expression); - return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ - ts.createThis() - ].concat(node.arguments)); - } - } - return node; - } - function isSuperContainer(node) { - var kind = node.kind; - return kind === 226 - || kind === 150 - || kind === 149 - || kind === 151 - || kind === 152; - } - function onEmitNode(emitContext, node, emitCallback) { - if (enabledSubstitutions & 1 && isSuperContainer(node)) { - var savedCurrentSuperContainer = currentSuperContainer; - currentSuperContainer = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSuperContainer = savedCurrentSuperContainer; - } - else { - previousOnEmitNode(emitContext, node, emitCallback); - } - } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { - return substituteExpression(node); - } - return node; - } - function createSuperAccessInAsyncMethod(argumentExpression, flags, location) { - if (flags & 4096) { - return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value", location); - } - else { - return ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression], location); - } - } - function getSuperContainerAsyncMethodFlags() { - return currentSuperContainer !== undefined - && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096); - } - } - ts.transformES2017 = transformES2017; - function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { - context.requestEmitHelper(awaiterHelper); - var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; - return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ - ts.createThis(), - hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), - promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), - generatorFunc - ]); - } - var awaiterHelper = { - name: "typescript:awaiter", - scoped: false, - priority: 5, - text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };" - }; - var asyncSuperHelper = { - name: "typescript:async-super", - scoped: true, - text: "\n const _super = name => super[name];" - }; - var advancedAsyncSuperHelper = { - name: "typescript:advanced-async-super", - scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" - }; -})(ts || (ts = {})); -var ts; (function (ts) { function transformES2016(context) { var hoistVariableDeclaration = context.hoistVariableDeclaration; @@ -41361,7 +44446,7 @@ var ts; return node; } switch (node.kind) { - case 192: + case 193: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -41385,19 +44470,19 @@ var ts; if (ts.isElementAccessExpression(left)) { var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); + target = ts.setTextRange(ts.createElementAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), ts.setTextRange(ts.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left); + value = ts.setTextRange(ts.createElementAccess(expressionTemp, argumentExpressionTemp), left); } else if (ts.isPropertyAccessExpression(left)) { var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); - value = ts.createPropertyAccess(expressionTemp, left.name, left); + target = ts.setTextRange(ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), left.name), left); + value = ts.setTextRange(ts.createPropertyAccess(expressionTemp, left.name), left); } else { target = left; value = left; } - return ts.createAssignment(target, ts.createMathPow(value, right, node), node); + return ts.setTextRange(ts.createAssignment(target, ts.createMathPow(value, right, node)), node); } function visitExponentiationExpression(node) { var left = ts.visitNode(node.left, visitor, ts.isExpression); @@ -41409,8 +44494,78 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var ES2015SubstitutionFlags; + (function (ES2015SubstitutionFlags) { + ES2015SubstitutionFlags[ES2015SubstitutionFlags["CapturedThis"] = 1] = "CapturedThis"; + ES2015SubstitutionFlags[ES2015SubstitutionFlags["BlockScopedBindings"] = 2] = "BlockScopedBindings"; + })(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {})); + var CopyDirection; + (function (CopyDirection) { + CopyDirection[CopyDirection["ToOriginal"] = 0] = "ToOriginal"; + CopyDirection[CopyDirection["ToOutParameter"] = 1] = "ToOutParameter"; + })(CopyDirection || (CopyDirection = {})); + var Jump; + (function (Jump) { + Jump[Jump["Break"] = 2] = "Break"; + Jump[Jump["Continue"] = 4] = "Continue"; + Jump[Jump["Return"] = 8] = "Return"; + })(Jump || (Jump = {})); + var SuperCaptureResult; + (function (SuperCaptureResult) { + SuperCaptureResult[SuperCaptureResult["NoReplacement"] = 0] = "NoReplacement"; + SuperCaptureResult[SuperCaptureResult["ReplaceSuperCapture"] = 1] = "ReplaceSuperCapture"; + SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; + })(SuperCaptureResult || (SuperCaptureResult = {})); + var HierarchyFacts; + (function (HierarchyFacts) { + HierarchyFacts[HierarchyFacts["None"] = 0] = "None"; + HierarchyFacts[HierarchyFacts["Function"] = 1] = "Function"; + HierarchyFacts[HierarchyFacts["ArrowFunction"] = 2] = "ArrowFunction"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBody"] = 4] = "AsyncFunctionBody"; + HierarchyFacts[HierarchyFacts["NonStaticClassElement"] = 8] = "NonStaticClassElement"; + HierarchyFacts[HierarchyFacts["CapturesThis"] = 16] = "CapturesThis"; + HierarchyFacts[HierarchyFacts["ExportedVariableStatement"] = 32] = "ExportedVariableStatement"; + HierarchyFacts[HierarchyFacts["TopLevel"] = 64] = "TopLevel"; + HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block"; + HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement"; + HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock"; + HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement"; + HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper"; + HierarchyFacts[HierarchyFacts["ComputedPropertyName"] = 8192] = "ComputedPropertyName"; + HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask"; + HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; + HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes"; + HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes"; + HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes"; + HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes"; + HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 16256] = "ArrowFunctionExcludes"; + HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes"; + HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; + HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes"; + HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes"; + HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameIncludes"] = 8192] = "ComputedPropertyNameIncludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameExcludes"] = 0] = "ComputedPropertyNameExcludes"; + HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget"; + HierarchyFacts[HierarchyFacts["NewTargetInComputedPropertyName"] = 32768] = "NewTargetInComputedPropertyName"; + HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask"; + HierarchyFacts[HierarchyFacts["PropagateNewTargetMask"] = 49152] = "PropagateNewTargetMask"; + })(HierarchyFacts || (HierarchyFacts = {})); function transformES2015(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -41418,15 +44573,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; var convertedLoopState; var enabledSubstitutions; return transformSourceFile; @@ -41436,247 +44583,207 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); - } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383; + return ancestorFacts; } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; - } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; + return hierarchyFacts & 4096 + && node.kind === 218 + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64) !== 0 || - node.kind === 219 || - (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 && ts.isStatement(node)) + || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205: - return visitVariableStatement(node); - case 218: - return visitSwitchStatement(node); - case 215: - case 214: - return visitBreakOrContinueStatement(node); - case 98: - return visitThisKeyword(node); - case 70: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96) { + return visitSuperKeyword(true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114: return undefined; - case 226: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 144: + case 145: return visitParameter(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 185: + case 186: return visitArrowFunction(node); - case 184: + case 185: return visitFunctionExpression(node); - case 223: + case 225: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 224: + case 226: return visitVariableDeclarationList(node); - case 219: + case 220: + return visitSwitchStatement(node); + case 234: + return visitCaseBlock(node); + case 206: + return visitBlock(node, false); + case 217: + case 216: + return visitBreakOrContinueStatement(node); + case 221: return visitLabeledStatement(node); - case 209: - return visitDoStatement(node); - case 210: - return visitWhileStatement(node); case 211: - return visitForStatement(node); case 212: - return visitForInStatement(node); + return visitDoOrWhileStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 207: + return visitForStatement(node, undefined); + case 214: + return visitForInStatement(node, undefined); + case 215: + return visitForOfStatement(node, undefined); + case 209: return visitExpressionStatement(node); - case 176: + case 177: return visitObjectLiteralExpression(node); - case 256: + case 259: return visitCatchClause(node); - case 258: + case 261: return visitShorthandPropertyAssignment(node); - case 175: + case 143: + return visitComputedPropertyName(node); + case 176: return visitArrayLiteralExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 183: + case 184: return visitParenthesizedExpression(node, true); - case 192: + case 193: return visitBinaryExpression(node, true); case 12: case 13: case 14: case 15: return visitTemplateLiteral(node); - case 181: + case 9: + return visitStringLiteral(node); + case 8: + return visitNumericLiteral(node); + case 182: return visitTaggedTemplateExpression(node); - case 194: - return visitTemplateExpression(node); case 195: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 196: + return visitYieldExpression(node); + case 197: return visitSpreadElement(node); case 96: - return visitSuperKeyword(); - case 195: - return ts.visitEachChild(node, visitor, context); - case 149: + return visitSuperKeyword(false); + case 98: + return visitThisKeyword(node); + case 203: + return visitMetaProperty(node); + case 150: return visitMethodDeclaration(node); - case 205: + case 152: + case 153: + return visitAccessorDeclaration(node); + case 207: return visitVariableStatement(node); + case 218: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968, 64); var statements = []; startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); + var statementOffset = ts.addStandardPrologue(statements, node.statements, false); addCaptureThisForNodeIfNeeded(statements, node); + statementOffset = ts.addCustomPrologue(statements, node.statements, statementOffset, visitor); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + exitSubtree(ancestorFacts, 0, 0); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - convertedLoopState.allowedNonLabeledJumps |= 2; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032, 0); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185) { - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2) { + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -41685,20 +44792,20 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 215 ? 2 : 4; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 ? 2 : 4; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215) { + if (node.kind === 217) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -41708,7 +44815,7 @@ var ts; } } else { - if (node.kind === 215) { + if (node.kind === 217) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -41741,8 +44848,9 @@ var ts; var variable = ts.createVariableDeclaration(ts.getLocalName(node, true), undefined, transformClassLikeDeclarationToExpression(node)); ts.setOriginalNode(variable, node); var statements = []; - var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable]), node); + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable])); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, node); ts.startOnNewLine(statement); statements.push(statement); if (ts.hasModifier(node, 1)) { @@ -41797,23 +44905,29 @@ var ts; ts.setEmitFlags(statement, 1536 | 384); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true); ts.setEmitFlags(block, 1536); return block; } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement)); + statements.push(ts.setTextRange(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node))), extendsClauseElement)); } } function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278, 73); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); - var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); + var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper)); + ts.setTextRange(constructorFunction, constructor || node); if (extendsClauseElement) { ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; } function transformConstructorParameters(constructor, hasSynthesizedSuper) { return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) @@ -41827,48 +44941,55 @@ var ts; statementOffset = 0; } else if (constructor) { - statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor); + statementOffset = ts.addStandardPrologue(statements, constructor.body.statements, false); } if (constructor) { addDefaultValueAssignmentsIfNeeded(statements, constructor); addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + if (!hasSynthesizedSuper) { + statementOffset = ts.addCustomPrologue(statements, constructor.body.statements, statementOffset, visitor); + } ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); if (superCaptureStatus === 1 || superCaptureStatus === 2) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1) { + hierarchyFacts |= 4096; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset)); } - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, false); + } + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true); + ts.setTextRange(block, constructor ? constructor.body : node); if (!constructor) { ts.setEmitFlags(block, 1536); } return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 216) { + if (statement.kind === 218) { return true; } - else if (statement.kind === 208) { + else if (statement.kind === 210) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204) { + else if (statement.kind === 206) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -41876,8 +44997,8 @@ var ts; } return false; } - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { - if (!hasExtendsClause) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -41897,42 +45018,43 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 209 && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } - if (superCallExpression && statementOffset === ctorStatements.length - 1) { + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 - || superCallExpression.left.kind !== 179) { + if (superCallExpression.kind !== 193 + || superCallExpression.left.kind !== 180) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); statements.push(returnStatement); return 2; } - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); if (superCallExpression) { return 1; } return 0; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { return undefined; } else if (ts.isBindingPattern(node.name)) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined, node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined), node), node); } else if (node.initializer) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined, node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined), node), node); } else { return node; @@ -41947,15 +45069,15 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_37 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_37)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_37, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_37, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -41970,10 +45092,11 @@ var ts; } function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ - ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter)) - ], parameter), 1 | 32 | 384), undefined, parameter); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.setTextRange(ts.createBlock([ + ts.createStatement(ts.setTextRange(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer))), parameter)) + ]), parameter), 1 | 32 | 384)); statement.startsOnNewLine = true; + ts.setTextRange(statement, parameter); ts.setEmitFlags(statement, 384 | 32 | 524288); statements.push(statement); } @@ -41990,22 +45113,22 @@ var ts; var expressionName = ts.getSynthesizedClone(parameter.name); var restIndex = node.parameters.length - 1; var temp = ts.createLoopVariable(); - statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + statements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([])) - ]), parameter), 524288)); - var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ])), parameter), 524288)); + var forStatement = ts.createFor(ts.setTextRange(ts.createVariableDeclarationList([ ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex)) - ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([ - ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ]), parameter), ts.setTextRange(ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length")), parameter), ts.setTextRange(ts.createPostfixIncrement(temp), parameter), ts.createBlock([ + ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 ? temp - : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter)) + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp))), parameter)) ])); ts.setEmitFlags(forStatement, 524288); ts.startOnNewLine(forStatement); statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 185) { + if (node.transformFlags & 32768 && node.kind !== 186) { captureThisForNode(statements, node, ts.createThis()); } } @@ -42013,29 +45136,62 @@ var ts; enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("_this", undefined, initializer) - ]), originalStatement); + ])); ts.setEmitFlags(captureThisStatement, 1536 | 524288); + ts.setTextRange(captureThisStatement, originalStatement); ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384) { + var newTarget = void 0; + switch (node.kind) { + case 186: + return statements; + case 150: + case 152: + case 153: + newTarget = ts.createVoidZero(); + break; + case 151: + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); + break; + case 227: + case 185: + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203: + case 205: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + case 150: + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150: + case 151: break; default: ts.Debug.failBadSyntaxKind(node); @@ -42044,28 +45200,32 @@ var ts; } } function transformSemicolonClassElementToStatement(member) { - return ts.createEmptyStatement(member); + return ts.setTextRange(ts.createEmptyStatement(), member); } - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0, 0); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); - var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined, container); ts.setEmitFlags(memberFunction, 1536); ts.setSourceMapRange(memberFunction, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); + var statement = ts.setTextRange(ts.createStatement(ts.createAssignment(memberName, memberFunction)), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); ts.setEmitFlags(statement, 48); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return statement; } - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, false)); ts.setEmitFlags(statement, 1536); + ts.setSourceMapRange(statement, ts.getSourceMapRange(accessors.firstAccessor)); return statement; } - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0, 0); var target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); @@ -42074,7 +45234,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -42082,51 +45242,86 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); } - properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true))); + properties.push(ts.createPropertyAssignment("enumerable", ts.createTrue()), ts.createPropertyAssignment("configurable", ts.createTrue())); var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ target, propertyName, - ts.createObjectLiteral(properties, undefined, true) + ts.createObjectLiteral(properties, true) ]); if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return call; } function visitArrowFunction(node) { if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } - var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256, 66); + var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + ts.setTextRange(func, node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8); + exitSubtree(ancestorFacts, 0, 0); + convertedLoopState = savedConvertedLoopState; return func; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var ancestorFacts = ts.getEmitFlags(node) & 131072 + ? enterSubtree(16278, 69) + : enterSubtree(16286, 65); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, undefined, node.asteriskToken, name, undefined, parameters, undefined, body); } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, undefined, parameters, undefined, body); } - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32) + ? enterSubtree(16286, 65 | 8) + : enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 && !name && (node.kind === 227 || node.kind === 185)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body), location), node); } function transformFunctionBody(node) { var multiLine = false; @@ -42138,7 +45333,7 @@ var ts; var statementOffset; resumeLexicalEnvironment(); if (ts.isBlock(body)) { - statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + statementOffset = ts.addStandardPrologue(statements, body.statements, false); } addCaptureThisForNodeIfNeeded(statements, node); addDefaultValueAssignmentsIfNeeded(statements, node); @@ -42147,6 +45342,7 @@ var ts; multiLine = true; } if (ts.isBlock(body)) { + statementOffset = ts.addCustomPrologue(statements, body.statements, statementOffset, visitor); statementsLocation = body.statements; ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); if (!multiLine && body.multiLine) { @@ -42154,7 +45350,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185); + ts.Debug.assert(node.kind === 186); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -42166,17 +45362,20 @@ var ts; } } var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = ts.createReturn(expression, body); + var returnStatement = ts.createReturn(expression); + ts.setTextRange(returnStatement, body); ts.setEmitFlags(returnStatement, 384 | 32 | 1024); statements.push(returnStatement); closeBraceLocation = body; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, false); if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), multiLine); + ts.setTextRange(block, node.body); if (!multiLine && singleLine) { ts.setEmitFlags(block, 1); } @@ -42186,11 +45385,26 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.setTextRange(ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, true)), updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 + ? enterSubtree(4032, 512) + : enterSubtree(3904, 128); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -42198,9 +45412,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -42210,9 +45424,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { + var ancestorFacts = enterSubtree(0, ts.hasModifier(node, 1) ? 32 : 0); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3) === 0) { var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; @@ -42225,53 +45442,59 @@ var ts; else { assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression)); } - (assignments || (assignments = [])).push(assignment); + assignments = ts.append(assignments, assignment); } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); + updated = ts.setTextRange(ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); })), node); } else { - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function visitVariableDeclarationList(node) { - if (node.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64) { + if (node.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations); + ts.setOriginalNode(declarationList, node); + ts.setTextRange(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } function shouldEmitExplicitInitializerForLetDeclaration(node) { var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, false)); + && (hierarchyFacts & 512) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 - && enclosingBlockScopeContainer.kind !== 213 + && (hierarchyFacts & 2048) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, false))); + && (hierarchyFacts & (1024 | 2048)) === 0)); return emitExplicitInitializer; } function visitVariableDeclarationInLetDeclarationList(node) { @@ -42287,84 +45510,94 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { + var ancestorFacts = enterSubtree(32, 0); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, (ancestorFacts & 32) !== 0); } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels.set(node.label.text, node.label.text); + } + function resetLabel(node) { + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - var result; - if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); - } - else { - result = ts.visitEachChild(node, visitor, context); - } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + var statement = ts.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, false) + ? visitIterationStatement(statement, node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 211: + case 212: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 213: + return visitForStatement(node, outermostLabeledStatement); + case 214: + return visitForInStatement(node, outermostLabeledStatement); + case 215: + return visitForOfStatement(node, outermostLabeledStatement); } - return result; } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0, 0); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement); } - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } - function convertForOfToFor(node, convertedLoopBodyStatements) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; + function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { var statements = []; - var counter = ts.createLoopVariable(); - var rhsReference = expression.kind === 70 - ? ts.createUniqueName(expression.text) - : ts.createTempVariable(undefined); - var elementAccess = ts.createElementAccess(rhsReference, counter); - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3) { + if (ts.isVariableDeclarationList(node.initializer)) { + if (node.initializer.flags & 3) { enableSubstitutionsForBlockScopedBindings(); } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + var firstOriginalDeclaration = ts.firstOrUndefined(node.initializer.declarations); if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess); - var declarationList = ts.createVariableDeclarationList(declarations, initializer); - ts.setOriginalNode(declarationList, initializer); + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, boundValue); + var declarationList = ts.setTextRange(ts.createVariableDeclarationList(declarations), node.initializer); + ts.setOriginalNode(declarationList, node.initializer); var firstDeclaration = declarations[0]; var lastDeclaration = ts.lastOrUndefined(declarations); ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); statements.push(ts.createVariableStatement(undefined, declarationList)); } else { - statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter)) - ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); + statements.push(ts.setTextRange(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.setTextRange(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, boundValue) + ]), ts.moveRangePos(node.initializer, -1)), node.initializer)), ts.moveRangeEnd(node.initializer, -1))); } } else { - var assignment = ts.createAssignment(initializer, elementAccess); + var assignment = ts.createAssignment(node.initializer, boundValue); if (ts.isDestructuringAssignment(assignment)) { - statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0))); + ts.aggregateTransformFlags(assignment); + statements.push(ts.createStatement(visitBinaryExpression(assignment, false))); } else { - assignment.end = initializer.end; - statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1))); + assignment.end = node.initializer.end; + statements.push(ts.setTextRange(ts.createStatement(ts.visitNode(assignment, visitor, ts.isExpression)), ts.moveRangeEnd(node.initializer, -1))); } } var bodyLocation; @@ -42373,7 +45606,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -42383,39 +45616,82 @@ var ts; statements.push(statement); } } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + } + function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var counter = ts.createLoopVariable(); + var rhsReference = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression)); - var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation); - ts.setEmitFlags(body, 48 | 384); - var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)), - ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) - ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); + var forStatement = ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0)), ts.moveRangePos(node.expression, -1)), + ts.setTextRange(ts.createVariableDeclaration(rhsReference, undefined, expression), node.expression) + ]), node.expression), 1048576), ts.setTextRange(ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length")), node.expression), ts.setTextRange(ts.createPostfixIncrement(counter), node.expression), convertForOfStatementHead(node, ts.createElementAccess(rhsReference, counter), convertedLoopBodyStatements)), node); ts.setEmitFlags(forStatement, 256); - return forStatement; + ts.setTextRange(forStatement, node); + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(undefined); + var values = ts.createValuesHelper(context, expression, node.expression); + var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, []); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, values), node.expression), + ts.createVariableDeclaration(result, undefined, next) + ]), node.expression), 1048576), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"), convertedLoopBodyStatements)), node), 256); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1)), ts.createBlock([ + ts.createTry(ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createFunctionCall(returnMethod, iterator, []))), 1), + ]), undefined, ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1) + ]), 1)) + ])); } function visitObjectLiteralExpression(node) { var properties = node.properties; var numProperties = properties.length; var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 - || property.name.kind === 142) { + if ((property.transformFlags & 16777216 && hierarchyFacts & 4) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 143) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - var temp = ts.createTempVariable(hoistVariableDeclaration); - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + var temp = ts.createTempVariable(hoistVariableDeclaration); + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), 32768)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536) !== 0; @@ -42439,14 +45715,16 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 | 4; } - var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -42455,11 +45733,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211: - case 212: case 213: + case 214: + case 215: var initializer = node.initializer; - if (initializer && initializer.kind === 224) { + if (initializer && initializer.kind === 226) { loopInitializer = initializer; } break; @@ -42485,19 +45763,26 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + startLexicalEnvironment(); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1, statements_4); - loopBody = ts.createBlock(statements_4, undefined, true); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, true); } - if (!ts.isBlock(loopBody)) { - loopBody = ts.createBlock([loopBody], undefined, true); + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + else { + loopBody = ts.createBlock([loopBody], true); + } + var isAsyncBlockContainingAwait = hierarchyFacts & 4 && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -42556,19 +45841,18 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); - loop.statement = undefined; - loop = ts.visitEachChild(loop, visitor, context); - loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); - } - statements.push(currentParent.kind === 219 - ? ts.createLabel(currentParent.label, loop) - : loop); + var clone_4 = ts.getMutableClone(node); + clone_4.statement = undefined; + clone_4 = ts.visitEachChild(clone_4, visitor, context); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, true); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); + } + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -42589,7 +45873,9 @@ var ts; !state.labeledNonLocalBreaks && !state.labeledNonLocalContinues; var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; })); - var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38), call) : call; + var callResult = isAsyncBlockContainingAwait + ? ts.createYield(ts.createToken(38), ts.setEmitFlags(call, 4194304)) + : call; if (isSimpleLoop) { statements.push(ts.createStatement(callResult)); copyOutParameters(state.loopOutParameters, 0, statements); @@ -42627,23 +45913,22 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -42652,7 +45937,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -42667,7 +45952,7 @@ var ts; else { loopParameters.push(ts.createParameter(undefined, undefined, undefined, name)); if (resolver.getNodeCheckFlags(decl) & 2097152) { - var outParamName = ts.createUniqueName("out_" + name.text); + var outParamName = ts.createUniqueName("out_" + ts.unescapeIdentifier(name.text)); loopOutParameters.push({ originalName: name, outParamName: outParamName }); } } @@ -42678,22 +45963,22 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257: + case 150: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 260: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 258: + case 261: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; default: ts.Debug.failBadSyntaxKind(node); break; @@ -42701,34 +45986,49 @@ var ts; } } function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } return expression; } function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } return expression; } - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0, 0); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined, container)); + ts.setTextRange(expression, method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); - var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032, 0); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp); + ts.setTextRange(newVariableDeclaration, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); + var list = ts.createVariableDeclarationList(vars); + ts.setTextRange(list, node.variableDeclaration); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -42736,21 +46036,43 @@ var ts; } function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); + var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined, undefined); ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); - return ts.createPropertyAssignment(node.name, functionExpression, node); + return ts.setTextRange(ts.createPropertyAssignment(node.name, functionExpression), node); + } + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return updated; } function visitShorthandPropertyAssignment(node) { - return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node); + return ts.setTextRange(ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name)), node); + } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0, 8192); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 32768 : 0); + return updated; } function visitYieldExpression(node) { return ts.visitEachChild(node, visitor, context); } function visitArrayLiteralExpression(node) { - return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + if (node.transformFlags & 64) { + return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + if (node.transformFlags & 64) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, false); @@ -42762,38 +46084,54 @@ var ts; } var resultingCall; if (node.transformFlags & 524288) { - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); } if (node.expression.kind === 96) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 524288) !== 0); - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + if (node.transformFlags & 524288) { + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + } + return ts.visitEachChild(node, visitor, context); } function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { var numElements = elements.length; var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) { return visitPartition(partition, multiLine, hasTrailingComma && end === numElements); })); - if (segments.length === 1) { - var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 - ? ts.createArraySlice(segments[0]) - : segments[0]; + if (compilerOptions.downlevelIteration) { + if (segments.length === 1) { + var firstSegment = segments[0]; + if (ts.isCallExpression(firstSegment) + && ts.isIdentifier(firstSegment.expression) + && (ts.getEmitFlags(firstSegment.expression) & 4096) + && firstSegment.expression.text === "___spread") { + return segments[0]; + } + } + return ts.createSpreadHelper(context, segments); + } + else { + if (segments.length === 1) { + var firstElement = elements[0]; + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 + ? ts.createArraySlice(segments[0]) + : segments[0]; + } + return ts.createArrayConcat(segments.shift(), segments); } - return ts.createArrayConcat(segments.shift(), segments); } function partitionSpread(node) { return ts.isSpreadExpression(node) @@ -42804,7 +46142,7 @@ var ts; return ts.map(chunk, visitExpressionOfSpread); } function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { - return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine); + return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, hasTrailingComma), visitor, ts.isExpression), multiLine); } function visitSpreadElement(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); @@ -42813,7 +46151,19 @@ var ts; return ts.visitNode(node.expression, visitor, ts.isExpression); } function visitTemplateLiteral(node) { - return ts.createLiteral(node.text, node); + return ts.setTextRange(ts.createLiteral(node.text), node); + } + function visitStringLiteral(node) { + if (node.hasExtendedUnicodeEscape) { + return ts.setTextRange(ts.createLiteral(node.text), node); + } + return node; + } + function visitNumericLiteral(node) { + if (node.numericLiteralFlags & 48) { + return ts.setTextRange(ts.createNumericLiteral(node.text), node); + } + return node; } function visitTaggedTemplateExpression(node) { var tag = ts.visitNode(node.tag, visitor, ts.isExpression); @@ -42847,7 +46197,7 @@ var ts; var isLast = node.kind === 12 || node.kind === 15; text = text.substring(1, text.length - (isLast ? 1 : 2)); text = text.replace(/\r\n?/g, "\n"); - return ts.createLiteral(text, node); + return ts.setTextRange(ts.createLiteral(text), node); } function visitTemplateExpression(node) { var expressions = []; @@ -42855,7 +46205,8 @@ var ts; addTemplateSpans(expressions, node); var expression = ts.reduceLeft(expressions, ts.createAdd); if (ts.nodeIsSynthesized(expression)) { - ts.setTextRange(expression, node); + expression.pos = node.pos; + expression.end = node.end; } return expression; } @@ -42878,21 +46229,34 @@ var ts; } } } - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32) - && currentParent.kind !== 179 + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; + function visitMetaProperty(node) { + if (node.keywordToken === 93 && node.name.text === "target") { + if (hierarchyFacts & 8192) { + hierarchyFacts |= 32768; + } + else { + hierarchyFacts |= 16384; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } + function onEmitNode(hint, node, emitCallback) { if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286, ts.getEmitFlags(node) & 8 + ? 65 | 16 + : 65); + previousOnEmitNode(hint, node, emitCallback); + exitSubtree(ancestorFacts, 0, 0); + return; } - previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; + previousOnEmitNode(hint, node, emitCallback); } function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2) === 0) { @@ -42904,18 +46268,18 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(98); - context.enableEmitNotification(150); - context.enableEmitNotification(149); context.enableEmitNotification(151); + context.enableEmitNotification(150); context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(186); context.enableEmitNotification(185); - context.enableEmitNotification(184); - context.enableEmitNotification(225); + context.enableEmitNotification(227); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } if (ts.isIdentifier(node)) { @@ -42927,7 +46291,7 @@ var ts; if (enabledSubstitutions & 2) { var original = ts.getParseTreeNode(node, ts.isIdentifier); if (original && isNameOfDeclarationWithCollidingName(original)) { - return ts.getGeneratedNameForNode(original); + return ts.setTextRange(ts.getGeneratedNameForNode(original), node); } } return node; @@ -42935,10 +46299,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174: - case 226: - case 229: - case 223: + case 175: + case 228: + case 231: + case 225: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -42957,16 +46321,15 @@ var ts; if (enabledSubstitutions & 2) { var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { - return ts.getGeneratedNameForNode(declaration.name); + return ts.setTextRange(ts.getGeneratedNameForNode(declaration.name), node); } } return node; } function substituteThisKeyword(node) { if (enabledSubstitutions & 1 - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8) { - return ts.createIdentifier("_this", node); + && hierarchyFacts & 16) { + return ts.setTextRange(ts.createIdentifier("_this"), node); } return node; } @@ -42982,11 +46345,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180) { return false; } var callTarget = statementExpression.expression; @@ -42994,7 +46357,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197) { return false; } var expression = callArgument.expression; @@ -43013,18 +46376,65 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); var ts; (function (ts) { - var instructionNames = ts.createMap((_a = {}, - _a[2] = "return", - _a[3] = "break", - _a[4] = "yield", - _a[5] = "yield*", - _a[7] = "endfinally", - _a)); + var OpCode; + (function (OpCode) { + OpCode[OpCode["Nop"] = 0] = "Nop"; + OpCode[OpCode["Statement"] = 1] = "Statement"; + OpCode[OpCode["Assign"] = 2] = "Assign"; + OpCode[OpCode["Break"] = 3] = "Break"; + OpCode[OpCode["BreakWhenTrue"] = 4] = "BreakWhenTrue"; + OpCode[OpCode["BreakWhenFalse"] = 5] = "BreakWhenFalse"; + OpCode[OpCode["Yield"] = 6] = "Yield"; + OpCode[OpCode["YieldStar"] = 7] = "YieldStar"; + OpCode[OpCode["Return"] = 8] = "Return"; + OpCode[OpCode["Throw"] = 9] = "Throw"; + OpCode[OpCode["Endfinally"] = 10] = "Endfinally"; + })(OpCode || (OpCode = {})); + var BlockAction; + (function (BlockAction) { + BlockAction[BlockAction["Open"] = 0] = "Open"; + BlockAction[BlockAction["Close"] = 1] = "Close"; + })(BlockAction || (BlockAction = {})); + var CodeBlockKind; + (function (CodeBlockKind) { + CodeBlockKind[CodeBlockKind["Exception"] = 0] = "Exception"; + CodeBlockKind[CodeBlockKind["With"] = 1] = "With"; + CodeBlockKind[CodeBlockKind["Switch"] = 2] = "Switch"; + CodeBlockKind[CodeBlockKind["Loop"] = 3] = "Loop"; + CodeBlockKind[CodeBlockKind["Labeled"] = 4] = "Labeled"; + })(CodeBlockKind || (CodeBlockKind = {})); + var ExceptionBlockState; + (function (ExceptionBlockState) { + ExceptionBlockState[ExceptionBlockState["Try"] = 0] = "Try"; + ExceptionBlockState[ExceptionBlockState["Catch"] = 1] = "Catch"; + ExceptionBlockState[ExceptionBlockState["Finally"] = 2] = "Finally"; + ExceptionBlockState[ExceptionBlockState["Done"] = 3] = "Done"; + })(ExceptionBlockState || (ExceptionBlockState = {})); + var Instruction; + (function (Instruction) { + Instruction[Instruction["Next"] = 0] = "Next"; + Instruction[Instruction["Throw"] = 1] = "Throw"; + Instruction[Instruction["Return"] = 2] = "Return"; + Instruction[Instruction["Break"] = 3] = "Break"; + Instruction[Instruction["Yield"] = 4] = "Yield"; + Instruction[Instruction["YieldStar"] = 5] = "YieldStar"; + Instruction[Instruction["Catch"] = 6] = "Catch"; + Instruction[Instruction["Endfinally"] = 7] = "Endfinally"; + })(Instruction || (Instruction = {})); + function getInstructionName(instruction) { + switch (instruction) { + case 2: return "return"; + case 3: return "break"; + case 4: return "yield"; + case 5: return "yield*"; + case 7: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -43090,13 +46500,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209: + case 211: return visitDoStatement(node); - case 210: + case 212: return visitWhileStatement(node); - case 218: + case 220: return visitSwitchStatement(node); - case 219: + case 221: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -43104,24 +46514,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 205: + case 207: return visitVariableStatement(node); - case 211: + case 213: return visitForStatement(node); - case 212: + case 214: return visitForInStatement(node); - case 215: + case 217: return visitBreakStatement(node); - case 214: - return visitContinueStatement(node); case 216: + return visitContinueStatement(node); + case 218: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -43137,21 +46547,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192: - return visitBinaryExpression(node); case 193: + return visitBinaryExpression(node); + case 194: return visitConditionalExpression(node); - case 195: + case 196: return visitYieldExpression(node); - case 175: - return visitArrayLiteralExpression(node); case 176: + return visitArrayLiteralExpression(node); + case 177: return visitObjectLiteralExpression(node); - case 178: - return visitElementAccessExpression(node); case 179: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -43159,9 +46569,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -43169,8 +46579,8 @@ var ts; } } function visitFunctionDeclaration(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { - node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -43190,8 +46600,8 @@ var ts; } } function visitFunctionExpression(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { - node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -43243,7 +46653,7 @@ var ts; operationLocations = undefined; state = ts.createTempVariable(undefined); resumeLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + var statementOffset = ts.addPrologue(statements, body.statements, false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); ts.addRange(statements, endLexicalEnvironment()); @@ -43261,7 +46671,7 @@ var ts; operationArguments = savedOperationArguments; operationLocations = savedOperationLocations; state = savedState; - return ts.createBlock(statements, body, body.multiLine); + return ts.setTextRange(ts.createBlock(statements, body.multiLine), body); } function visitVariableStatement(node) { if (node.transformFlags & 16777216) { @@ -43318,10 +46728,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177: + case 178: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178: + case 179: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -43330,7 +46740,7 @@ var ts; } var operator = node.operatorToken.kind; if (isCompoundAssignment(operator)) { - return ts.createBinary(target, 57, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node); + return ts.setTextRange(ts.createAssignment(target, ts.setTextRange(ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node); } else { return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression)); @@ -43346,10 +46756,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -43405,38 +46815,43 @@ var ts; var resumeLabel = defineLabel(); var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (node.asteriskToken) { - emitYieldStar(expression, node); + var iterator = (ts.getEmitFlags(node.expression) & 4194304) === 0 + ? ts.createValuesHelper(context, expression, node) + : expression; + emitYieldStar(iterator, node); } else { emitYield(expression, node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(node); } function visitArrayLiteralExpression(node) { return visitElements(node.elements, undefined, undefined, node.multiLine); } function visitElements(elements, leadingElement, location, multiLine) { var numInitialElements = countInitialNodesWithoutYield(elements); - var temp = declareLocal(); - var hasAssignedTemp = false; + var temp; if (numInitialElements > 0) { + temp = declareLocal(); var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); emitAssignment(temp, ts.createArrayLiteral(leadingElement ? [leadingElement].concat(initialElements) : initialElements)); leadingElement = undefined; - hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); - return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); + return temp + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.setTextRange(ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine), location); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { + var hasAssignedTemp = temp !== undefined; + if (!temp) { + temp = declareLocal(); + } emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine)); - hasAssignedTemp = true; + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine)); leadingElement = undefined; expressions = []; } @@ -43449,7 +46864,7 @@ var ts; var multiLine = node.multiLine; var numInitialProperties = countInitialNodesWithoutYield(properties); var temp = declareLocal(); - emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, multiLine)); + emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), multiLine)); var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties); expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); return ts.inlineExpressions(expressions); @@ -43471,10 +46886,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -43488,7 +46903,7 @@ var ts; function visitNewExpression(node) { if (ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, []), node), node); } return ts.visitEachChild(node, visitor, context); } @@ -43517,38 +46932,38 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204: + case 206: return transformAndEmitBlock(node); - case 207: + case 209: return transformAndEmitExpressionStatement(node); - case 208: + case 210: return transformAndEmitIfStatement(node); - case 209: + case 211: return transformAndEmitDoStatement(node); - case 210: + case 212: return transformAndEmitWhileStatement(node); - case 211: + case 213: return transformAndEmitForStatement(node); - case 212: - return transformAndEmitForInStatement(node); case 214: + return transformAndEmitForInStatement(node); + case 216: return transformAndEmitContinueStatement(node); - case 215: + case 217: return transformAndEmitBreakStatement(node); - case 216: + case 218: return transformAndEmitReturnStatement(node); - case 217: + case 219: return transformAndEmitWithStatement(node); - case 218: + case 220: return transformAndEmitSwitchStatement(node); - case 219: + case 221: return transformAndEmitLabeledStatement(node); - case 220: + case 222: return transformAndEmitThrowStatement(node); - case 221: + case 223: return transformAndEmitTryStatement(node); default: - return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); + return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); } } function transformAndEmitBlock(node) { @@ -43565,7 +46980,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -43595,7 +47012,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -43674,7 +47091,7 @@ var ts; transformAndEmitVariableDeclarationList(initializer); } else { - emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), initializer)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer)); } } markLabel(conditionLabel); @@ -43684,7 +47101,7 @@ var ts; transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); if (node.incrementor) { - emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), node.incrementor)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor)); } emitBreak(conditionLabel); endLoopBlock(); @@ -43698,7 +47115,7 @@ var ts; beginScriptLoopBlock(); } var initializer = node.initializer; - if (ts.isVariableDeclarationList(initializer)) { + if (initializer && ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name); @@ -43706,7 +47123,7 @@ var ts; var variables = ts.getInitializedVariables(initializer); node = ts.updateFor(node, variables.length > 0 ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable)) - : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, true), ts.visitNode(node.incrementor, visitor, ts.isExpression, true), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock)); + : undefined, ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -43764,7 +47181,7 @@ var ts; var variable = _a[_i]; hoistVariableDeclaration(variable.name); } - node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock)); + node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -43803,10 +47220,10 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitReturnStatement(node) { - emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node); + emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node); } function visitReturnStatement(node) { - return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node); + return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node); } function transformAndEmitWithStatement(node) { if (containsYield(node)) { @@ -43829,7 +47246,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 && defaultClauseIndex === -1) { + if (clause.kind === 257 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -43839,7 +47256,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253) { + if (clause.kind === 256) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -43941,9 +47358,9 @@ var ts; } return -1; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } return node; @@ -43955,17 +47372,17 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_38) { - var clone_6 = ts.getMutableClone(name_38); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -43974,7 +47391,7 @@ var ts; } function cacheExpression(node) { var temp; - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.getEmitFlags(node) & 4096) { return node; } temp = ts.createTempVariable(hoistVariableDeclaration); @@ -44066,15 +47483,22 @@ var ts; } function beginCatchBlock(variable) { ts.Debug.assert(peekBlockKind() === 0); - var text = variable.name.text; - var name = declareLocal(text); - if (!renamedCatchVariables) { - renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); - context.enableSubstitution(70); + var name; + if (ts.isGeneratedIdentifier(variable.name)) { + name = variable.name; + hoistVariableDeclaration(variable.name); + } + else { + var text = variable.name.text; + name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = ts.createMap(); + renamedCatchVariableDeclarations = []; + context.enableSubstitution(70); + } + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; } - renamedCatchVariables[text] = true; - renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1); var endLabel = exception.endLabel; @@ -44274,23 +47698,23 @@ var ts; } function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + ts.addSyntheticTrailingComment(literal, 3, getInstructionName(instruction)); return literal; } function createInlineBreak(label, location) { ts.Debug.assert(label > 0, "Invalid label: " + label); - return ts.createReturn(ts.createArrayLiteral([ + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), location); + ])), location); } function createInlineReturn(expression, location) { - return ts.createReturn(ts.createArrayLiteral(expression + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), location); + : [createInstruction(2)])), location); } function createGeneratorResume(location) { - return ts.createCall(ts.createPropertyAccess(state, "sent"), undefined, [], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(state, "sent"), undefined, []), location); } function emitNop() { emitWorker(0); @@ -44356,7 +47780,7 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144)); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, buildResult.length > 0)), 262144)); } function buildStatements() { if (operations) { @@ -44565,51 +47989,51 @@ var ts; } } function writeAssign(left, right, operationLocation) { - writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation)); + writeStatement(ts.setTextRange(ts.createStatement(ts.createAssignment(left, right)), operationLocation)); } function writeThrow(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createThrow(expression, operationLocation)); + writeStatement(ts.setTextRange(ts.createThrow(expression), operationLocation)); } function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), operationLocation)); + : [createInstruction(2)])), operationLocation), 384)); } function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation)); + ])), operationLocation), 384)); } function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384)), 1)); } function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384)), 1)); } function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4), expression] - : [createInstruction(4)]), operationLocation)); + : [createInstruction(4)])), operationLocation), 384)); } function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(5), expression - ]), operationLocation)); + ])), operationLocation), 384)); } function writeEndfinally() { lastOperationWasAbrupt = true; @@ -44627,23 +48051,47 @@ var ts; name: "typescript:generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); var ts; (function (ts) { function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(250); + context.enableEmitNotification(251); + context.enableEmitNotification(249); + noSubstitution = []; + } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); - context.enableSubstitution(257); + context.enableSubstitution(178); + context.enableSubstitution(260); return transformSourceFile; function transformSourceFile(node) { return node; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); + function onEmitNode(hint, node, emitCallback) { + switch (node.kind) { + case 250: + case 251: + case 249: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(hint, node); + } + node = previousOnSubstituteNode(hint, node); if (ts.isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); } @@ -44655,7 +48103,7 @@ var ts; function substitutePropertyAccessExpression(node) { var literalName = trySubstituteReservedName(node.name); if (literalName) { - return ts.createElementAccess(node.expression, literalName, node); + return ts.setTextRange(ts.createElementAccess(node.expression, literalName), node); } return node; } @@ -44669,7 +48117,7 @@ var ts; function trySubstituteReservedName(name) { var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); if (token >= 71 && token <= 106) { - return ts.createLiteral(name, name); + return ts.setTextRange(ts.createLiteral(name), name); } return undefined; } @@ -44679,12 +48127,13 @@ var ts; var ts; (function (ts) { function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); @@ -44696,40 +48145,49 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableSubstitution(258); - context.enableEmitNotification(261); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); + context.enableSubstitution(192); + context.enableSubstitution(261); + context.enableEmitNotification(264); + var moduleInfoMap = []; + var deferredExports = []; var currentSourceFile; var currentModuleInfo; var noSubstitution; return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node) - || !(ts.isExternalModule(node) - || compilerOptions.isolatedModules)) { + if (ts.isDeclarationFile(node) || !(ts.isExternalModule(node) || compilerOptions.isolatedModules)) { return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + var transformModule = getTransformModuleDelegate(moduleKind); var updated = transformModule(node); currentSourceFile = undefined; currentModuleInfo = undefined; return ts.aggregateTransformFlags(updated); } + function shouldEmitUnderscoreUnderscoreESModule() { + if (!currentModuleInfo.exportEquals && ts.isExternalModule(currentSourceFile)) { + return true; + } + return false; + } function transformCommonJSModule(node) { startLexicalEnvironment(); var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); + } + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, false); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + ts.addRange(statements, endLexicalEnvironment()); + var updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { ts.addEmitHelper(updated, exportStarHelper); } @@ -44738,15 +48196,8 @@ var ts; function transformAMDModule(node) { var define = ts.createIdentifier("define"); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, true); - } - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, undefined, false); - } - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; - return ts.updateSourceFileNode(node, ts.createNodeArray([ + var _a = collectAsynchronousDependencies(node, true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([ ts.createArrayLiteral([ ts.createLiteral("require"), @@ -44757,7 +48208,37 @@ var ts; ts.createParameter(undefined, undefined, undefined, "exports") ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) ]))) - ], node.statements)); + ]), node.statements)); + } + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, "factory")], undefined, ts.setTextRange(ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement(undefined, [ + ts.createVariableDeclaration("v", undefined, ts.createCall(ts.createIdentifier("factory"), undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], true), undefined)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, undefined, [ + ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, "require"), + ts.createParameter(undefined, undefined, undefined, "exports") + ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) + ])) + ]), node.statements)); } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { var aliasedModuleNames = []; @@ -44777,13 +48258,15 @@ var ts; var importNode = _c[_b]; var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); - if (includeNonAmdDependencies && importAliasName) { - ts.setEmitFlags(importAliasName, 4); - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); - } - else { - unaliasedModuleNames.push(externalModuleName); + if (externalModuleName) { + if (includeNonAmdDependencies && importAliasName) { + ts.setEmitFlags(importAliasName, 4); + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); + } + else { + unaliasedModuleNames.push(externalModuleName); + } } } return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; @@ -44791,12 +48274,15 @@ var ts; function transformAsynchronousModuleBody(node) { startLexicalEnvironment(); var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); + var statementOffset = ts.addPrologue(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); + } + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, true); - var body = ts.createBlock(statements, undefined, true); + ts.addRange(statements, endLexicalEnvironment()); + var body = ts.createBlock(statements, true); if (currentModuleInfo.hasExportStarsToExportValues) { ts.addEmitHelper(body, exportStarHelper); } @@ -44805,12 +48291,14 @@ var ts; function addExportEqualsIfNeeded(statements, emitAsReturn) { if (currentModuleInfo.exportEquals) { if (emitAsReturn) { - var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals); + var statement = ts.createReturn(currentModuleInfo.exportEquals.expression); + ts.setTextRange(statement, currentModuleInfo.exportEquals); ts.setEmitFlags(statement, 384 | 1536); statements.push(statement); } else { - var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals); + var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression)); + ts.setTextRange(statement, currentModuleInfo.exportEquals); ts.setEmitFlags(statement, 1536); statements.push(statement); } @@ -44818,23 +48306,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 241: + case 243: return visitExportDeclaration(node); - case 240: + case 242: return visitExportAssignment(node); - case 205: + case 207: return visitVariableStatement(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 226: + case 228: return visitClassDeclaration(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return node; @@ -44845,7 +48333,7 @@ var ts; var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (moduleKind !== ts.ModuleKind.AMD) { if (!node.importClause) { - return ts.createStatement(createRequireCall(node), node); + return ts.setTextRange(ts.createStatement(createRequireCall(node)), node); } else { var variables = []; @@ -44858,13 +48346,13 @@ var ts; variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node))); } } - statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, undefined, languageVersion >= 2 ? 2 : 0), node)); + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, languageVersion >= 2 ? 2 : 0)), node)); } } else if (namespaceDeclaration && ts.isDefaultImport(node)) { statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node), node) - ], undefined, languageVersion >= 2 ? 2 : 0))); + ts.setTextRange(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node)), node) + ], languageVersion >= 2 ? 2 : 0))); } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); @@ -44888,17 +48376,17 @@ var ts; var statements; if (moduleKind !== ts.ModuleKind.AMD) { if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(node.name, createRequireCall(node))), node)); } else { - statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node)) - ], undefined, languageVersion >= 2 ? 2 : 0), node)); + ], languageVersion >= 2 ? 2 : 0)), node)); } } else { if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node))), node)); } } if (hasAssociatedEndOfDeclarationMarker(node)) { @@ -44918,23 +48406,23 @@ var ts; if (node.exportClause) { var statements = []; if (moduleKind !== ts.ModuleKind.AMD) { - statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + statements.push(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node)) - ]), node)); + ])), node)); } for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); - statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), specifier)); + statements.push(ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue)), specifier)); } return ts.singleOrMany(statements); } else { - return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [ + return ts.setTextRange(ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [ moduleKind !== ts.ModuleKind.AMD ? createRequireCall(node) : generatedName - ]), node); + ])), node); } } function visitExportAssignment(node) { @@ -44955,7 +48443,7 @@ var ts; function visitFunctionDeclaration(node) { var statements; if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body, node), node)); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body), node), node)); } else { statements = ts.append(statements, node); @@ -44972,7 +48460,7 @@ var ts; function visitClassDeclaration(node) { var statements; if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members, node), node)); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members), node), node)); } else { statements = ts.append(statements, node); @@ -45008,7 +48496,7 @@ var ts; statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); } if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } } else { @@ -45028,11 +48516,11 @@ var ts; return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression); } else { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer); + return ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name), node.name), node.initializer); } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -45064,10 +48552,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45125,7 +48613,7 @@ var ts; } function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -45135,28 +48623,28 @@ var ts; return statements; } function appendExportStatement(statements, exportName, expression, location, allowComments) { - if (exportName.text === "default") { - var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 0) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); - } - else { - statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ - ts.createIdentifier("exports"), - ts.createLiteral("__esModule"), - ts.createObjectLiteral([ - ts.createPropertyAssignment("value", ts.createLiteral(true)) - ]) - ]))); - } - } - } statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); return statements; } + function createUnderscoreUnderscoreESModule() { + var statement; + if (languageVersion === 0) { + statement = ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true))); + } + else { + statement = ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ + ts.createIdentifier("exports"), + ts.createLiteral("__esModule"), + ts.createObjectLiteral([ + ts.createPropertyAssignment("value", ts.createLiteral(true)) + ]) + ])); + } + ts.setEmitFlags(statement, 524288); + return statement; + } function createExportStatement(name, value, location, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value), location); + var statement = ts.setTextRange(ts.createStatement(createExportExpression(name, value)), location); ts.startOnNewLine(statement); if (!allowComments) { ts.setEmitFlags(statement, 1536); @@ -45164,7 +48652,7 @@ var ts; return statement; } function createExportExpression(name, value, location) { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value, location); + return ts.setTextRange(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value), location); } function modifierVisitor(node) { switch (node.kind) { @@ -45174,26 +48662,26 @@ var ts; } return node; } - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); - previousOnEmitNode(emitContext, node, emitCallback); + noSubstitution = []; + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; currentModuleInfo = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); if (node.id && noSubstitution[node.id]) { return node; } - if (emitContext === 1) { + if (hint === 1) { return substituteExpression(node); } else if (ts.isShorthandPropertyAssignment(node)) { @@ -45207,9 +48695,9 @@ var ts; if (exportedOrImportedName !== name) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name, initializer, node); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); } - return ts.createPropertyAssignment(name, exportedOrImportedName, node); + return ts.setTextRange(ts.createPropertyAssignment(name, exportedOrImportedName), node); } return node; } @@ -45217,10 +48705,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); + case 192: case 191: - case 190: return substituteUnaryExpression(node); } return node; @@ -45235,17 +48723,17 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261) { - return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); + if (exportContainer && exportContainer.kind === 264) { + return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_39 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), node); + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name)), node); } } } @@ -45278,8 +48766,8 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 - ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node) + var expression = node.kind === 192 + ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1)), node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { var exportName = exportedNames_2[_i]; @@ -45301,7 +48789,6 @@ var ts; } } } - var _a; } ts.transformModule = transformModule; var exportStarHelper = { @@ -45309,7 +48796,6 @@ var ts; scoped: true, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }; - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -45323,14 +48809,14 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableEmitNotification(261); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); - var exportFunctionsMap = ts.createMap(); - var noSubstitutionMap = ts.createMap(); + context.enableSubstitution(192); + context.enableEmitNotification(264); + var moduleInfoMap = []; + var deferredExports = []; + var exportFunctionsMap = []; + var noSubstitutionMap = []; var currentSourceFile; var moduleInfo; var exportFunction; @@ -45349,7 +48835,8 @@ var ts; currentSourceFile = node; enclosingBlockScopedContainer = node; moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); @@ -45359,11 +48846,11 @@ var ts; ], undefined, moduleBodyBlock); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction])) - ], node.statements)); + ]), node.statements)), 1024); if (!(compilerOptions.outFile || compilerOptions.out)) { ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); } @@ -45385,17 +48872,19 @@ var ts; for (var i = 0; i < externalImports.length; i++) { var externalImport = externalImports[i]; var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); - var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].externalImports.push(externalImport); - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push({ - name: externalModuleName, - externalImports: [externalImport] - }); + if (externalModuleName) { + var text = externalModuleName.text; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { + dependencyGroups[groupIndex].externalImports.push(externalImport); + } + else { + groupIndices.set(text, dependencyGroups.length); + dependencyGroups.push({ + name: externalModuleName, + externalImports: [externalImport] + }); + } } } return dependencyGroups; @@ -45403,30 +48892,33 @@ var ts; function createSystemModuleBody(node, dependencyGroups) { var statements = []; startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) ]))); - ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true); + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement); var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); ts.addRange(statements, hoistedStatements); ts.addRange(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); - statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([ + var moduleObject = ts.createObjectLiteral([ ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), - ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true))) - ]), true))); - return ts.createBlock(statements, undefined, true); + ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, true))) + ]); + moduleObject.multiLine = true; + statements.push(ts.createReturn(moduleObject)); + return ts.createBlock(statements, true); } function addExportStarIfNeeded(statements) { if (!moduleInfo.hasExportStarsToExportValues) { return; } - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 241 && externalImport.exportClause) { + if (externalImport.kind === 243 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -45444,12 +48936,12 @@ var ts; if (exportedLocalName.text === "default") { continue; } - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true))); + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createTrue())); } } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 241) { + if (externalImport.kind !== 243) { continue; } var exportDecl = externalImport; @@ -45458,12 +48950,12 @@ var ts; } for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { var element = _g[_f]; - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true))); + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createTrue())); } } var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, undefined, true)) + ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, true)) ]))); var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); statements.push(exportStarFunction); @@ -45488,7 +48980,7 @@ var ts; ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1) ])), ts.createStatement(ts.createCall(exportFunction, undefined, [exports])) - ], undefined, true)); + ], true)); } function createSettersArray(exportStarFunction, dependencyGroups) { var setters = []; @@ -45501,15 +48993,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 235: + case 237: if (!entry.importClause) { break; } - case 234: + case 236: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 241: + case 243: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -45517,7 +49009,7 @@ var ts; var e = _d[_c]; properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); } - statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, undefined, true)]))); + statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, true)]))); } else { statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName]))); @@ -45525,19 +49017,19 @@ var ts; break; } } - setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, undefined, true))); + setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, true))); } - return ts.createArrayLiteral(setters, undefined, true); + return ts.createArrayLiteral(setters, true); } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 241: + case 243: return undefined; - case 240: + case 242: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -45586,7 +49078,7 @@ var ts; } function visitFunctionDeclaration(node) { if (ts.hasModifier(node, 1)) { - hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); + hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); } else { hoistedStatements = ts.append(hoistedStatements, node); @@ -45604,7 +49096,7 @@ var ts; var statements; var name = ts.getLocalName(node); hoistVariableDeclaration(name); - statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), node)), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.createAssignment(name, ts.setTextRange(ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement)), node))), node)); if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); @@ -45632,7 +49124,7 @@ var ts; } var statements; if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } if (isMarkedDeclaration) { var id = ts.getOriginalNodeId(node); @@ -45658,7 +49150,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 261 + && (enclosingBlockScopedContainer.kind === 264 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -45676,11 +49168,11 @@ var ts; function createVariableAssignment(name, value, location, isExportedDeclaration) { hoistVariableDeclaration(ts.getSynthesizedClone(name)); return isExportedDeclaration - ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location))) - : preventSubstitution(ts.createAssignment(name, value, location)); + ? createExportExpression(name, preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location))) + : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -45713,10 +49205,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45786,7 +49278,7 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; @@ -45815,43 +49307,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 205: + case 207: return visitVariableStatement(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 226: + case 228: return visitClassDeclaration(node); - case 211: + case 213: return visitForStatement(node); - case 212: + case 214: return visitForInStatement(node); - case 213: + case 215: return visitForOfStatement(node); - case 209: + case 211: return visitDoStatement(node); - case 210: + case 212: return visitWhileStatement(node); - case 219: + case 221: return visitLabeledStatement(node); - case 217: + case 219: return visitWithStatement(node); - case 218: + case 220: return visitSwitchStatement(node); - case 232: + case 234: return visitCaseBlock(node); - case 253: + case 256: return visitCaseClause(node); - case 254: + case 257: return visitDefaultClause(node); - case 221: + case 223: return visitTryStatement(node); - case 256: + case 259: return visitCatchClause(node); - case 204: + case 206: return visitBlock(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -45860,21 +49352,21 @@ var ts; function visitForStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; enclosingBlockScopedContainer = node; - node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); + node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; } function visitForInStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; enclosingBlockScopedContainer = node; - node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; } function visitForOfStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; enclosingBlockScopedContainer = node; - node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + node = ts.updateForOf(node, node.awaitModifier, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; } @@ -45883,6 +49375,9 @@ var ts; && shouldHoistVariableDeclarationList(node); } function visitForInitializer(node) { + if (!node) { + return node; + } if (shouldHoistForInitializer(node)) { var expressions = void 0; for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { @@ -45896,16 +49391,16 @@ var ts; } } function visitDoStatement(node) { - return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); + return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); } function visitWhileStatement(node) { - return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); } function visitLabeledStatement(node) { - return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); } function visitWithStatement(node) { - return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); } function visitSwitchStatement(node) { return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); @@ -45942,7 +49437,7 @@ var ts; } function destructuringVisitor(node) { if (node.transformFlags & 1024 - && node.kind === 192) { + && node.kind === 193) { return visitDestructuringAssignment(node); } else if (node.transformFlags & 2048) { @@ -45959,7 +49454,7 @@ var ts; return ts.visitEachChild(node, destructuringVisitor, context); } function hasExportedReferenceInDestructuringTarget(node) { - if (ts.isAssignmentExpression(node)) { + if (ts.isAssignmentExpression(node, true)) { return hasExportedReferenceInDestructuringTarget(node.left); } else if (ts.isSpreadExpression(node)) { @@ -45979,7 +49474,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261; + return container !== undefined && container.kind === 264; } else { return false; @@ -45993,8 +49488,8 @@ var ts; } return node; } - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -46003,22 +49498,22 @@ var ts; if (noSubstitution) { delete noSubstitutionMap[id]; } - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; moduleInfo = undefined; exportFunction = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); if (isSubstitutionPrevented(node)) { return node; } - if (emitContext === 1) { + if (hint === 1) { return substituteExpression(node); } return node; @@ -46027,10 +49522,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); - case 190: case 191: + case 192: return substituteUnaryExpression(node); } return node; @@ -46047,10 +49542,10 @@ var ts; var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); } else if (ts.isImportSpecifier(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name)), node); } } } @@ -46082,14 +49577,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 - ? ts.createPrefix(node.operator, node.operand, node) + var expression = node.kind === 192 + ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 191) { + if (node.kind === 192) { expression = node.operator === 42 ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -46106,7 +49601,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 264) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -46116,7 +49611,7 @@ var ts; } function preventSubstitution(node) { if (noSubstitution === undefined) - noSubstitution = ts.createMap(); + noSubstitution = []; noSubstitution[ts.getNodeId(node)] = true; return node; } @@ -46134,7 +49629,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261); + context.enableEmitNotification(264); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -46146,10 +49641,10 @@ var ts; var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); if (externalHelpersModuleName) { var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements); + var statementOffset = ts.addPrologue(statements, node.statements); ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); } else { return ts.visitEachChild(node, visitor, context); @@ -46159,9 +49654,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 234: + case 236: return undefined; - case 240: + case 242: return visitExportAssignment(node); } return node; @@ -46169,19 +49664,19 @@ var ts; function visitExportAssignment(node) { return node.isExportEquals ? undefined : node; } - function onEmitNode(emitContext, node, emitCallback) { + function onEmitNode(hint, node, emitCallback) { if (ts.isSourceFile(node)) { currentSourceFile = node; - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isIdentifier(node) && emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (ts.isIdentifier(node) && hint === 1) { return substituteExpressionIdentifier(node); } return node; @@ -46200,19 +49695,34 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); - function getTransformers(compilerOptions) { + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } + var TransformationState; + (function (TransformationState) { + TransformationState[TransformationState["Uninitialized"] = 0] = "Uninitialized"; + TransformationState[TransformationState["Initialized"] = 1] = "Initialized"; + TransformationState[TransformationState["Completed"] = 2] = "Completed"; + TransformationState[TransformationState["Disposed"] = 3] = "Disposed"; + })(TransformationState || (TransformationState = {})); + var SyntaxKindFeatureFlags; + (function (SyntaxKindFeatureFlags) { + SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; + SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications"; + })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})); + function getTransformers(compilerOptions, customTransformers) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var transformers = []; + ts.addRange(transformers, customTransformers && customTransformers.before); transformers.push(ts.transformTypeScript); if (jsx === 2) { transformers.push(ts.transformJsx); @@ -46230,16 +49740,16 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); if (languageVersion < 1) { transformers.push(ts.transformES5); } + ts.addRange(transformers, customTransformers && customTransformers.after); return transformers; } ts.getTransformers = getTransformers; - function transformFiles(resolver, host, sourceFiles, transformers) { + function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { var enabledSyntaxKindFeatures = new Array(298); - var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -46247,8 +49757,11 @@ var ts; var lexicalEnvironmentStackOffset = 0; var lexicalEnvironmentSuspended = false; var emitHelpers; + var onSubstituteNode = function (_, node) { return node; }; + var onEmitNode = function (hint, node, callback) { return callback(hint, node); }; + var state = 0; var context = { - getCompilerOptions: function () { return host.getCompilerOptions(); }, + getCompilerOptions: function () { return options; }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, startLexicalEnvironment: startLexicalEnvironment, @@ -46259,65 +49772,77 @@ var ts; hoistFunctionDeclaration: hoistFunctionDeclaration, requestEmitHelper: requestEmitHelper, readEmitHelpers: readEmitHelpers, - onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, - isSubstitutionEnabled: isSubstitutionEnabled, - onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); }, enableEmitNotification: enableEmitNotification, - isEmitNotificationEnabled: isEmitNotificationEnabled + isSubstitutionEnabled: isSubstitutionEnabled, + isEmitNotificationEnabled: isEmitNotificationEnabled, + get onSubstituteNode() { return onSubstituteNode; }, + set onSubstituteNode(value) { + ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onSubstituteNode = value; + }, + get onEmitNode() { return onEmitNode; }, + set onEmitNode(value) { + ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onEmitNode = value; + } }; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + ts.performance.mark("beforeTransform"); var transformation = ts.chain.apply(void 0, transformers)(context); - var transformed = ts.map(sourceFiles, transformSourceFile); - lexicalEnvironmentDisabled = true; + state = 1; + var transformed = ts.map(nodes, allowDtsFiles ? transformation : transformRoot); + state = 2; + ts.performance.mark("afterTransform"); + ts.performance.measure("transformTime", "beforeTransform", "afterTransform"); return { transformed: transformed, - emitNodeWithSubstitution: emitNodeWithSubstitution, - emitNodeWithNotification: emitNodeWithNotification + substituteNode: substituteNode, + emitNodeWithNotification: emitNodeWithNotification, + dispose: dispose }; - function transformSourceFile(sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return sourceFile; - } - return transformation(sourceFile); + function transformRoot(node) { + return node && (!ts.isSourceFile(node) || !ts.isDeclarationFile(node)) ? transformation(node) : node; } function enableSubstitution(kind) { + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 1; } function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0 && (ts.getEmitFlags(node) & 4) === 0; } - function emitNodeWithSubstitution(emitContext, node, emitCallback) { - if (node) { - if (isSubstitutionEnabled(node)) { - var substitute = context.onSubstituteNode(emitContext, node); - if (substitute && substitute !== node) { - emitCallback(emitContext, substitute); - return; - } - } - emitCallback(emitContext, node); - } + function substituteNode(hint, node) { + ts.Debug.assert(state < 3, "Cannot substitute a node after the result is disposed."); + return node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node; } function enableEmitNotification(kind) { + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 2; } function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0 || (ts.getEmitFlags(node) & 2) !== 0; } - function emitNodeWithNotification(emitContext, node, emitCallback) { + function emitNodeWithNotification(hint, node, emitCallback) { + ts.Debug.assert(state < 3, "Cannot invoke TransformationResult callbacks after the result is disposed."); if (node) { if (isEmitNotificationEnabled(node)) { - context.onEmitNode(emitContext, node, emitCallback); + onEmitNode(hint, node, emitCallback); } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } } } function hoistVariableDeclaration(name) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); var decl = ts.createVariableDeclaration(name); if (!lexicalEnvironmentVariableDeclarations) { lexicalEnvironmentVariableDeclarations = [decl]; @@ -46327,7 +49852,8 @@ var ts; } } function hoistFunctionDeclaration(func) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); if (!lexicalEnvironmentFunctionDeclarations) { lexicalEnvironmentFunctionDeclarations = [func]; } @@ -46336,7 +49862,8 @@ var ts; } } function startLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; @@ -46345,17 +49872,20 @@ var ts; lexicalEnvironmentFunctionDeclarations = undefined; } function suspendLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); lexicalEnvironmentSuspended = true; } function resumeLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); lexicalEnvironmentSuspended = false; } function endLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { @@ -46382,33 +49912,52 @@ var ts; return statements; } function requestEmitHelper(helper) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); emitHelpers = ts.append(emitHelpers, helper); } function readEmitHelpers() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); var helpers = emitHelpers; emitHelpers = undefined; return helpers; } + function dispose() { + if (state < 3) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentVariableDeclarationsStack = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + lexicalEnvironmentFunctionDeclarationsStack = undefined; + onSubstituteNode = undefined; + onEmitNode = undefined; + emitHelpers = undefined; + state = 3; + } + } } - ts.transformFiles = transformFiles; - var _a; + ts.transformNodes = transformNodes; })(ts || (ts = {})); var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + function getDeclarationDiagnosticsFromFile(_a, sourceFileOrBundle) { var declarationFilePath = _a.declarationFilePath; - emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, false); + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sourceFileOrBundle, false); } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { + var sourceFiles = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 265; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -46470,7 +50019,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235); + ts.Debug.assert(aliasEmitInfo.node.kind === 237); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -46493,9 +50042,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -46520,12 +50069,14 @@ var ts; var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.reportIllegalExtends = reportIllegalExtends; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -46541,10 +50092,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223) { + if (declaration.kind === 225) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) { + else if (declaration.kind === 240 || declaration.kind === 241 || declaration.kind === 238) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -46555,7 +50106,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235) { + if (moduleElementEmitInfo.node.kind === 237) { moduleElementEmitInfo.isVisible = true; } else { @@ -46563,12 +50114,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 232) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 232) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -46587,8 +50138,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -46615,6 +50166,12 @@ var ts; handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true)); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } + function reportIllegalExtends() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, ts.declarationNameToString(errorNameNode))); + } + } function reportInaccessibleThisError() { if (errorNameNode) { reportedDeclarationError = true; @@ -46624,12 +50181,16 @@ var ts; function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); - if (type) { + var shouldUseResolverType = declaration.kind === 145 && + resolver.isRequiredInitializedParameter(declaration); + if (type && !shouldUseResolverType) { emitType(type); } else { errorNameNode = declaration.name; - resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer); + var format = 2 | 1024 | + (shouldUseResolverType ? 4096 : 0); + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, format, writer); errorNameNode = undefined; } } @@ -46646,15 +50207,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { - var node = nodes_4[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var node = nodes_6[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -46681,49 +50242,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 133: + case 136: case 104: - case 137: + case 138: case 94: case 129: - case 167: - case 171: + case 168: + case 172: return writeTextOfNode(currentText, type); - case 199: + case 200: return emitExpressionWithTypeArguments(type); - case 157: + case 158: return emitTypeReference(type); - case 160: + case 161: return emitTypeQuery(type); - case 162: - return emitArrayType(type); case 163: - return emitTupleType(type); + return emitArrayType(type); case 164: - return emitUnionType(type); + return emitTupleType(type); case 165: - return emitIntersectionType(type); + return emitUnionType(type); case 166: + return emitIntersectionType(type); + case 167: return emitParenType(type); - case 168: - return emitTypeOperator(type); case 169: - return emitIndexedAccessType(type); + return emitTypeOperator(type); case 170: + return emitIndexedAccessType(type); + case 171: return emitMappedType(type); - case 158: case 159: + case 160: return emitSignatureDeclarationWithJsDocComments(type); - case 161: + case 162: return emitTypeLiteral(type); case 70: return emitEntityName(type); - case 141: + case 142: return emitEntityName(type); - case 156: + case 157: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -46731,22 +50293,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 ? entityName.left : entityName.expression; - var right = entityName.kind === 141 ? entityName.right : entityName.name; + var left = entityName.kind === 142 ? entityName.left : entityName.expression; + var right = entityName.kind === 142 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 236 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177); + ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 178); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -46850,15 +50412,15 @@ var ts; } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_40 = baseName + "_" + count; - if (!(name_40 in currentIdentifiers)) { - return name_40; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -46902,10 +50464,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 || - (node.parent.kind === 261 && isCurrentFileExternalModule)) { + else if (node.kind === 236 || + (node.parent.kind === 264 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 264) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -46914,7 +50476,7 @@ var ts; }); } else { - if (node.kind === 235) { + if (node.kind === 237) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -46932,30 +50494,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225: + case 227: return writeFunctionDeclaration(node); - case 205: + case 207: return writeVariableStatement(node); - case 227: + case 229: return writeInterfaceDeclaration(node); - case 226: - return writeClassDeclaration(node); case 228: + return writeClassDeclaration(node); + case 230: return writeTypeAliasDeclaration(node); - case 229: + case 231: return writeEnumDeclaration(node); - case 230: + case 232: return writeModuleDeclaration(node); - case 234: + case 236: return writeImportEqualsDeclaration(node); - case 235: + case 237: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 261) { + if (node.parent.kind === 264) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -46963,7 +50525,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 227 && !noDeclare) { + else if (node.kind !== 229 && !noDeclare) { write("declare "); } } @@ -47013,7 +50575,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 239) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -47036,7 +50598,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 237) { + if (node.importClause.namedBindings.kind === 239) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -47053,13 +50615,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232; var moduleSpecifier; - if (parent.kind === 234) { + if (parent.kind === 236) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230) { + else if (parent.kind === 232) { moduleSpecifier = parent.name; } else { @@ -47127,7 +50689,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231) { + while (node.body && node.body.kind !== 233) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -47197,7 +50759,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 && ts.hasModifier(node.parent, 8); + return node.parent.kind === 150 && ts.hasModifier(node.parent, 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -47207,52 +50769,69 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - (node.parent.parent && node.parent.parent.kind === 161)) { - ts.Debug.assert(node.parent.kind === 149 || - node.parent.kind === 148 || - node.parent.kind === 158 || + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || node.parent.kind === 159 || - node.parent.kind === 153 || - node.parent.kind === 154); + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } + if (node.default && !isPrivateMethodTypeParameter(node)) { + write(" = "); + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || + node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); + emitType(node.default); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.default, getTypeParameterConstraintVisibilityError); + } + } function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 226: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154: + case 155: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153: + case 154: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 228) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228: + case 230: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -47271,7 +50850,7 @@ var ts; write(">"); } } - function emitHeritageClause(typeReferences, isImplementsList) { + function emitHeritageClause(className, typeReferences, isImplementsList) { if (typeReferences) { write(isImplementsList ? " implements " : " extends "); emitCommaList(typeReferences, emitTypeOfTypeReference); @@ -47285,17 +50864,19 @@ var ts; } else { writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + errorNameNode = className; resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer); + errorNameNode = undefined; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 226) { + if (node.parent.parent.kind === 228) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { - diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + diagnosticMessage = ts.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -47327,9 +50908,10 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + node.name; + emitHeritageClause(node.name, [baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); + emitHeritageClause(node.name, ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -47350,7 +50932,7 @@ var ts; emitTypeParameters(node.typeParameters); var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); if (interfaceExtendsTypes && interfaceExtendsTypes.length) { - emitHeritageClause(interfaceExtendsTypes, false); + emitHeritageClause(node.name, interfaceExtendsTypes, false); } write(" {"); writeLine(); @@ -47372,17 +50954,17 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 223 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 147 || node.kind === 146 || - (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 || node.kind === 147 || + (node.kind === 145 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) { + if ((node.kind === 148 || node.kind === 147) && node.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -47395,14 +50977,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223) { + if (node.kind === 225) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 147 || node.kind === 146) { + else if (node.kind === 148 || node.kind === 147) { if (ts.hasModifier(node, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47410,7 +50992,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47436,7 +51018,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198) { + if (element.kind !== 199) { elements.push(element); } } @@ -47502,7 +51084,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -47515,7 +51097,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 + return accessor.kind === 152 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -47524,7 +51106,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152) { + if (accessorWithTypeAnnotation.kind === 153) { if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -47570,17 +51152,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225) { + if (node.kind === 227) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 || node.kind === 150) { + else if (node.kind === 150 || node.kind === 151) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225) { + if (node.kind === 227) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150) { + else if (node.kind === 151) { write("constructor"); } else { @@ -47600,15 +51182,15 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155) { + if (node.kind === 156) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { - if (node.kind === 154 || node.kind === 159) { + if (node.kind === 155 || node.kind === 160) { write("new "); } - else if (node.kind === 158) { + else if (node.kind === 159) { var currentOutput = writer.getText(); if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { closeParenthesizedFunctionType = true; @@ -47619,20 +51201,20 @@ var ts; write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155) { + if (node.kind === 156) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161) { + var isFunctionTypeOrConstructorType = node.kind === 159 || node.kind === 160; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 && !ts.hasModifier(node, 8)) { + else if (node.kind !== 151 && !ts.hasModifier(node, 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -47646,23 +51228,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154: + case 155: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 153: + case 154: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 155: + case 156: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; + case 150: case 149: - case 148: if (ts.hasModifier(node, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47670,7 +51252,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -47683,7 +51265,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225: + case 227: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -47715,9 +51297,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - node.parent.parent.kind === 161) { + if (node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8)) { @@ -47733,22 +51315,26 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150: + case 151: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 154: + case 155: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 153: + case 154: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 156: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47756,7 +51342,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47768,7 +51354,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 225: + case 227: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47779,12 +51365,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -47795,10 +51381,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198) { + if (bindingElement.kind === 199) { write(" "); } - else if (bindingElement.kind === 174) { + else if (bindingElement.kind === 175) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -47820,39 +51406,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225: - case 230: - case 234: case 227: - case 226: - case 228: + case 232: + case 236: case 229: + case 228: + case 230: + case 231: return emitModuleElement(node, isModuleElementVisible(node)); - case 205: + case 207: return emitModuleElement(node, isVariableStatementVisible(node)); - case 235: + case 237: return emitModuleElement(node, !node.importClause); - case 241: + case 243: return emitExportDeclaration(node); + case 151: case 150: case 149: - case 148: return writeFunctionDeclaration(node); - case 154: - case 153: case 155: + case 154: + case 156: return emitSignatureDeclarationWithJsDocComments(node); - case 151: case 152: + case 153: return emitAccessorDeclaration(node); + case 148: case 147: - case 146: return emitPropertyDeclaration(node); - case 260: + case 263: return emitEnumMemberDeclaration(node); - case 240: + case 242: return emitExportAssignment(node); - case 261: + case 264: return emitSourceFile(node); } } @@ -47863,14 +51449,15 @@ var ts; declFileName = referencedFile.fileName; } else { - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencesOutput += "/// " + newLine; } return addedBundledEmitReference; - function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) { + function getDeclFileName(emitFileNames, sourceFileOrBundle) { + var isBundledEmit = sourceFileOrBundle.kind === 265; if (isBundledEmit && !addBundledFileReference) { return; } @@ -47880,10 +51467,11 @@ var ts; } } } - function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { - var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles); + function writeDeclarationFile(declarationFilePath, sourceFileOrBundle, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { + var sourceFiles = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -47937,7 +51525,7 @@ var ts; getText: getText, getSourceMappingURL: getSourceMappingURL, }; - function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + function initialize(filePath, sourceMapFilePath, sourceFileOrBundle) { if (disabled) { return; } @@ -47968,9 +51556,8 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (!isBundledEmit) { - ts.Debug.assert(sourceFiles.length === 1); - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + if (sourceFileOrBundle.kind === 264) { + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); @@ -48061,28 +51648,28 @@ var ts; ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); } } - function emitNodeWithSourceMap(emitContext, node, emitCallback) { + function emitNodeWithSourceMap(hint, node, emitCallback) { if (disabled) { - return emitCallback(emitContext, node); + return emitCallback(hint, node); } if (node) { var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } if (emitFlags & 64) { disabled = true; - emitCallback(emitContext, node); + emitCallback(hint, node); disabled = false; } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -48131,7 +51718,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -48183,11 +51770,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function createCommentWriter(host, writer, sourceMap) { - var compilerOptions = host.getCompilerOptions(); - var extendedDiagnostics = compilerOptions.extendedDiagnostics; - var newLine = host.getNewLine(); - var emitPos = sourceMap.emitPos; + function createCommentWriter(printerOptions, emitPos) { + var extendedDiagnostics = printerOptions.extendedDiagnostics; + var newLine = ts.getNewLineCharacter(printerOptions); + var writer; var containerPos = -1; var containerEnd = -1; var declarationListContainerEnd = -1; @@ -48196,37 +51782,34 @@ var ts; var currentLineMap; var detachedCommentsInfo; var hasWrittenComment = false; - var disabled = compilerOptions.removeComments; + var disabled = printerOptions.removeComments; return { reset: reset, + setWriter: setWriter, setSourceFile: setSourceFile, emitNodeWithComments: emitNodeWithComments, emitBodyWithDetachedComments: emitBodyWithDetachedComments, emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition, + emitLeadingCommentsOfPosition: emitLeadingCommentsOfPosition, }; - function emitNodeWithComments(emitContext, node, emitCallback) { + function emitNodeWithComments(hint, node, emitCallback) { if (disabled) { - emitCallback(emitContext, node); + emitCallback(hint, node); return; } if (node) { - var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; - var emitFlags = ts.getEmitFlags(node); + hasWrittenComment = false; + var emitNode = node.emitNode; + var emitFlags = emitNode && emitNode.flags; + var _a = emitNode && emitNode.commentRange || node, pos = _a.pos, end = _a.end; if ((pos < 0 && end < 0) || (pos === end)) { - if (emitFlags & 2048) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); } else { if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293; + var isEmittedNode = node.kind !== 294; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -48240,23 +51823,16 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 224) { + if (node.kind === 226) { declarationListContainerEnd = end; } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 2048) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); if (extendedDiagnostics) { - ts.performance.mark("beginEmitNodeWithComment"); + ts.performance.mark("postEmitNodeWithComment"); } containerPos = savedContainerPos; containerEnd = savedContainerEnd; @@ -48265,11 +51841,75 @@ var ts; emitTrailingComments(end); } if (extendedDiagnostics) { - ts.performance.measure("commentTime", "beginEmitNodeWithComment"); + ts.performance.measure("commentTime", "postEmitNodeWithComment"); } } } } + function emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback) { + var leadingComments = emitNode && emitNode.leadingComments; + if (ts.some(leadingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("preEmitNodeWithSynthesizedComments"); + } + ts.forEach(leadingComments, emitLeadingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "preEmitNodeWithSynthesizedComments"); + } + } + emitNodeWithNestedComments(hint, node, emitFlags, emitCallback); + var trailingComments = emitNode && emitNode.trailingComments; + if (ts.some(trailingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("postEmitNodeWithSynthesizedComments"); + } + ts.forEach(trailingComments, emitTrailingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "postEmitNodeWithSynthesizedComments"); + } + } + } + function emitLeadingSynthesizedComment(comment) { + if (comment.kind === 2) { + writer.writeLine(); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine || comment.kind === 2) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + function emitTrailingSynthesizedComment(comment) { + if (!writer.isAtStartOfLine()) { + writer.write(" "); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + } + function writeSynthesizedComment(comment) { + var text = formatSynthesizedComment(comment); + var lineMap = comment.kind === 3 ? ts.computeLineStarts(text) : undefined; + ts.writeCommentRange(text, lineMap, writer, 0, text.length, newLine); + } + function formatSynthesizedComment(comment) { + return comment.kind === 3 + ? "/*" + comment.text + "*/" + : "//" + comment.text; + } + function emitNodeWithNestedComments(hint, node, emitFlags, emitCallback) { + if (emitFlags & 2048) { + disabled = true; + emitCallback(hint, node); + disabled = false; + } + else { + emitCallback(hint, node); + } + } function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { if (extendedDiagnostics) { ts.performance.mark("preEmitBodyWithDetachedComments"); @@ -48297,6 +51937,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -48321,9 +51964,11 @@ var ts; ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos); hasWrittenComment = true; } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -48331,6 +51976,12 @@ var ts; writer.write(" "); } } + function emitLeadingCommentsOfPosition(pos) { + if (disabled || pos === -1) { + return; + } + emitLeadingComments(pos, true); + } function emitTrailingComments(pos) { forEachTrailingCommentToEmit(pos, emitTrailingComment); } @@ -48338,9 +51989,11 @@ var ts; if (!writer.isAtStartOfLine()) { writer.write(" "); } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -48358,9 +52011,11 @@ var ts; } } function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -48389,6 +52044,9 @@ var ts; currentLineMap = undefined; detachedCommentsInfo = undefined; } + function setWriter(output) { + writer = output; + } function setSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = currentSourceFile.text; @@ -48420,9 +52078,11 @@ var ts; } } function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); } function isTripleSlashComment(commentPos, commentEnd) { if (currentText.charCodeAt(commentPos + 1) === 47 && @@ -48440,63 +52100,55 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var id = function (s) { return s; }; - var nullTransformers = [function (_) { return id; }]; - function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { - var delimiters = createDelimiterMap(); - var brackets = createBracketsMap(); + var delimiters = createDelimiterMap(); + var brackets = createBracketsMap(); + function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); var newLine = host.getNewLine(); - var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions); var writer = ts.createTextWriter(newLine); - var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var sourceMap = ts.createSourceMapWriter(host, writer); - var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap; - var comments = ts.createCommentWriter(host, writer, sourceMap); - var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition; - var nodeIdToGeneratedName; - var autoGeneratedIdToGeneratedName; - var generatedNameSet; - var tempFlags; var currentSourceFile; - var currentText; - var currentFileIdentifiers; var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); - ts.performance.mark("beforeTransform"); - var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; - ts.performance.measure("transformTime", "beforeTransform"); + var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, false); + var printer = createPrinter(compilerOptions, { + hasGlobalName: resolver.hasGlobalName, + onEmitNode: transform.emitNodeWithNotification, + substituteNode: transform.substituteNode, + onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, + onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, + onEmitSourceMapOfPosition: sourceMap.emitPos, + onEmitHelpers: emitHelpers, + onSetSourceFile: setSourceFile, + }); ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; - ts.disposeEmitNodes(sourceFile); - } + transform.dispose(); return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitSourceFileOrBundle(_a, sourceFileOrBundle) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { - printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle); } } else { emitSkipped = true; } if (declarationFilePath) { - emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; + emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; } if (!emitSkipped && emittedFilesList) { if (!emitOnlyDtsFiles) { @@ -48510,24 +52162,24 @@ var ts; } } } - function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { - sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); - nodeIdToGeneratedName = []; - autoGeneratedIdToGeneratedName = []; - generatedNameSet = ts.createMap(); - bundledHelpers = isBundledEmit ? ts.createMap() : undefined; - isOwnFileEmit = !isBundledEmit; - if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; - emitHelpers(sourceFile, true); - } + function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { + var bundle = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 264 ? sourceFileOrBundle : undefined; + var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); + if (bundle) { + bundledHelpers = ts.createMap(); + isOwnFileEmit = false; + printer.writeBundle(bundle, writer); } - ts.forEach(sourceFiles, printSourceFile); - writeLine(); + else { + isOwnFileEmit = true; + printer.writeFile(sourceFile, writer); + } + writer.writeLine(); var sourceMappingURL = sourceMap.getSourceMappingURL(); if (sourceMappingURL) { - write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); + writer.write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); } if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); @@ -48537,20 +52189,164 @@ var ts; } ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); - comments.reset(); writer.reset(); - tempFlags = 0; currentSourceFile = undefined; - currentText = undefined; + bundledHelpers = undefined; isOwnFileEmit = false; } - function printSourceFile(node) { + function setSourceFile(node) { currentSourceFile = node; - currentText = node.text; - currentFileIdentifiers = node.identifiers; sourceMap.setSourceFile(node); - comments.setSourceFile(node); - pipelineEmitWithNotification(0, node); + } + function emitHelpers(node, writeLines) { + var helpersEmitted = false; + var bundle = node.kind === 265 ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; + } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + continue; + } + writeLines(helper.text); + helpersEmitted = true; + } + } + } + return helpersEmitted; + } + } + ts.emitFiles = emitFiles; + function createPrinter(printerOptions, handlers) { + if (printerOptions === void 0) { printerOptions = {}; } + if (handlers === void 0) { handlers = {}; } + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray; + var newLine = ts.getNewLineCharacter(printerOptions); + var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); + var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; + var currentSourceFile; + var nodeIdToGeneratedName; + var autoGeneratedIdToGeneratedName; + var generatedNames; + var tempFlagsStack; + var tempFlags; + var writer; + var ownWriter; + reset(); + return { + printNode: printNode, + printFile: printFile, + printBundle: printBundle, + writeNode: writeNode, + writeFile: writeFile, + writeBundle: writeBundle + }; + function printNode(hint, node, sourceFile) { + switch (hint) { + case 0: + ts.Debug.assert(ts.isSourceFile(node), "Expected a SourceFile node."); + break; + case 2: + ts.Debug.assert(ts.isIdentifier(node), "Expected an Identifier node."); + break; + case 1: + ts.Debug.assert(ts.isExpression(node), "Expected an Expression node."); + break; + } + switch (node.kind) { + case 264: return printFile(node); + case 265: return printBundle(node); + } + writeNode(hint, node, sourceFile, beginPrint()); + return endPrint(); + } + function printBundle(bundle) { + writeBundle(bundle, beginPrint()); + return endPrint(); + } + function printFile(sourceFile) { + writeFile(sourceFile, beginPrint()); + return endPrint(); + } + function writeNode(hint, node, sourceFile, output) { + var previousWriter = writer; + setWriter(output); + print(hint, node, sourceFile); + reset(); + writer = previousWriter; + } + function writeBundle(bundle, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(bundle); + emitPrologueDirectivesIfNeeded(bundle); + emitHelpersIndirect(bundle); + for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + print(0, sourceFile, sourceFile); + } + reset(); + writer = previousWriter; + } + function writeFile(sourceFile, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(sourceFile); + emitPrologueDirectivesIfNeeded(sourceFile); + print(0, sourceFile, sourceFile); + reset(); + writer = previousWriter; + } + function beginPrint() { + return ownWriter || (ownWriter = ts.createTextWriter(newLine)); + } + function endPrint() { + var text = ownWriter.getText(); + ownWriter.reset(); + return text; + } + function print(hint, node, sourceFile) { + setSourceFile(sourceFile); + pipelineEmitWithNotification(hint, node); + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + comments.setSourceFile(sourceFile); + if (onSetSourceFile) { + onSetSourceFile(sourceFile); + } + } + function setWriter(output) { + writer = output; + comments.setWriter(output); + } + function reset() { + nodeIdToGeneratedName = []; + autoGeneratedIdToGeneratedName = []; + generatedNames = ts.createMap(); + tempFlagsStack = []; + tempFlags = 0; + comments.reset(); + setWriter(undefined); } function emit(node) { pipelineEmitWithNotification(3, node); @@ -48561,51 +52357,53 @@ var ts; function emitExpression(node) { pipelineEmitWithNotification(1, node); } - function pipelineEmitWithNotification(emitContext, node) { - emitNodeWithNotification(emitContext, node, pipelineEmitWithComments); - } - function pipelineEmitWithComments(emitContext, node) { - if (emitContext === 0) { - pipelineEmitWithSourceMap(emitContext, node); - return; + function pipelineEmitWithNotification(hint, node) { + if (onEmitNode) { + onEmitNode(hint, node, pipelineEmitWithComments); } - emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap); - } - function pipelineEmitWithSourceMap(emitContext, node) { - if (emitContext === 0 - || emitContext === 2) { - pipelineEmitWithSubstitution(emitContext, node); - return; + else { + pipelineEmitWithComments(hint, node); } - emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution); } - function pipelineEmitWithSubstitution(emitContext, node) { - emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext); - } - function pipelineEmitForContext(emitContext, node) { - switch (emitContext) { - case 0: return pipelineEmitInSourceFileContext(node); - case 2: return pipelineEmitInIdentifierNameContext(node); - case 3: return pipelineEmitInUnspecifiedContext(node); - case 1: return pipelineEmitInExpressionContext(node); + function pipelineEmitWithComments(hint, node) { + node = trySubstituteNode(hint, node); + if (emitNodeWithComments && hint !== 0) { + emitNodeWithComments(hint, node, pipelineEmitWithSourceMap); + } + else { + pipelineEmitWithSourceMap(hint, node); } } - function pipelineEmitInSourceFileContext(node) { - var kind = node.kind; - switch (kind) { - case 261: - return emitSourceFile(node); + function pipelineEmitWithSourceMap(hint, node) { + if (onEmitSourceMapOfNode && hint !== 0 && hint !== 2) { + onEmitSourceMapOfNode(hint, node, pipelineEmitWithHint); + } + else { + pipelineEmitWithHint(hint, node); } } - function pipelineEmitInIdentifierNameContext(node) { - var kind = node.kind; - switch (kind) { - case 70: - return emitIdentifier(node); + function pipelineEmitWithHint(hint, node) { + switch (hint) { + case 0: return pipelineEmitSourceFile(node); + case 2: return pipelineEmitIdentifierName(node); + case 1: return pipelineEmitExpression(node); + case 3: return pipelineEmitUnspecified(node); } } - function pipelineEmitInUnspecifiedContext(node) { + function pipelineEmitSourceFile(node) { + ts.Debug.assertNode(node, ts.isSourceFile); + emitSourceFile(node); + } + function pipelineEmitIdentifierName(node) { + ts.Debug.assertNode(node, ts.isIdentifier); + emitIdentifier(node); + } + function pipelineEmitUnspecified(node) { var kind = node.kind; + if (ts.isKeyword(kind)) { + writeTokenText(kind); + return; + } switch (kind) { case 13: case 14: @@ -48613,229 +52411,201 @@ var ts; return emitLiteral(node); case 70: return emitIdentifier(node); - case 75: - case 78: - case 83: - case 104: - case 111: - case 112: - case 113: - case 114: - case 116: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: - case 124: - case 125: - case 127: - case 128: - case 129: - case 130: - case 131: - case 132: - case 133: - case 134: - case 135: - case 136: - case 137: - case 138: - case 139: - case 140: - writeTokenText(kind); - return; - case 141: - return emitQualifiedName(node); case 142: - return emitComputedPropertyName(node); + return emitQualifiedName(node); case 143: - return emitTypeParameter(node); + return emitComputedPropertyName(node); case 144: - return emitParameter(node); + return emitTypeParameter(node); case 145: - return emitDecorator(node); + return emitParameter(node); case 146: - return emitPropertySignature(node); + return emitDecorator(node); case 147: - return emitPropertyDeclaration(node); + return emitPropertySignature(node); case 148: - return emitMethodSignature(node); + return emitPropertyDeclaration(node); case 149: - return emitMethodDeclaration(node); + return emitMethodSignature(node); case 150: - return emitConstructor(node); + return emitMethodDeclaration(node); case 151: + return emitConstructor(node); case 152: - return emitAccessorDeclaration(node); case 153: - return emitCallSignature(node); + return emitAccessorDeclaration(node); case 154: - return emitConstructSignature(node); + return emitCallSignature(node); case 155: - return emitIndexSignature(node); + return emitConstructSignature(node); case 156: - return emitTypePredicate(node); + return emitIndexSignature(node); case 157: - return emitTypeReference(node); + return emitTypePredicate(node); case 158: - return emitFunctionType(node); + return emitTypeReference(node); case 159: - return emitConstructorType(node); + return emitFunctionType(node); case 160: - return emitTypeQuery(node); + return emitConstructorType(node); case 161: - return emitTypeLiteral(node); + return emitTypeQuery(node); case 162: - return emitArrayType(node); + return emitTypeLiteral(node); case 163: - return emitTupleType(node); + return emitArrayType(node); case 164: - return emitUnionType(node); + return emitTupleType(node); case 165: - return emitIntersectionType(node); + return emitUnionType(node); case 166: + return emitIntersectionType(node); + case 167: return emitParenthesizedType(node); - case 199: + case 200: return emitExpressionWithTypeArguments(node); - case 167: - return emitThisType(); case 168: - return emitTypeOperator(node); + return emitThisType(); case 169: - return emitIndexedAccessType(node); + return emitTypeOperator(node); case 170: - return emitMappedType(node); + return emitIndexedAccessType(node); case 171: - return emitLiteralType(node); + return emitMappedType(node); case 172: - return emitObjectBindingPattern(node); + return emitLiteralType(node); case 173: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 174: + return emitArrayBindingPattern(node); + case 175: return emitBindingElement(node); - case 202: + case 204: return emitTemplateSpan(node); - case 203: + case 205: return emitSemicolonClassElement(); - case 204: + case 206: return emitBlock(node); - case 205: + case 207: return emitVariableStatement(node); - case 206: + case 208: return emitEmptyStatement(); - case 207: + case 209: return emitExpressionStatement(node); - case 208: + case 210: return emitIfStatement(node); - case 209: + case 211: return emitDoStatement(node); - case 210: + case 212: return emitWhileStatement(node); - case 211: + case 213: return emitForStatement(node); - case 212: + case 214: return emitForInStatement(node); - case 213: + case 215: return emitForOfStatement(node); - case 214: + case 216: return emitContinueStatement(node); - case 215: + case 217: return emitBreakStatement(node); - case 216: + case 218: return emitReturnStatement(node); - case 217: + case 219: return emitWithStatement(node); - case 218: + case 220: return emitSwitchStatement(node); - case 219: + case 221: return emitLabeledStatement(node); - case 220: + case 222: return emitThrowStatement(node); - case 221: + case 223: return emitTryStatement(node); - case 222: + case 224: return emitDebuggerStatement(node); - case 223: + case 225: return emitVariableDeclaration(node); - case 224: + case 226: return emitVariableDeclarationList(node); - case 225: + case 227: return emitFunctionDeclaration(node); - case 226: + case 228: return emitClassDeclaration(node); - case 227: + case 229: return emitInterfaceDeclaration(node); - case 228: + case 230: return emitTypeAliasDeclaration(node); - case 229: + case 231: return emitEnumDeclaration(node); - case 230: + case 232: return emitModuleDeclaration(node); - case 231: + case 233: return emitModuleBlock(node); - case 232: - return emitCaseBlock(node); case 234: + return emitCaseBlock(node); + case 236: return emitImportEqualsDeclaration(node); - case 235: + case 237: return emitImportDeclaration(node); - case 236: + case 238: return emitImportClause(node); - case 237: + case 239: return emitNamespaceImport(node); - case 238: + case 240: return emitNamedImports(node); - case 239: + case 241: return emitImportSpecifier(node); - case 240: + case 242: return emitExportAssignment(node); - case 241: + case 243: return emitExportDeclaration(node); - case 242: + case 244: return emitNamedExports(node); - case 243: + case 245: return emitExportSpecifier(node); - case 244: + case 246: return; - case 245: + case 247: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 248: + case 250: return emitJsxOpeningElement(node); - case 249: + case 251: return emitJsxClosingElement(node); - case 250: + case 252: return emitJsxAttribute(node); - case 251: + case 253: + return emitJsxAttributes(node); + case 254: return emitJsxSpreadAttribute(node); - case 252: + case 255: return emitJsxExpression(node); - case 253: + case 256: return emitCaseClause(node); - case 254: + case 257: return emitDefaultClause(node); - case 255: + case 258: return emitHeritageClause(node); - case 256: + case 259: return emitCatchClause(node); - case 257: + case 260: return emitPropertyAssignment(node); - case 258: + case 261: return emitShorthandPropertyAssignment(node); - case 259: + case 262: return emitSpreadAssignment(node); - case 260: + case 263: return emitEnumMember(node); } if (ts.isExpression(node)) { - return pipelineEmitWithSubstitution(1, node); + return pipelineEmitExpression(trySubstituteNode(1, node)); + } + if (ts.isToken(node)) { + writeTokenText(kind); + return; } } - function pipelineEmitInExpressionContext(node) { + function pipelineEmitExpression(node) { var kind = node.kind; switch (kind) { case 8: @@ -48853,77 +52623,82 @@ var ts; case 98: writeTokenText(kind); return; - case 175: - return emitArrayLiteralExpression(node); case 176: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 177: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 178: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 179: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 180: - return emitNewExpression(node); + return emitCallExpression(node); case 181: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 182: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 183: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 184: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 185: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 186: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 187: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 188: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 189: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 190: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 191: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 192: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 193: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 194: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 195: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 196: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 197: - return emitClassExpression(node); + return emitSpreadExpression(node); case 198: + return emitClassExpression(node); + case 199: return; - case 200: - return emitAsExpression(node); case 201: + return emitAsExpression(node); + case 202: return emitNonNullExpression(node); - case 246: + case 203: + return emitMetaProperty(node); + case 248: return emitJsxElement(node); - case 247: + case 249: return emitJsxSelfClosingElement(node); - case 294: + case 295: return emitPartiallyEmittedExpression(node); - case 297: - return writeLines(node.text); + } + } + function trySubstituteNode(hint, node) { + return node && substituteNode && substituteNode(hint, node) || node; + } + function emitHelpersIndirect(node) { + if (onEmitHelpers) { + onEmitHelpers(node, writeLines); } } function emitNumericLiteral(node) { emitLiteral(node); - if (node.trailingComment) { - write(" /*" + node.trailingComment + "*/"); - } } function emitLiteral(node) { var text = getLiteralTextOfNode(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) + if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -48962,8 +52737,8 @@ var ts; writeIfPresent(node.dotDotDotToken, "..."); emit(node.name); writeIfPresent(node.questionToken, "?"); - emitExpressionWithPrefix(" = ", node.initializer); emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { write("@"); @@ -49010,7 +52785,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 ? "get " : "set "); + write(node.kind === 152 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -49110,17 +52885,13 @@ var ts; write("{"); writeLine(); increaseIndent(); - if (node.readonlyToken) { - write("readonly "); - } + writeIfPresent(node.readonlyToken, "readonly "); write("["); emit(node.typeParameter.name); write(" in "); emit(node.typeParameter.constraint); write("]"); - if (node.questionToken) { - write("?"); - } + writeIfPresent(node.questionToken, "?"); write(": "); emit(node.type); write(";"); @@ -49180,7 +52951,7 @@ var ts; increaseIndent(); } var preferNewLine = node.multiLine ? 32768 : 0; - var allowTrailingComma = languageVersion >= 1 ? 32 : 0; + var allowTrailingComma = currentSourceFile.languageVersion >= 1 ? 32 : 0; emitList(node, properties, 978 | allowTrailingComma | preferNewLine); if (indentedFlag) { decreaseIndent(); @@ -49192,7 +52963,7 @@ var ts; var indentAfterDot = false; if (!(ts.getEmitFlags(node) & 65536)) { var dotRangeStart = node.expression.end; - var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; + var dotRangeEnd = ts.skipTrivia(currentSourceFile.text, node.expression.end) + 1; var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd }; indentBeforeDot = needsIndentation(node, node.expression, dotToken); indentAfterDot = needsIndentation(node, dotToken, node.name); @@ -49206,15 +52977,17 @@ var ts; decreaseIndentIf(indentBeforeDot, indentAfterDot); } function needsDotDotForPropertyAccess(expression) { - if (expression.kind === 8) { + expression = ts.skipPartiallyEmittedExpressions(expression); + if (ts.isNumericLiteral(expression)) { var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22)) < 0; + return !expression.numericLiteralFlags + && text.indexOf(ts.tokenToString(22)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { var constantValue = ts.getConstantValue(expression); return isFinite(constantValue) && Math.floor(constantValue) === constantValue - && compilerOptions.removeComments; + && printerOptions.removeComments; } } function emitElementAccessExpression(node) { @@ -49240,11 +53013,9 @@ var ts; emitExpression(node.template); } function emitTypeAssertionExpression(node) { - if (node.type) { - write("<"); - emit(node.type); - write(">"); - } + write("<"); + emit(node.type); + write(">"); emitExpression(node.expression); } function emitParenthesizedExpression(node) { @@ -49291,7 +53062,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 190 + return operand.kind === 191 && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43))); } @@ -49357,6 +53128,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } function emitTemplateSpan(node) { emitExpression(node.expression); emit(node.literal); @@ -49370,6 +53146,9 @@ var ts; else { writeToken(16, node.pos, node); emitBlockStatements(node); + increaseIndent(); + emitLeadingCommentsOfPosition(node.statements.end); + decreaseIndent(); writeToken(17, node.statements.end, node); } } @@ -49399,27 +53178,27 @@ var ts; writeToken(18, openParenPos, node); emitExpression(node.expression); writeToken(19, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 208) { + if (node.elseStatement.kind === 210) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -49429,7 +53208,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49441,7 +53220,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49451,2370 +53230,3934 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87, node.pos); write(" "); + emitWithSuffix(node.awaitModifier, " "); writeToken(18, openParenPos); emitForBinding(node.initializer); write(" of "); emitExpression(node.expression); - writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + writeToken(19, node.expression.end); + emitEmbeddedStatement(node, node.statement); + } + function emitForBinding(node) { + if (node !== undefined) { + if (node.kind === 226) { + emit(node); + } + else { + emitExpression(node); + } + } + } + function emitContinueStatement(node) { + writeToken(76, node.pos); + emitWithPrefix(" ", node.label); + write(";"); + } + function emitBreakStatement(node) { + writeToken(71, node.pos); + emitWithPrefix(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + writeToken(95, node.pos, node); + emitExpressionWithPrefix(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emitExpression(node.expression); + write(")"); + emitEmbeddedStatement(node, node.statement); + } + function emitSwitchStatement(node) { + var openParenPos = writeToken(97, node.pos); + write(" "); + writeToken(18, openParenPos); + emitExpression(node.expression); + writeToken(19, node.expression.end); + write(" "); + emit(node.caseBlock); + } + function emitLabeledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function emitThrowStatement(node) { + write("throw"); + emitExpressionWithPrefix(" ", node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } + if (node.finallyBlock) { + writeLineOrSpace(node); + write("finally "); + emit(node.finallyBlock); + } + } + function emitDebuggerStatement(node) { + writeToken(77, node.pos); + write(";"); + } + function emitVariableDeclaration(node) { + emit(node.name); + emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); + } + function emitVariableDeclarationList(node) { + write(ts.isLet(node) ? "let " : ts.isConst(node) ? "const " : "var "); + emitList(node, node.declarations, 272); + } + function emitFunctionDeclaration(node) { + emitFunctionDeclarationOrExpression(node); + } + function emitFunctionDeclarationOrExpression(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write(node.asteriskToken ? "function* " : "function "); + emitIdentifierName(node.name); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitBlockCallback(_hint, body) { + emitBlockFunctionBody(body); + } + function emitSignatureAndBody(node, emitSignatureHead) { + var body = node.body; + if (body) { + if (ts.isBlock(body)) { + var indentedFlag = ts.getEmitFlags(node) & 32768; + if (indentedFlag) { + increaseIndent(); + } + if (ts.getEmitFlags(node) & 262144) { + emitSignatureHead(node); + if (onEmitNode) { + onEmitNode(3, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } + } + else { + pushNameGenerationScope(); + emitSignatureHead(node); + if (onEmitNode) { + onEmitNode(3, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } + popNameGenerationScope(); + } + if (indentedFlag) { + decreaseIndent(); + } + } + else { + emitSignatureHead(node); + write(" "); + emitExpression(body); + } + } + else { + emitSignatureHead(node); + write(";"); + } + } + function emitSignatureHead(node) { + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitWithPrefix(": ", node.type); + } + function shouldEmitBlockFunctionBodyOnSingleLine(body) { + if (ts.getEmitFlags(body) & 1) { + return true; + } + if (body.multiLine) { + return false; + } + if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) { + return false; + } + if (shouldWriteLeadingLineTerminator(body, body.statements, 2) + || shouldWriteClosingLineTerminator(body, body.statements, 2)) { + return false; + } + var previousStatement; + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + if (shouldWriteSeparatingLineTerminator(previousStatement, statement, 2)) { + return false; + } + previousStatement = statement; + } + return true; + } + function emitBlockFunctionBody(body) { + write(" {"); + increaseIndent(); + var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body) + ? emitBlockFunctionBodyOnSingleLine + : emitBlockFunctionBodyWorker; + if (emitBodyWithDetachedComments) { + emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody); + } + else { + emitBlockFunctionBody(body); + } + decreaseIndent(); + writeToken(17, body.statements.end, body); + } + function emitBlockFunctionBodyOnSingleLine(body) { + emitBlockFunctionBodyWorker(body, true); + } + function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { + var statementOffset = emitPrologueDirectives(body.statements, true); + var pos = writer.getTextPos(); + emitHelpersIndirect(body); + if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { + decreaseIndent(); + emitList(body, body.statements, 384); + increaseIndent(); + } + else { + emitList(body, body.statements, 1, statementOffset); + } + } + function emitClassDeclaration(node) { + emitClassDeclarationOrExpression(node); + } + function emitClassDeclarationOrExpression(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write("class"); + emitNodeWithPrefix(" ", node.name, emitIdentifierName); + var indentedFlag = ts.getEmitFlags(node) & 32768; + if (indentedFlag) { + increaseIndent(); + } + emitTypeParameters(node, node.typeParameters); + emitList(node, node.heritageClauses, 256); + pushNameGenerationScope(); + write(" {"); + emitList(node, node.members, 65); + write("}"); + popNameGenerationScope(); + if (indentedFlag) { + decreaseIndent(); + } + } + function emitInterfaceDeclaration(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write("interface "); + emit(node.name); + emitTypeParameters(node, node.typeParameters); + emitList(node, node.heritageClauses, 256); + write(" {"); + emitList(node, node.members, 65); + write("}"); + } + function emitTypeAliasDeclaration(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write("type "); + emit(node.name); + emitTypeParameters(node, node.typeParameters); + write(" = "); + emit(node.type); + write(";"); + } + function emitEnumDeclaration(node) { + emitModifiers(node, node.modifiers); + write("enum "); + emit(node.name); + pushNameGenerationScope(); + write(" {"); + emitList(node, node.members, 81); + write("}"); + popNameGenerationScope(); + } + function emitModuleDeclaration(node) { + emitModifiers(node, node.modifiers); + write(node.flags & 16 ? "namespace " : "module "); + emit(node.name); + var body = node.body; + while (body.kind === 232) { + write("."); + emit(body.name); + body = body.body; + } + write(" "); + emit(body); + } + function emitModuleBlock(node) { + if (isEmptyBlock(node)) { + write("{ }"); + } + else { + pushNameGenerationScope(); + write("{"); + emitBlockStatements(node); + write("}"); + popNameGenerationScope(); + } + } + function emitCaseBlock(node) { + writeToken(16, node.pos); + emitList(node, node.clauses, 65); + writeToken(17, node.clauses.end); + } + function emitImportEqualsDeclaration(node) { + emitModifiers(node, node.modifiers); + write("import "); + emit(node.name); + write(" = "); + emitModuleReference(node.moduleReference); + write(";"); + } + function emitModuleReference(node) { + if (node.kind === 70) { + emitExpression(node); + } + else { + emit(node); + } + } + function emitImportDeclaration(node) { + emitModifiers(node, node.modifiers); + write("import "); + if (node.importClause) { + emit(node.importClause); + write(" from "); + } + emitExpression(node.moduleSpecifier); + write(";"); + } + function emitImportClause(node) { + emit(node.name); + if (node.name && node.namedBindings) { + write(", "); + } + emit(node.namedBindings); + } + function emitNamespaceImport(node) { + write("* as "); + emit(node.name); + } + function emitNamedImports(node) { + emitNamedImportsOrExports(node); + } + function emitImportSpecifier(node) { + emitImportOrExportSpecifier(node); + } + function emitExportAssignment(node) { + write(node.isExportEquals ? "export = " : "export default "); + emitExpression(node.expression); + write(";"); + } + function emitExportDeclaration(node) { + write("export "); + if (node.exportClause) { + emit(node.exportClause); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emitExpression(node.moduleSpecifier); + } + write(";"); + } + function emitNamedExports(node) { + emitNamedImportsOrExports(node); + } + function emitExportSpecifier(node) { + emitImportOrExportSpecifier(node); + } + function emitNamedImportsOrExports(node) { + write("{"); + emitList(node, node.elements, 432); + write("}"); + } + function emitImportOrExportSpecifier(node) { + if (node.propertyName) { + emit(node.propertyName); + write(" as "); + } + emit(node.name); + } + function emitExternalModuleReference(node) { + write("require("); + emitExpression(node.expression); + write(")"); + } + function emitJsxElement(node) { + emit(node.openingElement); + emitList(node, node.children, 131072); + emit(node.closingElement); + } + function emitJsxSelfClosingElement(node) { + write("<"); + emitJsxTagName(node.tagName); + write(" "); + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } + write("/>"); + } + function emitJsxOpeningElement(node) { + write("<"); + emitJsxTagName(node.tagName); + writeIfAny(node.attributes.properties, " "); + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } + write(">"); + } + function emitJsxText(node) { + writer.writeLiteral(getTextOfNode(node, true)); + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxAttributes(node) { + emitList(node, node.properties, 131328); + } + function emitJsxAttribute(node) { + emit(node.name); + emitWithPrefix("=", node.initializer); + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emitExpression(node.expression); + write("}"); + } + function emitJsxExpression(node) { + if (node.expression) { + write("{"); + if (node.dotDotDotToken) { + write("..."); + } + emitExpression(node.expression); + write("}"); + } + } + function emitJsxTagName(node) { + if (node.kind === 70) { + emitExpression(node); + } + else { + emit(node); + } + } + function emitCaseClause(node) { + write("case "); + emitExpression(node.expression); + write(":"); + emitCaseOrDefaultClauseStatements(node, node.statements); + } + function emitDefaultClause(node) { + write("default:"); + emitCaseOrDefaultClauseStatements(node, node.statements); + } + function emitCaseOrDefaultClauseStatements(parentNode, statements) { + var emitAsSingleStatement = statements.length === 1 && + (ts.nodeIsSynthesized(parentNode) || + ts.nodeIsSynthesized(statements[0]) || + ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile)); + if (emitAsSingleStatement) { + write(" "); + emit(statements[0]); + } + else { + emitList(parentNode, statements, 81985); + } + } + function emitHeritageClause(node) { + write(" "); + writeTokenText(node.token); + write(" "); + emitList(node, node.types, 272); + } + function emitCatchClause(node) { + var openParenPos = writeToken(73, node.pos); + write(" "); + writeToken(18, openParenPos); + emit(node.variableDeclaration); + writeToken(19, node.variableDeclaration ? node.variableDeclaration.end : openParenPos); + write(" "); + emit(node.block); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + var initializer = node.initializer; + if (emitTrailingCommentsOfPosition && (ts.getEmitFlags(initializer) & 512) === 0) { + var commentRange = ts.getCommentRange(initializer); + emitTrailingCommentsOfPosition(commentRange.pos); + } + emitExpression(initializer); + } + function emitShorthandPropertyAssignment(node) { + emit(node.name); + if (node.objectAssignmentInitializer) { + write(" = "); + emitExpression(node.objectAssignmentInitializer); + } + } + function emitSpreadAssignment(node) { + if (node.expression) { + write("..."); + emitExpression(node.expression); + } + } + function emitEnumMember(node) { + emit(node.name); + emitExpressionWithPrefix(" = ", node.initializer); + } + function emitSourceFile(node) { + writeLine(); + var statements = node.statements; + if (emitBodyWithDetachedComments) { + var shouldEmitDetachedComment = statements.length === 0 || + !ts.isPrologueDirective(statements[0]) || + ts.nodeIsSynthesized(statements[0]); + if (shouldEmitDetachedComment) { + emitBodyWithDetachedComments(node, statements, emitSourceFileWorker); + return; + } + } + emitSourceFileWorker(node); + } + function emitSourceFileWorker(node) { + var statements = node.statements; + pushNameGenerationScope(); + emitHelpersIndirect(node); + var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); + emitList(node, statements, 1, index === -1 ? statements.length : index); + popNameGenerationScope(); + } + function emitPartiallyEmittedExpression(node) { + emitExpression(node.expression); } - function emitForBinding(node) { - if (node !== undefined) { - if (node.kind === 224) { - emit(node); + function emitPrologueDirectives(statements, startWithNewLine, seenPrologueDirectives) { + for (var i = 0; i < statements.length; i++) { + var statement = statements[i]; + if (ts.isPrologueDirective(statement)) { + var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true; + if (shouldEmitPrologueDirective) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statement); + if (seenPrologueDirectives) { + seenPrologueDirectives.set(statement.expression.text, statement.expression.text); + } + } } else { - emitExpression(node); + return i; } } + return statements.length; } - function emitContinueStatement(node) { - writeToken(76, node.pos); - emitWithPrefix(" ", node.label); - write(";"); + function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + setSourceFile(sourceFileOrBundle); + emitPrologueDirectives(sourceFileOrBundle.statements); + } + else { + var seenPrologueDirectives = ts.createMap(); + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + setSourceFile(sourceFile); + emitPrologueDirectives(sourceFile.statements, true, seenPrologueDirectives); + } + } } - function emitBreakStatement(node) { - writeToken(71, node.pos); - emitWithPrefix(" ", node.label); - write(";"); + function emitShebangIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + var shebang = ts.getShebang(sourceFileOrBundle.text); + if (shebang) { + write(shebang); + writeLine(); + return true; + } + } + else { + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + if (emitShebangIfNeeded(sourceFile)) { + break; + } + } + } } - function emitReturnStatement(node) { - writeToken(95, node.pos, node); - emitExpressionWithPrefix(" ", node.expression); - write(";"); + function emitModifiers(node, modifiers) { + if (modifiers && modifiers.length) { + emitList(node, modifiers, 256); + write(" "); + } } - function emitWithStatement(node) { - write("with ("); - emitExpression(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); + function emitWithPrefix(prefix, node) { + emitNodeWithPrefix(prefix, node, emit); } - function emitSwitchStatement(node) { - var openParenPos = writeToken(97, node.pos); - write(" "); - writeToken(18, openParenPos); - emitExpression(node.expression); - writeToken(19, node.expression.end); - write(" "); - emit(node.caseBlock); + function emitExpressionWithPrefix(prefix, node) { + emitNodeWithPrefix(prefix, node, emitExpression); } - function emitLabeledStatement(node) { - emit(node.label); - write(": "); - emit(node.statement); + function emitNodeWithPrefix(prefix, node, emit) { + if (node) { + write(prefix); + emit(node); + } } - function emitThrowStatement(node) { - write("throw"); - emitExpressionWithPrefix(" ", node.expression); - write(";"); + function emitWithSuffix(node, suffix) { + if (node) { + emit(node); + write(suffix); + } } - function emitTryStatement(node) { - write("try "); - emit(node.tryBlock); - emit(node.catchClause); - if (node.finallyBlock) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1) { + write(" "); + emit(node); + } + else { writeLine(); - write("finally "); - emit(node.finallyBlock); + increaseIndent(); + emit(node); + decreaseIndent(); } } - function emitDebuggerStatement(node) { - writeToken(77, node.pos); - write(";"); + function emitDecorators(parentNode, decorators) { + emitList(parentNode, decorators, 24577); } - function emitVariableDeclaration(node) { - emit(node.name); - emitWithPrefix(": ", node.type); - emitExpressionWithPrefix(" = ", node.initializer); + function emitTypeArguments(parentNode, typeArguments) { + emitList(parentNode, typeArguments, 26960); } - function emitVariableDeclarationList(node) { - write(ts.isLet(node) ? "let " : ts.isConst(node) ? "const " : "var "); - emitList(node, node.declarations, 272); + function emitTypeParameters(parentNode, typeParameters) { + emitList(parentNode, typeParameters, 26960); } - function emitFunctionDeclaration(node) { - emitFunctionDeclarationOrExpression(node); + function emitParameters(parentNode, parameters) { + emitList(parentNode, parameters, 1360); } - function emitFunctionDeclarationOrExpression(node) { - emitDecorators(node, node.decorators); - emitModifiers(node, node.modifiers); - write(node.asteriskToken ? "function* " : "function "); - emitIdentifierName(node.name); - emitSignatureAndBody(node, emitSignatureHead); + function emitParametersForArrow(parentNode, parameters) { + if (parameters && + parameters.length === 1 && + parameters[0].type === undefined && + parameters[0].pos === parentNode.pos) { + emit(parameters[0]); + } + else { + emitParameters(parentNode, parameters); + } } - function emitSignatureAndBody(node, emitSignatureHead) { - var body = node.body; - if (body) { - if (ts.isBlock(body)) { - var indentedFlag = ts.getEmitFlags(node) & 32768; - if (indentedFlag) { - increaseIndent(); + function emitParametersForIndexSignature(parentNode, parameters) { + emitList(parentNode, parameters, 4432); + } + function emitList(parentNode, children, format, start, count) { + emitNodeList(emit, parentNode, children, format, start, count); + } + function emitExpressionList(parentNode, children, format, start, count) { + emitNodeList(emitExpression, parentNode, children, format, start, count); + } + function emitNodeList(emit, parentNode, children, format, start, count) { + if (start === void 0) { start = 0; } + if (count === void 0) { count = children ? children.length - start : 0; } + var isUndefined = children === undefined; + if (isUndefined && format & 8192) { + return; + } + var isEmpty = isUndefined || children.length === 0 || start >= children.length || count === 0; + if (isEmpty && format & 16384) { + return; + } + if (format & 7680) { + write(getOpeningBracket(format)); + } + if (onBeforeEmitNodeArray) { + onBeforeEmitNodeArray(children); + } + if (isEmpty) { + if (format & 1) { + writeLine(); + } + else if (format & 128) { + write(" "); + } + } + else { + var mayEmitInterveningComments = (format & 131072) === 0; + var shouldEmitInterveningComments = mayEmitInterveningComments; + if (shouldWriteLeadingLineTerminator(parentNode, children, format)) { + writeLine(); + shouldEmitInterveningComments = false; + } + else if (format & 128) { + write(" "); + } + if (format & 64) { + increaseIndent(); + } + var previousSibling = void 0; + var shouldDecreaseIndentAfterEmit = void 0; + var delimiter = getDelimiter(format); + for (var i = 0; i < count; i++) { + var child = children[start + i]; + if (previousSibling) { + if (delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } + write(delimiter); + if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) { + if ((format & (3 | 64)) === 0) { + increaseIndent(); + shouldDecreaseIndentAfterEmit = true; + } + writeLine(); + shouldEmitInterveningComments = false; + } + else if (previousSibling && format & 256) { + write(" "); + } } - if (ts.getEmitFlags(node) & 262144) { - emitSignatureHead(node); - emitBlockFunctionBody(body); + if (shouldEmitInterveningComments) { + if (emitTrailingCommentsOfPosition) { + var commentRange = ts.getCommentRange(child); + emitTrailingCommentsOfPosition(commentRange.pos); + } } else { - var savedTempFlags = tempFlags; - tempFlags = 0; - emitSignatureHead(node); - emitBlockFunctionBody(body); - tempFlags = savedTempFlags; + shouldEmitInterveningComments = mayEmitInterveningComments; } - if (indentedFlag) { + emit(child); + if (shouldDecreaseIndentAfterEmit) { decreaseIndent(); + shouldDecreaseIndentAfterEmit = false; } + previousSibling = child; } - else { - emitSignatureHead(node); + var hasTrailingComma = (format & 32) && children.hasTrailingComma; + if (format & 16 && hasTrailingComma) { + write(","); + } + if (previousSibling && delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } + if (format & 64) { + decreaseIndent(); + } + if (shouldWriteClosingLineTerminator(parentNode, children, format)) { + writeLine(); + } + else if (format & 128) { write(" "); - emitExpression(body); } } + if (onAfterEmitNodeArray) { + onAfterEmitNodeArray(children); + } + if (format & 7680) { + write(getClosingBracket(format)); + } + } + function write(s) { + writer.write(s); + } + function writeLine() { + writer.writeLine(); + } + function increaseIndent() { + writer.increaseIndent(); + } + function decreaseIndent() { + writer.decreaseIndent(); + } + function writeIfAny(nodes, text) { + if (ts.some(nodes)) { + write(text); + } + } + function writeIfPresent(node, text) { + if (node) { + write(text); + } + } + function writeToken(token, pos, contextNode) { + return onEmitSourceMapOfToken + ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) + : writeTokenText(token, pos); + } + function writeTokenText(token, pos) { + var tokenString = ts.tokenToString(token); + write(tokenString); + return pos < 0 ? pos : pos + tokenString.length; + } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1) { + write(" "); + } else { - emitSignatureHead(node); - write(";"); + writeLine(); } } - function emitSignatureHead(node) { - emitTypeParameters(node, node.typeParameters); - emitParameters(node, node.parameters); - emitWithPrefix(": ", node.type); + function writeLines(text) { + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); + for (var i = 0; i < lines.length; i++) { + var line = indentation ? lines[i].slice(indentation) : lines[i]; + if (line.length) { + writeLine(); + write(line); + writeLine(); + } + } } - function shouldEmitBlockFunctionBodyOnSingleLine(body) { - if (ts.getEmitFlags(body) & 1) { + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } + function increaseIndentIf(value, valueToWriteWhenNotIndenting) { + if (value) { + increaseIndent(); + writeLine(); + } + else if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + } + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function shouldWriteLeadingLineTerminator(parentNode, children, format) { + if (format & 1) { return true; } - if (body.multiLine) { - return false; + if (format & 2) { + if (format & 32768) { + return true; + } + var firstChild = children[0]; + if (firstChild === undefined) { + return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile); + } + else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(firstChild)) { + return synthesizedNodeStartsOnNewLine(firstChild, format); + } + else { + return !ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile); + } } - if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) { + else { return false; } - if (shouldWriteLeadingLineTerminator(body, body.statements, 2) - || shouldWriteClosingLineTerminator(body, body.statements, 2)) { - return false; + } + function shouldWriteSeparatingLineTerminator(previousNode, nextNode, format) { + if (format & 1) { + return true; } - var previousStatement; - for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { - var statement = _b[_a]; - if (shouldWriteSeparatingLineTerminator(previousStatement, statement, 2)) { + else if (format & 2) { + if (previousNode === undefined || nextNode === undefined) { return false; } - previousStatement = statement; + else if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) { + return synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format); + } + else { + return !ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile); + } + } + else { + return nextNode.startsOnNewLine; } - return true; } - function emitBlockFunctionBody(body) { - write(" {"); - increaseIndent(); - emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body) - ? emitBlockFunctionBodyOnSingleLine - : emitBlockFunctionBodyWorker); - decreaseIndent(); - writeToken(17, body.statements.end, body); + function shouldWriteClosingLineTerminator(parentNode, children, format) { + if (format & 1) { + return (format & 65536) === 0; + } + else if (format & 2) { + if (format & 32768) { + return true; + } + var lastChild = ts.lastOrUndefined(children); + if (lastChild === undefined) { + return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile); + } + else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(lastChild)) { + return synthesizedNodeStartsOnNewLine(lastChild, format); + } + else { + return !ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile); + } + } + else { + return false; + } } - function emitBlockFunctionBodyOnSingleLine(body) { - emitBlockFunctionBodyWorker(body, true); + function synthesizedNodeStartsOnNewLine(node, format) { + if (ts.nodeIsSynthesized(node)) { + var startsOnNewLine = node.startsOnNewLine; + if (startsOnNewLine === undefined) { + return (format & 32768) !== 0; + } + return startsOnNewLine; + } + return (format & 32768) !== 0; } - function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { - var statementOffset = emitPrologueDirectives(body.statements, true); - var helpersEmitted = emitHelpers(body); - if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) { - decreaseIndent(); - emitList(body, body.statements, 384); - increaseIndent(); + function needsIndentation(parent, node1, node2) { + parent = skipSynthesizedParentheses(parent); + node1 = skipSynthesizedParentheses(node1); + node2 = skipSynthesizedParentheses(node2); + if (node2.startsOnNewLine) { + return true; } - else { - emitList(body, body.statements, 1, statementOffset); + return !ts.nodeIsSynthesized(parent) + && !ts.nodeIsSynthesized(node1) + && !ts.nodeIsSynthesized(node2) + && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); + } + function isSingleLineEmptyBlock(block) { + return !block.multiLine + && isEmptyBlock(block); + } + function isEmptyBlock(block) { + return block.statements.length === 0 + && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + } + function skipSynthesizedParentheses(node) { + while (node.kind === 184 && ts.nodeIsSynthesized(node)) { + node = node.expression; } + return node; } - function emitClassDeclaration(node) { - emitClassDeclarationOrExpression(node); + function getTextOfNode(node, includeTrivia) { + if (ts.isGeneratedIdentifier(node)) { + return generateName(node); + } + else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { + return ts.unescapeIdentifier(node.text); + } + else if (node.kind === 9 && node.textSourceNode) { + return getTextOfNode(node.textSourceNode, includeTrivia); + } + else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { + return node.text; + } + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia); } - function emitClassDeclarationOrExpression(node) { - emitDecorators(node, node.decorators); - emitModifiers(node, node.modifiers); - write("class"); - emitNodeWithPrefix(" ", node.name, emitIdentifierName); - var indentedFlag = ts.getEmitFlags(node) & 32768; - if (indentedFlag) { - increaseIndent(); + function getLiteralTextOfNode(node) { + if (node.kind === 9 && node.textSourceNode) { + var textSourceNode = node.textSourceNode; + if (ts.isIdentifier(textSourceNode)) { + return "\"" + ts.escapeNonAsciiCharacters(ts.escapeString(getTextOfNode(textSourceNode))) + "\""; + } + else { + return getLiteralTextOfNode(textSourceNode); + } } - emitTypeParameters(node, node.typeParameters); - emitList(node, node.heritageClauses, 256); - var savedTempFlags = tempFlags; + return ts.getLiteralText(node, currentSourceFile); + } + function pushNameGenerationScope() { + tempFlagsStack.push(tempFlags); tempFlags = 0; - write(" {"); - emitList(node, node.members, 65); - write("}"); - if (indentedFlag) { - decreaseIndent(); + } + function popNameGenerationScope() { + tempFlags = tempFlagsStack.pop(); + } + function generateName(name) { + if (name.autoGenerateKind === 4) { + var node = getNodeForGeneratedName(name); + return generateNameCached(node); + } + else { + var autoGenerateId = name.autoGenerateId; + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(makeName(name))); } - tempFlags = savedTempFlags; } - function emitInterfaceDeclaration(node) { - emitDecorators(node, node.decorators); - emitModifiers(node, node.modifiers); - write("interface "); - emit(node.name); - emitTypeParameters(node, node.typeParameters); - emitList(node, node.heritageClauses, 256); - write(" {"); - emitList(node, node.members, 65); - write("}"); + function generateNameCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); } - function emitTypeAliasDeclaration(node) { - emitDecorators(node, node.decorators); - emitModifiers(node, node.modifiers); - write("type "); - emit(node.name); - emitTypeParameters(node, node.typeParameters); - write(" = "); - emit(node.type); - write(";"); + function isUniqueName(name) { + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name) + && !generatedNames.has(name); } - function emitEnumDeclaration(node) { - emitModifiers(node, node.modifiers); - write("enum "); - emit(node.name); - var savedTempFlags = tempFlags; - tempFlags = 0; - write(" {"); - emitList(node, node.members, 81); - write("}"); - tempFlags = savedTempFlags; + function isUniqueLocalName(name, container) { + for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { + if (node.locals) { + var local = node.locals.get(name); + if (local && local.flags & (107455 | 1048576 | 8388608)) { + return false; + } + } + } + return true; } - function emitModuleDeclaration(node) { - emitModifiers(node, node.modifiers); - write(node.flags & 16 ? "namespace " : "module "); - emit(node.name); - var body = node.body; - while (body.kind === 230) { - write("."); - emit(body.name); - body = body.body; + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name)) { + tempFlags |= flags; + return name; + } + } + while (true) { + var count = tempFlags & 268435455; + tempFlags++; + if (count !== 8 && count !== 13) { + var name = count < 26 + ? "_" + String.fromCharCode(97 + count) + : "_" + (count - 26); + if (isUniqueName(name)) { + return name; + } + } } - write(" "); - emit(body); } - function emitModuleBlock(node) { - if (isEmptyBlock(node)) { - write("{ }"); + function makeUniqueName(baseName) { + if (baseName.charCodeAt(baseName.length - 1) !== 95) { + baseName += "_"; } - else { - var savedTempFlags = tempFlags; - tempFlags = 0; - write("{"); - increaseIndent(); - emitBlockStatements(node); - write("}"); - tempFlags = savedTempFlags; + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + generatedNames.set(generatedName, generatedName); + return generatedName; + } + i++; } } - function emitCaseBlock(node) { - writeToken(16, node.pos); - emitList(node, node.clauses, 65); - writeToken(17, node.clauses.end); + function generateNameForModuleOrEnum(node) { + var name = getTextOfNode(node.name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); } - function emitImportEqualsDeclaration(node) { - emitModifiers(node, node.modifiers); - write("import "); - emit(node.name); - write(" = "); - emitModuleReference(node.moduleReference); - write(";"); + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); } - function emitModuleReference(node) { - if (node.kind === 70) { - emitExpression(node); - } - else { - emit(node); - } + function generateNameForExportDefault() { + return makeUniqueName("default"); } - function emitImportDeclaration(node) { - emitModifiers(node, node.modifiers); - write("import "); - if (node.importClause) { - emit(node.importClause); - write(" from "); - } - emitExpression(node.moduleSpecifier); - write(";"); + function generateNameForClassExpression() { + return makeUniqueName("class"); } - function emitImportClause(node) { - emit(node.name); - if (node.name && node.namedBindings) { - write(", "); + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameCached(node.name); } - emit(node.namedBindings); + return makeTempVariableName(0); } - function emitNamespaceImport(node) { - write("* as "); - emit(node.name); + function generateNameForNode(node) { + switch (node.kind) { + case 70: + return makeUniqueName(getTextOfNode(node)); + case 232: + case 231: + return generateNameForModuleOrEnum(node); + case 237: + case 243: + return generateNameForImportOrExportDeclaration(node); + case 227: + case 228: + case 242: + return generateNameForExportDefault(); + case 198: + return generateNameForClassExpression(); + case 150: + case 152: + case 153: + return generateNameForMethodOrAccessor(node); + default: + return makeTempVariableName(0); + } } - function emitNamedImports(node) { - emitNamedImportsOrExports(node); + function makeName(name) { + switch (name.autoGenerateKind) { + case 1: + return makeTempVariableName(0); + case 2: + return makeTempVariableName(268435456); + case 3: + return makeUniqueName(ts.unescapeIdentifier(name.text)); + } + ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } - function emitImportSpecifier(node) { - emitImportOrExportSpecifier(node); + function getNodeForGeneratedName(name) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + if (ts.isIdentifier(node) + && node.autoGenerateKind === 4 + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + return node; } - function emitExportAssignment(node) { - write(node.isExportEquals ? "export = " : "export default "); - emitExpression(node.expression); - write(";"); + } + ts.createPrinter = createPrinter; + function createDelimiterMap() { + var delimiters = []; + delimiters[0] = ""; + delimiters[16] = ","; + delimiters[4] = " |"; + delimiters[8] = " &"; + return delimiters; + } + function getDelimiter(format) { + return delimiters[format & 28]; + } + function createBracketsMap() { + var brackets = []; + brackets[512] = ["{", "}"]; + brackets[1024] = ["(", ")"]; + brackets[2048] = ["<", ">"]; + brackets[4096] = ["[", "]"]; + return brackets; + } + function getOpeningBracket(format) { + return brackets[format & 7680][0]; + } + function getClosingBracket(format) { + return brackets[format & 7680][1]; + } + var TempFlags; + (function (TempFlags) { + TempFlags[TempFlags["Auto"] = 0] = "Auto"; + TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; + TempFlags[TempFlags["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); + var ListFormat; + (function (ListFormat) { + ListFormat[ListFormat["None"] = 0] = "None"; + ListFormat[ListFormat["SingleLine"] = 0] = "SingleLine"; + ListFormat[ListFormat["MultiLine"] = 1] = "MultiLine"; + ListFormat[ListFormat["PreserveLines"] = 2] = "PreserveLines"; + ListFormat[ListFormat["LinesMask"] = 3] = "LinesMask"; + ListFormat[ListFormat["NotDelimited"] = 0] = "NotDelimited"; + ListFormat[ListFormat["BarDelimited"] = 4] = "BarDelimited"; + ListFormat[ListFormat["AmpersandDelimited"] = 8] = "AmpersandDelimited"; + ListFormat[ListFormat["CommaDelimited"] = 16] = "CommaDelimited"; + ListFormat[ListFormat["DelimitersMask"] = 28] = "DelimitersMask"; + ListFormat[ListFormat["AllowTrailingComma"] = 32] = "AllowTrailingComma"; + ListFormat[ListFormat["Indented"] = 64] = "Indented"; + ListFormat[ListFormat["SpaceBetweenBraces"] = 128] = "SpaceBetweenBraces"; + ListFormat[ListFormat["SpaceBetweenSiblings"] = 256] = "SpaceBetweenSiblings"; + ListFormat[ListFormat["Braces"] = 512] = "Braces"; + ListFormat[ListFormat["Parenthesis"] = 1024] = "Parenthesis"; + ListFormat[ListFormat["AngleBrackets"] = 2048] = "AngleBrackets"; + ListFormat[ListFormat["SquareBrackets"] = 4096] = "SquareBrackets"; + ListFormat[ListFormat["BracketsMask"] = 7680] = "BracketsMask"; + ListFormat[ListFormat["OptionalIfUndefined"] = 8192] = "OptionalIfUndefined"; + ListFormat[ListFormat["OptionalIfEmpty"] = 16384] = "OptionalIfEmpty"; + ListFormat[ListFormat["Optional"] = 24576] = "Optional"; + ListFormat[ListFormat["PreferNewLine"] = 32768] = "PreferNewLine"; + ListFormat[ListFormat["NoTrailingNewLine"] = 65536] = "NoTrailingNewLine"; + ListFormat[ListFormat["NoInterveningComments"] = 131072] = "NoInterveningComments"; + ListFormat[ListFormat["Modifiers"] = 256] = "Modifiers"; + ListFormat[ListFormat["HeritageClauses"] = 256] = "HeritageClauses"; + ListFormat[ListFormat["TypeLiteralMembers"] = 65] = "TypeLiteralMembers"; + ListFormat[ListFormat["TupleTypeElements"] = 336] = "TupleTypeElements"; + ListFormat[ListFormat["UnionTypeConstituents"] = 260] = "UnionTypeConstituents"; + ListFormat[ListFormat["IntersectionTypeConstituents"] = 264] = "IntersectionTypeConstituents"; + ListFormat[ListFormat["ObjectBindingPatternElements"] = 432] = "ObjectBindingPatternElements"; + ListFormat[ListFormat["ArrayBindingPatternElements"] = 304] = "ArrayBindingPatternElements"; + ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 978] = "ObjectLiteralExpressionProperties"; + ListFormat[ListFormat["ArrayLiteralExpressionElements"] = 4466] = "ArrayLiteralExpressionElements"; + ListFormat[ListFormat["CallExpressionArguments"] = 1296] = "CallExpressionArguments"; + ListFormat[ListFormat["NewExpressionArguments"] = 9488] = "NewExpressionArguments"; + ListFormat[ListFormat["TemplateExpressionSpans"] = 131072] = "TemplateExpressionSpans"; + ListFormat[ListFormat["SingleLineBlockStatements"] = 384] = "SingleLineBlockStatements"; + ListFormat[ListFormat["MultiLineBlockStatements"] = 65] = "MultiLineBlockStatements"; + ListFormat[ListFormat["VariableDeclarationList"] = 272] = "VariableDeclarationList"; + ListFormat[ListFormat["SingleLineFunctionBodyStatements"] = 384] = "SingleLineFunctionBodyStatements"; + ListFormat[ListFormat["MultiLineFunctionBodyStatements"] = 1] = "MultiLineFunctionBodyStatements"; + ListFormat[ListFormat["ClassHeritageClauses"] = 256] = "ClassHeritageClauses"; + ListFormat[ListFormat["ClassMembers"] = 65] = "ClassMembers"; + ListFormat[ListFormat["InterfaceMembers"] = 65] = "InterfaceMembers"; + ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers"; + ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses"; + ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements"; + ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren"; + ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes"; + ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements"; + ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes"; + ListFormat[ListFormat["SourceFileStatements"] = 65537] = "SourceFileStatements"; + ListFormat[ListFormat["Decorators"] = 24577] = "Decorators"; + ListFormat[ListFormat["TypeArguments"] = 26960] = "TypeArguments"; + ListFormat[ListFormat["TypeParameters"] = 26960] = "TypeParameters"; + ListFormat[ListFormat["Parameters"] = 1360] = "Parameters"; + ListFormat[ListFormat["IndexSignatureParameters"] = 4432] = "IndexSignatureParameters"; + })(ListFormat || (ListFormat = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var emptyArray = []; + var ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; + function findConfigFile(searchPath, fileExists, configName) { + if (configName === void 0) { configName = "tsconfig.json"; } + while (true) { + var fileName = ts.combinePaths(searchPath, configName); + if (fileExists(fileName)) { + return fileName; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; } - function emitExportDeclaration(node) { - write("export "); - if (node.exportClause) { - emit(node.exportClause); + return undefined; + } + ts.findConfigFile = findConfigFile; + function resolveTripleslashReference(moduleName, containingFile) { + var basePath = ts.getDirectoryPath(containingFile); + var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); + return ts.normalizePath(referencedFileName); + } + ts.resolveTripleslashReference = resolveTripleslashReference; + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; } - else { - write("*"); + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + return true; + } + commonPathComponents.length = i; + break; + } } - if (node.moduleSpecifier) { - write(" from "); - emitExpression(node.moduleSpecifier); + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; } - write(";"); - } - function emitNamedExports(node) { - emitNamedImportsOrExports(node); + }); + if (failed) { + return ""; } - function emitExportSpecifier(node) { - emitImportOrExportSpecifier(node); + if (!commonPathComponents) { + return currentDirectory; } - function emitNamedImportsOrExports(node) { - write("{"); - emitList(node, node.elements, 432); - write("}"); + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; + function createCompilerHost(options, setParentNodes) { + var existingDirectories = ts.createMap(); + function getCanonicalFileName(fileName) { + return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - function emitImportOrExportSpecifier(node) { - if (node.propertyName) { - emit(node.propertyName); - write(" as "); + function getSourceFile(fileName, languageVersion, onError) { + var text; + try { + ts.performance.mark("beforeIORead"); + text = ts.sys.readFile(fileName, options.charset); + ts.performance.mark("afterIORead"); + ts.performance.measure("I/O Read", "beforeIORead", "afterIORead"); } - emit(node.name); + catch (e) { + if (onError) { + onError(e.message); + } + text = ""; + } + return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } - function emitExternalModuleReference(node) { - write("require("); - emitExpression(node.expression); - write(")"); + function directoryExists(directoryPath) { + if (existingDirectories.has(directoryPath)) { + return true; + } + if (ts.sys.directoryExists(directoryPath)) { + existingDirectories.set(directoryPath, true); + return true; + } + return false; } - function emitJsxElement(node) { - emit(node.openingElement); - emitList(node, node.children, 131072); - emit(node.closingElement); + function ensureDirectoriesExist(directoryPath) { + if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = ts.getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory); + ts.sys.createDirectory(directoryPath); + } } - function emitJsxSelfClosingElement(node) { - write("<"); - emitJsxTagName(node.tagName); - write(" "); - emitList(node, node.attributes, 131328); - write("/>"); + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = ts.createMap(); + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints.set(fileName, { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }); } - function emitJsxOpeningElement(node) { - write("<"); - emitJsxTagName(node.tagName); - writeIfAny(node.attributes, " "); - emitList(node, node.attributes, 131328); - write(">"); + function writeFile(fileName, data, writeByteOrderMark, onError) { + try { + ts.performance.mark("beforeIOWrite"); + ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + ts.performance.mark("afterIOWrite"); + ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite"); + } + catch (e) { + if (onError) { + onError(e.message); + } + } } - function emitJsxText(node) { - writer.writeLiteral(getTextOfNode(node, true)); + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); } - function emitJsxClosingElement(node) { - write(""); + var newLine = ts.getNewLineCharacter(options); + var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); }); + return { + getSourceFile: getSourceFile, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, + writeFile: writeFile, + getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCanonicalFileName: getCanonicalFileName, + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, + readFile: function (fileName) { return ts.sys.readFile(fileName); }, + trace: function (s) { return ts.sys.write(s + newLine); }, + directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, + getEnvironmentVariable: function (name) { return ts.sys.getEnvironmentVariable ? ts.sys.getEnvironmentVariable(name) : ""; }, + getDirectories: function (path) { return ts.sys.getDirectories(path); }, + realpath: realpath + }; + } + ts.createCompilerHost = createCompilerHost; + function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (program.getCompilerOptions().declaration) { + diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); } - function emitJsxAttribute(node) { - emit(node.name); - emitWithPrefix("=", node.initializer); + return ts.sortAndDeduplicateDiagnostics(diagnostics); + } + ts.getPreEmitDiagnostics = getPreEmitDiagnostics; + function formatDiagnostics(diagnostics, host) { + var output = ""; + for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { + var diagnostic = diagnostics_1[_i]; + if (diagnostic.file) { + var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character; + var fileName = diagnostic.file.fileName; + var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }); + output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): "; + } + var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); + output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine(); } - function emitJsxSpreadAttribute(node) { - write("{..."); - emitExpression(node.expression); - write("}"); + return output; + } + ts.formatDiagnostics = formatDiagnostics; + function flattenDiagnosticMessageText(messageText, newLine) { + if (typeof messageText === "string") { + return messageText; } - function emitJsxExpression(node) { - if (node.expression) { - write("{"); - emitExpression(node.expression); - write("}"); + else { + var diagnosticChain = messageText; + var result = ""; + var indent = 0; + while (diagnosticChain) { + if (indent) { + result += newLine; + for (var i = 0; i < indent; i++) { + result += " "; + } + } + result += diagnosticChain.messageText; + indent++; + diagnosticChain = diagnosticChain.next; } + return result; } - function emitJsxTagName(node) { - if (node.kind === 70) { - emitExpression(node); + } + ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = ts.createMap(); + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); } else { - emit(node); + cache.set(name, result = loader(name, containingFile)); } + resolutions.push(result); } - function emitCaseClause(node) { - write("case "); - emitExpression(node.expression); - write(":"); - emitCaseOrDefaultClauseStatements(node, node.statements); + return resolutions; + } + function createProgram(rootNames, options, host, oldProgram) { + var program; + var files = []; + var commonSourceDirectory; + var diagnosticsProducingTypeChecker; + var noDiagnosticsTypeChecker; + var classifiableNames; + var cachedSemanticDiagnosticsForFile = {}; + var cachedDeclarationDiagnosticsForFile = {}; + var resolvedTypeReferenceDirectives = ts.createMap(); + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); + var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; + var currentNodeModulesDepth = 0; + var modulesWithElidedImports = ts.createMap(); + var sourceFilesFoundSearchingNodeModules = ts.createMap(); + ts.performance.mark("beforeProgram"); + host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); + var currentDirectory = host.getCurrentDirectory(); + var supportedExtensions = ts.getSupportedExtensions(options); + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { + if (!resolved || resolved.extension !== undefined) { + return resolved; + } + var withExtension = ts.clone(resolved); + withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName); + return withExtension; + }); }; } - function emitDefaultClause(node) { - write("default:"); - emitCaseOrDefaultClauseStatements(node, node.statements); + else { + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } - function emitCaseOrDefaultClauseStatements(parentNode, statements) { - var emitAsSingleStatement = statements.length === 1 && - (ts.nodeIsSynthesized(parentNode) || - ts.nodeIsSynthesized(statements[0]) || - ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile)); - if (emitAsSingleStatement) { - write(" "); - emit(statements[0]); - } - else { - emitList(parentNode, statements, 81985); - } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; } - function emitHeritageClause(node) { - write(" "); - writeTokenText(node.token); - write(" "); - emitList(node, node.types, 272); + else { + var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; } - function emitCatchClause(node) { - writeLine(); - var openParenPos = writeToken(73, node.pos); - write(" "); - writeToken(18, openParenPos); - emit(node.variableDeclaration); - writeToken(19, node.variableDeclaration ? node.variableDeclaration.end : openParenPos); - write(" "); - emit(node.block); + var filesByName = ts.createFileMap(); + var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; + if (!tryReuseStructureFromOldProgram()) { + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); + if (typeReferences.length) { + var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); + for (var i = 0; i < typeReferences.length; i++) { + processTypeReferenceDirective(typeReferences[i], resolutions[i]); + } + } + if (!skipDefaultLib) { + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), true); + }); + } + } } - function emitPropertyAssignment(node) { - emit(node.name); - write(": "); - var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 512) === 0) { - var commentRange = ts.getCommentRange(initializer); - emitTrailingCommentsOfPosition(commentRange.pos); + moduleResolutionCache = undefined; + oldProgram = undefined; + program = { + getRootFileNames: function () { return rootNames; }, + getSourceFile: getSourceFile, + getSourceFileByPath: getSourceFileByPath, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getOptionsDiagnostics: getOptionsDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getDeclarationDiagnostics: getDeclarationDiagnostics, + getTypeChecker: getTypeChecker, + getClassifiableNames: getClassifiableNames, + getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, + getCommonSourceDirectory: getCommonSourceDirectory, + emit: emit, + getCurrentDirectory: function () { return currentDirectory; }, + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; }, + isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, + dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker + }; + verifyCompilerOptions(); + ts.performance.mark("afterProgram"); + ts.performance.measure("Program", "beforeProgram", "afterProgram"); + return program; + function getCommonSourceDirectory() { + if (commonSourceDirectory === undefined) { + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); + if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { + commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); + } + else { + commonSourceDirectory = computeCommonSourceDirectory(emittedFiles); + } + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { + commonSourceDirectory += ts.directorySeparator; + } } - emitExpression(initializer); + return commonSourceDirectory; } - function emitShorthandPropertyAssignment(node) { - emit(node.name); - if (node.objectAssignmentInitializer) { - write(" = "); - emitExpression(node.objectAssignmentInitializer); + function getClassifiableNames() { + if (!classifiableNames) { + getTypeChecker(); + classifiableNames = ts.createMap(); + for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { + var sourceFile = files_2[_i]; + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); + } } + return classifiableNames; } - function emitSpreadAssignment(node) { - if (node.expression) { - write("..."); - emitExpression(node.expression); + function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) { + if (!oldProgramState && !file.ambientModuleNames.length) { + return resolveModuleNamesWorker(moduleNames, containingFile); } - } - function emitEnumMember(node) { - emit(node.name); - emitExpressionWithPrefix(" = ", node.initializer); - } - function emitSourceFile(node) { - writeLine(); - emitShebang(); - emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker); - } - function emitSourceFileWorker(node) { - var statements = node.statements; - var statementOffset = emitPrologueDirectives(statements); - var savedTempFlags = tempFlags; - tempFlags = 0; - emitHelpers(node); - emitList(node, statements, 1, statementOffset); - tempFlags = savedTempFlags; - } - function emitPartiallyEmittedExpression(node) { - emitExpression(node.expression); - } - function emitPrologueDirectives(statements, startWithNewLine) { - for (var i = 0; i < statements.length; i++) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); + var unknownModuleNames; + var result; + var predictedToResolveToAmbientModuleMarker = {}; + for (var i = 0; i < moduleNames.length; i++) { + var moduleName = moduleNames[i]; + var isKnownToResolveToAmbientModule = false; + if (ts.contains(file.ambientModuleNames, moduleName)) { + isKnownToResolveToAmbientModule = true; + if (ts.isTraceEnabled(options, host)) { + ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile); } - emit(statements[i]); } else { - return i; + isKnownToResolveToAmbientModule = checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState); } - } - return statements.length; - } - function emitHelpers(node, isBundle) { - var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); - var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; - var helpersEmitted = false; - var helpers = ts.getEmitHelpers(node); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - if (shouldSkip) - continue; - if (shouldBundle) { - if (bundledHelpers[helper.name]) { - continue; - } - bundledHelpers[helper.name] = true; - } - } - else if (isBundle) { - continue; + if (isKnownToResolveToAmbientModule) { + if (!unknownModuleNames) { + result = new Array(moduleNames.length); + unknownModuleNames = moduleNames.slice(0, i); } - writeLines(helper.text); - helpersEmitted = true; + result[i] = predictedToResolveToAmbientModuleMarker; + } + else if (unknownModuleNames) { + unknownModuleNames.push(moduleName); } } - if (helpersEmitted) { - writeLine(); + if (!unknownModuleNames) { + return resolveModuleNamesWorker(moduleNames, containingFile); + } + var resolutions = unknownModuleNames.length + ? resolveModuleNamesWorker(unknownModuleNames, containingFile) + : emptyArray; + var j = 0; + for (var i = 0; i < result.length; i++) { + if (result[i] === predictedToResolveToAmbientModuleMarker) { + result[i] = undefined; + } + else { + result[i] = resolutions[j]; + j++; + } + } + ts.Debug.assert(j === resolutions.length); + return result; + function checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) { + if (!oldProgramState) { + return false; + } + var resolutionToFile = ts.getResolvedModule(oldProgramState.file, moduleName); + if (resolutionToFile) { + return false; + } + var ambientModule = oldProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName); + if (!(ambientModule && ambientModule.declarations)) { + return false; + } + var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) { + var f = ts.getSourceFileOfNode(d); + return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f; + }); + if (!firstUnmodifiedFile) { + return false; + } + if (ts.isTraceEnabled(options, host)) { + ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName); + } + return true; } - return helpersEmitted; } - function writeLines(text) { - var lines = text.split(/\r\n?|\n/g); - var indentation = guessIndentation(lines); - for (var i = 0; i < lines.length; i++) { - var line = indentation ? lines[i].slice(indentation) : lines[i]; - if (line.length) { - if (i > 0) { - writeLine(); + function tryReuseStructureFromOldProgram() { + if (!oldProgram) { + return false; + } + var oldOptions = oldProgram.getCompilerOptions(); + if (ts.changesAffectModuleResolution(oldOptions, options)) { + return false; + } + ts.Debug.assert(!oldProgram.structureIsReused); + var oldRootNames = oldProgram.getRootFileNames(); + if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { + return false; + } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } + var newSourceFiles = []; + var filePaths = []; + var modifiedSourceFiles = []; + for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { + var oldSourceFile = _a[_i]; + var newSourceFile = host.getSourceFileByPath + ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) + : host.getSourceFile(oldSourceFile.fileName, options.target); + if (!newSourceFile) { + return false; + } + newSourceFile.path = oldSourceFile.path; + filePaths.push(newSourceFile.path); + if (oldSourceFile !== newSourceFile) { + if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + return false; } - write(line); + if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + return false; + } + collectExternalModuleReferences(newSourceFile); + if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + return false; + } + modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); + } + else { + newSourceFile = oldSourceFile; } + newSourceFiles.push(newSourceFile); } - } - function guessIndentation(lines) { - var indentation; - for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { - var line = lines_1[_a]; - for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { - if (!ts.isWhiteSpace(line.charCodeAt(i))) { - if (indentation === undefined || i < indentation) { - indentation = i; - break; - } + var modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; }); + for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { + var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile; + var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); + if (resolveModuleNamesWorker) { + var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, { file: oldSourceFile, program: oldProgram, modifiedFilePaths: modifiedFilePaths }); + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + if (resolveTypeReferenceDirectiveNamesWorker) { + var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; } } + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } - return indentation; - } - function emitShebang() { - var shebang = ts.getShebang(currentText); - if (shebang) { - write(shebang); - writeLine(); + for (var i = 0; i < newSourceFiles.length; i++) { + filesByName.set(filePaths[i], newSourceFiles[i]); } - } - function emitModifiers(node, modifiers) { - if (modifiers && modifiers.length) { - emitList(node, modifiers, 256); - write(" "); + files = newSourceFiles; + fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); + for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) { + var modifiedFile = modifiedSourceFiles_2[_d]; + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile); } + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); + oldProgram.structureIsReused = true; + return true; } - function emitWithPrefix(prefix, node) { - emitNodeWithPrefix(prefix, node, emit); + function getEmitHost(writeFileCallback) { + return { + getCanonicalFileName: getCanonicalFileName, + getCommonSourceDirectory: program.getCommonSourceDirectory, + getCompilerOptions: program.getCompilerOptions, + getCurrentDirectory: function () { return currentDirectory; }, + getNewLine: function () { return host.getNewLine(); }, + getSourceFile: program.getSourceFile, + getSourceFileByPath: program.getSourceFileByPath, + getSourceFiles: program.getSourceFiles, + isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), + isEmitBlocked: isEmitBlocked, + }; } - function emitExpressionWithPrefix(prefix, node) { - emitNodeWithPrefix(prefix, node, emitExpression); + function isSourceFileFromExternalLibrary(file) { + return sourceFilesFoundSearchingNodeModules.get(file.path); } - function emitNodeWithPrefix(prefix, node, emit) { - if (node) { - write(prefix); - emit(node); - } + function getDiagnosticsProducingTypeChecker() { + return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); } - function emitWithSuffix(node, suffix) { - if (node) { - emit(node); - write(suffix); - } + function dropDiagnosticsProducingTypeChecker() { + diagnosticsProducingTypeChecker = undefined; } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { - write(" "); - emit(node); + function getTypeChecker() { + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); + } + function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers) { + return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers); }); + } + function isEmitBlocked(emitFileName) { + return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + } + function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers) { + var declarationDiagnostics = []; + if (options.noEmit) { + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; } - else { - writeLine(); - increaseIndent(); - emit(node); - decreaseIndent(); + if (options.noEmitOnError) { + var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); + if (diagnostics.length === 0 && program.getCompilerOptions().declaration) { + declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken); + } + if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; + } } + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); + ts.performance.mark("beforeEmit"); + var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers); + ts.performance.mark("afterEmit"); + ts.performance.measure("Emit", "beforeEmit", "afterEmit"); + return emitResult; } - function emitDecorators(parentNode, decorators) { - emitList(parentNode, decorators, 24577); + function getSourceFile(fileName) { + return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); } - function emitTypeArguments(parentNode, typeArguments) { - emitList(parentNode, typeArguments, 26960); + function getSourceFileByPath(path) { + return filesByName.get(path); } - function emitTypeParameters(parentNode, typeParameters) { - emitList(parentNode, typeParameters, 26960); + function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { + if (sourceFile) { + return getDiagnostics(sourceFile, cancellationToken); + } + var allDiagnostics = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + if (cancellationToken) { + cancellationToken.throwIfCancellationRequested(); + } + ts.addRange(allDiagnostics, getDiagnostics(sourceFile, cancellationToken)); + }); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } - function emitParameters(parentNode, parameters) { - emitList(parentNode, parameters, 1360); + function getSyntacticDiagnostics(sourceFile, cancellationToken) { + return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken); } - function emitParametersForArrow(parentNode, parameters) { - if (parameters && - parameters.length === 1 && - parameters[0].type === undefined && - parameters[0].pos === parentNode.pos) { - emit(parameters[0]); + function getSemanticDiagnostics(sourceFile, cancellationToken) { + return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); + } + function getDeclarationDiagnostics(sourceFile, cancellationToken) { + var options = program.getCompilerOptions(); + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); } else { - emitParameters(parentNode, parameters); + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); } } - function emitParametersForIndexSignature(parentNode, parameters) { - emitList(parentNode, parameters, 4432); - } - function emitList(parentNode, children, format, start, count) { - emitNodeList(emit, parentNode, children, format, start, count); - } - function emitExpressionList(parentNode, children, format, start, count) { - emitNodeList(emitExpression, parentNode, children, format, start, count); - } - function emitNodeList(emit, parentNode, children, format, start, count) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = children ? children.length - start : 0; } - var isUndefined = children === undefined; - if (isUndefined && format & 8192) { - return; - } - var isEmpty = isUndefined || children.length === 0 || start >= children.length || count === 0; - if (isEmpty && format & 16384) { - return; + function getSyntacticDiagnosticsForFile(sourceFile) { + if (ts.isSourceFileJavaScript(sourceFile)) { + if (!sourceFile.additionalSyntacticDiagnostics) { + sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile); + } + return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics); } - if (format & 7680) { - write(getOpeningBracket(format)); + return sourceFile.parseDiagnostics; + } + function runWithCancellationToken(func) { + try { + return func(); } - if (isEmpty) { - if (format & 1) { - writeLine(); - } - else if (format & 128) { - write(" "); + catch (e) { + if (e instanceof ts.OperationCanceledException) { + noDiagnosticsTypeChecker = undefined; + diagnosticsProducingTypeChecker = undefined; } + throw e; } - else { - var mayEmitInterveningComments = (format & 131072) === 0; - var shouldEmitInterveningComments = mayEmitInterveningComments; - if (shouldWriteLeadingLineTerminator(parentNode, children, format)) { - writeLine(); - shouldEmitInterveningComments = false; - } - else if (format & 128) { - write(" "); + } + function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedSemanticDiagnosticsForFile, getSemanticDiagnosticsForFileNoCache); + } + function getSemanticDiagnosticsForFileNoCache(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var typeChecker = getDiagnosticsProducingTypeChecker(); + ts.Debug.assert(!!sourceFile.bindDiagnostics); + var bindDiagnostics = sourceFile.bindDiagnostics; + var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; + var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); + var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); + var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + return ts.isSourceFileJavaScript(sourceFile) + ? ts.filter(diagnostics, shouldReportDiagnostic) + : diagnostics; + }); + } + function shouldReportDiagnostic(diagnostic) { + var file = diagnostic.file, start = diagnostic.start; + if (file) { + var lineStarts = ts.getLineStarts(file); + var line = ts.computeLineAndCharacterOfPosition(lineStarts, start).line; + while (line > 0) { + var previousLineText = file.text.slice(lineStarts[line - 1], lineStarts[line]); + var result = ignoreDiagnosticCommentRegEx.exec(previousLineText); + if (!result) { + return true; + } + if (result[3]) { + return false; + } + line--; } - if (format & 64) { - increaseIndent(); + } + return true; + } + function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { + return runWithCancellationToken(function () { + var diagnostics = []; + var parent = sourceFile; + walk(sourceFile); + return diagnostics; + function walk(node) { + switch (parent.kind) { + case 145: + case 148: + if (parent.questionToken === node) { + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + return; + } + case 150: + case 149: + case 151: + case 152: + case 153: + case 185: + case 227: + case 186: + case 227: + case 225: + if (parent.type === node) { + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return; + } + } + switch (node.kind) { + case 236: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); + return; + case 242: + if (node.isExportEquals) { + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); + return; + } + break; + case 258: + var heritageClause = node; + if (heritageClause.token === 107) { + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return; + } + break; + case 229: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return; + case 232: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return; + case 230: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return; + case 231: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return; + case 183: + var typeAssertionExpression = node; + diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return; + } + var prevParent = parent; + parent = node; + ts.forEachChild(node, walk, walkArray); + parent = prevParent; } - var previousSibling = void 0; - var shouldDecreaseIndentAfterEmit = void 0; - var delimiter = getDelimiter(format); - for (var i = 0; i < count; i++) { - var child = children[start + i]; - if (previousSibling) { - write(delimiter); - if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) { - if ((format & (3 | 64)) === 0) { - increaseIndent(); - shouldDecreaseIndentAfterEmit = true; + function walkArray(nodes) { + if (parent.decorators === nodes && !options.experimentalDecorators) { + diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + } + switch (parent.kind) { + case 228: + case 150: + case 149: + case 151: + case 152: + case 153: + case 185: + case 227: + case 186: + case 227: + if (nodes === parent.typeParameters) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + return; } - writeLine(); - shouldEmitInterveningComments = false; - } - else if (previousSibling && format & 256) { - write(" "); - } - } - if (shouldEmitInterveningComments) { - var commentRange = ts.getCommentRange(child); - emitTrailingCommentsOfPosition(commentRange.pos); - } - else { - shouldEmitInterveningComments = mayEmitInterveningComments; + case 207: + if (nodes === parent.modifiers) { + return checkModifiers(nodes, parent.kind === 207); + } + break; + case 148: + if (nodes === parent.modifiers) { + for (var _i = 0, _a = nodes; _i < _a.length; _i++) { + var modifier = _a[_i]; + if (modifier.kind !== 114) { + diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + } + } + return; + } + break; + case 145: + if (nodes === parent.modifiers) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return; + } + break; + case 180: + case 181: + case 200: + if (nodes === parent.typeArguments) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return; + } + break; } - emit(child); - if (shouldDecreaseIndentAfterEmit) { - decreaseIndent(); - shouldDecreaseIndentAfterEmit = false; + for (var _b = 0, nodes_8 = nodes; _b < nodes_8.length; _b++) { + var node = nodes_8[_b]; + walk(node); } - previousSibling = child; } - var hasTrailingComma = (format & 32) && children.hasTrailingComma; - if (format & 16 && hasTrailingComma) { - write(","); + function checkModifiers(modifiers, isConstValid) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + switch (modifier.kind) { + case 75: + if (isConstValid) { + continue; + } + case 113: + case 111: + case 112: + case 130: + case 123: + case 116: + diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + break; + case 114: + case 83: + case 78: + } + } } - if (format & 64) { - decreaseIndent(); + function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) { + var start = nodes.pos; + return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2); } - if (shouldWriteClosingLineTerminator(parentNode, children, format)) { - writeLine(); + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); } - else if (format & 128) { - write(" "); + }); + } + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache); + } + function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) { + return runWithCancellationToken(function () { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile); + }); + } + function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) { + var cachedResult = sourceFile + ? cache.perFile && cache.perFile.get(sourceFile.path) + : cache.allDiagnostics; + if (cachedResult) { + return cachedResult; + } + var result = getDiagnostics(sourceFile, cancellationToken) || emptyArray; + if (sourceFile) { + if (!cache.perFile) { + cache.perFile = ts.createFileMap(); } + cache.perFile.set(sourceFile.path, result); } - if (format & 7680) { - write(getClosingBracket(format)); + else { + cache.allDiagnostics = result; } + return result; } - function writeIfAny(nodes, text) { - if (nodes && nodes.length > 0) { - write(text); - } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); } - function writeIfPresent(node, text) { - if (node !== undefined) { - write(text); - } + function getOptionsDiagnostics() { + var allDiagnostics = []; + ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } - function writeToken(token, pos, contextNode) { - return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText); + function getGlobalDiagnostics() { + var allDiagnostics = []; + ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } - function writeTokenText(token, pos) { - var tokenString = ts.tokenToString(token); - write(tokenString); - return pos < 0 ? pos : pos + tokenString.length; + function processRootFile(fileName, isDefaultLib) { + processSourceFile(ts.normalizePath(fileName), isDefaultLib); } - function increaseIndentIf(value, valueToWriteWhenNotIndenting) { - if (value) { - increaseIndent(); - writeLine(); - } - else if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); - } + function fileReferenceIsEqualTo(a, b) { + return a.fileName === b.fileName; } - function decreaseIndentIf(value1, value2) { - if (value1) { - decreaseIndent(); - } - if (value2) { - decreaseIndent(); - } + function moduleNameIsEqualTo(a, b) { + return a.text === b.text; } - function shouldWriteLeadingLineTerminator(parentNode, children, format) { - if (format & 1) { - return true; + function getTextOfLiteral(literal) { + return literal.text; + } + function collectExternalModuleReferences(file) { + if (file.imports) { + return; } - if (format & 2) { - if (format & 32768) { - return true; + var isJavaScriptFile = ts.isSourceFileJavaScript(file); + var isExternalModuleFile = ts.isExternalModule(file); + var isDtsFile = ts.isDeclarationFile(file); + var imports; + var moduleAugmentations; + var ambientModules; + if (options.importHelpers + && (options.isolatedModules || isExternalModuleFile) + && !file.isDeclarationFile) { + var externalHelpersModuleReference = ts.createLiteral(ts.externalHelpersModuleNameText); + var importDecl = ts.createImportDeclaration(undefined, undefined, undefined); + externalHelpersModuleReference.parent = importDecl; + importDecl.parent = file; + imports = [externalHelpersModuleReference]; + } + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var node = _a[_i]; + collectModuleReferences(node, false); + if (isJavaScriptFile) { + collectRequireCalls(node); } - var firstChild = children[0]; - if (firstChild === undefined) { - return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile); + } + file.imports = imports || emptyArray; + file.moduleAugmentations = moduleAugmentations || emptyArray; + file.ambientModuleNames = ambientModules || emptyArray; + return; + function collectModuleReferences(node, inAmbientModule) { + switch (node.kind) { + case 237: + case 236: + case 243: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + break; + } + if (!moduleNameExpr.text) { + break; + } + if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } + break; + case 232: + if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { + var moduleName = node.name; + if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { + (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); + } + else if (!inAmbientModule) { + if (isDtsFile) { + (ambientModules || (ambientModules = [])).push(moduleName.text); + } + var body = node.body; + if (body) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + collectModuleReferences(statement, true); + } + } + } + } } - else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(firstChild)) { - return synthesizedNodeStartsOnNewLine(firstChild, format); + } + function collectRequireCalls(node) { + if (ts.isRequireCall(node, true)) { + (imports || (imports = [])).push(node.arguments[0]); } else { - return !ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile); + ts.forEachChild(node, collectRequireCalls); } } - else { - return false; - } } - function shouldWriteSeparatingLineTerminator(previousNode, nextNode, format) { - if (format & 1) { - return true; - } - else if (format & 2) { - if (previousNode === undefined || nextNode === undefined) { - return false; + function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + var diagnosticArgument; + var diagnostic; + if (ts.hasExtension(fileName)) { + if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { + diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; + diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; } - else if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) { - return synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format); + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; } - else { - return !ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile); + else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { + diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + diagnosticArgument = [fileName]; } } else { - return nextNode.startsOnNewLine; - } - } - function shouldWriteClosingLineTerminator(parentNode, children, format) { - if (format & 1) { - return (format & 65536) === 0; - } - else if (format & 2) { - if (format & 32768) { - return true; - } - var lastChild = ts.lastOrUndefined(children); - if (lastChild === undefined) { - return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + if (!nonTsFile) { + if (options.allowNonTsExtensions) { + diagnostic = ts.Diagnostics.File_0_not_found; + diagnosticArgument = [fileName]; + } + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { + diagnostic = ts.Diagnostics.File_0_not_found; + fileName += ".ts"; + diagnosticArgument = [fileName]; + } } - else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(lastChild)) { - return synthesizedNodeStartsOnNewLine(lastChild, format); + } + if (diagnostic) { + if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { - return !ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile); - } - } - else { - return false; - } - } - function synthesizedNodeStartsOnNewLine(node, format) { - if (ts.nodeIsSynthesized(node)) { - var startsOnNewLine = node.startsOnNewLine; - if (startsOnNewLine === undefined) { - return (format & 32768) !== 0; + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } - return startsOnNewLine; - } - return (format & 32768) !== 0; - } - function needsIndentation(parent, node1, node2) { - parent = skipSynthesizedParentheses(parent); - node1 = skipSynthesizedParentheses(node1); - node2 = skipSynthesizedParentheses(node2); - if (node2.startsOnNewLine) { - return true; - } - return !ts.nodeIsSynthesized(parent) - && !ts.nodeIsSynthesized(node1) - && !ts.nodeIsSynthesized(node2) - && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); - } - function skipSynthesizedParentheses(node) { - while (node.kind === 183 && ts.nodeIsSynthesized(node)) { - node = node.expression; } - return node; } - function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { - return getGeneratedIdentifier(node); - } - else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { - return ts.unescapeIdentifier(node.text); - } - else if (node.kind === 9 && node.textSourceNode) { - return getTextOfNode(node.textSourceNode, includeTrivia); + function reportFileNamesDifferOnlyInCasingError(fileName, existingFileName, refFile, refPos, refEnd) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); } - else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { - return node.text; + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); } - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia); } - function getLiteralTextOfNode(node) { - if (node.kind === 9 && node.textSourceNode) { - var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode)) { - return "\"" + ts.escapeNonAsciiCharacters(ts.escapeString(getTextOfNode(textSourceNode))) + "\""; - } - else { - return getLiteralTextOfNode(textSourceNode); + function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { + if (filesByName.contains(path)) { + var file_1 = filesByName.get(path); + if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { + reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } - } - return ts.getLiteralText(node, currentSourceFile, languageVersion); - } - function isSingleLineEmptyBlock(block) { - return !block.multiLine - && isEmptyBlock(block); - } - function isEmptyBlock(block) { - return block.statements.length === 0 - && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); - } - function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); - } - function isUniqueLocalName(name, container) { - for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { - return false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth === 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); + if (!options.noResolve) { + processReferencedFiles(file_1, isDefaultLib); + processTypeReferenceDirectives(file_1); } + modulesWithElidedImports.set(file_1.path, false); + processImportedModules(file_1); } - } - return true; - } - function makeTempVariableName(flags) { - if (flags && !(tempFlags & flags)) { - var name_41 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_41)) { - tempFlags |= flags; - return name_41; - } - } - while (true) { - var count = tempFlags & 268435455; - tempFlags++; - if (count !== 8 && count !== 13) { - var name_42 = count < 26 - ? "_" + String.fromCharCode(97 + count) - : "_" + (count - 26); - if (isUniqueName(name_42)) { - return name_42; + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { + if (currentNodeModulesDepth < maxNodeModuleJsDepth) { + modulesWithElidedImports.set(file_1.path, false); + processImportedModules(file_1); } } + return file_1; } - } - function makeUniqueName(baseName) { - if (baseName.charCodeAt(baseName.length - 1) !== 95) { - baseName += "_"; - } - var i = 1; - while (true) { - var generatedName = baseName + i; - if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } - i++; - } - } - function generateNameForModuleOrEnum(node) { - var name = getTextOfNode(node.name); - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); - } - function generateNameForImportOrExportDeclaration(node) { - var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; - return makeUniqueName(baseName); - } - function generateNameForExportDefault() { - return makeUniqueName("default"); - } - function generateNameForClassExpression() { - return makeUniqueName("class"); - } - function generateNameForNode(node) { - switch (node.kind) { - case 70: - return makeUniqueName(getTextOfNode(node)); - case 230: - case 229: - return generateNameForModuleOrEnum(node); - case 235: - case 241: - return generateNameForImportOrExportDeclaration(node); - case 225: - case 226: - case 240: - return generateNameForExportDefault(); - case 197: - return generateNameForClassExpression(); - default: - return makeTempVariableName(0); - } - } - function generateName(name) { - switch (name.autoGenerateKind) { - case 1: - return makeTempVariableName(0); - case 2: - return makeTempVariableName(268435456); - case 3: - return makeUniqueName(name.text); - } - ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - if (ts.isIdentifier(node) - && node.autoGenerateKind === 4 - && node.autoGenerateId !== autoGenerateId) { - break; + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } - original = node.original; - } - return node; - } - function getGeneratedIdentifier(name) { - if (name.autoGenerateKind === 4) { - var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); - } - else { - var autoGenerateId = name.autoGenerateId; - return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name))); - } - } - function createDelimiterMap() { - var delimiters = []; - delimiters[0] = ""; - delimiters[16] = ","; - delimiters[4] = " |"; - delimiters[8] = " &"; - return delimiters; - } - function getDelimiter(format) { - return delimiters[format & 28]; - } - function createBracketsMap() { - var brackets = []; - brackets[512] = ["{", "}"]; - brackets[1024] = ["(", ")"]; - brackets[2048] = ["<", ">"]; - brackets[4096] = ["[", "]"]; - return brackets; - } - function getOpeningBracket(format) { - return brackets[format & 7680][0]; - } - function getClosingBracket(format) { - return brackets[format & 7680][1]; - } - } - ts.emitFiles = emitFiles; -})(ts || (ts = {})); -var ts; -(function (ts) { - var emptyArray = []; - function findConfigFile(searchPath, fileExists, configName) { - if (configName === void 0) { configName = "tsconfig.json"; } - while (true) { - var fileName = ts.combinePaths(searchPath, configName); - if (fileExists(fileName)) { - return fileName; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } - return undefined; - } - ts.findConfigFile = findConfigFile; - function resolveTripleslashReference(moduleName, containingFile) { - var basePath = ts.getDirectoryPath(containingFile); - var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); - return ts.normalizePath(referencedFileName); - } - ts.resolveTripleslashReference = resolveTripleslashReference; - function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { - var commonPathComponents; - var failed = ts.forEach(fileNames, function (sourceFile) { - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); - sourcePathComponents.pop(); - if (!commonPathComponents) { - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { - if (i === 0) { - return true; + }); + filesByName.set(path, file); + if (file) { + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); + file.path = path; + if (host.useCaseSensitiveFileNames()) { + var existingFile = filesByNameIgnoreCase.get(path); + if (existingFile) { + reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); + } + else { + filesByNameIgnoreCase.set(path, file); } - commonPathComponents.length = i; - break; + } + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; + if (!options.noResolve) { + processReferencedFiles(file, isDefaultLib); + processTypeReferenceDirectives(file); + } + processImportedModules(file); + if (isDefaultLib) { + files.unshift(file); + } + else { + files.push(file); } } - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - if (failed) { - return ""; + return file; } - if (!commonPathComponents) { - return currentDirectory; + function processReferencedFiles(file, isDefaultLib) { + ts.forEach(file.referencedFiles, function (ref) { + var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); + processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end); + }); } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); - } - ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; - function createCompilerHost(options, setParentNodes) { - var existingDirectories = ts.createMap(); - function getCanonicalFileName(fileName) { - return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (ref) { return ref.fileName.toLocaleLowerCase(); }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + var fileName = ref.fileName.toLocaleLowerCase(); + ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } } - var unsupportedFileEncodingErrorCode = -2147024809; - function getSourceFile(fileName, languageVersion, onError) { - var text; - try { - ts.performance.mark("beforeIORead"); - text = ts.sys.readFile(fileName, options.charset); - ts.performance.mark("afterIORead"); - ts.performance.measure("I/O Read", "beforeIORead", "afterIORead"); + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); + if (previousResolution && previousResolution.primary) { + return; } - catch (e) { - if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd); + } + else { + if (previousResolution) { + if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + } + saveResolution = false; + } + else { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd); + } } - text = ""; } - return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; - } - function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { - return true; + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } - if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; - return true; + if (saveResolution) { + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } - return false; } - function ensureDirectoriesExist(directoryPath) { - if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { - var parentDirectory = ts.getDirectoryPath(directoryPath); - ensureDirectoriesExist(parentDirectory); - ts.sys.createDirectory(directoryPath); + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; } - } - var outputFingerprints; - function writeFileIfUpdated(fileName, data, writeByteOrderMark) { - if (!outputFingerprints) { - outputFingerprints = ts.createMap(); + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); } - var hash = ts.sys.createHash(data); - var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; - if (fingerprint.byteOrderMark === writeByteOrderMark && - fingerprint.hash === hash && - fingerprint.mtime.getTime() === mtimeBefore.getTime()) { - return; - } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); } - ts.sys.writeFile(fileName, data, writeByteOrderMark); - var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { - hash: hash, - byteOrderMark: writeByteOrderMark, - mtime: mtimeAfter - }; } - function writeFile(fileName, data, writeByteOrderMark, onError) { - try { - ts.performance.mark("beforeIOWrite"); - ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { - writeFileIfUpdated(fileName, data, writeByteOrderMark); - } - else { - ts.sys.writeFile(fileName, data, writeByteOrderMark); + function getCanonicalFileName(fileName) { + return host.getCanonicalFileName(fileName); + } + function processImportedModules(file) { + collectExternalModuleReferences(file); + if (file.imports.length || file.moduleAugmentations.length) { + file.resolvedModules = ts.createMap(); + var nonGlobalAugmentation = ts.filter(file.moduleAugmentations, function (moduleAugmentation) { return moduleAugmentation.kind === 9; }); + var moduleNames = ts.map(ts.concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral); + var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file); + ts.Debug.assert(resolutions.length === moduleNames.length); + for (var i = 0; i < moduleNames.length; i++) { + var resolution = resolutions[i]; + ts.setResolvedModule(file, moduleNames[i], resolution); + if (!resolution) { + continue; + } + var isFromNodeModulesSearch = resolution.isExternalLibraryImport; + var isJsFileFromNodeModules = isFromNodeModulesSearch && !ts.extensionIsTypeScript(resolution.extension); + var resolvedFileName = resolution.resolvedFileName; + if (isFromNodeModulesSearch) { + currentNodeModulesDepth++; + } + var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; + var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; + if (elideImport) { + modulesWithElidedImports.set(file.path, true); + } + else if (shouldAddFile) { + var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); + var pos = ts.skipTrivia(file.text, file.imports[i].pos); + findSourceFile(resolvedFileName, path, false, file, pos, file.imports[i].end); + } + if (isFromNodeModulesSearch) { + currentNodeModulesDepth--; + } } - ts.performance.mark("afterIOWrite"); - ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite"); } - catch (e) { - if (onError) { - onError(e.message); - } + else { + file.resolvedModules = undefined; } } - function getDefaultLibLocation() { - return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); - } - var newLine = ts.getNewLineCharacter(options); - var realpath = ts.sys.realpath && (function (path) { return ts.sys.realpath(path); }); - return { - getSourceFile: getSourceFile, - getDefaultLibLocation: getDefaultLibLocation, - getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, - writeFile: writeFile, - getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, - getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return newLine; }, - fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, - readFile: function (fileName) { return ts.sys.readFile(fileName); }, - trace: function (s) { return ts.sys.write(s + newLine); }, - directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, - getEnvironmentVariable: function (name) { return ts.sys.getEnvironmentVariable ? ts.sys.getEnvironmentVariable(name) : ""; }, - getDirectories: function (path) { return ts.sys.getDirectories(path); }, - realpath: realpath - }; - } - ts.createCompilerHost = createCompilerHost; - function getPreEmitDiagnostics(program, sourceFile, cancellationToken) { - var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); - if (program.getCompilerOptions().declaration) { - diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); - } - return ts.sortAndDeduplicateDiagnostics(diagnostics); - } - ts.getPreEmitDiagnostics = getPreEmitDiagnostics; - function formatDiagnostics(diagnostics, host) { - var output = ""; - for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { - var diagnostic = diagnostics_1[_i]; - if (diagnostic.file) { - var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character; - var fileName = diagnostic.file.fileName; - var relativeFileName = ts.convertToRelativePath(fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }); - output += relativeFileName + "(" + (line + 1) + "," + (character + 1) + "): "; + function computeCommonSourceDirectory(sourceFiles) { + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); + } } - var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); - output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) + host.getNewLine(); - } - return output; - } - ts.formatDiagnostics = formatDiagnostics; - function flattenDiagnosticMessageText(messageText, newLine) { - if (typeof messageText === "string") { - return messageText; + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } - else { - var diagnosticChain = messageText; - var result = ""; - var indent = 0; - while (diagnosticChain) { - if (indent) { - result += newLine; - for (var i = 0; i < indent; i++) { - result += " "; + function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { + var allFilesBelongToPath = true; + if (sourceFiles) { + var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; + if (!ts.isDeclarationFile(sourceFile)) { + var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); + if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); + allFilesBelongToPath = false; + } } } - result += diagnosticChain.messageText; - indent++; - diagnosticChain = diagnosticChain.next; } - return result; - } - } - ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; - function loadWithLocalCache(names, containingFile, loader) { - if (names.length === 0) { - return []; - } - var resolutions = []; - var cache = ts.createMap(); - for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_43 = names_1[_i]; - var result = name_43 in cache - ? cache[name_43] - : cache[name_43] = loader(name_43, containingFile); - resolutions.push(result); + return allFilesBelongToPath; } - return resolutions; - } - function createProgram(rootNames, options, host, oldProgram) { - var program; - var files = []; - var commonSourceDirectory; - var diagnosticsProducingTypeChecker; - var noDiagnosticsTypeChecker; - var classifiableNames; - var resolvedTypeReferenceDirectives = ts.createMap(); - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; - var currentNodeModulesDepth = 0; - var modulesWithElidedImports = ts.createMap(); - var sourceFilesFoundSearchingNodeModules = ts.createMap(); - ts.performance.mark("beforeProgram"); - host = host || createCompilerHost(options); - var skipDefaultLib = options.noLib; - var programDiagnostics = ts.createDiagnosticCollection(); - var currentDirectory = host.getCurrentDirectory(); - var supportedExtensions = ts.getSupportedExtensions(options); - var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); - var resolveModuleNamesWorker; - if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { - if (!resolved || resolved.extension !== undefined) { - return resolved; + function verifyCompilerOptions() { + if (options.isolatedModules) { + if (options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } - var withExtension = ts.clone(resolved); - withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName); - return withExtension; - }); }; - } - else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; - resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; - } - var resolveTypeReferenceDirectiveNamesWorker; - if (host.resolveTypeReferenceDirectives) { - resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; - } - else { - var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; - resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; - } - var filesByName = ts.createFileMap(); - var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (!tryReuseStructureFromOldProgram()) { - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); - var typeReferences = ts.getAutomaticTypeDirectiveNames(options, host); - if (typeReferences.length) { - var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); - var containingFilename = ts.combinePaths(containingDirectory, "__inferred type names__.ts"); - var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename); - for (var i = 0; i < typeReferences.length; i++) { - processTypeReferenceDirective(typeReferences[i], resolutions[i]); + if (options.noEmitOnError) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } - } - if (!skipDefaultLib) { - if (!options.lib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (options.out) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); } - else { - var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); - ts.forEach(options.lib, function (libFileName) { - processRootFile(ts.combinePaths(libDirectory_1, libFileName), true); - }); + if (options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } - } - oldProgram = undefined; - program = { - getRootFileNames: function () { return rootNames; }, - getSourceFile: getSourceFile, - getSourceFileByPath: getSourceFileByPath, - getSourceFiles: function () { return files; }, - getCompilerOptions: function () { return options; }, - getSyntacticDiagnostics: getSyntacticDiagnostics, - getOptionsDiagnostics: getOptionsDiagnostics, - getGlobalDiagnostics: getGlobalDiagnostics, - getSemanticDiagnostics: getSemanticDiagnostics, - getDeclarationDiagnostics: getDeclarationDiagnostics, - getTypeChecker: getTypeChecker, - getClassifiableNames: getClassifiableNames, - getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: getCommonSourceDirectory, - emit: emit, - getCurrentDirectory: function () { return currentDirectory; }, - getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, - getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, - getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, - getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; }, - isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, - dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker - }; - verifyCompilerOptions(); - ts.performance.mark("afterProgram"); - ts.performance.measure("Program", "beforeProgram", "afterProgram"); - return program; - function getCommonSourceDirectory() { - if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); - if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { - commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); - } - else { - commonSourceDirectory = computeCommonSourceDirectory(emittedFiles); - } - if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { - commonSourceDirectory += ts.directorySeparator; + if (options.inlineSourceMap) { + if (options.sourceMap) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } - } - return commonSourceDirectory; - } - function getClassifiableNames() { - if (!classifiableNames) { - getTypeChecker(); - classifiableNames = ts.createMap(); - for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { - var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + if (options.mapRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } } - return classifiableNames; - } - function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) { - if (!oldProgramState && !file.ambientModuleNames.length) { - return resolveModuleNamesWorker(moduleNames, containingFile); + if (options.paths && options.baseUrl === undefined) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); } - var unknownModuleNames; - var result; - var predictedToResolveToAmbientModuleMarker = {}; - for (var i = 0; i < moduleNames.length; i++) { - var moduleName = moduleNames[i]; - var isKnownToResolveToAmbientModule = false; - if (ts.contains(file.ambientModuleNames, moduleName)) { - isKnownToResolveToAmbientModule = true; - if (ts.isTraceEnabled(options, host)) { - ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile); + if (options.paths) { + for (var key in options.paths) { + if (!ts.hasProperty(options.paths, key)) { + continue; } - } - else { - isKnownToResolveToAmbientModule = checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState); - } - if (isKnownToResolveToAmbientModule) { - if (!unknownModuleNames) { - result = new Array(moduleNames.length); - unknownModuleNames = moduleNames.slice(0, i); + if (!ts.hasZeroOrOneAsteriskCharacter(key)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + } + if (ts.isArray(options.paths[key])) { + if (options.paths[key].length === 0) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key)); + } + for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { + var subst = _a[_i]; + var typeOfSubst = typeof subst; + if (typeOfSubst === "string") { + if (!ts.hasZeroOrOneAsteriskCharacter(subst)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + } + } + } + else { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key)); } - result[i] = predictedToResolveToAmbientModuleMarker; } - else if (unknownModuleNames) { - unknownModuleNames.push(moduleName); + } + if (!options.sourceMap && !options.inlineSourceMap) { + if (options.inlineSources) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources")); + } + if (options.sourceRoot) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot")); } } - if (!unknownModuleNames) { - return resolveModuleNamesWorker(moduleNames, containingFile); + if (options.out && options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); } - var resolutions = unknownModuleNames.length - ? resolveModuleNamesWorker(unknownModuleNames, containingFile) - : emptyArray; - var j = 0; - for (var i = 0; i < result.length; i++) { - if (result[i] == predictedToResolveToAmbientModuleMarker) { - result[i] = undefined; + if (options.mapRoot && !options.sourceMap) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); } - else { - result[i] = resolutions[j]; - j++; + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); } } - ts.Debug.assert(j === resolutions.length); - return result; - function checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) { - if (!oldProgramState) { - return false; - } - var resolutionToFile = ts.getResolvedModule(oldProgramState.file, moduleName); - if (resolutionToFile) { - return false; + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + } + if (options.noImplicitUseStrict && (options.alwaysStrict === undefined ? options.strict : options.alwaysStrict)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); + } + var languageVersion = options.target || 0; + var outFile = options.outFile || options.out; + var firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (options.isolatedModules) { + if (options.module === ts.ModuleKind.None && languageVersion < 2) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); } - var ambientModule = oldProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName); - if (!(ambientModule && ambientModule.declarations)) { - return false; + var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); + if (firstNonExternalModuleSourceFile) { + var span_7 = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span_7.start, span_7.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } - var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) { - var f = ts.getSourceFileOfNode(d); - return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f; - }); - if (!firstUnmodifiedFile) { - return false; + } + else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { + var span_8 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); + programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_8.start, span_8.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none)); + } + if (outFile) { + if (options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } - if (ts.isTraceEnabled(options, host)) { - ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName); + else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) { + var span_9 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); + programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_9.start, span_9.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile")); } - return true; } - } - function tryReuseStructureFromOldProgram() { - if (!oldProgram) { - return false; + if (options.outDir || + options.sourceRoot || + options.mapRoot) { + var dir = getCommonSourceDirectory(); + if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + } } - var oldOptions = oldProgram.getCompilerOptions(); - if (ts.changesAffectModuleResolution(oldOptions, options)) { - return false; + if (!options.noEmit && options.allowJs && options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } - ts.Debug.assert(!oldProgram.structureIsReused); - var oldRootNames = oldProgram.getRootFileNames(); - if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { - return false; + if (options.checkJs && !options.allowJs) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")); } - if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { - return false; + if (options.emitDecoratorMetadata && + !options.experimentalDecorators) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } - var newSourceFiles = []; - var filePaths = []; - var modifiedSourceFiles = []; - for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { - var oldSourceFile = _a[_i]; - var newSourceFile = host.getSourceFileByPath - ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) - : host.getSourceFile(oldSourceFile.fileName, options.target); - if (!newSourceFile) { - return false; - } - newSourceFile.path = oldSourceFile.path; - filePaths.push(newSourceFile.path); - if (oldSourceFile !== newSourceFile) { - if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { - return false; - } - if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { - return false; - } - collectExternalModuleReferences(newSourceFile); - if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { - return false; - } - if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { - return false; - } - if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { - return false; - } - modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); + if (options.jsxFactory) { + if (options.reactNamespace) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory")); } - else { - newSourceFile = oldSourceFile; + if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory)); } - newSourceFiles.push(newSourceFile); } - var modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; }); - for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { - var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile; - var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); - if (resolveModuleNamesWorker) { - var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); - var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, { file: oldSourceFile, program: oldProgram, modifiedFilePaths: modifiedFilePaths }); - var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); - if (resolutionsChanged) { - return false; + else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + } + if (!options.noEmit && !options.suppressOutputPathCheck) { + var emitHost = getEmitHost(); + var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + ts.forEachEmittedFile(emitHost, function (emitFileNames) { + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); + }); + } + function verifyEmitFilePath(emitFileName, emitFilesSeen) { + if (emitFileName) { + var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); + if (filesByName.contains(emitFilePath)) { + var chain_1; + if (!options.configFilePath) { + chain_1 = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig); + } + chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName); + blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1)); } - } - if (resolveTypeReferenceDirectiveNamesWorker) { - var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); - var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); - var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); - if (resolutionsChanged) { - return false; + if (emitFilesSeen.contains(emitFilePath)) { + blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName)); + } + else { + emitFilesSeen.set(emitFilePath, true); } } - newSourceFile.resolvedModules = oldSourceFile.resolvedModules; - newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; - } - for (var i = 0, len = newSourceFiles.length; i < len; i++) { - filesByName.set(filePaths[i], newSourceFiles[i]); - } - files = newSourceFiles; - fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) { - var modifiedFile = modifiedSourceFiles_2[_d]; - fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile); } - resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); - oldProgram.structureIsReused = true; - return true; - } - function getEmitHost(writeFileCallback) { - return { - getCanonicalFileName: getCanonicalFileName, - getCommonSourceDirectory: program.getCommonSourceDirectory, - getCompilerOptions: program.getCompilerOptions, - getCurrentDirectory: function () { return currentDirectory; }, - getNewLine: function () { return host.getNewLine(); }, - getSourceFile: program.getSourceFile, - getSourceFileByPath: program.getSourceFileByPath, - getSourceFiles: program.getSourceFiles, - isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), - isEmitBlocked: isEmitBlocked, - }; - } - function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; } - function getDiagnosticsProducingTypeChecker() { - return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); + function blockEmittingOfFile(emitFileName, diag) { + hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); + programDiagnostics.add(diag); } - function dropDiagnosticsProducingTypeChecker() { - diagnosticsProducingTypeChecker = undefined; + } + ts.createProgram = createProgram; + function getResolutionDiagnostic(options, _a) { + var extension = _a.extension; + switch (extension) { + case ts.Extension.Ts: + case ts.Extension.Dts: + return undefined; + case ts.Extension.Tsx: + return needJsx(); + case ts.Extension.Jsx: + return needJsx() || needAllowJs(); + case ts.Extension.Js: + return needAllowJs(); } - function getTypeChecker() { - return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); + function needJsx() { + return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set; } - function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { - return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); }); + function needAllowJs() { + return options.allowJs ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_allowJs_is_not_set; } - function isEmitBlocked(emitFileName) { - return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + } + ts.getResolutionDiagnostic = getResolutionDiagnostic; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; + ts.optionDeclarations = [ + { + name: "help", + shortName: "h", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_this_message, + }, + { + name: "help", + shortName: "?", + type: "boolean" + }, + { + name: "all", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Show_all_compiler_options, + }, + { + name: "version", + shortName: "v", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_the_compiler_s_version, + }, + { + name: "init", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, + }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY, + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + }, + { + name: "pretty", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental + }, + { + name: "watch", + shortName: "w", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Watch_input_files, + }, + { + name: "target", + shortName: "t", + type: ts.createMapFromTemplate({ + "es3": 0, + "es5": 1, + "es6": 2, + "es2015": 2, + "es2016": 3, + "es2017": 4, + "esnext": 5, + }), + paramType: ts.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, + }, + { + name: "module", + shortName: "m", + type: ts.createMapFromTemplate({ + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES2015, + "es2015": ts.ModuleKind.ES2015, + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: ts.createMapFromTemplate({ + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", + "dom": "lib.dom.d.ts", + "dom.iterable": "lib.dom.iterable.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts", + "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", + "es2017.string": "lib.es2017.string.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", + }), + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "allowJs", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "checkJs", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Report_errors_in_js_files + }, + { + name: "jsx", + type: ts.createMapFromTemplate({ + "preserve": 1, + "react-native": 3, + "react": 2 + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_d_ts_file, + }, + { + name: "sourceMap", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_map_file, + }, + { + name: "outFile", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + }, + { + name: "outDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + }, + { + name: "rootDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + }, + { + name: "removeComments", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_comments_to_output, + }, + { + name: "noEmit", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_outputs, + }, + { + name: "importHelpers", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Import_emit_helpers_from_tslib + }, + { + name: "downlevelIteration", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 + }, + { + name: "isolatedModules", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule + }, + { + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_all_strict_type_checking_options + }, + { + name: "noImplicitAny", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, + }, + { + name: "strictNullChecks", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_strict_null_checks + }, + { + name: "noImplicitThis", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, + { + name: "alwaysStrict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + }, + { + name: "noUnusedLocals", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_locals, + }, + { + name: "noUnusedParameters", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_parameters, + }, + { + name: "noImplicitReturns", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "moduleResolution", + type: ts.createMapFromTemplate({ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic, + }), + paramType: ts.Diagnostics.STRATEGY, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + name: "paths", + type: "object", + isTSConfigOnly: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl + }, + { + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime + }, + { + name: "typeRoots", + type: "list", + element: { + name: "typeRoots", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + }, + { + name: "inlineSources", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + }, + { + name: "experimentalDecorators", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + { + name: "jsxFactory", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_verbose_diagnostic_information + }, + { + name: "traceResolution", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "listFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation + }, + { + name: "listEmittedFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation + }, + { + name: "out", + type: "string", + isFilePath: false, + category: ts.Diagnostics.Advanced_Options, + paramType: ts.Diagnostics.FILE, + description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + }, + { + name: "charset", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_character_set_of_the_input_files + }, + { + name: "emitBOM", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + }, + { + name: "locale", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: ts.createMapFromTemplate({ + "crlf": 0, + "lf": 1 + }), + paramType: ts.Diagnostics.NEWLINE, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + }, + { + name: "disableSizeLimit", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects + }, + { + name: "noImplicitUseStrict", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "noEmitHelpers", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + }, + { + name: "noEmitOnError", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, + }, + { + name: "preserveConstEnums", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, + }, + { + name: "allowUnusedLabels", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "allowUnreachableCode", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + }, + { + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts.Diagnostics.List_of_language_service_plugins } - function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { - var declarationDiagnostics = []; - if (options.noEmit) { - return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; - } - if (options.noEmitOnError) { - var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); - if (diagnostics.length === 0 && program.getCompilerOptions().declaration) { - declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken); - } - if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { - return { - diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), - sourceMaps: undefined, - emittedFiles: undefined, - emitSkipped: true - }; - } + ]; + ts.typeAcquisitionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean", + }, + { + name: "enable", + type: "boolean", + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" } - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); - ts.performance.mark("beforeEmit"); - var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles); - ts.performance.mark("afterEmit"); - ts.performance.measure("Emit", "beforeEmit", "afterEmit"); - return emitResult; - } - function getSourceFile(fileName) { - return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); - } - function getSourceFileByPath(path) { - return filesByName.get(path); - } - function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { - if (sourceFile) { - return getDiagnostics(sourceFile, cancellationToken); + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" } - var allDiagnostics = []; - ts.forEach(program.getSourceFiles(), function (sourceFile) { - if (cancellationToken) { - cancellationToken.throwIfCancellationRequested(); - } - ts.addRange(allDiagnostics, getDiagnostics(sourceFile, cancellationToken)); - }); - return ts.sortAndDeduplicateDiagnostics(allDiagnostics); - } - function getSyntacticDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken); } - function getSemanticDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); + ]; + ts.defaultInitCompilerOptions = { + module: ts.ModuleKind.CommonJS, + target: 1, + strict: true + }; + var optionNameMapCache; + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; } - function getDeclarationDiagnostics(sourceFile, cancellationToken) { - var options = program.getCompilerOptions(); - if (!sourceFile || options.out || options.outFile) { - return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); - } - else { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); - } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; + function getOptionNameMap() { + if (optionNameMapCache) { + return optionNameMapCache; } - function getSyntacticDiagnosticsForFile(sourceFile) { - if (ts.isSourceFileJavaScript(sourceFile)) { - if (!sourceFile.additionalSyntacticDiagnostics) { - sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile); - } - return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics); + var optionNameMap = ts.createMap(); + var shortOptionNames = ts.createMap(); + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap.set(option.name.toLowerCase(), option); + if (option.shortName) { + shortOptionNames.set(option.shortName, option.name); } - return sourceFile.parseDiagnostics; + }); + optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; + return optionNameMapCache; + } + ts.getOptionNameMap = getOptionNameMap; + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function parseCustomTypeOption(opt, value, errors) { + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); + } + ts.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors) { + if (value === void 0) { value = ""; } + value = trimString(value); + if (ts.startsWith(value, "-")) { + return undefined; } - function runWithCancellationToken(func) { - try { - return func(); - } - catch (e) { - if (e instanceof ts.OperationCanceledException) { - noDiagnosticsTypeChecker = undefined; - diagnosticsProducingTypeChecker = undefined; - } - throw e; - } + if (value === "") { + return []; } - function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { - return runWithCancellationToken(function () { - var typeChecker = getDiagnosticsProducingTypeChecker(); - ts.Debug.assert(!!sourceFile.bindDiagnostics); - var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken); - var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); - var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); - }); + var values = value.split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); } - function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { - return runWithCancellationToken(function () { - var diagnostics = []; - var parent = sourceFile; - walk(sourceFile); - return diagnostics; - function walk(node) { - switch (parent.kind) { - case 144: - case 147: - if (parent.questionToken === node) { - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); - return; - } - case 149: - case 148: - case 150: - case 151: - case 152: - case 184: - case 225: - case 185: - case 225: - case 223: - if (parent.type === node) { - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return; - } - } - switch (node.kind) { - case 234: - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); - return; - case 240: - if (node.isExportEquals) { - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); - return; - } - break; - case 255: - var heritageClause = node; - if (heritageClause.token === 107) { - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); - return; - } - break; - case 227: - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); - return; - case 230: - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); - return; - case 228: - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); - return; - case 229: - diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); - return; - case 182: - var typeAssertionExpression = node; - diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); - return; - } - var prevParent = parent; - parent = node; - ts.forEachChild(node, walk, walkArray); - parent = prevParent; - } - function walkArray(nodes) { - if (parent.decorators === nodes && !options.experimentalDecorators) { - diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); - } - switch (parent.kind) { - case 226: - case 149: - case 148: - case 150: - case 151: - case 152: - case 184: - case 225: - case 185: - case 225: - if (nodes === parent.typeParameters) { - diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); - return; - } - case 205: - if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205); - } - break; - case 147: - if (nodes === parent.modifiers) { - for (var _i = 0, _a = nodes; _i < _a.length; _i++) { - var modifier = _a[_i]; - if (modifier.kind !== 114) { - diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); - } - } - return; - } - break; - case 144: - if (nodes === parent.modifiers) { - diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); - return; - } - break; - case 179: - case 180: - case 199: - if (nodes === parent.typeArguments) { - diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); - return; - } - break; - } - for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { - var node = nodes_6[_b]; - walk(node); - } + } + ts.parseListTypeOption = parseListTypeOption; + function parseCommandLine(commandLine, readFile) { + var options = {}; + var fileNames = []; + var errors = []; + var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames; + parseStrings(commandLine); + return { + options: options, + fileNames: fileNames, + errors: errors + }; + function parseStrings(args) { + var i = 0; + while (i < args.length) { + var s = args[i]; + i++; + if (s.charCodeAt(0) === 64) { + parseResponseFile(s.slice(1)); } - function checkModifiers(modifiers, isConstValid) { - for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { - var modifier = modifiers_1[_i]; - switch (modifier.kind) { - case 75: - if (isConstValid) { - continue; - } - case 113: - case 111: - case 112: - case 130: - case 123: - case 116: - diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); - break; - case 114: - case 83: - case 78: - } + else if (s.charCodeAt(0) === 45) { + s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - } - function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) { - var start = nodes.pos; - return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2); - } - function createDiagnosticForNode(node, message, arg0, arg1, arg2) { - return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); - } - }); - } - function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { - return runWithCancellationToken(function () { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile); - }); - } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { - return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); - } - function getOptionsDiagnostics() { - var allDiagnostics = []; - ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); - ts.addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); - return ts.sortAndDeduplicateDiagnostics(allDiagnostics); - } - function getGlobalDiagnostics() { - var allDiagnostics = []; - ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics()); - return ts.sortAndDeduplicateDiagnostics(allDiagnostics); - } - function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); - } - function fileReferenceIsEqualTo(a, b) { - return a.fileName === b.fileName; - } - function moduleNameIsEqualTo(a, b) { - return a.text === b.text; - } - function getTextOfLiteral(literal) { - return literal.text; - } - function collectExternalModuleReferences(file) { - if (file.imports) { - return; - } - var isJavaScriptFile = ts.isSourceFileJavaScript(file); - var isExternalModuleFile = ts.isExternalModule(file); - var isDtsFile = ts.isDeclarationFile(file); - var imports; - var moduleAugmentations; - var ambientModules; - if (options.importHelpers - && (options.isolatedModules || isExternalModuleFile) - && !file.isDeclarationFile) { - var externalHelpersModuleReference = ts.createSynthesizedNode(9); - externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235); - importDecl.parent = file; - externalHelpersModuleReference.parent = importDecl; - imports = [externalHelpersModuleReference]; - } - for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { - var node = _a[_i]; - collectModuleReferences(node, false); - if (isJavaScriptFile) { - collectRequireCalls(node); - } - } - file.imports = imports || emptyArray; - file.moduleAugmentations = moduleAugmentations || emptyArray; - file.ambientModuleNames = ambientModules || emptyArray; - return; - function collectModuleReferences(node, inAmbientModule) { - switch (node.kind) { - case 235: - case 234: - case 241: - var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9) { - break; - } - if (!moduleNameExpr.text) { - break; - } - if (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { - (imports || (imports = [])).push(moduleNameExpr); - } - break; - case 230: - if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { - var moduleName = node.name; - if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { - (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); + var opt = optionNameMap.get(s); + if (opt) { + if (opt.isTSConfigOnly) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); + } + else { + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); } - else if (!inAmbientModule) { - if (isDtsFile) { - (ambientModules || (ambientModules = [])).push(moduleName.text); - } - var body = node.body; - if (body) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { - var statement = _a[_i]; - collectModuleReferences(statement, true); + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + var optValue = args[i]; + options[opt.name] = optValue !== "false"; + if (optValue === "false" || optValue === "true") { + i++; } - } + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + var result = parseListTypeOption(opt, args[i], errors); + options[opt.name] = result || []; + if (result) { + i++; + } + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; } } - } - } - function collectRequireCalls(node) { - if (ts.isRequireCall(node, true)) { - (imports || (imports = [])).push(node.arguments[0]); + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); + } } else { - ts.forEachChild(node, collectRequireCalls); + fileNames.push(s); } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var diagnosticArgument; - var diagnostic; - if (ts.hasExtension(fileName)) { - if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { - diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; - diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; - } - else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { - diagnostic = ts.Diagnostics.File_0_not_found; - diagnosticArgument = [fileName]; - } - else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { - diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; - diagnosticArgument = [fileName]; - } + function parseResponseFile(fileName) { + var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); + if (!text) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); + return; } - else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); - if (!nonTsFile) { - if (options.allowNonTsExtensions) { - diagnostic = ts.Diagnostics.File_0_not_found; - diagnosticArgument = [fileName]; + var args = []; + var pos = 0; + while (true) { + while (pos < text.length && text.charCodeAt(pos) <= 32) + pos++; + if (pos >= text.length) + break; + var start = pos; + if (text.charCodeAt(start) === 34) { + pos++; + while (pos < text.length && text.charCodeAt(pos) !== 34) + pos++; + if (pos < text.length) { + args.push(text.substring(start + 1, pos)); + pos++; } - else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { - diagnostic = ts.Diagnostics.File_0_not_found; - fileName += ".ts"; - diagnosticArgument = [fileName]; + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); } } - } - if (diagnostic) { - if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); - } else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); + while (text.charCodeAt(pos) > 32) + pos++; + args.push(text.substring(start, pos)); } } + parseStrings(args); } - function reportFileNamesDifferOnlyInCasingError(fileName, existingFileName, refFile, refPos, refEnd) { - if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); + } + ts.parseCommandLine = parseCommandLine; + function readConfigFile(fileName, readFile) { + var text = ""; + try { + text = readFile(fileName); + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; + } + return parseConfigFileTextToJson(fileName, text); + } + ts.readConfigFile = readConfigFile; + function parseConfigFileTextToJson(fileName, jsonText, stripComments) { + if (stripComments === void 0) { stripComments = true; } + try { + var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText; + return { config: /\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} }; + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; + } + } + ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + function generateTSConfig(options, fileNames, newLine) { + var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); + var configurations = { + compilerOptions: serializeCompilerOptions(compilerOptions) + }; + if (fileNames && fileNames.length) { + configurations.files = fileNames; + } + return writeConfigurations(); + function getCustomTypeMapOfCommandLineOption(optionDefinition) { + if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { + return undefined; + } + else if (optionDefinition.type === "list") { + return getCustomTypeMapOfCommandLineOption(optionDefinition.element); } else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); + return optionDefinition.type; } } - function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { - if (filesByName.contains(path)) { - var file_1 = filesByName.get(path); - if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { - reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); + function getNameOfCompilerOptionValue(value, customTypeMap) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { + return key; } - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; - if (!options.noResolve) { - processReferencedFiles(file_1, isDefaultLib); - processTypeReferenceDirectives(file_1); + }); + } + function serializeCompilerOptions(options) { + var result = {}; + var optionsNameMap = getOptionNameMap().optionNameMap; + for (var name in options) { + if (ts.hasProperty(options, name)) { + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { + continue; } - modulesWithElidedImports[file_1.path] = false; - processImportedModules(file_1); - } - else if (file_1 && modulesWithElidedImports[file_1.path]) { - if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; - processImportedModules(file_1); + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap) { + result[name] = value; + } + else { + if (optionDefinition.type === "list") { + var convertedValue = []; + for (var _i = 0, _a = value; _i < _a.length; _i++) { + var element = _a[_i]; + convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); + } + result[name] = convertedValue; + } + else { + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); + } + } } } - return file_1; } - var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - }); - filesByName.set(path, file); - if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); - file.path = path; - if (host.useCaseSensitiveFileNames()) { - var existingFile = filesByNameIgnoreCase.get(path); - if (existingFile) { - reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); + return result; + } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return ts.arrayFrom(option.type.keys())[0]; + } + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function writeConfigurations() { + var categorizedOptions = ts.reduceLeft(ts.filter(ts.optionDeclarations, function (o) { return o.category !== ts.Diagnostics.Command_line_Options && o.category !== ts.Diagnostics.Advanced_Options; }), function (memo, value) { + if (value.category) { + var name = ts.getLocaleSpecificMessage(value.category); + (memo[name] || (memo[name] = [])).push(value); + } + return memo; + }, {}); + var marginLength = 0; + var seenKnownKeys = 0; + var nameColumn = []; + var descriptionColumn = []; + var knownKeysCount = ts.getOwnKeys(configurations.compilerOptions).length; + for (var category in categorizedOptions) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push("/* " + category + " */"); + descriptionColumn.push(""); + for (var _i = 0, _a = categorizedOptions[category]; _i < _a.length; _i++) { + var option = _a[_i]; + var optionName = void 0; + if (ts.hasProperty(configurations.compilerOptions, option.name)) { + optionName = "\"" + option.name + "\": " + JSON.stringify(configurations.compilerOptions[option.name]) + ((seenKnownKeys += 1) === knownKeysCount ? "" : ","); } else { - filesByNameIgnoreCase.set(path, file); + optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; } + nameColumn.push(optionName); + descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); + marginLength = Math.max(optionName.length, marginLength); } - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; - if (!options.noResolve) { - processReferencedFiles(file, isDefaultLib); - processTypeReferenceDirectives(file); - } - processImportedModules(file); - if (isDefaultLib) { - files.unshift(file); - } - else { - files.push(file); - } - } - return file; - } - function processReferencedFiles(file, isDefaultLib) { - ts.forEach(file.referencedFiles, function (ref) { - var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end); - }); - } - function processTypeReferenceDirectives(file) { - var typeDirectives = ts.map(file.typeReferenceDirectives, function (ref) { return ref.fileName.toLocaleLowerCase(); }); - var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); - for (var i = 0; i < typeDirectives.length; i++) { - var ref = file.typeReferenceDirectives[i]; - var resolvedTypeReferenceDirective = resolutions[i]; - var fileName = ref.fileName.toLocaleLowerCase(); - ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective); - processTypeReferenceDirective(fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); } - } - function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; - if (previousResolution && previousResolution.primary) { - return; + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push(tab + "\"compilerOptions\": {"); + for (var i = 0; i < nameColumn.length; i++) { + var optionName = nameColumn[i]; + var description = descriptionColumn[i]; + result.push(tab + tab + optionName + makePadding(marginLength - optionName.length + 2) + description); } - var saveResolution = true; - if (resolvedTypeReferenceDirective) { - if (resolvedTypeReferenceDirective.primary) { - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd); - } - else { - if (previousResolution) { - if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) { - var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); - if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { - fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); - } - } - saveResolution = false; - } - else { - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd); - } + if (configurations.files && configurations.files.length) { + result.push(tab + "},"); + result.push(tab + "\"files\": ["); + for (var i = 0; i < configurations.files.length; i++) { + result.push("" + tab + tab + JSON.stringify(configurations.files[i]) + (i === configurations.files.length - 1 ? "" : ",")); } + result.push(tab + "]"); } else { - fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); - } - if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + result.push(tab + "}"); } + result.push("}"); + return result.join(newLine); } - function createDiagnostic(refFile, refPos, refEnd, message) { - var args = []; - for (var _i = 4; _i < arguments.length; _i++) { - args[_i - 4] = arguments[_i]; - } - if (refFile === undefined || refPos === undefined || refEnd === undefined) { - return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); - } - else { - return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + ts.generateTSConfig = generateTSConfig; + function removeComments(jsonText) { + var output = ""; + var scanner = ts.createScanner(1, false, 0, jsonText); + var token; + while ((token = scanner.scan()) !== 1) { + switch (token) { + case 2: + case 3: + output += scanner.getTokenText().replace(/\S/g, " "); + break; + default: + output += scanner.getTokenText(); + break; } } - function getCanonicalFileName(fileName) { - return host.getCanonicalFileName(fileName); + return output; + } + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { + if (existingOptions === void 0) { existingOptions = {}; } + if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } + var errors = []; + basePath = ts.normalizeSlashes(basePath); + var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); + if (resolutionStack.indexOf(resolvedPath) >= 0) { + return { + options: {}, + fileNames: [], + typeAcquisition: {}, + raw: json, + errors: [ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))], + wildcardDirectories: {} + }; } - function processImportedModules(file) { - collectExternalModuleReferences(file); - if (file.imports.length || file.moduleAugmentations.length) { - file.resolvedModules = ts.createMap(); - var nonGlobalAugmentation = ts.filter(file.moduleAugmentations, function (moduleAugmentation) { return moduleAugmentation.kind === 9; }); - var moduleNames = ts.map(ts.concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral); - var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file); - ts.Debug.assert(resolutions.length === moduleNames.length); - for (var i = 0; i < moduleNames.length; i++) { - var resolution = resolutions[i]; - ts.setResolvedModule(file, moduleNames[i], resolution); - if (!resolution) { - continue; - } - var isFromNodeModulesSearch = resolution.isExternalLibraryImport; - var isJsFileFromNodeModules = isFromNodeModulesSearch && !ts.extensionIsTypeScript(resolution.extension); - var resolvedFileName = resolution.resolvedFileName; - if (isFromNodeModulesSearch) { - currentNodeModulesDepth++; - } - var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; - var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; - if (elideImport) { - modulesWithElidedImports[file.path] = true; - } - else if (shouldAddFile) { - var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); - var pos = ts.skipTrivia(file.text, file.imports[i].pos); - findSourceFile(resolvedFileName, path, false, file, pos, file.imports[i].end); - } - if (isFromNodeModulesSearch) { - currentNodeModulesDepth--; - } - } + var options = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); + if (json["extends"]) { + var _a = [undefined, undefined, undefined, {}], include = _a[0], exclude = _a[1], files = _a[2], baseOptions = _a[3]; + if (typeof json["extends"] === "string") { + _b = (tryExtendsName(json["extends"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3]; } else { - file.resolvedModules = undefined; + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); } - } - function computeCommonSourceDirectory(sourceFiles) { - var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; - if (!file.isDeclarationFile) { - fileNames.push(file.fileName); - } + if (include && !json["include"]) { + json["include"] = include; } - return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); + if (exclude && !json["exclude"]) { + json["exclude"] = exclude; + } + if (files && !json["files"]) { + json["files"] = files; + } + options = ts.assign({}, baseOptions, options); } - function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { - var allFilesBelongToPath = true; - if (sourceFiles) { - var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; - if (!ts.isDeclarationFile(sourceFile)) { - var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); - if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir)); - allFilesBelongToPath = false; - } - } + options = ts.extend(existingOptions, options); + options.configFilePath = configFileName; + var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories; + var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); + return { + options: options, + fileNames: fileNames, + typeAcquisition: typeAcquisition, + raw: json, + errors: errors, + wildcardDirectories: wildcardDirectories, + compileOnSave: compileOnSave + }; + function tryExtendsName(extendedConfig) { + if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(ts.normalizeSlashes(extendedConfig), "./") || ts.startsWith(ts.normalizeSlashes(extendedConfig), "../"))) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); + return; + } + var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); + if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) { + extendedConfigPath = extendedConfigPath + ".json"; + if (!host.fileExists(extendedConfigPath)) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig)); + return; } } - return allFilesBelongToPath; + var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); }); + if (extendedResult.error) { + errors.push(extendedResult.error); + return; + } + var extendedDirname = ts.getDirectoryPath(extendedConfigPath); + var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName); + var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); }; + var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath])); + errors.push.apply(errors, result.errors); + var _a = ts.map(["include", "exclude", "files"], function (key) { + if (!json[key] && extendedResult.config[key]) { + return ts.map(extendedResult.config[key], updatePath); + } + }), include = _a[0], exclude = _a[1], files = _a[2]; + return [include, exclude, files, result.options]; } - function verifyCompilerOptions() { - if (options.isolatedModules) { - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + function getFileNames(errors) { + var fileNames; + if (ts.hasProperty(json, "files")) { + if (ts.isArray(json["files"])) { + fileNames = json["files"]; + if (fileNames.length === 0) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json")); + } } - if (options.noEmitOnError) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); } - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + } + var includeSpecs; + if (ts.hasProperty(json, "include")) { + if (ts.isArray(json["include"])) { + includeSpecs = json["include"]; } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array")); } } - if (options.inlineSourceMap) { - if (options.sourceMap) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + var excludeSpecs; + if (ts.hasProperty(json, "exclude")) { + if (ts.isArray(json["exclude"])) { + excludeSpecs = json["exclude"]; } - if (options.mapRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array")); } } - if (options.paths && options.baseUrl === undefined) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + else if (ts.hasProperty(json, "excludes")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } - if (options.paths) { - for (var key in options.paths) { - if (!ts.hasProperty(options.paths, key)) { - continue; - } - if (!ts.hasZeroOrOneAsteriskCharacter(key)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); - } - if (ts.isArray(options.paths[key])) { - if (options.paths[key].length === 0) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key)); - } - for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { - var subst = _a[_i]; - var typeOfSubst = typeof subst; - if (typeOfSubst === "string") { - if (!ts.hasZeroOrOneAsteriskCharacter(subst)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); - } - } - else { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); - } - } - } - else { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key)); - } + else { + excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; + var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; + if (outDir) { + excludeSpecs.push(outDir); } } - if (!options.sourceMap && !options.inlineSourceMap) { - if (options.inlineSources) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources")); - } - if (options.sourceRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot")); - } + if (fileNames === undefined && includeSpecs === undefined) { + includeSpecs = ["**/*"]; + } + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); + if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); + } + return result; + } + var _b; + } + ts.parseJsonConfigFileContent = parseJsonConfigFileContent; + function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) { + if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) { + return false; + } + var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors); + if (typeof result === "boolean" && result) { + return result; + } + return false; + } + ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson; + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } + : {}; + convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + var opt = optionNameMap.get(id); + if (opt) { + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } - if (options.out && options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); } - if (options.mapRoot && !options.sourceMap) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); } - if (options.declarationDir) { - if (!options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); - } - if (options.out || options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } } } - if (options.lib && options.noLib) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); - } - if (options.noImplicitUseStrict && options.alwaysStrict) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + var val = opt.type.get(key); + if (val !== undefined) { + return val; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } + function trimString(s) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); + } + var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/; + var invalidMultipleRecursionPatterns = /(^|\/)\*\*\/(.*\/)?\*\*($|\/)/; + var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; + var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; + var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { + basePath = ts.normalizePath(basePath); + var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; + var literalFileMap = ts.createMap(); + var wildcardFileMap = ts.createMap(); + if (include) { + include = validateSpecs(include, errors, false); + } + if (exclude) { + exclude = validateSpecs(exclude, errors, true); + } + var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); + if (fileNames) { + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_i]; + var file = ts.combinePaths(basePath, fileName); + literalFileMap.set(keyMapper(file), file); } - var languageVersion = options.target || 0; - var outFile = options.outFile || options.out; - var firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); - if (options.isolatedModules) { - if (options.module === ts.ModuleKind.None && languageVersion < 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); + } + if (include && include.length > 0) { + for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) { + var file = _b[_a]; + if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) { + continue; } - var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); - if (firstNonExternalModuleSourceFile) { - var span_7 = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span_7.start, span_7.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); + var key = keyMapper(file); + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } - else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { - var span_8 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_8.start, span_8.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none)); - } - if (outFile) { - if (options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); - } - else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) { - var span_9 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_9.start, span_9.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile")); - } + } + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); + return { + fileNames: literalFiles.concat(wildcardFiles), + wildcardDirectories: wildcardDirectories + }; + } + function validateSpecs(specs, errors, allowTrailingRecursion) { + var validSpecs = []; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; + if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } - if (options.outDir || - options.sourceRoot || - options.mapRoot) { - var dir = getCommonSourceDirectory(); - if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - } + else if (invalidMultipleRecursionPatterns.test(spec)) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec)); } - if (!options.noEmit && options.allowJs && options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); + else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } - if (options.emitDecoratorMetadata && - !options.experimentalDecorators) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + else { + validSpecs.push(spec); } - if (options.jsxFactory) { - if (options.reactNamespace) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory")); + } + return validSpecs; + } + function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { + var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); + var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); + var wildcardDirectories = {}; + if (include !== undefined) { + var recursiveKeys = []; + for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { + var file = include_1[_i]; + var spec = ts.normalizePath(ts.combinePaths(path, file)); + if (excludeRegex && excludeRegex.test(spec)) { + continue; } - if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory)); + var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); + if (match) { + var key = match.key, flags = match.flags; + var existingFlags = wildcardDirectories[key]; + if (existingFlags === undefined || existingFlags < flags) { + wildcardDirectories[key] = flags; + if (flags === 1) { + recursiveKeys.push(key); + } + } } } - else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); - } - if (!options.noEmit && !options.suppressOutputPathCheck) { - var emitHost = getEmitHost(); - var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { - verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); - verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); - }); - } - function verifyEmitFilePath(emitFileName, emitFilesSeen) { - if (emitFileName) { - var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); - if (filesByName.contains(emitFilePath)) { - var chain_1; - if (!options.configFilePath) { - chain_1 = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig); + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; } - chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName); - blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1)); - } - if (emitFilesSeen.contains(emitFilePath)) { - blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName)); - } - else { - emitFilesSeen.set(emitFilePath, true); } } - } - } - function blockEmittingOfFile(emitFileName, diag) { - hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); - programDiagnostics.add(diag); } + return wildcardDirectories; } - ts.createProgram = createProgram; - function getResolutionDiagnostic(options, _a) { - var extension = _a.extension; - switch (extension) { - case ts.Extension.Ts: - case ts.Extension.Dts: - return undefined; - case ts.Extension.Tsx: - return needJsx(); - case ts.Extension.Jsx: - return needJsx() || needAllowJs(); - case ts.Extension.Js: - return needAllowJs(); + function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { + var match = wildcardDirectoryPattern.exec(spec); + if (match) { + return { + key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(), + flags: watchRecursivePattern.test(spec) ? 1 : 0 + }; } - function needJsx() { - return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set; + if (ts.isImplicitGlob(spec)) { + return { key: spec, flags: 1 }; } - function needAllowJs() { - return options.allowJs ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_allowJs_is_not_set; + return undefined; + } + function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { + var extensionPriority = ts.getExtensionPriority(file, extensions); + var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); + for (var i = 0; i < adjustedExtensionPriority; i++) { + var higherPriorityExtension = extensions[i]; + var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { + return true; + } } + return false; + } + function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { + var extensionPriority = ts.getExtensionPriority(file, extensions); + var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); + for (var i = nextExtensionPriority; i < extensions.length; i++) { + var lowerPriorityExtension = extensions[i]; + var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); + wildcardFiles.delete(lowerPriorityPath); + } + } + function caseSensitiveKeyMapper(key) { + return key; + } + function caseInsensitiveKeyMapper(key) { + return key.toLowerCase(); } - ts.getResolutionDiagnostic = getResolutionDiagnostic; })(ts || (ts = {})); var ts; (function (ts) { @@ -51825,7 +57168,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -51884,6 +57229,22 @@ var ts; SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); + var OutputFileType; + (function (OutputFileType) { + OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; + OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; + OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; + })(OutputFileType = ts.OutputFileType || (ts.OutputFileType = {})); + var EndOfLineState; + (function (EndOfLineState) { + EndOfLineState[EndOfLineState["None"] = 0] = "None"; + EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; + EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; + })(EndOfLineState = ts.EndOfLineState || (ts.EndOfLineState = {})); var TokenClass; (function (TokenClass) { TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; @@ -51908,7 +57269,7 @@ var ts; ScriptElementKind.interfaceElement = "interface"; ScriptElementKind.typeElement = "type"; ScriptElementKind.enumElement = "enum"; - ScriptElementKind.enumMemberElement = "const"; + ScriptElementKind.enumMemberElement = "enum member"; ScriptElementKind.variableElement = "var"; ScriptElementKind.localVariableElement = "local var"; ScriptElementKind.functionElement = "function"; @@ -51930,6 +57291,7 @@ var ts; ScriptElementKind.letElement = "let"; ScriptElementKind.directory = "directory"; ScriptElementKind.externalModuleName = "external module name"; + ScriptElementKind.jsxAttribute = "JSX attribute"; })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); var ScriptElementKindModifier; (function (ScriptElementKindModifier) { @@ -51971,40 +57333,76 @@ var ts; ClassificationTypeNames.jsxText = "jsx text"; ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; ts.ClassificationTypeNames = ClassificationTypeNames; + var ClassificationType; + (function (ClassificationType) { + ClassificationType[ClassificationType["comment"] = 1] = "comment"; + ClassificationType[ClassificationType["identifier"] = 2] = "identifier"; + ClassificationType[ClassificationType["keyword"] = 3] = "keyword"; + ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral"; + ClassificationType[ClassificationType["operator"] = 5] = "operator"; + ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral"; + ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral"; + ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace"; + ClassificationType[ClassificationType["text"] = 9] = "text"; + ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation"; + ClassificationType[ClassificationType["className"] = 11] = "className"; + ClassificationType[ClassificationType["enumName"] = 12] = "enumName"; + ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName"; + ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName"; + ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName"; + ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; + ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; + ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName"; + ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; + ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; + ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; + ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute"; + ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText"; + ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue"; + })(ClassificationType = ts.ClassificationType || (ts.ClassificationType = {})); })(ts || (ts = {})); var ts; (function (ts) { ts.scanner = ts.createScanner(5, true); ts.emptyArray = []; + var SemanticMeaning; + (function (SemanticMeaning) { + SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; + SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value"; + SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type"; + SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace"; + SemanticMeaning[SemanticMeaning["All"] = 7] = "All"; + })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144: - case 223: - case 174: + case 145: + case 225: + case 175: + case 148: case 147: - case 146: - case 257: - case 258: case 260: - case 149: - case 148: + case 261: + case 263: case 150: + case 149: case 151: case 152: - case 225: - case 184: + case 153: + case 227: case 185: - case 256: + case 186: + case 259: + case 252: return 1; - case 143: - case 227: - case 228: - case 161: - return 2; - case 226: + case 144: case 229: - return 1 | 2; case 230: + case 162: + return 2; + case 228: + case 231: + return 1 | 2; + case 232: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -52014,21 +57412,24 @@ var ts; else { return 4; } - case 238: - case 239: - case 234: - case 235: case 240: case 241: + case 236: + case 237: + case 242: + case 243: return 1 | 2 | 4; - case 261: + case 264: return 4 | 1; } return 1 | 2 | 4; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240) { + if (node.kind === 264) { + return 1; + } + else if (node.parent.kind === 242) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -52050,15 +57451,15 @@ var ts; ts.getMeaningFromLocation = getMeaningFromLocation; function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 70); - if (node.parent.kind === 141 && + if (node.parent.kind === 142 && node.parent.right === node && - node.parent.parent.kind === 234) { + node.parent.parent.kind === 236) { return 1 | 2 | 4; } return 4; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141) { + while (node.parent.kind === 142) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -52069,27 +57470,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141) { - while (root.parent && root.parent.kind === 141) { + if (root.parent.kind === 142) { + while (root.parent && root.parent.kind === 142) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 && !isLastClause; + return root.parent.kind === 158 && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177) { - while (root.parent && root.parent.kind === 177) { + if (root.parent.kind === 178) { + while (root.parent && root.parent.kind === 178) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 255) { + if (!isLastClause && root.parent.kind === 200 && root.parent.parent.kind === 258) { var decl = root.parent.parent.parent; - return (decl.kind === 226 && root.parent.parent.token === 107) || - (decl.kind === 227 && root.parent.parent.token === 84); + return (decl.kind === 228 && root.parent.parent.token === 107) || + (decl.kind === 229 && root.parent.parent.token === 84); } return false; } @@ -52097,17 +57498,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 || - (node.parent.kind === 199 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 || + (node.parent.kind === 200 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 && !ts.isPartOfExpression(node)) || - node.kind === 167; + node.kind === 168; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179); + return isCallOrNewExpressionTarget(node, 180); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180); + return isCallOrNewExpressionTarget(node, 181); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -52120,7 +57521,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -52130,13 +57531,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 && - (node.parent.kind === 215 || node.parent.kind === 214) && + (node.parent.kind === 217 || node.parent.kind === 216) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 && - node.parent.kind === 219 && + node.parent.kind === 221 && node.parent.label === node; } function isLabelName(node) { @@ -52144,15 +57545,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 && node.parent.right === node; + return node.parent.kind === 142 && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 && node.parent.name === node; + return node.parent.kind === 232 && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -52163,19 +57564,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { + case 148: case 147: - case 146: - case 257: case 260: + case 263: + case 150: case 149: - case 148: - case 151: case 152: - case 230: + case 153: + case 232: return node.parent.name === node; - case 178: + case 179: return node.parent.argumentExpression === node; - case 142: + case 143: return true; } } @@ -52219,17 +57620,17 @@ var ts; return undefined; } switch (node.kind) { - case 261: + case 264: + case 150: case 149: - case 148: - case 225: - case 184: - case 151: - case 152: - case 226: case 227: + case 185: + case 152: + case 153: + case 228: case 229: - case 230: + case 231: + case 232: return node; } } @@ -52237,46 +57638,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261: + case 264: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230: + case 232: return ts.ScriptElementKind.moduleElement; - case 226: - case 197: + case 228: + case 198: return ts.ScriptElementKind.classElement; - case 227: return ts.ScriptElementKind.interfaceElement; - case 228: return ts.ScriptElementKind.typeElement; - case 229: return ts.ScriptElementKind.enumElement; - case 223: + case 229: return ts.ScriptElementKind.interfaceElement; + case 230: return ts.ScriptElementKind.typeElement; + case 231: return ts.ScriptElementKind.enumElement; + case 225: return getKindOfVariableDeclaration(node); - case 174: + case 175: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); + case 186: + case 227: case 185: - case 225: - case 184: return ts.ScriptElementKind.functionElement; - case 151: return ts.ScriptElementKind.memberGetAccessorElement; - case 152: return ts.ScriptElementKind.memberSetAccessorElement; + case 152: return ts.ScriptElementKind.memberGetAccessorElement; + case 153: return ts.ScriptElementKind.memberSetAccessorElement; + case 150: case 149: - case 148: return ts.ScriptElementKind.memberFunctionElement; + case 148: case 147: - case 146: return ts.ScriptElementKind.memberVariableElement; - case 155: return ts.ScriptElementKind.indexSignatureElement; - case 154: return ts.ScriptElementKind.constructSignatureElement; - case 153: return ts.ScriptElementKind.callSignatureElement; - case 150: return ts.ScriptElementKind.constructorImplementationElement; - case 143: return ts.ScriptElementKind.typeParameterElement; - case 260: return ts.ScriptElementKind.enumMemberElement; - case 144: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234: - case 239: + case 156: return ts.ScriptElementKind.indexSignatureElement; + case 155: return ts.ScriptElementKind.constructSignatureElement; + case 154: return ts.ScriptElementKind.callSignatureElement; + case 151: return ts.ScriptElementKind.constructorImplementationElement; + case 144: return ts.ScriptElementKind.typeParameterElement; + case 263: return ts.ScriptElementKind.enumMemberElement; + case 145: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; case 236: - case 243: - case 237: + case 241: + case 238: + case 245: + case 239: return ts.ScriptElementKind.alias; - case 285: + case 289: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -52290,21 +57691,12 @@ var ts; } } ts.getNodeKind = getNodeKind; - function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 ? node.parent : node; - var type = typeChecker.getTypeAtLocation(searchNode); - if (type && type.flags & 32) { - return type; - } - return undefined; - } - ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode; function isThis(node) { switch (node.kind) { case 98: return true; case 70: - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145; default: return false; } @@ -52312,7 +57704,7 @@ var ts; ts.isThis = isThis; var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= node.end) { + if (c.kind === 293 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -52523,7 +57915,7 @@ var ts; if (includeJsDocComment === void 0) { includeJsDocComment = false; } var current = sourceFile; outer: while (true) { - if (isToken(current)) { + if (ts.isToken(current)) { return current; } if (includeJsDocComment) { @@ -52546,8 +57938,8 @@ var ts; } } } - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; if (ts.isJSDocNode(child)) { continue; } @@ -52571,7 +57963,7 @@ var ts; } function findTokenOnLeftOfPosition(file, position) { var tokenAtPosition = getTokenAtPosition(file, position); - if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { return tokenAtPosition; } return findPrecedingToken(position, file); @@ -52580,7 +57972,7 @@ var ts; function findNextToken(previousToken, parent) { return find(parent); function find(n) { - if (isToken(n) && n.pos === previousToken.end) { + if (ts.isToken(n) && n.pos === previousToken.end) { return n; } var children = n.getChildren(); @@ -52599,7 +57991,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); @@ -52607,11 +57999,11 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; if (position < child.end && (nodeHasTokens(child) || child.kind === 10)) { var start = child.getStart(sourceFile); @@ -52626,7 +58018,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261); + ts.Debug.assert(startNode !== undefined || n.kind === 264); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -52671,13 +58063,13 @@ var ts; if (token.kind === 26 && token.parent.kind === 10) { return true; } - if (token.kind === 26 && token.parent.kind === 252) { + if (token.kind === 26 && token.parent.kind === 255) { return true; } - if (token && token.kind === 17 && token.parent.kind === 252) { + if (token && token.kind === 17 && token.parent.kind === 255) { return true; } - if (token.kind === 26 && token.parent.kind === 249) { + if (token.kind === 26 && token.parent.kind === 251) { return true; } return false; @@ -52694,10 +58086,10 @@ var ts; var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); return predicate ? ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 ? position <= c.end : position < c.end) && + (c.kind === 2 ? position <= c.end : position < c.end) && predicate(c); }) : ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 ? position <= c.end : position < c.end); }); + (c.kind === 2 ? position <= c.end : position < c.end); }); } return false; } @@ -52714,7 +58106,7 @@ var ts; ts.hasDocComment = hasDocComment; function getJsDocTagAtPosition(sourceFile, position) { var node = ts.getTokenAtPosition(sourceFile, position); - if (isToken(node)) { + if (ts.isToken(node)) { switch (node.kind) { case 103: case 109: @@ -52768,19 +58160,15 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 || node.kind === 179) { + if (node.kind === 158 || node.kind === 180) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 || node.kind === 227) { + if (ts.isFunctionLike(node) || node.kind === 228 || node.kind === 229) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; - function isToken(n) { - return n.kind >= 0 && n.kind <= 140; - } - ts.isToken = isToken; function isWord(kind) { return kind === 70 || ts.isKeyword(kind); } @@ -52837,18 +58225,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 || - node.kind === 176) { - if (node.parent.kind === 192 && + if (node.kind === 176 || + node.kind === 177) { + if (node.parent.kind === 193 && node.parent.left === node && node.parent.operatorToken.kind === 57) { return true; } - if (node.parent.kind === 213 && + if (node.parent.kind === 215 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 260 ? node.parent.parent : node.parent)) { return true; } } @@ -52876,10 +58264,43 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118: + case 121: + case 129: + case 132: + case 133: + case 135: + case 136: + case 104: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; + function isExternalModuleSymbol(moduleSymbol) { + ts.Debug.assert(!!(moduleSymbol.flags & 1536)); + return moduleSymbol.name.charCodeAt(0) === 34; + } + ts.isExternalModuleSymbol = isExternalModuleSymbol; + function nodeSeenTracker() { + var seen = []; + return function (node) { + var id = ts.getNodeId(node); + return !seen[id] && (seen[id] = true); + }; + } + ts.nodeSeenTracker = nodeSeenTracker; })(ts || (ts = {})); (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -52896,13 +58317,15 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; function writeIndent() { if (lineStart) { @@ -53050,21 +58473,16 @@ var ts; } ts.signatureToDisplayParts = signatureToDisplayParts; function getDeclaredName(typeChecker, symbol, location) { - if (isImportOrExportSpecifierName(location)) { - return location.getText(); - } - else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142) { + if (isImportOrExportSpecifierName(location) || ts.isStringOrNumericLiteral(location) && location.parent.kind === 143) { return location.text; } var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); - return name; + return typeChecker.symbolToString(localExportDefaultSymbol || symbol); } ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 || location.parent.kind === 243) && + (location.parent.kind === 241 || location.parent.kind === 245) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -53075,7 +58493,6 @@ var ts; (name.charCodeAt(0) === 34 || name.charCodeAt(0) === 39)) { return name.substring(1, length - 1); } - ; return name; } ts.stripQuotes = stripQuotes; @@ -53121,6 +58538,21 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getFirstNonSpaceCharacterPosition(text, position) { + while (ts.isWhiteSpace(text.charCodeAt(position))) { + position += 1; + } + return position; + } + ts.getFirstNonSpaceCharacterPosition = getFirstNonSpaceCharacterPosition; + function getOpenBrace(constructor, sourceFile) { + return constructor.body.getFirstToken(sourceFile); + } + ts.getOpenBrace = getOpenBrace; + function getOpenBraceOfClassLike(declaration, sourceFile) { + return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1); + } + ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike; })(ts || (ts = {})); var ts; (function (ts) { @@ -53169,89 +58601,89 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205: + case 207: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223: + case 225: + case 148: case 147: - case 146: return spanInVariableDeclaration(node); - case 144: + case 145: return spanInParameterDeclaration(node); - case 225: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 184: + case 153: + case 151: case 185: + case 186: return spanInFunctionDeclaration(node); - case 204: + case 206: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 231: + case 233: return spanInBlock(node); - case 256: + case 259: return spanInBlock(node.block); - case 207: + case 209: return textSpan(node.expression); - case 216: + case 218: return textSpan(node.getChildAt(0), node.expression); - case 210: + case 212: return textSpanEndingAtNextToken(node, node.expression); - case 209: + case 211: return spanInNode(node.statement); - case 222: + case 224: return textSpan(node.getChildAt(0)); - case 208: + case 210: return textSpanEndingAtNextToken(node, node.expression); - case 219: + case 221: return spanInNode(node.statement); - case 215: - case 214: + case 217: + case 216: return textSpan(node.getChildAt(0), node.label); - case 211: + case 213: return spanInForStatement(node); - case 212: + case 214: return textSpanEndingAtNextToken(node, node.expression); - case 213: + case 215: return spanInInitializerOfForLike(node); - case 218: + case 220: return textSpanEndingAtNextToken(node, node.expression); - case 253: - case 254: + case 256: + case 257: return spanInNode(node.statements[0]); - case 221: + case 223: return spanInBlock(node.tryBlock); - case 220: + case 222: return textSpan(node, node.expression); - case 240: + case 242: return textSpan(node, node.expression); - case 234: + case 236: return textSpan(node, node.moduleReference); - case 235: + case 237: return textSpan(node, node.moduleSpecifier); - case 241: + case 243: return textSpan(node, node.moduleSpecifier); - case 230: + case 232: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 226: - case 229: - case 260: - case 174: + case 228: + case 231: + case 263: + case 175: return textSpan(node); - case 217: + case 219: return spanInNode(node.statement); - case 145: + case 146: return spanInNodeArray(node.parent.decorators); - case 172: case 173: + case 174: return spanInBindingPattern(node); - case 227: - case 228: + case 229: + case 230: return undefined; case 24: case 1: @@ -53279,20 +58711,20 @@ var ts; case 73: case 86: return spanInNextNode(node); - case 140: + case 141: return spanInOfKeyword(node); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } if ((node.kind === 70 || - node.kind == 196 || - node.kind === 257 || - node.kind === 258) && + node.kind === 197 || + node.kind === 260 || + node.kind === 261) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192) { + if (node.kind === 193) { var binaryExpression = node; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); @@ -53307,38 +58739,38 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209: + case 211: return spanInPreviousNode(node); - case 145: + case 146: return spanInNode(node.parent); - case 211: case 213: + case 215: return textSpan(node); - case 192: + case 193: if (node.parent.operatorToken.kind === 25) { return textSpan(node); } break; - case 185: + case 186: if (node.parent.body === node) { return textSpan(node); } break; } } - if (node.parent.kind === 257 && + if (node.parent.kind === 260 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 182 && node.parent.type === node) { + if (node.parent.kind === 183 && node.parent.type === node) { return spanInNextNode(node.parent.type); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } - if ((node.parent.kind === 223 || - node.parent.kind === 144)) { + if ((node.parent.kind === 225 || + node.parent.kind === 145)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -53346,7 +58778,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192) { + if (node.parent.kind === 193) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -53358,8 +58790,8 @@ var ts; } } function textSpanFromVariableDeclaration(variableDeclaration) { - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] === variableDeclaration) { + if (variableDeclaration.parent.kind === 226 && + variableDeclaration.parent.declarations[0] === variableDeclaration) { return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); } else { @@ -53367,7 +58799,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 212) { + if (variableDeclaration.parent.parent.kind === 214) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -53375,11 +58807,11 @@ var ts; } if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || - variableDeclaration.parent.parent.kind === 213) { + variableDeclaration.parent.parent.kind === 215) { return textSpanFromVariableDeclaration(variableDeclaration); } - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] !== variableDeclaration) { + if (variableDeclaration.parent.kind === 226 && + variableDeclaration.parent.declarations[0] !== variableDeclaration) { return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); } } @@ -53407,7 +58839,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || - (functionDeclaration.parent.kind === 226 && functionDeclaration.kind !== 150); + (functionDeclaration.parent.kind === 228 && functionDeclaration.kind !== 151); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -53427,22 +58859,22 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230: + case 232: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 210: - case 208: case 212: + case 210: + case 214: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 211: case 213: + case 215: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224) { + if (forLikeStatement.initializer.kind === 226) { var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -53464,62 +58896,62 @@ var ts; } } function spanInBindingPattern(bindingPattern) { - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 174) { + if (bindingPattern.parent.kind === 175) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 && node.kind !== 172); - var elements = node.kind === 175 ? + ts.Debug.assert(node.kind !== 174 && node.kind !== 173); + var elements = node.kind === 176 ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node.parent.kind === 192 ? node.parent : node); + return textSpan(node.parent.kind === 193 ? node.parent : node); } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229: + case 231: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226: + case 228: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232: + case 234: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231: + case 233: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 229: - case 226: + case 231: + case 228: return textSpan(node); - case 204: + case 206: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 256: + case 259: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232: + case 234: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172: + case 173: var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -53532,7 +58964,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173: + case 174: var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -53544,33 +58976,33 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 || - node.parent.kind === 179 || - node.parent.kind === 180) { + if (node.parent.kind === 211 || + node.parent.kind === 180 || + node.parent.kind === 181) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 184) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 184: - case 225: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 210: - case 209: + case 153: + case 151: + case 212: case 211: case 213: - case 179: + case 215: case 180: - case 183: + case 181: + case 184: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -53578,26 +59010,26 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 || - node.parent.kind === 144) { + node.parent.kind === 260 || + node.parent.kind === 145) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182) { + if (node.parent.kind === 183) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209) { + if (node.parent.kind === 211) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213) { + if (node.parent.kind === 215) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -53628,7 +59060,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 || - keyword2 === 133 || + keyword2 === 134 || keyword2 === 122 || keyword2 === 114) { return true; @@ -53641,9 +59073,9 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; - var length_4 = dense[i + 1]; + var length_5 = dense[i + 1]; var type = dense[i + 2]; if (lastEnd >= 0) { var whitespaceLength_1 = start - lastEnd; @@ -53651,8 +59083,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace }); } } - entries.push({ length: length_4, classification: convertClassification(type) }); - lastEnd = start + length_4; + entries.push({ length: length_5, classification: convertClassification(type) }); + lastEnd = start + length_5; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -53744,10 +59176,10 @@ var ts; angleBracketStack--; } else if (token === 118 || - token === 134 || + token === 135 || token === 132 || token === 121 || - token === 135) { + token === 136) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 70; } @@ -53902,7 +59334,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 && token <= 140; + return token >= 71 && token <= 141; } function classFromKind(token) { if (isKeyword(token)) { @@ -53948,10 +59380,10 @@ var ts; ts.getSemanticClassifications = getSemanticClassifications; function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 230: - case 226: + case 232: + case 228: + case 229: case 227: - case 225: cancellationToken.throwIfCancellationRequested(); } } @@ -53995,7 +59427,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 && + return declaration.kind === 232 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -54006,7 +59438,7 @@ var ts; checkForClassificationCancellation(cancellationToken, kind); if (kind === 70 && !ts.nodeIsMissing(node)) { var identifier = node; - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -54052,7 +59484,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -54136,16 +59568,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 281: + case 285: processJSDocParameterTag(tag); break; - case 284: + case 288: processJSDocTemplateTag(tag); break; - case 283: + case 287: processElement(tag.typeExpression); break; - case 282: + case 286: processElement(tag.typeExpression); break; } @@ -54226,22 +59658,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248: + case 250: if (token.parent.tagName === token) { return 19; } break; - case 249: + case 251: if (token.parent.tagName === token) { return 20; } break; - case 247: + case 249: if (token.parent.tagName === token) { return 21; } break; - case 250: + case 252: if (token.parent.name === token) { return 22; } @@ -54261,299 +59693,115 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 57) { - if (token.parent.kind === 223 || - token.parent.kind === 147 || - token.parent.kind === 144 || - token.parent.kind === 250) { + if (token.parent.kind === 225 || + token.parent.kind === 148 || + token.parent.kind === 145 || + token.parent.kind === 252) { return 5; } } - if (token.parent.kind === 192 || - token.parent.kind === 190 || + if (token.parent.kind === 193 || token.parent.kind === 191 || - token.parent.kind === 193) { - return 5; - } - } - return 10; - } - else if (tokenKind === 8) { - return 4; - } - else if (tokenKind === 9) { - return token.parent.kind === 250 ? 24 : 6; - } - else if (tokenKind === 11) { - return 6; - } - else if (ts.isTemplateLiteralKind(tokenKind)) { - return 6; - } - else if (tokenKind === 10) { - return 23; - } - else if (tokenKind === 70) { - if (token) { - switch (token.parent.kind) { - case 226: - if (token.parent.name === token) { - return 11; - } - return; - case 143: - if (token.parent.name === token) { - return 15; - } - return; - case 227: - if (token.parent.name === token) { - return 13; - } - return; - case 229: - if (token.parent.name === token) { - return 12; - } - return; - case 230: - if (token.parent.name === token) { - return 14; - } - return; - case 144: - if (token.parent.name === token) { - return ts.isThisIdentifier(token) ? 3 : 17; - } - return; - } - } - return 2; - } - } - function processElement(element) { - if (!element) { - return; - } - if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { - checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; - if (!tryClassifyNode(child)) { - processElement(child); - } - } - } - } - } - ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; -})(ts || (ts = {})); -var ts; -(function (ts) { - var Completions; - (function (Completions) { - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { - if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); - } - if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); - } - var completionData = getCompletionData(typeChecker, log, sourceFile, position); - if (!completionData) { - return undefined; - } - var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; - if (isJsDocTagName) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() }; - } - var entries = []; - if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); - } - else { - if (!symbols || symbols.length === 0) { - if (sourceFile.languageVariant === 1 && - location.parent && location.parent.kind === 249) { - var tagName = location.parent.parent.openingElement.tagName; - entries.push({ - name: tagName.text, - kind: undefined, - kindModifiers: undefined, - sortText: "0", - }); - } - else { - return undefined; - } - } - getCompletionEntriesFromSymbols(symbols, entries, location, true); - } - if (!isMemberCompletion && !isJsDocTagName) { - ts.addRange(entries, keywordCompletions); - } - return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_44 in nameTable) { - if (nameTable[name_44] === position) { - continue; - } - if (!uniqueNames[name_44]) { - uniqueNames[name_44] = name_44; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } - } - } - return entries; - } - function createCompletionEntry(symbol, location, performCharacterChecks) { - var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; - } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; - } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9) { - return undefined; - } - if (node.parent.kind === 257 && - node.parent.parent.kind === 176 && - node.parent.name === node) { - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 235 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - return getStringLiteralCompletionEntriesFromContextualType(node); - } - } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); + token.parent.kind === 192 || + token.parent.kind === 194) { + return 5; } } - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; - } - return undefined; + return 10; } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - return undefined; + else if (tokenKind === 8) { + return 4; } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; + else if (tokenKind === 9) { + return token.parent.kind === 252 ? 24 : 6; + } + else if (tokenKind === 11) { + return 6; + } + else if (ts.isTemplateLiteralKind(tokenKind)) { + return 6; + } + else if (tokenKind === 10) { + return 23; + } + else if (tokenKind === 70) { + if (token) { + switch (token.parent.kind) { + case 228: + if (token.parent.name === token) { + return 11; + } + return; + case 144: + if (token.parent.name === token) { + return 15; + } + return; + case 229: + if (token.parent.name === token) { + return 13; + } + return; + case 231: + if (token.parent.name === token) { + return 12; + } + return; + case 232: + if (token.parent.name === token) { + return 14; + } + return; + case 145: + if (token.parent.name === token) { + return ts.isThisIdentifier(token) ? 3 : 17; + } + return; } } - return undefined; + return 2; } - function addStringLiteralCompletionsFromType(type, result) { - if (!type) { - return; - } - if (type.flags & 65536) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); + } + function processElement(element) { + if (!element) { + return; + } + if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { + checkForClassificationCancellation(cancellationToken, element.kind); + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; + if (!tryClassifyNode(child)) { + processElement(child); } } } - function getStringLiteralCompletionEntriesFromModuleNames(node) { + } + } + ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; +})(ts || (ts = {})); +var ts; +(function (ts) { + var Completions; + (function (Completions) { + var PathCompletions; + (function (PathCompletions) { + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { var literalValue = ts.normalizeSlashes(node.text); var scriptPath = node.getSourceFile().path; var scriptDirectory = ts.getDirectoryPath(scriptPath); var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); var entries; if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, false, span, compilerOptions, host, scriptPath); } else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, false, span, host, scriptPath); } } else { - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } return { isGlobalCompletion: false, @@ -54562,6 +59810,7 @@ var ts; entries: entries }; } + PathCompletions.getStringLiteralCompletionEntriesFromModuleNames = getStringLiteralCompletionEntriesFromModuleNames; function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); var relativeDirectory; @@ -54574,18 +59823,18 @@ var ts; } return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { var basePath = compilerOptions.project || host.getCurrentDirectory(); var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); var result = []; for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); } return result; } - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { if (result === void 0) { result = []; } if (fragment === undefined) { fragment = ""; @@ -54610,13 +59859,13 @@ var ts; continue; } var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - for (var foundFile in foundFiles) { + ts.forEachKey(foundFiles, function (foundFile) { result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); - } + }); } var directories = tryGetDirectories(host, baseDirectory); if (directories) { @@ -54629,14 +59878,14 @@ var ts; } return result; } - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; var result; if (baseUrl) { var fileExtensions = ts.getSupportedExtensions(compilerOptions); var projectDir = compilerOptions.project || host.getCurrentDirectory(); var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span, host); if (paths) { for (var path in paths) { if (paths.hasOwnProperty(path)) { @@ -54644,7 +59893,7 @@ var ts; if (paths[path]) { for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { var match = _c[_b]; result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } @@ -54665,13 +59914,13 @@ var ts; result = []; } getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { var moduleName = _e[_d]; result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { if (host.readDirectory) { var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; if (parsed) { @@ -54694,8 +59943,8 @@ var ts; continue; } var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + var length_6 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_6))); } return result; } @@ -54703,7 +59952,7 @@ var ts; } return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); @@ -54738,7 +59987,7 @@ var ts; } return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { var token = ts.getTokenAtPosition(sourceFile, position); if (!token) { return undefined; @@ -54766,7 +60015,7 @@ var ts; var scriptPath = ts.getDirectoryPath(sourceFile.path); if (kind === "path") { var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, sourceFile.path); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, host, sourceFile.path); } else { var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; @@ -54775,6 +60024,7 @@ var ts; } return completionInfo; } + PathCompletions.getTripleSlashReferenceCompletion = getTripleSlashReferenceCompletion; function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { if (result === void 0) { result = []; } if (options.types) { @@ -54797,7 +60047,7 @@ var ts; } } if (host.getDirectories) { - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { var packageJson = _d[_c]; var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); getCompletionEntriesFromDirectories(host, typesDir, span, result); @@ -54817,7 +60067,7 @@ var ts; } } } - function findPackageJsons(currentDir) { + function findPackageJsons(currentDir, host) { var paths = []; var currentConfigPath; while (true) { @@ -54825,11 +60075,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } - currentDir = parent_13; + currentDir = parent; } else { break; @@ -54840,7 +60090,7 @@ var ts; function enumerateNodeModulesVisibleToScript(host, scriptPath) { var result = []; if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { var packageJson = _a[_i]; var contents = tryReadingPackageJson(packageJson); if (!contents) { @@ -54901,21 +60151,256 @@ var ts; function normalizeAndPreserveTrailingSlash(path) { return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } + var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105)) { + break; + } } - var name_45 = element.propertyName || element.name; - existingImportsOrExports[name_45.text] = true; } - if (!ts.someProperties(existingImportsOrExports)) { - return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); - } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); } - function filterObjectMembersList(contextualMemberSymbols, existingMembers) { - if (!existingMembers || existingMembers.length === 0) { - return contextualMemberSymbols; + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); } - var existingMemberNames = ts.createMap(); - for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { - var m = existingMembers_1[_i]; - if (m.kind !== 257 && - m.kind !== 258 && - m.kind !== 174 && - m.kind !== 149 && - m.kind !== 151 && - m.kind !== 152) { - continue; - } - if (m.getStart() <= position && position <= m.getEnd()) { - continue; - } - var existingName = void 0; - if (m.kind === 174 && m.propertyName) { - if (m.propertyName.kind === 70) { - existingName = m.propertyName.text; - } + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213: + case 214: + case 215: + case 211: + case 212: + return getLoopBreakContinueOccurrences(owner); + case 220: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71); } - else { - existingName = m.name.text; + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + } + return keywords; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 206))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + while (hasKind(ifStatement.parent, 210) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 89); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 81)) { + break; } - existingMemberNames[existingName] = true; } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + if (!hasKind(ifStatement.elseStatement, 210)) { + break; + } + ifStatement = ifStatement.elseStatement; } - function filterJsxAttributes(symbols, attributes) { - var seenNames = ts.createMap(); - for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { - var attr = attributes_1[_i]; - if (attr.getStart() <= position && position <= attr.getEnd()) { - continue; + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 81 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldCombindElseAndIf = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; + break; + } } - if (attr.kind === 250) { - seenNames[attr.name.text] = true; + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; + continue; } } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); } + return result; } - function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) { - var displayName = ts.getDeclaredName(typeChecker, symbol, location); - if (displayName) { - var firstCharCode = displayName.charCodeAt(0); - if ((symbol.flags & 1920) && (firstCharCode === 39 || firstCharCode === 34)) { - return undefined; + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 221; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; } } - return getCompletionEntryDisplayName(displayName, target, performCharacterChecks); + return false; } - function getCompletionEntryDisplayName(name, target, performCharacterChecks) { - if (!name) { - return undefined; - } - name = ts.stripQuotes(name); - if (!name) { - return undefined; - } - if (performCharacterChecks) { - if (!ts.isIdentifierText(name, target)) { - return undefined; - } + })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } + var buckets = ts.createMap(); + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); + } + function getBucketForCompilationSettings(key, createIfMissing) { + var bucket = buckets.get(key); + if (!bucket && createIfMissing) { + buckets.set(key, bucket = ts.createFileMap()); } - return name; + return bucket; } - var keywordCompletions = []; - for (var i = 71; i <= 140; i++) { - keywordCompletions.push({ - name: ts.tokenToString(i), - kind: ts.ScriptElementKind.keyword, - kindModifiers: ts.ScriptElementKindModifier.none, - sortText: "0" + function reportStats() { + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); + var sourceFiles = []; + entries.forEachValue(function (key, entry) { + sourceFiles.push({ + name: key, + refCount: entry.languageServiceRefCount, + references: entry.owners.slice(0) + }); + }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; }); + return JSON.stringify(bucketInfoArray, undefined, 2); } - var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*= 0); + if (entry.languageServiceRefCount === 0) { + bucket.remove(path); + } + } + return { + acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, + updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, + releaseDocument: releaseDocument, + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings + }; + } + ts.createDocumentRegistry = createDocumentRegistry; })(ts || (ts = {})); var ts; (function (ts) { - var DocumentHighlights; - (function (DocumentHighlights) { - function getDocumentHighlights(typeChecker, cancellationToken, sourceFile, position, sourceFilesToSearch) { - var node = ts.getTouchingWord(sourceFile, position); - if (!node) { - return undefined; - } - return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node); - function getHighlightSpanForNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - return { - fileName: sourceFile.fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - kind: ts.HighlightSpanKind.none - }; - } - function getSemanticDocumentHighlights(node) { - if (node.kind === 70 || - node.kind === 98 || - node.kind === 167 || - node.kind === 96 || - node.kind === 9 || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFilesToSearch, false, false, false); - return convertReferencedSymbols(referencedSymbols); - } - return undefined; - function convertReferencedSymbols(referencedSymbols) { - if (!referencedSymbols) { - return undefined; - } - var fileNameToDocumentHighlights = ts.createMap(); - var result = []; - for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { - var referencedSymbol = referencedSymbols_1[_i]; - for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { - var referenceEntry = _b[_a]; - var fileName = referenceEntry.fileName; - var documentHighlights = fileNameToDocumentHighlights[fileName]; - if (!documentHighlights) { - documentHighlights = { fileName: fileName, highlightSpans: [] }; - fileNameToDocumentHighlights[fileName] = documentHighlights; - result.push(documentHighlights); - } - documentHighlights.highlightSpans.push({ - textSpan: referenceEntry.textSpan, - kind: referenceEntry.isWriteAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference - }); - } + var FindAllReferences; + (function (FindAllReferences) { + function createImportTracker(sourceFiles, checker, cancellationToken) { + var allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken); + return function (exportSymbol, exportInfo, isForRename) { + var _a = getImportersForExport(sourceFiles, allDirectImports, exportInfo, checker, cancellationToken), directImports = _a.directImports, indirectUsers = _a.indirectUsers; + return __assign({ indirectUsers: indirectUsers }, getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename)); + }; + } + FindAllReferences.createImportTracker = createImportTracker; + var ExportKind; + (function (ExportKind) { + ExportKind[ExportKind["Named"] = 0] = "Named"; + ExportKind[ExportKind["Default"] = 1] = "Default"; + ExportKind[ExportKind["ExportEquals"] = 2] = "ExportEquals"; + })(ExportKind = FindAllReferences.ExportKind || (FindAllReferences.ExportKind = {})); + var ImportExport; + (function (ImportExport) { + ImportExport[ImportExport["Import"] = 0] = "Import"; + ImportExport[ImportExport["Export"] = 1] = "Export"; + })(ImportExport = FindAllReferences.ImportExport || (FindAllReferences.ImportExport = {})); + function getImportersForExport(sourceFiles, allDirectImports, _a, checker, cancellationToken) { + var exportingModuleSymbol = _a.exportingModuleSymbol, exportKind = _a.exportKind; + var markSeenDirectImport = ts.nodeSeenTracker(); + var markSeenIndirectUser = ts.nodeSeenTracker(); + var directImports = []; + var isAvailableThroughGlobal = !!exportingModuleSymbol.globalExports; + var indirectUserDeclarations = isAvailableThroughGlobal ? undefined : []; + handleDirectImports(exportingModuleSymbol); + return { directImports: directImports, indirectUsers: getIndirectUsers() }; + function getIndirectUsers() { + if (isAvailableThroughGlobal) { + return sourceFiles; + } + for (var _i = 0, _a = exportingModuleSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (ts.isExternalModuleAugmentation(decl)) { + addIndirectUser(decl); } - return result; } + return indirectUserDeclarations.map(ts.getSourceFileOfNode); } - function getSyntacticDocumentHighlights(node) { - var fileName = sourceFile.fileName; - var highlightSpans = getHighlightSpans(node); - if (!highlightSpans || highlightSpans.length === 0) { - return undefined; - } - return [{ fileName: fileName, highlightSpans: highlightSpans }]; - function hasKind(node, kind) { - return node !== undefined && node.kind === kind; - } - function parent(node) { - return node && node.parent; - } - function getHighlightSpans(node) { - if (node) { - switch (node.kind) { - case 89: - case 81: - if (hasKind(node.parent, 208)) { - return getIfElseOccurrences(node.parent); - } - break; - case 95: - if (hasKind(node.parent, 216)) { - return getReturnOccurrences(node.parent); - } - break; - case 99: - if (hasKind(node.parent, 220)) { - return getThrowOccurrences(node.parent); - } - break; - case 73: - if (hasKind(parent(parent(node)), 221)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 101: - case 86: - if (hasKind(parent(node), 221)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; - case 97: - if (hasKind(node.parent, 218)) { - return getSwitchCaseDefaultOccurrences(node.parent); - } - break; - case 72: - case 78: - if (hasKind(parent(parent(parent(node))), 218)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); + function handleDirectImports(exportingModuleSymbol) { + var theseDirectImports = getDirectImports(exportingModuleSymbol); + if (theseDirectImports) + for (var _i = 0, theseDirectImports_1 = theseDirectImports; _i < theseDirectImports_1.length; _i++) { + var direct = theseDirectImports_1[_i]; + if (!markSeenDirectImport(direct)) { + continue; + } + cancellationToken.throwIfCancellationRequested(); + switch (direct.kind) { + case 180: + if (!isAvailableThroughGlobal) { + var parent = direct.parent; + if (exportKind === 2 && parent.kind === 225) { + var name = parent.name; + if (name.kind === 70) { + directImports.push(name); + break; + } + } + addIndirectUser(direct.getSourceFile()); } break; - case 71: - case 76: - if (hasKind(node.parent, 215) || hasKind(node.parent, 214)) { - return getBreakOrContinueStatementOccurrences(node.parent); - } + case 236: + handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1)); break; - case 87: - if (hasKind(node.parent, 211) || - hasKind(node.parent, 212) || - hasKind(node.parent, 213)) { - return getLoopBreakContinueOccurrences(node.parent); + case 237: + var namedBindings = direct.importClause && direct.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239) { + handleNamespaceImport(direct, namedBindings.name); } - break; - case 105: - case 80: - if (hasKind(node.parent, 210) || hasKind(node.parent, 209)) { - return getLoopBreakContinueOccurrences(node.parent); + else { + directImports.push(direct); } break; - case 122: - if (hasKind(node.parent, 150)) { - return getConstructorOccurrences(node.parent); + case 243: + if (!direct.exportClause) { + handleDirectImports(getContainingModuleSymbol(direct, checker)); } - break; - case 124: - case 133: - if (hasKind(node.parent, 151) || hasKind(node.parent, 152)) { - return getGetAndSetOccurrences(node.parent); + else { + directImports.push(direct); } break; - default: - if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 205)) { - return getModifierOccurrences(node.kind, node.parent); - } } } - return undefined; + } + function handleNamespaceImport(importDeclaration, name, isReExport) { + if (exportKind === 2) { + directImports.push(importDeclaration); } - function aggregateOwnedThrowStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 220) { - statementAccumulator.push(node); - } - else if (node.kind === 221) { - var tryStatement = node; - if (tryStatement.catchClause) { - aggregate(tryStatement.catchClause); - } - else { - aggregate(tryStatement.tryBlock); - } - if (tryStatement.finallyBlock) { - aggregate(tryStatement.finallyBlock); - } - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } + else if (!isAvailableThroughGlobal) { + var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); + ts.Debug.assert(sourceFileLike.kind === 264 || sourceFileLike.kind === 232); + if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { + addIndirectUsers(sourceFileLike); } - } - function getThrowStatementOwner(throwStatement) { - var child = throwStatement; - while (child.parent) { - var parent_17 = child.parent; - if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) { - return parent_17; - } - if (parent_17.kind === 221) { - var tryStatement = parent_17; - if (tryStatement.tryBlock === child && tryStatement.catchClause) { - return child; - } - } - child = parent_17; + else { + addIndirectUser(sourceFileLike); } - return undefined; } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 215 || node.kind === 214) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } - } + } + function addIndirectUser(sourceFileLike) { + ts.Debug.assert(!isAvailableThroughGlobal); + var isNew = markSeenIndirectUser(sourceFileLike); + if (isNew) { + indirectUserDeclarations.push(sourceFileLike); } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; + return isNew; + } + function addIndirectUsers(sourceFileLike) { + if (!addIndirectUser(sourceFileLike)) { + return; } - function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 218: - if (statement.kind === 214) { - continue; - } - case 211: - case 212: - case 213: - case 210: - case 209: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; - } - break; - default: - if (ts.isFunctionLike(node_1)) { - return undefined; - } - break; - } + var moduleSymbol = checker.getMergedSymbol(sourceFileLike.symbol); + ts.Debug.assert(!!(moduleSymbol.flags & 1536)); + var directImports = getDirectImports(moduleSymbol); + if (directImports) + for (var _i = 0, directImports_1 = directImports; _i < directImports_1.length; _i++) { + var directImport = directImports_1[_i]; + addIndirectUsers(getSourceFileLikeForImportDeclaration(directImport)); } - return undefined; + } + function getDirectImports(moduleSymbol) { + return allDirectImports.get(ts.getSymbolId(moduleSymbol).toString()); + } + } + function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, checker, isForRename) { + var exportName = exportSymbol.name; + var importSearches = []; + var singleReferences = []; + function addSearch(location, symbol) { + importSearches.push([location, symbol]); + } + if (directImports) + for (var _i = 0, directImports_2 = directImports; _i < directImports_2.length; _i++) { + var decl = directImports_2[_i]; + handleImport(decl); } - function getModifierOccurrences(modifier, declaration) { - var container = declaration.parent; - if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 226 || - container.kind === 197 || - (declaration.kind === 144 && hasKind(container, 150)))) { - return undefined; - } + return { importSearches: importSearches, singleReferences: singleReferences }; + function handleImport(decl) { + if (decl.kind === 236) { + if (isExternalModuleImportEquals(decl)) { + handleNamespaceImportLike(decl.name); } - else if (modifier === 114) { - if (!(container.kind === 226 || container.kind === 197)) { - return undefined; - } + return; + } + if (decl.kind === 70) { + handleNamespaceImportLike(decl); + return; + } + if (decl.moduleSpecifier.kind !== 9) { + return; + } + if (decl.kind === 243) { + searchForNamedImport(decl.exportClause); + return; + } + var importClause = decl.importClause; + var namedBindings = importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239) { + handleNamespaceImportLike(namedBindings.name); + return; + } + if (exportKind === 0) { + searchForNamedImport(namedBindings); + } + else { + var name = importClause.name; + if (name && (!isForRename || name.text === symbolName(exportSymbol))) { + var defaultImportAlias = checker.getSymbolAtLocation(name); + addSearch(name, defaultImportAlias); } - else if (modifier === 83 || modifier === 123) { - if (!(container.kind === 231 || container.kind === 261)) { - return undefined; - } + if (!isForRename && exportKind === 1) { + ts.Debug.assert(exportName === "default"); + searchForNamedImport(namedBindings); } - else if (modifier === 116) { - if (!(container.kind === 226 || declaration.kind === 226)) { - return undefined; + } + } + function handleNamespaceImportLike(importName) { + if (exportKind === 2 && (!isForRename || importName.text === exportName)) { + addSearch(importName, checker.getSymbolAtLocation(importName)); + } + } + function searchForNamedImport(namedBindings) { + if (namedBindings) + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var element = _a[_i]; + var name = element.name, propertyName = element.propertyName; + if ((propertyName || name).text !== exportName) { + continue; } - } - else { - return undefined; - } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 231: - case 261: - if (modifierFlag & 128) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 150: - nodes = container.parameters.concat(container.parent.members); - break; - case 226: - case 197: - nodes = container.members; - if (modifierFlag & 28) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 150 && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128) { - nodes = nodes.concat(container); + if (propertyName) { + singleReferences.push(propertyName); + if (!isForRename) { + addSearch(name, checker.getSymbolAtLocation(name)); } - break; - default: - ts.Debug.fail("Invalid container kind."); - } - ts.forEach(nodes, function (node) { - if (ts.getModifierFlags(node) & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 113: - return 4; - case 111: - return 8; - case 112: - return 16; - case 114: - return 32; - case 83: - return 1; - case 123: - return 2; - case 116: - return 128; - default: - ts.Debug.fail(); + else { + var localSymbol = element.kind === 245 && element.propertyName + ? checker.getExportSpecifierLocalTargetSymbol(element) + : checker.getSymbolAtLocation(name); + addSearch(name, localSymbol); } } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); + } + } + function findNamespaceReExports(sourceFileLike, name, checker) { + var namespaceImportSymbol = checker.getSymbolAtLocation(name); + return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { + if (statement.kind !== 243) + return; + var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; + if (moduleSpecifier || !exportClause) + return; + for (var _i = 0, _b = exportClause.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (checker.getExportSpecifierLocalTargetSymbol(element) === namespaceImportSymbol) { return true; } - return false; } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 151); - tryPushAccessorKeyword(accessorDeclaration.symbol, 152); - return ts.map(keywords, getHighlightSpanForNode); - function tryPushAccessorKeyword(accessorSymbol, accessorKind) { - var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); - if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124, 133); }); + }); + } + function getDirectImportsMap(sourceFiles, checker, cancellationToken) { + var map = ts.createMap(); + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; + cancellationToken.throwIfCancellationRequested(); + forEachImport(sourceFile, function (importDecl, moduleSpecifier) { + var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol) { + var id = ts.getSymbolId(moduleSymbol).toString(); + var imports = map.get(id); + if (!imports) { + map.set(id, imports = []); } + imports.push(importDecl); } + }); + } + return map; + } + function forEachPossibleImportOrExportStatement(sourceFileLike, action) { + return ts.forEach(sourceFileLike.kind === 264 ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); + }); + } + function forEachImport(sourceFile, action) { + if (sourceFile.externalModuleIndicator) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier = _a[_i]; + action(importerFromModuleSpecifier(moduleSpecifier), moduleSpecifier); } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 122); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { - if (loopNode.kind === 209) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105)) { - break; - } + } + else { + forEachPossibleImportOrExportStatement(sourceFile, function (statement) { + switch (statement.kind) { + case 243: + case 237: { + var decl = statement; + if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9) { + action(decl, decl.moduleSpecifier); + } + break; + } + case 236: { + var decl = statement; + var moduleReference = decl.moduleReference; + if (moduleReference.kind === 247 && + moduleReference.expression.kind === 9) { + action(decl, moduleReference.expression); } + break; } } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); + }); + if (sourceFile.flags & 65536) { + sourceFile.forEachChild(function recur(node) { + if (ts.isRequireCall(node, true)) { + action(node, node.arguments[0]); } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 211: - case 212: - case 213: - case 209: - case 210: - return getLoopBreakContinueOccurrences(owner); - case 218: - return getSwitchCaseDefaultOccurrences(owner); + else { + node.forEachChild(recur); } - } - return undefined; - } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); - ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71); - } - }); }); - return ts.map(keywords, getHighlightSpanForNode); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); + } + } + function importerFromModuleSpecifier(moduleSpecifier) { + var decl = moduleSpecifier.parent; + if (decl.kind === 237 || decl.kind === 243) { + return decl; + } + ts.Debug.assert(decl.kind === 247); + return decl.parent; + } + function getImportOrExportSymbol(node, symbol, checker, comingFromExport) { + return comingFromExport ? getExport() : getExport() || getImport(); + function getExport() { + var parent = node.parent; + if (symbol.flags & 7340032) { + if (parent.kind === 178) { + return symbol.declarations.some(function (d) { return d === parent; }) && parent.parent.kind === 193 + ? getSpecialPropertyExport(parent.parent, false) + : undefined; } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86); + else { + var exportSymbol = symbol.exportSymbol; + ts.Debug.assert(!!exportSymbol); + return exportInfo(exportSymbol, getExportKindForDeclaration(parent)); } - return ts.map(keywords, getHighlightSpanForNode); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + else { + var exportNode = parent.kind === 225 ? ts.getAncestor(parent, 207) : parent; + if (ts.hasModifier(exportNode, 1)) { + if (exportNode.kind === 236 && exportNode.moduleReference === node) { + if (comingFromExport) { + return undefined; + } + var lhsSymbol = checker.getSymbolAtLocation(exportNode.name); + return { kind: 0, symbol: lhsSymbol, isNamedImport: false }; + } + else { + return exportInfo(symbol, getExportKindForDeclaration(exportNode)); + } } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - if (ts.isFunctionBlock(owner)) { - ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); + else if (parent.kind === 242) { + var exportingModuleSymbol = parent.symbol.parent; + ts.Debug.assert(!!exportingModuleSymbol); + return { kind: 1, symbol: symbol, exportInfo: { exportingModuleSymbol: exportingModuleSymbol, exportKind: 2 } }; } - return ts.map(keywords, getHighlightSpanForNode); - } - function getReturnOccurrences(returnStatement) { - var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 204))) { - return undefined; + else if (parent.kind === 193) { + return getSpecialPropertyExport(parent, true); } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getIfElseOccurrences(ifStatement) { - var keywords = []; - while (hasKind(ifStatement.parent, 208) && ifStatement.parent.elseStatement === ifStatement) { - ifStatement = ifStatement.parent; - } - while (ifStatement) { - var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 89); - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 81)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 208)) { + else if (parent.parent.kind === 193) { + return getSpecialPropertyExport(parent.parent, true); + } + } + function getSpecialPropertyExport(node, useLhsSymbol) { + var kind; + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 1: + kind = 0; break; - } - ifStatement = ifStatement.elseStatement; + case 2: + kind = 2; + break; + default: + return undefined; } - var result = []; - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 81 && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; - var shouldCombindElseAndIf = true; - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; - continue; - } - } - result.push(getHighlightSpanForNode(keywords[i])); + var sym = useLhsSymbol ? checker.getSymbolAtLocation(node.left.name) : symbol; + return sym && exportInfo(sym, kind); + } + } + function getImport() { + var isImport = isNodeImport(node); + if (!isImport) + return; + var importedSymbol = checker.getImmediateAliasedSymbol(symbol); + if (importedSymbol) { + importedSymbol = skipExportSpecifierSymbol(importedSymbol, checker); + if (importedSymbol.name === "export=") { + importedSymbol = checker.getImmediateAliasedSymbol(importedSymbol); + } + if (symbolName(importedSymbol) === symbol.name) { + return __assign({ kind: 0, symbol: importedSymbol }, isImport); } - return result; } } + function exportInfo(symbol, kind) { + var exportInfo = getExportInfo(symbol, kind, checker); + return exportInfo && { kind: 1, symbol: symbol, exportInfo: exportInfo }; + } + function getExportKindForDeclaration(node) { + return ts.hasModifier(node, 512) ? 1 : 0; + } } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; - function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219; owner = owner.parent) { - if (owner.label.text === labelName) { - return true; + FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; + function isNodeImport(node) { + var parent = node.parent; + switch (parent.kind) { + case 236: + return parent.name === node && isExternalModuleImportEquals(parent) + ? { isNamedImport: false } + : undefined; + case 241: + return parent.propertyName ? undefined : { isNamedImport: true }; + case 238: + case 239: + ts.Debug.assert(parent.name === node); + return { isNamedImport: false }; + default: + return undefined; + } + } + function getExportInfo(exportSymbol, exportKind, checker) { + var exportingModuleSymbol = checker.getMergedSymbol(exportSymbol.parent); + return ts.isExternalModuleSymbol(exportingModuleSymbol) ? { exportingModuleSymbol: exportingModuleSymbol, exportKind: exportKind } : undefined; + } + FindAllReferences.getExportInfo = getExportInfo; + function symbolName(symbol) { + if (symbol.name !== "default") { + return symbol.name; + } + var name = ts.forEach(symbol.declarations, function (_a) { + var name = _a.name; + return name && name.kind === 70 && name.text; + }); + ts.Debug.assert(!!name); + return name; + } + function skipExportSpecifierSymbol(symbol, checker) { + if (symbol.declarations) + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) { + return checker.getExportSpecifierLocalTargetSymbol(declaration); + } } + return symbol; + } + function getContainingModuleSymbol(importer, checker) { + return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); + } + function getSourceFileLikeForImportDeclaration(node) { + if (node.kind === 180) { + return node.getSourceFile(); } - return false; + var parent = node.parent; + if (parent.kind === 264) { + return parent; + } + ts.Debug.assert(parent.kind === 233 && isAmbientModuleDeclaration(parent.parent)); + return parent.parent; } - })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})); + function isAmbientModuleDeclaration(node) { + return node.kind === 232 && node.name.kind === 9; + } + function isExternalModuleImportEquals(_a) { + var moduleReference = _a.moduleReference; + return moduleReference.kind === 247 && moduleReference.expression.kind === 9; + } + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); var ts; (function (ts) { - function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { - if (currentDirectory === void 0) { currentDirectory = ""; } - var buckets = ts.createMap(); - var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyForCompilationSettings(settings) { - return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); + var FindAllReferences; + (function (FindAllReferences) { + function nodeEntry(node, isInString) { + return { type: "node", node: node, isInString: isInString }; } - function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; - if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + FindAllReferences.nodeEntry = nodeEntry; + function findReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position) { + var referencedSymbols = findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position); + if (!referencedSymbols || !referencedSymbols.length) { + return undefined; } - return bucket; + var out = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var _a = referencedSymbols_1[_i], definition = _a.definition, references = _a.references; + if (definition) { + out.push({ definition: definitionToReferencedSymbolDefinitionInfo(definition, checker), references: references.map(toReferenceEntry) }); + } + } + return out; + } + FindAllReferences.findReferencedSymbols = findReferencedSymbols; + function getImplementationsAtPosition(checker, cancellationToken, sourceFiles, sourceFile, position) { + var node = ts.getTouchingPropertyName(sourceFile, position); + var referenceEntries = getImplementationReferenceEntries(checker, cancellationToken, sourceFiles, node); + return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); }); + } + FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; + function getImplementationReferenceEntries(typeChecker, cancellationToken, sourceFiles, node) { + if (node.parent.kind === 261) { + var result_4 = []; + FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, function (node) { return result_4.push(nodeEntry(node)); }); + return result_4; + } + else if (node.kind === 96 || ts.isSuperProperty(node.parent)) { + var symbol = typeChecker.getSymbolAtLocation(node); + return symbol.valueDeclaration && [nodeEntry(symbol.valueDeclaration)]; + } + else { + return getReferenceEntriesForNode(node, sourceFiles, typeChecker, cancellationToken, { implementations: true }); + } + } + function findReferencedEntries(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var x = flattenEntries(findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options)); + return ts.map(x, toReferenceEntry); } - function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; - var sourceFiles = []; - entries.forEachValue(function (key, entry) { - sourceFiles.push({ - name: key, - refCount: entry.languageServiceRefCount, - references: entry.owners.slice(0) - }); - }); - sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); - return { - bucket: name, - sourceFiles: sourceFiles - }; - }); - return JSON.stringify(bucketInfoArray, undefined, 2); + FindAllReferences.findReferencedEntries = findReferencedEntries; + function getReferenceEntriesForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + return flattenEntries(FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options)); } - function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + FindAllReferences.getReferenceEntriesForNode = getReferenceEntriesForNode; + function findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var node = ts.getTouchingPropertyName(sourceFile, position, true); + return FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options); + } + function flattenEntries(referenceSymbols) { + return referenceSymbols && ts.flatMap(referenceSymbols, function (r) { return r.references; }); + } + function definitionToReferencedSymbolDefinitionInfo(def, checker) { + var info = (function () { + switch (def.type) { + case "symbol": { + var symbol = def.symbol, node_2 = def.node; + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var name_3 = displayParts_1.map(function (p) { return p.text; }).join(""); + return { node: node_2, name: name_3, kind: kind_1, displayParts: displayParts_1 }; + } + case "label": { + var node_3 = def.node; + return { node: node_3, name: node_3.text, kind: ts.ScriptElementKind.label, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + } + case "keyword": { + var node_4 = def.node; + var name_4 = ts.tokenToString(node_4.kind); + return { node: node_4, name: name_4, kind: ts.ScriptElementKind.keyword, displayParts: [{ text: name_4, kind: ts.ScriptElementKind.keyword }] }; + } + case "this": { + var node_5 = def.node; + var symbol = checker.getSymbolAtLocation(node_5); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; + return { node: node_5, name: "this", kind: ts.ScriptElementKind.variableElement, displayParts: displayParts_2 }; + } + case "string": { + var node_6 = def.node; + return { node: node_6, name: node_6.text, kind: ts.ScriptElementKind.variableElement, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + } + } + })(); + if (!info) { + return undefined; + } + var node = info.node, name = info.name, kind = info.kind, displayParts = info.displayParts; + var sourceFile = node.getSourceFile(); + return { + containerKind: "", + containerName: "", + fileName: sourceFile.fileName, + kind: kind, + name: name, + textSpan: ts.createTextSpanFromNode(node, sourceFile), + displayParts: displayParts + }; } - function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, true, scriptKind); + function getDefinitionKindAndDisplayParts(symbol, node, checker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + return { displayParts: displayParts, kind: symbolKind }; } - function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + function toReferenceEntry(entry) { + if (entry.type === "span") { + return { textSpan: entry.textSpan, fileName: entry.fileName, isWriteAccess: false, isDefinition: false }; + } + var node = entry.node, isInString = entry.isInString; + return { + fileName: node.getSourceFile().fileName, + textSpan: getTextSpan(node), + isWriteAccess: isWriteAccess(node), + isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node), + isInString: isInString + }; } - function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, false, scriptKind); + function toImplementationLocation(entry, checker) { + if (entry.type === "node") { + var node = entry.node; + return __assign({ textSpan: getTextSpan(node), fileName: node.getSourceFile().fileName }, implementationKindDisplayParts(node, checker)); + } + else { + var textSpan = entry.textSpan, fileName = entry.fileName; + return { textSpan: textSpan, fileName: fileName, kind: ts.ScriptElementKind.unknown, displayParts: [] }; + } } - function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { - var bucket = getBucketForCompilationSettings(key, true); - var entry = bucket.get(path); - if (!entry) { - ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); - var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind); - entry = { - sourceFile: sourceFile, - languageServiceRefCount: 0, - owners: [] + function implementationKindDisplayParts(node, checker) { + var symbol = checker.getSymbolAtLocation(ts.isDeclaration(node) && node.name ? node.name : node); + if (symbol) { + return getDefinitionKindAndDisplayParts(symbol, node, checker); + } + else if (node.kind === 177) { + return { + kind: ts.ScriptElementKind.interfaceElement, + displayParts: [ts.punctuationPart(18), ts.textPart("object literal"), ts.punctuationPart(19)] + }; + } + else if (node.kind === 198) { + return { + kind: ts.ScriptElementKind.localClassElement, + displayParts: [ts.punctuationPart(18), ts.textPart("anonymous local class"), ts.punctuationPart(19)] }; - bucket.set(path, entry); } else { - if (entry.sourceFile.version !== version) { - entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); - } + return { kind: ts.getNodeKind(node), displayParts: [] }; } - if (acquiring) { - entry.languageServiceRefCount++; + } + function toHighlightSpan(entry) { + if (entry.type === "span") { + var fileName_1 = entry.fileName, textSpan = entry.textSpan; + return { fileName: fileName_1, span: { textSpan: textSpan, kind: ts.HighlightSpanKind.reference } }; } - return entry.sourceFile; + var node = entry.node, isInString = entry.isInString; + var fileName = entry.node.getSourceFile().fileName; + var writeAccess = isWriteAccess(node); + var span = { + textSpan: getTextSpan(node), + kind: writeAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference, + isInString: isInString + }; + return { fileName: fileName, span: span }; } - function releaseDocument(fileName, compilationSettings) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return releaseDocumentWithKey(path, key); + FindAllReferences.toHighlightSpan = toHighlightSpan; + function getTextSpan(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 9) { + start += 1; + end -= 1; + } + return ts.createTextSpanFromBounds(start, end); } - function releaseDocumentWithKey(path, key) { - var bucket = getBucketForCompilationSettings(key, false); - ts.Debug.assert(bucket !== undefined); - var entry = bucket.get(path); - entry.languageServiceRefCount--; - ts.Debug.assert(entry.languageServiceRefCount >= 0); - if (entry.languageServiceRefCount === 0) { - bucket.remove(path); + function isWriteAccess(node) { + if (node.kind === 70 && ts.isDeclarationName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 192 || parent.kind === 191) { + return true; + } + else if (parent.kind === 193 && parent.left === node) { + var operator = parent.operatorToken.kind; + return 57 <= operator && operator <= 69; + } } + return false; } - return { - acquireDocument: acquireDocument, - acquireDocumentWithKey: acquireDocumentWithKey, - updateDocument: updateDocument, - updateDocumentWithKey: updateDocumentWithKey, - releaseDocument: releaseDocument, - releaseDocumentWithKey: releaseDocumentWithKey, - reportStats: reportStats, - getKeyForCompilationSettings: getKeyForCompilationSettings - }; - } - ts.createDocumentRegistry = createDocumentRegistry; + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); -var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { - var node = ts.getTouchingPropertyName(sourceFile, position, true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; + var Core; + (function (Core) { + function getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + if (node.kind === 264) { + return undefined; + } + if (!options.implementations) { + var special = getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken); + if (special) { + return special; } - case 70: - case 98: - case 122: - case 9: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, false); + } + var symbol = checker.getSymbolAtLocation(node); + if (!symbol) { + if (!options.implementations && node.kind === 9) { + return getReferencesForStringLiteral(node, sourceFiles, cancellationToken); + } + return undefined; + } + if (!symbol.declarations || !symbol.declarations.length) { + return undefined; + } + return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options); } - return undefined; - } - FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { - if (!implementations) { + Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } if (ts.isLabelName(node)) { if (ts.isJumpStatementTarget(node)) { var labelDefinition = ts.getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition); } else { return getLabelReferencesInNode(node.parent, node); } } if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); + return getReferencesForThisKeyword(node, sourceFiles, cancellationToken); } if (node.kind === 96) { return getReferencesForSuperKeyword(node); } - } - var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9) { - return getReferencesForStringLiteral(node, sourceFiles); - } - if (!symbol) { return undefined; } - var declarations = symbol.declarations; - if (!declarations || !declarations.length) { - return undefined; - } - var result; - var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); - var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var scope = getSymbolScope(symbol); - var symbolToIndex = []; - if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); - } - else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; - cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + function getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options) { + symbol = skipPastExportOrImportSpecifier(symbol, node, checker); + var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), symbol.declarations); + var result = []; + var state = createState(sourceFiles, node, checker, cancellationToken, searchMeaning, options, result); + var search = state.createSearch(node, symbol, undefined, { allSearchSymbols: populateSearchSymbolSet(symbol, node, checker, options.implementations) }); + var scope = getSymbolScope(symbol); + if (scope) { + getReferencesInContainer(scope, scope.getSourceFile(), search, state); + } + else { + for (var _i = 0, _a = state.sourceFiles; _i < _a.length; _i++) { + var sourceFile = _a[_i]; + state.cancellationToken.throwIfCancellationRequested(); + searchForName(sourceFile, search, state); } } + return result; } - return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + function skipPastExportOrImportSpecifier(symbol, node, checker) { + var parent = node.parent; + if (ts.isExportSpecifier(parent)) { + return getLocalSymbolForExportSpecifier(node, symbol, parent, checker); + } + if (ts.isImportSpecifier(parent) && parent.propertyName === node) { + return checker.getImmediateAliasedSymbol(symbol); + } + return symbol; + } + function createState(sourceFiles, originalLocation, checker, cancellationToken, searchMeaning, options, result) { + var symbolIdToReferences = []; + var inheritsFromCache = ts.createMap(); + var sourceFileToSeenSymbols = []; + var isForConstructor = originalLocation.kind === 122; + var importTracker; + return __assign({}, options, { sourceFiles: sourceFiles, isForConstructor: isForConstructor, checker: checker, cancellationToken: cancellationToken, searchMeaning: searchMeaning, inheritsFromCache: inheritsFromCache, getImportSearches: getImportSearches, createSearch: createSearch, referenceAdder: referenceAdder, addStringOrCommentReference: addStringOrCommentReference, + markSearchedSymbol: markSearchedSymbol, markSeenContainingTypeReference: ts.nodeSeenTracker(), markSeenReExportRHS: ts.nodeSeenTracker() }); + function getImportSearches(exportSymbol, exportInfo) { + if (!importTracker) + importTracker = FindAllReferences.createImportTracker(sourceFiles, checker, cancellationToken); + return importTracker(exportSymbol, exportInfo, options.isForRename); + } + function createSearch(location, symbol, comingFrom, searchOptions) { + if (searchOptions === void 0) { searchOptions = {}; } + var _a = searchOptions.text, text = _a === void 0 ? ts.stripQuotes(ts.getDeclaredName(checker, symbol, location)) : _a, _b = searchOptions.allSearchSymbols, allSearchSymbols = _b === void 0 ? undefined : _b; + var escapedText = ts.escapeIdentifier(text); + var parents = options.implementations && getParentSymbolsOfPropertyAccess(location, symbol, checker); + return { location: location, symbol: symbol, comingFrom: comingFrom, text: text, escapedText: escapedText, parents: parents, includes: includes }; + function includes(referenceSymbol) { + return allSearchSymbols ? ts.contains(allSearchSymbols, referenceSymbol) : referenceSymbol === symbol; + } + } + function referenceAdder(referenceSymbol, searchLocation) { + var symbolId = ts.getSymbolId(referenceSymbol); + var references = symbolIdToReferences[symbolId]; + if (!references) { + references = symbolIdToReferences[symbolId] = []; + result.push({ definition: { type: "symbol", symbol: referenceSymbol, node: searchLocation }, references: references }); + } + return function (node) { return references.push(FindAllReferences.nodeEntry(node)); }; + } + function addStringOrCommentReference(fileName, textSpan) { + result.push({ + definition: undefined, + references: [{ type: "span", fileName: fileName, textSpan: textSpan }] + }); + } + function markSearchedSymbol(sourceFile, symbol) { + var sourceId = ts.getNodeId(sourceFile); + var symbolId = ts.getSymbolId(symbol); + var seenSymbols = sourceFileToSeenSymbols[sourceId] || (sourceFileToSeenSymbols[sourceId] = []); + return !seenSymbols[symbolId] && (seenSymbols[symbolId] = true); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608) { - var defaultImport = ts.getDeclarationOfKind(symbol, 236); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); + function searchForImportsOfExport(exportLocation, exportSymbol, exportInfo, state) { + var _a = state.getImportSearches(exportSymbol, exportInfo), importSearches = _a.importSearches, singleReferences = _a.singleReferences, indirectUsers = _a.indirectUsers; + if (singleReferences.length) { + var addRef = state.referenceAdder(exportSymbol, exportLocation); + for (var _i = 0, singleReferences_1 = singleReferences; _i < singleReferences_1.length; _i++) { + var singleRef = singleReferences_1[_i]; + addRef(singleRef); + } + } + for (var _b = 0, importSearches_1 = importSearches; _b < importSearches_1.length; _b++) { + var _c = importSearches_1[_b], importLocation = _c[0], importSymbol = _c[1]; + getReferencesInSourceFile(importLocation.getSourceFile(), state.createSearch(importLocation, importSymbol, 1), state); + } + if (indirectUsers.length) { + var indirectSearch = void 0; + switch (exportInfo.exportKind) { + case 0: + indirectSearch = state.createSearch(exportLocation, exportSymbol, 1); + break; + case 1: + indirectSearch = state.isForRename ? undefined : state.createSearch(exportLocation, exportSymbol, 1, { text: "default" }); + break; + case 2: + break; } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 || - declaration.kind === 243) ? declaration : undefined; }); - if (importOrExportSpecifier && - (!importOrExportSpecifier.propertyName || - importOrExportSpecifier.propertyName === location)) { - return importOrExportSpecifier.kind === 239 ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + if (indirectSearch) { + for (var _d = 0, indirectUsers_1 = indirectUsers; _d < indirectUsers_1.length; _d++) { + var indirectUser = indirectUsers_1[_d]; + searchForName(indirectUser, indirectSearch, state); + } } } - return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + function searchForImportedSymbol(symbol, state) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + getReferencesInSourceFile(declaration.getSourceFile(), state.createSearch(declaration, symbol, 0), state); + } + } + function searchForName(sourceFile, search, state) { + if (ts.getNameTable(sourceFile).get(search.escapedText) !== undefined) { + getReferencesInSourceFile(sourceFile, search, state); + } } - function getPropertySymbolOfDestructuringAssignment(location) { + function getPropertySymbolOfDestructuringAssignment(location, checker) { return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + checker.getPropertySymbolOfDestructuringAssignment(location); } function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); + var bindingElement = ts.getDeclarationOfKind(symbol, 175); return bindingElement && - bindingElement.parent.kind === 172 && + bindingElement.parent.kind === 173 && !bindingElement.propertyName; } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + var bindingElement = ts.getDeclarationOfKind(symbol, 175); + var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); } return undefined; } - function getInternedName(symbol, location) { - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); - } function getSymbolScope(symbol) { - var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 184 || valueDeclaration.kind === 197)) { + var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 185 || valueDeclaration.kind === 198)) { return valueDeclaration; } - if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); + if (!declarations) { + return undefined; + } + if (flags & (4 | 8192)) { + var privateDeclaration = ts.find(declarations, function (d) { return !!(ts.getModifierFlags(d) & 8); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226); + return ts.getAncestor(privateDeclaration, 228); } } - if (symbol.flags & 8388608) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { return undefined; } - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + if (parent && !((parent.flags & 1536) && ts.isExternalModuleSymbol(parent) && !parent.globalExports)) { return undefined; } - if (symbol.parent || (symbol.flags & 268435456)) { + if ((flags & 134217728 && symbol.checkFlags & 6)) { return undefined; } var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - return undefined; - } - if (container.kind === 261 && !ts.isExternalModule(container)) { - return undefined; - } - scope = container; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; + var container = ts.getContainerNode(declaration); + if (scope && scope !== container) { + return undefined; } + if (!container || container.kind === 264 && !ts.isExternalOrCommonJsModule(container)) { + return undefined; + } + scope = container; } - return scope; + return parent ? scope.getSourceFile() : scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { var positions = []; @@ -56390,7 +62546,6 @@ var ts; var symbolNameLength = symbolName.length; var position = text.indexOf(symbolName, start); while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); if (position > end) break; var endPosition = position + symbolNameLength; @@ -56407,242 +62562,277 @@ var ts; var sourceFile = container.getSourceFile(); var labelName = targetLabel.text; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.getWidth() !== labelName.length) { - return; + continue; } if (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "label", node: targetLabel }, references: references }]; } function isValidReferencePosition(node, searchSymbolName) { - if (node) { - switch (node.kind) { - case 70: - return node.getWidth() === searchSymbolName.length; - case 9: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + switch (node && node.kind) { + case 70: + return node.getWidth() === searchSymbolName.length; + case 9: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + node.getWidth() === searchSymbolName.length + 2; + case 8: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, ts.tokenToString(keywordKind), references); + } + return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd()); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push(FindAllReferences.nodeEntry(referenceLocation)); } } - return false; } - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); - if (!isValidReferencePosition(referenceLocation, searchText)) { - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); - } - } - }); + function getReferencesInSourceFile(sourceFile, search, state) { + state.cancellationToken.throwIfCancellationRequested(); + return getReferencesInContainer(sourceFile, sourceFile, search, state); + } + function getReferencesInContainer(container, sourceFile, search, state) { + if (!state.markSearchedSymbol(sourceFile, search.symbol)) { + return; } - return; - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } - } - } + var start = state.findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, search.text, start, container.getEnd()); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + getReferencesAtLocation(sourceFile, position, search, state); + } + } + function getReferencesAtLocation(sourceFile, position, search, state) { + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, search.text)) { + if (!state.implementations && (state.findInStrings && ts.isInString(sourceFile, position) || state.findInComments && ts.isInNonReferenceComment(sourceFile, position))) { + state.addStringOrCommentReference(sourceFile.fileName, ts.createTextSpan(position, search.text.length)); } + return; + } + if (!(ts.getMeaningFromLocation(referenceLocation) & state.searchMeaning)) { + return; + } + var referenceSymbol = state.checker.getSymbolAtLocation(referenceLocation); + if (!referenceSymbol) { + return; + } + var parent = referenceLocation.parent; + if (ts.isImportSpecifier(parent) && parent.propertyName === referenceLocation) { + return; + } + if (ts.isExportSpecifier(parent)) { + ts.Debug.assert(referenceLocation.kind === 70); + getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state); + return; + } + var relatedSymbol = getRelatedSymbol(search, referenceSymbol, referenceLocation, state); + if (!relatedSymbol) { + getReferenceForShorthandProperty(referenceSymbol, search, state); + return; + } + if (state.isForConstructor) { + findConstructorReferences(referenceLocation, sourceFile, search, state); } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + else { + addReference(referenceLocation, relatedSymbol, search.location, state); + } + getImportOrExportReferences(referenceLocation, referenceSymbol, search, state); + } + function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + var exportDeclaration = parent.parent; + var localSymbol = getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, state.checker); + if (!search.includes(localSymbol)) { + return; } - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - addReferences(findOwnConstructorCalls(searchSymbol)); + if (!propertyName) { + addRef(); + } + else if (referenceLocation === propertyName) { + if (!exportDeclaration.moduleSpecifier) { + addRef(); } - else { - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + if (!state.isForRename && state.markSeenReExportRHS(name)) { + addReference(name, referenceSymbol, name, state); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); + else { + if (state.markSeenReExportRHS(referenceLocation)) { + addRef(); } } - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } - }); - return result; + if (!(referenceLocation === propertyName && state.isForRename)) { + var exportKind = referenceLocation.originalKeywordKind === 78 ? 1 : 0; + var exportInfo = FindAllReferences.getExportInfo(referenceSymbol, exportKind, state.checker); + ts.Debug.assert(!!exportInfo); + searchForImportsOfExport(referenceLocation, referenceSymbol, exportInfo, state); } - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; + if (search.comingFrom !== 1 && exportDeclaration.moduleSpecifier && !propertyName) { + searchForImportedSymbol(state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier), state); + } + function addRef() { + addReference(referenceLocation, localSymbol, search.location, state); + } + } + function getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, checker) { + return isExportSpecifierAlias(referenceLocation, exportSpecifier) ? checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) : referenceSymbol; + } + function isExportSpecifierAlias(referenceLocation, exportSpecifier) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + ts.Debug.assert(propertyName === referenceLocation || name === referenceLocation); + if (propertyName) { + return propertyName === referenceLocation; + } + else { + return !parent.parent.moduleSpecifier; + } + } + function getImportOrExportReferences(referenceLocation, referenceSymbol, search, state) { + var importOrExport = FindAllReferences.getImportOrExportSymbol(referenceLocation, referenceSymbol, state.checker, search.comingFrom === 1); + if (!importOrExport) + return; + var symbol = importOrExport.symbol; + if (importOrExport.kind === 0) { + if (!state.isForRename || importOrExport.isNamedImport) { + searchForImportedSymbol(symbol, state); } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); + } + else { + searchForImportsOfExport(referenceLocation, symbol, importOrExport.exportInfo, state); + } + } + function getReferenceForShorthandProperty(_a, search, state) { + var flags = _a.flags, valueDeclaration = _a.valueDeclaration; + var shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration); + if (!(flags & 134217728) && search.includes(shorthandValueSymbol)) { + addReference(valueDeclaration.name, shorthandValueSymbol, search.location, state); + } + } + function addReference(referenceLocation, relatedSymbol, searchLocation, state) { + var addRef = state.referenceAdder(relatedSymbol, searchLocation); + if (state.implementations) { + addImplementationReferences(referenceLocation, addRef, state); + } + else { + addRef(referenceLocation); + } + } + function findConstructorReferences(referenceLocation, sourceFile, search, state) { + if (ts.isNewExpressionTarget(referenceLocation)) { + addReference(referenceLocation, search.symbol, search.location, state); + } + var pusher = state.referenceAdder(search.symbol, search.location); + if (ts.isClassLike(referenceLocation.parent)) { + ts.Debug.assert(referenceLocation.parent.name === referenceLocation); + findOwnConstructorReferences(search.symbol, sourceFile, pusher); + } + else { + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending)) { + findSuperConstructorAccesses(classExtending, pusher); + } + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + function findOwnConstructorReferences(classSymbol, sourceFile, addNode) { + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122, sourceFile); + ts.Debug.assert(decl.kind === 151 && !!ctrKeyword); + addNode(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150) { var body = decl.body; if (body) { - forEachDescendantOfKind(body, 96, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); + forEachDescendantOfKind(body, 98, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + addNode(thisKeyword); } }); } } - ; - return result; + }); + } + function findSuperConstructorAccesses(cls, addNode) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return; } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96, function (node) { + if (ts.isCallExpressionTarget(node)) { + addNode(node); + } }); } - return result[index]; - } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } } } - function getImplementationReferenceEntryForNode(refNode, result) { + function addImplementationReferences(refNode, addReference, state) { if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + addReference(refNode.parent); + return; } - else if (refNode.kind === 70) { - if (refNode.parent.kind === 258) { - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); - } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); - } + if (refNode.kind !== 70) { + return; + } + if (refNode.parent.kind === 261) { + getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); + } + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + addReference(containingClass); + return; + } + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference && state.markSeenContainingTypeReference(containingTypeReference)) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + addReference(parent.initializer); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + addReference(returnStatement.expression); + } + }); } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (isImplementationExpression(parent.body)) { + addReference(parent.body); } } - } - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + addReference(parent.expression); } } } @@ -56671,28 +62861,32 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 199 - && node.parent.kind === 255 + if (node.kind === 200 + && node.parent.kind === 258 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 70 || node.kind === 177) { + else if (node.kind === 70 || node.kind === 178) { return getContainingClassIfInHeritageClause(node.parent); } } return undefined; } function isImplementationExpression(node) { - if (node.kind === 183) { - return isImplementationExpression(node.expression); + switch (node.kind) { + case 184: + return isImplementationExpression(node.expression); + case 186: + case 185: + case 177: + case 198: + case 176: + return true; + default: + return false; } - return node.kind === 185 || - node.kind === 184 || - node.kind === 176 || - node.kind === 197 || - node.kind === 175; } - function explicitlyInheritsFrom(child, parent, cachedResults) { + function explicitlyInheritsFrom(child, parent, cachedResults, checker) { var parentIsInterface = parent.getFlags() & 64; return searchHierarchy(child); function searchHierarchy(symbol) { @@ -56700,10 +62894,11 @@ var ts; return true; } var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; } - cachedResults[key] = false; + cachedResults.set(key, false); var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { if (ts.isClassLike(declaration)) { if (parentIsInterface) { @@ -56719,19 +62914,19 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227) { + else if (declaration.kind === 229) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; }); - cachedResults[key] = inherits; + cachedResults.set(key, inherits); return inherits; } function searchTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type && type.symbol) { return searchHierarchy(type.symbol); } @@ -56746,13 +62941,13 @@ var ts; } var staticFlag = 32; switch (searchSpaceNode.kind) { - case 147: - case 146: - case 149: case 148: + case 147: case 150: + case 149: case 151: case 152: + case 153: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; @@ -56762,51 +62957,51 @@ var ts; var references = []; var sourceFile = searchSpaceNode.getSourceFile(); var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.kind !== 96) { - return; + continue; } var container = ts.getSuperContainer(node, false); if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "symbol", symbol: searchSpaceNode.symbol, node: superKeyword }, references: references }]; } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 32; switch (searchSpaceNode.kind) { + case 150: case 149: - case 148: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } + case 148: case 147: - case 146: - case 150: case 151: case 152: + case 153: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 261: + case 264: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 225: - case 184: + case 227: + case 185: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261) { + if (searchSpaceNode.kind === 264) { ts.forEach(sourceFiles, function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); }); @@ -56816,139 +63011,109 @@ var ts; possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, + definition: { type: "this", node: thisOrSuperKeyword }, references: references }]; function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); if (!node || !ts.isThis(node)) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 184: - case 225: + case 185: + case 227: if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; + case 150: case 149: - case 148: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 197: - case 226: + case 198: + case 228: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 261: - if (container.kind === 261 && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); + case 264: + if (container.kind === 264 && !ts.isExternalModule(container)) { + result.push(FindAllReferences.nodeEntry(node)); } break; } }); } } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - return undefined; - } + function getReferencesForStringLiteral(node, sourceFiles, cancellationToken) { var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; + cancellationToken.throwIfCancellationRequested(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, node.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, node.text, possiblePositions, references); } return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, + definition: { type: "string", node: node }, references: references }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9) { - return; - } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { + for (var _i = 0, possiblePositions_5 = possiblePositions; _i < possiblePositions_5.length; _i++) { + var position = possiblePositions_5[_i]; + var node_7 = ts.getTouchingWord(sourceFile, position); + if (node_7 && node_7.kind === 9 && node_7.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_7, true)); } } } } - function populateSearchSymbolSet(symbol, location) { + function populateSearchSymbolSet(symbol, location, checker, implementations) { var result = [symbol]; - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + if (containingObjectLiteralElement.kind !== 261) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); + if (propertySymbol) { + result.push(propertySymbol); + } + } + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), function (contextualSymbol) { + ts.addRange(result, checker.getRootSymbols(contextualSymbol)); }); - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + var shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { result.push(shorthandValueSymbol); } } - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 && + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + ts.addRange(result, checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); if (bindingElementPropertySymbol) { result.push(bindingElementPropertySymbol); } - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + for (var _i = 0, _a = checker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; if (rootSymbol !== symbol) { result.push(rootSymbol); } if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap()); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), checker); } - }); + } return result; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { if (!symbol) { return; } - if (symbol.name in previousIterationSymbolsCache) { + if (previousIterationSymbolsCache.has(symbol.name)) { return; } if (symbol.flags & (32 | 64)) { @@ -56957,7 +63122,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227) { + else if (declaration.kind === 229) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -56965,62 +63130,56 @@ var ts; return; function getPropertySymbolFromTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); + result.push.apply(result, checker.getRootSymbols(propertySymbol)); } - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); } } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; + function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) { + if (search.includes(referenceSymbol)) { + return referenceSymbol; } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); - } - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(referenceLocation); if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, state.checker), function (contextualSymbol) { + return ts.find(state.checker.getRootSymbols(contextualSymbol), search.includes); }); if (contextualSymbol) { return contextualSymbol; } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, state.checker); + if (propertySymbol && search.includes(propertySymbol)) { return propertySymbol; } } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, state.checker); + if (bindingElementPropertySymbol && search.includes(bindingElementPropertySymbol)) { return bindingElementPropertySymbol; } - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { - if (searchSymbols.indexOf(rootSymbol) >= 0) { + return ts.forEach(state.checker.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (search.includes(rootSymbol)) { return rootSymbol; } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, state.checker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), state.checker); + return ts.find(result, search.includes); } return undefined; }); } function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -57029,15 +63188,15 @@ var ts; } return node.name.text; } - function getPropertySymbolsFromContextualType(node) { + function getPropertySymbolsFromContextualType(node, checker) { var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); + var contextualType = checker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); + var symbol = contextualType.getProperty(name); + if (symbol) { + result_5.push(symbol); } if (contextualType.flags & 65536) { ts.forEach(contextualType.types, function (t) { @@ -57056,8 +63215,8 @@ var ts; var lastIterationMeaning = void 0; do { lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; var declarationMeaning = ts.getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -57067,137 +63226,86 @@ var ts; } return meaning; } - } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; - function convertReferences(referenceSymbols) { - if (!referenceSymbols) { - return undefined; - } - var referenceEntries = []; - for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { - var referenceSymbol = referenceSymbols_1[_i]; - ts.addRange(referenceEntries, referenceSymbol.references); - } - return referenceEntries; - } - FindAllReferences.convertReferences = convertReferences; - function isImplementation(node) { - if (!node) { - return false; - } - else if (ts.isVariableLike(node)) { - if (node.initializer) { - return true; - } - else if (node.kind === 223) { - var parentStatement = getParentStatementOfVariableDeclaration(node); - return parentStatement && ts.hasModifier(parentStatement, 2); + function isImplementation(node) { + if (!node) { + return false; } - } - else if (ts.isFunctionLike(node)) { - return !!node.body || ts.hasModifier(node, 2); - } - else { - switch (node.kind) { - case 226: - case 197: - case 229: - case 230: + else if (ts.isVariableLike(node)) { + if (node.initializer) { return true; + } + else if (node.kind === 225) { + var parentStatement = getParentStatementOfVariableDeclaration(node); + return parentStatement && ts.hasModifier(parentStatement, 2); + } + } + else if (ts.isFunctionLike(node)) { + return !!node.body || ts.hasModifier(node, 2); + } + else { + switch (node.kind) { + case 228: + case 198: + case 231: + case 232: + return true; + } } + return false; } - return false; - } - function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205) { - ts.Debug.assert(node.parent.kind === 224); - return node.parent.parent; + function getParentStatementOfVariableDeclaration(node) { + if (node.parent && node.parent.parent && node.parent.parent.kind === 207) { + ts.Debug.assert(node.parent.kind === 226); + return node.parent.parent; + } } - } - function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) { - var refSymbol = typeChecker.getSymbolAtLocation(node); - var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); - if (shorthandSymbol) { - for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { - var declaration = _a[_i]; - if (ts.getMeaningFromDeclaration(declaration) & 1) { - result.push(getReferenceEntryFromNode(declaration)); + function getReferenceEntriesForShorthandPropertyAssignment(node, checker, addReference) { + var refSymbol = checker.getSymbolAtLocation(node); + var shorthandSymbol = checker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); + if (shorthandSymbol) { + for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.getMeaningFromDeclaration(declaration) & 1) { + addReference(declaration); + } } } } - } - FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; - function getReferenceEntryFromNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - if (node.kind === 9) { - start += 1; - end -= 1; + Core.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; + function forEachDescendantOfKind(node, kind, action) { + ts.forEachChild(node, function (child) { + if (child.kind === kind) { + action(child); + } + forEachDescendantOfKind(child, kind, action); + }); } - return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - isWriteAccess: isWriteAccess(node), - isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - }; - } - FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode; - function isWriteAccess(node) { - if (node.kind === 70 && ts.isDeclarationName(node)) { - return true; + function tryGetClassByExtendingIdentifier(node) { + return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); } - var parent = node.parent; - if (parent) { - if (parent.kind === 191 || parent.kind === 190) { - return true; - } - else if (parent.kind === 192 && parent.left === node) { - var operator = parent.operatorToken.kind; - return 57 <= operator && operator <= 69; + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 9) { + return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } + return false; } - return false; - } - function forEachDescendantOfKind(node, kind, action) { - ts.forEachChild(node, function (child) { - if (child.kind === kind) { - action(child); + function getParentSymbolsOfPropertyAccess(location, symbol, checker) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); + if (!propertyAccessExpression) { + return undefined; + } + var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); + if (!localParentType) { + return undefined; + } + if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== symbol.parent) { + return [localParentType.symbol]; + } + else if (localParentType.flags & 196608) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } - forEachDescendantOfKind(child, kind, action); - }); - } - function getContainingObjectLiteralElement(node) { - switch (node.kind) { - case 9: - case 8: - if (node.parent.kind === 142) { - return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; - } - case 70: - return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; - } - return undefined; - } - function isObjectLiteralPropertyDeclaration(node) { - switch (node.kind) { - case 257: - case 258: - case 149: - case 151: - case 152: - return true; - } - return false; - } - function tryGetClassByExtendingIdentifier(node) { - return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); - } - function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 9) { - return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } - return false; - } + })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); var ts; @@ -57215,11 +63323,9 @@ var ts; } var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -57228,7 +63334,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -57243,11 +63349,11 @@ var ts; var declaration = symbol.declarations[0]; if (node.kind === 70 && (node.parent === declaration || - (declaration.kind === 239 && declaration.parent && declaration.parent.kind === 238))) { + (declaration.kind === 241 && declaration.parent && declaration.parent.kind === 240))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 258) { + if (node.parent.kind === 261) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -57258,6 +63364,22 @@ var ts; var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } + if (ts.isJsxOpeningLikeElement(node.parent)) { + var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName; + return [createDefinitionInfo(symbol.valueDeclaration, symbolKind, symbolName, containerName)]; + } + var element = ts.getContainingObjectLiteralElement(node); + if (element) { + if (typeChecker.getContextualType(element.parent)) { + var result = []; + var propertySymbols = ts.getPropertySymbolsFromContextualType(typeChecker, element); + for (var _i = 0, propertySymbols_1 = propertySymbols; _i < propertySymbols_1.length; _i++) { + var propertySymbol = propertySymbols_1[_i]; + result.push.apply(result, getDefinitionFromSymbol(typeChecker, propertySymbol, node)); + } + return result; + } + } return getDefinitionFromSymbol(typeChecker, symbol, node); } GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition; @@ -57321,31 +63443,45 @@ var ts; return false; } function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + if (!signatureDeclarations) { + return false; + } var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150) || - (!selectConstructors && (d.kind === 225 || d.kind === 149 || d.kind === 148))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151: + case 227: + case 150: + case 149: + return true; + default: + return false; + } + } function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -57392,37 +63528,16 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; - } - })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var GoToImplementation; - (function (GoToImplementation) { - function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - if (node.parent.kind === 258) { - var result = []; - ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); - return result.length > 0 ? result : undefined; - } - else if (node.kind === 96 || ts.isSuperProperty(node.parent)) { - var symbol = typeChecker.getSymbolAtLocation(node); - return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)]; - } - else { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, true); - var result = ts.flatMap(referencedSymbols, function (symbol) { - return ts.map(symbol.references, function (_a) { - var textSpan = _a.textSpan, fileName = _a.fileName; - return ({ textSpan: textSpan, fileName: fileName }); - }); - }); - return result && result.length > 0 ? result : undefined; + var signature = callLike && typeChecker.getResolvedSignature(callLike); + if (signature) { + var decl = signature.declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } } + return undefined; } - GoToImplementation.getImplementationAtPosition = getImplementationAtPosition; - })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {})); + })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); var ts; (function (ts) { @@ -57451,6 +63566,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -57469,7 +63585,8 @@ var ts; "prop", "version" ]; - var jsDocCompletionEntries; + var jsDocTagNameCompletionEntries; + var jsDocTagCompletionEntries; function getJsDocCommentsFromDeclarations(declarations) { var documentationComment = []; forEachUnique(declarations, function (declaration) { @@ -57490,9 +63607,32 @@ var ts; return documentationComment; } JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; + function getJsDocTagsFromDeclarations(declarations) { + var tags = []; + forEachUnique(declarations, function (declaration) { + var jsDocs = ts.getJSDocs(declaration); + if (!jsDocs) { + return; + } + for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) { + var doc = jsDocs_1[_i]; + var tagsForDoc = doc.tags; + if (tagsForDoc) { + tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 283; }).map(function (jsDocTag) { + return { + name: jsDocTag.tagName.text, + text: jsDocTag.comment + }; + })); + } + } + }); + return tags; + } + JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations; function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -57503,8 +63643,8 @@ var ts; } return undefined; } - function getAllJsDocCompletionEntries() { - return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + function getJSDocTagNameCompletions() { + return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: tagName, kind: ts.ScriptElementKind.keyword, @@ -57513,7 +63653,18 @@ var ts; }; })); } - JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries; + JsDoc.getJSDocTagNameCompletions = getJSDocTagNameCompletions; + function getJSDocTagCompletions() { + return jsDocTagCompletionEntries || (jsDocTagCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + return { + name: "@" + tagName, + kind: ts.ScriptElementKind.keyword, + kindModifiers: "", + sortText: "0" + }; + })); + } + JsDoc.getJSDocTagCompletions = getJSDocTagCompletions; function getDocCommentTemplateAtPosition(newLine, sourceFile, position) { if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { return undefined; @@ -57526,16 +63677,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225: - case 149: + case 227: case 150: - case 226: - case 205: + case 151: + case 228: + case 207: break findOwner; - case 261: + case 264: return undefined; - case 230: - if (commentOwner.parent.kind === 230) { + case 232: + if (commentOwner.parent.kind === 232) { return undefined; } break findOwner; @@ -57547,14 +63698,20 @@ var ts; var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; - var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character).replace(/\S/i, function () { return " "; }); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } var preamble = "/**" + newLine + indentationStr + " * "; @@ -57569,7 +63726,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205) { + if (commentOwner.kind === 207) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -57579,17 +63736,17 @@ var ts; return ts.emptyArray; } function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183) { + while (rightHandSide.kind === 184) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184: case 185: + case 186: return rightHandSide.parameters; - case 197: + case 198: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { return member.parameters; } } @@ -57600,47 +63757,212 @@ var ts; })(JsDoc = ts.JsDoc || (ts.JsDoc = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + var safeList; + var EmptySafeList = ts.createMap(); + JsTyping.nodeCoreModuleList = [ + "buffer", "querystring", "events", "http", "cluster", + "zlib", "os", "https", "punycode", "repl", "readline", + "vm", "child_process", "url", "dns", "net", + "dgram", "fs", "path", "string_decoder", "tls", + "crypto", "stream", "util", "assert", "tty", "domain", + "constants", "process", "v8", "timers", "console" + ]; + var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { + var inferredTypings = ts.createMap(); + if (!typeAcquisition || !typeAcquisition.enable) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { + var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); + return kind === 1 || kind === 2; + }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; + } + var filesToWatch = []; + var searchDirs = []; + var exclude = []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var bowerComponentsPath = ts.combinePaths(searchDir, "bower_components"); + getTypingNamesFromPackagesFolder(bowerComponentsPath); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromPackagesFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + if (unresolvedImports) { + for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { + var moduleId = unresolvedImports_1[_a]; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); + } + } + } + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); + } + }); + for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { + var excludeTypingName = exclude_1[_b]; + inferredTypings.delete(excludeTypingName); + } + var newTypingNames = []; + var cachedTypingPaths = []; + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); + } + else { + newTypingNames.push(typing); + } + }); + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); + } + } + } + function getTypingNamesFromJson(jsonPath, filesToWatch) { + if (host.fileExists(jsonPath)) { + filesToWatch.push(jsonPath); + } + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + if (jsonConfig.dependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); + } + } + } + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList !== EmptySafeList) { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + function getTypingNamesFromPackagesFolder(packagesFolderPath) { + filesToWatch.push(packagesFolderPath); + if (!host.directoryExists(packagesFolderPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(packagesFolderPath, [".json"], undefined, undefined, 2); + for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { + var fileName = fileNames_2[_i]; + var normalizedFileName = ts.normalizePath(fileName); + var baseFileName = ts.getBaseFileName(normalizedFileName); + if (baseFileName !== "package.json" && baseFileName !== "bower.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + if (baseFileName === "package.json" && packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings.set(packageJson.name, absolutePath); + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var NavigateTo; (function (NavigateTo) { function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_46 in nameToDeclarations) { - var declarations = nameToDeclarations[name_46]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; } - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) { + var declaration = declarations_12[_i]; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; } - matches = patternMatcher.getMatches(containers, name_46); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; + _loop_4(sourceFile); + } rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 || decl.kind === 239 || decl.kind === 234) { + if (decl.kind === 238 || decl.kind === 241 || decl.kind === 236) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -57681,7 +64003,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142) { + else if (declaration.name.kind === 143) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -57698,7 +64020,7 @@ var ts; } return true; } - if (expression.kind === 177) { + if (expression.kind === 178) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -57709,7 +64031,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -57750,7 +64072,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" }; @@ -57763,21 +64085,41 @@ var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { - function getNavigationBarItems(sourceFile) { + var whiteSpaceRegex = /\s+/g; + var curCancellationToken; + var curSourceFile; + var parentsStack = []; + var parent; + var emptyChildItemArray = []; + function getNavigationBarItems(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); - curSourceFile = undefined; - return result; + try { + return ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); + } + finally { + reset(); + } } NavigationBar.getNavigationBarItems = getNavigationBarItems; - function getNavigationTree(sourceFile) { + function getNavigationTree(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = convertToTree(rootNavigationBarNode(sourceFile)); - curSourceFile = undefined; - return result; + try { + return convertToTree(rootNavigationBarNode(sourceFile)); + } + finally { + reset(); + } } NavigationBar.getNavigationTree = getNavigationTree; - var curSourceFile; + function reset() { + curSourceFile = undefined; + curCancellationToken = undefined; + parentsStack = []; + parent = undefined; + emptyChildItemArray = []; + } function nodeText(node) { return node.getText(curSourceFile); } @@ -57792,8 +64134,6 @@ var ts; parent.children = [child]; } } - var parentsStack = []; - var parent; function rootNavigationBarNode(sourceFile) { ts.Debug.assert(!parentsStack.length); var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 }; @@ -57837,11 +64177,12 @@ var ts; endNode(); } function addChildrenRecursively(node) { + curCancellationToken.throwIfCancellationRequested(); if (!node || ts.isToken(node)) { return; } switch (node.kind) { - case 150: + case 151: var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) { @@ -57851,28 +64192,28 @@ var ts; } } break; - case 149: - case 151: + case 150: case 152: - case 148: + case 153: + case 149: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; + case 148: case 147: - case 146: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 236: + case 238: var importClause = node; if (importClause.name) { addLeafNode(importClause); } var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 239) { addLeafNode(namedBindings); } else { @@ -57883,12 +64224,12 @@ var ts; } } break; - case 174: - case 223: + case 175: + case 225: var decl = node; - var name_47 = decl.name; - if (ts.isBindingPattern(name_47)) { - addChildrenRecursively(name_47); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -57897,12 +64238,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; + case 186: + case 227: case 185: - case 225: - case 184: addNodeWithRecursiveChild(node, node.body); break; - case 229: + case 231: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -57912,9 +64253,9 @@ var ts; } endNode(); break; - case 226: - case 197: - case 227: + case 228: + case 198: + case 229: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -57922,21 +64263,21 @@ var ts; } endNode(); break; - case 230: + case 232: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243: - case 234: - case 155: - case 153: + case 245: + case 236: + case 156: case 154: - case 228: + case 155: + case 230: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285) { + if (tag.kind === 289) { addLeafNode(tag); } }); @@ -57952,9 +64293,9 @@ var ts; if (!name) { return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -57972,7 +64313,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -57984,12 +64325,12 @@ var ts; } }); function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 || areSameModule(a, b)); function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230) { + if (a.body.kind !== 232) { return true; } return areSameModule(a.body, b.body); @@ -58015,32 +64356,15 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; function tryGetName(node) { - if (node.kind === 230) { + if (node.kind === 232) { return getModuleName(node); } var decl = node; @@ -58048,18 +64372,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184: case 185: - case 197: + case 186: + case 198: return getFunctionOrClassName(node); - case 285: + case 289: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230) { + if (node.kind === 232) { return getModuleName(node); } var name = node.name; @@ -58070,29 +64394,29 @@ var ts; } } switch (node.kind) { - case 261: + case 264: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; + case 186: + case 227: case 185: - case 225: - case 184: - case 226: - case 197: + case 228: + case 198: if (ts.getModifierFlags(node) & 512) { return "default"; } return getFunctionOrClassName(node); - case 150: + case 151: return "constructor"; - case 154: + case 155: return "new()"; - case 153: + case 154: return "()"; - case 155: + case 156: return "[]"; - case 285: + case 289: return getJSDocTypedefTagName(node); default: return ""; @@ -58104,7 +64428,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -58132,24 +64456,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226: - case 197: + case 228: + case 198: + case 231: case 229: - case 227: + case 232: + case 264: case 230: - case 261: - case 228: - case 285: + case 289: return true; - case 150: - case 149: case 151: + case 150: case 152: - case 223: + case 153: + case 225: return hasSomeImportantChild(item); + case 186: + case 227: case 185: - case 225: - case 184: return isTopLevelFunctionDeclaration(item); default: return false; @@ -58159,10 +64483,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231: - case 261: - case 149: + case 233: + case 264: case 150: + case 151: return true; default: return hasSomeImportantChild(item); @@ -58171,17 +64495,16 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 && childKind !== 174; + return childKind !== 225 && childKind !== 175; }); } } } - var emptyChildItemArray = []; function convertToTree(n) { return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -58190,7 +64513,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -58226,35 +64549,41 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } return result.join("."); } function getInteriorModule(decl) { - return decl.body.kind === 230 ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142; + return !member.name || member.name.kind === 143; } function getNodeSpan(node) { - return node.kind === 261 + return node.kind === 264 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223) { + else if (node.parent.kind === 225) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 && + else if (node.parent.kind === 193 && node.parent.operatorToken.kind === 57) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 && node.parent.name) { + else if (node.parent.kind === 260 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -58265,38 +64594,37 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 || node.kind === 185 || node.kind === 197; + return node.kind === 185 || node.kind === 186 || node.kind === 198; } - var whiteSpaceRegex = /\s+/g; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); var ts; (function (ts) { var OutliningElementsCollector; (function (OutliningElementsCollector) { - function collectElements(sourceFile) { + function collectElements(sourceFile, cancellationToken) { var elements = []; var collapseText = "..."; function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { if (hintSpanNode && startElement && endElement) { - var span_12 = { + var span_13 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_12); + elements.push(span_13); } } function addOutliningSpanComments(commentSpan, autoCollapse) { if (commentSpan) { - var span_13 = { + var span_14 = { textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_13); + elements.push(span_14); } } function addOutliningForLeadingCommentsForNode(n) { @@ -58308,6 +64636,7 @@ var ts; var singleLineCommentCount = 0; for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) { var currentComment = comments_4[_i]; + cancellationToken.throwIfCancellationRequested(); if (currentComment.kind === 2) { if (isFirstSingleLineComment) { firstSingleLineCommentStart = currentComment.pos; @@ -58330,19 +64659,20 @@ var ts; function combineAndAddMultipleSingleLineComments(count, start, end) { if (count > 1) { var multipleSingleLineComments = { + kind: 2, pos: start, end: end, - kind: 2 }; addOutliningSpanComments(multipleSingleLineComments, false); } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185; + return ts.isFunctionBlock(node) && node.parent.kind !== 186; } var depth = 0; var maxDepth = 20; function walk(n) { + cancellationToken.throwIfCancellationRequested(); if (depth > maxDepth) { return; } @@ -58350,26 +64680,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204: + case 206: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_19.kind === 209 || - parent_19.kind === 212 || - parent_19.kind === 213 || - parent_19.kind === 211 || - parent_19.kind === 208 || - parent_19.kind === 210 || - parent_19.kind === 217 || - parent_19.kind === 256) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 || + parent.kind === 214 || + parent.kind === 215 || + parent.kind === 213 || + parent.kind === 210 || + parent.kind === 212 || + parent.kind === 219 || + parent.kind === 259) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221) { - var tryStatement = parent_19; + if (parent.kind === 223) { + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -58380,32 +64710,32 @@ var ts; } } } - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_15 = ts.createTextSpanFromNode(n); elements.push({ - textSpan: span_14, - hintSpan: span_14, + textSpan: span_15, + hintSpan: span_15, bannerText: collapseText, autoCollapse: autoCollapse(n) }); break; } - case 231: { + case 233: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226: - case 227: + case 228: case 229: - case 176: - case 232: { + case 231: + case 177: + case 234: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175: + case 176: var openBracket = ts.findChildOfKind(n, 20, sourceFile); var closeBracket = ts.findChildOfKind(n, 21, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -58482,10 +64812,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -58502,9 +64833,9 @@ var ts; if (index > 0) { var wordSpans = getWordSpans(candidate); for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span_15 = wordSpans_1[_i]; - if (partStartsWith(candidate, span_15, chunk.text, true)) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span_15, chunk.text, false)); + var span_16 = wordSpans_1[_i]; + if (partStartsWith(candidate, span_16, chunk.text, true)) { + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span_16, chunk.text, false)); } } } @@ -58667,7 +64998,8 @@ var ts; return str === str.toLowerCase(); } function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -58675,7 +65007,7 @@ var ts; return -1; } function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -58743,7 +65075,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -58917,7 +65249,7 @@ var ts; else { if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58943,7 +65275,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58957,7 +65289,7 @@ var ts; token = nextToken(); if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58983,7 +65315,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58993,7 +65325,7 @@ var ts; } else if (token === 38) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59120,90 +65452,85 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, true); - if (node) { - if (node.kind === 70 || - node.kind === 9 || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + if (node.kind === 70 && + node.originalKeywordKind === 78 && + symbol.parent.flags & 1536) { + return undefined; } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9) { - start += 1; - width -= 2; + else if (node.kind === 9) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } - return ts.createTextSpan(start, width); + var displayName = ts.stripQuotes(node.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9) { + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 || + node.kind === 9 || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); var ts; @@ -59211,6 +65538,13 @@ var ts; var SignatureHelp; (function (SignatureHelp) { var emptyArray = []; + var ArgumentListKind; + (function (ArgumentListKind) { + ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; + ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; + ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; + ArgumentListKind[ArgumentListKind["JSXAttributesArguments"] = 3] = "JSXAttributesArguments"; + })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {})); function getSignatureHelpItems(program, sourceFile, position, cancellationToken) { var typeChecker = program.getTypeChecker(); var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position); @@ -59236,14 +65570,14 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179) { + if (argumentInfo.invocation.kind !== 180) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; var name = expression.kind === 70 ? expression - : expression.kind === 177 + : expression.kind === 178 ? expression.name : undefined; if (!name || !name.text) { @@ -59253,10 +65587,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { - for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { - var declaration = declarations_10[_b]; + for (var _b = 0, declarations_13 = declarations; _b < declarations_13.length; _b++) { + var declaration = declarations_13[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -59272,7 +65606,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 || node.parent.kind === 180) { + if (node.parent.kind === 180 || node.parent.kind === 181) { var callExpression = node.parent; if (node.kind === 26 || node.kind === 18) { @@ -59304,23 +65638,23 @@ var ts; } return undefined; } - else if (node.kind === 12 && node.parent.kind === 181) { + else if (node.kind === 12 && node.parent.kind === 182) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0, sourceFile); } } - else if (node.kind === 13 && node.parent.parent.kind === 181) { + else if (node.kind === 13 && node.parent.parent.kind === 182) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 && node.parent.parent.parent.kind === 181) { + else if (node.parent.kind === 204 && node.parent.parent.parent.kind === 182) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); if (node.kind === 15 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -59328,8 +65662,20 @@ var ts; var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position); return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } + else if (node.parent && ts.isJsxOpeningLikeElement(node.parent)) { + var attributeSpanStart = node.parent.attributes.getFullStart(); + var attributeSpanEnd = ts.skipTrivia(sourceFile.text, node.parent.attributes.getEnd(), false); + return { + kind: 3, + invocation: node.parent, + argumentsSpan: ts.createTextSpan(attributeSpanStart, attributeSpanEnd - attributeSpanStart), + argumentIndex: 0, + argumentCount: 1 + }; + } return undefined; } + SignatureHelp.getImmediatelyContainingArgumentInfo = getImmediatelyContainingArgumentInfo; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); @@ -59384,7 +65730,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 194) { + if (template.kind === 195) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -59393,7 +65739,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261; n = n.parent) { + for (var n = node; n.kind !== 264; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -59476,7 +65822,8 @@ var ts; suffixDisplayParts: suffixDisplayParts, separatorDisplayParts: [ts.punctuationPart(25), ts.spacePart()], parameters: signatureHelpParameters, - documentation: candidateSignature.getDocumentationComment() + documentation: candidateSignature.getDocumentationComment(), + tags: candidateSignature.getJsDocTags() }; }); var argumentIndex = argumentListInfo.argumentIndex; @@ -59523,9 +65870,9 @@ var ts; var SymbolDisplay; (function (SymbolDisplay) { function getSymbolKind(typeChecker, symbol, location) { - var flags = symbol.getFlags(); + var flags = symbol.flags; if (flags & 32) - return ts.getDeclarationOfKind(symbol, 197) ? + return ts.getDeclarationOfKind(symbol, 198) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384) return ts.ScriptElementKind.enumElement; @@ -59535,12 +65882,12 @@ var ts; return ts.ScriptElementKind.interfaceElement; if (flags & 262144) return ts.ScriptElementKind.typeParameterElement; - var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location); + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); if (result === ts.ScriptElementKind.unknown) { if (flags & 262144) return ts.ScriptElementKind.typeParameterElement; if (flags & 8) - return ts.ScriptElementKind.variableElement; + return ts.ScriptElementKind.enumMemberElement; if (flags & 8388608) return ts.ScriptElementKind.alias; if (flags & 1536) @@ -59549,7 +65896,7 @@ var ts; return result; } SymbolDisplay.getSymbolKind = getSymbolKind; - function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) { + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) { if (typeChecker.isUndefinedSymbol(symbol)) { return ts.ScriptElementKind.variableElement; } @@ -59559,6 +65906,7 @@ var ts; if (location.kind === 98 && ts.isExpression(location)) { return ts.ScriptElementKind.parameterElement; } + var flags = symbol.flags; if (flags & 3) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ts.ScriptElementKind.parameterElement; @@ -59582,7 +65930,7 @@ var ts; if (flags & 16384) return ts.ScriptElementKind.constructorImplementationElement; if (flags & 4) { - if (flags & 268435456) { + if (flags & 134217728 && symbol.checkFlags & 6) { var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); if (rootSymbolFlags & (98308 | 3)) { @@ -59599,6 +65947,9 @@ var ts; } return unionPropertyKind; } + if (location.parent && ts.isJsxAttribute(location.parent)) { + return ts.ScriptElementKind.jsxAttribute; + } return ts.ScriptElementKind.memberVariableElement; } return ts.ScriptElementKind.unknown; @@ -59613,8 +65964,9 @@ var ts; if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); } var displayParts = []; var documentation; + var tags; var symbolFlags = symbol.flags; - var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location); + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); var hasAddedSymbolInfo; var isThisExpression = location.kind === 98 && ts.isExpression(location); var type; @@ -59625,26 +65977,29 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177) { + if (location.parent && location.parent.kind === 178) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } - var callExpression = void 0; - if (location.kind === 179 || location.kind === 180) { - callExpression = location; + var callExpressionLike = void 0; + if (location.kind === 180 || location.kind === 181) { + callExpressionLike = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { - callExpression = location.parent; + callExpressionLike = location.parent; + } + else if (location.parent && ts.isJsxOpeningLikeElement(location.parent) && ts.isFunctionLike(symbol.valueDeclaration)) { + callExpressionLike = location.parent; } - if (callExpression) { + if (callExpressionLike) { var candidateSignatures = []; - signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures); + signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 || callExpression.expression.kind === 96; + var useConstructSignatures = callExpressionLike.kind === 181 || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 96); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -59668,6 +66023,7 @@ var ts; addPrefixForAnyFunctionOrVar(symbol, symbolKind); } switch (symbolKind) { + case ts.ScriptElementKind.jsxAttribute: case ts.ScriptElementKind.memberVariableElement: case ts.ScriptElementKind.variableElement: case ts.ScriptElementKind.constElement: @@ -59692,21 +66048,21 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 122 && location.parent.kind === 150)) { + (location.kind === 122 && location.parent.kind === 151)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150) { + if (functionDeclaration.kind === 151) { symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -59715,7 +66071,7 @@ var ts; } } if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197)) { + if (ts.getDeclarationOfKind(symbol, 198)) { pushTypePart(ts.ScriptElementKind.localClassElement); } else { @@ -59734,7 +66090,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -59755,7 +66111,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230); + var declaration = ts.getDeclarationOfKind(symbol, 232); var isNamespace = declaration && declaration.name && declaration.name.kind === 70; displayParts.push(ts.keywordPart(isNamespace ? 128 : 127)); displayParts.push(ts.spacePart()); @@ -59774,25 +66130,25 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var declaration = ts.getDeclarationOfKind(symbol, 143); + var declaration = ts.getDeclarationOfKind(symbol, 144); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154) { + if (declaration.kind === 155) { displayParts.push(ts.keywordPart(93)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 && declaration.name) { + else if (declaration.kind !== 154 && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } - else if (declaration.kind === 228) { + else if (declaration.kind === 230) { addInPrefix(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -59801,9 +66157,10 @@ var ts; } } if (symbolFlags & 8) { + symbolKind = ts.ScriptElementKind.enumMemberElement; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260) { + if (declaration.kind === 263) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -59815,7 +66172,7 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233) { + if (symbol.declarations[0].kind === 235) { displayParts.push(ts.keywordPart(83)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128)); @@ -59826,7 +66183,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234) { + if (declaration.kind === 236) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -59861,6 +66218,7 @@ var ts; addPrefixForAnyFunctionOrVar(symbol, symbolKind); } if (symbolKind === ts.ScriptElementKind.memberVariableElement || + symbolKind === ts.ScriptElementKind.jsxAttribute || symbolFlags & 3 || symbolKind === ts.ScriptElementKind.localVariableElement || isThisExpression) { @@ -59893,11 +66251,12 @@ var ts; } if (!documentation) { documentation = symbol.getDocumentationComment(); + tags = symbol.getJsDocTags(); if (documentation.length === 0 && symbol.flags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 264; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192) { + if (!declaration.parent || declaration.parent.kind !== 193) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -59905,6 +66264,7 @@ var ts; continue; } documentation = rhsSymbol.getDocumentationComment(); + tags = rhsSymbol.getJsDocTags(); if (documentation.length > 0) { break; } @@ -59912,7 +66272,7 @@ var ts; } } } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -59963,6 +66323,7 @@ var ts; displayParts.push(ts.punctuationPart(19)); } documentation = signature.getDocumentationComment(); + tags = signature.getJsDocTags(); } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { @@ -59977,14 +66338,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 184) { + if (declaration.kind === 185) { return true; } - if (declaration.kind !== 223 && declaration.kind !== 225) { + if (declaration.kind !== 225 && declaration.kind !== 227) { return false; } - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { - if (parent_20.kind === 261 || parent_20.kind === 231) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 264 || parent.kind === 233) { return false; } } @@ -60019,7 +66380,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); var outputText; @@ -60065,10 +66426,10 @@ var ts; var commandLineOptionsStringToEnum; function fixupCompilerOptions(options, diagnostics) { commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -60077,17 +66438,18 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } } }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_5(opt); } return options; } + ts.fixupCompilerOptions = fixupCompilerOptions; })(ts || (ts = {})); var ts; (function (ts) { @@ -60096,10 +66458,19 @@ var ts; var standardScanner = ts.createScanner(5, false, 0); var jsxScanner = ts.createScanner(5, false, 1); var scanner; - function getFormattingScanner(sourceFile, startPos, endPos) { + var ScanAction; + (function (ScanAction) { + ScanAction[ScanAction["Scan"] = 0] = "Scan"; + ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; + ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken"; + ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; + ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText"; + })(ScanAction || (ScanAction = {})); + function getFormattingScanner(text, languageVariant, startPos, endPos) { ts.Debug.assert(scanner === undefined, "Scanner should be undefined"); - scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner; - scanner.setText(sourceFile.text); + scanner = languageVariant === 1 ? jsxScanner : standardScanner; + scanner.setText(text); scanner.setTextPos(startPos); var wasNewLine = true; var leadingTrivia; @@ -60175,10 +66546,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { + case 252: case 250: - case 248: + case 251: case 249: - case 247: return node.kind === 70; } } @@ -60287,8 +66658,8 @@ var ts; } function isOnToken() { ts.Debug.assert(scanner !== undefined); - var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken(); + var startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos(); return startPos < endPos && current !== 1 && !ts.isTrivia(current); } function fixTokenKind(tokenInfo, container) { @@ -60389,6 +66760,20 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var formatting; + (function (formatting) { + var FormattingRequestKind; + (function (FormattingRequestKind) { + FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument"; + FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; + FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; + FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; + FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; + })(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var formatting; (function (formatting) { @@ -60410,6 +66795,19 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleAction; + (function (RuleAction) { + RuleAction[RuleAction["Ignore"] = 1] = "Ignore"; + RuleAction[RuleAction["Space"] = 2] = "Space"; + RuleAction[RuleAction["NewLine"] = 4] = "NewLine"; + RuleAction[RuleAction["Delete"] = 8] = "Delete"; + })(RuleAction = formatting.RuleAction || (formatting.RuleAction = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var formatting; (function (formatting) { @@ -60440,6 +66838,17 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleFlags; + (function (RuleFlags) { + RuleFlags[RuleFlags["None"] = 0] = "None"; + RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; + })(RuleFlags = formatting.RuleFlags || (formatting.RuleFlags = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var formatting; (function (formatting) { @@ -60511,10 +66920,10 @@ var ts; this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 141, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([19, 21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -60525,10 +66934,10 @@ var ts; this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19, 3, 80, 101, 86, 81]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8)); this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); @@ -60548,18 +66957,20 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109, 75]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19, 80, 81, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2)); this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101, 86]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 133]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 134]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127, 131]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 133, 114, 136, 138]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 138])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 134, 114, 137, 139, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 139])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); @@ -60573,7 +66984,7 @@ var ts; this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8)); this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 133, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 134, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38, formatting.Shared.TokenRange.FromTokens([70, 18])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); @@ -60586,6 +66997,7 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, @@ -60614,7 +67026,7 @@ var ts; this.NoSpaceBetweenTagAndTemplateString, this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -60629,6 +67041,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; this.LowPriorityCommonRules = [ this.NoSpaceBeforeSemicolon, @@ -60637,7 +67050,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2)); @@ -60678,43 +67090,44 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_48 in o) { - if (o[name_48] === rule) { - return name_48; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 211; + return context.contextNode.kind === 213; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192: case 193: - case 200: - case 243: - case 239: - case 156: - case 164: + case 194: + case 201: + case 245: + case 241: + case 157: case 165: + case 166: return true; - case 174: - case 228: - case 234: - case 223: - case 144: - case 260: + case 175: + case 230: + case 236: + case 225: + case 145: + case 263: + case 148: case 147: - case 146: return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57; - case 212: + case 214: + case 144: return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; - case 213: - return context.currentTokenSpan.kind === 140 || context.nextTokenSpan.kind === 140; + case 215: + return context.currentTokenSpan.kind === 141 || context.nextTokenSpan.kind === 141; } return false; }; @@ -60722,11 +67135,14 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193; + return context.contextNode.kind === 194; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 173 || Rules.IsSingleLineBlockContext(context); + }; Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); }; @@ -60747,90 +67163,96 @@ var ts; return true; } switch (node.kind) { - case 204: - case 232: - case 176: - case 231: + case 206: + case 234: + case 177: + case 233: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225: + case 227: + case 150: case 149: - case 148: - case 151: case 152: case 153: - case 184: - case 150: + case 154: case 185: - case 227: + case 151: + case 186: + case 229: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 || context.contextNode.kind === 184; + return context.contextNode.kind === 227 || context.contextNode.kind === 185; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226: - case 197: - case 227: + case 228: + case 198: case 229: - case 161: - case 230: - case 241: - case 242: - case 235: - case 238: + case 231: + case 162: + case 232: + case 243: + case 244: + case 237: + case 240: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226: - case 230: - case 229: - case 204: - case 256: + case 228: + case 232: case 231: - case 218: + case 259: + case 233: + case 220: return true; + case 206: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 186 && + blockParent.kind !== 185) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208: - case 218: - case 211: - case 212: - case 213: case 210: - case 221: - case 209: - case 217: - case 256: + case 220: + case 213: + case 214: + case 215: + case 212: + case 223: + case 211: + case 219: + case 259: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176; + return context.contextNode.kind === 177; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179; + return context.contextNode.kind === 180; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180; + return context.contextNode.kind === 181; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -60842,25 +67264,25 @@ var ts; return context.nextTokenSpan.kind !== 21; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185; + return context.contextNode.kind === 186; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246; + return context.contextNode.kind !== 248; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252; + return context.contextNode.kind === 255; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250; + return context.nextTokenParent.kind === 252; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250; + return context.contextNode.kind === 252; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247; + return context.contextNode.kind === 249; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -60875,41 +67297,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145; + return node.kind === 146; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 && + return context.currentTokenParent.kind === 226 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230; + return context.contextNode.kind === 232; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161; + return context.contextNode.kind === 162; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 && token.kind !== 28) { return false; } switch (parent.kind) { - case 157: - case 182: - case 226: - case 197: + case 158: + case 183: + case 230: + case 228: + case 198: + case 229: case 227: - case 225: - case 184: case 185: + case 186: + case 150: case 149: - case 148: - case 153: case 154: - case 179: + case 155: case 180: - case 199: + case 181: + case 200: return true; default: return false; @@ -60920,13 +67343,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182; + return context.contextNode.kind === 183; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 188; + return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 189; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 && context.contextNode.expression !== undefined; + }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 202; }; return Rules; }()); @@ -60948,7 +67374,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 + 1; + this.mapRowLength = 141 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -60961,7 +67387,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 && column <= 140, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 && column <= 141, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -61125,7 +67551,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 140; token++) { + for (var token = 0; token <= 141; token++) { result.push(token); } return result; @@ -61169,9 +67595,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(71, 140); + TokenRange.Keywords = TokenRange.FromRange(71, 141); TokenRange.BinaryOperators = TokenRange.FromRange(26, 69); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 140, 117, 125]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 141, 117, 125]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42, 43, 51, 50]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 70, 18, 20, 16, 98, 93]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); @@ -61179,7 +67605,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 134, 121, 135, 104, 118]); + TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 135, 121, 136, 104, 118]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -61201,6 +67627,9 @@ var ts; RulesProvider.prototype.getRulesMap = function () { return this.rulesMap; }; + RulesProvider.prototype.getFormatOptions = function () { + return this.options; + }; RulesProvider.prototype.ensureUpToDate = function (options) { if (!this.options || !ts.compareDataObjects(this.options, options)) { var activeRules = this.createActiveRules(options); @@ -61212,6 +67641,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -61290,6 +67725,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -61315,6 +67756,10 @@ var ts; (function (ts) { var formatting; (function (formatting) { + var Constants; + (function (Constants) { + Constants[Constants["Unknown"] = -1] = "Unknown"; + })(Constants || (Constants = {})); function formatOnEnter(position, sourceFile, rulesProvider, options) { var line = sourceFile.getLineAndCharacterOfPosition(position).line; if (line === 0) { @@ -61387,17 +67832,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 226: - case 227: + case 228: + case 229: return ts.rangeContainsRange(parent.members, node); - case 230: + case 232: var body = parent.body; - return body && body.kind === 231 && ts.rangeContainsRange(body.statements, node); - case 261: - case 204: - case 231: + return body && body.kind === 233 && ts.rangeContainsRange(body.statements, node); + case 264: + case 206: + case 233: return ts.rangeContainsRange(parent.statements, node); - case 256: + case 259: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -61476,12 +67921,17 @@ var ts; } return 0; } + function formatNode(node, sourceFileLike, languageVariant, initialIndentation, delta, rulesProvider) { + var range = { pos: 0, end: sourceFileLike.text.length }; + return formatSpanWorker(range, node, initialIndentation, delta, formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end), rulesProvider.getFormatOptions(), rulesProvider, 1, function (_) { return false; }, sourceFileLike); + } + formatting.formatNode = formatNode; function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { - var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); - var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); var enclosingNode = findEnclosingNode(originalRange, sourceFile); - var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); - var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options), getOwnOrInheritedDelta(enclosingNode, options, sourceFile), formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end), options, rulesProvider, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); + } + function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, options, rulesProvider, requestKind, rangeContainsError, sourceFile) { + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); var previousRangeHasError; var previousRange; var previousParent; @@ -61496,7 +67946,6 @@ var ts; if (enclosingNode.decorators) { undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line; } - var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } if (!formattingScanner.isOnToken()) { @@ -61553,18 +68002,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226: return 74; - case 227: return 108; - case 225: return 88; - case 229: return 229; - case 151: return 124; - case 152: return 133; - case 149: + case 228: return 74; + case 229: return 108; + case 227: return 88; + case 231: return 231; + case 152: return 124; + case 153: return 134; + case 150: if (node.asteriskToken) { return 38; } - case 147: - case 144: + case 148: + case 145: return node.name.kind; } } @@ -61588,17 +68037,30 @@ var ts; switch (kind) { case 16: case 17: - case 20: - case 21: case 18: case 19: case 81: case 105: case 56: return indentation; - default: - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40: + case 28: { + if (container.kind === 250 || + container.kind === 251 || + container.kind === 249) { + return indentation; + } + break; + } + case 20: + case 21: { + if (container.kind !== 171) { + return indentation; + } + break; + } } + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -61639,7 +68101,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -61669,7 +68131,7 @@ var ts; if (tokenInfo.token.end > childStartPos) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -61680,11 +68142,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 && inheritedIndentation === -1) { + if (isFirstListItem && parent.kind === 176 && inheritedIndentation === -1) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -61704,10 +68166,10 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -61720,7 +68182,7 @@ var ts; if (formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -61910,7 +68372,7 @@ var ts; startLine++; } var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -62000,12 +68462,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 151: + case 227: + case 185: case 150: - case 225: - case 184: case 149: - case 148: - case 185: + case 186: if (node.typeParameters === list) { return 26; } @@ -62013,8 +68475,8 @@ var ts; return 18; } break; - case 179: case 180: + case 181: if (node.typeArguments === list) { return 26; } @@ -62022,7 +68484,7 @@ var ts; return 18; } break; - case 157: + case 158: if (node.typeArguments === list) { return 26; } @@ -62095,7 +68557,12 @@ var ts; (function (formatting) { var SmartIndenter; (function (SmartIndenter) { - function getIndentation(position, sourceFile, options) { + var Value; + (function (Value) { + Value[Value["Unknown"] = -1] = "Unknown"; + })(Value || (Value = {})); + function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { + if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } if (position > sourceFile.text.length) { return getBaseIndentation(options); } @@ -62123,7 +68590,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 && precedingToken.parent.kind !== 192) { + if (precedingToken.kind === 25 && precedingToken.parent.kind !== 193) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -62136,8 +68603,9 @@ var ts; while (current) { if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); - if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { - indentationDelta = 0; + var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); + if (nextTokenKind !== 0) { + indentationDelta = assumeNewLineBeforeCloseBrace && nextTokenKind === 2 ? options.indentSize : 0; } else { indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0; @@ -62225,31 +68693,37 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 || !parentAndChildShareLine); + (parent.kind === 264 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); } + var NextTokenKind; + (function (NextTokenKind) { + NextTokenKind[NextTokenKind["Unknown"] = 0] = "Unknown"; + NextTokenKind[NextTokenKind["OpenBrace"] = 1] = "OpenBrace"; + NextTokenKind[NextTokenKind["CloseBrace"] = 2] = "CloseBrace"; + })(NextTokenKind || (NextTokenKind = {})); function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { var nextToken = ts.findNextToken(precedingToken, current); if (!nextToken) { - return false; + return 0; } if (nextToken.kind === 16) { - return true; + return 1; } else if (nextToken.kind === 17) { var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; - return lineAtPosition === nextTokenStartLine; + return lineAtPosition === nextTokenStartLine ? 2 : 0; } - return false; + return 0; } function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 && parent.elseStatement === child) { + if (parent.kind === 210 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -62258,53 +68732,49 @@ var ts; return false; } SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getListIfStartEndIsInListRange(list, start, end) { + return list && ts.rangeContainsStartEnd(list, start, end) ? list : undefined; + } function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157: - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { - return node.parent.typeArguments; - } - break; - case 176: + case 158: + return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); + case 177: return node.parent.properties; - case 175: + case 176: return node.parent.elements; - case 225: - case 184: + case 227: case 185: + case 186: + case 150: case 149: - case 148: - case 153: - case 154: { + case 154: + case 151: + case 160: + case 155: { var start = node.getStart(sourceFile); - if (node.parent.typeParameters && - ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; - } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 180: - case 179: { + case 228: + return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); + case 181: + case 180: { var start = node.getStart(sourceFile); - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { - return node.parent.typeArguments; - } - if (node.parent.arguments && - ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { - return node.parent.arguments; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } + case 226: + return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); + case 240: + case 244: + return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } return undefined; } + SmartIndenter.getContainingList = getContainingList; function getActualIndentationForListItem(node, sourceFile, options) { var containingList = getContainingList(node, sourceFile); return containingList ? getActualIndentationFromList(containingList) : -1; @@ -62317,8 +68787,8 @@ var ts; if (node.kind === 19) { return -1; } - if (node.parent && (node.parent.kind === 179 || - node.parent.kind === 180) && + if (node.parent && (node.parent.kind === 180 || + node.parent.kind === 181) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -62336,10 +68806,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179: case 180: - case 177: + case 181: case 178: + case 179: node = node.expression; break; default: @@ -62376,109 +68846,603 @@ var ts; if (!ts.isWhiteSpaceSingleLine(ch)) { break; } - if (ch === 9) { - column += options.tabSize + (column % options.tabSize); + if (ch === 9) { + column += options.tabSize + (column % options.tabSize); + } + else { + column++; + } + character++; + } + return { column: column, character: character }; + } + SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; + function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { + return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column; + } + SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; + function nodeContentIsAlwaysIndented(kind) { + switch (kind) { + case 209: + case 228: + case 198: + case 229: + case 231: + case 230: + case 176: + case 206: + case 233: + case 177: + case 162: + case 171: + case 164: + case 234: + case 257: + case 256: + case 184: + case 178: + case 180: + case 181: + case 207: + case 225: + case 242: + case 218: + case 194: + case 174: + case 173: + case 250: + case 249: + case 255: + case 149: + case 154: + case 155: + case 145: + case 159: + case 160: + case 167: + case 182: + case 190: + case 244: + case 240: + case 245: + case 241: + return true; + } + return false; + } + function nodeWillIndentChild(parent, child, indentByDefault) { + var childKind = child ? child.kind : 0; + switch (parent.kind) { + case 211: + case 212: + case 214: + case 215: + case 213: + case 210: + case 227: + case 185: + case 150: + case 186: + case 151: + case 152: + case 153: + return childKind !== 206; + case 243: + return childKind !== 244; + case 237: + return childKind !== 238 || + (child.namedBindings && child.namedBindings.kind !== 240); + case 248: + return childKind !== 251; + } + return indentByDefault; + } + SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; + function shouldIndentChildNode(parent, child) { + return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); + } + SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var textChanges; + (function (textChanges) { + function getPos(n) { + return n["__pos"]; + } + function setPos(n, pos) { + n["__pos"] = pos; + } + function getEnd(n) { + return n["__end"]; + } + function setEnd(n, end) { + n["__end"] = end; + } + var Position; + (function (Position) { + Position[Position["FullStart"] = 0] = "FullStart"; + Position[Position["Start"] = 1] = "Start"; + })(Position = textChanges.Position || (textChanges.Position = {})); + function skipWhitespacesAndLineBreaks(text, start) { + return ts.skipTrivia(text, start, false, true); + } + function hasCommentsBeforeLineBreak(text, start) { + var i = start; + while (i < text.length) { + var ch = text.charCodeAt(i); + if (ts.isWhiteSpaceSingleLine(ch)) { + i++; + continue; + } + return ch === 47; + } + return false; + } + function getSeparatorCharacter(separator) { + return ts.tokenToString(separator.kind); + } + textChanges.getSeparatorCharacter = getSeparatorCharacter; + function getAdjustedStartPosition(sourceFile, node, options, position) { + if (options.useNonAdjustedStartPosition) { + return node.getFullStart(); + } + var fullStart = node.getFullStart(); + var start = node.getStart(sourceFile); + if (fullStart === start) { + return start; + } + var fullStartLine = ts.getLineStartPositionForPosition(fullStart, sourceFile); + var startLine = ts.getLineStartPositionForPosition(start, sourceFile); + if (startLine === fullStartLine) { + return position === Position.Start ? start : fullStart; + } + var adjustedStartPosition = ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, fullStartLine) + 1, sourceFile); + adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition); + return ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile); + } + textChanges.getAdjustedStartPosition = getAdjustedStartPosition; + function getAdjustedEndPosition(sourceFile, node, options) { + if (options.useNonAdjustedEndPosition) { + return node.getEnd(); + } + var end = node.getEnd(); + var newEnd = ts.skipTrivia(sourceFile.text, end, true); + return newEnd !== end && ts.isLineBreak(sourceFile.text.charCodeAt(newEnd - 1)) + ? newEnd + : end; + } + textChanges.getAdjustedEndPosition = getAdjustedEndPosition; + function isSeparator(node, candidate) { + return candidate && node.parent && (candidate.kind === 25 || (candidate.kind === 24 && node.parent.kind === 177)); + } + function spaces(count) { + var s = ""; + for (var i = 0; i < count; i++) { + s += " "; + } + return s; + } + var ChangeTracker = (function () { + function ChangeTracker(newLine, rulesProvider, validator) { + this.newLine = newLine; + this.rulesProvider = rulesProvider; + this.validator = validator; + this.changes = []; + this.newLineCharacter = ts.getNewLineCharacter({ newLine: newLine }); + } + ChangeTracker.fromCodeFixContext = function (context) { + return new ChangeTracker(context.newLineCharacter === "\n" ? 1 : 0, context.rulesProvider); + }; + ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, node, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteRange = function (sourceFile, range) { + this.changes.push({ sourceFile: sourceFile, range: range }); + return this; + }; + ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteNodeInList = function (sourceFile, node) { + var containingList = ts.formatting.SmartIndenter.getContainingList(node, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(node); + if (index < 0) { + return this; + } + if (containingList.length === 1) { + this.deleteNode(sourceFile, node); + return this; + } + if (index !== containingList.length - 1) { + var nextToken = ts.getTokenAtPosition(sourceFile, node.end); + if (nextToken && isSeparator(node, nextToken)) { + var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), false, true); + var nextElement = containingList[index + 1]; + var endPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, nextElement, {}, Position.FullStart), false, true); + this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); + } + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end); + if (previousToken && isSeparator(node, previousToken)) { + this.deleteNodeRange(sourceFile, previousToken, node); + } + } + return this; + }; + ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, range: range, options: options, node: newNode }); + return this; + }; + ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, oldNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, oldNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, options: options, node: newNode, range: { pos: pos, end: pos } }); + return this; + }; + ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, before, options, Position.Start); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: startPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode, options) { + if (options === void 0) { options = {}; } + if ((ts.isStatementButNotDeclaration(after)) || + after.kind === 148 || + after.kind === 147 || + after.kind === 149) { + if (sourceFile.text.charCodeAt(after.end - 1) !== 59) { + this.changes.push({ + sourceFile: sourceFile, + options: {}, + range: { pos: after.end, end: after.end }, + node: ts.createToken(24) + }); + } + } + var endPosition = getAdjustedEndPosition(sourceFile, after, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: endPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode) { + var containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(after); + if (index < 0) { + return this; + } + var end = after.getEnd(); + if (index !== containingList.length - 1) { + var nextToken = ts.getTokenAtPosition(sourceFile, after.end); + if (nextToken && isSeparator(after, nextToken)) { + var lineAndCharOfNextElement = ts.getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart())); + var lineAndCharOfNextToken = ts.getLineAndCharacterOfPosition(sourceFile, nextToken.end); + var prefix = void 0; + var startPos = void 0; + if (lineAndCharOfNextToken.line === lineAndCharOfNextElement.line) { + startPos = nextToken.end; + prefix = spaces(lineAndCharOfNextElement.character - lineAndCharOfNextToken.character); + } + else { + startPos = ts.getStartPositionOfLine(lineAndCharOfNextElement.line, sourceFile); + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: startPos, end: containingList[index + 1].getStart(sourceFile) }, + node: newNode, + useIndentationFromFile: true, + options: { + prefix: prefix, + suffix: "" + ts.tokenToString(nextToken.kind) + sourceFile.text.substring(nextToken.end, containingList[index + 1].getStart(sourceFile)) + } + }); + } + } + else { + var afterStart = after.getStart(sourceFile); + var afterStartLinePosition = ts.getLineStartPositionForPosition(afterStart, sourceFile); + var separator = void 0; + var multilineList = false; + if (containingList.length === 1) { + separator = 25; + } + else { + var tokenBeforeInsertPosition = ts.findPrecedingToken(after.pos, sourceFile); + separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 25; + var afterMinusOneStartLinePosition = ts.getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); + multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; + } + if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) { + multilineList = true; + } + if (multilineList) { + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: ts.createToken(separator), + options: {} + }); + var indentation = ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(afterStartLinePosition, afterStart, sourceFile, this.rulesProvider.getFormatOptions()); + var insertPos = ts.skipTrivia(sourceFile.text, end, true, false); + if (insertPos !== end && ts.isLineBreak(sourceFile.text.charCodeAt(insertPos - 1))) { + insertPos--; + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: insertPos, end: insertPos }, + node: newNode, + options: { indentation: indentation, prefix: this.newLineCharacter } + }); + } + else { + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: newNode, + options: { prefix: ts.tokenToString(separator) + " " } + }); + } + } + return this; + }; + ChangeTracker.prototype.getChanges = function () { + var _this = this; + var changesPerFile = ts.createFileMap(); + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var c = _a[_i]; + var changesInFile = changesPerFile.get(c.sourceFile.path); + if (!changesInFile) { + changesPerFile.set(c.sourceFile.path, changesInFile = []); + } + changesInFile.push(c); + } + var fileChangesList = []; + changesPerFile.forEachValue(function (path) { + var changesInFile = changesPerFile.get(path); + var sourceFile = changesInFile[0].sourceFile; + var fileTextChanges = { fileName: sourceFile.fileName, textChanges: [] }; + for (var _i = 0, _a = ChangeTracker.normalize(changesInFile); _i < _a.length; _i++) { + var c = _a[_i]; + fileTextChanges.textChanges.push({ + span: _this.computeSpan(c, sourceFile), + newText: _this.computeNewText(c, sourceFile) + }); + } + fileChangesList.push(fileTextChanges); + }); + return fileChangesList; + }; + ChangeTracker.prototype.computeSpan = function (change, _sourceFile) { + return ts.createTextSpanFromBounds(change.range.pos, change.range.end); + }; + ChangeTracker.prototype.computeNewText = function (change, sourceFile) { + if (!change.node) { + return ""; + } + var options = change.options || {}; + var nonFormattedText = getNonformattedText(change.node, sourceFile, this.newLine); + if (this.validator) { + this.validator(nonFormattedText); + } + var formatOptions = this.rulesProvider.getFormatOptions(); + var pos = change.range.pos; + var posStartsLine = ts.getLineStartPositionForPosition(pos, sourceFile) === pos; + var initialIndentation = change.options.indentation !== undefined + ? change.options.indentation + : change.useIndentationFromFile + ? ts.formatting.SmartIndenter.getIndentation(change.range.pos, sourceFile, formatOptions, posStartsLine || (change.options.prefix === this.newLineCharacter)) + : 0; + var delta = change.options.delta !== undefined + ? change.options.delta + : ts.formatting.SmartIndenter.shouldIndentChildNode(change.node) + ? formatOptions.indentSize + : 0; + var text = applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, this.rulesProvider); + text = posStartsLine || change.options.indentation !== undefined ? text : text.replace(/^\s+/, ""); + return (options.prefix || "") + text + (options.suffix || ""); + }; + ChangeTracker.normalize = function (changes) { + var normalized = ts.stableSort(changes, function (a, b) { return a.range.pos - b.range.pos; }); + for (var i = 0; i < normalized.length - 2; i++) { + ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos); + } + return normalized; + }; + return ChangeTracker; + }()); + textChanges.ChangeTracker = ChangeTracker; + function getNonformattedText(node, sourceFile, newLine) { + var options = { newLine: newLine, target: sourceFile.languageVersion }; + var writer = new Writer(ts.getNewLineCharacter(options)); + var printer = ts.createPrinter(options, writer); + printer.writeNode(3, node, sourceFile, writer); + return { text: writer.getText(), node: assignPositionsToNode(node) }; + } + textChanges.getNonformattedText = getNonformattedText; + function applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, rulesProvider) { + var lineMap = ts.computeLineStarts(nonFormattedText.text); + var file = { + text: nonFormattedText.text, + lineMap: lineMap, + getLineAndCharacterOfPosition: function (pos) { return ts.computeLineAndCharacterOfPosition(lineMap, pos); } + }; + var changes = ts.formatting.formatNode(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); + return applyChanges(nonFormattedText.text, changes); + } + textChanges.applyFormatting = applyFormatting; + function applyChanges(text, changes) { + for (var i = changes.length - 1; i >= 0; i--) { + var change = changes[i]; + text = "" + text.substring(0, change.span.start) + change.newText + text.substring(ts.textSpanEnd(change.span)); + } + return text; + } + textChanges.applyChanges = applyChanges; + function isTrivia(s) { + return ts.skipTrivia(s, 0) === s.length; + } + var nullTransformationContext = { + enableEmitNotification: ts.noop, + enableSubstitution: ts.noop, + endLexicalEnvironment: function () { return undefined; }, + getCompilerOptions: ts.notImplemented, + getEmitHost: ts.notImplemented, + getEmitResolver: ts.notImplemented, + hoistFunctionDeclaration: ts.noop, + hoistVariableDeclaration: ts.noop, + isEmitNotificationEnabled: ts.notImplemented, + isSubstitutionEnabled: ts.notImplemented, + onEmitNode: ts.noop, + onSubstituteNode: ts.notImplemented, + readEmitHelpers: ts.notImplemented, + requestEmitHelper: ts.noop, + resumeLexicalEnvironment: ts.noop, + startLexicalEnvironment: ts.noop, + suspendLexicalEnvironment: ts.noop + }; + function assignPositionsToNode(node) { + var visited = ts.visitEachChild(node, assignPositionsToNode, nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); + var newNode = ts.nodeIsSynthesized(visited) + ? visited + : (Proxy.prototype = visited, new Proxy()); + newNode.pos = getPos(node); + newNode.end = getEnd(node); + return newNode; + function Proxy() { } + } + function assignPositionsToNodeArray(nodes, visitor, test, start, count) { + var visited = ts.visitNodes(nodes, visitor, test, start, count); + if (!visited) { + return visited; + } + var nodeArray = visited === nodes ? ts.createNodeArray(visited.slice(0)) : visited; + nodeArray.pos = getPos(nodes); + nodeArray.end = getEnd(nodes); + return nodeArray; + } + var Writer = (function () { + function Writer(newLine) { + var _this = this; + this.lastNonTriviaPosition = 0; + this.writer = ts.createTextWriter(newLine); + this.onEmitNode = function (hint, node, printCallback) { + if (node) { + setPos(node, _this.lastNonTriviaPosition); + } + printCallback(hint, node); + if (node) { + setEnd(node, _this.lastNonTriviaPosition); } - else { - column++; + }; + this.onBeforeEmitNodeArray = function (nodes) { + if (nodes) { + setPos(nodes, _this.lastNonTriviaPosition); } - character++; - } - return { column: column, character: character }; - } - SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; - function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { - return findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options).column; - } - SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; - function nodeContentIsAlwaysIndented(kind) { - switch (kind) { - case 207: - case 226: - case 197: - case 227: - case 229: - case 228: - case 175: - case 204: - case 231: - case 176: - case 161: - case 163: - case 232: - case 254: - case 253: - case 183: - case 177: - case 179: - case 180: - case 205: - case 223: - case 240: - case 216: - case 193: - case 173: - case 172: - case 248: - case 247: - case 252: - case 148: - case 153: - case 154: - case 144: - case 158: - case 159: - case 166: - case 181: - case 189: - case 242: - case 238: - case 243: - case 239: - return true; - } - return false; + }; + this.onAfterEmitNodeArray = function (nodes) { + if (nodes) { + setEnd(nodes, _this.lastNonTriviaPosition); + } + }; } - function nodeWillIndentChild(parent, child, indentByDefault) { - var childKind = child ? child.kind : 0; - switch (parent.kind) { - case 209: - case 210: - case 212: - case 213: - case 211: - case 208: - case 225: - case 184: - case 149: - case 185: - case 150: - case 151: - case 152: - return childKind !== 204; - case 241: - return childKind !== 242; - case 235: - return childKind !== 236 || - (child.namedBindings && child.namedBindings.kind !== 238); - case 246: - return childKind !== 249; + Writer.prototype.setLastNonTriviaPosition = function (s, force) { + if (force || !isTrivia(s)) { + this.lastNonTriviaPosition = this.writer.getTextPos(); + var i = 0; + while (ts.isWhiteSpace(s.charCodeAt(s.length - i - 1))) { + i++; + } + this.lastNonTriviaPosition -= i; } - return indentByDefault; - } - SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; - function shouldIndentChildNode(parent, child) { - return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); - } - SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; - })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); - })(formatting = ts.formatting || (ts.formatting = {})); + }; + Writer.prototype.write = function (s) { + this.writer.write(s); + this.setLastNonTriviaPosition(s, false); + }; + Writer.prototype.writeTextOfNode = function (text, node) { + this.writer.writeTextOfNode(text, node); + }; + Writer.prototype.writeLine = function () { + this.writer.writeLine(); + }; + Writer.prototype.increaseIndent = function () { + this.writer.increaseIndent(); + }; + Writer.prototype.decreaseIndent = function () { + this.writer.decreaseIndent(); + }; + Writer.prototype.getText = function () { + return this.writer.getText(); + }; + Writer.prototype.rawWrite = function (s) { + this.writer.rawWrite(s); + this.setLastNonTriviaPosition(s, false); + }; + Writer.prototype.writeLiteral = function (s) { + this.writer.writeLiteral(s); + this.setLastNonTriviaPosition(s, true); + }; + Writer.prototype.getTextPos = function () { + return this.writer.getTextPos(); + }; + Writer.prototype.getLine = function () { + return this.writer.getLine(); + }; + Writer.prototype.getColumn = function () { + return this.writer.getColumn(); + }; + Writer.prototype.getIndent = function () { + return this.writer.getIndent(); + }; + Writer.prototype.isAtStartOfLine = function () { + return this.writer.isAtStartOfLine(); + }; + Writer.prototype.reset = function () { + this.writer.reset(); + this.lastNonTriviaPosition = 0; + }; + return Writer; + }()); + })(textChanges = ts.textChanges || (ts.textChanges = {})); })(ts || (ts = {})); var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -62512,24 +69476,203 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - return constructor.body.getFirstToken(sourceFile).getEnd(); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface + }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDeclaration = ts.getContainingClass(token); + if (!classDeclaration) { + return undefined; + } + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var classType = checker.getTypeAtLocation(classDeclaration); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDeclaration); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + var implementedType = checker.getTypeAtLocation(implementedTypeNode); + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8); }); + var newNodes = []; + createAndAddMissingIndexSignatureDeclaration(implementedType, 1, hasNumericIndexSignature, newNodes); + createAndAddMissingIndexSignatureDeclaration(implementedType, 0, hasStringIndexSignature, newNodes); + newNodes = newNodes.concat(codefix.createMissingMemberNodes(classDeclaration, nonPrivateMembers, checker)); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (newNodes.length > 0) { + pushAction(result, newNodes, message); + } + } + return result; + function createAndAddMissingIndexSignatureDeclaration(type, kind, hasIndexSigOfKind, newNodes) { + if (hasIndexSigOfKind) { + return; + } + var indexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (!indexInfoOfKind) { + return; + } + var newIndexSignatureDeclaration = checker.indexInfoToIndexSignatureDeclaration(indexInfoOfKind, kind, classDeclaration); + newNodes.push(newIndexSignatureDeclaration); + } + function pushAction(result, newNodes, description) { + var newAction = { + description: description, + changes: codefix.newNodesToChanges(newNodes, openBrace, context) + }; + result.push(newAction); + } } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122) { - return undefined; + errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code], + getCodeActions: getActionsForAddMissingMember + }); + function getActionsForAddMissingMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind !== 70) { + return undefined; + } + if (!ts.isPropertyAccessExpression(token.parent) || token.parent.expression.kind !== 98) { + return undefined; + } + var classMemberDeclaration = ts.getThisContainer(token, false); + if (!ts.isClassElement(classMemberDeclaration)) { + return undefined; + } + var classDeclaration = classMemberDeclaration.parent; + if (!classDeclaration || !ts.isClassLike(classDeclaration)) { + return undefined; + } + var isStatic = ts.hasModifier(classMemberDeclaration, 32); + return ts.isInJavaScriptFile(sourceFile) ? getActionsForAddMissingMemberInJavaScriptFile() : getActionsForAddMissingMemberInTypeScriptFile(); + function getActionsForAddMissingMemberInJavaScriptFile() { + var memberName = token.getText(); + if (isStatic) { + if (classDeclaration.kind === 198) { + return undefined; + } + var className = classDeclaration.name.getText(); + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_static_property_0), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classDeclaration.getEnd(), length: 0 }, + newText: "" + context.newLineCharacter + className + "." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + else { + var classConstructor = ts.getFirstConstructorWithBody(classDeclaration); + if (!classConstructor) { + return undefined; + } + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_property_0_in_the_constructor), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classConstructor.body.getEnd() - 1, length: 0 }, + newText: "this." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; + } + } + function getActionsForAddMissingMemberInTypeScriptFile() { + var typeNode; + if (token.parent.parent.kind === 193) { + var binaryExpression = token.parent.parent; + var checker = context.program.getTypeChecker(); + var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right))); + typeNode = checker.typeToTypeNode(widenedType, classDeclaration); + } + typeNode = typeNode || ts.createKeywordTypeNode(118); + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var property = ts.createProperty(undefined, isStatic ? [ts.createToken(114)] : undefined, token.getText(sourceFile), undefined, typeNode, undefined); + var propertyChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + propertyChangeTracker.insertNodeAfter(sourceFile, openBrace, property, { suffix: context.newLineCharacter }); + var actions = [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]), + changes: propertyChangeTracker.getChanges() }]; + if (!isStatic) { + var stringTypeNode = ts.createKeywordTypeNode(135); + var indexingParameter = ts.createParameter(undefined, undefined, undefined, "x", undefined, stringTypeNode, undefined); + var indexSignature = ts.createIndexSignatureDeclaration(undefined, undefined, [indexingParameter], typeNode); + var indexSignatureChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + indexSignatureChangeTracker.insertNodeAfter(sourceFile, openBrace, indexSignature, { suffix: context.newLineCharacter }); + actions.push({ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]), + changes: indexSignatureChangeTracker.getChanges() + }); + } + return actions; } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDeclaration = token.parent; + var extendsNode = ts.getClassExtendsHeritageClauseElement(classDeclaration); + var instantiatedExtendsType = checker.getTypeAtLocation(extendsNode); + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var newNodes = codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, checker); + var changes = codefix.newNodesToChanges(newNodes, ts.getOpenBraceOfClassLike(classDeclaration, sourceFile), context); + if (changes && changes.length > 0) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: changes + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8) && !!(flags & 128); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -62543,7 +69686,7 @@ var ts; if (!superCall) { return undefined; } - if (superCall.expression && superCall.expression.kind == 179) { + if (superCall.expression && superCall.expression.kind === 180) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -62551,23 +69694,15 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); - var changes = [{ - fileName: sourceFile.fileName, textChanges: [{ - newText: superCall.getText(sourceFile), - span: { start: newPosition, length: 0 } - }, - { - newText: "", - span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) } - }] - }]; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(constructor, sourceFile), superCall, { suffix: context.newLineCharacter }); + changeTracker.deleteNode(sourceFile, superCall); return [{ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor), - changes: changes + changes: changeTracker.getChanges() }]; function findSuperCall(n) { - if (n.kind === 207 && ts.isSuperCall(n.expression)) { + if (n.kind === 209 && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -62580,6 +69715,248 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + var superCall = ts.createStatement(ts.createCall(ts.createSuper(), undefined, ts.emptyArray)); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(token.parent, sourceFile), superCall, { suffix: context.newLineCharacter }); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84)) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, extendsToken, ts.createToken(107)); + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeTracker.replaceNode(sourceFile, keywordToken, ts.createToken(25)); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: changeTracker.getChanges() + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 70) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createThis(), token)); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind === 20) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70: + switch (token.parent.kind) { + case 225: + switch (token.parent.parent.parent.kind) { + case 213: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return deleteNode(forInitializer); + } + else { + return deleteNodeInList(token.parent); + } + case 215: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 226) { + var forOfInitializer = forOfStatement.initializer; + return replaceNode(forOfInitializer.declarations[0], ts.createObjectLiteral()); + } + break; + case 214: + return undefined; + case 259: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return deleteNode(parameter); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return deleteNode(variableStatement); + } + else { + return deleteNodeInList(token.parent); + } + } + case 144: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1); + if (!previousToken || previousToken.kind !== 26) { + return deleteRange(typeParameters); + } + var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end); + if (!nextToken || nextToken.kind !== 28) { + return deleteRange(typeParameters); + } + return deleteNodeRange(previousToken, nextToken); + } + else { + return deleteNodeInList(token.parent); + } + case 145: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return deleteNode(token.parent); + } + else { + return deleteNodeInList(token.parent); + } + case 236: + var importEquals = ts.getAncestor(token, 236); + return deleteNode(importEquals); + case 241: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + var importSpec = ts.getAncestor(token, 237); + return deleteNode(importSpec); + } + else { + return deleteNodeInList(token.parent); + } + case 238: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = ts.getAncestor(importClause, 237); + return deleteNode(importDecl); + } + else { + var start_4 = importClause.name.getStart(sourceFile); + var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end); + if (nextToken && nextToken.kind === 25) { + return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, false, true) }); + } + else { + return deleteNode(importClause.name); + } + } + case 239: + var namespaceImport = token.parent; + if (namespaceImport.name === token && !namespaceImport.parent.name) { + var importDecl = ts.getAncestor(namespaceImport, 237); + return deleteNode(importDecl); + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1); + if (previousToken && previousToken.kind === 25) { + var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart); + return deleteRange({ pos: startPosition, end: namespaceImport.end }); + } + return deleteRange(namespaceImport); + } + } + break; + case 148: + case 239: + return deleteNode(token.parent); + } + if (ts.isDeclarationName(token)) { + return deleteNode(token.parent); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return deleteNode(token.parent.parent); + } + else { + return undefined; + } + function deleteNode(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNode(sourceFile, n)); + } + function deleteRange(range) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteRange(sourceFile, range)); + } + function deleteNodeInList(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeInList(sourceFile, n)); + } + function deleteNodeRange(start, end) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeRange(sourceFile, start, end)); + } + function replaceNode(n, newNode) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).replaceNode(sourceFile, n, newNode)); + } + function makeChange(changeTracker) { + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), + changes: changeTracker.getChanges() + }]; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var codefix; (function (codefix) { @@ -62591,18 +69968,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -62635,8 +70013,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -62665,7 +70043,11 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics.Cannot_find_namespace_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -62674,18 +70056,22 @@ var ts; var token = ts.getTokenAtPosition(sourceFile, context.span.start); var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); - var cachedImportDeclarations = ts.createMap(); - var cachedNewImportInsertPosition; - var allPotentialModules = checker.getAmbientModules(); + var cachedImportDeclarations = []; + var lastImportDeclaration; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, false, true); + } + var candidateModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { - allPotentialModules.push(otherSourceFile.symbol); + candidateModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); - for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { - var moduleSymbol = allPotentialModules_1[_a]; + for (var _a = 0, candidateModules_1 = candidateModules; _a < candidateModules_1.length; _a++) { + var moduleSymbol = candidateModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { @@ -62704,8 +70090,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -62720,10 +70107,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235) { + if (node.kind === 237) { return node; } - if (node.kind === 234) { + if (node.kind === 236) { return node; } node = node.parent; @@ -62741,7 +70128,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { return getCodeActionsForExistingImport(existingDeclarations); @@ -62754,11 +70141,11 @@ var ts; var namespaceImportDeclaration; var namedImportDeclaration; var existingModuleSpecifier; - for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { - var declaration = declarations_11[_i]; - if (declaration.kind === 235) { + for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) { + var declaration = declarations_14[_i]; + if (declaration.kind === 237) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237) { + if (namedBindings && namedBindings.kind === 239) { namespaceImportDeclaration = declaration; } else { @@ -62774,94 +70161,82 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { - var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var fileTextChanges = getTextChangeForImportClause(namedImportDeclaration.importClause); var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); - actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], fileTextChanges, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); } else { actions.push(getCodeActionForNewImport(existingModuleSpecifier)); } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); } function getTextChangeForImportClause(importClause) { - var newImportText = isDefault ? "default as " + name : name; var importList = importClause.namedBindings; - if (!importList && importClause.name) { - var start = importClause.name.getEnd(); - return { - newText: ", { " + newImportText + " }", - span: { start: start, length: 0 } - }; - } - if (importList.elements.length === 0) { - var start = importList.getStart(); - return { - newText: "{ " + newImportText + " }", - span: { start: start, length: importList.getEnd() - start } - }; + var newImportSpecifier = ts.createImportSpecifier(undefined, ts.createIdentifier(name)); + if (!importList || importList.elements.length === 0) { + var newImportClause = ts.createImportClause(importClause.name, ts.createNamedImports([newImportSpecifier])); + return createChangeTracker().replaceNode(sourceFile, importClause, newImportClause).getChanges(); } - var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); - var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); - var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); - var oneImportPerLine = endLine - startLine > importList.elements.length; - return { - newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, - span: { start: insertPoint, length: 0 } - }; + return createChangeTracker().insertNodeInListAfter(sourceFile, importList.elements[importList.elements.length - 1], newImportSpecifier).getChanges(); } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235) { + if (declaration.kind === 237) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { namespacePrefix = declaration.name.getText(); } namespacePrefix = ts.stripQuotes(namespacePrefix); - return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], createChangeTracker().replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createIdentifier(namespacePrefix), name)).getChanges(), "CodeChange"); } } function getCodeActionForNewImport(moduleSpecifier) { - if (!cachedNewImportInsertPosition) { - var lastModuleSpecifierEnd = -1; - for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { - var moduleSpecifier_1 = _a[_i]; - var end = moduleSpecifier_1.getEnd(); - if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { - lastModuleSpecifierEnd = end; + if (!lastImportDeclaration) { + for (var i = sourceFile.statements.length - 1; i >= 0; i--) { + var statement = sourceFile.statements[i]; + if (statement.kind === 236 || statement.kind === 237) { + lastImportDeclaration = statement; + break; } } - cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); } var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); - var importStatementText = isDefault - ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; - var newText = cachedNewImportInsertPosition === sourceFile.getStart() - ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter - : "" + context.newLineCharacter + importStatementText + ";"; - return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + var changeTracker = createChangeTracker(); + var importClause = isDefault + ? ts.createImportClause(ts.createIdentifier(name), undefined) + : isNamespaceImport + ? ts.createImportClause(undefined, ts.createNamespaceImport(ts.createIdentifier(name))) + : ts.createImportClause(undefined, ts.createNamedImports([ts.createImportSpecifier(undefined, ts.createIdentifier(name))])); + var importDecl = ts.createImportDeclaration(undefined, undefined, importClause, ts.createLiteral(moduleSpecifierWithoutQuotes)); + if (!lastImportDeclaration) { + changeTracker.insertNodeAt(sourceFile, sourceFile.getStart(), importDecl, { suffix: "" + context.newLineCharacter + context.newLineCharacter }); + } + else { + changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl, { suffix: context.newLineCharacter }); + } + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], changeTracker.getChanges(), "NewImport", moduleSpecifierWithoutQuotes); function getModuleSpecifierForNewImport() { - var fileName = sourceFile.path; - var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var fileName = sourceFile.fileName; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().fileName; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261) { + if (moduleSymbol.valueDeclaration.kind !== 264) { return moduleSymbol.name; } } @@ -62869,11 +70244,11 @@ var ts; if (!options.baseUrl) { return undefined; } - var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); - var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + var relativeName = getRelativePathIfInDirectory(moduleFileName, options.baseUrl); if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -62893,7 +70268,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -62903,9 +70278,8 @@ var ts; } function tryGetModuleNameFromRootDirs() { if (options.rootDirs) { - var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, undefined, getCanonicalFileName); }); - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, options.rootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, options.rootDirs); if (normalizedTargetPath !== undefined) { var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; return ts.removeFileExtension(relativePath); @@ -62967,7 +70341,7 @@ var ts; function getPathRelativeToRootDirs(path, rootDirs) { for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { var rootDir = rootDirs_2[_i]; - var relativeName = tryRemoveParentDirectoryName(path, rootDir); + var relativeName = getRelativePathIfInDirectory(path, rootDir); if (relativeName !== undefined) { return relativeName; } @@ -62981,25 +70355,23 @@ var ts; } return fileName; } + function getRelativePathIfInDirectory(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + return ts.isRootedDiskPath(relativePath) || ts.startsWith(relativePath, "..") ? undefined : relativePath; + } function getRelativePath(path, directoryPath) { var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; } - function tryRemoveParentDirectoryName(path, parentDirectory) { - var index = path.indexOf(parentDirectory); - if (index === 0) { - return ts.endsWith(parentDirectory, ts.directorySeparator) - ? path.substring(parentDirectory.length) - : path.substring(parentDirectory.length + 1); - } - return undefined; - } } } - function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + function createChangeTracker() { + return ts.textChanges.ChangeTracker.fromCodeFixContext(context); + } + function createCodeAction(description, diagnosticArgs, changes, kind, moduleSpecifier) { return { description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), - changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + changes: changes, kind: kind, moduleSpecifier: moduleSpecifier }; @@ -63013,150 +70385,225 @@ var ts; var codefix; (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - if (token.kind === 20) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70: - switch (token.parent.kind) { - case 223: - switch (token.parent.parent.parent.kind) { - case 211: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212: - return undefined; - case 256: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - case 234: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - case 236: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 && importDecl.parent) { - importDecl = importDecl.parent; - } - return importDecl; + errorCodes: getApplicableDiagnosticCodes(), + getCodeActions: getDisableJsDiagnosticsCodeActions + }); + function getApplicableDiagnosticCodes() { + var allDiagnostcs = ts.Diagnostics; + return Object.keys(allDiagnostcs) + .filter(function (d) { return allDiagnostcs[d] && allDiagnostcs[d].category === ts.DiagnosticCategory.Error; }) + .map(function (d) { return allDiagnostcs[d].code; }); + } + function getIgnoreCommentLocationForLocation(sourceFile, position, newLineCharacter) { + var line = ts.getLineAndCharacterOfPosition(sourceFile, position).line; + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition); + if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) { + var token = ts.getTouchingToken(sourceFile, startPosition); + var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile); + if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) { + return { + span: { start: startPosition, length: 0 }, + newText: "// @ts-ignore" + newLineCharacter + }; } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] + } + return { + span: { start: position, length: 0 }, + newText: (position === startPosition ? "" : newLineCharacter) + "// @ts-ignore" + newLineCharacter + }; + } + function getDisableJsDiagnosticsCodeActions(context) { + var sourceFile = context.sourceFile, program = context.program, newLineCharacter = context.newLineCharacter, span = context.span; + if (!ts.isInJavaScriptFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { + return undefined; + } + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Ignore_this_error_message), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter)] + }] + }, + { + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Disable_checking_for_this_file), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { + start: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.pos : 0, + length: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.end - sourceFile.checkJsDirective.pos : 0 + }, + newText: "// @ts-nocheck" + newLineCharacter }] - }]; + }] + }]; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + function newNodesToChanges(newNodes, insertAfter, context) { + var sourceFile = context.sourceFile; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + for (var _i = 0, newNodes_1 = newNodes; _i < newNodes_1.length; _i++) { + var newNode = newNodes_1[_i]; + changeTracker.insertNodeAfter(sourceFile, insertAfter, newNode, { suffix: context.newLineCharacter }); + } + var changes = changeTracker.getChanges(); + if (!ts.some(changes)) { + return changes; + } + ts.Debug.assert(changes.length === 1); + var consolidatedChanges = [{ + fileName: changes[0].fileName, + textChanges: [{ + span: changes[0].textChanges[0].span, + newText: changes[0].textChanges.reduce(function (prev, cur) { return prev + cur.newText; }, "") + }] + }]; + return consolidatedChanges; + } + codefix.newNodesToChanges = newNodesToChanges; + function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, checker) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); + var newNodes = []; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + var newNode = createNewNodeForMemberSymbol(symbol, classDeclaration, checker); + if (newNode) { + if (Array.isArray(newNode)) { + newNodes = newNodes.concat(newNode); + } + else { + newNodes.push(newNode); + } } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + return newNodes; + } + codefix.createMissingMemberNodes = createMissingMemberNodes; + function createNewNodeForMemberSymbol(symbol, enclosingDeclaration, checker) { + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return undefined; + } + var declaration = declarations[0]; + var name = ts.getSynthesizedClone(declaration.name); + var visibilityModifier = createVisibilityModifier(ts.getModifierFlags(declaration)); + var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined; + var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); + var optional = !!(symbol.flags & 67108864); + switch (declaration.kind) { + case 152: + case 153: + case 147: + case 148: + var typeNode = checker.typeToTypeNode(type, enclosingDeclaration); + var property = ts.createProperty(undefined, modifiers, name, optional ? ts.createToken(54) : undefined, typeNode, undefined); + return property; + case 149: + case 150: + var signatures = checker.getSignaturesOfType(type, 0); + if (!ts.some(signatures)) { + return undefined; + } + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var signature = signatures[0]; + return signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + } + var signatureDeclarations = []; + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } + } + if (declarations.length > signatures.length) { + var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + var methodImplementingSignatures = createMethodImplementingSignatures(signatures, name, optional, modifiers); + signatureDeclarations.push(methodImplementingSignatures); } + return signatureDeclarations; + default: + return undefined; + } + function signatureToMethodDeclaration(signature, enclosingDeclaration, body) { + var signatureDeclaration = checker.signatureToSignatureDeclaration(signature, 150, enclosingDeclaration); + if (signatureDeclaration) { + signatureDeclaration.decorators = undefined; + signatureDeclaration.modifiers = modifiers; + signatureDeclaration.name = name; + signatureDeclaration.questionToken = optional ? ts.createToken(54) : undefined; + signatureDeclaration.body = body; } + return signatureDeclaration; } - }); + } + function createMethodImplementingSignatures(signatures, name, optional, modifiers) { + var maxArgsSignature = signatures[0]; + var minArgumentCount = signatures[0].minArgumentCount; + var someSigHasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + if (sig.hasRestParameter) { + someSigHasRestParameter = true; + } + if (sig.parameters.length >= maxArgsSignature.parameters.length && (!sig.hasRestParameter || maxArgsSignature.hasRestParameter)) { + maxArgsSignature = sig; + } + } + var maxNonRestArgs = maxArgsSignature.parameters.length - (maxArgsSignature.hasRestParameter ? 1 : 0); + var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.getName(); }); + var parameters = []; + for (var i = 0; i < maxNonRestArgs; i++) { + var anyType = ts.createKeywordTypeNode(118); + var newParameter = ts.createParameter(undefined, undefined, undefined, maxArgsParameterSymbolNames[i], i >= minArgumentCount ? ts.createToken(54) : undefined, anyType, undefined); + parameters.push(newParameter); + } + if (someSigHasRestParameter) { + var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(118)); + var restParameter = ts.createParameter(undefined, undefined, ts.createToken(23), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", maxNonRestArgs >= minArgumentCount ? ts.createToken(54) : undefined, anyArrayType, undefined); + parameters.push(restParameter); + } + return createStubbedMethod(modifiers, name, optional, undefined, parameters, undefined); + } + function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType) { + return ts.createMethodDeclaration(undefined, modifiers, undefined, name, optional ? ts.createToken(54) : undefined, typeParameters, parameters, returnType, createStubbedMethodBody()); + } + codefix.createStubbedMethod = createStubbedMethod; + function createStubbedMethodBody() { + return ts.createBlock([ts.createThrow(ts.createNew(ts.createIdentifier("Error"), undefined, [ts.createLiteral("Method not implemented.")]))], true); + } + function createVisibilityModifier(flags) { + if (flags & 4) { + return ts.createToken(113); + } + else if (flags & 16) { + return ts.createToken(112); + } + return undefined; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; (function (ts) { ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 ? new NodeObject(kind, pos, end) : + var node = kind >= 142 ? new NodeObject(kind, pos, end) : kind === 70 ? new IdentifierObject(70, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -63214,11 +70661,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292, nodes.pos, nodes.end, this); + var list = createNode(293, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { - var node = nodes_7[_i]; + for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { + var node = nodes_9[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -63233,11 +70680,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141) { + if (this.kind >= 142) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291; + var useJSDocScanner_1 = this.kind >= 282 && this.kind <= 292; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -63290,8 +70737,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 266 || kid.kind > 292; }); + return child.kind < 142 ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -63299,7 +70748,10 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 ? child : child.getLastToken(sourceFile); + return child.kind < 142 ? child : child.getLastToken(sourceFile); + }; + NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { + return ts.forEachChild(this, cbNode, cbNodeArray); }; return NodeObject; }()); @@ -63352,6 +70804,9 @@ var ts; TokenOrIdentifierObject.prototype.getLastToken = function () { return undefined; }; + TokenOrIdentifierObject.prototype.forEachChild = function () { + return undefined; + }; return TokenOrIdentifierObject; }()); var SymbolObject = (function () { @@ -63374,6 +70829,12 @@ var ts; } return this.documentationComment; }; + SymbolObject.prototype.getJsDocTags = function () { + if (this.tags === undefined) { + this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations); + } + return this.tags; + }; return SymbolObject; }()); var TokenObject = (function (_super) { @@ -63457,6 +70918,12 @@ var ts; } return this.documentationComment; }; + SignatureObject.prototype.getJsDocTags = function () { + if (this.jsDocTags === undefined) { + this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : []; + } + return this.jsDocTags; + }; return SignatureObject; }()); var SourceFileObject = (function (_super) { @@ -63496,17 +70963,21 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { @@ -63514,9 +70985,9 @@ var ts; if (result_7 !== undefined) { return result_7; } - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { var expr = declaration.name.expression; - if (expr.kind === 177) { + if (expr.kind === 178) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -63536,10 +71007,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 225: - case 184: + case 227: + case 185: + case 150: case 149: - case 148: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -63553,33 +71024,33 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; - case 226: - case 197: - case 227: case 228: + case 198: case 229: case 230: - case 234: - case 243: - case 239: - case 234: + case 231: + case 232: case 236: - case 237: - case 151: + case 245: + case 241: + case 236: + case 238: + case 239: case 152: - case 161: + case 153: + case 162: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144: + case 145: if (!ts.hasModifier(node, 92)) { break; } - case 223: - case 174: { + case 225: + case 175: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -63588,24 +71059,24 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260: + case 263: + case 148: case 147: - case 146: addDeclaration(node); break; - case 241: + case 243: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235: + case 237: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 239) { addDeclaration(importClause.namedBindings); } else { @@ -63831,6 +71302,30 @@ var ts; }; return CancellationTokenObject; }()); + var ThrottledCancellationToken = (function () { + function ThrottledCancellationToken(hostCancellationToken, throttleWaitMilliseconds) { + if (throttleWaitMilliseconds === void 0) { throttleWaitMilliseconds = 20; } + this.hostCancellationToken = hostCancellationToken; + this.throttleWaitMilliseconds = throttleWaitMilliseconds; + this.lastCancellationCheckTime = 0; + } + ThrottledCancellationToken.prototype.isCancellationRequested = function () { + var time = ts.timestamp(); + var duration = Math.abs(time - this.lastCancellationCheckTime); + if (duration >= this.throttleWaitMilliseconds) { + this.lastCancellationCheckTime = time; + return this.hostCancellationToken.isCancellationRequested(); + } + return false; + }; + ThrottledCancellationToken.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new ts.OperationCanceledException(); + } + }; + return ThrottledCancellationToken; + }()); + ts.ThrottledCancellationToken = ThrottledCancellationToken; function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -64048,10 +71543,10 @@ var ts; if (!symbol || typeChecker.isUnknownSymbol(symbol)) { switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: case 98: - case 167: + case 168: case 96: var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -64060,499 +71555,1593 @@ var ts; kindModifiers: ts.ScriptElementKindModifier.none, textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)), - documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined, + tags: type.symbol ? type.symbol.getJsDocTags() : undefined }; } } return undefined; } - var displayPartsDocumentationsAndKind = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node); - return { - kind: displayPartsDocumentationsAndKind.symbolKind, - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), - displayParts: displayPartsDocumentationsAndKind.displayParts, - documentation: displayPartsDocumentationsAndKind.documentation - }; + var displayPartsDocumentationsAndKind = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node); + return { + kind: displayPartsDocumentationsAndKind.symbolKind, + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + displayParts: displayPartsDocumentationsAndKind.displayParts, + documentation: displayPartsDocumentationsAndKind.documentation, + tags: displayPartsDocumentationsAndKind.tags + }; + } + function getDefinitionAtPosition(fileName, position) { + synchronizeHostData(); + return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position); + } + function getTypeDefinitionAtPosition(fileName, position) { + synchronizeHostData(); + return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position); + } + function getImplementationAtPosition(fileName, position) { + synchronizeHostData(); + return ts.FindAllReferences.getImplementationsAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); + } + function getOccurrencesAtPosition(fileName, position) { + var results = getOccurrencesAtPositionCore(fileName, position); + if (results) { + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); + } + return results; + } + function getDocumentHighlights(fileName, position, filesToSearch) { + synchronizeHostData(); + var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return program.getSourceFile(f); }); + var sourceFile = getValidSourceFile(fileName); + return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch); + } + function getOccurrencesAtPositionCore(fileName, position) { + return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName])); + function convertDocumentHighlights(documentHighlights) { + if (!documentHighlights) { + return undefined; + } + var result = []; + for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) { + var entry = documentHighlights_1[_i]; + for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) { + var highlightSpan = _b[_a]; + result.push({ + fileName: entry.fileName, + textSpan: highlightSpan.textSpan, + isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference, + isDefinition: false, + isInString: highlightSpan.isInString, + }); + } + } + return result; + } + } + function findRenameLocations(fileName, position, findInStrings, findInComments) { + return getReferences(fileName, position, { findInStrings: findInStrings, findInComments: findInComments, isForRename: true }); + } + function getReferencesAtPosition(fileName, position) { + return getReferences(fileName, position); + } + function getReferences(fileName, position, options) { + synchronizeHostData(); + return ts.FindAllReferences.findReferencedEntries(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, options); + } + function findReferences(fileName, position) { + synchronizeHostData(); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); + } + function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { + synchronizeHostData(); + var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); + return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles); + } + function getEmitOutput(fileName, emitOnlyDtsFiles) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var outputFiles = []; + function writeFile(fileName, data, writeByteOrderMark) { + outputFiles.push({ + name: fileName, + writeByteOrderMark: writeByteOrderMark, + text: data + }); + } + var customTransformers = host.getCustomTransformers && host.getCustomTransformers(); + var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); + return { + outputFiles: outputFiles, + emitSkipped: emitOutput.emitSkipped + }; + } + function getSignatureHelpItems(fileName, position) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); + } + function getNonBoundSourceFile(fileName) { + return syntaxTreeCache.getCurrentSourceFile(fileName); + } + function getSourceFile(fileName) { + return getNonBoundSourceFile(fileName); + } + function getNameOrDottedNameSpan(fileName, startPos, _endPos) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, startPos); + if (node === sourceFile) { + return; + } + switch (node.kind) { + case 178: + case 142: + case 9: + case 85: + case 100: + case 94: + case 96: + case 98: + case 168: + case 70: + break; + default: + return; + } + var nodeForStartPos = node; + while (true) { + if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) { + nodeForStartPos = nodeForStartPos.parent; + } + else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { + if (nodeForStartPos.parent.parent.kind === 232 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + nodeForStartPos = nodeForStartPos.parent.parent.name; + } + else { + break; + } + } + else { + break; + } + } + return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); + } + function getBreakpointStatementAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); + } + function getNavigationBarItems(fileName) { + return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); + } + function getNavigationTree(fileName) { + return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); + } + function isTsOrTsxFile(fileName) { + var kind = ts.getScriptKind(fileName, host); + return kind === 3 || kind === 4; + } + function getSemanticClassifications(fileName, span) { + if (!isTsOrTsxFile(fileName)) { + return []; + } + synchronizeHostData(); + return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); + } + function getEncodedSemanticClassifications(fileName, span) { + if (!isTsOrTsxFile(fileName)) { + return { spans: [], endOfLineState: 0 }; + } + synchronizeHostData(); + return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); + } + function getSyntacticClassifications(fileName, span) { + return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); + } + function getEncodedSyntacticClassifications(fileName, span) { + return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); + } + function getOutliningSpans(fileName) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return ts.OutliningElementsCollector.collectElements(sourceFile, cancellationToken); + } + function getBraceMatchingAtPosition(fileName, position) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var result = []; + var token = ts.getTouchingToken(sourceFile, position); + if (token.getStart(sourceFile) === position) { + var matchKind = getMatchingTokenKind(token); + if (matchKind) { + var parentElement = token.parent; + var childNodes = parentElement.getChildren(sourceFile); + for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) { + var current = childNodes_1[_i]; + if (current.kind === matchKind) { + var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + if (range1.start < range2.start) { + result.push(range1, range2); + } + else { + result.push(range2, range1); + } + break; + } + } + } + } + return result; + function getMatchingTokenKind(token) { + switch (token.kind) { + case 16: return 17; + case 18: return 19; + case 20: return 21; + case 26: return 28; + case 17: return 16; + case 19: return 18; + case 21: return 20; + case 28: return 26; + } + return undefined; + } } - function getDefinitionAtPosition(fileName, position) { - synchronizeHostData(); - return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position); + function getIndentationAtPosition(fileName, position, editorOptions) { + var start = ts.timestamp(); + var settings = toEditorSettings(editorOptions); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + log("getIndentationAtPosition: getCurrentSourceFile: " + (ts.timestamp() - start)); + start = ts.timestamp(); + var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings); + log("getIndentationAtPosition: computeIndentation : " + (ts.timestamp() - start)); + return result; } - function getImplementationAtPosition(fileName, position) { - synchronizeHostData(); - return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position)); + function getFormattingEditsForRange(fileName, start, end, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var settings = toEditorSettings(options); + return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(settings), settings); } - function getTypeDefinitionAtPosition(fileName, position) { - synchronizeHostData(); - return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position); + function getFormattingEditsForDocument(fileName, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var settings = toEditorSettings(options); + return ts.formatting.formatDocument(sourceFile, getRuleProvider(settings), settings); } - function getOccurrencesAtPosition(fileName, position) { - var results = getOccurrencesAtPositionCore(fileName, position); - if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); + function getFormattingEditsAfterKeystroke(fileName, position, key, options) { + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var settings = toEditorSettings(options); + if (key === "}") { + return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings); } - return results; + else if (key === ";") { + return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings); + } + else if (key === "\n") { + return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings); + } + return []; } - function getDocumentHighlights(fileName, position, filesToSearch) { + function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) { synchronizeHostData(); - var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return program.getSourceFile(f); }); var sourceFile = getValidSourceFile(fileName); - return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch); + var span = { start: start, length: end - start }; + var newLineChar = ts.getNewLineOrDefaultFromHost(host); + var allFixes = []; + ts.forEach(ts.deduplicate(errorCodes), function (error) { + cancellationToken.throwIfCancellationRequested(); + var context = { + errorCode: error, + sourceFile: sourceFile, + span: span, + program: program, + newLineCharacter: newLineChar, + host: host, + cancellationToken: cancellationToken, + rulesProvider: getRuleProvider(formatOptions) + }; + var fixes = ts.codefix.getFixes(context); + if (fixes) { + allFixes = allFixes.concat(fixes); + } + }); + return allFixes; } - function getOccurrencesAtPositionCore(fileName, position) { + function getDocCommentTemplateAtPosition(fileName, position) { + return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position); + } + function isValidBraceCompletionAtPosition(fileName, position, openingBrace) { + if (openingBrace === 60) { + return false; + } + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + if (ts.isInString(sourceFile, position)) { + return false; + } + if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { + return openingBrace === 123; + } + if (ts.isInTemplateString(sourceFile, position)) { + return false; + } + return true; + } + function getTodoComments(fileName, descriptors) { synchronizeHostData(); - return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName])); - function convertDocumentHighlights(documentHighlights) { - if (!documentHighlights) { - return undefined; - } - var result = []; - for (var _i = 0, documentHighlights_1 = documentHighlights; _i < documentHighlights_1.length; _i++) { - var entry = documentHighlights_1[_i]; - for (var _a = 0, _b = entry.highlightSpans; _a < _b.length; _a++) { - var highlightSpan = _b[_a]; - result.push({ - fileName: entry.fileName, - textSpan: highlightSpan.textSpan, - isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference, - isDefinition: false - }); + var sourceFile = getValidSourceFile(fileName); + cancellationToken.throwIfCancellationRequested(); + var fileContents = sourceFile.text; + var result = []; + if (descriptors.length > 0) { + var regExp = getTodoCommentsRegExp(); + var matchArray = void 0; + while (matchArray = regExp.exec(fileContents)) { + cancellationToken.throwIfCancellationRequested(); + var firstDescriptorCaptureIndex = 3; + ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); + var preamble = matchArray[1]; + var matchPosition = matchArray.index + preamble.length; + var token = ts.getTokenAtPosition(sourceFile, matchPosition); + if (!ts.isInsideComment(sourceFile, token, matchPosition)) { + continue; + } + var descriptor = undefined; + for (var i = 0; i < descriptors.length; i++) { + if (matchArray[i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[i]; + } + } + ts.Debug.assert(descriptor !== undefined); + if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { + continue; } + var message = matchArray[2]; + result.push({ + descriptor: descriptor, + message: message, + position: matchPosition + }); } - return result; + } + return result; + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + function getTodoCommentsRegExp() { + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; + var messageRemainder = /(?:.*?)/.source; + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + return new RegExp(regExpString, "gim"); + } + function isLetterOrDigit(char) { + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); } } - function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); - return ts.FindAllReferences.convertReferences(referencedSymbols); + function getRenameInfo(fileName, position) { + synchronizeHostData(); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position); } - function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); - return ts.FindAllReferences.convertReferences(referencedSymbols); + return { + dispose: dispose, + cleanupSemanticCache: cleanupSemanticCache, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, + getSyntacticClassifications: getSyntacticClassifications, + getSemanticClassifications: getSemanticClassifications, + getEncodedSyntacticClassifications: getEncodedSyntacticClassifications, + getEncodedSemanticClassifications: getEncodedSemanticClassifications, + getCompletionsAtPosition: getCompletionsAtPosition, + getCompletionEntryDetails: getCompletionEntryDetails, + getCompletionEntrySymbol: getCompletionEntrySymbol, + getSignatureHelpItems: getSignatureHelpItems, + getQuickInfoAtPosition: getQuickInfoAtPosition, + getDefinitionAtPosition: getDefinitionAtPosition, + getImplementationAtPosition: getImplementationAtPosition, + getTypeDefinitionAtPosition: getTypeDefinitionAtPosition, + getReferencesAtPosition: getReferencesAtPosition, + findReferences: findReferences, + getOccurrencesAtPosition: getOccurrencesAtPosition, + getDocumentHighlights: getDocumentHighlights, + getNameOrDottedNameSpan: getNameOrDottedNameSpan, + getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, + getNavigateToItems: getNavigateToItems, + getRenameInfo: getRenameInfo, + findRenameLocations: findRenameLocations, + getNavigationBarItems: getNavigationBarItems, + getNavigationTree: getNavigationTree, + getOutliningSpans: getOutliningSpans, + getTodoComments: getTodoComments, + getBraceMatchingAtPosition: getBraceMatchingAtPosition, + getIndentationAtPosition: getIndentationAtPosition, + getFormattingEditsForRange: getFormattingEditsForRange, + getFormattingEditsForDocument: getFormattingEditsForDocument, + getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, + isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition, + getCodeFixesAtPosition: getCodeFixesAtPosition, + getEmitOutput: getEmitOutput, + getNonBoundSourceFile: getNonBoundSourceFile, + getSourceFile: getSourceFile, + getProgram: getProgram + }; + } + ts.createLanguageService = createLanguageService; + function getNameTable(sourceFile) { + if (!sourceFile.nameTable) { + initializeNameTable(sourceFile); } - function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); - return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); + return sourceFile.nameTable; + } + ts.getNameTable = getNameTable; + function initializeNameTable(sourceFile) { + var nameTable = ts.createMap(); + walk(sourceFile); + sourceFile.nameTable = nameTable; + function walk(node) { + switch (node.kind) { + case 70: + setNameTable(node.text, node); + break; + case 9: + case 8: + if (ts.isDeclarationName(node) || + node.parent.kind === 247 || + isArgumentOfElementAccessExpression(node) || + ts.isLiteralComputedPropertyDeclarationName(node)) { + setNameTable(node.text, node); + } + break; + default: + ts.forEachChild(node, walk); + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + ts.forEachChild(jsDoc, walk); + } + } + } } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { - synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); } - function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { - synchronizeHostData(); - var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); - return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles); + } + function isObjectLiteralElement(node) { + switch (node.kind) { + case 252: + case 254: + case 260: + case 261: + case 150: + case 152: + case 153: + return true; } - function getEmitOutput(fileName, emitOnlyDtsFiles) { - synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - var outputFiles = []; - function writeFile(fileName, data, writeByteOrderMark) { - outputFiles.push({ - name: fileName, - writeByteOrderMark: writeByteOrderMark, - text: data + return false; + } + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9: + case 8: + if (node.parent.kind === 143) { + return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; + } + case 70: + return isObjectLiteralElement(node.parent) && + (node.parent.parent.kind === 177 || node.parent.parent.kind === 253) && + node.parent.name === node ? node.parent : undefined; + } + return undefined; + } + ts.getContainingObjectLiteralElement = getContainingObjectLiteralElement; + function getPropertySymbolsFromContextualType(typeChecker, node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = ts.getTextOfPropertyName(node.name); + if (name && contextualType) { + var result_8 = []; + var symbol = contextualType.getProperty(name); + if (contextualType.flags & 65536) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_8.push(symbol); + } }); + return result_8; + } + if (symbol) { + result_8.push(symbol); + return result_8; } - var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles); - return { - outputFiles: outputFiles, - emitSkipped: emitOutput.emitSkipped - }; } - function getSignatureHelpItems(fileName, position) { - synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); + return undefined; + } + ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; + function isArgumentOfElementAccessExpression(node) { + return node && + node.parent && + node.parent.kind === 179 && + node.parent.argumentExpression === node; + } + function getDefaultLibFilePath(options) { + if (typeof __dirname !== "undefined") { + return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options); } - function getNonBoundSourceFile(fileName) { - return syntaxTreeCache.getCurrentSourceFile(fileName); + throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); + } + ts.getDefaultLibFilePath = getDefaultLibFilePath; + ts.objectAllocator = getServicesObjectAllocator(); +})(ts || (ts = {})); +var debugObjectHost = (function () { return this; })(); +var ts; +(function (ts) { + function logInternalError(logger, err) { + if (logger) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); } - function getSourceFile(fileName) { - return getNonBoundSourceFile(fileName); + } + var ScriptSnapshotShimAdapter = (function () { + function ScriptSnapshotShimAdapter(scriptSnapshotShim) { + this.scriptSnapshotShim = scriptSnapshotShim; } - function getNameOrDottedNameSpan(fileName, startPos, _endPos) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - var node = ts.getTouchingPropertyName(sourceFile, startPos); - if (node === sourceFile) { - return; + ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { + return this.scriptSnapshotShim.getText(start, end); + }; + ScriptSnapshotShimAdapter.prototype.getLength = function () { + return this.scriptSnapshotShim.getLength(); + }; + ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { + var oldSnapshotShim = oldSnapshot; + var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); + if (encoded === null) { + return null; } - switch (node.kind) { - case 177: - case 141: - case 9: - case 85: - case 100: - case 94: - case 96: - case 98: - case 167: - case 70: - break; - default: - return; + var decoded = JSON.parse(encoded); + return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength); + }; + ScriptSnapshotShimAdapter.prototype.dispose = function () { + if ("dispose" in this.scriptSnapshotShim) { + this.scriptSnapshotShim.dispose(); } - var nodeForStartPos = node; - while (true) { - if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) { - nodeForStartPos = nodeForStartPos.parent; - } - else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 230 && - nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { - nodeForStartPos = nodeForStartPos.parent.parent.name; - } - else { - break; + }; + return ScriptSnapshotShimAdapter; + }()); + var LanguageServiceShimHostAdapter = (function () { + function LanguageServiceShimHostAdapter(shimHost) { + var _this = this; + this.shimHost = shimHost; + this.loggingEnabled = false; + this.tracingEnabled = false; + if ("getModuleResolutionsForFile" in this.shimHost) { + this.resolveModuleNames = function (moduleNames, containingFile) { + var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); + return ts.map(moduleNames, function (name) { + var result = ts.getProperty(resolutionsInFile, name); + return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: false } : undefined; + }); + }; + } + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.getProperty(typeDirectivesForFile, name); }); + }; + } + } + LanguageServiceShimHostAdapter.prototype.log = function (s) { + if (this.loggingEnabled) { + this.shimHost.log(s); + } + }; + LanguageServiceShimHostAdapter.prototype.trace = function (s) { + if (this.tracingEnabled) { + this.shimHost.trace(s); + } + }; + LanguageServiceShimHostAdapter.prototype.error = function (s) { + this.shimHost.error(s); + }; + LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { + if (!this.shimHost.getProjectVersion) { + return undefined; + } + return this.shimHost.getProjectVersion(); + }; + LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () { + if (!this.shimHost.getTypeRootsVersion) { + return 0; + } + return this.shimHost.getTypeRootsVersion(); + }; + LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () { + return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; + }; + LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { + var settingsJson = this.shimHost.getCompilationSettings(); + if (settingsJson === null || settingsJson === "") { + throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); + } + var compilerOptions = JSON.parse(settingsJson); + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; + }; + LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { + var encoded = this.shimHost.getScriptFileNames(); + return this.files = JSON.parse(encoded); + }; + LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { + var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); + return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); + }; + LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) { + if ("getScriptKind" in this.shimHost) { + return this.shimHost.getScriptKind(fileName); + } + else { + return 0; + } + }; + LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { + return this.shimHost.getScriptVersion(fileName); + }; + LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { + var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); + if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") { + return null; + } + try { + return JSON.parse(diagnosticMessagesJson); + } + catch (e) { + this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); + return null; + } + }; + LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { + var hostCancellationToken = this.shimHost.getCancellationToken(); + return new ts.ThrottledCancellationToken(hostCancellationToken); + }; + LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { + return this.shimHost.getCurrentDirectory(); + }; + LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) { + return JSON.parse(this.shimHost.getDirectories(path)); + }; + LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + }; + LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) { + var pattern = ts.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); + }; + LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) { + return this.shimHost.readFile(path, encoding); + }; + LanguageServiceShimHostAdapter.prototype.fileExists = function (path) { + return this.shimHost.fileExists(path); + }; + return LanguageServiceShimHostAdapter; + }()); + ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; + var CoreServicesShimHostAdapter = (function () { + function CoreServicesShimHostAdapter(shimHost) { + var _this = this; + this.shimHost = shimHost; + this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; + if ("directoryExists" in this.shimHost) { + this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; + } + if ("realpath" in this.shimHost) { + this.realpath = function (path) { return _this.shimHost.realpath(path); }; + } + } + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) { + try { + var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); + } + catch (e) { + var results = []; + for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) { + var extension = extensions_2[_i]; + for (var _a = 0, _b = this.readDirectoryFallback(rootDir, extension, exclude); _a < _b.length; _a++) { + var file = _b[_a]; + if (!ts.contains(results, file)) { + results.push(file); + } } } - else { - break; + return results; + } + }; + CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { + return this.shimHost.fileExists(fileName); + }; + CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { + return this.shimHost.readFile(fileName); + }; + CoreServicesShimHostAdapter.prototype.readDirectoryFallback = function (rootDir, extension, exclude) { + return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude))); + }; + CoreServicesShimHostAdapter.prototype.getDirectories = function (path) { + return JSON.parse(this.shimHost.getDirectories(path)); + }; + return CoreServicesShimHostAdapter; + }()); + ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action, logPerformance) { + var start; + if (logPerformance) { + logger.log(actionDescription); + start = ts.timestamp(); + } + var result = action(); + if (logPerformance) { + var end = ts.timestamp(); + logger.log(actionDescription + " completed in " + (end - start) + " msec"); + if (typeof result === "string") { + var str = result; + if (str.length > 128) { + str = str.substring(0, 128) + "..."; } + logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); } - return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); } - function getBreakpointStatementAtPosition(fileName, position) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); + return result; + } + function forwardJSONCall(logger, actionDescription, action, logPerformance) { + return forwardCall(logger, actionDescription, true, action, logPerformance); + } + function forwardCall(logger, actionDescription, returnJson, action, logPerformance) { + try { + var result = simpleForwardCall(logger, actionDescription, action, logPerformance); + return returnJson ? JSON.stringify({ result: result }) : result; } - function getNavigationBarItems(fileName) { - return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName)); + catch (err) { + if (err instanceof ts.OperationCanceledException) { + return JSON.stringify({ canceled: true }); + } + logInternalError(logger, err); + err.description = actionDescription; + return JSON.stringify({ error: err }); } - function getNavigationTree(fileName) { - return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName)); + } + var ShimBase = (function () { + function ShimBase(factory) { + this.factory = factory; + factory.registerShim(this); } - function isTsOrTsxFile(fileName) { - var kind = ts.getScriptKind(fileName, host); - return kind === 3 || kind === 4; + ShimBase.prototype.dispose = function (_dummy) { + this.factory.unregisterShim(this); + }; + return ShimBase; + }()); + function realizeDiagnostics(diagnostics, newLine) { + return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); }); + } + ts.realizeDiagnostics = realizeDiagnostics; + function realizeDiagnostic(diagnostic, newLine) { + return { + message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), + start: diagnostic.start, + length: diagnostic.length, + category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(), + code: diagnostic.code + }; + } + var LanguageServiceShimObject = (function (_super) { + __extends(LanguageServiceShimObject, _super); + function LanguageServiceShimObject(factory, host, languageService) { + var _this = _super.call(this, factory) || this; + _this.host = host; + _this.languageService = languageService; + _this.logPerformance = false; + _this.logger = _this.host; + return _this; } - function getSemanticClassifications(fileName, span) { - if (!isTsOrTsxFile(fileName)) { - return []; + LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); + }; + LanguageServiceShimObject.prototype.dispose = function (dummy) { + this.logger.log("dispose()"); + this.languageService.dispose(); + this.languageService = null; + if (debugObjectHost && debugObjectHost.CollectGarbage) { + debugObjectHost.CollectGarbage(); + this.logger.log("CollectGarbage()"); } - synchronizeHostData(); - return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); + this.logger = null; + _super.prototype.dispose.call(this, dummy); + }; + LanguageServiceShimObject.prototype.refresh = function (throwOnError) { + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; }); + }; + LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { + var _this = this; + this.forwardJSONCall("cleanupSemanticCache()", function () { + _this.languageService.cleanupSemanticCache(); + return null; + }); + }; + LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { + var newLine = ts.getNewLineOrDefaultFromHost(this.host); + return ts.realizeDiagnostics(diagnostics, newLine); + }; + LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); }); + }; + LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); }); + }; + LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); + }; + LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); + }; + LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSemanticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () { + var _this = this; + return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { + var diagnostics = _this.languageService.getCompilerOptionsDiagnostics(); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { + var _this = this; + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); }); + }; + LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getImplementationAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getImplementationAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); }); + }; + LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { + var _this = this; + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); }); + }; + LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.isValidBraceCompletionAtPosition = function (fileName, position, openingBrace) { + var _this = this; + return this.forwardJSONCall("isValidBraceCompletionAtPosition('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); }); + }; + LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getIndentationAtPosition(fileName, position, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.findReferences = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { + var _this = this; + return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { + var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); + return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); + }); + }; + LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { + var _this = this; + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsForDocument(fileName, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); }); + }; + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) { + var _this = this; + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ", " + fileName + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); }); + }; + LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); }); + }; + LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); }); + }; + LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { + var _this = this; + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); }); + }; + LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { + var _this = this; + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); }); + }; + LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { + var _this = this; + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); }); + }; + LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) { + var _this = this; + return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance); + }; + return LanguageServiceShimObject; + }(ShimBase)); + function convertClassifications(classifications) { + return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; + } + var ClassifierShimObject = (function (_super) { + __extends(ClassifierShimObject, _super); + function ClassifierShimObject(factory, logger) { + var _this = _super.call(this, factory) || this; + _this.logger = logger; + _this.logPerformance = false; + _this.classifier = ts.createClassifier(); + return _this; } - function getEncodedSemanticClassifications(fileName, span) { - if (!isTsOrTsxFile(fileName)) { - return { spans: [], endOfLineState: 0 }; + ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { + var _this = this; + return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance); + }; + ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { + var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); + var result = ""; + for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { + var item = _a[_i]; + result += item.length + "\n"; + result += item.classification + "\n"; } - synchronizeHostData(); - return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); - } - function getSyntacticClassifications(fileName, span) { - return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); - } - function getEncodedSyntacticClassifications(fileName, span) { - return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); - } - function getOutliningSpans(fileName) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.OutliningElementsCollector.collectElements(sourceFile); + result += classification.finalLexState; + return result; + }; + return ClassifierShimObject; + }(ShimBase)); + var CoreServicesShimObject = (function (_super) { + __extends(CoreServicesShimObject, _super); + function CoreServicesShimObject(factory, logger, host) { + var _this = _super.call(this, factory) || this; + _this.logger = logger; + _this.host = host; + _this.logPerformance = false; + return _this; } - function getBraceMatchingAtPosition(fileName, position) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); + }; + CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; + return { + resolvedFileName: resolvedFileName, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; + CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true); + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), + ambientExternalModules: result.ambientExternalModules, + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) + }; + }); + }; + CoreServicesShimObject.prototype.getAutomaticTypeDirectiveNames = function (compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("getAutomaticTypeDirectiveNames('" + compilerOptionsJson + "')", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + return ts.getAutomaticTypeDirectiveNames(compilerOptions, _this.host); + }); + }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } var result = []; - var token = ts.getTouchingToken(sourceFile, position); - if (token.getStart(sourceFile) === position) { - var matchKind = getMatchingTokenKind(token); - if (matchKind) { - var parentElement = token.parent; - var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) { - var current = childNodes_1[_i]; - if (current.kind === matchKind) { - var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); - var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); - if (range1.start < range2.start) { - result.push(range1, range2); - } - else { - result.push(range2, range1); - } - break; - } - } - } + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); } return result; - function getMatchingTokenKind(token) { - switch (token.kind) { - case 16: return 17; - case 18: return 19; - case 20: return 21; - case 26: return 28; - case 17: return 16; - case 19: return 18; - case 21: return 20; - case 28: return 26; + }; + CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { + var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); + var result = ts.parseConfigFileTextToJson(fileName, text); + if (result.error) { + return { + options: {}, + typeAcquisition: {}, + files: [], + raw: {}, + errors: [realizeDiagnostic(result.error, "\r\n")] + }; + } + var normalizedFileName = ts.normalizeSlashes(fileName); + var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); + return { + options: configFile.options, + typeAcquisition: configFile.typeAcquisition, + files: configFile.fileNames, + raw: configFile.raw, + errors: realizeDiagnostics(configFile.errors, "\r\n") + }; + }); + }; + CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); + }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + var getCanonicalFileName = ts.createGetCanonicalFileName(false); + return this.forwardJSONCall("discoverTypings()", function () { + var info = JSON.parse(discoverTypingsJson); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); + }); + }; + return CoreServicesShimObject; + }(ShimBase)); + var TypeScriptServicesFactory = (function () { + function TypeScriptServicesFactory() { + this._shims = []; + } + TypeScriptServicesFactory.prototype.getServicesVersion = function () { + return ts.servicesVersion; + }; + TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { + try { + if (this.documentRegistry === undefined) { + this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); + } + var hostAdapter = new LanguageServiceShimHostAdapter(host); + var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); + return new LanguageServiceShimObject(this, host, languageService); + } + catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { + try { + return new ClassifierShimObject(this, logger); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) { + try { + var adapter = new CoreServicesShimHostAdapter(host); + return new CoreServicesShimObject(this, host, adapter); + } + catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.close = function () { + this._shims = []; + this.documentRegistry = undefined; + }; + TypeScriptServicesFactory.prototype.registerShim = function (shim) { + this._shims.push(shim); + }; + TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { + for (var i = 0; i < this._shims.length; i++) { + if (this._shims[i] === shim) { + delete this._shims[i]; + return; } - return undefined; } + throw new Error("Invalid operation"); + }; + return TypeScriptServicesFactory; + }()); + ts.TypeScriptServicesFactory = TypeScriptServicesFactory; + if (typeof module !== "undefined" && module.exports) { + module.exports = ts; + } +})(ts || (ts = {})); +var TypeScript; +(function (TypeScript) { + var Services; + (function (Services) { + Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; + })(Services = TypeScript.Services || (TypeScript.Services = {})); +})(TypeScript || (TypeScript = {})); +var toolsVersion = "2.3"; +var ts; +(function (ts) { + var server; + (function (server) { + server.ActionSet = "action::set"; + server.ActionInvalidate = "action::invalidate"; + server.EventBeginInstallTypes = "event::beginInstallTypes"; + server.EventEndInstallTypes = "event::endInstallTypes"; + server.EventInitializationFailed = "event::initializationFailed"; + var Arguments; + (function (Arguments) { + Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; + Arguments.LogFile = "--logFile"; + Arguments.EnableTelemetry = "--enableTelemetry"; + Arguments.TypingSafeListLocation = "--typingSafeListLocation"; + })(Arguments = server.Arguments || (server.Arguments = {})); + function hasArgument(argumentName) { + return ts.sys.args.indexOf(argumentName) >= 0; } - function getIndentationAtPosition(fileName, position, editorOptions) { - var start = ts.timestamp(); - var settings = toEditorSettings(editorOptions); - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - log("getIndentationAtPosition: getCurrentSourceFile: " + (ts.timestamp() - start)); - start = ts.timestamp(); - var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings); - log("getIndentationAtPosition: computeIndentation : " + (ts.timestamp() - start)); - return result; + server.hasArgument = hasArgument; + function findArgument(argumentName) { + var index = ts.sys.args.indexOf(argumentName); + return index >= 0 && index < ts.sys.args.length - 1 + ? ts.sys.args[index + 1] + : undefined; } - function getFormattingEditsForRange(fileName, start, end, options) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - var settings = toEditorSettings(options); - return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(settings), settings); + server.findArgument = findArgument; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var LogLevel; + (function (LogLevel) { + LogLevel[LogLevel["terse"] = 0] = "terse"; + LogLevel[LogLevel["normal"] = 1] = "normal"; + LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; + LogLevel[LogLevel["verbose"] = 3] = "verbose"; + })(LogLevel = server.LogLevel || (server.LogLevel = {})); + server.emptyArray = []; + var Msg; + (function (Msg) { + Msg.Err = "Err"; + Msg.Info = "Info"; + Msg.Perf = "Perf"; + })(Msg = server.Msg || (server.Msg = {})); + function getProjectRootPath(project) { + switch (project.projectKind) { + case server.ProjectKind.Configured: + return ts.getDirectoryPath(project.getProjectName()); + case server.ProjectKind.Inferred: + return ""; + case server.ProjectKind.External: + var projectName = ts.normalizeSlashes(project.getProjectName()); + return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; + } } - function getFormattingEditsForDocument(fileName, options) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - var settings = toEditorSettings(options); - return ts.formatting.formatDocument(sourceFile, getRuleProvider(settings), settings); + function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { + return { + projectName: project.getProjectName(), + fileNames: project.getFileNames(true), + compilerOptions: project.getCompilerOptions(), + typeAcquisition: typeAcquisition, + unresolvedImports: unresolvedImports, + projectRootPath: getProjectRootPath(project), + cachePath: cachePath, + kind: "discover" + }; } - function getFormattingEditsAfterKeystroke(fileName, position, key, options) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - var settings = toEditorSettings(options); - if (key === "}") { - return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings); + server.createInstallTypingsRequest = createInstallTypingsRequest; + var Errors; + (function (Errors) { + function ThrowNoProject() { + throw new Error("No Project."); } - else if (key === ";") { - return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings); + Errors.ThrowNoProject = ThrowNoProject; + function ThrowProjectLanguageServiceDisabled() { + throw new Error("The project's language service is disabled."); } - else if (key === "\n") { - return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings); + Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; + function ThrowProjectDoesNotContainDocument(fileName, project) { + throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); } - return []; + Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; + })(Errors = server.Errors || (server.Errors = {})); + function getDefaultFormatCodeSettings(host) { + return { + indentSize: 4, + tabSize: 4, + newLineCharacter: host.newLine || "\n", + convertTabsToSpaces: true, + indentStyle: ts.IndentStyle.Smart, + insertSpaceAfterConstructor: false, + insertSpaceAfterCommaDelimiter: true, + insertSpaceAfterSemicolonInForStatements: true, + insertSpaceBeforeAndAfterBinaryOperators: true, + insertSpaceAfterKeywordsInControlFlowStatements: true, + insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, + placeOpenBraceOnNewLineForFunctions: false, + placeOpenBraceOnNewLineForControlBlocks: false, + }; } - function getCodeFixesAtPosition(fileName, start, end, errorCodes) { - synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - var span = { start: start, length: end - start }; - var newLineChar = ts.getNewLineOrDefaultFromHost(host); - var allFixes = []; - ts.forEach(errorCodes, function (error) { - cancellationToken.throwIfCancellationRequested(); - var context = { - errorCode: error, - sourceFile: sourceFile, - span: span, - program: program, - newLineCharacter: newLineChar, - host: host, - cancellationToken: cancellationToken - }; - var fixes = ts.codefix.getFixes(context); - if (fixes) { - allFixes = allFixes.concat(fixes); + server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; + function mergeMapLikes(target, source) { + for (var key in source) { + if (ts.hasProperty(source, key)) { + target[key] = source[key]; } - }); - return allFixes; - } - function getDocCommentTemplateAtPosition(fileName, position) { - return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position); - } - function isValidBraceCompletionAtPosition(fileName, position, openingBrace) { - if (openingBrace === 60) { - return false; - } - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { - return false; - } - if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { - return openingBrace === 123; - } - if (ts.isInTemplateString(sourceFile, position)) { - return false; } - return true; } - function getTodoComments(fileName, descriptors) { - synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - cancellationToken.throwIfCancellationRequested(); - var fileContents = sourceFile.text; - var result = []; - if (descriptors.length > 0) { - var regExp = getTodoCommentsRegExp(); - var matchArray = void 0; - while (matchArray = regExp.exec(fileContents)) { - cancellationToken.throwIfCancellationRequested(); - var firstDescriptorCaptureIndex = 3; - ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); - var preamble = matchArray[1]; - var matchPosition = matchArray.index + preamble.length; - var token = ts.getTokenAtPosition(sourceFile, matchPosition); - if (!ts.isInsideComment(sourceFile, token, matchPosition)) { - continue; - } - var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { - if (matchArray[i + firstDescriptorCaptureIndex]) { - descriptor = descriptors[i]; - } - } - ts.Debug.assert(descriptor !== undefined); - if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { - continue; - } - var message = matchArray[2]; - result.push({ - descriptor: descriptor, - message: message, - position: matchPosition - }); - } + server.mergeMapLikes = mergeMapLikes; + function removeItemFromSet(items, itemToRemove) { + if (items.length === 0) { + return; } - return result; - function escapeRegExp(str) { - return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + var index = items.indexOf(itemToRemove); + if (index < 0) { + return; } - function getTodoCommentsRegExp() { - var singleLineCommentStart = /(?:\/\/+\s*)/.source; - var multiLineCommentStart = /(?:\/\*+\s*)/.source; - var anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source; - var preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; - var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; - var messageRemainder = /(?:.*?)/.source; - var messagePortion = "(" + literals + messageRemainder + ")"; - var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; - return new RegExp(regExpString, "gim"); + if (index === items.length - 1) { + items.pop(); } - function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || - (char >= 65 && char <= 90) || - (char >= 48 && char <= 57); + else { + items[index] = items.pop(); } } - function getRenameInfo(fileName, position) { - synchronizeHostData(); - var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); - return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position); + server.removeItemFromSet = removeItemFromSet; + function toNormalizedPath(fileName) { + return ts.normalizePath(fileName); } - return { - dispose: dispose, - cleanupSemanticCache: cleanupSemanticCache, - getSyntacticDiagnostics: getSyntacticDiagnostics, - getSemanticDiagnostics: getSemanticDiagnostics, - getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, - getSyntacticClassifications: getSyntacticClassifications, - getSemanticClassifications: getSemanticClassifications, - getEncodedSyntacticClassifications: getEncodedSyntacticClassifications, - getEncodedSemanticClassifications: getEncodedSemanticClassifications, - getCompletionsAtPosition: getCompletionsAtPosition, - getCompletionEntryDetails: getCompletionEntryDetails, - getCompletionEntrySymbol: getCompletionEntrySymbol, - getSignatureHelpItems: getSignatureHelpItems, - getQuickInfoAtPosition: getQuickInfoAtPosition, - getDefinitionAtPosition: getDefinitionAtPosition, - getImplementationAtPosition: getImplementationAtPosition, - getTypeDefinitionAtPosition: getTypeDefinitionAtPosition, - getReferencesAtPosition: getReferencesAtPosition, - findReferences: findReferences, - getOccurrencesAtPosition: getOccurrencesAtPosition, - getDocumentHighlights: getDocumentHighlights, - getNameOrDottedNameSpan: getNameOrDottedNameSpan, - getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, - getNavigateToItems: getNavigateToItems, - getRenameInfo: getRenameInfo, - findRenameLocations: findRenameLocations, - getNavigationBarItems: getNavigationBarItems, - getNavigationTree: getNavigationTree, - getOutliningSpans: getOutliningSpans, - getTodoComments: getTodoComments, - getBraceMatchingAtPosition: getBraceMatchingAtPosition, - getIndentationAtPosition: getIndentationAtPosition, - getFormattingEditsForRange: getFormattingEditsForRange, - getFormattingEditsForDocument: getFormattingEditsForDocument, - getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, - getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, - isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition, - getCodeFixesAtPosition: getCodeFixesAtPosition, - getEmitOutput: getEmitOutput, - getNonBoundSourceFile: getNonBoundSourceFile, - getSourceFile: getSourceFile, - getProgram: getProgram - }; - } - ts.createLanguageService = createLanguageService; - function getNameTable(sourceFile) { - if (!sourceFile.nameTable) { - initializeNameTable(sourceFile); + server.toNormalizedPath = toNormalizedPath; + function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { + var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); + return getCanonicalFileName(f); } - return sourceFile.nameTable; - } - ts.getNameTable = getNameTable; - function initializeNameTable(sourceFile) { - var nameTable = ts.createMap(); - walk(sourceFile); - sourceFile.nameTable = nameTable; - function walk(node) { - switch (node.kind) { - case 70: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; - break; - case 9: - case 8: - if (ts.isDeclarationName(node) || - node.parent.kind === 245 || - isArgumentOfElementAccessExpression(node) || - ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; - } - break; - default: - ts.forEachChild(node, walk); - if (node.jsDoc) { - for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { - var jsDoc = _a[_i]; - ts.forEachChild(jsDoc, walk); - } - } - } + server.normalizedPathToPath = normalizedPathToPath; + function asNormalizedPath(fileName) { + return fileName; } - } - function isArgumentOfElementAccessExpression(node) { - return node && - node.parent && - node.parent.kind === 178 && - node.parent.argumentExpression === node; - } - function getDefaultLibFilePath(options) { - if (typeof __dirname !== "undefined") { - return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options); + server.asNormalizedPath = asNormalizedPath; + function createNormalizedPathMap() { + var map = ts.createMap(); + return { + get: function (path) { + return map.get(path); + }, + set: function (path, value) { + map.set(path, value); + }, + contains: function (path) { + return map.has(path); + }, + remove: function (path) { + map.delete(path); + } + }; } - throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); - } - ts.getDefaultLibFilePath = getDefaultLibFilePath; - function initializeServices() { - ts.objectAllocator = getServicesObjectAllocator(); - } - initializeServices(); + server.createNormalizedPathMap = createNormalizedPathMap; + function isInferredProjectName(name) { + return /dev\/null\/inferredProject\d+\*/.test(name); + } + server.isInferredProjectName = isInferredProjectName; + function makeInferredProjectName(counter) { + return "/dev/null/inferredProject" + counter + "*"; + } + server.makeInferredProjectName = makeInferredProjectName; + function toSortedReadonlyArray(arr) { + arr.sort(); + return arr; + } + server.toSortedReadonlyArray = toSortedReadonlyArray; + var ThrottledOperations = (function () { + function ThrottledOperations(host) { + this.host = host; + this.pendingTimeouts = ts.createMap(); + } + ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { + var pendingTimeout = this.pendingTimeouts.get(operationId); + if (pendingTimeout) { + this.host.clearTimeout(pendingTimeout); + } + this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb)); + }; + ThrottledOperations.run = function (self, operationId, cb) { + self.pendingTimeouts.delete(operationId); + cb(); + }; + return ThrottledOperations; + }()); + server.ThrottledOperations = ThrottledOperations; + var GcTimer = (function () { + function GcTimer(host, delay, logger) { + this.host = host; + this.delay = delay; + this.logger = logger; + } + GcTimer.prototype.scheduleCollect = function () { + if (!this.host.gc || this.timerId !== undefined) { + return; + } + this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); + }; + GcTimer.run = function (self) { + self.timerId = undefined; + var log = self.logger.hasLevel(LogLevel.requestTime); + var before = log && self.host.getMemoryUsage(); + self.host.gc(); + if (log) { + var after = self.host.getMemoryUsage(); + self.logger.perftrc("GC::before " + before + ", after " + after); + } + }; + return GcTimer; + }()); + server.GcTimer = GcTimer; + })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var ts; (function (ts) { var server; (function (server) { + var TextStorage = (function () { + function TextStorage(host, fileName) { + this.host = host; + this.fileName = fileName; + this.svcVersion = 0; + this.textVersion = 0; + } + TextStorage.prototype.getVersion = function () { + return this.svc + ? "SVC-" + this.svcVersion + "-" + this.svc.getSnapshot().version + : "Text-" + this.textVersion; + }; + TextStorage.prototype.hasScriptVersionCache = function () { + return this.svc !== undefined; + }; + TextStorage.prototype.useScriptVersionCache = function (newText) { + this.switchToScriptVersionCache(newText); + }; + TextStorage.prototype.useText = function (newText) { + this.svc = undefined; + this.setText(newText); + }; + TextStorage.prototype.edit = function (start, end, newText) { + this.switchToScriptVersionCache().edit(start, end - start, newText); + }; + TextStorage.prototype.reload = function (text) { + if (this.svc) { + this.svc.reload(text); + } + else { + this.setText(text); + } + }; + TextStorage.prototype.reloadFromFile = function (tempFileName) { + if (this.svc || (tempFileName !== this.fileName)) { + this.reload(this.getFileText(tempFileName)); + } + else { + this.setText(undefined); + } + }; + TextStorage.prototype.getSnapshot = function () { + return this.svc + ? this.svc.getSnapshot() + : ts.ScriptSnapshot.fromString(this.getOrLoadText()); + }; + TextStorage.prototype.getLineInfo = function (line) { + return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line); + }; + TextStorage.prototype.lineToTextSpan = function (line) { + if (!this.svc) { + var lineMap = this.getLineMap(); + var start = lineMap[line]; + var end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length; + return ts.createTextSpanFromBounds(start, end); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line + 1); + var len; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.offset - lineInfo.offset; + } + return ts.createTextSpan(lineInfo.offset, len); + }; + TextStorage.prototype.lineOffsetToPosition = function (line, offset) { + if (!this.svc) { + return ts.computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line); + return (lineInfo.offset + offset - 1); + }; + TextStorage.prototype.positionToLineOffset = function (position) { + if (!this.svc) { + var _a = ts.computeLineAndCharacterOfPosition(this.getLineMap(), position), line = _a.line, character = _a.character; + return { line: line + 1, offset: character + 1 }; + } + var index = this.svc.getSnapshot().index; + var lineOffset = index.charOffsetToLineNumberAndPos(position); + return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + }; + TextStorage.prototype.getFileText = function (tempFileName) { + return this.host.readFile(tempFileName || this.fileName) || ""; + }; + TextStorage.prototype.ensureNoScriptVersionCache = function () { + ts.Debug.assert(!this.svc, "ScriptVersionCache should not be set"); + }; + TextStorage.prototype.switchToScriptVersionCache = function (newText) { + if (!this.svc) { + this.svc = server.ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText()); + this.svcVersion++; + this.text = undefined; + } + return this.svc; + }; + TextStorage.prototype.getOrLoadText = function () { + this.ensureNoScriptVersionCache(); + if (this.text === undefined) { + this.setText(this.getFileText()); + } + return this.text; + }; + TextStorage.prototype.getLineMap = function () { + this.ensureNoScriptVersionCache(); + return this.lineMap || (this.lineMap = ts.computeLineStarts(this.getOrLoadText())); + }; + TextStorage.prototype.setText = function (newText) { + this.ensureNoScriptVersionCache(); + if (newText === undefined || this.text !== newText) { + this.text = newText; + this.lineMap = undefined; + this.textVersion++; + } + }; + return TextStorage; + }()); + server.TextStorage = TextStorage; var ScriptInfo = (function () { - function ScriptInfo(host, fileName, content, scriptKind, isOpen, hasMixedContent) { - if (isOpen === void 0) { isOpen = false; } + function ScriptInfo(host, fileName, scriptKind, hasMixedContent) { if (hasMixedContent === void 0) { hasMixedContent = false; } this.host = host; this.fileName = fileName; this.scriptKind = scriptKind; - this.isOpen = isOpen; this.hasMixedContent = hasMixedContent; this.containingProjects = []; this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); - this.svc = server.ScriptVersionCache.fromString(host, content); + this.textStorage = new TextStorage(host, fileName); + if (hasMixedContent) { + this.textStorage.reload(""); + } this.scriptKind = scriptKind ? scriptKind : ts.getScriptKindFromFileName(fileName); } + ScriptInfo.prototype.isScriptOpen = function () { + return this.isOpen; + }; + ScriptInfo.prototype.open = function (newText) { + this.isOpen = true; + this.textStorage.useScriptVersionCache(newText); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.close = function () { + this.isOpen = false; + this.textStorage.useText(this.hasMixedContent ? "" : undefined); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.getSnapshot = function () { + return this.textStorage.getSnapshot(); + }; ScriptInfo.prototype.getFormatCodeSettings = function () { return this.formatCodeSettings; }; @@ -64601,17 +73190,37 @@ var ts; this.containingProjects.length = 0; }; ScriptInfo.prototype.getDefaultProject = function () { - if (this.containingProjects.length === 0) { - return server.Errors.ThrowNoProject(); + switch (this.containingProjects.length) { + case 0: + return server.Errors.ThrowNoProject(); + case 1: + return this.containingProjects[0]; + default: + var firstExternalProject = void 0; + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var project = _a[_i]; + if (project.projectKind === server.ProjectKind.Configured) { + return project; + } + else if (project.projectKind === server.ProjectKind.External && !firstExternalProject) { + firstExternalProject = project; + } + } + return firstExternalProject || this.containingProjects[0]; + } + }; + ScriptInfo.prototype.registerFileUpdate = function () { + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + p.registerFileUpdate(this.path); } - return this.containingProjects[0]; }; ScriptInfo.prototype.setFormatOptions = function (formatSettings) { if (formatSettings) { if (!this.formatCodeSettings) { this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host); } - server.mergeMaps(this.formatCodeSettings, formatSettings); + server.mergeMapLikes(this.formatCodeSettings, formatSettings); } }; ScriptInfo.prototype.setWatcher = function (watcher) { @@ -64625,14 +73234,14 @@ var ts; } }; ScriptInfo.prototype.getLatestVersion = function () { - return this.svc.latestVersion().toString(); + return this.textStorage.getVersion(); }; ScriptInfo.prototype.reload = function (script) { - this.svc.reload(script); + this.textStorage.reload(script); this.markContainingProjectsAsDirty(); }; ScriptInfo.prototype.saveTo = function (fileName) { - var snap = this.snap(); + var snap = this.textStorage.getSnapshot(); this.host.writeFile(fileName, snap.getText(0, snap.getLength())); }; ScriptInfo.prototype.reloadFromFile = function (tempFileName) { @@ -64640,19 +73249,15 @@ var ts; this.reload(""); } else { - this.svc.reloadFromFile(tempFileName || this.fileName); + this.textStorage.reloadFromFile(tempFileName); this.markContainingProjectsAsDirty(); } }; - ScriptInfo.prototype.snap = function () { - return this.svc.getSnapshot(); - }; ScriptInfo.prototype.getLineInfo = function (line) { - var snap = this.snap(); - return snap.index.lineNumberToInfo(line); + return this.textStorage.getLineInfo(line); }; ScriptInfo.prototype.editContent = function (start, end, newText) { - this.svc.edit(start, end - start, newText); + this.textStorage.edit(start, end, newText); this.markContainingProjectsAsDirty(); }; ScriptInfo.prototype.markContainingProjectsAsDirty = function () { @@ -64662,27 +73267,16 @@ var ts; } }; ScriptInfo.prototype.lineToTextSpan = function (line) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line + 1); - var len; - if (lineInfo.leaf) { - len = lineInfo.leaf.text.length; - } - else { - var nextLineInfo = index.lineNumberToInfo(line + 2); - len = nextLineInfo.offset - lineInfo.offset; - } - return ts.createTextSpan(lineInfo.offset, len); + return this.textStorage.lineToTextSpan(line); }; ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line); - return (lineInfo.offset + offset - 1); + return this.textStorage.lineOffsetToPosition(line, offset); }; ScriptInfo.prototype.positionToLineOffset = function (position) { - var index = this.snap().index; - var lineOffset = index.charOffsetToLineNumberAndPos(position); - return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + return this.textStorage.positionToLineOffset(position); + }; + ScriptInfo.prototype.isJavaScript = function () { + return this.scriptKind === 1 || this.scriptKind === 2; }; return ScriptInfo; }()); @@ -64701,6 +73295,7 @@ var ts; this.cancellationToken = cancellationToken; this.resolvedModuleNames = ts.createFileMap(); this.resolvedTypeReferenceDirectives = ts.createFileMap(); + this.cancellationToken = new ts.ThrottledCancellationToken(cancellationToken, project.projectService.throttleWaitMilliseconds); this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); if (host.trace) { this.trace = function (s) { return host.trace(s); }; @@ -64710,7 +73305,7 @@ var ts; ? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation : undefined; var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host); - if (!(primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) { + if (ts.moduleHasNonRelativeName(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) { var _a = ts.loadModuleFromGlobalCache(moduleName, _this.project.getProjectName(), compilerOptions, host, globalCache), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; if (resolvedModule) { return { resolvedModule: resolvedModule, failedLookupLocations: primaryResult.failedLookupLocations.concat(failedLookupLocations) }; @@ -64738,15 +73333,16 @@ var ts; var compilerOptions = this.getCompilationSettings(); var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_49 = names_2[_i]; - var resolution = newResolutions[name_49]; + var name = names_2[_i]; + var resolution = newResolutions.get(name); if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_49]; + var existingResolution = currentResolutionsInFile && currentResolutionsInFile.get(name); if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - newResolutions[name_49] = resolution = loader(name_49, containingFile, compilerOptions, this); + resolution = loader(name, containingFile, compilerOptions, this); + newResolutions.set(name, resolution); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); @@ -64786,6 +73382,9 @@ var ts; return resolution.failedLookupLocations.length === 0; } }; + LSHost.prototype.getNewLine = function () { + return this.host.newLine; + }; LSHost.prototype.getProjectVersion = function () { return this.project.getProjectVersion(); }; @@ -64811,7 +73410,7 @@ var ts; LSHost.prototype.getScriptSnapshot = function (filename) { var scriptInfo = this.project.getScriptInfoLSHost(filename); if (scriptInfo) { - return scriptInfo.snap(); + return scriptInfo.getSnapshot(); } }; LSHost.prototype.getScriptFileNames = function () { @@ -64891,18 +73490,19 @@ var ts; var unique = 0; for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) { var v = arr1_1[_i]; - if (set[v] !== true) { - set[v] = true; + if (set.get(v) !== true) { + set.set(v, true); unique++; } } for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) { var v = arr2_1[_a]; - if (!ts.hasProperty(set, v)) { + var isSet = set.get(v); + if (isSet === undefined) { return false; } - if (set[v] === true) { - set[v] = false; + if (isSet === true) { + set.set(v, false); unique--; } } @@ -64914,7 +73514,7 @@ var ts; !setIsEqualTo(opt1.exclude, opt2.exclude); } function compilerOptionsChanged(opt1, opt2) { - return opt1.allowJs != opt2.allowJs; + return opt1.allowJs !== opt2.allowJs; } function unresolvedImportsChanged(imports1, imports2) { if (imports1 === imports2) { @@ -64932,38 +73532,38 @@ var ts; if (!typeAcquisition || !typeAcquisition.enable) { return server.emptyArray; } - var entry = this.perProjectCache[project.getProjectName()]; + var entry = this.perProjectCache.get(project.getProjectName()); var result = entry ? entry.typings : server.emptyArray; if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { - this.perProjectCache[project.getProjectName()] = { + this.perProjectCache.set(project.getProjectName(), { compilerOptions: project.getCompilerOptions(), typeAcquisition: typeAcquisition, typings: result, unresolvedImports: unresolvedImports, poisoned: true - }; + }); this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } return result; }; TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) { - this.perProjectCache[projectName] = { + this.perProjectCache.set(projectName, { compilerOptions: compilerOptions, typeAcquisition: typeAcquisition, typings: server.toSortedReadonlyArray(newTypings), unresolvedImports: unresolvedImports, poisoned: false - }; + }); }; TypingsCache.prototype.deleteTypingsForProject = function (projectName) { - delete this.perProjectCache[projectName]; + this.perProjectCache.delete(projectName); }; TypingsCache.prototype.onProjectClosed = function (project) { - delete this.perProjectCache[project.getProjectName()]; + this.perProjectCache.delete(project.getProjectName()); this.installer.onProjectClosed(project); }; return TypingsCache; @@ -64991,7 +73591,7 @@ var ts; BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; - if (statement.kind !== 230 || statement.name.kind !== 9) { + if (statement.kind !== 232 || statement.name.kind !== 9) { return false; } } @@ -65027,10 +73627,15 @@ var ts; function AbstractBuilder(project, ctor) { this.project = project; this.ctor = ctor; - this.fileInfos = ts.createFileMap(); } + AbstractBuilder.prototype.getFileInfos = function () { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap()); + }; + AbstractBuilder.prototype.clear = function () { + this.fileInfos_doNotAccessDirectly = undefined; + }; AbstractBuilder.prototype.getFileInfo = function (path) { - return this.fileInfos.get(path); + return this.getFileInfos().get(path); }; AbstractBuilder.prototype.getOrCreateFileInfo = function (path) { var fileInfo = this.getFileInfo(path); @@ -65042,16 +73647,16 @@ var ts; return fileInfo; }; AbstractBuilder.prototype.getFileInfoPaths = function () { - return this.fileInfos.getKeys(); + return this.getFileInfos().getKeys(); }; AbstractBuilder.prototype.setFileInfo = function (path, info) { - this.fileInfos.set(path, info); + this.getFileInfos().set(path, info); }; AbstractBuilder.prototype.removeFileInfo = function (path) { - this.fileInfos.remove(path); + this.getFileInfos().remove(path); }; AbstractBuilder.prototype.forEachFileInfo = function (action) { - this.fileInfos.forEachValue(function (_path, value) { return action(value); }); + this.getFileInfos().forEachValue(function (_path, value) { return action(value); }); }; AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { var fileInfo = this.getFileInfo(scriptInfo.path); @@ -65097,7 +73702,7 @@ var ts; var ModuleBuilderFileInfo = (function (_super) { __extends(ModuleBuilderFileInfo, _super); function ModuleBuilderFileInfo() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.references = []; _this.referencedBy = []; return _this; @@ -65107,7 +73712,6 @@ var ts; var r = rf.scriptInfo.fileName; return (l < r ? -1 : (l > r ? 1 : 0)); }; - ; ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) { if (array.length === 0) { array.push(fileInfo); @@ -65153,6 +73757,10 @@ var ts; _this.project = project; return _this; } + ModuleBuilder.prototype.clear = function () { + this.projectVersionForDependencyGraph = undefined; + _super.prototype.clear.call(this); + }; ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { var _this = this; if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { @@ -65235,25 +73843,25 @@ var ts; } var queue = fileInfo.referencedBy.slice(0); var fileNameSet = ts.createMap(); - fileNameSet[scriptInfo.fileName] = scriptInfo; + fileNameSet.set(scriptInfo.fileName, scriptInfo); while (queue.length > 0) { var processingFileInfo = queue.pop(); if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) { var potentialFileInfo = _a[_i]; - if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) { + if (!fileNameSet.has(potentialFileInfo.scriptInfo.fileName)) { queue.push(potentialFileInfo); } } } - fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo; + fileNameSet.set(processingFileInfo.scriptInfo.fileName, processingFileInfo.scriptInfo); } var result = []; - for (var fileName in fileNameSet) { - if (shouldEmitFile(fileNameSet[fileName])) { + fileNameSet.forEach(function (scriptInfo, fileName) { + if (shouldEmitFile(scriptInfo)) { result.push(fileName); } - } + }); return result; }; return ModuleBuilder; @@ -65349,107 +73957,6 @@ var ts; return UnresolvedImportsMap; }()); server.UnresolvedImportsMap = UnresolvedImportsMap; - var emptyResult = []; - var getEmptyResult = function () { return emptyResult; }; - var getUndefined = function () { return undefined; }; - var emptyEncodedSemanticClassifications = { spans: emptyResult, endOfLineState: 0 }; - function createNoSemanticFeaturesWrapper(realLanguageService) { - return { - cleanupSemanticCache: ts.noop, - getSyntacticDiagnostics: function (fileName) { - return fileName ? realLanguageService.getSyntacticDiagnostics(fileName) : emptyResult; - }, - getSemanticDiagnostics: getEmptyResult, - getCompilerOptionsDiagnostics: function () { - return realLanguageService.getCompilerOptionsDiagnostics(); - }, - getSyntacticClassifications: function (fileName, span) { - return realLanguageService.getSyntacticClassifications(fileName, span); - }, - getEncodedSyntacticClassifications: function (fileName, span) { - return realLanguageService.getEncodedSyntacticClassifications(fileName, span); - }, - getSemanticClassifications: getEmptyResult, - getEncodedSemanticClassifications: function () { - return emptyEncodedSemanticClassifications; - }, - getCompletionsAtPosition: getUndefined, - findReferences: getEmptyResult, - getCompletionEntryDetails: getUndefined, - getQuickInfoAtPosition: getUndefined, - findRenameLocations: getEmptyResult, - getNameOrDottedNameSpan: function (fileName, startPos, endPos) { - return realLanguageService.getNameOrDottedNameSpan(fileName, startPos, endPos); - }, - getBreakpointStatementAtPosition: function (fileName, position) { - return realLanguageService.getBreakpointStatementAtPosition(fileName, position); - }, - getBraceMatchingAtPosition: function (fileName, position) { - return realLanguageService.getBraceMatchingAtPosition(fileName, position); - }, - getSignatureHelpItems: getUndefined, - getDefinitionAtPosition: getEmptyResult, - getRenameInfo: function () { return ({ - canRename: false, - localizedErrorMessage: ts.getLocaleSpecificMessage(ts.Diagnostics.Language_service_is_disabled), - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }); }, - getTypeDefinitionAtPosition: getUndefined, - getReferencesAtPosition: getEmptyResult, - getDocumentHighlights: getEmptyResult, - getOccurrencesAtPosition: getEmptyResult, - getNavigateToItems: getEmptyResult, - getNavigationBarItems: function (fileName) { - return realLanguageService.getNavigationBarItems(fileName); - }, - getNavigationTree: function (fileName) { - return realLanguageService.getNavigationTree(fileName); - }, - getOutliningSpans: function (fileName) { - return realLanguageService.getOutliningSpans(fileName); - }, - getTodoComments: getEmptyResult, - getIndentationAtPosition: function (fileName, position, options) { - return realLanguageService.getIndentationAtPosition(fileName, position, options); - }, - getFormattingEditsForRange: function (fileName, start, end, options) { - return realLanguageService.getFormattingEditsForRange(fileName, start, end, options); - }, - getFormattingEditsForDocument: function (fileName, options) { - return realLanguageService.getFormattingEditsForDocument(fileName, options); - }, - getFormattingEditsAfterKeystroke: function (fileName, position, key, options) { - return realLanguageService.getFormattingEditsAfterKeystroke(fileName, position, key, options); - }, - getDocCommentTemplateAtPosition: function (fileName, position) { - return realLanguageService.getDocCommentTemplateAtPosition(fileName, position); - }, - isValidBraceCompletionAtPosition: function (fileName, position, openingBrace) { - return realLanguageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); - }, - getEmitOutput: getUndefined, - getProgram: function () { - return realLanguageService.getProgram(); - }, - getNonBoundSourceFile: function (fileName) { - return realLanguageService.getNonBoundSourceFile(fileName); - }, - dispose: function () { - return realLanguageService.dispose(); - }, - getCompletionEntrySymbol: getUndefined, - getImplementationAtPosition: getEmptyResult, - getSourceFile: function (fileName) { - return realLanguageService.getSourceFile(fileName); - }, - getCodeFixesAtPosition: getEmptyResult - }; - } - server.createNoSemanticFeaturesWrapper = createNoSemanticFeaturesWrapper; var Project = (function () { function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) { this.projectName = projectName; @@ -65471,16 +73978,13 @@ var ts; this.compilerOptions.allowNonTsExtensions = true; this.compilerOptions.allowJs = true; } - else if (hasExplicitListOfFiles) { + else if (hasExplicitListOfFiles || this.compilerOptions.allowJs) { this.compilerOptions.allowNonTsExtensions = true; } - if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { - this.compilerOptions.noEmitForJsFiles = true; - } + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken); this.lsHost.setCompilationSettings(this.compilerOptions); this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); - this.noSemanticFeaturesLanguageService = createNoSemanticFeaturesWrapper(this.languageService); if (!languageServiceEnabled) { this.disableLanguageService(); } @@ -65498,6 +74002,21 @@ var ts; Project.prototype.getCachedUnresolvedImportsPerFile_TestOnly = function () { return this.cachedUnresolvedImportsPerFile; }; + Project.resolveModule = function (moduleName, initialDir, host, log) { + var resolvedPath = ts.normalizeSlashes(host.resolvePath(ts.combinePaths(initialDir, "node_modules"))); + log("Loading " + moduleName + " from " + initialDir + " (resolved to " + resolvedPath + ")"); + var result = host.require(resolvedPath, moduleName); + if (result.error) { + log("Failed to load module: " + JSON.stringify(result.error)); + return undefined; + } + return result.module; + }; + Project.prototype.setInternalCompilerOptionsForEmittingJsFiles = function () { + if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { + this.compilerOptions.noEmitForJsFiles = true; + } + }; Project.prototype.getProjectErrors = function () { return this.projectErrors; }; @@ -65506,9 +74025,7 @@ var ts; if (ensureSynchronized) { this.updateGraph(); } - return this.languageServiceEnabled - ? this.languageService - : this.noSemanticFeaturesLanguageService; + return this.languageService; }; Project.prototype.getCompileOnSaveAffectedFileList = function (scriptInfo) { if (!this.languageServiceEnabled) { @@ -65538,6 +74055,9 @@ var ts; Project.prototype.getProjectName = function () { return this.projectName; }; + Project.prototype.getExternalFiles = function () { + return []; + }; Project.prototype.getSourceFile = function (path) { if (!this.program) { return undefined; @@ -65557,7 +74077,7 @@ var ts; info.detachFromProject(this); } } - else { + if (!this.program || !this.languageServiceEnabled) { for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) { var root = _c[_b]; root.detachFromProject(this); @@ -65582,7 +74102,9 @@ var ts; if (this.rootFiles) { for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) { var f = _a[_i]; - result.push(f.fileName); + if (this.languageServiceEnabled || f.isScriptOpen()) { + result.push(f.fileName); + } } if (this.typingFiles) { for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) { @@ -65598,6 +74120,9 @@ var ts; }; Project.prototype.getScriptInfos = function () { var _this = this; + if (!this.languageServiceEnabled) { + return this.rootFiles; + } return ts.map(this.program.getSourceFiles(), function (sourceFile) { var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path); if (!scriptInfo) { @@ -65656,7 +74181,7 @@ var ts; }; Project.prototype.containsFile = function (filename, requireOpen) { var info = this.projectService.getScriptInfoForNormalizedPath(filename); - if (info && (info.isOpen || !requireOpen)) { + if (info && (info.isScriptOpen() || !requireOpen)) { return this.containsScriptInfo(info); } }; @@ -65673,7 +74198,9 @@ var ts; }; Project.prototype.removeFile = function (info, detachFromProject) { if (detachFromProject === void 0) { detachFromProject = true; } - this.removeRootFileIfNecessary(info); + if (this.isRoot(info)) { + this.removeRoot(info); + } this.lsHost.notifyFileRemoved(info); this.cachedUnresolvedImportsPerFile.remove(info.path); if (detachFromProject) { @@ -65681,23 +74208,26 @@ var ts; } this.markAsDirty(); }; + Project.prototype.registerFileUpdate = function (fileName) { + (this.updatedFileNames || (this.updatedFileNames = ts.createMap())).set(fileName, fileName); + }; Project.prototype.markAsDirty = function () { this.projectStateVersion++; }; Project.prototype.extractUnresolvedImportsFromSourceFile = function (file, result) { var cached = this.cachedUnresolvedImportsPerFile.get(file.path); if (cached) { - for (var _i = 0, cached_1 = cached; _i < cached_1.length; _i++) { - var f = cached_1[_i]; + for (var _i = 0, cached_2 = cached; _i < cached_2.length; _i++) { + var f = cached_2[_i]; result.push(f); } return; } var unresolvedImports; if (file.resolvedModules) { - for (var name_50 in file.resolvedModules) { - if (!file.resolvedModules[name_50] && !ts.isExternalModuleNameRelative(name_50)) { - var trimmed = name_50.trim(); + file.resolvedModules.forEach(function (resolvedModule, name) { + if (!resolvedModule && !ts.isExternalModuleNameRelative(name)) { + var trimmed = name.trim(); var i = trimmed.indexOf("/"); if (i !== -1 && trimmed.charCodeAt(0) === 64) { i = trimmed.indexOf("/", i + 1); @@ -65708,14 +74238,11 @@ var ts; (unresolvedImports || (unresolvedImports = [])).push(trimmed); result.push(trimmed); } - } + }); } this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray); }; Project.prototype.updateGraph = function () { - if (!this.languageServiceEnabled) { - return true; - } this.lsHost.startRecordingFilesWithChangedResolutions(); var hasChanges = this.updateGraphWorker(); var changedFiles = this.lsHost.finishRecordingFilesWithChangedResolutions() || server.emptyArray; @@ -65737,6 +74264,12 @@ var ts; if (this.setTypings(cachedTypings)) { hasChanges = this.updateGraphWorker() || hasChanges; } + if (this.languageServiceEnabled) { + this.builder.onProjectUpdateGraph(); + } + else { + this.builder.clear(); + } if (hasChanges) { this.projectStructureVersion++; } @@ -65769,7 +74302,6 @@ var ts; } } } - this.builder.onProjectUpdateGraph(); return hasChanges; }; Project.prototype.getScriptInfoLSHost = function (fileName) { @@ -65802,15 +74334,13 @@ var ts; }; Project.prototype.setCompilerOptions = function (compilerOptions) { if (compilerOptions) { - if (this.projectKind === ProjectKind.Inferred) { - compilerOptions.allowJs = true; - } compilerOptions.allowNonTsExtensions = true; if (ts.changesAffectModuleResolution(this.compilerOptions, compilerOptions)) { this.cachedUnresolvedImportsPerFile.clear(); this.lastCachedUnresolvedImportsList = undefined; } this.compilerOptions = compilerOptions; + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost.setCompilationSettings(compilerOptions); this.markAsDirty(); } @@ -65830,29 +74360,33 @@ var ts; projectName: this.getProjectName(), version: this.projectStructureVersion, isInferred: this.projectKind === ProjectKind.Inferred, - options: this.getCompilerOptions() + options: this.getCompilerOptions(), + languageServiceDisabled: !this.languageServiceEnabled }; + var updatedFileNames = this.updatedFileNames; + this.updatedFileNames = undefined; if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { - if (this.projectStructureVersion == this.lastReportedVersion) { + if (this.projectStructureVersion === this.lastReportedVersion && !updatedFileNames) { return { info: info, projectErrors: this.projectErrors }; } - var lastReportedFileNames = this.lastReportedFileNames; - var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); - var added = []; - var removed = []; - for (var id in currentFiles) { - if (!ts.hasProperty(lastReportedFileNames, id)) { - added.push(id); + var lastReportedFileNames_1 = this.lastReportedFileNames; + var currentFiles_1 = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); + var added_1 = []; + var removed_1 = []; + var updated = ts.arrayFrom(updatedFileNames.keys()); + ts.forEachKey(currentFiles_1, function (id) { + if (!lastReportedFileNames_1.has(id)) { + added_1.push(id); } - } - for (var id in lastReportedFileNames) { - if (!ts.hasProperty(currentFiles, id)) { - removed.push(id); + }); + ts.forEachKey(lastReportedFileNames_1, function (id) { + if (!currentFiles_1.has(id)) { + removed_1.push(id); } - } - this.lastReportedFileNames = currentFiles; + }); + this.lastReportedFileNames = currentFiles_1; this.lastReportedVersion = this.projectStructureVersion; - return { info: info, changes: { added: added, removed: removed }, projectErrors: this.projectErrors }; + return { info: info, changes: { added: added_1, removed: removed_1, updated: updated }, projectErrors: this.projectErrors }; } else { var projectFileNames = this.getFileNames(); @@ -65879,7 +74413,7 @@ var ts; if (symbol && symbol.declarations && symbol.declarations[0]) { var declarationSourceFile = symbol.declarations[0].getSourceFile(); if (declarationSourceFile) { - referencedFiles[declarationSourceFile.path] = true; + referencedFiles.set(declarationSourceFile.path, true); } } } @@ -65890,28 +74424,25 @@ var ts; for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) { var referencedFile = _c[_b]; var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName); - referencedFiles[referencedPath] = true; + referencedFiles.set(referencedPath, true); } } if (sourceFile.resolvedTypeReferenceDirectiveNames) { - for (var typeName in sourceFile.resolvedTypeReferenceDirectiveNames) { - var resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName]; + sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) { if (!resolvedTypeReferenceDirective) { - continue; + return; } var fileName = resolvedTypeReferenceDirective.resolvedFileName; var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - referencedFiles[typeFilePath] = true; - } + referencedFiles.set(typeFilePath, true); + }); } - var allFileNames = ts.map(Object.keys(referencedFiles), function (key) { return key; }); + var allFileNames = ts.arrayFrom(referencedFiles.keys()); return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); }); }; - Project.prototype.removeRootFileIfNecessary = function (info) { - if (this.isRoot(info)) { - remove(this.rootFiles, info); - this.rootFilesMap.remove(info.path); - } + Project.prototype.removeRoot = function (info) { + remove(this.rootFiles, info); + this.rootFilesMap.remove(info.path); }; return Project; }()); @@ -65920,9 +74451,44 @@ var ts; __extends(InferredProject, _super); function InferredProject(projectService, documentRegistry, compilerOptions) { var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; + _this._isJsInferredProject = false; _this.directoriesWatchedForTsconfig = []; return _this; } + InferredProject.prototype.toggleJsInferredProject = function (isJsInferredProject) { + if (isJsInferredProject !== this._isJsInferredProject) { + this._isJsInferredProject = isJsInferredProject; + this.setCompilerOptions(); + } + }; + InferredProject.prototype.setCompilerOptions = function (options) { + var newOptions = options ? ts.clone(options) : this.getCompilerOptions(); + if (!newOptions) { + return; + } + if (this._isJsInferredProject && typeof newOptions.maxNodeModuleJsDepth !== "number") { + newOptions.maxNodeModuleJsDepth = 2; + } + else if (!this._isJsInferredProject) { + newOptions.maxNodeModuleJsDepth = undefined; + } + newOptions.allowJs = true; + _super.prototype.setCompilerOptions.call(this, newOptions); + }; + InferredProject.prototype.addRoot = function (info) { + if (!this._isJsInferredProject && info.isJavaScript()) { + this.toggleJsInferredProject(true); + } + _super.prototype.addRoot.call(this, info); + }; + InferredProject.prototype.removeRoot = function (info) { + if (this._isJsInferredProject && info.isJavaScript()) { + if (ts.filter(this.getRootScriptInfos(), function (info) { return info.isJavaScript(); }).length === 0) { + this.toggleJsInferredProject(false); + } + } + _super.prototype.removeRoot.call(this, info); + }; InferredProject.prototype.getProjectRootPath = function () { if (this.projectService.useSingleInferredProject) { return undefined; @@ -65961,13 +74527,78 @@ var ts; var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; _this.wildcardDirectories = wildcardDirectories; _this.compileOnSaveEnabled = compileOnSaveEnabled; + _this.plugins = []; _this.openRefCount = 0; _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName)); + _this.enablePlugins(); return _this; } ConfiguredProject.prototype.getConfigFilePath = function () { return this.getProjectName(); }; + ConfiguredProject.prototype.enablePlugins = function () { + var host = this.projectService.host; + var options = this.getCompilerOptions(); + if (!host.require) { + this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); + return; + } + var searchPaths = [ts.combinePaths(host.getExecutingFilePath(), "../../..")].concat(this.projectService.pluginProbeLocations); + if (options.plugins) { + for (var _i = 0, _a = options.plugins; _i < _a.length; _i++) { + var pluginConfigEntry = _a[_i]; + this.enablePlugin(pluginConfigEntry, searchPaths); + } + } + if (this.projectService.globalPlugins) { + var _loop_6 = function (globalPluginName) { + if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) + return "continue"; + this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths); + }; + var this_1 = this; + for (var _b = 0, _c = this.projectService.globalPlugins; _b < _c.length; _b++) { + var globalPluginName = _c[_b]; + _loop_6(globalPluginName); + } + } + }; + ConfiguredProject.prototype.enablePlugin = function (pluginConfigEntry, searchPaths) { + var _this = this; + var log = function (message) { + _this.projectService.logger.info(message); + }; + for (var _i = 0, searchPaths_1 = searchPaths; _i < searchPaths_1.length; _i++) { + var searchPath = searchPaths_1[_i]; + var resolvedModule = Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log); + if (resolvedModule) { + this.enableProxy(resolvedModule, pluginConfigEntry); + return; + } + } + this.projectService.logger.info("Couldn't find " + pluginConfigEntry.name + " anywhere in paths: " + searchPaths.join(",")); + }; + ConfiguredProject.prototype.enableProxy = function (pluginModuleFactory, configEntry) { + try { + if (typeof pluginModuleFactory !== "function") { + this.projectService.logger.info("Skipped loading plugin " + configEntry.name + " because it did expose a proper factory function"); + return; + } + var info = { + config: configEntry, + project: this, + languageService: this.languageService, + languageServiceHost: this.lsHost, + serverHost: this.projectService.host + }; + var pluginModule = pluginModuleFactory({ typescript: ts }); + this.languageService = pluginModule.create(info); + this.plugins.push(pluginModule); + } + catch (e) { + this.projectService.logger.info("Plugin activation failed: " + e); + } + }; ConfiguredProject.prototype.getProjectRootPath = function () { return ts.getDirectoryPath(this.getConfigFilePath()); }; @@ -65980,6 +74611,21 @@ var ts; ConfiguredProject.prototype.getTypeAcquisition = function () { return this.typeAcquisition; }; + ConfiguredProject.prototype.getExternalFiles = function () { + var items = []; + for (var _i = 0, _a = this.plugins; _i < _a.length; _i++) { + var plugin = _a[_i]; + if (typeof plugin.getExternalFiles === "function") { + try { + items.push.apply(items, plugin.getExternalFiles(this)); + } + catch (e) { + this.projectService.logger.info("A plugin threw an exception in getExternalFiles: " + e); + } + } + } + return items; + }; ConfiguredProject.prototype.watchConfigFile = function (callback) { var _this = this; this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); }); @@ -66010,14 +74656,14 @@ var ts; return; } var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath()); - this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) { + this.directoriesWatchedForWildcards = ts.createMap(); + this.wildcardDirectories.forEach(function (flag, directory) { if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) { var recursive = (flag & 1) !== 0; _this.projectService.logger.info("Add " + (recursive ? "recursive " : "") + "watcher for: " + directory); - watchers[directory] = _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive); + _this.directoriesWatchedForWildcards.set(directory, _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive)); } - return watchers; - }, {}); + }); }; ConfiguredProject.prototype.stopWatchingDirectory = function () { if (this.directoryWatcher) { @@ -66037,9 +74683,9 @@ var ts; } this.typeRootsWatchers = undefined; } - for (var id in this.directoriesWatchedForWildcards) { - this.directoriesWatchedForWildcards[id].close(); - } + this.directoriesWatchedForWildcards.forEach(function (watcher) { + watcher.close(); + }); this.directoriesWatchedForWildcards = undefined; this.stopWatchingDirectory(); }; @@ -66060,6 +74706,7 @@ var ts; __extends(ExternalProject, _super); function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) { var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; + _this.externalProjectName = externalProjectName; _this.compileOnSaveEnabled = compileOnSaveEnabled; _this.projectFilePath = projectFilePath; return _this; @@ -66116,36 +74763,60 @@ var ts; var option = commandLineOptions_1[_i]; if (typeof option.type === "object") { var optionMap = option.type; - for (var id in optionMap) { - ts.Debug.assert(typeof optionMap[id] === "number"); - } - map[option.name] = optionMap; + optionMap.forEach(function (value) { + ts.Debug.assert(typeof value === "number"); + }); + map.set(option.name, optionMap); } } return map; } var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations); - var indentStyle = ts.createMap({ + var indentStyle = ts.createMapFromTemplate({ "none": ts.IndentStyle.None, "block": ts.IndentStyle.Block, "smart": ts.IndentStyle.Smart }); + var defaultTypeSafeList = { + "jquery": { + "match": /jquery(-(\.?\d+)+)?(\.intellisense)?(\.min)?\.js$/i, + "types": ["jquery"] + }, + "WinJS": { + "match": /^(.*\/winjs-[.\d]+)\/js\/base\.js$/i, + "exclude": [["^", 1, "/.*"]], + "types": ["winjs"] + }, + "Kendo": { + "match": /^(.*\/kendo)\/kendo\.all\.min\.js$/i, + "exclude": [["^", 1, "/.*"]], + "types": ["kendo-ui"] + }, + "Office Nuget": { + "match": /^(.*\/office\/1)\/excel-\d+\.debug\.js$/i, + "exclude": [["^", 1, "/.*"]], + "types": ["office"] + }, + "Minified files": { + "match": /^(.+\.min\.js)$/i, + "exclude": [["^", 1, "$"]] + } + }; function convertFormatOptions(protocolOptions) { if (typeof protocolOptions.indentStyle === "string") { - protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()]; + protocolOptions.indentStyle = indentStyle.get(protocolOptions.indentStyle.toLowerCase()); ts.Debug.assert(protocolOptions.indentStyle !== undefined); } return protocolOptions; } server.convertFormatOptions = convertFormatOptions; function convertCompilerOptions(protocolOptions) { - for (var id in compilerOptionConverters) { + compilerOptionConverters.forEach(function (mappedValues, id) { var propertyValue = protocolOptions[id]; if (typeof propertyValue === "string") { - var mappedValues = compilerOptionConverters[id]; - protocolOptions[id] = mappedValues[propertyValue.toLowerCase()]; + protocolOptions[id] = mappedValues.get(propertyValue.toLowerCase()); } - } + }); return protocolOptions; } server.convertCompilerOptions = convertCompilerOptions; @@ -66178,7 +74849,10 @@ var ts; var fileNamePropertyReader = { getFileName: function (x) { return x; }, getScriptKind: function (_) { return undefined; }, - hasMixedContent: function (_) { return false; } + hasMixedContent: function (fileName, extraFileExtensions) { + var mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, function (item) { return item.isMixedContent; }), function (item) { return item.extension; }); + return ts.forEach(mixedContentExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); + } }; var externalFilePropertyReader = { getFileName: function (x) { return x.fileName; }, @@ -66209,24 +74883,25 @@ var ts; this.directoryWatchersRefCount = ts.createMap(); } DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) { - this.directoryWatchersRefCount[directory]--; - if (this.directoryWatchersRefCount[directory] === 0) { + var refCount = this.directoryWatchersRefCount.get(directory) - 1; + this.directoryWatchersRefCount.set(directory, refCount); + if (refCount === 0) { this.projectService.logger.info("Close directory watcher for: " + directory); - this.directoryWatchersForTsconfig[directory].close(); - delete this.directoryWatchersForTsconfig[directory]; + this.directoryWatchersForTsconfig.get(directory).close(); + this.directoryWatchersForTsconfig.delete(directory); } }; DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) { var currentPath = ts.getDirectoryPath(fileName); var parentPath = ts.getDirectoryPath(currentPath); - while (currentPath != parentPath) { - if (!this.directoryWatchersForTsconfig[currentPath]) { + while (currentPath !== parentPath) { + if (!this.directoryWatchersForTsconfig.has(currentPath)) { this.projectService.logger.info("Add watcher for: " + currentPath); - this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback); - this.directoryWatchersRefCount[currentPath] = 1; + this.directoryWatchersForTsconfig.set(currentPath, this.projectService.host.watchDirectory(currentPath, callback)); + this.directoryWatchersRefCount.set(currentPath, 1); } else { - this.directoryWatchersRefCount[currentPath] += 1; + this.directoryWatchersRefCount.set(currentPath, this.directoryWatchersRefCount.get(currentPath) + 1); } project.directoriesWatchedForTsconfig.push(currentPath); currentPath = parentPath; @@ -66236,31 +74911,35 @@ var ts; return DirectoryWatchers; }()); var ProjectService = (function () { - function ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler) { - if (typingsInstaller === void 0) { typingsInstaller = server.nullTypingsInstaller; } - this.host = host; - this.logger = logger; - this.cancellationToken = cancellationToken; - this.useSingleInferredProject = useSingleInferredProject; - this.typingsInstaller = typingsInstaller; - this.eventHandler = eventHandler; + function ProjectService(opts) { this.filenameToScriptInfo = ts.createFileMap(); this.externalProjectToConfiguredProjectMap = ts.createMap(); this.externalProjects = []; this.inferredProjects = []; this.configuredProjects = []; this.openFiles = []; - ts.Debug.assert(!!host.createHash, "'ServerHost.createHash' is required for ProjectService"); - this.toCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + this.projectToSizeMap = ts.createMap(); + this.host = opts.host; + this.logger = opts.logger; + this.cancellationToken = opts.cancellationToken; + this.useSingleInferredProject = opts.useSingleInferredProject; + this.typingsInstaller = opts.typingsInstaller || server.nullTypingsInstaller; + this.throttleWaitMilliseconds = opts.throttleWaitMilliseconds; + this.eventHandler = opts.eventHandler; + this.globalPlugins = opts.globalPlugins || server.emptyArray; + this.pluginProbeLocations = opts.pluginProbeLocations || server.emptyArray; + ts.Debug.assert(!!this.host.createHash, "'ServerHost.createHash' is required for ProjectService"); + this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); this.directoryWatchers = new DirectoryWatchers(this); - this.throttledOperations = new server.ThrottledOperations(host); + this.throttledOperations = new server.ThrottledOperations(this.host); this.typingsInstaller.attach(this); this.typingsCache = new server.TypingsCache(this.typingsInstaller); this.hostConfiguration = { formatCodeOptions: server.getDefaultFormatCodeSettings(this.host), - hostInfo: "Unknown host" + hostInfo: "Unknown host", + extraFileExtensions: [] }; - this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory()); + this.documentRegistry = ts.createDocumentRegistry(this.host.useCaseSensitiveFileNames, this.host.getCurrentDirectory()); } ProjectService.prototype.getChangedFiles_TestOnly = function () { return this.changedFiles; @@ -66384,7 +75063,7 @@ var ts; this.handleDeletedFile(info); } else { - if (info && (!info.isOpen)) { + if (info && (!info.isScriptOpen())) { info.reloadFromFile(); this.updateProjectGraphs(info.containingProjects); } @@ -66393,7 +75072,7 @@ var ts; ProjectService.prototype.handleDeletedFile = function (info) { this.logger.info(info.fileName + " deleted"); info.stopWatcher(); - if (!info.isOpen) { + if (!info.isScriptOpen()) { this.filenameToScriptInfo.remove(info.path); this.lastDeletedFile = info; var containingProjects = info.containingProjects.slice(); @@ -66424,7 +75103,7 @@ var ts; }; ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) { var _this = this; - if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) { return; } this.logger.info("Detected source file changes: " + fileName); @@ -66450,7 +75129,7 @@ var ts; this.refreshInferredProjects(); }; ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) { - if (ts.getBaseFileName(fileName) != "tsconfig.json") { + if (ts.getBaseFileName(fileName) !== "tsconfig.json") { this.logger.info(fileName + " is not tsconfig.json"); return; } @@ -66469,9 +75148,11 @@ var ts; switch (project.projectKind) { case server.ProjectKind.External: server.removeItemFromSet(this.externalProjects, project); + this.projectToSizeMap.delete(project.externalProjectName); break; case server.ProjectKind.Configured: server.removeItemFromSet(this.configuredProjects, project); + this.projectToSizeMap.delete(project.canonicalConfigFilePath); break; case server.ProjectKind.Inferred: server.removeItemFromSet(this.inferredProjects, project); @@ -66507,13 +75188,17 @@ var ts; if (!this.useSingleInferredProject) { for (var _b = 0, _c = this.openFiles; _b < _c.length; _b++) { var f = _c[_b]; - if (f.containingProjects.length === 0) { + if (f.containingProjects.length === 0 || !inferredProject.containsScriptInfo(f)) { continue; } - var defaultProject = f.getDefaultProject(); - if (isRootFileInInferredProject(info) && defaultProject !== inferredProject && inferredProject.containsScriptInfo(f)) { - this.removeProject(defaultProject); - f.attachToProject(inferredProject); + for (var _d = 0, _e = f.containingProjects; _d < _e.length; _d++) { + var fContainingProject = _e[_d]; + if (fContainingProject.projectKind === server.ProjectKind.Inferred && + fContainingProject.isRoot(f) && + fContainingProject !== inferredProject) { + this.removeProject(fContainingProject); + f.attachToProject(inferredProject); + } } } } @@ -66523,13 +75208,15 @@ var ts; } }; ProjectService.prototype.closeOpenFile = function (info) { - info.reloadFromFile(); + info.close(); server.removeItemFromSet(this.openFiles, info); - info.isOpen = false; var projectsToRemove; for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { var p = _a[_i]; if (p.projectKind === server.ProjectKind.Configured) { + if (info.hasMixedContent) { + info.registerFileUpdate(); + } if (p.deleteOpenRef() === 0) { (projectsToRemove || (projectsToRemove = [])).push(p); } @@ -66537,6 +75224,9 @@ var ts; else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) { (projectsToRemove || (projectsToRemove = [])).push(p); } + if (!p.languageServiceEnabled) { + p.markAsDirty(); + } } if (projectsToRemove) { for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) { @@ -66654,7 +75344,7 @@ var ts; config = sanitizedConfig; errors = diagnostics.length ? diagnostics : [result.error]; } - var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename); + var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename, [], this.hostConfiguration.extraFileExtensions); if (parsedCommandLine.errors.length) { errors = ts.concatenate(errors, parsedCommandLine.errors); } @@ -66667,16 +75357,19 @@ var ts; files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options, configHasFilesProperty: config["files"] !== undefined, - wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories), + wildcardDirectories: ts.createMapFromTemplate(parsedCommandLine.wildcardDirectories), typeAcquisition: parsedCommandLine.typeAcquisition, compileOnSave: parsedCommandLine.compileOnSave }; return { success: true, projectOptions: projectOptions, configFileErrors: errors }; }; - ProjectService.prototype.exceededTotalSizeLimitForNonTsFiles = function (options, fileNames, propertyReader) { + ProjectService.prototype.exceededTotalSizeLimitForNonTsFiles = function (name, options, fileNames, propertyReader) { if (options && options.disableSizeLimit || !this.host.getFileSize) { return false; } + var availableSpace = server.maxProgramSizeForNonTsFiles; + this.projectToSizeMap.set(name, 0); + this.projectToSizeMap.forEach(function (val) { return (availableSpace -= (val || 0)); }); var totalNonTsFileSize = 0; for (var _i = 0, fileNames_3 = fileNames; _i < fileNames_3.length; _i++) { var f = fileNames_3[_i]; @@ -66689,11 +75382,15 @@ var ts; return true; } } + if (totalNonTsFileSize > availableSpace) { + return true; + } + this.projectToSizeMap.set(name, totalNonTsFileSize); return false; }; ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) { var compilerOptions = convertCompilerOptions(options); - var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); + var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined); this.externalProjects.push(project); return project; @@ -66709,7 +75406,7 @@ var ts; }; ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) { var _this = this; - var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader); + var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(configFileName, projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader); var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave); this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors); project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); }); @@ -66733,9 +75430,9 @@ var ts; var f = files_4[_i]; var rootFilename = propertyReader.getFileName(f); var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); if (this.host.fileExists(rootFilename)) { - var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName == rootFilename, undefined, scriptKind, hasMixedContent); + var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName === rootFilename, undefined, scriptKind, hasMixedContent); project.addRoot(info); } else { @@ -66750,7 +75447,7 @@ var ts; var conversionResult = this.convertConfigFileContentToProjectOptions(configFileName); var projectOptions = conversionResult.success ? conversionResult.projectOptions - : { files: [], compilerOptions: {} }; + : { files: [], compilerOptions: {}, typeAcquisition: { enable: false } }; var project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName); return { success: conversionResult.success, @@ -66777,7 +75474,7 @@ var ts; rootFilesChanged = true; if (!scriptInfo) { var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent); } } @@ -66808,7 +75505,7 @@ var ts; if (toAdd) { for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) { var f = toAdd_1[_d]; - if (f.isOpen && isRootFileInInferredProject(f)) { + if (f.isScriptOpen() && isRootFileInInferredProject(f)) { var inferredProject = f.containingProjects[0]; inferredProject.removeFile(f); if (!inferredProject.hasRoots()) { @@ -66838,7 +75535,7 @@ var ts; this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors); return configFileErrors; } - if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) { + if (this.exceededTotalSizeLimitForNonTsFiles(project.canonicalConfigFilePath, projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) { project.setCompilerOptions(projectOptions.compilerOptions); if (!project.languageServiceEnabled) { return configFileErrors; @@ -66847,9 +75544,7 @@ var ts; project.stopWatchingDirectory(); } else { - if (!project.languageServiceEnabled) { - project.enableLanguageService(); - } + project.enableLanguageService(); this.watchConfigDirectoryForProject(project, projectOptions); this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); } @@ -66879,29 +75574,30 @@ var ts; var _this = this; var info = this.getScriptInfoForNormalizedPath(fileName); if (!info) { - var content = void 0; - if (this.host.fileExists(fileName)) { - content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName)); - } - if (!content) { + if (openedByClient || this.host.fileExists(fileName)) { + info = new server.ScriptInfo(this.host, fileName, scriptKind, hasMixedContent); + this.filenameToScriptInfo.set(info.path, info); if (openedByClient) { - content = ""; + if (fileContent === undefined) { + fileContent = this.host.readFile(fileName) || ""; + } } - } - if (content !== undefined) { - info = new server.ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent); - this.filenameToScriptInfo.set(info.path, info); - if (!info.isOpen && !hasMixedContent) { - info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); + else { + if (!hasMixedContent) { + info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); + } } } } if (info) { - if (fileContent !== undefined) { - info.reload(fileContent); + if (openedByClient && !info.isScriptOpen()) { + info.open(fileContent); + if (hasMixedContent) { + info.registerFileUpdate(); + } } - if (openedByClient) { - info.isOpen = true; + else if (fileContent !== undefined) { + info.reload(fileContent); } } return info; @@ -66926,9 +75622,13 @@ var ts; this.logger.info("Host information " + args.hostInfo); } if (args.formatOptions) { - server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); + server.mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } + if (args.extraFileExtensions) { + this.hostConfiguration.extraFileExtensions = args.extraFileExtensions; + this.logger.info("Host file extension mappings updated"); + } } }; ProjectService.prototype.closeLog = function () { @@ -66976,30 +75676,39 @@ var ts; return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind); }; ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) { - var _a = this.findContainingExternalProject(fileName) - ? {} - : this.openOrUpdateConfiguredProjectForFile(fileName), _b = _a.configFileName, configFileName = _b === void 0 ? undefined : _b, _c = _a.configFileErrors, configFileErrors = _c === void 0 ? undefined : _c; + var configFileName; + var configFileErrors; + var project = this.findContainingExternalProject(fileName); + if (!project) { + (_a = this.openOrUpdateConfiguredProjectForFile(fileName), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors); + if (configFileName) { + project = this.findConfiguredProjectByProjectName(configFileName); + } + } + if (project && !project.languageServiceEnabled) { + project.markAsDirty(); + } var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent); this.assignScriptInfoToInferredProjectIfNecessary(info, true); this.printProjects(); return { configFileName: configFileName, configFileErrors: configFileErrors }; + var _a; }; ProjectService.prototype.closeClientFile = function (uncheckedFileName) { var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); if (info) { this.closeOpenFile(info); - info.isOpen = false; } this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_5 = function (proj) { + var _loop_7 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_5(proj); + _loop_7(proj); } }; ProjectService.prototype.synchronizeProjectList = function (knownProjects) { @@ -67015,7 +75724,7 @@ var ts; for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) { var file = openFiles_1[_i]; var scriptInfo = this.getScriptInfo(file.fileName); - ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen); + ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen()); var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName); this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); } @@ -67058,7 +75767,7 @@ var ts; ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) { if (suppressRefresh === void 0) { suppressRefresh = false; } var fileName = server.toNormalizedPath(uncheckedFileName); - var configFiles = this.externalProjectToConfiguredProjectMap[fileName]; + var configFiles = this.externalProjectToConfiguredProjectMap.get(fileName); if (configFiles) { var shouldRefreshInferredProjects = false; for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) { @@ -67067,7 +75776,7 @@ var ts; shouldRefreshInferredProjects = true; } } - delete this.externalProjectToConfiguredProjectMap[fileName]; + this.externalProjectToConfiguredProjectMap.delete(fileName); if (shouldRefreshInferredProjects && !suppressRefresh) { this.refreshInferredProjects(); } @@ -67082,11 +75791,111 @@ var ts; } } }; - ProjectService.prototype.openExternalProject = function (proj) { + ProjectService.prototype.openExternalProjects = function (projects) { + var _this = this; + var projectsToClose = ts.arrayToMap(this.externalProjects, function (p) { return p.getProjectName(); }, function (_) { return true; }); + ts.forEachKey(this.externalProjectToConfiguredProjectMap, function (externalProjectName) { + projectsToClose.set(externalProjectName, true); + }); + for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { + var externalProject = projects_4[_i]; + this.openExternalProject(externalProject, true); + projectsToClose.delete(externalProject.projectFileName); + } + ts.forEachKey(projectsToClose, function (externalProjectName) { + _this.closeExternalProject(externalProjectName, true); + }); + this.refreshInferredProjects(); + }; + ProjectService.escapeFilenameForRegex = function (filename) { + return filename.replace(this.filenameEscapeRegexp, "\\$&"); + }; + ProjectService.prototype.resetSafeList = function () { + ProjectService.safelist = defaultTypeSafeList; + }; + ProjectService.prototype.loadSafeList = function (fileName) { + var raw = JSON.parse(this.host.readFile(fileName, "utf-8")); + for (var _i = 0, _a = Object.keys(raw); _i < _a.length; _i++) { + var k = _a[_i]; + raw[k].match = new RegExp(raw[k].match, "i"); + } + ProjectService.safelist = raw; + }; + ProjectService.prototype.applySafeList = function (proj) { + var _this = this; + var rootFiles = proj.rootFiles, typeAcquisition = proj.typeAcquisition; + var types = (typeAcquisition && typeAcquisition.include) || []; + var excludeRules = []; + var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); }); + var _loop_8 = function (name) { + var rule = ProjectService.safelist[name]; + for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) { + var root = normalizedNames_1[_i]; + if (rule.match.test(root)) { + this_2.logger.info("Excluding files based on rule " + name); + if (rule.types) { + for (var _a = 0, _b = rule.types; _a < _b.length; _a++) { + var type = _b[_a]; + if (types.indexOf(type) < 0) { + types.push(type); + } + } + } + if (rule.exclude) { + var _loop_9 = function (exclude) { + var processedRule = root.replace(rule.match, function () { + var groups = []; + for (var _i = 0; _i < arguments.length; _i++) { + groups[_i] = arguments[_i]; + } + return exclude.map(function (groupNumberOrString) { + if (typeof groupNumberOrString === "number") { + if (typeof groups[groupNumberOrString] !== "string") { + _this.logger.info("Incorrect RegExp specification in safelist rule " + name + " - not enough groups"); + return "\\*"; + } + return ProjectService.escapeFilenameForRegex(groups[groupNumberOrString]); + } + return groupNumberOrString; + }).join(""); + }); + if (excludeRules.indexOf(processedRule) === -1) { + excludeRules.push(processedRule); + } + }; + for (var _c = 0, _d = rule.exclude; _c < _d.length; _c++) { + var exclude = _d[_c]; + _loop_9(exclude); + } + } + else { + var escaped = ProjectService.escapeFilenameForRegex(root); + if (excludeRules.indexOf(escaped) < 0) { + excludeRules.push(escaped); + } + } + } + } + if (types.length > 0) { + proj.typeAcquisition = proj.typeAcquisition || {}; + proj.typeAcquisition.include = types; + } + }; + var this_2 = this; + for (var _i = 0, _a = Object.keys(ProjectService.safelist); _i < _a.length; _i++) { + var name = _a[_i]; + _loop_8(name); + } + var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); }); + proj.rootFiles = proj.rootFiles.filter(function (_file, index) { return !excludeRegexes.some(function (re) { return re.test(normalizedNames[index]); }); }); + }; + ProjectService.prototype.openExternalProject = function (proj, suppressRefreshOfInferredProjects) { + if (suppressRefreshOfInferredProjects === void 0) { suppressRefreshOfInferredProjects = false; } if (proj.typingOptions && !proj.typeAcquisition) { var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions); proj.typeAcquisition = typeAcquisition; } + this.applySafeList(proj); var tsConfigFiles; var rootFiles = []; for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) { @@ -67108,17 +75917,24 @@ var ts; var exisingConfigFiles; if (externalProject) { if (!tsConfigFiles) { - this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, undefined); + var compilerOptions = convertCompilerOptions(proj.options); + if (this.exceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, proj.rootFiles, externalFilePropertyReader)) { + externalProject.disableLanguageService(); + } + else { + externalProject.enableLanguageService(); + } + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, undefined); return; } this.closeExternalProject(proj.projectFileName, true); } - else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) { + else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) { if (!tsConfigFiles) { this.closeExternalProject(proj.projectFileName, true); } else { - var oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + var oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName); var iNew = 0; var iOld = 0; while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) { @@ -67143,7 +75959,7 @@ var ts; } } if (tsConfigFiles) { - this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles; + this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles); for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) { var tsconfigFile = tsConfigFiles_1[_b]; var project = this.findConfiguredProjectByProjectName(tsconfigFile); @@ -67157,13 +75973,17 @@ var ts; } } else { - delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName); this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); } - this.refreshInferredProjects(); + if (!suppressRefreshOfInferredProjects) { + this.refreshInferredProjects(); + } }; return ProjectService; }()); + ProjectService.safelist = defaultTypeSafeList; + ProjectService.filenameEscapeRegexp = /[-\/\\^$*+?.()|[\]{}]/g; server.ProjectService = ProjectService; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); @@ -67171,19 +75991,24 @@ var ts; (function (ts) { var server; (function (server) { + server.nullCancellationToken = { + isCancellationRequested: function () { return false; }, + setRequest: function () { return void 0; }, + resetRequest: function () { return void 0; } + }; function hrTimeToMilliseconds(time) { var seconds = time[0]; var nanoseconds = time[1]; return ((1e9 * seconds) + nanoseconds) / 1000000.0; } - function shouldSkipSematicCheck(project) { - if (project.getCompilerOptions().skipLibCheck !== undefined) { - return false; + function shouldSkipSemanticCheck(project) { + if (project.projectKind === server.ProjectKind.Inferred || project.projectKind === server.ProjectKind.External) { + return project.isJsOnlyProject(); } - if ((project.projectKind === server.ProjectKind.Inferred || project.projectKind === server.ProjectKind.External) && project.isJsOnlyProject()) { - return true; + else { + var options = project.getCompilerOptions(); + return options.skipLibCheck && !options.checkJs && project.isJsOnlyProject(); } - return false; } function compareNumber(a, b) { return a - b; @@ -67192,7 +76017,7 @@ var ts; if (a.file < b.file) { return -1; } - else if (a.file == b.file) { + else if (a.file === b.file) { var n = compareNumber(a.start.line, b.start.line); if (n === 0) { return compareNumber(a.start.offset, b.start.offset); @@ -67310,26 +76135,98 @@ var ts; return "Content-Length: " + (1 + len) + "\r\n\r\n" + json + newLine; } server.formatMessage = formatMessage; + var MultistepOperation = (function () { + function MultistepOperation(operationHost) { + var _this = this; + this.operationHost = operationHost; + this.completed = true; + this.next = { + immediate: function (action) { return _this.immediate(action); }, + delay: function (ms, action) { return _this.delay(ms, action); } + }; + } + MultistepOperation.prototype.startNew = function (action) { + this.complete(); + this.requestId = this.operationHost.getCurrentRequestId(); + this.completed = false; + this.executeAction(action); + }; + MultistepOperation.prototype.complete = function () { + if (!this.completed) { + if (this.requestId) { + this.operationHost.sendRequestCompletedEvent(this.requestId); + } + this.completed = true; + } + this.setTimerHandle(undefined); + this.setImmediateId(undefined); + }; + MultistepOperation.prototype.immediate = function (action) { + var _this = this; + var requestId = this.requestId; + ts.Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "immediate: incorrect request id"); + this.setImmediateId(this.operationHost.getServerHost().setImmediate(function () { + _this.immediateId = undefined; + _this.operationHost.executeWithRequestId(requestId, function () { return _this.executeAction(action); }); + })); + }; + MultistepOperation.prototype.delay = function (ms, action) { + var _this = this; + var requestId = this.requestId; + ts.Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "delay: incorrect request id"); + this.setTimerHandle(this.operationHost.getServerHost().setTimeout(function () { + _this.timerHandle = undefined; + _this.operationHost.executeWithRequestId(requestId, function () { return _this.executeAction(action); }); + }, ms)); + }; + MultistepOperation.prototype.executeAction = function (action) { + var stop = false; + try { + if (this.operationHost.isCancellationRequested()) { + stop = true; + } + else { + action(this.next); + } + } + catch (e) { + stop = true; + if (!(e instanceof ts.OperationCanceledException)) { + this.operationHost.logError(e, "delayed processing of request " + this.requestId); + } + } + if (stop || !this.hasPendingWork()) { + this.complete(); + } + }; + MultistepOperation.prototype.setTimerHandle = function (timerHandle) { + if (this.timerHandle !== undefined) { + this.operationHost.getServerHost().clearTimeout(this.timerHandle); + } + this.timerHandle = timerHandle; + }; + MultistepOperation.prototype.setImmediateId = function (immediateId) { + if (this.immediateId !== undefined) { + this.operationHost.getServerHost().clearImmediate(this.immediateId); + } + this.immediateId = immediateId; + }; + MultistepOperation.prototype.hasPendingWork = function () { + return !!this.timerHandle || !!this.immediateId; + }; + return MultistepOperation; + }()); var Session = (function () { - function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents, eventHandler) { + function Session(opts) { var _this = this; - this.host = host; - this.typingsInstaller = typingsInstaller; - this.byteLength = byteLength; - this.hrtime = hrtime; - this.logger = logger; - this.canUseEvents = canUseEvents; this.changeSeq = 0; - this.handlers = ts.createMap((_a = {}, + this.handlers = ts.createMapFromTemplate((_a = {}, _a[CommandNames.OpenExternalProject] = function (request) { - _this.projectService.openExternalProject(request.arguments); + _this.projectService.openExternalProject(request.arguments, false); return _this.requiredResponse(true); }, _a[CommandNames.OpenExternalProjects] = function (request) { - for (var _i = 0, _a = request.arguments.projects; _i < _a.length; _i++) { - var proj = _a[_i]; - _this.projectService.openExternalProject(proj); - } + _this.projectService.openExternalProjects(request.arguments.projects); return _this.requiredResponse(true); }, _a[CommandNames.CloseExternalProject] = function (request) { @@ -67477,12 +76374,12 @@ var ts; return _this.requiredResponse(_this.getSyntacticDiagnosticsSync(request.arguments)); }, _a[CommandNames.Geterr] = function (request) { - var geterrArgs = request.arguments; - return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false }; + _this.errorCheck.startNew(function (next) { return _this.getDiagnostics(next, request.arguments.delay, request.arguments.files); }); + return _this.notRequired(); }, _a[CommandNames.GeterrForProject] = function (request) { - var _a = request.arguments, file = _a.file, delay = _a.delay; - return { response: _this.getDiagnosticsForProject(delay, file), responseRequired: false }; + _this.errorCheck.startNew(function (next) { return _this.getDiagnosticsForProject(next, request.arguments.delay, request.arguments.file); }); + return _this.notRequired(); }, _a[CommandNames.Change] = function (request) { _this.change(request.arguments); @@ -67561,20 +76458,57 @@ var ts; return _this.requiredResponse(_this.getSupportedCodeFixes()); }, _a)); - this.eventHander = canUseEvents - ? eventHandler || (function (event) { return _this.defaultEventHandler(event); }) + this.host = opts.host; + this.cancellationToken = opts.cancellationToken; + this.typingsInstaller = opts.typingsInstaller; + this.byteLength = opts.byteLength; + this.hrtime = opts.hrtime; + this.logger = opts.logger; + this.canUseEvents = opts.canUseEvents; + var throttleWaitMilliseconds = opts.throttleWaitMilliseconds; + this.eventHandler = this.canUseEvents + ? opts.eventHandler || (function (event) { return _this.defaultEventHandler(event); }) : undefined; - this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, this.eventHander); - this.gcTimer = new server.GcTimer(host, 7000, logger); + var multistepOperationHost = { + executeWithRequestId: function (requestId, action) { return _this.executeWithRequestId(requestId, action); }, + getCurrentRequestId: function () { return _this.currentRequestId; }, + getServerHost: function () { return _this.host; }, + logError: function (err, cmd) { return _this.logError(err, cmd); }, + sendRequestCompletedEvent: function (requestId) { return _this.sendRequestCompletedEvent(requestId); }, + isCancellationRequested: function () { return _this.cancellationToken.isCancellationRequested(); } + }; + this.errorCheck = new MultistepOperation(multistepOperationHost); + var settings = { + host: this.host, + logger: this.logger, + cancellationToken: this.cancellationToken, + useSingleInferredProject: opts.useSingleInferredProject, + typingsInstaller: this.typingsInstaller, + throttleWaitMilliseconds: throttleWaitMilliseconds, + eventHandler: this.eventHandler, + globalPlugins: opts.globalPlugins, + pluginProbeLocations: opts.pluginProbeLocations + }; + this.projectService = new server.ProjectService(settings); + this.gcTimer = new server.GcTimer(this.host, 7000, this.logger); var _a; } + Session.prototype.sendRequestCompletedEvent = function (requestId) { + var event = { + seq: 0, + type: "event", + event: "requestCompleted", + body: { request_seq: requestId } + }; + this.send(event); + }; Session.prototype.defaultEventHandler = function (event) { var _this = this; switch (event.eventName) { case server.ContextEvent: - var _a = event.data, project = _a.project, fileName = _a.fileName; - this.projectService.logger.info("got context event, updating diagnostics for " + fileName); - this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); + var _a = event.data, project_1 = _a.project, fileName_2 = _a.fileName; + this.projectService.logger.info("got context event, updating diagnostics for " + fileName_2); + this.errorCheck.startNew(function (next) { return _this.updateErrorCheck(next, [{ fileName: fileName_2, project: project_1 }], _this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); }); break; case server.ConfigFileDiagEvent: var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics; @@ -67627,7 +76561,7 @@ var ts; seq: 0, type: "event", event: eventName, - body: info, + body: info }; this.send(ev); }; @@ -67651,7 +76585,7 @@ var ts; Session.prototype.semanticCheck = function (file, project) { try { var diags = []; - if (!shouldSkipSematicCheck(project)) { + if (!shouldSkipSemanticCheck(project)) { diags = project.getLanguageService().getSemanticDiagnostics(file); } var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); @@ -67682,7 +76616,7 @@ var ts; } }, ms); }; - Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs, requireOpen) { + Session.prototype.updateErrorCheck = function (next, checkList, seq, matchSeq, ms, followMs, requireOpen) { var _this = this; if (ms === void 0) { ms = 1500; } if (followMs === void 0) { followMs = 200; } @@ -67690,13 +76624,6 @@ var ts; if (followMs > ms) { followMs = ms; } - if (this.errorTimer) { - this.host.clearTimeout(this.errorTimer); - } - if (this.immediateId) { - this.host.clearImmediate(this.immediateId); - this.immediateId = undefined; - } var index = 0; var checkOne = function () { if (matchSeq(seq)) { @@ -67704,21 +76631,17 @@ var ts; index++; if (checkSpec_1.project.containsFile(checkSpec_1.fileName, requireOpen)) { _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project); - _this.immediateId = _this.host.setImmediate(function () { + next.immediate(function () { _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project); - _this.immediateId = undefined; if (checkList.length > index) { - _this.errorTimer = _this.host.setTimeout(checkOne, followMs); - } - else { - _this.errorTimer = undefined; + next.delay(followMs, checkOne); } }); } } }; if ((checkList.length > index) && (matchSeq(seq))) { - this.errorTimer = this.host.setTimeout(checkOne, ms); + next.delay(ms, checkOne); } }; Session.prototype.cleanProjects = function (caption, projects) { @@ -67726,8 +76649,8 @@ var ts; return; } this.logger.info("cleaning " + caption); - for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { - var p = projects_4[_i]; + for (var _i = 0, projects_5 = projects; _i < projects_5.length; _i++) { + var p = projects_5[_i]; p.getLanguageService(false).cleanupSemanticCache(); } }; @@ -67765,7 +76688,7 @@ var ts; }; Session.prototype.getDiagnosticsWorker = function (args, isSemantic, selector, includeLinePosition) { var _a = this.getFileAndProject(args), project = _a.project, file = _a.file; - if (isSemantic && shouldSkipSematicCheck(project)) { + if (isSemantic && shouldSkipSemanticCheck(project)) { return []; } var scriptInfo = project.getScriptInfoForNormalizedPath(file); @@ -67815,18 +76738,21 @@ var ts; }; Session.prototype.getImplementation = function (args, simplifiedResult) { var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); var implementations = project.getLanguageService().getImplementationAtPosition(file, position); if (!implementations) { return []; } if (simplifiedResult) { - return implementations.map(function (impl) { return ({ - file: impl.fileName, - start: scriptInfo.positionToLineOffset(impl.textSpan.start), - end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan)) - }); }); + return implementations.map(function (_a) { + var fileName = _a.fileName, textSpan = _a.textSpan; + var scriptInfo = project.getScriptInfo(fileName); + return { + file: fileName, + start: scriptInfo.positionToLineOffset(textSpan.start), + end: scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)) + }; + }); } else { return implementations; @@ -67841,16 +76767,20 @@ var ts; return undefined; } return occurrences.map(function (occurrence) { - var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan; + var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan, isInString = occurrence.isInString; var scriptInfo = project.getScriptInfo(fileName); var start = scriptInfo.positionToLineOffset(textSpan.start); var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)); - return { + var result = { start: start, end: end, file: fileName, isWriteAccess: isWriteAccess, }; + if (isInString) { + result.isInString = isInString; + } + return result; }); }; Session.prototype.getSyntacticDiagnosticsSync = function (args) { @@ -67927,13 +76857,23 @@ var ts; } return projects; }; + Session.prototype.getDefaultProject = function (args) { + if (args.projectFileName) { + var project = this.getProject(args.projectFileName); + if (project) { + return project; + } + } + var info = this.projectService.getScriptInfo(args.file); + return info.getDefaultProject(); + }; Session.prototype.getRenameLocations = function (args, simplifiedResult) { var file = server.toNormalizedPath(args.file); var info = this.projectService.getScriptInfoForNormalizedPath(file); var position = this.getPosition(args, info); var projects = this.getProjects(args); if (simplifiedResult) { - var defaultProject = projects[0]; + var defaultProject = this.getDefaultProject(args); var renameInfo = defaultProject.getLanguageService().getRenameInfo(file, position); if (!renameInfo) { return undefined; @@ -68012,7 +76952,7 @@ var ts; Session.prototype.getReferences = function (args, simplifiedResult) { var file = server.toNormalizedPath(args.file); var projects = this.getProjects(args); - var defaultProject = projects[0]; + var defaultProject = this.getDefaultProject(args); var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file); var position = this.getPosition(args, scriptInfo); if (simplifiedResult) { @@ -68023,7 +76963,7 @@ var ts; var displayString = ts.displayPartsToString(nameInfo.displayParts); var nameSpan = nameInfo.textSpan; var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset; - var nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var nameText = scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); var refs = server.combineProjectOutput(projects, function (project) { var references = project.getLanguageService().getReferencesAtPosition(file, position); if (!references) { @@ -68033,7 +76973,7 @@ var ts; var refScriptInfo = project.getScriptInfo(ref.fileName); var start = refScriptInfo.positionToLineOffset(ref.textSpan.start); var refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1); - var lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + var lineText = refScriptInfo.getSnapshot().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); return { file: ref.fileName, start: start, @@ -68065,8 +77005,8 @@ var ts; }; Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) { var _a = this.projectService.openClientFileWithNormalizedPath(fileName, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors; - if (this.eventHander) { - this.eventHander({ + if (this.eventHandler) { + this.eventHandler({ eventName: "configFileDiag", data: { triggerFile: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] } }); @@ -68144,6 +77084,7 @@ var ts; end: scriptInfo.positionToLineOffset(ts.textSpanEnd(quickInfo.textSpan)), displayString: displayString, documentation: docString, + tags: quickInfo.tags || [] }; } else { @@ -68183,7 +77124,7 @@ var ts; var position = scriptInfo.lineOffsetToPosition(args.line, args.offset); var formatOptions = this.projectService.getFormatCodeOptions(file); var edits = project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, position, args.key, formatOptions); - if ((args.key == "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { + if ((args.key === "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { var lineInfo = scriptInfo.getLineInfo(args.line); if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) { var lineText = lineInfo.leaf.text; @@ -68192,10 +77133,10 @@ var ts; var hasIndent = 0; var i = void 0, len = void 0; for (i = 0, len = lineText.length; i < len; i++) { - if (lineText.charAt(i) == " ") { + if (lineText.charAt(i) === " ") { hasIndent++; } - else if (lineText.charAt(i) == "\t") { + else if (lineText.charAt(i) === "\t") { hasIndent += formatOptions.tabSize; } else { @@ -68236,9 +77177,9 @@ var ts; if (simplifiedResult) { return completions.entries.reduce(function (result, entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_51 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var name = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_51, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + result.push({ name: name, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); } return result; }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); @@ -68271,7 +77212,8 @@ var ts; if (project.compileOnSaveEnabled && project.languageServiceEnabled) { result.push({ projectFileName: project.getProjectName(), - fileNames: project.getCompileOnSaveAffectedFileList(info) + fileNames: project.getCompileOnSaveAffectedFileList(info), + projectUsesOutFile: !!project.getCompilerOptions().outFile || !!project.getCompilerOptions().out }); } } @@ -68283,6 +77225,9 @@ var ts; if (!project) { server.Errors.ThrowNoProject(); } + if (!project.languageServiceEnabled) { + return false; + } var scriptInfo = project.getScriptInfo(file); return project.builder.emitFile(scriptInfo, function (path, data, writeByteOrderMark) { return _this.host.writeFile(path, data, writeByteOrderMark); }); }; @@ -68295,12 +77240,12 @@ var ts; return undefined; } if (simplifiedResult) { - var span_16 = helpItems.applicableSpan; + var span_17 = helpItems.applicableSpan; return { items: helpItems.items, applicableSpan: { - start: scriptInfo.positionToLineOffset(span_16.start), - end: scriptInfo.positionToLineOffset(span_16.start + span_16.length) + start: scriptInfo.positionToLineOffset(span_17.start), + end: scriptInfo.positionToLineOffset(span_17.start + span_17.length) }, selectedItemIndex: helpItems.selectedItemIndex, argumentIndex: helpItems.argumentIndex, @@ -68311,7 +77256,7 @@ var ts; return helpItems; } }; - Session.prototype.getDiagnostics = function (delay, fileNames) { + Session.prototype.getDiagnostics = function (next, delay, fileNames) { var _this = this; var checkList = fileNames.reduce(function (accum, uncheckedFileName) { var fileName = server.toNormalizedPath(uncheckedFileName); @@ -68322,7 +77267,7 @@ var ts; return accum; }, []); if (checkList.length > 0) { - this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay); + this.updateErrorCheck(next, checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay); } }; Session.prototype.change = function (args) { @@ -68479,11 +77424,15 @@ var ts; }; Session.prototype.getCodeFixes = function (args, simplifiedResult) { var _this = this; + if (args.errorCodes.length === 0) { + return undefined; + } var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; var scriptInfo = project.getScriptInfoForNormalizedPath(file); var startPosition = getStartPosition(); var endPosition = getEndPosition(); - var codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes); + var formatOptions = this.projectService.getFormatCodeOptions(file); + var codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, formatOptions); if (!codeActions) { return undefined; } @@ -68529,7 +77478,7 @@ var ts; ? spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }) : spans; }; - Session.prototype.getDiagnosticsForProject = function (delay, fileName) { + Session.prototype.getDiagnosticsForProject = function (next, delay, fileName) { var _this = this; var _a = this.getProjectInfoWorker(fileName, undefined, true), fileNames = _a.fileNames, languageServiceDisabled = _a.languageServiceDisabled; if (languageServiceDisabled) { @@ -68544,11 +77493,11 @@ var ts; var project = this.projectService.getDefaultProjectForFile(normalizedFileName, true); for (var _i = 0, fileNamesInProject_1 = fileNamesInProject; _i < fileNamesInProject_1.length; _i++) { var fileNameInProject = fileNamesInProject_1[_i]; - if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName)) + if (this.getCanonicalFileName(fileNameInProject) === this.getCanonicalFileName(fileName)) highPriorityFiles.push(fileNameInProject); else { var info = this.projectService.getScriptInfo(fileNameInProject); - if (!info.isOpen) { + if (!info.isScriptOpen()) { if (fileNameInProject.indexOf(".d.ts") > 0) veryLowPriorityFiles.push(fileNameInProject); else @@ -68561,7 +77510,7 @@ var ts; fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles); if (fileNamesInProject.length > 0) { var checkList = fileNamesInProject.map(function (fileName) { return ({ fileName: fileName, project: project }); }); - this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n == _this.changeSeq; }, delay, 200, false); + this.updateErrorCheck(next, checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay, 200, false); } }; Session.prototype.getCanonicalFileName = function (fileName) { @@ -68577,15 +77526,34 @@ var ts; return { response: response, responseRequired: true }; }; Session.prototype.addProtocolHandler = function (command, handler) { - if (command in this.handlers) { + if (this.handlers.has(command)) { throw new Error("Protocol handler already exists for command \"" + command + "\""); } - this.handlers[command] = handler; + this.handlers.set(command, handler); + }; + Session.prototype.setCurrentRequest = function (requestId) { + ts.Debug.assert(this.currentRequestId === undefined); + this.currentRequestId = requestId; + this.cancellationToken.setRequest(requestId); + }; + Session.prototype.resetCurrentRequest = function (requestId) { + ts.Debug.assert(this.currentRequestId === requestId); + this.currentRequestId = undefined; + this.cancellationToken.resetRequest(requestId); + }; + Session.prototype.executeWithRequestId = function (requestId, f) { + try { + this.setCurrentRequest(requestId); + return f(); + } + finally { + this.resetCurrentRequest(requestId); + } }; Session.prototype.executeCommand = function (request) { - var handler = this.handlers[request.command]; + var handler = this.handlers.get(request.command); if (handler) { - return handler(request); + return this.executeWithRequestId(request.seq, function () { return handler(request); }); } else { this.logger.msg("Unrecognized JSON command: " + JSON.stringify(request), server.Msg.Err); @@ -68687,7 +77655,7 @@ var ts; var lm = LineIndex.linesFromText(insertedText); var lines = lm.lines; if (lines.length > 1) { - if (lines[lines.length - 1] == "") { + if (lines[lines.length - 1] === "") { lines.length--; } } @@ -68716,7 +77684,7 @@ var ts; if (len > 1) { var insertedNodes = new Array(len - 1); var startNode = leafNode; - for (var i = 1, len_1 = lines.length; i < len_1; i++) { + for (var i = 1; i < lines.length; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } var pathIndex = this.startPath.length - 2; @@ -68913,8 +77881,8 @@ var ts; var snap = this.versions[this.currentVersionToIndex()]; if (this.changes.length > 0) { var snapIndex = snap.index; - for (var i = 0, len = this.changes.length; i < len; i++) { - var change = this.changes[i]; + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var change = _a[_i]; snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); } snap = new LineIndexSnapshot(this.currentVersion + 1, this); @@ -68935,8 +77903,8 @@ var ts; var textChangeRanges = []; for (var i = oldVersion + 1; i <= newVersion; i++) { var snap = this.versions[this.versionToIndex(i)]; - for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { - var textChange = snap.changesSincePreviousVersion[j]; + for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { + var textChange = _a[_i]; textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); } } @@ -69005,8 +77973,9 @@ var ts; } }; LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { - var oldSnap = oldSnapshot; - return this.getTextChangeRangeSinceVersion(oldSnap.version); + if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } }; return LineIndexSnapshot; }()); @@ -69035,7 +78004,7 @@ var ts; LineIndex.prototype.load = function (lines) { if (lines.length > 0) { var leaves = []; - for (var i = 0, len = lines.length; i < len; i++) { + for (var i = 0; i < lines.length; i++) { leaves[i] = new LineLeaf(lines[i]); } this.root = LineIndex.buildTreeFromBottom(leaves); @@ -69127,7 +78096,7 @@ var ts; } if (this.checkEdits) { var updatedText = this.getText(0, this.root.charCount()); - ts.Debug.assert(checkText == updatedText, "buffer edit mismatch"); + ts.Debug.assert(checkText === updatedText, "buffer edit mismatch"); } return walker.lineIndex; } @@ -69161,1457 +78130,910 @@ var ts; return this.buildTreeFromBottom(interiorNodes); } }; - LineIndex.linesFromText = function (text) { - var lineStarts = ts.computeLineStarts(text); - if (lineStarts.length === 0) { - return { lines: [], lineMap: lineStarts }; - } - var lines = new Array(lineStarts.length); - var lc = lineStarts.length - 1; - for (var lmi = 0; lmi < lc; lmi++) { - lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); - } - var endText = text.substring(lineStarts[lc]); - if (endText.length > 0) { - lines[lc] = endText; - } - else { - lines.length--; - } - return { lines: lines, lineMap: lineStarts }; - }; - return LineIndex; - }()); - server.LineIndex = LineIndex; - var LineNode = (function () { - function LineNode() { - this.totalChars = 0; - this.totalLines = 0; - this.children = []; - } - LineNode.prototype.isLeaf = function () { - return false; - }; - LineNode.prototype.updateCounts = function () { - this.totalChars = 0; - this.totalLines = 0; - for (var i = 0, len = this.children.length; i < len; i++) { - var child = this.children[i]; - this.totalChars += child.charCount(); - this.totalLines += child.lineCount(); - } - }; - LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { - if (walkFns.pre) { - walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); - } - if (walkFns.goSubtree) { - this.children[childIndex].walk(rangeStart, rangeLength, walkFns); - if (walkFns.post) { - walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); - } - } - else { - walkFns.goSubtree = true; - } - return walkFns.done; - }; - LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { - if (walkFns.pre && (!walkFns.done)) { - walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); - walkFns.goSubtree = true; - } - }; - LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { - var childIndex = 0; - var child = this.children[0]; - var childCharCount = child.charCount(); - var adjustedStart = rangeStart; - while (adjustedStart >= childCharCount) { - this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); - adjustedStart -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - } - if ((adjustedStart + rangeLength) <= childCharCount) { - if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { - return; - } - } - else { - if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { - return; - } - var adjustedLength = rangeLength - (childCharCount - adjustedStart); - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - while (adjustedLength > childCharCount) { - if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { - return; - } - adjustedLength -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - } - if (adjustedLength > 0) { - if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { - return; - } - } - } - if (walkFns.pre) { - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var ej = childIndex + 1; ej < clen; ej++) { - this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); - } - } - } - }; - LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { - var childInfo = this.childFromCharOffset(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset, - }; - } - else if (childInfo.childIndex < this.children.length) { - if (childInfo.child.isLeaf()) { - return { - line: childInfo.lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; - } - else { - var lineNode = (childInfo.child); - return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); - } - } - else { - var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); - return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; - } - }; - LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { - var childInfo = this.childFromLineNumber(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset - }; - } - else if (childInfo.child.isLeaf()) { - return { - line: lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; - } - else { - var lineNode = (childInfo.child); - return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); - } - }; - LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { - var child; - var relativeLineNumber = lineNumber; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - var childLineCount = child.lineCount(); - if (childLineCount >= relativeLineNumber) { - break; - } - else { - relativeLineNumber -= childLineCount; - charOffset += child.charCount(); - } - } - return { - child: child, - childIndex: i, - relativeLineNumber: relativeLineNumber, - charOffset: charOffset - }; - }; - LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { - var child; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - if (child.charCount() > charOffset) { - break; - } - else { - charOffset -= child.charCount(); - lineNumber += child.lineCount(); - } - } - return { - child: child, - childIndex: i, - charOffset: charOffset, - lineNumber: lineNumber - }; - }; - LineNode.prototype.splitAfter = function (childIndex) { - var splitNode; - var clen = this.children.length; - childIndex++; - var endLength = childIndex; - if (childIndex < clen) { - splitNode = new LineNode(); - while (childIndex < clen) { - splitNode.add(this.children[childIndex]); - childIndex++; - } - splitNode.updateCounts(); - } - this.children.length = endLength; - return splitNode; - }; - LineNode.prototype.remove = function (child) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var i = childIndex; i < (clen - 1); i++) { - this.children[i] = this.children[i + 1]; - } - } - this.children.length--; - }; - LineNode.prototype.findChildIndex = function (child) { - var childIndex = 0; - var clen = this.children.length; - while ((this.children[childIndex] !== child) && (childIndex < clen)) - childIndex++; - return childIndex; - }; - LineNode.prototype.insertAt = function (child, nodes) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - var nodeCount = nodes.length; - if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { - this.add(nodes[0]); - this.updateCounts(); - return []; - } - else { - var shiftNode = this.splitAfter(childIndex); - var nodeIndex = 0; - childIndex++; - while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { - this.children[childIndex] = nodes[nodeIndex]; - childIndex++; - nodeIndex++; - } - var splitNodes = []; - var splitNodeCount = 0; - if (nodeIndex < nodeCount) { - splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); - splitNodes = new Array(splitNodeCount); - var splitNodeIndex = 0; - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i] = new LineNode(); - } - var splitNode = splitNodes[0]; - while (nodeIndex < nodeCount) { - splitNode.add(nodes[nodeIndex]); - nodeIndex++; - if (splitNode.children.length === lineCollectionCapacity) { - splitNodeIndex++; - splitNode = splitNodes[splitNodeIndex]; - } - } - for (var i = splitNodes.length - 1; i >= 0; i--) { - if (splitNodes[i].children.length === 0) { - splitNodes.length--; - } - } - } - if (shiftNode) { - splitNodes[splitNodes.length] = shiftNode; - } - this.updateCounts(); - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i].updateCounts(); - } - return splitNodes; - } - }; - LineNode.prototype.add = function (collection) { - this.children[this.children.length] = collection; - return (this.children.length < lineCollectionCapacity); - }; - LineNode.prototype.charCount = function () { - return this.totalChars; - }; - LineNode.prototype.lineCount = function () { - return this.totalLines; - }; - return LineNode; - }()); - server.LineNode = LineNode; - var LineLeaf = (function () { - function LineLeaf(text) { - this.text = text; - } - LineLeaf.prototype.isLeaf = function () { - return true; - }; - LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { - walkFns.leaf(rangeStart, rangeLength, this); - }; - LineLeaf.prototype.charCount = function () { - return this.text.length; - }; - LineLeaf.prototype.lineCount = function () { - return 1; - }; - return LineLeaf; - }()); - server.LineLeaf = LineLeaf; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - var net = require("net"); - var childProcess = require("child_process"); - var os = require("os"); - function getGlobalTypingsCacheLocation() { - var basePath; - switch (process.platform) { - case "win32": - basePath = process.env.LOCALAPPDATA || - process.env.APPDATA || - (os.homedir && os.homedir()) || - process.env.USERPROFILE || - (process.env.HOMEDRIVE && process.env.HOMEPATH && ts.normalizeSlashes(process.env.HOMEDRIVE + process.env.HOMEPATH)) || - os.tmpdir(); - break; - case "linux": - case "android": - basePath = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && "/home/" + (process.env.LOGNAME || process.env.USER)) || - os.tmpdir(); - break; - case "darwin": - var homeDir = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && "/Users/" + (process.env.LOGNAME || process.env.USER)) || - os.tmpdir(); - basePath = ts.combinePaths(homeDir, "Library/Application Support/"); - break; - } - ts.Debug.assert(basePath !== undefined); - return ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript"); - } - var readline = require("readline"); - var fs = require("fs"); - var rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - terminal: false, - }); - var Logger = (function () { - function Logger(logFilename, traceToConsole, level) { - this.logFilename = logFilename; - this.traceToConsole = traceToConsole; - this.level = level; - this.fd = -1; - this.seq = 0; - this.inGroup = false; - this.firstInGroup = true; - } - Logger.padStringRight = function (str, padding) { - return (str + padding).slice(0, padding.length); - }; - Logger.prototype.close = function () { - if (this.fd >= 0) { - fs.close(this.fd); - } - }; - Logger.prototype.getLogFileName = function () { - return this.logFilename; - }; - Logger.prototype.perftrc = function (s) { - this.msg(s, server.Msg.Perf); - }; - Logger.prototype.info = function (s) { - this.msg(s, server.Msg.Info); - }; - Logger.prototype.startGroup = function () { - this.inGroup = true; - this.firstInGroup = true; - }; - Logger.prototype.endGroup = function () { - this.inGroup = false; - this.seq++; - this.firstInGroup = true; - }; - Logger.prototype.loggingEnabled = function () { - return !!this.logFilename || this.traceToConsole; - }; - Logger.prototype.hasLevel = function (level) { - return this.loggingEnabled() && this.level >= level; - }; - Logger.prototype.msg = function (s, type) { - if (type === void 0) { type = server.Msg.Err; } - if (this.fd < 0) { - if (this.logFilename) { - this.fd = fs.openSync(this.logFilename, "w"); - } - } - if (this.fd >= 0 || this.traceToConsole) { - s = s + "\n"; - var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " "); - if (this.firstInGroup) { - s = prefix + s; - this.firstInGroup = false; - } - if (!this.inGroup) { - this.seq++; - this.firstInGroup = true; - } - if (this.fd >= 0) { - var buf = new Buffer(s); - fs.writeSync(this.fd, buf, 0, buf.length, null); - } - if (this.traceToConsole) { - console.warn(s); - } - } - }; - return Logger; - }()); - var NodeTypingsInstaller = (function () { - function NodeTypingsInstaller(telemetryEnabled, logger, host, eventPort, globalTypingsCacheLocation, newLine) { - var _this = this; - this.telemetryEnabled = telemetryEnabled; - this.logger = logger; - this.globalTypingsCacheLocation = globalTypingsCacheLocation; - this.newLine = newLine; - this.installerPidReported = false; - this.throttledOperations = new server.ThrottledOperations(host); - if (eventPort) { - var s_1 = net.connect({ port: eventPort }, function () { - _this.socket = s_1; - _this.reportInstallerProcessId(); - }); - } - } - NodeTypingsInstaller.prototype.reportInstallerProcessId = function () { - if (this.installerPidReported) { - return; - } - if (this.socket && this.installer) { - this.sendEvent(0, "typingsInstallerPid", { pid: this.installer.pid }); - this.installerPidReported = true; - } - }; - NodeTypingsInstaller.prototype.sendEvent = function (seq, event, body) { - this.socket.write(server.formatMessage({ seq: seq, type: "event", event: event, body: body }, this.logger, Buffer.byteLength, this.newLine), "utf8"); - }; - NodeTypingsInstaller.prototype.setTelemetrySender = function (telemetrySender) { - this.telemetrySender = telemetrySender; - }; - NodeTypingsInstaller.prototype.attach = function (projectService) { - var _this = this; - this.projectService = projectService; - if (this.logger.hasLevel(server.LogLevel.requestTime)) { - this.logger.info("Binding..."); - } - var args = [server.Arguments.GlobalCacheLocation, this.globalTypingsCacheLocation]; - if (this.telemetryEnabled) { - args.push(server.Arguments.EnableTelemetry); - } - if (this.logger.loggingEnabled() && this.logger.getLogFileName()) { - args.push(server.Arguments.LogFile, ts.combinePaths(ts.getDirectoryPath(ts.normalizeSlashes(this.logger.getLogFileName())), "ti-" + process.pid + ".log")); - } - var execArgv = []; - { - for (var _i = 0, _a = process.execArgv; _i < _a.length; _i++) { - var arg = _a[_i]; - var match = /^--(debug|inspect)(=(\d+))?$/.exec(arg); - if (match) { - var currentPort = match[3] !== undefined - ? +match[3] - : match[1] === "debug" ? 5858 : 9229; - execArgv.push("--" + match[1] + "=" + (currentPort + 1)); - break; - } - } - } - this.installer = childProcess.fork(ts.combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv: execArgv }); - this.installer.on("message", function (m) { return _this.handleMessage(m); }); - this.reportInstallerProcessId(); - process.on("exit", function () { - _this.installer.kill(); - }); - }; - NodeTypingsInstaller.prototype.onProjectClosed = function (p) { - this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" }); - }; - NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typeAcquisition, unresolvedImports) { - var _this = this; - var request = server.createInstallTypingsRequest(project, typeAcquisition, unresolvedImports); - if (this.logger.hasLevel(server.LogLevel.verbose)) { - if (this.logger.hasLevel(server.LogLevel.verbose)) { - this.logger.info("Scheduling throttled operation: " + JSON.stringify(request)); - } - } - this.throttledOperations.schedule(project.getProjectName(), 250, function () { - if (_this.logger.hasLevel(server.LogLevel.verbose)) { - _this.logger.info("Sending request: " + JSON.stringify(request)); - } - _this.installer.send(request); - }); - }; - NodeTypingsInstaller.prototype.handleMessage = function (response) { - if (this.logger.hasLevel(server.LogLevel.verbose)) { - this.logger.info("Received response: " + JSON.stringify(response)); + LineIndex.linesFromText = function (text) { + var lineStarts = ts.computeLineStarts(text); + if (lineStarts.length === 0) { + return { lines: [], lineMap: lineStarts }; } - if (response.kind === server.EventInstall) { - if (this.telemetrySender) { - var body = { - telemetryEventName: "typingsInstalled", - payload: { - installedPackages: response.packagesToInstall.join(","), - installSuccess: response.installSuccess, - typingsInstallerVersion: response.typingsInstallerVersion - } - }; - var eventName = "telemetry"; - this.telemetrySender.event(body, eventName); - } - return; + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); } - this.projectService.updateTypingsForProject(response); - if (response.kind == server.ActionSet && this.socket) { - this.sendEvent(0, "setTypings", response); + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; + } + else { + lines.length--; } + return { lines: lines, lineMap: lineStarts }; }; - return NodeTypingsInstaller; + return LineIndex; }()); - var IOSession = (function (_super) { - __extends(IOSession, _super); - function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, telemetryEnabled, logger) { - var _this; - var typingsInstaller = disableAutomaticTypingAcquisition - ? undefined - : new NodeTypingsInstaller(telemetryEnabled, logger, host, installerEventPort, globalTypingsCacheLocation, host.newLine); - _this = _super.call(this, host, cancellationToken, useSingleInferredProject, typingsInstaller || server.nullTypingsInstaller, Buffer.byteLength, process.hrtime, logger, canUseEvents) || this; - if (telemetryEnabled && typingsInstaller) { - typingsInstaller.setTelemetrySender(_this); - } - return _this; + server.LineIndex = LineIndex; + var LineNode = (function () { + function LineNode() { + this.totalChars = 0; + this.totalLines = 0; + this.children = []; } - IOSession.prototype.exit = function () { - this.logger.info("Exiting..."); - this.projectService.closeLog(); - process.exit(0); + LineNode.prototype.isLeaf = function () { + return false; }; - IOSession.prototype.listen = function () { - var _this = this; - rl.on("line", function (input) { - var message = input.trim(); - _this.onMessage(message); - }); - rl.on("close", function () { - _this.exit(); - }); + LineNode.prototype.updateCounts = function () { + this.totalChars = 0; + this.totalLines = 0; + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); + } }; - return IOSession; - }(server.Session)); - function parseLoggingEnvironmentString(logEnvStr) { - var logEnv = { logToFile: true }; - var args = logEnvStr.split(" "); - for (var i = 0, len = args.length; i < (len - 1); i += 2) { - var option = args[i]; - var value = args[i + 1]; - if (option && value) { - switch (option) { - case "-file": - logEnv.file = ts.stripQuotes(value); - break; - case "-level": - var level = server.LogLevel[value]; - logEnv.detailLevel = typeof level === "number" ? level : server.LogLevel.normal; - break; - case "-traceToConsole": - logEnv.traceToConsole = value.toLowerCase() === "true"; - break; - case "-logToFile": - logEnv.logToFile = value.toLowerCase() === "true"; - break; - } + LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); } - } - return logEnv; - } - function createLoggerFromEnv() { - var fileName = undefined; - var detailLevel = server.LogLevel.normal; - var traceToConsole = false; - var logEnvStr = process.env["TSS_LOG"]; - if (logEnvStr) { - var logEnv = parseLoggingEnvironmentString(logEnvStr); - if (logEnv.logToFile) { - if (logEnv.file) { - fileName = logEnv.file; - } - else { - fileName = __dirname + "/.log" + process.pid.toString(); + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); } } - if (logEnv.detailLevel) { - detailLevel = logEnv.detailLevel; + else { + walkFns.goSubtree = true; } - traceToConsole = logEnv.traceToConsole; - } - return new Logger(fileName, traceToConsole, detailLevel); - } - function createPollingWatchedFileSet(interval, chunkSize) { - if (interval === void 0) { interval = 2500; } - if (chunkSize === void 0) { chunkSize = 30; } - var watchedFiles = []; - var nextFileToCheck = 0; - var watchTimer; - function getModifiedTime(fileName) { - return fs.statSync(fileName).mtime; - } - function poll(checkedIndex) { - var watchedFile = watchedFiles[checkedIndex]; - if (!watchedFile) { - return; + return walkFns.done; + }; + LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; } - fs.stat(watchedFile.fileName, function (err, stats) { - if (err) { - watchedFile.callback(watchedFile.fileName); + }; + LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; } - else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.fileName); - watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); + } + else { + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; } - }); - } - function startWatchTimer() { - watchTimer = setInterval(function () { - var count = 0; - var nextToCheck = nextFileToCheck; - var firstCheck = -1; - while ((count < chunkSize) && (nextToCheck !== firstCheck)) { - poll(nextToCheck); - if (firstCheck < 0) { - firstCheck = nextToCheck; + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; } - nextToCheck++; - if (nextToCheck === watchedFiles.length) { - nextToCheck = 0; + adjustedLength -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } + } + } + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); } - count++; } - nextFileToCheck = nextToCheck; - }, interval); - } - function addFile(fileName, callback) { - var file = { - fileName: fileName, - callback: callback, - mtime: getModifiedTime(fileName) - }; - watchedFiles.push(file); - if (watchedFiles.length === 1) { - startWatchTimer(); } - return file; - } - function removeFile(file) { - ts.unorderedRemoveItem(watchedFiles, file); - } - return { - getModifiedTime: getModifiedTime, - poll: poll, - startWatchTimer: startWatchTimer, - addFile: addFile, - removeFile: removeFile }; - } - var pollingWatchedFileSet = createPollingWatchedFileSet(); - var logger = createLoggerFromEnv(); - var pending = []; - var canWrite = true; - function writeMessage(buf) { - if (!canWrite) { - pending.push(buf); - } - else { - canWrite = false; - process.stdout.write(buf, setCanWriteFlagAndWriteMessageIfNecessary); - } - } - function setCanWriteFlagAndWriteMessageIfNecessary() { - canWrite = true; - if (pending.length) { - writeMessage(pending.shift()); - } - } - var sys = ts.sys; - sys.write = function (s) { return writeMessage(new Buffer(s, "utf8")); }; - sys.watchFile = function (fileName, callback) { - var watchedFile = pollingWatchedFileSet.addFile(fileName, callback); - return { - close: function () { return pollingWatchedFileSet.removeFile(watchedFile); } + LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset, + }; + } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + } + } + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; + } }; - }; - sys.setTimeout = setTimeout; - sys.clearTimeout = clearTimeout; - sys.setImmediate = setImmediate; - sys.clearImmediate = clearImmediate; - if (typeof global !== "undefined" && global.gc) { - sys.gc = function () { return global.gc(); }; - } - var cancellationToken; - try { - var factory = require("./cancellationToken"); - cancellationToken = factory(sys.args); - } - catch (e) { - cancellationToken = { - isCancellationRequested: function () { return false; } + LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset + }; + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } }; - } - ; - var eventPort; - { - var str = server.findArgument("--eventPort"); - var v = str && parseInt(str); - if (!isNaN(v)) { - eventPort = v; - } - } - var localeStr = server.findArgument("--locale"); - if (localeStr) { - ts.validateLocaleAndSetLanguage(localeStr, sys); - } - var useSingleInferredProject = server.hasArgument("--useSingleInferredProject"); - var disableAutomaticTypingAcquisition = server.hasArgument("--disableAutomaticTypingAcquisition"); - var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry); - var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, disableAutomaticTypingAcquisition, getGlobalTypingsCacheLocation(), telemetryEnabled, logger); - process.on("uncaughtException", function (err) { - ioSession.logError(err, "unknown"); - }); - process.noAsar = true; - ioSession.listen(); - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var debugObjectHost = (function () { return this; })(); -var ts; -(function (ts) { - function logInternalError(logger, err) { - if (logger) { - logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); - } - } - var ScriptSnapshotShimAdapter = (function () { - function ScriptSnapshotShimAdapter(scriptSnapshotShim) { - this.scriptSnapshotShim = scriptSnapshotShim; - } - ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { - return this.scriptSnapshotShim.getText(start, end); - }; - ScriptSnapshotShimAdapter.prototype.getLength = function () { - return this.scriptSnapshotShim.getLength(); - }; - ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { - var oldSnapshotShim = oldSnapshot; - var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); - if (encoded == null) { - return null; - } - var decoded = JSON.parse(encoded); - return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength); - }; - ScriptSnapshotShimAdapter.prototype.dispose = function () { - if ("dispose" in this.scriptSnapshotShim) { - this.scriptSnapshotShim.dispose(); - } - }; - return ScriptSnapshotShimAdapter; - }()); - var LanguageServiceShimHostAdapter = (function () { - function LanguageServiceShimHostAdapter(shimHost) { - var _this = this; - this.shimHost = shimHost; - this.loggingEnabled = false; - this.tracingEnabled = false; - if ("getModuleResolutionsForFile" in this.shimHost) { - this.resolveModuleNames = function (moduleNames, containingFile) { - var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); - return ts.map(moduleNames, function (name) { - var result = ts.getProperty(resolutionsInFile, name); - return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: false } : undefined; - }); - }; - } - if ("directoryExists" in this.shimHost) { - this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; - } - if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { - this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { - var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); - return ts.map(typeDirectiveNames, function (name) { return ts.getProperty(typeDirectivesForFile, name); }); - }; - } - } - LanguageServiceShimHostAdapter.prototype.log = function (s) { - if (this.loggingEnabled) { - this.shimHost.log(s); - } - }; - LanguageServiceShimHostAdapter.prototype.trace = function (s) { - if (this.tracingEnabled) { - this.shimHost.trace(s); - } - }; - LanguageServiceShimHostAdapter.prototype.error = function (s) { - this.shimHost.error(s); - }; - LanguageServiceShimHostAdapter.prototype.getProjectVersion = function () { - if (!this.shimHost.getProjectVersion) { - return undefined; - } - return this.shimHost.getProjectVersion(); - }; - LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () { - if (!this.shimHost.getTypeRootsVersion) { - return 0; - } - return this.shimHost.getTypeRootsVersion(); - }; - LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () { - return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; - }; - LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { - var settingsJson = this.shimHost.getCompilationSettings(); - if (settingsJson == null || settingsJson == "") { - throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); - } - return JSON.parse(settingsJson); - }; - LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { - var encoded = this.shimHost.getScriptFileNames(); - return this.files = JSON.parse(encoded); - }; - LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { - var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); - return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); - }; - LanguageServiceShimHostAdapter.prototype.getScriptKind = function (fileName) { - if ("getScriptKind" in this.shimHost) { - return this.shimHost.getScriptKind(fileName); - } - else { - return 0; - } - }; - LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { - return this.shimHost.getScriptVersion(fileName); - }; - LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { - var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); - if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { - return null; - } - try { - return JSON.parse(diagnosticMessagesJson); - } - catch (e) { - this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); - return null; - } - }; - LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { - var hostCancellationToken = this.shimHost.getCancellationToken(); - return new ThrottledCancellationToken(hostCancellationToken); - }; - LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { - return this.shimHost.getCurrentDirectory(); - }; - LanguageServiceShimHostAdapter.prototype.getDirectories = function (path) { - return JSON.parse(this.shimHost.getDirectories(path)); - }; - LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { - return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); - }; - LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) { - var pattern = ts.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); - return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); - }; - LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) { - return this.shimHost.readFile(path, encoding); - }; - LanguageServiceShimHostAdapter.prototype.fileExists = function (path) { - return this.shimHost.fileExists(path); - }; - return LanguageServiceShimHostAdapter; - }()); - ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; - var ThrottledCancellationToken = (function () { - function ThrottledCancellationToken(hostCancellationToken) { - this.hostCancellationToken = hostCancellationToken; - this.lastCancellationCheckTime = 0; - } - ThrottledCancellationToken.prototype.isCancellationRequested = function () { - var time = ts.timestamp(); - var duration = Math.abs(time - this.lastCancellationCheckTime); - if (duration > 10) { - this.lastCancellationCheckTime = time; - return this.hostCancellationToken.isCancellationRequested(); - } - return false; - }; - return ThrottledCancellationToken; - }()); - var CoreServicesShimHostAdapter = (function () { - function CoreServicesShimHostAdapter(shimHost) { - var _this = this; - this.shimHost = shimHost; - this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; - if ("directoryExists" in this.shimHost) { - this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; - } - if ("realpath" in this.shimHost) { - this.realpath = function (path) { return _this.shimHost.realpath(path); }; - } - } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) { - try { - var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); - return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); - } - catch (e) { - var results = []; - for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) { - var extension = extensions_2[_i]; - for (var _a = 0, _b = this.readDirectoryFallback(rootDir, extension, exclude); _a < _b.length; _a++) { - var file = _b[_a]; - if (!ts.contains(results, file)) { - results.push(file); + LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { + var child; + var relativeLineNumber = lineNumber; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); + } + } + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + }; + LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { + var child; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; + } + else { + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + }; + }; + LineNode.prototype.splitAfter = function (childIndex) { + var splitNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex]); + childIndex++; + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + }; + LineNode.prototype.remove = function (child) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + }; + LineNode.prototype.findChildIndex = function (child) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] !== child) && (childIndex < clen)) + childIndex++; + return childIndex; + }; + LineNode.prototype.insertAt = function (child, nodes) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex] = nodes[nodeIndex]; + childIndex++; + nodeIndex++; + } + var splitNodes = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex]); + nodeIndex++; + if (splitNode.children.length === lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; + } + } + for (var i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length === 0) { + splitNodes.length--; + } } } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i].updateCounts(); + } + return splitNodes; } - return results; + }; + LineNode.prototype.add = function (collection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + }; + LineNode.prototype.charCount = function () { + return this.totalChars; + }; + LineNode.prototype.lineCount = function () { + return this.totalLines; + }; + return LineNode; + }()); + server.LineNode = LineNode; + var LineLeaf = (function () { + function LineLeaf(text) { + this.text = text; } - }; - CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { - return this.shimHost.fileExists(fileName); - }; - CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { - return this.shimHost.readFile(fileName); - }; - CoreServicesShimHostAdapter.prototype.readDirectoryFallback = function (rootDir, extension, exclude) { - return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude))); - }; - CoreServicesShimHostAdapter.prototype.getDirectories = function (path) { - return JSON.parse(this.shimHost.getDirectories(path)); - }; - return CoreServicesShimHostAdapter; - }()); - ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; - function simpleForwardCall(logger, actionDescription, action, logPerformance) { - var start; - if (logPerformance) { - logger.log(actionDescription); - start = ts.timestamp(); - } - var result = action(); - if (logPerformance) { - var end = ts.timestamp(); - logger.log(actionDescription + " completed in " + (end - start) + " msec"); - if (typeof result === "string") { - var str = result; - if (str.length > 128) { - str = str.substring(0, 128) + "..."; + LineLeaf.prototype.isLeaf = function () { + return true; + }; + LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { + walkFns.leaf(rangeStart, rangeLength, this); + }; + LineLeaf.prototype.charCount = function () { + return this.text.length; + }; + LineLeaf.prototype.lineCount = function () { + return 1; + }; + return LineLeaf; + }()); + server.LineLeaf = LineLeaf; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var net = require("net"); + var childProcess = require("child_process"); + var os = require("os"); + function getGlobalTypingsCacheLocation() { + switch (process.platform) { + case "win32": { + var basePath = process.env.LOCALAPPDATA || + process.env.APPDATA || + (os.homedir && os.homedir()) || + process.env.USERPROFILE || + (process.env.HOMEDRIVE && process.env.HOMEPATH && ts.normalizeSlashes(process.env.HOMEDRIVE + process.env.HOMEPATH)) || + os.tmpdir(); + return ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript"); } - logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); + case "darwin": + case "linux": + case "android": { + var cacheLocation = getNonWindowsCacheLocation(process.platform === "darwin"); + return ts.combinePaths(cacheLocation, "typescript"); + } + default: + ts.Debug.fail("unsupported platform '" + process.platform + "'"); + return; } } - return result; - } - function forwardJSONCall(logger, actionDescription, action, logPerformance) { - return forwardCall(logger, actionDescription, true, action, logPerformance); - } - function forwardCall(logger, actionDescription, returnJson, action, logPerformance) { - try { - var result = simpleForwardCall(logger, actionDescription, action, logPerformance); - return returnJson ? JSON.stringify({ result: result }) : result; - } - catch (err) { - if (err instanceof ts.OperationCanceledException) { - return JSON.stringify({ canceled: true }); + function getNonWindowsCacheLocation(platformIsDarwin) { + if (process.env.XDG_CACHE_HOME) { + return process.env.XDG_CACHE_HOME; } - logInternalError(logger, err); - err.description = actionDescription; - return JSON.stringify({ error: err }); - } - } - var ShimBase = (function () { - function ShimBase(factory) { - this.factory = factory; - factory.registerShim(this); - } - ShimBase.prototype.dispose = function (_dummy) { - this.factory.unregisterShim(this); - }; - return ShimBase; - }()); - function realizeDiagnostics(diagnostics, newLine) { - return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); }); - } - ts.realizeDiagnostics = realizeDiagnostics; - function realizeDiagnostic(diagnostic, newLine) { - return { - message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), - start: diagnostic.start, - length: diagnostic.length, - category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(), - code: diagnostic.code - }; - } - var LanguageServiceShimObject = (function (_super) { - __extends(LanguageServiceShimObject, _super); - function LanguageServiceShimObject(factory, host, languageService) { - var _this = _super.call(this, factory) || this; - _this.host = host; - _this.languageService = languageService; - _this.logPerformance = false; - _this.logger = _this.host; - return _this; + var usersDir = platformIsDarwin ? "Users" : "home"; + var homePath = (os.homedir && os.homedir()) || + process.env.HOME || + ((process.env.LOGNAME || process.env.USER) && "/" + usersDir + "/" + (process.env.LOGNAME || process.env.USER)) || + os.tmpdir(); + var cacheFolder = platformIsDarwin + ? "Library/Caches" + : ".cache"; + return ts.combinePaths(ts.normalizeSlashes(homePath), cacheFolder); } - LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { - return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); - }; - LanguageServiceShimObject.prototype.dispose = function (dummy) { - this.logger.log("dispose()"); - this.languageService.dispose(); - this.languageService = null; - if (debugObjectHost && debugObjectHost.CollectGarbage) { - debugObjectHost.CollectGarbage(); - this.logger.log("CollectGarbage()"); + var readline = require("readline"); + var fs = require("fs"); + var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + terminal: false, + }); + var Logger = (function () { + function Logger(logFilename, traceToConsole, level) { + this.logFilename = logFilename; + this.traceToConsole = traceToConsole; + this.level = level; + this.fd = -1; + this.seq = 0; + this.inGroup = false; + this.firstInGroup = true; + if (this.logFilename) { + try { + this.fd = fs.openSync(this.logFilename, "w"); + } + catch (_) { + } + } } - this.logger = null; - _super.prototype.dispose.call(this, dummy); - }; - LanguageServiceShimObject.prototype.refresh = function (throwOnError) { - this.forwardJSONCall("refresh(" + throwOnError + ")", function () { return null; }); - }; - LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { - var _this = this; - this.forwardJSONCall("cleanupSemanticCache()", function () { - _this.languageService.cleanupSemanticCache(); - return null; - }); - }; - LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { - var newLine = ts.getNewLineOrDefaultFromHost(this.host); - return ts.realizeDiagnostics(diagnostics, newLine); - }; - LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { - var _this = this; - return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); }); - }; - LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { - var _this = this; - return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); }); - }; - LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { - var _this = this; - return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); - }; - LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { - var _this = this; - return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); - }; - LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { - var _this = this; - return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { - var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName); - return _this.realizeDiagnostics(diagnostics); - }); - }; - LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) { - var _this = this; - return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () { - var diagnostics = _this.languageService.getSemanticDiagnostics(fileName); - return _this.realizeDiagnostics(diagnostics); - }); - }; - LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () { - var _this = this; - return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { - var diagnostics = _this.languageService.getCompilerOptionsDiagnostics(); - return _this.realizeDiagnostics(diagnostics); - }); - }; - LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { - var _this = this; - return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { return _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); }); - }; - LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBreakpointStatementAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { return _this.languageService.getSignatureHelpItems(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDefinitionAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getTypeDefinitionAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getImplementationAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getImplementationAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); }); - }; - LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { - var _this = this; - return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); }); - }; - LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getBraceMatchingAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.isValidBraceCompletionAtPosition = function (fileName, position, openingBrace) { - var _this = this; - return this.forwardJSONCall("isValidBraceCompletionAtPosition('" + fileName + "', " + position + ", " + openingBrace + ")", function () { return _this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); }); - }; - LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { - var _this = this; - return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () { - var localOptions = JSON.parse(options); - return _this.languageService.getIndentationAtPosition(fileName, position, localOptions); - }); - }; - LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getReferencesAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.findReferences = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("findReferences('" + fileName + "', " + position + ")", function () { return _this.languageService.findReferences(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getOccurrencesAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { - var _this = this; - return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { - var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); - var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); - return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); - }); - }; - LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getCompletionsAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { - var _this = this; - return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", '" + entryName + "')", function () { return _this.languageService.getCompletionEntryDetails(fileName, position, entryName); }); - }; - LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { - var _this = this; - return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { - var localOptions = JSON.parse(options); - return _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); - }); - }; - LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { - var _this = this; - return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { - var localOptions = JSON.parse(options); - return _this.languageService.getFormattingEditsForDocument(fileName, localOptions); - }); - }; - LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { - var _this = this; - return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { - var localOptions = JSON.parse(options); - return _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); - }); - }; - LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { - var _this = this; - return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); }); - }; - LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) { - var _this = this; - return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ", " + fileName + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); }); - }; - LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { - var _this = this; - return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); }); - }; - LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) { - var _this = this; - return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); }); - }; - LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { - var _this = this; - return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); }); - }; - LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { - var _this = this; - return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { return _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); }); - }; - LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { - var _this = this; - return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { return _this.languageService.getEmitOutput(fileName); }); - }; - LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) { - var _this = this; - return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance); - }; - return LanguageServiceShimObject; - }(ShimBase)); - function convertClassifications(classifications) { - return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; - } - var ClassifierShimObject = (function (_super) { - __extends(ClassifierShimObject, _super); - function ClassifierShimObject(factory, logger) { - var _this = _super.call(this, factory) || this; - _this.logger = logger; - _this.logPerformance = false; - _this.classifier = ts.createClassifier(); - return _this; - } - ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { - var _this = this; - return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance); - }; - ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { - var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); - var result = ""; - for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { - var item = _a[_i]; - result += item.length + "\n"; - result += item.classification + "\n"; + Logger.padStringRight = function (str, padding) { + return (str + padding).slice(0, padding.length); + }; + Logger.prototype.close = function () { + if (this.fd >= 0) { + fs.close(this.fd); + } + }; + Logger.prototype.getLogFileName = function () { + return this.logFilename; + }; + Logger.prototype.perftrc = function (s) { + this.msg(s, server.Msg.Perf); + }; + Logger.prototype.info = function (s) { + this.msg(s, server.Msg.Info); + }; + Logger.prototype.startGroup = function () { + this.inGroup = true; + this.firstInGroup = true; + }; + Logger.prototype.endGroup = function () { + this.inGroup = false; + this.seq++; + this.firstInGroup = true; + }; + Logger.prototype.loggingEnabled = function () { + return !!this.logFilename || this.traceToConsole; + }; + Logger.prototype.hasLevel = function (level) { + return this.loggingEnabled() && this.level >= level; + }; + Logger.prototype.msg = function (s, type) { + if (type === void 0) { type = server.Msg.Err; } + if (this.fd >= 0 || this.traceToConsole) { + s = s + "\n"; + var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " "); + if (this.firstInGroup) { + s = prefix + s; + this.firstInGroup = false; + } + if (!this.inGroup) { + this.seq++; + this.firstInGroup = true; + } + if (this.fd >= 0) { + var buf = new Buffer(s); + fs.writeSync(this.fd, buf, 0, buf.length, null); + } + if (this.traceToConsole) { + console.warn(s); + } + } + }; + return Logger; + }()); + var NodeTypingsInstaller = (function () { + function NodeTypingsInstaller(telemetryEnabled, logger, host, eventPort, globalTypingsCacheLocation, typingSafeListLocation, newLine) { + var _this = this; + this.telemetryEnabled = telemetryEnabled; + this.logger = logger; + this.globalTypingsCacheLocation = globalTypingsCacheLocation; + this.typingSafeListLocation = typingSafeListLocation; + this.newLine = newLine; + this.installerPidReported = false; + this.throttledOperations = new server.ThrottledOperations(host); + if (eventPort) { + var s_1 = net.connect({ port: eventPort }, function () { + _this.socket = s_1; + _this.reportInstallerProcessId(); + }); + } } - result += classification.finalLexState; - return result; - }; - return ClassifierShimObject; - }(ShimBase)); - var CoreServicesShimObject = (function (_super) { - __extends(CoreServicesShimObject, _super); - function CoreServicesShimObject(factory, logger, host) { - var _this = _super.call(this, factory) || this; - _this.logger = logger; - _this.host = host; - _this.logPerformance = false; - return _this; - } - CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { - return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); - }; - CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) { - var _this = this; - return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { - var compilerOptions = JSON.parse(compilerOptionsJson); - var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); - var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] + NodeTypingsInstaller.prototype.reportInstallerProcessId = function () { + if (this.installerPidReported) { + return; + } + if (this.socket && this.installer) { + this.sendEvent(0, "typingsInstallerPid", { pid: this.installer.pid }); + this.installerPidReported = true; + } + }; + NodeTypingsInstaller.prototype.sendEvent = function (seq, event, body) { + this.socket.write(server.formatMessage({ seq: seq, type: "event", event: event, body: body }, this.logger, Buffer.byteLength, this.newLine), "utf8"); + }; + NodeTypingsInstaller.prototype.setTelemetrySender = function (telemetrySender) { + this.eventSender = telemetrySender; + }; + NodeTypingsInstaller.prototype.attach = function (projectService) { + var _this = this; + this.projectService = projectService; + if (this.logger.hasLevel(server.LogLevel.requestTime)) { + this.logger.info("Binding..."); + } + var args = [server.Arguments.GlobalCacheLocation, this.globalTypingsCacheLocation]; + if (this.telemetryEnabled) { + args.push(server.Arguments.EnableTelemetry); + } + if (this.logger.loggingEnabled() && this.logger.getLogFileName()) { + args.push(server.Arguments.LogFile, ts.combinePaths(ts.getDirectoryPath(ts.normalizeSlashes(this.logger.getLogFileName())), "ti-" + process.pid + ".log")); + } + if (this.typingSafeListLocation) { + args.push(server.Arguments.TypingSafeListLocation, this.typingSafeListLocation); + } + var execArgv = []; + { + for (var _i = 0, _a = process.execArgv; _i < _a.length; _i++) { + var arg = _a[_i]; + var match = /^--(debug|inspect)(=(\d+))?$/.exec(arg); + if (match) { + var currentPort = match[3] !== undefined + ? +match[3] + : match[1] === "debug" ? 5858 : 9229; + execArgv.push("--" + match[1] + "=" + (currentPort + 1)); + break; + } + } + } + this.installer = childProcess.fork(ts.combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv: execArgv }); + this.installer.on("message", function (m) { return _this.handleMessage(m); }); + this.reportInstallerProcessId(); + process.on("exit", function () { + _this.installer.kill(); + }); + }; + NodeTypingsInstaller.prototype.onProjectClosed = function (p) { + this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" }); + }; + NodeTypingsInstaller.prototype.enqueueInstallTypingsRequest = function (project, typeAcquisition, unresolvedImports) { + var _this = this; + var request = server.createInstallTypingsRequest(project, typeAcquisition, unresolvedImports); + if (this.logger.hasLevel(server.LogLevel.verbose)) { + if (this.logger.hasLevel(server.LogLevel.verbose)) { + this.logger.info("Scheduling throttled operation: " + JSON.stringify(request)); + } + } + this.throttledOperations.schedule(project.getProjectName(), 250, function () { + if (_this.logger.hasLevel(server.LogLevel.verbose)) { + _this.logger.info("Sending request: " + JSON.stringify(request)); + } + _this.installer.send(request); + }); + }; + NodeTypingsInstaller.prototype.handleMessage = function (response) { + if (this.logger.hasLevel(server.LogLevel.verbose)) { + this.logger.info("Received response: " + JSON.stringify(response)); + } + if (response.kind === server.EventInitializationFailed) { + if (!this.eventSender) { + return; + } + var body = { + message: response.message }; + var eventName = "typesInstallerInitializationFailed"; + this.eventSender.event(body, eventName); + return; } - return { - resolvedFileName: resolvedFileName, - failedLookupLocations: result.failedLookupLocations - }; - }); - }; - CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { - var _this = this; - return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { - var compilerOptions = JSON.parse(compilerOptionsJson); - var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); - return { - resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, - primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, - failedLookupLocations: result.failedLookupLocations - }; - }); - }; - CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { - var _this = this; - return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { - var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true); - return { - referencedFiles: _this.convertFileReferences(result.referencedFiles), - importedFiles: _this.convertFileReferences(result.importedFiles), - ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile, - typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) - }; - }); - }; - CoreServicesShimObject.prototype.getAutomaticTypeDirectiveNames = function (compilerOptionsJson) { - var _this = this; - return this.forwardJSONCall("getAutomaticTypeDirectiveNames('" + compilerOptionsJson + "')", function () { - var compilerOptions = JSON.parse(compilerOptionsJson); - return ts.getAutomaticTypeDirectiveNames(compilerOptions, _this.host); - }); - }; - CoreServicesShimObject.prototype.convertFileReferences = function (refs) { - if (!refs) { - return undefined; + if (response.kind === server.EventBeginInstallTypes) { + if (!this.eventSender) { + return; + } + var body = { + eventId: response.eventId, + packages: response.packagesToInstall, + }; + var eventName = "beginInstallTypes"; + this.eventSender.event(body, eventName); + return; + } + if (response.kind === server.EventEndInstallTypes) { + if (!this.eventSender) { + return; + } + if (this.telemetryEnabled) { + var body_1 = { + telemetryEventName: "typingsInstalled", + payload: { + installedPackages: response.packagesToInstall.join(","), + installSuccess: response.installSuccess, + typingsInstallerVersion: response.typingsInstallerVersion + } + }; + var eventName_1 = "telemetry"; + this.eventSender.event(body_1, eventName_1); + } + var body = { + eventId: response.eventId, + packages: response.packagesToInstall, + success: response.installSuccess, + }; + var eventName = "endInstallTypes"; + this.eventSender.event(body, eventName); + return; + } + this.projectService.updateTypingsForProject(response); + if (response.kind === server.ActionSet && this.socket) { + this.sendEvent(0, "setTypings", response); + } + }; + return NodeTypingsInstaller; + }()); + var IOSession = (function (_super) { + __extends(IOSession, _super); + function IOSession(options) { + var _this = this; + var host = options.host, installerEventPort = options.installerEventPort, globalTypingsCacheLocation = options.globalTypingsCacheLocation, typingSafeListLocation = options.typingSafeListLocation, canUseEvents = options.canUseEvents; + var typingsInstaller = disableAutomaticTypingAcquisition + ? undefined + : new NodeTypingsInstaller(telemetryEnabled, logger, host, installerEventPort, globalTypingsCacheLocation, typingSafeListLocation, host.newLine); + _this = _super.call(this, { + host: host, + cancellationToken: cancellationToken, + useSingleInferredProject: useSingleInferredProject, + typingsInstaller: typingsInstaller || server.nullTypingsInstaller, + byteLength: Buffer.byteLength, + hrtime: process.hrtime, + logger: logger, + canUseEvents: canUseEvents, + globalPlugins: options.globalPlugins, + pluginProbeLocations: options.pluginProbeLocations + }) || this; + if (telemetryEnabled && typingsInstaller) { + typingsInstaller.setTelemetrySender(_this); + } + return _this; } - var result = []; - for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { - var ref = refs_2[_i]; - result.push({ - path: ts.normalizeSlashes(ref.fileName), - position: ref.pos, - length: ref.end - ref.pos + IOSession.prototype.exit = function () { + this.logger.info("Exiting..."); + this.projectService.closeLog(); + process.exit(0); + }; + IOSession.prototype.listen = function () { + var _this = this; + rl.on("line", function (input) { + var message = input.trim(); + _this.onMessage(message); + }); + rl.on("close", function () { + _this.exit(); }); + }; + return IOSession; + }(server.Session)); + function parseLoggingEnvironmentString(logEnvStr) { + if (!logEnvStr) { + return {}; } - return result; - }; - CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { - var _this = this; - return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { - var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - var result = ts.parseConfigFileTextToJson(fileName, text); - if (result.error) { - return { - options: {}, - typeAcquisition: {}, - files: [], - raw: {}, - errors: [realizeDiagnostic(result.error, "\r\n")] - }; + var logEnv = { logToFile: true }; + var args = logEnvStr.split(" "); + var len = args.length - 1; + for (var i = 0; i < len; i += 2) { + var option = args[i]; + var value = args[i + 1]; + if (option && value) { + switch (option) { + case "-file": + logEnv.file = ts.stripQuotes(value); + break; + case "-level": + var level = getLogLevel(value); + logEnv.detailLevel = level !== undefined ? level : server.LogLevel.normal; + break; + case "-traceToConsole": + logEnv.traceToConsole = value.toLowerCase() === "true"; + break; + case "-logToFile": + logEnv.logToFile = value.toLowerCase() === "true"; + break; + } } - var normalizedFileName = ts.normalizeSlashes(fileName); - var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); - return { - options: configFile.options, - typeAcquisition: configFile.typeAcquisition, - files: configFile.fileNames, - raw: configFile.raw, - errors: realizeDiagnostics(configFile.errors, "\r\n") - }; - }); - }; - CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { - return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); - }; - CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { - var _this = this; - var getCanonicalFileName = ts.createGetCanonicalFileName(false); - return this.forwardJSONCall("discoverTypings()", function () { - var info = JSON.parse(discoverTypingsJson); - return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); - }); - }; - return CoreServicesShimObject; - }(ShimBase)); - var TypeScriptServicesFactory = (function () { - function TypeScriptServicesFactory() { - this._shims = []; + } + return logEnv; } - TypeScriptServicesFactory.prototype.getServicesVersion = function () { - return ts.servicesVersion; - }; - TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { - try { - if (this.documentRegistry === undefined) { - this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); + function getLogLevel(level) { + if (level) { + var l = level.toLowerCase(); + for (var name in server.LogLevel) { + if (isNaN(+name) && l === name.toLowerCase()) { + return server.LogLevel[name]; + } } - var hostAdapter = new LanguageServiceShimHostAdapter(host); - var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); - return new LanguageServiceShimObject(this, host, languageService); } - catch (err) { - logInternalError(host, err); - throw err; + return undefined; + } + function createLogger() { + var cmdLineLogFileName = server.findArgument("--logFile"); + var cmdLineVerbosity = getLogLevel(server.findArgument("--logVerbosity")); + var envLogOptions = parseLoggingEnvironmentString(process.env["TSS_LOG"]); + var logFileName = cmdLineLogFileName + ? ts.stripQuotes(cmdLineLogFileName) + : envLogOptions.logToFile + ? envLogOptions.file || (__dirname + "/.log" + process.pid.toString()) + : undefined; + var logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel; + return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity); + } + function createPollingWatchedFileSet(interval, chunkSize) { + if (interval === void 0) { interval = 2500; } + if (chunkSize === void 0) { chunkSize = 30; } + var watchedFiles = []; + var nextFileToCheck = 0; + var watchTimer; + function getModifiedTime(fileName) { + return fs.statSync(fileName).mtime; } - }; - TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { - try { - return new ClassifierShimObject(this, logger); + function poll(checkedIndex) { + var watchedFile = watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + fs.stat(watchedFile.fileName, function (err, stats) { + if (err) { + watchedFile.callback(watchedFile.fileName); + } + else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); + } + }); } - catch (err) { - logInternalError(logger, err); - throw err; + function startWatchTimer() { + watchTimer = setInterval(function () { + var count = 0; + var nextToCheck = nextFileToCheck; + var firstCheck = -1; + while ((count < chunkSize) && (nextToCheck !== firstCheck)) { + poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck === watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + nextFileToCheck = nextToCheck; + }, interval); + } + function addFile(fileName, callback) { + var file = { + fileName: fileName, + callback: callback, + mtime: getModifiedTime(fileName) + }; + watchedFiles.push(file); + if (watchedFiles.length === 1) { + startWatchTimer(); + } + return file; + } + function removeFile(file) { + ts.unorderedRemoveItem(watchedFiles, file); + } + return { + getModifiedTime: getModifiedTime, + poll: poll, + startWatchTimer: startWatchTimer, + addFile: addFile, + removeFile: removeFile + }; + } + var pollingWatchedFileSet = createPollingWatchedFileSet(); + var pending = []; + var canWrite = true; + function writeMessage(buf) { + if (!canWrite) { + pending.push(buf); + } + else { + canWrite = false; + process.stdout.write(buf, setCanWriteFlagAndWriteMessageIfNecessary); + } + } + function setCanWriteFlagAndWriteMessageIfNecessary() { + canWrite = true; + if (pending.length) { + writeMessage(pending.shift()); + } + } + function extractWatchDirectoryCacheKey(path, currentDriveKey) { + path = ts.normalizeSlashes(path); + if (isUNCPath(path)) { + var firstSlash = path.indexOf(ts.directorySeparator, 2); + return firstSlash !== -1 ? path.substring(0, firstSlash).toLowerCase() : path; + } + var rootLength = ts.getRootLength(path); + if (rootLength === 0) { + return currentDriveKey; } + if (path.charCodeAt(1) === 58 && path.charCodeAt(2) === 47) { + return path.charAt(0).toLowerCase(); + } + if (path.charCodeAt(0) === 47 && path.charCodeAt(1) !== 47) { + return currentDriveKey; + } + return undefined; + } + function isUNCPath(s) { + return s.length > 2 && s.charCodeAt(0) === 47 && s.charCodeAt(1) === 47; + } + var logger = createLogger(); + var sys = ts.sys; + var useWatchGuard = process.platform === "win32" && ts.getNodeMajorVersion() >= 4; + if (useWatchGuard) { + var currentDrive_1 = extractWatchDirectoryCacheKey(sys.resolvePath(sys.getCurrentDirectory()), undefined); + var statusCache_1 = ts.createMap(); + var originalWatchDirectory_1 = sys.watchDirectory; + sys.watchDirectory = function (path, callback, recursive) { + var cacheKey = extractWatchDirectoryCacheKey(path, currentDrive_1); + var status = cacheKey && statusCache_1.get(cacheKey); + if (status === undefined) { + if (logger.hasLevel(server.LogLevel.verbose)) { + logger.info(cacheKey + " for path " + path + " not found in cache..."); + } + try { + var args = [ts.combinePaths(__dirname, "watchGuard.js"), path]; + if (logger.hasLevel(server.LogLevel.verbose)) { + logger.info("Starting " + process.execPath + " with args " + JSON.stringify(args)); + } + childProcess.execFileSync(process.execPath, args, { stdio: "ignore", env: { "ELECTRON_RUN_AS_NODE": "1" } }); + status = true; + if (logger.hasLevel(server.LogLevel.verbose)) { + logger.info("WatchGuard for path " + path + " returned: OK"); + } + } + catch (e) { + status = false; + if (logger.hasLevel(server.LogLevel.verbose)) { + logger.info("WatchGuard for path " + path + " returned: " + e.message); + } + } + if (cacheKey) { + statusCache_1.set(cacheKey, status); + } + } + else if (logger.hasLevel(server.LogLevel.verbose)) { + logger.info("watchDirectory for " + path + " uses cached drive information."); + } + if (status) { + return originalWatchDirectory_1.call(sys, path, callback, recursive); + } + else { + return { close: function () { } }; + } + }; + } + sys.write = function (s) { return writeMessage(new Buffer(s, "utf8")); }; + sys.watchFile = function (fileName, callback) { + var watchedFile = pollingWatchedFileSet.addFile(fileName, callback); + return { + close: function () { return pollingWatchedFileSet.removeFile(watchedFile); } + }; }; - TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) { + sys.setTimeout = setTimeout; + sys.clearTimeout = clearTimeout; + sys.setImmediate = setImmediate; + sys.clearImmediate = clearImmediate; + if (typeof global !== "undefined" && global.gc) { + sys.gc = function () { return global.gc(); }; + } + sys.require = function (initialDir, moduleName) { + var result = ts.nodeModuleNameResolverWorker(moduleName, initialDir + "/program.ts", { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, sys, undefined, true); try { - var adapter = new CoreServicesShimHostAdapter(host); - return new CoreServicesShimObject(this, host, adapter); + return { module: require(result.resolvedModule.resolvedFileName), error: undefined }; } - catch (err) { - logInternalError(host, err); - throw err; + catch (e) { + return { module: undefined, error: e }; } }; - TypeScriptServicesFactory.prototype.close = function () { - this._shims = []; - this.documentRegistry = undefined; - }; - TypeScriptServicesFactory.prototype.registerShim = function (shim) { - this._shims.push(shim); - }; - TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { - if (this._shims[i] === shim) { - delete this._shims[i]; - return; - } + var cancellationToken; + try { + var factory = require("./cancellationToken"); + cancellationToken = factory(sys.args); + } + catch (e) { + cancellationToken = server.nullCancellationToken; + } + var eventPort; + { + var str = server.findArgument("--eventPort"); + var v = str && parseInt(str); + if (!isNaN(v)) { + eventPort = v; } - throw new Error("Invalid operation"); + } + var localeStr = server.findArgument("--locale"); + if (localeStr) { + ts.validateLocaleAndSetLanguage(localeStr, sys); + } + var typingSafeListLocation = server.findArgument("--typingSafeListLocation"); + var globalPlugins = (server.findArgument("--globalPlugins") || "").split(","); + var pluginProbeLocations = (server.findArgument("--pluginProbeLocations") || "").split(","); + var useSingleInferredProject = server.hasArgument("--useSingleInferredProject"); + var disableAutomaticTypingAcquisition = server.hasArgument("--disableAutomaticTypingAcquisition"); + var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry); + var options = { + host: sys, + cancellationToken: cancellationToken, + installerEventPort: eventPort, + canUseEvents: eventPort === undefined, + useSingleInferredProject: useSingleInferredProject, + disableAutomaticTypingAcquisition: disableAutomaticTypingAcquisition, + globalTypingsCacheLocation: getGlobalTypingsCacheLocation(), + typingSafeListLocation: typingSafeListLocation, + telemetryEnabled: telemetryEnabled, + logger: logger, + globalPlugins: globalPlugins, + pluginProbeLocations: pluginProbeLocations }; - return TypeScriptServicesFactory; - }()); - ts.TypeScriptServicesFactory = TypeScriptServicesFactory; - if (typeof module !== "undefined" && module.exports) { - module.exports = ts; - } + var ioSession = new IOSession(options); + process.on("uncaughtException", function (err) { + ioSession.logError(err, "unknown"); + }); + process.noAsar = true; + ioSession.listen(); + })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); -var TypeScript; -(function (TypeScript) { - var Services; - (function (Services) { - Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; - })(Services = TypeScript.Services || (TypeScript.Services = {})); -})(TypeScript || (TypeScript = {})); -var toolsVersion = "2.2"; diff --git a/node_modules/typescript/lib/tsserverlibrary.d.ts b/node_modules/typescript/lib/tsserverlibrary.d.ts index 3f46cb68b..44bd394e3 100644 --- a/node_modules/typescript/lib/tsserverlibrary.d.ts +++ b/node_modules/typescript/lib/tsserverlibrary.d.ts @@ -1,10055 +1,4027 @@ -/// -declare namespace ts.server.protocol { - namespace CommandTypes { - type Brace = "brace"; - type BraceFull = "brace-full"; - type BraceCompletion = "braceCompletion"; - type Change = "change"; - type Close = "close"; - type Completions = "completions"; - type CompletionsFull = "completions-full"; - type CompletionDetails = "completionEntryDetails"; - type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; - type CompileOnSaveEmitFile = "compileOnSaveEmitFile"; - type Configure = "configure"; - type Definition = "definition"; - type DefinitionFull = "definition-full"; - type Implementation = "implementation"; - type ImplementationFull = "implementation-full"; - type Exit = "exit"; - type Format = "format"; - type Formatonkey = "formatonkey"; - type FormatFull = "format-full"; - type FormatonkeyFull = "formatonkey-full"; - type FormatRangeFull = "formatRange-full"; - type Geterr = "geterr"; - type GeterrForProject = "geterrForProject"; - type SemanticDiagnosticsSync = "semanticDiagnosticsSync"; - type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; - type NavBar = "navbar"; - type NavBarFull = "navbar-full"; - type Navto = "navto"; - type NavtoFull = "navto-full"; - type NavTree = "navtree"; - type NavTreeFull = "navtree-full"; - type Occurrences = "occurrences"; - type DocumentHighlights = "documentHighlights"; - type DocumentHighlightsFull = "documentHighlights-full"; - type Open = "open"; - type Quickinfo = "quickinfo"; - type QuickinfoFull = "quickinfo-full"; - type References = "references"; - type ReferencesFull = "references-full"; - type Reload = "reload"; - type Rename = "rename"; - type RenameInfoFull = "rename-full"; - type RenameLocationsFull = "renameLocations-full"; - type Saveto = "saveto"; - type SignatureHelp = "signatureHelp"; - type SignatureHelpFull = "signatureHelp-full"; - type TypeDefinition = "typeDefinition"; - type ProjectInfo = "projectInfo"; - type ReloadProjects = "reloadProjects"; - type Unknown = "unknown"; - type OpenExternalProject = "openExternalProject"; - type OpenExternalProjects = "openExternalProjects"; - type CloseExternalProject = "closeExternalProject"; - type SynchronizeProjectList = "synchronizeProjectList"; - type ApplyChangedToOpenFiles = "applyChangedToOpenFiles"; - type EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full"; - type Cleanup = "cleanup"; - type OutliningSpans = "outliningSpans"; - type TodoComments = "todoComments"; - type Indentation = "indentation"; - type DocCommentTemplate = "docCommentTemplate"; - type CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full"; - type NameOrDottedNameSpan = "nameOrDottedNameSpan"; - type BreakpointStatement = "breakpointStatement"; - type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; - type GetCodeFixes = "getCodeFixes"; - type GetCodeFixesFull = "getCodeFixes-full"; - type GetSupportedCodeFixes = "getSupportedCodeFixes"; +/*! ***************************************************************************** +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. +***************************************************************************** */ + +declare namespace ts { + interface MapLike { + [index: string]: T; } - interface Message { - seq: number; - type: "request" | "response" | "event"; + interface Map { + get(key: string): T; + has(key: string): boolean; + set(key: string, value: T): this; + delete(key: string): boolean; + clear(): void; + forEach(action: (value: T, key: string) => void): void; + readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, T]>; } - interface Request extends Message { - command: string; - arguments?: any; + interface Iterator { + next(): { + value: T; + done: false; + } | { + value: never; + done: true; + }; } - interface ReloadProjectsRequest extends Message { - command: CommandTypes.ReloadProjects; + type Path = string & { + __pathBrand: any; + }; + interface FileMap { + get(fileName: Path): T; + set(fileName: Path, value: T): void; + contains(fileName: Path): boolean; + remove(fileName: Path): void; + forEachValue(f: (key: Path, v: T) => void): void; + getKeys(): Path[]; + clear(): void; } - interface Event extends Message { - event: string; - body?: any; + interface TextRange { + pos: number; + end: number; } - interface Response extends Message { - request_seq: number; - success: boolean; - command: string; - message?: string; - body?: any; + const enum SyntaxKind { + Unknown = 0, + EndOfFileToken = 1, + SingleLineCommentTrivia = 2, + MultiLineCommentTrivia = 3, + NewLineTrivia = 4, + WhitespaceTrivia = 5, + ShebangTrivia = 6, + ConflictMarkerTrivia = 7, + NumericLiteral = 8, + StringLiteral = 9, + JsxText = 10, + RegularExpressionLiteral = 11, + NoSubstitutionTemplateLiteral = 12, + TemplateHead = 13, + TemplateMiddle = 14, + TemplateTail = 15, + OpenBraceToken = 16, + CloseBraceToken = 17, + OpenParenToken = 18, + CloseParenToken = 19, + OpenBracketToken = 20, + CloseBracketToken = 21, + DotToken = 22, + DotDotDotToken = 23, + SemicolonToken = 24, + CommaToken = 25, + LessThanToken = 26, + LessThanSlashToken = 27, + GreaterThanToken = 28, + LessThanEqualsToken = 29, + GreaterThanEqualsToken = 30, + EqualsEqualsToken = 31, + ExclamationEqualsToken = 32, + EqualsEqualsEqualsToken = 33, + ExclamationEqualsEqualsToken = 34, + EqualsGreaterThanToken = 35, + PlusToken = 36, + MinusToken = 37, + AsteriskToken = 38, + AsteriskAsteriskToken = 39, + SlashToken = 40, + PercentToken = 41, + PlusPlusToken = 42, + MinusMinusToken = 43, + LessThanLessThanToken = 44, + GreaterThanGreaterThanToken = 45, + GreaterThanGreaterThanGreaterThanToken = 46, + AmpersandToken = 47, + BarToken = 48, + CaretToken = 49, + ExclamationToken = 50, + TildeToken = 51, + AmpersandAmpersandToken = 52, + BarBarToken = 53, + QuestionToken = 54, + ColonToken = 55, + AtToken = 56, + EqualsToken = 57, + PlusEqualsToken = 58, + MinusEqualsToken = 59, + AsteriskEqualsToken = 60, + AsteriskAsteriskEqualsToken = 61, + SlashEqualsToken = 62, + PercentEqualsToken = 63, + LessThanLessThanEqualsToken = 64, + GreaterThanGreaterThanEqualsToken = 65, + GreaterThanGreaterThanGreaterThanEqualsToken = 66, + AmpersandEqualsToken = 67, + BarEqualsToken = 68, + CaretEqualsToken = 69, + Identifier = 70, + BreakKeyword = 71, + CaseKeyword = 72, + CatchKeyword = 73, + ClassKeyword = 74, + ConstKeyword = 75, + ContinueKeyword = 76, + DebuggerKeyword = 77, + DefaultKeyword = 78, + DeleteKeyword = 79, + DoKeyword = 80, + ElseKeyword = 81, + EnumKeyword = 82, + ExportKeyword = 83, + ExtendsKeyword = 84, + FalseKeyword = 85, + FinallyKeyword = 86, + ForKeyword = 87, + FunctionKeyword = 88, + IfKeyword = 89, + ImportKeyword = 90, + InKeyword = 91, + InstanceOfKeyword = 92, + NewKeyword = 93, + NullKeyword = 94, + ReturnKeyword = 95, + SuperKeyword = 96, + SwitchKeyword = 97, + ThisKeyword = 98, + ThrowKeyword = 99, + TrueKeyword = 100, + TryKeyword = 101, + TypeOfKeyword = 102, + VarKeyword = 103, + VoidKeyword = 104, + WhileKeyword = 105, + WithKeyword = 106, + ImplementsKeyword = 107, + InterfaceKeyword = 108, + LetKeyword = 109, + PackageKeyword = 110, + PrivateKeyword = 111, + ProtectedKeyword = 112, + PublicKeyword = 113, + StaticKeyword = 114, + YieldKeyword = 115, + AbstractKeyword = 116, + AsKeyword = 117, + AnyKeyword = 118, + AsyncKeyword = 119, + AwaitKeyword = 120, + BooleanKeyword = 121, + ConstructorKeyword = 122, + DeclareKeyword = 123, + GetKeyword = 124, + IsKeyword = 125, + KeyOfKeyword = 126, + ModuleKeyword = 127, + NamespaceKeyword = 128, + NeverKeyword = 129, + ReadonlyKeyword = 130, + RequireKeyword = 131, + NumberKeyword = 132, + ObjectKeyword = 133, + SetKeyword = 134, + StringKeyword = 135, + SymbolKeyword = 136, + TypeKeyword = 137, + UndefinedKeyword = 138, + FromKeyword = 139, + GlobalKeyword = 140, + OfKeyword = 141, + QualifiedName = 142, + ComputedPropertyName = 143, + TypeParameter = 144, + Parameter = 145, + Decorator = 146, + PropertySignature = 147, + PropertyDeclaration = 148, + MethodSignature = 149, + MethodDeclaration = 150, + Constructor = 151, + GetAccessor = 152, + SetAccessor = 153, + CallSignature = 154, + ConstructSignature = 155, + IndexSignature = 156, + TypePredicate = 157, + TypeReference = 158, + FunctionType = 159, + ConstructorType = 160, + TypeQuery = 161, + TypeLiteral = 162, + ArrayType = 163, + TupleType = 164, + UnionType = 165, + IntersectionType = 166, + ParenthesizedType = 167, + ThisType = 168, + TypeOperator = 169, + IndexedAccessType = 170, + MappedType = 171, + LiteralType = 172, + ObjectBindingPattern = 173, + ArrayBindingPattern = 174, + BindingElement = 175, + ArrayLiteralExpression = 176, + ObjectLiteralExpression = 177, + PropertyAccessExpression = 178, + ElementAccessExpression = 179, + CallExpression = 180, + NewExpression = 181, + TaggedTemplateExpression = 182, + TypeAssertionExpression = 183, + ParenthesizedExpression = 184, + FunctionExpression = 185, + ArrowFunction = 186, + DeleteExpression = 187, + TypeOfExpression = 188, + VoidExpression = 189, + AwaitExpression = 190, + PrefixUnaryExpression = 191, + PostfixUnaryExpression = 192, + BinaryExpression = 193, + ConditionalExpression = 194, + TemplateExpression = 195, + YieldExpression = 196, + SpreadElement = 197, + ClassExpression = 198, + OmittedExpression = 199, + ExpressionWithTypeArguments = 200, + AsExpression = 201, + NonNullExpression = 202, + MetaProperty = 203, + TemplateSpan = 204, + SemicolonClassElement = 205, + Block = 206, + VariableStatement = 207, + EmptyStatement = 208, + ExpressionStatement = 209, + IfStatement = 210, + DoStatement = 211, + WhileStatement = 212, + ForStatement = 213, + ForInStatement = 214, + ForOfStatement = 215, + ContinueStatement = 216, + BreakStatement = 217, + ReturnStatement = 218, + WithStatement = 219, + SwitchStatement = 220, + LabeledStatement = 221, + ThrowStatement = 222, + TryStatement = 223, + DebuggerStatement = 224, + VariableDeclaration = 225, + VariableDeclarationList = 226, + FunctionDeclaration = 227, + ClassDeclaration = 228, + InterfaceDeclaration = 229, + TypeAliasDeclaration = 230, + EnumDeclaration = 231, + ModuleDeclaration = 232, + ModuleBlock = 233, + CaseBlock = 234, + NamespaceExportDeclaration = 235, + ImportEqualsDeclaration = 236, + ImportDeclaration = 237, + ImportClause = 238, + NamespaceImport = 239, + NamedImports = 240, + ImportSpecifier = 241, + ExportAssignment = 242, + ExportDeclaration = 243, + NamedExports = 244, + ExportSpecifier = 245, + MissingDeclaration = 246, + ExternalModuleReference = 247, + JsxElement = 248, + JsxSelfClosingElement = 249, + JsxOpeningElement = 250, + JsxClosingElement = 251, + JsxAttribute = 252, + JsxAttributes = 253, + JsxSpreadAttribute = 254, + JsxExpression = 255, + CaseClause = 256, + DefaultClause = 257, + HeritageClause = 258, + CatchClause = 259, + PropertyAssignment = 260, + ShorthandPropertyAssignment = 261, + SpreadAssignment = 262, + EnumMember = 263, + SourceFile = 264, + Bundle = 265, + JSDocTypeExpression = 266, + JSDocAllType = 267, + JSDocUnknownType = 268, + JSDocArrayType = 269, + JSDocUnionType = 270, + JSDocTupleType = 271, + JSDocNullableType = 272, + JSDocNonNullableType = 273, + JSDocRecordType = 274, + JSDocRecordMember = 275, + JSDocTypeReference = 276, + JSDocOptionalType = 277, + JSDocFunctionType = 278, + JSDocVariadicType = 279, + JSDocConstructorType = 280, + JSDocThisType = 281, + JSDocComment = 282, + JSDocTag = 283, + JSDocAugmentsTag = 284, + JSDocParameterTag = 285, + JSDocReturnTag = 286, + JSDocTypeTag = 287, + JSDocTemplateTag = 288, + JSDocTypedefTag = 289, + JSDocPropertyTag = 290, + JSDocTypeLiteral = 291, + JSDocLiteralType = 292, + SyntaxList = 293, + NotEmittedStatement = 294, + PartiallyEmittedExpression = 295, + MergeDeclarationMarker = 296, + EndOfDeclarationMarker = 297, + Count = 298, + FirstAssignment = 57, + LastAssignment = 69, + FirstCompoundAssignment = 58, + LastCompoundAssignment = 69, + FirstReservedWord = 71, + LastReservedWord = 106, + FirstKeyword = 71, + LastKeyword = 141, + FirstFutureReservedWord = 107, + LastFutureReservedWord = 115, + FirstTypeNode = 157, + LastTypeNode = 172, + FirstPunctuation = 16, + LastPunctuation = 69, + FirstToken = 0, + LastToken = 141, + FirstTriviaToken = 2, + LastTriviaToken = 7, + FirstLiteralToken = 8, + LastLiteralToken = 12, + FirstTemplateToken = 12, + LastTemplateToken = 15, + FirstBinaryOperator = 26, + LastBinaryOperator = 69, + FirstNode = 142, + FirstJSDocNode = 266, + LastJSDocNode = 292, + FirstJSDocTagNode = 282, + LastJSDocTagNode = 292, } - interface FileRequestArgs { - file: string; - projectFileName?: string; + const enum NodeFlags { + None = 0, + Let = 1, + Const = 2, + NestedNamespace = 4, + Synthesized = 8, + Namespace = 16, + ExportContext = 32, + ContainsThis = 64, + HasImplicitReturn = 128, + HasExplicitReturn = 256, + GlobalAugmentation = 512, + HasAsyncFunctions = 1024, + DisallowInContext = 2048, + YieldContext = 4096, + DecoratorContext = 8192, + AwaitContext = 16384, + ThisNodeHasError = 32768, + JavaScriptFile = 65536, + ThisNodeOrAnySubNodesHasError = 131072, + HasAggregatedChildData = 262144, + BlockScoped = 3, + ReachabilityCheckFlags = 384, + ReachabilityAndEmitFlags = 1408, + ContextFlags = 96256, + TypeExcludesFlags = 20480, } - interface DocCommentTemplateRequest extends FileLocationRequest { - command: CommandTypes.DocCommentTemplate; + const enum ModifierFlags { + None = 0, + Export = 1, + Ambient = 2, + Public = 4, + Private = 8, + Protected = 16, + Static = 32, + Readonly = 64, + Abstract = 128, + Async = 256, + Default = 512, + Const = 2048, + HasComputedFlags = 536870912, + AccessibilityModifier = 28, + ParameterPropertyModifier = 92, + NonPublicAccessibilityModifier = 24, + TypeScriptModifier = 2270, + ExportDefault = 513, } - interface DocCommandTemplateResponse extends Response { - body?: TextInsertion; + const enum JsxFlags { + None = 0, + IntrinsicNamedElement = 1, + IntrinsicIndexedElement = 2, + IntrinsicElement = 3, } - interface TodoCommentRequest extends FileRequest { - command: CommandTypes.TodoComments; - arguments: TodoCommentRequestArgs; + interface Node extends TextRange { + kind: SyntaxKind; + flags: NodeFlags; + decorators?: NodeArray; + modifiers?: ModifiersArray; + parent?: Node; } - interface TodoCommentRequestArgs extends FileRequestArgs { - descriptors: TodoCommentDescriptor[]; + interface NodeArray extends Array, TextRange { + hasTrailingComma?: boolean; } - interface TodoCommentsResponse extends Response { - body?: TodoComment[]; + interface Token extends Node { + kind: TKind; } - interface OutliningSpansRequest extends FileRequest { - command: CommandTypes.OutliningSpans; + type DotDotDotToken = Token; + type QuestionToken = Token; + type ColonToken = Token; + type EqualsToken = Token; + type AsteriskToken = Token; + type EqualsGreaterThanToken = Token; + type EndOfFileToken = Token; + type AtToken = Token; + type ReadonlyToken = Token; + type AwaitKeywordToken = Token; + type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; + type ModifiersArray = NodeArray; + interface Identifier extends PrimaryExpression { + kind: SyntaxKind.Identifier; + text: string; + originalKeywordKind?: SyntaxKind; + isInJSDocNamespace?: boolean; } - interface OutliningSpansResponse extends Response { - body?: OutliningSpan[]; + interface TransientIdentifier extends Identifier { + resolvedSymbol: Symbol; } - interface IndentationRequest extends FileLocationRequest { - command: CommandTypes.Indentation; - arguments: IndentationRequestArgs; + interface QualifiedName extends Node { + kind: SyntaxKind.QualifiedName; + left: EntityName; + right: Identifier; } - interface IndentationResponse extends Response { - body?: IndentationResult; + type EntityName = Identifier | QualifiedName; + type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName; + type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; + interface Declaration extends Node { + _declarationBrand: any; + name?: DeclarationName; } - interface IndentationResult { - position: number; - indentation: number; + interface DeclarationStatement extends Declaration, Statement { + name?: Identifier | StringLiteral | NumericLiteral; } - interface IndentationRequestArgs extends FileLocationRequestArgs { - options?: EditorSettings; + interface ComputedPropertyName extends Node { + kind: SyntaxKind.ComputedPropertyName; + expression: Expression; } - interface ProjectInfoRequestArgs extends FileRequestArgs { - needFileNameList: boolean; + interface Decorator extends Node { + kind: SyntaxKind.Decorator; + expression: LeftHandSideExpression; } - interface ProjectInfoRequest extends Request { - command: CommandTypes.ProjectInfo; - arguments: ProjectInfoRequestArgs; + interface TypeParameterDeclaration extends Declaration { + kind: SyntaxKind.TypeParameter; + parent?: DeclarationWithTypeParameters; + name: Identifier; + constraint?: TypeNode; + default?: TypeNode; + expression?: Expression; } - interface CompilerOptionsDiagnosticsRequest extends Request { - arguments: CompilerOptionsDiagnosticsRequestArgs; + interface SignatureDeclaration extends Declaration { + name?: PropertyName; + typeParameters?: NodeArray; + parameters: NodeArray; + type?: TypeNode; } - interface CompilerOptionsDiagnosticsRequestArgs { - projectFileName: string; + interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.CallSignature; } - interface ProjectInfo { - configFileName: string; - fileNames?: string[]; - languageServiceDisabled?: boolean; + interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.ConstructSignature; } - interface DiagnosticWithLinePosition { - message: string; - start: number; - length: number; - startLocation: Location; - endLocation: Location; - category: string; - code: number; + type BindingName = Identifier | BindingPattern; + interface VariableDeclaration extends Declaration { + kind: SyntaxKind.VariableDeclaration; + parent?: VariableDeclarationList | CatchClause; + name: BindingName; + type?: TypeNode; + initializer?: Expression; } - interface ProjectInfoResponse extends Response { - body?: ProjectInfo; + interface VariableDeclarationList extends Node { + kind: SyntaxKind.VariableDeclarationList; + parent?: VariableStatement | ForStatement | ForOfStatement | ForInStatement; + declarations: NodeArray; } - interface FileRequest extends Request { - arguments: FileRequestArgs; + interface ParameterDeclaration extends Declaration { + kind: SyntaxKind.Parameter; + parent?: SignatureDeclaration; + dotDotDotToken?: DotDotDotToken; + name: BindingName; + questionToken?: QuestionToken; + type?: TypeNode; + initializer?: Expression; } - interface FileLocationRequestArgs extends FileRequestArgs { - line: number; - offset: number; - position?: number; + interface BindingElement extends Declaration { + kind: SyntaxKind.BindingElement; + parent?: BindingPattern; + propertyName?: PropertyName; + dotDotDotToken?: DotDotDotToken; + name: BindingName; + initializer?: Expression; } - interface CodeFixRequest extends Request { - command: CommandTypes.GetCodeFixes; - arguments: CodeFixRequestArgs; + interface PropertySignature extends TypeElement { + kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember; + name: PropertyName; + questionToken?: QuestionToken; + type?: TypeNode; + initializer?: Expression; } - interface CodeFixRequestArgs extends FileRequestArgs { - startLine: number; - startOffset: number; - startPosition?: number; - endLine: number; - endOffset: number; - endPosition?: number; - errorCodes?: number[]; + interface PropertyDeclaration extends ClassElement { + kind: SyntaxKind.PropertyDeclaration; + questionToken?: QuestionToken; + name: PropertyName; + type?: TypeNode; + initializer?: Expression; } - interface GetCodeFixesResponse extends Response { - body?: CodeAction[]; + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + name?: PropertyName; } - interface FileLocationRequest extends FileRequest { - arguments: FileLocationRequestArgs; + type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration; + interface PropertyAssignment extends ObjectLiteralElement { + kind: SyntaxKind.PropertyAssignment; + name: PropertyName; + questionToken?: QuestionToken; + initializer: Expression; } - interface GetSupportedCodeFixesRequest extends Request { - command: CommandTypes.GetSupportedCodeFixes; + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + kind: SyntaxKind.ShorthandPropertyAssignment; + name: Identifier; + questionToken?: QuestionToken; + equalsToken?: Token; + objectAssignmentInitializer?: Expression; } - interface GetSupportedCodeFixesResponse extends Response { - body?: string[]; + interface SpreadAssignment extends ObjectLiteralElement { + kind: SyntaxKind.SpreadAssignment; + expression: Expression; } - interface EncodedSemanticClassificationsRequest extends FileRequest { - arguments: EncodedSemanticClassificationsRequestArgs; + interface VariableLikeDeclaration extends Declaration { + propertyName?: PropertyName; + dotDotDotToken?: DotDotDotToken; + name: DeclarationName; + questionToken?: QuestionToken; + type?: TypeNode; + initializer?: Expression; } - interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { - start: number; - length: number; + interface PropertyLikeDeclaration extends Declaration { + name: PropertyName; } - interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { - filesToSearch: string[]; + interface ObjectBindingPattern extends Node { + kind: SyntaxKind.ObjectBindingPattern; + parent?: VariableDeclaration | ParameterDeclaration | BindingElement; + elements: NodeArray; } - interface DefinitionRequest extends FileLocationRequest { - command: CommandTypes.Definition; + interface ArrayBindingPattern extends Node { + kind: SyntaxKind.ArrayBindingPattern; + parent?: VariableDeclaration | ParameterDeclaration | BindingElement; + elements: NodeArray; } - interface TypeDefinitionRequest extends FileLocationRequest { - command: CommandTypes.TypeDefinition; + type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; + type ArrayBindingElement = BindingElement | OmittedExpression; + interface FunctionLikeDeclaration extends SignatureDeclaration { + _functionLikeDeclarationBrand: any; + asteriskToken?: AsteriskToken; + questionToken?: QuestionToken; + body?: Block | Expression; } - interface ImplementationRequest extends FileLocationRequest { - command: CommandTypes.Implementation; + interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { + kind: SyntaxKind.FunctionDeclaration; + name?: Identifier; + body?: FunctionBody; } - interface Location { - line: number; - offset: number; + interface MethodSignature extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.MethodSignature; + name: PropertyName; } - interface TextSpan { - start: Location; - end: Location; + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.MethodDeclaration; + name: PropertyName; + body?: FunctionBody; } - interface FileSpan extends TextSpan { - file: string; + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + kind: SyntaxKind.Constructor; + parent?: ClassDeclaration | ClassExpression; + body?: FunctionBody; } - interface DefinitionResponse extends Response { - body?: FileSpan[]; + interface SemicolonClassElement extends ClassElement { + kind: SyntaxKind.SemicolonClassElement; + parent?: ClassDeclaration | ClassExpression; } - interface TypeDefinitionResponse extends Response { - body?: FileSpan[]; + interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.GetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; + name: PropertyName; + body: FunctionBody; } - interface ImplementationResponse extends Response { - body?: FileSpan[]; + interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.SetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; + name: PropertyName; + body: FunctionBody; } - interface BraceCompletionRequest extends FileLocationRequest { - command: CommandTypes.BraceCompletion; - arguments: BraceCompletionRequestArgs; + type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { + kind: SyntaxKind.IndexSignature; + parent?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode; } - interface BraceCompletionRequestArgs extends FileLocationRequestArgs { - openingBrace: string; + interface TypeNode extends Node { + _typeNodeBrand: any; } - interface OccurrencesRequest extends FileLocationRequest { - command: CommandTypes.Occurrences; + interface KeywordTypeNode extends TypeNode { + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } - interface OccurrencesResponseItem extends FileSpan { - isWriteAccess: boolean; + interface ThisTypeNode extends TypeNode { + kind: SyntaxKind.ThisType; } - interface OccurrencesResponse extends Response { - body?: OccurrencesResponseItem[]; + type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode; + interface FunctionTypeNode extends TypeNode, SignatureDeclaration { + kind: SyntaxKind.FunctionType; } - interface DocumentHighlightsRequest extends FileLocationRequest { - command: CommandTypes.DocumentHighlights; - arguments: DocumentHighlightsRequestArgs; + interface ConstructorTypeNode extends TypeNode, SignatureDeclaration { + kind: SyntaxKind.ConstructorType; } - interface HighlightSpan extends TextSpan { - kind: string; + interface TypeReferenceNode extends TypeNode { + kind: SyntaxKind.TypeReference; + typeName: EntityName; + typeArguments?: NodeArray; } - interface DocumentHighlightsItem { - file: string; - highlightSpans: HighlightSpan[]; + interface TypePredicateNode extends TypeNode { + kind: SyntaxKind.TypePredicate; + parameterName: Identifier | ThisTypeNode; + type: TypeNode; } - interface DocumentHighlightsResponse extends Response { - body?: DocumentHighlightsItem[]; + interface TypeQueryNode extends TypeNode { + kind: SyntaxKind.TypeQuery; + exprName: EntityName; } - interface ReferencesRequest extends FileLocationRequest { - command: CommandTypes.References; + interface TypeLiteralNode extends TypeNode, Declaration { + kind: SyntaxKind.TypeLiteral; + members: NodeArray; } - interface ReferencesResponseItem extends FileSpan { - lineText: string; - isWriteAccess: boolean; - isDefinition: boolean; + interface ArrayTypeNode extends TypeNode { + kind: SyntaxKind.ArrayType; + elementType: TypeNode; } - interface ReferencesResponseBody { - refs: ReferencesResponseItem[]; - symbolName: string; - symbolStartOffset: number; - symbolDisplayString: string; + interface TupleTypeNode extends TypeNode { + kind: SyntaxKind.TupleType; + elementTypes: NodeArray; } - interface ReferencesResponse extends Response { - body?: ReferencesResponseBody; + type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode; + interface UnionTypeNode extends TypeNode { + kind: SyntaxKind.UnionType; + types: NodeArray; } - interface RenameRequestArgs extends FileLocationRequestArgs { - findInComments?: boolean; - findInStrings?: boolean; + interface IntersectionTypeNode extends TypeNode { + kind: SyntaxKind.IntersectionType; + types: NodeArray; } - interface RenameRequest extends FileLocationRequest { - command: CommandTypes.Rename; - arguments: RenameRequestArgs; + interface ParenthesizedTypeNode extends TypeNode { + kind: SyntaxKind.ParenthesizedType; + type: TypeNode; } - interface RenameInfo { - canRename: boolean; - localizedErrorMessage?: string; - displayName: string; - fullDisplayName: string; - kind: string; - kindModifiers: string; + interface TypeOperatorNode extends TypeNode { + kind: SyntaxKind.TypeOperator; + operator: SyntaxKind.KeyOfKeyword; + type: TypeNode; } - interface SpanGroup { - file: string; - locs: TextSpan[]; + interface IndexedAccessTypeNode extends TypeNode { + kind: SyntaxKind.IndexedAccessType; + objectType: TypeNode; + indexType: TypeNode; } - interface RenameResponseBody { - info: RenameInfo; - locs: SpanGroup[]; + interface MappedTypeNode extends TypeNode, Declaration { + kind: SyntaxKind.MappedType; + parent?: TypeAliasDeclaration; + readonlyToken?: ReadonlyToken; + typeParameter: TypeParameterDeclaration; + questionToken?: QuestionToken; + type?: TypeNode; } - interface RenameResponse extends Response { - body?: RenameResponseBody; + interface LiteralTypeNode extends TypeNode { + kind: SyntaxKind.LiteralType; + literal: Expression; } - interface ExternalFile { - fileName: string; - scriptKind?: ScriptKindName | ts.ScriptKind; - hasMixedContent?: boolean; - content?: string; + interface StringLiteral extends LiteralExpression { + kind: SyntaxKind.StringLiteral; } - interface ExternalProject { - projectFileName: string; - rootFiles: ExternalFile[]; - options: ExternalProjectCompilerOptions; - typingOptions?: TypeAcquisition; - typeAcquisition?: TypeAcquisition; + interface Expression extends Node { + _expressionBrand: any; } - interface CompileOnSaveMixin { - compileOnSave?: boolean; + interface OmittedExpression extends Expression { + kind: SyntaxKind.OmittedExpression; } - type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin; - interface ProjectVersionInfo { - projectName: string; - isInferred: boolean; - version: number; - options: ts.CompilerOptions; + interface PartiallyEmittedExpression extends LeftHandSideExpression { + kind: SyntaxKind.PartiallyEmittedExpression; + expression: Expression; } - interface ProjectChanges { - added: string[]; - removed: string[]; + interface UnaryExpression extends Expression { + _unaryExpressionBrand: any; } - interface ProjectFiles { - info?: ProjectVersionInfo; - files?: string[]; - changes?: ProjectChanges; + interface IncrementExpression extends UnaryExpression { + _incrementExpressionBrand: any; } - interface ProjectFilesWithDiagnostics extends ProjectFiles { - projectErrors: DiagnosticWithLinePosition[]; + type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken; + interface PrefixUnaryExpression extends IncrementExpression { + kind: SyntaxKind.PrefixUnaryExpression; + operator: PrefixUnaryOperator; + operand: UnaryExpression; } - interface ChangedOpenFile { - fileName: string; - changes: ts.TextChange[]; + type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken; + interface PostfixUnaryExpression extends IncrementExpression { + kind: SyntaxKind.PostfixUnaryExpression; + operand: LeftHandSideExpression; + operator: PostfixUnaryOperator; } - interface ConfigureRequestArguments { - hostInfo?: string; - file?: string; - formatOptions?: FormatCodeSettings; + interface LeftHandSideExpression extends IncrementExpression { + _leftHandSideExpressionBrand: any; } - interface ConfigureRequest extends Request { - command: CommandTypes.Configure; - arguments: ConfigureRequestArguments; + interface MemberExpression extends LeftHandSideExpression { + _memberExpressionBrand: any; } - interface ConfigureResponse extends Response { + interface PrimaryExpression extends MemberExpression { + _primaryExpressionBrand: any; } - interface OpenRequestArgs extends FileRequestArgs { - fileContent?: string; - scriptKindName?: ScriptKindName; + interface NullLiteral extends PrimaryExpression, TypeNode { + kind: SyntaxKind.NullKeyword; } - type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; - interface OpenRequest extends Request { - command: CommandTypes.Open; - arguments: OpenRequestArgs; + interface BooleanLiteral extends PrimaryExpression, TypeNode { + kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword; } - interface OpenExternalProjectRequest extends Request { - command: CommandTypes.OpenExternalProject; - arguments: OpenExternalProjectArgs; + interface ThisExpression extends PrimaryExpression, KeywordTypeNode { + kind: SyntaxKind.ThisKeyword; } - type OpenExternalProjectArgs = ExternalProject; - interface OpenExternalProjectsRequest extends Request { - command: CommandTypes.OpenExternalProjects; - arguments: OpenExternalProjectsArgs; + interface SuperExpression extends PrimaryExpression { + kind: SyntaxKind.SuperKeyword; } - interface OpenExternalProjectsArgs { - projects: ExternalProject[]; + interface DeleteExpression extends UnaryExpression { + kind: SyntaxKind.DeleteExpression; + expression: UnaryExpression; } - interface OpenExternalProjectResponse extends Response { + interface TypeOfExpression extends UnaryExpression { + kind: SyntaxKind.TypeOfExpression; + expression: UnaryExpression; } - interface OpenExternalProjectsResponse extends Response { + interface VoidExpression extends UnaryExpression { + kind: SyntaxKind.VoidExpression; + expression: UnaryExpression; } - interface CloseExternalProjectRequest extends Request { - command: CommandTypes.CloseExternalProject; - arguments: CloseExternalProjectRequestArgs; + interface AwaitExpression extends UnaryExpression { + kind: SyntaxKind.AwaitExpression; + expression: UnaryExpression; } - interface CloseExternalProjectRequestArgs { - projectFileName: string; + interface YieldExpression extends Expression { + kind: SyntaxKind.YieldExpression; + asteriskToken?: AsteriskToken; + expression?: Expression; } - interface CloseExternalProjectResponse extends Response { + type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken; + type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken; + type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator; + type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken; + type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator; + type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken; + type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator; + type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword; + type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator; + type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken; + type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator; + type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken; + type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator; + type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken; + type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator; + type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken; + type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; + type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator; + type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken; + type BinaryOperatorToken = Token; + interface BinaryExpression extends Expression, Declaration { + kind: SyntaxKind.BinaryExpression; + left: Expression; + operatorToken: BinaryOperatorToken; + right: Expression; } - interface SynchronizeProjectListRequest extends Request { - arguments: SynchronizeProjectListRequestArgs; + type AssignmentOperatorToken = Token; + interface AssignmentExpression extends BinaryExpression { + left: LeftHandSideExpression; + operatorToken: TOperator; } - interface SynchronizeProjectListRequestArgs { - knownProjects: protocol.ProjectVersionInfo[]; + interface ObjectDestructuringAssignment extends AssignmentExpression { + left: ObjectLiteralExpression; } - interface ApplyChangedToOpenFilesRequest extends Request { - arguments: ApplyChangedToOpenFilesRequestArgs; + interface ArrayDestructuringAssignment extends AssignmentExpression { + left: ArrayLiteralExpression; } - interface ApplyChangedToOpenFilesRequestArgs { - openFiles?: ExternalFile[]; - changedFiles?: ChangedOpenFile[]; - closedFiles?: string[]; + type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment; + type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression | Identifier | PropertyAccessExpression | ElementAccessExpression; + type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment; + type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression; + type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression; + type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression; + type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression; + type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern; + interface ConditionalExpression extends Expression { + kind: SyntaxKind.ConditionalExpression; + condition: Expression; + questionToken: QuestionToken; + whenTrue: Expression; + colonToken: ColonToken; + whenFalse: Expression; } - interface SetCompilerOptionsForInferredProjectsRequest extends Request { - command: CommandTypes.CompilerOptionsForInferredProjects; - arguments: SetCompilerOptionsForInferredProjectsArgs; + type FunctionBody = Block; + type ConciseBody = FunctionBody | Expression; + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + kind: SyntaxKind.FunctionExpression; + name?: Identifier; + body: FunctionBody; } - interface SetCompilerOptionsForInferredProjectsArgs { - options: ExternalProjectCompilerOptions; + interface ArrowFunction extends Expression, FunctionLikeDeclaration { + kind: SyntaxKind.ArrowFunction; + equalsGreaterThanToken: EqualsGreaterThanToken; + body: ConciseBody; } - interface SetCompilerOptionsForInferredProjectsResponse extends Response { + interface LiteralLikeNode extends Node { + text: string; + isUnterminated?: boolean; + hasExtendedUnicodeEscape?: boolean; } - interface ExitRequest extends Request { - command: CommandTypes.Exit; + interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { + _literalExpressionBrand: any; } - interface CloseRequest extends FileRequest { - command: CommandTypes.Close; + interface RegularExpressionLiteral extends LiteralExpression { + kind: SyntaxKind.RegularExpressionLiteral; } - interface CompileOnSaveAffectedFileListRequest extends FileRequest { - command: CommandTypes.CompileOnSaveAffectedFileList; + interface NoSubstitutionTemplateLiteral extends LiteralExpression { + kind: SyntaxKind.NoSubstitutionTemplateLiteral; } - interface CompileOnSaveAffectedFileListSingleProject { - projectFileName: string; - fileNames: string[]; + interface NumericLiteral extends LiteralExpression { + kind: SyntaxKind.NumericLiteral; } - interface CompileOnSaveAffectedFileListResponse extends Response { - body: CompileOnSaveAffectedFileListSingleProject[]; + interface TemplateHead extends LiteralLikeNode { + kind: SyntaxKind.TemplateHead; + parent?: TemplateExpression; } - interface CompileOnSaveEmitFileRequest extends FileRequest { - command: CommandTypes.CompileOnSaveEmitFile; - arguments: CompileOnSaveEmitFileRequestArgs; + interface TemplateMiddle extends LiteralLikeNode { + kind: SyntaxKind.TemplateMiddle; + parent?: TemplateSpan; } - interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { - forced?: boolean; + interface TemplateTail extends LiteralLikeNode { + kind: SyntaxKind.TemplateTail; + parent?: TemplateSpan; } - interface QuickInfoRequest extends FileLocationRequest { - command: CommandTypes.Quickinfo; + type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral; + interface TemplateExpression extends PrimaryExpression { + kind: SyntaxKind.TemplateExpression; + head: TemplateHead; + templateSpans: NodeArray; } - interface QuickInfoResponseBody { - kind: string; - kindModifiers: string; - start: Location; - end: Location; - displayString: string; - documentation: string; + interface TemplateSpan extends Node { + kind: SyntaxKind.TemplateSpan; + parent?: TemplateExpression; + expression: Expression; + literal: TemplateMiddle | TemplateTail; } - interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody; + interface ParenthesizedExpression extends PrimaryExpression { + kind: SyntaxKind.ParenthesizedExpression; + expression: Expression; } - interface FormatRequestArgs extends FileLocationRequestArgs { - endLine: number; - endOffset: number; - endPosition?: number; - options?: FormatCodeSettings; + interface ArrayLiteralExpression extends PrimaryExpression { + kind: SyntaxKind.ArrayLiteralExpression; + elements: NodeArray; } - interface FormatRequest extends FileLocationRequest { - command: CommandTypes.Format; - arguments: FormatRequestArgs; + interface SpreadElement extends Expression { + kind: SyntaxKind.SpreadElement; + expression: Expression; } - interface CodeEdit { - start: Location; - end: Location; - newText: string; + interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration { + properties: NodeArray; } - interface FileCodeEdits { - fileName: string; - textChanges: CodeEdit[]; + interface ObjectLiteralExpression extends ObjectLiteralExpressionBase { + kind: SyntaxKind.ObjectLiteralExpression; } - interface CodeFixResponse extends Response { - body?: CodeAction[]; + type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression | ParenthesizedExpression; + type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; + interface PropertyAccessExpression extends MemberExpression, Declaration { + kind: SyntaxKind.PropertyAccessExpression; + expression: LeftHandSideExpression; + name: Identifier; } - interface CodeAction { - description: string; - changes: FileCodeEdits[]; + interface SuperPropertyAccessExpression extends PropertyAccessExpression { + expression: SuperExpression; } - interface FormatResponse extends Response { - body?: CodeEdit[]; + interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { + _propertyAccessExpressionLikeQualifiedNameBrand?: any; + expression: EntityNameExpression; } - interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { - key: string; - options?: FormatCodeSettings; + interface ElementAccessExpression extends MemberExpression { + kind: SyntaxKind.ElementAccessExpression; + expression: LeftHandSideExpression; + argumentExpression?: Expression; } - interface FormatOnKeyRequest extends FileLocationRequest { - command: CommandTypes.Formatonkey; - arguments: FormatOnKeyRequestArgs; + interface SuperElementAccessExpression extends ElementAccessExpression { + expression: SuperExpression; } - interface CompletionsRequestArgs extends FileLocationRequestArgs { - prefix?: string; + type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression; + interface CallExpression extends LeftHandSideExpression, Declaration { + kind: SyntaxKind.CallExpression; + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments: NodeArray; } - interface CompletionsRequest extends FileLocationRequest { - command: CommandTypes.Completions; - arguments: CompletionsRequestArgs; + interface SuperCall extends CallExpression { + expression: SuperExpression; } - interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { - entryNames: string[]; + interface ExpressionWithTypeArguments extends TypeNode { + kind: SyntaxKind.ExpressionWithTypeArguments; + parent?: HeritageClause; + expression: LeftHandSideExpression; + typeArguments?: NodeArray; } - interface CompletionDetailsRequest extends FileLocationRequest { - command: CommandTypes.CompletionDetails; - arguments: CompletionDetailsRequestArgs; + interface NewExpression extends PrimaryExpression, Declaration { + kind: SyntaxKind.NewExpression; + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments?: NodeArray; } - interface SymbolDisplayPart { - text: string; - kind: string; + interface TaggedTemplateExpression extends MemberExpression { + kind: SyntaxKind.TaggedTemplateExpression; + tag: LeftHandSideExpression; + template: TemplateLiteral; } - interface CompletionEntry { - name: string; - kind: string; - kindModifiers: string; - sortText: string; - replacementSpan?: TextSpan; + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement; + interface AsExpression extends Expression { + kind: SyntaxKind.AsExpression; + expression: Expression; + type: TypeNode; } - interface CompletionEntryDetails { - name: string; - kind: string; - kindModifiers: string; - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; + interface TypeAssertion extends UnaryExpression { + kind: SyntaxKind.TypeAssertionExpression; + type: TypeNode; + expression: UnaryExpression; } - interface CompletionsResponse extends Response { - body?: CompletionEntry[]; + type AssertionExpression = TypeAssertion | AsExpression; + interface NonNullExpression extends LeftHandSideExpression { + kind: SyntaxKind.NonNullExpression; + expression: Expression; } - interface CompletionDetailsResponse extends Response { - body?: CompletionEntryDetails[]; + interface MetaProperty extends PrimaryExpression { + kind: SyntaxKind.MetaProperty; + keywordToken: SyntaxKind; + name: Identifier; } - interface SignatureHelpParameter { - name: string; - documentation: SymbolDisplayPart[]; - displayParts: SymbolDisplayPart[]; - isOptional: boolean; + interface JsxElement extends PrimaryExpression { + kind: SyntaxKind.JsxElement; + openingElement: JsxOpeningElement; + children: NodeArray; + closingElement: JsxClosingElement; } - interface SignatureHelpItem { - isVariadic: boolean; - prefixDisplayParts: SymbolDisplayPart[]; - suffixDisplayParts: SymbolDisplayPart[]; - separatorDisplayParts: SymbolDisplayPart[]; - parameters: SignatureHelpParameter[]; - documentation: SymbolDisplayPart[]; + type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; + type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; + type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; + interface JsxAttributes extends ObjectLiteralExpressionBase { + parent?: JsxOpeningLikeElement; } - interface SignatureHelpItems { - items: SignatureHelpItem[]; - applicableSpan: TextSpan; - selectedItemIndex: number; - argumentIndex: number; - argumentCount: number; + interface JsxOpeningElement extends Expression { + kind: SyntaxKind.JsxOpeningElement; + parent?: JsxElement; + tagName: JsxTagNameExpression; + attributes: JsxAttributes; } - interface SignatureHelpRequestArgs extends FileLocationRequestArgs { + interface JsxSelfClosingElement extends PrimaryExpression { + kind: SyntaxKind.JsxSelfClosingElement; + tagName: JsxTagNameExpression; + attributes: JsxAttributes; } - interface SignatureHelpRequest extends FileLocationRequest { - command: CommandTypes.SignatureHelp; - arguments: SignatureHelpRequestArgs; + interface JsxAttribute extends ObjectLiteralElement { + kind: SyntaxKind.JsxAttribute; + parent?: JsxAttributes; + name: Identifier; + initializer?: StringLiteral | JsxExpression; } - interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems; + interface JsxSpreadAttribute extends ObjectLiteralElement { + kind: SyntaxKind.JsxSpreadAttribute; + parent?: JsxAttributes; + expression: Expression; } - interface SemanticDiagnosticsSyncRequest extends FileRequest { - command: CommandTypes.SemanticDiagnosticsSync; - arguments: SemanticDiagnosticsSyncRequestArgs; + interface JsxClosingElement extends Node { + kind: SyntaxKind.JsxClosingElement; + parent?: JsxElement; + tagName: JsxTagNameExpression; } - interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { - includeLinePosition?: boolean; + interface JsxExpression extends Expression { + kind: SyntaxKind.JsxExpression; + parent?: JsxElement | JsxAttributeLike; + dotDotDotToken?: Token; + expression?: Expression; } - interface SemanticDiagnosticsSyncResponse extends Response { - body?: Diagnostic[] | DiagnosticWithLinePosition[]; + interface JsxText extends Node { + kind: SyntaxKind.JsxText; + parent?: JsxElement; } - interface SyntacticDiagnosticsSyncRequest extends FileRequest { - command: CommandTypes.SyntacticDiagnosticsSync; - arguments: SyntacticDiagnosticsSyncRequestArgs; + type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; + interface Statement extends Node { + _statementBrand: any; } - interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { - includeLinePosition?: boolean; + interface NotEmittedStatement extends Statement { + kind: SyntaxKind.NotEmittedStatement; } - interface SyntacticDiagnosticsSyncResponse extends Response { - body?: Diagnostic[] | DiagnosticWithLinePosition[]; + interface EmptyStatement extends Statement { + kind: SyntaxKind.EmptyStatement; } - interface GeterrForProjectRequestArgs { - file: string; - delay: number; + interface DebuggerStatement extends Statement { + kind: SyntaxKind.DebuggerStatement; } - interface GeterrForProjectRequest extends Request { - command: CommandTypes.GeterrForProject; - arguments: GeterrForProjectRequestArgs; + interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { + kind: SyntaxKind.MissingDeclaration; + name?: Identifier; } - interface GeterrRequestArgs { - files: string[]; - delay: number; + type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause; + interface Block extends Statement { + kind: SyntaxKind.Block; + statements: NodeArray; } - interface GeterrRequest extends Request { - command: CommandTypes.Geterr; - arguments: GeterrRequestArgs; + interface VariableStatement extends Statement { + kind: SyntaxKind.VariableStatement; + declarationList: VariableDeclarationList; } - interface Diagnostic { - start: Location; - end: Location; - text: string; - code?: number; + interface ExpressionStatement extends Statement { + kind: SyntaxKind.ExpressionStatement; + expression: Expression; } - interface DiagnosticEventBody { - file: string; - diagnostics: Diagnostic[]; + interface IfStatement extends Statement { + kind: SyntaxKind.IfStatement; + expression: Expression; + thenStatement: Statement; + elseStatement?: Statement; } - interface DiagnosticEvent extends Event { - body?: DiagnosticEventBody; + interface IterationStatement extends Statement { + statement: Statement; } - interface ConfigFileDiagnosticEventBody { - triggerFile: string; - configFile: string; - diagnostics: Diagnostic[]; + interface DoStatement extends IterationStatement { + kind: SyntaxKind.DoStatement; + expression: Expression; } - interface ConfigFileDiagnosticEvent extends Event { - body?: ConfigFileDiagnosticEventBody; - event: "configFileDiag"; + interface WhileStatement extends IterationStatement { + kind: SyntaxKind.WhileStatement; + expression: Expression; } - type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; - interface ProjectLanguageServiceStateEvent extends Event { - event: ProjectLanguageServiceStateEventName; - body?: ProjectLanguageServiceStateEventBody; + type ForInitializer = VariableDeclarationList | Expression; + interface ForStatement extends IterationStatement { + kind: SyntaxKind.ForStatement; + initializer?: ForInitializer; + condition?: Expression; + incrementor?: Expression; } - interface ProjectLanguageServiceStateEventBody { - projectName: string; - languageServiceEnabled: boolean; + interface ForInStatement extends IterationStatement { + kind: SyntaxKind.ForInStatement; + initializer: ForInitializer; + expression: Expression; } - interface ReloadRequestArgs extends FileRequestArgs { - tmpfile: string; + interface ForOfStatement extends IterationStatement { + kind: SyntaxKind.ForOfStatement; + awaitModifier?: AwaitKeywordToken; + initializer: ForInitializer; + expression: Expression; } - interface ReloadRequest extends FileRequest { - command: CommandTypes.Reload; - arguments: ReloadRequestArgs; + interface BreakStatement extends Statement { + kind: SyntaxKind.BreakStatement; + label?: Identifier; } - interface ReloadResponse extends Response { + interface ContinueStatement extends Statement { + kind: SyntaxKind.ContinueStatement; + label?: Identifier; } - interface SavetoRequestArgs extends FileRequestArgs { - tmpfile: string; + type BreakOrContinueStatement = BreakStatement | ContinueStatement; + interface ReturnStatement extends Statement { + kind: SyntaxKind.ReturnStatement; + expression?: Expression; } - interface SavetoRequest extends FileRequest { - command: CommandTypes.Saveto; - arguments: SavetoRequestArgs; + interface WithStatement extends Statement { + kind: SyntaxKind.WithStatement; + expression: Expression; + statement: Statement; } - interface NavtoRequestArgs extends FileRequestArgs { - searchValue: string; - maxResultCount?: number; - currentFileOnly?: boolean; - projectFileName?: string; + interface SwitchStatement extends Statement { + kind: SyntaxKind.SwitchStatement; + expression: Expression; + caseBlock: CaseBlock; + possiblyExhaustive?: boolean; } - interface NavtoRequest extends FileRequest { - command: CommandTypes.Navto; - arguments: NavtoRequestArgs; + interface CaseBlock extends Node { + kind: SyntaxKind.CaseBlock; + parent?: SwitchStatement; + clauses: NodeArray; } - interface NavtoItem { - name: string; - kind: string; - matchKind?: string; - isCaseSensitive?: boolean; - kindModifiers?: string; - file: string; - start: Location; - end: Location; - containerName?: string; - containerKind?: string; + interface CaseClause extends Node { + kind: SyntaxKind.CaseClause; + parent?: CaseBlock; + expression: Expression; + statements: NodeArray; } - interface NavtoResponse extends Response { - body?: NavtoItem[]; + interface DefaultClause extends Node { + kind: SyntaxKind.DefaultClause; + parent?: CaseBlock; + statements: NodeArray; } - interface ChangeRequestArgs extends FormatRequestArgs { - insertString?: string; + type CaseOrDefaultClause = CaseClause | DefaultClause; + interface LabeledStatement extends Statement { + kind: SyntaxKind.LabeledStatement; + label: Identifier; + statement: Statement; } - interface ChangeRequest extends FileLocationRequest { - command: CommandTypes.Change; - arguments: ChangeRequestArgs; + interface ThrowStatement extends Statement { + kind: SyntaxKind.ThrowStatement; + expression: Expression; } - interface BraceResponse extends Response { - body?: TextSpan[]; + interface TryStatement extends Statement { + kind: SyntaxKind.TryStatement; + tryBlock: Block; + catchClause?: CatchClause; + finallyBlock?: Block; } - interface BraceRequest extends FileLocationRequest { - command: CommandTypes.Brace; + interface CatchClause extends Node { + kind: SyntaxKind.CatchClause; + parent?: TryStatement; + variableDeclaration: VariableDeclaration; + block: Block; } - interface NavBarRequest extends FileRequest { - command: CommandTypes.NavBar; + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; + interface ClassLikeDeclaration extends Declaration { + name?: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; } - interface NavTreeRequest extends FileRequest { - command: CommandTypes.NavTree; + interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { + kind: SyntaxKind.ClassDeclaration; + name?: Identifier; } - interface NavigationBarItem { - text: string; - kind: string; - kindModifiers?: string; - spans: TextSpan[]; - childItems?: NavigationBarItem[]; - indent: number; + interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + kind: SyntaxKind.ClassExpression; } - interface NavigationTree { - text: string; - kind: string; - kindModifiers: string; - spans: TextSpan[]; - childItems?: NavigationTree[]; + interface ClassElement extends Declaration { + _classElementBrand: any; + name?: PropertyName; } - type TelemetryEventName = "telemetry"; - interface TelemetryEvent extends Event { - event: TelemetryEventName; - body: TelemetryEventBody; + interface TypeElement extends Declaration { + _typeElementBrand: any; + name?: PropertyName; + questionToken?: QuestionToken; } - interface TelemetryEventBody { - telemetryEventName: string; - payload: any; + interface InterfaceDeclaration extends DeclarationStatement { + kind: SyntaxKind.InterfaceDeclaration; + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; } - type TypingsInstalledTelemetryEventName = "typingsInstalled"; - interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { - telemetryEventName: TypingsInstalledTelemetryEventName; - payload: TypingsInstalledTelemetryEventPayload; + interface HeritageClause extends Node { + kind: SyntaxKind.HeritageClause; + parent?: InterfaceDeclaration | ClassDeclaration | ClassExpression; + token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword; + types: NodeArray; } - interface TypingsInstalledTelemetryEventPayload { - installedPackages: string; - installSuccess: boolean; - typingsInstallerVersion: string; + interface TypeAliasDeclaration extends DeclarationStatement { + kind: SyntaxKind.TypeAliasDeclaration; + name: Identifier; + typeParameters?: NodeArray; + type: TypeNode; } - interface NavBarResponse extends Response { - body?: NavigationBarItem[]; + interface EnumMember extends Declaration { + kind: SyntaxKind.EnumMember; + parent?: EnumDeclaration; + name: PropertyName; + initializer?: Expression; } - interface NavTreeResponse extends Response { - body?: NavigationTree; + interface EnumDeclaration extends DeclarationStatement { + kind: SyntaxKind.EnumDeclaration; + name: Identifier; + members: NodeArray; } - namespace IndentStyle { - type None = "None"; - type Block = "Block"; - type Smart = "Smart"; + type ModuleName = Identifier | StringLiteral; + type ModuleBody = NamespaceBody | JSDocNamespaceBody; + interface ModuleDeclaration extends DeclarationStatement { + kind: SyntaxKind.ModuleDeclaration; + parent?: ModuleBody | SourceFile; + name: ModuleName; + body?: ModuleBody | JSDocNamespaceDeclaration; } - type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart; - interface EditorSettings { - baseIndentSize?: number; - indentSize?: number; - tabSize?: number; - newLineCharacter?: string; - convertTabsToSpaces?: boolean; - indentStyle?: IndentStyle | ts.IndentStyle; + type NamespaceBody = ModuleBlock | NamespaceDeclaration; + interface NamespaceDeclaration extends ModuleDeclaration { + name: Identifier; + body: NamespaceBody; } - interface FormatCodeSettings extends EditorSettings { - insertSpaceAfterCommaDelimiter?: boolean; - insertSpaceAfterSemicolonInForStatements?: boolean; - insertSpaceBeforeAndAfterBinaryOperators?: boolean; - insertSpaceAfterKeywordsInControlFlowStatements?: boolean; - insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; - placeOpenBraceOnNewLineForFunctions?: boolean; - placeOpenBraceOnNewLineForControlBlocks?: boolean; + type JSDocNamespaceBody = Identifier | JSDocNamespaceDeclaration; + interface JSDocNamespaceDeclaration extends ModuleDeclaration { + name: Identifier; + body: JSDocNamespaceBody; } - interface CompilerOptions { - allowJs?: boolean; - allowSyntheticDefaultImports?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - baseUrl?: string; - charset?: string; - declaration?: boolean; - declarationDir?: string; - disableSizeLimit?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - isolatedModules?: boolean; - jsx?: JsxEmit | ts.JsxEmit; - lib?: string[]; - locale?: string; - mapRoot?: string; - maxNodeModuleJsDepth?: number; - module?: ModuleKind | ts.ModuleKind; - moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; - newLine?: NewLineKind | ts.NewLineKind; - noEmit?: boolean; - noEmitHelpers?: boolean; - noEmitOnError?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitReturns?: boolean; - noImplicitThis?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noImplicitUseStrict?: boolean; - noLib?: boolean; - noResolve?: boolean; - out?: string; - outDir?: string; - outFile?: string; - paths?: MapLike; - preserveConstEnums?: boolean; - project?: string; - reactNamespace?: string; - removeComments?: boolean; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - strictNullChecks?: boolean; - suppressExcessPropertyErrors?: boolean; - suppressImplicitAnyIndexErrors?: boolean; - target?: ScriptTarget | ts.ScriptTarget; - traceResolution?: boolean; - types?: string[]; - typeRoots?: string[]; - [option: string]: CompilerOptionsValue | undefined; + interface ModuleBlock extends Node, Statement { + kind: SyntaxKind.ModuleBlock; + parent?: ModuleDeclaration; + statements: NodeArray; } - namespace JsxEmit { - type None = "None"; - type Preserve = "Preserve"; - type React = "React"; + type ModuleReference = EntityName | ExternalModuleReference; + interface ImportEqualsDeclaration extends DeclarationStatement { + kind: SyntaxKind.ImportEqualsDeclaration; + parent?: SourceFile | ModuleBlock; + name: Identifier; + moduleReference: ModuleReference; } - type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; - namespace ModuleKind { - type None = "None"; - type CommonJS = "CommonJS"; - type AMD = "AMD"; - type UMD = "UMD"; - type System = "System"; - type ES6 = "ES6"; - type ES2015 = "ES2015"; + interface ExternalModuleReference extends Node { + kind: SyntaxKind.ExternalModuleReference; + parent?: ImportEqualsDeclaration; + expression?: Expression; } - type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015; - namespace ModuleResolutionKind { - type Classic = "Classic"; - type Node = "Node"; + interface ImportDeclaration extends Statement { + kind: SyntaxKind.ImportDeclaration; + parent?: SourceFile | ModuleBlock; + importClause?: ImportClause; + moduleSpecifier: Expression; } - type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node; - namespace NewLineKind { - type Crlf = "Crlf"; - type Lf = "Lf"; + type NamedImportBindings = NamespaceImport | NamedImports; + interface ImportClause extends Declaration { + kind: SyntaxKind.ImportClause; + parent?: ImportDeclaration; + name?: Identifier; + namedBindings?: NamedImportBindings; } - type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf; - namespace ScriptTarget { - type ES3 = "ES3"; - type ES5 = "ES5"; - type ES6 = "ES6"; - type ES2015 = "ES2015"; + interface NamespaceImport extends Declaration { + kind: SyntaxKind.NamespaceImport; + parent?: ImportClause; + name: Identifier; } - type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015; -} -declare namespace ts { - interface MapLike { - [index: string]: T; + interface NamespaceExportDeclaration extends DeclarationStatement { + kind: SyntaxKind.NamespaceExportDeclaration; + name: Identifier; } - interface Map extends MapLike { - __mapBrand: any; + interface ExportDeclaration extends DeclarationStatement { + kind: SyntaxKind.ExportDeclaration; + parent?: SourceFile | ModuleBlock; + exportClause?: NamedExports; + moduleSpecifier?: Expression; } - type Path = string & { - __pathBrand: any; - }; - interface FileMap { - get(fileName: Path): T; - set(fileName: Path, value: T): void; - contains(fileName: Path): boolean; - remove(fileName: Path): void; - forEachValue(f: (key: Path, v: T) => void): void; - getKeys(): Path[]; - clear(): void; + interface NamedImports extends Node { + kind: SyntaxKind.NamedImports; + parent?: ImportClause; + elements: NodeArray; } - interface TextRange { - pos: number; - end: number; + interface NamedExports extends Node { + kind: SyntaxKind.NamedExports; + parent?: ExportDeclaration; + elements: NodeArray; } - const enum SyntaxKind { - Unknown = 0, - EndOfFileToken = 1, - SingleLineCommentTrivia = 2, - MultiLineCommentTrivia = 3, - NewLineTrivia = 4, - WhitespaceTrivia = 5, - ShebangTrivia = 6, - ConflictMarkerTrivia = 7, - NumericLiteral = 8, - StringLiteral = 9, - JsxText = 10, - RegularExpressionLiteral = 11, - NoSubstitutionTemplateLiteral = 12, - TemplateHead = 13, - TemplateMiddle = 14, - TemplateTail = 15, - OpenBraceToken = 16, - CloseBraceToken = 17, - OpenParenToken = 18, - CloseParenToken = 19, - OpenBracketToken = 20, - CloseBracketToken = 21, - DotToken = 22, - DotDotDotToken = 23, - SemicolonToken = 24, - CommaToken = 25, - LessThanToken = 26, - LessThanSlashToken = 27, - GreaterThanToken = 28, - LessThanEqualsToken = 29, - GreaterThanEqualsToken = 30, - EqualsEqualsToken = 31, - ExclamationEqualsToken = 32, - EqualsEqualsEqualsToken = 33, - ExclamationEqualsEqualsToken = 34, - EqualsGreaterThanToken = 35, - PlusToken = 36, - MinusToken = 37, - AsteriskToken = 38, - AsteriskAsteriskToken = 39, - SlashToken = 40, - PercentToken = 41, - PlusPlusToken = 42, - MinusMinusToken = 43, - LessThanLessThanToken = 44, - GreaterThanGreaterThanToken = 45, - GreaterThanGreaterThanGreaterThanToken = 46, - AmpersandToken = 47, - BarToken = 48, - CaretToken = 49, - ExclamationToken = 50, - TildeToken = 51, - AmpersandAmpersandToken = 52, - BarBarToken = 53, - QuestionToken = 54, - ColonToken = 55, - AtToken = 56, - EqualsToken = 57, - PlusEqualsToken = 58, - MinusEqualsToken = 59, - AsteriskEqualsToken = 60, - AsteriskAsteriskEqualsToken = 61, - SlashEqualsToken = 62, - PercentEqualsToken = 63, - LessThanLessThanEqualsToken = 64, - GreaterThanGreaterThanEqualsToken = 65, - GreaterThanGreaterThanGreaterThanEqualsToken = 66, - AmpersandEqualsToken = 67, - BarEqualsToken = 68, - CaretEqualsToken = 69, - Identifier = 70, - BreakKeyword = 71, - CaseKeyword = 72, - CatchKeyword = 73, - ClassKeyword = 74, - ConstKeyword = 75, - ContinueKeyword = 76, - DebuggerKeyword = 77, - DefaultKeyword = 78, - DeleteKeyword = 79, - DoKeyword = 80, - ElseKeyword = 81, - EnumKeyword = 82, - ExportKeyword = 83, - ExtendsKeyword = 84, - FalseKeyword = 85, - FinallyKeyword = 86, - ForKeyword = 87, - FunctionKeyword = 88, - IfKeyword = 89, - ImportKeyword = 90, - InKeyword = 91, - InstanceOfKeyword = 92, - NewKeyword = 93, - NullKeyword = 94, - ReturnKeyword = 95, - SuperKeyword = 96, - SwitchKeyword = 97, - ThisKeyword = 98, - ThrowKeyword = 99, - TrueKeyword = 100, - TryKeyword = 101, - TypeOfKeyword = 102, - VarKeyword = 103, - VoidKeyword = 104, - WhileKeyword = 105, - WithKeyword = 106, - ImplementsKeyword = 107, - InterfaceKeyword = 108, - LetKeyword = 109, - PackageKeyword = 110, - PrivateKeyword = 111, - ProtectedKeyword = 112, - PublicKeyword = 113, - StaticKeyword = 114, - YieldKeyword = 115, - AbstractKeyword = 116, - AsKeyword = 117, - AnyKeyword = 118, - AsyncKeyword = 119, - AwaitKeyword = 120, - BooleanKeyword = 121, - ConstructorKeyword = 122, - DeclareKeyword = 123, - GetKeyword = 124, - IsKeyword = 125, - KeyOfKeyword = 126, - ModuleKeyword = 127, - NamespaceKeyword = 128, - NeverKeyword = 129, - ReadonlyKeyword = 130, - RequireKeyword = 131, - NumberKeyword = 132, - SetKeyword = 133, - StringKeyword = 134, - SymbolKeyword = 135, - TypeKeyword = 136, - UndefinedKeyword = 137, - FromKeyword = 138, - GlobalKeyword = 139, - OfKeyword = 140, - QualifiedName = 141, - ComputedPropertyName = 142, - TypeParameter = 143, - Parameter = 144, - Decorator = 145, - PropertySignature = 146, - PropertyDeclaration = 147, - MethodSignature = 148, - MethodDeclaration = 149, - Constructor = 150, - GetAccessor = 151, - SetAccessor = 152, - CallSignature = 153, - ConstructSignature = 154, - IndexSignature = 155, - TypePredicate = 156, - TypeReference = 157, - FunctionType = 158, - ConstructorType = 159, - TypeQuery = 160, - TypeLiteral = 161, - ArrayType = 162, - TupleType = 163, - UnionType = 164, - IntersectionType = 165, - ParenthesizedType = 166, - ThisType = 167, - TypeOperator = 168, - IndexedAccessType = 169, - MappedType = 170, - LiteralType = 171, - ObjectBindingPattern = 172, - ArrayBindingPattern = 173, - BindingElement = 174, - ArrayLiteralExpression = 175, - ObjectLiteralExpression = 176, - PropertyAccessExpression = 177, - ElementAccessExpression = 178, - CallExpression = 179, - NewExpression = 180, - TaggedTemplateExpression = 181, - TypeAssertionExpression = 182, - ParenthesizedExpression = 183, - FunctionExpression = 184, - ArrowFunction = 185, - DeleteExpression = 186, - TypeOfExpression = 187, - VoidExpression = 188, - AwaitExpression = 189, - PrefixUnaryExpression = 190, - PostfixUnaryExpression = 191, - BinaryExpression = 192, - ConditionalExpression = 193, - TemplateExpression = 194, - YieldExpression = 195, - SpreadElement = 196, - ClassExpression = 197, - OmittedExpression = 198, - ExpressionWithTypeArguments = 199, - AsExpression = 200, - NonNullExpression = 201, - TemplateSpan = 202, - SemicolonClassElement = 203, - Block = 204, - VariableStatement = 205, - EmptyStatement = 206, - ExpressionStatement = 207, - IfStatement = 208, - DoStatement = 209, - WhileStatement = 210, - ForStatement = 211, - ForInStatement = 212, - ForOfStatement = 213, - ContinueStatement = 214, - BreakStatement = 215, - ReturnStatement = 216, - WithStatement = 217, - SwitchStatement = 218, - LabeledStatement = 219, - ThrowStatement = 220, - TryStatement = 221, - DebuggerStatement = 222, - VariableDeclaration = 223, - VariableDeclarationList = 224, - FunctionDeclaration = 225, - ClassDeclaration = 226, - InterfaceDeclaration = 227, - TypeAliasDeclaration = 228, - EnumDeclaration = 229, - ModuleDeclaration = 230, - ModuleBlock = 231, - CaseBlock = 232, - NamespaceExportDeclaration = 233, - ImportEqualsDeclaration = 234, - ImportDeclaration = 235, - ImportClause = 236, - NamespaceImport = 237, - NamedImports = 238, - ImportSpecifier = 239, - ExportAssignment = 240, - ExportDeclaration = 241, - NamedExports = 242, - ExportSpecifier = 243, - MissingDeclaration = 244, - ExternalModuleReference = 245, - JsxElement = 246, - JsxSelfClosingElement = 247, - JsxOpeningElement = 248, - JsxClosingElement = 249, - JsxAttribute = 250, - JsxSpreadAttribute = 251, - JsxExpression = 252, - CaseClause = 253, - DefaultClause = 254, - HeritageClause = 255, - CatchClause = 256, - PropertyAssignment = 257, - ShorthandPropertyAssignment = 258, - SpreadAssignment = 259, - EnumMember = 260, - SourceFile = 261, - JSDocTypeExpression = 262, - JSDocAllType = 263, - JSDocUnknownType = 264, - JSDocArrayType = 265, - JSDocUnionType = 266, - JSDocTupleType = 267, - JSDocNullableType = 268, - JSDocNonNullableType = 269, - JSDocRecordType = 270, - JSDocRecordMember = 271, - JSDocTypeReference = 272, - JSDocOptionalType = 273, - JSDocFunctionType = 274, - JSDocVariadicType = 275, - JSDocConstructorType = 276, - JSDocThisType = 277, - JSDocComment = 278, - JSDocTag = 279, - JSDocAugmentsTag = 280, - JSDocParameterTag = 281, - JSDocReturnTag = 282, - JSDocTypeTag = 283, - JSDocTemplateTag = 284, - JSDocTypedefTag = 285, - JSDocPropertyTag = 286, - JSDocTypeLiteral = 287, - JSDocLiteralType = 288, - JSDocNullKeyword = 289, - JSDocUndefinedKeyword = 290, - JSDocNeverKeyword = 291, - SyntaxList = 292, - NotEmittedStatement = 293, - PartiallyEmittedExpression = 294, - MergeDeclarationMarker = 295, - EndOfDeclarationMarker = 296, - RawExpression = 297, - Count = 298, - FirstAssignment = 57, - LastAssignment = 69, - FirstCompoundAssignment = 58, - LastCompoundAssignment = 69, - FirstReservedWord = 71, - LastReservedWord = 106, - FirstKeyword = 71, - LastKeyword = 140, - FirstFutureReservedWord = 107, - LastFutureReservedWord = 115, - FirstTypeNode = 156, - LastTypeNode = 171, - FirstPunctuation = 16, - LastPunctuation = 69, - FirstToken = 0, - LastToken = 140, - FirstTriviaToken = 2, - LastTriviaToken = 7, - FirstLiteralToken = 8, - LastLiteralToken = 12, - FirstTemplateToken = 12, - LastTemplateToken = 15, - FirstBinaryOperator = 26, - LastBinaryOperator = 69, - FirstNode = 141, - FirstJSDocNode = 262, - LastJSDocNode = 288, - FirstJSDocTagNode = 278, - LastJSDocTagNode = 291, + type NamedImportsOrExports = NamedImports | NamedExports; + interface ImportSpecifier extends Declaration { + kind: SyntaxKind.ImportSpecifier; + parent?: NamedImports; + propertyName?: Identifier; + name: Identifier; } - const enum NodeFlags { - None = 0, - Let = 1, - Const = 2, - NestedNamespace = 4, - Synthesized = 8, - Namespace = 16, - ExportContext = 32, - ContainsThis = 64, - HasImplicitReturn = 128, - HasExplicitReturn = 256, - GlobalAugmentation = 512, - HasClassExtends = 1024, - HasDecorators = 2048, - HasParamDecorators = 4096, - HasAsyncFunctions = 8192, - HasSpreadAttribute = 16384, - HasRestAttribute = 32768, - DisallowInContext = 65536, - YieldContext = 131072, - DecoratorContext = 262144, - AwaitContext = 524288, - ThisNodeHasError = 1048576, - JavaScriptFile = 2097152, - ThisNodeOrAnySubNodesHasError = 4194304, - HasAggregatedChildData = 8388608, - BlockScoped = 3, - ReachabilityCheckFlags = 384, - EmitHelperFlags = 64512, - ReachabilityAndEmitFlags = 64896, - ContextFlags = 3080192, - TypeExcludesFlags = 655360, + interface ExportSpecifier extends Declaration { + kind: SyntaxKind.ExportSpecifier; + parent?: NamedExports; + propertyName?: Identifier; + name: Identifier; } - const enum ModifierFlags { - None = 0, - Export = 1, - Ambient = 2, - Public = 4, - Private = 8, - Protected = 16, - Static = 32, - Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, - Const = 2048, - HasComputedFlags = 536870912, - AccessibilityModifier = 28, - ParameterPropertyModifier = 92, - NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 2270, - ExportDefault = 513, + type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; + interface ExportAssignment extends DeclarationStatement { + kind: SyntaxKind.ExportAssignment; + parent?: SourceFile; + isExportEquals?: boolean; + expression: Expression; } - const enum JsxFlags { - None = 0, - IntrinsicNamedElement = 1, - IntrinsicIndexedElement = 2, - IntrinsicElement = 3, + interface FileReference extends TextRange { + fileName: string; } - const enum RelationComparisonResult { - Succeeded = 1, - Failed = 2, - FailedAndReported = 3, + interface CheckJsDirective extends TextRange { + enabled: boolean; } - interface Node extends TextRange { - kind: SyntaxKind; - flags: NodeFlags; - modifierFlagsCache?: ModifierFlags; - transformFlags?: TransformFlags; - decorators?: NodeArray; - modifiers?: ModifiersArray; - id?: number; - parent?: Node; - original?: Node; - startsOnNewLine?: boolean; - jsDoc?: JSDoc[]; - jsDocCache?: (JSDoc | JSDocTag)[]; - symbol?: Symbol; - locals?: SymbolTable; - nextContainer?: Node; - localSymbol?: Symbol; - flowNode?: FlowNode; - emitNode?: EmitNode; + type CommentKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia; + interface CommentRange extends TextRange { + hasTrailingNewLine?: boolean; + kind: CommentKind; } - interface NodeArray extends Array, TextRange { - hasTrailingComma?: boolean; - transformFlags?: TransformFlags; + interface SynthesizedComment extends CommentRange { + text: string; + pos: -1; + end: -1; } - interface Token extends Node { - kind: TKind; + interface JSDocTypeExpression extends Node { + kind: SyntaxKind.JSDocTypeExpression; + type: JSDocType; } - type DotDotDotToken = Token; - type QuestionToken = Token; - type ColonToken = Token; - type EqualsToken = Token; - type AsteriskToken = Token; - type EqualsGreaterThanToken = Token; - type EndOfFileToken = Token; - type AtToken = Token; - type ReadonlyToken = Token; - type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; - type ModifiersArray = NodeArray; - const enum GeneratedIdentifierKind { - None = 0, - Auto = 1, - Loop = 2, - Unique = 3, - Node = 4, + interface JSDocType extends TypeNode { + _jsDocTypeBrand: any; } - interface Identifier extends PrimaryExpression { - kind: SyntaxKind.Identifier; - text: string; - originalKeywordKind?: SyntaxKind; - autoGenerateKind?: GeneratedIdentifierKind; - autoGenerateId?: number; - isInJSDocNamespace?: boolean; + interface JSDocAllType extends JSDocType { + kind: SyntaxKind.JSDocAllType; } - interface TransientIdentifier extends Identifier { - resolvedSymbol: Symbol; + interface JSDocUnknownType extends JSDocType { + kind: SyntaxKind.JSDocUnknownType; } - interface GeneratedIdentifier extends Identifier { - autoGenerateKind: GeneratedIdentifierKind.Auto | GeneratedIdentifierKind.Loop | GeneratedIdentifierKind.Unique | GeneratedIdentifierKind.Node; + interface JSDocArrayType extends JSDocType { + kind: SyntaxKind.JSDocArrayType; + elementType: JSDocType; } - interface QualifiedName extends Node { - kind: SyntaxKind.QualifiedName; - left: EntityName; - right: Identifier; + interface JSDocUnionType extends JSDocType { + kind: SyntaxKind.JSDocUnionType; + types: NodeArray; } - type EntityName = Identifier | QualifiedName; - type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName; - type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; - interface Declaration extends Node { - _declarationBrand: any; - name?: DeclarationName; + interface JSDocTupleType extends JSDocType { + kind: SyntaxKind.JSDocTupleType; + types: NodeArray; } - interface DeclarationStatement extends Declaration, Statement { - name?: Identifier | StringLiteral | NumericLiteral; + interface JSDocNonNullableType extends JSDocType { + kind: SyntaxKind.JSDocNonNullableType; + type: JSDocType; } - interface ComputedPropertyName extends Node { - kind: SyntaxKind.ComputedPropertyName; - expression: Expression; + interface JSDocNullableType extends JSDocType { + kind: SyntaxKind.JSDocNullableType; + type: JSDocType; } - interface Decorator extends Node { - kind: SyntaxKind.Decorator; - expression: LeftHandSideExpression; + interface JSDocRecordType extends JSDocType { + kind: SyntaxKind.JSDocRecordType; + literal: TypeLiteralNode; } - interface TypeParameterDeclaration extends Declaration { - kind: SyntaxKind.TypeParameter; - name: Identifier; - constraint?: TypeNode; - expression?: Expression; + interface JSDocTypeReference extends JSDocType { + kind: SyntaxKind.JSDocTypeReference; + name: EntityName; + typeArguments: NodeArray; } - interface SignatureDeclaration extends Declaration { - name?: PropertyName; - typeParameters?: NodeArray; + interface JSDocOptionalType extends JSDocType { + kind: SyntaxKind.JSDocOptionalType; + type: JSDocType; + } + interface JSDocFunctionType extends JSDocType, SignatureDeclaration { + kind: SyntaxKind.JSDocFunctionType; parameters: NodeArray; - type?: TypeNode; + type: JSDocType; } - interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { - kind: SyntaxKind.CallSignature; + interface JSDocVariadicType extends JSDocType { + kind: SyntaxKind.JSDocVariadicType; + type: JSDocType; } - interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { - kind: SyntaxKind.ConstructSignature; + interface JSDocConstructorType extends JSDocType { + kind: SyntaxKind.JSDocConstructorType; + type: JSDocType; } - type BindingName = Identifier | BindingPattern; - interface VariableDeclaration extends Declaration { - kind: SyntaxKind.VariableDeclaration; - parent?: VariableDeclarationList; - name: BindingName; - type?: TypeNode; - initializer?: Expression; + interface JSDocThisType extends JSDocType { + kind: SyntaxKind.JSDocThisType; + type: JSDocType; } - interface VariableDeclarationList extends Node { - kind: SyntaxKind.VariableDeclarationList; - declarations: NodeArray; + interface JSDocLiteralType extends JSDocType { + kind: SyntaxKind.JSDocLiteralType; + literal: LiteralTypeNode; } - interface ParameterDeclaration extends Declaration { - kind: SyntaxKind.Parameter; - dotDotDotToken?: DotDotDotToken; - name: BindingName; - questionToken?: QuestionToken; - type?: TypeNode; - initializer?: Expression; + type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; + interface JSDocRecordMember extends PropertySignature { + kind: SyntaxKind.JSDocRecordMember; + name: Identifier | StringLiteral | NumericLiteral; + type?: JSDocType; } - interface BindingElement extends Declaration { - kind: SyntaxKind.BindingElement; - propertyName?: PropertyName; - dotDotDotToken?: DotDotDotToken; - name: BindingName; - initializer?: Expression; + interface JSDoc extends Node { + kind: SyntaxKind.JSDocComment; + tags: NodeArray | undefined; + comment: string | undefined; } - interface PropertySignature extends TypeElement { - kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember; - name: PropertyName; - questionToken?: QuestionToken; - type?: TypeNode; - initializer?: Expression; + interface JSDocTag extends Node { + atToken: AtToken; + tagName: Identifier; + comment: string | undefined; } - interface PropertyDeclaration extends ClassElement { - kind: SyntaxKind.PropertyDeclaration; - questionToken?: QuestionToken; - name: PropertyName; - type?: TypeNode; - initializer?: Expression; + interface JSDocUnknownTag extends JSDocTag { + kind: SyntaxKind.JSDocTag; } - interface ObjectLiteralElement extends Declaration { - _objectLiteralBrandBrand: any; - name?: PropertyName; + interface JSDocAugmentsTag extends JSDocTag { + kind: SyntaxKind.JSDocAugmentsTag; + typeExpression: JSDocTypeExpression; } - type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment; - interface PropertyAssignment extends ObjectLiteralElement { - kind: SyntaxKind.PropertyAssignment; - name: PropertyName; - questionToken?: QuestionToken; - initializer: Expression; + interface JSDocTemplateTag extends JSDocTag { + kind: SyntaxKind.JSDocTemplateTag; + typeParameters: NodeArray; } - interface ShorthandPropertyAssignment extends ObjectLiteralElement { - kind: SyntaxKind.ShorthandPropertyAssignment; - name: Identifier; - questionToken?: QuestionToken; - equalsToken?: Token; - objectAssignmentInitializer?: Expression; + interface JSDocReturnTag extends JSDocTag { + kind: SyntaxKind.JSDocReturnTag; + typeExpression: JSDocTypeExpression; } - interface SpreadAssignment extends ObjectLiteralElement { - kind: SyntaxKind.SpreadAssignment; - expression: Expression; + interface JSDocTypeTag extends JSDocTag { + kind: SyntaxKind.JSDocTypeTag; + typeExpression: JSDocTypeExpression; } - interface VariableLikeDeclaration extends Declaration { - propertyName?: PropertyName; - dotDotDotToken?: DotDotDotToken; - name: DeclarationName; - questionToken?: QuestionToken; - type?: TypeNode; - initializer?: Expression; + interface JSDocTypedefTag extends JSDocTag, Declaration { + kind: SyntaxKind.JSDocTypedefTag; + fullName?: JSDocNamespaceDeclaration | Identifier; + name?: Identifier; + typeExpression?: JSDocTypeExpression; + jsDocTypeLiteral?: JSDocTypeLiteral; } - interface PropertyLikeDeclaration extends Declaration { - name: PropertyName; + interface JSDocPropertyTag extends JSDocTag, TypeElement { + kind: SyntaxKind.JSDocPropertyTag; + name: Identifier; + typeExpression: JSDocTypeExpression; } - interface ObjectBindingPattern extends Node { - kind: SyntaxKind.ObjectBindingPattern; - elements: NodeArray; + interface JSDocTypeLiteral extends JSDocType { + kind: SyntaxKind.JSDocTypeLiteral; + jsDocPropertyTags?: NodeArray; + jsDocTypeTag?: JSDocTypeTag; } - interface ArrayBindingPattern extends Node { - kind: SyntaxKind.ArrayBindingPattern; - elements: NodeArray; + interface JSDocParameterTag extends JSDocTag { + kind: SyntaxKind.JSDocParameterTag; + preParameterName?: Identifier; + typeExpression?: JSDocTypeExpression; + postParameterName?: Identifier; + parameterName: Identifier; + isBracketed: boolean; } - type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; - type ArrayBindingElement = BindingElement | OmittedExpression; - interface FunctionLikeDeclaration extends SignatureDeclaration { - _functionLikeDeclarationBrand: any; - asteriskToken?: AsteriskToken; - questionToken?: QuestionToken; - body?: Block | Expression; + const enum FlowFlags { + Unreachable = 1, + Start = 2, + BranchLabel = 4, + LoopLabel = 8, + Assignment = 16, + TrueCondition = 32, + FalseCondition = 64, + SwitchClause = 128, + ArrayMutation = 256, + Referenced = 512, + Shared = 1024, + PreFinally = 2048, + AfterFinally = 4096, + Label = 12, + Condition = 96, } - interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { - kind: SyntaxKind.FunctionDeclaration; - name?: Identifier; - body?: FunctionBody; + interface FlowLock { + locked?: boolean; } - interface MethodSignature extends SignatureDeclaration, TypeElement { - kind: SyntaxKind.MethodSignature; - name: PropertyName; + interface AfterFinallyFlow extends FlowNode, FlowLock { + antecedent: FlowNode; } - interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { - kind: SyntaxKind.MethodDeclaration; - name: PropertyName; - body?: FunctionBody; + interface PreFinallyFlow extends FlowNode { + antecedent: FlowNode; + lock: FlowLock; } - interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { - kind: SyntaxKind.Constructor; - body?: FunctionBody; + interface FlowNode { + flags: FlowFlags; + id?: number; } - interface SemicolonClassElement extends ClassElement { - kind: SyntaxKind.SemicolonClassElement; + interface FlowStart extends FlowNode { + container?: FunctionExpression | ArrowFunction | MethodDeclaration; } - interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { - kind: SyntaxKind.GetAccessor; - name: PropertyName; - body: FunctionBody; + interface FlowLabel extends FlowNode { + antecedents: FlowNode[]; } - interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { - kind: SyntaxKind.SetAccessor; - name: PropertyName; - body: FunctionBody; + interface FlowAssignment extends FlowNode { + node: Expression | VariableDeclaration | BindingElement; + antecedent: FlowNode; } - type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; - interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { - kind: SyntaxKind.IndexSignature; + interface FlowCondition extends FlowNode { + expression: Expression; + antecedent: FlowNode; } - interface TypeNode extends Node { - _typeNodeBrand: any; + interface FlowSwitchClause extends FlowNode { + switchStatement: SwitchStatement; + clauseStart: number; + clauseEnd: number; + antecedent: FlowNode; } - interface KeywordTypeNode extends TypeNode { - kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + interface FlowArrayMutation extends FlowNode { + node: CallExpression | BinaryExpression; + antecedent: FlowNode; } - interface ThisTypeNode extends TypeNode { - kind: SyntaxKind.ThisType; + type FlowType = Type | IncompleteType; + interface IncompleteType { + flags: TypeFlags; + type: Type; } - interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { - kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; + interface AmdDependency { + path: string; + name: string; } - interface FunctionTypeNode extends FunctionOrConstructorTypeNode { - kind: SyntaxKind.FunctionType; + interface SourceFile extends Declaration { + kind: SyntaxKind.SourceFile; + statements: NodeArray; + endOfFileToken: Token; + fileName: string; + text: string; + amdDependencies: AmdDependency[]; + moduleName: string; + referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; + languageVariant: LanguageVariant; + isDeclarationFile: boolean; + hasNoDefaultLib: boolean; + languageVersion: ScriptTarget; } - interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { - kind: SyntaxKind.ConstructorType; + interface Bundle extends Node { + kind: SyntaxKind.Bundle; + sourceFiles: SourceFile[]; } - interface TypeReferenceNode extends TypeNode { - kind: SyntaxKind.TypeReference; - typeName: EntityName; - typeArguments?: NodeArray; + interface ScriptReferenceHost { + getCompilerOptions(): CompilerOptions; + getSourceFile(fileName: string): SourceFile; + getSourceFileByPath(path: Path): SourceFile; + getCurrentDirectory(): string; } - interface TypePredicateNode extends TypeNode { - kind: SyntaxKind.TypePredicate; - parameterName: Identifier | ThisTypeNode; - type: TypeNode; + interface ParseConfigHost { + useCaseSensitiveFileNames: boolean; + readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[]; + fileExists(path: string): boolean; + readFile(path: string): string; } - interface TypeQueryNode extends TypeNode { - kind: SyntaxKind.TypeQuery; - exprName: EntityName; + interface WriteFileCallback { + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; } - interface TypeLiteralNode extends TypeNode, Declaration { - kind: SyntaxKind.TypeLiteral; - members: NodeArray; + class OperationCanceledException { } - interface ArrayTypeNode extends TypeNode { - kind: SyntaxKind.ArrayType; - elementType: TypeNode; + interface CancellationToken { + isCancellationRequested(): boolean; + throwIfCancellationRequested(): void; } - interface TupleTypeNode extends TypeNode { - kind: SyntaxKind.TupleType; - elementTypes: NodeArray; + interface Program extends ScriptReferenceHost { + getRootFileNames(): string[]; + getSourceFiles(): SourceFile[]; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; + getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; + getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + getTypeChecker(): TypeChecker; } - interface UnionOrIntersectionTypeNode extends TypeNode { - kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType; - types: NodeArray; + interface CustomTransformers { + before?: TransformerFactory[]; + after?: TransformerFactory[]; } - interface UnionTypeNode extends UnionOrIntersectionTypeNode { - kind: SyntaxKind.UnionType; + interface SourceMapSpan { + emittedLine: number; + emittedColumn: number; + sourceLine: number; + sourceColumn: number; + nameIndex?: number; + sourceIndex: number; } - interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { - kind: SyntaxKind.IntersectionType; - } - interface ParenthesizedTypeNode extends TypeNode { - kind: SyntaxKind.ParenthesizedType; - type: TypeNode; - } - interface TypeOperatorNode extends TypeNode { - kind: SyntaxKind.TypeOperator; - operator: SyntaxKind.KeyOfKeyword; - type: TypeNode; - } - interface IndexedAccessTypeNode extends TypeNode { - kind: SyntaxKind.IndexedAccessType; - objectType: TypeNode; - indexType: TypeNode; - } - interface MappedTypeNode extends TypeNode, Declaration { - kind: SyntaxKind.MappedType; - readonlyToken?: ReadonlyToken; - typeParameter: TypeParameterDeclaration; - questionToken?: QuestionToken; - type?: TypeNode; - } - interface LiteralTypeNode extends TypeNode { - kind: SyntaxKind.LiteralType; - literal: Expression; - } - interface StringLiteral extends LiteralExpression { - kind: SyntaxKind.StringLiteral; - textSourceNode?: Identifier | StringLiteral | NumericLiteral; - } - interface Expression extends Node { - _expressionBrand: any; - contextualType?: Type; - } - interface OmittedExpression extends Expression { - kind: SyntaxKind.OmittedExpression; - } - interface PartiallyEmittedExpression extends LeftHandSideExpression { - kind: SyntaxKind.PartiallyEmittedExpression; - expression: Expression; - } - interface UnaryExpression extends Expression { - _unaryExpressionBrand: any; + interface SourceMapData { + sourceMapFilePath: string; + jsSourceMappingURL: string; + sourceMapFile: string; + sourceMapSourceRoot: string; + sourceMapSources: string[]; + sourceMapSourcesContent?: string[]; + inputSourceFileNames: string[]; + sourceMapNames?: string[]; + sourceMapMappings: string; + sourceMapDecodedMappings: SourceMapSpan[]; } - interface IncrementExpression extends UnaryExpression { - _incrementExpressionBrand: any; + enum ExitStatus { + Success = 0, + DiagnosticsPresent_OutputsSkipped = 1, + DiagnosticsPresent_OutputsGenerated = 2, } - type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken; - interface PrefixUnaryExpression extends IncrementExpression { - kind: SyntaxKind.PrefixUnaryExpression; - operator: PrefixUnaryOperator; - operand: UnaryExpression; + interface EmitResult { + emitSkipped: boolean; + diagnostics: Diagnostic[]; + emittedFiles: string[]; } - type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken; - interface PostfixUnaryExpression extends IncrementExpression { - kind: SyntaxKind.PostfixUnaryExpression; - operand: LeftHandSideExpression; - operator: PostfixUnaryOperator; + interface TypeChecker { + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; + getDeclaredTypeOfSymbol(symbol: Symbol): Type; + getPropertiesOfType(type: Type): Symbol[]; + getPropertyOfType(type: Type, propertyName: string): Symbol; + getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; + getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getBaseTypes(type: InterfaceType): BaseType[]; + getBaseTypeOfLiteralType(type: Type): Type; + getWidenedType(type: Type): Type; + getReturnTypeOfSignature(signature: Signature): Type; + getNonNullableType(type: Type): Type; + typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode; + signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration; + indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration; + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; + getSymbolAtLocation(node: Node): Symbol; + getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; + getShorthandAssignmentValueSymbol(location: Node): Symbol; + getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; + getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; + getTypeAtLocation(node: Node): Type; + getTypeFromTypeNode(node: TypeNode): Type; + signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + getSymbolDisplayBuilder(): SymbolDisplayBuilder; + getFullyQualifiedName(symbol: Symbol): string; + getAugmentedPropertiesOfType(type: Type): Symbol[]; + getRootSymbols(symbol: Symbol): Symbol[]; + getContextualType(node: Expression): Type; + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + isUndefinedSymbol(symbol: Symbol): boolean; + isArgumentsSymbol(symbol: Symbol): boolean; + isUnknownSymbol(symbol: Symbol): boolean; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + getAliasedSymbol(symbol: Symbol): Symbol; + getExportsOfModule(moduleSymbol: Symbol): Symbol[]; + getAllAttributesTypeFromJsxOpeningLikeElement(elementNode: JsxOpeningLikeElement): Type; + getJsxIntrinsicTagNames(): Symbol[]; + isOptionalParameter(node: ParameterDeclaration): boolean; + getAmbientModules(): Symbol[]; + tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; + getApparentType(type: Type): Type; } - interface LeftHandSideExpression extends IncrementExpression { - _leftHandSideExpressionBrand: any; + enum NodeBuilderFlags { + None = 0, + allowThisInObjectLiteral = 1, + allowQualifedNameInPlaceOfIdentifier = 2, + allowTypeParameterInQualifiedName = 4, + allowAnonymousIdentifier = 8, + allowEmptyUnionOrIntersection = 16, + allowEmptyTuple = 32, } - interface MemberExpression extends LeftHandSideExpression { - _memberExpressionBrand: any; + interface SymbolDisplayBuilder { + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; } - interface PrimaryExpression extends MemberExpression { - _primaryExpressionBrand: any; + interface SymbolWriter { + writeKeyword(text: string): void; + writeOperator(text: string): void; + writePunctuation(text: string): void; + writeSpace(text: string): void; + writeStringLiteral(text: string): void; + writeParameter(text: string): void; + writeProperty(text: string): void; + writeSymbol(text: string, symbol: Symbol): void; + writeLine(): void; + increaseIndent(): void; + decreaseIndent(): void; + clear(): void; + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + reportInaccessibleThisError(): void; + reportIllegalExtends(): void; } - interface NullLiteral extends PrimaryExpression { - kind: SyntaxKind.NullKeyword; + const enum TypeFormatFlags { + None = 0, + WriteArrayAsGenericType = 1, + UseTypeOfFunction = 2, + NoTruncation = 4, + WriteArrowStyleSignature = 8, + WriteOwnNameForAnyLike = 16, + WriteTypeArgumentsOfSignature = 32, + InElementType = 64, + UseFullyQualifiedType = 128, + InFirstTypeArgument = 256, + InTypeAlias = 512, + UseTypeAliasValue = 1024, + SuppressAnyReturnType = 2048, + AddUndefined = 4096, } - interface BooleanLiteral extends PrimaryExpression { - kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword; + const enum SymbolFormatFlags { + None = 0, + WriteTypeParametersOrArguments = 1, + UseOnlyExternalAliasing = 2, } - interface ThisExpression extends PrimaryExpression { - kind: SyntaxKind.ThisKeyword; + const enum TypePredicateKind { + This = 0, + Identifier = 1, } - interface SuperExpression extends PrimaryExpression { - kind: SyntaxKind.SuperKeyword; + interface TypePredicateBase { + kind: TypePredicateKind; + type: Type; } - interface DeleteExpression extends UnaryExpression { - kind: SyntaxKind.DeleteExpression; - expression: UnaryExpression; + interface ThisTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.This; } - interface TypeOfExpression extends UnaryExpression { - kind: SyntaxKind.TypeOfExpression; - expression: UnaryExpression; + interface IdentifierTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.Identifier; + parameterName: string; + parameterIndex: number; } - interface VoidExpression extends UnaryExpression { - kind: SyntaxKind.VoidExpression; - expression: UnaryExpression; + type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; + const enum SymbolFlags { + None = 0, + FunctionScopedVariable = 1, + BlockScopedVariable = 2, + Property = 4, + EnumMember = 8, + Function = 16, + Class = 32, + Interface = 64, + ConstEnum = 128, + RegularEnum = 256, + ValueModule = 512, + NamespaceModule = 1024, + TypeLiteral = 2048, + ObjectLiteral = 4096, + Method = 8192, + Constructor = 16384, + GetAccessor = 32768, + SetAccessor = 65536, + Signature = 131072, + TypeParameter = 262144, + TypeAlias = 524288, + ExportValue = 1048576, + ExportType = 2097152, + ExportNamespace = 4194304, + Alias = 8388608, + Prototype = 16777216, + ExportStar = 33554432, + Optional = 67108864, + Transient = 134217728, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 793064, + Namespace = 1920, + Module = 1536, + Accessor = 98304, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 0, + EnumMemberExcludes = 900095, + FunctionExcludes = 106927, + ClassExcludes = 899519, + InterfaceExcludes = 792968, + RegularEnumExcludes = 899327, + ConstEnumExcludes = 899967, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 530920, + TypeAliasExcludes = 793064, + AliasExcludes = 8388608, + ModuleMember = 8914931, + ExportHasLocal = 944, + HasExports = 1952, + HasMembers = 6240, + BlockScoped = 418, + PropertyOrAccessor = 98308, + Export = 7340032, + ClassMember = 106500, } - interface AwaitExpression extends UnaryExpression { - kind: SyntaxKind.AwaitExpression; - expression: UnaryExpression; + interface Symbol { + flags: SymbolFlags; + name: string; + declarations?: Declaration[]; + valueDeclaration?: Declaration; + members?: SymbolTable; + exports?: SymbolTable; + globalExports?: SymbolTable; } - interface YieldExpression extends Expression { - kind: SyntaxKind.YieldExpression; - asteriskToken?: AsteriskToken; - expression?: Expression; - } - type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken; - type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken; - type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator; - type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken; - type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator; - type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken; - type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator; - type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword; - type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator; - type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken; - type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator; - type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken; - type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator; - type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken; - type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator; - type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken; - type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; - type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator; - type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken; - type BinaryOperatorToken = Token; - interface BinaryExpression extends Expression, Declaration { - kind: SyntaxKind.BinaryExpression; - left: Expression; - operatorToken: BinaryOperatorToken; - right: Expression; + type SymbolTable = Map; + const enum TypeFlags { + Any = 1, + String = 2, + Number = 4, + Boolean = 8, + Enum = 16, + StringLiteral = 32, + NumberLiteral = 64, + BooleanLiteral = 128, + EnumLiteral = 256, + ESSymbol = 512, + Void = 1024, + Undefined = 2048, + Null = 4096, + Never = 8192, + TypeParameter = 16384, + Object = 32768, + Union = 65536, + Intersection = 131072, + Index = 262144, + IndexedAccess = 524288, + NonPrimitive = 16777216, + Literal = 480, + StringOrNumberLiteral = 96, + PossiblyFalsy = 7406, + StringLike = 262178, + NumberLike = 340, + BooleanLike = 136, + EnumLike = 272, + UnionOrIntersection = 196608, + StructuredType = 229376, + StructuredOrTypeVariable = 1032192, + TypeVariable = 540672, + Narrowable = 17810431, + NotUnionOrUnit = 16810497, } - type AssignmentOperatorToken = Token; - interface AssignmentExpression extends BinaryExpression { - left: LeftHandSideExpression; - operatorToken: TOperator; + type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; + interface Type { + flags: TypeFlags; + symbol?: Symbol; + pattern?: DestructuringPattern; + aliasSymbol?: Symbol; + aliasTypeArguments?: Type[]; } - interface ObjectDestructuringAssignment extends AssignmentExpression { - left: ObjectLiteralExpression; + interface LiteralType extends Type { + text: string; + freshType?: LiteralType; + regularType?: LiteralType; } - interface ArrayDestructuringAssignment extends AssignmentExpression { - left: ArrayLiteralExpression; + interface EnumType extends Type { + memberTypes: EnumLiteralType[]; } - type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment; - type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression | Identifier | PropertyAccessExpression | ElementAccessExpression; - type BindingOrAssignmentElementRestIndicator = DotDotDotToken | SpreadElement | SpreadAssignment; - type BindingOrAssignmentElementTarget = BindingOrAssignmentPattern | Expression; - type ObjectBindingOrAssignmentPattern = ObjectBindingPattern | ObjectLiteralExpression; - type ArrayBindingOrAssignmentPattern = ArrayBindingPattern | ArrayLiteralExpression; - type AssignmentPattern = ObjectLiteralExpression | ArrayLiteralExpression; - type BindingOrAssignmentPattern = ObjectBindingOrAssignmentPattern | ArrayBindingOrAssignmentPattern; - interface ConditionalExpression extends Expression { - kind: SyntaxKind.ConditionalExpression; - condition: Expression; - questionToken: QuestionToken; - whenTrue: Expression; - colonToken: ColonToken; - whenFalse: Expression; + interface EnumLiteralType extends LiteralType { + baseType: EnumType & UnionType; } - type FunctionBody = Block; - type ConciseBody = FunctionBody | Expression; - interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { - kind: SyntaxKind.FunctionExpression; - name?: Identifier; - body: FunctionBody; + const enum ObjectFlags { + Class = 1, + Interface = 2, + Reference = 4, + Tuple = 8, + Anonymous = 16, + Mapped = 32, + Instantiated = 64, + ObjectLiteral = 128, + EvolvingArray = 256, + ObjectLiteralPatternWithComputedProperties = 512, + ClassOrInterface = 3, } - interface ArrowFunction extends Expression, FunctionLikeDeclaration { - kind: SyntaxKind.ArrowFunction; - equalsGreaterThanToken: EqualsGreaterThanToken; - body: ConciseBody; + interface ObjectType extends Type { + objectFlags: ObjectFlags; } - interface LiteralLikeNode extends Node { - text: string; - isUnterminated?: boolean; - hasExtendedUnicodeEscape?: boolean; - isOctalLiteral?: boolean; + interface InterfaceType extends ObjectType { + typeParameters: TypeParameter[]; + outerTypeParameters: TypeParameter[]; + localTypeParameters: TypeParameter[]; + thisType: TypeParameter; } - interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { - _literalExpressionBrand: any; + type BaseType = ObjectType | IntersectionType; + interface InterfaceTypeWithDeclaredMembers extends InterfaceType { + declaredProperties: Symbol[]; + declaredCallSignatures: Signature[]; + declaredConstructSignatures: Signature[]; + declaredStringIndexInfo: IndexInfo; + declaredNumberIndexInfo: IndexInfo; } - interface RegularExpressionLiteral extends LiteralExpression { - kind: SyntaxKind.RegularExpressionLiteral; + interface TypeReference extends ObjectType { + target: GenericType; + typeArguments: Type[]; } - interface NoSubstitutionTemplateLiteral extends LiteralExpression { - kind: SyntaxKind.NoSubstitutionTemplateLiteral; + interface GenericType extends InterfaceType, TypeReference { } - interface NumericLiteral extends LiteralExpression { - kind: SyntaxKind.NumericLiteral; - trailingComment?: string; + interface UnionOrIntersectionType extends Type { + types: Type[]; } - interface TemplateHead extends LiteralLikeNode { - kind: SyntaxKind.TemplateHead; + interface UnionType extends UnionOrIntersectionType { } - interface TemplateMiddle extends LiteralLikeNode { - kind: SyntaxKind.TemplateMiddle; + interface IntersectionType extends UnionOrIntersectionType { } - interface TemplateTail extends LiteralLikeNode { - kind: SyntaxKind.TemplateTail; + type StructuredType = ObjectType | UnionType | IntersectionType; + interface EvolvingArrayType extends ObjectType { + elementType: Type; + finalArrayType?: Type; } - type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral; - interface TemplateExpression extends PrimaryExpression { - kind: SyntaxKind.TemplateExpression; - head: TemplateHead; - templateSpans: NodeArray; + interface TypeVariable extends Type { } - interface TemplateSpan extends Node { - kind: SyntaxKind.TemplateSpan; - expression: Expression; - literal: TemplateMiddle | TemplateTail; + interface TypeParameter extends TypeVariable { + constraint: Type; + default?: Type; } - interface ParenthesizedExpression extends PrimaryExpression { - kind: SyntaxKind.ParenthesizedExpression; - expression: Expression; + interface IndexedAccessType extends TypeVariable { + objectType: Type; + indexType: Type; + constraint?: Type; } - interface ArrayLiteralExpression extends PrimaryExpression { - kind: SyntaxKind.ArrayLiteralExpression; - elements: NodeArray; - multiLine?: boolean; + interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } - interface SpreadElement extends Expression { - kind: SyntaxKind.SpreadElement; - expression: Expression; + const enum SignatureKind { + Call = 0, + Construct = 1, } - interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration { - properties: NodeArray; + interface Signature { + declaration: SignatureDeclaration; + typeParameters: TypeParameter[]; + parameters: Symbol[]; } - interface ObjectLiteralExpression extends ObjectLiteralExpressionBase { - kind: SyntaxKind.ObjectLiteralExpression; - multiLine?: boolean; + const enum IndexKind { + String = 0, + Number = 1, } - type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; - type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; - interface PropertyAccessExpression extends MemberExpression, Declaration { - kind: SyntaxKind.PropertyAccessExpression; - expression: LeftHandSideExpression; - name: Identifier; + interface IndexInfo { + type: Type; + isReadonly: boolean; + declaration?: SignatureDeclaration; } - interface SuperPropertyAccessExpression extends PropertyAccessExpression { - expression: SuperExpression; + interface JsFileExtensionInfo { + extension: string; + isMixedContent: boolean; } - interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { - _propertyAccessExpressionLikeQualifiedNameBrand?: any; - expression: EntityNameExpression; + interface DiagnosticMessage { + key: string; + category: DiagnosticCategory; + code: number; + message: string; } - interface ElementAccessExpression extends MemberExpression { - kind: SyntaxKind.ElementAccessExpression; - expression: LeftHandSideExpression; - argumentExpression?: Expression; + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; } - interface SuperElementAccessExpression extends ElementAccessExpression { - expression: SuperExpression; + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string | DiagnosticMessageChain; + category: DiagnosticCategory; + code: number; } - type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression; - interface CallExpression extends LeftHandSideExpression, Declaration { - kind: SyntaxKind.CallExpression; - expression: LeftHandSideExpression; - typeArguments?: NodeArray; - arguments: NodeArray; + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, } - interface SuperCall extends CallExpression { - expression: SuperExpression; + enum ModuleResolutionKind { + Classic = 1, + NodeJs = 2, } - interface ExpressionWithTypeArguments extends TypeNode { - kind: SyntaxKind.ExpressionWithTypeArguments; - expression: LeftHandSideExpression; - typeArguments?: NodeArray; + interface PluginImport { + name: string; } - interface NewExpression extends PrimaryExpression, Declaration { - kind: SyntaxKind.NewExpression; - expression: LeftHandSideExpression; - typeArguments?: NodeArray; - arguments: NodeArray; - } - interface TaggedTemplateExpression extends MemberExpression { - kind: SyntaxKind.TaggedTemplateExpression; - tag: LeftHandSideExpression; - template: TemplateLiteral; - } - type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator; - interface AsExpression extends Expression { - kind: SyntaxKind.AsExpression; - expression: Expression; - type: TypeNode; - } - interface TypeAssertion extends UnaryExpression { - kind: SyntaxKind.TypeAssertionExpression; - type: TypeNode; - expression: UnaryExpression; - } - type AssertionExpression = TypeAssertion | AsExpression; - interface NonNullExpression extends LeftHandSideExpression { - kind: SyntaxKind.NonNullExpression; - expression: Expression; - } - interface JsxElement extends PrimaryExpression { - kind: SyntaxKind.JsxElement; - openingElement: JsxOpeningElement; - children: NodeArray; - closingElement: JsxClosingElement; - } - type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; - interface JsxOpeningElement extends Expression { - kind: SyntaxKind.JsxOpeningElement; - tagName: JsxTagNameExpression; - attributes: NodeArray; - } - interface JsxSelfClosingElement extends PrimaryExpression { - kind: SyntaxKind.JsxSelfClosingElement; - tagName: JsxTagNameExpression; - attributes: NodeArray; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[]; + interface CompilerOptions { + allowJs?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + alwaysStrict?: boolean; + baseUrl?: string; + charset?: string; + checkJs?: boolean; + declaration?: boolean; + declarationDir?: string; + disableSizeLimit?: boolean; + downlevelIteration?: boolean; + emitBOM?: boolean; + emitDecoratorMetadata?: boolean; + experimentalDecorators?: boolean; + forceConsistentCasingInFileNames?: boolean; + importHelpers?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; + isolatedModules?: boolean; + jsx?: JsxEmit; + lib?: string[]; + locale?: string; + mapRoot?: string; + maxNodeModuleJsDepth?: number; + module?: ModuleKind; + moduleResolution?: ModuleResolutionKind; + newLine?: NewLineKind; + noEmit?: boolean; + noEmitHelpers?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; + noImplicitAny?: boolean; + noImplicitReturns?: boolean; + noImplicitThis?: boolean; + noUnusedLocals?: boolean; + noUnusedParameters?: boolean; + noImplicitUseStrict?: boolean; + noLib?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + outFile?: string; + paths?: MapLike; + preserveConstEnums?: boolean; + project?: string; + reactNamespace?: string; + jsxFactory?: string; + removeComments?: boolean; + rootDir?: string; + rootDirs?: string[]; + skipLibCheck?: boolean; + skipDefaultLibCheck?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + strict?: boolean; + strictNullChecks?: boolean; + suppressExcessPropertyErrors?: boolean; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + traceResolution?: boolean; + types?: string[]; + typeRoots?: string[]; + [option: string]: CompilerOptionsValue | undefined; } - type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; - type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; - interface JsxAttribute extends Node { - kind: SyntaxKind.JsxAttribute; - name: Identifier; - initializer?: StringLiteral | JsxExpression; + interface TypeAcquisition { + enableAutoDiscovery?: boolean; + enable?: boolean; + include?: string[]; + exclude?: string[]; + [option: string]: string[] | boolean | undefined; } - interface JsxSpreadAttribute extends Node { - kind: SyntaxKind.JsxSpreadAttribute; - expression: Expression; + interface DiscoverTypingsInfo { + fileNames: string[]; + projectRootPath: string; + safeListPath: string; + packageNameToTypingLocation: Map; + typeAcquisition: TypeAcquisition; + compilerOptions: CompilerOptions; + unresolvedImports: ReadonlyArray; } - interface JsxClosingElement extends Node { - kind: SyntaxKind.JsxClosingElement; - tagName: JsxTagNameExpression; + enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + UMD = 3, + System = 4, + ES2015 = 5, } - interface JsxExpression extends Expression { - kind: SyntaxKind.JsxExpression; - expression?: Expression; + const enum JsxEmit { + None = 0, + Preserve = 1, + React = 2, + ReactNative = 3, } - interface JsxText extends Node { - kind: SyntaxKind.JsxText; + const enum NewLineKind { + CarriageReturnLineFeed = 0, + LineFeed = 1, } - type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; - interface Statement extends Node { - _statementBrand: any; + interface LineAndCharacter { + line: number; + character: number; } - interface NotEmittedStatement extends Statement { - kind: SyntaxKind.NotEmittedStatement; + const enum ScriptKind { + Unknown = 0, + JS = 1, + JSX = 2, + TS = 3, + TSX = 4, + External = 5, } - interface EndOfDeclarationMarker extends Statement { - kind: SyntaxKind.EndOfDeclarationMarker; + const enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES2015 = 2, + ES2016 = 3, + ES2017 = 4, + ESNext = 5, + Latest = 5, } - interface RawExpression extends PrimaryExpression { - kind: SyntaxKind.RawExpression; - text: string; + const enum LanguageVariant { + Standard = 0, + JSX = 1, } - interface MergeDeclarationMarker extends Statement { - kind: SyntaxKind.MergeDeclarationMarker; + interface ParsedCommandLine { + options: CompilerOptions; + typeAcquisition?: TypeAcquisition; + fileNames: string[]; + raw?: any; + errors: Diagnostic[]; + wildcardDirectories?: MapLike; + compileOnSave?: boolean; } - interface EmptyStatement extends Statement { - kind: SyntaxKind.EmptyStatement; + const enum WatchDirectoryFlags { + None = 0, + Recursive = 1, } - interface DebuggerStatement extends Statement { - kind: SyntaxKind.DebuggerStatement; + interface ExpandResult { + fileNames: string[]; + wildcardDirectories: MapLike; } - interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { - kind: SyntaxKind.MissingDeclaration; - name?: Identifier; + interface ModuleResolutionHost { + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + trace?(s: string): void; + directoryExists?(directoryName: string): boolean; + realpath?(path: string): string; + getCurrentDirectory?(): string; + getDirectories?(path: string): string[]; } - type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; - interface Block extends Statement { - kind: SyntaxKind.Block; - statements: NodeArray; - multiLine?: boolean; + interface ResolvedModule { + resolvedFileName: string; + isExternalLibraryImport?: boolean; } - interface VariableStatement extends Statement { - kind: SyntaxKind.VariableStatement; - declarationList: VariableDeclarationList; + interface ResolvedModuleFull extends ResolvedModule { + extension: Extension; } - interface ExpressionStatement extends Statement { - kind: SyntaxKind.ExpressionStatement; - expression: Expression; + enum Extension { + Ts = 0, + Tsx = 1, + Dts = 2, + Js = 3, + Jsx = 4, + LastTypeScriptExtension = 2, } - interface PrologueDirective extends ExpressionStatement { - expression: StringLiteral; + interface ResolvedModuleWithFailedLookupLocations { + resolvedModule: ResolvedModuleFull | undefined; } - interface IfStatement extends Statement { - kind: SyntaxKind.IfStatement; - expression: Expression; - thenStatement: Statement; - elseStatement?: Statement; + interface ResolvedTypeReferenceDirective { + primary: boolean; + resolvedFileName?: string; } - interface IterationStatement extends Statement { - statement: Statement; + interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; + failedLookupLocations: string[]; } - interface DoStatement extends IterationStatement { - kind: SyntaxKind.DoStatement; - expression: Expression; + interface CompilerHost extends ModuleResolutionHost { + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getCancellationToken?(): CancellationToken; + getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; + writeFile: WriteFileCallback; + getCurrentDirectory(): string; + getDirectories(path: string): string[]; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + getEnvironmentVariable?(name: string): string; } - interface WhileStatement extends IterationStatement { - kind: SyntaxKind.WhileStatement; - expression: Expression; + const enum EmitFlags { + SingleLine = 1, + AdviseOnEmitNode = 2, + NoSubstitution = 4, + CapturesThis = 8, + NoLeadingSourceMap = 16, + NoTrailingSourceMap = 32, + NoSourceMap = 48, + NoNestedSourceMaps = 64, + NoTokenLeadingSourceMaps = 128, + NoTokenTrailingSourceMaps = 256, + NoTokenSourceMaps = 384, + NoLeadingComments = 512, + NoTrailingComments = 1024, + NoComments = 1536, + NoNestedComments = 2048, + HelperName = 4096, + ExportName = 8192, + LocalName = 16384, + Indented = 32768, + NoIndentation = 65536, + AsyncFunctionBody = 131072, + ReuseTempVariableScope = 262144, + CustomPrologue = 524288, + NoHoisting = 1048576, + HasEndOfDeclarationMarker = 2097152, + Iterator = 4194304, } - type ForInitializer = VariableDeclarationList | Expression; - interface ForStatement extends IterationStatement { - kind: SyntaxKind.ForStatement; - initializer?: ForInitializer; - condition?: Expression; - incrementor?: Expression; + interface EmitHelper { + readonly name: string; + readonly scoped: boolean; + readonly text: string; + readonly priority?: number; } - interface ForInStatement extends IterationStatement { - kind: SyntaxKind.ForInStatement; - initializer: ForInitializer; - expression: Expression; + const enum EmitHint { + SourceFile = 0, + Expression = 1, + IdentifierName = 2, + Unspecified = 3, } - interface ForOfStatement extends IterationStatement { - kind: SyntaxKind.ForOfStatement; - initializer: ForInitializer; - expression: Expression; + interface TransformationContext { + getCompilerOptions(): CompilerOptions; + startLexicalEnvironment(): void; + suspendLexicalEnvironment(): void; + resumeLexicalEnvironment(): void; + endLexicalEnvironment(): Statement[]; + hoistFunctionDeclaration(node: FunctionDeclaration): void; + hoistVariableDeclaration(node: Identifier): void; + requestEmitHelper(helper: EmitHelper): void; + readEmitHelpers(): EmitHelper[] | undefined; + enableSubstitution(kind: SyntaxKind): void; + isSubstitutionEnabled(node: Node): boolean; + onSubstituteNode: (hint: EmitHint, node: Node) => Node; + enableEmitNotification(kind: SyntaxKind): void; + isEmitNotificationEnabled(node: Node): boolean; + onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; } - interface BreakStatement extends Statement { - kind: SyntaxKind.BreakStatement; - label?: Identifier; + interface TransformationResult { + transformed: T[]; + diagnostics?: Diagnostic[]; + substituteNode(hint: EmitHint, node: Node): Node; + emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + dispose(): void; } - interface ContinueStatement extends Statement { - kind: SyntaxKind.ContinueStatement; - label?: Identifier; + type TransformerFactory = (context: TransformationContext) => Transformer; + type Transformer = (node: T) => T; + type Visitor = (node: Node) => VisitResult; + type VisitResult = T | T[]; + interface Printer { + printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string; + printFile(sourceFile: SourceFile): string; + printBundle(bundle: Bundle): string; } - type BreakOrContinueStatement = BreakStatement | ContinueStatement; - interface ReturnStatement extends Statement { - kind: SyntaxKind.ReturnStatement; - expression?: Expression; + interface PrintHandlers { + hasGlobalName?(name: string): boolean; + onEmitNode?(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + substituteNode?(hint: EmitHint, node: Node): Node; } - interface WithStatement extends Statement { - kind: SyntaxKind.WithStatement; - expression: Expression; - statement: Statement; + interface PrinterOptions { + removeComments?: boolean; + newLine?: NewLineKind; } - interface SwitchStatement extends Statement { - kind: SyntaxKind.SwitchStatement; - expression: Expression; - caseBlock: CaseBlock; - possiblyExhaustive?: boolean; + interface TextSpan { + start: number; + length: number; } - interface CaseBlock extends Node { - kind: SyntaxKind.CaseBlock; - clauses: NodeArray; + interface TextChangeRange { + span: TextSpan; + newLength: number; } - interface CaseClause extends Node { - kind: SyntaxKind.CaseClause; - expression: Expression; - statements: NodeArray; + interface SyntaxList extends Node { + _children: Node[]; } - interface DefaultClause extends Node { - kind: SyntaxKind.DefaultClause; - statements: NodeArray; +} +declare namespace ts { + const version = "2.3.0-dev.20170419"; +} +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; +declare function clearTimeout(handle: any): void; +declare namespace ts { + type FileWatcherCallback = (fileName: string, removed?: boolean) => void; + type DirectoryWatcherCallback = (fileName: string) => void; + interface WatchedFile { + fileName: string; + callback: FileWatcherCallback; + mtime?: Date; } - type CaseOrDefaultClause = CaseClause | DefaultClause; - interface LabeledStatement extends Statement { - kind: SyntaxKind.LabeledStatement; - label: Identifier; - statement: Statement; + interface System { + args: string[]; + newLine: string; + useCaseSensitiveFileNames: boolean; + write(s: string): void; + readFile(path: string, encoding?: string): string; + getFileSize?(path: string): number; + writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; + watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; + watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; + resolvePath(path: string): string; + fileExists(path: string): boolean; + directoryExists(path: string): boolean; + createDirectory(path: string): void; + getExecutingFilePath(): string; + getCurrentDirectory(): string; + getDirectories(path: string): string[]; + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + getModifiedTime?(path: string): Date; + createHash?(data: string): string; + getMemoryUsage?(): number; + exit(exitCode?: number): void; + realpath?(path: string): string; + setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + clearTimeout?(timeoutId: any): void; } - interface ThrowStatement extends Statement { - kind: SyntaxKind.ThrowStatement; - expression: Expression; + interface FileWatcher { + close(): void; } - interface TryStatement extends Statement { - kind: SyntaxKind.TryStatement; - tryBlock: Block; - catchClause?: CatchClause; - finallyBlock?: Block; + interface DirectoryWatcher extends FileWatcher { + directoryName: string; + referenceCount: number; } - interface CatchClause extends Node { - kind: SyntaxKind.CatchClause; - variableDeclaration: VariableDeclaration; - block: Block; + function getNodeMajorVersion(): number; + let sys: System; +} +declare namespace ts { + interface ErrorCallback { + (message: DiagnosticMessage, length: number): void; } - type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; - interface ClassLikeDeclaration extends Declaration { - name?: Identifier; - typeParameters?: NodeArray; - heritageClauses?: NodeArray; - members: NodeArray; + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasExtendedUnicodeEscape(): boolean; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scanJsxIdentifier(): SyntaxKind; + scanJsxAttributeValue(): SyntaxKind; + reScanJsxToken(): SyntaxKind; + scanJsxToken(): SyntaxKind; + scanJSDocToken(): SyntaxKind; + scan(): SyntaxKind; + getText(): string; + setText(text: string, start?: number, length?: number): void; + setOnError(onError: ErrorCallback): void; + setScriptTarget(scriptTarget: ScriptTarget): void; + setLanguageVariant(variant: LanguageVariant): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + scanRange(start: number, length: number, callback: () => T): T; + tryScan(callback: () => T): T; } - interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { - kind: SyntaxKind.ClassDeclaration; - name?: Identifier; + function tokenToString(t: SyntaxKind): string; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function isWhiteSpace(ch: number): boolean; + function isWhiteSpaceSingleLine(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function couldStartTrivia(text: string, pos: number): boolean; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getShebang(text: string): string; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; +} +declare namespace ts { + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; + function readConfigFile(fileName: string, readFile: (path: string) => string): { + config?: any; + error?: Diagnostic; + }; + function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments?: boolean): { + config?: any; + error?: Diagnostic; + }; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: JsFileExtensionInfo[]): ParsedCommandLine; + function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; + function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; + function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: TypeAcquisition; + errors: Diagnostic[]; + }; +} +declare namespace ts { + interface Push { + push(value: T): void; } - interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { - kind: SyntaxKind.ClassExpression; + function moduleHasNonRelativeName(moduleName: string): boolean; + function getEffectiveTypeRoots(options: CompilerOptions, host: { + directoryExists?: (directoryName: string) => boolean; + getCurrentDirectory?: () => string; + }): string[] | undefined; + function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; + function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; + interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; } - interface ClassElement extends Declaration { - _classElementBrand: any; - name?: PropertyName; + interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; } - interface TypeElement extends Declaration { - _typeElementBrand: any; - name?: PropertyName; - questionToken?: QuestionToken; + interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; } - interface InterfaceDeclaration extends DeclarationStatement { - kind: SyntaxKind.InterfaceDeclaration; - name: Identifier; - typeParameters?: NodeArray; - heritageClauses?: NodeArray; - members: NodeArray; - } - interface HeritageClause extends Node { - kind: SyntaxKind.HeritageClause; - token: SyntaxKind; - types?: NodeArray; - } - interface TypeAliasDeclaration extends DeclarationStatement { - kind: SyntaxKind.TypeAliasDeclaration; - name: Identifier; - typeParameters?: NodeArray; - type: TypeNode; - } - interface EnumMember extends Declaration { - kind: SyntaxKind.EnumMember; - name: PropertyName; - initializer?: Expression; - } - interface EnumDeclaration extends DeclarationStatement { - kind: SyntaxKind.EnumDeclaration; - name: Identifier; - members: NodeArray; + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; +} +declare namespace ts { + function getDefaultLibFileName(options: CompilerOptions): string; + function textSpanEnd(span: TextSpan): number; + function textSpanIsEmpty(span: TextSpan): boolean; + function textSpanContainsPosition(span: TextSpan, position: number): boolean; + function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean; + function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean; + function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan; + function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean; + function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean; + function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean; + function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean; + function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan; + function createTextSpan(start: number, length: number): TextSpan; + function createTextSpanFromBounds(start: number, end: number): TextSpan; + function textChangeRangeNewSpan(range: TextChangeRange): TextSpan; + function textChangeRangeIsUnchanged(range: TextChangeRange): boolean; + function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange; + let unchangedTextChangeRange: TextChangeRange; + function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; + function getTypeParameterOwner(d: Declaration): Declaration; + function isParameterPropertyDeclaration(node: Node): boolean; + function getCombinedModifierFlags(node: Node): ModifierFlags; + function getCombinedNodeFlags(node: Node): NodeFlags; + function validateLocaleAndSetLanguage(locale: string, sys: { + getExecutingFilePath(): string; + resolvePath(path: string): string; + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + }, errors?: Diagnostic[]): void; + function getOriginalNode(node: Node): Node; + function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; + function isParseTreeNode(node: Node): boolean; + function getParseTreeNode(node: Node): Node; + function getParseTreeNode(node: Node, nodeTest?: (node: Node) => node is T): T; + function unescapeIdentifier(identifier: string): string; +} +declare namespace ts { + function createNodeArray(elements?: T[], hasTrailingComma?: boolean): NodeArray; + function createLiteral(value: string): StringLiteral; + function createLiteral(value: number): NumericLiteral; + function createLiteral(value: boolean): BooleanLiteral; + function createLiteral(sourceNode: StringLiteral | NumericLiteral | Identifier): StringLiteral; + function createLiteral(value: string | number | boolean): PrimaryExpression; + function createNumericLiteral(value: string): NumericLiteral; + function createIdentifier(text: string): Identifier; + function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined): Identifier; + function createLoopVariable(): Identifier; + function createUniqueName(text: string): Identifier; + function getGeneratedNameForNode(node: Node): Identifier; + function createToken(token: TKind): Token; + function createSuper(): SuperExpression; + function createThis(): ThisExpression & Token; + function createNull(): NullLiteral & Token; + function createTrue(): BooleanLiteral & Token; + function createFalse(): BooleanLiteral & Token; + function createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName; + function updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName; + function createComputedPropertyName(expression: Expression): ComputedPropertyName; + function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; + function createSignatureDeclaration(kind: SyntaxKind, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): SignatureDeclaration; + function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; + function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function updateCallSignatureDeclaration(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; + function createMethodSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined): MethodSignature; + function updateMethodSignature(node: MethodSignature, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined, name: PropertyName, questionToken: QuestionToken | undefined): MethodSignature; + function createKeywordTypeNode(kind: KeywordTypeNode["kind"]): KeywordTypeNode; + function createThisTypeNode(): ThisTypeNode; + function createLiteralTypeNode(literal: Expression): LiteralTypeNode; + function updateLiteralTypeNode(node: LiteralTypeNode, literal: Expression): LiteralTypeNode; + function createTypeReferenceNode(typeName: string | EntityName, typeArguments: TypeNode[] | undefined): TypeReferenceNode; + function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; + function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode): TypePredicateNode; + function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; + function createTypeQueryNode(exprName: EntityName): TypeQueryNode; + function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; + function createArrayTypeNode(elementType: TypeNode): ArrayTypeNode; + function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType, types: TypeNode[]): UnionTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.IntersectionType, types: TypeNode[]): IntersectionTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: TypeNode[]): UnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node: UnionOrIntersectionTypeNode, types: NodeArray): UnionOrIntersectionTypeNode; + function createTypeLiteralNode(members: TypeElement[]): TypeLiteralNode; + function updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray): TypeLiteralNode; + function createTupleTypeNode(elementTypes: TypeNode[]): TupleTypeNode; + function updateTypleTypeNode(node: TupleTypeNode, elementTypes: TypeNode[]): TupleTypeNode; + function createMappedTypeNode(readonlyToken: ReadonlyToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | undefined, type: TypeNode | undefined): MappedTypeNode; + function updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | undefined, type: TypeNode | undefined): MappedTypeNode; + function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; + function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode; + function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; + function createTypeParameterDeclaration(name: string | Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; + function updateTypeParameterDeclaration(node: TypeParameterDeclaration, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; + function createPropertySignature(name: PropertyName | string, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature; + function updatePropertySignature(node: PropertySignature, name: PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature; + function createIndexSignatureDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node: IndexSignatureDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + function createParameter(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; + function updateParameter(node: ParameterDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration; + function createDecorator(expression: Expression): Decorator; + function updateDecorator(node: Decorator, expression: Expression): Decorator; + function createProperty(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression): PropertyDeclaration; + function updateProperty(node: PropertyDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, type: TypeNode | undefined, initializer: Expression): PropertyDeclaration; + function createMethodDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; + function updateMethod(node: MethodDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; + function createConstructor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + function createGetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; + function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; + function createSetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; + function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; + function createObjectBindingPattern(elements: BindingElement[]): ObjectBindingPattern; + function updateObjectBindingPattern(node: ObjectBindingPattern, elements: BindingElement[]): ObjectBindingPattern; + function createArrayBindingPattern(elements: ArrayBindingElement[]): ArrayBindingPattern; + function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern; + function createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression): BindingElement; + function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined): BindingElement; + function createArrayLiteral(elements?: Expression[], multiLine?: boolean): ArrayLiteralExpression; + function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression; + function createObjectLiteral(properties?: ObjectLiteralElementLike[], multiLine?: boolean): ObjectLiteralExpression; + function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElementLike[]): ObjectLiteralExpression; + function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression; + function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression; + function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression; + function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; + function createCall(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]): CallExpression; + function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]): CallExpression; + function createNew(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined): NewExpression; + function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined): NewExpression; + function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; + function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; + function createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion; + function updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion; + function createParen(expression: Expression): ParenthesizedExpression; + function updateParen(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression; + function createFunctionExpression(modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression; + function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression; + function createArrowFunction(modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody): ArrowFunction; + function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: ConciseBody): ArrowFunction; + function createDelete(expression: Expression): DeleteExpression; + function updateDelete(node: DeleteExpression, expression: Expression): DeleteExpression; + function createTypeOf(expression: Expression): TypeOfExpression; + function updateTypeOf(node: TypeOfExpression, expression: Expression): TypeOfExpression; + function createVoid(expression: Expression): VoidExpression; + function updateVoid(node: VoidExpression, expression: Expression): VoidExpression; + function createAwait(expression: Expression): AwaitExpression; + function updateAwait(node: AwaitExpression, expression: Expression): AwaitExpression; + function createPrefix(operator: PrefixUnaryOperator, operand: Expression): PrefixUnaryExpression; + function updatePrefix(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression; + function createPostfix(operand: Expression, operator: PostfixUnaryOperator): PostfixUnaryExpression; + function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; + function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression; + function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression; + function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; + function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression; + function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; + function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; + function updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; + function createYield(expression?: Expression): YieldExpression; + function createYield(asteriskToken: AsteriskToken, expression: Expression): YieldExpression; + function updateYield(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression): YieldExpression; + function createSpread(expression: Expression): SpreadElement; + function updateSpread(node: SpreadElement, expression: Expression): SpreadElement; + function createClassExpression(modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; + function updateClassExpression(node: ClassExpression, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; + function createOmittedExpression(): OmittedExpression; + function createExpressionWithTypeArguments(typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; + function updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; + function createAsExpression(expression: Expression, type: TypeNode): AsExpression; + function updateAsExpression(node: AsExpression, expression: Expression, type: TypeNode): AsExpression; + function createNonNullExpression(expression: Expression): NonNullExpression; + function updateNonNullExpression(node: NonNullExpression, expression: Expression): NonNullExpression; + function createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; + function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; + function createBlock(statements: Statement[], multiLine?: boolean): Block; + function updateBlock(node: Block, statements: Statement[]): Block; + function createVariableStatement(modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList | VariableDeclaration[]): VariableStatement; + function updateVariableStatement(node: VariableStatement, modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement; + function createVariableDeclarationList(declarations: VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList; + function updateVariableDeclarationList(node: VariableDeclarationList, declarations: VariableDeclaration[]): VariableDeclarationList; + function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression): VariableDeclaration; + function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration; + function createEmptyStatement(): EmptyStatement; + function createStatement(expression: Expression): ExpressionStatement; + function updateStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; + function createIf(expression: Expression, thenStatement: Statement, elseStatement?: Statement): IfStatement; + function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined): IfStatement; + function createDo(statement: Statement, expression: Expression): DoStatement; + function updateDo(node: DoStatement, statement: Statement, expression: Expression): DoStatement; + function createWhile(expression: Expression, statement: Statement): WhileStatement; + function updateWhile(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement; + function createFor(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; + function updateFor(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; + function createForIn(initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; + function updateForIn(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; + function createForOf(awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; + function updateForOf(node: ForOfStatement, awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; + function createContinue(label?: string | Identifier): ContinueStatement; + function updateContinue(node: ContinueStatement, label: Identifier | undefined): ContinueStatement; + function createBreak(label?: string | Identifier): BreakStatement; + function updateBreak(node: BreakStatement, label: Identifier | undefined): BreakStatement; + function createReturn(expression?: Expression): ReturnStatement; + function updateReturn(node: ReturnStatement, expression: Expression | undefined): ReturnStatement; + function createWith(expression: Expression, statement: Statement): WithStatement; + function updateWith(node: WithStatement, expression: Expression, statement: Statement): WithStatement; + function createSwitch(expression: Expression, caseBlock: CaseBlock): SwitchStatement; + function updateSwitch(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement; + function createLabel(label: string | Identifier, statement: Statement): LabeledStatement; + function updateLabel(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement; + function createThrow(expression: Expression): ThrowStatement; + function updateThrow(node: ThrowStatement, expression: Expression): ThrowStatement; + function createTry(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; + function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; + function createFunctionDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; + function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; + function createClassDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; + function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; + function createEnumDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, members: EnumMember[]): EnumDeclaration; + function updateEnumDeclaration(node: EnumDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, members: EnumMember[]): EnumDeclaration; + function createModuleDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; + function updateModuleDeclaration(node: ModuleDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; + function createModuleBlock(statements: Statement[]): ModuleBlock; + function updateModuleBlock(node: ModuleBlock, statements: Statement[]): ModuleBlock; + function createCaseBlock(clauses: CaseOrDefaultClause[]): CaseBlock; + function updateCaseBlock(node: CaseBlock, clauses: CaseOrDefaultClause[]): CaseBlock; + function createImportEqualsDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + function createImportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier?: Expression): ImportDeclaration; + function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression | undefined): ImportDeclaration; + function createImportClause(name: Identifier, namedBindings: NamedImportBindings): ImportClause; + function updateImportClause(node: ImportClause, name: Identifier, namedBindings: NamedImportBindings): ImportClause; + function createNamespaceImport(name: Identifier): NamespaceImport; + function updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; + function createNamedImports(elements: ImportSpecifier[]): NamedImports; + function updateNamedImports(node: NamedImports, elements: ImportSpecifier[]): NamedImports; + function createImportSpecifier(propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; + function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; + function createExportAssignment(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, isExportEquals: boolean, expression: Expression): ExportAssignment; + function updateExportAssignment(node: ExportAssignment, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, expression: Expression): ExportAssignment; + function createExportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier?: Expression): ExportDeclaration; + function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration; + function createNamedExports(elements: ExportSpecifier[]): NamedExports; + function updateNamedExports(node: NamedExports, elements: ExportSpecifier[]): NamedExports; + function createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; + function updateExportSpecifier(node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier; + function createExternalModuleReference(expression: Expression): ExternalModuleReference; + function updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference; + function createJsxElement(openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; + function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; + function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement; + function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement; + function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; + function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; + function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement; + function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; + function createJsxAttributes(properties: JsxAttributeLike[]): JsxAttributes; + function updateJsxAttributes(jsxAttributes: JsxAttributes, properties: JsxAttributeLike[]): JsxAttributes; + function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; + function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; + function createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute; + function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; + function createJsxExpression(dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined): JsxExpression; + function updateJsxExpression(node: JsxExpression, expression: Expression | undefined): JsxExpression; + function createHeritageClause(token: HeritageClause["token"], types: ExpressionWithTypeArguments[]): HeritageClause; + function updateHeritageClause(node: HeritageClause, types: ExpressionWithTypeArguments[]): HeritageClause; + function createCaseClause(expression: Expression, statements: Statement[]): CaseClause; + function updateCaseClause(node: CaseClause, expression: Expression, statements: Statement[]): CaseClause; + function createDefaultClause(statements: Statement[]): DefaultClause; + function updateDefaultClause(node: DefaultClause, statements: Statement[]): DefaultClause; + function createCatchClause(variableDeclaration: string | VariableDeclaration, block: Block): CatchClause; + function updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration, block: Block): CatchClause; + function createPropertyAssignment(name: string | PropertyName, initializer: Expression): PropertyAssignment; + function updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment; + function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression): ShorthandPropertyAssignment; + function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined): ShorthandPropertyAssignment; + function createSpreadAssignment(expression: Expression): SpreadAssignment; + function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; + function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; + function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; + function updateSourceFileNode(node: SourceFile, statements: Statement[]): SourceFile; + function getMutableClone(node: T): T; + function createNotEmittedStatement(original: Node): NotEmittedStatement; + function createPartiallyEmittedExpression(expression: Expression, original?: Node): PartiallyEmittedExpression; + function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; + function createBundle(sourceFiles: SourceFile[]): Bundle; + function updateBundle(node: Bundle, sourceFiles: SourceFile[]): Bundle; + function createComma(left: Expression, right: Expression): Expression; + function createLessThan(left: Expression, right: Expression): Expression; + function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; + function createAssignment(left: Expression, right: Expression): BinaryExpression; + function createStrictEquality(left: Expression, right: Expression): BinaryExpression; + function createStrictInequality(left: Expression, right: Expression): BinaryExpression; + function createAdd(left: Expression, right: Expression): BinaryExpression; + function createSubtract(left: Expression, right: Expression): BinaryExpression; + function createPostfixIncrement(operand: Expression): PostfixUnaryExpression; + function createLogicalAnd(left: Expression, right: Expression): BinaryExpression; + function createLogicalOr(left: Expression, right: Expression): BinaryExpression; + function createLogicalNot(operand: Expression): PrefixUnaryExpression; + function createVoidZero(): VoidExpression; + function createExportDefault(expression: Expression): ExportAssignment; + function createExternalModuleExport(exportName: Identifier): ExportDeclaration; + function disposeEmitNodes(sourceFile: SourceFile): void; + function setTextRange(range: T, location: TextRange | undefined): T; + function getEmitFlags(node: Node): EmitFlags | undefined; + function setEmitFlags(node: T, emitFlags: EmitFlags): T; + function getSourceMapRange(node: Node): TextRange; + function setSourceMapRange(node: T, range: TextRange | undefined): T; + function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange | undefined; + function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange | undefined): T; + function getCommentRange(node: Node): TextRange; + function setCommentRange(node: T, range: TextRange): T; + function getSyntheticLeadingComments(node: Node): SynthesizedComment[] | undefined; + function setSyntheticLeadingComments(node: T, comments: SynthesizedComment[]): T; + function addSyntheticLeadingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T; + function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined; + function setSyntheticTrailingComments(node: T, comments: SynthesizedComment[]): T; + function addSyntheticTrailingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T; + function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; + function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression; + function addEmitHelper(node: T, helper: EmitHelper): T; + function addEmitHelpers(node: T, helpers: EmitHelper[] | undefined): T; + function removeEmitHelper(node: Node, helper: EmitHelper): boolean; + function getEmitHelpers(node: Node): EmitHelper[] | undefined; + function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; + function setOriginalNode(node: T, original: Node | undefined): T; +} +declare namespace ts { + function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile; + function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName; + function isExternalModule(file: SourceFile): boolean; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; +} +declare namespace ts { + function visitNode(node: T, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T; + function visitNode(node: T | undefined, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T | undefined; + function visitNodes(nodes: NodeArray, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; + function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; + function visitLexicalEnvironment(statements: NodeArray, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray; + function visitParameterList(nodes: NodeArray, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes): NodeArray; + function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody; + function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined; + function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody; + function visitEachChild(node: T, visitor: Visitor, context: TransformationContext): T; + function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; +} +declare namespace ts { + function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer; +} +declare namespace ts { + function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; + function resolveTripleslashReference(moduleName: string, containingFile: string): string; + function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; + function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + interface FormatDiagnosticsHost { + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + getNewLine(): string; } - type ModuleBody = ModuleBlock | ModuleDeclaration; - type ModuleName = Identifier | StringLiteral; - interface ModuleDeclaration extends DeclarationStatement { - kind: SyntaxKind.ModuleDeclaration; - name: Identifier | StringLiteral; - body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier; + function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; +} +declare namespace ts { + interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFile): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; + forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; } - interface NamespaceDeclaration extends ModuleDeclaration { - name: Identifier; - body: ModuleBlock | NamespaceDeclaration; + interface Symbol { + getFlags(): SymbolFlags; + getName(): string; + getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } - interface JSDocNamespaceDeclaration extends ModuleDeclaration { - name: Identifier; - body: JSDocNamespaceDeclaration | Identifier; + interface Type { + getFlags(): TypeFlags; + getSymbol(): Symbol; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol; + getApparentProperties(): Symbol[]; + getCallSignatures(): Signature[]; + getConstructSignatures(): Signature[]; + getStringIndexType(): Type; + getNumberIndexType(): Type; + getBaseTypes(): BaseType[]; + getNonNullableType(): Type; } - interface ModuleBlock extends Node, Statement { - kind: SyntaxKind.ModuleBlock; - statements: NodeArray; + interface Signature { + getDeclaration(): SignatureDeclaration; + getTypeParameters(): TypeParameter[]; + getParameters(): Symbol[]; + getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } - type ModuleReference = EntityName | ExternalModuleReference; - interface ImportEqualsDeclaration extends DeclarationStatement { - kind: SyntaxKind.ImportEqualsDeclaration; - name: Identifier; - moduleReference: ModuleReference; + interface SourceFile { + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; + getLineStarts(): number[]; + getPositionOfLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; } - interface ExternalModuleReference extends Node { - kind: SyntaxKind.ExternalModuleReference; - expression?: Expression; + interface SourceFileLike { + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; } - interface ImportDeclaration extends Statement { - kind: SyntaxKind.ImportDeclaration; - importClause?: ImportClause; - moduleSpecifier: Expression; + interface IScriptSnapshot { + getText(start: number, end: number): string; + getLength(): number; + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; + dispose?(): void; } - type NamedImportBindings = NamespaceImport | NamedImports; - interface ImportClause extends Declaration { - kind: SyntaxKind.ImportClause; - name?: Identifier; - namedBindings?: NamedImportBindings; + namespace ScriptSnapshot { + function fromString(text: string): IScriptSnapshot; } - interface NamespaceImport extends Declaration { - kind: SyntaxKind.NamespaceImport; - name: Identifier; + interface PreProcessedFileInfo { + referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; + importedFiles: FileReference[]; + ambientExternalModules: string[]; + isLibFile: boolean; } - interface NamespaceExportDeclaration extends DeclarationStatement { - kind: SyntaxKind.NamespaceExportDeclaration; - name: Identifier; - moduleReference: LiteralLikeNode; + interface HostCancellationToken { + isCancellationRequested(): boolean; } - interface ExportDeclaration extends DeclarationStatement { - kind: SyntaxKind.ExportDeclaration; - exportClause?: NamedExports; - moduleSpecifier?: Expression; + interface LanguageServiceHost { + getCompilationSettings(): CompilerOptions; + getNewLine?(): string; + getProjectVersion?(): string; + getScriptFileNames(): string[]; + getScriptKind?(fileName: string): ScriptKind; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): HostCancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + log?(s: string): void; + trace?(s: string): void; + error?(s: string): void; + useCaseSensitiveFileNames?(): boolean; + readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + readFile?(path: string, encoding?: string): string; + fileExists?(path: string): boolean; + getTypeRootsVersion?(): number; + resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + directoryExists?(directoryName: string): boolean; + getDirectories?(directoryName: string): string[]; + getCustomTransformers?(): CustomTransformers | undefined; } - interface NamedImports extends Node { - kind: SyntaxKind.NamedImports; - elements: NodeArray; + interface LanguageService { + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; + getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; + getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[]; + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + findReferences(fileName: string, position: number): ReferencedSymbol[]; + getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[]; + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[]; + getNavigationBarItems(fileName: string): NavigationBarItem[]; + getNavigationTree(fileName: string): NavigationTree; + getOutliningSpans(fileName: string): OutliningSpan[]; + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; + isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[]; + getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; + getProgram(): Program; + dispose(): void; } - interface NamedExports extends Node { - kind: SyntaxKind.NamedExports; - elements: NodeArray; + interface Classifications { + spans: number[]; + endOfLineState: EndOfLineState; } - type NamedImportsOrExports = NamedImports | NamedExports; - interface ImportSpecifier extends Declaration { - kind: SyntaxKind.ImportSpecifier; - propertyName?: Identifier; - name: Identifier; + interface ClassifiedSpan { + textSpan: TextSpan; + classificationType: string; } - interface ExportSpecifier extends Declaration { - kind: SyntaxKind.ExportSpecifier; - propertyName?: Identifier; - name: Identifier; + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; } - type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; - interface ExportAssignment extends DeclarationStatement { - kind: SyntaxKind.ExportAssignment; - isExportEquals?: boolean; - expression: Expression; + interface NavigationTree { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems?: NavigationTree[]; } - interface FileReference extends TextRange { - fileName: string; + interface TodoCommentDescriptor { + text: string; + priority: number; } - interface CommentRange extends TextRange { - hasTrailingNewLine?: boolean; - kind: SyntaxKind; + interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; } - interface JSDocTypeExpression extends Node { - kind: SyntaxKind.JSDocTypeExpression; - type: JSDocType; + class TextChange { + span: TextSpan; + newText: string; } - interface JSDocType extends TypeNode { - _jsDocTypeBrand: any; + interface FileTextChanges { + fileName: string; + textChanges: TextChange[]; } - interface JSDocAllType extends JSDocType { - kind: SyntaxKind.JSDocAllType; + interface CodeAction { + description: string; + changes: FileTextChanges[]; } - interface JSDocUnknownType extends JSDocType { - kind: SyntaxKind.JSDocUnknownType; + interface TextInsertion { + newText: string; + caretOffset: number; } - interface JSDocArrayType extends JSDocType { - kind: SyntaxKind.JSDocArrayType; - elementType: JSDocType; + interface DocumentSpan { + textSpan: TextSpan; + fileName: string; } - interface JSDocUnionType extends JSDocType { - kind: SyntaxKind.JSDocUnionType; - types: NodeArray; + interface RenameLocation extends DocumentSpan { } - interface JSDocTupleType extends JSDocType { - kind: SyntaxKind.JSDocTupleType; - types: NodeArray; + interface ReferenceEntry extends DocumentSpan { + isWriteAccess: boolean; + isDefinition: boolean; + isInString?: true; } - interface JSDocNonNullableType extends JSDocType { - kind: SyntaxKind.JSDocNonNullableType; - type: JSDocType; + interface ImplementationLocation extends DocumentSpan { + kind: string; + displayParts: SymbolDisplayPart[]; } - interface JSDocNullableType extends JSDocType { - kind: SyntaxKind.JSDocNullableType; - type: JSDocType; + interface DocumentHighlights { + fileName: string; + highlightSpans: HighlightSpan[]; } - interface JSDocRecordType extends JSDocType { - kind: SyntaxKind.JSDocRecordType; - literal: TypeLiteralNode; + namespace HighlightSpanKind { + const none = "none"; + const definition = "definition"; + const reference = "reference"; + const writtenReference = "writtenReference"; } - interface JSDocTypeReference extends JSDocType { - kind: SyntaxKind.JSDocTypeReference; - name: EntityName; - typeArguments: NodeArray; + interface HighlightSpan { + fileName?: string; + isInString?: true; + textSpan: TextSpan; + kind: string; } - interface JSDocOptionalType extends JSDocType { - kind: SyntaxKind.JSDocOptionalType; - type: JSDocType; + interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; + isCaseSensitive: boolean; + fileName: string; + textSpan: TextSpan; + containerName: string; + containerKind: string; } - interface JSDocFunctionType extends JSDocType, SignatureDeclaration { - kind: SyntaxKind.JSDocFunctionType; - parameters: NodeArray; - type: JSDocType; + enum IndentStyle { + None = 0, + Block = 1, + Smart = 2, } - interface JSDocVariadicType extends JSDocType { - kind: SyntaxKind.JSDocVariadicType; - type: JSDocType; + interface EditorOptions { + BaseIndentSize?: number; + IndentSize: number; + TabSize: number; + NewLineCharacter: string; + ConvertTabsToSpaces: boolean; + IndentStyle: IndentStyle; } - interface JSDocConstructorType extends JSDocType { - kind: SyntaxKind.JSDocConstructorType; - type: JSDocType; + interface EditorSettings { + baseIndentSize?: number; + indentSize?: number; + tabSize?: number; + newLineCharacter?: string; + convertTabsToSpaces?: boolean; + indentStyle?: IndentStyle; } - interface JSDocThisType extends JSDocType { - kind: SyntaxKind.JSDocThisType; - type: JSDocType; + interface FormatCodeOptions extends EditorOptions { + InsertSpaceAfterCommaDelimiter: boolean; + InsertSpaceAfterSemicolonInForStatements: boolean; + InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; + InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; + InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; + PlaceOpenBraceOnNewLineForFunctions: boolean; + PlaceOpenBraceOnNewLineForControlBlocks: boolean; } - interface JSDocLiteralType extends JSDocType { - kind: SyntaxKind.JSDocLiteralType; - literal: LiteralTypeNode; + interface FormatCodeSettings extends EditorSettings { + insertSpaceAfterCommaDelimiter?: boolean; + insertSpaceAfterSemicolonInForStatements?: boolean; + insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; + insertSpaceAfterKeywordsInControlFlowStatements?: boolean; + insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; + placeOpenBraceOnNewLineForFunctions?: boolean; + placeOpenBraceOnNewLineForControlBlocks?: boolean; } - type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; - interface JSDocRecordMember extends PropertySignature { - kind: SyntaxKind.JSDocRecordMember; - name: Identifier | StringLiteral | NumericLiteral; - type?: JSDocType; - } - interface JSDoc extends Node { - kind: SyntaxKind.JSDocComment; - tags: NodeArray | undefined; - comment: string | undefined; - } - interface JSDocTag extends Node { - atToken: AtToken; - tagName: Identifier; - comment: string | undefined; - } - interface JSDocUnknownTag extends JSDocTag { - kind: SyntaxKind.JSDocTag; - } - interface JSDocAugmentsTag extends JSDocTag { - kind: SyntaxKind.JSDocAugmentsTag; - typeExpression: JSDocTypeExpression; + interface DefinitionInfo { + fileName: string; + textSpan: TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; } - interface JSDocTemplateTag extends JSDocTag { - kind: SyntaxKind.JSDocTemplateTag; - typeParameters: NodeArray; + interface ReferencedSymbolDefinitionInfo extends DefinitionInfo { + displayParts: SymbolDisplayPart[]; } - interface JSDocReturnTag extends JSDocTag { - kind: SyntaxKind.JSDocReturnTag; - typeExpression: JSDocTypeExpression; + interface ReferencedSymbol { + definition: ReferencedSymbolDefinitionInfo; + references: ReferenceEntry[]; } - interface JSDocTypeTag extends JSDocTag { - kind: SyntaxKind.JSDocTypeTag; - typeExpression: JSDocTypeExpression; + enum SymbolDisplayPartKind { + aliasName = 0, + className = 1, + enumName = 2, + fieldName = 3, + interfaceName = 4, + keyword = 5, + lineBreak = 6, + numericLiteral = 7, + stringLiteral = 8, + localName = 9, + methodName = 10, + moduleName = 11, + operator = 12, + parameterName = 13, + propertyName = 14, + punctuation = 15, + space = 16, + text = 17, + typeParameterName = 18, + enumMemberName = 19, + functionName = 20, + regularExpressionLiteral = 21, } - interface JSDocTypedefTag extends JSDocTag, Declaration { - kind: SyntaxKind.JSDocTypedefTag; - fullName?: JSDocNamespaceDeclaration | Identifier; - name?: Identifier; - typeExpression?: JSDocTypeExpression; - jsDocTypeLiteral?: JSDocTypeLiteral; + interface SymbolDisplayPart { + text: string; + kind: string; } - interface JSDocPropertyTag extends JSDocTag, TypeElement { - kind: SyntaxKind.JSDocPropertyTag; - name: Identifier; - typeExpression: JSDocTypeExpression; + interface JSDocTagInfo { + name: string; + text?: string; } - interface JSDocTypeLiteral extends JSDocType { - kind: SyntaxKind.JSDocTypeLiteral; - jsDocPropertyTags?: NodeArray; - jsDocTypeTag?: JSDocTypeTag; + interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } - interface JSDocParameterTag extends JSDocTag { - kind: SyntaxKind.JSDocParameterTag; - preParameterName?: Identifier; - typeExpression?: JSDocTypeExpression; - postParameterName?: Identifier; - parameterName: Identifier; - isBracketed: boolean; + interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TextSpan; } - const enum FlowFlags { - Unreachable = 1, - Start = 2, - BranchLabel = 4, - LoopLabel = 8, - Assignment = 16, - TrueCondition = 32, - FalseCondition = 64, - SwitchClause = 128, - ArrayMutation = 256, - Referenced = 512, - Shared = 1024, - Label = 12, - Condition = 96, + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; } - interface FlowNode { - flags: FlowFlags; - id?: number; + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } - interface FlowStart extends FlowNode { - container?: FunctionExpression | ArrowFunction | MethodDeclaration; + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; } - interface FlowLabel extends FlowNode { - antecedents: FlowNode[]; + interface CompletionInfo { + isGlobalCompletion: boolean; + isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; + entries: CompletionEntry[]; } - interface FlowAssignment extends FlowNode { - node: Expression | VariableDeclaration | BindingElement; - antecedent: FlowNode; + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + sortText: string; + replacementSpan?: TextSpan; } - interface FlowCondition extends FlowNode { - expression: Expression; - antecedent: FlowNode; + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } - interface FlowSwitchClause extends FlowNode { - switchStatement: SwitchStatement; - clauseStart: number; - clauseEnd: number; - antecedent: FlowNode; + interface OutliningSpan { + textSpan: TextSpan; + hintSpan: TextSpan; + bannerText: string; + autoCollapse: boolean; } - interface FlowArrayMutation extends FlowNode { - node: CallExpression | BinaryExpression; - antecedent: FlowNode; + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; } - type FlowType = Type | IncompleteType; - interface IncompleteType { - flags: TypeFlags; - type: Type; + const enum OutputFileType { + JavaScript = 0, + SourceMap = 1, + Declaration = 2, } - interface AmdDependency { - path: string; + interface OutputFile { name: string; - } - interface SourceFile extends Declaration { - kind: SyntaxKind.SourceFile; - statements: NodeArray; - endOfFileToken: Token; - fileName: string; - path: Path; + writeByteOrderMark: boolean; text: string; - amdDependencies: AmdDependency[]; - moduleName: string; - referencedFiles: FileReference[]; - typeReferenceDirectives: FileReference[]; - languageVariant: LanguageVariant; - isDeclarationFile: boolean; - renamedDependencies?: Map; - hasNoDefaultLib: boolean; - languageVersion: ScriptTarget; - scriptKind: ScriptKind; - externalModuleIndicator: Node; - commonJsModuleIndicator: Node; - identifiers: Map; - nodeCount: number; - identifierCount: number; - symbolCount: number; - parseDiagnostics: Diagnostic[]; - additionalSyntacticDiagnostics?: Diagnostic[]; - bindDiagnostics: Diagnostic[]; - lineMap: number[]; - classifiableNames?: Map; - resolvedModules: Map; - resolvedTypeReferenceDirectiveNames: Map; - imports: LiteralExpression[]; - moduleAugmentations: LiteralExpression[]; - patternAmbientModules?: PatternAmbientModule[]; - ambientModuleNames: string[]; } - interface ScriptReferenceHost { - getCompilerOptions(): CompilerOptions; - getSourceFile(fileName: string): SourceFile; - getSourceFileByPath(path: Path): SourceFile; - getCurrentDirectory(): string; + const enum EndOfLineState { + None = 0, + InMultiLineCommentTrivia = 1, + InSingleQuoteStringLiteral = 2, + InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } - interface ParseConfigHost { - useCaseSensitiveFileNames: boolean; - readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[]; - fileExists(path: string): boolean; - readFile(path: string): string; + enum TokenClass { + Punctuation = 0, + Keyword = 1, + Operator = 2, + Comment = 3, + Whitespace = 4, + Identifier = 5, + NumberLiteral = 6, + StringLiteral = 7, + RegExpLiteral = 8, } - interface WriteFileCallback { - (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; + interface ClassificationResult { + finalLexState: EndOfLineState; + entries: ClassificationInfo[]; } - class OperationCanceledException { + interface ClassificationInfo { + length: number; + classification: TokenClass; } - interface CancellationToken { - isCancellationRequested(): boolean; - throwIfCancellationRequested(): void; + interface Classifier { + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; + getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; } - interface Program extends ScriptReferenceHost { - getRootFileNames(): string[]; - getSourceFiles(): SourceFile[]; - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult; - getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; - getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; - getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - getTypeChecker(): TypeChecker; - getCommonSourceDirectory(): string; - getDiagnosticsProducingTypeChecker(): TypeChecker; - dropDiagnosticsProducingTypeChecker(): void; - getClassifiableNames(): Map; - getNodeCount(): number; - getIdentifierCount(): number; - getSymbolCount(): number; - getTypeCount(): number; - getFileProcessingDiagnostics(): DiagnosticCollection; - getResolvedTypeReferenceDirectives(): Map; - isSourceFileFromExternalLibrary(file: SourceFile): boolean; - structureIsReused?: boolean; - } - interface SourceMapSpan { - emittedLine: number; - emittedColumn: number; - sourceLine: number; - sourceColumn: number; - nameIndex?: number; - sourceIndex: number; + namespace ScriptElementKind { + const unknown = ""; + const warning = "warning"; + const keyword = "keyword"; + const scriptElement = "script"; + const moduleElement = "module"; + const classElement = "class"; + const localClassElement = "local class"; + const interfaceElement = "interface"; + const typeElement = "type"; + const enumElement = "enum"; + const enumMemberElement = "enum member"; + const variableElement = "var"; + const localVariableElement = "local var"; + const functionElement = "function"; + const localFunctionElement = "local function"; + const memberFunctionElement = "method"; + const memberGetAccessorElement = "getter"; + const memberSetAccessorElement = "setter"; + const memberVariableElement = "property"; + const constructorImplementationElement = "constructor"; + const callSignatureElement = "call"; + const indexSignatureElement = "index"; + const constructSignatureElement = "construct"; + const parameterElement = "parameter"; + const typeParameterElement = "type parameter"; + const primitiveType = "primitive type"; + const label = "label"; + const alias = "alias"; + const constElement = "const"; + const letElement = "let"; + const directory = "directory"; + const externalModuleName = "external module name"; + const jsxAttribute = "JSX attribute"; } - interface SourceMapData { - sourceMapFilePath: string; - jsSourceMappingURL: string; - sourceMapFile: string; - sourceMapSourceRoot: string; - sourceMapSources: string[]; - sourceMapSourcesContent?: string[]; - inputSourceFileNames: string[]; - sourceMapNames?: string[]; - sourceMapMappings: string; - sourceMapDecodedMappings: SourceMapSpan[]; + namespace ScriptElementKindModifier { + const none = ""; + const publicMemberModifier = "public"; + const privateMemberModifier = "private"; + const protectedMemberModifier = "protected"; + const exportedModifier = "export"; + const ambientModifier = "declare"; + const staticModifier = "static"; + const abstractModifier = "abstract"; } - enum ExitStatus { - Success = 0, - DiagnosticsPresent_OutputsSkipped = 1, - DiagnosticsPresent_OutputsGenerated = 2, + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAliasName: string; + static parameterName: string; + static docCommentTagName: string; + static jsxOpenTagName: string; + static jsxCloseTagName: string; + static jsxSelfClosingTagName: string; + static jsxAttribute: string; + static jsxText: string; + static jsxAttributeStringLiteralValue: string; } - interface EmitResult { - emitSkipped: boolean; - diagnostics: Diagnostic[]; - emittedFiles: string[]; - sourceMaps: SourceMapData[]; + const enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17, + docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, } - interface TypeCheckerHost { - getCompilerOptions(): CompilerOptions; - getSourceFiles(): SourceFile[]; - getSourceFile(fileName: string): SourceFile; - getResolvedTypeReferenceDirectives(): Map; +} +declare namespace ts { + function createClassifier(): Classifier; +} +declare namespace ts { + interface DocumentRegistry { + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; + getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; + reportStats(): string; } - interface TypeChecker { - getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; - getDeclaredTypeOfSymbol(symbol: Symbol): Type; - getPropertiesOfType(type: Type): Symbol[]; - getPropertyOfType(type: Type, propertyName: string): Symbol; - getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; - getIndexTypeOfType(type: Type, kind: IndexKind): Type; - getBaseTypes(type: InterfaceType): ObjectType[]; - getReturnTypeOfSignature(signature: Signature): Type; - getNonNullableType(type: Type): Type; - getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; - getSymbolAtLocation(node: Node): Symbol; - getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; - getShorthandAssignmentValueSymbol(location: Node): Symbol; - getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; - getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; - getTypeAtLocation(node: Node): Type; - typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; - symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; - getSymbolDisplayBuilder(): SymbolDisplayBuilder; - getFullyQualifiedName(symbol: Symbol): string; - getAugmentedPropertiesOfType(type: Type): Symbol[]; - getRootSymbols(symbol: Symbol): Symbol[]; - getContextualType(node: Expression): Type; - getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; - getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; - isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; - isUndefinedSymbol(symbol: Symbol): boolean; - isArgumentsSymbol(symbol: Symbol): boolean; - isUnknownSymbol(symbol: Symbol): boolean; - getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; - getAliasedSymbol(symbol: Symbol): Symbol; - getExportsOfModule(moduleSymbol: Symbol): Symbol[]; - getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; - getJsxIntrinsicTagNames(): Symbol[]; - isOptionalParameter(node: ParameterDeclaration): boolean; - getAmbientModules(): Symbol[]; - tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; - tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol; - getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; - getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver; - getNodeCount(): number; - getIdentifierCount(): number; - getSymbolCount(): number; - getTypeCount(): number; + type DocumentRegistryBucketKey = string & { + __bucketKey: any; + }; + function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; +} +declare namespace ts { + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; +} +declare namespace ts { + interface TranspileOptions { + compilerOptions?: CompilerOptions; + fileName?: string; + reportDiagnostics?: boolean; + moduleName?: string; + renamedDependencies?: MapLike; } - interface SymbolDisplayBuilder { - buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; - buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; - buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildDisplayForParametersAndDelimiters(thisParameter: Symbol, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + interface TranspileOutput { + outputText: string; + diagnostics?: Diagnostic[]; + sourceMapText?: string; } - interface SymbolWriter { - writeKeyword(text: string): void; - writeOperator(text: string): void; - writePunctuation(text: string): void; - writeSpace(text: string): void; - writeStringLiteral(text: string): void; - writeParameter(text: string): void; - writeSymbol(text: string, symbol: Symbol): void; - writeLine(): void; - increaseIndent(): void; - decreaseIndent(): void; - clear(): void; - trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; - reportInaccessibleThisError(): void; + function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; + function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; +} +declare namespace ts { + const servicesVersion = "0.5"; + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; } - const enum TypeFormatFlags { - None = 0, - WriteArrayAsGenericType = 1, - UseTypeOfFunction = 2, - NoTruncation = 4, - WriteArrowStyleSignature = 8, - WriteOwnNameForAnyLike = 16, - WriteTypeArgumentsOfSignature = 32, - InElementType = 64, - UseFullyQualifiedType = 128, - InFirstTypeArgument = 256, - InTypeAlias = 512, - UseTypeAliasValue = 1024, + function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; + function getDefaultCompilerOptions(): CompilerOptions; + function getSupportedCodeFixes(): string[]; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; + let disableIncrementalParsing: boolean; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function getDefaultLibFilePath(options: CompilerOptions): string; +} +declare namespace ts.server { + interface CompressedData { + length: number; + compressionKind: string; + data: any; + } + type RequireResult = { + module: {}; + error: undefined; + } | { + module: undefined; + error: {}; + }; + interface ServerHost extends System { + setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + clearTimeout(timeoutId: any): void; + setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; + clearImmediate(timeoutId: any): void; + gc?(): void; + trace?(s: string): void; + require?(initialPath: string, moduleName: string): RequireResult; + } + interface SortedReadonlyArray extends ReadonlyArray { + " __sortedReadonlyArrayBrand": any; + } + interface TypingInstallerRequest { + readonly projectName: string; + readonly kind: "discover" | "closeProject"; + } + interface DiscoverTypings extends TypingInstallerRequest { + readonly fileNames: string[]; + readonly projectRootPath: ts.Path; + readonly compilerOptions: ts.CompilerOptions; + readonly typeAcquisition: ts.TypeAcquisition; + readonly unresolvedImports: SortedReadonlyArray; + readonly cachePath?: string; + readonly kind: "discover"; + } + interface CloseProject extends TypingInstallerRequest { + readonly kind: "closeProject"; + } + type ActionSet = "action::set"; + type ActionInvalidate = "action::invalidate"; + type EventBeginInstallTypes = "event::beginInstallTypes"; + type EventEndInstallTypes = "event::endInstallTypes"; + type EventInitializationFailed = "event::initializationFailed"; + interface TypingInstallerResponse { + readonly kind: ActionSet | ActionInvalidate | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed; + } + interface InitializationFailedResponse extends TypingInstallerResponse { + readonly kind: EventInitializationFailed; + readonly message: string; + } + interface ProjectResponse extends TypingInstallerResponse { + readonly projectName: string; + } + interface SetTypings extends ProjectResponse { + readonly typeAcquisition: ts.TypeAcquisition; + readonly compilerOptions: ts.CompilerOptions; + readonly typings: string[]; + readonly unresolvedImports: SortedReadonlyArray; + readonly kind: ActionSet; + } + interface InvalidateCachedTypings extends ProjectResponse { + readonly kind: ActionInvalidate; + } + interface InstallTypes extends ProjectResponse { + readonly kind: EventBeginInstallTypes | EventEndInstallTypes; + readonly eventId: number; + readonly typingsInstallerVersion: string; + readonly packagesToInstall: ReadonlyArray; + } + interface BeginInstallTypes extends InstallTypes { + readonly kind: EventBeginInstallTypes; + } + interface EndInstallTypes extends InstallTypes { + readonly kind: EventEndInstallTypes; + readonly installSuccess: boolean; } - const enum SymbolFormatFlags { - None = 0, - WriteTypeParametersOrArguments = 1, - UseOnlyExternalAliasing = 2, +} +declare namespace ts.server { + const ActionSet: ActionSet; + const ActionInvalidate: ActionInvalidate; + const EventBeginInstallTypes: EventBeginInstallTypes; + const EventEndInstallTypes: EventEndInstallTypes; + const EventInitializationFailed: EventInitializationFailed; + namespace Arguments { + const GlobalCacheLocation = "--globalTypingsCacheLocation"; + const LogFile = "--logFile"; + const EnableTelemetry = "--enableTelemetry"; + const TypingSafeListLocation = "--typingSafeListLocation"; } - const enum SymbolAccessibility { - Accessible = 0, - NotAccessible = 1, - CannotBeNamed = 2, + function hasArgument(argumentName: string): boolean; + function findArgument(argumentName: string): string; +} +declare namespace ts.server { + enum LogLevel { + terse = 0, + normal = 1, + requestTime = 2, + verbose = 3, } - const enum SyntheticSymbolKind { - UnionOrIntersection = 0, - Spread = 1, + const emptyArray: ReadonlyArray; + interface Logger { + close(): void; + hasLevel(level: LogLevel): boolean; + loggingEnabled(): boolean; + perftrc(s: string): void; + info(s: string): void; + startGroup(): void; + endGroup(): void; + msg(s: string, type?: Msg.Types): void; + getLogFileName(): string; } - const enum TypePredicateKind { - This = 0, - Identifier = 1, + namespace Msg { + type Err = "Err"; + const Err: Err; + type Info = "Info"; + const Info: Info; + type Perf = "Perf"; + const Perf: Perf; + type Types = Err | Info | Perf; } - interface TypePredicateBase { - kind: TypePredicateKind; - type: Type; + function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings; + namespace Errors { + function ThrowNoProject(): never; + function ThrowProjectLanguageServiceDisabled(): never; + function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never; } - interface ThisTypePredicate extends TypePredicateBase { - kind: TypePredicateKind.This; + function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings; + function mergeMapLikes(target: MapLike, source: MapLike): void; + function removeItemFromSet(items: T[], itemToRemove: T): void; + type NormalizedPath = string & { + __normalizedPathTag: any; + }; + function toNormalizedPath(fileName: string): NormalizedPath; + function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path; + function asNormalizedPath(fileName: string): NormalizedPath; + interface NormalizedPathMap { + get(path: NormalizedPath): T; + set(path: NormalizedPath, value: T): void; + contains(path: NormalizedPath): boolean; + remove(path: NormalizedPath): void; } - interface IdentifierTypePredicate extends TypePredicateBase { - kind: TypePredicateKind.Identifier; - parameterName: string; - parameterIndex: number; + function createNormalizedPathMap(): NormalizedPathMap; + interface ProjectOptions { + configHasFilesProperty?: boolean; + files?: string[]; + wildcardDirectories?: Map; + compilerOptions?: CompilerOptions; + typeAcquisition?: TypeAcquisition; + compileOnSave?: boolean; } - type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; - type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; - interface SymbolVisibilityResult { - accessibility: SymbolAccessibility; - aliasesToMakeVisible?: AnyImportSyntax[]; - errorSymbolName?: string; - errorNode?: Node; + function isInferredProjectName(name: string): boolean; + function makeInferredProjectName(counter: number): string; + function toSortedReadonlyArray(arr: string[]): SortedReadonlyArray; + class ThrottledOperations { + private readonly host; + private pendingTimeouts; + constructor(host: ServerHost); + schedule(operationId: string, delay: number, cb: () => void): void; + private static run(self, operationId, cb); } - interface SymbolAccessibilityResult extends SymbolVisibilityResult { - errorModuleName?: string; + class GcTimer { + private readonly host; + private readonly delay; + private readonly logger; + private timerId; + constructor(host: ServerHost, delay: number, logger: Logger); + scheduleCollect(): void; + private static run(self); } - enum TypeReferenceSerializationKind { - Unknown = 0, - TypeWithConstructSignatureAndValue = 1, - VoidNullableOrNeverType = 2, - NumberLikeType = 3, - StringLikeType = 4, - BooleanType = 5, - ArrayLikeType = 6, - ESSymbolType = 7, - Promise = 8, - TypeWithCallSignature = 9, - ObjectType = 10, - } - interface EmitResolver { - hasGlobalName(name: string): boolean; - getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration; - getReferencedImportDeclaration(node: Identifier): Declaration; - getReferencedDeclarationWithCollidingName(node: Identifier): Declaration; - isDeclarationWithCollidingName(node: Declaration): boolean; - isValueAliasDeclaration(node: Node): boolean; - isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; - isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; - getNodeCheckFlags(node: Node): NodeCheckFlags; - isDeclarationVisible(node: Declaration): boolean; - collectLinkedAliases(node: Identifier): Node[]; - isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; - writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult; - isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult; - getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - getReferencedValueDeclaration(reference: Identifier): Declaration; - getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind; - isOptionalParameter(node: ParameterDeclaration): boolean; - moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; - isArgumentsLocalBinding(node: Identifier): boolean; - getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile; - getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[]; - getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[]; - isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean; - writeLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, writer: SymbolWriter): void; - getJsxFactoryEntity(): EntityName; +} +declare namespace ts.server.protocol { + namespace CommandTypes { + type Brace = "brace"; + type BraceCompletion = "braceCompletion"; + type Change = "change"; + type Close = "close"; + type Completions = "completions"; + type CompletionDetails = "completionEntryDetails"; + type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; + type CompileOnSaveEmitFile = "compileOnSaveEmitFile"; + type Configure = "configure"; + type Definition = "definition"; + type Implementation = "implementation"; + type Exit = "exit"; + type Format = "format"; + type Formatonkey = "formatonkey"; + type Geterr = "geterr"; + type GeterrForProject = "geterrForProject"; + type SemanticDiagnosticsSync = "semanticDiagnosticsSync"; + type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; + type NavBar = "navbar"; + type Navto = "navto"; + type NavTree = "navtree"; + type NavTreeFull = "navtree-full"; + type Occurrences = "occurrences"; + type DocumentHighlights = "documentHighlights"; + type Open = "open"; + type Quickinfo = "quickinfo"; + type References = "references"; + type Reload = "reload"; + type Rename = "rename"; + type Saveto = "saveto"; + type SignatureHelp = "signatureHelp"; + type TypeDefinition = "typeDefinition"; + type ProjectInfo = "projectInfo"; + type ReloadProjects = "reloadProjects"; + type Unknown = "unknown"; + type OpenExternalProject = "openExternalProject"; + type OpenExternalProjects = "openExternalProjects"; + type CloseExternalProject = "closeExternalProject"; + type TodoComments = "todoComments"; + type Indentation = "indentation"; + type DocCommentTemplate = "docCommentTemplate"; + type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; + type GetCodeFixes = "getCodeFixes"; + type GetSupportedCodeFixes = "getSupportedCodeFixes"; } - const enum SymbolFlags { - None = 0, - FunctionScopedVariable = 1, - BlockScopedVariable = 2, - Property = 4, - EnumMember = 8, - Function = 16, - Class = 32, - Interface = 64, - ConstEnum = 128, - RegularEnum = 256, - ValueModule = 512, - NamespaceModule = 1024, - TypeLiteral = 2048, - ObjectLiteral = 4096, - Method = 8192, - Constructor = 16384, - GetAccessor = 32768, - SetAccessor = 65536, - Signature = 131072, - TypeParameter = 262144, - TypeAlias = 524288, - ExportValue = 1048576, - ExportType = 2097152, - ExportNamespace = 4194304, - Alias = 8388608, - Instantiated = 16777216, - Merged = 33554432, - Transient = 67108864, - Prototype = 134217728, - SyntheticProperty = 268435456, - Optional = 536870912, - ExportStar = 1073741824, - Enum = 384, - Variable = 3, - Value = 107455, - Type = 793064, - Namespace = 1920, - Module = 1536, - Accessor = 98304, - FunctionScopedVariableExcludes = 107454, - BlockScopedVariableExcludes = 107455, - ParameterExcludes = 107455, - PropertyExcludes = 0, - EnumMemberExcludes = 900095, - FunctionExcludes = 106927, - ClassExcludes = 899519, - InterfaceExcludes = 792968, - RegularEnumExcludes = 899327, - ConstEnumExcludes = 899967, - ValueModuleExcludes = 106639, - NamespaceModuleExcludes = 0, - MethodExcludes = 99263, - GetAccessorExcludes = 41919, - SetAccessorExcludes = 74687, - TypeParameterExcludes = 530920, - TypeAliasExcludes = 793064, - AliasExcludes = 8388608, - ModuleMember = 8914931, - ExportHasLocal = 944, - HasExports = 1952, - HasMembers = 6240, - BlockScoped = 418, - PropertyOrAccessor = 98308, - Export = 7340032, - ClassMember = 106500, - Classifiable = 788448, + interface Message { + seq: number; + type: "request" | "response" | "event"; } - interface Symbol { - flags: SymbolFlags; - name: string; - declarations?: Declaration[]; - valueDeclaration?: Declaration; - members?: SymbolTable; - exports?: SymbolTable; - globalExports?: SymbolTable; - isReadonly?: boolean; - id?: number; - mergeId?: number; - parent?: Symbol; - exportSymbol?: Symbol; - constEnumOnlyModule?: boolean; - isReferenced?: boolean; - isReplaceableByMethod?: boolean; - isAssigned?: boolean; - } - interface SymbolLinks { - target?: Symbol; - type?: Type; - declaredType?: Type; - typeParameters?: TypeParameter[]; - inferredClassType?: Type; - instantiations?: Map; - mapper?: TypeMapper; - referenced?: boolean; - containingType?: UnionOrIntersectionType; - leftSpread?: Symbol; - rightSpread?: Symbol; - hasNonUniformType?: boolean; - isPartial?: boolean; - isDiscriminantProperty?: boolean; - resolvedExports?: SymbolTable; - exportsChecked?: boolean; - isDeclarationWithCollidingName?: boolean; - bindingElement?: BindingElement; - exportsSomeValue?: boolean; - } - interface TransientSymbol extends Symbol, SymbolLinks { + interface Request extends Message { + command: string; + arguments?: any; } - type SymbolTable = Map; - interface Pattern { - prefix: string; - suffix: string; - } - interface PatternAmbientModule { - pattern: Pattern; - symbol: Symbol; - } - const enum NodeCheckFlags { - TypeChecked = 1, - LexicalThis = 2, - CaptureThis = 4, - SuperInstance = 256, - SuperStatic = 512, - ContextChecked = 1024, - AsyncMethodWithSuper = 2048, - AsyncMethodWithSuperBinding = 4096, - CaptureArguments = 8192, - EnumValuesComputed = 16384, - LexicalModuleMergesWithClass = 32768, - LoopWithCapturedBlockScopedBinding = 65536, - CapturedBlockScopedBinding = 131072, - BlockScopedBindingInLoop = 262144, - ClassWithBodyScopedClassBinding = 524288, - BodyScopedClassBinding = 1048576, - NeedsLoopOutParameter = 2097152, - AssignmentsMarked = 4194304, - ClassWithConstructorReference = 8388608, - ConstructorReferenceInClass = 16777216, - } - interface NodeLinks { - flags?: NodeCheckFlags; - resolvedType?: Type; - resolvedSignature?: Signature; - resolvedSymbol?: Symbol; - resolvedIndexInfo?: IndexInfo; - maybeTypePredicate?: boolean; - enumMemberValue?: number; - isVisible?: boolean; - hasReportedStatementInAmbientContext?: boolean; - jsxFlags?: JsxFlags; - resolvedJsxType?: Type; - hasSuperCall?: boolean; - superCall?: ExpressionStatement; - switchTypes?: Type[]; + interface ReloadProjectsRequest extends Message { + command: CommandTypes.ReloadProjects; } - const enum TypeFlags { - Any = 1, - String = 2, - Number = 4, - Boolean = 8, - Enum = 16, - StringLiteral = 32, - NumberLiteral = 64, - BooleanLiteral = 128, - EnumLiteral = 256, - ESSymbol = 512, - Void = 1024, - Undefined = 2048, - Null = 4096, - Never = 8192, - TypeParameter = 16384, - Object = 32768, - Union = 65536, - Intersection = 131072, - Index = 262144, - IndexedAccess = 524288, - FreshLiteral = 1048576, - ContainsWideningType = 2097152, - ContainsObjectLiteral = 4194304, - ContainsAnyFunctionType = 8388608, - Nullable = 6144, - Literal = 480, - StringOrNumberLiteral = 96, - DefinitelyFalsy = 7392, - PossiblyFalsy = 7406, - Intrinsic = 16015, - Primitive = 8190, - StringLike = 262178, - NumberLike = 340, - BooleanLike = 136, - EnumLike = 272, - UnionOrIntersection = 196608, - StructuredType = 229376, - StructuredOrTypeParameter = 507904, - Narrowable = 1033215, - NotUnionOrUnit = 33281, - RequiresWidening = 6291456, - PropagatingFlags = 14680064, + interface Event extends Message { + event: string; + body?: any; } - type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; - interface Type { - flags: TypeFlags; - id: number; - symbol?: Symbol; - pattern?: DestructuringPattern; - aliasSymbol?: Symbol; - aliasTypeArguments?: Type[]; + interface Response extends Message { + request_seq: number; + success: boolean; + command: string; + message?: string; + body?: any; } - interface IntrinsicType extends Type { - intrinsicName: string; + interface FileRequestArgs { + file: string; + projectFileName?: string; } - interface LiteralType extends Type { - text: string; - freshType?: LiteralType; - regularType?: LiteralType; + interface DocCommentTemplateRequest extends FileLocationRequest { + command: CommandTypes.DocCommentTemplate; } - interface EnumType extends Type { - memberTypes: Map; + interface DocCommandTemplateResponse extends Response { + body?: TextInsertion; } - interface EnumLiteralType extends LiteralType { - baseType: EnumType & UnionType; + interface TodoCommentRequest extends FileRequest { + command: CommandTypes.TodoComments; + arguments: TodoCommentRequestArgs; } - const enum ObjectFlags { - Class = 1, - Interface = 2, - Reference = 4, - Tuple = 8, - Anonymous = 16, - Mapped = 32, - Instantiated = 64, - ObjectLiteral = 128, - EvolvingArray = 256, - ObjectLiteralPatternWithComputedProperties = 512, - ClassOrInterface = 3, + interface TodoCommentRequestArgs extends FileRequestArgs { + descriptors: TodoCommentDescriptor[]; } - interface ObjectType extends Type { - objectFlags: ObjectFlags; + interface TodoCommentsResponse extends Response { + body?: TodoComment[]; } - interface InterfaceType extends ObjectType { - typeParameters: TypeParameter[]; - outerTypeParameters: TypeParameter[]; - localTypeParameters: TypeParameter[]; - thisType: TypeParameter; - resolvedBaseConstructorType?: Type; - resolvedBaseTypes: ObjectType[]; + interface IndentationRequest extends FileLocationRequest { + command: CommandTypes.Indentation; + arguments: IndentationRequestArgs; } - interface InterfaceTypeWithDeclaredMembers extends InterfaceType { - declaredProperties: Symbol[]; - declaredCallSignatures: Signature[]; - declaredConstructSignatures: Signature[]; - declaredStringIndexInfo: IndexInfo; - declaredNumberIndexInfo: IndexInfo; + interface IndentationResponse extends Response { + body?: IndentationResult; } - interface TypeReference extends ObjectType { - target: GenericType; - typeArguments: Type[]; + interface IndentationResult { + position: number; + indentation: number; } - interface GenericType extends InterfaceType, TypeReference { - instantiations: Map; + interface IndentationRequestArgs extends FileLocationRequestArgs { + options?: EditorSettings; } - interface UnionOrIntersectionType extends Type { - types: Type[]; - resolvedProperties: SymbolTable; - couldContainTypeParameters: boolean; + interface ProjectInfoRequestArgs extends FileRequestArgs { + needFileNameList: boolean; } - interface UnionType extends UnionOrIntersectionType { + interface ProjectInfoRequest extends Request { + command: CommandTypes.ProjectInfo; + arguments: ProjectInfoRequestArgs; } - interface IntersectionType extends UnionOrIntersectionType { + interface CompilerOptionsDiagnosticsRequest extends Request { + arguments: CompilerOptionsDiagnosticsRequestArgs; } - type StructuredType = ObjectType | UnionType | IntersectionType; - interface AnonymousType extends ObjectType { - target?: AnonymousType; - mapper?: TypeMapper; + interface CompilerOptionsDiagnosticsRequestArgs { + projectFileName: string; } - interface MappedType extends ObjectType { - declaration: MappedTypeNode; - typeParameter?: TypeParameter; - constraintType?: Type; - templateType?: Type; - mapper?: TypeMapper; + interface ProjectInfo { + configFileName: string; + fileNames?: string[]; + languageServiceDisabled?: boolean; } - interface EvolvingArrayType extends ObjectType { - elementType: Type; - finalArrayType?: Type; + interface DiagnosticWithLinePosition { + message: string; + start: number; + length: number; + startLocation: Location; + endLocation: Location; + category: string; + code: number; } - interface ResolvedType extends ObjectType, UnionOrIntersectionType { - members: SymbolTable; - properties: Symbol[]; - callSignatures: Signature[]; - constructSignatures: Signature[]; - stringIndexInfo?: IndexInfo; - numberIndexInfo?: IndexInfo; + interface ProjectInfoResponse extends Response { + body?: ProjectInfo; } - interface FreshObjectLiteralType extends ResolvedType { - regularType: ResolvedType; + interface FileRequest extends Request { + arguments: FileRequestArgs; } - interface IterableOrIteratorType extends ObjectType, UnionType { - iterableElementType?: Type; - iteratorElementType?: Type; + interface FileLocationRequestArgs extends FileRequestArgs { + line: number; + offset: number; } - interface TypeParameter extends Type { - constraint: Type; - target?: TypeParameter; - mapper?: TypeMapper; - resolvedApparentType: Type; - resolvedIndexType: IndexType; - isThisType?: boolean; + interface CodeFixRequest extends Request { + command: CommandTypes.GetCodeFixes; + arguments: CodeFixRequestArgs; } - interface IndexType extends Type { - type: TypeParameter; + interface CodeFixRequestArgs extends FileRequestArgs { + startLine: number; + startOffset: number; + endLine: number; + endOffset: number; + errorCodes?: number[]; } - interface IndexedAccessType extends Type { - objectType: Type; - indexType: Type; + interface GetCodeFixesResponse extends Response { + body?: CodeAction[]; } - const enum SignatureKind { - Call = 0, - Construct = 1, + interface FileLocationRequest extends FileRequest { + arguments: FileLocationRequestArgs; } - interface Signature { - declaration: SignatureDeclaration; - typeParameters: TypeParameter[]; - parameters: Symbol[]; - thisParameter?: Symbol; - resolvedReturnType: Type; - minArgumentCount: number; - hasRestParameter: boolean; - hasLiteralTypes: boolean; - target?: Signature; - mapper?: TypeMapper; - unionSignatures?: Signature[]; - erasedSignatureCache?: Signature; - isolatedSignatureType?: ObjectType; - typePredicate?: TypePredicate; - instantiations?: Map; + interface GetSupportedCodeFixesRequest extends Request { + command: CommandTypes.GetSupportedCodeFixes; } - const enum IndexKind { - String = 0, - Number = 1, + interface GetSupportedCodeFixesResponse extends Response { + body?: string[]; } - interface IndexInfo { - type: Type; - isReadonly: boolean; - declaration?: SignatureDeclaration; + interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { + start: number; + length: number; } - interface TypeMapper { - (t: TypeParameter): Type; - mappedTypes?: Type[]; - instantiations?: Type[]; - context?: InferenceContext; - } - interface TypeInferences { - primary: Type[]; - secondary: Type[]; - topLevel: boolean; - isFixed: boolean; - } - interface InferenceContext { - signature: Signature; - inferUnionTypes: boolean; - inferences: TypeInferences[]; - inferredTypes: Type[]; - mapper?: TypeMapper; - failedTypeParameterIndex?: number; - } - const enum SpecialPropertyAssignmentKind { - None = 0, - ExportsProperty = 1, - ModuleExports = 2, - PrototypeProperty = 3, - ThisProperty = 4, + interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { + filesToSearch: string[]; } - interface DiagnosticMessage { - key: string; - category: DiagnosticCategory; - code: number; - message: string; + interface DefinitionRequest extends FileLocationRequest { + command: CommandTypes.Definition; } - interface DiagnosticMessageChain { - messageText: string; - category: DiagnosticCategory; - code: number; - next?: DiagnosticMessageChain; + interface TypeDefinitionRequest extends FileLocationRequest { + command: CommandTypes.TypeDefinition; } - interface Diagnostic { - file: SourceFile; - start: number; - length: number; - messageText: string | DiagnosticMessageChain; - category: DiagnosticCategory; - code: number; + interface ImplementationRequest extends FileLocationRequest { + command: CommandTypes.Implementation; } - enum DiagnosticCategory { - Warning = 0, - Error = 1, - Message = 2, + interface Location { + line: number; + offset: number; } - enum ModuleResolutionKind { - Classic = 1, - NodeJs = 2, + interface TextSpan { + start: Location; + end: Location; } - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike; - interface CompilerOptions { - allowJs?: boolean; - allowNonTsExtensions?: boolean; - allowSyntheticDefaultImports?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - alwaysStrict?: boolean; - baseUrl?: string; - charset?: string; - configFilePath?: string; - declaration?: boolean; - declarationDir?: string; - diagnostics?: boolean; - extendedDiagnostics?: boolean; - disableSizeLimit?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - help?: boolean; - importHelpers?: boolean; - init?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - isolatedModules?: boolean; - jsx?: JsxEmit; - lib?: string[]; - listEmittedFiles?: boolean; - listFiles?: boolean; - locale?: string; - mapRoot?: string; - maxNodeModuleJsDepth?: number; - module?: ModuleKind; - moduleResolution?: ModuleResolutionKind; - newLine?: NewLineKind; - noEmit?: boolean; - noEmitForJsFiles?: boolean; - noEmitHelpers?: boolean; - noEmitOnError?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitReturns?: boolean; - noImplicitThis?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noImplicitUseStrict?: boolean; - noLib?: boolean; - noResolve?: boolean; - out?: string; - outDir?: string; - outFile?: string; - paths?: MapLike; - preserveConstEnums?: boolean; - project?: string; - pretty?: DiagnosticStyle; - reactNamespace?: string; - jsxFactory?: string; - removeComments?: boolean; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - strictNullChecks?: boolean; - stripInternal?: boolean; - suppressExcessPropertyErrors?: boolean; - suppressImplicitAnyIndexErrors?: boolean; - suppressOutputPathCheck?: boolean; - target?: ScriptTarget; - traceResolution?: boolean; - types?: string[]; - typeRoots?: string[]; - version?: boolean; - watch?: boolean; - [option: string]: CompilerOptionsValue | undefined; + interface FileSpan extends TextSpan { + file: string; } - interface TypeAcquisition { - enableAutoDiscovery?: boolean; - enable?: boolean; - include?: string[]; - exclude?: string[]; - [option: string]: string[] | boolean | undefined; - } - interface DiscoverTypingsInfo { - fileNames: string[]; - projectRootPath: string; - safeListPath: string; - packageNameToTypingLocation: Map; - typeAcquisition: TypeAcquisition; - compilerOptions: CompilerOptions; - unresolvedImports: ReadonlyArray; - } - enum ModuleKind { - None = 0, - CommonJS = 1, - AMD = 2, - UMD = 3, - System = 4, - ES2015 = 5, - } - const enum JsxEmit { - None = 0, - Preserve = 1, - React = 2, - } - const enum NewLineKind { - CarriageReturnLineFeed = 0, - LineFeed = 1, - } - interface LineAndCharacter { - line: number; - character: number; - } - const enum ScriptKind { - Unknown = 0, - JS = 1, - JSX = 2, - TS = 3, - TSX = 4, - } - const enum ScriptTarget { - ES3 = 0, - ES5 = 1, - ES2015 = 2, - ES2016 = 3, - ES2017 = 4, - ESNext = 5, - Latest = 5, - } - const enum LanguageVariant { - Standard = 0, - JSX = 1, - } - const enum DiagnosticStyle { - Simple = 0, - Pretty = 1, - } - interface ParsedCommandLine { - options: CompilerOptions; - typeAcquisition?: TypeAcquisition; - fileNames: string[]; - raw?: any; - errors: Diagnostic[]; - wildcardDirectories?: MapLike; - compileOnSave?: boolean; - } - const enum WatchDirectoryFlags { - None = 0, - Recursive = 1, - } - interface ExpandResult { - fileNames: string[]; - wildcardDirectories: MapLike; - } - interface CommandLineOptionBase { - name: string; - type: "string" | "number" | "boolean" | "object" | "list" | Map; - isFilePath?: boolean; - shortName?: string; - description?: DiagnosticMessage; - paramType?: DiagnosticMessage; - experimental?: boolean; - isTSConfigOnly?: boolean; - } - interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase { - type: "string" | "number" | "boolean"; - } - interface CommandLineOptionOfCustomType extends CommandLineOptionBase { - type: Map; - } - interface TsConfigOnlyOption extends CommandLineOptionBase { - type: "object"; - } - interface CommandLineOptionOfListType extends CommandLineOptionBase { - type: "list"; - element: CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType; - } - type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption | CommandLineOptionOfListType; - const enum CharacterCodes { - nullCharacter = 0, - maxAsciiCharacter = 127, - lineFeed = 10, - carriageReturn = 13, - lineSeparator = 8232, - paragraphSeparator = 8233, - nextLine = 133, - space = 32, - nonBreakingSpace = 160, - enQuad = 8192, - emQuad = 8193, - enSpace = 8194, - emSpace = 8195, - threePerEmSpace = 8196, - fourPerEmSpace = 8197, - sixPerEmSpace = 8198, - figureSpace = 8199, - punctuationSpace = 8200, - thinSpace = 8201, - hairSpace = 8202, - zeroWidthSpace = 8203, - narrowNoBreakSpace = 8239, - ideographicSpace = 12288, - mathematicalSpace = 8287, - ogham = 5760, - _ = 95, - $ = 36, - _0 = 48, - _1 = 49, - _2 = 50, - _3 = 51, - _4 = 52, - _5 = 53, - _6 = 54, - _7 = 55, - _8 = 56, - _9 = 57, - 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, - 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, - ampersand = 38, - asterisk = 42, - at = 64, - backslash = 92, - backtick = 96, - bar = 124, - caret = 94, - closeBrace = 125, - closeBracket = 93, - closeParen = 41, - colon = 58, - comma = 44, - dot = 46, - doubleQuote = 34, - equals = 61, - exclamation = 33, - greaterThan = 62, - hash = 35, - lessThan = 60, - minus = 45, - openBrace = 123, - openBracket = 91, - openParen = 40, - percent = 37, - plus = 43, - question = 63, - semicolon = 59, - singleQuote = 39, - slash = 47, - tilde = 126, - backspace = 8, - formFeed = 12, - byteOrderMark = 65279, - tab = 9, - verticalTab = 11, - } - interface ModuleResolutionHost { - fileExists(fileName: string): boolean; - readFile(fileName: string): string; - trace?(s: string): void; - directoryExists?(directoryName: string): boolean; - realpath?(path: string): string; - getCurrentDirectory?(): string; - getDirectories?(path: string): string[]; - } - interface ResolvedModule { - resolvedFileName: string; - isExternalLibraryImport?: boolean; - } - interface ResolvedModuleFull extends ResolvedModule { - extension: Extension; - } - enum Extension { - Ts = 0, - Tsx = 1, - Dts = 2, - Js = 3, - Jsx = 4, - LastTypeScriptExtension = 2, - } - interface ResolvedModuleWithFailedLookupLocations { - resolvedModule: ResolvedModuleFull | undefined; - failedLookupLocations: string[]; - } - interface ResolvedTypeReferenceDirective { - primary: boolean; - resolvedFileName?: string; - } - interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { - resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; - failedLookupLocations: string[]; - } - interface CompilerHost extends ModuleResolutionHost { - getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getCancellationToken?(): CancellationToken; - getDefaultLibFileName(options: CompilerOptions): string; - getDefaultLibLocation?(): string; - writeFile: WriteFileCallback; - getCurrentDirectory(): string; - getDirectories(path: string): string[]; - getCanonicalFileName(fileName: string): string; - useCaseSensitiveFileNames(): boolean; - getNewLine(): string; - resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; - resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - getEnvironmentVariable?(name: string): string; - } - const enum TransformFlags { - None = 0, - TypeScript = 1, - ContainsTypeScript = 2, - ContainsJsx = 4, - ContainsESNext = 8, - ContainsES2017 = 16, - ContainsES2016 = 32, - ES2015 = 64, - ContainsES2015 = 128, - Generator = 256, - ContainsGenerator = 512, - DestructuringAssignment = 1024, - ContainsDestructuringAssignment = 2048, - ContainsDecorators = 4096, - ContainsPropertyInitializer = 8192, - ContainsLexicalThis = 16384, - ContainsCapturedLexicalThis = 32768, - ContainsLexicalThisInComputedPropertyName = 65536, - ContainsDefaultValueAssignments = 131072, - ContainsParameterPropertyAssignments = 262144, - ContainsSpread = 524288, - ContainsObjectSpread = 1048576, - ContainsRest = 524288, - ContainsObjectRest = 1048576, - ContainsComputedPropertyName = 2097152, - ContainsBlockScopedBinding = 4194304, - ContainsBindingPattern = 8388608, - ContainsYield = 16777216, - ContainsHoistedDeclarationOrCompletion = 33554432, - HasComputedFlags = 536870912, - AssertTypeScript = 3, - AssertJsx = 4, - AssertESNext = 8, - AssertES2017 = 16, - AssertES2016 = 32, - AssertES2015 = 192, - AssertGenerator = 768, - AssertDestructuringAssignment = 3072, - NodeExcludes = 536872257, - ArrowFunctionExcludes = 601249089, - FunctionExcludes = 601281857, - ConstructorExcludes = 601015617, - MethodOrAccessorExcludes = 601015617, - ClassExcludes = 539358529, - ModuleExcludes = 574674241, - TypeExcludes = -3, - ObjectLiteralExcludes = 540087617, - ArrayLiteralOrCallOrNewExcludes = 537396545, - VariableDeclarationListExcludes = 546309441, - ParameterExcludes = 536872257, - CatchClauseExcludes = 537920833, - BindingPatternExcludes = 537396545, - TypeScriptClassSyntaxMask = 274432, - ES2015FunctionSyntaxMask = 163840, - } - interface EmitNode { - annotatedNodes?: Node[]; - flags?: EmitFlags; - commentRange?: TextRange; - sourceMapRange?: TextRange; - tokenSourceMapRanges?: Map; - constantValue?: number; - externalHelpersModuleName?: Identifier; - helpers?: EmitHelper[]; - } - const enum EmitFlags { - SingleLine = 1, - AdviseOnEmitNode = 2, - NoSubstitution = 4, - CapturesThis = 8, - NoLeadingSourceMap = 16, - NoTrailingSourceMap = 32, - NoSourceMap = 48, - NoNestedSourceMaps = 64, - NoTokenLeadingSourceMaps = 128, - NoTokenTrailingSourceMaps = 256, - NoTokenSourceMaps = 384, - NoLeadingComments = 512, - NoTrailingComments = 1024, - NoComments = 1536, - NoNestedComments = 2048, - HelperName = 4096, - ExportName = 8192, - LocalName = 16384, - Indented = 32768, - NoIndentation = 65536, - AsyncFunctionBody = 131072, - ReuseTempVariableScope = 262144, - CustomPrologue = 524288, - NoHoisting = 1048576, - HasEndOfDeclarationMarker = 2097152, - } - interface EmitHelper { - readonly name: string; - readonly scoped: boolean; - readonly text: string; - readonly priority?: number; - } - const enum EmitContext { - SourceFile = 0, - Expression = 1, - IdentifierName = 2, - Unspecified = 3, - } - interface EmitHost extends ScriptReferenceHost { - getSourceFiles(): SourceFile[]; - isSourceFileFromExternalLibrary(file: SourceFile): boolean; - getCommonSourceDirectory(): string; - getCanonicalFileName(fileName: string): string; - getNewLine(): string; - isEmitBlocked(emitFileName: string): boolean; - writeFile: WriteFileCallback; - } - interface TransformationContext { - getCompilerOptions(): CompilerOptions; - getEmitResolver(): EmitResolver; - getEmitHost(): EmitHost; - startLexicalEnvironment(): void; - suspendLexicalEnvironment(): void; - resumeLexicalEnvironment(): void; - endLexicalEnvironment(): Statement[]; - hoistFunctionDeclaration(node: FunctionDeclaration): void; - hoistVariableDeclaration(node: Identifier): void; - requestEmitHelper(helper: EmitHelper): void; - readEmitHelpers(): EmitHelper[] | undefined; - enableSubstitution(kind: SyntaxKind): void; - isSubstitutionEnabled(node: Node): boolean; - onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node; - enableEmitNotification(kind: SyntaxKind): void; - isEmitNotificationEnabled(node: Node): boolean; - onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void; - } - interface TransformationResult { - transformed: SourceFile[]; - emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - } - type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile; - interface TextSpan { - start: number; - length: number; + interface DefinitionResponse extends Response { + body?: FileSpan[]; } - interface TextChangeRange { - span: TextSpan; - newLength: number; + interface TypeDefinitionResponse extends Response { + body?: FileSpan[]; } - interface DiagnosticCollection { - add(diagnostic: Diagnostic): void; - getGlobalDiagnostics(): Diagnostic[]; - getDiagnostics(fileName?: string): Diagnostic[]; - getModificationCount(): number; - reattachFileDiagnostics(newFile: SourceFile): void; + interface ImplementationResponse extends Response { + body?: FileSpan[]; } - interface SyntaxList extends Node { - _children: Node[]; + interface BraceCompletionRequest extends FileLocationRequest { + command: CommandTypes.BraceCompletion; + arguments: BraceCompletionRequestArgs; } -} -declare namespace ts { - const timestamp: () => number; -} -declare namespace ts.performance { - function mark(markName: string): void; - function measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - function getCount(markName: string): number; - function getDuration(measureName: string): number; - function forEachMeasure(cb: (measureName: string, duration: number) => void): void; - function enable(): void; - function disable(): void; -} -declare namespace ts { - const version = "2.2.0-dev.20161127"; -} -declare namespace ts { - const enum Ternary { - False = 0, - Maybe = 1, - True = -1, + interface BraceCompletionRequestArgs extends FileLocationRequestArgs { + openingBrace: string; } - const collator: { - compare(a: string, b: string): number; - }; - function createMap(template?: MapLike): Map; - function createFileMap(keyMapper?: (key: string) => string): FileMap; - function toPath(fileName: string, basePath: string, getCanonicalFileName: (path: string) => string): Path; - const enum Comparison { - LessThan = -1, - EqualTo = 0, - GreaterThan = 1, - } - function forEach(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined; - function zipWith(arrayA: T[], arrayB: U[], callback: (a: T, b: U, index: number) => void): void; - function every(array: T[], callback: (element: T, index: number) => boolean): boolean; - function find(array: T[], predicate: (element: T, index: number) => boolean): T | undefined; - function findMap(array: T[], callback: (element: T, index: number) => U | undefined): U; - function contains(array: T[], value: T): boolean; - function indexOf(array: T[], value: T): number; - function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number; - function countWhere(array: T[], predicate: (x: T, i: number) => boolean): number; - function filter(array: T[], f: (x: T) => x is U): U[]; - function filter(array: T[], f: (x: T) => boolean): T[]; - function removeWhere(array: T[], f: (x: T) => boolean): boolean; - function filterMutate(array: T[], f: (x: T) => boolean): void; - function map(array: T[], f: (x: T, i: number) => U): U[]; - function sameMap(array: T[], f: (x: T, i: number) => T): T[]; - function flatten(array: (T | T[])[]): T[]; - function flatMap(array: T[], mapfn: (x: T, i: number) => U | U[]): U[]; - function span(array: T[], f: (x: T, i: number) => boolean): [T[], T[]]; - function spanMap(array: T[], keyfn: (x: T, i: number) => K, mapfn: (chunk: T[], key: K, start: number, end: number) => U): U[]; - function mapObject(object: MapLike, f: (key: string, x: T) => [string, U]): MapLike; - function some(array: T[], predicate?: (value: T) => boolean): boolean; - function concatenate(array1: T[], array2: T[]): T[]; - function deduplicate(array: T[], areEqual?: (a: T, b: T) => boolean): T[]; - function arrayIsEqualTo(array1: ReadonlyArray, array2: ReadonlyArray, equaler?: (a: T, b: T) => boolean): boolean; - function changesAffectModuleResolution(oldOptions: CompilerOptions, newOptions: CompilerOptions): boolean; - function compact(array: T[]): T[]; - function relativeComplement(arrayA: T[] | undefined, arrayB: T[] | undefined, comparer?: (x: T, y: T) => Comparison, offsetA?: number, offsetB?: number): T[] | undefined; - function sum(array: any[], prop: string): number; - function append(to: T[] | undefined, value: T | undefined): T[] | undefined; - function addRange(to: T[] | undefined, from: T[] | undefined): T[] | undefined; - function stableSort(array: T[], comparer?: (x: T, y: T) => Comparison): T[]; - function rangeEquals(array1: T[], array2: T[], pos: number, end: number): boolean; - function firstOrUndefined(array: T[]): T; - function lastOrUndefined(array: T[]): T; - function singleOrUndefined(array: T[]): T; - function singleOrMany(array: T[]): T | T[]; - function replaceElement(array: T[], index: number, value: T): T[]; - function binarySearch(array: T[], value: T, comparer?: (v1: T, v2: T) => number, offset?: number): number; - function reduceLeft(array: T[], f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U; - function reduceLeft(array: T[], f: (memo: T, value: T, i: number) => T): T; - function reduceRight(array: T[], f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U; - function reduceRight(array: T[], f: (memo: T, value: T, i: number) => T): T; - function hasProperty(map: MapLike, key: string): boolean; - function getProperty(map: MapLike, key: string): T | undefined; - function getOwnKeys(map: MapLike): string[]; - function forEachProperty(map: Map, callback: (value: T, key: string) => U): U; - function someProperties(map: Map, predicate?: (value: T, key: string) => boolean): boolean; - function copyProperties(source: Map, target: MapLike): void; - function appendProperty(map: Map, key: string | number, value: T): Map; - function assign, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3; - function assign, T2>(t: T1, arg1: T2): T1 & T2; - function assign>(t: T1, ...args: any[]): any; - function reduceProperties(map: Map, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; - function reduceOwnProperties(map: MapLike, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; - function equalOwnProperties(left: MapLike, right: MapLike, equalityComparer?: (left: T, right: T) => boolean): boolean; - function arrayToMap(array: T[], makeKey: (value: T) => string): Map; - function arrayToMap(array: T[], makeKey: (value: T) => string, makeValue: (value: T) => U): Map; - function isEmpty(map: Map): boolean; - function cloneMap(map: Map): Map; - function clone(object: T): T; - function extend(first: T1, second: T2): T1 & T2; - function multiMapAdd(map: Map, key: string | number, value: V): V[]; - function multiMapRemove(map: Map, key: string, value: V): void; - function isArray(value: any): value is any[]; - function noop(): void; - function notImplemented(): never; - function memoize(callback: () => T): () => T; - function chain(...args: ((t: T) => (u: U) => U)[]): (t: T) => (u: U) => U; - function compose(...args: ((t: T) => T)[]): (t: T) => T; - let localizedDiagnosticMessages: Map; - function getLocaleSpecificMessage(message: DiagnosticMessage): string; - function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: (string | number)[]): Diagnostic; - function formatMessage(_dummy: any, message: DiagnosticMessage): string; - function createCompilerDiagnostic(message: DiagnosticMessage, ...args: (string | number)[]): Diagnostic; - function createCompilerDiagnosticFromMessageChain(chain: DiagnosticMessageChain): Diagnostic; - function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain; - function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain; - function compareValues(a: T, b: T): Comparison; - function compareStrings(a: string, b: string, ignoreCase?: boolean): Comparison; - function compareStringsCaseInsensitive(a: string, b: string): Comparison; - function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison; - function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; - function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; - function normalizeSlashes(path: string): string; - function getRootLength(path: string): number; - const directorySeparator = "/"; - function normalizePath(path: string): string; - function pathEndsWithDirectorySeparator(path: string): boolean; - function getDirectoryPath(path: Path): Path; - function getDirectoryPath(path: string): string; - function isUrl(path: string): boolean; - function isExternalModuleNameRelative(moduleName: string): boolean; - function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget; - function getEmitModuleKind(compilerOptions: CompilerOptions): ModuleKind; - function getEmitModuleResolutionKind(compilerOptions: CompilerOptions): ModuleResolutionKind; - function hasZeroOrOneAsteriskCharacter(str: string): boolean; - function isRootedDiskPath(path: string): boolean; - function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string; - function getNormalizedPathComponents(path: string, currentDirectory: string): string[]; - function getNormalizedAbsolutePath(fileName: string, currentDirectory: string): string; - function getNormalizedPathFromPathComponents(pathComponents: string[]): string; - function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string; - function getBaseFileName(path: string): string; - function combinePaths(path1: string, path2: string): string; - function removeTrailingDirectorySeparator(path: string): string; - function ensureTrailingDirectorySeparator(path: string): string; - function comparePaths(a: string, b: string, currentDirectory: string, ignoreCase?: boolean): Comparison; - function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean; - function startsWith(str: string, prefix: string): boolean; - function endsWith(str: string, suffix: string): boolean; - function hasExtension(fileName: string): boolean; - function fileExtensionIs(path: string, extension: string): boolean; - function fileExtensionIsAny(path: string, extensions: string[]): boolean; - function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude"): string; - function isImplicitGlob(lastPathComponent: string): boolean; - interface FileSystemEntries { - files: string[]; - directories: string[]; - } - interface FileMatcherPatterns { - includeFilePattern: string; - includeDirectoryPattern: string; - excludePattern: string; - basePaths: string[]; - } - function getFileMatcherPatterns(path: string, excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns; - function matchFiles(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string, getFileSystemEntries: (path: string) => FileSystemEntries): string[]; - function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): ScriptKind; - function getScriptKindFromFileName(fileName: string): ScriptKind; - const supportedTypeScriptExtensions: string[]; - const supportedTypescriptExtensionsForExtractExtension: string[]; - const supportedJavascriptExtensions: string[]; - function getSupportedExtensions(options?: CompilerOptions): string[]; - function hasJavaScriptFileExtension(fileName: string): boolean; - function hasTypeScriptFileExtension(fileName: string): boolean; - function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions): boolean; - const enum ExtensionPriority { - TypeScriptFiles = 0, - DeclarationAndJavaScriptFiles = 2, - Limit = 5, - Highest = 0, - Lowest = 2, - } - function getExtensionPriority(path: string, supportedExtensions: string[]): ExtensionPriority; - function adjustExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority; - function getNextLowestExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority; - function removeFileExtension(path: string): string; - function tryRemoveExtension(path: string, extension: string): string | undefined; - function removeExtension(path: string, extension: string): string; - function changeExtension(path: T, newExtension: string): T; - interface ObjectAllocator { - getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; - getTokenConstructor(): new (kind: TKind, pos?: number, end?: number) => Token; - getIdentifierConstructor(): new (kind: SyntaxKind.Identifier, pos?: number, end?: number) => Identifier; - getSourceFileConstructor(): new (kind: SyntaxKind.SourceFile, pos?: number, end?: number) => SourceFile; - getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; - getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; - getSignatureConstructor(): new (checker: TypeChecker) => Signature; - } - let objectAllocator: ObjectAllocator; - const enum AssertionLevel { - None = 0, - Normal = 1, - Aggressive = 2, - VeryAggressive = 3, - } - namespace Debug { - let currentAssertionLevel: AssertionLevel; - function shouldAssert(level: AssertionLevel): boolean; - function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void; - function fail(message?: string): void; - } - function orderedRemoveItem(array: T[], item: T): boolean; - function orderedRemoveItemAt(array: T[], index: number): void; - function unorderedRemoveItemAt(array: T[], index: number): void; - function unorderedRemoveItem(array: T[], item: T): void; - function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): (fileName: string) => string; - function matchPatternOrExact(patternStrings: string[], candidate: string): string | Pattern | undefined; - function patternText({prefix, suffix}: Pattern): string; - function matchedText(pattern: Pattern, candidate: string): string; - function findBestPatternMatch(values: T[], getPattern: (value: T) => Pattern, candidate: string): T | undefined; - function tryParsePattern(pattern: string): Pattern | undefined; - function positionIsSynthesized(pos: number): boolean; - function extensionIsTypeScript(ext: Extension): boolean; - function extensionFromPath(path: string): Extension; - function tryGetExtensionFromPath(path: string): Extension | undefined; -} -declare namespace ts { - type FileWatcherCallback = (fileName: string, removed?: boolean) => void; - type DirectoryWatcherCallback = (fileName: string) => void; - interface WatchedFile { - fileName: string; - callback: FileWatcherCallback; - mtime?: Date; + interface OccurrencesRequest extends FileLocationRequest { + command: CommandTypes.Occurrences; } - interface System { - args: string[]; - newLine: string; - useCaseSensitiveFileNames: boolean; - write(s: string): void; - readFile(path: string, encoding?: string): string; - getFileSize?(path: string): number; - writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; - watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; - resolvePath(path: string): string; - fileExists(path: string): boolean; - directoryExists(path: string): boolean; - createDirectory(path: string): void; - getExecutingFilePath(): string; - getCurrentDirectory(): string; - getDirectories(path: string): string[]; - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; - getModifiedTime?(path: string): Date; - createHash?(data: string): string; - getMemoryUsage?(): number; - exit(exitCode?: number): void; - realpath?(path: string): string; - getEnvironmentVariable(name: string): string; - tryEnableSourceMapsForHost?(): void; - setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; - clearTimeout?(timeoutId: any): void; + interface OccurrencesResponseItem extends FileSpan { + isWriteAccess: boolean; + isInString?: true; } - interface FileWatcher { - close(): void; + interface OccurrencesResponse extends Response { + body?: OccurrencesResponseItem[]; } - interface DirectoryWatcher extends FileWatcher { - directoryName: string; - referenceCount: number; - } - let sys: System; -} -declare namespace ts { - const Diagnostics: { - Unterminated_string_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_file_cannot_have_a_reference_to_itself: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Trailing_comma_not_allowed: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Asterisk_Slash_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_token: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_must_be_last_in_a_parameter_list: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_cannot_have_question_mark_and_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_required_parameter_cannot_follow_an_optional_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_cannot_have_a_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_cannot_have_a_question_mark: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_must_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_must_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_type_must_be_string_or_number: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Accessibility_modifier_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_must_precede_1_modifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_class_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_must_be_followed_by_an_argument_list_or_member_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_ambient_modules_can_use_quoted_names: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Statements_are_not_allowed_in_ambient_contexts: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializers_are_not_allowed_in_ambient_contexts: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_in_an_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_with_a_class_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_data_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_module_or_namespace_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_0_modifier_cannot_be_used_with_an_interface_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_cannot_be_optional: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_must_have_exactly_one_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_cannot_have_an_optional_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_parameter_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_cannot_have_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_get_accessor_cannot_have_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_async_function_or_method_must_have_a_valid_awaitable_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Operand_for_await_does_not_have_a_valid_callable_then_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_member_must_have_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_cannot_be_used_in_a_namespace: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_type_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_an_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_0_modifier_cannot_be_used_with_an_import_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_reference_directive_syntax: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_accessor_cannot_be_declared_in_an_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_constructor_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameters_cannot_appear_on_a_constructor_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_annotation_cannot_appear_on_a_constructor_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_accessor_cannot_have_type_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_cannot_have_a_return_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_must_have_exactly_one_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_argument_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_use_of_0_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - with_statements_are_not_allowed_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - delete_cannot_be_called_on_an_identifier_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Jump_target_cannot_cross_function_boundary: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_return_statement_can_only_be_used_within_a_function_body: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_label_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_cannot_have_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_literals_are_not_allowed_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_tuple_type_element_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_declaration_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Hexadecimal_digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_end_of_text: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_character: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Declaration_or_statement_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Statement_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - case_or_default_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_or_signature_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_member_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Argument_expression_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_assignment_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_or_comma_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_argument_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - String_literal_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Line_break_not_permitted_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - or_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_declarations_in_a_namespace_cannot_reference_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_declarations_must_be_initialized: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_declarations_can_only_be_declared_inside_a_block: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - let_declarations_can_only_be_declared_inside_a_block: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_template_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_regular_expression_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_member_cannot_be_declared_optional: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_yield_expression_is_only_allowed_in_a_generator_body: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Computed_property_names_are_not_allowed_in_enums: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_comma_expression_is_not_allowed_in_a_computed_property_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - extends_clause_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - extends_clause_must_precede_implements_clause: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Classes_can_only_extend_a_single_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - implements_clause_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_declaration_cannot_have_implements_clause: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Binary_digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_token_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_destructuring_pattern_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Array_element_destructuring_pattern_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_destructuring_declaration_must_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_implementation_cannot_be_declared_in_ambient_contexts: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Modifiers_cannot_appear_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Merge_conflict_marker_encountered: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_element_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_property_may_not_be_declared_using_a_binding_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_import_declaration_cannot_have_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_has_no_default_export: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_declaration_cannot_have_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_declarations_are_not_permitted_in_a_namespace: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Catch_clause_variable_cannot_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Catch_clause_variable_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_Unicode_escape_sequence: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Line_terminator_not_permitted_before_arrow: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Decorators_are_not_valid_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_declaration_without_the_default_modifier_must_have_a_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_assignment_is_not_supported_when_module_flag_is_system: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generators_are_not_allowed_in_an_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_overload_signature_cannot_be_declared_as_a_generator: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_tag_already_specified: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Signature_0_must_have_a_type_predicate: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_parameter_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_predicate_0_is_not_assignable_to_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_is_not_in_the_same_position_as_parameter_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_cannot_reference_a_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_can_only_be_used_in_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_import_declaration_can_only_be_used_in_a_namespace_or_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_declaration_can_only_be_used_in_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_with_1_modifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Abstract_methods_can_only_appear_within_an_abstract_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_interface_property_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_literal_property_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_member_cannot_have_the_0_keyword: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - with_statements_are_not_allowed_in_an_async_function_block: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - await_expression_is_only_allowed_within_an_async_function: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_body_of_an_if_statement_cannot_be_the_empty_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_module_exports_may_only_appear_in_module_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_module_exports_may_only_appear_in_declaration_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_module_exports_may_only_appear_at_top_level: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_property_cannot_be_declared_using_a_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Static_members_cannot_reference_class_type_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Circular_definition_of_import_alias_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_has_no_exported_member_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_is_not_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_module_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_recursively_references_itself_as_a_base_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_may_only_extend_another_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_interface_may_only_extend_a_class_or_another_interface: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_has_a_circular_constraint: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generic_type_0_requires_1_type_argument_s: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_generic: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_type_0_must_be_a_class_or_interface_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_type_0_must_have_1_type_parameter_s: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_global_type_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Named_property_0_of_types_1_and_2_are_not_identical: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_0_cannot_simultaneously_extend_types_1_and_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Excessive_stack_depth_comparing_types_0_and_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_assignable_to_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_redeclare_exported_variable_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_missing_in_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_private_in_type_1_but_not_in_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Types_of_property_0_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_optional_in_type_1_but_required_in_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Types_of_parameters_0_and_1_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Index_signature_is_missing_in_type_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Index_signatures_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_a_module_or_namespace_body: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_current_location: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_constructor_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_a_static_property_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_can_only_be_referenced_in_a_derived_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_cannot_be_referenced_in_constructor_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_does_not_exist_on_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_private_and_only_accessible_within_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_does_not_satisfy_the_constraint_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Supplied_parameters_do_not_match_any_signature_of_call_target: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Untyped_function_calls_may_not_accept_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_a_void_function_can_be_called_with_the_new_keyword: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_cannot_be_converted_to_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Operator_0_cannot_be_applied_to_types_1_and_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_must_be_of_an_array_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_cannot_be_referenced_in_its_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_string_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_number_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructors_for_derived_classes_must_contain_a_super_call: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_get_accessor_must_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Getter_and_setter_accessors_do_not_agree_in_visibility: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - get_and_set_accessor_must_have_the_same_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_exported_or_non_exported: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_ambient_or_non_ambient: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_public_private_or_protected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_optional_or_required: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_overload_must_be_static: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_overload_must_not_be_static: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_implementation_name_must_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructor_implementation_is_missing: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Multiple_constructor_implementations_are_not_allowed: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_function_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signature_is_not_compatible_with_function_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Declaration_name_conflicts_with_built_in_global_identifier_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Setters_cannot_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_incorrectly_extends_base_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_incorrectly_implements_interface_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_may_only_implement_another_class_or_interface: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - All_declarations_of_0_must_have_identical_type_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_0_incorrectly_extends_interface_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Ambient_module_declaration_cannot_specify_relative_module_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_declaration_conflicts_with_local_declaration_of_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Types_have_separate_declarations_of_a_private_property_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_in_type_1_but_public_in_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Block_scoped_variable_0_used_before_its_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_redeclare_block_scoped_variable_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_enum_member_cannot_have_a_numeric_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_0_is_used_before_being_assigned: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_alias_0_circularly_references_itself: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_alias_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_AMD_module_cannot_have_multiple_name_assignments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_has_no_property_1_and_no_string_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_has_no_property_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_an_array_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_element_must_be_last_in_a_destructuring_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_a_computed_property_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_cannot_be_referenced_in_a_computed_property_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_global_value_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_0_operator_cannot_be_applied_to_type_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_declarations_must_all_be_const_or_non_const: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - In_const_enum_declarations_member_initializer_must_be_constant_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_does_not_exist_on_const_enum_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_declaration_conflicts_with_exported_declaration_of_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_iterator_must_have_a_next_method: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_redeclare_identifier_0_in_catch_clause: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_an_array_type_or_a_string_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_element_cannot_contain_a_binding_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_namespace_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_generator_cannot_have_a_void_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_a_constructor_function_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - No_base_constructor_has_the_specified_number_of_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Base_constructor_return_type_0_is_not_a_class_or_interface_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Base_constructors_must_all_have_the_same_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_create_an_instance_of_the_abstract_class_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_abstract_or_non_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Classes_containing_abstract_methods_must_be_marked_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - All_declarations_of_an_abstract_method_must_be_consecutive: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - yield_expressions_cannot_be_used_in_a_parameter_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - await_expressions_cannot_be_used_in_a_parameter_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_module_cannot_have_multiple_default_exports: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_incompatible_with_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_is_possibly_null: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_is_possibly_undefined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_is_possibly_null_or_undefined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_function_returning_never_cannot_have_a_reachable_end_point: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_type_0_has_members_with_initializers_that_are_not_literals: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_cannot_be_used_to_index_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_has_no_matching_index_signature_for_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_cannot_be_used_as_an_index_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_to_0_because_it_is_not_a_variable: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Index_signature_in_type_0_only_permits_reading: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_attributes_type_0_may_not_be_a_union_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_in_type_1_is_not_assignable_to_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_global_type_JSX_0_may_not_have_more_than_one_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_emit_namespaced_JSX_elements_in_React: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_expressions_must_have_one_parent_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_provides_no_match_for_the_signature_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_module_name_in_augmentation_module_0_cannot_be_found: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Accessors_must_both_be_abstract_or_non_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_comparable_to_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_this_parameter_must_be_the_first_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_constructor_cannot_have_a_this_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - get_and_set_accessor_must_have_the_same_this_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_this_types_of_each_signature_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - All_declarations_of_0_must_have_identical_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_type_definition_file_for_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_extend_an_interface_0_Did_you_mean_implements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_must_be_declared_after_its_base_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Namespace_0_has_no_exported_member_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Spread_types_may_only_be_created_from_object_types: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Rest_types_may_only_be_created_from_object_types: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_declaration_0_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_variable_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_exported_function_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_type_alias_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Default_export_of_the_module_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_current_host_does_not_support_the_0_option: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_the_common_subdirectory_path_for_the_input_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_read_file_0_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unsupported_file_encoding: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Failed_to_parse_file_0_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unknown_compiler_option_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compiler_option_0_requires_a_value_of_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Could_not_write_file_0_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_cannot_be_specified_without_specifying_option_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_cannot_be_specified_with_option_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_tsconfig_json_file_is_already_defined_at_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_write_file_0_because_it_would_overwrite_input_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_specified_path_does_not_exist_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_paths_cannot_be_used_without_specifying_baseUrl_option: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Pattern_0_can_have_at_most_one_Asterisk_character: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitutions_for_pattern_0_should_be_an_array: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Concatenate_and_emit_output_to_single_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generates_corresponding_d_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Watch_input_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Redirect_output_structure_to_the_directory: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_erase_const_enum_declarations_in_generated_code: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_outputs_if_any_errors_were_reported: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_comments_to_output: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_outputs: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Skip_type_checking_of_declaration_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Print_this_message: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Print_the_compiler_s_version: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compile_the_project_in_the_given_directory: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Syntax_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - options: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Examples_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Options_Colon: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Version_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Insert_command_line_options_and_files_from_a_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_change_detected_Starting_incremental_compilation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - KIND: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - FILE: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - VERSION: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - LOCATION: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - DIRECTORY: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - STRATEGY: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compilation_complete_Watching_for_file_changes: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generates_corresponding_map_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compiler_option_0_expects_an_argument: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_quoted_string_in_response_file_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Argument_for_0_option_must_be_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unsupported_locale_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_open_file_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Corrupted_locale_file_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_not_found: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - NEWLINE: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_can_only_be_specified_in_tsconfig_json_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enables_experimental_support_for_ES7_decorators: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enables_experimental_support_for_emitting_type_metadata_for_decorators: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enables_experimental_support_for_ES7_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Successfully_created_a_tsconfig_json_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Suppress_excess_property_checks_for_object_literals: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Stylize_errors_and_messages_using_color_and_context_experimental: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_report_errors_on_unused_labels: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_error_when_not_all_code_paths_in_function_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_errors_for_fallthrough_cases_in_switch_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_report_errors_on_unreachable_code: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Disallow_inconsistently_cased_references_to_the_same_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_library_files_to_be_included_in_the_compilation_Colon: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_JSX_code_generation_Colon_preserve_or_react: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_amd_and_system_modules_are_supported_alongside_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Base_directory_to_resolve_non_absolute_module_names: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enable_tracing_of_the_name_resolution_process: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_module_0_from_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Explicitly_specified_module_resolution_kind_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_resolution_kind_is_not_specified_using_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_name_0_was_successfully_resolved_to_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_name_0_was_not_resolved: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_name_0_matched_pattern_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Trying_substitution_0_candidate_module_location_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_module_name_0_relative_to_base_url_1_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Loading_module_as_file_Slash_folder_candidate_module_location_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_does_not_exist: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_exist_use_it_as_a_name_resolution_result: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Loading_module_0_from_node_modules_folder: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Found_package_json_at_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - package_json_does_not_have_a_types_or_main_field: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - package_json_has_0_field_1_that_references_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Allow_javascript_files_to_be_compiled: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_should_have_array_of_strings_as_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Checking_if_0_is_the_longest_matching_prefix_for_1_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expected_type_of_0_field_in_package_json_to_be_string_got_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Longest_matching_prefix_for_0_is_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Loading_0_from_the_root_dir_1_candidate_location_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Trying_other_entries_in_rootDirs: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_resolution_using_rootDirs_has_failed: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_use_strict_directives_in_module_output: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enable_strict_null_checks: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unknown_option_excludes_Did_you_mean_exclude: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Raise_error_on_this_expressions_with_an_implied_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_using_primary_search_paths: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_from_node_modules_folder: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_reference_directive_0_was_not_resolved: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_with_primary_search_path_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Root_directory_cannot_be_determined_skipping_primary_search_paths: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_declaration_files_to_be_included_in_compilation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Looking_up_in_node_modules_folder_initial_location_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_config_file_0_found_doesn_t_contain_any_source_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_real_path_for_0_result_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_name_0_has_a_1_extension_stripping_it: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_declared_but_never_used: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_errors_on_unused_locals: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_errors_on_unused_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - No_types_specified_in_package_json_so_returning_main_value_of_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_declared_but_never_used: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_emit_helpers_from_tslib: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_to_1_but_jsx_is_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_to_1_but_allowJs_is_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Member_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_literal_s_property_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Rest_parameter_0_implicitly_has_an_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unreachable_code_detected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unused_label: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Fallthrough_case_in_switch: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Not_all_code_paths_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Binding_element_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - You_cannot_rename_this_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - import_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - export_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_parameter_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - implements_clauses_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - interface_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - module_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_aliases_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - types_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_arguments_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - parameter_modifiers_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - enum_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_assertion_expressions_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - class_expressions_are_not_currently_supported: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Language_service_is_disabled: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_attributes_must_only_be_assigned_a_non_empty_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expected_corresponding_JSX_closing_tag_for_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_attribute_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_0_has_no_corresponding_closing_tag: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unknown_type_acquisition_option_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Circularity_detected_while_resolving_configuration_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_files_list_in_config_file_0_is_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Add_missing_super_call: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Make_super_call_the_first_statement_in_the_constructor: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Change_extends_to_implements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Remove_unused_identifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implement_interface_on_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implement_interface_on_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implement_inherited_abstract_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_0_from_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Change_0_to_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Add_0_to_existing_import_declaration_from_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - }; -} -declare namespace ts { - interface ErrorCallback { - (message: DiagnosticMessage, length: number): void; - } - function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean; - interface Scanner { - getStartPos(): number; - getToken(): SyntaxKind; - getTextPos(): number; - getTokenPos(): number; - getTokenText(): string; - getTokenValue(): string; - hasExtendedUnicodeEscape(): boolean; - hasPrecedingLineBreak(): boolean; - isIdentifier(): boolean; - isReservedWord(): boolean; - isUnterminated(): boolean; - reScanGreaterToken(): SyntaxKind; - reScanSlashToken(): SyntaxKind; - reScanTemplateToken(): SyntaxKind; - scanJsxIdentifier(): SyntaxKind; - scanJsxAttributeValue(): SyntaxKind; - reScanJsxToken(): SyntaxKind; - scanJsxToken(): SyntaxKind; - scanJSDocToken(): SyntaxKind; - scan(): SyntaxKind; - getText(): string; - setText(text: string, start?: number, length?: number): void; - setOnError(onError: ErrorCallback): void; - setScriptTarget(scriptTarget: ScriptTarget): void; - setLanguageVariant(variant: LanguageVariant): void; - setTextPos(textPos: number): void; - lookAhead(callback: () => T): T; - scanRange(start: number, length: number, callback: () => T): T; - tryScan(callback: () => T): T; - } - function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget): boolean; - function tokenToString(t: SyntaxKind): string; - function stringToToken(s: string): SyntaxKind; - function computeLineStarts(text: string): number[]; - function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; - function getLineStarts(sourceFile: SourceFile): number[]; - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { - line: number; - character: number; - }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; - function isWhiteSpace(ch: number): boolean; - function isWhiteSpaceSingleLine(ch: number): boolean; - function isLineBreak(ch: number): boolean; - function isOctalDigit(ch: number): boolean; - function couldStartTrivia(text: string, pos: number): boolean; - function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean, stopAtComments?: boolean): number; - function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; - function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; - function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; - function getShebang(text: string): string; - function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; - function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; - function isIdentifierText(name: string, languageVersion: ScriptTarget): boolean; - function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; -} -declare namespace ts { - const compileOnSaveCommandLineOption: CommandLineOption; - const optionDeclarations: CommandLineOption[]; - let typeAcquisitionDeclarations: CommandLineOption[]; - interface OptionNameMap { - optionNameMap: Map; - shortOptionNames: Map; - } - const defaultInitCompilerOptions: CompilerOptions; - function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition; - function getOptionNameMap(): OptionNameMap; - function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic; - function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): string | number; - function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[] | undefined; - function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; - function readConfigFile(fileName: string, readFile: (path: string) => string): { - config?: any; - error?: Diagnostic; - }; - function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments?: boolean): { - config?: any; - error?: Diagnostic; - }; - function generateTSConfig(options: CompilerOptions, fileNames: string[]): { - compilerOptions: Map; - }; - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine; - function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; - function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: CompilerOptions; - errors: Diagnostic[]; - }; - function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: TypeAcquisition; - errors: Diagnostic[]; - }; -} -declare namespace ts.JsTyping { - interface TypingResolutionHost { - directoryExists: (path: string) => boolean; - fileExists: (fileName: string) => boolean; - readFile: (path: string, encoding?: string) => string; - readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[]; - } - const nodeCoreModuleList: ReadonlyArray; - function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map, typeAcquisition: TypeAcquisition, unresolvedImports: ReadonlyArray): { - cachedTypingPaths: string[]; - newTypingNames: string[]; - filesToWatch: string[]; - }; -} -declare namespace ts.server { - const ActionSet: ActionSet; - const ActionInvalidate: ActionInvalidate; - const EventInstall: EventInstall; - namespace Arguments { - const GlobalCacheLocation = "--globalTypingsCacheLocation"; - const LogFile = "--logFile"; - const EnableTelemetry = "--enableTelemetry"; - } - function hasArgument(argumentName: string): boolean; - function findArgument(argumentName: string): string; -} -declare namespace ts.server { - enum LogLevel { - terse = 0, - normal = 1, - requestTime = 2, - verbose = 3, - } - const emptyArray: ReadonlyArray; - interface Logger { - close(): void; - hasLevel(level: LogLevel): boolean; - loggingEnabled(): boolean; - perftrc(s: string): void; - info(s: string): void; - startGroup(): void; - endGroup(): void; - msg(s: string, type?: Msg.Types): void; - getLogFileName(): string; - } - namespace Msg { - type Err = "Err"; - const Err: Err; - type Info = "Info"; - const Info: Info; - type Perf = "Perf"; - const Perf: Perf; - type Types = Err | Info | Perf; + interface DocumentHighlightsRequest extends FileLocationRequest { + command: CommandTypes.DocumentHighlights; + arguments: DocumentHighlightsRequestArgs; } - function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings; - namespace Errors { - function ThrowNoProject(): never; - function ThrowProjectLanguageServiceDisabled(): never; - function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never; + interface HighlightSpan extends TextSpan { + kind: string; } - function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings; - function mergeMaps(target: MapLike, source: MapLike): void; - function removeItemFromSet(items: T[], itemToRemove: T): void; - type NormalizedPath = string & { - __normalizedPathTag: any; - }; - function toNormalizedPath(fileName: string): NormalizedPath; - function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path; - function asNormalizedPath(fileName: string): NormalizedPath; - interface NormalizedPathMap { - get(path: NormalizedPath): T; - set(path: NormalizedPath, value: T): void; - contains(path: NormalizedPath): boolean; - remove(path: NormalizedPath): void; + interface DocumentHighlightsItem { + file: string; + highlightSpans: HighlightSpan[]; } - function createNormalizedPathMap(): NormalizedPathMap; - interface ProjectOptions { - configHasFilesProperty?: boolean; - files?: string[]; - wildcardDirectories?: Map; - compilerOptions?: CompilerOptions; - typeAcquisition?: TypeAcquisition; - compileOnSave?: boolean; + interface DocumentHighlightsResponse extends Response { + body?: DocumentHighlightsItem[]; } - function isInferredProjectName(name: string): boolean; - function makeInferredProjectName(counter: number): string; - function toSortedReadonlyArray(arr: string[]): SortedReadonlyArray; - class ThrottledOperations { - private readonly host; - private pendingTimeouts; - constructor(host: ServerHost); - schedule(operationId: string, delay: number, cb: () => void): void; - private static run(self, operationId, cb); + interface ReferencesRequest extends FileLocationRequest { + command: CommandTypes.References; } - class GcTimer { - private readonly host; - private readonly delay; - private readonly logger; - private timerId; - constructor(host: ServerHost, delay: number, logger: Logger); - scheduleCollect(): void; - private static run(self); + interface ReferencesResponseItem extends FileSpan { + lineText: string; + isWriteAccess: boolean; + isDefinition: boolean; } -} -declare namespace ts { - function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; - function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean; - function moduleHasNonRelativeName(moduleName: string): boolean; - function getEffectiveTypeRoots(options: CompilerOptions, host: { - directoryExists?: (directoryName: string) => boolean; - getCurrentDirectory?: () => string; - }): string[] | undefined; - function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; - function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function directoryProbablyExists(directoryName: string, host: { - directoryExists?: (directoryName: string) => boolean; - }): boolean; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function loadModuleFromGlobalCache(moduleName: string, projectName: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, globalCache: string): ResolvedModuleWithFailedLookupLocations; -} -declare namespace ts { - const externalHelpersModuleNameText = "tslib"; - interface ReferencePathMatchResult { - fileReference?: FileReference; - diagnosticMessage?: DiagnosticMessage; - isNoDefaultLib?: boolean; - isTypeReferenceDirective?: boolean; - } - function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration; - interface StringSymbolWriter extends SymbolWriter { - string(): string; - } - function getSingleLineStringWriter(): StringSymbolWriter; - function releaseStringWriter(writer: StringSymbolWriter): void; - function getFullWidth(node: Node): number; - function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean; - function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModuleFull; - function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModuleFull): void; - function setResolvedTypeReferenceDirective(sourceFile: SourceFile, typeReferenceDirectiveName: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective): void; - function moduleResolutionIsEqualTo(oldResolution: ResolvedModuleFull, newResolution: ResolvedModuleFull): boolean; - function typeDirectiveIsEqualTo(oldResolution: ResolvedTypeReferenceDirective, newResolution: ResolvedTypeReferenceDirective): boolean; - function hasChangesInResolutions(names: string[], newResolutions: T[], oldResolutions: Map, comparer: (oldResolution: T, newResolution: T) => boolean): boolean; - function containsParseError(node: Node): boolean; - function getSourceFileOfNode(node: Node): SourceFile; - function isStatementWithLocals(node: Node): boolean; - function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; - function nodePosToString(node: Node): string; - function getStartPosOfNode(node: Node): number; - function isDefined(value: any): boolean; - function getEndLinePosition(line: number, sourceFile: SourceFile): number; - function nodeIsMissing(node: Node): boolean; - function nodeIsPresent(node: Node): boolean; - function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDoc?: boolean): number; - function isJSDocNode(node: Node): boolean; - function isJSDocTag(node: Node): boolean; - function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number; - function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node, includeTrivia?: boolean): string; - function getTextOfNodeFromSourceText(sourceText: string, node: Node): string; - function getTextOfNode(node: Node, includeTrivia?: boolean): string; - function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile, languageVersion: ScriptTarget): string; - function isBinaryOrOctalIntegerLiteral(node: LiteralLikeNode, text: string): boolean; - function escapeIdentifier(identifier: string): string; - function unescapeIdentifier(identifier: string): string; - function makeIdentifierFromModuleName(moduleName: string): string; - function isBlockOrCatchScoped(declaration: Declaration): boolean; - function isCatchClauseVariableDeclarationOrBindingElement(declaration: Declaration): boolean; - function isAmbientModule(node: Node): boolean; - function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean; - function isBlockScopedContainerTopLevel(node: Node): boolean; - function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean; - function isExternalModuleAugmentation(node: Node): boolean; - function isBlockScope(node: Node, parentNode: Node): boolean; - function getEnclosingBlockScopeContainer(node: Node): Node; - function declarationNameToString(name: DeclarationName): string; - function getTextOfPropertyName(name: PropertyName): string; - function entityNameToString(name: EntityNameOrEntityNameExpression): string; - function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic; - function createDiagnosticForNodeInSourceFile(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic; - function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic; - function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan; - function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan; - function isExternalOrCommonJsModule(file: SourceFile): boolean; - function isDeclarationFile(file: SourceFile): boolean; - function isConstEnumDeclaration(node: Node): boolean; - function isConst(node: Node): boolean; - function isLet(node: Node): boolean; - function isSuperCall(n: Node): n is SuperCall; - function isPrologueDirective(node: Node): node is PrologueDirective; - function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; - function getLeadingCommentRangesOfNodeFromText(node: Node, text: string): CommentRange[]; - function getJSDocCommentRanges(node: Node, text: string): CommentRange[]; - let fullTripleSlashReferencePathRegEx: RegExp; - let fullTripleSlashReferenceTypeReferenceDirectiveRegEx: RegExp; - let fullTripleSlashAMDReferencePathRegEx: RegExp; - function isPartOfTypeNode(node: Node): boolean; - function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; - function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void; - function isVariableLike(node: Node): node is VariableLikeDeclaration; - function isAccessor(node: Node): node is AccessorDeclaration; - function isClassLike(node: Node): node is ClassLikeDeclaration; - function isFunctionLike(node: Node): node is FunctionLikeDeclaration; - function isFunctionLikeKind(kind: SyntaxKind): boolean; - function introducesArgumentsExoticObject(node: Node): boolean; - function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement; - function isFunctionBlock(node: Node): boolean; - function isObjectLiteralMethod(node: Node): node is MethodDeclaration; - function isObjectLiteralOrClassExpressionMethod(node: Node): node is MethodDeclaration; - function isIdentifierTypePredicate(predicate: TypePredicate): predicate is IdentifierTypePredicate; - function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate; - function getContainingFunction(node: Node): FunctionLikeDeclaration; - function getContainingClass(node: Node): ClassLikeDeclaration; - function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; - function getSuperContainer(node: Node, stopOnFunctions: boolean): Node; - function getImmediatelyInvokedFunctionExpression(func: Node): CallExpression; - function isSuperProperty(node: Node): node is SuperProperty; - function getEntityNameFromTypeNode(node: TypeNode): EntityNameOrEntityNameExpression; - function isCallLikeExpression(node: Node): node is CallLikeExpression; - function getInvokedExpression(node: CallLikeExpression): Expression; - function nodeCanBeDecorated(node: Node): boolean; - function nodeIsDecorated(node: Node): boolean; - function nodeOrChildIsDecorated(node: Node): boolean; - function childIsDecorated(node: Node): boolean; - function isJSXTagName(node: Node): boolean; - function isPartOfExpression(node: Node): boolean; - function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean; - function isExternalModuleImportEqualsDeclaration(node: Node): boolean; - function getExternalModuleImportEqualsDeclarationExpression(node: Node): Expression; - function isInternalModuleImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration; - function isSourceFileJavaScript(file: SourceFile): boolean; - function isInJavaScriptFile(node: Node): boolean; - function isRequireCall(expression: Node, checkArgumentIsStringLiteral: boolean): expression is CallExpression; - function isSingleOrDoubleQuote(charCode: number): boolean; - function isDeclarationOfFunctionExpression(s: Symbol): boolean; - function getSpecialPropertyAssignmentKind(expression: Node): SpecialPropertyAssignmentKind; - function getExternalModuleName(node: Node): Expression; - function getNamespaceDeclarationNode(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): ImportEqualsDeclaration | NamespaceImport; - function isDefaultImport(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean; - function hasQuestionToken(node: Node): boolean; - function isJSDocConstructSignature(node: Node): boolean; - function getCommentsFromJSDoc(node: Node): string[]; - function getJSDocParameterTags(param: Node): JSDocParameterTag[]; - function getJSDocType(node: Node): JSDocType; - function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag; - function getJSDocReturnTag(node: Node): JSDocReturnTag; - function getJSDocTemplateTag(node: Node): JSDocTemplateTag; - function hasRestParameter(s: SignatureDeclaration): boolean; - function hasDeclaredRestParameter(s: SignatureDeclaration): boolean; - function isRestParameter(node: ParameterDeclaration): boolean; - function isDeclaredRestParam(node: ParameterDeclaration): boolean; - const enum AssignmentKind { - None = 0, - Definite = 1, - Compound = 2, - } - function getAssignmentTargetKind(node: Node): AssignmentKind; - function isAssignmentTarget(node: Node): boolean; - function isNodeDescendantOf(node: Node, ancestor: Node): boolean; - function isInAmbientContext(node: Node): boolean; - function isDeclarationName(name: Node): boolean; - function isLiteralComputedPropertyDeclarationName(node: Node): boolean; - function isIdentifierName(node: Identifier): boolean; - function isAliasSymbolDeclaration(node: Node): boolean; - function exportAssignmentIsAlias(node: ExportAssignment): boolean; - function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration | InterfaceDeclaration): ExpressionWithTypeArguments; - function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration): NodeArray; - function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; - function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; - function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; - function getAncestor(node: Node, kind: SyntaxKind): Node; - function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; - function isKeyword(token: SyntaxKind): boolean; - function isTrivia(token: SyntaxKind): boolean; - function isAsyncFunctionLike(node: Node): boolean; - function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral; - function hasDynamicName(declaration: Declaration): boolean; - function isDynamicName(name: DeclarationName): boolean; - function isWellKnownSymbolSyntactically(node: Expression): boolean; - function getPropertyNameForPropertyNameNode(name: DeclarationName | ParameterDeclaration): string; - function getPropertyNameForKnownSymbolName(symbolName: string): string; - function isESSymbolIdentifier(node: Node): boolean; - function isPushOrUnshiftIdentifier(node: Identifier): boolean; - function isModifierKind(token: SyntaxKind): boolean; - function isParameterDeclaration(node: VariableLikeDeclaration): boolean; - function getRootDeclaration(node: Node): Node; - function nodeStartsNewLexicalEnvironment(node: Node): boolean; - function nodeIsSynthesized(node: TextRange): boolean; - function getOriginalNode(node: Node): Node; - function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; - function isParseTreeNode(node: Node): boolean; - function getParseTreeNode(node: Node): Node; - function getParseTreeNode(node: Node, nodeTest?: (node: Node) => node is T): T; - function getOriginalSourceFiles(sourceFiles: SourceFile[]): SourceFile[]; - function getOriginalNodeId(node: Node): number; - const enum Associativity { - Left = 0, - Right = 1, - } - function getExpressionAssociativity(expression: Expression): Associativity; - function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity; - function getExpressionPrecedence(expression: Expression): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; - function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocAugmentsTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.RawExpression | SyntaxKind.Count; - function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; - function createDiagnosticCollection(): DiagnosticCollection; - function escapeString(s: string): string; - function isIntrinsicJsxName(name: string): boolean; - function escapeNonAsciiCharacters(s: string): string; - interface EmitTextWriter { - write(s: string): void; - writeTextOfNode(text: string, node: Node): void; - writeLine(): void; - increaseIndent(): void; - decreaseIndent(): void; - getText(): string; - rawWrite(s: string): void; - writeLiteral(s: string): void; - getTextPos(): number; - getLine(): number; - getColumn(): number; - getIndent(): number; - isAtStartOfLine(): boolean; - reset(): void; - } - function getIndentString(level: number): string; - function getIndentSize(): number; - function createTextWriter(newLine: String): EmitTextWriter; - function getResolvedExternalModuleName(host: EmitHost, file: SourceFile): string; - function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): string; - function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string; - function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string; - function getDeclarationEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost): string; - interface EmitFileNames { - jsFilePath: string; - sourceMapFilePath: string; - declarationFilePath: string; - } - function getSourceFilesToEmit(host: EmitHost, targetSourceFile?: SourceFile): SourceFile[]; - function filterSourceFilesInDirectory(sourceFiles: SourceFile[], isSourceFileFromExternalLibrary: (file: SourceFile) => boolean): SourceFile[]; - function forEachTransformedEmitFile(host: EmitHost, sourceFiles: SourceFile[], action: (jsFilePath: string, sourceMapFilePath: string, declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) => void, emitOnlyDtsFiles?: boolean): void; - function forEachExpectedEmitFile(host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFiles: SourceFile[], isBundledEmit: boolean, emitOnlyDtsFiles: boolean) => void, targetSourceFile?: SourceFile, emitOnlyDtsFiles?: boolean): void; - function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; - function writeFile(host: EmitHost, diagnostics: DiagnosticCollection, fileName: string, data: string, writeByteOrderMark: boolean, sourceFiles?: SourceFile[]): void; - function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; - function getLineOfLocalPositionFromLineMap(lineMap: number[], pos: number): number; - function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; - function getSetAccessorTypeAnnotationNode(accessor: SetAccessorDeclaration): TypeNode; - function getThisParameter(signature: SignatureDeclaration): ParameterDeclaration | undefined; - function parameterIsThisKeyword(parameter: ParameterDeclaration): boolean; - function isThisIdentifier(node: Node | undefined): boolean; - function identifierIsThisKeyword(id: Identifier): boolean; - interface AllAccessorDeclarations { - firstAccessor: AccessorDeclaration; - secondAccessor: AccessorDeclaration; - getAccessor: AccessorDeclaration; - setAccessor: AccessorDeclaration; - } - function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): AllAccessorDeclarations; - function emitNewLineBeforeLeadingComments(lineMap: number[], writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; - function emitNewLineBeforeLeadingCommentsOfPosition(lineMap: number[], writer: EmitTextWriter, pos: number, leadingComments: CommentRange[]): void; - function emitNewLineBeforeLeadingCommentOfPosition(lineMap: number[], writer: EmitTextWriter, pos: number, commentPos: number): void; - function emitComments(text: string, lineMap: number[], writer: EmitTextWriter, comments: CommentRange[], leadingSeparator: boolean, trailingSeparator: boolean, newLine: string, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void): void; - function emitDetachedComments(text: string, lineMap: number[], writer: EmitTextWriter, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean): { - nodePos: number; - detachedCommentEndPos: number; - }; - function writeCommentRange(text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string): void; - function hasModifiers(node: Node): boolean; - function hasModifier(node: Node, flags: ModifierFlags): boolean; - function getModifierFlags(node: Node): ModifierFlags; - function modifierToFlag(token: SyntaxKind): ModifierFlags; - function isLogicalOperator(token: SyntaxKind): boolean; - function isAssignmentOperator(token: SyntaxKind): boolean; - function tryGetClassExtendingExpressionWithTypeArguments(node: Node): ClassLikeDeclaration | undefined; - function isAssignmentExpression(node: Node, excludeCompoundAssignment: true): node is AssignmentExpression; - function isAssignmentExpression(node: Node, excludeCompoundAssignment?: false): node is AssignmentExpression; - function isDestructuringAssignment(node: Node): node is DestructuringAssignment; - function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean; - function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean; - function isEntityNameExpression(node: Expression): node is EntityNameExpression; - function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; - function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean; - function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; - function tryExtractTypeScriptExtension(fileName: string): string | undefined; - const stringify: (value: any) => string; - function convertToBase64(input: string): string; - function getNewLineCharacter(options: CompilerOptions): string; - function isSimpleExpression(node: Expression): boolean; - function formatSyntaxKind(kind: SyntaxKind): string; - function movePos(pos: number, value: number): number; - function createRange(pos: number, end: number): TextRange; - function moveRangeEnd(range: TextRange, end: number): TextRange; - function moveRangePos(range: TextRange, pos: number): TextRange; - function moveRangePastDecorators(node: Node): TextRange; - function moveRangePastModifiers(node: Node): TextRange; - function isCollapsedRange(range: TextRange): boolean; - function collapseRangeToStart(range: TextRange): TextRange; - function collapseRangeToEnd(range: TextRange): TextRange; - function createTokenRange(pos: number, token: SyntaxKind): TextRange; - function rangeIsOnSingleLine(range: TextRange, sourceFile: SourceFile): boolean; - function rangeStartPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeEndPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeStartIsOnSameLineAsRangeEnd(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeEndIsOnSameLineAsRangeStart(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function positionsAreOnSameLine(pos1: number, pos2: number, sourceFile: SourceFile): boolean; - function getStartPositionOfRange(range: TextRange, sourceFile: SourceFile): number; - function isDeclarationNameOfEnumOrNamespace(node: Identifier): boolean; - function getInitializedVariables(node: VariableDeclarationList): VariableDeclaration[]; - function isMergedWithClass(node: Node): boolean; - function isFirstDeclarationOfKind(node: Node, kind: SyntaxKind): boolean; - function isNodeArray(array: T[]): array is NodeArray; - function isNoSubstitutionTemplateLiteral(node: Node): node is LiteralExpression; - function isLiteralKind(kind: SyntaxKind): boolean; - function isTextualLiteralKind(kind: SyntaxKind): boolean; - function isLiteralExpression(node: Node): node is LiteralExpression; - function isTemplateLiteralKind(kind: SyntaxKind): boolean; - function isTemplateHead(node: Node): node is TemplateHead; - function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail; - function isIdentifier(node: Node): node is Identifier; - function isGeneratedIdentifier(node: Node): node is GeneratedIdentifier; - function isModifier(node: Node): node is Modifier; - function isQualifiedName(node: Node): node is QualifiedName; - function isComputedPropertyName(node: Node): node is ComputedPropertyName; - function isEntityName(node: Node): node is EntityName; - function isPropertyName(node: Node): node is PropertyName; - function isModuleName(node: Node): node is ModuleName; - function isBindingName(node: Node): node is BindingName; - function isTypeParameter(node: Node): node is TypeParameterDeclaration; - function isParameter(node: Node): node is ParameterDeclaration; - function isDecorator(node: Node): node is Decorator; - function isMethodDeclaration(node: Node): node is MethodDeclaration; - function isClassElement(node: Node): node is ClassElement; - function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; - function isTypeNode(node: Node): node is TypeNode; - function isArrayBindingPattern(node: Node): node is ArrayBindingPattern; - function isObjectBindingPattern(node: Node): node is ObjectBindingPattern; - function isBindingPattern(node: Node): node is BindingPattern; - function isAssignmentPattern(node: Node): node is AssignmentPattern; - function isBindingElement(node: Node): node is BindingElement; - function isArrayBindingElement(node: Node): node is ArrayBindingElement; - function isDeclarationBindingElement(bindingElement: BindingOrAssignmentElement): bindingElement is VariableDeclaration | ParameterDeclaration | BindingElement; - function isBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is BindingOrAssignmentPattern; - function isObjectBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ObjectBindingOrAssignmentPattern; - function isArrayBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ArrayBindingOrAssignmentPattern; - function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression; - function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression; - function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression; - function isElementAccessExpression(node: Node): node is ElementAccessExpression; - function isBinaryExpression(node: Node): node is BinaryExpression; - function isConditionalExpression(node: Node): node is ConditionalExpression; - function isCallExpression(node: Node): node is CallExpression; - function isTemplateLiteral(node: Node): node is TemplateLiteral; - function isSpreadExpression(node: Node): node is SpreadElement; - function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; - function isLeftHandSideExpression(node: Node): node is LeftHandSideExpression; - function isUnaryExpression(node: Node): node is UnaryExpression; - function isExpression(node: Node): node is Expression; - function isAssertionExpression(node: Node): node is AssertionExpression; - function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression; - function isNotEmittedStatement(node: Node): node is NotEmittedStatement; - function isNotEmittedOrPartiallyEmittedNode(node: Node): node is NotEmittedStatement | PartiallyEmittedExpression; - function isOmittedExpression(node: Node): node is OmittedExpression; - function isTemplateSpan(node: Node): node is TemplateSpan; - function isBlock(node: Node): node is Block; - function isConciseBody(node: Node): node is ConciseBody; - function isFunctionBody(node: Node): node is FunctionBody; - function isForInitializer(node: Node): node is ForInitializer; - function isVariableDeclaration(node: Node): node is VariableDeclaration; - function isVariableDeclarationList(node: Node): node is VariableDeclarationList; - function isCaseBlock(node: Node): node is CaseBlock; - function isModuleBody(node: Node): node is ModuleBody; - function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration; - function isImportClause(node: Node): node is ImportClause; - function isNamedImportBindings(node: Node): node is NamedImportBindings; - function isImportSpecifier(node: Node): node is ImportSpecifier; - function isNamedExports(node: Node): node is NamedExports; - function isExportSpecifier(node: Node): node is ExportSpecifier; - function isModuleOrEnumDeclaration(node: Node): node is ModuleDeclaration | EnumDeclaration; - function isDeclaration(node: Node): node is Declaration; - function isDeclarationStatement(node: Node): node is DeclarationStatement; - function isStatementButNotDeclaration(node: Node): node is Statement; - function isStatement(node: Node): node is Statement; - function isModuleReference(node: Node): node is ModuleReference; - function isJsxOpeningElement(node: Node): node is JsxOpeningElement; - function isJsxClosingElement(node: Node): node is JsxClosingElement; - function isJsxTagNameExpression(node: Node): node is JsxTagNameExpression; - function isJsxChild(node: Node): node is JsxChild; - function isJsxAttributeLike(node: Node): node is JsxAttributeLike; - function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute; - function isJsxAttribute(node: Node): node is JsxAttribute; - function isStringLiteralOrJsxExpression(node: Node): node is StringLiteral | JsxExpression; - function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause; - function isHeritageClause(node: Node): node is HeritageClause; - function isCatchClause(node: Node): node is CatchClause; - function isPropertyAssignment(node: Node): node is PropertyAssignment; - function isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment; - function isEnumMember(node: Node): node is EnumMember; - function isSourceFile(node: Node): node is SourceFile; - function isWatchSet(options: CompilerOptions): boolean; -} -declare namespace ts { - function getDefaultLibFileName(options: CompilerOptions): string; - function textSpanEnd(span: TextSpan): number; - function textSpanIsEmpty(span: TextSpan): boolean; - function textSpanContainsPosition(span: TextSpan, position: number): boolean; - function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean; - function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean; - function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan; - function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean; - function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean; - function decodedTextSpanIntersectsWith(start1: number, length1: number, start2: number, length2: number): boolean; - function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean; - function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan; - function createTextSpan(start: number, length: number): TextSpan; - function createTextSpanFromBounds(start: number, end: number): TextSpan; - function textChangeRangeNewSpan(range: TextChangeRange): TextSpan; - function textChangeRangeIsUnchanged(range: TextChangeRange): boolean; - function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange; - let unchangedTextChangeRange: TextChangeRange; - function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; - function getTypeParameterOwner(d: Declaration): Declaration; - function isParameterPropertyDeclaration(node: Node): boolean; - function getCombinedModifierFlags(node: Node): ModifierFlags; - function getCombinedNodeFlags(node: Node): NodeFlags; - function validateLocaleAndSetLanguage(locale: string, sys: { - getExecutingFilePath(): string; - resolvePath(path: string): string; - fileExists(fileName: string): boolean; - readFile(fileName: string): string; - }, errors?: Diagnostic[]): void; -} -declare namespace ts { - function updateNode(updated: T, original: T): T; - function createNodeArray(elements?: T[], location?: TextRange, hasTrailingComma?: boolean): NodeArray; - function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node; - function createSynthesizedNodeArray(elements?: T[]): NodeArray; - function getSynthesizedClone(node: T): T; - function getMutableClone(node: T): T; - function createLiteral(textSource: StringLiteral | NumericLiteral | Identifier, location?: TextRange): StringLiteral; - function createLiteral(value: string, location?: TextRange): StringLiteral; - function createLiteral(value: number, location?: TextRange): NumericLiteral; - function createLiteral(value: boolean, location?: TextRange): BooleanLiteral; - function createLiteral(value: string | number | boolean, location?: TextRange): PrimaryExpression; - function createIdentifier(text: string, location?: TextRange): Identifier; - function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, location?: TextRange): Identifier; - function createLoopVariable(location?: TextRange): Identifier; - function createUniqueName(text: string, location?: TextRange): Identifier; - function getGeneratedNameForNode(node: Node, location?: TextRange): Identifier; - function createToken(token: TKind): Token; - function createSuper(): PrimaryExpression; - function createThis(location?: TextRange): PrimaryExpression; - function createNull(): PrimaryExpression; - function createComputedPropertyName(expression: Expression, location?: TextRange): ComputedPropertyName; - function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; - function createParameter(decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: string | Identifier | BindingPattern, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): ParameterDeclaration; - function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: BindingName, type: TypeNode, initializer: Expression): ParameterDeclaration; - function createProperty(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, questionToken: QuestionToken, type: TypeNode, initializer: Expression, location?: TextRange): PropertyDeclaration; - function updateProperty(node: PropertyDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, type: TypeNode, initializer: Expression): PropertyDeclaration; - function createMethod(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): MethodDeclaration; - function updateMethod(node: MethodDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): MethodDeclaration; - function createConstructor(decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block, location?: TextRange, flags?: NodeFlags): ConstructorDeclaration; - function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block): ConstructorDeclaration; - function createGetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): GetAccessorDeclaration; - function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block): GetAccessorDeclaration; - function createSetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], body: Block, location?: TextRange, flags?: NodeFlags): SetAccessorDeclaration; - function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], body: Block): SetAccessorDeclaration; - function createObjectBindingPattern(elements: BindingElement[], location?: TextRange): ObjectBindingPattern; - function updateObjectBindingPattern(node: ObjectBindingPattern, elements: BindingElement[]): ObjectBindingPattern; - function createArrayBindingPattern(elements: ArrayBindingElement[], location?: TextRange): ArrayBindingPattern; - function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern; - function createBindingElement(propertyName: string | PropertyName, dotDotDotToken: DotDotDotToken, name: string | BindingName, initializer?: Expression, location?: TextRange): BindingElement; - function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken, propertyName: PropertyName, name: BindingName, initializer: Expression): BindingElement; - function createArrayLiteral(elements?: Expression[], location?: TextRange, multiLine?: boolean): ArrayLiteralExpression; - function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression; - function createObjectLiteral(properties?: ObjectLiteralElementLike[], location?: TextRange, multiLine?: boolean): ObjectLiteralExpression; - function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElementLike[]): ObjectLiteralExpression; - function createPropertyAccess(expression: Expression, name: string | Identifier, location?: TextRange, flags?: NodeFlags): PropertyAccessExpression; - function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression; - function createElementAccess(expression: Expression, index: number | Expression, location?: TextRange): ElementAccessExpression; - function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; - function createCall(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[], location?: TextRange, flags?: NodeFlags): CallExpression; - function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]): CallExpression; - function createNew(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[], location?: TextRange, flags?: NodeFlags): NewExpression; - function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]): NewExpression; - function createTaggedTemplate(tag: Expression, template: TemplateLiteral, location?: TextRange): TaggedTemplateExpression; - function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; - function createParen(expression: Expression, location?: TextRange): ParenthesizedExpression; - function updateParen(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression; - function createFunctionExpression(modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): FunctionExpression; - function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): FunctionExpression; - function createArrowFunction(modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody, location?: TextRange, flags?: NodeFlags): ArrowFunction; - function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: ConciseBody): ArrowFunction; - function createDelete(expression: Expression, location?: TextRange): DeleteExpression; - function updateDelete(node: DeleteExpression, expression: Expression): Expression; - function createTypeOf(expression: Expression, location?: TextRange): TypeOfExpression; - function updateTypeOf(node: TypeOfExpression, expression: Expression): Expression; - function createVoid(expression: Expression, location?: TextRange): VoidExpression; - function updateVoid(node: VoidExpression, expression: Expression): VoidExpression; - function createAwait(expression: Expression, location?: TextRange): AwaitExpression; - function updateAwait(node: AwaitExpression, expression: Expression): AwaitExpression; - function createPrefix(operator: PrefixUnaryOperator, operand: Expression, location?: TextRange): PrefixUnaryExpression; - function updatePrefix(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression; - function createPostfix(operand: Expression, operator: PostfixUnaryOperator, location?: TextRange): PostfixUnaryExpression; - function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; - function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression, location?: TextRange): BinaryExpression; - function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression; - function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression, location?: TextRange): ConditionalExpression; - function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression, location?: TextRange): ConditionalExpression; - function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; - function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[], location?: TextRange): TemplateExpression; - function updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; - function createYield(asteriskToken: AsteriskToken, expression: Expression, location?: TextRange): YieldExpression; - function updateYield(node: YieldExpression, expression: Expression): YieldExpression; - function createSpread(expression: Expression, location?: TextRange): SpreadElement; - function updateSpread(node: SpreadElement, expression: Expression): SpreadElement; - function createClassExpression(modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[], location?: TextRange): ClassExpression; - function updateClassExpression(node: ClassExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; - function createOmittedExpression(location?: TextRange): OmittedExpression; - function createExpressionWithTypeArguments(typeArguments: TypeNode[], expression: Expression, location?: TextRange): ExpressionWithTypeArguments; - function updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; - function createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail, location?: TextRange): TemplateSpan; - function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; - function createBlock(statements: Statement[], location?: TextRange, multiLine?: boolean, flags?: NodeFlags): Block; - function updateBlock(node: Block, statements: Statement[]): Block; - function createVariableStatement(modifiers: Modifier[], declarationList: VariableDeclarationList | VariableDeclaration[], location?: TextRange, flags?: NodeFlags): VariableStatement; - function updateVariableStatement(node: VariableStatement, modifiers: Modifier[], declarationList: VariableDeclarationList): VariableStatement; - function createVariableDeclarationList(declarations: VariableDeclaration[], location?: TextRange, flags?: NodeFlags): VariableDeclarationList; - function updateVariableDeclarationList(node: VariableDeclarationList, declarations: VariableDeclaration[]): VariableDeclarationList; - function createVariableDeclaration(name: string | BindingPattern | Identifier, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): VariableDeclaration; - function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode, initializer: Expression): VariableDeclaration; - function createEmptyStatement(location: TextRange): EmptyStatement; - function createStatement(expression: Expression, location?: TextRange, flags?: NodeFlags): ExpressionStatement; - function updateStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; - function createIf(expression: Expression, thenStatement: Statement, elseStatement?: Statement, location?: TextRange): IfStatement; - function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement): IfStatement; - function createDo(statement: Statement, expression: Expression, location?: TextRange): DoStatement; - function updateDo(node: DoStatement, statement: Statement, expression: Expression): DoStatement; - function createWhile(expression: Expression, statement: Statement, location?: TextRange): WhileStatement; - function updateWhile(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement; - function createFor(initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement, location?: TextRange): ForStatement; - function updateFor(node: ForStatement, initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement): ForStatement; - function createForIn(initializer: ForInitializer, expression: Expression, statement: Statement, location?: TextRange): ForInStatement; - function updateForIn(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; - function createForOf(initializer: ForInitializer, expression: Expression, statement: Statement, location?: TextRange): ForOfStatement; - function updateForOf(node: ForOfStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; - function createContinue(label?: Identifier, location?: TextRange): ContinueStatement; - function updateContinue(node: ContinueStatement, label: Identifier): ContinueStatement; - function createBreak(label?: Identifier, location?: TextRange): BreakStatement; - function updateBreak(node: BreakStatement, label: Identifier): BreakStatement; - function createReturn(expression?: Expression, location?: TextRange): ReturnStatement; - function updateReturn(node: ReturnStatement, expression: Expression): ReturnStatement; - function createWith(expression: Expression, statement: Statement, location?: TextRange): WithStatement; - function updateWith(node: WithStatement, expression: Expression, statement: Statement): WithStatement; - function createSwitch(expression: Expression, caseBlock: CaseBlock, location?: TextRange): SwitchStatement; - function updateSwitch(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement; - function createLabel(label: string | Identifier, statement: Statement, location?: TextRange): LabeledStatement; - function updateLabel(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement; - function createThrow(expression: Expression, location?: TextRange): ThrowStatement; - function updateThrow(node: ThrowStatement, expression: Expression): ThrowStatement; - function createTry(tryBlock: Block, catchClause: CatchClause, finallyBlock: Block, location?: TextRange): TryStatement; - function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause, finallyBlock: Block): TryStatement; - function createCaseBlock(clauses: CaseOrDefaultClause[], location?: TextRange): CaseBlock; - function updateCaseBlock(node: CaseBlock, clauses: CaseOrDefaultClause[]): CaseBlock; - function createFunctionDeclaration(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): FunctionDeclaration; - function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): FunctionDeclaration; - function createClassDeclaration(decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[], location?: TextRange): ClassDeclaration; - function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; - function createImportDeclaration(decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier?: Expression, location?: TextRange): ImportDeclaration; - function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier: Expression): ImportDeclaration; - function createImportClause(name: Identifier, namedBindings: NamedImportBindings, location?: TextRange): ImportClause; - function updateImportClause(node: ImportClause, name: Identifier, namedBindings: NamedImportBindings): ImportClause; - function createNamespaceImport(name: Identifier, location?: TextRange): NamespaceImport; - function updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; - function createNamedImports(elements: ImportSpecifier[], location?: TextRange): NamedImports; - function updateNamedImports(node: NamedImports, elements: ImportSpecifier[]): NamedImports; - function createImportSpecifier(propertyName: Identifier, name: Identifier, location?: TextRange): ImportSpecifier; - function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier, name: Identifier): ImportSpecifier; - function createExportAssignment(decorators: Decorator[], modifiers: Modifier[], isExportEquals: boolean, expression: Expression, location?: TextRange): ExportAssignment; - function updateExportAssignment(node: ExportAssignment, decorators: Decorator[], modifiers: Modifier[], expression: Expression): ExportAssignment; - function createExportDeclaration(decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier?: Expression, location?: TextRange): ExportDeclaration; - function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier: Expression): ExportDeclaration; - function createNamedExports(elements: ExportSpecifier[], location?: TextRange): NamedExports; - function updateNamedExports(node: NamedExports, elements: ExportSpecifier[]): NamedExports; - function createExportSpecifier(name: string | Identifier, propertyName?: string | Identifier, location?: TextRange): ExportSpecifier; - function updateExportSpecifier(node: ExportSpecifier, name: Identifier, propertyName: Identifier): ExportSpecifier; - function createJsxElement(openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement, location?: TextRange): JsxElement; - function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; - function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributeLike[], location?: TextRange): JsxSelfClosingElement; - function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributeLike[]): JsxSelfClosingElement; - function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributeLike[], location?: TextRange): JsxOpeningElement; - function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributeLike[]): JsxOpeningElement; - function createJsxClosingElement(tagName: JsxTagNameExpression, location?: TextRange): JsxClosingElement; - function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; - function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression, location?: TextRange): JsxAttribute; - function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; - function createJsxSpreadAttribute(expression: Expression, location?: TextRange): JsxSpreadAttribute; - function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; - function createJsxExpression(expression: Expression, location?: TextRange): JsxExpression; - function updateJsxExpression(node: JsxExpression, expression: Expression): JsxExpression; - function createHeritageClause(token: SyntaxKind, types: ExpressionWithTypeArguments[], location?: TextRange): HeritageClause; - function updateHeritageClause(node: HeritageClause, types: ExpressionWithTypeArguments[]): HeritageClause; - function createCaseClause(expression: Expression, statements: Statement[], location?: TextRange): CaseClause; - function updateCaseClause(node: CaseClause, expression: Expression, statements: Statement[]): CaseClause; - function createDefaultClause(statements: Statement[], location?: TextRange): DefaultClause; - function updateDefaultClause(node: DefaultClause, statements: Statement[]): DefaultClause; - function createCatchClause(variableDeclaration: string | VariableDeclaration, block: Block, location?: TextRange): CatchClause; - function updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration, block: Block): CatchClause; - function createPropertyAssignment(name: string | PropertyName, initializer: Expression, location?: TextRange): PropertyAssignment; - function updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment; - function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer: Expression, location?: TextRange): ShorthandPropertyAssignment; - function createSpreadAssignment(expression: Expression, location?: TextRange): SpreadAssignment; - function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression): ShorthandPropertyAssignment; - function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; - function updateSourceFileNode(node: SourceFile, statements: Statement[]): SourceFile; - function createNotEmittedStatement(original: Node): NotEmittedStatement; - function createEndOfDeclarationMarker(original: Node): EndOfDeclarationMarker; - function createMergeDeclarationMarker(original: Node): MergeDeclarationMarker; - function createPartiallyEmittedExpression(expression: Expression, original?: Node, location?: TextRange): PartiallyEmittedExpression; - function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; - function createRawExpression(text: string): RawExpression; - function createComma(left: Expression, right: Expression): Expression; - function createLessThan(left: Expression, right: Expression, location?: TextRange): Expression; - function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression, location?: TextRange): DestructuringAssignment; - function createAssignment(left: Expression, right: Expression, location?: TextRange): BinaryExpression; - function createStrictEquality(left: Expression, right: Expression): BinaryExpression; - function createStrictInequality(left: Expression, right: Expression): BinaryExpression; - function createAdd(left: Expression, right: Expression): BinaryExpression; - function createSubtract(left: Expression, right: Expression): BinaryExpression; - function createPostfixIncrement(operand: Expression, location?: TextRange): PostfixUnaryExpression; - function createLogicalAnd(left: Expression, right: Expression): BinaryExpression; - function createLogicalOr(left: Expression, right: Expression): BinaryExpression; - function createLogicalNot(operand: Expression): PrefixUnaryExpression; - function createVoidZero(): VoidExpression; - type TypeOfTag = "undefined" | "number" | "boolean" | "string" | "symbol" | "object" | "function"; - function createTypeCheck(value: Expression, tag: TypeOfTag): BinaryExpression; - function createMemberAccessForPropertyName(target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression; - function createFunctionCall(func: Expression, thisArg: Expression, argumentsList: Expression[], location?: TextRange): CallExpression; - function createFunctionApply(func: Expression, thisArg: Expression, argumentsExpression: Expression, location?: TextRange): CallExpression; - function createArraySlice(array: Expression, start?: number | Expression): CallExpression; - function createArrayConcat(array: Expression, values: Expression[]): CallExpression; - function createMathPow(left: Expression, right: Expression, location?: TextRange): CallExpression; - function createExpressionForJsxElement(jsxFactoryEntity: EntityName, reactNamespace: string, tagName: Expression, props: Expression, children: Expression[], parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression; - function createExportDefault(expression: Expression): ExportAssignment; - function createExternalModuleExport(exportName: Identifier): ExportDeclaration; - function createLetStatement(name: Identifier, initializer: Expression, location?: TextRange): VariableStatement; - function createLetDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; - function createConstDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; - function getHelperName(name: string): Identifier; - interface CallBinding { - target: LeftHandSideExpression; - thisArg: Expression; - } - function createCallBinding(expression: Expression, recordTempVariable: (temp: Identifier) => void, languageVersion?: ScriptTarget, cacheIdentifiers?: boolean): CallBinding; - function inlineExpressions(expressions: Expression[]): Expression; - function createExpressionFromEntityName(node: EntityName | Expression): Expression; - function createExpressionForPropertyName(memberName: PropertyName): Expression; - function createExpressionForObjectLiteralElementLike(node: ObjectLiteralExpression, property: ObjectLiteralElementLike, receiver: Expression): Expression; - function getLocalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - function isLocalName(node: Identifier): boolean; - function getExportName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - function isExportName(node: Identifier): boolean; - function getDeclarationName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - function getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression; - function getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression; - function convertToFunctionBody(node: ConciseBody, multiLine?: boolean): Block; - function addPrologueDirectives(target: Statement[], source: Statement[], ensureUseStrict?: boolean, visitor?: (node: Node) => VisitResult): number; - function startsWithUseStrict(statements: Statement[]): boolean; - function ensureUseStrict(statements: NodeArray): NodeArray; - function parenthesizeBinaryOperand(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand?: Expression): Expression; - function parenthesizeForConditionalHead(condition: Expression): Expression; - function parenthesizeForNew(expression: Expression): LeftHandSideExpression; - function parenthesizeForAccess(expression: Expression): LeftHandSideExpression; - function parenthesizePostfixOperand(operand: Expression): LeftHandSideExpression; - function parenthesizePrefixOperand(operand: Expression): UnaryExpression; - function parenthesizeExpressionForList(expression: Expression): Expression; - function parenthesizeExpressionForExpressionStatement(expression: Expression): Expression; - function parenthesizeConciseBody(body: ConciseBody): ConciseBody; - const enum OuterExpressionKinds { - Parentheses = 1, - Assertions = 2, - PartiallyEmittedExpressions = 4, - All = 7, - } - function skipOuterExpressions(node: Expression, kinds?: OuterExpressionKinds): Expression; - function skipOuterExpressions(node: Node, kinds?: OuterExpressionKinds): Node; - function skipParentheses(node: Expression): Expression; - function skipParentheses(node: Node): Node; - function skipAssertions(node: Expression): Expression; - function skipAssertions(node: Node): Node; - function skipPartiallyEmittedExpressions(node: Expression): Expression; - function skipPartiallyEmittedExpressions(node: Node): Node; - function startOnNewLine(node: T): T; - function setOriginalNode(node: T, original: Node): T; - function disposeEmitNodes(sourceFile: SourceFile): void; - function getOrCreateEmitNode(node: Node): EmitNode; - function getEmitFlags(node: Node): EmitFlags; - function setEmitFlags(node: T, emitFlags: EmitFlags): T; - function getSourceMapRange(node: Node): TextRange; - function setSourceMapRange(node: T, range: TextRange): T; - function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange; - function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange): T; - function getCommentRange(node: Node): TextRange; - function setCommentRange(node: T, range: TextRange): T; - function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; - function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression; - function getExternalHelpersModuleName(node: SourceFile): Identifier; - function getOrCreateExternalHelpersModuleNameIfNeeded(node: SourceFile, compilerOptions: CompilerOptions): Identifier; - function addEmitHelper(node: T, helper: EmitHelper): T; - function addEmitHelpers(node: T, helpers: EmitHelper[] | undefined): T; - function removeEmitHelper(node: Node, helper: EmitHelper): boolean; - function getEmitHelpers(node: Node): EmitHelper[] | undefined; - function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; - function compareEmitHelpers(x: EmitHelper, y: EmitHelper): Comparison; - function setTextRange(node: T, location: TextRange): T; - function setNodeFlags(node: T, flags: NodeFlags): T; - function setMultiLine(node: T, multiLine: boolean): T; - function setHasTrailingComma(nodes: NodeArray, hasTrailingComma: boolean): NodeArray; - function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile): Identifier; - function getExternalModuleNameLiteral(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions): StringLiteral; - function tryGetModuleNameFromFile(file: SourceFile, host: EmitHost, options: CompilerOptions): StringLiteral; - function getInitializerOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): Expression | undefined; - function getTargetOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementTarget; - function getRestIndicatorOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementRestIndicator; - function getPropertyNameOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): PropertyName; - function getElementsOfBindingOrAssignmentPattern(name: BindingOrAssignmentPattern): BindingOrAssignmentElement[]; - function convertToArrayAssignmentElement(element: BindingOrAssignmentElement): Expression; - function convertToObjectAssignmentElement(element: BindingOrAssignmentElement): ObjectLiteralElementLike; - function convertToAssignmentPattern(node: BindingOrAssignmentPattern): AssignmentPattern; - function convertToObjectAssignmentPattern(node: ObjectBindingOrAssignmentPattern): ObjectLiteralExpression; - function convertToArrayAssignmentPattern(node: ArrayBindingOrAssignmentPattern): ArrayLiteralExpression; - function convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression; - interface ExternalModuleInfo { - externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; - externalHelpersImportDeclaration: ImportDeclaration | undefined; - exportSpecifiers: Map; - exportedBindings: Map; - exportedNames: Identifier[]; - exportEquals: ExportAssignment | undefined; - hasExportStarsToExportValues: boolean; - } - function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo; -} -declare namespace ts { - function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; - function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; - function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile; - function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName; - function isExternalModule(file: SourceFile): boolean; - function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function parseIsolatedJSDocComment(content: string, start?: number, length?: number): { - jsDoc: JSDoc; - diagnostics: Diagnostic[]; - }; - function parseJSDocTypeExpressionForTests(content: string, start?: number, length?: number): { - jsDocTypeExpression: JSDocTypeExpression; - diagnostics: Diagnostic[]; - }; -} -declare namespace ts { - const enum ModuleInstanceState { - NonInstantiated = 0, - Instantiated = 1, - ConstEnumOnly = 2, - } - function getModuleInstanceState(node: Node): ModuleInstanceState; - function bindSourceFile(file: SourceFile, options: CompilerOptions): void; - function computeTransformFlagsForNode(node: Node, subtreeFlags: TransformFlags): TransformFlags; - function getTransformFlagsSubtreeExclusions(kind: SyntaxKind): TransformFlags; -} -declare namespace ts { - function getNodeId(node: Node): number; - function getSymbolId(symbol: Symbol): number; - function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; -} -declare namespace ts { - type VisitResult = T | T[]; - function reduceEachChild(node: Node, initial: T, cbNode: (memo: T, node: Node) => T, cbNodeArray?: (memo: T, nodes: Node[]) => T): T; - function visitNode(node: T, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, optional?: boolean, lift?: (node: NodeArray) => T): T; - function visitNode(node: T, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, optional: boolean, lift: (node: NodeArray) => T, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): T; - function visitNodes(nodes: NodeArray, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, start?: number, count?: number): NodeArray; - function visitNodes(nodes: NodeArray, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, start: number, count: number, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): NodeArray; - function visitLexicalEnvironment(statements: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray; - function visitParameterList(nodes: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext): NodeArray; - function visitFunctionBody(node: FunctionBody, visitor: (node: Node) => VisitResult, context: TransformationContext): FunctionBody; - function visitFunctionBody(node: ConciseBody, visitor: (node: Node) => VisitResult, context: TransformationContext): ConciseBody; - function visitEachChild(node: T, visitor: (node: Node) => VisitResult, context: TransformationContext): T; - function mergeLexicalEnvironment(statements: NodeArray, declarations: Statement[]): NodeArray; - function mergeLexicalEnvironment(statements: Statement[], declarations: Statement[]): Statement[]; - function mergeFunctionBodyLexicalEnvironment(body: FunctionBody, declarations: Statement[]): FunctionBody; - function mergeFunctionBodyLexicalEnvironment(body: ConciseBody, declarations: Statement[]): ConciseBody; - function liftToBlock(nodes: Node[]): Statement; - function aggregateTransformFlags(node: T): T; - namespace Debug { - const failNotOptional: typeof noop; - const failBadSyntaxKind: (node: Node, message?: string) => void; - const assertEachNode: (nodes: Node[], test: (node: Node) => boolean, message?: string) => void; - const assertNode: (node: Node, test: (node: Node) => boolean, message?: string) => void; - const assertOptionalNode: (node: Node, test: (node: Node) => boolean, message?: string) => void; - const assertOptionalToken: (node: Node, kind: SyntaxKind, message?: string) => void; - const assertMissingNode: (node: Node, message?: string) => void; + interface ReferencesResponseBody { + refs: ReferencesResponseItem[]; + symbolName: string; + symbolStartOffset: number; + symbolDisplayString: string; } -} -declare namespace ts { - const enum FlattenLevel { - All = 0, - ObjectRest = 1, + interface ReferencesResponse extends Response { + body?: ReferencesResponseBody; } - function flattenDestructuringAssignment(node: VariableDeclaration | DestructuringAssignment, visitor: ((node: Node) => VisitResult) | undefined, context: TransformationContext, level: FlattenLevel, needsValue?: boolean, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression): Expression; - function flattenDestructuringBinding(node: VariableDeclaration | ParameterDeclaration, visitor: (node: Node) => VisitResult, context: TransformationContext, level: FlattenLevel, rval?: Expression, hoistTempVariables?: boolean, skipInitializer?: boolean): VariableDeclaration[]; -} -declare namespace ts { - function transformTypeScript(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformESNext(context: TransformationContext): (node: SourceFile) => SourceFile; - function createAssignHelper(context: TransformationContext, attributesSegments: Expression[]): CallExpression; -} -declare namespace ts { - function transformJsx(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2017(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2016(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2015(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformGenerators(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES5(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformModule(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformSystemModule(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2015Module(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function getTransformers(compilerOptions: CompilerOptions): Transformer[]; - function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]): TransformationResult; -} -declare namespace ts { - function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[]; - function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection, emitOnlyDtsFiles: boolean): boolean; -} -declare namespace ts { - interface SourceMapWriter { - initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void; - reset(): void; - setSourceFile(sourceFile: SourceFile): void; - emitPos(pos: number): void; - emitNodeWithSourceMap(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - emitTokenWithSourceMap(node: Node, token: SyntaxKind, tokenStartPos: number, emitCallback: (token: SyntaxKind, tokenStartPos: number) => number): number; - getText(): string; - getSourceMappingURL(): string; - getSourceMapData(): SourceMapData; + interface RenameRequestArgs extends FileLocationRequestArgs { + findInComments?: boolean; + findInStrings?: boolean; + } + interface RenameRequest extends FileLocationRequest { + command: CommandTypes.Rename; + arguments: RenameRequestArgs; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage?: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; } - function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter; -} -declare namespace ts { - interface CommentWriter { - reset(): void; - setSourceFile(sourceFile: SourceFile): void; - emitNodeWithComments(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - emitBodyWithDetachedComments(node: Node, detachedRange: TextRange, emitCallback: (node: Node) => void): void; - emitTrailingCommentsOfPosition(pos: number): void; - } - function createCommentWriter(host: EmitHost, writer: EmitTextWriter, sourceMap: SourceMapWriter): CommentWriter; -} -declare namespace ts { - function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitResult; -} -declare namespace ts { - function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; - function resolveTripleslashReference(moduleName: string, containingFile: string): string; - function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: (fileName: string) => string): string; - function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; - function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - interface FormatDiagnosticsHost { - getCurrentDirectory(): string; - getCanonicalFileName(fileName: string): string; - getNewLine(): string; + interface SpanGroup { + file: string; + locs: TextSpan[]; } - function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string; - function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; - function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; - function getResolutionDiagnostic(options: CompilerOptions, {extension}: ResolvedModuleFull): DiagnosticMessage | undefined; -} -declare namespace ts { - interface Node { - getSourceFile(): SourceFile; - getChildCount(sourceFile?: SourceFile): number; - getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): Node[]; - getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; - getFullStart(): number; - getEnd(): number; - getWidth(sourceFile?: SourceFile): number; - getFullWidth(): number; - getLeadingTriviaWidth(sourceFile?: SourceFile): number; - getFullText(sourceFile?: SourceFile): string; - getText(sourceFile?: SourceFile): string; - getFirstToken(sourceFile?: SourceFile): Node; - getLastToken(sourceFile?: SourceFile): Node; + interface RenameResponseBody { + info: RenameInfo; + locs: SpanGroup[]; } - interface Symbol { - getFlags(): SymbolFlags; - getName(): string; - getDeclarations(): Declaration[]; - getDocumentationComment(): SymbolDisplayPart[]; + interface RenameResponse extends Response { + body?: RenameResponseBody; } - interface Type { - getFlags(): TypeFlags; - getSymbol(): Symbol; - getProperties(): Symbol[]; - getProperty(propertyName: string): Symbol; - getApparentProperties(): Symbol[]; - getCallSignatures(): Signature[]; - getConstructSignatures(): Signature[]; - getStringIndexType(): Type; - getNumberIndexType(): Type; - getBaseTypes(): ObjectType[]; - getNonNullableType(): Type; + interface ExternalFile { + fileName: string; + scriptKind?: ScriptKindName | ts.ScriptKind; + hasMixedContent?: boolean; + content?: string; } - interface Signature { - getDeclaration(): SignatureDeclaration; - getTypeParameters(): Type[]; - getParameters(): Symbol[]; - getReturnType(): Type; - getDocumentationComment(): SymbolDisplayPart[]; + interface ExternalProject { + projectFileName: string; + rootFiles: ExternalFile[]; + options: ExternalProjectCompilerOptions; + typingOptions?: TypeAcquisition; + typeAcquisition?: TypeAcquisition; } - interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map; - getNamedDeclarations(): Map; - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - getLineEndOfPosition(pos: number): number; - getLineStarts(): number[]; - getPositionOfLineAndCharacter(line: number, character: number): number; - update(newText: string, textChangeRange: TextChangeRange): SourceFile; + interface CompileOnSaveMixin { + compileOnSave?: boolean; } - interface IScriptSnapshot { - getText(start: number, end: number): string; - getLength(): number; - getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; - dispose?(): void; + type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin; + interface ProjectChanges { + added: string[]; + removed: string[]; + updated: string[]; } - namespace ScriptSnapshot { - function fromString(text: string): IScriptSnapshot; + interface ConfigureRequestArguments { + hostInfo?: string; + file?: string; + formatOptions?: FormatCodeSettings; + extraFileExtensions?: JsFileExtensionInfo[]; } - interface PreProcessedFileInfo { - referencedFiles: FileReference[]; - typeReferenceDirectives: FileReference[]; - importedFiles: FileReference[]; - ambientExternalModules: string[]; - isLibFile: boolean; + interface ConfigureRequest extends Request { + command: CommandTypes.Configure; + arguments: ConfigureRequestArguments; } - interface HostCancellationToken { - isCancellationRequested(): boolean; + interface ConfigureResponse extends Response { } - interface LanguageServiceHost { - getCompilationSettings(): CompilerOptions; - getNewLine?(): string; - getProjectVersion?(): string; - getScriptFileNames(): string[]; - getScriptKind?(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): IScriptSnapshot | undefined; - getLocalizedDiagnosticMessages?(): any; - getCancellationToken?(): HostCancellationToken; - getCurrentDirectory(): string; - getDefaultLibFileName(options: CompilerOptions): string; - log?(s: string): void; - trace?(s: string): void; - error?(s: string): void; - useCaseSensitiveFileNames?(): boolean; - readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; - readFile?(path: string, encoding?: string): string; - fileExists?(path: string): boolean; - getTypeRootsVersion?(): number; - resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; - resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - directoryExists?(directoryName: string): boolean; - getDirectories?(directoryName: string): string[]; + interface OpenRequestArgs extends FileRequestArgs { + fileContent?: string; + scriptKindName?: ScriptKindName; } - interface LanguageService { - cleanupSemanticCache(): void; - getSyntacticDiagnostics(fileName: string): Diagnostic[]; - getSemanticDiagnostics(fileName: string): Diagnostic[]; - getCompilerOptionsDiagnostics(): Diagnostic[]; - getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; - getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; - getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; - getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; - getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; - getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; - getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol; - getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; - getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; - getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; - getRenameInfo(fileName: string, position: number): RenameInfo; - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; - getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; - getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; - getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[]; - getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - findReferences(fileName: string, position: number): ReferencedSymbol[]; - getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[]; - getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[]; - getNavigationBarItems(fileName: string): NavigationBarItem[]; - getNavigationTree(fileName: string): NavigationTree; - getOutliningSpans(fileName: string): OutliningSpan[]; - getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; - getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; - getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number; - getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; - getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; - getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; - isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[]; - getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; - getProgram(): Program; - getNonBoundSourceFile(fileName: string): SourceFile; - getSourceFile(fileName: string): SourceFile; - dispose(): void; + type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; + interface OpenRequest extends Request { + command: CommandTypes.Open; + arguments: OpenRequestArgs; } - interface Classifications { - spans: number[]; - endOfLineState: EndOfLineState; + interface OpenExternalProjectRequest extends Request { + command: CommandTypes.OpenExternalProject; + arguments: OpenExternalProjectArgs; } - interface ClassifiedSpan { - textSpan: TextSpan; - classificationType: string; + type OpenExternalProjectArgs = ExternalProject; + interface OpenExternalProjectsRequest extends Request { + command: CommandTypes.OpenExternalProjects; + arguments: OpenExternalProjectsArgs; } - interface NavigationBarItem { - text: string; - kind: string; - kindModifiers: string; - spans: TextSpan[]; - childItems: NavigationBarItem[]; - indent: number; - bolded: boolean; - grayed: boolean; + interface OpenExternalProjectsArgs { + projects: ExternalProject[]; } - interface NavigationTree { - text: string; - kind: string; - kindModifiers: string; - spans: TextSpan[]; - childItems?: NavigationTree[]; + interface OpenExternalProjectResponse extends Response { } - interface TodoCommentDescriptor { - text: string; - priority: number; + interface OpenExternalProjectsResponse extends Response { } - interface TodoComment { - descriptor: TodoCommentDescriptor; - message: string; - position: number; + interface CloseExternalProjectRequest extends Request { + command: CommandTypes.CloseExternalProject; + arguments: CloseExternalProjectRequestArgs; } - class TextChange { - span: TextSpan; - newText: string; + interface CloseExternalProjectRequestArgs { + projectFileName: string; } - interface FileTextChanges { - fileName: string; - textChanges: TextChange[]; + interface CloseExternalProjectResponse extends Response { } - interface CodeAction { - description: string; - changes: FileTextChanges[]; + interface SetCompilerOptionsForInferredProjectsRequest extends Request { + command: CommandTypes.CompilerOptionsForInferredProjects; + arguments: SetCompilerOptionsForInferredProjectsArgs; } - interface TextInsertion { - newText: string; - caretOffset: number; + interface SetCompilerOptionsForInferredProjectsArgs { + options: ExternalProjectCompilerOptions; + } + interface SetCompilerOptionsForInferredProjectsResponse extends Response { + } + interface ExitRequest extends Request { + command: CommandTypes.Exit; + } + interface CloseRequest extends FileRequest { + command: CommandTypes.Close; } - interface RenameLocation { - textSpan: TextSpan; - fileName: string; + interface CompileOnSaveAffectedFileListRequest extends FileRequest { + command: CommandTypes.CompileOnSaveAffectedFileList; } - interface ReferenceEntry { - textSpan: TextSpan; - fileName: string; - isWriteAccess: boolean; - isDefinition: boolean; + interface CompileOnSaveAffectedFileListSingleProject { + projectFileName: string; + fileNames: string[]; + projectUsesOutFile: boolean; } - interface ImplementationLocation { - textSpan: TextSpan; - fileName: string; + interface CompileOnSaveAffectedFileListResponse extends Response { + body: CompileOnSaveAffectedFileListSingleProject[]; } - interface DocumentHighlights { - fileName: string; - highlightSpans: HighlightSpan[]; + interface CompileOnSaveEmitFileRequest extends FileRequest { + command: CommandTypes.CompileOnSaveEmitFile; + arguments: CompileOnSaveEmitFileRequestArgs; } - namespace HighlightSpanKind { - const none = "none"; - const definition = "definition"; - const reference = "reference"; - const writtenReference = "writtenReference"; + interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { + forced?: boolean; } - interface HighlightSpan { - fileName?: string; - textSpan: TextSpan; - kind: string; + interface QuickInfoRequest extends FileLocationRequest { + command: CommandTypes.Quickinfo; } - interface NavigateToItem { - name: string; + interface QuickInfoResponseBody { kind: string; kindModifiers: string; - matchKind: string; - isCaseSensitive: boolean; + start: Location; + end: Location; + displayString: string; + documentation: string; + tags: JSDocTagInfo[]; + } + interface QuickInfoResponse extends Response { + body?: QuickInfoResponseBody; + } + interface FormatRequestArgs extends FileLocationRequestArgs { + endLine: number; + endOffset: number; + options?: FormatCodeSettings; + } + interface FormatRequest extends FileLocationRequest { + command: CommandTypes.Format; + arguments: FormatRequestArgs; + } + interface CodeEdit { + start: Location; + end: Location; + newText: string; + } + interface FileCodeEdits { fileName: string; - textSpan: TextSpan; - containerName: string; - containerKind: string; + textChanges: CodeEdit[]; } - enum IndentStyle { - None = 0, - Block = 1, - Smart = 2, + interface CodeFixResponse extends Response { + body?: CodeAction[]; } - interface EditorOptions { - BaseIndentSize?: number; - IndentSize: number; - TabSize: number; - NewLineCharacter: string; - ConvertTabsToSpaces: boolean; - IndentStyle: IndentStyle; + interface CodeAction { + description: string; + changes: FileCodeEdits[]; } - interface EditorSettings { - baseIndentSize?: number; - indentSize?: number; - tabSize?: number; - newLineCharacter?: string; - convertTabsToSpaces?: boolean; - indentStyle?: IndentStyle; + interface FormatResponse extends Response { + body?: CodeEdit[]; } - interface FormatCodeOptions extends EditorOptions { - InsertSpaceAfterCommaDelimiter: boolean; - InsertSpaceAfterSemicolonInForStatements: boolean; - InsertSpaceBeforeAndAfterBinaryOperators: boolean; - InsertSpaceAfterKeywordsInControlFlowStatements: boolean; - InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; - InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; - InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; - InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; - InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; - InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; - InsertSpaceAfterTypeAssertion?: boolean; - PlaceOpenBraceOnNewLineForFunctions: boolean; - PlaceOpenBraceOnNewLineForControlBlocks: boolean; + interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { + key: string; + options?: FormatCodeSettings; } - interface FormatCodeSettings extends EditorSettings { - insertSpaceAfterCommaDelimiter?: boolean; - insertSpaceAfterSemicolonInForStatements?: boolean; - insertSpaceBeforeAndAfterBinaryOperators?: boolean; - insertSpaceAfterKeywordsInControlFlowStatements?: boolean; - insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; - insertSpaceAfterTypeAssertion?: boolean; - placeOpenBraceOnNewLineForFunctions?: boolean; - placeOpenBraceOnNewLineForControlBlocks?: boolean; + interface FormatOnKeyRequest extends FileLocationRequest { + command: CommandTypes.Formatonkey; + arguments: FormatOnKeyRequestArgs; } - interface DefinitionInfo { - fileName: string; - textSpan: TextSpan; - kind: string; - name: string; - containerKind: string; - containerName: string; + interface CompletionsRequestArgs extends FileLocationRequestArgs { + prefix?: string; } - interface ReferencedSymbolDefinitionInfo extends DefinitionInfo { - displayParts: SymbolDisplayPart[]; + interface CompletionsRequest extends FileLocationRequest { + command: CommandTypes.Completions; + arguments: CompletionsRequestArgs; } - interface ReferencedSymbol { - definition: ReferencedSymbolDefinitionInfo; - references: ReferenceEntry[]; + interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + entryNames: string[]; } - enum SymbolDisplayPartKind { - aliasName = 0, - className = 1, - enumName = 2, - fieldName = 3, - interfaceName = 4, - keyword = 5, - lineBreak = 6, - numericLiteral = 7, - stringLiteral = 8, - localName = 9, - methodName = 10, - moduleName = 11, - operator = 12, - parameterName = 13, - propertyName = 14, - punctuation = 15, - space = 16, - text = 17, - typeParameterName = 18, - enumMemberName = 19, - functionName = 20, - regularExpressionLiteral = 21, + interface CompletionDetailsRequest extends FileLocationRequest { + command: CommandTypes.CompletionDetails; + arguments: CompletionDetailsRequestArgs; } interface SymbolDisplayPart { text: string; kind: string; } - interface QuickInfo { + interface CompletionEntry { + name: string; kind: string; kindModifiers: string; - textSpan: TextSpan; - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; + sortText: string; + replacementSpan?: TextSpan; } - interface RenameInfo { - canRename: boolean; - localizedErrorMessage: string; - displayName: string; - fullDisplayName: string; + interface CompletionEntryDetails { + name: string; kind: string; kindModifiers: string; - triggerSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; + } + interface CompletionsResponse extends Response { + body?: CompletionEntry[]; + } + interface CompletionDetailsResponse extends Response { + body?: CompletionEntryDetails[]; } interface SignatureHelpParameter { name: string; @@ -10064,6 +4036,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } interface SignatureHelpItems { items: SignatureHelpItem[]; @@ -10072,1233 +4045,350 @@ declare namespace ts { argumentIndex: number; argumentCount: number; } - interface CompletionInfo { - isGlobalCompletion: boolean; - isMemberCompletion: boolean; - isNewIdentifierLocation: boolean; - entries: CompletionEntry[]; - } - interface CompletionEntry { - name: string; - kind: string; - kindModifiers: string; - sortText: string; - replacementSpan?: TextSpan; - } - interface CompletionEntryDetails { - name: string; - kind: string; - kindModifiers: string; - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; - } - interface OutliningSpan { - textSpan: TextSpan; - hintSpan: TextSpan; - bannerText: string; - autoCollapse: boolean; - } - interface EmitOutput { - outputFiles: OutputFile[]; - emitSkipped: boolean; - } - const enum OutputFileType { - JavaScript = 0, - SourceMap = 1, - Declaration = 2, - } - interface OutputFile { - name: string; - writeByteOrderMark: boolean; - text: string; - } - const enum EndOfLineState { - None = 0, - InMultiLineCommentTrivia = 1, - InSingleQuoteStringLiteral = 2, - InDoubleQuoteStringLiteral = 3, - InTemplateHeadOrNoSubstitutionTemplate = 4, - InTemplateMiddleOrTail = 5, - InTemplateSubstitutionPosition = 6, + interface SignatureHelpRequestArgs extends FileLocationRequestArgs { } - enum TokenClass { - Punctuation = 0, - Keyword = 1, - Operator = 2, - Comment = 3, - Whitespace = 4, - Identifier = 5, - NumberLiteral = 6, - StringLiteral = 7, - RegExpLiteral = 8, + interface SignatureHelpRequest extends FileLocationRequest { + command: CommandTypes.SignatureHelp; + arguments: SignatureHelpRequestArgs; } - interface ClassificationResult { - finalLexState: EndOfLineState; - entries: ClassificationInfo[]; + interface SignatureHelpResponse extends Response { + body?: SignatureHelpItems; } - interface ClassificationInfo { - length: number; - classification: TokenClass; + interface SemanticDiagnosticsSyncRequest extends FileRequest { + command: CommandTypes.SemanticDiagnosticsSync; + arguments: SemanticDiagnosticsSyncRequestArgs; } - interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; - getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; + interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { + includeLinePosition?: boolean; } - namespace ScriptElementKind { - const unknown = ""; - const warning = "warning"; - const keyword = "keyword"; - const scriptElement = "script"; - const moduleElement = "module"; - const classElement = "class"; - const localClassElement = "local class"; - const interfaceElement = "interface"; - const typeElement = "type"; - const enumElement = "enum"; - const enumMemberElement = "const"; - const variableElement = "var"; - const localVariableElement = "local var"; - const functionElement = "function"; - const localFunctionElement = "local function"; - const memberFunctionElement = "method"; - const memberGetAccessorElement = "getter"; - const memberSetAccessorElement = "setter"; - const memberVariableElement = "property"; - const constructorImplementationElement = "constructor"; - const callSignatureElement = "call"; - const indexSignatureElement = "index"; - const constructSignatureElement = "construct"; - const parameterElement = "parameter"; - const typeParameterElement = "type parameter"; - const primitiveType = "primitive type"; - const label = "label"; - const alias = "alias"; - const constElement = "const"; - const letElement = "let"; - const directory = "directory"; - const externalModuleName = "external module name"; + interface SemanticDiagnosticsSyncResponse extends Response { + body?: Diagnostic[] | DiagnosticWithLinePosition[]; } - namespace ScriptElementKindModifier { - const none = ""; - const publicMemberModifier = "public"; - const privateMemberModifier = "private"; - const protectedMemberModifier = "protected"; - const exportedModifier = "export"; - const ambientModifier = "declare"; - const staticModifier = "static"; - const abstractModifier = "abstract"; + interface SyntacticDiagnosticsSyncRequest extends FileRequest { + command: CommandTypes.SyntacticDiagnosticsSync; + arguments: SyntacticDiagnosticsSyncRequestArgs; } - class ClassificationTypeNames { - static comment: string; - static identifier: string; - static keyword: string; - static numericLiteral: string; - static operator: string; - static stringLiteral: string; - static whiteSpace: string; - static text: string; - static punctuation: string; - static className: string; - static enumName: string; - static interfaceName: string; - static moduleName: string; - static typeParameterName: string; - static typeAliasName: string; - static parameterName: string; - static docCommentTagName: string; - static jsxOpenTagName: string; - static jsxCloseTagName: string; - static jsxSelfClosingTagName: string; - static jsxAttribute: string; - static jsxText: string; - static jsxAttributeStringLiteralValue: string; + interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { + includeLinePosition?: boolean; } - const enum ClassificationType { - comment = 1, - identifier = 2, - keyword = 3, - numericLiteral = 4, - operator = 5, - stringLiteral = 6, - regularExpressionLiteral = 7, - whiteSpace = 8, - text = 9, - punctuation = 10, - className = 11, - enumName = 12, - interfaceName = 13, - moduleName = 14, - typeParameterName = 15, - typeAliasName = 16, - parameterName = 17, - docCommentTagName = 18, - jsxOpenTagName = 19, - jsxCloseTagName = 20, - jsxSelfClosingTagName = 21, - jsxAttribute = 22, - jsxText = 23, - jsxAttributeStringLiteralValue = 24, + interface SyntacticDiagnosticsSyncResponse extends Response { + body?: Diagnostic[] | DiagnosticWithLinePosition[]; } -} -declare namespace ts { - const scanner: Scanner; - const emptyArray: any[]; - const enum SemanticMeaning { - None = 0, - Value = 1, - Type = 2, - Namespace = 4, - All = 7, - } - function getMeaningFromDeclaration(node: Node): SemanticMeaning; - function getMeaningFromLocation(node: Node): SemanticMeaning; - function isCallExpressionTarget(node: Node): boolean; - function isNewExpressionTarget(node: Node): boolean; - function climbPastPropertyAccess(node: Node): Node; - function getTargetLabel(referenceNode: Node, labelName: string): Identifier; - function isJumpStatementTarget(node: Node): boolean; - function isLabelName(node: Node): boolean; - function isRightSideOfQualifiedName(node: Node): boolean; - function isRightSideOfPropertyAccess(node: Node): boolean; - function isNameOfModuleDeclaration(node: Node): boolean; - function isNameOfFunctionDeclaration(node: Node): boolean; - function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean; - function isExpressionOfExternalModuleImportEqualsDeclaration(node: Node): boolean; - function isInsideComment(sourceFile: SourceFile, token: Node, position: number): boolean; - function getContainerNode(node: Node): Declaration; - function getNodeKind(node: Node): string; - function getStringLiteralTypeForNode(node: StringLiteral | LiteralTypeNode, typeChecker: TypeChecker): LiteralType; - function isThis(node: Node): boolean; - interface ListItemInfo { - listItemIndex: number; - list: Node; - } - function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number; - function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; - function startEndContainsRange(start: number, end: number, range: TextRange): boolean; - function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; - function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean; - function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean; - function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean; - function isCompletedNode(n: Node, sourceFile: SourceFile): boolean; - function findListItemInfo(node: Node): ListItemInfo; - function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean; - function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node; - function findContainingList(node: Node): Node; - function getTouchingWord(sourceFile: SourceFile, position: number, includeJsDocComment?: boolean): Node; - function getTouchingPropertyName(sourceFile: SourceFile, position: number, includeJsDocComment?: boolean): Node; - function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean, includeJsDocComment?: boolean): Node; - function getTokenAtPosition(sourceFile: SourceFile, position: number, includeJsDocComment?: boolean): Node; - function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node; - function findNextToken(previousToken: Node, parent: Node): Node; - function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node; - function isInString(sourceFile: SourceFile, position: number): boolean; - function isInComment(sourceFile: SourceFile, position: number): boolean; - function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position: number): boolean; - function isInTemplateString(sourceFile: SourceFile, position: number): boolean; - function isInCommentHelper(sourceFile: SourceFile, position: number, predicate?: (c: CommentRange) => boolean): boolean; - function hasDocComment(sourceFile: SourceFile, position: number): boolean; - function getJsDocTagAtPosition(sourceFile: SourceFile, position: number): JSDocTag; - function getNodeModifiers(node: Node): string; - function getTypeArgumentOrTypeParameterList(node: Node): NodeArray; - function isToken(n: Node): boolean; - function isWord(kind: SyntaxKind): boolean; - function isComment(kind: SyntaxKind): boolean; - function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean; - function isPunctuation(kind: SyntaxKind): boolean; - function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean; - function isAccessibilityModifier(kind: SyntaxKind): boolean; - function compareDataObjects(dst: any, src: any): boolean; - function isArrayLiteralOrObjectLiteralDestructuringPattern(node: Node): boolean; - function hasTrailingDirectorySeparator(path: string): boolean; - function isInReferenceComment(sourceFile: SourceFile, position: number): boolean; - function isInNonReferenceComment(sourceFile: SourceFile, position: number): boolean; -} -declare namespace ts { - function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean; - function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart; - function displayPart(text: string, kind: SymbolDisplayPartKind): SymbolDisplayPart; - function spacePart(): SymbolDisplayPart; - function keywordPart(kind: SyntaxKind): SymbolDisplayPart; - function punctuationPart(kind: SyntaxKind): SymbolDisplayPart; - function operatorPart(kind: SyntaxKind): SymbolDisplayPart; - function textOrKeywordPart(text: string): SymbolDisplayPart; - function textPart(text: string): SymbolDisplayPart; - function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost): string; - function lineBreakPart(): SymbolDisplayPart; - function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[]; - function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; - function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[]; - function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; - function getDeclaredName(typeChecker: TypeChecker, symbol: Symbol, location: Node): string; - function isImportOrExportSpecifierName(location: Node): boolean; - function stripQuotes(name: string): string; - function scriptKindIs(fileName: string, host: LanguageServiceHost, ...scriptKinds: ScriptKind[]): boolean; - function getScriptKind(fileName: string, host?: LanguageServiceHost): ScriptKind; - function sanitizeConfigFile(configFileName: string, content: string): { - configJsonObject: any; - diagnostics: Diagnostic[]; - }; -} -declare namespace ts.BreakpointResolver { - function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number): TextSpan; -} -declare namespace ts { - function createClassifier(): Classifier; - function getSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map, span: TextSpan): ClassifiedSpan[]; - function getEncodedSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map, span: TextSpan): Classifications; - function getSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): ClassifiedSpan[]; - function getEncodedSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): Classifications; -} -declare namespace ts.Completions { - function getCompletionsAtPosition(host: LanguageServiceHost, typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number): CompletionInfo; - function getCompletionEntryDetails(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): CompletionEntryDetails; - function getCompletionEntrySymbol(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): Symbol; -} -declare namespace ts.DocumentHighlights { - function getDocumentHighlights(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: SourceFile[]): DocumentHighlights[]; -} -declare namespace ts { - interface DocumentRegistry { - acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; - getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey; - releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; - releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; - reportStats(): string; + interface GeterrForProjectRequestArgs { + file: string; + delay: number; } - type DocumentRegistryBucketKey = string & { - __bucketKey: any; - }; - function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; -} -declare namespace ts.FindAllReferences { - function findReferencedSymbols(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], sourceFile: SourceFile, position: number, findInStrings: boolean, findInComments: boolean): ReferencedSymbol[]; - function getReferencedSymbolsForNode(typeChecker: TypeChecker, cancellationToken: CancellationToken, node: Node, sourceFiles: SourceFile[], findInStrings: boolean, findInComments: boolean, implementations: boolean): ReferencedSymbol[]; - function convertReferences(referenceSymbols: ReferencedSymbol[]): ReferenceEntry[]; - function getReferenceEntriesForShorthandPropertyAssignment(node: Node, typeChecker: TypeChecker, result: ReferenceEntry[]): void; - function getReferenceEntryFromNode(node: Node): ReferenceEntry; -} -declare namespace ts.GoToDefinition { - function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[]; - function getTypeDefinitionAtPosition(typeChecker: TypeChecker, sourceFile: SourceFile, position: number): DefinitionInfo[]; -} -declare namespace ts.GoToImplementation { - function getImplementationAtPosition(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], node: Node): ImplementationLocation[]; -} -declare namespace ts.JsDoc { - function getJsDocCommentsFromDeclarations(declarations: Declaration[]): SymbolDisplayPart[]; - function getAllJsDocCompletionEntries(): CompletionEntry[]; - function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion; -} -declare namespace ts.NavigateTo { - function getNavigateToItems(sourceFiles: SourceFile[], checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[]; -} -declare namespace ts.NavigationBar { - function getNavigationBarItems(sourceFile: SourceFile): NavigationBarItem[]; - function getNavigationTree(sourceFile: SourceFile): NavigationTree; -} -declare namespace ts.OutliningElementsCollector { - function collectElements(sourceFile: SourceFile): OutliningSpan[]; -} -declare namespace ts { - enum PatternMatchKind { - exact = 0, - prefix = 1, - substring = 2, - camelCase = 3, - } - interface PatternMatch { - kind: PatternMatchKind; - camelCaseWeight?: number; - isCaseSensitive: boolean; - punctuationStripped: boolean; + interface GeterrForProjectRequest extends Request { + command: CommandTypes.GeterrForProject; + arguments: GeterrForProjectRequestArgs; } - interface PatternMatcher { - getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; - getMatches(candidateContainers: string[], candidate: string): PatternMatch[]; - patternContainsDots: boolean; + interface GeterrRequestArgs { + files: string[]; + delay: number; } - function createPatternMatcher(pattern: string): PatternMatcher; - function breakIntoCharacterSpans(identifier: string): TextSpan[]; - function breakIntoWordSpans(identifier: string): TextSpan[]; -} -declare namespace ts { - function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; -} -declare namespace ts.Rename { - function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: (fileName: string) => string, sourceFile: SourceFile, position: number): RenameInfo; -} -declare namespace ts.SignatureHelp { - const enum ArgumentListKind { - TypeArguments = 0, - CallArguments = 1, - TaggedTemplateArguments = 2, - } - interface ArgumentListInfo { - kind: ArgumentListKind; - invocation: CallLikeExpression; - argumentsSpan: TextSpan; - argumentIndex?: number; - argumentCount: number; + interface GeterrRequest extends Request { + command: CommandTypes.Geterr; + arguments: GeterrRequestArgs; } - function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationToken): SignatureHelpItems; - function getContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile): ArgumentListInfo; -} -declare namespace ts.SymbolDisplay { - function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): string; - function getSymbolModifiers(symbol: Symbol): string; - function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: TypeChecker, symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node, location: Node, semanticMeaning?: SemanticMeaning): { - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; - symbolKind: string; - }; -} -declare namespace ts { - interface TranspileOptions { - compilerOptions?: CompilerOptions; - fileName?: string; - reportDiagnostics?: boolean; - moduleName?: string; - renamedDependencies?: MapLike; + type RequestCompletedEventName = "requestCompleted"; + interface RequestCompletedEvent extends Event { + event: RequestCompletedEventName; + body: RequestCompletedEventBody; } - interface TranspileOutput { - outputText: string; - diagnostics?: Diagnostic[]; - sourceMapText?: string; + interface RequestCompletedEventBody { + request_seq: number; } - function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; - function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; -} -declare namespace ts.formatting { - interface FormattingScanner { - advance(): void; - isOnToken(): boolean; - readTokenInfo(n: Node): TokenInfo; - getCurrentLeadingTrivia(): TextRangeWithKind[]; - lastTrailingTriviaWasNewLine(): boolean; - skipToEndOf(node: Node): void; - close(): void; + interface Diagnostic { + start: Location; + end: Location; + text: string; + code?: number; } - function getFormattingScanner(sourceFile: SourceFile, startPos: number, endPos: number): FormattingScanner; -} -declare namespace ts.formatting { - class FormattingContext { - sourceFile: SourceFile; - formattingRequestKind: FormattingRequestKind; - currentTokenSpan: TextRangeWithKind; - nextTokenSpan: TextRangeWithKind; - contextNode: Node; - currentTokenParent: Node; - nextTokenParent: Node; - private contextNodeAllOnSameLine; - private nextNodeAllOnSameLine; - private tokensAreOnSameLine; - private contextNodeBlockIsOnOneLine; - private nextNodeBlockIsOnOneLine; - constructor(sourceFile: SourceFile, formattingRequestKind: FormattingRequestKind); - updateContext(currentRange: TextRangeWithKind, currentTokenParent: Node, nextRange: TextRangeWithKind, nextTokenParent: Node, commonParent: Node): void; - ContextNodeAllOnSameLine(): boolean; - NextNodeAllOnSameLine(): boolean; - TokensAreOnSameLine(): boolean; - ContextNodeBlockIsOnOneLine(): boolean; - NextNodeBlockIsOnOneLine(): boolean; - private NodeIsOnOneLine(node); - private BlockIsOnOneLine(node); + interface DiagnosticEventBody { + file: string; + diagnostics: Diagnostic[]; } -} -declare namespace ts.formatting { - const enum FormattingRequestKind { - FormatDocument = 0, - FormatSelection = 1, - FormatOnEnter = 2, - FormatOnSemicolon = 3, - FormatOnClosingCurlyBrace = 4, + interface DiagnosticEvent extends Event { + body?: DiagnosticEventBody; } -} -declare namespace ts.formatting { - class Rule { - Descriptor: RuleDescriptor; - Operation: RuleOperation; - Flag: RuleFlags; - constructor(Descriptor: RuleDescriptor, Operation: RuleOperation, Flag?: RuleFlags); - toString(): string; + interface ConfigFileDiagnosticEventBody { + triggerFile: string; + configFile: string; + diagnostics: Diagnostic[]; } -} -declare namespace ts.formatting { - const enum RuleAction { - Ignore = 1, - Space = 2, - NewLine = 4, - Delete = 8, + interface ConfigFileDiagnosticEvent extends Event { + body?: ConfigFileDiagnosticEventBody; + event: "configFileDiag"; } -} -declare namespace ts.formatting { - class RuleDescriptor { - LeftTokenRange: Shared.TokenRange; - RightTokenRange: Shared.TokenRange; - constructor(LeftTokenRange: Shared.TokenRange, RightTokenRange: Shared.TokenRange); - toString(): string; - static create1(left: SyntaxKind, right: SyntaxKind): RuleDescriptor; - static create2(left: Shared.TokenRange, right: SyntaxKind): RuleDescriptor; - static create3(left: SyntaxKind, right: Shared.TokenRange): RuleDescriptor; - static create4(left: Shared.TokenRange, right: Shared.TokenRange): RuleDescriptor; + type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; + interface ProjectLanguageServiceStateEvent extends Event { + event: ProjectLanguageServiceStateEventName; + body?: ProjectLanguageServiceStateEventBody; } -} -declare namespace ts.formatting { - const enum RuleFlags { - None = 0, - CanDeleteNewLines = 1, + interface ProjectLanguageServiceStateEventBody { + projectName: string; + languageServiceEnabled: boolean; } -} -declare namespace ts.formatting { - class RuleOperation { - Context: RuleOperationContext; - Action: RuleAction; - constructor(Context: RuleOperationContext, Action: RuleAction); - toString(): string; - static create1(action: RuleAction): RuleOperation; - static create2(context: RuleOperationContext, action: RuleAction): RuleOperation; + interface ReloadRequestArgs extends FileRequestArgs { + tmpfile: string; } -} -declare namespace ts.formatting { - class RuleOperationContext { - private customContextChecks; - constructor(...funcs: { - (context: FormattingContext): boolean; - }[]); - static Any: RuleOperationContext; - IsAny(): boolean; - InContext(context: FormattingContext): boolean; + interface ReloadRequest extends FileRequest { + command: CommandTypes.Reload; + arguments: ReloadRequestArgs; } -} -declare namespace ts.formatting { - class Rules { - getRuleName(rule: Rule): string; - [name: string]: any; - IgnoreBeforeComment: Rule; - IgnoreAfterLineComment: Rule; - NoSpaceBeforeSemicolon: Rule; - NoSpaceBeforeColon: Rule; - NoSpaceBeforeQuestionMark: Rule; - SpaceAfterColon: Rule; - SpaceAfterQuestionMarkInConditionalOperator: Rule; - NoSpaceAfterQuestionMark: Rule; - SpaceAfterSemicolon: Rule; - SpaceAfterCloseBrace: Rule; - SpaceBetweenCloseBraceAndElse: Rule; - SpaceBetweenCloseBraceAndWhile: Rule; - NoSpaceAfterCloseBrace: Rule; - NoSpaceBeforeDot: Rule; - NoSpaceAfterDot: Rule; - NoSpaceBeforeOpenBracket: Rule; - NoSpaceAfterCloseBracket: Rule; - SpaceAfterOpenBrace: Rule; - SpaceBeforeCloseBrace: Rule; - NoSpaceAfterOpenBrace: Rule; - NoSpaceBeforeCloseBrace: Rule; - NoSpaceBetweenEmptyBraceBrackets: Rule; - NewLineAfterOpenBraceInBlockContext: Rule; - NewLineBeforeCloseBraceInBlockContext: Rule; - NoSpaceAfterUnaryPrefixOperator: Rule; - NoSpaceAfterUnaryPreincrementOperator: Rule; - NoSpaceAfterUnaryPredecrementOperator: Rule; - NoSpaceBeforeUnaryPostincrementOperator: Rule; - NoSpaceBeforeUnaryPostdecrementOperator: Rule; - SpaceAfterPostincrementWhenFollowedByAdd: Rule; - SpaceAfterAddWhenFollowedByUnaryPlus: Rule; - SpaceAfterAddWhenFollowedByPreincrement: Rule; - SpaceAfterPostdecrementWhenFollowedBySubtract: Rule; - SpaceAfterSubtractWhenFollowedByUnaryMinus: Rule; - SpaceAfterSubtractWhenFollowedByPredecrement: Rule; - NoSpaceBeforeComma: Rule; - SpaceAfterCertainKeywords: Rule; - SpaceAfterLetConstInVariableDeclaration: Rule; - NoSpaceBeforeOpenParenInFuncCall: Rule; - SpaceAfterFunctionInFuncDecl: Rule; - NoSpaceBeforeOpenParenInFuncDecl: Rule; - SpaceAfterVoidOperator: Rule; - NoSpaceBetweenReturnAndSemicolon: Rule; - SpaceBetweenStatements: Rule; - SpaceAfterTryFinally: Rule; - SpaceAfterGetSetInMember: Rule; - SpaceBeforeBinaryKeywordOperator: Rule; - SpaceAfterBinaryKeywordOperator: Rule; - NoSpaceAfterConstructor: Rule; - NoSpaceAfterModuleImport: Rule; - SpaceAfterCertainTypeScriptKeywords: Rule; - SpaceBeforeCertainTypeScriptKeywords: Rule; - SpaceAfterModuleName: Rule; - SpaceBeforeArrow: Rule; - SpaceAfterArrow: Rule; - NoSpaceAfterEllipsis: Rule; - NoSpaceAfterOptionalParameters: Rule; - NoSpaceBeforeOpenAngularBracket: Rule; - NoSpaceBetweenCloseParenAndAngularBracket: Rule; - NoSpaceAfterOpenAngularBracket: Rule; - NoSpaceBeforeCloseAngularBracket: Rule; - NoSpaceAfterCloseAngularBracket: Rule; - NoSpaceBetweenEmptyInterfaceBraceBrackets: Rule; - HighPriorityCommonRules: Rule[]; - LowPriorityCommonRules: Rule[]; - SpaceAfterComma: Rule; - NoSpaceAfterComma: Rule; - SpaceBeforeBinaryOperator: Rule; - SpaceAfterBinaryOperator: Rule; - NoSpaceBeforeBinaryOperator: Rule; - NoSpaceAfterBinaryOperator: Rule; - SpaceAfterKeywordInControl: Rule; - NoSpaceAfterKeywordInControl: Rule; - FunctionOpenBraceLeftTokenRange: Shared.TokenRange; - SpaceBeforeOpenBraceInFunction: Rule; - NewLineBeforeOpenBraceInFunction: Rule; - TypeScriptOpenBraceLeftTokenRange: Shared.TokenRange; - SpaceBeforeOpenBraceInTypeScriptDeclWithBlock: Rule; - NewLineBeforeOpenBraceInTypeScriptDeclWithBlock: Rule; - ControlOpenBraceLeftTokenRange: Shared.TokenRange; - SpaceBeforeOpenBraceInControl: Rule; - NewLineBeforeOpenBraceInControl: Rule; - SpaceAfterSemicolonInFor: Rule; - NoSpaceAfterSemicolonInFor: Rule; - SpaceAfterOpenParen: Rule; - SpaceBeforeCloseParen: Rule; - NoSpaceBetweenParens: Rule; - NoSpaceAfterOpenParen: Rule; - NoSpaceBeforeCloseParen: Rule; - SpaceAfterOpenBracket: Rule; - SpaceBeforeCloseBracket: Rule; - NoSpaceBetweenBrackets: Rule; - NoSpaceAfterOpenBracket: Rule; - NoSpaceBeforeCloseBracket: Rule; - SpaceAfterAnonymousFunctionKeyword: Rule; - NoSpaceAfterAnonymousFunctionKeyword: Rule; - SpaceBeforeAt: Rule; - NoSpaceAfterAt: Rule; - SpaceAfterDecorator: Rule; - NoSpaceBetweenFunctionKeywordAndStar: Rule; - SpaceAfterStarInGeneratorDeclaration: Rule; - NoSpaceBetweenYieldKeywordAndStar: Rule; - SpaceBetweenYieldOrYieldStarAndOperand: Rule; - SpaceBetweenAsyncAndOpenParen: Rule; - SpaceBetweenAsyncAndFunctionKeyword: Rule; - NoSpaceBetweenTagAndTemplateString: Rule; - NoSpaceAfterTemplateHeadAndMiddle: Rule; - SpaceAfterTemplateHeadAndMiddle: Rule; - NoSpaceBeforeTemplateMiddleAndTail: Rule; - SpaceBeforeTemplateMiddleAndTail: Rule; - NoSpaceAfterOpenBraceInJsxExpression: Rule; - SpaceAfterOpenBraceInJsxExpression: Rule; - NoSpaceBeforeCloseBraceInJsxExpression: Rule; - SpaceBeforeCloseBraceInJsxExpression: Rule; - SpaceBeforeJsxAttribute: Rule; - SpaceBeforeSlashInJsxOpeningElement: Rule; - NoSpaceBeforeGreaterThanTokenInJsxOpeningElement: Rule; - NoSpaceBeforeEqualInJsxAttribute: Rule; - NoSpaceAfterEqualInJsxAttribute: Rule; - NoSpaceAfterTypeAssertion: Rule; - SpaceAfterTypeAssertion: Rule; - constructor(); - static IsForContext(context: FormattingContext): boolean; - static IsNotForContext(context: FormattingContext): boolean; - static IsBinaryOpContext(context: FormattingContext): boolean; - static IsNotBinaryOpContext(context: FormattingContext): boolean; - static IsConditionalOperatorContext(context: FormattingContext): boolean; - static IsSameLineTokenOrBeforeMultilineBlockContext(context: FormattingContext): boolean; - static IsBeforeMultilineBlockContext(context: FormattingContext): boolean; - static IsMultilineBlockContext(context: FormattingContext): boolean; - static IsSingleLineBlockContext(context: FormattingContext): boolean; - static IsBlockContext(context: FormattingContext): boolean; - static IsBeforeBlockContext(context: FormattingContext): boolean; - static NodeIsBlockContext(node: Node): boolean; - static IsFunctionDeclContext(context: FormattingContext): boolean; - static IsFunctionDeclarationOrFunctionExpressionContext(context: FormattingContext): boolean; - static IsTypeScriptDeclWithBlockContext(context: FormattingContext): boolean; - static NodeIsTypeScriptDeclWithBlockContext(node: Node): boolean; - static IsAfterCodeBlockContext(context: FormattingContext): boolean; - static IsControlDeclContext(context: FormattingContext): boolean; - static IsObjectContext(context: FormattingContext): boolean; - static IsFunctionCallContext(context: FormattingContext): boolean; - static IsNewContext(context: FormattingContext): boolean; - static IsFunctionCallOrNewContext(context: FormattingContext): boolean; - static IsPreviousTokenNotComma(context: FormattingContext): boolean; - static IsNextTokenNotCloseBracket(context: FormattingContext): boolean; - static IsArrowFunctionContext(context: FormattingContext): boolean; - static IsNonJsxSameLineTokenContext(context: FormattingContext): boolean; - static IsNonJsxElementContext(context: FormattingContext): boolean; - static IsJsxExpressionContext(context: FormattingContext): boolean; - static IsNextTokenParentJsxAttribute(context: FormattingContext): boolean; - static IsJsxAttributeContext(context: FormattingContext): boolean; - static IsJsxSelfClosingElementContext(context: FormattingContext): boolean; - static IsNotBeforeBlockInFunctionDeclarationContext(context: FormattingContext): boolean; - static IsEndOfDecoratorContextOnSameLine(context: FormattingContext): boolean; - static NodeIsInDecoratorContext(node: Node): boolean; - static IsStartOfVariableDeclarationList(context: FormattingContext): boolean; - static IsNotFormatOnEnter(context: FormattingContext): boolean; - static IsModuleDeclContext(context: FormattingContext): boolean; - static IsObjectTypeContext(context: FormattingContext): boolean; - static IsTypeArgumentOrParameterOrAssertion(token: TextRangeWithKind, parent: Node): boolean; - static IsTypeArgumentOrParameterOrAssertionContext(context: FormattingContext): boolean; - static IsTypeAssertionContext(context: FormattingContext): boolean; - static IsVoidOpContext(context: FormattingContext): boolean; - static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean; + interface ReloadResponse extends Response { } -} -declare namespace ts.formatting { - class RulesMap { - map: RulesBucket[]; - mapRowLength: number; - constructor(); - static create(rules: Rule[]): RulesMap; - Initialize(rules: Rule[]): RulesBucket[]; - FillRules(rules: Rule[], rulesBucketConstructionStateList: RulesBucketConstructionState[]): void; - private GetRuleBucketIndex(row, column); - private FillRule(rule, rulesBucketConstructionStateList); - GetRule(context: FormattingContext): Rule; - } - enum RulesPosition { - IgnoreRulesSpecific = 0, - IgnoreRulesAny, - ContextRulesSpecific, - ContextRulesAny, - NoContextRulesSpecific, - NoContextRulesAny, - } - class RulesBucketConstructionState { - private rulesInsertionIndexBitmap; - constructor(); - GetInsertionIndex(maskPosition: RulesPosition): number; - IncreaseInsertionIndex(maskPosition: RulesPosition): void; - } - class RulesBucket { - private rules; - constructor(); - Rules(): Rule[]; - AddRule(rule: Rule, specificTokens: boolean, constructionState: RulesBucketConstructionState[], rulesBucketIndex: number): void; + interface SavetoRequestArgs extends FileRequestArgs { + tmpfile: string; } -} -declare namespace ts.formatting { - namespace Shared { - interface ITokenAccess { - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - } - class TokenRangeAccess implements ITokenAccess { - private tokens; - constructor(from: SyntaxKind, to: SyntaxKind, except: SyntaxKind[]); - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - } - class TokenValuesAccess implements ITokenAccess { - private tokens; - constructor(tks: SyntaxKind[]); - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - } - class TokenSingleValueAccess implements ITokenAccess { - token: SyntaxKind; - constructor(token: SyntaxKind); - GetTokens(): SyntaxKind[]; - Contains(tokenValue: SyntaxKind): boolean; - } - class TokenAllAccess implements ITokenAccess { - GetTokens(): SyntaxKind[]; - Contains(): boolean; - toString(): string; - } - class TokenRange { - tokenAccess: ITokenAccess; - constructor(tokenAccess: ITokenAccess); - static FromToken(token: SyntaxKind): TokenRange; - static FromTokens(tokens: SyntaxKind[]): TokenRange; - static FromRange(f: SyntaxKind, to: SyntaxKind, except?: SyntaxKind[]): TokenRange; - static AllTokens(): TokenRange; - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - toString(): string; - static Any: TokenRange; - static AnyIncludingMultilineComments: TokenRange; - static Keywords: TokenRange; - static BinaryOperators: TokenRange; - static BinaryKeywordOperators: TokenRange; - static UnaryPrefixOperators: TokenRange; - static UnaryPrefixExpressions: TokenRange; - static UnaryPreincrementExpressions: TokenRange; - static UnaryPostincrementExpressions: TokenRange; - static UnaryPredecrementExpressions: TokenRange; - static UnaryPostdecrementExpressions: TokenRange; - static Comments: TokenRange; - static TypeNames: TokenRange; - } + interface SavetoRequest extends FileRequest { + command: CommandTypes.Saveto; + arguments: SavetoRequestArgs; } -} -declare namespace ts.formatting { - class RulesProvider { - private globalRules; - private options; - private activeRules; - private rulesMap; - constructor(); - getRuleName(rule: Rule): string; - getRuleByName(name: string): Rule; - getRulesMap(): RulesMap; - ensureUpToDate(options: ts.FormatCodeSettings): void; - private createActiveRules(options); + interface NavtoRequestArgs extends FileRequestArgs { + searchValue: string; + maxResultCount?: number; + currentFileOnly?: boolean; + projectFileName?: string; } -} -declare namespace ts.formatting { - interface TextRangeWithKind extends TextRange { - kind: SyntaxKind; + interface NavtoRequest extends FileRequest { + command: CommandTypes.Navto; + arguments: NavtoRequestArgs; + } + interface NavtoItem { + name: string; + kind: string; + matchKind?: string; + isCaseSensitive?: boolean; + kindModifiers?: string; + file: string; + start: Location; + end: Location; + containerName?: string; + containerKind?: string; } - interface TokenInfo { - leadingTrivia: TextRangeWithKind[]; - token: TextRangeWithKind; - trailingTrivia: TextRangeWithKind[]; - } - function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatOnSemicolon(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatDocument(sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function getIndentationString(indentation: number, options: EditorSettings): string; -} -declare namespace ts.formatting { - namespace SmartIndenter { - function getIndentation(position: number, sourceFile: SourceFile, options: EditorSettings): number; - function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: EditorSettings): number; - function getBaseIndentation(options: EditorSettings): number; - function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFile): boolean; - function findFirstNonWhitespaceCharacterAndColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorSettings): { - column: number; - character: number; - }; - function findFirstNonWhitespaceColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorSettings): number; - function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean): boolean; - function shouldIndentChildNode(parent: TextRangeWithKind, child?: TextRangeWithKind): boolean; + interface NavtoResponse extends Response { + body?: NavtoItem[]; } -} -declare namespace ts { - interface CodeFix { - errorCodes: number[]; - getCodeActions(context: CodeFixContext): CodeAction[] | undefined; + interface ChangeRequestArgs extends FormatRequestArgs { + insertString?: string; } - interface CodeFixContext { - errorCode: number; - sourceFile: SourceFile; - span: TextSpan; - program: Program; - newLineCharacter: string; - host: LanguageServiceHost; - cancellationToken: CancellationToken; + interface ChangeRequest extends FileLocationRequest { + command: CommandTypes.Change; + arguments: ChangeRequestArgs; } - namespace codefix { - function registerCodeFix(action: CodeFix): void; - function getSupportedErrorCodes(): string[]; - function getFixes(context: CodeFixContext): CodeAction[]; + interface BraceResponse extends Response { + body?: TextSpan[]; } -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts { - const servicesVersion = "0.5"; - interface DisplayPartsSymbolWriter extends SymbolWriter { - displayParts(): SymbolDisplayPart[]; + interface BraceRequest extends FileLocationRequest { + command: CommandTypes.Brace; } - function toEditorSettings(options: FormatCodeOptions | FormatCodeSettings): FormatCodeSettings; - function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; - function displayPartsToString(displayParts: SymbolDisplayPart[]): string; - function getDefaultCompilerOptions(): CompilerOptions; - function getSupportedCodeFixes(): string[]; - function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; - let disableIncrementalParsing: boolean; - function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; - function getNameTable(sourceFile: SourceFile): Map; - function getDefaultLibFilePath(options: CompilerOptions): string; -} -declare namespace ts.server { - class ScriptInfo { - private readonly host; - readonly fileName: NormalizedPath; - readonly scriptKind: ScriptKind; - isOpen: boolean; - hasMixedContent: boolean; - readonly containingProjects: Project[]; - private formatCodeSettings; - readonly path: Path; - private fileWatcher; - private svc; - constructor(host: ServerHost, fileName: NormalizedPath, content: string, scriptKind: ScriptKind, isOpen?: boolean, hasMixedContent?: boolean); - getFormatCodeSettings(): FormatCodeSettings; - attachToProject(project: Project): boolean; - isAttached(project: Project): boolean; - detachFromProject(project: Project): void; - detachAllProjects(): void; - getDefaultProject(): Project; - setFormatOptions(formatSettings: FormatCodeSettings): void; - setWatcher(watcher: FileWatcher): void; - stopWatcher(): void; - getLatestVersion(): string; - reload(script: string): void; - saveTo(fileName: string): void; - reloadFromFile(tempFileName?: NormalizedPath): void; - snap(): LineIndexSnapshot; - getLineInfo(line: number): ILineInfo; - editContent(start: number, end: number, newText: string): void; - markContainingProjectsAsDirty(): void; - lineToTextSpan(line: number): TextSpan; - lineOffsetToPosition(line: number, offset: number): number; - positionToLineOffset(position: number): ILineInfo; + interface NavBarRequest extends FileRequest { + command: CommandTypes.NavBar; } -} -declare namespace ts.server { - class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost { - private readonly host; - private readonly project; - private readonly cancellationToken; - private compilationSettings; - private readonly resolvedModuleNames; - private readonly resolvedTypeReferenceDirectives; - private readonly getCanonicalFileName; - private filesWithChangedSetOfUnresolvedImports; - private readonly resolveModuleName; - readonly trace: (s: string) => void; - readonly realpath?: (path: string) => string; - constructor(host: ServerHost, project: Project, cancellationToken: HostCancellationToken); - startRecordingFilesWithChangedResolutions(): void; - finishRecordingFilesWithChangedResolutions(): Path[]; - private resolveNamesWithLocalCache(names, containingFile, cache, loader, getResult, getResultFileName, logChanges); - getProjectVersion(): string; - getCompilationSettings(): CompilerOptions; - useCaseSensitiveFileNames(): boolean; - getCancellationToken(): HostCancellationToken; - resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModuleFull[]; - getDefaultLibFileName(): string; - getScriptSnapshot(filename: string): ts.IScriptSnapshot; - getScriptFileNames(): string[]; - getTypeRootsVersion(): number; - getScriptKind(fileName: string): ScriptKind; - getScriptVersion(filename: string): string; - getCurrentDirectory(): string; - resolvePath(path: string): string; - fileExists(path: string): boolean; - readFile(fileName: string): string; - directoryExists(path: string): boolean; - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; - getDirectories(path: string): string[]; - notifyFileRemoved(info: ScriptInfo): void; - setCompilationSettings(opt: ts.CompilerOptions): void; + interface NavTreeRequest extends FileRequest { + command: CommandTypes.NavTree; } -} -declare namespace ts.server { - interface ITypingsInstaller { - enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray): void; - attach(projectService: ProjectService): void; - onProjectClosed(p: Project): void; - readonly globalTypingsCacheLocation: string; + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers?: string; + spans: TextSpan[]; + childItems?: NavigationBarItem[]; + indent: number; } - const nullTypingsInstaller: ITypingsInstaller; - class TypingsCache { - private readonly installer; - private readonly perProjectCache; - constructor(installer: ITypingsInstaller); - getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray, forceRefresh: boolean): SortedReadonlyArray; - updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]): void; - deleteTypingsForProject(projectName: string): void; - onProjectClosed(project: Project): void; + interface NavigationTree { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems?: NavigationTree[]; } -} -declare namespace ts.server { - function shouldEmitFile(scriptInfo: ScriptInfo): boolean; - class BuilderFileInfo { - readonly scriptInfo: ScriptInfo; - readonly project: Project; - private lastCheckedShapeSignature; - constructor(scriptInfo: ScriptInfo, project: Project); - isExternalModuleOrHasOnlyAmbientExternalModules(): boolean; - private containsOnlyAmbientModules(sourceFile); - private computeHash(text); - private getSourceFile(); - updateShapeSignature(): boolean; + type TelemetryEventName = "telemetry"; + interface TelemetryEvent extends Event { + event: TelemetryEventName; + body: TelemetryEventBody; } - interface Builder { - readonly project: Project; - getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; - onProjectUpdateGraph(): void; - emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; + interface TelemetryEventBody { + telemetryEventName: string; + payload: any; } - function createBuilder(project: Project): Builder; -} -declare namespace ts.server { - enum ProjectKind { - Inferred = 0, - Configured = 1, - External = 2, + type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed"; + interface TypesInstallerInitializationFailedEvent extends Event { + event: TypesInstallerInitializationFailedEventName; + body: TypesInstallerInitializationFailedEventBody; } - function allRootFilesAreJsOrDts(project: Project): boolean; - function allFilesAreJsOrDts(project: Project): boolean; - interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles { - projectErrors: Diagnostic[]; + interface TypesInstallerInitializationFailedEventBody { + message: string; } - class UnresolvedImportsMap { - readonly perFileMap: FileMap>; - private version; - clear(): void; - getVersion(): number; - remove(path: Path): void; - get(path: Path): ReadonlyArray; - set(path: Path, value: ReadonlyArray): void; + type TypingsInstalledTelemetryEventName = "typingsInstalled"; + interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { + telemetryEventName: TypingsInstalledTelemetryEventName; + payload: TypingsInstalledTelemetryEventPayload; } - function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService; - abstract class Project { - private readonly projectName; - readonly projectKind: ProjectKind; - readonly projectService: ProjectService; - private documentRegistry; - private compilerOptions; - compileOnSaveEnabled: boolean; - private rootFiles; - private rootFilesMap; - private lsHost; - private program; - private cachedUnresolvedImportsPerFile; - private lastCachedUnresolvedImportsList; - private readonly languageService; - private readonly noSemanticFeaturesLanguageService; - languageServiceEnabled: boolean; - builder: Builder; - private lastReportedFileNames; - private lastReportedVersion; - private projectStructureVersion; - private projectStateVersion; - private typingFiles; - protected projectErrors: Diagnostic[]; - typesVersion: number; - isNonTsProject(): boolean; - isJsOnlyProject(): boolean; - getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap; - constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); - getProjectErrors(): Diagnostic[]; - getLanguageService(ensureSynchronized?: boolean): LanguageService; - getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[]; - getProjectVersion(): string; - enableLanguageService(): void; - disableLanguageService(): void; - getProjectName(): string; - abstract getProjectRootPath(): string | undefined; - abstract getTypeAcquisition(): TypeAcquisition; - getSourceFile(path: Path): SourceFile; - updateTypes(): void; - close(): void; - getCompilerOptions(): CompilerOptions; - hasRoots(): boolean; - getRootFiles(): NormalizedPath[]; - getRootFilesLSHost(): string[]; - getRootScriptInfos(): ScriptInfo[]; - getScriptInfos(): ScriptInfo[]; - getFileEmitOutput(info: ScriptInfo, emitOnlyDtsFiles: boolean): EmitOutput; - getFileNames(excludeFilesFromExternalLibraries?: boolean): NormalizedPath[]; - getAllEmittableFiles(): string[]; - containsScriptInfo(info: ScriptInfo): boolean; - containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean; - isRoot(info: ScriptInfo): boolean; - addRoot(info: ScriptInfo): void; - removeFile(info: ScriptInfo, detachFromProject?: boolean): void; - markAsDirty(): void; - private extractUnresolvedImportsFromSourceFile(file, result); - updateGraph(): boolean; - private setTypings(typings); - private updateGraphWorker(); - getScriptInfoLSHost(fileName: string): ScriptInfo; - getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; - getScriptInfo(uncheckedFileName: string): ScriptInfo; - filesToString(): string; - setCompilerOptions(compilerOptions: CompilerOptions): void; - reloadScript(filename: NormalizedPath, tempFileName?: NormalizedPath): boolean; - getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics; - getReferencedFiles(path: Path): Path[]; - private removeRootFileIfNecessary(info); + interface TypingsInstalledTelemetryEventPayload { + installedPackages: string; + installSuccess: boolean; + typingsInstallerVersion: string; } - class InferredProject extends Project { - private static newName; - directoriesWatchedForTsconfig: string[]; - constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions); - getProjectRootPath(): string; - close(): void; - getTypeAcquisition(): TypeAcquisition; + type BeginInstallTypesEventName = "beginInstallTypes"; + type EndInstallTypesEventName = "endInstallTypes"; + interface BeginInstallTypesEvent extends Event { + event: BeginInstallTypesEventName; + body: BeginInstallTypesEventBody; } - class ConfiguredProject extends Project { - private wildcardDirectories; - compileOnSaveEnabled: boolean; - private typeAcquisition; - private projectFileWatcher; - private directoryWatcher; - private directoriesWatchedForWildcards; - private typeRootsWatchers; - readonly canonicalConfigFilePath: NormalizedPath; - openRefCount: number; - constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, compilerOptions: CompilerOptions, wildcardDirectories: Map, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean); - getConfigFilePath(): string; - getProjectRootPath(): string; - setProjectErrors(projectErrors: Diagnostic[]): void; - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; - getTypeAcquisition(): TypeAcquisition; - watchConfigFile(callback: (project: ConfiguredProject) => void): void; - watchTypeRoots(callback: (project: ConfiguredProject, path: string) => void): void; - watchConfigDirectory(callback: (project: ConfiguredProject, path: string) => void): void; - watchWildcards(callback: (project: ConfiguredProject, path: string) => void): void; - stopWatchingDirectory(): void; - close(): void; - addOpenRef(): void; - deleteOpenRef(): number; - getEffectiveTypeRoots(): string[]; + interface EndInstallTypesEvent extends Event { + event: EndInstallTypesEventName; + body: EndInstallTypesEventBody; } - class ExternalProject extends Project { - compileOnSaveEnabled: boolean; - private readonly projectFilePath; - private typeAcquisition; - constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean, projectFilePath?: string); - getProjectRootPath(): string; - getTypeAcquisition(): TypeAcquisition; - setProjectErrors(projectErrors: Diagnostic[]): void; - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; + interface InstallTypesEventBody { + eventId: number; + packages: ReadonlyArray; } -} -declare namespace ts.server { - const maxProgramSizeForNonTsFiles: number; - const ContextEvent = "context"; - const ConfigFileDiagEvent = "configFileDiag"; - const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; - interface ContextEvent { - eventName: typeof ContextEvent; - data: { - project: Project; - fileName: NormalizedPath; - }; + interface BeginInstallTypesEventBody extends InstallTypesEventBody { } - interface ConfigFileDiagEvent { - eventName: typeof ConfigFileDiagEvent; - data: { - triggerFile: string; - configFileName: string; - diagnostics: Diagnostic[]; - }; + interface EndInstallTypesEventBody extends InstallTypesEventBody { + success: boolean; } - interface ProjectLanguageServiceStateEvent { - eventName: typeof ProjectLanguageServiceStateEvent; - data: { - project: Project; - languageServiceEnabled: boolean; - }; + interface NavBarResponse extends Response { + body?: NavigationBarItem[]; } - type ProjectServiceEvent = ContextEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent; - interface ProjectServiceEventHandler { - (event: ProjectServiceEvent): void; + interface NavTreeResponse extends Response { + body?: NavigationTree; } - function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; - function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; - function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind; - function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind; - function combineProjectOutput(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean): T[]; - interface HostConfiguration { - formatCodeOptions: FormatCodeSettings; - hostInfo: string; + namespace IndentStyle { + type None = "None"; + type Block = "Block"; + type Smart = "Smart"; } - interface OpenConfiguredProjectResult { - configFileName?: string; - configFileErrors?: Diagnostic[]; + type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart; + interface EditorSettings { + baseIndentSize?: number; + indentSize?: number; + tabSize?: number; + newLineCharacter?: string; + convertTabsToSpaces?: boolean; + indentStyle?: IndentStyle | ts.IndentStyle; } - class ProjectService { - readonly host: ServerHost; - readonly logger: Logger; - readonly cancellationToken: HostCancellationToken; - readonly useSingleInferredProject: boolean; - readonly typingsInstaller: ITypingsInstaller; - private readonly eventHandler; - readonly typingsCache: TypingsCache; - private readonly documentRegistry; - private readonly filenameToScriptInfo; - private readonly externalProjectToConfiguredProjectMap; - readonly externalProjects: ExternalProject[]; - readonly inferredProjects: InferredProject[]; - readonly configuredProjects: ConfiguredProject[]; - readonly openFiles: ScriptInfo[]; - private compilerOptionsForInferredProjects; - private compileOnSaveForInferredProjects; - private readonly directoryWatchers; - private readonly throttledOperations; - private readonly hostConfiguration; - private changedFiles; - readonly toCanonicalFileName: (f: string) => string; - lastDeletedFile: ScriptInfo; - constructor(host: ServerHost, logger: Logger, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller?: ITypingsInstaller, eventHandler?: ProjectServiceEventHandler); - getChangedFiles_TestOnly(): ScriptInfo[]; - ensureInferredProjectsUpToDate_TestOnly(): void; - getCompilerOptionsForInferredProjects(): CompilerOptions; - onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; - updateTypingsForProject(response: SetTypings | InvalidateCachedTypings): void; - setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions): void; - stopWatchingDirectory(directory: string): void; - findProject(projectName: string): Project; - getDefaultProjectForFile(fileName: NormalizedPath, refreshInferredProjects: boolean): Project; - private ensureInferredProjectsUpToDate(); - private findContainingExternalProject(fileName); - getFormatCodeOptions(file?: NormalizedPath): FormatCodeSettings; - private updateProjectGraphs(projects); - private onSourceFileChanged(fileName); - private handleDeletedFile(info); - private onTypeRootFileChanged(project, fileName); - private onSourceFileInDirectoryChangedForConfiguredProject(project, fileName); - private handleChangeInSourceFileForConfiguredProject(project, triggerFile); - private onConfigChangedForConfiguredProject(project); - private onConfigFileAddedForInferredProject(fileName); - private getCanonicalFileName(fileName); - private removeProject(project); - private assignScriptInfoToInferredProjectIfNecessary(info, addToListOfOpenFiles); - private closeOpenFile(info); - private openOrUpdateConfiguredProjectForFile(fileName); - private findConfigFile(searchPath); - private printProjects(); - private findConfiguredProjectByProjectName(configFileName); - private findExternalProjectByProjectName(projectFileName); - private convertConfigFileContentToProjectOptions(configFilename); - private exceededTotalSizeLimitForNonTsFiles(options, fileNames, propertyReader); - private createAndAddExternalProject(projectFileName, files, options, typeAcquisition); - private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile); - private createAndAddConfiguredProject(configFileName, projectOptions, configFileErrors, clientFileName?); - private watchConfigDirectoryForProject(project, options); - private addFilesToProjectAndUpdateGraph(project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors); - private openConfigFile(configFileName, clientFileName?); - private updateNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors); - private updateConfiguredProject(project); - createInferredProjectWithRootFileIfNecessary(root: ScriptInfo): InferredProject; - getOrCreateScriptInfo(uncheckedFileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind): ScriptInfo; - getScriptInfo(uncheckedFileName: string): ScriptInfo; - getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): ScriptInfo; - getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; - getScriptInfoForPath(fileName: Path): ScriptInfo; - setHostConfiguration(args: protocol.ConfigureRequestArguments): void; - closeLog(): void; - reloadProjects(): void; - refreshInferredProjects(): void; - openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind): OpenConfiguredProjectResult; - openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): OpenConfiguredProjectResult; - closeClientFile(uncheckedFileName: string): void; - private collectChanges(lastKnownProjectVersions, currentProjects, result); - synchronizeProjectList(knownProjects: protocol.ProjectVersionInfo[]): ProjectFilesWithTSDiagnostics[]; - applyChangesInOpenFiles(openFiles: protocol.ExternalFile[], changedFiles: protocol.ChangedOpenFile[], closedFiles: string[]): void; - private closeConfiguredProject(configFile); - closeExternalProject(uncheckedFileName: string, suppressRefresh?: boolean): void; - openExternalProject(proj: protocol.ExternalProject): void; + interface FormatCodeSettings extends EditorSettings { + insertSpaceAfterCommaDelimiter?: boolean; + insertSpaceAfterSemicolonInForStatements?: boolean; + insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; + insertSpaceAfterKeywordsInControlFlowStatements?: boolean; + insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; + placeOpenBraceOnNewLineForFunctions?: boolean; + placeOpenBraceOnNewLineForControlBlocks?: boolean; + } + interface CompilerOptions { + allowJs?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + baseUrl?: string; + charset?: string; + declaration?: boolean; + declarationDir?: string; + disableSizeLimit?: boolean; + emitBOM?: boolean; + emitDecoratorMetadata?: boolean; + experimentalDecorators?: boolean; + forceConsistentCasingInFileNames?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; + isolatedModules?: boolean; + jsx?: JsxEmit | ts.JsxEmit; + lib?: string[]; + locale?: string; + mapRoot?: string; + maxNodeModuleJsDepth?: number; + module?: ModuleKind | ts.ModuleKind; + moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; + newLine?: NewLineKind | ts.NewLineKind; + noEmit?: boolean; + noEmitHelpers?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; + noImplicitAny?: boolean; + noImplicitReturns?: boolean; + noImplicitThis?: boolean; + noUnusedLocals?: boolean; + noUnusedParameters?: boolean; + noImplicitUseStrict?: boolean; + noLib?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + outFile?: string; + paths?: MapLike; + plugins?: PluginImport[]; + preserveConstEnums?: boolean; + project?: string; + reactNamespace?: string; + removeComments?: boolean; + rootDir?: string; + rootDirs?: string[]; + skipLibCheck?: boolean; + skipDefaultLibCheck?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + strictNullChecks?: boolean; + suppressExcessPropertyErrors?: boolean; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget | ts.ScriptTarget; + traceResolution?: boolean; + types?: string[]; + typeRoots?: string[]; + [option: string]: CompilerOptionsValue | undefined; + } + namespace JsxEmit { + type None = "None"; + type Preserve = "Preserve"; + type ReactNative = "ReactNative"; + type React = "React"; + } + type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative; + namespace ModuleKind { + type None = "None"; + type CommonJS = "CommonJS"; + type AMD = "AMD"; + type UMD = "UMD"; + type System = "System"; + type ES6 = "ES6"; + type ES2015 = "ES2015"; + } + type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015; + namespace ModuleResolutionKind { + type Classic = "Classic"; + type Node = "Node"; + } + type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node; + namespace NewLineKind { + type Crlf = "Crlf"; + type Lf = "Lf"; + } + type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf; + namespace ScriptTarget { + type ES3 = "ES3"; + type ES5 = "ES5"; + type ES6 = "ES6"; + type ES2015 = "ES2015"; } + type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015; } declare namespace ts.server { + interface ServerCancellationToken extends HostCancellationToken { + setRequest(requestId: number): void; + resetRequest(requestId: number): void; + } + const nullCancellationToken: ServerCancellationToken; interface PendingErrorCheck { fileName: NormalizedPath; project: Project; @@ -11308,51 +4398,36 @@ declare namespace ts.server { } namespace CommandNames { const Brace: protocol.CommandTypes.Brace; - const BraceFull: protocol.CommandTypes.BraceFull; const BraceCompletion: protocol.CommandTypes.BraceCompletion; const Change: protocol.CommandTypes.Change; const Close: protocol.CommandTypes.Close; const Completions: protocol.CommandTypes.Completions; - const CompletionsFull: protocol.CommandTypes.CompletionsFull; const CompletionDetails: protocol.CommandTypes.CompletionDetails; const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList; const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile; const Configure: protocol.CommandTypes.Configure; const Definition: protocol.CommandTypes.Definition; - const DefinitionFull: protocol.CommandTypes.DefinitionFull; const Exit: protocol.CommandTypes.Exit; const Format: protocol.CommandTypes.Format; const Formatonkey: protocol.CommandTypes.Formatonkey; - const FormatFull: protocol.CommandTypes.FormatFull; - const FormatonkeyFull: protocol.CommandTypes.FormatonkeyFull; - const FormatRangeFull: protocol.CommandTypes.FormatRangeFull; const Geterr: protocol.CommandTypes.Geterr; const GeterrForProject: protocol.CommandTypes.GeterrForProject; const Implementation: protocol.CommandTypes.Implementation; - const ImplementationFull: protocol.CommandTypes.ImplementationFull; const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync; const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync; const NavBar: protocol.CommandTypes.NavBar; - const NavBarFull: protocol.CommandTypes.NavBarFull; const NavTree: protocol.CommandTypes.NavTree; const NavTreeFull: protocol.CommandTypes.NavTreeFull; const Navto: protocol.CommandTypes.Navto; - const NavtoFull: protocol.CommandTypes.NavtoFull; const Occurrences: protocol.CommandTypes.Occurrences; const DocumentHighlights: protocol.CommandTypes.DocumentHighlights; - const DocumentHighlightsFull: protocol.CommandTypes.DocumentHighlightsFull; const Open: protocol.CommandTypes.Open; const Quickinfo: protocol.CommandTypes.Quickinfo; - const QuickinfoFull: protocol.CommandTypes.QuickinfoFull; const References: protocol.CommandTypes.References; - const ReferencesFull: protocol.CommandTypes.ReferencesFull; const Reload: protocol.CommandTypes.Reload; const Rename: protocol.CommandTypes.Rename; - const RenameInfoFull: protocol.CommandTypes.RenameInfoFull; - const RenameLocationsFull: protocol.CommandTypes.RenameLocationsFull; const Saveto: protocol.CommandTypes.Saveto; const SignatureHelp: protocol.CommandTypes.SignatureHelp; - const SignatureHelpFull: protocol.CommandTypes.SignatureHelpFull; const TypeDefinition: protocol.CommandTypes.TypeDefinition; const ProjectInfo: protocol.CommandTypes.ProjectInfo; const ReloadProjects: protocol.CommandTypes.ReloadProjects; @@ -11360,37 +4435,44 @@ declare namespace ts.server { const OpenExternalProject: protocol.CommandTypes.OpenExternalProject; const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects; const CloseExternalProject: protocol.CommandTypes.CloseExternalProject; - const SynchronizeProjectList: protocol.CommandTypes.SynchronizeProjectList; - const ApplyChangedToOpenFiles: protocol.CommandTypes.ApplyChangedToOpenFiles; - const EncodedSemanticClassificationsFull: protocol.CommandTypes.EncodedSemanticClassificationsFull; - const Cleanup: protocol.CommandTypes.Cleanup; - const OutliningSpans: protocol.CommandTypes.OutliningSpans; const TodoComments: protocol.CommandTypes.TodoComments; const Indentation: protocol.CommandTypes.Indentation; const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate; - const CompilerOptionsDiagnosticsFull: protocol.CommandTypes.CompilerOptionsDiagnosticsFull; - const NameOrDottedNameSpan: protocol.CommandTypes.NameOrDottedNameSpan; - const BreakpointStatement: protocol.CommandTypes.BreakpointStatement; const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects; const GetCodeFixes: protocol.CommandTypes.GetCodeFixes; - const GetCodeFixesFull: protocol.CommandTypes.GetCodeFixesFull; const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes; } function formatMessage(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; + interface SessionOptions { + host: ServerHost; + cancellationToken: ServerCancellationToken; + useSingleInferredProject: boolean; + typingsInstaller: ITypingsInstaller; + byteLength: (buf: string, encoding?: string) => number; + hrtime: (start?: number[]) => number[]; + logger: Logger; + canUseEvents: boolean; + eventHandler?: ProjectServiceEventHandler; + throttleWaitMilliseconds?: number; + globalPlugins?: string[]; + pluginProbeLocations?: string[]; + } class Session implements EventSender { + private readonly gcTimer; + protected projectService: ProjectService; + private changeSeq; + private currentRequestId; + private errorCheck; + private eventHandler; private host; + private readonly cancellationToken; protected readonly typingsInstaller: ITypingsInstaller; private byteLength; private hrtime; protected logger: Logger; - protected readonly canUseEvents: boolean; - private readonly gcTimer; - protected projectService: ProjectService; - private errorTimer; - private immediateId; - private changeSeq; - private eventHander; - constructor(host: ServerHost, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller: ITypingsInstaller, byteLength: (buf: string, encoding?: string) => number, hrtime: (start?: number[]) => number[], logger: Logger, canUseEvents: boolean, eventHandler?: ProjectServiceEventHandler); + private canUseEvents; + constructor(opts: SessionOptions); + private sendRequestCompletedEvent(requestId); private defaultEventHandler(event); logError(err: Error, cmd: string): void; send(msg: protocol.Message): void; @@ -11400,7 +4482,7 @@ declare namespace ts.server { private semanticCheck(file, project); private syntacticCheck(file, project); private updateProjectStructure(seq, matchSeq, ms?); - private updateErrorCheck(checkList, seq, matchSeq, ms?, followMs?, requireOpen?); + private updateErrorCheck(next, checkList, seq, matchSeq, ms?, followMs?, requireOpen?); private cleanProjects(caption, projects); private cleanup(); private getEncodedSemanticClassifications(args); @@ -11420,6 +4502,7 @@ declare namespace ts.server { private getProjectInfoWorker(uncheckedFileName, projectFileName, needFileNameList); private getRenameInfo(args); private getProjects(args); + private getDefaultProject(args); private getRenameLocations(args, simplifiedResult); private getReferences(args, simplifiedResult); private openClientFile(fileName, fileContent?, scriptKind?); @@ -11445,7 +4528,7 @@ declare namespace ts.server { private getCompileOnSaveAffectedFileList(args); private emitFile(args); private getSignatureHelpItems(args, simplifiedResult); - private getDiagnostics(delay, fileNames); + private getDiagnostics(next, delay, fileNames); private change(args); private reload(args, reqSeq); private saveToTmp(fileName, tempFileName); @@ -11461,7 +4544,7 @@ declare namespace ts.server { private mapCodeAction(codeAction, scriptInfo); private convertTextChangeToCodeEdit(change, scriptInfo); private getBraceMatching(args, simplifiedResult); - getDiagnosticsForProject(delay: number, fileName: string): void; + private getDiagnosticsForProject(next, delay, fileName); getCanonicalFileName(fileName: string): string; exit(): void; private notRequired(); @@ -11471,6 +4554,9 @@ declare namespace ts.server { response?: any; responseRequired: boolean; }): void; + private setCurrentRequest(requestId); + private resetCurrentRequest(requestId); + executeWithRequestId(requestId: number, f: () => T): T; executeCommand(request: protocol.Request): { response?: any; responseRequired?: boolean; @@ -11534,8 +4620,8 @@ declare namespace ts.server { static fromString(host: ServerHost, script: string): ScriptVersionCache; } class LineIndexSnapshot implements ts.IScriptSnapshot { - version: number; - cache: ScriptVersionCache; + readonly version: number; + readonly cache: ScriptVersionCache; index: LineIndex; changesSincePreviousVersion: TextChange[]; constructor(version: number, cache: ScriptVersionCache); @@ -11563,218 +4649,483 @@ declare namespace ts.server { lineMap: number[]; }; } - class LineNode implements LineCollection { - totalChars: number; - totalLines: number; - children: LineCollection[]; - isLeaf(): boolean; - updateCounts(): void; - execWalk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker, childIndex: number, nodeType: CharRangeSection): boolean; - skipChild(relativeStart: number, relativeLength: number, childIndex: number, walkFns: ILineIndexWalker, nodeType: CharRangeSection): void; - walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; - charOffsetToLineNumberAndPos(lineNumber: number, charOffset: number): ILineInfo; - lineNumberToInfo(lineNumber: number, charOffset: number): ILineInfo; - childFromLineNumber(lineNumber: number, charOffset: number): { - child: LineCollection; - childIndex: number; - relativeLineNumber: number; - charOffset: number; - }; - childFromCharOffset(lineNumber: number, charOffset: number): { - child: LineCollection; - childIndex: number; - charOffset: number; - lineNumber: number; - }; - splitAfter(childIndex: number): LineNode; - remove(child: LineCollection): void; - findChildIndex(child: LineCollection): number; - insertAt(child: LineCollection, nodes: LineCollection[]): LineNode[]; - add(collection: LineCollection): boolean; - charCount(): number; - lineCount(): number; + class LineNode implements LineCollection { + totalChars: number; + totalLines: number; + children: LineCollection[]; + isLeaf(): boolean; + updateCounts(): void; + execWalk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker, childIndex: number, nodeType: CharRangeSection): boolean; + skipChild(relativeStart: number, relativeLength: number, childIndex: number, walkFns: ILineIndexWalker, nodeType: CharRangeSection): void; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + charOffsetToLineNumberAndPos(lineNumber: number, charOffset: number): ILineInfo; + lineNumberToInfo(lineNumber: number, charOffset: number): ILineInfo; + childFromLineNumber(lineNumber: number, charOffset: number): { + child: LineCollection; + childIndex: number; + relativeLineNumber: number; + charOffset: number; + }; + childFromCharOffset(lineNumber: number, charOffset: number): { + child: LineCollection; + childIndex: number; + charOffset: number; + lineNumber: number; + }; + splitAfter(childIndex: number): LineNode; + remove(child: LineCollection): void; + findChildIndex(child: LineCollection): number; + insertAt(child: LineCollection, nodes: LineCollection[]): LineNode[]; + add(collection: LineCollection): boolean; + charCount(): number; + lineCount(): number; + } + class LineLeaf implements LineCollection { + text: string; + constructor(text: string); + isLeaf(): boolean; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + charCount(): number; + lineCount(): number; + } +} +declare namespace ts.server { + class ScriptInfo { + private readonly host; + readonly fileName: NormalizedPath; + readonly scriptKind: ScriptKind; + hasMixedContent: boolean; + readonly containingProjects: Project[]; + private formatCodeSettings; + readonly path: Path; + private fileWatcher; + private textStorage; + private isOpen; + constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent?: boolean); + isScriptOpen(): boolean; + open(newText: string): void; + close(): void; + getSnapshot(): IScriptSnapshot; + getFormatCodeSettings(): FormatCodeSettings; + attachToProject(project: Project): boolean; + isAttached(project: Project): boolean; + detachFromProject(project: Project): void; + detachAllProjects(): void; + getDefaultProject(): Project; + registerFileUpdate(): void; + setFormatOptions(formatSettings: FormatCodeSettings): void; + setWatcher(watcher: FileWatcher): void; + stopWatcher(): void; + getLatestVersion(): string; + reload(script: string): void; + saveTo(fileName: string): void; + reloadFromFile(tempFileName?: NormalizedPath): void; + getLineInfo(line: number): ILineInfo; + editContent(start: number, end: number, newText: string): void; + markContainingProjectsAsDirty(): void; + lineToTextSpan(line: number): TextSpan; + lineOffsetToPosition(line: number, offset: number): number; + positionToLineOffset(position: number): ILineInfo; + isJavaScript(): boolean; + } +} +declare namespace ts.server { + class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost { + private readonly host; + private readonly project; + private readonly cancellationToken; + private compilationSettings; + private readonly resolvedModuleNames; + private readonly resolvedTypeReferenceDirectives; + private readonly getCanonicalFileName; + private filesWithChangedSetOfUnresolvedImports; + private readonly resolveModuleName; + readonly trace: (s: string) => void; + readonly realpath?: (path: string) => string; + constructor(host: ServerHost, project: Project, cancellationToken: HostCancellationToken); + startRecordingFilesWithChangedResolutions(): void; + finishRecordingFilesWithChangedResolutions(): Path[]; + private resolveNamesWithLocalCache(names, containingFile, cache, loader, getResult, getResultFileName, logChanges); + getNewLine(): string; + getProjectVersion(): string; + getCompilationSettings(): CompilerOptions; + useCaseSensitiveFileNames(): boolean; + getCancellationToken(): HostCancellationToken; + resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModuleFull[]; + getDefaultLibFileName(): string; + getScriptSnapshot(filename: string): ts.IScriptSnapshot; + getScriptFileNames(): string[]; + getTypeRootsVersion(): number; + getScriptKind(fileName: string): ScriptKind; + getScriptVersion(filename: string): string; + getCurrentDirectory(): string; + resolvePath(path: string): string; + fileExists(path: string): boolean; + readFile(fileName: string): string; + directoryExists(path: string): boolean; + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + getDirectories(path: string): string[]; + notifyFileRemoved(info: ScriptInfo): void; + setCompilationSettings(opt: ts.CompilerOptions): void; + } +} +declare namespace ts.server { + interface ITypingsInstaller { + enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray): void; + attach(projectService: ProjectService): void; + onProjectClosed(p: Project): void; + readonly globalTypingsCacheLocation: string; + } + const nullTypingsInstaller: ITypingsInstaller; + class TypingsCache { + private readonly installer; + private readonly perProjectCache; + constructor(installer: ITypingsInstaller); + getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray, forceRefresh: boolean): SortedReadonlyArray; + updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]): void; + deleteTypingsForProject(projectName: string): void; + onProjectClosed(project: Project): void; + } +} +declare namespace ts.server { + function shouldEmitFile(scriptInfo: ScriptInfo): boolean; + class BuilderFileInfo { + readonly scriptInfo: ScriptInfo; + readonly project: Project; + private lastCheckedShapeSignature; + constructor(scriptInfo: ScriptInfo, project: Project); + isExternalModuleOrHasOnlyAmbientExternalModules(): boolean; + private containsOnlyAmbientModules(sourceFile); + private computeHash(text); + private getSourceFile(); + updateShapeSignature(): boolean; + } + interface Builder { + readonly project: Project; + getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; + onProjectUpdateGraph(): void; + emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; + clear(): void; + } + function createBuilder(project: Project): Builder; +} +declare namespace ts.server { + enum ProjectKind { + Inferred = 0, + Configured = 1, + External = 2, + } + function allRootFilesAreJsOrDts(project: Project): boolean; + function allFilesAreJsOrDts(project: Project): boolean; + class UnresolvedImportsMap { + readonly perFileMap: FileMap>; + private version; + clear(): void; + getVersion(): number; + remove(path: Path): void; + get(path: Path): ReadonlyArray; + set(path: Path, value: ReadonlyArray): void; + } + interface PluginCreateInfo { + project: Project; + languageService: LanguageService; + languageServiceHost: LanguageServiceHost; + serverHost: ServerHost; + config: any; + } + interface PluginModule { + create(createInfo: PluginCreateInfo): LanguageService; + getExternalFiles?(proj: Project): string[]; + } + interface PluginModuleFactory { + (mod: { + typescript: typeof ts; + }): PluginModule; + } + abstract class Project { + private readonly projectName; + readonly projectKind: ProjectKind; + readonly projectService: ProjectService; + private documentRegistry; + private compilerOptions; + compileOnSaveEnabled: boolean; + private rootFiles; + private rootFilesMap; + private program; + private cachedUnresolvedImportsPerFile; + private lastCachedUnresolvedImportsList; + protected languageService: LanguageService; + languageServiceEnabled: boolean; + protected readonly lsHost: LSHost; + builder: Builder; + private updatedFileNames; + private lastReportedFileNames; + private lastReportedVersion; + private projectStructureVersion; + private projectStateVersion; + private typingFiles; + protected projectErrors: Diagnostic[]; + typesVersion: number; + isNonTsProject(): boolean; + isJsOnlyProject(): boolean; + getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap; + static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {}; + constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); + private setInternalCompilerOptionsForEmittingJsFiles(); + getProjectErrors(): Diagnostic[]; + getLanguageService(ensureSynchronized?: boolean): LanguageService; + getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[]; + getProjectVersion(): string; + enableLanguageService(): void; + disableLanguageService(): void; + getProjectName(): string; + abstract getProjectRootPath(): string | undefined; + abstract getTypeAcquisition(): TypeAcquisition; + getExternalFiles(): string[]; + getSourceFile(path: Path): SourceFile; + updateTypes(): void; + close(): void; + getCompilerOptions(): CompilerOptions; + hasRoots(): boolean; + getRootFiles(): NormalizedPath[]; + getRootFilesLSHost(): string[]; + getRootScriptInfos(): ScriptInfo[]; + getScriptInfos(): ScriptInfo[]; + getFileEmitOutput(info: ScriptInfo, emitOnlyDtsFiles: boolean): EmitOutput; + getFileNames(excludeFilesFromExternalLibraries?: boolean): NormalizedPath[]; + getAllEmittableFiles(): string[]; + containsScriptInfo(info: ScriptInfo): boolean; + containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean; + isRoot(info: ScriptInfo): boolean; + addRoot(info: ScriptInfo): void; + removeFile(info: ScriptInfo, detachFromProject?: boolean): void; + registerFileUpdate(fileName: string): void; + markAsDirty(): void; + private extractUnresolvedImportsFromSourceFile(file, result); + updateGraph(): boolean; + private setTypings(typings); + private updateGraphWorker(); + getScriptInfoLSHost(fileName: string): ScriptInfo; + getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; + getScriptInfo(uncheckedFileName: string): ScriptInfo; + filesToString(): string; + setCompilerOptions(compilerOptions: CompilerOptions): void; + reloadScript(filename: NormalizedPath, tempFileName?: NormalizedPath): boolean; + getReferencedFiles(path: Path): Path[]; + protected removeRoot(info: ScriptInfo): void; + } + class InferredProject extends Project { + private static newName; + private _isJsInferredProject; + toggleJsInferredProject(isJsInferredProject: boolean): void; + setCompilerOptions(options?: CompilerOptions): void; + directoriesWatchedForTsconfig: string[]; + constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions); + addRoot(info: ScriptInfo): void; + removeRoot(info: ScriptInfo): void; + getProjectRootPath(): string; + close(): void; + getTypeAcquisition(): TypeAcquisition; } - class LineLeaf implements LineCollection { - text: string; - constructor(text: string); - isLeaf(): boolean; - walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; - charCount(): number; - lineCount(): number; + class ConfiguredProject extends Project { + private wildcardDirectories; + compileOnSaveEnabled: boolean; + private typeAcquisition; + private projectFileWatcher; + private directoryWatcher; + private directoriesWatchedForWildcards; + private typeRootsWatchers; + readonly canonicalConfigFilePath: NormalizedPath; + private plugins; + openRefCount: number; + constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, compilerOptions: CompilerOptions, wildcardDirectories: Map, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean); + getConfigFilePath(): string; + enablePlugins(): void; + private enablePlugin(pluginConfigEntry, searchPaths); + private enableProxy(pluginModuleFactory, configEntry); + getProjectRootPath(): string; + setProjectErrors(projectErrors: Diagnostic[]): void; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; + getTypeAcquisition(): TypeAcquisition; + getExternalFiles(): string[]; + watchConfigFile(callback: (project: ConfiguredProject) => void): void; + watchTypeRoots(callback: (project: ConfiguredProject, path: string) => void): void; + watchConfigDirectory(callback: (project: ConfiguredProject, path: string) => void): void; + watchWildcards(callback: (project: ConfiguredProject, path: string) => void): void; + stopWatchingDirectory(): void; + close(): void; + addOpenRef(): void; + deleteOpenRef(): number; + getEffectiveTypeRoots(): string[]; } -} -declare let debugObjectHost: any; -declare namespace ts { - interface ScriptSnapshotShim { - getText(start: number, end: number): string; - getLength(): number; - getChangeRange(oldSnapshot: ScriptSnapshotShim): string; - dispose?(): void; + class ExternalProject extends Project { + externalProjectName: string; + compileOnSaveEnabled: boolean; + private readonly projectFilePath; + private typeAcquisition; + constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean, projectFilePath?: string); + getProjectRootPath(): string; + getTypeAcquisition(): TypeAcquisition; + setProjectErrors(projectErrors: Diagnostic[]): void; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; } - interface Logger { - log(s: string): void; - trace(s: string): void; - error(s: string): void; +} +declare namespace ts.server { + const maxProgramSizeForNonTsFiles: number; + const ContextEvent = "context"; + const ConfigFileDiagEvent = "configFileDiag"; + const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; + interface ContextEvent { + eventName: typeof ContextEvent; + data: { + project: Project; + fileName: NormalizedPath; + }; } - interface LanguageServiceShimHost extends Logger { - getCompilationSettings(): string; - getScriptFileNames(): string; - getScriptKind?(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): ScriptSnapshotShim; - getLocalizedDiagnosticMessages(): string; - getCancellationToken(): HostCancellationToken; - getCurrentDirectory(): string; - getDirectories(path: string): string; - getDefaultLibFileName(options: string): string; - getNewLine?(): string; - getProjectVersion?(): string; - useCaseSensitiveFileNames?(): boolean; - getTypeRootsVersion?(): number; - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - readFile(path: string, encoding?: string): string; - fileExists(path: string): boolean; - getModuleResolutionsForFile?(fileName: string): string; - getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string; - directoryExists(directoryName: string): boolean; + interface ConfigFileDiagEvent { + eventName: typeof ConfigFileDiagEvent; + data: { + triggerFile: string; + configFileName: string; + diagnostics: Diagnostic[]; + }; } - interface CoreServicesShimHost extends Logger { - directoryExists(directoryName: string): boolean; - fileExists(fileName: string): boolean; - getCurrentDirectory(): string; - getDirectories(path: string): string; - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - readFile(fileName: string): string; - realpath?(path: string): string; - trace(s: string): void; - useCaseSensitiveFileNames?(): boolean; + interface ProjectLanguageServiceStateEvent { + eventName: typeof ProjectLanguageServiceStateEvent; + data: { + project: Project; + languageServiceEnabled: boolean; + }; } - interface IFileReference { - path: string; - position: number; - length: number; + type ProjectServiceEvent = ContextEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent; + interface ProjectServiceEventHandler { + (event: ProjectServiceEvent): void; } - interface ShimFactory { - registerShim(shim: Shim): void; - unregisterShim(shim: Shim): void; + interface SafeList { + [name: string]: { + match: RegExp; + exclude?: Array>; + types?: string[]; + }; } - interface Shim { - dispose(_dummy: any): void; + function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; + function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; + function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind; + function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind.Unknown | ScriptKind.JS | ScriptKind.JSX | ScriptKind.TS | ScriptKind.TSX; + function combineProjectOutput(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean): T[]; + interface HostConfiguration { + formatCodeOptions: FormatCodeSettings; + hostInfo: string; + extraFileExtensions?: JsFileExtensionInfo[]; } - interface LanguageServiceShim extends Shim { - languageService: LanguageService; - dispose(_dummy: any): void; - refresh(throwOnError: boolean): void; - cleanupSemanticCache(): void; - getSyntacticDiagnostics(fileName: string): string; - getSemanticDiagnostics(fileName: string): string; - getCompilerOptionsDiagnostics(): string; - getSyntacticClassifications(fileName: string, start: number, length: number): string; - getSemanticClassifications(fileName: string, start: number, length: number): string; - getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string; - getEncodedSemanticClassifications(fileName: string, start: number, length: number): string; - getCompletionsAtPosition(fileName: string, position: number): string; - getCompletionEntryDetails(fileName: string, position: number, entryName: string): string; - getQuickInfoAtPosition(fileName: string, position: number): string; - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string; - getBreakpointStatementAtPosition(fileName: string, position: number): string; - getSignatureHelpItems(fileName: string, position: number): string; - getRenameInfo(fileName: string, position: number): string; - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string; - getDefinitionAtPosition(fileName: string, position: number): string; - getTypeDefinitionAtPosition(fileName: string, position: number): string; - getImplementationAtPosition(fileName: string, position: number): string; - getReferencesAtPosition(fileName: string, position: number): string; - findReferences(fileName: string, position: number): string; - getOccurrencesAtPosition(fileName: string, position: number): string; - getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; - getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string): string; - getNavigationBarItems(fileName: string): string; - getNavigationTree(fileName: string): string; - getOutliningSpans(fileName: string): string; - getTodoComments(fileName: string, todoCommentDescriptors: string): string; - getBraceMatchingAtPosition(fileName: string, position: number): string; - getIndentationAtPosition(fileName: string, position: number, options: string): string; - getFormattingEditsForRange(fileName: string, start: number, end: number, options: string): string; - getFormattingEditsForDocument(fileName: string, options: string): string; - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string): string; - getDocCommentTemplateAtPosition(fileName: string, position: number): string; - isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): string; - getEmitOutput(fileName: string): string; - getEmitOutputObject(fileName: string): EmitOutput; - } - interface ClassifierShim extends Shim { - getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; - getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; - } - interface CoreServicesShim extends Shim { - getAutomaticTypeDirectiveNames(compilerOptionsJson: string): string; - getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getDefaultCompilationSettings(): string; - discoverTypings(discoverTypingsJson: string): string; - } - class LanguageServiceShimHostAdapter implements LanguageServiceHost { - private shimHost; - private files; - private loggingEnabled; - private tracingEnabled; - resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModuleFull[]; - resolveTypeReferenceDirectives: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; - directoryExists: (directoryName: string) => boolean; - constructor(shimHost: LanguageServiceShimHost); - log(s: string): void; - trace(s: string): void; - error(s: string): void; - getProjectVersion(): string; - getTypeRootsVersion(): number; - useCaseSensitiveFileNames(): boolean; - getCompilationSettings(): CompilerOptions; - getScriptFileNames(): string[]; - getScriptSnapshot(fileName: string): IScriptSnapshot; - getScriptKind(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getLocalizedDiagnosticMessages(): any; - getCancellationToken(): HostCancellationToken; - getCurrentDirectory(): string; - getDirectories(path: string): string[]; - getDefaultLibFileName(options: CompilerOptions): string; - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[], depth?: number): string[]; - readFile(path: string, encoding?: string): string; - fileExists(path: string): boolean; + interface OpenConfiguredProjectResult { + configFileName?: NormalizedPath; + configFileErrors?: Diagnostic[]; } - class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost { - private shimHost; - directoryExists: (directoryName: string) => boolean; - realpath: (path: string) => string; - useCaseSensitiveFileNames: boolean; - constructor(shimHost: CoreServicesShimHost); - readDirectory(rootDir: string, extensions: string[], exclude: string[], include: string[], depth?: number): string[]; - fileExists(fileName: string): boolean; - readFile(fileName: string): string; - private readDirectoryFallback(rootDir, extension, exclude); - getDirectories(path: string): string[]; + interface ProjectServiceOptions { + host: ServerHost; + logger: Logger; + cancellationToken: HostCancellationToken; + useSingleInferredProject: boolean; + typingsInstaller: ITypingsInstaller; + eventHandler?: ProjectServiceEventHandler; + throttleWaitMilliseconds?: number; + globalPlugins?: string[]; + pluginProbeLocations?: string[]; } - function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { - message: string; - start: number; - length: number; - category: string; - code: number; - }[]; - class TypeScriptServicesFactory implements ShimFactory { - private _shims; - private documentRegistry; - getServicesVersion(): string; - createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim; - createClassifierShim(logger: Logger): ClassifierShim; - createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim; - close(): void; - registerShim(shim: Shim): void; - unregisterShim(shim: Shim): void; + class ProjectService { + readonly typingsCache: TypingsCache; + private readonly documentRegistry; + private readonly filenameToScriptInfo; + private readonly externalProjectToConfiguredProjectMap; + readonly externalProjects: ExternalProject[]; + readonly inferredProjects: InferredProject[]; + readonly configuredProjects: ConfiguredProject[]; + readonly openFiles: ScriptInfo[]; + private compilerOptionsForInferredProjects; + private compileOnSaveForInferredProjects; + private readonly projectToSizeMap; + private readonly directoryWatchers; + private readonly throttledOperations; + private readonly hostConfiguration; + private static safelist; + private changedFiles; + readonly toCanonicalFileName: (f: string) => string; + lastDeletedFile: ScriptInfo; + readonly host: ServerHost; + readonly logger: Logger; + readonly cancellationToken: HostCancellationToken; + readonly useSingleInferredProject: boolean; + readonly typingsInstaller: ITypingsInstaller; + readonly throttleWaitMilliseconds?: number; + private readonly eventHandler?; + readonly globalPlugins: ReadonlyArray; + readonly pluginProbeLocations: ReadonlyArray; + constructor(opts: ProjectServiceOptions); + ensureInferredProjectsUpToDate_TestOnly(): void; + getCompilerOptionsForInferredProjects(): CompilerOptions; + onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; + updateTypingsForProject(response: SetTypings | InvalidateCachedTypings): void; + setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions): void; + stopWatchingDirectory(directory: string): void; + findProject(projectName: string): Project; + getDefaultProjectForFile(fileName: NormalizedPath, refreshInferredProjects: boolean): Project; + private ensureInferredProjectsUpToDate(); + private findContainingExternalProject(fileName); + getFormatCodeOptions(file?: NormalizedPath): FormatCodeSettings; + private updateProjectGraphs(projects); + private onSourceFileChanged(fileName); + private handleDeletedFile(info); + private onTypeRootFileChanged(project, fileName); + private onSourceFileInDirectoryChangedForConfiguredProject(project, fileName); + private handleChangeInSourceFileForConfiguredProject(project, triggerFile); + private onConfigChangedForConfiguredProject(project); + private onConfigFileAddedForInferredProject(fileName); + private getCanonicalFileName(fileName); + private removeProject(project); + private assignScriptInfoToInferredProjectIfNecessary(info, addToListOfOpenFiles); + private closeOpenFile(info); + private openOrUpdateConfiguredProjectForFile(fileName); + private findConfigFile(searchPath); + private printProjects(); + private findConfiguredProjectByProjectName(configFileName); + private findExternalProjectByProjectName(projectFileName); + private convertConfigFileContentToProjectOptions(configFilename); + private exceededTotalSizeLimitForNonTsFiles(name, options, fileNames, propertyReader); + private createAndAddExternalProject(projectFileName, files, options, typeAcquisition); + private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile); + private createAndAddConfiguredProject(configFileName, projectOptions, configFileErrors, clientFileName?); + private watchConfigDirectoryForProject(project, options); + private addFilesToProjectAndUpdateGraph(project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors); + private openConfigFile(configFileName, clientFileName?); + private updateNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors); + private updateConfiguredProject(project); + createInferredProjectWithRootFileIfNecessary(root: ScriptInfo): InferredProject; + getOrCreateScriptInfo(uncheckedFileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind): ScriptInfo; + getScriptInfo(uncheckedFileName: string): ScriptInfo; + getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): ScriptInfo; + getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; + getScriptInfoForPath(fileName: Path): ScriptInfo; + setHostConfiguration(args: protocol.ConfigureRequestArguments): void; + closeLog(): void; + reloadProjects(): void; + refreshInferredProjects(): void; + openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind): OpenConfiguredProjectResult; + openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): OpenConfiguredProjectResult; + closeClientFile(uncheckedFileName: string): void; + private collectChanges(lastKnownProjectVersions, currentProjects, result); + private closeConfiguredProject(configFile); + closeExternalProject(uncheckedFileName: string, suppressRefresh?: boolean): void; + openExternalProjects(projects: protocol.ExternalProject[]): void; + private static filenameEscapeRegexp; + private static escapeFilenameForRegex(filename); + resetSafeList(): void; + loadSafeList(fileName: string): void; + applySafeList(proj: protocol.ExternalProject): void; + openExternalProject(proj: protocol.ExternalProject, suppressRefreshOfInferredProjects?: boolean): void; } } -declare namespace TypeScript.Services { - const TypeScriptServicesFactory: typeof ts.TypeScriptServicesFactory; -} -declare const toolsVersion = "2.2"; + +export = ts; +export as namespace ts; \ No newline at end of file diff --git a/node_modules/typescript/lib/tsserverlibrary.js b/node_modules/typescript/lib/tsserverlibrary.js index 4ed37099e..5acf5bb26 100644 --- a/node_modules/typescript/lib/tsserverlibrary.js +++ b/node_modules/typescript/lib/tsserverlibrary.js @@ -13,13 +13,455 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +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; }; +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 __()); + }; +})(); var ts; (function (ts) { + var SyntaxKind; + (function (SyntaxKind) { + SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; + SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["ShebangTrivia"] = 6] = "ShebangTrivia"; + SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral"; + SyntaxKind[SyntaxKind["JsxText"] = 10] = "JsxText"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 11] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 12] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["TemplateHead"] = 13] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 14] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 15] = "TemplateTail"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 16] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 17] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 18] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 19] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 20] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 21] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 22] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 23] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 24] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 25] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 26] = "LessThanToken"; + SyntaxKind[SyntaxKind["LessThanSlashToken"] = 27] = "LessThanSlashToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 28] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 29] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 30] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 31] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 32] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 33] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 34] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 35] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 36] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 37] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 38] = "AsteriskToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 39] = "AsteriskAsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 40] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 41] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 42] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 43] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 44] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 46] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 47] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 48] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 49] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 50] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 51] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 52] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 53] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 54] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 55] = "ColonToken"; + SyntaxKind[SyntaxKind["AtToken"] = 56] = "AtToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 57] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 58] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 59] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 60] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 61] = "AsteriskAsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 62] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 63] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 64] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 66] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 67] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 68] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 69] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 70] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 71] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 72] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 73] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 74] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 75] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 76] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 77] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 78] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 79] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 80] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 81] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 82] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 83] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 84] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 85] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 86] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 87] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 88] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 89] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 90] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 91] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 92] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 93] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 94] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 95] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 96] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 97] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 98] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 99] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 100] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 101] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 102] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 103] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 104] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 105] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 106] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 107] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 108] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 109] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 110] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 111] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 112] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 113] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 114] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 115] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 116] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 117] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 118] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 119] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 120] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 121] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 122] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 123] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 124] = "GetKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 125] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 126] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 127] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 128] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 129] = "NeverKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 133] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 134] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 135] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 136] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 137] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 138] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 139] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 140] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 141] = "OfKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 142] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 143] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 144] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 145] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 146] = "Decorator"; + SyntaxKind[SyntaxKind["PropertySignature"] = 147] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 148] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 149] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 150] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 151] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 152] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 153] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 154] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 155] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 156] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypePredicate"] = 157] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 158] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 159] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 160] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 161] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 162] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 163] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 164] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 165] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 166] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 167] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 168] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 169] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 170] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 171] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 172] = "LiteralType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 173] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 174] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 175] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 176] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 177] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 179] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 180] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 181] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 182] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 183] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 184] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 185] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 186] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 187] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 188] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 189] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 190] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 191] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 192] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 193] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 194] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 195] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 196] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 197] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 198] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 199] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 200] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 201] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 202] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 203] = "MetaProperty"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 204] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 205] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 206] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 207] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 208] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 209] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 210] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 211] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 212] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 213] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 214] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 215] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 216] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 217] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 218] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 219] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 220] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 221] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 222] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 223] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 224] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 226] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 227] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 228] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 229] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 230] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 231] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 232] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 233] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 234] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 235] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 236] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 237] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 238] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 239] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 240] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 241] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 242] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 243] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 244] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 245] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 246] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 247] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["JsxElement"] = 248] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 249] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 250] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 251] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 252] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 253] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 254] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 255] = "JsxExpression"; + SyntaxKind[SyntaxKind["CaseClause"] = 256] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 257] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 258] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 259] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 260] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 261] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 262] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 263] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 264] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 265] = "Bundle"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 266] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 267] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 268] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 269] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 270] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 271] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 272] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 273] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 274] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 275] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 276] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 277] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 278] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 279] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 280] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 281] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 283] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 284] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 285] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 286] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 287] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 288] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 289] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 290] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 291] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 292] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 58] = "FirstCompoundAssignment"; + SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 69] = "LastCompoundAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 141] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 157] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 172] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; + SyntaxKind[SyntaxKind["LastToken"] = 141] = "LastToken"; + SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; + SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 12] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 12] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 142] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 266] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 282] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; + })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); + var NodeFlags; + (function (NodeFlags) { + NodeFlags[NodeFlags["None"] = 0] = "None"; + NodeFlags[NodeFlags["Let"] = 1] = "Let"; + NodeFlags[NodeFlags["Const"] = 2] = "Const"; + NodeFlags[NodeFlags["NestedNamespace"] = 4] = "NestedNamespace"; + NodeFlags[NodeFlags["Synthesized"] = 8] = "Synthesized"; + NodeFlags[NodeFlags["Namespace"] = 16] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 32] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 64] = "ContainsThis"; + NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn"; + NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn"; + NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 1024] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 2048] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 4096] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 8192] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 16384] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 32768] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; + NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; + NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 96256] = "ContextFlags"; + NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags"; + })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); + var ModifierFlags; + (function (ModifierFlags) { + ModifierFlags[ModifierFlags["None"] = 0] = "None"; + ModifierFlags[ModifierFlags["Export"] = 1] = "Export"; + ModifierFlags[ModifierFlags["Ambient"] = 2] = "Ambient"; + ModifierFlags[ModifierFlags["Public"] = 4] = "Public"; + ModifierFlags[ModifierFlags["Private"] = 8] = "Private"; + ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; + ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; + ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; + ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; + ModifierFlags[ModifierFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags"; + ModifierFlags[ModifierFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; + ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier"; + ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 2270] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; + })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); + var JsxFlags; + (function (JsxFlags) { + JsxFlags[JsxFlags["None"] = 0] = "None"; + JsxFlags[JsxFlags["IntrinsicNamedElement"] = 1] = "IntrinsicNamedElement"; + JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement"; + JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement"; + })(JsxFlags = ts.JsxFlags || (ts.JsxFlags = {})); + var RelationComparisonResult; + (function (RelationComparisonResult) { + RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded"; + RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed"; + RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; + })(RelationComparisonResult = ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); + var GeneratedIdentifierKind; + (function (GeneratedIdentifierKind) { + GeneratedIdentifierKind[GeneratedIdentifierKind["None"] = 0] = "None"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Auto"] = 1] = "Auto"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Loop"] = 2] = "Loop"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node"; + })(GeneratedIdentifierKind = ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {})); + var NumericLiteralFlags; + (function (NumericLiteralFlags) { + NumericLiteralFlags[NumericLiteralFlags["None"] = 0] = "None"; + NumericLiteralFlags[NumericLiteralFlags["Scientific"] = 2] = "Scientific"; + NumericLiteralFlags[NumericLiteralFlags["Octal"] = 4] = "Octal"; + NumericLiteralFlags[NumericLiteralFlags["HexSpecifier"] = 8] = "HexSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinarySpecifier"] = 16] = "BinarySpecifier"; + NumericLiteralFlags[NumericLiteralFlags["OctalSpecifier"] = 32] = "OctalSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctalSpecifier"] = 48] = "BinaryOrOctalSpecifier"; + })(NumericLiteralFlags = ts.NumericLiteralFlags || (ts.NumericLiteralFlags = {})); + var FlowFlags; + (function (FlowFlags) { + FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable"; + FlowFlags[FlowFlags["Start"] = 2] = "Start"; + FlowFlags[FlowFlags["BranchLabel"] = 4] = "BranchLabel"; + FlowFlags[FlowFlags["LoopLabel"] = 8] = "LoopLabel"; + FlowFlags[FlowFlags["Assignment"] = 16] = "Assignment"; + FlowFlags[FlowFlags["TrueCondition"] = 32] = "TrueCondition"; + FlowFlags[FlowFlags["FalseCondition"] = 64] = "FalseCondition"; + FlowFlags[FlowFlags["SwitchClause"] = 128] = "SwitchClause"; + FlowFlags[FlowFlags["ArrayMutation"] = 256] = "ArrayMutation"; + FlowFlags[FlowFlags["Referenced"] = 512] = "Referenced"; + FlowFlags[FlowFlags["Shared"] = 1024] = "Shared"; + FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally"; + FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally"; + FlowFlags[FlowFlags["Label"] = 12] = "Label"; + FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; + })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {})); var OperationCanceledException = (function () { function OperationCanceledException() { } @@ -32,6 +474,55 @@ var ts; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var NodeBuilderFlags; + (function (NodeBuilderFlags) { + NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None"; + NodeBuilderFlags[NodeBuilderFlags["allowThisInObjectLiteral"] = 1] = "allowThisInObjectLiteral"; + NodeBuilderFlags[NodeBuilderFlags["allowQualifedNameInPlaceOfIdentifier"] = 2] = "allowQualifedNameInPlaceOfIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowTypeParameterInQualifiedName"] = 4] = "allowTypeParameterInQualifiedName"; + NodeBuilderFlags[NodeBuilderFlags["allowAnonymousIdentifier"] = 8] = "allowAnonymousIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyUnionOrIntersection"] = 16] = "allowEmptyUnionOrIntersection"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyTuple"] = 32] = "allowEmptyTuple"; + })(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {})); + var TypeFormatFlags; + (function (TypeFormatFlags) { + TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; + TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType"; + TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 2] = "UseTypeOfFunction"; + TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 4] = "NoTruncation"; + TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 8] = "WriteArrowStyleSignature"; + TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 16] = "WriteOwnNameForAnyLike"; + TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; + TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType"; + TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType"; + TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; + TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias"; + TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue"; + TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 2048] = "SuppressAnyReturnType"; + TypeFormatFlags[TypeFormatFlags["AddUndefined"] = 4096] = "AddUndefined"; + })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); + var SymbolFormatFlags; + (function (SymbolFormatFlags) { + SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None"; + SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments"; + SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing"; + })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); + var SymbolAccessibility; + (function (SymbolAccessibility) { + SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible"; + SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible"; + SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; + })(SymbolAccessibility = ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); + var SyntheticSymbolKind; + (function (SyntheticSymbolKind) { + SyntheticSymbolKind[SyntheticSymbolKind["UnionOrIntersection"] = 0] = "UnionOrIntersection"; + SyntheticSymbolKind[SyntheticSymbolKind["Spread"] = 1] = "Spread"; + })(SyntheticSymbolKind = ts.SyntheticSymbolKind || (ts.SyntheticSymbolKind = {})); + var TypePredicateKind; + (function (TypePredicateKind) { + TypePredicateKind[TypePredicateKind["This"] = 0] = "This"; + TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier"; + })(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {})); var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown"; @@ -46,6 +537,191 @@ var ts; TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 9] = "TypeWithCallSignature"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType"; })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); + var SymbolFlags; + (function (SymbolFlags) { + SymbolFlags[SymbolFlags["None"] = 0] = "None"; + SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable"; + SymbolFlags[SymbolFlags["BlockScopedVariable"] = 2] = "BlockScopedVariable"; + SymbolFlags[SymbolFlags["Property"] = 4] = "Property"; + SymbolFlags[SymbolFlags["EnumMember"] = 8] = "EnumMember"; + SymbolFlags[SymbolFlags["Function"] = 16] = "Function"; + SymbolFlags[SymbolFlags["Class"] = 32] = "Class"; + SymbolFlags[SymbolFlags["Interface"] = 64] = "Interface"; + SymbolFlags[SymbolFlags["ConstEnum"] = 128] = "ConstEnum"; + SymbolFlags[SymbolFlags["RegularEnum"] = 256] = "RegularEnum"; + SymbolFlags[SymbolFlags["ValueModule"] = 512] = "ValueModule"; + SymbolFlags[SymbolFlags["NamespaceModule"] = 1024] = "NamespaceModule"; + SymbolFlags[SymbolFlags["TypeLiteral"] = 2048] = "TypeLiteral"; + SymbolFlags[SymbolFlags["ObjectLiteral"] = 4096] = "ObjectLiteral"; + SymbolFlags[SymbolFlags["Method"] = 8192] = "Method"; + SymbolFlags[SymbolFlags["Constructor"] = 16384] = "Constructor"; + SymbolFlags[SymbolFlags["GetAccessor"] = 32768] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 65536] = "SetAccessor"; + SymbolFlags[SymbolFlags["Signature"] = 131072] = "Signature"; + SymbolFlags[SymbolFlags["TypeParameter"] = 262144] = "TypeParameter"; + SymbolFlags[SymbolFlags["TypeAlias"] = 524288] = "TypeAlias"; + SymbolFlags[SymbolFlags["ExportValue"] = 1048576] = "ExportValue"; + SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType"; + SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace"; + SymbolFlags[SymbolFlags["Alias"] = 8388608] = "Alias"; + SymbolFlags[SymbolFlags["Prototype"] = 16777216] = "Prototype"; + SymbolFlags[SymbolFlags["ExportStar"] = 33554432] = "ExportStar"; + SymbolFlags[SymbolFlags["Optional"] = 67108864] = "Optional"; + SymbolFlags[SymbolFlags["Transient"] = 134217728] = "Transient"; + SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; + SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; + SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; + SymbolFlags[SymbolFlags["Type"] = 793064] = "Type"; + SymbolFlags[SymbolFlags["Namespace"] = 1920] = "Namespace"; + SymbolFlags[SymbolFlags["Module"] = 1536] = "Module"; + SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor"; + SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 107454] = "FunctionScopedVariableExcludes"; + SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 107455] = "BlockScopedVariableExcludes"; + SymbolFlags[SymbolFlags["ParameterExcludes"] = 107455] = "ParameterExcludes"; + SymbolFlags[SymbolFlags["PropertyExcludes"] = 0] = "PropertyExcludes"; + SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 900095] = "EnumMemberExcludes"; + SymbolFlags[SymbolFlags["FunctionExcludes"] = 106927] = "FunctionExcludes"; + SymbolFlags[SymbolFlags["ClassExcludes"] = 899519] = "ClassExcludes"; + SymbolFlags[SymbolFlags["InterfaceExcludes"] = 792968] = "InterfaceExcludes"; + SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes"; + SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes"; + SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 106639] = "ValueModuleExcludes"; + SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; + SymbolFlags[SymbolFlags["MethodExcludes"] = 99263] = "MethodExcludes"; + SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 41919] = "GetAccessorExcludes"; + SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 530920] = "TypeParameterExcludes"; + SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 793064] = "TypeAliasExcludes"; + SymbolFlags[SymbolFlags["AliasExcludes"] = 8388608] = "AliasExcludes"; + SymbolFlags[SymbolFlags["ModuleMember"] = 8914931] = "ModuleMember"; + SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal"; + SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports"; + SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers"; + SymbolFlags[SymbolFlags["BlockScoped"] = 418] = "BlockScoped"; + SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor"; + SymbolFlags[SymbolFlags["Export"] = 7340032] = "Export"; + SymbolFlags[SymbolFlags["ClassMember"] = 106500] = "ClassMember"; + SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable"; + })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {})); + var CheckFlags; + (function (CheckFlags) { + CheckFlags[CheckFlags["Instantiated"] = 1] = "Instantiated"; + CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty"; + CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod"; + CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly"; + CheckFlags[CheckFlags["Partial"] = 16] = "Partial"; + CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType"; + CheckFlags[CheckFlags["ContainsPublic"] = 64] = "ContainsPublic"; + CheckFlags[CheckFlags["ContainsProtected"] = 128] = "ContainsProtected"; + CheckFlags[CheckFlags["ContainsPrivate"] = 256] = "ContainsPrivate"; + CheckFlags[CheckFlags["ContainsStatic"] = 512] = "ContainsStatic"; + CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic"; + })(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {})); + var NodeCheckFlags; + (function (NodeCheckFlags) { + NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; + NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; + NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["CaptureNewTarget"] = 8] = "CaptureNewTarget"; + NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; + NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; + NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; + NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; + NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; + NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; + NodeCheckFlags[NodeCheckFlags["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["CapturedBlockScopedBinding"] = 131072] = "CapturedBlockScopedBinding"; + NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 262144] = "BlockScopedBindingInLoop"; + NodeCheckFlags[NodeCheckFlags["ClassWithBodyScopedClassBinding"] = 524288] = "ClassWithBodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["BodyScopedClassBinding"] = 1048576] = "BodyScopedClassBinding"; + NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 2097152] = "NeedsLoopOutParameter"; + NodeCheckFlags[NodeCheckFlags["AssignmentsMarked"] = 4194304] = "AssignmentsMarked"; + NodeCheckFlags[NodeCheckFlags["ClassWithConstructorReference"] = 8388608] = "ClassWithConstructorReference"; + NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 16777216] = "ConstructorReferenceInClass"; + })(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); + var TypeFlags; + (function (TypeFlags) { + TypeFlags[TypeFlags["Any"] = 1] = "Any"; + TypeFlags[TypeFlags["String"] = 2] = "String"; + TypeFlags[TypeFlags["Number"] = 4] = "Number"; + TypeFlags[TypeFlags["Boolean"] = 8] = "Boolean"; + TypeFlags[TypeFlags["Enum"] = 16] = "Enum"; + TypeFlags[TypeFlags["StringLiteral"] = 32] = "StringLiteral"; + TypeFlags[TypeFlags["NumberLiteral"] = 64] = "NumberLiteral"; + TypeFlags[TypeFlags["BooleanLiteral"] = 128] = "BooleanLiteral"; + TypeFlags[TypeFlags["EnumLiteral"] = 256] = "EnumLiteral"; + TypeFlags[TypeFlags["ESSymbol"] = 512] = "ESSymbol"; + TypeFlags[TypeFlags["Void"] = 1024] = "Void"; + TypeFlags[TypeFlags["Undefined"] = 2048] = "Undefined"; + TypeFlags[TypeFlags["Null"] = 4096] = "Null"; + TypeFlags[TypeFlags["Never"] = 8192] = "Never"; + TypeFlags[TypeFlags["TypeParameter"] = 16384] = "TypeParameter"; + TypeFlags[TypeFlags["Object"] = 32768] = "Object"; + TypeFlags[TypeFlags["Union"] = 65536] = "Union"; + TypeFlags[TypeFlags["Intersection"] = 131072] = "Intersection"; + TypeFlags[TypeFlags["Index"] = 262144] = "Index"; + TypeFlags[TypeFlags["IndexedAccess"] = 524288] = "IndexedAccess"; + TypeFlags[TypeFlags["FreshLiteral"] = 1048576] = "FreshLiteral"; + TypeFlags[TypeFlags["ContainsWideningType"] = 2097152] = "ContainsWideningType"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; + TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["NonPrimitive"] = 16777216] = "NonPrimitive"; + TypeFlags[TypeFlags["JsxAttributes"] = 33554432] = "JsxAttributes"; + TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable"; + TypeFlags[TypeFlags["Literal"] = 480] = "Literal"; + TypeFlags[TypeFlags["StringOrNumberLiteral"] = 96] = "StringOrNumberLiteral"; + TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy"; + TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy"; + TypeFlags[TypeFlags["Intrinsic"] = 16793231] = "Intrinsic"; + TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; + TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; + TypeFlags[TypeFlags["NumberLike"] = 340] = "NumberLike"; + TypeFlags[TypeFlags["BooleanLike"] = 136] = "BooleanLike"; + TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; + TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; + TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; + TypeFlags[TypeFlags["StructuredOrTypeVariable"] = 1032192] = "StructuredOrTypeVariable"; + TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; + TypeFlags[TypeFlags["Narrowable"] = 17810431] = "Narrowable"; + TypeFlags[TypeFlags["NotUnionOrUnit"] = 16810497] = "NotUnionOrUnit"; + TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; + TypeFlags[TypeFlags["PropagatingFlags"] = 14680064] = "PropagatingFlags"; + })(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {})); + var ObjectFlags; + (function (ObjectFlags) { + ObjectFlags[ObjectFlags["Class"] = 1] = "Class"; + ObjectFlags[ObjectFlags["Interface"] = 2] = "Interface"; + ObjectFlags[ObjectFlags["Reference"] = 4] = "Reference"; + ObjectFlags[ObjectFlags["Tuple"] = 8] = "Tuple"; + ObjectFlags[ObjectFlags["Anonymous"] = 16] = "Anonymous"; + ObjectFlags[ObjectFlags["Mapped"] = 32] = "Mapped"; + ObjectFlags[ObjectFlags["Instantiated"] = 64] = "Instantiated"; + ObjectFlags[ObjectFlags["ObjectLiteral"] = 128] = "ObjectLiteral"; + ObjectFlags[ObjectFlags["EvolvingArray"] = 256] = "EvolvingArray"; + ObjectFlags[ObjectFlags["ObjectLiteralPatternWithComputedProperties"] = 512] = "ObjectLiteralPatternWithComputedProperties"; + ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface"; + })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {})); + var SignatureKind; + (function (SignatureKind) { + SignatureKind[SignatureKind["Call"] = 0] = "Call"; + SignatureKind[SignatureKind["Construct"] = 1] = "Construct"; + })(SignatureKind = ts.SignatureKind || (ts.SignatureKind = {})); + var IndexKind; + (function (IndexKind) { + IndexKind[IndexKind["String"] = 0] = "String"; + IndexKind[IndexKind["Number"] = 1] = "Number"; + })(IndexKind = ts.IndexKind || (ts.IndexKind = {})); + var SpecialPropertyAssignmentKind; + (function (SpecialPropertyAssignmentKind) { + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ExportsProperty"] = 1] = "ExportsProperty"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ModuleExports"] = 2] = "ModuleExports"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty"; + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["Property"] = 5] = "Property"; + })(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); var DiagnosticCategory; (function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; @@ -66,6 +742,179 @@ var ts; ModuleKind[ModuleKind["System"] = 4] = "System"; ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015"; })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {})); + var JsxEmit; + (function (JsxEmit) { + JsxEmit[JsxEmit["None"] = 0] = "None"; + JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve"; + JsxEmit[JsxEmit["React"] = 2] = "React"; + JsxEmit[JsxEmit["ReactNative"] = 3] = "ReactNative"; + })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); + var NewLineKind; + (function (NewLineKind) { + NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed"; + NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed"; + })(NewLineKind = ts.NewLineKind || (ts.NewLineKind = {})); + var ScriptKind; + (function (ScriptKind) { + ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown"; + ScriptKind[ScriptKind["JS"] = 1] = "JS"; + ScriptKind[ScriptKind["JSX"] = 2] = "JSX"; + ScriptKind[ScriptKind["TS"] = 3] = "TS"; + ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; + ScriptKind[ScriptKind["External"] = 5] = "External"; + })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {})); + var ScriptTarget; + (function (ScriptTarget) { + ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; + ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; + ScriptTarget[ScriptTarget["ES2015"] = 2] = "ES2015"; + ScriptTarget[ScriptTarget["ES2016"] = 3] = "ES2016"; + ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017"; + ScriptTarget[ScriptTarget["ESNext"] = 5] = "ESNext"; + ScriptTarget[ScriptTarget["Latest"] = 5] = "Latest"; + })(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {})); + var LanguageVariant; + (function (LanguageVariant) { + LanguageVariant[LanguageVariant["Standard"] = 0] = "Standard"; + LanguageVariant[LanguageVariant["JSX"] = 1] = "JSX"; + })(LanguageVariant = ts.LanguageVariant || (ts.LanguageVariant = {})); + var DiagnosticStyle; + (function (DiagnosticStyle) { + DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple"; + DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty"; + })(DiagnosticStyle = ts.DiagnosticStyle || (ts.DiagnosticStyle = {})); + var WatchDirectoryFlags; + (function (WatchDirectoryFlags) { + WatchDirectoryFlags[WatchDirectoryFlags["None"] = 0] = "None"; + WatchDirectoryFlags[WatchDirectoryFlags["Recursive"] = 1] = "Recursive"; + })(WatchDirectoryFlags = ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {})); + var CharacterCodes; + (function (CharacterCodes) { + CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; + CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; + CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; + CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; + CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator"; + CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator"; + CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine"; + CharacterCodes[CharacterCodes["space"] = 32] = "space"; + CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace"; + CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad"; + CharacterCodes[CharacterCodes["emQuad"] = 8193] = "emQuad"; + CharacterCodes[CharacterCodes["enSpace"] = 8194] = "enSpace"; + CharacterCodes[CharacterCodes["emSpace"] = 8195] = "emSpace"; + CharacterCodes[CharacterCodes["threePerEmSpace"] = 8196] = "threePerEmSpace"; + CharacterCodes[CharacterCodes["fourPerEmSpace"] = 8197] = "fourPerEmSpace"; + CharacterCodes[CharacterCodes["sixPerEmSpace"] = 8198] = "sixPerEmSpace"; + CharacterCodes[CharacterCodes["figureSpace"] = 8199] = "figureSpace"; + CharacterCodes[CharacterCodes["punctuationSpace"] = 8200] = "punctuationSpace"; + CharacterCodes[CharacterCodes["thinSpace"] = 8201] = "thinSpace"; + CharacterCodes[CharacterCodes["hairSpace"] = 8202] = "hairSpace"; + CharacterCodes[CharacterCodes["zeroWidthSpace"] = 8203] = "zeroWidthSpace"; + CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace"; + CharacterCodes[CharacterCodes["ideographicSpace"] = 12288] = "ideographicSpace"; + CharacterCodes[CharacterCodes["mathematicalSpace"] = 8287] = "mathematicalSpace"; + CharacterCodes[CharacterCodes["ogham"] = 5760] = "ogham"; + CharacterCodes[CharacterCodes["_"] = 95] = "_"; + CharacterCodes[CharacterCodes["$"] = 36] = "$"; + CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; + CharacterCodes[CharacterCodes["_1"] = 49] = "_1"; + CharacterCodes[CharacterCodes["_2"] = 50] = "_2"; + CharacterCodes[CharacterCodes["_3"] = 51] = "_3"; + CharacterCodes[CharacterCodes["_4"] = 52] = "_4"; + CharacterCodes[CharacterCodes["_5"] = 53] = "_5"; + CharacterCodes[CharacterCodes["_6"] = 54] = "_6"; + CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; + CharacterCodes[CharacterCodes["_8"] = 56] = "_8"; + CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; + CharacterCodes[CharacterCodes["a"] = 97] = "a"; + CharacterCodes[CharacterCodes["b"] = 98] = "b"; + CharacterCodes[CharacterCodes["c"] = 99] = "c"; + CharacterCodes[CharacterCodes["d"] = 100] = "d"; + CharacterCodes[CharacterCodes["e"] = 101] = "e"; + CharacterCodes[CharacterCodes["f"] = 102] = "f"; + CharacterCodes[CharacterCodes["g"] = 103] = "g"; + CharacterCodes[CharacterCodes["h"] = 104] = "h"; + CharacterCodes[CharacterCodes["i"] = 105] = "i"; + CharacterCodes[CharacterCodes["j"] = 106] = "j"; + CharacterCodes[CharacterCodes["k"] = 107] = "k"; + CharacterCodes[CharacterCodes["l"] = 108] = "l"; + CharacterCodes[CharacterCodes["m"] = 109] = "m"; + CharacterCodes[CharacterCodes["n"] = 110] = "n"; + CharacterCodes[CharacterCodes["o"] = 111] = "o"; + CharacterCodes[CharacterCodes["p"] = 112] = "p"; + CharacterCodes[CharacterCodes["q"] = 113] = "q"; + CharacterCodes[CharacterCodes["r"] = 114] = "r"; + CharacterCodes[CharacterCodes["s"] = 115] = "s"; + CharacterCodes[CharacterCodes["t"] = 116] = "t"; + CharacterCodes[CharacterCodes["u"] = 117] = "u"; + CharacterCodes[CharacterCodes["v"] = 118] = "v"; + CharacterCodes[CharacterCodes["w"] = 119] = "w"; + CharacterCodes[CharacterCodes["x"] = 120] = "x"; + CharacterCodes[CharacterCodes["y"] = 121] = "y"; + CharacterCodes[CharacterCodes["z"] = 122] = "z"; + CharacterCodes[CharacterCodes["A"] = 65] = "A"; + CharacterCodes[CharacterCodes["B"] = 66] = "B"; + CharacterCodes[CharacterCodes["C"] = 67] = "C"; + CharacterCodes[CharacterCodes["D"] = 68] = "D"; + CharacterCodes[CharacterCodes["E"] = 69] = "E"; + CharacterCodes[CharacterCodes["F"] = 70] = "F"; + CharacterCodes[CharacterCodes["G"] = 71] = "G"; + CharacterCodes[CharacterCodes["H"] = 72] = "H"; + CharacterCodes[CharacterCodes["I"] = 73] = "I"; + CharacterCodes[CharacterCodes["J"] = 74] = "J"; + CharacterCodes[CharacterCodes["K"] = 75] = "K"; + CharacterCodes[CharacterCodes["L"] = 76] = "L"; + CharacterCodes[CharacterCodes["M"] = 77] = "M"; + CharacterCodes[CharacterCodes["N"] = 78] = "N"; + CharacterCodes[CharacterCodes["O"] = 79] = "O"; + CharacterCodes[CharacterCodes["P"] = 80] = "P"; + CharacterCodes[CharacterCodes["Q"] = 81] = "Q"; + CharacterCodes[CharacterCodes["R"] = 82] = "R"; + CharacterCodes[CharacterCodes["S"] = 83] = "S"; + CharacterCodes[CharacterCodes["T"] = 84] = "T"; + CharacterCodes[CharacterCodes["U"] = 85] = "U"; + CharacterCodes[CharacterCodes["V"] = 86] = "V"; + CharacterCodes[CharacterCodes["W"] = 87] = "W"; + CharacterCodes[CharacterCodes["X"] = 88] = "X"; + CharacterCodes[CharacterCodes["Y"] = 89] = "Y"; + CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; + CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; + CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; + CharacterCodes[CharacterCodes["at"] = 64] = "at"; + CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick"; + CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; + CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; + CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; + CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; + CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; + CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; + CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; + CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; + CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; + CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; + CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; + CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; + CharacterCodes[CharacterCodes["hash"] = 35] = "hash"; + CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; + CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; + CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; + CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; + CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; + CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; + CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; + CharacterCodes[CharacterCodes["question"] = 63] = "question"; + CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; + CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; + CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; + CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; + CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; + CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; + CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark"; + CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; + CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; + })(CharacterCodes = ts.CharacterCodes || (ts.CharacterCodes = {})); var Extension; (function (Extension) { Extension[Extension["Ts"] = 0] = "Ts"; @@ -75,6 +924,121 @@ var ts; Extension[Extension["Jsx"] = 4] = "Jsx"; Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension"; })(Extension = ts.Extension || (ts.Extension = {})); + var TransformFlags; + (function (TransformFlags) { + TransformFlags[TransformFlags["None"] = 0] = "None"; + TransformFlags[TransformFlags["TypeScript"] = 1] = "TypeScript"; + TransformFlags[TransformFlags["ContainsTypeScript"] = 2] = "ContainsTypeScript"; + TransformFlags[TransformFlags["ContainsJsx"] = 4] = "ContainsJsx"; + TransformFlags[TransformFlags["ContainsESNext"] = 8] = "ContainsESNext"; + TransformFlags[TransformFlags["ContainsES2017"] = 16] = "ContainsES2017"; + TransformFlags[TransformFlags["ContainsES2016"] = 32] = "ContainsES2016"; + TransformFlags[TransformFlags["ES2015"] = 64] = "ES2015"; + TransformFlags[TransformFlags["ContainsES2015"] = 128] = "ContainsES2015"; + TransformFlags[TransformFlags["Generator"] = 256] = "Generator"; + TransformFlags[TransformFlags["ContainsGenerator"] = 512] = "ContainsGenerator"; + TransformFlags[TransformFlags["DestructuringAssignment"] = 1024] = "DestructuringAssignment"; + TransformFlags[TransformFlags["ContainsDestructuringAssignment"] = 2048] = "ContainsDestructuringAssignment"; + TransformFlags[TransformFlags["ContainsDecorators"] = 4096] = "ContainsDecorators"; + TransformFlags[TransformFlags["ContainsPropertyInitializer"] = 8192] = "ContainsPropertyInitializer"; + TransformFlags[TransformFlags["ContainsLexicalThis"] = 16384] = "ContainsLexicalThis"; + TransformFlags[TransformFlags["ContainsCapturedLexicalThis"] = 32768] = "ContainsCapturedLexicalThis"; + TransformFlags[TransformFlags["ContainsLexicalThisInComputedPropertyName"] = 65536] = "ContainsLexicalThisInComputedPropertyName"; + TransformFlags[TransformFlags["ContainsDefaultValueAssignments"] = 131072] = "ContainsDefaultValueAssignments"; + TransformFlags[TransformFlags["ContainsParameterPropertyAssignments"] = 262144] = "ContainsParameterPropertyAssignments"; + TransformFlags[TransformFlags["ContainsSpread"] = 524288] = "ContainsSpread"; + TransformFlags[TransformFlags["ContainsObjectSpread"] = 1048576] = "ContainsObjectSpread"; + TransformFlags[TransformFlags["ContainsRest"] = 524288] = "ContainsRest"; + TransformFlags[TransformFlags["ContainsObjectRest"] = 1048576] = "ContainsObjectRest"; + TransformFlags[TransformFlags["ContainsComputedPropertyName"] = 2097152] = "ContainsComputedPropertyName"; + TransformFlags[TransformFlags["ContainsBlockScopedBinding"] = 4194304] = "ContainsBlockScopedBinding"; + TransformFlags[TransformFlags["ContainsBindingPattern"] = 8388608] = "ContainsBindingPattern"; + TransformFlags[TransformFlags["ContainsYield"] = 16777216] = "ContainsYield"; + TransformFlags[TransformFlags["ContainsHoistedDeclarationOrCompletion"] = 33554432] = "ContainsHoistedDeclarationOrCompletion"; + TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags"; + TransformFlags[TransformFlags["AssertTypeScript"] = 3] = "AssertTypeScript"; + TransformFlags[TransformFlags["AssertJsx"] = 4] = "AssertJsx"; + TransformFlags[TransformFlags["AssertESNext"] = 8] = "AssertESNext"; + TransformFlags[TransformFlags["AssertES2017"] = 16] = "AssertES2017"; + TransformFlags[TransformFlags["AssertES2016"] = 32] = "AssertES2016"; + TransformFlags[TransformFlags["AssertES2015"] = 192] = "AssertES2015"; + TransformFlags[TransformFlags["AssertGenerator"] = 768] = "AssertGenerator"; + TransformFlags[TransformFlags["AssertDestructuringAssignment"] = 3072] = "AssertDestructuringAssignment"; + TransformFlags[TransformFlags["NodeExcludes"] = 536872257] = "NodeExcludes"; + TransformFlags[TransformFlags["ArrowFunctionExcludes"] = 601249089] = "ArrowFunctionExcludes"; + TransformFlags[TransformFlags["FunctionExcludes"] = 601281857] = "FunctionExcludes"; + TransformFlags[TransformFlags["ConstructorExcludes"] = 601015617] = "ConstructorExcludes"; + TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = 601015617] = "MethodOrAccessorExcludes"; + TransformFlags[TransformFlags["ClassExcludes"] = 539358529] = "ClassExcludes"; + TransformFlags[TransformFlags["ModuleExcludes"] = 574674241] = "ModuleExcludes"; + TransformFlags[TransformFlags["TypeExcludes"] = -3] = "TypeExcludes"; + TransformFlags[TransformFlags["ObjectLiteralExcludes"] = 540087617] = "ObjectLiteralExcludes"; + TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = 537396545] = "ArrayLiteralOrCallOrNewExcludes"; + TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = 546309441] = "VariableDeclarationListExcludes"; + TransformFlags[TransformFlags["ParameterExcludes"] = 536872257] = "ParameterExcludes"; + TransformFlags[TransformFlags["CatchClauseExcludes"] = 537920833] = "CatchClauseExcludes"; + TransformFlags[TransformFlags["BindingPatternExcludes"] = 537396545] = "BindingPatternExcludes"; + TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask"; + TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask"; + })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); + var EmitFlags; + (function (EmitFlags) { + EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine"; + EmitFlags[EmitFlags["AdviseOnEmitNode"] = 2] = "AdviseOnEmitNode"; + EmitFlags[EmitFlags["NoSubstitution"] = 4] = "NoSubstitution"; + EmitFlags[EmitFlags["CapturesThis"] = 8] = "CapturesThis"; + EmitFlags[EmitFlags["NoLeadingSourceMap"] = 16] = "NoLeadingSourceMap"; + EmitFlags[EmitFlags["NoTrailingSourceMap"] = 32] = "NoTrailingSourceMap"; + EmitFlags[EmitFlags["NoSourceMap"] = 48] = "NoSourceMap"; + EmitFlags[EmitFlags["NoNestedSourceMaps"] = 64] = "NoNestedSourceMaps"; + EmitFlags[EmitFlags["NoTokenLeadingSourceMaps"] = 128] = "NoTokenLeadingSourceMaps"; + EmitFlags[EmitFlags["NoTokenTrailingSourceMaps"] = 256] = "NoTokenTrailingSourceMaps"; + EmitFlags[EmitFlags["NoTokenSourceMaps"] = 384] = "NoTokenSourceMaps"; + EmitFlags[EmitFlags["NoLeadingComments"] = 512] = "NoLeadingComments"; + EmitFlags[EmitFlags["NoTrailingComments"] = 1024] = "NoTrailingComments"; + EmitFlags[EmitFlags["NoComments"] = 1536] = "NoComments"; + EmitFlags[EmitFlags["NoNestedComments"] = 2048] = "NoNestedComments"; + EmitFlags[EmitFlags["HelperName"] = 4096] = "HelperName"; + EmitFlags[EmitFlags["ExportName"] = 8192] = "ExportName"; + EmitFlags[EmitFlags["LocalName"] = 16384] = "LocalName"; + EmitFlags[EmitFlags["Indented"] = 32768] = "Indented"; + EmitFlags[EmitFlags["NoIndentation"] = 65536] = "NoIndentation"; + EmitFlags[EmitFlags["AsyncFunctionBody"] = 131072] = "AsyncFunctionBody"; + EmitFlags[EmitFlags["ReuseTempVariableScope"] = 262144] = "ReuseTempVariableScope"; + EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue"; + EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting"; + EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker"; + EmitFlags[EmitFlags["Iterator"] = 4194304] = "Iterator"; + })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); + var ExternalEmitHelpers; + (function (ExternalEmitHelpers) { + ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends"; + ExternalEmitHelpers[ExternalEmitHelpers["Assign"] = 2] = "Assign"; + ExternalEmitHelpers[ExternalEmitHelpers["Rest"] = 4] = "Rest"; + ExternalEmitHelpers[ExternalEmitHelpers["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers[ExternalEmitHelpers["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers[ExternalEmitHelpers["Param"] = 32] = "Param"; + ExternalEmitHelpers[ExternalEmitHelpers["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers[ExternalEmitHelpers["Generator"] = 128] = "Generator"; + ExternalEmitHelpers[ExternalEmitHelpers["Values"] = 256] = "Values"; + ExternalEmitHelpers[ExternalEmitHelpers["Read"] = 512] = "Read"; + ExternalEmitHelpers[ExternalEmitHelpers["Spread"] = 1024] = "Spread"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncGenerator"] = 2048] = "AsyncGenerator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncDelegator"] = 4096] = "AsyncDelegator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncValues"] = 8192] = "AsyncValues"; + ExternalEmitHelpers[ExternalEmitHelpers["ForOfIncludes"] = 256] = "ForOfIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["ForAwaitOfIncludes"] = 8192] = "ForAwaitOfIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["SpreadIncludes"] = 1536] = "SpreadIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 8192] = "LastEmitHelper"; + })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); + var EmitHint; + (function (EmitHint) { + EmitHint[EmitHint["SourceFile"] = 0] = "SourceFile"; + EmitHint[EmitHint["Expression"] = 1] = "Expression"; + EmitHint[EmitHint["IdentifierName"] = 2] = "IdentifierName"; + EmitHint[EmitHint["Unspecified"] = 3] = "Unspecified"; + })(EmitHint = ts.EmitHint || (ts.EmitHint = {})); })(ts || (ts = {})); var ts; (function (ts) { @@ -93,32 +1057,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -137,22 +1101,102 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.2.0-dev.20161127"; + ts.version = "2.3.0-dev.20170419"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + var Ternary; + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(Ternary = ts.Ternary || (ts.Ternary = {})); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -165,32 +1209,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -204,9 +1243,19 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + var Comparison; + (function (Comparison) { + Comparison[Comparison["LessThan"] = -1] = "LessThan"; + Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; + Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; + })(Comparison = ts.Comparison || (ts.Comparison = {})); + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -216,6 +1265,20 @@ var ts; return undefined; } ts.forEach = forEach; + function findAncestor(node, callback) { + while (node) { + var result = callback(node); + if (result === "quit") { + return undefined; + } + else if (result) { + return node; + } + node = node.parent; + } + return undefined; + } + ts.findAncestor = findAncestor; function zipWith(arrayA, arrayB, callback) { Debug.assert(arrayA.length === arrayB.length); for (var i = 0; i < arrayA.length; i++) { @@ -225,7 +1288,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -235,7 +1298,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -244,8 +1307,17 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -268,7 +1340,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -278,7 +1350,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -465,21 +1537,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -763,38 +1832,55 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator, map) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(map ? map(value) : value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function convertToArray(iterator, f) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(f(value)); } - return false; + return result; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.convertToArray = convertToArray; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } + } + return undefined; + var _b; } - ts.appendProperty = appendProperty; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); + } + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -802,31 +1888,14 @@ var ts; } for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { var arg = args_1[_a]; - for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) { - var p = _c[_b]; - t[p] = arg[p]; - } + for (var p in arg) + if (hasProperty(arg, p)) { + t[p] = arg[p]; + } } return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -851,23 +1920,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -894,27 +1954,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -990,6 +2055,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -1091,8 +2157,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1474,36 +2542,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1573,6 +2631,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1585,34 +2644,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } + } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1628,14 +2701,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -1673,8 +2746,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = allSupportedExtensions.slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (extensions.indexOf(extInfo.extension) === -1) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1685,11 +2769,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1698,33 +2782,40 @@ var ts; return false; } ts.isSupportedSourceFileName = isSupportedSourceFileName; + var ExtensionPriority; + (function (ExtensionPriority) { + ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles"; + ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles"; + ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest"; + ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest"; + })(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {})); function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--) { if (fileExtensionIs(path, supportedExtensions[i])) { - return adjustExtensionPriority(i); + return adjustExtensionPriority(i, supportedExtensions); } } return 0; } ts.getExtensionPriority = getExtensionPriority; - function adjustExtensionPriority(extensionPriority) { + function adjustExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 0; } - else if (extensionPriority < 5) { + else if (extensionPriority < supportedExtensions.length) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.adjustExtensionPriority = adjustExtensionPriority; - function getNextLowestExtensionPriority(extensionPriority) { + function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority; @@ -1782,6 +2873,13 @@ var ts; getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } }; + var AssertionLevel; + (function (AssertionLevel) { + AssertionLevel[AssertionLevel["None"] = 0] = "None"; + AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; + AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; + AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; + })(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {})); var Debug; (function (Debug) { Debug.currentAssertionLevel = 0; @@ -1933,136 +3031,29 @@ var ts; } } ts.tryGetExtensionFromPath = tryGetExtensionFromPath; + function isCheckJsEnabledForFile(sourceFile, compilerOptions) { + return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; + } + ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile; })(ts || (ts = {})); var ts; (function (ts) { - ts.sys = (function () { - function getWScriptSystem() { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - var shell = new ActiveXObject("WScript.Shell"); - var fileStream = new ActiveXObject("ADODB.Stream"); - fileStream.Type = 2; - var binaryStream = new ActiveXObject("ADODB.Stream"); - binaryStream.Type = 1; - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); - } - function readFile(fileName, encoding) { - if (!fso.FileExists(fileName)) { - return undefined; - } - fileStream.Open(); - try { - if (encoding) { - fileStream.Charset = encoding; - fileStream.LoadFromFile(fileName); - } - else { - fileStream.Charset = "x-ansi"; - fileStream.LoadFromFile(fileName); - var bom = fileStream.ReadText(2) || ""; - fileStream.Position = 0; - fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; - } - return fileStream.ReadText(); - } - catch (e) { - throw e; - } - finally { - fileStream.Close(); - } - } - function writeFile(fileName, data, writeByteOrderMark) { - fileStream.Open(); - binaryStream.Open(); - try { - fileStream.Charset = "utf-8"; - fileStream.WriteText(data); - if (writeByteOrderMark) { - fileStream.Position = 0; - } - else { - fileStream.Position = 3; - } - fileStream.CopyTo(binaryStream); - binaryStream.SaveToFile(fileName, 2); - } - finally { - binaryStream.Close(); - fileStream.Close(); - } - } - function getNames(collection) { - var result = []; - for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { - result.push(e.item().Name); - } - return result.sort(); - } - function getDirectories(path) { - var folder = fso.GetFolder(path); - return getNames(folder.subfolders); - } - function getAccessibleFileSystemEntries(path) { - try { - var folder = fso.GetFolder(path || "."); - var files = getNames(folder.files); - var directories = getNames(folder.subfolders); - return { files: files, directories: directories }; - } - catch (e) { - return { files: [], directories: [] }; - } - } - function readDirectory(path, extensions, excludes, includes) { - return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries); - } - var wscriptSystem = { - args: args, - newLine: "\r\n", - useCaseSensitiveFileNames: false, - write: function (s) { - WScript.StdOut.Write(s); - }, - readFile: readFile, - writeFile: writeFile, - resolvePath: function (path) { - return fso.GetAbsolutePathName(path); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - createDirectory: function (directoryName) { - if (!wscriptSystem.directoryExists(directoryName)) { - fso.CreateFolder(directoryName); - } - }, - getExecutingFilePath: function () { - return WScript.ScriptFullName; - }, - getCurrentDirectory: function () { - return shell.CurrentDirectory; - }, - getDirectories: getDirectories, - getEnvironmentVariable: function (name) { - return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%" + name + "%"); - }, - readDirectory: readDirectory, - exit: function (exitCode) { - try { - WScript.Quit(exitCode); - } - catch (e) { - } - } - }; - return wscriptSystem; + function getNodeMajorVersion() { + if (typeof process === "undefined") { + return undefined; + } + var version = process.version; + if (!version) { + return undefined; + } + var dot = version.indexOf("."); + if (dot === -1) { + return undefined; } + return parseInt(version.substring(1, dot)); + } + ts.getNodeMajorVersion = getNodeMajorVersion; + ts.sys = (function () { function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); @@ -2071,32 +3062,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2108,24 +3099,26 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } } var watchedFileSet = createWatchedFileSet(); - function isNode4OrLater() { - return parseInt(process.version.charAt(1)) >= 4; - } + var nodeVersion = getNodeMajorVersion(); + var isNode4OrLater = nodeVersion >= 4; function isFileSystemCaseSensitive() { if (platform === "win32" || platform === "win64") { return false; @@ -2182,10 +3175,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2206,6 +3199,11 @@ var ts; function readDirectory(path, extensions, excludes, includes) { return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries); } + var FileSystemEntryKind; + (function (FileSystemEntryKind) { + FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; + FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; + })(FileSystemEntryKind || (FileSystemEntryKind = {})); function fileSystemEntryExists(path, entryKind) { try { var stat = _fs.statSync(path); @@ -2262,7 +3260,7 @@ var ts; if (!directoryExists(directoryName)) { return noOpFileWatcher; } - if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } else { @@ -2272,7 +3270,6 @@ var ts; if (eventName === "rename") { callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } - ; }); }, resolvePath: function (path) { @@ -2389,9 +3386,6 @@ var ts; if (typeof ChakraHost !== "undefined") { sys = getChakraSystem(); } - else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - sys = getWScriptSystem(); - } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { sys = getNodeSystem(); } @@ -2460,11 +3454,11 @@ var ts; Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, - Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: "Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059", message: "Return expression in async function does not have a valid callable 'then' member." }, - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: "Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060", message: "Expression body for async arrow function does not have a valid callable 'then' member." }, + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", message: "The return type of an async function must either be a valid promise or must not contain a callable 'then' member." }, + A_promise_must_have_a_then_method: { code: 1059, category: ts.DiagnosticCategory.Error, key: "A_promise_must_have_a_then_method_1059", message: "A promise must have a 'then' method." }, + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: { code: 1060, category: ts.DiagnosticCategory.Error, key: "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", message: "The first parameter of the 'then' method of a promise must be a callback." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, @@ -2473,7 +3467,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2489,6 +3483,7 @@ var ts; Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, + A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: { code: 1103, category: ts.DiagnosticCategory.Error, key: "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", message: "A 'for-await-of' statement is only allowed within an async function or async generator." }, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, @@ -2496,7 +3491,7 @@ var ts; Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, + Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'." }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, @@ -2528,9 +3523,9 @@ var ts; Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", message: "Cannot use imports, exports, or module augmentations when '--module' is 'none'." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing." }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, + const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized." }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, @@ -2579,11 +3574,12 @@ var ts; Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode" }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." }, @@ -2629,6 +3625,11 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1320, category: ts.DiagnosticCategory.Error, key: "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", message: "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1321, category: ts.DiagnosticCategory.Error, key: "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", message: "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1322, category: ts.DiagnosticCategory.Error, key: "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", message: "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2672,6 +3673,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2682,19 +3684,20 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter." }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, + Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'." }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, @@ -2734,12 +3737,12 @@ var ts; The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class." }, The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, + Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'." }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, @@ -2748,19 +3751,19 @@ var ts; Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, + Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'." }, All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, + Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'." }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged." }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged." }, Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'" }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name." }, + Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'." }, Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'" }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, @@ -2769,18 +3772,20 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, + Class_0_used_before_its_declaration: { code: 2449, category: ts.DiagnosticCategory.Error, key: "Class_0_used_before_its_declaration_2449", message: "Class '{0}' used before its declaration." }, + Enum_0_used_before_its_declaration: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Enum_0_used_before_its_declaration_2450", message: "Enum '{0}' used before its declaration." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, + Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'." }, An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" }, + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern." }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, @@ -2801,13 +3806,13 @@ var ts; let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'." }, The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause" }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause." }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, @@ -2819,6 +3824,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, + Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: { code: 2504, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", message: "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator." }, A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, @@ -2833,6 +3839,7 @@ var ts; All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, + An_async_iterator_must_have_a_next_method: { code: 2519, category: ts.DiagnosticCategory.Error, key: "An_async_iterator_must_have_a_next_method_2519", message: "An async iterator must have a 'next()' method." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, @@ -2856,23 +3863,33 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, + Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." }, + The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: { code: 2547, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", message: "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property." }, + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2548, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", message: "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2549, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", message: "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: { code: 2550, category: ts.DiagnosticCategory.Error, key: "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", message: "Generic type instantiation is excessively deep and possibly infinite." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, + Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'." }, JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, - Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property." }, + The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property." }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, + Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React." }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, - Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element." }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'." }, super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, @@ -2904,7 +3921,6 @@ var ts; All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, - A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." }, An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, @@ -2913,9 +3929,17 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference." }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property." }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, + Required_type_parameters_may_not_follow_optional_type_parameters: { code: 2706, category: ts.DiagnosticCategory.Error, key: "Required_type_parameters_may_not_follow_optional_type_parameters_2706", message: "Required type parameters may not follow optional type parameters." }, + Generic_type_0_requires_between_1_and_2_type_arguments: { code: 2707, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_between_1_and_2_type_arguments_2707", message: "Generic type '{0}' requires between {1} and {2} type arguments." }, + Cannot_use_namespace_0_as_a_value: { code: 2708, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_value_2708", message: "Cannot use namespace '{0}' as a value." }, + Cannot_use_namespace_0_as_a_type: { code: 2709, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_type_2709", message: "Cannot use namespace '{0}' as a type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2926,8 +3950,8 @@ var ts; Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "'extends' clause of exported class '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "'extends' clause of exported interface '{0}' has or is using private name '{1}'." }, Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, @@ -2988,16 +4012,18 @@ var ts; Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced: { code: 4093, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced_4093", message: "'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", message: "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported_file_encoding_5013", message: "Unsupported file encoding." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}." }, Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}" }, + Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", message: "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, @@ -3006,12 +4032,12 @@ var ts; A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, - The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'." }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'." }, Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, - Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character." }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character." }, Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_should_be_an_array_5063", message: "Substitutions for pattern '{0}' should be an array." }, Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, @@ -3029,11 +4055,11 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'." }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3048,11 +4074,12 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -3074,17 +4101,18 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context (experimental)." }, Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'." }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", message: "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit" }, Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, @@ -3095,23 +4123,23 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, + package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, - Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, - Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, - Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, - Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'." }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'." }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'." }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'." }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'." }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed." }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, @@ -3121,32 +4149,67 @@ var ts; Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, - Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'." }, Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, - Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'." }, Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, - Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'." }, Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." }, - File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" }, + File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it." }, _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." }, Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" }, - No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" }, + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files." }, Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" }, + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file." }, Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, + Show_diagnostic_information: { code: 6149, category: ts.DiagnosticCategory.Message, key: "Show_diagnostic_information_6149", message: "Show diagnostic information." }, + Show_verbose_diagnostic_information: { code: 6150, category: ts.DiagnosticCategory.Message, key: "Show_verbose_diagnostic_information_6150", message: "Show verbose diagnostic information." }, + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: { code: 6151, category: ts.DiagnosticCategory.Message, key: "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", message: "Emit a single file with source maps instead of having a separate file." }, + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: { code: 6152, category: ts.DiagnosticCategory.Message, key: "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", message: "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set." }, + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: { code: 6153, category: ts.DiagnosticCategory.Message, key: "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", message: "Transpile each file as a separate module (similar to 'ts.transpileModule')." }, + Print_names_of_generated_files_part_of_the_compilation: { code: 6154, category: ts.DiagnosticCategory.Message, key: "Print_names_of_generated_files_part_of_the_compilation_6154", message: "Print names of generated files part of the compilation." }, + Print_names_of_files_part_of_the_compilation: { code: 6155, category: ts.DiagnosticCategory.Message, key: "Print_names_of_files_part_of_the_compilation_6155", message: "Print names of files part of the compilation." }, + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: { code: 6156, category: ts.DiagnosticCategory.Message, key: "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", message: "The locale used when displaying messages to the user (e.g. 'en-us')" }, + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: { code: 6157, category: ts.DiagnosticCategory.Message, key: "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", message: "Do not generate custom helper functions like '__extends' in compiled output." }, + Do_not_include_the_default_library_file_lib_d_ts: { code: 6158, category: ts.DiagnosticCategory.Message, key: "Do_not_include_the_default_library_file_lib_d_ts_6158", message: "Do not include the default library file (lib.d.ts)." }, + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: { code: 6159, category: ts.DiagnosticCategory.Message, key: "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", message: "Do not add triple-slash references or imported modules to the list of compiled files." }, + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: { code: 6160, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", message: "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files." }, + List_of_folders_to_include_type_definitions_from: { code: 6161, category: ts.DiagnosticCategory.Message, key: "List_of_folders_to_include_type_definitions_from_6161", message: "List of folders to include type definitions from." }, + Disable_size_limitations_on_JavaScript_projects: { code: 6162, category: ts.DiagnosticCategory.Message, key: "Disable_size_limitations_on_JavaScript_projects_6162", message: "Disable size limitations on JavaScript projects." }, + The_character_set_of_the_input_files: { code: 6163, category: ts.DiagnosticCategory.Message, key: "The_character_set_of_the_input_files_6163", message: "The character set of the input files." }, + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: { code: 6164, category: ts.DiagnosticCategory.Message, key: "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", message: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files." }, + Do_not_truncate_error_messages: { code: 6165, category: ts.DiagnosticCategory.Message, key: "Do_not_truncate_error_messages_6165", message: "Do not truncate error messages." }, + Output_directory_for_generated_declaration_files: { code: 6166, category: ts.DiagnosticCategory.Message, key: "Output_directory_for_generated_declaration_files_6166", message: "Output directory for generated declaration files." }, + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: { code: 6167, category: ts.DiagnosticCategory.Message, key: "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", message: "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'." }, + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: { code: 6168, category: ts.DiagnosticCategory.Message, key: "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", message: "List of root folders whose combined content represents the structure of the project at runtime." }, + Show_all_compiler_options: { code: 6169, category: ts.DiagnosticCategory.Message, key: "Show_all_compiler_options_6169", message: "Show all compiler options." }, + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: { code: 6170, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", message: "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file" }, + Command_line_Options: { code: 6171, category: ts.DiagnosticCategory.Message, key: "Command_line_Options_6171", message: "Command-line Options" }, + Basic_Options: { code: 6172, category: ts.DiagnosticCategory.Message, key: "Basic_Options_6172", message: "Basic Options" }, + Strict_Type_Checking_Options: { code: 6173, category: ts.DiagnosticCategory.Message, key: "Strict_Type_Checking_Options_6173", message: "Strict Type-Checking Options" }, + Module_Resolution_Options: { code: 6174, category: ts.DiagnosticCategory.Message, key: "Module_Resolution_Options_6174", message: "Module Resolution Options" }, + Source_Map_Options: { code: 6175, category: ts.DiagnosticCategory.Message, key: "Source_Map_Options_6175", message: "Source Map Options" }, + Additional_Checks: { code: 6176, category: ts.DiagnosticCategory.Message, key: "Additional_Checks_6176", message: "Additional Checks" }, + Experimental_Options: { code: 6177, category: ts.DiagnosticCategory.Message, key: "Experimental_Options_6177", message: "Experimental Options" }, + Advanced_Options: { code: 6178, category: ts.DiagnosticCategory.Message, key: "Advanced_Options_6178", message: "Advanced Options" }, + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: { code: 6179, category: ts.DiagnosticCategory.Message, key: "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", message: "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'." }, + Enable_all_strict_type_checking_options: { code: 6180, category: ts.DiagnosticCategory.Message, key: "Enable_all_strict_type_checking_options_6180", message: "Enable all strict type-checking options." }, + List_of_language_service_plugins: { code: 6181, category: ts.DiagnosticCategory.Message, key: "List_of_language_service_plugins_6181", message: "List of language service plugins." }, + Scoped_package_detected_looking_in_0: { code: 6182, category: ts.DiagnosticCategory.Message, key: "Scoped_package_detected_looking_in_0_6182", message: "Scoped package detected, looking in '{0}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3164,7 +4227,7 @@ var ts; _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists." }, Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, @@ -3188,7 +4251,7 @@ var ts; parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -3196,28 +4259,40 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'." }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: '{0}'." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig." }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, - Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, - Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, - Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}." }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}." }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." }, + Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." }, + Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'." }, + Disable_checking_for_this_file: { code: 90018, category: ts.DiagnosticCategory.Message, key: "Disable_checking_for_this_file_90018", message: "Disable checking for this file." }, + Ignore_this_error_message: { code: 90019, category: ts.DiagnosticCategory.Message, key: "Ignore_this_error_message_90019", message: "Ignore this error message." }, + Initialize_property_0_in_the_constructor: { code: 90020, category: ts.DiagnosticCategory.Message, key: "Initialize_property_0_in_the_constructor_90020", message: "Initialize property '{0}' in the constructor." }, + Initialize_static_property_0: { code: 90021, category: ts.DiagnosticCategory.Message, key: "Initialize_static_property_0_90021", message: "Initialize static property '{0}'." }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, + Report_errors_in_js_files: { code: 8019, category: ts.DiagnosticCategory.Message, key: "Report_errors_in_js_files_8019", message: "Report errors in .js files." }, }; })(ts || (ts = {})); var ts; @@ -3226,7 +4301,7 @@ var ts; return token >= 70; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116, "any": 118, "as": 117, @@ -3250,7 +4325,7 @@ var ts; "false": 85, "finally": 86, "for": 87, - "from": 138, + "from": 139, "function": 88, "get": 124, "if": 89, @@ -3268,27 +4343,28 @@ var ts; "new": 93, "null": 94, "number": 132, + "object": 133, "package": 110, "private": 111, "protected": 112, "public": 113, "readonly": 130, "require": 131, - "global": 139, + "global": 140, "return": 95, - "set": 133, + "set": 134, "static": 114, - "string": 134, + "string": 135, "super": 96, "switch": 97, - "symbol": 135, + "symbol": 136, "this": 98, "throw": 99, "true": 100, "try": 101, - "type": 136, + "type": 137, "typeof": 102, - "undefined": 137, + "undefined": 138, "var": 103, "void": 104, "while": 105, @@ -3296,7 +4372,7 @@ var ts; "yield": 115, "async": 119, "await": 120, - "of": 140, + "of": 141, "{": 16, "}": 17, "(": 18, @@ -3391,9 +4467,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -3402,7 +4478,7 @@ var ts; } ts.tokenToString = tokenToString; function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; function computeLineStarts(text) { @@ -3462,7 +4538,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -3598,7 +4673,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -3751,7 +4826,7 @@ var ts; if (!comments) { comments = []; } - comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); return comments; } function getLeadingCommentRanges(text, pos) { @@ -3784,7 +4859,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -3803,6 +4878,7 @@ var ts; var precedingLineBreak; var hasExtendedUnicodeEscape; var tokenIsUnterminated; + var numericLiteralFlags; setText(text, start, length); return { getStartPos: function () { return startPos; }, @@ -3816,6 +4892,7 @@ var ts; isIdentifier: function () { return token === 70 || token > 106; }, isReservedWord: function () { return token >= 71 && token <= 106; }, isUnterminated: function () { return tokenIsUnterminated; }, + getNumericLiteralFlags: function () { return numericLiteralFlags; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -3852,6 +4929,7 @@ var ts; var end = pos; if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { pos++; + numericLiteralFlags = 2; if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) pos++; if (isDigit(text.charCodeAt(pos))) { @@ -4121,8 +5199,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70; @@ -4151,6 +5232,7 @@ var ts; hasExtendedUnicodeEscape = false; precedingLineBreak = false; tokenIsUnterminated = false; + numericLiteralFlags = 0; while (true) { tokenPos = pos; if (pos >= end) { @@ -4332,6 +5414,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 8; return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { @@ -4342,6 +5425,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 16; return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { @@ -4352,10 +5436,12 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 32; return token = 8; } if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); + numericLiteralFlags = 4; return token = 8; } case 49: @@ -4602,7 +5688,14 @@ var ts; while (pos < end) { pos++; char = text.charCodeAt(pos); - if ((char === 123) || (char === 60)) { + if (char === 123) { + break; + } + if (char === 60) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7; + } break; } } @@ -4776,40 +5869,12 @@ var ts; (function (ts) { ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; ts.optionDeclarations = [ - { - name: "charset", - type: "string", - }, - ts.compileOnSaveCommandLineOption, - { - name: "declaration", - shortName: "d", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "diagnostics", - type: "boolean", - }, - { - name: "extendedDiagnostics", - type: "boolean", - experimental: true - }, - { - name: "emitBOM", - type: "boolean" - }, { name: "help", shortName: "h", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, }, { @@ -4818,56 +5883,73 @@ var ts; type: "boolean" }, { - name: "init", + name: "all", type: "boolean", - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Show_all_compiler_options, }, { - name: "inlineSourceMap", + name: "version", + shortName: "v", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_the_compiler_s_version, }, { - name: "inlineSources", + name: "init", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, }, { - name: "jsx", - type: ts.createMap({ - "preserve": 1, - "react": 2 - }), - paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - }, - { - name: "reactNamespace", - type: "string", - description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit - }, - { - name: "jsxFactory", + name: "project", + shortName: "p", type: "string", - description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + isFilePath: true, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY, + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, }, { - name: "listFiles", + name: "pretty", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental }, { - name: "locale", - type: "string", + name: "watch", + shortName: "w", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Watch_input_files, }, { - name: "mapRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: ts.Diagnostics.LOCATION, + name: "target", + shortName: "t", + type: ts.createMapFromTemplate({ + "es3": 0, + "es5": 1, + "es6": 2, + "es2015": 2, + "es2016": 3, + "es2017": 4, + "esnext": 5, + }), + paramType: ts.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, }, { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -4876,238 +5958,232 @@ var ts; "es6": ts.ModuleKind.ES2015, "es2015": ts.ModuleKind.ES2015, }), - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, }, { - name: "newLine", - type: ts.createMap({ - "crlf": 0, - "lf": 1 - }), - description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - }, - { - name: "noEmit", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs, - }, - { - name: "noEmitHelpers", - type: "boolean" - }, - { - name: "noEmitOnError", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "noErrorTruncation", - type: "boolean" - }, - { - name: "noImplicitAny", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "noImplicitThis", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "noUnusedLocals", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_locals, + name: "lib", + type: "list", + element: { + name: "lib", + type: ts.createMapFromTemplate({ + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", + "dom": "lib.dom.d.ts", + "dom.iterable": "lib.dom.iterable.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts", + "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", + "es2017.string": "lib.es2017.string.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", + }), + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon }, { - name: "noUnusedParameters", + name: "allowJs", type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_parameters, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled }, { - name: "noLib", + name: "checkJs", type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Report_errors_in_js_files }, { - name: "noResolve", - type: "boolean", + name: "jsx", + type: ts.createMapFromTemplate({ + "preserve": 1, + "react-native": 3, + "react": 2 + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { - name: "skipDefaultLibCheck", + name: "declaration", + shortName: "d", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_d_ts_file, }, { - name: "skipLibCheck", + name: "sourceMap", type: "boolean", - description: ts.Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "out", - type: "string", - isFilePath: false, - paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_map_file, }, { name: "outFile", type: "string", isFilePath: true, - description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, }, { name: "outDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Redirect_output_structure_to_the_directory, paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "preserveConstEnums", - type: "boolean", - description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "pretty", - description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, - type: "boolean" - }, - { - name: "project", - shortName: "p", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY - }, - { - name: "removeComments", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_comments_to_output, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, }, { name: "rootDir", type: "string", isFilePath: true, paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, }, { - name: "isolatedModules", + name: "removeComments", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_comments_to_output, }, { - name: "sourceMap", + name: "noEmit", type: "boolean", - description: ts.Diagnostics.Generates_corresponding_map_file, - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: ts.Diagnostics.LOCATION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_outputs, }, { - name: "suppressExcessPropertyErrors", + name: "importHelpers", type: "boolean", - description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, - experimental: true + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Import_emit_helpers_from_tslib }, { - name: "suppressImplicitAnyIndexErrors", + name: "downlevelIteration", type: "boolean", - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 }, { - name: "stripInternal", + name: "isolatedModules", type: "boolean", - description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - experimental: true + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule }, { - name: "target", - shortName: "t", - type: ts.createMap({ - "es3": 0, - "es5": 1, - "es6": 2, - "es2015": 2, - "es2016": 3, - "es2017": 4, - "esnext": 5, - }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, - paramType: ts.Diagnostics.VERSION, + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_all_strict_type_checking_options }, { - name: "version", - shortName: "v", + name: "noImplicitAny", type: "boolean", - description: ts.Diagnostics.Print_the_compiler_s_version, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, }, { - name: "watch", - shortName: "w", + name: "strictNullChecks", type: "boolean", - description: ts.Diagnostics.Watch_input_files, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_strict_null_checks }, { - name: "experimentalDecorators", + name: "noImplicitThis", type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, }, { - name: "emitDecoratorMetadata", + name: "alwaysStrict", type: "boolean", - experimental: true, - description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file }, { - name: "moduleResolution", - type: ts.createMap({ - "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic, - }), - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - paramType: ts.Diagnostics.STRATEGY, + name: "noUnusedLocals", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_locals, }, { - name: "allowUnusedLabels", + name: "noUnusedParameters", type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_parameters, }, { name: "noImplicitReturns", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value }, { name: "noFallthroughCasesInSwitch", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement }, { - name: "allowUnreachableCode", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + name: "moduleResolution", + type: ts.createMapFromTemplate({ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic, + }), + paramType: ts.Diagnostics.STRATEGY, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, }, { name: "baseUrl", type: "string", isFilePath: true, + category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names }, { name: "paths", type: "object", - isTSConfigOnly: true + isTSConfigOnly: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl }, { name: "rootDirs", @@ -5117,7 +6193,9 @@ var ts; name: "rootDirs", type: "string", isFilePath: true - } + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime }, { name: "typeRoots", @@ -5126,7 +6204,9 @@ var ts; name: "typeRoots", type: "string", isFilePath: true - } + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from }, { name: "types", @@ -5135,88 +6215,253 @@ var ts; name: "types", type: "string" }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation }, { - name: "traceResolution", + name: "allowSyntheticDefaultImports", type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking }, { - name: "allowJs", - type: "boolean", - description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, }, { - name: "allowSyntheticDefaultImports", + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", type: "boolean", - description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file }, { - name: "noImplicitUseStrict", + name: "inlineSources", type: "boolean", - description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set }, { - name: "maxNodeModuleJsDepth", - type: "number", - description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + name: "experimentalDecorators", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + { + name: "jsxFactory", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_verbose_diagnostic_information + }, + { + name: "traceResolution", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "listFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation }, { name: "listEmittedFiles", - type: "boolean" + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation }, { - name: "lib", - type: "list", - element: { - name: "lib", - type: ts.createMap({ - "es5": "lib.es5.d.ts", - "es6": "lib.es2015.d.ts", - "es2015": "lib.es2015.d.ts", - "es7": "lib.es2016.d.ts", - "es2016": "lib.es2016.d.ts", - "es2017": "lib.es2017.d.ts", - "dom": "lib.dom.d.ts", - "dom.iterable": "lib.dom.iterable.d.ts", - "webworker": "lib.webworker.d.ts", - "scripthost": "lib.scripthost.d.ts", - "es2015.core": "lib.es2015.core.d.ts", - "es2015.collection": "lib.es2015.collection.d.ts", - "es2015.generator": "lib.es2015.generator.d.ts", - "es2015.iterable": "lib.es2015.iterable.d.ts", - "es2015.promise": "lib.es2015.promise.d.ts", - "es2015.proxy": "lib.es2015.proxy.d.ts", - "es2015.reflect": "lib.es2015.reflect.d.ts", - "es2015.symbol": "lib.es2015.symbol.d.ts", - "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", - "es2016.array.include": "lib.es2016.array.include.d.ts", - "es2017.object": "lib.es2017.object.d.ts", - "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", - "es2017.string": "lib.es2017.string.d.ts", - }), - }, - description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + name: "out", + type: "string", + isFilePath: false, + category: ts.Diagnostics.Advanced_Options, + paramType: ts.Diagnostics.FILE, + description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + }, + { + name: "charset", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_character_set_of_the_input_files + }, + { + name: "emitBOM", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + }, + { + name: "locale", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: ts.createMapFromTemplate({ + "crlf": 0, + "lf": 1 + }), + paramType: ts.Diagnostics.NEWLINE, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, }, { name: "disableSizeLimit", - type: "boolean" + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects }, { - name: "strictNullChecks", + name: "noImplicitUseStrict", type: "boolean", - description: ts.Diagnostics.Enable_strict_null_checks + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output }, { - name: "importHelpers", + name: "noEmitHelpers", type: "boolean", - description: ts.Diagnostics.Import_emit_helpers_from_tslib + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output }, { - name: "alwaysStrict", + name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, + }, + { + name: "preserveConstEnums", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, + }, + { + name: "allowUnusedLabels", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "allowUnreachableCode", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + }, + { + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts.Diagnostics.List_of_language_service_plugins } ]; ts.typeAcquisitionDeclarations = [ @@ -5248,8 +6493,7 @@ var ts; ts.defaultInitCompilerOptions = { module: ts.ModuleKind.CommonJS, target: 1, - noImplicitAny: false, - sourceMap: false, + strict: true }; var optionNameMapCache; function convertEnableAutoDiscoveryToEnable(typeAcquisition) { @@ -5271,9 +6515,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -5281,19 +6525,12 @@ var ts; } ts.getOptionNameMap = getOptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; function parseListTypeOption(opt, value, errors) { @@ -5337,11 +6574,12 @@ var ts; } else if (s.charCodeAt(0) === 45) { s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -5446,7 +6684,7 @@ var ts; } } ts.parseConfigFileTextToJson = parseConfigFileTextToJson; - function generateTSConfig(options, fileNames) { + function generateTSConfig(options, fileNames, newLine) { var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); var configurations = { compilerOptions: serializeCompilerOptions(compilerOptions) @@ -5454,7 +6692,7 @@ var ts; if (fileNames && fileNames.length) { configurations.files = fileNames; } - return configurations; + return writeConfigurations(); function getCustomTypeMapOfCommandLineOption(optionDefinition) { if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { return undefined; @@ -5467,53 +6705,121 @@ var ts; } } function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_5 in options) { - if (ts.hasProperty(options, name_5)) { - switch (name_5) { - case "init": - case "watch": - case "version": - case "help": - case "project": - break; - default: - var value = options[name_5]; - var optionDefinition = optionsNameMap[name_5.toLowerCase()]; - if (optionDefinition) { - var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - result[name_5] = value; - } - else { - if (optionDefinition.type === "list") { - var convertedValue = []; - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name_5] = convertedValue; - } - else { - result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap); - } + for (var name in options) { + if (ts.hasProperty(options, name)) { + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { + continue; + } + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap) { + result[name] = value; + } + else { + if (optionDefinition.type === "list") { + var convertedValue = []; + for (var _i = 0, _a = value; _i < _a.length; _i++) { + var element = _a[_i]; + convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } + result[name] = convertedValue; } - break; + else { + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); + } + } } } } return result; } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return ts.arrayFrom(option.type.keys())[0]; + } + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function writeConfigurations() { + var categorizedOptions = ts.reduceLeft(ts.filter(ts.optionDeclarations, function (o) { return o.category !== ts.Diagnostics.Command_line_Options && o.category !== ts.Diagnostics.Advanced_Options; }), function (memo, value) { + if (value.category) { + var name = ts.getLocaleSpecificMessage(value.category); + (memo[name] || (memo[name] = [])).push(value); + } + return memo; + }, {}); + var marginLength = 0; + var seenKnownKeys = 0; + var nameColumn = []; + var descriptionColumn = []; + var knownKeysCount = ts.getOwnKeys(configurations.compilerOptions).length; + for (var category in categorizedOptions) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push("/* " + category + " */"); + descriptionColumn.push(""); + for (var _i = 0, _a = categorizedOptions[category]; _i < _a.length; _i++) { + var option = _a[_i]; + var optionName = void 0; + if (ts.hasProperty(configurations.compilerOptions, option.name)) { + optionName = "\"" + option.name + "\": " + JSON.stringify(configurations.compilerOptions[option.name]) + ((seenKnownKeys += 1) === knownKeysCount ? "" : ","); + } + else { + optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; + } + nameColumn.push(optionName); + descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); + marginLength = Math.max(optionName.length, marginLength); + } + } + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push(tab + "\"compilerOptions\": {"); + for (var i = 0; i < nameColumn.length; i++) { + var optionName = nameColumn[i]; + var description = descriptionColumn[i]; + result.push(tab + tab + optionName + makePadding(marginLength - optionName.length + 2) + description); + } + if (configurations.files && configurations.files.length) { + result.push(tab + "},"); + result.push(tab + "\"files\": ["); + for (var i = 0; i < configurations.files.length; i++) { + result.push("" + tab + tab + JSON.stringify(configurations.files[i]) + (i === configurations.files.length - 1 ? "" : ",")); + } + result.push(tab + "]"); + } + else { + result.push(tab + "}"); + } + result.push("}"); + return result.join(newLine); + } } ts.generateTSConfig = generateTSConfig; function removeComments(jsonText) { @@ -5533,10 +6839,12 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -5658,7 +6966,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -5709,8 +7017,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -5744,8 +7052,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -5762,7 +7071,7 @@ var ts; var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; var literalFileMap = ts.createMap(); @@ -5774,12 +7083,12 @@ var ts; exclude = validateSpecs(exclude, errors, true); } var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -5790,14 +7099,13 @@ var ts; } removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -5805,8 +7113,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -5825,7 +7133,7 @@ var ts; function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -5846,14 +7154,15 @@ var ts; } } } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } } return wildcardDirectories; } @@ -5872,11 +7181,11 @@ var ts; } function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority); + var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); for (var i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -5884,17 +7193,13 @@ var ts; } function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority); + var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - function addFileToOutput(output, file) { - output.push(file); - return output; - } function caseSensitiveKeyMapper(key) { return key; } @@ -5904,618 +7209,325 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var JsTyping; - (function (JsTyping) { - ; - ; - var safeList; - var EmptySafeList = ts.createMap(); - JsTyping.nodeCoreModuleList = [ - "buffer", "querystring", "events", "http", "cluster", - "zlib", "os", "https", "punycode", "repl", "readline", - "vm", "child_process", "url", "dns", "net", - "dgram", "fs", "path", "string_decoder", "tls", - "crypto", "stream", "util", "assert", "tty", "domain", - "constants", "process", "v8", "timers", "console" - ]; - var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { - var inferredTypings = ts.createMap(); - if (!typeAcquisition || !typeAcquisition.enable) { - return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + function trace(host) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + ts.trace = trace; + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); + function resolvedTypeScriptOnly(resolved) { + if (!resolved) { + return undefined; + } + ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); + return resolved.path; + } + function resolvedModuleFromResolved(_a, isExternalLibraryImport) { + var path = _a.path, extension = _a.extension; + return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; + } + function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations }; + } + function moduleHasNonRelativeName(moduleName) { + return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); + } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; + function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) { + var jsonContent = readJson(packageJsonPath, state.host); + return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); + function tryReadFromField(fieldName) { + if (!ts.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); + } + return; } - fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { - var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); - return kind === 1 || kind === 2; - }); - if (!safeList) { - var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + var fileName = jsonContent[fieldName]; + if (typeof fileName !== "string") { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); + } + return; } - var filesToWatch = []; - var searchDirs = []; - var exclude = []; - mergeTypings(typeAcquisition.include); - exclude = typeAcquisition.exclude || []; - var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); - if (projectRootPath) { - possibleSearchDirs.push(projectRootPath); + var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); } - searchDirs = ts.deduplicate(possibleSearchDirs); - for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { - var searchDir = searchDirs_1[_i]; - var packageJsonPath = ts.combinePaths(searchDir, "package.json"); - getTypingNamesFromJson(packageJsonPath, filesToWatch); - var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); - getTypingNamesFromJson(bowerJsonPath, filesToWatch); - var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromNodeModuleFolder(nodeModulesPath); + return path; + } + } + function readJson(path, host) { + try { + var jsonText = host.readFile(path); + return jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + return {}; + } + } + function getEffectiveTypeRoots(options, host) { + if (options.typeRoots) { + return options.typeRoots; + } + var currentDirectory; + if (options.configFilePath) { + currentDirectory = ts.getDirectoryPath(options.configFilePath); + } + else if (host.getCurrentDirectory) { + currentDirectory = host.getCurrentDirectory(); + } + if (currentDirectory !== undefined) { + return getDefaultTypeRoots(currentDirectory, host); + } + } + ts.getEffectiveTypeRoots = getEffectiveTypeRoots; + function getDefaultTypeRoots(currentDirectory, host) { + if (!host.directoryExists) { + return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; + } + var typeRoots; + forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { + var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); + if (host.directoryExists(atTypes)) { + (typeRoots || (typeRoots = [])).push(atTypes); } - getTypingNamesFromSourceFileNames(fileNames); - if (unresolvedImports) { - for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { - var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; - } + return undefined; + }); + return typeRoots; + } + var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + traceEnabled: traceEnabled + }; + var typeRoots = getEffectiveTypeRoots(options, host); + if (traceEnabled) { + if (containingFile === undefined) { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); } - } - for (var name_6 in packageNameToTypingLocation) { - if (name_6 in inferredTypings && !inferredTypings[name_6]) { - inferredTypings[name_6] = packageNameToTypingLocation[name_6]; + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); } } - for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { - var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; - } - var newTypingNames = []; - var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + else { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); } else { - newTypingNames.push(typing); + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); } } - return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; - function mergeTypings(typingNames) { - if (!typingNames) { - return; + } + var failedLookupLocations = []; + var resolved = primaryLookup(); + var primary = true; + if (!resolved) { + resolved = secondaryLookup(); + primary = false; + } + var resolvedTypeReferenceDirective; + if (resolved) { + resolved = realpath(resolved, host, traceEnabled); + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary); + } + resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved }; + } + return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations }; + function primaryLookup() { + if (typeRoots && typeRoots.length) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); } - for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { - var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + return ts.forEach(typeRoots, function (typeRoot) { + var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); + }); + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); } } - function getTypingNamesFromJson(jsonPath, filesToWatch) { - if (host.fileExists(jsonPath)) { - filesToWatch.push(jsonPath); + } + function secondaryLookup() { + var resolvedFile; + var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); + if (initialLocationForSecondaryLookup !== undefined) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); - if (result.config) { - var jsonConfig = result.config; - if (jsonConfig.dependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); - } - if (jsonConfig.devDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); - } - if (jsonConfig.optionalDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); - } - if (jsonConfig.peerDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); - } + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); + if (!resolvedFile && traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } + return resolvedFile; } - function getTypingNamesFromSourceFileNames(fileNames) { - var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); - var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); - var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); - if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); } - var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); - if (hasJsxFile) { - mergeTypings(["react"]); + } + } + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function getAutomaticTypeDirectiveNames(options, host) { + if (options.types) { + return options.types; + } + var result = []; + if (host.directoryExists && host.getDirectories) { + var typeRoots = getEffectiveTypeRoots(options, host); + if (typeRoots) { + for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { + var root = typeRoots_1[_i]; + if (host.directoryExists(root)) { + for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { + var typeDirectivePath = _b[_a]; + var normalized = ts.normalizePath(typeDirectivePath); + var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); + var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; + if (!isNotNeededPackage) { + result.push(ts.getBaseFileName(normalized)); + } + } + } } } - function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { - if (!host.directoryExists(nodeModulesPath)) { + } + return result; + } + ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); + if (!perModuleNameCache) { + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { return; } - var typingNames = []; - var fileNames = host.readDirectory(nodeModulesPath, [".json"], undefined, undefined, 2); - for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { - var fileName = fileNames_2[_i]; - var normalizedFileName = ts.normalizePath(fileName); - if (ts.getBaseFileName(normalizedFileName) !== "package.json") { - continue; - } - var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); - if (!result.config) { - continue; + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { + break; } - var packageJson = result.config; - if (packageJson._requiredBy && - ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { - continue; - } - if (!packageJson.name) { - continue; - } - if (packageJson.typings) { - var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; - } - else { - typingNames.push(packageJson.name); + directoryPathMap.set(parent, result); + current = parent; + if (current === commonPrefix) { + break; } } - mergeTypings(typingNames); - } - } - JsTyping.discoverTypings = discoverTypings; - })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - server.ActionSet = "action::set"; - server.ActionInvalidate = "action::invalidate"; - server.EventInstall = "event::install"; - var Arguments; - (function (Arguments) { - Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; - Arguments.LogFile = "--logFile"; - Arguments.EnableTelemetry = "--enableTelemetry"; - })(Arguments = server.Arguments || (server.Arguments = {})); - function hasArgument(argumentName) { - return ts.sys.args.indexOf(argumentName) >= 0; - } - server.hasArgument = hasArgument; - function findArgument(argumentName) { - var index = ts.sys.args.indexOf(argumentName); - return index >= 0 && index < ts.sys.args.length - 1 - ? ts.sys.args[index + 1] - : undefined; - } - server.findArgument = findArgument; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - var LogLevel; - (function (LogLevel) { - LogLevel[LogLevel["terse"] = 0] = "terse"; - LogLevel[LogLevel["normal"] = 1] = "normal"; - LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; - LogLevel[LogLevel["verbose"] = 3] = "verbose"; - })(LogLevel = server.LogLevel || (server.LogLevel = {})); - server.emptyArray = []; - var Msg; - (function (Msg) { - Msg.Err = "Err"; - Msg.Info = "Info"; - Msg.Perf = "Perf"; - })(Msg = server.Msg || (server.Msg = {})); - function getProjectRootPath(project) { - switch (project.projectKind) { - case server.ProjectKind.Configured: - return ts.getDirectoryPath(project.getProjectName()); - case server.ProjectKind.Inferred: - return ""; - case server.ProjectKind.External: - var projectName = ts.normalizeSlashes(project.getProjectName()); - return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; - } - } - function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { - return { - projectName: project.getProjectName(), - fileNames: project.getFileNames(true), - compilerOptions: project.getCompilerOptions(), - typeAcquisition: typeAcquisition, - unresolvedImports: unresolvedImports, - projectRootPath: getProjectRootPath(project), - cachePath: cachePath, - kind: "discover" - }; - } - server.createInstallTypingsRequest = createInstallTypingsRequest; - var Errors; - (function (Errors) { - function ThrowNoProject() { - throw new Error("No Project."); - } - Errors.ThrowNoProject = ThrowNoProject; - function ThrowProjectLanguageServiceDisabled() { - throw new Error("The project's language service is disabled."); - } - Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; - function ThrowProjectDoesNotContainDocument(fileName, project) { - throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); - } - Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; - })(Errors = server.Errors || (server.Errors = {})); - function getDefaultFormatCodeSettings(host) { - return { - indentSize: 4, - tabSize: 4, - newLineCharacter: host.newLine || "\n", - convertTabsToSpaces: true, - indentStyle: ts.IndentStyle.Smart, - insertSpaceAfterCommaDelimiter: true, - insertSpaceAfterSemicolonInForStatements: true, - insertSpaceBeforeAndAfterBinaryOperators: true, - insertSpaceAfterKeywordsInControlFlowStatements: true, - insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, - placeOpenBraceOnNewLineForFunctions: false, - placeOpenBraceOnNewLineForControlBlocks: false, - }; - } - server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; - function mergeMaps(target, source) { - for (var key in source) { - if (ts.hasProperty(source, key)) { - target[key] = source[key]; - } - } - } - server.mergeMaps = mergeMaps; - function removeItemFromSet(items, itemToRemove) { - if (items.length === 0) { - return; - } - var index = items.indexOf(itemToRemove); - if (index < 0) { - return; - } - if (index === items.length - 1) { - items.pop(); - } - else { - items[index] = items.pop(); - } - } - server.removeItemFromSet = removeItemFromSet; - function toNormalizedPath(fileName) { - return ts.normalizePath(fileName); - } - server.toNormalizedPath = toNormalizedPath; - function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { - var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); - return getCanonicalFileName(f); - } - server.normalizedPathToPath = normalizedPathToPath; - function asNormalizedPath(fileName) { - return fileName; - } - server.asNormalizedPath = asNormalizedPath; - function createNormalizedPathMap() { - var map = Object.create(null); - return { - get: function (path) { - return map[path]; - }, - set: function (path, value) { - map[path] = value; - }, - contains: function (path) { - return ts.hasProperty(map, path); - }, - remove: function (path) { - delete map[path]; - } - }; - } - server.createNormalizedPathMap = createNormalizedPathMap; - function isInferredProjectName(name) { - return /dev\/null\/inferredProject\d+\*/.test(name); - } - server.isInferredProjectName = isInferredProjectName; - function makeInferredProjectName(counter) { - return "/dev/null/inferredProject" + counter + "*"; - } - server.makeInferredProjectName = makeInferredProjectName; - function toSortedReadonlyArray(arr) { - arr.sort(); - return arr; - } - server.toSortedReadonlyArray = toSortedReadonlyArray; - var ThrottledOperations = (function () { - function ThrottledOperations(host) { - this.host = host; - this.pendingTimeouts = ts.createMap(); - } - ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { - if (ts.hasProperty(this.pendingTimeouts, operationId)) { - this.host.clearTimeout(this.pendingTimeouts[operationId]); - } - this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); - }; - ThrottledOperations.run = function (self, operationId, cb) { - delete self.pendingTimeouts[operationId]; - cb(); - }; - return ThrottledOperations; - }()); - server.ThrottledOperations = ThrottledOperations; - var GcTimer = (function () { - function GcTimer(host, delay, logger) { - this.host = host; - this.delay = delay; - this.logger = logger; } - GcTimer.prototype.scheduleCollect = function () { - if (!this.host.gc || this.timerId != undefined) { - return; - } - this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); - }; - GcTimer.run = function (self) { - self.timerId = undefined; - var log = self.logger.hasLevel(LogLevel.requestTime); - var before = log && self.host.getMemoryUsage(); - self.host.gc(); - if (log) { - var after = self.host.getMemoryUsage(); - self.logger.perftrc("GC::before " + before + ", after " + after); - } - }; - return GcTimer; - }()); - server.GcTimer = GcTimer; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - function trace(host) { - host.trace(ts.formatMessage.apply(undefined, arguments)); - } - ts.trace = trace; - function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceResolution && host.trace !== undefined; - } - ts.isTraceEnabled = isTraceEnabled; - function resolvedTypeScriptOnly(resolved) { - if (!resolved) { - return undefined; - } - ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); - return resolved.path; - } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } - function resolvedModuleFromResolved(_a, isExternalLibraryImport) { - var path = _a.path, extension = _a.extension; - return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; - } - function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) { - return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations }; - } - function moduleHasNonRelativeName(moduleName) { - return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); - } - ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { - var jsonContent = readJson(packageJsonPath, state.host); - switch (extensions) { - case 2: - case 0: - return tryReadFromField("typings") || tryReadFromField("types"); - case 1: - if (typeof jsonContent.main === "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); - } - return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main)); + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; } - return undefined; - } - function tryReadFromField(fieldName) { - if (ts.hasProperty(jsonContent, fieldName)) { - var typesFile = jsonContent[fieldName]; - if (typeof typesFile === "string") { - var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); - } - return typesFilePath; + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); - } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; } + return directory.substr(0, sep); } } } - function readJson(path, host) { - try { - var jsonText = host.readFile(path); - return jsonText ? JSON.parse(jsonText) : {}; - } - catch (e) { - return {}; - } - } - function getEffectiveTypeRoots(options, host) { - if (options.typeRoots) { - return options.typeRoots; - } - var currentDirectory; - if (options.configFilePath) { - currentDirectory = ts.getDirectoryPath(options.configFilePath); - } - else if (host.getCurrentDirectory) { - currentDirectory = host.getCurrentDirectory(); - } - if (currentDirectory !== undefined) { - return getDefaultTypeRoots(currentDirectory, host); - } - } - ts.getEffectiveTypeRoots = getEffectiveTypeRoots; - function getDefaultTypeRoots(currentDirectory, host) { - if (!host.directoryExists) { - return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; - } - var typeRoots; - forEachAncestorDirectory(currentDirectory, function (directory) { - var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); - if (host.directoryExists(atTypes)) { - (typeRoots || (typeRoots = [])).push(atTypes); - } - }); - return typeRoots; - } - var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); - function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { - var traceEnabled = isTraceEnabled(options, host); - var moduleResolutionState = { - compilerOptions: options, - host: host, - traceEnabled: traceEnabled - }; - var typeRoots = getEffectiveTypeRoots(options, host); + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { - if (containingFile === undefined) { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); - } - else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); - } - } - else { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); - } - else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); - } - } - } - var failedLookupLocations = []; - var resolved = primaryLookup(); - var primary = true; - if (!resolved) { - resolved = secondaryLookup(); - primary = false; + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var resolvedTypeReferenceDirective; - if (resolved) { - resolved = realpath(resolved, host, traceEnabled); + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache.get(moduleName); + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } - resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved }; } - return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations }; - function primaryLookup() { - if (typeRoots && typeRoots.length) { + else { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); } - return ts.forEach(typeRoots, function (typeRoot) { - var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); - var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); - }); } else { if (traceEnabled) { - trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); - } - } - } - function secondaryLookup() { - var resolvedFile; - var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); - if (initialLocationForSecondaryLookup !== undefined) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); - if (!resolvedFile && traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); - } - return resolvedFile; } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); - } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; } - } - } - ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; - function getAutomaticTypeDirectiveNames(options, host) { - if (options.types) { - return options.types; - } - var result = []; - if (host.directoryExists && host.getDirectories) { - var typeRoots = getEffectiveTypeRoots(options, host); - if (typeRoots) { - for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { - var root = typeRoots_1[_i]; - if (host.directoryExists(root)) { - for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { - var typeDirectivePath = _b[_a]; - var normalized = ts.normalizePath(typeDirectivePath); - var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); - var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; - if (!isNotNeededPackage) { - result.push(ts.getBaseFileName(normalized)); - } - } - } + if (perFolderCache) { + perFolderCache.set(moduleName, result); + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); } } } - return result; - } - ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); - } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; - if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); - } - } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); - } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; - } if (traceEnabled) { if (result.resolvedModule) { trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); @@ -6639,37 +7651,43 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, false); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + function nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, jsOnly) { + if (jsOnly === void 0) { jsOnly = false; } var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { - var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); + var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, true); }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state, true); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } - ts.nodeModuleNameResolver = nodeModuleNameResolver; + ts.nodeModuleNameResolverWorker = nodeModuleNameResolverWorker; function realpath(path, host, traceEnabled) { if (!host.realpath) { return path; @@ -6680,12 +7698,35 @@ var ts; } return real; } - function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); + } + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName); @@ -6713,11 +7754,11 @@ var ts; } } switch (extensions) { - case 2: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -6726,113 +7767,181 @@ var ts; } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var packageJsonPath = pathToPackageJson(candidate); + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { considerPackageJson = true; } var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); - } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + if (considerPackageJson) { + var packageJsonPath = pathToPackageJson(candidate); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state); + if (fromPackageJson) { + return fromPackageJson; } } else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field); + if (directoryExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } + failedLookupLocations.push(packageJsonPath); } } - else { + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state); + if (!file) { + return undefined; + } + var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); + var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); + if (fromFile) { + var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + if (resolved) { + return resolved; + } if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); } - failedLookupLocations.push(packageJsonPath); } - return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; + return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, false); + } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); + } + } + function mangleScopedPackage(moduleName, state) { + if (ts.startsWith(moduleName, "@")) { + var replaceSlash = moduleName.replace(ts.directorySeparator, "__"); + if (replaceSlash !== moduleName) { + var mangled = replaceSlash.slice(1); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; + } + } + return moduleName; + } + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); }); if (resolved_3) { return resolved_3; } - if (extensions === 0) { + if (extensions === Extensions.TypeScript) { return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); } } } @@ -6844,10 +7953,13 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } function forEachAncestorDirectory(directory, callback) { while (true) { var result = callback(directory); @@ -6878,6 +7990,19 @@ var ts; return undefined; } ts.getDeclarationOfKind = getDeclarationOfKind; + function findDeclaration(symbol, predicate) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + if (predicate(declaration)) { + return declaration; + } + } + } + return undefined; + } + ts.findDeclaration = findDeclaration; var stringWriters = []; function getSingleLineStringWriter() { if (stringWriters.length === 0) { @@ -6891,13 +8016,15 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, writeLine: function () { return str_1 += " "; }, increaseIndent: ts.noop, decreaseIndent: ts.noop, clear: function () { return str_1 = ""; }, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; } return stringWriters.pop(); @@ -6913,25 +8040,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; function moduleResolutionIsEqualTo(oldResolution, newResolution) { @@ -6950,7 +8077,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -6963,21 +8090,21 @@ var ts; ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304) !== 0; + return (node.flags & 131072) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608)) { - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576) !== 0) || + if (!(node.flags & 262144)) { + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304; + node.flags |= 131072; } - node.flags |= 8388608; + node.flags |= 262144; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261) { + while (node && node.kind !== 264) { node = node.parent; } return node; @@ -6985,11 +8112,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204: - case 232: - case 211: - case 212: + case 206: + case 234: case 213: + case 214: + case 215: return true; } return false; @@ -7044,6 +8171,10 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; + function isToken(n) { + return n.kind >= 0 && n.kind <= 141; + } + ts.isToken = isToken; function getTokenPosOfNode(node, sourceFile, includeJsDoc) { if (nodeIsMissing(node)) { return node.pos; @@ -7054,18 +8185,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 292 && node._children.length > 0) { + if (node.kind === 293 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 288; + return node.kind >= 266 && node.kind <= 292; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 291; + return node.kind >= 282 && node.kind <= 292; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -7096,16 +8227,9 @@ var ts; return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; - function getLiteralText(node, sourceFile, languageVersion) { - if (languageVersion < 2 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); - } + function getLiteralText(node, sourceFile) { if (!nodeIsSynthesized(node) && node.parent) { - var text = getSourceTextOfNodeFromSourceFile(sourceFile, node); - if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { - return node.text; - } - return text; + return getSourceTextOfNodeFromSourceFile(sourceFile, node); } switch (node.kind) { case 9: @@ -7124,19 +8248,6 @@ var ts; ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); } ts.getLiteralText = getLiteralText; - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98: - case 66: - case 111: - case 79: - return true; - } - } - return false; - } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -7144,10 +8255,6 @@ var ts; return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; } ts.escapeIdentifier = escapeIdentifier; - function unescapeIdentifier(identifier) { - return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; - } - ts.unescapeIdentifier = unescapeIdentifier; function makeIdentifierFromModuleName(moduleName) { return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } @@ -7159,11 +8266,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 && node.parent.kind === 256; + return node.kind === 225 && node.parent.kind === 259; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 && + return node && node.kind === 232 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -7172,11 +8279,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 230 && (!node.body); + return node && node.kind === 232 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 || - node.kind === 230 || + return node.kind === 264 || + node.kind === 232 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -7189,32 +8296,36 @@ var ts; return false; } switch (node.parent.kind) { - case 261: + case 264: return ts.isExternalModule(node.parent); - case 231: + case 233: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261: + case 264: + case 234: + case 259: case 232: - case 256: - case 230: - case 211: - case 212: case 213: - case 150: - case 149: + case 214: + case 215: case 151: + case 150: case 152: - case 225: - case 184: + case 153: + case 227: case 185: + case 186: return true; - case 204: + case 206: return parentNode && !isFunctionLike(parentNode); } return false; @@ -7234,6 +8345,10 @@ var ts; return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); } ts.declarationNameToString = declarationNameToString; + function getNameFromIndexInfo(info) { + return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined; + } + ts.getNameFromIndexInfo = getNameFromIndexInfo; function getTextOfPropertyName(name) { switch (name.kind) { case 70: @@ -7241,7 +8356,7 @@ var ts; case 9: case 8: return name.text; - case 142: + case 143: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -7252,10 +8367,10 @@ var ts; function entityNameToString(name) { switch (name.kind) { case 70: - return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141: + return getFullWidth(name) === 0 ? ts.unescapeIdentifier(name.text) : getTextOfNode(name); + case 142: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177: + case 178: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -7292,7 +8407,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204) { + if (node.body && node.body.kind === 206) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -7304,29 +8419,29 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261: + case 264: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 223: - case 174: - case 226: - case 197: - case 227: - case 230: - case 229: - case 260: case 225: - case 184: - case 149: - case 151: - case 152: + case 175: case 228: + case 198: + case 229: + case 232: + case 231: + case 263: + case 227: + case 185: + case 150: + case 152: + case 153: + case 230: errorNode = node.name; break; - case 185: + case 186: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -7347,7 +8462,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 && isConst(node); + return node.kind === 231 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -7360,11 +8475,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 && n.expression.kind === 96; + return n.kind === 180 && n.expression.kind === 96; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 + return node.kind === 209 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -7377,10 +8492,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 || - node.kind === 143 || - node.kind === 184 || - node.kind === 185) ? + var commentRanges = (node.kind === 145 || + node.kind === 144 || + node.kind === 185 || + node.kind === 186) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, function (comment) { @@ -7394,96 +8509,110 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 <= node.kind && node.kind <= 171) { + if (157 <= node.kind && node.kind <= 172) { return true; } switch (node.kind) { case 118: case 132: - case 134: - case 121: case 135: - case 137: + case 121: + case 136: + case 138: case 129: return true; case 104: - return node.parent.kind !== 188; - case 199: + return node.parent.kind !== 189; + case 200: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 70: - if (node.parent.kind === 141 && node.parent.right === node) { + if (node.parent.kind === 142 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 && node.parent.name === node) { + else if (node.parent.kind === 178 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 70 || node.kind === 141 || node.kind === 177, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141: - case 177: + ts.Debug.assert(node.kind === 70 || node.kind === 142 || node.kind === 178, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 142: + case 178: case 98: - var parent_1 = node.parent; - if (parent_1.kind === 160) { + var parent = node.parent; + if (parent.kind === 161) { return false; } - if (156 <= parent_1.kind && parent_1.kind <= 171) { + if (157 <= parent.kind && parent.kind <= 172) { return true; } - switch (parent_1.kind) { - case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143: - return node === parent_1.constraint; - case 147: - case 146: + switch (parent.kind) { + case 200: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); case 144: - case 223: - return node === parent_1.type; + return node === parent.constraint; + case 148: + case 147: + case 145: case 225: - case 184: + return node === parent.type; + case 227: case 185: + case 186: + case 151: case 150: case 149: - case 148: - case 151: case 152: - return node === parent_1.type; case 153: + return node === parent.type; case 154: case 155: - return node === parent_1.type; - case 182: - return node === parent_1.type; - case 179: + case 156: + return node === parent.type; + case 183: + return node === parent.type; case 180: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 181: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182: return false; } } return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 191; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216: + case 218: return visitor(node); - case 232: - case 204: - case 208: - case 209: + case 234: + case 206: case 210: case 211: case 212: case 213: - case 217: - case 218: - case 253: - case 254: + case 214: + case 215: case 219: - case 221: + case 220: case 256: + case 257: + case 221: + case 223: + case 259: return ts.forEachChild(node, traverse); } } @@ -7493,24 +8622,25 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195: + case 196: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } + return; + case 231: case 229: - case 227: + case 232: case 230: case 228: - case 226: - case 197: + case 198: return; default: if (isFunctionLike(node)) { - var name_7 = node.name; - if (name_7 && name_7.kind === 142) { - traverse(name_7.expression); + var name = node.name; + if (name && name.kind === 143) { + traverse(name.expression); return; } } @@ -7521,17 +8651,29 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + function getRestParameterElementType(node) { + if (node && node.kind === 163) { + return node.elementType; + } + else if (node && node.kind === 158) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174: + case 175: + case 263: + case 145: case 260: - case 144: - case 257: + case 148: case 147: - case 146: - case 258: - case 223: + case 261: + case 225: return true; } } @@ -7539,11 +8681,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 || node.kind === 152); + return node && (node.kind === 152 || node.kind === 153); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 || node.kind === 197); + return node && (node.kind === 228 || node.kind === 198); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7552,19 +8694,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150: - case 184: - case 225: + case 151: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return true; } return false; @@ -7572,13 +8714,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 225: - case 184: + case 153: + case 227: + case 185: return true; } return false; @@ -7586,30 +8728,42 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 213: + case 214: + case 215: case 211: case 212: - case 213: - case 209: - case 210: return true; - case 219: + case 221: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 221) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 && isFunctionLike(node.parent); + return node && node.kind === 206 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 && node.parent.kind === 176; + return node && node.kind === 150 && node.parent.kind === 177; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 && - (node.parent.kind === 176 || - node.parent.kind === 197); + return node.kind === 150 && + (node.parent.kind === 177 || + node.parent.kind === 198); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7645,44 +8799,57 @@ var ts; return undefined; } switch (node.kind) { - case 142: + case 143: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 185: + case 186: if (!includeArrowFunctions) { continue; } - case 225: - case 184: - case 230: - case 147: - case 146: - case 149: + case 227: + case 185: + case 232: case 148: + case 147: case 150: + case 149: case 151: case 152: case 153: case 154: case 155: - case 229: - case 261: + case 156: + case 231: + case 264: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, false); + if (container) { + switch (container.kind) { + case 151: + case 227: + case 185: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; @@ -7690,25 +8857,25 @@ var ts; return node; } switch (node.kind) { - case 142: + case 143: node = node.parent; break; - case 225: - case 184: + case 227: case 185: + case 186: if (!stopOnFunctions) { continue; } - case 147: - case 146: - case 149: case 148: + case 147: case 150: + case 149: case 151: case 152: + case 153: return node; - case 145: - if (node.parent.kind === 144 && isClassElement(node.parent.parent)) { + case 146: + if (node.parent.kind === 145 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { @@ -7720,36 +8887,36 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 || func.kind === 185) { + if (func.kind === 185 || func.kind === 186) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent = func.parent; + while (parent.kind === 184) { + prev = parent; + parent = parent.parent; } - if (parent_2.kind === 179 && parent_2.expression === prev) { - return parent_2; + if (parent.kind === 180 && parent.expression === prev) { + return parent; } } } ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 || kind === 178) + return (kind === 178 || kind === 179) && node.expression.kind === 96; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157: - case 272: + case 158: + case 276: return node.typeName; - case 199: + case 200: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70: - case 141: + case 142: return node; } return undefined; @@ -7757,10 +8924,12 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179: + case 250: + case 249: case 180: case 181: - case 145: + case 182: + case 146: return true; default: return false; @@ -7768,29 +8937,32 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181) { + if (node.kind === 182) { return node.tag; } + else if (isJsxOpeningLikeElement(node)) { + return node.tagName; + } return node.expression; } ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226: + case 228: return true; - case 147: - return node.parent.kind === 226; - case 151: + case 148: + return node.parent.kind === 228; case 152: - case 149: + case 153: + case 150: return node.body !== undefined - && node.parent.kind === 226; - case 144: + && node.parent.kind === 228; + case 145: return node.parent.body !== undefined - && (node.parent.kind === 150 - || node.parent.kind === 149 - || node.parent.kind === 152) - && node.parent.parent.kind === 226; + && (node.parent.kind === 151 + || node.parent.kind === 150 + || node.parent.kind === 153) + && node.parent.parent.kind === 228; } return false; } @@ -7806,19 +8978,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226: + case 228: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149: - case 152: + case 150: + case 153: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 || - parent.kind === 247 || - parent.kind === 249) { + if (parent.kind === 250 || + parent.kind === 249 || + parent.kind === 251) { return parent.tagName === node; } return false; @@ -7832,95 +9004,96 @@ var ts; case 100: case 85: case 11: - case 175: case 176: case 177: case 178: case 179: case 180: case 181: - case 200: case 182: case 201: case 183: + case 202: case 184: - case 197: case 185: - case 188: + case 198: case 186: + case 189: case 187: - case 190: + case 188: case 191: case 192: case 193: - case 196: case 194: - case 12: - case 198: - case 246: - case 247: + case 197: case 195: - case 189: + case 12: + case 199: + case 248: + case 249: + case 196: + case 190: + case 203: return true; - case 141: - while (node.parent.kind === 141) { + case 142: + while (node.parent.kind === 142) { node = node.parent; } - return node.parent.kind === 160 || isJSXTagName(node); + return node.parent.kind === 161 || isJSXTagName(node); case 70: - if (node.parent.kind === 160 || isJSXTagName(node)) { + if (node.parent.kind === 161 || isJSXTagName(node)) { return true; } case 8: case 9: case 98: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 223: - case 144: + var parent = node.parent; + switch (parent.kind) { + case 225: + case 145: + case 148: case 147: - case 146: + case 263: case 260: - case 257: - case 174: - return parent_3.initializer === node; - case 207: - case 208: + case 175: + return parent.initializer === node; case 209: case 210: - case 216: - case 217: + case 211: + case 212: case 218: - case 253: + case 219: case 220: - case 218: - return parent_3.expression === node; - case 211: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224) || + case 256: + case 222: + case 220: + return parent.expression === node; + case 213: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226) || forStatement.condition === node || forStatement.incrementor === node; - case 212: - case 213: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) || + case 214: + case 215: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226) || forInStatement.expression === node; - case 182: - case 200: - return node === parent_3.expression; - case 202: - return node === parent_3.expression; - case 142: - return node === parent_3.expression; - case 145: - case 252: - case 251: - case 259: + case 183: + case 201: + return node === parent.expression; + case 204: + return node === parent.expression; + case 143: + return node === parent.expression; + case 146: + case 255: + case 254: + case 262: return true; - case 199: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + case 200: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent)) { return true; } } @@ -7935,7 +9108,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind === 245; + return node.kind === 236 && node.moduleReference.kind === 247; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7944,7 +9117,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind !== 245; + return node.kind === 236 && node.moduleReference.kind !== 247; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7952,38 +9125,57 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152); + return node && !!(node.flags & 65536); } ts.isInJavaScriptFile = isInJavaScriptFile; - function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 179 && - expression.expression.kind === 70 && - expression.expression.text === "require" && - expression.arguments.length === 1; - return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9); + function isRequireCall(callExpression, checkArgumentIsStringLiteral) { + if (callExpression.kind !== 180) { + return false; + } + var _a = callExpression, expression = _a.expression, args = _a.arguments; + if (expression.kind !== 70 || expression.text !== "require") { + return false; + } + if (args.length !== 1) { + return false; + } + var arg = args[0]; + return !checkArgumentIsStringLiteral || arg.kind === 9 || arg.kind === 12; } ts.isRequireCall = isRequireCall; function isSingleOrDoubleQuote(charCode) { return charCode === 39 || charCode === 34; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; - function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223) { + function isDeclarationOfFunctionOrClassExpression(s) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184; + return declaration.initializer && (declaration.initializer.kind === 185 || declaration.initializer.kind === 198); } return false; } - ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression; + ts.isDeclarationOfFunctionOrClassExpression = isDeclarationOfFunctionOrClassExpression; + function getRightMostAssignedExpression(node) { + while (isAssignmentExpression(node, true)) { + node = node.right; + } + return node; + } + ts.getRightMostAssignedExpression = getRightMostAssignedExpression; + function isExportsIdentifier(node) { + return isIdentifier(node) && node.text === "exports"; + } + ts.isExportsIdentifier = isExportsIdentifier; + function isModuleExportsPropertyAccessExpression(node) { + return isPropertyAccessExpression(node) && isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports"; + } + ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression; function getSpecialPropertyAssignmentKind(expression) { if (!isInJavaScriptFile(expression)) { return 0; } - if (expression.kind !== 192) { - return 0; - } var expr = expression; - if (expr.operatorToken.kind !== 57 || expr.left.kind !== 177) { + if (expr.operatorToken.kind !== 57 || expr.left.kind !== 178) { return 0; } var lhs = expr.left; @@ -7995,11 +9187,14 @@ var ts; else if (lhsId.text === "module" && lhs.name.text === "exports") { return 2; } + else { + return 5; + } } else if (lhs.expression.kind === 98) { return 4; } - else if (lhs.expression.kind === 177) { + else if (lhs.expression.kind === 178) { var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70) { var innerPropertyAccessIdentifier = innerPropertyAccess.expression; @@ -8015,35 +9210,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235) { + if (node.kind === 237) { return node.moduleSpecifier; } - if (node.kind === 234) { + if (node.kind === 236) { var reference = node.moduleReference; - if (reference.kind === 245) { + if (reference.kind === 247) { return reference.expression; } } - if (node.kind === 241) { + if (node.kind === 243) { return node.moduleSpecifier; } - if (node.kind === 230 && node.name.kind === 9) { + if (node.kind === 232 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234) { + if (node.kind === 236) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 + return node.kind === 237 && node.importClause && !!node.importClause.name; } @@ -8051,13 +9246,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144: + case 145: + case 150: case 149: + case 261: + case 260: case 148: - case 258: - case 257: case 147: - case 146: return node.questionToken !== undefined; } } @@ -8065,28 +9260,36 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 && + return node.kind === 278 && node.parameters.length > 0 && - node.parameters[0].type.kind === 276; + node.parameters[0].type.kind === 280; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function hasJSDocParameterTags(node) { + var parameterTags = getJSDocTags(node, 285); + return parameterTags && parameterTags.length > 0; + } + ts.hasJSDocParameterTags = hasJSDocParameterTags; function getJSDocTags(node, kind) { var docs = getJSDocs(node); if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281) { + if (doc.kind === 285) { if (doc.kind === kind) { result.push(doc); } } else { - result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); + var tags = doc.tags; + if (tags) { + result.push.apply(result, ts.filter(tags, function (tag) { return tag.kind === kind; })); + } } } return result; @@ -8106,9 +9309,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205; + parent.parent.parent.kind === 207; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205; + parent.parent.kind === 207; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -8116,19 +9319,19 @@ var ts; getJSDocsWorker(variableStatementNode); } var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 && + parent.kind === 193 && parent.operatorToken.kind === 57 && - parent.parent.kind === 207; + parent.parent.kind === 209; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 && - parent && parent.kind === 230; - var isPropertyAssignmentExpression = parent && parent.kind === 257; + var isModuleDeclaration = node.kind === 232 && + parent && parent.kind === 232; + var isPropertyAssignmentExpression = parent && parent.kind === 260; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } - if (node.kind === 144) { + if (node.kind === 145) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -8137,22 +9340,23 @@ var ts; cache = ts.concatenate(cache, node.jsDoc); } } + ts.getJSDocs = getJSDocs; function getJSDocParameterTags(param) { if (!isParameter(param)) { return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281); + var tags = getJSDocTags(func, 285); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 285; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { - var name_8 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 285 && tag.parameterName.text === name_1; }); } else { return undefined; @@ -8160,8 +9364,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283); - if (!tag && node.kind === 144) { + var tag = getFirstJSDocTag(node, 287); + if (!tag && node.kind === 145) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -8171,15 +9375,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 284); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 286); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284); + return getFirstJSDocTag(node, 288); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -8191,9 +9395,9 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152)) { - if (node.type && node.type.kind === 275 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { + if (node && (node.flags & 65536)) { + if (node.type && node.type.kind === 279 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 279; })) { return true; } } @@ -8204,32 +9408,43 @@ var ts; return node && node.dotDotDotToken !== undefined; } ts.isDeclaredRestParam = isDeclaredRestParam; + var AssignmentKind; + (function (AssignmentKind) { + AssignmentKind[AssignmentKind["None"] = 0] = "None"; + AssignmentKind[AssignmentKind["Definite"] = 1] = "Definite"; + AssignmentKind[AssignmentKind["Compound"] = 2] = "Compound"; + })(AssignmentKind = ts.AssignmentKind || (ts.AssignmentKind = {})); function getAssignmentTargetKind(node) { var parent = node.parent; while (true) { switch (parent.kind) { - case 192: + case 193: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 ? 1 : 2 : 0; - case 190: case 191: + case 192: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 212: - case 213: + case 214: + case 215: return parent.initializer === node ? 1 : 0; - case 183: - case 175: - case 196: + case 184: + case 176: + case 197: node = parent; break; - case 258: + case 261: if (parent.name !== node) { return 0; } - case 257: + node = parent.parent; + break; + case 260: + if (parent.name === node) { + return 0; + } node = parent.parent; break; default: @@ -8243,6 +9458,17 @@ var ts; return getAssignmentTargetKind(node) !== 0; } ts.isAssignmentTarget = isAssignmentTarget; + function isDeleteTarget(node) { + if (node.kind !== 178 && node.kind !== 179) { + return false; + } + node = node.parent; + while (node && node.kind === 184) { + node = node.parent; + } + return node && node.kind === 187; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -8254,7 +9480,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 264 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8267,7 +9493,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 || parent.kind === 243) { + if (parent.kind === 241 || parent.kind === 245) { if (parent.propertyName) { return true; } @@ -8280,48 +9506,48 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 || node.kind === 8) && - node.parent.kind === 142 && + node.parent.kind === 143 && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 151: case 152: + case 153: + case 263: case 260: - case 257: - case 177: + case 178: return parent.name === node; - case 141: + case 142: if (parent.right === node) { - while (parent.kind === 141) { + while (parent.kind === 142) { parent = parent.parent; } - return parent.kind === 160; + return parent.kind === 161; } return false; - case 174: - case 239: + case 175: + case 241: return parent.propertyName === node; - case 243: + case 245: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 234 || - node.kind === 233 || - node.kind === 236 && !!node.name || - node.kind === 237 || + return node.kind === 236 || + node.kind === 235 || + node.kind === 238 && !!node.name || node.kind === 239 || - node.kind === 243 || - node.kind === 240 && exportAssignmentIsAlias(node); + node.kind === 241 || + node.kind === 245 || + node.kind === 242 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8407,17 +9633,61 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 <= token && token <= 140; + return 71 <= token && token <= 141; } ts.isKeyword = isKeyword; function isTrivia(token) { return 2 <= token && token <= 7; } ts.isTrivia = isTrivia; - function isAsyncFunctionLike(node) { - return isFunctionLike(node) && hasModifier(node, 256) && !isAccessor(node); + var FunctionFlags; + (function (FunctionFlags) { + FunctionFlags[FunctionFlags["Normal"] = 0] = "Normal"; + FunctionFlags[FunctionFlags["Generator"] = 1] = "Generator"; + FunctionFlags[FunctionFlags["Async"] = 2] = "Async"; + FunctionFlags[FunctionFlags["AsyncOrAsyncGenerator"] = 3] = "AsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["Invalid"] = 4] = "Invalid"; + FunctionFlags[FunctionFlags["InvalidAsyncOrAsyncGenerator"] = 7] = "InvalidAsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["InvalidGenerator"] = 5] = "InvalidGenerator"; + })(FunctionFlags = ts.FunctionFlags || (ts.FunctionFlags = {})); + function getFunctionFlags(node) { + var flags = 0; + switch (node.kind) { + case 227: + case 185: + case 150: + if (node.asteriskToken) { + flags |= 1; + } + case 186: + if (hasModifier(node, 256)) { + flags |= 2; + } + break; + } + if (!node.body) { + flags |= 4; + } + return flags; } - ts.isAsyncFunctionLike = isAsyncFunctionLike; + ts.getFunctionFlags = getFunctionFlags; + function isAsyncFunction(node) { + switch (node.kind) { + case 227: + case 185: + case 186: + case 150: + return node.body !== undefined + && node.asteriskToken === undefined + && hasModifier(node, 256); + } + return false; + } + ts.isAsyncFunction = isAsyncFunction; + function isNumericLiteral(node) { + return node.kind === 8; + } + ts.isNumericLiteral = isNumericLiteral; function isStringOrNumericLiteral(node) { var kind = node.kind; return kind === 9 @@ -8429,7 +9699,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 && + return name.kind === 143 && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -8439,10 +9709,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 144) { + if (name.kind === 70 || name.kind === 9 || name.kind === 8 || name.kind === 145) { return name.text; } - if (name.kind === 142) { + if (name.kind === 143) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -8487,11 +9757,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144; + return root.kind === 145; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174) { + while (node.kind === 175) { node = node.parent.parent; } return node; @@ -8499,15 +9769,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 - || kind === 184 - || kind === 225 + return kind === 151 || kind === 185 - || kind === 149 - || kind === 151 + || kind === 227 + || kind === 186 + || kind === 150 || kind === 152 - || kind === 230 - || kind === 261; + || kind === 153 + || kind === 232 + || kind === 264; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8515,66 +9785,49 @@ var ts; || ts.positionIsSynthesized(node.end); } ts.nodeIsSynthesized = nodeIsSynthesized; - function getOriginalNode(node, nodeTest) { - if (node) { - while (node.original !== undefined) { - node = node.original; - } + function getOriginalSourceFileOrBundle(sourceFileOrBundle) { + if (sourceFileOrBundle.kind === 265) { + return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, getOriginalSourceFile)); } - return !nodeTest || nodeTest(node) ? node : undefined; - } - ts.getOriginalNode = getOriginalNode; - function isParseTreeNode(node) { - return (node.flags & 8) === 0; + return getOriginalSourceFile(sourceFileOrBundle); } - ts.isParseTreeNode = isParseTreeNode; - function getParseTreeNode(node, nodeTest) { - if (isParseTreeNode(node)) { - return node; - } - node = getOriginalNode(node); - if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { - return node; - } - return undefined; + ts.getOriginalSourceFileOrBundle = getOriginalSourceFileOrBundle; + function getOriginalSourceFile(sourceFile) { + return ts.getParseTreeNode(sourceFile, isSourceFile) || sourceFile; } - ts.getParseTreeNode = getParseTreeNode; function getOriginalSourceFiles(sourceFiles) { - var originalSourceFiles = []; - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; - var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile); - if (originalSourceFile) { - originalSourceFiles.push(originalSourceFile); - } - } - return originalSourceFiles; + return ts.sameMap(sourceFiles, getOriginalSourceFile); } ts.getOriginalSourceFiles = getOriginalSourceFiles; function getOriginalNodeId(node) { - node = getOriginalNode(node); + node = ts.getOriginalNode(node); return node ? ts.getNodeId(node) : 0; } ts.getOriginalNodeId = getOriginalNodeId; + var Associativity; + (function (Associativity) { + Associativity[Associativity["Left"] = 0] = "Left"; + Associativity[Associativity["Right"] = 1] = "Right"; + })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180: + case 181: return hasArguments ? 0 : 1; - case 190: - case 187: + case 191: case 188: - case 186: case 189: - case 193: - case 195: + case 187: + case 190: + case 194: + case 196: return 1; - case 192: + case 193: switch (operator) { case 39: case 57: @@ -8598,15 +9851,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192) { + if (expression.kind === 193) { return expression.operatorToken.kind; } - else if (expression.kind === 190 || expression.kind === 191) { + else if (expression.kind === 191 || expression.kind === 192) { return expression.operator; } else { @@ -8624,37 +9877,36 @@ var ts; case 85: case 8: case 9: - case 175: case 176: - case 184: + case 177: case 185: - case 197: - case 246: - case 247: + case 186: + case 198: + case 248: + case 249: case 11: case 12: - case 194: - case 183: - case 198: - case 297: + case 195: + case 184: + case 199: return 19; - case 181: - case 177: + case 182: case 178: + case 179: return 18; - case 180: + case 181: return hasArguments ? 18 : 17; - case 179: + case 180: return 17; - case 191: + case 192: return 16; - case 190: - case 187: + case 191: case 188: - case 186: case 189: + case 187: + case 190: return 15; - case 192: + case 193: switch (operatorKind) { case 50: case 51: @@ -8712,11 +9964,11 @@ var ts; default: return -1; } - case 193: + case 194: return 4; - case 195: - return 2; case 196: + return 2; + case 197: return 1; default: return -1; @@ -8739,21 +9991,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -8770,16 +10016,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -8788,14 +10034,14 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -8810,13 +10056,12 @@ var ts; "\u0085": "\\u0085" }); function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -8959,129 +10204,62 @@ var ts; ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); - } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); if (options.outFile || options.out) { - onBundledEmit(sourceFiles); - } - else { - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], false); - } - function onBundledEmit(sourceFiles) { if (sourceFiles.length) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, true); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : ""; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, ts.createBundle(sourceFiles), emitOnlyDtsFiles); + } + } + else { + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFile, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - var extension = ".js"; - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1) { + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -9106,7 +10284,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 && nodeIsPresent(member.body)) { + if (member.kind === 151 && nodeIsPresent(member.body)) { return member; } }); @@ -9147,10 +10325,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151) { + if (accessor.kind === 152) { getAccessor = accessor; } - else if (accessor.kind === 152) { + else if (accessor.kind === 153) { setAccessor = accessor; } else { @@ -9159,7 +10337,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 || member.kind === 152) + if ((member.kind === 152 || member.kind === 153) && hasModifier(member, 32) === hasModifier(accessor, 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -9170,10 +10348,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 && !getAccessor) { + if (member.kind === 152 && !getAccessor) { getAccessor = member; } - if (member.kind === 152 && !setAccessor) { + if (member.kind === 153 && !setAccessor) { setAccessor = member; } } @@ -9391,7 +10569,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 && + if (node.kind === 200 && node.parent.token === 84 && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9409,8 +10587,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 176 - || kind === 175; + return kind === 177 + || kind === 176; } return false; } @@ -9434,31 +10612,42 @@ var ts; return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; + function isExpressionWithTypeArgumentsInClassImplementsClause(node) { + return node.kind === 200 + && isEntityNameExpression(node.expression) + && node.parent + && node.parent.token === 107 + && node.parent.parent + && isClassLike(node.parent.parent); + } + ts.isExpressionWithTypeArgumentsInClassImplementsClause = isExpressionWithTypeArgumentsInClassImplementsClause; function isEntityNameExpression(node) { return node.kind === 70 || - node.kind === 177 && isEntityNameExpression(node.expression); + node.kind === 178 && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 && node.parent.right === node) || - (node.parent.kind === 177 && node.parent.name === node); + return (node.parent.kind === 142 && node.parent.right === node) || + (node.parent.kind === 178 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; - function isEmptyObjectLiteralOrArrayLiteral(expression) { - var kind = expression.kind; - if (kind === 176) { - return expression.properties.length === 0; - } - if (kind === 175) { - return expression.elements.length === 0; - } - return false; + function isEmptyObjectLiteral(expression) { + return expression.kind === 177 && + expression.properties.length === 0; } - ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; + ts.isEmptyObjectLiteral = isEmptyObjectLiteral; + function isEmptyArrayLiteral(expression) { + return expression.kind === 176 && + expression.elements.length === 0; + } + ts.isEmptyArrayLiteral = isEmptyArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512); + } function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); } @@ -9492,39 +10681,6 @@ var ts; } return output; } - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - function stringifyFallback(value) { - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function convertToBase64(input) { var result = ""; @@ -9583,39 +10739,39 @@ var ts; || kind === 94) { return true; } - else if (kind === 177) { + else if (kind === 178) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178) { + else if (kind === 179) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 - || kind === 191) { + else if (kind === 191 + || kind === 192) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192) { + else if (kind === 193) { return node.operatorToken.kind !== 39 && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193) { + else if (kind === 194) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 - || kind === 187 - || kind === 186) { + else if (kind === 189 + || kind === 188 + || kind === 187) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175) { + else if (kind === 176) { return node.elements.length === 0; } - else if (kind === 176) { + else if (kind === 177) { return node.properties.length === 0; } - else if (kind === 179) { + else if (kind === 180) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -9630,16 +10786,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_9 in syntaxKindEnum) { - if (syntaxKindEnum[name_9] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_9 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -9648,6 +10807,14 @@ var ts; } } ts.formatSyntaxKind = formatSyntaxKind; + function getRangePos(range) { + return range ? range.pos : -1; + } + ts.getRangePos = getRangePos; + function getRangeEnd(range) { + return range ? range.end : -1; + } + ts.getRangeEnd = getRangeEnd; function movePos(pos, value) { return ts.positionIsSynthesized(pos) ? -1 : pos + value; } @@ -9722,11 +10889,11 @@ var ts; } ts.getStartPositionOfRange = getStartPositionOfRange; function isDeclarationNameOfEnumOrNamespace(node) { - var parseNode = getParseTreeNode(node); + var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229: - case 230: + case 231: + case 232: return parseNode === parseNode.parent.name; } } @@ -9744,7 +10911,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 && declaration !== node) { + if (declaration.kind === 228 && declaration !== node) { return true; } } @@ -9795,6 +10962,10 @@ var ts; return node.kind === 70; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 189; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { return isIdentifier(node) && node.autoGenerateKind > 0; } @@ -9804,16 +10975,16 @@ var ts; } ts.isModifier = isModifier; function isQualifiedName(node) { - return node.kind === 141; + return node.kind === 142; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142; + return node.kind === 143; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 + return kind === 142 || kind === 70; } ts.isEntityName = isEntityName; @@ -9822,7 +10993,7 @@ var ts; return kind === 70 || kind === 9 || kind === 8 - || kind === 142; + || kind === 143; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -9834,101 +11005,105 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 - || kind === 172 - || kind === 173; + || kind === 173 + || kind === 174; } ts.isBindingName = isBindingName; function isTypeParameter(node) { - return node.kind === 143; + return node.kind === 144; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144; + return node.kind === 145; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145; + return node.kind === 146; } ts.isDecorator = isDecorator; function isMethodDeclaration(node) { - return node.kind === 149; + return node.kind === 150; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 - || kind === 147 - || kind === 149 - || kind === 151 + return kind === 151 + || kind === 148 + || kind === 150 || kind === 152 - || kind === 155 - || kind === 203; + || kind === 153 + || kind === 156 + || kind === 205; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 - || kind === 258 - || kind === 259 - || kind === 149 - || kind === 151 + return kind === 260 + || kind === 261 + || kind === 262 + || kind === 150 || kind === 152 - || kind === 244; + || kind === 153 + || kind === 246; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { - return (kind >= 156 && kind <= 171) + return (kind >= 157 && kind <= 172) || kind === 118 || kind === 132 + || kind === 133 || kind === 121 - || kind === 134 || kind === 135 + || kind === 136 + || kind === 98 || kind === 104 + || kind === 138 + || kind === 94 || kind === 129 - || kind === 199; + || kind === 200; } function isTypeNode(node) { return isTypeNodeKind(node.kind); } ts.isTypeNode = isTypeNode; function isArrayBindingPattern(node) { - return node.kind === 173; + return node.kind === 174; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172; + return node.kind === 173; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 - || kind === 172; + return kind === 174 + || kind === 173; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 - || kind === 176; + return kind === 176 + || kind === 177; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174; + return node.kind === 175; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 - || kind === 198; + return kind === 175 + || kind === 199; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223: - case 144: - case 174: + case 225: + case 145: + case 175: return true; } return false; @@ -9941,8 +11116,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172: - case 176: + case 173: + case 177: return true; } return false; @@ -9950,94 +11125,100 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: + case 174: + case 176: return true; } return false; } ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isArrayLiteralExpression(node) { - return node.kind === 175; + return node.kind === 176; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176; + return node.kind === 177; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177; + return node.kind === 178; } ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isPropertyAccessOrQualifiedName(node) { + var kind = node.kind; + return kind === 178 + || kind === 142; + } + ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isElementAccessExpression(node) { - return node.kind === 178; + return node.kind === 179; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192; + return node.kind === 193; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193; + return node.kind === 194; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179; + return node.kind === 180; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 + return kind === 195 || kind === 12; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196; + return node.kind === 197; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199; + return node.kind === 200; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 - || kind === 178 - || kind === 180 + return kind === 178 || kind === 179 - || kind === 246 - || kind === 247 || kind === 181 - || kind === 175 - || kind === 183 + || kind === 180 + || kind === 248 + || kind === 249 + || kind === 182 || kind === 176 - || kind === 197 || kind === 184 + || kind === 177 + || kind === 198 + || kind === 185 || kind === 70 || kind === 11 || kind === 8 || kind === 9 || kind === 12 - || kind === 194 + || kind === 195 || kind === 85 || kind === 94 || kind === 98 || kind === 100 || kind === 96 - || kind === 201 - || kind === 297; + || kind === 202 + || kind === 203; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 - || kind === 191 - || kind === 186 + return kind === 191 + || kind === 192 || kind === 187 || kind === 188 || kind === 189 - || kind === 182 + || kind === 190 + || kind === 183 || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -10045,14 +11226,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 - || kind === 195 - || kind === 185 - || kind === 192 + return kind === 194 || kind === 196 - || kind === 200 - || kind === 198 - || kind === 297 + || kind === 186 + || kind === 193 + || kind === 197 + || kind === 201 + || kind === 199 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10061,16 +11241,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 - || kind === 200; + return kind === 183 + || kind === 201; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294; + return node.kind === 295; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293; + return node.kind === 294; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10079,15 +11259,15 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198; + return node.kind === 199; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 202; + return node.kind === 204; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 204; + return node.kind === 206; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10105,121 +11285,135 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223; + return node.kind === 225; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224; + return node.kind === 226; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232; + return node.kind === 234; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 - || kind === 230; + return kind === 233 + || kind === 232 + || kind === 70; } ts.isModuleBody = isModuleBody; + function isNamespaceBody(node) { + var kind = node.kind; + return kind === 233 + || kind === 232; + } + ts.isNamespaceBody = isNamespaceBody; + function isJSDocNamespaceBody(node) { + var kind = node.kind; + return kind === 70 + || kind === 232; + } + ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isImportEqualsDeclaration(node) { - return node.kind === 234; + return node.kind === 236; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236; + return node.kind === 238; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 240 + || kind === 239; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239; + return node.kind === 241; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242; + return node.kind === 244; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243; + return node.kind === 245; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 || node.kind === 229; + return node.kind === 232 || node.kind === 231; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 - || kind === 174 - || kind === 226 - || kind === 197 - || kind === 150 - || kind === 229 - || kind === 260 - || kind === 243 - || kind === 225 - || kind === 184 + return kind === 186 + || kind === 175 + || kind === 228 + || kind === 198 || kind === 151 - || kind === 236 - || kind === 234 - || kind === 239 + || kind === 231 + || kind === 263 + || kind === 245 || kind === 227 + || kind === 185 + || kind === 152 + || kind === 238 + || kind === 236 + || kind === 241 + || kind === 229 + || kind === 252 + || kind === 150 || kind === 149 + || kind === 232 + || kind === 235 + || kind === 239 + || kind === 145 + || kind === 260 || kind === 148 + || kind === 147 + || kind === 153 + || kind === 261 || kind === 230 - || kind === 233 - || kind === 237 || kind === 144 - || kind === 257 - || kind === 147 - || kind === 146 - || kind === 152 - || kind === 258 - || kind === 228 - || kind === 143 - || kind === 223 - || kind === 285; + || kind === 225 + || kind === 289; } function isDeclarationStatementKind(kind) { - return kind === 225 - || kind === 244 - || kind === 226 - || kind === 227 + return kind === 227 + || kind === 246 || kind === 228 || kind === 229 || kind === 230 - || kind === 235 - || kind === 234 - || kind === 241 - || kind === 240 - || kind === 233; + || kind === 231 + || kind === 232 + || kind === 237 + || kind === 236 + || kind === 243 + || kind === 242 + || kind === 235; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 + return kind === 217 + || kind === 216 + || kind === 224 + || kind === 211 + || kind === 209 + || kind === 208 || kind === 214 + || kind === 215 + || kind === 213 + || kind === 210 + || kind === 221 + || kind === 218 + || kind === 220 || kind === 222 - || kind === 209 + || kind === 223 || kind === 207 - || kind === 206 || kind === 212 - || kind === 213 - || kind === 211 - || kind === 208 || kind === 219 - || kind === 216 - || kind === 218 - || kind === 220 - || kind === 221 - || kind === 205 - || kind === 210 - || kind === 217 - || kind === 293 - || kind === 296 - || kind === 295; + || kind === 294 + || kind === 297 + || kind === 296; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10237,87 +11431,98 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204; + || kind === 206; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 245 - || kind === 141 + return kind === 247 + || kind === 142 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 248; + return node.kind === 250; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249; + return node.kind === 251; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 || kind === 70 - || kind === 177; + || kind === 178; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 - || kind === 252 - || kind === 247 + return kind === 248 + || kind === 255 + || kind === 249 || kind === 10; } ts.isJsxChild = isJsxChild; + function isJsxAttributes(node) { + var kind = node.kind; + return kind === 253; + } + ts.isJsxAttributes = isJsxAttributes; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 - || kind === 251; + return kind === 252 + || kind === 254; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251; + return node.kind === 254; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250; + return node.kind === 252; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 252; + || kind === 255; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; + function isJsxOpeningLikeElement(node) { + var kind = node.kind; + return kind === 250 + || kind === 249; + } + ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 - || kind === 254; + return kind === 256 + || kind === 257; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255; + return node.kind === 258; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256; + return node.kind === 259; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 257; + return node.kind === 260; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 261; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 260; + return node.kind === 263; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 261; + return node.kind === 264; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10329,10 +11534,11 @@ var ts; function getDefaultLibFileName(options) { switch (options.target) { case 5: + return "lib.esnext.full.d.ts"; case 4: - return "lib.es2017.d.ts"; + return "lib.es2017.full.d.ts"; case 3: - return "lib.es2016.d.ts"; + return "lib.es2016.full.d.ts"; case 2: return "lib.es6.d.ts"; default: @@ -10456,9 +11662,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143) { + if (d && d.kind === 144) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229) { return current; } } @@ -10466,11 +11672,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92) && node.parent.kind === 150 && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92) && node.parent.kind === 151 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10478,14 +11684,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 226) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 207) { flags |= ts.getModifierFlags(node); } return flags; @@ -10494,14 +11700,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223) { + if (node.kind === 225) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 226) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 207) { flags |= node.flags; } return flags; @@ -10554,24 +11760,46 @@ var ts; } } ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; + function getOriginalNode(node, nodeTest) { + if (node) { + while (node.original !== undefined) { + node = node.original; + } + } + return !nodeTest || nodeTest(node) ? node : undefined; + } + ts.getOriginalNode = getOriginalNode; + function isParseTreeNode(node) { + return (node.flags & 8) === 0; + } + ts.isParseTreeNode = isParseTreeNode; + function getParseTreeNode(node, nodeTest) { + if (node === undefined || isParseTreeNode(node)) { + return node; + } + node = getOriginalNode(node); + if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { + return node; + } + return undefined; + } + ts.getParseTreeNode = getParseTreeNode; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; })(ts || (ts = {})); var ts; (function (ts) { - var NodeConstructor; - var SourceFileConstructor; - function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 - ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) - : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); - var node = location - ? new ConstructorForKind(kind, location.pos, location.end) - : new ConstructorForKind(kind, -1, -1); - node.flags = flags | 8; + function createSynthesizedNode(kind) { + var node = ts.createNode(kind, -1, -1); + node.flags |= 8; return node; } function updateNode(updated, original) { if (updated !== original) { setOriginalNode(updated, original); + setTextRange(updated, original); if (original.startsOnNewLine) { updated.startsOnNewLine = true; } @@ -10580,7 +11808,7 @@ var ts; return updated; } ts.updateNode = updateNode; - function createNodeArray(elements, location, hasTrailingComma) { + function createNodeArray(elements, hasTrailingComma) { if (elements) { if (ts.isNodeArray(elements)) { return elements; @@ -10590,32 +11818,15 @@ var ts; elements = []; } var array = elements; - if (location) { - array.pos = location.pos; - array.end = location.end; - } - else { - array.pos = -1; - array.end = -1; - } - if (hasTrailingComma) { - array.hasTrailingComma = true; - } + array.pos = -1; + array.end = -1; + array.hasTrailingComma = hasTrailingComma; return array; } ts.createNodeArray = createNodeArray; - function createSynthesizedNode(kind, startsOnNewLine) { - var node = createNode(kind, undefined); - node.startsOnNewLine = startsOnNewLine; - return node; - } - ts.createSynthesizedNode = createSynthesizedNode; - function createSynthesizedNodeArray(elements) { - return createNodeArray(elements, undefined); - } - ts.createSynthesizedNodeArray = createSynthesizedNodeArray; function getSynthesizedClone(node) { - var clone = createNode(node.kind, undefined, node.flags); + var clone = createSynthesizedNode(node.kind); + clone.flags |= node.flags; setOriginalNode(clone, node); for (var key in node) { if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { @@ -10626,50 +11837,48 @@ var ts; return clone; } ts.getSynthesizedClone = getSynthesizedClone; - function getMutableClone(node) { - var clone = getSynthesizedClone(node); - clone.pos = node.pos; - clone.end = node.end; - clone.parent = node.parent; - return clone; - } - ts.getMutableClone = getMutableClone; - function createLiteral(value, location) { + function createLiteral(value) { if (typeof value === "number") { - var node = createNode(8, location, undefined); - node.text = value.toString(); - return node; + return createNumericLiteral(value + ""); } - else if (typeof value === "boolean") { - return createNode(value ? 100 : 85, location, undefined); + if (typeof value === "boolean") { + return value ? createTrue() : createFalse(); } - else if (typeof value === "string") { - var node = createNode(9, location, undefined); - node.text = value; - return node; - } - else if (value) { - var node = createNode(9, location, undefined); - node.textSourceNode = value; - node.text = value.text; - return node; + if (typeof value === "string") { + return createStringLiteral(value); } + return createLiteralFromNode(value); } ts.createLiteral = createLiteral; - var nextAutoGenerateId = 0; - function createIdentifier(text, location) { - var node = createNode(70, location); + function createNumericLiteral(value) { + var node = createSynthesizedNode(8); + node.text = value; + node.numericLiteralFlags = 0; + return node; + } + ts.createNumericLiteral = createNumericLiteral; + function createStringLiteral(text) { + var node = createSynthesizedNode(9); + node.text = text; + return node; + } + function createLiteralFromNode(sourceNode) { + var node = createStringLiteral(sourceNode.text); + node.textSourceNode = sourceNode; + return node; + } + function createIdentifier(text) { + var node = createSynthesizedNode(70); node.text = ts.escapeIdentifier(text); - node.originalKeywordKind = ts.stringToToken(text); + node.originalKeywordKind = text ? ts.stringToToken(text) : 0; node.autoGenerateKind = 0; node.autoGenerateId = 0; return node; } ts.createIdentifier = createIdentifier; - function createTempVariable(recordTempVariable, location) { - var name = createNode(70, location); - name.text = ""; - name.originalKeywordKind = 0; + var nextAutoGenerateId = 0; + function createTempVariable(recordTempVariable) { + var name = createIdentifier(""); name.autoGenerateKind = 1; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; @@ -10679,93 +11888,387 @@ var ts; return name; } ts.createTempVariable = createTempVariable; - function createLoopVariable(location) { - var name = createNode(70, location); - name.text = ""; - name.originalKeywordKind = 0; + function createLoopVariable() { + var name = createIdentifier(""); name.autoGenerateKind = 2; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createLoopVariable = createLoopVariable; - function createUniqueName(text, location) { - var name = createNode(70, location); - name.text = text; - name.originalKeywordKind = 0; + function createUniqueName(text) { + var name = createIdentifier(text); name.autoGenerateKind = 3; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createUniqueName = createUniqueName; - function getGeneratedNameForNode(node, location) { - var name = createNode(70, location); - name.original = node; - name.text = ""; - name.originalKeywordKind = 0; + function getGeneratedNameForNode(node) { + var name = createIdentifier(""); name.autoGenerateKind = 4; name.autoGenerateId = nextAutoGenerateId; + name.original = node; nextAutoGenerateId++; return name; } ts.getGeneratedNameForNode = getGeneratedNameForNode; function createToken(token) { - return createNode(token); + return createSynthesizedNode(token); } ts.createToken = createToken; function createSuper() { - var node = createNode(96); - return node; + return createSynthesizedNode(96); } ts.createSuper = createSuper; - function createThis(location) { - var node = createNode(98, location); - return node; + function createThis() { + return createSynthesizedNode(98); } ts.createThis = createThis; function createNull() { - var node = createNode(94); - return node; + return createSynthesizedNode(94); } ts.createNull = createNull; - function createComputedPropertyName(expression, location) { - var node = createNode(142, location); + function createTrue() { + return createSynthesizedNode(100); + } + ts.createTrue = createTrue; + function createFalse() { + return createSynthesizedNode(85); + } + ts.createFalse = createFalse; + function createQualifiedName(left, right) { + var node = createSynthesizedNode(142); + node.left = left; + node.right = asName(right); + return node; + } + ts.createQualifiedName = createQualifiedName; + function updateQualifiedName(node, left, right) { + return node.left !== left + || node.right !== right + ? updateNode(createQualifiedName(left, right), node) + : node; + } + ts.updateQualifiedName = updateQualifiedName; + function createComputedPropertyName(expression) { + var node = createSynthesizedNode(143); node.expression = expression; return node; } ts.createComputedPropertyName = createComputedPropertyName; function updateComputedPropertyName(node, expression) { - if (node.expression !== expression) { - return updateNode(createComputedPropertyName(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createComputedPropertyName(expression), node) + : node; } ts.updateComputedPropertyName = updateComputedPropertyName; - function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createSignatureDeclaration(kind, typeParameters, parameters, type) { + var signatureDeclaration = createSynthesizedNode(kind); + signatureDeclaration.typeParameters = asNodeArray(typeParameters); + signatureDeclaration.parameters = asNodeArray(parameters); + signatureDeclaration.type = type; + return signatureDeclaration; + } + ts.createSignatureDeclaration = createSignatureDeclaration; + function updateSignatureDeclaration(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) + : node; + } + function createFunctionTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(159, typeParameters, parameters, type); + } + ts.createFunctionTypeNode = createFunctionTypeNode; + function updateFunctionTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateFunctionTypeNode = updateFunctionTypeNode; + function createConstructorTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(160, typeParameters, parameters, type); + } + ts.createConstructorTypeNode = createConstructorTypeNode; + function updateConstructorTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructorTypeNode = updateConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(154, typeParameters, parameters, type); + } + ts.createCallSignatureDeclaration = createCallSignatureDeclaration; + function updateCallSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateCallSignatureDeclaration = updateCallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(155, typeParameters, parameters, type); + } + ts.createConstructSignatureDeclaration = createConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructSignatureDeclaration = updateConstructSignatureDeclaration; + function createMethodSignature(typeParameters, parameters, type, name, questionToken) { + var methodSignature = createSignatureDeclaration(149, typeParameters, parameters, type); + methodSignature.name = asName(name); + methodSignature.questionToken = questionToken; + return methodSignature; + } + ts.createMethodSignature = createMethodSignature; + function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.name !== name + || node.questionToken !== questionToken + ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) + : node; + } + ts.updateMethodSignature = updateMethodSignature; + function createKeywordTypeNode(kind) { + return createSynthesizedNode(kind); + } + ts.createKeywordTypeNode = createKeywordTypeNode; + function createThisTypeNode() { + return createSynthesizedNode(168); + } + ts.createThisTypeNode = createThisTypeNode; + function createLiteralTypeNode(literal) { + var literalTypeNode = createSynthesizedNode(172); + literalTypeNode.literal = literal; + return literalTypeNode; + } + ts.createLiteralTypeNode = createLiteralTypeNode; + function updateLiteralTypeNode(node, literal) { + return node.literal !== literal + ? updateNode(createLiteralTypeNode(literal), node) + : node; + } + ts.updateLiteralTypeNode = updateLiteralTypeNode; + function createTypeReferenceNode(typeName, typeArguments) { + var typeReference = createSynthesizedNode(158); + typeReference.typeName = asName(typeName); + typeReference.typeArguments = asNodeArray(typeArguments); + return typeReference; + } + ts.createTypeReferenceNode = createTypeReferenceNode; + function updateTypeReferenceNode(node, typeName, typeArguments) { + return node.typeName !== typeName + || node.typeArguments !== typeArguments + ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) + : node; + } + ts.updateTypeReferenceNode = updateTypeReferenceNode; + function createTypePredicateNode(parameterName, type) { + var typePredicateNode = createSynthesizedNode(157); + typePredicateNode.parameterName = asName(parameterName); + typePredicateNode.type = type; + return typePredicateNode; + } + ts.createTypePredicateNode = createTypePredicateNode; + function updateTypePredicateNode(node, parameterName, type) { + return node.parameterName !== parameterName + || node.type !== type + ? updateNode(createTypePredicateNode(parameterName, type), node) + : node; + } + ts.updateTypePredicateNode = updateTypePredicateNode; + function createTypeQueryNode(exprName) { + var typeQueryNode = createSynthesizedNode(161); + typeQueryNode.exprName = exprName; + return typeQueryNode; + } + ts.createTypeQueryNode = createTypeQueryNode; + function updateTypeQueryNode(node, exprName) { + return node.exprName !== exprName ? updateNode(createTypeQueryNode(exprName), node) : node; + } + ts.updateTypeQueryNode = updateTypeQueryNode; + function createArrayTypeNode(elementType) { + var arrayTypeNode = createSynthesizedNode(163); + arrayTypeNode.elementType = elementType; + return arrayTypeNode; + } + ts.createArrayTypeNode = createArrayTypeNode; + function updateArrayTypeNode(node, elementType) { + return node.elementType !== elementType + ? updateNode(createArrayTypeNode(elementType), node) + : node; + } + ts.updateArrayTypeNode = updateArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind, types) { + var unionTypeNode = createSynthesizedNode(kind); + unionTypeNode.types = createNodeArray(types); + return unionTypeNode; + } + ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node, types) { + return node.types !== types + ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) + : node; + } + ts.updateUnionOrIntersectionTypeNode = updateUnionOrIntersectionTypeNode; + function createTypeLiteralNode(members) { + var typeLiteralNode = createSynthesizedNode(162); + typeLiteralNode.members = createNodeArray(members); + return typeLiteralNode; + } + ts.createTypeLiteralNode = createTypeLiteralNode; + function updateTypeLiteralNode(node, members) { + return node.members !== members + ? updateNode(createTypeLiteralNode(members), node) + : node; + } + ts.updateTypeLiteralNode = updateTypeLiteralNode; + function createTupleTypeNode(elementTypes) { + var tupleTypeNode = createSynthesizedNode(164); + tupleTypeNode.elementTypes = createNodeArray(elementTypes); + return tupleTypeNode; + } + ts.createTupleTypeNode = createTupleTypeNode; + function updateTypleTypeNode(node, elementTypes) { + return node.elementTypes !== elementTypes + ? updateNode(createTupleTypeNode(elementTypes), node) + : node; + } + ts.updateTypleTypeNode = updateTypleTypeNode; + function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { + var mappedTypeNode = createSynthesizedNode(171); + mappedTypeNode.readonlyToken = readonlyToken; + mappedTypeNode.typeParameter = typeParameter; + mappedTypeNode.questionToken = questionToken; + mappedTypeNode.type = type; + return mappedTypeNode; + } + ts.createMappedTypeNode = createMappedTypeNode; + function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { + return node.readonlyToken !== readonlyToken + || node.typeParameter !== typeParameter + || node.questionToken !== questionToken + || node.type !== type + ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) + : node; + } + ts.updateMappedTypeNode = updateMappedTypeNode; + function createTypeOperatorNode(type) { + var typeOperatorNode = createSynthesizedNode(169); + typeOperatorNode.operator = 126; + typeOperatorNode.type = type; + return typeOperatorNode; + } + ts.createTypeOperatorNode = createTypeOperatorNode; + function updateTypeOperatorNode(node, type) { + return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; + } + ts.updateTypeOperatorNode = updateTypeOperatorNode; + function createIndexedAccessTypeNode(objectType, indexType) { + var indexedAccessTypeNode = createSynthesizedNode(170); + indexedAccessTypeNode.objectType = objectType; + indexedAccessTypeNode.indexType = indexType; + return indexedAccessTypeNode; + } + ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node, objectType, indexType) { + return node.objectType !== objectType + || node.indexType !== indexType + ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) + : node; + } + ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; + function createTypeParameterDeclaration(name, constraint, defaultType) { + var typeParameter = createSynthesizedNode(144); + typeParameter.name = asName(name); + typeParameter.constraint = constraint; + typeParameter.default = defaultType; + return typeParameter; + } + ts.createTypeParameterDeclaration = createTypeParameterDeclaration; + function updateTypeParameterDeclaration(node, name, constraint, defaultType) { + return node.name !== name + || node.constraint !== constraint + || node.default !== defaultType + ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) + : node; + } + ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; + function createPropertySignature(name, questionToken, type, initializer) { + var propertySignature = createSynthesizedNode(147); + propertySignature.name = asName(name); + propertySignature.questionToken = questionToken; + propertySignature.type = type; + propertySignature.initializer = initializer; + return propertySignature; + } + ts.createPropertySignature = createPropertySignature; + function updatePropertySignature(node, name, questionToken, type, initializer) { + return node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createPropertySignature(name, questionToken, type, initializer), node) + : node; + } + ts.updatePropertySignature = updatePropertySignature; + function createIndexSignatureDeclaration(decorators, modifiers, parameters, type) { + var indexSignature = createSynthesizedNode(156); + indexSignature.decorators = asNodeArray(decorators); + indexSignature.modifiers = asNodeArray(modifiers); + indexSignature.parameters = createNodeArray(parameters); + indexSignature.type = type; + return indexSignature; + } + ts.createIndexSignatureDeclaration = createIndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node, decorators, modifiers, parameters, type) { + return node.parameters !== parameters + || node.type !== type + || node.decorators !== decorators + || node.modifiers !== modifiers + ? updateNode(createIndexSignatureDeclaration(decorators, modifiers, parameters, type), node) + : node; + } + ts.updateIndexSignatureDeclaration = updateIndexSignatureDeclaration; + function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + var node = createSynthesizedNode(145); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.name = asName(name); node.questionToken = questionToken; node.type = type; - node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, node, node.flags), node); - } - return node; + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer), node) + : node; } ts.updateParameter = updateParameter; - function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createDecorator(expression) { + var node = createSynthesizedNode(146); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createDecorator = createDecorator; + function updateDecorator(node, expression) { + return node.expression !== expression + ? updateNode(createDecorator(expression), node) + : node; + } + ts.updateDecorator = updateDecorator; + function createProperty(decorators, modifiers, name, questionToken, type, initializer) { + var node = createSynthesizedNode(148); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.questionToken = questionToken; node.type = type; node.initializer = initializer; @@ -10773,36 +12276,46 @@ var ts; } ts.createProperty = createProperty; function updateProperty(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer), node) + : node; } ts.updateProperty = updateProperty; - function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(150); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.questionToken = questionToken; + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } - ts.createMethod = createMethod; - function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + ts.createMethodDeclaration = createMethodDeclaration; + function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) + : node; } ts.updateMethod = updateMethod; - function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createConstructor(decorators, modifiers, parameters, body) { + var node = createSynthesizedNode(151); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = undefined; @@ -10811,17 +12324,19 @@ var ts; } ts.createConstructor = createConstructor; function updateConstructor(node, decorators, modifiers, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) { - return updateNode(createConstructor(decorators, modifiers, parameters, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.parameters !== parameters + || node.body !== body + ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) + : node; } ts.updateConstructor = updateConstructor; - function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createGetAccessor(decorators, modifiers, name, parameters, type, body) { + var node = createSynthesizedNode(152); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = type; @@ -10830,17 +12345,21 @@ var ts; } ts.createGetAccessor = createGetAccessor; function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) + : node; } ts.updateGetAccessor = updateGetAccessor; - function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createSetAccessor(decorators, modifiers, name, parameters, body) { + var node = createSynthesizedNode(153); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.body = body; @@ -10848,57 +12367,60 @@ var ts; } ts.createSetAccessor = createSetAccessor; function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) { - return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.body !== body + ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) + : node; } ts.updateSetAccessor = updateSetAccessor; - function createObjectBindingPattern(elements, location) { - var node = createNode(172, location); + function createObjectBindingPattern(elements) { + var node = createSynthesizedNode(173); node.elements = createNodeArray(elements); return node; } ts.createObjectBindingPattern = createObjectBindingPattern; function updateObjectBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createObjectBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createObjectBindingPattern(elements), node) + : node; } ts.updateObjectBindingPattern = updateObjectBindingPattern; - function createArrayBindingPattern(elements, location) { - var node = createNode(173, location); + function createArrayBindingPattern(elements) { + var node = createSynthesizedNode(174); node.elements = createNodeArray(elements); return node; } ts.createArrayBindingPattern = createArrayBindingPattern; function updateArrayBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayBindingPattern(elements), node) + : node; } ts.updateArrayBindingPattern = updateArrayBindingPattern; - function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174, location); - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createBindingElement(dotDotDotToken, propertyName, name, initializer) { + var node = createSynthesizedNode(175); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.propertyName = asName(propertyName); + node.name = asName(name); node.initializer = initializer; return node; } ts.createBindingElement = createBindingElement; function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); - } - return node; + return node.propertyName !== propertyName + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.initializer !== initializer + ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) + : node; } ts.updateBindingElement = updateBindingElement; - function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175, location); - node.elements = parenthesizeListElements(createNodeArray(elements)); + function createArrayLiteral(elements, multiLine) { + var node = createSynthesizedNode(176); + node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; } @@ -10906,14 +12428,13 @@ var ts; } ts.createArrayLiteral = createArrayLiteral; function updateArrayLiteral(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayLiteral(elements, node, node.multiLine), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayLiteral(elements, node.multiLine), node) + : node; } ts.updateArrayLiteral = updateArrayLiteral; - function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176, location); + function createObjectLiteral(properties, multiLine) { + var node = createSynthesizedNode(177); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -10922,431 +12443,461 @@ var ts; } ts.createObjectLiteral = createObjectLiteral; function updateObjectLiteral(node, properties) { - if (node.properties !== properties) { - return updateNode(createObjectLiteral(properties, node, node.multiLine), node); - } - return node; + return node.properties !== properties + ? updateNode(createObjectLiteral(properties, node.multiLine), node) + : node; } ts.updateObjectLiteral = updateObjectLiteral; - function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177, location, flags); - node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 65536; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAccess(expression, name) { + var node = createSynthesizedNode(178); + node.expression = ts.parenthesizeForAccess(expression); + node.name = asName(name); + setEmitFlags(node, 65536); return node; } ts.createPropertyAccess = createPropertyAccess; function updatePropertyAccess(node, expression, name) { - if (node.expression !== expression || node.name !== name) { - var propertyAccess = createPropertyAccess(expression, name, node, node.flags); - (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node); - return updateNode(propertyAccess, node); - } - return node; + return node.expression !== expression + || node.name !== name + ? updateNode(setEmitFlags(createPropertyAccess(expression, name), getEmitFlags(node)), node) + : node; } ts.updatePropertyAccess = updatePropertyAccess; - function createElementAccess(expression, index, location) { - var node = createNode(178, location); - node.expression = parenthesizeForAccess(expression); - node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; + function createElementAccess(expression, index) { + var node = createSynthesizedNode(179); + node.expression = ts.parenthesizeForAccess(expression); + node.argumentExpression = asExpression(index); return node; } ts.createElementAccess = createElementAccess; function updateElementAccess(node, expression, argumentExpression) { - if (node.expression !== expression || node.argumentExpression !== argumentExpression) { - return updateNode(createElementAccess(expression, argumentExpression, node), node); - } - return node; + return node.expression !== expression + || node.argumentExpression !== argumentExpression + ? updateNode(createElementAccess(expression, argumentExpression), node) + : node; } ts.updateElementAccess = updateElementAccess; - function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179, location, flags); - node.expression = parenthesizeForAccess(expression); - if (typeArguments) { - node.typeArguments = createNodeArray(typeArguments); - } - node.arguments = parenthesizeListElements(createNodeArray(argumentsArray)); + function createCall(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(180); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); return node; } ts.createCall = createCall; function updateCall(node, expression, typeArguments, argumentsArray) { - if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) { - return updateNode(createCall(expression, typeArguments, argumentsArray, node, node.flags), node); - } - return node; + return expression !== node.expression + || typeArguments !== node.typeArguments + || argumentsArray !== node.arguments + ? updateNode(createCall(expression, typeArguments, argumentsArray), node) + : node; } ts.updateCall = updateCall; - function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180, location, flags); - node.expression = parenthesizeForNew(expression); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; + function createNew(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(181); + node.expression = ts.parenthesizeForNew(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; return node; } ts.createNew = createNew; function updateNew(node, expression, typeArguments, argumentsArray) { - if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) { - return updateNode(createNew(expression, typeArguments, argumentsArray, node, node.flags), node); - } - return node; + return node.expression !== expression + || node.typeArguments !== typeArguments + || node.arguments !== argumentsArray + ? updateNode(createNew(expression, typeArguments, argumentsArray), node) + : node; } ts.updateNew = updateNew; - function createTaggedTemplate(tag, template, location) { - var node = createNode(181, location); - node.tag = parenthesizeForAccess(tag); + function createTaggedTemplate(tag, template) { + var node = createSynthesizedNode(182); + node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; } ts.createTaggedTemplate = createTaggedTemplate; function updateTaggedTemplate(node, tag, template) { - if (node.tag !== tag || node.template !== template) { - return updateNode(createTaggedTemplate(tag, template, node), node); - } - return node; + return node.tag !== tag + || node.template !== template + ? updateNode(createTaggedTemplate(tag, template), node) + : node; } ts.updateTaggedTemplate = updateTaggedTemplate; - function createParen(expression, location) { - var node = createNode(183, location); + function createTypeAssertion(type, expression) { + var node = createSynthesizedNode(183); + node.type = type; + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeAssertion = createTypeAssertion; + function updateTypeAssertion(node, type, expression) { + return node.type !== type + || node.expression !== expression + ? updateNode(createTypeAssertion(type, expression), node) + : node; + } + ts.updateTypeAssertion = updateTypeAssertion; + function createParen(expression) { + var node = createSynthesizedNode(184); node.expression = expression; return node; } ts.createParen = createParen; function updateParen(node, expression) { - if (node.expression !== expression) { - return updateNode(createParen(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createParen(expression), node) + : node; } ts.updateParen = updateParen; - function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(185); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionExpression = createFunctionExpression; - function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) { - if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.name !== name + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionExpression = updateFunctionExpression; - function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + var node = createSynthesizedNode(186); + node.modifiers = asNodeArray(modifiers); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35); - node.body = parenthesizeConciseBody(body); + node.body = ts.parenthesizeConciseBody(body); return node; } ts.createArrowFunction = createArrowFunction; function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) { - if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body), node) + : node; } ts.updateArrowFunction = updateArrowFunction; - function createDelete(expression, location) { - var node = createNode(186, location); - node.expression = parenthesizePrefixOperand(expression); + function createDelete(expression) { + var node = createSynthesizedNode(187); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createDelete = createDelete; function updateDelete(node, expression) { - if (node.expression !== expression) { - return updateNode(createDelete(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createDelete(expression), node) + : node; } ts.updateDelete = updateDelete; - function createTypeOf(expression, location) { - var node = createNode(187, location); - node.expression = parenthesizePrefixOperand(expression); + function createTypeOf(expression) { + var node = createSynthesizedNode(188); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createTypeOf = createTypeOf; function updateTypeOf(node, expression) { - if (node.expression !== expression) { - return updateNode(createTypeOf(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createTypeOf(expression), node) + : node; } ts.updateTypeOf = updateTypeOf; - function createVoid(expression, location) { - var node = createNode(188, location); - node.expression = parenthesizePrefixOperand(expression); + function createVoid(expression) { + var node = createSynthesizedNode(189); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createVoid = createVoid; function updateVoid(node, expression) { - if (node.expression !== expression) { - return updateNode(createVoid(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createVoid(expression), node) + : node; } ts.updateVoid = updateVoid; - function createAwait(expression, location) { - var node = createNode(189, location); - node.expression = parenthesizePrefixOperand(expression); + function createAwait(expression) { + var node = createSynthesizedNode(190); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createAwait = createAwait; function updateAwait(node, expression) { - if (node.expression !== expression) { - return updateNode(createAwait(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createAwait(expression), node) + : node; } ts.updateAwait = updateAwait; - function createPrefix(operator, operand, location) { - var node = createNode(190, location); + function createPrefix(operator, operand) { + var node = createSynthesizedNode(191); node.operator = operator; - node.operand = parenthesizePrefixOperand(operand); + node.operand = ts.parenthesizePrefixOperand(operand); return node; } ts.createPrefix = createPrefix; function updatePrefix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPrefix(node.operator, operand, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPrefix(node.operator, operand), node) + : node; } ts.updatePrefix = updatePrefix; - function createPostfix(operand, operator, location) { - var node = createNode(191, location); - node.operand = parenthesizePostfixOperand(operand); + function createPostfix(operand, operator) { + var node = createSynthesizedNode(192); + node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; } ts.createPostfix = createPostfix; function updatePostfix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPostfix(operand, node.operator, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPostfix(operand, node.operator), node) + : node; } ts.updatePostfix = updatePostfix; - function createBinary(left, operator, right, location) { - var operatorToken = typeof operator === "number" ? createToken(operator) : operator; + function createBinary(left, operator, right) { + var node = createSynthesizedNode(193); + var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; - var node = createNode(192, location); - node.left = parenthesizeBinaryOperand(operatorKind, left, true, undefined); + node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined); node.operatorToken = operatorToken; - node.right = parenthesizeBinaryOperand(operatorKind, right, false, node.left); + node.right = ts.parenthesizeBinaryOperand(operatorKind, right, false, node.left); return node; } ts.createBinary = createBinary; function updateBinary(node, left, right) { - if (node.left !== left || node.right !== right) { - return updateNode(createBinary(left, node.operatorToken, right, node), node); - } - return node; + return node.left !== left + || node.right !== right + ? updateNode(createBinary(left, node.operatorToken, right), node) + : node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193, whenFalse ? location : colonTokenOrLocation); - node.condition = parenthesizeForConditionalHead(condition); - if (whenFalse) { - node.questionToken = questionTokenOrWhenTrue; - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - node.colonToken = colonTokenOrLocation; - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); - } - else { - node.questionToken = createToken(54); - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); - node.colonToken = createToken(55); - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - } + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { + var node = createSynthesizedNode(194); + node.condition = ts.parenthesizeForConditionalHead(condition); + node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(54); + node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); + node.colonToken = whenFalse ? colonToken : createToken(55); + node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse); return node; } ts.createConditional = createConditional; function updateConditional(node, condition, whenTrue, whenFalse) { - if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) { - return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node); - } - return node; + return node.condition !== condition + || node.whenTrue !== whenTrue + || node.whenFalse !== whenFalse + ? updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse), node) + : node; } ts.updateConditional = updateConditional; - function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194, location); + function createTemplateExpression(head, templateSpans) { + var node = createSynthesizedNode(195); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; } ts.createTemplateExpression = createTemplateExpression; function updateTemplateExpression(node, head, templateSpans) { - if (node.head !== head || node.templateSpans !== templateSpans) { - return updateNode(createTemplateExpression(head, templateSpans, node), node); - } - return node; + return node.head !== head + || node.templateSpans !== templateSpans + ? updateNode(createTemplateExpression(head, templateSpans), node) + : node; } ts.updateTemplateExpression = updateTemplateExpression; - function createYield(asteriskToken, expression, location) { - var node = createNode(195, location); - node.asteriskToken = asteriskToken; - node.expression = expression; + function createYield(asteriskTokenOrExpression, expression) { + var node = createSynthesizedNode(196); + node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 38 ? asteriskTokenOrExpression : undefined; + node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 38 ? asteriskTokenOrExpression : expression; return node; } ts.createYield = createYield; - function updateYield(node, expression) { - if (node.expression !== expression) { - return updateNode(createYield(node.asteriskToken, expression, node), node); - } - return node; + function updateYield(node, asteriskToken, expression) { + return node.expression !== expression + || node.asteriskToken !== asteriskToken + ? updateNode(createYield(asteriskToken, expression), node) + : node; } ts.updateYield = updateYield; - function createSpread(expression, location) { - var node = createNode(196, location); - node.expression = parenthesizeExpressionForList(expression); + function createSpread(expression) { + var node = createSynthesizedNode(197); + node.expression = ts.parenthesizeExpressionForList(expression); return node; } ts.createSpread = createSpread; function updateSpread(node, expression) { - if (node.expression !== expression) { - return updateNode(createSpread(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createSpread(expression), node) + : node; } ts.updateSpread = updateSpread; - function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197, location); + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(198); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassExpression = createClassExpression; function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { - if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassExpression = updateClassExpression; - function createOmittedExpression(location) { - var node = createNode(198, location); - return node; + function createOmittedExpression() { + return createSynthesizedNode(199); } ts.createOmittedExpression = createOmittedExpression; - function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199, location); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.expression = parenthesizeForAccess(expression); + function createExpressionWithTypeArguments(typeArguments, expression) { + var node = createSynthesizedNode(200); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); return node; } ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; function updateExpressionWithTypeArguments(node, typeArguments, expression) { - if (node.typeArguments !== typeArguments || node.expression !== expression) { - return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node); - } - return node; + return node.typeArguments !== typeArguments + || node.expression !== expression + ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) + : node; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; - function createTemplateSpan(expression, literal, location) { - var node = createNode(202, location); + function createAsExpression(expression, type) { + var node = createSynthesizedNode(201); + node.expression = expression; + node.type = type; + return node; + } + ts.createAsExpression = createAsExpression; + function updateAsExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? updateNode(createAsExpression(expression, type), node) + : node; + } + ts.updateAsExpression = updateAsExpression; + function createNonNullExpression(expression) { + var node = createSynthesizedNode(202); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createNonNullExpression = createNonNullExpression; + function updateNonNullExpression(node, expression) { + return node.expression !== expression + ? updateNode(createNonNullExpression(expression), node) + : node; + } + ts.updateNonNullExpression = updateNonNullExpression; + function createTemplateSpan(expression, literal) { + var node = createSynthesizedNode(204); node.expression = expression; node.literal = literal; return node; } ts.createTemplateSpan = createTemplateSpan; function updateTemplateSpan(node, expression, literal) { - if (node.expression !== expression || node.literal !== literal) { - return updateNode(createTemplateSpan(expression, literal, node), node); - } - return node; + return node.expression !== expression + || node.literal !== literal + ? updateNode(createTemplateSpan(expression, literal), node) + : node; } ts.updateTemplateSpan = updateTemplateSpan; - function createBlock(statements, location, multiLine, flags) { - var block = createNode(204, location, flags); + function createBlock(statements, multiLine) { + var block = createSynthesizedNode(206); block.statements = createNodeArray(statements); - if (multiLine) { - block.multiLine = true; - } + if (multiLine) + block.multiLine = multiLine; return block; } ts.createBlock = createBlock; function updateBlock(node, statements) { - if (statements !== node.statements) { - return updateNode(createBlock(statements, node, node.multiLine, node.flags), node); - } - return node; + return statements !== node.statements + ? updateNode(createBlock(statements, node.multiLine), node) + : node; } ts.updateBlock = updateBlock; - function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205, location, flags); + function createVariableStatement(modifiers, declarationList) { + var node = createSynthesizedNode(207); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; return node; } ts.createVariableStatement = createVariableStatement; function updateVariableStatement(node, modifiers, declarationList) { - if (node.modifiers !== modifiers || node.declarationList !== declarationList) { - return updateNode(createVariableStatement(modifiers, declarationList, node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.declarationList !== declarationList + ? updateNode(createVariableStatement(modifiers, declarationList), node) + : node; } ts.updateVariableStatement = updateVariableStatement; - function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224, location, flags); + function createVariableDeclarationList(declarations, flags) { + var node = createSynthesizedNode(226); + node.flags |= flags; node.declarations = createNodeArray(declarations); return node; } ts.createVariableDeclarationList = createVariableDeclarationList; function updateVariableDeclarationList(node, declarations) { - if (node.declarations !== declarations) { - return updateNode(createVariableDeclarationList(declarations, node, node.flags), node); - } - return node; + return node.declarations !== declarations + ? updateNode(createVariableDeclarationList(declarations, node.flags), node) + : node; } ts.updateVariableDeclarationList = updateVariableDeclarationList; - function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223, location, flags); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createVariableDeclaration(name, type, initializer) { + var node = createSynthesizedNode(225); + node.name = asName(name); node.type = type; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createVariableDeclaration = createVariableDeclaration; function updateVariableDeclaration(node, name, type, initializer) { - if (node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createVariableDeclaration(name, type, initializer, node, node.flags), node); - } - return node; + return node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createVariableDeclaration(name, type, initializer), node) + : node; } ts.updateVariableDeclaration = updateVariableDeclaration; - function createEmptyStatement(location) { - return createNode(206, location); + function createEmptyStatement() { + return createSynthesizedNode(208); } ts.createEmptyStatement = createEmptyStatement; - function createStatement(expression, location, flags) { - var node = createNode(207, location, flags); - node.expression = parenthesizeExpressionForExpressionStatement(expression); + function createStatement(expression) { + var node = createSynthesizedNode(209); + node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } ts.createStatement = createStatement; function updateStatement(node, expression) { - if (node.expression !== expression) { - return updateNode(createStatement(expression, node, node.flags), node); - } - return node; + return node.expression !== expression + ? updateNode(createStatement(expression), node) + : node; } ts.updateStatement = updateStatement; - function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208, location); + function createIf(expression, thenStatement, elseStatement) { + var node = createSynthesizedNode(210); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11354,42 +12905,43 @@ var ts; } ts.createIf = createIf; function updateIf(node, expression, thenStatement, elseStatement) { - if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) { - return updateNode(createIf(expression, thenStatement, elseStatement, node), node); - } - return node; + return node.expression !== expression + || node.thenStatement !== thenStatement + || node.elseStatement !== elseStatement + ? updateNode(createIf(expression, thenStatement, elseStatement), node) + : node; } ts.updateIf = updateIf; - function createDo(statement, expression, location) { - var node = createNode(209, location); + function createDo(statement, expression) { + var node = createSynthesizedNode(211); node.statement = statement; node.expression = expression; return node; } ts.createDo = createDo; function updateDo(node, statement, expression) { - if (node.statement !== statement || node.expression !== expression) { - return updateNode(createDo(statement, expression, node), node); - } - return node; + return node.statement !== statement + || node.expression !== expression + ? updateNode(createDo(statement, expression), node) + : node; } ts.updateDo = updateDo; - function createWhile(expression, statement, location) { - var node = createNode(210, location); + function createWhile(expression, statement) { + var node = createSynthesizedNode(212); node.expression = expression; node.statement = statement; return node; } ts.createWhile = createWhile; function updateWhile(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWhile(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWhile(expression, statement), node) + : node; } ts.updateWhile = updateWhile; - function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211, location, undefined); + function createFor(initializer, condition, incrementor, statement) { + var node = createSynthesizedNode(213); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11398,14 +12950,16 @@ var ts; } ts.createFor = createFor; function updateFor(node, initializer, condition, incrementor, statement) { - if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) { - return updateNode(createFor(initializer, condition, incrementor, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.condition !== condition + || node.incrementor !== incrementor + || node.statement !== statement + ? updateNode(createFor(initializer, condition, incrementor, statement), node) + : node; } ts.updateFor = updateFor; - function createForIn(initializer, expression, statement, location) { - var node = createNode(212, location); + function createForIn(initializer, expression, statement) { + var node = createSynthesizedNode(214); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11413,127 +12967,123 @@ var ts; } ts.createForIn = createForIn; function updateForIn(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForIn(initializer, expression, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForIn(initializer, expression, statement), node) + : node; } ts.updateForIn = updateForIn; - function createForOf(initializer, expression, statement, location) { - var node = createNode(213, location); + function createForOf(awaitModifier, initializer, expression, statement) { + var node = createSynthesizedNode(215); + node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; node.statement = statement; return node; } ts.createForOf = createForOf; - function updateForOf(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForOf(initializer, expression, statement, node), node); - } - return node; + function updateForOf(node, awaitModifier, initializer, expression, statement) { + return node.awaitModifier !== awaitModifier + || node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) + : node; } ts.updateForOf = updateForOf; - function createContinue(label, location) { - var node = createNode(214, location); - if (label) { - node.label = label; - } + function createContinue(label) { + var node = createSynthesizedNode(216); + node.label = asName(label); return node; } ts.createContinue = createContinue; function updateContinue(node, label) { - if (node.label !== label) { - return updateNode(createContinue(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createContinue(label), node) + : node; } ts.updateContinue = updateContinue; - function createBreak(label, location) { - var node = createNode(215, location); - if (label) { - node.label = label; - } + function createBreak(label) { + var node = createSynthesizedNode(217); + node.label = asName(label); return node; } ts.createBreak = createBreak; function updateBreak(node, label) { - if (node.label !== label) { - return updateNode(createBreak(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createBreak(label), node) + : node; } ts.updateBreak = updateBreak; - function createReturn(expression, location) { - var node = createNode(216, location); + function createReturn(expression) { + var node = createSynthesizedNode(218); node.expression = expression; return node; } ts.createReturn = createReturn; function updateReturn(node, expression) { - if (node.expression !== expression) { - return updateNode(createReturn(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createReturn(expression), node) + : node; } ts.updateReturn = updateReturn; - function createWith(expression, statement, location) { - var node = createNode(217, location); + function createWith(expression, statement) { + var node = createSynthesizedNode(219); node.expression = expression; node.statement = statement; return node; } ts.createWith = createWith; function updateWith(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWith(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWith(expression, statement), node) + : node; } ts.updateWith = updateWith; - function createSwitch(expression, caseBlock, location) { - var node = createNode(218, location); - node.expression = parenthesizeExpressionForList(expression); + function createSwitch(expression, caseBlock) { + var node = createSynthesizedNode(220); + node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; } ts.createSwitch = createSwitch; function updateSwitch(node, expression, caseBlock) { - if (node.expression !== expression || node.caseBlock !== caseBlock) { - return updateNode(createSwitch(expression, caseBlock, node), node); - } - return node; + return node.expression !== expression + || node.caseBlock !== caseBlock + ? updateNode(createSwitch(expression, caseBlock), node) + : node; } ts.updateSwitch = updateSwitch; - function createLabel(label, statement, location) { - var node = createNode(219, location); - node.label = typeof label === "string" ? createIdentifier(label) : label; + function createLabel(label, statement) { + var node = createSynthesizedNode(221); + node.label = asName(label); node.statement = statement; return node; } ts.createLabel = createLabel; function updateLabel(node, label, statement) { - if (node.label !== label || node.statement !== statement) { - return updateNode(createLabel(label, statement, node), node); - } - return node; + return node.label !== label + || node.statement !== statement + ? updateNode(createLabel(label, statement), node) + : node; } ts.updateLabel = updateLabel; - function createThrow(expression, location) { - var node = createNode(220, location); + function createThrow(expression) { + var node = createSynthesizedNode(222); node.expression = expression; return node; } ts.createThrow = createThrow; function updateThrow(node, expression) { - if (node.expression !== expression) { - return updateNode(createThrow(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createThrow(expression), node) + : node; } ts.updateThrow = updateThrow; - function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221, location); + function createTry(tryBlock, catchClause, finallyBlock) { + var node = createSynthesizedNode(223); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11541,194 +13091,284 @@ var ts; } ts.createTry = createTry; function updateTry(node, tryBlock, catchClause, finallyBlock) { - if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) { - return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node); - } - return node; + return node.tryBlock !== tryBlock + || node.catchClause !== catchClause + || node.finallyBlock !== finallyBlock + ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) + : node; } ts.updateTry = updateTry; - function createCaseBlock(clauses, location) { - var node = createNode(232, location); - node.clauses = createNodeArray(clauses); - return node; - } - ts.createCaseBlock = createCaseBlock; - function updateCaseBlock(node, clauses) { - if (node.clauses !== clauses) { - return updateNode(createCaseBlock(clauses, node), node); - } - return node; - } - ts.updateCaseBlock = updateCaseBlock; - function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(227); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionDeclaration = createFunctionDeclaration; - function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, node, node.flags), node); - } - return node; + function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionDeclaration = updateFunctionDeclaration; - function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(228); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassDeclaration = createClassDeclaration; function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassDeclaration = updateClassDeclaration; - function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createEnumDeclaration(decorators, modifiers, name, members) { + var node = createSynthesizedNode(231); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.members = createNodeArray(members); + return node; + } + ts.createEnumDeclaration = createEnumDeclaration; + function updateEnumDeclaration(node, decorators, modifiers, name, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.members !== members + ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) + : node; + } + ts.updateEnumDeclaration = updateEnumDeclaration; + function createModuleDeclaration(decorators, modifiers, name, body, flags) { + var node = createSynthesizedNode(232); + node.flags |= flags; + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = name; + node.body = body; + return node; + } + ts.createModuleDeclaration = createModuleDeclaration; + function updateModuleDeclaration(node, decorators, modifiers, name, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.body !== body + ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) + : node; + } + ts.updateModuleDeclaration = updateModuleDeclaration; + function createModuleBlock(statements) { + var node = createSynthesizedNode(233); + node.statements = createNodeArray(statements); + return node; + } + ts.createModuleBlock = createModuleBlock; + function updateModuleBlock(node, statements) { + return node.statements !== statements + ? updateNode(createModuleBlock(statements), node) + : node; + } + ts.updateModuleBlock = updateModuleBlock; + function createCaseBlock(clauses) { + var node = createSynthesizedNode(234); + node.clauses = createNodeArray(clauses); + return node; + } + ts.createCaseBlock = createCaseBlock; + function updateCaseBlock(node, clauses) { + return node.clauses !== clauses + ? updateNode(createCaseBlock(clauses), node) + : node; + } + ts.updateCaseBlock = updateCaseBlock; + function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { + var node = createSynthesizedNode(236); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.moduleReference = moduleReference; + return node; + } + ts.createImportEqualsDeclaration = createImportEqualsDeclaration; + function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.moduleReference !== moduleReference + ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) + : node; + } + ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; + function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { + var node = createSynthesizedNode(237); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createImportDeclaration = createImportDeclaration; function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) + : node; } ts.updateImportDeclaration = updateImportDeclaration; - function createImportClause(name, namedBindings, location) { - var node = createNode(236, location); + function createImportClause(name, namedBindings) { + var node = createSynthesizedNode(238); node.name = name; node.namedBindings = namedBindings; return node; } ts.createImportClause = createImportClause; function updateImportClause(node, name, namedBindings) { - if (node.name !== name || node.namedBindings !== namedBindings) { - return updateNode(createImportClause(name, namedBindings, node), node); - } - return node; + return node.name !== name + || node.namedBindings !== namedBindings + ? updateNode(createImportClause(name, namedBindings), node) + : node; } ts.updateImportClause = updateImportClause; - function createNamespaceImport(name, location) { - var node = createNode(237, location); + function createNamespaceImport(name) { + var node = createSynthesizedNode(239); node.name = name; return node; } ts.createNamespaceImport = createNamespaceImport; function updateNamespaceImport(node, name) { - if (node.name !== name) { - return updateNode(createNamespaceImport(name, node), node); - } - return node; + return node.name !== name + ? updateNode(createNamespaceImport(name), node) + : node; } ts.updateNamespaceImport = updateNamespaceImport; - function createNamedImports(elements, location) { - var node = createNode(238, location); + function createNamedImports(elements) { + var node = createSynthesizedNode(240); node.elements = createNodeArray(elements); return node; } ts.createNamedImports = createNamedImports; function updateNamedImports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedImports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedImports(elements), node) + : node; } ts.updateNamedImports = updateNamedImports; - function createImportSpecifier(propertyName, name, location) { - var node = createNode(239, location); + function createImportSpecifier(propertyName, name) { + var node = createSynthesizedNode(241); node.propertyName = propertyName; node.name = name; return node; } ts.createImportSpecifier = createImportSpecifier; function updateImportSpecifier(node, propertyName, name) { - if (node.propertyName !== propertyName || node.name !== name) { - return updateNode(createImportSpecifier(propertyName, name, node), node); - } - return node; + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createImportSpecifier(propertyName, name), node) + : node; } ts.updateImportSpecifier = updateImportSpecifier; - function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportAssignment(decorators, modifiers, isExportEquals, expression) { + var node = createSynthesizedNode(242); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = expression; return node; } ts.createExportAssignment = createExportAssignment; function updateExportAssignment(node, decorators, modifiers, expression) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) { - return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.expression !== expression + ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) + : node; } ts.updateExportAssignment = updateExportAssignment; - function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { + var node = createSynthesizedNode(243); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createExportDeclaration = createExportDeclaration; function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.exportClause !== exportClause + || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) + : node; } ts.updateExportDeclaration = updateExportDeclaration; - function createNamedExports(elements, location) { - var node = createNode(242, location); + function createNamedExports(elements) { + var node = createSynthesizedNode(244); node.elements = createNodeArray(elements); return node; } ts.createNamedExports = createNamedExports; function updateNamedExports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedExports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedExports(elements), node) + : node; } ts.updateNamedExports = updateNamedExports; - function createExportSpecifier(name, propertyName, location) { - var node = createNode(243, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createExportSpecifier(propertyName, name) { + var node = createSynthesizedNode(245); + node.propertyName = asName(propertyName); + node.name = asName(name); return node; } ts.createExportSpecifier = createExportSpecifier; - function updateExportSpecifier(node, name, propertyName) { - if (node.name !== name || node.propertyName !== propertyName) { - return updateNode(createExportSpecifier(name, propertyName, node), node); - } - return node; + function updateExportSpecifier(node, propertyName, name) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createExportSpecifier(propertyName, name), node) + : node; } ts.updateExportSpecifier = updateExportSpecifier; - function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246, location); + function createExternalModuleReference(expression) { + var node = createSynthesizedNode(247); + node.expression = expression; + return node; + } + ts.createExternalModuleReference = createExternalModuleReference; + function updateExternalModuleReference(node, expression) { + return node.expression !== expression + ? updateNode(createExternalModuleReference(expression), node) + : node; + } + ts.updateExternalModuleReference = updateExternalModuleReference; + function createJsxElement(openingElement, children, closingElement) { + var node = createSynthesizedNode(248); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11736,95 +13376,107 @@ var ts; } ts.createJsxElement = createJsxElement; function updateJsxElement(node, openingElement, children, closingElement) { - if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) { - return updateNode(createJsxElement(openingElement, children, closingElement, node), node); - } - return node; + return node.openingElement !== openingElement + || node.children !== children + || node.closingElement !== closingElement + ? updateNode(createJsxElement(openingElement, children, closingElement), node) + : node; } ts.updateJsxElement = updateJsxElement; - function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247, location); + function createJsxSelfClosingElement(tagName, attributes) { + var node = createSynthesizedNode(249); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxSelfClosingElement = createJsxSelfClosingElement; function updateJsxSelfClosingElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxSelfClosingElement(tagName, attributes), node) + : node; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; - function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248, location); + function createJsxOpeningElement(tagName, attributes) { + var node = createSynthesizedNode(250); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxOpeningElement = createJsxOpeningElement; function updateJsxOpeningElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxOpeningElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxOpeningElement(tagName, attributes), node) + : node; } ts.updateJsxOpeningElement = updateJsxOpeningElement; - function createJsxClosingElement(tagName, location) { - var node = createNode(249, location); + function createJsxClosingElement(tagName) { + var node = createSynthesizedNode(251); node.tagName = tagName; return node; } ts.createJsxClosingElement = createJsxClosingElement; function updateJsxClosingElement(node, tagName) { - if (node.tagName !== tagName) { - return updateNode(createJsxClosingElement(tagName, node), node); - } - return node; + return node.tagName !== tagName + ? updateNode(createJsxClosingElement(tagName), node) + : node; } ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer, location) { - var node = createNode(250, location); + function createJsxAttributes(properties) { + var jsxAttributes = createSynthesizedNode(253); + jsxAttributes.properties = createNodeArray(properties); + return jsxAttributes; + } + ts.createJsxAttributes = createJsxAttributes; + function updateJsxAttributes(jsxAttributes, properties) { + if (jsxAttributes.properties !== properties) { + return updateNode(createJsxAttributes(properties), jsxAttributes); + } + return jsxAttributes; + } + ts.updateJsxAttributes = updateJsxAttributes; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(252); node.name = name; node.initializer = initializer; return node; } ts.createJsxAttribute = createJsxAttribute; function updateJsxAttribute(node, name, initializer) { - if (node.name !== name || node.initializer !== initializer) { - return updateNode(createJsxAttribute(name, initializer, node), node); - } - return node; + return node.name !== name + || node.initializer !== initializer + ? updateNode(createJsxAttribute(name, initializer), node) + : node; } ts.updateJsxAttribute = updateJsxAttribute; - function createJsxSpreadAttribute(expression, location) { - var node = createNode(251, location); + function createJsxSpreadAttribute(expression) { + var node = createSynthesizedNode(254); node.expression = expression; return node; } ts.createJsxSpreadAttribute = createJsxSpreadAttribute; function updateJsxSpreadAttribute(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxSpreadAttribute(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxSpreadAttribute(expression), node) + : node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252, location); + function createJsxExpression(dotDotDotToken, expression) { + var node = createSynthesizedNode(255); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) + : node; } ts.updateJsxExpression = updateJsxExpression; - function createHeritageClause(token, types, location) { - var node = createNode(255, location); + function createHeritageClause(token, types) { + var node = createSynthesizedNode(258); node.token = token; node.types = createNodeArray(types); return node; @@ -11832,40 +13484,40 @@ var ts; ts.createHeritageClause = createHeritageClause; function updateHeritageClause(node, types) { if (node.types !== types) { - return updateNode(createHeritageClause(node.token, types, node), node); + return updateNode(createHeritageClause(node.token, types), node); } return node; } ts.updateHeritageClause = updateHeritageClause; - function createCaseClause(expression, statements, location) { - var node = createNode(253, location); - node.expression = parenthesizeExpressionForList(expression); + function createCaseClause(expression, statements) { + var node = createSynthesizedNode(256); + node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; } ts.createCaseClause = createCaseClause; function updateCaseClause(node, expression, statements) { if (node.expression !== expression || node.statements !== statements) { - return updateNode(createCaseClause(expression, statements, node), node); + return updateNode(createCaseClause(expression, statements), node); } return node; } ts.updateCaseClause = updateCaseClause; - function createDefaultClause(statements, location) { - var node = createNode(254, location); + function createDefaultClause(statements) { + var node = createSynthesizedNode(257); node.statements = createNodeArray(statements); return node; } ts.createDefaultClause = createDefaultClause; function updateDefaultClause(node, statements) { if (node.statements !== statements) { - return updateNode(createDefaultClause(statements, node), node); + return updateNode(createDefaultClause(statements), node); } return node; } ts.updateDefaultClause = updateDefaultClause; - function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256, location); + function createCatchClause(variableDeclaration, block) { + var node = createSynthesizedNode(259); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11873,56 +13525,71 @@ var ts; ts.createCatchClause = createCatchClause; function updateCatchClause(node, variableDeclaration, block) { if (node.variableDeclaration !== variableDeclaration || node.block !== block) { - return updateNode(createCatchClause(variableDeclaration, block, node), node); + return updateNode(createCatchClause(variableDeclaration, block), node); } return node; } ts.updateCatchClause = updateCatchClause; - function createPropertyAssignment(name, initializer, location) { - var node = createNode(257, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAssignment(name, initializer) { + var node = createSynthesizedNode(260); + node.name = asName(name); node.questionToken = undefined; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createPropertyAssignment = createPropertyAssignment; function updatePropertyAssignment(node, name, initializer) { if (node.name !== name || node.initializer !== initializer) { - return updateNode(createPropertyAssignment(name, initializer, node), node); + return updateNode(createPropertyAssignment(name, initializer), node); } return node; } ts.updatePropertyAssignment = updatePropertyAssignment; - function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; + function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { + var node = createSynthesizedNode(261); + node.name = asName(name); + node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; - function createSpreadAssignment(expression, location) { - var node = createNode(259, location); - node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; - return node; - } - ts.createSpreadAssignment = createSpreadAssignment; function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) { - return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node); + return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node); } return node; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; + function createSpreadAssignment(expression) { + var node = createSynthesizedNode(262); + node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; + return node; + } + ts.createSpreadAssignment = createSpreadAssignment; function updateSpreadAssignment(node, expression) { if (node.expression !== expression) { - return updateNode(createSpreadAssignment(expression, node), node); + return updateNode(createSpreadAssignment(expression), node); } return node; } ts.updateSpreadAssignment = updateSpreadAssignment; + function createEnumMember(name, initializer) { + var node = createSynthesizedNode(263); + node.name = asName(name); + node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); + return node; + } + ts.createEnumMember = createEnumMember; + function updateEnumMember(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createEnumMember(name, initializer), node) + : node; + } + ts.updateEnumMember = updateEnumMember; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261, node, node.flags); + var updated = createSynthesizedNode(264); + updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -11981,56 +13648,73 @@ var ts; return node; } ts.updateSourceFileNode = updateSourceFileNode; + function getMutableClone(node) { + var clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + clone.parent = node.parent; + return clone; + } + ts.getMutableClone = getMutableClone; function createNotEmittedStatement(original) { - var node = createNode(293, original); + var node = createSynthesizedNode(294); node.original = original; + setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(296); + var node = createSynthesizedNode(297); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(295); + var node = createSynthesizedNode(296); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; - function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294, location || original); + function createPartiallyEmittedExpression(expression, original) { + var node = createSynthesizedNode(295); node.expression = expression; node.original = original; + setTextRange(node, original); return node; } ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; function updatePartiallyEmittedExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node); + return updateNode(createPartiallyEmittedExpression(expression, node.original), node); } return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - function createRawExpression(text) { - var node = createNode(297); - node.text = text; + function createBundle(sourceFiles) { + var node = ts.createNode(265); + node.sourceFiles = sourceFiles; return node; } - ts.createRawExpression = createRawExpression; + ts.createBundle = createBundle; + function updateBundle(node, sourceFiles) { + if (node.sourceFiles !== sourceFiles) { + return createBundle(sourceFiles); + } + return node; + } + ts.updateBundle = updateBundle; function createComma(left, right) { return createBinary(left, 25, right); } ts.createComma = createComma; - function createLessThan(left, right, location) { - return createBinary(left, 26, right, location); + function createLessThan(left, right) { + return createBinary(left, 26, right); } ts.createLessThan = createLessThan; - function createAssignment(left, right, location) { - return createBinary(left, 57, right, location); + function createAssignment(left, right) { + return createBinary(left, 57, right); } ts.createAssignment = createAssignment; function createStrictEquality(left, right) { @@ -12049,8 +13733,8 @@ var ts; return createBinary(left, 37, right); } ts.createSubtract = createSubtract; - function createPostfixIncrement(operand, location) { - return createPostfix(operand, 42, location); + function createPostfixIncrement(operand) { + return createPostfix(operand, 42); } ts.createPostfixIncrement = createPostfixIncrement; function createLogicalAnd(left, right) { @@ -12069,54 +13753,305 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createExportDefault(expression) { + return createExportAssignment(undefined, undefined, false, expression); + } + ts.createExportDefault = createExportDefault; + function createExternalModuleExport(exportName) { + return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(undefined, exportName)])); + } + ts.createExternalModuleExport = createExternalModuleExport; + function asName(name) { + return typeof name === "string" ? createIdentifier(name) : name; + } + function asExpression(value) { + return typeof value === "string" || typeof value === "number" ? createLiteral(value) : value; + } + function asNodeArray(array) { + return array ? createNodeArray(array) : undefined; + } + function asToken(value) { + return typeof value === "number" ? createToken(value) : value; + } + function disposeEmitNodes(sourceFile) { + sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); + var emitNode = sourceFile && sourceFile.emitNode; + var annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = undefined; + } + } + } + ts.disposeEmitNodes = disposeEmitNodes; + function getOrCreateEmitNode(node) { + if (!node.emitNode) { + if (ts.isParseTreeNode(node)) { + if (node.kind === 264) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = ts.getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } + return node.emitNode; + } + ts.getOrCreateEmitNode = getOrCreateEmitNode; + function setTextRange(range, location) { + if (location) { + range.pos = location.pos; + range.end = location.end; + } + return range; + } + ts.setTextRange = setTextRange; + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + ts.getEmitFlags = getEmitFlags; + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + ts.setEmitFlags = setEmitFlags; + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; + function setSourceMapRange(node, range) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + ts.setSourceMapRange = setSourceMapRange; + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; + function setTokenSourceMapRange(node, token, range) { + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); + tokenSourceMapRanges[token] = range; + return node; + } + ts.setTokenSourceMapRange = setTokenSourceMapRange; + function getCommentRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + ts.getCommentRange = getCommentRange; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + ts.setCommentRange = setCommentRange; + function getSyntheticLeadingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.leadingComments; + } + ts.getSyntheticLeadingComments = getSyntheticLeadingComments; + function setSyntheticLeadingComments(node, comments) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + ts.setSyntheticLeadingComments = setSyntheticLeadingComments; + function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticLeadingComment = addSyntheticLeadingComment; + function getSyntheticTrailingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.trailingComments; + } + ts.getSyntheticTrailingComments = getSyntheticTrailingComments; + function setSyntheticTrailingComments(node, comments) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + ts.setSyntheticTrailingComments = setSyntheticTrailingComments; + function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticTrailingComment = addSyntheticTrailingComment; + function getConstantValue(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + ts.getConstantValue = getConstantValue; + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + ts.setConstantValue = setConstantValue; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === undefined) + return 1; + if (y.priority === undefined) + return -1; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) + destEmitNode = {}; + if (leadingComments) + destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) + destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments); + if (flags) + destEmitNode.flags = flags; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) + destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); + return destEmitNode; + } + function mergeTokenSourceMapRanges(sourceRanges, destRanges) { + if (!destRanges) + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } + return destRanges; + } +})(ts || (ts = {})); +(function (ts) { function createTypeCheck(value, tag) { return tag === "undefined" - ? createStrictEquality(value, createVoidZero()) - : createStrictEquality(createTypeOf(value), createLiteral(tag)); + ? ts.createStrictEquality(value, ts.createVoidZero()) + : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)); } ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { - return createElementAccess(target, memberName.expression, location); + return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); } else { - var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 64; + var expression = ts.setTextRange(ts.isIdentifier(memberName) + ? ts.createPropertyAccess(target, memberName) + : ts.createElementAccess(target, memberName), memberName); + ts.getOrCreateEmitNode(expression).flags |= 64; return expression; } } ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; function createFunctionCall(func, thisArg, argumentsList, location) { - return createCall(createPropertyAccess(func, "call"), undefined, [ + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), undefined, [ thisArg - ].concat(argumentsList), location); + ].concat(argumentsList)), location); } ts.createFunctionCall = createFunctionCall; function createFunctionApply(func, thisArg, argumentsExpression, location) { - return createCall(createPropertyAccess(func, "apply"), undefined, [ + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), undefined, [ thisArg, argumentsExpression - ], location); + ]), location); } ts.createFunctionApply = createFunctionApply; function createArraySlice(array, start) { var argumentsList = []; if (start !== undefined) { - argumentsList.push(typeof start === "number" ? createLiteral(start) : start); + argumentsList.push(typeof start === "number" ? ts.createLiteral(start) : start); } - return createCall(createPropertyAccess(array, "slice"), undefined, argumentsList); + return ts.createCall(ts.createPropertyAccess(array, "slice"), undefined, argumentsList); } ts.createArraySlice = createArraySlice; function createArrayConcat(array, values) { - return createCall(createPropertyAccess(array, "concat"), undefined, values); + return ts.createCall(ts.createPropertyAccess(array, "concat"), undefined, values); } ts.createArrayConcat = createArrayConcat; function createMathPow(left, right, location) { - return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), undefined, [left, right], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), undefined, [left, right]), location); } ts.createMathPow = createMathPow; function createReactNamespace(reactNamespace, parent) { - var react = createIdentifier(reactNamespace || "React"); + var react = ts.createIdentifier(reactNamespace || "React"); react.flags &= ~8; react.parent = ts.getParseTreeNode(parent); return react; @@ -12124,9 +14059,9 @@ var ts; function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); - var right = createSynthesizedNode(70); + var right = ts.createIdentifier(jsxFactory.right.text); right.text = jsxFactory.right.text; - return createPropertyAccess(left, right); + return ts.createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12135,7 +14070,7 @@ var ts; function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : - createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); } function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { var argumentsList = [tagName]; @@ -12144,7 +14079,7 @@ var ts; } if (children && children.length > 0) { if (!props) { - argumentsList.push(createNull()); + argumentsList.push(ts.createNull()); } if (children.length > 1) { for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { @@ -12157,33 +14092,80 @@ var ts; argumentsList.push(children[0]); } } - return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList, location); + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; - function createExportDefault(expression) { - return createExportAssignment(undefined, undefined, false, expression); - } - ts.createExportDefault = createExportDefault; - function createExternalModuleExport(exportName) { - return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(exportName)])); + function getHelperName(name) { + return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2); } - ts.createExternalModuleExport = createExternalModuleExport; - function createLetStatement(name, initializer, location) { - return createVariableStatement(undefined, createLetDeclarationList([createVariableDeclaration(name, undefined, initializer)]), location); + ts.getHelperName = getHelperName; + var valuesHelper = { + name: "typescript:values", + scoped: false, + text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n " + }; + function createValuesHelper(context, expression, location) { + context.requestEmitHelper(valuesHelper); + return ts.setTextRange(ts.createCall(getHelperName("__values"), undefined, [expression]), location); } - ts.createLetStatement = createLetStatement; - function createLetDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 1); + ts.createValuesHelper = createValuesHelper; + var readHelper = { + name: "typescript:read", + scoped: false, + text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n " + }; + function createReadHelper(context, iteratorRecord, count, location) { + context.requestEmitHelper(readHelper); + return ts.setTextRange(ts.createCall(getHelperName("__read"), undefined, count !== undefined + ? [iteratorRecord, ts.createLiteral(count)] + : [iteratorRecord]), location); + } + ts.createReadHelper = createReadHelper; + var spreadHelper = { + name: "typescript:spread", + scoped: false, + text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" + }; + function createSpreadHelper(context, argumentList, location) { + context.requestEmitHelper(readHelper); + context.requestEmitHelper(spreadHelper); + return ts.setTextRange(ts.createCall(getHelperName("__spread"), undefined, argumentList), location); + } + ts.createSpreadHelper = createSpreadHelper; + function createForOfBindingStatement(node, boundValue) { + if (ts.isVariableDeclarationList(node)) { + var firstDeclaration = ts.firstOrUndefined(node.declarations); + var updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, undefined, boundValue); + return ts.setTextRange(ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(node, [updatedDeclaration])), node); + } + else { + var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), node); + return ts.setTextRange(ts.createStatement(updatedExpression), node); + } } - ts.createLetDeclarationList = createLetDeclarationList; - function createConstDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 2); + ts.createForOfBindingStatement = createForOfBindingStatement; + function insertLeadingStatement(dest, source) { + if (ts.isBlock(dest)) { + return ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)); + } + else { + return ts.createBlock(ts.createNodeArray([dest, source]), true); + } } - ts.createConstDeclarationList = createConstDeclarationList; - function getHelperName(name) { - return setEmitFlags(createIdentifier(name), 4096 | 2); + ts.insertLeadingStatement = insertLeadingStatement; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; } - ts.getHelperName = getHelperName; + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12193,13 +14175,13 @@ var ts; case 8: case 9: return false; - case 175: + case 176: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176: + case 177: return target.properties.length > 0; default: return true; @@ -12210,19 +14192,26 @@ var ts; var thisArg; var target; if (ts.isSuperProperty(callee)) { - thisArg = createThis(); + thisArg = ts.createThis(); target = callee; } else if (callee.kind === 96) { - thisArg = createThis(); - target = languageVersion < 2 ? createIdentifier("_super", callee) : callee; + thisArg = ts.createThis(); + target = languageVersion < 2 + ? ts.setTextRange(ts.createIdentifier("_super"), callee) + : callee; + } + else if (ts.getEmitFlags(callee) & 4096) { + thisArg = ts.createVoidZero(); + target = parenthesizeForAccess(callee); } else { switch (callee.kind) { - case 177: { + case 178: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = createTempVariable(recordTempVariable); - target = createPropertyAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.name, callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12230,10 +14219,11 @@ var ts; } break; } - case 178: { + case 179: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = createTempVariable(recordTempVariable); - target = createElementAccess(createAssignment(thisArg, callee.expression, callee.expression), callee.argumentExpression, callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12242,7 +14232,7 @@ var ts; break; } default: { - thisArg = createVoidZero(); + thisArg = ts.createVoidZero(); target = parenthesizeForAccess(expression); break; } @@ -12252,42 +14242,42 @@ var ts; } ts.createCallBinding = createCallBinding; function inlineExpressions(expressions) { - return ts.reduceLeft(expressions, createComma); + return ts.reduceLeft(expressions, ts.createComma); } ts.inlineExpressions = inlineExpressions; function createExpressionFromEntityName(node) { if (ts.isQualifiedName(node)) { var left = createExpressionFromEntityName(node.left); - var right = getMutableClone(node.right); - return createPropertyAccess(left, right, node); + var right = ts.getMutableClone(node.right); + return ts.setTextRange(ts.createPropertyAccess(left, right), node); } else { - return getMutableClone(node); + return ts.getMutableClone(node); } } ts.createExpressionFromEntityName = createExpressionFromEntityName; function createExpressionForPropertyName(memberName) { if (ts.isIdentifier(memberName)) { - return createLiteral(memberName, undefined); + return ts.createLiteral(memberName); } else if (ts.isComputedPropertyName(memberName)) { - return getMutableClone(memberName.expression); + return ts.getMutableClone(memberName.expression); } else { - return getMutableClone(memberName); + return ts.getMutableClone(memberName); } } ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151: case 152: + case 153: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257: + case 260: return createExpressionForPropertyAssignment(property, receiver); - case 258: + case 261: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149: + case 150: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12297,43 +14287,45 @@ var ts; if (property === firstAccessor) { var properties_1 = []; if (getAccessor) { - var getterFunction = createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body, getAccessor); - setOriginalNode(getterFunction, getAccessor); - var getter = createPropertyAssignment("get", getterFunction); + var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body); + ts.setTextRange(getterFunction, getAccessor); + ts.setOriginalNode(getterFunction, getAccessor); + var getter = ts.createPropertyAssignment("get", getterFunction); properties_1.push(getter); } if (setAccessor) { - var setterFunction = createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body, setAccessor); - setOriginalNode(setterFunction, setAccessor); - var setter = createPropertyAssignment("set", setterFunction); + var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body); + ts.setTextRange(setterFunction, setAccessor); + ts.setOriginalNode(setterFunction, setAccessor); + var setter = ts.createPropertyAssignment("set", setterFunction); properties_1.push(setter); } - properties_1.push(createPropertyAssignment("enumerable", createLiteral(true))); - properties_1.push(createPropertyAssignment("configurable", createLiteral(true))); - var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), undefined, [ + properties_1.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); + properties_1.push(ts.createPropertyAssignment("configurable", ts.createTrue())); + var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ receiver, createExpressionForPropertyName(property.name), - createObjectLiteral(properties_1, undefined, multiLine) - ], firstAccessor); + ts.createObjectLiteral(properties_1, multiLine) + ]), firstAccessor); return ts.aggregateTransformFlags(expression); } return undefined; } function createExpressionForPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer, property), property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer), property), property)); } function createExpressionForShorthandPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), getSynthesizedClone(property.name), property), property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), ts.getSynthesizedClone(property.name)), property), property)); } function createExpressionForMethodDeclaration(method, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body, method), method), method), method)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body), method), method)), method), method)); } function getLocalName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 16384); } ts.getLocalName = getLocalName; function isLocalName(node) { - return (getEmitFlags(node) & 16384) !== 0; + return (ts.getEmitFlags(node) & 16384) !== 0; } ts.isLocalName = isLocalName; function getExportName(node, allowComments, allowSourceMaps) { @@ -12341,7 +14333,7 @@ var ts; } ts.getExportName = getExportName; function isExportName(node) { - return (getEmitFlags(node) & 8192) !== 0; + return (ts.getEmitFlags(node) & 8192) !== 0; } ts.isExportName = isExportName; function getDeclarationName(node, allowComments, allowSourceMaps) { @@ -12350,17 +14342,17 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_10 = getMutableClone(node.name); - emitFlags |= getEmitFlags(node.name); + var name = ts.getMutableClone(node.name); + emitFlags |= ts.getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_10, emitFlags); - return name_10; + ts.setEmitFlags(name, emitFlags); + return name; } - return getGeneratedNameForNode(node); + return ts.getGeneratedNameForNode(node); } function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { if (ns && ts.hasModifier(node, 1)) { @@ -12370,25 +14362,31 @@ var ts; } ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName; function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { - var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), name); + var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); + ts.setTextRange(qualifiedName, name); var emitFlags; if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(qualifiedName, emitFlags); + ts.setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; function convertToFunctionBody(node, multiLine) { - return ts.isBlock(node) ? node : createBlock([createReturn(node, node)], node, multiLine); + return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node); } ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { return node.expression.text === "use strict"; } - function addPrologueDirectives(target, source, ensureUseStrict, visitor) { + function addPrologue(target, source, ensureUseStrict, visitor) { + var offset = addStandardPrologue(target, source, ensureUseStrict); + return addCustomPrologue(target, source, offset, visitor); + } + ts.addPrologue = addPrologue; + function addStandardPrologue(target, source, ensureUseStrict) { ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); var foundUseStrict = false; var statementOffset = 0; @@ -12407,11 +14405,16 @@ var ts; statementOffset++; } if (ensureUseStrict && !foundUseStrict) { - target.push(startOnNewLine(createStatement(createLiteral("use strict")))); + target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))); } + return statementOffset; + } + ts.addStandardPrologue = addStandardPrologue; + function addCustomPrologue(target, source, statementOffset, visitor) { + var numStatements = source.length; while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 524288) { + if (ts.getEmitFlags(statement) & 524288) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12421,7 +14424,7 @@ var ts; } return statementOffset; } - ts.addPrologueDirectives = addPrologueDirectives; + ts.addCustomPrologue = addCustomPrologue; function startsWithUseStrict(statements) { var firstStatement = ts.firstOrUndefined(statements); return firstStatement !== undefined @@ -12444,33 +14447,43 @@ var ts; } } if (!foundUseStrict) { - return createNodeArray([ - startOnNewLine(createStatement(createLiteral("use strict"))) - ].concat(statements), statements); + return ts.setTextRange(ts.createNodeArray([ + startOnNewLine(ts.createStatement(ts.createLiteral("use strict"))) + ].concat(statements)), statements); } return statements; } ts.ensureUseStrict = ensureUseStrict; + function parenthesizeConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { + return ts.createParen(condition); + } + return condition; + } + ts.parenthesizeConditionalHead = parenthesizeConditionalHead; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 183) { + if (skipped.kind === 184) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) - ? createParen(operand) + ? ts.createParen(operand) : operand; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 195) { + && operand.kind === 196) { return false; } return true; @@ -12509,7 +14522,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 && node.operatorToken.kind === 36) { + if (node.kind === 193 && node.operatorToken.kind === 36) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12524,29 +14537,30 @@ var ts; return 0; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193, 54); + var conditionalPrecedence = ts.getOperatorPrecedence(194, 54); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { - return createParen(condition); + return ts.createParen(condition); } return condition; } ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; function parenthesizeSubexpressionOfConditionalExpression(e) { - return e.kind === 192 && e.operatorToken.kind === 25 - ? createParen(e) + return e.kind === 193 && e.operatorToken.kind === 25 + ? ts.createParen(e) : e; } + ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179: - return createParen(expression); case 180: + return ts.createParen(expression); + case 181: return emittedExpression.arguments ? expression - : createParen(expression); + : ts.createParen(expression); } return parenthesizeForAccess(expression); } @@ -12554,23 +14568,22 @@ var ts; function parenthesizeForAccess(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 || emittedExpression.arguments) - && emittedExpression.kind !== 8) { + && (emittedExpression.kind !== 181 || emittedExpression.arguments)) { return expression; } - return createParen(expression, expression); + return ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeForAccess = parenthesizeForAccess; function parenthesizePostfixOperand(operand) { return ts.isLeftHandSideExpression(operand) ? operand - : createParen(operand, operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePostfixOperand = parenthesizePostfixOperand; function parenthesizePrefixOperand(operand) { return ts.isUnaryExpression(operand) ? operand - : createParen(operand, operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePrefixOperand = parenthesizePrefixOperand; function parenthesizeListElements(elements) { @@ -12585,17 +14598,18 @@ var ts; } } if (result !== undefined) { - return createNodeArray(result, elements, elements.hasTrailingComma); + return ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements); } return elements; } + ts.parenthesizeListElements = parenthesizeListElements; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192, 25); + var commaPrecedence = ts.getOperatorPrecedence(193, 25); return expressionPrecedence > commaPrecedence ? expression - : createParen(expression, expression); + : ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeExpressionForList = parenthesizeExpressionForList; function parenthesizeExpressionForExpressionStatement(expression) { @@ -12603,16 +14617,16 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 || kind === 185) { - var mutableCall = getMutableClone(emittedExpression); - mutableCall.expression = createParen(callee, callee); + if (kind === 185 || kind === 186) { + var mutableCall = ts.getMutableClone(emittedExpression); + mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); } } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 || leftmostExpressionKind === 184) { - return createParen(expression, expression); + if (leftmostExpressionKind === 177 || leftmostExpressionKind === 185) { + return ts.setTextRange(ts.createParen(expression), expression); } } return expression; @@ -12620,7 +14634,7 @@ var ts; ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement; function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) { if (ts.isPartiallyEmittedExpression(originalOuterExpression)) { - var clone_1 = getMutableClone(originalOuterExpression); + var clone_1 = ts.getMutableClone(originalOuterExpression); clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression); return clone_1; } @@ -12629,21 +14643,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191: + case 192: node = node.operand; continue; - case 192: + case 193: node = node.left; continue; - case 193: + case 194: node = node.condition; continue; + case 180: case 179: case 178: - case 177: node = node.expression; continue; - case 294: + case 295: node = node.expression; continue; } @@ -12651,13 +14665,19 @@ var ts; } } function parenthesizeConciseBody(body) { - var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176) { - return createParen(body, body); + if (!ts.isBlock(body) && getLeftmostExpression(body).kind === 177) { + return ts.setTextRange(ts.createParen(body), body); } return body; } ts.parenthesizeConciseBody = parenthesizeConciseBody; + var OuterExpressionKinds; + (function (OuterExpressionKinds) { + OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses"; + OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions"; + OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions"; + OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All"; + })(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {})); function skipOuterExpressions(node, kinds) { if (kinds === void 0) { kinds = 7; } var previousNode; @@ -12677,7 +14697,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183) { + while (node.kind === 184) { node = node.expression; } return node; @@ -12691,7 +14711,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294) { + while (node.kind === 295) { node = node.expression; } return node; @@ -12702,120 +14722,6 @@ var ts; return node; } ts.startOnNewLine = startOnNewLine; - function setOriginalNode(node, original) { - node.original = original; - if (original) { - var emitNode = original.emitNode; - if (emitNode) - node.emitNode = mergeEmitNode(emitNode, node.emitNode); - } - return node; - } - ts.setOriginalNode = setOriginalNode; - function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; - if (!destEmitNode) - destEmitNode = {}; - if (flags) - destEmitNode.flags = flags; - if (commentRange) - destEmitNode.commentRange = commentRange; - if (sourceMapRange) - destEmitNode.sourceMapRange = sourceMapRange; - if (tokenSourceMapRanges) - destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); - if (constantValue !== undefined) - destEmitNode.constantValue = constantValue; - if (helpers) - destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); - return destEmitNode; - } - function mergeTokenSourceMapRanges(sourceRanges, destRanges) { - if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); - return destRanges; - } - function disposeEmitNodes(sourceFile) { - sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); - var emitNode = sourceFile && sourceFile.emitNode; - var annotatedNodes = emitNode && emitNode.annotatedNodes; - if (annotatedNodes) { - for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { - var node = annotatedNodes_1[_i]; - node.emitNode = undefined; - } - } - } - ts.disposeEmitNodes = disposeEmitNodes; - function getOrCreateEmitNode(node) { - if (!node.emitNode) { - if (ts.isParseTreeNode(node)) { - if (node.kind === 261) { - return node.emitNode = { annotatedNodes: [node] }; - } - var sourceFile = ts.getSourceFileOfNode(node); - getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); - } - node.emitNode = {}; - } - return node.emitNode; - } - ts.getOrCreateEmitNode = getOrCreateEmitNode; - function getEmitFlags(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.flags; - } - ts.getEmitFlags = getEmitFlags; - function setEmitFlags(node, emitFlags) { - getOrCreateEmitNode(node).flags = emitFlags; - return node; - } - ts.setEmitFlags = setEmitFlags; - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; - } - ts.getSourceMapRange = getSourceMapRange; - function setSourceMapRange(node, range) { - getOrCreateEmitNode(node).sourceMapRange = range; - return node; - } - ts.setSourceMapRange = setSourceMapRange; - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; - function setTokenSourceMapRange(node, token, range) { - var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); - tokenSourceMapRanges[token] = range; - return node; - } - ts.setTokenSourceMapRange = setTokenSourceMapRange; - function getCommentRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.commentRange) || node; - } - ts.getCommentRange = getCommentRange; - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; - function getConstantValue(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.constantValue; - } - ts.getConstantValue = getConstantValue; - function setConstantValue(node, value) { - var emitNode = getOrCreateEmitNode(node); - emitNode.constantValue = value; - return node; - } - ts.setConstantValue = setConstantValue; function getExternalHelpersModuleName(node) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); var emitNode = parseNode && parseNode.emitNode; @@ -12828,125 +14734,31 @@ var ts; if (externalHelpersModuleName) { return externalHelpersModuleName; } - var helpers = getEmitHelpers(node); + var helpers = ts.getEmitHelpers(node); if (helpers) { - for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { - var helper = helpers_1[_i]; + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; if (!helper.scoped) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); - var emitNode = getOrCreateEmitNode(parseNode); - return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + var emitNode = ts.getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)); } } } } } ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; - function addEmitHelper(node, helper) { - var emitNode = getOrCreateEmitNode(node); - emitNode.helpers = ts.append(emitNode.helpers, helper); - return node; - } - ts.addEmitHelper = addEmitHelper; - function addEmitHelpers(node, helpers) { - if (ts.some(helpers)) { - var emitNode = getOrCreateEmitNode(node); - for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { - var helper = helpers_2[_i]; - if (!ts.contains(emitNode.helpers, helper)) { - emitNode.helpers = ts.append(emitNode.helpers, helper); - } - } - } - return node; - } - ts.addEmitHelpers = addEmitHelpers; - function removeEmitHelper(node, helper) { - var emitNode = node.emitNode; - if (emitNode) { - var helpers = emitNode.helpers; - if (helpers) { - return ts.orderedRemoveItem(helpers, helper); - } - } - return false; - } - ts.removeEmitHelper = removeEmitHelper; - function getEmitHelpers(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.helpers; - } - ts.getEmitHelpers = getEmitHelpers; - function moveEmitHelpers(source, target, predicate) { - var sourceEmitNode = source.emitNode; - var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; - if (!ts.some(sourceEmitHelpers)) - return; - var targetEmitNode = getOrCreateEmitNode(target); - var helpersRemoved = 0; - for (var i = 0; i < sourceEmitHelpers.length; i++) { - var helper = sourceEmitHelpers[i]; - if (predicate(helper)) { - helpersRemoved++; - if (!ts.contains(targetEmitNode.helpers, helper)) { - targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); - } - } - else if (helpersRemoved > 0) { - sourceEmitHelpers[i - helpersRemoved] = helper; - } - } - if (helpersRemoved > 0) { - sourceEmitHelpers.length -= helpersRemoved; - } - } - ts.moveEmitHelpers = moveEmitHelpers; - function compareEmitHelpers(x, y) { - if (x === y) - return 0; - if (x.priority === y.priority) - return 0; - if (x.priority === undefined) - return 1; - if (y.priority === undefined) - return -1; - return ts.compareValues(x.priority, y.priority); - } - ts.compareEmitHelpers = compareEmitHelpers; - function setTextRange(node, location) { - if (location) { - node.pos = location.pos; - node.end = location.end; - } - return node; - } - ts.setTextRange = setTextRange; - function setNodeFlags(node, flags) { - node.flags = flags; - return node; - } - ts.setNodeFlags = setNodeFlags; - function setMultiLine(node, multiLine) { - node.multiLine = multiLine; - return node; - } - ts.setMultiLine = setMultiLine; - function setHasTrailingComma(nodes, hasTrailingComma) { - nodes.hasTrailingComma = hasTrailingComma; - return nodes; - } - ts.setHasTrailingComma = setHasTrailingComma; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_11 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 && node.importClause) { - return getGeneratedNameForNode(node); + if (node.kind === 237 && node.importClause) { + return ts.getGeneratedNameForNode(node); } - if (node.kind === 241 && node.moduleSpecifier) { - return getGeneratedNameForNode(node); + if (node.kind === 243 && node.moduleSpecifier) { + return ts.getGeneratedNameForNode(node); } return undefined; } @@ -12956,26 +14768,24 @@ var ts; if (moduleName.kind === 9) { return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) || tryRenameExternalModule(moduleName, sourceFile) - || getSynthesizedClone(moduleName); + || ts.getSynthesizedClone(moduleName); } return undefined; } ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && ts.createLiteral(rename); } function tryGetModuleNameFromFile(file, host, options) { if (!file) { return undefined; } if (file.moduleName) { - return createLiteral(file.moduleName); + return ts.createLiteral(file.moduleName); } if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) { - return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); + return ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); } return undefined; } @@ -13009,11 +14819,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257: + case 260: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 258: + case 261: return bindingElement.name; - case 259: + case 262: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -13029,11 +14839,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144: - case 174: + case 145: + case 175: return bindingElement.dotDotDotToken; - case 196: - case 259: + case 197: + case 262: return bindingElement; } return undefined; @@ -13041,7 +14851,7 @@ var ts; ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174: + case 175: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13049,7 +14859,7 @@ var ts; : propertyName; } break; - case 257: + case 260: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13057,7 +14867,7 @@ var ts; : propertyName; } break; - case 259: + case 262: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -13071,11 +14881,11 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172: case 173: - case 175: - return name.elements; + case 174: case 176: + return name.elements; + case 177: return name.properties; } } @@ -13084,10 +14894,12 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpread(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); } var expression = convertToAssignmentElementTarget(element.name); - return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + return element.initializer + ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) + : expression; } ts.Debug.assertNode(element, ts.isExpression); return element; @@ -13097,14 +14909,14 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpreadAssignment(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); } if (element.propertyName) { var expression = convertToAssignmentElementTarget(element.name); - return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element); } ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element); } ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); return element; @@ -13112,18 +14924,18 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173: - case 175: - return convertToArrayAssignmentPattern(node); - case 172: + case 174: case 176: + return convertToArrayAssignmentPattern(node); + case 173: + case 177: return convertToObjectAssignmentPattern(node); } } ts.convertToAssignmentPattern = convertToAssignmentPattern; function convertToObjectAssignmentPattern(node) { if (ts.isObjectBindingPattern(node)) { - return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isObjectLiteralExpression); return node; @@ -13131,7 +14943,7 @@ var ts; ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; function convertToArrayAssignmentPattern(node) { if (ts.isArrayBindingPattern(node)) { - return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isArrayLiteralExpression); return node; @@ -13147,30 +14959,30 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; var exportEquals = undefined; var hasExportStarsToExportValues = false; var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); - var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration(undefined, undefined, createImportClause(undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); if (externalHelpersImportDeclaration) { externalImports.push(externalHelpersImportDeclaration); } for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235: + case 237: externalImports.push(node); break; - case 234: - if (node.moduleReference.kind === 245) { + case 236: + if (node.moduleReference.kind === 247) { externalImports.push(node); } break; - case 241: + case 243: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -13183,26 +14995,26 @@ var ts; else { for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_12 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_12.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_12) - || resolver.getReferencedValueDeclaration(name_12); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 240: + case 242: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 205: + case 207: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13210,38 +15022,38 @@ var ts; } } break; - case 225: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_13 = node.name; - if (!uniqueExports[name_13.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); - uniqueExports[name_13.text] = true; - exportedNames = ts.append(exportedNames, name_13); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 226: + case 228: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { - var name_14 = node.name; - if (!uniqueExports[name_14.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14); - uniqueExports[name_14.text] = true; - exportedNames = ts.append(exportedNames, name_14); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13261,13 +15073,23 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); var ts; (function (ts) { @@ -13276,13 +15098,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261) { + if (kind === 264) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141) { + else if (kind < 142) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13318,28 +15140,29 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141: + case 142: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143: + case 144: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 258: + case 261: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259: + case 262: return visitNode(cbNode, node.expression); - case 144: + case 145: + case 148: case 147: - case 146: - case 257: - case 223: - case 174: + case 260: + case 225: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -13348,24 +15171,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158: case 159: - case 153: + case 160: case 154: case 155: + case 156: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 225: + case 153: case 185: + case 227: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -13376,320 +15199,326 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157: + case 158: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156: + case 157: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160: - return visitNode(cbNode, node.exprName); case 161: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 162: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 163: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 164: + return visitNodes(cbNodes, node.elementTypes); case 165: - return visitNodes(cbNodes, node.types); case 166: - case 168: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); + case 167: case 169: + return visitNode(cbNode, node.type); + case 170: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170: + case 171: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171: - return visitNode(cbNode, node.literal); case 172: + return visitNode(cbNode, node.literal); case 173: - return visitNodes(cbNodes, node.elements); - case 175: + case 174: return visitNodes(cbNodes, node.elements); case 176: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 177: + return visitNodes(cbNodes, node.properties); + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178: + case 179: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179: case 180: + case 181: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181: + case 182: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182: + case 183: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.expression); - case 186: + case 184: return visitNode(cbNode, node.expression); case 187: return visitNode(cbNode, node.expression); case 188: return visitNode(cbNode, node.expression); - case 190: - return visitNode(cbNode, node.operand); - case 195: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 189: return visitNode(cbNode, node.expression); case 191: return visitNode(cbNode, node.operand); + case 196: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 190: + return visitNode(cbNode, node.expression); case 192: + return visitNode(cbNode, node.operand); + case 193: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200: + case 201: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201: + case 202: return visitNode(cbNode, node.expression); - case 193: + case 203: + return visitNode(cbNode, node.name); + case 194: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196: + case 197: return visitNode(cbNode, node.expression); - case 204: - case 231: + case 206: + case 233: return visitNodes(cbNodes, node.statements); - case 261: + case 264: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205: + case 207: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224: + case 226: return visitNodes(cbNodes, node.declarations); - case 207: + case 209: return visitNode(cbNode, node.expression); - case 208: + case 210: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209: + case 211: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210: + case 212: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 211: + case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 212: + case 214: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213: - return visitNode(cbNode, node.initializer) || + case 215: + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214: - case 215: - return visitNode(cbNode, node.label); case 216: - return visitNode(cbNode, node.expression); case 217: + return visitNode(cbNode, node.label); + case 218: + return visitNode(cbNode, node.expression); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218: + case 220: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232: + case 234: return visitNodes(cbNodes, node.clauses); - case 253: + case 256: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254: + case 257: return visitNodes(cbNodes, node.statements); - case 219: + case 221: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220: + case 222: return visitNode(cbNode, node.expression); - case 221: + case 223: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256: + case 259: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145: + case 146: return visitNode(cbNode, node.expression); - case 226: - case 197: + case 228: + case 198: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 227: + case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 228: + case 230: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 229: + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 260: + case 263: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 230: + case 232: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235: + case 237: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233: + case 235: return visitNode(cbNode, node.name); - case 237: + case 239: return visitNode(cbNode, node.name); - case 238: - case 242: + case 240: + case 244: return visitNodes(cbNodes, node.elements); - case 241: + case 243: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239: - case 243: + case 241: + case 245: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194: + case 195: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142: + case 143: return visitNode(cbNode, node.expression); - case 255: + case 258: return visitNodes(cbNodes, node.types); - case 199: + case 200: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245: + case 247: return visitNode(cbNode, node.expression); - case 244: - return visitNodes(cbNodes, node.decorators); case 246: + return visitNodes(cbNodes, node.decorators); + case 248: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247: - case 248: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNodes, node.attributes); + case 249: case 250: + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.attributes); + case 253: + return visitNodes(cbNodes, node.properties); + case 252: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251: - return visitNode(cbNode, node.expression); - case 252: + case 254: return visitNode(cbNode, node.expression); - case 249: + case 255: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 251: return visitNode(cbNode, node.tagName); - case 262: - return visitNode(cbNode, node.type); case 266: + return visitNode(cbNode, node.type); + case 270: return visitNodes(cbNodes, node.types); - case 267: + case 271: return visitNodes(cbNodes, node.types); - case 265: - return visitNode(cbNode, node.elementType); case 269: + return visitNode(cbNode, node.elementType); + case 273: return visitNode(cbNode, node.type); - case 268: + case 272: return visitNode(cbNode, node.type); - case 270: + case 274: return visitNode(cbNode, node.literal); - case 272: + case 276: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273: + case 277: return visitNode(cbNode, node.type); - case 274: + case 278: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275: + case 279: return visitNode(cbNode, node.type); - case 276: + case 280: return visitNode(cbNode, node.type); - case 277: + case 281: return visitNode(cbNode, node.type); - case 271: + case 275: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278: + case 282: return visitNodes(cbNodes, node.tags); - case 281: + case 285: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282: - return visitNode(cbNode, node.typeExpression); - case 283: + case 286: return visitNode(cbNode, node.typeExpression); - case 280: + case 287: return visitNode(cbNode, node.typeExpression); case 284: + return visitNode(cbNode, node.typeExpression); + case 288: return visitNodes(cbNodes, node.typeParameters); - case 285: + case 289: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287: + case 291: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286: + case 290: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294: + case 295: return visitNode(cbNode, node.expression); - case 288: + case 292: return visitNode(cbNode, node.literal); } } @@ -13730,7 +15559,7 @@ var ts; var Parser; (function (Parser) { var scanner = ts.createScanner(5, true); - var disallowInAndDecoratorContext = 65536 | 262144; + var disallowInAndDecoratorContext = 2048 | 8192; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -13778,7 +15607,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 || scriptKind === 2 ? 2097152 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -13853,7 +15682,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(261, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(264, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -13873,16 +15702,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536); + setContextFlag(val, 2048); } function setYieldContext(val) { - setContextFlag(val, 131072); + setContextFlag(val, 4096); } function setDecoratorContext(val) { - setContextFlag(val, 262144); + setContextFlag(val, 8192); } function setAwaitContext(val) { - setContextFlag(val, 524288); + setContextFlag(val, 16384); } function doOutsideOfContext(context, func) { var contextFlagsToClear = context & contextFlags; @@ -13905,40 +15734,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536, func); + return doOutsideOfContext(2048, func); } function disallowInAnd(func) { - return doInsideOfContext(65536, func); + return doInsideOfContext(2048, func); } function doInYieldContext(func) { - return doInsideOfContext(131072, func); + return doInsideOfContext(4096, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144, func); + return doInsideOfContext(8192, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288, func); + return doInsideOfContext(16384, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288, func); + return doOutsideOfContext(16384, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 | 524288, func); + return doInsideOfContext(4096 | 16384, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072); + return inContext(4096); } function inDisallowInContext() { - return inContext(65536); + return inContext(2048); } function inDecoratorContext() { - return inContext(262144); + return inContext(8192); } function inAwaitContext() { - return inContext(524288); + return inContext(16384); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14080,7 +15909,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 ? new NodeConstructor(kind, pos, pos) : kind === 70 ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -14100,7 +15929,7 @@ var ts; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576; + node.flags |= 32768; } return node; } @@ -14117,7 +15946,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; @@ -14162,7 +15995,7 @@ var ts; return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token()); } function parseComputedPropertyName() { - var node = createNode(142); + var node = createNode(143); parseExpected(20); node.expression = allowInAnd(parseExpression); parseExpected(21); @@ -14211,6 +16044,7 @@ var ts; function nextTokenIsClassOrFunctionOrAsync() { nextToken(); return token() === 74 || token() === 88 || + (token() === 116 && lookAhead(nextTokenIsClassKeywordOnSameLine)) || (token() === 119 && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } function isListElement(parsingContext, inErrorRecovery) { @@ -14418,7 +16252,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 3080192; + var nodeContextFlags = node.flags & 96256; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -14467,14 +16301,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150: - case 155: case 151: + case 156: case 152: - case 147: - case 203: + case 153: + case 148: + case 205: return true; - case 149: + case 150: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 70 && methodDeclaration.name.originalKeywordKind === 122; @@ -14486,8 +16320,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253: - case 254: + case 256: + case 257: return true; } } @@ -14496,65 +16330,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225: - case 205: - case 204: - case 208: + case 227: case 207: + case 206: + case 210: + case 209: + case 222: + case 218: case 220: + case 217: case 216: - case 218: - case 215: case 214: - case 212: + case 215: case 213: - case 211: - case 210: - case 217: - case 206: - case 221: + case 212: case 219: - case 209: - case 222: - case 235: - case 234: - case 241: - case 240: - case 230: - case 226: - case 227: - case 229: + case 208: + case 223: + case 221: + case 211: + case 224: + case 237: + case 236: + case 243: + case 242: + case 232: case 228: + case 229: + case 231: + case 230: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260; + return node.kind === 263; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154: - case 148: case 155: - case 146: - case 153: + case 149: + case 156: + case 147: + case 154: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223) { + if (node.kind !== 225) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144) { + if (node.kind !== 145) { return false; } var parameter = node; @@ -14599,7 +16433,6 @@ var ts; case 25: return ts.Diagnostics.Property_assignment_expected; } } - ; function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; @@ -14650,7 +16483,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22)) { - var node = createNode(141, entity.pos); + var node = createNode(142, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -14667,7 +16500,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194); + var template = createNode(195); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -14679,7 +16512,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202); + var span = createNode(204); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -14715,20 +16548,16 @@ var ts; if (scanner.isUnterminated()) { node.isUnterminated = true; } - var tokenPos = scanner.getTokenPos(); + if (node.kind === 8) { + node.numericLiteralFlags = scanner.getNumericLiteralFlags(); + } nextToken(); finishNode(node); - if (node.kind === 8 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.isOctalLiteral = true; - } return node; } function parseTypeReference() { - var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(157, typeName.pos); - node.typeName = typeName; + var node = createNode(158); + node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); } @@ -14736,24 +16565,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156, lhs.pos); + var node = createNode(157, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167); + var node = createNode(168); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160); + var node = createNode(161); parseExpected(102); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); if (parseOptional(84)) { if (isStartOfType() || !isStartOfExpression()) { @@ -14763,6 +16592,9 @@ var ts; node.expression = parseUnaryExpressionOrHigher(); } } + if (parseOptional(57)) { + node.default = parseType(); + } return finishNode(node); } function parseTypeParameters() { @@ -14780,9 +16612,9 @@ var ts; return token() === 23 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 || token() === 98; } function parseParameter() { - var node = createNode(144); + var node = createNode(145); if (token() === 98) { - node.name = createIdentifier(true, undefined); + node.name = createIdentifier(true); node.type = parseParameterType(); return finishNode(node); } @@ -14840,7 +16672,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154) { + if (kind === 155) { parseExpected(93); } fillSignature(55, false, false, false, node); @@ -14880,7 +16712,7 @@ var ts; return token() === 55 || token() === 25 || token() === 21; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155, fullStart); + var node = createNode(156, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16, parseParameter, 20, 21); @@ -14892,7 +16724,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54); if (token() === 18 || token() === 26) { - var method = createNode(148, fullStart); + var method = createNode(149, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -14901,7 +16733,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146, fullStart); + var property = createNode(147, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -14914,19 +16746,19 @@ var ts; } } function isTypeMemberStart() { - var idToken; if (token() === 18 || token() === 26) { return true; } + var idToken; while (ts.isModifierKind(token())) { - idToken = token(); + idToken = true; nextToken(); } if (token() === 20) { return true; } if (isLiteralPropertyName()) { - idToken = token(); + idToken = true; nextToken(); } if (idToken) { @@ -14941,10 +16773,10 @@ var ts; } function parseTypeMember() { if (token() === 18 || token() === 26) { - return parseSignatureMember(153); + return parseSignatureMember(154); } if (token() === 93 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154); + return parseSignatureMember(155); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -14958,7 +16790,7 @@ var ts; return token() === 18 || token() === 26; } function parseTypeLiteral() { - var node = createNode(161); + var node = createNode(162); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -14981,14 +16813,14 @@ var ts; return token() === 20 && nextTokenIsIdentifier() && nextToken() === 91; } function parseMappedTypeParameter() { - var node = createNode(143); + var node = createNode(144); node.name = parseIdentifier(); parseExpected(91); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170); + var node = createNode(171); parseExpected(16); node.readonlyToken = parseOptionalToken(130); parseExpected(20); @@ -15001,12 +16833,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163); + var node = createNode(164); node.elementTypes = parseBracketedList(20, parseType, 20, 21); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166); + var node = createNode(167); parseExpected(18); node.type = parseType(); parseExpected(19); @@ -15014,7 +16846,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159) { + if (kind === 160) { parseExpected(93); } fillSignature(35, false, false, false, node); @@ -15025,7 +16857,7 @@ var ts; return token() === 22 ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171); + var node = createNode(172); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -15036,12 +16868,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: - case 137: + case 136: + case 138: case 129: + case 133: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: @@ -15078,12 +16911,12 @@ var ts; function isStartOfType() { switch (token()) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: - case 137: + case 138: case 94: case 98: case 102: @@ -15091,11 +16924,14 @@ var ts; case 16: case 20: case 26: + case 48: + case 47: case 93: case 9: case 8: case 100: case 85: + case 133: return true; case 37: return lookAhead(nextTokenIsNumericLiteral); @@ -15113,14 +16949,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20)) { if (isStartOfType()) { - var node = createNode(169, type.pos); + var node = createNode(170, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21); type = finishNode(node); } else { - var node = createNode(162, type.pos); + var node = createNode(163, type.pos); node.elementType = type; parseExpected(21); type = finishNode(node); @@ -15129,7 +16965,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168); + var node = createNode(169); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -15143,6 +16979,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -15157,10 +16994,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165, parseTypeOperatorOrHigher, 47); + return parseUnionOrIntersectionType(166, parseTypeOperatorOrHigher, 47); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164, parseIntersectionTypeOrHigher, 48); + return parseUnionOrIntersectionType(165, parseIntersectionTypeOrHigher, 48); } function isStartOfFunctionType() { if (token() === 26) { @@ -15206,7 +17043,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156, typePredicateVariable.pos); + var node = createNode(157, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -15223,14 +17060,14 @@ var ts; } } function parseType() { - return doOutsideOfContext(655360, parseTypeWorker); + return doOutsideOfContext(20480, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158); + return parseFunctionOrConstructorType(159); } if (token() === 93) { - return parseFunctionOrConstructorType(159); + return parseFunctionOrConstructorType(160); } return parseUnionTypeOrHigher(); } @@ -15349,7 +17186,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195); + var node = createNode(196); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token() === 38 || isStartOfExpression())) { @@ -15365,13 +17202,13 @@ var ts; ts.Debug.assert(token() === 35, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185, asyncModifier.pos); + node = createNode(186, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185, identifier.pos); + node = createNode(186, identifier.pos); } - var parameter = createNode(144, identifier.pos); + var parameter = createNode(145, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -15505,7 +17342,7 @@ var ts; return 0; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185); + var node = createNode(186); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256); fillSignature(55, false, isAsync, !allowAmbiguity, node); @@ -15537,7 +17374,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(193, leftOperand.pos); + var node = createNode(194, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -15550,7 +17387,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 || t === 140; + return t === 91 || t === 141; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -15628,39 +17465,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192, left.pos); + var node = createNode(193, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200, left.pos); + var node = createNode(201, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186); + var node = createNode(187); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187); + var node = createNode(188); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15675,7 +17512,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189); + var node = createNode(190); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -15691,7 +17528,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182) { + if (simpleUnaryExpression.kind === 183) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -15744,7 +17581,7 @@ var ts; } function parseIncrementExpression() { if (token() === 42 || token() === 43) { - var node = createNode(190); + var node = createNode(191); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -15756,7 +17593,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 || token() === 43) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191, expression.pos); + var node = createNode(192, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -15779,7 +17616,7 @@ var ts; if (token() === 18 || token() === 22 || token() === 20) { return expression; } - var node = createNode(177, expression.pos); + var node = createNode(178, expression.pos); node.expression = expression; parseExpectedToken(22, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -15801,8 +17638,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248) { - var node = createNode(246, opening.pos); + if (opening.kind === 250) { + var node = createNode(248, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -15812,14 +17649,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247); + ts.Debug.assert(opening.kind === 249); result = opening; } if (inExpressionContext && token() === 26) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192, result.pos); + var badNode = createNode(193, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -15859,20 +17696,28 @@ var ts; parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } + else if (token() === 7) { + break; + } result.push(parseJsxChild()); } result.end = scanner.getTokenPos(); parsingContext = saveParsingContext; return result; } + function parseJsxAttributes() { + var jsxAttributes = createNode(253); + jsxAttributes.properties = parseList(13, parseJsxAttribute); + return finishNode(jsxAttributes); + } function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(26); var tagName = parseJsxElementName(); - var attributes = parseList(13, parseJsxAttribute); + var attributes = parseJsxAttributes(); var node; if (token() === 28) { - node = createNode(248, fullStart); + node = createNode(250, fullStart); scanJsxText(); } else { @@ -15884,7 +17729,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(247, fullStart); + node = createNode(249, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -15895,7 +17740,7 @@ var ts; var expression = token() === 98 ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22)) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -15903,9 +17748,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252); + var node = createNode(255); parseExpected(16); if (token() !== 17) { + node.dotDotDotToken = parseOptionalToken(23); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -15922,7 +17768,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250); + var node = createNode(252); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -15937,7 +17783,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251); + var node = createNode(254); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -15945,7 +17791,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249); + var node = createNode(251); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -15958,7 +17804,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182); + var node = createNode(183); parseExpected(26); node.type = parseType(); parseExpected(28); @@ -15969,7 +17815,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22); if (dotToken) { - var propertyAccess = createNode(177, expression.pos); + var propertyAccess = createNode(178, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); @@ -15977,13 +17823,13 @@ var ts; } if (token() === 50 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201, expression.pos); + var nonNullExpression = createNode(202, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } if (!inDecoratorContext() && parseOptional(20)) { - var indexedAccess = createNode(178, expression.pos); + var indexedAccess = createNode(179, expression.pos); indexedAccess.expression = expression; if (token() !== 21) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -15997,7 +17843,7 @@ var ts; continue; } if (token() === 12 || token() === 13) { - var tagExpression = createNode(181, expression.pos); + var tagExpression = createNode(182, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 ? parseLiteralNode() @@ -16016,7 +17862,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -16024,7 +17870,7 @@ var ts; continue; } else if (token() === 18) { - var callExpr = createNode(179, expression.pos); + var callExpr = createNode(180, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -16119,28 +17965,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183); + var node = createNode(184); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196); + var node = createNode(197); parseExpected(23); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 ? parseSpreadElement() : - token() === 25 ? createNode(198) : + token() === 25 ? createNode(199) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175); + var node = createNode(176); parseExpected(20); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16151,18 +17997,18 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124)) { - return parseAccessorDeclaration(151, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(133)) { return parseAccessorDeclaration(152, fullStart, decorators, modifiers); } + else if (parseContextualModifier(134)) { + return parseAccessorDeclaration(153, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(259, fullStart); + var spreadElement = createNode(262, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16181,7 +18027,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258, fullStart); + var shorthandDeclaration = createNode(261, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -16192,7 +18038,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257, fullStart); + var propertyAssignment = createNode(260, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16202,7 +18048,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(16); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16216,7 +18062,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(184); + var node = createNode(185); node.modifiers = parseModifiers(); parseExpected(88); node.asteriskToken = parseOptionalToken(38); @@ -16238,8 +18084,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180); + var fullStart = scanner.getStartPos(); parseExpected(93); + if (parseOptional(22)) { + var node_1 = createNode(203, fullStart); + node_1.keywordToken = 93; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(181, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -16248,7 +18101,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204); + var node = createNode(206); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16279,12 +18132,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206); + var node = createNode(208); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(208); + var node = createNode(210); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16294,7 +18147,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209); + var node = createNode(211); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -16305,7 +18158,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210); + var node = createNode(212); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16316,6 +18169,7 @@ var ts; function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(87); + var awaitToken = parseOptionalToken(120); parseExpected(18); var initializer = undefined; if (token() !== 24) { @@ -16327,22 +18181,23 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(91)) { - var forInStatement = createNode(212, pos); - forInStatement.initializer = initializer; - forInStatement.expression = allowInAnd(parseExpression); - parseExpected(19); - forOrForInOrForOfStatement = forInStatement; - } - else if (parseOptional(140)) { - var forOfStatement = createNode(213, pos); + if (awaitToken ? parseExpected(141) : parseOptional(141)) { + var forOfStatement = createNode(215, pos); + forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } + else if (parseOptional(91)) { + var forInStatement = createNode(214, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(19); + forOrForInOrForOfStatement = forInStatement; + } else { - var forStatement = createNode(211, pos); + var forStatement = createNode(213, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -16360,7 +18215,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 ? 71 : 76); + parseExpected(kind === 217 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -16368,7 +18223,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216); + var node = createNode(218); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -16377,7 +18232,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217); + var node = createNode(219); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16386,7 +18241,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253); + var node = createNode(256); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -16394,7 +18249,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254); + var node = createNode(257); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -16404,12 +18259,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218); + var node = createNode(220); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(232, scanner.getStartPos()); + var caseBlock = createNode(234, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -16417,14 +18272,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(220); + var node = createNode(222); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(221); + var node = createNode(223); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -16435,7 +18290,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256); + var result = createNode(259); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -16445,7 +18300,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222); + var node = createNode(224); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -16454,13 +18309,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(219, fullStart); + var labeledStatement = createNode(221, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207, fullStart); + var expressionStatement = createNode(209, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -16470,6 +18325,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak(); } + function nextTokenIsClassKeywordOnSameLine() { + nextToken(); + return token() === 74 && !scanner.hasPrecedingLineBreak(); + } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); return token() === 88 && !scanner.hasPrecedingLineBreak(); @@ -16489,7 +18348,7 @@ var ts; case 82: return true; case 108: - case 136: + case 137: return nextTokenIsIdentifierOnSameLine(); case 127: case 128: @@ -16506,7 +18365,7 @@ var ts; return false; } continue; - case 139: + case 140: nextToken(); return token() === 16 || token() === 70 || token() === 83; case 90: @@ -16566,8 +18425,8 @@ var ts; case 108: case 127: case 128: - case 136: - case 139: + case 137: + case 140: return true; case 113: case 111: @@ -16612,9 +18471,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(214); + return parseBreakOrContinueStatement(216); case 71: - return parseBreakOrContinueStatement(215); + return parseBreakOrContinueStatement(217); case 95: return parseReturnStatement(); case 106: @@ -16633,7 +18492,7 @@ var ts; return parseDeclaration(); case 119: case 108: - case 136: + case 137: case 127: case 128: case 123: @@ -16647,7 +18506,7 @@ var ts; case 116: case 114: case 130: - case 139: + case 140: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -16670,11 +18529,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136: + case 137: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139: + case 140: case 127: case 128: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -16693,7 +18552,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -16714,16 +18573,16 @@ var ts; } function parseArrayBindingElement() { if (token() === 25) { - return createNode(198); + return createNode(199); } - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174); + var node = createNode(175); node.dotDotDotToken = parseOptionalToken(23); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -16739,14 +18598,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172); + var node = createNode(173); parseExpected(16); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(17); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173); + var node = createNode(174); parseExpected(20); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(21); @@ -16765,7 +18624,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223); + var node = createNode(225); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -16774,7 +18633,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224); + var node = createNode(226); switch (token()) { case 103: break; @@ -16788,7 +18647,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token() === 140 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -16803,7 +18662,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(207, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -16811,7 +18670,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -16824,7 +18683,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150, pos); + var node = createNode(151, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122); @@ -16833,7 +18692,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149, fullStart); + var method = createNode(150, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -16846,7 +18705,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147, fullStart); + var property = createNode(148, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -16854,7 +18713,7 @@ var ts; property.type = parseTypeAnnotation(); property.initializer = ts.hasModifier(property, 32) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 | 65536, parseNonParameterInitializer); + : doOutsideOfContext(4096 | 2048, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -16916,7 +18775,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 133 || idToken === 124) { + if (!ts.isKeyword(idToken) || idToken === 134 || idToken === 124) { return true; } switch (token()) { @@ -16939,7 +18798,7 @@ var ts; if (!parseOptional(56)) { break; } - var decorator = createNode(145, decoratorStart); + var decorator = createNode(146, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -16996,7 +18855,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(203); + var result = createNode(205); nextToken(); return finishNode(result); } @@ -17021,16 +18880,16 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined); + var name = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 198); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -17064,9 +18923,10 @@ var ts; return undefined; } function parseHeritageClause() { - if (token() === 84 || token() === 107) { - var node = createNode(255); - node.token = token(); + var tok = token(); + if (tok === 84 || tok === 107) { + var node = createNode(258); + node.token = tok; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); return finishNode(node); @@ -17074,7 +18934,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199); + var node = createNode(200); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26) { node.typeArguments = parseBracketedList(19, parseType, 26, 28); @@ -17088,7 +18948,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -17099,10 +18959,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136); + parseExpected(137); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57); @@ -17111,13 +18971,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(260, scanner.getStartPos()); + var node = createNode(263, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -17132,7 +18992,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231, scanner.getStartPos()); + var node = createNode(233, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -17143,7 +19003,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230, fullStart); + var node = createNode(232, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -17155,10 +19015,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(232, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139) { + if (token() === 140) { node.name = parseIdentifier(); node.flags |= 512; } @@ -17175,7 +19035,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139) { + if (token() === 140) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(128)) { @@ -17200,7 +19060,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233, fullStart); + var exportDeclaration = createNode(235, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -17215,38 +19075,41 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(234, fullStart); - importEqualsDeclaration.decorators = decorators; - importEqualsDeclaration.modifiers = modifiers; - importEqualsDeclaration.name = identifier; - parseExpected(57); - importEqualsDeclaration.moduleReference = parseModuleReference(); - parseSemicolon(); - return addJSDocComment(finishNode(importEqualsDeclaration)); - } - } - var importDeclaration = createNode(235, fullStart); + if (token() !== 25 && token() !== 139) { + return parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier); + } + } + var importDeclaration = createNode(237, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || token() === 38 || token() === 16) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138); + parseExpected(139); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } + function parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier) { + var importEqualsDeclaration = createNode(236, fullStart); + importEqualsDeclaration.decorators = decorators; + importEqualsDeclaration.modifiers = modifiers; + importEqualsDeclaration.name = identifier; + parseExpected(57); + importEqualsDeclaration.moduleReference = parseModuleReference(); + parseSemicolon(); + return addJSDocComment(finishNode(importEqualsDeclaration)); + } function parseImportClause(identifier, fullStart) { - var importClause = createNode(236, fullStart); + var importClause = createNode(238, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(240); } return finishNode(importClause); } @@ -17256,7 +19119,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(245); + var node = createNode(247); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -17274,7 +19137,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(237); + var namespaceImport = createNode(239); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -17282,14 +19145,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 240 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243); + return parseImportOrExportSpecifier(245); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239); + return parseImportOrExportSpecifier(241); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -17308,23 +19171,23 @@ var ts; else { node.name = identifierName; } - if (kind === 239 && checkIdentifierIsKeyword) { + if (kind === 241 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(243, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { - parseExpected(138); + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242); - if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(138); + node.exportClause = parseNamedImportsOrExports(244); + if (token() === 139 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(139); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -17332,7 +19195,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -17351,6 +19214,7 @@ var ts; var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; + var checkJsDirective = undefined; while (true) { var kind = triviaScanner.scan(); if (kind !== 2) { @@ -17361,7 +19225,11 @@ var ts; break; } } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; + var range = { + kind: triviaScanner.getToken(), + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -17401,24 +19269,71 @@ var ts; amdDependencies.push(amdDependency); } } + var checkJsDirectiveRegEx = /^\/\/\/?\s*(@ts-check|@ts-nocheck)\s*$/gim; + var checkJsDirectiveMatchResult = checkJsDirectiveRegEx.exec(comment); + if (checkJsDirectiveMatchResult) { + checkJsDirective = { + enabled: ts.compareStrings(checkJsDirectiveMatchResult[1], "@ts-check", true) === 0, + end: range.end, + pos: range.pos + }; + } } } sourceFile.referencedFiles = referencedFiles; sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; + sourceFile.checkJsDirective = checkJsDirective; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 234 && node.moduleReference.kind === 245 - || node.kind === 235 - || node.kind === 240 - || node.kind === 241 + || node.kind === 236 && node.moduleReference.kind === 247 + || node.kind === 237 + || node.kind === 242 + || node.kind === 243 ? node : undefined; }); } + var ParsingContext; + (function (ParsingContext) { + ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements"; + ParsingContext[ParsingContext["BlockStatements"] = 1] = "BlockStatements"; + ParsingContext[ParsingContext["SwitchClauses"] = 2] = "SwitchClauses"; + ParsingContext[ParsingContext["SwitchClauseStatements"] = 3] = "SwitchClauseStatements"; + ParsingContext[ParsingContext["TypeMembers"] = 4] = "TypeMembers"; + ParsingContext[ParsingContext["ClassMembers"] = 5] = "ClassMembers"; + ParsingContext[ParsingContext["EnumMembers"] = 6] = "EnumMembers"; + ParsingContext[ParsingContext["HeritageClauseElement"] = 7] = "HeritageClauseElement"; + ParsingContext[ParsingContext["VariableDeclarations"] = 8] = "VariableDeclarations"; + ParsingContext[ParsingContext["ObjectBindingElements"] = 9] = "ObjectBindingElements"; + ParsingContext[ParsingContext["ArrayBindingElements"] = 10] = "ArrayBindingElements"; + ParsingContext[ParsingContext["ArgumentExpressions"] = 11] = "ArgumentExpressions"; + ParsingContext[ParsingContext["ObjectLiteralMembers"] = 12] = "ObjectLiteralMembers"; + ParsingContext[ParsingContext["JsxAttributes"] = 13] = "JsxAttributes"; + ParsingContext[ParsingContext["JsxChildren"] = 14] = "JsxChildren"; + ParsingContext[ParsingContext["ArrayLiteralMembers"] = 15] = "ArrayLiteralMembers"; + ParsingContext[ParsingContext["Parameters"] = 16] = "Parameters"; + ParsingContext[ParsingContext["RestProperties"] = 17] = "RestProperties"; + ParsingContext[ParsingContext["TypeParameters"] = 18] = "TypeParameters"; + ParsingContext[ParsingContext["TypeArguments"] = 19] = "TypeArguments"; + ParsingContext[ParsingContext["TupleElementTypes"] = 20] = "TupleElementTypes"; + ParsingContext[ParsingContext["HeritageClauses"] = 21] = "HeritageClauses"; + ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 22] = "ImportOrExportSpecifiers"; + ParsingContext[ParsingContext["JSDocFunctionParameters"] = 23] = "JSDocFunctionParameters"; + ParsingContext[ParsingContext["JSDocTypeArguments"] = 24] = "JSDocTypeArguments"; + ParsingContext[ParsingContext["JSDocRecordMembers"] = 25] = "JSDocRecordMembers"; + ParsingContext[ParsingContext["JSDocTupleTypes"] = 26] = "JSDocTupleTypes"; + ParsingContext[ParsingContext["Count"] = 27] = "Count"; + })(ParsingContext || (ParsingContext = {})); + var Tristate; + (function (Tristate) { + Tristate[Tristate["False"] = 0] = "False"; + Tristate[Tristate["True"] = 1] = "True"; + Tristate[Tristate["Unknown"] = 2] = "Unknown"; + })(Tristate || (Tristate = {})); var JSDocParser; (function (JSDocParser) { function isJSDocType() { @@ -17450,7 +19365,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(262, scanner.getTokenPos()); + var result = createNode(266, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -17461,12 +19376,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(266, type.pos); + var unionType = createNode(270, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(273, type.pos); + var optionalType = createNode(277, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -17477,20 +19392,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(265, type.pos); + var arrayType = createNode(269, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(268, type.pos); + var nullableType = createNode(272, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(269, type.pos); + var nonNullableType = createNode(273, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -17524,14 +19439,15 @@ var ts; case 98: return parseJSDocThisType(); case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: case 104: case 94: - case 137: + case 138: case 129: + case 133: return parseTokenNode(); case 9: case 8: @@ -17542,27 +19458,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277); + var result = createNode(281); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276); + var result = createNode(280); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275); + var result = createNode(279); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274); + var result = createNode(278); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -17575,7 +19491,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144); + var parameter = createNode(145); parameter.type = parseJSDocType(); if (parseOptional(57)) { parameter.questionToken = createNode(57); @@ -17583,7 +19499,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272); + var result = createNode(276); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -17617,24 +19533,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141, left.pos); + var result = createNode(142, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270); + var result = createNode(274); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269); + var result = createNode(273); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267); + var result = createNode(271); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -17648,7 +19564,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266); + var result = createNode(270); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -17664,12 +19580,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263); + var result = createNode(267); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288); + var result = createNode(292); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17682,11 +19598,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(264, pos); + var result = createNode(268, pos); return finishNode(result); } else { - var result = createNode(268, pos); + var result = createNode(272, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -17714,6 +19630,12 @@ var ts; return comment; } JSDocParser.parseJSDocComment = parseJSDocComment; + var JSDocState; + (function (JSDocState) { + JSDocState[JSDocState["BeginningOfLine"] = 0] = "BeginningOfLine"; + JSDocState[JSDocState["SawAsterisk"] = 1] = "SawAsterisk"; + JSDocState[JSDocState["SavingComments"] = 2] = "SavingComments"; + })(JSDocState || (JSDocState = {})); function parseJSDocCommentWorker(start, length) { var content = sourceText; start = start || 0; @@ -17771,7 +19693,7 @@ var ts; break; case 38: var asterisk = scanner.getTokenText(); - if (state === 1) { + if (state === 1 || state === 2) { state = 2; pushComment(asterisk); } @@ -17786,7 +19708,10 @@ var ts; break; case 5: var whitespace = scanner.getTokenText(); - if (state === 2 || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -17794,6 +19719,7 @@ var ts; case 1: break; default: + state = 2; pushComment(scanner.getTokenText()); break; } @@ -17826,7 +19752,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(278, start); + var result = createNode(282, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -17883,7 +19809,7 @@ var ts; } function parseTagComments(indent) { var comments = []; - var state = 1; + var state = 0; var margin; function pushComment(text) { if (!margin) { @@ -17936,7 +19862,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -17991,7 +19917,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -18002,20 +19928,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(286, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 287; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(287, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -18030,7 +19956,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286, atToken.pos); + var result = createNode(290, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -18039,7 +19965,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -18048,25 +19974,28 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285, atToken.pos); + var typedefTag = createNode(289, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70) { + while (true) { + if (rightNode.kind === 70 || !rightNode.body) { + typedefTag.name = rightNode.kind === 70 ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272) { + if (typeExpression.type.kind === 276) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_16 = jsDocTypeReference.name; - if (name_16.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -18080,7 +20009,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(291, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -18110,6 +20039,7 @@ var ts; break; case 70: canParseTag = false; + break; case 1: break; } @@ -18121,7 +20051,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(230, pos); + var jsDocNamespaceNode = createNode(232, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -18165,19 +20095,19 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 288; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); while (true) { - var name_17 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_17) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_17.pos); - typeParameter.name = name_17; + var typeParameter = createNode(144, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -18188,7 +20118,7 @@ var ts; break; } } - var result = createNode(284, atToken.pos); + var result = createNode(288, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18480,7 +20410,7 @@ var ts; } function visitArray(array) { if (position >= array.pos && position < array.end) { - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -18502,21 +20432,31 @@ var ts; } } } + var InvalidPosition; + (function (InvalidPosition) { + InvalidPosition[InvalidPosition["Value"] = -1] = "Value"; + })(InvalidPosition || (InvalidPosition = {})); })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); var ts; (function (ts) { + var ModuleInstanceState; + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ModuleInstanceState = ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); function getModuleInstanceState(node) { - if (node.kind === 227 || node.kind === 228) { + if (node.kind === 229 || node.kind === 230) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 237 || node.kind === 236) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 231) { + else if (node.kind === 233) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -18532,7 +20472,7 @@ var ts; }); return state_1; } - else if (node.kind === 230) { + else if (node.kind === 232) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -18544,6 +20484,18 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; + var ContainerFlags; + (function (ContainerFlags) { + ContainerFlags[ContainerFlags["None"] = 0] = "None"; + ContainerFlags[ContainerFlags["IsContainer"] = 1] = "IsContainer"; + ContainerFlags[ContainerFlags["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; + ContainerFlags[ContainerFlags["IsControlFlowContainer"] = 4] = "IsControlFlowContainer"; + ContainerFlags[ContainerFlags["IsFunctionLike"] = 8] = "IsFunctionLike"; + ContainerFlags[ContainerFlags["IsFunctionExpression"] = 16] = "IsFunctionExpression"; + ContainerFlags[ContainerFlags["HasLocals"] = 32] = "HasLocals"; + ContainerFlags[ContainerFlags["IsInterface"] = 64] = "IsInterface"; + ContainerFlags[ContainerFlags["IsObjectLiteralOrClassExpressionMethod"] = 128] = "IsObjectLiteralOrClassExpressionMethod"; + })(ContainerFlags || (ContainerFlags = {})); var binder = createBinder(); function bindSourceFile(file, options) { ts.performance.mark("beforeBind"); @@ -18614,7 +20566,7 @@ var ts; } return bindSourceFile; function bindInStrictMode(file, opts) { - if (opts.alwaysStrict && !ts.isDeclarationFile(file)) { + if ((opts.alwaysStrict === undefined ? opts.strict : opts.alwaysStrict) && !ts.isDeclarationFile(file)) { return true; } else { @@ -18641,7 +20593,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232)) { symbol.valueDeclaration = node; } } @@ -18651,7 +20603,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -18662,46 +20614,47 @@ var ts; return node.name.text; } switch (node.kind) { - case 150: + case 151: return "__constructor"; - case 158: - case 153: - return "__call"; case 159: case 154: - return "__new"; + return "__call"; + case 160: case 155: + return "__new"; + case 156: return "__index"; - case 241: + case 243: return "__export"; - case 240: + case 242: return node.isExportEquals ? "export=" : "default"; - case 192: + case 193: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; case 1: case 4: + case 5: return node.left.name.text; case 3: return node.left.expression.name.text; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225: - case 226: + case 227: + case 228: return ts.hasModifier(node, 512) ? "default" : undefined; - case 274: + case 278: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144: - ts.Debug.assert(node.parent.kind === 274); + case 145: + ts.Debug.assert(node.parent.kind === 278); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285: + case 289: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -18724,13 +20677,16 @@ var ts; symbol = createSymbol(0, "__missing"); } else { - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0, name)); + } if (name && (includes & 788448)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { - symbol = symbolTable[name] = createSymbol(0, name); + symbolTable.set(name, symbol = createSymbol(0, name)); } else { if (node.name) { @@ -18745,7 +20701,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -18765,7 +20721,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) { + if (node.kind === 245 || (node.kind === 236 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -18773,7 +20729,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 285 && + var isJSDocTypedefInJSDocNamespace = node.kind === 289 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18828,13 +20784,13 @@ var ts; activeLabels = undefined; hasExplicitReturn = false; bindChildren(node); - node.flags &= ~64896; + node.flags &= ~1408; if (!(currentFlow.flags & 1) && containerFlags & 8 && ts.nodeIsPresent(node.body)) { node.flags |= 128; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 261) { + if (node.kind === 264) { node.flags |= emitFlags; } if (isIIFE) { @@ -18910,66 +20866,72 @@ var ts; return; } switch (node.kind) { - case 210: + case 212: bindWhileStatement(node); break; - case 209: + case 211: bindDoStatement(node); break; - case 211: + case 213: bindForStatement(node); break; - case 212: - case 213: + case 214: + case 215: bindForInOrForOfStatement(node); break; - case 208: + case 210: bindIfStatement(node); break; - case 216: - case 220: + case 218: + case 222: bindReturnOrThrow(node); break; - case 215: - case 214: + case 217: + case 216: bindBreakOrContinueStatement(node); break; - case 221: + case 223: bindTryStatement(node); break; - case 218: + case 220: bindSwitchStatement(node); break; - case 232: + case 234: bindCaseBlock(node); break; - case 253: + case 256: bindCaseClause(node); break; - case 219: + case 221: bindLabeledStatement(node); break; - case 190: + case 191: bindPrefixUnaryExpressionFlow(node); break; - case 191: + case 192: bindPostfixUnaryExpressionFlow(node); break; - case 192: + case 193: bindBinaryExpressionFlow(node); break; - case 186: + case 187: bindDeleteExpressionFlow(node); break; - case 193: + case 194: bindConditionalExpressionFlow(node); break; - case 223: + case 225: bindVariableDeclarationFlow(node); break; - case 179: + case 180: bindCallExpressionFlow(node); break; + case 282: + bindJSDocComment(node); + break; + case 289: + bindJSDocTypedefTag(node); + break; default: bindEachChild(node); break; @@ -18979,15 +20941,15 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 178: return isNarrowableReference(expr); - case 179: + case 180: return hasNarrowableArgument(expr); - case 183: + case 184: return isNarrowingExpression(expr.expression); - case 192: + case 193: return isNarrowingBinaryExpression(expr); - case 190: + case 191: return expr.operator === 50 && isNarrowingExpression(expr.operand); } return false; @@ -18995,7 +20957,8 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 || expr.kind === 98 || - expr.kind === 177 && isNarrowableReference(expr.expression); + expr.kind === 96 || + expr.kind === 178 && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -19006,14 +20969,14 @@ var ts; } } } - if (expr.expression.kind === 177 && + if (expr.expression.kind === 178 && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; + return expr1.kind === 188 && isNarrowableOperand(expr1.expression) && expr2.kind === 9; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -19034,9 +20997,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183: + case 184: return isNarrowableOperand(expr.expression); - case 192: + case 193: switch (expr.operatorToken.kind) { case 57: return isNarrowableOperand(expr.left); @@ -19130,33 +21093,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208: case 210: - case 209: - return parent.expression === node; + case 212: case 211: - case 193: + return parent.expression === node; + case 213: + case 194: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183) { + if (node.kind === 184) { node = node.expression; } - else if (node.kind === 190 && node.operator === 50) { + else if (node.kind === 191 && node.operator === 50) { node = node.operand; } else { - return node.kind === 192 && (node.operatorToken.kind === 52 || + return node.kind === 193 && (node.operatorToken.kind === 52 || node.operatorToken.kind === 53); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 || - node.parent.kind === 190 && + while (node.parent.kind === 184 || + node.parent.kind === 191 && node.parent.operator === 50) { node = node.parent; } @@ -19198,7 +21161,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 + var enclosingLabeledStatement = node.parent.kind === 221 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -19230,10 +21193,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; + if (node.kind === 215) { + bind(node.awaitModifier); + } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224) { + if (node.initializer.kind !== 226) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -19255,7 +21221,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216) { + if (node.kind === 218) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -19275,7 +21241,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -19308,7 +21274,8 @@ var ts; flowAfterCatch = currentFlow; } if (node.finallyBlock) { - addAntecedent(preFinallyLabel, preTryFlow); + var preFinallyFlow = { flags: 2048, antecedent: preTryFlow, lock: {} }; + addAntecedent(preFinallyLabel, preFinallyFlow); currentFlow = finishFlowLabel(preFinallyLabel); bind(node.finallyBlock); if (!(currentFlow.flags & 1)) { @@ -19318,6 +21285,11 @@ var ts; : unreachableFlow; } } + if (!(currentFlow.flags & 1)) { + var afterFinallyFlow = { flags: 4096, antecedent: currentFlow }; + preFinallyFlow.lock = afterFinallyFlow; + currentFlow = afterFinallyFlow; + } } else { currentFlow = finishFlowLabel(preFinallyLabel); @@ -19332,7 +21304,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 257; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -19397,13 +21369,13 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209) { + if (!node.statement || node.statement.kind !== 211) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 && node.operatorToken.kind === 57) { + if (node.kind === 193 && node.operatorToken.kind === 57) { bindAssignmentTargetFlow(node.left); } else { @@ -19414,10 +21386,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175) { + else if (node.kind === 176) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196) { + if (e.kind === 197) { bindAssignmentTargetFlow(e.expression); } else { @@ -19425,16 +21397,16 @@ var ts; } } } - else if (node.kind === 176) { + else if (node.kind === 177) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257) { + if (p.kind === 260) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258) { + else if (p.kind === 261) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259) { + else if (p.kind === 262) { bindAssignmentTargetFlow(p.expression); } } @@ -19490,7 +21462,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 && node.left.kind === 178) { + if (operator === 57 && node.left.kind === 179) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19501,7 +21473,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { bindAssignmentTargetFlow(node.expression); } } @@ -19534,16 +21506,31 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { + if (node.initializer || node.parent.parent.kind === 214 || node.parent.parent.kind === 215) { bindInitializedVariableFlow(node); } } + function bindJSDocComment(node) { + ts.forEachChild(node, function (n) { + if (n.kind !== 289) { + bind(n); + } + }); + } + function bindJSDocTypedefTag(node) { + ts.forEachChild(node, function (n) { + if (node.fullName && n === node.name && node.fullName.kind !== 70) { + return; + } + bind(n); + }); + } function bindCallExpressionFlow(node) { var expr = node.expression; - while (expr.kind === 183) { + while (expr.kind === 184) { expr = expr.expression; } - if (expr.kind === 184 || expr.kind === 185) { + if (expr.kind === 185 || expr.kind === 186) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -19551,7 +21538,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177) { + if (node.expression.kind === 178) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -19560,52 +21547,53 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197: - case 226: - case 229: - case 176: - case 161: - case 287: - case 270: + case 198: + case 228: + case 231: + case 177: + case 162: + case 291: + case 274: + case 253: return 1; - case 227: + case 229: return 1 | 64; - case 274: + case 278: + case 232: case 230: - case 228: - case 170: + case 171: return 1 | 32; - case 261: + case 264: return 1 | 4 | 32; - case 149: + case 150: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } - case 150: - case 225: - case 148: case 151: + case 227: + case 149: case 152: case 153: case 154: case 155: - case 158: + case 156: case 159: + case 160: return 1 | 4 | 32 | 8; - case 184: case 185: + case 186: return 1 | 4 | 32 | 8 | 16; - case 231: + case 233: return 4; - case 147: + case 148: return node.initializer ? 4 : 0; - case 256: - case 211: - case 212: + case 259: case 213: - case 232: + case 214: + case 215: + case 234: return 2; - case 204: + case 206: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -19621,37 +21609,38 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 230: + case 232: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261: + case 264: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197: - case 226: + case 198: + case 228: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229: + case 231: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161: - case 176: - case 227: - case 270: - case 287: + case 162: + case 177: + case 229: + case 274: + case 291: + case 253: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158: case 159: - case 153: + case 160: case 154: case 155: - case 149: - case 148: + case 156: case 150: + case 149: case 151: case 152: - case 225: - case 184: + case 153: + case 227: case 185: - case 274: - case 228: - case 170: + case 186: + case 278: + case 230: + case 171: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -19666,11 +21655,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 ? node : node.body; - if (body && (body.kind === 261 || body.kind === 231)) { + var body = node.kind === 264 ? node : node.body; + if (body && (body.kind === 264 || body.kind === 233)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 || stat.kind === 240) { + if (stat.kind === 243 || stat.kind === 242) { return true; } } @@ -19692,7 +21681,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -19712,12 +21701,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0) { - declareSymbolAndAddToSymbolTable(node, 1024, 0); - } - else { - declareSymbolAndAddToSymbolTable(node, 512, 106639); + var state = declareModuleSymbol(node); + if (state !== 0) { if (node.symbol.flags & (16 | 32 | 256)) { node.symbol.constEnumOnlyModule = false; } @@ -19733,29 +21718,40 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 : 1024, instantiated ? 106639 : 0); + return state; + } function bindFunctionOrConstructorType(node) { var symbol = createSymbol(131072, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { + var ElementKind; + (function (ElementKind) { + ElementKind[ElementKind["Property"] = 1] = "Property"; + ElementKind[ElementKind["Accessor"] = 2] = "Accessor"; + })(ElementKind || (ElementKind = {})); if (inStrictMode) { var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 || prop.name.kind !== 70) { + if (prop.kind === 262 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149 + var currentKind = prop.kind === 260 || prop.kind === 261 || prop.kind === 150 ? 1 : 2; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 && existingKind === 1) { @@ -19766,16 +21762,22 @@ var ts; } return bindAnonymousDeclaration(node, 4096, "__object"); } + function bindJsxAttributes(node) { + return bindAnonymousDeclaration(node, 4096, "__jsxAttributes"); + } + function bindJsxAttribute(node, symbolFlags, symbolExcludes) { + return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } function bindAnonymousDeclaration(node, symbolFlags, name) { var symbol = createSymbol(symbolFlags, name); addDeclarationToSymbol(symbol, node, symbolFlags); } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230: + case 232: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261: + case 264: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -19865,8 +21867,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 261 && - blockScopeContainer.kind !== 230 && + if (blockScopeContainer.kind !== 264 && + blockScopeContainer.kind !== 232 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -19874,7 +21876,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.isOctalLiteral) { + if (inStrictMode && node.numericLiteralFlags & 4) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -19908,8 +21910,11 @@ var ts; } node.parent = parent; var saveInStrictMode = inStrictMode; + if (ts.isInJavaScriptFile(node)) { + bindJSDocTypedefTagIfAny(node); + } bindWorker(node); - if (node.kind > 140) { + if (node.kind > 141) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -19926,6 +21931,26 @@ var ts; } inStrictMode = saveInStrictMode; } + function bindJSDocTypedefTagIfAny(node) { + if (!node.jsDoc) { + return; + } + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (!jsDoc.tags) { + continue; + } + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { + var tag = _c[_b]; + if (tag.kind === 289) { + var savedParent = parent; + parent = jsDoc; + bind(tag); + parent = savedParent; + } + } + } + } function updateStrictModeStatementList(statements) { if (!inStrictMode) { for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { @@ -19949,90 +21974,88 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285) { + while (parentNode && parentNode.kind !== 289) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 261)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177: + case 178: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192: - if (ts.isInJavaScriptFile(node)) { - var specialKind = ts.getSpecialPropertyAssignmentKind(node); - switch (specialKind) { - case 1: - bindExportsPropertyAssignment(node); - break; - case 2: - bindModuleExportsAssignment(node); - break; - case 3: - bindPrototypePropertyAssignment(node); - break; - case 4: - bindThisPropertyAssignment(node); - break; - case 0: - break; - default: - ts.Debug.fail("Unknown special property assignment kind"); - } + case 193: + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1: + bindExportsPropertyAssignment(node); + break; + case 2: + bindModuleExportsAssignment(node); + break; + case 3: + bindPrototypePropertyAssignment(node); + break; + case 4: + bindThisPropertyAssignment(node); + break; + case 5: + bindStaticPropertyAssignment(node); + break; + case 0: + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 256: + case 259: return checkStrictModeCatchClause(node); - case 186: + case 187: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 191: + case 192: return checkStrictModePostfixUnaryExpression(node); - case 190: + case 191: return checkStrictModePrefixUnaryExpression(node); - case 217: + case 219: return checkStrictModeWithStatement(node); - case 167: + case 168: seenThisKeyword = true; return; - case 156: + case 157: return checkTypePredicate(node); - case 143: - return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: + return declareSymbolAndAddToSymbolTable(node, 262144, 530920); + case 145: return bindParameter(node); - case 223: - case 174: - if (node.dotDotDotToken && node.parent.kind === 172) { - emitFlags |= 32768; - } + case 225: + case 175: return bindVariableDeclarationOrBindingElement(node); + case 148: case 147: - case 146: - case 271: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 286: + case 275: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0); + case 290: return bindJSDocProperty(node); - case 257: - case 258: - return bindPropertyOrMethodOrAccessor(node, 4, 0); case 260: + case 261: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 263: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 259: - case 251: + case 262: + case 254: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 && - root.parent.kind === 192 && + if (root.kind === 177 && + root.parent.kind === 193 && root.parent.operatorToken.kind === 57 && root.parent.left === root) { hasRest = true; @@ -20040,80 +22063,83 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 : 16384; return; - case 153: case 154: case 155: + case 156: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 150: case 149: - case 148: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 225: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 67108864 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); + case 227: return bindFunctionDeclaration(node); - case 150: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 151: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 152: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 153: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 158: case 159: - case 274: + case 160: + case 278: return bindFunctionOrConstructorType(node); - case 161: - case 170: - case 287: - case 270: + case 162: + case 171: + case 291: + case 274: return bindAnonymousDeclaration(node, 2048, "__type"); - case 176: + case 177: return bindObjectLiteralExpression(node); - case 184: case 185: + case 186: return bindFunctionExpression(node); - case 179: + case 180: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 197: - case 226: + case 198: + case 228: inStrictMode = true; return bindClassLikeDeclaration(node); - case 227: + case 229: return bindBlockScopedDeclaration(node, 64, 792968); - case 285: + case 289: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 228: + case 230: return bindBlockScopedDeclaration(node, 524288, 793064); - case 229: + case 231: return bindEnumDeclaration(node); - case 230: + case 232: return bindModuleDeclaration(node); - case 234: - case 237: + case 253: + return bindJsxAttributes(node); + case 252: + return bindJsxAttribute(node, 4, 0); + case 236: case 239: - case 243: + case 241: + case 245: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 233: + case 235: return bindNamespaceExportDeclaration(node); - case 236: + case 238: return bindImportClause(node); - case 241: + case 243: return bindExportDeclaration(node); - case 240: + case 242: return bindExportAssignment(node); - case 261: + case 264: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204: + case 206: if (!ts.isFunctionLike(node.parent)) { return; } - case 231: + case 233: return updateStrictModeStatementList(node.statements); } } @@ -20122,7 +22148,7 @@ var ts; if (parameterName && parameterName.kind === 70) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167) { + if (parameterName && parameterName.kind === 168) { seenThisKeyword = true; } bind(type); @@ -20141,7 +22167,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -20151,17 +22177,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261) { + if (node.parent.kind !== 264) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20171,10 +22197,10 @@ var ts; } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { - bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); + bindAnonymousDeclaration(node, 33554432, getDeclarationName(node)); } else if (!node.exportClause) { - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); + declareSymbol(container.symbol.exports, container.symbol, node, 33554432, 0); } } function bindImportClause(node) { @@ -20194,24 +22220,56 @@ var ts; setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); } + function isExportsOrModuleExportsOrAlias(node) { + return ts.isExportsIdentifier(node) || + ts.isModuleExportsPropertyAccessExpression(node) || + isNameOfExportsOrModuleExportsAliasDeclaration(node); + } + function isNameOfExportsOrModuleExportsAliasDeclaration(node) { + if (node.kind === 70) { + var symbol = lookupSymbolForName(node.text); + if (symbol && symbol.valueDeclaration && symbol.valueDeclaration.kind === 225) { + var declaration = symbol.valueDeclaration; + if (declaration.initializer) { + return isExportsOrModuleExportsOrAliasOrAssignemnt(declaration.initializer); + } + } + } + return false; + } + function isExportsOrModuleExportsOrAliasOrAssignemnt(node) { + return isExportsOrModuleExportsOrAlias(node) || + (ts.isAssignmentExpression(node, true) && (isExportsOrModuleExportsOrAliasOrAssignemnt(node.left) || isExportsOrModuleExportsOrAliasOrAssignemnt(node.right))); + } function bindModuleExportsAssignment(node) { + var assignedExpression = ts.getRightMostAssignedExpression(node.right); + if (ts.isEmptyObjectLiteral(assignedExpression) || isExportsOrModuleExportsOrAlias(assignedExpression)) { + setCommonJsModuleIndicator(node); + return; + } setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 225 || container.kind === 184) { - container.symbol.members = container.symbol.members || ts.createMap(); - declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); - } - else if (container.kind === 150) { - var saveContainer = container; - container = container.parent; - var symbol = bindPropertyOrMethodOrAccessor(node, 4, 0); - if (symbol) { - symbol.isReplaceableByMethod = true; - } - container = saveContainer; + var container = ts.getThisContainer(node, false); + switch (container.kind) { + case 227: + case 185: + container.symbol.members = container.symbol.members || ts.createMap(); + declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); + break; + case 151: + case 148: + case 150: + case 152: + case 153: + var containingClass = container.parent; + var symbol = declareSymbol(ts.hasModifier(container, 32) ? containingClass.symbol.exports : containingClass.symbol.members, containingClass.symbol, node, 4, 0); + if (symbol) { + symbol.isReplaceableByMethod = true; + } + break; } } function bindPrototypePropertyAssignment(node) { @@ -20221,14 +22279,35 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; - if (!funcSymbol || !(funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { - return; + bindPropertyAssignment(constructorFunction.text, leftSideOfAssignment, true); + } + function bindStaticPropertyAssignment(node) { + var leftSideOfAssignment = node.left; + var target = leftSideOfAssignment.expression; + leftSideOfAssignment.parent = node; + target.parent = leftSideOfAssignment; + if (isNameOfExportsOrModuleExportsAliasDeclaration(target)) { + bindExportsPropertyAssignment(node); } - if (!funcSymbol.members) { - funcSymbol.members = ts.createMap(); + else { + bindPropertyAssignment(target.text, leftSideOfAssignment, false); } - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4, 0); + } + function lookupSymbolForName(name) { + return (container.symbol && container.symbol.exports && container.symbol.exports.get(name)) || (container.locals && container.locals.get(name)); + } + function bindPropertyAssignment(functionName, propertyAccessExpression, isPrototypeProperty) { + var targetSymbol = lookupSymbolForName(functionName); + if (targetSymbol && ts.isDeclarationOfFunctionOrClassExpression(targetSymbol)) { + targetSymbol = targetSymbol.valueDeclaration.initializer.symbol; + } + if (!targetSymbol || !(targetSymbol.flags & (16 | 32))) { + return; + } + var symbolTable = isPrototypeProperty ? + (targetSymbol.members || (targetSymbol.members = ts.createMap())) : + (targetSymbol.exports || (targetSymbol.exports = ts.createMap())); + declareSymbol(symbolTable, targetSymbol, propertyAccessExpression, 4, 0); } function bindCallExpression(node) { if (!file.commonJsModuleIndicator && ts.isRequireCall(node, false)) { @@ -20236,33 +22315,26 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; - } - } - if (node.kind === 226) { + if (node.kind === 228) { bindBlockScopedDeclaration(node, 32, 899519); } else { var bindingName = node.name ? node.name.text : "__class"; bindAnonymousDeclaration(node, 32, bindingName); if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; - var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var prototypeSymbol = createSymbol(4 | 16777216, "prototype"); + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -20287,11 +22359,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 | 4096); - } if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.name); } @@ -20303,13 +22370,13 @@ var ts; } if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 536870912 : 0), 0); + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 67108864 : 0), 0); } } function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } checkStrictModeFunctionName(node); @@ -20323,8 +22390,8 @@ var ts; } function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } if (currentFlow) { @@ -20336,11 +22403,8 @@ var ts; } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -20362,15 +22426,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) || - node.kind === 226 || - (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 208) || + node.kind === 228 || + (node.kind === 232 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 || + (node.kind !== 207 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -20384,56 +22448,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179: - return computeCallExpression(node, subtreeFlags); case 180: + return computeCallExpression(node, subtreeFlags); + case 181: return computeNewExpression(node, subtreeFlags); - case 230: + case 232: return computeModuleDeclaration(node, subtreeFlags); - case 183: + case 184: return computeParenthesizedExpression(node, subtreeFlags); - case 192: + case 193: return computeBinaryExpression(node, subtreeFlags); - case 207: + case 209: return computeExpressionStatement(node, subtreeFlags); - case 144: + case 145: return computeParameter(node, subtreeFlags); - case 185: + case 186: return computeArrowFunction(node, subtreeFlags); - case 184: + case 185: return computeFunctionExpression(node, subtreeFlags); - case 225: + case 227: return computeFunctionDeclaration(node, subtreeFlags); - case 223: + case 225: return computeVariableDeclaration(node, subtreeFlags); - case 224: + case 226: return computeVariableDeclarationList(node, subtreeFlags); - case 205: + case 207: return computeVariableStatement(node, subtreeFlags); - case 219: + case 221: return computeLabeledStatement(node, subtreeFlags); - case 226: + case 228: return computeClassDeclaration(node, subtreeFlags); - case 197: + case 198: return computeClassExpression(node, subtreeFlags); - case 255: + case 258: return computeHeritageClause(node, subtreeFlags); - case 256: + case 259: return computeCatchClause(node, subtreeFlags); - case 199: + case 200: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150: + case 151: return computeConstructor(node, subtreeFlags); - case 147: + case 148: return computePropertyDeclaration(node, subtreeFlags); - case 149: + case 150: return computeMethod(node, subtreeFlags); - case 151: case 152: + case 153: return computeAccessor(node, subtreeFlags); - case 234: + case 236: return computeImportEquals(node, subtreeFlags); - case 177: + case 178: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -20458,8 +22522,8 @@ var ts; switch (kind) { case 96: return true; - case 177: case 178: + case 179: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96; @@ -20481,10 +22545,10 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 && leftKind === 176) { + if (operatorTokenKind === 57 && leftKind === 177) { transformFlags |= 8 | 192 | 3072; } - else if (operatorTokenKind === 57 && leftKind === 175) { + else if (operatorTokenKind === 57 && leftKind === 176) { transformFlags |= 192 | 3072; } else if (operatorTokenKind === 39 @@ -20523,8 +22587,8 @@ var ts; var expression = node.expression; var expressionKind = expression.kind; var expressionTransformFlags = expression.transformFlags; - if (expressionKind === 200 - || expressionKind === 182) { + if (expressionKind === 201 + || expressionKind === 183) { transformFlags |= 3; } if (expressionTransformFlags & 1024) { @@ -20621,9 +22685,9 @@ var ts; transformFlags |= 8; } if (ts.hasModifier(node, 256)) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; @@ -20666,7 +22730,7 @@ var ts; transformFlags |= 3; } if (modifierFlags & 256) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } if (subtreeFlags & 1048576) { transformFlags |= 8; @@ -20674,7 +22738,7 @@ var ts; if (subtreeFlags & 163840) { transformFlags |= 192; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } } @@ -20689,7 +22753,7 @@ var ts; transformFlags |= 3; } if (ts.hasModifier(node, 256)) { - transformFlags |= 16; + transformFlags |= node.asteriskToken ? 8 : 16; } if (subtreeFlags & 1048576) { transformFlags |= 8; @@ -20697,7 +22761,7 @@ var ts; if (subtreeFlags & 163840) { transformFlags |= 192; } - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { + if (node.asteriskToken) { transformFlags |= 768; } node.transformFlags = transformFlags | 536870912; @@ -20810,8 +22874,8 @@ var ts; var excludeFlags = 536872257; switch (kind) { case 119: - case 189: - transformFlags |= 16; + case 190: + transformFlags |= 8 | 16; break; case 113: case 111: @@ -20819,50 +22883,66 @@ var ts; case 116: case 123: case 75: - case 229: - case 260: - case 182: - case 200: + case 231: + case 263: + case 183: case 201: + case 202: case 130: transformFlags |= 3; break; - case 246: - case 247: case 248: - case 10: case 249: case 250: + case 10: case 251: case 252: + case 253: + case 254: + case 255: transformFlags |= 4; break; - case 213: - transformFlags |= 8; case 12: case 13: case 14: case 15: - case 194: - case 181: - case 258: + case 195: + case 182: + case 261: case 114: + case 203: transformFlags |= 192; break; - case 195: - transformFlags |= 192 | 16777216; + case 9: + if (node.hasExtendedUnicodeEscape) { + transformFlags |= 192; + } + break; + case 8: + if (node.numericLiteralFlags & 48) { + transformFlags |= 192; + } + break; + case 215: + if (node.awaitModifier) { + transformFlags |= 8; + } + transformFlags |= 192; + break; + case 196: + transformFlags |= 8 | 192 | 16777216; break; case 118: case 132: case 129: - case 134: - case 121: + case 133: case 135: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: case 156: @@ -20876,26 +22956,27 @@ var ts; case 164: case 165: case 166: - case 227: - case 228: case 167: + case 229: + case 230: case 168: case 169: case 170: case 171: + case 172: transformFlags = 3; excludeFlags = -3; break; - case 142: + case 143: transformFlags |= 2097152; if (subtreeFlags & 16384) { transformFlags |= 65536; } break; - case 196: + case 197: transformFlags |= 192 | 524288; break; - case 259: + case 262: transformFlags |= 8 | 1048576; break; case 96: @@ -20904,27 +22985,27 @@ var ts; case 98: transformFlags |= 16384; break; - case 172: + case 173: transformFlags |= 192 | 8388608; if (subtreeFlags & 524288) { transformFlags |= 8 | 1048576; } excludeFlags = 537396545; break; - case 173: + case 174: transformFlags |= 192 | 8388608; excludeFlags = 537396545; break; - case 174: + case 175: transformFlags |= 192; if (node.dotDotDotToken) { transformFlags |= 524288; } break; - case 145: + case 146: transformFlags |= 3 | 4096; break; - case 176: + case 177: excludeFlags = 540087617; if (subtreeFlags & 2097152) { transformFlags |= 192; @@ -20936,29 +23017,29 @@ var ts; transformFlags |= 8; } break; - case 175: - case 180: + case 176: + case 181: excludeFlags = 537396545; if (subtreeFlags & 524288) { transformFlags |= 192; } break; - case 209: - case 210: case 211: case 212: + case 213: + case 214: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 261: + case 264: if (subtreeFlags & 32768) { transformFlags |= 192; } break; + case 218: case 216: - case 214: - case 215: + case 217: transformFlags |= 33554432; break; } @@ -20966,56 +23047,57 @@ var ts; return transformFlags & ~excludeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 && kind <= 171) { + if (kind >= 157 && kind <= 172) { return -3; } switch (kind) { - case 179: case 180: - case 175: + case 181: + case 176: return 537396545; - case 230: + case 232: return 574674241; - case 144: + case 145: return 536872257; - case 185: + case 186: return 601249089; - case 184: - case 225: + case 185: + case 227: return 601281857; - case 224: - return 546309441; case 226: - case 197: + return 546309441; + case 228: + case 198: return 539358529; - case 150: - return 601015617; - case 149: case 151: + return 601015617; + case 150: case 152: + case 153: return 601015617; case 118: case 132: case 129: - case 134: - case 121: case 135: + case 133: + case 121: + case 136: case 104: - case 143: - case 146: - case 148: - case 153: + case 144: + case 147: + case 149: case 154: case 155: - case 227: - case 228: + case 156: + case 229: + case 230: return -3; - case 176: + case 177: return 540087617; - case 256: + case 259: return 537920833; - case 172: case 173: + case 174: return 537396545; default: return 536872257; @@ -21048,23 +23130,29 @@ var ts; ts.getSymbolId = getSymbolId; function createTypeChecker(host, produceDiagnostics) { var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; var symbolCount = 0; + var symbolInstantiationDepth = 0; var emptyArray = []; var emptySymbols = ts.createMap(); var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); var modulekind = ts.getEmitModuleKind(compilerOptions); var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters; var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; - var strictNullChecks = compilerOptions.strictNullChecks; + var strictNullChecks = compilerOptions.strictNullChecks === undefined ? compilerOptions.strict : compilerOptions.strictNullChecks; + var noImplicitAny = compilerOptions.noImplicitAny === undefined ? compilerOptions.strict : compilerOptions.noImplicitAny; + var noImplicitThis = compilerOptions.noImplicitThis === undefined ? compilerOptions.strict : compilerOptions.noImplicitThis; var emitResolver = createResolver(); - var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var nodeBuilder = createNodeBuilder(); + var undefinedSymbol = createSymbol(4, "undefined"); undefinedSymbol.declarations = []; - var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); + var argumentsSymbol = createSymbol(4, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, @@ -21073,47 +23161,127 @@ var ts; isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, + getMergedSymbol: getMergedSymbol, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, - getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, + getTypeOfSymbolAtLocation: function (symbol, location) { + location = ts.getParseTreeNode(location); + return location ? getTypeOfSymbolAtLocation(symbol, location) : unknownType; + }, + getSymbolsOfParameterPropertyDeclaration: function (parameter, parameterName) { + parameter = ts.getParseTreeNode(parameter, ts.isParameter); + ts.Debug.assert(parameter !== undefined, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); + return getSymbolsOfParameterPropertyDeclaration(parameter, parameterName); + }, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getBaseTypeOfLiteralType: getBaseTypeOfLiteralType, + getWidenedType: getWidenedType, + getTypeFromTypeNode: function (node) { + node = ts.getParseTreeNode(node, ts.isTypeNode); + return node ? getTypeFromTypeNode(node) : unknownType; + }, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, - getSymbolsInScope: getSymbolsInScope, - getSymbolAtLocation: getSymbolAtLocation, - getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, - getTypeAtLocation: getTypeOfNode, - getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, - typeToString: typeToString, + typeToTypeNode: nodeBuilder.typeToTypeNode, + indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, + signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, + getSymbolsInScope: function (location, meaning) { + location = ts.getParseTreeNode(location); + return location ? getSymbolsInScope(location, meaning) : []; + }, + getSymbolAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getSymbolAtLocation(node) : undefined; + }, + getShorthandAssignmentValueSymbol: function (node) { + node = ts.getParseTreeNode(node); + return node ? getShorthandAssignmentValueSymbol(node) : undefined; + }, + getExportSpecifierLocalTargetSymbol: function (node) { + node = ts.getParseTreeNode(node, ts.isExportSpecifier); + return node ? getExportSpecifierLocalTargetSymbol(node) : undefined; + }, + getTypeAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getTypeOfNode(node) : unknownType; + }, + getPropertySymbolOfDestructuringAssignment: function (location) { + location = ts.getParseTreeNode(location, ts.isIdentifier); + return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; + }, + signatureToString: function (signature, enclosingDeclaration, flags, kind) { + return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind); + }, + typeToString: function (type, enclosingDeclaration, flags) { + return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags); + }, getSymbolDisplayBuilder: getSymbolDisplayBuilder, - symbolToString: symbolToString, + symbolToString: function (symbol, enclosingDeclaration, meaning) { + return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning); + }, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: function (node) { + node = ts.getParseTreeNode(node, ts.isExpression); + return node ? getContextualType(node) : undefined; + }, getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: getResolvedSignature, - getConstantValue: getConstantValue, - isValidPropertyAccess: isValidPropertyAccess, - getSignatureFromDeclaration: getSignatureFromDeclaration, - isImplementationOfOverload: isImplementationOfOverload, + getResolvedSignature: function (node, candidatesOutArray) { + node = ts.getParseTreeNode(node, ts.isCallLikeExpression); + return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + }, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, + isValidPropertyAccess: function (node, propertyName) { + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + return node ? isValidPropertyAccess(node, propertyName) : false; + }, + getSignatureFromDeclaration: function (declaration) { + declaration = ts.getParseTreeNode(declaration, ts.isFunctionLike); + return declaration ? getSignatureFromDeclaration(declaration) : undefined; + }, + isImplementationOfOverload: function (node) { + node = ts.getParseTreeNode(node, ts.isFunctionLike); + return node ? isImplementationOfOverload(node) : undefined; + }, + getImmediateAliasedSymbol: function (symbol) { + ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.immediateTarget) { + var node = getDeclarationOfAliasSymbol(symbol); + ts.Debug.assert(!!node); + links.immediateTarget = getTargetOfAliasDeclaration(node, true); + } + return links.immediateTarget; + }, getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, - getJsxElementAttributesType: getJsxElementAttributesType, + getAllAttributesTypeFromJsxOpeningLikeElement: function (node) { + node = ts.getParseTreeNode(node, ts.isJsxOpeningLikeElement); + return node ? getAllAttributesTypeFromJsxOpeningLikeElement(node) : undefined; + }, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, - isOptionalParameter: isOptionalParameter, + isOptionalParameter: function (node) { + node = ts.getParseTreeNode(node, ts.isParameter); + return node ? isOptionalParameter(node) : false; + }, tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -21122,8 +23290,8 @@ var ts; var numericLiteralTypes = ts.createMap(); var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; - var unknownSymbol = createSymbol(4 | 67108864, "unknown"); - var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var unknownSymbol = createSymbol(4, "unknown"); + var resolvingSymbol = createSymbol(0, "__resolving__"); var anyType = createIntrinsicType(1, "any"); var autoType = createIntrinsicType(1, "any"); var unknownType = createIntrinsicType(1, "unknown"); @@ -21140,8 +23308,9 @@ var ts; var voidType = createIntrinsicType(1024, "void"); var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); + var nonPrimitiveType = createIntrinsicType(16777216, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var emptyTypeLiteralSymbol = createSymbol(2048 | 67108864, "__type"); + var emptyTypeLiteralSymbol = createSymbol(2048, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -21149,16 +23318,15 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, undefined, 0, false, false); var enumNumberIndexInfo = createIndexInfo(stringType, true); + var jsObjectLiteralIndexInfo = createIndexInfo(anyType, false); var globals = ts.createMap(); var patternAmbientModules; - var getGlobalESSymbolConstructorSymbol; - var getGlobalPromiseConstructorSymbol; - var tryGetGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -21167,26 +23335,26 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var globalThisType; var anyArrayType; var autoArrayType; var anyReadonlyArrayType; - var getGlobalTemplateStringsArrayType; - var getGlobalESSymbolType; - var getGlobalIterableType; - var getGlobalIteratorType; - var getGlobalIterableIteratorType; - var getGlobalClassDecoratorType; - var getGlobalParameterDecoratorType; - var getGlobalPropertyDecoratorType; - var getGlobalMethodDecoratorType; - var getGlobalTypedPropertyDescriptorType; - var getGlobalPromiseType; - var tryGetGlobalPromiseType; - var getGlobalPromiseLikeType; - var getInstantiatedGlobalPromiseLikeType; - var getGlobalPromiseConstructorLikeType; - var getGlobalThenableType; - var jsxElementClassType; + var deferredGlobalESSymbolConstructorSymbol; + var deferredGlobalESSymbolType; + var deferredGlobalTypedPropertyDescriptorType; + var deferredGlobalPromiseType; + var deferredGlobalPromiseConstructorSymbol; + var deferredGlobalPromiseConstructorLikeType; + var deferredGlobalIterableType; + var deferredGlobalIteratorType; + var deferredGlobalIterableIteratorType; + var deferredGlobalAsyncIterableType; + var deferredGlobalAsyncIteratorType; + var deferredGlobalAsyncIterableIteratorType; + var deferredGlobalTemplateStringsArrayType; + var deferredJsxElementClassType; + var deferredJsxElementType; + var deferredJsxStatelessElementType; var deferredNodes; var deferredUnusedIdentifierNodes; var flowLoopStart = 0; @@ -21207,9 +23375,70 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); - var typeofEQFacts = ts.createMap({ + var TypeFacts; + (function (TypeFacts) { + TypeFacts[TypeFacts["None"] = 0] = "None"; + TypeFacts[TypeFacts["TypeofEQString"] = 1] = "TypeofEQString"; + TypeFacts[TypeFacts["TypeofEQNumber"] = 2] = "TypeofEQNumber"; + TypeFacts[TypeFacts["TypeofEQBoolean"] = 4] = "TypeofEQBoolean"; + TypeFacts[TypeFacts["TypeofEQSymbol"] = 8] = "TypeofEQSymbol"; + TypeFacts[TypeFacts["TypeofEQObject"] = 16] = "TypeofEQObject"; + TypeFacts[TypeFacts["TypeofEQFunction"] = 32] = "TypeofEQFunction"; + TypeFacts[TypeFacts["TypeofEQHostObject"] = 64] = "TypeofEQHostObject"; + TypeFacts[TypeFacts["TypeofNEString"] = 128] = "TypeofNEString"; + TypeFacts[TypeFacts["TypeofNENumber"] = 256] = "TypeofNENumber"; + TypeFacts[TypeFacts["TypeofNEBoolean"] = 512] = "TypeofNEBoolean"; + TypeFacts[TypeFacts["TypeofNESymbol"] = 1024] = "TypeofNESymbol"; + TypeFacts[TypeFacts["TypeofNEObject"] = 2048] = "TypeofNEObject"; + TypeFacts[TypeFacts["TypeofNEFunction"] = 4096] = "TypeofNEFunction"; + TypeFacts[TypeFacts["TypeofNEHostObject"] = 8192] = "TypeofNEHostObject"; + TypeFacts[TypeFacts["EQUndefined"] = 16384] = "EQUndefined"; + TypeFacts[TypeFacts["EQNull"] = 32768] = "EQNull"; + TypeFacts[TypeFacts["EQUndefinedOrNull"] = 65536] = "EQUndefinedOrNull"; + TypeFacts[TypeFacts["NEUndefined"] = 131072] = "NEUndefined"; + TypeFacts[TypeFacts["NENull"] = 262144] = "NENull"; + TypeFacts[TypeFacts["NEUndefinedOrNull"] = 524288] = "NEUndefinedOrNull"; + TypeFacts[TypeFacts["Truthy"] = 1048576] = "Truthy"; + TypeFacts[TypeFacts["Falsy"] = 2097152] = "Falsy"; + TypeFacts[TypeFacts["Discriminatable"] = 4194304] = "Discriminatable"; + TypeFacts[TypeFacts["All"] = 8388607] = "All"; + TypeFacts[TypeFacts["BaseStringStrictFacts"] = 933633] = "BaseStringStrictFacts"; + TypeFacts[TypeFacts["BaseStringFacts"] = 3145473] = "BaseStringFacts"; + TypeFacts[TypeFacts["StringStrictFacts"] = 4079361] = "StringStrictFacts"; + TypeFacts[TypeFacts["StringFacts"] = 4194049] = "StringFacts"; + TypeFacts[TypeFacts["EmptyStringStrictFacts"] = 3030785] = "EmptyStringStrictFacts"; + TypeFacts[TypeFacts["EmptyStringFacts"] = 3145473] = "EmptyStringFacts"; + TypeFacts[TypeFacts["NonEmptyStringStrictFacts"] = 1982209] = "NonEmptyStringStrictFacts"; + TypeFacts[TypeFacts["NonEmptyStringFacts"] = 4194049] = "NonEmptyStringFacts"; + TypeFacts[TypeFacts["BaseNumberStrictFacts"] = 933506] = "BaseNumberStrictFacts"; + TypeFacts[TypeFacts["BaseNumberFacts"] = 3145346] = "BaseNumberFacts"; + TypeFacts[TypeFacts["NumberStrictFacts"] = 4079234] = "NumberStrictFacts"; + TypeFacts[TypeFacts["NumberFacts"] = 4193922] = "NumberFacts"; + TypeFacts[TypeFacts["ZeroStrictFacts"] = 3030658] = "ZeroStrictFacts"; + TypeFacts[TypeFacts["ZeroFacts"] = 3145346] = "ZeroFacts"; + TypeFacts[TypeFacts["NonZeroStrictFacts"] = 1982082] = "NonZeroStrictFacts"; + TypeFacts[TypeFacts["NonZeroFacts"] = 4193922] = "NonZeroFacts"; + TypeFacts[TypeFacts["BaseBooleanStrictFacts"] = 933252] = "BaseBooleanStrictFacts"; + TypeFacts[TypeFacts["BaseBooleanFacts"] = 3145092] = "BaseBooleanFacts"; + TypeFacts[TypeFacts["BooleanStrictFacts"] = 4078980] = "BooleanStrictFacts"; + TypeFacts[TypeFacts["BooleanFacts"] = 4193668] = "BooleanFacts"; + TypeFacts[TypeFacts["FalseStrictFacts"] = 3030404] = "FalseStrictFacts"; + TypeFacts[TypeFacts["FalseFacts"] = 3145092] = "FalseFacts"; + TypeFacts[TypeFacts["TrueStrictFacts"] = 1981828] = "TrueStrictFacts"; + TypeFacts[TypeFacts["TrueFacts"] = 4193668] = "TrueFacts"; + TypeFacts[TypeFacts["SymbolStrictFacts"] = 1981320] = "SymbolStrictFacts"; + TypeFacts[TypeFacts["SymbolFacts"] = 4193160] = "SymbolFacts"; + TypeFacts[TypeFacts["ObjectStrictFacts"] = 6166480] = "ObjectStrictFacts"; + TypeFacts[TypeFacts["ObjectFacts"] = 8378320] = "ObjectFacts"; + TypeFacts[TypeFacts["FunctionStrictFacts"] = 6164448] = "FunctionStrictFacts"; + TypeFacts[TypeFacts["FunctionFacts"] = 8376288] = "FunctionFacts"; + TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; + TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; + })(TypeFacts || (TypeFacts = {})); + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1, "number": 2, "boolean": 4, @@ -21218,7 +23447,7 @@ var ts; "object": 16, "function": 32 }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128, "number": 256, "boolean": 512, @@ -21227,14 +23456,14 @@ var ts; "object": 2048, "function": 4096 }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, "symbol": esSymbolType, "undefined": undefinedType }); - var jsxElementType; + var typeofType = createTypeofType(); var _jsxNamespace; var _jsxFactoryEntity; var jsxTypes = ts.createMap(); @@ -21253,8 +23482,21 @@ var ts; var identityRelation = ts.createMap(); var enumRelation = ts.createMap(); var _displayBuilder; + var TypeSystemPropertyName; + (function (TypeSystemPropertyName) { + TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType"; + TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; + })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); + var CheckMode; + (function (CheckMode) { + CheckMode[CheckMode["Normal"] = 0] = "Normal"; + CheckMode[CheckMode["SkipContextSensitive"] = 1] = "SkipContextSensitive"; + CheckMode[CheckMode["Inferential"] = 2] = "Inferential"; + })(CheckMode || (CheckMode = {})); var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -21284,7 +23526,12 @@ var ts; } function createSymbol(flags, name) { symbolCount++; - return new Symbol(flags, name); + var symbol = (new Symbol(flags | 134217728, name)); + symbol.checkFlags = 0; + return symbol; + } + function isTransientSymbol(symbol) { + return (symbol.flags & 134217728) !== 0; } function getExcludedSymbolFlags(flags) { var result = 0; @@ -21330,7 +23577,7 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 33554432, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) @@ -21352,12 +23599,10 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { + (target.valueDeclaration.kind === 232 && source.valueDeclaration.kind !== 232))) { target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -21370,6 +23615,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -21382,18 +23630,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { - if (!(targetSymbol.flags & 33554432)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + if (!(targetSymbol.flags & 134217728)) { + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -21414,7 +23663,7 @@ var ts; } mainModule = resolveExternalModuleSymbol(mainModule); if (mainModule.flags & 1920) { - mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule); + mainModule = mainModule.flags & 134217728 ? mainModule : cloneSymbol(mainModule); mergeSymbol(mainModule, moduleAugmentation.symbol); } else { @@ -21423,20 +23672,21 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } } function getSymbolLinks(symbol) { - if (symbol.flags & 67108864) + if (symbol.flags & 134217728) return symbol; var id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}); @@ -21448,14 +23698,17 @@ var ts; function getObjectFlags(type) { return type.flags & 32768 ? type.objectFlags : 0; } + function getCheckFlags(symbol) { + return symbol.flags & 134217728 ? symbol.checkFlags : 0; + } function isGlobalSourceFile(node) { - return node.kind === 261 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 264 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } @@ -21486,57 +23739,76 @@ var ts; (!compilerOptions.outFile && !compilerOptions.out)) { return true; } - if (isUsedInFunctionOrNonStaticProperty(usage)) { + if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { return true; } var sourceFiles = host.getSourceFiles(); return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 223 || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 175) { + var errorBindingElement = ts.getAncestor(usage, 175); + if (errorBindingElement) { + return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || + declaration.pos < errorBindingElement.pos; + } + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225), usage); + } + else if (declaration.kind === 225) { + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; + } + if (usage.parent.kind === 245) { + return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); - return isUsedInFunctionOrNonStaticProperty(usage, container); + return isInTypeQuery(usage) || isUsedInFunctionOrInstanceProperty(usage, declaration, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205: - case 211: + case 207: case 213: + case 215: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 212: - case 213: + case 214: + case 215: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } } return false; } - function isUsedInFunctionOrNonStaticProperty(usage, container) { - var current = usage; - while (current) { + function isUsedInFunctionOrInstanceProperty(usage, declaration, container) { + return !!ts.findAncestor(usage, function (current) { if (current === container) { - return false; + return "quit"; } if (ts.isFunctionLike(current)) { return true; } - var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 && - (ts.getModifierFlags(current.parent) & 32) === 0 && + var initializerOfProperty = current.parent && + current.parent.kind === 148 && current.parent.initializer === current; - if (initializerOfNonStaticProperty) { - return true; + if (initializerOfProperty) { + if (ts.getModifierFlags(current.parent) & 32) { + if (declaration.kind === 150) { + return true; + } + } + else { + var isDeclarationInstanceProperty = declaration.kind === 148 && !(ts.getModifierFlags(declaration) & 32); + if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { + return true; + } + } } - current = current.parent; - } - return false; + }); } } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { @@ -21551,18 +23823,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 282) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 144 || - lastLocation.kind === 143 + lastLocation.kind === 145 || + lastLocation.kind === 144 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 144 || + lastLocation.kind === 145 || (lastLocation === location.type && - result.valueDeclaration.kind === 144); + result.valueDeclaration.kind === 145); } } if (useResult) { @@ -21574,23 +23846,24 @@ var ts; } } switch (location.kind) { - case 261: + case 264: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230: + case 232: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 || ts.isAmbientModule(location)) { - if (result = moduleExports["default"]) { + if (location.kind === 264 || ts.isAmbientModule(location)) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; } - if (moduleExports[name] && - moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 243)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 && + ts.getDeclarationOfKind(moduleExport, 245)) { break; } } @@ -21598,13 +23871,13 @@ var ts; break loop; } break; - case 229: + case 231: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 148: case 147: - case 146: if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -21614,17 +23887,21 @@ var ts; } } break; - case 226: - case 197: - case 227: + case 228: + case 198: + case 229: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { + if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { + result = undefined; + break; + } if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } break loop; } - if (location.kind === 197 && meaning & 32) { + if (location.kind === 198 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -21632,28 +23909,28 @@ var ts; } } break; - case 142: + case 143: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 225: - case 185: + case 153: + case 227: + case 186: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184: + case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -21666,8 +23943,8 @@ var ts; } } break; - case 145: - if (location.parent && location.parent.kind === 144) { + case 146: + if (location.parent && location.parent.kind === 145) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -21690,7 +23967,8 @@ var ts; !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && - !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { + !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && + !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } } @@ -21702,21 +23980,31 @@ var ts; error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } - if (meaning & 2) { + if (meaning & 2 || + ((meaning & 32 || meaning & 384) && (meaning & 107455) === 107455)) { var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); - if (exportOrLocalSymbol.flags & 2) { + if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233) { + if (decls && decls.length === 1 && decls[0].kind === 235) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } } return result; } + function isTypeParameterSymbolDeclaredInContainer(symbol, container) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.kind === 144 && decl.parent === container) { + return true; + } + } + return false; + } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { if ((errorLocation.kind === 70 && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { return false; @@ -21757,9 +24045,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70: - case 177: + case 178: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199: + case 200: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -21786,65 +24074,84 @@ var ts; } return false; } - function checkResolvedBlockScopedVariable(result, errorLocation) { - ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); - } - } - function isSameScopeDescendentOf(initial, parent, stopAt) { - if (!parent) { - return false; + function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { + if (meaning & (107455 & ~1024 & ~793064)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~107455, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, name); + return true; + } } - for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { - if (current === parent) { + else if (meaning & (793064 & ~1024 & ~107455)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~793064, undefined, undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, name); return true; } } return false; } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384)); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 231) ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + if (result.flags & 2) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 32) { + error(errorLocation, ts.Diagnostics.Class_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 384) { + error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + return parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent; }); + } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234) { + if (node.kind === 236) { return node; } - while (node && node.kind !== 235) { - node = node.parent; - } - return node; + return ts.findAncestor(node, function (n) { return n.kind === 237; }); } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } - function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245) { + function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { + if (node.moduleReference.kind === 247) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } - return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); } - function getTargetOfImportClause(node) { + function getTargetOfImportClause(node, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default"), dontResolveAlias); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { - return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } return exportDefaultSymbol; } } - function getTargetOfNamespaceImport(node) { + function getTargetOfNamespaceImport(node, dontResolveAlias) { var moduleSpecifier = node.parent.parent.moduleSpecifier; - return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); + return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier, dontResolveAlias); } function combineValueAndTypeSymbols(valueSymbol, typeSymbol) { if (valueSymbol.flags & (793064 | 1920)) { @@ -21861,12 +24168,9 @@ var ts; result.exports = valueSymbol.exports; return result; } - function getExportOfModule(symbol, name) { + function getExportOfModule(symbol, name, dontResolveAlias) { if (symbol.flags & 1536) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; - if (exportedSymbol) { - return resolveSymbol(exportedSymbol); - } + return resolveSymbol(getExportsOfSymbol(symbol).get(name), dontResolveAlias); } } function getPropertyOfVariable(symbol, name) { @@ -21877,71 +24181,72 @@ var ts; } } } - function getExternalModuleMember(node, specifier) { + function getExternalModuleMember(node, specifier, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); + var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier, dontResolveAlias); if (targetSymbol) { - var name_18 = specifier.propertyName || specifier.name; - if (name_18.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } - symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_18.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") { - symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); + var symbolFromModule = getExportOfModule(targetSymbol, name.text, dontResolveAlias); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { + symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } } } - function getTargetOfImportSpecifier(node) { - return getExternalModuleMember(node.parent.parent.parent, node); + function getTargetOfImportSpecifier(node, dontResolveAlias) { + return getExternalModuleMember(node.parent.parent.parent, node, dontResolveAlias); } - function getTargetOfNamespaceExportDeclaration(node) { - return resolveExternalModuleSymbol(node.parent.symbol); + function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) { + return resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias); } - function getTargetOfExportSpecifier(node) { + function getTargetOfExportSpecifier(node, dontResolveAlias) { return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920); + getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : + resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920, false, dontResolveAlias); } - function getTargetOfExportAssignment(node) { - return resolveEntityName(node.expression, 107455 | 793064 | 1920); + function getTargetOfExportAssignment(node, dontResolveAlias) { + return resolveEntityName(node.expression, 107455 | 793064 | 1920, false, dontResolveAlias); } - function getTargetOfAliasDeclaration(node) { + function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 234: - return getTargetOfImportEqualsDeclaration(node); case 236: - return getTargetOfImportClause(node); - case 237: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); + case 238: + return getTargetOfImportClause(node, dontRecursivelyResolve); case 239: - return getTargetOfImportSpecifier(node); - case 243: - return getTargetOfExportSpecifier(node); - case 240: - return getTargetOfExportAssignment(node); - case 233: - return getTargetOfNamespaceExportDeclaration(node); + return getTargetOfNamespaceImport(node, dontRecursivelyResolve); + case 241: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 245: + return getTargetOfExportSpecifier(node, dontRecursivelyResolve); + case 242: + return getTargetOfExportAssignment(node, dontRecursivelyResolve); + case 235: + return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); } } - function resolveSymbol(symbol) { - return symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)) ? resolveAlias(symbol) : symbol; + function resolveSymbol(symbol, dontResolveAlias) { + var shouldResolve = !dontResolveAlias && symbol && symbol.flags & 8388608 && !(symbol.flags & (107455 | 793064 | 1920)); + return shouldResolve ? resolveAlias(symbol) : symbol; } function resolveAlias(symbol) { ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); @@ -21980,10 +24285,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240) { + if (node.kind === 242) { checkExpressionCached(node.expression); } - else if (node.kind === 243) { + else if (node.kind === 245) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21995,11 +24300,11 @@ var ts; if (entityName.kind === 70 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 70 || entityName.parent.kind === 141) { + if (entityName.kind === 70 || entityName.parent.kind === 142) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 234); + ts.Debug.assert(entityName.parent.kind === 236); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -22018,9 +24323,19 @@ var ts; return undefined; } } - else if (name.kind === 141 || name.kind === 177) { - var left = name.kind === 141 ? name.left : name.expression; - var right = name.kind === 141 ? name.right : name.name; + else if (name.kind === 142 || name.kind === 178) { + var left = void 0; + if (name.kind === 142) { + left = name.left; + } + else if (name.kind === 178 && + (name.expression.kind === 184 || ts.isEntityNameExpression(name.expression))) { + left = name.expression; + } + else { + return undefined; + } + var right = name.kind === 142 ? name.right : name.name; var namespace = resolveEntityName(left, 1920, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -22036,10 +24351,15 @@ var ts; return undefined; } } + else if (name.kind === 184) { + return ts.isEntityNameExpression(name.expression) ? + resolveEntityName(name.expression, meaning, ignoreErrors, dontResolveAlias, location) : + undefined; + } else { ts.Debug.fail("Unknown entity name kind."); } - ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { @@ -22047,7 +24367,7 @@ var ts; } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { if (isForAugmentation === void 0) { isForAugmentation = false; } - if (moduleReferenceExpression.kind !== 9) { + if (moduleReferenceExpression.kind !== 9 && moduleReferenceExpression.kind !== 12) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -22084,11 +24404,10 @@ var ts; } if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } - else if (compilerOptions.noImplicitAny && moduleNotFoundError) { + else if (noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); } return undefined; @@ -22110,27 +24429,35 @@ var ts; } return undefined; } - function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias)) || moduleSymbol; } - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { - var symbol = resolveExternalModuleSymbol(moduleSymbol); - if (symbol && !(symbol.flags & (1536 | 3))) { + function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); + if (!dontResolveAlias && symbol && !(symbol.flags & (1536 | 3))) { error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -22141,24 +24468,28 @@ var ts; return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -22170,26 +24501,26 @@ var ts; } visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -22211,22 +24542,13 @@ var ts; : symbol; } function symbolIsValue(symbol) { - if (symbol.flags & 16777216) { - return symbolIsValue(getSymbolLinks(symbol).target); - } - if (symbol.flags & 107455) { - return true; - } - if (symbol.flags & 8388608) { - return (resolveAlias(symbol).flags & 107455) !== 0; - } - return false; + return !!(symbol.flags & 107455 || symbol.flags & 8388608 && resolveAlias(symbol).flags & 107455); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 && ts.nodeIsPresent(member.body)) { return member; } } @@ -22254,6 +24576,9 @@ var ts; type.symbol = symbol; return type; } + function createTypeofType() { + return getUnionType(ts.convertToArray(typeofEQFacts.keys(), function (s) { return getLiteralTypeForText(32, s); })); + } function isReservedMemberName(name) { return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && @@ -22262,16 +24587,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -22290,19 +24614,19 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 261: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 264: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: - if (result = callback(getSymbolOfNode(location_1).exports)) { + case 232: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -22315,6 +24639,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { return true; @@ -22328,26 +24662,28 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + if (isAccessible(symbols.get(symbol.name))) { + return [symbol]; + } + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -22358,14 +24694,14 @@ var ts; function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { return false; } if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -22379,10 +24715,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147: - case 149: - case 151: + case 148: + case 150: case 152: + case 153: continue; default: return false; @@ -22430,15 +24766,12 @@ var ts; } return { accessibility: 0 }; function getExternalModuleContainer(declaration) { - for (; declaration; declaration = declaration.parent) { - if (hasExternalModuleSymbol(declaration)) { - return getSymbolOfNode(declaration); - } - } + var node = ts.findAncestor(declaration, hasExternalModuleSymbol); + return node && getSymbolOfNode(node); } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 264 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22472,11 +24805,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 160 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 234) { + else if (entityName.kind === 142 || entityName.kind === 178 || + entityName.parent.kind === 236) { meaning = 1920; } else { @@ -22524,6 +24857,483 @@ var ts; } return result; } + function createNodeBuilder() { + var context; + return { + typeToTypeNode: function (type, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = typeToTypeNodeHelper(type); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + indexInfoToIndexSignatureDeclaration: function (indexInfo, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + signatureToSignatureDeclaration: function (signature, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = signatureToSignatureDeclarationHelper(signature, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + } + }; + function createNodeBuilderContext(enclosingDeclaration, flags) { + return { + enclosingDeclaration: enclosingDeclaration, + flags: flags, + encounteredError: false, + inObjectTypeLiteral: false, + checkAlias: true, + symbolStack: undefined + }; + } + function typeToTypeNodeHelper(type) { + if (!type) { + context.encounteredError = true; + return undefined; + } + if (type.flags & 1) { + return ts.createKeywordTypeNode(118); + } + if (type.flags & 2) { + return ts.createKeywordTypeNode(135); + } + if (type.flags & 4) { + return ts.createKeywordTypeNode(132); + } + if (type.flags & 8) { + return ts.createKeywordTypeNode(121); + } + if (type.flags & 16) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & (32)) { + return ts.createLiteralTypeNode((ts.createLiteral(type.text))); + } + if (type.flags & (64)) { + return ts.createLiteralTypeNode((ts.createNumericLiteral(type.text))); + } + if (type.flags & 128) { + return type.intrinsicName === "true" ? ts.createTrue() : ts.createFalse(); + } + if (type.flags & 256) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & 1024) { + return ts.createKeywordTypeNode(104); + } + if (type.flags & 2048) { + return ts.createKeywordTypeNode(138); + } + if (type.flags & 4096) { + return ts.createKeywordTypeNode(94); + } + if (type.flags & 8192) { + return ts.createKeywordTypeNode(129); + } + if (type.flags & 512) { + return ts.createKeywordTypeNode(136); + } + if (type.flags & 16777216) { + return ts.createKeywordTypeNode(133); + } + if (type.flags & 16384 && type.isThisType) { + if (context.inObjectTypeLiteral) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowThisInObjectLiteral)) { + context.encounteredError = true; + } + } + return ts.createThis(); + } + var objectFlags = getObjectFlags(type); + if (objectFlags & 4) { + ts.Debug.assert(!!(type.flags & 32768)); + return typeReferenceToTypeNode(type); + } + if (objectFlags & 3) { + ts.Debug.assert(!!(type.flags & 32768)); + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (type.flags & 16384) { + var name = symbolToName(type.symbol, false); + return ts.createTypeReferenceNode(name, undefined); + } + if (context.checkAlias && type.aliasSymbol) { + var name = symbolToName(type.aliasSymbol, false); + var typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments); + return ts.createTypeReferenceNode(name, typeArgumentNodes); + } + context.checkAlias = false; + if (type.flags & 65536) { + var formattedUnionTypes = formatUnionTypes(type.types); + var unionTypeNodes = formattedUnionTypes && mapToTypeNodeArray(formattedUnionTypes); + if (unionTypeNodes && unionTypeNodes.length > 0) { + return ts.createUnionOrIntersectionTypeNode(165, unionTypeNodes); + } + else { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyUnionOrIntersection)) { + context.encounteredError = true; + } + return undefined; + } + } + if (type.flags & 131072) { + return ts.createUnionOrIntersectionTypeNode(166, mapToTypeNodeArray(type.types)); + } + if (objectFlags & (16 | 32)) { + ts.Debug.assert(!!(type.flags & 32768)); + return createAnonymousTypeNode(type); + } + if (type.flags & 262144) { + var indexedType = type.type; + var indexTypeNode = typeToTypeNodeHelper(indexedType); + return ts.createTypeOperatorNode(indexTypeNode); + } + if (type.flags & 524288) { + var objectTypeNode = typeToTypeNodeHelper(type.objectType); + var indexTypeNode = typeToTypeNodeHelper(type.indexType); + return ts.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); + } + ts.Debug.fail("Should be unreachable."); + function mapToTypeNodeArray(types) { + var result = []; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type_1 = types_1[_i]; + var typeNode = typeToTypeNodeHelper(type_1); + if (typeNode) { + result.push(typeNode); + } + } + return result; + } + function createMappedTypeNodeFromType(type) { + ts.Debug.assert(!!(type.flags & 32768)); + var typeParameter = getTypeParameterFromMappedType(type); + var typeParameterNode = typeParameterToDeclaration(typeParameter); + var templateType = getTemplateTypeFromMappedType(type); + var templateTypeNode = typeToTypeNodeHelper(templateType); + var readonlyToken = type.declaration && type.declaration.readonlyToken ? ts.createToken(130) : undefined; + var questionToken = type.declaration && type.declaration.questionToken ? ts.createToken(54) : undefined; + return ts.createMappedTypeNode(readonlyToken, typeParameterNode, questionToken, templateTypeNode); + } + function createAnonymousTypeNode(type) { + var symbol = type.symbol; + if (symbol) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512) || + shouldWriteTypeOfFunctionSymbol()) { + return createTypeQueryNodeFromSymbol(symbol); + } + else if (ts.contains(context.symbolStack, symbol)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + var entityName = symbolToName(typeAlias, false); + return ts.createTypeReferenceNode(entityName, undefined); + } + else { + return ts.createKeywordTypeNode(118); + } + } + else { + if (!context.symbolStack) { + context.symbolStack = []; + } + context.symbolStack.push(symbol); + var result = createTypeNodeFromObjectType(type); + context.symbolStack.pop(); + return result; + } + } + else { + return createTypeNodeFromObjectType(type); + } + function shouldWriteTypeOfFunctionSymbol() { + var isStaticMethodSymbol = !!(symbol.flags & 8192 && + ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32; })); + var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && + (symbol.parent || + ts.forEach(symbol.declarations, function (declaration) { + return declaration.parent.kind === 264 || declaration.parent.kind === 233; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return ts.contains(context.symbolStack, symbol); + } + } + } + function createTypeNodeFromObjectType(type) { + if (type.objectFlags & 32) { + if (getConstraintTypeFromMappedType(type).flags & (16384 | 262144)) { + return createMappedTypeNodeFromType(type); + } + } + var resolved = resolveStructuredTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + return ts.createTypeLiteralNode(undefined); + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + var signature = resolved.callSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 159); + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + var signature = resolved.constructSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 160); + } + } + var saveInObjectTypeLiteral = context.inObjectTypeLiteral; + context.inObjectTypeLiteral = true; + var members = createTypeNodesFromResolvedType(resolved); + context.inObjectTypeLiteral = saveInObjectTypeLiteral; + return ts.createTypeLiteralNode(members); + } + function createTypeQueryNodeFromSymbol(symbol) { + var entityName = symbolToName(symbol, false); + return ts.createTypeQueryNode(entityName); + } + function typeReferenceToTypeNode(type) { + var typeArguments = type.typeArguments || emptyArray; + if (type.target === globalArrayType) { + var elementType = typeToTypeNodeHelper(typeArguments[0]); + return ts.createArrayTypeNode(elementType); + } + else if (type.target.objectFlags & 8) { + if (typeArguments.length > 0) { + var tupleConstituentNodes = mapToTypeNodeArray(typeArguments.slice(0, getTypeReferenceArity(type))); + if (tupleConstituentNodes && tupleConstituentNodes.length > 0) { + return ts.createTupleTypeNode(tupleConstituentNodes); + } + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyTuple)) { + context.encounteredError = true; + } + return undefined; + } + else { + var outerTypeParameters = type.target.outerTypeParameters; + var i = 0; + var qualifiedName = undefined; + if (outerTypeParameters) { + var length_1 = outerTypeParameters.length; + while (i < length_1) { + var start = i; + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + do { + i++; + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { + var qualifiedNamePart = symbolToName(parent, true); + if (!qualifiedName) { + qualifiedName = ts.createQualifiedName(qualifiedNamePart, undefined); + } + else { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = qualifiedNamePart; + qualifiedName = ts.createQualifiedName(qualifiedName, undefined); + } + } + } + } + var entityName = undefined; + var nameIdentifier = symbolToName(type.symbol, true); + if (qualifiedName) { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = nameIdentifier; + entityName = qualifiedName; + } + else { + entityName = nameIdentifier; + } + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + var typeArgumentNodes = ts.some(typeArguments) ? mapToTypeNodeArray(typeArguments.slice(i, typeParameterCount - i)) : undefined; + return ts.createTypeReferenceNode(entityName, typeArgumentNodes); + } + } + function createTypeNodesFromResolvedType(resolvedType) { + var typeElements = []; + for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 154)); + } + for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 155)); + } + if (resolvedType.stringIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.stringIndexInfo, 0)); + } + if (resolvedType.numberIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.numberIndexInfo, 1)); + } + var properties = resolvedType.properties; + if (!properties) { + return typeElements; + } + for (var _d = 0, properties_2 = properties; _d < properties_2.length; _d++) { + var propertySymbol = properties_2[_d]; + var propertyType = getTypeOfSymbol(propertySymbol); + var oldDeclaration = propertySymbol.declarations && propertySymbol.declarations[0]; + if (!oldDeclaration) { + return; + } + var propertyName = oldDeclaration.name; + var optionalToken = propertySymbol.flags & 67108864 ? ts.createToken(54) : undefined; + if (propertySymbol.flags & (16 | 8192) && !getPropertiesOfObjectType(propertyType).length) { + var signatures = getSignaturesOfType(propertyType, 0); + for (var _e = 0, signatures_1 = signatures; _e < signatures_1.length; _e++) { + var signature = signatures_1[_e]; + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 149); + methodDeclaration.name = propertyName; + methodDeclaration.questionToken = optionalToken; + typeElements.push(methodDeclaration); + } + } + else { + var propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType) : ts.createKeywordTypeNode(118); + typeElements.push(ts.createPropertySignature(propertyName, optionalToken, propertyTypeNode, undefined)); + } + } + return typeElements.length ? typeElements : undefined; + } + } + function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind) { + var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 ? 135 : 132); + var name = ts.getNameFromIndexInfo(indexInfo); + var indexingParameter = ts.createParameter(undefined, undefined, undefined, name, undefined, indexerTypeNode, undefined); + var typeNode = typeToTypeNodeHelper(indexInfo.type); + return ts.createIndexSignatureDeclaration(undefined, indexInfo.isReadonly ? [ts.createToken(130)] : undefined, [indexingParameter], typeNode); + } + function signatureToSignatureDeclarationHelper(signature, kind) { + var typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter); }); + var returnTypeNode; + if (signature.typePredicate) { + var typePredicate = signature.typePredicate; + var parameterName = typePredicate.kind === 1 ? ts.createIdentifier(typePredicate.parameterName) : ts.createThisTypeNode(); + var typeNode = typeToTypeNodeHelper(typePredicate.type); + returnTypeNode = ts.createTypePredicateNode(parameterName, typeNode); + } + else { + var returnType = getReturnTypeOfSignature(signature); + returnTypeNode = returnType && typeToTypeNodeHelper(returnType); + } + var returnTypeNodeExceptAny = returnTypeNode && returnTypeNode.kind !== 118 ? returnTypeNode : undefined; + return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNodeExceptAny); + } + function typeParameterToDeclaration(type) { + var constraint = getConstraintFromTypeParameter(type); + var constraintNode = constraint && typeToTypeNodeHelper(constraint); + var defaultParameter = getDefaultFromTypeParameter(type); + var defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter); + var name = symbolToName(type.symbol, true); + return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); + } + function symbolToParameterDeclaration(parameterSymbol) { + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 145); + var parameterType = getTypeOfSymbol(parameterSymbol); + var parameterTypeNode = typeToTypeNodeHelper(parameterType); + var parameterNode = ts.createParameter(parameterDeclaration.decorators, parameterDeclaration.modifiers, parameterDeclaration.dotDotDotToken && ts.createToken(23), ts.getSynthesizedClone(parameterDeclaration.name), parameterDeclaration.questionToken && ts.createToken(54), parameterTypeNode, parameterDeclaration.initializer); + return parameterNode; + } + function symbolToName(symbol, expectsIdentifier) { + var chain; + var isTypeParameter = symbol.flags & 262144; + if (!isTypeParameter && context.enclosingDeclaration) { + chain = getSymbolChain(symbol, 0, true); + ts.Debug.assert(chain && chain.length > 0); + } + else { + chain = [symbol]; + } + if (expectsIdentifier && chain.length !== 1 + && !context.encounteredError + && !(context.flags & ts.NodeBuilderFlags.allowQualifedNameInPlaceOfIdentifier)) { + context.encounteredError = true; + } + return createEntityNameFromSymbolChain(chain, chain.length - 1); + function createEntityNameFromSymbolChain(chain, index) { + ts.Debug.assert(chain && 0 <= index && index < chain.length); + var symbol = chain[index]; + var typeParameterString = ""; + if (index > 0) { + var parentSymbol = chain[index - 1]; + var typeParameters = void 0; + if (getCheckFlags(symbol) & 1) { + typeParameters = getTypeParametersOfClassOrInterface(parentSymbol); + } + else { + var targetSymbol = getTargetSymbol(parentSymbol); + if (targetSymbol.flags & (32 | 64 | 524288)) { + typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + } + } + if (typeParameters && typeParameters.length > 0) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowTypeParameterInQualifiedName)) { + context.encounteredError = true; + } + var writer = ts.getSingleLineStringWriter(); + var displayBuilder = getSymbolDisplayBuilder(); + displayBuilder.buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, context.enclosingDeclaration, 0); + typeParameterString = writer.string(); + ts.releaseStringWriter(writer); + } + } + var symbolName = getNameOfSymbol(symbol); + var symbolNameWithTypeParameters = typeParameterString.length > 0 ? symbolName + "<" + typeParameterString + ">" : symbolName; + var identifier = ts.createIdentifier(symbolNameWithTypeParameters); + return index > 0 ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier; + } + function getSymbolChain(symbol, meaning, endOfChain) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, false); + var parentSymbol; + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + var parentChain = getSymbolChain(parent, getQualifiedLeftMeaning(meaning), false); + if (parentChain) { + parentSymbol = parent; + accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [symbol]); + } + } + } + if (accessibleSymbolChain) { + return accessibleSymbolChain; + } + if (endOfChain || + !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) && + !(symbol.flags & (2048 | 4096))) { + return [symbol]; + } + } + function getNameOfSymbol(symbol) { + var declaration = ts.firstOrUndefined(symbol.declarations); + if (declaration) { + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225) { + return ts.declarationNameToString(declaration.parent.name); + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowAnonymousIdentifier)) { + context.encounteredError = true; + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; + } + } + return symbol.name; + } + } + } function typePredicateToString(typePredicate, enclosingDeclaration, flags) { var writer = ts.getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); @@ -22567,11 +25377,8 @@ var ts; } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { - var node = type.symbol.declarations[0].parent; - while (node.kind === 166) { - node = node.parent; - } - if (node.kind === 228) { + var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 167; }); + if (node.kind === 230) { return getSymbolOfNode(node); } } @@ -22579,29 +25386,32 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 && + node.parent.kind === 233 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197: - return "(Anonymous class)"; - case 184: - case 185: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225) { + return ts.declarationNameToString(declaration.parent.name); + } + switch (declaration.kind) { + case 198: + return "(Anonymous class)"; + case 185: + case 186: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { function appendSymbolNameOnly(symbol, writer) { writer.writeSymbol(getNameOfSymbol(symbol), symbol); } @@ -22629,7 +25439,7 @@ var ts; function appendParentTypeArgumentsAndSymbolName(symbol) { if (parentSymbol) { if (flags & 1) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { @@ -22648,9 +25458,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22680,7 +25490,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { var nextFlags = flags & ~512; - if (type.flags & 16015) { + if (type.flags & 16793231) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -22705,7 +25515,7 @@ var ts; else if (!(flags & 512) && type.aliasSymbol && isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) { var typeArguments = type.aliasTypeArguments; - writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); + writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, ts.length(typeArguments), nextFlags); } else if (type.flags & 196608) { writeUnionOrIntersectionType(type, nextFlags); @@ -22780,15 +25590,15 @@ var ts; var outerTypeParameters = type.target.outerTypeParameters; var i = 0; if (outerTypeParameters) { - var length_1 = outerTypeParameters.length; - while (i < length_1) { + var length_2 = outerTypeParameters.length; + while (i < length_2) { var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22814,7 +25624,8 @@ var ts; function writeAnonymousType(type, flags) { var symbol = type.symbol; if (symbol) { - if (symbol.flags & (32 | 384 | 512)) { + if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 | 512)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -22847,7 +25658,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 || declaration.parent.kind === 231; + return declaration.parent.kind === 264 || declaration.parent.kind === 233; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -22860,32 +25671,13 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130); - writeSpace(writer); - } - writePunctuation(writer, 20); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21); - writePunctuation(writer, 55); - writeSpace(writer); - writeType(info.type, 0); - writePunctuation(writer, 24); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130); writeSpace(writer); } buildSymbolDisplay(prop, writer); - if (prop.flags & 536870912) { + if (prop.flags & 67108864) { writePunctuation(writer, 54); } } @@ -22961,15 +25753,15 @@ var ts; writePunctuation(writer, 24); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134); - writeIndexSignature(resolved.numberIndexInfo, 132); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { - var signature = signatures_1[_f]; + for (var _f = 0, signatures_2 = signatures; _f < signatures_2.length; _f++) { + var signature = signatures_2[_f]; writePropertyWithModifiers(p); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, undefined, symbolStack); writePunctuation(writer, 24); @@ -23028,32 +25820,43 @@ var ts; writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } + var defaultType = getDefaultFromTypeParameter(tp); + if (defaultType) { + writeSpace(writer); + writePunctuation(writer, 57); + writeSpace(writer); + buildTypeDisplay(defaultType, writer, enclosingDeclaration, flags, symbolStack); + } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; - if (ts.isRestParameter(parameterNode)) { + if (parameterNode ? ts.isRestParameter(parameterNode) : isTransientSymbol(p) && p.isRestParameter) { writePunctuation(writer, 23); } - if (ts.isBindingPattern(parameterNode.name)) { + if (parameterNode && ts.isBindingPattern(parameterNode.name)) { buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); } else { appendSymbolNameOnly(p, writer); } - if (isOptionalParameter(parameterNode)) { + if (parameterNode && isOptionalParameter(parameterNode)) { writePunctuation(writer, 54); } writePunctuation(writer, 55); writeSpace(writer); - buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); + var type = getTypeOfSymbol(p); + if (parameterNode && isRequiredInitializedParameter(parameterNode)) { + type = includeFalsyTypes(type, 2048); + } + buildTypeDisplay(type, writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { writePunctuation(writer, 16); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { writePunctuation(writer, 20); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -23067,9 +25870,9 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174); + ts.Debug.assert(bindingElement.kind === 175); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55); writeSpace(writer); } @@ -23141,6 +25944,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 && isTypeAny(returnType)) { + return; + } if (flags & 8) { writeSpace(writer); writePunctuation(writer, 35); @@ -23153,7 +25960,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -23171,6 +25977,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130); + writeSpace(writer); + } + writePunctuation(writer, 20); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55); + writeSpace(writer); + switch (kind) { + case 1: + writeKeyword(writer, 132); + break; + case 0: + writeKeyword(writer, 135); + break; + } + writePunctuation(writer, 21); + writePunctuation(writer, 55); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -23181,6 +26013,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -23195,63 +26028,63 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174: + case 175: return isDeclarationVisible(node.parent.parent); - case 223: + case 225: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 230: - case 226: - case 227: + case 232: case 228: - case 225: case 229: - case 234: + case 230: + case 227: + case 231: + case 236: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 236 && parent.kind !== 264 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent); + case 148: case 147: - case 146: - case 151: case 152: + case 153: + case 150: case 149: - case 148: if (ts.getModifierFlags(node) & (8 | 16)) { return false; } - case 150: - case 154: - case 153: + case 151: case 155: - case 144: - case 231: - case 158: + case 154: + case 156: + case 145: + case 233: case 159: - case 161: - case 157: + case 160: case 162: + case 158: case 163: case 164: case 165: case 166: + case 167: return isDeclarationVisible(node.parent); - case 236: - case 237: + case 238: case 239: + case 241: return false; - case 143: - case 261: - case 233: + case 144: + case 264: + case 235: return true; - case 240: + case 242: return false; default: return false; @@ -23260,10 +26093,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240) { + if (node.parent && node.parent.kind === 242) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243) { + else if (node.parent.kind === 245) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -23295,8 +26128,8 @@ var ts; function pushTypeResolution(target, propertyName) { var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); if (resolutionCycleStartIndex >= 0) { - var length_2 = resolutionTargets.length; - for (var i = resolutionCycleStartIndex; i < length_2; i++) { + var length_3 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_3; i++) { resolutionResults[i] = false; } return false; @@ -23338,21 +26171,20 @@ var ts; return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = ts.getRootDeclaration(node); - while (node) { + node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 223: - case 224: + case 225: + case 226: + case 241: + case 240: case 239: case 238: - case 237: - case 236: - node = node.parent; - break; + return false; default: - return node.parent; + return true; } - } + }); + return node && node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype)); @@ -23365,32 +26197,34 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192) !== 0; - } function getTypeForBindingElementParent(node) { var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); } function isComputedNonLiteralName(name) { - return name.kind === 142 && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144); }); + if (source.flags & 8192) { + return emptyObjectType; + } + if (source.flags & 65536) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); - for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_19 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_19)] = true; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var name = properties_3[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16); - var isMethod = prop.flags & 8192; var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0); @@ -23410,9 +26244,9 @@ var ts; return parentType; } var type; - if (pattern.kind === 172) { + if (pattern.kind === 173) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } @@ -23426,25 +26260,25 @@ var ts; type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_20 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_20)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } } else { - var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); + var elementType = checkIteratedTypeOrElementType(parentType, pattern, false, false); if (declaration.dotDotDotToken) { type = createArrayType(elementType); } @@ -23471,7 +26305,7 @@ var ts; getUnionType([type, checkExpressionCached(declaration.initializer)], true) : type; } - function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + function getTypeForDeclarationFromJSDocComment(declaration) { var jsdocType = ts.getJSDocType(declaration); if (jsdocType) { return getTypeFromTypeNode(jsdocType); @@ -23484,33 +26318,35 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 && expr.elements.length === 0; + return expr.kind === 176 && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152) { - var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + if (declaration.flags & 65536) { + var type = getTypeForDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } - if (declaration.parent.parent.kind === 212) { + if (declaration.parent.parent.kind === 214) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213) { - return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; + if (declaration.parent.parent.kind === 215) { + var forOfStatement = declaration.parent.parent; + return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); + var declaredType = getTypeFromTypeNode(declaration.type); + return addOptionality(declaredType, declaration.questionToken && includeOptionality); } - if ((compilerOptions.noImplicitAny || declaration.flags & 2097152) && - declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + if ((noImplicitAny || declaration.flags & 65536) && + declaration.kind === 225 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23519,10 +26355,10 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var func = declaration.parent; - if (func.kind === 152 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151); + if (func.kind === 153 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -23548,7 +26384,10 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 258) { + if (ts.isJsxAttribute(declaration)) { + return trueType; + } + if (declaration.kind === 261) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -23556,6 +26395,37 @@ var ts; } return undefined; } + function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol) { + var types = []; + var definedInConstructor = false; + var definedInMethod = false; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var expression = declaration.kind === 193 ? declaration : + declaration.kind === 178 ? ts.getAncestor(declaration, 193) : + undefined; + if (!expression) { + return unknownType; + } + if (ts.isPropertyAccessExpression(expression.left) && expression.left.expression.kind === 98) { + if (ts.getThisContainer(expression, false).kind === 151) { + definedInConstructor = true; + } + else { + definedInMethod = true; + } + } + if (expression.flags & 65536) { + var type = getTypeForDeclarationFromJSDocComment(expression.parent); + if (type && type !== unknownType) { + types.push(getWidenedType(type)); + continue; + } + } + types.push(getWidenedLiteralType(checkExpressionCached(expression.right))); + } + return getWidenedType(addOptionality(getUnionType(types, true), definedInMethod && !definedInConstructor)); + } function getTypeFromBindingElement(element, includePatternInType, reportErrors) { if (element.initializer) { return checkDeclarationInitializer(element); @@ -23563,28 +26433,33 @@ var ts; if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); } - if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + if (reportErrors && noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAnyError(element, anyType); } return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { + if (isComputedNonLiteralName(name)) { hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, false); + return; + } var text = ts.getTextOfPropertyName(name); - var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); + var flags = 4 | (e.initializer ? 67108864 : 0); var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -23608,7 +26483,7 @@ var ts; return result; } function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 + return pattern.kind === 173 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -23618,13 +26493,13 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 257) { + if (declaration.kind === 260) { return type; } return getWidenedType(type); } type = declaration.dotDotDotToken ? anyArrayType : anyType; - if (reportErrors && compilerOptions.noImplicitAny) { + if (reportErrors && noImplicitAny) { if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } @@ -23633,56 +26508,38 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 ? root.parent : root; + var memberDeclaration = root.kind === 145 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.flags & 134217728) { + if (symbol.flags & 16777216) { return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 240) { + if (declaration.kind === 242) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 && declaration.kind === 286 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 290 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = void 0; - if (declaration.kind === 192 || - declaration.kind === 177 && declaration.parent.kind === 192) { - if (declaration.flags & 2097152) { - var jsdocType = ts.getJSDocType(declaration.parent); - if (jsdocType) { - return links.type = getTypeFromTypeNode(jsdocType); - } - } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 ? - checkExpressionCached(decl.right) : - checkExpressionCached(decl.parent.right); }); - type = getUnionType(declaredTypes, true); + if (declaration.kind === 193 || + declaration.kind === 178 && declaration.parent.kind === 193) { + type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else { type = getWidenedTypeForVariableLikeDeclaration(declaration, true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -23690,7 +26547,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151) { + if (accessor.kind === 152) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -23710,10 +26567,10 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151); - var setter = ts.getDeclarationOfKind(symbol, 152); - if (getter && getter.flags & 2097152) { - var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + var getter = ts.getDeclarationOfKind(symbol, 152); + var setter = ts.getDeclarationOfKind(symbol, 153); + if (getter && getter.flags & 65536) { + var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; } @@ -23736,7 +26593,7 @@ var ts; type = getReturnTypeFromBody(getter); } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { if (setter) { error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); } @@ -23751,8 +26608,8 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151); + if (noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 152); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -23760,6 +26617,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -23768,8 +26629,13 @@ var ts; } else { var type = createObjectType(16, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 ? - includeFalsyTypes(type, 2048) : type; + if (symbol.flags & 32) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 67108864 ? includeFalsyTypes(type, 2048) : type; + } } } return links.type; @@ -23794,12 +26660,37 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (symbolInstantiationDepth === 100) { + error(symbol.valueDeclaration, ts.Diagnostics.Generic_type_instantiation_is_excessively_deep_and_possibly_infinite); + links.type = unknownType; + } + else { + if (!pushTypeResolution(symbol, 0)) { + return unknownType; + } + symbolInstantiationDepth++; + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + symbolInstantiationDepth--; + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; + } } return links.type; } + function reportCircularityError(symbol) { + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + if (noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { return getTypeOfInstantiatedSymbol(symbol); } if (symbol.flags & (3 | 4)) { @@ -23819,19 +26710,30 @@ var ts; } return unknownType; } + function isReferenceToType(type, target) { + return type !== undefined + && target !== undefined + && (getObjectFlags(type) & 4) !== 0 + && type.target === target; + } function getTargetType(type) { return getObjectFlags(type) & 4 ? type.target : type; } function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 | 4)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072) { + return ts.forEach(type.types, check); + } } } function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { - var declaration = declarations_2[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -23848,9 +26750,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 || node.kind === 197 || - node.kind === 225 || node.kind === 184 || - node.kind === 149 || node.kind === 185) { + if (node.kind === 228 || node.kind === 198 || + node.kind === 227 || node.kind === 185 || + node.kind === 150 || node.kind === 186) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -23859,15 +26761,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 || node.kind === 226 || - node.kind === 197 || node.kind === 228) { + if (node.kind === 229 || node.kind === 228 || + node.kind === 198 || node.kind === 230) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -23879,18 +26781,34 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 && getSignaturesOfType(type, 1).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1).length > 0) { + return true; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type); + return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); } - function getConstructorsForTypeArguments(type, typeArgumentNodes) { - var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; - return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; }); + function getConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var typeArgCount = ts.length(typeArgumentNodes); + var isJavaScript = ts.isInJavaScriptFile(location); + return ts.filter(getSignaturesOfType(type, 1), function (sig) { return (isJavaScript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts.length(sig.typeParameters); }); } - function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { - var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); + function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location); if (typeArgumentNodes) { var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); @@ -23907,14 +26825,14 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); return type.resolvedBaseConstructorType = unknownType; } - if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { + if (!(baseConstructorType.flags & 1) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); return type.resolvedBaseConstructorType = unknownType; } @@ -23943,8 +26861,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 | 131072 | 1))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -23954,8 +26872,11 @@ var ts; areAllOuterTypeParametersApplied(originalBaseType)) { baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } + else if (baseConstructorType.flags & 1) { + baseType = baseConstructorType; + } else { - var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -23972,7 +26893,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -23996,16 +26917,20 @@ var ts; } return true; } + function isValidBaseType(type) { + return type.flags & (32768 | 16777216 | 1) && !isGenericMappedType(type) || + type.flags & 131072 && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -24029,7 +26954,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227) { + if (declaration.kind === 229) { if (declaration.flags & 64) { return false; } @@ -24062,7 +26987,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -24079,7 +27004,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285); + var declaration = ts.getDeclarationOfKind(symbol, 289); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24090,7 +27015,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228); + declaration = ts.getDeclarationOfKind(symbol, 230); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -24098,7 +27023,7 @@ var ts; if (typeParameters) { links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -24115,14 +27040,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8 || - expr.kind === 70 && !!symbol.exports[expr.text]; + expr.kind === 70 && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 231) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -24147,10 +27072,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 231) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -24167,7 +27092,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -24188,9 +27113,6 @@ var ts; if (!links.declaredType) { var type = createType(16384); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -24203,7 +27125,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216) === 0); if (symbol.flags & (32 | 64)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -24238,19 +27159,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 136: + case 133: case 104: - case 137: + case 138: case 94: case 129: - case 171: + case 172: return true; - case 162: + case 163: return isIndependentType(node.elementType); - case 157: + case 158: return isIndependentTypeReference(node); } return false; @@ -24259,7 +27181,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -24275,12 +27197,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { + case 148: case 147: - case 146: return isIndependentVariableLikeDeclaration(declaration); - case 149: - case 148: case 150: + case 149: + case 151: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -24291,7 +27213,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -24299,15 +27221,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -24315,8 +27237,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1); } @@ -24324,7 +27246,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -24360,10 +27289,14 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0); + if (!stringIndexInfo) { + stringIndexInfo = instantiatedBaseType === anyType ? + createIndexInfo(anyType, false) : + getIndexInfoOfType(instantiatedBaseType, 0); + } numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1); } } @@ -24402,14 +27335,16 @@ var ts; return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); + var isJavaScript = ts.isInJavaScriptFile(baseTypeNode); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); - var typeArgCount = typeArguments ? typeArguments.length : 0; + var typeArgCount = ts.length(typeArguments); var result = []; for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { var baseSig = baseSignatures_1[_i]; - var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; - if (typeParamCount === typeArgCount) { - var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + var minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters); + var typeParamCount = ts.length(baseSig.typeParameters); + if ((isJavaScript || typeArgCount >= minTypeArgumentCount) && typeArgCount <= typeParamCount) { + var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, baseTypeNode)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; sig.resolvedReturnType = classType; result.push(sig); @@ -24463,7 +27398,7 @@ var ts; s = cloneSignature(signature); if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) { var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), true); - s.thisParameter = createTransientSymbol(signature.thisParameter, thisType); + s.thisParameter = createSymbolWithType(signature.thisParameter, thisType); } s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -24478,8 +27413,8 @@ var ts; function getUnionIndexInfo(types, kind) { var indexTypes = []; var isAnyReadonly = false; - for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { - var type = types_1[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type = types_2[_i]; var indexInfo = getIndexInfoOfType(type, kind); if (!indexInfo) { return undefined; @@ -24505,17 +27440,44 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -24531,8 +27493,8 @@ var ts; } else if (symbol.flags & 2048) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -24540,23 +27502,27 @@ var ts; else { var members = emptySymbols; var constructSignatures = emptyArray; - if (symbol.flags & 1952) { + var stringIndexInfo = undefined; + if (symbol.exports) { members = getExportsOfSymbol(symbol); } if (symbol.flags & 32) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768) { + if (baseConstructorType.flags & (32768 | 131072 | 540672)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); + } + else if (baseConstructorType === anyType) { + stringIndexInfo = createIndexInfo(anyType, false); } } var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; - setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, constructSignatures, stringIndexInfo, numberIndexInfo); if (symbol.flags & (16 | 8192)) { type.callSignatures = getSignaturesOfSymbol(symbol); } @@ -24565,37 +27531,48 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 169) { + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } + if (getIndexInfoOfType(modifiersType, 0)) { + addMemberForKeyType(stringType); + } + } + else { + var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t, propertySymbol) { + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - if (t.flags & (32 | 64 | 256)) { + if (t.flags & 32) { var propName = t.text; - var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; - members[propName] = prop; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 67108864); + var prop = createSymbol(4 | (isOptional ? 67108864 : 0), propName); + prop.checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? 8 : 0; + prop.type = propType; + if (propertySymbol) { + prop.syntheticOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2) { - stringIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - else if (t.flags & 4) { - numberIndexInfo = createIndexInfo(propType, isReadonly); - } - }); - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -24608,16 +27585,28 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 169) { + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint && constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; } function isGenericMappedType(type) { if (getObjectFlags(type) & 32) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 | 262144)); + return maybeTypeOfKind(constraintType, 540672 | 262144); } return false; } @@ -24655,35 +27644,33 @@ var ts; function getPropertyOfObjectType(type, name) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - if (type.flags & 65536) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - if (!(prop.flags & 268435456 && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + if (type.flags & 65536) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -24691,41 +27678,126 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } - function getApparentTypeOfTypeParameter(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); - while (constraintType && constraintType.flags & 16384) { - constraintType = getConstraintOfTypeParameter(constraintType); + function getConstraintOfType(type) { + return type.flags & 16384 ? getConstraintOfTypeParameter(type) : + type.flags & 524288 ? getConstraintOfIndexedAccess(type) : + getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getConstraintOfIndexedAccess(type) { + var baseObjectType = getBaseConstraintOfType(type.objectType); + var baseIndexType = getBaseConstraintOfType(type.indexType); + return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; + } + function getBaseConstraintOfType(type) { + if (type.flags & (540672 | 196608)) { + var constraint = getResolvedBaseConstraint(type); + if (constraint !== noConstraintType && constraint !== circularConstraintType) { + return constraint; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } - return type.resolvedApparentType; + else if (type.flags & 262144) { + return stringType; + } + return undefined; } - function getApparentTypeOfIndexedAccess(type) { - return getIndexTypeOfType(getApparentType(type.objectType), 0) || type; + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type_2 = types_3[_i]; + var baseType = getBaseConstraint(type_2); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & 262144) { + return stringType; + } + if (t.flags & 524288) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; + } + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); + } + function getDefaultFromTypeParameter(typeParameter) { + if (!typeParameter.default) { + if (typeParameter.target) { + var targetDefault = getDefaultFromTypeParameter(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType; + } + else { + var defaultDeclaration = typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameter(decl) && decl.default; }); + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; + } + } + return typeParameter.default === noConstraintType ? undefined : typeParameter.default; } function getApparentType(type) { - var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) : - type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) : - type; - return t.flags & 262178 ? globalStringType : - t.flags & 340 ? globalNumberType : - t.flags & 136 ? globalBooleanType : - t.flags & 512 ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 ? globalStringType : + t.flags & 340 ? globalNumberType : + t.flags & 136 ? globalBooleanType : + t.flags & 512 ? getGlobalESSymbolType(languageVersion >= 2) : + t.flags & 16777216 ? emptyObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { - var types = containingType.types; var props; - var commonFlags = (containingType.flags & 131072) ? 536870912 : 0; - var isReadonly = false; - var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + var types = containingType.types; + var isUnion = containingType.flags & 65536; + var excludeModifiers = isUnion ? 24 : 0; + var commonFlags = isUnion ? 0 : 67108864; + var syntheticFlag = 4; + var checkFlags = 0; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var current = types_4[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))) { + var modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; + if (prop && !(modifiers & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -24733,25 +27805,29 @@ var ts; else if (!ts.contains(props, prop)) { props.push(prop); } - if (isReadonlySymbol(prop)) { - isReadonly = true; + checkFlags |= (isReadonlySymbol(prop) ? 8 : 0) | + (!(modifiers & 24) ? 64 : 0) | + (modifiers & 16 ? 128 : 0) | + (modifiers & 8 ? 256 : 0) | + (modifiers & 32 ? 512 : 0); + if (!isMethodLike(prop)) { + syntheticFlag = 2; } } - else if (containingType.flags & 65536) { - isPartial = true; + else if (isUnion) { + checkFlags |= 16; } } } if (!props) { return undefined; } - if (props.length === 1 && !isPartial) { + if (props.length === 1 && !(checkFlags & 16)) { return props[0]; } var propTypes = []; var declarations = []; var commonType = undefined; - var hasNonUniformType = false; for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { var prop = props_1[_a]; if (prop.declarations) { @@ -24762,39 +27838,37 @@ var ts; commonType = type; } else if (type !== commonType) { - hasNonUniformType = true; + checkFlags |= 32; } propTypes.push(type); } - var result = createSymbol(4 | 67108864 | 268435456 | commonFlags, name); + var result = createSymbol(4 | commonFlags, name); + result.checkFlags = syntheticFlag | checkFlags; result.containingType = containingType; - result.hasNonUniformType = hasNonUniformType; - result.isPartial = isPartial; result.declarations = declarations; - result.isReadonly = isReadonly; - result.type = containingType.flags & 65536 ? getUnionType(propTypes) : getIntersectionType(propTypes); + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); return result; } function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; } function getPropertyOfUnionOrIntersectionType(type, name) { var property = getUnionOrIntersectionProperty(type, name); - return property && !(property.flags & 268435456 && property.isPartial) ? property : undefined; + return property && !(getCheckFlags(property) & 16) ? property : undefined; } function getPropertyOfType(type, name) { type = getApparentType(type); if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -24853,7 +27927,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -24873,16 +27947,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152) { - if (node.type && node.type.kind === 273) { + if (node.flags & 65536) { + if (node.type && node.type.kind === 277) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -24893,7 +27967,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + return paramTag.typeExpression.type.kind === 277; } } } @@ -24917,6 +27991,12 @@ var ts; ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } + var iife = ts.getImmediatelyInvokedFunctionExpression(node.parent); + if (iife) { + return !node.type && + !node.dotDotDotToken && + ts.indexOf(node.parent.parameters, node) >= iife.arguments.length; + } return false; } function createTypePredicateFromTypePredicateNode(node) { @@ -24936,16 +28016,50 @@ var ts; }; } } + function getMinTypeArgumentCount(typeParameters) { + var minTypeArgumentCount = 0; + if (typeParameters) { + for (var i = 0; i < typeParameters.length; i++) { + if (!getDefaultFromTypeParameter(typeParameters[i])) { + minTypeArgumentCount = i + 1; + } + } + } + return minTypeArgumentCount; + } + function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, location) { + var numTypeParameters = ts.length(typeParameters); + if (numTypeParameters) { + var numTypeArguments = ts.length(typeArguments); + var isJavaScript = ts.isInJavaScriptFile(location); + if ((isJavaScript || numTypeArguments >= minTypeArgumentCount) && numTypeArguments <= numTypeParameters) { + if (!typeArguments) { + typeArguments = []; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + typeArguments[i] = isJavaScript ? anyType : emptyObjectType; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + var mapper = createTypeMapper(typeParameters, typeArguments); + var defaultType = getDefaultFromTypeParameter(typeParameters[i]); + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : isJavaScript ? anyType : emptyObjectType; + } + } + } + return typeArguments; + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + var isUntypedSignatureInJSFile = !iife && !isJSConstructSignature && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration); + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { @@ -24959,41 +28073,34 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171) { + if (param.type && param.type.kind === 172) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - minArgumentCount = -1; + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param) || + isUntypedSignatureInJSFile; + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } - if ((declaration.kind === 151 || declaration.kind === 152) && + if ((declaration.kind === 152 || declaration.kind === 153) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 ? 152 : 151; + var otherKind = declaration.kind === 152 ? 153 : 152; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 ? + var classType = declaration.kind === 151 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 ? + var typePredicate = declaration.type && declaration.type.kind === 157 ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -25010,41 +28117,69 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152) { + if (declaration.flags & 65536) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } - if (declaration.kind === 151 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152); + if (declaration.kind === 152 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { return anyType; } } + function containsArgumentsReference(declaration) { + var links = getNodeLinks(declaration); + if (links.containsArgumentsReference === undefined) { + if (links.flags & 8192) { + links.containsArgumentsReference = true; + } + else { + links.containsArgumentsReference = traverse(declaration.body); + } + } + return links.containsArgumentsReference; + function traverse(node) { + if (!node) + return false; + switch (node.kind) { + case 70: + return node.text === "arguments" && ts.isPartOfExpression(node); + case 148: + case 150: + case 152: + case 153: + return node.name.kind === 143 + && traverse(node.name); + default: + return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && ts.forEachChild(node, traverse); + } + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158: case 159: - case 225: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 274: + case 186: + case 278: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -25088,7 +28223,7 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { var declaration = signature.declaration; if (declaration.name) { error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); @@ -25112,9 +28247,14 @@ var ts; return anyType; } function getSignatureInstantiation(signature, typeArguments) { + typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters)); var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); @@ -25129,7 +28269,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 || signature.declaration.kind === 154; + var isConstructor = signature.declaration.kind === 151 || signature.declaration.kind === 155; var type = createObjectType(16); type.members = emptySymbols; type.properties = emptyArray; @@ -25140,10 +28280,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 132 : 134; + var syntaxKind = kind === 1 ? 132 : 135; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -25170,21 +28310,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143).constraint; + return ts.getDeclarationOfKind(type.symbol, 144).constraint; } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; - } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -25192,28 +28320,23 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144).parent); } function getTypeListId(types) { var result = ""; if (types) { - var length_3 = types.length; + var length_4 = types.length; var i = 0; - while (i < length_3) { + while (i < length_4) { var startId = types[i].id; var count = 1; - while (i + count < length_3 && types[i + count].id === startId + count) { + while (i + count < length_4 && types[i + count].id === startId + count) { count++; } if (result.length) { @@ -25230,8 +28353,8 @@ var ts; } function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -25240,9 +28363,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4, target.symbol); + type = createObjectType(4, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -25258,17 +28382,22 @@ var ts; return type; } function getTypeReferenceArity(type) { - return type.target.typeParameters ? type.target.typeParameters.length : 0; + return ts.length(type.target.typeParameters); } function getTypeFromClassOrInterfaceReference(node, symbol) { var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (!ts.isInJavaScriptFile(node) && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, typeToString(type, undefined, 1), minTypeArgumentCount, typeParameters.length); return unknownType; } - return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode))); + var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, minTypeArgumentCount, node)); + return createTypeReference(type, typeArguments); } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); @@ -25281,14 +28410,22 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); + } + return instantiation; } function getTypeFromTypeAliasReference(node, symbol) { var type = getDeclaredTypeOfSymbol(symbol); var typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length); return unknownType; } var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode); @@ -25309,11 +28446,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157: + case 158: return node.typeName; - case 272: + case 276: return node.name; - case 199: + case 200: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -25337,23 +28474,58 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 272) { + if (symbol.flags & 107455 && node.kind === 276) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); } + function getPrimitiveTypeFromJSDocTypeReference(node) { + if (ts.isIdentifier(node.name)) { + switch (node.name.text) { + case "String": + return stringType; + case "Number": + return numberType; + case "Boolean": + return booleanType; + case "Void": + return voidType; + case "Undefined": + return undefinedType; + case "Null": + return nullType; + case "Object": + return anyType; + case "Function": + return anyFunctionType; + case "Array": + case "array": + return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined; + case "Promise": + case "promise": + return !node.typeArguments || !node.typeArguments.length ? createPromiseType(anyType) : undefined; + } + } + } + function getTypeFromJSDocNullableTypeNode(node) { + var type = getTypeFromTypeNode(node.type); + return strictNullChecks ? getUnionType([type, nullType]) : type; + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272) { - var typeReferenceName = getTypeReferenceName(node); - symbol = resolveTypeReferenceName(typeReferenceName); - type = getTypeReferenceType(node, symbol); + if (node.kind === 276) { + type = getPrimitiveTypeFromJSDocTypeReference(node); + if (!type) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(typeReferenceName); + type = getTypeReferenceType(node, symbol); + } } else { - var typeNameOrExpression = node.kind === 157 + var typeNameOrExpression = node.kind === 158 ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -25379,12 +28551,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { - var declaration = declarations_3[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var declaration = declarations_4[_i]; switch (declaration.kind) { - case 226: - case 227: + case 228: case 229: + case 231: return declaration; } } @@ -25397,44 +28569,91 @@ var ts; error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return arity ? emptyGenericType : emptyObjectType; } - if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + if (ts.length(type.typeParameters) !== arity) { error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); return arity ? emptyGenericType : emptyObjectType; } return type; } - function getGlobalValueSymbol(name) { - return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + function getGlobalValueSymbol(name, reportErrors) { + return getGlobalSymbol(name, 107455, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined); } - function getGlobalTypeSymbol(name) { - return getGlobalSymbol(name, 793064, ts.Diagnostics.Cannot_find_global_type_0); + function getGlobalTypeSymbol(name, reportErrors) { + return getGlobalSymbol(name, 793064, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined); } function getGlobalSymbol(name, meaning, diagnostic) { return resolveName(undefined, name, meaning, diagnostic, name); } - function getGlobalType(name, arity) { + function getGlobalType(name, arity, reportErrors) { + var symbol = getGlobalTypeSymbol(name, reportErrors); + return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : undefined; + } + function getGlobalTypedPropertyDescriptorType() { + return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", 1, true)) || emptyGenericType; + } + function getGlobalTemplateStringsArrayType() { + return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", 0, true)) || emptyObjectType; + } + function getGlobalESSymbolConstructorSymbol(reportErrors) { + return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)); + } + function getGlobalESSymbolType(reportErrors) { + return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", 0, reportErrors)) || emptyObjectType; + } + function getGlobalPromiseType(reportErrors) { + return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", 1, reportErrors)) || emptyGenericType; + } + function getGlobalPromiseConstructorSymbol(reportErrors) { + return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)); + } + function getGlobalPromiseConstructorLikeType(reportErrors) { + return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", 0, reportErrors)) || emptyObjectType; + } + function getGlobalAsyncIterableType(reportErrors) { + return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIteratorType(reportErrors) { + return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIterableIteratorType(reportErrors) { + return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableType(reportErrors) { + return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIteratorType(reportErrors) { + return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableIteratorType(reportErrors) { + return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", 1, reportErrors)) || emptyGenericType; + } + function getGlobalTypeOrUndefined(name, arity) { if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); + var symbol = getGlobalSymbol(name, 793064, undefined); + return symbol && getTypeOfGlobalSymbol(symbol, arity); } function getExportedTypeFromNamespace(namespace, name) { var namespaceSymbol = getGlobalSymbol(namespace, 1920, undefined); var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function createTypedPropertyDescriptorType(propertyType) { - var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyGenericType - ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) - : emptyObjectType; - } function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } - function createIterableType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); + function createTypedPropertyDescriptorType(propertyType) { + return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); + } + function createAsyncIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableType(true), [iteratedType]); + } + function createAsyncIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableIteratorType(true), [iteratedType]); + } + function createIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableType(true), [iteratedType]); } - function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); + function createIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(true), [iteratedType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -25452,7 +28671,7 @@ var ts; for (var i = 0; i < arity; i++) { var typeParameter = createType(16384); typeParameters.push(typeParameter); - var property = createSymbol(4 | 67108864, "" + i); + var property = createSymbol(4, "" + i); property.type = typeParameter; properties.push(property); } @@ -25461,7 +28680,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384); @@ -25543,14 +28762,14 @@ var ts; } } function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -25558,8 +28777,9 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -25637,10 +28857,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, 6144); - type = unionTypes[id] = createType(65536 | propagatedFlags); + type = createType(65536 | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25661,13 +28882,25 @@ var ts; else if (type.flags & 1) { typeSet.containsAny = true; } + else if (getObjectFlags(type) & 16 && isEmptyObjectType(type)) { + typeSet.containsEmptyObject = true; + } else if (!(type.flags & 8192) && (strictNullChecks || !(type.flags & 6144)) && !ts.contains(typeSet, type)) { - typeSet.push(type); + if (type.flags & 32768) { + typeSet.containsObjectType = true; + } + if (type.flags & 65536 && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } + if (!(type.flags & 32768 && type.objectFlags & 16 && + type.symbol && type.symbol.flags & (16 | 8192) && containsIdenticalType(typeSet, type))) { + typeSet.push(type); + } } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var type = types_9[_i]; addTypeToIntersection(typeSet, type); } } @@ -25675,30 +28908,28 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { return anyType; } + if (typeSet.containsEmptyObject && !typeSet.containsObjectType) { + typeSet.push(emptyObjectType); + } if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 6144); - type = intersectionTypes[id] = createType(131072 | propagatedFlags); + type = createType(131072 | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -25712,7 +28943,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144); type.resolvedIndexType.type = type; @@ -25728,7 +28959,7 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 ? getIndexTypeForTypeParameter(type) : + return maybeTypeOfKind(type, 540672) ? getIndexTypeForGenericType(type) : getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) : type.flags & 1 || getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromPropertyNames(type); @@ -25751,7 +28982,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; var propName = indexType.flags & (32 | 64 | 256) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? @@ -25780,14 +29011,14 @@ var ts; getIndexInfoOfType(objectType, 0) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } return indexInfo.type; } if (accessExpression && !isConstEnumObjectType(objectType)) { - if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { if (getIndexTypeOfType(objectType, 1)) { error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); } @@ -25799,7 +29030,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 | 64)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -25809,34 +29040,36 @@ var ts; else { error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); } + return unknownType; } - return unknownType; + return anyType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; - return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken); + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384 || - objectType.flags & 16384 && indexType.flags & 262144 || + if (maybeTypeOfKind(indexType, 540672 | 262144) || + maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 179) || isGenericMappedType(objectType)) { - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } + if (objectType.flags & 1) { + return objectType; } if (isGenericMappedType(objectType)) { return getIndexedAccessForMappedType(objectType, indexType, accessNode); } var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 && !(indexType.flags & 8190)) { @@ -25876,7 +29109,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -25889,17 +29122,33 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } - function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 | 1)) && !!(right.flags & (32768 | 1)), "Only object types may be spread."); + function getSpreadType(left, right) { if (left.flags & 1 || right.flags & 1) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144); }); + if (left.flags & 8192) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144); }); + if (right.flags & 8192) { + return left; + } + if (left.flags & 65536) { + return mapType(left, function (t) { return getSpreadType(t, right); }); + } + if (right.flags & 65536) { + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216) { + return emptyObjectType; + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -25914,42 +29163,55 @@ var ts; } for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; - var isOwnProperty = !(rightProp.flags & 8192) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, getNonReadonlySymbol(rightProp)); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 && !(leftProp.flags & 32768) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); - if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 536870912) { + if (maybeTypeOfKind(rightType, 2048) || rightProp.flags & 67108864) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); - var flags = 4 | 67108864 | (leftProp.flags & 536870912); + var flags = 4 | (leftProp.flags & 67108864); var result = createSymbol(flags, leftProp.name); result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072)]); result.leftSpread = leftProp; result.rightSpread = rightProp; result.declarations = declarations; - result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, getNonReadonlySymbol(leftProp)); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function getNonReadonlySymbol(prop) { + if (!isReadonlySymbol(prop)) { + return prop; + } + var flags = 4 | (prop.flags & 67108864); + var result = createSymbol(flags, prop.name); + result.type = getTypeOfSymbol(prop); + result.declarations = prop.declarations; + result.syntheticOrigin = prop; + return result; + } + function isClassMethod(prop) { + return prop.flags & 8192 && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -25971,7 +29233,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -25999,9 +29265,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229)) { if (!(ts.getModifierFlags(container) & 32) && - (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -26018,85 +29284,82 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 263: - case 264: + case 267: + case 268: return anyType; - case 134: + case 135: return stringType; case 132: return numberType; case 121: return booleanType; - case 135: + case 136: return esSymbolType; case 104: return voidType; - case 137: + case 138: return undefinedType; case 94: return nullType; case 129: return neverType; - case 289: - return nullType; - case 290: - return undefinedType; - case 291: - return neverType; - case 167: + case 133: + return nonPrimitiveType; + case 168: case 98: return getTypeFromThisTypeNode(node); - case 171: + case 172: return getTypeFromLiteralTypeNode(node); - case 288: + case 292: return getTypeFromLiteralTypeNode(node.literal); - case 157: - case 272: + case 158: + case 276: return getTypeFromTypeReference(node); - case 156: + case 157: return booleanType; - case 199: + case 200: return getTypeFromTypeReference(node); - case 160: + case 161: return getTypeFromTypeQueryNode(node); - case 162: - case 265: - return getTypeFromArrayTypeNode(node); case 163: - return getTypeFromTupleTypeNode(node); + case 269: + return getTypeFromArrayTypeNode(node); case 164: - case 266: - return getTypeFromUnionTypeNode(node); + return getTypeFromTupleTypeNode(node); case 165: - return getTypeFromIntersectionTypeNode(node); + case 270: + return getTypeFromUnionTypeNode(node); case 166: - case 268: - case 269: - case 276: - case 277: + return getTypeFromIntersectionTypeNode(node); + case 272: + return getTypeFromJSDocNullableTypeNode(node); + case 167: case 273: + case 280: + case 281: + case 277: return getTypeFromTypeNode(node.type); - case 270: + case 274: return getTypeFromTypeNode(node.literal); - case 158: case 159: - case 161: - case 287: - case 274: + case 160: + case 162: + case 291: + case 278: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168: - return getTypeFromTypeOperatorNode(node); case 169: - return getTypeFromIndexedAccessTypeNode(node); + return getTypeFromTypeOperatorNode(node); case 170: + return getTypeFromIndexedAccessTypeNode(node); + case 171: return getTypeFromMappedTypeNode(node); case 70: - case 141: + case 142: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267: + case 271: return getTypeFromJSDocTupleType(node); - case 275: + case 279: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -26123,13 +29386,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -26140,16 +29403,20 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } function createTypeEraser(sources) { return createTypeMapper(sources, undefined); } + function createBackreferenceMapper(typeParameters, index) { + var mapper = function (t) { return ts.indexOf(typeParameters, t) >= index ? emptyObjectType : t; }; + mapper.mappedTypes = typeParameters; + return mapper; + } function getInferenceMapper(context) { if (!context.mapper) { var mapper = function (t) { @@ -26173,7 +29440,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -26218,12 +29490,13 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 16777216) { + if (getCheckFlags(symbol) & 1) { var links = getSymbolLinks(symbol); symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); + result.checkFlags = 1; result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -26244,18 +29517,17 @@ var ts; function instantiateMappedType(type, mapper) { var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144) { - var typeParameter_1 = constraintType.type; - var mappedTypeParameter = mapper(typeParameter_1); - if (typeParameter_1 !== mappedTypeParameter) { - return mapType(mappedTypeParameter, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeParameter_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + var typeVariable_1 = constraintType.type; + if (typeVariable_1.flags & 16384) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -26276,26 +29548,28 @@ var ts; return false; } var mappedTypes = mapper.mappedTypes; - var node = symbol.declarations[0].parent; - while (node) { + return !!ts.findAncestor(symbol.declarations[0], function (node) { + if (node.kind === 232 || node.kind === 264) { + return "quit"; + } switch (node.kind) { - case 158: case 159: - case 225: - case 149: - case 148: + case 160: + case 227: case 150: - case 153: + case 149: + case 151: case 154: case 155: - case 151: + case 156: case 152: - case 184: + case 153: case 185: - case 226: - case 197: - case 227: + case 186: case 228: + case 198: + case 229: + case 230: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -26305,25 +29579,34 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227) { + if (ts.isClassLike(node) || node.kind === 229) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230: - case 261: - return false; + case 171: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 278: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; } - node = node.parent; - } - return false; + }); } function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 || parentKind === 231; + return parentKind === 264 || parentKind === 233; } return false; } @@ -26375,28 +29658,34 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184: case 185: + case 186: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return ts.forEach(node.properties, isContextSensitive); - case 175: + case 176: return ts.forEach(node.elements, isContextSensitive); - case 193: + case 194: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192: + case 193: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257: + case 260: return isContextSensitive(node.initializer); + case 150: case 149: - case 148: return isContextSensitiveFunctionLikeDeclaration(node); - case 183: + case 184: return isContextSensitive(node.expression); + case 253: + return ts.forEach(node.properties, isContextSensitive); + case 252: + return node.initializer && isContextSensitive(node.initializer); + case 255: + return node.expression && isContextSensitive(node.expression); } return false; } @@ -26407,7 +29696,7 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !p.type; })) { return true; } - if (node.kind === 185) { + if (node.kind === 186) { return false; } var parameter = ts.firstOrUndefined(node.parameters); @@ -26425,9 +29714,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } function isTypeIdenticalTo(source, target) { @@ -26446,7 +29738,7 @@ var ts; return isTypeRelatedTo(source, target, assignableRelation); } function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -26464,9 +29756,9 @@ var ts; return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { - return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; + return compareSignaturesRelated(source, target, false, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; } - function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + function compareSignaturesRelated(source, target, checkAsCallback, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { if (source === target) { return -1; } @@ -26497,9 +29789,15 @@ var ts; var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); + var sourceType = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var targetType = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var sourceSig = getSingleCallSignature(getNonNullableType(sourceType)); + var targetSig = getSingleCallSignature(getNonNullableType(targetType)); + var callbacks = sourceSig && targetSig && !sourceSig.typePredicate && !targetSig.typePredicate && + (getFalsyFlags(sourceType) & 6144) === (getFalsyFlags(targetType) & 6144); + var related = callbacks ? + compareSignaturesRelated(targetSig, sourceSig, true, false, reportErrors, errorReporter, compareTypes) : + !checkAsCallback && compareTypes(sourceType, targetType, false) || compareTypes(targetType, sourceType, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -26526,7 +29824,8 @@ var ts; } } else { - result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + result &= checkAsCallback && compareTypes(targetReturnType, sourceReturnType, false) || + compareTypes(sourceReturnType, targetReturnType, reportErrors); } } return result; @@ -26589,18 +29888,33 @@ var ts; sourceNonRestParamCount; } } + function isEmptyResolvedType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } + function isEmptyObjectType(type) { + return type.flags & 32768 ? isEmptyResolvedType(resolveStructuredTypeMembers(type)) : + type.flags & 65536 ? ts.forEach(type.types, isEmptyObjectType) : + type.flags & 131072 ? !ts.forEach(type.types, function (t) { return !isEmptyObjectType(t); }) : + false; + } function isEnumTypeRelatedTo(source, target, errorReporter) { if (source === target) { return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256) || (source.flags & 65536) !== (target.flags & 65536)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -26611,11 +29925,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192) @@ -26636,6 +29952,8 @@ var ts; return true; if (source.flags & 4096 && (!strictNullChecks || target.flags & 4096)) return true; + if (source.flags & 32768 && target.flags & 16777216) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1) return true; @@ -26667,13 +29985,13 @@ var ts; } if (source.flags & 32768 && target.flags & 32768) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1; } } - if (source.flags & 507904 || target.flags & 507904) { - return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); + if (source.flags & 1032192 || target.flags & 1032192) { + return checkTypeRelatedTo(source, target, relation, undefined); } return false; } @@ -26727,10 +30045,27 @@ var ts; if ((globalStringType === source && stringType === target) || (globalNumberType === source && numberType === target) || (globalBooleanType === source && booleanType === target) || - (getGlobalESSymbolType() === source && esSymbolType === target)) { + (getGlobalESSymbolType(false) === source && esSymbolType === target)) { reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608)) { + return false; + } + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 && source.flags & 1048576) { @@ -26753,7 +30088,7 @@ var ts; } return 0; } - if (target.flags & 196608) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -26769,91 +30104,24 @@ var ts; return result; } } - else if (target.flags & 65536) { - if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) { - return result; - } - } - else if (target.flags & 131072) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { - return result; - } - } - else if (source.flags & 131072) { - if (result = someTypeRelatedToType(source, target, false)) { - return result; - } - } - if (target.flags & 16384) { - if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { - if (!source.declaration.questionToken) { - var templateType = getTemplateTypeFromMappedType(source); - var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); - if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { - return result; - } - } - } - else { - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } - } - else if (target.flags & 262144) { - if (source.flags & 262144) { - if (result = isRelatedTo(target.type, source.type, false)) { - return result; - } - } - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } - } - } - else if (target.flags & 524288) { - if (source.flags & 524288 && source.indexType === target.indexType) { - if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { - return result; - } - } - } - if (source.flags & 16384) { - if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { - var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); - var templateType = getTemplateTypeFromMappedType(target); - if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + else { + if (target.flags & 65536) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190) && !(target.flags & 8190))) { return result; } } - else { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1) { - constraint = emptyObjectType; - } - constraint = getTypeWithThisArgument(constraint, source); - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; + else if (target.flags & 131072) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - } - else { - if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { - if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + else if (source.flags & 131072) { + if (result = someTypeRelatedToType(source, target, false)) { return result; } } - var apparentSource = getApparentType(source); - if (apparentSource.flags & (32768 | 131072) && target.flags & 32768) { - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + if (source.flags & 1032192 || target.flags & 1032192) { + if (result = recursiveTypeRelatedTo(source, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -26873,12 +30141,7 @@ var ts; function isIdenticalTo(source, target) { var result; if (source.flags & 32768 && target.flags & 32768) { - if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { - if (result = typeArgumentsRelatedTo(source, target, false)) { - return result; - } - } - return objectTypeRelatedTo(source, source, target, false); + return recursiveTypeRelatedTo(source, target, false); } if (source.flags & 65536 && target.flags & 65536 || source.flags & 131072 && target.flags & 131072) { @@ -26890,42 +30153,43 @@ var ts; } return 0; } - function isKnownProperty(type, name) { + function isKnownProperty(type, name, isComparingJsxAttributes) { if (type.flags & 32768) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || - resolved.stringIndexInfo || - (resolved.numberIndexInfo && isNumericLiteralName(name)) || - getPropertyOfType(type, name)) { + if (resolved.stringIndexInfo || resolved.numberIndexInfo && isNumericLiteralName(name) || + getPropertyOfType(type, name) || isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) { return true; } } else if (type.flags & 196608) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; - if (isKnownProperty(t, name)) { + if (isKnownProperty(t, name, isComparingJsxAttributes)) { return true; } } } return false; } - function isEmptyObjectType(t) { - return t.properties.length === 0 && - t.callSignatures.length === 0 && - t.constructSignatures.length === 0 && - !t.stringIndexInfo && - !t.numberIndexInfo; - } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768) && !(getObjectFlags(target) & 512)) { + var isComparingJsxAttributes = !!(source.flags & 33554432); + if ((relation === assignableRelation || relation === comparableRelation) && + (isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) { + return false; + } for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (!isKnownProperty(target, prop.name)) { + if (!isKnownProperty(target, prop.name, isComparingJsxAttributes)) { if (reportErrors) { ts.Debug.assert(!!errorNode); - errorNode = prop.valueDeclaration; - reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + if (ts.isJsxAttributes(errorNode)) { + reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target)); + } + else { + errorNode = prop.valueDeclaration; + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } } return true; } @@ -26951,20 +30215,42 @@ var ts; if (target.flags & 65536 && containsType(targetTypes, source)) { return -1; } - var len = targetTypes.length; - for (var i = 0; i < len; i++) { - var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var type = targetTypes_1[_i]; + var related = isRelatedTo(source, type, false); if (related) { return related; } } + if (reportErrors) { + var discriminantType = findMatchingDiscriminantType(source, target); + isRelatedTo(source, discriminantType || targetTypes[targetTypes.length - 1], true); + } return 0; } + function findMatchingDiscriminantType(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + if (sourceProperties) { + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProperty = sourceProperties_1[_i]; + if (isDiscriminantProperty(target, sourceProperty.name)) { + var sourceType = getTypeOfSymbol(sourceProperty); + for (var _a = 0, _b = target.types; _a < _b.length; _a++) { + var type = _b[_a]; + var targetType = getTypeOfPropertyOfType(type, sourceProperty.name); + if (targetType && isRelatedTo(sourceType, targetType)) { + return type; + } + } + } + } + } + } function typeRelatedToEachType(source, target, reportErrors) { var result = -1; var targetTypes = target.types; - for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { - var targetType = targetTypes_1[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var targetType = targetTypes_2[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0; @@ -27017,15 +30303,15 @@ var ts; } return result; } - function objectTypeRelatedTo(source, originalSource, target, reportErrors) { + function recursiveTypeRelatedTo(source, target, reportErrors) { if (overflow) { return 0; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2) { - relation[id] = 3; + relation.set(id, 3); } else { return related === 1 ? -1 : 0; @@ -27033,7 +30319,7 @@ var ts; } if (depth > 0) { for (var i = 0; i < depth; i++) { - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1; } } @@ -27051,71 +30337,165 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1; + maybeStack[depth].set(id, 1); depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth)) expandingFlags |= 1; - if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) + if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, depth)) expandingFlags |= 2; + var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors) : 1; + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + ts.copyEntries(maybeCache, destinationCache); + } + else { + relation.set(id, reportErrors ? 3 : 2); + } + return result; + } + function structuredTypeRelatedTo(source, target, reportErrors) { var result; - if (expandingFlags === 3) { - result = 1; + var saveErrorInfo = errorInfo; + if (target.flags & 16384) { + if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; + } + } + } } - else if (isGenericMappedType(source) || isGenericMappedType(target)) { - result = mappedTypeRelatedTo(source, target, reportErrors); + else if (target.flags & 262144) { + if (source.flags & 262144) { + if (result = isRelatedTo(target.type, source.type, false)) { + return result; + } + } + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + else if (target.flags & 524288) { + var constraint = getConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + if (source.flags & 16384) { + if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else { + var constraint = getConstraintOfTypeParameter(source); + if (constraint || !(target.flags & 16777216)) { + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + constraint = getTypeWithThisArgument(constraint, source); + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + } + else if (source.flags & 524288) { + var constraint = getConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else if (target.flags & 524288 && source.indexType === target.indexType) { + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } } else { - result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + return result; + } + } + var sourceIsPrimitive = !!(source.flags & 8190); + if (relation !== identityRelation) { + source = getApparentType(source); + } + if (source.flags & (32768 | 131072) && target.flags & 32768) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; + if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportStructuralErrors); + } + else { + result = propertiesRelatedTo(source, target, reportStructuralErrors); if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 0, reportErrors); + result &= signaturesRelatedTo(source, target, 0, reportStructuralErrors); if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 1, reportErrors); + result &= signaturesRelatedTo(source, target, 1, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 0, sourceIsPrimitive, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 1, sourceIsPrimitive, reportStructuralErrors); + } + } } } } + if (result) { + errorInfo = saveErrorInfo; + return result; + } } } - expandingFlags = saveExpandingFlags; - depth--; - if (result) { - var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); - } - else { - relation[id] = reportErrors ? 3 : 2; - } - return result; + return 0; } function mappedTypeRelatedTo(source, target, reportErrors) { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1; + } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + return -1; + } } return 0; } @@ -27126,22 +30506,28 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128); - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var targetProp = properties_3[_i]; + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var targetProp = properties_4[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (!(targetProp.flags & 536870912) || requireOptionalProperties) { + if (!(targetProp.flags & 67108864) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } return 0; } } - else if (!(targetProp.flags & 134217728)) { + else if (!(targetProp.flags & 16777216)) { var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & 8 || targetPropFlags & 8) { + if (getCheckFlags(sourceProp) & 256) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); + } + return 0; + } if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { if (sourcePropFlags & 8 && targetPropFlags & 8) { @@ -27155,12 +30541,9 @@ var ts; } } else if (targetPropFlags & 16) { - var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; - var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); - if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (!isValidOverrideOf(sourceProp, targetProp)) { if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)); } return 0; } @@ -27179,7 +30562,7 @@ var ts; return 0; } result &= related; - if (relation !== comparableRelation && sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { + if (relation !== comparableRelation && sourceProp.flags & 67108864 && !(targetProp.flags & 67108864)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -27200,8 +30583,8 @@ var ts; return 0; } var result = -1; - for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { - var sourceProp = sourceProperties_1[_i]; + for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { + var sourceProp = sourceProperties_2[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -27257,7 +30640,7 @@ var ts; return result; } function signatureRelatedTo(source, target, reportErrors) { - return compareSignaturesRelated(source, target, false, reportErrors, reportError, isRelatedTo); + return compareSignaturesRelated(source, target, false, false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -27266,7 +30649,7 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; @@ -27299,12 +30682,12 @@ var ts; } return related; } - function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + function indexTypesRelatedTo(source, target, kind, sourceIsPrimitive, reportErrors) { if (relation === identityRelation) { return indexTypesIdenticalTo(source, target, kind); } var targetInfo = getIndexInfoOfType(target, kind); - if (!targetInfo || ((targetInfo.type.flags & 1) && !(originalSource.flags & 8190))) { + if (!targetInfo || targetInfo.type.flags & 1 && !sourceIsPrimitive) { return -1; } var sourceInfo = getIndexInfoOfType(source, kind) || @@ -27362,6 +30745,37 @@ var ts; return false; } } + function forEachProperty(prop, callback) { + if (getCheckFlags(prop) & 6) { + for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { + var t = _a[_i]; + var p = getPropertyOfType(t, prop.name); + var result = p && forEachProperty(p, callback); + if (result) { + return result; + } + } + return undefined; + } + return callback(prop); + } + function getDeclaringClass(prop) { + return prop.parent && prop.parent.flags & 32 ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : undefined; + } + function isPropertyInClassDerivedFrom(prop, baseClass) { + return forEachProperty(prop, function (sp) { + var sourceClass = getDeclaringClass(sp); + return sourceClass ? hasBaseType(sourceClass, baseClass) : false; + }); + } + function isValidOverrideOf(sourceProp, targetProp) { + return !forEachProperty(targetProp, function (tp) { return getDeclarationModifierFlagsFromSymbol(tp) & 16 ? + !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; }); + } + function isClassDerivedFromDeclaringClasses(checkClass, prop) { + return forEachProperty(prop, function (p) { return getDeclarationModifierFlagsFromSymbol(p) & 16 ? + !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass; + } function isAbstractConstructorType(type) { if (getObjectFlags(type) & 16) { var symbol = type.symbol; @@ -27374,16 +30788,18 @@ var ts; } return false; } - function isDeeplyNestedGeneric(type, stack, depth) { - if (getObjectFlags(type) & (4 | 64) && depth >= 5) { + function isDeeplyNestedType(type, stack, depth) { + if (depth >= 5 && type.flags & 32768) { var symbol = type.symbol; - var count = 0; - for (var i = 0; i < depth; i++) { - var t = stack[i]; - if (getObjectFlags(t) & (4 | 64) && t.symbol === symbol) { - count++; - if (count >= 5) - return true; + if (symbol) { + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 32768 && t.symbol === symbol) { + count++; + if (count >= 5) + return true; + } } } } @@ -27407,7 +30823,7 @@ var ts; } } else { - if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) { + if ((sourceProp.flags & 67108864) !== (targetProp.flags & 67108864)) { return 0; } } @@ -27437,7 +30853,7 @@ var ts; if (!(isMatchingSignature(source, target, partialMatch))) { return 0; } - if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { + if (ts.length(source.typeParameters) !== ts.length(target.typeParameters)) { return 0; } source = getErasedSignature(source); @@ -27475,8 +30891,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -27484,8 +30900,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -27576,8 +30992,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getFalsyFlags(t); } return result; @@ -27606,7 +31022,7 @@ var ts; types.push(undefinedType); if (flags & 4096) types.push(nullType); - return getUnionType(types, true); + return getUnionType(types); } function removeDefinitelyFalsyTypes(type) { return getFalsyFlags(type) & 7392 ? @@ -27621,8 +31037,8 @@ var ts; getSignaturesOfType(type, 0).length === 0 && getSignaturesOfType(type, 1).length === 0; } - function createTransientSymbol(source, type) { - var symbol = createSymbol(source.flags | 67108864, source.name); + function createSymbolWithType(source, type) { + var symbol = createSymbol(source.flags, source.name); symbol.declarations = source.declarations; symbol.parent = source.parent; symbol.type = type; @@ -27638,9 +31054,8 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createSymbolWithType(property, updated)); } - ; return members; } function getRegularTypeOfObjectLiteral(type) { @@ -27659,11 +31074,17 @@ var ts; type.regularType = regularNew; return regularNew; } + function getWidenedProperty(prop) { + var original = getTypeOfSymbol(prop); + var widened = getWidenedType(original); + return widened === original ? prop : createSymbolWithType(prop, widened); + } function getWidenedTypeOfObjectLiteral(type) { - var members = transformTypeOfMembers(type, function (prop) { - var widened = getWidenedType(prop); - return prop === widened ? prop : widened; - }); + var members = ts.createMap(); + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + members.set(prop.name, prop.flags & 4 ? getWidenedProperty(prop) : prop); + } var stringIndexInfo = getIndexInfoOfType(type, 0); var numberIndexInfo = getIndexInfoOfType(type, 1); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); @@ -27724,25 +31145,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 148: case 147: - case 146: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144: + case 145: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174: + case 175: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 184: + case 153: case 185: + case 186: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -27755,7 +31176,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) { + if (produceDiagnostics && noImplicitAny && type.flags & 2097152) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -27781,13 +31202,14 @@ var ts; callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } - function createInferenceContext(signature, inferUnionTypes) { + function createInferenceContext(signature, inferUnionTypes, useAnyForNoInferences) { var inferences = ts.map(signature.typeParameters, createTypeInferencesObject); return { signature: signature, inferUnionTypes: inferUnionTypes, inferences: inferences, inferredTypes: new Array(signature.typeParameters.length), + useAnyForNoInferences: useAnyForNoInferences }; } function createTypeInferencesObject() { @@ -27798,25 +31220,69 @@ var ts; isFixed: false, }; } - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 || - objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 || + objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 && type.symbol && type.symbol.flags & (8192 | 2048 | 32) || objectFlags & 32 || - type.flags & 196608 && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 67108864; + var members = createSymbolTable(properties); + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var prop = properties_5[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.name); + inferredProp.checkFlags = readonlyMask && isReadonlySymbol(prop) ? 8 : 0; + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + members.set(prop.name, inferredProp); + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -27832,7 +31298,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -27871,13 +31337,13 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384) { + if (target.flags & 540672) { if (source.flags & 8388608) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : @@ -27885,7 +31351,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -27903,21 +31369,21 @@ var ts; } else if (target.flags & 196608) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { - var t = targetTypes_2[_d]; - if (t.flags & 16384 && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + var typeVariableCount = 0; + var typeVariable = void 0; + for (var _d = 0, targetTypes_3 = targetTypes; _d < targetTypes_3.length; _d++) { + var t = targetTypes_3[_d]; + if (t.flags & 540672 && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -27934,14 +31400,14 @@ var ts; if (isInProcess(source, target)) { return; } - if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { + if (isDeeplyNestedType(source, sourceStack, depth) && isDeeplyNestedType(target, targetStack, depth)) { return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -27957,9 +31423,16 @@ var ts; function inferFromObjectTypes(source, target) { if (getObjectFlags(target) & 32) { var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); + if (constraintType.flags & 262144) { + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } return; } if (constraintType.flags & 16384) { @@ -27975,8 +31448,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var targetProp = properties_6[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -28026,8 +31499,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -28068,7 +31541,13 @@ var ts; inferenceSucceeded = !!unionOrSuperType; } else { - inferredType = emptyObjectType; + var defaultType = getDefaultFromTypeParameter(context.signature.typeParameters[index]); + if (defaultType) { + inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context.signature.typeParameters, index), getInferenceMapper(context))); + } + else { + inferredType = context.useAnyForNoInferences ? anyType : emptyObjectType; + } inferenceSucceeded = true; } context.inferredTypes[index] = inferredType; @@ -28101,19 +31580,7 @@ var ts; return links.resolvedSymbol; } function isInTypeQuery(node) { - while (node) { - switch (node.kind) { - case 160: - return true; - case 70: - case 141: - node = node.parent; - continue; - default: - return false; - } - } - ts.Debug.fail("should not get here"); + return !!ts.findAncestor(node, function (n) { return n.kind === 161 ? true : n.kind === 70 || n.kind === 142 ? false : "quit"; }); } function getFlowCacheKey(node) { if (node.kind === 70) { @@ -28123,7 +31590,7 @@ var ts; if (node.kind === 98) { return "0"; } - if (node.kind === 177) { + if (node.kind === 178) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -28134,7 +31601,7 @@ var ts; case 70: case 98: return node; - case 177: + case 178: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -28143,19 +31610,21 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 || target.kind === 174) && + (target.kind === 225 || target.kind === 175) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; - case 177: - return target.kind === 177 && + case 96: + return target.kind === 96; + case 178: + return target.kind === 178 && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177) { + while (source.kind === 178) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -28164,7 +31633,7 @@ var ts; return false; } function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 && + return target.kind === 178 && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -28172,7 +31641,7 @@ var ts; if (expr.kind === 70) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177) { + if (expr.kind === 178) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -28181,9 +31650,9 @@ var ts; function isDiscriminantProperty(type, name) { if (type && type.flags & 65536) { var prop = getUnionOrIntersectionProperty(type, name); - if (prop && prop.flags & 268435456) { + if (prop && getCheckFlags(prop) & 2) { if (prop.isDiscriminantProperty === undefined) { - prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop)); + prop.isDiscriminantProperty = prop.checkFlags & 32 && isLiteralType(getTypeOfSymbol(prop)); } return prop.isDiscriminantProperty; } @@ -28202,7 +31671,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 && + if (callExpression.expression.kind === 178 && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -28241,8 +31710,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; result |= getTypeFacts(t); } return result; @@ -28250,7 +31719,7 @@ var ts; function isFunctionObjectType(type) { var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -28293,9 +31762,11 @@ var ts; if (flags & 512) { return strictNullChecks ? 1981320 : 4193160; } - if (flags & 16384) { - var constraint = getConstraintOfTypeParameter(type); - return getTypeFacts(constraint || emptyObjectType); + if (flags & 16777216) { + return strictNullChecks ? 6166480 : 8378320; + } + if (flags & 540672) { + return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType); } if (flags & 196608) { return getTypeFactsOfTypes(type.types); @@ -28321,17 +31792,23 @@ var ts; } function getTypeOfDestructuredArrayElement(type, index) { return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || - checkIteratedTypeOrElementType(type, undefined, false) || + checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType; } function getTypeOfDestructuredSpreadExpression(type) { - return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); + return createArrayType(checkIteratedTypeOrElementType(type, undefined, false, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 257 ? + var isDestructuringDefaultAssignment = node.parent.kind === 176 && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 260 && isDestructuringAssignmentTarget(node.parent.parent); + return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } + function isDestructuringAssignmentTarget(parent) { + return parent.parent.kind === 193 && parent.parent.left === parent || + parent.parent.kind === 215 && parent.parent.initializer === parent; + } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); } @@ -28347,21 +31824,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212: + case 214: return stringType; - case 213: - return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192: + case 215: + return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; + case 193: return getAssignedTypeOfBinaryExpression(parent); - case 186: + case 187: return undefinedType; - case 175: + case 176: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196: + case 197: return getAssignedTypeOfSpreadExpression(parent); - case 257: + case 260: return getAssignedTypeOfPropertyAssignment(parent); - case 258: + case 261: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -28369,7 +31846,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 ? + var type = pattern.kind === 173 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -28384,35 +31861,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 214) { return stringType; } - if (node.parent.parent.kind === 213) { - return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + if (node.parent.parent.kind === 215) { + return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 ? + return node.kind === 225 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 || node.kind === 174 ? + return node.kind === 225 || node.kind === 175 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 && node.initializer && + return node.kind === 225 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 && node.parent.kind === 192 && + node.kind !== 175 && node.parent.kind === 193 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183: + case 184: return getReferenceCandidate(node.expression); - case 192: + case 193: switch (node.operatorToken.kind) { case 57: return getReferenceCandidate(node.left); @@ -28424,13 +31901,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 || - parent.kind === 192 && parent.operatorToken.kind === 57 && parent.left === node || - parent.kind === 192 && parent.operatorToken.kind === 25 && parent.right === node ? + return parent.kind === 184 || + parent.kind === 193 && parent.operatorToken.kind === 57 && parent.left === node || + parent.kind === 193 && parent.operatorToken.kind === 25 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253) { + if (clause.kind === 256) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -28476,8 +31953,29 @@ var ts; } return f(type) ? type : neverType; } - function mapType(type, f) { - return type.flags & 65536 ? getUnionType(ts.map(type.types, f)) : f(type); + function mapType(type, mapper) { + if (!(type.flags & 65536)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; + var t = mapper(current); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; } function extractTypesOfKind(type, kind) { return filterType(type, function (t) { return (t.flags & kind) !== 0; }); @@ -28511,7 +32009,7 @@ var ts; return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); } function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); + var elementType = getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -28532,8 +32030,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -28551,11 +32049,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 && (parent.name.text === "length" || - parent.parent.kind === 179 && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 && + var isLengthPushOrUnshift = parent.kind === 178 && (parent.name.text === "length" || + parent.parent.kind === 180 && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 && parent.expression === root && - parent.parent.kind === 192 && + parent.parent.kind === 193 && parent.parent.operatorToken.kind === 57 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -28582,19 +32080,17 @@ var ts; } return false; } - function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { + function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) { + if (initialType === void 0) { initialType = declaredType; } var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215)) { + if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & 17810431)) { return declaredType; } - var initialType = assumeInitialized ? declaredType : - declaredType === autoType || declaredType === autoArrayType ? undefinedType : - includeFalsyTypes(declaredType, 2048); var visitedFlowStart = visitedFlowCount; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; var resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 && getTypeWithFacts(resultType, 524288).flags & 8192) { + if (reference.parent.kind === 202 && getTypeWithFacts(resultType, 524288).flags & 8192) { return declaredType; } return resultType; @@ -28608,7 +32104,16 @@ var ts; } } var type = void 0; - if (flow.flags & 16) { + if (flow.flags & 4096) { + flow.locked = true; + type = getTypeAtFlowNode(flow.antecedent); + flow.locked = false; + } + else if (flow.flags & 2048) { + flow = flow.antecedent; + continue; + } + else if (flow.flags & 16) { type = getTypeAtFlowAssignment(flow); if (!type) { flow = flow.antecedent; @@ -28639,7 +32144,7 @@ var ts; } else if (flow.flags & 2) { var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177) { + if (container && container !== flowContainer && reference.kind !== 178 && reference.kind !== 98) { flow = container.flowNode; continue; } @@ -28682,7 +32187,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 ? + var expr = node.kind === 180 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -28690,7 +32195,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 179) { + if (node.kind === 180) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -28742,6 +32247,9 @@ var ts; var seenIncomplete = false; for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { var antecedent = _a[_i]; + if (antecedent.flags & 2048 && antecedent.lock.locked) { + continue; + } var flowType = getTypeAtFlowNode(antecedent); var type = getTypeFromFlowType(flowType); if (type === declaredType && declaredType === initialType) { @@ -28765,8 +32273,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } for (var i = flowLoopStart; i < flowLoopCount; i++) { if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) { @@ -28788,8 +32297,9 @@ var ts; firstAntecedentType = flowType; } var type = getTypeFromFlowType(flowType); - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -28805,10 +32315,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 && + return expr.kind === 178 && declaredType.flags & 65536 && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -28842,10 +32353,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 && right_1.kind === 9) { + if (left_1.kind === 188 && right_1.kind === 9) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 && left_1.kind === 9) { + if (right_1.kind === 188 && left_1.kind === 9) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -28891,7 +32402,7 @@ var ts; assumeTrue ? 16384 : 131072; return getTypeWithFacts(type, facts); } - if (type.flags & 33281) { + if (type.flags & 16810497) { return type; } if (assumeTrue) { @@ -28916,14 +32427,22 @@ var ts; assumeTrue = !assumeTrue; } if (assumeTrue && !(type.flags & 65536)) { - var targetType = typeofTypesByName[literal.text]; - if (targetType && isTypeSubtypeOf(targetType, type)) { - return targetType; + var targetType = typeofTypesByName.get(literal.text); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 540672) { + var constraint = getBaseConstraintOfType(type) || anyType; + if (isTypeSubtypeOf(targetType, constraint)) { + return getIntersectionType([type, targetType]); + } + } } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 : - typeofNEFacts[literal.text] || 8192; + typeofEQFacts.get(literal.text) || 64 : + typeofNEFacts.get(literal.text) || 8192; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -28992,10 +32511,9 @@ var ts; return assignableType; } } - var targetType = type.flags & 16384 ? getApparentType(type) : type; return isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : - isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); } function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { @@ -29023,7 +32541,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 || invokedExpression.kind === 177) { + if (invokedExpression.kind === 179 || invokedExpression.kind === 178) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -29040,15 +32558,16 @@ var ts; switch (expr.kind) { case 70: case 98: - case 177: + case 96: + case 178: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179: + case 180: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183: + case 184: return narrowType(type, expr.expression, assumeTrue); - case 192: + case 193: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190: + case 191: if (expr.operator === 50) { return narrowType(type, expr.operand, !assumeTrue); } @@ -29072,15 +32591,12 @@ var ts; return getTypeOfSymbol(symbol); } function getControlFlowContainer(node) { - while (true) { - node = node.parent; - if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 || - node.kind === 261 || - node.kind === 147) { - return node; - } - } + return ts.findAncestor(node.parent, function (node) { + return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || + node.kind === 233 || + node.kind === 264 || + node.kind === 148; + }); } function isParameterAssigned(symbol) { var func = ts.getRootDeclaration(symbol.valueDeclaration).parent; @@ -29094,21 +32610,13 @@ var ts; return symbol.isAssigned || false; } function hasParentWithAssignmentsMarked(node) { - while (true) { - node = node.parent; - if (!node) { - return false; - } - if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304) { - return true; - } - } + return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 4194304); }); } function markParameterAssignments(node) { if (node.kind === 70) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145) { symbol.isAssigned = true; } } @@ -29120,6 +32628,14 @@ var ts; function isConstVariable(symbol) { return symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType; } + function removeOptionalityFromDeclaredType(declaredType, declaration) { + var annotationIncludesUndefined = strictNullChecks && + declaration.kind === 145 && + declaration.initializer && + getFalsyFlags(declaredType) & 2048 && + !(getFalsyFlags(checkExpression(declaration.initializer)) & 2048); + return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 131072) : declaredType; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === unknownSymbol) { @@ -29128,16 +32644,14 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 185) { + if (container.kind === 186) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288) { - getNodeLinks(container).flags |= 8192; - } + getNodeLinks(container).flags |= 8192; return getTypeOfSymbol(symbol); } if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -29146,7 +32660,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 226 + if (declaration_1.kind === 228 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29158,11 +32672,11 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197) { + else if (declaration_1.kind === 198) { var container = ts.getThisContainer(node, false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 && ts.hasModifier(container, 32)) { + if (container.kind === 148 && ts.hasModifier(container, 32)) { getNodeLinks(declaration_1).flags |= 8388608; getNodeLinks(node).flags |= 16777216; } @@ -29174,6 +32688,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -29191,22 +32706,25 @@ var ts; if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) { return type; } - var isParameter = ts.getRootDeclaration(declaration).kind === 144; + var isParameter = ts.getRootDeclaration(declaration).kind === 145; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 || - flowContainer.kind === 185 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 || + flowContainer.kind === 186 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); - var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); + var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, ts.getRootDeclaration(declaration)) : type) : + type === autoType || type === autoArrayType ? undefinedType : + includeFalsyTypes(type, 2048); + var flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized); if (type === autoType || type === autoArrayType) { if (flowType === autoType || flowType === autoArrayType) { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } @@ -29220,19 +32738,12 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isInsideFunction(node, threshold) { - var current = node; - while (current && current !== threshold) { - if (ts.isFunctionLike(current)) { - return true; - } - current = current.parent; - } - return false; + return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n); }); } function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 256) { + symbol.valueDeclaration.parent.kind === 259) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -29250,8 +32761,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 211 && - ts.getAncestor(symbol.valueDeclaration, 224).parent === container && + if (container.kind === 213 && + ts.getAncestor(symbol.valueDeclaration, 226).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -29263,33 +32774,25 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 183) { + while (current.parent.kind === 184) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 || current.parent.kind === 191)) { + else if ((current.parent.kind === 191 || current.parent.kind === 192)) { var expr = current.parent; isAssigned = expr.operator === 42 || expr.operator === 43; } if (!isAssigned) { return false; } - while (current !== container) { - if (current === container.statement) { - return true; - } - else { - current = current.parent; - } - } - return false; + return !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement; }); } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 147 || container.kind === 150) { + if (container.kind === 148 || container.kind === 151) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -29320,42 +32823,45 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + if (!superCall || superCall.end > node.pos) { + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 150) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - if (!superCall || superCall.end > node.pos) { - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + if (container.kind === 151) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 185) { + if (container.kind === 186) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 230: + case 232: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 229: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 150: + case 151: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 148: case 147: - case 146: if (ts.getModifierFlags(container) & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 142: + case 143: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -29364,8 +32870,8 @@ var ts; } if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { - if (container.kind === 184 && - ts.isInJavaScriptFile(container.parent) && + if (container.kind === 185 && + container.parent.kind === 193 && ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent .left @@ -29384,7 +32890,7 @@ var ts; if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); var type = ts.hasModifier(container, 32) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; - return getFlowTypeOfReference(node, type, true, undefined); + return getFlowTypeOfReference(node, type); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); @@ -29392,34 +32898,29 @@ var ts; return type; } } - if (compilerOptions.noImplicitThis) { + if (noImplicitThis) { error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } return anyType; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274) { + if (jsdocType && jsdocType.kind === 278) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 281) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { - for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144) { - return true; - } - } - return false; + return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 145; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 185) { + while (container && container.kind === 186) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -29427,17 +32928,14 @@ var ts; var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; if (!canUseSuperExpression) { - var current = node; - while (current && current !== container && current.kind !== 142) { - current = current.parent; - } - if (current && current.kind === 142) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 143; }); + if (current && current.kind === 143) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -29445,6 +32943,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 151) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32) || isCallExpression) { nodeCheckFlag = 512; } @@ -29452,7 +32953,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 149 && ts.getModifierFlags(container) & 256) { + if (container.kind === 150 && ts.getModifierFlags(container) & 256) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -29463,7 +32964,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176) { + if (container.parent.kind === 177) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -29481,7 +32982,7 @@ var ts; } return unknownType; } - if (container.kind === 150 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -29493,32 +32994,50 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 150; + return container.kind === 151; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 176) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177) { if (ts.getModifierFlags(container) & 32) { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || - container.kind === 152; + return container.kind === 150 || + container.kind === 149 || + container.kind === 152 || + container.kind === 153; } else { - return container.kind === 149 || - container.kind === 148 || - container.kind === 151 || + return container.kind === 150 || + container.kind === 149 || container.kind === 152 || + container.kind === 153 || + container.kind === 148 || container.kind === 147 || - container.kind === 146 || - container.kind === 150; + container.kind === 151; } } } return false; } } + function getContainingObjectLiteral(func) { + return (func.kind === 150 || + func.kind === 152 || + func.kind === 153) && func.parent.kind === 177 ? func.parent : + func.kind === 185 && func.parent.kind === 260 ? func.parent.parent : + undefined; + } + function getThisTypeArgument(type) { + return getObjectFlags(type) & 4 && type.target === globalThisType ? type.typeArguments[0] : undefined; + } + function getThisTypeFromContextualType(type) { + return mapType(type, function (t) { + return t.flags & 131072 ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + }); + } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185) { + if (func.kind === 186) { + return undefined; + } + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -29527,29 +33046,55 @@ var ts; } } } + if (noImplicitThis) { + var containingLiteral = getContainingObjectLiteral(func); + if (containingLiteral) { + var contextualType = getApparentTypeOfContextualType(containingLiteral); + var literal = containingLiteral; + var type = contextualType; + while (type) { + var thisType = getThisTypeFromContextualType(type); + if (thisType) { + return instantiateType(thisType, getContextualMapper(containingLiteral)); + } + if (literal.parent.kind !== 260) { + break; + } + literal = literal.parent.parent; + type = getApparentTypeOfContextualType(literal); + } + return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral); + } + if (func.parent.kind === 193 && func.parent.operatorToken.kind === 57) { + var target = func.parent.left; + if (target.kind === 178 || target.kind === 179) { + return checkExpressionCached(target.expression); + } + } + } return undefined; } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -29574,7 +33119,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144) { + if (declaration.kind === 145) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -29585,11 +33130,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_21 = declaration.propertyName || declaration.name; - if (ts.isVariableLike(parentDeclaration) && + var name = declaration.propertyName || declaration.name; + if (parentDeclaration.kind !== 175 && parentDeclaration.type && - !ts.isBindingPattern(name_21)) { - var text = ts.getTextOfPropertyName(name_21); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -29600,33 +33145,34 @@ var ts; } function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); - if (ts.isAsyncFunctionLike(func)) { - var contextualReturnType = getContextualReturnType(func); - if (contextualReturnType) { - return getPromisedType(contextualReturnType); + if (func) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1) { + return undefined; } - return undefined; - } - if (func && !func.asteriskToken) { - return getContextualReturnType(func); + var contextualReturnType = getContextualReturnType(func); + return functionFlags & 2 + ? contextualReturnType && getAwaitedTypeOfPromise(contextualReturnType) + : contextualReturnType; } return undefined; } function getContextualTypeForYieldOperand(node) { var func = ts.getContainingFunction(node); if (func) { + var functionFlags = ts.getFunctionFlags(func); var contextualReturnType = getContextualReturnType(func); if (contextualReturnType) { return node.asteriskToken ? contextualReturnType - : getElementTypeOfIterableIterator(contextualReturnType); + : getIteratedTypeOfGenerator(contextualReturnType, (functionFlags & 2) !== 0); } } return undefined; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 && node.parent.initializer === node) { + if (node.parent.kind === 145 && node.parent.initializer === node) { return true; } node = node.parent; @@ -29635,8 +33181,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 150 || - functionDecl.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152))) { + functionDecl.kind === 151 || + functionDecl.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -29655,7 +33201,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181) { + if (template.parent.kind === 182) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -29685,38 +33231,14 @@ var ts; } return undefined; } - function applyToContextualType(type, mapper) { - if (!(type.flags & 65536)) { - return mapper(type); - } - var types = type.types; - var mappedType; - var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; - var t = mapper(current); - if (t) { - if (!mappedType) { - mappedType = t; - } - else if (!mappedTypes) { - mappedTypes = [mappedType, t]; - } - else { - mappedTypes.push(t); - } - } - } - return mappedTypes ? getUnionType(mappedTypes) : mappedType; - } function getTypeOfPropertyOfContextualType(type, name) { - return applyToContextualType(type, function (t) { + return mapType(type, function (t) { var prop = t.flags & 229376 ? getPropertyOfType(t, name) : undefined; return prop ? getTypeOfSymbol(prop) : undefined; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); + return mapType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 65536 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); @@ -29751,7 +33273,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? getElementTypeOfIterable(type, undefined) : undefined); + || getIteratedTypeOrElementType(type, undefined, false, false, false); } return undefined; } @@ -29760,19 +33282,16 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxAttribute(attribute) { - var kind = attribute.kind; - var jsxElement = attribute.parent; - var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250) { - if (!attrsType || isTypeAny(attrsType)) { + var attributesType = getContextualType(attribute.parent); + if (ts.isJsxAttribute(attribute)) { + if (!attributesType || isTypeAny(attributesType)) { return undefined; } - return getTypeOfPropertyOfType(attrsType, attribute.name.text); + return getTypeOfPropertyOfType(attributesType, attribute.name.text); } - else if (attribute.kind === 251) { - return attrsType; + else { + return attributesType; } - ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } function getApparentTypeOfContextualType(node) { var type = getContextualType(node); @@ -29787,45 +33306,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223: - case 144: + case 225: + case 145: + case 148: case 147: - case 146: - case 174: + case 175: return getContextualTypeForInitializerExpression(node); - case 185: - case 216: + case 186: + case 218: return getContextualTypeForReturnExpression(node); - case 195: + case 196: return getContextualTypeForYieldOperand(parent); - case 179: case 180: + case 181: return getContextualTypeForArgument(parent, node); - case 182: - case 200: + case 183: + case 201: return getTypeFromTypeNode(parent.type); - case 192: + case 193: return getContextualTypeForBinaryOperand(node); - case 257: - case 258: + case 260: + case 261: return getContextualTypeForObjectLiteralElement(parent); - case 175: + case 176: return getContextualTypeForElementExpression(node); - case 193: + case 194: return getContextualTypeForConditionalOperand(node); - case 202: - ts.Debug.assert(parent.parent.kind === 194); + case 204: + ts.Debug.assert(parent.parent.kind === 195); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183: + case 184: return getContextualType(parent); - case 252: + case 255: return getContextualType(parent); - case 250: - case 251: + case 252: + case 254: return getContextualTypeForJsxAttribute(parent); + case 250: + case 249: + return getAttributesTypeFromJsxOpeningLikeElement(parent); } return undefined; } + function getContextualMapper(node) { + node = ts.findAncestor(node, function (n) { return !!n.contextualMapper; }); + return node ? node.contextualMapper : identityMapper; + } function getNonGenericSignature(type, node) { var signatures = getSignaturesOfStructuredType(type, 0); if (signatures.length === 1) { @@ -29850,7 +33376,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 || node.kind === 185; + return node.kind === 185 || node.kind === 186; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -29863,7 +33389,7 @@ var ts; getApparentTypeOfContextualType(node); } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -29873,8 +33399,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var current = types_17[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -29896,37 +33422,37 @@ var ts; } return result; } - function isInferentialContext(mapper) { - return mapper && mapper.context; - } - function checkSpreadExpression(node, contextualMapper) { - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); + function checkSpreadExpression(node, checkMode) { + if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 1536); + } + var arrayOrIterableType = checkExpression(node.expression, checkMode); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false, false); } function hasDefaultValue(node) { - return (node.kind === 174 && !!node.initializer) || - (node.kind === 192 && node.operatorToken.kind === 57); + return (node.kind === 175 && !!node.initializer) || + (node.kind === 193 && node.operatorToken.kind === 57); } - function checkArrayLiteral(node, contextualMapper) { + function checkArrayLiteral(node, checkMode) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196) { - var restArrayType = checkExpression(e.expression, contextualMapper); + if (inDestructuringPattern && e.kind === 197) { + var restArrayType = checkExpression(e.expression, checkMode); var restElementType = getIndexTypeOfType(restArrayType, 1) || - (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); + getIteratedTypeOrElementType(restArrayType, undefined, false, false, false); if (restElementType) { elementTypes.push(restElementType); } } else { - var type = checkExpressionForMutableLocation(e, contextualMapper); + var type = checkExpressionForMutableLocation(e, checkMode); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196; + hasSpreadElement = hasSpreadElement || e.kind === 197; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -29937,7 +33463,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 173 || pattern.kind === 175)) { + if (pattern && (pattern.kind === 174 || pattern.kind === 176)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -29945,7 +33471,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198) { + if (patternElement.kind !== 199) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -29962,7 +33488,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 340); @@ -29999,7 +33525,7 @@ var ts; var unionType = propTypes.length ? getUnionType(propTypes, true) : undefinedType; return createIndexInfo(unionType, false); } - function checkObjectLiteral(node, contextualMapper) { + function checkObjectLiteral(node, checkMode) { var inDestructuringPattern = ts.isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = ts.createMap(); @@ -30008,7 +33534,8 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 || contextualType.pattern.kind === 176); + (contextualType.pattern.kind === 173 || contextualType.pattern.kind === 177); + var isJSObjectLiteral = !contextualType && ts.isInJavaScriptFile(node); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -30017,27 +33544,27 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 || - memberDecl.kind === 258 || + if (memberDecl.kind === 260 || + memberDecl.kind === 261 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257) { - type = checkPropertyAssignment(memberDecl, contextualMapper); + if (memberDecl.kind === 260) { + type = checkPropertyAssignment(memberDecl, checkMode); } - else if (memberDecl.kind === 149) { - type = checkObjectLiteralMethod(memberDecl, contextualMapper); + else if (memberDecl.kind === 150) { + type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 258); - type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 261); + type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } typeFlags |= type.flags; - var prop = createSymbol(4 | 67108864 | member.flags, member.name); + var prop = createSymbol(4 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 260 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 261 && memberDecl.objectAssignmentInitializer); if (isOptional) { - prop.flags |= 536870912; + prop.flags |= 67108864; } if (ts.hasDynamicName(memberDecl)) { patternWithComputedProperties = true; @@ -30046,9 +33573,9 @@ var ts; else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512)) { var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { - prop.flags |= impliedProp.flags & 536870912; + prop.flags |= impliedProp.flags & 67108864; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -30061,9 +33588,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259) { + else if (memberDecl.kind === 262) { + if (languageVersion < 2) { + checkExternalEmitHelpers(memberDecl, 2); + } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -30071,17 +33601,17 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 | 1))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } else { - ts.Debug.assert(memberDecl.kind === 151 || memberDecl.kind === 152); - checkAccessorDeclaration(memberDecl); + ts.Debug.assert(memberDecl.kind === 152 || memberDecl.kind === 153); + checkNodeDeferred(memberDecl); } if (ts.hasDynamicName(memberDecl)) { if (isNumericName(memberDecl.name)) { @@ -30092,34 +33622,36 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { - if (!(prop.flags & 536870912)) { + if (!propertiesTable.get(prop.name)) { + if (!(prop.flags & 67108864)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), true); + spread = getSpreadType(spread, createObjectLiteralType()); + } + if (spread.flags & 32768) { + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; + var stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; + var numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); @@ -30136,9 +33668,14 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 | 4096 | 2048 | 16777216) || + type.flags & 32768 && !isGenericMappedType(type) || + type.flags & 196608 && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { checkJsxOpeningLikeElement(node.openingElement); @@ -30151,85 +33688,105 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252: + case 255: checkJsxExpression(child); break; - case 246: + case 248: checkJsxElement(child); break; - case 247: + case 249: checkJsxSelfClosingElement(child); break; } } - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function isUnhyphenatedJsxName(name) { return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 177 || tagName.kind === 98) { + if (tagName.kind === 178 || tagName.kind === 98) { return false; } else { return ts.isIntrinsicJsxName(tagName.text); } } - function checkJsxAttribute(node, elementAttributesType, nameTable) { - var correspondingPropType = undefined; - if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { - error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); - } - else if (elementAttributesType && !isTypeAny(elementAttributesType)) { - var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); - correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - if (isUnhyphenatedJsxName(node.name.text)) { - var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0); - if (attributeType) { - correspondingPropType = attributeType; + function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, filter, checkMode) { + var attributes = openingLikeElement.attributes; + var attributesTable = ts.createMap(); + var spread = emptyObjectType; + var attributesArray = []; + for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { + var attributeDecl = _a[_i]; + var member = attributeDecl.symbol; + if (ts.isJsxAttribute(attributeDecl)) { + var exprType = attributeDecl.initializer ? + checkExpression(attributeDecl.initializer, checkMode) : + trueType; + var attributeSymbol = createSymbol(4 | 134217728 | member.flags, member.name); + attributeSymbol.declarations = member.declarations; + attributeSymbol.parent = member.parent; + if (member.valueDeclaration) { + attributeSymbol.valueDeclaration = member.valueDeclaration; } - else { - if (!correspondingPropType) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; - } + attributeSymbol.type = exprType; + attributeSymbol.target = member; + attributesTable.set(attributeSymbol.name, attributeSymbol); + attributesArray.push(attributeSymbol); + } + else { + ts.Debug.assert(attributeDecl.kind === 254); + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + var exprType = checkExpression(attributeDecl.expression); + if (!isValidSpreadType(exprType)) { + error(attributeDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); + return anyType; + } + if (isTypeAny(exprType)) { + return anyType; } + spread = getSpreadType(spread, exprType); } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); + if (spread !== emptyObjectType) { + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + attributesArray = getPropertiesOfType(spread); } - else { - exprType = booleanType; + attributesTable = ts.createMap(); + if (attributesArray) { + ts.forEach(attributesArray, function (attr) { + if (!filter || filter(attr)) { + attributesTable.set(attr.name, attr); + } + }); } - if (correspondingPropType) { - checkTypeAssignableTo(exprType, correspondingPropType, node); + return createJsxAttributesType(attributes.symbol, attributesTable); + function createJsxAttributesType(symbol, attributesTable) { + var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, undefined, undefined); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; + result.flags |= 33554432 | 4194304 | freshObjectLiteralFlag; + result.objectFlags |= 128; + return result; } - nameTable[node.name.text] = true; - return exprType; } - function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { - var type = checkExpression(node.expression); - var props = getPropertiesOfType(type); - for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { - var prop = props_2[_i]; - if (!nameTable[prop.name]) { - var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); - if (targetPropSym) { - var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); - checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); - } - nameTable[prop.name] = true; - } - } - return type; + function checkJsxAttributes(node, checkMode) { + return createJsxAttributesTypeFromAttributesProperty(node.parent, undefined, checkMode); } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); @@ -30250,7 +33807,7 @@ var ts; return links.resolvedSymbol = unknownSymbol; } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } return links.resolvedSymbol = unknownSymbol; @@ -30294,23 +33851,86 @@ var ts; return undefined; } } - function getResolvedJsxType(node, elemType, elemClassType) { - if (!elemType) { - elemType = checkExpression(node.tagName); + function defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + var callSignature = getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, undefined); + if (callSignature !== unknownSignature) { + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + } + return undefined; + } + function tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + var candidatesOutArray = []; + getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray); + var result = void 0; + var allMatchingAttributesType = void 0; + for (var _i = 0, candidatesOutArray_1 = candidatesOutArray; _i < candidatesOutArray_1.length; _i++) { + var candidate = candidatesOutArray_1[_i]; + var callReturnType = getReturnTypeOfSignature(candidate); + var paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var shouldBeCandidate = true; + for (var _a = 0, _b = openingLikeElement.attributes.properties; _a < _b.length; _a++) { + var attribute = _b[_a]; + if (ts.isJsxAttribute(attribute) && + isUnhyphenatedJsxName(attribute.name.text) && + !getPropertyOfType(paramType, attribute.name.text)) { + shouldBeCandidate = false; + break; + } + } + if (shouldBeCandidate) { + result = intersectTypes(result, paramType); + } + allMatchingAttributesType = intersectTypes(allMatchingAttributesType, paramType); + } + } + if (!result) { + result = allMatchingAttributesType; + } + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + result = intersectTypes(intrinsicAttributes, result); + } + return result; + } + } + return undefined; + } + function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) { + if (!elementType) { + elementType = checkExpression(openingLikeElement.tagName); } - if (elemType.flags & 65536) { - var types = elemType.types; - return getUnionType(ts.map(types, function (type) { - return getResolvedJsxType(node, type, elemClassType); + if (elementType.flags & 65536) { + var types = elementType.types; + return getUnionType(types.map(function (type) { + return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), true); } - if (elemType.flags & 2) { + if (elementType.flags & 2) { return anyType; } - else if (elemType.flags & 32) { + else if (elementType.flags & 32) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { - var stringLiteralTypeName = elemType.text; + var stringLiteralTypeName = elementType.text; var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName); if (intrinsicProp) { return getTypeOfSymbol(intrinsicProp); @@ -30319,28 +33939,19 @@ var ts; if (indexSignatureType) { return indexSignatureType; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); + error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); } return anyType; } - var elemInstanceType = getJsxElementInstanceType(node, elemType); - if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { - if (jsxElementType) { - var callSignatures = elemType && getSignaturesOfType(elemType, 0); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); - } - return paramType; - } - } + var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? + tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : + defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); + if (statelessAttributesType) { + return statelessAttributesType; } - if (elemClassType) { - checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + if (elementClassType) { + checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } if (isTypeAny(elemInstanceType)) { return elemInstanceType; @@ -30360,10 +33971,6 @@ var ts; else if (isTypeAny(attributesType) || (attributesType === unknownType)) { return attributesType; } - else if (attributesType.flags & 65536) { - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); - return anyType; - } else { var apparentAttributesType = attributesType; var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes); @@ -30386,38 +33993,72 @@ var ts; } } } - function getJsxElementAttributesType(node) { + function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { + ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); var links = getNodeLinks(node); - if (!links.resolvedJsxType) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - var symbol = getIntrinsicTagSymbol(node); - if (links.jsxFlags & 1) { - return links.resolvedJsxType = getTypeOfSymbol(symbol); - } - else if (links.jsxFlags & 2) { - return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0).type; - } - else { - return links.resolvedJsxType = unknownType; - } + if (!links.resolvedJsxElementAttributesType) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1) { + return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol); + } + else if (links.jsxFlags & 2) { + return links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, 0).type; } else { - var elemClassType = getJsxGlobalElementClassType(); - return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); + return links.resolvedJsxElementAttributesType = unknownType; } } - return links.resolvedJsxType; + return links.resolvedJsxElementAttributesType; + } + function getCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType) { + var links = getNodeLinks(node); + if (!links.resolvedJsxElementAttributesType) { + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxElementAttributesType = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, undefined, elemClassType); + } + return links.resolvedJsxElementAttributesType; + } + function getAllAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, true); + } + } + function getAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, false); + } } function getJsxAttributePropertySymbol(attrib) { - var attributesType = getJsxElementAttributesType(attrib.parent); + var attributesType = getAttributesTypeFromJsxOpeningLikeElement(attrib.parent.parent); var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } function getJsxGlobalElementClassType() { - if (!jsxElementClassType) { - jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + if (!deferredJsxElementClassType) { + deferredJsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); } - return jsxElementClassType; + return deferredJsxElementClassType; + } + function getJsxGlobalElementType() { + if (!deferredJsxElementType) { + deferredJsxElementType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.Element); + } + return deferredJsxElementType; + } + function getJsxGlobalStatelessElementType() { + if (!deferredJsxStatelessElementType) { + var jsxElementType = getJsxGlobalElementType(); + if (jsxElementType) { + deferredJsxStatelessElementType = getUnionType([jsxElementType, nullType]); + } + } + return deferredJsxStatelessElementType; } function getJsxIntrinsicTagNames() { var intrinsics = getJsxType(JsxNames.IntrinsicElements); @@ -30427,8 +34068,8 @@ var ts; if ((compilerOptions.jsx || 0) === 0) { error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); } - if (jsxElementType === undefined) { - if (compilerOptions.noImplicitAny) { + if (getJsxGlobalElementType() === undefined) { + if (noImplicitAny) { error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); } } @@ -30445,61 +34086,83 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - var targetAttributesType = getJsxElementAttributesType(node); - var nameTable = ts.createMap(); - var sawSpreadedAny = false; - for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250) { - checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); - } - else { - ts.Debug.assert(node.attributes[i].kind === 251); - var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); - if (isTypeAny(spreadType)) { - sawSpreadedAny = true; - } - } + checkJsxAttributesAssignableToTagNameAttributes(node); + } + function checkJsxAttributesAssignableToTagNameAttributes(openingLikeElement) { + var targetAttributesType = isJsxIntrinsicIdentifier(openingLikeElement.tagName) ? + getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : + getCustomJsxElementAttributesType(openingLikeElement, false); + var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, function (attribute) { + return isUnhyphenatedJsxName(attribute.name) || !!(getPropertyOfType(targetAttributesType, attribute.name)); + }); + if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || sourceAttributesType.properties.length > 0)) { + error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } - if (targetAttributesType && !sawSpreadedAny) { - var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); - } - } + else { + checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); } } - function checkJsxExpression(node) { + function checkJsxExpression(node, checkMode) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression, checkMode); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147; + return s.valueDeclaration ? s.valueDeclaration.kind : 148; } function getDeclarationModifierFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; + if (s.valueDeclaration) { + var flags = ts.getCombinedModifierFlags(s.valueDeclaration); + return s.parent && s.parent.flags & 32 ? flags : flags & ~28; + } + if (getCheckFlags(s) & 6) { + var checkFlags = s.checkFlags; + var accessModifier = checkFlags & 256 ? 8 : + checkFlags & 64 ? 4 : + 16; + var staticModifier = checkFlags & 512 ? 32 : 0; + return accessModifier | staticModifier; + } + if (s.flags & 16777216) { + return 4 | 32; + } + return 0; } function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } - function checkClassPropertyAccess(node, left, type, prop) { + function isMethodLike(symbol) { + return !!(symbol.flags & 8192 || getCheckFlags(symbol) & 4); + } + function checkPropertyAccessibility(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 223 ? + var errorNode = node.kind === 178 || node.kind === 225 ? node.name : node.right; + if (getCheckFlags(prop) & 256) { + error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); + return false; + } if (left.kind === 96) { - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 149) { - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2) { + var hasNonMethodDeclaration = forEachProperty(prop, function (p) { + var propKind = getDeclarationKindFromSymbol(p); + return propKind !== 150 && propKind !== 149; + }); + if (hasNonMethodDeclaration) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128) { - error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } } @@ -30509,7 +34172,7 @@ var ts; if (flags & 8) { var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (!isNodeWithinClass(node, declaringClassDeclaration)) { - error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } return true; @@ -30519,10 +34182,10 @@ var ts; } var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); - return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + return isClassDerivedFromDeclaringClasses(enclosingClass, prop) ? enclosingClass : undefined; }); if (!enclosingClass) { - error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || type)); return false; } if (flags & 32) { @@ -30538,16 +34201,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144; - if (kind) { - error(node, kind & 2048 ? kind & 4096 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144; + if (kind) { + error(errorNode, kind & 2048 ? kind & 4096 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 | 8192) ? unknownType : t; } return type; } @@ -30576,7 +34240,7 @@ var ts; noUnusedIdentifiers && (prop.flags & 106500) && prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8)) { - if (prop.flags & 16777216) { + if (getCheckFlags(prop) & 1) { getSymbolLinks(prop).target.isReferenced = true; } else { @@ -30584,6 +34248,15 @@ var ts; } } } + function isInPropertyInitializer(node) { + while (node) { + if (node.parent && node.parent.kind === 148 && node.parent.initializer === node) { + return true; + } + node = node.parent; + } + return false; + } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { var type = checkNonNullExpression(left); if (isTypeAny(type) || type === silentNeverType) { @@ -30595,16 +34268,30 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type); } return unknownType; } + if (prop.valueDeclaration) { + if (isInPropertyInitializer(node) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + } + if (prop.valueDeclaration.kind === 228 && + node.parent && node.parent.kind !== 158 && + !ts.isInAmbientContext(prop.valueDeclaration) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Class_0_used_before_its_declaration, right.text); + } + } markPropertyAsReferenced(prop); getNodeLinks(node).resolvedSymbol = prop; - if (prop.parent && prop.parent.flags & 32) { - checkClassPropertyAccess(node, left, apparentType, prop); - } + checkPropertyAccessibility(node, left, apparentType, prop); var propType = getTypeOfSymbol(prop); var assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { @@ -30613,30 +34300,30 @@ var ts; return unknownType; } } - if (node.kind !== 177 || assignmentKind === 1 || + if (node.kind !== 178 || assignmentKind === 1 || !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 65536)) { return propType; } - var flowType = getFlowTypeOfReference(node, propType, true, undefined); + var flowType = getFlowTypeOfReference(node, propType); return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 + var left = node.kind === 178 ? node.expression : node.left; var type = checkExpression(left); if (type !== unknownType && !isTypeAny(type)) { var prop = getPropertyOfType(getWidenedType(type), propertyName); - if (prop && prop.parent && prop.parent.flags & 32) { - return checkClassPropertyAccess(node, left, type, prop); + if (prop) { + return checkPropertyAccessibility(node, left, type, prop); } } return true; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224) { + if (initializer.kind === 226) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -30658,7 +34345,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 && + if (node.kind === 214 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -30676,7 +34363,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 && node.parent.expression === node) { + if (node.parent.kind === 181 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -30696,7 +34383,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -30716,7 +34403,7 @@ var ts; if (!leftHandSideSymbol) { return false; } - var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + var globalESSymbol = getGlobalESSymbolConstructorSymbol(true); if (!globalESSymbol) { return false; } @@ -30729,10 +34416,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181) { + if (node.kind === 182) { checkExpression(node.template); } - else if (node.kind !== 145) { + else if (node.kind !== 146) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -30751,22 +34438,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { - var signature = signatures_2[_i]; + for (var _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) { + var signature = signatures_3[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -30783,7 +34470,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196) { + if (arg && arg.kind === 197) { return i; } } @@ -30796,11 +34483,14 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181) { + if (ts.isJsxOpeningLikeElement(node)) { + return true; + } + if (node.kind === 182) { var tagExpression = node; argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194) { + if (tagExpression.template.kind === 195) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -30812,7 +34502,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145) { + else if (node.kind === 146) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, undefined, signature); @@ -30820,7 +34510,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 180); + ts.Debug.assert(callExpression.kind === 181); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -30828,8 +34518,10 @@ var ts; typeArguments = callExpression.typeArguments; spreadArgIndex = getSpreadArgumentIndex(args); } + var numTypeParameters = ts.length(signature.typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + (typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { return false; } @@ -30853,9 +34545,9 @@ var ts; return undefined; } function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature, true); + var context = createInferenceContext(signature, true, false); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -30874,19 +34566,19 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } if (excludeArgument) { @@ -30894,7 +34586,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -30904,7 +34596,7 @@ var ts; var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; var mapper; - for (var i = 0; i < typeParameters.length; i++) { + for (var i = 0; i < typeArgumentNodes.length; i++) { if (typeArgumentsAreAssignable) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -30924,9 +34616,29 @@ var ts; } return typeArgumentsAreAssignable; } + function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation) { + var callIsIncomplete = node.attributes.end === node.end; + if (callIsIncomplete) { + return true; + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; + var paramType = getTypeAtPosition(signature, 0); + var attributesType = checkExpressionWithContextualType(node.attributes, paramType, undefined); + var argProperties = getPropertiesOfType(attributesType); + for (var _i = 0, argProperties_1 = argProperties; _i < argProperties_1.length; _i++) { + var arg = argProperties_1[_i]; + if (!getPropertyOfType(paramType, arg.name) && isUnhyphenatedJsxName(arg.name)) { + return false; + } + } + return checkTypeRelatedTo(attributesType, paramType, relation, undefined, headMessage); + } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (ts.isJsxOpeningLikeElement(node)) { + return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); + } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180) { + if (thisType && thisType !== voidType && node.kind !== 181) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -30939,7 +34651,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 198) { + if (arg === undefined || arg.kind !== 199) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); if (argType === undefined) { @@ -30954,51 +34666,54 @@ var ts; return true; } function getThisArgumentOfCall(node) { - if (node.kind === 179) { + if (node.kind === 180) { var callee = node.expression; - if (callee.kind === 177) { + if (callee.kind === 178) { return callee.expression; } - else if (callee.kind === 178) { + else if (callee.kind === 179) { return callee.expression; } } } function getEffectiveCallArguments(node) { var args; - if (node.kind === 181) { + if (node.kind === 182) { var template = node.template; args = [undefined]; - if (template.kind === 194) { + if (template.kind === 195) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145) { + else if (node.kind === 146) { return undefined; } + else if (ts.isJsxOpeningLikeElement(node)) { + args = node.attributes.properties.length > 0 ? [node.attributes] : emptyArray; + } else { args = node.arguments || emptyArray; } return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145) { + if (node.kind === 146) { switch (node.parent.kind) { - case 226: - case 197: + case 228: + case 198: return 1; - case 147: + case 148: return 2; - case 149: - case 151: + case 150: case 152: + case 153: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 144: + case 145: return 3; } } @@ -31007,48 +34722,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { node = node.parent; - if (node.kind === 150) { + if (node.kind === 151) { return anyType; } } - if (node.kind === 147 || - node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 148 || + node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var element = node; switch (element.name.kind) { case 70: case 8: case 9: return getLiteralTypeForText(32, element.name.text); - case 142: + case 143: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512)) { return nameType; @@ -31065,20 +34780,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 228) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144) { + if (node.kind === 145) { return numberType; } - if (node.kind === 147) { + if (node.kind === 148) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 || - node.kind === 151 || - node.kind === 152) { + if (node.kind === 150 || + node.kind === 152 || + node.kind === 153) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -31099,26 +34814,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex) { - if (node.kind === 145) { + if (node.kind === 146) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 145 || - (argIndex === 0 && node.kind === 181)) { + if (node.kind === 146 || + (argIndex === 0 && node.kind === 182)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145) { + if (node.kind === 146) { return node.expression; } - else if (argIndex === 0 && node.kind === 181) { + else if (argIndex === 0 && node.kind === 182) { return node.template; } else { @@ -31126,15 +34841,30 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181; - var isDecorator = node.kind === 145; + var isTaggedTemplate = node.kind === 182; + var isDecorator = node.kind === 146; + var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; - if (!isTaggedTemplate && !isDecorator) { + if (!isTaggedTemplate && !isDecorator && !isJsxOpeningOrSelfClosingElement) { typeArguments = node.typeArguments; if (node.expression.kind !== 96) { ts.forEach(typeArguments, checkSourceElement); } } + if (signatures.length === 1) { + var declaration = signatures[0].declaration; + if (declaration && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration)) { + if (containsArgumentsReference(declaration)) { + var signatureWithRest = cloneSignature(signatures[0]); + var syntheticArgsSymbol = createSymbol(3, "args"); + syntheticArgsSymbol.type = anyArrayType; + syntheticArgsSymbol.isRestParameter = true; + signatureWithRest.parameters = ts.concatenate(signatureWithRest.parameters, [syntheticArgsSymbol]); + signatureWithRest.hasRestParameter = true; + signatures = [signatureWithRest]; + } + } + } var candidates = candidatesOutArray || []; reorderCandidates(signatures, candidates); if (!candidates.length) { @@ -31157,7 +34887,7 @@ var ts; var candidateForTypeArgumentError; var resultOfFailedInference; var result; - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma); } @@ -31171,6 +34901,9 @@ var ts; return result; } if (candidateForArgumentError) { + if (isJsxOpeningOrSelfClosingElement) { + return candidateForArgumentError; + } checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); } else if (candidateForTypeArgumentError) { @@ -31186,7 +34919,7 @@ var ts; if (headMessage) { diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); } - reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + reportNoCommonSupertypeError(inferenceCandidates, node.tagName || node.expression || node.tag, diagnosticChainHead); } } else { @@ -31222,20 +34955,20 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate, false) + ? createInferenceContext(originalCandidate, false, ts.isInJavaScriptFile(node)) : undefined; while (true) { candidate = originalCandidate; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); + typeArgumentTypes = fillMissingTypeArguments(ts.map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, getMinTypeArgumentCount(candidate.typeParameters)); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); } else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); - typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; + typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; } if (!typeArgumentsAreValid) { break; @@ -31277,7 +35010,7 @@ var ts; if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); if (baseTypeNode) { - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode); return resolveCall(node, baseConstructors, candidatesOutArray); } } @@ -31388,12 +35121,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8) { @@ -31425,16 +35159,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226: - case 197: + case 228: + case 198: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144: + case 145: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147: + case 148: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149: - case 151: + case 150: case 152: + case 153: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -31459,16 +35193,42 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) { + ts.Debug.assert(!(elementType.flags & 65536)); + var callSignature = resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray); + return callSignature; + } + function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) { + if (elementType.flags & 65536) { + var types = elementType.types; + var result = void 0; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var type = types_18[_i]; + result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray); + } + return result; + } + var callSignatures = elementType && getSignaturesOfType(elementType, 0); + if (callSignatures && callSignatures.length > 0) { + var callSignature = void 0; + callSignature = resolveCall(openingLikeElement, callSignatures, candidatesOutArray); + return callSignature; + } + return undefined; + } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179: - return resolveCallExpression(node, candidatesOutArray); case 180: - return resolveNewExpression(node, candidatesOutArray); + return resolveCallExpression(node, candidatesOutArray); case 181: + return resolveNewExpression(node, candidatesOutArray); + case 182: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145: + case 146: return resolveDecorator(node, candidatesOutArray); + case 250: + case 249: + return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); } @@ -31499,20 +35259,23 @@ var ts; if (node.expression.kind === 96) { return voidType; } - if (node.kind === 180) { + if (node.kind === 181) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 && - declaration.kind !== 154 && - declaration.kind !== 159 && + declaration.kind !== 151 && + declaration.kind !== 155 && + declaration.kind !== 160 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = node.expression.kind === 70 ? getResolvedSymbol(node.expression) : checkExpression(node.expression).symbol; - if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 || ts.isDeclarationOfFunctionExpression(funcSymbol))) { + if (funcSymbol && ts.isDeclarationOfFunctionOrClassExpression(funcSymbol)) { + funcSymbol = getSymbolOfNode(funcSymbol.valueDeclaration.initializer); + } + if (funcSymbol && funcSymbol.members && funcSymbol.flags & 16) { return getInferredClassType(funcSymbol); } - else if (compilerOptions.noImplicitAny) { + else if (noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; @@ -31535,9 +35298,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 225 + ? 227 : resolvedRequire.flags & 3 - ? 223 + ? 225 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -31563,6 +35326,22 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 151) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -31578,13 +35357,16 @@ var ts; pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } - function assignContextualParameterTypes(signature, context, mapper) { + function getTypeOfFirstParameterOfSignature(signature) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + } + function assignContextualParameterTypes(signature, context, mapper, checkMode) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); - if (isInferentialContext(mapper)) { + if (checkMode === 2) { for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -31592,23 +35374,23 @@ var ts; var parameter = signature.thisParameter; if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { if (!parameter) { - signature.thisParameter = createTransientSymbol(context.thisParameter, undefined); + signature.thisParameter = createSymbolWithType(context.thisParameter, undefined); } - assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper); + assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper, checkMode); } } for (var i = 0; i < len; i++) { var parameter = signature.parameters[i]; if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeAtPosition(context, i); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } } @@ -31625,19 +35407,19 @@ var ts; } } } - function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper, checkMode) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 || - parameter.valueDeclaration.name.kind === 173)) { + (parameter.valueDeclaration.name.kind === 173 || + parameter.valueDeclaration.name.kind === 174)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); } - else if (isInferentialContext(mapper)) { - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + else if (checkMode === 2) { + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -31648,9 +35430,9 @@ var ts; return undefined; } function createPromiseType(promisedType) { - var globalPromiseType = getGlobalPromiseType(); + var globalPromiseType = getGlobalPromiseType(true); if (globalPromiseType !== emptyGenericType) { - promisedType = getAwaitedType(promisedType); + promisedType = getAwaitedType(promisedType) || emptyObjectType; return createTypeReference(globalPromiseType, [promisedType]); } return emptyObjectType; @@ -31661,46 +35443,56 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol(true)) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } - function getReturnTypeFromBody(func, contextualMapper) { + function getReturnTypeFromBody(func, checkMode) { var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); if (!func.body) { return unknownType; } - var isAsync = ts.isAsyncFunctionLike(func); + var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 204) { - type = checkExpressionCached(func.body, contextualMapper); - if (isAsync) { - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (func.body.kind !== 206) { + type = checkExpressionCached(func.body, checkMode); + if (functionFlags & 2) { + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } } else { var types = void 0; - var funcIsGenerator = !!func.asteriskToken; - if (funcIsGenerator) { - types = checkAndAggregateYieldOperandTypes(func, contextualMapper); - if (types.length === 0) { - var iterableIteratorAny = createIterableIteratorType(anyType); - if (compilerOptions.noImplicitAny) { + if (functionFlags & 1) { + types = ts.concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), checkAndAggregateReturnExpressionTypes(func, checkMode)); + if (!types || types.length === 0) { + var iterableIteratorAny = functionFlags & 2 + ? createAsyncIterableIteratorType(anyType) + : createIterableIteratorType(anyType); + if (noImplicitAny) { error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)); } return iterableIteratorAny; } } else { - types = checkAndAggregateReturnExpressionTypes(func, contextualMapper); + types = checkAndAggregateReturnExpressionTypes(func, checkMode); if (!types) { - return isAsync ? createPromiseReturnType(func, neverType) : neverType; + return functionFlags & 2 + ? createPromiseReturnType(func, neverType) + : neverType; } if (types.length === 0) { - return isAsync ? createPromiseReturnType(func, voidType) : voidType; + return functionFlags & 2 + ? createPromiseReturnType(func, voidType) + : voidType; } } type = getUnionType(types, true); - if (funcIsGenerator) { - type = createIterableIteratorType(type); + if (functionFlags & 1) { + type = functionFlags & 2 + ? createAsyncIterableIteratorType(type) + : createIterableIteratorType(type); } } if (!contextualSignature) { @@ -31712,16 +35504,24 @@ var ts; type = getWidenedLiteralType(type); } var widenedType = getWidenedType(type); - return isAsync ? createPromiseReturnType(func, widenedType) : widenedType; + return (functionFlags & 3) === 2 + ? createPromiseReturnType(func, widenedType) + : widenedType; } - function checkAndAggregateYieldOperandTypes(func, contextualMapper) { + function checkAndAggregateYieldOperandTypes(func, checkMode) { var aggregatedTypes = []; + var functionFlags = ts.getFunctionFlags(func); ts.forEachYieldExpression(func.body, function (yieldExpression) { var expr = yieldExpression.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); + var type = checkExpressionCached(expr, checkMode); if (yieldExpression.asteriskToken) { - type = checkElementTypeOfIterable(type, yieldExpression.expression); + type = checkIteratedTypeOrElementType(type, yieldExpression.expression, false, (functionFlags & 2) !== 0); + } + if (functionFlags & 2) { + type = checkAwaitedType(type, expr, yieldExpression.asteriskToken + ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (!ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); @@ -31742,29 +35542,29 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128)) { return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; } - function checkAndAggregateReturnExpressionTypes(func, contextualMapper) { - var isAsync = ts.isAsyncFunctionLike(func); + function checkAndAggregateReturnExpressionTypes(func, checkMode) { + var functionFlags = ts.getFunctionFlags(func); var aggregatedTypes = []; var hasReturnWithNoExpression = functionHasImplicitReturn(func); var hasReturnOfTypeNever = false; ts.forEachReturnStatement(func.body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); - if (isAsync) { - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var type = checkExpressionCached(expr, checkMode); + if (functionFlags & 2) { + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (type.flags & 8192) { hasReturnOfTypeNever = true; @@ -31778,7 +35578,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 || func.kind === 185)) { + func.kind === 185 || func.kind === 186)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -31795,7 +35595,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -31821,20 +35621,20 @@ var ts; error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); } } - function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184) { + if (!hasGrammarError && node.kind === 185) { checkGrammarForGenerator(node); } - if (contextualMapper === identityMapper && isContextSensitive(node)) { + if (checkMode === 1 && isContextSensitive(node)) { checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); - var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + var mightFixTypeParameters = contextSensitive && checkMode === 2; if (mightFixTypeParameters || !(links.flags & 1024)) { var contextualSignature = getContextualSignature(node); var contextChecked = !!(links.flags & 1024); @@ -31843,10 +35643,10 @@ var ts; if (contextualSignature) { var signature = getSignaturesOfType(type, 0)[0]; if (contextSensitive) { - assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + assignContextualParameterTypes(signature, contextualSignature, getContextualMapper(node), checkMode); } if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { - var returnType = getReturnTypeFromBody(node, contextualMapper); + var returnType = getReturnTypeFromBody(node, checkMode); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } @@ -31858,31 +35658,35 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149) { + if (produceDiagnostics && node.kind !== 150) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 || ts.isObjectLiteralMethod(node)); - var isAsync = ts.isAsyncFunctionLike(node); - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); - if (!node.asteriskToken) { + ts.Debug.assert(node.kind !== 150 || ts.isObjectLiteralMethod(node)); + var functionFlags = ts.getFunctionFlags(node); + var returnOrPromisedType = node.type && + ((functionFlags & 3) === 2 ? + checkAsyncFunctionReturnType(node) : + getTypeFromTypeNode(node.type)); + if ((functionFlags & 1) === 0) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (node.body) { if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204) { + if (node.body.kind === 206) { checkSourceElement(node.body); } else { var exprType = checkExpression(node.body); if (returnOrPromisedType) { - if (isAsync) { - var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); + if ((functionFlags & 3) === 2) { + var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { @@ -31901,19 +35705,19 @@ var ts; return true; } function isReadonlySymbol(symbol) { - return symbol.isReadonly || - symbol.flags & 4 && (getDeclarationModifierFlagsFromSymbol(symbol) & 64) !== 0 || - symbol.flags & 3 && (getDeclarationNodeFlagsFromSymbol(symbol) & 2) !== 0 || + return !!(getCheckFlags(symbol) & 8 || + symbol.flags & 4 && getDeclarationModifierFlagsFromSymbol(symbol) & 64 || + symbol.flags & 3 && getDeclarationNodeFlagsFromSymbol(symbol) & 2 || symbol.flags & 98304 && !(symbol.flags & 65536) || - (symbol.flags & 8) !== 0; + symbol.flags & 8); } function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 177 || expr.kind === 178) && + (expr.kind === 178 || expr.kind === 179) && expr.expression.kind === 98) { var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150)) + if (!(func && func.kind === 151)) return true; return !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent); } @@ -31922,13 +35726,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 || expr.kind === 178) { + if (expr.kind === 178 || expr.kind === 179) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237; + return declaration && declaration.kind === 239; } } } @@ -31936,7 +35740,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage) { var node = ts.skipParentheses(expr); - if (node.kind !== 70 && node.kind !== 177 && node.kind !== 178) { + if (node.kind !== 70 && node.kind !== 178 && node.kind !== 179) { error(expr, invalidReferenceMessage); return false; } @@ -31944,11 +35748,21 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 178 && expr.kind !== 179) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { checkExpression(node.expression); - return stringType; + return typeofType; } function checkVoidExpression(node) { checkExpression(node.expression); @@ -31956,7 +35770,7 @@ var ts; } function checkAwaitExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 524288)) { + if (!(node.flags & 16384)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -31964,7 +35778,7 @@ var ts; } } var operandType = checkExpression(node.expression); - return checkAwaitedType(operandType, node); + return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); @@ -31978,6 +35792,7 @@ var ts; case 36: case 37: case 51: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -31989,7 +35804,7 @@ var ts; booleanType; case 42: case 43: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } @@ -32002,7 +35817,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } @@ -32014,8 +35829,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_19 = types; _i < types_19.length; _i++) { + var t = types_19[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -32029,8 +35844,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_20 = types; _i < types_20.length; _i++) { + var t = types_20[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -32039,8 +35854,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_21 = types; _a < types_21.length; _a++) { + var t = types_21[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -32061,7 +35876,10 @@ var ts; if (isTypeOfKind(leftType, 8190)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0).length || + getSignaturesOfType(rightType, 1).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -32070,39 +35888,41 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; + for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { + var p = properties_7[_i]; checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 || property.kind === 258) { - var name_22 = property.name; - if (name_22.kind === 142) { - checkComputedPropertyName(name_22); + if (property.kind === 260 || property.kind === 261) { + var name = property.name; + if (name.kind === 143) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_22)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_22); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 258) { + if (property.kind === 261) { return checkDestructuringAssignment(property, type); } else { @@ -32110,10 +35930,13 @@ var ts; } } else { - error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 259) { + else if (property.kind === 262) { + if (languageVersion < 5) { + checkExternalEmitHelpers(property, 4); + } var nonRestNames = []; if (allProperties) { for (var i = 0; i < allProperties.length - 1; i++) { @@ -32127,19 +35950,22 @@ var ts; error(property, ts.Diagnostics.Property_assignment_expected); } } - function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { - var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; + function checkArrayLiteralAssignment(node, sourceType, checkMode) { + if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512); + } + var elementType = checkIteratedTypeOrElementType(sourceType, node, false, false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } return sourceType; } - function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198) { - if (element.kind !== 196) { + if (element.kind !== 199) { + if (element.kind !== 197) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -32147,7 +35973,7 @@ var ts; ? getTypeOfPropertyOfType(sourceType, propName) : elementType; if (type) { - return checkDestructuringAssignment(element, type, contextualMapper); + return checkDestructuringAssignment(element, type, checkMode); } else { checkExpression(element); @@ -32165,48 +35991,48 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 && restExpression.operatorToken.kind === 57) { + if (restExpression.kind === 193 && restExpression.operatorToken.kind === 57) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { - return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); + return checkDestructuringAssignment(restExpression, createArrayType(elementType), checkMode); } } } } return undefined; } - function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 258) { + if (exprOrAssignment.kind === 261) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048)) { sourceType = getTypeWithFacts(sourceType, 131072); } - checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode); } target = exprOrAssignment.name; } else { target = exprOrAssignment; } - if (target.kind === 192 && target.operatorToken.kind === 57) { - checkBinaryExpression(target, contextualMapper); + if (target.kind === 193 && target.operatorToken.kind === 57) { + checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 176) { + if (target.kind === 177) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175) { - return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + if (target.kind === 176) { + return checkArrayLiteralAssignment(target, sourceType, checkMode); } - return checkReferenceAssignment(target, sourceType, contextualMapper); + return checkReferenceAssignment(target, sourceType, checkMode); } - function checkReferenceAssignment(target, sourceType, contextualMapper) { - var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 ? + function checkReferenceAssignment(target, sourceType, checkMode) { + var targetType = checkExpression(target, checkMode); + var error = target.parent.kind === 262 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -32220,35 +36046,35 @@ var ts; case 70: case 9: case 11: - case 181: - case 194: + case 182: + case 195: case 12: case 8: case 100: case 85: case 94: - case 137: - case 184: - case 197: + case 138: case 185: - case 175: + case 198: + case 186: case 176: - case 187: - case 201: - case 247: - case 246: + case 177: + case 188: + case 202: + case 249: + case 248: return true; - case 193: + case 194: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192: + case 193: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190: case 191: + case 192: switch (node.operator) { case 50: case 36: @@ -32257,9 +36083,9 @@ var ts; return true; } return false; - case 188: - case 182: - case 200: + case 189: + case 183: + case 201: default: return false; } @@ -32274,16 +36100,16 @@ var ts; firstAssignableToSecond && !secondAssignableToFirst ? type2 : getUnionType([type1, type2], true); } - function checkBinaryExpression(node, contextualMapper) { - return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + function checkBinaryExpression(node, checkMode) { + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, checkMode, node); } - function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 57 && (left.kind === 176 || left.kind === 175)) { - return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); + if (operator === 57 && (left.kind === 177 || left.kind === 176)) { + return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } - var leftType = checkExpression(left, contextualMapper); - var rightType = checkExpression(right, contextualMapper); + var leftType = checkExpression(left, checkMode); + var rightType = checkExpression(right, checkMode); switch (operator) { case 38: case 39: @@ -32310,12 +36136,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; if ((leftType.flags & 136) && (rightType.flags & 136) && @@ -32335,12 +36157,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (leftType.flags & 6144) - leftType = rightType; - if (rightType.flags & 6144) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 | 262178) && !isTypeOfKind(rightType, 1 | 262178)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340) && isTypeOfKind(rightType, 340)) { resultType = numberType; @@ -32369,8 +36189,8 @@ var ts; case 29: case 30: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -32406,11 +36226,14 @@ var ts; checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 25: - if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) { error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType; } + function isEvalNode(node) { + return node.kind === 70 && node.text === "eval"; + } function checkForDisallowedESSymbolOperand(operator) { var offendingSymbolOperand = maybeTypeOfKind(leftType, 512) ? left : maybeTypeOfKind(rightType, 512) ? right : @@ -32464,7 +36287,7 @@ var ts; } function checkYieldExpression(node) { if (produceDiagnostics) { - if (!(node.flags & 131072) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -32473,30 +36296,45 @@ var ts; } if (node.expression) { var func = ts.getContainingFunction(node); - if (func && func.asteriskToken) { + var functionFlags = func && ts.getFunctionFlags(func); + if (node.asteriskToken) { + if (functionFlags & 2) { + if (languageVersion < 4) { + checkExternalEmitHelpers(node, 4096); + } + } + else if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256); + } + } + if (functionFlags & 1) { var expressionType = checkExpressionCached(node.expression, undefined); var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { - expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); + expressionElementType = checkIteratedTypeOrElementType(expressionType, node.expression, false, (functionFlags & 2) !== 0); } if (func.type) { - var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; + var signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(func.type), (functionFlags & 2) !== 0) || anyType; if (nodeIsYieldStar) { - checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(functionFlags & 2 + ? getAwaitedType(expressionElementType, node.expression, ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionElementType, signatureElementType, node.expression, undefined); } else { - checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(functionFlags & 2 + ? getAwaitedType(expressionType, node.expression, ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionType, signatureElementType, node.expression, undefined); } } } } return anyType; } - function checkConditionalExpression(node, contextualMapper) { + function checkConditionalExpression(node, checkMode) { checkExpression(node.condition); - var type1 = checkExpression(node.whenTrue, contextualMapper); - var type2 = checkExpression(node.whenFalse, contextualMapper); + var type1 = checkExpression(node.whenTrue, checkMode); + var type2 = checkExpression(node.whenFalse, checkMode); return getBestChoiceType(type1, type2); } function checkLiteralExpression(node) { @@ -32522,107 +36360,119 @@ var ts; } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var saveContextualType = node.contextualType; + var saveContextualMapper = node.contextualMapper; node.contextualType = contextualType; - var result = checkExpression(node, contextualMapper); + node.contextualMapper = contextualMapper; + var checkMode = contextualMapper === identityMapper ? 1 : + contextualMapper ? 2 : 0; + var result = checkExpression(node, checkMode); node.contextualType = saveContextualType; + node.contextualMapper = saveContextualMapper; return result; } - function checkExpressionCached(node, contextualMapper) { + function checkExpressionCached(node, checkMode) { var links = getNodeLinks(node); if (!links.resolvedType) { var saveFlowLoopStart = flowLoopStart; flowLoopStart = flowLoopCount; - links.resolvedType = checkExpression(node, contextualMapper); + links.resolvedType = checkExpression(node, checkMode); flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 || node.kind === 200; + return node.kind === 183 || node.kind === 201; } function checkDeclarationInitializer(declaration) { - var type = checkExpressionCached(declaration.initializer); + var type = getTypeOfExpression(declaration.initializer, true); return ts.getCombinedNodeFlags(declaration) & 2 || ts.getCombinedModifierFlags(declaration) & 64 && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); - if (apparentType.flags & (2 | 4 | 8 | 16)) { + if (contextualType.flags & 540672) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + if (constraint.flags & (2 | 4 | 8 | 16)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 | 262144)); } return false; } - function checkExpressionForMutableLocation(node, contextualMapper) { - var type = checkExpression(node, contextualMapper); + function checkExpressionForMutableLocation(node, checkMode) { + var type = checkExpression(node, checkMode); return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } - function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 142) { + function checkPropertyAssignment(node, checkMode) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } - return checkExpressionForMutableLocation(node.initializer, contextualMapper); + return checkExpressionForMutableLocation(node.initializer, checkMode); } - function checkObjectLiteralMethod(node, contextualMapper) { + function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } - var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } - function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (isInferentialContext(contextualMapper)) { + function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { + if (checkMode === 2) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { - return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, getContextualMapper(node))); } } } } return type; } - function getTypeOfExpression(node) { - if (node.kind === 179 && node.expression.kind !== 96) { + function getTypeOfExpression(node, cache) { + if (node.kind === 180 && node.expression.kind !== 96 && !ts.isRequireCall(node, true)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { return getReturnTypeOfSignature(signature); } } - return checkExpression(node); + return cache ? checkExpressionCached(node) : checkExpression(node); } - function checkExpression(node, contextualMapper) { + function getContextFreeTypeOfExpression(node) { + var saveContextualType = node.contextualType; + node.contextualType = anyType; + var type = getTypeOfExpression(node); + node.contextualType = saveContextualType; + return type; + } + function checkExpression(node, checkMode) { var type; - if (node.kind === 141) { + if (node.kind === 142) { type = checkQualifiedName(node); } else { - var uninstantiatedType = checkExpressionWorker(node, contextualMapper); - type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkExpressionWorker(node, checkMode); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 177 && node.parent.expression === node) || - (node.parent.kind === 178 && node.parent.expression === node) || - ((node.kind === 70 || node.kind === 141) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 && node.parent.expression === node) || + (node.parent.kind === 179 && node.parent.expression === node) || + ((node.kind === 70 || node.kind === 142) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } } return type; } - function checkExpressionWorker(node, contextualMapper) { + function checkExpressionWorker(node, checkMode) { switch (node.kind) { case 70: return checkIdentifier(node); @@ -32637,66 +36487,70 @@ var ts; case 100: case 85: return checkLiteralExpression(node); - case 194: + case 195: return checkTemplateExpression(node); case 12: return stringType; case 11: return globalRegExpType; - case 175: - return checkArrayLiteral(node, contextualMapper); case 176: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, checkMode); case 177: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, checkMode); case 178: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 179: + return checkIndexedAccess(node); case 180: - return checkCallExpression(node); case 181: + return checkCallExpression(node); + case 182: return checkTaggedTemplateExpression(node); - case 183: - return checkExpression(node.expression, contextualMapper); - case 197: - return checkClassExpression(node); case 184: + return checkExpression(node.expression, checkMode); + case 198: + return checkClassExpression(node); case 185: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187: + case 186: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 188: return checkTypeOfExpression(node); - case 182: - case 200: - return checkAssertion(node); + case 183: case 201: + return checkAssertion(node); + case 202: return checkNonNullAssertion(node); - case 186: + case 203: + return checkMetaProperty(node); + case 187: return checkDeleteExpression(node); - case 188: - return checkVoidExpression(node); case 189: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 190: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 191: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 192: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 193: - return checkConditionalExpression(node, contextualMapper); - case 196: - return checkSpreadExpression(node, contextualMapper); - case 198: + return checkBinaryExpression(node, checkMode); + case 194: + return checkConditionalExpression(node, checkMode); + case 197: + return checkSpreadExpression(node, checkMode); + case 199: return undefinedWideningType; - case 195: + case 196: return checkYieldExpression(node); - case 252: - return checkJsxExpression(node); - case 246: + case 255: + return checkJsxExpression(node, checkMode); + case 248: return checkJsxElement(node); - case 247: + case 249: return checkJsxSelfClosingElement(node); - case 248: + case 253: + return checkJsxAttributes(node, checkMode); + case 250: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -32706,7 +36560,16 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); - getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); + checkSourceElement(node.default); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } + var constraintType = getConstraintOfTypeParameter(typeParameter); + var defaultType = getDefaultFromTypeParameter(typeParameter); + if (constraintType && defaultType) { + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } @@ -32717,7 +36580,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -32728,7 +36591,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 || func.kind === 154 || func.kind === 159) { + if (func.kind === 151 || func.kind === 155 || func.kind === 160) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -32736,14 +36599,6 @@ var ts; error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } } - function isSyntacticallyValidGenerator(node) { - if (!node.asteriskToken || !node.body) { - return false; - } - return node.kind === 149 || - node.kind === 225 || - node.kind === 184; - } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { @@ -32783,9 +36638,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_23 = _a[_i].name; - if (ts.isBindingPattern(name_23) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -32798,16 +36653,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 186: + case 154: + case 227: case 185: - case 153: - case 225: - case 184: - case 158: + case 159: + case 150: case 149: - case 148: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -32817,29 +36672,44 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_24 = element.name; - if (name_24.kind === 70 && - name_24.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_24.kind === 173 || - name_24.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 || + name.kind === 173) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 155) { + if (node.kind === 156) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 225 || node.kind === 159 || - node.kind === 153 || node.kind === 150 || - node.kind === 154) { + else if (node.kind === 159 || node.kind === 227 || node.kind === 160 || + node.kind === 154 || node.kind === 151 || + node.kind === 155) { checkGrammarFunctionLikeDeclaration(node); } + var functionFlags = ts.getFunctionFlags(node); + if ((functionFlags & 7) === 2 && languageVersion < 4) { + checkExternalEmitHelpers(node, 64); + if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } + if ((functionFlags & 5) === 1) { + if (functionFlags & 2 && languageVersion < 4) { + checkExternalEmitHelpers(node, 2048); + } + else if (languageVersion < 2) { + checkExternalEmitHelpers(node, 128); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -32847,29 +36717,32 @@ var ts; } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); - if (compilerOptions.noImplicitAny && !node.type) { + if (noImplicitAny && !node.type) { switch (node.kind) { - case 154: + case 155: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153: + case 154: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } } if (node.type) { - if (languageVersion >= 2 && isSyntacticallyValidGenerator(node)) { + var functionFlags_1 = ts.getFunctionFlags(node); + if ((functionFlags_1 & 5) === 1) { var returnType = getTypeFromTypeNode(node.type); if (returnType === voidType) { error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); } else { - var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType; - var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType); + var generatorElementType = getIteratedTypeOfGenerator(returnType, (functionFlags_1 & 2) !== 0) || anyType; + var iterableIteratorInstantiation = functionFlags_1 & 2 + ? createAsyncIterableIteratorType(generatorElementType) + : createIterableIteratorType(generatorElementType); checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } - else if (ts.isAsyncFunctionLike(node)) { + else if ((functionFlags_1 & 3) === 2) { checkAsyncFunctionReturnType(node); } } @@ -32879,11 +36752,18 @@ var ts; } } function checkClassForDuplicateDeclarations(node) { + var Declaration; + (function (Declaration) { + Declaration[Declaration["Getter"] = 1] = "Getter"; + Declaration[Declaration["Setter"] = 2] = "Setter"; + Declaration[Declaration["Method"] = 4] = "Method"; + Declaration[Declaration["Property"] = 3] = "Property"; + })(Declaration || (Declaration = {})); var instanceNames = ts.createMap(); var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -32892,36 +36772,65 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114; }); + var isStatic = ts.getModifierFlags(member) & 32; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151: + case 152: addName(names, member.name, memberName, 1); break; - case 152: + case 153: addName(names, member.name, memberName, 2); break; - case 147: + case 148: addName(names, member.name, memberName, 3); break; + case 150: + addName(names, member.name, memberName, 4); + break; } } } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4) { + if (meaning !== 4) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -32929,7 +36838,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146) { + if (member.kind === 147) { var memberName = void 0; switch (member.name.kind) { case 9: @@ -32940,18 +36849,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227) { + if (node.kind === 229) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -32966,7 +36875,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134: + case 135: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -33033,12 +36942,12 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 225) { + else if (n.kind !== 185 && n.kind !== 227) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 && + return n.kind === 148 && !(ts.getModifierFlags(n) & 32) && !!n.initializer; } @@ -33058,7 +36967,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -33081,18 +36990,18 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151) { + if (node.kind === 152) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128)) { if (!(node.flags & 256)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 151 ? 152 : 151; + var otherKind = node.kind === 152 ? 153 : 152; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) { @@ -33106,17 +37015,12 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151) { + if (node.kind === 152) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } - else { - checkNodeDeferred(node); - } + checkSourceElement(node.body); + registerForUnusedIdentifiersCheck(node); } function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { var firstType = getAnnotatedType(first); @@ -33125,14 +37029,11 @@ var ts; error(first, message); } } - function checkAccessorDeferred(node) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } function checkMissingDeclaration(node) { checkDecorators(node); } function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); var typeArguments; var mapper; var result = true; @@ -33140,7 +37041,7 @@ var ts; var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { if (!typeArguments) { - typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + typeArguments = fillMissingTypeArguments(ts.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, minTypeArgumentCount); mapper = createTypeMapper(typeParameters, typeArguments); } var typeArgument = typeArguments[i]; @@ -33191,25 +37092,42 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288)) { + return type; + } + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + if (maybeTypeOfKind(objectType, 540672) && isTypeOfKind(indexType, 340)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 227 && - n.parent.kind !== 226 && - n.parent.kind !== 197 && + if (n.parent.kind !== 229 && + n.parent.kind !== 228 && + n.parent.kind !== 198 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -33286,7 +37204,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 149 || node.kind === 148) && + var reportError = (node.kind === 150 || node.kind === 149) && (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32); if (reportError) { var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -33315,15 +37233,15 @@ var ts; } var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { - var current = declarations_4[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var current = declarations_5[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 || node.parent.kind === 162 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 227 || node.kind === 150 || node.kind === 149 || node.kind === 151) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -33374,8 +37292,8 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; + for (var _a = 0, signatures_4 = signatures; _a < signatures_4.length; _a++) { + var signature = signatures_4[_a]; if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -33434,16 +37352,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227: + case 229: return 2097152; - case 230: + case 232: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 226: - case 229: + case 228: + case 231: return 2097152 | 1048576; - case 234: + case 236: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -33453,87 +37371,92 @@ var ts; } } } - function checkNonThenableType(type, location, message) { - type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { - if (location) { - if (!message) { - message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; - } - error(location, message); - } - return unknownType; - } - return type; + function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage) { + var promisedType = getPromisedTypeOfPromise(type, errorNode); + return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage); } - function getPromisedType(promise) { + function getPromisedTypeOfPromise(promise, errorNode) { if (isTypeAny(promise)) { return undefined; } - if (getObjectFlags(promise) & 4) { - if (promise.target === tryGetGlobalPromiseType() - || promise.target === getGlobalPromiseLikeType()) { - return promise.typeArguments[0]; - } + var typeAsPromise = promise; + if (typeAsPromise.promisedTypeOfPromise) { + return typeAsPromise.promisedTypeOfPromise; } - var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType(); - if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) { - return undefined; + if (isReferenceToType(promise, getGlobalPromiseType(false))) { + return typeAsPromise.promisedTypeOfPromise = promise.typeArguments[0]; } var thenFunction = getTypeOfPropertyOfType(promise, "then"); - if (!thenFunction || isTypeAny(thenFunction)) { + if (isTypeAny(thenFunction)) { return undefined; } - var thenSignatures = getSignaturesOfType(thenFunction, 0); + var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : emptyArray; if (thenSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method); + } return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288); if (isTypeAny(onfulfilledParameterType)) { return undefined; } var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0); if (onfulfilledParameterSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + } return undefined; } - return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true); - } - function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return typeAsPromise.promisedTypeOfPromise = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), true); } - function getAwaitedType(type) { - return checkAwaitedType(type, undefined, undefined); + function checkAwaitedType(type, errorNode, diagnosticMessage) { + return getAwaitedType(type, errorNode, diagnosticMessage) || unknownType; } - function checkAwaitedType(type, location, message) { - return checkAwaitedTypeWorker(type); - function checkAwaitedTypeWorker(type) { - if (type.flags & 65536) { - var types = []; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var constituentType = _a[_i]; - types.push(checkAwaitedTypeWorker(constituentType)); - } - return getUnionType(types, true); + function getAwaitedType(type, errorNode, diagnosticMessage) { + var typeAsAwaitable = type; + if (typeAsAwaitable.awaitedTypeOfType) { + return typeAsAwaitable.awaitedTypeOfType; + } + if (isTypeAny(type)) { + return typeAsAwaitable.awaitedTypeOfType = type; + } + if (type.flags & 65536) { + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var constituentType = _a[_i]; + types = ts.append(types, getAwaitedType(constituentType, errorNode, diagnosticMessage)); } - else { - var promisedType = getPromisedType(type); - if (promisedType === undefined) { - return checkNonThenableType(type, location, message); - } - else { - if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { - if (location) { - error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); - } - return unknownType; - } - awaitedTypeStack.push(type.id); - var awaitedType = checkAwaitedTypeWorker(promisedType); - awaitedTypeStack.pop(); - return awaitedType; + if (!types) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, true); + } + var promisedType = getPromisedTypeOfPromise(type); + if (promisedType) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); } + return undefined; + } + awaitedTypeStack.push(type.id); + var awaitedType = getAwaitedType(promisedType, errorNode, diagnosticMessage); + awaitedTypeStack.pop(); + if (!awaitedType) { + return undefined; } + return typeAsAwaitable.awaitedTypeOfType = awaitedType; } + var thenFunction = getTypeOfPropertyOfType(type, "then"); + if (thenFunction && getSignaturesOfType(thenFunction, 0).length > 0) { + if (errorNode) { + ts.Debug.assert(!!diagnosticMessage); + error(errorNode, diagnosticMessage); + } + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = type; } function checkAsyncFunctionReturnType(node) { var returnType = getTypeFromTypeNode(node.type); @@ -33541,8 +37464,8 @@ var ts; if (returnType === unknownType) { return unknownType; } - var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) { + var globalPromiseType = getGlobalPromiseType(true); + if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) { error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); return unknownType; } @@ -33560,10 +37483,15 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 && promiseConstructorName.text === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } - var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(true); if (globalPromiseConstructorLikeType === emptyObjectType) { error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); return unknownType; @@ -33578,7 +37506,7 @@ var ts; return unknownType; } } - return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return checkAwaitedType(returnType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkDecorator(node) { var signature = getResolvedSignature(node); @@ -33590,22 +37518,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226: + case 228: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144: + case 145: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147: + case 148: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149: - case 151: + case 150: case 152: + case 153: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -33624,6 +37552,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } function checkDecorators(node) { if (!node.decorators) { return; @@ -33634,28 +37565,36 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8); + if (node.kind === 145) { + checkExternalEmitHelpers(firstDecorator, 32); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 226: + case 228: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; - case 149: - case 151: + case 150: case 152: + case 153: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147: - case 144: + case 148: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; + case 145: markTypeNodeAsReferenced(node.type); break; } @@ -33667,6 +37606,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -33674,8 +37614,8 @@ var ts; function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); - var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 142) { + var functionFlags = ts.getFunctionFlags(node); + if (node.name && node.name.kind === 143) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -33693,15 +37633,17 @@ var ts; } } checkSourceElement(node.body); - if (!node.asteriskToken) { - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if ((functionFlags & 1) === 0) { + var returnOrPromisedType = node.type && (functionFlags & 2 + ? checkAsyncFunctionReturnType(node) + : getTypeFromTypeNode(node.type)); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { - if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { + if (noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } - if (node.asteriskToken && ts.nodeIsPresent(node.body)) { + if (functionFlags & 1 && ts.nodeIsPresent(node.body)) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } } @@ -33717,56 +37659,54 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261: - case 230: + case 264: + case 232: checkUnusedModuleMembers(node); break; - case 226: - case 197: + case 228: + case 198: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227: + case 229: checkUnusedTypeParameters(node); break; - case 204: - case 232: - case 211: - case 212: + case 206: + case 234: case 213: + case 214: + case 215: checkUnusedLocalsAndParameters(node); break; - case 150: - case 184: - case 225: - case 185: - case 149: case 151: + case 185: + case 227: + case 186: + case 150: case 152: + case 153: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148: - case 153: + case 149: case 154: case 155: - case 158: + case 156: case 159: + case 160: checkUnusedTypeParameters(node); break; } - ; } } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -33779,22 +37719,28 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_3(key); - } + }); + } + } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; } + return false; } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 && - (declaration.parent.parent.kind === 212 || - declaration.parent.parent.kind === 213)) { + if (declaration.kind === 225 && + (declaration.parent.parent.kind === 214 || + declaration.parent.parent.kind === 215)) { return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -33807,12 +37753,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 || member.kind === 147) { + if (member.kind === 150 || member.kind === 148) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150) { + else if (member.kind === 151) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) { @@ -33843,21 +37789,20 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } - } + }); } } function checkBlock(node) { - if (node.kind === 204) { + if (node.kind === 206) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -33879,19 +37824,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 || - node.kind === 146 || + if (node.kind === 148 || + node.kind === 147 || + node.kind === 150 || node.kind === 149 || - node.kind === 148 || - node.kind === 151 || - node.kind === 152) { + node.kind === 152 || + node.kind === 153) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -33901,9 +37846,13 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } function checkIfThisIsCapturedInEnclosingScope(node) { - var current = node; - while (current) { + ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4) { var isDeclaration_1 = node.kind !== 70; if (isDeclaration_1) { @@ -33912,10 +37861,23 @@ var ts; else { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); } - return; + return true; } - current = current.parent; - } + }); + } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + ts.findAncestor(node, function (current) { + if (getNodeCheckFlags(current) & 8) { + var isDeclaration_2 = node.kind !== 70; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return true; + } + }); } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { @@ -33926,8 +37888,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -33942,23 +37904,23 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 264 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 232 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192) { + if (parent.kind === 264 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -33966,7 +37928,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 223 && !node.initializer) { + if (node.kind === 225 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -33976,25 +37938,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224); - var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226); + var container = varDeclList.parent.kind === 207 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 204 && ts.isFunctionLike(container.parent) || - container.kind === 231 || - container.kind === 230 || - container.kind === 261); + (container.kind === 206 && ts.isFunctionLike(container.parent) || + container.kind === 233 || + container.kind === 232 || + container.kind === 264); if (!namesShareScope) { - var name_25 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144) { + if (ts.getRootDeclaration(node).kind !== 145) { return; } var func = ts.getContainingFunction(node); @@ -34003,7 +37965,7 @@ var ts; if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { return; } - if (n.kind === 177) { + if (n.kind === 178) { return visit(n.expression); } else if (n.kind === 70) { @@ -34017,21 +37979,21 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144) { + if (symbol.valueDeclaration.kind === 145 || + symbol.valueDeclaration.kind === 175) { if (symbol.valueDeclaration.pos < node.pos) { return; } - var current = n; - while (current !== node.initializer) { - if (ts.isFunctionLike(current.parent)) { - return; - } - if (current.parent.kind === 147 && - !(ts.hasModifier(current.parent, 32)) && - ts.isClassLike(current.parent.parent)) { - return; + if (ts.findAncestor(n, function (current) { + if (current === node.initializer) { + return "quit"; } - current = current.parent; + return ts.isFunctionLike(current.parent) || + (current.parent.kind === 148 && + !(ts.hasModifier(current.parent, 32)) && + ts.isClassLike(current.parent.parent)); + })) { + return; } } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); @@ -34048,34 +38010,40 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 142) { + if (node.name.kind === 143) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174) { - if (node.propertyName && node.propertyName.kind === 142) { + if (node.kind === 175) { + if (node.parent.kind === 173 && languageVersion < 5) { + checkExternalEmitHelpers(node, 4); + } + if (node.propertyName && node.propertyName.kind === 143) { checkComputedPropertyName(node.propertyName); } - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); - var name_26 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent.initializer && property) { + checkPropertyAccessibility(parent, parent.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { + if (node.name.kind === 174 && languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512); + } ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 144 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -34084,7 +38052,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 214) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -34102,20 +38070,21 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 && node.kind !== 146) { + if (node.kind !== 148 && node.kind !== 147) { checkExportsOnMergedDeclarations(node); - if (node.kind === 223 || node.kind === 174) { + if (node.kind === 225 || node.kind === 175) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 223) || - (left.kind === 223 && right.kind === 144)) { + if ((left.kind === 145 && right.kind === 225) || + (left.kind === 225 && right.kind === 145)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -34142,8 +38111,8 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 176) { - if (ts.isAsyncFunctionLike(node)) { + if (node.modifiers && node.parent.kind === 177) { + if (ts.getFunctionFlags(node) & 2) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } @@ -34161,7 +38130,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206) { + if (node.thenStatement.kind === 208) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -34178,12 +38147,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224) { + if (node.initializer && node.initializer.kind === 226) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224) { + if (node.initializer.kind === 226) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -34201,13 +38170,23 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 224) { + if (node.kind === 215) { + if (node.awaitModifier) { + if (languageVersion < 4) { + checkExternalEmitHelpers(node, 8192); + } + } + else if (languageVersion < 2 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256); + } + } + if (node.initializer.kind === 226) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 175 || varExpr.kind === 176) { + var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); + if (varExpr.kind === 176 || varExpr.kind === 177) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -34226,7 +38205,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 226) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -34236,7 +38215,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 || varExpr.kind === 176) { + if (varExpr.kind === 176 || varExpr.kind === 177) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -34246,7 +38225,7 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 16384 | 524288)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -34261,161 +38240,199 @@ var ts; checkVariableDeclaration(decl); } } - function checkRightHandSideOfForOf(rhsExpression) { + function checkRightHandSideOfForOf(rhsExpression, awaitModifier) { var expressionType = checkNonNullExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, true, awaitModifier !== undefined); } - function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { + function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable) { if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= 2) { - return checkElementTypeOfIterable(inputType, errorNode); + return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, true) || anyType; + } + function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, checkAssignability) { + var uplevelIteration = languageVersion >= 2; + var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; + if (uplevelIteration || downlevelIteration || allowAsyncIterable) { + var iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterable, allowAsyncIterable, checkAssignability); + if (iteratedType || uplevelIteration) { + return iteratedType; + } } + var arrayType = inputType; + var reportedError = false; + var hasStringConstituent = false; if (allowStringInput) { - return checkElementTypeOfArrayOrString(inputType, errorNode); - } - if (isArrayLikeType(inputType)) { - var indexType = getIndexTypeOfType(inputType, 1); - if (indexType) { - return indexType; + if (arrayType.flags & 65536) { + var arrayTypes = inputType.types; + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); + if (filteredTypes !== arrayTypes) { + arrayType = getUnionType(filteredTypes, true); + } + } + else if (arrayType.flags & 262178) { + arrayType = neverType; + } + hasStringConstituent = arrayType !== inputType; + if (hasStringConstituent) { + if (languageVersion < 1) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + } + if (arrayType.flags & 8192) { + return stringType; + } } } - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (!isArrayLikeType(arrayType)) { + if (errorNode && !reportedError) { + var diagnostic = !allowStringInput || hasStringConstituent + ? downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type + : downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(errorNode, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : undefined; } - return unknownType; - } - function checkElementTypeOfIterable(iterable, errorNode) { - var elementType = getElementTypeOfIterable(iterable, errorNode); - if (errorNode && elementType) { - checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode); + var arrayElementType = getIndexTypeOfType(arrayType, 1); + if (hasStringConstituent && arrayElementType) { + if (arrayElementType.flags & 262178) { + return stringType; + } + return getUnionType([arrayElementType, stringType], true); } - return elementType || anyType; + return arrayElementType; } - function getElementTypeOfIterable(type, errorNode) { + function getIteratedTypeOfIterable(type, errorNode, isAsyncIterable, allowNonAsyncIterables, checkAssignability) { if (isTypeAny(type)) { return undefined; } var typeAsIterable = type; - if (!typeAsIterable.iterableElementType) { - if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableType()) { - typeAsIterable.iterableElementType = type.typeArguments[0]; + if (isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable) { + return isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable; + } + if (isAsyncIterable) { + if (isReferenceToType(type, getGlobalAsyncIterableType(false)) || + isReferenceToType(type, getGlobalAsyncIterableIteratorType(false))) { + return typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0]; } - else { - var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); - if (isTypeAny(iteratorFunction)) { - return undefined; - } - var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0) : emptyArray; - if (iteratorFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); - } - return undefined; - } - typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), true), errorNode); + } + if (!isAsyncIterable || allowNonAsyncIterables) { + if (isReferenceToType(type, getGlobalIterableType(false)) || + isReferenceToType(type, getGlobalIterableIteratorType(false))) { + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0] + : typeAsIterable.iteratedTypeOfIterable = type.typeArguments[0]; } } - return typeAsIterable.iterableElementType; - } - function getElementTypeOfIterator(type, errorNode) { - if (isTypeAny(type)) { - return undefined; + var iteratorMethodSignatures; + var mayBeIterable = false; + if (isAsyncIterable) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("asyncIterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; + } + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0); } - var typeAsIterator = type; - if (!typeAsIterator.iteratorElementType) { - if ((getObjectFlags(type) & 4) && type.target === getGlobalIteratorType()) { - typeAsIterator.iteratorElementType = type.typeArguments[0]; + if (!isAsyncIterable || (allowNonAsyncIterables && !ts.some(iteratorMethodSignatures))) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; } - else { - var iteratorNextFunction = getTypeOfPropertyOfType(type, "next"); - if (isTypeAny(iteratorNextFunction)) { - return undefined; - } - var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0) : emptyArray; - if (iteratorNextFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method); - } - return undefined; - } - var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), true); - if (isTypeAny(iteratorNextResult)) { - return undefined; - } - var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); - if (!iteratorNextValue) { - if (errorNode) { - error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); - } - return undefined; - } - typeAsIterator.iteratorElementType = iteratorNextValue; + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0); + mayBeIterable = true; + } + if (ts.some(iteratorMethodSignatures)) { + var iteratorMethodReturnType = getUnionType(ts.map(iteratorMethodSignatures, getReturnTypeOfSignature), true); + var iteratedType = getIteratedTypeOfIterator(iteratorMethodReturnType, errorNode, false); + if (checkAssignability && errorNode && iteratedType) { + checkTypeAssignableTo(type, mayBeIterable + ? createIterableType(iteratedType) + : createAsyncIterableType(iteratedType), errorNode); } + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType + : typeAsIterable.iteratedTypeOfIterable = iteratedType; + } + if (errorNode) { + error(errorNode, isAsyncIterable + ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); } - return typeAsIterator.iteratorElementType; + return undefined; } - function getElementTypeOfIterableIterator(type) { + function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (isTypeAny(type)) { return undefined; } - if ((getObjectFlags(type) & 4) && type.target === getGlobalIterableIteratorType()) { - return type.typeArguments[0]; + var typeAsIterator = type; + if (isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator) { + return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator; } - return getElementTypeOfIterable(type, undefined) || - getElementTypeOfIterator(type, undefined); - } - function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { - ts.Debug.assert(languageVersion < 2); - var arrayType = arrayOrStringType; - if (arrayOrStringType.flags & 65536) { - var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178); }); - if (filteredTypes !== arrayTypes) { - arrayType = getUnionType(filteredTypes, true); - } + var getIteratorType = isAsyncIterator ? getGlobalAsyncIteratorType : getGlobalIteratorType; + if (isReferenceToType(type, getIteratorType(false))) { + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = type.typeArguments[0] + : typeAsIterator.iteratedTypeOfIterator = type.typeArguments[0]; } - else if (arrayOrStringType.flags & 262178) { - arrayType = neverType; + var nextMethod = getTypeOfPropertyOfType(type, "next"); + if (isTypeAny(nextMethod)) { + return undefined; } - var hasStringConstituent = arrayOrStringType !== arrayType; - var reportedError = false; - if (hasStringConstituent) { - if (languageVersion < 1) { - error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - reportedError = true; - } - if (arrayType.flags & 8192) { - return stringType; + var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0) : emptyArray; + if (nextMethodSignatures.length === 0) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.An_async_iterator_must_have_a_next_method + : ts.Diagnostics.An_iterator_must_have_a_next_method); } + return undefined; } - if (!isArrayLikeType(arrayType)) { - if (!reportedError) { - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; - error(errorNode, diagnostic, typeToString(arrayType)); + var nextResult = getUnionType(ts.map(nextMethodSignatures, getReturnTypeOfSignature), true); + if (isTypeAny(nextResult)) { + return undefined; + } + if (isAsyncIterator) { + nextResult = getAwaitedTypeOfPromise(nextResult, errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property); + if (isTypeAny(nextResult)) { + return undefined; } - return hasStringConstituent ? stringType : unknownType; } - var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; - if (hasStringConstituent) { - if (arrayElementType.flags & 262178) { - return stringType; + var nextValue = nextResult && getTypeOfPropertyOfType(nextResult, "value"); + if (!nextValue) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property + : ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); } - return getUnionType([arrayElementType, stringType], true); + return undefined; } - return arrayElementType; + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = nextValue + : typeAsIterator.iteratedTypeOfIterator = nextValue; + } + function getIteratedTypeOfGenerator(returnType, isAsyncGenerator) { + if (isTypeAny(returnType)) { + return undefined; + } + return getIteratedTypeOfIterable(returnType, undefined, isAsyncGenerator, false, false) + || getIteratedTypeOfIterator(returnType, undefined, isAsyncGenerator); } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152))); + return !!(node.kind === 152 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { - var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + var unwrappedReturnType = (ts.getFunctionFlags(func) & 3) === 2 + ? getPromisedTypeOfPromise(returnType) + : returnType; return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 | 1); } function checkReturnStatement(node) { @@ -34431,40 +38448,41 @@ var ts; var returnType = getReturnTypeOfSignature(signature); if (strictNullChecks || node.expression || returnType.flags & 8192) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (func.asteriskToken) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1) { return; } - if (func.kind === 152) { + if (func.kind === 153) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { - if (ts.isAsyncFunctionLike(func)) { - var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (functionFlags & 2) { + var promisedType = getPromisedTypeOfPromise(returnType); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288) { + if (node.flags & 16384) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -34483,7 +38501,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 254 && !hasDuplicateDefaultClause) { + if (clause.kind === 257 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -34495,7 +38513,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253) { + if (produceDiagnostics && clause.kind === 256) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -34516,18 +38534,16 @@ var ts; } function checkLabeledStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - var current = node.parent; - while (current) { + ts.findAncestor(node.parent, function (current) { if (ts.isFunctionLike(current)) { - break; + return "quit"; } - if (current.kind === 219 && current.label.text === node.label.text) { + if (current.kind === 221 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); - break; + return true; } - current = current.parent; - } + }); } checkSourceElement(node.statement); } @@ -34554,14 +38570,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -34609,12 +38625,13 @@ var ts; if (!indexType) { return; } - if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + var propDeclaration = prop.valueDeclaration; + if (indexKind === 1 && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } var errorNode; - if (prop.valueDeclaration.name.kind === 142 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -34639,15 +38656,23 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + var seenDefault = false; + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { + if (node.default) { + seenDefault = true; + } + else if (seenDefault) { + error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + } for (var j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); @@ -34657,22 +38682,56 @@ var ts; } } } - function checkTypeParameterListsIdentical(node, symbol) { + function checkTypeParameterListsIdentical(symbol) { if (symbol.declarations.length === 1) { return; } - var firstDecl; - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 226 || declaration.kind === 227) { - if (!firstDecl) { - firstDecl = declaration; + var links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (declarations.length <= 1) { + return; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { + var name = symbolToString(symbol); + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); } - else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + function areTypeParametersIdentical(declarations, typeParameters) { + var maxTypeArgumentCount = ts.length(typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var numTypeParameters = ts.length(declaration.typeParameters); + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + return false; + } + for (var i = 0; i < numTypeParameters; i++) { + var source = declaration.typeParameters[i]; + var target = typeParameters[i]; + if (source.name.text !== target.symbol.name) { + return false; + } + var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); + var targetConstraint = getConstraintFromTypeParameter(target); + if ((sourceConstraint || targetConstraint) && + (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { + return false; + } + var sourceDefault = source.default && getTypeFromTypeNode(source.default); + var targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + return false; } } } + return true; } function checkClassExpression(node) { checkClassLikeDeclaration(node); @@ -34692,11 +38751,12 @@ var ts; registerForUnusedIdentifiersCheck(node); } function checkClassLikeDeclaration(node) { - checkGrammarClassDeclarationHeritageClauses(node); + checkGrammarClassLikeDeclaration(node); checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -34706,19 +38766,26 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); checkClassForDuplicateDeclarations(node); + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2) { + checkExternalEmitHelpers(baseTypeNode.parent, 1); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); - for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { + for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) { var constructor = _a[_i]; if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { break; @@ -34727,15 +38794,11 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && - !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226) { - if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { - error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); - } + if (baseConstructorType.flags & 540672 && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { - var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 540672)) { + var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } @@ -34754,8 +38817,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 ? t.target : t; - if (getObjectFlags(declaredType) & 3) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -34783,17 +38845,22 @@ var ts; } } function getTargetSymbol(s) { - return s.flags & 16777216 ? getSymbolLinks(s).target : s; + return getCheckFlags(s) & 1 ? s.target : s; } function getClassLikeDeclarationOfSymbol(symbol) { return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } + function getClassOrInterfaceDeclarationsOfSymbol(symbol) { + return ts.filter(symbol.declarations, function (d) { + return d.kind === 228 || d.kind === 229; + }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); - if (base.flags & 134217728) { + if (base.flags & 16777216) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); @@ -34803,7 +38870,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) { - if (derivedClassDecl.kind === 197) { + if (derivedClassDecl.kind === 198) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -34813,66 +38880,37 @@ var ts; } else { var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 8) || (derivedDeclarationFlags & 8)) { + if (baseDeclarationFlags & 8 || derivedDeclarationFlags & 8) { continue; } if ((baseDeclarationFlags & 32) !== (derivedDeclarationFlags & 32)) { continue; } - if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { + if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 && derived.flags & 98308) { continue; } var errorMessage = void 0; - if (base.flags & 8192) { + if (isMethodLike(base)) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert((derived.flags & 4) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & 4) { - ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert((base.flags & 98304) !== 0); - ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } - error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + error(derived.valueDeclaration.name || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } } } } function isAccessor(kind) { - return kind === 151 || kind === 152; - } - function areTypeParametersIdentical(list1, list2) { - if (!list1 && !list2) { - return true; - } - if (!list1 || !list2 || list1.length !== list2.length) { - return false; - } - for (var i = 0, len = list1.length; i < len; i++) { - var tp1 = list1[i]; - var tp2 = list2[i]; - if (tp1.name.text !== tp2.name.text) { - return false; - } - if (!tp1.constraint && !tp2.constraint) { - continue; - } - if (!tp1.constraint || !tp2.constraint) { - return false; - } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { - return false; - } - } - return true; + return kind === 152 || kind === 153; } function checkInheritedPropertiesAreIdentical(type, typeNode) { var baseTypes = getBaseTypes(type); @@ -34880,16 +38918,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; - var existing = seen[prop.name]; + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_8 = properties; _a < properties_8.length; _a++) { + var prop = properties_8[_a]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -34913,8 +38951,8 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227); + checkTypeParameterListsIdentical(symbol); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -35010,7 +39048,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190: + case 191: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -35021,7 +39059,7 @@ var ts; case 51: return ~value_1; } return undefined; - case 192: + case 193: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -35045,12 +39083,13 @@ var ts; } return undefined; case 8: + checkGrammarNumericLiteral(e); return +e.text; - case 183: + case 184: return evalConstant(e.expression); case 70: + case 179: case 178: - case 177: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -35061,7 +39100,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178) { + if (e.kind === 179) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -35078,7 +39117,7 @@ var ts; if (current.kind === 70) { break; } - else if (current.kind === 177) { + else if (current.kind === 178) { current = current.expression; } else { @@ -35118,6 +39157,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -35138,7 +39178,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 229) { + if (declaration.kind !== 231) { return false; } var enumDeclaration = declaration; @@ -35159,10 +39199,10 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { - var declaration = declarations_5[_i]; - if ((declaration.kind === 226 || - (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) && + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + if ((declaration.kind === 228 || + (declaration.kind === 227 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -35221,7 +39261,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 226); + var mergedClass = ts.getDeclarationOfKind(symbol, 228); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -35229,7 +39269,7 @@ var ts; } if (isAmbientExternalModule) { if (ts.isExternalModuleAugmentation(node)) { - var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432); + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 134217728); if (checkBody && node.body) { for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { var statement = _a[_i]; @@ -35264,42 +39304,42 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205: + case 207: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240: - case 241: + case 242: + case 243: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234: - case 235: + case 236: + case 237: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174: - case 223: - var name_27 = node.name; - if (ts.isBindingPattern(name_27)) { - for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { + case 175: + case 225: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 226: - case 229: - case 225: + case 228: + case 231: case 227: + case 229: + case 232: case 230: - case 228: if (isGlobalAugmentation) { return; } var symbol = getSymbolOfNode(node); if (symbol) { - var reportError = !(symbol.flags & 33554432); + var reportError = !(symbol.flags & 134217728); if (!reportError) { reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } @@ -35311,12 +39351,12 @@ var ts; switch (node.kind) { case 70: return node; - case 141: + case 142: do { node = node.left; } while (node.kind !== 70); return node; - case 177: + case 178: do { node = node.expression; } while (node.kind !== 70); @@ -35329,9 +39369,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 ? + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 264 && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -35352,7 +39392,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 ? + var message = node.kind === 245 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -35379,7 +39419,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 239) { checkImportBinding(importClause.namedBindings); } else { @@ -35430,8 +39470,10 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 264 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -35444,7 +39486,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230; + var isInAppropriateContext = node.parent.kind === 264 || node.parent.kind === 233 || node.parent.kind === 232; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -35467,9 +39509,14 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 261 ? node.parent : node.parent.parent; - if (container.kind === 230 && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 264 ? node.parent : node.parent.parent; + if (container.kind === 232 && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { @@ -35492,50 +39539,45 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { error(declaration, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); } } - var exports_1 = getExportsOfModule(moduleSymbol); - for (var id in exports_1) { + var exports = getExportsOfModule(moduleSymbol); + exports && exports.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports_1[id], declarations = _a.declarations, flags = _a.flags; if (flags & (1920 | 64 | 384)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 && exportedDeclarationsCount <= 2) { - continue; + return; } if (exportedDeclarationsCount > 1) { - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; if (isNotOverload(declaration)) { diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 && declaration.kind !== 149) || + return (declaration.kind !== 227 && declaration.kind !== 150) || !!declaration.body; } } @@ -35546,123 +39588,123 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 230: - case 226: + case 232: + case 228: + case 229: case 227: - case 225: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143: - return checkTypeParameter(node); case 144: + return checkTypeParameter(node); + case 145: return checkParameter(node); + case 148: case 147: - case 146: return checkPropertyDeclaration(node); - case 158: case 159: - case 153: + case 160: case 154: - return checkSignatureDeclaration(node); case 155: return checkSignatureDeclaration(node); + case 156: + return checkSignatureDeclaration(node); + case 150: case 149: - case 148: return checkMethodDeclaration(node); - case 150: - return checkConstructorDeclaration(node); case 151: + return checkConstructorDeclaration(node); case 152: + case 153: return checkAccessorDeclaration(node); - case 157: + case 158: return checkTypeReferenceNode(node); - case 156: + case 157: return checkTypePredicate(node); - case 160: - return checkTypeQuery(node); case 161: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 162: - return checkArrayType(node); + return checkTypeLiteral(node); case 163: - return checkTupleType(node); + return checkArrayType(node); case 164: + return checkTupleType(node); case 165: - return checkUnionOrIntersectionType(node); case 166: - case 168: - return checkSourceElement(node.type); + return checkUnionOrIntersectionType(node); + case 167: case 169: - return checkIndexedAccessType(node); + return checkSourceElement(node.type); case 170: + return checkIndexedAccessType(node); + case 171: return checkMappedType(node); - case 225: + case 227: return checkFunctionDeclaration(node); - case 204: - case 231: + case 206: + case 233: return checkBlock(node); - case 205: - return checkVariableStatement(node); case 207: - return checkExpressionStatement(node); - case 208: - return checkIfStatement(node); + return checkVariableStatement(node); case 209: - return checkDoStatement(node); + return checkExpressionStatement(node); case 210: - return checkWhileStatement(node); + return checkIfStatement(node); case 211: - return checkForStatement(node); + return checkDoStatement(node); case 212: - return checkForInStatement(node); + return checkWhileStatement(node); case 213: - return checkForOfStatement(node); + return checkForStatement(node); case 214: + return checkForInStatement(node); case 215: - return checkBreakOrContinueStatement(node); + return checkForOfStatement(node); case 216: - return checkReturnStatement(node); case 217: - return checkWithStatement(node); + return checkBreakOrContinueStatement(node); case 218: - return checkSwitchStatement(node); + return checkReturnStatement(node); case 219: - return checkLabeledStatement(node); + return checkWithStatement(node); case 220: - return checkThrowStatement(node); + return checkSwitchStatement(node); case 221: - return checkTryStatement(node); + return checkLabeledStatement(node); + case 222: + return checkThrowStatement(node); case 223: + return checkTryStatement(node); + case 225: return checkVariableDeclaration(node); - case 174: + case 175: return checkBindingElement(node); - case 226: + case 228: return checkClassDeclaration(node); - case 227: + case 229: return checkInterfaceDeclaration(node); - case 228: + case 230: return checkTypeAliasDeclaration(node); - case 229: + case 231: return checkEnumDeclaration(node); - case 230: + case 232: return checkModuleDeclaration(node); - case 235: + case 237: return checkImportDeclaration(node); - case 234: + case 236: return checkImportEqualsDeclaration(node); - case 241: + case 243: return checkExportDeclaration(node); - case 240: + case 242: return checkExportAssignment(node); - case 206: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 222: + case 224: checkGrammarStatementInAmbientContext(node); return; - case 244: + case 246: return checkMissingDeclaration(node); } } @@ -35675,17 +39717,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184: case 185: + case 186: + case 150: case 149: - case 148: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151: case 152: - checkAccessorDeferred(node); + case 153: + checkAccessorDeclaration(node); break; - case 197: + case 198: checkClassExpressionDeferred(node); break; } @@ -35705,6 +39747,7 @@ var ts; } checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -35724,6 +39767,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1; } } @@ -35768,7 +39815,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 && node.parent.statement === node) { + if (node.parent.kind === 219 && node.parent.statement === node) { return true; } node = node.parent; @@ -35777,11 +39824,11 @@ var ts; return false; } function getSymbolsInScope(location, meaning) { - var symbols = ts.createMap(); - var memberFlags = 0; if (isInsideWithStatementBody(location)) { return []; } + var symbols = ts.createMap(); + var memberFlags = 0; populateSymbols(); return symbolsToArray(symbols); function populateSymbols() { @@ -35790,28 +39837,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261: + case 264: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: + case 232: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 229: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 197: + case 198: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 226: - case 227: + case 228: + case 229: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } break; - case 184: + case 185: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -35829,17 +39876,16 @@ var ts; function copySymbol(symbol, meaning) { if (symbol.flags & meaning) { var id = symbol.name; - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -35850,27 +39896,27 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143: - case 226: - case 227: + case 144: case 228: case 229: + case 230: + case 231: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141) { + while (node.parent && node.parent.kind === 142) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 272); + return node.parent && (node.parent.kind === 158 || node.parent.kind === 276); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177) { + while (node.parent && node.parent.kind === 178) { node = node.parent; } - return node.parent && node.parent.kind === 199; + return node.parent && node.parent.kind === 200; } function forEachEnclosingClass(node, callback) { var result; @@ -35887,13 +39933,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141) { + while (nodeOnRightSide.parent.kind === 142) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234) { + if (nodeOnRightSide.parent.kind === 236) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240) { + if (nodeOnRightSide.parent.kind === 242) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -35901,27 +39947,35 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } + function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1: + case 3: + return getSymbolOfNode(entityName.parent); + case 4: + case 2: + case 5: + return getSymbolOfNode(entityName.parent.parent); + } + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177) { - var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); - switch (specialPropertyAssignmentKind) { - case 1: - case 3: - return getSymbolOfNode(entityName.parent); - case 4: - case 2: - return getSymbolOfNode(entityName.parent.parent); - default: + if (ts.isInJavaScriptFile(entityName) && + entityName.parent.kind === 178 && + entityName.parent === entityName.parent.parent.left) { + var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); + if (specialPropertyAssignmentSymbol) { + return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } - if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 234); + if (entityName.kind !== 178 && isInRightSideOfImportOrExportAssignment(entityName)) { + var importEqualsDeclaration = ts.getAncestor(entityName, 236); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -35930,7 +39984,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 199) { + if (entityName.parent.kind === 200) { meaning = 793064; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -35940,9 +39994,12 @@ var ts; meaning = 1920; } meaning |= 8388608; - return resolveEntityName(entityName, meaning); + var entityNameSymbol = resolveEntityName(entityName, meaning); + if (entityNameSymbol) { + return entityNameSymbol; + } } - else if (ts.isPartOfExpression(entityName)) { + if (ts.isPartOfExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } @@ -35952,14 +40009,14 @@ var ts; } return resolveEntityName(entityName, 107455, false, true); } - else if (entityName.kind === 177) { + else if (entityName.kind === 178) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141) { + else if (entityName.kind === 142) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -35968,19 +40025,19 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 158 || entityName.parent.kind === 276) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 250) { + else if (entityName.parent.kind === 252) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157) { return resolveEntityName(entityName, 1); } return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261) { + if (node.kind === 264) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -35996,8 +40053,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 && - node.parent.parent.kind === 172 && + else if (node.parent.kind === 175 && + node.parent.parent.kind === 173 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -36008,8 +40065,8 @@ var ts; } switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98: var container = ts.getThisContainer(node, false); @@ -36022,18 +40079,18 @@ var ts; case 96: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167: + case 168: return getTypeFromTypeNode(node).symbol; case 122: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150) { + if (constructorDeclaration && constructorDeclaration.kind === 151) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 || node.parent.kind === 241) && + ((node.parent.kind === 237 || node.parent.kind === 243) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -36041,7 +40098,7 @@ var ts; return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 178 && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -36055,7 +40112,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 258) { + if (location && location.kind === 261) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -36070,13 +40127,22 @@ var ts; return unknownType; } if (ts.isPartOfTypeNode(node)) { - return getTypeFromTypeNode(node); + var typeFromTypeNode = getTypeFromTypeNode(node); + if (typeFromTypeNode && ts.isExpressionWithTypeArgumentsInClassImplementsClause(node)) { + var containingClass = ts.getContainingClass(node); + var classType = getTypeOfNode(containingClass); + typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType); + } + return typeFromTypeNode; } if (ts.isPartOfExpression(node)) { return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { - return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; + var classNode = ts.getContainingClass(node); + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)); + var baseType = getBaseTypes(classType)[0]; + return baseType && getTypeWithThisArgument(baseType, classType.thisType); } if (isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); @@ -36105,22 +40171,22 @@ var ts; return unknownType; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 213) { - var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + ts.Debug.assert(expr.kind === 177 || expr.kind === 176); + if (expr.parent.kind === 215) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 192) { + if (expr.parent.kind === 193) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 257) { + if (expr.parent.kind === 260) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } - ts.Debug.assert(expr.parent.kind === 175); + ts.Debug.assert(expr.parent.kind === 176); var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false) || unknownType; + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, false, false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); } function getPropertySymbolOfDestructuringAssignment(location) { @@ -36144,29 +40210,32 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 268435456) { + if (getCheckFlags(symbol) & 6) { var symbols_3 = []; - var name_28 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_28); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } }); return symbols_3; } - else if (symbol.flags & 67108864) { + else if (symbol.flags & 134217728) { if (symbol.leftSpread) { var links = symbol; - return [links.leftSpread, links.rightSpread]; + return getRootSymbols(links.leftSpread).concat(getRootSymbols(links.rightSpread)); + } + if (symbol.syntheticOrigin) { + return getRootSymbols(symbol.syntheticOrigin); } var target = void 0; var next = symbol; @@ -36183,7 +40252,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -36199,7 +40269,7 @@ var ts; if (symbolLinks.exportsSomeValue === undefined) { symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -36223,19 +40293,15 @@ var ts; } symbol = exportSymbol; } - var parentSymbol = getParentOfSymbol(symbol); - if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) { - var symbolFile = parentSymbol.valueDeclaration; + var parentSymbol_1 = getParentOfSymbol(symbol); + if (parentSymbol_1) { + if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 264) { + var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; return symbolIsUmdExport ? undefined : symbolFile; } - for (var n = node.parent; n; n = n.parent) { - if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) { - return n; - } - } + return ts.findAncestor(node.parent, function (n) { return ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1; }); } } } @@ -36263,7 +40329,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 206 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -36298,21 +40364,17 @@ var ts; return false; } function isValueAliasDeclaration(node) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - return true; - } switch (node.kind) { - case 234: case 236: - case 237: + case 238: case 239: - case 243: - return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); case 241: + case 245: + return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); + case 243: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240: + case 242: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -36322,7 +40384,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 264 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -36340,10 +40402,6 @@ var ts; return isConstEnumSymbol(s) || s.constEnumOnlyModule; } function isReferencedAliasDeclaration(node, checkChildren) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - return true; - } if (ts.isAliasSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node); if (symbol && getSymbolLinks(symbol).referenced) { @@ -36364,16 +40422,30 @@ var ts; } return false; } + function isRequiredInitializedParameter(parameter) { + return strictNullChecks && + !isOptionalParameter(parameter) && + parameter.initializer && + !(ts.getModifierFlags(parameter) & 92); + } function getNodeCheckFlags(node) { - node = ts.getParseTreeNode(node); - return node ? getNodeLinks(node).flags : undefined; + return getNodeLinks(node).flags; } function getEnumMemberValue(node) { computeEnumMemberValues(node.parent); return getNodeLinks(node).enumMemberValue; } + function canHaveConstantValue(node) { + switch (node.kind) { + case 263: + case 178: + case 179: + return true; + } + return false; + } function getConstantValue(node) { - if (node.kind === 260) { + if (node.kind === 263) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -36389,15 +40461,17 @@ var ts; } function getTypeReferenceSerializationKind(typeName, location) { var valueSymbol = resolveEntityName(typeName, 107455, true, false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } var typeSymbol = resolveEntityName(typeName, 793064, true, false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(false); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; } @@ -36441,6 +40515,9 @@ var ts; var type = symbol && !(symbol.flags & (2048 | 131072)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : unknownType; + if (flags & 4096) { + type = includeFalsyTypes(type, 2048); + } getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -36455,10 +40532,13 @@ var ts; var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); resolveBaseTypesOfClass(classType); var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + if (!baseType.symbol) { + writer.reportIllegalExtends(); + } getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -36467,9 +40547,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36502,34 +40582,46 @@ var ts; var fileToDirective; if (resolvedTypeReferenceDirectives) { fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, isDeclarationWithCollidingName: isDeclarationWithCollidingName, - isValueAliasDeclaration: isValueAliasDeclaration, + isValueAliasDeclaration: function (node) { + node = ts.getParseTreeNode(node); + return node ? isValueAliasDeclaration(node) : true; + }, hasGlobalName: hasGlobalName, - isReferencedAliasDeclaration: isReferencedAliasDeclaration, - getNodeCheckFlags: getNodeCheckFlags, + isReferencedAliasDeclaration: function (node, checkChildren) { + node = ts.getParseTreeNode(node); + return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + }, + getNodeCheckFlags: function (node) { + node = ts.getParseTreeNode(node); + return node ? getNodeCheckFlags(node) : undefined; + }, isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, + isRequiredInitializedParameter: isRequiredInitializedParameter, writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, - getConstantValue: getConstantValue, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, collectLinkedAliases: collectLinkedAliases, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, @@ -36547,7 +40639,7 @@ var ts; if (!fileToDirective) { return undefined; } - var meaning = (node.kind === 177) || (node.kind === 70 && isInTypeQuery(node)) + var meaning = (node.kind === 178) || (node.kind === 70 && isInTypeQuery(node)) ? 107455 | 1048576 : 793064 | 1920; var symbol = resolveEntityName(node, meaning, true); @@ -36582,15 +40674,15 @@ var ts; } var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 264 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -36609,7 +40701,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261); + return ts.getDeclarationOfKind(moduleSymbol, 264); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -36617,8 +40709,6 @@ var ts; ts.bindSourceFile(file, compilerOptions); } var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -36632,20 +40722,11 @@ var ts; } if (file.symbol && file.symbol.globalExports) { var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; - } - } - } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } if (augmentations) { @@ -36659,116 +40740,80 @@ var ts; } addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedWideningType; - getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", 0, true); getSymbolLinks(unknownSymbol).type = unknownType; - globalArrayType = getGlobalType("Array", 1); - globalObjectType = getGlobalType("Object"); - globalFunctionType = getGlobalType("Function"); - globalStringType = getGlobalType("String"); - globalNumberType = getGlobalType("Number"); - globalBooleanType = getGlobalType("Boolean"); - globalRegExpType = getGlobalType("RegExp"); - jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); - getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); }); - getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); - getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); - getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); - getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); - getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); - getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); - tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793064, undefined) && getGlobalPromiseType(); }); - getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); - getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); - getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); - tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol("Promise", 107455, undefined) && getGlobalPromiseConstructorSymbol(); }); - getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); - getGlobalThenableType = ts.memoize(createThenableType); - getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); - if (languageVersion >= 2) { - getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); - getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); - getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); - getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); - } - else { - getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); - getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); - } + globalArrayType = getGlobalType("Array", 1, true); + globalObjectType = getGlobalType("Object", 0, true); + globalFunctionType = getGlobalType("Function", 0, true); + globalStringType = getGlobalType("String", 0, true); + globalNumberType = getGlobalType("Number", 0, true); + globalBooleanType = getGlobalType("Boolean", 0, true); + globalRegExpType = getGlobalType("RegExp", 0, true); anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); - var symbol = getGlobalSymbol("ReadonlyArray", 793064, undefined); - globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, 1); + globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, undefined); - if (helpersModule) { - var exports_2 = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 && languageVersion < 2) { - verifyHelperSymbol(exports_2, "__extends", 107455); - } - if (requestedExternalEmitHelpers & 16384 && - (languageVersion < 5 || compilerOptions.jsx === 2)) { - verifyHelperSymbol(exports_2, "__assign", 107455); - } - if (languageVersion < 5 && requestedExternalEmitHelpers & 32768) { - verifyHelperSymbol(exports_2, "__rest", 107455); - } - if (requestedExternalEmitHelpers & 2048) { - verifyHelperSymbol(exports_2, "__decorate", 107455); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports_2, "__metadata", 107455); - } - } - if (requestedExternalEmitHelpers & 4096) { - verifyHelperSymbol(exports_2, "__param", 107455); - } - if (requestedExternalEmitHelpers & 8192) { - verifyHelperSymbol(exports_2, "__awaiter", 107455); - if (languageVersion < 2) { - verifyHelperSymbol(exports_2, "__generator", 107455); + globalThisType = getGlobalTypeOrUndefined("ThisType", 1); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !ts.isInAmbientContext(location)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1; helper <= 8192; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1: return "__extends"; + case 2: return "__assign"; + case 4: return "__rest"; + case 8: return "__decorate"; + case 16: return "__metadata"; + case 32: return "__param"; + case 64: return "__awaiter"; + case 128: return "__generator"; + case 256: return "__values"; + case 512: return "__read"; + case 1024: return "__spread"; + case 2048: return "__asyncGenerator"; + case 4096: return "__asyncDelegator"; + case 8192: return "__asyncValues"; + default: ts.Debug.fail("Unrecognized helper."); } } - function createInstantiatedPromiseLikeType() { - var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyGenericType) { - return createTypeReference(promiseLikeType, [anyType]); + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; } - return emptyObjectType; - } - function createThenableType() { - var thenPropertySymbol = createSymbol(67108864 | 4, "then"); - getSymbolLinks(thenPropertySymbol).type = globalFunctionType; - var thenableType = createObjectType(16); - thenableType.properties = [thenPropertySymbol]; - thenableType.members = createSymbolTable(thenableType.properties); - thenableType.callSignatures = []; - thenableType.constructSignatures = []; - return thenableType; + return externalHelpersModule; } function checkGrammarDecorators(node) { if (!node.decorators) { return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 || node.kind === 152) { + else if (node.kind === 152 || node.kind === 153) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -36786,16 +40831,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130) { - if (node.kind === 146 || node.kind === 148) { + if (node.kind === 147 || node.kind === 149) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155) { + if (node.kind === 156) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75: - if (node.kind !== 229 && node.parent.kind === 226) { + if (node.kind !== 231 && node.parent.kind === 228) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -36821,7 +40866,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 233 || node.parent.kind === 264) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -36844,10 +40889,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 233 || node.parent.kind === 264) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -36860,7 +40905,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 && node.kind !== 146 && node.kind !== 155 && node.kind !== 144) { + else if (node.kind !== 148 && node.kind !== 147 && node.kind !== 156 && node.kind !== 145) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -36879,10 +40924,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -36894,13 +40939,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -36910,14 +40955,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226) { - if (node.kind !== 149 && - node.kind !== 147 && - node.kind !== 151 && - node.kind !== 152) { + if (node.kind !== 228) { + if (node.kind !== 150 && + node.kind !== 148 && + node.kind !== 152 && + node.kind !== 153) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 228 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -36936,7 +40981,7 @@ var ts; else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 144) { + else if (node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -36944,7 +40989,7 @@ var ts; break; } } - if (node.kind === 150) { + if (node.kind === 151) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -36959,13 +41004,13 @@ var ts; } return; } - else if ((node.kind === 235 || node.kind === 234) && flags & 2) { + else if ((node.kind === 237 || node.kind === 236) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 && (flags & 92) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 && (flags & 92) && node.dotDotDotToken) { + else if (node.kind === 145 && (flags & 92) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256) { @@ -36981,37 +41026,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151: case 152: - case 150: + case 153: + case 151: + case 148: case 147: - case 146: + case 150: case 149: - case 148: - case 155: - case 230: - case 235: - case 234: - case 241: - case 240: - case 184: + case 156: + case 232: + case 237: + case 236: + case 243: + case 242: case 185: - case 144: + case 186: + case 145: return false; default: - if (node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 233 || node.parent.kind === 264) { return false; } switch (node.kind) { - case 225: - return nodeHasAnyModifiersExcept(node, 119); - case 226: - return nodeHasAnyModifiersExcept(node, 116); case 227: - case 205: + return nodeHasAnyModifiersExcept(node, 119); case 228: - return true; + return nodeHasAnyModifiersExcept(node, 116); case 229: + case 207: + case 230: + return true; + case 231: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -37024,14 +41069,11 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149: - case 225: - case 184: + case 150: + case 227: case 185: - if (!node.asteriskToken) { - return false; - } - break; + case 186: + return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } @@ -37088,8 +41130,12 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } + function checkGrammarClassLikeDeclaration(node) { + var file = ts.getSourceFileOfNode(node); + return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file); + } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185) { + if (node.kind === 186) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -37124,7 +41170,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 134 && parameter.type.kind !== 132) { + if (parameter.type.kind !== 135 && parameter.type.kind !== 132) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -37151,7 +41197,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198) { + if (arg.kind === 199) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -37221,28 +41267,25 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 142) { + if (node.kind !== 143) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 && computedPropertyName.expression.operatorToken.kind === 25) { + if (computedPropertyName.expression.kind === 193 && computedPropertyName.expression.operatorToken.kind === 25) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 || - node.kind === 184 || - node.kind === 149); + ts.Debug.assert(node.kind === 227 || + node.kind === 185 || + node.kind === 150); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } - if (languageVersion < 2) { - return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher); - } } } function checkGrammarForInvalidQuestionMark(questionToken, message) { @@ -37258,87 +41301,87 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259) { + if (prop.kind === 262) { continue; } - var name_29 = prop.name; - if (name_29.kind === 142) { - checkGrammarComputedPropertyName(name_29); + var name = prop.name; + if (name.kind === 143) { + checkGrammarComputedPropertyName(name); } - if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 261 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 || prop.kind !== 149) { + if (mod.kind !== 119 || prop.kind !== 150) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } } var currentKind = void 0; - if (prop.kind === 257 || prop.kind === 258) { + if (prop.kind === 260 || prop.kind === 261) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_29.kind === 8) { - checkGrammarNumericLiteral(name_29); + if (name.kind === 8) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149) { + else if (prop.kind === 150) { currentKind = Property; } - else if (prop.kind === 151) { + else if (prop.kind === 152) { currentKind = GetAccessor; } - else if (prop.kind === 152) { + else if (prop.kind === 153) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_29); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_29, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_29)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } } function checkGrammarJsxElement(node) { var seen = ts.createMap(); - for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { + for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251) { + if (attr.kind === 254) { continue; } var jsxAttr = attr; - var name_30 = jsxAttr.name; - if (!seen[name_30.text]) { - seen[name_30.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_30, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 && !initializer.expression) { + if (initializer && initializer.kind === 255 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -37347,7 +41390,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224) { + if (forInOrOfStatement.kind === 215 && forInOrOfStatement.awaitModifier) { + if ((forInOrOfStatement.flags & 16384) === 0) { + return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + } + } + if (forInOrOfStatement.initializer.kind === 226) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -37355,20 +41403,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 214 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -37388,15 +41436,18 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 ? + return grammarErrorOnNode(accessor.name, kind === 152 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152) { + else if (kind === 153) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -37415,10 +41466,10 @@ var ts; } } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -37433,7 +41484,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176) { + if (node.parent.kind === 177) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -37449,10 +41500,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 229) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -37463,9 +41514,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219: + case 221: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 214 + var isMisplacedContinueLabel = node.kind === 216 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -37473,8 +41524,8 @@ var ts; return false; } break; - case 218: - if (node.kind === 215 && !node.label) { + case 220: + if (node.kind === 217 && !node.label) { return false; } break; @@ -37487,13 +41538,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 + var message = node.kind === 217 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 215 + var message = node.kind === 217 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -37505,7 +41556,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 || node.name.kind === 172) { + if (node.name.kind === 174 || node.name.kind === 173) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -37515,11 +41566,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 || expr.kind === 8 || - expr.kind === 190 && expr.operator === 37 && + expr.kind === 191 && expr.operator === 37 && expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) { + if (node.parent.parent.kind !== 214 && node.parent.parent.kind !== 215) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -37546,9 +41597,29 @@ var ts; } } } + if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && + !ts.isInAmbientContext(node.parent.parent) && ts.hasModifier(node.parent.parent, 1)) { + checkESModuleMarker(node.name); + } var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } + function checkESModuleMarker(name) { + if (name.kind === 70) { + if (ts.unescapeIdentifier(name.text) === "__esModule") { + return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); + } + } + else { + var elements = name.elements; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; + if (!ts.isOmittedExpression(element)) { + return checkESModuleMarker(element.name); + } + } + } + } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 70) { if (name.originalKeywordKind === 109) { @@ -37557,8 +41628,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { - var element = elements_2[_i]; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var element = elements_3[_i]; if (!ts.isOmittedExpression(element)) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -37576,15 +41647,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208: - case 209: case 210: - case 217: case 211: case 212: + case 219: case 213: + case 214: + case 215: return false; - case 219: + case 221: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -37599,6 +41670,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -37639,7 +41717,7 @@ var ts; return true; } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 229) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37647,7 +41725,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161) { + else if (node.parent.kind === 162) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37660,13 +41738,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 227 || - node.kind === 228 || + if (node.kind === 229 || + node.kind === 230 || + node.kind === 237 || + node.kind === 236 || + node.kind === 243 || + node.kind === 242 || node.kind === 235 || - node.kind === 234 || - node.kind === 241 || - node.kind === 240 || - node.kind === 233 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -37675,7 +41753,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205) { + if (ts.isDeclaration(decl) || decl.kind === 207) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -37694,7 +41772,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 204 || node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 206 || node.parent.kind === 233 || node.parent.kind === 264) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -37705,8 +41783,22 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.isOctalLiteral && languageVersion >= 1) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.numericLiteralFlags & 4) { + var diagnosticMessage = void 0; + if (languageVersion >= 1) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 172)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 263)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -37719,11 +41811,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -37731,423 +41823,17 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ; - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[229] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[230] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[231] = [ - { name: "statements", test: ts.isStatement } - ], - _a[234] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[245] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[260] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); - function reduceNode(node, f, initial) { - return node ? f(initial, node) : initial; - } - function reduceNodeArray(nodes, f, initial) { - return nodes ? f(initial, nodes) : initial; - } - function reduceEachChild(node, initial, cbNode, cbNodeArray) { - if (node === undefined) { - return initial; - } - var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; - var cbNodes = cbNodeArray || cbNode; - var kind = node.kind; - if ((kind > 0 && kind <= 140)) { - return initial; - } - if ((kind >= 156 && kind <= 171)) { - return initial; - } - var result = initial; - switch (node.kind) { - case 203: - case 206: - case 198: - case 222: - case 293: - break; - case 142: - result = reduceNode(node.expression, cbNode, result); - break; - case 144: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 145: - result = reduceNode(node.expression, cbNode, result); - break; - case 147: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 149: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 150: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.body, cbNode, result); - break; - case 151: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 152: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.body, cbNode, result); - break; - case 172: - case 173: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 174: - result = reduceNode(node.propertyName, cbNode, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 175: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 176: - result = reduceNodes(node.properties, cbNodes, result); - break; - case 177: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.name, cbNode, result); - break; - case 178: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.argumentExpression, cbNode, result); - break; - case 179: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); - break; - case 180: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); - break; - case 181: - result = reduceNode(node.tag, cbNode, result); - result = reduceNode(node.template, cbNode, result); - break; - case 184: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 185: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 183: - case 186: - case 187: - case 188: - case 189: - case 195: - case 196: - case 201: - result = reduceNode(node.expression, cbNode, result); - break; - case 190: - case 191: - result = reduceNode(node.operand, cbNode, result); - break; - case 192: - result = reduceNode(node.left, cbNode, result); - result = reduceNode(node.right, cbNode, result); - break; - case 193: - result = reduceNode(node.condition, cbNode, result); - result = reduceNode(node.whenTrue, cbNode, result); - result = reduceNode(node.whenFalse, cbNode, result); - break; - case 194: - result = reduceNode(node.head, cbNode, result); - result = reduceNodes(node.templateSpans, cbNodes, result); - break; - case 197: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); - break; - case 199: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - break; - case 202: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.literal, cbNode, result); - break; - case 204: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 205: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.declarationList, cbNode, result); - break; - case 207: - result = reduceNode(node.expression, cbNode, result); - break; - case 208: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.thenStatement, cbNode, result); - result = reduceNode(node.elseStatement, cbNode, result); - break; - case 209: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; - case 210: - case 217: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 211: - result = reduceNode(node.initializer, cbNode, result); - result = reduceNode(node.condition, cbNode, result); - result = reduceNode(node.incrementor, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 212: - case 213: - result = reduceNode(node.initializer, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 216: - case 220: - result = reduceNode(node.expression, cbNode, result); - break; - case 218: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.caseBlock, cbNode, result); - break; - case 219: - result = reduceNode(node.label, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 221: - result = reduceNode(node.tryBlock, cbNode, result); - result = reduceNode(node.catchClause, cbNode, result); - result = reduceNode(node.finallyBlock, cbNode, result); - break; - case 223: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 224: - result = reduceNodes(node.declarations, cbNodes, result); - break; - case 225: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 226: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); - break; - case 232: - result = reduceNodes(node.clauses, cbNodes, result); - break; - case 235: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.importClause, cbNode, result); - result = reduceNode(node.moduleSpecifier, cbNode, result); - break; - case 236: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.namedBindings, cbNode, result); - break; - case 237: - result = reduceNode(node.name, cbNode, result); - break; - case 238: - case 242: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 239: - case 243: - result = reduceNode(node.propertyName, cbNode, result); - result = reduceNode(node.name, cbNode, result); - break; - case 240: - result = ts.reduceLeft(node.decorators, cbNode, result); - result = ts.reduceLeft(node.modifiers, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; - case 241: - result = ts.reduceLeft(node.decorators, cbNode, result); - result = ts.reduceLeft(node.modifiers, cbNode, result); - result = reduceNode(node.exportClause, cbNode, result); - result = reduceNode(node.moduleSpecifier, cbNode, result); - break; - case 246: - result = reduceNode(node.openingElement, cbNode, result); - result = ts.reduceLeft(node.children, cbNode, result); - result = reduceNode(node.closingElement, cbNode, result); - break; - case 247: - case 248: - result = reduceNode(node.tagName, cbNode, result); - result = reduceNodes(node.attributes, cbNodes, result); - break; - case 249: - result = reduceNode(node.tagName, cbNode, result); - break; - case 250: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 251: - result = reduceNode(node.expression, cbNode, result); - break; - case 252: - result = reduceNode(node.expression, cbNode, result); - break; - case 253: - result = reduceNode(node.expression, cbNode, result); - case 254: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 255: - result = reduceNodes(node.types, cbNodes, result); - break; - case 256: - result = reduceNode(node.variableDeclaration, cbNode, result); - result = reduceNode(node.block, cbNode, result); - break; - case 257: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 258: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.objectAssignmentInitializer, cbNode, result); - break; - case 259: - result = reduceNode(node.expression, cbNode, result); - break; - case 261: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 294: - result = reduceNode(node.expression, cbNode, result); - break; - default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { - var edge = edgeTraversalPath_1[_i]; - var value = node[edge.name]; - if (value !== undefined) { - result = ts.isArray(value) - ? reduceNodes(value, cbNodes, result) - : cbNode(result, value); - } - } - } - break; - } - return result; - } - ts.reduceEachChild = reduceEachChild; - function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { + function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; } - aggregateTransformFlags(node); + ts.aggregateTransformFlags(node); var visited = visitor(node); if (visited === node) { return node; } var visitedNode; if (visited === undefined) { - if (!optional) { - Debug.failNotOptional(); - } return undefined; } else if (ts.isArray(visited)) { @@ -38156,17 +41842,14 @@ var ts; else { visitedNode = visited; } - if (parenthesize !== undefined) { - visitedNode = parenthesize(visitedNode, parentNode); - } - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); return visitedNode; } ts.visitNode = visitNode; - function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) { - if (nodes === undefined) { - return undefined; + function visitNodes(nodes, visitor, test, start, count) { + if (nodes === undefined || visitor === undefined) { + return nodes; } var updated; var length = nodes.length; @@ -38177,35 +41860,30 @@ var ts; count = length - start; } if (start > 0 || count < length) { - updated = ts.createNodeArray([], undefined, nodes.hasTrailingComma && start + count === length); + updated = ts.createNodeArray([], nodes.hasTrailingComma && start + count === length); } for (var i = 0; i < count; i++) { var node = nodes[i + start]; - aggregateTransformFlags(node); + ts.aggregateTransformFlags(node); var visited = node !== undefined ? visitor(node) : undefined; if (updated !== undefined || visited === undefined || visited !== node) { if (updated === undefined) { - updated = ts.createNodeArray(nodes.slice(0, i), nodes, nodes.hasTrailingComma); + updated = ts.createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma); + ts.setTextRange(updated, nodes); } if (visited) { if (ts.isArray(visited)) { for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { var visitedNode = visited_1[_i]; - visitedNode = parenthesize - ? parenthesize(visitedNode, parentNode) - : visitedNode; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); updated.push(visitedNode); } } else { - var visitedNode = parenthesize - ? parenthesize(visited, parentNode) - : visited; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); + ts.Debug.assertNode(visited, test); + ts.aggregateTransformFlags(visited); + updated.push(visited); } } } @@ -38217,15 +41895,16 @@ var ts; context.startLexicalEnvironment(); statements = visitNodes(statements, visitor, ts.isStatement, start); if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { - statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + statements = ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements)), statements); } var declarations = context.endLexicalEnvironment(); - return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + return ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements); } ts.visitLexicalEnvironment = visitLexicalEnvironment; - function visitParameterList(nodes, visitor, context) { + function visitParameterList(nodes, visitor, context, nodesVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } context.startLexicalEnvironment(); - var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + var updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration); context.suspendLexicalEnvironment(); return updated; } @@ -38236,247 +41915,669 @@ var ts; var declarations = context.endLexicalEnvironment(); if (ts.some(declarations)) { var block = ts.convertToFunctionBody(updated); - var statements = mergeLexicalEnvironment(block.statements, declarations); + var statements = ts.mergeLexicalEnvironment(block.statements, declarations); return ts.updateBlock(block, statements); } return updated; } ts.visitFunctionBody = visitFunctionBody; - function visitEachChild(node, visitor, context) { + function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } if (node === undefined) { return undefined; } var kind = node.kind; - if ((kind > 0 && kind <= 140)) { - return node; - } - if ((kind >= 156 && kind <= 171)) { + if ((kind > 0 && kind <= 141) || kind === 168) { return node; } switch (node.kind) { - case 203: - case 206: - case 198: - case 222: + case 205: + case 208: + case 199: + case 224: + case 297: + case 246: return node; case 142: + return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier)); + case 143: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); + case 159: + return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 160: + return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 154: + return ts.updateCallSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 155: + return ts.updateConstructSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 149: + return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); + case 156: + return ts.updateIndexSignatureDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 145: + return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 146: + return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression)); + case 158: + return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + case 157: + return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 161: + return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName)); + case 162: + return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor)); + case 163: + return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode)); + case 164: + return ts.updateTypleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode)); + case 165: + case 166: + return ts.updateUnionOrIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + case 167: + throw ts.Debug.fail("not implemented."); + case 169: + return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode)); + case 170: + return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode)); + case 171: + return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameter), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); + case 172: + return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); case 144: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode)); case 147: - return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 149: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updatePropertySignature(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 148: + return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 150: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); + return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 151: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); case 152: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 172: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); + return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 153: + return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); case 173: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); + return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); case 174: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, true)); + return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); case 175: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); + return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); case 176: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); + return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); case 177: - return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); case 178: - return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); case 179: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); case 180: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); case 181: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 182: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); case 183: - return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); case 184: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); case 185: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 186: - return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 187: - return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 188: - return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); case 189: + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + case 190: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192: + case 193: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190: - return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); case 191: + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 192: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 194: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); case 195: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); case 196: - return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); case 197: - return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199: - return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 198: + return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 200: + return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 201: + return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); case 202: - return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 204: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 205: - return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); + return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + case 206: + return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 207: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); + return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); case 209: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 210: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); case 211: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 212: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 213: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 214: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 215: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForOf(node, node.awaitModifier, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 216: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); case 217: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); case 218: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); case 219: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); case 220: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 221: - return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 222: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); case 223: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); - case 224: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 226: - return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); + return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + case 227: + return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 228: + return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 231: + return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); case 232: - return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); + case 233: + return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 234: + return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); case 236: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); + return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); case 237: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 238: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); case 239: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 240: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); case 241: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); case 242: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 243: - return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 246: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 244: + return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + case 245: + return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); case 247: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); case 248: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + case 253: + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); case 249: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 250: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); case 251: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 252: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 253: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 254: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 255: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 256: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); case 257: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); case 258: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); case 259: - return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + case 260: + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 261: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 262: + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + case 263: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 264: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 294: + case 295: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: - var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { - var edge = edgeTraversalPath_2[_i]; - var value = node[edge.name]; - if (value !== undefined) { - var visited = ts.isArray(value) - ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node) - : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node); - if (updated !== undefined || visited !== value) { - if (updated === undefined) { - updated = ts.getMutableClone(node); - } - if (visited !== value) { - updated[edge.name] = visited; - } - } - } - } - } - return updated ? ts.updateNode(updated, node) : node; + return node; } } ts.visitEachChild = visitEachChild; + function extractSingleNode(nodes) { + ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return ts.singleOrUndefined(nodes); + } +})(ts || (ts = {})); +(function (ts) { + function reduceNode(node, f, initial) { + return node ? f(initial, node) : initial; + } + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } + function reduceEachChild(node, initial, cbNode, cbNodeArray) { + if (node === undefined) { + return initial; + } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; + var kind = node.kind; + if ((kind > 0 && kind <= 141)) { + return initial; + } + if ((kind >= 157 && kind <= 172)) { + return initial; + } + var result = initial; + switch (node.kind) { + case 205: + case 208: + case 199: + case 224: + case 294: + break; + case 142: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 143: + result = reduceNode(node.expression, cbNode, result); + break; + case 145: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 146: + result = reduceNode(node.expression, cbNode, result); + break; + case 148: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 150: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 151: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); + break; + case 152: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 153: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); + break; + case 173: + case 174: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 175: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 176: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 177: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 178: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 179: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); + break; + case 180: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 181: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 182: + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); + break; + case 183: + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 185: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 186: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 184: + case 187: + case 188: + case 189: + case 190: + case 196: + case 197: + case 202: + result = reduceNode(node.expression, cbNode, result); + break; + case 191: + case 192: + result = reduceNode(node.operand, cbNode, result); + break; + case 193: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 194: + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); + break; + case 195: + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); + break; + case 198: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 200: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + break; + case 201: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.type, cbNode, result); + break; + case 202: + result = reduceNode(node.expression, cbNode, result); + break; + case 204: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); + break; + case 206: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 207: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); + break; + case 209: + result = reduceNode(node.expression, cbNode, result); + break; + case 210: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); + break; + case 211: + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 212: + case 219: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 213: + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 214: + case 215: + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 218: + case 222: + result = reduceNode(node.expression, cbNode, result); + break; + case 220: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); + break; + case 221: + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 223: + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); + break; + case 225: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 226: + result = reduceNodes(node.declarations, cbNodes, result); + break; + case 227: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 228: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 231: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 232: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 233: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 234: + result = reduceNodes(node.clauses, cbNodes, result); + break; + case 236: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.moduleReference, cbNode, result); + break; + case 237: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); + break; + case 238: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); + break; + case 239: + result = reduceNode(node.name, cbNode, result); + break; + case 240: + case 244: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 241: + case 245: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 242: + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 243: + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); + break; + case 247: + result = reduceNode(node.expression, cbNode, result); + break; + case 248: + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); + break; + case 249: + case 250: + result = reduceNode(node.tagName, cbNode, result); + result = reduceNode(node.attributes, cbNode, result); + break; + case 253: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 251: + result = reduceNode(node.tagName, cbNode, result); + break; + case 252: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 254: + result = reduceNode(node.expression, cbNode, result); + break; + case 255: + result = reduceNode(node.expression, cbNode, result); + break; + case 256: + result = reduceNode(node.expression, cbNode, result); + case 257: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 258: + result = reduceNodes(node.types, cbNodes, result); + break; + case 259: + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); + break; + case 260: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 261: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); + break; + case 262: + result = reduceNode(node.expression, cbNode, result); + break; + case 263: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 264: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 295: + result = reduceNode(node.expression, cbNode, result); + break; + default: + break; + } + return result; + } + ts.reduceEachChild = reduceEachChild; function mergeLexicalEnvironment(statements, declarations) { if (!ts.some(declarations)) { return statements; } return ts.isNodeArray(statements) - ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + ? ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements) : ts.addRange(statements, declarations); } ts.mergeLexicalEnvironment = mergeLexicalEnvironment; - function mergeFunctionBodyLexicalEnvironment(body, declarations) { - if (body && declarations !== undefined && declarations.length > 0) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements)); - } - else { - return ts.createBlock(ts.createNodeArray([ts.createReturn(body, body)].concat(declarations), body), body, true); - } - } - return body; - } - ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment; function liftToBlock(nodes) { Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block."); return ts.singleOrUndefined(nodes) || ts.createBlock(nodes); } ts.liftToBlock = liftToBlock; - function extractSingleNode(nodes) { - Debug.assert(nodes.length <= 1, "Too many nodes written to output."); - return ts.singleOrUndefined(nodes); - } function aggregateTransformFlags(node) { aggregateTransformFlagsForNode(node); return node; @@ -38507,7 +42608,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 200)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -38520,9 +42621,6 @@ var ts; } var Debug; (function (Debug) { - Debug.failNotOptional = Debug.shouldAssert(1) - ? function (message) { return Debug.assert(false, message || "Node not optional."); } - : ts.noop; Debug.failBadSyntaxKind = Debug.shouldAssert(1) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; @@ -38555,16 +42653,20 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); var ts; (function (ts) { + var FlattenLevel; + (function (FlattenLevel) { + FlattenLevel[FlattenLevel["All"] = 0] = "All"; + FlattenLevel[FlattenLevel["ObjectRest"] = 1] = "ObjectRest"; + })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {})); function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) { var location = node; var value; if (ts.isDestructuringAssignment(node)) { value = node.right; - while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + while (ts.isEmptyArrayLiteral(node.left) || ts.isEmptyObjectLiteral(node.left)) { if (ts.isDestructuringAssignment(value)) { location = node = value; value = node.right; @@ -38578,6 +42680,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: true, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -38612,7 +42715,7 @@ var ts; ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); var expression = createAssignmentCallback ? createAssignmentCallback(target, value, location) - : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + : ts.setTextRange(ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value), location); expression.original = original; emitExpression(expression); } @@ -38625,6 +42728,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: hoistTempVariables, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -38650,10 +42754,11 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_31 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_31, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value); variable.original = original; - if (ts.isIdentifier(name_31)) { + ts.setTextRange(variable, location); + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64); } ts.aggregateTransformFlags(variable); @@ -38741,7 +42846,12 @@ var ts; function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); var numElements = elements.length; - if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { + if (flattenContext.level < 1 && flattenContext.downlevelIteration) { + value = ensureIdentifier(flattenContext, ts.createReadHelper(flattenContext.context, value, numElements > 0 && ts.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) + ? undefined + : numElements, location), false, location); + } + else if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); } @@ -38799,8 +42909,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_32 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_32); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { @@ -38811,7 +42921,7 @@ var ts; var temp = ts.createTempVariable(undefined); if (flattenContext.hoistTempVariables) { flattenContext.context.hoistVariableDeclaration(temp); - flattenContext.emitExpression(ts.createAssignment(temp, value, location)); + flattenContext.emitExpression(ts.setTextRange(ts.createAssignment(temp, value), location)); } else { flattenContext.emitBindingOrAssignment(temp, value, location, undefined); @@ -38842,7 +42952,7 @@ var ts; var restHelper = { name: "typescript:rest", scoped: false, - text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" }; function createRestCall(context, value, elements, computedTempVariables, location) { context.requestEmitHelper(restHelper); @@ -38861,12 +42971,21 @@ var ts; } } } - return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + return ts.createCall(ts.getHelperName("__rest"), undefined, [ + value, + ts.setTextRange(ts.createArrayLiteral(propertyNames), location) + ]); } })(ts || (ts = {})); var ts; (function (ts) { var USE_NEW_TYPE_METADATA_FORMAT = false; + var TypeScriptSubstitutionFlags; + (function (TypeScriptSubstitutionFlags) { + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["ClassAliases"] = 1] = "ClassAliases"; + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NamespaceExports"] = 2] = "NamespaceExports"; + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers"; + })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {})); function transformTypeScript(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); @@ -38877,8 +42996,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); context.enableSubstitution(178); + context.enableSubstitution(179); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -38911,15 +43030,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 261: - case 232: - case 231: - case 204: + case 264: + case 234: + case 233: + case 206: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 226: - case 225: + case 228: + case 227: if (ts.hasModifier(node, 2)) { break; } @@ -38944,13 +43063,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 240: + case 242: return visitExportAssignment(node); - case 241: + case 243: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -38960,11 +43079,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 241 || - node.kind === 235 || - node.kind === 236 || - (node.kind === 234 && - node.moduleReference.kind === 245)) { + if (node.kind === 243 || + node.kind === 237 || + node.kind === 238 || + (node.kind === 236 && + node.moduleReference.kind === 247)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -38980,15 +43099,15 @@ var ts; } function classElementVisitorWorker(node) { switch (node.kind) { - case 150: - return undefined; - case 147: - case 155: case 151: + return undefined; + case 148: + case 156: case 152: - case 149: + case 153: + case 150: return visitorWorker(node); - case 203: + case 205: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -39019,23 +43138,22 @@ var ts; case 75: case 123: case 130: - case 162: case 163: - case 161: - case 156: - case 143: + case 164: + case 162: + case 157: + case 144: case 118: case 121: - case 134: + case 135: case 132: case 129: case 104: - case 135: + case 136: + case 160: case 159: + case 161: case 158: - case 160: - case 157: - case 164: case 165: case 166: case 167: @@ -39043,56 +43161,58 @@ var ts; case 169: case 170: case 171: - case 155: - case 145: - case 228: - case 147: - case 150: + case 172: + case 156: + case 146: + case 230: + case 148: + return undefined; + case 151: return visitConstructor(node); - case 227: + case 229: return ts.createNotEmittedStatement(node); - case 226: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 255: + case 258: return visitHeritageClause(node); - case 199: + case 200: return visitExpressionWithTypeArguments(node); - case 149: + case 150: return visitMethodDeclaration(node); - case 151: - return visitGetAccessor(node); case 152: + return visitGetAccessor(node); + case 153: return visitSetAccessor(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: + case 145: return visitParameter(node); - case 183: + case 184: return visitParenthesizedExpression(node); - case 182: - case 200: + case 183: + case 201: return visitAssertionExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 201: + case 202: return visitNonNullExpression(node); - case 229: + case 231: return visitEnumDeclaration(node); - case 205: + case 207: return visitVariableStatement(node); - case 223: + case 225: return visitVariableDeclaration(node); - case 230: + case 232: return visitModuleDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -39100,7 +43220,8 @@ var ts; } } function visitSourceFile(node) { - var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + var alwaysStrict = (compilerOptions.alwaysStrict === undefined ? compilerOptions.strict : compilerOptions.alwaysStrict) && + !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)); } function shouldEmitDecorateCallForClass(node) { @@ -39152,11 +43273,12 @@ var ts; return ts.singleOrMany(statements); } function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) { - var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); + var classDeclaration = ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause)); var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { emitFlags |= 32; } + ts.setTextRange(classDeclaration, node); ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); return classDeclaration; @@ -39167,10 +43289,14 @@ var ts; var declName = ts.getLocalName(node, false, true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, hasExtendsClause); - var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members, location); + var classExpression = ts.createClassExpression(undefined, name, undefined, heritageClauses, members); ts.setOriginalNode(classExpression, node); - var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location); + ts.setTextRange(classExpression, location); + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declName, undefined, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression) + ], 1)); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, location); ts.setCommentRange(statement, node); return statement; } @@ -39178,7 +43304,9 @@ var ts; var staticProperties = getInitializedProperties(node, true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84; })); - var classExpression = ts.setOriginalNode(ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members, node), node); + var classExpression = ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members); + ts.setOriginalNode(classExpression, node); + ts.setTextRange(classExpression, node); if (staticProperties.length > 0) { var expressions = []; var temp = ts.createTempVariable(hoistVariableDeclaration); @@ -39201,7 +43329,7 @@ var ts; members.push(constructor); } ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement)); - return ts.createNodeArray(members, node.members); + return ts.setTextRange(ts.createNodeArray(members), node.members); } function transformConstructor(node, hasExtendsClause) { var hasInstancePropertyWithInitializer = ts.forEach(node.members, isInstanceInitializedProperty); @@ -39212,7 +43340,7 @@ var ts; } var parameters = transformConstructorParameters(constructor); var body = transformConstructorBody(node, constructor, hasExtendsClause); - return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor(undefined, undefined, parameters, body, constructor || node), constructor)); + return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(ts.createConstructor(undefined, undefined, parameters, body), constructor || node), constructor)); } function transformConstructorParameters(constructor) { return ts.visitParameterList(constructor && constructor.parameters, visitor, context) @@ -39235,18 +43363,18 @@ var ts; if (constructor) { ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } - ts.addRange(statements, endLexicalEnvironment()); - return ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : undefined, true); + statements = ts.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + return ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined); } function addPrologueDirectivesAndInitialSuperCall(ctor, result) { if (ctor.body) { var statements = ctor.body.statements; - var index = ts.addPrologueDirectives(result, statements, false, visitor); + var index = ts.addPrologue(result, statements, false, visitor); if (index === statements.length) { return index; } var statement = statements[index]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -39268,7 +43396,7 @@ var ts; ts.setEmitFlags(propertyName, 1536 | 48); var localName = ts.getMutableClone(name); ts.setEmitFlags(localName, 1536); - return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, node.name), localName), ts.moveRangePos(node, -1))); + return ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createThis(), propertyName), node.name), localName)), ts.moveRangePos(node, -1))); } function getInitializedProperties(node, isStatic) { return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty); @@ -39280,13 +43408,13 @@ var ts; return isInitializedProperty(member, false); } function isInitializedProperty(member, isStatic) { - return member.kind === 147 + return member.kind === 148 && isStatic === ts.hasModifier(member, 32) && member.initializer !== undefined; } function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -39295,8 +43423,8 @@ var ts; } function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { + var property = properties_10[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -39353,12 +43481,12 @@ var ts; } function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151: case 152: + case 153: return getAllDecoratorsOfAccessors(node, member); - case 149: + case 150: return getAllDecoratorsOfMethod(member); - case 147: + case 148: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -39369,10 +43497,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -39397,14 +43526,14 @@ var ts; } return { decorators: decorators }; } - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } function addClassElementDecorationStatements(statements, node, isStatic) { @@ -39429,14 +43558,14 @@ var ts; } function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, true); var descriptor = languageVersion > 0 - ? member.kind === 147 + ? member.kind === 148 ? ts.createVoidZero() : ts.createNull() : undefined; @@ -39452,7 +43581,7 @@ var ts; } function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -39480,90 +43609,83 @@ var ts; } return expressions; } - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, undefined, true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, true))); } } } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 - || kind === 151 + return kind === 150 || kind === 152 - || kind === 147; + || kind === 153 + || kind === 148; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 149; + return node.kind === 150; } function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 - || kind === 197 - || kind === 149 - || kind === 151 - || kind === 152; + switch (node.kind) { + case 228: + case 198: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 150: + case 152: + case 153: + return true; + } + return false; } function serializeTypeOfNode(node) { switch (node.kind) { - case 147: - case 144: - case 151: - return serializeTypeNode(node.type); + case 148: + case 145: case 152: + return serializeTypeNode(node.type); + case 153: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226: - case 197: - case 149: + case 228: + case 198: + case 150: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); } } - function getRestParameterElementType(node) { - if (node && node.kind === 162) { - return node.elementType; - } - else if (node && node.kind === 157) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -39571,7 +43693,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -39579,7 +43701,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -39588,11 +43710,20 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 152) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } function serializeReturnTypeOfNode(node) { if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } - else if (ts.isAsyncFunctionLike(node)) { + else if (ts.isAsyncFunction(node)) { return ts.createIdentifier("Promise"); } return ts.createVoidZero(); @@ -39603,21 +43734,26 @@ var ts; } switch (node.kind) { case 104: + case 138: + case 94: + case 129: return ts.createVoidZero(); - case 166: + case 167: return serializeTypeNode(node.type); - case 158: case 159: + case 160: return ts.createIdentifier("Function"); - case 162: case 163: + case 164: return ts.createIdentifier("Array"); - case 156: + case 157: case 121: return ts.createIdentifier("Boolean"); - case 134: + case 135: return ts.createIdentifier("String"); - case 171: + case 133: + return ts.createIdentifier("Object"); + case 172: switch (node.literal.kind) { case 9: return ts.createIdentifier("String"); @@ -39633,44 +43769,22 @@ var ts; break; case 132: return ts.createIdentifier("Number"); - case 135: + case 136: return languageVersion < 2 ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157: + case 158: return serializeTypeReferenceNode(node); + case 166: case 165: - case 164: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - if (serializedIndividual.kind !== 70) { - serializedUnion = undefined; - break; - } - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - if (serializedUnion) { - return serializedUnion; - } - } - case 160: - case 168: + return serializeUnionOrIntersectionType(node); + case 161: case 169: case 170: - case 161: + case 171: + case 162: case 118: - case 167: + case 168: break; default: ts.Debug.failBadSyntaxKind(node); @@ -39678,6 +43792,32 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + serializedUnion = serializedIndividual; + } + } + return serializedUnion; + } function serializeTypeReferenceNode(node) { switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { case ts.TypeReferenceSerializationKind.Unknown: @@ -39712,15 +43852,15 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_33 = ts.getMutableClone(node); - name_33.flags &= ~8; - name_33.original = undefined; - name_33.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_33), ts.createLiteral("undefined")), name_33); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_33; - case 141: + return name; + case 142: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -39749,7 +43889,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -39764,7 +43904,7 @@ var ts; hoistVariableDeclaration(generatedName); expression = ts.createAssignment(generatedName, expression); } - return ts.setOriginalNode(ts.createComputedPropertyName(expression, name), name); + return ts.updateComputedPropertyName(name, expression); } else { return name; @@ -39773,13 +43913,12 @@ var ts; function visitHeritageClause(node) { if (node.token === 84) { var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1); - return ts.createHeritageClause(84, types, node); + return ts.setTextRange(ts.createHeritageClause(84, types), node); } return undefined; } function visitExpressionWithTypeArguments(node) { - var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); - return ts.createExpressionWithTypeArguments(undefined, expression, node); + return ts.updateExpressionWithTypeArguments(node, undefined, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); } function shouldEmitFunctionLikeDeclaration(node) { return !ts.nodeIsMissing(node.body); @@ -39788,13 +43927,13 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - return ts.visitEachChild(node, visitor, context); + return ts.updateConstructor(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), ts.visitNodes(node.modifiers, visitor, ts.isModifier), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context)); } function visitMethodDeclaration(node) { if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + var updated = ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); if (updated !== node) { ts.setCommentRange(updated, node); ts.setSourceMapRange(updated, ts.moveRangePastDecorators(node)); @@ -39830,7 +43969,7 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createNotEmittedStatement(node); } - var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); + var updated = ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { var statements = [updated]; addExportMemberAssignment(statements, node); @@ -39839,10 +43978,10 @@ var ts; return updated; } function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { + if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createOmittedExpression(); } - var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated; } function visitArrowFunction(node) { @@ -39853,8 +43992,9 @@ var ts; if (ts.parameterIsThisKeyword(node)) { return undefined; } - var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), ts.moveRangePastModifiers(node)); + var parameter = ts.createParameter(undefined, undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); ts.setOriginalNode(parameter, node); + ts.setTextRange(parameter, ts.moveRangePastModifiers(node)); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); ts.setEmitFlags(parameter.name, 32); @@ -39866,7 +44006,7 @@ var ts; if (variables.length === 0) { return undefined; } - return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), node); + return ts.setTextRange(ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))), node); } else { return ts.visitEachChild(node, visitor, context); @@ -39878,7 +44018,7 @@ var ts; return ts.flattenDestructuringAssignment(node, visitor, context, 0, false, createNamespaceExportExpression); } else { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), node); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression)), node); } } function visitVariableDeclaration(node) { @@ -39932,8 +44072,9 @@ var ts; var localName = ts.getLocalName(node, false, true); moduleArg = ts.createAssignment(localName, moduleArg); } - var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg]), node); + var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformEnumBody(node, containerName)), undefined, [moduleArg])); ts.setOriginalNode(enumStatement, node); + ts.setTextRange(enumStatement, node); ts.setEmitFlags(enumStatement, emitFlags); statements.push(enumStatement); statements.push(ts.createEndOfDeclarationMarker(node)); @@ -39947,11 +44088,11 @@ var ts; ts.addRange(statements, ts.map(node.members, transformEnumMember)); ts.addRange(statements, endLexicalEnvironment()); currentNamespaceContainerName = savedCurrentNamespaceLocalName; - return ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); + return ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true); } function transformEnumMember(member) { var name = getExpressionForPropertyName(member, false); - return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, member), member); + return ts.setTextRange(ts.createStatement(ts.setTextRange(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name), member)), member); } function transformEnumMemberDeclarationValue(member) { var value = resolver.getConstantValue(member); @@ -39983,16 +44124,16 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_34 = node.symbol && node.symbol.name; - if (name_34) { - return currentScopeFirstDeclarationsOfName[name_34] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -40004,7 +44145,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 229) { + if (node.kind === 231) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -40045,8 +44186,9 @@ var ts; var localName = ts.getLocalName(node, false, true); moduleArg = ts.createAssignment(localName, moduleArg); } - var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg]), node); + var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, transformModuleBody(node, containerName)), undefined, [moduleArg])); ts.setOriginalNode(moduleStatement, node); + ts.setTextRange(moduleStatement, node); ts.setEmitFlags(moduleStatement, emitFlags); statements.push(moduleStatement); statements.push(ts.createEndOfDeclarationMarker(node)); @@ -40064,8 +44206,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 233) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -40086,14 +44228,15 @@ var ts; currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 231) { + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true); + ts.setTextRange(block, blockLocation); + if (body.kind !== 233) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230) { + if (moduleDeclaration.body.kind === 232) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -40102,18 +44245,18 @@ var ts; if (!node.importClause) { return node; } - var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, true); + var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause); return importClause ? ts.updateImportDeclaration(node, undefined, undefined, importClause, node.moduleSpecifier) : undefined; } function visitImportClause(node) { var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined; - var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, true); + var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings); return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 237) { + if (node.kind === 239) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -40136,7 +44279,7 @@ var ts; if (!resolver.isValueAliasDeclaration(node)) { return undefined; } - var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, true); + var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports); return exportClause ? ts.updateExportDeclaration(node, undefined, undefined, exportClause, node.moduleSpecifier) : undefined; @@ -40165,9 +44308,9 @@ var ts; var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); ts.setEmitFlags(moduleReference, 1536 | 2048); if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { - return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ + return ts.setOriginalNode(ts.setTextRange(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, undefined, moduleReference), node) - ]), node), node); + ])), node), node); } else { return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node); @@ -40188,7 +44331,7 @@ var ts; && ts.hasModifier(node, 512); } function expressionToStatement(expression) { - return ts.createStatement(expression, undefined); + return ts.createStatement(expression); } function addExportMemberAssignment(statements, node) { var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), ts.getLocalName(node)); @@ -40198,10 +44341,10 @@ var ts; statements.push(statement); } function createNamespaceExport(exportName, exportValue, location) { - return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue), location); + return ts.setTextRange(ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, false, true), exportValue)), location); } function createNamespaceExportExpression(exportName, exportValue, location) { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location); } function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { return ts.getNamespaceMemberName(currentNamespaceContainerName, name, false, true); @@ -40217,7 +44360,7 @@ var ts; function getClassAliasIfNeeded(node) { if (resolver.getNodeCheckFlags(node) & 8388608) { enableSubstitutionForClassAliases(); - var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default"); + var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.unescapeIdentifier(node.name.text) : "default"); classAliases[ts.getOriginalNodeId(node)] = classAlias; hoistVariableDeclaration(classAlias); return classAlias; @@ -40241,37 +44384,42 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(70); - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(258); - context.enableEmitNotification(230); + context.enableSubstitution(261); + context.enableEmitNotification(232); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 232; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229; + return ts.getOriginalNode(node).kind === 231; } - function onEmitNode(emitContext, node, emitCallback) { + function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; + var savedCurrentSourceFile = currentSourceFile; + if (ts.isSourceFile(node)) { + currentSourceFile = node; + } if (enabledSubstitutions & 2 && isTransformedModuleDeclaration(node)) { applicableSubstitutions |= 2; } if (enabledSubstitutions & 8 && isTransformedEnumDeclaration(node)) { applicableSubstitutions |= 8; } - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); applicableSubstitutions = savedApplicableSubstitutions; + currentSourceFile = savedCurrentSourceFile; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } else if (ts.isShorthandPropertyAssignment(node)) { @@ -40281,14 +44429,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_35 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_35); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_35, initializer, node); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); } - return ts.createPropertyAssignment(name_35, exportedName, node); + return ts.setTextRange(ts.createPropertyAssignment(name, exportedName), node); } } return node; @@ -40297,9 +44445,9 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 177: - return substitutePropertyAccessExpression(node); case 178: + return substitutePropertyAccessExpression(node); + case 179: return substituteElementAccessExpression(node); } return node; @@ -40329,11 +44477,11 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 261) { - var substitute = (applicableSubstitutions & 2 && container.kind === 230) || - (applicableSubstitutions & 8 && container.kind === 229); + if (container && container.kind !== 264) { + var substitute = (applicableSubstitutions & 2 && container.kind === 232) || + (applicableSubstitutions & 8 && container.kind === 231); if (substitute) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), node); } } } @@ -40348,16 +44496,14 @@ var ts; function substituteConstantValue(node) { var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { + ts.setConstantValue(node, constantValue); var substitute = ts.createLiteral(constantValue); - ts.setSourceMapRange(substitute, node); - ts.setCommentRange(substitute, node); if (!compilerOptions.removeComments) { var propertyName = ts.isPropertyAccessExpression(node) ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - substitute.trailingComment = " " + propertyName + " "; + ts.addSyntheticTrailingComment(substitute, 3, " " + propertyName + " "); } - ts.setConstantValue(node, constantValue); return substitute; } return node; @@ -40372,24 +44518,24 @@ var ts; } } ts.transformTypeScript = transformTypeScript; - var paramHelper = { - name: "typescript:param", - scoped: false, - priority: 4, - text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" - }; - function createParamHelper(context, expression, parameterOffset, location) { - context.requestEmitHelper(paramHelper); - return ts.createCall(ts.getHelperName("__param"), undefined, [ - ts.createLiteral(parameterOffset), - expression - ], location); + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + context.requestEmitHelper(decorateHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray), location); } - var metadataHelper = { - name: "typescript:metadata", + var decorateHelper = { + name: "typescript:decorate", scoped: false, - priority: 3, - text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" }; function createMetadataHelper(context, metadataKey, metadataValue) { context.requestEmitHelper(metadataHelper); @@ -40398,236 +44544,747 @@ var ts; metadataValue ]); } - var decorateHelper = { - name: "typescript:decorate", + var metadataHelper = { + name: "typescript:metadata", scoped: false, - priority: 2, - text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + priority: 3, + text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" }; - function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { - context.requestEmitHelper(decorateHelper); - var argumentsArray = []; - argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, undefined, true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); - } - } - return ts.createCall(ts.getHelperName("__decorate"), undefined, argumentsArray, location); + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__param"), undefined, [ + ts.createLiteral(parameterOffset), + expression + ]), location); } + var paramHelper = { + name: "typescript:param", + scoped: false, + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + }; })(ts || (ts = {})); var ts; (function (ts) { - function transformESNext(context) { - var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var ES2017SubstitutionFlags; + (function (ES2017SubstitutionFlags) { + ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); + function transformES2017(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var currentSourceFile; + var enabledSubstitutions; + var enclosingSuperContainerFlags = 0; + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } + currentSourceFile = node; var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; return visited; } function visitor(node) { - return visitorWorker(node, false); - } - function visitorNoDestructuringValue(node) { - return visitorWorker(node, true); - } - function visitorWorker(node, noDestructuringValue) { - if ((node.transformFlags & 8) === 0) { + if ((node.transformFlags & 16) === 0) { return node; } switch (node.kind) { - case 176: - return visitObjectLiteralExpression(node); - case 192: - return visitBinaryExpression(node, noDestructuringValue); - case 223: - return visitVariableDeclaration(node); - case 213: - return visitForOfStatement(node); - case 211: - return visitForStatement(node); - case 188: - return visitVoidExpression(node); + case 119: + return undefined; + case 190: + return visitAwaitExpression(node); case 150: - return visitConstructorDeclaration(node); - case 149: return visitMethodDeclaration(node); - case 151: - return visitGetAccessorDeclaration(node); - case 152: - return visitSetAccessorDeclaration(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); case 185: + return visitFunctionExpression(node); + case 186: return visitArrowFunction(node); - case 144: - return visitParameter(node); - case 207: - return visitExpressionStatement(node); - case 183: - return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); } } - function chunkObjectLiteralElements(elements) { - var chunkObject; - var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259) { - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - chunkObject = undefined; - } - var target = e.expression; - objects.push(ts.visitNode(target, visitor, ts.isExpression)); - } - else { - if (!chunkObject) { - chunkObject = []; - } - if (e.kind === 257) { - var p = e; - chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); + function visitAwaitExpression(node) { + return ts.setOriginalNode(ts.setTextRange(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); + } + function visitMethodDeclaration(node) { + return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); + var original = ts.getOriginalNode(node, ts.isFunctionLike); + var nodeType = original.type; + var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; + var isArrowFunction = node.kind === 186; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; + if (!isArrowFunction) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.createBlock(statements, true); + ts.setTextRange(block, node.body); + if (languageVersion >= 2) { + if (resolver.getNodeCheckFlags(node) & 4096) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else { - chunkObject.push(e); + else if (resolver.getNodeCheckFlags(node) & 2048) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); } } + return block; } - if (chunkObject) { - objects.push(ts.createObjectLiteral(chunkObject)); - } - return objects; - } - function visitObjectLiteralExpression(node) { - if (node.transformFlags & 1048576) { - var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176) { - objects.unshift(ts.createObjectLiteral()); + else { + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(ts.concatenate(block.statements, declarations)), block.statements)); } - return createAssignHelper(context, objects); + return expression; } - return ts.visitEachChild(node, visitor, context); - } - function visitExpressionStatement(node) { - return ts.visitEachChild(node, visitorNoDestructuringValue, context); - } - function visitParenthesizedExpression(node, noDestructuringValue) { - return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); } - function visitBinaryExpression(node, noDestructuringValue) { - if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) { - return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue); + function transformFunctionBodyWorker(body, start) { + if (ts.isBlock(body)) { + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); } - else if (node.operatorToken.kind === 25) { - return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)); + else { + startLexicalEnvironment(); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); + var declarations = endLexicalEnvironment(); + return ts.updateBlock(visited, ts.setTextRange(ts.createNodeArray(ts.concatenate(visited.statements, declarations)), visited.statements)); } - return ts.visitEachChild(node, visitor, context); } - function visitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) { - return ts.flattenDestructuringBinding(node, visitor, context, 1); + function getPromiseConstructor(type) { + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; + } } - return ts.visitEachChild(node, visitor, context); - } - function visitForStatement(node) { - return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)); + return undefined; } - function visitVoidExpression(node) { - return ts.visitEachChild(node, visitorNoDestructuringValue, context); + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution(180); + context.enableSubstitution(178); + context.enableSubstitution(179); + context.enableEmitNotification(228); + context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); + } } - function visitForOfStatement(node) { - var leadingStatements; - var temp; - var initializer = ts.skipParentheses(node.initializer); - if (initializer.transformFlags & 1048576) { - if (ts.isVariableDeclarationList(initializer)) { - temp = ts.createTempVariable(undefined); - var firstDeclaration = ts.firstOrUndefined(initializer.declarations); - var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1, temp, false, true); - if (ts.some(declarations)) { - var statement = ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(initializer, declarations), initializer); - leadingStatements = ts.append(leadingStatements, statement); - } - } - else if (ts.isAssignmentPattern(initializer)) { - temp = ts.createTempVariable(undefined); - var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, node.initializer)), visitor, context, 1); - leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, node.initializer)); + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; } } - if (temp) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - var block = ts.isBlock(statement) - ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) - : ts.createBlock(ts.append(leadingStatements, statement), statement, true); - return ts.updateForOf(node, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(temp, undefined, undefined, node.initializer) - ], node.initializer, 1), expression, block); - } - return ts.visitEachChild(node, visitor, context); + previousOnEmitNode(hint, node, emitCallback); } - function visitParameter(node) { - if (node.transformFlags & 1048576) { - return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); } - return ts.visitEachChild(node, visitor, context); - } - function visitConstructorDeclaration(node) { - return ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + return node; } - function visitGetAccessorDeclaration(node) { - return ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + function substituteExpression(node) { + switch (node.kind) { + case 178: + return substitutePropertyAccessExpression(node); + case 179: + return substituteElementAccessExpression(node); + case 180: + return substituteCallExpression(node); + } + return node; } - function visitSetAccessorDeclaration(node) { - return ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; } - function visitMethodDeclaration(node) { - return ts.updateMethod(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; } - function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; } - function visitArrowFunction(node) { - return ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 + || kind === 151 + || kind === 150 + || kind === 152 + || kind === 153; } - function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); + } } - function transformFunctionBody(node) { - resumeLexicalEnvironment(); - var leadingStatements; - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var parameter = _a[_i]; - if (parameter.transformFlags & 1048576) { - var temp = ts.getGeneratedNameForNode(parameter); - var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true); - if (ts.some(declarations)) { - var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations)); - ts.setEmitFlags(statement, 524288); - leadingStatements = ts.append(leadingStatements, statement); + } + ts.transformES2017 = transformES2017; + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + ts.asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];\n " + }; + ts.advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);\n " + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var ESNextSubstitutionFlags; + (function (ESNextSubstitutionFlags) { + ESNextSubstitutionFlags[ESNextSubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ESNextSubstitutionFlags || (ESNextSubstitutionFlags = {})); + function transformESNext(context) { + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var enabledSubstitutions; + var enclosingFunctionFlags; + var enclosingSuperContainerFlags = 0; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + function visitor(node) { + return visitorWorker(node, false); + } + function visitorNoDestructuringValue(node) { + return visitorWorker(node, true); + } + function visitorNoAsyncModifier(node) { + if (node.kind === 119) { + return undefined; + } + return node; + } + function visitorWorker(node, noDestructuringValue) { + if ((node.transformFlags & 8) === 0) { + return node; + } + switch (node.kind) { + case 190: + return visitAwaitExpression(node); + case 196: + return visitYieldExpression(node); + case 221: + return visitLabeledStatement(node); + case 177: + return visitObjectLiteralExpression(node); + case 193: + return visitBinaryExpression(node, noDestructuringValue); + case 225: + return visitVariableDeclaration(node); + case 215: + return visitForOfStatement(node, undefined); + case 213: + return visitForStatement(node); + case 189: + return visitVoidExpression(node); + case 151: + return visitConstructorDeclaration(node); + case 150: + return visitMethodDeclaration(node); + case 152: + return visitGetAccessorDeclaration(node); + case 153: + return visitSetAccessorDeclaration(node); + case 227: + return visitFunctionDeclaration(node); + case 185: + return visitFunctionExpression(node); + case 186: + return visitArrowFunction(node); + case 145: + return visitParameter(node); + case 209: + return visitExpressionStatement(node); + case 184: + return visitParenthesizedExpression(node, noDestructuringValue); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitAwaitExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.setOriginalNode(ts.setTextRange(ts.createYield(undefined, ts.createArrayLiteral([ts.createLiteral("await"), expression])), node), node); + } + return ts.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.updateYield(node, node.asteriskToken, node.asteriskToken + ? createAsyncDelegatorHelper(context, expression, expression) + : ts.createArrayLiteral(expression + ? [ts.createLiteral("yield"), expression] + : [ts.createLiteral("yield")])); + } + return ts.visitEachChild(node, visitor, context); + } + function visitLabeledStatement(node) { + if (enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1) { + var statement = ts.unwrapInnermostStatementOfLabel(node); + if (statement.kind === 215 && statement.awaitModifier) { + return visitForOfStatement(statement, node); + } + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), node); + } + return ts.visitEachChild(node, visitor, context); + } + function chunkObjectLiteralElements(elements) { + var chunkObject; + var objects = []; + for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { + var e = elements_4[_i]; + if (e.kind === 262) { + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + chunkObject = undefined; + } + var target = e.expression; + objects.push(ts.visitNode(target, visitor, ts.isExpression)); + } + else { + if (!chunkObject) { + chunkObject = []; + } + if (e.kind === 260) { + var p = e; + chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); + } + else { + chunkObject.push(e); } } } + if (chunkObject) { + objects.push(ts.createObjectLiteral(chunkObject)); + } + return objects; + } + function visitObjectLiteralExpression(node) { + if (node.transformFlags & 1048576) { + var objects = chunkObjectLiteralElements(node.properties); + if (objects.length && objects[0].kind !== 177) { + objects.unshift(ts.createObjectLiteral()); + } + return createAssignHelper(context, objects); + } + return ts.visitEachChild(node, visitor, context); + } + function visitExpressionStatement(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitParenthesizedExpression(node, noDestructuringValue) { + return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); + } + function visitBinaryExpression(node, noDestructuringValue) { + if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) { + return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue); + } + else if (node.operatorToken.kind === 25) { + return ts.updateBinary(node, ts.visitNode(node.left, visitorNoDestructuringValue, ts.isExpression), ts.visitNode(node.right, noDestructuringValue ? visitorNoDestructuringValue : visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name) && node.name.transformFlags & 1048576) { + return ts.flattenDestructuringBinding(node, visitor, context, 1); + } + return ts.visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + return ts.updateFor(node, ts.visitNode(node.initializer, visitorNoDestructuringValue, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement)); + } + function visitVoidExpression(node) { + return ts.visitEachChild(node, visitorNoDestructuringValue, context); + } + function visitForOfStatement(node, outermostLabeledStatement) { + if (node.initializer.transformFlags & 1048576) { + node = transformForOfStatementWithObjectRest(node); + } + if (node.awaitModifier) { + return transformForAwaitOfStatement(node, outermostLabeledStatement); + } + else { + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement); + } + } + function transformForOfStatementWithObjectRest(node) { + var initializerWithoutParens = ts.skipParentheses(node.initializer); + if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) { + var bodyLocation = void 0; + var statementsLocation = void 0; + var temp = ts.createTempVariable(undefined); + var statements = [ts.createForOfBindingStatement(initializerWithoutParens, temp)]; + if (ts.isBlock(node.statement)) { + ts.addRange(statements, node.statement.statements); + bodyLocation = node.statement; + statementsLocation = node.statement.statements; + } + return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) + ], 1), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation)); + } + return node; + } + function convertForOfStatementHead(node, boundValue) { + var binding = ts.createForOfBindingStatement(node.initializer, boundValue); + var bodyLocation; + var statementsLocation; + var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + } + function transformForAwaitOfStatement(node, outermostLabeledStatement) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(undefined); + var values = createAsyncValuesHelper(context, expression, node.expression); + var next = ts.createYield(undefined, enclosingFunctionFlags & 1 + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, []) + ]) + : ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, [])); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, values), node.expression), + ts.createVariableDeclaration(result, undefined, next) + ]), node.expression), 1048576), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"))), node), 256); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1)), ts.createBlock([ + ts.createTry(ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createYield(undefined, enclosingFunctionFlags & 1 + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createFunctionCall(returnMethod, iterator, []) + ]) + : ts.createFunctionCall(returnMethod, iterator, [])))), 1) + ]), undefined, ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1) + ]), 1)) + ])); + } + function visitParameter(node) { + if (node.transformFlags & 1048576) { + return ts.updateParameter(node, undefined, undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), undefined, undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + return ts.visitEachChild(node, visitor, context); + } + function visitConstructorDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateConstructor(node, undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function visitGetAccessorDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateGetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function visitSetAccessorDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0; + var updated = ts.updateSetAccessor(node, undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function visitMethodDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateMethod(node, undefined, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(undefined, visitor, ts.isToken), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function visitFunctionDeclaration(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionDeclaration(node, undefined, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function visitArrowFunction(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function visitFunctionExpression(node) { + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionExpression(node, enclosingFunctionFlags & 1 + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 + ? undefined + : node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, enclosingFunctionFlags & 2 && enclosingFunctionFlags & 1 + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function transformAsyncGeneratorFunctionBody(node) { + resumeLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, false, visitor); + appendObjectRestAssignmentsIfNeeded(statements, node); + statements.push(ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression(undefined, ts.createToken(38), node.name && ts.getGeneratedNameForNode(node.name), undefined, [], undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.updateBlock(node.body, statements); + if (languageVersion >= 2) { + if (resolver.getNodeCheckFlags(node) & 4096) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; + } + function transformFunctionBody(node) { + resumeLexicalEnvironment(); + var statementOffset = 0; + var statements = []; var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologue(statements, body.statements, false, visitor); + } + ts.addRange(statements, appendObjectRestAssignmentsIfNeeded(undefined, node)); var trailingStatements = endLexicalEnvironment(); - if (ts.some(leadingStatements) || ts.some(trailingStatements)) { + if (statementOffset > 0 || ts.some(statements) || ts.some(trailingStatements)) { var block = ts.convertToFunctionBody(body, true); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + ts.addRange(statements, block.statements.slice(statementOffset)); + ts.addRange(statements, trailingStatements); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(statements), block.statements)); } return body; } + function appendObjectRestAssignmentsIfNeeded(statements, node) { + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (parameter.transformFlags & 1048576) { + var temp = ts.getGeneratedNameForNode(parameter); + var declarations = ts.flattenDestructuringBinding(parameter, visitor, context, 1, temp, false, true); + if (ts.some(declarations)) { + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(declarations)); + ts.setEmitFlags(statement, 524288); + statements = ts.append(statements, statement); + } + } + } + return statements; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1) === 0) { + enabledSubstitutions |= 1; + context.enableSubstitution(180); + context.enableSubstitution(178); + context.enableSubstitution(179); + context.enableEmitNotification(228); + context.enableEmitNotification(150); + context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(151); + } + } + function onEmitNode(hint, node, emitCallback) { + if (enabledSubstitutions & 1 && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 | 4096); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178: + return substitutePropertyAccessExpression(node); + case 179: + return substituteElementAccessExpression(node); + case 180: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 + || kind === 151 + || kind === 150 + || kind === 152 + || kind === 153; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), location); + } + } } ts.transformESNext = transformESNext; var assignHelper = { @@ -40637,25 +45294,57 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), undefined, attributesSegments); } ts.createAssignHelper = createAssignHelper; + var asyncGeneratorHelper = { + name: "typescript:asyncGenerator", + scoped: false, + text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), q = [], c, i;\n return i = { next: verb(\"next\"), \"throw\": verb(\"throw\"), \"return\": verb(\"return\") }, i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }\n function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }\n function step(r) { r.done ? settle(c[2], r) : Promise.resolve(r.value[1]).then(r.value[0] === \"yield\" ? _yield : r.value[0] === \"delegate\" ? delegate : fulfill, reject); }\n function _yield(value) { settle(c[2], { value: value, done: false }); }\n function delegate(r) { step(r.done ? r : { value: [\"yield\", r.value], done: false }); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { c = void 0, f(v), next(); }\n };\n " + }; + function createAsyncGeneratorHelper(context, generatorFunc) { + context.requestEmitHelper(asyncGeneratorHelper); + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; + return ts.createCall(ts.getHelperName("__asyncGenerator"), undefined, [ + ts.createThis(), + ts.createIdentifier("arguments"), + generatorFunc + ]); + } + var asyncDelegator = { + name: "typescript:asyncDelegator", + scoped: false, + text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i = { next: verb(\"next\"), \"throw\": verb(\"throw\", function (e) { throw e; }), \"return\": verb(\"return\", function (v) { return { value: v, done: true }; }) };\n return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { return function (v) { return { value: [\"delegate\", (o[n] || f).call(o, v)], done: false }; }; }\n };\n " + }; + function createAsyncDelegatorHelper(context, expression, location) { + context.requestEmitHelper(asyncDelegator); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"), undefined, [expression]), location); + } + var asyncValues = { + name: "typescript:asyncValues", + scoped: false, + text: "\n var __asyncValues = (this && this.__asyncIterator) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator];\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\n };\n " + }; + function createAsyncValuesHelper(context, expression, location) { + context.requestEmitHelper(asyncValues); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"), undefined, [expression]), location); + } })(ts || (ts = {})); var ts; (function (ts) { function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); - var currentSourceFile; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFile = node; var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; return visited; } function visitor(node) { @@ -40668,11 +45357,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246: + case 248: return visitJsxElement(node, false); - case 247: + case 249: return visitJsxSelfClosingElement(node, false); - case 252: + case 255: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -40682,11 +45371,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 252: + case 255: return visitJsxExpression(node); - case 246: + case 248: return visitJsxElement(node, true); - case 247: + case 249: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -40702,7 +45391,7 @@ var ts; function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; - var attrs = node.attributes; + var attrs = node.attributes.properties; if (attrs.length === 0) { objectProperties = ts.createNull(); } @@ -40734,13 +45423,16 @@ var ts; } function transformJsxAttributeInitializer(node) { if (node === undefined) { - return ts.createLiteral(true); + return ts.createTrue(); } else if (node.kind === 9) { var decoded = tryDecodeEntities(node.text); - return decoded ? ts.createLiteral(decoded, node) : node; + return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 252) { + else if (node.kind === 255) { + if (node.expression === undefined) { + return ts.createTrue(); + } return visitJsxExpression(node); } else { @@ -40748,43 +45440,35 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + function fixupWhitespaceAndDecodeEntities(text) { + var acc; var firstNonWhitespace = 0; var lastNonWhitespace = -1; for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } function decodeEntities(text) { return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { @@ -40795,7 +45479,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); return ch ? String.fromCharCode(ch) : match; } }); @@ -40805,16 +45489,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246) { + if (node.kind === 248) { return getTagName(node.openingElement); } else { - var name_36 = node.tagName; - if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) { - return ts.createLiteral(name_36.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_36); + return ts.createExpressionFromEntityName(name); } } } @@ -40832,7 +45516,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -41090,593 +45774,358 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; - var resolver = context.getEmitResolver(); - var compilerOptions = context.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var currentSourceFile; - var enabledSubstitutions; - var currentSuperContainer; - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; + function transformES2016(context) { + var hoistVariableDeclaration = context.hoistVariableDeclaration; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { return node; } - currentSourceFile = node; - var visited = ts.visitEachChild(node, visitor, context); - ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; - return visited; + return ts.visitEachChild(node, visitor, context); } function visitor(node) { - if ((node.transformFlags & 16) === 0) { + if ((node.transformFlags & 32) === 0) { return node; } switch (node.kind) { - case 119: - return undefined; - case 189: - return visitAwaitExpression(node); - case 149: - return visitMethodDeclaration(node); - case 225: - return visitFunctionDeclaration(node); - case 184: - return visitFunctionExpression(node); - case 185: - return visitArrowFunction(node); + case 193: + return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); } } - function visitAwaitExpression(node) { - return ts.setOriginalNode(ts.createYield(undefined, ts.visitNode(node.expression, visitor, ts.isExpression), node), node); + function visitBinaryExpression(node) { + switch (node.operatorToken.kind) { + case 61: + return visitExponentiationAssignmentExpression(node); + case 39: + return visitExponentiationExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } } - function visitMethodDeclaration(node) { - return ts.updateMethod(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + function visitExponentiationAssignmentExpression(node) { + var target; + var value; + var left = ts.visitNode(node.left, visitor, ts.isExpression); + var right = ts.visitNode(node.right, visitor, ts.isExpression); + if (ts.isElementAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.setTextRange(ts.createElementAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), ts.setTextRange(ts.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left); + value = ts.setTextRange(ts.createElementAccess(expressionTemp, argumentExpressionTemp), left); + } + else if (ts.isPropertyAccessExpression(left)) { + var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); + target = ts.setTextRange(ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), left.name), left); + value = ts.setTextRange(ts.createPropertyAccess(expressionTemp, left.name), left); + } + else { + target = left; + value = left; + } + return ts.setTextRange(ts.createAssignment(target, ts.createMathPow(value, right, node)), node); } - function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + function visitExponentiationExpression(node) { + var left = ts.visitNode(node.left, visitor, ts.isExpression); + var right = ts.visitNode(node.right, visitor, ts.isExpression); + return ts.createMathPow(left, right, node); } - function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { - return ts.createOmittedExpression(); + } + ts.transformES2016 = transformES2016; +})(ts || (ts = {})); +var ts; +(function (ts) { + var ES2015SubstitutionFlags; + (function (ES2015SubstitutionFlags) { + ES2015SubstitutionFlags[ES2015SubstitutionFlags["CapturedThis"] = 1] = "CapturedThis"; + ES2015SubstitutionFlags[ES2015SubstitutionFlags["BlockScopedBindings"] = 2] = "BlockScopedBindings"; + })(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {})); + var CopyDirection; + (function (CopyDirection) { + CopyDirection[CopyDirection["ToOriginal"] = 0] = "ToOriginal"; + CopyDirection[CopyDirection["ToOutParameter"] = 1] = "ToOutParameter"; + })(CopyDirection || (CopyDirection = {})); + var Jump; + (function (Jump) { + Jump[Jump["Break"] = 2] = "Break"; + Jump[Jump["Continue"] = 4] = "Continue"; + Jump[Jump["Return"] = 8] = "Return"; + })(Jump || (Jump = {})); + var SuperCaptureResult; + (function (SuperCaptureResult) { + SuperCaptureResult[SuperCaptureResult["NoReplacement"] = 0] = "NoReplacement"; + SuperCaptureResult[SuperCaptureResult["ReplaceSuperCapture"] = 1] = "ReplaceSuperCapture"; + SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; + })(SuperCaptureResult || (SuperCaptureResult = {})); + var HierarchyFacts; + (function (HierarchyFacts) { + HierarchyFacts[HierarchyFacts["None"] = 0] = "None"; + HierarchyFacts[HierarchyFacts["Function"] = 1] = "Function"; + HierarchyFacts[HierarchyFacts["ArrowFunction"] = 2] = "ArrowFunction"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBody"] = 4] = "AsyncFunctionBody"; + HierarchyFacts[HierarchyFacts["NonStaticClassElement"] = 8] = "NonStaticClassElement"; + HierarchyFacts[HierarchyFacts["CapturesThis"] = 16] = "CapturesThis"; + HierarchyFacts[HierarchyFacts["ExportedVariableStatement"] = 32] = "ExportedVariableStatement"; + HierarchyFacts[HierarchyFacts["TopLevel"] = 64] = "TopLevel"; + HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block"; + HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement"; + HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock"; + HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement"; + HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper"; + HierarchyFacts[HierarchyFacts["ComputedPropertyName"] = 8192] = "ComputedPropertyName"; + HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask"; + HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; + HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes"; + HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes"; + HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes"; + HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes"; + HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 16256] = "ArrowFunctionExcludes"; + HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes"; + HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; + HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes"; + HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes"; + HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameIncludes"] = 8192] = "ComputedPropertyNameIncludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameExcludes"] = 0] = "ComputedPropertyNameExcludes"; + HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget"; + HierarchyFacts[HierarchyFacts["NewTargetInComputedPropertyName"] = 32768] = "NewTargetInComputedPropertyName"; + HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask"; + HierarchyFacts[HierarchyFacts["PropagateNewTargetMask"] = 49152] = "PropagateNewTargetMask"; + })(HierarchyFacts || (HierarchyFacts = {})); + function transformES2015(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + var currentSourceFile; + var currentText; + var hierarchyFacts; + var convertedLoopState; + var enabledSubstitutions; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; } - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + currentSourceFile = node; + currentText = node.text; + var visited = visitSourceFile(node); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + currentText = undefined; + hierarchyFacts = 0; + return visited; } - function visitArrowFunction(node) { - return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383; + return ancestorFacts; } - function transformAsyncFunctionBody(node) { - resumeLexicalEnvironment(); - var original = ts.getOriginalNode(node, ts.isFunctionLike); - var nodeType = original.type; - var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; - if (!isArrowFunction) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, false, visitor); - statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); - ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(statements, node.body, true); - if (languageVersion >= 2) { - if (resolver.getNodeCheckFlags(node) & 4096) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, advancedAsyncSuperHelper); - } - else if (resolver.getNodeCheckFlags(node) & 2048) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, asyncSuperHelper); - } - } - return block; - } - else { - var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); - var declarations = endLexicalEnvironment(); - if (ts.some(declarations)) { - var block = ts.convertToFunctionBody(expression); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); - } - return expression; - } + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts; } - function transformFunctionBodyWorker(body, start) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); + function isReturnVoidStatementInConstructorWithCapturedSuper(node) { + return hierarchyFacts & 4096 + && node.kind === 218 + && !node.expression; + } + function shouldVisitNode(node) { + return (node.transformFlags & 128) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 && ts.isStatement(node)) + || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); + } + function visitor(node) { + if (shouldVisitNode(node)) { + return visitJavaScript(node); } else { - startLexicalEnvironment(); - var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); - var declarations = endLexicalEnvironment(); - return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); + return node; } } - function getPromiseConstructor(type) { - var typeName = type && ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, true); } - return undefined; + return node; } - function enableSubstitutionForAsyncMethodsWithSuper() { - if ((enabledSubstitutions & 1) === 0) { - enabledSubstitutions |= 1; - context.enableSubstitution(179); - context.enableSubstitution(177); - context.enableSubstitution(178); - context.enableEmitNotification(226); - context.enableEmitNotification(149); - context.enableEmitNotification(151); - context.enableEmitNotification(152); - context.enableEmitNotification(150); + function callExpressionVisitor(node) { + if (node.kind === 96) { + return visitSuperKeyword(true); } + return visitor(node); } - function substituteExpression(node) { - switch (node.kind) { - case 177: - return substitutePropertyAccessExpression(node); - case 178: - return substituteElementAccessExpression(node); - case 179: - if (enabledSubstitutions & 1) { - return substituteCallExpression(node); - } - break; - } - return node; - } - function substitutePropertyAccessExpression(node) { - if (enabledSubstitutions & 1 && node.expression.kind === 96) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node); - } - } - return node; - } - function substituteElementAccessExpression(node) { - if (enabledSubstitutions & 1 && node.expression.kind === 96) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node); - } - } - return node; - } - function substituteCallExpression(node) { - var expression = node.expression; - if (ts.isSuperProperty(expression)) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - var argumentExpression = ts.isPropertyAccessExpression(expression) - ? substitutePropertyAccessExpression(expression) - : substituteElementAccessExpression(expression); - return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), undefined, [ - ts.createThis() - ].concat(node.arguments)); - } - } - return node; - } - function isSuperContainer(node) { - var kind = node.kind; - return kind === 226 - || kind === 150 - || kind === 149 - || kind === 151 - || kind === 152; - } - function onEmitNode(emitContext, node, emitCallback) { - if (enabledSubstitutions & 1 && isSuperContainer(node)) { - var savedCurrentSuperContainer = currentSuperContainer; - currentSuperContainer = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSuperContainer = savedCurrentSuperContainer; - } - else { - previousOnEmitNode(emitContext, node, emitCallback); - } - } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { - return substituteExpression(node); - } - return node; - } - function createSuperAccessInAsyncMethod(argumentExpression, flags, location) { - if (flags & 4096) { - return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression]), "value", location); - } - else { - return ts.createCall(ts.createIdentifier("_super"), undefined, [argumentExpression], location); - } - } - function getSuperContainerAsyncMethodFlags() { - return currentSuperContainer !== undefined - && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 | 4096); - } - } - ts.transformES2017 = transformES2017; - function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { - context.requestEmitHelper(awaiterHelper); - var generatorFunc = ts.createFunctionExpression(undefined, ts.createToken(38), undefined, undefined, [], undefined, body); - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072; - return ts.createCall(ts.getHelperName("__awaiter"), undefined, [ - ts.createThis(), - hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), - promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), - generatorFunc - ]); - } - var awaiterHelper = { - name: "typescript:awaiter", - scoped: false, - priority: 5, - text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };" - }; - var asyncSuperHelper = { - name: "typescript:async-super", - scoped: true, - text: "\n const _super = name => super[name];" - }; - var advancedAsyncSuperHelper = { - name: "typescript:advanced-async-super", - scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" - }; -})(ts || (ts = {})); -var ts; -(function (ts) { - function transformES2016(context) { - var hoistVariableDeclaration = context.hoistVariableDeclaration; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; - } - return ts.visitEachChild(node, visitor, context); - } - function visitor(node) { - if ((node.transformFlags & 32) === 0) { - return node; - } - switch (node.kind) { - case 192: - return visitBinaryExpression(node); - default: - return ts.visitEachChild(node, visitor, context); - } - } - function visitBinaryExpression(node) { - switch (node.operatorToken.kind) { - case 61: - return visitExponentiationAssignmentExpression(node); - case 39: - return visitExponentiationExpression(node); - default: - return ts.visitEachChild(node, visitor, context); - } - } - function visitExponentiationAssignmentExpression(node) { - var target; - var value; - var left = ts.visitNode(node.left, visitor, ts.isExpression); - var right = ts.visitNode(node.right, visitor, ts.isExpression); - if (ts.isElementAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, left.argumentExpression), left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, left); - } - else if (ts.isPropertyAccessExpression(left)) { - var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, left.expression), left.name, left); - value = ts.createPropertyAccess(expressionTemp, left.name, left); - } - else { - target = left; - value = left; - } - return ts.createAssignment(target, ts.createMathPow(value, right, node), node); - } - function visitExponentiationExpression(node) { - var left = ts.visitNode(node.left, visitor, ts.isExpression); - var right = ts.visitNode(node.right, visitor, ts.isExpression); - return ts.createMathPow(left, right, node); - } - } - ts.transformES2016 = transformES2016; -})(ts || (ts = {})); -var ts; -(function (ts) { - function transformES2015(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; - var resolver = context.getEmitResolver(); - var previousOnSubstituteNode = context.onSubstituteNode; - var previousOnEmitNode = context.onEmitNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - var currentSourceFile; - var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; - var convertedLoopState; - var enabledSubstitutions; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; - } - currentSourceFile = node; - currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); - ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; - currentText = undefined; - return visited; - } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); - } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; - } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); - } - function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; - } - function shouldCheckNode(node) { - return (node.transformFlags & 64) !== 0 || - node.kind === 219 || - (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); - } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { - return visitJavaScript(node); - } - else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - return ts.visitEachChild(node, visitor, context); - } - else { - return node; - } - } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); - } - else { - result = visitNodesInConvertedLoop(node); - } - return result; - } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205: - return visitVariableStatement(node); - case 218: - return visitSwitchStatement(node); - case 215: - case 214: - return visitBreakOrContinueStatement(node); - case 98: - return visitThisKeyword(node); - case 70: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); - } - } - function visitJavaScript(node) { + function visitJavaScript(node) { switch (node.kind) { case 114: return undefined; - case 226: + case 228: return visitClassDeclaration(node); - case 197: + case 198: return visitClassExpression(node); - case 144: + case 145: return visitParameter(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 185: + case 186: return visitArrowFunction(node); - case 184: + case 185: return visitFunctionExpression(node); - case 223: + case 225: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 224: + case 226: return visitVariableDeclarationList(node); - case 219: + case 220: + return visitSwitchStatement(node); + case 234: + return visitCaseBlock(node); + case 206: + return visitBlock(node, false); + case 217: + case 216: + return visitBreakOrContinueStatement(node); + case 221: return visitLabeledStatement(node); - case 209: - return visitDoStatement(node); - case 210: - return visitWhileStatement(node); case 211: - return visitForStatement(node); case 212: - return visitForInStatement(node); + return visitDoOrWhileStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 207: + return visitForStatement(node, undefined); + case 214: + return visitForInStatement(node, undefined); + case 215: + return visitForOfStatement(node, undefined); + case 209: return visitExpressionStatement(node); - case 176: + case 177: return visitObjectLiteralExpression(node); - case 256: + case 259: return visitCatchClause(node); - case 258: + case 261: return visitShorthandPropertyAssignment(node); - case 175: + case 143: + return visitComputedPropertyName(node); + case 176: return visitArrayLiteralExpression(node); - case 179: - return visitCallExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); - case 183: + case 184: return visitParenthesizedExpression(node, true); - case 192: + case 193: return visitBinaryExpression(node, true); case 12: case 13: case 14: case 15: return visitTemplateLiteral(node); - case 181: + case 9: + return visitStringLiteral(node); + case 8: + return visitNumericLiteral(node); + case 182: return visitTaggedTemplateExpression(node); - case 194: - return visitTemplateExpression(node); case 195: - return visitYieldExpression(node); + return visitTemplateExpression(node); case 196: + return visitYieldExpression(node); + case 197: return visitSpreadElement(node); case 96: - return visitSuperKeyword(); - case 195: - return ts.visitEachChild(node, visitor, context); - case 149: + return visitSuperKeyword(false); + case 98: + return visitThisKeyword(node); + case 203: + return visitMetaProperty(node); + case 150: return visitMethodDeclaration(node); - case 205: + case 152: + case 153: + return visitAccessorDeclaration(node); + case 207: return visitVariableStatement(node); + case 218: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968, 64); var statements = []; startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); + var statementOffset = ts.addStandardPrologue(statements, node.statements, false); addCaptureThisForNodeIfNeeded(statements, node); + statementOffset = ts.addCustomPrologue(statements, node.statements, statementOffset, visitor); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + exitSubtree(ancestorFacts, 0, 0); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - convertedLoopState.allowedNonLabeledJumps |= 2; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032, 0); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185) { - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2) { + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -41685,20 +46134,20 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 215 ? 2 : 4; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 ? 2 : 4; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215) { + if (node.kind === 217) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -41708,7 +46157,7 @@ var ts; } } else { - if (node.kind === 215) { + if (node.kind === 217) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -41741,8 +46190,9 @@ var ts; var variable = ts.createVariableDeclaration(ts.getLocalName(node, true), undefined, transformClassLikeDeclarationToExpression(node)); ts.setOriginalNode(variable, node); var statements = []; - var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable]), node); + var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([variable])); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, node); ts.startOnNewLine(statement); statements.push(statement); if (ts.hasModifier(node, 1)) { @@ -41797,23 +46247,29 @@ var ts; ts.setEmitFlags(statement, 1536 | 384); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, node.members), undefined, true); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), node.members), true); ts.setEmitFlags(block, 1536); return block; } function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), extendsClauseElement)); + statements.push(ts.setTextRange(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node))), extendsClauseElement)); } } function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278, 73); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); - var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); + var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper)); + ts.setTextRange(constructorFunction, constructor || node); if (extendsClauseElement) { ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; } function transformConstructorParameters(constructor, hasSynthesizedSuper) { return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) @@ -41827,48 +46283,55 @@ var ts; statementOffset = 0; } else if (constructor) { - statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, false, visitor); + statementOffset = ts.addStandardPrologue(statements, constructor.body.statements, false); } if (constructor) { addDefaultValueAssignmentsIfNeeded(statements, constructor); addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + if (!hasSynthesizedSuper) { + statementOffset = ts.addCustomPrologue(statements, constructor.body.statements, statementOffset, visitor); + } ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); if (superCaptureStatus === 1 || superCaptureStatus === 2) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1) { + hierarchyFacts |= 4096; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset)); } - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, false); + } + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true); + ts.setTextRange(block, constructor ? constructor.body : node); if (!constructor) { ts.setEmitFlags(block, 1536); } return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 216) { + if (statement.kind === 218) { return true; } - else if (statement.kind === 208) { + else if (statement.kind === 210) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204) { + else if (statement.kind === 206) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -41876,8 +46339,8 @@ var ts; } return false; } - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { - if (!hasExtendsClause) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -41897,42 +46360,43 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 209 && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } - if (superCallExpression && statementOffset === ctorStatements.length - 1) { + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 | 32768))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 - || superCallExpression.left.kind !== 179) { + if (superCallExpression.kind !== 193 + || superCallExpression.left.kind !== 180) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } ts.setCommentRange(returnStatement, ts.getCommentRange(ts.setEmitFlags(superCallExpression.left, 1536))); statements.push(returnStatement); return 2; } - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); if (superCallExpression) { return 1; } return 0; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { return undefined; } else if (ts.isBindingPattern(node.name)) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined, node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createParameter(undefined, undefined, undefined, ts.getGeneratedNameForNode(node), undefined, undefined, undefined), node), node); } else if (node.initializer) { - return ts.setOriginalNode(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined, node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createParameter(undefined, undefined, undefined, node.name, undefined, undefined, undefined), node), node); } else { return node; @@ -41947,15 +46411,15 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_37 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_37)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_37, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_37, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -41970,10 +46434,11 @@ var ts; } function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ - ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer)), parameter)) - ], parameter), 1 | 32 | 384), undefined, parameter); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.setTextRange(ts.createBlock([ + ts.createStatement(ts.setTextRange(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48), ts.setEmitFlags(initializer, 48 | ts.getEmitFlags(initializer))), parameter)) + ]), parameter), 1 | 32 | 384)); statement.startsOnNewLine = true; + ts.setTextRange(statement, parameter); ts.setEmitFlags(statement, 384 | 32 | 524288); statements.push(statement); } @@ -41990,22 +46455,22 @@ var ts; var expressionName = ts.getSynthesizedClone(parameter.name); var restIndex = node.parameters.length - 1; var temp = ts.createLoopVariable(); - statements.push(ts.setEmitFlags(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + statements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(declarationName, undefined, ts.createArrayLiteral([])) - ]), parameter), 524288)); - var forStatement = ts.createFor(ts.createVariableDeclarationList([ + ])), parameter), 524288)); + var forStatement = ts.createFor(ts.setTextRange(ts.createVariableDeclarationList([ ts.createVariableDeclaration(temp, undefined, ts.createLiteral(restIndex)) - ], parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), parameter), ts.createPostfixIncrement(temp, parameter), ts.createBlock([ - ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ]), parameter), ts.setTextRange(ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length")), parameter), ts.setTextRange(ts.createPostfixIncrement(temp), parameter), ts.createBlock([ + ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 ? temp - : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), parameter)) + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp))), parameter)) ])); ts.setEmitFlags(forStatement, 524288); ts.startOnNewLine(forStatement); statements.push(forStatement); } function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 && node.kind !== 185) { + if (node.transformFlags & 32768 && node.kind !== 186) { captureThisForNode(statements, node, ts.createThis()); } } @@ -42013,29 +46478,62 @@ var ts; enableSubstitutionsForCapturedThis(); var captureThisStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("_this", undefined, initializer) - ]), originalStatement); + ])); ts.setEmitFlags(captureThisStatement, 1536 | 524288); + ts.setTextRange(captureThisStatement, originalStatement); ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384) { + var newTarget = void 0; + switch (node.kind) { + case 186: + return statements; + case 150: + case 152: + case 153: + newTarget = ts.createVoidZero(); + break; + case 151: + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); + break; + case 227: + case 185: + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203: + case 205: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + case 150: + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150: + case 151: break; default: ts.Debug.failBadSyntaxKind(node); @@ -42044,28 +46542,32 @@ var ts; } } function transformSemicolonClassElementToStatement(member) { - return ts.createEmptyStatement(member); + return ts.setTextRange(ts.createEmptyStatement(), member); } - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0, 0); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); - var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined, container); ts.setEmitFlags(memberFunction, 1536); ts.setSourceMapRange(memberFunction, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); + var statement = ts.setTextRange(ts.createStatement(ts.createAssignment(memberName, memberFunction)), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); ts.setEmitFlags(statement, 48); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return statement; } - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, false)); ts.setEmitFlags(statement, 1536); + ts.setSourceMapRange(statement, ts.getSourceMapRange(accessors.firstAccessor)); return statement; } - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0, 0); var target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); @@ -42074,7 +46576,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -42082,51 +46584,86 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); } - properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true))); + properties.push(ts.createPropertyAssignment("enumerable", ts.createTrue()), ts.createPropertyAssignment("configurable", ts.createTrue())); var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ target, propertyName, - ts.createObjectLiteral(properties, undefined, true) + ts.createObjectLiteral(properties, true) ]); if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return call; } function visitArrowFunction(node) { if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } - var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256, 66); + var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + ts.setTextRange(func, node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8); + exitSubtree(ancestorFacts, 0, 0); + convertedLoopState = savedConvertedLoopState; return func; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var ancestorFacts = ts.getEmitFlags(node) & 131072 + ? enterSubtree(16278, 69) + : enterSubtree(16286, 65); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, undefined, node.asteriskToken, name, undefined, parameters, undefined, body); } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, undefined, parameters, undefined, body); } - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32) + ? enterSubtree(16286, 65 | 8) + : enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 && !name && (node.kind === 227 || node.kind === 185)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body), location), node); } function transformFunctionBody(node) { var multiLine = false; @@ -42138,7 +46675,7 @@ var ts; var statementOffset; resumeLexicalEnvironment(); if (ts.isBlock(body)) { - statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + statementOffset = ts.addStandardPrologue(statements, body.statements, false); } addCaptureThisForNodeIfNeeded(statements, node); addDefaultValueAssignmentsIfNeeded(statements, node); @@ -42147,6 +46684,7 @@ var ts; multiLine = true; } if (ts.isBlock(body)) { + statementOffset = ts.addCustomPrologue(statements, body.statements, statementOffset, visitor); statementsLocation = body.statements; ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); if (!multiLine && body.multiLine) { @@ -42154,7 +46692,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185); + ts.Debug.assert(node.kind === 186); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -42166,17 +46704,20 @@ var ts; } } var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = ts.createReturn(expression, body); + var returnStatement = ts.createReturn(expression); + ts.setTextRange(returnStatement, body); ts.setEmitFlags(returnStatement, 384 | 32 | 1024); statements.push(returnStatement); closeBraceLocation = body; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, false); if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), multiLine); + ts.setTextRange(block, node.body); if (!multiLine && singleLine) { ts.setEmitFlags(block, 1); } @@ -42186,11 +46727,26 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.setTextRange(ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, true)), updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 + ? enterSubtree(4032, 512) + : enterSubtree(3904, 128); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } function visitExpressionStatement(node) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateStatement(node, visitBinaryExpression(node.expression, false)); } return ts.visitEachChild(node, visitor, context); @@ -42198,9 +46754,9 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { if (!needsDestructuringValue) { switch (node.expression.kind) { - case 183: + case 184: return ts.updateParen(node, visitParenthesizedExpression(node.expression, false)); - case 192: + case 193: return ts.updateParen(node, visitBinaryExpression(node.expression, false)); } } @@ -42210,9 +46766,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { + var ancestorFacts = enterSubtree(0, ts.hasModifier(node, 1) ? 32 : 0); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3) === 0) { var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; @@ -42225,53 +46784,59 @@ var ts; else { assignment = ts.createBinary(decl.name, 57, ts.visitNode(decl.initializer, visitor, ts.isExpression)); } - (assignments || (assignments = [])).push(assignment); + assignments = ts.append(assignments, assignment); } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); + updated = ts.setTextRange(ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); })), node); } else { - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function visitVariableDeclarationList(node) { - if (node.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64) { + if (node.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations); + ts.setOriginalNode(declarationList, node); + ts.setTextRange(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } function shouldEmitExplicitInitializerForLetDeclaration(node) { var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, false)); + && (hierarchyFacts & 512) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 - && enclosingBlockScopeContainer.kind !== 213 + && (hierarchyFacts & 2048) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, false))); + && (hierarchyFacts & (1024 | 2048)) === 0)); return emitExplicitInitializer; } function visitVariableDeclarationInLetDeclarationList(node) { @@ -42287,84 +46852,94 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { + var ancestorFacts = enterSubtree(32, 0); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, (ancestorFacts & 32) !== 0); } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels.set(node.label.text, node.label.text); + } + function resetLabel(node) { + convertedLoopState.labels.set(node.label.text, undefined); } function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - else { - result = ts.visitEachChild(node, visitor, context); - } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + var statement = ts.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, false) + ? visitIterationStatement(statement, node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 211: + case 212: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 213: + return visitForStatement(node, outermostLabeledStatement); + case 214: + return visitForInStatement(node, outermostLabeledStatement); + case 215: + return visitForOfStatement(node, outermostLabeledStatement); } - return result; } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0, 0); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement); } - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } - function convertForOfToFor(node, convertedLoopBodyStatements) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; + function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { var statements = []; - var counter = ts.createLoopVariable(); - var rhsReference = expression.kind === 70 - ? ts.createUniqueName(expression.text) - : ts.createTempVariable(undefined); - var elementAccess = ts.createElementAccess(rhsReference, counter); - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3) { + if (ts.isVariableDeclarationList(node.initializer)) { + if (node.initializer.flags & 3) { enableSubstitutionsForBlockScopedBindings(); } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + var firstOriginalDeclaration = ts.firstOrUndefined(node.initializer.declarations); if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { - var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, elementAccess); - var declarationList = ts.createVariableDeclarationList(declarations, initializer); - ts.setOriginalNode(declarationList, initializer); + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0, boundValue); + var declarationList = ts.setTextRange(ts.createVariableDeclarationList(declarations), node.initializer); + ts.setOriginalNode(declarationList, node.initializer); var firstDeclaration = declarations[0]; var lastDeclaration = ts.lastOrUndefined(declarations); ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); statements.push(ts.createVariableStatement(undefined, declarationList)); } else { - statements.push(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, ts.createElementAccess(rhsReference, counter)) - ], ts.moveRangePos(initializer, -1)), initializer), ts.moveRangeEnd(initializer, -1))); + statements.push(ts.setTextRange(ts.createVariableStatement(undefined, ts.setOriginalNode(ts.setTextRange(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(undefined), undefined, boundValue) + ]), ts.moveRangePos(node.initializer, -1)), node.initializer)), ts.moveRangeEnd(node.initializer, -1))); } } else { - var assignment = ts.createAssignment(initializer, elementAccess); + var assignment = ts.createAssignment(node.initializer, boundValue); if (ts.isDestructuringAssignment(assignment)) { - statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0))); + ts.aggregateTransformFlags(assignment); + statements.push(ts.createStatement(visitBinaryExpression(assignment, false))); } else { - assignment.end = initializer.end; - statements.push(ts.createStatement(assignment, ts.moveRangeEnd(initializer, -1))); + assignment.end = node.initializer.end; + statements.push(ts.setTextRange(ts.createStatement(ts.visitNode(assignment, visitor, ts.isExpression)), ts.moveRangeEnd(node.initializer, -1))); } } var bodyLocation; @@ -42373,7 +46948,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -42383,39 +46958,82 @@ var ts; statements.push(statement); } } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + } + function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var counter = ts.createLoopVariable(); + var rhsReference = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); ts.setEmitFlags(expression, 48 | ts.getEmitFlags(expression)); - var body = ts.createBlock(ts.createNodeArray(statements, statementsLocation), bodyLocation); - ts.setEmitFlags(body, 48 | 384); - var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0), ts.moveRangePos(node.expression, -1)), - ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) - ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); + var forStatement = ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(counter, undefined, ts.createLiteral(0)), ts.moveRangePos(node.expression, -1)), + ts.setTextRange(ts.createVariableDeclaration(rhsReference, undefined, expression), node.expression) + ]), node.expression), 1048576), ts.setTextRange(ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length")), node.expression), ts.setTextRange(ts.createPostfixIncrement(counter), node.expression), convertForOfStatementHead(node, ts.createElementAccess(rhsReference, counter), convertedLoopBodyStatements)), node); ts.setEmitFlags(forStatement, 256); - return forStatement; + ts.setTextRange(forStatement, node); + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(undefined); + var values = ts.createValuesHelper(context, expression, node.expression); + var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, []); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, values), node.expression), + ts.createVariableDeclaration(result, undefined, next) + ]), node.expression), 1048576), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"), convertedLoopBodyStatements)), node), 256); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1)), ts.createBlock([ + ts.createTry(ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createFunctionCall(returnMethod, iterator, []))), 1), + ]), undefined, ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1) + ]), 1)) + ])); } function visitObjectLiteralExpression(node) { var properties = node.properties; var numProperties = properties.length; var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 - || property.name.kind === 142) { + if ((property.transformFlags & 16777216 && hierarchyFacts & 4) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 143) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - var temp = ts.createTempVariable(hoistVariableDeclaration); - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + var temp = ts.createTempVariable(hoistVariableDeclaration); + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), 32768)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536) !== 0; @@ -42439,14 +47057,16 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 | 4; } - var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -42455,11 +47075,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211: - case 212: case 213: + case 214: + case 215: var initializer = node.initializer; - if (initializer && initializer.kind === 224) { + if (initializer && initializer.kind === 226) { loopInitializer = initializer; } break; @@ -42485,19 +47105,26 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + startLexicalEnvironment(); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1, statements_4); - loopBody = ts.createBlock(statements_4, undefined, true); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, true); } - if (!ts.isBlock(loopBody)) { - loopBody = ts.createBlock([loopBody], undefined, true); + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + else { + loopBody = ts.createBlock([loopBody], true); + } + var isAsyncBlockContainingAwait = hierarchyFacts & 4 && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -42556,19 +47183,18 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); - loop.statement = undefined; - loop = ts.visitEachChild(loop, visitor, context); - loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); - } - statements.push(currentParent.kind === 219 - ? ts.createLabel(currentParent.label, loop) - : loop); + var clone_4 = ts.getMutableClone(node); + clone_4.statement = undefined; + clone_4 = ts.visitEachChild(clone_4, visitor, context); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, true); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); + } + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -42589,7 +47215,9 @@ var ts; !state.labeledNonLocalBreaks && !state.labeledNonLocalContinues; var call = ts.createCall(loopFunctionExpressionName, undefined, ts.map(parameters, function (p) { return p.name; })); - var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38), call) : call; + var callResult = isAsyncBlockContainingAwait + ? ts.createYield(ts.createToken(38), ts.setEmitFlags(call, 4194304)) + : call; if (isSimpleLoop) { statements.push(ts.createStatement(callResult)); copyOutParameters(state.loopOutParameters, 0, statements); @@ -42627,23 +47255,22 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -42652,7 +47279,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -42667,7 +47294,7 @@ var ts; else { loopParameters.push(ts.createParameter(undefined, undefined, undefined, name)); if (resolver.getNodeCheckFlags(decl) & 2097152) { - var outParamName = ts.createUniqueName("out_" + name.text); + var outParamName = ts.createUniqueName("out_" + ts.unescapeIdentifier(name.text)); loopOutParameters.push({ originalName: name, outParamName: outParamName }); } } @@ -42678,22 +47305,22 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151: case 152: + case 153: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257: + case 150: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 260: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 258: + case 261: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; default: ts.Debug.failBadSyntaxKind(node); break; @@ -42701,34 +47328,49 @@ var ts; } } function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } return expression; } function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } return expression; } - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0, 0); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined, container)); + ts.setTextRange(expression, method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); - var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032, 0); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp); + ts.setTextRange(newVariableDeclaration, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); + var list = ts.createVariableDeclarationList(vars); + ts.setTextRange(list, node.variableDeclaration); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -42736,21 +47378,43 @@ var ts; } function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); + var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined, undefined); ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); - return ts.createPropertyAssignment(node.name, functionExpression, node); + return ts.setTextRange(ts.createPropertyAssignment(node.name, functionExpression), node); + } + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return updated; } function visitShorthandPropertyAssignment(node) { - return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node); + return ts.setTextRange(ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name)), node); + } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0, 8192); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 32768 : 0); + return updated; } function visitYieldExpression(node) { return ts.visitEachChild(node, visitor, context); } function visitArrayLiteralExpression(node) { - return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + if (node.transformFlags & 64) { + return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + if (node.transformFlags & 64) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, false); @@ -42762,38 +47426,54 @@ var ts; } var resultingCall; if (node.transformFlags & 524288) { - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); } if (node.expression.kind === 96) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 524288) !== 0); - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + if (node.transformFlags & 524288) { + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + } + return ts.visitEachChild(node, visitor, context); } function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { var numElements = elements.length; var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) { return visitPartition(partition, multiLine, hasTrailingComma && end === numElements); })); - if (segments.length === 1) { - var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 - ? ts.createArraySlice(segments[0]) - : segments[0]; + if (compilerOptions.downlevelIteration) { + if (segments.length === 1) { + var firstSegment = segments[0]; + if (ts.isCallExpression(firstSegment) + && ts.isIdentifier(firstSegment.expression) + && (ts.getEmitFlags(firstSegment.expression) & 4096) + && firstSegment.expression.text === "___spread") { + return segments[0]; + } + } + return ts.createSpreadHelper(context, segments); + } + else { + if (segments.length === 1) { + var firstElement = elements[0]; + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 + ? ts.createArraySlice(segments[0]) + : segments[0]; + } + return ts.createArrayConcat(segments.shift(), segments); } - return ts.createArrayConcat(segments.shift(), segments); } function partitionSpread(node) { return ts.isSpreadExpression(node) @@ -42804,7 +47484,7 @@ var ts; return ts.map(chunk, visitExpressionOfSpread); } function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { - return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, undefined, hasTrailingComma), visitor, ts.isExpression), undefined, multiLine); + return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, hasTrailingComma), visitor, ts.isExpression), multiLine); } function visitSpreadElement(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); @@ -42813,7 +47493,19 @@ var ts; return ts.visitNode(node.expression, visitor, ts.isExpression); } function visitTemplateLiteral(node) { - return ts.createLiteral(node.text, node); + return ts.setTextRange(ts.createLiteral(node.text), node); + } + function visitStringLiteral(node) { + if (node.hasExtendedUnicodeEscape) { + return ts.setTextRange(ts.createLiteral(node.text), node); + } + return node; + } + function visitNumericLiteral(node) { + if (node.numericLiteralFlags & 48) { + return ts.setTextRange(ts.createNumericLiteral(node.text), node); + } + return node; } function visitTaggedTemplateExpression(node) { var tag = ts.visitNode(node.tag, visitor, ts.isExpression); @@ -42847,7 +47539,7 @@ var ts; var isLast = node.kind === 12 || node.kind === 15; text = text.substring(1, text.length - (isLast ? 1 : 2)); text = text.replace(/\r\n?/g, "\n"); - return ts.createLiteral(text, node); + return ts.setTextRange(ts.createLiteral(text), node); } function visitTemplateExpression(node) { var expressions = []; @@ -42855,7 +47547,8 @@ var ts; addTemplateSpans(expressions, node); var expression = ts.reduceLeft(expressions, ts.createAdd); if (ts.nodeIsSynthesized(expression)) { - ts.setTextRange(expression, node); + expression.pos = node.pos; + expression.end = node.end; } return expression; } @@ -42878,21 +47571,34 @@ var ts; } } } - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32) - && currentParent.kind !== 179 + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } - function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; + function visitMetaProperty(node) { + if (node.keywordToken === 93 && node.name.text === "target") { + if (hierarchyFacts & 8192) { + hierarchyFacts |= 32768; + } + else { + hierarchyFacts |= 16384; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } + function onEmitNode(hint, node, emitCallback) { if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286, ts.getEmitFlags(node) & 8 + ? 65 | 16 + : 65); + previousOnEmitNode(hint, node, emitCallback); + exitSubtree(ancestorFacts, 0, 0); + return; } - previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; + previousOnEmitNode(hint, node, emitCallback); } function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2) === 0) { @@ -42904,18 +47610,18 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(98); - context.enableEmitNotification(150); - context.enableEmitNotification(149); context.enableEmitNotification(151); + context.enableEmitNotification(150); context.enableEmitNotification(152); + context.enableEmitNotification(153); + context.enableEmitNotification(186); context.enableEmitNotification(185); - context.enableEmitNotification(184); - context.enableEmitNotification(225); + context.enableEmitNotification(227); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } if (ts.isIdentifier(node)) { @@ -42927,7 +47633,7 @@ var ts; if (enabledSubstitutions & 2) { var original = ts.getParseTreeNode(node, ts.isIdentifier); if (original && isNameOfDeclarationWithCollidingName(original)) { - return ts.getGeneratedNameForNode(original); + return ts.setTextRange(ts.getGeneratedNameForNode(original), node); } } return node; @@ -42935,10 +47641,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174: - case 226: - case 229: - case 223: + case 175: + case 228: + case 231: + case 225: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -42957,16 +47663,15 @@ var ts; if (enabledSubstitutions & 2) { var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { - return ts.getGeneratedNameForNode(declaration.name); + return ts.setTextRange(ts.getGeneratedNameForNode(declaration.name), node); } } return node; } function substituteThisKeyword(node) { if (enabledSubstitutions & 1 - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8) { - return ts.createIdentifier("_this", node); + && hierarchyFacts & 16) { + return ts.setTextRange(ts.createIdentifier("_this"), node); } return node; } @@ -42982,11 +47687,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180) { return false; } var callTarget = statementExpression.expression; @@ -42994,7 +47699,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197) { return false; } var expression = callArgument.expression; @@ -43013,18 +47718,65 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); var ts; (function (ts) { - var instructionNames = ts.createMap((_a = {}, - _a[2] = "return", - _a[3] = "break", - _a[4] = "yield", - _a[5] = "yield*", - _a[7] = "endfinally", - _a)); + var OpCode; + (function (OpCode) { + OpCode[OpCode["Nop"] = 0] = "Nop"; + OpCode[OpCode["Statement"] = 1] = "Statement"; + OpCode[OpCode["Assign"] = 2] = "Assign"; + OpCode[OpCode["Break"] = 3] = "Break"; + OpCode[OpCode["BreakWhenTrue"] = 4] = "BreakWhenTrue"; + OpCode[OpCode["BreakWhenFalse"] = 5] = "BreakWhenFalse"; + OpCode[OpCode["Yield"] = 6] = "Yield"; + OpCode[OpCode["YieldStar"] = 7] = "YieldStar"; + OpCode[OpCode["Return"] = 8] = "Return"; + OpCode[OpCode["Throw"] = 9] = "Throw"; + OpCode[OpCode["Endfinally"] = 10] = "Endfinally"; + })(OpCode || (OpCode = {})); + var BlockAction; + (function (BlockAction) { + BlockAction[BlockAction["Open"] = 0] = "Open"; + BlockAction[BlockAction["Close"] = 1] = "Close"; + })(BlockAction || (BlockAction = {})); + var CodeBlockKind; + (function (CodeBlockKind) { + CodeBlockKind[CodeBlockKind["Exception"] = 0] = "Exception"; + CodeBlockKind[CodeBlockKind["With"] = 1] = "With"; + CodeBlockKind[CodeBlockKind["Switch"] = 2] = "Switch"; + CodeBlockKind[CodeBlockKind["Loop"] = 3] = "Loop"; + CodeBlockKind[CodeBlockKind["Labeled"] = 4] = "Labeled"; + })(CodeBlockKind || (CodeBlockKind = {})); + var ExceptionBlockState; + (function (ExceptionBlockState) { + ExceptionBlockState[ExceptionBlockState["Try"] = 0] = "Try"; + ExceptionBlockState[ExceptionBlockState["Catch"] = 1] = "Catch"; + ExceptionBlockState[ExceptionBlockState["Finally"] = 2] = "Finally"; + ExceptionBlockState[ExceptionBlockState["Done"] = 3] = "Done"; + })(ExceptionBlockState || (ExceptionBlockState = {})); + var Instruction; + (function (Instruction) { + Instruction[Instruction["Next"] = 0] = "Next"; + Instruction[Instruction["Throw"] = 1] = "Throw"; + Instruction[Instruction["Return"] = 2] = "Return"; + Instruction[Instruction["Break"] = 3] = "Break"; + Instruction[Instruction["Yield"] = 4] = "Yield"; + Instruction[Instruction["YieldStar"] = 5] = "YieldStar"; + Instruction[Instruction["Catch"] = 6] = "Catch"; + Instruction[Instruction["Endfinally"] = 7] = "Endfinally"; + })(Instruction || (Instruction = {})); + function getInstructionName(instruction) { + switch (instruction) { + case 2: return "return"; + case 3: return "break"; + case 4: return "yield"; + case 5: return "yield*"; + case 7: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -43090,13 +47842,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209: + case 211: return visitDoStatement(node); - case 210: + case 212: return visitWhileStatement(node); - case 218: + case 220: return visitSwitchStatement(node); - case 219: + case 221: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -43104,24 +47856,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); - case 151: case 152: + case 153: return visitAccessorDeclaration(node); - case 205: + case 207: return visitVariableStatement(node); - case 211: + case 213: return visitForStatement(node); - case 212: + case 214: return visitForInStatement(node); - case 215: + case 217: return visitBreakStatement(node); - case 214: - return visitContinueStatement(node); case 216: + return visitContinueStatement(node); + case 218: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -43137,21 +47889,21 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192: - return visitBinaryExpression(node); case 193: + return visitBinaryExpression(node); + case 194: return visitConditionalExpression(node); - case 195: + case 196: return visitYieldExpression(node); - case 175: - return visitArrayLiteralExpression(node); case 176: + return visitArrayLiteralExpression(node); + case 177: return visitObjectLiteralExpression(node); - case 178: - return visitElementAccessExpression(node); case 179: - return visitCallExpression(node); + return visitElementAccessExpression(node); case 180: + return visitCallExpression(node); + case 181: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -43159,9 +47911,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 225: + case 227: return visitFunctionDeclaration(node); - case 184: + case 185: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -43169,8 +47921,8 @@ var ts; } } function visitFunctionDeclaration(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { - node = ts.setOriginalNode(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(undefined, node.modifiers, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -43190,8 +47942,8 @@ var ts; } } function visitFunctionExpression(node) { - if (node.asteriskToken && ts.getEmitFlags(node) & 131072) { - node = ts.setOriginalNode(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body), node), node); + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(undefined, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformGeneratorFunctionBody(node.body)), node), node); } else { var savedInGeneratorFunctionBody = inGeneratorFunctionBody; @@ -43243,7 +47995,7 @@ var ts; operationLocations = undefined; state = ts.createTempVariable(undefined); resumeLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, body.statements, false, visitor); + var statementOffset = ts.addPrologue(statements, body.statements, false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); ts.addRange(statements, endLexicalEnvironment()); @@ -43261,7 +48013,7 @@ var ts; operationArguments = savedOperationArguments; operationLocations = savedOperationLocations; state = savedState; - return ts.createBlock(statements, body, body.multiLine); + return ts.setTextRange(ts.createBlock(statements, body.multiLine), body); } function visitVariableStatement(node) { if (node.transformFlags & 16777216) { @@ -43318,10 +48070,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177: + case 178: target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178: + case 179: target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -43330,7 +48082,7 @@ var ts; } var operator = node.operatorToken.kind; if (isCompoundAssignment(operator)) { - return ts.createBinary(target, 57, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node); + return ts.setTextRange(ts.createAssignment(target, ts.setTextRange(ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node); } else { return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression)); @@ -43346,10 +48098,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -43405,38 +48157,43 @@ var ts; var resumeLabel = defineLabel(); var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (node.asteriskToken) { - emitYieldStar(expression, node); + var iterator = (ts.getEmitFlags(node.expression) & 4194304) === 0 + ? ts.createValuesHelper(context, expression, node) + : expression; + emitYieldStar(iterator, node); } else { emitYield(expression, node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(node); } function visitArrayLiteralExpression(node) { return visitElements(node.elements, undefined, undefined, node.multiLine); } function visitElements(elements, leadingElement, location, multiLine) { var numInitialElements = countInitialNodesWithoutYield(elements); - var temp = declareLocal(); - var hasAssignedTemp = false; + var temp; if (numInitialElements > 0) { + temp = declareLocal(); var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); emitAssignment(temp, ts.createArrayLiteral(leadingElement ? [leadingElement].concat(initialElements) : initialElements)); leadingElement = undefined; - hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); - return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); + return temp + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.setTextRange(ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine), location); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { + var hasAssignedTemp = temp !== undefined; + if (!temp) { + temp = declareLocal(); + } emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, undefined, multiLine)); - hasAssignedTemp = true; + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine)); leadingElement = undefined; expressions = []; } @@ -43449,7 +48206,7 @@ var ts; var multiLine = node.multiLine; var numInitialProperties = countInitialNodesWithoutYield(properties); var temp = declareLocal(); - emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, multiLine)); + emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), multiLine)); var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties); expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); return ts.inlineExpressions(expressions); @@ -43471,10 +48228,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -43488,7 +48245,7 @@ var ts; function visitNewExpression(node) { if (ts.forEach(node.arguments, containsYield)) { var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, [], node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, ts.createVoidZero())), undefined, []), node), node); } return ts.visitEachChild(node, visitor, context); } @@ -43517,38 +48274,38 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204: + case 206: return transformAndEmitBlock(node); - case 207: + case 209: return transformAndEmitExpressionStatement(node); - case 208: + case 210: return transformAndEmitIfStatement(node); - case 209: + case 211: return transformAndEmitDoStatement(node); - case 210: + case 212: return transformAndEmitWhileStatement(node); - case 211: + case 213: return transformAndEmitForStatement(node); - case 212: - return transformAndEmitForInStatement(node); case 214: + return transformAndEmitForInStatement(node); + case 216: return transformAndEmitContinueStatement(node); - case 215: + case 217: return transformAndEmitBreakStatement(node); - case 216: + case 218: return transformAndEmitReturnStatement(node); - case 217: + case 219: return transformAndEmitWithStatement(node); - case 218: + case 220: return transformAndEmitSwitchStatement(node); - case 219: + case 221: return transformAndEmitLabeledStatement(node); - case 220: + case 222: return transformAndEmitThrowStatement(node); - case 221: + case 223: return transformAndEmitTryStatement(node); default: - return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); + return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); } } function transformAndEmitBlock(node) { @@ -43565,7 +48322,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -43595,7 +48354,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -43674,7 +48433,7 @@ var ts; transformAndEmitVariableDeclarationList(initializer); } else { - emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), initializer)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer)); } } markLabel(conditionLabel); @@ -43684,7 +48443,7 @@ var ts; transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); if (node.incrementor) { - emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), node.incrementor)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor)); } emitBreak(conditionLabel); endLoopBlock(); @@ -43698,7 +48457,7 @@ var ts; beginScriptLoopBlock(); } var initializer = node.initializer; - if (ts.isVariableDeclarationList(initializer)) { + if (initializer && ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name); @@ -43706,7 +48465,7 @@ var ts; var variables = ts.getInitializedVariables(initializer); node = ts.updateFor(node, variables.length > 0 ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable)) - : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, true), ts.visitNode(node.incrementor, visitor, ts.isExpression, true), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock)); + : undefined, ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -43764,7 +48523,7 @@ var ts; var variable = _a[_i]; hoistVariableDeclaration(variable.name); } - node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock)); + node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -43803,10 +48562,10 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitReturnStatement(node) { - emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node); + emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node); } function visitReturnStatement(node) { - return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, true), node); + return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression), node); } function transformAndEmitWithStatement(node) { if (containsYield(node)) { @@ -43829,7 +48588,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 && defaultClauseIndex === -1) { + if (clause.kind === 257 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -43839,7 +48598,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253) { + if (clause.kind === 256) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -43941,9 +48700,9 @@ var ts; } return -1; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1) { return substituteExpression(node); } return node; @@ -43955,17 +48714,17 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_38) { - var clone_6 = ts.getMutableClone(name_38); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -43974,7 +48733,7 @@ var ts; } function cacheExpression(node) { var temp; - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.getEmitFlags(node) & 4096) { return node; } temp = ts.createTempVariable(hoistVariableDeclaration); @@ -44066,15 +48825,22 @@ var ts; } function beginCatchBlock(variable) { ts.Debug.assert(peekBlockKind() === 0); - var text = variable.name.text; - var name = declareLocal(text); - if (!renamedCatchVariables) { - renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); - context.enableSubstitution(70); + var name; + if (ts.isGeneratedIdentifier(variable.name)) { + name = variable.name; + hoistVariableDeclaration(variable.name); + } + else { + var text = variable.name.text; + name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = ts.createMap(); + renamedCatchVariableDeclarations = []; + context.enableSubstitution(70); + } + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; } - renamedCatchVariables[text] = true; - renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1); var endLabel = exception.endLabel; @@ -44274,23 +49040,23 @@ var ts; } function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + ts.addSyntheticTrailingComment(literal, 3, getInstructionName(instruction)); return literal; } function createInlineBreak(label, location) { ts.Debug.assert(label > 0, "Invalid label: " + label); - return ts.createReturn(ts.createArrayLiteral([ + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), location); + ])), location); } function createInlineReturn(expression, location) { - return ts.createReturn(ts.createArrayLiteral(expression + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), location); + : [createInstruction(2)])), location); } function createGeneratorResume(location) { - return ts.createCall(ts.createPropertyAccess(state, "sent"), undefined, [], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(state, "sent"), undefined, []), location); } function emitNop() { emitWorker(0); @@ -44356,7 +49122,7 @@ var ts; currentExceptionBlock = undefined; withBlockStack = undefined; var buildResult = buildStatements(); - return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, undefined, buildResult.length > 0)), 262144)); + return createGeneratorHelper(context, ts.setEmitFlags(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, state)], undefined, ts.createBlock(buildResult, buildResult.length > 0)), 262144)); } function buildStatements() { if (operations) { @@ -44565,51 +49331,51 @@ var ts; } } function writeAssign(left, right, operationLocation) { - writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation)); + writeStatement(ts.setTextRange(ts.createStatement(ts.createAssignment(left, right)), operationLocation)); } function writeThrow(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createThrow(expression, operationLocation)); + writeStatement(ts.setTextRange(ts.createThrow(expression), operationLocation)); } function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), operationLocation)); + : [createInstruction(2)])), operationLocation), 384)); } function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation)); + ])), operationLocation), 384)); } function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384)), 1)); } function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384)), 1)); } function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4), expression] - : [createInstruction(4)]), operationLocation)); + : [createInstruction(4)])), operationLocation), 384)); } function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(5), expression - ]), operationLocation)); + ])), operationLocation), 384)); } function writeEndfinally() { lastOperationWasAbrupt = true; @@ -44627,23 +49393,47 @@ var ts; name: "typescript:generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); var ts; (function (ts) { function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(250); + context.enableEmitNotification(251); + context.enableEmitNotification(249); + noSubstitution = []; + } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177); - context.enableSubstitution(257); + context.enableSubstitution(178); + context.enableSubstitution(260); return transformSourceFile; function transformSourceFile(node) { return node; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); + function onEmitNode(hint, node, emitCallback) { + switch (node.kind) { + case 250: + case 251: + case 249: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(hint, node, emitCallback); + } + function onSubstituteNode(hint, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(hint, node); + } + node = previousOnSubstituteNode(hint, node); if (ts.isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); } @@ -44655,7 +49445,7 @@ var ts; function substitutePropertyAccessExpression(node) { var literalName = trySubstituteReservedName(node.name); if (literalName) { - return ts.createElementAccess(node.expression, literalName, node); + return ts.setTextRange(ts.createElementAccess(node.expression, literalName), node); } return node; } @@ -44669,7 +49459,7 @@ var ts; function trySubstituteReservedName(name) { var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); if (token >= 71 && token <= 106) { - return ts.createLiteral(name, name); + return ts.setTextRange(ts.createLiteral(name), name); } return undefined; } @@ -44679,12 +49469,13 @@ var ts; var ts; (function (ts) { function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); @@ -44696,40 +49487,49 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableSubstitution(258); - context.enableEmitNotification(261); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); + context.enableSubstitution(192); + context.enableSubstitution(261); + context.enableEmitNotification(264); + var moduleInfoMap = []; + var deferredExports = []; var currentSourceFile; var currentModuleInfo; var noSubstitution; return transformSourceFile; function transformSourceFile(node) { - if (ts.isDeclarationFile(node) - || !(ts.isExternalModule(node) - || compilerOptions.isolatedModules)) { + if (ts.isDeclarationFile(node) || !(ts.isExternalModule(node) || compilerOptions.isolatedModules)) { return node; } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + var transformModule = getTransformModuleDelegate(moduleKind); var updated = transformModule(node); currentSourceFile = undefined; currentModuleInfo = undefined; return ts.aggregateTransformFlags(updated); } + function shouldEmitUnderscoreUnderscoreESModule() { + if (!currentModuleInfo.exportEquals && ts.isExternalModule(currentSourceFile)) { + return true; + } + return false; + } function transformCommonJSModule(node) { startLexicalEnvironment(); var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); + } + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, false); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + ts.addRange(statements, endLexicalEnvironment()); + var updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { ts.addEmitHelper(updated, exportStarHelper); } @@ -44738,15 +49538,8 @@ var ts; function transformAMDModule(node) { var define = ts.createIdentifier("define"); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, true); - } - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, undefined, false); - } - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; - return ts.updateSourceFileNode(node, ts.createNodeArray([ + var _a = collectAsynchronousDependencies(node, true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([ ts.createArrayLiteral([ ts.createLiteral("require"), @@ -44757,7 +49550,37 @@ var ts; ts.createParameter(undefined, undefined, undefined, "exports") ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) ]))) - ], node.statements)); + ]), node.statements)); + } + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, "factory")], undefined, ts.setTextRange(ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement(undefined, [ + ts.createVariableDeclaration("v", undefined, ts.createCall(ts.createIdentifier("factory"), undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], true), undefined)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, undefined, [ + ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, "require"), + ts.createParameter(undefined, undefined, undefined, "exports") + ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) + ])) + ]), node.statements)); } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { var aliasedModuleNames = []; @@ -44777,13 +49600,15 @@ var ts; var importNode = _c[_b]; var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); - if (includeNonAmdDependencies && importAliasName) { - ts.setEmitFlags(importAliasName, 4); - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); - } - else { - unaliasedModuleNames.push(externalModuleName); + if (externalModuleName) { + if (includeNonAmdDependencies && importAliasName) { + ts.setEmitFlags(importAliasName, 4); + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(ts.createParameter(undefined, undefined, undefined, importAliasName)); + } + else { + unaliasedModuleNames.push(externalModuleName); + } } } return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; @@ -44791,12 +49616,15 @@ var ts; function transformAsynchronousModuleBody(node) { startLexicalEnvironment(); var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true)); + var statementOffset = ts.addPrologue(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); + } + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, true); - var body = ts.createBlock(statements, undefined, true); + ts.addRange(statements, endLexicalEnvironment()); + var body = ts.createBlock(statements, true); if (currentModuleInfo.hasExportStarsToExportValues) { ts.addEmitHelper(body, exportStarHelper); } @@ -44805,12 +49633,14 @@ var ts; function addExportEqualsIfNeeded(statements, emitAsReturn) { if (currentModuleInfo.exportEquals) { if (emitAsReturn) { - var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, currentModuleInfo.exportEquals); + var statement = ts.createReturn(currentModuleInfo.exportEquals.expression); + ts.setTextRange(statement, currentModuleInfo.exportEquals); ts.setEmitFlags(statement, 384 | 1536); statements.push(statement); } else { - var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), currentModuleInfo.exportEquals); + var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression)); + ts.setTextRange(statement, currentModuleInfo.exportEquals); ts.setEmitFlags(statement, 1536); statements.push(statement); } @@ -44818,23 +49648,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 241: + case 243: return visitExportDeclaration(node); - case 240: + case 242: return visitExportAssignment(node); - case 205: + case 207: return visitVariableStatement(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 226: + case 228: return visitClassDeclaration(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return node; @@ -44845,7 +49675,7 @@ var ts; var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (moduleKind !== ts.ModuleKind.AMD) { if (!node.importClause) { - return ts.createStatement(createRequireCall(node), node); + return ts.setTextRange(ts.createStatement(createRequireCall(node)), node); } else { var variables = []; @@ -44858,13 +49688,13 @@ var ts; variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node))); } } - statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, undefined, languageVersion >= 2 ? 2 : 0), node)); + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(variables, languageVersion >= 2 ? 2 : 0)), node)); } } else if (namespaceDeclaration && ts.isDefaultImport(node)) { statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node), node) - ], undefined, languageVersion >= 2 ? 2 : 0))); + ts.setTextRange(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), undefined, ts.getGeneratedNameForNode(node)), node) + ], languageVersion >= 2 ? 2 : 0))); } if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); @@ -44888,17 +49718,17 @@ var ts; var statements; if (moduleKind !== ts.ModuleKind.AMD) { if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(node.name, createRequireCall(node))), node)); } else { - statements = ts.append(statements, ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), undefined, createRequireCall(node)) - ], undefined, languageVersion >= 2 ? 2 : 0), node)); + ], languageVersion >= 2 ? 2 : 0)), node)); } } else { if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node))), node)); } } if (hasAssociatedEndOfDeclarationMarker(node)) { @@ -44918,23 +49748,23 @@ var ts; if (node.exportClause) { var statements = []; if (moduleKind !== ts.ModuleKind.AMD) { - statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + statements.push(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(generatedName, undefined, createRequireCall(node)) - ]), node)); + ])), node)); } for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); - statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), specifier)); + statements.push(ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue)), specifier)); } return ts.singleOrMany(statements); } else { - return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [ + return ts.setTextRange(ts.createStatement(ts.createCall(ts.createIdentifier("__export"), undefined, [ moduleKind !== ts.ModuleKind.AMD ? createRequireCall(node) : generatedName - ]), node); + ])), node); } } function visitExportAssignment(node) { @@ -44955,7 +49785,7 @@ var ts; function visitFunctionDeclaration(node) { var statements; if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body, node), node)); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, node.parameters, undefined, node.body), node), node)); } else { statements = ts.append(statements, node); @@ -44972,7 +49802,7 @@ var ts; function visitClassDeclaration(node) { var statements; if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members, node), node)); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, node.heritageClauses, node.members), node), node)); } else { statements = ts.append(statements, node); @@ -45008,7 +49838,7 @@ var ts; statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); } if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } } else { @@ -45028,11 +49858,11 @@ var ts; return ts.flattenDestructuringAssignment(node, undefined, context, 0, false, createExportExpression); } else { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, node.name), node.initializer); + return ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name), node.name), node.initializer); } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -45064,10 +49894,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45125,7 +49955,7 @@ var ts; } function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -45135,28 +49965,28 @@ var ts; return statements; } function appendExportStatement(statements, exportName, expression, location, allowComments) { - if (exportName.text === "default") { - var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 0) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); - } - else { - statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ - ts.createIdentifier("exports"), - ts.createLiteral("__esModule"), - ts.createObjectLiteral([ - ts.createPropertyAssignment("value", ts.createLiteral(true)) - ]) - ]))); - } - } - } statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); return statements; } + function createUnderscoreUnderscoreESModule() { + var statement; + if (languageVersion === 0) { + statement = ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true))); + } + else { + statement = ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ + ts.createIdentifier("exports"), + ts.createLiteral("__esModule"), + ts.createObjectLiteral([ + ts.createPropertyAssignment("value", ts.createLiteral(true)) + ]) + ])); + } + ts.setEmitFlags(statement, 524288); + return statement; + } function createExportStatement(name, value, location, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value), location); + var statement = ts.setTextRange(ts.createStatement(createExportExpression(name, value)), location); ts.startOnNewLine(statement); if (!allowComments) { ts.setEmitFlags(statement, 1536); @@ -45164,7 +49994,7 @@ var ts; return statement; } function createExportExpression(name, value, location) { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value, location); + return ts.setTextRange(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value), location); } function modifierVisitor(node) { switch (node.kind) { @@ -45174,26 +50004,26 @@ var ts; } return node; } - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); - previousOnEmitNode(emitContext, node, emitCallback); + noSubstitution = []; + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; currentModuleInfo = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); if (node.id && noSubstitution[node.id]) { return node; } - if (emitContext === 1) { + if (hint === 1) { return substituteExpression(node); } else if (ts.isShorthandPropertyAssignment(node)) { @@ -45207,9 +50037,9 @@ var ts; if (exportedOrImportedName !== name) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name, initializer, node); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); } - return ts.createPropertyAssignment(name, exportedOrImportedName, node); + return ts.setTextRange(ts.createPropertyAssignment(name, exportedOrImportedName), node); } return node; } @@ -45217,10 +50047,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); + case 192: case 191: - case 190: return substituteUnaryExpression(node); } return node; @@ -45235,17 +50065,17 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261) { - return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); + if (exportContainer && exportContainer.kind === 264) { + return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_39 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), node); + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name)), node); } } } @@ -45278,8 +50108,8 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 - ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1), node) + var expression = node.kind === 192 + ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 42 ? 58 : 59), ts.createLiteral(1)), node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { var exportName = exportedNames_2[_i]; @@ -45301,7 +50131,6 @@ var ts; } } } - var _a; } ts.transformModule = transformModule; var exportStarHelper = { @@ -45309,7 +50138,6 @@ var ts; scoped: true, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }; - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -45323,14 +50151,14 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(70); - context.enableSubstitution(192); - context.enableSubstitution(190); + context.enableSubstitution(193); context.enableSubstitution(191); - context.enableEmitNotification(261); - var moduleInfoMap = ts.createMap(); - var deferredExports = ts.createMap(); - var exportFunctionsMap = ts.createMap(); - var noSubstitutionMap = ts.createMap(); + context.enableSubstitution(192); + context.enableEmitNotification(264); + var moduleInfoMap = []; + var deferredExports = []; + var exportFunctionsMap = []; + var noSubstitutionMap = []; var currentSourceFile; var moduleInfo; var exportFunction; @@ -45349,7 +50177,8 @@ var ts; currentSourceFile = node; enclosingBlockScopedContainer = node; moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; contextObject = ts.createUniqueName("context"); var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); @@ -45359,11 +50188,11 @@ var ts; ], undefined, moduleBodyBlock); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName ? [moduleName, dependencies, moduleBodyFunction] : [dependencies, moduleBodyFunction])) - ], node.statements)); + ]), node.statements)), 1024); if (!(compilerOptions.outFile || compilerOptions.out)) { ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); } @@ -45385,17 +50214,19 @@ var ts; for (var i = 0; i < externalImports.length; i++) { var externalImport = externalImports[i]; var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); - var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].externalImports.push(externalImport); - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push({ - name: externalModuleName, - externalImports: [externalImport] - }); + if (externalModuleName) { + var text = externalModuleName.text; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { + dependencyGroups[groupIndex].externalImports.push(externalImport); + } + else { + groupIndices.set(text, dependencyGroups.length); + dependencyGroups.push({ + name: externalModuleName, + externalImports: [externalImport] + }); + } } } return dependencyGroups; @@ -45403,30 +50234,33 @@ var ts; function createSystemModuleBody(node, dependencyGroups) { var statements = []; startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("__moduleName", undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) ]))); - ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, true); + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement); var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); ts.addRange(statements, hoistedStatements); ts.addRange(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); - statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([ + var moduleObject = ts.createObjectLiteral([ ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), - ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, undefined, true))) - ]), true))); - return ts.createBlock(statements, undefined, true); + ts.createPropertyAssignment("execute", ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock(executeStatements, true))) + ]); + moduleObject.multiLine = true; + statements.push(ts.createReturn(moduleObject)); + return ts.createBlock(statements, true); } function addExportStarIfNeeded(statements) { if (!moduleInfo.hasExportStarsToExportValues) { return; } - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 241 && externalImport.exportClause) { + if (externalImport.kind === 243 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -45444,12 +50278,12 @@ var ts; if (exportedLocalName.text === "default") { continue; } - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true))); + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createTrue())); } } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 241) { + if (externalImport.kind !== 243) { continue; } var exportDecl = externalImport; @@ -45458,12 +50292,12 @@ var ts; } for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { var element = _g[_f]; - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true))); + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createTrue())); } } var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); statements.push(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, undefined, true)) + ts.createVariableDeclaration(exportedNamesStorageRef, undefined, ts.createObjectLiteral(exportedNames, true)) ]))); var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); statements.push(exportStarFunction); @@ -45488,7 +50322,7 @@ var ts; ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1) ])), ts.createStatement(ts.createCall(exportFunction, undefined, [exports])) - ], undefined, true)); + ], true)); } function createSettersArray(exportStarFunction, dependencyGroups) { var setters = []; @@ -45501,15 +50335,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 235: + case 237: if (!entry.importClause) { break; } - case 234: + case 236: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 241: + case 243: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -45517,7 +50351,7 @@ var ts; var e = _d[_c]; properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); } - statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, undefined, true)]))); + statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, true)]))); } else { statements.push(ts.createStatement(ts.createCall(exportStarFunction, undefined, [parameterName]))); @@ -45525,19 +50359,19 @@ var ts; break; } } - setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, undefined, true))); + setters.push(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, parameterName)], undefined, ts.createBlock(statements, true))); } - return ts.createArrayLiteral(setters, undefined, true); + return ts.createArrayLiteral(setters, true); } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 237: return visitImportDeclaration(node); - case 234: + case 236: return visitImportEqualsDeclaration(node); - case 241: + case 243: return undefined; - case 240: + case 242: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -45586,7 +50420,7 @@ var ts; } function visitFunctionDeclaration(node) { if (ts.hasModifier(node, 1)) { - hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); + hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); } else { hoistedStatements = ts.append(hoistedStatements, node); @@ -45604,7 +50438,7 @@ var ts; var statements; var name = ts.getLocalName(node); hoistVariableDeclaration(name); - statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), node)), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.createAssignment(name, ts.setTextRange(ts.createClassExpression(undefined, node.name, undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement)), node))), node)); if (hasAssociatedEndOfDeclarationMarker(node)) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); @@ -45632,7 +50466,7 @@ var ts; } var statements; if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), node)); + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } if (isMarkedDeclaration) { var id = ts.getOriginalNodeId(node); @@ -45658,7 +50492,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 261 + && (enclosingBlockScopedContainer.kind === 264 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -45676,11 +50510,11 @@ var ts; function createVariableAssignment(name, value, location, isExportedDeclaration) { hoistVariableDeclaration(ts.getSynthesizedClone(name)); return isExportedDeclaration - ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location))) - : preventSubstitution(ts.createAssignment(name, value, location)); + ? createExportExpression(name, preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location))) + : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -45713,10 +50547,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 239: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 240: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45786,7 +50620,7 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; @@ -45815,43 +50649,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 205: + case 207: return visitVariableStatement(node); - case 225: + case 227: return visitFunctionDeclaration(node); - case 226: + case 228: return visitClassDeclaration(node); - case 211: + case 213: return visitForStatement(node); - case 212: + case 214: return visitForInStatement(node); - case 213: + case 215: return visitForOfStatement(node); - case 209: + case 211: return visitDoStatement(node); - case 210: + case 212: return visitWhileStatement(node); - case 219: + case 221: return visitLabeledStatement(node); - case 217: + case 219: return visitWithStatement(node); - case 218: + case 220: return visitSwitchStatement(node); - case 232: + case 234: return visitCaseBlock(node); - case 253: + case 256: return visitCaseClause(node); - case 254: + case 257: return visitDefaultClause(node); - case 221: + case 223: return visitTryStatement(node); - case 256: + case 259: return visitCatchClause(node); - case 204: + case 206: return visitBlock(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -45860,21 +50694,21 @@ var ts; function visitForStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; enclosingBlockScopedContainer = node; - node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); + node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; } function visitForInStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; enclosingBlockScopedContainer = node; - node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; } function visitForOfStatement(node) { var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; enclosingBlockScopedContainer = node; - node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + node = ts.updateForOf(node, node.awaitModifier, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; return node; } @@ -45883,6 +50717,9 @@ var ts; && shouldHoistVariableDeclarationList(node); } function visitForInitializer(node) { + if (!node) { + return node; + } if (shouldHoistForInitializer(node)) { var expressions = void 0; for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { @@ -45896,16 +50733,16 @@ var ts; } } function visitDoStatement(node) { - return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); + return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); } function visitWhileStatement(node) { - return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); } function visitLabeledStatement(node) { - return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); } function visitWithStatement(node) { - return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, false, ts.liftToBlock)); + return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); } function visitSwitchStatement(node) { return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); @@ -45942,7 +50779,7 @@ var ts; } function destructuringVisitor(node) { if (node.transformFlags & 1024 - && node.kind === 192) { + && node.kind === 193) { return visitDestructuringAssignment(node); } else if (node.transformFlags & 2048) { @@ -45959,7 +50796,7 @@ var ts; return ts.visitEachChild(node, destructuringVisitor, context); } function hasExportedReferenceInDestructuringTarget(node) { - if (ts.isAssignmentExpression(node)) { + if (ts.isAssignmentExpression(node, true)) { return hasExportedReferenceInDestructuringTarget(node.left); } else if (ts.isSpreadExpression(node)) { @@ -45979,7 +50816,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261; + return container !== undefined && container.kind === 264; } else { return false; @@ -45993,8 +50830,8 @@ var ts; } return node; } - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -46003,22 +50840,22 @@ var ts; if (noSubstitution) { delete noSubstitutionMap[id]; } - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; moduleInfo = undefined; exportFunction = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); if (isSubstitutionPrevented(node)) { return node; } - if (emitContext === 1) { + if (hint === 1) { return substituteExpression(node); } return node; @@ -46027,10 +50864,10 @@ var ts; switch (node.kind) { case 70: return substituteExpressionIdentifier(node); - case 192: + case 193: return substituteBinaryExpression(node); - case 190: case 191: + case 192: return substituteUnaryExpression(node); } return node; @@ -46047,10 +50884,10 @@ var ts; var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), node); } else if (ts.isImportSpecifier(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name)), node); } } } @@ -46082,14 +50919,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 - ? ts.createPrefix(node.operator, node.operand, node) + var expression = node.kind === 192 + ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 191) { + if (node.kind === 192) { expression = node.operator === 42 ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -46106,7 +50943,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 264) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -46116,7 +50953,7 @@ var ts; } function preventSubstitution(node) { if (noSubstitution === undefined) - noSubstitution = ts.createMap(); + noSubstitution = []; noSubstitution[ts.getNodeId(node)] = true; return node; } @@ -46134,7 +50971,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261); + context.enableEmitNotification(264); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -46146,10 +50983,10 @@ var ts; var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); if (externalHelpersModuleName) { var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements); + var statementOffset = ts.addPrologue(statements, node.statements); ts.append(statements, ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); } else { return ts.visitEachChild(node, visitor, context); @@ -46159,9 +50996,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 234: + case 236: return undefined; - case 240: + case 242: return visitExportAssignment(node); } return node; @@ -46169,19 +51006,19 @@ var ts; function visitExportAssignment(node) { return node.isExportEquals ? undefined : node; } - function onEmitNode(emitContext, node, emitCallback) { + function onEmitNode(hint, node, emitCallback) { if (ts.isSourceFile(node)) { currentSourceFile = node; - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isIdentifier(node) && emitContext === 1) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (ts.isIdentifier(node) && hint === 1) { return substituteExpressionIdentifier(node); } return node; @@ -46200,19 +51037,34 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); - function getTransformers(compilerOptions) { + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } + var TransformationState; + (function (TransformationState) { + TransformationState[TransformationState["Uninitialized"] = 0] = "Uninitialized"; + TransformationState[TransformationState["Initialized"] = 1] = "Initialized"; + TransformationState[TransformationState["Completed"] = 2] = "Completed"; + TransformationState[TransformationState["Disposed"] = 3] = "Disposed"; + })(TransformationState || (TransformationState = {})); + var SyntaxKindFeatureFlags; + (function (SyntaxKindFeatureFlags) { + SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; + SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications"; + })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})); + function getTransformers(compilerOptions, customTransformers) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var transformers = []; + ts.addRange(transformers, customTransformers && customTransformers.before); transformers.push(ts.transformTypeScript); if (jsx === 2) { transformers.push(ts.transformJsx); @@ -46230,16 +51082,16 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); if (languageVersion < 1) { transformers.push(ts.transformES5); } + ts.addRange(transformers, customTransformers && customTransformers.after); return transformers; } ts.getTransformers = getTransformers; - function transformFiles(resolver, host, sourceFiles, transformers) { + function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { var enabledSyntaxKindFeatures = new Array(298); - var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -46247,8 +51099,11 @@ var ts; var lexicalEnvironmentStackOffset = 0; var lexicalEnvironmentSuspended = false; var emitHelpers; + var onSubstituteNode = function (_, node) { return node; }; + var onEmitNode = function (hint, node, callback) { return callback(hint, node); }; + var state = 0; var context = { - getCompilerOptions: function () { return host.getCompilerOptions(); }, + getCompilerOptions: function () { return options; }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, startLexicalEnvironment: startLexicalEnvironment, @@ -46259,65 +51114,77 @@ var ts; hoistFunctionDeclaration: hoistFunctionDeclaration, requestEmitHelper: requestEmitHelper, readEmitHelpers: readEmitHelpers, - onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, - isSubstitutionEnabled: isSubstitutionEnabled, - onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); }, enableEmitNotification: enableEmitNotification, - isEmitNotificationEnabled: isEmitNotificationEnabled + isSubstitutionEnabled: isSubstitutionEnabled, + isEmitNotificationEnabled: isEmitNotificationEnabled, + get onSubstituteNode() { return onSubstituteNode; }, + set onSubstituteNode(value) { + ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onSubstituteNode = value; + }, + get onEmitNode() { return onEmitNode; }, + set onEmitNode(value) { + ts.Debug.assert(state < 1, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onEmitNode = value; + } }; + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + ts.performance.mark("beforeTransform"); var transformation = ts.chain.apply(void 0, transformers)(context); - var transformed = ts.map(sourceFiles, transformSourceFile); - lexicalEnvironmentDisabled = true; + state = 1; + var transformed = ts.map(nodes, allowDtsFiles ? transformation : transformRoot); + state = 2; + ts.performance.mark("afterTransform"); + ts.performance.measure("transformTime", "beforeTransform", "afterTransform"); return { transformed: transformed, - emitNodeWithSubstitution: emitNodeWithSubstitution, - emitNodeWithNotification: emitNodeWithNotification + substituteNode: substituteNode, + emitNodeWithNotification: emitNodeWithNotification, + dispose: dispose }; - function transformSourceFile(sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return sourceFile; - } - return transformation(sourceFile); + function transformRoot(node) { + return node && (!ts.isSourceFile(node) || !ts.isDeclarationFile(node)) ? transformation(node) : node; } function enableSubstitution(kind) { + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 1; } function isSubstitutionEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 1) !== 0 && (ts.getEmitFlags(node) & 4) === 0; } - function emitNodeWithSubstitution(emitContext, node, emitCallback) { - if (node) { - if (isSubstitutionEnabled(node)) { - var substitute = context.onSubstituteNode(emitContext, node); - if (substitute && substitute !== node) { - emitCallback(emitContext, substitute); - return; - } - } - emitCallback(emitContext, node); - } + function substituteNode(hint, node) { + ts.Debug.assert(state < 3, "Cannot substitute a node after the result is disposed."); + return node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node; } function enableEmitNotification(kind) { + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 2; } function isEmitNotificationEnabled(node) { return (enabledSyntaxKindFeatures[node.kind] & 2) !== 0 || (ts.getEmitFlags(node) & 2) !== 0; } - function emitNodeWithNotification(emitContext, node, emitCallback) { + function emitNodeWithNotification(hint, node, emitCallback) { + ts.Debug.assert(state < 3, "Cannot invoke TransformationResult callbacks after the result is disposed."); if (node) { if (isEmitNotificationEnabled(node)) { - context.onEmitNode(emitContext, node, emitCallback); + onEmitNode(hint, node, emitCallback); } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } } } function hoistVariableDeclaration(name) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); var decl = ts.createVariableDeclaration(name); if (!lexicalEnvironmentVariableDeclarations) { lexicalEnvironmentVariableDeclarations = [decl]; @@ -46327,7 +51194,8 @@ var ts; } } function hoistFunctionDeclaration(func) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); if (!lexicalEnvironmentFunctionDeclarations) { lexicalEnvironmentFunctionDeclarations = [func]; } @@ -46336,7 +51204,8 @@ var ts; } } function startLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); lexicalEnvironmentVariableDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentVariableDeclarations; lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; @@ -46345,17 +51214,20 @@ var ts; lexicalEnvironmentFunctionDeclarations = undefined; } function suspendLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); lexicalEnvironmentSuspended = true; } function resumeLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); lexicalEnvironmentSuspended = false; } function endLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { @@ -46382,33 +51254,52 @@ var ts; return statements; } function requestEmitHelper(helper) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); emitHelpers = ts.append(emitHelpers, helper); } function readEmitHelpers() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2, "Cannot modify the transformation context after transformation has completed."); var helpers = emitHelpers; emitHelpers = undefined; return helpers; } + function dispose() { + if (state < 3) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentVariableDeclarationsStack = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + lexicalEnvironmentFunctionDeclarationsStack = undefined; + onSubstituteNode = undefined; + onEmitNode = undefined; + emitHelpers = undefined; + state = 3; + } + } } - ts.transformFiles = transformFiles; - var _a; + ts.transformNodes = transformNodes; })(ts || (ts = {})); var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + function getDeclarationDiagnosticsFromFile(_a, sourceFileOrBundle) { var declarationFilePath = _a.declarationFilePath; - emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, false); + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sourceFileOrBundle, false); } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { + var sourceFiles = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 265; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -46470,7 +51361,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235); + ts.Debug.assert(aliasEmitInfo.node.kind === 237); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -46493,9 +51384,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -46520,12 +51411,14 @@ var ts; var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.reportIllegalExtends = reportIllegalExtends; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -46541,10 +51434,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223) { + if (declaration.kind === 225) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) { + else if (declaration.kind === 240 || declaration.kind === 241 || declaration.kind === 238) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -46555,7 +51448,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235) { + if (moduleElementEmitInfo.node.kind === 237) { moduleElementEmitInfo.isVisible = true; } else { @@ -46563,12 +51456,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 232) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 232) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -46587,8 +51480,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -46615,6 +51508,12 @@ var ts; handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true)); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } + function reportIllegalExtends() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, ts.declarationNameToString(errorNameNode))); + } + } function reportInaccessibleThisError() { if (errorNameNode) { reportedDeclarationError = true; @@ -46624,12 +51523,16 @@ var ts; function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); - if (type) { + var shouldUseResolverType = declaration.kind === 145 && + resolver.isRequiredInitializedParameter(declaration); + if (type && !shouldUseResolverType) { emitType(type); } else { errorNameNode = declaration.name; - resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer); + var format = 2 | 1024 | + (shouldUseResolverType ? 4096 : 0); + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, format, writer); errorNameNode = undefined; } } @@ -46646,15 +51549,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { - var node = nodes_4[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var node = nodes_6[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -46681,49 +51584,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118: - case 134: + case 135: case 132: case 121: - case 135: + case 133: + case 136: case 104: - case 137: + case 138: case 94: case 129: - case 167: - case 171: + case 168: + case 172: return writeTextOfNode(currentText, type); - case 199: + case 200: return emitExpressionWithTypeArguments(type); - case 157: + case 158: return emitTypeReference(type); - case 160: + case 161: return emitTypeQuery(type); - case 162: - return emitArrayType(type); case 163: - return emitTupleType(type); + return emitArrayType(type); case 164: - return emitUnionType(type); + return emitTupleType(type); case 165: - return emitIntersectionType(type); + return emitUnionType(type); case 166: + return emitIntersectionType(type); + case 167: return emitParenType(type); - case 168: - return emitTypeOperator(type); case 169: - return emitIndexedAccessType(type); + return emitTypeOperator(type); case 170: + return emitIndexedAccessType(type); + case 171: return emitMappedType(type); - case 158: case 159: + case 160: return emitSignatureDeclarationWithJsDocComments(type); - case 161: + case 162: return emitTypeLiteral(type); case 70: return emitEntityName(type); - case 141: + case 142: return emitEntityName(type); - case 156: + case 157: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -46731,22 +51635,22 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 ? entityName.left : entityName.expression; - var right = entityName.kind === 141 ? entityName.right : entityName.name; + var left = entityName.kind === 142 ? entityName.left : entityName.expression; + var right = entityName.kind === 142 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 236 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 177); + ts.Debug.assert(node.expression.kind === 70 || node.expression.kind === 178); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -46850,15 +51754,15 @@ var ts; } function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_40 = baseName + "_" + count; - if (!(name_40 in currentIdentifiers)) { - return name_40; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -46902,10 +51806,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 || - (node.parent.kind === 261 && isCurrentFileExternalModule)) { + else if (node.kind === 236 || + (node.parent.kind === 264 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 264) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -46914,7 +51818,7 @@ var ts; }); } else { - if (node.kind === 235) { + if (node.kind === 237) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -46932,30 +51836,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225: + case 227: return writeFunctionDeclaration(node); - case 205: + case 207: return writeVariableStatement(node); - case 227: + case 229: return writeInterfaceDeclaration(node); - case 226: - return writeClassDeclaration(node); case 228: + return writeClassDeclaration(node); + case 230: return writeTypeAliasDeclaration(node); - case 229: + case 231: return writeEnumDeclaration(node); - case 230: + case 232: return writeModuleDeclaration(node); - case 234: + case 236: return writeImportEqualsDeclaration(node); - case 235: + case 237: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 261) { + if (node.parent.kind === 264) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -46963,7 +51867,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 227 && !noDeclare) { + else if (node.kind !== 229 && !noDeclare) { write("declare "); } } @@ -47013,7 +51917,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 239) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -47036,7 +51940,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 237) { + if (node.importClause.namedBindings.kind === 239) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -47053,13 +51957,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232; var moduleSpecifier; - if (parent.kind === 234) { + if (parent.kind === 236) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230) { + else if (parent.kind === 232) { moduleSpecifier = parent.name; } else { @@ -47127,7 +52031,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231) { + while (node.body && node.body.kind !== 233) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -47197,7 +52101,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 && ts.hasModifier(node.parent, 8); + return node.parent.kind === 150 && ts.hasModifier(node.parent, 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -47207,52 +52111,69 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - (node.parent.parent && node.parent.parent.kind === 161)) { - ts.Debug.assert(node.parent.kind === 149 || - node.parent.kind === 148 || - node.parent.kind === 158 || + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || node.parent.kind === 159 || - node.parent.kind === 153 || - node.parent.kind === 154); + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } + if (node.default && !isPrivateMethodTypeParameter(node)) { + write(" = "); + if (node.parent.kind === 159 || + node.parent.kind === 160 || + (node.parent.parent && node.parent.parent.kind === 162)) { + ts.Debug.assert(node.parent.kind === 150 || + node.parent.kind === 149 || + node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.kind === 154 || + node.parent.kind === 155); + emitType(node.default); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.default, getTypeParameterConstraintVisibilityError); + } + } function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 226: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154: + case 155: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153: + case 154: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 228) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228: + case 230: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -47271,7 +52192,7 @@ var ts; write(">"); } } - function emitHeritageClause(typeReferences, isImplementsList) { + function emitHeritageClause(className, typeReferences, isImplementsList) { if (typeReferences) { write(isImplementsList ? " implements " : " extends "); emitCommaList(typeReferences, emitTypeOfTypeReference); @@ -47285,17 +52206,19 @@ var ts; } else { writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + errorNameNode = className; resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer); + errorNameNode = undefined; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 226) { + if (node.parent.parent.kind === 228) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { - diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + diagnosticMessage = ts.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -47327,9 +52250,10 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + node.name; + emitHeritageClause(node.name, [baseTypeNode], false); } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); + emitHeritageClause(node.name, ts.getClassImplementsHeritageClauseElements(node), true); write(" {"); writeLine(); increaseIndent(); @@ -47350,7 +52274,7 @@ var ts; emitTypeParameters(node.typeParameters); var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); if (interfaceExtendsTypes && interfaceExtendsTypes.length) { - emitHeritageClause(interfaceExtendsTypes, false); + emitHeritageClause(node.name, interfaceExtendsTypes, false); } write(" {"); writeLine(); @@ -47372,17 +52296,17 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 223 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 147 || node.kind === 146 || - (node.kind === 144 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 || node.kind === 147 || + (node.kind === 145 && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 || node.kind === 146) && node.parent.kind === 161) { + if ((node.kind === 148 || node.kind === 147) && node.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -47395,14 +52319,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223) { + if (node.kind === 225) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 147 || node.kind === 146) { + else if (node.kind === 148 || node.kind === 147) { if (ts.hasModifier(node, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47410,7 +52334,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47436,7 +52360,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198) { + if (element.kind !== 199) { elements.push(element); } } @@ -47502,7 +52426,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 151 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -47515,7 +52439,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 + return accessor.kind === 152 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -47524,7 +52448,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152) { + if (accessorWithTypeAnnotation.kind === 153) { if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -47570,17 +52494,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225) { + if (node.kind === 227) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 || node.kind === 150) { + else if (node.kind === 150 || node.kind === 151) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225) { + if (node.kind === 227) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150) { + else if (node.kind === 151) { write("constructor"); } else { @@ -47600,15 +52524,15 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155) { + if (node.kind === 156) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { - if (node.kind === 154 || node.kind === 159) { + if (node.kind === 155 || node.kind === 160) { write("new "); } - else if (node.kind === 158) { + else if (node.kind === 159) { var currentOutput = writer.getText(); if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { closeParenthesizedFunctionType = true; @@ -47619,20 +52543,20 @@ var ts; write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155) { + if (node.kind === 156) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 158 || node.kind === 159; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161) { + var isFunctionTypeOrConstructorType = node.kind === 159 || node.kind === 160; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 && !ts.hasModifier(node, 8)) { + else if (node.kind !== 151 && !ts.hasModifier(node, 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -47646,23 +52570,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154: + case 155: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 153: + case 154: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 155: + case 156: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; + case 150: case 149: - case 148: if (ts.hasModifier(node, 32)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47670,7 +52594,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 228) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -47683,7 +52607,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225: + case 227: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -47715,9 +52639,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 || - node.parent.kind === 159 || - node.parent.parent.kind === 161) { + if (node.parent.kind === 159 || + node.parent.kind === 160 || + node.parent.parent.kind === 162) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8)) { @@ -47733,22 +52657,26 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150: + case 151: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 154: + case 155: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 153: + case 154: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 156: + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150: case 149: - case 148: if (ts.hasModifier(node.parent, 32)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -47756,7 +52684,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 228) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47768,7 +52696,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 225: + case 227: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47779,12 +52707,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 172) { + if (bindingPattern.kind === 173) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173) { + else if (bindingPattern.kind === 174) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -47795,10 +52723,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198) { + if (bindingElement.kind === 199) { write(" "); } - else if (bindingElement.kind === 174) { + else if (bindingElement.kind === 175) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -47820,39 +52748,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225: - case 230: - case 234: case 227: - case 226: - case 228: + case 232: + case 236: case 229: + case 228: + case 230: + case 231: return emitModuleElement(node, isModuleElementVisible(node)); - case 205: + case 207: return emitModuleElement(node, isVariableStatementVisible(node)); - case 235: + case 237: return emitModuleElement(node, !node.importClause); - case 241: + case 243: return emitExportDeclaration(node); + case 151: case 150: case 149: - case 148: return writeFunctionDeclaration(node); - case 154: - case 153: case 155: + case 154: + case 156: return emitSignatureDeclarationWithJsDocComments(node); - case 151: case 152: + case 153: return emitAccessorDeclaration(node); + case 148: case 147: - case 146: return emitPropertyDeclaration(node); - case 260: + case 263: return emitEnumMemberDeclaration(node); - case 240: + case 242: return emitExportAssignment(node); - case 261: + case 264: return emitSourceFile(node); } } @@ -47863,14 +52791,15 @@ var ts; declFileName = referencedFile.fileName; } else { - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencesOutput += "/// " + newLine; } return addedBundledEmitReference; - function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) { + function getDeclFileName(emitFileNames, sourceFileOrBundle) { + var isBundledEmit = sourceFileOrBundle.kind === 265; if (isBundledEmit && !addBundledFileReference) { return; } @@ -47880,10 +52809,11 @@ var ts; } } } - function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { - var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles); + function writeDeclarationFile(declarationFilePath, sourceFileOrBundle, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { + var sourceFiles = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -47937,7 +52867,7 @@ var ts; getText: getText, getSourceMappingURL: getSourceMappingURL, }; - function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + function initialize(filePath, sourceMapFilePath, sourceFileOrBundle) { if (disabled) { return; } @@ -47968,9 +52898,8 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (!isBundledEmit) { - ts.Debug.assert(sourceFiles.length === 1); - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + if (sourceFileOrBundle.kind === 264) { + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); @@ -48061,28 +52990,28 @@ var ts; ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); } } - function emitNodeWithSourceMap(emitContext, node, emitCallback) { + function emitNodeWithSourceMap(hint, node, emitCallback) { if (disabled) { - return emitCallback(emitContext, node); + return emitCallback(hint, node); } if (node) { var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } if (emitFlags & 64) { disabled = true; - emitCallback(emitContext, node); + emitCallback(hint, node); disabled = false; } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -48131,7 +53060,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -48183,11 +53112,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function createCommentWriter(host, writer, sourceMap) { - var compilerOptions = host.getCompilerOptions(); - var extendedDiagnostics = compilerOptions.extendedDiagnostics; - var newLine = host.getNewLine(); - var emitPos = sourceMap.emitPos; + function createCommentWriter(printerOptions, emitPos) { + var extendedDiagnostics = printerOptions.extendedDiagnostics; + var newLine = ts.getNewLineCharacter(printerOptions); + var writer; var containerPos = -1; var containerEnd = -1; var declarationListContainerEnd = -1; @@ -48196,37 +53124,34 @@ var ts; var currentLineMap; var detachedCommentsInfo; var hasWrittenComment = false; - var disabled = compilerOptions.removeComments; + var disabled = printerOptions.removeComments; return { reset: reset, + setWriter: setWriter, setSourceFile: setSourceFile, emitNodeWithComments: emitNodeWithComments, emitBodyWithDetachedComments: emitBodyWithDetachedComments, emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition, + emitLeadingCommentsOfPosition: emitLeadingCommentsOfPosition, }; - function emitNodeWithComments(emitContext, node, emitCallback) { + function emitNodeWithComments(hint, node, emitCallback) { if (disabled) { - emitCallback(emitContext, node); + emitCallback(hint, node); return; } if (node) { - var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; - var emitFlags = ts.getEmitFlags(node); + hasWrittenComment = false; + var emitNode = node.emitNode; + var emitFlags = emitNode && emitNode.flags; + var _a = emitNode && emitNode.commentRange || node, pos = _a.pos, end = _a.end; if ((pos < 0 && end < 0) || (pos === end)) { - if (emitFlags & 2048) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); } else { if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293; + var isEmittedNode = node.kind !== 294; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -48240,23 +53165,16 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 224) { + if (node.kind === 226) { declarationListContainerEnd = end; } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 2048) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); if (extendedDiagnostics) { - ts.performance.mark("beginEmitNodeWithComment"); + ts.performance.mark("postEmitNodeWithComment"); } containerPos = savedContainerPos; containerEnd = savedContainerEnd; @@ -48265,11 +53183,75 @@ var ts; emitTrailingComments(end); } if (extendedDiagnostics) { - ts.performance.measure("commentTime", "beginEmitNodeWithComment"); + ts.performance.measure("commentTime", "postEmitNodeWithComment"); } } } } + function emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback) { + var leadingComments = emitNode && emitNode.leadingComments; + if (ts.some(leadingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("preEmitNodeWithSynthesizedComments"); + } + ts.forEach(leadingComments, emitLeadingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "preEmitNodeWithSynthesizedComments"); + } + } + emitNodeWithNestedComments(hint, node, emitFlags, emitCallback); + var trailingComments = emitNode && emitNode.trailingComments; + if (ts.some(trailingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("postEmitNodeWithSynthesizedComments"); + } + ts.forEach(trailingComments, emitTrailingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "postEmitNodeWithSynthesizedComments"); + } + } + } + function emitLeadingSynthesizedComment(comment) { + if (comment.kind === 2) { + writer.writeLine(); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine || comment.kind === 2) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + function emitTrailingSynthesizedComment(comment) { + if (!writer.isAtStartOfLine()) { + writer.write(" "); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + } + function writeSynthesizedComment(comment) { + var text = formatSynthesizedComment(comment); + var lineMap = comment.kind === 3 ? ts.computeLineStarts(text) : undefined; + ts.writeCommentRange(text, lineMap, writer, 0, text.length, newLine); + } + function formatSynthesizedComment(comment) { + return comment.kind === 3 + ? "/*" + comment.text + "*/" + : "//" + comment.text; + } + function emitNodeWithNestedComments(hint, node, emitFlags, emitCallback) { + if (emitFlags & 2048) { + disabled = true; + emitCallback(hint, node); + disabled = false; + } + else { + emitCallback(hint, node); + } + } function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { if (extendedDiagnostics) { ts.performance.mark("preEmitBodyWithDetachedComments"); @@ -48297,6 +53279,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -48321,9 +53306,11 @@ var ts; ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos); hasWrittenComment = true; } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -48331,6 +53318,12 @@ var ts; writer.write(" "); } } + function emitLeadingCommentsOfPosition(pos) { + if (disabled || pos === -1) { + return; + } + emitLeadingComments(pos, true); + } function emitTrailingComments(pos) { forEachTrailingCommentToEmit(pos, emitTrailingComment); } @@ -48338,9 +53331,11 @@ var ts; if (!writer.isAtStartOfLine()) { writer.write(" "); } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -48358,9 +53353,11 @@ var ts; } } function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -48389,6 +53386,9 @@ var ts; currentLineMap = undefined; detachedCommentsInfo = undefined; } + function setWriter(output) { + writer = output; + } function setSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = currentSourceFile.text; @@ -48420,9 +53420,11 @@ var ts; } } function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); } function isTripleSlashComment(commentPos, commentEnd) { if (currentText.charCodeAt(commentPos + 1) === 47 && @@ -48440,63 +53442,55 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var id = function (s) { return s; }; - var nullTransformers = [function (_) { return id; }]; - function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { - var delimiters = createDelimiterMap(); - var brackets = createBracketsMap(); + var delimiters = createDelimiterMap(); + var brackets = createBracketsMap(); + function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); var newLine = host.getNewLine(); - var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions); var writer = ts.createTextWriter(newLine); - var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var sourceMap = ts.createSourceMapWriter(host, writer); - var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap; - var comments = ts.createCommentWriter(host, writer, sourceMap); - var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition; - var nodeIdToGeneratedName; - var autoGeneratedIdToGeneratedName; - var generatedNameSet; - var tempFlags; var currentSourceFile; - var currentText; - var currentFileIdentifiers; var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); - ts.performance.mark("beforeTransform"); - var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; - ts.performance.measure("transformTime", "beforeTransform"); + var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, false); + var printer = createPrinter(compilerOptions, { + hasGlobalName: resolver.hasGlobalName, + onEmitNode: transform.emitNodeWithNotification, + substituteNode: transform.substituteNode, + onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, + onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, + onEmitSourceMapOfPosition: sourceMap.emitPos, + onEmitHelpers: emitHelpers, + onSetSourceFile: setSourceFile, + }); ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; - ts.disposeEmitNodes(sourceFile); - } + transform.dispose(); return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitSourceFileOrBundle(_a, sourceFileOrBundle) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { - printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle); } } else { emitSkipped = true; } if (declarationFilePath) { - emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; + emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; } if (!emitSkipped && emittedFilesList) { if (!emitOnlyDtsFiles) { @@ -48510,24 +53504,24 @@ var ts; } } } - function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { - sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); - nodeIdToGeneratedName = []; - autoGeneratedIdToGeneratedName = []; - generatedNameSet = ts.createMap(); - bundledHelpers = isBundledEmit ? ts.createMap() : undefined; - isOwnFileEmit = !isBundledEmit; - if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; - emitHelpers(sourceFile, true); - } + function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { + var bundle = sourceFileOrBundle.kind === 265 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 264 ? sourceFileOrBundle : undefined; + var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); + if (bundle) { + bundledHelpers = ts.createMap(); + isOwnFileEmit = false; + printer.writeBundle(bundle, writer); } - ts.forEach(sourceFiles, printSourceFile); - writeLine(); + else { + isOwnFileEmit = true; + printer.writeFile(sourceFile, writer); + } + writer.writeLine(); var sourceMappingURL = sourceMap.getSourceMappingURL(); if (sourceMappingURL) { - write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); + writer.write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); } if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); @@ -48537,20 +53531,164 @@ var ts; } ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); - comments.reset(); writer.reset(); - tempFlags = 0; currentSourceFile = undefined; - currentText = undefined; + bundledHelpers = undefined; isOwnFileEmit = false; } - function printSourceFile(node) { + function setSourceFile(node) { currentSourceFile = node; - currentText = node.text; - currentFileIdentifiers = node.identifiers; sourceMap.setSourceFile(node); - comments.setSourceFile(node); - pipelineEmitWithNotification(0, node); + } + function emitHelpers(node, writeLines) { + var helpersEmitted = false; + var bundle = node.kind === 265 ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; + } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + if (shouldSkip) + continue; + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + continue; + } + writeLines(helper.text); + helpersEmitted = true; + } + } + } + return helpersEmitted; + } + } + ts.emitFiles = emitFiles; + function createPrinter(printerOptions, handlers) { + if (printerOptions === void 0) { printerOptions = {}; } + if (handlers === void 0) { handlers = {}; } + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray; + var newLine = ts.getNewLineCharacter(printerOptions); + var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); + var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; + var currentSourceFile; + var nodeIdToGeneratedName; + var autoGeneratedIdToGeneratedName; + var generatedNames; + var tempFlagsStack; + var tempFlags; + var writer; + var ownWriter; + reset(); + return { + printNode: printNode, + printFile: printFile, + printBundle: printBundle, + writeNode: writeNode, + writeFile: writeFile, + writeBundle: writeBundle + }; + function printNode(hint, node, sourceFile) { + switch (hint) { + case 0: + ts.Debug.assert(ts.isSourceFile(node), "Expected a SourceFile node."); + break; + case 2: + ts.Debug.assert(ts.isIdentifier(node), "Expected an Identifier node."); + break; + case 1: + ts.Debug.assert(ts.isExpression(node), "Expected an Expression node."); + break; + } + switch (node.kind) { + case 264: return printFile(node); + case 265: return printBundle(node); + } + writeNode(hint, node, sourceFile, beginPrint()); + return endPrint(); + } + function printBundle(bundle) { + writeBundle(bundle, beginPrint()); + return endPrint(); + } + function printFile(sourceFile) { + writeFile(sourceFile, beginPrint()); + return endPrint(); + } + function writeNode(hint, node, sourceFile, output) { + var previousWriter = writer; + setWriter(output); + print(hint, node, sourceFile); + reset(); + writer = previousWriter; + } + function writeBundle(bundle, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(bundle); + emitPrologueDirectivesIfNeeded(bundle); + emitHelpersIndirect(bundle); + for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + print(0, sourceFile, sourceFile); + } + reset(); + writer = previousWriter; + } + function writeFile(sourceFile, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(sourceFile); + emitPrologueDirectivesIfNeeded(sourceFile); + print(0, sourceFile, sourceFile); + reset(); + writer = previousWriter; + } + function beginPrint() { + return ownWriter || (ownWriter = ts.createTextWriter(newLine)); + } + function endPrint() { + var text = ownWriter.getText(); + ownWriter.reset(); + return text; + } + function print(hint, node, sourceFile) { + setSourceFile(sourceFile); + pipelineEmitWithNotification(hint, node); + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + comments.setSourceFile(sourceFile); + if (onSetSourceFile) { + onSetSourceFile(sourceFile); + } + } + function setWriter(output) { + writer = output; + comments.setWriter(output); + } + function reset() { + nodeIdToGeneratedName = []; + autoGeneratedIdToGeneratedName = []; + generatedNames = ts.createMap(); + tempFlagsStack = []; + tempFlags = 0; + comments.reset(); + setWriter(undefined); } function emit(node) { pipelineEmitWithNotification(3, node); @@ -48561,51 +53699,53 @@ var ts; function emitExpression(node) { pipelineEmitWithNotification(1, node); } - function pipelineEmitWithNotification(emitContext, node) { - emitNodeWithNotification(emitContext, node, pipelineEmitWithComments); - } - function pipelineEmitWithComments(emitContext, node) { - if (emitContext === 0) { - pipelineEmitWithSourceMap(emitContext, node); - return; + function pipelineEmitWithNotification(hint, node) { + if (onEmitNode) { + onEmitNode(hint, node, pipelineEmitWithComments); } - emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap); - } - function pipelineEmitWithSourceMap(emitContext, node) { - if (emitContext === 0 - || emitContext === 2) { - pipelineEmitWithSubstitution(emitContext, node); - return; + else { + pipelineEmitWithComments(hint, node); } - emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution); - } - function pipelineEmitWithSubstitution(emitContext, node) { - emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext); } - function pipelineEmitForContext(emitContext, node) { - switch (emitContext) { - case 0: return pipelineEmitInSourceFileContext(node); - case 2: return pipelineEmitInIdentifierNameContext(node); - case 3: return pipelineEmitInUnspecifiedContext(node); - case 1: return pipelineEmitInExpressionContext(node); + function pipelineEmitWithComments(hint, node) { + node = trySubstituteNode(hint, node); + if (emitNodeWithComments && hint !== 0) { + emitNodeWithComments(hint, node, pipelineEmitWithSourceMap); + } + else { + pipelineEmitWithSourceMap(hint, node); } } - function pipelineEmitInSourceFileContext(node) { - var kind = node.kind; - switch (kind) { - case 261: - return emitSourceFile(node); + function pipelineEmitWithSourceMap(hint, node) { + if (onEmitSourceMapOfNode && hint !== 0 && hint !== 2) { + onEmitSourceMapOfNode(hint, node, pipelineEmitWithHint); + } + else { + pipelineEmitWithHint(hint, node); } } - function pipelineEmitInIdentifierNameContext(node) { - var kind = node.kind; - switch (kind) { - case 70: - return emitIdentifier(node); + function pipelineEmitWithHint(hint, node) { + switch (hint) { + case 0: return pipelineEmitSourceFile(node); + case 2: return pipelineEmitIdentifierName(node); + case 1: return pipelineEmitExpression(node); + case 3: return pipelineEmitUnspecified(node); } } - function pipelineEmitInUnspecifiedContext(node) { + function pipelineEmitSourceFile(node) { + ts.Debug.assertNode(node, ts.isSourceFile); + emitSourceFile(node); + } + function pipelineEmitIdentifierName(node) { + ts.Debug.assertNode(node, ts.isIdentifier); + emitIdentifier(node); + } + function pipelineEmitUnspecified(node) { var kind = node.kind; + if (ts.isKeyword(kind)) { + writeTokenText(kind); + return; + } switch (kind) { case 13: case 14: @@ -48613,229 +53753,201 @@ var ts; return emitLiteral(node); case 70: return emitIdentifier(node); - case 75: - case 78: - case 83: - case 104: - case 111: - case 112: - case 113: - case 114: - case 116: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - case 123: - case 124: - case 125: - case 127: - case 128: - case 129: - case 130: - case 131: - case 132: - case 133: - case 134: - case 135: - case 136: - case 137: - case 138: - case 139: - case 140: - writeTokenText(kind); - return; - case 141: - return emitQualifiedName(node); case 142: - return emitComputedPropertyName(node); + return emitQualifiedName(node); case 143: - return emitTypeParameter(node); + return emitComputedPropertyName(node); case 144: - return emitParameter(node); + return emitTypeParameter(node); case 145: - return emitDecorator(node); + return emitParameter(node); case 146: - return emitPropertySignature(node); + return emitDecorator(node); case 147: - return emitPropertyDeclaration(node); + return emitPropertySignature(node); case 148: - return emitMethodSignature(node); + return emitPropertyDeclaration(node); case 149: - return emitMethodDeclaration(node); + return emitMethodSignature(node); case 150: - return emitConstructor(node); + return emitMethodDeclaration(node); case 151: + return emitConstructor(node); case 152: - return emitAccessorDeclaration(node); case 153: - return emitCallSignature(node); + return emitAccessorDeclaration(node); case 154: - return emitConstructSignature(node); + return emitCallSignature(node); case 155: - return emitIndexSignature(node); + return emitConstructSignature(node); case 156: - return emitTypePredicate(node); + return emitIndexSignature(node); case 157: - return emitTypeReference(node); + return emitTypePredicate(node); case 158: - return emitFunctionType(node); + return emitTypeReference(node); case 159: - return emitConstructorType(node); + return emitFunctionType(node); case 160: - return emitTypeQuery(node); + return emitConstructorType(node); case 161: - return emitTypeLiteral(node); + return emitTypeQuery(node); case 162: - return emitArrayType(node); + return emitTypeLiteral(node); case 163: - return emitTupleType(node); + return emitArrayType(node); case 164: - return emitUnionType(node); + return emitTupleType(node); case 165: - return emitIntersectionType(node); + return emitUnionType(node); case 166: + return emitIntersectionType(node); + case 167: return emitParenthesizedType(node); - case 199: + case 200: return emitExpressionWithTypeArguments(node); - case 167: - return emitThisType(); case 168: - return emitTypeOperator(node); + return emitThisType(); case 169: - return emitIndexedAccessType(node); + return emitTypeOperator(node); case 170: - return emitMappedType(node); + return emitIndexedAccessType(node); case 171: - return emitLiteralType(node); + return emitMappedType(node); case 172: - return emitObjectBindingPattern(node); + return emitLiteralType(node); case 173: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 174: + return emitArrayBindingPattern(node); + case 175: return emitBindingElement(node); - case 202: + case 204: return emitTemplateSpan(node); - case 203: + case 205: return emitSemicolonClassElement(); - case 204: + case 206: return emitBlock(node); - case 205: + case 207: return emitVariableStatement(node); - case 206: + case 208: return emitEmptyStatement(); - case 207: + case 209: return emitExpressionStatement(node); - case 208: + case 210: return emitIfStatement(node); - case 209: + case 211: return emitDoStatement(node); - case 210: + case 212: return emitWhileStatement(node); - case 211: + case 213: return emitForStatement(node); - case 212: + case 214: return emitForInStatement(node); - case 213: + case 215: return emitForOfStatement(node); - case 214: + case 216: return emitContinueStatement(node); - case 215: + case 217: return emitBreakStatement(node); - case 216: + case 218: return emitReturnStatement(node); - case 217: + case 219: return emitWithStatement(node); - case 218: + case 220: return emitSwitchStatement(node); - case 219: + case 221: return emitLabeledStatement(node); - case 220: + case 222: return emitThrowStatement(node); - case 221: + case 223: return emitTryStatement(node); - case 222: + case 224: return emitDebuggerStatement(node); - case 223: + case 225: return emitVariableDeclaration(node); - case 224: + case 226: return emitVariableDeclarationList(node); - case 225: + case 227: return emitFunctionDeclaration(node); - case 226: + case 228: return emitClassDeclaration(node); - case 227: + case 229: return emitInterfaceDeclaration(node); - case 228: + case 230: return emitTypeAliasDeclaration(node); - case 229: + case 231: return emitEnumDeclaration(node); - case 230: + case 232: return emitModuleDeclaration(node); - case 231: + case 233: return emitModuleBlock(node); - case 232: - return emitCaseBlock(node); case 234: + return emitCaseBlock(node); + case 236: return emitImportEqualsDeclaration(node); - case 235: + case 237: return emitImportDeclaration(node); - case 236: + case 238: return emitImportClause(node); - case 237: + case 239: return emitNamespaceImport(node); - case 238: + case 240: return emitNamedImports(node); - case 239: + case 241: return emitImportSpecifier(node); - case 240: + case 242: return emitExportAssignment(node); - case 241: + case 243: return emitExportDeclaration(node); - case 242: + case 244: return emitNamedExports(node); - case 243: + case 245: return emitExportSpecifier(node); - case 244: + case 246: return; - case 245: + case 247: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 248: + case 250: return emitJsxOpeningElement(node); - case 249: + case 251: return emitJsxClosingElement(node); - case 250: + case 252: return emitJsxAttribute(node); - case 251: + case 253: + return emitJsxAttributes(node); + case 254: return emitJsxSpreadAttribute(node); - case 252: + case 255: return emitJsxExpression(node); - case 253: + case 256: return emitCaseClause(node); - case 254: + case 257: return emitDefaultClause(node); - case 255: + case 258: return emitHeritageClause(node); - case 256: + case 259: return emitCatchClause(node); - case 257: + case 260: return emitPropertyAssignment(node); - case 258: + case 261: return emitShorthandPropertyAssignment(node); - case 259: + case 262: return emitSpreadAssignment(node); - case 260: + case 263: return emitEnumMember(node); } if (ts.isExpression(node)) { - return pipelineEmitWithSubstitution(1, node); + return pipelineEmitExpression(trySubstituteNode(1, node)); + } + if (ts.isToken(node)) { + writeTokenText(kind); + return; } } - function pipelineEmitInExpressionContext(node) { + function pipelineEmitExpression(node) { var kind = node.kind; switch (kind) { case 8: @@ -48853,77 +53965,82 @@ var ts; case 98: writeTokenText(kind); return; - case 175: - return emitArrayLiteralExpression(node); case 176: - return emitObjectLiteralExpression(node); + return emitArrayLiteralExpression(node); case 177: - return emitPropertyAccessExpression(node); + return emitObjectLiteralExpression(node); case 178: - return emitElementAccessExpression(node); + return emitPropertyAccessExpression(node); case 179: - return emitCallExpression(node); + return emitElementAccessExpression(node); case 180: - return emitNewExpression(node); + return emitCallExpression(node); case 181: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 182: - return emitTypeAssertionExpression(node); + return emitTaggedTemplateExpression(node); case 183: - return emitParenthesizedExpression(node); + return emitTypeAssertionExpression(node); case 184: - return emitFunctionExpression(node); + return emitParenthesizedExpression(node); case 185: - return emitArrowFunction(node); + return emitFunctionExpression(node); case 186: - return emitDeleteExpression(node); + return emitArrowFunction(node); case 187: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 188: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 189: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 190: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 191: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 192: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 193: - return emitConditionalExpression(node); + return emitBinaryExpression(node); case 194: - return emitTemplateExpression(node); + return emitConditionalExpression(node); case 195: - return emitYieldExpression(node); + return emitTemplateExpression(node); case 196: - return emitSpreadExpression(node); + return emitYieldExpression(node); case 197: - return emitClassExpression(node); + return emitSpreadExpression(node); case 198: + return emitClassExpression(node); + case 199: return; - case 200: - return emitAsExpression(node); case 201: + return emitAsExpression(node); + case 202: return emitNonNullExpression(node); - case 246: + case 203: + return emitMetaProperty(node); + case 248: return emitJsxElement(node); - case 247: + case 249: return emitJsxSelfClosingElement(node); - case 294: + case 295: return emitPartiallyEmittedExpression(node); - case 297: - return writeLines(node.text); + } + } + function trySubstituteNode(hint, node) { + return node && substituteNode && substituteNode(hint, node) || node; + } + function emitHelpersIndirect(node) { + if (onEmitHelpers) { + onEmitHelpers(node, writeLines); } } function emitNumericLiteral(node) { emitLiteral(node); - if (node.trailingComment) { - write(" /*" + node.trailingComment + "*/"); - } } function emitLiteral(node) { var text = getLiteralTextOfNode(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) + if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -48962,8 +54079,8 @@ var ts; writeIfPresent(node.dotDotDotToken, "..."); emit(node.name); writeIfPresent(node.questionToken, "?"); - emitExpressionWithPrefix(" = ", node.initializer); emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { write("@"); @@ -49010,7 +54127,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 ? "get " : "set "); + write(node.kind === 152 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -49110,17 +54227,13 @@ var ts; write("{"); writeLine(); increaseIndent(); - if (node.readonlyToken) { - write("readonly "); - } + writeIfPresent(node.readonlyToken, "readonly "); write("["); emit(node.typeParameter.name); write(" in "); emit(node.typeParameter.constraint); write("]"); - if (node.questionToken) { - write("?"); - } + writeIfPresent(node.questionToken, "?"); write(": "); emit(node.type); write(";"); @@ -49180,7 +54293,7 @@ var ts; increaseIndent(); } var preferNewLine = node.multiLine ? 32768 : 0; - var allowTrailingComma = languageVersion >= 1 ? 32 : 0; + var allowTrailingComma = currentSourceFile.languageVersion >= 1 ? 32 : 0; emitList(node, properties, 978 | allowTrailingComma | preferNewLine); if (indentedFlag) { decreaseIndent(); @@ -49192,7 +54305,7 @@ var ts; var indentAfterDot = false; if (!(ts.getEmitFlags(node) & 65536)) { var dotRangeStart = node.expression.end; - var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; + var dotRangeEnd = ts.skipTrivia(currentSourceFile.text, node.expression.end) + 1; var dotToken = { kind: 22, pos: dotRangeStart, end: dotRangeEnd }; indentBeforeDot = needsIndentation(node, node.expression, dotToken); indentAfterDot = needsIndentation(node, dotToken, node.name); @@ -49206,15 +54319,17 @@ var ts; decreaseIndentIf(indentBeforeDot, indentAfterDot); } function needsDotDotForPropertyAccess(expression) { - if (expression.kind === 8) { + expression = ts.skipPartiallyEmittedExpressions(expression); + if (ts.isNumericLiteral(expression)) { var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22)) < 0; + return !expression.numericLiteralFlags + && text.indexOf(ts.tokenToString(22)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { var constantValue = ts.getConstantValue(expression); return isFinite(constantValue) && Math.floor(constantValue) === constantValue - && compilerOptions.removeComments; + && printerOptions.removeComments; } } function emitElementAccessExpression(node) { @@ -49240,11 +54355,9 @@ var ts; emitExpression(node.template); } function emitTypeAssertionExpression(node) { - if (node.type) { - write("<"); - emit(node.type); - write(">"); - } + write("<"); + emit(node.type); + write(">"); emitExpression(node.expression); } function emitParenthesizedExpression(node) { @@ -49291,7 +54404,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 190 + return operand.kind === 191 && ((node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) || (node.operator === 37 && (operand.operator === 37 || operand.operator === 43))); } @@ -49357,6 +54470,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } function emitTemplateSpan(node) { emitExpression(node.expression); emit(node.literal); @@ -49370,6 +54488,9 @@ var ts; else { writeToken(16, node.pos, node); emitBlockStatements(node); + increaseIndent(); + emitLeadingCommentsOfPosition(node.statements.end); + decreaseIndent(); writeToken(17, node.statements.end, node); } } @@ -49399,27 +54520,27 @@ var ts; writeToken(18, openParenPos, node); emitExpression(node.expression); writeToken(19, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 208) { + if (node.elseStatement.kind === 210) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -49429,7 +54550,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49441,7 +54562,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49451,21 +54572,22 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87, node.pos); write(" "); + emitWithSuffix(node.awaitModifier, " "); writeToken(18, openParenPos); emitForBinding(node.initializer); write(" of "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224) { + if (node.kind === 226) { emit(node); } else { @@ -49492,7 +54614,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97, node.pos); @@ -49516,9 +54638,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -49546,6 +54671,9 @@ var ts; emitIdentifierName(node.name); emitSignatureAndBody(node, emitSignatureHead); } + function emitBlockCallback(_hint, body) { + emitBlockFunctionBody(body); + } function emitSignatureAndBody(node, emitSignatureHead) { var body = node.body; if (body) { @@ -49556,14 +54684,23 @@ var ts; } if (ts.getEmitFlags(node) & 262144) { emitSignatureHead(node); - emitBlockFunctionBody(body); + if (onEmitNode) { + onEmitNode(3, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); emitSignatureHead(node); - emitBlockFunctionBody(body); - tempFlags = savedTempFlags; + if (onEmitNode) { + onEmitNode(3, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } + popNameGenerationScope(); } if (indentedFlag) { decreaseIndent(); @@ -49612,9 +54749,15 @@ var ts; function emitBlockFunctionBody(body) { write(" {"); increaseIndent(); - emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body) + var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine - : emitBlockFunctionBodyWorker); + : emitBlockFunctionBodyWorker; + if (emitBodyWithDetachedComments) { + emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody); + } + else { + emitBlockFunctionBody(body); + } decreaseIndent(); writeToken(17, body.statements.end, body); } @@ -49623,8 +54766,9 @@ var ts; } function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { var statementOffset = emitPrologueDirectives(body.statements, true); - var helpersEmitted = emitHelpers(body); - if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) { + var pos = writer.getTextPos(); + emitHelpersIndirect(body); + if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384); increaseIndent(); @@ -49647,15 +54791,14 @@ var ts; } emitTypeParameters(node, node.typeParameters); emitList(node, node.heritageClauses, 256); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 65); write("}"); + popNameGenerationScope(); if (indentedFlag) { decreaseIndent(); } - tempFlags = savedTempFlags; } function emitInterfaceDeclaration(node) { emitDecorators(node, node.decorators); @@ -49682,19 +54825,18 @@ var ts; emitModifiers(node, node.modifiers); write("enum "); emit(node.name); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 81); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } function emitModuleDeclaration(node) { emitModifiers(node, node.modifiers); write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230) { + while (body.kind === 232) { write("."); emit(body.name); body = body.body; @@ -49707,13 +54849,11 @@ var ts; write("{ }"); } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write("{"); - increaseIndent(); emitBlockStatements(node); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } } function emitCaseBlock(node) { @@ -49815,14 +54955,18 @@ var ts; write("<"); emitJsxTagName(node.tagName); write(" "); - emitList(node, node.attributes, 131328); + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write("/>"); } function emitJsxOpeningElement(node) { write("<"); emitJsxTagName(node.tagName); - writeIfAny(node.attributes, " "); - emitList(node, node.attributes, 131328); + writeIfAny(node.attributes.properties, " "); + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write(">"); } function emitJsxText(node) { @@ -49833,6 +54977,9 @@ var ts; emitJsxTagName(node.tagName); write(">"); } + function emitJsxAttributes(node) { + emitList(node, node.properties, 131328); + } function emitJsxAttribute(node) { emit(node.name); emitWithPrefix("=", node.initializer); @@ -49845,6 +54992,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -49887,7 +55037,6 @@ var ts; emitList(node, node.types, 272); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73, node.pos); write(" "); writeToken(18, openParenPos); @@ -49900,7 +55049,7 @@ var ts; emit(node.name); write(": "); var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 512) === 0) { + if (emitTrailingCommentsOfPosition && (ts.getEmitFlags(initializer) & 512) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -49925,28 +55074,43 @@ var ts; } function emitSourceFile(node) { writeLine(); - emitShebang(); - emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker); + var statements = node.statements; + if (emitBodyWithDetachedComments) { + var shouldEmitDetachedComment = statements.length === 0 || + !ts.isPrologueDirective(statements[0]) || + ts.nodeIsSynthesized(statements[0]); + if (shouldEmitDetachedComment) { + emitBodyWithDetachedComments(node, statements, emitSourceFileWorker); + return; + } + } + emitSourceFileWorker(node); } function emitSourceFileWorker(node) { var statements = node.statements; - var statementOffset = emitPrologueDirectives(statements); - var savedTempFlags = tempFlags; - tempFlags = 0; - emitHelpers(node); - emitList(node, statements, 1, statementOffset); - tempFlags = savedTempFlags; + pushNameGenerationScope(); + emitHelpersIndirect(node); + var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); + emitList(node, statements, 1, index === -1 ? statements.length : index); + popNameGenerationScope(); } function emitPartiallyEmittedExpression(node) { emitExpression(node.expression); } - function emitPrologueDirectives(statements, startWithNewLine) { + function emitPrologueDirectives(statements, startWithNewLine, seenPrologueDirectives) { for (var i = 0; i < statements.length; i++) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); + var statement = statements[i]; + if (ts.isPrologueDirective(statement)) { + var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true; + if (shouldEmitPrologueDirective) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statement); + if (seenPrologueDirectives) { + seenPrologueDirectives.set(statement.expression.text, statement.expression.text); + } } - emit(statements[i]); } else { return i; @@ -49954,71 +55118,37 @@ var ts; } return statements.length; } - function emitHelpers(node, isBundle) { - var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); - var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; - var helpersEmitted = false; - var helpers = ts.getEmitHelpers(node); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - if (shouldSkip) - continue; - if (shouldBundle) { - if (bundledHelpers[helper.name]) { - continue; - } - bundledHelpers[helper.name] = true; - } - } - else if (isBundle) { - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } + function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + setSourceFile(sourceFileOrBundle); + emitPrologueDirectives(sourceFileOrBundle.statements); } - if (helpersEmitted) { - writeLine(); + else { + var seenPrologueDirectives = ts.createMap(); + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + setSourceFile(sourceFile); + emitPrologueDirectives(sourceFile.statements, true, seenPrologueDirectives); + } } - return helpersEmitted; } - function writeLines(text) { - var lines = text.split(/\r\n?|\n/g); - var indentation = guessIndentation(lines); - for (var i = 0; i < lines.length; i++) { - var line = indentation ? lines[i].slice(indentation) : lines[i]; - if (line.length) { - if (i > 0) { - writeLine(); - } - write(line); + function emitShebangIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + var shebang = ts.getShebang(sourceFileOrBundle.text); + if (shebang) { + write(shebang); + writeLine(); + return true; } } - } - function guessIndentation(lines) { - var indentation; - for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { - var line = lines_1[_a]; - for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { - if (!ts.isWhiteSpace(line.charCodeAt(i))) { - if (indentation === undefined || i < indentation) { - indentation = i; - break; - } + else { + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + if (emitShebangIfNeeded(sourceFile)) { + break; } } } - return indentation; - } - function emitShebang() { - var shebang = ts.getShebang(currentText); - if (shebang) { - write(shebang); - writeLine(); - } } function emitModifiers(node, modifiers) { if (modifiers && modifiers.length) { @@ -50044,8 +55174,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1) { write(" "); emit(node); } @@ -50102,6 +55232,9 @@ var ts; if (format & 7680) { write(getOpeningBracket(format)); } + if (onBeforeEmitNodeArray) { + onBeforeEmitNodeArray(children); + } if (isEmpty) { if (format & 1) { writeLine(); @@ -50129,6 +55262,9 @@ var ts; for (var i = 0; i < count; i++) { var child = children[start + i]; if (previousSibling) { + if (delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } write(delimiter); if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) { if ((format & (3 | 64)) === 0) { @@ -50143,8 +55279,10 @@ var ts; } } if (shouldEmitInterveningComments) { - var commentRange = ts.getCommentRange(child); - emitTrailingCommentsOfPosition(commentRange.pos); + if (emitTrailingCommentsOfPosition) { + var commentRange = ts.getCommentRange(child); + emitTrailingCommentsOfPosition(commentRange.pos); + } } else { shouldEmitInterveningComments = mayEmitInterveningComments; @@ -50160,6 +55298,9 @@ var ts; if (format & 16 && hasTrailingComma) { write(","); } + if (previousSibling && delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } if (format & 64) { decreaseIndent(); } @@ -50170,28 +55311,80 @@ var ts; write(" "); } } + if (onAfterEmitNodeArray) { + onAfterEmitNodeArray(children); + } if (format & 7680) { write(getClosingBracket(format)); } } + function write(s) { + writer.write(s); + } + function writeLine() { + writer.writeLine(); + } + function increaseIndent() { + writer.increaseIndent(); + } + function decreaseIndent() { + writer.decreaseIndent(); + } function writeIfAny(nodes, text) { - if (nodes && nodes.length > 0) { + if (ts.some(nodes)) { write(text); } } function writeIfPresent(node, text) { - if (node !== undefined) { + if (node) { write(text); } } function writeToken(token, pos, contextNode) { - return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText); + return onEmitSourceMapOfToken + ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) + : writeTokenText(token, pos); } function writeTokenText(token, pos) { var tokenString = ts.tokenToString(token); write(tokenString); return pos < 0 ? pos : pos + tokenString.length; } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1) { + write(" "); + } + else { + writeLine(); + } + } + function writeLines(text) { + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); + for (var i = 0; i < lines.length; i++) { + var line = indentation ? lines[i].slice(indentation) : lines[i]; + if (line.length) { + writeLine(); + write(line); + writeLine(); + } + } + } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } function increaseIndentIf(value, valueToWriteWhenNotIndenting) { if (value) { increaseIndent(); @@ -50296,15 +55489,23 @@ var ts; && !ts.nodeIsSynthesized(node2) && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } + function isSingleLineEmptyBlock(block) { + return !block.multiLine + && isEmptyBlock(block); + } + function isEmptyBlock(block) { + return block.statements.length === 0 + && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + } function skipSynthesizedParentheses(node) { - while (node.kind === 183 && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { if (ts.isGeneratedIdentifier(node)) { - return getGeneratedIdentifier(node); + return generateName(node); } else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { return ts.unescapeIdentifier(node.text); @@ -50327,25 +55528,39 @@ var ts; return getLiteralTextOfNode(textSourceNode); } } - return ts.getLiteralText(node, currentSourceFile, languageVersion); + return ts.getLiteralText(node, currentSourceFile); } - function isSingleLineEmptyBlock(block) { - return !block.multiLine - && isEmptyBlock(block); + function pushNameGenerationScope() { + tempFlagsStack.push(tempFlags); + tempFlags = 0; } - function isEmptyBlock(block) { - return block.statements.length === 0 - && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + function popNameGenerationScope() { + tempFlags = tempFlagsStack.pop(); + } + function generateName(name) { + if (name.autoGenerateKind === 4) { + var node = getNodeForGeneratedName(name); + return generateNameCached(node); + } + else { + var autoGenerateId = name.autoGenerateId; + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(makeName(name))); + } + } + function generateNameCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); } function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name) + && !generatedNames.has(name); } function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + if (node.locals) { + var local = node.locals.get(name); + if (local && local.flags & (107455 | 1048576 | 8388608)) { return false; } } @@ -50354,21 +55569,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_41 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_41)) { + var name = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_41; + return name; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_42 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_42)) { - return name_42; + if (isUniqueName(name)) { + return name; } } } @@ -50381,7 +55596,8 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNames.set(generatedName, generatedName); + return generatedName; } i++; } @@ -50402,34 +55618,44 @@ var ts; function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameCached(node.name); + } + return makeTempVariableName(0); + } function generateNameForNode(node) { switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); - case 230: - case 229: + case 232: + case 231: return generateNameForModuleOrEnum(node); - case 235: - case 241: + case 237: + case 243: return generateNameForImportOrExportDeclaration(node); - case 225: - case 226: - case 240: + case 227: + case 228: + case 242: return generateNameForExportDefault(); - case 197: + case 198: return generateNameForClassExpression(); + case 150: + case 152: + case 153: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); } } - function generateName(name) { + function makeName(name) { switch (name.autoGenerateKind) { case 1: return makeTempVariableName(0); case 2: return makeTempVariableName(268435456); case 3: - return makeUniqueName(name.text); + return makeUniqueName(ts.unescapeIdentifier(name.text)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -50448,48 +55674,106 @@ var ts; } return node; } - function getGeneratedIdentifier(name) { - if (name.autoGenerateKind === 4) { - var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); - } - else { - var autoGenerateId = name.autoGenerateId; - return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name))); - } - } - function createDelimiterMap() { - var delimiters = []; - delimiters[0] = ""; - delimiters[16] = ","; - delimiters[4] = " |"; - delimiters[8] = " &"; - return delimiters; - } - function getDelimiter(format) { - return delimiters[format & 28]; - } - function createBracketsMap() { - var brackets = []; - brackets[512] = ["{", "}"]; - brackets[1024] = ["(", ")"]; - brackets[2048] = ["<", ">"]; - brackets[4096] = ["[", "]"]; - return brackets; - } - function getOpeningBracket(format) { - return brackets[format & 7680][0]; - } - function getClosingBracket(format) { - return brackets[format & 7680][1]; - } } - ts.emitFiles = emitFiles; + ts.createPrinter = createPrinter; + function createDelimiterMap() { + var delimiters = []; + delimiters[0] = ""; + delimiters[16] = ","; + delimiters[4] = " |"; + delimiters[8] = " &"; + return delimiters; + } + function getDelimiter(format) { + return delimiters[format & 28]; + } + function createBracketsMap() { + var brackets = []; + brackets[512] = ["{", "}"]; + brackets[1024] = ["(", ")"]; + brackets[2048] = ["<", ">"]; + brackets[4096] = ["[", "]"]; + return brackets; + } + function getOpeningBracket(format) { + return brackets[format & 7680][0]; + } + function getClosingBracket(format) { + return brackets[format & 7680][1]; + } + var TempFlags; + (function (TempFlags) { + TempFlags[TempFlags["Auto"] = 0] = "Auto"; + TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; + TempFlags[TempFlags["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); + var ListFormat; + (function (ListFormat) { + ListFormat[ListFormat["None"] = 0] = "None"; + ListFormat[ListFormat["SingleLine"] = 0] = "SingleLine"; + ListFormat[ListFormat["MultiLine"] = 1] = "MultiLine"; + ListFormat[ListFormat["PreserveLines"] = 2] = "PreserveLines"; + ListFormat[ListFormat["LinesMask"] = 3] = "LinesMask"; + ListFormat[ListFormat["NotDelimited"] = 0] = "NotDelimited"; + ListFormat[ListFormat["BarDelimited"] = 4] = "BarDelimited"; + ListFormat[ListFormat["AmpersandDelimited"] = 8] = "AmpersandDelimited"; + ListFormat[ListFormat["CommaDelimited"] = 16] = "CommaDelimited"; + ListFormat[ListFormat["DelimitersMask"] = 28] = "DelimitersMask"; + ListFormat[ListFormat["AllowTrailingComma"] = 32] = "AllowTrailingComma"; + ListFormat[ListFormat["Indented"] = 64] = "Indented"; + ListFormat[ListFormat["SpaceBetweenBraces"] = 128] = "SpaceBetweenBraces"; + ListFormat[ListFormat["SpaceBetweenSiblings"] = 256] = "SpaceBetweenSiblings"; + ListFormat[ListFormat["Braces"] = 512] = "Braces"; + ListFormat[ListFormat["Parenthesis"] = 1024] = "Parenthesis"; + ListFormat[ListFormat["AngleBrackets"] = 2048] = "AngleBrackets"; + ListFormat[ListFormat["SquareBrackets"] = 4096] = "SquareBrackets"; + ListFormat[ListFormat["BracketsMask"] = 7680] = "BracketsMask"; + ListFormat[ListFormat["OptionalIfUndefined"] = 8192] = "OptionalIfUndefined"; + ListFormat[ListFormat["OptionalIfEmpty"] = 16384] = "OptionalIfEmpty"; + ListFormat[ListFormat["Optional"] = 24576] = "Optional"; + ListFormat[ListFormat["PreferNewLine"] = 32768] = "PreferNewLine"; + ListFormat[ListFormat["NoTrailingNewLine"] = 65536] = "NoTrailingNewLine"; + ListFormat[ListFormat["NoInterveningComments"] = 131072] = "NoInterveningComments"; + ListFormat[ListFormat["Modifiers"] = 256] = "Modifiers"; + ListFormat[ListFormat["HeritageClauses"] = 256] = "HeritageClauses"; + ListFormat[ListFormat["TypeLiteralMembers"] = 65] = "TypeLiteralMembers"; + ListFormat[ListFormat["TupleTypeElements"] = 336] = "TupleTypeElements"; + ListFormat[ListFormat["UnionTypeConstituents"] = 260] = "UnionTypeConstituents"; + ListFormat[ListFormat["IntersectionTypeConstituents"] = 264] = "IntersectionTypeConstituents"; + ListFormat[ListFormat["ObjectBindingPatternElements"] = 432] = "ObjectBindingPatternElements"; + ListFormat[ListFormat["ArrayBindingPatternElements"] = 304] = "ArrayBindingPatternElements"; + ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 978] = "ObjectLiteralExpressionProperties"; + ListFormat[ListFormat["ArrayLiteralExpressionElements"] = 4466] = "ArrayLiteralExpressionElements"; + ListFormat[ListFormat["CallExpressionArguments"] = 1296] = "CallExpressionArguments"; + ListFormat[ListFormat["NewExpressionArguments"] = 9488] = "NewExpressionArguments"; + ListFormat[ListFormat["TemplateExpressionSpans"] = 131072] = "TemplateExpressionSpans"; + ListFormat[ListFormat["SingleLineBlockStatements"] = 384] = "SingleLineBlockStatements"; + ListFormat[ListFormat["MultiLineBlockStatements"] = 65] = "MultiLineBlockStatements"; + ListFormat[ListFormat["VariableDeclarationList"] = 272] = "VariableDeclarationList"; + ListFormat[ListFormat["SingleLineFunctionBodyStatements"] = 384] = "SingleLineFunctionBodyStatements"; + ListFormat[ListFormat["MultiLineFunctionBodyStatements"] = 1] = "MultiLineFunctionBodyStatements"; + ListFormat[ListFormat["ClassHeritageClauses"] = 256] = "ClassHeritageClauses"; + ListFormat[ListFormat["ClassMembers"] = 65] = "ClassMembers"; + ListFormat[ListFormat["InterfaceMembers"] = 65] = "InterfaceMembers"; + ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers"; + ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses"; + ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements"; + ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren"; + ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes"; + ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements"; + ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes"; + ListFormat[ListFormat["SourceFileStatements"] = 65537] = "SourceFileStatements"; + ListFormat[ListFormat["Decorators"] = 24577] = "Decorators"; + ListFormat[ListFormat["TypeArguments"] = 26960] = "TypeArguments"; + ListFormat[ListFormat["TypeParameters"] = 26960] = "TypeParameters"; + ListFormat[ListFormat["Parameters"] = 1360] = "Parameters"; + ListFormat[ListFormat["IndexSignatureParameters"] = 4432] = "IndexSignatureParameters"; + })(ListFormat || (ListFormat = {})); })(ts || (ts = {})); var ts; (function (ts) { var emptyArray = []; + var ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } while (true) { @@ -50521,7 +55805,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { return true; @@ -50548,7 +55833,6 @@ var ts; function getCanonicalFileName(fileName) { return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { var text; try { @@ -50559,20 +55843,18 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.message); } text = ""; } return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -50591,9 +55873,10 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -50601,11 +55884,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -50704,10 +55987,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_43 = names_1[_i]; - var result = name_43 in cache - ? cache[name_43] - : cache[name_43] = loader(name_43, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -50719,6 +56006,8 @@ var ts; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; + var cachedSemanticDiagnosticsForFile = {}; + var cachedDeclarationDiagnosticsForFile = {}; var resolvedTypeReferenceDirectives = ts.createMap(); var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; @@ -50732,6 +56021,7 @@ var ts; var currentDirectory = host.getCurrentDirectory(); var supportedExtensions = ts.getSupportedExtensions(options); var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -50744,7 +56034,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -50780,6 +56071,7 @@ var ts; } } } + moduleResolutionCache = undefined; oldProgram = undefined; program = { getRootFileNames: function () { return rootNames; }, @@ -50813,7 +56105,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } @@ -50832,7 +56124,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -50875,7 +56167,7 @@ var ts; : emptyArray; var j = 0; for (var i = 0; i < result.length; i++) { - if (result[i] == predictedToResolveToAmbientModuleMarker) { + if (result[i] === predictedToResolveToAmbientModuleMarker) { result[i] = undefined; } else { @@ -50986,7 +56278,7 @@ var ts; newSourceFile.resolvedModules = oldSourceFile.resolvedModules; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -51015,7 +56307,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); @@ -51026,13 +56318,13 @@ var ts; function getTypeChecker() { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); } - function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { - return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); }); + function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers) { + return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers); }); } function isEmitBlocked(emitFileName) { return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); } - function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { + function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers) { var declarationDiagnostics = []; if (options.noEmit) { return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; @@ -51053,7 +56345,8 @@ var ts; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); ts.performance.mark("beforeEmit"); - var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles); + var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers); ts.performance.mark("afterEmit"); ts.performance.measure("Emit", "beforeEmit", "afterEmit"); return emitResult; @@ -51114,16 +56407,42 @@ var ts; } } function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedSemanticDiagnosticsForFile, getSemanticDiagnosticsForFileNoCache); + } + function getSemanticDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken); + var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + return ts.isSourceFileJavaScript(sourceFile) + ? ts.filter(diagnostics, shouldReportDiagnostic) + : diagnostics; }); } + function shouldReportDiagnostic(diagnostic) { + var file = diagnostic.file, start = diagnostic.start; + if (file) { + var lineStarts = ts.getLineStarts(file); + var line = ts.computeLineAndCharacterOfPosition(lineStarts, start).line; + while (line > 0) { + var previousLineText = file.text.slice(lineStarts[line - 1], lineStarts[line]); + var result = ignoreDiagnosticCommentRegEx.exec(previousLineText); + if (!result) { + return true; + } + if (result[3]) { + return false; + } + line--; + } + } + return true; + } function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { return runWithCancellationToken(function () { var diagnostics = []; @@ -51132,57 +56451,57 @@ var ts; return diagnostics; function walk(node) { switch (parent.kind) { - case 144: - case 147: + case 145: + case 148: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - case 149: - case 148: case 150: + case 149: case 151: case 152: - case 184: - case 225: + case 153: case 185: + case 227: + case 186: + case 227: case 225: - case 223: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 234: + case 236: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240: + case 242: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255: + case 258: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230: + case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182: + case 183: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -51197,26 +56516,26 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226: - case 149: - case 148: + case 228: case 150: + case 149: case 151: case 152: - case 184: - case 225: + case 153: case 185: - case 225: + case 227: + case 186: + case 227: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 205: + case 207: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205); + return checkModifiers(nodes, parent.kind === 207); } break; - case 147: + case 148: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; @@ -51227,23 +56546,23 @@ var ts; return; } break; - case 144: + case 145: if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179: case 180: - case 199: + case 181: + case 200: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); return; } break; } - for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { - var node = nodes_6[_b]; + for (var _b = 0, nodes_8 = nodes; _b < nodes_8.length; _b++) { + var node = nodes_8[_b]; walk(node); } } @@ -51279,11 +56598,33 @@ var ts; }); } function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache); + } + function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile); }); } + function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) { + var cachedResult = sourceFile + ? cache.perFile && cache.perFile.get(sourceFile.path) + : cache.allDiagnostics; + if (cachedResult) { + return cachedResult; + } + var result = getDiagnostics(sourceFile, cancellationToken) || emptyArray; + if (sourceFile) { + if (!cache.perFile) { + cache.perFile = ts.createFileMap(); + } + cache.perFile.set(sourceFile.path, result); + } + else { + cache.allDiagnostics = result; + } + return result; + } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); } @@ -51323,11 +56664,10 @@ var ts; if (options.importHelpers && (options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) { - var externalHelpersModuleReference = ts.createSynthesizedNode(9); - externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235); - importDecl.parent = file; + var externalHelpersModuleReference = ts.createLiteral(ts.externalHelpersModuleNameText); + var importDecl = ts.createImportDeclaration(undefined, undefined, undefined); externalHelpersModuleReference.parent = importDecl; + importDecl.parent = file; imports = [externalHelpersModuleReference]; } for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { @@ -51343,9 +56683,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 235: - case 234: - case 241: + case 237: + case 236: + case 243: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -51357,7 +56697,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230: + case 232: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -51441,18 +56781,18 @@ var ts; if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth === 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -51468,7 +56808,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(path); @@ -51512,7 +56852,7 @@ var ts; } } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -51540,7 +56880,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -51581,7 +56921,7 @@ var ts; var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -51599,8 +56939,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -51611,8 +56951,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -51705,7 +57045,7 @@ var ts; if (options.lib && options.noLib) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } - if (options.noImplicitUseStrict && options.alwaysStrict) { + if (options.noImplicitUseStrict && (options.alwaysStrict === undefined ? options.strict : options.alwaysStrict)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); } var languageVersion = options.target || 0; @@ -51745,6 +57085,9 @@ var ts; if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } + if (options.checkJs && !options.allowJs) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")); + } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); @@ -51763,7 +57106,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -51825,7 +57168,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -51884,6 +57229,22 @@ var ts; SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); + var OutputFileType; + (function (OutputFileType) { + OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; + OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; + OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; + })(OutputFileType = ts.OutputFileType || (ts.OutputFileType = {})); + var EndOfLineState; + (function (EndOfLineState) { + EndOfLineState[EndOfLineState["None"] = 0] = "None"; + EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; + EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; + })(EndOfLineState = ts.EndOfLineState || (ts.EndOfLineState = {})); var TokenClass; (function (TokenClass) { TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; @@ -51908,7 +57269,7 @@ var ts; ScriptElementKind.interfaceElement = "interface"; ScriptElementKind.typeElement = "type"; ScriptElementKind.enumElement = "enum"; - ScriptElementKind.enumMemberElement = "const"; + ScriptElementKind.enumMemberElement = "enum member"; ScriptElementKind.variableElement = "var"; ScriptElementKind.localVariableElement = "local var"; ScriptElementKind.functionElement = "function"; @@ -51930,6 +57291,7 @@ var ts; ScriptElementKind.letElement = "let"; ScriptElementKind.directory = "directory"; ScriptElementKind.externalModuleName = "external module name"; + ScriptElementKind.jsxAttribute = "JSX attribute"; })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); var ScriptElementKindModifier; (function (ScriptElementKindModifier) { @@ -51971,40 +57333,76 @@ var ts; ClassificationTypeNames.jsxText = "jsx text"; ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; ts.ClassificationTypeNames = ClassificationTypeNames; + var ClassificationType; + (function (ClassificationType) { + ClassificationType[ClassificationType["comment"] = 1] = "comment"; + ClassificationType[ClassificationType["identifier"] = 2] = "identifier"; + ClassificationType[ClassificationType["keyword"] = 3] = "keyword"; + ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral"; + ClassificationType[ClassificationType["operator"] = 5] = "operator"; + ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral"; + ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral"; + ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace"; + ClassificationType[ClassificationType["text"] = 9] = "text"; + ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation"; + ClassificationType[ClassificationType["className"] = 11] = "className"; + ClassificationType[ClassificationType["enumName"] = 12] = "enumName"; + ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName"; + ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName"; + ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName"; + ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; + ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; + ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName"; + ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; + ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; + ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; + ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute"; + ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText"; + ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue"; + })(ClassificationType = ts.ClassificationType || (ts.ClassificationType = {})); })(ts || (ts = {})); var ts; (function (ts) { ts.scanner = ts.createScanner(5, true); ts.emptyArray = []; + var SemanticMeaning; + (function (SemanticMeaning) { + SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; + SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value"; + SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type"; + SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace"; + SemanticMeaning[SemanticMeaning["All"] = 7] = "All"; + })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144: - case 223: - case 174: + case 145: + case 225: + case 175: + case 148: case 147: - case 146: - case 257: - case 258: case 260: - case 149: - case 148: + case 261: + case 263: case 150: + case 149: case 151: case 152: - case 225: - case 184: + case 153: + case 227: case 185: - case 256: + case 186: + case 259: + case 252: return 1; - case 143: - case 227: - case 228: - case 161: - return 2; - case 226: + case 144: case 229: - return 1 | 2; case 230: + case 162: + return 2; + case 228: + case 231: + return 1 | 2; + case 232: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -52014,21 +57412,24 @@ var ts; else { return 4; } - case 238: - case 239: - case 234: - case 235: case 240: case 241: + case 236: + case 237: + case 242: + case 243: return 1 | 2 | 4; - case 261: + case 264: return 4 | 1; } return 1 | 2 | 4; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240) { + if (node.kind === 264) { + return 1; + } + else if (node.parent.kind === 242) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -52050,15 +57451,15 @@ var ts; ts.getMeaningFromLocation = getMeaningFromLocation; function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 70); - if (node.parent.kind === 141 && + if (node.parent.kind === 142 && node.parent.right === node && - node.parent.parent.kind === 234) { + node.parent.parent.kind === 236) { return 1 | 2 | 4; } return 4; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141) { + while (node.parent.kind === 142) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -52069,27 +57470,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141) { - while (root.parent && root.parent.kind === 141) { + if (root.parent.kind === 142) { + while (root.parent && root.parent.kind === 142) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 && !isLastClause; + return root.parent.kind === 158 && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177) { - while (root.parent && root.parent.kind === 177) { + if (root.parent.kind === 178) { + while (root.parent && root.parent.kind === 178) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 255) { + if (!isLastClause && root.parent.kind === 200 && root.parent.parent.kind === 258) { var decl = root.parent.parent.parent; - return (decl.kind === 226 && root.parent.parent.token === 107) || - (decl.kind === 227 && root.parent.parent.token === 84); + return (decl.kind === 228 && root.parent.parent.token === 107) || + (decl.kind === 229 && root.parent.parent.token === 84); } return false; } @@ -52097,17 +57498,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 || - (node.parent.kind === 199 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 || + (node.parent.kind === 200 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 && !ts.isPartOfExpression(node)) || - node.kind === 167; + node.kind === 168; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179); + return isCallOrNewExpressionTarget(node, 180); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180); + return isCallOrNewExpressionTarget(node, 181); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -52120,7 +57521,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -52130,13 +57531,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 && - (node.parent.kind === 215 || node.parent.kind === 214) && + (node.parent.kind === 217 || node.parent.kind === 216) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 && - node.parent.kind === 219 && + node.parent.kind === 221 && node.parent.label === node; } function isLabelName(node) { @@ -52144,15 +57545,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 && node.parent.right === node; + return node.parent.kind === 142 && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 && node.parent.name === node; + return node.parent.kind === 232 && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -52163,19 +57564,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { + case 148: case 147: - case 146: - case 257: case 260: + case 263: + case 150: case 149: - case 148: - case 151: case 152: - case 230: + case 153: + case 232: return node.parent.name === node; - case 178: + case 179: return node.parent.argumentExpression === node; - case 142: + case 143: return true; } } @@ -52219,17 +57620,17 @@ var ts; return undefined; } switch (node.kind) { - case 261: + case 264: + case 150: case 149: - case 148: - case 225: - case 184: - case 151: - case 152: - case 226: case 227: + case 185: + case 152: + case 153: + case 228: case 229: - case 230: + case 231: + case 232: return node; } } @@ -52237,46 +57638,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261: + case 264: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230: + case 232: return ts.ScriptElementKind.moduleElement; - case 226: - case 197: + case 228: + case 198: return ts.ScriptElementKind.classElement; - case 227: return ts.ScriptElementKind.interfaceElement; - case 228: return ts.ScriptElementKind.typeElement; - case 229: return ts.ScriptElementKind.enumElement; - case 223: + case 229: return ts.ScriptElementKind.interfaceElement; + case 230: return ts.ScriptElementKind.typeElement; + case 231: return ts.ScriptElementKind.enumElement; + case 225: return getKindOfVariableDeclaration(node); - case 174: + case 175: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); + case 186: + case 227: case 185: - case 225: - case 184: return ts.ScriptElementKind.functionElement; - case 151: return ts.ScriptElementKind.memberGetAccessorElement; - case 152: return ts.ScriptElementKind.memberSetAccessorElement; + case 152: return ts.ScriptElementKind.memberGetAccessorElement; + case 153: return ts.ScriptElementKind.memberSetAccessorElement; + case 150: case 149: - case 148: return ts.ScriptElementKind.memberFunctionElement; + case 148: case 147: - case 146: return ts.ScriptElementKind.memberVariableElement; - case 155: return ts.ScriptElementKind.indexSignatureElement; - case 154: return ts.ScriptElementKind.constructSignatureElement; - case 153: return ts.ScriptElementKind.callSignatureElement; - case 150: return ts.ScriptElementKind.constructorImplementationElement; - case 143: return ts.ScriptElementKind.typeParameterElement; - case 260: return ts.ScriptElementKind.enumMemberElement; - case 144: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234: - case 239: + case 156: return ts.ScriptElementKind.indexSignatureElement; + case 155: return ts.ScriptElementKind.constructSignatureElement; + case 154: return ts.ScriptElementKind.callSignatureElement; + case 151: return ts.ScriptElementKind.constructorImplementationElement; + case 144: return ts.ScriptElementKind.typeParameterElement; + case 263: return ts.ScriptElementKind.enumMemberElement; + case 145: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; case 236: - case 243: - case 237: + case 241: + case 238: + case 245: + case 239: return ts.ScriptElementKind.alias; - case 285: + case 289: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -52290,21 +57691,12 @@ var ts; } } ts.getNodeKind = getNodeKind; - function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 ? node.parent : node; - var type = typeChecker.getTypeAtLocation(searchNode); - if (type && type.flags & 32) { - return type; - } - return undefined; - } - ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode; function isThis(node) { switch (node.kind) { case 98: return true; case 70: - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145; default: return false; } @@ -52312,7 +57704,7 @@ var ts; ts.isThis = isThis; var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= node.end) { + if (c.kind === 293 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -52523,7 +57915,7 @@ var ts; if (includeJsDocComment === void 0) { includeJsDocComment = false; } var current = sourceFile; outer: while (true) { - if (isToken(current)) { + if (ts.isToken(current)) { return current; } if (includeJsDocComment) { @@ -52546,8 +57938,8 @@ var ts; } } } - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; if (ts.isJSDocNode(child)) { continue; } @@ -52571,7 +57963,7 @@ var ts; } function findTokenOnLeftOfPosition(file, position) { var tokenAtPosition = getTokenAtPosition(file, position); - if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { return tokenAtPosition; } return findPrecedingToken(position, file); @@ -52580,7 +57972,7 @@ var ts; function findNextToken(previousToken, parent) { return find(parent); function find(n) { - if (isToken(n) && n.pos === previousToken.end) { + if (ts.isToken(n) && n.pos === previousToken.end) { return n; } var children = n.getChildren(); @@ -52599,7 +57991,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); @@ -52607,11 +57999,11 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; if (position < child.end && (nodeHasTokens(child) || child.kind === 10)) { var start = child.getStart(sourceFile); @@ -52626,7 +58018,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261); + ts.Debug.assert(startNode !== undefined || n.kind === 264); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -52671,13 +58063,13 @@ var ts; if (token.kind === 26 && token.parent.kind === 10) { return true; } - if (token.kind === 26 && token.parent.kind === 252) { + if (token.kind === 26 && token.parent.kind === 255) { return true; } - if (token && token.kind === 17 && token.parent.kind === 252) { + if (token && token.kind === 17 && token.parent.kind === 255) { return true; } - if (token.kind === 26 && token.parent.kind === 249) { + if (token.kind === 26 && token.parent.kind === 251) { return true; } return false; @@ -52694,10 +58086,10 @@ var ts; var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); return predicate ? ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 ? position <= c.end : position < c.end) && + (c.kind === 2 ? position <= c.end : position < c.end) && predicate(c); }) : ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 ? position <= c.end : position < c.end); }); + (c.kind === 2 ? position <= c.end : position < c.end); }); } return false; } @@ -52714,7 +58106,7 @@ var ts; ts.hasDocComment = hasDocComment; function getJsDocTagAtPosition(sourceFile, position) { var node = ts.getTokenAtPosition(sourceFile, position); - if (isToken(node)) { + if (ts.isToken(node)) { switch (node.kind) { case 103: case 109: @@ -52768,19 +58160,15 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 || node.kind === 179) { + if (node.kind === 158 || node.kind === 180) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 || node.kind === 227) { + if (ts.isFunctionLike(node) || node.kind === 228 || node.kind === 229) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; - function isToken(n) { - return n.kind >= 0 && n.kind <= 140; - } - ts.isToken = isToken; function isWord(kind) { return kind === 70 || ts.isKeyword(kind); } @@ -52837,18 +58225,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 || - node.kind === 176) { - if (node.parent.kind === 192 && + if (node.kind === 176 || + node.kind === 177) { + if (node.parent.kind === 193 && node.parent.left === node && node.parent.operatorToken.kind === 57) { return true; } - if (node.parent.kind === 213 && + if (node.parent.kind === 215 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 260 ? node.parent.parent : node.parent)) { return true; } } @@ -52876,10 +58264,43 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118: + case 121: + case 129: + case 132: + case 133: + case 135: + case 136: + case 104: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; + function isExternalModuleSymbol(moduleSymbol) { + ts.Debug.assert(!!(moduleSymbol.flags & 1536)); + return moduleSymbol.name.charCodeAt(0) === 34; + } + ts.isExternalModuleSymbol = isExternalModuleSymbol; + function nodeSeenTracker() { + var seen = []; + return function (node) { + var id = ts.getNodeId(node); + return !seen[id] && (seen[id] = true); + }; + } + ts.nodeSeenTracker = nodeSeenTracker; })(ts || (ts = {})); (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -52896,13 +58317,15 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; function writeIndent() { if (lineStart) { @@ -53050,21 +58473,16 @@ var ts; } ts.signatureToDisplayParts = signatureToDisplayParts; function getDeclaredName(typeChecker, symbol, location) { - if (isImportOrExportSpecifierName(location)) { - return location.getText(); - } - else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142) { + if (isImportOrExportSpecifierName(location) || ts.isStringOrNumericLiteral(location) && location.parent.kind === 143) { return location.text; } var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); - return name; + return typeChecker.symbolToString(localExportDefaultSymbol || symbol); } ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 || location.parent.kind === 243) && + (location.parent.kind === 241 || location.parent.kind === 245) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -53075,7 +58493,6 @@ var ts; (name.charCodeAt(0) === 34 || name.charCodeAt(0) === 39)) { return name.substring(1, length - 1); } - ; return name; } ts.stripQuotes = stripQuotes; @@ -53121,6 +58538,21 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getFirstNonSpaceCharacterPosition(text, position) { + while (ts.isWhiteSpace(text.charCodeAt(position))) { + position += 1; + } + return position; + } + ts.getFirstNonSpaceCharacterPosition = getFirstNonSpaceCharacterPosition; + function getOpenBrace(constructor, sourceFile) { + return constructor.body.getFirstToken(sourceFile); + } + ts.getOpenBrace = getOpenBrace; + function getOpenBraceOfClassLike(declaration, sourceFile) { + return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1); + } + ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike; })(ts || (ts = {})); var ts; (function (ts) { @@ -53169,89 +58601,89 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205: + case 207: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223: + case 225: + case 148: case 147: - case 146: return spanInVariableDeclaration(node); - case 144: + case 145: return spanInParameterDeclaration(node); - case 225: + case 227: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 184: + case 153: + case 151: case 185: + case 186: return spanInFunctionDeclaration(node); - case 204: + case 206: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 231: + case 233: return spanInBlock(node); - case 256: + case 259: return spanInBlock(node.block); - case 207: + case 209: return textSpan(node.expression); - case 216: + case 218: return textSpan(node.getChildAt(0), node.expression); - case 210: + case 212: return textSpanEndingAtNextToken(node, node.expression); - case 209: + case 211: return spanInNode(node.statement); - case 222: + case 224: return textSpan(node.getChildAt(0)); - case 208: + case 210: return textSpanEndingAtNextToken(node, node.expression); - case 219: + case 221: return spanInNode(node.statement); - case 215: - case 214: + case 217: + case 216: return textSpan(node.getChildAt(0), node.label); - case 211: + case 213: return spanInForStatement(node); - case 212: + case 214: return textSpanEndingAtNextToken(node, node.expression); - case 213: + case 215: return spanInInitializerOfForLike(node); - case 218: + case 220: return textSpanEndingAtNextToken(node, node.expression); - case 253: - case 254: + case 256: + case 257: return spanInNode(node.statements[0]); - case 221: + case 223: return spanInBlock(node.tryBlock); - case 220: + case 222: return textSpan(node, node.expression); - case 240: + case 242: return textSpan(node, node.expression); - case 234: + case 236: return textSpan(node, node.moduleReference); - case 235: + case 237: return textSpan(node, node.moduleSpecifier); - case 241: + case 243: return textSpan(node, node.moduleSpecifier); - case 230: + case 232: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 226: - case 229: - case 260: - case 174: + case 228: + case 231: + case 263: + case 175: return textSpan(node); - case 217: + case 219: return spanInNode(node.statement); - case 145: + case 146: return spanInNodeArray(node.parent.decorators); - case 172: case 173: + case 174: return spanInBindingPattern(node); - case 227: - case 228: + case 229: + case 230: return undefined; case 24: case 1: @@ -53279,20 +58711,20 @@ var ts; case 73: case 86: return spanInNextNode(node); - case 140: + case 141: return spanInOfKeyword(node); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } if ((node.kind === 70 || - node.kind == 196 || - node.kind === 257 || - node.kind === 258) && + node.kind === 197 || + node.kind === 260 || + node.kind === 261) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192) { + if (node.kind === 193) { var binaryExpression = node; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); @@ -53307,38 +58739,38 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209: + case 211: return spanInPreviousNode(node); - case 145: + case 146: return spanInNode(node.parent); - case 211: case 213: + case 215: return textSpan(node); - case 192: + case 193: if (node.parent.operatorToken.kind === 25) { return textSpan(node); } break; - case 185: + case 186: if (node.parent.body === node) { return textSpan(node); } break; } } - if (node.parent.kind === 257 && + if (node.parent.kind === 260 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 182 && node.parent.type === node) { + if (node.parent.kind === 183 && node.parent.type === node) { return spanInNextNode(node.parent.type); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } - if ((node.parent.kind === 223 || - node.parent.kind === 144)) { + if ((node.parent.kind === 225 || + node.parent.kind === 145)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -53346,7 +58778,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192) { + if (node.parent.kind === 193) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -53358,8 +58790,8 @@ var ts; } } function textSpanFromVariableDeclaration(variableDeclaration) { - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] === variableDeclaration) { + if (variableDeclaration.parent.kind === 226 && + variableDeclaration.parent.declarations[0] === variableDeclaration) { return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); } else { @@ -53367,7 +58799,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 212) { + if (variableDeclaration.parent.parent.kind === 214) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -53375,11 +58807,11 @@ var ts; } if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || - variableDeclaration.parent.parent.kind === 213) { + variableDeclaration.parent.parent.kind === 215) { return textSpanFromVariableDeclaration(variableDeclaration); } - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] !== variableDeclaration) { + if (variableDeclaration.parent.kind === 226 && + variableDeclaration.parent.declarations[0] !== variableDeclaration) { return spanInNode(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent)); } } @@ -53407,7 +58839,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || - (functionDeclaration.parent.kind === 226 && functionDeclaration.kind !== 150); + (functionDeclaration.parent.kind === 228 && functionDeclaration.kind !== 151); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -53427,22 +58859,22 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230: + case 232: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 210: - case 208: case 212: + case 210: + case 214: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 211: case 213: + case 215: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224) { + if (forLikeStatement.initializer.kind === 226) { var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -53464,62 +58896,62 @@ var ts; } } function spanInBindingPattern(bindingPattern) { - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 174) { + if (bindingPattern.parent.kind === 175) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 && node.kind !== 172); - var elements = node.kind === 175 ? + ts.Debug.assert(node.kind !== 174 && node.kind !== 173); + var elements = node.kind === 176 ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node.parent.kind === 192 ? node.parent : node); + return textSpan(node.parent.kind === 193 ? node.parent : node); } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229: + case 231: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226: + case 228: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232: + case 234: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231: + case 233: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 229: - case 226: + case 231: + case 228: return textSpan(node); - case 204: + case 206: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 256: + case 259: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232: + case 234: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172: + case 173: var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -53532,7 +58964,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173: + case 174: var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -53544,33 +58976,33 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 || - node.parent.kind === 179 || - node.parent.kind === 180) { + if (node.parent.kind === 211 || + node.parent.kind === 180 || + node.parent.kind === 181) { return spanInPreviousNode(node); } - if (node.parent.kind === 183) { + if (node.parent.kind === 184) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 184: - case 225: case 185: + case 227: + case 186: + case 150: case 149: - case 148: - case 151: case 152: - case 150: - case 210: - case 209: + case 153: + case 151: + case 212: case 211: case 213: - case 179: + case 215: case 180: - case 183: + case 181: + case 184: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -53578,26 +59010,26 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 || - node.parent.kind === 144) { + node.parent.kind === 260 || + node.parent.kind === 145) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182) { + if (node.parent.kind === 183) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209) { + if (node.parent.kind === 211) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213) { + if (node.parent.kind === 215) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -53628,7 +59060,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 || - keyword2 === 133 || + keyword2 === 134 || keyword2 === 122 || keyword2 === 114) { return true; @@ -53641,9 +59073,9 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; - var length_4 = dense[i + 1]; + var length_5 = dense[i + 1]; var type = dense[i + 2]; if (lastEnd >= 0) { var whitespaceLength_1 = start - lastEnd; @@ -53651,8 +59083,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace }); } } - entries.push({ length: length_4, classification: convertClassification(type) }); - lastEnd = start + length_4; + entries.push({ length: length_5, classification: convertClassification(type) }); + lastEnd = start + length_5; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -53744,10 +59176,10 @@ var ts; angleBracketStack--; } else if (token === 118 || - token === 134 || + token === 135 || token === 132 || token === 121 || - token === 135) { + token === 136) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 70; } @@ -53902,7 +59334,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 && token <= 140; + return token >= 71 && token <= 141; } function classFromKind(token) { if (isKeyword(token)) { @@ -53948,10 +59380,10 @@ var ts; ts.getSemanticClassifications = getSemanticClassifications; function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 230: - case 226: + case 232: + case 228: + case 229: case 227: - case 225: cancellationToken.throwIfCancellationRequested(); } } @@ -53995,7 +59427,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 && + return declaration.kind === 232 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -54006,7 +59438,7 @@ var ts; checkForClassificationCancellation(cancellationToken, kind); if (kind === 70 && !ts.nodeIsMissing(node)) { var identifier = node; - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -54052,7 +59484,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -54136,16 +59568,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 281: + case 285: processJSDocParameterTag(tag); break; - case 284: + case 288: processJSDocTemplateTag(tag); break; - case 283: + case 287: processElement(tag.typeExpression); break; - case 282: + case 286: processElement(tag.typeExpression); break; } @@ -54226,22 +59658,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248: + case 250: if (token.parent.tagName === token) { return 19; } break; - case 249: + case 251: if (token.parent.tagName === token) { return 20; } break; - case 247: + case 249: if (token.parent.tagName === token) { return 21; } break; - case 250: + case 252: if (token.parent.name === token) { return 22; } @@ -54261,17 +59693,17 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 57) { - if (token.parent.kind === 223 || - token.parent.kind === 147 || - token.parent.kind === 144 || - token.parent.kind === 250) { + if (token.parent.kind === 225 || + token.parent.kind === 148 || + token.parent.kind === 145 || + token.parent.kind === 252) { return 5; } } - if (token.parent.kind === 192 || - token.parent.kind === 190 || + if (token.parent.kind === 193 || token.parent.kind === 191 || - token.parent.kind === 193) { + token.parent.kind === 192 || + token.parent.kind === 194) { return 5; } } @@ -54281,7 +59713,7 @@ var ts; return 4; } else if (tokenKind === 9) { - return token.parent.kind === 250 ? 24 : 6; + return token.parent.kind === 252 ? 24 : 6; } else if (tokenKind === 11) { return 6; @@ -54295,32 +59727,32 @@ var ts; else if (tokenKind === 70) { if (token) { switch (token.parent.kind) { - case 226: + case 228: if (token.parent.name === token) { return 11; } return; - case 143: + case 144: if (token.parent.name === token) { return 15; } return; - case 227: + case 229: if (token.parent.name === token) { return 13; } return; - case 229: + case 231: if (token.parent.name === token) { return 12; } return; - case 230: + case 232: if (token.parent.name === token) { return 14; } return; - case 144: + case 145: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 : 17; } @@ -54336,9 +59768,8 @@ var ts; } if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; if (!tryClassifyNode(child)) { processElement(child); } @@ -54352,208 +59783,25 @@ var ts; (function (ts) { var Completions; (function (Completions) { - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { - if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); - } - if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); - } - var completionData = getCompletionData(typeChecker, log, sourceFile, position); - if (!completionData) { - return undefined; - } - var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; - if (isJsDocTagName) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() }; - } - var entries = []; - if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); - } - else { - if (!symbols || symbols.length === 0) { - if (sourceFile.languageVariant === 1 && - location.parent && location.parent.kind === 249) { - var tagName = location.parent.parent.openingElement.tagName; - entries.push({ - name: tagName.text, - kind: undefined, - kindModifiers: undefined, - sortText: "0", - }); - } - else { - return undefined; - } - } - getCompletionEntriesFromSymbols(symbols, entries, location, true); - } - if (!isMemberCompletion && !isJsDocTagName) { - ts.addRange(entries, keywordCompletions); - } - return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_44 in nameTable) { - if (nameTable[name_44] === position) { - continue; - } - if (!uniqueNames[name_44]) { - uniqueNames[name_44] = name_44; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } - } - } - return entries; - } - function createCompletionEntry(symbol, location, performCharacterChecks) { - var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; - } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; - } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9) { - return undefined; - } - if (node.parent.kind === 257 && - node.parent.parent.kind === 176 && - node.parent.name === node) { - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 235 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - return getStringLiteralCompletionEntriesFromContextualType(node); - } - } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } - } - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; - } - return undefined; - } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - return undefined; - } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; - } - function addStringLiteralCompletionsFromType(type, result) { - if (!type) { - return; - } - if (type.flags & 65536) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); - } - } - } - function getStringLiteralCompletionEntriesFromModuleNames(node) { + var PathCompletions; + (function (PathCompletions) { + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { var literalValue = ts.normalizeSlashes(node.text); var scriptPath = node.getSourceFile().path; var scriptDirectory = ts.getDirectoryPath(scriptPath); var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); var entries; if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, false, span, compilerOptions, host, scriptPath); } else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, false, span, host, scriptPath); } } else { - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } return { isGlobalCompletion: false, @@ -54562,6 +59810,7 @@ var ts; entries: entries }; } + PathCompletions.getStringLiteralCompletionEntriesFromModuleNames = getStringLiteralCompletionEntriesFromModuleNames; function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); var relativeDirectory; @@ -54574,18 +59823,18 @@ var ts; } return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { var basePath = compilerOptions.project || host.getCurrentDirectory(); var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); var result = []; for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); } return result; } - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { if (result === void 0) { result = []; } if (fragment === undefined) { fragment = ""; @@ -54610,13 +59859,13 @@ var ts; continue; } var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - for (var foundFile in foundFiles) { + ts.forEachKey(foundFiles, function (foundFile) { result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); - } + }); } var directories = tryGetDirectories(host, baseDirectory); if (directories) { @@ -54629,14 +59878,14 @@ var ts; } return result; } - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; var result; if (baseUrl) { var fileExtensions = ts.getSupportedExtensions(compilerOptions); var projectDir = compilerOptions.project || host.getCurrentDirectory(); var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, false, span, host); if (paths) { for (var path in paths) { if (paths.hasOwnProperty(path)) { @@ -54644,7 +59893,7 @@ var ts; if (paths[path]) { for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { var match = _c[_b]; result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } @@ -54665,13 +59914,13 @@ var ts; result = []; } getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { var moduleName = _e[_d]; result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { if (host.readDirectory) { var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; if (parsed) { @@ -54694,8 +59943,8 @@ var ts; continue; } var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + var length_6 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_6))); } return result; } @@ -54703,7 +59952,7 @@ var ts; } return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); @@ -54738,7 +59987,7 @@ var ts; } return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { var token = ts.getTokenAtPosition(sourceFile, position); if (!token) { return undefined; @@ -54766,7 +60015,7 @@ var ts; var scriptPath = ts.getDirectoryPath(sourceFile.path); if (kind === "path") { var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, sourceFile.path); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), true, span_10, host, sourceFile.path); } else { var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; @@ -54775,6 +60024,7 @@ var ts; } return completionInfo; } + PathCompletions.getTripleSlashReferenceCompletion = getTripleSlashReferenceCompletion; function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { if (result === void 0) { result = []; } if (options.types) { @@ -54797,7 +60047,7 @@ var ts; } } if (host.getDirectories) { - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { var packageJson = _d[_c]; var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); getCompletionEntriesFromDirectories(host, typesDir, span, result); @@ -54817,7 +60067,7 @@ var ts; } } } - function findPackageJsons(currentDir) { + function findPackageJsons(currentDir, host) { var paths = []; var currentConfigPath; while (true) { @@ -54825,11 +60075,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } - currentDir = parent_13; + currentDir = parent; } else { break; @@ -54840,7 +60090,7 @@ var ts; function enumerateNodeModulesVisibleToScript(host, scriptPath) { var result = []; if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { var packageJson = _a[_i]; var contents = tryReadingPackageJson(packageJson); if (!contents) { @@ -54901,21 +60151,256 @@ var ts; function normalizeAndPreserveTrailingSlash(path) { return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } + var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105)) { - break; - } - } - } - } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 211: - case 212: - case 213: - case 209: - case 210: - return getLoopBreakContinueOccurrences(owner); - case 218: - return getSwitchCaseDefaultOccurrences(owner); + } + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 152); + tryPushAccessorKeyword(accessorDeclaration.symbol, 153); + return keywords; + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124, 134); }); + } + } + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 122); + }); + }); + return keywords; + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { + if (loopNode.kind === 211) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105)) { + break; } } - return undefined; } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); - ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71); - } - }); - }); - return ts.map(keywords, getHighlightSpanForNode); + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71, 76); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); - } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86); - } - return ts.map(keywords, getHighlightSpanForNode); + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213: + case 214: + case 215: + case 211: + case 212: + return getLoopBreakContinueOccurrences(owner); + case 220: + return getSwitchCaseDefaultOccurrences(owner); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97); + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 72, 78); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71); } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - if (ts.isFunctionBlock(owner)) { - ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + } + return keywords; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 206))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + while (hasKind(ifStatement.parent, 210) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 89); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 81)) { + break; } - return ts.map(keywords, getHighlightSpanForNode); } - function getReturnOccurrences(returnStatement) { - var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 204))) { - return undefined; - } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95); - }); - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getIfElseOccurrences(ifStatement) { - var keywords = []; - while (hasKind(ifStatement.parent, 208) && ifStatement.parent.elseStatement === ifStatement) { - ifStatement = ifStatement.parent; - } - while (ifStatement) { - var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 89); - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 81)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 208)) { + if (!hasKind(ifStatement.elseStatement, 210)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 81 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldCombindElseAndIf = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; break; } - ifStatement = ifStatement.elseStatement; } - var result = []; - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 81 && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; - var shouldCombindElseAndIf = true; - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; - continue; - } - } - result.push(getHighlightSpanForNode(keywords[i])); + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; + continue; } - return result; } + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); } + return result; } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 221; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -56110,15 +61574,15 @@ var ts; return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); } function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; + var bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + buckets.set(key, bucket = ts.createFileMap()); } return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); var sourceFiles = []; entries.forEachValue(function (key, entry) { sourceFiles.push({ @@ -56206,179 +61670,871 @@ var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { - var node = ts.getTouchingPropertyName(sourceFile, position, true); - if (node === sourceFile) { - return undefined; + function createImportTracker(sourceFiles, checker, cancellationToken) { + var allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken); + return function (exportSymbol, exportInfo, isForRename) { + var _a = getImportersForExport(sourceFiles, allDirectImports, exportInfo, checker, cancellationToken), directImports = _a.directImports, indirectUsers = _a.indirectUsers; + return __assign({ indirectUsers: indirectUsers }, getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename)); + }; + } + FindAllReferences.createImportTracker = createImportTracker; + var ExportKind; + (function (ExportKind) { + ExportKind[ExportKind["Named"] = 0] = "Named"; + ExportKind[ExportKind["Default"] = 1] = "Default"; + ExportKind[ExportKind["ExportEquals"] = 2] = "ExportEquals"; + })(ExportKind = FindAllReferences.ExportKind || (FindAllReferences.ExportKind = {})); + var ImportExport; + (function (ImportExport) { + ImportExport[ImportExport["Import"] = 0] = "Import"; + ImportExport[ImportExport["Export"] = 1] = "Export"; + })(ImportExport = FindAllReferences.ImportExport || (FindAllReferences.ImportExport = {})); + function getImportersForExport(sourceFiles, allDirectImports, _a, checker, cancellationToken) { + var exportingModuleSymbol = _a.exportingModuleSymbol, exportKind = _a.exportKind; + var markSeenDirectImport = ts.nodeSeenTracker(); + var markSeenIndirectUser = ts.nodeSeenTracker(); + var directImports = []; + var isAvailableThroughGlobal = !!exportingModuleSymbol.globalExports; + var indirectUserDeclarations = isAvailableThroughGlobal ? undefined : []; + handleDirectImports(exportingModuleSymbol); + return { directImports: directImports, indirectUsers: getIndirectUsers() }; + function getIndirectUsers() { + if (isAvailableThroughGlobal) { + return sourceFiles; + } + for (var _i = 0, _a = exportingModuleSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (ts.isExternalModuleAugmentation(decl)) { + addIndirectUser(decl); + } + } + return indirectUserDeclarations.map(ts.getSourceFileOfNode); } - switch (node.kind) { - case 8: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; + function handleDirectImports(exportingModuleSymbol) { + var theseDirectImports = getDirectImports(exportingModuleSymbol); + if (theseDirectImports) + for (var _i = 0, theseDirectImports_1 = theseDirectImports; _i < theseDirectImports_1.length; _i++) { + var direct = theseDirectImports_1[_i]; + if (!markSeenDirectImport(direct)) { + continue; + } + cancellationToken.throwIfCancellationRequested(); + switch (direct.kind) { + case 180: + if (!isAvailableThroughGlobal) { + var parent = direct.parent; + if (exportKind === 2 && parent.kind === 225) { + var name = parent.name; + if (name.kind === 70) { + directImports.push(name); + break; + } + } + addIndirectUser(direct.getSourceFile()); + } + break; + case 236: + handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1)); + break; + case 237: + var namedBindings = direct.importClause && direct.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239) { + handleNamespaceImport(direct, namedBindings.name); + } + else { + directImports.push(direct); + } + break; + case 243: + if (!direct.exportClause) { + handleDirectImports(getContainingModuleSymbol(direct, checker)); + } + else { + directImports.push(direct); + } + break; + } } - case 70: - case 98: - case 122: - case 9: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, false); } - return undefined; + function handleNamespaceImport(importDeclaration, name, isReExport) { + if (exportKind === 2) { + directImports.push(importDeclaration); + } + else if (!isAvailableThroughGlobal) { + var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); + ts.Debug.assert(sourceFileLike.kind === 264 || sourceFileLike.kind === 232); + if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { + addIndirectUsers(sourceFileLike); + } + else { + addIndirectUser(sourceFileLike); + } + } + } + function addIndirectUser(sourceFileLike) { + ts.Debug.assert(!isAvailableThroughGlobal); + var isNew = markSeenIndirectUser(sourceFileLike); + if (isNew) { + indirectUserDeclarations.push(sourceFileLike); + } + return isNew; + } + function addIndirectUsers(sourceFileLike) { + if (!addIndirectUser(sourceFileLike)) { + return; + } + var moduleSymbol = checker.getMergedSymbol(sourceFileLike.symbol); + ts.Debug.assert(!!(moduleSymbol.flags & 1536)); + var directImports = getDirectImports(moduleSymbol); + if (directImports) + for (var _i = 0, directImports_1 = directImports; _i < directImports_1.length; _i++) { + var directImport = directImports_1[_i]; + addIndirectUsers(getSourceFileLikeForImportDeclaration(directImport)); + } + } + function getDirectImports(moduleSymbol) { + return allDirectImports.get(ts.getSymbolId(moduleSymbol).toString()); + } + } + function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, checker, isForRename) { + var exportName = exportSymbol.name; + var importSearches = []; + var singleReferences = []; + function addSearch(location, symbol) { + importSearches.push([location, symbol]); + } + if (directImports) + for (var _i = 0, directImports_2 = directImports; _i < directImports_2.length; _i++) { + var decl = directImports_2[_i]; + handleImport(decl); + } + return { importSearches: importSearches, singleReferences: singleReferences }; + function handleImport(decl) { + if (decl.kind === 236) { + if (isExternalModuleImportEquals(decl)) { + handleNamespaceImportLike(decl.name); + } + return; + } + if (decl.kind === 70) { + handleNamespaceImportLike(decl); + return; + } + if (decl.moduleSpecifier.kind !== 9) { + return; + } + if (decl.kind === 243) { + searchForNamedImport(decl.exportClause); + return; + } + var importClause = decl.importClause; + var namedBindings = importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239) { + handleNamespaceImportLike(namedBindings.name); + return; + } + if (exportKind === 0) { + searchForNamedImport(namedBindings); + } + else { + var name = importClause.name; + if (name && (!isForRename || name.text === symbolName(exportSymbol))) { + var defaultImportAlias = checker.getSymbolAtLocation(name); + addSearch(name, defaultImportAlias); + } + if (!isForRename && exportKind === 1) { + ts.Debug.assert(exportName === "default"); + searchForNamedImport(namedBindings); + } + } + } + function handleNamespaceImportLike(importName) { + if (exportKind === 2 && (!isForRename || importName.text === exportName)) { + addSearch(importName, checker.getSymbolAtLocation(importName)); + } + } + function searchForNamedImport(namedBindings) { + if (namedBindings) + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var element = _a[_i]; + var name = element.name, propertyName = element.propertyName; + if ((propertyName || name).text !== exportName) { + continue; + } + if (propertyName) { + singleReferences.push(propertyName); + if (!isForRename) { + addSearch(name, checker.getSymbolAtLocation(name)); + } + } + else { + var localSymbol = element.kind === 245 && element.propertyName + ? checker.getExportSpecifierLocalTargetSymbol(element) + : checker.getSymbolAtLocation(name); + addSearch(name, localSymbol); + } + } + } + } + function findNamespaceReExports(sourceFileLike, name, checker) { + var namespaceImportSymbol = checker.getSymbolAtLocation(name); + return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { + if (statement.kind !== 243) + return; + var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; + if (moduleSpecifier || !exportClause) + return; + for (var _i = 0, _b = exportClause.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (checker.getExportSpecifierLocalTargetSymbol(element) === namespaceImportSymbol) { + return true; + } + } + }); + } + function getDirectImportsMap(sourceFiles, checker, cancellationToken) { + var map = ts.createMap(); + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; + cancellationToken.throwIfCancellationRequested(); + forEachImport(sourceFile, function (importDecl, moduleSpecifier) { + var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol) { + var id = ts.getSymbolId(moduleSymbol).toString(); + var imports = map.get(id); + if (!imports) { + map.set(id, imports = []); + } + imports.push(importDecl); + } + }); + } + return map; + } + function forEachPossibleImportOrExportStatement(sourceFileLike, action) { + return ts.forEach(sourceFileLike.kind === 264 ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); + }); + } + function forEachImport(sourceFile, action) { + if (sourceFile.externalModuleIndicator) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier = _a[_i]; + action(importerFromModuleSpecifier(moduleSpecifier), moduleSpecifier); + } + } + else { + forEachPossibleImportOrExportStatement(sourceFile, function (statement) { + switch (statement.kind) { + case 243: + case 237: { + var decl = statement; + if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9) { + action(decl, decl.moduleSpecifier); + } + break; + } + case 236: { + var decl = statement; + var moduleReference = decl.moduleReference; + if (moduleReference.kind === 247 && + moduleReference.expression.kind === 9) { + action(decl, moduleReference.expression); + } + break; + } + } + }); + if (sourceFile.flags & 65536) { + sourceFile.forEachChild(function recur(node) { + if (ts.isRequireCall(node, true)) { + action(node, node.arguments[0]); + } + else { + node.forEachChild(recur); + } + }); + } + } + } + function importerFromModuleSpecifier(moduleSpecifier) { + var decl = moduleSpecifier.parent; + if (decl.kind === 237 || decl.kind === 243) { + return decl; + } + ts.Debug.assert(decl.kind === 247); + return decl.parent; + } + function getImportOrExportSymbol(node, symbol, checker, comingFromExport) { + return comingFromExport ? getExport() : getExport() || getImport(); + function getExport() { + var parent = node.parent; + if (symbol.flags & 7340032) { + if (parent.kind === 178) { + return symbol.declarations.some(function (d) { return d === parent; }) && parent.parent.kind === 193 + ? getSpecialPropertyExport(parent.parent, false) + : undefined; + } + else { + var exportSymbol = symbol.exportSymbol; + ts.Debug.assert(!!exportSymbol); + return exportInfo(exportSymbol, getExportKindForDeclaration(parent)); + } + } + else { + var exportNode = parent.kind === 225 ? ts.getAncestor(parent, 207) : parent; + if (ts.hasModifier(exportNode, 1)) { + if (exportNode.kind === 236 && exportNode.moduleReference === node) { + if (comingFromExport) { + return undefined; + } + var lhsSymbol = checker.getSymbolAtLocation(exportNode.name); + return { kind: 0, symbol: lhsSymbol, isNamedImport: false }; + } + else { + return exportInfo(symbol, getExportKindForDeclaration(exportNode)); + } + } + else if (parent.kind === 242) { + var exportingModuleSymbol = parent.symbol.parent; + ts.Debug.assert(!!exportingModuleSymbol); + return { kind: 1, symbol: symbol, exportInfo: { exportingModuleSymbol: exportingModuleSymbol, exportKind: 2 } }; + } + else if (parent.kind === 193) { + return getSpecialPropertyExport(parent, true); + } + else if (parent.parent.kind === 193) { + return getSpecialPropertyExport(parent.parent, true); + } + } + function getSpecialPropertyExport(node, useLhsSymbol) { + var kind; + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 1: + kind = 0; + break; + case 2: + kind = 2; + break; + default: + return undefined; + } + var sym = useLhsSymbol ? checker.getSymbolAtLocation(node.left.name) : symbol; + return sym && exportInfo(sym, kind); + } + } + function getImport() { + var isImport = isNodeImport(node); + if (!isImport) + return; + var importedSymbol = checker.getImmediateAliasedSymbol(symbol); + if (importedSymbol) { + importedSymbol = skipExportSpecifierSymbol(importedSymbol, checker); + if (importedSymbol.name === "export=") { + importedSymbol = checker.getImmediateAliasedSymbol(importedSymbol); + } + if (symbolName(importedSymbol) === symbol.name) { + return __assign({ kind: 0, symbol: importedSymbol }, isImport); + } + } + } + function exportInfo(symbol, kind) { + var exportInfo = getExportInfo(symbol, kind, checker); + return exportInfo && { kind: 1, symbol: symbol, exportInfo: exportInfo }; + } + function getExportKindForDeclaration(node) { + return ts.hasModifier(node, 512) ? 1 : 0; + } + } + FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; + function isNodeImport(node) { + var parent = node.parent; + switch (parent.kind) { + case 236: + return parent.name === node && isExternalModuleImportEquals(parent) + ? { isNamedImport: false } + : undefined; + case 241: + return parent.propertyName ? undefined : { isNamedImport: true }; + case 238: + case 239: + ts.Debug.assert(parent.name === node); + return { isNamedImport: false }; + default: + return undefined; + } + } + function getExportInfo(exportSymbol, exportKind, checker) { + var exportingModuleSymbol = checker.getMergedSymbol(exportSymbol.parent); + return ts.isExternalModuleSymbol(exportingModuleSymbol) ? { exportingModuleSymbol: exportingModuleSymbol, exportKind: exportKind } : undefined; + } + FindAllReferences.getExportInfo = getExportInfo; + function symbolName(symbol) { + if (symbol.name !== "default") { + return symbol.name; + } + var name = ts.forEach(symbol.declarations, function (_a) { + var name = _a.name; + return name && name.kind === 70 && name.text; + }); + ts.Debug.assert(!!name); + return name; + } + function skipExportSpecifierSymbol(symbol, checker) { + if (symbol.declarations) + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) { + return checker.getExportSpecifierLocalTargetSymbol(declaration); + } + } + return symbol; + } + function getContainingModuleSymbol(importer, checker) { + return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); + } + function getSourceFileLikeForImportDeclaration(node) { + if (node.kind === 180) { + return node.getSourceFile(); + } + var parent = node.parent; + if (parent.kind === 264) { + return parent; + } + ts.Debug.assert(parent.kind === 233 && isAmbientModuleDeclaration(parent.parent)); + return parent.parent; + } + function isAmbientModuleDeclaration(node) { + return node.kind === 232 && node.name.kind === 9; + } + function isExternalModuleImportEquals(_a) { + var moduleReference = _a.moduleReference; + return moduleReference.kind === 247 && moduleReference.expression.kind === 9; + } + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var FindAllReferences; + (function (FindAllReferences) { + function nodeEntry(node, isInString) { + return { type: "node", node: node, isInString: isInString }; + } + FindAllReferences.nodeEntry = nodeEntry; + function findReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position) { + var referencedSymbols = findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position); + if (!referencedSymbols || !referencedSymbols.length) { + return undefined; + } + var out = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var _a = referencedSymbols_1[_i], definition = _a.definition, references = _a.references; + if (definition) { + out.push({ definition: definitionToReferencedSymbolDefinitionInfo(definition, checker), references: references.map(toReferenceEntry) }); + } + } + return out; } FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { - if (!implementations) { + function getImplementationsAtPosition(checker, cancellationToken, sourceFiles, sourceFile, position) { + var node = ts.getTouchingPropertyName(sourceFile, position); + var referenceEntries = getImplementationReferenceEntries(checker, cancellationToken, sourceFiles, node); + return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); }); + } + FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; + function getImplementationReferenceEntries(typeChecker, cancellationToken, sourceFiles, node) { + if (node.parent.kind === 261) { + var result_4 = []; + FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, function (node) { return result_4.push(nodeEntry(node)); }); + return result_4; + } + else if (node.kind === 96 || ts.isSuperProperty(node.parent)) { + var symbol = typeChecker.getSymbolAtLocation(node); + return symbol.valueDeclaration && [nodeEntry(symbol.valueDeclaration)]; + } + else { + return getReferenceEntriesForNode(node, sourceFiles, typeChecker, cancellationToken, { implementations: true }); + } + } + function findReferencedEntries(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var x = flattenEntries(findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options)); + return ts.map(x, toReferenceEntry); + } + FindAllReferences.findReferencedEntries = findReferencedEntries; + function getReferenceEntriesForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + return flattenEntries(FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options)); + } + FindAllReferences.getReferenceEntriesForNode = getReferenceEntriesForNode; + function findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var node = ts.getTouchingPropertyName(sourceFile, position, true); + return FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options); + } + function flattenEntries(referenceSymbols) { + return referenceSymbols && ts.flatMap(referenceSymbols, function (r) { return r.references; }); + } + function definitionToReferencedSymbolDefinitionInfo(def, checker) { + var info = (function () { + switch (def.type) { + case "symbol": { + var symbol = def.symbol, node_2 = def.node; + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var name_3 = displayParts_1.map(function (p) { return p.text; }).join(""); + return { node: node_2, name: name_3, kind: kind_1, displayParts: displayParts_1 }; + } + case "label": { + var node_3 = def.node; + return { node: node_3, name: node_3.text, kind: ts.ScriptElementKind.label, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + } + case "keyword": { + var node_4 = def.node; + var name_4 = ts.tokenToString(node_4.kind); + return { node: node_4, name: name_4, kind: ts.ScriptElementKind.keyword, displayParts: [{ text: name_4, kind: ts.ScriptElementKind.keyword }] }; + } + case "this": { + var node_5 = def.node; + var symbol = checker.getSymbolAtLocation(node_5); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; + return { node: node_5, name: "this", kind: ts.ScriptElementKind.variableElement, displayParts: displayParts_2 }; + } + case "string": { + var node_6 = def.node; + return { node: node_6, name: node_6.text, kind: ts.ScriptElementKind.variableElement, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + } + } + })(); + if (!info) { + return undefined; + } + var node = info.node, name = info.name, kind = info.kind, displayParts = info.displayParts; + var sourceFile = node.getSourceFile(); + return { + containerKind: "", + containerName: "", + fileName: sourceFile.fileName, + kind: kind, + name: name, + textSpan: ts.createTextSpanFromNode(node, sourceFile), + displayParts: displayParts + }; + } + function getDefinitionKindAndDisplayParts(symbol, node, checker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + return { displayParts: displayParts, kind: symbolKind }; + } + function toReferenceEntry(entry) { + if (entry.type === "span") { + return { textSpan: entry.textSpan, fileName: entry.fileName, isWriteAccess: false, isDefinition: false }; + } + var node = entry.node, isInString = entry.isInString; + return { + fileName: node.getSourceFile().fileName, + textSpan: getTextSpan(node), + isWriteAccess: isWriteAccess(node), + isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node), + isInString: isInString + }; + } + function toImplementationLocation(entry, checker) { + if (entry.type === "node") { + var node = entry.node; + return __assign({ textSpan: getTextSpan(node), fileName: node.getSourceFile().fileName }, implementationKindDisplayParts(node, checker)); + } + else { + var textSpan = entry.textSpan, fileName = entry.fileName; + return { textSpan: textSpan, fileName: fileName, kind: ts.ScriptElementKind.unknown, displayParts: [] }; + } + } + function implementationKindDisplayParts(node, checker) { + var symbol = checker.getSymbolAtLocation(ts.isDeclaration(node) && node.name ? node.name : node); + if (symbol) { + return getDefinitionKindAndDisplayParts(symbol, node, checker); + } + else if (node.kind === 177) { + return { + kind: ts.ScriptElementKind.interfaceElement, + displayParts: [ts.punctuationPart(18), ts.textPart("object literal"), ts.punctuationPart(19)] + }; + } + else if (node.kind === 198) { + return { + kind: ts.ScriptElementKind.localClassElement, + displayParts: [ts.punctuationPart(18), ts.textPart("anonymous local class"), ts.punctuationPart(19)] + }; + } + else { + return { kind: ts.getNodeKind(node), displayParts: [] }; + } + } + function toHighlightSpan(entry) { + if (entry.type === "span") { + var fileName_1 = entry.fileName, textSpan = entry.textSpan; + return { fileName: fileName_1, span: { textSpan: textSpan, kind: ts.HighlightSpanKind.reference } }; + } + var node = entry.node, isInString = entry.isInString; + var fileName = entry.node.getSourceFile().fileName; + var writeAccess = isWriteAccess(node); + var span = { + textSpan: getTextSpan(node), + kind: writeAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference, + isInString: isInString + }; + return { fileName: fileName, span: span }; + } + FindAllReferences.toHighlightSpan = toHighlightSpan; + function getTextSpan(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 9) { + start += 1; + end -= 1; + } + return ts.createTextSpanFromBounds(start, end); + } + function isWriteAccess(node) { + if (node.kind === 70 && ts.isDeclarationName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 192 || parent.kind === 191) { + return true; + } + else if (parent.kind === 193 && parent.left === node) { + var operator = parent.operatorToken.kind; + return 57 <= operator && operator <= 69; + } + } + return false; + } + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); +})(ts || (ts = {})); +(function (ts) { + var FindAllReferences; + (function (FindAllReferences) { + var Core; + (function (Core) { + function getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + if (node.kind === 264) { + return undefined; + } + if (!options.implementations) { + var special = getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken); + if (special) { + return special; + } + } + var symbol = checker.getSymbolAtLocation(node); + if (!symbol) { + if (!options.implementations && node.kind === 9) { + return getReferencesForStringLiteral(node, sourceFiles, cancellationToken); + } + return undefined; + } + if (!symbol.declarations || !symbol.declarations.length) { + return undefined; + } + return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options); + } + Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } if (ts.isLabelName(node)) { if (ts.isJumpStatementTarget(node)) { var labelDefinition = ts.getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition); } else { return getLabelReferencesInNode(node.parent, node); } } if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); + return getReferencesForThisKeyword(node, sourceFiles, cancellationToken); } if (node.kind === 96) { return getReferencesForSuperKeyword(node); } - } - var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9) { - return getReferencesForStringLiteral(node, sourceFiles); - } - if (!symbol) { return undefined; } - var declarations = symbol.declarations; - if (!declarations || !declarations.length) { - return undefined; - } - var result; - var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); - var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var scope = getSymbolScope(symbol); - var symbolToIndex = []; - if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); - } - else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; - cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + function getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options) { + symbol = skipPastExportOrImportSpecifier(symbol, node, checker); + var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), symbol.declarations); + var result = []; + var state = createState(sourceFiles, node, checker, cancellationToken, searchMeaning, options, result); + var search = state.createSearch(node, symbol, undefined, { allSearchSymbols: populateSearchSymbolSet(symbol, node, checker, options.implementations) }); + var scope = getSymbolScope(symbol); + if (scope) { + getReferencesInContainer(scope, scope.getSourceFile(), search, state); + } + else { + for (var _i = 0, _a = state.sourceFiles; _i < _a.length; _i++) { + var sourceFile = _a[_i]; + state.cancellationToken.throwIfCancellationRequested(); + searchForName(sourceFile, search, state); } } + return result; } - return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + function skipPastExportOrImportSpecifier(symbol, node, checker) { + var parent = node.parent; + if (ts.isExportSpecifier(parent)) { + return getLocalSymbolForExportSpecifier(node, symbol, parent, checker); + } + if (ts.isImportSpecifier(parent) && parent.propertyName === node) { + return checker.getImmediateAliasedSymbol(symbol); + } + return symbol; + } + function createState(sourceFiles, originalLocation, checker, cancellationToken, searchMeaning, options, result) { + var symbolIdToReferences = []; + var inheritsFromCache = ts.createMap(); + var sourceFileToSeenSymbols = []; + var isForConstructor = originalLocation.kind === 122; + var importTracker; + return __assign({}, options, { sourceFiles: sourceFiles, isForConstructor: isForConstructor, checker: checker, cancellationToken: cancellationToken, searchMeaning: searchMeaning, inheritsFromCache: inheritsFromCache, getImportSearches: getImportSearches, createSearch: createSearch, referenceAdder: referenceAdder, addStringOrCommentReference: addStringOrCommentReference, + markSearchedSymbol: markSearchedSymbol, markSeenContainingTypeReference: ts.nodeSeenTracker(), markSeenReExportRHS: ts.nodeSeenTracker() }); + function getImportSearches(exportSymbol, exportInfo) { + if (!importTracker) + importTracker = FindAllReferences.createImportTracker(sourceFiles, checker, cancellationToken); + return importTracker(exportSymbol, exportInfo, options.isForRename); + } + function createSearch(location, symbol, comingFrom, searchOptions) { + if (searchOptions === void 0) { searchOptions = {}; } + var _a = searchOptions.text, text = _a === void 0 ? ts.stripQuotes(ts.getDeclaredName(checker, symbol, location)) : _a, _b = searchOptions.allSearchSymbols, allSearchSymbols = _b === void 0 ? undefined : _b; + var escapedText = ts.escapeIdentifier(text); + var parents = options.implementations && getParentSymbolsOfPropertyAccess(location, symbol, checker); + return { location: location, symbol: symbol, comingFrom: comingFrom, text: text, escapedText: escapedText, parents: parents, includes: includes }; + function includes(referenceSymbol) { + return allSearchSymbols ? ts.contains(allSearchSymbols, referenceSymbol) : referenceSymbol === symbol; + } + } + function referenceAdder(referenceSymbol, searchLocation) { + var symbolId = ts.getSymbolId(referenceSymbol); + var references = symbolIdToReferences[symbolId]; + if (!references) { + references = symbolIdToReferences[symbolId] = []; + result.push({ definition: { type: "symbol", symbol: referenceSymbol, node: searchLocation }, references: references }); + } + return function (node) { return references.push(FindAllReferences.nodeEntry(node)); }; + } + function addStringOrCommentReference(fileName, textSpan) { + result.push({ + definition: undefined, + references: [{ type: "span", fileName: fileName, textSpan: textSpan }] + }); + } + function markSearchedSymbol(sourceFile, symbol) { + var sourceId = ts.getNodeId(sourceFile); + var symbolId = ts.getSymbolId(symbol); + var seenSymbols = sourceFileToSeenSymbols[sourceId] || (sourceFileToSeenSymbols[sourceId] = []); + return !seenSymbols[symbolId] && (seenSymbols[symbolId] = true); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608) { - var defaultImport = ts.getDeclarationOfKind(symbol, 236); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); + function searchForImportsOfExport(exportLocation, exportSymbol, exportInfo, state) { + var _a = state.getImportSearches(exportSymbol, exportInfo), importSearches = _a.importSearches, singleReferences = _a.singleReferences, indirectUsers = _a.indirectUsers; + if (singleReferences.length) { + var addRef = state.referenceAdder(exportSymbol, exportLocation); + for (var _i = 0, singleReferences_1 = singleReferences; _i < singleReferences_1.length; _i++) { + var singleRef = singleReferences_1[_i]; + addRef(singleRef); + } + } + for (var _b = 0, importSearches_1 = importSearches; _b < importSearches_1.length; _b++) { + var _c = importSearches_1[_b], importLocation = _c[0], importSymbol = _c[1]; + getReferencesInSourceFile(importLocation.getSourceFile(), state.createSearch(importLocation, importSymbol, 1), state); + } + if (indirectUsers.length) { + var indirectSearch = void 0; + switch (exportInfo.exportKind) { + case 0: + indirectSearch = state.createSearch(exportLocation, exportSymbol, 1); + break; + case 1: + indirectSearch = state.isForRename ? undefined : state.createSearch(exportLocation, exportSymbol, 1, { text: "default" }); + break; + case 2: + break; } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 || - declaration.kind === 243) ? declaration : undefined; }); - if (importOrExportSpecifier && - (!importOrExportSpecifier.propertyName || - importOrExportSpecifier.propertyName === location)) { - return importOrExportSpecifier.kind === 239 ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + if (indirectSearch) { + for (var _d = 0, indirectUsers_1 = indirectUsers; _d < indirectUsers_1.length; _d++) { + var indirectUser = indirectUsers_1[_d]; + searchForName(indirectUser, indirectSearch, state); + } } } - return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + function searchForImportedSymbol(symbol, state) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + getReferencesInSourceFile(declaration.getSourceFile(), state.createSearch(declaration, symbol, 0), state); + } + } + function searchForName(sourceFile, search, state) { + if (ts.getNameTable(sourceFile).get(search.escapedText) !== undefined) { + getReferencesInSourceFile(sourceFile, search, state); + } } - function getPropertySymbolOfDestructuringAssignment(location) { + function getPropertySymbolOfDestructuringAssignment(location, checker) { return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + checker.getPropertySymbolOfDestructuringAssignment(location); } function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); + var bindingElement = ts.getDeclarationOfKind(symbol, 175); return bindingElement && - bindingElement.parent.kind === 172 && + bindingElement.parent.kind === 173 && !bindingElement.propertyName; } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + var bindingElement = ts.getDeclarationOfKind(symbol, 175); + var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); } return undefined; } - function getInternedName(symbol, location) { - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); - } function getSymbolScope(symbol) { - var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 184 || valueDeclaration.kind === 197)) { + var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 185 || valueDeclaration.kind === 198)) { return valueDeclaration; } - if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); + if (!declarations) { + return undefined; + } + if (flags & (4 | 8192)) { + var privateDeclaration = ts.find(declarations, function (d) { return !!(ts.getModifierFlags(d) & 8); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226); + return ts.getAncestor(privateDeclaration, 228); } } - if (symbol.flags & 8388608) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { return undefined; } - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + if (parent && !((parent.flags & 1536) && ts.isExternalModuleSymbol(parent) && !parent.globalExports)) { return undefined; } - if (symbol.parent || (symbol.flags & 268435456)) { + if ((flags & 134217728 && symbol.checkFlags & 6)) { return undefined; } var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - return undefined; - } - if (container.kind === 261 && !ts.isExternalModule(container)) { - return undefined; - } - scope = container; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; + var container = ts.getContainerNode(declaration); + if (scope && scope !== container) { + return undefined; } + if (!container || container.kind === 264 && !ts.isExternalOrCommonJsModule(container)) { + return undefined; + } + scope = container; } - return scope; + return parent ? scope.getSourceFile() : scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { var positions = []; @@ -56390,7 +62546,6 @@ var ts; var symbolNameLength = symbolName.length; var position = text.indexOf(symbolName, start); while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); if (position > end) break; var endPosition = position + symbolNameLength; @@ -56407,242 +62562,277 @@ var ts; var sourceFile = container.getSourceFile(); var labelName = targetLabel.text; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.getWidth() !== labelName.length) { - return; + continue; } if (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "label", node: targetLabel }, references: references }]; } function isValidReferencePosition(node, searchSymbolName) { - if (node) { - switch (node.kind) { - case 70: - return node.getWidth() === searchSymbolName.length; - case 9: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + switch (node && node.kind) { + case 70: + return node.getWidth() === searchSymbolName.length; + case 9: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + node.getWidth() === searchSymbolName.length + 2; + case 8: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, ts.tokenToString(keywordKind), references); + } + return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd()); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push(FindAllReferences.nodeEntry(referenceLocation)); } } - return false; } - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); - if (!isValidReferencePosition(referenceLocation, searchText)) { - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, searchLocation.kind === 122, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); - } - } - }); + function getReferencesInSourceFile(sourceFile, search, state) { + state.cancellationToken.throwIfCancellationRequested(); + return getReferencesInContainer(sourceFile, sourceFile, search, state); + } + function getReferencesInContainer(container, sourceFile, search, state) { + if (!state.markSearchedSymbol(sourceFile, search.symbol)) { + return; } - return; - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } - } - } + var start = state.findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, search.text, start, container.getEnd()); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + getReferencesAtLocation(sourceFile, position, search, state); + } + } + function getReferencesAtLocation(sourceFile, position, search, state) { + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, search.text)) { + if (!state.implementations && (state.findInStrings && ts.isInString(sourceFile, position) || state.findInComments && ts.isInNonReferenceComment(sourceFile, position))) { + state.addStringOrCommentReference(sourceFile.fileName, ts.createTextSpan(position, search.text.length)); } + return; + } + if (!(ts.getMeaningFromLocation(referenceLocation) & state.searchMeaning)) { + return; + } + var referenceSymbol = state.checker.getSymbolAtLocation(referenceLocation); + if (!referenceSymbol) { + return; + } + var parent = referenceLocation.parent; + if (ts.isImportSpecifier(parent) && parent.propertyName === referenceLocation) { + return; + } + if (ts.isExportSpecifier(parent)) { + ts.Debug.assert(referenceLocation.kind === 70); + getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state); + return; + } + var relatedSymbol = getRelatedSymbol(search, referenceSymbol, referenceLocation, state); + if (!relatedSymbol) { + getReferenceForShorthandProperty(referenceSymbol, search, state); + return; + } + if (state.isForConstructor) { + findConstructorReferences(referenceLocation, sourceFile, search, state); } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + else { + addReference(referenceLocation, relatedSymbol, search.location, state); + } + getImportOrExportReferences(referenceLocation, referenceSymbol, search, state); + } + function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + var exportDeclaration = parent.parent; + var localSymbol = getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, state.checker); + if (!search.includes(localSymbol)) { + return; } - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - addReferences(findOwnConstructorCalls(searchSymbol)); + if (!propertyName) { + addRef(); + } + else if (referenceLocation === propertyName) { + if (!exportDeclaration.moduleSpecifier) { + addRef(); } - else { - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + if (!state.isForRename && state.markSeenReExportRHS(name)) { + addReference(name, referenceSymbol, name, state); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); + else { + if (state.markSeenReExportRHS(referenceLocation)) { + addRef(); } } - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } - }); - return result; + if (!(referenceLocation === propertyName && state.isForRename)) { + var exportKind = referenceLocation.originalKeywordKind === 78 ? 1 : 0; + var exportInfo = FindAllReferences.getExportInfo(referenceSymbol, exportKind, state.checker); + ts.Debug.assert(!!exportInfo); + searchForImportsOfExport(referenceLocation, referenceSymbol, exportInfo, state); } - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; + if (search.comingFrom !== 1 && exportDeclaration.moduleSpecifier && !propertyName) { + searchForImportedSymbol(state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier), state); + } + function addRef() { + addReference(referenceLocation, localSymbol, search.location, state); + } + } + function getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, checker) { + return isExportSpecifierAlias(referenceLocation, exportSpecifier) ? checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) : referenceSymbol; + } + function isExportSpecifierAlias(referenceLocation, exportSpecifier) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + ts.Debug.assert(propertyName === referenceLocation || name === referenceLocation); + if (propertyName) { + return propertyName === referenceLocation; + } + else { + return !parent.parent.moduleSpecifier; + } + } + function getImportOrExportReferences(referenceLocation, referenceSymbol, search, state) { + var importOrExport = FindAllReferences.getImportOrExportSymbol(referenceLocation, referenceSymbol, state.checker, search.comingFrom === 1); + if (!importOrExport) + return; + var symbol = importOrExport.symbol; + if (importOrExport.kind === 0) { + if (!state.isForRename || importOrExport.isNamedImport) { + searchForImportedSymbol(symbol, state); } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150); + } + else { + searchForImportsOfExport(referenceLocation, symbol, importOrExport.exportInfo, state); + } + } + function getReferenceForShorthandProperty(_a, search, state) { + var flags = _a.flags, valueDeclaration = _a.valueDeclaration; + var shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration); + if (!(flags & 134217728) && search.includes(shorthandValueSymbol)) { + addReference(valueDeclaration.name, shorthandValueSymbol, search.location, state); + } + } + function addReference(referenceLocation, relatedSymbol, searchLocation, state) { + var addRef = state.referenceAdder(relatedSymbol, searchLocation); + if (state.implementations) { + addImplementationReferences(referenceLocation, addRef, state); + } + else { + addRef(referenceLocation); + } + } + function findConstructorReferences(referenceLocation, sourceFile, search, state) { + if (ts.isNewExpressionTarget(referenceLocation)) { + addReference(referenceLocation, search.symbol, search.location, state); + } + var pusher = state.referenceAdder(search.symbol, search.location); + if (ts.isClassLike(referenceLocation.parent)) { + ts.Debug.assert(referenceLocation.parent.name === referenceLocation); + findOwnConstructorReferences(search.symbol, sourceFile, pusher); + } + else { + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending)) { + findSuperConstructorAccesses(classExtending, pusher); + } + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + function findOwnConstructorReferences(classSymbol, sourceFile, addNode) { + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122, sourceFile); + ts.Debug.assert(decl.kind === 151 && !!ctrKeyword); + addNode(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150) { var body = decl.body; if (body) { - forEachDescendantOfKind(body, 96, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); + forEachDescendantOfKind(body, 98, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + addNode(thisKeyword); } }); } } - ; - return result; + }); + } + function findSuperConstructorAccesses(cls, addNode) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return; } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96, function (node) { + if (ts.isCallExpressionTarget(node)) { + addNode(node); + } }); } - return result[index]; - } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } } } - function getImplementationReferenceEntryForNode(refNode, result) { + function addImplementationReferences(refNode, addReference, state) { if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + addReference(refNode.parent); + return; } - else if (refNode.kind === 70) { - if (refNode.parent.kind === 258) { - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); - } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); - } + if (refNode.kind !== 70) { + return; + } + if (refNode.parent.kind === 261) { + getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); + } + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + addReference(containingClass); + return; + } + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference && state.markSeenContainingTypeReference(containingTypeReference)) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + addReference(parent.initializer); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + addReference(returnStatement.expression); + } + }); } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (isImplementationExpression(parent.body)) { + addReference(parent.body); } } - } - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + addReference(parent.expression); } } } @@ -56671,28 +62861,32 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 199 - && node.parent.kind === 255 + if (node.kind === 200 + && node.parent.kind === 258 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 70 || node.kind === 177) { + else if (node.kind === 70 || node.kind === 178) { return getContainingClassIfInHeritageClause(node.parent); } } return undefined; } function isImplementationExpression(node) { - if (node.kind === 183) { - return isImplementationExpression(node.expression); + switch (node.kind) { + case 184: + return isImplementationExpression(node.expression); + case 186: + case 185: + case 177: + case 198: + case 176: + return true; + default: + return false; } - return node.kind === 185 || - node.kind === 184 || - node.kind === 176 || - node.kind === 197 || - node.kind === 175; } - function explicitlyInheritsFrom(child, parent, cachedResults) { + function explicitlyInheritsFrom(child, parent, cachedResults, checker) { var parentIsInterface = parent.getFlags() & 64; return searchHierarchy(child); function searchHierarchy(symbol) { @@ -56700,10 +62894,11 @@ var ts; return true; } var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; } - cachedResults[key] = false; + cachedResults.set(key, false); var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { if (ts.isClassLike(declaration)) { if (parentIsInterface) { @@ -56719,19 +62914,19 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227) { + else if (declaration.kind === 229) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; }); - cachedResults[key] = inherits; + cachedResults.set(key, inherits); return inherits; } function searchTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type && type.symbol) { return searchHierarchy(type.symbol); } @@ -56746,13 +62941,13 @@ var ts; } var staticFlag = 32; switch (searchSpaceNode.kind) { - case 147: - case 146: - case 149: case 148: + case 147: case 150: + case 149: case 151: case 152: + case 153: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; @@ -56762,51 +62957,51 @@ var ts; var references = []; var sourceFile = searchSpaceNode.getSourceFile(); var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.kind !== 96) { - return; + continue; } var container = ts.getSuperContainer(node, false); if (container && (32 & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "symbol", symbol: searchSpaceNode.symbol, node: superKeyword }, references: references }]; } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 32; switch (searchSpaceNode.kind) { + case 150: case 149: - case 148: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } + case 148: case 147: - case 146: - case 150: case 151: case 152: + case 153: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 261: + case 264: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 225: - case 184: + case 227: + case 185: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261) { + if (searchSpaceNode.kind === 264) { ts.forEach(sourceFiles, function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); }); @@ -56816,139 +63011,109 @@ var ts; possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, + definition: { type: "this", node: thisOrSuperKeyword }, references: references }]; function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); if (!node || !ts.isThis(node)) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 184: - case 225: + case 185: + case 227: if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; + case 150: case 149: - case 148: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 197: - case 226: + case 198: + case 228: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 261: - if (container.kind === 261 && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); + case 264: + if (container.kind === 264 && !ts.isExternalModule(container)) { + result.push(FindAllReferences.nodeEntry(node)); } break; } }); } } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - return undefined; - } + function getReferencesForStringLiteral(node, sourceFiles, cancellationToken) { var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; + cancellationToken.throwIfCancellationRequested(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, node.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, node.text, possiblePositions, references); } return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, + definition: { type: "string", node: node }, references: references }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9) { - return; - } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { + for (var _i = 0, possiblePositions_5 = possiblePositions; _i < possiblePositions_5.length; _i++) { + var position = possiblePositions_5[_i]; + var node_7 = ts.getTouchingWord(sourceFile, position); + if (node_7 && node_7.kind === 9 && node_7.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_7, true)); } } } } - function populateSearchSymbolSet(symbol, location) { + function populateSearchSymbolSet(symbol, location, checker, implementations) { var result = [symbol]; - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + if (containingObjectLiteralElement.kind !== 261) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); + if (propertySymbol) { + result.push(propertySymbol); + } + } + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), function (contextualSymbol) { + ts.addRange(result, checker.getRootSymbols(contextualSymbol)); }); - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + var shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { result.push(shorthandValueSymbol); } } - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 && + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + ts.addRange(result, checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); if (bindingElementPropertySymbol) { result.push(bindingElementPropertySymbol); } - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + for (var _i = 0, _a = checker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; if (rootSymbol !== symbol) { result.push(rootSymbol); } if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap()); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), checker); } - }); + } return result; } - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { if (!symbol) { return; } - if (symbol.name in previousIterationSymbolsCache) { + if (previousIterationSymbolsCache.has(symbol.name)) { return; } if (symbol.flags & (32 | 64)) { @@ -56957,7 +63122,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227) { + else if (declaration.kind === 229) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -56965,62 +63130,56 @@ var ts; return; function getPropertySymbolFromTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); + result.push.apply(result, checker.getRootSymbols(propertySymbol)); } - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); } } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) { + if (search.includes(referenceSymbol)) { + return referenceSymbol; } - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(referenceLocation); if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, state.checker), function (contextualSymbol) { + return ts.find(state.checker.getRootSymbols(contextualSymbol), search.includes); }); if (contextualSymbol) { return contextualSymbol; } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, state.checker); + if (propertySymbol && search.includes(propertySymbol)) { return propertySymbol; } } - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, state.checker); + if (bindingElementPropertySymbol && search.includes(bindingElementPropertySymbol)) { return bindingElementPropertySymbol; } - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { - if (searchSymbols.indexOf(rootSymbol) >= 0) { + return ts.forEach(state.checker.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (search.includes(rootSymbol)) { return rootSymbol; } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, state.checker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), state.checker); + return ts.find(result, search.includes); } return undefined; }); } function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142) { + if (node.name.kind === 143) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { return nameExpression.text; @@ -57029,15 +63188,15 @@ var ts; } return node.name.text; } - function getPropertySymbolsFromContextualType(node) { + function getPropertySymbolsFromContextualType(node, checker) { var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); + var contextualType = checker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); + var symbol = contextualType.getProperty(name); + if (symbol) { + result_5.push(symbol); } if (contextualType.flags & 65536) { ts.forEach(contextualType.types, function (t) { @@ -57056,8 +63215,8 @@ var ts; var lastIterationMeaning = void 0; do { lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; var declarationMeaning = ts.getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -57067,137 +63226,86 @@ var ts; } return meaning; } - } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; - function convertReferences(referenceSymbols) { - if (!referenceSymbols) { - return undefined; - } - var referenceEntries = []; - for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { - var referenceSymbol = referenceSymbols_1[_i]; - ts.addRange(referenceEntries, referenceSymbol.references); - } - return referenceEntries; - } - FindAllReferences.convertReferences = convertReferences; - function isImplementation(node) { - if (!node) { - return false; - } - else if (ts.isVariableLike(node)) { - if (node.initializer) { - return true; - } - else if (node.kind === 223) { - var parentStatement = getParentStatementOfVariableDeclaration(node); - return parentStatement && ts.hasModifier(parentStatement, 2); + function isImplementation(node) { + if (!node) { + return false; } - } - else if (ts.isFunctionLike(node)) { - return !!node.body || ts.hasModifier(node, 2); - } - else { - switch (node.kind) { - case 226: - case 197: - case 229: - case 230: + else if (ts.isVariableLike(node)) { + if (node.initializer) { return true; + } + else if (node.kind === 225) { + var parentStatement = getParentStatementOfVariableDeclaration(node); + return parentStatement && ts.hasModifier(parentStatement, 2); + } + } + else if (ts.isFunctionLike(node)) { + return !!node.body || ts.hasModifier(node, 2); + } + else { + switch (node.kind) { + case 228: + case 198: + case 231: + case 232: + return true; + } } + return false; } - return false; - } - function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205) { - ts.Debug.assert(node.parent.kind === 224); - return node.parent.parent; + function getParentStatementOfVariableDeclaration(node) { + if (node.parent && node.parent.parent && node.parent.parent.kind === 207) { + ts.Debug.assert(node.parent.kind === 226); + return node.parent.parent; + } } - } - function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) { - var refSymbol = typeChecker.getSymbolAtLocation(node); - var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); - if (shorthandSymbol) { - for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { - var declaration = _a[_i]; - if (ts.getMeaningFromDeclaration(declaration) & 1) { - result.push(getReferenceEntryFromNode(declaration)); + function getReferenceEntriesForShorthandPropertyAssignment(node, checker, addReference) { + var refSymbol = checker.getSymbolAtLocation(node); + var shorthandSymbol = checker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); + if (shorthandSymbol) { + for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.getMeaningFromDeclaration(declaration) & 1) { + addReference(declaration); + } } } } - } - FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; - function getReferenceEntryFromNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - if (node.kind === 9) { - start += 1; - end -= 1; + Core.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; + function forEachDescendantOfKind(node, kind, action) { + ts.forEachChild(node, function (child) { + if (child.kind === kind) { + action(child); + } + forEachDescendantOfKind(child, kind, action); + }); } - return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - isWriteAccess: isWriteAccess(node), - isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - }; - } - FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode; - function isWriteAccess(node) { - if (node.kind === 70 && ts.isDeclarationName(node)) { - return true; + function tryGetClassByExtendingIdentifier(node) { + return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); } - var parent = node.parent; - if (parent) { - if (parent.kind === 191 || parent.kind === 190) { - return true; - } - else if (parent.kind === 192 && parent.left === node) { - var operator = parent.operatorToken.kind; - return 57 <= operator && operator <= 69; + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 9) { + return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } + return false; } - return false; - } - function forEachDescendantOfKind(node, kind, action) { - ts.forEachChild(node, function (child) { - if (child.kind === kind) { - action(child); + function getParentSymbolsOfPropertyAccess(location, symbol, checker) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); + if (!propertyAccessExpression) { + return undefined; + } + var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); + if (!localParentType) { + return undefined; + } + if (localParentType.symbol && localParentType.symbol.flags & (32 | 64) && localParentType.symbol !== symbol.parent) { + return [localParentType.symbol]; + } + else if (localParentType.flags & 196608) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } - forEachDescendantOfKind(child, kind, action); - }); - } - function getContainingObjectLiteralElement(node) { - switch (node.kind) { - case 9: - case 8: - if (node.parent.kind === 142) { - return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; - } - case 70: - return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; - } - return undefined; - } - function isObjectLiteralPropertyDeclaration(node) { - switch (node.kind) { - case 257: - case 258: - case 149: - case 151: - case 152: - return true; - } - return false; - } - function tryGetClassByExtendingIdentifier(node) { - return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); - } - function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 9) { - return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } - return false; - } + })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); var ts; @@ -57215,11 +63323,9 @@ var ts; } var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -57228,7 +63334,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -57243,11 +63349,11 @@ var ts; var declaration = symbol.declarations[0]; if (node.kind === 70 && (node.parent === declaration || - (declaration.kind === 239 && declaration.parent && declaration.parent.kind === 238))) { + (declaration.kind === 241 && declaration.parent && declaration.parent.kind === 240))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 258) { + if (node.parent.kind === 261) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -57258,6 +63364,22 @@ var ts; var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } + if (ts.isJsxOpeningLikeElement(node.parent)) { + var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName; + return [createDefinitionInfo(symbol.valueDeclaration, symbolKind, symbolName, containerName)]; + } + var element = ts.getContainingObjectLiteralElement(node); + if (element) { + if (typeChecker.getContextualType(element.parent)) { + var result = []; + var propertySymbols = ts.getPropertySymbolsFromContextualType(typeChecker, element); + for (var _i = 0, propertySymbols_1 = propertySymbols; _i < propertySymbols_1.length; _i++) { + var propertySymbol = propertySymbols_1[_i]; + result.push.apply(result, getDefinitionFromSymbol(typeChecker, propertySymbol, node)); + } + return result; + } + } return getDefinitionFromSymbol(typeChecker, symbol, node); } GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition; @@ -57321,31 +63443,45 @@ var ts; return false; } function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + if (!signatureDeclarations) { + return false; + } var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150) || - (!selectConstructors && (d.kind === 225 || d.kind === 149 || d.kind === 148))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151: + case 227: + case 150: + case 149: + return true; + default: + return false; + } + } function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -57392,37 +63528,16 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; - } - })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var GoToImplementation; - (function (GoToImplementation) { - function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - if (node.parent.kind === 258) { - var result = []; - ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); - return result.length > 0 ? result : undefined; - } - else if (node.kind === 96 || ts.isSuperProperty(node.parent)) { - var symbol = typeChecker.getSymbolAtLocation(node); - return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)]; - } - else { - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, false, false, true); - var result = ts.flatMap(referencedSymbols, function (symbol) { - return ts.map(symbol.references, function (_a) { - var textSpan = _a.textSpan, fileName = _a.fileName; - return ({ textSpan: textSpan, fileName: fileName }); - }); - }); - return result && result.length > 0 ? result : undefined; + var signature = callLike && typeChecker.getResolvedSignature(callLike); + if (signature) { + var decl = signature.declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } } + return undefined; } - GoToImplementation.getImplementationAtPosition = getImplementationAtPosition; - })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {})); + })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); var ts; (function (ts) { @@ -57451,6 +63566,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -57469,7 +63585,8 @@ var ts; "prop", "version" ]; - var jsDocCompletionEntries; + var jsDocTagNameCompletionEntries; + var jsDocTagCompletionEntries; function getJsDocCommentsFromDeclarations(declarations) { var documentationComment = []; forEachUnique(declarations, function (declaration) { @@ -57490,9 +63607,32 @@ var ts; return documentationComment; } JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; + function getJsDocTagsFromDeclarations(declarations) { + var tags = []; + forEachUnique(declarations, function (declaration) { + var jsDocs = ts.getJSDocs(declaration); + if (!jsDocs) { + return; + } + for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) { + var doc = jsDocs_1[_i]; + var tagsForDoc = doc.tags; + if (tagsForDoc) { + tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 283; }).map(function (jsDocTag) { + return { + name: jsDocTag.tagName.text, + text: jsDocTag.comment + }; + })); + } + } + }); + return tags; + } + JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations; function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -57503,8 +63643,8 @@ var ts; } return undefined; } - function getAllJsDocCompletionEntries() { - return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + function getJSDocTagNameCompletions() { + return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: tagName, kind: ts.ScriptElementKind.keyword, @@ -57513,7 +63653,18 @@ var ts; }; })); } - JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries; + JsDoc.getJSDocTagNameCompletions = getJSDocTagNameCompletions; + function getJSDocTagCompletions() { + return jsDocTagCompletionEntries || (jsDocTagCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + return { + name: "@" + tagName, + kind: ts.ScriptElementKind.keyword, + kindModifiers: "", + sortText: "0" + }; + })); + } + JsDoc.getJSDocTagCompletions = getJSDocTagCompletions; function getDocCommentTemplateAtPosition(newLine, sourceFile, position) { if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { return undefined; @@ -57526,16 +63677,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225: - case 149: + case 227: case 150: - case 226: - case 205: + case 151: + case 228: + case 207: break findOwner; - case 261: + case 264: return undefined; - case 230: - if (commentOwner.parent.kind === 230) { + case 232: + if (commentOwner.parent.kind === 232) { return undefined; } break findOwner; @@ -57547,14 +63698,20 @@ var ts; var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; - var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character).replace(/\S/i, function () { return " "; }); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } var preamble = "/**" + newLine + indentationStr + " * "; @@ -57569,7 +63726,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205) { + if (commentOwner.kind === 207) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -57579,17 +63736,17 @@ var ts; return ts.emptyArray; } function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183) { + while (rightHandSide.kind === 184) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184: case 185: + case 186: return rightHandSide.parameters; - case 197: + case 198: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150) { + if (member.kind === 151) { return member.parameters; } } @@ -57600,47 +63757,212 @@ var ts; })(JsDoc = ts.JsDoc || (ts.JsDoc = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + var safeList; + var EmptySafeList = ts.createMap(); + JsTyping.nodeCoreModuleList = [ + "buffer", "querystring", "events", "http", "cluster", + "zlib", "os", "https", "punycode", "repl", "readline", + "vm", "child_process", "url", "dns", "net", + "dgram", "fs", "path", "string_decoder", "tls", + "crypto", "stream", "util", "assert", "tty", "domain", + "constants", "process", "v8", "timers", "console" + ]; + var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { + var inferredTypings = ts.createMap(); + if (!typeAcquisition || !typeAcquisition.enable) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { + var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); + return kind === 1 || kind === 2; + }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; + } + var filesToWatch = []; + var searchDirs = []; + var exclude = []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var bowerComponentsPath = ts.combinePaths(searchDir, "bower_components"); + getTypingNamesFromPackagesFolder(bowerComponentsPath); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromPackagesFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + if (unresolvedImports) { + for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { + var moduleId = unresolvedImports_1[_a]; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); + } + } + } + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); + } + }); + for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { + var excludeTypingName = exclude_1[_b]; + inferredTypings.delete(excludeTypingName); + } + var newTypingNames = []; + var cachedTypingPaths = []; + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); + } + else { + newTypingNames.push(typing); + } + }); + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); + } + } + } + function getTypingNamesFromJson(jsonPath, filesToWatch) { + if (host.fileExists(jsonPath)) { + filesToWatch.push(jsonPath); + } + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + if (jsonConfig.dependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); + } + } + } + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList !== EmptySafeList) { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + function getTypingNamesFromPackagesFolder(packagesFolderPath) { + filesToWatch.push(packagesFolderPath); + if (!host.directoryExists(packagesFolderPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(packagesFolderPath, [".json"], undefined, undefined, 2); + for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { + var fileName = fileNames_2[_i]; + var normalizedFileName = ts.normalizePath(fileName); + var baseFileName = ts.getBaseFileName(normalizedFileName); + if (baseFileName !== "package.json" && baseFileName !== "bower.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + if (baseFileName === "package.json" && packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings.set(packageJson.name, absolutePath); + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var NavigateTo; (function (NavigateTo) { function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_46 in nameToDeclarations) { - var declarations = nameToDeclarations[name_46]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; } - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) { + var declaration = declarations_12[_i]; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; } - matches = patternMatcher.getMatches(containers, name_46); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; + _loop_4(sourceFile); + } rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 || decl.kind === 239 || decl.kind === 234) { + if (decl.kind === 238 || decl.kind === 241 || decl.kind === 236) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -57681,7 +64003,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142) { + else if (declaration.name.kind === 143) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -57698,7 +64020,7 @@ var ts; } return true; } - if (expression.kind === 177) { + if (expression.kind === 178) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -57709,7 +64031,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -57750,7 +64072,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" }; @@ -57763,21 +64085,41 @@ var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { - function getNavigationBarItems(sourceFile) { + var whiteSpaceRegex = /\s+/g; + var curCancellationToken; + var curSourceFile; + var parentsStack = []; + var parent; + var emptyChildItemArray = []; + function getNavigationBarItems(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); - curSourceFile = undefined; - return result; + try { + return ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); + } + finally { + reset(); + } } NavigationBar.getNavigationBarItems = getNavigationBarItems; - function getNavigationTree(sourceFile) { + function getNavigationTree(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = convertToTree(rootNavigationBarNode(sourceFile)); - curSourceFile = undefined; - return result; + try { + return convertToTree(rootNavigationBarNode(sourceFile)); + } + finally { + reset(); + } } NavigationBar.getNavigationTree = getNavigationTree; - var curSourceFile; + function reset() { + curSourceFile = undefined; + curCancellationToken = undefined; + parentsStack = []; + parent = undefined; + emptyChildItemArray = []; + } function nodeText(node) { return node.getText(curSourceFile); } @@ -57792,8 +64134,6 @@ var ts; parent.children = [child]; } } - var parentsStack = []; - var parent; function rootNavigationBarNode(sourceFile) { ts.Debug.assert(!parentsStack.length); var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 }; @@ -57837,11 +64177,12 @@ var ts; endNode(); } function addChildrenRecursively(node) { + curCancellationToken.throwIfCancellationRequested(); if (!node || ts.isToken(node)) { return; } switch (node.kind) { - case 150: + case 151: var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); for (var _i = 0, _a = ctr.parameters; _i < _a.length; _i++) { @@ -57851,28 +64192,28 @@ var ts; } } break; - case 149: - case 151: + case 150: case 152: - case 148: + case 153: + case 149: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; + case 148: case 147: - case 146: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 236: + case 238: var importClause = node; if (importClause.name) { addLeafNode(importClause); } var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 239) { addLeafNode(namedBindings); } else { @@ -57883,12 +64224,12 @@ var ts; } } break; - case 174: - case 223: + case 175: + case 225: var decl = node; - var name_47 = decl.name; - if (ts.isBindingPattern(name_47)) { - addChildrenRecursively(name_47); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -57897,12 +64238,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; + case 186: + case 227: case 185: - case 225: - case 184: addNodeWithRecursiveChild(node, node.body); break; - case 229: + case 231: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -57912,9 +64253,9 @@ var ts; } endNode(); break; - case 226: - case 197: - case 227: + case 228: + case 198: + case 229: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -57922,21 +64263,21 @@ var ts; } endNode(); break; - case 230: + case 232: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243: - case 234: - case 155: - case 153: + case 245: + case 236: + case 156: case 154: - case 228: + case 155: + case 230: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285) { + if (tag.kind === 289) { addLeafNode(tag); } }); @@ -57952,9 +64293,9 @@ var ts; if (!name) { return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -57972,7 +64313,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -57984,12 +64325,12 @@ var ts; } }); function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 || areSameModule(a, b)); function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230) { + if (a.body.kind !== 232) { return true; } return areSameModule(a.body, b.body); @@ -58015,32 +64356,15 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; function tryGetName(node) { - if (node.kind === 230) { + if (node.kind === 232) { return getModuleName(node); } var decl = node; @@ -58048,18 +64372,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184: case 185: - case 197: + case 186: + case 198: return getFunctionOrClassName(node); - case 285: + case 289: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230) { + if (node.kind === 232) { return getModuleName(node); } var name = node.name; @@ -58070,29 +64394,29 @@ var ts; } } switch (node.kind) { - case 261: + case 264: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; + case 186: + case 227: case 185: - case 225: - case 184: - case 226: - case 197: + case 228: + case 198: if (ts.getModifierFlags(node) & 512) { return "default"; } return getFunctionOrClassName(node); - case 150: + case 151: return "constructor"; - case 154: + case 155: return "new()"; - case 153: + case 154: return "()"; - case 155: + case 156: return "[]"; - case 285: + case 289: return getJSDocTypedefTagName(node); default: return ""; @@ -58104,7 +64428,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 207) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -58132,24 +64456,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226: - case 197: + case 228: + case 198: + case 231: case 229: - case 227: + case 232: + case 264: case 230: - case 261: - case 228: - case 285: + case 289: return true; - case 150: - case 149: case 151: + case 150: case 152: - case 223: + case 153: + case 225: return hasSomeImportantChild(item); + case 186: + case 227: case 185: - case 225: - case 184: return isTopLevelFunctionDeclaration(item); default: return false; @@ -58159,10 +64483,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231: - case 261: - case 149: + case 233: + case 264: case 150: + case 151: return true; default: return hasSomeImportantChild(item); @@ -58171,17 +64495,16 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 && childKind !== 174; + return childKind !== 225 && childKind !== 175; }); } } } - var emptyChildItemArray = []; function convertToTree(n) { return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -58190,7 +64513,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -58226,35 +64549,41 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } return result.join("."); } function getInteriorModule(decl) { - return decl.body.kind === 230 ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142; + return !member.name || member.name.kind === 143; } function getNodeSpan(node) { - return node.kind === 261 + return node.kind === 264 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223) { + else if (node.parent.kind === 225) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 && + else if (node.parent.kind === 193 && node.parent.operatorToken.kind === 57) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 && node.parent.name) { + else if (node.parent.kind === 260 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -58265,38 +64594,37 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 || node.kind === 185 || node.kind === 197; + return node.kind === 185 || node.kind === 186 || node.kind === 198; } - var whiteSpaceRegex = /\s+/g; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); var ts; (function (ts) { var OutliningElementsCollector; (function (OutliningElementsCollector) { - function collectElements(sourceFile) { + function collectElements(sourceFile, cancellationToken) { var elements = []; var collapseText = "..."; function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { if (hintSpanNode && startElement && endElement) { - var span_12 = { + var span_13 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_12); + elements.push(span_13); } } function addOutliningSpanComments(commentSpan, autoCollapse) { if (commentSpan) { - var span_13 = { + var span_14 = { textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_13); + elements.push(span_14); } } function addOutliningForLeadingCommentsForNode(n) { @@ -58308,6 +64636,7 @@ var ts; var singleLineCommentCount = 0; for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) { var currentComment = comments_4[_i]; + cancellationToken.throwIfCancellationRequested(); if (currentComment.kind === 2) { if (isFirstSingleLineComment) { firstSingleLineCommentStart = currentComment.pos; @@ -58330,19 +64659,20 @@ var ts; function combineAndAddMultipleSingleLineComments(count, start, end) { if (count > 1) { var multipleSingleLineComments = { + kind: 2, pos: start, end: end, - kind: 2 }; addOutliningSpanComments(multipleSingleLineComments, false); } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185; + return ts.isFunctionBlock(node) && node.parent.kind !== 186; } var depth = 0; var maxDepth = 20; function walk(n) { + cancellationToken.throwIfCancellationRequested(); if (depth > maxDepth) { return; } @@ -58350,26 +64680,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204: + case 206: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_19.kind === 209 || - parent_19.kind === 212 || - parent_19.kind === 213 || - parent_19.kind === 211 || - parent_19.kind === 208 || - parent_19.kind === 210 || - parent_19.kind === 217 || - parent_19.kind === 256) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 || + parent.kind === 214 || + parent.kind === 215 || + parent.kind === 213 || + parent.kind === 210 || + parent.kind === 212 || + parent.kind === 219 || + parent.kind === 259) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221) { - var tryStatement = parent_19; + if (parent.kind === 223) { + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -58380,32 +64710,32 @@ var ts; } } } - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_15 = ts.createTextSpanFromNode(n); elements.push({ - textSpan: span_14, - hintSpan: span_14, + textSpan: span_15, + hintSpan: span_15, bannerText: collapseText, autoCollapse: autoCollapse(n) }); break; } - case 231: { + case 233: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226: - case 227: + case 228: case 229: - case 176: - case 232: { + case 231: + case 177: + case 234: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175: + case 176: var openBracket = ts.findChildOfKind(n, 20, sourceFile); var closeBracket = ts.findChildOfKind(n, 21, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -58482,10 +64812,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -58502,9 +64833,9 @@ var ts; if (index > 0) { var wordSpans = getWordSpans(candidate); for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span_15 = wordSpans_1[_i]; - if (partStartsWith(candidate, span_15, chunk.text, true)) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span_15, chunk.text, false)); + var span_16 = wordSpans_1[_i]; + if (partStartsWith(candidate, span_16, chunk.text, true)) { + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, partStartsWith(candidate, span_16, chunk.text, false)); } } } @@ -58667,7 +64998,8 @@ var ts; return str === str.toLowerCase(); } function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -58675,7 +65007,7 @@ var ts; return -1; } function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -58743,7 +65075,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -58917,7 +65249,7 @@ var ts; else { if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58943,7 +65275,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58957,7 +65289,7 @@ var ts; token = nextToken(); if (token === 70 || ts.isKeyword(token)) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58983,7 +65315,7 @@ var ts; } if (token === 17) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -58993,7 +65325,7 @@ var ts; } else if (token === 38) { token = nextToken(); - if (token === 138) { + if (token === 139) { token = nextToken(); if (token === 9) { recordModuleName(); @@ -59120,90 +65452,85 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, true); - if (node) { - if (node.kind === 70 || - node.kind === 9 || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + if (node.kind === 70 && + node.originalKeywordKind === 78 && + symbol.parent.flags & 1536) { + return undefined; } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9) { - start += 1; - width -= 2; + else if (node.kind === 9) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } - return ts.createTextSpan(start, width); + var displayName = ts.stripQuotes(node.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9) { + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 || + node.kind === 9 || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); var ts; @@ -59211,6 +65538,13 @@ var ts; var SignatureHelp; (function (SignatureHelp) { var emptyArray = []; + var ArgumentListKind; + (function (ArgumentListKind) { + ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; + ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; + ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; + ArgumentListKind[ArgumentListKind["JSXAttributesArguments"] = 3] = "JSXAttributesArguments"; + })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {})); function getSignatureHelpItems(program, sourceFile, position, cancellationToken) { var typeChecker = program.getTypeChecker(); var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position); @@ -59236,14 +65570,14 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179) { + if (argumentInfo.invocation.kind !== 180) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; var name = expression.kind === 70 ? expression - : expression.kind === 177 + : expression.kind === 178 ? expression.name : undefined; if (!name || !name.text) { @@ -59253,10 +65587,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { - for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { - var declaration = declarations_10[_b]; + for (var _b = 0, declarations_13 = declarations; _b < declarations_13.length; _b++) { + var declaration = declarations_13[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -59272,7 +65606,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 || node.parent.kind === 180) { + if (node.parent.kind === 180 || node.parent.kind === 181) { var callExpression = node.parent; if (node.kind === 26 || node.kind === 18) { @@ -59304,23 +65638,23 @@ var ts; } return undefined; } - else if (node.kind === 12 && node.parent.kind === 181) { + else if (node.kind === 12 && node.parent.kind === 182) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0, sourceFile); } } - else if (node.kind === 13 && node.parent.parent.kind === 181) { + else if (node.kind === 13 && node.parent.parent.kind === 182) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 && node.parent.parent.parent.kind === 181) { + else if (node.parent.kind === 204 && node.parent.parent.parent.kind === 182) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194); + ts.Debug.assert(templateExpression.kind === 195); if (node.kind === 15 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -59328,8 +65662,20 @@ var ts; var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position); return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } + else if (node.parent && ts.isJsxOpeningLikeElement(node.parent)) { + var attributeSpanStart = node.parent.attributes.getFullStart(); + var attributeSpanEnd = ts.skipTrivia(sourceFile.text, node.parent.attributes.getEnd(), false); + return { + kind: 3, + invocation: node.parent, + argumentsSpan: ts.createTextSpan(attributeSpanStart, attributeSpanEnd - attributeSpanStart), + argumentIndex: 0, + argumentCount: 1 + }; + } return undefined; } + SignatureHelp.getImmediatelyContainingArgumentInfo = getImmediatelyContainingArgumentInfo; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); @@ -59384,7 +65730,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 194) { + if (template.kind === 195) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -59393,7 +65739,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261; n = n.parent) { + for (var n = node; n.kind !== 264; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -59476,7 +65822,8 @@ var ts; suffixDisplayParts: suffixDisplayParts, separatorDisplayParts: [ts.punctuationPart(25), ts.spacePart()], parameters: signatureHelpParameters, - documentation: candidateSignature.getDocumentationComment() + documentation: candidateSignature.getDocumentationComment(), + tags: candidateSignature.getJsDocTags() }; }); var argumentIndex = argumentListInfo.argumentIndex; @@ -59523,9 +65870,9 @@ var ts; var SymbolDisplay; (function (SymbolDisplay) { function getSymbolKind(typeChecker, symbol, location) { - var flags = symbol.getFlags(); + var flags = symbol.flags; if (flags & 32) - return ts.getDeclarationOfKind(symbol, 197) ? + return ts.getDeclarationOfKind(symbol, 198) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384) return ts.ScriptElementKind.enumElement; @@ -59535,12 +65882,12 @@ var ts; return ts.ScriptElementKind.interfaceElement; if (flags & 262144) return ts.ScriptElementKind.typeParameterElement; - var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location); + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); if (result === ts.ScriptElementKind.unknown) { if (flags & 262144) return ts.ScriptElementKind.typeParameterElement; if (flags & 8) - return ts.ScriptElementKind.variableElement; + return ts.ScriptElementKind.enumMemberElement; if (flags & 8388608) return ts.ScriptElementKind.alias; if (flags & 1536) @@ -59549,7 +65896,7 @@ var ts; return result; } SymbolDisplay.getSymbolKind = getSymbolKind; - function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) { + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) { if (typeChecker.isUndefinedSymbol(symbol)) { return ts.ScriptElementKind.variableElement; } @@ -59559,6 +65906,7 @@ var ts; if (location.kind === 98 && ts.isExpression(location)) { return ts.ScriptElementKind.parameterElement; } + var flags = symbol.flags; if (flags & 3) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ts.ScriptElementKind.parameterElement; @@ -59582,7 +65930,7 @@ var ts; if (flags & 16384) return ts.ScriptElementKind.constructorImplementationElement; if (flags & 4) { - if (flags & 268435456) { + if (flags & 134217728 && symbol.checkFlags & 6) { var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); if (rootSymbolFlags & (98308 | 3)) { @@ -59599,6 +65947,9 @@ var ts; } return unionPropertyKind; } + if (location.parent && ts.isJsxAttribute(location.parent)) { + return ts.ScriptElementKind.jsxAttribute; + } return ts.ScriptElementKind.memberVariableElement; } return ts.ScriptElementKind.unknown; @@ -59613,8 +65964,9 @@ var ts; if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); } var displayParts = []; var documentation; + var tags; var symbolFlags = symbol.flags; - var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location); + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); var hasAddedSymbolInfo; var isThisExpression = location.kind === 98 && ts.isExpression(location); var type; @@ -59625,26 +65977,29 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177) { + if (location.parent && location.parent.kind === 178) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } - var callExpression = void 0; - if (location.kind === 179 || location.kind === 180) { - callExpression = location; + var callExpressionLike = void 0; + if (location.kind === 180 || location.kind === 181) { + callExpressionLike = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { - callExpression = location.parent; + callExpressionLike = location.parent; } - if (callExpression) { + else if (location.parent && ts.isJsxOpeningLikeElement(location.parent) && ts.isFunctionLike(symbol.valueDeclaration)) { + callExpressionLike = location.parent; + } + if (callExpressionLike) { var candidateSignatures = []; - signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures); + signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 || callExpression.expression.kind === 96; + var useConstructSignatures = callExpressionLike.kind === 181 || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 96); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -59668,6 +66023,7 @@ var ts; addPrefixForAnyFunctionOrVar(symbol, symbolKind); } switch (symbolKind) { + case ts.ScriptElementKind.jsxAttribute: case ts.ScriptElementKind.memberVariableElement: case ts.ScriptElementKind.variableElement: case ts.ScriptElementKind.constElement: @@ -59692,21 +66048,21 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 122 && location.parent.kind === 150)) { + (location.kind === 122 && location.parent.kind === 151)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150) { + if (functionDeclaration.kind === 151) { symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -59715,7 +66071,7 @@ var ts; } } if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197)) { + if (ts.getDeclarationOfKind(symbol, 198)) { pushTypePart(ts.ScriptElementKind.localClassElement); } else { @@ -59734,7 +66090,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -59755,7 +66111,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230); + var declaration = ts.getDeclarationOfKind(symbol, 232); var isNamespace = declaration && declaration.name && declaration.name.kind === 70; displayParts.push(ts.keywordPart(isNamespace ? 128 : 127)); displayParts.push(ts.spacePart()); @@ -59774,25 +66130,25 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var declaration = ts.getDeclarationOfKind(symbol, 143); + var declaration = ts.getDeclarationOfKind(symbol, 144); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154) { + if (declaration.kind === 155) { displayParts.push(ts.keywordPart(93)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 && declaration.name) { + else if (declaration.kind !== 154 && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } - else if (declaration.kind === 228) { + else if (declaration.kind === 230) { addInPrefix(); - displayParts.push(ts.keywordPart(136)); + displayParts.push(ts.keywordPart(137)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -59801,9 +66157,10 @@ var ts; } } if (symbolFlags & 8) { + symbolKind = ts.ScriptElementKind.enumMemberElement; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260) { + if (declaration.kind === 263) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -59815,7 +66172,7 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233) { + if (symbol.declarations[0].kind === 235) { displayParts.push(ts.keywordPart(83)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128)); @@ -59826,7 +66183,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234) { + if (declaration.kind === 236) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -59861,6 +66218,7 @@ var ts; addPrefixForAnyFunctionOrVar(symbol, symbolKind); } if (symbolKind === ts.ScriptElementKind.memberVariableElement || + symbolKind === ts.ScriptElementKind.jsxAttribute || symbolFlags & 3 || symbolKind === ts.ScriptElementKind.localVariableElement || isThisExpression) { @@ -59893,11 +66251,12 @@ var ts; } if (!documentation) { documentation = symbol.getDocumentationComment(); + tags = symbol.getJsDocTags(); if (documentation.length === 0 && symbol.flags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 264; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192) { + if (!declaration.parent || declaration.parent.kind !== 193) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -59905,6 +66264,7 @@ var ts; continue; } documentation = rhsSymbol.getDocumentationComment(); + tags = rhsSymbol.getJsDocTags(); if (documentation.length > 0) { break; } @@ -59912,7 +66272,7 @@ var ts; } } } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -59963,6 +66323,7 @@ var ts; displayParts.push(ts.punctuationPart(19)); } documentation = signature.getDocumentationComment(); + tags = signature.getJsDocTags(); } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { @@ -59977,14 +66338,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 184) { + if (declaration.kind === 185) { return true; } - if (declaration.kind !== 223 && declaration.kind !== 225) { + if (declaration.kind !== 225 && declaration.kind !== 227) { return false; } - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { - if (parent_20.kind === 261 || parent_20.kind === 231) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 264 || parent.kind === 233) { return false; } } @@ -60019,7 +66380,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); var outputText; @@ -60065,10 +66426,10 @@ var ts; var commandLineOptionsStringToEnum; function fixupCompilerOptions(options, diagnostics) { commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -60077,17 +66438,18 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } } }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_5(opt); } return options; } + ts.fixupCompilerOptions = fixupCompilerOptions; })(ts || (ts = {})); var ts; (function (ts) { @@ -60096,10 +66458,19 @@ var ts; var standardScanner = ts.createScanner(5, false, 0); var jsxScanner = ts.createScanner(5, false, 1); var scanner; - function getFormattingScanner(sourceFile, startPos, endPos) { + var ScanAction; + (function (ScanAction) { + ScanAction[ScanAction["Scan"] = 0] = "Scan"; + ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; + ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken"; + ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; + ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText"; + })(ScanAction || (ScanAction = {})); + function getFormattingScanner(text, languageVariant, startPos, endPos) { ts.Debug.assert(scanner === undefined, "Scanner should be undefined"); - scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner; - scanner.setText(sourceFile.text); + scanner = languageVariant === 1 ? jsxScanner : standardScanner; + scanner.setText(text); scanner.setTextPos(startPos); var wasNewLine = true; var leadingTrivia; @@ -60175,10 +66546,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { + case 252: case 250: - case 248: + case 251: case 249: - case 247: return node.kind === 70; } } @@ -60287,8 +66658,8 @@ var ts; } function isOnToken() { ts.Debug.assert(scanner !== undefined); - var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken(); + var startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos(); return startPos < endPos && current !== 1 && !ts.isTrivia(current); } function fixTokenKind(tokenInfo, container) { @@ -60389,6 +66760,20 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var formatting; + (function (formatting) { + var FormattingRequestKind; + (function (FormattingRequestKind) { + FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument"; + FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; + FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; + FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; + FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; + })(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var formatting; (function (formatting) { @@ -60410,6 +66795,19 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleAction; + (function (RuleAction) { + RuleAction[RuleAction["Ignore"] = 1] = "Ignore"; + RuleAction[RuleAction["Space"] = 2] = "Space"; + RuleAction[RuleAction["NewLine"] = 4] = "NewLine"; + RuleAction[RuleAction["Delete"] = 8] = "Delete"; + })(RuleAction = formatting.RuleAction || (formatting.RuleAction = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var formatting; (function (formatting) { @@ -60440,6 +66838,17 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleFlags; + (function (RuleFlags) { + RuleFlags[RuleFlags["None"] = 0] = "None"; + RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; + })(RuleFlags = formatting.RuleFlags || (formatting.RuleFlags = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var formatting; (function (formatting) { @@ -60511,10 +66920,10 @@ var ts; this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 141, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([19, 21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -60525,10 +66934,10 @@ var ts; this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19, 3, 80, 101, 86, 81]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8)); this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); @@ -60548,18 +66957,20 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109, 75]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19, 80, 81, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2)); this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101, 86]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 133]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 134]), 70), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127, 131]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 133, 114, 136, 138]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 138])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 134, 114, 137, 139, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 139])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); @@ -60573,7 +66984,7 @@ var ts; this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8)); this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 133, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116, 70, 83, 78, 74, 114, 113, 111, 112, 124, 134, 20, 38])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38, formatting.Shared.TokenRange.FromTokens([70, 18])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); @@ -60586,6 +66997,7 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, @@ -60614,7 +67026,7 @@ var ts; this.NoSpaceBetweenTagAndTemplateString, this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -60629,6 +67041,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; this.LowPriorityCommonRules = [ this.NoSpaceBeforeSemicolon, @@ -60637,7 +67050,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2)); @@ -60678,43 +67090,44 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_48 in o) { - if (o[name_48] === rule) { - return name_48; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 211; + return context.contextNode.kind === 213; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192: case 193: - case 200: - case 243: - case 239: - case 156: - case 164: + case 194: + case 201: + case 245: + case 241: + case 157: case 165: + case 166: return true; - case 174: - case 228: - case 234: - case 223: - case 144: - case 260: + case 175: + case 230: + case 236: + case 225: + case 145: + case 263: + case 148: case 147: - case 146: return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57; - case 212: + case 214: + case 144: return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; - case 213: - return context.currentTokenSpan.kind === 140 || context.nextTokenSpan.kind === 140; + case 215: + return context.currentTokenSpan.kind === 141 || context.nextTokenSpan.kind === 141; } return false; }; @@ -60722,11 +67135,14 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193; + return context.contextNode.kind === 194; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 173 || Rules.IsSingleLineBlockContext(context); + }; Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); }; @@ -60747,90 +67163,96 @@ var ts; return true; } switch (node.kind) { - case 204: - case 232: - case 176: - case 231: + case 206: + case 234: + case 177: + case 233: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225: + case 227: + case 150: case 149: - case 148: - case 151: case 152: case 153: - case 184: - case 150: + case 154: case 185: - case 227: + case 151: + case 186: + case 229: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 || context.contextNode.kind === 184; + return context.contextNode.kind === 227 || context.contextNode.kind === 185; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226: - case 197: - case 227: + case 228: + case 198: case 229: - case 161: - case 230: - case 241: - case 242: - case 235: - case 238: + case 231: + case 162: + case 232: + case 243: + case 244: + case 237: + case 240: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226: - case 230: - case 229: - case 204: - case 256: + case 228: + case 232: case 231: - case 218: + case 259: + case 233: + case 220: return true; + case 206: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 186 && + blockParent.kind !== 185) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208: - case 218: - case 211: - case 212: - case 213: case 210: - case 221: - case 209: - case 217: - case 256: + case 220: + case 213: + case 214: + case 215: + case 212: + case 223: + case 211: + case 219: + case 259: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176; + return context.contextNode.kind === 177; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179; + return context.contextNode.kind === 180; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180; + return context.contextNode.kind === 181; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -60842,25 +67264,25 @@ var ts; return context.nextTokenSpan.kind !== 21; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185; + return context.contextNode.kind === 186; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246; + return context.contextNode.kind !== 248; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252; + return context.contextNode.kind === 255; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250; + return context.nextTokenParent.kind === 252; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250; + return context.contextNode.kind === 252; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247; + return context.contextNode.kind === 249; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -60875,41 +67297,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145; + return node.kind === 146; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 && + return context.currentTokenParent.kind === 226 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230; + return context.contextNode.kind === 232; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161; + return context.contextNode.kind === 162; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 && token.kind !== 28) { return false; } switch (parent.kind) { - case 157: - case 182: - case 226: - case 197: + case 158: + case 183: + case 230: + case 228: + case 198: + case 229: case 227: - case 225: - case 184: case 185: + case 186: + case 150: case 149: - case 148: - case 153: case 154: - case 179: + case 155: case 180: - case 199: + case 181: + case 200: return true; default: return false; @@ -60920,13 +67343,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182; + return context.contextNode.kind === 183; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 188; + return context.currentTokenSpan.kind === 104 && context.currentTokenParent.kind === 189; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 && context.contextNode.expression !== undefined; + }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 202; }; return Rules; }()); @@ -60948,7 +67374,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 + 1; + this.mapRowLength = 141 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -60961,7 +67387,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 && column <= 140, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 && column <= 141, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -61125,7 +67551,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 140; token++) { + for (var token = 0; token <= 141; token++) { result.push(token); } return result; @@ -61169,9 +67595,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(71, 140); + TokenRange.Keywords = TokenRange.FromRange(71, 141); TokenRange.BinaryOperators = TokenRange.FromRange(26, 69); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 140, 117, 125]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91, 92, 141, 117, 125]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42, 43, 51, 50]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 70, 18, 20, 16, 98, 93]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); @@ -61179,7 +67605,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70, 18, 98, 93]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70, 19, 21, 93]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 134, 121, 135, 104, 118]); + TokenRange.TypeNames = TokenRange.FromTokens([70, 132, 135, 121, 136, 104, 118]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -61201,6 +67627,9 @@ var ts; RulesProvider.prototype.getRulesMap = function () { return this.rulesMap; }; + RulesProvider.prototype.getFormatOptions = function () { + return this.options; + }; RulesProvider.prototype.ensureUpToDate = function (options) { if (!this.options || !ts.compareDataObjects(this.options, options)) { var activeRules = this.createActiveRules(options); @@ -61212,6 +67641,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -61290,6 +67725,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -61315,6 +67756,10 @@ var ts; (function (ts) { var formatting; (function (formatting) { + var Constants; + (function (Constants) { + Constants[Constants["Unknown"] = -1] = "Unknown"; + })(Constants || (Constants = {})); function formatOnEnter(position, sourceFile, rulesProvider, options) { var line = sourceFile.getLineAndCharacterOfPosition(position).line; if (line === 0) { @@ -61387,17 +67832,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 226: - case 227: + case 228: + case 229: return ts.rangeContainsRange(parent.members, node); - case 230: + case 232: var body = parent.body; - return body && body.kind === 231 && ts.rangeContainsRange(body.statements, node); - case 261: - case 204: - case 231: + return body && body.kind === 233 && ts.rangeContainsRange(body.statements, node); + case 264: + case 206: + case 233: return ts.rangeContainsRange(parent.statements, node); - case 256: + case 259: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -61476,12 +67921,17 @@ var ts; } return 0; } + function formatNode(node, sourceFileLike, languageVariant, initialIndentation, delta, rulesProvider) { + var range = { pos: 0, end: sourceFileLike.text.length }; + return formatSpanWorker(range, node, initialIndentation, delta, formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end), rulesProvider.getFormatOptions(), rulesProvider, 1, function (_) { return false; }, sourceFileLike); + } + formatting.formatNode = formatNode; function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { - var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); - var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); var enclosingNode = findEnclosingNode(originalRange, sourceFile); - var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); - var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options), getOwnOrInheritedDelta(enclosingNode, options, sourceFile), formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end), options, rulesProvider, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); + } + function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, options, rulesProvider, requestKind, rangeContainsError, sourceFile) { + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); var previousRangeHasError; var previousRange; var previousParent; @@ -61496,7 +67946,6 @@ var ts; if (enclosingNode.decorators) { undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line; } - var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } if (!formattingScanner.isOnToken()) { @@ -61553,18 +68002,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226: return 74; - case 227: return 108; - case 225: return 88; - case 229: return 229; - case 151: return 124; - case 152: return 133; - case 149: + case 228: return 74; + case 229: return 108; + case 227: return 88; + case 231: return 231; + case 152: return 124; + case 153: return 134; + case 150: if (node.asteriskToken) { return 38; } - case 147: - case 144: + case 148: + case 145: return node.name.kind; } } @@ -61588,17 +68037,30 @@ var ts; switch (kind) { case 16: case 17: - case 20: - case 21: case 18: case 19: case 81: case 105: case 56: return indentation; - default: - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40: + case 28: { + if (container.kind === 250 || + container.kind === 251 || + container.kind === 249) { + return indentation; + } + break; + } + case 20: + case 21: { + if (container.kind !== 171) { + return indentation; + } + break; + } } + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -61639,7 +68101,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -61669,7 +68131,7 @@ var ts; if (tokenInfo.token.end > childStartPos) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -61680,11 +68142,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 && inheritedIndentation === -1) { + if (isFirstListItem && parent.kind === 176 && inheritedIndentation === -1) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -61704,10 +68166,10 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -61720,7 +68182,7 @@ var ts; if (formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -61910,7 +68372,7 @@ var ts; startLine++; } var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -62000,12 +68462,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 151: + case 227: + case 185: case 150: - case 225: - case 184: case 149: - case 148: - case 185: + case 186: if (node.typeParameters === list) { return 26; } @@ -62013,8 +68475,8 @@ var ts; return 18; } break; - case 179: case 180: + case 181: if (node.typeArguments === list) { return 26; } @@ -62022,7 +68484,7 @@ var ts; return 18; } break; - case 157: + case 158: if (node.typeArguments === list) { return 26; } @@ -62095,7 +68557,12 @@ var ts; (function (formatting) { var SmartIndenter; (function (SmartIndenter) { - function getIndentation(position, sourceFile, options) { + var Value; + (function (Value) { + Value[Value["Unknown"] = -1] = "Unknown"; + })(Value || (Value = {})); + function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { + if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } if (position > sourceFile.text.length) { return getBaseIndentation(options); } @@ -62123,7 +68590,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 && precedingToken.parent.kind !== 192) { + if (precedingToken.kind === 25 && precedingToken.parent.kind !== 193) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -62136,8 +68603,9 @@ var ts; while (current) { if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); - if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { - indentationDelta = 0; + var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); + if (nextTokenKind !== 0) { + indentationDelta = assumeNewLineBeforeCloseBrace && nextTokenKind === 2 ? options.indentSize : 0; } else { indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0; @@ -62225,31 +68693,37 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 || !parentAndChildShareLine); + (parent.kind === 264 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); } + var NextTokenKind; + (function (NextTokenKind) { + NextTokenKind[NextTokenKind["Unknown"] = 0] = "Unknown"; + NextTokenKind[NextTokenKind["OpenBrace"] = 1] = "OpenBrace"; + NextTokenKind[NextTokenKind["CloseBrace"] = 2] = "CloseBrace"; + })(NextTokenKind || (NextTokenKind = {})); function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { var nextToken = ts.findNextToken(precedingToken, current); if (!nextToken) { - return false; + return 0; } if (nextToken.kind === 16) { - return true; + return 1; } else if (nextToken.kind === 17) { var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; - return lineAtPosition === nextTokenStartLine; + return lineAtPosition === nextTokenStartLine ? 2 : 0; } - return false; + return 0; } function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 && parent.elseStatement === child) { + if (parent.kind === 210 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -62258,53 +68732,49 @@ var ts; return false; } SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getListIfStartEndIsInListRange(list, start, end) { + return list && ts.rangeContainsStartEnd(list, start, end) ? list : undefined; + } function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157: - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { - return node.parent.typeArguments; - } - break; - case 176: + case 158: + return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); + case 177: return node.parent.properties; - case 175: + case 176: return node.parent.elements; - case 225: - case 184: + case 227: case 185: + case 186: + case 150: case 149: - case 148: - case 153: - case 154: { + case 154: + case 151: + case 160: + case 155: { var start = node.getStart(sourceFile); - if (node.parent.typeParameters && - ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; - } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 180: - case 179: { + case 228: + return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); + case 181: + case 180: { var start = node.getStart(sourceFile); - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { - return node.parent.typeArguments; - } - if (node.parent.arguments && - ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { - return node.parent.arguments; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } + case 226: + return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); + case 240: + case 244: + return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } return undefined; } + SmartIndenter.getContainingList = getContainingList; function getActualIndentationForListItem(node, sourceFile, options) { var containingList = getContainingList(node, sourceFile); return containingList ? getActualIndentationFromList(containingList) : -1; @@ -62317,8 +68787,8 @@ var ts; if (node.kind === 19) { return -1; } - if (node.parent && (node.parent.kind === 179 || - node.parent.kind === 180) && + if (node.parent && (node.parent.kind === 180 || + node.parent.kind === 181) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -62336,10 +68806,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179: case 180: - case 177: + case 181: case 178: + case 179: node = node.expression; break; default: @@ -62393,48 +68863,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 207: - case 226: - case 197: - case 227: - case 229: + case 209: case 228: - case 175: - case 204: + case 198: + case 229: case 231: + case 230: case 176: - case 161: - case 163: - case 232: - case 254: - case 253: - case 183: + case 206: + case 233: case 177: - case 179: + case 162: + case 171: + case 164: + case 234: + case 257: + case 256: + case 184: + case 178: case 180: - case 205: - case 223: - case 240: - case 216: - case 193: + case 181: + case 207: + case 225: + case 242: + case 218: + case 194: + case 174: case 173: - case 172: - case 248: - case 247: - case 252: - case 148: - case 153: + case 250: + case 249: + case 255: + case 149: case 154: - case 144: - case 158: + case 155: + case 145: case 159: - case 166: - case 181: - case 189: - case 242: - case 238: - case 243: - case 239: + case 160: + case 167: + case 182: + case 190: + case 244: + case 240: + case 245: + case 241: return true; } return false; @@ -62442,27 +68913,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { - case 209: - case 210: + case 211: case 212: + case 214: + case 215: case 213: - case 211: - case 208: - case 225: - case 184: - case 149: + case 210: + case 227: case 185: case 150: + case 186: case 151: case 152: - return childKind !== 204; - case 241: - return childKind !== 242; - case 235: - return childKind !== 236 || - (child.namedBindings && child.namedBindings.kind !== 238); - case 246: - return childKind !== 249; + case 153: + return childKind !== 206; + case 243: + return childKind !== 244; + case 237: + return childKind !== 238 || + (child.namedBindings && child.namedBindings.kind !== 240); + case 248: + return childKind !== 251; } return indentByDefault; } @@ -62475,10 +68946,503 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var textChanges; + (function (textChanges) { + function getPos(n) { + return n["__pos"]; + } + function setPos(n, pos) { + n["__pos"] = pos; + } + function getEnd(n) { + return n["__end"]; + } + function setEnd(n, end) { + n["__end"] = end; + } + var Position; + (function (Position) { + Position[Position["FullStart"] = 0] = "FullStart"; + Position[Position["Start"] = 1] = "Start"; + })(Position = textChanges.Position || (textChanges.Position = {})); + function skipWhitespacesAndLineBreaks(text, start) { + return ts.skipTrivia(text, start, false, true); + } + function hasCommentsBeforeLineBreak(text, start) { + var i = start; + while (i < text.length) { + var ch = text.charCodeAt(i); + if (ts.isWhiteSpaceSingleLine(ch)) { + i++; + continue; + } + return ch === 47; + } + return false; + } + function getSeparatorCharacter(separator) { + return ts.tokenToString(separator.kind); + } + textChanges.getSeparatorCharacter = getSeparatorCharacter; + function getAdjustedStartPosition(sourceFile, node, options, position) { + if (options.useNonAdjustedStartPosition) { + return node.getFullStart(); + } + var fullStart = node.getFullStart(); + var start = node.getStart(sourceFile); + if (fullStart === start) { + return start; + } + var fullStartLine = ts.getLineStartPositionForPosition(fullStart, sourceFile); + var startLine = ts.getLineStartPositionForPosition(start, sourceFile); + if (startLine === fullStartLine) { + return position === Position.Start ? start : fullStart; + } + var adjustedStartPosition = ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, fullStartLine) + 1, sourceFile); + adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition); + return ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile); + } + textChanges.getAdjustedStartPosition = getAdjustedStartPosition; + function getAdjustedEndPosition(sourceFile, node, options) { + if (options.useNonAdjustedEndPosition) { + return node.getEnd(); + } + var end = node.getEnd(); + var newEnd = ts.skipTrivia(sourceFile.text, end, true); + return newEnd !== end && ts.isLineBreak(sourceFile.text.charCodeAt(newEnd - 1)) + ? newEnd + : end; + } + textChanges.getAdjustedEndPosition = getAdjustedEndPosition; + function isSeparator(node, candidate) { + return candidate && node.parent && (candidate.kind === 25 || (candidate.kind === 24 && node.parent.kind === 177)); + } + function spaces(count) { + var s = ""; + for (var i = 0; i < count; i++) { + s += " "; + } + return s; + } + var ChangeTracker = (function () { + function ChangeTracker(newLine, rulesProvider, validator) { + this.newLine = newLine; + this.rulesProvider = rulesProvider; + this.validator = validator; + this.changes = []; + this.newLineCharacter = ts.getNewLineCharacter({ newLine: newLine }); + } + ChangeTracker.fromCodeFixContext = function (context) { + return new ChangeTracker(context.newLineCharacter === "\n" ? 1 : 0, context.rulesProvider); + }; + ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, node, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteRange = function (sourceFile, range) { + this.changes.push({ sourceFile: sourceFile, range: range }); + return this; + }; + ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteNodeInList = function (sourceFile, node) { + var containingList = ts.formatting.SmartIndenter.getContainingList(node, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(node); + if (index < 0) { + return this; + } + if (containingList.length === 1) { + this.deleteNode(sourceFile, node); + return this; + } + if (index !== containingList.length - 1) { + var nextToken = ts.getTokenAtPosition(sourceFile, node.end); + if (nextToken && isSeparator(node, nextToken)) { + var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), false, true); + var nextElement = containingList[index + 1]; + var endPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, nextElement, {}, Position.FullStart), false, true); + this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); + } + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end); + if (previousToken && isSeparator(node, previousToken)) { + this.deleteNodeRange(sourceFile, previousToken, node); + } + } + return this; + }; + ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, range: range, options: options, node: newNode }); + return this; + }; + ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, oldNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, oldNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, options: options, node: newNode, range: { pos: pos, end: pos } }); + return this; + }; + ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, before, options, Position.Start); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: startPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode, options) { + if (options === void 0) { options = {}; } + if ((ts.isStatementButNotDeclaration(after)) || + after.kind === 148 || + after.kind === 147 || + after.kind === 149) { + if (sourceFile.text.charCodeAt(after.end - 1) !== 59) { + this.changes.push({ + sourceFile: sourceFile, + options: {}, + range: { pos: after.end, end: after.end }, + node: ts.createToken(24) + }); + } + } + var endPosition = getAdjustedEndPosition(sourceFile, after, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: endPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode) { + var containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(after); + if (index < 0) { + return this; + } + var end = after.getEnd(); + if (index !== containingList.length - 1) { + var nextToken = ts.getTokenAtPosition(sourceFile, after.end); + if (nextToken && isSeparator(after, nextToken)) { + var lineAndCharOfNextElement = ts.getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart())); + var lineAndCharOfNextToken = ts.getLineAndCharacterOfPosition(sourceFile, nextToken.end); + var prefix = void 0; + var startPos = void 0; + if (lineAndCharOfNextToken.line === lineAndCharOfNextElement.line) { + startPos = nextToken.end; + prefix = spaces(lineAndCharOfNextElement.character - lineAndCharOfNextToken.character); + } + else { + startPos = ts.getStartPositionOfLine(lineAndCharOfNextElement.line, sourceFile); + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: startPos, end: containingList[index + 1].getStart(sourceFile) }, + node: newNode, + useIndentationFromFile: true, + options: { + prefix: prefix, + suffix: "" + ts.tokenToString(nextToken.kind) + sourceFile.text.substring(nextToken.end, containingList[index + 1].getStart(sourceFile)) + } + }); + } + } + else { + var afterStart = after.getStart(sourceFile); + var afterStartLinePosition = ts.getLineStartPositionForPosition(afterStart, sourceFile); + var separator = void 0; + var multilineList = false; + if (containingList.length === 1) { + separator = 25; + } + else { + var tokenBeforeInsertPosition = ts.findPrecedingToken(after.pos, sourceFile); + separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 25; + var afterMinusOneStartLinePosition = ts.getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); + multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; + } + if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) { + multilineList = true; + } + if (multilineList) { + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: ts.createToken(separator), + options: {} + }); + var indentation = ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(afterStartLinePosition, afterStart, sourceFile, this.rulesProvider.getFormatOptions()); + var insertPos = ts.skipTrivia(sourceFile.text, end, true, false); + if (insertPos !== end && ts.isLineBreak(sourceFile.text.charCodeAt(insertPos - 1))) { + insertPos--; + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: insertPos, end: insertPos }, + node: newNode, + options: { indentation: indentation, prefix: this.newLineCharacter } + }); + } + else { + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: newNode, + options: { prefix: ts.tokenToString(separator) + " " } + }); + } + } + return this; + }; + ChangeTracker.prototype.getChanges = function () { + var _this = this; + var changesPerFile = ts.createFileMap(); + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var c = _a[_i]; + var changesInFile = changesPerFile.get(c.sourceFile.path); + if (!changesInFile) { + changesPerFile.set(c.sourceFile.path, changesInFile = []); + } + changesInFile.push(c); + } + var fileChangesList = []; + changesPerFile.forEachValue(function (path) { + var changesInFile = changesPerFile.get(path); + var sourceFile = changesInFile[0].sourceFile; + var fileTextChanges = { fileName: sourceFile.fileName, textChanges: [] }; + for (var _i = 0, _a = ChangeTracker.normalize(changesInFile); _i < _a.length; _i++) { + var c = _a[_i]; + fileTextChanges.textChanges.push({ + span: _this.computeSpan(c, sourceFile), + newText: _this.computeNewText(c, sourceFile) + }); + } + fileChangesList.push(fileTextChanges); + }); + return fileChangesList; + }; + ChangeTracker.prototype.computeSpan = function (change, _sourceFile) { + return ts.createTextSpanFromBounds(change.range.pos, change.range.end); + }; + ChangeTracker.prototype.computeNewText = function (change, sourceFile) { + if (!change.node) { + return ""; + } + var options = change.options || {}; + var nonFormattedText = getNonformattedText(change.node, sourceFile, this.newLine); + if (this.validator) { + this.validator(nonFormattedText); + } + var formatOptions = this.rulesProvider.getFormatOptions(); + var pos = change.range.pos; + var posStartsLine = ts.getLineStartPositionForPosition(pos, sourceFile) === pos; + var initialIndentation = change.options.indentation !== undefined + ? change.options.indentation + : change.useIndentationFromFile + ? ts.formatting.SmartIndenter.getIndentation(change.range.pos, sourceFile, formatOptions, posStartsLine || (change.options.prefix === this.newLineCharacter)) + : 0; + var delta = change.options.delta !== undefined + ? change.options.delta + : ts.formatting.SmartIndenter.shouldIndentChildNode(change.node) + ? formatOptions.indentSize + : 0; + var text = applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, this.rulesProvider); + text = posStartsLine || change.options.indentation !== undefined ? text : text.replace(/^\s+/, ""); + return (options.prefix || "") + text + (options.suffix || ""); + }; + ChangeTracker.normalize = function (changes) { + var normalized = ts.stableSort(changes, function (a, b) { return a.range.pos - b.range.pos; }); + for (var i = 0; i < normalized.length - 2; i++) { + ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos); + } + return normalized; + }; + return ChangeTracker; + }()); + textChanges.ChangeTracker = ChangeTracker; + function getNonformattedText(node, sourceFile, newLine) { + var options = { newLine: newLine, target: sourceFile.languageVersion }; + var writer = new Writer(ts.getNewLineCharacter(options)); + var printer = ts.createPrinter(options, writer); + printer.writeNode(3, node, sourceFile, writer); + return { text: writer.getText(), node: assignPositionsToNode(node) }; + } + textChanges.getNonformattedText = getNonformattedText; + function applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, rulesProvider) { + var lineMap = ts.computeLineStarts(nonFormattedText.text); + var file = { + text: nonFormattedText.text, + lineMap: lineMap, + getLineAndCharacterOfPosition: function (pos) { return ts.computeLineAndCharacterOfPosition(lineMap, pos); } + }; + var changes = ts.formatting.formatNode(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); + return applyChanges(nonFormattedText.text, changes); + } + textChanges.applyFormatting = applyFormatting; + function applyChanges(text, changes) { + for (var i = changes.length - 1; i >= 0; i--) { + var change = changes[i]; + text = "" + text.substring(0, change.span.start) + change.newText + text.substring(ts.textSpanEnd(change.span)); + } + return text; + } + textChanges.applyChanges = applyChanges; + function isTrivia(s) { + return ts.skipTrivia(s, 0) === s.length; + } + var nullTransformationContext = { + enableEmitNotification: ts.noop, + enableSubstitution: ts.noop, + endLexicalEnvironment: function () { return undefined; }, + getCompilerOptions: ts.notImplemented, + getEmitHost: ts.notImplemented, + getEmitResolver: ts.notImplemented, + hoistFunctionDeclaration: ts.noop, + hoistVariableDeclaration: ts.noop, + isEmitNotificationEnabled: ts.notImplemented, + isSubstitutionEnabled: ts.notImplemented, + onEmitNode: ts.noop, + onSubstituteNode: ts.notImplemented, + readEmitHelpers: ts.notImplemented, + requestEmitHelper: ts.noop, + resumeLexicalEnvironment: ts.noop, + startLexicalEnvironment: ts.noop, + suspendLexicalEnvironment: ts.noop + }; + function assignPositionsToNode(node) { + var visited = ts.visitEachChild(node, assignPositionsToNode, nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); + var newNode = ts.nodeIsSynthesized(visited) + ? visited + : (Proxy.prototype = visited, new Proxy()); + newNode.pos = getPos(node); + newNode.end = getEnd(node); + return newNode; + function Proxy() { } + } + function assignPositionsToNodeArray(nodes, visitor, test, start, count) { + var visited = ts.visitNodes(nodes, visitor, test, start, count); + if (!visited) { + return visited; + } + var nodeArray = visited === nodes ? ts.createNodeArray(visited.slice(0)) : visited; + nodeArray.pos = getPos(nodes); + nodeArray.end = getEnd(nodes); + return nodeArray; + } + var Writer = (function () { + function Writer(newLine) { + var _this = this; + this.lastNonTriviaPosition = 0; + this.writer = ts.createTextWriter(newLine); + this.onEmitNode = function (hint, node, printCallback) { + if (node) { + setPos(node, _this.lastNonTriviaPosition); + } + printCallback(hint, node); + if (node) { + setEnd(node, _this.lastNonTriviaPosition); + } + }; + this.onBeforeEmitNodeArray = function (nodes) { + if (nodes) { + setPos(nodes, _this.lastNonTriviaPosition); + } + }; + this.onAfterEmitNodeArray = function (nodes) { + if (nodes) { + setEnd(nodes, _this.lastNonTriviaPosition); + } + }; + } + Writer.prototype.setLastNonTriviaPosition = function (s, force) { + if (force || !isTrivia(s)) { + this.lastNonTriviaPosition = this.writer.getTextPos(); + var i = 0; + while (ts.isWhiteSpace(s.charCodeAt(s.length - i - 1))) { + i++; + } + this.lastNonTriviaPosition -= i; + } + }; + Writer.prototype.write = function (s) { + this.writer.write(s); + this.setLastNonTriviaPosition(s, false); + }; + Writer.prototype.writeTextOfNode = function (text, node) { + this.writer.writeTextOfNode(text, node); + }; + Writer.prototype.writeLine = function () { + this.writer.writeLine(); + }; + Writer.prototype.increaseIndent = function () { + this.writer.increaseIndent(); + }; + Writer.prototype.decreaseIndent = function () { + this.writer.decreaseIndent(); + }; + Writer.prototype.getText = function () { + return this.writer.getText(); + }; + Writer.prototype.rawWrite = function (s) { + this.writer.rawWrite(s); + this.setLastNonTriviaPosition(s, false); + }; + Writer.prototype.writeLiteral = function (s) { + this.writer.writeLiteral(s); + this.setLastNonTriviaPosition(s, true); + }; + Writer.prototype.getTextPos = function () { + return this.writer.getTextPos(); + }; + Writer.prototype.getLine = function () { + return this.writer.getLine(); + }; + Writer.prototype.getColumn = function () { + return this.writer.getColumn(); + }; + Writer.prototype.getIndent = function () { + return this.writer.getIndent(); + }; + Writer.prototype.isAtStartOfLine = function () { + return this.writer.isAtStartOfLine(); + }; + Writer.prototype.reset = function () { + this.writer.reset(); + this.lastNonTriviaPosition = 0; + }; + return Writer; + }()); + })(textChanges = ts.textChanges || (ts.textChanges = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -62512,24 +69476,203 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - return constructor.body.getFirstToken(sourceFile).getEnd(); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface + }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDeclaration = ts.getContainingClass(token); + if (!classDeclaration) { + return undefined; + } + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var classType = checker.getTypeAtLocation(classDeclaration); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDeclaration); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + var implementedType = checker.getTypeAtLocation(implementedTypeNode); + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8); }); + var newNodes = []; + createAndAddMissingIndexSignatureDeclaration(implementedType, 1, hasNumericIndexSignature, newNodes); + createAndAddMissingIndexSignatureDeclaration(implementedType, 0, hasStringIndexSignature, newNodes); + newNodes = newNodes.concat(codefix.createMissingMemberNodes(classDeclaration, nonPrivateMembers, checker)); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (newNodes.length > 0) { + pushAction(result, newNodes, message); + } + } + return result; + function createAndAddMissingIndexSignatureDeclaration(type, kind, hasIndexSigOfKind, newNodes) { + if (hasIndexSigOfKind) { + return; + } + var indexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (!indexInfoOfKind) { + return; + } + var newIndexSignatureDeclaration = checker.indexInfoToIndexSignatureDeclaration(indexInfoOfKind, kind, classDeclaration); + newNodes.push(newIndexSignatureDeclaration); + } + function pushAction(result, newNodes, description) { + var newAction = { + description: description, + changes: codefix.newNodesToChanges(newNodes, openBrace, context) + }; + result.push(newAction); + } } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122) { - return undefined; + errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code], + getCodeActions: getActionsForAddMissingMember + }); + function getActionsForAddMissingMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind !== 70) { + return undefined; + } + if (!ts.isPropertyAccessExpression(token.parent) || token.parent.expression.kind !== 98) { + return undefined; + } + var classMemberDeclaration = ts.getThisContainer(token, false); + if (!ts.isClassElement(classMemberDeclaration)) { + return undefined; + } + var classDeclaration = classMemberDeclaration.parent; + if (!classDeclaration || !ts.isClassLike(classDeclaration)) { + return undefined; + } + var isStatic = ts.hasModifier(classMemberDeclaration, 32); + return ts.isInJavaScriptFile(sourceFile) ? getActionsForAddMissingMemberInJavaScriptFile() : getActionsForAddMissingMemberInTypeScriptFile(); + function getActionsForAddMissingMemberInJavaScriptFile() { + var memberName = token.getText(); + if (isStatic) { + if (classDeclaration.kind === 198) { + return undefined; + } + var className = classDeclaration.name.getText(); + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_static_property_0), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classDeclaration.getEnd(), length: 0 }, + newText: "" + context.newLineCharacter + className + "." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + else { + var classConstructor = ts.getFirstConstructorWithBody(classDeclaration); + if (!classConstructor) { + return undefined; + } + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_property_0_in_the_constructor), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classConstructor.body.getEnd() - 1, length: 0 }, + newText: "this." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; + } + } + function getActionsForAddMissingMemberInTypeScriptFile() { + var typeNode; + if (token.parent.parent.kind === 193) { + var binaryExpression = token.parent.parent; + var checker = context.program.getTypeChecker(); + var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right))); + typeNode = checker.typeToTypeNode(widenedType, classDeclaration); + } + typeNode = typeNode || ts.createKeywordTypeNode(118); + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var property = ts.createProperty(undefined, isStatic ? [ts.createToken(114)] : undefined, token.getText(sourceFile), undefined, typeNode, undefined); + var propertyChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + propertyChangeTracker.insertNodeAfter(sourceFile, openBrace, property, { suffix: context.newLineCharacter }); + var actions = [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]), + changes: propertyChangeTracker.getChanges() }]; + if (!isStatic) { + var stringTypeNode = ts.createKeywordTypeNode(135); + var indexingParameter = ts.createParameter(undefined, undefined, undefined, "x", undefined, stringTypeNode, undefined); + var indexSignature = ts.createIndexSignatureDeclaration(undefined, undefined, [indexingParameter], typeNode); + var indexSignatureChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + indexSignatureChangeTracker.insertNodeAfter(sourceFile, openBrace, indexSignature, { suffix: context.newLineCharacter }); + actions.push({ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]), + changes: indexSignatureChangeTracker.getChanges() + }); + } + return actions; } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDeclaration = token.parent; + var extendsNode = ts.getClassExtendsHeritageClauseElement(classDeclaration); + var instantiatedExtendsType = checker.getTypeAtLocation(extendsNode); + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var newNodes = codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, checker); + var changes = codefix.newNodesToChanges(newNodes, ts.getOpenBraceOfClassLike(classDeclaration, sourceFile), context); + if (changes && changes.length > 0) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: changes + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8) && !!(flags & 128); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -62543,7 +69686,7 @@ var ts; if (!superCall) { return undefined; } - if (superCall.expression && superCall.expression.kind == 179) { + if (superCall.expression && superCall.expression.kind === 180) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -62551,23 +69694,15 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); - var changes = [{ - fileName: sourceFile.fileName, textChanges: [{ - newText: superCall.getText(sourceFile), - span: { start: newPosition, length: 0 } - }, - { - newText: "", - span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) } - }] - }]; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(constructor, sourceFile), superCall, { suffix: context.newLineCharacter }); + changeTracker.deleteNode(sourceFile, superCall); return [{ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor), - changes: changes + changes: changeTracker.getChanges() }]; function findSuperCall(n) { - if (n.kind === 207 && ts.isSuperCall(n.expression)) { + if (n.kind === 209 && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -62580,6 +69715,248 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + var superCall = ts.createStatement(ts.createCall(ts.createSuper(), undefined, ts.emptyArray)); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(token.parent, sourceFile), superCall, { suffix: context.newLineCharacter }); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84)) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, extendsToken, ts.createToken(107)); + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeTracker.replaceNode(sourceFile, keywordToken, ts.createToken(25)); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: changeTracker.getChanges() + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 70) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createThis(), token)); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind === 20) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70: + switch (token.parent.kind) { + case 225: + switch (token.parent.parent.parent.kind) { + case 213: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return deleteNode(forInitializer); + } + else { + return deleteNodeInList(token.parent); + } + case 215: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 226) { + var forOfInitializer = forOfStatement.initializer; + return replaceNode(forOfInitializer.declarations[0], ts.createObjectLiteral()); + } + break; + case 214: + return undefined; + case 259: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return deleteNode(parameter); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return deleteNode(variableStatement); + } + else { + return deleteNodeInList(token.parent); + } + } + case 144: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1); + if (!previousToken || previousToken.kind !== 26) { + return deleteRange(typeParameters); + } + var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end); + if (!nextToken || nextToken.kind !== 28) { + return deleteRange(typeParameters); + } + return deleteNodeRange(previousToken, nextToken); + } + else { + return deleteNodeInList(token.parent); + } + case 145: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return deleteNode(token.parent); + } + else { + return deleteNodeInList(token.parent); + } + case 236: + var importEquals = ts.getAncestor(token, 236); + return deleteNode(importEquals); + case 241: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + var importSpec = ts.getAncestor(token, 237); + return deleteNode(importSpec); + } + else { + return deleteNodeInList(token.parent); + } + case 238: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = ts.getAncestor(importClause, 237); + return deleteNode(importDecl); + } + else { + var start_4 = importClause.name.getStart(sourceFile); + var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end); + if (nextToken && nextToken.kind === 25) { + return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, false, true) }); + } + else { + return deleteNode(importClause.name); + } + } + case 239: + var namespaceImport = token.parent; + if (namespaceImport.name === token && !namespaceImport.parent.name) { + var importDecl = ts.getAncestor(namespaceImport, 237); + return deleteNode(importDecl); + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1); + if (previousToken && previousToken.kind === 25) { + var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart); + return deleteRange({ pos: startPosition, end: namespaceImport.end }); + } + return deleteRange(namespaceImport); + } + } + break; + case 148: + case 239: + return deleteNode(token.parent); + } + if (ts.isDeclarationName(token)) { + return deleteNode(token.parent); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return deleteNode(token.parent.parent); + } + else { + return undefined; + } + function deleteNode(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNode(sourceFile, n)); + } + function deleteRange(range) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteRange(sourceFile, range)); + } + function deleteNodeInList(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeInList(sourceFile, n)); + } + function deleteNodeRange(start, end) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeRange(sourceFile, start, end)); + } + function replaceNode(n, newNode) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).replaceNode(sourceFile, n, newNode)); + } + function makeChange(changeTracker) { + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), + changes: changeTracker.getChanges() + }]; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var codefix; (function (codefix) { @@ -62591,18 +69968,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -62635,8 +70013,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -62665,7 +70043,11 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics.Cannot_find_namespace_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -62674,18 +70056,22 @@ var ts; var token = ts.getTokenAtPosition(sourceFile, context.span.start); var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); - var cachedImportDeclarations = ts.createMap(); - var cachedNewImportInsertPosition; - var allPotentialModules = checker.getAmbientModules(); + var cachedImportDeclarations = []; + var lastImportDeclaration; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, false, true); + } + var candidateModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { - allPotentialModules.push(otherSourceFile.symbol); + candidateModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); - for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { - var moduleSymbol = allPotentialModules_1[_a]; + for (var _a = 0, candidateModules_1 = candidateModules; _a < candidateModules_1.length; _a++) { + var moduleSymbol = candidateModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { @@ -62704,8 +70090,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -62720,10 +70107,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235) { + if (node.kind === 237) { return node; } - if (node.kind === 234) { + if (node.kind === 236) { return node; } node = node.parent; @@ -62741,7 +70128,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { return getCodeActionsForExistingImport(existingDeclarations); @@ -62754,11 +70141,11 @@ var ts; var namespaceImportDeclaration; var namedImportDeclaration; var existingModuleSpecifier; - for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { - var declaration = declarations_11[_i]; - if (declaration.kind === 235) { + for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) { + var declaration = declarations_14[_i]; + if (declaration.kind === 237) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237) { + if (namedBindings && namedBindings.kind === 239) { namespaceImportDeclaration = declaration; } else { @@ -62774,94 +70161,82 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { - var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var fileTextChanges = getTextChangeForImportClause(namedImportDeclaration.importClause); var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); - actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], fileTextChanges, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); } else { actions.push(getCodeActionForNewImport(existingModuleSpecifier)); } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); } function getTextChangeForImportClause(importClause) { - var newImportText = isDefault ? "default as " + name : name; var importList = importClause.namedBindings; - if (!importList && importClause.name) { - var start = importClause.name.getEnd(); - return { - newText: ", { " + newImportText + " }", - span: { start: start, length: 0 } - }; - } - if (importList.elements.length === 0) { - var start = importList.getStart(); - return { - newText: "{ " + newImportText + " }", - span: { start: start, length: importList.getEnd() - start } - }; + var newImportSpecifier = ts.createImportSpecifier(undefined, ts.createIdentifier(name)); + if (!importList || importList.elements.length === 0) { + var newImportClause = ts.createImportClause(importClause.name, ts.createNamedImports([newImportSpecifier])); + return createChangeTracker().replaceNode(sourceFile, importClause, newImportClause).getChanges(); } - var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); - var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); - var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); - var oneImportPerLine = endLine - startLine > importList.elements.length; - return { - newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, - span: { start: insertPoint, length: 0 } - }; + return createChangeTracker().insertNodeInListAfter(sourceFile, importList.elements[importList.elements.length - 1], newImportSpecifier).getChanges(); } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235) { + if (declaration.kind === 237) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { namespacePrefix = declaration.name.getText(); } namespacePrefix = ts.stripQuotes(namespacePrefix); - return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], createChangeTracker().replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createIdentifier(namespacePrefix), name)).getChanges(), "CodeChange"); } } function getCodeActionForNewImport(moduleSpecifier) { - if (!cachedNewImportInsertPosition) { - var lastModuleSpecifierEnd = -1; - for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { - var moduleSpecifier_1 = _a[_i]; - var end = moduleSpecifier_1.getEnd(); - if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { - lastModuleSpecifierEnd = end; + if (!lastImportDeclaration) { + for (var i = sourceFile.statements.length - 1; i >= 0; i--) { + var statement = sourceFile.statements[i]; + if (statement.kind === 236 || statement.kind === 237) { + lastImportDeclaration = statement; + break; } } - cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); } var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); - var importStatementText = isDefault - ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; - var newText = cachedNewImportInsertPosition === sourceFile.getStart() - ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter - : "" + context.newLineCharacter + importStatementText + ";"; - return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + var changeTracker = createChangeTracker(); + var importClause = isDefault + ? ts.createImportClause(ts.createIdentifier(name), undefined) + : isNamespaceImport + ? ts.createImportClause(undefined, ts.createNamespaceImport(ts.createIdentifier(name))) + : ts.createImportClause(undefined, ts.createNamedImports([ts.createImportSpecifier(undefined, ts.createIdentifier(name))])); + var importDecl = ts.createImportDeclaration(undefined, undefined, importClause, ts.createLiteral(moduleSpecifierWithoutQuotes)); + if (!lastImportDeclaration) { + changeTracker.insertNodeAt(sourceFile, sourceFile.getStart(), importDecl, { suffix: "" + context.newLineCharacter + context.newLineCharacter }); + } + else { + changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl, { suffix: context.newLineCharacter }); + } + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], changeTracker.getChanges(), "NewImport", moduleSpecifierWithoutQuotes); function getModuleSpecifierForNewImport() { - var fileName = sourceFile.path; - var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var fileName = sourceFile.fileName; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().fileName; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261) { + if (moduleSymbol.valueDeclaration.kind !== 264) { return moduleSymbol.name; } } @@ -62869,11 +70244,11 @@ var ts; if (!options.baseUrl) { return undefined; } - var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); - var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + var relativeName = getRelativePathIfInDirectory(moduleFileName, options.baseUrl); if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -62893,7 +70268,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -62903,9 +70278,8 @@ var ts; } function tryGetModuleNameFromRootDirs() { if (options.rootDirs) { - var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, undefined, getCanonicalFileName); }); - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, options.rootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, options.rootDirs); if (normalizedTargetPath !== undefined) { var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; return ts.removeFileExtension(relativePath); @@ -62967,7 +70341,7 @@ var ts; function getPathRelativeToRootDirs(path, rootDirs) { for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { var rootDir = rootDirs_2[_i]; - var relativeName = tryRemoveParentDirectoryName(path, rootDir); + var relativeName = getRelativePathIfInDirectory(path, rootDir); if (relativeName !== undefined) { return relativeName; } @@ -62981,25 +70355,23 @@ var ts; } return fileName; } + function getRelativePathIfInDirectory(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + return ts.isRootedDiskPath(relativePath) || ts.startsWith(relativePath, "..") ? undefined : relativePath; + } function getRelativePath(path, directoryPath) { var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; } - function tryRemoveParentDirectoryName(path, parentDirectory) { - var index = path.indexOf(parentDirectory); - if (index === 0) { - return ts.endsWith(parentDirectory, ts.directorySeparator) - ? path.substring(parentDirectory.length) - : path.substring(parentDirectory.length + 1); - } - return undefined; - } } } - function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + function createChangeTracker() { + return ts.textChanges.ChangeTracker.fromCodeFixContext(context); + } + function createCodeAction(description, diagnosticArgs, changes, kind, moduleSpecifier) { return { description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), - changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + changes: changes, kind: kind, moduleSpecifier: moduleSpecifier }; @@ -63013,150 +70385,225 @@ var ts; var codefix; (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - if (token.kind === 20) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70: - switch (token.parent.kind) { - case 223: - switch (token.parent.parent.parent.kind) { - case 211: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212: - return undefined; - case 256: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - case 234: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - case 236: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 && importDecl.parent) { - importDecl = importDecl.parent; - } - return importDecl; + errorCodes: getApplicableDiagnosticCodes(), + getCodeActions: getDisableJsDiagnosticsCodeActions + }); + function getApplicableDiagnosticCodes() { + var allDiagnostcs = ts.Diagnostics; + return Object.keys(allDiagnostcs) + .filter(function (d) { return allDiagnostcs[d] && allDiagnostcs[d].category === ts.DiagnosticCategory.Error; }) + .map(function (d) { return allDiagnostcs[d].code; }); + } + function getIgnoreCommentLocationForLocation(sourceFile, position, newLineCharacter) { + var line = ts.getLineAndCharacterOfPosition(sourceFile, position).line; + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition); + if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) { + var token = ts.getTouchingToken(sourceFile, startPosition); + var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile); + if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) { + return { + span: { start: startPosition, length: 0 }, + newText: "// @ts-ignore" + newLineCharacter + }; } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] + } + return { + span: { start: position, length: 0 }, + newText: (position === startPosition ? "" : newLineCharacter) + "// @ts-ignore" + newLineCharacter + }; + } + function getDisableJsDiagnosticsCodeActions(context) { + var sourceFile = context.sourceFile, program = context.program, newLineCharacter = context.newLineCharacter, span = context.span; + if (!ts.isInJavaScriptFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { + return undefined; + } + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Ignore_this_error_message), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter)] + }] + }, + { + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Disable_checking_for_this_file), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { + start: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.pos : 0, + length: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.end - sourceFile.checkJsDirective.pos : 0 + }, + newText: "// @ts-nocheck" + newLineCharacter }] - }]; + }] + }]; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + function newNodesToChanges(newNodes, insertAfter, context) { + var sourceFile = context.sourceFile; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + for (var _i = 0, newNodes_1 = newNodes; _i < newNodes_1.length; _i++) { + var newNode = newNodes_1[_i]; + changeTracker.insertNodeAfter(sourceFile, insertAfter, newNode, { suffix: context.newLineCharacter }); + } + var changes = changeTracker.getChanges(); + if (!ts.some(changes)) { + return changes; + } + ts.Debug.assert(changes.length === 1); + var consolidatedChanges = [{ + fileName: changes[0].fileName, + textChanges: [{ + span: changes[0].textChanges[0].span, + newText: changes[0].textChanges.reduce(function (prev, cur) { return prev + cur.newText; }, "") + }] + }]; + return consolidatedChanges; + } + codefix.newNodesToChanges = newNodesToChanges; + function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, checker) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); + var newNodes = []; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + var newNode = createNewNodeForMemberSymbol(symbol, classDeclaration, checker); + if (newNode) { + if (Array.isArray(newNode)) { + newNodes = newNodes.concat(newNode); + } + else { + newNodes.push(newNode); + } } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + return newNodes; + } + codefix.createMissingMemberNodes = createMissingMemberNodes; + function createNewNodeForMemberSymbol(symbol, enclosingDeclaration, checker) { + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return undefined; + } + var declaration = declarations[0]; + var name = ts.getSynthesizedClone(declaration.name); + var visibilityModifier = createVisibilityModifier(ts.getModifierFlags(declaration)); + var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined; + var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); + var optional = !!(symbol.flags & 67108864); + switch (declaration.kind) { + case 152: + case 153: + case 147: + case 148: + var typeNode = checker.typeToTypeNode(type, enclosingDeclaration); + var property = ts.createProperty(undefined, modifiers, name, optional ? ts.createToken(54) : undefined, typeNode, undefined); + return property; + case 149: + case 150: + var signatures = checker.getSignaturesOfType(type, 0); + if (!ts.some(signatures)) { + return undefined; + } + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var signature = signatures[0]; + return signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + } + var signatureDeclarations = []; + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } + } + if (declarations.length > signatures.length) { + var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + var methodImplementingSignatures = createMethodImplementingSignatures(signatures, name, optional, modifiers); + signatureDeclarations.push(methodImplementingSignatures); } + return signatureDeclarations; + default: + return undefined; + } + function signatureToMethodDeclaration(signature, enclosingDeclaration, body) { + var signatureDeclaration = checker.signatureToSignatureDeclaration(signature, 150, enclosingDeclaration); + if (signatureDeclaration) { + signatureDeclaration.decorators = undefined; + signatureDeclaration.modifiers = modifiers; + signatureDeclaration.name = name; + signatureDeclaration.questionToken = optional ? ts.createToken(54) : undefined; + signatureDeclaration.body = body; } + return signatureDeclaration; } - }); + } + function createMethodImplementingSignatures(signatures, name, optional, modifiers) { + var maxArgsSignature = signatures[0]; + var minArgumentCount = signatures[0].minArgumentCount; + var someSigHasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + if (sig.hasRestParameter) { + someSigHasRestParameter = true; + } + if (sig.parameters.length >= maxArgsSignature.parameters.length && (!sig.hasRestParameter || maxArgsSignature.hasRestParameter)) { + maxArgsSignature = sig; + } + } + var maxNonRestArgs = maxArgsSignature.parameters.length - (maxArgsSignature.hasRestParameter ? 1 : 0); + var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.getName(); }); + var parameters = []; + for (var i = 0; i < maxNonRestArgs; i++) { + var anyType = ts.createKeywordTypeNode(118); + var newParameter = ts.createParameter(undefined, undefined, undefined, maxArgsParameterSymbolNames[i], i >= minArgumentCount ? ts.createToken(54) : undefined, anyType, undefined); + parameters.push(newParameter); + } + if (someSigHasRestParameter) { + var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(118)); + var restParameter = ts.createParameter(undefined, undefined, ts.createToken(23), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", maxNonRestArgs >= minArgumentCount ? ts.createToken(54) : undefined, anyArrayType, undefined); + parameters.push(restParameter); + } + return createStubbedMethod(modifiers, name, optional, undefined, parameters, undefined); + } + function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType) { + return ts.createMethodDeclaration(undefined, modifiers, undefined, name, optional ? ts.createToken(54) : undefined, typeParameters, parameters, returnType, createStubbedMethodBody()); + } + codefix.createStubbedMethod = createStubbedMethod; + function createStubbedMethodBody() { + return ts.createBlock([ts.createThrow(ts.createNew(ts.createIdentifier("Error"), undefined, [ts.createLiteral("Method not implemented.")]))], true); + } + function createVisibilityModifier(flags) { + if (flags & 4) { + return ts.createToken(113); + } + else if (flags & 16) { + return ts.createToken(112); + } + return undefined; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; (function (ts) { ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 ? new NodeObject(kind, pos, end) : + var node = kind >= 142 ? new NodeObject(kind, pos, end) : kind === 70 ? new IdentifierObject(70, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -63214,11 +70661,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292, nodes.pos, nodes.end, this); + var list = createNode(293, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { - var node = nodes_7[_i]; + for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { + var node = nodes_9[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -63233,11 +70680,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141) { + if (this.kind >= 142) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291; + var useJSDocScanner_1 = this.kind >= 282 && this.kind <= 292; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -63290,8 +70737,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 266 || kid.kind > 292; }); + return child.kind < 142 ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -63299,7 +70748,10 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 ? child : child.getLastToken(sourceFile); + return child.kind < 142 ? child : child.getLastToken(sourceFile); + }; + NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { + return ts.forEachChild(this, cbNode, cbNodeArray); }; return NodeObject; }()); @@ -63352,6 +70804,9 @@ var ts; TokenOrIdentifierObject.prototype.getLastToken = function () { return undefined; }; + TokenOrIdentifierObject.prototype.forEachChild = function () { + return undefined; + }; return TokenOrIdentifierObject; }()); var SymbolObject = (function () { @@ -63374,6 +70829,12 @@ var ts; } return this.documentationComment; }; + SymbolObject.prototype.getJsDocTags = function () { + if (this.tags === undefined) { + this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations); + } + return this.tags; + }; return SymbolObject; }()); var TokenObject = (function (_super) { @@ -63457,6 +70918,12 @@ var ts; } return this.documentationComment; }; + SignatureObject.prototype.getJsDocTags = function () { + if (this.jsDocTags === undefined) { + this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : []; + } + return this.jsDocTags; + }; return SignatureObject; }()); var SourceFileObject = (function (_super) { @@ -63496,17 +70963,21 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { @@ -63514,9 +70985,9 @@ var ts; if (result_7 !== undefined) { return result_7; } - if (declaration.name.kind === 142) { + if (declaration.name.kind === 143) { var expr = declaration.name.expression; - if (expr.kind === 177) { + if (expr.kind === 178) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -63536,10 +71007,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 225: - case 184: + case 227: + case 185: + case 150: case 149: - case 148: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -63553,33 +71024,33 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; - case 226: - case 197: - case 227: case 228: + case 198: case 229: case 230: - case 234: - case 243: - case 239: - case 234: + case 231: + case 232: case 236: - case 237: - case 151: + case 245: + case 241: + case 236: + case 238: + case 239: case 152: - case 161: + case 153: + case 162: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144: + case 145: if (!ts.hasModifier(node, 92)) { break; } - case 223: - case 174: { + case 225: + case 175: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -63588,24 +71059,24 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260: + case 263: + case 148: case 147: - case 146: addDeclaration(node); break; - case 241: + case 243: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235: + case 237: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 239) { addDeclaration(importClause.namedBindings); } else { @@ -63831,6 +71302,30 @@ var ts; }; return CancellationTokenObject; }()); + var ThrottledCancellationToken = (function () { + function ThrottledCancellationToken(hostCancellationToken, throttleWaitMilliseconds) { + if (throttleWaitMilliseconds === void 0) { throttleWaitMilliseconds = 20; } + this.hostCancellationToken = hostCancellationToken; + this.throttleWaitMilliseconds = throttleWaitMilliseconds; + this.lastCancellationCheckTime = 0; + } + ThrottledCancellationToken.prototype.isCancellationRequested = function () { + var time = ts.timestamp(); + var duration = Math.abs(time - this.lastCancellationCheckTime); + if (duration >= this.throttleWaitMilliseconds) { + this.lastCancellationCheckTime = time; + return this.hostCancellationToken.isCancellationRequested(); + } + return false; + }; + ThrottledCancellationToken.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new ts.OperationCanceledException(); + } + }; + return ThrottledCancellationToken; + }()); + ts.ThrottledCancellationToken = ThrottledCancellationToken; function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -64048,10 +71543,10 @@ var ts; if (!symbol || typeChecker.isUnknownSymbol(symbol)) { switch (node.kind) { case 70: - case 177: - case 141: + case 178: + case 142: case 98: - case 167: + case 168: case 96: var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -64060,7 +71555,8 @@ var ts; kindModifiers: ts.ScriptElementKindModifier.none, textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)), - documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined, + tags: type.symbol ? type.symbol.getJsDocTags() : undefined }; } } @@ -64072,26 +71568,27 @@ var ts; kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: displayPartsDocumentationsAndKind.displayParts, - documentation: displayPartsDocumentationsAndKind.documentation + documentation: displayPartsDocumentationsAndKind.documentation, + tags: displayPartsDocumentationsAndKind.tags }; } function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position); } - function getImplementationAtPosition(fileName, position) { - synchronizeHostData(); - return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position)); - } function getTypeDefinitionAtPosition(fileName, position) { synchronizeHostData(); return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position); } + function getImplementationAtPosition(fileName, position) { + synchronizeHostData(); + return ts.FindAllReferences.getImplementationsAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); + } function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); } return results; } @@ -64102,7 +71599,6 @@ var ts; return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch); } function getOccurrencesAtPositionCore(fileName, position) { - synchronizeHostData(); return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName])); function convertDocumentHighlights(documentHighlights) { if (!documentHighlights) { @@ -64117,7 +71613,8 @@ var ts; fileName: entry.fileName, textSpan: highlightSpan.textSpan, isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference, - isDefinition: false + isDefinition: false, + isInString: highlightSpan.isInString, }); } } @@ -64125,20 +71622,18 @@ var ts; } } function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); - return ts.FindAllReferences.convertReferences(referencedSymbols); + return getReferences(fileName, position, { findInStrings: findInStrings, findInComments: findInComments, isForRename: true }); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); - return ts.FindAllReferences.convertReferences(referencedSymbols); + return getReferences(fileName, position); } - function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); - return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); + function getReferences(fileName, position, options) { + synchronizeHostData(); + return ts.FindAllReferences.findReferencedEntries(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, options); } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + function findReferences(fileName, position) { synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); } function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { synchronizeHostData(); @@ -64156,7 +71651,8 @@ var ts; text: data }); } - var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles); + var customTransformers = host.getCustomTransformers && host.getCustomTransformers(); + var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); return { outputFiles: outputFiles, emitSkipped: emitOutput.emitSkipped @@ -64180,15 +71676,15 @@ var ts; return; } switch (node.kind) { - case 177: - case 141: + case 178: + case 142: case 9: case 85: case 100: case 94: case 96: case 98: - case 167: + case 168: case 70: break; default: @@ -64200,7 +71696,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 230 && + if (nodeForStartPos.parent.parent.kind === 232 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -64219,10 +71715,10 @@ var ts; return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); } function getNavigationBarItems(fileName) { - return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName)); + return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); } function getNavigationTree(fileName) { - return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName)); + return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); } function isTsOrTsxFile(fileName) { var kind = ts.getScriptKind(fileName, host); @@ -64250,7 +71746,7 @@ var ts; } function getOutliningSpans(fileName) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.OutliningElementsCollector.collectElements(sourceFile); + return ts.OutliningElementsCollector.collectElements(sourceFile, cancellationToken); } function getBraceMatchingAtPosition(fileName, position) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); @@ -64326,13 +71822,13 @@ var ts; } return []; } - function getCodeFixesAtPosition(fileName, start, end, errorCodes) { + function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var span = { start: start, length: end - start }; var newLineChar = ts.getNewLineOrDefaultFromHost(host); var allFixes = []; - ts.forEach(errorCodes, function (error) { + ts.forEach(ts.deduplicate(errorCodes), function (error) { cancellationToken.throwIfCancellationRequested(); var context = { errorCode: error, @@ -64341,7 +71837,8 @@ var ts; program: program, newLineCharacter: newLineChar, host: host, - cancellationToken: cancellationToken + cancellationToken: cancellationToken, + rulesProvider: getRuleProvider(formatOptions) }; var fixes = ts.codefix.getFixes(context); if (fixes) { @@ -64358,7 +71855,7 @@ var ts; return false; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -64389,7 +71886,7 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + for (var i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -64493,15 +71990,15 @@ var ts; function walk(node) { switch (node.kind) { case 70: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); break; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 245 || + node.parent.kind === 247 || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); } break; default: @@ -64514,11 +72011,66 @@ var ts; } } } + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); + } + } + function isObjectLiteralElement(node) { + switch (node.kind) { + case 252: + case 254: + case 260: + case 261: + case 150: + case 152: + case 153: + return true; + } + return false; + } + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9: + case 8: + if (node.parent.kind === 143) { + return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; + } + case 70: + return isObjectLiteralElement(node.parent) && + (node.parent.parent.kind === 177 || node.parent.parent.kind === 253) && + node.parent.name === node ? node.parent : undefined; + } + return undefined; + } + ts.getContainingObjectLiteralElement = getContainingObjectLiteralElement; + function getPropertySymbolsFromContextualType(typeChecker, node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = ts.getTextOfPropertyName(node.name); + if (name && contextualType) { + var result_8 = []; + var symbol = contextualType.getProperty(name); + if (contextualType.flags & 65536) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_8.push(symbol); + } + }); + return result_8; + } + if (symbol) { + result_8.push(symbol); + return result_8; + } + } + return undefined; } + ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 178 && + node.parent.kind === 179 && node.parent.argumentExpression === node; } function getDefaultLibFilePath(options) { @@ -64528,4958 +72080,5697 @@ var ts; throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); } ts.getDefaultLibFilePath = getDefaultLibFilePath; - function initializeServices() { - ts.objectAllocator = getServicesObjectAllocator(); - } - initializeServices(); + ts.objectAllocator = getServicesObjectAllocator(); })(ts || (ts = {})); var ts; (function (ts) { var server; (function (server) { - var ScriptInfo = (function () { - function ScriptInfo(host, fileName, content, scriptKind, isOpen, hasMixedContent) { - if (isOpen === void 0) { isOpen = false; } - if (hasMixedContent === void 0) { hasMixedContent = false; } - this.host = host; - this.fileName = fileName; - this.scriptKind = scriptKind; - this.isOpen = isOpen; - this.hasMixedContent = hasMixedContent; - this.containingProjects = []; - this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); - this.svc = server.ScriptVersionCache.fromString(host, content); - this.scriptKind = scriptKind - ? scriptKind - : ts.getScriptKindFromFileName(fileName); + server.ActionSet = "action::set"; + server.ActionInvalidate = "action::invalidate"; + server.EventBeginInstallTypes = "event::beginInstallTypes"; + server.EventEndInstallTypes = "event::endInstallTypes"; + server.EventInitializationFailed = "event::initializationFailed"; + var Arguments; + (function (Arguments) { + Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; + Arguments.LogFile = "--logFile"; + Arguments.EnableTelemetry = "--enableTelemetry"; + Arguments.TypingSafeListLocation = "--typingSafeListLocation"; + })(Arguments = server.Arguments || (server.Arguments = {})); + function hasArgument(argumentName) { + return ts.sys.args.indexOf(argumentName) >= 0; + } + server.hasArgument = hasArgument; + function findArgument(argumentName) { + var index = ts.sys.args.indexOf(argumentName); + return index >= 0 && index < ts.sys.args.length - 1 + ? ts.sys.args[index + 1] + : undefined; + } + server.findArgument = findArgument; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var LogLevel; + (function (LogLevel) { + LogLevel[LogLevel["terse"] = 0] = "terse"; + LogLevel[LogLevel["normal"] = 1] = "normal"; + LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; + LogLevel[LogLevel["verbose"] = 3] = "verbose"; + })(LogLevel = server.LogLevel || (server.LogLevel = {})); + server.emptyArray = []; + var Msg; + (function (Msg) { + Msg.Err = "Err"; + Msg.Info = "Info"; + Msg.Perf = "Perf"; + })(Msg = server.Msg || (server.Msg = {})); + function getProjectRootPath(project) { + switch (project.projectKind) { + case server.ProjectKind.Configured: + return ts.getDirectoryPath(project.getProjectName()); + case server.ProjectKind.Inferred: + return ""; + case server.ProjectKind.External: + var projectName = ts.normalizeSlashes(project.getProjectName()); + return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; } - ScriptInfo.prototype.getFormatCodeSettings = function () { - return this.formatCodeSettings; - }; - ScriptInfo.prototype.attachToProject = function (project) { - var isNew = !this.isAttached(project); - if (isNew) { - this.containingProjects.push(project); - } - return isNew; - }; - ScriptInfo.prototype.isAttached = function (project) { - switch (this.containingProjects.length) { - case 0: return false; - case 1: return this.containingProjects[0] === project; - case 2: return this.containingProjects[0] === project || this.containingProjects[1] === project; - default: return ts.contains(this.containingProjects, project); - } - }; - ScriptInfo.prototype.detachFromProject = function (project) { - switch (this.containingProjects.length) { - case 0: - return; - case 1: - if (this.containingProjects[0] === project) { - this.containingProjects.pop(); - } - break; - case 2: - if (this.containingProjects[0] === project) { - this.containingProjects[0] = this.containingProjects.pop(); - } - else if (this.containingProjects[1] === project) { - this.containingProjects.pop(); - } - break; - default: - server.removeItemFromSet(this.containingProjects, project); - break; - } - }; - ScriptInfo.prototype.detachAllProjects = function () { - for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { - var p = _a[_i]; - p.removeFile(this, false); - } - this.containingProjects.length = 0; + } + function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { + return { + projectName: project.getProjectName(), + fileNames: project.getFileNames(true), + compilerOptions: project.getCompilerOptions(), + typeAcquisition: typeAcquisition, + unresolvedImports: unresolvedImports, + projectRootPath: getProjectRootPath(project), + cachePath: cachePath, + kind: "discover" }; - ScriptInfo.prototype.getDefaultProject = function () { - if (this.containingProjects.length === 0) { - return server.Errors.ThrowNoProject(); - } - return this.containingProjects[0]; + } + server.createInstallTypingsRequest = createInstallTypingsRequest; + var Errors; + (function (Errors) { + function ThrowNoProject() { + throw new Error("No Project."); + } + Errors.ThrowNoProject = ThrowNoProject; + function ThrowProjectLanguageServiceDisabled() { + throw new Error("The project's language service is disabled."); + } + Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; + function ThrowProjectDoesNotContainDocument(fileName, project) { + throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); + } + Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; + })(Errors = server.Errors || (server.Errors = {})); + function getDefaultFormatCodeSettings(host) { + return { + indentSize: 4, + tabSize: 4, + newLineCharacter: host.newLine || "\n", + convertTabsToSpaces: true, + indentStyle: ts.IndentStyle.Smart, + insertSpaceAfterConstructor: false, + insertSpaceAfterCommaDelimiter: true, + insertSpaceAfterSemicolonInForStatements: true, + insertSpaceBeforeAndAfterBinaryOperators: true, + insertSpaceAfterKeywordsInControlFlowStatements: true, + insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, + placeOpenBraceOnNewLineForFunctions: false, + placeOpenBraceOnNewLineForControlBlocks: false, }; - ScriptInfo.prototype.setFormatOptions = function (formatSettings) { - if (formatSettings) { - if (!this.formatCodeSettings) { - this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host); - } - server.mergeMaps(this.formatCodeSettings, formatSettings); + } + server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; + function mergeMapLikes(target, source) { + for (var key in source) { + if (ts.hasProperty(source, key)) { + target[key] = source[key]; } - }; - ScriptInfo.prototype.setWatcher = function (watcher) { - this.stopWatcher(); - this.fileWatcher = watcher; - }; - ScriptInfo.prototype.stopWatcher = function () { - if (this.fileWatcher) { - this.fileWatcher.close(); - this.fileWatcher = undefined; + } + } + server.mergeMapLikes = mergeMapLikes; + function removeItemFromSet(items, itemToRemove) { + if (items.length === 0) { + return; + } + var index = items.indexOf(itemToRemove); + if (index < 0) { + return; + } + if (index === items.length - 1) { + items.pop(); + } + else { + items[index] = items.pop(); + } + } + server.removeItemFromSet = removeItemFromSet; + function toNormalizedPath(fileName) { + return ts.normalizePath(fileName); + } + server.toNormalizedPath = toNormalizedPath; + function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { + var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); + return getCanonicalFileName(f); + } + server.normalizedPathToPath = normalizedPathToPath; + function asNormalizedPath(fileName) { + return fileName; + } + server.asNormalizedPath = asNormalizedPath; + function createNormalizedPathMap() { + var map = ts.createMap(); + return { + get: function (path) { + return map.get(path); + }, + set: function (path, value) { + map.set(path, value); + }, + contains: function (path) { + return map.has(path); + }, + remove: function (path) { + map.delete(path); } }; - ScriptInfo.prototype.getLatestVersion = function () { - return this.svc.latestVersion().toString(); - }; - ScriptInfo.prototype.reload = function (script) { - this.svc.reload(script); - this.markContainingProjectsAsDirty(); - }; - ScriptInfo.prototype.saveTo = function (fileName) { - var snap = this.snap(); - this.host.writeFile(fileName, snap.getText(0, snap.getLength())); - }; - ScriptInfo.prototype.reloadFromFile = function (tempFileName) { - if (this.hasMixedContent) { - this.reload(""); - } - else { - this.svc.reloadFromFile(tempFileName || this.fileName); - this.markContainingProjectsAsDirty(); + } + server.createNormalizedPathMap = createNormalizedPathMap; + function isInferredProjectName(name) { + return /dev\/null\/inferredProject\d+\*/.test(name); + } + server.isInferredProjectName = isInferredProjectName; + function makeInferredProjectName(counter) { + return "/dev/null/inferredProject" + counter + "*"; + } + server.makeInferredProjectName = makeInferredProjectName; + function toSortedReadonlyArray(arr) { + arr.sort(); + return arr; + } + server.toSortedReadonlyArray = toSortedReadonlyArray; + var ThrottledOperations = (function () { + function ThrottledOperations(host) { + this.host = host; + this.pendingTimeouts = ts.createMap(); + } + ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { + var pendingTimeout = this.pendingTimeouts.get(operationId); + if (pendingTimeout) { + this.host.clearTimeout(pendingTimeout); } + this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb)); }; - ScriptInfo.prototype.snap = function () { - return this.svc.getSnapshot(); - }; - ScriptInfo.prototype.getLineInfo = function (line) { - var snap = this.snap(); - return snap.index.lineNumberToInfo(line); - }; - ScriptInfo.prototype.editContent = function (start, end, newText) { - this.svc.edit(start, end - start, newText); - this.markContainingProjectsAsDirty(); + ThrottledOperations.run = function (self, operationId, cb) { + self.pendingTimeouts.delete(operationId); + cb(); }; - ScriptInfo.prototype.markContainingProjectsAsDirty = function () { - for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { - var p = _a[_i]; - p.markAsDirty(); + return ThrottledOperations; + }()); + server.ThrottledOperations = ThrottledOperations; + var GcTimer = (function () { + function GcTimer(host, delay, logger) { + this.host = host; + this.delay = delay; + this.logger = logger; + } + GcTimer.prototype.scheduleCollect = function () { + if (!this.host.gc || this.timerId !== undefined) { + return; } + this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); }; - ScriptInfo.prototype.lineToTextSpan = function (line) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line + 1); - var len; - if (lineInfo.leaf) { - len = lineInfo.leaf.text.length; - } - else { - var nextLineInfo = index.lineNumberToInfo(line + 2); - len = nextLineInfo.offset - lineInfo.offset; + GcTimer.run = function (self) { + self.timerId = undefined; + var log = self.logger.hasLevel(LogLevel.requestTime); + var before = log && self.host.getMemoryUsage(); + self.host.gc(); + if (log) { + var after = self.host.getMemoryUsage(); + self.logger.perftrc("GC::before " + before + ", after " + after); } - return ts.createTextSpan(lineInfo.offset, len); - }; - ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) { - var index = this.snap().index; - var lineInfo = index.lineNumberToInfo(line); - return (lineInfo.offset + offset - 1); - }; - ScriptInfo.prototype.positionToLineOffset = function (position) { - var index = this.snap().index; - var lineOffset = index.charOffsetToLineNumberAndPos(position); - return { line: lineOffset.line, offset: lineOffset.offset + 1 }; }; - return ScriptInfo; + return GcTimer; }()); - server.ScriptInfo = ScriptInfo; + server.GcTimer = GcTimer; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var ts; (function (ts) { var server; (function (server) { - var LSHost = (function () { - function LSHost(host, project, cancellationToken) { - var _this = this; - this.host = host; - this.project = project; - this.cancellationToken = cancellationToken; - this.resolvedModuleNames = ts.createFileMap(); - this.resolvedTypeReferenceDirectives = ts.createFileMap(); - this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); - if (host.trace) { - this.trace = function (s) { return host.trace(s); }; - } - this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) { - var globalCache = _this.project.getTypeAcquisition().enable - ? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation - : undefined; - var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host); - if (!(primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) { - var _a = ts.loadModuleFromGlobalCache(moduleName, _this.project.getProjectName(), compilerOptions, host, globalCache), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; - if (resolvedModule) { - return { resolvedModule: resolvedModule, failedLookupLocations: primaryResult.failedLookupLocations.concat(failedLookupLocations) }; - } - } - return primaryResult; - }; - if (this.host.realpath) { - this.realpath = function (path) { return _this.host.realpath(path); }; + server.nullCancellationToken = { + isCancellationRequested: function () { return false; }, + setRequest: function () { return void 0; }, + resetRequest: function () { return void 0; } + }; + function hrTimeToMilliseconds(time) { + var seconds = time[0]; + var nanoseconds = time[1]; + return ((1e9 * seconds) + nanoseconds) / 1000000.0; + } + function shouldSkipSemanticCheck(project) { + if (project.projectKind === server.ProjectKind.Inferred || project.projectKind === server.ProjectKind.External) { + return project.isJsOnlyProject(); + } + else { + var options = project.getCompilerOptions(); + return options.skipLibCheck && !options.checkJs && project.isJsOnlyProject(); + } + } + function compareNumber(a, b) { + return a - b; + } + function compareFileStart(a, b) { + if (a.file < b.file) { + return -1; + } + else if (a.file === b.file) { + var n = compareNumber(a.start.line, b.start.line); + if (n === 0) { + return compareNumber(a.start.offset, b.start.offset); } + else + return n; } - LSHost.prototype.startRecordingFilesWithChangedResolutions = function () { - this.filesWithChangedSetOfUnresolvedImports = []; + else { + return 1; + } + } + function formatDiag(fileName, project, diag) { + var scriptInfo = project.getScriptInfoForNormalizedPath(fileName); + return { + start: scriptInfo.positionToLineOffset(diag.start), + end: scriptInfo.positionToLineOffset(diag.start + diag.length), + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"), + code: diag.code }; - LSHost.prototype.finishRecordingFilesWithChangedResolutions = function () { - var collected = this.filesWithChangedSetOfUnresolvedImports; - this.filesWithChangedSetOfUnresolvedImports = undefined; - return collected; + } + function formatConfigFileDiag(diag) { + return { + start: undefined, + end: undefined, + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") }; - LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult, getResultFileName, logChanges) { - var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); - var currentResolutionsInFile = cache.get(path); - var newResolutions = ts.createMap(); - var resolvedModules = []; - var compilerOptions = this.getCompilationSettings(); - var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; - for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_49 = names_2[_i]; - var resolution = newResolutions[name_49]; - if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_49]; - if (moduleResolutionIsValid(existingResolution)) { - resolution = existingResolution; - } - else { - newResolutions[name_49] = resolution = loader(name_49, containingFile, compilerOptions, this); - } - if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { - this.filesWithChangedSetOfUnresolvedImports.push(path); - logChanges = false; - } - } - ts.Debug.assert(resolution !== undefined); - resolvedModules.push(getResult(resolution)); - } - cache.set(path, newResolutions); - return resolvedModules; - function resolutionIsEqualTo(oldResolution, newResolution) { - if (oldResolution === newResolution) { - return true; - } - if (!oldResolution || !newResolution) { - return false; - } - var oldResult = getResult(oldResolution); - var newResult = getResult(newResolution); - if (oldResult === newResult) { - return true; - } - if (!oldResult || !newResult) { - return false; - } - return getResultFileName(oldResult) === getResultFileName(newResult); - } - function moduleResolutionIsValid(resolution) { - if (!resolution) { - return false; - } - var result = getResult(resolution); - if (result) { - return getResultFileName(result) !== lastDeletedFileName; - } - return resolution.failedLookupLocations.length === 0; - } - }; - LSHost.prototype.getProjectVersion = function () { - return this.project.getProjectVersion(); - }; - LSHost.prototype.getCompilationSettings = function () { - return this.compilationSettings; - }; - LSHost.prototype.useCaseSensitiveFileNames = function () { - return this.host.useCaseSensitiveFileNames; - }; - LSHost.prototype.getCancellationToken = function () { - return this.cancellationToken; - }; - LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { - return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; }, function (r) { return r.resolvedFileName; }, false); - }; - LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { - return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, this.resolveModuleName, function (m) { return m.resolvedModule; }, function (r) { return r.resolvedFileName; }, true); - }; - LSHost.prototype.getDefaultLibFileName = function () { - var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); - return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); - }; - LSHost.prototype.getScriptSnapshot = function (filename) { - var scriptInfo = this.project.getScriptInfoLSHost(filename); - if (scriptInfo) { - return scriptInfo.snap(); - } - }; - LSHost.prototype.getScriptFileNames = function () { - return this.project.getRootFilesLSHost(); - }; - LSHost.prototype.getTypeRootsVersion = function () { - return this.project.typesVersion; - }; - LSHost.prototype.getScriptKind = function (fileName) { - var info = this.project.getScriptInfoLSHost(fileName); - return info && info.scriptKind; - }; - LSHost.prototype.getScriptVersion = function (filename) { - var info = this.project.getScriptInfoLSHost(filename); - return info && info.getLatestVersion(); - }; - LSHost.prototype.getCurrentDirectory = function () { - return this.host.getCurrentDirectory(); - }; - LSHost.prototype.resolvePath = function (path) { - return this.host.resolvePath(path); - }; - LSHost.prototype.fileExists = function (path) { - return this.host.fileExists(path); - }; - LSHost.prototype.readFile = function (fileName) { - return this.host.readFile(fileName); - }; - LSHost.prototype.directoryExists = function (path) { - return this.host.directoryExists(path); - }; - LSHost.prototype.readDirectory = function (path, extensions, exclude, include) { - return this.host.readDirectory(path, extensions, exclude, include); - }; - LSHost.prototype.getDirectories = function (path) { - return this.host.getDirectories(path); - }; - LSHost.prototype.notifyFileRemoved = function (info) { - this.resolvedModuleNames.remove(info.path); - this.resolvedTypeReferenceDirectives.remove(info.path); - }; - LSHost.prototype.setCompilationSettings = function (opt) { - if (ts.changesAffectModuleResolution(this.compilationSettings, opt)) { - this.resolvedModuleNames.clear(); - this.resolvedTypeReferenceDirectives.clear(); - } - this.compilationSettings = opt; - }; - return LSHost; - }()); - server.LSHost = LSHost; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - server.nullTypingsInstaller = { - enqueueInstallTypingsRequest: ts.noop, - attach: ts.noop, - onProjectClosed: ts.noop, - globalTypingsCacheLocation: undefined - }; - var TypingsCacheEntry = (function () { - function TypingsCacheEntry() { - } - return TypingsCacheEntry; - }()); - function setIsEqualTo(arr1, arr2) { - if (arr1 === arr2) { - return true; - } - if ((arr1 || server.emptyArray).length === 0 && (arr2 || server.emptyArray).length === 0) { - return true; - } - var set = ts.createMap(); - var unique = 0; - for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) { - var v = arr1_1[_i]; - if (set[v] !== true) { - set[v] = true; - unique++; - } - } - for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) { - var v = arr2_1[_a]; - if (!ts.hasProperty(set, v)) { - return false; - } - if (set[v] === true) { - set[v] = false; - unique--; + } + function allEditsBeforePos(edits, pos) { + for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { + var edit = edits_1[_i]; + if (ts.textSpanEnd(edit.span) >= pos) { + return false; } } - return unique === 0; - } - function typeAcquisitionChanged(opt1, opt2) { - return opt1.enable !== opt2.enable || - !setIsEqualTo(opt1.include, opt2.include) || - !setIsEqualTo(opt1.exclude, opt2.exclude); - } - function compilerOptionsChanged(opt1, opt2) { - return opt1.allowJs != opt2.allowJs; + return true; } - function unresolvedImportsChanged(imports1, imports2) { - if (imports1 === imports2) { - return false; + var CommandNames; + (function (CommandNames) { + CommandNames.Brace = "brace"; + CommandNames.BraceFull = "brace-full"; + CommandNames.BraceCompletion = "braceCompletion"; + CommandNames.Change = "change"; + CommandNames.Close = "close"; + CommandNames.Completions = "completions"; + CommandNames.CompletionsFull = "completions-full"; + CommandNames.CompletionDetails = "completionEntryDetails"; + CommandNames.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; + CommandNames.CompileOnSaveEmitFile = "compileOnSaveEmitFile"; + CommandNames.Configure = "configure"; + CommandNames.Definition = "definition"; + CommandNames.DefinitionFull = "definition-full"; + CommandNames.Exit = "exit"; + CommandNames.Format = "format"; + CommandNames.Formatonkey = "formatonkey"; + CommandNames.FormatFull = "format-full"; + CommandNames.FormatonkeyFull = "formatonkey-full"; + CommandNames.FormatRangeFull = "formatRange-full"; + CommandNames.Geterr = "geterr"; + CommandNames.GeterrForProject = "geterrForProject"; + CommandNames.Implementation = "implementation"; + CommandNames.ImplementationFull = "implementation-full"; + CommandNames.SemanticDiagnosticsSync = "semanticDiagnosticsSync"; + CommandNames.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; + CommandNames.NavBar = "navbar"; + CommandNames.NavBarFull = "navbar-full"; + CommandNames.NavTree = "navtree"; + CommandNames.NavTreeFull = "navtree-full"; + CommandNames.Navto = "navto"; + CommandNames.NavtoFull = "navto-full"; + CommandNames.Occurrences = "occurrences"; + CommandNames.DocumentHighlights = "documentHighlights"; + CommandNames.DocumentHighlightsFull = "documentHighlights-full"; + CommandNames.Open = "open"; + CommandNames.Quickinfo = "quickinfo"; + CommandNames.QuickinfoFull = "quickinfo-full"; + CommandNames.References = "references"; + CommandNames.ReferencesFull = "references-full"; + CommandNames.Reload = "reload"; + CommandNames.Rename = "rename"; + CommandNames.RenameInfoFull = "rename-full"; + CommandNames.RenameLocationsFull = "renameLocations-full"; + CommandNames.Saveto = "saveto"; + CommandNames.SignatureHelp = "signatureHelp"; + CommandNames.SignatureHelpFull = "signatureHelp-full"; + CommandNames.TypeDefinition = "typeDefinition"; + CommandNames.ProjectInfo = "projectInfo"; + CommandNames.ReloadProjects = "reloadProjects"; + CommandNames.Unknown = "unknown"; + CommandNames.OpenExternalProject = "openExternalProject"; + CommandNames.OpenExternalProjects = "openExternalProjects"; + CommandNames.CloseExternalProject = "closeExternalProject"; + CommandNames.SynchronizeProjectList = "synchronizeProjectList"; + CommandNames.ApplyChangedToOpenFiles = "applyChangedToOpenFiles"; + CommandNames.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full"; + CommandNames.Cleanup = "cleanup"; + CommandNames.OutliningSpans = "outliningSpans"; + CommandNames.TodoComments = "todoComments"; + CommandNames.Indentation = "indentation"; + CommandNames.DocCommentTemplate = "docCommentTemplate"; + CommandNames.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full"; + CommandNames.NameOrDottedNameSpan = "nameOrDottedNameSpan"; + CommandNames.BreakpointStatement = "breakpointStatement"; + CommandNames.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; + CommandNames.GetCodeFixes = "getCodeFixes"; + CommandNames.GetCodeFixesFull = "getCodeFixes-full"; + CommandNames.GetSupportedCodeFixes = "getSupportedCodeFixes"; + })(CommandNames = server.CommandNames || (server.CommandNames = {})); + function formatMessage(msg, logger, byteLength, newLine) { + var verboseLogging = logger.hasLevel(server.LogLevel.verbose); + var json = JSON.stringify(msg); + if (verboseLogging) { + logger.info(msg.type + ": " + json); } - return !ts.arrayIsEqualTo(imports1, imports2); + var len = byteLength(json, "utf8"); + return "Content-Length: " + (1 + len) + "\r\n\r\n" + json + newLine; } - var TypingsCache = (function () { - function TypingsCache(installer) { - this.installer = installer; - this.perProjectCache = ts.createMap(); - } - TypingsCache.prototype.getTypingsForProject = function (project, unresolvedImports, forceRefresh) { - var typeAcquisition = project.getTypeAcquisition(); - if (!typeAcquisition || !typeAcquisition.enable) { - return server.emptyArray; - } - var entry = this.perProjectCache[project.getProjectName()]; - var result = entry ? entry.typings : server.emptyArray; - if (forceRefresh || - !entry || - typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || - compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || - unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { - this.perProjectCache[project.getProjectName()] = { - compilerOptions: project.getCompilerOptions(), - typeAcquisition: typeAcquisition, - typings: result, - unresolvedImports: unresolvedImports, - poisoned: true - }; - this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); - } - return result; - }; - TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) { - this.perProjectCache[projectName] = { - compilerOptions: compilerOptions, - typeAcquisition: typeAcquisition, - typings: server.toSortedReadonlyArray(newTypings), - unresolvedImports: unresolvedImports, - poisoned: false + server.formatMessage = formatMessage; + var MultistepOperation = (function () { + function MultistepOperation(operationHost) { + var _this = this; + this.operationHost = operationHost; + this.completed = true; + this.next = { + immediate: function (action) { return _this.immediate(action); }, + delay: function (ms, action) { return _this.delay(ms, action); } }; - }; - TypingsCache.prototype.deleteTypingsForProject = function (projectName) { - delete this.perProjectCache[projectName]; - }; - TypingsCache.prototype.onProjectClosed = function (project) { - delete this.perProjectCache[project.getProjectName()]; - this.installer.onProjectClosed(project); - }; - return TypingsCache; - }()); - server.TypingsCache = TypingsCache; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - function shouldEmitFile(scriptInfo) { - return !scriptInfo.hasMixedContent; - } - server.shouldEmitFile = shouldEmitFile; - var BuilderFileInfo = (function () { - function BuilderFileInfo(scriptInfo, project) { - this.scriptInfo = scriptInfo; - this.project = project; } - BuilderFileInfo.prototype.isExternalModuleOrHasOnlyAmbientExternalModules = function () { - var sourceFile = this.getSourceFile(); - return ts.isExternalModule(sourceFile) || this.containsOnlyAmbientModules(sourceFile); + MultistepOperation.prototype.startNew = function (action) { + this.complete(); + this.requestId = this.operationHost.getCurrentRequestId(); + this.completed = false; + this.executeAction(action); }; - BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var statement = _a[_i]; - if (statement.kind !== 230 || statement.name.kind !== 9) { - return false; + MultistepOperation.prototype.complete = function () { + if (!this.completed) { + if (this.requestId) { + this.operationHost.sendRequestCompletedEvent(this.requestId); } + this.completed = true; } - return true; + this.setTimerHandle(undefined); + this.setImmediateId(undefined); }; - BuilderFileInfo.prototype.computeHash = function (text) { - return this.project.projectService.host.createHash(text); + MultistepOperation.prototype.immediate = function (action) { + var _this = this; + var requestId = this.requestId; + ts.Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "immediate: incorrect request id"); + this.setImmediateId(this.operationHost.getServerHost().setImmediate(function () { + _this.immediateId = undefined; + _this.operationHost.executeWithRequestId(requestId, function () { return _this.executeAction(action); }); + })); }; - BuilderFileInfo.prototype.getSourceFile = function () { - return this.project.getSourceFile(this.scriptInfo.path); + MultistepOperation.prototype.delay = function (ms, action) { + var _this = this; + var requestId = this.requestId; + ts.Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "delay: incorrect request id"); + this.setTimerHandle(this.operationHost.getServerHost().setTimeout(function () { + _this.timerHandle = undefined; + _this.operationHost.executeWithRequestId(requestId, function () { return _this.executeAction(action); }); + }, ms)); }; - BuilderFileInfo.prototype.updateShapeSignature = function () { - var sourceFile = this.getSourceFile(); - if (!sourceFile) { - return true; - } - var lastSignature = this.lastCheckedShapeSignature; - if (sourceFile.isDeclarationFile) { - this.lastCheckedShapeSignature = this.computeHash(sourceFile.text); - } - else { - var emitOutput = this.project.getFileEmitOutput(this.scriptInfo, true); - if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) { - this.lastCheckedShapeSignature = this.computeHash(emitOutput.outputFiles[0].text); + MultistepOperation.prototype.executeAction = function (action) { + var stop = false; + try { + if (this.operationHost.isCancellationRequested()) { + stop = true; } - } - return !lastSignature || this.lastCheckedShapeSignature !== lastSignature; - }; - return BuilderFileInfo; - }()); - server.BuilderFileInfo = BuilderFileInfo; - var AbstractBuilder = (function () { - function AbstractBuilder(project, ctor) { - this.project = project; - this.ctor = ctor; - this.fileInfos = ts.createFileMap(); - } - AbstractBuilder.prototype.getFileInfo = function (path) { - return this.fileInfos.get(path); - }; - AbstractBuilder.prototype.getOrCreateFileInfo = function (path) { - var fileInfo = this.getFileInfo(path); - if (!fileInfo) { - var scriptInfo = this.project.getScriptInfo(path); - fileInfo = new this.ctor(scriptInfo, this.project); - this.setFileInfo(path, fileInfo); - } - return fileInfo; - }; - AbstractBuilder.prototype.getFileInfoPaths = function () { - return this.fileInfos.getKeys(); - }; - AbstractBuilder.prototype.setFileInfo = function (path, info) { - this.fileInfos.set(path, info); - }; - AbstractBuilder.prototype.removeFileInfo = function (path) { - this.fileInfos.remove(path); - }; - AbstractBuilder.prototype.forEachFileInfo = function (action) { - this.fileInfos.forEachValue(function (_path, value) { return action(value); }); - }; - AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { - var fileInfo = this.getFileInfo(scriptInfo.path); - if (!fileInfo) { - return false; - } - var _a = this.project.getFileEmitOutput(fileInfo.scriptInfo, false), emitSkipped = _a.emitSkipped, outputFiles = _a.outputFiles; - if (!emitSkipped) { - var projectRootPath = this.project.getProjectRootPath(); - for (var _i = 0, outputFiles_1 = outputFiles; _i < outputFiles_1.length; _i++) { - var outputFile = outputFiles_1[_i]; - var outputFileAbsoluteFileName = ts.getNormalizedAbsolutePath(outputFile.name, projectRootPath ? projectRootPath : ts.getDirectoryPath(scriptInfo.fileName)); - writeFile(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark); + else { + action(this.next); } } - return !emitSkipped; - }; - return AbstractBuilder; - }()); - var NonModuleBuilder = (function (_super) { - __extends(NonModuleBuilder, _super); - function NonModuleBuilder(project) { - var _this = _super.call(this, project, BuilderFileInfo) || this; - _this.project = project; - return _this; - } - NonModuleBuilder.prototype.onProjectUpdateGraph = function () { - }; - NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { - var info = this.getOrCreateFileInfo(scriptInfo.path); - var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; - if (info.updateShapeSignature()) { - var options = this.project.getCompilerOptions(); - if (options && (options.out || options.outFile)) { - return singleFileResult; + catch (e) { + stop = true; + if (!(e instanceof ts.OperationCanceledException)) { + this.operationHost.logError(e, "delayed processing of request " + this.requestId); } - return this.project.getAllEmittableFiles(); - } - return singleFileResult; - }; - return NonModuleBuilder; - }(AbstractBuilder)); - var ModuleBuilderFileInfo = (function (_super) { - __extends(ModuleBuilderFileInfo, _super); - function ModuleBuilderFileInfo() { - var _this = _super.apply(this, arguments) || this; - _this.references = []; - _this.referencedBy = []; - return _this; - } - ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) { - var l = lf.scriptInfo.fileName; - var r = rf.scriptInfo.fileName; - return (l < r ? -1 : (l > r ? 1 : 0)); - }; - ; - ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) { - if (array.length === 0) { - array.push(fileInfo); - return; - } - var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); - if (insertIndex < 0) { - array.splice(~insertIndex, 0, fileInfo); - } - }; - ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) { - if (!array || array.length === 0) { - return; - } - if (array[0] === fileInfo) { - array.splice(0, 1); - return; } - var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); - if (removeIndex >= 0) { - array.splice(removeIndex, 1); + if (stop || !this.hasPendingWork()) { + this.complete(); } }; - ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) { - ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo); - }; - ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) { - ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo); - }; - ModuleBuilderFileInfo.prototype.removeFileReferences = function () { - for (var _i = 0, _a = this.references; _i < _a.length; _i++) { - var reference = _a[_i]; - reference.removeReferencedBy(this); + MultistepOperation.prototype.setTimerHandle = function (timerHandle) { + if (this.timerHandle !== undefined) { + this.operationHost.getServerHost().clearTimeout(this.timerHandle); } - this.references = []; + this.timerHandle = timerHandle; }; - return ModuleBuilderFileInfo; - }(BuilderFileInfo)); - var ModuleBuilder = (function (_super) { - __extends(ModuleBuilder, _super); - function ModuleBuilder(project) { - var _this = _super.call(this, project, ModuleBuilderFileInfo) || this; - _this.project = project; - return _this; - } - ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { - var _this = this; - if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { - return []; - } - var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path); - if (referencedFilePaths.length > 0) { - return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos); + MultistepOperation.prototype.setImmediateId = function (immediateId) { + if (this.immediateId !== undefined) { + this.operationHost.getServerHost().clearImmediate(this.immediateId); } - return []; + this.immediateId = immediateId; }; - ModuleBuilder.prototype.onProjectUpdateGraph = function () { - this.ensureProjectDependencyGraphUpToDate(); + MultistepOperation.prototype.hasPendingWork = function () { + return !!this.timerHandle || !!this.immediateId; }; - ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () { + return MultistepOperation; + }()); + var Session = (function () { + function Session(opts) { var _this = this; - if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) { - var currentScriptInfos = this.project.getScriptInfos(); - for (var _i = 0, currentScriptInfos_1 = currentScriptInfos; _i < currentScriptInfos_1.length; _i++) { - var scriptInfo = currentScriptInfos_1[_i]; - var fileInfo = this.getOrCreateFileInfo(scriptInfo.path); - this.updateFileReferences(fileInfo); - } - this.forEachFileInfo(function (fileInfo) { - if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) { - fileInfo.removeFileReferences(); - _this.removeFileInfo(fileInfo.scriptInfo.path); + this.changeSeq = 0; + this.handlers = ts.createMapFromTemplate((_a = {}, + _a[CommandNames.OpenExternalProject] = function (request) { + _this.projectService.openExternalProject(request.arguments, false); + return _this.requiredResponse(true); + }, + _a[CommandNames.OpenExternalProjects] = function (request) { + _this.projectService.openExternalProjects(request.arguments.projects); + return _this.requiredResponse(true); + }, + _a[CommandNames.CloseExternalProject] = function (request) { + _this.projectService.closeExternalProject(request.arguments.projectFileName); + return _this.requiredResponse(true); + }, + _a[CommandNames.SynchronizeProjectList] = function (request) { + var result = _this.projectService.synchronizeProjectList(request.arguments.knownProjects); + if (!result.some(function (p) { return p.projectErrors && p.projectErrors.length !== 0; })) { + return _this.requiredResponse(result); } - }); - this.projectVersionForDependencyGraph = this.project.getProjectVersion(); - } - }; - ModuleBuilder.prototype.updateFileReferences = function (fileInfo) { - if (fileInfo.scriptVersionForReferences === fileInfo.scriptInfo.getLatestVersion()) { - return; - } - var newReferences = this.getReferencedFileInfos(fileInfo); - var oldReferences = fileInfo.references; - var oldIndex = 0; - var newIndex = 0; - while (oldIndex < oldReferences.length && newIndex < newReferences.length) { - var oldReference = oldReferences[oldIndex]; - var newReference = newReferences[newIndex]; - var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference); - if (compare < 0) { - oldReference.removeReferencedBy(fileInfo); - oldIndex++; - } - else if (compare > 0) { - newReference.addReferencedBy(fileInfo); - newIndex++; - } - else { - oldIndex++; - newIndex++; - } - } - for (var i = oldIndex; i < oldReferences.length; i++) { - oldReferences[i].removeReferencedBy(fileInfo); - } - for (var i = newIndex; i < newReferences.length; i++) { - newReferences[i].addReferencedBy(fileInfo); - } - fileInfo.references = newReferences; - fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion(); - }; - ModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { - this.ensureProjectDependencyGraphUpToDate(); - var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; - var fileInfo = this.getFileInfo(scriptInfo.path); - if (!fileInfo || !fileInfo.updateShapeSignature()) { - return singleFileResult; - } - if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { - return this.project.getAllEmittableFiles(); - } - var options = this.project.getCompilerOptions(); - if (options && (options.isolatedModules || options.out || options.outFile)) { - return singleFileResult; - } - var queue = fileInfo.referencedBy.slice(0); - var fileNameSet = ts.createMap(); - fileNameSet[scriptInfo.fileName] = scriptInfo; - while (queue.length > 0) { - var processingFileInfo = queue.pop(); - if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { - for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) { - var potentialFileInfo = _a[_i]; - if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) { - queue.push(potentialFileInfo); + var converted = ts.map(result, function (p) { + if (!p.projectErrors || p.projectErrors.length === 0) { + return p; } - } - } - fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo; - } - var result = []; - for (var fileName in fileNameSet) { - if (shouldEmitFile(fileNameSet[fileName])) { - result.push(fileName); - } - } - return result; - }; - return ModuleBuilder; - }(AbstractBuilder)); - function createBuilder(project) { - var moduleKind = project.getCompilerOptions().module; - switch (moduleKind) { - case ts.ModuleKind.None: - return new NonModuleBuilder(project); - default: - return new ModuleBuilder(project); - } - } - server.createBuilder = createBuilder; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - var ProjectKind; - (function (ProjectKind) { - ProjectKind[ProjectKind["Inferred"] = 0] = "Inferred"; - ProjectKind[ProjectKind["Configured"] = 1] = "Configured"; - ProjectKind[ProjectKind["External"] = 2] = "External"; - })(ProjectKind = server.ProjectKind || (server.ProjectKind = {})); - function remove(items, item) { - var index = items.indexOf(item); - if (index >= 0) { - items.splice(index, 1); + return { + info: p.info, + changes: p.changes, + files: p.files, + projectErrors: _this.convertToDiagnosticsWithLinePosition(p.projectErrors, undefined) + }; + }); + return _this.requiredResponse(converted); + }, + _a[CommandNames.ApplyChangedToOpenFiles] = function (request) { + _this.projectService.applyChangesInOpenFiles(request.arguments.openFiles, request.arguments.changedFiles, request.arguments.closedFiles); + _this.changeSeq++; + return _this.requiredResponse(true); + }, + _a[CommandNames.Exit] = function () { + _this.exit(); + return _this.notRequired(); + }, + _a[CommandNames.Definition] = function (request) { + return _this.requiredResponse(_this.getDefinition(request.arguments, true)); + }, + _a[CommandNames.DefinitionFull] = function (request) { + return _this.requiredResponse(_this.getDefinition(request.arguments, false)); + }, + _a[CommandNames.TypeDefinition] = function (request) { + return _this.requiredResponse(_this.getTypeDefinition(request.arguments)); + }, + _a[CommandNames.Implementation] = function (request) { + return _this.requiredResponse(_this.getImplementation(request.arguments, true)); + }, + _a[CommandNames.ImplementationFull] = function (request) { + return _this.requiredResponse(_this.getImplementation(request.arguments, false)); + }, + _a[CommandNames.References] = function (request) { + return _this.requiredResponse(_this.getReferences(request.arguments, true)); + }, + _a[CommandNames.ReferencesFull] = function (request) { + return _this.requiredResponse(_this.getReferences(request.arguments, false)); + }, + _a[CommandNames.Rename] = function (request) { + return _this.requiredResponse(_this.getRenameLocations(request.arguments, true)); + }, + _a[CommandNames.RenameLocationsFull] = function (request) { + return _this.requiredResponse(_this.getRenameLocations(request.arguments, false)); + }, + _a[CommandNames.RenameInfoFull] = function (request) { + return _this.requiredResponse(_this.getRenameInfo(request.arguments)); + }, + _a[CommandNames.Open] = function (request) { + _this.openClientFile(server.toNormalizedPath(request.arguments.file), request.arguments.fileContent, server.convertScriptKindName(request.arguments.scriptKindName)); + return _this.notRequired(); + }, + _a[CommandNames.Quickinfo] = function (request) { + return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, true)); + }, + _a[CommandNames.QuickinfoFull] = function (request) { + return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, false)); + }, + _a[CommandNames.OutliningSpans] = function (request) { + return _this.requiredResponse(_this.getOutliningSpans(request.arguments)); + }, + _a[CommandNames.TodoComments] = function (request) { + return _this.requiredResponse(_this.getTodoComments(request.arguments)); + }, + _a[CommandNames.Indentation] = function (request) { + return _this.requiredResponse(_this.getIndentation(request.arguments)); + }, + _a[CommandNames.NameOrDottedNameSpan] = function (request) { + return _this.requiredResponse(_this.getNameOrDottedNameSpan(request.arguments)); + }, + _a[CommandNames.BreakpointStatement] = function (request) { + return _this.requiredResponse(_this.getBreakpointStatement(request.arguments)); + }, + _a[CommandNames.BraceCompletion] = function (request) { + return _this.requiredResponse(_this.isValidBraceCompletion(request.arguments)); + }, + _a[CommandNames.DocCommentTemplate] = function (request) { + return _this.requiredResponse(_this.getDocCommentTemplate(request.arguments)); + }, + _a[CommandNames.Format] = function (request) { + return _this.requiredResponse(_this.getFormattingEditsForRange(request.arguments)); + }, + _a[CommandNames.Formatonkey] = function (request) { + return _this.requiredResponse(_this.getFormattingEditsAfterKeystroke(request.arguments)); + }, + _a[CommandNames.FormatFull] = function (request) { + return _this.requiredResponse(_this.getFormattingEditsForDocumentFull(request.arguments)); + }, + _a[CommandNames.FormatonkeyFull] = function (request) { + return _this.requiredResponse(_this.getFormattingEditsAfterKeystrokeFull(request.arguments)); + }, + _a[CommandNames.FormatRangeFull] = function (request) { + return _this.requiredResponse(_this.getFormattingEditsForRangeFull(request.arguments)); + }, + _a[CommandNames.Completions] = function (request) { + return _this.requiredResponse(_this.getCompletions(request.arguments, true)); + }, + _a[CommandNames.CompletionsFull] = function (request) { + return _this.requiredResponse(_this.getCompletions(request.arguments, false)); + }, + _a[CommandNames.CompletionDetails] = function (request) { + return _this.requiredResponse(_this.getCompletionEntryDetails(request.arguments)); + }, + _a[CommandNames.CompileOnSaveAffectedFileList] = function (request) { + return _this.requiredResponse(_this.getCompileOnSaveAffectedFileList(request.arguments)); + }, + _a[CommandNames.CompileOnSaveEmitFile] = function (request) { + return _this.requiredResponse(_this.emitFile(request.arguments)); + }, + _a[CommandNames.SignatureHelp] = function (request) { + return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, true)); + }, + _a[CommandNames.SignatureHelpFull] = function (request) { + return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, false)); + }, + _a[CommandNames.CompilerOptionsDiagnosticsFull] = function (request) { + return _this.requiredResponse(_this.getCompilerOptionsDiagnostics(request.arguments)); + }, + _a[CommandNames.EncodedSemanticClassificationsFull] = function (request) { + return _this.requiredResponse(_this.getEncodedSemanticClassifications(request.arguments)); + }, + _a[CommandNames.Cleanup] = function () { + _this.cleanup(); + return _this.requiredResponse(true); + }, + _a[CommandNames.SemanticDiagnosticsSync] = function (request) { + return _this.requiredResponse(_this.getSemanticDiagnosticsSync(request.arguments)); + }, + _a[CommandNames.SyntacticDiagnosticsSync] = function (request) { + return _this.requiredResponse(_this.getSyntacticDiagnosticsSync(request.arguments)); + }, + _a[CommandNames.Geterr] = function (request) { + _this.errorCheck.startNew(function (next) { return _this.getDiagnostics(next, request.arguments.delay, request.arguments.files); }); + return _this.notRequired(); + }, + _a[CommandNames.GeterrForProject] = function (request) { + _this.errorCheck.startNew(function (next) { return _this.getDiagnosticsForProject(next, request.arguments.delay, request.arguments.file); }); + return _this.notRequired(); + }, + _a[CommandNames.Change] = function (request) { + _this.change(request.arguments); + return _this.notRequired(); + }, + _a[CommandNames.Configure] = function (request) { + _this.projectService.setHostConfiguration(request.arguments); + _this.output(undefined, CommandNames.Configure, request.seq); + return _this.notRequired(); + }, + _a[CommandNames.Reload] = function (request) { + _this.reload(request.arguments, request.seq); + return _this.requiredResponse({ reloadFinished: true }); + }, + _a[CommandNames.Saveto] = function (request) { + var savetoArgs = request.arguments; + _this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + return _this.notRequired(); + }, + _a[CommandNames.Close] = function (request) { + var closeArgs = request.arguments; + _this.closeClientFile(closeArgs.file); + return _this.notRequired(); + }, + _a[CommandNames.Navto] = function (request) { + return _this.requiredResponse(_this.getNavigateToItems(request.arguments, true)); + }, + _a[CommandNames.NavtoFull] = function (request) { + return _this.requiredResponse(_this.getNavigateToItems(request.arguments, false)); + }, + _a[CommandNames.Brace] = function (request) { + return _this.requiredResponse(_this.getBraceMatching(request.arguments, true)); + }, + _a[CommandNames.BraceFull] = function (request) { + return _this.requiredResponse(_this.getBraceMatching(request.arguments, false)); + }, + _a[CommandNames.NavBar] = function (request) { + return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, true)); + }, + _a[CommandNames.NavBarFull] = function (request) { + return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false)); + }, + _a[CommandNames.NavTree] = function (request) { + return _this.requiredResponse(_this.getNavigationTree(request.arguments, true)); + }, + _a[CommandNames.NavTreeFull] = function (request) { + return _this.requiredResponse(_this.getNavigationTree(request.arguments, false)); + }, + _a[CommandNames.Occurrences] = function (request) { + return _this.requiredResponse(_this.getOccurrences(request.arguments)); + }, + _a[CommandNames.DocumentHighlights] = function (request) { + return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, true)); + }, + _a[CommandNames.DocumentHighlightsFull] = function (request) { + return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false)); + }, + _a[CommandNames.CompilerOptionsForInferredProjects] = function (request) { + _this.setCompilerOptionsForInferredProjects(request.arguments); + return _this.requiredResponse(true); + }, + _a[CommandNames.ProjectInfo] = function (request) { + return _this.requiredResponse(_this.getProjectInfo(request.arguments)); + }, + _a[CommandNames.ReloadProjects] = function () { + _this.projectService.reloadProjects(); + return _this.notRequired(); + }, + _a[CommandNames.GetCodeFixes] = function (request) { + return _this.requiredResponse(_this.getCodeFixes(request.arguments, true)); + }, + _a[CommandNames.GetCodeFixesFull] = function (request) { + return _this.requiredResponse(_this.getCodeFixes(request.arguments, false)); + }, + _a[CommandNames.GetSupportedCodeFixes] = function () { + return _this.requiredResponse(_this.getSupportedCodeFixes()); + }, + _a)); + this.host = opts.host; + this.cancellationToken = opts.cancellationToken; + this.typingsInstaller = opts.typingsInstaller; + this.byteLength = opts.byteLength; + this.hrtime = opts.hrtime; + this.logger = opts.logger; + this.canUseEvents = opts.canUseEvents; + var throttleWaitMilliseconds = opts.throttleWaitMilliseconds; + this.eventHandler = this.canUseEvents + ? opts.eventHandler || (function (event) { return _this.defaultEventHandler(event); }) + : undefined; + var multistepOperationHost = { + executeWithRequestId: function (requestId, action) { return _this.executeWithRequestId(requestId, action); }, + getCurrentRequestId: function () { return _this.currentRequestId; }, + getServerHost: function () { return _this.host; }, + logError: function (err, cmd) { return _this.logError(err, cmd); }, + sendRequestCompletedEvent: function (requestId) { return _this.sendRequestCompletedEvent(requestId); }, + isCancellationRequested: function () { return _this.cancellationToken.isCancellationRequested(); } + }; + this.errorCheck = new MultistepOperation(multistepOperationHost); + var settings = { + host: this.host, + logger: this.logger, + cancellationToken: this.cancellationToken, + useSingleInferredProject: opts.useSingleInferredProject, + typingsInstaller: this.typingsInstaller, + throttleWaitMilliseconds: throttleWaitMilliseconds, + eventHandler: this.eventHandler, + globalPlugins: opts.globalPlugins, + pluginProbeLocations: opts.pluginProbeLocations + }; + this.projectService = new server.ProjectService(settings); + this.gcTimer = new server.GcTimer(this.host, 7000, this.logger); + var _a; } - } - function countEachFileTypes(infos) { - var result = { js: 0, jsx: 0, ts: 0, tsx: 0, dts: 0 }; - for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) { - var info = infos_1[_i]; - switch (info.scriptKind) { - case 1: - result.js += 1; - break; - case 2: - result.jsx += 1; + Session.prototype.sendRequestCompletedEvent = function (requestId) { + var event = { + seq: 0, + type: "event", + event: "requestCompleted", + body: { request_seq: requestId } + }; + this.send(event); + }; + Session.prototype.defaultEventHandler = function (event) { + var _this = this; + switch (event.eventName) { + case server.ContextEvent: + var _a = event.data, project_1 = _a.project, fileName_2 = _a.fileName; + this.projectService.logger.info("got context event, updating diagnostics for " + fileName_2); + this.errorCheck.startNew(function (next) { return _this.updateErrorCheck(next, [{ fileName: fileName_2, project: project_1 }], _this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); }); break; - case 3: - ts.fileExtensionIs(info.fileName, ".d.ts") - ? result.dts += 1 - : result.ts += 1; + case server.ConfigFileDiagEvent: + var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics; + this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics); break; - case 4: - result.tsx += 1; + case server.ProjectLanguageServiceStateEvent: + var eventName = "projectLanguageServiceState"; + this.event({ + projectName: event.data.project.getProjectName(), + languageServiceEnabled: event.data.languageServiceEnabled + }, eventName); break; } - } - return result; - } - function hasOneOrMoreJsAndNoTsFiles(project) { - var counts = countEachFileTypes(project.getScriptInfos()); - return counts.js > 0 && counts.ts === 0 && counts.tsx === 0; - } - function allRootFilesAreJsOrDts(project) { - var counts = countEachFileTypes(project.getRootScriptInfos()); - return counts.ts === 0 && counts.tsx === 0; - } - server.allRootFilesAreJsOrDts = allRootFilesAreJsOrDts; - function allFilesAreJsOrDts(project) { - var counts = countEachFileTypes(project.getScriptInfos()); - return counts.ts === 0 && counts.tsx === 0; - } - server.allFilesAreJsOrDts = allFilesAreJsOrDts; - var UnresolvedImportsMap = (function () { - function UnresolvedImportsMap() { - this.perFileMap = ts.createFileMap(); - this.version = 0; - } - UnresolvedImportsMap.prototype.clear = function () { - this.perFileMap.clear(); - this.version = 0; - }; - UnresolvedImportsMap.prototype.getVersion = function () { - return this.version; }; - UnresolvedImportsMap.prototype.remove = function (path) { - this.perFileMap.remove(path); - this.version++; + Session.prototype.logError = function (err, cmd) { + var msg = "Exception on executing command " + cmd; + if (err.message) { + msg += ":\n" + err.message; + if (err.stack) { + msg += "\n" + err.stack; + } + } + this.logger.msg(msg, server.Msg.Err); }; - UnresolvedImportsMap.prototype.get = function (path) { - return this.perFileMap.get(path); + Session.prototype.send = function (msg) { + if (msg.type === "event" && !this.canUseEvents) { + if (this.logger.hasLevel(server.LogLevel.verbose)) { + this.logger.info("Session does not support events: ignored event: " + JSON.stringify(msg)); + } + return; + } + this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine)); }; - UnresolvedImportsMap.prototype.set = function (path, value) { - this.perFileMap.set(path, value); - this.version++; + Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) { + var bakedDiags = ts.map(diagnostics, formatConfigFileDiag); + var ev = { + seq: 0, + type: "event", + event: "configFileDiag", + body: { + triggerFile: triggerFile, + configFile: configFile, + diagnostics: bakedDiags + } + }; + this.send(ev); }; - return UnresolvedImportsMap; - }()); - server.UnresolvedImportsMap = UnresolvedImportsMap; - var emptyResult = []; - var getEmptyResult = function () { return emptyResult; }; - var getUndefined = function () { return undefined; }; - var emptyEncodedSemanticClassifications = { spans: emptyResult, endOfLineState: 0 }; - function createNoSemanticFeaturesWrapper(realLanguageService) { - return { - cleanupSemanticCache: ts.noop, - getSyntacticDiagnostics: function (fileName) { - return fileName ? realLanguageService.getSyntacticDiagnostics(fileName) : emptyResult; - }, - getSemanticDiagnostics: getEmptyResult, - getCompilerOptionsDiagnostics: function () { - return realLanguageService.getCompilerOptionsDiagnostics(); - }, - getSyntacticClassifications: function (fileName, span) { - return realLanguageService.getSyntacticClassifications(fileName, span); - }, - getEncodedSyntacticClassifications: function (fileName, span) { - return realLanguageService.getEncodedSyntacticClassifications(fileName, span); - }, - getSemanticClassifications: getEmptyResult, - getEncodedSemanticClassifications: function () { - return emptyEncodedSemanticClassifications; - }, - getCompletionsAtPosition: getUndefined, - findReferences: getEmptyResult, - getCompletionEntryDetails: getUndefined, - getQuickInfoAtPosition: getUndefined, - findRenameLocations: getEmptyResult, - getNameOrDottedNameSpan: function (fileName, startPos, endPos) { - return realLanguageService.getNameOrDottedNameSpan(fileName, startPos, endPos); - }, - getBreakpointStatementAtPosition: function (fileName, position) { - return realLanguageService.getBreakpointStatementAtPosition(fileName, position); - }, - getBraceMatchingAtPosition: function (fileName, position) { - return realLanguageService.getBraceMatchingAtPosition(fileName, position); - }, - getSignatureHelpItems: getUndefined, - getDefinitionAtPosition: getEmptyResult, - getRenameInfo: function () { return ({ - canRename: false, - localizedErrorMessage: ts.getLocaleSpecificMessage(ts.Diagnostics.Language_service_is_disabled), - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }); }, - getTypeDefinitionAtPosition: getUndefined, - getReferencesAtPosition: getEmptyResult, - getDocumentHighlights: getEmptyResult, - getOccurrencesAtPosition: getEmptyResult, - getNavigateToItems: getEmptyResult, - getNavigationBarItems: function (fileName) { - return realLanguageService.getNavigationBarItems(fileName); - }, - getNavigationTree: function (fileName) { - return realLanguageService.getNavigationTree(fileName); - }, - getOutliningSpans: function (fileName) { - return realLanguageService.getOutliningSpans(fileName); - }, - getTodoComments: getEmptyResult, - getIndentationAtPosition: function (fileName, position, options) { - return realLanguageService.getIndentationAtPosition(fileName, position, options); - }, - getFormattingEditsForRange: function (fileName, start, end, options) { - return realLanguageService.getFormattingEditsForRange(fileName, start, end, options); - }, - getFormattingEditsForDocument: function (fileName, options) { - return realLanguageService.getFormattingEditsForDocument(fileName, options); - }, - getFormattingEditsAfterKeystroke: function (fileName, position, key, options) { - return realLanguageService.getFormattingEditsAfterKeystroke(fileName, position, key, options); - }, - getDocCommentTemplateAtPosition: function (fileName, position) { - return realLanguageService.getDocCommentTemplateAtPosition(fileName, position); - }, - isValidBraceCompletionAtPosition: function (fileName, position, openingBrace) { - return realLanguageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace); - }, - getEmitOutput: getUndefined, - getProgram: function () { - return realLanguageService.getProgram(); - }, - getNonBoundSourceFile: function (fileName) { - return realLanguageService.getNonBoundSourceFile(fileName); - }, - dispose: function () { - return realLanguageService.dispose(); - }, - getCompletionEntrySymbol: getUndefined, - getImplementationAtPosition: getEmptyResult, - getSourceFile: function (fileName) { - return realLanguageService.getSourceFile(fileName); - }, - getCodeFixesAtPosition: getEmptyResult + Session.prototype.event = function (info, eventName) { + var ev = { + seq: 0, + type: "event", + event: eventName, + body: info + }; + this.send(ev); }; - } - server.createNoSemanticFeaturesWrapper = createNoSemanticFeaturesWrapper; - var Project = (function () { - function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) { - this.projectName = projectName; - this.projectKind = projectKind; - this.projectService = projectService; - this.documentRegistry = documentRegistry; - this.compilerOptions = compilerOptions; - this.compileOnSaveEnabled = compileOnSaveEnabled; - this.rootFiles = []; - this.rootFilesMap = ts.createFileMap(); - this.cachedUnresolvedImportsPerFile = new UnresolvedImportsMap(); - this.languageServiceEnabled = true; - this.lastReportedVersion = 0; - this.projectStructureVersion = 0; - this.projectStateVersion = 0; - this.typesVersion = 0; - if (!this.compilerOptions) { - this.compilerOptions = ts.getDefaultCompilerOptions(); - this.compilerOptions.allowNonTsExtensions = true; - this.compilerOptions.allowJs = true; + Session.prototype.output = function (info, cmdName, reqSeq, errorMsg) { + if (reqSeq === void 0) { reqSeq = 0; } + var res = { + seq: 0, + type: "response", + command: cmdName, + request_seq: reqSeq, + success: !errorMsg, + }; + if (!errorMsg) { + res.body = info; } - else if (hasExplicitListOfFiles) { - this.compilerOptions.allowNonTsExtensions = true; + else { + res.message = errorMsg; } - if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { - this.compilerOptions.noEmitForJsFiles = true; + this.send(res); + }; + Session.prototype.semanticCheck = function (file, project) { + try { + var diags = []; + if (!shouldSkipSemanticCheck(project)) { + diags = project.getLanguageService().getSemanticDiagnostics(file); + } + var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); } - this.lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken); - this.lsHost.setCompilationSettings(this.compilerOptions); - this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); - this.noSemanticFeaturesLanguageService = createNoSemanticFeaturesWrapper(this.languageService); - if (!languageServiceEnabled) { - this.disableLanguageService(); + catch (err) { + this.logError(err, "semantic check"); } - this.builder = server.createBuilder(this); - this.markAsDirty(); - } - Project.prototype.isNonTsProject = function () { - this.updateGraph(); - return allFilesAreJsOrDts(this); - }; - Project.prototype.isJsOnlyProject = function () { - this.updateGraph(); - return hasOneOrMoreJsAndNoTsFiles(this); - }; - Project.prototype.getCachedUnresolvedImportsPerFile_TestOnly = function () { - return this.cachedUnresolvedImportsPerFile; - }; - Project.prototype.getProjectErrors = function () { - return this.projectErrors; }; - Project.prototype.getLanguageService = function (ensureSynchronized) { - if (ensureSynchronized === void 0) { ensureSynchronized = true; } - if (ensureSynchronized) { - this.updateGraph(); + Session.prototype.syntacticCheck = function (file, project) { + try { + var diags = project.getLanguageService().getSyntacticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + } } - return this.languageServiceEnabled - ? this.languageService - : this.noSemanticFeaturesLanguageService; - }; - Project.prototype.getCompileOnSaveAffectedFileList = function (scriptInfo) { - if (!this.languageServiceEnabled) { - return []; + catch (err) { + this.logError(err, "syntactic check"); } - this.updateGraph(); - return this.builder.getFilesAffectedBy(scriptInfo); }; - Project.prototype.getProjectVersion = function () { - return this.projectStateVersion.toString(); + Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) { + var _this = this; + if (ms === void 0) { ms = 1500; } + this.host.setTimeout(function () { + if (matchSeq(seq)) { + _this.projectService.refreshInferredProjects(); + } + }, ms); }; - Project.prototype.enableLanguageService = function () { - if (this.languageServiceEnabled) { - return; + Session.prototype.updateErrorCheck = function (next, checkList, seq, matchSeq, ms, followMs, requireOpen) { + var _this = this; + if (ms === void 0) { ms = 1500; } + if (followMs === void 0) { followMs = 200; } + if (requireOpen === void 0) { requireOpen = true; } + if (followMs > ms) { + followMs = ms; + } + var index = 0; + var checkOne = function () { + if (matchSeq(seq)) { + var checkSpec_1 = checkList[index]; + index++; + if (checkSpec_1.project.containsFile(checkSpec_1.fileName, requireOpen)) { + _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project); + next.immediate(function () { + _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project); + if (checkList.length > index) { + next.delay(followMs, checkOne); + } + }); + } + } + }; + if ((checkList.length > index) && (matchSeq(seq))) { + next.delay(ms, checkOne); } - this.languageServiceEnabled = true; - this.projectService.onUpdateLanguageServiceStateForProject(this, true); }; - Project.prototype.disableLanguageService = function () { - if (!this.languageServiceEnabled) { + Session.prototype.cleanProjects = function (caption, projects) { + if (!projects) { return; } - this.languageService.cleanupSemanticCache(); - this.languageServiceEnabled = false; - this.projectService.onUpdateLanguageServiceStateForProject(this, false); - }; - Project.prototype.getProjectName = function () { - return this.projectName; - }; - Project.prototype.getSourceFile = function (path) { - if (!this.program) { - return undefined; + this.logger.info("cleaning " + caption); + for (var _i = 0, projects_1 = projects; _i < projects_1.length; _i++) { + var p = projects_1[_i]; + p.getLanguageService(false).cleanupSemanticCache(); } - return this.program.getSourceFileByPath(path); - }; - Project.prototype.updateTypes = function () { - this.typesVersion++; - this.markAsDirty(); - this.updateGraph(); }; - Project.prototype.close = function () { - if (this.program) { - for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) { - var f = _a[_i]; - var info = this.projectService.getScriptInfo(f.fileName); - info.detachFromProject(this); - } - } - else { - for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) { - var root = _c[_b]; - root.detachFromProject(this); - } + Session.prototype.cleanup = function () { + this.cleanProjects("inferred projects", this.projectService.inferredProjects); + this.cleanProjects("configured projects", this.projectService.configuredProjects); + this.cleanProjects("external projects", this.projectService.externalProjects); + if (this.host.gc) { + this.logger.info("host.gc()"); + this.host.gc(); } - this.rootFiles = undefined; - this.rootFilesMap = undefined; - this.program = undefined; - this.languageService.dispose(); - }; - Project.prototype.getCompilerOptions = function () { - return this.compilerOptions; - }; - Project.prototype.hasRoots = function () { - return this.rootFiles && this.rootFiles.length > 0; }; - Project.prototype.getRootFiles = function () { - return this.rootFiles && this.rootFiles.map(function (info) { return info.fileName; }); + Session.prototype.getEncodedSemanticClassifications = function (args) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + return project.getLanguageService().getEncodedSemanticClassifications(file, args); }; - Project.prototype.getRootFilesLSHost = function () { - var result = []; - if (this.rootFiles) { - for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) { - var f = _a[_i]; - result.push(f.fileName); - } - if (this.typingFiles) { - for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) { - var f = _c[_b]; - result.push(f); - } - } - } - return result; + Session.prototype.getProject = function (projectFileName) { + return projectFileName && this.projectService.findProject(projectFileName); }; - Project.prototype.getRootScriptInfos = function () { - return this.rootFiles; + Session.prototype.getCompilerOptionsDiagnostics = function (args) { + var project = this.getProject(args.projectFileName); + return this.convertToDiagnosticsWithLinePosition(project.getLanguageService().getCompilerOptionsDiagnostics(), undefined); }; - Project.prototype.getScriptInfos = function () { + Session.prototype.convertToDiagnosticsWithLinePosition = function (diagnostics, scriptInfo) { var _this = this; - return ts.map(this.program.getSourceFiles(), function (sourceFile) { - var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path); - if (!scriptInfo) { - ts.Debug.assert(false, "scriptInfo for a file '" + sourceFile.fileName + "' is missing."); - } - return scriptInfo; - }); + return diagnostics.map(function (d) { return ({ + message: ts.flattenDiagnosticMessageText(d.messageText, _this.host.newLine), + start: d.start, + length: d.length, + category: ts.DiagnosticCategory[d.category].toLowerCase(), + code: d.code, + startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start), + endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length) + }); }); }; - Project.prototype.getFileEmitOutput = function (info, emitOnlyDtsFiles) { - if (!this.languageServiceEnabled) { - return undefined; + Session.prototype.getDiagnosticsWorker = function (args, isSemantic, selector, includeLinePosition) { + var _a = this.getFileAndProject(args), project = _a.project, file = _a.file; + if (isSemantic && shouldSkipSemanticCheck(project)) { + return []; } - return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles); + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var diagnostics = selector(project, file); + return includeLinePosition + ? this.convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo) + : diagnostics.map(function (d) { return formatDiag(file, project, d); }); }; - Project.prototype.getFileNames = function (excludeFilesFromExternalLibraries) { - if (!this.program) { - return []; + Session.prototype.getDefinition = function (args, simplifiedResult) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + var definitions = project.getLanguageService().getDefinitionAtPosition(file, position); + if (!definitions) { + return undefined; } - if (!this.languageServiceEnabled) { - var rootFiles = this.getRootFiles(); - if (this.compilerOptions) { - var defaultLibrary = ts.getDefaultLibFilePath(this.compilerOptions); - if (defaultLibrary) { - (rootFiles || (rootFiles = [])).push(server.asNormalizedPath(defaultLibrary)); - } - } - return rootFiles; + if (simplifiedResult) { + return definitions.map(function (def) { + var defScriptInfo = project.getScriptInfo(def.fileName); + return { + file: def.fileName, + start: defScriptInfo.positionToLineOffset(def.textSpan.start), + end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan)) + }; + }); } - var result = []; - for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) { - var f = _a[_i]; - if (excludeFilesFromExternalLibraries && this.program.isSourceFileFromExternalLibrary(f)) { - continue; - } - result.push(server.asNormalizedPath(f.fileName)); + else { + return definitions; } - return result; }; - Project.prototype.getAllEmittableFiles = function () { - if (!this.languageServiceEnabled) { + Session.prototype.getTypeDefinition = function (args) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + var definitions = project.getLanguageService().getTypeDefinitionAtPosition(file, position); + if (!definitions) { + return undefined; + } + return definitions.map(function (def) { + var defScriptInfo = project.getScriptInfo(def.fileName); + return { + file: def.fileName, + start: defScriptInfo.positionToLineOffset(def.textSpan.start), + end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan)) + }; + }); + }; + Session.prototype.getImplementation = function (args, simplifiedResult) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); + var implementations = project.getLanguageService().getImplementationAtPosition(file, position); + if (!implementations) { return []; } - var defaultLibraryFileName = ts.getDefaultLibFileName(this.compilerOptions); - var infos = this.getScriptInfos(); - var result = []; - for (var _i = 0, infos_2 = infos; _i < infos_2.length; _i++) { - var info = infos_2[_i]; - if (ts.getBaseFileName(info.fileName) !== defaultLibraryFileName && server.shouldEmitFile(info)) { - result.push(info.fileName); - } + if (simplifiedResult) { + return implementations.map(function (_a) { + var fileName = _a.fileName, textSpan = _a.textSpan; + var scriptInfo = project.getScriptInfo(fileName); + return { + file: fileName, + start: scriptInfo.positionToLineOffset(textSpan.start), + end: scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)) + }; + }); } - return result; - }; - Project.prototype.containsScriptInfo = function (info) { - return this.isRoot(info) || (this.program && this.program.getSourceFileByPath(info.path) !== undefined); - }; - Project.prototype.containsFile = function (filename, requireOpen) { - var info = this.projectService.getScriptInfoForNormalizedPath(filename); - if (info && (info.isOpen || !requireOpen)) { - return this.containsScriptInfo(info); + else { + return implementations; } }; - Project.prototype.isRoot = function (info) { - return this.rootFilesMap && this.rootFilesMap.contains(info.path); - }; - Project.prototype.addRoot = function (info) { - if (!this.isRoot(info)) { - this.rootFiles.push(info); - this.rootFilesMap.set(info.path, info); - info.attachToProject(this); - this.markAsDirty(); + Session.prototype.getOccurrences = function (args) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + var occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position); + if (!occurrences) { + return undefined; } + return occurrences.map(function (occurrence) { + var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan, isInString = occurrence.isInString; + var scriptInfo = project.getScriptInfo(fileName); + var start = scriptInfo.positionToLineOffset(textSpan.start); + var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)); + var result = { + start: start, + end: end, + file: fileName, + isWriteAccess: isWriteAccess, + }; + if (isInString) { + result.isInString = isInString; + } + return result; + }); }; - Project.prototype.removeFile = function (info, detachFromProject) { - if (detachFromProject === void 0) { detachFromProject = true; } - this.removeRootFileIfNecessary(info); - this.lsHost.notifyFileRemoved(info); - this.cachedUnresolvedImportsPerFile.remove(info.path); - if (detachFromProject) { - info.detachFromProject(this); - } - this.markAsDirty(); + Session.prototype.getSyntacticDiagnosticsSync = function (args) { + return this.getDiagnosticsWorker(args, false, function (project, file) { return project.getLanguageService().getSyntacticDiagnostics(file); }, args.includeLinePosition); }; - Project.prototype.markAsDirty = function () { - this.projectStateVersion++; + Session.prototype.getSemanticDiagnosticsSync = function (args) { + return this.getDiagnosticsWorker(args, true, function (project, file) { return project.getLanguageService().getSemanticDiagnostics(file); }, args.includeLinePosition); }; - Project.prototype.extractUnresolvedImportsFromSourceFile = function (file, result) { - var cached = this.cachedUnresolvedImportsPerFile.get(file.path); - if (cached) { - for (var _i = 0, cached_1 = cached; _i < cached_1.length; _i++) { - var f = cached_1[_i]; - result.push(f); - } - return; - } - var unresolvedImports; - if (file.resolvedModules) { - for (var name_50 in file.resolvedModules) { - if (!file.resolvedModules[name_50] && !ts.isExternalModuleNameRelative(name_50)) { - var trimmed = name_50.trim(); - var i = trimmed.indexOf("/"); - if (i !== -1 && trimmed.charCodeAt(0) === 64) { - i = trimmed.indexOf("/", i + 1); - } - if (i !== -1) { - trimmed = trimmed.substr(0, i); - } - (unresolvedImports || (unresolvedImports = [])).push(trimmed); - result.push(trimmed); - } - } + Session.prototype.getDocumentHighlights = function (args, simplifiedResult) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + var documentHighlights = project.getLanguageService().getDocumentHighlights(file, position, args.filesToSearch); + if (!documentHighlights) { + return undefined; } - this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray); - }; - Project.prototype.updateGraph = function () { - if (!this.languageServiceEnabled) { - return true; + if (simplifiedResult) { + return documentHighlights.map(convertToDocumentHighlightsItem); } - this.lsHost.startRecordingFilesWithChangedResolutions(); - var hasChanges = this.updateGraphWorker(); - var changedFiles = this.lsHost.finishRecordingFilesWithChangedResolutions() || server.emptyArray; - for (var _i = 0, changedFiles_1 = changedFiles; _i < changedFiles_1.length; _i++) { - var file = changedFiles_1[_i]; - this.cachedUnresolvedImportsPerFile.remove(file); + else { + return documentHighlights; } - var unresolvedImports; - if (hasChanges || changedFiles.length) { - var result = []; - for (var _a = 0, _b = this.program.getSourceFiles(); _a < _b.length; _a++) { - var sourceFile = _b[_a]; - this.extractUnresolvedImportsFromSourceFile(sourceFile, result); + function convertToDocumentHighlightsItem(documentHighlights) { + var fileName = documentHighlights.fileName, highlightSpans = documentHighlights.highlightSpans; + var scriptInfo = project.getScriptInfo(fileName); + return { + file: fileName, + highlightSpans: highlightSpans.map(convertHighlightSpan) + }; + function convertHighlightSpan(highlightSpan) { + var textSpan = highlightSpan.textSpan, kind = highlightSpan.kind; + var start = scriptInfo.positionToLineOffset(textSpan.start); + var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)); + return { start: start, end: end, kind: kind }; } - this.lastCachedUnresolvedImportsList = server.toSortedReadonlyArray(result); } - unresolvedImports = this.lastCachedUnresolvedImportsList; - var cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, unresolvedImports, hasChanges); - if (this.setTypings(cachedTypings)) { - hasChanges = this.updateGraphWorker() || hasChanges; - } - if (hasChanges) { - this.projectStructureVersion++; - } - return !hasChanges; - }; - Project.prototype.setTypings = function (typings) { - if (ts.arrayIsEqualTo(this.typingFiles, typings)) { - return false; - } - this.typingFiles = typings; - this.markAsDirty(); - return true; }; - Project.prototype.updateGraphWorker = function () { - var oldProgram = this.program; - this.program = this.languageService.getProgram(); - var hasChanges = false; - if (!oldProgram || (this.program !== oldProgram && !oldProgram.structureIsReused)) { - hasChanges = true; - if (oldProgram) { - for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { - var f = _a[_i]; - if (this.program.getSourceFileByPath(f.path)) { - continue; - } - var scriptInfoToDetach = this.projectService.getScriptInfo(f.fileName); - if (scriptInfoToDetach) { - scriptInfoToDetach.detachFromProject(this); - } - } - } - } - this.builder.onProjectUpdateGraph(); - return hasChanges; + Session.prototype.setCompilerOptionsForInferredProjects = function (args) { + this.projectService.setCompilerOptionsForInferredProjects(args.options); }; - Project.prototype.getScriptInfoLSHost = function (fileName) { - var scriptInfo = this.projectService.getOrCreateScriptInfo(fileName, false); - if (scriptInfo) { - scriptInfo.attachToProject(this); - } - return scriptInfo; + Session.prototype.getProjectInfo = function (args) { + return this.getProjectInfoWorker(args.file, args.projectFileName, args.needFileNameList); }; - Project.prototype.getScriptInfoForNormalizedPath = function (fileName) { - var scriptInfo = this.projectService.getOrCreateScriptInfoForNormalizedPath(fileName, false); - if (scriptInfo && !scriptInfo.isAttached(this)) { - return server.Errors.ThrowProjectDoesNotContainDocument(fileName, this); - } - return scriptInfo; + Session.prototype.getProjectInfoWorker = function (uncheckedFileName, projectFileName, needFileNameList) { + var project = this.getFileAndProjectWorker(uncheckedFileName, projectFileName, true, true).project; + var projectInfo = { + configFileName: project.getProjectName(), + languageServiceDisabled: !project.languageServiceEnabled, + fileNames: needFileNameList ? project.getFileNames() : undefined + }; + return projectInfo; }; - Project.prototype.getScriptInfo = function (uncheckedFileName) { - return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); + Session.prototype.getRenameInfo = function (args) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + return project.getLanguageService().getRenameInfo(file, position); }; - Project.prototype.filesToString = function () { - if (!this.program) { - return ""; + Session.prototype.getProjects = function (args) { + var projects; + if (args.projectFileName) { + var project = this.getProject(args.projectFileName); + if (project) { + projects = [project]; + } } - var strBuilder = ""; - for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) { - var file = _a[_i]; - strBuilder += file.fileName + "\n"; + else { + var scriptInfo = this.projectService.getScriptInfo(args.file); + projects = scriptInfo.containingProjects; } - return strBuilder; - }; - Project.prototype.setCompilerOptions = function (compilerOptions) { - if (compilerOptions) { - if (this.projectKind === ProjectKind.Inferred) { - compilerOptions.allowJs = true; - } - compilerOptions.allowNonTsExtensions = true; - if (ts.changesAffectModuleResolution(this.compilerOptions, compilerOptions)) { - this.cachedUnresolvedImportsPerFile.clear(); - this.lastCachedUnresolvedImportsList = undefined; - } - this.compilerOptions = compilerOptions; - this.lsHost.setCompilationSettings(compilerOptions); - this.markAsDirty(); + projects = ts.filter(projects, function (p) { return p.languageServiceEnabled; }); + if (!projects || !projects.length) { + return server.Errors.ThrowNoProject(); } + return projects; }; - Project.prototype.reloadScript = function (filename, tempFileName) { - var script = this.projectService.getScriptInfoForNormalizedPath(filename); - if (script) { - ts.Debug.assert(script.isAttached(this)); - script.reloadFromFile(tempFileName); - return true; + Session.prototype.getDefaultProject = function (args) { + if (args.projectFileName) { + var project = this.getProject(args.projectFileName); + if (project) { + return project; + } } - return false; + var info = this.projectService.getScriptInfo(args.file); + return info.getDefaultProject(); }; - Project.prototype.getChangesSinceVersion = function (lastKnownVersion) { - this.updateGraph(); - var info = { - projectName: this.getProjectName(), - version: this.projectStructureVersion, - isInferred: this.projectKind === ProjectKind.Inferred, - options: this.getCompilerOptions() - }; - if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { - if (this.projectStructureVersion == this.lastReportedVersion) { - return { info: info, projectErrors: this.projectErrors }; + Session.prototype.getRenameLocations = function (args, simplifiedResult) { + var file = server.toNormalizedPath(args.file); + var info = this.projectService.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, info); + var projects = this.getProjects(args); + if (simplifiedResult) { + var defaultProject = this.getDefaultProject(args); + var renameInfo = defaultProject.getLanguageService().getRenameInfo(file, position); + if (!renameInfo) { + return undefined; } - var lastReportedFileNames = this.lastReportedFileNames; - var currentFiles = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); - var added = []; - var removed = []; - for (var id in currentFiles) { - if (!ts.hasProperty(lastReportedFileNames, id)) { - added.push(id); - } + if (!renameInfo.canRename) { + return { + info: renameInfo, + locs: [] + }; } - for (var id in lastReportedFileNames) { - if (!ts.hasProperty(currentFiles, id)) { - removed.push(id); + var fileSpans = server.combineProjectOutput(projects, function (project) { + var renameLocations = project.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); + if (!renameLocations) { + return []; } - } - this.lastReportedFileNames = currentFiles; - this.lastReportedVersion = this.projectStructureVersion; - return { info: info, changes: { added: added, removed: removed }, projectErrors: this.projectErrors }; + return renameLocations.map(function (location) { + var locationScriptInfo = project.getScriptInfo(location.fileName); + return { + file: location.fileName, + start: locationScriptInfo.positionToLineOffset(location.textSpan.start), + end: locationScriptInfo.positionToLineOffset(ts.textSpanEnd(location.textSpan)), + }; + }); + }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; }); + var locs = fileSpans.reduce(function (accum, cur) { + var curFileAccum; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file !== cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); + return { info: renameInfo, locs: locs }; } else { - var projectFileNames = this.getFileNames(); - this.lastReportedFileNames = ts.arrayToMap(projectFileNames, function (x) { return x; }); - this.lastReportedVersion = this.projectStructureVersion; - return { info: info, files: projectFileNames, projectErrors: this.projectErrors }; + return server.combineProjectOutput(projects, function (p) { return p.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); }, undefined, renameLocationIsEqualTo); } - }; - Project.prototype.getReferencedFiles = function (path) { - var _this = this; - if (!this.languageServiceEnabled) { - return []; + function renameLocationIsEqualTo(a, b) { + if (a === b) { + return true; + } + if (!a || !b) { + return false; + } + return a.fileName === b.fileName && + a.textSpan.start === b.textSpan.start && + a.textSpan.length === b.textSpan.length; } - var sourceFile = this.getSourceFile(path); - if (!sourceFile) { - return []; - } - var referencedFiles = ts.createMap(); - if (sourceFile.imports && sourceFile.imports.length > 0) { - var checker = this.program.getTypeChecker(); - for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { - var importName = _a[_i]; - var symbol = checker.getSymbolAtLocation(importName); - if (symbol && symbol.declarations && symbol.declarations[0]) { - var declarationSourceFile = symbol.declarations[0].getSourceFile(); - if (declarationSourceFile) { - referencedFiles[declarationSourceFile.path] = true; - } + function compareRenameLocation(a, b) { + if (a.file < b.file) { + return -1; + } + else if (a.file > b.file) { + return 1; + } + else { + if (a.start.line < b.start.line) { + return 1; + } + else if (a.start.line > b.start.line) { + return -1; + } + else { + return b.start.offset - a.start.offset; } } } - var currentDirectory = ts.getDirectoryPath(path); - var getCanonicalFileName = ts.createGetCanonicalFileName(this.projectService.host.useCaseSensitiveFileNames); - if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) { - for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) { - var referencedFile = _c[_b]; - var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName); - referencedFiles[referencedPath] = true; + }; + Session.prototype.getReferences = function (args, simplifiedResult) { + var file = server.toNormalizedPath(args.file); + var projects = this.getProjects(args); + var defaultProject = this.getDefaultProject(args); + var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + if (simplifiedResult) { + var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position); + if (!nameInfo) { + return undefined; } - } - if (sourceFile.resolvedTypeReferenceDirectiveNames) { - for (var typeName in sourceFile.resolvedTypeReferenceDirectiveNames) { - var resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName]; - if (!resolvedTypeReferenceDirective) { - continue; + var displayString = ts.displayPartsToString(nameInfo.displayParts); + var nameSpan = nameInfo.textSpan; + var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset; + var nameText = scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var refs = server.combineProjectOutput(projects, function (project) { + var references = project.getLanguageService().getReferencesAtPosition(file, position); + if (!references) { + return []; } - var fileName = resolvedTypeReferenceDirective.resolvedFileName; - var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - referencedFiles[typeFilePath] = true; + return references.map(function (ref) { + var refScriptInfo = project.getScriptInfo(ref.fileName); + var start = refScriptInfo.positionToLineOffset(ref.textSpan.start); + var refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1); + var lineText = refScriptInfo.getSnapshot().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: refScriptInfo.positionToLineOffset(ts.textSpanEnd(ref.textSpan)), + isWriteAccess: ref.isWriteAccess, + isDefinition: ref.isDefinition + }; + }); + }, compareFileStart, areReferencesResponseItemsForTheSameLocation); + return { + refs: refs, + symbolName: nameText, + symbolStartOffset: nameColStart, + symbolDisplayString: displayString + }; + } + else { + return server.combineProjectOutput(projects, function (project) { return project.getLanguageService().findReferences(file, position); }, undefined, undefined); + } + function areReferencesResponseItemsForTheSameLocation(a, b) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; } + return false; } - var allFileNames = ts.map(Object.keys(referencedFiles), function (key) { return key; }); - return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); }); }; - Project.prototype.removeRootFileIfNecessary = function (info) { - if (this.isRoot(info)) { - remove(this.rootFiles, info); - this.rootFilesMap.remove(info.path); + Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) { + var _a = this.projectService.openClientFileWithNormalizedPath(fileName, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors; + if (this.eventHandler) { + this.eventHandler({ + eventName: "configFileDiag", + data: { triggerFile: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] } + }); } }; - return Project; - }()); - server.Project = Project; - var InferredProject = (function (_super) { - __extends(InferredProject, _super); - function InferredProject(projectService, documentRegistry, compilerOptions) { - var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; - _this.directoriesWatchedForTsconfig = []; - return _this; - } - InferredProject.prototype.getProjectRootPath = function () { - if (this.projectService.useSingleInferredProject) { - return undefined; - } - var rootFiles = this.getRootFiles(); - return ts.getDirectoryPath(rootFiles[0]); + Session.prototype.getPosition = function (args, scriptInfo) { + return args.position !== undefined ? args.position : scriptInfo.lineOffsetToPosition(args.line, args.offset); }; - InferredProject.prototype.close = function () { - _super.prototype.close.call(this); - for (var _i = 0, _a = this.directoriesWatchedForTsconfig; _i < _a.length; _i++) { - var directory = _a[_i]; - this.projectService.stopWatchingDirectory(directory); - } + Session.prototype.getFileAndProject = function (args, errorOnMissingProject) { + if (errorOnMissingProject === void 0) { errorOnMissingProject = true; } + return this.getFileAndProjectWorker(args.file, args.projectFileName, true, errorOnMissingProject); }; - InferredProject.prototype.getTypeAcquisition = function () { - return { - enable: allRootFilesAreJsOrDts(this), - include: [], - exclude: [] - }; + Session.prototype.getFileAndProjectWithoutRefreshingInferredProjects = function (args, errorOnMissingProject) { + if (errorOnMissingProject === void 0) { errorOnMissingProject = true; } + return this.getFileAndProjectWorker(args.file, args.projectFileName, false, errorOnMissingProject); }; - return InferredProject; - }(Project)); - InferredProject.newName = (function () { - var nextId = 1; - return function () { - var id = nextId; - nextId++; - return server.makeInferredProjectName(id); + Session.prototype.getFileAndProjectWorker = function (uncheckedFileName, projectFileName, refreshInferredProjects, errorOnMissingProject) { + var file = server.toNormalizedPath(uncheckedFileName); + var project = this.getProject(projectFileName) || this.projectService.getDefaultProjectForFile(file, refreshInferredProjects); + if (!project && errorOnMissingProject) { + return server.Errors.ThrowNoProject(); + } + return { file: file, project: project }; }; - })(); - server.InferredProject = InferredProject; - var ConfiguredProject = (function (_super) { - __extends(ConfiguredProject, _super); - function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) { - var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; - _this.wildcardDirectories = wildcardDirectories; - _this.compileOnSaveEnabled = compileOnSaveEnabled; - _this.openRefCount = 0; - _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName)); - return _this; - } - ConfiguredProject.prototype.getConfigFilePath = function () { - return this.getProjectName(); + Session.prototype.getOutliningSpans = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + return project.getLanguageService(false).getOutliningSpans(file); }; - ConfiguredProject.prototype.getProjectRootPath = function () { - return ts.getDirectoryPath(this.getConfigFilePath()); + Session.prototype.getTodoComments = function (args) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + return project.getLanguageService().getTodoComments(file, args.descriptors); }; - ConfiguredProject.prototype.setProjectErrors = function (projectErrors) { - this.projectErrors = projectErrors; + Session.prototype.getDocCommentTemplate = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + return project.getLanguageService(false).getDocCommentTemplateAtPosition(file, position); }; - ConfiguredProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { - this.typeAcquisition = newTypeAcquisition; + Session.prototype.getIndentation = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); + var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); + var indentation = project.getLanguageService(false).getIndentationAtPosition(file, position, options); + return { position: position, indentation: indentation }; }; - ConfiguredProject.prototype.getTypeAcquisition = function () { - return this.typeAcquisition; + Session.prototype.getBreakpointStatement = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); + return project.getLanguageService(false).getBreakpointStatementAtPosition(file, position); }; - ConfiguredProject.prototype.watchConfigFile = function (callback) { - var _this = this; - this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); }); + Session.prototype.getNameOrDottedNameSpan = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); + return project.getLanguageService(false).getNameOrDottedNameSpan(file, position, position); }; - ConfiguredProject.prototype.watchTypeRoots = function (callback) { - var _this = this; - var roots = this.getEffectiveTypeRoots(); - var watchers = []; - for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) { - var root = roots_1[_i]; - this.projectService.logger.info("Add type root watcher for: " + root); - watchers.push(this.projectService.host.watchDirectory(root, function (path) { return callback(_this, path); }, false)); - } - this.typeRootsWatchers = watchers; + Session.prototype.isValidBraceCompletion = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); + return project.getLanguageService(false).isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); }; - ConfiguredProject.prototype.watchConfigDirectory = function (callback) { - var _this = this; - if (this.directoryWatcher) { - return; + Session.prototype.getQuickInfoWorker = function (args, simplifiedResult) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); + if (!quickInfo) { + return undefined; + } + if (simplifiedResult) { + var displayString = ts.displayPartsToString(quickInfo.displayParts); + var docString = ts.displayPartsToString(quickInfo.documentation); + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), + end: scriptInfo.positionToLineOffset(ts.textSpanEnd(quickInfo.textSpan)), + displayString: displayString, + documentation: docString, + tags: quickInfo.tags || [] + }; + } + else { + return quickInfo; } - var directoryToWatch = ts.getDirectoryPath(this.getConfigFilePath()); - this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch); - this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true); }; - ConfiguredProject.prototype.watchWildcards = function (callback) { + Session.prototype.getFormattingEditsForRange = function (args) { var _this = this; - if (!this.wildcardDirectories) { - return; + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var startPosition = scriptInfo.lineOffsetToPosition(args.line, args.offset); + var endPosition = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset); + var edits = project.getLanguageService(false).getFormattingEditsForRange(file, startPosition, endPosition, this.projectService.getFormatCodeOptions(file)); + if (!edits) { + return undefined; } - var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath()); - this.directoriesWatchedForWildcards = ts.reduceProperties(this.wildcardDirectories, function (watchers, flag, directory) { - if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) { - var recursive = (flag & 1) !== 0; - _this.projectService.logger.info("Add " + (recursive ? "recursive " : "") + "watcher for: " + directory); - watchers[directory] = _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive); - } - return watchers; - }, {}); + return edits.map(function (edit) { return _this.convertTextChangeToCodeEdit(edit, scriptInfo); }); }; - ConfiguredProject.prototype.stopWatchingDirectory = function () { - if (this.directoryWatcher) { - this.directoryWatcher.close(); - this.directoryWatcher = undefined; - } + Session.prototype.getFormattingEditsForRangeFull = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); + return project.getLanguageService(false).getFormattingEditsForRange(file, args.position, args.endPosition, options); }; - ConfiguredProject.prototype.close = function () { - _super.prototype.close.call(this); - if (this.projectFileWatcher) { - this.projectFileWatcher.close(); - } - if (this.typeRootsWatchers) { - for (var _i = 0, _a = this.typeRootsWatchers; _i < _a.length; _i++) { - var watcher = _a[_i]; - watcher.close(); + Session.prototype.getFormattingEditsForDocumentFull = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); + return project.getLanguageService(false).getFormattingEditsForDocument(file, options); + }; + Session.prototype.getFormattingEditsAfterKeystrokeFull = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); + return project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, args.position, args.key, options); + }; + Session.prototype.getFormattingEditsAfterKeystroke = function (args) { + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = scriptInfo.lineOffsetToPosition(args.line, args.offset); + var formatOptions = this.projectService.getFormatCodeOptions(file); + var edits = project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, position, args.key, formatOptions); + if ((args.key === "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { + var lineInfo = scriptInfo.getLineInfo(args.line); + if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) { + var lineText = lineInfo.leaf.text; + if (lineText.search("\\S") < 0) { + var preferredIndent = project.getLanguageService(false).getIndentationAtPosition(file, position, formatOptions); + var hasIndent = 0; + var i = void 0, len = void 0; + for (i = 0, len = lineText.length; i < len; i++) { + if (lineText.charAt(i) === " ") { + hasIndent++; + } + else if (lineText.charAt(i) === "\t") { + hasIndent += formatOptions.tabSize; + } + else { + break; + } + } + if (preferredIndent !== hasIndent) { + var firstNoWhiteSpacePosition = lineInfo.offset + i; + edits.push({ + span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition), + newText: ts.formatting.getIndentationString(preferredIndent, formatOptions) + }); + } + } } - this.typeRootsWatchers = undefined; } - for (var id in this.directoriesWatchedForWildcards) { - this.directoriesWatchedForWildcards[id].close(); + if (!edits) { + return undefined; } - this.directoriesWatchedForWildcards = undefined; - this.stopWatchingDirectory(); - }; - ConfiguredProject.prototype.addOpenRef = function () { - this.openRefCount++; + return edits.map(function (edit) { + return { + start: scriptInfo.positionToLineOffset(edit.span.start), + end: scriptInfo.positionToLineOffset(ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); }; - ConfiguredProject.prototype.deleteOpenRef = function () { - this.openRefCount--; - return this.openRefCount; + Session.prototype.getCompletions = function (args, simplifiedResult) { + var _this = this; + var prefix = args.prefix || ""; + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + var completions = project.getLanguageService().getCompletionsAtPosition(file, position); + if (!completions) { + return undefined; + } + if (simplifiedResult) { + return completions.entries.reduce(function (result, entry) { + if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { + var name = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; + result.push({ name: name, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + } + return result; + }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); + } + else { + return completions; + } }; - ConfiguredProject.prototype.getEffectiveTypeRoots = function () { - return ts.getEffectiveTypeRoots(this.getCompilerOptions(), this.projectService.host) || []; + Session.prototype.getCompletionEntryDetails = function (args) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + return args.entryNames.reduce(function (accum, entryName) { + var details = project.getLanguageService().getCompletionEntryDetails(file, position, entryName); + if (details) { + accum.push(details); + } + return accum; + }, []); }; - return ConfiguredProject; - }(Project)); - server.ConfiguredProject = ConfiguredProject; - var ExternalProject = (function (_super) { - __extends(ExternalProject, _super); - function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) { - var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; - _this.compileOnSaveEnabled = compileOnSaveEnabled; - _this.projectFilePath = projectFilePath; - return _this; - } - ExternalProject.prototype.getProjectRootPath = function () { - if (this.projectFilePath) { - return ts.getDirectoryPath(this.projectFilePath); + Session.prototype.getCompileOnSaveAffectedFileList = function (args) { + var info = this.projectService.getScriptInfo(args.file); + var result = []; + if (!info) { + return []; } - return ts.getDirectoryPath(ts.normalizeSlashes(this.getProjectName())); - }; - ExternalProject.prototype.getTypeAcquisition = function () { - return this.typeAcquisition; + var projectsToSearch = args.projectFileName ? [this.projectService.findProject(args.projectFileName)] : info.containingProjects; + for (var _i = 0, projectsToSearch_1 = projectsToSearch; _i < projectsToSearch_1.length; _i++) { + var project = projectsToSearch_1[_i]; + if (project.compileOnSaveEnabled && project.languageServiceEnabled) { + result.push({ + projectFileName: project.getProjectName(), + fileNames: project.getCompileOnSaveAffectedFileList(info), + projectUsesOutFile: !!project.getCompilerOptions().outFile || !!project.getCompilerOptions().out + }); + } + } + return result; }; - ExternalProject.prototype.setProjectErrors = function (projectErrors) { - this.projectErrors = projectErrors; + Session.prototype.emitFile = function (args) { + var _this = this; + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + if (!project) { + server.Errors.ThrowNoProject(); + } + if (!project.languageServiceEnabled) { + return false; + } + var scriptInfo = project.getScriptInfo(file); + return project.builder.emitFile(scriptInfo, function (path, data, writeByteOrderMark) { return _this.host.writeFile(path, data, writeByteOrderMark); }); }; - ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { - if (!newTypeAcquisition) { - newTypeAcquisition = { - enable: allRootFilesAreJsOrDts(this), - include: [], - exclude: [] + Session.prototype.getSignatureHelpItems = function (args, simplifiedResult) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + var helpItems = project.getLanguageService().getSignatureHelpItems(file, position); + if (!helpItems) { + return undefined; + } + if (simplifiedResult) { + var span_17 = helpItems.applicableSpan; + return { + items: helpItems.items, + applicableSpan: { + start: scriptInfo.positionToLineOffset(span_17.start), + end: scriptInfo.positionToLineOffset(span_17.start + span_17.length) + }, + selectedItemIndex: helpItems.selectedItemIndex, + argumentIndex: helpItems.argumentIndex, + argumentCount: helpItems.argumentCount, }; } else { - if (newTypeAcquisition.enable === undefined) { - newTypeAcquisition.enable = allRootFilesAreJsOrDts(this); - } - if (!newTypeAcquisition.include) { - newTypeAcquisition.include = []; - } - if (!newTypeAcquisition.exclude) { - newTypeAcquisition.exclude = []; + return helpItems; + } + }; + Session.prototype.getDiagnostics = function (next, delay, fileNames) { + var _this = this; + var checkList = fileNames.reduce(function (accum, uncheckedFileName) { + var fileName = server.toNormalizedPath(uncheckedFileName); + var project = _this.projectService.getDefaultProjectForFile(fileName, true); + if (project) { + accum.push({ fileName: fileName, project: project }); } + return accum; + }, []); + if (checkList.length > 0) { + this.updateErrorCheck(next, checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay); } - this.typeAcquisition = newTypeAcquisition; }; - return ExternalProject; - }(Project)); - server.ExternalProject = ExternalProject; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; - server.ContextEvent = "context"; - server.ConfigFileDiagEvent = "configFileDiag"; - server.ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; - function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) { - var map = ts.createMap(); - for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) { - var option = commandLineOptions_1[_i]; - if (typeof option.type === "object") { - var optionMap = option.type; - for (var id in optionMap) { - ts.Debug.assert(typeof optionMap[id] === "number"); + Session.prototype.change = function (args) { + var _this = this; + var _a = this.getFileAndProject(args, false), file = _a.file, project = _a.project; + if (project) { + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var start = scriptInfo.lineOffsetToPosition(args.line, args.offset); + var end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset); + if (start >= 0) { + scriptInfo.editContent(start, end, args.insertString); + this.changeSeq++; } - map[option.name] = optionMap; + this.updateProjectStructure(this.changeSeq, function (n) { return n === _this.changeSeq; }); } - } - return map; - } - var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations); - var indentStyle = ts.createMap({ - "none": ts.IndentStyle.None, - "block": ts.IndentStyle.Block, - "smart": ts.IndentStyle.Smart - }); - function convertFormatOptions(protocolOptions) { - if (typeof protocolOptions.indentStyle === "string") { - protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()]; - ts.Debug.assert(protocolOptions.indentStyle !== undefined); - } - return protocolOptions; - } - server.convertFormatOptions = convertFormatOptions; - function convertCompilerOptions(protocolOptions) { - for (var id in compilerOptionConverters) { - var propertyValue = protocolOptions[id]; - if (typeof propertyValue === "string") { - var mappedValues = compilerOptionConverters[id]; - protocolOptions[id] = mappedValues[propertyValue.toLowerCase()]; - } - } - return protocolOptions; - } - server.convertCompilerOptions = convertCompilerOptions; - function tryConvertScriptKindName(scriptKindName) { - return typeof scriptKindName === "string" - ? convertScriptKindName(scriptKindName) - : scriptKindName; - } - server.tryConvertScriptKindName = tryConvertScriptKindName; - function convertScriptKindName(scriptKindName) { - switch (scriptKindName) { - case "JS": - return 1; - case "JSX": - return 2; - case "TS": - return 3; - case "TSX": - return 4; - default: - return 0; - } - } - server.convertScriptKindName = convertScriptKindName; - function combineProjectOutput(projects, action, comparer, areEqual) { - var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer); - return projects.length > 1 ? ts.deduplicate(result, areEqual) : result; - } - server.combineProjectOutput = combineProjectOutput; - var fileNamePropertyReader = { - getFileName: function (x) { return x; }, - getScriptKind: function (_) { return undefined; }, - hasMixedContent: function (_) { return false; } - }; - var externalFilePropertyReader = { - getFileName: function (x) { return x.fileName; }, - getScriptKind: function (x) { return tryConvertScriptKindName(x.scriptKind); }, - hasMixedContent: function (x) { return x.hasMixedContent; } - }; - function findProjectByName(projectName, projects) { - for (var _i = 0, projects_1 = projects; _i < projects_1.length; _i++) { - var proj = projects_1[_i]; - if (proj.getProjectName() === projectName) { - return proj; - } - } - } - function createFileNotFoundDiagnostic(fileName) { - return ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName); - } - function isRootFileInInferredProject(info) { - if (info.containingProjects.length === 0) { - return false; - } - return info.containingProjects[0].projectKind === server.ProjectKind.Inferred && info.containingProjects[0].isRoot(info); - } - var DirectoryWatchers = (function () { - function DirectoryWatchers(projectService) { - this.projectService = projectService; - this.directoryWatchersForTsconfig = ts.createMap(); - this.directoryWatchersRefCount = ts.createMap(); - } - DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) { - this.directoryWatchersRefCount[directory]--; - if (this.directoryWatchersRefCount[directory] === 0) { - this.projectService.logger.info("Close directory watcher for: " + directory); - this.directoryWatchersForTsconfig[directory].close(); - delete this.directoryWatchersForTsconfig[directory]; + }; + Session.prototype.reload = function (args, reqSeq) { + var file = server.toNormalizedPath(args.file); + var tempFileName = args.tmpfile && server.toNormalizedPath(args.tmpfile); + var project = this.projectService.getDefaultProjectForFile(file, true); + if (project) { + this.changeSeq++; + if (project.reloadScript(file, tempFileName)) { + this.output(undefined, CommandNames.Reload, reqSeq); + } } }; - DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) { - var currentPath = ts.getDirectoryPath(fileName); - var parentPath = ts.getDirectoryPath(currentPath); - while (currentPath != parentPath) { - if (!this.directoryWatchersForTsconfig[currentPath]) { - this.projectService.logger.info("Add watcher for: " + currentPath); - this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback); - this.directoryWatchersRefCount[currentPath] = 1; - } - else { - this.directoryWatchersRefCount[currentPath] += 1; - } - project.directoriesWatchedForTsconfig.push(currentPath); - currentPath = parentPath; - parentPath = ts.getDirectoryPath(parentPath); + Session.prototype.saveToTmp = function (fileName, tempFileName) { + var scriptInfo = this.projectService.getScriptInfo(fileName); + if (scriptInfo) { + scriptInfo.saveTo(tempFileName); } }; - return DirectoryWatchers; - }()); - var ProjectService = (function () { - function ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler) { - if (typingsInstaller === void 0) { typingsInstaller = server.nullTypingsInstaller; } - this.host = host; - this.logger = logger; - this.cancellationToken = cancellationToken; - this.useSingleInferredProject = useSingleInferredProject; - this.typingsInstaller = typingsInstaller; - this.eventHandler = eventHandler; - this.filenameToScriptInfo = ts.createFileMap(); - this.externalProjectToConfiguredProjectMap = ts.createMap(); - this.externalProjects = []; - this.inferredProjects = []; - this.configuredProjects = []; - this.openFiles = []; - ts.Debug.assert(!!host.createHash, "'ServerHost.createHash' is required for ProjectService"); - this.toCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); - this.directoryWatchers = new DirectoryWatchers(this); - this.throttledOperations = new server.ThrottledOperations(host); - this.typingsInstaller.attach(this); - this.typingsCache = new server.TypingsCache(this.typingsInstaller); - this.hostConfiguration = { - formatCodeOptions: server.getDefaultFormatCodeSettings(this.host), - hostInfo: "Unknown host" - }; - this.documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory()); - } - ProjectService.prototype.getChangedFiles_TestOnly = function () { - return this.changedFiles; - }; - ProjectService.prototype.ensureInferredProjectsUpToDate_TestOnly = function () { - this.ensureInferredProjectsUpToDate(); - }; - ProjectService.prototype.getCompilerOptionsForInferredProjects = function () { - return this.compilerOptionsForInferredProjects; - }; - ProjectService.prototype.onUpdateLanguageServiceStateForProject = function (project, languageServiceEnabled) { - if (!this.eventHandler) { + Session.prototype.closeClientFile = function (fileName) { + if (!fileName) { return; } - this.eventHandler({ - eventName: server.ProjectLanguageServiceStateEvent, - data: { project: project, languageServiceEnabled: languageServiceEnabled } - }); + var file = ts.normalizePath(fileName); + this.projectService.closeClientFile(file); }; - ProjectService.prototype.updateTypingsForProject = function (response) { - var project = this.findProject(response.projectName); - if (!project) { - return; - } - switch (response.kind) { - case server.ActionSet: - this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings); - break; - case server.ActionInvalidate: - this.typingsCache.deleteTypingsForProject(response.projectName); - break; - } - project.updateGraph(); + Session.prototype.decorateNavigationBarItems = function (items, scriptInfo) { + var _this = this; + return ts.map(items, function (item) { return ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, + spans: item.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }), + childItems: _this.decorateNavigationBarItems(item.childItems, scriptInfo), + indent: item.indent + }); }); }; - ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) { - this.compilerOptionsForInferredProjects = convertCompilerOptions(projectCompilerOptions); - this.compilerOptionsForInferredProjects.allowNonTsExtensions = true; - this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave; - for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) { - var proj = _a[_i]; - proj.setCompilerOptions(this.compilerOptionsForInferredProjects); - proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave; - } - this.updateProjectGraphs(this.inferredProjects); + Session.prototype.getNavigationBarItems = function (args, simplifiedResult) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var items = project.getLanguageService(false).getNavigationBarItems(file); + return !items + ? undefined + : simplifiedResult + ? this.decorateNavigationBarItems(items, project.getScriptInfoForNormalizedPath(file)) + : items; }; - ProjectService.prototype.stopWatchingDirectory = function (directory) { - this.directoryWatchers.stopWatchingDirectory(directory); + Session.prototype.decorateNavigationTree = function (tree, scriptInfo) { + var _this = this; + return { + text: tree.text, + kind: tree.kind, + kindModifiers: tree.kindModifiers, + spans: tree.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }), + childItems: ts.map(tree.childItems, function (item) { return _this.decorateNavigationTree(item, scriptInfo); }) + }; }; - ProjectService.prototype.findProject = function (projectName) { - if (projectName === undefined) { - return undefined; - } - if (server.isInferredProjectName(projectName)) { - this.ensureInferredProjectsUpToDate(); - return findProjectByName(projectName, this.inferredProjects); - } - return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName)); + Session.prototype.decorateSpan = function (span, scriptInfo) { + return { + start: scriptInfo.positionToLineOffset(span.start), + end: scriptInfo.positionToLineOffset(ts.textSpanEnd(span)) + }; }; - ProjectService.prototype.getDefaultProjectForFile = function (fileName, refreshInferredProjects) { - if (refreshInferredProjects) { - this.ensureInferredProjectsUpToDate(); - } - var scriptInfo = this.getScriptInfoForNormalizedPath(fileName); - return scriptInfo && scriptInfo.getDefaultProject(); + Session.prototype.getNavigationTree = function (args, simplifiedResult) { + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; + var tree = project.getLanguageService(false).getNavigationTree(file); + return !tree + ? undefined + : simplifiedResult + ? this.decorateNavigationTree(tree, project.getScriptInfoForNormalizedPath(file)) + : tree; }; - ProjectService.prototype.ensureInferredProjectsUpToDate = function () { - if (this.changedFiles) { - var projectsToUpdate = void 0; - if (this.changedFiles.length === 1) { - projectsToUpdate = this.changedFiles[0].containingProjects; - } - else { - projectsToUpdate = []; - for (var _i = 0, _a = this.changedFiles; _i < _a.length; _i++) { - var f = _a[_i]; - projectsToUpdate = projectsToUpdate.concat(f.containingProjects); + Session.prototype.getNavigateToItems = function (args, simplifiedResult) { + var projects = this.getProjects(args); + var fileName = args.currentFileOnly ? args.file && ts.normalizeSlashes(args.file) : undefined; + if (simplifiedResult) { + return server.combineProjectOutput(projects, function (project) { + var navItems = project.getLanguageService().getNavigateToItems(args.searchValue, args.maxResultCount, fileName, project.isNonTsProject()); + if (!navItems) { + return []; } - } - this.updateProjectGraphs(projectsToUpdate); - this.changedFiles = undefined; + return navItems.map(function (navItem) { + var scriptInfo = project.getScriptInfo(navItem.fileName); + var start = scriptInfo.positionToLineOffset(navItem.textSpan.start); + var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(navItem.textSpan)); + var bakedItem = { + name: navItem.name, + kind: navItem.kind, + file: navItem.fileName, + start: start, + end: end, + }; + if (navItem.kindModifiers && (navItem.kindModifiers !== "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind !== "none") { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + return bakedItem; + }); + }, undefined, areNavToItemsForTheSameLocation); } - }; - ProjectService.prototype.findContainingExternalProject = function (fileName) { - for (var _i = 0, _a = this.externalProjects; _i < _a.length; _i++) { - var proj = _a[_i]; - if (proj.containsFile(fileName)) { - return proj; - } + else { + return server.combineProjectOutput(projects, function (project) { return project.getLanguageService().getNavigateToItems(args.searchValue, args.maxResultCount, fileName, project.isNonTsProject()); }, undefined, navigateToItemIsEqualTo); } - return undefined; - }; - ProjectService.prototype.getFormatCodeOptions = function (file) { - var formatCodeSettings; - if (file) { - var info = this.getScriptInfoForNormalizedPath(file); - if (info) { - formatCodeSettings = info.getFormatCodeSettings(); + function navigateToItemIsEqualTo(a, b) { + if (a === b) { + return true; } - } - return formatCodeSettings || this.hostConfiguration.formatCodeOptions; - }; - ProjectService.prototype.updateProjectGraphs = function (projects) { - var shouldRefreshInferredProjects = false; - for (var _i = 0, projects_2 = projects; _i < projects_2.length; _i++) { - var p = projects_2[_i]; - if (!p.updateGraph()) { - shouldRefreshInferredProjects = true; + if (!a || !b) { + return false; } + return a.containerKind === b.containerKind && + a.containerName === b.containerName && + a.fileName === b.fileName && + a.isCaseSensitive === b.isCaseSensitive && + a.kind === b.kind && + a.kindModifiers === b.containerName && + a.matchKind === b.matchKind && + a.name === b.name && + a.textSpan.start === b.textSpan.start && + a.textSpan.length === b.textSpan.length; } - if (shouldRefreshInferredProjects) { - this.refreshInferredProjects(); + function areNavToItemsForTheSameLocation(a, b) { + if (a && b) { + return a.file === b.file && + a.start === b.start && + a.end === b.end; + } + return false; } }; - ProjectService.prototype.onSourceFileChanged = function (fileName) { - var info = this.getScriptInfoForNormalizedPath(fileName); - if (!info) { - this.logger.info("Error: got watch notification for unknown file: " + fileName); - return; + Session.prototype.getSupportedCodeFixes = function () { + return ts.getSupportedCodeFixes(); + }; + Session.prototype.getCodeFixes = function (args, simplifiedResult) { + var _this = this; + if (args.errorCodes.length === 0) { + return undefined; } - if (!this.host.fileExists(fileName)) { - this.handleDeletedFile(info); + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var startPosition = getStartPosition(); + var endPosition = getEndPosition(); + var formatOptions = this.projectService.getFormatCodeOptions(file); + var codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, formatOptions); + if (!codeActions) { + return undefined; + } + if (simplifiedResult) { + return codeActions.map(function (codeAction) { return _this.mapCodeAction(codeAction, scriptInfo); }); } else { - if (info && (!info.isOpen)) { - info.reloadFromFile(); - this.updateProjectGraphs(info.containingProjects); - } + return codeActions; } - }; - ProjectService.prototype.handleDeletedFile = function (info) { - this.logger.info(info.fileName + " deleted"); - info.stopWatcher(); - if (!info.isOpen) { - this.filenameToScriptInfo.remove(info.path); - this.lastDeletedFile = info; - var containingProjects = info.containingProjects.slice(); - info.detachAllProjects(); - this.updateProjectGraphs(containingProjects); - this.lastDeletedFile = undefined; - if (!this.eventHandler) { - return; - } - for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { - var openFile = _a[_i]; - this.eventHandler({ - eventName: server.ContextEvent, - data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } - }); - } + function getStartPosition() { + return args.startPosition !== undefined ? args.startPosition : scriptInfo.lineOffsetToPosition(args.startLine, args.startOffset); + } + function getEndPosition() { + return args.endPosition !== undefined ? args.endPosition : scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset); } - this.printProjects(); }; - ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) { + Session.prototype.mapCodeAction = function (codeAction, scriptInfo) { var _this = this; - this.logger.info("Type root file " + fileName + " changed"); - this.throttledOperations.schedule(project.getConfigFilePath() + " * type root", 250, function () { - project.updateTypes(); - _this.updateConfiguredProject(project); - _this.refreshInferredProjects(); - }); + return { + description: codeAction.description, + changes: codeAction.changes.map(function (change) { return ({ + fileName: change.fileName, + textChanges: change.textChanges.map(function (textChange) { return _this.convertTextChangeToCodeEdit(textChange, scriptInfo); }) + }); }) + }; }; - ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) { - var _this = this; - if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) { - return; - } - this.logger.info("Detected source file changes: " + fileName); - this.throttledOperations.schedule(project.getConfigFilePath(), 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); }); + Session.prototype.convertTextChangeToCodeEdit = function (change, scriptInfo) { + return { + start: scriptInfo.positionToLineOffset(change.span.start), + end: scriptInfo.positionToLineOffset(change.span.start + change.span.length), + newText: change.newText ? change.newText : "" + }; }; - ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) { + Session.prototype.getBraceMatching = function (args, simplifiedResult) { var _this = this; - var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; - this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile); - var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); - var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); - if (!ts.arrayIsEqualTo(currentRootFiles.sort(), newRootFiles.sort())) { - this.logger.info("Updating configured project"); - this.updateConfiguredProject(project); - this.refreshInferredProjects(); - } - }; - ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) { - var configFileName = project.getConfigFilePath(); - this.logger.info("Config file changed: " + configFileName); - var configFileErrors = this.updateConfiguredProject(project); - this.reportConfigFileDiagnostics(configFileName, configFileErrors, configFileName); - this.refreshInferredProjects(); + var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; + var scriptInfo = project.getScriptInfoForNormalizedPath(file); + var position = this.getPosition(args, scriptInfo); + var spans = project.getLanguageService(false).getBraceMatchingAtPosition(file, position); + return !spans + ? undefined + : simplifiedResult + ? spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }) + : spans; }; - ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) { - if (ts.getBaseFileName(fileName) != "tsconfig.json") { - this.logger.info(fileName + " is not tsconfig.json"); + Session.prototype.getDiagnosticsForProject = function (next, delay, fileName) { + var _this = this; + var _a = this.getProjectInfoWorker(fileName, undefined, true), fileNames = _a.fileNames, languageServiceDisabled = _a.languageServiceDisabled; + if (languageServiceDisabled) { return; } - var configFileErrors = this.convertConfigFileContentToProjectOptions(fileName).configFileErrors; - this.reportConfigFileDiagnostics(fileName, configFileErrors, fileName); - this.logger.info("Detected newly added tsconfig file: " + fileName); - this.reloadProjects(); + var fileNamesInProject = fileNames.filter(function (value) { return value.indexOf("lib.d.ts") < 0; }); + var highPriorityFiles = []; + var mediumPriorityFiles = []; + var lowPriorityFiles = []; + var veryLowPriorityFiles = []; + var normalizedFileName = server.toNormalizedPath(fileName); + var project = this.projectService.getDefaultProjectForFile(normalizedFileName, true); + for (var _i = 0, fileNamesInProject_1 = fileNamesInProject; _i < fileNamesInProject_1.length; _i++) { + var fileNameInProject = fileNamesInProject_1[_i]; + if (this.getCanonicalFileName(fileNameInProject) === this.getCanonicalFileName(fileName)) + highPriorityFiles.push(fileNameInProject); + else { + var info = this.projectService.getScriptInfo(fileNameInProject); + if (!info.isScriptOpen()) { + if (fileNameInProject.indexOf(".d.ts") > 0) + veryLowPriorityFiles.push(fileNameInProject); + else + lowPriorityFiles.push(fileNameInProject); + } + else + mediumPriorityFiles.push(fileNameInProject); + } + } + fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles); + if (fileNamesInProject.length > 0) { + var checkList = fileNamesInProject.map(function (fileName) { return ({ fileName: fileName, project: project }); }); + this.updateErrorCheck(next, checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay, 200, false); + } }; - ProjectService.prototype.getCanonicalFileName = function (fileName) { + Session.prototype.getCanonicalFileName = function (fileName) { var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); return ts.normalizePath(name); }; - ProjectService.prototype.removeProject = function (project) { - this.logger.info("remove project: " + project.getRootFiles().toString()); - project.close(); - switch (project.projectKind) { - case server.ProjectKind.External: - server.removeItemFromSet(this.externalProjects, project); - break; - case server.ProjectKind.Configured: - server.removeItemFromSet(this.configuredProjects, project); - break; - case server.ProjectKind.Inferred: - server.removeItemFromSet(this.inferredProjects, project); - break; + Session.prototype.exit = function () { + }; + Session.prototype.notRequired = function () { + return { responseRequired: false }; + }; + Session.prototype.requiredResponse = function (response) { + return { response: response, responseRequired: true }; + }; + Session.prototype.addProtocolHandler = function (command, handler) { + if (this.handlers.has(command)) { + throw new Error("Protocol handler already exists for command \"" + command + "\""); } + this.handlers.set(command, handler); }; - ProjectService.prototype.assignScriptInfoToInferredProjectIfNecessary = function (info, addToListOfOpenFiles) { - var externalProject = this.findContainingExternalProject(info.fileName); - if (externalProject) { - if (addToListOfOpenFiles) { - this.openFiles.push(info); + Session.prototype.setCurrentRequest = function (requestId) { + ts.Debug.assert(this.currentRequestId === undefined); + this.currentRequestId = requestId; + this.cancellationToken.setRequest(requestId); + }; + Session.prototype.resetCurrentRequest = function (requestId) { + ts.Debug.assert(this.currentRequestId === requestId); + this.currentRequestId = undefined; + this.cancellationToken.resetRequest(requestId); + }; + Session.prototype.executeWithRequestId = function (requestId, f) { + try { + this.setCurrentRequest(requestId); + return f(); + } + finally { + this.resetCurrentRequest(requestId); + } + }; + Session.prototype.executeCommand = function (request) { + var handler = this.handlers.get(request.command); + if (handler) { + return this.executeWithRequestId(request.seq, function () { return handler(request); }); + } + else { + this.logger.msg("Unrecognized JSON command: " + JSON.stringify(request), server.Msg.Err); + this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); + return { responseRequired: false }; + } + }; + Session.prototype.onMessage = function (message) { + this.gcTimer.scheduleCollect(); + var start; + if (this.logger.hasLevel(server.LogLevel.requestTime)) { + start = this.hrtime(); + if (this.logger.hasLevel(server.LogLevel.verbose)) { + this.logger.info("request: " + message); } - return; } - var foundConfiguredProject = false; - for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { - var p = _a[_i]; - if (p.projectKind === server.ProjectKind.Configured) { - foundConfiguredProject = true; - if (addToListOfOpenFiles) { - (p).addOpenRef(); + var request; + try { + request = JSON.parse(message); + var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired; + if (this.logger.hasLevel(server.LogLevel.requestTime)) { + var elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4); + if (responseRequired) { + this.logger.perftrc(request.seq + "::" + request.command + ": elapsed time (in milliseconds) " + elapsedTime); + } + else { + this.logger.perftrc(request.seq + "::" + request.command + ": async elapsed time (in milliseconds) " + elapsedTime); } } - } - if (foundConfiguredProject) { - if (addToListOfOpenFiles) { - this.openFiles.push(info); + if (response) { + this.output(response, request.command, request.seq); + } + else if (responseRequired) { + this.output(undefined, request.command, request.seq, "No content available."); } - return; } - if (info.containingProjects.length === 0) { - var inferredProject = this.createInferredProjectWithRootFileIfNecessary(info); - if (!this.useSingleInferredProject) { - for (var _b = 0, _c = this.openFiles; _b < _c.length; _b++) { - var f = _c[_b]; - if (f.containingProjects.length === 0) { - continue; - } - var defaultProject = f.getDefaultProject(); - if (isRootFileInInferredProject(info) && defaultProject !== inferredProject && inferredProject.containsScriptInfo(f)) { - this.removeProject(defaultProject); - f.attachToProject(inferredProject); - } - } + catch (err) { + if (err instanceof ts.OperationCanceledException) { + this.output({ canceled: true }, request.command, request.seq); + return; } - } - if (addToListOfOpenFiles) { - this.openFiles.push(info); + this.logError(err, message); + this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message + "\n" + err.stack); } }; - ProjectService.prototype.closeOpenFile = function (info) { - info.reloadFromFile(); - server.removeItemFromSet(this.openFiles, info); - info.isOpen = false; - var projectsToRemove; - for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { - var p = _a[_i]; - if (p.projectKind === server.ProjectKind.Configured) { - if (p.deleteOpenRef() === 0) { - (projectsToRemove || (projectsToRemove = [])).push(p); - } - } - else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) { - (projectsToRemove || (projectsToRemove = [])).push(p); - } + return Session; + }()); + server.Session = Session; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var lineCollectionCapacity = 4; + var CharRangeSection; + (function (CharRangeSection) { + CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; + CharRangeSection[CharRangeSection["Start"] = 1] = "Start"; + CharRangeSection[CharRangeSection["Entire"] = 2] = "Entire"; + CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; + CharRangeSection[CharRangeSection["End"] = 4] = "End"; + CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; + })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {})); + var BaseLineIndexWalker = (function () { + function BaseLineIndexWalker() { + this.goSubtree = true; + this.done = false; + } + BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) { + }; + return BaseLineIndexWalker; + }()); + var EditWalker = (function (_super) { + __extends(EditWalker, _super); + function EditWalker() { + var _this = _super.call(this) || this; + _this.lineIndex = new LineIndex(); + _this.endBranch = []; + _this.state = CharRangeSection.Entire; + _this.initialText = ""; + _this.trailingText = ""; + _this.suppressTrailingText = false; + _this.lineIndex.root = new LineNode(); + _this.startPath = [_this.lineIndex.root]; + _this.stack = [_this.lineIndex.root]; + return _this; + } + EditWalker.prototype.insertLines = function (insertedText) { + if (this.suppressTrailingText) { + this.trailingText = ""; } - if (projectsToRemove) { - for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) { - var project = projectsToRemove_1[_b]; - this.removeProject(project); + if (insertedText) { + insertedText = this.initialText + insertedText + this.trailingText; + } + else { + insertedText = this.initialText + this.trailingText; + } + var lm = LineIndex.linesFromText(insertedText); + var lines = lm.lines; + if (lines.length > 1) { + if (lines[lines.length - 1] === "") { + lines.length--; } - var orphanFiles = void 0; - for (var _c = 0, _d = this.openFiles; _c < _d.length; _c++) { - var f = _d[_c]; - if (f.containingProjects.length === 0) { - (orphanFiles || (orphanFiles = [])).push(f); + } + var branchParent; + var lastZeroCount; + for (var k = this.endBranch.length - 1; k >= 0; k--) { + this.endBranch[k].updateCounts(); + if (this.endBranch[k].charCount() === 0) { + lastZeroCount = this.endBranch[k]; + if (k > 0) { + branchParent = this.endBranch[k - 1]; } - } - if (orphanFiles) { - for (var _e = 0, orphanFiles_1 = orphanFiles; _e < orphanFiles_1.length; _e++) { - var f = orphanFiles_1[_e]; - this.assignScriptInfoToInferredProjectIfNecessary(f, false); + else { + branchParent = this.branchNode; } } } - if (info.containingProjects.length === 0) { - this.filenameToScriptInfo.remove(info.path); - } - }; - ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) { - var searchPath = ts.getDirectoryPath(fileName); - this.logger.info("Search path: " + searchPath); - var configFileName = this.findConfigFile(server.asNormalizedPath(searchPath)); - if (!configFileName) { - this.logger.info("No config files found."); - return {}; + if (lastZeroCount) { + branchParent.remove(lastZeroCount); } - this.logger.info("Config file name: " + configFileName); - var project = this.findConfiguredProjectByProjectName(configFileName); - if (!project) { - var _a = this.openConfigFile(configFileName, fileName), success = _a.success, errors = _a.errors; - if (!success) { - return { configFileName: configFileName, configFileErrors: errors }; + var insertionNode = this.startPath[this.startPath.length - 2]; + var leafNode = this.startPath[this.startPath.length - 1]; + var len = lines.length; + if (len > 0) { + leafNode.text = lines[0]; + if (len > 1) { + var insertedNodes = new Array(len - 1); + var startNode = leafNode; + for (var i = 1; i < lines.length; i++) { + insertedNodes[i - 1] = new LineLeaf(lines[i]); + } + var pathIndex = this.startPath.length - 2; + while (pathIndex >= 0) { + insertionNode = this.startPath[pathIndex]; + insertedNodes = insertionNode.insertAt(startNode, insertedNodes); + pathIndex--; + startNode = insertionNode; + } + var insertedNodesLen = insertedNodes.length; + while (insertedNodesLen > 0) { + var newRoot = new LineNode(); + newRoot.add(this.lineIndex.root); + insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); + insertedNodesLen = insertedNodes.length; + this.lineIndex.root = newRoot; + } + this.lineIndex.root.updateCounts(); } - this.logger.info("Opened configuration file " + configFileName); - if (errors && errors.length > 0) { - return { configFileName: configFileName, configFileErrors: errors }; + else { + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } } } else { - this.updateConfiguredProject(project); + insertionNode.remove(leafNode); + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } } - return { configFileName: configFileName }; + return this.lineIndex; }; - ProjectService.prototype.findConfigFile = function (searchPath) { - while (true) { - var tsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "tsconfig.json")); - if (this.host.fileExists(tsconfigFileName)) { - return tsconfigFileName; - } - var jsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "jsconfig.json")); - if (this.host.fileExists(jsconfigFileName)) { - return jsconfigFileName; - } - var parentPath = server.asNormalizedPath(ts.getDirectoryPath(searchPath)); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; + EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) { + if (lineCollection === this.lineCollectionAtBranch) { + this.state = CharRangeSection.End; } + this.stack.length--; return undefined; }; - ProjectService.prototype.printProjects = function () { - if (!this.logger.hasLevel(server.LogLevel.verbose)) { - return; - } - this.logger.startGroup(); - var counter = 0; - counter = printProjects(this.logger, this.externalProjects, counter); - counter = printProjects(this.logger, this.configuredProjects, counter); - counter = printProjects(this.logger, this.inferredProjects, counter); - this.logger.info("Open files: "); - for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { - var rootFile = _a[_i]; - this.logger.info(rootFile.fileName); + EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) { + var currentNode = this.stack[this.stack.length - 1]; + if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { + this.state = CharRangeSection.Start; + this.branchNode = currentNode; + this.lineCollectionAtBranch = lineCollection; } - this.logger.endGroup(); - function printProjects(logger, projects, counter) { - for (var _i = 0, projects_3 = projects; _i < projects_3.length; _i++) { - var project = projects_3[_i]; - project.updateGraph(); - logger.info("Project '" + project.getProjectName() + "' (" + server.ProjectKind[project.projectKind] + ") " + counter); - logger.info(project.filesToString()); - logger.info("-----------------------------------------------"); - counter++; + var child; + function fresh(node) { + if (node.isLeaf()) { + return new LineLeaf(""); } - return counter; + else + return new LineNode(); } - }; - ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) { - configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName)); - for (var _i = 0, _a = this.configuredProjects; _i < _a.length; _i++) { - var proj = _a[_i]; - if (proj.canonicalConfigFilePath === configFileName) { - return proj; - } + switch (nodeType) { + case CharRangeSection.PreStart: + this.goSubtree = false; + if (this.state !== CharRangeSection.End) { + currentNode.add(lineCollection); + } + break; + case CharRangeSection.Start: + if (this.state === CharRangeSection.End) { + this.goSubtree = false; + } + else { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + break; + case CharRangeSection.Entire: + if (this.state !== CharRangeSection.End) { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.Mid: + this.goSubtree = false; + break; + case CharRangeSection.End: + if (this.state !== CharRangeSection.End) { + this.goSubtree = false; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.PostEnd: + this.goSubtree = false; + if (this.state !== CharRangeSection.Start) { + currentNode.add(lineCollection); + } + break; } + if (this.goSubtree) { + this.stack[this.stack.length] = child; + } + return lineCollection; }; - ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) { - return findProjectByName(projectFileName, this.externalProjects); - }; - ProjectService.prototype.convertConfigFileContentToProjectOptions = function (configFilename) { - configFilename = ts.normalizePath(configFilename); - var configFileContent = this.host.readFile(configFilename); - var errors; - var result = ts.parseConfigFileTextToJson(configFilename, configFileContent); - var config = result.config; - if (result.error) { - var _a = ts.sanitizeConfigFile(configFilename, configFileContent), sanitizedConfig = _a.configJsonObject, diagnostics = _a.diagnostics; - config = sanitizedConfig; - errors = diagnostics.length ? diagnostics : [result.error]; + EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { + if (this.state === CharRangeSection.Start) { + this.initialText = ll.text.substring(0, relativeStart); } - var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename); - if (parsedCommandLine.errors.length) { - errors = ts.concatenate(errors, parsedCommandLine.errors); + else if (this.state === CharRangeSection.Entire) { + this.initialText = ll.text.substring(0, relativeStart); + this.trailingText = ll.text.substring(relativeStart + relativeLength); } - ts.Debug.assert(!!parsedCommandLine.fileNames); - if (parsedCommandLine.fileNames.length === 0) { - (errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename)); - return { success: false, configFileErrors: errors }; + else { + this.trailingText = ll.text.substring(relativeStart + relativeLength); } - var projectOptions = { - files: parsedCommandLine.fileNames, - compilerOptions: parsedCommandLine.options, - configHasFilesProperty: config["files"] !== undefined, - wildcardDirectories: ts.createMap(parsedCommandLine.wildcardDirectories), - typeAcquisition: parsedCommandLine.typeAcquisition, - compileOnSave: parsedCommandLine.compileOnSave - }; - return { success: true, projectOptions: projectOptions, configFileErrors: errors }; }; - ProjectService.prototype.exceededTotalSizeLimitForNonTsFiles = function (options, fileNames, propertyReader) { - if (options && options.disableSizeLimit || !this.host.getFileSize) { - return false; - } - var totalNonTsFileSize = 0; - for (var _i = 0, fileNames_3 = fileNames; _i < fileNames_3.length; _i++) { - var f = fileNames_3[_i]; - var fileName = propertyReader.getFileName(f); - if (ts.hasTypeScriptFileExtension(fileName)) { - continue; - } - totalNonTsFileSize += this.host.getFileSize(fileName); - if (totalNonTsFileSize > server.maxProgramSizeForNonTsFiles) { - return true; - } + return EditWalker; + }(BaseLineIndexWalker)); + var TextChange = (function () { + function TextChange(pos, deleteLen, insertedText) { + this.pos = pos; + this.deleteLen = deleteLen; + this.insertedText = insertedText; + } + TextChange.prototype.getTextChangeRange = function () { + return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); + }; + return TextChange; + }()); + server.TextChange = TextChange; + var ScriptVersionCache = (function () { + function ScriptVersionCache() { + this.changes = []; + this.versions = new Array(ScriptVersionCache.maxVersions); + this.minVersion = 0; + this.currentVersion = 0; + } + ScriptVersionCache.prototype.versionToIndex = function (version) { + if (version < this.minVersion || version > this.currentVersion) { + return undefined; } - return false; + return version % ScriptVersionCache.maxVersions; }; - ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) { - var compilerOptions = convertCompilerOptions(options); - var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); - this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined); - this.externalProjects.push(project); - return project; + ScriptVersionCache.prototype.currentVersionToIndex = function () { + return this.currentVersion % ScriptVersionCache.maxVersions; }; - ProjectService.prototype.reportConfigFileDiagnostics = function (configFileName, diagnostics, triggerFile) { - if (!this.eventHandler) { - return; + ScriptVersionCache.prototype.edit = function (pos, deleteLen, insertedText) { + this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); + if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || + (deleteLen > ScriptVersionCache.changeLengthThreshold) || + (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { + this.getSnapshot(); } - this.eventHandler({ - eventName: server.ConfigFileDiagEvent, - data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile } - }); }; - ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) { - var _this = this; - var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader); - var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave); - this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors); - project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); }); - if (!sizeLimitExceeded) { - this.watchConfigDirectoryForProject(project, projectOptions); - } - project.watchWildcards(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); }); - project.watchTypeRoots(function (project, path) { return _this.onTypeRootFileChanged(project, path); }); - this.configuredProjects.push(project); - return project; + ScriptVersionCache.prototype.latest = function () { + return this.versions[this.currentVersionToIndex()]; }; - ProjectService.prototype.watchConfigDirectoryForProject = function (project, options) { - var _this = this; - if (!options.configHasFilesProperty) { - project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); }); + ScriptVersionCache.prototype.latestVersion = function () { + if (this.changes.length > 0) { + this.getSnapshot(); } + return this.currentVersion; }; - ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors) { - var errors; - for (var _i = 0, files_4 = files; _i < files_4.length; _i++) { - var f = files_4[_i]; - var rootFilename = propertyReader.getFileName(f); - var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); - if (this.host.fileExists(rootFilename)) { - var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName == rootFilename, undefined, scriptKind, hasMixedContent); - project.addRoot(info); - } - else { - (errors || (errors = [])).push(createFileNotFoundDiagnostic(rootFilename)); - } + ScriptVersionCache.prototype.reloadFromFile = function (filename) { + var content = this.host.readFile(filename); + if (!content) { + content = ""; } - project.setProjectErrors(ts.concatenate(configFileErrors, errors)); - project.setTypeAcquisition(typeAcquisition); - project.updateGraph(); + this.reload(content); }; - ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) { - var conversionResult = this.convertConfigFileContentToProjectOptions(configFileName); - var projectOptions = conversionResult.success - ? conversionResult.projectOptions - : { files: [], compilerOptions: {} }; - var project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName); - return { - success: conversionResult.success, - project: project, - errors: project.getProjectErrors() - }; + ScriptVersionCache.prototype.reload = function (script) { + this.currentVersion++; + this.changes = []; + var snap = new LineIndexSnapshot(this.currentVersion, this); + for (var i = 0; i < this.versions.length; i++) { + this.versions[i] = undefined; + } + this.versions[this.currentVersionToIndex()] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + this.minVersion = this.currentVersion; }; - ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) { - var oldRootScriptInfos = project.getRootScriptInfos(); - var newRootScriptInfos = []; - var newRootScriptInfoMap = server.createNormalizedPathMap(); - var projectErrors; - var rootFilesChanged = false; - for (var _i = 0, newUncheckedFiles_1 = newUncheckedFiles; _i < newUncheckedFiles_1.length; _i++) { - var f = newUncheckedFiles_1[_i]; - var newRootFile = propertyReader.getFileName(f); - if (!this.host.fileExists(newRootFile)) { - (projectErrors || (projectErrors = [])).push(createFileNotFoundDiagnostic(newRootFile)); - continue; + ScriptVersionCache.prototype.getSnapshot = function () { + var snap = this.versions[this.currentVersionToIndex()]; + if (this.changes.length > 0) { + var snapIndex = snap.index; + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var change = _a[_i]; + snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); } - var normalizedPath = server.toNormalizedPath(newRootFile); - var scriptInfo = this.getScriptInfoForNormalizedPath(normalizedPath); - if (!scriptInfo || !project.isRoot(scriptInfo)) { - rootFilesChanged = true; - if (!scriptInfo) { - var scriptKind = propertyReader.getScriptKind(f); - var hasMixedContent = propertyReader.hasMixedContent(f); - scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent); - } + snap = new LineIndexSnapshot(this.currentVersion + 1, this); + snap.index = snapIndex; + snap.changesSincePreviousVersion = this.changes; + this.currentVersion = snap.version; + this.versions[this.currentVersionToIndex()] = snap; + this.changes = []; + if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { + this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; } - newRootScriptInfos.push(scriptInfo); - newRootScriptInfoMap.set(scriptInfo.fileName, scriptInfo); } - if (rootFilesChanged || newRootScriptInfos.length !== oldRootScriptInfos.length) { - var toAdd = void 0; - var toRemove = void 0; - for (var _a = 0, oldRootScriptInfos_1 = oldRootScriptInfos; _a < oldRootScriptInfos_1.length; _a++) { - var oldFile = oldRootScriptInfos_1[_a]; - if (!newRootScriptInfoMap.contains(oldFile.fileName)) { - (toRemove || (toRemove = [])).push(oldFile); - } - } - for (var _b = 0, newRootScriptInfos_1 = newRootScriptInfos; _b < newRootScriptInfos_1.length; _b++) { - var newFile = newRootScriptInfos_1[_b]; - if (!project.isRoot(newFile)) { - (toAdd || (toAdd = [])).push(newFile); + return snap; + }; + ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { + if (oldVersion < newVersion) { + if (oldVersion >= this.minVersion) { + var textChangeRanges = []; + for (var i = oldVersion + 1; i <= newVersion; i++) { + var snap = this.versions[this.versionToIndex(i)]; + for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { + var textChange = _a[_i]; + textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + } } + return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); } - if (toRemove) { - for (var _c = 0, toRemove_1 = toRemove; _c < toRemove_1.length; _c++) { - var f = toRemove_1[_c]; - project.removeFile(f); - } - } - if (toAdd) { - for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) { - var f = toAdd_1[_d]; - if (f.isOpen && isRootFileInInferredProject(f)) { - var inferredProject = f.containingProjects[0]; - inferredProject.removeFile(f); - if (!inferredProject.hasRoots()) { - this.removeProject(inferredProject); - } - } - project.addRoot(f); - } + else { + return undefined; } } - project.setCompilerOptions(newOptions); - project.setTypeAcquisition(newTypeAcquisition); - if (compileOnSave !== undefined) { - project.compileOnSaveEnabled = compileOnSave; + else { + return ts.unchangedTextChangeRange; } - project.setProjectErrors(ts.concatenate(configFileErrors, projectErrors)); - project.updateGraph(); }; - ProjectService.prototype.updateConfiguredProject = function (project) { - if (!this.host.fileExists(project.getConfigFilePath())) { - this.logger.info("Config file deleted"); - this.removeProject(project); - return; + ScriptVersionCache.fromString = function (host, script) { + var svc = new ScriptVersionCache(); + var snap = new LineIndexSnapshot(0, svc); + svc.versions[svc.currentVersion] = snap; + svc.host = host; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + return svc; + }; + return ScriptVersionCache; + }()); + ScriptVersionCache.changeNumberThreshold = 8; + ScriptVersionCache.changeLengthThreshold = 256; + ScriptVersionCache.maxVersions = 8; + server.ScriptVersionCache = ScriptVersionCache; + var LineIndexSnapshot = (function () { + function LineIndexSnapshot(version, cache) { + this.version = version; + this.cache = cache; + this.changesSincePreviousVersion = []; + } + LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { + return this.index.getText(rangeStart, rangeEnd - rangeStart); + }; + LineIndexSnapshot.prototype.getLength = function () { + return this.index.root.charCount(); + }; + LineIndexSnapshot.prototype.getLineStartPositions = function () { + var starts = [-1]; + var count = 1; + var pos = 0; + this.index.every(function (ll) { + starts[count] = pos; + count++; + pos += ll.text.length; + return true; + }, 0); + return starts; + }; + LineIndexSnapshot.prototype.getLineMapper = function () { + var _this = this; + return function (line) { + return _this.index.lineNumberToInfo(line).offset; + }; + }; + LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { + if (this.version <= scriptVersion) { + return ts.unchangedTextChangeRange; } - var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; - if (!success) { - this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors); - return configFileErrors; + else { + return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); } - if (this.exceededTotalSizeLimitForNonTsFiles(projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) { - project.setCompilerOptions(projectOptions.compilerOptions); - if (!project.languageServiceEnabled) { - return configFileErrors; - } - project.disableLanguageService(); - project.stopWatchingDirectory(); + }; + LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { + if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } + }; + return LineIndexSnapshot; + }()); + server.LineIndexSnapshot = LineIndexSnapshot; + var LineIndex = (function () { + function LineIndex() { + this.checkEdits = false; + } + LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { + return this.root.charOffsetToLineNumberAndPos(1, charOffset); + }; + LineIndex.prototype.lineNumberToInfo = function (lineNumber) { + var lineCount = this.root.lineCount(); + if (lineNumber <= lineCount) { + var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); + lineInfo.line = lineNumber; + return lineInfo; } else { - if (!project.languageServiceEnabled) { - project.enableLanguageService(); + return { + line: lineNumber, + offset: this.root.charCount() + }; + } + }; + LineIndex.prototype.load = function (lines) { + if (lines.length > 0) { + var leaves = []; + for (var i = 0; i < lines.length; i++) { + leaves[i] = new LineLeaf(lines[i]); } - this.watchConfigDirectoryForProject(project, projectOptions); - this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); + this.root = LineIndex.buildTreeFromBottom(leaves); + } + else { + this.root = new LineNode(); } - return configFileErrors; }; - ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) { - var _this = this; - var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length; - var project = useExistingProject - ? this.inferredProjects[0] - : new server.InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); - project.addRoot(root); - this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); }); - project.updateGraph(); - if (!useExistingProject) { - this.inferredProjects.push(project); + LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) { + this.root.walk(rangeStart, rangeLength, walkFns); + }; + LineIndex.prototype.getText = function (rangeStart, rangeLength) { + var accum = ""; + if ((rangeLength > 0) && (rangeStart < this.root.charCount())) { + this.walk(rangeStart, rangeLength, { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); + } + }); } - return project; + return accum; }; - ProjectService.prototype.getOrCreateScriptInfo = function (uncheckedFileName, openedByClient, fileContent, scriptKind) { - return this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName), openedByClient, fileContent, scriptKind); + LineIndex.prototype.getLength = function () { + return this.root.charCount(); }; - ProjectService.prototype.getScriptInfo = function (uncheckedFileName) { - return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); + LineIndex.prototype.every = function (f, rangeStart, rangeEnd) { + if (!rangeEnd) { + rangeEnd = this.root.charCount(); + } + var walkFns = { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + if (!f(ll, relativeStart, relativeLength)) { + this.done = true; + } + } + }; + this.walk(rangeStart, rangeEnd - rangeStart, walkFns); + return !walkFns.done; }; - ProjectService.prototype.getOrCreateScriptInfoForNormalizedPath = function (fileName, openedByClient, fileContent, scriptKind, hasMixedContent) { - var _this = this; - var info = this.getScriptInfoForNormalizedPath(fileName); - if (!info) { - var content = void 0; - if (this.host.fileExists(fileName)) { - content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName)); + LineIndex.prototype.edit = function (pos, deleteLength, newText) { + function editFlat(source, s, dl, nt) { + if (nt === void 0) { nt = ""; } + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + if (this.root.charCount() === 0) { + if (newText !== undefined) { + this.load(LineIndex.linesFromText(newText).lines); + return this; } - if (!content) { - if (openedByClient) { - content = ""; + } + else { + var checkText = void 0; + if (this.checkEdits) { + checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + } + var walker = new EditWalker(); + if (pos >= this.root.charCount()) { + pos = this.root.charCount() - 1; + var endString = this.getText(pos, 1); + if (newText) { + newText = endString + newText; + } + else { + newText = endString; } + deleteLength = 0; + walker.suppressTrailingText = true; } - if (content !== undefined) { - info = new server.ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent); - this.filenameToScriptInfo.set(info.path, info); - if (!info.isOpen && !hasMixedContent) { - info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); + else if (deleteLength > 0) { + var e = pos + deleteLength; + var lineInfo = this.charOffsetToLineNumberAndPos(e); + if ((lineInfo && (lineInfo.offset === 0))) { + deleteLength += lineInfo.text.length; + if (newText) { + newText = newText + lineInfo.text; + } + else { + newText = lineInfo.text; + } } } - } - if (info) { - if (fileContent !== undefined) { - info.reload(fileContent); + if (pos < this.root.charCount()) { + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText); } - if (openedByClient) { - info.isOpen = true; + if (this.checkEdits) { + var updatedText = this.getText(0, this.root.charCount()); + ts.Debug.assert(checkText === updatedText, "buffer edit mismatch"); } + return walker.lineIndex; } - return info; }; - ProjectService.prototype.getScriptInfoForNormalizedPath = function (fileName) { - return this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.host.getCurrentDirectory(), this.toCanonicalFileName)); - }; - ProjectService.prototype.getScriptInfoForPath = function (fileName) { - return this.filenameToScriptInfo.get(fileName); - }; - ProjectService.prototype.setHostConfiguration = function (args) { - if (args.file) { - var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(args.file)); - if (info) { - info.setFormatOptions(convertFormatOptions(args.formatOptions)); - this.logger.info("Host configuration update for file " + args.file); + LineIndex.buildTreeFromBottom = function (nodes) { + var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); + var interiorNodes = []; + var nodeIndex = 0; + for (var i = 0; i < nodeCount; i++) { + interiorNodes[i] = new LineNode(); + var charCount = 0; + var lineCount = 0; + for (var j = 0; j < lineCollectionCapacity; j++) { + if (nodeIndex < nodes.length) { + interiorNodes[i].add(nodes[nodeIndex]); + charCount += nodes[nodeIndex].charCount(); + lineCount += nodes[nodeIndex].lineCount(); + } + else { + break; + } + nodeIndex++; } + interiorNodes[i].totalChars = charCount; + interiorNodes[i].totalLines = lineCount; + } + if (interiorNodes.length === 1) { + return interiorNodes[0]; } else { - if (args.hostInfo !== undefined) { - this.hostConfiguration.hostInfo = args.hostInfo; - this.logger.info("Host information " + args.hostInfo); - } - if (args.formatOptions) { - server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); - this.logger.info("Format host information updated"); - } + return this.buildTreeFromBottom(interiorNodes); } }; - ProjectService.prototype.closeLog = function () { - this.logger.close(); - }; - ProjectService.prototype.reloadProjects = function () { - this.logger.info("reload projects."); - for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { - var info = _a[_i]; - this.openOrUpdateConfiguredProjectForFile(info.fileName); + LineIndex.linesFromText = function (text) { + var lineStarts = ts.computeLineStarts(text); + if (lineStarts.length === 0) { + return { lines: [], lineMap: lineStarts }; } - this.refreshInferredProjects(); - }; - ProjectService.prototype.refreshInferredProjects = function () { - this.logger.info("updating project structure from ..."); - this.printProjects(); - var orphantedFiles = []; - for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { - var info = _a[_i]; - if (info.containingProjects.length === 0) { - orphantedFiles.push(info); - } - else { - if (isRootFileInInferredProject(info) && info.containingProjects.length > 1) { - var inferredProject = info.containingProjects[0]; - ts.Debug.assert(inferredProject.projectKind === server.ProjectKind.Inferred); - inferredProject.removeFile(info); - if (!inferredProject.hasRoots()) { - this.removeProject(inferredProject); - } - } - } + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); } - for (var _b = 0, orphantedFiles_1 = orphantedFiles; _b < orphantedFiles_1.length; _b++) { - var f = orphantedFiles_1[_b]; - this.assignScriptInfoToInferredProjectIfNecessary(f, false); + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; } - for (var _c = 0, _d = this.inferredProjects; _c < _d.length; _c++) { - var p = _d[_c]; - p.updateGraph(); + else { + lines.length--; } - this.printProjects(); - }; - ProjectService.prototype.openClientFile = function (fileName, fileContent, scriptKind) { - return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind); - }; - ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) { - var _a = this.findContainingExternalProject(fileName) - ? {} - : this.openOrUpdateConfiguredProjectForFile(fileName), _b = _a.configFileName, configFileName = _b === void 0 ? undefined : _b, _c = _a.configFileErrors, configFileErrors = _c === void 0 ? undefined : _c; - var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent); - this.assignScriptInfoToInferredProjectIfNecessary(info, true); - this.printProjects(); - return { configFileName: configFileName, configFileErrors: configFileErrors }; + return { lines: lines, lineMap: lineStarts }; }; - ProjectService.prototype.closeClientFile = function (uncheckedFileName) { - var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); - if (info) { - this.closeOpenFile(info); - info.isOpen = false; - } - this.printProjects(); + return LineIndex; + }()); + server.LineIndex = LineIndex; + var LineNode = (function () { + function LineNode() { + this.totalChars = 0; + this.totalLines = 0; + this.children = []; + } + LineNode.prototype.isLeaf = function () { + return false; }; - ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_5 = function (proj) { - var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); - result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); - }; - for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { - var proj = currentProjects_1[_i]; - _loop_5(proj); + LineNode.prototype.updateCounts = function () { + this.totalChars = 0; + this.totalLines = 0; + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); } }; - ProjectService.prototype.synchronizeProjectList = function (knownProjects) { - var files = []; - this.collectChanges(knownProjects, this.externalProjects, files); - this.collectChanges(knownProjects, this.configuredProjects, files); - this.collectChanges(knownProjects, this.inferredProjects, files); - return files; - }; - ProjectService.prototype.applyChangesInOpenFiles = function (openFiles, changedFiles, closedFiles) { - var recordChangedFiles = changedFiles && !openFiles && !closedFiles; - if (openFiles) { - for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) { - var file = openFiles_1[_i]; - var scriptInfo = this.getScriptInfo(file.fileName); - ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen); - var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName); - this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); - } - } - if (changedFiles) { - for (var _a = 0, changedFiles_2 = changedFiles; _a < changedFiles_2.length; _a++) { - var file = changedFiles_2[_a]; - var scriptInfo = this.getScriptInfo(file.fileName); - ts.Debug.assert(!!scriptInfo); - for (var i = file.changes.length - 1; i >= 0; i--) { - var change = file.changes[i]; - scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText); - } - if (recordChangedFiles) { - if (!this.changedFiles) { - this.changedFiles = [scriptInfo]; - } - else if (this.changedFiles.indexOf(scriptInfo) < 0) { - this.changedFiles.push(scriptInfo); - } - } - } + LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); } - if (closedFiles) { - for (var _b = 0, closedFiles_1 = closedFiles; _b < closedFiles_1.length; _b++) { - var file = closedFiles_1[_b]; - this.closeClientFile(file); + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); } } - if (openFiles || closedFiles) { - this.refreshInferredProjects(); + else { + walkFns.goSubtree = true; } + return walkFns.done; }; - ProjectService.prototype.closeConfiguredProject = function (configFile) { - var configuredProject = this.findConfiguredProjectByProjectName(configFile); - if (configuredProject && configuredProject.deleteOpenRef() === 0) { - this.removeProject(configuredProject); + LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; } }; - ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) { - if (suppressRefresh === void 0) { suppressRefresh = false; } - var fileName = server.toNormalizedPath(uncheckedFileName); - var configFiles = this.externalProjectToConfiguredProjectMap[fileName]; - if (configFiles) { - var shouldRefreshInferredProjects = false; - for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) { - var configFile = configFiles_1[_i]; - if (this.closeConfiguredProject(configFile)) { - shouldRefreshInferredProjects = true; + LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; + } + } + else { + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; + } + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; } + adjustedLength -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); } - delete this.externalProjectToConfiguredProjectMap[fileName]; - if (shouldRefreshInferredProjects && !suppressRefresh) { - this.refreshInferredProjects(); + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } } } - else { - var externalProject = this.findExternalProjectByProjectName(uncheckedFileName); - if (externalProject) { - this.removeProject(externalProject); - if (!suppressRefresh) { - this.refreshInferredProjects(); + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); } } } }; - ProjectService.prototype.openExternalProject = function (proj) { - if (proj.typingOptions && !proj.typeAcquisition) { - var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions); - proj.typeAcquisition = typeAcquisition; + LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset, + }; } - var tsConfigFiles; - var rootFiles = []; - for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) { - var file = _a[_i]; - var normalized = server.toNormalizedPath(file.fileName); - if (ts.getBaseFileName(normalized) === "tsconfig.json") { - if (this.host.fileExists(normalized)) { - (tsConfigFiles || (tsConfigFiles = [])).push(normalized); - } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; } else { - rootFiles.push(file); + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); } } - if (tsConfigFiles) { - tsConfigFiles.sort(); + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; } - var externalProject = this.findExternalProjectByProjectName(proj.projectFileName); - var exisingConfigFiles; - if (externalProject) { - if (!tsConfigFiles) { - this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, undefined); - return; + }; + LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset + }; + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } + }; + LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { + var child; + var relativeLineNumber = lineNumber; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); } - this.closeExternalProject(proj.projectFileName, true); } - else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) { - if (!tsConfigFiles) { - this.closeExternalProject(proj.projectFileName, true); + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + }; + LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { + var child; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; } else { - var oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName]; - var iNew = 0; - var iOld = 0; - while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) { - var newConfig = tsConfigFiles[iNew]; - var oldConfig = oldConfigFiles[iOld]; - if (oldConfig < newConfig) { - this.closeConfiguredProject(oldConfig); - iOld++; - } - else if (oldConfig > newConfig) { - iNew++; - } - else { - (exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig); - iOld++; - iNew++; + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + }; + }; + LineNode.prototype.splitAfter = function (childIndex) { + var splitNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex]); + childIndex++; + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + }; + LineNode.prototype.remove = function (child) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + }; + LineNode.prototype.findChildIndex = function (child) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] !== child) && (childIndex < clen)) + childIndex++; + return childIndex; + }; + LineNode.prototype.insertAt = function (child, nodes) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex] = nodes[nodeIndex]; + childIndex++; + nodeIndex++; + } + var splitNodes = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex]); + nodeIndex++; + if (splitNode.children.length === lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; } } - for (var i = iOld; i < oldConfigFiles.length; i++) { - this.closeConfiguredProject(oldConfigFiles[i]); + for (var i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length === 0) { + splitNodes.length--; + } } } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i].updateCounts(); + } + return splitNodes; } - if (tsConfigFiles) { - this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles; - for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) { - var tsconfigFile = tsConfigFiles_1[_b]; - var project = this.findConfiguredProjectByProjectName(tsconfigFile); - if (!project) { - var result = this.openConfigFile(tsconfigFile); - project = result.success && result.project; + }; + LineNode.prototype.add = function (collection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + }; + LineNode.prototype.charCount = function () { + return this.totalChars; + }; + LineNode.prototype.lineCount = function () { + return this.totalLines; + }; + return LineNode; + }()); + server.LineNode = LineNode; + var LineLeaf = (function () { + function LineLeaf(text) { + this.text = text; + } + LineLeaf.prototype.isLeaf = function () { + return true; + }; + LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { + walkFns.leaf(rangeStart, rangeLength, this); + }; + LineLeaf.prototype.charCount = function () { + return this.text.length; + }; + LineLeaf.prototype.lineCount = function () { + return 1; + }; + return LineLeaf; + }()); + server.LineLeaf = LineLeaf; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var TextStorage = (function () { + function TextStorage(host, fileName) { + this.host = host; + this.fileName = fileName; + this.svcVersion = 0; + this.textVersion = 0; + } + TextStorage.prototype.getVersion = function () { + return this.svc + ? "SVC-" + this.svcVersion + "-" + this.svc.getSnapshot().version + : "Text-" + this.textVersion; + }; + TextStorage.prototype.hasScriptVersionCache = function () { + return this.svc !== undefined; + }; + TextStorage.prototype.useScriptVersionCache = function (newText) { + this.switchToScriptVersionCache(newText); + }; + TextStorage.prototype.useText = function (newText) { + this.svc = undefined; + this.setText(newText); + }; + TextStorage.prototype.edit = function (start, end, newText) { + this.switchToScriptVersionCache().edit(start, end - start, newText); + }; + TextStorage.prototype.reload = function (text) { + if (this.svc) { + this.svc.reload(text); + } + else { + this.setText(text); + } + }; + TextStorage.prototype.reloadFromFile = function (tempFileName) { + if (this.svc || (tempFileName !== this.fileName)) { + this.reload(this.getFileText(tempFileName)); + } + else { + this.setText(undefined); + } + }; + TextStorage.prototype.getSnapshot = function () { + return this.svc + ? this.svc.getSnapshot() + : ts.ScriptSnapshot.fromString(this.getOrLoadText()); + }; + TextStorage.prototype.getLineInfo = function (line) { + return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line); + }; + TextStorage.prototype.lineToTextSpan = function (line) { + if (!this.svc) { + var lineMap = this.getLineMap(); + var start = lineMap[line]; + var end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length; + return ts.createTextSpanFromBounds(start, end); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line + 1); + var len; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.offset - lineInfo.offset; + } + return ts.createTextSpan(lineInfo.offset, len); + }; + TextStorage.prototype.lineOffsetToPosition = function (line, offset) { + if (!this.svc) { + return ts.computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1); + } + var index = this.svc.getSnapshot().index; + var lineInfo = index.lineNumberToInfo(line); + return (lineInfo.offset + offset - 1); + }; + TextStorage.prototype.positionToLineOffset = function (position) { + if (!this.svc) { + var _a = ts.computeLineAndCharacterOfPosition(this.getLineMap(), position), line = _a.line, character = _a.character; + return { line: line + 1, offset: character + 1 }; + } + var index = this.svc.getSnapshot().index; + var lineOffset = index.charOffsetToLineNumberAndPos(position); + return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + }; + TextStorage.prototype.getFileText = function (tempFileName) { + return this.host.readFile(tempFileName || this.fileName) || ""; + }; + TextStorage.prototype.ensureNoScriptVersionCache = function () { + ts.Debug.assert(!this.svc, "ScriptVersionCache should not be set"); + }; + TextStorage.prototype.switchToScriptVersionCache = function (newText) { + if (!this.svc) { + this.svc = server.ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText()); + this.svcVersion++; + this.text = undefined; + } + return this.svc; + }; + TextStorage.prototype.getOrLoadText = function () { + this.ensureNoScriptVersionCache(); + if (this.text === undefined) { + this.setText(this.getFileText()); + } + return this.text; + }; + TextStorage.prototype.getLineMap = function () { + this.ensureNoScriptVersionCache(); + return this.lineMap || (this.lineMap = ts.computeLineStarts(this.getOrLoadText())); + }; + TextStorage.prototype.setText = function (newText) { + this.ensureNoScriptVersionCache(); + if (newText === undefined || this.text !== newText) { + this.text = newText; + this.lineMap = undefined; + this.textVersion++; + } + }; + return TextStorage; + }()); + server.TextStorage = TextStorage; + var ScriptInfo = (function () { + function ScriptInfo(host, fileName, scriptKind, hasMixedContent) { + if (hasMixedContent === void 0) { hasMixedContent = false; } + this.host = host; + this.fileName = fileName; + this.scriptKind = scriptKind; + this.hasMixedContent = hasMixedContent; + this.containingProjects = []; + this.path = ts.toPath(fileName, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); + this.textStorage = new TextStorage(host, fileName); + if (hasMixedContent) { + this.textStorage.reload(""); + } + this.scriptKind = scriptKind + ? scriptKind + : ts.getScriptKindFromFileName(fileName); + } + ScriptInfo.prototype.isScriptOpen = function () { + return this.isOpen; + }; + ScriptInfo.prototype.open = function (newText) { + this.isOpen = true; + this.textStorage.useScriptVersionCache(newText); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.close = function () { + this.isOpen = false; + this.textStorage.useText(this.hasMixedContent ? "" : undefined); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.getSnapshot = function () { + return this.textStorage.getSnapshot(); + }; + ScriptInfo.prototype.getFormatCodeSettings = function () { + return this.formatCodeSettings; + }; + ScriptInfo.prototype.attachToProject = function (project) { + var isNew = !this.isAttached(project); + if (isNew) { + this.containingProjects.push(project); + } + return isNew; + }; + ScriptInfo.prototype.isAttached = function (project) { + switch (this.containingProjects.length) { + case 0: return false; + case 1: return this.containingProjects[0] === project; + case 2: return this.containingProjects[0] === project || this.containingProjects[1] === project; + default: return ts.contains(this.containingProjects, project); + } + }; + ScriptInfo.prototype.detachFromProject = function (project) { + switch (this.containingProjects.length) { + case 0: + return; + case 1: + if (this.containingProjects[0] === project) { + this.containingProjects.pop(); } - if (project && !ts.contains(exisingConfigFiles, tsconfigFile)) { - project.addOpenRef(); + break; + case 2: + if (this.containingProjects[0] === project) { + this.containingProjects[0] = this.containingProjects.pop(); + } + else if (this.containingProjects[1] === project) { + this.containingProjects.pop(); + } + break; + default: + server.removeItemFromSet(this.containingProjects, project); + break; + } + }; + ScriptInfo.prototype.detachAllProjects = function () { + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + p.removeFile(this, false); + } + this.containingProjects.length = 0; + }; + ScriptInfo.prototype.getDefaultProject = function () { + switch (this.containingProjects.length) { + case 0: + return server.Errors.ThrowNoProject(); + case 1: + return this.containingProjects[0]; + default: + var firstExternalProject = void 0; + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var project = _a[_i]; + if (project.projectKind === server.ProjectKind.Configured) { + return project; + } + else if (project.projectKind === server.ProjectKind.External && !firstExternalProject) { + firstExternalProject = project; + } } + return firstExternalProject || this.containingProjects[0]; + } + }; + ScriptInfo.prototype.registerFileUpdate = function () { + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + p.registerFileUpdate(this.path); + } + }; + ScriptInfo.prototype.setFormatOptions = function (formatSettings) { + if (formatSettings) { + if (!this.formatCodeSettings) { + this.formatCodeSettings = server.getDefaultFormatCodeSettings(this.host); } + server.mergeMapLikes(this.formatCodeSettings, formatSettings); + } + }; + ScriptInfo.prototype.setWatcher = function (watcher) { + this.stopWatcher(); + this.fileWatcher = watcher; + }; + ScriptInfo.prototype.stopWatcher = function () { + if (this.fileWatcher) { + this.fileWatcher.close(); + this.fileWatcher = undefined; + } + }; + ScriptInfo.prototype.getLatestVersion = function () { + return this.textStorage.getVersion(); + }; + ScriptInfo.prototype.reload = function (script) { + this.textStorage.reload(script); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.saveTo = function (fileName) { + var snap = this.textStorage.getSnapshot(); + this.host.writeFile(fileName, snap.getText(0, snap.getLength())); + }; + ScriptInfo.prototype.reloadFromFile = function (tempFileName) { + if (this.hasMixedContent) { + this.reload(""); } else { - delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; - this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); + this.textStorage.reloadFromFile(tempFileName); + this.markContainingProjectsAsDirty(); } - this.refreshInferredProjects(); }; - return ProjectService; + ScriptInfo.prototype.getLineInfo = function (line) { + return this.textStorage.getLineInfo(line); + }; + ScriptInfo.prototype.editContent = function (start, end, newText) { + this.textStorage.edit(start, end, newText); + this.markContainingProjectsAsDirty(); + }; + ScriptInfo.prototype.markContainingProjectsAsDirty = function () { + for (var _i = 0, _a = this.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + p.markAsDirty(); + } + }; + ScriptInfo.prototype.lineToTextSpan = function (line) { + return this.textStorage.lineToTextSpan(line); + }; + ScriptInfo.prototype.lineOffsetToPosition = function (line, offset) { + return this.textStorage.lineOffsetToPosition(line, offset); + }; + ScriptInfo.prototype.positionToLineOffset = function (position) { + return this.textStorage.positionToLineOffset(position); + }; + ScriptInfo.prototype.isJavaScript = function () { + return this.scriptKind === 1 || this.scriptKind === 2; + }; + return ScriptInfo; }()); - server.ProjectService = ProjectService; + server.ScriptInfo = ScriptInfo; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var ts; (function (ts) { var server; (function (server) { - function hrTimeToMilliseconds(time) { - var seconds = time[0]; - var nanoseconds = time[1]; - return ((1e9 * seconds) + nanoseconds) / 1000000.0; - } - function shouldSkipSematicCheck(project) { - if (project.getCompilerOptions().skipLibCheck !== undefined) { - return false; - } - if ((project.projectKind === server.ProjectKind.Inferred || project.projectKind === server.ProjectKind.External) && project.isJsOnlyProject()) { - return true; - } - return false; - } - function compareNumber(a, b) { - return a - b; - } - function compareFileStart(a, b) { - if (a.file < b.file) { - return -1; - } - else if (a.file == b.file) { - var n = compareNumber(a.start.line, b.start.line); - if (n === 0) { - return compareNumber(a.start.offset, b.start.offset); + var LSHost = (function () { + function LSHost(host, project, cancellationToken) { + var _this = this; + this.host = host; + this.project = project; + this.cancellationToken = cancellationToken; + this.resolvedModuleNames = ts.createFileMap(); + this.resolvedTypeReferenceDirectives = ts.createFileMap(); + this.cancellationToken = new ts.ThrottledCancellationToken(cancellationToken, project.projectService.throttleWaitMilliseconds); + this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); + if (host.trace) { + this.trace = function (s) { return host.trace(s); }; + } + this.resolveModuleName = function (moduleName, containingFile, compilerOptions, host) { + var globalCache = _this.project.getTypeAcquisition().enable + ? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation + : undefined; + var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host); + if (ts.moduleHasNonRelativeName(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) { + var _a = ts.loadModuleFromGlobalCache(moduleName, _this.project.getProjectName(), compilerOptions, host, globalCache), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; + if (resolvedModule) { + return { resolvedModule: resolvedModule, failedLookupLocations: primaryResult.failedLookupLocations.concat(failedLookupLocations) }; + } + } + return primaryResult; + }; + if (this.host.realpath) { + this.realpath = function (path) { return _this.host.realpath(path); }; } - else - return n; - } - else { - return 1; } - } - function formatDiag(fileName, project, diag) { - var scriptInfo = project.getScriptInfoForNormalizedPath(fileName); - return { - start: scriptInfo.positionToLineOffset(diag.start), - end: scriptInfo.positionToLineOffset(diag.start + diag.length), - text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"), - code: diag.code + LSHost.prototype.startRecordingFilesWithChangedResolutions = function () { + this.filesWithChangedSetOfUnresolvedImports = []; }; - } - function formatConfigFileDiag(diag) { - return { - start: undefined, - end: undefined, - text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") + LSHost.prototype.finishRecordingFilesWithChangedResolutions = function () { + var collected = this.filesWithChangedSetOfUnresolvedImports; + this.filesWithChangedSetOfUnresolvedImports = undefined; + return collected; }; - } - function allEditsBeforePos(edits, pos) { - for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { - var edit = edits_1[_i]; - if (ts.textSpanEnd(edit.span) >= pos) { - return false; + LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult, getResultFileName, logChanges) { + var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); + var currentResolutionsInFile = cache.get(path); + var newResolutions = ts.createMap(); + var resolvedModules = []; + var compilerOptions = this.getCompilationSettings(); + var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; + for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { + var name = names_2[_i]; + var resolution = newResolutions.get(name); + if (!resolution) { + var existingResolution = currentResolutionsInFile && currentResolutionsInFile.get(name); + if (moduleResolutionIsValid(existingResolution)) { + resolution = existingResolution; + } + else { + resolution = loader(name, containingFile, compilerOptions, this); + newResolutions.set(name, resolution); + } + if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { + this.filesWithChangedSetOfUnresolvedImports.push(path); + logChanges = false; + } + } + ts.Debug.assert(resolution !== undefined); + resolvedModules.push(getResult(resolution)); } + cache.set(path, newResolutions); + return resolvedModules; + function resolutionIsEqualTo(oldResolution, newResolution) { + if (oldResolution === newResolution) { + return true; + } + if (!oldResolution || !newResolution) { + return false; + } + var oldResult = getResult(oldResolution); + var newResult = getResult(newResolution); + if (oldResult === newResult) { + return true; + } + if (!oldResult || !newResult) { + return false; + } + return getResultFileName(oldResult) === getResultFileName(newResult); + } + function moduleResolutionIsValid(resolution) { + if (!resolution) { + return false; + } + var result = getResult(resolution); + if (result) { + return getResultFileName(result) !== lastDeletedFileName; + } + return resolution.failedLookupLocations.length === 0; + } + }; + LSHost.prototype.getNewLine = function () { + return this.host.newLine; + }; + LSHost.prototype.getProjectVersion = function () { + return this.project.getProjectVersion(); + }; + LSHost.prototype.getCompilationSettings = function () { + return this.compilationSettings; + }; + LSHost.prototype.useCaseSensitiveFileNames = function () { + return this.host.useCaseSensitiveFileNames; + }; + LSHost.prototype.getCancellationToken = function () { + return this.cancellationToken; + }; + LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; }, function (r) { return r.resolvedFileName; }, false); + }; + LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { + return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, this.resolveModuleName, function (m) { return m.resolvedModule; }, function (r) { return r.resolvedFileName; }, true); + }; + LSHost.prototype.getDefaultLibFileName = function () { + var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); + return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); + }; + LSHost.prototype.getScriptSnapshot = function (filename) { + var scriptInfo = this.project.getScriptInfoLSHost(filename); + if (scriptInfo) { + return scriptInfo.getSnapshot(); + } + }; + LSHost.prototype.getScriptFileNames = function () { + return this.project.getRootFilesLSHost(); + }; + LSHost.prototype.getTypeRootsVersion = function () { + return this.project.typesVersion; + }; + LSHost.prototype.getScriptKind = function (fileName) { + var info = this.project.getScriptInfoLSHost(fileName); + return info && info.scriptKind; + }; + LSHost.prototype.getScriptVersion = function (filename) { + var info = this.project.getScriptInfoLSHost(filename); + return info && info.getLatestVersion(); + }; + LSHost.prototype.getCurrentDirectory = function () { + return this.host.getCurrentDirectory(); + }; + LSHost.prototype.resolvePath = function (path) { + return this.host.resolvePath(path); + }; + LSHost.prototype.fileExists = function (path) { + return this.host.fileExists(path); + }; + LSHost.prototype.readFile = function (fileName) { + return this.host.readFile(fileName); + }; + LSHost.prototype.directoryExists = function (path) { + return this.host.directoryExists(path); + }; + LSHost.prototype.readDirectory = function (path, extensions, exclude, include) { + return this.host.readDirectory(path, extensions, exclude, include); + }; + LSHost.prototype.getDirectories = function (path) { + return this.host.getDirectories(path); + }; + LSHost.prototype.notifyFileRemoved = function (info) { + this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); + }; + LSHost.prototype.setCompilationSettings = function (opt) { + if (ts.changesAffectModuleResolution(this.compilationSettings, opt)) { + this.resolvedModuleNames.clear(); + this.resolvedTypeReferenceDirectives.clear(); + } + this.compilationSettings = opt; + }; + return LSHost; + }()); + server.LSHost = LSHost; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + server.nullTypingsInstaller = { + enqueueInstallTypingsRequest: ts.noop, + attach: ts.noop, + onProjectClosed: ts.noop, + globalTypingsCacheLocation: undefined + }; + var TypingsCacheEntry = (function () { + function TypingsCacheEntry() { } - return true; - } - var CommandNames; - (function (CommandNames) { - CommandNames.Brace = "brace"; - CommandNames.BraceFull = "brace-full"; - CommandNames.BraceCompletion = "braceCompletion"; - CommandNames.Change = "change"; - CommandNames.Close = "close"; - CommandNames.Completions = "completions"; - CommandNames.CompletionsFull = "completions-full"; - CommandNames.CompletionDetails = "completionEntryDetails"; - CommandNames.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; - CommandNames.CompileOnSaveEmitFile = "compileOnSaveEmitFile"; - CommandNames.Configure = "configure"; - CommandNames.Definition = "definition"; - CommandNames.DefinitionFull = "definition-full"; - CommandNames.Exit = "exit"; - CommandNames.Format = "format"; - CommandNames.Formatonkey = "formatonkey"; - CommandNames.FormatFull = "format-full"; - CommandNames.FormatonkeyFull = "formatonkey-full"; - CommandNames.FormatRangeFull = "formatRange-full"; - CommandNames.Geterr = "geterr"; - CommandNames.GeterrForProject = "geterrForProject"; - CommandNames.Implementation = "implementation"; - CommandNames.ImplementationFull = "implementation-full"; - CommandNames.SemanticDiagnosticsSync = "semanticDiagnosticsSync"; - CommandNames.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; - CommandNames.NavBar = "navbar"; - CommandNames.NavBarFull = "navbar-full"; - CommandNames.NavTree = "navtree"; - CommandNames.NavTreeFull = "navtree-full"; - CommandNames.Navto = "navto"; - CommandNames.NavtoFull = "navto-full"; - CommandNames.Occurrences = "occurrences"; - CommandNames.DocumentHighlights = "documentHighlights"; - CommandNames.DocumentHighlightsFull = "documentHighlights-full"; - CommandNames.Open = "open"; - CommandNames.Quickinfo = "quickinfo"; - CommandNames.QuickinfoFull = "quickinfo-full"; - CommandNames.References = "references"; - CommandNames.ReferencesFull = "references-full"; - CommandNames.Reload = "reload"; - CommandNames.Rename = "rename"; - CommandNames.RenameInfoFull = "rename-full"; - CommandNames.RenameLocationsFull = "renameLocations-full"; - CommandNames.Saveto = "saveto"; - CommandNames.SignatureHelp = "signatureHelp"; - CommandNames.SignatureHelpFull = "signatureHelp-full"; - CommandNames.TypeDefinition = "typeDefinition"; - CommandNames.ProjectInfo = "projectInfo"; - CommandNames.ReloadProjects = "reloadProjects"; - CommandNames.Unknown = "unknown"; - CommandNames.OpenExternalProject = "openExternalProject"; - CommandNames.OpenExternalProjects = "openExternalProjects"; - CommandNames.CloseExternalProject = "closeExternalProject"; - CommandNames.SynchronizeProjectList = "synchronizeProjectList"; - CommandNames.ApplyChangedToOpenFiles = "applyChangedToOpenFiles"; - CommandNames.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full"; - CommandNames.Cleanup = "cleanup"; - CommandNames.OutliningSpans = "outliningSpans"; - CommandNames.TodoComments = "todoComments"; - CommandNames.Indentation = "indentation"; - CommandNames.DocCommentTemplate = "docCommentTemplate"; - CommandNames.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full"; - CommandNames.NameOrDottedNameSpan = "nameOrDottedNameSpan"; - CommandNames.BreakpointStatement = "breakpointStatement"; - CommandNames.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; - CommandNames.GetCodeFixes = "getCodeFixes"; - CommandNames.GetCodeFixesFull = "getCodeFixes-full"; - CommandNames.GetSupportedCodeFixes = "getSupportedCodeFixes"; - })(CommandNames = server.CommandNames || (server.CommandNames = {})); - function formatMessage(msg, logger, byteLength, newLine) { - var verboseLogging = logger.hasLevel(server.LogLevel.verbose); - var json = JSON.stringify(msg); - if (verboseLogging) { - logger.info(msg.type + ": " + json); - } - var len = byteLength(json, "utf8"); - return "Content-Length: " + (1 + len) + "\r\n\r\n" + json + newLine; + return TypingsCacheEntry; + }()); + function setIsEqualTo(arr1, arr2) { + if (arr1 === arr2) { + return true; + } + if ((arr1 || server.emptyArray).length === 0 && (arr2 || server.emptyArray).length === 0) { + return true; + } + var set = ts.createMap(); + var unique = 0; + for (var _i = 0, arr1_1 = arr1; _i < arr1_1.length; _i++) { + var v = arr1_1[_i]; + if (set.get(v) !== true) { + set.set(v, true); + unique++; + } + } + for (var _a = 0, arr2_1 = arr2; _a < arr2_1.length; _a++) { + var v = arr2_1[_a]; + var isSet = set.get(v); + if (isSet === undefined) { + return false; + } + if (isSet === true) { + set.set(v, false); + unique--; + } + } + return unique === 0; } - server.formatMessage = formatMessage; - var Session = (function () { - function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents, eventHandler) { + function typeAcquisitionChanged(opt1, opt2) { + return opt1.enable !== opt2.enable || + !setIsEqualTo(opt1.include, opt2.include) || + !setIsEqualTo(opt1.exclude, opt2.exclude); + } + function compilerOptionsChanged(opt1, opt2) { + return opt1.allowJs !== opt2.allowJs; + } + function unresolvedImportsChanged(imports1, imports2) { + if (imports1 === imports2) { + return false; + } + return !ts.arrayIsEqualTo(imports1, imports2); + } + var TypingsCache = (function () { + function TypingsCache(installer) { + this.installer = installer; + this.perProjectCache = ts.createMap(); + } + TypingsCache.prototype.getTypingsForProject = function (project, unresolvedImports, forceRefresh) { + var typeAcquisition = project.getTypeAcquisition(); + if (!typeAcquisition || !typeAcquisition.enable) { + return server.emptyArray; + } + var entry = this.perProjectCache.get(project.getProjectName()); + var result = entry ? entry.typings : server.emptyArray; + if (forceRefresh || + !entry || + typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || + compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || + unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { + this.perProjectCache.set(project.getProjectName(), { + compilerOptions: project.getCompilerOptions(), + typeAcquisition: typeAcquisition, + typings: result, + unresolvedImports: unresolvedImports, + poisoned: true + }); + this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); + } + return result; + }; + TypingsCache.prototype.updateTypingsForProject = function (projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) { + this.perProjectCache.set(projectName, { + compilerOptions: compilerOptions, + typeAcquisition: typeAcquisition, + typings: server.toSortedReadonlyArray(newTypings), + unresolvedImports: unresolvedImports, + poisoned: false + }); + }; + TypingsCache.prototype.deleteTypingsForProject = function (projectName) { + this.perProjectCache.delete(projectName); + }; + TypingsCache.prototype.onProjectClosed = function (project) { + this.perProjectCache.delete(project.getProjectName()); + this.installer.onProjectClosed(project); + }; + return TypingsCache; + }()); + server.TypingsCache = TypingsCache; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + function shouldEmitFile(scriptInfo) { + return !scriptInfo.hasMixedContent; + } + server.shouldEmitFile = shouldEmitFile; + var BuilderFileInfo = (function () { + function BuilderFileInfo(scriptInfo, project) { + this.scriptInfo = scriptInfo; + this.project = project; + } + BuilderFileInfo.prototype.isExternalModuleOrHasOnlyAmbientExternalModules = function () { + var sourceFile = this.getSourceFile(); + return ts.isExternalModule(sourceFile) || this.containsOnlyAmbientModules(sourceFile); + }; + BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (statement.kind !== 232 || statement.name.kind !== 9) { + return false; + } + } + return true; + }; + BuilderFileInfo.prototype.computeHash = function (text) { + return this.project.projectService.host.createHash(text); + }; + BuilderFileInfo.prototype.getSourceFile = function () { + return this.project.getSourceFile(this.scriptInfo.path); + }; + BuilderFileInfo.prototype.updateShapeSignature = function () { + var sourceFile = this.getSourceFile(); + if (!sourceFile) { + return true; + } + var lastSignature = this.lastCheckedShapeSignature; + if (sourceFile.isDeclarationFile) { + this.lastCheckedShapeSignature = this.computeHash(sourceFile.text); + } + else { + var emitOutput = this.project.getFileEmitOutput(this.scriptInfo, true); + if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) { + this.lastCheckedShapeSignature = this.computeHash(emitOutput.outputFiles[0].text); + } + } + return !lastSignature || this.lastCheckedShapeSignature !== lastSignature; + }; + return BuilderFileInfo; + }()); + server.BuilderFileInfo = BuilderFileInfo; + var AbstractBuilder = (function () { + function AbstractBuilder(project, ctor) { + this.project = project; + this.ctor = ctor; + } + AbstractBuilder.prototype.getFileInfos = function () { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap()); + }; + AbstractBuilder.prototype.clear = function () { + this.fileInfos_doNotAccessDirectly = undefined; + }; + AbstractBuilder.prototype.getFileInfo = function (path) { + return this.getFileInfos().get(path); + }; + AbstractBuilder.prototype.getOrCreateFileInfo = function (path) { + var fileInfo = this.getFileInfo(path); + if (!fileInfo) { + var scriptInfo = this.project.getScriptInfo(path); + fileInfo = new this.ctor(scriptInfo, this.project); + this.setFileInfo(path, fileInfo); + } + return fileInfo; + }; + AbstractBuilder.prototype.getFileInfoPaths = function () { + return this.getFileInfos().getKeys(); + }; + AbstractBuilder.prototype.setFileInfo = function (path, info) { + this.getFileInfos().set(path, info); + }; + AbstractBuilder.prototype.removeFileInfo = function (path) { + this.getFileInfos().remove(path); + }; + AbstractBuilder.prototype.forEachFileInfo = function (action) { + this.getFileInfos().forEachValue(function (_path, value) { return action(value); }); + }; + AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { + var fileInfo = this.getFileInfo(scriptInfo.path); + if (!fileInfo) { + return false; + } + var _a = this.project.getFileEmitOutput(fileInfo.scriptInfo, false), emitSkipped = _a.emitSkipped, outputFiles = _a.outputFiles; + if (!emitSkipped) { + var projectRootPath = this.project.getProjectRootPath(); + for (var _i = 0, outputFiles_1 = outputFiles; _i < outputFiles_1.length; _i++) { + var outputFile = outputFiles_1[_i]; + var outputFileAbsoluteFileName = ts.getNormalizedAbsolutePath(outputFile.name, projectRootPath ? projectRootPath : ts.getDirectoryPath(scriptInfo.fileName)); + writeFile(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark); + } + } + return !emitSkipped; + }; + return AbstractBuilder; + }()); + var NonModuleBuilder = (function (_super) { + __extends(NonModuleBuilder, _super); + function NonModuleBuilder(project) { + var _this = _super.call(this, project, BuilderFileInfo) || this; + _this.project = project; + return _this; + } + NonModuleBuilder.prototype.onProjectUpdateGraph = function () { + }; + NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { + var info = this.getOrCreateFileInfo(scriptInfo.path); + var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; + if (info.updateShapeSignature()) { + var options = this.project.getCompilerOptions(); + if (options && (options.out || options.outFile)) { + return singleFileResult; + } + return this.project.getAllEmittableFiles(); + } + return singleFileResult; + }; + return NonModuleBuilder; + }(AbstractBuilder)); + var ModuleBuilderFileInfo = (function (_super) { + __extends(ModuleBuilderFileInfo, _super); + function ModuleBuilderFileInfo() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.references = []; + _this.referencedBy = []; + return _this; + } + ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) { + var l = lf.scriptInfo.fileName; + var r = rf.scriptInfo.fileName; + return (l < r ? -1 : (l > r ? 1 : 0)); + }; + ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) { + if (array.length === 0) { + array.push(fileInfo); + return; + } + var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); + if (insertIndex < 0) { + array.splice(~insertIndex, 0, fileInfo); + } + }; + ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) { + if (!array || array.length === 0) { + return; + } + if (array[0] === fileInfo) { + array.splice(0, 1); + return; + } + var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); + if (removeIndex >= 0) { + array.splice(removeIndex, 1); + } + }; + ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) { + ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo); + }; + ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) { + ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo); + }; + ModuleBuilderFileInfo.prototype.removeFileReferences = function () { + for (var _i = 0, _a = this.references; _i < _a.length; _i++) { + var reference = _a[_i]; + reference.removeReferencedBy(this); + } + this.references = []; + }; + return ModuleBuilderFileInfo; + }(BuilderFileInfo)); + var ModuleBuilder = (function (_super) { + __extends(ModuleBuilder, _super); + function ModuleBuilder(project) { + var _this = _super.call(this, project, ModuleBuilderFileInfo) || this; + _this.project = project; + return _this; + } + ModuleBuilder.prototype.clear = function () { + this.projectVersionForDependencyGraph = undefined; + _super.prototype.clear.call(this); + }; + ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { var _this = this; - this.host = host; - this.typingsInstaller = typingsInstaller; - this.byteLength = byteLength; - this.hrtime = hrtime; - this.logger = logger; - this.canUseEvents = canUseEvents; - this.changeSeq = 0; - this.handlers = ts.createMap((_a = {}, - _a[CommandNames.OpenExternalProject] = function (request) { - _this.projectService.openExternalProject(request.arguments); - return _this.requiredResponse(true); - }, - _a[CommandNames.OpenExternalProjects] = function (request) { - for (var _i = 0, _a = request.arguments.projects; _i < _a.length; _i++) { - var proj = _a[_i]; - _this.projectService.openExternalProject(proj); - } - return _this.requiredResponse(true); - }, - _a[CommandNames.CloseExternalProject] = function (request) { - _this.projectService.closeExternalProject(request.arguments.projectFileName); - return _this.requiredResponse(true); - }, - _a[CommandNames.SynchronizeProjectList] = function (request) { - var result = _this.projectService.synchronizeProjectList(request.arguments.knownProjects); - if (!result.some(function (p) { return p.projectErrors && p.projectErrors.length !== 0; })) { - return _this.requiredResponse(result); + if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { + return []; + } + var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path); + if (referencedFilePaths.length > 0) { + return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos); + } + return []; + }; + ModuleBuilder.prototype.onProjectUpdateGraph = function () { + this.ensureProjectDependencyGraphUpToDate(); + }; + ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () { + var _this = this; + if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) { + var currentScriptInfos = this.project.getScriptInfos(); + for (var _i = 0, currentScriptInfos_1 = currentScriptInfos; _i < currentScriptInfos_1.length; _i++) { + var scriptInfo = currentScriptInfos_1[_i]; + var fileInfo = this.getOrCreateFileInfo(scriptInfo.path); + this.updateFileReferences(fileInfo); + } + this.forEachFileInfo(function (fileInfo) { + if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) { + fileInfo.removeFileReferences(); + _this.removeFileInfo(fileInfo.scriptInfo.path); } - var converted = ts.map(result, function (p) { - if (!p.projectErrors || p.projectErrors.length === 0) { - return p; + }); + this.projectVersionForDependencyGraph = this.project.getProjectVersion(); + } + }; + ModuleBuilder.prototype.updateFileReferences = function (fileInfo) { + if (fileInfo.scriptVersionForReferences === fileInfo.scriptInfo.getLatestVersion()) { + return; + } + var newReferences = this.getReferencedFileInfos(fileInfo); + var oldReferences = fileInfo.references; + var oldIndex = 0; + var newIndex = 0; + while (oldIndex < oldReferences.length && newIndex < newReferences.length) { + var oldReference = oldReferences[oldIndex]; + var newReference = newReferences[newIndex]; + var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference); + if (compare < 0) { + oldReference.removeReferencedBy(fileInfo); + oldIndex++; + } + else if (compare > 0) { + newReference.addReferencedBy(fileInfo); + newIndex++; + } + else { + oldIndex++; + newIndex++; + } + } + for (var i = oldIndex; i < oldReferences.length; i++) { + oldReferences[i].removeReferencedBy(fileInfo); + } + for (var i = newIndex; i < newReferences.length; i++) { + newReferences[i].addReferencedBy(fileInfo); + } + fileInfo.references = newReferences; + fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion(); + }; + ModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { + this.ensureProjectDependencyGraphUpToDate(); + var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; + var fileInfo = this.getFileInfo(scriptInfo.path); + if (!fileInfo || !fileInfo.updateShapeSignature()) { + return singleFileResult; + } + if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { + return this.project.getAllEmittableFiles(); + } + var options = this.project.getCompilerOptions(); + if (options && (options.isolatedModules || options.out || options.outFile)) { + return singleFileResult; + } + var queue = fileInfo.referencedBy.slice(0); + var fileNameSet = ts.createMap(); + fileNameSet.set(scriptInfo.fileName, scriptInfo); + while (queue.length > 0) { + var processingFileInfo = queue.pop(); + if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { + for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) { + var potentialFileInfo = _a[_i]; + if (!fileNameSet.has(potentialFileInfo.scriptInfo.fileName)) { + queue.push(potentialFileInfo); } - return { - info: p.info, - changes: p.changes, - files: p.files, - projectErrors: _this.convertToDiagnosticsWithLinePosition(p.projectErrors, undefined) - }; - }); - return _this.requiredResponse(converted); - }, - _a[CommandNames.ApplyChangedToOpenFiles] = function (request) { - _this.projectService.applyChangesInOpenFiles(request.arguments.openFiles, request.arguments.changedFiles, request.arguments.closedFiles); - _this.changeSeq++; - return _this.requiredResponse(true); - }, - _a[CommandNames.Exit] = function () { - _this.exit(); - return _this.notRequired(); - }, - _a[CommandNames.Definition] = function (request) { - return _this.requiredResponse(_this.getDefinition(request.arguments, true)); - }, - _a[CommandNames.DefinitionFull] = function (request) { - return _this.requiredResponse(_this.getDefinition(request.arguments, false)); - }, - _a[CommandNames.TypeDefinition] = function (request) { - return _this.requiredResponse(_this.getTypeDefinition(request.arguments)); - }, - _a[CommandNames.Implementation] = function (request) { - return _this.requiredResponse(_this.getImplementation(request.arguments, true)); - }, - _a[CommandNames.ImplementationFull] = function (request) { - return _this.requiredResponse(_this.getImplementation(request.arguments, false)); - }, - _a[CommandNames.References] = function (request) { - return _this.requiredResponse(_this.getReferences(request.arguments, true)); - }, - _a[CommandNames.ReferencesFull] = function (request) { - return _this.requiredResponse(_this.getReferences(request.arguments, false)); - }, - _a[CommandNames.Rename] = function (request) { - return _this.requiredResponse(_this.getRenameLocations(request.arguments, true)); - }, - _a[CommandNames.RenameLocationsFull] = function (request) { - return _this.requiredResponse(_this.getRenameLocations(request.arguments, false)); - }, - _a[CommandNames.RenameInfoFull] = function (request) { - return _this.requiredResponse(_this.getRenameInfo(request.arguments)); - }, - _a[CommandNames.Open] = function (request) { - _this.openClientFile(server.toNormalizedPath(request.arguments.file), request.arguments.fileContent, server.convertScriptKindName(request.arguments.scriptKindName)); - return _this.notRequired(); - }, - _a[CommandNames.Quickinfo] = function (request) { - return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, true)); - }, - _a[CommandNames.QuickinfoFull] = function (request) { - return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, false)); - }, - _a[CommandNames.OutliningSpans] = function (request) { - return _this.requiredResponse(_this.getOutliningSpans(request.arguments)); - }, - _a[CommandNames.TodoComments] = function (request) { - return _this.requiredResponse(_this.getTodoComments(request.arguments)); - }, - _a[CommandNames.Indentation] = function (request) { - return _this.requiredResponse(_this.getIndentation(request.arguments)); - }, - _a[CommandNames.NameOrDottedNameSpan] = function (request) { - return _this.requiredResponse(_this.getNameOrDottedNameSpan(request.arguments)); - }, - _a[CommandNames.BreakpointStatement] = function (request) { - return _this.requiredResponse(_this.getBreakpointStatement(request.arguments)); - }, - _a[CommandNames.BraceCompletion] = function (request) { - return _this.requiredResponse(_this.isValidBraceCompletion(request.arguments)); - }, - _a[CommandNames.DocCommentTemplate] = function (request) { - return _this.requiredResponse(_this.getDocCommentTemplate(request.arguments)); - }, - _a[CommandNames.Format] = function (request) { - return _this.requiredResponse(_this.getFormattingEditsForRange(request.arguments)); - }, - _a[CommandNames.Formatonkey] = function (request) { - return _this.requiredResponse(_this.getFormattingEditsAfterKeystroke(request.arguments)); - }, - _a[CommandNames.FormatFull] = function (request) { - return _this.requiredResponse(_this.getFormattingEditsForDocumentFull(request.arguments)); - }, - _a[CommandNames.FormatonkeyFull] = function (request) { - return _this.requiredResponse(_this.getFormattingEditsAfterKeystrokeFull(request.arguments)); - }, - _a[CommandNames.FormatRangeFull] = function (request) { - return _this.requiredResponse(_this.getFormattingEditsForRangeFull(request.arguments)); - }, - _a[CommandNames.Completions] = function (request) { - return _this.requiredResponse(_this.getCompletions(request.arguments, true)); - }, - _a[CommandNames.CompletionsFull] = function (request) { - return _this.requiredResponse(_this.getCompletions(request.arguments, false)); - }, - _a[CommandNames.CompletionDetails] = function (request) { - return _this.requiredResponse(_this.getCompletionEntryDetails(request.arguments)); - }, - _a[CommandNames.CompileOnSaveAffectedFileList] = function (request) { - return _this.requiredResponse(_this.getCompileOnSaveAffectedFileList(request.arguments)); - }, - _a[CommandNames.CompileOnSaveEmitFile] = function (request) { - return _this.requiredResponse(_this.emitFile(request.arguments)); - }, - _a[CommandNames.SignatureHelp] = function (request) { - return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, true)); - }, - _a[CommandNames.SignatureHelpFull] = function (request) { - return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, false)); - }, - _a[CommandNames.CompilerOptionsDiagnosticsFull] = function (request) { - return _this.requiredResponse(_this.getCompilerOptionsDiagnostics(request.arguments)); - }, - _a[CommandNames.EncodedSemanticClassificationsFull] = function (request) { - return _this.requiredResponse(_this.getEncodedSemanticClassifications(request.arguments)); - }, - _a[CommandNames.Cleanup] = function () { - _this.cleanup(); - return _this.requiredResponse(true); - }, - _a[CommandNames.SemanticDiagnosticsSync] = function (request) { - return _this.requiredResponse(_this.getSemanticDiagnosticsSync(request.arguments)); - }, - _a[CommandNames.SyntacticDiagnosticsSync] = function (request) { - return _this.requiredResponse(_this.getSyntacticDiagnosticsSync(request.arguments)); - }, - _a[CommandNames.Geterr] = function (request) { - var geterrArgs = request.arguments; - return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false }; - }, - _a[CommandNames.GeterrForProject] = function (request) { - var _a = request.arguments, file = _a.file, delay = _a.delay; - return { response: _this.getDiagnosticsForProject(delay, file), responseRequired: false }; - }, - _a[CommandNames.Change] = function (request) { - _this.change(request.arguments); - return _this.notRequired(); - }, - _a[CommandNames.Configure] = function (request) { - _this.projectService.setHostConfiguration(request.arguments); - _this.output(undefined, CommandNames.Configure, request.seq); - return _this.notRequired(); - }, - _a[CommandNames.Reload] = function (request) { - _this.reload(request.arguments, request.seq); - return _this.requiredResponse({ reloadFinished: true }); - }, - _a[CommandNames.Saveto] = function (request) { - var savetoArgs = request.arguments; - _this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); - return _this.notRequired(); - }, - _a[CommandNames.Close] = function (request) { - var closeArgs = request.arguments; - _this.closeClientFile(closeArgs.file); - return _this.notRequired(); - }, - _a[CommandNames.Navto] = function (request) { - return _this.requiredResponse(_this.getNavigateToItems(request.arguments, true)); - }, - _a[CommandNames.NavtoFull] = function (request) { - return _this.requiredResponse(_this.getNavigateToItems(request.arguments, false)); - }, - _a[CommandNames.Brace] = function (request) { - return _this.requiredResponse(_this.getBraceMatching(request.arguments, true)); - }, - _a[CommandNames.BraceFull] = function (request) { - return _this.requiredResponse(_this.getBraceMatching(request.arguments, false)); - }, - _a[CommandNames.NavBar] = function (request) { - return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, true)); - }, - _a[CommandNames.NavBarFull] = function (request) { - return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false)); - }, - _a[CommandNames.NavTree] = function (request) { - return _this.requiredResponse(_this.getNavigationTree(request.arguments, true)); - }, - _a[CommandNames.NavTreeFull] = function (request) { - return _this.requiredResponse(_this.getNavigationTree(request.arguments, false)); - }, - _a[CommandNames.Occurrences] = function (request) { - return _this.requiredResponse(_this.getOccurrences(request.arguments)); - }, - _a[CommandNames.DocumentHighlights] = function (request) { - return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, true)); - }, - _a[CommandNames.DocumentHighlightsFull] = function (request) { - return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false)); - }, - _a[CommandNames.CompilerOptionsForInferredProjects] = function (request) { - _this.setCompilerOptionsForInferredProjects(request.arguments); - return _this.requiredResponse(true); - }, - _a[CommandNames.ProjectInfo] = function (request) { - return _this.requiredResponse(_this.getProjectInfo(request.arguments)); - }, - _a[CommandNames.ReloadProjects] = function () { - _this.projectService.reloadProjects(); - return _this.notRequired(); - }, - _a[CommandNames.GetCodeFixes] = function (request) { - return _this.requiredResponse(_this.getCodeFixes(request.arguments, true)); - }, - _a[CommandNames.GetCodeFixesFull] = function (request) { - return _this.requiredResponse(_this.getCodeFixes(request.arguments, false)); - }, - _a[CommandNames.GetSupportedCodeFixes] = function () { - return _this.requiredResponse(_this.getSupportedCodeFixes()); - }, - _a)); - this.eventHander = canUseEvents - ? eventHandler || (function (event) { return _this.defaultEventHandler(event); }) - : undefined; - this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, this.eventHander); - this.gcTimer = new server.GcTimer(host, 7000, logger); - var _a; + } + } + fileNameSet.set(processingFileInfo.scriptInfo.fileName, processingFileInfo.scriptInfo); + } + var result = []; + fileNameSet.forEach(function (scriptInfo, fileName) { + if (shouldEmitFile(scriptInfo)) { + result.push(fileName); + } + }); + return result; + }; + return ModuleBuilder; + }(AbstractBuilder)); + function createBuilder(project) { + var moduleKind = project.getCompilerOptions().module; + switch (moduleKind) { + case ts.ModuleKind.None: + return new NonModuleBuilder(project); + default: + return new ModuleBuilder(project); } - Session.prototype.defaultEventHandler = function (event) { - var _this = this; - switch (event.eventName) { - case server.ContextEvent: - var _a = event.data, project = _a.project, fileName = _a.fileName; - this.projectService.logger.info("got context event, updating diagnostics for " + fileName); - this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); + } + server.createBuilder = createBuilder; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var ProjectKind; + (function (ProjectKind) { + ProjectKind[ProjectKind["Inferred"] = 0] = "Inferred"; + ProjectKind[ProjectKind["Configured"] = 1] = "Configured"; + ProjectKind[ProjectKind["External"] = 2] = "External"; + })(ProjectKind = server.ProjectKind || (server.ProjectKind = {})); + function remove(items, item) { + var index = items.indexOf(item); + if (index >= 0) { + items.splice(index, 1); + } + } + function countEachFileTypes(infos) { + var result = { js: 0, jsx: 0, ts: 0, tsx: 0, dts: 0 }; + for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) { + var info = infos_1[_i]; + switch (info.scriptKind) { + case 1: + result.js += 1; break; - case server.ConfigFileDiagEvent: - var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics; - this.configFileDiagnosticEvent(triggerFile, configFileName, diagnostics); + case 2: + result.jsx += 1; break; - case server.ProjectLanguageServiceStateEvent: - var eventName = "projectLanguageServiceState"; - this.event({ - projectName: event.data.project.getProjectName(), - languageServiceEnabled: event.data.languageServiceEnabled - }, eventName); + case 3: + ts.fileExtensionIs(info.fileName, ".d.ts") + ? result.dts += 1 + : result.ts += 1; + break; + case 4: + result.tsx += 1; break; } + } + return result; + } + function hasOneOrMoreJsAndNoTsFiles(project) { + var counts = countEachFileTypes(project.getScriptInfos()); + return counts.js > 0 && counts.ts === 0 && counts.tsx === 0; + } + function allRootFilesAreJsOrDts(project) { + var counts = countEachFileTypes(project.getRootScriptInfos()); + return counts.ts === 0 && counts.tsx === 0; + } + server.allRootFilesAreJsOrDts = allRootFilesAreJsOrDts; + function allFilesAreJsOrDts(project) { + var counts = countEachFileTypes(project.getScriptInfos()); + return counts.ts === 0 && counts.tsx === 0; + } + server.allFilesAreJsOrDts = allFilesAreJsOrDts; + var UnresolvedImportsMap = (function () { + function UnresolvedImportsMap() { + this.perFileMap = ts.createFileMap(); + this.version = 0; + } + UnresolvedImportsMap.prototype.clear = function () { + this.perFileMap.clear(); + this.version = 0; }; - Session.prototype.logError = function (err, cmd) { - var msg = "Exception on executing command " + cmd; - if (err.message) { - msg += ":\n" + err.message; - if (err.stack) { - msg += "\n" + err.stack; - } + UnresolvedImportsMap.prototype.getVersion = function () { + return this.version; + }; + UnresolvedImportsMap.prototype.remove = function (path) { + this.perFileMap.remove(path); + this.version++; + }; + UnresolvedImportsMap.prototype.get = function (path) { + return this.perFileMap.get(path); + }; + UnresolvedImportsMap.prototype.set = function (path, value) { + this.perFileMap.set(path, value); + this.version++; + }; + return UnresolvedImportsMap; + }()); + server.UnresolvedImportsMap = UnresolvedImportsMap; + var Project = (function () { + function Project(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) { + this.projectName = projectName; + this.projectKind = projectKind; + this.projectService = projectService; + this.documentRegistry = documentRegistry; + this.compilerOptions = compilerOptions; + this.compileOnSaveEnabled = compileOnSaveEnabled; + this.rootFiles = []; + this.rootFilesMap = ts.createFileMap(); + this.cachedUnresolvedImportsPerFile = new UnresolvedImportsMap(); + this.languageServiceEnabled = true; + this.lastReportedVersion = 0; + this.projectStructureVersion = 0; + this.projectStateVersion = 0; + this.typesVersion = 0; + if (!this.compilerOptions) { + this.compilerOptions = ts.getDefaultCompilerOptions(); + this.compilerOptions.allowNonTsExtensions = true; + this.compilerOptions.allowJs = true; } - this.logger.msg(msg, server.Msg.Err); + else if (hasExplicitListOfFiles || this.compilerOptions.allowJs) { + this.compilerOptions.allowNonTsExtensions = true; + } + this.setInternalCompilerOptionsForEmittingJsFiles(); + this.lsHost = new server.LSHost(this.projectService.host, this, this.projectService.cancellationToken); + this.lsHost.setCompilationSettings(this.compilerOptions); + this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); + if (!languageServiceEnabled) { + this.disableLanguageService(); + } + this.builder = server.createBuilder(this); + this.markAsDirty(); + } + Project.prototype.isNonTsProject = function () { + this.updateGraph(); + return allFilesAreJsOrDts(this); }; - Session.prototype.send = function (msg) { - if (msg.type === "event" && !this.canUseEvents) { - if (this.logger.hasLevel(server.LogLevel.verbose)) { - this.logger.info("Session does not support events: ignored event: " + JSON.stringify(msg)); - } - return; + Project.prototype.isJsOnlyProject = function () { + this.updateGraph(); + return hasOneOrMoreJsAndNoTsFiles(this); + }; + Project.prototype.getCachedUnresolvedImportsPerFile_TestOnly = function () { + return this.cachedUnresolvedImportsPerFile; + }; + Project.resolveModule = function (moduleName, initialDir, host, log) { + var resolvedPath = ts.normalizeSlashes(host.resolvePath(ts.combinePaths(initialDir, "node_modules"))); + log("Loading " + moduleName + " from " + initialDir + " (resolved to " + resolvedPath + ")"); + var result = host.require(resolvedPath, moduleName); + if (result.error) { + log("Failed to load module: " + JSON.stringify(result.error)); + return undefined; } - this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine)); + return result.module; }; - Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) { - var bakedDiags = ts.map(diagnostics, formatConfigFileDiag); - var ev = { - seq: 0, - type: "event", - event: "configFileDiag", - body: { - triggerFile: triggerFile, - configFile: configFile, - diagnostics: bakedDiags - } - }; - this.send(ev); + Project.prototype.setInternalCompilerOptionsForEmittingJsFiles = function () { + if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { + this.compilerOptions.noEmitForJsFiles = true; + } }; - Session.prototype.event = function (info, eventName) { - var ev = { - seq: 0, - type: "event", - event: eventName, - body: info, - }; - this.send(ev); + Project.prototype.getProjectErrors = function () { + return this.projectErrors; }; - Session.prototype.output = function (info, cmdName, reqSeq, errorMsg) { - if (reqSeq === void 0) { reqSeq = 0; } - var res = { - seq: 0, - type: "response", - command: cmdName, - request_seq: reqSeq, - success: !errorMsg, - }; - if (!errorMsg) { - res.body = info; + Project.prototype.getLanguageService = function (ensureSynchronized) { + if (ensureSynchronized === void 0) { ensureSynchronized = true; } + if (ensureSynchronized) { + this.updateGraph(); } - else { - res.message = errorMsg; + return this.languageService; + }; + Project.prototype.getCompileOnSaveAffectedFileList = function (scriptInfo) { + if (!this.languageServiceEnabled) { + return []; } - this.send(res); + this.updateGraph(); + return this.builder.getFilesAffectedBy(scriptInfo); }; - Session.prototype.semanticCheck = function (file, project) { - try { - var diags = []; - if (!shouldSkipSematicCheck(project)) { - diags = project.getLanguageService().getSemanticDiagnostics(file); - } - var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); - this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + Project.prototype.getProjectVersion = function () { + return this.projectStateVersion.toString(); + }; + Project.prototype.enableLanguageService = function () { + if (this.languageServiceEnabled) { + return; } - catch (err) { - this.logError(err, "semantic check"); + this.languageServiceEnabled = true; + this.projectService.onUpdateLanguageServiceStateForProject(this, true); + }; + Project.prototype.disableLanguageService = function () { + if (!this.languageServiceEnabled) { + return; } + this.languageService.cleanupSemanticCache(); + this.languageServiceEnabled = false; + this.projectService.onUpdateLanguageServiceStateForProject(this, false); }; - Session.prototype.syntacticCheck = function (file, project) { - try { - var diags = project.getLanguageService().getSyntacticDiagnostics(file); - if (diags) { - var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); - this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + Project.prototype.getProjectName = function () { + return this.projectName; + }; + Project.prototype.getExternalFiles = function () { + return []; + }; + Project.prototype.getSourceFile = function (path) { + if (!this.program) { + return undefined; + } + return this.program.getSourceFileByPath(path); + }; + Project.prototype.updateTypes = function () { + this.typesVersion++; + this.markAsDirty(); + this.updateGraph(); + }; + Project.prototype.close = function () { + if (this.program) { + for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) { + var f = _a[_i]; + var info = this.projectService.getScriptInfo(f.fileName); + info.detachFromProject(this); } } - catch (err) { - this.logError(err, "syntactic check"); + if (!this.program || !this.languageServiceEnabled) { + for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) { + var root = _c[_b]; + root.detachFromProject(this); + } } + this.rootFiles = undefined; + this.rootFilesMap = undefined; + this.program = undefined; + this.languageService.dispose(); }; - Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) { - var _this = this; - if (ms === void 0) { ms = 1500; } - this.host.setTimeout(function () { - if (matchSeq(seq)) { - _this.projectService.refreshInferredProjects(); + Project.prototype.getCompilerOptions = function () { + return this.compilerOptions; + }; + Project.prototype.hasRoots = function () { + return this.rootFiles && this.rootFiles.length > 0; + }; + Project.prototype.getRootFiles = function () { + return this.rootFiles && this.rootFiles.map(function (info) { return info.fileName; }); + }; + Project.prototype.getRootFilesLSHost = function () { + var result = []; + if (this.rootFiles) { + for (var _i = 0, _a = this.rootFiles; _i < _a.length; _i++) { + var f = _a[_i]; + if (this.languageServiceEnabled || f.isScriptOpen()) { + result.push(f.fileName); + } } - }, ms); + if (this.typingFiles) { + for (var _b = 0, _c = this.typingFiles; _b < _c.length; _b++) { + var f = _c[_b]; + result.push(f); + } + } + } + return result; + }; + Project.prototype.getRootScriptInfos = function () { + return this.rootFiles; }; - Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs, requireOpen) { + Project.prototype.getScriptInfos = function () { var _this = this; - if (ms === void 0) { ms = 1500; } - if (followMs === void 0) { followMs = 200; } - if (requireOpen === void 0) { requireOpen = true; } - if (followMs > ms) { - followMs = ms; + if (!this.languageServiceEnabled) { + return this.rootFiles; } - if (this.errorTimer) { - this.host.clearTimeout(this.errorTimer); + return ts.map(this.program.getSourceFiles(), function (sourceFile) { + var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path); + if (!scriptInfo) { + ts.Debug.assert(false, "scriptInfo for a file '" + sourceFile.fileName + "' is missing."); + } + return scriptInfo; + }); + }; + Project.prototype.getFileEmitOutput = function (info, emitOnlyDtsFiles) { + if (!this.languageServiceEnabled) { + return undefined; } - if (this.immediateId) { - this.host.clearImmediate(this.immediateId); - this.immediateId = undefined; + return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles); + }; + Project.prototype.getFileNames = function (excludeFilesFromExternalLibraries) { + if (!this.program) { + return []; } - var index = 0; - var checkOne = function () { - if (matchSeq(seq)) { - var checkSpec_1 = checkList[index]; - index++; - if (checkSpec_1.project.containsFile(checkSpec_1.fileName, requireOpen)) { - _this.syntacticCheck(checkSpec_1.fileName, checkSpec_1.project); - _this.immediateId = _this.host.setImmediate(function () { - _this.semanticCheck(checkSpec_1.fileName, checkSpec_1.project); - _this.immediateId = undefined; - if (checkList.length > index) { - _this.errorTimer = _this.host.setTimeout(checkOne, followMs); - } - else { - _this.errorTimer = undefined; - } - }); + if (!this.languageServiceEnabled) { + var rootFiles = this.getRootFiles(); + if (this.compilerOptions) { + var defaultLibrary = ts.getDefaultLibFilePath(this.compilerOptions); + if (defaultLibrary) { + (rootFiles || (rootFiles = [])).push(server.asNormalizedPath(defaultLibrary)); } } - }; - if ((checkList.length > index) && (matchSeq(seq))) { - this.errorTimer = this.host.setTimeout(checkOne, ms); + return rootFiles; + } + var result = []; + for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) { + var f = _a[_i]; + if (excludeFilesFromExternalLibraries && this.program.isSourceFileFromExternalLibrary(f)) { + continue; + } + result.push(server.asNormalizedPath(f.fileName)); } + return result; }; - Session.prototype.cleanProjects = function (caption, projects) { - if (!projects) { - return; + Project.prototype.getAllEmittableFiles = function () { + if (!this.languageServiceEnabled) { + return []; } - this.logger.info("cleaning " + caption); - for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { - var p = projects_4[_i]; - p.getLanguageService(false).cleanupSemanticCache(); + var defaultLibraryFileName = ts.getDefaultLibFileName(this.compilerOptions); + var infos = this.getScriptInfos(); + var result = []; + for (var _i = 0, infos_2 = infos; _i < infos_2.length; _i++) { + var info = infos_2[_i]; + if (ts.getBaseFileName(info.fileName) !== defaultLibraryFileName && server.shouldEmitFile(info)) { + result.push(info.fileName); + } } + return result; }; - Session.prototype.cleanup = function () { - this.cleanProjects("inferred projects", this.projectService.inferredProjects); - this.cleanProjects("configured projects", this.projectService.configuredProjects); - this.cleanProjects("external projects", this.projectService.externalProjects); - if (this.host.gc) { - this.logger.info("host.gc()"); - this.host.gc(); + Project.prototype.containsScriptInfo = function (info) { + return this.isRoot(info) || (this.program && this.program.getSourceFileByPath(info.path) !== undefined); + }; + Project.prototype.containsFile = function (filename, requireOpen) { + var info = this.projectService.getScriptInfoForNormalizedPath(filename); + if (info && (info.isScriptOpen() || !requireOpen)) { + return this.containsScriptInfo(info); } }; - Session.prototype.getEncodedSemanticClassifications = function (args) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - return project.getLanguageService().getEncodedSemanticClassifications(file, args); + Project.prototype.isRoot = function (info) { + return this.rootFilesMap && this.rootFilesMap.contains(info.path); }; - Session.prototype.getProject = function (projectFileName) { - return projectFileName && this.projectService.findProject(projectFileName); + Project.prototype.addRoot = function (info) { + if (!this.isRoot(info)) { + this.rootFiles.push(info); + this.rootFilesMap.set(info.path, info); + info.attachToProject(this); + this.markAsDirty(); + } }; - Session.prototype.getCompilerOptionsDiagnostics = function (args) { - var project = this.getProject(args.projectFileName); - return this.convertToDiagnosticsWithLinePosition(project.getLanguageService().getCompilerOptionsDiagnostics(), undefined); + Project.prototype.removeFile = function (info, detachFromProject) { + if (detachFromProject === void 0) { detachFromProject = true; } + if (this.isRoot(info)) { + this.removeRoot(info); + } + this.lsHost.notifyFileRemoved(info); + this.cachedUnresolvedImportsPerFile.remove(info.path); + if (detachFromProject) { + info.detachFromProject(this); + } + this.markAsDirty(); }; - Session.prototype.convertToDiagnosticsWithLinePosition = function (diagnostics, scriptInfo) { - var _this = this; - return diagnostics.map(function (d) { return ({ - message: ts.flattenDiagnosticMessageText(d.messageText, _this.host.newLine), - start: d.start, - length: d.length, - category: ts.DiagnosticCategory[d.category].toLowerCase(), - code: d.code, - startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start), - endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length) - }); }); + Project.prototype.registerFileUpdate = function (fileName) { + (this.updatedFileNames || (this.updatedFileNames = ts.createMap())).set(fileName, fileName); }; - Session.prototype.getDiagnosticsWorker = function (args, isSemantic, selector, includeLinePosition) { - var _a = this.getFileAndProject(args), project = _a.project, file = _a.file; - if (isSemantic && shouldSkipSematicCheck(project)) { - return []; - } - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var diagnostics = selector(project, file); - return includeLinePosition - ? this.convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo) - : diagnostics.map(function (d) { return formatDiag(file, project, d); }); + Project.prototype.markAsDirty = function () { + this.projectStateVersion++; }; - Session.prototype.getDefinition = function (args, simplifiedResult) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var definitions = project.getLanguageService().getDefinitionAtPosition(file, position); - if (!definitions) { - return undefined; + Project.prototype.extractUnresolvedImportsFromSourceFile = function (file, result) { + var cached = this.cachedUnresolvedImportsPerFile.get(file.path); + if (cached) { + for (var _i = 0, cached_2 = cached; _i < cached_2.length; _i++) { + var f = cached_2[_i]; + result.push(f); + } + return; } - if (simplifiedResult) { - return definitions.map(function (def) { - var defScriptInfo = project.getScriptInfo(def.fileName); - return { - file: def.fileName, - start: defScriptInfo.positionToLineOffset(def.textSpan.start), - end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan)) - }; + var unresolvedImports; + if (file.resolvedModules) { + file.resolvedModules.forEach(function (resolvedModule, name) { + if (!resolvedModule && !ts.isExternalModuleNameRelative(name)) { + var trimmed = name.trim(); + var i = trimmed.indexOf("/"); + if (i !== -1 && trimmed.charCodeAt(0) === 64) { + i = trimmed.indexOf("/", i + 1); + } + if (i !== -1) { + trimmed = trimmed.substr(0, i); + } + (unresolvedImports || (unresolvedImports = [])).push(trimmed); + result.push(trimmed); + } }); } - else { - return definitions; - } + this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || server.emptyArray); }; - Session.prototype.getTypeDefinition = function (args) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var definitions = project.getLanguageService().getTypeDefinitionAtPosition(file, position); - if (!definitions) { - return undefined; + Project.prototype.updateGraph = function () { + this.lsHost.startRecordingFilesWithChangedResolutions(); + var hasChanges = this.updateGraphWorker(); + var changedFiles = this.lsHost.finishRecordingFilesWithChangedResolutions() || server.emptyArray; + for (var _i = 0, changedFiles_1 = changedFiles; _i < changedFiles_1.length; _i++) { + var file = changedFiles_1[_i]; + this.cachedUnresolvedImportsPerFile.remove(file); } - return definitions.map(function (def) { - var defScriptInfo = project.getScriptInfo(def.fileName); - return { - file: def.fileName, - start: defScriptInfo.positionToLineOffset(def.textSpan.start), - end: defScriptInfo.positionToLineOffset(ts.textSpanEnd(def.textSpan)) - }; - }); - }; - Session.prototype.getImplementation = function (args, simplifiedResult) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var implementations = project.getLanguageService().getImplementationAtPosition(file, position); - if (!implementations) { - return []; + var unresolvedImports; + if (hasChanges || changedFiles.length) { + var result = []; + for (var _a = 0, _b = this.program.getSourceFiles(); _a < _b.length; _a++) { + var sourceFile = _b[_a]; + this.extractUnresolvedImportsFromSourceFile(sourceFile, result); + } + this.lastCachedUnresolvedImportsList = server.toSortedReadonlyArray(result); } - if (simplifiedResult) { - return implementations.map(function (impl) { return ({ - file: impl.fileName, - start: scriptInfo.positionToLineOffset(impl.textSpan.start), - end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan)) - }); }); + unresolvedImports = this.lastCachedUnresolvedImportsList; + var cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, unresolvedImports, hasChanges); + if (this.setTypings(cachedTypings)) { + hasChanges = this.updateGraphWorker() || hasChanges; + } + if (this.languageServiceEnabled) { + this.builder.onProjectUpdateGraph(); } else { - return implementations; + this.builder.clear(); } - }; - Session.prototype.getOccurrences = function (args) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position); - if (!occurrences) { - return undefined; + if (hasChanges) { + this.projectStructureVersion++; } - return occurrences.map(function (occurrence) { - var fileName = occurrence.fileName, isWriteAccess = occurrence.isWriteAccess, textSpan = occurrence.textSpan; - var scriptInfo = project.getScriptInfo(fileName); - var start = scriptInfo.positionToLineOffset(textSpan.start); - var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)); - return { - start: start, - end: end, - file: fileName, - isWriteAccess: isWriteAccess, - }; - }); - }; - Session.prototype.getSyntacticDiagnosticsSync = function (args) { - return this.getDiagnosticsWorker(args, false, function (project, file) { return project.getLanguageService().getSyntacticDiagnostics(file); }, args.includeLinePosition); - }; - Session.prototype.getSemanticDiagnosticsSync = function (args) { - return this.getDiagnosticsWorker(args, true, function (project, file) { return project.getLanguageService().getSemanticDiagnostics(file); }, args.includeLinePosition); + return !hasChanges; }; - Session.prototype.getDocumentHighlights = function (args, simplifiedResult) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var documentHighlights = project.getLanguageService().getDocumentHighlights(file, position, args.filesToSearch); - if (!documentHighlights) { - return undefined; - } - if (simplifiedResult) { - return documentHighlights.map(convertToDocumentHighlightsItem); - } - else { - return documentHighlights; + Project.prototype.setTypings = function (typings) { + if (ts.arrayIsEqualTo(this.typingFiles, typings)) { + return false; } - function convertToDocumentHighlightsItem(documentHighlights) { - var fileName = documentHighlights.fileName, highlightSpans = documentHighlights.highlightSpans; - var scriptInfo = project.getScriptInfo(fileName); - return { - file: fileName, - highlightSpans: highlightSpans.map(convertHighlightSpan) - }; - function convertHighlightSpan(highlightSpan) { - var textSpan = highlightSpan.textSpan, kind = highlightSpan.kind; - var start = scriptInfo.positionToLineOffset(textSpan.start); - var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan)); - return { start: start, end: end, kind: kind }; + this.typingFiles = typings; + this.markAsDirty(); + return true; + }; + Project.prototype.updateGraphWorker = function () { + var oldProgram = this.program; + this.program = this.languageService.getProgram(); + var hasChanges = false; + if (!oldProgram || (this.program !== oldProgram && !oldProgram.structureIsReused)) { + hasChanges = true; + if (oldProgram) { + for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { + var f = _a[_i]; + if (this.program.getSourceFileByPath(f.path)) { + continue; + } + var scriptInfoToDetach = this.projectService.getScriptInfo(f.fileName); + if (scriptInfoToDetach) { + scriptInfoToDetach.detachFromProject(this); + } + } } } + return hasChanges; }; - Session.prototype.setCompilerOptionsForInferredProjects = function (args) { - this.projectService.setCompilerOptionsForInferredProjects(args.options); + Project.prototype.getScriptInfoLSHost = function (fileName) { + var scriptInfo = this.projectService.getOrCreateScriptInfo(fileName, false); + if (scriptInfo) { + scriptInfo.attachToProject(this); + } + return scriptInfo; }; - Session.prototype.getProjectInfo = function (args) { - return this.getProjectInfoWorker(args.file, args.projectFileName, args.needFileNameList); + Project.prototype.getScriptInfoForNormalizedPath = function (fileName) { + var scriptInfo = this.projectService.getOrCreateScriptInfoForNormalizedPath(fileName, false); + if (scriptInfo && !scriptInfo.isAttached(this)) { + return server.Errors.ThrowProjectDoesNotContainDocument(fileName, this); + } + return scriptInfo; }; - Session.prototype.getProjectInfoWorker = function (uncheckedFileName, projectFileName, needFileNameList) { - var project = this.getFileAndProjectWorker(uncheckedFileName, projectFileName, true, true).project; - var projectInfo = { - configFileName: project.getProjectName(), - languageServiceDisabled: !project.languageServiceEnabled, - fileNames: needFileNameList ? project.getFileNames() : undefined - }; - return projectInfo; + Project.prototype.getScriptInfo = function (uncheckedFileName) { + return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); }; - Session.prototype.getRenameInfo = function (args) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - return project.getLanguageService().getRenameInfo(file, position); + Project.prototype.filesToString = function () { + if (!this.program) { + return ""; + } + var strBuilder = ""; + for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) { + var file = _a[_i]; + strBuilder += file.fileName + "\n"; + } + return strBuilder; }; - Session.prototype.getProjects = function (args) { - var projects; - if (args.projectFileName) { - var project = this.getProject(args.projectFileName); - if (project) { - projects = [project]; + Project.prototype.setCompilerOptions = function (compilerOptions) { + if (compilerOptions) { + compilerOptions.allowNonTsExtensions = true; + if (ts.changesAffectModuleResolution(this.compilerOptions, compilerOptions)) { + this.cachedUnresolvedImportsPerFile.clear(); + this.lastCachedUnresolvedImportsList = undefined; } + this.compilerOptions = compilerOptions; + this.setInternalCompilerOptionsForEmittingJsFiles(); + this.lsHost.setCompilationSettings(compilerOptions); + this.markAsDirty(); } - else { - var scriptInfo = this.projectService.getScriptInfo(args.file); - projects = scriptInfo.containingProjects; - } - projects = ts.filter(projects, function (p) { return p.languageServiceEnabled; }); - if (!projects || !projects.length) { - return server.Errors.ThrowNoProject(); + }; + Project.prototype.reloadScript = function (filename, tempFileName) { + var script = this.projectService.getScriptInfoForNormalizedPath(filename); + if (script) { + ts.Debug.assert(script.isAttached(this)); + script.reloadFromFile(tempFileName); + return true; } - return projects; + return false; }; - Session.prototype.getRenameLocations = function (args, simplifiedResult) { - var file = server.toNormalizedPath(args.file); - var info = this.projectService.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, info); - var projects = this.getProjects(args); - if (simplifiedResult) { - var defaultProject = projects[0]; - var renameInfo = defaultProject.getLanguageService().getRenameInfo(file, position); - if (!renameInfo) { - return undefined; - } - if (!renameInfo.canRename) { - return { - info: renameInfo, - locs: [] - }; + Project.prototype.getChangesSinceVersion = function (lastKnownVersion) { + this.updateGraph(); + var info = { + projectName: this.getProjectName(), + version: this.projectStructureVersion, + isInferred: this.projectKind === ProjectKind.Inferred, + options: this.getCompilerOptions(), + languageServiceDisabled: !this.languageServiceEnabled + }; + var updatedFileNames = this.updatedFileNames; + this.updatedFileNames = undefined; + if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { + if (this.projectStructureVersion === this.lastReportedVersion && !updatedFileNames) { + return { info: info, projectErrors: this.projectErrors }; } - var fileSpans = server.combineProjectOutput(projects, function (project) { - var renameLocations = project.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); - if (!renameLocations) { - return []; - } - return renameLocations.map(function (location) { - var locationScriptInfo = project.getScriptInfo(location.fileName); - return { - file: location.fileName, - start: locationScriptInfo.positionToLineOffset(location.textSpan.start), - end: locationScriptInfo.positionToLineOffset(ts.textSpanEnd(location.textSpan)), - }; - }); - }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; }); - var locs = fileSpans.reduce(function (accum, cur) { - var curFileAccum; - if (accum.length > 0) { - curFileAccum = accum[accum.length - 1]; - if (curFileAccum.file !== cur.file) { - curFileAccum = undefined; - } + var lastReportedFileNames_1 = this.lastReportedFileNames; + var currentFiles_1 = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); + var added_1 = []; + var removed_1 = []; + var updated = ts.arrayFrom(updatedFileNames.keys()); + ts.forEachKey(currentFiles_1, function (id) { + if (!lastReportedFileNames_1.has(id)) { + added_1.push(id); } - if (!curFileAccum) { - curFileAccum = { file: cur.file, locs: [] }; - accum.push(curFileAccum); + }); + ts.forEachKey(lastReportedFileNames_1, function (id) { + if (!currentFiles_1.has(id)) { + removed_1.push(id); } - curFileAccum.locs.push({ start: cur.start, end: cur.end }); - return accum; - }, []); - return { info: renameInfo, locs: locs }; + }); + this.lastReportedFileNames = currentFiles_1; + this.lastReportedVersion = this.projectStructureVersion; + return { info: info, changes: { added: added_1, removed: removed_1, updated: updated }, projectErrors: this.projectErrors }; } else { - return server.combineProjectOutput(projects, function (p) { return p.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); }, undefined, renameLocationIsEqualTo); + var projectFileNames = this.getFileNames(); + this.lastReportedFileNames = ts.arrayToMap(projectFileNames, function (x) { return x; }); + this.lastReportedVersion = this.projectStructureVersion; + return { info: info, files: projectFileNames, projectErrors: this.projectErrors }; } - function renameLocationIsEqualTo(a, b) { - if (a === b) { - return true; - } - if (!a || !b) { - return false; - } - return a.fileName === b.fileName && - a.textSpan.start === b.textSpan.start && - a.textSpan.length === b.textSpan.length; + }; + Project.prototype.getReferencedFiles = function (path) { + var _this = this; + if (!this.languageServiceEnabled) { + return []; } - function compareRenameLocation(a, b) { - if (a.file < b.file) { - return -1; - } - else if (a.file > b.file) { - return 1; - } - else { - if (a.start.line < b.start.line) { - return 1; - } - else if (a.start.line > b.start.line) { - return -1; - } - else { - return b.start.offset - a.start.offset; - } - } + var sourceFile = this.getSourceFile(path); + if (!sourceFile) { + return []; } - }; - Session.prototype.getReferences = function (args, simplifiedResult) { - var file = server.toNormalizedPath(args.file); - var projects = this.getProjects(args); - var defaultProject = projects[0]; - var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - if (simplifiedResult) { - var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position); - if (!nameInfo) { - return undefined; - } - var displayString = ts.displayPartsToString(nameInfo.displayParts); - var nameSpan = nameInfo.textSpan; - var nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset; - var nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); - var refs = server.combineProjectOutput(projects, function (project) { - var references = project.getLanguageService().getReferencesAtPosition(file, position); - if (!references) { - return []; + var referencedFiles = ts.createMap(); + if (sourceFile.imports && sourceFile.imports.length > 0) { + var checker = this.program.getTypeChecker(); + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var importName = _a[_i]; + var symbol = checker.getSymbolAtLocation(importName); + if (symbol && symbol.declarations && symbol.declarations[0]) { + var declarationSourceFile = symbol.declarations[0].getSourceFile(); + if (declarationSourceFile) { + referencedFiles.set(declarationSourceFile.path, true); + } } - return references.map(function (ref) { - var refScriptInfo = project.getScriptInfo(ref.fileName); - var start = refScriptInfo.positionToLineOffset(ref.textSpan.start); - var refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1); - var lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); - return { - file: ref.fileName, - start: start, - lineText: lineText, - end: refScriptInfo.positionToLineOffset(ts.textSpanEnd(ref.textSpan)), - isWriteAccess: ref.isWriteAccess, - isDefinition: ref.isDefinition - }; - }); - }, compareFileStart, areReferencesResponseItemsForTheSameLocation); - return { - refs: refs, - symbolName: nameText, - symbolStartOffset: nameColStart, - symbolDisplayString: displayString - }; - } - else { - return server.combineProjectOutput(projects, function (project) { return project.getLanguageService().findReferences(file, position); }, undefined, undefined); + } } - function areReferencesResponseItemsForTheSameLocation(a, b) { - if (a && b) { - return a.file === b.file && - a.start === b.start && - a.end === b.end; + var currentDirectory = ts.getDirectoryPath(path); + var getCanonicalFileName = ts.createGetCanonicalFileName(this.projectService.host.useCaseSensitiveFileNames); + if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) { + for (var _b = 0, _c = sourceFile.referencedFiles; _b < _c.length; _b++) { + var referencedFile = _c[_b]; + var referencedPath = ts.toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName); + referencedFiles.set(referencedPath, true); } - return false; } - }; - Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) { - var _a = this.projectService.openClientFileWithNormalizedPath(fileName, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors; - if (this.eventHander) { - this.eventHander({ - eventName: "configFileDiag", - data: { triggerFile: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] } + if (sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) { + if (!resolvedTypeReferenceDirective) { + return; + } + var fileName = resolvedTypeReferenceDirective.resolvedFileName; + var typeFilePath = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + referencedFiles.set(typeFilePath, true); }); } + var allFileNames = ts.arrayFrom(referencedFiles.keys()); + return ts.filter(allFileNames, function (file) { return _this.projectService.host.fileExists(file); }); }; - Session.prototype.getPosition = function (args, scriptInfo) { - return args.position !== undefined ? args.position : scriptInfo.lineOffsetToPosition(args.line, args.offset); - }; - Session.prototype.getFileAndProject = function (args, errorOnMissingProject) { - if (errorOnMissingProject === void 0) { errorOnMissingProject = true; } - return this.getFileAndProjectWorker(args.file, args.projectFileName, true, errorOnMissingProject); - }; - Session.prototype.getFileAndProjectWithoutRefreshingInferredProjects = function (args, errorOnMissingProject) { - if (errorOnMissingProject === void 0) { errorOnMissingProject = true; } - return this.getFileAndProjectWorker(args.file, args.projectFileName, false, errorOnMissingProject); + Project.prototype.removeRoot = function (info) { + remove(this.rootFiles, info); + this.rootFilesMap.remove(info.path); }; - Session.prototype.getFileAndProjectWorker = function (uncheckedFileName, projectFileName, refreshInferredProjects, errorOnMissingProject) { - var file = server.toNormalizedPath(uncheckedFileName); - var project = this.getProject(projectFileName) || this.projectService.getDefaultProjectForFile(file, refreshInferredProjects); - if (!project && errorOnMissingProject) { - return server.Errors.ThrowNoProject(); + return Project; + }()); + server.Project = Project; + var InferredProject = (function (_super) { + __extends(InferredProject, _super); + function InferredProject(projectService, documentRegistry, compilerOptions) { + var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; + _this._isJsInferredProject = false; + _this.directoriesWatchedForTsconfig = []; + return _this; + } + InferredProject.prototype.toggleJsInferredProject = function (isJsInferredProject) { + if (isJsInferredProject !== this._isJsInferredProject) { + this._isJsInferredProject = isJsInferredProject; + this.setCompilerOptions(); } - return { file: file, project: project }; - }; - Session.prototype.getOutliningSpans = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - return project.getLanguageService(false).getOutliningSpans(file); - }; - Session.prototype.getTodoComments = function (args) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - return project.getLanguageService().getTodoComments(file, args.descriptors); - }; - Session.prototype.getDocCommentTemplate = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - return project.getLanguageService(false).getDocCommentTemplateAtPosition(file, position); - }; - Session.prototype.getIndentation = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); - var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); - var indentation = project.getLanguageService(false).getIndentationAtPosition(file, position, options); - return { position: position, indentation: indentation }; }; - Session.prototype.getBreakpointStatement = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); - return project.getLanguageService(false).getBreakpointStatementAtPosition(file, position); + InferredProject.prototype.setCompilerOptions = function (options) { + var newOptions = options ? ts.clone(options) : this.getCompilerOptions(); + if (!newOptions) { + return; + } + if (this._isJsInferredProject && typeof newOptions.maxNodeModuleJsDepth !== "number") { + newOptions.maxNodeModuleJsDepth = 2; + } + else if (!this._isJsInferredProject) { + newOptions.maxNodeModuleJsDepth = undefined; + } + newOptions.allowJs = true; + _super.prototype.setCompilerOptions.call(this, newOptions); }; - Session.prototype.getNameOrDottedNameSpan = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); - return project.getLanguageService(false).getNameOrDottedNameSpan(file, position, position); + InferredProject.prototype.addRoot = function (info) { + if (!this._isJsInferredProject && info.isJavaScript()) { + this.toggleJsInferredProject(true); + } + _super.prototype.addRoot.call(this, info); }; - Session.prototype.isValidBraceCompletion = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); - return project.getLanguageService(false).isValidBraceCompletionAtPosition(file, position, args.openingBrace.charCodeAt(0)); + InferredProject.prototype.removeRoot = function (info) { + if (this._isJsInferredProject && info.isJavaScript()) { + if (ts.filter(this.getRootScriptInfos(), function (info) { return info.isJavaScript(); }).length === 0) { + this.toggleJsInferredProject(false); + } + } + _super.prototype.removeRoot.call(this, info); }; - Session.prototype.getQuickInfoWorker = function (args, simplifiedResult) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo)); - if (!quickInfo) { + InferredProject.prototype.getProjectRootPath = function () { + if (this.projectService.useSingleInferredProject) { return undefined; } - if (simplifiedResult) { - var displayString = ts.displayPartsToString(quickInfo.displayParts); - var docString = ts.displayPartsToString(quickInfo.documentation); - return { - kind: quickInfo.kind, - kindModifiers: quickInfo.kindModifiers, - start: scriptInfo.positionToLineOffset(quickInfo.textSpan.start), - end: scriptInfo.positionToLineOffset(ts.textSpanEnd(quickInfo.textSpan)), - displayString: displayString, - documentation: docString, - }; - } - else { - return quickInfo; - } + var rootFiles = this.getRootFiles(); + return ts.getDirectoryPath(rootFiles[0]); }; - Session.prototype.getFormattingEditsForRange = function (args) { - var _this = this; - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var startPosition = scriptInfo.lineOffsetToPosition(args.line, args.offset); - var endPosition = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset); - var edits = project.getLanguageService(false).getFormattingEditsForRange(file, startPosition, endPosition, this.projectService.getFormatCodeOptions(file)); - if (!edits) { - return undefined; + InferredProject.prototype.close = function () { + _super.prototype.close.call(this); + for (var _i = 0, _a = this.directoriesWatchedForTsconfig; _i < _a.length; _i++) { + var directory = _a[_i]; + this.projectService.stopWatchingDirectory(directory); } - return edits.map(function (edit) { return _this.convertTextChangeToCodeEdit(edit, scriptInfo); }); }; - Session.prototype.getFormattingEditsForRangeFull = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); - return project.getLanguageService(false).getFormattingEditsForRange(file, args.position, args.endPosition, options); + InferredProject.prototype.getTypeAcquisition = function () { + return { + enable: allRootFilesAreJsOrDts(this), + include: [], + exclude: [] + }; }; - Session.prototype.getFormattingEditsForDocumentFull = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); - return project.getLanguageService(false).getFormattingEditsForDocument(file, options); + return InferredProject; + }(Project)); + InferredProject.newName = (function () { + var nextId = 1; + return function () { + var id = nextId; + nextId++; + return server.makeInferredProjectName(id); }; - Session.prototype.getFormattingEditsAfterKeystrokeFull = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file); - return project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, args.position, args.key, options); + })(); + server.InferredProject = InferredProject; + var ConfiguredProject = (function (_super) { + __extends(ConfiguredProject, _super); + function ConfiguredProject(configFileName, projectService, documentRegistry, hasExplicitListOfFiles, compilerOptions, wildcardDirectories, languageServiceEnabled, compileOnSaveEnabled) { + var _this = _super.call(this, configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; + _this.wildcardDirectories = wildcardDirectories; + _this.compileOnSaveEnabled = compileOnSaveEnabled; + _this.plugins = []; + _this.openRefCount = 0; + _this.canonicalConfigFilePath = server.asNormalizedPath(projectService.toCanonicalFileName(configFileName)); + _this.enablePlugins(); + return _this; + } + ConfiguredProject.prototype.getConfigFilePath = function () { + return this.getProjectName(); }; - Session.prototype.getFormattingEditsAfterKeystroke = function (args) { - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = scriptInfo.lineOffsetToPosition(args.line, args.offset); - var formatOptions = this.projectService.getFormatCodeOptions(file); - var edits = project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, position, args.key, formatOptions); - if ((args.key == "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { - var lineInfo = scriptInfo.getLineInfo(args.line); - if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) { - var lineText = lineInfo.leaf.text; - if (lineText.search("\\S") < 0) { - var preferredIndent = project.getLanguageService(false).getIndentationAtPosition(file, position, formatOptions); - var hasIndent = 0; - var i = void 0, len = void 0; - for (i = 0, len = lineText.length; i < len; i++) { - if (lineText.charAt(i) == " ") { - hasIndent++; - } - else if (lineText.charAt(i) == "\t") { - hasIndent += formatOptions.tabSize; - } - else { - break; - } - } - if (preferredIndent !== hasIndent) { - var firstNoWhiteSpacePosition = lineInfo.offset + i; - edits.push({ - span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition), - newText: ts.formatting.getIndentationString(preferredIndent, formatOptions) - }); - } - } - } - } - if (!edits) { - return undefined; + ConfiguredProject.prototype.enablePlugins = function () { + var host = this.projectService.host; + var options = this.getCompilerOptions(); + if (!host.require) { + this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); + return; } - return edits.map(function (edit) { - return { - start: scriptInfo.positionToLineOffset(edit.span.start), - end: scriptInfo.positionToLineOffset(ts.textSpanEnd(edit.span)), - newText: edit.newText ? edit.newText : "" + var searchPaths = [ts.combinePaths(host.getExecutingFilePath(), "../../..")].concat(this.projectService.pluginProbeLocations); + if (options.plugins) { + for (var _i = 0, _a = options.plugins; _i < _a.length; _i++) { + var pluginConfigEntry = _a[_i]; + this.enablePlugin(pluginConfigEntry, searchPaths); + } + } + if (this.projectService.globalPlugins) { + var _loop_6 = function (globalPluginName) { + if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) + return "continue"; + this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths); }; - }); + var this_1 = this; + for (var _b = 0, _c = this.projectService.globalPlugins; _b < _c.length; _b++) { + var globalPluginName = _c[_b]; + _loop_6(globalPluginName); + } + } }; - Session.prototype.getCompletions = function (args, simplifiedResult) { + ConfiguredProject.prototype.enablePlugin = function (pluginConfigEntry, searchPaths) { var _this = this; - var prefix = args.prefix || ""; - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var completions = project.getLanguageService().getCompletionsAtPosition(file, position); - if (!completions) { - return undefined; + var log = function (message) { + _this.projectService.logger.info(message); + }; + for (var _i = 0, searchPaths_1 = searchPaths; _i < searchPaths_1.length; _i++) { + var searchPath = searchPaths_1[_i]; + var resolvedModule = Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log); + if (resolvedModule) { + this.enableProxy(resolvedModule, pluginConfigEntry); + return; + } } - if (simplifiedResult) { - return completions.entries.reduce(function (result, entry) { - if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_51 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; - var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_51, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); - } - return result; - }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); + this.projectService.logger.info("Couldn't find " + pluginConfigEntry.name + " anywhere in paths: " + searchPaths.join(",")); + }; + ConfiguredProject.prototype.enableProxy = function (pluginModuleFactory, configEntry) { + try { + if (typeof pluginModuleFactory !== "function") { + this.projectService.logger.info("Skipped loading plugin " + configEntry.name + " because it did expose a proper factory function"); + return; + } + var info = { + config: configEntry, + project: this, + languageService: this.languageService, + languageServiceHost: this.lsHost, + serverHost: this.projectService.host + }; + var pluginModule = pluginModuleFactory({ typescript: ts }); + this.languageService = pluginModule.create(info); + this.plugins.push(pluginModule); } - else { - return completions; + catch (e) { + this.projectService.logger.info("Plugin activation failed: " + e); } }; - Session.prototype.getCompletionEntryDetails = function (args) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - return args.entryNames.reduce(function (accum, entryName) { - var details = project.getLanguageService().getCompletionEntryDetails(file, position, entryName); - if (details) { - accum.push(details); - } - return accum; - }, []); + ConfiguredProject.prototype.getProjectRootPath = function () { + return ts.getDirectoryPath(this.getConfigFilePath()); }; - Session.prototype.getCompileOnSaveAffectedFileList = function (args) { - var info = this.projectService.getScriptInfo(args.file); - var result = []; - if (!info) { - return []; - } - var projectsToSearch = args.projectFileName ? [this.projectService.findProject(args.projectFileName)] : info.containingProjects; - for (var _i = 0, projectsToSearch_1 = projectsToSearch; _i < projectsToSearch_1.length; _i++) { - var project = projectsToSearch_1[_i]; - if (project.compileOnSaveEnabled && project.languageServiceEnabled) { - result.push({ - projectFileName: project.getProjectName(), - fileNames: project.getCompileOnSaveAffectedFileList(info) - }); + ConfiguredProject.prototype.setProjectErrors = function (projectErrors) { + this.projectErrors = projectErrors; + }; + ConfiguredProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { + this.typeAcquisition = newTypeAcquisition; + }; + ConfiguredProject.prototype.getTypeAcquisition = function () { + return this.typeAcquisition; + }; + ConfiguredProject.prototype.getExternalFiles = function () { + var items = []; + for (var _i = 0, _a = this.plugins; _i < _a.length; _i++) { + var plugin = _a[_i]; + if (typeof plugin.getExternalFiles === "function") { + try { + items.push.apply(items, plugin.getExternalFiles(this)); + } + catch (e) { + this.projectService.logger.info("A plugin threw an exception in getExternalFiles: " + e); + } } } - return result; + return items; }; - Session.prototype.emitFile = function (args) { + ConfiguredProject.prototype.watchConfigFile = function (callback) { var _this = this; - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - if (!project) { - server.Errors.ThrowNoProject(); - } - var scriptInfo = project.getScriptInfo(file); - return project.builder.emitFile(scriptInfo, function (path, data, writeByteOrderMark) { return _this.host.writeFile(path, data, writeByteOrderMark); }); + this.projectFileWatcher = this.projectService.host.watchFile(this.getConfigFilePath(), function (_) { return callback(_this); }); }; - Session.prototype.getSignatureHelpItems = function (args, simplifiedResult) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var helpItems = project.getLanguageService().getSignatureHelpItems(file, position); - if (!helpItems) { - return undefined; - } - if (simplifiedResult) { - var span_16 = helpItems.applicableSpan; - return { - items: helpItems.items, - applicableSpan: { - start: scriptInfo.positionToLineOffset(span_16.start), - end: scriptInfo.positionToLineOffset(span_16.start + span_16.length) - }, - selectedItemIndex: helpItems.selectedItemIndex, - argumentIndex: helpItems.argumentIndex, - argumentCount: helpItems.argumentCount, - }; - } - else { - return helpItems; + ConfiguredProject.prototype.watchTypeRoots = function (callback) { + var _this = this; + var roots = this.getEffectiveTypeRoots(); + var watchers = []; + for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) { + var root = roots_1[_i]; + this.projectService.logger.info("Add type root watcher for: " + root); + watchers.push(this.projectService.host.watchDirectory(root, function (path) { return callback(_this, path); }, false)); } + this.typeRootsWatchers = watchers; }; - Session.prototype.getDiagnostics = function (delay, fileNames) { + ConfiguredProject.prototype.watchConfigDirectory = function (callback) { var _this = this; - var checkList = fileNames.reduce(function (accum, uncheckedFileName) { - var fileName = server.toNormalizedPath(uncheckedFileName); - var project = _this.projectService.getDefaultProjectForFile(fileName, true); - if (project) { - accum.push({ fileName: fileName, project: project }); - } - return accum; - }, []); - if (checkList.length > 0) { - this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay); + if (this.directoryWatcher) { + return; } + var directoryToWatch = ts.getDirectoryPath(this.getConfigFilePath()); + this.projectService.logger.info("Add recursive watcher for: " + directoryToWatch); + this.directoryWatcher = this.projectService.host.watchDirectory(directoryToWatch, function (path) { return callback(_this, path); }, true); }; - Session.prototype.change = function (args) { + ConfiguredProject.prototype.watchWildcards = function (callback) { var _this = this; - var _a = this.getFileAndProject(args, false), file = _a.file, project = _a.project; - if (project) { - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var start = scriptInfo.lineOffsetToPosition(args.line, args.offset); - var end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset); - if (start >= 0) { - scriptInfo.editContent(start, end, args.insertString); - this.changeSeq++; + if (!this.wildcardDirectories) { + return; + } + var configDirectoryPath = ts.getDirectoryPath(this.getConfigFilePath()); + this.directoriesWatchedForWildcards = ts.createMap(); + this.wildcardDirectories.forEach(function (flag, directory) { + if (ts.comparePaths(configDirectoryPath, directory, ".", !_this.projectService.host.useCaseSensitiveFileNames) !== 0) { + var recursive = (flag & 1) !== 0; + _this.projectService.logger.info("Add " + (recursive ? "recursive " : "") + "watcher for: " + directory); + _this.directoriesWatchedForWildcards.set(directory, _this.projectService.host.watchDirectory(directory, function (path) { return callback(_this, path); }, recursive)); } - this.updateProjectStructure(this.changeSeq, function (n) { return n === _this.changeSeq; }); + }); + }; + ConfiguredProject.prototype.stopWatchingDirectory = function () { + if (this.directoryWatcher) { + this.directoryWatcher.close(); + this.directoryWatcher = undefined; } }; - Session.prototype.reload = function (args, reqSeq) { - var file = server.toNormalizedPath(args.file); - var tempFileName = args.tmpfile && server.toNormalizedPath(args.tmpfile); - var project = this.projectService.getDefaultProjectForFile(file, true); - if (project) { - this.changeSeq++; - if (project.reloadScript(file, tempFileName)) { - this.output(undefined, CommandNames.Reload, reqSeq); + ConfiguredProject.prototype.close = function () { + _super.prototype.close.call(this); + if (this.projectFileWatcher) { + this.projectFileWatcher.close(); + } + if (this.typeRootsWatchers) { + for (var _i = 0, _a = this.typeRootsWatchers; _i < _a.length; _i++) { + var watcher = _a[_i]; + watcher.close(); } + this.typeRootsWatchers = undefined; } + this.directoriesWatchedForWildcards.forEach(function (watcher) { + watcher.close(); + }); + this.directoriesWatchedForWildcards = undefined; + this.stopWatchingDirectory(); }; - Session.prototype.saveToTmp = function (fileName, tempFileName) { - var scriptInfo = this.projectService.getScriptInfo(fileName); - if (scriptInfo) { - scriptInfo.saveTo(tempFileName); + ConfiguredProject.prototype.addOpenRef = function () { + this.openRefCount++; + }; + ConfiguredProject.prototype.deleteOpenRef = function () { + this.openRefCount--; + return this.openRefCount; + }; + ConfiguredProject.prototype.getEffectiveTypeRoots = function () { + return ts.getEffectiveTypeRoots(this.getCompilerOptions(), this.projectService.host) || []; + }; + return ConfiguredProject; + }(Project)); + server.ConfiguredProject = ConfiguredProject; + var ExternalProject = (function (_super) { + __extends(ExternalProject, _super); + function ExternalProject(externalProjectName, projectService, documentRegistry, compilerOptions, languageServiceEnabled, compileOnSaveEnabled, projectFilePath) { + var _this = _super.call(this, externalProjectName, ProjectKind.External, projectService, documentRegistry, true, languageServiceEnabled, compilerOptions, compileOnSaveEnabled) || this; + _this.externalProjectName = externalProjectName; + _this.compileOnSaveEnabled = compileOnSaveEnabled; + _this.projectFilePath = projectFilePath; + return _this; + } + ExternalProject.prototype.getProjectRootPath = function () { + if (this.projectFilePath) { + return ts.getDirectoryPath(this.projectFilePath); } + return ts.getDirectoryPath(ts.normalizeSlashes(this.getProjectName())); }; - Session.prototype.closeClientFile = function (fileName) { - if (!fileName) { - return; + ExternalProject.prototype.getTypeAcquisition = function () { + return this.typeAcquisition; + }; + ExternalProject.prototype.setProjectErrors = function (projectErrors) { + this.projectErrors = projectErrors; + }; + ExternalProject.prototype.setTypeAcquisition = function (newTypeAcquisition) { + if (!newTypeAcquisition) { + newTypeAcquisition = { + enable: allRootFilesAreJsOrDts(this), + include: [], + exclude: [] + }; } - var file = ts.normalizePath(fileName); - this.projectService.closeClientFile(file); + else { + if (newTypeAcquisition.enable === undefined) { + newTypeAcquisition.enable = allRootFilesAreJsOrDts(this); + } + if (!newTypeAcquisition.include) { + newTypeAcquisition.include = []; + } + if (!newTypeAcquisition.exclude) { + newTypeAcquisition.exclude = []; + } + } + this.typeAcquisition = newTypeAcquisition; }; - Session.prototype.decorateNavigationBarItems = function (items, scriptInfo) { - var _this = this; - return ts.map(items, function (item) { return ({ - text: item.text, - kind: item.kind, - kindModifiers: item.kindModifiers, - spans: item.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }), - childItems: _this.decorateNavigationBarItems(item.childItems, scriptInfo), - indent: item.indent - }); }); + return ExternalProject; + }(Project)); + server.ExternalProject = ExternalProject; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; + server.ContextEvent = "context"; + server.ConfigFileDiagEvent = "configFileDiag"; + server.ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; + function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) { + var map = ts.createMap(); + for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) { + var option = commandLineOptions_1[_i]; + if (typeof option.type === "object") { + var optionMap = option.type; + optionMap.forEach(function (value) { + ts.Debug.assert(typeof value === "number"); + }); + map.set(option.name, optionMap); + } + } + return map; + } + var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations); + var indentStyle = ts.createMapFromTemplate({ + "none": ts.IndentStyle.None, + "block": ts.IndentStyle.Block, + "smart": ts.IndentStyle.Smart + }); + var defaultTypeSafeList = { + "jquery": { + "match": /jquery(-(\.?\d+)+)?(\.intellisense)?(\.min)?\.js$/i, + "types": ["jquery"] + }, + "WinJS": { + "match": /^(.*\/winjs-[.\d]+)\/js\/base\.js$/i, + "exclude": [["^", 1, "/.*"]], + "types": ["winjs"] + }, + "Kendo": { + "match": /^(.*\/kendo)\/kendo\.all\.min\.js$/i, + "exclude": [["^", 1, "/.*"]], + "types": ["kendo-ui"] + }, + "Office Nuget": { + "match": /^(.*\/office\/1)\/excel-\d+\.debug\.js$/i, + "exclude": [["^", 1, "/.*"]], + "types": ["office"] + }, + "Minified files": { + "match": /^(.+\.min\.js)$/i, + "exclude": [["^", 1, "$"]] + } + }; + function convertFormatOptions(protocolOptions) { + if (typeof protocolOptions.indentStyle === "string") { + protocolOptions.indentStyle = indentStyle.get(protocolOptions.indentStyle.toLowerCase()); + ts.Debug.assert(protocolOptions.indentStyle !== undefined); + } + return protocolOptions; + } + server.convertFormatOptions = convertFormatOptions; + function convertCompilerOptions(protocolOptions) { + compilerOptionConverters.forEach(function (mappedValues, id) { + var propertyValue = protocolOptions[id]; + if (typeof propertyValue === "string") { + protocolOptions[id] = mappedValues.get(propertyValue.toLowerCase()); + } + }); + return protocolOptions; + } + server.convertCompilerOptions = convertCompilerOptions; + function tryConvertScriptKindName(scriptKindName) { + return typeof scriptKindName === "string" + ? convertScriptKindName(scriptKindName) + : scriptKindName; + } + server.tryConvertScriptKindName = tryConvertScriptKindName; + function convertScriptKindName(scriptKindName) { + switch (scriptKindName) { + case "JS": + return 1; + case "JSX": + return 2; + case "TS": + return 3; + case "TSX": + return 4; + default: + return 0; + } + } + server.convertScriptKindName = convertScriptKindName; + function combineProjectOutput(projects, action, comparer, areEqual) { + var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer); + return projects.length > 1 ? ts.deduplicate(result, areEqual) : result; + } + server.combineProjectOutput = combineProjectOutput; + var fileNamePropertyReader = { + getFileName: function (x) { return x; }, + getScriptKind: function (_) { return undefined; }, + hasMixedContent: function (fileName, extraFileExtensions) { + var mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, function (item) { return item.isMixedContent; }), function (item) { return item.extension; }); + return ts.forEach(mixedContentExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); + } + }; + var externalFilePropertyReader = { + getFileName: function (x) { return x.fileName; }, + getScriptKind: function (x) { return tryConvertScriptKindName(x.scriptKind); }, + hasMixedContent: function (x) { return x.hasMixedContent; } + }; + function findProjectByName(projectName, projects) { + for (var _i = 0, projects_2 = projects; _i < projects_2.length; _i++) { + var proj = projects_2[_i]; + if (proj.getProjectName() === projectName) { + return proj; + } + } + } + function createFileNotFoundDiagnostic(fileName) { + return ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName); + } + function isRootFileInInferredProject(info) { + if (info.containingProjects.length === 0) { + return false; + } + return info.containingProjects[0].projectKind === server.ProjectKind.Inferred && info.containingProjects[0].isRoot(info); + } + var DirectoryWatchers = (function () { + function DirectoryWatchers(projectService) { + this.projectService = projectService; + this.directoryWatchersForTsconfig = ts.createMap(); + this.directoryWatchersRefCount = ts.createMap(); + } + DirectoryWatchers.prototype.stopWatchingDirectory = function (directory) { + var refCount = this.directoryWatchersRefCount.get(directory) - 1; + this.directoryWatchersRefCount.set(directory, refCount); + if (refCount === 0) { + this.projectService.logger.info("Close directory watcher for: " + directory); + this.directoryWatchersForTsconfig.get(directory).close(); + this.directoryWatchersForTsconfig.delete(directory); + } }; - Session.prototype.getNavigationBarItems = function (args, simplifiedResult) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var items = project.getLanguageService(false).getNavigationBarItems(file); - return !items - ? undefined - : simplifiedResult - ? this.decorateNavigationBarItems(items, project.getScriptInfoForNormalizedPath(file)) - : items; + DirectoryWatchers.prototype.startWatchingContainingDirectoriesForFile = function (fileName, project, callback) { + var currentPath = ts.getDirectoryPath(fileName); + var parentPath = ts.getDirectoryPath(currentPath); + while (currentPath !== parentPath) { + if (!this.directoryWatchersForTsconfig.has(currentPath)) { + this.projectService.logger.info("Add watcher for: " + currentPath); + this.directoryWatchersForTsconfig.set(currentPath, this.projectService.host.watchDirectory(currentPath, callback)); + this.directoryWatchersRefCount.set(currentPath, 1); + } + else { + this.directoryWatchersRefCount.set(currentPath, this.directoryWatchersRefCount.get(currentPath) + 1); + } + project.directoriesWatchedForTsconfig.push(currentPath); + currentPath = parentPath; + parentPath = ts.getDirectoryPath(parentPath); + } }; - Session.prototype.decorateNavigationTree = function (tree, scriptInfo) { - var _this = this; - return { - text: tree.text, - kind: tree.kind, - kindModifiers: tree.kindModifiers, - spans: tree.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }), - childItems: ts.map(tree.childItems, function (item) { return _this.decorateNavigationTree(item, scriptInfo); }) + return DirectoryWatchers; + }()); + var ProjectService = (function () { + function ProjectService(opts) { + this.filenameToScriptInfo = ts.createFileMap(); + this.externalProjectToConfiguredProjectMap = ts.createMap(); + this.externalProjects = []; + this.inferredProjects = []; + this.configuredProjects = []; + this.openFiles = []; + this.projectToSizeMap = ts.createMap(); + this.host = opts.host; + this.logger = opts.logger; + this.cancellationToken = opts.cancellationToken; + this.useSingleInferredProject = opts.useSingleInferredProject; + this.typingsInstaller = opts.typingsInstaller || server.nullTypingsInstaller; + this.throttleWaitMilliseconds = opts.throttleWaitMilliseconds; + this.eventHandler = opts.eventHandler; + this.globalPlugins = opts.globalPlugins || server.emptyArray; + this.pluginProbeLocations = opts.pluginProbeLocations || server.emptyArray; + ts.Debug.assert(!!this.host.createHash, "'ServerHost.createHash' is required for ProjectService"); + this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); + this.directoryWatchers = new DirectoryWatchers(this); + this.throttledOperations = new server.ThrottledOperations(this.host); + this.typingsInstaller.attach(this); + this.typingsCache = new server.TypingsCache(this.typingsInstaller); + this.hostConfiguration = { + formatCodeOptions: server.getDefaultFormatCodeSettings(this.host), + hostInfo: "Unknown host", + extraFileExtensions: [] }; + this.documentRegistry = ts.createDocumentRegistry(this.host.useCaseSensitiveFileNames, this.host.getCurrentDirectory()); + } + ProjectService.prototype.getChangedFiles_TestOnly = function () { + return this.changedFiles; }; - Session.prototype.decorateSpan = function (span, scriptInfo) { - return { - start: scriptInfo.positionToLineOffset(span.start), - end: scriptInfo.positionToLineOffset(ts.textSpanEnd(span)) - }; + ProjectService.prototype.ensureInferredProjectsUpToDate_TestOnly = function () { + this.ensureInferredProjectsUpToDate(); }; - Session.prototype.getNavigationTree = function (args, simplifiedResult) { - var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; - var tree = project.getLanguageService(false).getNavigationTree(file); - return !tree - ? undefined - : simplifiedResult - ? this.decorateNavigationTree(tree, project.getScriptInfoForNormalizedPath(file)) - : tree; + ProjectService.prototype.getCompilerOptionsForInferredProjects = function () { + return this.compilerOptionsForInferredProjects; }; - Session.prototype.getNavigateToItems = function (args, simplifiedResult) { - var projects = this.getProjects(args); - var fileName = args.currentFileOnly ? args.file && ts.normalizeSlashes(args.file) : undefined; - if (simplifiedResult) { - return server.combineProjectOutput(projects, function (project) { - var navItems = project.getLanguageService().getNavigateToItems(args.searchValue, args.maxResultCount, fileName, project.isNonTsProject()); - if (!navItems) { - return []; - } - return navItems.map(function (navItem) { - var scriptInfo = project.getScriptInfo(navItem.fileName); - var start = scriptInfo.positionToLineOffset(navItem.textSpan.start); - var end = scriptInfo.positionToLineOffset(ts.textSpanEnd(navItem.textSpan)); - var bakedItem = { - name: navItem.name, - kind: navItem.kind, - file: navItem.fileName, - start: start, - end: end, - }; - if (navItem.kindModifiers && (navItem.kindModifiers !== "")) { - bakedItem.kindModifiers = navItem.kindModifiers; - } - if (navItem.matchKind !== "none") { - bakedItem.matchKind = navItem.matchKind; - } - if (navItem.containerName && (navItem.containerName.length > 0)) { - bakedItem.containerName = navItem.containerName; - } - if (navItem.containerKind && (navItem.containerKind.length > 0)) { - bakedItem.containerKind = navItem.containerKind; - } - return bakedItem; - }); - }, undefined, areNavToItemsForTheSameLocation); + ProjectService.prototype.onUpdateLanguageServiceStateForProject = function (project, languageServiceEnabled) { + if (!this.eventHandler) { + return; } - else { - return server.combineProjectOutput(projects, function (project) { return project.getLanguageService().getNavigateToItems(args.searchValue, args.maxResultCount, fileName, project.isNonTsProject()); }, undefined, navigateToItemIsEqualTo); + this.eventHandler({ + eventName: server.ProjectLanguageServiceStateEvent, + data: { project: project, languageServiceEnabled: languageServiceEnabled } + }); + }; + ProjectService.prototype.updateTypingsForProject = function (response) { + var project = this.findProject(response.projectName); + if (!project) { + return; } - function navigateToItemIsEqualTo(a, b) { - if (a === b) { - return true; + switch (response.kind) { + case server.ActionSet: + this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings); + break; + case server.ActionInvalidate: + this.typingsCache.deleteTypingsForProject(response.projectName); + break; + } + project.updateGraph(); + }; + ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) { + this.compilerOptionsForInferredProjects = convertCompilerOptions(projectCompilerOptions); + this.compilerOptionsForInferredProjects.allowNonTsExtensions = true; + this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave; + for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) { + var proj = _a[_i]; + proj.setCompilerOptions(this.compilerOptionsForInferredProjects); + proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave; + } + this.updateProjectGraphs(this.inferredProjects); + }; + ProjectService.prototype.stopWatchingDirectory = function (directory) { + this.directoryWatchers.stopWatchingDirectory(directory); + }; + ProjectService.prototype.findProject = function (projectName) { + if (projectName === undefined) { + return undefined; + } + if (server.isInferredProjectName(projectName)) { + this.ensureInferredProjectsUpToDate(); + return findProjectByName(projectName, this.inferredProjects); + } + return this.findExternalProjectByProjectName(projectName) || this.findConfiguredProjectByProjectName(server.toNormalizedPath(projectName)); + }; + ProjectService.prototype.getDefaultProjectForFile = function (fileName, refreshInferredProjects) { + if (refreshInferredProjects) { + this.ensureInferredProjectsUpToDate(); + } + var scriptInfo = this.getScriptInfoForNormalizedPath(fileName); + return scriptInfo && scriptInfo.getDefaultProject(); + }; + ProjectService.prototype.ensureInferredProjectsUpToDate = function () { + if (this.changedFiles) { + var projectsToUpdate = void 0; + if (this.changedFiles.length === 1) { + projectsToUpdate = this.changedFiles[0].containingProjects; } - if (!a || !b) { - return false; + else { + projectsToUpdate = []; + for (var _i = 0, _a = this.changedFiles; _i < _a.length; _i++) { + var f = _a[_i]; + projectsToUpdate = projectsToUpdate.concat(f.containingProjects); + } } - return a.containerKind === b.containerKind && - a.containerName === b.containerName && - a.fileName === b.fileName && - a.isCaseSensitive === b.isCaseSensitive && - a.kind === b.kind && - a.kindModifiers === b.containerName && - a.matchKind === b.matchKind && - a.name === b.name && - a.textSpan.start === b.textSpan.start && - a.textSpan.length === b.textSpan.length; + this.updateProjectGraphs(projectsToUpdate); + this.changedFiles = undefined; } - function areNavToItemsForTheSameLocation(a, b) { - if (a && b) { - return a.file === b.file && - a.start === b.start && - a.end === b.end; + }; + ProjectService.prototype.findContainingExternalProject = function (fileName) { + for (var _i = 0, _a = this.externalProjects; _i < _a.length; _i++) { + var proj = _a[_i]; + if (proj.containsFile(fileName)) { + return proj; } - return false; } + return undefined; }; - Session.prototype.getSupportedCodeFixes = function () { - return ts.getSupportedCodeFixes(); + ProjectService.prototype.getFormatCodeOptions = function (file) { + var formatCodeSettings; + if (file) { + var info = this.getScriptInfoForNormalizedPath(file); + if (info) { + formatCodeSettings = info.getFormatCodeSettings(); + } + } + return formatCodeSettings || this.hostConfiguration.formatCodeOptions; }; - Session.prototype.getCodeFixes = function (args, simplifiedResult) { - var _this = this; - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var startPosition = getStartPosition(); - var endPosition = getEndPosition(); - var codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes); - if (!codeActions) { - return undefined; + ProjectService.prototype.updateProjectGraphs = function (projects) { + var shouldRefreshInferredProjects = false; + for (var _i = 0, projects_3 = projects; _i < projects_3.length; _i++) { + var p = projects_3[_i]; + if (!p.updateGraph()) { + shouldRefreshInferredProjects = true; + } } - if (simplifiedResult) { - return codeActions.map(function (codeAction) { return _this.mapCodeAction(codeAction, scriptInfo); }); + if (shouldRefreshInferredProjects) { + this.refreshInferredProjects(); } - else { - return codeActions; + }; + ProjectService.prototype.onSourceFileChanged = function (fileName) { + var info = this.getScriptInfoForNormalizedPath(fileName); + if (!info) { + this.logger.info("Error: got watch notification for unknown file: " + fileName); + return; } - function getStartPosition() { - return args.startPosition !== undefined ? args.startPosition : scriptInfo.lineOffsetToPosition(args.startLine, args.startOffset); + if (!this.host.fileExists(fileName)) { + this.handleDeletedFile(info); } - function getEndPosition() { - return args.endPosition !== undefined ? args.endPosition : scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset); + else { + if (info && (!info.isScriptOpen())) { + info.reloadFromFile(); + this.updateProjectGraphs(info.containingProjects); + } } }; - Session.prototype.mapCodeAction = function (codeAction, scriptInfo) { - var _this = this; - return { - description: codeAction.description, - changes: codeAction.changes.map(function (change) { return ({ - fileName: change.fileName, - textChanges: change.textChanges.map(function (textChange) { return _this.convertTextChangeToCodeEdit(textChange, scriptInfo); }) - }); }) - }; - }; - Session.prototype.convertTextChangeToCodeEdit = function (change, scriptInfo) { - return { - start: scriptInfo.positionToLineOffset(change.span.start), - end: scriptInfo.positionToLineOffset(change.span.start + change.span.length), - newText: change.newText ? change.newText : "" - }; + ProjectService.prototype.handleDeletedFile = function (info) { + this.logger.info(info.fileName + " deleted"); + info.stopWatcher(); + if (!info.isScriptOpen()) { + this.filenameToScriptInfo.remove(info.path); + this.lastDeletedFile = info; + var containingProjects = info.containingProjects.slice(); + info.detachAllProjects(); + this.updateProjectGraphs(containingProjects); + this.lastDeletedFile = undefined; + if (!this.eventHandler) { + return; + } + for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { + var openFile = _a[_i]; + this.eventHandler({ + eventName: server.ContextEvent, + data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } + }); + } + } + this.printProjects(); }; - Session.prototype.getBraceMatching = function (args, simplifiedResult) { + ProjectService.prototype.onTypeRootFileChanged = function (project, fileName) { var _this = this; - var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project; - var scriptInfo = project.getScriptInfoForNormalizedPath(file); - var position = this.getPosition(args, scriptInfo); - var spans = project.getLanguageService(false).getBraceMatchingAtPosition(file, position); - return !spans - ? undefined - : simplifiedResult - ? spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }) - : spans; + this.logger.info("Type root file " + fileName + " changed"); + this.throttledOperations.schedule(project.getConfigFilePath() + " * type root", 250, function () { + project.updateTypes(); + _this.updateConfiguredProject(project); + _this.refreshInferredProjects(); + }); }; - Session.prototype.getDiagnosticsForProject = function (delay, fileName) { + ProjectService.prototype.onSourceFileInDirectoryChangedForConfiguredProject = function (project, fileName) { var _this = this; - var _a = this.getProjectInfoWorker(fileName, undefined, true), fileNames = _a.fileNames, languageServiceDisabled = _a.languageServiceDisabled; - if (languageServiceDisabled) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) { return; } - var fileNamesInProject = fileNames.filter(function (value) { return value.indexOf("lib.d.ts") < 0; }); - var highPriorityFiles = []; - var mediumPriorityFiles = []; - var lowPriorityFiles = []; - var veryLowPriorityFiles = []; - var normalizedFileName = server.toNormalizedPath(fileName); - var project = this.projectService.getDefaultProjectForFile(normalizedFileName, true); - for (var _i = 0, fileNamesInProject_1 = fileNamesInProject; _i < fileNamesInProject_1.length; _i++) { - var fileNameInProject = fileNamesInProject_1[_i]; - if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName)) - highPriorityFiles.push(fileNameInProject); - else { - var info = this.projectService.getScriptInfo(fileNameInProject); - if (!info.isOpen) { - if (fileNameInProject.indexOf(".d.ts") > 0) - veryLowPriorityFiles.push(fileNameInProject); - else - lowPriorityFiles.push(fileNameInProject); - } - else - mediumPriorityFiles.push(fileNameInProject); - } + this.logger.info("Detected source file changes: " + fileName); + this.throttledOperations.schedule(project.getConfigFilePath(), 250, function () { return _this.handleChangeInSourceFileForConfiguredProject(project, fileName); }); + }; + ProjectService.prototype.handleChangeInSourceFileForConfiguredProject = function (project, triggerFile) { + var _this = this; + var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; + this.reportConfigFileDiagnostics(project.getProjectName(), configFileErrors, triggerFile); + var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); + var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); + if (!ts.arrayIsEqualTo(currentRootFiles.sort(), newRootFiles.sort())) { + this.logger.info("Updating configured project"); + this.updateConfiguredProject(project); + this.refreshInferredProjects(); } - fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles); - if (fileNamesInProject.length > 0) { - var checkList = fileNamesInProject.map(function (fileName) { return ({ fileName: fileName, project: project }); }); - this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n == _this.changeSeq; }, delay, 200, false); + }; + ProjectService.prototype.onConfigChangedForConfiguredProject = function (project) { + var configFileName = project.getConfigFilePath(); + this.logger.info("Config file changed: " + configFileName); + var configFileErrors = this.updateConfiguredProject(project); + this.reportConfigFileDiagnostics(configFileName, configFileErrors, configFileName); + this.refreshInferredProjects(); + }; + ProjectService.prototype.onConfigFileAddedForInferredProject = function (fileName) { + if (ts.getBaseFileName(fileName) !== "tsconfig.json") { + this.logger.info(fileName + " is not tsconfig.json"); + return; } + var configFileErrors = this.convertConfigFileContentToProjectOptions(fileName).configFileErrors; + this.reportConfigFileDiagnostics(fileName, configFileErrors, fileName); + this.logger.info("Detected newly added tsconfig file: " + fileName); + this.reloadProjects(); }; - Session.prototype.getCanonicalFileName = function (fileName) { + ProjectService.prototype.getCanonicalFileName = function (fileName) { var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); return ts.normalizePath(name); }; - Session.prototype.exit = function () { - }; - Session.prototype.notRequired = function () { - return { responseRequired: false }; - }; - Session.prototype.requiredResponse = function (response) { - return { response: response, responseRequired: true }; - }; - Session.prototype.addProtocolHandler = function (command, handler) { - if (command in this.handlers) { - throw new Error("Protocol handler already exists for command \"" + command + "\""); - } - this.handlers[command] = handler; - }; - Session.prototype.executeCommand = function (request) { - var handler = this.handlers[request.command]; - if (handler) { - return handler(request); - } - else { - this.logger.msg("Unrecognized JSON command: " + JSON.stringify(request), server.Msg.Err); - this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); - return { responseRequired: false }; + ProjectService.prototype.removeProject = function (project) { + this.logger.info("remove project: " + project.getRootFiles().toString()); + project.close(); + switch (project.projectKind) { + case server.ProjectKind.External: + server.removeItemFromSet(this.externalProjects, project); + this.projectToSizeMap.delete(project.externalProjectName); + break; + case server.ProjectKind.Configured: + server.removeItemFromSet(this.configuredProjects, project); + this.projectToSizeMap.delete(project.canonicalConfigFilePath); + break; + case server.ProjectKind.Inferred: + server.removeItemFromSet(this.inferredProjects, project); + break; } }; - Session.prototype.onMessage = function (message) { - this.gcTimer.scheduleCollect(); - var start; - if (this.logger.hasLevel(server.LogLevel.requestTime)) { - start = this.hrtime(); - if (this.logger.hasLevel(server.LogLevel.verbose)) { - this.logger.info("request: " + message); + ProjectService.prototype.assignScriptInfoToInferredProjectIfNecessary = function (info, addToListOfOpenFiles) { + var externalProject = this.findContainingExternalProject(info.fileName); + if (externalProject) { + if (addToListOfOpenFiles) { + this.openFiles.push(info); } + return; } - var request; - try { - request = JSON.parse(message); - var _a = this.executeCommand(request), response = _a.response, responseRequired = _a.responseRequired; - if (this.logger.hasLevel(server.LogLevel.requestTime)) { - var elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4); - if (responseRequired) { - this.logger.perftrc(request.seq + "::" + request.command + ": elapsed time (in milliseconds) " + elapsedTime); - } - else { - this.logger.perftrc(request.seq + "::" + request.command + ": async elapsed time (in milliseconds) " + elapsedTime); + var foundConfiguredProject = false; + for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + if (p.projectKind === server.ProjectKind.Configured) { + foundConfiguredProject = true; + if (addToListOfOpenFiles) { + (p).addOpenRef(); } } - if (response) { - this.output(response, request.command, request.seq); - } - else if (responseRequired) { - this.output(undefined, request.command, request.seq, "No content available."); - } - } - catch (err) { - if (err instanceof ts.OperationCanceledException) { - this.output({ canceled: true }, request.command, request.seq); - return; - } - this.logError(err, message); - this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message + "\n" + err.stack); - } - }; - return Session; - }()); - server.Session = Session; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - var lineCollectionCapacity = 4; - var CharRangeSection; - (function (CharRangeSection) { - CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; - CharRangeSection[CharRangeSection["Start"] = 1] = "Start"; - CharRangeSection[CharRangeSection["Entire"] = 2] = "Entire"; - CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; - CharRangeSection[CharRangeSection["End"] = 4] = "End"; - CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; - })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {})); - var BaseLineIndexWalker = (function () { - function BaseLineIndexWalker() { - this.goSubtree = true; - this.done = false; - } - BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) { - }; - return BaseLineIndexWalker; - }()); - var EditWalker = (function (_super) { - __extends(EditWalker, _super); - function EditWalker() { - var _this = _super.call(this) || this; - _this.lineIndex = new LineIndex(); - _this.endBranch = []; - _this.state = CharRangeSection.Entire; - _this.initialText = ""; - _this.trailingText = ""; - _this.suppressTrailingText = false; - _this.lineIndex.root = new LineNode(); - _this.startPath = [_this.lineIndex.root]; - _this.stack = [_this.lineIndex.root]; - return _this; - } - EditWalker.prototype.insertLines = function (insertedText) { - if (this.suppressTrailingText) { - this.trailingText = ""; - } - if (insertedText) { - insertedText = this.initialText + insertedText + this.trailingText; - } - else { - insertedText = this.initialText + this.trailingText; } - var lm = LineIndex.linesFromText(insertedText); - var lines = lm.lines; - if (lines.length > 1) { - if (lines[lines.length - 1] == "") { - lines.length--; + if (foundConfiguredProject) { + if (addToListOfOpenFiles) { + this.openFiles.push(info); } + return; } - var branchParent; - var lastZeroCount; - for (var k = this.endBranch.length - 1; k >= 0; k--) { - this.endBranch[k].updateCounts(); - if (this.endBranch[k].charCount() === 0) { - lastZeroCount = this.endBranch[k]; - if (k > 0) { - branchParent = this.endBranch[k - 1]; - } - else { - branchParent = this.branchNode; + if (info.containingProjects.length === 0) { + var inferredProject = this.createInferredProjectWithRootFileIfNecessary(info); + if (!this.useSingleInferredProject) { + for (var _b = 0, _c = this.openFiles; _b < _c.length; _b++) { + var f = _c[_b]; + if (f.containingProjects.length === 0 || !inferredProject.containsScriptInfo(f)) { + continue; + } + for (var _d = 0, _e = f.containingProjects; _d < _e.length; _d++) { + var fContainingProject = _e[_d]; + if (fContainingProject.projectKind === server.ProjectKind.Inferred && + fContainingProject.isRoot(f) && + fContainingProject !== inferredProject) { + this.removeProject(fContainingProject); + f.attachToProject(inferredProject); + } + } } } } - if (lastZeroCount) { - branchParent.remove(lastZeroCount); + if (addToListOfOpenFiles) { + this.openFiles.push(info); } - var insertionNode = this.startPath[this.startPath.length - 2]; - var leafNode = this.startPath[this.startPath.length - 1]; - var len = lines.length; - if (len > 0) { - leafNode.text = lines[0]; - if (len > 1) { - var insertedNodes = new Array(len - 1); - var startNode = leafNode; - for (var i = 1, len_1 = lines.length; i < len_1; i++) { - insertedNodes[i - 1] = new LineLeaf(lines[i]); - } - var pathIndex = this.startPath.length - 2; - while (pathIndex >= 0) { - insertionNode = this.startPath[pathIndex]; - insertedNodes = insertionNode.insertAt(startNode, insertedNodes); - pathIndex--; - startNode = insertionNode; + }; + ProjectService.prototype.closeOpenFile = function (info) { + info.close(); + server.removeItemFromSet(this.openFiles, info); + var projectsToRemove; + for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { + var p = _a[_i]; + if (p.projectKind === server.ProjectKind.Configured) { + if (info.hasMixedContent) { + info.registerFileUpdate(); } - var insertedNodesLen = insertedNodes.length; - while (insertedNodesLen > 0) { - var newRoot = new LineNode(); - newRoot.add(this.lineIndex.root); - insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); - insertedNodesLen = insertedNodes.length; - this.lineIndex.root = newRoot; + if (p.deleteOpenRef() === 0) { + (projectsToRemove || (projectsToRemove = [])).push(p); } - this.lineIndex.root.updateCounts(); } - else { - for (var j = this.startPath.length - 2; j >= 0; j--) { - this.startPath[j].updateCounts(); - } + else if (p.projectKind === server.ProjectKind.Inferred && p.isRoot(info)) { + (projectsToRemove || (projectsToRemove = [])).push(p); + } + if (!p.languageServiceEnabled) { + p.markAsDirty(); } } - else { - insertionNode.remove(leafNode); - for (var j = this.startPath.length - 2; j >= 0; j--) { - this.startPath[j].updateCounts(); + if (projectsToRemove) { + for (var _b = 0, projectsToRemove_1 = projectsToRemove; _b < projectsToRemove_1.length; _b++) { + var project = projectsToRemove_1[_b]; + this.removeProject(project); + } + var orphanFiles = void 0; + for (var _c = 0, _d = this.openFiles; _c < _d.length; _c++) { + var f = _d[_c]; + if (f.containingProjects.length === 0) { + (orphanFiles || (orphanFiles = [])).push(f); + } + } + if (orphanFiles) { + for (var _e = 0, orphanFiles_1 = orphanFiles; _e < orphanFiles_1.length; _e++) { + var f = orphanFiles_1[_e]; + this.assignScriptInfoToInferredProjectIfNecessary(f, false); + } } } - return this.lineIndex; - }; - EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) { - if (lineCollection === this.lineCollectionAtBranch) { - this.state = CharRangeSection.End; + if (info.containingProjects.length === 0) { + this.filenameToScriptInfo.remove(info.path); } - this.stack.length--; - return undefined; }; - EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) { - var currentNode = this.stack[this.stack.length - 1]; - if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { - this.state = CharRangeSection.Start; - this.branchNode = currentNode; - this.lineCollectionAtBranch = lineCollection; + ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) { + var searchPath = ts.getDirectoryPath(fileName); + this.logger.info("Search path: " + searchPath); + var configFileName = this.findConfigFile(server.asNormalizedPath(searchPath)); + if (!configFileName) { + this.logger.info("No config files found."); + return {}; } - var child; - function fresh(node) { - if (node.isLeaf()) { - return new LineLeaf(""); + this.logger.info("Config file name: " + configFileName); + var project = this.findConfiguredProjectByProjectName(configFileName); + if (!project) { + var _a = this.openConfigFile(configFileName, fileName), success = _a.success, errors = _a.errors; + if (!success) { + return { configFileName: configFileName, configFileErrors: errors }; + } + this.logger.info("Opened configuration file " + configFileName); + if (errors && errors.length > 0) { + return { configFileName: configFileName, configFileErrors: errors }; } - else - return new LineNode(); } - switch (nodeType) { - case CharRangeSection.PreStart: - this.goSubtree = false; - if (this.state !== CharRangeSection.End) { - currentNode.add(lineCollection); - } - break; - case CharRangeSection.Start: - if (this.state === CharRangeSection.End) { - this.goSubtree = false; - } - else { - child = fresh(lineCollection); - currentNode.add(child); - this.startPath[this.startPath.length] = child; - } - break; - case CharRangeSection.Entire: - if (this.state !== CharRangeSection.End) { - child = fresh(lineCollection); - currentNode.add(child); - this.startPath[this.startPath.length] = child; - } - else { - if (!lineCollection.isLeaf()) { - child = fresh(lineCollection); - currentNode.add(child); - this.endBranch[this.endBranch.length] = child; - } - } - break; - case CharRangeSection.Mid: - this.goSubtree = false; - break; - case CharRangeSection.End: - if (this.state !== CharRangeSection.End) { - this.goSubtree = false; - } - else { - if (!lineCollection.isLeaf()) { - child = fresh(lineCollection); - currentNode.add(child); - this.endBranch[this.endBranch.length] = child; - } - } - break; - case CharRangeSection.PostEnd: - this.goSubtree = false; - if (this.state !== CharRangeSection.Start) { - currentNode.add(lineCollection); - } + else { + this.updateConfiguredProject(project); + } + return { configFileName: configFileName }; + }; + ProjectService.prototype.findConfigFile = function (searchPath) { + while (true) { + var tsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "tsconfig.json")); + if (this.host.fileExists(tsconfigFileName)) { + return tsconfigFileName; + } + var jsconfigFileName = server.asNormalizedPath(ts.combinePaths(searchPath, "jsconfig.json")); + if (this.host.fileExists(jsconfigFileName)) { + return jsconfigFileName; + } + var parentPath = server.asNormalizedPath(ts.getDirectoryPath(searchPath)); + if (parentPath === searchPath) { break; + } + searchPath = parentPath; } - if (this.goSubtree) { - this.stack[this.stack.length] = child; - } - return lineCollection; + return undefined; }; - EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { - if (this.state === CharRangeSection.Start) { - this.initialText = ll.text.substring(0, relativeStart); + ProjectService.prototype.printProjects = function () { + if (!this.logger.hasLevel(server.LogLevel.verbose)) { + return; } - else if (this.state === CharRangeSection.Entire) { - this.initialText = ll.text.substring(0, relativeStart); - this.trailingText = ll.text.substring(relativeStart + relativeLength); + this.logger.startGroup(); + var counter = 0; + counter = printProjects(this.logger, this.externalProjects, counter); + counter = printProjects(this.logger, this.configuredProjects, counter); + counter = printProjects(this.logger, this.inferredProjects, counter); + this.logger.info("Open files: "); + for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { + var rootFile = _a[_i]; + this.logger.info(rootFile.fileName); } - else { - this.trailingText = ll.text.substring(relativeStart + relativeLength); + this.logger.endGroup(); + function printProjects(logger, projects, counter) { + for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { + var project = projects_4[_i]; + project.updateGraph(); + logger.info("Project '" + project.getProjectName() + "' (" + server.ProjectKind[project.projectKind] + ") " + counter); + logger.info(project.filesToString()); + logger.info("-----------------------------------------------"); + counter++; + } + return counter; } }; - return EditWalker; - }(BaseLineIndexWalker)); - var TextChange = (function () { - function TextChange(pos, deleteLen, insertedText) { - this.pos = pos; - this.deleteLen = deleteLen; - this.insertedText = insertedText; - } - TextChange.prototype.getTextChangeRange = function () { - return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); - }; - return TextChange; - }()); - server.TextChange = TextChange; - var ScriptVersionCache = (function () { - function ScriptVersionCache() { - this.changes = []; - this.versions = new Array(ScriptVersionCache.maxVersions); - this.minVersion = 0; - this.currentVersion = 0; - } - ScriptVersionCache.prototype.versionToIndex = function (version) { - if (version < this.minVersion || version > this.currentVersion) { - return undefined; + ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) { + configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName)); + for (var _i = 0, _a = this.configuredProjects; _i < _a.length; _i++) { + var proj = _a[_i]; + if (proj.canonicalConfigFilePath === configFileName) { + return proj; + } } - return version % ScriptVersionCache.maxVersions; }; - ScriptVersionCache.prototype.currentVersionToIndex = function () { - return this.currentVersion % ScriptVersionCache.maxVersions; + ProjectService.prototype.findExternalProjectByProjectName = function (projectFileName) { + return findProjectByName(projectFileName, this.externalProjects); }; - ScriptVersionCache.prototype.edit = function (pos, deleteLen, insertedText) { - this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); - if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || - (deleteLen > ScriptVersionCache.changeLengthThreshold) || - (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { - this.getSnapshot(); + ProjectService.prototype.convertConfigFileContentToProjectOptions = function (configFilename) { + configFilename = ts.normalizePath(configFilename); + var configFileContent = this.host.readFile(configFilename); + var errors; + var result = ts.parseConfigFileTextToJson(configFilename, configFileContent); + var config = result.config; + if (result.error) { + var _a = ts.sanitizeConfigFile(configFilename, configFileContent), sanitizedConfig = _a.configJsonObject, diagnostics = _a.diagnostics; + config = sanitizedConfig; + errors = diagnostics.length ? diagnostics : [result.error]; } + var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename, [], this.hostConfiguration.extraFileExtensions); + if (parsedCommandLine.errors.length) { + errors = ts.concatenate(errors, parsedCommandLine.errors); + } + ts.Debug.assert(!!parsedCommandLine.fileNames); + if (parsedCommandLine.fileNames.length === 0) { + (errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename)); + return { success: false, configFileErrors: errors }; + } + var projectOptions = { + files: parsedCommandLine.fileNames, + compilerOptions: parsedCommandLine.options, + configHasFilesProperty: config["files"] !== undefined, + wildcardDirectories: ts.createMapFromTemplate(parsedCommandLine.wildcardDirectories), + typeAcquisition: parsedCommandLine.typeAcquisition, + compileOnSave: parsedCommandLine.compileOnSave + }; + return { success: true, projectOptions: projectOptions, configFileErrors: errors }; }; - ScriptVersionCache.prototype.latest = function () { - return this.versions[this.currentVersionToIndex()]; - }; - ScriptVersionCache.prototype.latestVersion = function () { - if (this.changes.length > 0) { - this.getSnapshot(); + ProjectService.prototype.exceededTotalSizeLimitForNonTsFiles = function (name, options, fileNames, propertyReader) { + if (options && options.disableSizeLimit || !this.host.getFileSize) { + return false; } - return this.currentVersion; + var availableSpace = server.maxProgramSizeForNonTsFiles; + this.projectToSizeMap.set(name, 0); + this.projectToSizeMap.forEach(function (val) { return (availableSpace -= (val || 0)); }); + var totalNonTsFileSize = 0; + for (var _i = 0, fileNames_3 = fileNames; _i < fileNames_3.length; _i++) { + var f = fileNames_3[_i]; + var fileName = propertyReader.getFileName(f); + if (ts.hasTypeScriptFileExtension(fileName)) { + continue; + } + totalNonTsFileSize += this.host.getFileSize(fileName); + if (totalNonTsFileSize > server.maxProgramSizeForNonTsFiles) { + return true; + } + } + if (totalNonTsFileSize > availableSpace) { + return true; + } + this.projectToSizeMap.set(name, totalNonTsFileSize); + return false; }; - ScriptVersionCache.prototype.reloadFromFile = function (filename) { - var content = this.host.readFile(filename); - if (!content) { - content = ""; + ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typeAcquisition) { + var compilerOptions = convertCompilerOptions(options); + var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); + this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typeAcquisition, undefined); + this.externalProjects.push(project); + return project; + }; + ProjectService.prototype.reportConfigFileDiagnostics = function (configFileName, diagnostics, triggerFile) { + if (!this.eventHandler) { + return; } - this.reload(content); + this.eventHandler({ + eventName: server.ConfigFileDiagEvent, + data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile } + }); }; - ScriptVersionCache.prototype.reload = function (script) { - this.currentVersion++; - this.changes = []; - var snap = new LineIndexSnapshot(this.currentVersion, this); - for (var i = 0; i < this.versions.length; i++) { - this.versions[i] = undefined; + ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) { + var _this = this; + var sizeLimitExceeded = this.exceededTotalSizeLimitForNonTsFiles(configFileName, projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader); + var project = new server.ConfiguredProject(configFileName, this, this.documentRegistry, projectOptions.configHasFilesProperty, projectOptions.compilerOptions, projectOptions.wildcardDirectories, !sizeLimitExceeded, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave); + this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors); + project.watchConfigFile(function (project) { return _this.onConfigChangedForConfiguredProject(project); }); + if (!sizeLimitExceeded) { + this.watchConfigDirectoryForProject(project, projectOptions); } - this.versions[this.currentVersionToIndex()] = snap; - snap.index = new LineIndex(); - var lm = LineIndex.linesFromText(script); - snap.index.load(lm.lines); - this.minVersion = this.currentVersion; + project.watchWildcards(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); }); + project.watchTypeRoots(function (project, path) { return _this.onTypeRootFileChanged(project, path); }); + this.configuredProjects.push(project); + return project; }; - ScriptVersionCache.prototype.getSnapshot = function () { - var snap = this.versions[this.currentVersionToIndex()]; - if (this.changes.length > 0) { - var snapIndex = snap.index; - for (var i = 0, len = this.changes.length; i < len; i++) { - var change = this.changes[i]; - snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); - } - snap = new LineIndexSnapshot(this.currentVersion + 1, this); - snap.index = snapIndex; - snap.changesSincePreviousVersion = this.changes; - this.currentVersion = snap.version; - this.versions[this.currentVersionToIndex()] = snap; - this.changes = []; - if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { - this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; - } + ProjectService.prototype.watchConfigDirectoryForProject = function (project, options) { + var _this = this; + if (!options.configHasFilesProperty) { + project.watchConfigDirectory(function (project, path) { return _this.onSourceFileInDirectoryChangedForConfiguredProject(project, path); }); } - return snap; }; - ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { - if (oldVersion < newVersion) { - if (oldVersion >= this.minVersion) { - var textChangeRanges = []; - for (var i = oldVersion + 1; i <= newVersion; i++) { - var snap = this.versions[this.versionToIndex(i)]; - for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { - var textChange = snap.changesSincePreviousVersion[j]; - textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); - } - } - return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); + ProjectService.prototype.addFilesToProjectAndUpdateGraph = function (project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors) { + var errors; + for (var _i = 0, files_4 = files; _i < files_4.length; _i++) { + var f = files_4[_i]; + var rootFilename = propertyReader.getFileName(f); + var scriptKind = propertyReader.getScriptKind(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); + if (this.host.fileExists(rootFilename)) { + var info = this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(rootFilename), clientFileName === rootFilename, undefined, scriptKind, hasMixedContent); + project.addRoot(info); } else { - return undefined; + (errors || (errors = [])).push(createFileNotFoundDiagnostic(rootFilename)); } } - else { - return ts.unchangedTextChangeRange; - } - }; - ScriptVersionCache.fromString = function (host, script) { - var svc = new ScriptVersionCache(); - var snap = new LineIndexSnapshot(0, svc); - svc.versions[svc.currentVersion] = snap; - svc.host = host; - snap.index = new LineIndex(); - var lm = LineIndex.linesFromText(script); - snap.index.load(lm.lines); - return svc; - }; - return ScriptVersionCache; - }()); - ScriptVersionCache.changeNumberThreshold = 8; - ScriptVersionCache.changeLengthThreshold = 256; - ScriptVersionCache.maxVersions = 8; - server.ScriptVersionCache = ScriptVersionCache; - var LineIndexSnapshot = (function () { - function LineIndexSnapshot(version, cache) { - this.version = version; - this.cache = cache; - this.changesSincePreviousVersion = []; - } - LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { - return this.index.getText(rangeStart, rangeEnd - rangeStart); - }; - LineIndexSnapshot.prototype.getLength = function () { - return this.index.root.charCount(); - }; - LineIndexSnapshot.prototype.getLineStartPositions = function () { - var starts = [-1]; - var count = 1; - var pos = 0; - this.index.every(function (ll) { - starts[count] = pos; - count++; - pos += ll.text.length; - return true; - }, 0); - return starts; + project.setProjectErrors(ts.concatenate(configFileErrors, errors)); + project.setTypeAcquisition(typeAcquisition); + project.updateGraph(); }; - LineIndexSnapshot.prototype.getLineMapper = function () { - var _this = this; - return function (line) { - return _this.index.lineNumberToInfo(line).offset; + ProjectService.prototype.openConfigFile = function (configFileName, clientFileName) { + var conversionResult = this.convertConfigFileContentToProjectOptions(configFileName); + var projectOptions = conversionResult.success + ? conversionResult.projectOptions + : { files: [], compilerOptions: {}, typeAcquisition: { enable: false } }; + var project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName); + return { + success: conversionResult.success, + project: project, + errors: project.getProjectErrors() }; }; - LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { - if (this.version <= scriptVersion) { - return ts.unchangedTextChangeRange; + ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) { + var oldRootScriptInfos = project.getRootScriptInfos(); + var newRootScriptInfos = []; + var newRootScriptInfoMap = server.createNormalizedPathMap(); + var projectErrors; + var rootFilesChanged = false; + for (var _i = 0, newUncheckedFiles_1 = newUncheckedFiles; _i < newUncheckedFiles_1.length; _i++) { + var f = newUncheckedFiles_1[_i]; + var newRootFile = propertyReader.getFileName(f); + if (!this.host.fileExists(newRootFile)) { + (projectErrors || (projectErrors = [])).push(createFileNotFoundDiagnostic(newRootFile)); + continue; + } + var normalizedPath = server.toNormalizedPath(newRootFile); + var scriptInfo = this.getScriptInfoForNormalizedPath(normalizedPath); + if (!scriptInfo || !project.isRoot(scriptInfo)) { + rootFilesChanged = true; + if (!scriptInfo) { + var scriptKind = propertyReader.getScriptKind(f); + var hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); + scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, false, undefined, scriptKind, hasMixedContent); + } + } + newRootScriptInfos.push(scriptInfo); + newRootScriptInfoMap.set(scriptInfo.fileName, scriptInfo); } - else { - return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); + if (rootFilesChanged || newRootScriptInfos.length !== oldRootScriptInfos.length) { + var toAdd = void 0; + var toRemove = void 0; + for (var _a = 0, oldRootScriptInfos_1 = oldRootScriptInfos; _a < oldRootScriptInfos_1.length; _a++) { + var oldFile = oldRootScriptInfos_1[_a]; + if (!newRootScriptInfoMap.contains(oldFile.fileName)) { + (toRemove || (toRemove = [])).push(oldFile); + } + } + for (var _b = 0, newRootScriptInfos_1 = newRootScriptInfos; _b < newRootScriptInfos_1.length; _b++) { + var newFile = newRootScriptInfos_1[_b]; + if (!project.isRoot(newFile)) { + (toAdd || (toAdd = [])).push(newFile); + } + } + if (toRemove) { + for (var _c = 0, toRemove_1 = toRemove; _c < toRemove_1.length; _c++) { + var f = toRemove_1[_c]; + project.removeFile(f); + } + } + if (toAdd) { + for (var _d = 0, toAdd_1 = toAdd; _d < toAdd_1.length; _d++) { + var f = toAdd_1[_d]; + if (f.isScriptOpen() && isRootFileInInferredProject(f)) { + var inferredProject = f.containingProjects[0]; + inferredProject.removeFile(f); + if (!inferredProject.hasRoots()) { + this.removeProject(inferredProject); + } + } + project.addRoot(f); + } + } } + project.setCompilerOptions(newOptions); + project.setTypeAcquisition(newTypeAcquisition); + if (compileOnSave !== undefined) { + project.compileOnSaveEnabled = compileOnSave; + } + project.setProjectErrors(ts.concatenate(configFileErrors, projectErrors)); + project.updateGraph(); }; - LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { - var oldSnap = oldSnapshot; - return this.getTextChangeRangeSinceVersion(oldSnap.version); - }; - return LineIndexSnapshot; - }()); - server.LineIndexSnapshot = LineIndexSnapshot; - var LineIndex = (function () { - function LineIndex() { - this.checkEdits = false; - } - LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { - return this.root.charOffsetToLineNumberAndPos(1, charOffset); - }; - LineIndex.prototype.lineNumberToInfo = function (lineNumber) { - var lineCount = this.root.lineCount(); - if (lineNumber <= lineCount) { - var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); - lineInfo.line = lineNumber; - return lineInfo; + ProjectService.prototype.updateConfiguredProject = function (project) { + if (!this.host.fileExists(project.getConfigFilePath())) { + this.logger.info("Config file deleted"); + this.removeProject(project); + return; } - else { - return { - line: lineNumber, - offset: this.root.charCount() - }; + var _a = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()), success = _a.success, projectOptions = _a.projectOptions, configFileErrors = _a.configFileErrors; + if (!success) { + this.updateNonInferredProject(project, [], fileNamePropertyReader, {}, {}, false, configFileErrors); + return configFileErrors; } - }; - LineIndex.prototype.load = function (lines) { - if (lines.length > 0) { - var leaves = []; - for (var i = 0, len = lines.length; i < len; i++) { - leaves[i] = new LineLeaf(lines[i]); + if (this.exceededTotalSizeLimitForNonTsFiles(project.canonicalConfigFilePath, projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader)) { + project.setCompilerOptions(projectOptions.compilerOptions); + if (!project.languageServiceEnabled) { + return configFileErrors; } - this.root = LineIndex.buildTreeFromBottom(leaves); + project.disableLanguageService(); + project.stopWatchingDirectory(); } else { - this.root = new LineNode(); + project.enableLanguageService(); + this.watchConfigDirectoryForProject(project, projectOptions); + this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); } + return configFileErrors; }; - LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) { - this.root.walk(rangeStart, rangeLength, walkFns); - }; - LineIndex.prototype.getText = function (rangeStart, rangeLength) { - var accum = ""; - if ((rangeLength > 0) && (rangeStart < this.root.charCount())) { - this.walk(rangeStart, rangeLength, { - goSubtree: true, - done: false, - leaf: function (relativeStart, relativeLength, ll) { - accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); - } - }); + ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) { + var _this = this; + var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length; + var project = useExistingProject + ? this.inferredProjects[0] + : new server.InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); + project.addRoot(root); + this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); }); + project.updateGraph(); + if (!useExistingProject) { + this.inferredProjects.push(project); } - return accum; + return project; }; - LineIndex.prototype.getLength = function () { - return this.root.charCount(); + ProjectService.prototype.getOrCreateScriptInfo = function (uncheckedFileName, openedByClient, fileContent, scriptKind) { + return this.getOrCreateScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName), openedByClient, fileContent, scriptKind); }; - LineIndex.prototype.every = function (f, rangeStart, rangeEnd) { - if (!rangeEnd) { - rangeEnd = this.root.charCount(); - } - var walkFns = { - goSubtree: true, - done: false, - leaf: function (relativeStart, relativeLength, ll) { - if (!f(ll, relativeStart, relativeLength)) { - this.done = true; - } - } - }; - this.walk(rangeStart, rangeEnd - rangeStart, walkFns); - return !walkFns.done; + ProjectService.prototype.getScriptInfo = function (uncheckedFileName) { + return this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); }; - LineIndex.prototype.edit = function (pos, deleteLength, newText) { - function editFlat(source, s, dl, nt) { - if (nt === void 0) { nt = ""; } - return source.substring(0, s) + nt + source.substring(s + dl, source.length); - } - if (this.root.charCount() === 0) { - if (newText !== undefined) { - this.load(LineIndex.linesFromText(newText).lines); - return this; - } - } - else { - var checkText = void 0; - if (this.checkEdits) { - checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); - } - var walker = new EditWalker(); - if (pos >= this.root.charCount()) { - pos = this.root.charCount() - 1; - var endString = this.getText(pos, 1); - if (newText) { - newText = endString + newText; + ProjectService.prototype.getOrCreateScriptInfoForNormalizedPath = function (fileName, openedByClient, fileContent, scriptKind, hasMixedContent) { + var _this = this; + var info = this.getScriptInfoForNormalizedPath(fileName); + if (!info) { + if (openedByClient || this.host.fileExists(fileName)) { + info = new server.ScriptInfo(this.host, fileName, scriptKind, hasMixedContent); + this.filenameToScriptInfo.set(info.path, info); + if (openedByClient) { + if (fileContent === undefined) { + fileContent = this.host.readFile(fileName) || ""; + } } else { - newText = endString; - } - deleteLength = 0; - walker.suppressTrailingText = true; - } - else if (deleteLength > 0) { - var e = pos + deleteLength; - var lineInfo = this.charOffsetToLineNumberAndPos(e); - if ((lineInfo && (lineInfo.offset === 0))) { - deleteLength += lineInfo.text.length; - if (newText) { - newText = newText + lineInfo.text; - } - else { - newText = lineInfo.text; + if (!hasMixedContent) { + info.setWatcher(this.host.watchFile(fileName, function (_) { return _this.onSourceFileChanged(fileName); })); } } } - if (pos < this.root.charCount()) { - this.root.walk(pos, deleteLength, walker); - walker.insertLines(newText); + } + if (info) { + if (openedByClient && !info.isScriptOpen()) { + info.open(fileContent); + if (hasMixedContent) { + info.registerFileUpdate(); + } } - if (this.checkEdits) { - var updatedText = this.getText(0, this.root.charCount()); - ts.Debug.assert(checkText == updatedText, "buffer edit mismatch"); + else if (fileContent !== undefined) { + info.reload(fileContent); } - return walker.lineIndex; } + return info; }; - LineIndex.buildTreeFromBottom = function (nodes) { - var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); - var interiorNodes = []; - var nodeIndex = 0; - for (var i = 0; i < nodeCount; i++) { - interiorNodes[i] = new LineNode(); - var charCount = 0; - var lineCount = 0; - for (var j = 0; j < lineCollectionCapacity; j++) { - if (nodeIndex < nodes.length) { - interiorNodes[i].add(nodes[nodeIndex]); - charCount += nodes[nodeIndex].charCount(); - lineCount += nodes[nodeIndex].lineCount(); - } - else { - break; - } - nodeIndex++; + ProjectService.prototype.getScriptInfoForNormalizedPath = function (fileName) { + return this.getScriptInfoForPath(server.normalizedPathToPath(fileName, this.host.getCurrentDirectory(), this.toCanonicalFileName)); + }; + ProjectService.prototype.getScriptInfoForPath = function (fileName) { + return this.filenameToScriptInfo.get(fileName); + }; + ProjectService.prototype.setHostConfiguration = function (args) { + if (args.file) { + var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(args.file)); + if (info) { + info.setFormatOptions(convertFormatOptions(args.formatOptions)); + this.logger.info("Host configuration update for file " + args.file); } - interiorNodes[i].totalChars = charCount; - interiorNodes[i].totalLines = lineCount; - } - if (interiorNodes.length === 1) { - return interiorNodes[0]; } else { - return this.buildTreeFromBottom(interiorNodes); + if (args.hostInfo !== undefined) { + this.hostConfiguration.hostInfo = args.hostInfo; + this.logger.info("Host information " + args.hostInfo); + } + if (args.formatOptions) { + server.mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); + this.logger.info("Format host information updated"); + } + if (args.extraFileExtensions) { + this.hostConfiguration.extraFileExtensions = args.extraFileExtensions; + this.logger.info("Host file extension mappings updated"); + } } }; - LineIndex.linesFromText = function (text) { - var lineStarts = ts.computeLineStarts(text); - if (lineStarts.length === 0) { - return { lines: [], lineMap: lineStarts }; + ProjectService.prototype.closeLog = function () { + this.logger.close(); + }; + ProjectService.prototype.reloadProjects = function () { + this.logger.info("reload projects."); + for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { + var info = _a[_i]; + this.openOrUpdateConfiguredProjectForFile(info.fileName); } - var lines = new Array(lineStarts.length); - var lc = lineStarts.length - 1; - for (var lmi = 0; lmi < lc; lmi++) { - lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + this.refreshInferredProjects(); + }; + ProjectService.prototype.refreshInferredProjects = function () { + this.logger.info("updating project structure from ..."); + this.printProjects(); + var orphantedFiles = []; + for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { + var info = _a[_i]; + if (info.containingProjects.length === 0) { + orphantedFiles.push(info); + } + else { + if (isRootFileInInferredProject(info) && info.containingProjects.length > 1) { + var inferredProject = info.containingProjects[0]; + ts.Debug.assert(inferredProject.projectKind === server.ProjectKind.Inferred); + inferredProject.removeFile(info); + if (!inferredProject.hasRoots()) { + this.removeProject(inferredProject); + } + } + } } - var endText = text.substring(lineStarts[lc]); - if (endText.length > 0) { - lines[lc] = endText; + for (var _b = 0, orphantedFiles_1 = orphantedFiles; _b < orphantedFiles_1.length; _b++) { + var f = orphantedFiles_1[_b]; + this.assignScriptInfoToInferredProjectIfNecessary(f, false); } - else { - lines.length--; + for (var _c = 0, _d = this.inferredProjects; _c < _d.length; _c++) { + var p = _d[_c]; + p.updateGraph(); } - return { lines: lines, lineMap: lineStarts }; - }; - return LineIndex; - }()); - server.LineIndex = LineIndex; - var LineNode = (function () { - function LineNode() { - this.totalChars = 0; - this.totalLines = 0; - this.children = []; - } - LineNode.prototype.isLeaf = function () { - return false; + this.printProjects(); }; - LineNode.prototype.updateCounts = function () { - this.totalChars = 0; - this.totalLines = 0; - for (var i = 0, len = this.children.length; i < len; i++) { - var child = this.children[i]; - this.totalChars += child.charCount(); - this.totalLines += child.lineCount(); - } + ProjectService.prototype.openClientFile = function (fileName, fileContent, scriptKind) { + return this.openClientFileWithNormalizedPath(server.toNormalizedPath(fileName), fileContent, scriptKind); }; - LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { - if (walkFns.pre) { - walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); - } - if (walkFns.goSubtree) { - this.children[childIndex].walk(rangeStart, rangeLength, walkFns); - if (walkFns.post) { - walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + ProjectService.prototype.openClientFileWithNormalizedPath = function (fileName, fileContent, scriptKind, hasMixedContent) { + var configFileName; + var configFileErrors; + var project = this.findContainingExternalProject(fileName); + if (!project) { + (_a = this.openOrUpdateConfiguredProjectForFile(fileName), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors); + if (configFileName) { + project = this.findConfiguredProjectByProjectName(configFileName); } } - else { - walkFns.goSubtree = true; + if (project && !project.languageServiceEnabled) { + project.markAsDirty(); } - return walkFns.done; + var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent); + this.assignScriptInfoToInferredProjectIfNecessary(info, true); + this.printProjects(); + return { configFileName: configFileName, configFileErrors: configFileErrors }; + var _a; }; - LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { - if (walkFns.pre && (!walkFns.done)) { - walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); - walkFns.goSubtree = true; + ProjectService.prototype.closeClientFile = function (uncheckedFileName) { + var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(uncheckedFileName)); + if (info) { + this.closeOpenFile(info); } + this.printProjects(); }; - LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { - var childIndex = 0; - var child = this.children[0]; - var childCharCount = child.charCount(); - var adjustedStart = rangeStart; - while (adjustedStart >= childCharCount) { - this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); - adjustedStart -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); + ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { + var _loop_7 = function (proj) { + var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); + result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); + }; + for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { + var proj = currentProjects_1[_i]; + _loop_7(proj); } - if ((adjustedStart + rangeLength) <= childCharCount) { - if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { - return; + }; + ProjectService.prototype.synchronizeProjectList = function (knownProjects) { + var files = []; + this.collectChanges(knownProjects, this.externalProjects, files); + this.collectChanges(knownProjects, this.configuredProjects, files); + this.collectChanges(knownProjects, this.inferredProjects, files); + return files; + }; + ProjectService.prototype.applyChangesInOpenFiles = function (openFiles, changedFiles, closedFiles) { + var recordChangedFiles = changedFiles && !openFiles && !closedFiles; + if (openFiles) { + for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) { + var file = openFiles_1[_i]; + var scriptInfo = this.getScriptInfo(file.fileName); + ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen()); + var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName); + this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); } } - else { - if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { - return; - } - var adjustedLength = rangeLength - (childCharCount - adjustedStart); - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - while (adjustedLength > childCharCount) { - if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { - return; + if (changedFiles) { + for (var _a = 0, changedFiles_2 = changedFiles; _a < changedFiles_2.length; _a++) { + var file = changedFiles_2[_a]; + var scriptInfo = this.getScriptInfo(file.fileName); + ts.Debug.assert(!!scriptInfo); + for (var i = file.changes.length - 1; i >= 0; i--) { + var change = file.changes[i]; + scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText); } - adjustedLength -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - } - if (adjustedLength > 0) { - if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { - return; + if (recordChangedFiles) { + if (!this.changedFiles) { + this.changedFiles = [scriptInfo]; + } + else if (this.changedFiles.indexOf(scriptInfo) < 0) { + this.changedFiles.push(scriptInfo); + } } } } - if (walkFns.pre) { - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var ej = childIndex + 1; ej < clen; ej++) { - this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); - } + if (closedFiles) { + for (var _b = 0, closedFiles_1 = closedFiles; _b < closedFiles_1.length; _b++) { + var file = closedFiles_1[_b]; + this.closeClientFile(file); } } + if (openFiles || closedFiles) { + this.refreshInferredProjects(); + } }; - LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { - var childInfo = this.childFromCharOffset(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset, - }; + ProjectService.prototype.closeConfiguredProject = function (configFile) { + var configuredProject = this.findConfiguredProjectByProjectName(configFile); + if (configuredProject && configuredProject.deleteOpenRef() === 0) { + this.removeProject(configuredProject); } - else if (childInfo.childIndex < this.children.length) { - if (childInfo.child.isLeaf()) { - return { - line: childInfo.lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; + }; + ProjectService.prototype.closeExternalProject = function (uncheckedFileName, suppressRefresh) { + if (suppressRefresh === void 0) { suppressRefresh = false; } + var fileName = server.toNormalizedPath(uncheckedFileName); + var configFiles = this.externalProjectToConfiguredProjectMap.get(fileName); + if (configFiles) { + var shouldRefreshInferredProjects = false; + for (var _i = 0, configFiles_1 = configFiles; _i < configFiles_1.length; _i++) { + var configFile = configFiles_1[_i]; + if (this.closeConfiguredProject(configFile)) { + shouldRefreshInferredProjects = true; + } } - else { - var lineNode = (childInfo.child); - return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + this.externalProjectToConfiguredProjectMap.delete(fileName); + if (shouldRefreshInferredProjects && !suppressRefresh) { + this.refreshInferredProjects(); } } else { - var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); - return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; + var externalProject = this.findExternalProjectByProjectName(uncheckedFileName); + if (externalProject) { + this.removeProject(externalProject); + if (!suppressRefresh) { + this.refreshInferredProjects(); + } + } } }; - LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { - var childInfo = this.childFromLineNumber(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset - }; - } - else if (childInfo.child.isLeaf()) { - return { - line: lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; + ProjectService.prototype.openExternalProjects = function (projects) { + var _this = this; + var projectsToClose = ts.arrayToMap(this.externalProjects, function (p) { return p.getProjectName(); }, function (_) { return true; }); + ts.forEachKey(this.externalProjectToConfiguredProjectMap, function (externalProjectName) { + projectsToClose.set(externalProjectName, true); + }); + for (var _i = 0, projects_5 = projects; _i < projects_5.length; _i++) { + var externalProject = projects_5[_i]; + this.openExternalProject(externalProject, true); + projectsToClose.delete(externalProject.projectFileName); } - else { - var lineNode = (childInfo.child); - return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + ts.forEachKey(projectsToClose, function (externalProjectName) { + _this.closeExternalProject(externalProjectName, true); + }); + this.refreshInferredProjects(); + }; + ProjectService.escapeFilenameForRegex = function (filename) { + return filename.replace(this.filenameEscapeRegexp, "\\$&"); + }; + ProjectService.prototype.resetSafeList = function () { + ProjectService.safelist = defaultTypeSafeList; + }; + ProjectService.prototype.loadSafeList = function (fileName) { + var raw = JSON.parse(this.host.readFile(fileName, "utf-8")); + for (var _i = 0, _a = Object.keys(raw); _i < _a.length; _i++) { + var k = _a[_i]; + raw[k].match = new RegExp(raw[k].match, "i"); } + ProjectService.safelist = raw; }; - LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { - var child; - var relativeLineNumber = lineNumber; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - var childLineCount = child.lineCount(); - if (childLineCount >= relativeLineNumber) { - break; + ProjectService.prototype.applySafeList = function (proj) { + var _this = this; + var rootFiles = proj.rootFiles, typeAcquisition = proj.typeAcquisition; + var types = (typeAcquisition && typeAcquisition.include) || []; + var excludeRules = []; + var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); }); + var _loop_8 = function (name) { + var rule = ProjectService.safelist[name]; + for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) { + var root = normalizedNames_1[_i]; + if (rule.match.test(root)) { + this_2.logger.info("Excluding files based on rule " + name); + if (rule.types) { + for (var _a = 0, _b = rule.types; _a < _b.length; _a++) { + var type = _b[_a]; + if (types.indexOf(type) < 0) { + types.push(type); + } + } + } + if (rule.exclude) { + var _loop_9 = function (exclude) { + var processedRule = root.replace(rule.match, function () { + var groups = []; + for (var _i = 0; _i < arguments.length; _i++) { + groups[_i] = arguments[_i]; + } + return exclude.map(function (groupNumberOrString) { + if (typeof groupNumberOrString === "number") { + if (typeof groups[groupNumberOrString] !== "string") { + _this.logger.info("Incorrect RegExp specification in safelist rule " + name + " - not enough groups"); + return "\\*"; + } + return ProjectService.escapeFilenameForRegex(groups[groupNumberOrString]); + } + return groupNumberOrString; + }).join(""); + }); + if (excludeRules.indexOf(processedRule) === -1) { + excludeRules.push(processedRule); + } + }; + for (var _c = 0, _d = rule.exclude; _c < _d.length; _c++) { + var exclude = _d[_c]; + _loop_9(exclude); + } + } + else { + var escaped = ProjectService.escapeFilenameForRegex(root); + if (excludeRules.indexOf(escaped) < 0) { + excludeRules.push(escaped); + } + } + } } - else { - relativeLineNumber -= childLineCount; - charOffset += child.charCount(); + if (types.length > 0) { + proj.typeAcquisition = proj.typeAcquisition || {}; + proj.typeAcquisition.include = types; } - } - return { - child: child, - childIndex: i, - relativeLineNumber: relativeLineNumber, - charOffset: charOffset }; + var this_2 = this; + for (var _i = 0, _a = Object.keys(ProjectService.safelist); _i < _a.length; _i++) { + var name = _a[_i]; + _loop_8(name); + } + var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); }); + proj.rootFiles = proj.rootFiles.filter(function (_file, index) { return !excludeRegexes.some(function (re) { return re.test(normalizedNames[index]); }); }); }; - LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { - var child; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - if (child.charCount() > charOffset) { - break; + ProjectService.prototype.openExternalProject = function (proj, suppressRefreshOfInferredProjects) { + if (suppressRefreshOfInferredProjects === void 0) { suppressRefreshOfInferredProjects = false; } + if (proj.typingOptions && !proj.typeAcquisition) { + var typeAcquisition = ts.convertEnableAutoDiscoveryToEnable(proj.typingOptions); + proj.typeAcquisition = typeAcquisition; + } + this.applySafeList(proj); + var tsConfigFiles; + var rootFiles = []; + for (var _i = 0, _a = proj.rootFiles; _i < _a.length; _i++) { + var file = _a[_i]; + var normalized = server.toNormalizedPath(file.fileName); + if (ts.getBaseFileName(normalized) === "tsconfig.json") { + if (this.host.fileExists(normalized)) { + (tsConfigFiles || (tsConfigFiles = [])).push(normalized); + } } else { - charOffset -= child.charCount(); - lineNumber += child.lineCount(); + rootFiles.push(file); } } - return { - child: child, - childIndex: i, - charOffset: charOffset, - lineNumber: lineNumber - }; - }; - LineNode.prototype.splitAfter = function (childIndex) { - var splitNode; - var clen = this.children.length; - childIndex++; - var endLength = childIndex; - if (childIndex < clen) { - splitNode = new LineNode(); - while (childIndex < clen) { - splitNode.add(this.children[childIndex]); - childIndex++; - } - splitNode.updateCounts(); + if (tsConfigFiles) { + tsConfigFiles.sort(); } - this.children.length = endLength; - return splitNode; - }; - LineNode.prototype.remove = function (child) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var i = childIndex; i < (clen - 1); i++) { - this.children[i] = this.children[i + 1]; + var externalProject = this.findExternalProjectByProjectName(proj.projectFileName); + var exisingConfigFiles; + if (externalProject) { + if (!tsConfigFiles) { + var compilerOptions = convertCompilerOptions(proj.options); + if (this.exceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, proj.rootFiles, externalFilePropertyReader)) { + externalProject.disableLanguageService(); + } + else { + externalProject.enableLanguageService(); + } + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, undefined); + return; } + this.closeExternalProject(proj.projectFileName, true); } - this.children.length--; - }; - LineNode.prototype.findChildIndex = function (child) { - var childIndex = 0; - var clen = this.children.length; - while ((this.children[childIndex] !== child) && (childIndex < clen)) - childIndex++; - return childIndex; - }; - LineNode.prototype.insertAt = function (child, nodes) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - var nodeCount = nodes.length; - if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { - this.add(nodes[0]); - this.updateCounts(); - return []; - } - else { - var shiftNode = this.splitAfter(childIndex); - var nodeIndex = 0; - childIndex++; - while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { - this.children[childIndex] = nodes[nodeIndex]; - childIndex++; - nodeIndex++; + else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) { + if (!tsConfigFiles) { + this.closeExternalProject(proj.projectFileName, true); } - var splitNodes = []; - var splitNodeCount = 0; - if (nodeIndex < nodeCount) { - splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); - splitNodes = new Array(splitNodeCount); - var splitNodeIndex = 0; - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i] = new LineNode(); - } - var splitNode = splitNodes[0]; - while (nodeIndex < nodeCount) { - splitNode.add(nodes[nodeIndex]); - nodeIndex++; - if (splitNode.children.length === lineCollectionCapacity) { - splitNodeIndex++; - splitNode = splitNodes[splitNodeIndex]; + else { + var oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName); + var iNew = 0; + var iOld = 0; + while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) { + var newConfig = tsConfigFiles[iNew]; + var oldConfig = oldConfigFiles[iOld]; + if (oldConfig < newConfig) { + this.closeConfiguredProject(oldConfig); + iOld++; } - } - for (var i = splitNodes.length - 1; i >= 0; i--) { - if (splitNodes[i].children.length === 0) { - splitNodes.length--; + else if (oldConfig > newConfig) { + iNew++; + } + else { + (exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig); + iOld++; + iNew++; } } + for (var i = iOld; i < oldConfigFiles.length; i++) { + this.closeConfiguredProject(oldConfigFiles[i]); + } } - if (shiftNode) { - splitNodes[splitNodes.length] = shiftNode; - } - this.updateCounts(); - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i].updateCounts(); + } + if (tsConfigFiles) { + this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles); + for (var _b = 0, tsConfigFiles_1 = tsConfigFiles; _b < tsConfigFiles_1.length; _b++) { + var tsconfigFile = tsConfigFiles_1[_b]; + var project = this.findConfiguredProjectByProjectName(tsconfigFile); + if (!project) { + var result = this.openConfigFile(tsconfigFile); + project = result.success && result.project; + } + if (project && !ts.contains(exisingConfigFiles, tsconfigFile)) { + project.addOpenRef(); + } } - return splitNodes; + } + else { + this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName); + this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); + } + if (!suppressRefreshOfInferredProjects) { + this.refreshInferredProjects(); } }; - LineNode.prototype.add = function (collection) { - this.children[this.children.length] = collection; - return (this.children.length < lineCollectionCapacity); - }; - LineNode.prototype.charCount = function () { - return this.totalChars; - }; - LineNode.prototype.lineCount = function () { - return this.totalLines; - }; - return LineNode; - }()); - server.LineNode = LineNode; - var LineLeaf = (function () { - function LineLeaf(text) { - this.text = text; - } - LineLeaf.prototype.isLeaf = function () { - return true; - }; - LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { - walkFns.leaf(rangeStart, rangeLength, this); - }; - LineLeaf.prototype.charCount = function () { - return this.text.length; - }; - LineLeaf.prototype.lineCount = function () { - return 1; - }; - return LineLeaf; + return ProjectService; }()); - server.LineLeaf = LineLeaf; + ProjectService.safelist = defaultTypeSafeList; + ProjectService.filenameEscapeRegexp = /[-\/\\^$*+?.()|[\]{}]/g; + server.ProjectService = ProjectService; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var debugObjectHost = (function () { return this; })(); @@ -69503,7 +77794,7 @@ var ts; ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { var oldSnapshotShim = oldSnapshot; var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); - if (encoded == null) { + if (encoded === null) { return null; } var decoded = JSON.parse(encoded); @@ -69571,10 +77862,12 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); - if (settingsJson == null || settingsJson == "") { + if (settingsJson === null || settingsJson === "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } - return JSON.parse(settingsJson); + var compilerOptions = JSON.parse(settingsJson); + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; }; LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); @@ -69597,7 +77890,7 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); - if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") { return null; } try { @@ -69610,7 +77903,7 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { var hostCancellationToken = this.shimHost.getCancellationToken(); - return new ThrottledCancellationToken(hostCancellationToken); + return new ts.ThrottledCancellationToken(hostCancellationToken); }; LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { return this.shimHost.getCurrentDirectory(); @@ -69634,22 +77927,6 @@ var ts; return LanguageServiceShimHostAdapter; }()); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; - var ThrottledCancellationToken = (function () { - function ThrottledCancellationToken(hostCancellationToken) { - this.hostCancellationToken = hostCancellationToken; - this.lastCancellationCheckTime = 0; - } - ThrottledCancellationToken.prototype.isCancellationRequested = function () { - var time = ts.timestamp(); - var duration = Math.abs(time - this.lastCancellationCheckTime); - if (duration > 10) { - this.lastCancellationCheckTime = time; - return this.hostCancellationToken.isCancellationRequested(); - } - return false; - }; - return ThrottledCancellationToken; - }()); var CoreServicesShimHostAdapter = (function () { function CoreServicesShimHostAdapter(shimHost) { var _this = this; @@ -70012,12 +78289,6 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] - }; - } return { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations @@ -70157,7 +78428,7 @@ var ts; this._shims.push(shim); }; TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (var i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; @@ -70179,4 +78450,4 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); -var toolsVersion = "2.2"; +var toolsVersion = "2.3"; diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts index cec498e41..7e6fac11b 100644 --- a/node_modules/typescript/lib/typescript.d.ts +++ b/node_modules/typescript/lib/typescript.d.ts @@ -14,11 +14,36 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { + /** + * Type of objects whose values are all of the same type. + * The `in` and `for-in` operators can *not* be safely used, + * since `Object.prototype` may be modified by outside code. + */ interface MapLike { [index: string]: T; } - interface Map extends MapLike { - __mapBrand: any; + /** ES6 Map interface. */ + interface Map { + get(key: string): T; + has(key: string): boolean; + set(key: string, value: T): this; + delete(key: string): boolean; + clear(): void; + forEach(action: (value: T, key: string) => void): void; + readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, T]>; + } + /** ES6 Iterator type. */ + interface Iterator { + next(): { + value: T; + done: false; + } | { + value: never; + done: true; + }; } type Path = string & { __pathBrand: any; @@ -170,171 +195,171 @@ declare namespace ts { ReadonlyKeyword = 130, RequireKeyword = 131, NumberKeyword = 132, - SetKeyword = 133, - StringKeyword = 134, - SymbolKeyword = 135, - TypeKeyword = 136, - UndefinedKeyword = 137, - FromKeyword = 138, - GlobalKeyword = 139, - OfKeyword = 140, - QualifiedName = 141, - ComputedPropertyName = 142, - TypeParameter = 143, - Parameter = 144, - Decorator = 145, - PropertySignature = 146, - PropertyDeclaration = 147, - MethodSignature = 148, - MethodDeclaration = 149, - Constructor = 150, - GetAccessor = 151, - SetAccessor = 152, - CallSignature = 153, - ConstructSignature = 154, - IndexSignature = 155, - TypePredicate = 156, - TypeReference = 157, - FunctionType = 158, - ConstructorType = 159, - TypeQuery = 160, - TypeLiteral = 161, - ArrayType = 162, - TupleType = 163, - UnionType = 164, - IntersectionType = 165, - ParenthesizedType = 166, - ThisType = 167, - TypeOperator = 168, - IndexedAccessType = 169, - MappedType = 170, - LiteralType = 171, - ObjectBindingPattern = 172, - ArrayBindingPattern = 173, - BindingElement = 174, - ArrayLiteralExpression = 175, - ObjectLiteralExpression = 176, - PropertyAccessExpression = 177, - ElementAccessExpression = 178, - CallExpression = 179, - NewExpression = 180, - TaggedTemplateExpression = 181, - TypeAssertionExpression = 182, - ParenthesizedExpression = 183, - FunctionExpression = 184, - ArrowFunction = 185, - DeleteExpression = 186, - TypeOfExpression = 187, - VoidExpression = 188, - AwaitExpression = 189, - PrefixUnaryExpression = 190, - PostfixUnaryExpression = 191, - BinaryExpression = 192, - ConditionalExpression = 193, - TemplateExpression = 194, - YieldExpression = 195, - SpreadElement = 196, - ClassExpression = 197, - OmittedExpression = 198, - ExpressionWithTypeArguments = 199, - AsExpression = 200, - NonNullExpression = 201, - TemplateSpan = 202, - SemicolonClassElement = 203, - Block = 204, - VariableStatement = 205, - EmptyStatement = 206, - ExpressionStatement = 207, - IfStatement = 208, - DoStatement = 209, - WhileStatement = 210, - ForStatement = 211, - ForInStatement = 212, - ForOfStatement = 213, - ContinueStatement = 214, - BreakStatement = 215, - ReturnStatement = 216, - WithStatement = 217, - SwitchStatement = 218, - LabeledStatement = 219, - ThrowStatement = 220, - TryStatement = 221, - DebuggerStatement = 222, - VariableDeclaration = 223, - VariableDeclarationList = 224, - FunctionDeclaration = 225, - ClassDeclaration = 226, - InterfaceDeclaration = 227, - TypeAliasDeclaration = 228, - EnumDeclaration = 229, - ModuleDeclaration = 230, - ModuleBlock = 231, - CaseBlock = 232, - NamespaceExportDeclaration = 233, - ImportEqualsDeclaration = 234, - ImportDeclaration = 235, - ImportClause = 236, - NamespaceImport = 237, - NamedImports = 238, - ImportSpecifier = 239, - ExportAssignment = 240, - ExportDeclaration = 241, - NamedExports = 242, - ExportSpecifier = 243, - MissingDeclaration = 244, - ExternalModuleReference = 245, - JsxElement = 246, - JsxSelfClosingElement = 247, - JsxOpeningElement = 248, - JsxClosingElement = 249, - JsxAttribute = 250, - JsxSpreadAttribute = 251, - JsxExpression = 252, - CaseClause = 253, - DefaultClause = 254, - HeritageClause = 255, - CatchClause = 256, - PropertyAssignment = 257, - ShorthandPropertyAssignment = 258, - SpreadAssignment = 259, - EnumMember = 260, - SourceFile = 261, - JSDocTypeExpression = 262, - JSDocAllType = 263, - JSDocUnknownType = 264, - JSDocArrayType = 265, - JSDocUnionType = 266, - JSDocTupleType = 267, - JSDocNullableType = 268, - JSDocNonNullableType = 269, - JSDocRecordType = 270, - JSDocRecordMember = 271, - JSDocTypeReference = 272, - JSDocOptionalType = 273, - JSDocFunctionType = 274, - JSDocVariadicType = 275, - JSDocConstructorType = 276, - JSDocThisType = 277, - JSDocComment = 278, - JSDocTag = 279, - JSDocAugmentsTag = 280, - JSDocParameterTag = 281, - JSDocReturnTag = 282, - JSDocTypeTag = 283, - JSDocTemplateTag = 284, - JSDocTypedefTag = 285, - JSDocPropertyTag = 286, - JSDocTypeLiteral = 287, - JSDocLiteralType = 288, - JSDocNullKeyword = 289, - JSDocUndefinedKeyword = 290, - JSDocNeverKeyword = 291, - SyntaxList = 292, - NotEmittedStatement = 293, - PartiallyEmittedExpression = 294, - MergeDeclarationMarker = 295, - EndOfDeclarationMarker = 296, - RawExpression = 297, + ObjectKeyword = 133, + SetKeyword = 134, + StringKeyword = 135, + SymbolKeyword = 136, + TypeKeyword = 137, + UndefinedKeyword = 138, + FromKeyword = 139, + GlobalKeyword = 140, + OfKeyword = 141, + QualifiedName = 142, + ComputedPropertyName = 143, + TypeParameter = 144, + Parameter = 145, + Decorator = 146, + PropertySignature = 147, + PropertyDeclaration = 148, + MethodSignature = 149, + MethodDeclaration = 150, + Constructor = 151, + GetAccessor = 152, + SetAccessor = 153, + CallSignature = 154, + ConstructSignature = 155, + IndexSignature = 156, + TypePredicate = 157, + TypeReference = 158, + FunctionType = 159, + ConstructorType = 160, + TypeQuery = 161, + TypeLiteral = 162, + ArrayType = 163, + TupleType = 164, + UnionType = 165, + IntersectionType = 166, + ParenthesizedType = 167, + ThisType = 168, + TypeOperator = 169, + IndexedAccessType = 170, + MappedType = 171, + LiteralType = 172, + ObjectBindingPattern = 173, + ArrayBindingPattern = 174, + BindingElement = 175, + ArrayLiteralExpression = 176, + ObjectLiteralExpression = 177, + PropertyAccessExpression = 178, + ElementAccessExpression = 179, + CallExpression = 180, + NewExpression = 181, + TaggedTemplateExpression = 182, + TypeAssertionExpression = 183, + ParenthesizedExpression = 184, + FunctionExpression = 185, + ArrowFunction = 186, + DeleteExpression = 187, + TypeOfExpression = 188, + VoidExpression = 189, + AwaitExpression = 190, + PrefixUnaryExpression = 191, + PostfixUnaryExpression = 192, + BinaryExpression = 193, + ConditionalExpression = 194, + TemplateExpression = 195, + YieldExpression = 196, + SpreadElement = 197, + ClassExpression = 198, + OmittedExpression = 199, + ExpressionWithTypeArguments = 200, + AsExpression = 201, + NonNullExpression = 202, + MetaProperty = 203, + TemplateSpan = 204, + SemicolonClassElement = 205, + Block = 206, + VariableStatement = 207, + EmptyStatement = 208, + ExpressionStatement = 209, + IfStatement = 210, + DoStatement = 211, + WhileStatement = 212, + ForStatement = 213, + ForInStatement = 214, + ForOfStatement = 215, + ContinueStatement = 216, + BreakStatement = 217, + ReturnStatement = 218, + WithStatement = 219, + SwitchStatement = 220, + LabeledStatement = 221, + ThrowStatement = 222, + TryStatement = 223, + DebuggerStatement = 224, + VariableDeclaration = 225, + VariableDeclarationList = 226, + FunctionDeclaration = 227, + ClassDeclaration = 228, + InterfaceDeclaration = 229, + TypeAliasDeclaration = 230, + EnumDeclaration = 231, + ModuleDeclaration = 232, + ModuleBlock = 233, + CaseBlock = 234, + NamespaceExportDeclaration = 235, + ImportEqualsDeclaration = 236, + ImportDeclaration = 237, + ImportClause = 238, + NamespaceImport = 239, + NamedImports = 240, + ImportSpecifier = 241, + ExportAssignment = 242, + ExportDeclaration = 243, + NamedExports = 244, + ExportSpecifier = 245, + MissingDeclaration = 246, + ExternalModuleReference = 247, + JsxElement = 248, + JsxSelfClosingElement = 249, + JsxOpeningElement = 250, + JsxClosingElement = 251, + JsxAttribute = 252, + JsxAttributes = 253, + JsxSpreadAttribute = 254, + JsxExpression = 255, + CaseClause = 256, + DefaultClause = 257, + HeritageClause = 258, + CatchClause = 259, + PropertyAssignment = 260, + ShorthandPropertyAssignment = 261, + SpreadAssignment = 262, + EnumMember = 263, + SourceFile = 264, + Bundle = 265, + JSDocTypeExpression = 266, + JSDocAllType = 267, + JSDocUnknownType = 268, + JSDocArrayType = 269, + JSDocUnionType = 270, + JSDocTupleType = 271, + JSDocNullableType = 272, + JSDocNonNullableType = 273, + JSDocRecordType = 274, + JSDocRecordMember = 275, + JSDocTypeReference = 276, + JSDocOptionalType = 277, + JSDocFunctionType = 278, + JSDocVariadicType = 279, + JSDocConstructorType = 280, + JSDocThisType = 281, + JSDocComment = 282, + JSDocTag = 283, + JSDocAugmentsTag = 284, + JSDocParameterTag = 285, + JSDocReturnTag = 286, + JSDocTypeTag = 287, + JSDocTemplateTag = 288, + JSDocTypedefTag = 289, + JSDocPropertyTag = 290, + JSDocTypeLiteral = 291, + JSDocLiteralType = 292, + SyntaxList = 293, + NotEmittedStatement = 294, + PartiallyEmittedExpression = 295, + MergeDeclarationMarker = 296, + EndOfDeclarationMarker = 297, Count = 298, FirstAssignment = 57, LastAssignment = 69, @@ -343,15 +368,15 @@ declare namespace ts { FirstReservedWord = 71, LastReservedWord = 106, FirstKeyword = 71, - LastKeyword = 140, + LastKeyword = 141, FirstFutureReservedWord = 107, LastFutureReservedWord = 115, - FirstTypeNode = 156, - LastTypeNode = 171, + FirstTypeNode = 157, + LastTypeNode = 172, FirstPunctuation = 16, LastPunctuation = 69, FirstToken = 0, - LastToken = 140, + LastToken = 141, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -360,11 +385,11 @@ declare namespace ts { LastTemplateToken = 15, FirstBinaryOperator = 26, LastBinaryOperator = 69, - FirstNode = 141, - FirstJSDocNode = 262, - LastJSDocNode = 288, - FirstJSDocTagNode = 278, - LastJSDocTagNode = 291, + FirstNode = 142, + FirstJSDocNode = 266, + LastJSDocNode = 292, + FirstJSDocTagNode = 282, + LastJSDocTagNode = 292, } enum NodeFlags { None = 0, @@ -378,26 +403,20 @@ declare namespace ts { HasImplicitReturn = 128, HasExplicitReturn = 256, GlobalAugmentation = 512, - HasClassExtends = 1024, - HasDecorators = 2048, - HasParamDecorators = 4096, - HasAsyncFunctions = 8192, - HasSpreadAttribute = 16384, - HasRestAttribute = 32768, - DisallowInContext = 65536, - YieldContext = 131072, - DecoratorContext = 262144, - AwaitContext = 524288, - ThisNodeHasError = 1048576, - JavaScriptFile = 2097152, - ThisNodeOrAnySubNodesHasError = 4194304, - HasAggregatedChildData = 8388608, + HasAsyncFunctions = 1024, + DisallowInContext = 2048, + YieldContext = 4096, + DecoratorContext = 8192, + AwaitContext = 16384, + ThisNodeHasError = 32768, + JavaScriptFile = 65536, + ThisNodeOrAnySubNodesHasError = 131072, + HasAggregatedChildData = 262144, BlockScoped = 3, ReachabilityCheckFlags = 384, - EmitHelperFlags = 64512, - ReachabilityAndEmitFlags = 64896, - ContextFlags = 3080192, - TypeExcludesFlags = 655360, + ReachabilityAndEmitFlags = 1408, + ContextFlags = 96256, + TypeExcludesFlags = 20480, } enum ModifierFlags { None = 0, @@ -449,6 +468,7 @@ declare namespace ts { type EndOfFileToken = Token; type AtToken = Token; type ReadonlyToken = Token; + type AwaitKeywordToken = Token; type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; type ModifiersArray = NodeArray; interface Identifier extends PrimaryExpression { @@ -485,8 +505,10 @@ declare namespace ts { } interface TypeParameterDeclaration extends Declaration { kind: SyntaxKind.TypeParameter; + parent?: DeclarationWithTypeParameters; name: Identifier; constraint?: TypeNode; + default?: TypeNode; expression?: Expression; } interface SignatureDeclaration extends Declaration { @@ -504,17 +526,19 @@ declare namespace ts { type BindingName = Identifier | BindingPattern; interface VariableDeclaration extends Declaration { kind: SyntaxKind.VariableDeclaration; - parent?: VariableDeclarationList; + parent?: VariableDeclarationList | CatchClause; name: BindingName; type?: TypeNode; initializer?: Expression; } interface VariableDeclarationList extends Node { kind: SyntaxKind.VariableDeclarationList; + parent?: VariableStatement | ForStatement | ForOfStatement | ForInStatement; declarations: NodeArray; } interface ParameterDeclaration extends Declaration { kind: SyntaxKind.Parameter; + parent?: SignatureDeclaration; dotDotDotToken?: DotDotDotToken; name: BindingName; questionToken?: QuestionToken; @@ -523,6 +547,7 @@ declare namespace ts { } interface BindingElement extends Declaration { kind: SyntaxKind.BindingElement; + parent?: BindingPattern; propertyName?: PropertyName; dotDotDotToken?: DotDotDotToken; name: BindingName; @@ -546,7 +571,7 @@ declare namespace ts { _objectLiteralBrandBrand: any; name?: PropertyName; } - type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment; + type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration; interface PropertyAssignment extends ObjectLiteralElement { kind: SyntaxKind.PropertyAssignment; name: PropertyName; @@ -577,10 +602,12 @@ declare namespace ts { } interface ObjectBindingPattern extends Node { kind: SyntaxKind.ObjectBindingPattern; + parent?: VariableDeclaration | ParameterDeclaration | BindingElement; elements: NodeArray; } interface ArrayBindingPattern extends Node { kind: SyntaxKind.ArrayBindingPattern; + parent?: VariableDeclaration | ParameterDeclaration | BindingElement; elements: NodeArray; } type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; @@ -615,41 +642,45 @@ declare namespace ts { } interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { kind: SyntaxKind.Constructor; + parent?: ClassDeclaration | ClassExpression; body?: FunctionBody; } + /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ interface SemicolonClassElement extends ClassElement { kind: SyntaxKind.SemicolonClassElement; + parent?: ClassDeclaration | ClassExpression; } interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.GetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.SetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { kind: SyntaxKind.IndexSignature; + parent?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode; } interface TypeNode extends Node { _typeNodeBrand: any; } interface KeywordTypeNode extends TypeNode { - kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; } - interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { - kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; - } - interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode; + interface FunctionTypeNode extends TypeNode, SignatureDeclaration { kind: SyntaxKind.FunctionType; } - interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + interface ConstructorTypeNode extends TypeNode, SignatureDeclaration { kind: SyntaxKind.ConstructorType; } interface TypeReferenceNode extends TypeNode { @@ -678,15 +709,14 @@ declare namespace ts { kind: SyntaxKind.TupleType; elementTypes: NodeArray; } - interface UnionOrIntersectionTypeNode extends TypeNode { - kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType; - types: NodeArray; - } - interface UnionTypeNode extends UnionOrIntersectionTypeNode { + type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode; + interface UnionTypeNode extends TypeNode { kind: SyntaxKind.UnionType; + types: NodeArray; } - interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { + interface IntersectionTypeNode extends TypeNode { kind: SyntaxKind.IntersectionType; + types: NodeArray; } interface ParenthesizedTypeNode extends TypeNode { kind: SyntaxKind.ParenthesizedType; @@ -704,6 +734,7 @@ declare namespace ts { } interface MappedTypeNode extends TypeNode, Declaration { kind: SyntaxKind.MappedType; + parent?: TypeAliasDeclaration; readonlyToken?: ReadonlyToken; typeParameter: TypeParameterDeclaration; questionToken?: QuestionToken; @@ -718,11 +749,14 @@ declare namespace ts { } interface Expression extends Node { _expressionBrand: any; - contextualType?: Type; } interface OmittedExpression extends Expression { kind: SyntaxKind.OmittedExpression; } + interface PartiallyEmittedExpression extends LeftHandSideExpression { + kind: SyntaxKind.PartiallyEmittedExpression; + expression: Expression; + } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } @@ -750,13 +784,13 @@ declare namespace ts { interface PrimaryExpression extends MemberExpression { _primaryExpressionBrand: any; } - interface NullLiteral extends PrimaryExpression { + interface NullLiteral extends PrimaryExpression, TypeNode { kind: SyntaxKind.NullKeyword; } - interface BooleanLiteral extends PrimaryExpression { + interface BooleanLiteral extends PrimaryExpression, TypeNode { kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword; } - interface ThisExpression extends PrimaryExpression { + interface ThisExpression extends PrimaryExpression, KeywordTypeNode { kind: SyntaxKind.ThisKeyword; } interface SuperExpression extends PrimaryExpression { @@ -864,16 +898,18 @@ declare namespace ts { } interface NumericLiteral extends LiteralExpression { kind: SyntaxKind.NumericLiteral; - trailingComment?: string; } interface TemplateHead extends LiteralLikeNode { kind: SyntaxKind.TemplateHead; + parent?: TemplateExpression; } interface TemplateMiddle extends LiteralLikeNode { kind: SyntaxKind.TemplateMiddle; + parent?: TemplateSpan; } interface TemplateTail extends LiteralLikeNode { kind: SyntaxKind.TemplateTail; + parent?: TemplateSpan; } type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral; interface TemplateExpression extends PrimaryExpression { @@ -883,6 +919,7 @@ declare namespace ts { } interface TemplateSpan extends Node { kind: SyntaxKind.TemplateSpan; + parent?: TemplateExpression; expression: Expression; literal: TemplateMiddle | TemplateTail; } @@ -899,18 +936,18 @@ declare namespace ts { expression: Expression; } /** - * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to - * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be - * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type - * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) - **/ + * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to + * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be + * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type + * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) + */ interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration { properties: NodeArray; } interface ObjectLiteralExpression extends ObjectLiteralExpressionBase { kind: SyntaxKind.ObjectLiteralExpression; } - type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; + type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression | ParenthesizedExpression; type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; interface PropertyAccessExpression extends MemberExpression, Declaration { kind: SyntaxKind.PropertyAccessExpression; @@ -945,6 +982,7 @@ declare namespace ts { } interface ExpressionWithTypeArguments extends TypeNode { kind: SyntaxKind.ExpressionWithTypeArguments; + parent?: HeritageClause; expression: LeftHandSideExpression; typeArguments?: NodeArray; } @@ -952,14 +990,14 @@ declare namespace ts { kind: SyntaxKind.NewExpression; expression: LeftHandSideExpression; typeArguments?: NodeArray; - arguments: NodeArray; + arguments?: NodeArray; } interface TaggedTemplateExpression extends MemberExpression { kind: SyntaxKind.TaggedTemplateExpression; tag: LeftHandSideExpression; template: TemplateLiteral; } - type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator; + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement; interface AsExpression extends Expression { kind: SyntaxKind.AsExpression; expression: Expression; @@ -975,49 +1013,67 @@ declare namespace ts { kind: SyntaxKind.NonNullExpression; expression: Expression; } + interface MetaProperty extends PrimaryExpression { + kind: SyntaxKind.MetaProperty; + keywordToken: SyntaxKind; + name: Identifier; + } interface JsxElement extends PrimaryExpression { kind: SyntaxKind.JsxElement; openingElement: JsxOpeningElement; children: NodeArray; closingElement: JsxClosingElement; } + type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; + type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; + interface JsxAttributes extends ObjectLiteralExpressionBase { + parent?: JsxOpeningLikeElement; + } interface JsxOpeningElement extends Expression { kind: SyntaxKind.JsxOpeningElement; + parent?: JsxElement; tagName: JsxTagNameExpression; - attributes: NodeArray; + attributes: JsxAttributes; } interface JsxSelfClosingElement extends PrimaryExpression { kind: SyntaxKind.JsxSelfClosingElement; tagName: JsxTagNameExpression; - attributes: NodeArray; + attributes: JsxAttributes; } - type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; - type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; - interface JsxAttribute extends Node { + interface JsxAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxAttribute; + parent?: JsxAttributes; name: Identifier; initializer?: StringLiteral | JsxExpression; } - interface JsxSpreadAttribute extends Node { + interface JsxSpreadAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxSpreadAttribute; + parent?: JsxAttributes; expression: Expression; } interface JsxClosingElement extends Node { kind: SyntaxKind.JsxClosingElement; + parent?: JsxElement; tagName: JsxTagNameExpression; } interface JsxExpression extends Expression { kind: SyntaxKind.JsxExpression; + parent?: JsxElement | JsxAttributeLike; + dotDotDotToken?: Token; expression?: Expression; } interface JsxText extends Node { kind: SyntaxKind.JsxText; + parent?: JsxElement; } type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; interface Statement extends Node { _statementBrand: any; } + interface NotEmittedStatement extends Statement { + kind: SyntaxKind.NotEmittedStatement; + } interface EmptyStatement extends Statement { kind: SyntaxKind.EmptyStatement; } @@ -1028,7 +1084,7 @@ declare namespace ts { kind: SyntaxKind.MissingDeclaration; name?: Identifier; } - type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; + type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause; interface Block extends Statement { kind: SyntaxKind.Block; statements: NodeArray; @@ -1072,6 +1128,7 @@ declare namespace ts { } interface ForOfStatement extends IterationStatement { kind: SyntaxKind.ForOfStatement; + awaitModifier?: AwaitKeywordToken; initializer: ForInitializer; expression: Expression; } @@ -1101,15 +1158,18 @@ declare namespace ts { } interface CaseBlock extends Node { kind: SyntaxKind.CaseBlock; + parent?: SwitchStatement; clauses: NodeArray; } interface CaseClause extends Node { kind: SyntaxKind.CaseClause; + parent?: CaseBlock; expression: Expression; statements: NodeArray; } interface DefaultClause extends Node { kind: SyntaxKind.DefaultClause; + parent?: CaseBlock; statements: NodeArray; } type CaseOrDefaultClause = CaseClause | DefaultClause; @@ -1130,6 +1190,7 @@ declare namespace ts { } interface CatchClause extends Node { kind: SyntaxKind.CatchClause; + parent?: TryStatement; variableDeclaration: VariableDeclaration; block: Block; } @@ -1165,8 +1226,9 @@ declare namespace ts { } interface HeritageClause extends Node { kind: SyntaxKind.HeritageClause; - token: SyntaxKind; - types?: NodeArray; + parent?: InterfaceDeclaration | ClassDeclaration | ClassExpression; + token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword; + types: NodeArray; } interface TypeAliasDeclaration extends DeclarationStatement { kind: SyntaxKind.TypeAliasDeclaration; @@ -1176,6 +1238,7 @@ declare namespace ts { } interface EnumMember extends Declaration { kind: SyntaxKind.EnumMember; + parent?: EnumDeclaration; name: PropertyName; initializer?: Expression; } @@ -1184,91 +1247,121 @@ declare namespace ts { name: Identifier; members: NodeArray; } - type ModuleBody = ModuleBlock | ModuleDeclaration; type ModuleName = Identifier | StringLiteral; + type ModuleBody = NamespaceBody | JSDocNamespaceBody; interface ModuleDeclaration extends DeclarationStatement { kind: SyntaxKind.ModuleDeclaration; - name: Identifier | StringLiteral; - body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier; + parent?: ModuleBody | SourceFile; + name: ModuleName; + body?: ModuleBody | JSDocNamespaceDeclaration; } + type NamespaceBody = ModuleBlock | NamespaceDeclaration; interface NamespaceDeclaration extends ModuleDeclaration { name: Identifier; - body: ModuleBlock | NamespaceDeclaration; + body: NamespaceBody; } + type JSDocNamespaceBody = Identifier | JSDocNamespaceDeclaration; interface JSDocNamespaceDeclaration extends ModuleDeclaration { name: Identifier; - body: JSDocNamespaceDeclaration | Identifier; + body: JSDocNamespaceBody; } interface ModuleBlock extends Node, Statement { kind: SyntaxKind.ModuleBlock; + parent?: ModuleDeclaration; statements: NodeArray; } type ModuleReference = EntityName | ExternalModuleReference; + /** + * One of: + * - import x = require("mod"); + * - import x = M.x; + */ interface ImportEqualsDeclaration extends DeclarationStatement { kind: SyntaxKind.ImportEqualsDeclaration; + parent?: SourceFile | ModuleBlock; name: Identifier; moduleReference: ModuleReference; } interface ExternalModuleReference extends Node { kind: SyntaxKind.ExternalModuleReference; + parent?: ImportEqualsDeclaration; expression?: Expression; } interface ImportDeclaration extends Statement { kind: SyntaxKind.ImportDeclaration; + parent?: SourceFile | ModuleBlock; importClause?: ImportClause; + /** If this is not a StringLiteral it will be a grammar error. */ moduleSpecifier: Expression; } type NamedImportBindings = NamespaceImport | NamedImports; interface ImportClause extends Declaration { kind: SyntaxKind.ImportClause; + parent?: ImportDeclaration; name?: Identifier; namedBindings?: NamedImportBindings; } interface NamespaceImport extends Declaration { kind: SyntaxKind.NamespaceImport; + parent?: ImportClause; name: Identifier; } interface NamespaceExportDeclaration extends DeclarationStatement { kind: SyntaxKind.NamespaceExportDeclaration; name: Identifier; - moduleReference: LiteralLikeNode; } interface ExportDeclaration extends DeclarationStatement { kind: SyntaxKind.ExportDeclaration; + parent?: SourceFile | ModuleBlock; exportClause?: NamedExports; + /** If this is not a StringLiteral it will be a grammar error. */ moduleSpecifier?: Expression; } interface NamedImports extends Node { kind: SyntaxKind.NamedImports; + parent?: ImportClause; elements: NodeArray; } interface NamedExports extends Node { kind: SyntaxKind.NamedExports; + parent?: ExportDeclaration; elements: NodeArray; } type NamedImportsOrExports = NamedImports | NamedExports; interface ImportSpecifier extends Declaration { kind: SyntaxKind.ImportSpecifier; + parent?: NamedImports; propertyName?: Identifier; name: Identifier; } interface ExportSpecifier extends Declaration { kind: SyntaxKind.ExportSpecifier; + parent?: NamedExports; propertyName?: Identifier; name: Identifier; } type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; interface ExportAssignment extends DeclarationStatement { kind: SyntaxKind.ExportAssignment; + parent?: SourceFile; isExportEquals?: boolean; expression: Expression; } interface FileReference extends TextRange { fileName: string; } + interface CheckJsDirective extends TextRange { + enabled: boolean; + } + type CommentKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia; interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; - kind: SyntaxKind; + kind: CommentKind; + } + interface SynthesizedComment extends CommentRange { + text: string; + pos: -1; + end: -1; } interface JSDocTypeExpression extends Node { kind: SyntaxKind.JSDocTypeExpression; @@ -1412,9 +1505,21 @@ declare namespace ts { ArrayMutation = 256, Referenced = 512, Shared = 1024, + PreFinally = 2048, + AfterFinally = 4096, Label = 12, Condition = 96, } + interface FlowLock { + locked?: boolean; + } + interface AfterFinallyFlow extends FlowNode, FlowLock { + antecedent: FlowNode; + } + interface PreFinallyFlow extends FlowNode { + antecedent: FlowNode; + lock: FlowLock; + } interface FlowNode { flags: FlowFlags; id?: number; @@ -1457,7 +1562,6 @@ declare namespace ts { statements: NodeArray; endOfFileToken: Token; fileName: string; - path: Path; text: string; amdDependencies: AmdDependency[]; moduleName: string; @@ -1476,6 +1580,10 @@ declare namespace ts { hasNoDefaultLib: boolean; languageVersion: ScriptTarget; } + interface Bundle extends Node { + kind: SyntaxKind.Bundle; + sourceFiles: SourceFile[]; + } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; getSourceFile(fileName: string): SourceFile; @@ -1486,9 +1594,9 @@ declare namespace ts { useCaseSensitiveFileNames: boolean; readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[]; /** - * Gets a value indicating whether the specified path exists and is a file. - * @param path The path to test. - */ + * Gets a value indicating whether the specified path exists and is a file. + * @param path The path to test. + */ fileExists(path: string): boolean; readFile(path: string): string; } @@ -1521,7 +1629,7 @@ declare namespace ts { * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter * will be invoked when writing the JavaScript and declaration files. */ - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; @@ -1532,6 +1640,12 @@ declare namespace ts { */ getTypeChecker(): TypeChecker; } + interface CustomTransformers { + /** Custom transformers to evaluate before built-in transformations. */ + before?: TransformerFactory[]; + /** Custom transformers to evaluate after built-in transformations. */ + after?: TransformerFactory[]; + } interface SourceMapSpan { /** Line number in the .js file. */ emittedLine: number; @@ -1575,11 +1689,20 @@ declare namespace ts { getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; + getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; - getBaseTypes(type: InterfaceType): ObjectType[]; + getBaseTypes(type: InterfaceType): BaseType[]; + getBaseTypeOfLiteralType(type: Type): Type; + getWidenedType(type: Type): Type; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; + /** Note that the resulting nodes cannot be checked. */ + typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode; + /** Note that the resulting nodes cannot be checked. */ + signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration; + /** Note that the resulting nodes cannot be checked. */ + indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; @@ -1587,6 +1710,8 @@ declare namespace ts { getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; + getTypeFromTypeNode(node: TypeNode): Type; + signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; @@ -1602,18 +1727,30 @@ declare namespace ts { isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; - getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; + getAllAttributesTypeFromJsxOpeningLikeElement(elementNode: JsxOpeningLikeElement): Type; getJsxIntrinsicTagNames(): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; + getApparentType(type: Type): Type; + } + enum NodeBuilderFlags { + None = 0, + allowThisInObjectLiteral = 1, + allowQualifedNameInPlaceOfIdentifier = 2, + allowTypeParameterInQualifiedName = 4, + allowAnonymousIdentifier = 8, + allowEmptyUnionOrIntersection = 16, + allowEmptyTuple = 32, } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1629,6 +1766,7 @@ declare namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -1636,6 +1774,7 @@ declare namespace ts { clear(): void; trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; + reportIllegalExtends(): void; } enum TypeFormatFlags { None = 0, @@ -1650,6 +1789,8 @@ declare namespace ts { InFirstTypeArgument = 256, InTypeAlias = 512, UseTypeAliasValue = 1024, + SuppressAnyReturnType = 2048, + AddUndefined = 4096, } enum SymbolFormatFlags { None = 0, @@ -1699,13 +1840,10 @@ declare namespace ts { ExportType = 2097152, ExportNamespace = 4194304, Alias = 8388608, - Instantiated = 16777216, - Merged = 33554432, - Transient = 67108864, - Prototype = 134217728, - SyntheticProperty = 268435456, - Optional = 536870912, - ExportStar = 1073741824, + Prototype = 16777216, + ExportStar = 33554432, + Optional = 67108864, + Transient = 134217728, Enum = 384, Variable = 3, Value = 107455, @@ -1771,6 +1909,7 @@ declare namespace ts { Intersection = 131072, Index = 262144, IndexedAccess = 524288, + NonPrimitive = 16777216, Literal = 480, StringOrNumberLiteral = 96, PossiblyFalsy = 7406, @@ -1780,9 +1919,10 @@ declare namespace ts { EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, - StructuredOrTypeParameter = 507904, - Narrowable = 1033215, - NotUnionOrUnit = 33281, + StructuredOrTypeVariable = 1032192, + TypeVariable = 540672, + Narrowable = 17810431, + NotUnionOrUnit = 16810497, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1798,7 +1938,7 @@ declare namespace ts { regularType?: LiteralType; } interface EnumType extends Type { - memberTypes: Map; + memberTypes: EnumLiteralType[]; } interface EnumLiteralType extends LiteralType { baseType: EnumType & UnionType; @@ -1819,12 +1959,14 @@ declare namespace ts { interface ObjectType extends Type { objectFlags: ObjectFlags; } + /** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */ interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; localTypeParameters: TypeParameter[]; thisType: TypeParameter; } + type BaseType = ObjectType | IntersectionType; interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; @@ -1832,6 +1974,16 @@ declare namespace ts { declaredStringIndexInfo: IndexInfo; declaredNumberIndexInfo: IndexInfo; } + /** + * Type references (TypeFlags.Reference). When a class or interface has type parameters or + * a "this" type, references to the class or interface are made using type references. The + * typeArguments property specifies the types to substitute for the type parameters of the + * class or interface and optionally includes an extra element that specifies the type to + * substitute for "this" in the resulting instantiation. When no extra argument is present, + * the type reference itself is substituted for "this". The typeArguments property is undefined + * if the class or interface has no type parameters and the reference isn't specifying an + * explicit "this" argument. + */ interface TypeReference extends ObjectType { target: GenericType; typeArguments: Type[]; @@ -1850,15 +2002,19 @@ declare namespace ts { elementType: Type; finalArrayType?: Type; } - interface TypeParameter extends Type { - constraint: Type; + interface TypeVariable extends Type { } - interface IndexType extends Type { - type: TypeParameter; + interface TypeParameter extends TypeVariable { + constraint: Type; + default?: Type; } - interface IndexedAccessType extends Type { + interface IndexedAccessType extends TypeVariable { objectType: Type; indexType: Type; + constraint?: Type; + } + interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } enum SignatureKind { Call = 0, @@ -1878,6 +2034,10 @@ declare namespace ts { isReadonly: boolean; declaration?: SignatureDeclaration; } + interface JsFileExtensionInfo { + extension: string; + isMixedContent: boolean; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -1913,7 +2073,10 @@ declare namespace ts { Classic = 1, NodeJs = 2, } - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike; + interface PluginImport { + name: string; + } + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[]; interface CompilerOptions { allowJs?: boolean; allowSyntheticDefaultImports?: boolean; @@ -1922,9 +2085,11 @@ declare namespace ts { alwaysStrict?: boolean; baseUrl?: string; charset?: string; + checkJs?: boolean; declaration?: boolean; declarationDir?: string; disableSizeLimit?: boolean; + downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; experimentalDecorators?: boolean; @@ -1969,6 +2134,7 @@ declare namespace ts { skipDefaultLibCheck?: boolean; sourceMap?: boolean; sourceRoot?: string; + strict?: boolean; strictNullChecks?: boolean; suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; @@ -2007,6 +2173,7 @@ declare namespace ts { None = 0, Preserve = 1, React = 2, + ReactNative = 3, } enum NewLineKind { CarriageReturnLineFeed = 0, @@ -2022,6 +2189,7 @@ declare namespace ts { JSX = 2, TS = 3, TSX = 4, + External = 5, } enum ScriptTarget { ES3 = 0, @@ -2102,7 +2270,6 @@ declare namespace ts { } interface ResolvedModuleWithFailedLookupLocations { resolvedModule: ResolvedModuleFull | undefined; - failedLookupLocations: string[]; } interface ResolvedTypeReferenceDirective { primary: boolean; @@ -2131,6 +2298,206 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getEnvironmentVariable?(name: string): string; } + enum EmitFlags { + SingleLine = 1, + AdviseOnEmitNode = 2, + NoSubstitution = 4, + CapturesThis = 8, + NoLeadingSourceMap = 16, + NoTrailingSourceMap = 32, + NoSourceMap = 48, + NoNestedSourceMaps = 64, + NoTokenLeadingSourceMaps = 128, + NoTokenTrailingSourceMaps = 256, + NoTokenSourceMaps = 384, + NoLeadingComments = 512, + NoTrailingComments = 1024, + NoComments = 1536, + NoNestedComments = 2048, + HelperName = 4096, + ExportName = 8192, + LocalName = 16384, + Indented = 32768, + NoIndentation = 65536, + AsyncFunctionBody = 131072, + ReuseTempVariableScope = 262144, + CustomPrologue = 524288, + NoHoisting = 1048576, + HasEndOfDeclarationMarker = 2097152, + Iterator = 4194304, + } + interface EmitHelper { + readonly name: string; + readonly scoped: boolean; + readonly text: string; + readonly priority?: number; + } + enum EmitHint { + SourceFile = 0, + Expression = 1, + IdentifierName = 2, + Unspecified = 3, + } + interface TransformationContext { + /** Gets the compiler options supplied to the transformer. */ + getCompilerOptions(): CompilerOptions; + /** Starts a new lexical environment. */ + startLexicalEnvironment(): void; + /** Suspends the current lexical environment, usually after visiting a parameter list. */ + suspendLexicalEnvironment(): void; + /** Resumes a suspended lexical environment, usually before visiting a function body. */ + resumeLexicalEnvironment(): void; + /** Ends a lexical environment, returning any declarations. */ + endLexicalEnvironment(): Statement[]; + /** Hoists a function declaration to the containing scope. */ + hoistFunctionDeclaration(node: FunctionDeclaration): void; + /** Hoists a variable declaration to the containing scope. */ + hoistVariableDeclaration(node: Identifier): void; + /** Records a request for a non-scoped emit helper in the current context. */ + requestEmitHelper(helper: EmitHelper): void; + /** Gets and resets the requested non-scoped emit helpers. */ + readEmitHelpers(): EmitHelper[] | undefined; + /** Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ + enableSubstitution(kind: SyntaxKind): void; + /** Determines whether expression substitutions are enabled for the provided node. */ + isSubstitutionEnabled(node: Node): boolean; + /** + * Hook used by transformers to substitute expressions just before they + * are emitted by the pretty printer. + * + * NOTE: Transformation hooks should only be modified during `Transformer` initialization, + * before returning the `NodeTransformer` callback. + */ + onSubstituteNode: (hint: EmitHint, node: Node) => Node; + /** + * Enables before/after emit notifications in the pretty printer for the provided + * SyntaxKind. + */ + enableEmitNotification(kind: SyntaxKind): void; + /** + * Determines whether before/after emit notifications should be raised in the pretty + * printer when it emits a node. + */ + isEmitNotificationEnabled(node: Node): boolean; + /** + * Hook used to allow transformers to capture state before or after + * the printer emits a node. + * + * NOTE: Transformation hooks should only be modified during `Transformer` initialization, + * before returning the `NodeTransformer` callback. + */ + onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; + } + interface TransformationResult { + /** Gets the transformed source files. */ + transformed: T[]; + /** Gets diagnostics for the transformation. */ + diagnostics?: Diagnostic[]; + /** + * Gets a substitute for a node, if one is available; otherwise, returns the original node. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + substituteNode(hint: EmitHint, node: Node): Node; + /** + * Emits a node with possible notification. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emitCallback A callback used to emit the node. + */ + emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + /** + * Clean up EmitNode entries on any parse-tree nodes. + */ + dispose(): void; + } + /** + * A function that is used to initialize and return a `Transformer` callback, which in turn + * will be used to transform one or more nodes. + */ + type TransformerFactory = (context: TransformationContext) => Transformer; + /** + * A function that transforms a node. + */ + type Transformer = (node: T) => T; + /** + * A function that accepts and possibly transforms a node. + */ + type Visitor = (node: Node) => VisitResult; + type VisitResult = T | T[]; + interface Printer { + /** + * Print a node and its subtree as-is, without any emit transformations. + * @param hint A value indicating the purpose of a node. This is primarily used to + * distinguish between an `Identifier` used in an expression position, versus an + * `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you + * should just pass `Unspecified`. + * @param node The node to print. The node and its subtree are printed as-is, without any + * emit transformations. + * @param sourceFile A source file that provides context for the node. The source text of + * the file is used to emit the original source content for literals and identifiers, while + * the identifiers of the source file are used when generating unique names to avoid + * collisions. + */ + printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string; + /** + * Prints a source file as-is, without any emit transformations. + */ + printFile(sourceFile: SourceFile): string; + /** + * Prints a bundle of source files as-is, without any emit transformations. + */ + printBundle(bundle: Bundle): string; + } + interface PrintHandlers { + /** + * A hook used by the Printer when generating unique names to avoid collisions with + * globally defined names that exist outside of the current source file. + */ + hasGlobalName?(name: string): boolean; + /** + * A hook used by the Printer to provide notifications prior to emitting a node. A + * compatible implementation **must** invoke `emitCallback` with the provided `hint` and + * `node` values. + * @param hint A hint indicating the intended purpose of the node. + * @param node The node to emit. + * @param emitCallback A callback that, when invoked, will emit the node. + * @example + * ```ts + * var printer = createPrinter(printerOptions, { + * onEmitNode(hint, node, emitCallback) { + * // set up or track state prior to emitting the node... + * emitCallback(hint, node); + * // restore state after emitting the node... + * } + * }); + * ``` + */ + onEmitNode?(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + /** + * A hook used by the Printer to perform just-in-time substitution of a node. This is + * primarily used by node transformations that need to substitute one node for another, + * such as replacing `myExportedVar` with `exports.myExportedVar`. + * @param hint A hint indicating the intended purpose of the node. + * @param node The node to emit. + * @example + * ```ts + * var printer = createPrinter(printerOptions, { + * substituteNode(hint, node) { + * // perform substitution if necessary... + * return node; + * } + * }); + * ``` + */ + substituteNode?(hint: EmitHint, node: Node): Node; + } + interface PrinterOptions { + removeComments?: boolean; + newLine?: NewLineKind; + } interface TextSpan { start: number; length: number; @@ -2145,8 +2512,10 @@ declare namespace ts { } declare namespace ts { /** The version of the TypeScript compiler release */ - const version = "2.2.0-dev.20161127"; + const version = "2.3.0-dev.20170419"; } +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; +declare function clearTimeout(handle: any): void; declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -2192,6 +2561,7 @@ declare namespace ts { directoryName: string; referenceCount: number; } + function getNodeMajorVersion(): number; let sys: System; } declare namespace ts { @@ -2237,12 +2607,12 @@ declare namespace ts { function isWhiteSpaceSingleLine(ch: number): boolean; function isLineBreak(ch: number): boolean; function couldStartTrivia(text: string, pos: number): boolean; - function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; - function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; - function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; /** Optionally, get the shebang */ function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; @@ -2282,15 +2652,414 @@ declare namespace ts { function getCombinedModifierFlags(node: Node): ModifierFlags; function getCombinedNodeFlags(node: Node): NodeFlags; /** - * Checks to see if the locale is in the appropriate format, - * and if it is, attempts to set the appropriate language. - */ + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ function validateLocaleAndSetLanguage(locale: string, sys: { getExecutingFilePath(): string; resolvePath(path: string): string; fileExists(fileName: string): boolean; readFile(fileName: string): string; }, errors?: Diagnostic[]): void; + function getOriginalNode(node: Node): Node; + function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; + /** + * Gets a value indicating whether a node originated in the parse tree. + * + * @param node The node to test. + */ + function isParseTreeNode(node: Node): boolean; + /** + * Gets the original parse tree node for a node. + * + * @param node The original node. + * @returns The original parse tree node if found; otherwise, undefined. + */ + function getParseTreeNode(node: Node): Node; + /** + * Gets the original parse tree node for a node. + * + * @param node The original node. + * @param nodeTest A callback used to ensure the correct type of parse tree node is returned. + * @returns The original parse tree node if found; otherwise, undefined. + */ + function getParseTreeNode(node: Node, nodeTest?: (node: Node) => node is T): T; + /** + * Remove extra underscore from escaped identifier text content. + * + * @param identifier The escaped identifier text. + * @returns The unescaped identifier text. + */ + function unescapeIdentifier(identifier: string): string; +} +declare namespace ts { + /** + * Make `elements` into a `NodeArray`. If `elements` is `undefined`, returns an empty `NodeArray`. + */ + function createNodeArray(elements?: T[], hasTrailingComma?: boolean): NodeArray; + function createLiteral(value: string): StringLiteral; + function createLiteral(value: number): NumericLiteral; + function createLiteral(value: boolean): BooleanLiteral; + /** Create a string literal whose source text is read from a source node during emit. */ + function createLiteral(sourceNode: StringLiteral | NumericLiteral | Identifier): StringLiteral; + function createLiteral(value: string | number | boolean): PrimaryExpression; + function createNumericLiteral(value: string): NumericLiteral; + function createIdentifier(text: string): Identifier; + /** Create a unique temporary variable. */ + function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined): Identifier; + /** Create a unique temporary variable for use in a loop. */ + function createLoopVariable(): Identifier; + /** Create a unique name based on the supplied text. */ + function createUniqueName(text: string): Identifier; + /** Create a unique name generated for a node. */ + function getGeneratedNameForNode(node: Node): Identifier; + function createToken(token: TKind): Token; + function createSuper(): SuperExpression; + function createThis(): ThisExpression & Token; + function createNull(): NullLiteral & Token; + function createTrue(): BooleanLiteral & Token; + function createFalse(): BooleanLiteral & Token; + function createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName; + function updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName; + function createComputedPropertyName(expression: Expression): ComputedPropertyName; + function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; + function createSignatureDeclaration(kind: SyntaxKind, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): SignatureDeclaration; + function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; + function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function updateCallSignatureDeclaration(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; + function createMethodSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined): MethodSignature; + function updateMethodSignature(node: MethodSignature, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined, name: PropertyName, questionToken: QuestionToken | undefined): MethodSignature; + function createKeywordTypeNode(kind: KeywordTypeNode["kind"]): KeywordTypeNode; + function createThisTypeNode(): ThisTypeNode; + function createLiteralTypeNode(literal: Expression): LiteralTypeNode; + function updateLiteralTypeNode(node: LiteralTypeNode, literal: Expression): LiteralTypeNode; + function createTypeReferenceNode(typeName: string | EntityName, typeArguments: TypeNode[] | undefined): TypeReferenceNode; + function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; + function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode): TypePredicateNode; + function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; + function createTypeQueryNode(exprName: EntityName): TypeQueryNode; + function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; + function createArrayTypeNode(elementType: TypeNode): ArrayTypeNode; + function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType, types: TypeNode[]): UnionTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.IntersectionType, types: TypeNode[]): IntersectionTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: TypeNode[]): UnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node: UnionOrIntersectionTypeNode, types: NodeArray): UnionOrIntersectionTypeNode; + function createTypeLiteralNode(members: TypeElement[]): TypeLiteralNode; + function updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray): TypeLiteralNode; + function createTupleTypeNode(elementTypes: TypeNode[]): TupleTypeNode; + function updateTypleTypeNode(node: TupleTypeNode, elementTypes: TypeNode[]): TupleTypeNode; + function createMappedTypeNode(readonlyToken: ReadonlyToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | undefined, type: TypeNode | undefined): MappedTypeNode; + function updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | undefined, type: TypeNode | undefined): MappedTypeNode; + function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; + function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode; + function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; + function createTypeParameterDeclaration(name: string | Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; + function updateTypeParameterDeclaration(node: TypeParameterDeclaration, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; + function createPropertySignature(name: PropertyName | string, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature; + function updatePropertySignature(node: PropertySignature, name: PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature; + function createIndexSignatureDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node: IndexSignatureDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + function createParameter(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; + function updateParameter(node: ParameterDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration; + function createDecorator(expression: Expression): Decorator; + function updateDecorator(node: Decorator, expression: Expression): Decorator; + function createProperty(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression): PropertyDeclaration; + function updateProperty(node: PropertyDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, type: TypeNode | undefined, initializer: Expression): PropertyDeclaration; + function createMethodDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; + function updateMethod(node: MethodDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; + function createConstructor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + function createGetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; + function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; + function createSetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; + function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; + function createObjectBindingPattern(elements: BindingElement[]): ObjectBindingPattern; + function updateObjectBindingPattern(node: ObjectBindingPattern, elements: BindingElement[]): ObjectBindingPattern; + function createArrayBindingPattern(elements: ArrayBindingElement[]): ArrayBindingPattern; + function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern; + function createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression): BindingElement; + function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined): BindingElement; + function createArrayLiteral(elements?: Expression[], multiLine?: boolean): ArrayLiteralExpression; + function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression; + function createObjectLiteral(properties?: ObjectLiteralElementLike[], multiLine?: boolean): ObjectLiteralExpression; + function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElementLike[]): ObjectLiteralExpression; + function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression; + function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression; + function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression; + function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; + function createCall(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]): CallExpression; + function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]): CallExpression; + function createNew(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined): NewExpression; + function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined): NewExpression; + function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; + function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; + function createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion; + function updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion; + function createParen(expression: Expression): ParenthesizedExpression; + function updateParen(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression; + function createFunctionExpression(modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression; + function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression; + function createArrowFunction(modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody): ArrowFunction; + function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: ConciseBody): ArrowFunction; + function createDelete(expression: Expression): DeleteExpression; + function updateDelete(node: DeleteExpression, expression: Expression): DeleteExpression; + function createTypeOf(expression: Expression): TypeOfExpression; + function updateTypeOf(node: TypeOfExpression, expression: Expression): TypeOfExpression; + function createVoid(expression: Expression): VoidExpression; + function updateVoid(node: VoidExpression, expression: Expression): VoidExpression; + function createAwait(expression: Expression): AwaitExpression; + function updateAwait(node: AwaitExpression, expression: Expression): AwaitExpression; + function createPrefix(operator: PrefixUnaryOperator, operand: Expression): PrefixUnaryExpression; + function updatePrefix(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression; + function createPostfix(operand: Expression, operator: PostfixUnaryOperator): PostfixUnaryExpression; + function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; + function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression; + function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression; + function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; + function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression; + function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; + function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; + function updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; + function createYield(expression?: Expression): YieldExpression; + function createYield(asteriskToken: AsteriskToken, expression: Expression): YieldExpression; + function updateYield(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression): YieldExpression; + function createSpread(expression: Expression): SpreadElement; + function updateSpread(node: SpreadElement, expression: Expression): SpreadElement; + function createClassExpression(modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; + function updateClassExpression(node: ClassExpression, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; + function createOmittedExpression(): OmittedExpression; + function createExpressionWithTypeArguments(typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; + function updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; + function createAsExpression(expression: Expression, type: TypeNode): AsExpression; + function updateAsExpression(node: AsExpression, expression: Expression, type: TypeNode): AsExpression; + function createNonNullExpression(expression: Expression): NonNullExpression; + function updateNonNullExpression(node: NonNullExpression, expression: Expression): NonNullExpression; + function createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; + function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; + function createBlock(statements: Statement[], multiLine?: boolean): Block; + function updateBlock(node: Block, statements: Statement[]): Block; + function createVariableStatement(modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList | VariableDeclaration[]): VariableStatement; + function updateVariableStatement(node: VariableStatement, modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement; + function createVariableDeclarationList(declarations: VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList; + function updateVariableDeclarationList(node: VariableDeclarationList, declarations: VariableDeclaration[]): VariableDeclarationList; + function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression): VariableDeclaration; + function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration; + function createEmptyStatement(): EmptyStatement; + function createStatement(expression: Expression): ExpressionStatement; + function updateStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; + function createIf(expression: Expression, thenStatement: Statement, elseStatement?: Statement): IfStatement; + function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined): IfStatement; + function createDo(statement: Statement, expression: Expression): DoStatement; + function updateDo(node: DoStatement, statement: Statement, expression: Expression): DoStatement; + function createWhile(expression: Expression, statement: Statement): WhileStatement; + function updateWhile(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement; + function createFor(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; + function updateFor(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; + function createForIn(initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; + function updateForIn(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; + function createForOf(awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; + function updateForOf(node: ForOfStatement, awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; + function createContinue(label?: string | Identifier): ContinueStatement; + function updateContinue(node: ContinueStatement, label: Identifier | undefined): ContinueStatement; + function createBreak(label?: string | Identifier): BreakStatement; + function updateBreak(node: BreakStatement, label: Identifier | undefined): BreakStatement; + function createReturn(expression?: Expression): ReturnStatement; + function updateReturn(node: ReturnStatement, expression: Expression | undefined): ReturnStatement; + function createWith(expression: Expression, statement: Statement): WithStatement; + function updateWith(node: WithStatement, expression: Expression, statement: Statement): WithStatement; + function createSwitch(expression: Expression, caseBlock: CaseBlock): SwitchStatement; + function updateSwitch(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement; + function createLabel(label: string | Identifier, statement: Statement): LabeledStatement; + function updateLabel(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement; + function createThrow(expression: Expression): ThrowStatement; + function updateThrow(node: ThrowStatement, expression: Expression): ThrowStatement; + function createTry(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; + function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; + function createFunctionDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; + function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; + function createClassDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; + function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; + function createEnumDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, members: EnumMember[]): EnumDeclaration; + function updateEnumDeclaration(node: EnumDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, members: EnumMember[]): EnumDeclaration; + function createModuleDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; + function updateModuleDeclaration(node: ModuleDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; + function createModuleBlock(statements: Statement[]): ModuleBlock; + function updateModuleBlock(node: ModuleBlock, statements: Statement[]): ModuleBlock; + function createCaseBlock(clauses: CaseOrDefaultClause[]): CaseBlock; + function updateCaseBlock(node: CaseBlock, clauses: CaseOrDefaultClause[]): CaseBlock; + function createImportEqualsDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + function createImportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier?: Expression): ImportDeclaration; + function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression | undefined): ImportDeclaration; + function createImportClause(name: Identifier, namedBindings: NamedImportBindings): ImportClause; + function updateImportClause(node: ImportClause, name: Identifier, namedBindings: NamedImportBindings): ImportClause; + function createNamespaceImport(name: Identifier): NamespaceImport; + function updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; + function createNamedImports(elements: ImportSpecifier[]): NamedImports; + function updateNamedImports(node: NamedImports, elements: ImportSpecifier[]): NamedImports; + function createImportSpecifier(propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; + function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; + function createExportAssignment(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, isExportEquals: boolean, expression: Expression): ExportAssignment; + function updateExportAssignment(node: ExportAssignment, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, expression: Expression): ExportAssignment; + function createExportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier?: Expression): ExportDeclaration; + function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration; + function createNamedExports(elements: ExportSpecifier[]): NamedExports; + function updateNamedExports(node: NamedExports, elements: ExportSpecifier[]): NamedExports; + function createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; + function updateExportSpecifier(node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier; + function createExternalModuleReference(expression: Expression): ExternalModuleReference; + function updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference; + function createJsxElement(openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; + function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; + function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement; + function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement; + function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; + function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; + function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement; + function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; + function createJsxAttributes(properties: JsxAttributeLike[]): JsxAttributes; + function updateJsxAttributes(jsxAttributes: JsxAttributes, properties: JsxAttributeLike[]): JsxAttributes; + function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; + function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; + function createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute; + function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; + function createJsxExpression(dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined): JsxExpression; + function updateJsxExpression(node: JsxExpression, expression: Expression | undefined): JsxExpression; + function createHeritageClause(token: HeritageClause["token"], types: ExpressionWithTypeArguments[]): HeritageClause; + function updateHeritageClause(node: HeritageClause, types: ExpressionWithTypeArguments[]): HeritageClause; + function createCaseClause(expression: Expression, statements: Statement[]): CaseClause; + function updateCaseClause(node: CaseClause, expression: Expression, statements: Statement[]): CaseClause; + function createDefaultClause(statements: Statement[]): DefaultClause; + function updateDefaultClause(node: DefaultClause, statements: Statement[]): DefaultClause; + function createCatchClause(variableDeclaration: string | VariableDeclaration, block: Block): CatchClause; + function updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration, block: Block): CatchClause; + function createPropertyAssignment(name: string | PropertyName, initializer: Expression): PropertyAssignment; + function updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment; + function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression): ShorthandPropertyAssignment; + function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined): ShorthandPropertyAssignment; + function createSpreadAssignment(expression: Expression): SpreadAssignment; + function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; + function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; + function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; + function updateSourceFileNode(node: SourceFile, statements: Statement[]): SourceFile; + /** + * Creates a shallow, memberwise clone of a node for mutation. + */ + function getMutableClone(node: T): T; + /** + * Creates a synthetic statement to act as a placeholder for a not-emitted statement in + * order to preserve comments. + * + * @param original The original statement. + */ + function createNotEmittedStatement(original: Node): NotEmittedStatement; + /** + * Creates a synthetic expression to act as a placeholder for a not-emitted expression in + * order to preserve comments or sourcemap positions. + * + * @param expression The inner expression to emit. + * @param original The original outer expression. + * @param location The location for the expression. Defaults to the positions from "original" if provided. + */ + function createPartiallyEmittedExpression(expression: Expression, original?: Node): PartiallyEmittedExpression; + function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; + function createBundle(sourceFiles: SourceFile[]): Bundle; + function updateBundle(node: Bundle, sourceFiles: SourceFile[]): Bundle; + function createComma(left: Expression, right: Expression): Expression; + function createLessThan(left: Expression, right: Expression): Expression; + function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; + function createAssignment(left: Expression, right: Expression): BinaryExpression; + function createStrictEquality(left: Expression, right: Expression): BinaryExpression; + function createStrictInequality(left: Expression, right: Expression): BinaryExpression; + function createAdd(left: Expression, right: Expression): BinaryExpression; + function createSubtract(left: Expression, right: Expression): BinaryExpression; + function createPostfixIncrement(operand: Expression): PostfixUnaryExpression; + function createLogicalAnd(left: Expression, right: Expression): BinaryExpression; + function createLogicalOr(left: Expression, right: Expression): BinaryExpression; + function createLogicalNot(operand: Expression): PrefixUnaryExpression; + function createVoidZero(): VoidExpression; + function createExportDefault(expression: Expression): ExportAssignment; + function createExternalModuleExport(exportName: Identifier): ExportDeclaration; + /** + * Clears any EmitNode entries from parse-tree nodes. + * @param sourceFile A source file. + */ + function disposeEmitNodes(sourceFile: SourceFile): void; + function setTextRange(range: T, location: TextRange | undefined): T; + /** + * Gets flags that control emit behavior of a node. + */ + function getEmitFlags(node: Node): EmitFlags | undefined; + /** + * Sets flags that control emit behavior of a node. + */ + function setEmitFlags(node: T, emitFlags: EmitFlags): T; + /** + * Gets a custom text range to use when emitting source maps. + */ + function getSourceMapRange(node: Node): TextRange; + /** + * Sets a custom text range to use when emitting source maps. + */ + function setSourceMapRange(node: T, range: TextRange | undefined): T; + /** + * Gets the TextRange to use for source maps for a token of a node. + */ + function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange | undefined; + /** + * Sets the TextRange to use for source maps for a token of a node. + */ + function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange | undefined): T; + /** + * Gets a custom text range to use when emitting comments. + */ + function getCommentRange(node: Node): TextRange; + /** + * Sets a custom text range to use when emitting comments. + */ + function setCommentRange(node: T, range: TextRange): T; + function getSyntheticLeadingComments(node: Node): SynthesizedComment[] | undefined; + function setSyntheticLeadingComments(node: T, comments: SynthesizedComment[]): T; + function addSyntheticLeadingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T; + function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined; + function setSyntheticTrailingComments(node: T, comments: SynthesizedComment[]): T; + function addSyntheticTrailingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T; + /** + * Gets the constant value to emit for an expression. + */ + function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; + /** + * Sets the constant value to emit for an expression. + */ + function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelper(node: T, helper: EmitHelper): T; + /** + * Add EmitHelpers to a node. + */ + function addEmitHelpers(node: T, helpers: EmitHelper[] | undefined): T; + /** + * Removes an EmitHelper from a node. + */ + function removeEmitHelper(node: Node, helper: EmitHelper): boolean; + /** + * Gets the EmitHelpers of a node. + */ + function getEmitHelpers(node: Node): EmitHelper[] | undefined; + /** + * Moves matching emit helpers from a source node to a target node. + */ + function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; + function setOriginalNode(node: T, original: Node | undefined): T; } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; @@ -2301,6 +3070,10 @@ declare namespace ts { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { + /** Array that is only intended to be pushed to, never read. */ + interface Push { + push(value: T): void; + } function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; @@ -2313,17 +3086,120 @@ declare namespace ts { */ function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; /** - * Given a set of options, returns the set of type directive names - * that should be included for this program automatically. - * This list could either come from the config file, - * or from enumerating the types root + initial secondary types lookup location. - * More type directives might appear in the program later as a result of loading actual source files; - * this list is only the set of defaults that are implicitly included. - */ + * Given a set of options, returns the set of type directive names + * that should be included for this program automatically. + * This list could either come from the config file, + * or from enumerating the types root + initial secondary types lookup location. + * More type directives might appear in the program later as a result of loading actual source files; + * this list is only the set of defaults that are implicitly included. + */ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + /** + * Cached module resolutions per containing directory. + * This assumes that any module id will have the same resolution for sibling files located in the same folder. + */ + interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; + } + /** + * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory + * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. + */ + interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; + } + interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; + } + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; +} +declare namespace ts { + /** + * Visits a Node using the supplied visitor, possibly returning a new Node in its place. + * + * @param node The Node to visit. + * @param visitor The callback used to visit the Node. + * @param test A callback to execute to verify the Node is valid. + * @param lift An optional callback to execute to lift a NodeArray into a valid Node. + */ + function visitNode(node: T, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T; + /** + * Visits a Node using the supplied visitor, possibly returning a new Node in its place. + * + * @param node The Node to visit. + * @param visitor The callback used to visit the Node. + * @param test A callback to execute to verify the Node is valid. + * @param lift An optional callback to execute to lift a NodeArray into a valid Node. + */ + function visitNode(node: T | undefined, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T | undefined; + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + function visitNodes(nodes: NodeArray, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; + /** + * Starts a new lexical environment and visits a statement list, ending the lexical environment + * and merging hoisted declarations upon completion. + */ + function visitLexicalEnvironment(statements: NodeArray, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray; + /** + * Starts a new lexical environment and visits a parameter list, suspending the lexical + * environment upon completion. + */ + function visitParameterList(nodes: NodeArray, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes): NodeArray; + /** + * Resumes a suspended lexical environment and visits a function body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody; + /** + * Resumes a suspended lexical environment and visits a function body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined; + /** + * Resumes a suspended lexical environment and visits a concise body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody; + /** + * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + * + * @param node The Node whose children will be visited. + * @param visitor The callback used to visit each child. + * @param context A lexical environment context for the visitor. + */ + function visitEachChild(node: T, visitor: Visitor, context: TransformationContext): T; + /** + * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + * + * @param node The Node whose children will be visited. + * @param visitor The callback used to visit each child. + * @param context A lexical environment context for the visitor. + */ + function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; +} +declare namespace ts { + function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer; } declare namespace ts { function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; @@ -2340,31 +3216,32 @@ declare namespace ts { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic; }; /** - * Parse the text of the tsconfig.json file - * @param fileName The path to the config file - * @param jsonText The text of the config file - */ + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments?: boolean): { config?: any; error?: Diagnostic; }; /** - * Parse the contents of a config file (tsconfig.json). - * @param json The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine; + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: JsFileExtensionInfo[]): ParsedCommandLine; function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; @@ -2391,12 +3268,14 @@ declare namespace ts { getText(sourceFile?: SourceFile): string; getFirstToken(sourceFile?: SourceFile): Node; getLastToken(sourceFile?: SourceFile): Node; + forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; } interface Symbol { getFlags(): SymbolFlags; getName(): string; getDeclarations(): Declaration[]; getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } interface Type { getFlags(): TypeFlags; @@ -2408,15 +3287,16 @@ declare namespace ts { getConstructSignatures(): Signature[]; getStringIndexType(): Type; getNumberIndexType(): Type; - getBaseTypes(): ObjectType[]; + getBaseTypes(): BaseType[]; getNonNullableType(): Type; } interface Signature { getDeclaration(): SignatureDeclaration; - getTypeParameters(): Type[]; + getTypeParameters(): TypeParameter[]; getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; @@ -2425,6 +3305,9 @@ declare namespace ts { getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } + interface SourceFileLike { + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + } /** * Represents an immutable snapshot of a script at a specified time.Once acquired, the * snapshot is observably immutable. i.e. the same calls with the same parameters will return @@ -2483,6 +3366,10 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists?(directoryName: string): boolean; getDirectories?(directoryName: string): string[]; + /** + * Gets a set of custom transformers to use during emit. + */ + getCustomTransformers?(): CustomTransformers | undefined; } interface LanguageService { cleanupSemanticCache(): void; @@ -2528,7 +3415,7 @@ declare namespace ts { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[]; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[]; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; getProgram(): Program; dispose(): void; @@ -2604,19 +3491,20 @@ declare namespace ts { /** The position in newText the caret should point to after the insertion. */ caretOffset: number; } - interface RenameLocation { + interface DocumentSpan { textSpan: TextSpan; fileName: string; } - interface ReferenceEntry { - textSpan: TextSpan; - fileName: string; + interface RenameLocation extends DocumentSpan { + } + interface ReferenceEntry extends DocumentSpan { isWriteAccess: boolean; isDefinition: boolean; + isInString?: true; } - interface ImplementationLocation { - textSpan: TextSpan; - fileName: string; + interface ImplementationLocation extends DocumentSpan { + kind: string; + displayParts: SymbolDisplayPart[]; } interface DocumentHighlights { fileName: string; @@ -2630,6 +3518,7 @@ declare namespace ts { } interface HighlightSpan { fileName?: string; + isInString?: true; textSpan: TextSpan; kind: string; } @@ -2669,6 +3558,7 @@ declare namespace ts { InsertSpaceAfterCommaDelimiter: boolean; InsertSpaceAfterSemicolonInForStatements: boolean; InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; @@ -2677,6 +3567,7 @@ declare namespace ts { InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; } @@ -2684,6 +3575,7 @@ declare namespace ts { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; @@ -2692,6 +3584,7 @@ declare namespace ts { insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } @@ -2738,12 +3631,17 @@ declare namespace ts { text: string; kind: string; } + interface JSDocTagInfo { + name: string; + text?: string; + } interface QuickInfo { kind: string; kindModifiers: string; textSpan: TextSpan; displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } interface RenameInfo { canRename: boolean; @@ -2774,6 +3672,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. @@ -2800,10 +3699,10 @@ declare namespace ts { kindModifiers: string; sortText: string; /** - * An optional span that indicates the text to be replaced by this completion item. It will be - * set if the required span differs from the one generated by the default replacement behavior and should - * be used in that case - */ + * An optional span that indicates the text to be replaced by this completion item. It will be + * set if the required span differs from the one generated by the default replacement behavior and should + * be used in that case + */ replacementSpan?: TextSpan; } interface CompletionEntryDetails { @@ -2812,6 +3711,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } interface OutliningSpan { /** The span of the document to actually collapse. */ @@ -2821,9 +3721,9 @@ declare namespace ts { /** The text to display in the editor for the collapsed region. */ bannerText: string; /** - * Whether or not this region should be automatically collapsed when - * the 'Collapse to Definitions' command is invoked. - */ + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ autoCollapse: boolean; } interface EmitOutput { @@ -2911,7 +3811,7 @@ declare namespace ts { const typeElement = "type"; /** enum E */ const enumElement = "enum"; - const enumMemberElement = "const"; + const enumMemberElement = "enum member"; /** * Inside module and script only * const v = .. @@ -2954,6 +3854,10 @@ declare namespace ts { const letElement = "let"; const directory = "directory"; const externalModuleName = "external module name"; + /** + * + */ + const jsxAttribute = "JSX attribute"; } namespace ScriptElementKindModifier { const none = ""; @@ -3022,61 +3926,61 @@ declare namespace ts { } declare namespace ts { /** - * The document registry represents a store of SourceFile objects that can be shared between - * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) - * of files in the context. - * SourceFile objects account for most of the memory usage by the language service. Sharing - * the same DocumentRegistry instance between different instances of LanguageService allow - * for more efficient memory utilization since all projects will share at least the library - * file (lib.d.ts). - * - * A more advanced use of the document registry is to serialize sourceFile objects to disk - * and re-hydrate them when needed. - * - * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it - * to all subsequent createLanguageService calls. - */ + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ interface DocumentRegistry { /** - * Request a stored SourceFile with a given fileName and compilationSettings. - * The first call to acquire will call createLanguageServiceSourceFile to generate - * the SourceFile if was not found in the registry. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - */ + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; /** - * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile - * to get an updated SourceFile. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @param scriptSnapshot Text of the file. - * @param version Current version of the file. - */ + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. + */ updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey; /** - * Informs the DocumentRegistry that a file is not needed any longer. - * - * Note: It is not allowed to call release on a SourceFile that was not acquired from - * this registry originally. - * - * @param fileName The name of the file to be released - * @param compilationSettings The compilation settings used to acquire the file - */ + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; reportStats(): string; @@ -3120,11 +4024,20 @@ declare namespace ts { function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; /** - * Get the path of the default library files (lib.d.ts) as distributed with the typescript - * node package. - * The functionality is not supported if the ts module is consumed outside of a node module. - */ + * Get the path of the default library files (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ function getDefaultLibFilePath(options: CompilerOptions): string; } +declare namespace ts { + /** + * Transform one or more nodes using the supplied transformers. + * @param source A single `Node` or an array of `Node` objects. + * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. + * @param compilerOptions Optional compiler options. + */ + function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions): TransformationResult; +} export = ts; \ No newline at end of file diff --git a/node_modules/typescript/lib/typescript.js b/node_modules/typescript/lib/typescript.js index d4ad545cf..ad7cbabef 100644 --- a/node_modules/typescript/lib/typescript.js +++ b/node_modules/typescript/lib/typescript.js @@ -13,11 +13,24 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +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; }; +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 __()); + }; +})(); var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword @@ -168,191 +181,191 @@ var ts; SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword"; SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword"; SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 133] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 134] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 135] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 136] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 137] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 138] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 139] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 140] = "OfKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 133] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 134] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 135] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 136] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 137] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 138] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 139] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 140] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 141] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 141] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 142] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 142] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 143] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 143] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 144] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 145] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 144] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 145] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 146] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 147] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 148] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 149] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 150] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 151] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 152] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 153] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 154] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 155] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 147] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 148] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 149] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 150] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 151] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 152] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 153] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 154] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 155] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 156] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 156] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 157] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 158] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 159] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 160] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 161] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 162] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 163] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 164] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 165] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 166] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 167] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 168] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 169] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 170] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 171] = "LiteralType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 157] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 158] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 159] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 160] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 161] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 162] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 163] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 164] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 165] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 166] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 167] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 168] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 169] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 170] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 171] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 172] = "LiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 172] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 173] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 174] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 173] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 174] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 175] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 175] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 176] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 177] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 178] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 179] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 180] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 181] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 182] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 183] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 184] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 185] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 186] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 187] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 188] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 189] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 190] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 191] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 192] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 193] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 194] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 195] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 196] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 197] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 198] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 199] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 200] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 201] = "NonNullExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 176] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 177] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 179] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 180] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 181] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 182] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 183] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 184] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 185] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 186] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 187] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 188] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 189] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 190] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 191] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 192] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 193] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 194] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 195] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 196] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 197] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 198] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 199] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 200] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 201] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 202] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 203] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 202] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 203] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 204] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 205] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 204] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 205] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 206] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 207] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 208] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 209] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 210] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 211] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 212] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 213] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 214] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 215] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 216] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 217] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 218] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 219] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 220] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 221] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 222] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 223] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 224] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 225] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 226] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 227] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 228] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 229] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 230] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 231] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 232] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 233] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 234] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 235] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 236] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 237] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 238] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 239] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 240] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 241] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 242] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 243] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 244] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 206] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 207] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 208] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 209] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 210] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 211] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 212] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 213] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 214] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 215] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 216] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 217] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 218] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 219] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 220] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 221] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 222] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 223] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 224] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 226] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 227] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 228] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 229] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 230] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 231] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 232] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 233] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 234] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 235] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 236] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 237] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 238] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 239] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 240] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 241] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 242] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 243] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 244] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 245] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 246] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 247] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 246] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 247] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 248] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 249] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 250] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 251] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 252] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 248] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 249] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 250] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 251] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 252] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 253] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 254] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 255] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 253] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 254] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 255] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 256] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 256] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 257] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 258] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 259] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 257] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 258] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 259] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 260] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 261] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 262] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 260] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 263] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 261] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 264] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 265] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 262] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 266] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 263] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 267] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 264] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 265] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 266] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 267] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 268] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 269] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 270] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 271] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 272] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 273] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 274] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 275] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 276] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 268] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 269] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 270] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 271] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 272] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 273] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 274] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 275] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 276] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 277] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 278] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 279] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 280] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 281] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 283] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 284] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 285] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 286] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 287] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 288] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 289] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 290] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 291] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 292] = "JSDocLiteralType"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; // Enum value count SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; // Markers @@ -363,15 +376,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 140] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 141] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 156] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 171] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 157] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 172] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 140] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 141] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -380,11 +393,11 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 142] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 266] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 282] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -399,28 +412,22 @@ var ts; NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn"; NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn"; NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation"; - NodeFlags[NodeFlags["HasClassExtends"] = 1024] = "HasClassExtends"; - NodeFlags[NodeFlags["HasDecorators"] = 2048] = "HasDecorators"; - NodeFlags[NodeFlags["HasParamDecorators"] = 4096] = "HasParamDecorators"; - NodeFlags[NodeFlags["HasAsyncFunctions"] = 8192] = "HasAsyncFunctions"; - NodeFlags[NodeFlags["HasSpreadAttribute"] = 16384] = "HasSpreadAttribute"; - NodeFlags[NodeFlags["HasRestAttribute"] = 32768] = "HasRestAttribute"; - NodeFlags[NodeFlags["DisallowInContext"] = 65536] = "DisallowInContext"; - NodeFlags[NodeFlags["YieldContext"] = 131072] = "YieldContext"; - NodeFlags[NodeFlags["DecoratorContext"] = 262144] = "DecoratorContext"; - NodeFlags[NodeFlags["AwaitContext"] = 524288] = "AwaitContext"; - NodeFlags[NodeFlags["ThisNodeHasError"] = 1048576] = "ThisNodeHasError"; - NodeFlags[NodeFlags["JavaScriptFile"] = 2097152] = "JavaScriptFile"; - NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 4194304] = "ThisNodeOrAnySubNodesHasError"; - NodeFlags[NodeFlags["HasAggregatedChildData"] = 8388608] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 1024] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 2048] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 4096] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 8192] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 16384] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 32768] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; - NodeFlags[NodeFlags["EmitHelperFlags"] = 64512] = "EmitHelperFlags"; - NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 64896] = "ReachabilityAndEmitFlags"; + NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; // Parsing context flags - NodeFlags[NodeFlags["ContextFlags"] = 3080192] = "ContextFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 96256] = "ContextFlags"; // Exclude these flags when parsing a Type - NodeFlags[NodeFlags["TypeExcludesFlags"] = 655360] = "TypeExcludesFlags"; + NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags"; })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); var ModifierFlags; (function (ModifierFlags) { @@ -469,6 +476,17 @@ var ts; GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique"; GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node"; })(GeneratedIdentifierKind = ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {})); + /* @internal */ + var NumericLiteralFlags; + (function (NumericLiteralFlags) { + NumericLiteralFlags[NumericLiteralFlags["None"] = 0] = "None"; + NumericLiteralFlags[NumericLiteralFlags["Scientific"] = 2] = "Scientific"; + NumericLiteralFlags[NumericLiteralFlags["Octal"] = 4] = "Octal"; + NumericLiteralFlags[NumericLiteralFlags["HexSpecifier"] = 8] = "HexSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinarySpecifier"] = 16] = "BinarySpecifier"; + NumericLiteralFlags[NumericLiteralFlags["OctalSpecifier"] = 32] = "OctalSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctalSpecifier"] = 48] = "BinaryOrOctalSpecifier"; + })(NumericLiteralFlags = ts.NumericLiteralFlags || (ts.NumericLiteralFlags = {})); var FlowFlags; (function (FlowFlags) { FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable"; @@ -482,6 +500,8 @@ var ts; FlowFlags[FlowFlags["ArrayMutation"] = 256] = "ArrayMutation"; FlowFlags[FlowFlags["Referenced"] = 512] = "Referenced"; FlowFlags[FlowFlags["Shared"] = 1024] = "Shared"; + FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally"; + FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally"; FlowFlags[FlowFlags["Label"] = 12] = "Label"; FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {})); @@ -503,6 +523,16 @@ var ts; // Diagnostics were produced and outputs were generated in spite of them. ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var NodeBuilderFlags; + (function (NodeBuilderFlags) { + NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None"; + NodeBuilderFlags[NodeBuilderFlags["allowThisInObjectLiteral"] = 1] = "allowThisInObjectLiteral"; + NodeBuilderFlags[NodeBuilderFlags["allowQualifedNameInPlaceOfIdentifier"] = 2] = "allowQualifedNameInPlaceOfIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowTypeParameterInQualifiedName"] = 4] = "allowTypeParameterInQualifiedName"; + NodeBuilderFlags[NodeBuilderFlags["allowAnonymousIdentifier"] = 8] = "allowAnonymousIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyUnionOrIntersection"] = 16] = "allowEmptyUnionOrIntersection"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyTuple"] = 32] = "allowEmptyTuple"; + })(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {})); var TypeFormatFlags; (function (TypeFormatFlags) { TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; @@ -517,6 +547,8 @@ var ts; TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias"; TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue"; + TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 2048] = "SuppressAnyReturnType"; + TypeFormatFlags[TypeFormatFlags["AddUndefined"] = 4096] = "AddUndefined"; })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var SymbolFormatFlags; (function (SymbolFormatFlags) { @@ -549,8 +581,7 @@ var ts; TypePredicateKind[TypePredicateKind["This"] = 0] = "This"; TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier"; })(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {})); - /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator - * metadata */ + /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator metadata */ /* @internal */ var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { @@ -598,13 +629,10 @@ var ts; SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType"; SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace"; SymbolFlags[SymbolFlags["Alias"] = 8388608] = "Alias"; - SymbolFlags[SymbolFlags["Instantiated"] = 16777216] = "Instantiated"; - SymbolFlags[SymbolFlags["Merged"] = 33554432] = "Merged"; - SymbolFlags[SymbolFlags["Transient"] = 67108864] = "Transient"; - SymbolFlags[SymbolFlags["Prototype"] = 134217728] = "Prototype"; - SymbolFlags[SymbolFlags["SyntheticProperty"] = 268435456] = "SyntheticProperty"; - SymbolFlags[SymbolFlags["Optional"] = 536870912] = "Optional"; - SymbolFlags[SymbolFlags["ExportStar"] = 1073741824] = "ExportStar"; + SymbolFlags[SymbolFlags["Prototype"] = 16777216] = "Prototype"; + SymbolFlags[SymbolFlags["ExportStar"] = 33554432] = "ExportStar"; + SymbolFlags[SymbolFlags["Optional"] = 67108864] = "Optional"; + SymbolFlags[SymbolFlags["Transient"] = 134217728] = "Transient"; SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; @@ -648,11 +676,27 @@ var ts; SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable"; })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {})); /* @internal */ + var CheckFlags; + (function (CheckFlags) { + CheckFlags[CheckFlags["Instantiated"] = 1] = "Instantiated"; + CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty"; + CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod"; + CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly"; + CheckFlags[CheckFlags["Partial"] = 16] = "Partial"; + CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType"; + CheckFlags[CheckFlags["ContainsPublic"] = 64] = "ContainsPublic"; + CheckFlags[CheckFlags["ContainsProtected"] = 128] = "ContainsProtected"; + CheckFlags[CheckFlags["ContainsPrivate"] = 256] = "ContainsPrivate"; + CheckFlags[CheckFlags["ContainsStatic"] = 512] = "ContainsStatic"; + CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic"; + })(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {})); + /* @internal */ var NodeCheckFlags; (function (NodeCheckFlags) { NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["CaptureNewTarget"] = 8] = "CaptureNewTarget"; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; @@ -701,6 +745,9 @@ var ts; TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; /* @internal */ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["NonPrimitive"] = 16777216] = "NonPrimitive"; + /* @internal */ + TypeFlags[TypeFlags["JsxAttributes"] = 33554432] = "JsxAttributes"; /* @internal */ TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable"; TypeFlags[TypeFlags["Literal"] = 480] = "Literal"; @@ -709,7 +756,7 @@ var ts; TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy"; TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic"; + TypeFlags[TypeFlags["Intrinsic"] = 16793231] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; @@ -718,11 +765,12 @@ var ts; TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; - TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["StructuredOrTypeVariable"] = 1032192] = "StructuredOrTypeVariable"; + TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never - TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable"; - TypeFlags[TypeFlags["NotUnionOrUnit"] = 33281] = "NotUnionOrUnit"; + TypeFlags[TypeFlags["Narrowable"] = 17810431] = "Narrowable"; + TypeFlags[TypeFlags["NotUnionOrUnit"] = 16810497] = "NotUnionOrUnit"; /* @internal */ TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; /* @internal */ @@ -764,6 +812,8 @@ var ts; SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty"; /// this.name = expr SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty"; + // F.name = expr + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["Property"] = 5] = "Property"; })(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); var DiagnosticCategory; (function (DiagnosticCategory) { @@ -790,6 +840,7 @@ var ts; JsxEmit[JsxEmit["None"] = 0] = "None"; JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve"; JsxEmit[JsxEmit["React"] = 2] = "React"; + JsxEmit[JsxEmit["ReactNative"] = 3] = "ReactNative"; })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); var NewLineKind; (function (NewLineKind) { @@ -803,6 +854,7 @@ var ts; ScriptKind[ScriptKind["JSX"] = 2] = "JSX"; ScriptKind[ScriptKind["TS"] = 3] = "TS"; ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; + ScriptKind[ScriptKind["External"] = 5] = "External"; })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {})); var ScriptTarget; (function (ScriptTarget) { @@ -1037,7 +1089,6 @@ var ts; TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask"; TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask"; })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); - /* @internal */ var EmitFlags; (function (EmitFlags) { EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine"; @@ -1065,15 +1116,45 @@ var ts; EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue"; EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting"; EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker"; + EmitFlags[EmitFlags["Iterator"] = 4194304] = "Iterator"; })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); + /** + * Used by the checker, this enum keeps track of external emit helpers that should be type + * checked. + */ /* @internal */ - var EmitContext; - (function (EmitContext) { - EmitContext[EmitContext["SourceFile"] = 0] = "SourceFile"; - EmitContext[EmitContext["Expression"] = 1] = "Expression"; - EmitContext[EmitContext["IdentifierName"] = 2] = "IdentifierName"; - EmitContext[EmitContext["Unspecified"] = 3] = "Unspecified"; - })(EmitContext = ts.EmitContext || (ts.EmitContext = {})); + var ExternalEmitHelpers; + (function (ExternalEmitHelpers) { + ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends"; + ExternalEmitHelpers[ExternalEmitHelpers["Assign"] = 2] = "Assign"; + ExternalEmitHelpers[ExternalEmitHelpers["Rest"] = 4] = "Rest"; + ExternalEmitHelpers[ExternalEmitHelpers["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers[ExternalEmitHelpers["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers[ExternalEmitHelpers["Param"] = 32] = "Param"; + ExternalEmitHelpers[ExternalEmitHelpers["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers[ExternalEmitHelpers["Generator"] = 128] = "Generator"; + ExternalEmitHelpers[ExternalEmitHelpers["Values"] = 256] = "Values"; + ExternalEmitHelpers[ExternalEmitHelpers["Read"] = 512] = "Read"; + ExternalEmitHelpers[ExternalEmitHelpers["Spread"] = 1024] = "Spread"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncGenerator"] = 2048] = "AsyncGenerator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncDelegator"] = 4096] = "AsyncDelegator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncValues"] = 8192] = "AsyncValues"; + // Helpers included by ES2015 for..of + ExternalEmitHelpers[ExternalEmitHelpers["ForOfIncludes"] = 256] = "ForOfIncludes"; + // Helpers included by ES2017 for..await..of + ExternalEmitHelpers[ExternalEmitHelpers["ForAwaitOfIncludes"] = 8192] = "ForAwaitOfIncludes"; + // Helpers included by ES2015 spread + ExternalEmitHelpers[ExternalEmitHelpers["SpreadIncludes"] = 1536] = "SpreadIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 8192] = "LastEmitHelper"; + })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); + var EmitHint; + (function (EmitHint) { + EmitHint[EmitHint["SourceFile"] = 0] = "SourceFile"; + EmitHint[EmitHint["Expression"] = 1] = "Expression"; + EmitHint[EmitHint["IdentifierName"] = 2] = "IdentifierName"; + EmitHint[EmitHint["Unspecified"] = 3] = "Unspecified"; + })(EmitHint = ts.EmitHint || (ts.EmitHint = {})); })(ts || (ts = {})); /*@internal*/ var ts; @@ -1101,8 +1182,8 @@ var ts; */ function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } @@ -1118,9 +1199,9 @@ var ts; */ function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; @@ -1130,7 +1211,7 @@ var ts; * @param markName The name of the mark. */ function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; /** @@ -1139,7 +1220,7 @@ var ts; * @param measureName The name of the measure whose durations should be accumulated. */ function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; /** @@ -1148,9 +1229,9 @@ var ts; * @param cb The action to perform for each measure */ function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; /** Enables (and resets) performance measurements for the compiler. */ @@ -1174,7 +1255,7 @@ var ts; var ts; (function (ts) { /** The version of the TypeScript compiler release */ - ts.version = "2.2.0-dev.20161127"; + ts.version = "2.3.0-dev.20170419"; })(ts || (ts = {})); /* @internal */ (function (ts) { @@ -1193,25 +1274,106 @@ var ts; Ternary[Ternary["Maybe"] = 1] = "Maybe"; Ternary[Ternary["True"] = -1] = "True"; })(Ternary = ts.Ternary || (ts.Ternary = {})); - var createObject = Object.create; // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); // tslint:disable-line:no-null-keyword + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(/*locales*/ undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + /** Create a MapLike with good performance. */ + function createDictionaryObject() { + var map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. // This disables creation of hidden classes, which are expensive when an object is // constantly changing shape. map["__"] = undefined; delete map["__"]; + return map; + } + /** Create a new map. If a template object is provided, the map will copy entries from it. */ + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); // Copies keys/values from template. Note that for..in will not throw if // template is undefined, and instead will just exit the loop. for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + // Internet Explorer's Map doesn't support iteration, so don't use it. + // tslint:disable-next-line:no-in-operator + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + // Keep the class inside a function so it doesn't get compiled if it's not used. + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + // tslint:disable-next-line:no-in-operator + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -1224,33 +1386,28 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } // path should already be well-formed so it does not need to be normalized function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -1270,6 +1427,10 @@ var ts; Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; })(Comparison = ts.Comparison || (ts.Comparison = {})); + function length(array) { + return array ? array.length : 0; + } + ts.length = length; /** * Iterates through 'array' by index and performs the callback on each element of array until the callback * returns a truthy value, then returns that value. @@ -1277,7 +1438,7 @@ var ts; */ function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1287,6 +1448,26 @@ var ts; return undefined; } ts.forEach = forEach; + /** + * Iterates through the parent chain of a node and performs the callback on each parent until the callback + * returns a truthy value, then returns that value. + * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" + * At that point findAncestor returns undefined. + */ + function findAncestor(node, callback) { + while (node) { + var result = callback(node); + if (result === "quit") { + return undefined; + } + else if (result) { + return node; + } + node = node.parent; + } + return undefined; + } + ts.findAncestor = findAncestor; function zipWith(arrayA, arrayB, callback) { Debug.assert(arrayA.length === arrayB.length); for (var i = 0; i < arrayA.length; i++) { @@ -1301,7 +1482,7 @@ var ts; */ function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -1312,7 +1493,7 @@ var ts; ts.every = every; /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -1321,12 +1502,22 @@ var ts; return undefined; } ts.find = find; + /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */ + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; /** * Returns the first truthy result of `callback`, or else fails. * This is like `forEach`, but never returns undefined. */ function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1349,7 +1540,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -1359,7 +1550,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -1569,21 +1760,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -1901,9 +2089,6 @@ var ts; /** * Indicates whether a map-like contains an own property with the specified key. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * the 'in' operator. - * * @param map A map-like. * @param key A property key. */ @@ -1914,9 +2099,6 @@ var ts; /** * Gets the value of an owned property in a map-like. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * an indexer. - * * @param map A map-like. * @param key A property key. */ @@ -1941,56 +2123,61 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - /** - * Enumerates the properties of a Map, invoking a callback and returning the first truthy result. - * - * @param map A map for which properties should be enumerated. - * @param callback A callback to invoke for each property. - */ - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator, map) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(map ? map(value) : value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - /** - * Returns true if a Map has some matching property. - * - * @param map A map whose properties should be tested. - * @param predicate An optional callback used to test each property. - */ - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function convertToArray(iterator, f) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(f(value)); } - return false; + return result; + var _b; } - ts.someProperties = someProperties; + ts.convertToArray = convertToArray; /** - * Performs a shallow copy of the properties from a source Map to a target MapLike - * - * @param source A map from which properties should be copied. - * @param target A map to which properties should be copied. + * Calls `callback` for each entry in the map, returning the first truthy result. + * Use `map.forEach` instead for normal iteration. */ - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachEntry = forEachEntry; + /** `forEachEntry` for just keys. */ + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } + } + return undefined; + var _b; + } + ts.forEachKey = forEachKey; + /** Copy entries from `source` to `target`. */ + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); } - ts.appendProperty = appendProperty; + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -1998,51 +2185,14 @@ var ts; } for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { var arg = args_1[_a]; - for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) { - var p = _c[_b]; - t[p] = arg[p]; - } + for (var p in arg) + if (hasProperty(arg, p)) { + t[p] = arg[p]; + } } return t; } ts.assign = assign; - /** - * Reduce the properties of a map. - * - * NOTE: This is intended for use with Map objects. For MapLike objects, use - * reduceOwnProperties instead as it offers better runtime safety. - * - * @param map The map to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; - /** - * Reduce the properties defined on a map-like (but not from its prototype chain). - * - * NOTE: This is intended for use with MapLike objects. For Map objects, use - * reduceProperties instead as it offers better performance. - * - * @param map The map-like to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -2073,23 +2223,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -2116,36 +2257,32 @@ var ts; return result; } ts.extend = extend; - /** - * Adds the value to an array of values associated with the key, and returns the array. - * Creates the array if it does not already exist. - */ - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - /** - * Removes a value from an array of values associated with the key. - * Does not preserve the order of those values. - * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. - */ - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; /** * Tests whether a value is an array. */ @@ -2226,6 +2363,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -2328,9 +2466,12 @@ var ts; if (b === undefined) return 1 /* GreaterThan */; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - // accent means a ≠ b, a ≠ aÌ, a = A - var result = a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); + // Checking if "collator exists indicates that Intl is available. + // We still have to check if "collator.compare" is correct. If it is not, use "String.localeComapre" + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); // accent means a ≠ b, a ≠ aÌ, a = A return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */; } a = a.toUpperCase(); @@ -2403,7 +2544,7 @@ var ts; ts.normalizeSlashes = normalizeSlashes; /** * Returns length of path root (i.e. length of "/", "x:/", "//server/share/, file:///user/files") - */ + */ function getRootLength(path) { if (path.charCodeAt(0) === 47 /* slash */) { if (path.charCodeAt(1) !== 47 /* slash */) @@ -2775,6 +2916,17 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + // If excluding, match "foo/bar/baz...", but if including, only allow "foo". + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } @@ -2785,31 +2937,10 @@ var ts; * files or directories, does not match subdirectories that start with a . character */ var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - // If excluding, match "foo/bar/baz...", but if including, only allow "foo". - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; /** * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension, * and does not contain any glob characters itself. @@ -2888,6 +3019,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -2900,34 +3032,50 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + // Associate an array of results with each include regex. This keeps results in order of the "include" order. + // If there are no "includes", then just put everything in results[0]. + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); + } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -2952,7 +3100,7 @@ var ts; } // Sort the offsets array using either the literal or canonical path representations. includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } @@ -2961,7 +3109,7 @@ var ts; // subpath of an existing base path for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -3010,8 +3158,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = allSupportedExtensions.slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (extensions.indexOf(extInfo.extension) === -1) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -3022,11 +3181,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -3044,14 +3203,13 @@ var ts; (function (ExtensionPriority) { ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles"; ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles"; - ExtensionPriority[ExtensionPriority["Limit"] = 5] = "Limit"; ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest"; ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest"; })(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {})); function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--) { if (fileExtensionIs(path, supportedExtensions[i])) { - return adjustExtensionPriority(i); + return adjustExtensionPriority(i, supportedExtensions); } } // If its not in the list of supported extensions, this is likely a @@ -3062,27 +3220,27 @@ var ts; /** * Adjusts an extension priority to be the highest priority within the same range. */ - function adjustExtensionPriority(extensionPriority) { + function adjustExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) { return 0 /* TypeScriptFiles */; } - else if (extensionPriority < 5 /* Limit */) { + else if (extensionPriority < supportedExtensions.length) { return 2 /* DeclarationAndJavaScriptFiles */; } else { - return 5 /* Limit */; + return supportedExtensions.length; } } ts.adjustExtensionPriority = adjustExtensionPriority; /** * Gets the next lowest extension priority for a given priority. */ - function getNextLowestExtensionPriority(extensionPriority) { + function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) { return 2 /* DeclarationAndJavaScriptFiles */; } else { - return 5 /* Limit */; + return supportedExtensions.length; } } ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority; @@ -3329,144 +3487,30 @@ var ts; } } ts.tryGetExtensionFromPath = tryGetExtensionFromPath; + function isCheckJsEnabledForFile(sourceFile, compilerOptions) { + return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; + } + ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile; })(ts || (ts = {})); /// var ts; (function (ts) { - ts.sys = (function () { - function getWScriptSystem() { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - var shell = new ActiveXObject("WScript.Shell"); - var fileStream = new ActiveXObject("ADODB.Stream"); - fileStream.Type = 2 /*text*/; - var binaryStream = new ActiveXObject("ADODB.Stream"); - binaryStream.Type = 1 /*binary*/; - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); - } - function readFile(fileName, encoding) { - if (!fso.FileExists(fileName)) { - return undefined; - } - fileStream.Open(); - try { - if (encoding) { - fileStream.Charset = encoding; - fileStream.LoadFromFile(fileName); - } - else { - // Load file and read the first two bytes into a string with no interpretation - fileStream.Charset = "x-ansi"; - fileStream.LoadFromFile(fileName); - var bom = fileStream.ReadText(2) || ""; - // Position must be at 0 before encoding can be changed - fileStream.Position = 0; - // [0xFF,0xFE] and [0xFE,0xFF] mean utf-16 (little or big endian), otherwise default to utf-8 - fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; - } - // ReadText method always strips byte order mark from resulting string - return fileStream.ReadText(); - } - catch (e) { - throw e; - } - finally { - fileStream.Close(); - } - } - function writeFile(fileName, data, writeByteOrderMark) { - fileStream.Open(); - binaryStream.Open(); - try { - // Write characters in UTF-8 encoding - fileStream.Charset = "utf-8"; - fileStream.WriteText(data); - // If we don't want the BOM, then skip it by setting the starting location to 3 (size of BOM). - // If not, start from position 0, as the BOM will be added automatically when charset==utf8. - if (writeByteOrderMark) { - fileStream.Position = 0; - } - else { - fileStream.Position = 3; - } - fileStream.CopyTo(binaryStream); - binaryStream.SaveToFile(fileName, 2 /*overwrite*/); - } - finally { - binaryStream.Close(); - fileStream.Close(); - } - } - function getNames(collection) { - var result = []; - for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { - result.push(e.item().Name); - } - return result.sort(); - } - function getDirectories(path) { - var folder = fso.GetFolder(path); - return getNames(folder.subfolders); - } - function getAccessibleFileSystemEntries(path) { - try { - var folder = fso.GetFolder(path || "."); - var files = getNames(folder.files); - var directories = getNames(folder.subfolders); - return { files: files, directories: directories }; - } - catch (e) { - return { files: [], directories: [] }; - } - } - function readDirectory(path, extensions, excludes, includes) { - return ts.matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries); - } - var wscriptSystem = { - args: args, - newLine: "\r\n", - useCaseSensitiveFileNames: false, - write: function (s) { - WScript.StdOut.Write(s); - }, - readFile: readFile, - writeFile: writeFile, - resolvePath: function (path) { - return fso.GetAbsolutePathName(path); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - createDirectory: function (directoryName) { - if (!wscriptSystem.directoryExists(directoryName)) { - fso.CreateFolder(directoryName); - } - }, - getExecutingFilePath: function () { - return WScript.ScriptFullName; - }, - getCurrentDirectory: function () { - return shell.CurrentDirectory; - }, - getDirectories: getDirectories, - getEnvironmentVariable: function (name) { - return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%" + name + "%"); - }, - readDirectory: readDirectory, - exit: function (exitCode) { - try { - WScript.Quit(exitCode); - } - catch (e) { - } - } - }; - return wscriptSystem; + function getNodeMajorVersion() { + if (typeof process === "undefined") { + return undefined; + } + var version = process.version; + if (!version) { + return undefined; + } + var dot = version.indexOf("."); + if (dot === -1) { + return undefined; } + return parseInt(version.substring(1, dot)); + } + ts.getNodeMajorVersion = getNodeMajorVersion; + ts.sys = (function () { function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); @@ -3476,32 +3520,32 @@ var ts; function createWatchedFileSet() { var dirWatchers = ts.createMap(); // One file can have multiple watchers - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -3513,7 +3557,7 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" @@ -3521,18 +3565,20 @@ var ts; ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); // Some applications save a working file via rename operations - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } } var watchedFileSet = createWatchedFileSet(); - function isNode4OrLater() { - return parseInt(process.version.charAt(1)) >= 4; - } + var nodeVersion = getNodeMajorVersion(); + var isNode4OrLater = nodeVersion >= 4; function isFileSystemCaseSensitive() { // win32\win64 are case insensitive platforms if (platform === "win32" || platform === "win64") { @@ -3553,7 +3599,7 @@ var ts; if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { // Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js, // flip all byte pairs and treat as little endian. - len &= ~1; + len &= ~1; // Round down to a multiple of 2 for (var i = 0; i < len; i += 2) { var temp = buffer[i]; buffer[i] = buffer[i + 1]; @@ -3580,7 +3626,7 @@ var ts; var fd; try { fd = _fs.openSync(fileName, "w"); - _fs.writeSync(fd, data, undefined, "utf8"); + _fs.writeSync(fd, data, /*position*/ undefined, "utf8"); } finally { if (fd !== undefined) { @@ -3600,10 +3646,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -3685,9 +3731,10 @@ var ts; // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643) var options; if (!directoryExists(directoryName)) { + // do nothing if target folder does not exist return noOpFileWatcher; } - if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } else { @@ -3701,7 +3748,6 @@ var ts; // When deleting a file, the passed baseFileName is null callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } - ; }); }, resolvePath: function (path) { @@ -3765,6 +3811,7 @@ var ts; require("source-map-support").install(); } catch (e) { + // Could not enable source maps. } }, setTimeout: setTimeout, @@ -3820,9 +3867,6 @@ var ts; if (typeof ChakraHost !== "undefined") { sys = getChakraSystem(); } - else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - sys = getWScriptSystem(); - } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { // process and process.nextTick checks if current environment is node-like // process.browser check excludes webpack and browserify @@ -3897,11 +3941,11 @@ var ts; Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, - Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: "Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059", message: "Return expression in async function does not have a valid callable 'then' member." }, - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: "Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060", message: "Expression body for async arrow function does not have a valid callable 'then' member." }, + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", message: "The return type of an async function must either be a valid promise or must not contain a callable 'then' member." }, + A_promise_must_have_a_then_method: { code: 1059, category: ts.DiagnosticCategory.Error, key: "A_promise_must_have_a_then_method_1059", message: "A promise must have a 'then' method." }, + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: { code: 1060, category: ts.DiagnosticCategory.Error, key: "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", message: "The first parameter of the 'then' method of a promise must be a callback." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, @@ -3910,7 +3954,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -3926,6 +3970,7 @@ var ts; Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, + A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: { code: 1103, category: ts.DiagnosticCategory.Error, key: "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", message: "A 'for-await-of' statement is only allowed within an async function or async generator." }, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, @@ -3933,7 +3978,7 @@ var ts; Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, + Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'." }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, @@ -3965,9 +4010,9 @@ var ts; Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", message: "Cannot use imports, exports, or module augmentations when '--module' is 'none'." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing." }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, + const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized." }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, @@ -4016,11 +4061,12 @@ var ts; Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode" }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." }, @@ -4066,6 +4112,11 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1320, category: ts.DiagnosticCategory.Error, key: "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", message: "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1321, category: ts.DiagnosticCategory.Error, key: "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", message: "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1322, category: ts.DiagnosticCategory.Error, key: "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", message: "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -4109,6 +4160,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -4119,19 +4171,20 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter." }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, + Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'." }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, @@ -4171,12 +4224,12 @@ var ts; The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class." }, The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, + Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'." }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, @@ -4185,19 +4238,19 @@ var ts; Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, + Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'." }, All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, + Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'." }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged." }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged." }, Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'" }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name." }, + Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'." }, Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'" }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, @@ -4206,18 +4259,20 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, + Class_0_used_before_its_declaration: { code: 2449, category: ts.DiagnosticCategory.Error, key: "Class_0_used_before_its_declaration_2449", message: "Class '{0}' used before its declaration." }, + Enum_0_used_before_its_declaration: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Enum_0_used_before_its_declaration_2450", message: "Enum '{0}' used before its declaration." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, + Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'." }, An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" }, + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern." }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, @@ -4238,13 +4293,13 @@ var ts; let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'." }, The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause" }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause." }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, @@ -4256,6 +4311,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, + Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: { code: 2504, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", message: "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator." }, A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, @@ -4270,6 +4326,7 @@ var ts; All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, + An_async_iterator_must_have_a_next_method: { code: 2519, category: ts.DiagnosticCategory.Error, key: "An_async_iterator_must_have_a_next_method_2519", message: "An async iterator must have a 'next()' method." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, @@ -4293,23 +4350,33 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, + Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." }, + The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: { code: 2547, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", message: "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property." }, + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2548, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", message: "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2549, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", message: "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: { code: 2550, category: ts.DiagnosticCategory.Error, key: "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", message: "Generic type instantiation is excessively deep and possibly infinite." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, + Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'." }, JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, - Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property." }, + The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property." }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, + Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React." }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, - Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element." }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'." }, super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, @@ -4341,7 +4408,6 @@ var ts; All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, - A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." }, An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, @@ -4350,9 +4416,17 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference." }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property." }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, + Required_type_parameters_may_not_follow_optional_type_parameters: { code: 2706, category: ts.DiagnosticCategory.Error, key: "Required_type_parameters_may_not_follow_optional_type_parameters_2706", message: "Required type parameters may not follow optional type parameters." }, + Generic_type_0_requires_between_1_and_2_type_arguments: { code: 2707, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_between_1_and_2_type_arguments_2707", message: "Generic type '{0}' requires between {1} and {2} type arguments." }, + Cannot_use_namespace_0_as_a_value: { code: 2708, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_value_2708", message: "Cannot use namespace '{0}' as a value." }, + Cannot_use_namespace_0_as_a_type: { code: 2709, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_type_2709", message: "Cannot use namespace '{0}' as a type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -4363,8 +4437,8 @@ var ts; Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "'extends' clause of exported class '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "'extends' clause of exported interface '{0}' has or is using private name '{1}'." }, Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, @@ -4425,16 +4499,18 @@ var ts; Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced: { code: 4093, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced_4093", message: "'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", message: "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported_file_encoding_5013", message: "Unsupported file encoding." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}." }, Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}" }, + Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", message: "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, @@ -4443,12 +4519,12 @@ var ts; A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, - The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'." }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'." }, Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, - Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character." }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character." }, Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_should_be_an_array_5063", message: "Substitutions for pattern '{0}' should be an array." }, Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, @@ -4466,11 +4542,11 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'." }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -4485,11 +4561,12 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -4511,17 +4588,18 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context (experimental)." }, Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'." }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", message: "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit" }, Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, @@ -4532,23 +4610,23 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, + package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, - Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, - Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, - Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, - Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'." }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'." }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'." }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'." }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'." }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed." }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, @@ -4558,32 +4636,67 @@ var ts; Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, - Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'." }, Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, - Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'." }, Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, - Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'." }, Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." }, - File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" }, + File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it." }, _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." }, Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" }, - No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" }, + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files." }, Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" }, + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file." }, Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, + Show_diagnostic_information: { code: 6149, category: ts.DiagnosticCategory.Message, key: "Show_diagnostic_information_6149", message: "Show diagnostic information." }, + Show_verbose_diagnostic_information: { code: 6150, category: ts.DiagnosticCategory.Message, key: "Show_verbose_diagnostic_information_6150", message: "Show verbose diagnostic information." }, + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: { code: 6151, category: ts.DiagnosticCategory.Message, key: "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", message: "Emit a single file with source maps instead of having a separate file." }, + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: { code: 6152, category: ts.DiagnosticCategory.Message, key: "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", message: "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set." }, + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: { code: 6153, category: ts.DiagnosticCategory.Message, key: "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", message: "Transpile each file as a separate module (similar to 'ts.transpileModule')." }, + Print_names_of_generated_files_part_of_the_compilation: { code: 6154, category: ts.DiagnosticCategory.Message, key: "Print_names_of_generated_files_part_of_the_compilation_6154", message: "Print names of generated files part of the compilation." }, + Print_names_of_files_part_of_the_compilation: { code: 6155, category: ts.DiagnosticCategory.Message, key: "Print_names_of_files_part_of_the_compilation_6155", message: "Print names of files part of the compilation." }, + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: { code: 6156, category: ts.DiagnosticCategory.Message, key: "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", message: "The locale used when displaying messages to the user (e.g. 'en-us')" }, + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: { code: 6157, category: ts.DiagnosticCategory.Message, key: "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", message: "Do not generate custom helper functions like '__extends' in compiled output." }, + Do_not_include_the_default_library_file_lib_d_ts: { code: 6158, category: ts.DiagnosticCategory.Message, key: "Do_not_include_the_default_library_file_lib_d_ts_6158", message: "Do not include the default library file (lib.d.ts)." }, + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: { code: 6159, category: ts.DiagnosticCategory.Message, key: "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", message: "Do not add triple-slash references or imported modules to the list of compiled files." }, + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: { code: 6160, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", message: "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files." }, + List_of_folders_to_include_type_definitions_from: { code: 6161, category: ts.DiagnosticCategory.Message, key: "List_of_folders_to_include_type_definitions_from_6161", message: "List of folders to include type definitions from." }, + Disable_size_limitations_on_JavaScript_projects: { code: 6162, category: ts.DiagnosticCategory.Message, key: "Disable_size_limitations_on_JavaScript_projects_6162", message: "Disable size limitations on JavaScript projects." }, + The_character_set_of_the_input_files: { code: 6163, category: ts.DiagnosticCategory.Message, key: "The_character_set_of_the_input_files_6163", message: "The character set of the input files." }, + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: { code: 6164, category: ts.DiagnosticCategory.Message, key: "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", message: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files." }, + Do_not_truncate_error_messages: { code: 6165, category: ts.DiagnosticCategory.Message, key: "Do_not_truncate_error_messages_6165", message: "Do not truncate error messages." }, + Output_directory_for_generated_declaration_files: { code: 6166, category: ts.DiagnosticCategory.Message, key: "Output_directory_for_generated_declaration_files_6166", message: "Output directory for generated declaration files." }, + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: { code: 6167, category: ts.DiagnosticCategory.Message, key: "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", message: "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'." }, + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: { code: 6168, category: ts.DiagnosticCategory.Message, key: "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", message: "List of root folders whose combined content represents the structure of the project at runtime." }, + Show_all_compiler_options: { code: 6169, category: ts.DiagnosticCategory.Message, key: "Show_all_compiler_options_6169", message: "Show all compiler options." }, + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: { code: 6170, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", message: "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file" }, + Command_line_Options: { code: 6171, category: ts.DiagnosticCategory.Message, key: "Command_line_Options_6171", message: "Command-line Options" }, + Basic_Options: { code: 6172, category: ts.DiagnosticCategory.Message, key: "Basic_Options_6172", message: "Basic Options" }, + Strict_Type_Checking_Options: { code: 6173, category: ts.DiagnosticCategory.Message, key: "Strict_Type_Checking_Options_6173", message: "Strict Type-Checking Options" }, + Module_Resolution_Options: { code: 6174, category: ts.DiagnosticCategory.Message, key: "Module_Resolution_Options_6174", message: "Module Resolution Options" }, + Source_Map_Options: { code: 6175, category: ts.DiagnosticCategory.Message, key: "Source_Map_Options_6175", message: "Source Map Options" }, + Additional_Checks: { code: 6176, category: ts.DiagnosticCategory.Message, key: "Additional_Checks_6176", message: "Additional Checks" }, + Experimental_Options: { code: 6177, category: ts.DiagnosticCategory.Message, key: "Experimental_Options_6177", message: "Experimental Options" }, + Advanced_Options: { code: 6178, category: ts.DiagnosticCategory.Message, key: "Advanced_Options_6178", message: "Advanced Options" }, + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: { code: 6179, category: ts.DiagnosticCategory.Message, key: "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", message: "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'." }, + Enable_all_strict_type_checking_options: { code: 6180, category: ts.DiagnosticCategory.Message, key: "Enable_all_strict_type_checking_options_6180", message: "Enable all strict type-checking options." }, + List_of_language_service_plugins: { code: 6181, category: ts.DiagnosticCategory.Message, key: "List_of_language_service_plugins_6181", message: "List of language service plugins." }, + Scoped_package_detected_looking_in_0: { code: 6182, category: ts.DiagnosticCategory.Message, key: "Scoped_package_detected_looking_in_0_6182", message: "Scoped package detected, looking in '{0}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -4601,7 +4714,7 @@ var ts; _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists." }, Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, @@ -4625,7 +4738,7 @@ var ts; parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -4633,28 +4746,40 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'." }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: '{0}'." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig." }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, - Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, - Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, - Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}." }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}." }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." }, + Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." }, + Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'." }, + Disable_checking_for_this_file: { code: 90018, category: ts.DiagnosticCategory.Message, key: "Disable_checking_for_this_file_90018", message: "Disable checking for this file." }, + Ignore_this_error_message: { code: 90019, category: ts.DiagnosticCategory.Message, key: "Ignore_this_error_message_90019", message: "Ignore this error message." }, + Initialize_property_0_in_the_constructor: { code: 90020, category: ts.DiagnosticCategory.Message, key: "Initialize_property_0_in_the_constructor_90020", message: "Initialize property '{0}' in the constructor." }, + Initialize_static_property_0: { code: 90021, category: ts.DiagnosticCategory.Message, key: "Initialize_static_property_0_90021", message: "Initialize static property '{0}'." }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, + Report_errors_in_js_files: { code: 8019, category: ts.DiagnosticCategory.Message, key: "Report_errors_in_js_files_8019", message: "Report errors in .js files." }, }; })(ts || (ts = {})); /// @@ -4666,7 +4791,7 @@ var ts; return token >= 70 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116 /* AbstractKeyword */, "any": 118 /* AnyKeyword */, "as": 117 /* AsKeyword */, @@ -4690,7 +4815,7 @@ var ts; "false": 85 /* FalseKeyword */, "finally": 86 /* FinallyKeyword */, "for": 87 /* ForKeyword */, - "from": 138 /* FromKeyword */, + "from": 139 /* FromKeyword */, "function": 88 /* FunctionKeyword */, "get": 124 /* GetKeyword */, "if": 89 /* IfKeyword */, @@ -4708,27 +4833,28 @@ var ts; "new": 93 /* NewKeyword */, "null": 94 /* NullKeyword */, "number": 132 /* NumberKeyword */, + "object": 133 /* ObjectKeyword */, "package": 110 /* PackageKeyword */, "private": 111 /* PrivateKeyword */, "protected": 112 /* ProtectedKeyword */, "public": 113 /* PublicKeyword */, "readonly": 130 /* ReadonlyKeyword */, "require": 131 /* RequireKeyword */, - "global": 139 /* GlobalKeyword */, + "global": 140 /* GlobalKeyword */, "return": 95 /* ReturnKeyword */, - "set": 133 /* SetKeyword */, + "set": 134 /* SetKeyword */, "static": 114 /* StaticKeyword */, - "string": 134 /* StringKeyword */, + "string": 135 /* StringKeyword */, "super": 96 /* SuperKeyword */, "switch": 97 /* SwitchKeyword */, - "symbol": 135 /* SymbolKeyword */, + "symbol": 136 /* SymbolKeyword */, "this": 98 /* ThisKeyword */, "throw": 99 /* ThrowKeyword */, "true": 100 /* TrueKeyword */, "try": 101 /* TryKeyword */, - "type": 136 /* TypeKeyword */, + "type": 137 /* TypeKeyword */, "typeof": 102 /* TypeOfKeyword */, - "undefined": 137 /* UndefinedKeyword */, + "undefined": 138 /* UndefinedKeyword */, "var": 103 /* VarKeyword */, "void": 104 /* VoidKeyword */, "while": 105 /* WhileKeyword */, @@ -4736,7 +4862,7 @@ var ts; "yield": 115 /* YieldKeyword */, "async": 119 /* AsyncKeyword */, "await": 120 /* AwaitKeyword */, - "of": 140 /* OfKeyword */, + "of": 141 /* OfKeyword */, "{": 16 /* OpenBraceToken */, "}": 17 /* CloseBraceToken */, "(": 18 /* OpenParenToken */, @@ -4876,9 +5002,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -4888,7 +5014,7 @@ var ts; ts.tokenToString = tokenToString; /* @internal */ function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; /* @internal */ @@ -4904,6 +5030,7 @@ var ts; if (text.charCodeAt(pos) === 10 /* lineFeed */) { pos++; } + // falls through case 10 /* lineFeed */: result.push(lineStart); lineStart = pos; @@ -4962,7 +5089,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -5049,6 +5175,7 @@ var ts; if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) { pos++; } + // falls through case 10 /* lineFeed */: pos++; if (stopAfterLineBreak) { @@ -5121,7 +5248,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -5203,6 +5330,7 @@ var ts; if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) { pos++; } + // falls through case 10 /* lineFeed */: pos++; if (trailing) { @@ -5298,15 +5426,15 @@ var ts; if (!comments) { comments = []; } - comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); return comments; } function getLeadingCommentRanges(text, pos) { - return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); + return reduceEachLeadingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined); } ts.getLeadingCommentRanges = getLeadingCommentRanges; function getTrailingCommentRanges(text, pos) { - return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); + return reduceEachTrailingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined); } ts.getTrailingCommentRanges = getTrailingCommentRanges; /** Optionally, get the shebang */ @@ -5333,7 +5461,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -5357,6 +5485,7 @@ var ts; var precedingLineBreak; var hasExtendedUnicodeEscape; var tokenIsUnterminated; + var numericLiteralFlags; setText(text, start, length); return { getStartPos: function () { return startPos; }, @@ -5370,6 +5499,7 @@ var ts; isIdentifier: function () { return token === 70 /* Identifier */ || token > 106 /* LastReservedWord */; }, isReservedWord: function () { return token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */; }, isUnterminated: function () { return tokenIsUnterminated; }, + getNumericLiteralFlags: function () { return numericLiteralFlags; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -5406,6 +5536,7 @@ var ts; var end = pos; if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { pos++; + numericLiteralFlags = 2 /* Scientific */; if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) pos++; if (isDigit(text.charCodeAt(pos))) { @@ -5604,7 +5735,7 @@ var ts; if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) { pos++; } - // fall through + // falls through case 10 /* lineFeed */: case 8232 /* lineSeparator */: case 8233 /* paragraphSeparator */: @@ -5705,8 +5836,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 /* a */ && ch <= 122 /* z */) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70 /* Identifier */; @@ -5738,6 +5872,7 @@ var ts; hasExtendedUnicodeEscape = false; precedingLineBreak = false; tokenIsUnterminated = false; + numericLiteralFlags = 0; while (true) { tokenPos = pos; if (pos >= end) { @@ -5923,6 +6058,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 8 /* HexSpecifier */; return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { @@ -5933,6 +6069,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 16 /* BinarySpecifier */; return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { @@ -5943,16 +6080,19 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 32 /* OctalSpecifier */; return token = 8 /* NumericLiteral */; } // Try to parse as an octal if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); + numericLiteralFlags = 4 /* Octal */; return token = 8 /* NumericLiteral */; } // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being // permissive and allowing decimal digits of the form 08* and 09* (which many browsers also do). + // falls through case 49 /* _1 */: case 50 /* _2 */: case 51 /* _3 */: @@ -6206,7 +6346,14 @@ var ts; while (pos < end) { pos++; char = text.charCodeAt(pos); - if ((char === 123 /* openBrace */) || (char === 60 /* lessThan */)) { + if (char === 123 /* openBrace */) { + break; + } + if (char === 60 /* lessThan */) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7 /* ConflictMarkerTrivia */; + } break; } } @@ -6399,6 +6546,19 @@ var ts; return undefined; } ts.getDeclarationOfKind = getDeclarationOfKind; + function findDeclaration(symbol, predicate) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + if (predicate(declaration)) { + return declaration; + } + } + } + return undefined; + } + ts.findDeclaration = findDeclaration; // Pool writers to avoid needing to allocate them for every symbol we write. var stringWriters = []; function getSingleLineStringWriter() { @@ -6413,6 +6573,7 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. @@ -6421,7 +6582,8 @@ var ts; decreaseIndent: ts.noop, clear: function () { return str_1 = ""; }, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; } return stringWriters.pop(); @@ -6437,25 +6599,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; /* @internal */ @@ -6477,7 +6639,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -6491,28 +6653,28 @@ var ts; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 131072 /* ThisNodeOrAnySubNodesHasError */) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608 /* HasAggregatedChildData */)) { + if (!(node.flags & 262144 /* HasAggregatedChildData */)) { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576 /* ThisNodeHasError */) !== 0) || + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 131072 /* ThisNodeOrAnySubNodesHasError */; } // Also mark that we've propagated the child information to this node. This way we can // always consult the bit directly on this node without needing to check its children // again. - node.flags |= 8388608 /* HasAggregatedChildData */; + node.flags |= 262144 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261 /* SourceFile */) { + while (node && node.kind !== 264 /* SourceFile */) { node = node.parent; } return node; @@ -6520,11 +6682,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return true; } return false; @@ -6599,6 +6761,10 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; + function isToken(n) { + return n.kind >= 0 /* FirstToken */ && n.kind <= 141 /* LastToken */; + } + ts.isToken = isToken; function getTokenPosOfNode(node, sourceFile, includeJsDoc) { // With nodes that have no width (i.e. 'Missing' nodes), we actually *don't* // want to skip trivia because this will launch us forward to the next token. @@ -6615,18 +6781,18 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 293 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; + return node.kind >= 266 /* FirstJSDocNode */ && node.kind <= 292 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */; + return node.kind >= 282 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6657,20 +6823,11 @@ var ts; return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; - function getLiteralText(node, sourceFile, languageVersion) { - // Any template literal or string literal with an extended escape - // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. - if (languageVersion < 2 /* ES2015 */ && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); - } + function getLiteralText(node, sourceFile) { // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. if (!nodeIsSynthesized(node) && node.parent) { - var text = getSourceTextOfNodeFromSourceFile(sourceFile, node); - if (languageVersion < 2 /* ES2015 */ && isBinaryOrOctalIntegerLiteral(node, text)) { - return node.text; - } - return text; + return getSourceTextOfNodeFromSourceFile(sourceFile, node); } // If we can't reach the original source text, use the canonical form if it's a number, // or an escaped quoted form of the original text if it's string-like. @@ -6691,19 +6848,6 @@ var ts; ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); } ts.getLiteralText = getLiteralText; - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98 /* b */: - case 66 /* B */: - case 111 /* o */: - case 79 /* O */: - return true; - } - } - return false; - } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -6712,11 +6856,6 @@ var ts; return identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? "_" + identifier : identifier; } ts.escapeIdentifier = escapeIdentifier; - // Remove extra underscore from escaped identifier - function unescapeIdentifier(identifier) { - return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; - } - ts.unescapeIdentifier = unescapeIdentifier; // Make an identifier from an external module name by extracting the string after the last "/" and replacing // all non-alphanumeric characters with underscores function makeIdentifierFromModuleName(moduleName) { @@ -6730,26 +6869,26 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 /* VariableDeclaration */ && node.parent.kind === 256 /* CatchClause */; + return node.kind === 225 /* VariableDeclaration */ && node.parent.kind === 259 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 /* ModuleDeclaration */ && + return node && node.kind === 232 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; - /** Given a symbol for a module, checks that it is either an untyped import or a shorthand ambient module. */ + /** Given a symbol for a module, checks that it is a shorthand ambient module. */ function isShorthandAmbientModuleSymbol(moduleSymbol) { return isShorthandAmbientModule(moduleSymbol.valueDeclaration); } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node.kind === 230 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 232 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 /* SourceFile */ || - node.kind === 230 /* ModuleDeclaration */ || + return node.kind === 264 /* SourceFile */ || + node.kind === 232 /* ModuleDeclaration */ || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6765,32 +6904,36 @@ var ts; return false; } switch (node.parent.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: return ts.isExternalModule(node.parent); - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 256 /* CatchClause */: - case 230 /* ModuleDeclaration */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 264 /* SourceFile */: + case 234 /* CaseBlock */: + case 259 /* CatchClause */: + case 232 /* ModuleDeclaration */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return true; - case 204 /* Block */: + case 206 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !isFunctionLike(parentNode); @@ -6817,6 +6960,10 @@ var ts; return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); } ts.declarationNameToString = declarationNameToString; + function getNameFromIndexInfo(info) { + return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined; + } + ts.getNameFromIndexInfo = getNameFromIndexInfo; function getTextOfPropertyName(name) { switch (name.kind) { case 70 /* Identifier */: @@ -6824,7 +6971,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -6835,10 +6982,10 @@ var ts; function entityNameToString(name) { switch (name.kind) { case 70 /* Identifier */: - return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141 /* QualifiedName */: + return getFullWidth(name) === 0 ? ts.unescapeIdentifier(name.text) : getTextOfNode(name); + case 142 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -6875,7 +7022,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204 /* Block */) { + if (node.body && node.body.kind === 206 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -6889,7 +7036,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -6898,23 +7045,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 228 /* TypeAliasDeclaration */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 263 /* EnumMember */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 230 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -6937,7 +7084,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 /* EnumDeclaration */ && isConst(node); + return node.kind === 231 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -6950,11 +7097,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; + return n.kind === 180 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 /* ExpressionStatement */ + return node.kind === 209 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -6967,10 +7114,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 /* Parameter */ || - node.kind === 143 /* TypeParameter */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 185 /* ArrowFunction */) ? + var commentRanges = (node.kind === 145 /* Parameter */ || + node.kind === 144 /* TypeParameter */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 186 /* ArrowFunction */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); // True if the comment starts with '/**' but not if it is '/**/' @@ -6985,79 +7132,80 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 /* FirstTypeNode */ <= node.kind && node.kind <= 171 /* LastTypeNode */) { + if (157 /* FirstTypeNode */ <= node.kind && node.kind <= 172 /* LastTypeNode */) { return true; } switch (node.kind) { case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: return true; case 104 /* VoidKeyword */: - return node.parent.kind !== 188 /* VoidExpression */; - case 199 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 189 /* VoidExpression */; + case 200 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 70 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141 /* QualifiedName */: - case 177 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + // falls through + case 142 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: case 98 /* ThisKeyword */: - var parent_1 = node.parent; - if (parent_1.kind === 160 /* TypeQuery */) { + var parent = node.parent; + if (parent.kind === 161 /* TypeQuery */) { return false; } // Do not recursively call isPartOfTypeNode on the parent. In the example: // // let a: A.B.C; // - // Calling isPartOfTypeNode would consider the qualified name A.B a type node. Only C or - // A.B.C is a type node. - if (156 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 171 /* LastTypeNode */) { + // Calling isPartOfTypeNode would consider the qualified name A.B a type node. + // Only C and A.B.C are type nodes. + if (157 /* FirstTypeNode */ <= parent.kind && parent.kind <= 172 /* LastTypeNode */) { return true; } - switch (parent_1.kind) { - case 199 /* ExpressionWithTypeArguments */: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143 /* TypeParameter */: - return node === parent_1.constraint; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 144 /* Parameter */: - case 223 /* VariableDeclaration */: - return node === parent_1.type; - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return node === parent_1.type; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - return node === parent_1.type; - case 182 /* TypeAssertionExpression */: - return node === parent_1.type; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 181 /* TaggedTemplateExpression */: + switch (parent.kind) { + case 200 /* ExpressionWithTypeArguments */: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); + case 144 /* TypeParameter */: + return node === parent.constraint; + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + return node === parent.type; + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return node === parent.type; + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + return node === parent.type; + case 183 /* TypeAssertionExpression */: + return node === parent.type; + case 180 /* CallExpression */: + case 181 /* NewExpression */: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -7065,29 +7213,43 @@ var ts; return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 191 /* PrefixUnaryExpression */; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitor(node); - case 232 /* CaseBlock */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 254 /* DefaultClause */: - case 219 /* LabeledStatement */: - case 221 /* TryStatement */: - case 256 /* CatchClause */: + case 234 /* CaseBlock */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 256 /* CaseClause */: + case 257 /* DefaultClause */: + case 221 /* LabeledStatement */: + case 223 /* TryStatement */: + case 259 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -7097,29 +7259,30 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + return; + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. return; default: if (isFunctionLike(node)) { - var name_5 = node.name; - if (name_5 && name_5.kind === 142 /* ComputedPropertyName */) { + var name = node.name; + if (name && name.kind === 143 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. - traverse(name_5.expression); + traverse(name.expression); return; } } @@ -7132,17 +7295,35 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + function getRestParameterElementType(node) { + if (node && node.kind === 163 /* ArrayType */) { + return node.elementType; + } + else if (node && node.kind === 158 /* TypeReference */) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174 /* BindingElement */: - case 260 /* EnumMember */: - case 144 /* Parameter */: - case 257 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* ShorthandPropertyAssignment */: - case 223 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 263 /* EnumMember */: + case 145 /* Parameter */: + case 260 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 261 /* ShorthandPropertyAssignment */: + case 225 /* VariableDeclaration */: return true; } } @@ -7150,11 +7331,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */); + return node && (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); + return node && (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7163,19 +7344,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return true; } return false; @@ -7183,13 +7364,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return true; } return false; @@ -7197,30 +7378,42 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return true; - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 221 /* LabeledStatement */) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 206 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 /* MethodDeclaration */ && node.parent.kind === 176 /* ObjectLiteralExpression */; + return node && node.kind === 150 /* MethodDeclaration */ && node.parent.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 /* MethodDeclaration */ && - (node.parent.kind === 176 /* ObjectLiteralExpression */ || - node.parent.kind === 197 /* ClassExpression */); + return node.kind === 150 /* MethodDeclaration */ && + (node.parent.kind === 177 /* ObjectLiteralExpression */ || + node.parent.kind === 198 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7256,7 +7449,7 @@ var ts; return undefined; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -7271,9 +7464,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -7284,39 +7477,52 @@ var ts; node = node.parent; } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - // Fall through - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 230 /* ModuleDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 229 /* EnumDeclaration */: - case 261 /* SourceFile */: + // falls through + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 232 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 231 /* EnumDeclaration */: + case 264 /* SourceFile */: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, /*includeArrowFunctions*/ false); + if (container) { + switch (container.kind) { + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; /** - * Given an super call/property node, returns the closest node where - * - a super call/property access is legal in the node and not legal in the parent node the node. - * i.e. super call is legal in constructor but not legal in the class body. - * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher) - * - a super call/property is definitely illegal in the container (but might be legal in some subnode) - * i.e. super property access is illegal in function declaration but can be legal in the statement list - */ + * Given an super call/property node, returns the closest node where + * - a super call/property access is legal in the node and not legal in the parent node the node. + * i.e. super call is legal in constructor but not legal in the class body. + * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher) + * - a super call/property is definitely illegal in the container (but might be legal in some subnode) + * i.e. super property access is illegal in function declaration but can be legal in the statement list + */ function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; @@ -7324,26 +7530,27 @@ var ts; return node; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: node = node.parent; break; - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + // falls through + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return node; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -7359,15 +7566,15 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */) { + if (func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183 /* ParenthesizedExpression */) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent = func.parent; + while (parent.kind === 184 /* ParenthesizedExpression */) { + prev = parent; + parent = parent.parent; } - if (parent_2.kind === 179 /* CallExpression */ && parent_2.expression === prev) { - return parent_2; + if (parent.kind === 180 /* CallExpression */ && parent.expression === prev) { + return parent; } } } @@ -7377,21 +7584,21 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 /* PropertyAccessExpression */ || kind === 178 /* ElementAccessExpression */) + return (kind === 178 /* PropertyAccessExpression */ || kind === 179 /* ElementAccessExpression */) && node.expression.kind === 96 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 276 /* JSDocTypeReference */: return node.typeName; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return node; } return undefined; @@ -7399,10 +7606,12 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 145 /* Decorator */: + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 146 /* Decorator */: return true; default: return false; @@ -7410,34 +7619,37 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { return node.tag; } + else if (isJsxOpeningLikeElement(node)) { + return node.tagName; + } // Will either be a CallExpression, NewExpression, or Decorator. return node.expression; } ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // classes are valid targets return true; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 226 /* ClassDeclaration */; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + return node.parent.kind === 228 /* ClassDeclaration */; + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && node.parent.kind === 226 /* ClassDeclaration */; - case 144 /* Parameter */: + && node.parent.kind === 228 /* ClassDeclaration */; + case 145 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return node.parent.body !== undefined - && (node.parent.kind === 150 /* Constructor */ - || node.parent.kind === 149 /* MethodDeclaration */ - || node.parent.kind === 152 /* SetAccessor */) - && node.parent.parent.kind === 226 /* ClassDeclaration */; + && (node.parent.kind === 151 /* Constructor */ + || node.parent.kind === 150 /* MethodDeclaration */ + || node.parent.kind === 153 /* SetAccessor */) + && node.parent.parent.kind === 228 /* ClassDeclaration */; } return false; } @@ -7453,19 +7665,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149 /* MethodDeclaration */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 153 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 /* JsxOpeningElement */ || - parent.kind === 247 /* JsxSelfClosingElement */ || - parent.kind === 249 /* JsxClosingElement */) { + if (parent.kind === 250 /* JsxOpeningElement */ || + parent.kind === 249 /* JsxSelfClosingElement */ || + parent.kind === 251 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -7479,96 +7691,97 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 11 /* RegularExpressionLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 200 /* AsExpression */: - case 182 /* TypeAssertionExpression */: - case 201 /* NonNullExpression */: - case 183 /* ParenthesizedExpression */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 196 /* SpreadElement */: - case 194 /* TemplateExpression */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 201 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 202 /* NonNullExpression */: + case 184 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 197 /* SpreadElement */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: - case 198 /* OmittedExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: - case 195 /* YieldExpression */: - case 189 /* AwaitExpression */: + case 199 /* OmittedExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 196 /* YieldExpression */: + case 190 /* AwaitExpression */: + case 203 /* MetaProperty */: return true; - case 141 /* QualifiedName */: - while (node.parent.kind === 141 /* QualifiedName */) { + case 142 /* QualifiedName */: + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node); + return node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node); case 70 /* Identifier */: - if (node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node)) { + if (node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node)) { return true; } - // fall through + // falls through case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 98 /* ThisKeyword */: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 223 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: - case 174 /* BindingElement */: - return parent_3.initializer === node; - case 207 /* ExpressionStatement */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 216 /* ReturnStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 220 /* ThrowStatement */: - case 218 /* SwitchStatement */: - return parent_3.expression === node; - case 211 /* ForStatement */: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + var parent = node.parent; + switch (parent.kind) { + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 263 /* EnumMember */: + case 260 /* PropertyAssignment */: + case 175 /* BindingElement */: + return parent.initializer === node; + case 209 /* ExpressionStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 218 /* ReturnStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 256 /* CaseClause */: + case 222 /* ThrowStatement */: + case 220 /* SwitchStatement */: + return parent.expression === node; + case 213 /* ForStatement */: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forInStatement.expression === node; - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - return node === parent_3.expression; - case 202 /* TemplateSpan */: - return node === parent_3.expression; - case 142 /* ComputedPropertyName */: - return node === parent_3.expression; - case 145 /* Decorator */: - case 252 /* JsxExpression */: - case 251 /* JsxSpreadAttribute */: - case 259 /* SpreadAssignment */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + return node === parent.expression; + case 204 /* TemplateSpan */: + return node === parent.expression; + case 143 /* ComputedPropertyName */: + return node === parent.expression; + case 146 /* Decorator */: + case 255 /* JsxExpression */: + case 254 /* JsxSpreadAttribute */: + case 262 /* SpreadAssignment */: return true; - case 199 /* ExpressionWithTypeArguments */: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + case 200 /* ExpressionWithTypeArguments */: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent)) { return true; } } @@ -7583,7 +7796,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7592,7 +7805,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 245 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 247 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7600,21 +7813,27 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152 /* JavaScriptFile */); + return node && !!(node.flags & 65536 /* JavaScriptFile */); } ts.isInJavaScriptFile = isInJavaScriptFile; /** * Returns true if the node is a CallExpression to the identifier 'require' with - * exactly one argument. + * exactly one argument (of the form 'require("name")'). * This function does not test if the node is in a JavaScript file or not. - */ - function isRequireCall(expression, checkArgumentIsStringLiteral) { - // of the form 'require("name")' - var isRequire = expression.kind === 179 /* CallExpression */ && - expression.expression.kind === 70 /* Identifier */ && - expression.expression.text === "require" && - expression.arguments.length === 1; - return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9 /* StringLiteral */); + */ + function isRequireCall(callExpression, checkArgumentIsStringLiteral) { + if (callExpression.kind !== 180 /* CallExpression */) { + return false; + } + var _a = callExpression, expression = _a.expression, args = _a.arguments; + if (expression.kind !== 70 /* Identifier */ || expression.text !== "require") { + return false; + } + if (args.length !== 1) { + return false; + } + var arg = args[0]; + return !checkArgumentIsStringLiteral || arg.kind === 9 /* StringLiteral */ || arg.kind === 12 /* NoSubstitutionTemplateLiteral */; } ts.isRequireCall = isRequireCall; function isSingleOrDoubleQuote(charCode) { @@ -7625,25 +7844,37 @@ var ts; * Returns true if the node is a variable declaration whose initializer is a function expression. * This function does not test if the node is in a JavaScript file or not. */ - function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223 /* VariableDeclaration */) { + function isDeclarationOfFunctionOrClassExpression(s) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225 /* VariableDeclaration */) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */; + return declaration.initializer && (declaration.initializer.kind === 185 /* FunctionExpression */ || declaration.initializer.kind === 198 /* ClassExpression */); } return false; } - ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression; + ts.isDeclarationOfFunctionOrClassExpression = isDeclarationOfFunctionOrClassExpression; + function getRightMostAssignedExpression(node) { + while (isAssignmentExpression(node, /*excludeCompoundAssignements*/ true)) { + node = node.right; + } + return node; + } + ts.getRightMostAssignedExpression = getRightMostAssignedExpression; + function isExportsIdentifier(node) { + return isIdentifier(node) && node.text === "exports"; + } + ts.isExportsIdentifier = isExportsIdentifier; + function isModuleExportsPropertyAccessExpression(node) { + return isPropertyAccessExpression(node) && isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports"; + } + ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression; /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property /// assignments we treat as special in the binder function getSpecialPropertyAssignmentKind(expression) { if (!isInJavaScriptFile(expression)) { return 0 /* None */; } - if (expression.kind !== 192 /* BinaryExpression */) { - return 0 /* None */; - } var expr = expression; - if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 177 /* PropertyAccessExpression */) { + if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 178 /* PropertyAccessExpression */) { return 0 /* None */; } var lhs = expr.left; @@ -7657,11 +7888,15 @@ var ts; // module.exports = expr return 2 /* ModuleExports */; } + else { + // F.x = expr + return 5 /* Property */; + } } else if (lhs.expression.kind === 98 /* ThisKeyword */) { return 4 /* ThisProperty */; } - else if (lhs.expression.kind === 177 /* PropertyAccessExpression */) { + else if (lhs.expression.kind === 178 /* PropertyAccessExpression */) { // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70 /* Identifier */) { @@ -7679,35 +7914,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 245 /* ExternalModuleReference */) { + if (reference.kind === 247 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 241 /* ExportDeclaration */) { + if (node.kind === 243 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 230 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 232 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239 /* NamespaceImport */) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 /* ImportDeclaration */ + return node.kind === 237 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } @@ -7715,13 +7950,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144 /* Parameter */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 258 /* ShorthandPropertyAssignment */: - case 257 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 261 /* ShorthandPropertyAssignment */: + case 260 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -7729,28 +7964,36 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 /* JSDocFunctionType */ && + return node.kind === 278 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 276 /* JSDocConstructorType */; + node.parameters[0].type.kind === 280 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function hasJSDocParameterTags(node) { + var parameterTags = getJSDocTags(node, 285 /* JSDocParameterTag */); + return parameterTags && parameterTags.length > 0; + } + ts.hasJSDocParameterTags = hasJSDocParameterTags; function getJSDocTags(node, kind) { var docs = getJSDocs(node); if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281 /* JSDocParameterTag */) { + if (doc.kind === 285 /* JSDocParameterTag */) { if (doc.kind === kind) { result.push(doc); } } else { - result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); + var tags = doc.tags; + if (tags) { + result.push.apply(result, ts.filter(tags, function (tag) { return tag.kind === kind; })); + } } } return result; @@ -7776,9 +8019,9 @@ var ts; // var x = function(name) { return name.length; } var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205 /* VariableStatement */; + parent.parent.parent.kind === 207 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205 /* VariableStatement */; + parent.parent.kind === 207 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -7787,20 +8030,20 @@ var ts; } // Also recognize when the node is the RHS of an assignment expression var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 /* BinaryExpression */ && + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && - parent.parent.kind === 207 /* ExpressionStatement */; + parent.parent.kind === 209 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ && - parent && parent.kind === 230 /* ModuleDeclaration */; - var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */; + var isModuleDeclaration = node.kind === 232 /* ModuleDeclaration */ && + parent && parent.kind === 232 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 260 /* PropertyAssignment */; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } // Pull parameter comments from declaring function as well - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -7809,23 +8052,24 @@ var ts; cache = ts.concatenate(cache, node.jsDoc); } } + ts.getJSDocs = getJSDocs; function getJSDocParameterTags(param) { if (!isParameter(param)) { return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281 /* JSDocParameterTag */); + var tags = getJSDocTags(func, 285 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 285 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { - var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 285 /* JSDocParameterTag */ && tag.parameterName.text === name_1; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7835,8 +8079,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */); - if (!tag && node.kind === 144 /* Parameter */) { + var tag = getFirstJSDocTag(node, 287 /* JSDocTypeTag */); + if (!tag && node.kind === 145 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -7846,15 +8090,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 284 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 286 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 288 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -7866,9 +8110,9 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 275 /* JSDocVariadicType */ || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) { + if (node && (node.flags & 65536 /* JavaScriptFile */)) { + if (node.type && node.type.kind === 279 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 279 /* JSDocVariadicType */; })) { return true; } } @@ -7889,29 +8133,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 183 /* ParenthesizedExpression */: - case 175 /* ArrayLiteralExpression */: - case 196 /* SpreadElement */: + case 184 /* ParenthesizedExpression */: + case 176 /* ArrayLiteralExpression */: + case 197 /* SpreadElement */: node = parent; break; - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } - // Fall through - case 257 /* PropertyAssignment */: + node = parent.parent; + break; + case 260 /* PropertyAssignment */: + if (parent.name === node) { + return 0 /* None */; + } node = parent.parent; break; default: @@ -7923,11 +8171,24 @@ var ts; ts.getAssignmentTargetKind = getAssignmentTargetKind; // A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is - // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. + // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ a }] = xxx'. + // (Note that `p` is not a target in the above examples, only `a`.) function isAssignmentTarget(node) { return getAssignmentTargetKind(node) !== 0 /* None */; } ts.isAssignmentTarget = isAssignmentTarget; + // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped + function isDeleteTarget(node) { + if (node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { + return false; + } + node = node.parent; + while (node && node.kind === 184 /* ParenthesizedExpression */) { + node = node.parent; + } + return node && node.kind === 187 /* DeleteExpression */; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -7939,7 +8200,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 261 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 264 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -7953,7 +8214,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 /* ImportSpecifier */ || parent.kind === 243 /* ExportSpecifier */) { + if (parent.kind === 241 /* ImportSpecifier */ || parent.kind === 245 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -7966,7 +8227,7 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - node.parent.kind === 142 /* ComputedPropertyName */ && + node.parent.kind === 143 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -7974,31 +8235,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: - case 177 /* PropertyAccessExpression */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 263 /* EnumMember */: + case 260 /* PropertyAssignment */: + case 178 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 141 /* QualifiedName */) { + while (parent.kind === 142 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 160 /* TypeQuery */; + return parent.kind === 161 /* TypeQuery */; } return false; - case 174 /* BindingElement */: - case 239 /* ImportSpecifier */: + case 175 /* BindingElement */: + case 241 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 243 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -8014,13 +8275,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 233 /* NamespaceExportDeclaration */ || - node.kind === 236 /* ImportClause */ && !!node.name || - node.kind === 237 /* NamespaceImport */ || - node.kind === 239 /* ImportSpecifier */ || - node.kind === 243 /* ExportSpecifier */ || - node.kind === 240 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 235 /* NamespaceExportDeclaration */ || + node.kind === 238 /* ImportClause */ && !!node.name || + node.kind === 239 /* NamespaceImport */ || + node.kind === 241 /* ImportSpecifier */ || + node.kind === 245 /* ExportSpecifier */ || + node.kind === 242 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8106,17 +8367,62 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 /* FirstKeyword */ <= token && token <= 140 /* LastKeyword */; + return 71 /* FirstKeyword */ <= token && token <= 141 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */; } ts.isTrivia = isTrivia; - function isAsyncFunctionLike(node) { - return isFunctionLike(node) && hasModifier(node, 256 /* Async */) && !isAccessor(node); + var FunctionFlags; + (function (FunctionFlags) { + FunctionFlags[FunctionFlags["Normal"] = 0] = "Normal"; + FunctionFlags[FunctionFlags["Generator"] = 1] = "Generator"; + FunctionFlags[FunctionFlags["Async"] = 2] = "Async"; + FunctionFlags[FunctionFlags["AsyncOrAsyncGenerator"] = 3] = "AsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["Invalid"] = 4] = "Invalid"; + FunctionFlags[FunctionFlags["InvalidAsyncOrAsyncGenerator"] = 7] = "InvalidAsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["InvalidGenerator"] = 5] = "InvalidGenerator"; + })(FunctionFlags = ts.FunctionFlags || (ts.FunctionFlags = {})); + function getFunctionFlags(node) { + var flags = 0 /* Normal */; + switch (node.kind) { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + if (node.asteriskToken) { + flags |= 1 /* Generator */; + } + // falls through + case 186 /* ArrowFunction */: + if (hasModifier(node, 256 /* Async */)) { + flags |= 2 /* Async */; + } + break; + } + if (!node.body) { + flags |= 4 /* Invalid */; + } + return flags; + } + ts.getFunctionFlags = getFunctionFlags; + function isAsyncFunction(node) { + switch (node.kind) { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + return node.body !== undefined + && node.asteriskToken === undefined + && hasModifier(node, 256 /* Async */); + } + return false; + } + ts.isAsyncFunction = isAsyncFunction; + function isNumericLiteral(node) { + return node.kind === 8 /* NumericLiteral */; } - ts.isAsyncFunctionLike = isAsyncFunctionLike; + ts.isNumericLiteral = isNumericLiteral; function isStringOrNumericLiteral(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ @@ -8135,7 +8441,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 /* ComputedPropertyName */ && + return name.kind === 143 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -8150,10 +8456,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 144 /* Parameter */) { + if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 145 /* Parameter */) { return name.text; } - if (name.kind === 142 /* ComputedPropertyName */) { + if (name.kind === 143 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -8201,11 +8507,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144 /* Parameter */; + return root.kind === 145 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174 /* BindingElement */) { + while (node.kind === 175 /* BindingElement */) { node = node.parent.parent; } return node; @@ -8213,15 +8519,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 184 /* FunctionExpression */ - || kind === 225 /* FunctionDeclaration */ - || kind === 185 /* ArrowFunction */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 230 /* ModuleDeclaration */ - || kind === 261 /* SourceFile */; + return kind === 151 /* Constructor */ + || kind === 185 /* FunctionExpression */ + || kind === 227 /* FunctionDeclaration */ + || kind === 186 /* ArrowFunction */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 232 /* ModuleDeclaration */ + || kind === 264 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8229,49 +8535,22 @@ var ts; || ts.positionIsSynthesized(node.end); } ts.nodeIsSynthesized = nodeIsSynthesized; - function getOriginalNode(node, nodeTest) { - if (node) { - while (node.original !== undefined) { - node = node.original; - } + function getOriginalSourceFileOrBundle(sourceFileOrBundle) { + if (sourceFileOrBundle.kind === 265 /* Bundle */) { + return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, getOriginalSourceFile)); } - return !nodeTest || nodeTest(node) ? node : undefined; + return getOriginalSourceFile(sourceFileOrBundle); } - ts.getOriginalNode = getOriginalNode; - /** - * Gets a value indicating whether a node originated in the parse tree. - * - * @param node The node to test. - */ - function isParseTreeNode(node) { - return (node.flags & 8 /* Synthesized */) === 0; + ts.getOriginalSourceFileOrBundle = getOriginalSourceFileOrBundle; + function getOriginalSourceFile(sourceFile) { + return ts.getParseTreeNode(sourceFile, isSourceFile) || sourceFile; } - ts.isParseTreeNode = isParseTreeNode; - function getParseTreeNode(node, nodeTest) { - if (isParseTreeNode(node)) { - return node; - } - node = getOriginalNode(node); - if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { - return node; - } - return undefined; - } - ts.getParseTreeNode = getParseTreeNode; function getOriginalSourceFiles(sourceFiles) { - var originalSourceFiles = []; - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; - var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile); - if (originalSourceFile) { - originalSourceFiles.push(originalSourceFile); - } - } - return originalSourceFiles; + return ts.sameMap(sourceFiles, getOriginalSourceFile); } ts.getOriginalSourceFiles = getOriginalSourceFiles; function getOriginalNodeId(node) { - node = getOriginalNode(node); + node = ts.getOriginalNode(node); return node ? ts.getNodeId(node) : 0; } ts.getOriginalNodeId = getOriginalNodeId; @@ -8282,23 +8561,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: - case 193 /* ConditionalExpression */: - case 195 /* YieldExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: + case 194 /* ConditionalExpression */: + case 196 /* YieldExpression */: return 1 /* Right */; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operator) { case 39 /* AsteriskAsteriskToken */: case 57 /* EqualsToken */: @@ -8322,15 +8601,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192 /* BinaryExpression */) { + if (expression.kind === 193 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 190 /* PrefixUnaryExpression */ || expression.kind === 191 /* PostfixUnaryExpression */) { + else if (expression.kind === 191 /* PrefixUnaryExpression */ || expression.kind === 192 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -8348,37 +8627,36 @@ var ts; case 85 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: case 11 /* RegularExpressionLiteral */: case 12 /* NoSubstitutionTemplateLiteral */: - case 194 /* TemplateExpression */: - case 183 /* ParenthesizedExpression */: - case 198 /* OmittedExpression */: - case 297 /* RawExpression */: + case 195 /* TemplateExpression */: + case 184 /* ParenthesizedExpression */: + case 199 /* OmittedExpression */: return 19; - case 181 /* TaggedTemplateExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 182 /* TaggedTemplateExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: return 18; - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 18 : 17; - case 179 /* CallExpression */: + case 180 /* CallExpression */: return 17; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return 16; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: return 15; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operatorKind) { case 50 /* ExclamationToken */: case 51 /* TildeToken */: @@ -8436,11 +8714,11 @@ var ts; default: return -1; } - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return 4; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return 2; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return 1; default: return -1; @@ -8463,21 +8741,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -8494,16 +8766,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -8512,9 +8784,9 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; @@ -8524,7 +8796,7 @@ var ts; // the map below must be updated. Note that this regexp *does not* include the 'delete' character. // There is no reason for this other than that JSON.stringify does not handle it either. var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -8544,13 +8816,12 @@ var ts; * Note that this doesn't actually wrap the input in double quotes. */ function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -8707,168 +8978,77 @@ var ts; */ function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - /** Don't call this for `--outFile`, just for `--outDir` or plain emit. */ - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - /** - * Whether a file should be emitted in a non-`--outFile` case. - * Don't emit if source file is a declaration file, or was located under node_modules - */ - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); - } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); + /** Don't call this for `--outFile`, just for `--outDir` or plain emit. `--outFile` needs additional checks. */ + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; /** - * Iterates over each source file to emit. The source files are expected to have been - * transformed for use by the pretty printer. - * - * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support - * transformations. + * Iterates over the source files that are expected to have an emit output. * * @param host An EmitHost. - * @param sourceFiles The transformed source files to emit. * @param action The action to execute. + * @param sourceFilesOrTargetSourceFile + * If an array, the full list of source files to emit. + * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. */ - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); - // Emit on each source file if (options.outFile || options.out) { - onBundledEmit(sourceFiles); - } - else { - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; - // Don't emit if source file is a declaration file, or was located under node_modules - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], /*isBundledEmit*/ false); - } - function onBundledEmit(sourceFiles) { if (sourceFiles.length) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, /*isBundledEmit*/ true); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : ""; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, ts.createBundle(sourceFiles), emitOnlyDtsFiles); + } + } + else { + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFile, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - /** - * Iterates over the source files that are expected to have an emit output. This function - * is used by the legacy emitter and the declaration emitter and should not be used by - * the tree transforming emitter. - * - * @param host An EmitHost. - * @param action The action to execute. - * @param targetSourceFile An optional target source file to emit. - */ - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - // Emit on each source file - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. + // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. + // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1 /* Preserve */) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - // Can emit only sources that are not declaration file and are either non module code or module with - // --module or --target es6 specified. Files included by searching under node_modules are also not emitted. - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, /*isBundledEmit*/ true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1 /* JSX */) { + // TypeScript source file preserving JSX syntax + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -8893,7 +9073,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -8935,10 +9115,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 152 /* SetAccessor */) { + else if (accessor.kind === 153 /* SetAccessor */) { setAccessor = accessor; } else { @@ -8947,7 +9127,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 /* GetAccessor */ || member.kind === 152 /* SetAccessor */) + if ((member.kind === 152 /* GetAccessor */ || member.kind === 153 /* SetAccessor */) && hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -8958,10 +9138,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 /* GetAccessor */ && !getAccessor) { + if (member.kind === 152 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 152 /* SetAccessor */ && !setAccessor) { + if (member.kind === 153 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -9224,7 +9404,7 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ && + if (node.kind === 200 /* ExpressionWithTypeArguments */ && node.parent.token === 84 /* ExtendsKeyword */ && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9242,8 +9422,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 176 /* ObjectLiteralExpression */ - || kind === 175 /* ArrayLiteralExpression */; + return kind === 177 /* ObjectLiteralExpression */ + || kind === 176 /* ArrayLiteralExpression */; } return false; } @@ -9269,31 +9449,42 @@ var ts; return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; + function isExpressionWithTypeArgumentsInClassImplementsClause(node) { + return node.kind === 200 /* ExpressionWithTypeArguments */ + && isEntityNameExpression(node.expression) + && node.parent + && node.parent.token === 107 /* ImplementsKeyword */ + && node.parent.parent + && isClassLike(node.parent.parent); + } + ts.isExpressionWithTypeArgumentsInClassImplementsClause = isExpressionWithTypeArgumentsInClassImplementsClause; function isEntityNameExpression(node) { return node.kind === 70 /* Identifier */ || - node.kind === 177 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); + node.kind === 178 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; - function isEmptyObjectLiteralOrArrayLiteral(expression) { - var kind = expression.kind; - if (kind === 176 /* ObjectLiteralExpression */) { - return expression.properties.length === 0; - } - if (kind === 175 /* ArrayLiteralExpression */) { - return expression.elements.length === 0; - } - return false; + function isEmptyObjectLiteral(expression) { + return expression.kind === 177 /* ObjectLiteralExpression */ && + expression.properties.length === 0; } - ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; + ts.isEmptyObjectLiteral = isEmptyObjectLiteral; + function isEmptyArrayLiteral(expression) { + return expression.kind === 176 /* ArrayLiteralExpression */ && + expression.elements.length === 0; + } + ts.isEmptyArrayLiteral = isEmptyArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */); + } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); @@ -9333,47 +9524,6 @@ var ts; } return output; } - /** - * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph - * as the fallback implementation does not check for circular references by default. - */ - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - /** - * Serialize an object graph into a JSON string. - */ - function stringifyFallback(value) { - // JSON.stringify returns `undefined` here, instead of the string "undefined". - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** * Converts a string to a base-64 encoded ASCII string. @@ -9446,39 +9596,39 @@ var ts; || kind === 94 /* NullKeyword */) { return true; } - else if (kind === 177 /* PropertyAccessExpression */) { + else if (kind === 178 /* PropertyAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178 /* ElementAccessExpression */) { + else if (kind === 179 /* ElementAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */) { + else if (kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192 /* BinaryExpression */) { + else if (kind === 193 /* BinaryExpression */) { return node.operatorToken.kind !== 39 /* AsteriskAsteriskToken */ && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193 /* ConditionalExpression */) { + else if (kind === 194 /* ConditionalExpression */) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 /* VoidExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 186 /* DeleteExpression */) { + else if (kind === 189 /* VoidExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 187 /* DeleteExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175 /* ArrayLiteralExpression */) { + else if (kind === 176 /* ArrayLiteralExpression */) { return node.elements.length === 0; } - else if (kind === 176 /* ObjectLiteralExpression */) { + else if (kind === 177 /* ObjectLiteralExpression */) { return node.properties.length === 0; } - else if (kind === 179 /* CallExpression */) { + else if (kind === 180 /* CallExpression */) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -9493,16 +9643,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_7 in syntaxKindEnum) { - if (syntaxKindEnum[name_7] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_7 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -9511,6 +9664,14 @@ var ts; } } ts.formatSyntaxKind = formatSyntaxKind; + function getRangePos(range) { + return range ? range.pos : -1; + } + ts.getRangePos = getRangePos; + function getRangeEnd(range) { + return range ? range.end : -1; + } + ts.getRangeEnd = getRangeEnd; /** * Increases (or decreases) a position by the provided amount. * @@ -9642,11 +9803,11 @@ var ts; * declaration. */ function isDeclarationNameOfEnumOrNamespace(node) { - var parseNode = getParseTreeNode(node); + var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -9667,7 +9828,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ && declaration !== node) { + if (declaration.kind === 228 /* ClassDeclaration */ && declaration !== node) { return true; } } @@ -9732,6 +9893,10 @@ var ts; return node.kind === 70 /* Identifier */; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 189 /* VoidExpression */; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { // Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`. return isIdentifier(node) && node.autoGenerateKind > 0 /* None */; @@ -9744,16 +9909,16 @@ var ts; ts.isModifier = isModifier; // Names function isQualifiedName(node) { - return node.kind === 141 /* QualifiedName */; + return node.kind === 142 /* QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142 /* ComputedPropertyName */; + return node.kind === 143 /* ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 /* QualifiedName */ + return kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isEntityName = isEntityName; @@ -9762,7 +9927,7 @@ var ts; return kind === 70 /* Identifier */ || kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ - || kind === 142 /* ComputedPropertyName */; + || kind === 143 /* ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -9774,61 +9939,65 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 /* Identifier */ - || kind === 172 /* ObjectBindingPattern */ - || kind === 173 /* ArrayBindingPattern */; + || kind === 173 /* ObjectBindingPattern */ + || kind === 174 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Signature elements function isTypeParameter(node) { - return node.kind === 143 /* TypeParameter */; + return node.kind === 144 /* TypeParameter */; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144 /* Parameter */; + return node.kind === 145 /* Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; } ts.isDecorator = isDecorator; // Type members function isMethodDeclaration(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 147 /* PropertyDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 155 /* IndexSignature */ - || kind === 203 /* SemicolonClassElement */; + return kind === 151 /* Constructor */ + || kind === 148 /* PropertyDeclaration */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 156 /* IndexSignature */ + || kind === 205 /* SemicolonClassElement */; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 /* PropertyAssignment */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 259 /* SpreadAssignment */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 244 /* MissingDeclaration */; + return kind === 260 /* PropertyAssignment */ + || kind === 261 /* ShorthandPropertyAssignment */ + || kind === 262 /* SpreadAssignment */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 246 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type function isTypeNodeKind(kind) { - return (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) + return (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) || kind === 118 /* AnyKeyword */ || kind === 132 /* NumberKeyword */ + || kind === 133 /* ObjectKeyword */ || kind === 121 /* BooleanKeyword */ - || kind === 134 /* StringKeyword */ - || kind === 135 /* SymbolKeyword */ + || kind === 135 /* StringKeyword */ + || kind === 136 /* SymbolKeyword */ + || kind === 98 /* ThisKeyword */ || kind === 104 /* VoidKeyword */ + || kind === 138 /* UndefinedKeyword */ + || kind === 94 /* NullKeyword */ || kind === 129 /* NeverKeyword */ - || kind === 199 /* ExpressionWithTypeArguments */; + || kind === 200 /* ExpressionWithTypeArguments */; } /** * Node test that determines whether a node is a valid type node. @@ -9841,36 +10010,36 @@ var ts; ts.isTypeNode = isTypeNode; // Binding patterns function isArrayBindingPattern(node) { - return node.kind === 173 /* ArrayBindingPattern */; + return node.kind === 174 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172 /* ObjectBindingPattern */; + return node.kind === 173 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 /* ArrayBindingPattern */ - || kind === 172 /* ObjectBindingPattern */; + return kind === 174 /* ArrayBindingPattern */ + || kind === 173 /* ObjectBindingPattern */; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 /* ArrayLiteralExpression */ - || kind === 176 /* ObjectLiteralExpression */; + return kind === 176 /* ArrayLiteralExpression */ + || kind === 177 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174 /* BindingElement */; + return node.kind === 175 /* BindingElement */; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 /* BindingElement */ - || kind === 198 /* OmittedExpression */; + return kind === 175 /* BindingElement */ + || kind === 199 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -9878,9 +10047,9 @@ var ts; */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223 /* VariableDeclaration */: - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 175 /* BindingElement */: return true; } return false; @@ -9899,8 +10068,8 @@ var ts; */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return true; } return false; @@ -9911,8 +10080,8 @@ var ts; */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return true; } return false; @@ -9920,86 +10089,92 @@ var ts; ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; // Expression function isArrayLiteralExpression(node) { - return node.kind === 175 /* ArrayLiteralExpression */; + return node.kind === 176 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176 /* ObjectLiteralExpression */; + return node.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177 /* PropertyAccessExpression */; + return node.kind === 178 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isPropertyAccessOrQualifiedName(node) { + var kind = node.kind; + return kind === 178 /* PropertyAccessExpression */ + || kind === 142 /* QualifiedName */; + } + ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isElementAccessExpression(node) { - return node.kind === 178 /* ElementAccessExpression */; + return node.kind === 179 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192 /* BinaryExpression */; + return node.kind === 193 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193 /* ConditionalExpression */; + return node.kind === 194 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179 /* CallExpression */; + return node.kind === 180 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 /* TemplateExpression */ + return kind === 195 /* TemplateExpression */ || kind === 12 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196 /* SpreadElement */; + return node.kind === 197 /* SpreadElement */; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199 /* ExpressionWithTypeArguments */; + return node.kind === 200 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 /* PropertyAccessExpression */ - || kind === 178 /* ElementAccessExpression */ - || kind === 180 /* NewExpression */ - || kind === 179 /* CallExpression */ - || kind === 246 /* JsxElement */ - || kind === 247 /* JsxSelfClosingElement */ - || kind === 181 /* TaggedTemplateExpression */ - || kind === 175 /* ArrayLiteralExpression */ - || kind === 183 /* ParenthesizedExpression */ - || kind === 176 /* ObjectLiteralExpression */ - || kind === 197 /* ClassExpression */ - || kind === 184 /* FunctionExpression */ + return kind === 178 /* PropertyAccessExpression */ + || kind === 179 /* ElementAccessExpression */ + || kind === 181 /* NewExpression */ + || kind === 180 /* CallExpression */ + || kind === 248 /* JsxElement */ + || kind === 249 /* JsxSelfClosingElement */ + || kind === 182 /* TaggedTemplateExpression */ + || kind === 176 /* ArrayLiteralExpression */ + || kind === 184 /* ParenthesizedExpression */ + || kind === 177 /* ObjectLiteralExpression */ + || kind === 198 /* ClassExpression */ + || kind === 185 /* FunctionExpression */ || kind === 70 /* Identifier */ || kind === 11 /* RegularExpressionLiteral */ || kind === 8 /* NumericLiteral */ || kind === 9 /* StringLiteral */ || kind === 12 /* NoSubstitutionTemplateLiteral */ - || kind === 194 /* TemplateExpression */ + || kind === 195 /* TemplateExpression */ || kind === 85 /* FalseKeyword */ || kind === 94 /* NullKeyword */ || kind === 98 /* ThisKeyword */ || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ - || kind === 201 /* NonNullExpression */ - || kind === 297 /* RawExpression */; + || kind === 202 /* NonNullExpression */ + || kind === 203 /* MetaProperty */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */ - || kind === 186 /* DeleteExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 188 /* VoidExpression */ - || kind === 189 /* AwaitExpression */ - || kind === 182 /* TypeAssertionExpression */ + return kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */ + || kind === 187 /* DeleteExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 189 /* VoidExpression */ + || kind === 190 /* AwaitExpression */ + || kind === 183 /* TypeAssertionExpression */ || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -10007,14 +10182,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 /* ConditionalExpression */ - || kind === 195 /* YieldExpression */ - || kind === 185 /* ArrowFunction */ - || kind === 192 /* BinaryExpression */ - || kind === 196 /* SpreadElement */ - || kind === 200 /* AsExpression */ - || kind === 198 /* OmittedExpression */ - || kind === 297 /* RawExpression */ + return kind === 194 /* ConditionalExpression */ + || kind === 196 /* YieldExpression */ + || kind === 186 /* ArrowFunction */ + || kind === 193 /* BinaryExpression */ + || kind === 197 /* SpreadElement */ + || kind === 201 /* AsExpression */ + || kind === 199 /* OmittedExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10023,16 +10197,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 /* TypeAssertionExpression */ - || kind === 200 /* AsExpression */; + return kind === 183 /* TypeAssertionExpression */ + || kind === 201 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294 /* PartiallyEmittedExpression */; + return node.kind === 295 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293 /* NotEmittedStatement */; + return node.kind === 294 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10041,17 +10215,17 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198 /* OmittedExpression */; + return node.kind === 199 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; // Misc function isTemplateSpan(node) { - return node.kind === 202 /* TemplateSpan */; + return node.kind === 204 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; // Element function isBlock(node) { - return node.kind === 204 /* Block */; + return node.kind === 206 /* Block */; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10069,121 +10243,135 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223 /* VariableDeclaration */; + return node.kind === 225 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224 /* VariableDeclarationList */; + return node.kind === 226 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232 /* CaseBlock */; + return node.kind === 234 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 /* ModuleBlock */ - || kind === 230 /* ModuleDeclaration */; + return kind === 233 /* ModuleBlock */ + || kind === 232 /* ModuleDeclaration */ + || kind === 70 /* Identifier */; } ts.isModuleBody = isModuleBody; + function isNamespaceBody(node) { + var kind = node.kind; + return kind === 233 /* ModuleBlock */ + || kind === 232 /* ModuleDeclaration */; + } + ts.isNamespaceBody = isNamespaceBody; + function isJSDocNamespaceBody(node) { + var kind = node.kind; + return kind === 70 /* Identifier */ + || kind === 232 /* ModuleDeclaration */; + } + ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */; + return node.kind === 236 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236 /* ImportClause */; + return node.kind === 238 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 /* NamedImports */ - || kind === 237 /* NamespaceImport */; + return kind === 240 /* NamedImports */ + || kind === 239 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239 /* ImportSpecifier */; + return node.kind === 241 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242 /* NamedExports */; + return node.kind === 244 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243 /* ExportSpecifier */; + return node.kind === 245 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 /* ModuleDeclaration */ || node.kind === 229 /* EnumDeclaration */; + return node.kind === 232 /* ModuleDeclaration */ || node.kind === 231 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 /* ArrowFunction */ - || kind === 174 /* BindingElement */ - || kind === 226 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 150 /* Constructor */ - || kind === 229 /* EnumDeclaration */ - || kind === 260 /* EnumMember */ - || kind === 243 /* ExportSpecifier */ - || kind === 225 /* FunctionDeclaration */ - || kind === 184 /* FunctionExpression */ - || kind === 151 /* GetAccessor */ - || kind === 236 /* ImportClause */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 239 /* ImportSpecifier */ - || kind === 227 /* InterfaceDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 148 /* MethodSignature */ - || kind === 230 /* ModuleDeclaration */ - || kind === 233 /* NamespaceExportDeclaration */ - || kind === 237 /* NamespaceImport */ - || kind === 144 /* Parameter */ - || kind === 257 /* PropertyAssignment */ - || kind === 147 /* PropertyDeclaration */ - || kind === 146 /* PropertySignature */ - || kind === 152 /* SetAccessor */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 228 /* TypeAliasDeclaration */ - || kind === 143 /* TypeParameter */ - || kind === 223 /* VariableDeclaration */ - || kind === 285 /* JSDocTypedefTag */; + return kind === 186 /* ArrowFunction */ + || kind === 175 /* BindingElement */ + || kind === 228 /* ClassDeclaration */ + || kind === 198 /* ClassExpression */ + || kind === 151 /* Constructor */ + || kind === 231 /* EnumDeclaration */ + || kind === 263 /* EnumMember */ + || kind === 245 /* ExportSpecifier */ + || kind === 227 /* FunctionDeclaration */ + || kind === 185 /* FunctionExpression */ + || kind === 152 /* GetAccessor */ + || kind === 238 /* ImportClause */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 241 /* ImportSpecifier */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 252 /* JsxAttribute */ + || kind === 150 /* MethodDeclaration */ + || kind === 149 /* MethodSignature */ + || kind === 232 /* ModuleDeclaration */ + || kind === 235 /* NamespaceExportDeclaration */ + || kind === 239 /* NamespaceImport */ + || kind === 145 /* Parameter */ + || kind === 260 /* PropertyAssignment */ + || kind === 148 /* PropertyDeclaration */ + || kind === 147 /* PropertySignature */ + || kind === 153 /* SetAccessor */ + || kind === 261 /* ShorthandPropertyAssignment */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 144 /* TypeParameter */ + || kind === 225 /* VariableDeclaration */ + || kind === 289 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 225 /* FunctionDeclaration */ - || kind === 244 /* MissingDeclaration */ - || kind === 226 /* ClassDeclaration */ - || kind === 227 /* InterfaceDeclaration */ - || kind === 228 /* TypeAliasDeclaration */ - || kind === 229 /* EnumDeclaration */ - || kind === 230 /* ModuleDeclaration */ - || kind === 235 /* ImportDeclaration */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 241 /* ExportDeclaration */ - || kind === 240 /* ExportAssignment */ - || kind === 233 /* NamespaceExportDeclaration */; + return kind === 227 /* FunctionDeclaration */ + || kind === 246 /* MissingDeclaration */ + || kind === 228 /* ClassDeclaration */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 231 /* EnumDeclaration */ + || kind === 232 /* ModuleDeclaration */ + || kind === 237 /* ImportDeclaration */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 243 /* ExportDeclaration */ + || kind === 242 /* ExportAssignment */ + || kind === 235 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 /* BreakStatement */ - || kind === 214 /* ContinueStatement */ - || kind === 222 /* DebuggerStatement */ - || kind === 209 /* DoStatement */ - || kind === 207 /* ExpressionStatement */ - || kind === 206 /* EmptyStatement */ - || kind === 212 /* ForInStatement */ - || kind === 213 /* ForOfStatement */ - || kind === 211 /* ForStatement */ - || kind === 208 /* IfStatement */ - || kind === 219 /* LabeledStatement */ - || kind === 216 /* ReturnStatement */ - || kind === 218 /* SwitchStatement */ - || kind === 220 /* ThrowStatement */ - || kind === 221 /* TryStatement */ - || kind === 205 /* VariableStatement */ - || kind === 210 /* WhileStatement */ - || kind === 217 /* WithStatement */ - || kind === 293 /* NotEmittedStatement */ - || kind === 296 /* EndOfDeclarationMarker */ - || kind === 295 /* MergeDeclarationMarker */; + return kind === 217 /* BreakStatement */ + || kind === 216 /* ContinueStatement */ + || kind === 224 /* DebuggerStatement */ + || kind === 211 /* DoStatement */ + || kind === 209 /* ExpressionStatement */ + || kind === 208 /* EmptyStatement */ + || kind === 214 /* ForInStatement */ + || kind === 215 /* ForOfStatement */ + || kind === 213 /* ForStatement */ + || kind === 210 /* IfStatement */ + || kind === 221 /* LabeledStatement */ + || kind === 218 /* ReturnStatement */ + || kind === 220 /* SwitchStatement */ + || kind === 222 /* ThrowStatement */ + || kind === 223 /* TryStatement */ + || kind === 207 /* VariableStatement */ + || kind === 212 /* WhileStatement */ + || kind === 219 /* WithStatement */ + || kind === 294 /* NotEmittedStatement */ + || kind === 297 /* EndOfDeclarationMarker */ + || kind === 296 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10204,93 +10392,104 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204 /* Block */; + || kind === 206 /* Block */; } ts.isStatement = isStatement; // Module references function isModuleReference(node) { var kind = node.kind; - return kind === 245 /* ExternalModuleReference */ - || kind === 141 /* QualifiedName */ + return kind === 247 /* ExternalModuleReference */ + || kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isModuleReference = isModuleReference; // JSX function isJsxOpeningElement(node) { - return node.kind === 248 /* JsxOpeningElement */; + return node.kind === 250 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249 /* JsxClosingElement */; + return node.kind === 251 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 /* ThisKeyword */ || kind === 70 /* Identifier */ - || kind === 177 /* PropertyAccessExpression */; + || kind === 178 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 /* JsxElement */ - || kind === 252 /* JsxExpression */ - || kind === 247 /* JsxSelfClosingElement */ + return kind === 248 /* JsxElement */ + || kind === 255 /* JsxExpression */ + || kind === 249 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */; } ts.isJsxChild = isJsxChild; + function isJsxAttributes(node) { + var kind = node.kind; + return kind === 253 /* JsxAttributes */; + } + ts.isJsxAttributes = isJsxAttributes; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 /* JsxAttribute */ - || kind === 251 /* JsxSpreadAttribute */; + return kind === 252 /* JsxAttribute */ + || kind === 254 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251 /* JsxSpreadAttribute */; + return node.kind === 254 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250 /* JsxAttribute */; + return node.kind === 252 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 252 /* JsxExpression */; + || kind === 255 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; + function isJsxOpeningLikeElement(node) { + var kind = node.kind; + return kind === 250 /* JsxOpeningElement */ + || kind === 249 /* JsxSelfClosingElement */; + } + ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 /* CaseClause */ - || kind === 254 /* DefaultClause */; + return kind === 256 /* CaseClause */ + || kind === 257 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255 /* HeritageClause */; + return node.kind === 258 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256 /* CatchClause */; + return node.kind === 259 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 257 /* PropertyAssignment */; + return node.kind === 260 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258 /* ShorthandPropertyAssignment */; + return node.kind === 261 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; // Enum function isEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 263 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 261 /* SourceFile */; + return node.kind === 264 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10303,12 +10502,13 @@ var ts; function getDefaultLibFileName(options) { switch (options.target) { case 5 /* ESNext */: + return "lib.esnext.full.d.ts"; case 4 /* ES2017 */: - return "lib.es2017.d.ts"; + return "lib.es2017.full.d.ts"; case 3 /* ES2016 */: - return "lib.es2016.d.ts"; + return "lib.es2016.full.d.ts"; case 2 /* ES2015 */: - return "lib.es6.d.ts"; + return "lib.es6.d.ts"; // We don't use lib.es2015.full.d.ts due to breaking change. default: return "lib.d.ts"; } @@ -10516,13 +10716,13 @@ var ts; oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); } - return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN); + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength*/ newEndN - oldStartN); } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143 /* TypeParameter */) { + if (d && d.kind === 144 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229 /* InterfaceDeclaration */) { return current; } } @@ -10530,11 +10730,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 150 /* Constructor */ && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 151 /* Constructor */ && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 /* BindingElement */ || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 /* BindingElement */ || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10542,14 +10742,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -10565,23 +10765,23 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= node.flags; } return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; /** - * Checks to see if the locale is in the appropriate format, - * and if it is, attempts to set the appropriate language. - */ + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ function validateLocaleAndSetLanguage(locale, sys, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { @@ -10632,27 +10832,60 @@ var ts; } } ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; + function getOriginalNode(node, nodeTest) { + if (node) { + while (node.original !== undefined) { + node = node.original; + } + } + return !nodeTest || nodeTest(node) ? node : undefined; + } + ts.getOriginalNode = getOriginalNode; + /** + * Gets a value indicating whether a node originated in the parse tree. + * + * @param node The node to test. + */ + function isParseTreeNode(node) { + return (node.flags & 8 /* Synthesized */) === 0; + } + ts.isParseTreeNode = isParseTreeNode; + function getParseTreeNode(node, nodeTest) { + if (node === undefined || isParseTreeNode(node)) { + return node; + } + node = getOriginalNode(node); + if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { + return node; + } + return undefined; + } + ts.getParseTreeNode = getParseTreeNode; + /** + * Remove extra underscore from escaped identifier text content. + * + * @param identifier The escaped identifier text. + * @returns The unescaped identifier text. + */ + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; })(ts || (ts = {})); /// /// -/* @internal */ var ts; (function (ts) { - var NodeConstructor; - var SourceFileConstructor; - function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 /* SourceFile */ - ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) - : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); - var node = location - ? new ConstructorForKind(kind, location.pos, location.end) - : new ConstructorForKind(kind, /*pos*/ -1, /*end*/ -1); - node.flags = flags | 8 /* Synthesized */; + function createSynthesizedNode(kind) { + var node = ts.createNode(kind, -1, -1); + node.flags |= 8 /* Synthesized */; return node; } + /* @internal */ function updateNode(updated, original) { if (updated !== original) { setOriginalNode(updated, original); + setTextRange(updated, original); if (original.startsOnNewLine) { updated.startsOnNewLine = true; } @@ -10661,7 +10894,10 @@ var ts; return updated; } ts.updateNode = updateNode; - function createNodeArray(elements, location, hasTrailingComma) { + /** + * Make `elements` into a `NodeArray`. If `elements` is `undefined`, returns an empty `NodeArray`. + */ + function createNodeArray(elements, hasTrailingComma) { if (elements) { if (ts.isNodeArray(elements)) { return elements; @@ -10671,38 +10907,22 @@ var ts; elements = []; } var array = elements; - if (location) { - array.pos = location.pos; - array.end = location.end; - } - else { - array.pos = -1; - array.end = -1; - } - if (hasTrailingComma) { - array.hasTrailingComma = true; - } + array.pos = -1; + array.end = -1; + array.hasTrailingComma = hasTrailingComma; return array; } ts.createNodeArray = createNodeArray; - function createSynthesizedNode(kind, startsOnNewLine) { - var node = createNode(kind, /*location*/ undefined); - node.startsOnNewLine = startsOnNewLine; - return node; - } - ts.createSynthesizedNode = createSynthesizedNode; - function createSynthesizedNodeArray(elements) { - return createNodeArray(elements, /*location*/ undefined); - } - ts.createSynthesizedNodeArray = createSynthesizedNodeArray; /** * Creates a shallow, memberwise clone of a node with no source map location. */ + /* @internal */ function getSynthesizedClone(node) { // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of // the original node. We also need to exclude specific properties and only include own- // properties (to skip members already defined on the shared prototype). - var clone = createNode(node.kind, /*location*/ undefined, node.flags); + var clone = createSynthesizedNode(node.kind); + clone.flags |= node.flags; setOriginalNode(clone, node); for (var key in node) { if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { @@ -10713,54 +10933,50 @@ var ts; return clone; } ts.getSynthesizedClone = getSynthesizedClone; - /** - * Creates a shallow, memberwise clone of a node for mutation. - */ - function getMutableClone(node) { - var clone = getSynthesizedClone(node); - clone.pos = node.pos; - clone.end = node.end; - clone.parent = node.parent; - return clone; - } - ts.getMutableClone = getMutableClone; - function createLiteral(value, location) { + function createLiteral(value) { if (typeof value === "number") { - var node = createNode(8 /* NumericLiteral */, location, /*flags*/ undefined); - node.text = value.toString(); - return node; - } - else if (typeof value === "boolean") { - return createNode(value ? 100 /* TrueKeyword */ : 85 /* FalseKeyword */, location, /*flags*/ undefined); + return createNumericLiteral(value + ""); } - else if (typeof value === "string") { - var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined); - node.text = value; - return node; + if (typeof value === "boolean") { + return value ? createTrue() : createFalse(); } - else if (value) { - var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined); - node.textSourceNode = value; - node.text = value.text; - return node; + if (typeof value === "string") { + return createStringLiteral(value); } + return createLiteralFromNode(value); } ts.createLiteral = createLiteral; + function createNumericLiteral(value) { + var node = createSynthesizedNode(8 /* NumericLiteral */); + node.text = value; + node.numericLiteralFlags = 0; + return node; + } + ts.createNumericLiteral = createNumericLiteral; + function createStringLiteral(text) { + var node = createSynthesizedNode(9 /* StringLiteral */); + node.text = text; + return node; + } + function createLiteralFromNode(sourceNode) { + var node = createStringLiteral(sourceNode.text); + node.textSourceNode = sourceNode; + return node; + } // Identifiers - var nextAutoGenerateId = 0; - function createIdentifier(text, location) { - var node = createNode(70 /* Identifier */, location); + function createIdentifier(text) { + var node = createSynthesizedNode(70 /* Identifier */); node.text = ts.escapeIdentifier(text); - node.originalKeywordKind = ts.stringToToken(text); + node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */; node.autoGenerateKind = 0 /* None */; node.autoGenerateId = 0; return node; } ts.createIdentifier = createIdentifier; - function createTempVariable(recordTempVariable, location) { - var name = createNode(70 /* Identifier */, location); - name.text = ""; - name.originalKeywordKind = 0 /* Unknown */; + var nextAutoGenerateId = 0; + /** Create a unique temporary variable. */ + function createTempVariable(recordTempVariable) { + var name = createIdentifier(""); name.autoGenerateKind = 1 /* Auto */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; @@ -10770,98 +10986,399 @@ var ts; return name; } ts.createTempVariable = createTempVariable; - function createLoopVariable(location) { - var name = createNode(70 /* Identifier */, location); - name.text = ""; - name.originalKeywordKind = 0 /* Unknown */; + /** Create a unique temporary variable for use in a loop. */ + function createLoopVariable() { + var name = createIdentifier(""); name.autoGenerateKind = 2 /* Loop */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createLoopVariable = createLoopVariable; - function createUniqueName(text, location) { - var name = createNode(70 /* Identifier */, location); - name.text = text; - name.originalKeywordKind = 0 /* Unknown */; + /** Create a unique name based on the supplied text. */ + function createUniqueName(text) { + var name = createIdentifier(text); name.autoGenerateKind = 3 /* Unique */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createUniqueName = createUniqueName; - function getGeneratedNameForNode(node, location) { - var name = createNode(70 /* Identifier */, location); - name.original = node; - name.text = ""; - name.originalKeywordKind = 0 /* Unknown */; + /** Create a unique name generated for a node. */ + function getGeneratedNameForNode(node) { + var name = createIdentifier(""); name.autoGenerateKind = 4 /* Node */; name.autoGenerateId = nextAutoGenerateId; + name.original = node; nextAutoGenerateId++; return name; } ts.getGeneratedNameForNode = getGeneratedNameForNode; // Punctuation function createToken(token) { - return createNode(token); + return createSynthesizedNode(token); } ts.createToken = createToken; // Reserved words function createSuper() { - var node = createNode(96 /* SuperKeyword */); - return node; + return createSynthesizedNode(96 /* SuperKeyword */); } ts.createSuper = createSuper; - function createThis(location) { - var node = createNode(98 /* ThisKeyword */, location); - return node; + function createThis() { + return createSynthesizedNode(98 /* ThisKeyword */); } ts.createThis = createThis; function createNull() { - var node = createNode(94 /* NullKeyword */); - return node; + return createSynthesizedNode(94 /* NullKeyword */); } ts.createNull = createNull; + function createTrue() { + return createSynthesizedNode(100 /* TrueKeyword */); + } + ts.createTrue = createTrue; + function createFalse() { + return createSynthesizedNode(85 /* FalseKeyword */); + } + ts.createFalse = createFalse; // Names - function createComputedPropertyName(expression, location) { - var node = createNode(142 /* ComputedPropertyName */, location); + function createQualifiedName(left, right) { + var node = createSynthesizedNode(142 /* QualifiedName */); + node.left = left; + node.right = asName(right); + return node; + } + ts.createQualifiedName = createQualifiedName; + function updateQualifiedName(node, left, right) { + return node.left !== left + || node.right !== right + ? updateNode(createQualifiedName(left, right), node) + : node; + } + ts.updateQualifiedName = updateQualifiedName; + function createComputedPropertyName(expression) { + var node = createSynthesizedNode(143 /* ComputedPropertyName */); node.expression = expression; return node; } ts.createComputedPropertyName = createComputedPropertyName; function updateComputedPropertyName(node, expression) { - if (node.expression !== expression) { - return updateNode(createComputedPropertyName(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createComputedPropertyName(expression), node) + : node; } ts.updateComputedPropertyName = updateComputedPropertyName; + // Type Elements + function createSignatureDeclaration(kind, typeParameters, parameters, type) { + var signatureDeclaration = createSynthesizedNode(kind); + signatureDeclaration.typeParameters = asNodeArray(typeParameters); + signatureDeclaration.parameters = asNodeArray(parameters); + signatureDeclaration.type = type; + return signatureDeclaration; + } + ts.createSignatureDeclaration = createSignatureDeclaration; + function updateSignatureDeclaration(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) + : node; + } + function createFunctionTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(159 /* FunctionType */, typeParameters, parameters, type); + } + ts.createFunctionTypeNode = createFunctionTypeNode; + function updateFunctionTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateFunctionTypeNode = updateFunctionTypeNode; + function createConstructorTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(160 /* ConstructorType */, typeParameters, parameters, type); + } + ts.createConstructorTypeNode = createConstructorTypeNode; + function updateConstructorTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructorTypeNode = updateConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(154 /* CallSignature */, typeParameters, parameters, type); + } + ts.createCallSignatureDeclaration = createCallSignatureDeclaration; + function updateCallSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateCallSignatureDeclaration = updateCallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(155 /* ConstructSignature */, typeParameters, parameters, type); + } + ts.createConstructSignatureDeclaration = createConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructSignatureDeclaration = updateConstructSignatureDeclaration; + function createMethodSignature(typeParameters, parameters, type, name, questionToken) { + var methodSignature = createSignatureDeclaration(149 /* MethodSignature */, typeParameters, parameters, type); + methodSignature.name = asName(name); + methodSignature.questionToken = questionToken; + return methodSignature; + } + ts.createMethodSignature = createMethodSignature; + function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.name !== name + || node.questionToken !== questionToken + ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) + : node; + } + ts.updateMethodSignature = updateMethodSignature; + // Types + function createKeywordTypeNode(kind) { + return createSynthesizedNode(kind); + } + ts.createKeywordTypeNode = createKeywordTypeNode; + function createThisTypeNode() { + return createSynthesizedNode(168 /* ThisType */); + } + ts.createThisTypeNode = createThisTypeNode; + function createLiteralTypeNode(literal) { + var literalTypeNode = createSynthesizedNode(172 /* LiteralType */); + literalTypeNode.literal = literal; + return literalTypeNode; + } + ts.createLiteralTypeNode = createLiteralTypeNode; + function updateLiteralTypeNode(node, literal) { + return node.literal !== literal + ? updateNode(createLiteralTypeNode(literal), node) + : node; + } + ts.updateLiteralTypeNode = updateLiteralTypeNode; + function createTypeReferenceNode(typeName, typeArguments) { + var typeReference = createSynthesizedNode(158 /* TypeReference */); + typeReference.typeName = asName(typeName); + typeReference.typeArguments = asNodeArray(typeArguments); + return typeReference; + } + ts.createTypeReferenceNode = createTypeReferenceNode; + function updateTypeReferenceNode(node, typeName, typeArguments) { + return node.typeName !== typeName + || node.typeArguments !== typeArguments + ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) + : node; + } + ts.updateTypeReferenceNode = updateTypeReferenceNode; + function createTypePredicateNode(parameterName, type) { + var typePredicateNode = createSynthesizedNode(157 /* TypePredicate */); + typePredicateNode.parameterName = asName(parameterName); + typePredicateNode.type = type; + return typePredicateNode; + } + ts.createTypePredicateNode = createTypePredicateNode; + function updateTypePredicateNode(node, parameterName, type) { + return node.parameterName !== parameterName + || node.type !== type + ? updateNode(createTypePredicateNode(parameterName, type), node) + : node; + } + ts.updateTypePredicateNode = updateTypePredicateNode; + function createTypeQueryNode(exprName) { + var typeQueryNode = createSynthesizedNode(161 /* TypeQuery */); + typeQueryNode.exprName = exprName; + return typeQueryNode; + } + ts.createTypeQueryNode = createTypeQueryNode; + function updateTypeQueryNode(node, exprName) { + return node.exprName !== exprName ? updateNode(createTypeQueryNode(exprName), node) : node; + } + ts.updateTypeQueryNode = updateTypeQueryNode; + function createArrayTypeNode(elementType) { + var arrayTypeNode = createSynthesizedNode(163 /* ArrayType */); + arrayTypeNode.elementType = elementType; + return arrayTypeNode; + } + ts.createArrayTypeNode = createArrayTypeNode; + function updateArrayTypeNode(node, elementType) { + return node.elementType !== elementType + ? updateNode(createArrayTypeNode(elementType), node) + : node; + } + ts.updateArrayTypeNode = updateArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind, types) { + var unionTypeNode = createSynthesizedNode(kind); + unionTypeNode.types = createNodeArray(types); + return unionTypeNode; + } + ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node, types) { + return node.types !== types + ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) + : node; + } + ts.updateUnionOrIntersectionTypeNode = updateUnionOrIntersectionTypeNode; + function createTypeLiteralNode(members) { + var typeLiteralNode = createSynthesizedNode(162 /* TypeLiteral */); + typeLiteralNode.members = createNodeArray(members); + return typeLiteralNode; + } + ts.createTypeLiteralNode = createTypeLiteralNode; + function updateTypeLiteralNode(node, members) { + return node.members !== members + ? updateNode(createTypeLiteralNode(members), node) + : node; + } + ts.updateTypeLiteralNode = updateTypeLiteralNode; + function createTupleTypeNode(elementTypes) { + var tupleTypeNode = createSynthesizedNode(164 /* TupleType */); + tupleTypeNode.elementTypes = createNodeArray(elementTypes); + return tupleTypeNode; + } + ts.createTupleTypeNode = createTupleTypeNode; + function updateTypleTypeNode(node, elementTypes) { + return node.elementTypes !== elementTypes + ? updateNode(createTupleTypeNode(elementTypes), node) + : node; + } + ts.updateTypleTypeNode = updateTypleTypeNode; + function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { + var mappedTypeNode = createSynthesizedNode(171 /* MappedType */); + mappedTypeNode.readonlyToken = readonlyToken; + mappedTypeNode.typeParameter = typeParameter; + mappedTypeNode.questionToken = questionToken; + mappedTypeNode.type = type; + return mappedTypeNode; + } + ts.createMappedTypeNode = createMappedTypeNode; + function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { + return node.readonlyToken !== readonlyToken + || node.typeParameter !== typeParameter + || node.questionToken !== questionToken + || node.type !== type + ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) + : node; + } + ts.updateMappedTypeNode = updateMappedTypeNode; + function createTypeOperatorNode(type) { + var typeOperatorNode = createSynthesizedNode(169 /* TypeOperator */); + typeOperatorNode.operator = 126 /* KeyOfKeyword */; + typeOperatorNode.type = type; + return typeOperatorNode; + } + ts.createTypeOperatorNode = createTypeOperatorNode; + function updateTypeOperatorNode(node, type) { + return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; + } + ts.updateTypeOperatorNode = updateTypeOperatorNode; + function createIndexedAccessTypeNode(objectType, indexType) { + var indexedAccessTypeNode = createSynthesizedNode(170 /* IndexedAccessType */); + indexedAccessTypeNode.objectType = objectType; + indexedAccessTypeNode.indexType = indexType; + return indexedAccessTypeNode; + } + ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node, objectType, indexType) { + return node.objectType !== objectType + || node.indexType !== indexType + ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) + : node; + } + ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; + // Type Declarations + function createTypeParameterDeclaration(name, constraint, defaultType) { + var typeParameter = createSynthesizedNode(144 /* TypeParameter */); + typeParameter.name = asName(name); + typeParameter.constraint = constraint; + typeParameter.default = defaultType; + return typeParameter; + } + ts.createTypeParameterDeclaration = createTypeParameterDeclaration; + function updateTypeParameterDeclaration(node, name, constraint, defaultType) { + return node.name !== name + || node.constraint !== constraint + || node.default !== defaultType + ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) + : node; + } + ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; + // Signature elements + function createPropertySignature(name, questionToken, type, initializer) { + var propertySignature = createSynthesizedNode(147 /* PropertySignature */); + propertySignature.name = asName(name); + propertySignature.questionToken = questionToken; + propertySignature.type = type; + propertySignature.initializer = initializer; + return propertySignature; + } + ts.createPropertySignature = createPropertySignature; + function updatePropertySignature(node, name, questionToken, type, initializer) { + return node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createPropertySignature(name, questionToken, type, initializer), node) + : node; + } + ts.updatePropertySignature = updatePropertySignature; + function createIndexSignatureDeclaration(decorators, modifiers, parameters, type) { + var indexSignature = createSynthesizedNode(156 /* IndexSignature */); + indexSignature.decorators = asNodeArray(decorators); + indexSignature.modifiers = asNodeArray(modifiers); + indexSignature.parameters = createNodeArray(parameters); + indexSignature.type = type; + return indexSignature; + } + ts.createIndexSignatureDeclaration = createIndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node, decorators, modifiers, parameters, type) { + return node.parameters !== parameters + || node.type !== type + || node.decorators !== decorators + || node.modifiers !== modifiers + ? updateNode(createIndexSignatureDeclaration(decorators, modifiers, parameters, type), node) + : node; + } + ts.updateIndexSignatureDeclaration = updateIndexSignatureDeclaration; // Signature elements - function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144 /* Parameter */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + var node = createSynthesizedNode(145 /* Parameter */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.name = asName(name); node.questionToken = questionToken; node.type = type; - node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node); - } - return node; + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer), node) + : node; } ts.updateParameter = updateParameter; + function createDecorator(expression) { + var node = createSynthesizedNode(146 /* Decorator */); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createDecorator = createDecorator; + function updateDecorator(node, expression) { + return node.expression !== expression + ? updateNode(createDecorator(expression), node) + : node; + } + ts.updateDecorator = updateDecorator; // Type members - function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147 /* PropertyDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createProperty(decorators, modifiers, name, questionToken, type, initializer) { + var node = createSynthesizedNode(148 /* PropertyDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.questionToken = questionToken; node.type = type; node.initializer = initializer; @@ -10869,36 +11386,46 @@ var ts; } ts.createProperty = createProperty; function updateProperty(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer), node) + : node; } ts.updateProperty = updateProperty; - function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149 /* MethodDeclaration */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(150 /* MethodDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.questionToken = questionToken; + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } - ts.createMethod = createMethod; - function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + ts.createMethodDeclaration = createMethodDeclaration; + function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) + : node; } ts.updateMethod = updateMethod; - function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150 /* Constructor */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createConstructor(decorators, modifiers, parameters, body) { + var node = createSynthesizedNode(151 /* Constructor */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = undefined; @@ -10907,17 +11434,19 @@ var ts; } ts.createConstructor = createConstructor; function updateConstructor(node, decorators, modifiers, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) { - return updateNode(createConstructor(decorators, modifiers, parameters, body, /*location*/ node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.parameters !== parameters + || node.body !== body + ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) + : node; } ts.updateConstructor = updateConstructor; - function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151 /* GetAccessor */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createGetAccessor(decorators, modifiers, name, parameters, type, body) { + var node = createSynthesizedNode(152 /* GetAccessor */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = type; @@ -10926,17 +11455,21 @@ var ts; } ts.createGetAccessor = createGetAccessor; function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) + : node; } ts.updateGetAccessor = updateGetAccessor; - function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152 /* SetAccessor */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createSetAccessor(decorators, modifiers, name, parameters, body) { + var node = createSynthesizedNode(153 /* SetAccessor */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.body = body; @@ -10944,59 +11477,62 @@ var ts; } ts.createSetAccessor = createSetAccessor; function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) { - return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, /*location*/ node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.body !== body + ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) + : node; } ts.updateSetAccessor = updateSetAccessor; // Binding Patterns - function createObjectBindingPattern(elements, location) { - var node = createNode(172 /* ObjectBindingPattern */, location); + function createObjectBindingPattern(elements) { + var node = createSynthesizedNode(173 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); return node; } ts.createObjectBindingPattern = createObjectBindingPattern; function updateObjectBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createObjectBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createObjectBindingPattern(elements), node) + : node; } ts.updateObjectBindingPattern = updateObjectBindingPattern; - function createArrayBindingPattern(elements, location) { - var node = createNode(173 /* ArrayBindingPattern */, location); + function createArrayBindingPattern(elements) { + var node = createSynthesizedNode(174 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); return node; } ts.createArrayBindingPattern = createArrayBindingPattern; function updateArrayBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayBindingPattern(elements), node) + : node; } ts.updateArrayBindingPattern = updateArrayBindingPattern; - function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174 /* BindingElement */, location); - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createBindingElement(dotDotDotToken, propertyName, name, initializer) { + var node = createSynthesizedNode(175 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.propertyName = asName(propertyName); + node.name = asName(name); node.initializer = initializer; return node; } ts.createBindingElement = createBindingElement; function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); - } - return node; + return node.propertyName !== propertyName + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.initializer !== initializer + ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) + : node; } ts.updateBindingElement = updateBindingElement; // Expression - function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175 /* ArrayLiteralExpression */, location); - node.elements = parenthesizeListElements(createNodeArray(elements)); + function createArrayLiteral(elements, multiLine) { + var node = createSynthesizedNode(176 /* ArrayLiteralExpression */); + node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; } @@ -11004,14 +11540,13 @@ var ts; } ts.createArrayLiteral = createArrayLiteral; function updateArrayLiteral(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayLiteral(elements, node, node.multiLine), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayLiteral(elements, node.multiLine), node) + : node; } ts.updateArrayLiteral = updateArrayLiteral; - function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176 /* ObjectLiteralExpression */, location); + function createObjectLiteral(properties, multiLine) { + var node = createSynthesizedNode(177 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -11020,436 +11555,465 @@ var ts; } ts.createObjectLiteral = createObjectLiteral; function updateObjectLiteral(node, properties) { - if (node.properties !== properties) { - return updateNode(createObjectLiteral(properties, node, node.multiLine), node); - } - return node; + return node.properties !== properties + ? updateNode(createObjectLiteral(properties, node.multiLine), node) + : node; } ts.updateObjectLiteral = updateObjectLiteral; - function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177 /* PropertyAccessExpression */, location, flags); - node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAccess(expression, name) { + var node = createSynthesizedNode(178 /* PropertyAccessExpression */); + node.expression = ts.parenthesizeForAccess(expression); + node.name = asName(name); + setEmitFlags(node, 65536 /* NoIndentation */); return node; } ts.createPropertyAccess = createPropertyAccess; function updatePropertyAccess(node, expression, name) { - if (node.expression !== expression || node.name !== name) { - var propertyAccess = createPropertyAccess(expression, name, /*location*/ node, node.flags); - // Because we are updating existed propertyAccess we want to inherit its emitFlags instead of using default from createPropertyAccess - (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node); - return updateNode(propertyAccess, node); - } - return node; + // Because we are updating existed propertyAccess we want to inherit its emitFlags + // instead of using the default from createPropertyAccess + return node.expression !== expression + || node.name !== name + ? updateNode(setEmitFlags(createPropertyAccess(expression, name), getEmitFlags(node)), node) + : node; } ts.updatePropertyAccess = updatePropertyAccess; - function createElementAccess(expression, index, location) { - var node = createNode(178 /* ElementAccessExpression */, location); - node.expression = parenthesizeForAccess(expression); - node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; + function createElementAccess(expression, index) { + var node = createSynthesizedNode(179 /* ElementAccessExpression */); + node.expression = ts.parenthesizeForAccess(expression); + node.argumentExpression = asExpression(index); return node; } ts.createElementAccess = createElementAccess; function updateElementAccess(node, expression, argumentExpression) { - if (node.expression !== expression || node.argumentExpression !== argumentExpression) { - return updateNode(createElementAccess(expression, argumentExpression, node), node); - } - return node; + return node.expression !== expression + || node.argumentExpression !== argumentExpression + ? updateNode(createElementAccess(expression, argumentExpression), node) + : node; } ts.updateElementAccess = updateElementAccess; - function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179 /* CallExpression */, location, flags); - node.expression = parenthesizeForAccess(expression); - if (typeArguments) { - node.typeArguments = createNodeArray(typeArguments); - } - node.arguments = parenthesizeListElements(createNodeArray(argumentsArray)); + function createCall(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(180 /* CallExpression */); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); return node; } ts.createCall = createCall; function updateCall(node, expression, typeArguments, argumentsArray) { - if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) { - return updateNode(createCall(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node); - } - return node; + return expression !== node.expression + || typeArguments !== node.typeArguments + || argumentsArray !== node.arguments + ? updateNode(createCall(expression, typeArguments, argumentsArray), node) + : node; } ts.updateCall = updateCall; - function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180 /* NewExpression */, location, flags); - node.expression = parenthesizeForNew(expression); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; + function createNew(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(181 /* NewExpression */); + node.expression = ts.parenthesizeForNew(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; return node; } ts.createNew = createNew; function updateNew(node, expression, typeArguments, argumentsArray) { - if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) { - return updateNode(createNew(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node); - } - return node; + return node.expression !== expression + || node.typeArguments !== typeArguments + || node.arguments !== argumentsArray + ? updateNode(createNew(expression, typeArguments, argumentsArray), node) + : node; } ts.updateNew = updateNew; - function createTaggedTemplate(tag, template, location) { - var node = createNode(181 /* TaggedTemplateExpression */, location); - node.tag = parenthesizeForAccess(tag); + function createTaggedTemplate(tag, template) { + var node = createSynthesizedNode(182 /* TaggedTemplateExpression */); + node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; } ts.createTaggedTemplate = createTaggedTemplate; function updateTaggedTemplate(node, tag, template) { - if (node.tag !== tag || node.template !== template) { - return updateNode(createTaggedTemplate(tag, template, node), node); - } - return node; + return node.tag !== tag + || node.template !== template + ? updateNode(createTaggedTemplate(tag, template), node) + : node; } ts.updateTaggedTemplate = updateTaggedTemplate; - function createParen(expression, location) { - var node = createNode(183 /* ParenthesizedExpression */, location); + function createTypeAssertion(type, expression) { + var node = createSynthesizedNode(183 /* TypeAssertionExpression */); + node.type = type; + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeAssertion = createTypeAssertion; + function updateTypeAssertion(node, type, expression) { + return node.type !== type + || node.expression !== expression + ? updateNode(createTypeAssertion(type, expression), node) + : node; + } + ts.updateTypeAssertion = updateTypeAssertion; + function createParen(expression) { + var node = createSynthesizedNode(184 /* ParenthesizedExpression */); node.expression = expression; return node; } ts.createParen = createParen; function updateParen(node, expression) { - if (node.expression !== expression) { - return updateNode(createParen(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createParen(expression), node) + : node; } ts.updateParen = updateParen; - function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184 /* FunctionExpression */, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(185 /* FunctionExpression */); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionExpression = createFunctionExpression; - function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) { - if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.name !== name + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionExpression = updateFunctionExpression; - function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185 /* ArrowFunction */, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + var node = createSynthesizedNode(186 /* ArrowFunction */); + node.modifiers = asNodeArray(modifiers); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35 /* EqualsGreaterThanToken */); - node.body = parenthesizeConciseBody(body); + node.body = ts.parenthesizeConciseBody(body); return node; } ts.createArrowFunction = createArrowFunction; function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) { - if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, /*location*/ node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body), node) + : node; } ts.updateArrowFunction = updateArrowFunction; - function createDelete(expression, location) { - var node = createNode(186 /* DeleteExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createDelete(expression) { + var node = createSynthesizedNode(187 /* DeleteExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createDelete = createDelete; function updateDelete(node, expression) { - if (node.expression !== expression) { - return updateNode(createDelete(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createDelete(expression), node) + : node; } ts.updateDelete = updateDelete; - function createTypeOf(expression, location) { - var node = createNode(187 /* TypeOfExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createTypeOf(expression) { + var node = createSynthesizedNode(188 /* TypeOfExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createTypeOf = createTypeOf; function updateTypeOf(node, expression) { - if (node.expression !== expression) { - return updateNode(createTypeOf(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createTypeOf(expression), node) + : node; } ts.updateTypeOf = updateTypeOf; - function createVoid(expression, location) { - var node = createNode(188 /* VoidExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createVoid(expression) { + var node = createSynthesizedNode(189 /* VoidExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createVoid = createVoid; function updateVoid(node, expression) { - if (node.expression !== expression) { - return updateNode(createVoid(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createVoid(expression), node) + : node; } ts.updateVoid = updateVoid; - function createAwait(expression, location) { - var node = createNode(189 /* AwaitExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createAwait(expression) { + var node = createSynthesizedNode(190 /* AwaitExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createAwait = createAwait; function updateAwait(node, expression) { - if (node.expression !== expression) { - return updateNode(createAwait(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createAwait(expression), node) + : node; } ts.updateAwait = updateAwait; - function createPrefix(operator, operand, location) { - var node = createNode(190 /* PrefixUnaryExpression */, location); + function createPrefix(operator, operand) { + var node = createSynthesizedNode(191 /* PrefixUnaryExpression */); node.operator = operator; - node.operand = parenthesizePrefixOperand(operand); + node.operand = ts.parenthesizePrefixOperand(operand); return node; } ts.createPrefix = createPrefix; function updatePrefix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPrefix(node.operator, operand, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPrefix(node.operator, operand), node) + : node; } ts.updatePrefix = updatePrefix; - function createPostfix(operand, operator, location) { - var node = createNode(191 /* PostfixUnaryExpression */, location); - node.operand = parenthesizePostfixOperand(operand); + function createPostfix(operand, operator) { + var node = createSynthesizedNode(192 /* PostfixUnaryExpression */); + node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; } ts.createPostfix = createPostfix; function updatePostfix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPostfix(operand, node.operator, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPostfix(operand, node.operator), node) + : node; } ts.updatePostfix = updatePostfix; - function createBinary(left, operator, right, location) { - var operatorToken = typeof operator === "number" ? createToken(operator) : operator; + function createBinary(left, operator, right) { + var node = createSynthesizedNode(193 /* BinaryExpression */); + var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; - var node = createNode(192 /* BinaryExpression */, location); - node.left = parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); + node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); node.operatorToken = operatorToken; - node.right = parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left); + node.right = ts.parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left); return node; } ts.createBinary = createBinary; function updateBinary(node, left, right) { - if (node.left !== left || node.right !== right) { - return updateNode(createBinary(left, node.operatorToken, right, /*location*/ node), node); - } - return node; + return node.left !== left + || node.right !== right + ? updateNode(createBinary(left, node.operatorToken, right), node) + : node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); - node.condition = parenthesizeForConditionalHead(condition); - if (whenFalse) { - // second overload - node.questionToken = questionTokenOrWhenTrue; - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - node.colonToken = colonTokenOrLocation; - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); - } - else { - // first overload - node.questionToken = createToken(54 /* QuestionToken */); - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); - node.colonToken = createToken(55 /* ColonToken */); - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - } + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { + var node = createSynthesizedNode(194 /* ConditionalExpression */); + node.condition = ts.parenthesizeForConditionalHead(condition); + node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(54 /* QuestionToken */); + node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); + node.colonToken = whenFalse ? colonToken : createToken(55 /* ColonToken */); + node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse); return node; } ts.createConditional = createConditional; function updateConditional(node, condition, whenTrue, whenFalse) { - if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) { - return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node); - } - return node; + return node.condition !== condition + || node.whenTrue !== whenTrue + || node.whenFalse !== whenFalse + ? updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse), node) + : node; } ts.updateConditional = updateConditional; - function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194 /* TemplateExpression */, location); + function createTemplateExpression(head, templateSpans) { + var node = createSynthesizedNode(195 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; } ts.createTemplateExpression = createTemplateExpression; function updateTemplateExpression(node, head, templateSpans) { - if (node.head !== head || node.templateSpans !== templateSpans) { - return updateNode(createTemplateExpression(head, templateSpans, node), node); - } - return node; + return node.head !== head + || node.templateSpans !== templateSpans + ? updateNode(createTemplateExpression(head, templateSpans), node) + : node; } ts.updateTemplateExpression = updateTemplateExpression; - function createYield(asteriskToken, expression, location) { - var node = createNode(195 /* YieldExpression */, location); - node.asteriskToken = asteriskToken; - node.expression = expression; + function createYield(asteriskTokenOrExpression, expression) { + var node = createSynthesizedNode(196 /* YieldExpression */); + node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 38 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined; + node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 38 /* AsteriskToken */ ? asteriskTokenOrExpression : expression; return node; } ts.createYield = createYield; - function updateYield(node, expression) { - if (node.expression !== expression) { - return updateNode(createYield(node.asteriskToken, expression, node), node); - } - return node; + function updateYield(node, asteriskToken, expression) { + return node.expression !== expression + || node.asteriskToken !== asteriskToken + ? updateNode(createYield(asteriskToken, expression), node) + : node; } ts.updateYield = updateYield; - function createSpread(expression, location) { - var node = createNode(196 /* SpreadElement */, location); - node.expression = parenthesizeExpressionForList(expression); + function createSpread(expression) { + var node = createSynthesizedNode(197 /* SpreadElement */); + node.expression = ts.parenthesizeExpressionForList(expression); return node; } ts.createSpread = createSpread; function updateSpread(node, expression) { - if (node.expression !== expression) { - return updateNode(createSpread(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createSpread(expression), node) + : node; } ts.updateSpread = updateSpread; - function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197 /* ClassExpression */, location); + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(198 /* ClassExpression */); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassExpression = createClassExpression; function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { - if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassExpression = updateClassExpression; - function createOmittedExpression(location) { - var node = createNode(198 /* OmittedExpression */, location); - return node; + function createOmittedExpression() { + return createSynthesizedNode(199 /* OmittedExpression */); } ts.createOmittedExpression = createOmittedExpression; - function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199 /* ExpressionWithTypeArguments */, location); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.expression = parenthesizeForAccess(expression); + function createExpressionWithTypeArguments(typeArguments, expression) { + var node = createSynthesizedNode(200 /* ExpressionWithTypeArguments */); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); return node; } ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; function updateExpressionWithTypeArguments(node, typeArguments, expression) { - if (node.typeArguments !== typeArguments || node.expression !== expression) { - return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node); - } - return node; + return node.typeArguments !== typeArguments + || node.expression !== expression + ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) + : node; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; + function createAsExpression(expression, type) { + var node = createSynthesizedNode(201 /* AsExpression */); + node.expression = expression; + node.type = type; + return node; + } + ts.createAsExpression = createAsExpression; + function updateAsExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? updateNode(createAsExpression(expression, type), node) + : node; + } + ts.updateAsExpression = updateAsExpression; + function createNonNullExpression(expression) { + var node = createSynthesizedNode(202 /* NonNullExpression */); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createNonNullExpression = createNonNullExpression; + function updateNonNullExpression(node, expression) { + return node.expression !== expression + ? updateNode(createNonNullExpression(expression), node) + : node; + } + ts.updateNonNullExpression = updateNonNullExpression; // Misc - function createTemplateSpan(expression, literal, location) { - var node = createNode(202 /* TemplateSpan */, location); + function createTemplateSpan(expression, literal) { + var node = createSynthesizedNode(204 /* TemplateSpan */); node.expression = expression; node.literal = literal; return node; } ts.createTemplateSpan = createTemplateSpan; function updateTemplateSpan(node, expression, literal) { - if (node.expression !== expression || node.literal !== literal) { - return updateNode(createTemplateSpan(expression, literal, node), node); - } - return node; + return node.expression !== expression + || node.literal !== literal + ? updateNode(createTemplateSpan(expression, literal), node) + : node; } ts.updateTemplateSpan = updateTemplateSpan; // Element - function createBlock(statements, location, multiLine, flags) { - var block = createNode(204 /* Block */, location, flags); + function createBlock(statements, multiLine) { + var block = createSynthesizedNode(206 /* Block */); block.statements = createNodeArray(statements); - if (multiLine) { - block.multiLine = true; - } + if (multiLine) + block.multiLine = multiLine; return block; } ts.createBlock = createBlock; function updateBlock(node, statements) { - if (statements !== node.statements) { - return updateNode(createBlock(statements, /*location*/ node, node.multiLine, node.flags), node); - } - return node; + return statements !== node.statements + ? updateNode(createBlock(statements, node.multiLine), node) + : node; } ts.updateBlock = updateBlock; - function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205 /* VariableStatement */, location, flags); + function createVariableStatement(modifiers, declarationList) { + var node = createSynthesizedNode(207 /* VariableStatement */); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; return node; } ts.createVariableStatement = createVariableStatement; function updateVariableStatement(node, modifiers, declarationList) { - if (node.modifiers !== modifiers || node.declarationList !== declarationList) { - return updateNode(createVariableStatement(modifiers, declarationList, /*location*/ node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.declarationList !== declarationList + ? updateNode(createVariableStatement(modifiers, declarationList), node) + : node; } ts.updateVariableStatement = updateVariableStatement; - function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224 /* VariableDeclarationList */, location, flags); + function createVariableDeclarationList(declarations, flags) { + var node = createSynthesizedNode(226 /* VariableDeclarationList */); + node.flags |= flags; node.declarations = createNodeArray(declarations); return node; } ts.createVariableDeclarationList = createVariableDeclarationList; function updateVariableDeclarationList(node, declarations) { - if (node.declarations !== declarations) { - return updateNode(createVariableDeclarationList(declarations, /*location*/ node, node.flags), node); - } - return node; + return node.declarations !== declarations + ? updateNode(createVariableDeclarationList(declarations, node.flags), node) + : node; } ts.updateVariableDeclarationList = updateVariableDeclarationList; - function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223 /* VariableDeclaration */, location, flags); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createVariableDeclaration(name, type, initializer) { + var node = createSynthesizedNode(225 /* VariableDeclaration */); + node.name = asName(name); node.type = type; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createVariableDeclaration = createVariableDeclaration; function updateVariableDeclaration(node, name, type, initializer) { - if (node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createVariableDeclaration(name, type, initializer, /*location*/ node, node.flags), node); - } - return node; + return node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createVariableDeclaration(name, type, initializer), node) + : node; } ts.updateVariableDeclaration = updateVariableDeclaration; - function createEmptyStatement(location) { - return createNode(206 /* EmptyStatement */, location); + function createEmptyStatement() { + return createSynthesizedNode(208 /* EmptyStatement */); } ts.createEmptyStatement = createEmptyStatement; - function createStatement(expression, location, flags) { - var node = createNode(207 /* ExpressionStatement */, location, flags); - node.expression = parenthesizeExpressionForExpressionStatement(expression); + function createStatement(expression) { + var node = createSynthesizedNode(209 /* ExpressionStatement */); + node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } ts.createStatement = createStatement; function updateStatement(node, expression) { - if (node.expression !== expression) { - return updateNode(createStatement(expression, /*location*/ node, node.flags), node); - } - return node; + return node.expression !== expression + ? updateNode(createStatement(expression), node) + : node; } ts.updateStatement = updateStatement; - function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208 /* IfStatement */, location); + function createIf(expression, thenStatement, elseStatement) { + var node = createSynthesizedNode(210 /* IfStatement */); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11457,42 +12021,43 @@ var ts; } ts.createIf = createIf; function updateIf(node, expression, thenStatement, elseStatement) { - if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) { - return updateNode(createIf(expression, thenStatement, elseStatement, /*location*/ node), node); - } - return node; + return node.expression !== expression + || node.thenStatement !== thenStatement + || node.elseStatement !== elseStatement + ? updateNode(createIf(expression, thenStatement, elseStatement), node) + : node; } ts.updateIf = updateIf; - function createDo(statement, expression, location) { - var node = createNode(209 /* DoStatement */, location); + function createDo(statement, expression) { + var node = createSynthesizedNode(211 /* DoStatement */); node.statement = statement; node.expression = expression; return node; } ts.createDo = createDo; function updateDo(node, statement, expression) { - if (node.statement !== statement || node.expression !== expression) { - return updateNode(createDo(statement, expression, node), node); - } - return node; + return node.statement !== statement + || node.expression !== expression + ? updateNode(createDo(statement, expression), node) + : node; } ts.updateDo = updateDo; - function createWhile(expression, statement, location) { - var node = createNode(210 /* WhileStatement */, location); + function createWhile(expression, statement) { + var node = createSynthesizedNode(212 /* WhileStatement */); node.expression = expression; node.statement = statement; return node; } ts.createWhile = createWhile; function updateWhile(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWhile(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWhile(expression, statement), node) + : node; } ts.updateWhile = updateWhile; - function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211 /* ForStatement */, location, /*flags*/ undefined); + function createFor(initializer, condition, incrementor, statement) { + var node = createSynthesizedNode(213 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11501,14 +12066,16 @@ var ts; } ts.createFor = createFor; function updateFor(node, initializer, condition, incrementor, statement) { - if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) { - return updateNode(createFor(initializer, condition, incrementor, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.condition !== condition + || node.incrementor !== incrementor + || node.statement !== statement + ? updateNode(createFor(initializer, condition, incrementor, statement), node) + : node; } ts.updateFor = updateFor; - function createForIn(initializer, expression, statement, location) { - var node = createNode(212 /* ForInStatement */, location); + function createForIn(initializer, expression, statement) { + var node = createSynthesizedNode(214 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11516,127 +12083,123 @@ var ts; } ts.createForIn = createForIn; function updateForIn(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForIn(initializer, expression, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForIn(initializer, expression, statement), node) + : node; } ts.updateForIn = updateForIn; - function createForOf(initializer, expression, statement, location) { - var node = createNode(213 /* ForOfStatement */, location); + function createForOf(awaitModifier, initializer, expression, statement) { + var node = createSynthesizedNode(215 /* ForOfStatement */); + node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; node.statement = statement; return node; } ts.createForOf = createForOf; - function updateForOf(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForOf(initializer, expression, statement, node), node); - } - return node; + function updateForOf(node, awaitModifier, initializer, expression, statement) { + return node.awaitModifier !== awaitModifier + || node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) + : node; } ts.updateForOf = updateForOf; - function createContinue(label, location) { - var node = createNode(214 /* ContinueStatement */, location); - if (label) { - node.label = label; - } + function createContinue(label) { + var node = createSynthesizedNode(216 /* ContinueStatement */); + node.label = asName(label); return node; } ts.createContinue = createContinue; function updateContinue(node, label) { - if (node.label !== label) { - return updateNode(createContinue(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createContinue(label), node) + : node; } ts.updateContinue = updateContinue; - function createBreak(label, location) { - var node = createNode(215 /* BreakStatement */, location); - if (label) { - node.label = label; - } + function createBreak(label) { + var node = createSynthesizedNode(217 /* BreakStatement */); + node.label = asName(label); return node; } ts.createBreak = createBreak; function updateBreak(node, label) { - if (node.label !== label) { - return updateNode(createBreak(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createBreak(label), node) + : node; } ts.updateBreak = updateBreak; - function createReturn(expression, location) { - var node = createNode(216 /* ReturnStatement */, location); + function createReturn(expression) { + var node = createSynthesizedNode(218 /* ReturnStatement */); node.expression = expression; return node; } ts.createReturn = createReturn; function updateReturn(node, expression) { - if (node.expression !== expression) { - return updateNode(createReturn(expression, /*location*/ node), node); - } - return node; + return node.expression !== expression + ? updateNode(createReturn(expression), node) + : node; } ts.updateReturn = updateReturn; - function createWith(expression, statement, location) { - var node = createNode(217 /* WithStatement */, location); + function createWith(expression, statement) { + var node = createSynthesizedNode(219 /* WithStatement */); node.expression = expression; node.statement = statement; return node; } ts.createWith = createWith; function updateWith(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWith(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWith(expression, statement), node) + : node; } ts.updateWith = updateWith; - function createSwitch(expression, caseBlock, location) { - var node = createNode(218 /* SwitchStatement */, location); - node.expression = parenthesizeExpressionForList(expression); + function createSwitch(expression, caseBlock) { + var node = createSynthesizedNode(220 /* SwitchStatement */); + node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; } ts.createSwitch = createSwitch; function updateSwitch(node, expression, caseBlock) { - if (node.expression !== expression || node.caseBlock !== caseBlock) { - return updateNode(createSwitch(expression, caseBlock, node), node); - } - return node; + return node.expression !== expression + || node.caseBlock !== caseBlock + ? updateNode(createSwitch(expression, caseBlock), node) + : node; } ts.updateSwitch = updateSwitch; - function createLabel(label, statement, location) { - var node = createNode(219 /* LabeledStatement */, location); - node.label = typeof label === "string" ? createIdentifier(label) : label; + function createLabel(label, statement) { + var node = createSynthesizedNode(221 /* LabeledStatement */); + node.label = asName(label); node.statement = statement; return node; } ts.createLabel = createLabel; function updateLabel(node, label, statement) { - if (node.label !== label || node.statement !== statement) { - return updateNode(createLabel(label, statement, node), node); - } - return node; + return node.label !== label + || node.statement !== statement + ? updateNode(createLabel(label, statement), node) + : node; } ts.updateLabel = updateLabel; - function createThrow(expression, location) { - var node = createNode(220 /* ThrowStatement */, location); + function createThrow(expression) { + var node = createSynthesizedNode(222 /* ThrowStatement */); node.expression = expression; return node; } ts.createThrow = createThrow; function updateThrow(node, expression) { - if (node.expression !== expression) { - return updateNode(createThrow(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createThrow(expression), node) + : node; } ts.updateThrow = updateThrow; - function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221 /* TryStatement */, location); + function createTry(tryBlock, catchClause, finallyBlock) { + var node = createSynthesizedNode(223 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11644,195 +12207,286 @@ var ts; } ts.createTry = createTry; function updateTry(node, tryBlock, catchClause, finallyBlock) { - if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) { - return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node); - } - return node; + return node.tryBlock !== tryBlock + || node.catchClause !== catchClause + || node.finallyBlock !== finallyBlock + ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) + : node; } ts.updateTry = updateTry; - function createCaseBlock(clauses, location) { - var node = createNode(232 /* CaseBlock */, location); - node.clauses = createNodeArray(clauses); - return node; - } - ts.createCaseBlock = createCaseBlock; - function updateCaseBlock(node, clauses) { - if (node.clauses !== clauses) { - return updateNode(createCaseBlock(clauses, node), node); - } - return node; - } - ts.updateCaseBlock = updateCaseBlock; - function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225 /* FunctionDeclaration */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(227 /* FunctionDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionDeclaration = createFunctionDeclaration; - function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionDeclaration = updateFunctionDeclaration; - function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226 /* ClassDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(228 /* ClassDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassDeclaration = createClassDeclaration; function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassDeclaration = updateClassDeclaration; - function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235 /* ImportDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createEnumDeclaration(decorators, modifiers, name, members) { + var node = createSynthesizedNode(231 /* EnumDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.members = createNodeArray(members); + return node; + } + ts.createEnumDeclaration = createEnumDeclaration; + function updateEnumDeclaration(node, decorators, modifiers, name, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.members !== members + ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) + : node; + } + ts.updateEnumDeclaration = updateEnumDeclaration; + function createModuleDeclaration(decorators, modifiers, name, body, flags) { + var node = createSynthesizedNode(232 /* ModuleDeclaration */); + node.flags |= flags; + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = name; + node.body = body; + return node; + } + ts.createModuleDeclaration = createModuleDeclaration; + function updateModuleDeclaration(node, decorators, modifiers, name, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.body !== body + ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) + : node; + } + ts.updateModuleDeclaration = updateModuleDeclaration; + function createModuleBlock(statements) { + var node = createSynthesizedNode(233 /* ModuleBlock */); + node.statements = createNodeArray(statements); + return node; + } + ts.createModuleBlock = createModuleBlock; + function updateModuleBlock(node, statements) { + return node.statements !== statements + ? updateNode(createModuleBlock(statements), node) + : node; + } + ts.updateModuleBlock = updateModuleBlock; + function createCaseBlock(clauses) { + var node = createSynthesizedNode(234 /* CaseBlock */); + node.clauses = createNodeArray(clauses); + return node; + } + ts.createCaseBlock = createCaseBlock; + function updateCaseBlock(node, clauses) { + return node.clauses !== clauses + ? updateNode(createCaseBlock(clauses), node) + : node; + } + ts.updateCaseBlock = updateCaseBlock; + function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { + var node = createSynthesizedNode(236 /* ImportEqualsDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.moduleReference = moduleReference; + return node; + } + ts.createImportEqualsDeclaration = createImportEqualsDeclaration; + function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.moduleReference !== moduleReference + ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) + : node; + } + ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; + function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { + var node = createSynthesizedNode(237 /* ImportDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createImportDeclaration = createImportDeclaration; function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) + : node; } ts.updateImportDeclaration = updateImportDeclaration; - function createImportClause(name, namedBindings, location) { - var node = createNode(236 /* ImportClause */, location); + function createImportClause(name, namedBindings) { + var node = createSynthesizedNode(238 /* ImportClause */); node.name = name; node.namedBindings = namedBindings; return node; } ts.createImportClause = createImportClause; function updateImportClause(node, name, namedBindings) { - if (node.name !== name || node.namedBindings !== namedBindings) { - return updateNode(createImportClause(name, namedBindings, node), node); - } - return node; + return node.name !== name + || node.namedBindings !== namedBindings + ? updateNode(createImportClause(name, namedBindings), node) + : node; } ts.updateImportClause = updateImportClause; - function createNamespaceImport(name, location) { - var node = createNode(237 /* NamespaceImport */, location); + function createNamespaceImport(name) { + var node = createSynthesizedNode(239 /* NamespaceImport */); node.name = name; return node; } ts.createNamespaceImport = createNamespaceImport; function updateNamespaceImport(node, name) { - if (node.name !== name) { - return updateNode(createNamespaceImport(name, node), node); - } - return node; + return node.name !== name + ? updateNode(createNamespaceImport(name), node) + : node; } ts.updateNamespaceImport = updateNamespaceImport; - function createNamedImports(elements, location) { - var node = createNode(238 /* NamedImports */, location); + function createNamedImports(elements) { + var node = createSynthesizedNode(240 /* NamedImports */); node.elements = createNodeArray(elements); return node; } ts.createNamedImports = createNamedImports; function updateNamedImports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedImports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedImports(elements), node) + : node; } ts.updateNamedImports = updateNamedImports; - function createImportSpecifier(propertyName, name, location) { - var node = createNode(239 /* ImportSpecifier */, location); + function createImportSpecifier(propertyName, name) { + var node = createSynthesizedNode(241 /* ImportSpecifier */); node.propertyName = propertyName; node.name = name; return node; } ts.createImportSpecifier = createImportSpecifier; function updateImportSpecifier(node, propertyName, name) { - if (node.propertyName !== propertyName || node.name !== name) { - return updateNode(createImportSpecifier(propertyName, name, node), node); - } - return node; + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createImportSpecifier(propertyName, name), node) + : node; } ts.updateImportSpecifier = updateImportSpecifier; - function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240 /* ExportAssignment */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportAssignment(decorators, modifiers, isExportEquals, expression) { + var node = createSynthesizedNode(242 /* ExportAssignment */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = expression; return node; } ts.createExportAssignment = createExportAssignment; function updateExportAssignment(node, decorators, modifiers, expression) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) { - return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.expression !== expression + ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) + : node; } ts.updateExportAssignment = updateExportAssignment; - function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241 /* ExportDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { + var node = createSynthesizedNode(243 /* ExportDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createExportDeclaration = createExportDeclaration; function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.exportClause !== exportClause + || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) + : node; } ts.updateExportDeclaration = updateExportDeclaration; - function createNamedExports(elements, location) { - var node = createNode(242 /* NamedExports */, location); + function createNamedExports(elements) { + var node = createSynthesizedNode(244 /* NamedExports */); node.elements = createNodeArray(elements); return node; } ts.createNamedExports = createNamedExports; function updateNamedExports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedExports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedExports(elements), node) + : node; } ts.updateNamedExports = updateNamedExports; - function createExportSpecifier(name, propertyName, location) { - var node = createNode(243 /* ExportSpecifier */, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createExportSpecifier(propertyName, name) { + var node = createSynthesizedNode(245 /* ExportSpecifier */); + node.propertyName = asName(propertyName); + node.name = asName(name); return node; } ts.createExportSpecifier = createExportSpecifier; - function updateExportSpecifier(node, name, propertyName) { - if (node.name !== name || node.propertyName !== propertyName) { - return updateNode(createExportSpecifier(name, propertyName, node), node); - } - return node; + function updateExportSpecifier(node, propertyName, name) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createExportSpecifier(propertyName, name), node) + : node; } ts.updateExportSpecifier = updateExportSpecifier; + // Module references + function createExternalModuleReference(expression) { + var node = createSynthesizedNode(247 /* ExternalModuleReference */); + node.expression = expression; + return node; + } + ts.createExternalModuleReference = createExternalModuleReference; + function updateExternalModuleReference(node, expression) { + return node.expression !== expression + ? updateNode(createExternalModuleReference(expression), node) + : node; + } + ts.updateExternalModuleReference = updateExternalModuleReference; // JSX - function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246 /* JsxElement */, location); + function createJsxElement(openingElement, children, closingElement) { + var node = createSynthesizedNode(248 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11840,96 +12494,108 @@ var ts; } ts.createJsxElement = createJsxElement; function updateJsxElement(node, openingElement, children, closingElement) { - if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) { - return updateNode(createJsxElement(openingElement, children, closingElement, node), node); - } - return node; + return node.openingElement !== openingElement + || node.children !== children + || node.closingElement !== closingElement + ? updateNode(createJsxElement(openingElement, children, closingElement), node) + : node; } ts.updateJsxElement = updateJsxElement; - function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247 /* JsxSelfClosingElement */, location); + function createJsxSelfClosingElement(tagName, attributes) { + var node = createSynthesizedNode(249 /* JsxSelfClosingElement */); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxSelfClosingElement = createJsxSelfClosingElement; function updateJsxSelfClosingElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxSelfClosingElement(tagName, attributes), node) + : node; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; - function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248 /* JsxOpeningElement */, location); + function createJsxOpeningElement(tagName, attributes) { + var node = createSynthesizedNode(250 /* JsxOpeningElement */); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxOpeningElement = createJsxOpeningElement; function updateJsxOpeningElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxOpeningElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxOpeningElement(tagName, attributes), node) + : node; } ts.updateJsxOpeningElement = updateJsxOpeningElement; - function createJsxClosingElement(tagName, location) { - var node = createNode(249 /* JsxClosingElement */, location); + function createJsxClosingElement(tagName) { + var node = createSynthesizedNode(251 /* JsxClosingElement */); node.tagName = tagName; return node; } ts.createJsxClosingElement = createJsxClosingElement; function updateJsxClosingElement(node, tagName) { - if (node.tagName !== tagName) { - return updateNode(createJsxClosingElement(tagName, node), node); - } - return node; + return node.tagName !== tagName + ? updateNode(createJsxClosingElement(tagName), node) + : node; } ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer, location) { - var node = createNode(250 /* JsxAttribute */, location); + function createJsxAttributes(properties) { + var jsxAttributes = createSynthesizedNode(253 /* JsxAttributes */); + jsxAttributes.properties = createNodeArray(properties); + return jsxAttributes; + } + ts.createJsxAttributes = createJsxAttributes; + function updateJsxAttributes(jsxAttributes, properties) { + if (jsxAttributes.properties !== properties) { + return updateNode(createJsxAttributes(properties), jsxAttributes); + } + return jsxAttributes; + } + ts.updateJsxAttributes = updateJsxAttributes; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(252 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; } ts.createJsxAttribute = createJsxAttribute; function updateJsxAttribute(node, name, initializer) { - if (node.name !== name || node.initializer !== initializer) { - return updateNode(createJsxAttribute(name, initializer, node), node); - } - return node; + return node.name !== name + || node.initializer !== initializer + ? updateNode(createJsxAttribute(name, initializer), node) + : node; } ts.updateJsxAttribute = updateJsxAttribute; - function createJsxSpreadAttribute(expression, location) { - var node = createNode(251 /* JsxSpreadAttribute */, location); + function createJsxSpreadAttribute(expression) { + var node = createSynthesizedNode(254 /* JsxSpreadAttribute */); node.expression = expression; return node; } ts.createJsxSpreadAttribute = createJsxSpreadAttribute; function updateJsxSpreadAttribute(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxSpreadAttribute(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxSpreadAttribute(expression), node) + : node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252 /* JsxExpression */, location); + function createJsxExpression(dotDotDotToken, expression) { + var node = createSynthesizedNode(255 /* JsxExpression */); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) + : node; } ts.updateJsxExpression = updateJsxExpression; // Clauses - function createHeritageClause(token, types, location) { - var node = createNode(255 /* HeritageClause */, location); + function createHeritageClause(token, types) { + var node = createSynthesizedNode(258 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -11937,40 +12603,40 @@ var ts; ts.createHeritageClause = createHeritageClause; function updateHeritageClause(node, types) { if (node.types !== types) { - return updateNode(createHeritageClause(node.token, types, node), node); + return updateNode(createHeritageClause(node.token, types), node); } return node; } ts.updateHeritageClause = updateHeritageClause; - function createCaseClause(expression, statements, location) { - var node = createNode(253 /* CaseClause */, location); - node.expression = parenthesizeExpressionForList(expression); + function createCaseClause(expression, statements) { + var node = createSynthesizedNode(256 /* CaseClause */); + node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; } ts.createCaseClause = createCaseClause; function updateCaseClause(node, expression, statements) { if (node.expression !== expression || node.statements !== statements) { - return updateNode(createCaseClause(expression, statements, node), node); + return updateNode(createCaseClause(expression, statements), node); } return node; } ts.updateCaseClause = updateCaseClause; - function createDefaultClause(statements, location) { - var node = createNode(254 /* DefaultClause */, location); + function createDefaultClause(statements) { + var node = createSynthesizedNode(257 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } ts.createDefaultClause = createDefaultClause; function updateDefaultClause(node, statements) { if (node.statements !== statements) { - return updateNode(createDefaultClause(statements, node), node); + return updateNode(createDefaultClause(statements), node); } return node; } ts.updateDefaultClause = updateDefaultClause; - function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256 /* CatchClause */, location); + function createCatchClause(variableDeclaration, block) { + var node = createSynthesizedNode(259 /* CatchClause */); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11978,58 +12644,74 @@ var ts; ts.createCatchClause = createCatchClause; function updateCatchClause(node, variableDeclaration, block) { if (node.variableDeclaration !== variableDeclaration || node.block !== block) { - return updateNode(createCatchClause(variableDeclaration, block, node), node); + return updateNode(createCatchClause(variableDeclaration, block), node); } return node; } ts.updateCatchClause = updateCatchClause; // Property assignments - function createPropertyAssignment(name, initializer, location) { - var node = createNode(257 /* PropertyAssignment */, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAssignment(name, initializer) { + var node = createSynthesizedNode(260 /* PropertyAssignment */); + node.name = asName(name); node.questionToken = undefined; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createPropertyAssignment = createPropertyAssignment; function updatePropertyAssignment(node, name, initializer) { if (node.name !== name || node.initializer !== initializer) { - return updateNode(createPropertyAssignment(name, initializer, node), node); + return updateNode(createPropertyAssignment(name, initializer), node); } return node; } ts.updatePropertyAssignment = updatePropertyAssignment; - function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258 /* ShorthandPropertyAssignment */, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; + function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { + var node = createSynthesizedNode(261 /* ShorthandPropertyAssignment */); + node.name = asName(name); + node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; - function createSpreadAssignment(expression, location) { - var node = createNode(259 /* SpreadAssignment */, location); - node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; - return node; - } - ts.createSpreadAssignment = createSpreadAssignment; function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) { - return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node); + return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node); } return node; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; + function createSpreadAssignment(expression) { + var node = createSynthesizedNode(262 /* SpreadAssignment */); + node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; + return node; + } + ts.createSpreadAssignment = createSpreadAssignment; function updateSpreadAssignment(node, expression) { if (node.expression !== expression) { - return updateNode(createSpreadAssignment(expression, node), node); + return updateNode(createSpreadAssignment(expression), node); } return node; } ts.updateSpreadAssignment = updateSpreadAssignment; + // Enum + function createEnumMember(name, initializer) { + var node = createSynthesizedNode(263 /* EnumMember */); + node.name = asName(name); + node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); + return node; + } + ts.createEnumMember = createEnumMember; + function updateEnumMember(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createEnumMember(name, initializer), node) + : node; + } + ts.updateEnumMember = updateEnumMember; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261 /* SourceFile */, /*location*/ node, node.flags); + var updated = createSynthesizedNode(264 /* SourceFile */); + updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -12088,6 +12770,17 @@ var ts; return node; } ts.updateSourceFileNode = updateSourceFileNode; + /** + * Creates a shallow, memberwise clone of a node for mutation. + */ + function getMutableClone(node) { + var clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + clone.parent = node.parent; + return clone; + } + ts.getMutableClone = getMutableClone; // Transformation nodes /** * Creates a synthetic statement to act as a placeholder for a not-emitted statement in @@ -12096,8 +12789,9 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(293 /* NotEmittedStatement */, /*location*/ original); + var node = createSynthesizedNode(294 /* NotEmittedStatement */); node.original = original; + setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; @@ -12105,8 +12799,9 @@ var ts; * Creates a synthetic element to act as a placeholder for the end of an emitted declaration in * order to properly emit exports. */ + /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createNode(296 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(297 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12116,8 +12811,9 @@ var ts; * Creates a synthetic element to act as a placeholder for the beginning of a merged declaration in * order to properly emit exports. */ + /* @internal */ function createMergeDeclarationMarker(original) { - var node = createNode(295 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(296 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12131,44 +12827,45 @@ var ts; * @param original The original outer expression. * @param location The location for the expression. Defaults to the positions from "original" if provided. */ - function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original); + function createPartiallyEmittedExpression(expression, original) { + var node = createSynthesizedNode(295 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; + setTextRange(node, original); return node; } ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; function updatePartiallyEmittedExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node); + return updateNode(createPartiallyEmittedExpression(expression, node.original), node); } return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - /** - * Creates a node that emits a string of raw text in an expression position. Raw text is never - * transformed, should be ES3 compliant, and should have the same precedence as - * PrimaryExpression. - * - * @param text The raw text of the node. - */ - function createRawExpression(text) { - var node = createNode(297 /* RawExpression */); - node.text = text; + function createBundle(sourceFiles) { + var node = ts.createNode(265 /* Bundle */); + node.sourceFiles = sourceFiles; return node; } - ts.createRawExpression = createRawExpression; + ts.createBundle = createBundle; + function updateBundle(node, sourceFiles) { + if (node.sourceFiles !== sourceFiles) { + return createBundle(sourceFiles); + } + return node; + } + ts.updateBundle = updateBundle; // Compound nodes function createComma(left, right) { return createBinary(left, 25 /* CommaToken */, right); } ts.createComma = createComma; - function createLessThan(left, right, location) { - return createBinary(left, 26 /* LessThanToken */, right, location); + function createLessThan(left, right) { + return createBinary(left, 26 /* LessThanToken */, right); } ts.createLessThan = createLessThan; - function createAssignment(left, right, location) { - return createBinary(left, 57 /* EqualsToken */, right, location); + function createAssignment(left, right) { + return createBinary(left, 57 /* EqualsToken */, right); } ts.createAssignment = createAssignment; function createStrictEquality(left, right) { @@ -12187,8 +12884,8 @@ var ts; return createBinary(left, 37 /* MinusToken */, right); } ts.createSubtract = createSubtract; - function createPostfixIncrement(operand, location) { - return createPostfix(operand, 42 /* PlusPlusToken */, location); + function createPostfixIncrement(operand) { + return createPostfix(operand, 42 /* PlusPlusToken */); } ts.createPostfixIncrement = createPostfixIncrement; function createLogicalAnd(left, right) { @@ -12207,61 +12904,378 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createExportDefault(expression) { + return createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportEquals*/ false, expression); + } + ts.createExportDefault = createExportDefault; + function createExternalModuleExport(exportName) { + return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(/*propertyName*/ undefined, exportName)])); + } + ts.createExternalModuleExport = createExternalModuleExport; + function asName(name) { + return typeof name === "string" ? createIdentifier(name) : name; + } + function asExpression(value) { + return typeof value === "string" || typeof value === "number" ? createLiteral(value) : value; + } + function asNodeArray(array) { + return array ? createNodeArray(array) : undefined; + } + function asToken(value) { + return typeof value === "number" ? createToken(value) : value; + } + /** + * Clears any EmitNode entries from parse-tree nodes. + * @param sourceFile A source file. + */ + function disposeEmitNodes(sourceFile) { + // During transformation we may need to annotate a parse tree node with transient + // transformation properties. As parse tree nodes live longer than transformation + // nodes, we need to make sure we reclaim any memory allocated for custom ranges + // from these nodes to ensure we do not hold onto entire subtrees just for position + // information. We also need to reset these nodes to a pre-transformation state + // for incremental parsing scenarios so that we do not impact later emit. + sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); + var emitNode = sourceFile && sourceFile.emitNode; + var annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = undefined; + } + } + } + ts.disposeEmitNodes = disposeEmitNodes; + /** + * Associates a node with the current transformation, initializing + * various transient transformation properties. + */ + /* @internal */ + function getOrCreateEmitNode(node) { + if (!node.emitNode) { + if (ts.isParseTreeNode(node)) { + // To avoid holding onto transformation artifacts, we keep track of any + // parse tree node we are annotating. This allows us to clean them up after + // all transformations have completed. + if (node.kind === 264 /* SourceFile */) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = ts.getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } + return node.emitNode; + } + ts.getOrCreateEmitNode = getOrCreateEmitNode; + function setTextRange(range, location) { + if (location) { + range.pos = location.pos; + range.end = location.end; + } + return range; + } + ts.setTextRange = setTextRange; + /** + * Gets flags that control emit behavior of a node. + */ + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + ts.getEmitFlags = getEmitFlags; + /** + * Sets flags that control emit behavior of a node. + */ + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + ts.setEmitFlags = setEmitFlags; + /** + * Gets a custom text range to use when emitting source maps. + */ + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; + /** + * Sets a custom text range to use when emitting source maps. + */ + function setSourceMapRange(node, range) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + ts.setSourceMapRange = setSourceMapRange; + /** + * Gets the TextRange to use for source maps for a token of a node. + */ + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; + /** + * Sets the TextRange to use for source maps for a token of a node. + */ + function setTokenSourceMapRange(node, token, range) { + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); + tokenSourceMapRanges[token] = range; + return node; + } + ts.setTokenSourceMapRange = setTokenSourceMapRange; + /** + * Gets a custom text range to use when emitting comments. + */ + function getCommentRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + ts.getCommentRange = getCommentRange; + /** + * Sets a custom text range to use when emitting comments. + */ + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + ts.setCommentRange = setCommentRange; + function getSyntheticLeadingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.leadingComments; + } + ts.getSyntheticLeadingComments = getSyntheticLeadingComments; + function setSyntheticLeadingComments(node, comments) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + ts.setSyntheticLeadingComments = setSyntheticLeadingComments; + function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticLeadingComment = addSyntheticLeadingComment; + function getSyntheticTrailingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.trailingComments; + } + ts.getSyntheticTrailingComments = getSyntheticTrailingComments; + function setSyntheticTrailingComments(node, comments) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + ts.setSyntheticTrailingComments = setSyntheticTrailingComments; + function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticTrailingComment = addSyntheticTrailingComment; + /** + * Gets the constant value to emit for an expression. + */ + function getConstantValue(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + ts.getConstantValue = getConstantValue; + /** + * Sets the constant value to emit for an expression. + */ + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + ts.setConstantValue = setConstantValue; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + /** + * Add EmitHelpers to a node. + */ + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + /** + * Removes an EmitHelper from a node. + */ + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + /** + * Gets the EmitHelpers of a node. + */ + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + /** + * Moves matching emit helpers from a source node to a target node. + */ + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + /* @internal */ + function compareEmitHelpers(x, y) { + if (x === y) + return 0 /* EqualTo */; + if (x.priority === y.priority) + return 0 /* EqualTo */; + if (x.priority === undefined) + return 1 /* GreaterThan */; + if (y.priority === undefined) + return -1 /* LessThan */; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) + destEmitNode = {}; + if (leadingComments) + destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) + destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments); + if (flags) + destEmitNode.flags = flags; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) + destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); + return destEmitNode; + } + function mergeTokenSourceMapRanges(sourceRanges, destRanges) { + if (!destRanges) + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } + return destRanges; + } +})(ts || (ts = {})); +/* @internal */ +(function (ts) { + // Compound nodes function createTypeCheck(value, tag) { return tag === "undefined" - ? createStrictEquality(value, createVoidZero()) - : createStrictEquality(createTypeOf(value), createLiteral(tag)); + ? ts.createStrictEquality(value, ts.createVoidZero()) + : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)); } ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { - return createElementAccess(target, memberName.expression, location); + return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); } else { - var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 64 /* NoNestedSourceMaps */; + var expression = ts.setTextRange(ts.isIdentifier(memberName) + ? ts.createPropertyAccess(target, memberName) + : ts.createElementAccess(target, memberName), memberName); + ts.getOrCreateEmitNode(expression).flags |= 64 /* NoNestedSourceMaps */; return expression; } } ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; function createFunctionCall(func, thisArg, argumentsList, location) { - return createCall(createPropertyAccess(func, "call"), + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), /*typeArguments*/ undefined, [ thisArg - ].concat(argumentsList), location); + ].concat(argumentsList)), location); } ts.createFunctionCall = createFunctionCall; function createFunctionApply(func, thisArg, argumentsExpression, location) { - return createCall(createPropertyAccess(func, "apply"), + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), /*typeArguments*/ undefined, [ thisArg, argumentsExpression - ], location); + ]), location); } ts.createFunctionApply = createFunctionApply; function createArraySlice(array, start) { var argumentsList = []; if (start !== undefined) { - argumentsList.push(typeof start === "number" ? createLiteral(start) : start); + argumentsList.push(typeof start === "number" ? ts.createLiteral(start) : start); } - return createCall(createPropertyAccess(array, "slice"), /*typeArguments*/ undefined, argumentsList); + return ts.createCall(ts.createPropertyAccess(array, "slice"), /*typeArguments*/ undefined, argumentsList); } ts.createArraySlice = createArraySlice; function createArrayConcat(array, values) { - return createCall(createPropertyAccess(array, "concat"), + return ts.createCall(ts.createPropertyAccess(array, "concat"), /*typeArguments*/ undefined, values); } ts.createArrayConcat = createArrayConcat; function createMathPow(left, right, location) { - return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), - /*typeArguments*/ undefined, [left, right], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), + /*typeArguments*/ undefined, [left, right]), location); } ts.createMathPow = createMathPow; function createReactNamespace(reactNamespace, parent) { // To ensure the emit resolver can properly resolve the namespace, we need to // treat this identifier as if it were a source tree node by clearing the `Synthesized` // flag and setting a parent node. - var react = createIdentifier(reactNamespace || "React"); + var react = ts.createIdentifier(reactNamespace || "React"); react.flags &= ~8 /* Synthesized */; // Set the parent that is in parse tree // this makes sure that parent chain is intact for checker to traverse complete scope tree @@ -12271,9 +13285,9 @@ var ts; function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); - var right = createSynthesizedNode(70 /* Identifier */); + var right = ts.createIdentifier(jsxFactory.right.text); right.text = jsxFactory.right.text; - return createPropertyAccess(left, right); + return ts.createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12282,7 +13296,7 @@ var ts; function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : - createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); } function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { var argumentsList = [tagName]; @@ -12291,7 +13305,7 @@ var ts; } if (children && children.length > 0) { if (!props) { - argumentsList.push(createNull()); + argumentsList.push(ts.createNull()); } if (children.length > 1) { for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { @@ -12304,35 +13318,89 @@ var ts; argumentsList.push(children[0]); } } - return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), - /*typeArguments*/ undefined, argumentsList, location); + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), + /*typeArguments*/ undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; - function createExportDefault(expression) { - return createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportEquals*/ false, expression); - } - ts.createExportDefault = createExportDefault; - function createExternalModuleExport(exportName) { - return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(exportName)])); - } - ts.createExternalModuleExport = createExternalModuleExport; - function createLetStatement(name, initializer, location) { - return createVariableStatement(/*modifiers*/ undefined, createLetDeclarationList([createVariableDeclaration(name, /*type*/ undefined, initializer)]), location); - } - ts.createLetStatement = createLetStatement; - function createLetDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 1 /* Let */); - } - ts.createLetDeclarationList = createLetDeclarationList; - function createConstDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 2 /* Const */); - } - ts.createConstDeclarationList = createConstDeclarationList; // Helpers function getHelperName(name) { - return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); + return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); } ts.getHelperName = getHelperName; + var valuesHelper = { + name: "typescript:values", + scoped: false, + text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n " + }; + function createValuesHelper(context, expression, location) { + context.requestEmitHelper(valuesHelper); + return ts.setTextRange(ts.createCall(getHelperName("__values"), + /*typeArguments*/ undefined, [expression]), location); + } + ts.createValuesHelper = createValuesHelper; + var readHelper = { + name: "typescript:read", + scoped: false, + text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n " + }; + function createReadHelper(context, iteratorRecord, count, location) { + context.requestEmitHelper(readHelper); + return ts.setTextRange(ts.createCall(getHelperName("__read"), + /*typeArguments*/ undefined, count !== undefined + ? [iteratorRecord, ts.createLiteral(count)] + : [iteratorRecord]), location); + } + ts.createReadHelper = createReadHelper; + var spreadHelper = { + name: "typescript:spread", + scoped: false, + text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" + }; + function createSpreadHelper(context, argumentList, location) { + context.requestEmitHelper(readHelper); + context.requestEmitHelper(spreadHelper); + return ts.setTextRange(ts.createCall(getHelperName("__spread"), + /*typeArguments*/ undefined, argumentList), location); + } + ts.createSpreadHelper = createSpreadHelper; + // Utilities + function createForOfBindingStatement(node, boundValue) { + if (ts.isVariableDeclarationList(node)) { + var firstDeclaration = ts.firstOrUndefined(node.declarations); + var updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, + /*typeNode*/ undefined, boundValue); + return ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.updateVariableDeclarationList(node, [updatedDeclaration])), + /*location*/ node); + } + else { + var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), /*location*/ node); + return ts.setTextRange(ts.createStatement(updatedExpression), /*location*/ node); + } + } + ts.createForOfBindingStatement = createForOfBindingStatement; + function insertLeadingStatement(dest, source) { + if (ts.isBlock(dest)) { + return ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)); + } + else { + return ts.createBlock(ts.createNodeArray([dest, source]), /*multiLine*/ true); + } + } + ts.insertLeadingStatement = insertLeadingStatement; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 /* LabeledStatement */ + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12342,13 +13410,13 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return false; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -12359,22 +13427,27 @@ var ts; var thisArg; var target; if (ts.isSuperProperty(callee)) { - thisArg = createThis(); + thisArg = ts.createThis(); target = callee; } else if (callee.kind === 96 /* SuperKeyword */) { - thisArg = createThis(); - target = languageVersion < 2 /* ES2015 */ ? createIdentifier("_super", /*location*/ callee) : callee; + thisArg = ts.createThis(); + target = languageVersion < 2 /* ES2015 */ + ? ts.setTextRange(ts.createIdentifier("_super"), callee) + : callee; + } + else if (ts.getEmitFlags(callee) & 4096 /* HelperName */) { + thisArg = ts.createVoidZero(); + target = parenthesizeForAccess(callee); } else { switch (callee.kind) { - case 177 /* PropertyAccessExpression */: { + case 178 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` - thisArg = createTempVariable(recordTempVariable); - target = createPropertyAccess(createAssignment(thisArg, callee.expression, - /*location*/ callee.expression), callee.name, - /*location*/ callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12382,13 +13455,12 @@ var ts; } break; } - case 178 /* ElementAccessExpression */: { + case 179 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` - thisArg = createTempVariable(recordTempVariable); - target = createElementAccess(createAssignment(thisArg, callee.expression, - /*location*/ callee.expression), callee.argumentExpression, - /*location*/ callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12398,7 +13470,7 @@ var ts; } default: { // for `a()` target is `a` and thisArg is `void 0` - thisArg = createVoidZero(); + thisArg = ts.createVoidZero(); target = parenthesizeForAccess(expression); break; } @@ -12408,42 +13480,42 @@ var ts; } ts.createCallBinding = createCallBinding; function inlineExpressions(expressions) { - return ts.reduceLeft(expressions, createComma); + return ts.reduceLeft(expressions, ts.createComma); } ts.inlineExpressions = inlineExpressions; function createExpressionFromEntityName(node) { if (ts.isQualifiedName(node)) { var left = createExpressionFromEntityName(node.left); - var right = getMutableClone(node.right); - return createPropertyAccess(left, right, /*location*/ node); + var right = ts.getMutableClone(node.right); + return ts.setTextRange(ts.createPropertyAccess(left, right), node); } else { - return getMutableClone(node); + return ts.getMutableClone(node); } } ts.createExpressionFromEntityName = createExpressionFromEntityName; function createExpressionForPropertyName(memberName) { if (ts.isIdentifier(memberName)) { - return createLiteral(memberName, /*location*/ undefined); + return ts.createLiteral(memberName); } else if (ts.isComputedPropertyName(memberName)) { - return getMutableClone(memberName.expression); + return ts.getMutableClone(memberName.expression); } else { - return getMutableClone(memberName); + return ts.getMutableClone(memberName); } } ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12453,57 +13525,55 @@ var ts; if (property === firstAccessor) { var properties_1 = []; if (getAccessor) { - var getterFunction = createFunctionExpression(getAccessor.modifiers, + var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, /*asteriskToken*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, getAccessor.parameters, - /*type*/ undefined, getAccessor.body, - /*location*/ getAccessor); - setOriginalNode(getterFunction, getAccessor); - var getter = createPropertyAssignment("get", getterFunction); + /*type*/ undefined, getAccessor.body); + ts.setTextRange(getterFunction, getAccessor); + ts.setOriginalNode(getterFunction, getAccessor); + var getter = ts.createPropertyAssignment("get", getterFunction); properties_1.push(getter); } if (setAccessor) { - var setterFunction = createFunctionExpression(setAccessor.modifiers, + var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, /*asteriskToken*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, setAccessor.parameters, - /*type*/ undefined, setAccessor.body, - /*location*/ setAccessor); - setOriginalNode(setterFunction, setAccessor); - var setter = createPropertyAssignment("set", setterFunction); + /*type*/ undefined, setAccessor.body); + ts.setTextRange(setterFunction, setAccessor); + ts.setOriginalNode(setterFunction, setAccessor); + var setter = ts.createPropertyAssignment("set", setterFunction); properties_1.push(setter); } - properties_1.push(createPropertyAssignment("enumerable", createLiteral(true))); - properties_1.push(createPropertyAssignment("configurable", createLiteral(true))); - var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), + properties_1.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); + properties_1.push(ts.createPropertyAssignment("configurable", ts.createTrue())); + var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), /*typeArguments*/ undefined, [ receiver, createExpressionForPropertyName(property.name), - createObjectLiteral(properties_1, /*location*/ undefined, multiLine) - ], + ts.createObjectLiteral(properties_1, multiLine) + ]), /*location*/ firstAccessor); return ts.aggregateTransformFlags(expression); } return undefined; } function createExpressionForPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), property.initializer, - /*location*/ property), - /*original*/ property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), property.initializer), property), property)); } function createExpressionForShorthandPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), getSynthesizedClone(property.name), + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), ts.getSynthesizedClone(property.name)), /*location*/ property), /*original*/ property)); } function createExpressionForMethodDeclaration(method, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, /*location*/ method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, /*location*/ method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, /*name*/ undefined, /*typeParameters*/ undefined, method.parameters, - /*type*/ undefined, method.body, + /*type*/ undefined, method.body), /*location*/ method), - /*original*/ method), + /*original*/ method)), /*location*/ method), /*original*/ method)); } @@ -12525,7 +13595,7 @@ var ts; * Gets whether an identifier should only be referred to by its local name. */ function isLocalName(node) { - return (getEmitFlags(node) & 16384 /* LocalName */) !== 0; + return (ts.getEmitFlags(node) & 16384 /* LocalName */) !== 0; } ts.isLocalName = isLocalName; /** @@ -12547,7 +13617,7 @@ var ts; * name points to an exported symbol. */ function isExportName(node) { - return (getEmitFlags(node) & 8192 /* ExportName */) !== 0; + return (ts.getEmitFlags(node) & 8192 /* ExportName */) !== 0; } ts.isExportName = isExportName; /** @@ -12563,17 +13633,17 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_8 = getMutableClone(node.name); - emitFlags |= getEmitFlags(node.name); + var name = ts.getMutableClone(node.name); + emitFlags |= ts.getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48 /* NoSourceMap */; if (!allowComments) emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(name_8, emitFlags); - return name_8; + ts.setEmitFlags(name, emitFlags); + return name; } - return getGeneratedNameForNode(node); + return ts.getGeneratedNameForNode(node); } /** * Gets the exported name of a declaration for use in expressions. @@ -12602,19 +13672,20 @@ var ts; * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { - var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name); + var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); + ts.setTextRange(qualifiedName, name); var emitFlags; if (!allowSourceMaps) emitFlags |= 48 /* NoSourceMap */; if (!allowComments) emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(qualifiedName, emitFlags); + ts.setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; function convertToFunctionBody(node, multiLine) { - return ts.isBlock(node) ? node : createBlock([createReturn(node, /*location*/ node)], /*location*/ node, multiLine); + return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node); } ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { @@ -12631,7 +13702,18 @@ var ts; * @param ensureUseStrict: boolean determining whether the function need to add prologue-directives * @param visitor: Optional callback used to visit any custom prologue directives. */ - function addPrologueDirectives(target, source, ensureUseStrict, visitor) { + function addPrologue(target, source, ensureUseStrict, visitor) { + var offset = addStandardPrologue(target, source, ensureUseStrict); + return addCustomPrologue(target, source, offset, visitor); + } + ts.addPrologue = addPrologue; + /** + * Add just the standard (string-expression) prologue-directives into target statement-array. + * The function needs to be called during each transformation step. + * This function needs to be called whenever we transform the statement + * list of a source file, namespace, or function-like body. + */ + function addStandardPrologue(target, source, ensureUseStrict) { ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); var foundUseStrict = false; var statementOffset = 0; @@ -12650,11 +13732,22 @@ var ts; statementOffset++; } if (ensureUseStrict && !foundUseStrict) { - target.push(startOnNewLine(createStatement(createLiteral("use strict")))); + target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))); } + return statementOffset; + } + ts.addStandardPrologue = addStandardPrologue; + /** + * Add just the custom prologue-directives into target statement-array. + * The function needs to be called during each transformation step. + * This function needs to be called whenever we transform the statement + * list of a source file, namespace, or function-like body. + */ + function addCustomPrologue(target, source, statementOffset, visitor) { + var numStatements = source.length; while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 524288 /* CustomPrologue */) { + if (ts.getEmitFlags(statement) & 524288 /* CustomPrologue */) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12664,7 +13757,7 @@ var ts; } return statementOffset; } - ts.addPrologueDirectives = addPrologueDirectives; + ts.addCustomPrologue = addCustomPrologue; function startsWithUseStrict(statements) { var firstStatement = ts.firstOrUndefined(statements); return firstStatement !== undefined @@ -12692,13 +13785,23 @@ var ts; } } if (!foundUseStrict) { - return createNodeArray([ - startOnNewLine(createStatement(createLiteral("use strict"))) - ].concat(statements), statements); + return ts.setTextRange(ts.createNodeArray([ + startOnNewLine(ts.createStatement(ts.createLiteral("use strict"))) + ].concat(statements)), statements); } return statements; } ts.ensureUseStrict = ensureUseStrict; + function parenthesizeConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(194 /* ConditionalExpression */, 54 /* QuestionToken */); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { + return ts.createParen(condition); + } + return condition; + } + ts.parenthesizeConditionalHead = parenthesizeConditionalHead; /** * Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended * order of operations. @@ -12711,11 +13814,11 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 183 /* ParenthesizedExpression */) { + if (skipped.kind === 184 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) - ? createParen(operand) + ? ts.createParen(operand) : operand; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; @@ -12745,8 +13848,8 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193 /* BinaryExpression */, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { @@ -12755,7 +13858,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 195 /* YieldExpression */) { + && operand.kind === 196 /* YieldExpression */) { return false; } return true; @@ -12843,7 +13946,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12858,11 +13961,11 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(194 /* ConditionalExpression */, 54 /* QuestionToken */); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { - return createParen(condition); + return ts.createParen(condition); } return condition; } @@ -12871,10 +13974,11 @@ var ts; // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions // so in case when comma expression is introduced as a part of previous transformations // if should be wrapped in parens since comma operator has the lowest precedence - return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ - ? createParen(e) + return e.kind === 193 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ + ? ts.createParen(e) : e; } + ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; /** * Wraps an expression in parentheses if it is needed in order to use the expression * as the expression of a NewExpression node. @@ -12884,12 +13988,12 @@ var ts; function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179 /* CallExpression */: - return createParen(expression); - case 180 /* NewExpression */: + case 180 /* CallExpression */: + return ts.createParen(expression); + case 181 /* NewExpression */: return emittedExpression.arguments ? expression - : createParen(expression); + : ts.createParen(expression); } return parenthesizeForAccess(expression); } @@ -12902,32 +14006,29 @@ var ts; */ function parenthesizeForAccess(expression) { // isLeftHandSideExpression is almost the correct criterion for when it is not necessary - // to parenthesize the expression before a dot. The known exceptions are: + // to parenthesize the expression before a dot. The known exception is: // // NewExpression: // new C.x -> not the same as (new C).x - // NumericLiteral - // 1.x -> not the same as (1).x // var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 /* NewExpression */ || emittedExpression.arguments) - && emittedExpression.kind !== 8 /* NumericLiteral */) { + && (emittedExpression.kind !== 181 /* NewExpression */ || emittedExpression.arguments)) { return expression; } - return createParen(expression, /*location*/ expression); + return ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeForAccess = parenthesizeForAccess; function parenthesizePostfixOperand(operand) { return ts.isLeftHandSideExpression(operand) ? operand - : createParen(operand, /*location*/ operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePostfixOperand = parenthesizePostfixOperand; function parenthesizePrefixOperand(operand) { return ts.isUnaryExpression(operand) ? operand - : createParen(operand, /*location*/ operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePrefixOperand = parenthesizePrefixOperand; function parenthesizeListElements(elements) { @@ -12942,17 +14043,18 @@ var ts; } } if (result !== undefined) { - return createNodeArray(result, elements, elements.hasTrailingComma); + return ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements); } return elements; } + ts.parenthesizeListElements = parenthesizeListElements; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, 25 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, 25 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression - : createParen(expression, /*location*/ expression); + : ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeExpressionForList = parenthesizeExpressionForList; function parenthesizeExpressionForExpressionStatement(expression) { @@ -12960,16 +14062,16 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 /* FunctionExpression */ || kind === 185 /* ArrowFunction */) { - var mutableCall = getMutableClone(emittedExpression); - mutableCall.expression = createParen(callee, /*location*/ callee); + if (kind === 185 /* FunctionExpression */ || kind === 186 /* ArrowFunction */) { + var mutableCall = ts.getMutableClone(emittedExpression); + mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); } } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 /* ObjectLiteralExpression */ || leftmostExpressionKind === 184 /* FunctionExpression */) { - return createParen(expression, /*location*/ expression); + if (leftmostExpressionKind === 177 /* ObjectLiteralExpression */ || leftmostExpressionKind === 185 /* FunctionExpression */) { + return ts.setTextRange(ts.createParen(expression), expression); } } return expression; @@ -12983,7 +14085,7 @@ var ts; */ function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) { if (ts.isPartiallyEmittedExpression(originalOuterExpression)) { - var clone_1 = getMutableClone(originalOuterExpression); + var clone_1 = ts.getMutableClone(originalOuterExpression); clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression); return clone_1; } @@ -12992,21 +14094,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: node = node.operand; continue; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: node = node.left; continue; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: node = node.condition; continue; - case 179 /* CallExpression */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: node = node.expression; continue; - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13014,9 +14116,8 @@ var ts; } } function parenthesizeConciseBody(body) { - var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176 /* ObjectLiteralExpression */) { - return createParen(body, /*location*/ body); + if (!ts.isBlock(body) && getLeftmostExpression(body).kind === 177 /* ObjectLiteralExpression */) { + return ts.setTextRange(ts.createParen(body), body); } return body; } @@ -13047,7 +14148,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */) { + while (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } return node; @@ -13061,7 +14162,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294 /* PartiallyEmittedExpression */) { + while (node.kind === 295 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13072,188 +14173,6 @@ var ts; return node; } ts.startOnNewLine = startOnNewLine; - function setOriginalNode(node, original) { - node.original = original; - if (original) { - var emitNode = original.emitNode; - if (emitNode) - node.emitNode = mergeEmitNode(emitNode, node.emitNode); - } - return node; - } - ts.setOriginalNode = setOriginalNode; - function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; - if (!destEmitNode) - destEmitNode = {}; - if (flags) - destEmitNode.flags = flags; - if (commentRange) - destEmitNode.commentRange = commentRange; - if (sourceMapRange) - destEmitNode.sourceMapRange = sourceMapRange; - if (tokenSourceMapRanges) - destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); - if (constantValue !== undefined) - destEmitNode.constantValue = constantValue; - if (helpers) - destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); - return destEmitNode; - } - function mergeTokenSourceMapRanges(sourceRanges, destRanges) { - if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); - return destRanges; - } - /** - * Clears any EmitNode entries from parse-tree nodes. - * @param sourceFile A source file. - */ - function disposeEmitNodes(sourceFile) { - // During transformation we may need to annotate a parse tree node with transient - // transformation properties. As parse tree nodes live longer than transformation - // nodes, we need to make sure we reclaim any memory allocated for custom ranges - // from these nodes to ensure we do not hold onto entire subtrees just for position - // information. We also need to reset these nodes to a pre-transformation state - // for incremental parsing scenarios so that we do not impact later emit. - sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); - var emitNode = sourceFile && sourceFile.emitNode; - var annotatedNodes = emitNode && emitNode.annotatedNodes; - if (annotatedNodes) { - for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { - var node = annotatedNodes_1[_i]; - node.emitNode = undefined; - } - } - } - ts.disposeEmitNodes = disposeEmitNodes; - /** - * Associates a node with the current transformation, initializing - * various transient transformation properties. - * - * @param node The node. - */ - function getOrCreateEmitNode(node) { - if (!node.emitNode) { - if (ts.isParseTreeNode(node)) { - // To avoid holding onto transformation artifacts, we keep track of any - // parse tree node we are annotating. This allows us to clean them up after - // all transformations have completed. - if (node.kind === 261 /* SourceFile */) { - return node.emitNode = { annotatedNodes: [node] }; - } - var sourceFile = ts.getSourceFileOfNode(node); - getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); - } - node.emitNode = {}; - } - return node.emitNode; - } - ts.getOrCreateEmitNode = getOrCreateEmitNode; - /** - * Gets flags that control emit behavior of a node. - * - * @param node The node. - */ - function getEmitFlags(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.flags; - } - ts.getEmitFlags = getEmitFlags; - /** - * Sets flags that control emit behavior of a node. - * - * @param node The node. - * @param emitFlags The NodeEmitFlags for the node. - */ - function setEmitFlags(node, emitFlags) { - getOrCreateEmitNode(node).flags = emitFlags; - return node; - } - ts.setEmitFlags = setEmitFlags; - /** - * Gets a custom text range to use when emitting source maps. - * - * @param node The node. - */ - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; - } - ts.getSourceMapRange = getSourceMapRange; - /** - * Sets a custom text range to use when emitting source maps. - * - * @param node The node. - * @param range The text range. - */ - function setSourceMapRange(node, range) { - getOrCreateEmitNode(node).sourceMapRange = range; - return node; - } - ts.setSourceMapRange = setSourceMapRange; - /** - * Gets the TextRange to use for source maps for a token of a node. - * - * @param node The node. - * @param token The token. - */ - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; - /** - * Sets the TextRange to use for source maps for a token of a node. - * - * @param node The node. - * @param token The token. - * @param range The text range. - */ - function setTokenSourceMapRange(node, token, range) { - var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); - tokenSourceMapRanges[token] = range; - return node; - } - ts.setTokenSourceMapRange = setTokenSourceMapRange; - /** - * Gets a custom text range to use when emitting comments. - * - * @param node The node. - */ - function getCommentRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.commentRange) || node; - } - ts.getCommentRange = getCommentRange; - /** - * Sets a custom text range to use when emitting comments. - */ - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; - /** - * Gets the constant value to emit for an expression. - */ - function getConstantValue(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.constantValue; - } - ts.getConstantValue = getConstantValue; - /** - * Sets the constant value to emit for an expression. - */ - function setConstantValue(node, value) { - var emitNode = getOrCreateEmitNode(node); - emitNode.constantValue = value; - return node; - } - ts.setConstantValue = setConstantValue; function getExternalHelpersModuleName(node) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); var emitNode = parseNode && parseNode.emitNode; @@ -13266,143 +14185,34 @@ var ts; if (externalHelpersModuleName) { return externalHelpersModuleName; } - var helpers = getEmitHelpers(node); + var helpers = ts.getEmitHelpers(node); if (helpers) { - for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { - var helper = helpers_1[_i]; + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; if (!helper.scoped) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); - var emitNode = getOrCreateEmitNode(parseNode); - return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + var emitNode = ts.getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)); } } } } } ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; - /** - * Adds an EmitHelper to a node. - */ - function addEmitHelper(node, helper) { - var emitNode = getOrCreateEmitNode(node); - emitNode.helpers = ts.append(emitNode.helpers, helper); - return node; - } - ts.addEmitHelper = addEmitHelper; - /** - * Adds an EmitHelper to a node. - */ - function addEmitHelpers(node, helpers) { - if (ts.some(helpers)) { - var emitNode = getOrCreateEmitNode(node); - for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { - var helper = helpers_2[_i]; - if (!ts.contains(emitNode.helpers, helper)) { - emitNode.helpers = ts.append(emitNode.helpers, helper); - } - } - } - return node; - } - ts.addEmitHelpers = addEmitHelpers; - /** - * Removes an EmitHelper from a node. - */ - function removeEmitHelper(node, helper) { - var emitNode = node.emitNode; - if (emitNode) { - var helpers = emitNode.helpers; - if (helpers) { - return ts.orderedRemoveItem(helpers, helper); - } - } - return false; - } - ts.removeEmitHelper = removeEmitHelper; - /** - * Gets the EmitHelpers of a node. - */ - function getEmitHelpers(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.helpers; - } - ts.getEmitHelpers = getEmitHelpers; - /** - * Moves matching emit helpers from a source node to a target node. - */ - function moveEmitHelpers(source, target, predicate) { - var sourceEmitNode = source.emitNode; - var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; - if (!ts.some(sourceEmitHelpers)) - return; - var targetEmitNode = getOrCreateEmitNode(target); - var helpersRemoved = 0; - for (var i = 0; i < sourceEmitHelpers.length; i++) { - var helper = sourceEmitHelpers[i]; - if (predicate(helper)) { - helpersRemoved++; - if (!ts.contains(targetEmitNode.helpers, helper)) { - targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); - } - } - else if (helpersRemoved > 0) { - sourceEmitHelpers[i - helpersRemoved] = helper; - } - } - if (helpersRemoved > 0) { - sourceEmitHelpers.length -= helpersRemoved; - } - } - ts.moveEmitHelpers = moveEmitHelpers; - function compareEmitHelpers(x, y) { - if (x === y) - return 0 /* EqualTo */; - if (x.priority === y.priority) - return 0 /* EqualTo */; - if (x.priority === undefined) - return 1 /* GreaterThan */; - if (y.priority === undefined) - return -1 /* LessThan */; - return ts.compareValues(x.priority, y.priority); - } - ts.compareEmitHelpers = compareEmitHelpers; - function setTextRange(node, location) { - if (location) { - node.pos = location.pos; - node.end = location.end; - } - return node; - } - ts.setTextRange = setTextRange; - function setNodeFlags(node, flags) { - node.flags = flags; - return node; - } - ts.setNodeFlags = setNodeFlags; - function setMultiLine(node, multiLine) { - node.multiLine = multiLine; - return node; - } - ts.setMultiLine = setMultiLine; - function setHasTrailingComma(nodes, hasTrailingComma) { - nodes.hasTrailingComma = hasTrailingComma; - return nodes; - } - ts.setHasTrailingComma = setHasTrailingComma; /** * Get the name of that target module from an import or export declaration */ function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_9 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 /* ImportDeclaration */ && node.importClause) { - return getGeneratedNameForNode(node); + if (node.kind === 237 /* ImportDeclaration */ && node.importClause) { + return ts.getGeneratedNameForNode(node); } - if (node.kind === 241 /* ExportDeclaration */ && node.moduleSpecifier) { - return getGeneratedNameForNode(node); + if (node.kind === 243 /* ExportDeclaration */ && node.moduleSpecifier) { + return ts.getGeneratedNameForNode(node); } return undefined; } @@ -13420,7 +14230,7 @@ var ts; if (moduleName.kind === 9 /* StringLiteral */) { return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) || tryRenameExternalModule(moduleName, sourceFile) - || getSynthesizedClone(moduleName); + || ts.getSynthesizedClone(moduleName); } return undefined; } @@ -13430,10 +14240,8 @@ var ts; * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && ts.createLiteral(rename); } /** * Get the name of a module as should be written in the emitted output. @@ -13447,10 +14255,10 @@ var ts; return undefined; } if (file.moduleName) { - return createLiteral(file.moduleName); + return ts.createLiteral(file.moduleName); } if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) { - return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); + return ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); } return undefined; } @@ -13521,7 +14329,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -13533,11 +14341,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -13569,12 +14377,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 175 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 196 /* SpreadElement */: - case 259 /* SpreadAssignment */: + case 197 /* SpreadElement */: + case 262 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -13586,7 +14394,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -13598,7 +14406,7 @@ var ts; : propertyName; } break; - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -13610,7 +14418,7 @@ var ts; : propertyName; } break; - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -13628,13 +14436,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -13644,10 +14452,12 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpread(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); } var expression = convertToAssignmentElementTarget(element.name); - return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + return element.initializer + ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) + : expression; } ts.Debug.assertNode(element, ts.isExpression); return element; @@ -13657,14 +14467,14 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpreadAssignment(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); } if (element.propertyName) { var expression = convertToAssignmentElementTarget(element.name); - return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element); } ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element); } ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); return element; @@ -13672,18 +14482,18 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } ts.convertToAssignmentPattern = convertToAssignmentPattern; function convertToObjectAssignmentPattern(node) { if (ts.isObjectBindingPattern(node)) { - return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isObjectLiteralExpression); return node; @@ -13691,7 +14501,7 @@ var ts; ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; function convertToArrayAssignmentPattern(node) { if (ts.isArrayBindingPattern(node)) { - return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isArrayLiteralExpression); return node; @@ -13707,37 +14517,37 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; var exportEquals = undefined; var hasExportStarsToExportValues = false; var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); - var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration( + var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration( /*decorators*/ undefined, - /*modifiers*/ undefined, createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); if (externalHelpersImportDeclaration) { externalImports.push(externalHelpersImportDeclaration); } for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); break; - case 234 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + case 236 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -13753,27 +14563,27 @@ var ts; // export { x, y } for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13781,42 +14591,42 @@ var ts; } } break; - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export function x() { } - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = true; - exportedNames = ts.append(exportedNames, name_11); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export class x { } - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = true; - exportedNames = ts.append(exportedNames, name_12); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13836,13 +14646,24 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + /** Use a sparse array as a multi-map. */ + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); /// /// @@ -13854,13 +14675,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261 /* SourceFile */) { + if (kind === 264 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70 /* Identifier */) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141 /* FirstNode */) { + else if (kind < 142 /* FirstNode */) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13903,28 +14724,29 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: return visitNode(cbNode, node.expression); - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* PropertyAssignment */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -13933,24 +14755,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -13961,320 +14783,326 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 163 /* TupleType */: + case 164 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return visitNode(cbNode, node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170 /* MappedType */: + case 171 /* MappedType */: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return visitNode(cbNode, node.literal); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200 /* AsExpression */: + case 201 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 193 /* ConditionalExpression */: + case 203 /* MetaProperty */: + return visitNode(cbNode, node.name); + case 194 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 261 /* SourceFile */: + case 264 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213 /* ForOfStatement */: - return visitNode(cbNode, node.initializer) || + case 215 /* ForOfStatement */: + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return visitNode(cbNode, node.label); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 253 /* CaseClause */: + case 256 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254 /* DefaultClause */: + case 257 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145 /* Decorator */: + case 146 /* Decorator */: return visitNode(cbNode, node.expression); - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 260 /* EnumMember */: + case 263 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236 /* ImportClause */: + case 238 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202 /* TemplateSpan */: + case 204 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 244 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 246 /* JsxElement */: + case 248 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || - visitNodes(cbNodes, node.attributes); - case 250 /* JsxAttribute */: + visitNode(cbNode, node.attributes); + case 253 /* JsxAttributes */: + return visitNodes(cbNodes, node.properties); + case 252 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251 /* JsxSpreadAttribute */: + case 254 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 252 /* JsxExpression */: - return visitNode(cbNode, node.expression); - case 249 /* JsxClosingElement */: + case 255 /* JsxExpression */: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 251 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 262 /* JSDocTypeExpression */: + case 266 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 266 /* JSDocUnionType */: + case 270 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 267 /* JSDocTupleType */: + case 271 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 265 /* JSDocArrayType */: + case 269 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 269 /* JSDocNonNullableType */: + case 273 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 268 /* JSDocNullableType */: + case 272 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 270 /* JSDocRecordType */: + case 274 /* JSDocRecordType */: return visitNode(cbNode, node.literal); - case 272 /* JSDocTypeReference */: + case 276 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273 /* JSDocOptionalType */: + case 277 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 274 /* JSDocFunctionType */: + case 278 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275 /* JSDocVariadicType */: + case 279 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 276 /* JSDocConstructorType */: + case 280 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 277 /* JSDocThisType */: + case 281 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 271 /* JSDocRecordMember */: + case 275 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278 /* JSDocComment */: + case 282 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 281 /* JSDocParameterTag */: + case 285 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282 /* JSDocReturnTag */: + case 286 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 283 /* JSDocTypeTag */: + case 287 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 280 /* JSDocAugmentsTag */: + case 284 /* JSDocAugmentsTag */: return visitNode(cbNode, node.typeExpression); - case 284 /* JSDocTemplateTag */: + case 288 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287 /* JSDocTypeLiteral */: + case 291 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286 /* JSDocPropertyTag */: + case 290 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 288 /* JSDocLiteralType */: + case 292 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14292,6 +15120,7 @@ var ts; return Parser.parseIsolatedEntityName(text, languageVersion); } ts.parseIsolatedEntityName = parseIsolatedEntityName; + // See also `isExternalOrCommonJsModule` in utilities.ts function isExternalModule(file) { return file.externalModuleIndicator !== undefined; } @@ -14334,7 +15163,7 @@ var ts; // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true); - var disallowInAndDecoratorContext = 65536 /* DisallowInContext */ | 262144 /* DecoratorContext */; + var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks var NodeConstructor; var TokenConstructor; @@ -14458,7 +15287,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 2097152 /* JavaScriptFile */ : 0 /* None */; + contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 65536 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); @@ -14546,7 +15375,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(261 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(264 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14566,16 +15395,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536 /* DisallowInContext */); + setContextFlag(val, 2048 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 131072 /* YieldContext */); + setContextFlag(val, 4096 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 262144 /* DecoratorContext */); + setContextFlag(val, 8192 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 524288 /* AwaitContext */); + setContextFlag(val, 16384 /* AwaitContext */); } function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are @@ -14616,40 +15445,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536 /* DisallowInContext */, func); + return doOutsideOfContext(2048 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(65536 /* DisallowInContext */, func); + return doInsideOfContext(2048 /* DisallowInContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(131072 /* YieldContext */, func); + return doInsideOfContext(4096 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144 /* DecoratorContext */, func); + return doInsideOfContext(8192 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288 /* AwaitContext */, func); + return doInsideOfContext(16384 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288 /* AwaitContext */, func); + return doOutsideOfContext(16384 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 /* YieldContext */ | 524288 /* AwaitContext */, func); + return doInsideOfContext(4096 /* YieldContext */ | 16384 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072 /* YieldContext */); + return inContext(4096 /* YieldContext */); } function inDisallowInContext() { - return inContext(65536 /* DisallowInContext */); + return inContext(2048 /* DisallowInContext */); } function inDecoratorContext() { - return inContext(262144 /* DecoratorContext */); + return inContext(8192 /* DecoratorContext */); } function inAwaitContext() { - return inContext(524288 /* AwaitContext */); + return inContext(16384 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14830,7 +15659,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : kind === 70 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -14853,7 +15682,7 @@ var ts; // flag so that we don't mark any subsequent nodes. if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576 /* ThisNodeHasError */; + node.flags |= 32768 /* ThisNodeHasError */; } return node; } @@ -14870,7 +15699,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues // with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for @@ -14922,7 +15755,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(142 /* ComputedPropertyName */); + var node = createNode(143 /* ComputedPropertyName */); parseExpected(20 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -14975,6 +15808,7 @@ var ts; function nextTokenIsClassOrFunctionOrAsync() { nextToken(); return token() === 74 /* ClassKeyword */ || token() === 88 /* FunctionKeyword */ || + (token() === 116 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || (token() === 119 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element @@ -15015,7 +15849,7 @@ var ts; case 9 /* ObjectBindingElements */: return token() === 20 /* OpenBracketToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName(); case 7 /* HeritageClauseElement */: - // If we see { } then only consume it as an expression if it is followed by , or { + // If we see `{ ... }` then only consume it as an expression if it is followed by `,` or `{` // That way we won't consume the body of a class in its heritage clause. if (token() === 16 /* OpenBraceToken */) { return lookAhead(isValidHeritageClauseObjectLiteral); @@ -15247,7 +16081,7 @@ var ts; // differently depending on what mode it is in. // // This also applies to all our other context flags as well. - var nodeContextFlags = node.flags & 3080192 /* ContextFlags */; + var nodeContextFlags = node.flags & 96256 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -15329,14 +16163,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150 /* Constructor */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 147 /* PropertyDeclaration */: - case 203 /* SemicolonClassElement */: + case 151 /* Constructor */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 205 /* SemicolonClassElement */: return true; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. @@ -15351,8 +16185,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 256 /* CaseClause */: + case 257 /* DefaultClause */: return true; } } @@ -15361,58 +16195,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 205 /* VariableStatement */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 207 /* ExpressionStatement */: - case 220 /* ThrowStatement */: - case 216 /* ReturnStatement */: - case 218 /* SwitchStatement */: - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 206 /* EmptyStatement */: - case 221 /* TryStatement */: - case 219 /* LabeledStatement */: - case 209 /* DoStatement */: - case 222 /* DebuggerStatement */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 207 /* VariableStatement */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 209 /* ExpressionStatement */: + case 222 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 220 /* SwitchStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 208 /* EmptyStatement */: + case 223 /* TryStatement */: + case 221 /* LabeledStatement */: + case 211 /* DoStatement */: + case 224 /* DebuggerStatement */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 263 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154 /* ConstructSignature */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 146 /* PropertySignature */: - case 153 /* CallSignature */: + case 155 /* ConstructSignature */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 147 /* PropertySignature */: + case 154 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223 /* VariableDeclaration */) { + if (node.kind !== 225 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -15433,7 +16267,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144 /* Parameter */) { + if (node.kind !== 145 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -15480,7 +16314,6 @@ var ts; case 25 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected; } } - ; // Parses a comma-delimited list of elements function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; @@ -15546,7 +16379,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22 /* DotToken */)) { - var node = createNode(141 /* QualifiedName */, entity.pos); // !!! + var node = createNode(142 /* QualifiedName */, entity.pos); // !!! node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -15585,7 +16418,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194 /* TemplateExpression */); + var template = createNode(195 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -15597,7 +16430,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202 /* TemplateSpan */); + var span = createNode(204 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17 /* CloseBraceToken */) { @@ -15633,27 +16466,23 @@ var ts; if (scanner.isUnterminated()) { node.isUnterminated = true; } - var tokenPos = scanner.getTokenPos(); - nextToken(); - finishNode(node); // Octal literals are not allowed in strict mode or ES5 // Note that theoretically the following condition would hold true literals like 009, // which is not octal.But because of how the scanner separates the tokens, we would // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. // We also do not need to check for negatives because any prefix operator would be part of a // parent unary expression. - if (node.kind === 8 /* NumericLiteral */ - && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.isOctalLiteral = true; + if (node.kind === 8 /* NumericLiteral */) { + node.numericLiteralFlags = scanner.getNumericLiteralFlags(); } + nextToken(); + finishNode(node); return node; } // TYPES function parseTypeReference() { - var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - var node = createNode(157 /* TypeReference */, typeName.pos); - node.typeName = typeName; + var node = createNode(158 /* TypeReference */); + node.typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); } @@ -15661,24 +16490,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156 /* TypePredicate */, lhs.pos); + var node = createNode(157 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167 /* ThisType */); + var node = createNode(168 /* ThisType */); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160 /* TypeQuery */); + var node = createNode(161 /* TypeQuery */); parseExpected(102 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(84 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -15699,6 +16528,9 @@ var ts; node.expression = parseUnaryExpressionOrHigher(); } } + if (parseOptional(57 /* EqualsToken */)) { + node.default = parseType(); + } return finishNode(node); } function parseTypeParameters() { @@ -15716,9 +16548,9 @@ var ts; return token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 /* AtToken */ || token() === 98 /* ThisKeyword */; } function parseParameter() { - var node = createNode(144 /* Parameter */); + var node = createNode(145 /* Parameter */); if (token() === 98 /* ThisKeyword */) { - node.name = createIdentifier(/*isIdentifier*/ true, undefined); + node.name = createIdentifier(/*isIdentifier*/ true); node.type = parseParameterType(); return finishNode(node); } @@ -15815,7 +16647,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154 /* ConstructSignature */) { + if (kind === 155 /* ConstructSignature */) { parseExpected(93 /* NewKeyword */); } fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -15879,7 +16711,7 @@ var ts; return token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || token() === 21 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155 /* IndexSignature */, fullStart); + var node = createNode(156 /* IndexSignature */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); @@ -15891,7 +16723,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54 /* QuestionToken */); if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - var method = createNode(148 /* MethodSignature */, fullStart); + var method = createNode(149 /* MethodSignature */, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -15902,7 +16734,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146 /* PropertySignature */, fullStart); + var property = createNode(147 /* PropertySignature */, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -15918,14 +16750,14 @@ var ts; } } function isTypeMemberStart() { - var idToken; // Return true if we have the start of a signature member if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { return true; } + var idToken; // Eat up all modifiers, but hold on to the last one in case it is actually an identifier while (ts.isModifierKind(token())) { - idToken = token(); + idToken = true; nextToken(); } // Index signatures and computed property names are type members @@ -15934,7 +16766,7 @@ var ts; } // Try to get the first property-like token following all modifiers if (isLiteralPropertyName()) { - idToken = token(); + idToken = true; nextToken(); } // If we were able to get any potential identifier, check that it is @@ -15951,10 +16783,10 @@ var ts; } function parseTypeMember() { if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - return parseSignatureMember(153 /* CallSignature */); + return parseSignatureMember(154 /* CallSignature */); } if (token() === 93 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154 /* ConstructSignature */); + return parseSignatureMember(155 /* ConstructSignature */); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -15968,7 +16800,7 @@ var ts; return token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(161 /* TypeLiteral */); + var node = createNode(162 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -15991,14 +16823,14 @@ var ts; return token() === 20 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 91 /* InKeyword */; } function parseMappedTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); parseExpected(91 /* InKeyword */); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170 /* MappedType */); + var node = createNode(171 /* MappedType */); parseExpected(16 /* OpenBraceToken */); node.readonlyToken = parseOptionalToken(130 /* ReadonlyKeyword */); parseExpected(20 /* OpenBracketToken */); @@ -16011,12 +16843,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163 /* TupleType */); + var node = createNode(164 /* TupleType */); node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166 /* ParenthesizedType */); + var node = createNode(167 /* ParenthesizedType */); parseExpected(18 /* OpenParenToken */); node.type = parseType(); parseExpected(19 /* CloseParenToken */); @@ -16024,7 +16856,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159 /* ConstructorType */) { + if (kind === 160 /* ConstructorType */) { parseExpected(93 /* NewKeyword */); } fillSignature(35 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -16035,7 +16867,7 @@ var ts; return token() === 22 /* DotToken */ ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171 /* LiteralType */); + var node = createNode(172 /* LiteralType */); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -16046,12 +16878,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -16089,12 +16922,12 @@ var ts; function isStartOfType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 98 /* ThisKeyword */: case 102 /* TypeOfKeyword */: @@ -16102,11 +16935,14 @@ var ts; case 16 /* OpenBraceToken */: case 20 /* OpenBracketToken */: case 26 /* LessThanToken */: + case 48 /* BarToken */: + case 47 /* AmpersandToken */: case 93 /* NewKeyword */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: + case 133 /* ObjectKeyword */: return true; case 37 /* MinusToken */: return lookAhead(nextTokenIsNumericLiteral); @@ -16126,14 +16962,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20 /* OpenBracketToken */)) { if (isStartOfType()) { - var node = createNode(169 /* IndexedAccessType */, type.pos); + var node = createNode(170 /* IndexedAccessType */, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21 /* CloseBracketToken */); type = finishNode(node); } else { - var node = createNode(162 /* ArrayType */, type.pos); + var node = createNode(163 /* ArrayType */, type.pos); node.elementType = type; parseExpected(21 /* CloseBracketToken */); type = finishNode(node); @@ -16142,7 +16978,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168 /* TypeOperator */); + var node = createNode(169 /* TypeOperator */); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -16156,6 +16992,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -16170,10 +17007,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); + return parseUnionOrIntersectionType(166 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); + return parseUnionOrIntersectionType(165 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); } function isStartOfFunctionType() { if (token() === 26 /* LessThanToken */) { @@ -16230,7 +17067,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(157 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -16249,14 +17086,14 @@ var ts; function parseType() { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - return doOutsideOfContext(655360 /* TypeExcludesFlags */, parseTypeWorker); + return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158 /* FunctionType */); + return parseFunctionOrConstructorType(159 /* FunctionType */); } if (token() === 93 /* NewKeyword */) { - return parseFunctionOrConstructorType(159 /* ConstructorType */); + return parseFunctionOrConstructorType(160 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -16457,7 +17294,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195 /* YieldExpression */); + var node = createNode(196 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -16479,13 +17316,13 @@ var ts; ts.Debug.assert(token() === 35 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185 /* ArrowFunction */, asyncModifier.pos); + node = createNode(186 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185 /* ArrowFunction */, identifier.pos); + node = createNode(186 /* ArrowFunction */, identifier.pos); } - var parameter = createNode(144 /* Parameter */, identifier.pos); + var parameter = createNode(145 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -16667,7 +17504,7 @@ var ts; return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185 /* ArrowFunction */); + var node = createNode(186 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */); // Arrow functions are never generators. @@ -16733,7 +17570,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(193 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(194 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -16746,7 +17583,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 /* InKeyword */ || t === 140 /* OfKeyword */; + return t === 91 /* InKeyword */ || t === 141 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -16854,39 +17691,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192 /* BinaryExpression */, left.pos); + var node = createNode(193 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200 /* AsExpression */, left.pos); + var node = createNode(201 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186 /* DeleteExpression */); + var node = createNode(187 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187 /* TypeOfExpression */); + var node = createNode(188 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188 /* VoidExpression */); + var node = createNode(189 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -16902,7 +17739,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189 /* AwaitExpression */); + var node = createNode(190 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -16945,7 +17782,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 183 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -16990,6 +17827,7 @@ var ts; if (isAwaitExpression()) { return parseAwaitExpression(); } + // falls through default: return parseIncrementExpression(); } @@ -17023,7 +17861,7 @@ var ts; return false; } // We are in JSX context and the token is part of JSXElement. - // Fall through + // falls through default: return true; } @@ -17041,7 +17879,7 @@ var ts; */ function parseIncrementExpression() { if (token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -17054,7 +17892,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(192 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -17158,7 +17996,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(177 /* PropertyAccessExpression */, expression.pos); + var node = createNode(178 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(22 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -17183,8 +18021,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248 /* JsxOpeningElement */) { - var node = createNode(246 /* JsxElement */, opening.pos); + if (opening.kind === 250 /* JsxOpeningElement */) { + var node = createNode(248 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17194,7 +18032,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 249 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17209,7 +18047,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192 /* BinaryExpression */, result.pos); + var badNode = createNode(193 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -17252,23 +18090,31 @@ var ts; parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } + else if (token() === 7 /* ConflictMarkerTrivia */) { + break; + } result.push(parseJsxChild()); } result.end = scanner.getTokenPos(); parsingContext = saveParsingContext; return result; } + function parseJsxAttributes() { + var jsxAttributes = createNode(253 /* JsxAttributes */); + jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); + return finishNode(jsxAttributes); + } function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(26 /* LessThanToken */); var tagName = parseJsxElementName(); - var attributes = parseList(13 /* JsxAttributes */, parseJsxAttribute); + var attributes = parseJsxAttributes(); var node; if (token() === 28 /* GreaterThanToken */) { // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(248 /* JsxOpeningElement */, fullStart); + node = createNode(250 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17280,7 +18126,7 @@ var ts; parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(247 /* JsxSelfClosingElement */, fullStart); + node = createNode(249 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -17296,7 +18142,7 @@ var ts; var expression = token() === 98 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22 /* DotToken */)) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17304,9 +18150,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252 /* JsxExpression */); + var node = createNode(255 /* JsxExpression */); parseExpected(16 /* OpenBraceToken */); if (token() !== 17 /* CloseBraceToken */) { + node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -17323,7 +18170,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250 /* JsxAttribute */); + var node = createNode(252 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 57 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -17338,7 +18185,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251 /* JsxSpreadAttribute */); + var node = createNode(254 /* JsxSpreadAttribute */); parseExpected(16 /* OpenBraceToken */); parseExpected(23 /* DotDotDotToken */); node.expression = parseExpression(); @@ -17346,7 +18193,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249 /* JsxClosingElement */); + var node = createNode(251 /* JsxClosingElement */); parseExpected(27 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -17359,7 +18206,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182 /* TypeAssertionExpression */); + var node = createNode(183 /* TypeAssertionExpression */); parseExpected(26 /* LessThanToken */); node.type = parseType(); parseExpected(28 /* GreaterThanToken */); @@ -17370,7 +18217,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17378,14 +18225,14 @@ var ts; } if (token() === 50 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(202 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(20 /* OpenBracketToken */)) { - var indexedAccess = createNode(178 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(179 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -17401,7 +18248,7 @@ var ts; continue; } if (token() === 12 /* NoSubstitutionTemplateLiteral */ || token() === 13 /* TemplateHead */) { - var tagExpression = createNode(181 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(182 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -17424,7 +18271,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -17432,7 +18279,7 @@ var ts; continue; } else if (token() === 18 /* OpenParenToken */) { - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -17542,28 +18389,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183 /* ParenthesizedExpression */); + var node = createNode(184 /* ParenthesizedExpression */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196 /* SpreadElement */); + var node = createNode(197 /* SpreadElement */); parseExpected(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 25 /* CommaToken */ ? createNode(198 /* OmittedExpression */) : + token() === 25 /* CommaToken */ ? createNode(199 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175 /* ArrayLiteralExpression */); + var node = createNode(176 /* ArrayLiteralExpression */); parseExpected(20 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17574,10 +18421,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124 /* GetKeyword */)) { - return parseAccessorDeclaration(151 /* GetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(152 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(133 /* SetKeyword */)) { - return parseAccessorDeclaration(152 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(134 /* SetKeyword */)) { + return parseAccessorDeclaration(153 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -17585,7 +18432,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(259 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(262 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -17610,7 +18457,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(261 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57 /* EqualsToken */); @@ -17621,7 +18468,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(260 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -17631,7 +18478,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176 /* ObjectLiteralExpression */); + var node = createNode(177 /* ObjectLiteralExpression */); parseExpected(16 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17650,7 +18497,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNode(184 /* FunctionExpression */); + var node = createNode(185 /* FunctionExpression */); node.modifiers = parseModifiers(); parseExpected(88 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */); @@ -17672,8 +18519,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180 /* NewExpression */); + var fullStart = scanner.getStartPos(); parseExpected(93 /* NewKeyword */); + if (parseOptional(22 /* DotToken */)) { + var node_1 = createNode(203 /* MetaProperty */, fullStart); + node_1.keywordToken = 93 /* NewKeyword */; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(181 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18 /* OpenParenToken */) { @@ -17683,7 +18537,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204 /* Block */); + var node = createNode(206 /* Block */); if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17716,12 +18570,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206 /* EmptyStatement */); + var node = createNode(208 /* EmptyStatement */); parseExpected(24 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(208 /* IfStatement */); + var node = createNode(210 /* IfStatement */); parseExpected(89 /* IfKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17731,7 +18585,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209 /* DoStatement */); + var node = createNode(211 /* DoStatement */); parseExpected(80 /* DoKeyword */); node.statement = parseStatement(); parseExpected(105 /* WhileKeyword */); @@ -17746,7 +18600,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210 /* WhileStatement */); + var node = createNode(212 /* WhileStatement */); parseExpected(105 /* WhileKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17757,6 +18611,7 @@ var ts; function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(87 /* ForKeyword */); + var awaitToken = parseOptionalToken(120 /* AwaitKeyword */); parseExpected(18 /* OpenParenToken */); var initializer = undefined; if (token() !== 24 /* SemicolonToken */) { @@ -17768,22 +18623,23 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(91 /* InKeyword */)) { - var forInStatement = createNode(212 /* ForInStatement */, pos); - forInStatement.initializer = initializer; - forInStatement.expression = allowInAnd(parseExpression); - parseExpected(19 /* CloseParenToken */); - forOrForInOrForOfStatement = forInStatement; - } - else if (parseOptional(140 /* OfKeyword */)) { - var forOfStatement = createNode(213 /* ForOfStatement */, pos); + if (awaitToken ? parseExpected(141 /* OfKeyword */) : parseOptional(141 /* OfKeyword */)) { + var forOfStatement = createNode(215 /* ForOfStatement */, pos); + forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } + else if (parseOptional(91 /* InKeyword */)) { + var forInStatement = createNode(214 /* ForInStatement */, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(19 /* CloseParenToken */); + forOrForInOrForOfStatement = forInStatement; + } else { - var forStatement = createNode(211 /* ForStatement */, pos); + var forStatement = createNode(213 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(24 /* SemicolonToken */); if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) { @@ -17801,7 +18657,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); + parseExpected(kind === 217 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -17809,7 +18665,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216 /* ReturnStatement */); + var node = createNode(218 /* ReturnStatement */); parseExpected(95 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -17818,7 +18674,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217 /* WithStatement */); + var node = createNode(219 /* WithStatement */); parseExpected(106 /* WithKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17827,7 +18683,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253 /* CaseClause */); + var node = createNode(256 /* CaseClause */); parseExpected(72 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(55 /* ColonToken */); @@ -17835,7 +18691,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254 /* DefaultClause */); + var node = createNode(257 /* DefaultClause */); parseExpected(78 /* DefaultKeyword */); parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -17845,12 +18701,12 @@ var ts; return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218 /* SwitchStatement */); + var node = createNode(220 /* SwitchStatement */); parseExpected(97 /* SwitchKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); - var caseBlock = createNode(232 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(234 /* CaseBlock */, scanner.getStartPos()); parseExpected(16 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(17 /* CloseBraceToken */); @@ -17865,7 +18721,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(220 /* ThrowStatement */); + var node = createNode(222 /* ThrowStatement */); parseExpected(99 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -17873,7 +18729,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(221 /* TryStatement */); + var node = createNode(223 /* TryStatement */); parseExpected(101 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -17886,7 +18742,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256 /* CatchClause */); + var result = createNode(259 /* CatchClause */); parseExpected(73 /* CatchKeyword */); if (parseExpected(18 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17896,7 +18752,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222 /* DebuggerStatement */); + var node = createNode(224 /* DebuggerStatement */); parseExpected(77 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -17908,13 +18764,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) { - var labeledStatement = createNode(219 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(221 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(209 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -17924,6 +18780,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak(); } + function nextTokenIsClassKeywordOnSameLine() { + nextToken(); + return token() === 74 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak(); + } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); return token() === 88 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); @@ -17964,7 +18824,7 @@ var ts; // // could be legal, it would add complexity for very little gain. case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: @@ -17982,7 +18842,7 @@ var ts; return false; } continue; - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: nextToken(); return token() === 16 /* OpenBraceToken */ || token() === 70 /* Identifier */ || token() === 83 /* ExportKeyword */; case 90 /* ImportKeyword */: @@ -18044,8 +18904,8 @@ var ts; case 108 /* InterfaceKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: - case 136 /* TypeKeyword */: - case 139 /* GlobalKeyword */: + case 137 /* TypeKeyword */: + case 140 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 113 /* PublicKeyword */: @@ -18095,9 +18955,9 @@ var ts; case 87 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 76 /* ContinueKeyword */: - return parseBreakOrContinueStatement(214 /* ContinueStatement */); + return parseBreakOrContinueStatement(216 /* ContinueStatement */); case 71 /* BreakKeyword */: - return parseBreakOrContinueStatement(215 /* BreakStatement */); + return parseBreakOrContinueStatement(217 /* BreakStatement */); case 95 /* ReturnKeyword */: return parseReturnStatement(); case 106 /* WithKeyword */: @@ -18117,7 +18977,7 @@ var ts; return parseDeclaration(); case 119 /* AsyncKeyword */: case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: case 123 /* DeclareKeyword */: @@ -18131,7 +18991,7 @@ var ts; case 116 /* AbstractKeyword */: case 114 /* StaticKeyword */: case 130 /* ReadonlyKeyword */: - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -18154,11 +19014,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -18179,7 +19039,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(244 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -18201,16 +19061,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 25 /* CommaToken */) { - return createNode(198 /* OmittedExpression */); + return createNode(199 /* OmittedExpression */); } - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -18226,14 +19086,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172 /* ObjectBindingPattern */); + var node = createNode(173 /* ObjectBindingPattern */); parseExpected(16 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(17 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173 /* ArrayBindingPattern */); + var node = createNode(174 /* ArrayBindingPattern */); parseExpected(20 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(21 /* CloseBracketToken */); @@ -18252,7 +19112,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223 /* VariableDeclaration */); + var node = createNode(225 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -18261,7 +19121,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224 /* VariableDeclarationList */); + var node = createNode(226 /* VariableDeclarationList */); switch (token()) { case 103 /* VarKeyword */: break; @@ -18284,7 +19144,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token() === 140 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -18299,7 +19159,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205 /* VariableStatement */, fullStart); + var node = createNode(207 /* VariableStatement */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -18307,7 +19167,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225 /* FunctionDeclaration */, fullStart); + var node = createNode(227 /* FunctionDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88 /* FunctionKeyword */); @@ -18320,7 +19180,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150 /* Constructor */, pos); + var node = createNode(151 /* Constructor */, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122 /* ConstructorKeyword */); @@ -18329,7 +19189,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149 /* MethodDeclaration */, fullStart); + var method = createNode(150 /* MethodDeclaration */, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -18342,7 +19202,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147 /* PropertyDeclaration */, fullStart); + var property = createNode(148 /* PropertyDeclaration */, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -18359,7 +19219,7 @@ var ts; // The checker may still error in the static case to explicitly disallow the yield expression. property.initializer = ts.hasModifier(property, 32 /* Static */) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 /* YieldContext */ | 65536 /* DisallowInContext */, parseNonParameterInitializer); + : doOutsideOfContext(4096 /* YieldContext */ | 2048 /* DisallowInContext */, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -18435,7 +19295,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 133 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 134 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -18465,7 +19325,7 @@ var ts; if (!parseOptional(56 /* AtToken */)) { break; } - var decorator = createNode(145 /* Decorator */, decoratorStart); + var decorator = createNode(146 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -18531,7 +19391,7 @@ var ts; } function parseClassElement() { if (token() === 24 /* SemicolonToken */) { - var result = createNode(203 /* SemicolonClassElement */); + var result = createNode(205 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -18559,8 +19419,8 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined); + var name = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -18569,10 +19429,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 197 /* ClassExpression */); + /*modifiers*/ undefined, 198 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -18615,9 +19475,10 @@ var ts; return undefined; } function parseHeritageClause() { - if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) { - var node = createNode(255 /* HeritageClause */); - node.token = token(); + var tok = token(); + if (tok === 84 /* ExtendsKeyword */ || tok === 107 /* ImplementsKeyword */) { + var node = createNode(258 /* HeritageClause */); + node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); return finishNode(node); @@ -18625,7 +19486,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199 /* ExpressionWithTypeArguments */); + var node = createNode(200 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); @@ -18639,7 +19500,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227 /* InterfaceDeclaration */, fullStart); + var node = createNode(229 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108 /* InterfaceKeyword */); @@ -18650,10 +19511,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* TypeAliasDeclaration */, fullStart); + var node = createNode(230 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136 /* TypeKeyword */); + parseExpected(137 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57 /* EqualsToken */); @@ -18666,13 +19527,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(260 /* EnumMember */, scanner.getStartPos()); + var node = createNode(263 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229 /* EnumDeclaration */, fullStart); + var node = createNode(231 /* EnumDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82 /* EnumKeyword */); @@ -18687,7 +19548,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(233 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(16 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(17 /* CloseBraceToken */); @@ -18698,7 +19559,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -18712,10 +19573,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); node.flags |= 512 /* GlobalAugmentation */; @@ -18733,7 +19594,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -18759,7 +19620,7 @@ var ts; return nextToken() === 40 /* SlashToken */; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233 /* NamespaceExportDeclaration */, fullStart); + var exportDeclaration = createNode(235 /* NamespaceExportDeclaration */, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117 /* AsKeyword */); @@ -18774,22 +19635,12 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 /* CommaToken */ && token() !== 138 /* FromKeyword */) { - // ImportEquals declaration of type: - // import x = require("mod"); or - // import x = M.x; - var importEqualsDeclaration = createNode(234 /* ImportEqualsDeclaration */, fullStart); - importEqualsDeclaration.decorators = decorators; - importEqualsDeclaration.modifiers = modifiers; - importEqualsDeclaration.name = identifier; - parseExpected(57 /* EqualsToken */); - importEqualsDeclaration.moduleReference = parseModuleReference(); - parseSemicolon(); - return addJSDocComment(finishNode(importEqualsDeclaration)); + if (token() !== 25 /* CommaToken */ && token() !== 139 /* FromKeyword */) { + return parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier); } } // Import statement - var importDeclaration = createNode(235 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(237 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; // ImportDeclaration: @@ -18799,12 +19650,22 @@ var ts; token() === 38 /* AsteriskToken */ || token() === 16 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } + function parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier) { + var importEqualsDeclaration = createNode(236 /* ImportEqualsDeclaration */, fullStart); + importEqualsDeclaration.decorators = decorators; + importEqualsDeclaration.modifiers = modifiers; + importEqualsDeclaration.name = identifier; + parseExpected(57 /* EqualsToken */); + importEqualsDeclaration.moduleReference = parseModuleReference(); + parseSemicolon(); + return addJSDocComment(finishNode(importEqualsDeclaration)); + } function parseImportClause(identifier, fullStart) { // ImportClause: // ImportedDefaultBinding @@ -18812,7 +19673,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(236 /* ImportClause */, fullStart); + var importClause = createNode(238 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -18822,7 +19683,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(25 /* CommaToken */)) { - importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(238 /* NamedImports */); + importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(240 /* NamedImports */); } return finishNode(importClause); } @@ -18832,7 +19693,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(245 /* ExternalModuleReference */); + var node = createNode(247 /* ExternalModuleReference */); parseExpected(131 /* RequireKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -18855,7 +19716,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(237 /* NamespaceImport */); + var namespaceImport = createNode(239 /* NamespaceImport */); parseExpected(38 /* AsteriskToken */); parseExpected(117 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -18870,14 +19731,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 238 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 240 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243 /* ExportSpecifier */); + return parseImportOrExportSpecifier(245 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239 /* ImportSpecifier */); + return parseImportOrExportSpecifier(241 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -18902,27 +19763,27 @@ var ts; else { node.name = identifierName; } - if (kind === 239 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 241 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241 /* ExportDeclaration */, fullStart); + var node = createNode(243 /* ExportDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38 /* AsteriskToken */)) { - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(244 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 138 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(138 /* FromKeyword */); + if (token() === 139 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -18930,7 +19791,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240 /* ExportAssignment */, fullStart); + var node = createNode(242 /* ExportAssignment */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57 /* EqualsToken */)) { @@ -18949,6 +19810,7 @@ var ts; var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; + var checkJsDirective = undefined; // Keep scanning all the leading trivia in the file until we get to something that // isn't trivia. Any single line comment will be analyzed to see if it is a // reference comment. @@ -18962,7 +19824,11 @@ var ts; break; } } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; + var range = { + kind: triviaScanner.getToken(), + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -19002,20 +19868,30 @@ var ts; amdDependencies.push(amdDependency); } } + var checkJsDirectiveRegEx = /^\/\/\/?\s*(@ts-check|@ts-nocheck)\s*$/gim; + var checkJsDirectiveMatchResult = checkJsDirectiveRegEx.exec(comment); + if (checkJsDirectiveMatchResult) { + checkJsDirective = { + enabled: ts.compareStrings(checkJsDirectiveMatchResult[1], "@ts-check", /*ignoreCase*/ true) === 0 /* EqualTo */, + end: range.end, + pos: range.pos + }; + } } } sourceFile.referencedFiles = referencedFiles; sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; + sourceFile.checkJsDirective = checkJsDirective; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */ - || node.kind === 235 /* ImportDeclaration */ - || node.kind === 240 /* ExportAssignment */ - || node.kind === 241 /* ExportDeclaration */ + || node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */ + || node.kind === 237 /* ImportDeclaration */ + || node.kind === 242 /* ExportAssignment */ + || node.kind === 243 /* ExportDeclaration */ ? node : undefined; }); @@ -19090,7 +19966,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(262 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(266 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(16 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(17 /* CloseBraceToken */); @@ -19101,12 +19977,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48 /* BarToken */) { - var unionType = createNode(266 /* JSDocUnionType */, type.pos); + var unionType = createNode(270 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57 /* EqualsToken */) { - var optionalType = createNode(273 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(277 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -19117,20 +19993,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20 /* OpenBracketToken */) { - var arrayType = createNode(265 /* JSDocArrayType */, type.pos); + var arrayType = createNode(269 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token() === 54 /* QuestionToken */) { - var nullableType = createNode(268 /* JSDocNullableType */, type.pos); + var nullableType = createNode(272 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50 /* ExclamationToken */) { - var nonNullableType = createNode(269 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(273 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -19164,14 +20040,15 @@ var ts; case 98 /* ThisKeyword */: return parseJSDocThisType(); case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: return parseTokenNode(); case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -19182,27 +20059,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277 /* JSDocThisType */); + var result = createNode(281 /* JSDocThisType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276 /* JSDocConstructorType */); + var result = createNode(280 /* JSDocConstructorType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275 /* JSDocVariadicType */); + var result = createNode(279 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274 /* JSDocFunctionType */); + var result = createNode(278 /* JSDocFunctionType */); nextToken(); parseExpected(18 /* OpenParenToken */); result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -19215,7 +20092,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144 /* Parameter */); + var parameter = createNode(145 /* Parameter */); parameter.type = parseJSDocType(); if (parseOptional(57 /* EqualsToken */)) { // TODO(rbuckton): Can this be changed to SyntaxKind.QuestionToken? @@ -19224,7 +20101,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272 /* JSDocTypeReference */); + var result = createNode(276 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -19259,24 +20136,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141 /* QualifiedName */, left.pos); + var result = createNode(142 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270 /* JSDocRecordType */); + var result = createNode(274 /* JSDocRecordType */); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269 /* JSDocNonNullableType */); + var result = createNode(273 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267 /* JSDocTupleType */); + var result = createNode(271 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -19290,7 +20167,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266 /* JSDocUnionType */); + var result = createNode(270 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19 /* CloseParenToken */); @@ -19306,12 +20183,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263 /* JSDocAllType */); + var result = createNode(267 /* JSDocAllType */); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288 /* JSDocLiteralType */); + var result = createNode(292 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19334,11 +20211,11 @@ var ts; token() === 28 /* GreaterThanToken */ || token() === 57 /* EqualsToken */ || token() === 48 /* BarToken */) { - var result = createNode(264 /* JSDocUnknownType */, pos); + var result = createNode(268 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(268 /* JSDocNullableType */, pos); + var result = createNode(272 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -19437,7 +20314,7 @@ var ts; break; case 38 /* AsteriskToken */: var asterisk = scanner.getTokenText(); - if (state === 1 /* SawAsterisk */) { + if (state === 1 /* SawAsterisk */ || state === 2 /* SavingComments */) { // If we've already seen an asterisk, then we can no longer parse a tag on this line state = 2 /* SavingComments */; pushComment(asterisk); @@ -19458,7 +20335,10 @@ var ts; case 5 /* WhitespaceTrivia */: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin var whitespace = scanner.getTokenText(); - if (state === 2 /* SavingComments */ || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2 /* SavingComments */) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -19466,6 +20346,8 @@ var ts; case 1 /* EndOfFileToken */: break; default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = 2 /* SavingComments */; pushComment(scanner.getTokenText()); break; } @@ -19498,7 +20380,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(278 /* JSDocComment */, start); + var result = createNode(282 /* JSDocComment */, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19556,7 +20438,7 @@ var ts; } function parseTagComments(indent) { var comments = []; - var state = 1 /* SawAsterisk */; + var state = 0 /* BeginningOfLine */; var margin; function pushComment(text) { if (!margin) { @@ -19597,7 +20479,8 @@ var ts; indent += scanner.getTokenText().length; break; } - // FALLTHROUGH otherwise to record the * as a comment + // record the * as a comment + // falls through default: state = 2 /* SavingComments */; // leading identifiers start recording as well pushComment(scanner.getTokenText()); @@ -19614,7 +20497,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279 /* JSDocTag */, atToken.pos); + var result = createNode(283 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -19671,7 +20554,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281 /* JSDocParameterTag */, atToken.pos); + var result = createNode(285 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19682,20 +20565,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282 /* JSDocReturnTag */, atToken.pos); + var result = createNode(286 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 287 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283 /* JSDocTypeTag */, atToken.pos); + var result = createNode(287 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19710,7 +20593,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(290 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -19719,7 +20602,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(284 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -19728,25 +20611,30 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(289 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70 /* Identifier */) { + while (true) { + if (rightNode.kind === 70 /* Identifier */ || !rightNode.body) { + // if node is identifier - use it as name + // otherwise use name of the rightmost part that we were able to parse + typedefTag.name = rightNode.kind === 70 /* Identifier */ ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272 /* JSDocTypeReference */) { + if (typeExpression.type.kind === 276 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { - var name_14 = jsDocTypeReference.name; - if (name_14.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -19760,7 +20648,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(291 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19790,6 +20678,7 @@ var ts; break; case 70 /* Identifier */: canParseTag = false; + break; case 1 /* EndOfFileToken */: break; } @@ -19801,7 +20690,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) { - var jsDocNamespaceNode = createNode(230 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(232 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -19847,20 +20736,20 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 288 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' var typeParameters = createNodeArray(); while (true) { - var name_15 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_15) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143 /* TypeParameter */, name_15.pos); - typeParameter.name = name_15; + var typeParameter = createNode(144 /* TypeParameter */, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25 /* CommaToken */) { @@ -19871,7 +20760,7 @@ var ts; break; } } - var result = createNode(284 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(288 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -20345,7 +21234,7 @@ var ts; if (position >= array.pos && position < array.end) { // position was in this array. Search through this array to see if we find a // viable element. - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -20391,16 +21280,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 230 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } - else if (node.kind === 231 /* ModuleBlock */) { + else if (node.kind === 233 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -20419,7 +21308,7 @@ var ts; }); return state_1; } - else if (node.kind === 230 /* ModuleDeclaration */) { + else if (node.kind === 232 /* ModuleDeclaration */) { var body = node.body; return body ? getModuleInstanceState(body) : 1 /* Instantiated */; } @@ -20532,7 +21421,7 @@ var ts; } return bindSourceFile; function bindInStrictMode(file, opts) { - if (opts.alwaysStrict && !ts.isDeclarationFile(file)) { + if ((opts.alwaysStrict === undefined ? opts.strict : opts.alwaysStrict) && !ts.isDeclarationFile(file)) { // bind in strict mode source files with alwaysStrict option return true; } @@ -20560,7 +21449,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -20573,7 +21462,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression)) { @@ -20585,27 +21474,28 @@ var ts; return node.name.text; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return "__constructor"; - case 158 /* FunctionType */: - case 153 /* CallSignature */: + case 159 /* FunctionType */: + case 154 /* CallSignature */: return "__call"; - case 159 /* ConstructorType */: - case 154 /* ConstructSignature */: + case 160 /* ConstructorType */: + case 155 /* ConstructSignature */: return "__new"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "__index"; - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return "__export"; - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2 /* ModuleExports */: // module.exports = ... return "export="; case 1 /* ExportsProperty */: case 4 /* ThisProperty */: + case 5 /* Property */: // exports.x = ... or this.y = ... return node.left.name.text; case 3 /* PrototypeProperty */: @@ -20614,22 +21504,22 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined; - case 274 /* JSDocFunctionType */: + case 278 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144 /* Parameter */: + case 145 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 274 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 278 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -20684,15 +21574,18 @@ var ts; // Otherwise, we'll be merging into a compatible existing symbol (for example when // you have multiple 'vars' with the same name in the same container). In this case // just add this node into the declarations list of the symbol. - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0 /* None */, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); + } if (name && (includes & 788448 /* Classifiable */)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { // Javascript constructor-declared symbols can be discarded in favor of // prototype symbols like methods. - symbol = symbolTable[name] = createSymbol(0 /* None */, name); + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); } else { if (node.name) { @@ -20716,7 +21609,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -20736,11 +21629,11 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 243 /* ExportSpecifier */ || (node.kind === 234 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 245 /* ExportSpecifier */ || (node.kind === 236 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + return declareSymbol(container.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } } else { @@ -20759,7 +21652,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 289 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20767,13 +21660,13 @@ var ts; var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolFlags & 793064 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolFlags & 1920 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); - var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + var local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); node.localSymbol = local; return local; } else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + return declareSymbol(container.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } } } @@ -20840,14 +21733,13 @@ var ts; hasExplicitReturn = false; bindChildren(node); // Reset all reachability check related flags on node (for incremental scenarios) - // Reset all emit helper flags on node (for incremental scenarios) - node.flags &= ~64896 /* ReachabilityAndEmitFlags */; + node.flags &= ~1408 /* ReachabilityAndEmitFlags */; if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && ts.nodeIsPresent(node.body)) { node.flags |= 128 /* HasImplicitReturn */; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 264 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -20926,66 +21818,72 @@ var ts; return; } switch (node.kind) { - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: bindWhileStatement(node); break; - case 209 /* DoStatement */: + case 211 /* DoStatement */: bindDoStatement(node); break; - case 211 /* ForStatement */: + case 213 /* ForStatement */: bindForStatement(node); break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 208 /* IfStatement */: + case 210 /* IfStatement */: bindIfStatement(node); break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 221 /* TryStatement */: + case 223 /* TryStatement */: bindTryStatement(node); break; - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: bindSwitchStatement(node); break; - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: bindCaseBlock(node); break; - case 253 /* CaseClause */: + case 256 /* CaseClause */: bindCaseClause(node); break; - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: bindLabeledStatement(node); break; - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 179 /* CallExpression */: + case 180 /* CallExpression */: bindCallExpressionFlow(node); break; + case 282 /* JSDocComment */: + bindJSDocComment(node); + break; + case 289 /* JSDocTypedefTag */: + bindJSDocTypedefTag(node); + break; default: bindEachChild(node); break; @@ -20995,15 +21893,15 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return hasNarrowableArgument(expr); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return expr.operator === 50 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; @@ -21011,7 +21909,8 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 /* Identifier */ || expr.kind === 98 /* ThisKeyword */ || - expr.kind === 177 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + expr.kind === 96 /* SuperKeyword */ || + expr.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -21022,14 +21921,14 @@ var ts; } } } - if (expr.expression.kind === 177 /* PropertyAccessExpression */ && + if (expr.expression.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; + return expr1.kind === 188 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -21050,9 +21949,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 57 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -21147,33 +22046,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208 /* IfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: + case 210 /* IfStatement */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: return parent.expression === node; - case 211 /* ForStatement */: - case 193 /* ConditionalExpression */: + case 213 /* ForStatement */: + case 194 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183 /* ParenthesizedExpression */) { + if (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 190 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { + else if (node.kind === 191 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 192 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || + return node.kind === 193 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 53 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 /* ParenthesizedExpression */ || - node.parent.kind === 190 /* PrefixUnaryExpression */ && + while (node.parent.kind === 184 /* ParenthesizedExpression */ || + node.parent.kind === 191 /* PrefixUnaryExpression */ && node.parent.operator === 50 /* ExclamationToken */) { node = node.parent; } @@ -21215,7 +22114,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 221 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21249,10 +22148,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; + if (node.kind === 215 /* ForOfStatement */) { + bind(node.awaitModifier); + } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224 /* VariableDeclarationList */) { + if (node.initializer.kind !== 226 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21274,7 +22176,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216 /* ReturnStatement */) { + if (node.kind === 218 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21294,7 +22196,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -21330,7 +22232,32 @@ var ts; if (node.finallyBlock) { // in finally flow is combined from pre-try/flow from try/flow from catch // pre-flow is necessary to make sure that finally is reachable even if finally flows in both try and finally blocks are unreachable - addAntecedent(preFinallyLabel, preTryFlow); + // also for finally blocks we inject two extra edges into the flow graph. + // first -> edge that connects pre-try flow with the label at the beginning of the finally block, it has lock associated with it + // second -> edge that represents post-finally flow. + // these edges are used in following scenario: + // let a; (1) + // try { a = someOperation(); (2)} + // finally { (3) console.log(a) } (4) + // (5) a + // flow graph for this case looks roughly like this (arrows show ): + // (1-pre-try-flow) <--.. <-- (2-post-try-flow) + // ^ ^ + // |*****(3-pre-finally-label) -----| + // ^ + // |-- ... <-- (4-post-finally-label) <--- (5) + // In case when we walk the flow starting from inside the finally block we want to take edge '*****' into account + // since it ensures that finally is always reachable. However when we start outside the finally block and go through label (5) + // then edge '*****' should be discarded because label 4 is only reachable if post-finally label-4 is reachable + // Simply speaking code inside finally block is treated as reachable as pre-try-flow + // since we conservatively assume that any line in try block can throw or return in which case we'll enter finally. + // However code after finally is reachable only if control flow was not abrupted in try/catch or finally blocks - it should be composed from + // final flows of these blocks without taking pre-try flow into account. + // + // extra edges that we inject allows to control this behavior + // if when walking the flow we step on post-finally edge - we can mark matching pre-finally edge as locked so it will be skipped. + var preFinallyFlow = { flags: 2048 /* PreFinally */, antecedent: preTryFlow, lock: {} }; + addAntecedent(preFinallyLabel, preFinallyFlow); currentFlow = finishFlowLabel(preFinallyLabel); bind(node.finallyBlock); // if flow after finally is unreachable - keep it @@ -21346,6 +22273,11 @@ var ts; : unreachableFlow; } } + if (!(currentFlow.flags & 1 /* Unreachable */)) { + var afterFinallyFlow = { flags: 4096 /* AfterFinally */, antecedent: currentFlow }; + preFinallyFlow.lock = afterFinallyFlow; + currentFlow = afterFinallyFlow; + } } else { currentFlow = finishFlowLabel(preFinallyLabel); @@ -21360,7 +22292,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 257 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -21427,14 +22359,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 211 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -21445,10 +22377,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175 /* ArrayLiteralExpression */) { + else if (node.kind === 176 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196 /* SpreadElement */) { + if (e.kind === 197 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -21456,16 +22388,16 @@ var ts; } } } - else if (node.kind === 176 /* ObjectLiteralExpression */) { + else if (node.kind === 177 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257 /* PropertyAssignment */) { + if (p.kind === 260 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258 /* ShorthandPropertyAssignment */) { + else if (p.kind === 261 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259 /* SpreadAssignment */) { + else if (p.kind === 262 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -21521,7 +22453,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) { + if (operator === 57 /* EqualsToken */ && node.left.kind === 179 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21532,7 +22464,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -21565,19 +22497,37 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) { + if (node.initializer || node.parent.parent.kind === 214 /* ForInStatement */ || node.parent.parent.kind === 215 /* ForOfStatement */) { bindInitializedVariableFlow(node); } } + function bindJSDocComment(node) { + ts.forEachChild(node, function (n) { + if (n.kind !== 289 /* JSDocTypedefTag */) { + bind(n); + } + }); + } + function bindJSDocTypedefTag(node) { + ts.forEachChild(node, function (n) { + // if the node has a fullName "A.B.C", that means symbol "C" was already bound + // when we visit "fullName"; so when we visit the name "C" as the next child of + // the jsDocTypedefTag, we should skip binding it. + if (node.fullName && n === node.name && node.fullName.kind !== 70 /* Identifier */) { + return; + } + bind(n); + }); + } function bindCallExpressionFlow(node) { // If the target of the call expression is a function expression or arrow function we have // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = node.expression; - while (expr.kind === 183 /* ParenthesizedExpression */) { + while (expr.kind === 184 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) { + if (expr.kind === 185 /* FunctionExpression */ || expr.kind === 186 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -21585,7 +22535,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21594,52 +22544,54 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 291 /* JSDocTypeLiteral */: + case 274 /* JSDocRecordType */: + case 253 /* JsxAttributes */: return 1 /* IsContainer */; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 274 /* JSDocFunctionType */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 278 /* JSDocFunctionType */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 261 /* SourceFile */: + case 264 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; } - case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + // falls through + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 256 /* CatchClause */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 232 /* CaseBlock */: + case 259 /* CatchClause */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 234 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 204 /* Block */: + case 206 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -21676,42 +22628,43 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261 /* SourceFile */: + case 264 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161 /* TypeLiteral */: - case 176 /* ObjectLiteralExpression */: - case 227 /* InterfaceDeclaration */: - case 270 /* JSDocRecordType */: - case 287 /* JSDocTypeLiteral */: + case 162 /* TypeLiteral */: + case 177 /* ObjectLiteralExpression */: + case 229 /* InterfaceDeclaration */: + case 274 /* JSDocRecordType */: + case 291 /* JSDocTypeLiteral */: + case 253 /* JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: - case 228 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 278 /* JSDocFunctionType */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -21729,14 +22682,14 @@ var ts; function declareSourceFileMember(node, symbolFlags, symbolExcludes) { return ts.isExternalModule(file) ? declareModuleMember(node, symbolFlags, symbolExcludes) - : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); + : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 261 /* SourceFile */ || body.kind === 231 /* ModuleBlock */)) { + var body = node.kind === 264 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 264 /* SourceFile */ || body.kind === 233 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 /* ExportDeclaration */ || stat.kind === 240 /* ExportAssignment */) { + if (stat.kind === 243 /* ExportDeclaration */ || stat.kind === 242 /* ExportAssignment */) { return true; } } @@ -21760,7 +22713,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -21780,12 +22733,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0 /* NonInstantiated */) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + var state = declareModuleSymbol(node); + if (state !== 0 /* NonInstantiated */) { if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { // if module was already merged with some function, class or non-const enum // treat is a non-const-enum-only @@ -21805,6 +22754,12 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0 /* NonInstantiated */; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 /* ValueModule */ : 1024 /* NamespaceModule */, instantiated ? 106639 /* ValueModuleExcludes */ : 0 /* NamespaceModuleExcludes */); + return state; + } function bindFunctionOrConstructorType(node) { // For a given function symbol "<...>(...) => T" we want to generate a symbol identical // to the one we would get for: { <...>(...): T } @@ -21817,7 +22772,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { var ElementKind; @@ -21829,7 +22784,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { + if (prop.kind === 262 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { continue; } var identifier = prop.name; @@ -21841,12 +22796,12 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ + var currentKind = prop.kind === 260 /* PropertyAssignment */ || prop.kind === 261 /* ShorthandPropertyAssignment */ || prop.kind === 150 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { @@ -21857,27 +22812,33 @@ var ts; } return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object"); } + function bindJsxAttributes(node) { + return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__jsxAttributes"); + } + function bindJsxAttribute(node, symbolFlags, symbolExcludes) { + return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } function bindAnonymousDeclaration(node, symbolFlags, name) { var symbol = createSymbol(symbolFlags, name); addDeclarationToSymbol(symbol, node, symbolFlags); } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; } - // fall through. + // falls through default: if (!blockScopeContainer.locals) { blockScopeContainer.locals = ts.createMap(); addToContainerChain(blockScopeContainer); } - declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); + declareSymbol(blockScopeContainer.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } } function bindBlockScopedVariableDeclaration(node) { @@ -21977,8 +22938,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 261 /* SourceFile */ && - blockScopeContainer.kind !== 230 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 264 /* SourceFile */ && + blockScopeContainer.kind !== 232 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -21988,7 +22949,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.isOctalLiteral) { + if (inStrictMode && node.numericLiteralFlags & 4 /* Octal */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -22028,6 +22989,18 @@ var ts; } node.parent = parent; var saveInStrictMode = inStrictMode; + // Even though in the AST the jsdoc @typedef node belongs to the current node, + // its symbol might be in the same scope with the current node's symbol. Consider: + // + // /** @typedef {string | number} MyType */ + // function foo(); + // + // Here the current node is "foo", which is a container, but the scope of "MyType" should + // not be inside "foo". Therefore we always bind @typedef before bind the parent node, + // and skip binding this tag later when binding all the other jsdoc tags. + if (ts.isInJavaScriptFile(node)) { + bindJSDocTypedefTagIfAny(node); + } // First we bind declaration nodes to a symbol if possible. We'll both create a symbol // and then potentially add the symbol to an appropriate symbol table. Possible // destination symbol tables are: @@ -22044,7 +23017,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 140 /* LastToken */) { + if (node.kind > 141 /* LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -22061,6 +23034,26 @@ var ts; } inStrictMode = saveInStrictMode; } + function bindJSDocTypedefTagIfAny(node) { + if (!node.jsDoc) { + return; + } + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (!jsDoc.tags) { + continue; + } + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { + var tag = _c[_b]; + if (tag.kind === 289 /* JSDocTypedefTag */) { + var savedParent = parent; + parent = jsDoc; + bind(tag); + parent = savedParent; + } + } + } + } function updateStrictModeStatementList(statements) { if (!inStrictMode) { for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { @@ -22091,91 +23084,90 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 289 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); break; } + // falls through case 98 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 261 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192 /* BinaryExpression */: - if (ts.isInJavaScriptFile(node)) { - var specialKind = ts.getSpecialPropertyAssignmentKind(node); - switch (specialKind) { - case 1 /* ExportsProperty */: - bindExportsPropertyAssignment(node); - break; - case 2 /* ModuleExports */: - bindModuleExportsAssignment(node); - break; - case 3 /* PrototypeProperty */: - bindPrototypePropertyAssignment(node); - break; - case 4 /* ThisProperty */: - bindThisPropertyAssignment(node); - break; - case 0 /* None */: - // Nothing to do - break; - default: - ts.Debug.fail("Unknown special property assignment kind"); - } + case 193 /* BinaryExpression */: + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1 /* ExportsProperty */: + bindExportsPropertyAssignment(node); + break; + case 2 /* ModuleExports */: + bindModuleExportsAssignment(node); + break; + case 3 /* PrototypeProperty */: + bindPrototypePropertyAssignment(node); + break; + case 4 /* ThisProperty */: + bindThisPropertyAssignment(node); + break; + case 5 /* Property */: + bindStaticPropertyAssignment(node); + break; + case 0 /* None */: + // Nothing to do + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return checkStrictModeCatchClause(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return checkStrictModeWithStatement(node); - case 167 /* ThisType */: + case 168 /* ThisType */: seenThisKeyword = true; return; - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */); - case 144 /* Parameter */: + case 145 /* Parameter */: return bindParameter(node); - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - if (node.dotDotDotToken && node.parent.kind === 172 /* ObjectBindingPattern */) { - emitFlags |= 32768 /* HasRestAttribute */; - } + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 271 /* JSDocRecordMember */: - return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 286 /* JSDocPropertyTag */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 275 /* JSDocRecordMember */: + return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); + case 290 /* JSDocPropertyTag */: return bindJSDocProperty(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 260 /* EnumMember */: + case 263 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 259 /* SpreadAssignment */: - case 251 /* JsxSpreadAttribute */: + case 262 /* SpreadAssignment */: + case 254 /* JsxSpreadAttribute */: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 /* ObjectLiteralExpression */ && - root.parent.kind === 192 /* BinaryExpression */ && + if (root.kind === 177 /* ObjectLiteralExpression */ && + root.parent.kind === 193 /* BinaryExpression */ && root.parent.operatorToken.kind === 57 /* EqualsToken */ && root.parent.left === root) { hasRest = true; @@ -22183,88 +23175,92 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 /* HasRestAttribute */ : 16384 /* HasSpreadAttribute */; return; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. - return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 225 /* FunctionDeclaration */: + return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); + case 227 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 274 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 278 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 161 /* TypeLiteral */: - case 170 /* MappedType */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 291 /* JSDocTypeLiteral */: + case 274 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return bindFunctionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } break; - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return bindModuleDeclaration(node); + // Jsx-attributes + case 253 /* JsxAttributes */: + return bindJsxAttributes(node); + case 252 /* JsxAttribute */: + return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports - case 234 /* ImportEqualsDeclaration */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 233 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 236 /* ImportClause */: + case 238 /* ImportClause */: return bindImportClause(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return bindExportDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return bindExportAssignment(node); - case 261 /* SourceFile */: + case 264 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204 /* Block */: + case 206 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } - // Fall through - case 231 /* ModuleBlock */: + // falls through + case 233 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); } } @@ -22273,7 +23269,7 @@ var ts; if (parameterName && parameterName.kind === 70 /* Identifier */) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167 /* ThisType */) { + if (parameterName && parameterName.kind === 168 /* ThisType */) { seenThisKeyword = true; } bind(type); @@ -22296,7 +23292,7 @@ var ts; // An export default clause with an expression exports a value // We want to exclude both class and function here, this is necessary to issue an error when there are both // default export-assignment and default export function and class declaration. - var flags = node.kind === 240 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) ? 8388608 /* Alias */ : 4 /* Property */; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */); @@ -22306,17 +23302,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261 /* SourceFile */) { + if (node.parent.kind !== 264 /* SourceFile */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -22327,11 +23323,11 @@ var ts; function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { // Export * in some sort of block construct - bindAnonymousDeclaration(node, 1073741824 /* ExportStar */, getDeclarationName(node)); + bindAnonymousDeclaration(node, 33554432 /* ExportStar */, getDeclarationName(node)); } else if (!node.exportClause) { // All export * declarations are collected in an __export symbol - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0 /* None */); + declareSymbol(container.symbol.exports, container.symbol, node, 33554432 /* ExportStar */, 0 /* None */); } } function bindImportClause(node) { @@ -22353,30 +23349,67 @@ var ts; setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node.left, 4 /* Property */ | 7340032 /* Export */, 0 /* None */); } + function isExportsOrModuleExportsOrAlias(node) { + return ts.isExportsIdentifier(node) || + ts.isModuleExportsPropertyAccessExpression(node) || + isNameOfExportsOrModuleExportsAliasDeclaration(node); + } + function isNameOfExportsOrModuleExportsAliasDeclaration(node) { + if (node.kind === 70 /* Identifier */) { + var symbol = lookupSymbolForName(node.text); + if (symbol && symbol.valueDeclaration && symbol.valueDeclaration.kind === 225 /* VariableDeclaration */) { + var declaration = symbol.valueDeclaration; + if (declaration.initializer) { + return isExportsOrModuleExportsOrAliasOrAssignemnt(declaration.initializer); + } + } + } + return false; + } + function isExportsOrModuleExportsOrAliasOrAssignemnt(node) { + return isExportsOrModuleExportsOrAlias(node) || + (ts.isAssignmentExpression(node, /*excludeCompoundAssignements*/ true) && (isExportsOrModuleExportsOrAliasOrAssignemnt(node.left) || isExportsOrModuleExportsOrAliasOrAssignemnt(node.right))); + } function bindModuleExportsAssignment(node) { + // A common practice in node modules is to set 'export = module.exports = {}', this ensures that 'exports' + // is still pointing to 'module.exports'. + // We do not want to consider this as 'export=' since a module can have only one of these. + // Similarlly we do not want to treat 'module.exports = exports' as an 'export='. + var assignedExpression = ts.getRightMostAssignedExpression(node.right); + if (ts.isEmptyObjectLiteral(assignedExpression) || isExportsOrModuleExportsOrAlias(assignedExpression)) { + // Mark it as a module in case there are no other exports in the file + setCommonJsModuleIndicator(node); + return; + } // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node, 4 /* Property */ | 7340032 /* Export */ | 512 /* ValueModule */, 0 /* None */); } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - // Declare a 'member' if the container is an ES5 class or ES6 constructor - if (container.kind === 225 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { - container.symbol.members = container.symbol.members || ts.createMap(); - // It's acceptable for multiple 'this' assignments of the same identifier to occur - declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); - } - else if (container.kind === 150 /* Constructor */) { - // this.foo assignment in a JavaScript class - // Bind this property to the containing class - var saveContainer = container; - container = container.parent; - var symbol = bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* None */); - if (symbol) { - // constructor-declared symbols can be overwritten by subsequent method declarations - symbol.isReplaceableByMethod = true; - } - container = saveContainer; + var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); + switch (container.kind) { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + // Declare a 'member' if the container is an ES5 class or ES6 constructor + container.symbol.members = container.symbol.members || ts.createMap(); + // It's acceptable for multiple 'this' assignments of the same identifier to occur + declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); + break; + case 151 /* Constructor */: + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + // this.foo assignment in a JavaScript class + // Bind this property to the containing class + var containingClass = container.parent; + var symbol = declareSymbol(ts.hasModifier(container, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members, containingClass.symbol, node, 4 /* Property */, 0 /* None */); + if (symbol) { + // symbols declared through 'this' property assignements can be overwritten by subsequent method declarations + symbol.isReplaceableByMethod = true; + } + break; } } function bindPrototypePropertyAssignment(node) { @@ -22390,16 +23423,44 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; - if (!funcSymbol || !(funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) { + bindPropertyAssignment(constructorFunction.text, leftSideOfAssignment, /*isPrototypeProperty*/ true); + } + function bindStaticPropertyAssignment(node) { + // We saw a node of the form 'x.y = z'. Declare a 'member' y on x if x was a function. + // Look up the function in the local scope, since prototype assignments should + // follow the function declaration + var leftSideOfAssignment = node.left; + var target = leftSideOfAssignment.expression; + // Fix up parent pointers since we're going to use these nodes before we bind into them + leftSideOfAssignment.parent = node; + target.parent = leftSideOfAssignment; + if (isNameOfExportsOrModuleExportsAliasDeclaration(target)) { + // This can be an alias for the 'exports' or 'module.exports' names, e.g. + // var util = module.exports; + // util.property = function ... + bindExportsPropertyAssignment(node); + } + else { + bindPropertyAssignment(target.text, leftSideOfAssignment, /*isPrototypeProperty*/ false); + } + } + function lookupSymbolForName(name) { + return (container.symbol && container.symbol.exports && container.symbol.exports.get(name)) || (container.locals && container.locals.get(name)); + } + function bindPropertyAssignment(functionName, propertyAccessExpression, isPrototypeProperty) { + var targetSymbol = lookupSymbolForName(functionName); + if (targetSymbol && ts.isDeclarationOfFunctionOrClassExpression(targetSymbol)) { + targetSymbol = targetSymbol.valueDeclaration.initializer.symbol; + } + if (!targetSymbol || !(targetSymbol.flags & (16 /* Function */ | 32 /* Class */))) { return; } // Set up the members collection if it doesn't exist already - if (!funcSymbol.members) { - funcSymbol.members = ts.createMap(); - } + var symbolTable = isPrototypeProperty ? + (targetSymbol.members || (targetSymbol.members = ts.createMap())) : + (targetSymbol.exports || (targetSymbol.exports = ts.createMap())); // Declare the method/property - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4 /* Property */, 0 /* PropertyExcludes */); + declareSymbol(symbolTable, targetSymbol, propertyAccessExpression, 4 /* Property */, 0 /* PropertyExcludes */); } function bindCallExpression(node) { // We're only inspecting call expressions to detect CommonJS modules, so we can skip @@ -22409,15 +23470,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024 /* HasClassExtends */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; - } - } - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -22425,7 +23478,7 @@ var ts; bindAnonymousDeclaration(node, 32 /* Class */, bindingName); // Add name of class expression into the map for semantic classifier if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; @@ -22438,14 +23491,15 @@ var ts; // Note: we check for this here because this class may be merging into a module. The // module might have an exported variable called 'prototype'. We can't allow that as // that would clash with the built-in 'prototype' for the class. - var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var prototypeSymbol = createSymbol(4 /* Property */ | 16777216 /* Prototype */, "prototype"); + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -22479,11 +23533,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 /* HasDecorators */ | 4096 /* HasParamDecorators */); - } if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -22499,13 +23548,13 @@ var ts; // containing class. if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); } } function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024 /* HasAsyncFunctions */; } } checkStrictModeFunctionName(node); @@ -22519,8 +23568,8 @@ var ts; } function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow) { @@ -22532,11 +23581,8 @@ var ts; } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -22561,13 +23607,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 206 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 208 /* EmptyStatement */) || // report error on class declarations - node.kind === 226 /* ClassDeclaration */ || + node.kind === 228 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 230 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 232 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 229 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 231 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -22581,7 +23627,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 /* VariableStatement */ || + (node.kind !== 207 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -22601,56 +23647,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); - case 144 /* Parameter */: + case 145 /* Parameter */: return computeParameter(node, subtreeFlags); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150 /* Constructor */: + case 151 /* Constructor */: return computeConstructor(node, subtreeFlags); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return computePropertyDeclaration(node, subtreeFlags); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return computeMethod(node, subtreeFlags); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -22677,8 +23723,8 @@ var ts; switch (kind) { case 96 /* SuperKeyword */: return true; - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96 /* SuperKeyword */; @@ -22702,12 +23748,12 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 177 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } @@ -22757,8 +23803,8 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (expressionKind === 200 /* AsExpression */ - || expressionKind === 182 /* TypeAssertionExpression */) { + if (expressionKind === 201 /* AsExpression */ + || expressionKind === 183 /* TypeAssertionExpression */) { transformFlags |= 3 /* AssertTypeScript */; } // If the expression of a ParenthesizedExpression is a destructuring assignment, @@ -22883,10 +23929,9 @@ var ts; } // An async method declaration is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 16 /* AssertES2017 */; + transformFlags |= node.asteriskToken ? 8 /* AssertESNext */ : 16 /* AssertES2017 */; } - // Currently, we only support generators that were originally async function bodies. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + if (node.asteriskToken) { transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -22940,7 +23985,7 @@ var ts; } // An async function declaration is ES2017 syntax. if (modifierFlags & 256 /* Async */) { - transformFlags |= 16 /* AssertES2017 */; + transformFlags |= node.asteriskToken ? 8 /* AssertESNext */ : 16 /* AssertES2017 */; } // function declarations with object rest destructuring are ES Next syntax if (subtreeFlags & 1048576 /* ContainsObjectRest */) { @@ -22957,7 +24002,7 @@ var ts; // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + if (node.asteriskToken) { transformFlags |= 768 /* AssertGenerator */; } } @@ -22975,7 +24020,7 @@ var ts; } // An async function expression is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 16 /* AssertES2017 */; + transformFlags |= node.asteriskToken ? 8 /* AssertESNext */ : 16 /* AssertES2017 */; } // function expressions with object rest destructuring are ES Next syntax if (subtreeFlags & 1048576 /* ContainsObjectRest */) { @@ -22990,9 +24035,7 @@ var ts; // If a FunctionExpression is generator function and is the body of a // transformed async function, then this node can be transformed to a // down-level generator. - // Currently we do not support transforming any other generator fucntions - // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + if (node.asteriskToken) { transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -23123,9 +24166,9 @@ var ts; var excludeFlags = 536872257 /* NodeExcludes */; switch (kind) { case 119 /* AsyncKeyword */: - case 189 /* AwaitExpression */: - // async/await is ES2017 syntax - transformFlags |= 16 /* AssertES2017 */; + case 190 /* AwaitExpression */: + // async/await is ES2017 syntax, but may be ESNext syntax (for async generators) + transformFlags |= 8 /* AssertESNext */ | 16 /* AssertES2017 */; break; case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: @@ -23133,81 +24176,98 @@ var ts; case 116 /* AbstractKeyword */: case 123 /* DeclareKeyword */: case 75 /* ConstKeyword */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - case 201 /* NonNullExpression */: + case 231 /* EnumDeclaration */: + case 263 /* EnumMember */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + case 202 /* NonNullExpression */: case 130 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: case 10 /* JsxText */: - case 249 /* JsxClosingElement */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - case 252 /* JsxExpression */: + case 251 /* JsxClosingElement */: + case 252 /* JsxAttribute */: + case 253 /* JsxAttributes */: + case 254 /* JsxSpreadAttribute */: + case 255 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; - case 213 /* ForOfStatement */: - // for-of might be ESNext if it has a rest destructuring - transformFlags |= 8 /* AssertESNext */; - // FALLTHROUGH case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: - case 194 /* TemplateExpression */: - case 181 /* TaggedTemplateExpression */: - case 258 /* ShorthandPropertyAssignment */: + case 195 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 261 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: + case 203 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; - case 195 /* YieldExpression */: - // This node is ES6 syntax. - transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; + case 9 /* StringLiteral */: + if (node.hasExtendedUnicodeEscape) { + transformFlags |= 192 /* AssertES2015 */; + } + break; + case 8 /* NumericLiteral */: + if (node.numericLiteralFlags & 48 /* BinaryOrOctalSpecifier */) { + transformFlags |= 192 /* AssertES2015 */; + } + break; + case 215 /* ForOfStatement */: + // This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of). + if (node.awaitModifier) { + transformFlags |= 8 /* AssertESNext */; + } + transformFlags |= 192 /* AssertES2015 */; + break; + case 196 /* YieldExpression */: + // This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async + // generator). + transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; break; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 156 /* TypePredicate */: - case 157 /* TypeReference */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 160 /* TypeQuery */: - case 161 /* TypeLiteral */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 157 /* TypePredicate */: + case 158 /* TypeReference */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 161 /* TypeQuery */: + case 162 /* TypeLiteral */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 3 /* AssertTypeScript */; excludeFlags = -3 /* TypeExcludes */; break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: // Even though computed property names are ES6, we don't treat them as such. // This is so that they can flow through PropertyName transforms unaffected. // Instead, we mark the container as ES6, so that it can properly handle the transform. @@ -23224,10 +24284,10 @@ var ts; transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 96 /* SuperKeyword */: @@ -23238,28 +24298,28 @@ var ts; // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 16384 /* ContainsLexicalThis */; break; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; if (subtreeFlags & 524288 /* ContainsRest */) { transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: transformFlags |= 192 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 524288 /* ContainsRest */; } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: excludeFlags = 540087617 /* ObjectLiteralExcludes */; if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -23277,8 +24337,8 @@ var ts; transformFlags |= 8 /* AssertESNext */; } break; - case 175 /* ArrayLiteralExpression */: - case 180 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: + case 181 /* NewExpression */: excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */; if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 @@ -23286,23 +24346,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 216 /* ReturnStatement */: - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 218 /* ReturnStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -23318,56 +24378,57 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) { + if (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) { return -3 /* TypeExcludes */; } switch (kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 175 /* ArrayLiteralExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return 574674241 /* ModuleExcludes */; - case 144 /* Parameter */: + case 145 /* Parameter */: return 536872257 /* ParameterExcludes */; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return 601249089 /* ArrowFunctionExcludes */; - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: return 601281857 /* FunctionExcludes */; - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return 546309441 /* VariableDeclarationListExcludes */; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return 539358529 /* ClassExcludes */; - case 150 /* Constructor */: + case 151 /* Constructor */: return 601015617 /* ConstructorExcludes */; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return 601015617 /* MethodOrAccessorExcludes */; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: + case 133 /* ObjectKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 256 /* CatchClause */: + case 259 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return 537396545 /* BindingPatternExcludes */; default: return 536872257 /* NodeExcludes */; @@ -23406,10 +24467,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - /** Create Resolved from a file with unknown extension. */ - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */ function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; @@ -23422,37 +24479,29 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + /** Reads from "main" or "types"/"typings" depending on `extensions`. */ + function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); - switch (extensions) { - case 2 /* DtsOnly */: - case 0 /* TypeScript */: - return tryReadFromField("typings") || tryReadFromField("types"); - case 1 /* JavaScript */: - if (typeof jsonContent.main === "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); - } - return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main)); - } - return undefined; - } + return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); function tryReadFromField(fieldName) { - if (ts.hasProperty(jsonContent, fieldName)) { - var typesFile = jsonContent[fieldName]; - if (typeof typesFile === "string") { - var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); - } - return typesFilePath; + if (!ts.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); - } + return; + } + var fileName = jsonContent[fieldName]; + if (typeof fileName !== "string") { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); } + return; } + var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); + } + return path; } } function readJson(path, host) { @@ -23488,13 +24537,15 @@ var ts; function getDefaultTypeRoots(currentDirectory, host) { if (!host.directoryExists) { return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; + // And if it doesn't exist, tough. } var typeRoots; - forEachAncestorDirectory(currentDirectory, function (directory) { + forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -23555,7 +24606,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2 /* DtsOnly */, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -23572,7 +24627,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2 /* DtsOnly */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*cache*/ undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -23587,13 +24643,13 @@ var ts; } ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; /** - * Given a set of options, returns the set of type directive names - * that should be included for this program automatically. - * This list could either come from the config file, - * or from enumerating the types root + initial secondary types lookup location. - * More type directives might appear in the program later as a result of loading actual source files; - * this list is only the set of defaults that are implicitly included. - */ + * Given a set of options, returns the set of type directive names + * that should be included for this program automatically. + * This list could either come from the config file, + * or from enumerating the types root + initial secondary types lookup location. + * More type directives might appear in the program later as a result of loading actual source files; + * this list is only the set of defaults that are implicitly included. + */ function getAutomaticTypeDirectiveNames(options, host) { // Use explicit type list from tsconfig.json if (options.types) { @@ -23625,31 +24681,135 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); + if (!perModuleNameCache) { + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + /** + * At first this function add entry directory -> module resolution result to the table. + * Then it computes the set of parent folders for 'directory' that should have the same module resolution result + * and for every parent folder in set it adds entry: parent -> module resolution. . + * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. + * Set of parent folders that should have the same result will be: + * [ + * /a/b/c/d, /a/b/c, /a/b + * ] + * this means that request for module resolution from file in any of these folder will be immediately found in cache. + */ + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + // if entry is already in cache do nothing + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + // find common prefix between directory and resolved file name + // this common prefix should be the shorted path that has the same resolution + // directory: /a/b/c/d/e + // resolvedFileName: /a/b/foo.d.ts + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + if (current === commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + // find first position where directory and resolution differs + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + // find last directory separator before position i + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache.get(moduleName); + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache.set(moduleName, result); + // put result in per-module name cache + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -23842,38 +25002,45 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, /*jsOnly*/ false); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + /* @internal */ + function nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, jsOnly) { + if (jsOnly === void 0) { jsOnly = false; } var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { - var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); + var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, /*considerPackageJson*/ true); }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state, /*considerPackageJson*/ true); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } - ts.nodeModuleNameResolver = nodeModuleNameResolver; + ts.nodeModuleNameResolverWorker = nodeModuleNameResolverWorker; function realpath(path, host, traceEnabled) { if (!host.realpath) { return path; @@ -23884,12 +25051,35 @@ var ts; } return real; } - function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); + } + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); } /* @internal */ function directoryProbablyExists(directoryName, host) { @@ -23928,11 +25118,11 @@ var ts; } } switch (extensions) { - case 2 /* DtsOnly */: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0 /* TypeScript */: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1 /* JavaScript */: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -23942,120 +25132,191 @@ var ts; } /** Return the file if it exists. */ function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var packageJsonPath = pathToPackageJson(candidate); + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { considerPackageJson = true; } var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - // A package.json "typings" may specify an exact filename, or may choose to omit an extension. - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - // Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden. - return resolvedFromAnyFile(fromFile); - } - var x = tryAddingExtensions(typesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + if (considerPackageJson) { + var packageJsonPath = pathToPackageJson(candidate); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state); + if (fromPackageJson) { + return fromPackageJson; } } else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field); + if (directoryExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } + // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results + failedLookupLocations.push(packageJsonPath); } } - else { + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state); + if (!file) { + return undefined; + } + var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); + var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); + if (fromFile) { + var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + if (resolved) { + return resolved; + } if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); } - // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results - failedLookupLocations.push(packageJsonPath); } - return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + // Even if extensions is DtsOnly, we can still look up a .ts file as a result of package.json "types" + var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; + // Don't do package.json lookup recursively, because Node.js' package lookup doesn't. + return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, /*considerPackageJson*/ false); + } + /** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */ + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + /** True if `extension` is one of the supported `extensions`. */ + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly. - return loadModuleFromNodeModulesWorker(2 /* DtsOnly */, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true, /*cache*/ undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */ function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1 /* JavaScript */) { - return loadModuleFromNodeModulesFolder(2 /* DtsOnly */, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); + } + } + /** For a scoped package, we must look in `@types/foo__bar` instead of `@types/@foo/bar`. */ + function mangleScopedPackage(moduleName, state) { + if (ts.startsWith(moduleName, "@")) { + var replaceSlash = moduleName.replace(ts.directorySeparator, "__"); + if (replaceSlash !== moduleName) { + var mangled = replaceSlash.slice(1); // Take off the "@" + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; + } + } + return moduleName; + } + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { // Climb up parent directories looking for a module. var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state)); }); if (resolved_3) { return resolved_3; } - if (extensions === 0 /* TypeScript */) { + if (extensions === Extensions.TypeScript) { // If we didn't find the file normally, look it up in @types. return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state)); } } } @@ -24072,10 +25333,17 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2 /* DtsOnly */, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + /** + * Wraps value to SearchResult. + * @returns undefined if value is undefined or { value } otherwise + */ + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ function forEachAncestorDirectory(directory, callback) { while (true) { @@ -24128,23 +25396,34 @@ var ts; // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; var symbolCount = 0; + var symbolInstantiationDepth = 0; var emptyArray = []; var emptySymbols = ts.createMap(); var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); var modulekind = ts.getEmitModuleKind(compilerOptions); var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters; var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; - var strictNullChecks = compilerOptions.strictNullChecks; + var strictNullChecks = compilerOptions.strictNullChecks === undefined ? compilerOptions.strict : compilerOptions.strictNullChecks; + var noImplicitAny = compilerOptions.noImplicitAny === undefined ? compilerOptions.strict : compilerOptions.noImplicitAny; + var noImplicitThis = compilerOptions.noImplicitThis === undefined ? compilerOptions.strict : compilerOptions.noImplicitThis; var emitResolver = createResolver(); - var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); + var nodeBuilder = createNodeBuilder(); + var undefinedSymbol = createSymbol(4 /* Property */, "undefined"); undefinedSymbol.declarations = []; - var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "arguments"); + var argumentsSymbol = createSymbol(4 /* Property */, "arguments"); + // for public members that accept a Node or one of its subtypes, we must guard against + // synthetic nodes created during transformations by calling `getParseTreeNode`. + // for most of these, we perform the guard only on `checker` to avoid any possible + // extra cost of calling `getParseTreeNode` when calling these functions from inside the + // checker. var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, @@ -24153,49 +25432,129 @@ var ts; isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, + getMergedSymbol: getMergedSymbol, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, - getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, + getTypeOfSymbolAtLocation: function (symbol, location) { + location = ts.getParseTreeNode(location); + return location ? getTypeOfSymbolAtLocation(symbol, location) : unknownType; + }, + getSymbolsOfParameterPropertyDeclaration: function (parameter, parameterName) { + parameter = ts.getParseTreeNode(parameter, ts.isParameter); + ts.Debug.assert(parameter !== undefined, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); + return getSymbolsOfParameterPropertyDeclaration(parameter, parameterName); + }, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getBaseTypeOfLiteralType: getBaseTypeOfLiteralType, + getWidenedType: getWidenedType, + getTypeFromTypeNode: function (node) { + node = ts.getParseTreeNode(node, ts.isTypeNode); + return node ? getTypeFromTypeNode(node) : unknownType; + }, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, - getSymbolsInScope: getSymbolsInScope, - getSymbolAtLocation: getSymbolAtLocation, - getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, - getTypeAtLocation: getTypeOfNode, - getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, - typeToString: typeToString, + typeToTypeNode: nodeBuilder.typeToTypeNode, + indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, + signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, + getSymbolsInScope: function (location, meaning) { + location = ts.getParseTreeNode(location); + return location ? getSymbolsInScope(location, meaning) : []; + }, + getSymbolAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getSymbolAtLocation(node) : undefined; + }, + getShorthandAssignmentValueSymbol: function (node) { + node = ts.getParseTreeNode(node); + return node ? getShorthandAssignmentValueSymbol(node) : undefined; + }, + getExportSpecifierLocalTargetSymbol: function (node) { + node = ts.getParseTreeNode(node, ts.isExportSpecifier); + return node ? getExportSpecifierLocalTargetSymbol(node) : undefined; + }, + getTypeAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getTypeOfNode(node) : unknownType; + }, + getPropertySymbolOfDestructuringAssignment: function (location) { + location = ts.getParseTreeNode(location, ts.isIdentifier); + return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; + }, + signatureToString: function (signature, enclosingDeclaration, flags, kind) { + return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind); + }, + typeToString: function (type, enclosingDeclaration, flags) { + return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags); + }, getSymbolDisplayBuilder: getSymbolDisplayBuilder, - symbolToString: symbolToString, + symbolToString: function (symbol, enclosingDeclaration, meaning) { + return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning); + }, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: function (node) { + node = ts.getParseTreeNode(node, ts.isExpression); + return node ? getContextualType(node) : undefined; + }, getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: getResolvedSignature, - getConstantValue: getConstantValue, - isValidPropertyAccess: isValidPropertyAccess, - getSignatureFromDeclaration: getSignatureFromDeclaration, - isImplementationOfOverload: isImplementationOfOverload, + getResolvedSignature: function (node, candidatesOutArray) { + node = ts.getParseTreeNode(node, ts.isCallLikeExpression); + return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + }, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, + isValidPropertyAccess: function (node, propertyName) { + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + return node ? isValidPropertyAccess(node, propertyName) : false; + }, + getSignatureFromDeclaration: function (declaration) { + declaration = ts.getParseTreeNode(declaration, ts.isFunctionLike); + return declaration ? getSignatureFromDeclaration(declaration) : undefined; + }, + isImplementationOfOverload: function (node) { + node = ts.getParseTreeNode(node, ts.isFunctionLike); + return node ? isImplementationOfOverload(node) : undefined; + }, + getImmediateAliasedSymbol: function (symbol) { + ts.Debug.assert((symbol.flags & 8388608 /* Alias */) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.immediateTarget) { + var node = getDeclarationOfAliasSymbol(symbol); + ts.Debug.assert(!!node); + links.immediateTarget = getTargetOfAliasDeclaration(node, /*dontRecursivelyResolve*/ true); + } + return links.immediateTarget; + }, getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, - getJsxElementAttributesType: getJsxElementAttributesType, + getAllAttributesTypeFromJsxOpeningLikeElement: function (node) { + node = ts.getParseTreeNode(node, ts.isJsxOpeningLikeElement); + return node ? getAllAttributesTypeFromJsxOpeningLikeElement(node) : undefined; + }, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, - isOptionalParameter: isOptionalParameter, + isOptionalParameter: function (node) { + node = ts.getParseTreeNode(node, ts.isParameter); + return node ? isOptionalParameter(node) : false; + }, tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { // we deliberately exclude augmentations // since we are only interested in declarations of the module itself return tryFindAmbientModule(moduleName, /*withAugmentations*/ false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -24204,8 +25563,8 @@ var ts; var numericLiteralTypes = ts.createMap(); var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; - var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); - var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); + var unknownSymbol = createSymbol(4 /* Property */, "unknown"); + var resolvingSymbol = createSymbol(0, "__resolving__"); var anyType = createIntrinsicType(1 /* Any */, "any"); var autoType = createIntrinsicType(1 /* Any */, "any"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); @@ -24222,8 +25581,9 @@ var ts; var voidType = createIntrinsicType(1024 /* Void */, "void"); var neverType = createIntrinsicType(8192 /* Never */, "never"); var silentNeverType = createIntrinsicType(8192 /* Never */, "never"); + var nonPrimitiveType = createIntrinsicType(16777216 /* NonPrimitive */, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type"); + var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -24233,21 +25593,20 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); + var jsObjectLiteralIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); var globals = ts.createMap(); /** * List of every ambient module with a "*" wildcard. * Unlike other ambient modules, these can't be stored in `globals` because symbol tables only deal with exact matches. * This is only used if there is no exact match. - */ + */ var patternAmbientModules; - var getGlobalESSymbolConstructorSymbol; - var getGlobalPromiseConstructorSymbol; - var tryGetGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -24256,29 +25615,29 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var globalThisType; var anyArrayType; var autoArrayType; var anyReadonlyArrayType; // The library files are only loaded when the feature is used. // This allows users to just specify library files they want to used through --lib // and they will not get an error from not having unrelated library files - var getGlobalTemplateStringsArrayType; - var getGlobalESSymbolType; - var getGlobalIterableType; - var getGlobalIteratorType; - var getGlobalIterableIteratorType; - var getGlobalClassDecoratorType; - var getGlobalParameterDecoratorType; - var getGlobalPropertyDecoratorType; - var getGlobalMethodDecoratorType; - var getGlobalTypedPropertyDescriptorType; - var getGlobalPromiseType; - var tryGetGlobalPromiseType; - var getGlobalPromiseLikeType; - var getInstantiatedGlobalPromiseLikeType; - var getGlobalPromiseConstructorLikeType; - var getGlobalThenableType; - var jsxElementClassType; + var deferredGlobalESSymbolConstructorSymbol; + var deferredGlobalESSymbolType; + var deferredGlobalTypedPropertyDescriptorType; + var deferredGlobalPromiseType; + var deferredGlobalPromiseConstructorSymbol; + var deferredGlobalPromiseConstructorLikeType; + var deferredGlobalIterableType; + var deferredGlobalIteratorType; + var deferredGlobalIterableIteratorType; + var deferredGlobalAsyncIterableType; + var deferredGlobalAsyncIteratorType; + var deferredGlobalAsyncIterableIteratorType; + var deferredGlobalTemplateStringsArrayType; + var deferredJsxElementClassType; + var deferredJsxElementType; + var deferredJsxStatelessElementType; var deferredNodes; var deferredUnusedIdentifierNodes; var flowLoopStart = 0; @@ -24299,6 +25658,7 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); var TypeFacts; @@ -24364,7 +25724,7 @@ var ts; TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; })(TypeFacts || (TypeFacts = {})); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1 /* TypeofEQString */, "number": 2 /* TypeofEQNumber */, "boolean": 4 /* TypeofEQBoolean */, @@ -24373,7 +25733,7 @@ var ts; "object": 16 /* TypeofEQObject */, "function": 32 /* TypeofEQFunction */ }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128 /* TypeofNEString */, "number": 256 /* TypeofNENumber */, "boolean": 512 /* TypeofNEBoolean */, @@ -24382,14 +25742,14 @@ var ts; "object": 2048 /* TypeofNEObject */, "function": 4096 /* TypeofNEFunction */ }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, "symbol": esSymbolType, "undefined": undefinedType }); - var jsxElementType; + var typeofType = createTypeofType(); var _jsxNamespace; var _jsxFactoryEntity; /** Things we lazy load from the JSX namespace */ @@ -24417,8 +25777,14 @@ var ts; TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); + var CheckMode; + (function (CheckMode) { + CheckMode[CheckMode["Normal"] = 0] = "Normal"; + CheckMode[CheckMode["SkipContextSensitive"] = 1] = "SkipContextSensitive"; + CheckMode[CheckMode["Inferential"] = 2] = "Inferential"; + })(CheckMode || (CheckMode = {})); var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -24450,7 +25816,12 @@ var ts; } function createSymbol(flags, name) { symbolCount++; - return new Symbol(flags, name); + var symbol = (new Symbol(flags | 134217728 /* Transient */, name)); + symbol.checkFlags = 0; + return symbol; + } + function isTransientSymbol(symbol) { + return (symbol.flags & 134217728 /* Transient */) !== 0; } function getExcludedSymbolFlags(flags) { var result = 0; @@ -24496,7 +25867,7 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 33554432 /* Merged */, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) @@ -24519,13 +25890,11 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 230 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 232 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 232 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -24538,6 +25907,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024 /* NamespaceModule */) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -24550,18 +25922,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { - if (!(targetSymbol.flags & 33554432 /* Merged */)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + if (!(targetSymbol.flags & 134217728 /* Transient */)) { + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -24590,7 +25963,7 @@ var ts; if (mainModule.flags & 1920 /* Namespace */) { // if module symbol has already been merged - it is safe to use it. // otherwise clone it - mainModule = mainModule.flags & 33554432 /* Merged */ ? mainModule : cloneSymbol(mainModule); + mainModule = mainModule.flags & 134217728 /* Transient */ ? mainModule : cloneSymbol(mainModule); mergeSymbol(mainModule, moduleAugmentation.symbol); } else { @@ -24599,21 +25972,22 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { // Error on redeclarations - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } } function getSymbolLinks(symbol) { - if (symbol.flags & 67108864 /* Transient */) + if (symbol.flags & 134217728 /* Transient */) return symbol; var id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}); @@ -24625,14 +25999,17 @@ var ts; function getObjectFlags(type) { return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } + function getCheckFlags(symbol) { + return symbol.flags & 134217728 /* Transient */ ? symbol.checkFlags : 0; + } function isGlobalSourceFile(node) { - return node.kind === 261 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 264 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } @@ -24669,12 +26046,12 @@ var ts; if (declarationFile !== useFile) { if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) || (!compilerOptions.outFile && !compilerOptions.out)) { - // nodes are in different files and order cannot be determines + // nodes are in different files and order cannot be determined return true; } // declaration is after usage // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) - if (isUsedInFunctionOrNonStaticProperty(usage)) { + if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { return true; } var sourceFiles = host.getSourceFiles(); @@ -24682,20 +26059,41 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== 223 /* VariableDeclaration */ || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 175 /* BindingElement */) { + // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) + var errorBindingElement = ts.getAncestor(usage, 175 /* BindingElement */); + if (errorBindingElement) { + return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || + declaration.pos < errorBindingElement.pos; + } + // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225 /* VariableDeclaration */), usage); + } + else if (declaration.kind === 225 /* VariableDeclaration */) { + // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; + } + // declaration is after usage, but it can still be legal if usage is deferred: + // 1. inside an export specifier + // 2. inside a function + // 3. inside an instance property initializer, a reference to a non-instance property + // 4. inside a static property initializer, a reference to a static method in the same class + // or if usage is in a type context: + // 1. inside a type query (typeof in type position) + if (usage.parent.kind === 245 /* ExportSpecifier */) { + // export specifiers do not use the variable, they only make it available for use + return true; } - // declaration is after usage - // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) var container = ts.getEnclosingBlockScopeContainer(declaration); - return isUsedInFunctionOrNonStaticProperty(usage, container); + return isInTypeQuery(usage) || isUsedInFunctionOrInstanceProperty(usage, declaration, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205 /* VariableStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 207 /* VariableStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -24704,8 +26102,8 @@ var ts; break; } switch (declaration.parent.parent.kind) { - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: // ForIn/ForOf case - use site should not be used in expression part if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; @@ -24713,25 +26111,31 @@ var ts; } return false; } - function isUsedInFunctionOrNonStaticProperty(usage, container) { - var current = usage; - while (current) { + function isUsedInFunctionOrInstanceProperty(usage, declaration, container) { + return !!ts.findAncestor(usage, function (current) { if (current === container) { - return false; + return "quit"; } if (ts.isFunctionLike(current)) { return true; } - var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 /* PropertyDeclaration */ && - (ts.getModifierFlags(current.parent) & 32 /* Static */) === 0 && + var initializerOfProperty = current.parent && + current.parent.kind === 148 /* PropertyDeclaration */ && current.parent.initializer === current; - if (initializerOfNonStaticProperty) { - return true; + if (initializerOfProperty) { + if (ts.getModifierFlags(current.parent) & 32 /* Static */) { + if (declaration.kind === 150 /* MethodDeclaration */) { + return true; + } + } + else { + var isDeclarationInstanceProperty = declaration.kind === 148 /* PropertyDeclaration */ && !(ts.getModifierFlags(declaration) & 32 /* Static */); + if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { + return true; + } + } } - current = current.parent; - } - return false; + }); } } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and @@ -24756,11 +26160,11 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 282 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || - lastLocation.kind === 144 /* Parameter */ || - lastLocation.kind === 143 /* TypeParameter */ + lastLocation.kind === 145 /* Parameter */ || + lastLocation.kind === 144 /* TypeParameter */ : false; } if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { @@ -24769,9 +26173,9 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 144 /* Parameter */ || + lastLocation.kind === 145 /* Parameter */ || (lastLocation === location.type && - result.valueDeclaration.kind === 144 /* Parameter */); + result.valueDeclaration.kind === 145 /* Parameter */); } } if (useResult) { @@ -24783,16 +26187,17 @@ var ts; } } switch (location.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230 /* ModuleDeclaration */: + // falls through + case 232 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 264 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. - if (result = moduleExports["default"]) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; @@ -24810,9 +26215,10 @@ var ts; // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, // which is not the desired behavior. - if (moduleExports[name] && - moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 243 /* ExportSpecifier */)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 /* Alias */ && + ts.getDeclarationOfKind(moduleExport, 245 /* ExportSpecifier */)) { break; } } @@ -24820,13 +26226,13 @@ var ts; break loop; } break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -24843,10 +26249,15 @@ var ts; } } break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) { + if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { + // ignore type parameters not declared in this container + result = undefined; + break; + } if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type @@ -24856,7 +26267,7 @@ var ts; } break loop; } - if (location.kind === 197 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 198 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -24872,9 +26283,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -24882,19 +26293,19 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -24907,7 +26318,7 @@ var ts; } } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -24916,7 +26327,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 144 /* Parameter */) { + if (location.parent && location.parent.kind === 145 /* Parameter */) { location = location.parent; } // @@ -24945,7 +26356,8 @@ var ts; !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && - !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { + !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && + !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } } @@ -24967,31 +26379,41 @@ var ts; // interface bar {} // } // const foo/*1*/: foo/*2*/.bar; - // The foo at /*1*/ and /*2*/ will share same symbol with two meaning - // block - scope variable and namespace module. However, only when we + // The foo at /*1*/ and /*2*/ will share same symbol with two meanings: + // block-scoped variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, - // we want to check for block- scoped - if (meaning & 2 /* BlockScopedVariable */) { + // we want to check for block-scoped + if (meaning & 2 /* BlockScopedVariable */ || + ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 107455 /* Value */) === 107455 /* Value */)) { var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); - if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */) { + if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } // If we're in an external module, we can't reference value symbols created from UMD export declarations if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 235 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } } return result; } + function isTypeParameterSymbolDeclaredInContainer(symbol, container) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.kind === 144 /* TypeParameter */ && decl.parent === container) { + return true; + } + } + return false; + } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { if ((errorLocation.kind === 70 /* Identifier */ && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { return false; } - var container = ts.getThisContainer(errorLocation, /* includeArrowFunctions */ true); + var container = ts.getThisContainer(errorLocation, /*includeArrowFunctions*/ true); var location = container; while (location) { if (ts.isClassLike(location.parent)) { @@ -25034,9 +26456,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -25063,13 +26485,38 @@ var ts; } return false; } + function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { + if (meaning & (107455 /* Value */ & ~1024 /* NamespaceModule */ & ~793064 /* Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, name); + return true; + } + } + else if (meaning & (793064 /* Type */ & ~1024 /* NamespaceModule */ & ~107455 /* Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~793064 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, name); + return true; + } + } + return false; + } function checkResolvedBlockScopedVariable(result, errorLocation) { - ts.Debug.assert((result.flags & 2 /* BlockScopedVariable */) !== 0); + ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */)); // Block-scoped variables cannot be used before their definition - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223 /* VariableDeclaration */), errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 231 /* EnumDeclaration */) ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + if (result.flags & 2 /* BlockScopedVariable */) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 32 /* Class */) { + error(errorLocation, ts.Diagnostics.Class_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 384 /* Enum */) { + error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } } } /* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached. @@ -25077,56 +26524,50 @@ var ts; * Return false if 'stopAt' node is reached or isFunctionLike(current) === true. */ function isSameScopeDescendentOf(initial, parent, stopAt) { - if (!parent) { - return false; - } - for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { - if (current === parent) { - return true; - } - } - return false; + return parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent; }); } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 235 /* ImportDeclaration */) { - node = node.parent; - } - return node; + return ts.findAncestor(node, function (n) { return n.kind === 237 /* ImportDeclaration */; }); } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } - function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } - return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); } - function getTargetOfImportClause(node) { + function getTargetOfImportClause(node, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default"), dontResolveAlias); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { - return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } return exportDefaultSymbol; } } - function getTargetOfNamespaceImport(node) { + function getTargetOfNamespaceImport(node, dontResolveAlias) { var moduleSpecifier = node.parent.parent.moduleSpecifier; - return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); + return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier, dontResolveAlias); } // This function creates a synthetic symbol that combines the value side of one symbol with the // type/namespace side of another symbol. Consider this example: @@ -25161,12 +26602,9 @@ var ts; result.exports = valueSymbol.exports; return result; } - function getExportOfModule(symbol, name) { + function getExportOfModule(symbol, name, dontResolveAlias) { if (symbol.flags & 1536 /* Module */) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; - if (exportedSymbol) { - return resolveSymbol(exportedSymbol); - } + return resolveSymbol(getExportsOfSymbol(symbol).get(name), dontResolveAlias); } } function getPropertyOfVariable(symbol, name) { @@ -25177,74 +26615,75 @@ var ts; } } } - function getExternalModuleMember(node, specifier) { + function getExternalModuleMember(node, specifier, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); + var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier, dontResolveAlias); if (targetSymbol) { - var name_16 = specifier.propertyName || specifier.name; - if (name_16.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; // First check if module was specified with "export=". If so, get the member from the resolved type - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } // if symbolFromVariable is export - get its final target - symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); + symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); + var symbolFromModule = getExportOfModule(targetSymbol, name.text, dontResolveAlias); // If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default - if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { - symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { + symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } } } - function getTargetOfImportSpecifier(node) { - return getExternalModuleMember(node.parent.parent.parent, node); + function getTargetOfImportSpecifier(node, dontResolveAlias) { + return getExternalModuleMember(node.parent.parent.parent, node, dontResolveAlias); } - function getTargetOfNamespaceExportDeclaration(node) { - return resolveExternalModuleSymbol(node.parent.symbol); + function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) { + return resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias); } - function getTargetOfExportSpecifier(node) { + function getTargetOfExportSpecifier(node, dontResolveAlias) { return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */); + getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : + resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } - function getTargetOfExportAssignment(node) { - return resolveEntityName(node.expression, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */); + function getTargetOfExportAssignment(node, dontResolveAlias) { + return resolveEntityName(node.expression, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } - function getTargetOfAliasDeclaration(node) { + function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - return getTargetOfImportEqualsDeclaration(node); - case 236 /* ImportClause */: - return getTargetOfImportClause(node); - case 237 /* NamespaceImport */: - return getTargetOfNamespaceImport(node); - case 239 /* ImportSpecifier */: - return getTargetOfImportSpecifier(node); - case 243 /* ExportSpecifier */: - return getTargetOfExportSpecifier(node); - case 240 /* ExportAssignment */: - return getTargetOfExportAssignment(node); - case 233 /* NamespaceExportDeclaration */: - return getTargetOfNamespaceExportDeclaration(node); - } - } - function resolveSymbol(symbol) { - return symbol && symbol.flags & 8388608 /* Alias */ && !(symbol.flags & (107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */)) ? resolveAlias(symbol) : symbol; + case 236 /* ImportEqualsDeclaration */: + return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); + case 238 /* ImportClause */: + return getTargetOfImportClause(node, dontRecursivelyResolve); + case 239 /* NamespaceImport */: + return getTargetOfNamespaceImport(node, dontRecursivelyResolve); + case 241 /* ImportSpecifier */: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 245 /* ExportSpecifier */: + return getTargetOfExportSpecifier(node, dontRecursivelyResolve); + case 242 /* ExportAssignment */: + return getTargetOfExportAssignment(node, dontRecursivelyResolve); + case 235 /* NamespaceExportDeclaration */: + return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); + } + } + function resolveSymbol(symbol, dontResolveAlias) { + var shouldResolve = !dontResolveAlias && symbol && symbol.flags & 8388608 /* Alias */ && !(symbol.flags & (107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */)); + return shouldResolve ? resolveAlias(symbol) : symbol; } function resolveAlias(symbol) { ts.Debug.assert((symbol.flags & 8388608 /* Alias */) !== 0, "Should only get Alias here."); @@ -25286,11 +26725,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240 /* ExportAssignment */) { + if (node.kind === 242 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 243 /* ExportSpecifier */) { + else if (node.kind === 245 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -25312,20 +26751,22 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 141 /* QualifiedName */) { + if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 142 /* QualifiedName */) { return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 234 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 236 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol) { return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } - // Resolves a qualified name and any involved aliases + /** + * Resolves a qualified name and any involved aliases. + */ function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) { if (ts.nodeIsMissing(name)) { return undefined; @@ -25338,9 +26779,23 @@ var ts; return undefined; } } - else if (name.kind === 141 /* QualifiedName */ || name.kind === 177 /* PropertyAccessExpression */) { - var left = name.kind === 141 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 141 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 142 /* QualifiedName */ || name.kind === 178 /* PropertyAccessExpression */) { + var left = void 0; + if (name.kind === 142 /* QualifiedName */) { + left = name.left; + } + else if (name.kind === 178 /* PropertyAccessExpression */ && + (name.expression.kind === 184 /* ParenthesizedExpression */ || ts.isEntityNameExpression(name.expression))) { + left = name.expression; + } + else { + // If the expression in property-access expression is not entity-name or parenthsizedExpression (e.g. it is a call expression), it won't be able to successfully resolve the name. + // This is the case when we are trying to do any language service operation in heritage clauses. By return undefined, the getSymbolOfEntityNameOrPropertyAccessExpression + // will attempt to checkPropertyAccessExpression to resolve symbol. + // i.e class C extends foo()./*do language service operation here*/B {} + return undefined; + } + var right = name.kind === 142 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -25356,10 +26811,19 @@ var ts; return undefined; } } + else if (name.kind === 184 /* ParenthesizedExpression */) { + // If the expression in parenthesizedExpression is not an entity-name (e.g. it is a call expression), it won't be able to successfully resolve the name. + // This is the case when we are trying to do any language service operation in heritage clauses. + // By return undefined, the getSymbolOfEntityNameOrPropertyAccessExpression will attempt to checkPropertyAccessExpression to resolve symbol. + // i.e class C extends foo()./*do language service operation here*/B {} + return ts.isEntityNameExpression(name.expression) ? + resolveEntityName(name.expression, meaning, ignoreErrors, dontResolveAlias, location) : + undefined; + } else { ts.Debug.fail("Unknown entity name kind."); } - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { @@ -25367,7 +26831,7 @@ var ts; } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { if (isForAugmentation === void 0) { isForAugmentation = false; } - if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) { + if (moduleReferenceExpression.kind !== 9 /* StringLiteral */ && moduleReferenceExpression.kind !== 12 /* NoSubstitutionTemplateLiteral */) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -25409,11 +26873,10 @@ var ts; // May be an untyped module. If so, ignore resolutionDiagnostic. if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } - else if (compilerOptions.noImplicitAny && moduleNotFoundError) { + else if (noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); } // Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first. @@ -25439,30 +26902,38 @@ var ts; } // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. - function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias)) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may // combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable). - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { - var symbol = resolveExternalModuleSymbol(moduleSymbol); - if (symbol && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { + function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); + if (!dontResolveAlias && symbol && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -25477,24 +26948,28 @@ var ts; * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables */ function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -25510,27 +26985,27 @@ var ts; visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); // All export * declarations are collected in an __export symbol by the binder - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -25552,26 +27027,13 @@ var ts; : symbol; } function symbolIsValue(symbol) { - // If it is an instantiated symbol, then it is a value if the symbol it is an - // instantiation of is a value. - if (symbol.flags & 16777216 /* Instantiated */) { - return symbolIsValue(getSymbolLinks(symbol).target); - } - // If the symbol has the value flag, it is trivially a value. - if (symbol.flags & 107455 /* Value */) { - return true; - } - // If it is an alias, then it is a value if the symbol it resolves to is a value. - if (symbol.flags & 8388608 /* Alias */) { - return (resolveAlias(symbol).flags & 107455 /* Value */) !== 0; - } - return false; + return !!(symbol.flags & 107455 /* Value */ || symbol.flags & 8388608 /* Alias */ && resolveAlias(symbol).flags & 107455 /* Value */); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -25599,6 +27061,9 @@ var ts; type.symbol = symbol; return type; } + function createTypeofType() { + return getUnionType(ts.convertToArray(typeofEQFacts.keys(), function (s) { return getLiteralTypeForText(32 /* StringLiteral */, s); })); + } // A reserved member name starts with two underscores, but the third character cannot be an underscore // or the @ symbol. A third underscore indicates an escaped form of an identifer that started // with at least two underscores. The @ character indicates that the name is denoted by a well known ES @@ -25611,16 +27076,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -25639,20 +27103,21 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { + for (var location = enclosingDeclaration; location; location = location.parent) { // Locals of a source file are not in scope (because they get merged into the global symbol table) - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 261 /* SourceFile */: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 264 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230 /* ModuleDeclaration */: - if (result = callback(getSymbolOfNode(location_1).exports)) { + // falls through + case 232 /* ModuleDeclaration */: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -25666,6 +27131,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -25684,31 +27159,33 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - // Check if symbol is any of the alias - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 /* Alias */ - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { - if (!useOnlyExternalAliasing || - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols.get(symbol.name))) { + return [symbol]; + } + // Check if symbol is any of the alias + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 /* Alias */ + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) { + if (!useOnlyExternalAliasing || + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -25720,7 +27197,7 @@ var ts; var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { // If symbol of this name is not available in the symbol table we are ok - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { // Continue to the next symbol table return false; @@ -25731,7 +27208,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -25746,10 +27223,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: continue; default: return false; @@ -25822,15 +27299,12 @@ var ts; } return { accessibility: 0 /* Accessible */ }; function getExternalModuleContainer(declaration) { - for (; declaration; declaration = declaration.parent) { - if (hasExternalModuleSymbol(declaration)) { - return getSymbolOfNode(declaration); - } - } + var node = ts.findAncestor(declaration, hasExternalModuleSymbol); + return node && getSymbolOfNode(node); } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 264 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -25871,12 +27345,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 160 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ || - entityName.parent.kind === 234 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 142 /* QualifiedName */ || entityName.kind === 178 /* PropertyAccessExpression */ || + entityName.parent.kind === 236 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -25928,6 +27402,516 @@ var ts; } return result; } + function createNodeBuilder() { + var context; + return { + typeToTypeNode: function (type, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = typeToTypeNodeHelper(type); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + indexInfoToIndexSignatureDeclaration: function (indexInfo, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + signatureToSignatureDeclaration: function (signature, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = signatureToSignatureDeclarationHelper(signature, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + } + }; + function createNodeBuilderContext(enclosingDeclaration, flags) { + return { + enclosingDeclaration: enclosingDeclaration, + flags: flags, + encounteredError: false, + inObjectTypeLiteral: false, + checkAlias: true, + symbolStack: undefined + }; + } + function typeToTypeNodeHelper(type) { + if (!type) { + context.encounteredError = true; + // TODO(aozgaa): should we return implict any (undefined) or explicit any (keywordtypenode)? + return undefined; + } + if (type.flags & 1 /* Any */) { + return ts.createKeywordTypeNode(118 /* AnyKeyword */); + } + if (type.flags & 2 /* String */) { + return ts.createKeywordTypeNode(135 /* StringKeyword */); + } + if (type.flags & 4 /* Number */) { + return ts.createKeywordTypeNode(132 /* NumberKeyword */); + } + if (type.flags & 8 /* Boolean */) { + return ts.createKeywordTypeNode(121 /* BooleanKeyword */); + } + if (type.flags & 16 /* Enum */) { + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (type.flags & (32 /* StringLiteral */)) { + return ts.createLiteralTypeNode((ts.createLiteral(type.text))); + } + if (type.flags & (64 /* NumberLiteral */)) { + return ts.createLiteralTypeNode((ts.createNumericLiteral(type.text))); + } + if (type.flags & 128 /* BooleanLiteral */) { + return type.intrinsicName === "true" ? ts.createTrue() : ts.createFalse(); + } + if (type.flags & 256 /* EnumLiteral */) { + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (type.flags & 1024 /* Void */) { + return ts.createKeywordTypeNode(104 /* VoidKeyword */); + } + if (type.flags & 2048 /* Undefined */) { + return ts.createKeywordTypeNode(138 /* UndefinedKeyword */); + } + if (type.flags & 4096 /* Null */) { + return ts.createKeywordTypeNode(94 /* NullKeyword */); + } + if (type.flags & 8192 /* Never */) { + return ts.createKeywordTypeNode(129 /* NeverKeyword */); + } + if (type.flags & 512 /* ESSymbol */) { + return ts.createKeywordTypeNode(136 /* SymbolKeyword */); + } + if (type.flags & 16777216 /* NonPrimitive */) { + return ts.createKeywordTypeNode(133 /* ObjectKeyword */); + } + if (type.flags & 16384 /* TypeParameter */ && type.isThisType) { + if (context.inObjectTypeLiteral) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowThisInObjectLiteral)) { + context.encounteredError = true; + } + } + return ts.createThis(); + } + var objectFlags = getObjectFlags(type); + if (objectFlags & 4 /* Reference */) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + return typeReferenceToTypeNode(type); + } + if (objectFlags & 3 /* ClassOrInterface */) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + // TODO(aozgaa): handle type arguments. + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (type.flags & 16384 /* TypeParameter */) { + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + // Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter. + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (context.checkAlias && type.aliasSymbol) { + var name = symbolToName(type.aliasSymbol, /*expectsIdentifier*/ false); + var typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments); + return ts.createTypeReferenceNode(name, typeArgumentNodes); + } + context.checkAlias = false; + if (type.flags & 65536 /* Union */) { + var formattedUnionTypes = formatUnionTypes(type.types); + var unionTypeNodes = formattedUnionTypes && mapToTypeNodeArray(formattedUnionTypes); + if (unionTypeNodes && unionTypeNodes.length > 0) { + return ts.createUnionOrIntersectionTypeNode(165 /* UnionType */, unionTypeNodes); + } + else { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyUnionOrIntersection)) { + context.encounteredError = true; + } + return undefined; + } + } + if (type.flags & 131072 /* Intersection */) { + return ts.createUnionOrIntersectionTypeNode(166 /* IntersectionType */, mapToTypeNodeArray(type.types)); + } + if (objectFlags & (16 /* Anonymous */ | 32 /* Mapped */)) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + // The type is an object literal type. + return createAnonymousTypeNode(type); + } + if (type.flags & 262144 /* Index */) { + var indexedType = type.type; + var indexTypeNode = typeToTypeNodeHelper(indexedType); + return ts.createTypeOperatorNode(indexTypeNode); + } + if (type.flags & 524288 /* IndexedAccess */) { + var objectTypeNode = typeToTypeNodeHelper(type.objectType); + var indexTypeNode = typeToTypeNodeHelper(type.indexType); + return ts.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); + } + ts.Debug.fail("Should be unreachable."); + function mapToTypeNodeArray(types) { + var result = []; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type_1 = types_1[_i]; + var typeNode = typeToTypeNodeHelper(type_1); + if (typeNode) { + result.push(typeNode); + } + } + return result; + } + function createMappedTypeNodeFromType(type) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + var typeParameter = getTypeParameterFromMappedType(type); + var typeParameterNode = typeParameterToDeclaration(typeParameter); + var templateType = getTemplateTypeFromMappedType(type); + var templateTypeNode = typeToTypeNodeHelper(templateType); + var readonlyToken = type.declaration && type.declaration.readonlyToken ? ts.createToken(130 /* ReadonlyKeyword */) : undefined; + var questionToken = type.declaration && type.declaration.questionToken ? ts.createToken(54 /* QuestionToken */) : undefined; + return ts.createMappedTypeNode(readonlyToken, typeParameterNode, questionToken, templateTypeNode); + } + function createAnonymousTypeNode(type) { + var symbol = type.symbol; + if (symbol) { + // Always use 'typeof T' for type of class, enum, and module objects + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || + shouldWriteTypeOfFunctionSymbol()) { + return createTypeQueryNodeFromSymbol(symbol); + } + else if (ts.contains(context.symbolStack, symbol)) { + // If type is an anonymous type literal in a type alias declaration, use type alias name + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + // The specified symbol flags need to be reinterpreted as type flags + var entityName = symbolToName(typeAlias, /*expectsIdentifier*/ false); + return ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + } + else { + return ts.createKeywordTypeNode(118 /* AnyKeyword */); + } + } + else { + // Since instantiations of the same anonymous type have the same symbol, tracking symbols instead + // of types allows us to catch circular references to instantiations of the same anonymous type + if (!context.symbolStack) { + context.symbolStack = []; + } + context.symbolStack.push(symbol); + var result = createTypeNodeFromObjectType(type); + context.symbolStack.pop(); + return result; + } + } + else { + // Anonymous types without a symbol are never circular. + return createTypeNodeFromObjectType(type); + } + function shouldWriteTypeOfFunctionSymbol() { + var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ && + ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32 /* Static */; })); + var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && + (symbol.parent || + ts.forEach(symbol.declarations, function (declaration) { + return declaration.parent.kind === 264 /* SourceFile */ || declaration.parent.kind === 233 /* ModuleBlock */; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + // typeof is allowed only for static/non local functions + return ts.contains(context.symbolStack, symbol); // it is type of the symbol uses itself recursively + } + } + } + function createTypeNodeFromObjectType(type) { + if (type.objectFlags & 32 /* Mapped */) { + if (getConstraintTypeFromMappedType(type).flags & (16384 /* TypeParameter */ | 262144 /* Index */)) { + return createMappedTypeNodeFromType(type); + } + } + var resolved = resolveStructuredTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + return ts.createTypeLiteralNode(/*members*/ undefined); + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + var signature = resolved.callSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 159 /* FunctionType */); + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + var signature = resolved.constructSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 160 /* ConstructorType */); + } + } + var saveInObjectTypeLiteral = context.inObjectTypeLiteral; + context.inObjectTypeLiteral = true; + var members = createTypeNodesFromResolvedType(resolved); + context.inObjectTypeLiteral = saveInObjectTypeLiteral; + return ts.createTypeLiteralNode(members); + } + function createTypeQueryNodeFromSymbol(symbol) { + var entityName = symbolToName(symbol, /*expectsIdentifier*/ false); + return ts.createTypeQueryNode(entityName); + } + function typeReferenceToTypeNode(type) { + var typeArguments = type.typeArguments || emptyArray; + if (type.target === globalArrayType) { + var elementType = typeToTypeNodeHelper(typeArguments[0]); + return ts.createArrayTypeNode(elementType); + } + else if (type.target.objectFlags & 8 /* Tuple */) { + if (typeArguments.length > 0) { + var tupleConstituentNodes = mapToTypeNodeArray(typeArguments.slice(0, getTypeReferenceArity(type))); + if (tupleConstituentNodes && tupleConstituentNodes.length > 0) { + return ts.createTupleTypeNode(tupleConstituentNodes); + } + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyTuple)) { + context.encounteredError = true; + } + return undefined; + } + else { + var outerTypeParameters = type.target.outerTypeParameters; + var i = 0; + var qualifiedName = undefined; + if (outerTypeParameters) { + var length_1 = outerTypeParameters.length; + while (i < length_1) { + // Find group of type arguments for type parameters with the same declaring container. + var start = i; + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + do { + i++; + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + // When type parameters are their own type arguments for the whole group (i.e. we have + // the default outer type arguments), we don't show the group. + if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { + var qualifiedNamePart = symbolToName(parent, /*expectsIdentifier*/ true); + if (!qualifiedName) { + qualifiedName = ts.createQualifiedName(qualifiedNamePart, /*right*/ undefined); + } + else { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = qualifiedNamePart; + qualifiedName = ts.createQualifiedName(qualifiedName, /*right*/ undefined); + } + } + } + } + var entityName = undefined; + var nameIdentifier = symbolToName(type.symbol, /*expectsIdentifier*/ true); + if (qualifiedName) { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = nameIdentifier; + entityName = qualifiedName; + } + else { + entityName = nameIdentifier; + } + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + var typeArgumentNodes = ts.some(typeArguments) ? mapToTypeNodeArray(typeArguments.slice(i, typeParameterCount - i)) : undefined; + return ts.createTypeReferenceNode(entityName, typeArgumentNodes); + } + } + function createTypeNodesFromResolvedType(resolvedType) { + var typeElements = []; + for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 154 /* CallSignature */)); + } + for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 155 /* ConstructSignature */)); + } + if (resolvedType.stringIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.stringIndexInfo, 0 /* String */)); + } + if (resolvedType.numberIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.numberIndexInfo, 1 /* Number */)); + } + var properties = resolvedType.properties; + if (!properties) { + return typeElements; + } + for (var _d = 0, properties_2 = properties; _d < properties_2.length; _d++) { + var propertySymbol = properties_2[_d]; + var propertyType = getTypeOfSymbol(propertySymbol); + var oldDeclaration = propertySymbol.declarations && propertySymbol.declarations[0]; + if (!oldDeclaration) { + return; + } + var propertyName = oldDeclaration.name; + var optionalToken = propertySymbol.flags & 67108864 /* Optional */ ? ts.createToken(54 /* QuestionToken */) : undefined; + if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length) { + var signatures = getSignaturesOfType(propertyType, 0 /* Call */); + for (var _e = 0, signatures_1 = signatures; _e < signatures_1.length; _e++) { + var signature = signatures_1[_e]; + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 149 /* MethodSignature */); + methodDeclaration.name = propertyName; + methodDeclaration.questionToken = optionalToken; + typeElements.push(methodDeclaration); + } + } + else { + // TODO(aozgaa): should we create a node with explicit or implict any? + var propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType) : ts.createKeywordTypeNode(118 /* AnyKeyword */); + typeElements.push(ts.createPropertySignature(propertyName, optionalToken, propertyTypeNode, + /*initializer*/ undefined)); + } + } + return typeElements.length ? typeElements : undefined; + } + } + function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind) { + var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 135 /* StringKeyword */ : 132 /* NumberKeyword */); + var name = ts.getNameFromIndexInfo(indexInfo); + var indexingParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, name, + /*questionToken*/ undefined, indexerTypeNode, + /*initializer*/ undefined); + var typeNode = typeToTypeNodeHelper(indexInfo.type); + return ts.createIndexSignatureDeclaration( + /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(130 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + } + function signatureToSignatureDeclarationHelper(signature, kind) { + var typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter); }); + var returnTypeNode; + if (signature.typePredicate) { + var typePredicate = signature.typePredicate; + var parameterName = typePredicate.kind === 1 /* Identifier */ ? ts.createIdentifier(typePredicate.parameterName) : ts.createThisTypeNode(); + var typeNode = typeToTypeNodeHelper(typePredicate.type); + returnTypeNode = ts.createTypePredicateNode(parameterName, typeNode); + } + else { + var returnType = getReturnTypeOfSignature(signature); + returnTypeNode = returnType && typeToTypeNodeHelper(returnType); + } + var returnTypeNodeExceptAny = returnTypeNode && returnTypeNode.kind !== 118 /* AnyKeyword */ ? returnTypeNode : undefined; + return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNodeExceptAny); + } + function typeParameterToDeclaration(type) { + var constraint = getConstraintFromTypeParameter(type); + var constraintNode = constraint && typeToTypeNodeHelper(constraint); + var defaultParameter = getDefaultFromTypeParameter(type); + var defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter); + var name = symbolToName(type.symbol, /*expectsIdentifier*/ true); + return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); + } + function symbolToParameterDeclaration(parameterSymbol) { + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 145 /* Parameter */); + var parameterType = getTypeOfSymbol(parameterSymbol); + var parameterTypeNode = typeToTypeNodeHelper(parameterType); + // TODO(aozgaa): In the future, check initializer accessibility. + var parameterNode = ts.createParameter(parameterDeclaration.decorators, parameterDeclaration.modifiers, parameterDeclaration.dotDotDotToken && ts.createToken(23 /* DotDotDotToken */), + // Clone name to remove trivia. + ts.getSynthesizedClone(parameterDeclaration.name), parameterDeclaration.questionToken && ts.createToken(54 /* QuestionToken */), parameterTypeNode, parameterDeclaration.initializer); + return parameterNode; + } + function symbolToName(symbol, expectsIdentifier) { + // Try to get qualified name if the symbol is not a type parameter and there is an enclosing declaration. + var chain; + var isTypeParameter = symbol.flags & 262144 /* TypeParameter */; + if (!isTypeParameter && context.enclosingDeclaration) { + chain = getSymbolChain(symbol, 0 /* None */, /*endOfChain*/ true); + ts.Debug.assert(chain && chain.length > 0); + } + else { + chain = [symbol]; + } + if (expectsIdentifier && chain.length !== 1 + && !context.encounteredError + && !(context.flags & ts.NodeBuilderFlags.allowQualifedNameInPlaceOfIdentifier)) { + context.encounteredError = true; + } + return createEntityNameFromSymbolChain(chain, chain.length - 1); + function createEntityNameFromSymbolChain(chain, index) { + ts.Debug.assert(chain && 0 <= index && index < chain.length); + // const parentIndex = index - 1; + var symbol = chain[index]; + var typeParameterString = ""; + if (index > 0) { + var parentSymbol = chain[index - 1]; + var typeParameters = void 0; + if (getCheckFlags(symbol) & 1 /* Instantiated */) { + typeParameters = getTypeParametersOfClassOrInterface(parentSymbol); + } + else { + var targetSymbol = getTargetSymbol(parentSymbol); + if (targetSymbol.flags & (32 /* Class */ | 64 /* Interface */ | 524288 /* TypeAlias */)) { + typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + } + } + if (typeParameters && typeParameters.length > 0) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowTypeParameterInQualifiedName)) { + context.encounteredError = true; + } + var writer = ts.getSingleLineStringWriter(); + var displayBuilder = getSymbolDisplayBuilder(); + displayBuilder.buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, context.enclosingDeclaration, 0); + typeParameterString = writer.string(); + ts.releaseStringWriter(writer); + } + } + var symbolName = getNameOfSymbol(symbol); + var symbolNameWithTypeParameters = typeParameterString.length > 0 ? symbolName + "<" + typeParameterString + ">" : symbolName; + var identifier = ts.createIdentifier(symbolNameWithTypeParameters); + return index > 0 ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier; + } + /** @param endOfChain Set to false for recursive calls; non-recursive calls should always output something. */ + function getSymbolChain(symbol, meaning, endOfChain) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, /*useOnlyExternalAliasing*/ false); + var parentSymbol; + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + // Go up and add our parent. + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + var parentChain = getSymbolChain(parent, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + if (parentChain) { + parentSymbol = parent; + accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [symbol]); + } + } + } + if (accessibleSymbolChain) { + return accessibleSymbolChain; + } + if ( + // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols. + endOfChain || + // If a parent symbol is an external module, don't write it. (We prefer just `x` vs `"foo/bar".x`.) + !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) && + // If a parent symbol is an anonymous type, don't write it. + !(symbol.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))) { + return [symbol]; + } + } + function getNameOfSymbol(symbol) { + var declaration = ts.firstOrUndefined(symbol.declarations); + if (declaration) { + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225 /* VariableDeclaration */) { + return ts.declarationNameToString(declaration.parent.name); + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowAnonymousIdentifier)) { + context.encounteredError = true; + } + switch (declaration.kind) { + case 198 /* ClassExpression */: + return "(Anonymous class)"; + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return "(Anonymous function)"; + } + } + return symbol.name; + } + } + } function typePredicateToString(typePredicate, enclosingDeclaration, flags) { var writer = ts.getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); @@ -25971,11 +27955,8 @@ var ts; } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { - var node = type.symbol.declarations[0].parent; - while (node.kind === 166 /* ParenthesizedType */) { - node = node.parent; - } - if (node.kind === 228 /* TypeAliasDeclaration */) { + var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 167 /* ParenthesizedType */; }); + if (node.kind === 230 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -25983,29 +27964,32 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 /* ModuleBlock */ && + node.parent.kind === 233 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 /* StringLiteral */ ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197 /* ClassExpression */: - return "(Anonymous class)"; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225 /* VariableDeclaration */) { + return ts.declarationNameToString(declaration.parent.name); + } + switch (declaration.kind) { + case 198 /* ClassExpression */: + return "(Anonymous class)"; + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { /** * Writes only the name of the symbol out to the writer. Uses the original source text * for the name of the symbol if it is available to match how the user wrote the name. @@ -26047,7 +28031,7 @@ var ts; if (parentSymbol) { // Write type arguments of instantiated class/interface here if (flags & 1 /* WriteTypeParametersOrArguments */) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(symbol) & 1 /* Instantiated */) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { @@ -26075,9 +28059,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26115,7 +28099,7 @@ var ts; function writeType(type, flags) { var nextFlags = flags & ~512 /* InTypeAlias */; // Write undefined/null type as any - if (type.flags & 16015 /* Intrinsic */) { + if (type.flags & 16793231 /* Intrinsic */) { // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && isTypeAny(type) ? "any" @@ -26142,7 +28126,7 @@ var ts; else if (!(flags & 512 /* InTypeAlias */) && type.aliasSymbol && isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === 0 /* Accessible */) { var typeArguments = type.aliasTypeArguments; - writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); + writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, ts.length(typeArguments), nextFlags); } else if (type.flags & 196608 /* UnionOrIntersection */) { writeUnionOrIntersectionType(type, nextFlags); @@ -26223,18 +28207,18 @@ var ts; var outerTypeParameters = type.target.outerTypeParameters; var i = 0; if (outerTypeParameters) { - var length_1 = outerTypeParameters.length; - while (i < length_1) { + var length_2 = outerTypeParameters.length; + while (i < length_2) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26261,7 +28245,8 @@ var ts; var symbol = type.symbol; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 /* Enum */ | 512 /* ValueModule */)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -26300,7 +28285,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 /* SourceFile */ || declaration.parent.kind === 231 /* ModuleBlock */; + return declaration.parent.kind === 264 /* SourceFile */ || declaration.parent.kind === 233 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26314,32 +28299,13 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130 /* ReadonlyKeyword */); - writeSpace(writer); - } - writePunctuation(writer, 20 /* OpenBracketToken */); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21 /* CloseBracketToken */); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeType(info.type, 0 /* None */); - writePunctuation(writer, 24 /* SemicolonToken */); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130 /* ReadonlyKeyword */); writeSpace(writer); } buildSymbolDisplay(prop, writer); - if (prop.flags & 536870912 /* Optional */) { + if (prop.flags & 67108864 /* Optional */) { writePunctuation(writer, 54 /* QuestionToken */); } } @@ -26416,15 +28382,15 @@ var ts; writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134 /* StringKeyword */); - writeIndexSignature(resolved.numberIndexInfo, 132 /* NumberKeyword */); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0 /* String */, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1 /* Number */, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0 /* Call */); - for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { - var signature = signatures_1[_f]; + for (var _f = 0, signatures_2 = signatures; _f < signatures_2.length; _f++) { + var signature = signatures_2[_f]; writePropertyWithModifiers(p); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, 24 /* SemicolonToken */); @@ -26483,33 +28449,44 @@ var ts; writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } + var defaultType = getDefaultFromTypeParameter(tp); + if (defaultType) { + writeSpace(writer); + writePunctuation(writer, 57 /* EqualsToken */); + writeSpace(writer); + buildTypeDisplay(defaultType, writer, enclosingDeclaration, flags, symbolStack); + } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; - if (ts.isRestParameter(parameterNode)) { + if (parameterNode ? ts.isRestParameter(parameterNode) : isTransientSymbol(p) && p.isRestParameter) { writePunctuation(writer, 23 /* DotDotDotToken */); } - if (ts.isBindingPattern(parameterNode.name)) { + if (parameterNode && ts.isBindingPattern(parameterNode.name)) { buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); } else { appendSymbolNameOnly(p, writer); } - if (isOptionalParameter(parameterNode)) { + if (parameterNode && isOptionalParameter(parameterNode)) { writePunctuation(writer, 54 /* QuestionToken */); } writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); - buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); + var type = getTypeOfSymbol(p); + if (parameterNode && isRequiredInitializedParameter(parameterNode)) { + type = includeFalsyTypes(type, 2048 /* Undefined */); + } + buildTypeDisplay(type, writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. - if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { writePunctuation(writer, 16 /* OpenBraceToken */); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17 /* CloseBraceToken */); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { writePunctuation(writer, 20 /* OpenBracketToken */); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -26523,9 +28500,9 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */); + ts.Debug.assert(bindingElement.kind === 175 /* BindingElement */); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); } @@ -26597,6 +28574,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 /* SuppressAnyReturnType */ && isTypeAny(returnType)) { + return; + } if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); writePunctuation(writer, 35 /* EqualsGreaterThanToken */); @@ -26609,7 +28590,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -26629,6 +28609,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130 /* ReadonlyKeyword */); + writeSpace(writer); + } + writePunctuation(writer, 20 /* OpenBracketToken */); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + switch (kind) { + case 1 /* Number */: + writeKeyword(writer, 132 /* NumberKeyword */); + break; + case 0 /* String */: + writeKeyword(writer, 135 /* StringKeyword */); + break; + } + writePunctuation(writer, 21 /* CloseBracketToken */); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24 /* SemicolonToken */); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -26639,6 +28645,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -26653,75 +28660,76 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } - // Otherwise fall through - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 225 /* FunctionDeclaration */: - case 229 /* EnumDeclaration */: - case 234 /* ImportEqualsDeclaration */: + // falls through + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 231 /* EnumDeclaration */: + case 236 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 236 /* ImportEqualsDeclaration */ && parent.kind !== 264 /* SourceFile */ && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_7); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + return isDeclarationVisible(parent); + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.getModifierFlags(node) & (8 /* Private */ | 16 /* Protected */)) { // Private/protected properties/methods are not visible return false; } - // Public properties/methods are visible if its parents are visible, so const it fall into next case statement - case 150 /* Constructor */: - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: - case 144 /* Parameter */: - case 231 /* ModuleBlock */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 157 /* TypeReference */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: + // Public properties/methods are visible if its parents are visible, so: + // falls through + case 151 /* Constructor */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: + case 145 /* Parameter */: + case 233 /* ModuleBlock */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 158 /* TypeReference */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: return false; // Type parameters are always visible - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: // Source file and namespace export are always visible - case 261 /* SourceFile */: - case 233 /* NamespaceExportDeclaration */: + case 264 /* SourceFile */: + case 235 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return false; default: return false; @@ -26730,10 +28738,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 242 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243 /* ExportSpecifier */) { + else if (node.parent.kind === 245 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -26778,8 +28786,8 @@ var ts; var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); if (resolutionCycleStartIndex >= 0) { // A cycle was found - var length_2 = resolutionTargets.length; - for (var i = resolutionCycleStartIndex; i < length_2; i++) { + var length_3 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_3; i++) { resolutionResults[i] = false; } return false; @@ -26823,21 +28831,20 @@ var ts; return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = ts.getRootDeclaration(node); - while (node) { + node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 223 /* VariableDeclaration */: - case 224 /* VariableDeclarationList */: - case 239 /* ImportSpecifier */: - case 238 /* NamedImports */: - case 237 /* NamespaceImport */: - case 236 /* ImportClause */: - node = node.parent; - break; + case 225 /* VariableDeclaration */: + case 226 /* VariableDeclarationList */: + case 241 /* ImportSpecifier */: + case 240 /* NamedImports */: + case 239 /* NamespaceImport */: + case 238 /* ImportClause */: + return false; default: - return node.parent; + return true; } - } + }); + return node && node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -26855,9 +28862,6 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192 /* Never */) !== 0; - } // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node) { @@ -26865,24 +28869,29 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } function isComputedNonLiteralName(name) { - return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768 /* Object */), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (source.flags & 8192 /* Never */) { + return emptyObjectType; + } + if (source.flags & 65536 /* Union */) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); - for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_17 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_17)] = true; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var name = properties_3[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */); - var isMethod = prop.flags & 8192 /* Method */; var isSetOnlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0 /* String */); @@ -26907,9 +28916,9 @@ var ts; return parentType; } var type; - if (pattern.kind === 172 /* ObjectBindingPattern */) { + if (pattern.kind === 173 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768 /* Object */)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } @@ -26924,8 +28933,8 @@ var ts; } else { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name_18 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_18)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { // computed properties with non-literal names are treated as 'any' return anyType; } @@ -26934,12 +28943,12 @@ var ts; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - var text = ts.getTextOfPropertyName(name_18); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { - error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } @@ -26948,7 +28957,7 @@ var ts; // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false); + var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false, /*allowAsyncIterable*/ false); if (declaration.dotDotDotToken) { // Rest element has an array type with the same element type as the parent type type = createArrayType(elementType); @@ -26979,7 +28988,7 @@ var ts; getUnionType([type, checkExpressionCached(declaration.initializer)], /*subtypeReduction*/ true) : type; } - function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + function getTypeForDeclarationFromJSDocComment(declaration) { var jsdocType = ts.getJSDocType(declaration); if (jsdocType) { return getTypeFromTypeNode(jsdocType); @@ -26992,44 +29001,46 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 176 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048 /* Undefined */) : type; } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { // If this is a variable in a JavaScript file, then use the JSDoc type (if it has // one as its type), otherwise fallback to the below standard TS codepaths to // try to figure it out. - var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + var type = getTypeForDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (declaration.parent.parent.kind === 212 /* ForInStatement */) { + if (declaration.parent.parent.kind === 214 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 215 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, // or it may have led to an error inside getElementTypeOfIterable. - return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; + var forOfStatement = declaration.parent.parent; + return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } // Use type from type annotation if one is present if (declaration.type) { - return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); + var declaredType = getTypeFromTypeNode(declaration.type); + return addOptionality(declaredType, /*optional*/ declaration.questionToken && includeOptionality); } - if ((compilerOptions.noImplicitAny || declaration.flags & 2097152 /* JavaScriptFile */) && - declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + if ((noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && + declaration.kind === 225 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -27043,11 +29054,11 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 152 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151 /* GetAccessor */); + if (func.kind === 153 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152 /* GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -27076,8 +29087,13 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); } + if (ts.isJsxAttribute(declaration)) { + // if JSX attribute doesn't have initializer, by default the attribute will have boolean value of true. + // I.e is sugar for + return trueType; + } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 258 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 261 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27087,6 +29103,38 @@ var ts; // No type specified and nothing can be inferred return undefined; } + function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol) { + var types = []; + var definedInConstructor = false; + var definedInMethod = false; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var expression = declaration.kind === 193 /* BinaryExpression */ ? declaration : + declaration.kind === 178 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 193 /* BinaryExpression */) : + undefined; + if (!expression) { + return unknownType; + } + if (ts.isPropertyAccessExpression(expression.left) && expression.left.expression.kind === 98 /* ThisKeyword */) { + if (ts.getThisContainer(expression, /*includeArrowFunctions*/ false).kind === 151 /* Constructor */) { + definedInConstructor = true; + } + else { + definedInMethod = true; + } + } + if (expression.flags & 65536 /* JavaScriptFile */) { + // If there is a JSDoc type, use it + var type = getTypeForDeclarationFromJSDocComment(expression.parent); + if (type && type !== unknownType) { + types.push(getWidenedType(type)); + continue; + } + } + types.push(getWidenedLiteralType(checkExpressionCached(expression.right))); + } + return getWidenedType(addOptionality(getUnionType(types, /*subtypeReduction*/ true), definedInMethod && !definedInConstructor)); + } // Return the type implied by a binding pattern element. This is the type of the initializer of the element if // one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding // pattern. Otherwise, it is the type any. @@ -27097,7 +29145,7 @@ var ts; if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); } - if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + if (reportErrors && noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAnyError(element, anyType); } return anyType; @@ -27105,22 +29153,27 @@ var ts; // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { - // do not include computed properties or rests in the implied type + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); + return; + } var text = ts.getTextOfPropertyName(name); - var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); + var flags = 4 /* Property */ | (e.initializer ? 67108864 /* Optional */ : 0); var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -27153,7 +29206,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 /* ObjectBindingPattern */ + return pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -27175,7 +29228,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 257 /* PropertyAssignment */) { + if (declaration.kind === 260 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27183,7 +29236,7 @@ var ts; // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration - if (reportErrors && compilerOptions.noImplicitAny) { + if (reportErrors && noImplicitAny) { if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } @@ -27192,14 +29245,14 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 /* Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 145 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { // Handle prototype property - if (symbol.flags & 134217728 /* Prototype */) { + if (symbol.flags & 16777216 /* Prototype */) { return links.type = getTypeOfPrototypeProperty(symbol); } // Handle catch clause variables @@ -27208,10 +29261,10 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 240 /* ExportAssignment */) { + if (declaration.kind === 242 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 290 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27224,36 +29277,15 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 192 /* BinaryExpression */ || - declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) { - // Use JS Doc type if present on parent expression statement - if (declaration.flags & 2097152 /* JavaScriptFile */) { - var jsdocType = ts.getJSDocType(declaration.parent); - if (jsdocType) { - return links.type = getTypeFromTypeNode(jsdocType); - } - } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ? - checkExpressionCached(decl.right) : - checkExpressionCached(decl.parent.right); }); - type = getUnionType(declaredTypes, /*subtypeReduction*/ true); + if (declaration.kind === 193 /* BinaryExpression */ || + declaration.kind === 178 /* PropertyAccessExpression */ && declaration.parent.kind === 193 /* BinaryExpression */) { + type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else { type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - // Variable has type annotation that circularly references the variable itself - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - // Variable has initializer that circularly references the variable itself - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -27261,7 +29293,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -27281,10 +29313,10 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */); - if (getter && getter.flags & 2097152 /* JavaScriptFile */) { - var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + var getter = ts.getDeclarationOfKind(symbol, 152 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 153 /* SetAccessor */); + if (getter && getter.flags & 65536 /* JavaScriptFile */) { + var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; } @@ -27310,7 +29342,7 @@ var ts; type = getReturnTypeFromBody(getter); } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { if (setter) { error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); } @@ -27325,8 +29357,8 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); + if (noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 152 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -27334,6 +29366,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 /* TypeVariable */ ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -27342,8 +29378,13 @@ var ts; } else { var type = createObjectType(16 /* Anonymous */, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? - includeFalsyTypes(type, 2048 /* Undefined */) : type; + if (symbol.flags & 32 /* Class */) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 67108864 /* Optional */ ? includeFalsyTypes(type, 2048 /* Undefined */) : type; + } } } return links.type; @@ -27373,12 +29414,39 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (symbolInstantiationDepth === 100) { + error(symbol.valueDeclaration, ts.Diagnostics.Generic_type_instantiation_is_excessively_deep_and_possibly_infinite); + links.type = unknownType; + } + else { + if (!pushTypeResolution(symbol, 0 /* Type */)) { + return unknownType; + } + symbolInstantiationDepth++; + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + symbolInstantiationDepth--; + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; + } } return links.type; } + function reportCircularityError(symbol) { + // Check if variable has type annotation that circularly references the variable itself + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + // Otherwise variable has initializer that circularly references the variable itself + if (noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(symbol) & 1 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); } if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) { @@ -27398,22 +29466,33 @@ var ts; } return unknownType; } + function isReferenceToType(type, target) { + return type !== undefined + && target !== undefined + && (getObjectFlags(type) & 4 /* Reference */) !== 0 + && type.target === target; + } function getTargetType(type) { return getObjectFlags(type) & 4 /* Reference */ ? type.target : type; } function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072 /* Intersection */) { + return ts.forEach(type.types, check); + } } } // Appends the type parameters given by a list of declarations to a set of type parameters and returns the resulting set. // The function allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set // in-place and returns the same array. function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { - var declaration = declarations_2[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -27433,9 +29512,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || - node.kind === 225 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) { + if (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */ || + node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */ || node.kind === 186 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -27445,8 +29524,8 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); - return appendOuterTypeParameters(undefined, declaration); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); + return appendOuterTypeParameters(/*typeParameters*/ undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, // interface, or type alias. @@ -27454,8 +29533,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 226 /* ClassDeclaration */ || - node.kind === 197 /* ClassExpression */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 228 /* ClassDeclaration */ || + node.kind === 198 /* ClassExpression */ || node.kind === 230 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -27469,29 +29548,50 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + // A type is a mixin constructor if it has a single construct signature taking no type parameters and a single + // rest parameter of type any[]. + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1 /* Construct */); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 1 /* Construct */).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1 /* Construct */).length > 0) { + return true; + } + if (type.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(type); + return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); } - function getConstructorsForTypeArguments(type, typeArgumentNodes) { - var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; - return ts.filter(getSignaturesOfType(type, 1 /* Construct */), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; }); + function getConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var typeArgCount = ts.length(typeArgumentNodes); + var isJavaScript = ts.isInJavaScriptFile(location); + return ts.filter(getSignaturesOfType(type, 1 /* Construct */), function (sig) { return (isJavaScript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts.length(sig.typeParameters); }); } - function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { - var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); + function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location); if (typeArgumentNodes) { var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); } return signatures; } - // The base constructor of a class can resolve to - // undefinedType if the class has no extends clause, - // unknownType if an error occurred during resolution of the extends expression, - // nullType if the extends expression is the null value, or - // an object type with at least one construct signature. + /** + * The base constructor of a class can resolve to + * * undefinedType if the class has no extends clause, + * * unknownType if an error occurred during resolution of the extends expression, + * * nullType if the extends expression is the null value, + * * anyType if the extends expression has type any, or + * * an object type with at least one construct signature. + */ function getBaseConstructorTypeOfClass(type) { if (!type.resolvedBaseConstructorType) { var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27502,7 +29602,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */)) { // Resolving the members of a class requires us to resolve the base class of that class. // We force resolution here such that we catch circularities now. resolveStructuredTypeMembers(baseConstructorType); @@ -27511,7 +29611,7 @@ var ts; error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); return type.resolvedBaseConstructorType = unknownType; } - if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { + if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); return type.resolvedBaseConstructorType = unknownType; } @@ -27540,8 +29640,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768 /* Object */)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */ | 1 /* Any */))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27554,11 +29654,14 @@ var ts; // type arguments in the same manner as a type reference to get the same error reporting experience. baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } + else if (baseConstructorType.flags & 1 /* Any */) { + baseType = baseConstructorType; + } else { // The class derives from a "class-like" constructor function, check that we have at least one construct signature // with a matching number of type parameters and use the return type of the first instantiated signature. Elsewhere // we check that all instantiated signatures return the same type. - var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -27576,7 +29679,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -27602,16 +29705,22 @@ var ts; } return true; } + // A valid base type is `any`, any non-generic object type or intersection of non-generic + // object types. + function isValidBaseType(type) { + return type.flags & (32768 /* Object */ | 16777216 /* NonPrimitive */ | 1 /* Any */) && !isGenericMappedType(type) || + type.flags & 131072 /* Intersection */ && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -27638,7 +29747,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */) { + if (declaration.kind === 229 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -27676,7 +29785,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -27695,7 +29804,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 289 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -27706,7 +29815,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228 /* TypeAliasDeclaration */); + declaration = ts.getDeclarationOfKind(symbol, 230 /* TypeAliasDeclaration */); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -27716,7 +29825,7 @@ var ts; // an instantiation of the type alias with the type parameters supplied as type arguments. links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -27733,14 +29842,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */ || - expr.kind === 70 /* Identifier */ && !!symbol.exports[expr.text]; + expr.kind === 70 /* Identifier */ && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -27765,10 +29874,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -27785,7 +29894,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536 /* Union */; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -27806,9 +29915,6 @@ var ts; if (!links.declaredType) { var type = createType(16384 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -27821,7 +29927,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0); if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -27860,19 +29965,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 171 /* LiteralType */: + case 172 /* LiteralType */: return true; - case 162 /* ArrayType */: + case 163 /* ArrayType */: return isIndependentType(node.elementType); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -27885,7 +29991,7 @@ var ts; // A function-like declaration is considered independent (free of this references) if it has a return type // annotation that is considered independent and if each parameter is considered independent. function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -27906,12 +30012,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -27922,7 +30028,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -27932,15 +30038,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -27948,8 +30054,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); } @@ -27957,7 +30063,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4 /* Reference */) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -27993,10 +30106,14 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); - stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0 /* String */); + if (!stringIndexInfo) { + stringIndexInfo = instantiatedBaseType === anyType ? + createIndexInfo(anyType, /*isReadonly*/ false) : + getIndexInfoOfType(instantiatedBaseType, 0 /* String */); + } numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1 /* Number */); } } @@ -28035,14 +30152,16 @@ var ts; return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); + var isJavaScript = ts.isInJavaScriptFile(baseTypeNode); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); - var typeArgCount = typeArguments ? typeArguments.length : 0; + var typeArgCount = ts.length(typeArguments); var result = []; for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { var baseSig = baseSignatures_1[_i]; - var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; - if (typeParamCount === typeArgCount) { - var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + var minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters); + var typeParamCount = ts.length(baseSig.typeParameters); + if ((isJavaScript || typeArgCount >= minTypeArgumentCount) && typeArgCount <= typeParamCount) { + var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, baseTypeNode)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; sig.resolvedReturnType = classType; result.push(sig); @@ -28105,7 +30224,7 @@ var ts; s = cloneSignature(signature); if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) { var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), /*subtypeReduction*/ true); - s.thisParameter = createTransientSymbol(signature.thisParameter, thisType); + s.thisParameter = createSymbolWithType(signature.thisParameter, thisType); } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; @@ -28121,8 +30240,8 @@ var ts; function getUnionIndexInfo(types, kind) { var indexTypes = []; var isAnyReadonly = false; - for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { - var type = types_1[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type = types_2[_i]; var indexInfo = getIndexInfoOfType(type, kind); if (!indexInfo) { return undefined; @@ -28150,22 +30269,57 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + // When an intersection type contains mixin constructor types, the construct signatures from + // those types are discarded and their return types are mixed into the return types of all + // other construct signatures in the intersection type. For example, the intersection type + // '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature + // 'new(s: string) => A & B'. + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1 /* Construct */); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1 /* Construct */)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } + /** + * Converts an AnonymousType to a ResolvedType. + */ function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (type.target) { @@ -28178,8 +30332,8 @@ var ts; } else if (symbol.flags & 2048 /* TypeLiteral */) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -28188,23 +30342,27 @@ var ts; // Combinations of function, class, enum and module var members = emptySymbols; var constructSignatures = emptyArray; - if (symbol.flags & 1952 /* HasExports */) { + var stringIndexInfo = undefined; + if (symbol.exports) { members = getExportsOfSymbol(symbol); } if (symbol.flags & 32 /* Class */) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */ | 540672 /* TypeVariable */)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); + } + else if (baseConstructorType === anyType) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); } } var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined; - setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, constructSignatures, stringIndexInfo, numberIndexInfo); // We resolve the members before computing the signatures because a signature may use // typeof with a qualified name expression that circularly references the type we are // in the process of resolving (see issue #6072). The temporarily empty signature list @@ -28218,7 +30376,6 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; // Resolve upfront such that recursive references see an empty object type. setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); // In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type, @@ -28226,43 +30383,53 @@ var ts; var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - // First, if the constraint type is a type parameter, obtain the base constraint. Then, - // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. - // Finally, iterate over the constituents of the resulting iteration type. - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); // The 'T' in 'keyof T' + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 169 /* TypeOperator */) { + // We have a { [P in keyof T]: X } + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } + if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + addMemberForKeyType(stringType); + } + } + else { + // First, if the constraint type is a type parameter, obtain the base constraint. Then, + // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. + // Finally, iterate over the constituents of the resulting iteration type. + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t, propertySymbol) { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - // If the current iteration type constituent is a literal type, create a property. - // Otherwise, for type string create a string index signature and for type number - // create a numeric index signature. - if (t.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */)) { + // If the current iteration type constituent is a string literal type, create a property. + // Otherwise, for type string create a string index signature. + if (t.flags & 32 /* StringLiteral */) { var propName = t.text; - var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; - members[propName] = prop; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 67108864 /* Optional */); + var prop = createSymbol(4 /* Property */ | (isOptional ? 67108864 /* Optional */ : 0), propName); + prop.checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? 8 /* Readonly */ : 0; + prop.type = propType; + if (propertySymbol) { + prop.syntheticOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2 /* String */) { - stringIndexInfo = createIndexInfo(propType, isReadonly); - } - else if (t.flags & 4 /* Number */) { - numberIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - }); - // If we created both a string and a numeric string index signature, and if the two index - // signatures have identical types, discard the redundant numeric index signature. - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -28275,16 +30442,34 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 169 /* TypeOperator */) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint && constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; } function isGenericMappedType(type) { if (getObjectFlags(type) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 /* TypeParameter */ | 262144 /* Index */)); + return maybeTypeOfKind(constraintType, 540672 /* TypeVariable */ | 262144 /* Index */); } return false; } @@ -28321,42 +30506,40 @@ var ts; return emptyArray; } /** If the given type is an object type and that type has a property by the given name, - * return the symbol for that property. Otherwise return undefined. */ + * return the symbol for that property. Otherwise return undefined. + */ function getPropertyOfObjectType(type, name) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - // The properties of a union type are those that are present in all constituent types, so - // we only need to check the properties of the first type - if (type.flags & 65536 /* Union */) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - // We need to filter out partial properties in union types - if (!(prop.flags & 268435456 /* SyntheticProperty */ && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + // The properties of a union type are those that are present in all constituent types, so + // we only need to check the properties of the first type + if (type.flags & 65536 /* Union */) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -28364,25 +30547,114 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + function getConstraintOfType(type) { + return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : + type.flags & 524288 /* IndexedAccess */ ? getConstraintOfIndexedAccess(type) : + getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getConstraintOfIndexedAccess(type) { + var baseObjectType = getBaseConstraintOfType(type.objectType); + var baseIndexType = getBaseConstraintOfType(type.indexType); + return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; + } + function getBaseConstraintOfType(type) { + if (type.flags & (540672 /* TypeVariable */ | 196608 /* UnionOrIntersection */)) { + var constraint = getResolvedBaseConstraint(type); + if (constraint !== noConstraintType && constraint !== circularConstraintType) { + return constraint; + } + } + else if (type.flags & 262144 /* Index */) { + return stringType; + } + return undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } /** - * The apparent type of a type parameter is the base constraint instantiated with the type parameter - * as the type argument for the 'this' type. + * Return the resolved base constraint of a type variable. The noConstraintType singleton is returned if the + * type variable has no constraint, and the circularConstraintType singleton is returned if the constraint + * circularly references the type variable. */ - function getApparentTypeOfTypeParameter(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); - while (constraintType && constraintType.flags & 16384 /* TypeParameter */) { - constraintType = getConstraintOfTypeParameter(constraintType); + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384 /* TypeParameter */) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608 /* UnionOrIntersection */) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type_2 = types_3[_i]; + var baseType = getBaseConstraint(type_2); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + if (t.flags & 262144 /* Index */) { + return stringType; + } + if (t.flags & 524288 /* IndexedAccess */) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; } - return type.resolvedApparentType; + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); } /** - * The apparent type of an indexed access T[K] is the type of T's string index signature, if any. + * Gets the default type for a type parameter. + * + * If the type parameter is the result of an instantiation, this gets the instantiated + * default type of its target. If the type parameter has no default type, `undefined` + * is returned. + * + * This function *does not* perform a circularity check. */ - function getApparentTypeOfIndexedAccess(type) { - return getIndexTypeOfType(getApparentType(type.objectType), 0 /* String */) || type; + function getDefaultFromTypeParameter(typeParameter) { + if (!typeParameter.default) { + if (typeParameter.target) { + var targetDefault = getDefaultFromTypeParameter(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType; + } + else { + var defaultDeclaration = typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameter(decl) && decl.default; }); + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; + } + } + return typeParameter.default === noConstraintType ? undefined : typeParameter.default; } /** * For a type parameter, return the base constraint of the type parameter. For the string, number, @@ -28390,28 +30662,31 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) : - type.flags & 524288 /* IndexedAccess */ ? getApparentTypeOfIndexedAccess(type) : - type; - return t.flags & 262178 /* StringLike */ ? globalStringType : - t.flags & 340 /* NumberLike */ ? globalNumberType : - t.flags & 136 /* BooleanLike */ ? globalBooleanType : - t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 /* TypeVariable */ ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 /* StringLike */ ? globalStringType : + t.flags & 340 /* NumberLike */ ? globalNumberType : + t.flags & 136 /* BooleanLike */ ? globalBooleanType : + t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) : + t.flags & 16777216 /* NonPrimitive */ ? emptyObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { - var types = containingType.types; var props; + var types = containingType.types; + var isUnion = containingType.flags & 65536 /* Union */; + var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0; // Flags we want to propagate to the result if they exist in all source symbols - var commonFlags = (containingType.flags & 131072 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; - var isReadonly = false; - var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + var commonFlags = isUnion ? 0 /* None */ : 67108864 /* Optional */; + var syntheticFlag = 4 /* SyntheticMethod */; + var checkFlags = 0; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var current = types_4[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { + var modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; + if (prop && !(modifiers & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -28419,25 +30694,29 @@ var ts; else if (!ts.contains(props, prop)) { props.push(prop); } - if (isReadonlySymbol(prop)) { - isReadonly = true; + checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) | + (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 64 /* ContainsPublic */ : 0) | + (modifiers & 16 /* Protected */ ? 128 /* ContainsProtected */ : 0) | + (modifiers & 8 /* Private */ ? 256 /* ContainsPrivate */ : 0) | + (modifiers & 32 /* Static */ ? 512 /* ContainsStatic */ : 0); + if (!isMethodLike(prop)) { + syntheticFlag = 2 /* SyntheticProperty */; } } - else if (containingType.flags & 65536 /* Union */) { - isPartial = true; + else if (isUnion) { + checkFlags |= 16 /* Partial */; } } } if (!props) { return undefined; } - if (props.length === 1 && !isPartial) { + if (props.length === 1 && !(checkFlags & 16 /* Partial */)) { return props[0]; } var propTypes = []; var declarations = []; var commonType = undefined; - var hasNonUniformType = false; for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { var prop = props_1[_a]; if (prop.declarations) { @@ -28448,17 +30727,15 @@ var ts; commonType = type; } else if (type !== commonType) { - hasNonUniformType = true; + checkFlags |= 32 /* HasNonUniformType */; } propTypes.push(type); } - var result = createSymbol(4 /* Property */ | 67108864 /* Transient */ | 268435456 /* SyntheticProperty */ | commonFlags, name); + var result = createSymbol(4 /* Property */ | commonFlags, name); + result.checkFlags = syntheticFlag | checkFlags; result.containingType = containingType; - result.hasNonUniformType = hasNonUniformType; - result.isPartial = isPartial; result.declarations = declarations; - result.isReadonly = isReadonly; - result.type = containingType.flags & 65536 /* Union */ ? getUnionType(propTypes) : getIntersectionType(propTypes); + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); return result; } // Return the symbol for a given property in a union or intersection type, or undefined if the property @@ -28467,12 +30744,12 @@ var ts; // these partial properties when identifying discriminant properties, but otherwise they are filtered out // and do not appear to be present in the union type. function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -28480,7 +30757,7 @@ var ts; function getPropertyOfUnionOrIntersectionType(type, name) { var property = getUnionOrIntersectionProperty(type, name); // We need to filter out partial properties in union types - return property && !(property.flags & 268435456 /* SyntheticProperty */ && property.isPartial) ? property : undefined; + return property && !(getCheckFlags(property) & 16 /* Partial */) ? property : undefined; } /** * Return the symbol for the property with the given name in the given type. Creates synthetic union properties when @@ -28494,7 +30771,7 @@ var ts; type = getApparentType(type); if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -28561,7 +30838,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -28583,16 +30860,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152 /* JavaScriptFile */) { - if (node.type && node.type.kind === 273 /* JSDocOptionalType */) { + if (node.flags & 65536 /* JavaScriptFile */) { + if (node.type && node.type.kind === 277 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -28603,7 +30880,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 277 /* JSDocOptionalType */; } } } @@ -28628,6 +30905,12 @@ var ts; ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } + var iife = ts.getImmediatelyInvokedFunctionExpression(node.parent); + if (iife) { + return !node.type && + !node.dotDotDotToken && + ts.indexOf(node.parent.parameters, node) >= iife.arguments.length; + } return false; } function createTypePredicateFromTypePredicateNode(node) { @@ -28647,19 +30930,68 @@ var ts; }; } } + /** + * Gets the minimum number of type arguments needed to satisfy all non-optional type + * parameters. + */ + function getMinTypeArgumentCount(typeParameters) { + var minTypeArgumentCount = 0; + if (typeParameters) { + for (var i = 0; i < typeParameters.length; i++) { + if (!getDefaultFromTypeParameter(typeParameters[i])) { + minTypeArgumentCount = i + 1; + } + } + } + return minTypeArgumentCount; + } + /** + * Fill in default types for unsupplied type arguments. If `typeArguments` is undefined + * when a default type is supplied, a new array will be created and returned. + * + * @param typeArguments The supplied type arguments. + * @param typeParameters The requested type parameters. + * @param minTypeArgumentCount The minimum number of required type arguments. + */ + function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, location) { + var numTypeParameters = ts.length(typeParameters); + if (numTypeParameters) { + var numTypeArguments = ts.length(typeArguments); + var isJavaScript = ts.isInJavaScriptFile(location); + if ((isJavaScript || numTypeArguments >= minTypeArgumentCount) && numTypeArguments <= numTypeParameters) { + if (!typeArguments) { + typeArguments = []; + } + // Map an unsatisfied type parameter with a default type. + // If a type parameter does not have a default type, or if the default type + // is a forward reference, the empty object type is used. + for (var i = numTypeArguments; i < numTypeParameters; i++) { + typeArguments[i] = isJavaScript ? anyType : emptyObjectType; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + var mapper = createTypeMapper(typeParameters, typeArguments); + var defaultType = getDefaultFromTypeParameter(typeParameters[i]); + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : isJavaScript ? anyType : emptyObjectType; + } + } + } + return typeArguments; + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); + var isUntypedSignatureInJSFile = !iife && !isJSConstructSignature && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration); // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; // Include parameter symbol instead of property symbol in the signature @@ -28674,43 +31006,36 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171 /* LiteralType */) { + if (param.type && param.type.kind === 172 /* LiteralType */) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - // If we see any required parameters, it means the prior ones were not in fact optional. - minArgumentCount = -1; + // Record a new minimum argument count if this is not an optional parameter + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param) || + isUntypedSignatureInJSFile; + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 151 /* GetAccessor */ || declaration.kind === 152 /* SetAccessor */) && + if ((declaration.kind === 152 /* GetAccessor */ || declaration.kind === 153 /* SetAccessor */) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = declaration.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 /* Constructor */ ? + var classType = declaration.kind === 151 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 /* TypePredicate */ ? + var typePredicate = declaration.type && declaration.type.kind === 157 /* TypePredicate */ ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -28727,7 +31052,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -28735,35 +31060,63 @@ var ts; } // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 151 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152 /* SetAccessor */); + if (declaration.kind === 152 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153 /* SetAccessor */); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { return anyType; } } + function containsArgumentsReference(declaration) { + var links = getNodeLinks(declaration); + if (links.containsArgumentsReference === undefined) { + if (links.flags & 8192 /* CaptureArguments */) { + links.containsArgumentsReference = true; + } + else { + links.containsArgumentsReference = traverse(declaration.body); + } + } + return links.containsArgumentsReference; + function traverse(node) { + if (!node) + return false; + switch (node.kind) { + case 70 /* Identifier */: + return node.text === "arguments" && ts.isPartOfExpression(node); + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return node.name.kind === 143 /* ComputedPropertyName */ + && traverse(node.name); + default: + return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && ts.forEachChild(node, traverse); + } + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 278 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -28810,7 +31163,7 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { var declaration = signature.declaration; if (declaration.name) { error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); @@ -28834,9 +31187,14 @@ var ts; return anyType; } function getSignatureInstantiation(signature, typeArguments) { + typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters)); var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true); @@ -28855,7 +31213,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 /* Constructor */ || signature.declaration.kind === 154 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 151 /* Constructor */ || signature.declaration.kind === 155 /* ConstructSignature */; var type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = emptyArray; @@ -28866,10 +31224,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 134 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 135 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -28896,21 +31254,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143 /* TypeParameter */).constraint; - } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 /* TypeParameter */ && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; + return ts.getDeclarationOfKind(type.symbol, 144 /* TypeParameter */).constraint; } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -28918,28 +31264,23 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144 /* TypeParameter */).parent); } function getTypeListId(types) { var result = ""; if (types) { - var length_3 = types.length; + var length_4 = types.length; var i = 0; - while (i < length_3) { + while (i < length_4) { var startId = types[i].id; var count = 1; - while (i + count < length_3 && types[i + count].id === startId + count) { + while (i + count < length_4 && types[i + count].id === startId + count) { count++; } if (result.length) { @@ -28960,8 +31301,8 @@ var ts; // that care about the presence of such types at arbitrary depth in a containing type. function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -28970,9 +31311,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4 /* Reference */, target.symbol); + type = createObjectType(4 /* Reference */, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -28988,21 +31330,26 @@ var ts; return type; } function getTypeReferenceArity(type) { - return type.target.typeParameters ? type.target.typeParameters.length : 0; + return ts.length(type.target.typeParameters); } // Get type from reference to class or interface function getTypeFromClassOrInterfaceReference(node, symbol) { var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (!ts.isInJavaScriptFile(node) && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */), minTypeArgumentCount, typeParameters.length); return unknownType; } // In a type reference, the outer type parameters of the referenced class or interface are automatically // supplied as type arguments and the type reference only specifies arguments for the local type parameters // of the class or interface. - return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode))); + var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, minTypeArgumentCount, node)); + return createTypeReference(type, typeArguments); } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); @@ -29015,7 +31362,11 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); + } + return instantiation; } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the @@ -29024,8 +31375,12 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length); return unknownType; } var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode); @@ -29047,11 +31402,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157 /* TypeReference */: + case 158 /* TypeReference */: return node.typeName; - case 272 /* JSDocTypeReference */: + case 276 /* JSDocTypeReference */: return node.name; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -29077,7 +31432,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 272 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 276 /* JSDocTypeReference */) { // A JSDocTypeReference may have resolved to a value (as opposed to a type). In // that case, the type of this reference is just the type of the value we resolved // to. @@ -29085,19 +31440,54 @@ var ts; } return getTypeFromNonGenericTypeReference(node, symbol); } + function getPrimitiveTypeFromJSDocTypeReference(node) { + if (ts.isIdentifier(node.name)) { + switch (node.name.text) { + case "String": + return stringType; + case "Number": + return numberType; + case "Boolean": + return booleanType; + case "Void": + return voidType; + case "Undefined": + return undefinedType; + case "Null": + return nullType; + case "Object": + return anyType; + case "Function": + return anyFunctionType; + case "Array": + case "array": + return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined; + case "Promise": + case "promise": + return !node.typeArguments || !node.typeArguments.length ? createPromiseType(anyType) : undefined; + } + } + } + function getTypeFromJSDocNullableTypeNode(node) { + var type = getTypeFromTypeNode(node.type); + return strictNullChecks ? getUnionType([type, nullType]) : type; + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272 /* JSDocTypeReference */) { - var typeReferenceName = getTypeReferenceName(node); - symbol = resolveTypeReferenceName(typeReferenceName); - type = getTypeReferenceType(node, symbol); + if (node.kind === 276 /* JSDocTypeReference */) { + type = getPrimitiveTypeFromJSDocTypeReference(node); + if (!type) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(typeReferenceName); + type = getTypeReferenceType(node, symbol); + } } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 157 /* TypeReference */ + var typeNameOrExpression = node.kind === 158 /* TypeReference */ ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -29129,12 +31519,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { - var declaration = declarations_3[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var declaration = declarations_4[_i]; switch (declaration.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: return declaration; } } @@ -29147,24 +31537,68 @@ var ts; error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return arity ? emptyGenericType : emptyObjectType; } - if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + if (ts.length(type.typeParameters) !== arity) { error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); return arity ? emptyGenericType : emptyObjectType; } return type; } - function getGlobalValueSymbol(name) { - return getGlobalSymbol(name, 107455 /* Value */, ts.Diagnostics.Cannot_find_global_value_0); + function getGlobalValueSymbol(name, reportErrors) { + return getGlobalSymbol(name, 107455 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined); } - function getGlobalTypeSymbol(name) { - return getGlobalSymbol(name, 793064 /* Type */, ts.Diagnostics.Cannot_find_global_type_0); + function getGlobalTypeSymbol(name, reportErrors) { + return getGlobalSymbol(name, 793064 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined); } function getGlobalSymbol(name, meaning, diagnostic) { return resolveName(undefined, name, meaning, diagnostic, name); } - function getGlobalType(name, arity) { + function getGlobalType(name, arity, reportErrors) { + var symbol = getGlobalTypeSymbol(name, reportErrors); + return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : undefined; + } + function getGlobalTypedPropertyDescriptorType() { + return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", /*arity*/ 1, /*reportErrors*/ true)) || emptyGenericType; + } + function getGlobalTemplateStringsArrayType() { + return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", /*arity*/ 0, /*reportErrors*/ true)) || emptyObjectType; + } + function getGlobalESSymbolConstructorSymbol(reportErrors) { + return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)); + } + function getGlobalESSymbolType(reportErrors) { + return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", /*arity*/ 0, reportErrors)) || emptyObjectType; + } + function getGlobalPromiseType(reportErrors) { + return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalPromiseConstructorSymbol(reportErrors) { + return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)); + } + function getGlobalPromiseConstructorLikeType(reportErrors) { + return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", /*arity*/ 0, reportErrors)) || emptyObjectType; + } + function getGlobalAsyncIterableType(reportErrors) { + return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIteratorType(reportErrors) { + return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIterableIteratorType(reportErrors) { + return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableType(reportErrors) { + return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalIteratorType(reportErrors) { + return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableIteratorType(reportErrors) { + return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalTypeOrUndefined(name, arity) { if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); + var symbol = getGlobalSymbol(name, 793064 /* Type */, /*diagnostic*/ undefined); + return symbol && getTypeOfGlobalSymbol(symbol, arity); } /** * Returns a type that is inside a namespace at the global scope, e.g. @@ -29175,26 +31609,26 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - /** - * Creates a TypeReference for a generic `TypedPropertyDescriptor`. - */ - function createTypedPropertyDescriptorType(propertyType) { - var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyGenericType - ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) - : emptyObjectType; - } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } - function createIterableType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); + function createTypedPropertyDescriptorType(propertyType) { + return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); + } + function createAsyncIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableType(/*reportErrors*/ true), [iteratedType]); + } + function createAsyncIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableIteratorType(/*reportErrors*/ true), [iteratedType]); } - function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); + function createIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableType(/*reportErrors*/ true), [iteratedType]); + } + function createIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(/*reportErrors*/ true), [iteratedType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -29219,7 +31653,7 @@ var ts; for (var i = 0; i < arity; i++) { var typeParameter = createType(16384 /* TypeParameter */); typeParameters.push(typeParameter); - var property = createSymbol(4 /* Property */ | 67108864 /* Transient */, "" + i); + var property = createSymbol(4 /* Property */, "" + i); property.type = typeParameter; properties.push(property); } @@ -29228,7 +31662,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -29312,14 +31746,14 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -29327,8 +31761,9 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -29414,10 +31849,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */); - type = unionTypes[id] = createType(65536 /* Union */ | propagatedFlags); + type = createType(65536 /* Union */ | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29438,15 +31874,27 @@ var ts; else if (type.flags & 1 /* Any */) { typeSet.containsAny = true; } + else if (getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type)) { + typeSet.containsEmptyObject = true; + } else if (!(type.flags & 8192 /* Never */) && (strictNullChecks || !(type.flags & 6144 /* Nullable */)) && !ts.contains(typeSet, type)) { - typeSet.push(type); + if (type.flags & 32768 /* Object */) { + typeSet.containsObjectType = true; + } + if (type.flags & 65536 /* Union */ && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } + if (!(type.flags & 32768 /* Object */ && type.objectFlags & 16 /* Anonymous */ && + type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */) && containsIdenticalType(typeSet, type))) { + typeSet.push(type); + } } } // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var type = types_9[_i]; addTypeToIntersection(typeSet, type); } } @@ -29464,31 +31912,31 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536 /* Union */) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), - /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { return anyType; } + if (typeSet.containsEmptyObject && !typeSet.containsObjectType) { + typeSet.push(emptyObjectType); + } if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), + /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 6144 /* Nullable */); - type = intersectionTypes[id] = createType(131072 /* Intersection */ | propagatedFlags); + type = createType(131072 /* Intersection */ | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29502,7 +31950,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144 /* Index */); type.resolvedIndexType.type = type; @@ -29518,7 +31966,7 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 /* TypeParameter */ ? getIndexTypeForTypeParameter(type) : + return maybeTypeOfKind(type, 540672 /* TypeVariable */) ? getIndexTypeForGenericType(type) : getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) : type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromPropertyNames(type); @@ -29541,7 +31989,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? @@ -29570,14 +32018,14 @@ var ts; getIndexInfoOfType(objectType, 0 /* String */) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } return indexInfo.type; } if (accessExpression && !isConstEnumObjectType(objectType)) { - if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { if (getIndexTypeOfType(objectType, 1 /* Number */)) { error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); } @@ -29589,7 +32037,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -29599,32 +32047,32 @@ var ts; else { error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); } + return unknownType; } - return unknownType; + return anyType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; - return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken); + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384 /* TypeParameter */ || - objectType.flags & 16384 /* TypeParameter */ && indexType.flags & 262144 /* Index */ || + // If the index type is generic, if the object type is generic and doesn't originate in an expression, + // or if the object type is a mapped type with a generic constraint, we are performing a higher-order + // index access where we cannot meaningfully access the properties of the object type. Note that for a + // generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to + // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved + // eagerly using the constraint type of 'this' at the given location. + if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || + maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 179 /* ElementAccessExpression */) || isGenericMappedType(objectType)) { - // If either the object type or the index type are type parameters, or if the object type is a mapped - // type with a generic constraint, we are performing a higher-order index access where we cannot - // meaningfully access the properties of the object type. In those cases, we first check that the - // index type is assignable to 'keyof T' for the object type. - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } + if (objectType.flags & 1 /* Any */) { + return objectType; } // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes // the index type for P. For example, for an index access { [P in K]: Box }[X], we construct the @@ -29634,8 +32082,13 @@ var ts; } // Otherwise we defer the operation by creating an indexed access type. var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } + // In the following we resolve T[K] to the type of the property in T selected by K. var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) { var propTypes = []; @@ -29677,7 +32130,7 @@ var ts; if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -29690,7 +32143,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -29701,11 +32154,27 @@ var ts; * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 /* Object */ | 1 /* Any */)) && !!(right.flags & (32768 /* Object */ | 1 /* Any */)), "Only object types may be spread."); + function getSpreadType(left, right) { if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (left.flags & 8192 /* Never */) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (right.flags & 8192 /* Never */) { + return left; + } + if (left.flags & 65536 /* Union */) { + return mapType(left, function (t) { return getSpreadType(t, right); }); + } + if (right.flags & 65536 /* Union */) { + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216 /* NonPrimitive */) { + return emptyObjectType; + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -29722,42 +32191,55 @@ var ts; for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; // we approximate own properties as non-methods plus methods that are inside the object literal - var isOwnProperty = !(rightProp.flags & 8192 /* Method */) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 /* SetAccessor */ && !(rightProp.flags & 32768 /* GetAccessor */); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 /* Private */ | 16 /* Protected */)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, getNonReadonlySymbol(rightProp)); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 /* SetAccessor */ && !(leftProp.flags & 32768 /* GetAccessor */) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); - if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 536870912 /* Optional */) { + if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 67108864 /* Optional */) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); - var flags = 4 /* Property */ | 67108864 /* Transient */ | (leftProp.flags & 536870912 /* Optional */); + var flags = 4 /* Property */ | (leftProp.flags & 67108864 /* Optional */); var result = createSymbol(flags, leftProp.name); result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072 /* NEUndefined */)]); result.leftSpread = leftProp; result.rightSpread = rightProp; result.declarations = declarations; - result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, getNonReadonlySymbol(leftProp)); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function getNonReadonlySymbol(prop) { + if (!isReadonlySymbol(prop)) { + return prop; + } + var flags = 4 /* Property */ | (prop.flags & 67108864 /* Optional */); + var result = createSymbol(flags, prop.name); + result.type = getTypeOfSymbol(prop); + result.declarations = prop.declarations; + result.syntheticOrigin = prop; + return result; + } + function isClassMethod(prop) { + return prop.flags & 8192 /* Method */ && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -29779,7 +32261,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 /* StringLiteral */ ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -29807,9 +32293,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229 /* InterfaceDeclaration */)) { if (!(ts.getModifierFlags(container) & 32 /* Static */) && - (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -29826,87 +32312,84 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 263 /* JSDocAllType */: - case 264 /* JSDocUnknownType */: + case 267 /* JSDocAllType */: + case 268 /* JSDocUnknownType */: return anyType; - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return stringType; case 132 /* NumberKeyword */: return numberType; case 121 /* BooleanKeyword */: return booleanType; - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return esSymbolType; case 104 /* VoidKeyword */: return voidType; - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: return undefinedType; case 94 /* NullKeyword */: return nullType; case 129 /* NeverKeyword */: return neverType; - case 289 /* JSDocNullKeyword */: - return nullType; - case 290 /* JSDocUndefinedKeyword */: - return undefinedType; - case 291 /* JSDocNeverKeyword */: - return neverType; - case 167 /* ThisType */: + case 133 /* ObjectKeyword */: + return nonPrimitiveType; + case 168 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 288 /* JSDocLiteralType */: + case 292 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); - case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 276 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return booleanType; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 162 /* ArrayType */: - case 265 /* JSDocArrayType */: + case 163 /* ArrayType */: + case 269 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 164 /* UnionType */: - case 266 /* JSDocUnionType */: + case 165 /* UnionType */: + case 270 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 166 /* ParenthesizedType */: - case 268 /* JSDocNullableType */: - case 269 /* JSDocNonNullableType */: - case 276 /* JSDocConstructorType */: - case 277 /* JSDocThisType */: - case 273 /* JSDocOptionalType */: + case 272 /* JSDocNullableType */: + return getTypeFromJSDocNullableTypeNode(node); + case 167 /* ParenthesizedType */: + case 273 /* JSDocNonNullableType */: + case 280 /* JSDocConstructorType */: + case 281 /* JSDocThisType */: + case 277 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 270 /* JSDocRecordType */: + case 274 /* JSDocRecordType */: return getTypeFromTypeNode(node.literal); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 274 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 291 /* JSDocTypeLiteral */: + case 278 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return getTypeFromMappedTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267 /* JSDocTupleType */: + case 271 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 275 /* JSDocVariadicType */: + case 279 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -29933,13 +32416,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -29950,15 +32433,23 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } function createTypeEraser(sources) { - return createTypeMapper(sources, undefined); + return createTypeMapper(sources, /*targets*/ undefined); + } + /** + * Maps forward-references to later types parameters to the empty object type. + * This is used during inference when instantiating type parameter defaults. + */ + function createBackreferenceMapper(typeParameters, index) { + var mapper = function (t) { return ts.indexOf(typeParameters, t) >= index ? emptyObjectType : t; }; + mapper.mappedTypes = typeParameters; + return mapper; } function getInferenceMapper(context) { if (!context.mapper) { @@ -29983,7 +32474,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -30031,7 +32527,7 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(symbol) & 1 /* Instantiated */) { var links = getSymbolLinks(symbol); // If symbol being instantiated is itself a instantiation, fetch the original target and combine the // type mappers. This ensures that original type identities are properly preserved and that aliases @@ -30041,7 +32537,8 @@ var ts; } // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - var result = createSymbol(16777216 /* Instantiated */ | 67108864 /* Transient */ | symbol.flags, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); + result.checkFlags = 1 /* Instantiated */; result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -30060,25 +32557,24 @@ var ts; return result; } function instantiateMappedType(type, mapper) { - // Check if we have an isomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some - // type parameter T. If so, the mapped type is distributive over a union type and when T is instantiated + // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some + // type variable T. If so, the mapped type is distributive over a union type and when T is instantiated // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for - // isomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a + // homomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a // union type A | undefined, we produce { [P in keyof A]: X } | undefined. var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144 /* Index */) { - var typeParameter_1 = constraintType.type; - var mappedTypeParameter = mapper(typeParameter_1); - if (typeParameter_1 !== mappedTypeParameter) { - return mapType(mappedTypeParameter, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeParameter_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + var typeVariable_1 = constraintType.type; + if (typeVariable_1.flags & 16384 /* TypeParameter */) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -30102,26 +32598,28 @@ var ts; // Starting with the parent of the symbol's declaration, check if the mapper maps any of // the type parameters introduced by enclosing declarations. We just pick the first // declaration since multiple declarations will all have the same parent anyway. - var node = symbol.declarations[0].parent; - while (node) { + return !!ts.findAncestor(symbol.declarations[0], function (node) { + if (node.kind === 232 /* ModuleDeclaration */ || node.kind === 264 /* SourceFile */) { + return "quit"; + } switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -30131,25 +32629,34 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(node) || node.kind === 229 /* InterfaceDeclaration */) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: - return false; + case 171 /* MappedType */: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 278 /* JSDocFunctionType */: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; } - node = node.parent; - } - return false; + }); } function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 /* SourceFile */ || parentKind === 231 /* ModuleBlock */; + return parentKind === 264 /* SourceFile */ || parentKind === 233 /* ModuleBlock */; } return false; } @@ -30226,28 +32733,36 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return node.operatorToken.kind === 53 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isContextSensitive(node.expression); + case 253 /* JsxAttributes */: + return ts.forEach(node.properties, isContextSensitive); + case 252 /* JsxAttribute */: + // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. + return node.initializer && isContextSensitive(node.initializer); + case 255 /* JsxExpression */: + // It is possible to that node.expression is undefined (e.g
) + return node.expression && isContextSensitive(node.expression); } return false; } @@ -30261,7 +32776,7 @@ var ts; return true; } // For arrow functions we now know we're not context sensitive. - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { return false; } // If the first parameter is not an explicit 'this' parameter, then the function has @@ -30283,9 +32798,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } // TYPE CHECKING @@ -30308,7 +32826,7 @@ var ts; // subtype of T but not structurally identical to T. This specifically means that two distinct but // structurally identical types (such as two classes) are not considered instances of each other. function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } /** * This is *not* a bi-directional relationship. @@ -30334,12 +32852,13 @@ var ts; return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { - return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; + return compareSignaturesRelated(source, target, /*checkAsCallback*/ false, ignoreReturnTypes, /*reportErrors*/ false, + /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; } /** * See signatureRelatedTo, compareSignaturesIdentical */ - function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + function compareSignaturesRelated(source, target, checkAsCallback, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { // TODO (drosen): De-duplicate code between related functions. if (source === target) { return -1 /* True */; @@ -30374,9 +32893,23 @@ var ts; var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); + var sourceType = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var targetType = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var sourceSig = getSingleCallSignature(getNonNullableType(sourceType)); + var targetSig = getSingleCallSignature(getNonNullableType(targetType)); + // In order to ensure that any generic type Foo is at least co-variant with respect to T no matter + // how Foo uses T, we need to relate parameters bi-variantly (given that parameters are input positions, + // they naturally relate only contra-variantly). However, if the source and target parameters both have + // function types with a single call signature, we known we are relating two callback parameters. In + // that case it is sufficient to only relate the parameters of the signatures co-variantly because, + // similar to return values, callback parameters are output positions. This means that a Promise, + // where T is used only in callback parameter positions, will be co-variant (as opposed to bi-variant) + // with respect to T. + var callbacks = sourceSig && targetSig && !sourceSig.typePredicate && !targetSig.typePredicate && + (getFalsyFlags(sourceType) & 6144 /* Nullable */) === (getFalsyFlags(targetType) & 6144 /* Nullable */); + var related = callbacks ? + compareSignaturesRelated(targetSig, sourceSig, /*checkAsCallback*/ true, /*ignoreReturnTypes*/ false, reportErrors, errorReporter, compareTypes) : + !checkAsCallback && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -30404,7 +32937,11 @@ var ts; } } else { - result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + // When relating callback signatures, we still need to relate return types bi-variantly as otherwise + // the containing type wouldn't be co-variant. For example, interface Foo { add(cb: () => T): void } + // wouldn't be co-variant for T without this rule. + result &= checkAsCallback && compareTypes(targetReturnType, sourceReturnType, /*reportErrors*/ false) || + compareTypes(sourceReturnType, targetReturnType, reportErrors); } } return result; @@ -30471,18 +33008,33 @@ var ts; sourceNonRestParamCount; } } + function isEmptyResolvedType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } + function isEmptyObjectType(type) { + return type.flags & 32768 /* Object */ ? isEmptyResolvedType(resolveStructuredTypeMembers(type)) : + type.flags & 65536 /* Union */ ? ts.forEach(type.types, isEmptyObjectType) : + type.flags & 131072 /* Intersection */ ? !ts.forEach(type.types, function (t) { return !isEmptyObjectType(t); }) : + false; + } function isEnumTypeRelatedTo(source, target, errorReporter) { if (source === target) { return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) || (source.flags & 65536 /* Union */) !== (target.flags & 65536 /* Union */)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -30493,11 +33045,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192 /* Never */) @@ -30518,6 +33072,8 @@ var ts; return true; if (source.flags & 4096 /* Null */ && (!strictNullChecks || target.flags & 4096 /* Null */)) return true; + if (source.flags & 32768 /* Object */ && target.flags & 16777216 /* NonPrimitive */) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1 /* Any */) return true; @@ -30549,13 +33105,13 @@ var ts; } if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1 /* Succeeded */; } } - if (source.flags & 507904 /* StructuredOrTypeParameter */ || target.flags & 507904 /* StructuredOrTypeParameter */) { - return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); + if (source.flags & 1032192 /* StructuredOrTypeVariable */ || target.flags & 1032192 /* StructuredOrTypeVariable */) { + return checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined); } return false; } @@ -30619,14 +33175,35 @@ var ts; if ((globalStringType === source && stringType === target) || (globalNumberType === source && numberType === target) || (globalBooleanType === source && booleanType === target) || - (getGlobalESSymbolType() === source && esSymbolType === target)) { + (getGlobalESSymbolType(/*reportErrors*/ false) === source && esSymbolType === target)) { reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } - // Compare two types and return - // Ternary.True if they are related with no assumptions, - // Ternary.Maybe if they are related with assumptions of other relationships, or - // Ternary.False if they are not related. + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608 /* UnionOrIntersection */)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144 /* Nullable */) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } + /** + * Compare two types and return + * * Ternary.True if they are related with no assumptions, + * * Ternary.Maybe if they are related with assumptions of other relationships, or + * * Ternary.False if they are not related. + */ function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) { @@ -30654,7 +33231,7 @@ var ts; // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & 196608 /* UnionOrIntersection */) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -30673,122 +33250,37 @@ var ts; return result; } } - else if (target.flags & 65536 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */) && !(target.flags & 8190 /* Primitive */))) { - return result; - } - } - else if (target.flags & 131072 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { - return result; - } - } - else if (source.flags & 131072 /* Intersection */) { - // Check to see if any constituents of the intersection are immediately related to the target. - // - // Don't report errors though. Checking whether a constituent is related to the source is not actually - // useful and leads to some confusing error messages. Instead it is better to let the below checks - // take care of this, or to not elaborate at all. For instance, - // - // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. - // - // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection - // than to report that 'D' is not assignable to 'A' or 'B'. - // - // - For a primitive type or type parameter (such as 'number = A & B') there is no point in - // breaking the intersection apart. - if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { - return result; - } - } - if (target.flags & 16384 /* TypeParameter */) { - // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. - if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) { - if (!source.declaration.questionToken) { - var templateType = getTemplateTypeFromMappedType(source); - var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); - if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { - return result; - } - } - } - else { - // Given a type parameter K with a constraint keyof T, a type S is - // assignable to K if S is assignable to keyof T. - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144 /* Index */) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } - } - else if (target.flags & 262144 /* Index */) { - // A keyof S is related to a keyof T if T is related to S. - if (source.flags & 262144 /* Index */) { - if (result = isRelatedTo(target.type, source.type, /*reportErrors*/ false)) { - return result; - } - } - // Given a type parameter T with a constraint C, a type S is assignable to - // keyof T if S is assignable to keyof C. - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } - } - } - else if (target.flags & 524288 /* IndexedAccess */) { - // if we have indexed access types with identical index types, see if relationship holds for - // the two object types. - if (source.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) { - if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { - return result; - } - } - } - if (source.flags & 16384 /* TypeParameter */) { - // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X. - if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) { - var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); - var templateType = getTemplateTypeFromMappedType(target); - if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + else { + if (target.flags & 65536 /* Union */) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */) && !(target.flags & 8190 /* Primitive */))) { return result; } } - else { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1 /* Any */) { - constraint = emptyObjectType; - } - // The constraint may need to be further instantiated with its 'this' type. - constraint = getTypeWithThisArgument(constraint, source); - // Report constraint errors only if the constraint is not the empty object type - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; + else if (target.flags & 131072 /* Intersection */) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - } - else { - if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { - // We have type references to same target type, see if relationship holds for all type arguments - if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + else if (source.flags & 131072 /* Intersection */) { + // Check to see if any constituents of the intersection are immediately related to the target. + // + // Don't report errors though. Checking whether a constituent is related to the source is not actually + // useful and leads to some confusing error messages. Instead it is better to let the below checks + // take care of this, or to not elaborate at all. For instance, + // + // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. + // + // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection + // than to report that 'D' is not assignable to 'A' or 'B'. + // + // - For a primitive type or type parameter (such as 'number = A & B') there is no point in + // breaking the intersection apart. + if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { return result; } } - // Even if relationship doesn't hold for unions, intersections, or generic type references, - // it may hold in a structural comparison. - var apparentSource = getApparentType(source); - // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates - // to X. Failing both of those we want to check if the aggregation of A and B's members structurally - // relates to X. Thus, we include intersection types on the source side here. - if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { - // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + if (source.flags & 1032192 /* StructuredOrTypeVariable */ || target.flags & 1032192 /* StructuredOrTypeVariable */) { + if (result = recursiveTypeRelatedTo(source, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -30808,13 +33300,7 @@ var ts; function isIdenticalTo(source, target) { var result; if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { - if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { - // We have type references to same target type, see if all type arguments are identical - if (result = typeArgumentsRelatedTo(source, target, /*reportErrors*/ false)) { - return result; - } - } - return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false); + return recursiveTypeRelatedTo(source, target, /*reportErrors*/ false); } if (source.flags & 65536 /* Union */ && target.flags & 65536 /* Union */ || source.flags & 131072 /* Intersection */ && target.flags & 131072 /* Intersection */) { @@ -30830,45 +33316,49 @@ var ts; // is considered known if the object type is empty and the check is for assignability, if the object type has // index signatures, or if the property is actually declared in the object type. In a union or intersection // type, a property is considered known if it is known in any constituent type. - function isKnownProperty(type, name) { + function isKnownProperty(type, name, isComparingJsxAttributes) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || - resolved.stringIndexInfo || - (resolved.numberIndexInfo && isNumericLiteralName(name)) || - getPropertyOfType(type, name)) { + if (resolved.stringIndexInfo || resolved.numberIndexInfo && isNumericLiteralName(name) || + getPropertyOfType(type, name) || isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) { + // For JSXAttributes, if the attribute has a hyphenated name, consider that the attribute to be known. return true; } } else if (type.flags & 196608 /* UnionOrIntersection */) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; - if (isKnownProperty(t, name)) { + if (isKnownProperty(t, name, isComparingJsxAttributes)) { return true; } } } return false; } - function isEmptyObjectType(t) { - return t.properties.length === 0 && - t.callSignatures.length === 0 && - t.constructSignatures.length === 0 && - !t.stringIndexInfo && - !t.numberIndexInfo; - } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768 /* Object */) && !(getObjectFlags(target) & 512 /* ObjectLiteralPatternWithComputedProperties */)) { + var isComparingJsxAttributes = !!(source.flags & 33554432 /* JsxAttributes */); + if ((relation === assignableRelation || relation === comparableRelation) && + (isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) { + return false; + } for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (!isKnownProperty(target, prop.name)) { + if (!isKnownProperty(target, prop.name, isComparingJsxAttributes)) { if (reportErrors) { // We know *exactly* where things went wrong when comparing the types. // Use this property as the error node as this will be more helpful in // reasoning about what went wrong. ts.Debug.assert(!!errorNode); - errorNode = prop.valueDeclaration; - reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + if (ts.isJsxAttributes(errorNode)) { + // JsxAttributes has an object-literal flag and undergo same type-assignablity check as normal object-literal. + // However, using an object-literal error message will be very confusing to the users so we give different a message. + reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target)); + } + else { + errorNode = prop.valueDeclaration; + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } } return true; } @@ -30894,20 +33384,42 @@ var ts; if (target.flags & 65536 /* Union */ && containsType(targetTypes, source)) { return -1 /* True */; } - var len = targetTypes.length; - for (var i = 0; i < len; i++) { - var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var type = targetTypes_1[_i]; + var related = isRelatedTo(source, type, /*reportErrors*/ false); if (related) { return related; } } + if (reportErrors) { + var discriminantType = findMatchingDiscriminantType(source, target); + isRelatedTo(source, discriminantType || targetTypes[targetTypes.length - 1], /*reportErrors*/ true); + } return 0 /* False */; } + function findMatchingDiscriminantType(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + if (sourceProperties) { + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProperty = sourceProperties_1[_i]; + if (isDiscriminantProperty(target, sourceProperty.name)) { + var sourceType = getTypeOfSymbol(sourceProperty); + for (var _a = 0, _b = target.types; _a < _b.length; _a++) { + var type = _b[_a]; + var targetType = getTypeOfPropertyOfType(type, sourceProperty.name); + if (targetType && isRelatedTo(sourceType, targetType)) { + return type; + } + } + } + } + } + } function typeRelatedToEachType(source, target, reportErrors) { var result = -1 /* True */; var targetTypes = target.types; - for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { - var targetType = targetTypes_1[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var targetType = targetTypes_2[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0 /* False */; @@ -30960,22 +33472,22 @@ var ts; } return result; } - // Determine if two object types are related by structure. First, check if the result is already available in the global cache. + // Determine if possibly recursive types are related. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are // equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion // and issue an error. Otherwise, actually compare the structure of the two types. - function objectTypeRelatedTo(source, originalSource, target, reportErrors) { + function recursiveTypeRelatedTo(source, target, reportErrors) { if (overflow) { return 0 /* False */; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2 /* Failed */) { // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported // failure and continue computing the relation such that errors get reported. - relation[id] = 3 /* FailedAndReported */; + relation.set(id, 3 /* FailedAndReported */); } else { return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; @@ -30984,7 +33496,7 @@ var ts; if (depth > 0) { for (var i = 0; i < depth; i++) { // If source and target are already being compared, consider them related with assumptions - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1 /* Maybe */; } } @@ -31002,75 +33514,192 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1 /* Succeeded */; + maybeStack[depth].set(id, 1 /* Succeeded */); depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth)) expandingFlags |= 1; - if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) + if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, depth)) expandingFlags |= 2; - var result; - if (expandingFlags === 3) { - result = 1 /* Maybe */; - } - else if (isGenericMappedType(source) || isGenericMappedType(target)) { - result = mappedTypeRelatedTo(source, target, reportErrors); - } - else { - result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); - if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 0 /* String */, reportErrors); - if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 1 /* Number */, reportErrors); - } - } - } - } - } + var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors) : 1 /* Maybe */; expandingFlags = saveExpandingFlags; depth--; if (result) { var maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); + ts.copyEntries(maybeCache, destinationCache); } else { // A false result goes straight into global cache (when something is false under assumptions it // will also be false without assumptions) - relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */; + relation.set(id, reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */); } return result; } - // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. - function mappedTypeRelatedTo(source, target, reportErrors) { - if (isGenericMappedType(target)) { - if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } + function structuredTypeRelatedTo(source, target, reportErrors) { + var result; + var saveErrorInfo = errorInfo; + if (target.flags & 16384 /* TypeParameter */) { + // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. + if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; } } + } + } + else if (target.flags & 262144 /* Index */) { + // A keyof S is related to a keyof T if T is related to S. + if (source.flags & 262144 /* Index */) { + if (result = isRelatedTo(target.type, source.type, /*reportErrors*/ false)) { + return result; + } + } + // A type S is assignable to keyof T if S is assignable to keyof C, where C is the + // constraint of T. + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + else if (target.flags & 524288 /* IndexedAccess */) { + // A type S is related to a type T[K] if S is related to A[K], where K is string-like and + // A is the apparent type of S. + var constraint = getConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + if (source.flags & 16384 /* TypeParameter */) { + // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X. + if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else { + var constraint = getConstraintOfTypeParameter(source); + // A type parameter with no constraint is not related to the non-primitive object type. + if (constraint || !(target.flags & 16777216 /* NonPrimitive */)) { + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // Report constraint errors only if the constraint is not the empty object type + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + } + else if (source.flags & 524288 /* IndexedAccess */) { + // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and + // A is the apparent type of S. + var constraint = getConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else if (target.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) { + // if we have indexed access types with identical index types, see if relationship holds for + // the two object types. + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } + } + else { + if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { + // We have type references to same target type, see if relationship holds for all type arguments + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + return result; + } + } + // Even if relationship doesn't hold for unions, intersections, or generic type references, + // it may hold in a structural comparison. + var sourceIsPrimitive = !!(source.flags & 8190 /* Primitive */); + if (relation !== identityRelation) { + source = getApparentType(source); + } + // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates + // to X. Failing both of those we want to check if the aggregation of A and B's members structurally + // relates to X. Thus, we include intersection types on the source side here. + if (source.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { + // Report structural errors only if we haven't reported any errors yet + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; + if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportStructuralErrors); + } else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + result = propertiesRelatedTo(source, target, reportStructuralErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 0 /* String */, sourceIsPrimitive, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 1 /* Number */, sourceIsPrimitive, reportStructuralErrors); + } + } } } } + if (result) { + errorInfo = saveErrorInfo; + return result; + } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1 /* True */; + return 0 /* False */; + } + // A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is + // related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice + // that S and T are contra-variant whereas X and Y are co-variant. + function mappedTypeRelatedTo(source, target, reportErrors) { + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1 /* True */; + } + } + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { + return -1 /* True */; + } } return 0 /* False */; } @@ -31081,22 +33710,28 @@ var ts; var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128 /* ObjectLiteral */); - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var targetProp = properties_3[_i]; + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var targetProp = properties_4[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (!(targetProp.flags & 536870912 /* Optional */) || requireOptionalProperties) { + if (!(targetProp.flags & 67108864 /* Optional */) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } return 0 /* False */; } } - else if (!(targetProp.flags & 134217728 /* Prototype */)) { + else if (!(targetProp.flags & 16777216 /* Prototype */)) { var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) { + if (getCheckFlags(sourceProp) & 256 /* ContainsPrivate */) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); + } + return 0 /* False */; + } if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) { @@ -31110,12 +33745,9 @@ var ts; } } else if (targetPropFlags & 16 /* Protected */) { - var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; - var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); - if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (!isValidOverrideOf(sourceProp, targetProp)) { if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)); } return 0 /* False */; } @@ -31135,7 +33767,7 @@ var ts; } result &= related; // When checking for comparability, be more lenient with optional properties. - if (relation !== comparableRelation && sourceProp.flags & 536870912 /* Optional */ && !(targetProp.flags & 536870912 /* Optional */)) { + if (relation !== comparableRelation && sourceProp.flags & 67108864 /* Optional */ && !(targetProp.flags & 67108864 /* Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -31163,8 +33795,8 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { - var sourceProp = sourceProperties_1[_i]; + for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { + var sourceProp = sourceProperties_2[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0 /* False */; @@ -31228,7 +33860,7 @@ var ts; * See signatureAssignableTo, compareSignaturesIdentical */ function signatureRelatedTo(source, target, reportErrors) { - return compareSignaturesRelated(source, target, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); + return compareSignaturesRelated(source, target, /*checkAsCallback*/ false, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -31237,7 +33869,7 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; @@ -31270,12 +33902,12 @@ var ts; } return related; } - function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + function indexTypesRelatedTo(source, target, kind, sourceIsPrimitive, reportErrors) { if (relation === identityRelation) { return indexTypesIdenticalTo(source, target, kind); } var targetInfo = getIndexInfoOfType(target, kind); - if (!targetInfo || ((targetInfo.type.flags & 1 /* Any */) && !(originalSource.flags & 8190 /* Primitive */))) { + if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) { // Index signature of type any permits assignment from everything but primitives return -1 /* True */; } @@ -31337,6 +33969,45 @@ var ts; return false; } } + // Invoke the callback for each underlying property symbol of the given symbol and return the first + // value that isn't undefined. + function forEachProperty(prop, callback) { + if (getCheckFlags(prop) & 6 /* Synthetic */) { + for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { + var t = _a[_i]; + var p = getPropertyOfType(t, prop.name); + var result = p && forEachProperty(p, callback); + if (result) { + return result; + } + } + return undefined; + } + return callback(prop); + } + // Return the declaring class type of a property or undefined if property not declared in class + function getDeclaringClass(prop) { + return prop.parent && prop.parent.flags & 32 /* Class */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : undefined; + } + // Return true if some underlying source property is declared in a class that derives + // from the given base class. + function isPropertyInClassDerivedFrom(prop, baseClass) { + return forEachProperty(prop, function (sp) { + var sourceClass = getDeclaringClass(sp); + return sourceClass ? hasBaseType(sourceClass, baseClass) : false; + }); + } + // Return true if source property is a valid override of protected parts of target property. + function isValidOverrideOf(sourceProp, targetProp) { + return !forEachProperty(targetProp, function (tp) { return getDeclarationModifierFlagsFromSymbol(tp) & 16 /* Protected */ ? + !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; }); + } + // Return true if the given class derives from each of the declaring classes of the protected + // constituents of the given property. + function isClassDerivedFromDeclaringClasses(checkClass, prop) { + return forEachProperty(prop, function (p) { return getDeclarationModifierFlagsFromSymbol(p) & 16 /* Protected */ ? + !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass; + } // Return true if the given type is the constructor type for an abstract class function isAbstractConstructorType(type) { if (getObjectFlags(type) & 16 /* Anonymous */) { @@ -31350,22 +34021,24 @@ var ts; } return false; } - // Return true if the given type is part of a deeply nested chain of generic instantiations. We consider this to be the case - // when structural type comparisons have been started for 10 or more instantiations of the same generic type. It is possible, - // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely expanding. - // Effectively, we will generate a false positive when two types are structurally equal to at least 10 levels, but unequal at - // some level beyond that. - function isDeeplyNestedGeneric(type, stack, depth) { - // We track type references (created by createTypeReference) and instantiated types (created by instantiateType) - if (getObjectFlags(type) & (4 /* Reference */ | 64 /* Instantiated */) && depth >= 5) { + // Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons + // for 5 or more occurrences or instantiations of the type have been recorded on the given stack. It is possible, + // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely + // expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5 + // levels, but unequal at some level beyond that. + function isDeeplyNestedType(type, stack, depth) { + // We track all object types that have an associated symbol (representing the origin of the type) + if (depth >= 5 && type.flags & 32768 /* Object */) { var symbol = type.symbol; - var count = 0; - for (var i = 0; i < depth; i++) { - var t = stack[i]; - if (getObjectFlags(t) & (4 /* Reference */ | 64 /* Instantiated */) && t.symbol === symbol) { - count++; - if (count >= 5) - return true; + if (symbol) { + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 32768 /* Object */ && t.symbol === symbol) { + count++; + if (count >= 5) + return true; + } } } } @@ -31392,7 +34065,7 @@ var ts; } } else { - if ((sourceProp.flags & 536870912 /* Optional */) !== (targetProp.flags & 536870912 /* Optional */)) { + if ((sourceProp.flags & 67108864 /* Optional */) !== (targetProp.flags & 67108864 /* Optional */)) { return 0 /* False */; } } @@ -31436,7 +34109,7 @@ var ts; // the constraints with a common set of type arguments to get relatable entities in places where // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile, // particularly as we're comparing erased versions of the signatures below. - if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { + if (ts.length(source.typeParameters) !== ts.length(target.typeParameters)) { return 0 /* False */; } // Spec 1.0 Section 3.8.3 & 3.8.4: @@ -31476,8 +34149,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -31485,8 +34158,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -31592,8 +34265,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getFalsyFlags(t); } return result; @@ -31625,7 +34298,7 @@ var ts; types.push(undefinedType); if (flags & 4096 /* Null */) types.push(nullType); - return getUnionType(types, /*subtypeReduction*/ true); + return getUnionType(types); } function removeDefinitelyFalsyTypes(type) { return getFalsyFlags(type) & 7392 /* DefinitelyFalsy */ ? @@ -31644,8 +34317,8 @@ var ts; getSignaturesOfType(type, 0 /* Call */).length === 0 && getSignaturesOfType(type, 1 /* Construct */).length === 0; } - function createTransientSymbol(source, type) { - var symbol = createSymbol(source.flags | 67108864 /* Transient */, source.name); + function createSymbolWithType(source, type) { + var symbol = createSymbol(source.flags, source.name); symbol.declarations = source.declarations; symbol.parent = source.parent; symbol.type = type; @@ -31661,9 +34334,8 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createSymbolWithType(property, updated)); } - ; return members; } /** @@ -31687,11 +34359,19 @@ var ts; type.regularType = regularNew; return regularNew; } + function getWidenedProperty(prop) { + var original = getTypeOfSymbol(prop); + var widened = getWidenedType(original); + return widened === original ? prop : createSymbolWithType(prop, widened); + } function getWidenedTypeOfObjectLiteral(type) { - var members = transformTypeOfMembers(type, function (prop) { - var widened = getWidenedType(prop); - return prop === widened ? prop : widened; - }); + var members = ts.createMap(); + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + // Since get accessors already widen their return value there is no need to + // widen accessor based properties here. + members.set(prop.name, prop.flags & 4 /* Property */ ? getWidenedProperty(prop) : prop); + } var stringIndexInfo = getIndexInfoOfType(type, 0 /* String */); var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); @@ -31763,25 +34443,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144 /* Parameter */: + case 145 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -31794,7 +34474,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152 /* ContainsWideningType */) { + if (produceDiagnostics && noImplicitAny && type.flags & 2097152 /* ContainsWideningType */) { // Report implicit any error within type if possible, otherwise report error on declaration if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); @@ -31821,13 +34501,14 @@ var ts; callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } - function createInferenceContext(signature, inferUnionTypes) { + function createInferenceContext(signature, inferUnionTypes, useAnyForNoInferences) { var inferences = ts.map(signature.typeParameters, createTypeInferencesObject); return { signature: signature, inferUnionTypes: inferUnionTypes, inferences: inferences, inferredTypes: new Array(signature.typeParameters.length), + useAnyForNoInferences: useAnyForNoInferences }; } function createTypeInferencesObject() { @@ -31841,25 +34522,73 @@ var ts; // Return true if the given type could possibly reference a type parameter for which // we perform type inference (i.e. a type parameter of a generic function). We cache // results for union and intersection types for performance reasons. - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 /* TypeParameter */ || - objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 /* TypeVariable */ || + objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) || objectFlags & 32 /* Mapped */ || - type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 /* UnionOrIntersection */ && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct + // an object type with the same set of properties as the source type, where the type of each + // property is computed by inferring from the source property type to X for the type + // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0 /* String */); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 67108864 /* Optional */; + var members = createSymbolTable(properties); + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var prop = properties_5[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.name); + inferredProp.checkFlags = readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0; + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + members.set(prop.name, inferredProp); + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, /*subtypeReduction*/ true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -31875,7 +34604,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -31927,7 +34656,7 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384 /* TypeParameter */) { + if (target.flags & 540672 /* TypeVariable */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). // Because the anyFunctionType is internal, it should not be exposed to the user by adding @@ -31937,9 +34666,9 @@ var ts; if (source.flags & 8388608 /* ContainsAnyFunctionType */) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { // Any inferences that are made to a type parameter in a union type are inferior // to inferences made to a flat (non-union) type. This is because if we infer to @@ -31953,7 +34682,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 /* TypeParameter */ && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -31972,25 +34701,25 @@ var ts; } else if (target.flags & 196608 /* UnionOrIntersection */) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - // First infer to each type in union or intersection that isn't a type parameter - for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { - var t = targetTypes_2[_d]; - if (t.flags & 16384 /* TypeParameter */ && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + var typeVariableCount = 0; + var typeVariable = void 0; + // First infer to each type in union or intersection that isn't a type variable + for (var _d = 0, targetTypes_3 = targetTypes; _d < targetTypes_3.length; _d++) { + var t = targetTypes_3[_d]; + if (t.flags & 540672 /* TypeVariable */ && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - // Next, if target containings a single naked type parameter, make a secondary inference to that type - // parameter. This gives meaningful results for union types in co-variant positions and intersection + // Next, if target containings a single naked type variable, make a secondary inference to that type + // variable. This gives meaningful results for union types in co-variant positions and intersection // types in contra-variant positions (such as callback parameters). - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -32008,14 +34737,14 @@ var ts; if (isInProcess(source, target)) { return; } - if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { + if (isDeeplyNestedType(source, sourceStack, depth) && isDeeplyNestedType(target, targetStack, depth)) { return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -32031,12 +34760,25 @@ var ts; function inferFromObjectTypes(source, target) { if (getObjectFlags(target) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32 /* Mapped */) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); + if (constraintType.flags & 262144 /* Index */) { + // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X }, + // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source + // type and then make a secondary inference from that type to T. We make a secondary inference + // such that direct inferences to T get priority over inferences to Partial, for example. + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } return; } if (constraintType.flags & 16384 /* TypeParameter */) { + // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type + // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. inferFromTypes(getIndexType(source), constraintType); inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); return; @@ -32049,8 +34791,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var targetProp = properties_6[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -32100,8 +34842,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -32151,11 +34893,20 @@ var ts; inferenceSucceeded = !!unionOrSuperType; } else { - // Infer the empty object type when no inferences were made. It is important to remember that - // in this case, inference still succeeds, meaning there is no error for not having inference - // candidates. An inference error only occurs when there are *conflicting* candidates, i.e. + // Infer either the default or the empty object type when no inferences were + // made. It is important to remember that in this case, inference still + // succeeds, meaning there is no error for not having inference candidates. An + // inference error only occurs when there are *conflicting* candidates, i.e. // candidates with no common supertype. - inferredType = emptyObjectType; + var defaultType = getDefaultFromTypeParameter(context.signature.typeParameters[index]); + if (defaultType) { + // Instantiate the default type. Any forward reference to a type + // parameter should be instantiated to the empty object type. + inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context.signature.typeParameters, index), getInferenceMapper(context))); + } + else { + inferredType = context.useAnyForNoInferences ? anyType : emptyObjectType; + } inferenceSucceeded = true; } context.inferredTypes[index] = inferredType; @@ -32196,19 +34947,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - while (node) { - switch (node.kind) { - case 160 /* TypeQuery */: - return true; - case 70 /* Identifier */: - case 141 /* QualifiedName */: - node = node.parent; - continue; - default: - return false; - } - } - ts.Debug.fail("should not get here"); + return !!ts.findAncestor(node, function (n) { return n.kind === 161 /* TypeQuery */ ? true : n.kind === 70 /* Identifier */ || n.kind === 142 /* QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -32222,7 +34961,7 @@ var ts; if (node.kind === 98 /* ThisKeyword */) { return "0"; } - if (node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 178 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -32233,7 +34972,7 @@ var ts; case 70 /* Identifier */: case 98 /* ThisKeyword */: return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -32242,19 +34981,21 @@ var ts; switch (source.kind) { case 70 /* Identifier */: return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && + (target.kind === 225 /* VariableDeclaration */ || target.kind === 175 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98 /* ThisKeyword */: return target.kind === 98 /* ThisKeyword */; - case 177 /* PropertyAccessExpression */: - return target.kind === 177 /* PropertyAccessExpression */ && + case 96 /* SuperKeyword */: + return target.kind === 96 /* SuperKeyword */; + case 178 /* PropertyAccessExpression */: + return target.kind === 178 /* PropertyAccessExpression */ && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177 /* PropertyAccessExpression */) { + while (source.kind === 178 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -32267,7 +35008,7 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 /* PropertyAccessExpression */ && + return target.kind === 178 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -32275,7 +35016,7 @@ var ts; if (expr.kind === 70 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -32284,9 +35025,9 @@ var ts; function isDiscriminantProperty(type, name) { if (type && type.flags & 65536 /* Union */) { var prop = getUnionOrIntersectionProperty(type, name); - if (prop && prop.flags & 268435456 /* SyntheticProperty */) { + if (prop && getCheckFlags(prop) & 2 /* SyntheticProperty */) { if (prop.isDiscriminantProperty === undefined) { - prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop)); + prop.isDiscriminantProperty = prop.checkFlags & 32 /* HasNonUniformType */ && isLiteralType(getTypeOfSymbol(prop)); } return prop.isDiscriminantProperty; } @@ -32305,7 +35046,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 178 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -32347,8 +35088,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0 /* None */; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; result |= getTypeFacts(t); } return result; @@ -32358,7 +35099,7 @@ var ts; // check. This gives us a quicker out in the common case where an object type is not a function. var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -32401,9 +35142,11 @@ var ts; if (flags & 512 /* ESSymbol */) { return strictNullChecks ? 1981320 /* SymbolStrictFacts */ : 4193160 /* SymbolFacts */; } - if (flags & 16384 /* TypeParameter */) { - var constraint = getConstraintOfTypeParameter(type); - return getTypeFacts(constraint || emptyObjectType); + if (flags & 16777216 /* NonPrimitive */) { + return strictNullChecks ? 6166480 /* ObjectStrictFacts */ : 8378320 /* ObjectFacts */; + } + if (flags & 540672 /* TypeVariable */) { + return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType); } if (flags & 196608 /* UnionOrIntersection */) { return getTypeFactsOfTypes(type.types); @@ -32429,17 +35172,23 @@ var ts; } function getTypeOfDestructuredArrayElement(type, index) { return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || - checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || + checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; } function getTypeOfDestructuredSpreadExpression(type) { - return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); + return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ? + var isDestructuringDefaultAssignment = node.parent.kind === 176 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 260 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } + function isDestructuringAssignmentTarget(parent) { + return parent.parent.kind === 193 /* BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 215 /* ForOfStatement */ && parent.parent.initializer === parent; + } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); } @@ -32455,21 +35204,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return stringType; - case 213 /* ForOfStatement */: - return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192 /* BinaryExpression */: + case 215 /* ForOfStatement */: + return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; + case 193 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return undefinedType; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -32477,7 +35226,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 /* ObjectBindingPattern */ ? + var type = pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -32495,35 +35244,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212 /* ForInStatement */) { + if (node.parent.parent.kind === 214 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 213 /* ForOfStatement */) { - return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + if (node.parent.parent.kind === 215 /* ForOfStatement */) { + return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 /* VariableDeclaration */ ? + return node.kind === 225 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? + return node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 /* VariableDeclaration */ && node.initializer && + return node.kind === 225 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ && + node.kind !== 175 /* BindingElement */ && node.parent.kind === 193 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (node.operatorToken.kind) { case 57 /* EqualsToken */: return getReferenceCandidate(node.left); @@ -32535,13 +35284,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 /* ParenthesizedExpression */ || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? + return parent.kind === 184 /* ParenthesizedExpression */ || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 256 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -32589,8 +35338,32 @@ var ts; } return f(type) ? type : neverType; } - function mapType(type, f) { - return type.flags & 65536 /* Union */ ? getUnionType(ts.map(type.types, f)) : f(type); + // Apply a mapping function to a type and return the resulting type. If the source type + // is a union type, the mapping function is applied to each constituent type and a union + // of the resulting types is returned. + function mapType(type, mapper) { + if (!(type.flags & 65536 /* Union */)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; + var t = mapper(current); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; } function extractTypesOfKind(type, kind) { return filterType(type, function (t) { return (t.flags & kind) !== 0; }); @@ -32634,7 +35407,7 @@ var ts; // we defer subtype reduction until the evolving array type is finalized into a manifest // array type. function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); + var elementType = getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -32656,8 +35429,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (!(t.flags & 8192 /* Never */)) { if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; @@ -32680,11 +35453,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 /* PropertyAccessExpression */ && (parent.name.text === "length" || - parent.parent.kind === 179 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 178 /* PropertyAccessExpression */ && (parent.name.text === "length" || + parent.parent.kind === 180 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 192 /* BinaryExpression */ && + parent.parent.kind === 193 /* BinaryExpression */ && parent.parent.operatorToken.kind === 57 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -32711,14 +35484,12 @@ var ts; } return false; } - function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { + function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) { + if (initialType === void 0) { initialType = declaredType; } var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215 /* Narrowable */)) { + if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & 17810431 /* Narrowable */)) { return declaredType; } - var initialType = assumeInitialized ? declaredType : - declaredType === autoType || declaredType === autoArrayType ? undefinedType : - includeFalsyTypes(declaredType, 2048 /* Undefined */); var visitedFlowStart = visitedFlowCount; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; @@ -32727,7 +35498,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { + if (reference.parent.kind === 202 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { return declaredType; } return resultType; @@ -32744,7 +35515,19 @@ var ts; } } var type = void 0; - if (flow.flags & 16 /* Assignment */) { + if (flow.flags & 4096 /* AfterFinally */) { + // block flow edge: finally -> pre-try (for larger explanation check comment in binder.ts - bindTryStatement + flow.locked = true; + type = getTypeAtFlowNode(flow.antecedent); + flow.locked = false; + } + else if (flow.flags & 2048 /* PreFinally */) { + // locked pre-finally flows are filtered out in getTypeAtFlowBranchLabel + // so here just redirect to antecedent + flow = flow.antecedent; + continue; + } + else if (flow.flags & 16 /* Assignment */) { type = getTypeAtFlowAssignment(flow); if (!type) { flow = flow.antecedent; @@ -32776,7 +35559,7 @@ var ts; else if (flow.flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177 /* PropertyAccessExpression */) { + if (container && container !== flowContainer && reference.kind !== 178 /* PropertyAccessExpression */ && reference.kind !== 98 /* ThisKeyword */) { flow = container.flowNode; continue; } @@ -32830,7 +35613,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 /* CallExpression */ ? + var expr = node.kind === 180 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -32838,7 +35621,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -32897,6 +35680,12 @@ var ts; var seenIncomplete = false; for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { var antecedent = _a[_i]; + if (antecedent.flags & 2048 /* PreFinally */ && antecedent.lock.locked) { + // if flow correspond to branch from pre-try to finally and this branch is locked - this means that + // we initially have started following the flow outside the finally block. + // in this case we should ignore this branch. + continue; + } var flowType = getTypeAtFlowNode(antecedent); var type = getTypeFromFlowType(flowType); // If the type at a particular antecedent path is the declared type and the @@ -32929,8 +35718,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } // If this flow loop junction and reference are already being processed, return // the union of the types computed for each branch so far, marked as incomplete. @@ -32965,8 +35755,9 @@ var ts; // If we see a value appear in the cache it is a sign that control flow analysis // was restarted and completed by checkExpressionCached. We can simply pick up // the resulting type and bail out. - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -32990,10 +35781,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, /*incomplete*/ true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 /* PropertyAccessExpression */ && + return expr.kind === 178 /* PropertyAccessExpression */ && declaredType.flags & 65536 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -33027,10 +35819,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { + if (left_1.kind === 188 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { + if (right_1.kind === 188 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -33076,7 +35868,7 @@ var ts; assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */; return getTypeWithFacts(type, facts); } - if (type.flags & 33281 /* NotUnionOrUnit */) { + if (type.flags & 16810497 /* NotUnionOrUnit */) { return type; } if (assumeTrue) { @@ -33107,14 +35899,22 @@ var ts; // We narrow a non-union type to an exact primitive type if the non-union type // is a supertype of that primitive type. For example, type 'any' can be narrowed // to one of the primitive types. - var targetType = typeofTypesByName[literal.text]; - if (targetType && isTypeSubtypeOf(targetType, type)) { - return targetType; + var targetType = typeofTypesByName.get(literal.text); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(type) || anyType; + if (isTypeSubtypeOf(targetType, constraint)) { + return getIntersectionType([type, targetType]); + } + } } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 /* TypeofEQHostObject */ : - typeofNEFacts[literal.text] || 8192 /* TypeofNEHostObject */; + typeofEQFacts.get(literal.text) || 64 /* TypeofEQHostObject */ : + typeofNEFacts.get(literal.text) || 8192 /* TypeofNEHostObject */; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -33197,10 +35997,9 @@ var ts; // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the // two types. - var targetType = type.flags & 16384 /* TypeParameter */ ? getApparentType(type) : type; return isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : - isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); } function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { @@ -33229,7 +36028,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 /* ElementAccessExpression */ || invokedExpression.kind === 177 /* PropertyAccessExpression */) { + if (invokedExpression.kind === 179 /* ElementAccessExpression */ || invokedExpression.kind === 178 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -33248,15 +36047,16 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 96 /* SuperKeyword */: + case 178 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: if (expr.operator === 50 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -33289,15 +36089,12 @@ var ts; return getTypeOfSymbol(symbol); } function getControlFlowContainer(node) { - while (true) { - node = node.parent; - if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 /* ModuleBlock */ || - node.kind === 261 /* SourceFile */ || - node.kind === 147 /* PropertyDeclaration */) { - return node; - } - } + return ts.findAncestor(node.parent, function (node) { + return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || + node.kind === 233 /* ModuleBlock */ || + node.kind === 264 /* SourceFile */ || + node.kind === 148 /* PropertyDeclaration */; + }); } // Check if a parameter is assigned anywhere within its declaring function. function isParameterAssigned(symbol) { @@ -33312,21 +36109,13 @@ var ts; return symbol.isAssigned || false; } function hasParentWithAssignmentsMarked(node) { - while (true) { - node = node.parent; - if (!node) { - return false; - } - if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304 /* AssignmentsMarked */) { - return true; - } - } + return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 4194304 /* AssignmentsMarked */); }); } function markParameterAssignments(node) { if (node.kind === 70 /* Identifier */) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144 /* Parameter */) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145 /* Parameter */) { symbol.isAssigned = true; } } @@ -33338,6 +36127,15 @@ var ts; function isConstVariable(symbol) { return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType; } + /** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */ + function removeOptionalityFromDeclaredType(declaredType, declaration) { + var annotationIncludesUndefined = strictNullChecks && + declaration.kind === 145 /* Parameter */ && + declaration.initializer && + getFalsyFlags(declaredType) & 2048 /* Undefined */ && + !(getFalsyFlags(checkExpression(declaration.initializer)) & 2048 /* Undefined */); + return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 131072 /* NEUndefined */) : declaredType; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === unknownSymbol) { @@ -33352,16 +36150,14 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256 /* Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288 /* AwaitContext */) { - getNodeLinks(container).flags |= 8192 /* CaptureArguments */; - } + getNodeLinks(container).flags |= 8192 /* CaptureArguments */; return getTypeOfSymbol(symbol); } if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -33373,7 +36169,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration_1.kind === 226 /* ClassDeclaration */ + if (declaration_1.kind === 228 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33385,14 +36181,14 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197 /* ClassExpression */) { + else if (declaration_1.kind === 198 /* ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { + if (container.kind === 148 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */; getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */; } @@ -33404,6 +36200,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -33426,15 +36223,15 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 144 /* Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 145 /* Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 /* FunctionExpression */ || - flowContainer.kind === 185 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 /* FunctionExpression */ || + flowContainer.kind === 186 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -33442,15 +36239,18 @@ var ts; // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); - var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); + var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, ts.getRootDeclaration(declaration)) : type) : + type === autoType || type === autoArrayType ? undefinedType : + includeFalsyTypes(type, 2048 /* Undefined */); + var flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized); // A variable is considered uninitialized when it is possible to analyze the entire control flow graph // from declaration to use, and when the variable's declared type doesn't include undefined but the // control flow based type does include undefined. if (type === autoType || type === autoArrayType) { if (flowType === autoType || flowType === autoArrayType) { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } @@ -33465,19 +36265,12 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isInsideFunction(node, threshold) { - var current = node; - while (current && current !== threshold) { - if (ts.isFunctionLike(current)) { - return true; - } - current = current.parent; - } - return false; + return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n); }); } function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 256 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 259 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -33502,8 +36295,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 211 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 224 /* VariableDeclarationList */).parent === container && + if (container.kind === 213 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 226 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -33515,9 +36308,9 @@ var ts; } } function isAssignedInBodyOfForStatement(node, container) { - var current = node; // skip parenthesized nodes - while (current.parent.kind === 183 /* ParenthesizedExpression */) { + var current = node; + while (current.parent.kind === 184 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -33525,7 +36318,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 /* PrefixUnaryExpression */ || current.parent.kind === 191 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 191 /* PrefixUnaryExpression */ || current.parent.kind === 192 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 42 /* PlusPlusToken */ || expr.operator === 43 /* MinusMinusToken */; } @@ -33534,19 +36327,11 @@ var ts; } // at this point we know that node is the target of assignment // now check that modification happens inside the statement part of the ForStatement - while (current !== container) { - if (current === container.statement) { - return true; - } - else { - current = current.parent; - } - } - return false; + return !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement; }); } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 147 /* PropertyDeclaration */ || container.kind === 150 /* Constructor */) { + if (container.kind === 148 /* PropertyDeclaration */ || container.kind === 151 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -33589,58 +36374,63 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; - if (container.kind === 150 /* Constructor */) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - // If a containing class does not have extends clause or the class extends null - // skip checking whether super statement is called before "this" accessing. - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + if (container.kind === 151 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 150 /* Constructor */: + case 151 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (ts.getModifierFlags(container) & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); + // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -33652,8 +36442,8 @@ var ts; // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 184 /* FunctionExpression */ && - ts.isInJavaScriptFile(container.parent) && + if (container.kind === 185 /* FunctionExpression */ && + container.parent.kind === 193 /* BinaryExpression */ && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') var className = container.parent // x.prototype.y = f @@ -33673,7 +36463,7 @@ var ts; if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); var type = ts.hasModifier(container, 32 /* Static */) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; - return getFlowTypeOfReference(node, type, /*assumeInitialized*/ true, /*flowContainer*/ undefined); + return getFlowTypeOfReference(node, type); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); @@ -33681,7 +36471,7 @@ var ts; return type; } } - if (compilerOptions.noImplicitThis) { + if (noImplicitThis) { // With noImplicitThis, functions may not reference 'this' if it has type 'any' error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } @@ -33689,28 +36479,23 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 278 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 281 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { - for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144 /* Parameter */) { - return true; - } - } - return false; + return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 145 /* Parameter */; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 185 /* ArrowFunction */) { + while (container && container.kind === 186 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -33723,17 +36508,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = node; - while (current && current !== container && current.kind !== 142 /* ComputedPropertyName */) { - current = current.parent; - } - if (current && current.kind === 142 /* ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 143 /* ComputedPropertyName */; }); + if (current && current.kind === 143 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -33741,6 +36523,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 151 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; } @@ -33804,7 +36589,7 @@ var ts; // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment // while a property access can. - if (container.kind === 149 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { + if (container.kind === 150 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } @@ -33818,7 +36603,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (container.parent.kind === 177 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -33838,7 +36623,7 @@ var ts; } return unknownType; } - if (container.kind === 150 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; @@ -33853,7 +36638,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 150 /* Constructor */; + return container.kind === 151 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -33861,29 +36646,47 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */) { if (ts.getModifierFlags(container) & 32 /* Static */) { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */; } else { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */ || - container.kind === 147 /* PropertyDeclaration */ || - container.kind === 146 /* PropertySignature */ || - container.kind === 150 /* Constructor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */ || + container.kind === 148 /* PropertyDeclaration */ || + container.kind === 147 /* PropertySignature */ || + container.kind === 151 /* Constructor */; } } } return false; } } + function getContainingObjectLiteral(func) { + return (func.kind === 150 /* MethodDeclaration */ || + func.kind === 152 /* GetAccessor */ || + func.kind === 153 /* SetAccessor */) && func.parent.kind === 177 /* ObjectLiteralExpression */ ? func.parent : + func.kind === 185 /* FunctionExpression */ && func.parent.kind === 260 /* PropertyAssignment */ ? func.parent.parent : + undefined; + } + function getThisTypeArgument(type) { + return getObjectFlags(type) & 4 /* Reference */ && type.target === globalThisType ? type.typeArguments[0] : undefined; + } + function getThisTypeFromContextualType(type) { + return mapType(type, function (t) { + return t.flags & 131072 /* Intersection */ ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + }); + } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185 /* ArrowFunction */) { + if (func.kind === 186 /* ArrowFunction */) { + return undefined; + } + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -33892,6 +36695,40 @@ var ts; } } } + if (noImplicitThis) { + var containingLiteral = getContainingObjectLiteral(func); + if (containingLiteral) { + // We have an object literal method. Check if the containing object literal has a contextual type + // that includes a ThisType. If so, T is the contextual type for 'this'. We continue looking in + // any directly enclosing object literals. + var contextualType = getApparentTypeOfContextualType(containingLiteral); + var literal = containingLiteral; + var type = contextualType; + while (type) { + var thisType = getThisTypeFromContextualType(type); + if (thisType) { + return instantiateType(thisType, getContextualMapper(containingLiteral)); + } + if (literal.parent.kind !== 260 /* PropertyAssignment */) { + break; + } + literal = literal.parent.parent; + type = getApparentTypeOfContextualType(literal); + } + // There was no contextual ThisType for the containing object literal, so the contextual type + // for 'this' is the non-null form of the contextual type for the containing object literal or + // the type of the object literal itself. + return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral); + } + // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the + // contextual type for 'this' is 'obj'. + if (func.parent.kind === 193 /* BinaryExpression */ && func.parent.operatorToken.kind === 57 /* EqualsToken */) { + var target = func.parent.left; + if (target.kind === 178 /* PropertyAccessExpression */ || target.kind === 179 /* ElementAccessExpression */) { + return checkExpressionCached(target.expression); + } + } + } return undefined; } // Return contextual type of parameter or undefined if no contextual type is available @@ -33899,23 +36736,23 @@ var ts; var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -33949,7 +36786,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -33960,11 +36797,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_19 = declaration.propertyName || declaration.name; - if (ts.isVariableLike(parentDeclaration) && + var name = declaration.propertyName || declaration.name; + if (parentDeclaration.kind !== 175 /* BindingElement */ && parentDeclaration.type && - !ts.isBindingPattern(name_19)) { - var text = ts.getTextOfPropertyName(name_19); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -33975,33 +36812,34 @@ var ts; } function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); - if (ts.isAsyncFunctionLike(func)) { - var contextualReturnType = getContextualReturnType(func); - if (contextualReturnType) { - return getPromisedType(contextualReturnType); + if (func) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1 /* Generator */) { + return undefined; } - return undefined; - } - if (func && !func.asteriskToken) { - return getContextualReturnType(func); + var contextualReturnType = getContextualReturnType(func); + return functionFlags & 2 /* Async */ + ? contextualReturnType && getAwaitedTypeOfPromise(contextualReturnType) // Async function + : contextualReturnType; // Regular function } return undefined; } function getContextualTypeForYieldOperand(node) { var func = ts.getContainingFunction(node); if (func) { + var functionFlags = ts.getFunctionFlags(func); var contextualReturnType = getContextualReturnType(func); if (contextualReturnType) { return node.asteriskToken ? contextualReturnType - : getElementTypeOfIterableIterator(contextualReturnType); + : getIteratedTypeOfGenerator(contextualReturnType, (functionFlags & 2 /* Async */) !== 0); } } return undefined; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 145 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -34012,8 +36850,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 150 /* Constructor */ || - functionDecl.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152 /* SetAccessor */))) { + functionDecl.kind === 151 /* Constructor */ || + functionDecl.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -34035,7 +36873,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181 /* TaggedTemplateExpression */) { + if (template.parent.kind === 182 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -34069,41 +36907,14 @@ var ts; } return undefined; } - // Apply a mapping function to a contextual type and return the resulting type. If the contextual type - // is a union type, the mapping function is applied to each constituent type and a union of the resulting - // types is returned. - function applyToContextualType(type, mapper) { - if (!(type.flags & 65536 /* Union */)) { - return mapper(type); - } - var types = type.types; - var mappedType; - var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; - var t = mapper(current); - if (t) { - if (!mappedType) { - mappedType = t; - } - else if (!mappedTypes) { - mappedTypes = [mappedType, t]; - } - else { - mappedTypes.push(t); - } - } - } - return mappedTypes ? getUnionType(mappedTypes) : mappedType; - } function getTypeOfPropertyOfContextualType(type, name) { - return applyToContextualType(type, function (t) { + return mapType(type, function (t) { var prop = t.flags & 229376 /* StructuredType */ ? getPropertyOfType(t, name) : undefined; return prop ? getTypeOfSymbol(prop) : undefined; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); + return mapType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } // Return true if the given contextual type is a tuple-like type function contextualTypeIsTupleLikeType(type) { @@ -34150,7 +36961,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */) - || (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined); + || getIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false); } return undefined; } @@ -34160,19 +36971,19 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxAttribute(attribute) { - var kind = attribute.kind; - var jsxElement = attribute.parent; - var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250 /* JsxAttribute */) { - if (!attrsType || isTypeAny(attrsType)) { + // When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type + // which is a type of the parameter of the signature we are trying out. + // If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName + var attributesType = getContextualType(attribute.parent); + if (ts.isJsxAttribute(attribute)) { + if (!attributesType || isTypeAny(attributesType)) { return undefined; } - return getTypeOfPropertyOfType(attrsType, attribute.name.text); + return getTypeOfPropertyOfType(attributesType, attribute.name.text); } - else if (attribute.kind === 251 /* JsxSpreadAttribute */) { - return attrsType; + else { + return attributesType; } - ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -34207,45 +37018,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 175 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 185 /* ArrowFunction */: - case 216 /* ReturnStatement */: + case 186 /* ArrowFunction */: + case 218 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 202 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */); + case 204 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 195 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getContextualType(parent); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return getContextualType(parent); - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxAttribute */: + case 254 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + return getAttributesTypeFromJsxOpeningLikeElement(parent); } return undefined; } + function getContextualMapper(node) { + node = ts.findAncestor(node, function (n) { return !!n.contextualMapper; }); + return node ? node.contextualMapper : identityMapper; + } // If the given type is an object or union type, if that type has a single signature, and if // that signature is non-generic, return the signature. Otherwise return undefined. function getNonGenericSignature(type, node) { @@ -34273,7 +37091,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -34292,7 +37110,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -34302,8 +37120,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var current = types_17[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -34330,46 +37148,25 @@ var ts; } return result; } - /** - * Detect if the mapper implies an inference context. Specifically, there are 4 possible values - * for a mapper. Let's go through each one of them: - * - * 1. undefined - this means we are not doing inferential typing, but we may do contextual typing, - * which could cause us to assign a parameter a type - * 2. identityMapper - means we want to avoid assigning a parameter a type, whether or not we are in - * inferential typing (context is undefined for the identityMapper) - * 3. a mapper created by createInferenceMapper - we are doing inferential typing, we want to assign - * types to parameters and fix type parameters (context is defined) - * 4. an instantiation mapper created by createTypeMapper or createTypeEraser - this should never be - * passed as the contextual mapper when checking an expression (context is undefined for these) - * - * isInferentialContext is detecting if we are in case 3 - */ - function isInferentialContext(mapper) { - return mapper && mapper.context; - } - function checkSpreadExpression(node, contextualMapper) { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); + function checkSpreadExpression(node, checkMode) { + if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 1536 /* SpreadIncludes */); + } + var arrayOrIterableType = checkExpression(node.expression, checkMode); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterable*/ false); } function hasDefaultValue(node) { - return (node.kind === 174 /* BindingElement */ && !!node.initializer) || - (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); + return (node.kind === 175 /* BindingElement */ && !!node.initializer) || + (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); } - function checkArrayLiteral(node, contextualMapper) { + function checkArrayLiteral(node, checkMode) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 197 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -34382,18 +37179,18 @@ var ts; // get the contextual element type from it. So we do something similar to // getContextualTypeForElementExpression, which will crucially not error // if there is no index type / iterated type. - var restArrayType = checkExpression(e.expression, contextualMapper); + var restArrayType = checkExpression(e.expression, checkMode); var restElementType = getIndexTypeOfType(restArrayType, 1 /* Number */) || - (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined); + getIteratedTypeOrElementType(restArrayType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false); if (restElementType) { elementTypes.push(restElementType); } } else { - var type = checkExpressionForMutableLocation(e, contextualMapper); + var type = checkExpressionForMutableLocation(e, checkMode); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196 /* SpreadElement */; + hasSpreadElement = hasSpreadElement || e.kind === 197 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -34408,7 +37205,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 173 /* ArrayBindingPattern */ || pattern.kind === 175 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 174 /* ArrayBindingPattern */ || pattern.kind === 176 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -34416,7 +37213,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198 /* OmittedExpression */) { + if (patternElement.kind !== 199 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -34433,7 +37230,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -34495,7 +37292,7 @@ var ts; var unionType = propTypes.length ? getUnionType(propTypes, /*subtypeReduction*/ true) : undefinedType; return createIndexInfo(unionType, /*isReadonly*/ false); } - function checkObjectLiteral(node, contextualMapper) { + function checkObjectLiteral(node, checkMode) { var inDestructuringPattern = ts.isAssignmentTarget(node); // Grammar checking checkGrammarObjectLiteralExpression(node, inDestructuringPattern); @@ -34505,7 +37302,8 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 /* ObjectBindingPattern */ || contextualType.pattern.kind === 176 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 173 /* ObjectBindingPattern */ || contextualType.pattern.kind === 177 /* ObjectLiteralExpression */); + var isJSObjectLiteral = !contextualType && ts.isInJavaScriptFile(node); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -34514,29 +37312,29 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 /* PropertyAssignment */ || - memberDecl.kind === 258 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 260 /* PropertyAssignment */ || + memberDecl.kind === 261 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257 /* PropertyAssignment */) { - type = checkPropertyAssignment(memberDecl, contextualMapper); + if (memberDecl.kind === 260 /* PropertyAssignment */) { + type = checkPropertyAssignment(memberDecl, checkMode); } - else if (memberDecl.kind === 149 /* MethodDeclaration */) { - type = checkObjectLiteralMethod(memberDecl, contextualMapper); + else if (memberDecl.kind === 150 /* MethodDeclaration */) { + type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 258 /* ShorthandPropertyAssignment */); - type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 261 /* ShorthandPropertyAssignment */); + type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } typeFlags |= type.flags; - var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); + var prop = createSymbol(4 /* Property */ | member.flags, member.name); if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 257 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 260 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 261 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { - prop.flags |= 536870912 /* Optional */; + prop.flags |= 67108864 /* Optional */; } if (ts.hasDynamicName(memberDecl)) { patternWithComputedProperties = true; @@ -34547,9 +37345,9 @@ var ts; // binding pattern specifies a default value for the property, make the property optional. var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { - prop.flags |= impliedProp.flags & 536870912 /* Optional */; + prop.flags |= impliedProp.flags & 67108864 /* Optional */; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0 /* String */)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -34562,9 +37360,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259 /* SpreadAssignment */) { + else if (memberDecl.kind === 262 /* SpreadAssignment */) { + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(memberDecl, 2 /* Assign */); + } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -34572,11 +37373,11 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 /* Object */ | 1 /* Any */))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } @@ -34586,8 +37387,8 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 151 /* GetAccessor */ || memberDecl.kind === 152 /* SetAccessor */); - checkAccessorDeclaration(memberDecl); + ts.Debug.assert(memberDecl.kind === 152 /* GetAccessor */ || memberDecl.kind === 153 /* SetAccessor */); + checkNodeDeferred(memberDecl); } if (ts.hasDynamicName(memberDecl)) { if (isNumericName(memberDecl.name)) { @@ -34598,7 +37399,7 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } @@ -34607,27 +37408,30 @@ var ts; if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { - if (!(prop.flags & 536870912 /* Optional */)) { + if (!propertiesTable.get(prop.name)) { + if (!(prop.flags & 67108864 /* Optional */)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); + } + if (spread.flags & 32768 /* Object */) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined; + var stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined; + var numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */; result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); @@ -34644,9 +37448,14 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */ | 16777216 /* NonPrimitive */) || + type.flags & 32768 /* Object */ && !isGenericMappedType(type) || + type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { // Check attributes @@ -34662,18 +37471,18 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: checkJsxExpression(child); break; - case 246 /* JsxElement */: + case 248 /* JsxElement */: checkJsxElement(child); break; - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } } - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } /** * Returns true iff the JSX element name would be a valid JS identifier, ignoring restrictions about keywords not being identifiers @@ -34687,81 +37496,114 @@ var ts; */ function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment - if (tagName.kind === 177 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { + if (tagName.kind === 178 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { return false; } else { return ts.isIntrinsicJsxName(tagName.text); } } - function checkJsxAttribute(node, elementAttributesType, nameTable) { - var correspondingPropType = undefined; - // Look up the corresponding property for this attribute - if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { - // If there is no 'props' property, you may not have non-"data-" attributes - error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); - } - else if (elementAttributesType && !isTypeAny(elementAttributesType)) { - var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); - correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - if (isUnhyphenatedJsxName(node.name.text)) { - var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0 /* String */); - if (attributeType) { - correspondingPropType = attributeType; + /** + * Get attributes type of the JSX opening-like element. The result is from resolving "attributes" property of the opening-like element. + * + * @param openingLikeElement a JSX opening-like element + * @param filter a function to remove attributes that will not participate in checking whether attributes are assignable + * @return an anonymous type (similar to the one returned by checkObjectLiteral) in which its properties are attributes property. + * @remarks Because this function calls getSpreadType, it needs to use the same checks as checkObjectLiteral, + * which also calls getSpreadType. + */ + function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, filter, checkMode) { + var attributes = openingLikeElement.attributes; + var attributesTable = ts.createMap(); + var spread = emptyObjectType; + var attributesArray = []; + for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { + var attributeDecl = _a[_i]; + var member = attributeDecl.symbol; + if (ts.isJsxAttribute(attributeDecl)) { + var exprType = attributeDecl.initializer ? + checkExpression(attributeDecl.initializer, checkMode) : + trueType; // is sugar for + var attributeSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */ | member.flags, member.name); + attributeSymbol.declarations = member.declarations; + attributeSymbol.parent = member.parent; + if (member.valueDeclaration) { + attributeSymbol.valueDeclaration = member.valueDeclaration; } - else { - // If there's no corresponding property with this name, error - if (!correspondingPropType) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; - } + attributeSymbol.type = exprType; + attributeSymbol.target = member; + attributesTable.set(attributeSymbol.name, attributeSymbol); + attributesArray.push(attributeSymbol); + } + else { + ts.Debug.assert(attributeDecl.kind === 254 /* JsxSpreadAttribute */); + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + var exprType = checkExpression(attributeDecl.expression); + if (!isValidSpreadType(exprType)) { + error(attributeDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); + return anyType; + } + if (isTypeAny(exprType)) { + return anyType; } + spread = getSpreadType(spread, exprType); } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); + if (spread !== emptyObjectType) { + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + attributesArray = getPropertiesOfType(spread); } - else { - // is sugar for - exprType = booleanType; + attributesTable = ts.createMap(); + if (attributesArray) { + ts.forEach(attributesArray, function (attr) { + if (!filter || filter(attr)) { + attributesTable.set(attr.name, attr); + } + }); } - if (correspondingPropType) { - checkTypeAssignableTo(exprType, correspondingPropType, node); + return createJsxAttributesType(attributes.symbol, attributesTable); + /** + * Create anonymous type from given attributes symbol table. + * @param symbol a symbol of JsxAttributes containing attributes corresponding to attributesTable + * @param attributesTable a symbol table of attributes property + */ + function createJsxAttributesType(symbol, attributesTable) { + var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */; + result.flags |= 33554432 /* JsxAttributes */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag; + result.objectFlags |= 128 /* ObjectLiteral */; + return result; } - nameTable[node.name.text] = true; - return exprType; } - function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { - var type = checkExpression(node.expression); - var props = getPropertiesOfType(type); - for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { - var prop = props_2[_i]; - // Is there a corresponding property in the element attributes type? Skip checking of properties - // that have already been assigned to, as these are not actually pushed into the resulting type - if (!nameTable[prop.name]) { - var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); - if (targetPropSym) { - var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); - checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); - } - nameTable[prop.name] = true; - } - } - return type; + /** + * Check attributes property of opening-like element. This function is called during chooseOverload to get call signature of a JSX opening-like element. + * (See "checkApplicableSignatureForJsxOpeningLikeElement" for how the function is used) + * @param node a JSXAttributes to be resolved of its type + */ + function checkJsxAttributes(node, checkMode) { + return createJsxAttributesTypeFromAttributesProperty(node.parent, /*filter*/ undefined, checkMode); } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } /** - * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic - * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic - * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement). - * May also return unknownSymbol if both of these lookups fail. - */ + * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic + * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic + * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement). + * May also return unknownSymbol if both of these lookups fail. + */ function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { @@ -34784,7 +37626,7 @@ var ts; return links.resolvedSymbol = unknownSymbol; } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } return links.resolvedSymbol = unknownSymbol; @@ -34849,28 +37691,133 @@ var ts; } } /** - * Given React element instance type and the class type, resolve the Jsx type - * Pass elemType to handle individual type in the union typed element type. - */ - function getResolvedJsxType(node, elemType, elemClassType) { - if (!elemType) { - elemType = checkExpression(node.tagName); + * Get JSX attributes type by trying to resolve openingLikeElement as a stateless function component. + * Return only attributes type of successfully resolved call signature. + * This function assumes that the caller handled other possible element type of the JSX element (e.g. stateful component) + * Unlike tryGetAllJsxStatelessFunctionAttributesType, this function is a default behavior of type-checkers. + * @param openingLikeElement a JSX opening-like element to find attributes type + * @param elementType a type of the opening-like element. This elementType can't be an union type + * @param elemInstanceType an element instance type (the result of newing or invoking this tag) + * @param elementClassType a JSX-ElementClass type. This is a result of looking up ElementClass interface in the JSX global + */ + function defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536 /* Union */)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + // We don't call getResolvedSignature here because we have already resolve the type of JSX Element. + var callSignature = getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, /*candidatesOutArray*/ undefined); + if (callSignature !== unknownSignature) { + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + } + return undefined; + } + /** + * Get JSX attributes type by trying to resolve openingLikeElement as a stateless function component. + * Return all attributes type of resolved call signature including candidate signatures. + * This function assumes that the caller handled other possible element type of the JSX element. + * This function is a behavior used by language service when looking up completion in JSX element. + * @param openingLikeElement a JSX opening-like element to find attributes type + * @param elementType a type of the opening-like element. This elementType can't be an union type + * @param elemInstanceType an element instance type (the result of newing or invoking this tag) + * @param elementClassType a JSX-ElementClass type. This is a result of looking up ElementClass interface in the JSX global + */ + function tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536 /* Union */)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + // Is this is a stateless function component? See if its single signature's return type is assignable to the JSX Element Type + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + // We don't call getResolvedSignature because here we have already resolve the type of JSX Element. + var candidatesOutArray = []; + getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray); + var result = void 0; + var allMatchingAttributesType = void 0; + for (var _i = 0, candidatesOutArray_1 = candidatesOutArray; _i < candidatesOutArray_1.length; _i++) { + var candidate = candidatesOutArray_1[_i]; + var callReturnType = getReturnTypeOfSignature(candidate); + var paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var shouldBeCandidate = true; + for (var _a = 0, _b = openingLikeElement.attributes.properties; _a < _b.length; _a++) { + var attribute = _b[_a]; + if (ts.isJsxAttribute(attribute) && + isUnhyphenatedJsxName(attribute.name.text) && + !getPropertyOfType(paramType, attribute.name.text)) { + shouldBeCandidate = false; + break; + } + } + if (shouldBeCandidate) { + result = intersectTypes(result, paramType); + } + allMatchingAttributesType = intersectTypes(allMatchingAttributesType, paramType); + } + } + // If we can't find any matching, just return everything. + if (!result) { + result = allMatchingAttributesType; + } + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + result = intersectTypes(intrinsicAttributes, result); + } + return result; + } } - if (elemType.flags & 65536 /* Union */) { - var types = elemType.types; - return getUnionType(ts.map(types, function (type) { - return getResolvedJsxType(node, type, elemClassType); + return undefined; + } + /** + * Resolve attributes type of the given opening-like element. The attributes type is a type of attributes associated with the given elementType. + * For instance: + * declare function Foo(attr: { p1: string}): JSX.Element; + * ; // This function will try resolve "Foo" and return an attributes type of "Foo" which is "{ p1: string }" + * + * The function is intended to initially be called from getAttributesTypeFromJsxOpeningLikeElement which already handle JSX-intrinsic-element.. + * This function will try to resolve custom JSX attributes type in following order: string literal, stateless function, and stateful component + * + * @param openingLikeElement a non-intrinsic JSXOPeningLikeElement + * @param shouldIncludeAllStatelessAttributesType a boolean indicating whether to include all attributes types from all stateless function signature + * @param elementType an instance type of the given opening-like element. If undefined, the function will check type openinglikeElement's tagname. + * @param elementClassType a JSX-ElementClass type. This is a result of looking up ElementClass interface in the JSX global (imported from react.d.ts) + * @return attributes type if able to resolve the type of node + * anyType if there is no type ElementAttributesProperty or there is an error + * emptyObjectType if there is no "prop" in the element instance type + */ + function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) { + if (!elementType) { + elementType = checkExpression(openingLikeElement.tagName); + } + if (elementType.flags & 65536 /* Union */) { + var types = elementType.types; + return getUnionType(types.map(function (type) { + return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), /*subtypeReduction*/ true); } // If the elemType is a string type, we have to return anyType to prevent an error downstream as we will try to find construct or call signature of the type - if (elemType.flags & 2 /* String */) { + if (elementType.flags & 2 /* String */) { return anyType; } - else if (elemType.flags & 32 /* StringLiteral */) { + else if (elementType.flags & 32 /* StringLiteral */) { // If the elemType is a stringLiteral type, we can then provide a check to make sure that the string literal type is one of the Jsx intrinsic element type + // For example: + // var CustomTag: "h1" = "h1"; + // Hello World var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { - var stringLiteralTypeName = elemType.text; + var stringLiteralTypeName = elementType.text; var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName); if (intrinsicProp) { return getTypeOfSymbol(intrinsicProp); @@ -34879,34 +37826,24 @@ var ts; if (indexSignatureType) { return indexSignatureType; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); + error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); } // If we need to report an error, we already done so here. So just return any to prevent any more error downstream return anyType; } // Get the element instance type (the result of newing or invoking this tag) - var elemInstanceType = getJsxElementInstanceType(node, elemType); - if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { - // Is this is a stateless function component? See if its single signature's return type is - // assignable to the JSX Element Type - if (jsxElementType) { - var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - // Intersect in JSX.IntrinsicAttributes if it exists - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); - } - return paramType; - } - } + var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + // If we should include all stateless attributes type, then get all attributes type from all stateless function signature. + // Otherwise get only attributes type from the signature picked by choose-overload logic. + var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? + tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : + defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); + if (statelessAttributesType) { + return statelessAttributesType; } // Issue an error if this return type isn't assignable to JSX.ElementClass - if (elemClassType) { - checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + if (elementClassType) { + checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } if (isTypeAny(elemInstanceType)) { return elemInstanceType; @@ -34930,11 +37867,6 @@ var ts; // Props is of type 'any' or unknown return attributesType; } - else if (attributesType.flags & 65536 /* Union */) { - // Props cannot be a union type - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); - return anyType; - } else { // Normal case -- add in IntrinsicClassElements and IntrinsicElements var apparentAttributesType = attributesType; @@ -34959,30 +37891,68 @@ var ts; } } /** - * Given an opening/self-closing element, get the 'element attributes type', i.e. the type that tells - * us which attributes are valid on a given element. + * Get attributes type of the given intrinsic opening-like Jsx element by resolving the tag name. + * The function is intended to be called from a function which has checked that the opening element is an intrinsic element. + * @param node an intrinsic JSX opening-like element */ - function getJsxElementAttributesType(node) { + function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { + ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); var links = getNodeLinks(node); - if (!links.resolvedJsxType) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - var symbol = getIntrinsicTagSymbol(node); - if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { - return links.resolvedJsxType = getTypeOfSymbol(symbol); - } - else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { - return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0 /* String */).type; - } - else { - return links.resolvedJsxType = unknownType; - } + if (!links.resolvedJsxElementAttributesType) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { + return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol); + } + else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { + return links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, 0 /* String */).type; } else { - var elemClassType = getJsxGlobalElementClassType(); - return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); + return links.resolvedJsxElementAttributesType = unknownType; } } - return links.resolvedJsxType; + return links.resolvedJsxElementAttributesType; + } + /** + * Get attributes type of the given custom opening-like JSX element. + * This function is intended to be called from a caller that handles intrinsic JSX element already. + * @param node a custom JSX opening-like element + * @param shouldIncludeAllStatelessAttributesType a boolean value used by language service to get all possible attributes type from an overload stateless function component + */ + function getCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType) { + var links = getNodeLinks(node); + if (!links.resolvedJsxElementAttributesType) { + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxElementAttributesType = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, /*elementType*/ undefined, elemClassType); + } + return links.resolvedJsxElementAttributesType; + } + /** + * Get all possible attributes type, especially from an overload stateless function component, of the given JSX opening-like element. + * This function is called by language service (see: completions-tryGetGlobalSymbols). + * @param node a JSX opening-like element to get attributes type for + */ + function getAllAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + // Because in language service, the given JSX opening-like element may be incomplete and therefore, + // we can't resolve to exact signature if the element is a stateless function component so the best thing to do is return all attributes type from all overloads. + return getCustomJsxElementAttributesType(node, /*shouldIncludeAllStatelessAttributesType*/ true); + } + } + /** + * Get the attributes type, which indicates the attributes that are valid on the given JSXOpeningLikeElement. + * @param node a JSXOpeningLikeElement node + * @return an attributes type of the given node + */ + function getAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, /*shouldIncludeAllStatelessAttributesType*/ false); + } } /** * Given a JSX attribute, returns the symbol for the corresponds property @@ -34990,17 +37960,34 @@ var ts; * that have no matching element attributes type property. */ function getJsxAttributePropertySymbol(attrib) { - var attributesType = getJsxElementAttributesType(attrib.parent); + var attributesType = getAttributesTypeFromJsxOpeningLikeElement(attrib.parent.parent); var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } function getJsxGlobalElementClassType() { - if (!jsxElementClassType) { - jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + if (!deferredJsxElementClassType) { + deferredJsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + } + return deferredJsxElementClassType; + } + function getJsxGlobalElementType() { + if (!deferredJsxElementType) { + deferredJsxElementType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.Element); + } + return deferredJsxElementType; + } + function getJsxGlobalStatelessElementType() { + if (!deferredJsxStatelessElementType) { + var jsxElementType = getJsxGlobalElementType(); + if (jsxElementType) { + deferredJsxStatelessElementType = getUnionType([jsxElementType, nullType]); + } } - return jsxElementClassType; + return deferredJsxStatelessElementType; } - /// Returns all the properties of the Jsx.IntrinsicElements interface + /** + * Returns all the properties of the Jsx.IntrinsicElements interface + */ function getJsxIntrinsicTagNames() { var intrinsics = getJsxType(JsxNames.IntrinsicElements); return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; @@ -35010,8 +37997,8 @@ var ts; if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) { error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); } - if (jsxElementType === undefined) { - if (compilerOptions.noImplicitAny) { + if (getJsxGlobalElementType() === undefined) { + if (noImplicitAny) { error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); } } @@ -35033,39 +38020,46 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - var targetAttributesType = getJsxElementAttributesType(node); - var nameTable = ts.createMap(); - // Process this array in right-to-left order so we know which - // attributes (mostly from spreads) are being overwritten and - // thus should have their types ignored - var sawSpreadedAny = false; - for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250 /* JsxAttribute */) { - checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); - } - else { - ts.Debug.assert(node.attributes[i].kind === 251 /* JsxSpreadAttribute */); - var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); - if (isTypeAny(spreadType)) { - sawSpreadedAny = true; - } - } + checkJsxAttributesAssignableToTagNameAttributes(node); + } + /** + * Check whether the given attributes of JSX opening-like element is assignable to the tagName attributes. + * Get the attributes type of the opening-like element through resolving the tagName, "target attributes" + * Check assignablity between given attributes property, "source attributes", and the "target attributes" + * @param openingLikeElement an opening-like JSX element to check its JSXAttributes + */ + function checkJsxAttributesAssignableToTagNameAttributes(openingLikeElement) { + // The function involves following steps: + // 1. Figure out expected attributes type by resolving tagName of the JSX opening-like element, targetAttributesType. + // During these steps, we will try to resolve the tagName as intrinsic name, stateless function, stateful component (in the order) + // 2. Solved JSX attributes type given by users, sourceAttributesType, which is by resolving "attributes" property of the JSX opening-like element. + // 3. Check if the two are assignable to each other + // targetAttributesType is a type of an attributes from resolving tagName of an opening-like JSX element. + var targetAttributesType = isJsxIntrinsicIdentifier(openingLikeElement.tagName) ? + getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : + getCustomJsxElementAttributesType(openingLikeElement, /*shouldIncludeAllStatelessAttributesType*/ false); + // sourceAttributesType is a type of an attributes properties. + // i.e
+ // attr1 and attr2 are treated as JSXAttributes attached in the JsxOpeningLikeElement as "attributes". + var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, function (attribute) { + return isUnhyphenatedJsxName(attribute.name) || !!(getPropertyOfType(targetAttributesType, attribute.name)); + }); + // If the targetAttributesType is an emptyObjectType, indicating that there is no property named 'props' on this instance type. + // but there exists a sourceAttributesType, we need to explicitly give an error as normal assignability check allow excess properties and will pass. + if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || sourceAttributesType.properties.length > 0)) { + error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } - // Check that all required properties have been provided. If an 'any' - // was spreaded in, though, assume that it provided all required properties - if (targetAttributesType && !sawSpreadedAny) { - var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912 /* Optional */) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); - } - } + else { + checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); } } - function checkJsxExpression(node) { + function checkJsxExpression(node, checkMode) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression, checkMode); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; @@ -35074,14 +38068,32 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 148 /* PropertyDeclaration */; } function getDeclarationModifierFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; + if (s.valueDeclaration) { + var flags = ts.getCombinedModifierFlags(s.valueDeclaration); + return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */; + } + if (getCheckFlags(s) & 6 /* Synthetic */) { + var checkFlags = s.checkFlags; + var accessModifier = checkFlags & 256 /* ContainsPrivate */ ? 8 /* Private */ : + checkFlags & 64 /* ContainsPublic */ ? 4 /* Public */ : + 16 /* Protected */; + var staticModifier = checkFlags & 512 /* ContainsStatic */ ? 32 /* Static */ : 0; + return accessModifier | staticModifier; + } + if (s.flags & 16777216 /* Prototype */) { + return 4 /* Public */ | 32 /* Static */; + } + return 0; } function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } + function isMethodLike(symbol) { + return !!(symbol.flags & 8192 /* Method */ || getCheckFlags(symbol) & 4 /* SyntheticMethod */); + } /** * Check whether the requested property access is valid. * Returns true if node is a valid property access, and false otherwise. @@ -35090,12 +38102,16 @@ var ts; * @param type The type of left. * @param prop The symbol for the right hand side of the property access. */ - function checkClassPropertyAccess(node, left, type, prop) { + function checkPropertyAccessibility(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 223 /* VariableDeclaration */ ? + var errorNode = node.kind === 178 /* PropertyAccessExpression */ || node.kind === 225 /* VariableDeclaration */ ? node.name : node.right; + if (getCheckFlags(prop) & 256 /* ContainsPrivate */) { + // Synthetic property with private constituent property + error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); + return false; + } if (left.kind === 96 /* SuperKeyword */) { // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or @@ -35104,18 +38120,22 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 149 /* MethodDeclaration */) { - // `prop` refers to a *property* declared in the super class - // rather than a *method*, so it does not satisfy the above criteria. - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2 /* ES2015 */) { + var hasNonMethodDeclaration = forEachProperty(prop, function (p) { + var propKind = getDeclarationKindFromSymbol(p); + return propKind !== 150 /* MethodDeclaration */ && propKind !== 149 /* MethodSignature */; + }); + if (hasNonMethodDeclaration) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128 /* Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an // additional error elsewhere. - error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } } @@ -35128,7 +38148,7 @@ var ts; if (flags & 8 /* Private */) { var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (!isNodeWithinClass(node, declaringClassDeclaration)) { - error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } return true; @@ -35138,14 +38158,15 @@ var ts; if (left.kind === 96 /* SuperKeyword */) { return true; } - // Get the enclosing class that has the declaring class as its base type + // Find the first enclosing class that has the declaring classes of the protected constituents + // of the property as base classes var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); - return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + return isClassDerivedFromDeclaringClasses(enclosingClass, prop) ? enclosingClass : undefined; }); // A protected property is accessible if the property is within the declaring class or classes derived from it if (!enclosingClass) { - error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || type)); return false; } // No further restrictions for static properties @@ -35157,7 +38178,6 @@ var ts; // get the original type -- represented as the type constraint of the 'this' type type = getConstraintOfTypeParameter(type); } - // TODO: why is the first part of this check here? if (!(getObjectFlags(getTargetType(type)) & 3 /* ClassOrInterface */ && hasBaseType(type, enclosingClass))) { error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; @@ -35165,16 +38185,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144 /* Nullable */; - if (kind) { - error(node, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144 /* Nullable */; + if (kind) { + error(errorNode, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 /* Nullable */ | 8192 /* Never */) ? unknownType : t; } return type; } @@ -35203,7 +38224,7 @@ var ts; noUnusedIdentifiers && (prop.flags & 106500 /* ClassMember */) && prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8 /* Private */)) { - if (prop.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(prop) & 1 /* Instantiated */) { getSymbolLinks(prop).target.isReferenced = true; } else { @@ -35211,6 +38232,15 @@ var ts; } } } + function isInPropertyInitializer(node) { + while (node) { + if (node.parent && node.parent.kind === 148 /* PropertyDeclaration */ && node.parent.initializer === node) { + return true; + } + node = node.parent; + } + return false; + } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { var type = checkNonNullExpression(left); if (isTypeAny(type) || type === silentNeverType) { @@ -35223,16 +38253,30 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0 /* String */); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 /* TypeParameter */ && type.isThisType ? apparentType : type); } return unknownType; } + if (prop.valueDeclaration) { + if (isInPropertyInitializer(node) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + } + if (prop.valueDeclaration.kind === 228 /* ClassDeclaration */ && + node.parent && node.parent.kind !== 158 /* TypeReference */ && + !ts.isInAmbientContext(prop.valueDeclaration) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Class_0_used_before_its_declaration, right.text); + } + } markPropertyAsReferenced(prop); getNodeLinks(node).resolvedSymbol = prop; - if (prop.parent && prop.parent.flags & 32 /* Class */) { - checkClassPropertyAccess(node, left, apparentType, prop); - } + checkPropertyAccessibility(node, left, apparentType, prop); var propType = getTypeOfSymbol(prop); var assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { @@ -35244,23 +38288,23 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 177 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || + if (node.kind !== 178 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 65536 /* Union */)) { return propType; } - var flowType = getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined); + var flowType = getFlowTypeOfReference(node, propType); return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 /* PropertyAccessExpression */ + var left = node.kind === 178 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); if (type !== unknownType && !isTypeAny(type)) { var prop = getPropertyOfType(getWidenedType(type), propertyName); - if (prop && prop.parent && prop.parent.flags & 32 /* Class */) { - return checkClassPropertyAccess(node, left, type, prop); + if (prop) { + return checkPropertyAccessibility(node, left, type, prop); } } return true; @@ -35270,7 +38314,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer.kind === 226 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -35299,7 +38343,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 /* ForInStatement */ && + if (node.kind === 214 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -35317,7 +38361,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 181 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -35337,7 +38381,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -35361,7 +38405,7 @@ var ts; if (!leftHandSideSymbol) { return false; } - var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + var globalESSymbol = getGlobalESSymbolConstructorSymbol(/*reportErrors*/ true); if (!globalESSymbol) { // Already errored when we tried to look up the symbol return false; @@ -35375,10 +38419,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 145 /* Decorator */) { + else if (node.kind !== 146 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -35405,16 +38449,16 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { - var signature = signatures_2[_i]; + for (var _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) { + var signature = signatures_3[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent; index = cutoffIndex; } } @@ -35422,7 +38466,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35444,7 +38488,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196 /* SpreadElement */) { + if (arg && arg.kind === 197 /* SpreadElement */) { return i; } } @@ -35457,13 +38501,17 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (ts.isJsxOpeningLikeElement(node)) { + // The arity check will be done in "checkApplicableSignatureForJsxOpeningLikeElement". + return true; + } + if (node.kind === 182 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194 /* TemplateExpression */) { + if (tagExpression.template.kind === 195 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -35480,7 +38528,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* Decorator */) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -35489,19 +38537,21 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 180 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 181 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; - // If we are missing the close paren, the call is incomplete. + // If we are missing the close parenthesis, the call is incomplete. callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; spreadArgIndex = getSpreadArgumentIndex(args); } // If the user supplied type arguments, but the number of type arguments does not match // the declared number of type parameters, the call has an incorrect arity. + var numTypeParameters = ts.length(signature.typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + (typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { return false; } @@ -35531,10 +38581,10 @@ var ts; } // Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec) function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature, /*inferUnionTypes*/ true); + var context = createInferenceContext(signature, /*inferUnionTypes*/ true, /*useAnyForNoInferences*/ false); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -35565,7 +38615,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. @@ -35573,7 +38623,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type @@ -35584,7 +38634,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } // In the second pass we visit only context sensitive arguments, and only those that aren't excluded, this @@ -35598,7 +38648,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -35608,7 +38658,7 @@ var ts; var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; var mapper; - for (var i = 0; i < typeParameters.length; i++) { + for (var i = 0; i < typeArgumentNodes.length; i++) { if (typeArgumentsAreAssignable /* so far */) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -35628,9 +38678,44 @@ var ts; } return typeArgumentsAreAssignable; } + /** + * Check if the given signature can possibly be a signature called by the JSX opening-like element. + * @param node a JSX opening-like element we are trying to figure its call signature + * @param signature a candidate signature we are trying whether it is a call signature + * @param relation a relationship to check parameter and argument type + * @param excludeArgument + */ + function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation) { + // JSX opening-like element has correct arity for stateless-function component if the one of the following condition is true: + // 1. callIsIncomplete + // 2. attributes property has same number of properties as the parameter object type. + // We can figure that out by resolving attributes property and check number of properties in the resolved type + // If the call has correct arity, we will then check if the argument type and parameter type is assignable + var callIsIncomplete = node.attributes.end === node.end; // If we are missing the close "/>", the call is incomplete + if (callIsIncomplete) { + return true; + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; + // Stateless function components can have maximum of three arguments: "props", "context", and "updater". + // However "context" and "updater" are implicit and can't be specify by users. Only the first parameter, props, + // can be specified by users through attributes property. + var paramType = getTypeAtPosition(signature, 0); + var attributesType = checkExpressionWithContextualType(node.attributes, paramType, /*contextualMapper*/ undefined); + var argProperties = getPropertiesOfType(attributesType); + for (var _i = 0, argProperties_1 = argProperties; _i < argProperties_1.length; _i++) { + var arg = argProperties_1[_i]; + if (!getPropertyOfType(paramType, arg.name) && isUnhyphenatedJsxName(arg.name)) { + return false; + } + } + return checkTypeRelatedTo(attributesType, paramType, relation, /*errorNode*/ undefined, headMessage); + } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (ts.isJsxOpeningLikeElement(node)) { + return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); + } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 181 /* NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -35647,7 +38732,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); @@ -35669,12 +38754,12 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { var callee = node.expression; - if (callee.kind === 177 /* PropertyAccessExpression */) { + if (callee.kind === 178 /* PropertyAccessExpression */) { return callee.expression; } - else if (callee.kind === 178 /* ElementAccessExpression */) { + else if (callee.kind === 179 /* ElementAccessExpression */) { return callee.expression; } } @@ -35690,53 +38775,56 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. return undefined; } + else if (ts.isJsxOpeningLikeElement(node)) { + args = node.attributes.properties.length > 0 ? [node.attributes] : emptyArray; + } else { args = node.arguments || emptyArray; } return args; } /** - * Returns the effective argument count for a node that works like a function invocation. - * If 'node' is a Decorator, the number of arguments is derived from the decoration - * target and the signature: - * If 'node.target' is a class declaration or class expression, the effective argument - * count is 1. - * If 'node.target' is a parameter declaration, the effective argument count is 3. - * If 'node.target' is a property declaration, the effective argument count is 2. - * If 'node.target' is a method or accessor declaration, the effective argument count - * is 3, although it can be 2 if the signature only accepts two arguments, allowing - * us to match a property decorator. - * Otherwise, the argument count is the length of the 'args' array. - */ + * Returns the effective argument count for a node that works like a function invocation. + * If 'node' is a Decorator, the number of arguments is derived from the decoration + * target and the signature: + * If 'node.target' is a class declaration or class expression, the effective argument + * count is 1. + * If 'node.target' is a parameter declaration, the effective argument count is 3. + * If 'node.target' is a property declaration, the effective argument count is 2. + * If 'node.target' is a method or accessor declaration, the effective argument count + * is 3, although it can be 2 if the signature only accepts two arguments, allowing + * us to match a property decorator. + * Otherwise, the argument count is the length of the 'args' array. + */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If we are emitting decorators for ES3, we will only pass two arguments. @@ -35746,7 +38834,7 @@ var ts; // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 144 /* Parameter */: + case 145 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -35757,38 +38845,38 @@ var ts; } } /** - * Returns the effective type of the first argument to a decorator. - * If 'node' is a class declaration or class expression, the effective argument type - * is the type of the static side of the class. - * If 'node' is a parameter declaration, the effective argument type is either the type - * of the static or instance side of the class for the parameter's parent method, - * depending on whether the method is declared static. - * For a constructor, the type is always the type of the static side of the class. - * If 'node' is a property, method, or accessor declaration, the effective argument - * type is the type of the static or instance side of the parent class for class - * element, depending on whether the element is declared static. - */ + * Returns the effective type of the first argument to a decorator. + * If 'node' is a class declaration or class expression, the effective argument type + * is the type of the static side of the class. + * If 'node' is a parameter declaration, the effective argument type is either the type + * of the static or instance side of the class for the parameter's parent method, + * depending on whether the method is declared static. + * For a constructor, the type is always the type of the static side of the class. + * If 'node' is a property, method, or accessor declaration, the effective argument + * type is the type of the static or instance side of the parent class for class + * element, depending on whether the element is declared static. + */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -35799,37 +38887,39 @@ var ts; return unknownType; } /** - * Returns the effective type for the second argument to a decorator. - * If 'node' is a parameter, its effective argument type is one of the following: - * If 'node.parent' is a constructor, the effective argument type is 'any', as we - * will emit `undefined`. - * If 'node.parent' is a member with an identifier, numeric, or string literal name, - * the effective argument type will be a string literal type for the member name. - * If 'node.parent' is a computed property name, the effective argument type will - * either be a symbol type or the string type. - * If 'node' is a member with an identifier, numeric, or string literal name, the - * effective argument type will be a string literal type for the member name. - * If 'node' is a computed property name, the effective argument type will either - * be a symbol type or the string type. - * A class decorator does not have a second argument type. - */ + * Returns the effective type for the second argument to a decorator. + * If 'node' is a parameter, its effective argument type is one of the following: + * If 'node.parent' is a constructor, the effective argument type is 'any', as we + * will emit `undefined`. + * If 'node.parent' is a member with an identifier, numeric, or string literal name, + * the effective argument type will be a string literal type for the member name. + * If 'node.parent' is a computed property name, the effective argument type will + * either be a symbol type or the string type. + * If 'node' is a member with an identifier, numeric, or string literal name, the + * effective argument type will be a string literal type for the member name. + * If 'node' is a computed property name, the effective argument type will either + * be a symbol type or the string type. + * A class decorator does not have a second argument type. + */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } + // For a non-constructor parameter decorator, the `propertyKey` will be either + // a string or a symbol, based on the name of the parameter's containing method. } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will @@ -35840,7 +38930,7 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getLiteralTypeForText(32 /* StringLiteral */, element.name.text); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512 /* ESSymbol */)) { return nameType; @@ -35857,30 +38947,30 @@ var ts; return unknownType; } /** - * Returns the effective argument type for the third argument to a decorator. - * If 'node' is a parameter, the effective argument type is the number type. - * If 'node' is a method or accessor, the effective argument type is a - * `TypedPropertyDescriptor` instantiated with the type of the member. - * Class and property decorators do not have a third effective argument. - */ + * Returns the effective argument type for the third argument to a decorator. + * If 'node' is a parameter, the effective argument type is the number type. + * If 'node' is a method or accessor, the effective argument type is a + * `TypedPropertyDescriptor` instantiated with the type of the member. + * Class and property decorators do not have a third effective argument. + */ function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 147 /* PropertyDeclaration */) { + if (node.kind === 148 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -35890,8 +38980,8 @@ var ts; return unknownType; } /** - * Returns the effective argument type for the provided argument to a decorator. - */ + * Returns the effective argument type for the provided argument to a decorator. + */ function getEffectiveDecoratorArgumentType(node, argIndex) { if (argIndex === 0) { return getEffectiveDecoratorFirstArgumentType(node.parent); @@ -35906,16 +38996,16 @@ var ts; return unknownType; } /** - * Gets the effective argument type for an argument in a call expression. - */ + * Gets the effective argument type for an argument in a call expression. + */ function getEffectiveArgumentType(node, argIndex) { // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -35923,25 +39013,25 @@ var ts; return undefined; } /** - * Gets the effective argument expression for an argument in a call expression. - */ + * Gets the effective argument expression for an argument in a call expression. + */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 145 /* Decorator */ || - (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */)) { + if (node.kind === 146 /* Decorator */ || + (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; } /** - * Gets the error node to use when reporting errors for an effective argument. - */ + * Gets the error node to use when reporting errors for an effective argument. + */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -35950,16 +39040,31 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 145 /* Decorator */; + var isTaggedTemplate = node.kind === 182 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 146 /* Decorator */; + var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; - if (!isTaggedTemplate && !isDecorator) { + if (!isTaggedTemplate && !isDecorator && !isJsxOpeningOrSelfClosingElement) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. if (node.expression.kind !== 96 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } + if (signatures.length === 1) { + var declaration = signatures[0].declaration; + if (declaration && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration)) { + if (containsArgumentsReference(declaration)) { + var signatureWithRest = cloneSignature(signatures[0]); + var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args"); + syntheticArgsSymbol.type = anyArrayType; + syntheticArgsSymbol.isRestParameter = true; + signatureWithRest.parameters = ts.concatenate(signatureWithRest.parameters, [syntheticArgsSymbol]); + signatureWithRest.hasRestParameter = true; + signatures = [signatureWithRest]; + } + } + } var candidates = candidatesOutArray || []; // reorderCandidates fills up the candidates array directly reorderCandidates(signatures, candidates); @@ -36022,7 +39127,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 /* CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -36051,6 +39156,10 @@ var ts; // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. if (candidateForArgumentError) { + if (isJsxOpeningOrSelfClosingElement) { + // We do not report any error here because any error will be handled in "resolveCustomJsxElementAttributesType". + return candidateForArgumentError; + } // excludeArgument is undefined, in this case also equivalent to [undefined, undefined, ...] // The importance of excludeArgument is to prevent us from typing function expression parameters // in arguments too early. If possible, we'd like to only type them once we know the correct @@ -36072,7 +39181,7 @@ var ts; if (headMessage) { diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); } - reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + reportNoCommonSupertypeError(inferenceCandidates, node.tagName || node.expression || node.tag, diagnosticChainHead); } } else { @@ -36113,20 +39222,20 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false) + ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false, /*useAnyForNoInferences*/ ts.isInJavaScriptFile(node)) : undefined; while (true) { candidate = originalCandidate; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); + typeArgumentTypes = fillMissingTypeArguments(ts.map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, getMinTypeArgumentCount(candidate.typeParameters)); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); - typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; + typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; } if (!typeArgumentsAreValid) { break; @@ -36136,7 +39245,7 @@ var ts; if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; } - var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; + var index = excludeArgument ? ts.indexOf(excludeArgument, /*value*/ true) : -1; if (index < 0) { return candidate; } @@ -36175,7 +39284,7 @@ var ts; // with the type arguments specified in the extends clause. var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); if (baseTypeNode) { - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode); return resolveCall(node, baseConstructors, candidatesOutArray); } } @@ -36329,12 +39438,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 /* Protected */ && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8 /* Private */) { @@ -36366,26 +39476,26 @@ var ts; return resolveCall(node, callSignatures, candidatesOutArray); } /** - * Gets the localized diagnostic head message to use for errors when resolving a decorator as a call expression. - */ + * Gets the localized diagnostic head message to use for errors when resolving a decorator as a call expression. + */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144 /* Parameter */: + case 145 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } /** - * Resolves a decorator as if it were a call expression. - */ + * Resolves a decorator as if it were a call expression. + */ function resolveDecorator(node, candidatesOutArray) { var funcType = checkExpression(node.expression); var apparentType = getApparentType(funcType); @@ -36407,21 +39517,73 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + /** + * This function is similar to getResolvedSignature but is exclusively for trying to resolve JSX stateless-function component. + * The main reason we have to use this function instead of getResolvedSignature because, the caller of this function will already check the type of openingLikeElement's tagName + * and pass the type as elementType. The elementType can not be a union (as such case should be handled by the caller of this function) + * Note: at this point, we are still not sure whether the opening-like element is a stateless function component or not. + * @param openingLikeElement an opening-like JSX element to try to resolve as JSX stateless function + * @param elementType an element type of the opneing-like element by checking opening-like element's tagname. + * @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service; + * the function will fill it up with appropriate candidate signatures + */ + function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) { + ts.Debug.assert(!(elementType.flags & 65536 /* Union */)); + var callSignature = resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray); + return callSignature; + } + /** + * Try treating a given opening-like element as stateless function component and resolve a tagName to a function signature. + * @param openingLikeElement an JSX opening-like element we want to try resolve its stateless function if possible + * @param elementType a type of the opening-like JSX element, a result of resolving tagName in opening-like element. + * @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service; + * the function will fill it up with appropriate candidate signatures + * @return a resolved signature if we can find function matching function signature through resolve call or a first signature in the list of functions. + * otherwise return undefined if tag-name of the opening-like element doesn't have call signatures + */ + function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) { + // If this function is called from language service, elementType can be a union type. This is not possible if the function is called from compiler (see: resolveCustomJsxElementAttributesType) + if (elementType.flags & 65536 /* Union */) { + var types = elementType.types; + var result = void 0; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var type = types_18[_i]; + result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray); + } + return result; + } + var callSignatures = elementType && getSignaturesOfType(elementType, 0 /* Call */); + if (callSignatures && callSignatures.length > 0) { + var callSignature = void 0; + callSignature = resolveCall(openingLikeElement, callSignatures, candidatesOutArray); + return callSignature; + } + return undefined; + } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145 /* Decorator */: + case 146 /* Decorator */: return resolveDecorator(node, candidatesOutArray); + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + // This code-path is called by language service + return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); } - // candidatesOutArray is passed by signature help in the language service, and collectCandidates - // must fill it up with the appropriate candidate signatures + /** + * Resolve a signature of a given call-like expression. + * @param node a call-like expression to try resolve a signature for + * @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service; + * the function will fill it up with appropriate candidate signatures + * @return a signature of the call-like expression or undefined if one can't be found + */ function getResolvedSignature(node, candidatesOutArray) { var links = getNodeLinks(node); // If getResolvedSignature has already been called, we will have cached the resolvedSignature. @@ -36464,12 +39626,12 @@ var ts; if (node.expression.kind === 96 /* SuperKeyword */) { return voidType; } - if (node.kind === 180 /* NewExpression */) { + if (node.kind === 181 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 /* Constructor */ && - declaration.kind !== 154 /* ConstructSignature */ && - declaration.kind !== 159 /* ConstructorType */ && + declaration.kind !== 151 /* Constructor */ && + declaration.kind !== 155 /* ConstructSignature */ && + declaration.kind !== 160 /* ConstructorType */ && !ts.isJSDocConstructSignature(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any, unless // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations @@ -36479,10 +39641,13 @@ var ts; var funcSymbol = node.expression.kind === 70 /* Identifier */ ? getResolvedSymbol(node.expression) : checkExpression(node.expression).symbol; - if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) { + if (funcSymbol && ts.isDeclarationOfFunctionOrClassExpression(funcSymbol)) { + funcSymbol = getSymbolOfNode(funcSymbol.valueDeclaration.initializer); + } + if (funcSymbol && funcSymbol.members && funcSymbol.flags & 16 /* Function */) { return getInferredClassType(funcSymbol); } - else if (compilerOptions.noImplicitAny) { + else if (noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; @@ -36509,9 +39674,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 225 /* FunctionDeclaration */ + ? 227 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 223 /* VariableDeclaration */ + ? 225 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -36538,6 +39703,22 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 151 /* Constructor */) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -36553,13 +39734,16 @@ var ts; pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } - function assignContextualParameterTypes(signature, context, mapper) { + function getTypeOfFirstParameterOfSignature(signature) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + } + function assignContextualParameterTypes(signature, context, mapper, checkMode) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); - if (isInferentialContext(mapper)) { + if (checkMode === 2 /* Inferential */) { for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -36567,23 +39751,23 @@ var ts; var parameter = signature.thisParameter; if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { if (!parameter) { - signature.thisParameter = createTransientSymbol(context.thisParameter, undefined); + signature.thisParameter = createSymbolWithType(context.thisParameter, /*type*/ undefined); } - assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper); + assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper, checkMode); } } for (var i = 0; i < len; i++) { var parameter = signature.parameters[i]; if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeAtPosition(context, i); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } } @@ -36602,19 +39786,19 @@ var ts; } } } - function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper, checkMode) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); // if inference didn't come up with anything but {}, fall back to the binding pattern if present. if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 /* ObjectBindingPattern */ || - parameter.valueDeclaration.name.kind === 173 /* ArrayBindingPattern */)) { + (parameter.valueDeclaration.name.kind === 173 /* ObjectBindingPattern */ || + parameter.valueDeclaration.name.kind === 174 /* ArrayBindingPattern */)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); } - else if (isInferentialContext(mapper)) { + else if (checkMode === 2 /* Inferential */) { // Even if the parameter already has a type, it might be because it was given a type while // processing the function as an argument to a prior signature during overload resolution. // If this was the case, it may have caused some type parameters to be fixed. So here, @@ -36644,7 +39828,7 @@ var ts; // T in the second overload so that we do not infer Base as a candidate for T // (inferring Base would make type argument inference inconsistent between the two // overloads). - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -36656,10 +39840,10 @@ var ts; } function createPromiseType(promisedType) { // creates a `Promise` type where `T` is the promisedType argument - var globalPromiseType = getGlobalPromiseType(); + var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type - promisedType = getAwaitedType(promisedType); + promisedType = getAwaitedType(promisedType) || emptyObjectType; return createTypeReference(globalPromiseType, [promisedType]); } return emptyObjectType; @@ -36670,53 +39854,63 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol(/*reportErrors*/ true)) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } - function getReturnTypeFromBody(func, contextualMapper) { + function getReturnTypeFromBody(func, checkMode) { var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); if (!func.body) { return unknownType; } - var isAsync = ts.isAsyncFunctionLike(func); + var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 204 /* Block */) { - type = checkExpressionCached(func.body, contextualMapper); - if (isAsync) { + if (func.body.kind !== 206 /* Block */) { + type = checkExpressionCached(func.body, checkMode); + if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body should be unwrapped to its awaited type, which we will wrap in // the native Promise type later in this function. - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + type = checkAwaitedType(type, /*errorNode*/ func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } } else { var types = void 0; - var funcIsGenerator = !!func.asteriskToken; - if (funcIsGenerator) { - types = checkAndAggregateYieldOperandTypes(func, contextualMapper); - if (types.length === 0) { - var iterableIteratorAny = createIterableIteratorType(anyType); - if (compilerOptions.noImplicitAny) { + if (functionFlags & 1 /* Generator */) { + types = ts.concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), checkAndAggregateReturnExpressionTypes(func, checkMode)); + if (!types || types.length === 0) { + var iterableIteratorAny = functionFlags & 2 /* Async */ + ? createAsyncIterableIteratorType(anyType) // AsyncGenerator function + : createIterableIteratorType(anyType); // Generator function + if (noImplicitAny) { error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)); } return iterableIteratorAny; } } else { - types = checkAndAggregateReturnExpressionTypes(func, contextualMapper); + types = checkAndAggregateReturnExpressionTypes(func, checkMode); if (!types) { // For an async function, the return type will not be never, but rather a Promise for never. - return isAsync ? createPromiseReturnType(func, neverType) : neverType; + return functionFlags & 2 /* Async */ + ? createPromiseReturnType(func, neverType) // Async function + : neverType; // Normal function } if (types.length === 0) { // For an async function, the return type will not be void, but rather a Promise for void. - return isAsync ? createPromiseReturnType(func, voidType) : voidType; + return functionFlags & 2 /* Async */ + ? createPromiseReturnType(func, voidType) // Async function + : voidType; // Normal function } } // Return a union of the return expression types. type = getUnionType(types, /*subtypeReduction*/ true); - if (funcIsGenerator) { - type = createIterableIteratorType(type); + if (functionFlags & 1 /* Generator */) { + type = functionFlags & 2 /* Async */ + ? createAsyncIterableIteratorType(type) // AsyncGenerator function + : createIterableIteratorType(type); // Generator function } } if (!contextualSignature) { @@ -36731,17 +39925,25 @@ var ts; // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body is awaited type of the body, wrapped in a native Promise type. - return isAsync ? createPromiseReturnType(func, widenedType) : widenedType; + return (functionFlags & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */ + ? createPromiseReturnType(func, widenedType) // Async function + : widenedType; // Generator function, AsyncGenerator function, or normal function } - function checkAndAggregateYieldOperandTypes(func, contextualMapper) { + function checkAndAggregateYieldOperandTypes(func, checkMode) { var aggregatedTypes = []; + var functionFlags = ts.getFunctionFlags(func); ts.forEachYieldExpression(func.body, function (yieldExpression) { var expr = yieldExpression.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); + var type = checkExpressionCached(expr, checkMode); if (yieldExpression.asteriskToken) { // A yield* expression effectively yields everything that its operand yields - type = checkElementTypeOfIterable(type, yieldExpression.expression); + type = checkIteratedTypeOrElementType(type, yieldExpression.expression, /*allowStringInput*/ false, (functionFlags & 2 /* Async */) !== 0); + } + if (functionFlags & 2 /* Async */) { + type = checkAwaitedType(type, expr, yieldExpression.asteriskToken + ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (!ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); @@ -36762,33 +39964,33 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128 /* HasImplicitReturn */)) { return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; } - function checkAndAggregateReturnExpressionTypes(func, contextualMapper) { - var isAsync = ts.isAsyncFunctionLike(func); + function checkAndAggregateReturnExpressionTypes(func, checkMode) { + var functionFlags = ts.getFunctionFlags(func); var aggregatedTypes = []; var hasReturnWithNoExpression = functionHasImplicitReturn(func); var hasReturnOfTypeNever = false; ts.forEachReturnStatement(func.body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); - if (isAsync) { + var type = checkExpressionCached(expr, checkMode); + if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body should be unwrapped to its awaited type, which should be wrapped in // the native Promise type by the caller. - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (type.flags & 8192 /* Never */) { hasReturnOfTypeNever = true; @@ -36802,7 +40004,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */)) { + func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -36831,7 +40033,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 /* Block */ || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -36863,22 +40065,22 @@ var ts; error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); } } - function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 185 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards - if (contextualMapper === identityMapper && isContextSensitive(node)) { + if (checkMode === 1 /* SkipContextSensitive */ && isContextSensitive(node)) { checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); - var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + var mightFixTypeParameters = contextSensitive && checkMode === 2 /* Inferential */; // Check if function expression is contextually typed and assign parameter types if so. // See the comment in assignTypeToParameterAndFixTypeParameters to understand why we need to // check mightFixTypeParameters. @@ -36893,10 +40095,10 @@ var ts; if (contextualSignature) { var signature = getSignaturesOfType(type, 0 /* Call */)[0]; if (contextSensitive) { - assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + assignContextualParameterTypes(signature, contextualSignature, getContextualMapper(node), checkMode); } if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { - var returnType = getReturnTypeFromBody(node, contextualMapper); + var returnType = getReturnTypeFromBody(node, checkMode); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } @@ -36908,17 +40110,21 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) { + if (produceDiagnostics && node.kind !== 150 /* MethodDeclaration */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); - var isAsync = ts.isAsyncFunctionLike(node); - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); - if (!node.asteriskToken) { + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + var functionFlags = ts.getFunctionFlags(node); + var returnOrPromisedType = node.type && + ((functionFlags & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */ ? + checkAsyncFunctionReturnType(node) : + getTypeFromTypeNode(node.type)); // AsyncGenerator function, Generator function, or normal function + if ((functionFlags & 1 /* Generator */) === 0) { // return is not necessary in the body of generators checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } @@ -36931,7 +40137,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204 /* Block */) { + if (node.body.kind === 206 /* Block */) { checkSourceElement(node.body); } else { @@ -36942,8 +40148,8 @@ var ts; // its return type annotation. var exprType = checkExpression(node.body); if (returnOrPromisedType) { - if (isAsync) { - var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); + if ((functionFlags & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */) { + var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { @@ -36968,21 +40174,21 @@ var ts; // Get accessors without matching set accessors // Enum members // Unions and intersections of the above (unions and intersections eagerly set isReadonly on creation) - return symbol.isReadonly || - symbol.flags & 4 /* Property */ && (getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */) !== 0 || - symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 || + return !!(getCheckFlags(symbol) & 8 /* Readonly */ || + symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */ || + symbol.flags & 3 /* Variable */ && getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */ || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || - (symbol.flags & 8 /* EnumMember */) !== 0; + symbol.flags & 8 /* EnumMember */); } function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) && + (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) && expr.expression.kind === 98 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150 /* Constructor */)) + if (!(func && func.kind === 151 /* Constructor */)) return true; // If func.parent is a class and symbol is a (readonly) property of that class, or // if func is a constructor and symbol is a (readonly) parameter property declared in it, @@ -36994,13 +40200,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237 /* NamespaceImport */; + return declaration && declaration.kind === 239 /* NamespaceImport */; } } } @@ -37009,7 +40215,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipParentheses(expr); - if (node.kind !== 70 /* Identifier */ && node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + if (node.kind !== 70 /* Identifier */ && node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -37017,11 +40223,21 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 178 /* PropertyAccessExpression */ && expr.kind !== 179 /* ElementAccessExpression */) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { checkExpression(node.expression); - return stringType; + return typeofType; } function checkVoidExpression(node) { checkExpression(node.expression); @@ -37030,7 +40246,7 @@ var ts; function checkAwaitExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 524288 /* AwaitContext */)) { + if (!(node.flags & 16384 /* AwaitContext */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -37038,7 +40254,7 @@ var ts; } } var operandType = checkExpression(node.expression); - return checkAwaitedType(operandType, node); + return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); @@ -37052,6 +40268,7 @@ var ts; case 36 /* PlusToken */: case 37 /* MinusToken */: case 51 /* TildeToken */: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -37063,7 +40280,7 @@ var ts; booleanType; case 42 /* PlusPlusToken */: case 43 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37077,7 +40294,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37092,8 +40309,8 @@ var ts; } if (type.flags & 196608 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_19 = types; _i < types_19.length; _i++) { + var t = types_19[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -37110,8 +40327,8 @@ var ts; } if (type.flags & 65536 /* Union */) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_20 = types; _i < types_20.length; _i++) { + var t = types_20[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -37120,8 +40337,8 @@ var ts; } if (type.flags & 131072 /* Intersection */) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_21 = types; _a < types_21.length; _a++) { + var t = types_21[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -37141,14 +40358,17 @@ var ts; } // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, - // and the right operand to be of type Any or a subtype of the 'Function' interface type. + // and the right operand to be of type Any, a subtype of the 'Function' interface type, or have a call or construct signature. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported if (isTypeOfKind(leftType, 8190 /* Primitive */)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0 /* Call */).length || + getSignaturesOfType(rightType, 1 /* Construct */).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -37157,6 +40377,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); // TypeScript 1.0 spec (April 2014): 4.15.5 // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. @@ -37164,37 +40386,37 @@ var ts; if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 /* NumberLike */ | 512 /* ESSymbol */))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */ | 16777216 /* NonPrimitive */)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; + for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { + var p = properties_7[_i]; checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) { - var name_20 = property.name; - if (name_20.kind === 142 /* ComputedPropertyName */) { - checkComputedPropertyName(name_20); + if (property.kind === 260 /* PropertyAssignment */ || property.kind === 261 /* ShorthandPropertyAssignment */) { + var name = property.name; + if (name.kind === 143 /* ComputedPropertyName */) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_20)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 258 /* ShorthandPropertyAssignment */) { + if (property.kind === 261 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -37203,10 +40425,13 @@ var ts; } } else { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 259 /* SpreadAssignment */) { + else if (property.kind === 262 /* SpreadAssignment */) { + if (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(property, 4 /* Rest */); + } var nonRestNames = []; if (allProperties) { for (var i = 0; i < allProperties.length - 1; i++) { @@ -37220,22 +40445,25 @@ var ts; error(property, ts.Diagnostics.Property_assignment_expected); } } - function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { + function checkArrayLiteralAssignment(node, sourceType, checkMode) { + if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512 /* Read */); + } // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; + var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } return sourceType; } - function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198 /* OmittedExpression */) { - if (element.kind !== 196 /* SpreadElement */) { + if (element.kind !== 199 /* OmittedExpression */) { + if (element.kind !== 197 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -37243,7 +40471,7 @@ var ts; ? getTypeOfPropertyOfType(sourceType, propName) : elementType; if (type) { - return checkDestructuringAssignment(element, type, contextualMapper); + return checkDestructuringAssignment(element, type, checkMode); } else { // We still need to check element expression here because we may need to set appropriate flag on the expression @@ -37263,20 +40491,20 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { + if (restExpression.kind === 193 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { - return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); + return checkDestructuringAssignment(restExpression, createArrayType(elementType), checkMode); } } } } return undefined; } - function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 258 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 261 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -37285,28 +40513,28 @@ var ts; !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048 /* Undefined */)) { sourceType = getTypeWithFacts(sourceType, 131072 /* NEUndefined */); } - checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode); } target = exprOrAssignment.name; } else { target = exprOrAssignment; } - if (target.kind === 192 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { - checkBinaryExpression(target, contextualMapper); + if (target.kind === 193 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { + checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 176 /* ObjectLiteralExpression */) { + if (target.kind === 177 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175 /* ArrayLiteralExpression */) { - return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + if (target.kind === 176 /* ArrayLiteralExpression */) { + return checkArrayLiteralAssignment(target, sourceType, checkMode); } - return checkReferenceAssignment(target, sourceType, contextualMapper); + return checkReferenceAssignment(target, sourceType, checkMode); } - function checkReferenceAssignment(target, sourceType, contextualMapper) { - var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 /* SpreadAssignment */ ? + function checkReferenceAssignment(target, sourceType, checkMode) { + var targetType = checkExpression(target, checkMode); + var error = target.parent.kind === 262 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -37328,35 +40556,35 @@ var ts; case 70 /* Identifier */: case 9 /* StringLiteral */: case 11 /* RegularExpressionLiteral */: - case 181 /* TaggedTemplateExpression */: - case 194 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 187 /* TypeOfExpression */: - case 201 /* NonNullExpression */: - case 247 /* JsxSelfClosingElement */: - case 246 /* JsxElement */: + case 138 /* UndefinedKeyword */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 188 /* TypeOfExpression */: + case 202 /* NonNullExpression */: + case 249 /* JsxSelfClosingElement */: + case 248 /* JsxElement */: return true; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -37368,9 +40596,9 @@ var ts; } return false; // Some forms listed here for clarity - case 188 /* VoidExpression */: // Explicit opt-out - case 182 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 200 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 189 /* VoidExpression */: // Explicit opt-out + case 183 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 201 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -37385,16 +40613,16 @@ var ts; firstAssignableToSecond && !secondAssignableToFirst ? type2 : getUnionType([type1, type2], /*subtypeReduction*/ true); } - function checkBinaryExpression(node, contextualMapper) { - return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + function checkBinaryExpression(node, checkMode) { + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, checkMode, node); } - function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 57 /* EqualsToken */ && (left.kind === 176 /* ObjectLiteralExpression */ || left.kind === 175 /* ArrayLiteralExpression */)) { - return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); + if (operator === 57 /* EqualsToken */ && (left.kind === 177 /* ObjectLiteralExpression */ || left.kind === 176 /* ArrayLiteralExpression */)) { + return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } - var leftType = checkExpression(left, contextualMapper); - var rightType = checkExpression(right, contextualMapper); + var leftType = checkExpression(left, checkMode); + var rightType = checkExpression(right, checkMode); switch (operator) { case 38 /* AsteriskToken */: case 39 /* AsteriskAsteriskToken */: @@ -37421,18 +40649,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.1 - // These operators require their operands to be of type Any, the Number primitive type, - // or an enum type. Operands of an enum type are treated - // as having the primitive type Number. If one operand is the null or undefined value, - // it is treated as having the type of the other operand. - // The result is always of the Number primitive type. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion @@ -37455,16 +40673,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.2 - // The binary + operator requires both operands to be of the Number primitive type or an enum type, - // or at least one of the operands to be of type Any or the String primitive type. - // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 /* Any */ | 262178 /* StringLike */) && !isTypeOfKind(rightType, 1 /* Any */ | 262178 /* StringLike */)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340 /* NumberLike */) && isTypeOfKind(rightType, 340 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. @@ -37499,8 +40711,8 @@ var ts; case 29 /* LessThanEqualsToken */: case 30 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -37536,11 +40748,14 @@ var ts; checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 25 /* CommaToken */: - if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) { error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType; } + function isEvalNode(node) { + return node.kind === 70 /* Identifier */ && node.text === "eval"; + } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { var offendingSymbolOperand = maybeTypeOfKind(leftType, 512 /* ESSymbol */) ? left : @@ -37603,7 +40818,7 @@ var ts; function checkYieldExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 131072 /* YieldContext */) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096 /* YieldContext */) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -37614,23 +40829,40 @@ var ts; var func = ts.getContainingFunction(node); // If the user's code is syntactically correct, the func should always have a star. After all, // we are in a yield context. - if (func && func.asteriskToken) { + var functionFlags = func && ts.getFunctionFlags(func); + if (node.asteriskToken) { + if (functionFlags & 2 /* Async */) { + if (languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 4096 /* AsyncDelegator */); + } + } + else if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256 /* Values */); + } + } + if (functionFlags & 1 /* Generator */) { var expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined); var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { - expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); + expressionElementType = checkIteratedTypeOrElementType(expressionType, node.expression, /*allowStringInput*/ false, (functionFlags & 2 /* Async */) !== 0); } // There is no point in doing an assignability check if the function // has no explicit return type because the return type is directly computed // from the yield expressions. if (func.type) { - var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; + var signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(func.type), (functionFlags & 2 /* Async */) !== 0) || anyType; if (nodeIsYieldStar) { - checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, /*headMessage*/ undefined); + checkTypeAssignableTo(functionFlags & 2 /* Async */ + ? getAwaitedType(expressionElementType, node.expression, ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionElementType, signatureElementType, node.expression, + /*headMessage*/ undefined); } else { - checkTypeAssignableTo(expressionType, signatureElementType, node.expression, /*headMessage*/ undefined); + checkTypeAssignableTo(functionFlags & 2 /* Async */ + ? getAwaitedType(expressionType, node.expression, ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionType, signatureElementType, node.expression, + /*headMessage*/ undefined); } } } @@ -37638,10 +40870,10 @@ var ts; // Both yield and yield* expressions have type 'any' return anyType; } - function checkConditionalExpression(node, contextualMapper) { + function checkConditionalExpression(node, checkMode) { checkExpression(node.condition); - var type1 = checkExpression(node.whenTrue, contextualMapper); - var type2 = checkExpression(node.whenFalse, contextualMapper); + var type1 = checkExpression(node.whenTrue, checkMode); + var type2 = checkExpression(node.whenFalse, checkMode); return getBestChoiceType(type1, type2); } function checkLiteralExpression(node) { @@ -37672,12 +40904,17 @@ var ts; } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var saveContextualType = node.contextualType; + var saveContextualMapper = node.contextualMapper; node.contextualType = contextualType; - var result = checkExpression(node, contextualMapper); + node.contextualMapper = contextualMapper; + var checkMode = contextualMapper === identityMapper ? 1 /* SkipContextSensitive */ : + contextualMapper ? 2 /* Inferential */ : 0 /* Normal */; + var result = checkExpression(node, checkMode); node.contextualType = saveContextualType; + node.contextualMapper = saveContextualMapper; return result; } - function checkExpressionCached(node, contextualMapper) { + function checkExpressionCached(node, checkMode) { var links = getNodeLinks(node); if (!links.resolvedType) { // When computing a type that we're going to cache, we need to ignore any ongoing control flow @@ -37685,83 +40922,87 @@ var ts; // to the top of the stack ensures all transient types are computed from a known point. var saveFlowLoopStart = flowLoopStart; flowLoopStart = flowLoopCount; - links.resolvedType = checkExpression(node, contextualMapper); + links.resolvedType = checkExpression(node, checkMode); flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 /* TypeAssertionExpression */ || node.kind === 200 /* AsExpression */; + return node.kind === 183 /* TypeAssertionExpression */ || node.kind === 201 /* AsExpression */; } function checkDeclarationInitializer(declaration) { - var type = checkExpressionCached(declaration.initializer); + var type = getTypeOfExpression(declaration.initializer, /*cache*/ true); return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384 /* TypeParameter */) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. - if (apparentType.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { + if (constraint.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */)); } return false; } - function checkExpressionForMutableLocation(node, contextualMapper) { - var type = checkExpression(node, contextualMapper); + function checkExpressionForMutableLocation(node, checkMode) { + var type = checkExpression(node, checkMode); return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } - function checkPropertyAssignment(node, contextualMapper) { + function checkPropertyAssignment(node, checkMode) { // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } - return checkExpressionForMutableLocation(node.initializer, contextualMapper); + return checkExpressionForMutableLocation(node.initializer, checkMode); } - function checkObjectLiteralMethod(node, contextualMapper) { + function checkObjectLiteralMethod(node, checkMode) { // Grammar checking checkGrammarMethod(node); // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } - var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } - function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (isInferentialContext(contextualMapper)) { + function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { + if (checkMode === 2 /* Inferential */) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { - return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, getContextualMapper(node))); } } } } return type; } - // Returns the type of an expression. Unlike checkExpression, this function is simply concerned - // with computing the type and may not fully check all contained sub-expressions for errors. - function getTypeOfExpression(node) { + /** + * Returns the type of an expression. Unlike checkExpression, this function is simply concerned + * with computing the type and may not fully check all contained sub-expressions for errors. + * A cache argument of true indicates that if the function performs a full type check, it is ok + * to cache the result. + */ + function getTypeOfExpression(node, cache) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { + if (node.kind === 180 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -37771,7 +41012,21 @@ var ts; // Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions // should have a parameter that indicates whether full error checking is required such that // we can perform the optimizations locally. - return checkExpression(node); + return cache ? checkExpressionCached(node) : checkExpression(node); + } + /** + * Returns the type of an expression. Unlike checkExpression, this function is simply concerned + * with computing the type and may not fully check all contained sub-expressions for errors. + * It is intended for uses where you know there is no contextual type, + * and requesting the contextual type might cause a circularity or other bad behaviour. + * It sets the contextual type of the node to any before calling getTypeOfExpression. + */ + function getContextFreeTypeOfExpression(node) { + var saveContextualType = node.contextualType; + node.contextualType = anyType; + var type = getTypeOfExpression(node); + node.contextualType = saveContextualType; + return type; } // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the @@ -37780,30 +41035,30 @@ var ts; // object, it serves as an indicator that all contained function and arrow expressions should be considered to // have the wildcard function type; this form of type check is used during overload resolution to exclude // contextually typed function and arrow expressions in the initial phase. - function checkExpression(node, contextualMapper) { + function checkExpression(node, checkMode) { var type; - if (node.kind === 141 /* QualifiedName */) { + if (node.kind === 142 /* QualifiedName */) { type = checkQualifiedName(node); } else { - var uninstantiatedType = checkExpressionWorker(node, contextualMapper); - type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkExpressionWorker(node, checkMode); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } if (isConstEnumObjectType(type)) { // enum object type for const enums are only permitted in: // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } } return type; } - function checkExpressionWorker(node, contextualMapper) { + function checkExpressionWorker(node, checkMode) { switch (node.kind) { case 70 /* Identifier */: return checkIdentifier(node); @@ -37818,66 +41073,70 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: return checkLiteralExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return checkTemplateExpression(node); case 12 /* NoSubstitutionTemplateLiteral */: return stringType; case 11 /* RegularExpressionLiteral */: return globalRegExpType; - case 175 /* ArrayLiteralExpression */: - return checkArrayLiteral(node, contextualMapper); - case 176 /* ObjectLiteralExpression */: - return checkObjectLiteral(node, contextualMapper); - case 177 /* PropertyAccessExpression */: + case 176 /* ArrayLiteralExpression */: + return checkArrayLiteral(node, checkMode); + case 177 /* ObjectLiteralExpression */: + return checkObjectLiteral(node, checkMode); + case 178 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return checkCallExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 183 /* ParenthesizedExpression */: - return checkExpression(node.expression, contextualMapper); - case 197 /* ClassExpression */: + case 184 /* ParenthesizedExpression */: + return checkExpression(node.expression, checkMode); + case 198 /* ClassExpression */: return checkClassExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187 /* TypeOfExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 188 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return checkAssertion(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return checkNonNullAssertion(node); - case 186 /* DeleteExpression */: + case 203 /* MetaProperty */: + return checkMetaProperty(node); + case 187 /* DeleteExpression */: return checkDeleteExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return checkVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return checkAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: - return checkBinaryExpression(node, contextualMapper); - case 193 /* ConditionalExpression */: - return checkConditionalExpression(node, contextualMapper); - case 196 /* SpreadElement */: - return checkSpreadExpression(node, contextualMapper); - case 198 /* OmittedExpression */: + case 193 /* BinaryExpression */: + return checkBinaryExpression(node, checkMode); + case 194 /* ConditionalExpression */: + return checkConditionalExpression(node, checkMode); + case 197 /* SpreadElement */: + return checkSpreadExpression(node, checkMode); + case 199 /* OmittedExpression */: return undefinedWideningType; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return checkYieldExpression(node); - case 252 /* JsxExpression */: - return checkJsxExpression(node); - case 246 /* JsxElement */: + case 255 /* JsxExpression */: + return checkJsxExpression(node, checkMode); + case 248 /* JsxElement */: return checkJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 248 /* JsxOpeningElement */: + case 253 /* JsxAttributes */: + return checkJsxAttributes(node, checkMode); + case 250 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -37889,7 +41148,16 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); - getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); + checkSourceElement(node.default); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } + var constraintType = getConstraintOfTypeParameter(typeParameter); + var defaultType = getDefaultFromTypeParameter(typeParameter); + if (constraintType && defaultType) { + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } @@ -37905,7 +41173,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92 /* ParameterPropertyModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -37916,7 +41184,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 /* Constructor */ || func.kind === 154 /* ConstructSignature */ || func.kind === 159 /* ConstructorType */) { + if (func.kind === 151 /* Constructor */ || func.kind === 155 /* ConstructSignature */ || func.kind === 160 /* ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -37926,14 +41194,6 @@ var ts; error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } } - function isSyntacticallyValidGenerator(node) { - if (!node.asteriskToken || !node.body) { - return false; - } - return node.kind === 149 /* MethodDeclaration */ || - node.kind === 225 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */; - } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { @@ -37967,7 +41227,7 @@ var ts; error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + var leadingError = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, /*headMessage*/ undefined, leadingError); } @@ -37975,9 +41235,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_21 = _a[_i].name; - if (ts.isBindingPattern(name_21) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -37990,16 +41250,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 185 /* ArrowFunction */: - case 153 /* CallSignature */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 158 /* FunctionType */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + case 186 /* ArrowFunction */: + case 154 /* CallSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 159 /* FunctionType */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -38009,15 +41269,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_22 = element.name; - if (name_22.kind === 70 /* Identifier */ && - name_22.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 /* Identifier */ && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_22.kind === 173 /* ArrayBindingPattern */ || - name_22.kind === 172 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 /* ArrayBindingPattern */ || + name.kind === 173 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } @@ -38025,14 +41285,29 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 /* FunctionType */ || node.kind === 225 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || - node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ || - node.kind === 154 /* ConstructSignature */) { + else if (node.kind === 159 /* FunctionType */ || node.kind === 227 /* FunctionDeclaration */ || node.kind === 160 /* ConstructorType */ || + node.kind === 154 /* CallSignature */ || node.kind === 151 /* Constructor */ || + node.kind === 155 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } + var functionFlags = ts.getFunctionFlags(node); + if ((functionFlags & 7 /* InvalidAsyncOrAsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 64 /* Awaiter */); + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(node, 128 /* Generator */); + } + } + if ((functionFlags & 5 /* InvalidGenerator */) === 1 /* Generator */) { + if (functionFlags & 2 /* Async */ && languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 2048 /* AsyncGenerator */); + } + else if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(node, 128 /* Generator */); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -38040,25 +41315,28 @@ var ts; } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); - if (compilerOptions.noImplicitAny && !node.type) { + if (noImplicitAny && !node.type) { switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } } if (node.type) { - if (languageVersion >= 2 /* ES2015 */ && isSyntacticallyValidGenerator(node)) { + var functionFlags_1 = ts.getFunctionFlags(node); + if ((functionFlags_1 & 5 /* InvalidGenerator */) === 1 /* Generator */) { var returnType = getTypeFromTypeNode(node.type); if (returnType === voidType) { error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); } else { - var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType; - var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType); + var generatorElementType = getIteratedTypeOfGenerator(returnType, (functionFlags_1 & 2 /* Async */) !== 0) || anyType; + var iterableIteratorInstantiation = functionFlags_1 & 2 /* Async */ + ? createAsyncIterableIteratorType(generatorElementType) // AsyncGenerator function + : createIterableIteratorType(generatorElementType); // Generator function // Naively, one could check that IterableIterator is assignable to the return type annotation. // However, that would not catch the error in the following case. // @@ -38068,7 +41346,7 @@ var ts; checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } - else if (ts.isAsyncFunctionLike(node)) { + else if ((functionFlags_1 & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */) { checkAsyncFunctionReturnType(node); } } @@ -38078,17 +41356,18 @@ var ts; } } function checkClassForDuplicateDeclarations(node) { - var Accessor; - (function (Accessor) { - Accessor[Accessor["Getter"] = 1] = "Getter"; - Accessor[Accessor["Setter"] = 2] = "Setter"; - Accessor[Accessor["Property"] = 3] = "Property"; - })(Accessor || (Accessor = {})); + var Declaration; + (function (Declaration) { + Declaration[Declaration["Getter"] = 1] = "Getter"; + Declaration[Declaration["Setter"] = 2] = "Setter"; + Declaration[Declaration["Method"] = 4] = "Method"; + Declaration[Declaration["Property"] = 3] = "Property"; + })(Declaration || (Declaration = {})); var instanceNames = ts.createMap(); var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -38097,36 +41376,76 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114 /* StaticKeyword */; }); + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: addName(names, member.name, memberName, 1 /* Getter */); break; - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: addName(names, member.name, memberName, 2 /* Setter */); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: addName(names, member.name, memberName, 3 /* Property */); break; + case 150 /* MethodDeclaration */: + addName(names, member.name, memberName, 4 /* Method */); + break; } } } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4 /* Method */) { + if (meaning !== 4 /* Method */) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + /** + * Static members being set on a constructor function may conflict with built-in properties + * of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable + * built-in properties. This check issues a transpile error when a class has a static + * member with the same name as a non-writable built-in property. + * + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.3 + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.5 + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-properties-of-the-function-constructor + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-function-instances + */ + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -38134,7 +41453,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146 /* PropertySignature */) { + if (member.kind === 147 /* PropertySignature */) { var memberName = void 0; switch (member.name.kind) { case 9 /* StringLiteral */: @@ -38145,18 +41464,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227 /* InterfaceDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -38176,7 +41495,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -38252,12 +41571,12 @@ var ts; if (n.kind === 98 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 225 /* FunctionDeclaration */) { + else if (n.kind !== 185 /* FunctionExpression */ && n.kind !== 227 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 /* PropertyDeclaration */ && + return n.kind === 148 /* PropertyDeclaration */ && !(ts.getModifierFlags(n) & 32 /* Static */) && !!n.initializer; } @@ -38287,7 +41606,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -38311,7 +41630,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) { if (!(node.flags & 256 /* HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -38321,13 +41640,13 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = node.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28 /* AccessibilityModifier */) !== (ts.getModifierFlags(otherAccessor) & 28 /* AccessibilityModifier */)) { @@ -38343,17 +41662,12 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176 /* ObjectLiteralExpression */) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } - else { - checkNodeDeferred(node); - } + checkSourceElement(node.body); + registerForUnusedIdentifiersCheck(node); } function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { var firstType = getAnnotatedType(first); @@ -38362,14 +41676,11 @@ var ts; error(first, message); } } - function checkAccessorDeferred(node) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } function checkMissingDeclaration(node) { checkDecorators(node); } function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); var typeArguments; var mapper; var result = true; @@ -38377,7 +41688,7 @@ var ts; var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { if (!typeArguments) { - typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + typeArguments = fillMissingTypeArguments(ts.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, minTypeArgumentCount); mapper = createTypeMapper(typeParameters, typeArguments); } var typeArgument = typeArguments[i]; @@ -38430,16 +41741,36 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288 /* IndexedAccess */)) { + return type; + } + // Check if the index type is assignable to 'keyof T' for the object type. + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + // Check if we're indexing with a numeric type and the object type is a generic + // type with a constraint that has a numeric index signature. + if (maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && isTypeOfKind(indexType, 340 /* NumberLike */)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1 /* Number */)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node); @@ -38448,9 +41779,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 227 /* InterfaceDeclaration */ && - n.parent.kind !== 226 /* ClassDeclaration */ && - n.parent.kind !== 197 /* ClassExpression */ && + if (n.parent.kind !== 229 /* InterfaceDeclaration */ && + n.parent.kind !== 228 /* ClassDeclaration */ && + n.parent.kind !== 198 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -38538,7 +41869,7 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */) && + var reportError = (node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */) && (ts.getModifierFlags(node) & 32 /* Static */) !== (ts.getModifierFlags(subsequentNode) & 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members @@ -38573,11 +41904,11 @@ var ts; } var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { - var current = declarations_4[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var current = declarations_5[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 /* InterfaceDeclaration */ || node.parent.kind === 162 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -38588,7 +41919,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 225 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { + if (node.kind === 227 /* FunctionDeclaration */ || node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */ || node.kind === 151 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -38640,8 +41971,8 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; + for (var _a = 0, signatures_4 = signatures; _a < signatures_4.length; _a++) { + var signature = signatures_4[_a]; if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -38710,16 +42041,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -38729,25 +42060,16 @@ var ts; } } } - function checkNonThenableType(type, location, message) { - type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { - if (location) { - if (!message) { - message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; - } - error(location, message); - } - return unknownType; - } - return type; + function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage) { + var promisedType = getPromisedTypeOfPromise(type, errorNode); + return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage); } /** - * Gets the "promised type" of a promise. - * @param type The type of the promise. - * @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback. - */ - function getPromisedType(promise) { + * Gets the "promised type" of a promise. + * @param type The type of the promise. + * @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback. + */ + function getPromisedTypeOfPromise(promise, errorNode) { // // { // promise // then( // thenFunction @@ -38760,127 +42082,140 @@ var ts; if (isTypeAny(promise)) { return undefined; } - if (getObjectFlags(promise) & 4 /* Reference */) { - if (promise.target === tryGetGlobalPromiseType() - || promise.target === getGlobalPromiseLikeType()) { - return promise.typeArguments[0]; - } + var typeAsPromise = promise; + if (typeAsPromise.promisedTypeOfPromise) { + return typeAsPromise.promisedTypeOfPromise; } - var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType(); - if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) { - return undefined; + if (isReferenceToType(promise, getGlobalPromiseType(/*reportErrors*/ false))) { + return typeAsPromise.promisedTypeOfPromise = promise.typeArguments[0]; } var thenFunction = getTypeOfPropertyOfType(promise, "then"); - if (!thenFunction || isTypeAny(thenFunction)) { + if (isTypeAny(thenFunction)) { return undefined; } - var thenSignatures = getSignaturesOfType(thenFunction, 0 /* Call */); + var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray; if (thenSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method); + } return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288 /* NEUndefinedOrNull */); if (isTypeAny(onfulfilledParameterType)) { return undefined; } var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */); if (onfulfilledParameterSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + } return undefined; } - return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), /*subtypeReduction*/ true); - } - function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return typeAsPromise.promisedTypeOfPromise = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), /*subtypeReduction*/ true); } /** - * Gets the "awaited type" of a type. - * @param type The type to await. - * @remarks The "awaited type" of an expression is its "promised type" if the expression is a - * Promise-like type; otherwise, it is the type of the expression. This is used to reflect - * The runtime behavior of the `await` keyword. - */ - function getAwaitedType(type) { - return checkAwaitedType(type, /*location*/ undefined, /*message*/ undefined); + * Gets the "awaited type" of a type. + * @param type The type to await. + * @remarks The "awaited type" of an expression is its "promised type" if the expression is a + * Promise-like type; otherwise, it is the type of the expression. This is used to reflect + * The runtime behavior of the `await` keyword. + */ + function checkAwaitedType(type, errorNode, diagnosticMessage) { + return getAwaitedType(type, errorNode, diagnosticMessage) || unknownType; } - function checkAwaitedType(type, location, message) { - return checkAwaitedTypeWorker(type); - function checkAwaitedTypeWorker(type) { - if (type.flags & 65536 /* Union */) { - var types = []; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var constituentType = _a[_i]; - types.push(checkAwaitedTypeWorker(constituentType)); - } - return getUnionType(types, /*subtypeReduction*/ true); + function getAwaitedType(type, errorNode, diagnosticMessage) { + var typeAsAwaitable = type; + if (typeAsAwaitable.awaitedTypeOfType) { + return typeAsAwaitable.awaitedTypeOfType; + } + if (isTypeAny(type)) { + return typeAsAwaitable.awaitedTypeOfType = type; + } + if (type.flags & 65536 /* Union */) { + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var constituentType = _a[_i]; + types = ts.append(types, getAwaitedType(constituentType, errorNode, diagnosticMessage)); } - else { - var promisedType = getPromisedType(type); - if (promisedType === undefined) { - // The type was not a PromiseLike, so it could not be unwrapped any further. - // As long as the type does not have a callable "then" property, it is - // safe to return the type; otherwise, an error will have been reported in - // the call to checkNonThenableType and we will return unknownType. - // - // An example of a non-promise "thenable" might be: - // - // await { then(): void {} } - // - // The "thenable" does not match the minimal definition for a PromiseLike. When - // a Promise/A+-compatible or ES6 promise tries to adopt this value, the promise - // will never settle. We treat this as an error to help flag an early indicator - // of a runtime problem. If the user wants to return this value from an async - // function, they would need to wrap it in some other value. If they want it to - // be treated as a promise, they can cast to . - return checkNonThenableType(type, location, message); - } - else { - if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { - // We have a bad actor in the form of a promise whose promised type is - // the same promise type, or a mutually recursive promise. Return the - // unknown type as we cannot guess the shape. If this were the actual - // case in the JavaScript, this Promise would never resolve. - // - // An example of a bad actor with a singly-recursive promise type might - // be: - // - // interface BadPromise { - // then( - // onfulfilled: (value: BadPromise) => any, - // onrejected: (error: any) => any): BadPromise; - // } - // - // The above interface will pass the PromiseLike check, and return a - // promised type of `BadPromise`. Since this is a self reference, we - // don't want to keep recursing ad infinitum. - // - // An example of a bad actor in the form of a mutually-recursive - // promise type might be: - // - // interface BadPromiseA { - // then( - // onfulfilled: (value: BadPromiseB) => any, - // onrejected: (error: any) => any): BadPromiseB; - // } - // - // interface BadPromiseB { - // then( - // onfulfilled: (value: BadPromiseA) => any, - // onrejected: (error: any) => any): BadPromiseA; - // } - // - if (location) { - error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); - } - return unknownType; - } - // Keep track of the type we're about to unwrap to avoid bad recursive promise types. - // See the comments above for more information. - awaitedTypeStack.push(type.id); - var awaitedType = checkAwaitedTypeWorker(promisedType); - awaitedTypeStack.pop(); - return awaitedType; + if (!types) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, /*subtypeReduction*/ true); + } + var promisedType = getPromisedTypeOfPromise(type); + if (promisedType) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { + // Verify that we don't have a bad actor in the form of a promise whose + // promised type is the same as the promise type, or a mutually recursive + // promise. If so, we return undefined as we cannot guess the shape. If this + // were the actual case in the JavaScript, this Promise would never resolve. + // + // An example of a bad actor with a singly-recursive promise type might + // be: + // + // interface BadPromise { + // then( + // onfulfilled: (value: BadPromise) => any, + // onrejected: (error: any) => any): BadPromise; + // } + // The above interface will pass the PromiseLike check, and return a + // promised type of `BadPromise`. Since this is a self reference, we + // don't want to keep recursing ad infinitum. + // + // An example of a bad actor in the form of a mutually-recursive + // promise type might be: + // + // interface BadPromiseA { + // then( + // onfulfilled: (value: BadPromiseB) => any, + // onrejected: (error: any) => any): BadPromiseB; + // } + // + // interface BadPromiseB { + // then( + // onfulfilled: (value: BadPromiseA) => any, + // onrejected: (error: any) => any): BadPromiseA; + // } + // + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); } + return undefined; + } + // Keep track of the type we're about to unwrap to avoid bad recursive promise types. + // See the comments above for more information. + awaitedTypeStack.push(type.id); + var awaitedType = getAwaitedType(promisedType, errorNode, diagnosticMessage); + awaitedTypeStack.pop(); + if (!awaitedType) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = awaitedType; + } + // The type was not a promise, so it could not be unwrapped any further. + // As long as the type does not have a callable "then" property, it is + // safe to return the type; otherwise, an error will be reported in + // the call to getNonThenableType and we will return undefined. + // + // An example of a non-promise "thenable" might be: + // + // await { then(): void {} } + // + // The "thenable" does not match the minimal definition for a promise. When + // a Promise/A+-compatible or ES6 promise tries to adopt this value, the promise + // will never settle. We treat this as an error to help flag an early indicator + // of a runtime problem. If the user wants to return this value from an async + // function, they would need to wrap it in some other value. If they want it to + // be treated as a promise, they can cast to . + var thenFunction = getTypeOfPropertyOfType(type, "then"); + if (thenFunction && getSignaturesOfType(thenFunction, 0 /* Call */).length > 0) { + if (errorNode) { + ts.Debug.assert(!!diagnosticMessage); + error(errorNode, diagnosticMessage); } + return undefined; } + return typeAsAwaitable.awaitedTypeOfType = type; } /** * Checks the return type of an async function to ensure it is a compatible @@ -38925,8 +42260,8 @@ var ts; if (returnType === unknownType) { return unknownType; } - var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) { + var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); + if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) { // The promise type was not a valid type reference to the global promise type, so we // report an error and return the unknown type. error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); @@ -38947,10 +42282,15 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455 /* Value */, /*ignoreErrors*/ true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 /* Identifier */ && promiseConstructorName.text === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } - var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(/*reportErrors*/ true); if (globalPromiseConstructorLikeType === emptyObjectType) { // If we couldn't resolve the global PromiseConstructorLike type we cannot verify // compatibility with __awaiter. @@ -38969,7 +42309,7 @@ var ts; } } // Get and return the awaited type of the return type. - return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return checkAwaitedType(returnType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } /** Check a decorator */ function checkDecorator(node) { @@ -38982,22 +42322,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144 /* Parameter */: + case 145 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -39020,6 +42360,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } /** Check the decorators of a node */ function checkDecorators(node) { if (!node.decorators) { @@ -39033,29 +42376,37 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); + if (node.kind === 145 /* Parameter */) { + checkExternalEmitHelpers(firstDecorator, 32 /* Param */); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: + case 148 /* PropertyDeclaration */: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; + case 145 /* Parameter */: markTypeNodeAsReferenced(node.type); break; } @@ -39067,6 +42418,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -39074,11 +42426,11 @@ var ts; function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); - var isAsync = ts.isAsyncFunctionLike(node); + var functionFlags = ts.getFunctionFlags(node); // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 143 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -39109,17 +42461,19 @@ var ts; } } checkSourceElement(node.body); - if (!node.asteriskToken) { - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if ((functionFlags & 1 /* Generator */) === 0) { + var returnOrPromisedType = node.type && (functionFlags & 2 /* Async */ + ? checkAsyncFunctionReturnType(node) // Async function + : getTypeFromTypeNode(node.type)); // normal function checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { // Report an implicit any error if there is no body, no explicit return type, and node is not a private method // in an ambient context - if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { + if (noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } - if (node.asteriskToken && ts.nodeIsPresent(node.body)) { + if (functionFlags & 1 /* Generator */ && ts.nodeIsPresent(node.body)) { // A generator with a body and no type annotation can still cause errors. It can error if the // yielded values have no common supertype, or it can give an implicit any error if it has no // yielded values. The only way to trigger these errors is to try checking its return type. @@ -39138,56 +42492,54 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261 /* SourceFile */: - case 230 /* ModuleDeclaration */: + case 264 /* SourceFile */: + case 232 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: checkUnusedTypeParameters(node); break; } - ; } } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145 /* Parameter */) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -39200,22 +42552,28 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_3(key); - } + }); } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 /* VariableDeclaration */ && - (declaration.parent.parent.kind === 212 /* ForInStatement */ || - declaration.parent.parent.kind === 213 /* ForOfStatement */)) { + if (declaration.kind === 225 /* VariableDeclaration */ && + (declaration.parent.parent.kind === 214 /* ForInStatement */ || + declaration.parent.parent.kind === 215 /* ForOfStatement */)) { return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 /* Identifier */ ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -39228,12 +42586,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 /* MethodDeclaration */ || member.kind === 147 /* PropertyDeclaration */) { + if (member.kind === 150 /* MethodDeclaration */ || member.kind === 148 /* PropertyDeclaration */) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8 /* Private */) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150 /* Constructor */) { + else if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8 /* Private */) { @@ -39266,22 +42624,21 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } - } + }); } } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 204 /* Block */) { + if (node.kind === 206 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -39304,12 +42661,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 146 /* PropertySignature */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 148 /* MethodSignature */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 147 /* PropertySignature */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 149 /* MethodSignature */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -39318,7 +42675,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -39329,10 +42686,14 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node) { - var current = node; - while (current) { + ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { var isDeclaration_1 = node.kind !== 70 /* Identifier */; if (isDeclaration_1) { @@ -39341,10 +42702,23 @@ var ts; else { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); } - return; + return true; } - current = current.parent; - } + }); + } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + ts.findAncestor(node, function (current) { + if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) { + var isDeclaration_2 = node.kind !== 70 /* Identifier */; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return true; + } + }); } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { @@ -39357,8 +42731,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70 /* Identifier */; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70 /* Identifier */; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -39375,27 +42749,27 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 264 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 /* ES2017 */ || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192 /* HasAsyncFunctions */) { + if (parent.kind === 264 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39430,7 +42804,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 223 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 225 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -39440,24 +42814,24 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 205 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 207 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 204 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 231 /* ModuleBlock */ || - container.kind === 230 /* ModuleDeclaration */ || - container.kind === 261 /* SourceFile */); + (container.kind === 206 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 233 /* ModuleBlock */ || + container.kind === 232 /* ModuleDeclaration */ || + container.kind === 264 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_23 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } @@ -39465,7 +42839,7 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 145 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -39476,7 +42850,7 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 177 /* PropertyAccessExpression */) { + if (n.kind === 178 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } @@ -39495,27 +42869,28 @@ var ts; // so we need to do a bit of extra work to check if reference is legal var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 /* Parameter */) { + if (symbol.valueDeclaration.kind === 145 /* Parameter */ || + symbol.valueDeclaration.kind === 175 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { return; } // - parameter is wrapped in function-like entity - var current = n; - while (current !== node.initializer) { - if (ts.isFunctionLike(current.parent)) { - return; + if (ts.findAncestor(n, function (current) { + if (current === node.initializer) { + return "quit"; } - // computed property names/initializers in instance property declaration of class like entities - // are executed in constructor and thus deferred - if (current.parent.kind === 147 /* PropertyDeclaration */ && - !(ts.hasModifier(current.parent, 32 /* Static */)) && - ts.isClassLike(current.parent.parent)) { - return; - } - current = current.parent; + return ts.isFunctionLike(current.parent) || + // computed property names/initializers in instance property declaration of class like entities + // are executed in constructor and thus deferred + (current.parent.kind === 148 /* PropertyDeclaration */ && + !(ts.hasModifier(current.parent, 32 /* Static */)) && + ts.isClassLike(current.parent.parent)); + })) { + return; } + // fall through to report error } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); } @@ -39536,40 +42911,46 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174 /* BindingElement */) { + if (node.kind === 175 /* BindingElement */) { + if (node.parent.kind === 173 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(node, 4 /* Rest */); + } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); - var name_24 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent.initializer && property) { + checkPropertyAccessibility(parent, parent.initializer, parentType, property); } } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { + if (node.name.kind === 174 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512 /* Read */); + } ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 144 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39580,7 +42961,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39600,21 +42981,22 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) { + if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { + if (node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 /* Parameter */ && right.kind === 223 /* VariableDeclaration */) || - (left.kind === 223 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { + if ((left.kind === 145 /* Parameter */ && right.kind === 225 /* VariableDeclaration */) || + (left.kind === 225 /* VariableDeclaration */ && right.kind === 145 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -39644,8 +43026,8 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 176 /* ObjectLiteralExpression */) { - if (ts.isAsyncFunctionLike(node)) { + if (node.modifiers && node.parent.kind === 177 /* ObjectLiteralExpression */) { + if (ts.getFunctionFlags(node) & 2 /* Async */) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } @@ -39665,7 +43047,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206 /* EmptyStatement */) { + if (node.thenStatement.kind === 208 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -39685,12 +43067,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 226 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -39708,19 +43090,29 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); + if (node.kind === 215 /* ForOfStatement */) { + if (node.awaitModifier) { + if (languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 8192 /* ForAwaitOfIncludes */); + } + } + else if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + } + } // Check the LHS and RHS // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var iteratedType = checkRightHandSideOfForOf(node.expression); + var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); // There may be a destructuring assignment on the left side - if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -39752,7 +43144,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -39766,7 +43158,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -39779,7 +43171,7 @@ var ts; } // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */ | 16777216 /* NonPrimitive */)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -39795,52 +43187,113 @@ var ts; checkVariableDeclaration(decl); } } - function checkRightHandSideOfForOf(rhsExpression) { + function checkRightHandSideOfForOf(rhsExpression, awaitModifier) { var expressionType = checkNonNullExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true, awaitModifier !== undefined); } - function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { + function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable) { if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= 2 /* ES2015 */) { - return checkElementTypeOfIterable(inputType, errorNode); + return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, /*checkAssignability*/ true) || anyType; + } + /** + * When consuming an iterable type in a for..of, spread, or iterator destructuring assignment + * we want to get the iterated type of an iterable for ES2015 or later, or the iterated type + * of a iterable (if defined globally) or element type of an array like for ES2015 or earlier. + */ + function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, checkAssignability) { + var uplevelIteration = languageVersion >= 2 /* ES2015 */; + var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; + // Get the iterated type of an `Iterable` or `IterableIterator` only in ES2015 + // or higher, when inside of an async generator or for-await-if, or when + // downlevelIteration is requested. + if (uplevelIteration || downlevelIteration || allowAsyncIterable) { + // We only report errors for an invalid iterable type in ES2015 or higher. + var iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterable, allowAsyncIterable, checkAssignability); + if (iteratedType || uplevelIteration) { + return iteratedType; + } } + var arrayType = inputType; + var reportedError = false; + var hasStringConstituent = false; + // If strings are permitted, remove any string-like constituents from the array type. + // This allows us to find other non-string element types from an array unioned with + // a string. if (allowStringInput) { - return checkElementTypeOfArrayOrString(inputType, errorNode); - } - if (isArrayLikeType(inputType)) { - var indexType = getIndexTypeOfType(inputType, 1 /* Number */); - if (indexType) { - return indexType; + if (arrayType.flags & 65536 /* Union */) { + // After we remove all types that are StringLike, we will know if there was a string constituent + // based on whether the result of filter is a new array. + var arrayTypes = inputType.types; + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); }); + if (filteredTypes !== arrayTypes) { + arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); + } + } + else if (arrayType.flags & 262178 /* StringLike */) { + arrayType = neverType; + } + hasStringConstituent = arrayType !== inputType; + if (hasStringConstituent) { + if (languageVersion < 1 /* ES5 */) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + } + // Now that we've removed all the StringLike types, if no constituents remain, then the entire + // arrayOrStringType was a string. + if (arrayType.flags & 8192 /* Never */) { + return stringType; + } } } - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (!isArrayLikeType(arrayType)) { + if (errorNode && !reportedError) { + // Which error we report depends on whether we allow strings or if there was a + // string constituent. For example, if the input type is number | string, we + // want to say that number is not an array type. But if the input was just + // number and string input is allowed, we want to say that number is not an + // array type or a string type. + var diagnostic = !allowStringInput || hasStringConstituent + ? downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type + : downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(errorNode, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : undefined; } - return unknownType; - } - /** - * When errorNode is undefined, it means we should not report any errors. - */ - function checkElementTypeOfIterable(iterable, errorNode) { - var elementType = getElementTypeOfIterable(iterable, errorNode); - // Now even though we have extracted the iteratedType, we will have to validate that the type - // passed in is actually an Iterable. - if (errorNode && elementType) { - checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode); + var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */); + if (hasStringConstituent && arrayElementType) { + // This is just an optimization for the case where arrayOrStringType is string | string[] + if (arrayElementType.flags & 262178 /* StringLike */) { + return stringType; + } + return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); } - return elementType || anyType; + return arrayElementType; } /** * We want to treat type as an iterable, and get the type it is an iterable of. The iterable * must have the following structure (annotated with the names of the variables below): * - * { // iterable - * [Symbol.iterator]: { // iteratorFunction - * (): Iterator + * { // iterable + * [Symbol.iterator]: { // iteratorMethod + * (): Iterator + * } + * } + * + * For an async iterable, we expect the following structure: + * + * { // iterable + * [Symbol.asyncIterator]: { // iteratorMethod + * (): AsyncIterator + * } * } - * } * * T is the type we are after. At every level that involves analyzing return types * of signatures, we union the return types of all the signatures. @@ -39852,166 +43305,170 @@ var ts; * caller requested it. Then the caller can decide what to do in the case where there is no iterated * type. This is different from returning anyType, because that would signify that we have matched the * whole pattern and that T (above) is 'any'. + * + * For a **for-of** statement, `yield*` (in a normal generator), spread, array + * destructuring, or normal generator we will only ever look for a `[Symbol.iterator]()` + * method. + * + * For an async generator we will only ever look at the `[Symbol.asyncIterator]()` method. + * + * For a **for-await-of** statement or a `yield*` in an async generator we will look for + * the `[Symbol.asyncIterator]()` method first, and then the `[Symbol.iterator]()` method. */ - function getElementTypeOfIterable(type, errorNode) { + function getIteratedTypeOfIterable(type, errorNode, isAsyncIterable, allowNonAsyncIterables, checkAssignability) { if (isTypeAny(type)) { return undefined; } var typeAsIterable = type; - if (!typeAsIterable.iterableElementType) { - // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable), - // then just grab its type argument. - if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableType()) { - typeAsIterable.iterableElementType = type.typeArguments[0]; + if (isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable) { + return isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable; + } + if (isAsyncIterable) { + // As an optimization, if the type is an instantiation of the global `AsyncIterable` + // or the global `AsyncIterableIterator` then just grab its type argument. + if (isReferenceToType(type, getGlobalAsyncIterableType(/*reportErrors*/ false)) || + isReferenceToType(type, getGlobalAsyncIterableIteratorType(/*reportErrors*/ false))) { + return typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0]; + } + } + if (!isAsyncIterable || allowNonAsyncIterables) { + // As an optimization, if the type is an instantiation of the global `Iterable` or + // `IterableIterator` then just grab its type argument. + if (isReferenceToType(type, getGlobalIterableType(/*reportErrors*/ false)) || + isReferenceToType(type, getGlobalIterableIteratorType(/*reportErrors*/ false))) { + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0] + : typeAsIterable.iteratedTypeOfIterable = type.typeArguments[0]; + } + } + var iteratorMethodSignatures; + var mayBeIterable = false; + if (isAsyncIterable) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("asyncIterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; } - else { - var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); - if (isTypeAny(iteratorFunction)) { - return undefined; - } - var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0 /* Call */) : emptyArray; - if (iteratorFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); - } - return undefined; - } - typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true), errorNode); + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0 /* Call */); + } + if (!isAsyncIterable || (allowNonAsyncIterables && !ts.some(iteratorMethodSignatures))) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; + } + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0 /* Call */); + mayBeIterable = true; + } + if (ts.some(iteratorMethodSignatures)) { + var iteratorMethodReturnType = getUnionType(ts.map(iteratorMethodSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); + var iteratedType = getIteratedTypeOfIterator(iteratorMethodReturnType, errorNode, /*isAsyncIterator*/ false); + if (checkAssignability && errorNode && iteratedType) { + // If `checkAssignability` was specified, we were called from + // `checkIteratedTypeOrElementType`. As such, we need to validate that + // the type passed in is actually an Iterable. + checkTypeAssignableTo(type, mayBeIterable + ? createIterableType(iteratedType) + : createAsyncIterableType(iteratedType), errorNode); } + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType + : typeAsIterable.iteratedTypeOfIterable = iteratedType; + } + if (errorNode) { + error(errorNode, isAsyncIterable + ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); } - return typeAsIterable.iterableElementType; + return undefined; } /** - * This function has very similar logic as getElementTypeOfIterable, except that it operates on + * This function has very similar logic as getIteratedTypeOfIterable, except that it operates on * Iterators instead of Iterables. Here is the structure: * * { // iterator - * next: { // iteratorNextFunction - * (): { // iteratorNextResult - * value: T // iteratorNextValue + * next: { // nextMethod + * (): { // nextResult + * value: T // nextValue * } * } * } * + * For an async iterator, we expect the following structure: + * + * { // iterator + * next: { // nextMethod + * (): PromiseLike<{ // nextResult + * value: T // nextValue + * }> + * } + * } */ - function getElementTypeOfIterator(type, errorNode) { + function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (isTypeAny(type)) { return undefined; } var typeAsIterator = type; - if (!typeAsIterator.iteratorElementType) { - // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator), - // then just grab its type argument. - if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIteratorType()) { - typeAsIterator.iteratorElementType = type.typeArguments[0]; - } - else { - var iteratorNextFunction = getTypeOfPropertyOfType(type, "next"); - if (isTypeAny(iteratorNextFunction)) { - return undefined; - } - var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0 /* Call */) : emptyArray; - if (iteratorNextFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method); - } - return undefined; - } - var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); - if (isTypeAny(iteratorNextResult)) { - return undefined; - } - var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); - if (!iteratorNextValue) { - if (errorNode) { - error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); - } - return undefined; - } - typeAsIterator.iteratorElementType = iteratorNextValue; - } + if (isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator) { + return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator; + } + // As an optimization, if the type is an instantiation of the global `Iterator` (for + // a non-async iterator) or the global `AsyncIterator` (for an async-iterator) then + // just grab its type argument. + var getIteratorType = isAsyncIterator ? getGlobalAsyncIteratorType : getGlobalIteratorType; + if (isReferenceToType(type, getIteratorType(/*reportErrors*/ false))) { + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = type.typeArguments[0] + : typeAsIterator.iteratedTypeOfIterator = type.typeArguments[0]; + } + // Both async and non-async iterators must have a `next` method. + var nextMethod = getTypeOfPropertyOfType(type, "next"); + if (isTypeAny(nextMethod)) { + return undefined; } - return typeAsIterator.iteratorElementType; - } - function getElementTypeOfIterableIterator(type) { - if (isTypeAny(type)) { + var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0 /* Call */) : emptyArray; + if (nextMethodSignatures.length === 0) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.An_async_iterator_must_have_a_next_method + : ts.Diagnostics.An_iterator_must_have_a_next_method); + } return undefined; } - // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), - // then just grab its type argument. - if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableIteratorType()) { - return type.typeArguments[0]; + var nextResult = getUnionType(ts.map(nextMethodSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); + if (isTypeAny(nextResult)) { + return undefined; } - return getElementTypeOfIterable(type, /*errorNode*/ undefined) || - getElementTypeOfIterator(type, /*errorNode*/ undefined); - } - /** - * This function does the following steps: - * 1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents. - * 2. Take the element types of the array constituents. - * 3. Return the union of the element types, and string if there was a string constituent. - * - * For example: - * string -> string - * number[] -> number - * string[] | number[] -> string | number - * string | number[] -> string | number - * string | string[] | number[] -> string | number - * - * It also errors if: - * 1. Some constituent is neither a string nor an array. - * 2. Some constituent is a string and target is less than ES5 (because in ES3 string is not indexable). - */ - function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { - ts.Debug.assert(languageVersion < 2 /* ES2015 */); - var arrayType = arrayOrStringType; - if (arrayOrStringType.flags & 65536 /* Union */) { - // After we remove all types that are StringLike, we will know if there was a string constituent - // based on whether the result of filter is a new array. - var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); }); - if (filteredTypes !== arrayTypes) { - arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); - } - } - else if (arrayOrStringType.flags & 262178 /* StringLike */) { - arrayType = neverType; - } - var hasStringConstituent = arrayOrStringType !== arrayType; - var reportedError = false; - if (hasStringConstituent) { - if (languageVersion < 1 /* ES5 */) { - error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - reportedError = true; - } - // Now that we've removed all the StringLike types, if no constituents remain, then the entire - // arrayOrStringType was a string. - if (arrayType.flags & 8192 /* Never */) { - return stringType; + // For an async iterator, we must get the awaited type of the return type. + if (isAsyncIterator) { + nextResult = getAwaitedTypeOfPromise(nextResult, errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property); + if (isTypeAny(nextResult)) { + return undefined; } } - if (!isArrayLikeType(arrayType)) { - if (!reportedError) { - // Which error we report depends on whether there was a string constituent. For example, - // if the input type is number | string, we want to say that number is not an array type. - // But if the input was just number, we want to say that number is not an array type - // or a string type. - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; - error(errorNode, diagnostic, typeToString(arrayType)); + var nextValue = nextResult && getTypeOfPropertyOfType(nextResult, "value"); + if (!nextValue) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property + : ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); } - return hasStringConstituent ? stringType : unknownType; + return undefined; } - var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */) || unknownType; - if (hasStringConstituent) { - // This is just an optimization for the case where arrayOrStringType is string | string[] - if (arrayElementType.flags & 262178 /* StringLike */) { - return stringType; - } - return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = nextValue + : typeAsIterator.iteratedTypeOfIterator = nextValue; + } + /** + * A generator may have a return type of `Iterator`, `Iterable`, or + * `IterableIterator`. An async generator may have a return type of `AsyncIterator`, + * `AsyncIterable`, or `AsyncIterableIterator`. This function can be used to extract + * the iterated type from this return type for contextual typing and verifying signatures. + */ + function getIteratedTypeOfGenerator(returnType, isAsyncGenerator) { + if (isTypeAny(returnType)) { + return undefined; } - return arrayElementType; + return getIteratedTypeOfIterable(returnType, /*errorNode*/ undefined, isAsyncGenerator, /*allowNonAsyncIterables*/ false, /*checkAssignability*/ false) + || getIteratedTypeOfIterator(returnType, /*errorNode*/ undefined, isAsyncGenerator); } function checkBreakOrContinueStatement(node) { // Grammar checking @@ -40019,10 +43476,12 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152 /* SetAccessor */))); + return !!(node.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153 /* SetAccessor */))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { - var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + var unwrappedReturnType = (ts.getFunctionFlags(func) & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */ + ? getPromisedTypeOfPromise(returnType) // Async function + : returnType; // AsyncGenerator function, Generator function, or normal function return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 /* Void */ | 1 /* Any */); } function checkReturnStatement(node) { @@ -40039,40 +43498,41 @@ var ts; var returnType = getReturnTypeOfSignature(signature); if (strictNullChecks || node.expression || returnType.flags & 8192 /* Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (func.asteriskToken) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1 /* Generator */) { // A generator does not need its return expressions checked against its return type. // Instead, the yield expressions are checked against the element type. // TODO: Check return expressions of generators when return type tracking is added // for generators. return; } - if (func.kind === 152 /* SetAccessor */) { + if (func.kind === 153 /* SetAccessor */) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150 /* Constructor */) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151 /* Constructor */) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { - if (ts.isAsyncFunctionLike(func)) { - var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (functionFlags & 2 /* Async */) { + var promisedType = getPromisedTypeOfPromise(returnType); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -40081,7 +43541,7 @@ var ts; function checkWithStatement(node) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -40102,7 +43562,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 254 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 257 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -40114,7 +43574,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 256 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable @@ -40140,18 +43600,16 @@ var ts; function checkLabeledStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - var current = node.parent; - while (current) { + ts.findAncestor(node.parent, function (current) { if (ts.isFunctionLike(current)) { - break; + return "quit"; } - if (current.kind === 219 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 221 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); - break; + return true; } - current = current.parent; - } + }); } // ensure that label is unique checkSourceElement(node.statement); @@ -40182,14 +43640,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -40241,15 +43699,16 @@ var ts; if (!indexType) { return; } + var propDeclaration = prop.valueDeclaration; // index is numeric and property name is not valid numeric literal - if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) { + if (indexKind === 1 /* Number */ && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 142 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -40279,16 +43738,26 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } - /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ + /** + * Check each type parameter and check that type parameters have no duplicate type parameter declarations + */ function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + var seenDefault = false; + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { + if (node.default) { + seenDefault = true; + } + else if (seenDefault) { + error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + } for (var j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); @@ -40299,22 +43768,64 @@ var ts; } } /** Check that type parameter lists are identical across multiple declarations */ - function checkTypeParameterListsIdentical(node, symbol) { + function checkTypeParameterListsIdentical(symbol) { if (symbol.declarations.length === 1) { return; } - var firstDecl; - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ || declaration.kind === 227 /* InterfaceDeclaration */) { - if (!firstDecl) { - firstDecl = declaration; + var links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (declarations.length <= 1) { + return; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { + // Report an error on every conflicting declaration. + var name = symbolToString(symbol); + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); } - else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + function areTypeParametersIdentical(declarations, typeParameters) { + var maxTypeArgumentCount = ts.length(typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + // If this declaration has too few or too many type parameters, we report an error + var numTypeParameters = ts.length(declaration.typeParameters); + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + return false; + } + for (var i = 0; i < numTypeParameters; i++) { + var source = declaration.typeParameters[i]; + var target = typeParameters[i]; + // If the type parameter node does not have the same as the resolved type + // parameter at this position, we report an error. + if (source.name.text !== target.symbol.name) { + return false; + } + // If the type parameter node does not have an identical constraint as the resolved + // type parameter at this position, we report an error. + var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); + var targetConstraint = getConstraintFromTypeParameter(target); + if ((sourceConstraint || targetConstraint) && + (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { + return false; + } + // If the type parameter node has a default and it is not identical to the default + // for the type parameter at this position, we report an error. + var sourceDefault = source.default && getTypeFromTypeNode(source.default); + var targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + return false; } } } + return true; } function checkClassExpression(node) { checkClassLikeDeclaration(node); @@ -40334,11 +43845,12 @@ var ts; registerForUnusedIdentifiersCheck(node); } function checkClassLikeDeclaration(node) { - checkGrammarClassDeclarationHeritageClauses(node); + checkGrammarClassLikeDeclaration(node); checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -40348,19 +43860,27 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); checkClassForDuplicateDeclarations(node); + // Only check for reserved static identifiers on non-ambient context. + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); - for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { + for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) { var constructor = _a[_i]; if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { break; @@ -40369,19 +43889,15 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && - !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226 /* ClassDeclaration */) { - if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { - error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); - } + if (baseConstructorType.flags & 540672 /* TypeVariable */ && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 540672 /* TypeVariable */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify // that all instantiated base constructor signatures return the same type. We can simply compare the type // references (as opposed to checking the structure of the types) because elsewhere we have already checked // that the base type is a class or interface type (and not, for example, an anonymous object type). - var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } @@ -40400,8 +43916,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 /* Reference */ ? t.target : t; - if (getObjectFlags(declaredType) & 3 /* ClassOrInterface */) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -40431,11 +43946,16 @@ var ts; function getTargetSymbol(s) { // if symbol is instantiated its flags are not copied from the 'target' // so we'll need to get back original 'target' symbol to work with correct set of flags - return s.flags & 16777216 /* Instantiated */ ? getSymbolLinks(s).target : s; + return getCheckFlags(s) & 1 /* Instantiated */ ? s.target : s; } function getClassLikeDeclarationOfSymbol(symbol) { return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } + function getClassOrInterfaceDeclarationsOfSymbol(symbol) { + return ts.filter(symbol.declarations, function (d) { + return d.kind === 228 /* ClassDeclaration */ || d.kind === 229 /* InterfaceDeclaration */; + }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { // TypeScript 1.0 spec (April 2014): 8.2.3 // A derived class inherits all members from its base class it doesn't override. @@ -40451,11 +43971,11 @@ var ts; // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); - if (base.flags & 134217728 /* Prototype */) { + if (base.flags & 16777216 /* Prototype */) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); @@ -40472,7 +43992,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128 /* Abstract */))) { - if (derivedClassDecl.kind === 197 /* ClassExpression */) { + if (derivedClassDecl.kind === 198 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -40483,7 +44003,7 @@ var ts; else { // derived overrides base. var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 8 /* Private */) || (derivedDeclarationFlags & 8 /* Private */)) { + if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) { // either base or derived property is private - not override, skip it continue; } @@ -40491,64 +44011,32 @@ var ts; // value of 'static' is not the same for properties - not override, skip it continue; } - if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & 98308 /* PropertyOrAccessor */) && (derived.flags & 98308 /* PropertyOrAccessor */))) { + if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { // method is overridden with method or property/accessor is overridden with property/accessor - correct case continue; } var errorMessage = void 0; - if (base.flags & 8192 /* Method */) { + if (isMethodLike(base)) { if (derived.flags & 98304 /* Accessor */) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert((derived.flags & 4 /* Property */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & 4 /* Property */) { - ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert((base.flags & 98304 /* Accessor */) !== 0); - ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } - error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + error(derived.valueDeclaration.name || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } } } } function isAccessor(kind) { - return kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */; - } - function areTypeParametersIdentical(list1, list2) { - if (!list1 && !list2) { - return true; - } - if (!list1 || !list2 || list1.length !== list2.length) { - return false; - } - // TypeScript 1.0 spec (April 2014): - // When a generic interface has multiple declarations, all declarations must have identical type parameter - // lists, i.e. identical type parameter names with identical constraints in identical order. - for (var i = 0, len = list1.length; i < len; i++) { - var tp1 = list1[i]; - var tp2 = list2[i]; - if (tp1.name.text !== tp2.name.text) { - return false; - } - if (!tp1.constraint && !tp2.constraint) { - continue; - } - if (!tp1.constraint || !tp2.constraint) { - return false; - } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { - return false; - } - } - return true; + return kind === 152 /* GetAccessor */ || kind === 153 /* SetAccessor */; } function checkInheritedPropertiesAreIdentical(type, typeNode) { var baseTypes = getBaseTypes(type); @@ -40556,16 +44044,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; - var existing = seen[prop.name]; + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_8 = properties; _a < properties_8.length; _a++) { + var prop = properties_8[_a]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -40573,7 +44061,7 @@ var ts; ok = false; var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); + var errorInfo = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -40590,9 +44078,9 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -40699,7 +44187,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -40710,7 +44198,7 @@ var ts; case 51 /* TildeToken */: return ~value_1; } return undefined; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -40734,12 +44222,13 @@ var ts; } return undefined; case 8 /* NumericLiteral */: + checkGrammarNumericLiteral(e); return +e.text; - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return evalConstant(e.expression); case 70 /* Identifier */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -40752,7 +44241,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178 /* ElementAccessExpression */) { + if (e.kind === 179 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -40770,7 +44259,7 @@ var ts; if (current.kind === 70 /* Identifier */) { break; } - else if (current.kind === 177 /* PropertyAccessExpression */) { + else if (current.kind === 178 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -40814,6 +44303,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -40842,7 +44332,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 229 /* EnumDeclaration */) { + if (declaration.kind !== 231 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -40863,10 +44353,10 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { - var declaration = declarations_5[_i]; - if ((declaration.kind === 226 /* ClassDeclaration */ || - (declaration.kind === 225 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + if ((declaration.kind === 228 /* ClassDeclaration */ || + (declaration.kind === 227 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -40930,7 +44420,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 226 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 228 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -40943,7 +44433,7 @@ var ts; // We can detect if augmentation was applied using following rules: // - augmentation for a global scope is always applied // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module). - var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432 /* Merged */); + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 134217728 /* Transient */); if (checkBody && node.body) { // body of ambient external module is always a module block for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { @@ -40981,39 +44471,39 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: - var name_25 = node.name; - if (ts.isBindingPattern(name_25)) { - for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - // fallthrough - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 225 /* FunctionDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: + // falls through + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -41023,7 +44513,7 @@ var ts; // this is done it two steps // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* Merged */); + var reportError = !(symbol.flags & 134217728 /* Transient */); if (!reportError) { // symbol should not originate in augmentation reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); @@ -41036,12 +44526,12 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: do { node = node.left; } while (node.kind !== 70 /* Identifier */); return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 70 /* Identifier */); @@ -41054,9 +44544,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 264 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -41089,7 +44579,7 @@ var ts; (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 /* ExportSpecifier */ ? + var message = node.kind === 245 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -41117,7 +44607,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -41174,8 +44664,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 /* ModuleBlock */ && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 264 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -41189,7 +44681,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 /* SourceFile */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 230 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 264 /* SourceFile */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 232 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -41215,9 +44707,14 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 261 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 230 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 264 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 232 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } // Grammar checking @@ -41243,18 +44740,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -41263,35 +44755,35 @@ var ts; } // Checks for export * conflicts var exports = getExportsOfModule(moduleSymbol); - for (var id in exports) { + exports && exports.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports[id], declarations = _a.declarations, flags = _a.flags; // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. // (TS Exceptions: namespaces, function overloads, enums, and interfaces) if (flags & (1920 /* Namespace */ | 64 /* Interface */ | 384 /* Enum */)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) { // it is legal to merge type alias with other values // so count should be either 1 (just type alias) or 2 (type alias + merged value) - continue; + return; } if (exportedDeclarationsCount > 1) { - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; if (isNotOverload(declaration)) { diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || + return (declaration.kind !== 227 /* FunctionDeclaration */ && declaration.kind !== 150 /* MethodDeclaration */) || !!declaration.body; } } @@ -41304,123 +44796,123 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return checkTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return checkParameter(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return checkPropertyDeclaration(node); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return checkSignatureDeclaration(node); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return checkMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return checkConstructorDeclaration(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return checkAccessorDeclaration(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return checkTypeReferenceNode(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return checkTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return checkTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return checkArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return checkTupleType(node); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return checkSourceElement(node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return checkIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return checkMappedType(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return checkBlock(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return checkVariableStatement(node); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return checkExpressionStatement(node); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return checkIfStatement(node); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return checkDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return checkWhileStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return checkForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return checkForInStatement(node); - case 213 /* ForOfStatement */: + case 215 /* ForOfStatement */: return checkForOfStatement(node); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return checkReturnStatement(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return checkWithStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return checkSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return checkLabeledStatement(node); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return checkThrowStatement(node); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return checkTryStatement(node); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return checkBindingElement(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return checkClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return checkImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return checkExportDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return checkExportAssignment(node); - case 206 /* EmptyStatement */: + case 208 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 222 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 244 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -41442,17 +44934,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - checkAccessorDeferred(node); + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + checkAccessorDeclaration(node); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -41477,6 +44969,7 @@ var ts; // Grammar checking checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -41496,6 +44989,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1 /* TypeChecked */; } } @@ -41553,7 +45050,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 219 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -41562,12 +45059,12 @@ var ts; return false; } function getSymbolsInScope(location, meaning) { - var symbols = ts.createMap(); - var memberFlags = 0 /* None */; if (isInsideWithStatementBody(location)) { // We cannot answer semantic questions within a with block, do not proceed any further return []; } + var symbols = ts.createMap(); + var memberFlags = 0 /* None */; populateSymbols(); return symbolsToArray(symbols); function populateSymbols() { @@ -41576,25 +45073,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230 /* ModuleDeclaration */: + // falls through + case 232 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - // fall through; this fall-through is necessary because we would like to handle + // falls through + // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -41603,7 +45102,7 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793064 /* Type */); } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -41631,17 +45130,16 @@ var ts; // We will copy all symbol regardless of its reserved name because // symbolsToArray will check whether the key is a reserved name and // it will not copy symbol with reserved name to the array - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -41652,28 +45150,28 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143 /* TypeParameter */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 144 /* TypeParameter */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141 /* QualifiedName */) { + while (node.parent && node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 272 /* JSDocTypeReference */); + return node.parent && (node.parent.kind === 158 /* TypeReference */ || node.parent.kind === 276 /* JSDocTypeReference */); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 178 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 199 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 200 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -41690,13 +45188,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 142 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 236 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 242 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -41704,29 +45202,38 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } + function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1 /* ExportsProperty */: + case 3 /* PrototypeProperty */: + return getSymbolOfNode(entityName.parent); + case 4 /* ThisProperty */: + case 2 /* ModuleExports */: + case 5 /* Property */: + return getSymbolOfNode(entityName.parent.parent); + } + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177 /* PropertyAccessExpression */) { - var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); - switch (specialPropertyAssignmentKind) { - case 1 /* ExportsProperty */: - case 3 /* PrototypeProperty */: - return getSymbolOfNode(entityName.parent); - case 4 /* ThisProperty */: - case 2 /* ModuleExports */: - return getSymbolOfNode(entityName.parent.parent); - default: + if (ts.isInJavaScriptFile(entityName) && + entityName.parent.kind === 178 /* PropertyAccessExpression */ && + entityName.parent === entityName.parent.parent.left) { + // Check if this is a special property assignment + var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); + if (specialPropertyAssignmentSymbol) { + return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 240 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + if (entityName.kind !== 178 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 234 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 236 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } @@ -41736,7 +45243,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 199 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 200 /* ExpressionWithTypeArguments */) { meaning = 793064 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -41747,9 +45254,12 @@ var ts; meaning = 1920 /* Namespace */; } meaning |= 8388608 /* Alias */; - return resolveEntityName(entityName, meaning); + var entityNameSymbol = resolveEntityName(entityName, meaning); + if (entityNameSymbol) { + return entityNameSymbol; + } } - else if (ts.isPartOfExpression(entityName)) { + if (ts.isPartOfExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { // Missing entity name. return undefined; @@ -41760,14 +45270,14 @@ var ts; } return resolveEntityName(entityName, 107455 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 177 /* PropertyAccessExpression */) { + else if (entityName.kind === 178 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141 /* QualifiedName */) { + else if (entityName.kind === 142 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -41776,20 +45286,20 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 272 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; + var meaning = (entityName.parent.kind === 158 /* TypeReference */ || entityName.parent.kind === 276 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 250 /* JsxAttribute */) { + else if (entityName.parent.kind === 252 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156 /* TypePredicate */) { + if (entityName.parent.kind === 157 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 264 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -41807,8 +45317,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 /* BindingElement */ && - node.parent.parent.kind === 172 /* ObjectBindingPattern */ && + else if (node.parent.kind === 175 /* BindingElement */ && + node.parent.parent.kind === 173 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -41819,8 +45329,8 @@ var ts; } switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98 /* ThisKeyword */: var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); @@ -41830,16 +45340,16 @@ var ts; return sig.thisParameter; } } - // fallthrough + // falls through case 96 /* SuperKeyword */: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167 /* ThisType */: + case 168 /* ThisType */: return getTypeFromTypeNode(node).symbol; case 122 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 151 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -41847,17 +45357,17 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 /* ImportDeclaration */ || node.parent.kind === 241 /* ExportDeclaration */) && + ((node.parent.kind === 237 /* ImportDeclaration */ || node.parent.kind === 243 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) { return resolveExternalModuleName(node, node); } - // Fall through + // falls through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -41874,7 +45384,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 258 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 261 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -41891,7 +45401,13 @@ var ts; return unknownType; } if (ts.isPartOfTypeNode(node)) { - return getTypeFromTypeNode(node); + var typeFromTypeNode = getTypeFromTypeNode(node); + if (typeFromTypeNode && ts.isExpressionWithTypeArgumentsInClassImplementsClause(node)) { + var containingClass = ts.getContainingClass(node); + var classType = getTypeOfNode(containingClass); + typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType); + } + return typeFromTypeNode; } if (ts.isPartOfExpression(node)) { return getRegularTypeOfExpression(node); @@ -41899,7 +45415,10 @@ var ts; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { // A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the // extends clause of a class. We handle that case here. - return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; + var classNode = ts.getContainingClass(node); + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)); + var baseType = getBaseTypes(classType)[0]; + return baseType && getTypeWithThisArgument(baseType, classType.thisType); } if (isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration @@ -41936,31 +45455,31 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 /* ObjectLiteralExpression */ || expr.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 177 /* ObjectLiteralExpression */ || expr.kind === 176 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 213 /* ForOfStatement */) { - var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + if (expr.parent.kind === 215 /* ForOfStatement */) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 192 /* BinaryExpression */) { + if (expr.parent.kind === 193 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 257 /* PropertyAssignment */) { + if (expr.parent.kind === 260 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 176 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); } // Gets the property symbol corresponding to the property in destructuring assignment @@ -41981,9 +45500,9 @@ var ts; return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } /** - * Gets either the static or instance type of a class element, based on - * whether the element is declared as "static". - */ + * Gets either the static or instance type of a class element, based on + * whether the element is declared as "static". + */ function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); return ts.getModifierFlags(node) & 32 /* Static */ @@ -41997,29 +45516,32 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 268435456 /* SyntheticProperty */) { + if (getCheckFlags(symbol) & 6 /* Synthetic */) { var symbols_3 = []; - var name_26 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_26); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } }); return symbols_3; } - else if (symbol.flags & 67108864 /* Transient */) { + else if (symbol.flags & 134217728 /* Transient */) { if (symbol.leftSpread) { var links = symbol; - return [links.leftSpread, links.rightSpread]; + return getRootSymbols(links.leftSpread).concat(getRootSymbols(links.rightSpread)); + } + if (symbol.syntheticOrigin) { + return getRootSymbols(symbol.syntheticOrigin); } var target = void 0; var next = symbol; @@ -42037,7 +45559,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -42058,7 +45581,7 @@ var ts; // otherwise - check if at least one export is value symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455 /* Value */) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -42091,20 +45614,16 @@ var ts; } symbol = exportSymbol; } - var parentSymbol = getParentOfSymbol(symbol); - if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 261 /* SourceFile */) { - var symbolFile = parentSymbol.valueDeclaration; + var parentSymbol_1 = getParentOfSymbol(symbol); + if (parentSymbol_1) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 264 /* SourceFile */) { + var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. var symbolIsUmdExport = symbolFile !== referenceFile; return symbolIsUmdExport ? undefined : symbolFile; } - for (var n = node.parent; n; n = n.parent) { - if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) { - return n; - } - } + return ts.findAncestor(node.parent, function (n) { return ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1; }); } } } @@ -42150,7 +45669,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 204 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 206 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -42190,22 +45709,17 @@ var ts; return false; } function isValueAliasDeclaration(node) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - // A synthesized node comes from an emit transformation and is always a value. - return true; - } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.expression && node.expression.kind === 70 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -42215,7 +45729,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 264 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -42236,11 +45750,6 @@ var ts; return isConstEnumSymbol(s) || s.constEnumOnlyModule; } function isReferencedAliasDeclaration(node, checkChildren) { - node = ts.getParseTreeNode(node); - // Purely synthesized nodes are always emitted. - if (node === undefined) { - return true; - } if (ts.isAliasSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node); if (symbol && getSymbolLinks(symbol).referenced) { @@ -42272,16 +45781,30 @@ var ts; } return false; } + function isRequiredInitializedParameter(parameter) { + return strictNullChecks && + !isOptionalParameter(parameter) && + parameter.initializer && + !(ts.getModifierFlags(parameter) & 92 /* ParameterPropertyModifier */); + } function getNodeCheckFlags(node) { - node = ts.getParseTreeNode(node); - return node ? getNodeLinks(node).flags : undefined; + return getNodeLinks(node).flags; } function getEnumMemberValue(node) { computeEnumMemberValues(node.parent); return getNodeLinks(node).enumMemberValue; } + function canHaveConstantValue(node) { + switch (node.kind) { + case 263 /* EnumMember */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + return true; + } + return false; + } function getConstantValue(node) { - if (node.kind === 260 /* EnumMember */) { + if (node.kind === 263 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -42299,16 +45822,18 @@ var ts; function getTypeReferenceSerializationKind(typeName, location) { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. var typeSymbol = resolveEntityName(typeName, 793064 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } // We might not be able to resolve type symbol so use unknown type in that case (eg error case) if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; @@ -42354,6 +45879,9 @@ var ts; var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : unknownType; + if (flags & 4096 /* AddUndefined */) { + type = includeFalsyTypes(type, 2048 /* Undefined */); + } getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -42368,10 +45896,13 @@ var ts; var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); resolveBaseTypesOfClass(classType); var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + if (!baseType.symbol) { + writer.reportIllegalExtends(); + } getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -42382,9 +45913,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -42420,34 +45951,48 @@ var ts; if (resolvedTypeReferenceDirectives) { // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, isDeclarationWithCollidingName: isDeclarationWithCollidingName, - isValueAliasDeclaration: isValueAliasDeclaration, + isValueAliasDeclaration: function (node) { + node = ts.getParseTreeNode(node); + // Synthesized nodes are always treated like values. + return node ? isValueAliasDeclaration(node) : true; + }, hasGlobalName: hasGlobalName, - isReferencedAliasDeclaration: isReferencedAliasDeclaration, - getNodeCheckFlags: getNodeCheckFlags, + isReferencedAliasDeclaration: function (node, checkChildren) { + node = ts.getParseTreeNode(node); + // Synthesized nodes are always treated as referenced. + return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + }, + getNodeCheckFlags: function (node) { + node = ts.getParseTreeNode(node); + return node ? getNodeCheckFlags(node) : undefined; + }, isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, + isRequiredInitializedParameter: isRequiredInitializedParameter, writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, - getConstantValue: getConstantValue, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, collectLinkedAliases: collectLinkedAliases, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, @@ -42470,7 +46015,7 @@ var ts; // property access can only be used as values // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 177 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) + var meaning = (node.kind === 178 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) ? 107455 /* Value */ | 1048576 /* ExportValue */ : 793064 /* Type */ | 1920 /* Namespace */; var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); @@ -42513,15 +46058,15 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 264 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -42541,7 +46086,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 264 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -42551,8 +46096,6 @@ var ts; } // Initialize global symbol table var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -42567,20 +46110,11 @@ var ts; if (file.symbol && file.symbol.globalExports) { // Merge in UMD exports with first-in-wins semantics (see #9771) var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } - } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512 /* EmitHelperFlags */; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } + }); } } if (augmentations) { @@ -42597,110 +46131,67 @@ var ts; // Setup global builtins addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedWideningType; - getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true); getSymbolLinks(unknownSymbol).type = unknownType; // Initialize special types - globalArrayType = getGlobalType("Array", /*arity*/ 1); - globalObjectType = getGlobalType("Object"); - globalFunctionType = getGlobalType("Function"); - globalStringType = getGlobalType("String"); - globalNumberType = getGlobalType("Number"); - globalBooleanType = getGlobalType("Boolean"); - globalRegExpType = getGlobalType("RegExp"); - jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); - getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); }); - getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); - getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); - getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); - getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); - getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); - getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); - tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793064 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); - getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); - getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); - getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); - tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol("Promise", 107455 /* Value */, /*diagnostic*/ undefined) && getGlobalPromiseConstructorSymbol(); }); - getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); - getGlobalThenableType = ts.memoize(createThenableType); - getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); - if (languageVersion >= 2 /* ES2015 */) { - getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); - getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", /*arity*/ 1); }); - getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", /*arity*/ 1); }); - getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", /*arity*/ 1); }); - } - else { - getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); - getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); - } + globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true); + globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true); + globalFunctionType = getGlobalType("Function", /*arity*/ 0, /*reportErrors*/ true); + globalStringType = getGlobalType("String", /*arity*/ 0, /*reportErrors*/ true); + globalNumberType = getGlobalType("Number", /*arity*/ 0, /*reportErrors*/ true); + globalBooleanType = getGlobalType("Boolean", /*arity*/ 0, /*reportErrors*/ true); + globalRegExpType = getGlobalType("RegExp", /*arity*/ 0, /*reportErrors*/ true); anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); - var symbol = getGlobalSymbol("ReadonlyArray", 793064 /* Type */, /*diagnostic*/ undefined); - globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); + globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", /*arity*/ 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - // If we have specified that we are importing helpers, we should report global - // errors if we cannot resolve the helpers external module, or if it does not have - // the necessary helpers exported. - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - // Find the first reference to the helpers module. - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, - /*errorNode*/ undefined); - // If we found the module, report errors if it does not have the necessary exports. - if (helpersModule) { - var exports = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 /* HasClassExtends */ && languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__extends", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 16384 /* HasSpreadAttribute */ && - (languageVersion < 5 /* ESNext */ || compilerOptions.jsx === 2 /* React */)) { - verifyHelperSymbol(exports, "__assign", 107455 /* Value */); - } - if (languageVersion < 5 /* ESNext */ && requestedExternalEmitHelpers & 32768 /* HasRestAttribute */) { - verifyHelperSymbol(exports, "__rest", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 2048 /* HasDecorators */) { - verifyHelperSymbol(exports, "__decorate", 107455 /* Value */); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", 107455 /* Value */); - } - } - if (requestedExternalEmitHelpers & 4096 /* HasParamDecorators */) { - verifyHelperSymbol(exports, "__param", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 8192 /* HasAsyncFunctions */) { - verifyHelperSymbol(exports, "__awaiter", 107455 /* Value */); - if (languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__generator", 107455 /* Value */); + globalThisType = getGlobalTypeOrUndefined("ThisType", /*arity*/ 1); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !ts.isInAmbientContext(location)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1 /* FirstEmitHelper */; helper <= 8192 /* LastEmitHelper */; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455 /* Value */); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(/*location*/ undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1 /* Extends */: return "__extends"; + case 2 /* Assign */: return "__assign"; + case 4 /* Rest */: return "__rest"; + case 8 /* Decorate */: return "__decorate"; + case 16 /* Metadata */: return "__metadata"; + case 32 /* Param */: return "__param"; + case 64 /* Awaiter */: return "__awaiter"; + case 128 /* Generator */: return "__generator"; + case 256 /* Values */: return "__values"; + case 512 /* Read */: return "__read"; + case 1024 /* Spread */: return "__spread"; + case 2048 /* AsyncGenerator */: return "__asyncGenerator"; + case 4096 /* AsyncDelegator */: return "__asyncDelegator"; + case 8192 /* AsyncValues */: return "__asyncValues"; + default: ts.Debug.fail("Unrecognized helper."); } } - function createInstantiatedPromiseLikeType() { - var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyGenericType) { - return createTypeReference(promiseLikeType, [anyType]); + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; } - return emptyObjectType; - } - function createThenableType() { - // build the thenable type that is used to verify against a non-promise "thenable" operand to `await`. - var thenPropertySymbol = createSymbol(67108864 /* Transient */ | 4 /* Property */, "then"); - getSymbolLinks(thenPropertySymbol).type = globalFunctionType; - var thenableType = createObjectType(16 /* Anonymous */); - thenableType.properties = [thenPropertySymbol]; - thenableType.members = createSymbolTable(thenableType.properties); - thenableType.callSignatures = []; - thenableType.constructSignatures = []; - return thenableType; + return externalHelpersModule; } // GRAMMAR CHECKING function checkGrammarDecorators(node) { @@ -42708,14 +46199,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */) { + else if (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -42733,16 +46224,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130 /* ReadonlyKeyword */) { - if (node.kind === 146 /* PropertySignature */ || node.kind === 148 /* MethodSignature */) { + if (node.kind === 147 /* PropertySignature */ || node.kind === 149 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75 /* ConstKeyword */: - if (node.kind !== 229 /* EnumDeclaration */ && node.parent.kind === 226 /* ClassDeclaration */) { + if (node.kind !== 231 /* EnumDeclaration */ && node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */)); } break; @@ -42768,7 +46259,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -42791,10 +46282,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -42807,7 +46298,7 @@ var ts; if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */ && node.kind !== 155 /* IndexSignature */ && node.kind !== 144 /* Parameter */) { + else if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */ && node.kind !== 156 /* IndexSignature */ && node.kind !== 145 /* Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -42827,10 +46318,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -42842,13 +46333,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -42858,14 +46349,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226 /* ClassDeclaration */) { - if (node.kind !== 149 /* MethodDeclaration */ && - node.kind !== 147 /* PropertyDeclaration */ && - node.kind !== 151 /* GetAccessor */ && - node.kind !== 152 /* SetAccessor */) { + if (node.kind !== 228 /* ClassDeclaration */) { + if (node.kind !== 150 /* MethodDeclaration */ && + node.kind !== 148 /* PropertyDeclaration */ && + node.kind !== 152 /* GetAccessor */ && + node.kind !== 153 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { + if (!(node.parent.kind === 228 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -42884,7 +46375,7 @@ var ts; else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -42892,7 +46383,7 @@ var ts; break; } } - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -42907,13 +46398,13 @@ var ts; } return; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256 /* Async */) { @@ -42933,37 +46424,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 230 /* ModuleDeclaration */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 144 /* Parameter */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 232 /* ModuleDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 145 /* Parameter */: return false; default: - if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { return false; } switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */); - case 227 /* InterfaceDeclaration */: - case 205 /* VariableStatement */: - case 228 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 207 /* VariableStatement */: + case 230 /* TypeAliasDeclaration */: return true; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */); default: ts.Debug.fail(); @@ -42976,14 +46467,11 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - if (!node.asteriskToken) { - return false; - } - break; + case 150 /* MethodDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } @@ -43041,8 +46529,12 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } + function checkGrammarClassLikeDeclaration(node) { + var file = ts.getSourceFileOfNode(node); + return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file); + } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -43077,7 +46569,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 134 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { + if (parameter.type.kind !== 135 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -43105,7 +46597,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198 /* OmittedExpression */) { + if (arg.kind === 199 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -43178,28 +46670,25 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 142 /* ComputedPropertyName */) { + if (node.kind !== 143 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) { + if (computedPropertyName.expression.kind === 193 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 227 /* FunctionDeclaration */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } - if (languageVersion < 2 /* ES2015 */) { - return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher); - } } } function checkGrammarForInvalidQuestionMark(questionToken, message) { @@ -43215,15 +46704,15 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */) { + if (prop.kind === 262 /* SpreadAssignment */) { continue; } - var name_27 = prop.name; - if (name_27.kind === 142 /* ComputedPropertyName */) { + var name = prop.name; + if (name.kind === 143 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_27); + checkGrammarComputedPropertyName(name); } - if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 261 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -43232,7 +46721,7 @@ var ts; if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 149 /* MethodDeclaration */) { + if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 150 /* MethodDeclaration */) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -43246,69 +46735,69 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) { + if (prop.kind === 260 /* PropertyAssignment */ || prop.kind === 261 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_27.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_27); + if (name.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149 /* MethodDeclaration */) { + else if (prop.kind === 150 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 151 /* GetAccessor */) { + else if (prop.kind === 152 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 152 /* SetAccessor */) { + else if (prop.kind === 153 /* SetAccessor */) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_27); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_27, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_27)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } } function checkGrammarJsxElement(node) { var seen = ts.createMap(); - for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { + for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251 /* JsxSpreadAttribute */) { + if (attr.kind === 254 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_28 = jsxAttr.name; - if (!seen[name_28.text]) { - seen[name_28.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 255 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -43317,7 +46806,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forInOrOfStatement.kind === 215 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) { + return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + } + } + if (forInOrOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -43332,20 +46826,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -43365,15 +46859,18 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128 /* Abstract */)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128 /* Abstract */) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 /* GetAccessor */ ? + return grammarErrorOnNode(accessor.name, kind === 152 /* GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152 /* SetAccessor */) { + else if (kind === 153 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -43392,14 +46889,14 @@ var ts; } } /** Does the accessor have the right number of parameters? - - A get accessor has no parameters or a single `this` parameter. - A set accessor has one parameter or a `this` parameter and one more parameter */ + * A get accessor has no parameters or a single `this` parameter. + * A set accessor has one parameter or a `this` parameter and one more parameter. + */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -43414,7 +46911,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176 /* ObjectLiteralExpression */) { + if (node.parent.kind === 177 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -43435,10 +46932,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -43449,11 +46946,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 214 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 216 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -43461,8 +46958,8 @@ var ts; return false; } break; - case 218 /* SwitchStatement */: - if (node.kind === 215 /* BreakStatement */ && !node.label) { + case 220 /* SwitchStatement */: + if (node.kind === 217 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -43477,13 +46974,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 /* BreakStatement */ + var message = node.kind === 217 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 215 /* BreakStatement */ + var message = node.kind === 217 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -43495,7 +46992,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 /* ArrayBindingPattern */ || node.name.kind === 172 /* ObjectBindingPattern */) { + if (node.name.kind === 174 /* ArrayBindingPattern */ || node.name.kind === 173 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -43506,11 +47003,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 /* ForInStatement */ && node.parent.parent.kind !== 213 /* ForOfStatement */) { + if (node.parent.parent.kind !== 214 /* ForInStatement */ && node.parent.parent.kind !== 215 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -43539,6 +47036,10 @@ var ts; } } } + if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && + !ts.isInAmbientContext(node.parent.parent) && ts.hasModifier(node.parent.parent, 1 /* Export */)) { + checkESModuleMarker(node.name); + } var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); // 1. LexicalDeclaration : LetOrConst BindingList ; // It is a Syntax Error if the BoundNames of BindingList contains "let". @@ -43548,6 +47049,22 @@ var ts; // and its Identifier is eval or arguments return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } + function checkESModuleMarker(name) { + if (name.kind === 70 /* Identifier */) { + if (ts.unescapeIdentifier(name.text) === "__esModule") { + return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); + } + } + else { + var elements = name.elements; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; + if (!ts.isOmittedExpression(element)) { + return checkESModuleMarker(element.name); + } + } + } + } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 70 /* Identifier */) { if (name.originalKeywordKind === 109 /* LetKeyword */) { @@ -43556,8 +47073,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { - var element = elements_2[_i]; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var element = elements_3[_i]; if (!ts.isOmittedExpression(element)) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -43575,15 +47092,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return false; - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -43598,6 +47115,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -43638,7 +47162,7 @@ var ts; return true; } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -43646,7 +47170,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -43671,13 +47195,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 227 /* InterfaceDeclaration */ || - node.kind === 228 /* TypeAliasDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 241 /* ExportDeclaration */ || - node.kind === 240 /* ExportAssignment */ || - node.kind === 233 /* NamespaceExportDeclaration */ || + if (node.kind === 229 /* InterfaceDeclaration */ || + node.kind === 230 /* TypeAliasDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 243 /* ExportDeclaration */ || + node.kind === 242 /* ExportAssignment */ || + node.kind === 235 /* NamespaceExportDeclaration */ || ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -43686,7 +47210,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 207 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -43712,7 +47236,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 204 /* Block */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 206 /* Block */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -43720,13 +47244,30 @@ var ts; } } else { + // We must be parented by a statement. If so, there's no need + // to report the error as our parent will have already done it. + // Debug.assert(isStatement(node.parent)); } } } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.numericLiteralFlags & 4 /* Octal */) { + var diagnosticMessage = void 0; + if (languageVersion >= 1 /* ES5 */) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 172 /* LiteralType */)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 263 /* EnumMember */)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37 /* MinusToken */; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -43739,11 +47280,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -43752,466 +47293,19 @@ var ts; /// /// /// -/* @internal */ var ts; (function (ts) { - ; - /** - * This map contains information about the shape of each Node in "types.ts" pertaining to how - * each node should be traversed during a transformation. - * - * Each edge corresponds to a property in a Node subtype that should be traversed when visiting - * each child. The properties are assigned in the order in which traversal should occur. - * - * We only add entries for nodes that do not have a create/update pair defined in factory.ts - * - * NOTE: This needs to be kept up to date with changes to nodes in "types.ts". Currently, this - * map is not comprehensive. Only node edges relevant to tree transformation are - * currently defined. We may extend this to be more comprehensive, and eventually - * supplant the existing `forEachChild` implementation if performance is not - * significantly impacted. - */ - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141 /* QualifiedName */] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145 /* Decorator */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182 /* TypeAssertionExpression */] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200 /* AsExpression */] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201 /* NonNullExpression */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[229 /* EnumDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[230 /* ModuleDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[231 /* ModuleBlock */] = [ - { name: "statements", test: ts.isStatement } - ], - _a[234 /* ImportEqualsDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[245 /* ExternalModuleReference */] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[260 /* EnumMember */] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); - function reduceNode(node, f, initial) { - return node ? f(initial, node) : initial; - } - function reduceNodeArray(nodes, f, initial) { - return nodes ? f(initial, nodes) : initial; - } - /** - * Similar to `reduceLeft`, performs a reduction against each child of a node. - * NOTE: Unlike `forEachChild`, this does *not* visit every node. Only nodes added to the - * `nodeEdgeTraversalMap` above will be visited. - * - * @param node The node containing the children to reduce. - * @param initial The initial value to supply to the reduction. - * @param f The callback function - */ - function reduceEachChild(node, initial, cbNode, cbNodeArray) { - if (node === undefined) { - return initial; - } - var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; - var cbNodes = cbNodeArray || cbNode; - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { - return initial; - } - // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { - return initial; - } - var result = initial; - switch (node.kind) { - // Leaf nodes - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: - case 293 /* NotEmittedStatement */: - // No need to visit nodes with no children. - break; - // Names - case 142 /* ComputedPropertyName */: - result = reduceNode(node.expression, cbNode, result); - break; - // Signature elements - case 144 /* Parameter */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 145 /* Decorator */: - result = reduceNode(node.expression, cbNode, result); - break; - // Type member - case 147 /* PropertyDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 149 /* MethodDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 150 /* Constructor */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.body, cbNode, result); - break; - case 151 /* GetAccessor */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 152 /* SetAccessor */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.body, cbNode, result); - break; - // Binding patterns - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 174 /* BindingElement */: - result = reduceNode(node.propertyName, cbNode, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - // Expression - case 175 /* ArrayLiteralExpression */: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 176 /* ObjectLiteralExpression */: - result = reduceNodes(node.properties, cbNodes, result); - break; - case 177 /* PropertyAccessExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.name, cbNode, result); - break; - case 178 /* ElementAccessExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.argumentExpression, cbNode, result); - break; - case 179 /* CallExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); - break; - case 180 /* NewExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); - break; - case 181 /* TaggedTemplateExpression */: - result = reduceNode(node.tag, cbNode, result); - result = reduceNode(node.template, cbNode, result); - break; - case 184 /* FunctionExpression */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 185 /* ArrowFunction */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 183 /* ParenthesizedExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 189 /* AwaitExpression */: - case 195 /* YieldExpression */: - case 196 /* SpreadElement */: - case 201 /* NonNullExpression */: - result = reduceNode(node.expression, cbNode, result); - break; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: - result = reduceNode(node.operand, cbNode, result); - break; - case 192 /* BinaryExpression */: - result = reduceNode(node.left, cbNode, result); - result = reduceNode(node.right, cbNode, result); - break; - case 193 /* ConditionalExpression */: - result = reduceNode(node.condition, cbNode, result); - result = reduceNode(node.whenTrue, cbNode, result); - result = reduceNode(node.whenFalse, cbNode, result); - break; - case 194 /* TemplateExpression */: - result = reduceNode(node.head, cbNode, result); - result = reduceNodes(node.templateSpans, cbNodes, result); - break; - case 197 /* ClassExpression */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); - break; - case 199 /* ExpressionWithTypeArguments */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - break; - // Misc - case 202 /* TemplateSpan */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.literal, cbNode, result); - break; - // Element - case 204 /* Block */: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 205 /* VariableStatement */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.declarationList, cbNode, result); - break; - case 207 /* ExpressionStatement */: - result = reduceNode(node.expression, cbNode, result); - break; - case 208 /* IfStatement */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.thenStatement, cbNode, result); - result = reduceNode(node.elseStatement, cbNode, result); - break; - case 209 /* DoStatement */: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 211 /* ForStatement */: - result = reduceNode(node.initializer, cbNode, result); - result = reduceNode(node.condition, cbNode, result); - result = reduceNode(node.incrementor, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - result = reduceNode(node.initializer, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: - result = reduceNode(node.expression, cbNode, result); - break; - case 218 /* SwitchStatement */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.caseBlock, cbNode, result); - break; - case 219 /* LabeledStatement */: - result = reduceNode(node.label, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 221 /* TryStatement */: - result = reduceNode(node.tryBlock, cbNode, result); - result = reduceNode(node.catchClause, cbNode, result); - result = reduceNode(node.finallyBlock, cbNode, result); - break; - case 223 /* VariableDeclaration */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 224 /* VariableDeclarationList */: - result = reduceNodes(node.declarations, cbNodes, result); - break; - case 225 /* FunctionDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 226 /* ClassDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); - break; - case 232 /* CaseBlock */: - result = reduceNodes(node.clauses, cbNodes, result); - break; - case 235 /* ImportDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.importClause, cbNode, result); - result = reduceNode(node.moduleSpecifier, cbNode, result); - break; - case 236 /* ImportClause */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.namedBindings, cbNode, result); - break; - case 237 /* NamespaceImport */: - result = reduceNode(node.name, cbNode, result); - break; - case 238 /* NamedImports */: - case 242 /* NamedExports */: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: - result = reduceNode(node.propertyName, cbNode, result); - result = reduceNode(node.name, cbNode, result); - break; - case 240 /* ExportAssignment */: - result = ts.reduceLeft(node.decorators, cbNode, result); - result = ts.reduceLeft(node.modifiers, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; - case 241 /* ExportDeclaration */: - result = ts.reduceLeft(node.decorators, cbNode, result); - result = ts.reduceLeft(node.modifiers, cbNode, result); - result = reduceNode(node.exportClause, cbNode, result); - result = reduceNode(node.moduleSpecifier, cbNode, result); - break; - // JSX - case 246 /* JsxElement */: - result = reduceNode(node.openingElement, cbNode, result); - result = ts.reduceLeft(node.children, cbNode, result); - result = reduceNode(node.closingElement, cbNode, result); - break; - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: - result = reduceNode(node.tagName, cbNode, result); - result = reduceNodes(node.attributes, cbNodes, result); - break; - case 249 /* JsxClosingElement */: - result = reduceNode(node.tagName, cbNode, result); - break; - case 250 /* JsxAttribute */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 251 /* JsxSpreadAttribute */: - result = reduceNode(node.expression, cbNode, result); - break; - case 252 /* JsxExpression */: - result = reduceNode(node.expression, cbNode, result); - break; - // Clauses - case 253 /* CaseClause */: - result = reduceNode(node.expression, cbNode, result); - // fall-through - case 254 /* DefaultClause */: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 255 /* HeritageClause */: - result = reduceNodes(node.types, cbNodes, result); - break; - case 256 /* CatchClause */: - result = reduceNode(node.variableDeclaration, cbNode, result); - result = reduceNode(node.block, cbNode, result); - break; - // Property assignments - case 257 /* PropertyAssignment */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 258 /* ShorthandPropertyAssignment */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.objectAssignmentInitializer, cbNode, result); - break; - case 259 /* SpreadAssignment */: - result = reduceNode(node.expression, cbNode, result); - break; - // Top-level nodes - case 261 /* SourceFile */: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 294 /* PartiallyEmittedExpression */: - result = reduceNode(node.expression, cbNode, result); - break; - default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { - var edge = edgeTraversalPath_1[_i]; - var value = node[edge.name]; - if (value !== undefined) { - result = ts.isArray(value) - ? reduceNodes(value, cbNodes, result) - : cbNode(result, value); - } - } - } - break; - } - return result; - } - ts.reduceEachChild = reduceEachChild; - function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { + function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; } - aggregateTransformFlags(node); + ts.aggregateTransformFlags(node); var visited = visitor(node); if (visited === node) { return node; } var visitedNode; if (visited === undefined) { - if (!optional) { - Debug.failNotOptional(); - } return undefined; } else if (ts.isArray(visited)) { @@ -44220,17 +47314,23 @@ var ts; else { visitedNode = visited; } - if (parenthesize !== undefined) { - visitedNode = parenthesize(visitedNode, parentNode); - } - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); return visitedNode; } ts.visitNode = visitNode; - function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) { - if (nodes === undefined) { - return undefined; + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + function visitNodes(nodes, visitor, test, start, count) { + if (nodes === undefined || visitor === undefined) { + return nodes; } var updated; // Ensure start and count have valid values @@ -44245,38 +47345,32 @@ var ts; // If we are not visiting all of the original nodes, we must always create a new array. // Since this is a fragment of a node array, we do not copy over the previous location // and will only copy over `hasTrailingComma` if we are including the last element. - updated = ts.createNodeArray([], /*location*/ undefined, - /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length); + updated = ts.createNodeArray([], /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length); } // Visit each original node. for (var i = 0; i < count; i++) { var node = nodes[i + start]; - aggregateTransformFlags(node); + ts.aggregateTransformFlags(node); var visited = node !== undefined ? visitor(node) : undefined; if (updated !== undefined || visited === undefined || visited !== node) { if (updated === undefined) { // Ensure we have a copy of `nodes`, up to the current index. - updated = ts.createNodeArray(nodes.slice(0, i), /*location*/ nodes, nodes.hasTrailingComma); + updated = ts.createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma); + ts.setTextRange(updated, nodes); } if (visited) { if (ts.isArray(visited)) { for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { var visitedNode = visited_1[_i]; - visitedNode = parenthesize - ? parenthesize(visitedNode, parentNode) - : visitedNode; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); updated.push(visitedNode); } } else { - var visitedNode = parenthesize - ? parenthesize(visited, parentNode) - : visited; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); + ts.Debug.assertNode(visited, test); + ts.aggregateTransformFlags(visited); + updated.push(visited); } } } @@ -44292,19 +47386,20 @@ var ts; context.startLexicalEnvironment(); statements = visitNodes(statements, visitor, ts.isStatement, start); if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { - statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + statements = ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements)), statements); } var declarations = context.endLexicalEnvironment(); - return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + return ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements); } ts.visitLexicalEnvironment = visitLexicalEnvironment; /** * Starts a new lexical environment and visits a parameter list, suspending the lexical * environment upon completion. */ - function visitParameterList(nodes, visitor, context) { + function visitParameterList(nodes, visitor, context, nodesVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } context.startLexicalEnvironment(); - var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + var updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration); context.suspendLexicalEnvironment(); return updated; } @@ -44315,256 +47410,715 @@ var ts; var declarations = context.endLexicalEnvironment(); if (ts.some(declarations)) { var block = ts.convertToFunctionBody(updated); - var statements = mergeLexicalEnvironment(block.statements, declarations); + var statements = ts.mergeLexicalEnvironment(block.statements, declarations); return ts.updateBlock(block, statements); } return updated; } ts.visitFunctionBody = visitFunctionBody; - function visitEachChild(node, visitor, context) { + function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } if (node === undefined) { return undefined; } var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { - return node; - } - // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */) || kind === 168 /* ThisType */) { return node; } switch (node.kind) { - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: + case 297 /* EndOfDeclarationMarker */: + case 246 /* MissingDeclaration */: // No need to visit nodes with no children. return node; // Names - case 142 /* ComputedPropertyName */: + case 142 /* QualifiedName */: + return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier)); + case 143 /* ComputedPropertyName */: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); - // Signature elements - case 144 /* Parameter */: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - // Type member - case 147 /* PropertyDeclaration */: - return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 149 /* MethodDeclaration */: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 150 /* Constructor */: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 151 /* GetAccessor */: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 152 /* SetAccessor */: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); + // Signatures and Signature Elements + case 159 /* FunctionType */: + return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 160 /* ConstructorType */: + return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 154 /* CallSignature */: + return ts.updateCallSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 155 /* ConstructSignature */: + return ts.updateConstructSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 149 /* MethodSignature */: + return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); + case 156 /* IndexSignature */: + return ts.updateIndexSignatureDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 145 /* Parameter */: + return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 146 /* Decorator */: + return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression)); + // Types + case 158 /* TypeReference */: + return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + case 157 /* TypePredicate */: + return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 161 /* TypeQuery */: + return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName)); + case 162 /* TypeLiteral */: + return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor)); + case 163 /* ArrayType */: + return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode)); + case 164 /* TupleType */: + return ts.updateTypleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode)); + case 165 /* UnionType */: + case 166 /* IntersectionType */: + return ts.updateUnionOrIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + case 167 /* ParenthesizedType */: + throw ts.Debug.fail("not implemented."); + case 169 /* TypeOperator */: + return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode)); + case 170 /* IndexedAccessType */: + return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode)); + case 171 /* MappedType */: + return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameter), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); + case 172 /* LiteralType */: + return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); + // Type Declarations + case 144 /* TypeParameter */: + return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode)); + // Type members + case 147 /* PropertySignature */: + return ts.updatePropertySignature(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 148 /* PropertyDeclaration */: + return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 150 /* MethodDeclaration */: + return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 151 /* Constructor */: + return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); + case 152 /* GetAccessor */: + return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 153 /* SetAccessor */: + return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); // Binding patterns - case 172 /* ObjectBindingPattern */: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); - case 173 /* ArrayBindingPattern */: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); - case 174 /* BindingElement */: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); + case 173 /* ObjectBindingPattern */: + return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + case 174 /* ArrayBindingPattern */: + return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + case 175 /* BindingElement */: + return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); // Expression - case 175 /* ArrayLiteralExpression */: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); - case 176 /* ObjectLiteralExpression */: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 177 /* PropertyAccessExpression */: + case 176 /* ArrayLiteralExpression */: + return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + case 177 /* ObjectLiteralExpression */: + return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + case 178 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 179 /* CallExpression */: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 180 /* NewExpression */: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 181 /* TaggedTemplateExpression */: + case 180 /* CallExpression */: + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 181 /* NewExpression */: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 182 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183 /* ParenthesizedExpression */: + case 183 /* TypeAssertionExpression */: + return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 184 /* FunctionExpression */: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 185 /* ArrowFunction */: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 186 /* DeleteExpression */: + case 185 /* FunctionExpression */: + return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 186 /* ArrowFunction */: + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 187 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 194 /* TemplateExpression */: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); - case 195 /* YieldExpression */: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* SpreadElement */: + case 195 /* TemplateExpression */: + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + case 196 /* YieldExpression */: + return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); + case 197 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 197 /* ClassExpression */: - return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199 /* ExpressionWithTypeArguments */: - return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 198 /* ClassExpression */: + return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 200 /* ExpressionWithTypeArguments */: + return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 201 /* AsExpression */: + return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); + case 202 /* NonNullExpression */: + return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Misc - case 202 /* TemplateSpan */: + case 204 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 204 /* Block */: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 205 /* VariableStatement */: - return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207 /* ExpressionStatement */: + case 206 /* Block */: + return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 207 /* VariableStatement */: + return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); + case 209 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* IfStatement */: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock)); - case 209 /* DoStatement */: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 210 /* WhileStatement */: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 211 /* ForStatement */: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 212 /* ForInStatement */: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 213 /* ForOfStatement */: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 214 /* ContinueStatement */: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 215 /* BreakStatement */: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 216 /* ReturnStatement */: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true)); - case 217 /* WithStatement */: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 218 /* SwitchStatement */: + case 210 /* IfStatement */: + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); + case 211 /* DoStatement */: + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + case 212 /* WhileStatement */: + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 213 /* ForStatement */: + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 214 /* ForInStatement */: + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 215 /* ForOfStatement */: + return ts.updateForOf(node, node.awaitModifier, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 216 /* ContinueStatement */: + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 217 /* BreakStatement */: + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 218 /* ReturnStatement */: + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); + case 219 /* WithStatement */: + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 220 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 219 /* LabeledStatement */: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 220 /* ThrowStatement */: + case 221 /* LabeledStatement */: + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 222 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 221 /* TryStatement */: - return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true)); - case 223 /* VariableDeclaration */: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 224 /* VariableDeclarationList */: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 225 /* FunctionDeclaration */: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 226 /* ClassDeclaration */: - return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232 /* CaseBlock */: - return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235 /* ImportDeclaration */: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 236 /* ImportClause */: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true)); - case 237 /* NamespaceImport */: + case 223 /* TryStatement */: + return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); + case 225 /* VariableDeclaration */: + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 226 /* VariableDeclarationList */: + return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + case 227 /* FunctionDeclaration */: + return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 228 /* ClassDeclaration */: + return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 231 /* EnumDeclaration */: + return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + case 232 /* ModuleDeclaration */: + return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); + case 233 /* ModuleBlock */: + return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 234 /* CaseBlock */: + return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + case 236 /* ImportEqualsDeclaration */: + return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); + case 237 /* ImportDeclaration */: + return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 238 /* ImportClause */: + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); + case 239 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 238 /* NamedImports */: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 239 /* ImportSpecifier */: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); - case 240 /* ExportAssignment */: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 241 /* ExportDeclaration */: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true)); - case 242 /* NamedExports */: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 243 /* ExportSpecifier */: - return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); + case 240 /* NamedImports */: + return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + case 241 /* ImportSpecifier */: + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + case 242 /* ExportAssignment */: + return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + case 243 /* ExportDeclaration */: + return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 244 /* NamedExports */: + return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + case 245 /* ExportSpecifier */: + return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + // Module references + case 247 /* ExternalModuleReference */: + return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); // JSX - case 246 /* JsxElement */: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 247 /* JsxSelfClosingElement */: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 248 /* JsxOpeningElement */: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249 /* JsxClosingElement */: + case 248 /* JsxElement */: + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + case 253 /* JsxAttributes */: + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + case 249 /* JsxSelfClosingElement */: + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 250 /* JsxOpeningElement */: + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 251 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 250 /* JsxAttribute */: + case 252 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 251 /* JsxSpreadAttribute */: + case 254 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 253 /* CaseClause */: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 254 /* DefaultClause */: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 255 /* HeritageClause */: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 256 /* CatchClause */: + case 256 /* CaseClause */: + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + case 257 /* DefaultClause */: + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 258 /* HeritageClause */: + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + case 259 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + // Enum + case 263 /* EnumMember */: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 261 /* SourceFile */: + case 264 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: - var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { - var edge = edgeTraversalPath_2[_i]; - var value = node[edge.name]; - if (value !== undefined) { - var visited = ts.isArray(value) - ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node) - : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node); - if (updated !== undefined || visited !== value) { - if (updated === undefined) { - updated = ts.getMutableClone(node); - } - if (visited !== value) { - updated[edge.name] = visited; - } - } - } - } - } - return updated ? ts.updateNode(updated, node) : node; + return node; } - // return node; } ts.visitEachChild = visitEachChild; + /** + * Extracts the single node from a NodeArray. + * + * @param nodes The NodeArray. + */ + function extractSingleNode(nodes) { + ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return ts.singleOrUndefined(nodes); + } +})(ts || (ts = {})); +/* @internal */ +(function (ts) { + function reduceNode(node, f, initial) { + return node ? f(initial, node) : initial; + } + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } + /** + * Similar to `reduceLeft`, performs a reduction against each child of a node. + * NOTE: Unlike `forEachChild`, this does *not* visit every node. + * + * @param node The node containing the children to reduce. + * @param initial The initial value to supply to the reduction. + * @param f The callback function + */ + function reduceEachChild(node, initial, cbNode, cbNodeArray) { + if (node === undefined) { + return initial; + } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; + var kind = node.kind; + // No need to visit nodes with no children. + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */)) { + return initial; + } + // We do not yet support types. + if ((kind >= 157 /* TypePredicate */ && kind <= 172 /* LiteralType */)) { + return initial; + } + var result = initial; + switch (node.kind) { + // Leaf nodes + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: + case 294 /* NotEmittedStatement */: + // No need to visit nodes with no children. + break; + // Names + case 142 /* QualifiedName */: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 143 /* ComputedPropertyName */: + result = reduceNode(node.expression, cbNode, result); + break; + // Signature elements + case 145 /* Parameter */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 146 /* Decorator */: + result = reduceNode(node.expression, cbNode, result); + break; + // Type member + case 148 /* PropertyDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 150 /* MethodDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 151 /* Constructor */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); + break; + case 152 /* GetAccessor */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 153 /* SetAccessor */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); + break; + // Binding patterns + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 175 /* BindingElement */: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + // Expression + case 176 /* ArrayLiteralExpression */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 177 /* ObjectLiteralExpression */: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 178 /* PropertyAccessExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 179 /* ElementAccessExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); + break; + case 180 /* CallExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 181 /* NewExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 182 /* TaggedTemplateExpression */: + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); + break; + case 183 /* TypeAssertionExpression */: + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 185 /* FunctionExpression */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 186 /* ArrowFunction */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 184 /* ParenthesizedExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 190 /* AwaitExpression */: + case 196 /* YieldExpression */: + case 197 /* SpreadElement */: + case 202 /* NonNullExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + result = reduceNode(node.operand, cbNode, result); + break; + case 193 /* BinaryExpression */: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 194 /* ConditionalExpression */: + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); + break; + case 195 /* TemplateExpression */: + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); + break; + case 198 /* ClassExpression */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 200 /* ExpressionWithTypeArguments */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + break; + case 201 /* AsExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.type, cbNode, result); + break; + case 202 /* NonNullExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + // Misc + case 204 /* TemplateSpan */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); + break; + // Element + case 206 /* Block */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 207 /* VariableStatement */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); + break; + case 209 /* ExpressionStatement */: + result = reduceNode(node.expression, cbNode, result); + break; + case 210 /* IfStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); + break; + case 211 /* DoStatement */: + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 213 /* ForStatement */: + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: + result = reduceNode(node.expression, cbNode, result); + break; + case 220 /* SwitchStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); + break; + case 221 /* LabeledStatement */: + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 223 /* TryStatement */: + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); + break; + case 225 /* VariableDeclaration */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 226 /* VariableDeclarationList */: + result = reduceNodes(node.declarations, cbNodes, result); + break; + case 227 /* FunctionDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 228 /* ClassDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 231 /* EnumDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 232 /* ModuleDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 233 /* ModuleBlock */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 234 /* CaseBlock */: + result = reduceNodes(node.clauses, cbNodes, result); + break; + case 236 /* ImportEqualsDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.moduleReference, cbNode, result); + break; + case 237 /* ImportDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); + break; + case 238 /* ImportClause */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); + break; + case 239 /* NamespaceImport */: + result = reduceNode(node.name, cbNode, result); + break; + case 240 /* NamedImports */: + case 244 /* NamedExports */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 242 /* ExportAssignment */: + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 243 /* ExportDeclaration */: + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); + break; + // Module references + case 247 /* ExternalModuleReference */: + result = reduceNode(node.expression, cbNode, result); + break; + // JSX + case 248 /* JsxElement */: + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); + break; + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: + result = reduceNode(node.tagName, cbNode, result); + result = reduceNode(node.attributes, cbNode, result); + break; + case 253 /* JsxAttributes */: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 251 /* JsxClosingElement */: + result = reduceNode(node.tagName, cbNode, result); + break; + case 252 /* JsxAttribute */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 254 /* JsxSpreadAttribute */: + result = reduceNode(node.expression, cbNode, result); + break; + case 255 /* JsxExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + // Clauses + case 256 /* CaseClause */: + result = reduceNode(node.expression, cbNode, result); + // falls through + case 257 /* DefaultClause */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 258 /* HeritageClause */: + result = reduceNodes(node.types, cbNodes, result); + break; + case 259 /* CatchClause */: + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); + break; + // Property assignments + case 260 /* PropertyAssignment */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 261 /* ShorthandPropertyAssignment */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); + break; + case 262 /* SpreadAssignment */: + result = reduceNode(node.expression, cbNode, result); + break; + // Enum + case 263 /* EnumMember */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + // Top-level nodes + case 264 /* SourceFile */: + result = reduceNodes(node.statements, cbNodes, result); + break; + // Transformation nodes + case 295 /* PartiallyEmittedExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + default: + break; + } + return result; + } + ts.reduceEachChild = reduceEachChild; function mergeLexicalEnvironment(statements, declarations) { if (!ts.some(declarations)) { return statements; } return ts.isNodeArray(statements) - ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + ? ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements) : ts.addRange(statements, declarations); } ts.mergeLexicalEnvironment = mergeLexicalEnvironment; - function mergeFunctionBodyLexicalEnvironment(body, declarations) { - if (body && declarations !== undefined && declarations.length > 0) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements)); - } - else { - return ts.createBlock(ts.createNodeArray([ts.createReturn(body, /*location*/ body)].concat(declarations), body), - /*location*/ body, - /*multiLine*/ true); - } - } - return body; - } - ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment; /** * Lifts a NodeArray containing only Statement nodes to a block. * @@ -44575,15 +48129,6 @@ var ts; return ts.singleOrUndefined(nodes) || ts.createBlock(nodes); } ts.liftToBlock = liftToBlock; - /** - * Extracts the single node from a NodeArray. - * - * @param nodes The NodeArray. - */ - function extractSingleNode(nodes) { - Debug.assert(nodes.length <= 1, "Too many nodes written to output."); - return ts.singleOrUndefined(nodes); - } /** * Aggregates the TransformFlags for a Node and its subtree. */ @@ -44629,7 +48174,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 200 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -44647,9 +48192,6 @@ var ts; } var Debug; (function (Debug) { - Debug.failNotOptional = Debug.shouldAssert(1 /* Normal */) - ? function (message) { return Debug.assert(false, message || "Node not optional."); } - : ts.noop; Debug.failBadSyntaxKind = Debug.shouldAssert(1 /* Normal */) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; @@ -44682,7 +48224,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); /// /// @@ -44710,7 +48251,7 @@ var ts; var value; if (ts.isDestructuringAssignment(node)) { value = node.right; - while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + while (ts.isEmptyArrayLiteral(node.left) || ts.isEmptyObjectLiteral(node.left)) { if (ts.isDestructuringAssignment(value)) { location = node = value; value = node.right; @@ -44724,6 +48265,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: true, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -44772,7 +48314,7 @@ var ts; ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); var expression = createAssignmentCallback ? createAssignmentCallback(target, value, location) - : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + : ts.setTextRange(ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value), location); expression.original = original; emitExpression(expression); } @@ -44796,6 +48338,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: hoistTempVariables, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -44821,11 +48364,12 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_29 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_29, - /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, + /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value); variable.original = original; - if (ts.isIdentifier(name_29)) { + ts.setTextRange(variable, location); + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */); } ts.aggregateTransformFlags(variable); @@ -44947,7 +48491,14 @@ var ts; function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); var numElements = elements.length; - if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) { + if (flattenContext.level < 1 /* ObjectRest */ && flattenContext.downlevelIteration) { + // Read the elements of the iterable into an array + value = ensureIdentifier(flattenContext, ts.createReadHelper(flattenContext.context, value, numElements > 0 && ts.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) + ? undefined + : numElements, location), + /*reuseIdentifierExpressions*/ false, location); + } + else if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) { // For anything other than a single-element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. Additionally, if we have zero elements // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, @@ -45029,8 +48580,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_30 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_30); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } /** @@ -45052,7 +48603,7 @@ var ts; var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); if (flattenContext.hoistTempVariables) { flattenContext.context.hoistVariableDeclaration(temp); - flattenContext.emitExpression(ts.createAssignment(temp, value, location)); + flattenContext.emitExpression(ts.setTextRange(ts.createAssignment(temp, value), location)); } else { flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined); @@ -45075,7 +48626,7 @@ var ts; return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)); } function makeBindingElement(name) { - return ts.createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name); + return ts.createBindingElement(/*dotDotDotToken*/ undefined, /*propertyName*/ undefined, name); } function makeAssignmentElement(name) { return name; @@ -45083,10 +48634,11 @@ var ts; var restHelper = { name: "typescript:rest", scoped: false, - text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" }; /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement - * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/ + * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);` + */ function createRestCall(context, value, elements, computedTempVariables, location) { context.requestEmitHelper(restHelper); var propertyNames = []; @@ -45105,7 +48657,11 @@ var ts; } } } - return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + return ts.createCall(ts.getHelperName("__rest"), + /*typeArguments*/ undefined, [ + value, + ts.setTextRange(ts.createArrayLiteral(propertyNames), location) + ]); } })(ts || (ts = {})); /// @@ -45140,8 +48696,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -45205,15 +48761,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 231 /* ModuleBlock */: - case 204 /* Block */: + case 264 /* SourceFile */: + case 234 /* CaseBlock */: + case 233 /* ModuleBlock */: + case 206 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 226 /* ClassDeclaration */: - case 225 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -45260,13 +48816,13 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -45286,11 +48842,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 241 /* ExportDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 236 /* ImportClause */ || - (node.kind === 234 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 245 /* ExternalModuleReference */)) { + if (node.kind === 243 /* ExportDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 238 /* ImportClause */ || + (node.kind === 236 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 247 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -45320,19 +48876,19 @@ var ts; */ function classElementVisitorWorker(node) { switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // TypeScript constructors are transformed in `visitClassDeclaration`. // We elide them here as `visitorWorker` checks transform flags, which could // erronously include an ES6 constructor without TypeScript syntax. return undefined; - case 147 /* PropertyDeclaration */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + case 148 /* PropertyDeclaration */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 203 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -45372,46 +48928,47 @@ var ts; case 123 /* DeclareKeyword */: case 130 /* ReadonlyKeyword */: // TypeScript accessibility and readonly modifiers are elided. - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 161 /* TypeLiteral */: - case 156 /* TypePredicate */: - case 143 /* TypeParameter */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 162 /* TypeLiteral */: + case 157 /* TypePredicate */: + case 144 /* TypeParameter */: case 118 /* AnyKeyword */: case 121 /* BooleanKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: case 104 /* VoidKeyword */: - case 135 /* SymbolKeyword */: - case 159 /* ConstructorType */: - case 158 /* FunctionType */: - case 160 /* TypeQuery */: - case 157 /* TypeReference */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 136 /* SymbolKeyword */: + case 160 /* ConstructorType */: + case 159 /* FunctionType */: + case 161 /* TypeQuery */: + case 158 /* TypeReference */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // TypeScript type nodes are elided. - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: // TypeScript index signatures are elided. - case 145 /* Decorator */: + case 146 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. - case 147 /* PropertyDeclaration */: - // TypeScript property declarations are elided. - case 150 /* Constructor */: + case 148 /* PropertyDeclaration */: + // TypeScript property declarations are elided. + return undefined; + case 151 /* Constructor */: return visitConstructor(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -45422,7 +48979,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: // This is a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -45433,35 +48990,35 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: // This is a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -45471,33 +49028,33 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -45506,7 +49063,8 @@ var ts; } } function visitSourceFile(node) { - var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + var alwaysStrict = (compilerOptions.alwaysStrict === undefined ? compilerOptions.strict : compilerOptions.alwaysStrict) && + !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict)); } /** @@ -45602,13 +49160,14 @@ var ts; // } var classDeclaration = ts.createClassDeclaration( /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); - var emitFlags = ts.getEmitFlags(node); + /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause)); // To better align with the old emitter, we should not emit a trailing source map // entry if the class has static properties. + var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { emitFlags |= 32 /* NoTrailingSourceMap */; } + ts.setTextRange(classDeclaration, node); ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); return classDeclaration; @@ -45716,12 +49275,18 @@ var ts; // } var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, hasExtendsClause); - var classExpression = ts.createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members, location); + var classExpression = ts.createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members); ts.setOriginalNode(classExpression, node); + ts.setTextRange(classExpression, location); // let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference // or decoratedClassAlias if the class contain self-reference. - var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location); + var statement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declName, + /*type*/ undefined, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression) + ], 1 /* Let */)); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, location); ts.setCommentRange(statement, node); return statement; } @@ -45738,10 +49303,11 @@ var ts; var staticProperties = getInitializedProperties(node, /*isStatic*/ true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84 /* ExtendsKeyword */; })); - var classExpression = ts.setOriginalNode(ts.createClassExpression( + var classExpression = ts.createClassExpression( /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, heritageClauses, members, - /*location*/ node), node); + /*typeParameters*/ undefined, heritageClauses, members); + ts.setOriginalNode(classExpression, node); + ts.setTextRange(classExpression, node); if (staticProperties.length > 0) { var expressions = []; var temp = ts.createTempVariable(hoistVariableDeclaration); @@ -45773,7 +49339,7 @@ var ts; members.push(constructor); } ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement)); - return ts.createNodeArray(members, /*location*/ node.members); + return ts.setTextRange(ts.createNodeArray(members), /*location*/ node.members); } /** * Transforms (or creates) a constructor for a class. @@ -45798,10 +49364,9 @@ var ts; // constructor(${parameters}) { // ${body} // } - return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor( + return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(ts.createConstructor( /*decorators*/ undefined, - /*modifiers*/ undefined, parameters, body, - /*location*/ constructor || node), constructor)); + /*modifiers*/ undefined, parameters, body), constructor || node), constructor)); } /** * Transforms (or creates) the parameters for the constructor of a class with @@ -45883,11 +49448,11 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } // End the lexical environment. - ts.addRange(statements, endLexicalEnvironment()); - return ts.createBlock(ts.createNodeArray(statements, + statements = ts.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + return ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ constructor ? constructor.body.statements : node.members), - /*location*/ constructor ? constructor.body : undefined, - /*multiLine*/ true); + /*multiLine*/ true), + /*location*/ constructor ? constructor.body : undefined); } /** * Adds super call and preceding prologue directives into the list of statements. @@ -45899,13 +49464,13 @@ var ts; if (ctor.body) { var statements = ctor.body.statements; // add prologue directives to the list (if any) - var index = ts.addPrologueDirectives(result, statements, /*ensureUseStrict*/ false, visitor); + var index = ts.addPrologue(result, statements, /*ensureUseStrict*/ false, visitor); if (index === statements.length) { // list contains nothing but prologue directives (or empty) - exit return index; } var statement = statements[index]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -45942,9 +49507,7 @@ var ts; ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */); var localName = ts.getMutableClone(name); ts.setEmitFlags(localName, 1536 /* NoComments */); - return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, - /*location*/ node.name), localName), - /*location*/ ts.moveRangePos(node, -1))); + return ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createThis(), propertyName), node.name), localName)), ts.moveRangePos(node, -1))); } /** * Gets all property declarations with initializers on either the static or instance side of a class. @@ -45978,7 +49541,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member, isStatic) { - return member.kind === 147 /* PropertyDeclaration */ + return member.kind === 148 /* PropertyDeclaration */ && isStatic === ts.hasModifier(member, 32 /* Static */) && member.initializer !== undefined; } @@ -45989,8 +49552,8 @@ var ts; * @param receiver The receiver on which each property should be assigned. */ function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -46005,8 +49568,8 @@ var ts; */ function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { + var property = properties_10[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -46113,12 +49676,12 @@ var ts; */ function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return getAllDecoratorsOfAccessors(node, member); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -46135,10 +49698,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -46179,14 +49743,14 @@ var ts; * @param node The declaration node. * @param allDecorators An object containing all of the decorators for the declaration. */ - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } /** @@ -46233,7 +49797,7 @@ var ts; */ function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -46270,7 +49834,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true); var descriptor = languageVersion > 0 /* ES3 */ - ? member.kind === 147 /* PropertyDeclaration */ + ? member.kind === 148 /* PropertyDeclaration */ ? ts.createVoidZero() : ts.createNull() : undefined; @@ -46296,7 +49860,7 @@ var ts; */ function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -46342,41 +49906,41 @@ var ts; * @param node The declaration node. * @param decoratorExpressions The destination array to which to add new decorator expressions. */ - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*multiLine*/ true))); } } } @@ -46389,10 +49953,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 147 /* PropertyDeclaration */; + return kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 148 /* PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -46402,7 +49966,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -46412,12 +49976,16 @@ var ts; * @param node The node to test. */ function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; + switch (node.kind) { + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return true; + } + return false; } /** * Serializes the type of a node for use with decorator type metadata. @@ -46426,43 +49994,26 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: - case 151 /* GetAccessor */: + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 152 /* GetAccessor */: return serializeTypeNode(node.type); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 150 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); } } - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node) { - if (node && node.kind === 162 /* ArrayType */) { - return node.elementType; - } - else if (node && node.kind === 157 /* TypeReference */) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } /** * Serializes the types of the parameters of a node for use with decorator type metadata. * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -46470,7 +50021,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -46478,7 +50029,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -46487,6 +50038,15 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 152 /* GetAccessor */) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } /** * Serializes the return type of a node for use with decorator type metadata. * @@ -46496,7 +50056,7 @@ var ts; if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } - else if (ts.isAsyncFunctionLike(node)) { + else if (ts.isAsyncFunction(node)) { return ts.createIdentifier("Promise"); } return ts.createVoidZero(); @@ -46525,21 +50085,26 @@ var ts; } switch (node.kind) { case 104 /* VoidKeyword */: + case 138 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 129 /* NeverKeyword */: return ts.createVoidZero(); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return serializeTypeNode(node.type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return ts.createIdentifier("Function"); - case 162 /* ArrayType */: - case 163 /* TupleType */: + case 163 /* ArrayType */: + case 164 /* TupleType */: return ts.createIdentifier("Array"); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: case 121 /* BooleanKeyword */: return ts.createIdentifier("Boolean"); - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return ts.createIdentifier("String"); - case 171 /* LiteralType */: + case 133 /* ObjectKeyword */: + return ts.createIdentifier("Object"); + case 172 /* LiteralType */: switch (node.literal.kind) { case 9 /* StringLiteral */: return ts.createIdentifier("String"); @@ -46555,49 +50120,22 @@ var ts; break; case 132 /* NumberKeyword */: return ts.createIdentifier("Number"); - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return languageVersion < 2 /* ES2015 */ ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return serializeTypeReferenceNode(node); - case 165 /* IntersectionType */: - case 164 /* UnionType */: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - // Non identifier - if (serializedIndividual.kind !== 70 /* Identifier */) { - serializedUnion = undefined; - break; - } - // One of the individual is global object, return immediately - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - // Different types - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - // If we were able to find common type - if (serializedUnion) { - return serializedUnion; - } - } - // Fallthrough - case 160 /* TypeQuery */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 161 /* TypeLiteral */: + case 166 /* IntersectionType */: + case 165 /* UnionType */: + return serializeUnionOrIntersectionType(node); + case 161 /* TypeQuery */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 162 /* TypeLiteral */: case 118 /* AnyKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: break; default: ts.Debug.failBadSyntaxKind(node); @@ -46605,6 +50143,37 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + // If we dont have any other type already set, set the initial type + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + // One of the individual is global object, return immediately + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + // Different types + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + // Initialize the union type + serializedUnion = serializedIndividual; + } + } + // If we were able to find common type, use it + return serializedUnion; + } /** * Serializes a TypeReferenceNode to an appropriate JS constructor value for use with * decorator type metadata. @@ -46654,15 +50223,15 @@ var ts; case 70 /* Identifier */: // Create a clone of the name with a new parent, and treat it as if it were // a source tree node for the purposes of the checker. - var name_31 = ts.getMutableClone(node); - name_31.flags &= ~8 /* Synthesized */; - name_31.original = undefined; - name_31.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8 /* Synthesized */; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_31), ts.createLiteral("undefined")), name_31); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_31; - case 141 /* QualifiedName */: + return name; + case 142 /* QualifiedName */: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -46708,7 +50277,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -46730,7 +50299,7 @@ var ts; hoistVariableDeclaration(generatedName); expression = ts.createAssignment(generatedName, expression); } - return ts.setOriginalNode(ts.createComputedPropertyName(expression, /*location*/ name), name); + return ts.updateComputedPropertyName(name, expression); } else { return name; @@ -46748,7 +50317,7 @@ var ts; function visitHeritageClause(node) { if (node.token === 84 /* ExtendsKeyword */) { var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1); - return ts.createHeritageClause(84 /* ExtendsKeyword */, types, node); + return ts.setTextRange(ts.createHeritageClause(84 /* ExtendsKeyword */, types), node); } return undefined; } @@ -46761,9 +50330,8 @@ var ts; * @param node The ExpressionWithTypeArguments to transform. */ function visitExpressionWithTypeArguments(node) { - var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); - return ts.createExpressionWithTypeArguments( - /*typeArguments*/ undefined, expression, node); + return ts.updateExpressionWithTypeArguments(node, + /*typeArguments*/ undefined, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); } /** * Determines whether to emit a function-like declaration. We should not emit the @@ -46778,7 +50346,7 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - return ts.visitEachChild(node, visitor, context); + return ts.updateConstructor(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), ts.visitNodes(node.modifiers, visitor, ts.isModifier), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context)); } /** * Visits a method declaration of a class. @@ -46795,7 +50363,8 @@ var ts; return undefined; } var updated = ts.updateMethod(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), + /*questionToken*/ undefined, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); if (updated !== node) { @@ -46877,7 +50446,7 @@ var ts; return ts.createNotEmittedStatement(node); } var updated = ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { @@ -46896,12 +50465,12 @@ var ts; * @param node The function expression node. */ function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { + if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createOmittedExpression(); } - var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated; } /** @@ -46933,11 +50502,11 @@ var ts; /*decorators*/ undefined, /*modifiers*/ undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), /*questionToken*/ undefined, - /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), - /*location*/ ts.moveRangePastModifiers(node)); + /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); // While we emit the source map for the node after skipping decorators and modifiers, // we need to emit the comments for the original range. ts.setOriginalNode(parameter, node); + ts.setTextRange(parameter, ts.moveRangePastModifiers(node)); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */); @@ -46956,8 +50525,7 @@ var ts; // elide statement if there are no initialized variables. return undefined; } - return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), - /*location*/ node); + return ts.setTextRange(ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))), node); } else { return ts.visitEachChild(node, visitor, context); @@ -46970,7 +50538,7 @@ var ts; /*needsValue*/ false, createNamespaceExportExpression); } else { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression)), /*location*/ node); } } @@ -46996,13 +50564,13 @@ var ts; // code if the casted expression has a lower precedence than the rest of the // expression. // + // To preserve comments, we return a "PartiallyEmittedExpression" here which will + // preserve the position information of the original expression. + // // Due to the auto-parenthesization rules used by the visitor and factory functions // we can safely elide the parentheses here, as a new synthetic // ParenthesizedExpression will be inserted if we remove parentheses too // aggressively. - // - // To preserve comments, we return a "PartiallyEmittedExpression" here which will - // preserve the position information of the original expression. return ts.createPartiallyEmittedExpression(expression, node); } return ts.visitEachChild(node, visitor, context); @@ -47084,9 +50652,9 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], /*type*/ undefined, transformEnumBody(node, containerName)), - /*typeArguments*/ undefined, [moduleArg]), - /*location*/ node); + /*typeArguments*/ undefined, [moduleArg])); ts.setOriginalNode(enumStatement, node); + ts.setTextRange(enumStatement, node); ts.setEmitFlags(enumStatement, emitFlags); statements.push(enumStatement); // Add a DeclarationMarker for the enum to preserve trailing comments and mark @@ -47107,8 +50675,7 @@ var ts; ts.addRange(statements, ts.map(node.members, transformEnumMember)); ts.addRange(statements, endLexicalEnvironment()); currentNamespaceContainerName = savedCurrentNamespaceLocalName; - return ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), - /*location*/ undefined, + return ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ node.members), /*multiLine*/ true); } /** @@ -47121,9 +50688,7 @@ var ts; // we pass false as 'generateNameForComputedPropertyName' for a backward compatibility purposes // old emitter always generate 'expression' part of the name as-is. var name = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ false); - return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, - /*location*/ member), - /*location*/ member); + return ts.setTextRange(ts.createStatement(ts.setTextRange(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name), member)), member); } /** * Transforms the value of an enum member. @@ -47176,8 +50741,8 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } @@ -47187,9 +50752,9 @@ var ts; */ function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_32 = node.symbol && node.symbol.name; - if (name_32) { - return currentScopeFirstDeclarationsOfName[name_32] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -47206,7 +50771,7 @@ var ts; recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 229 /* EnumDeclaration */) { + if (node.kind === 231 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -47298,9 +50863,9 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], /*type*/ undefined, transformModuleBody(node, containerName)), - /*typeArguments*/ undefined, [moduleArg]), - /*location*/ node); + /*typeArguments*/ undefined, [moduleArg])); ts.setOriginalNode(moduleStatement, node); + ts.setTextRange(moduleStatement, node); ts.setEmitFlags(moduleStatement, emitFlags); statements.push(moduleStatement); // Add a DeclarationMarker for the namespace to preserve trailing comments and mark @@ -47325,8 +50890,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231 /* ModuleBlock */) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 233 /* ModuleBlock */) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -47347,10 +50912,10 @@ var ts; currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - var block = ts.createBlock(ts.createNodeArray(statements, + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ statementsLocation), - /*location*/ blockLocation, /*multiLine*/ true); + ts.setTextRange(block, blockLocation); // namespace hello.hi.world { // function foo() {} // @@ -47371,13 +50936,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (body.kind !== 231 /* ModuleBlock */) { + if (body.kind !== 233 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -47394,7 +50959,7 @@ var ts; return node; } // Elide the declaration if the import clause was elided. - var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, /*optional*/ true); + var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause); return importClause ? ts.updateImportDeclaration(node, /*decorators*/ undefined, @@ -47409,7 +50974,7 @@ var ts; function visitImportClause(node) { // Elide the import clause if we elide both its name and its named bindings. var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined; - var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, /*optional*/ true); + var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings); return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } /** @@ -47418,7 +50983,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 237 /* NamespaceImport */) { + if (node.kind === 239 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -47465,7 +51030,7 @@ var ts; return undefined; } // Elide the export declaration if all of its named exports are elided. - var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, /*optional*/ true); + var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports); return exportClause ? ts.updateExportDeclaration(node, /*decorators*/ undefined, @@ -47525,10 +51090,10 @@ var ts; if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { // export var ${name} = ${moduleReference}; // var ${name} = ${moduleReference}; - return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ + return ts.setOriginalNode(ts.setTextRange(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, /*type*/ undefined, moduleReference), node) - ]), node), node); + ])), node), node); } else { // exports.${name} = ${moduleReference}; @@ -47573,7 +51138,7 @@ var ts; * Creates a statement for the provided expression. This is used in calls to `map`. */ function expressionToStatement(expression) { - return ts.createStatement(expression, /*location*/ undefined); + return ts.createStatement(expression); } function addExportMemberAssignment(statements, node) { var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), ts.getLocalName(node)); @@ -47583,10 +51148,10 @@ var ts; statements.push(statement); } function createNamespaceExport(exportName, exportValue, location) { - return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue), location); + return ts.setTextRange(ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue)), location); } function createNamespaceExportExpression(exportName, exportValue, location) { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location); } function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { return ts.getNamespaceMemberName(currentNamespaceContainerName, name, /*allowComments*/ false, /*allowSourceMaps*/ true); @@ -47614,7 +51179,7 @@ var ts; function getClassAliasIfNeeded(node) { if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) { enableSubstitutionForClassAliases(); - var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default"); + var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.unescapeIdentifier(node.name.text) : "default"); classAliases[ts.getOriginalNodeId(node)] = classAlias; hoistVariableDeclaration(classAlias); return classAlias; @@ -47641,7 +51206,7 @@ var ts; // substitute class names inside of a class declaration. context.enableSubstitution(70 /* Identifier */); // Keep track of class aliases. - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { @@ -47650,44 +51215,49 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(70 /* Identifier */); - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); + context.enableSubstitution(261 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(230 /* ModuleDeclaration */); + context.enableEmitNotification(232 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 232 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 231 /* EnumDeclaration */; } /** * Hook for node emit. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emit A callback used to emit the node in the printer. */ - function onEmitNode(emitContext, node, emitCallback) { + function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; + var savedCurrentSourceFile = currentSourceFile; + if (ts.isSourceFile(node)) { + currentSourceFile = node; + } if (enabledSubstitutions & 2 /* NamespaceExports */ && isTransformedModuleDeclaration(node)) { applicableSubstitutions |= 2 /* NamespaceExports */; } if (enabledSubstitutions & 8 /* NonQualifiedEnumMembers */ && isTransformedEnumDeclaration(node)) { applicableSubstitutions |= 8 /* NonQualifiedEnumMembers */; } - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); applicableSubstitutions = savedApplicableSubstitutions; + currentSourceFile = savedCurrentSourceFile; } /** * Hooks node substitutions. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */) { return substituteExpression(node); } else if (ts.isShorthandPropertyAssignment(node)) { @@ -47697,16 +51267,16 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2 /* NamespaceExports */) { - var name_33 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_33); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { // A shorthand property with an assignment initializer is probably part of a // destructuring assignment if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_33, initializer, /*location*/ node); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); } - return ts.createPropertyAssignment(name_33, exportedName, /*location*/ node); + return ts.setTextRange(ts.createPropertyAssignment(name, exportedName), node); } } return node; @@ -47715,9 +51285,9 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -47755,11 +51325,12 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 261 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 230 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 229 /* EnumDeclaration */); + if (container && container.kind !== 264 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 232 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 231 /* EnumDeclaration */); if (substitute) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), + /*location*/ node); } } } @@ -47774,16 +51345,15 @@ var ts; function substituteConstantValue(node) { var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { + // track the constant value on the node for the printer in needsDotDotForPropertyAccess + ts.setConstantValue(node, constantValue); var substitute = ts.createLiteral(constantValue); - ts.setSourceMapRange(substitute, node); - ts.setCommentRange(substitute, node); if (!compilerOptions.removeComments) { var propertyName = ts.isPropertyAccessExpression(node) ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - substitute.trailingComment = " " + propertyName + " "; + ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + propertyName + " "); } - ts.setConstantValue(node, constantValue); return substitute; } return node; @@ -47798,19 +51368,33 @@ var ts; } } ts.transformTypeScript = transformTypeScript; - var paramHelper = { - name: "typescript:param", + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*multiLine*/ true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + context.requestEmitHelper(decorateHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"), + /*typeArguments*/ undefined, argumentsArray), location); + } + var decorateHelper = { + name: "typescript:decorate", scoped: false, - priority: 4, - text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" }; - function createParamHelper(context, expression, parameterOffset, location) { - context.requestEmitHelper(paramHelper); - return ts.createCall(ts.getHelperName("__param"), + function createMetadataHelper(context, metadataKey, metadataValue) { + context.requestEmitHelper(metadataHelper); + return ts.createCall(ts.getHelperName("__metadata"), /*typeArguments*/ undefined, [ - ts.createLiteral(parameterOffset), - expression - ], location); + ts.createLiteral(metadataKey), + metadataValue + ]); } var metadataHelper = { name: "typescript:metadata", @@ -47818,41 +51402,391 @@ var ts; priority: 3, text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" }; - function createMetadataHelper(context, metadataKey, metadataValue) { - context.requestEmitHelper(metadataHelper); - return ts.createCall(ts.getHelperName("__metadata"), + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__param"), /*typeArguments*/ undefined, [ - ts.createLiteral(metadataKey), - metadataValue - ]); + ts.createLiteral(parameterOffset), + expression + ]), location); } - var decorateHelper = { - name: "typescript:decorate", + var paramHelper = { + name: "typescript:param", scoped: false, - priority: 2, - text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" }; - function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { - context.requestEmitHelper(decorateHelper); - var argumentsArray = []; - argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); +})(ts || (ts = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + var ES2017SubstitutionFlags; + (function (ES2017SubstitutionFlags) { + /** Enables substitutions for async methods with `super` calls. */ + ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); + function transformES2017(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + // These variables contain state that changes as we descend into the tree. + var currentSourceFile; + /** + * Keeps track of whether expression substitution has been enabled for specific edge cases. + * They are persisted between each SourceFile transformation and should not be reset. + */ + var enabledSubstitutions; + /** + * This keeps track of containers where `super` is valid, for use with + * just-in-time substitution for `super` expressions inside of async methods. + */ + var enclosingSuperContainerFlags = 0; + // Save the previous transformation hooks. + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + // Set new transformation hooks. + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; + } + function visitor(node) { + if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) { + return node; + } + switch (node.kind) { + case 119 /* AsyncKeyword */: + // ES2017 async modifier should be elided for targets < ES2017 + return undefined; + case 190 /* AwaitExpression */: + return visitAwaitExpression(node); + case 150 /* MethodDeclaration */: + return visitMethodDeclaration(node); + case 227 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 185 /* FunctionExpression */: + return visitFunctionExpression(node); + case 186 /* ArrowFunction */: + return visitArrowFunction(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + /** + * Visits an AwaitExpression node. + * + * This function will be called any time a ES2017 await expression is encountered. + * + * @param node The node to visit. + */ + function visitAwaitExpression(node) { + return ts.setOriginalNode(ts.setTextRange(ts.createYield( + /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); + } + /** + * Visits a MethodDeclaration node. + * + * This function will be called when one of the following conditions are met: + * - The node is marked as async + * + * @param node The node to visit. + */ + function visitMethodDeclaration(node) { + return ts.updateMethod(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, + /*questionToken*/ undefined, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + /** + * Visits a FunctionDeclaration node. + * + * This function will be called when one of the following conditions are met: + * - The node is marked async + * + * @param node The node to visit. + */ + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + /** + * Visits a FunctionExpression node. + * + * This function will be called when one of the following conditions are met: + * - The node is marked async + * + * @param node The node to visit. + */ + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + /** + * Visits an ArrowFunction. + * + * This function will be called when one of the following conditions are met: + * - The node is marked async + * + * @param node The node to visit. + */ + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); + var original = ts.getOriginalNode(node, ts.isFunctionLike); + var nodeType = original.type; + var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; + var isArrowFunction = node.kind === 186 /* ArrowFunction */; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; + // An async function is emit as an outer function that calls an inner + // generator function. To preserve lexical bindings, we pass the current + // `this` and `arguments` objects to `__awaiter`. The generator function + // passed to `__awaiter` is executed inside of the callback to the + // promise constructor. + if (!isArrowFunction) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.createBlock(statements, /*multiLine*/ true); + ts.setTextRange(block, node.body); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + if (languageVersion >= 2 /* ES2015 */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; + } + else { + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(ts.concatenate(block.statements, declarations)), block.statements)); + } + return expression; + } + } + function transformFunctionBodyWorker(body, start) { + if (ts.isBlock(body)) { + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); + } + else { + startLexicalEnvironment(); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); + var declarations = endLexicalEnvironment(); + return ts.updateBlock(visited, ts.setTextRange(ts.createNodeArray(ts.concatenate(visited.statements, declarations)), visited.statements)); + } + } + function getPromiseConstructor(type) { + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; + } + } + return undefined; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { + enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; + // We need to enable substitutions for call, property access, and element access + // if we need to rewrite super calls. + context.enableSubstitution(180 /* CallExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); + // We need to be notified when entering and exiting declarations that bind super. + context.enableEmitNotification(228 /* ClassDeclaration */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(151 /* Constructor */); + } + } + /** + * Hook for node emit. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(hint, node, emitCallback) { + // If we need to support substitutions for `super` in an async method, + // we should track it here. + if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + /** + * Hooks node substitutions. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */ && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178 /* PropertyAccessExpression */: + return substitutePropertyAccessExpression(node); + case 179 /* ElementAccessExpression */: + return substituteElementAccessExpression(node); + case 180 /* CallExpression */: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), + /*typeArguments*/ undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 /* ClassDeclaration */ + || kind === 151 /* Constructor */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), location); } } - return ts.createCall(ts.getHelperName("__decorate"), /*typeArguments*/ undefined, argumentsArray, location); } + ts.transformES2017 = transformES2017; + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression( + /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, body); + // Mark this node as originally an async function + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; + return ts.createCall(ts.getHelperName("__awaiter"), + /*typeArguments*/ undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + ts.asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];\n " + }; + ts.advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);\n " + }; })(ts || (ts = {})); /// /// +/// /*@internal*/ var ts; (function (ts) { + var ESNextSubstitutionFlags; + (function (ESNextSubstitutionFlags) { + /** Enables substitutions for async methods with `super` calls. */ + ESNextSubstitutionFlags[ESNextSubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ESNextSubstitutionFlags || (ESNextSubstitutionFlags = {})); function transformESNext(context) { - var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var enabledSubstitutions; + var enclosingFunctionFlags; + var enclosingSuperContainerFlags = 0; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { @@ -47868,53 +51802,95 @@ var ts; function visitorNoDestructuringValue(node) { return visitorWorker(node, /*noDestructuringValue*/ true); } + function visitorNoAsyncModifier(node) { + if (node.kind === 119 /* AsyncKeyword */) { + return undefined; + } + return node; + } function visitorWorker(node, noDestructuringValue) { if ((node.transformFlags & 8 /* ContainsESNext */) === 0) { return node; } switch (node.kind) { - case 176 /* ObjectLiteralExpression */: + case 190 /* AwaitExpression */: + return visitAwaitExpression(node); + case 196 /* YieldExpression */: + return visitYieldExpression(node); + case 221 /* LabeledStatement */: + return visitLabeledStatement(node); + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 211 /* ForStatement */: + case 215 /* ForOfStatement */: + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); + case 213 /* ForStatement */: return visitForStatement(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitVoidExpression(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return visitConstructorDeclaration(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); } } + function visitAwaitExpression(node) { + if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.setOriginalNode(ts.setTextRange(ts.createYield( + /*asteriskToken*/ undefined, ts.createArrayLiteral([ts.createLiteral("await"), expression])), + /*location*/ node), node); + } + return ts.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.updateYield(node, node.asteriskToken, node.asteriskToken + ? createAsyncDelegatorHelper(context, expression, expression) + : ts.createArrayLiteral(expression + ? [ts.createLiteral("yield"), expression] + : [ts.createLiteral("yield")])); + } + return ts.visitEachChild(node, visitor, context); + } + function visitLabeledStatement(node) { + if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) { + var statement = ts.unwrapInnermostStatementOfLabel(node); + if (statement.kind === 215 /* ForOfStatement */ && statement.awaitModifier) { + return visitForOfStatement(statement, node); + } + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), node); + } + return ts.visitEachChild(node, visitor, context); + } function chunkObjectLiteralElements(elements) { var chunkObject; var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259 /* SpreadAssignment */) { + for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { + var e = elements_4[_i]; + if (e.kind === 262 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -47926,7 +51902,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257 /* PropertyAssignment */) { + if (e.kind === 260 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -47948,7 +51924,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 177 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -47998,41 +51974,101 @@ var ts; * * @param node A ForOfStatement. */ - function visitForOfStatement(node) { - var leadingStatements; - var temp; - var initializer = ts.skipParentheses(node.initializer); - if (initializer.transformFlags & 1048576 /* ContainsObjectRest */) { - if (ts.isVariableDeclarationList(initializer)) { - temp = ts.createTempVariable(/*recordTempVariable*/ undefined); - var firstDeclaration = ts.firstOrUndefined(initializer.declarations); - var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1 /* ObjectRest */, temp, - /*doNotRecordTempVariablesInLine*/ false, - /*skipInitializer*/ true); - if (ts.some(declarations)) { - var statement = ts.createVariableStatement( - /*modifiers*/ undefined, ts.updateVariableDeclarationList(initializer, declarations), - /*location*/ initializer); - leadingStatements = ts.append(leadingStatements, statement); - } - } - else if (ts.isAssignmentPattern(initializer)) { - temp = ts.createTempVariable(/*recordTempVariable*/ undefined); - var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, /*location*/ node.initializer)), visitor, context, 1 /* ObjectRest */); - leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, /*location*/ node.initializer)); - } + function visitForOfStatement(node, outermostLabeledStatement) { + if (node.initializer.transformFlags & 1048576 /* ContainsObjectRest */) { + node = transformForOfStatementWithObjectRest(node); } - if (temp) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - var block = ts.isBlock(statement) - ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) - : ts.createBlock(ts.append(leadingStatements, statement), statement, /*multiLine*/ true); - return ts.updateForOf(node, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(temp, /*type*/ undefined, /*initializer*/ undefined, node.initializer) - ], node.initializer, 1 /* Let */), expression, block); + if (node.awaitModifier) { + return transformForAwaitOfStatement(node, outermostLabeledStatement); } - return ts.visitEachChild(node, visitor, context); + else { + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement); + } + } + function transformForOfStatementWithObjectRest(node) { + var initializerWithoutParens = ts.skipParentheses(node.initializer); + if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) { + var bodyLocation = void 0; + var statementsLocation = void 0; + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var statements = [ts.createForOfBindingStatement(initializerWithoutParens, temp)]; + if (ts.isBlock(node.statement)) { + ts.addRange(statements, node.statement.statements); + bodyLocation = node.statement; + statementsLocation = node.statement.statements; + } + return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) + ], 1 /* Let */), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), + /*multiLine*/ true), bodyLocation)); + } + return node; + } + function convertForOfStatementHead(node, boundValue) { + var binding = ts.createForOfBindingStatement(node.initializer, boundValue); + var bodyLocation; + var statementsLocation; + var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), + /*multiLine*/ true), bodyLocation), 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); + } + function transformForAwaitOfStatement(node, outermostLabeledStatement) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(/*recordTempVariable*/ undefined); + var values = createAsyncValuesHelper(context, expression, /*location*/ node.expression); + var next = ts.createYield( + /*asteriskToken*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []) + ]) + : ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, [])); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor( + /*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + ts.createVariableDeclaration(result, /*type*/ undefined, next) + ]), node.expression), 1048576 /* NoHoisting */), + /*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")), + /*incrementor*/ ts.createAssignment(result, next), + /*statement*/ convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"))), + /*location*/ node), 256 /* NoTokenTrailingSourceMaps */); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1 /* SingleLine */)), ts.createBlock([ + ts.createTry( + /*tryBlock*/ ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createYield( + /*asteriskToken*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createFunctionCall(returnMethod, iterator, []) + ]) + : ts.createFunctionCall(returnMethod, iterator, [])))), 1 /* SingleLine */) + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1 /* SingleLine */) + ]), 1 /* SingleLine */)) + ])); } function visitParameter(node) { if (node.transformFlags & 1048576 /* ContainsObjectRest */) { @@ -48041,48 +52077,137 @@ var ts; return ts.updateParameter(node, /*decorators*/ undefined, /*modifiers*/ undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), + /*questionToken*/ undefined, /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); } return ts.visitEachChild(node, visitor, context); } function visitConstructorDeclaration(node) { - return ts.updateConstructor(node, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0 /* Normal */; + var updated = ts.updateConstructor(node, /*decorators*/ undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitGetAccessorDeclaration(node) { - return ts.updateGetAccessor(node, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0 /* Normal */; + var updated = ts.updateGetAccessor(node, /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitSetAccessorDeclaration(node) { - return ts.updateSetAccessor(node, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0 /* Normal */; + var updated = ts.updateSetAccessor(node, /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitMethodDeclaration(node) { - return ts.updateMethod(node, - /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateMethod(node, + /*decorators*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 /* Async */ + ? undefined + : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(/*questionToken*/ undefined, visitor, ts.isToken), /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node)); + /*type*/ undefined, enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, node.modifiers, node.name, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 /* Async */ + ? undefined + : node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node)); + /*type*/ undefined, enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitArrowFunction(node) { - return ts.updateArrowFunction(node, node.modifiers, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateArrowFunction(node, node.modifiers, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, node.modifiers, node.name, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionExpression(node, enclosingFunctionFlags & 1 /* Generator */ + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 /* Async */ + ? undefined + : node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node)); + /*type*/ undefined, enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function transformAsyncGeneratorFunctionBody(node) { + resumeLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); + appendObjectRestAssignmentsIfNeeded(statements, node); + statements.push(ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression( + /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), node.name && ts.getGeneratedNameForNode(node.name), + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.updateBlock(node.body, statements); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + if (languageVersion >= 2 /* ES2015 */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; } function transformFunctionBody(node) { resumeLexicalEnvironment(); - var leadingStatements; + var statementOffset = 0; + var statements = []; + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologue(statements, body.statements, /*ensureUseStrict*/ false, visitor); + } + ts.addRange(statements, appendObjectRestAssignmentsIfNeeded(/*statements*/ undefined, node)); + var trailingStatements = endLexicalEnvironment(); + if (statementOffset > 0 || ts.some(statements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, /*multiLine*/ true); + ts.addRange(statements, block.statements.slice(statementOffset)); + ts.addRange(statements, trailingStatements); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(statements), block.statements)); + } + return body; + } + function appendObjectRestAssignmentsIfNeeded(statements, node) { for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; if (parameter.transformFlags & 1048576 /* ContainsObjectRest */) { @@ -48094,17 +52219,116 @@ var ts; var statement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList(declarations)); ts.setEmitFlags(statement, 524288 /* CustomPrologue */); - leadingStatements = ts.append(leadingStatements, statement); + statements = ts.append(statements, statement); } } } - var body = ts.visitNode(node.body, visitor, ts.isConciseBody); - var trailingStatements = endLexicalEnvironment(); - if (ts.some(leadingStatements) || ts.some(trailingStatements)) { - var block = ts.convertToFunctionBody(body, /*multiLine*/ true); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + return statements; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { + enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; + // We need to enable substitutions for call, property access, and element access + // if we need to rewrite super calls. + context.enableSubstitution(180 /* CallExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); + // We need to be notified when entering and exiting declarations that bind super. + context.enableEmitNotification(228 /* ClassDeclaration */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(151 /* Constructor */); + } + } + /** + * Called by the printer just before a node is printed. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to be printed. + * @param emitCallback The callback used to emit the node. + */ + function onEmitNode(hint, node, emitCallback) { + // If we need to support substitutions for `super` in an async method, + // we should track it here. + if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + /** + * Hooks node substitutions. + * + * @param hint The context for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */ && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178 /* PropertyAccessExpression */: + return substitutePropertyAccessExpression(node); + case 179 /* ElementAccessExpression */: + return substituteElementAccessExpression(node); + case 180 /* CallExpression */: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), + /*typeArguments*/ undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 /* ClassDeclaration */ + || kind === 151 /* Constructor */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), location); } - return body; } } ts.transformESNext = transformESNext; @@ -48115,11 +52339,51 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2 /* ES2015 */) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), + /*typeArguments*/ undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), /*typeArguments*/ undefined, attributesSegments); } ts.createAssignHelper = createAssignHelper; + var asyncGeneratorHelper = { + name: "typescript:asyncGenerator", + scoped: false, + text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), q = [], c, i;\n return i = { next: verb(\"next\"), \"throw\": verb(\"throw\"), \"return\": verb(\"return\") }, i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }\n function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }\n function step(r) { r.done ? settle(c[2], r) : Promise.resolve(r.value[1]).then(r.value[0] === \"yield\" ? _yield : r.value[0] === \"delegate\" ? delegate : fulfill, reject); }\n function _yield(value) { settle(c[2], { value: value, done: false }); }\n function delegate(r) { step(r.done ? r : { value: [\"yield\", r.value], done: false }); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { c = void 0, f(v), next(); }\n };\n " + }; + function createAsyncGeneratorHelper(context, generatorFunc) { + context.requestEmitHelper(asyncGeneratorHelper); + // Mark this node as originally an async function + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; + return ts.createCall(ts.getHelperName("__asyncGenerator"), + /*typeArguments*/ undefined, [ + ts.createThis(), + ts.createIdentifier("arguments"), + generatorFunc + ]); + } + var asyncDelegator = { + name: "typescript:asyncDelegator", + scoped: false, + text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i = { next: verb(\"next\"), \"throw\": verb(\"throw\", function (e) { throw e; }), \"return\": verb(\"return\", function (v) { return { value: v, done: true }; }) };\n return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { return function (v) { return { value: [\"delegate\", (o[n] || f).call(o, v)], done: false }; }; }\n };\n " + }; + function createAsyncDelegatorHelper(context, expression, location) { + context.requestEmitHelper(asyncDelegator); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"), + /*typeArguments*/ undefined, [expression]), location); + } + var asyncValues = { + name: "typescript:asyncValues", + scoped: false, + text: "\n var __asyncValues = (this && this.__asyncIterator) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator];\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\n };\n " + }; + function createAsyncValuesHelper(context, expression, location) { + context.requestEmitHelper(asyncValues); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"), + /*typeArguments*/ undefined, [expression]), location); + } })(ts || (ts = {})); /// /// @@ -48129,7 +52393,6 @@ var ts; (function (ts) { function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); - var currentSourceFile; return transformSourceFile; /** * Transform JSX-specific syntax in a SourceFile. @@ -48140,10 +52403,8 @@ var ts; if (ts.isDeclarationFile(node)) { return node; } - currentSourceFile = node; var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; return visited; } function visitor(node) { @@ -48156,11 +52417,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -48170,11 +52431,11 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return visitJsxExpression(node); - case 246 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); @@ -48190,7 +52451,7 @@ var ts; function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; - var attrs = node.attributes; + var attrs = node.attributes.properties; if (attrs.length === 0) { // When there are no attributes, React wants "null" objectProperties = ts.createNull(); @@ -48229,13 +52490,16 @@ var ts; } function transformJsxAttributeInitializer(node) { if (node === undefined) { - return ts.createLiteral(true); + return ts.createTrue(); } else if (node.kind === 9 /* StringLiteral */) { var decoded = tryDecodeEntities(node.text); - return decoded ? ts.createLiteral(decoded, /*location*/ node) : node; + return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 252 /* JsxExpression */) { + else if (node.kind === 255 /* JsxExpression */) { + if (node.expression === undefined) { + return ts.createTrue(); + } return visitJsxExpression(node); } else { @@ -48243,54 +52507,61 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, /*includeTrivia*/ true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, /*includeTrivia*/ true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + /** + * JSX trims whitespace at the end and beginning of lines, except that the + * start/end of a tag is considered a start/end of a line only if that line is + * on the same line as the closing tag. See examples in + * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model + * + * An equivalent algorithm would be: + * - If there is only one line, return it. + * - If there is only whitespace (but multiple lines), return `undefined`. + * - Split the text into lines. + * - 'trimRight' the first line, 'trimLeft' the last line, 'trim' middle lines. + * - Decode entities on each line (individually). + * - Remove empty lines and join the rest with " ". + */ + function fixupWhitespaceAndDecodeEntities(text) { + var acc; + // First non-whitespace character on this line. var firstNonWhitespace = 0; + // Last non-whitespace character on this line. var lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in - // tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + // These initial values are special because the first line is: + // firstNonWhitespace = 0 to indicate that we want leading whitsepace, + // but lastNonWhitespace = -1 as a special flag to indicate that we *don't* include the line if it's all whitespace. for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); + // If we've seen any non-whitespace characters on this line, add the 'trim' of the line. + // (lastNonWhitespace === -1 is a special flag to detect whether the first line is all whitespace.) + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } + // Reset firstNonWhitespace for the next line. + // Don't bother to reset lastNonWhitespace because we ignore it if firstNonWhitespace = -1. firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - /** - * Aggregates two expressions by interpolating them with a whitespace literal. - */ - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + // We do not escape the string here as that is handled by the printer + // when it emits the literal. We do, however, need to decode JSX entities. + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } /** * Replace entities like " ", "{", and "�" with the characters they encode. @@ -48305,7 +52576,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); // If this is not a valid entity, then just use `match` (replace it with itself, i.e. don't replace) return ch ? String.fromCharCode(ch) : match; } @@ -48317,16 +52588,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246 /* JsxElement */) { + if (node.kind === 248 /* JsxElement */) { return getTagName(node.openingElement); } else { - var name_34 = node.tagName; - if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) { - return ts.createLiteral(name_34.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_34); + return ts.createExpressionFromEntityName(name); } } } @@ -48349,7 +52620,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -48609,375 +52880,6 @@ var ts; /// /*@internal*/ var ts; -(function (ts) { - var ES2017SubstitutionFlags; - (function (ES2017SubstitutionFlags) { - /** Enables substitutions for async methods with `super` calls. */ - ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; - })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); - function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; - var resolver = context.getEmitResolver(); - var compilerOptions = context.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - // These variables contain state that changes as we descend into the tree. - var currentSourceFile; - /** - * Keeps track of whether expression substitution has been enabled for specific edge cases. - * They are persisted between each SourceFile transformation and should not be reset. - */ - var enabledSubstitutions; - /** - * This keeps track of containers where `super` is valid, for use with - * just-in-time substitution for `super` expressions inside of async methods. - */ - var currentSuperContainer; - // Save the previous transformation hooks. - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - // Set new transformation hooks. - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; - } - currentSourceFile = node; - var visited = ts.visitEachChild(node, visitor, context); - ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; - return visited; - } - function visitor(node) { - if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) { - return node; - } - switch (node.kind) { - case 119 /* AsyncKeyword */: - // ES2017 async modifier should be elided for targets < ES2017 - return undefined; - case 189 /* AwaitExpression */: - // ES2017 'await' expressions must be transformed for targets < ES2017. - return visitAwaitExpression(node); - case 149 /* MethodDeclaration */: - // ES2017 method declarations may be 'async' - return visitMethodDeclaration(node); - case 225 /* FunctionDeclaration */: - // ES2017 function declarations may be 'async' - return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: - // ES2017 function expressions may be 'async' - return visitFunctionExpression(node); - case 185 /* ArrowFunction */: - // ES2017 arrow functions may be 'async' - return visitArrowFunction(node); - default: - return ts.visitEachChild(node, visitor, context); - } - } - /** - * Visits an AwaitExpression node. - * - * This function will be called any time a ES2017 await expression is encountered. - * - * @param node The node to visit. - */ - function visitAwaitExpression(node) { - return ts.setOriginalNode(ts.createYield( - /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression), - /*location*/ node), node); - } - /** - * Visits a MethodDeclaration node. - * - * This function will be called when one of the following conditions are met: - * - The node is marked as async - * - * @param node The node to visit. - */ - function visitMethodDeclaration(node) { - return ts.updateMethod(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - /** - * Visits a FunctionDeclaration node. - * - * This function will be called when one of the following conditions are met: - * - The node is marked async - * - * @param node The node to visit. - */ - function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - /** - * Visits a FunctionExpression node. - * - * This function will be called when one of the following conditions are met: - * - The node is marked async - * - * @param node The node to visit. - */ - function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { - return ts.createOmittedExpression(); - } - return ts.updateFunctionExpression(node, - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - /** - * Visits an ArrowFunction. - * - * This function will be called when one of the following conditions are met: - * - The node is marked async - * - * @param node The node to visit. - */ - function visitArrowFunction(node) { - return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function transformAsyncFunctionBody(node) { - resumeLexicalEnvironment(); - var original = ts.getOriginalNode(node, ts.isFunctionLike); - var nodeType = original.type; - var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185 /* ArrowFunction */; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; - // An async function is emit as an outer function that calls an inner - // generator function. To preserve lexical bindings, we pass the current - // `this` and `arguments` objects to `__awaiter`. The generator function - // passed to `__awaiter` is executed inside of the callback to the - // promise constructor. - if (!isArrowFunction) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); - statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); - ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(statements, /*location*/ node.body, /*multiLine*/ true); - // Minor optimization, emit `_super` helper to capture `super` access in an arrow. - // This step isn't needed if we eventually transform this to ES5. - if (languageVersion >= 2 /* ES2015 */) { - if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, advancedAsyncSuperHelper); - } - else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, asyncSuperHelper); - } - } - return block; - } - else { - var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); - var declarations = endLexicalEnvironment(); - if (ts.some(declarations)) { - var block = ts.convertToFunctionBody(expression); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); - } - return expression; - } - } - function transformFunctionBodyWorker(body, start) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); - } - else { - startLexicalEnvironment(); - var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); - var declarations = endLexicalEnvironment(); - return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); - } - } - function getPromiseConstructor(type) { - var typeName = type && ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } - } - return undefined; - } - function enableSubstitutionForAsyncMethodsWithSuper() { - if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { - enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; - // We need to enable substitutions for call, property access, and element access - // if we need to rewrite super calls. - context.enableSubstitution(179 /* CallExpression */); - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); - // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(226 /* ClassDeclaration */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(150 /* Constructor */); - } - } - function substituteExpression(node) { - switch (node.kind) { - case 177 /* PropertyAccessExpression */: - return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: - return substituteElementAccessExpression(node); - case 179 /* CallExpression */: - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) { - return substituteCallExpression(node); - } - break; - } - return node; - } - function substitutePropertyAccessExpression(node) { - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node); - } - } - return node; - } - function substituteElementAccessExpression(node) { - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node); - } - } - return node; - } - function substituteCallExpression(node) { - var expression = node.expression; - if (ts.isSuperProperty(expression)) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - var argumentExpression = ts.isPropertyAccessExpression(expression) - ? substitutePropertyAccessExpression(expression) - : substituteElementAccessExpression(expression); - return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), - /*typeArguments*/ undefined, [ - ts.createThis() - ].concat(node.arguments)); - } - } - return node; - } - function isSuperContainer(node) { - var kind = node.kind; - return kind === 226 /* ClassDeclaration */ - || kind === 150 /* Constructor */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; - } - /** - * Hook for node emit. - * - * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. - */ - function onEmitNode(emitContext, node, emitCallback) { - // If we need to support substitutions for `super` in an async method, - // we should track it here. - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var savedCurrentSuperContainer = currentSuperContainer; - currentSuperContainer = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSuperContainer = savedCurrentSuperContainer; - } - else { - previousOnEmitNode(emitContext, node, emitCallback); - } - } - /** - * Hooks node substitutions. - * - * @param node The node to substitute. - * @param isExpression A value indicating whether the node is to be used in an expression - * position. - */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { - return substituteExpression(node); - } - return node; - } - function createSuperAccessInAsyncMethod(argumentExpression, flags, location) { - if (flags & 4096 /* AsyncMethodWithSuperBinding */) { - return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), - /*typeArguments*/ undefined, [argumentExpression]), "value", location); - } - else { - return ts.createCall(ts.createIdentifier("_super"), - /*typeArguments*/ undefined, [argumentExpression], location); - } - } - function getSuperContainerAsyncMethodFlags() { - return currentSuperContainer !== undefined - && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */); - } - } - ts.transformES2017 = transformES2017; - function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { - context.requestEmitHelper(awaiterHelper); - var generatorFunc = ts.createFunctionExpression( - /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), - /*name*/ undefined, - /*typeParameters*/ undefined, - /*parameters*/ [], - /*type*/ undefined, body); - // Mark this node as originally an async function - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; - return ts.createCall(ts.getHelperName("__awaiter"), - /*typeArguments*/ undefined, [ - ts.createThis(), - hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), - promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), - generatorFunc - ]); - } - var awaiterHelper = { - name: "typescript:awaiter", - scoped: false, - priority: 5, - text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };" - }; - var asyncSuperHelper = { - name: "typescript:async-super", - scoped: true, - text: "\n const _super = name => super[name];" - }; - var advancedAsyncSuperHelper = { - name: "typescript:advanced-async-super", - scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" - }; -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; (function (ts) { function transformES2016(context) { var hoistVariableDeclaration = context.hoistVariableDeclaration; @@ -48993,7 +52895,7 @@ var ts; return node; } switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -49018,25 +52920,21 @@ var ts; // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)` var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression), - /*location*/ left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, - /*location*/ left); + target = ts.setTextRange(ts.createElementAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), ts.setTextRange(ts.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left); + value = ts.setTextRange(ts.createElementAccess(expressionTemp, argumentExpressionTemp), left); } else if (ts.isPropertyAccessExpression(left)) { // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)` var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name, - /*location*/ left); - value = ts.createPropertyAccess(expressionTemp, left.name, - /*location*/ left); + target = ts.setTextRange(ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), left.name), left); + value = ts.setTextRange(ts.createPropertyAccess(expressionTemp, left.name), left); } else { // Transforms `a **= b` into `a = Math.pow(a, b)` target = left; value = left; } - return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node); + return ts.setTextRange(ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node)), node); } function visitExponentiationExpression(node) { // Transforms `a ** b` into `Math.pow(a, b)` @@ -49049,6 +52947,7 @@ var ts; })(ts || (ts = {})); /// /// +/// /*@internal*/ var ts; (function (ts) { @@ -49094,8 +52993,85 @@ var ts; */ SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; })(SuperCaptureResult || (SuperCaptureResult = {})); + // Facts we track as we traverse the tree + var HierarchyFacts; + (function (HierarchyFacts) { + HierarchyFacts[HierarchyFacts["None"] = 0] = "None"; + // + // Ancestor facts + // + HierarchyFacts[HierarchyFacts["Function"] = 1] = "Function"; + HierarchyFacts[HierarchyFacts["ArrowFunction"] = 2] = "ArrowFunction"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBody"] = 4] = "AsyncFunctionBody"; + HierarchyFacts[HierarchyFacts["NonStaticClassElement"] = 8] = "NonStaticClassElement"; + HierarchyFacts[HierarchyFacts["CapturesThis"] = 16] = "CapturesThis"; + HierarchyFacts[HierarchyFacts["ExportedVariableStatement"] = 32] = "ExportedVariableStatement"; + HierarchyFacts[HierarchyFacts["TopLevel"] = 64] = "TopLevel"; + HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block"; + HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement"; + HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock"; + HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement"; + HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper"; + HierarchyFacts[HierarchyFacts["ComputedPropertyName"] = 8192] = "ComputedPropertyName"; + // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. + // + // Ancestor masks + // + HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask"; + // We are always in *some* kind of block scope, but only specific block-scope containers are + // top-level or Blocks. + HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; + HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes"; + // A source file is a top-level block scope. + HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes"; + HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes"; + // Functions, methods, and accessors are both new lexical scopes and new block scopes. + HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes"; + HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes"; + // Arrow functions are lexically scoped to their container, but are new block scopes. + HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 16256] = "ArrowFunctionExcludes"; + // Constructors are both new lexical scopes and new block scopes. Constructors are also + // always considered non-static members of a class. + HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes"; + HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes"; + // 'do' and 'while' statements are not block scopes. We track that the subtree is contained + // within an IterationStatement to indicate whether the embedded statement is an + // IterationStatementBlock. + HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; + // 'for' statements are new block scopes and have special handling for 'let' declarations. + HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes"; + // 'for-in' and 'for-of' statements are new block scopes and have special handling for + // 'let' declarations. + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes"; + // Blocks (other than function bodies) are new block scopes. + HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes"; + HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes"; + // Computed property names track subtree flags differently than their containing members. + HierarchyFacts[HierarchyFacts["ComputedPropertyNameIncludes"] = 8192] = "ComputedPropertyNameIncludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameExcludes"] = 0] = "ComputedPropertyNameExcludes"; + // + // Subtree facts + // + HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget"; + HierarchyFacts[HierarchyFacts["NewTargetInComputedPropertyName"] = 32768] = "NewTargetInComputedPropertyName"; + // + // Subtree masks + // + HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask"; + HierarchyFacts[HierarchyFacts["PropagateNewTargetMask"] = 49152] = "PropagateNewTargetMask"; + })(HierarchyFacts || (HierarchyFacts = {})); function transformES2015(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -49103,15 +53079,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; /** * Used to track if we are emitting body of the converted loop */ @@ -49129,257 +53097,221 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0 /* None */; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); - } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072 /* AsyncFunctionBody */)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - // keep track of the enclosing variable statement when in the context of - // variable statements, variable declarations, binding elements, and binding - // patterns. - switch (currentNode.kind) { - case 205 /* VariableStatement */: - enclosingVariableStatement = currentNode; - break; - case 224 /* VariableDeclarationList */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + /** + * Sets the `HierarchyFacts` for this node prior to visiting this node's subtree, returning the facts set prior to modification. + * @param excludeFacts The existing `HierarchyFacts` to reset before visiting the subtree. + * @param includeFacts The new `HierarchyFacts` to set before visiting the subtree. + */ + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */; + return ancestorFacts; } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + /** + * Restores the `HierarchyFacts` for this node's ancestor after visiting this node's + * subtree, propagating specific facts from the subtree. + * @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree. + * @param excludeFacts The existing `HierarchyFacts` of the subtree that should not be propagated. + * @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated. + */ + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression; + return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ + && node.kind === 218 /* ReturnStatement */ + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64 /* ES2015 */) !== 0 || - node.kind === 219 /* LabeledStatement */ || - (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && ts.isStatement(node)) + || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - // we want to dive in this branch either if node has children with ES2015 specific syntax - // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); - } - else { - result = visitNodesInConvertedLoop(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, /*isFunctionBody*/ true); } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216 /* ReturnStatement */: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 218 /* SwitchStatement */: - return visitSwitchStatement(node); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - return visitBreakOrContinueStatement(node); - case 98 /* ThisKeyword */: - return visitThisKeyword(node); - case 70 /* Identifier */: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96 /* SuperKeyword */) { + return visitSuperKeyword(/*isExpressionOfCall*/ true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114 /* StaticKeyword */: return undefined; // elide static keyword - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return visitClassExpression(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); case 70 /* Identifier */: return visitIdentifier(node); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 219 /* LabeledStatement */: + case 220 /* SwitchStatement */: + return visitSwitchStatement(node); + case 234 /* CaseBlock */: + return visitCaseBlock(node); + case 206 /* Block */: + return visitBlock(node, /*isFunctionBody*/ false); + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: + return visitBreakOrContinueStatement(node); + case 221 /* LabeledStatement */: return visitLabeledStatement(node); - case 209 /* DoStatement */: - return visitDoStatement(node); - case 210 /* WhileStatement */: - return visitWhileStatement(node); - case 211 /* ForStatement */: - return visitForStatement(node); - case 212 /* ForInStatement */: - return visitForInStatement(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 207 /* ExpressionStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); + case 213 /* ForStatement */: + return visitForStatement(node, /*outermostLabeledStatement*/ undefined); + case 214 /* ForInStatement */: + return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); + case 215 /* ForOfStatement */: + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return visitCatchClause(node); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 175 /* ArrayLiteralExpression */: + case 143 /* ComputedPropertyName */: + return visitComputedPropertyName(node); + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: return visitTemplateLiteral(node); - case 181 /* TaggedTemplateExpression */: + case 9 /* StringLiteral */: + return visitStringLiteral(node); + case 8 /* NumericLiteral */: + return visitNumericLiteral(node); + case 182 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitSpreadElement(node); case 96 /* SuperKeyword */: - return visitSuperKeyword(); - case 195 /* YieldExpression */: - // `yield` will be handled by a generators transform. - return ts.visitEachChild(node, visitor, context); - case 149 /* MethodDeclaration */: - return visitMethodDeclaration(node); - case 205 /* VariableStatement */: + return visitSuperKeyword(/*isExpressionOfCall*/ false); + case 98 /* ThisKeyword */: + return visitThisKeyword(node); + case 203 /* MetaProperty */: + return visitMetaProperty(node); + case 150 /* MethodDeclaration */: + return visitMethodDeclaration(node); + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return visitAccessorDeclaration(node); + case 207 /* VariableStatement */: return visitVariableStatement(node); + case 218 /* ReturnStatement */: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */); var statements = []; startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); + var statementOffset = ts.addStandardPrologue(statements, node.statements, /*ensureUseStrict*/ false); addCaptureThisForNodeIfNeeded(statements, node); + statementOffset = ts.addCustomPrologue(statements, node.statements, statementOffset, visitor); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - // for switch statement allow only non-labeled break - convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + // for switch statement allow only non-labeled break + convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8 /* Return */; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8 /* Return */; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185 /* ArrowFunction */) { - // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2 /* ArrowFunction */) { + // if the enclosing function is an ArrowFunction then we use the captured 'this' keyword. + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -49388,7 +53320,7 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); @@ -49399,13 +53331,13 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 215 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -49416,7 +53348,7 @@ var ts; } } else { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -49464,8 +53396,9 @@ var ts; /*type*/ undefined, transformClassLikeDeclarationToExpression(node)); ts.setOriginalNode(variable, node); var statements = []; - var statement = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([variable]), /*location*/ node); + var statement = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([variable])); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, node); ts.startOnNewLine(statement); statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) @@ -49583,7 +53516,7 @@ var ts; ts.setEmitFlags(statement, 1536 /* NoComments */ | 384 /* NoTokenSourceMaps */); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ node.members), /*multiLine*/ true); ts.setEmitFlags(block, 1536 /* NoComments */); return block; } @@ -49596,7 +53529,7 @@ var ts; */ function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), + statements.push(ts.setTextRange(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node))), /*location*/ extendsClauseElement)); } } @@ -49608,6 +53541,9 @@ var ts; * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration( @@ -49615,12 +53551,14 @@ var ts; /*modifiers*/ undefined, /*asteriskToken*/ undefined, ts.getDeclarationName(node), /*typeParameters*/ undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), - /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), - /*location*/ constructor || node); + /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper)); + ts.setTextRange(constructorFunction, constructor || node); if (extendsClauseElement) { ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; } /** * Transforms the parameters of the constructor declaration of a class. @@ -49658,38 +53596,46 @@ var ts; statementOffset = 0; } else if (constructor) { - // Otherwise, try to emit all potential prologue directives first. - statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor); + statementOffset = ts.addStandardPrologue(statements, constructor.body.statements, /*ensureUseStrict*/ false); } if (constructor) { addDefaultValueAssignmentsIfNeeded(statements, constructor); addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + if (!hasSynthesizedSuper) { + // If no super call has been synthesized, emit custom prologue directives. + statementOffset = ts.addCustomPrologue(statements, constructor.body.statements, statementOffset, visitor); + } ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + // determine whether the class is known syntactically to be a derived class (e.g. a + // class that extends a value that is not syntactically known to be `null`). + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94 /* NullKeyword */; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); // The last statement expression was replaced. Skip it. if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1 /* ReplaceSuperCapture */; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1 /* ReplaceSuperCapture */) { + hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset)); } // Return `_this` unless we're sure enough that it would be pointless to add a return statement. // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return. - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 /* ReplaceWithReturn */ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, /*copyOnWrite*/ false); + } + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ constructor ? constructor.body.statements : node.members), - /*location*/ constructor ? constructor.body : node, /*multiLine*/ true); + ts.setTextRange(block, constructor ? constructor.body : node); if (!constructor) { ts.setEmitFlags(block, 1536 /* NoComments */); } @@ -49702,17 +53648,17 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 216 /* ReturnStatement */) { + if (statement.kind === 218 /* ReturnStatement */) { return true; } - else if (statement.kind === 208 /* IfStatement */) { + else if (statement.kind === 210 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204 /* Block */) { + else if (statement.kind === 206 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -49725,9 +53671,9 @@ var ts; * * @returns The new statement offset into the `statements` array. */ - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { // If this isn't a derived class, just capture 'this' for arrow functions if necessary. - if (!hasExtendsClause) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -49770,16 +53716,18 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } - // Return the result if we have an immediate super() call on the last statement. - if (superCallExpression && statementOffset === ctorStatements.length - 1) { + // Return the result if we have an immediate super() call on the last statement, + // but only if the constructor itself doesn't use 'this' elsewhere. + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 /* BinaryExpression */ - || superCallExpression.left.kind !== 179 /* CallExpression */) { + if (superCallExpression.kind !== 193 /* BinaryExpression */ + || superCallExpression.left.kind !== 180 /* CallExpression */) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } // Shift comments from the original super call to the return statement. @@ -49788,18 +53736,18 @@ var ts; return 2 /* ReplaceWithReturn */; } // Perform the capture. - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); // If we're actually replacing the original statement, we need to signal this to the caller. if (superCallExpression) { return 1 /* ReplaceSuperCapture */; } return 0 /* NoReplacement */; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } /** * Visits a parameter declaration. @@ -49814,25 +53762,25 @@ var ts; else if (ts.isBindingPattern(node.name)) { // Binding patterns are converted into a generated name and are // evaluated inside the function body. - return ts.setOriginalNode(ts.createParameter( + return ts.setOriginalNode(ts.setTextRange(ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node), /*questionToken*/ undefined, /*type*/ undefined, - /*initializer*/ undefined, + /*initializer*/ undefined), /*location*/ node), /*original*/ node); } else if (node.initializer) { // Initializers are elided - return ts.setOriginalNode(ts.createParameter( + return ts.setOriginalNode(ts.setTextRange(ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, node.name, /*questionToken*/ undefined, /*type*/ undefined, - /*initializer*/ undefined, + /*initializer*/ undefined), /*location*/ node), /*original*/ node); } @@ -49862,17 +53810,17 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_35 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; // A rest parameter cannot have a binding pattern or an initializer, // so let's just ignore it. if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_35)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_35, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_35, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -49907,13 +53855,11 @@ var ts; */ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ - ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer)), - /*location*/ parameter)) - ], /*location*/ parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */), - /*elseStatement*/ undefined, - /*location*/ parameter); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.setTextRange(ts.createBlock([ + ts.createStatement(ts.setTextRange(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer))), parameter)) + ]), parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */)); statement.startsOnNewLine = true; + ts.setTextRange(statement, parameter); ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 524288 /* CustomPrologue */); statements.push(statement); } @@ -49950,22 +53896,21 @@ var ts; var restIndex = node.parameters.length - 1; var temp = ts.createLoopVariable(); // var param = []; - statements.push(ts.setEmitFlags(ts.createVariableStatement( + statements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(declarationName, /*type*/ undefined, ts.createArrayLiteral([])) - ]), + ])), /*location*/ parameter), 524288 /* CustomPrologue */)); // for (var _i = restIndex; _i < arguments.length; _i++) { // param[_i - restIndex] = arguments[_i]; // } - var forStatement = ts.createFor(ts.createVariableDeclarationList([ + var forStatement = ts.createFor(ts.setTextRange(ts.createVariableDeclarationList([ ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex)) - ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), - /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([ - ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ]), parameter), ts.setTextRange(ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length")), parameter), ts.setTextRange(ts.createPostfixIncrement(temp), parameter), ts.createBlock([ + ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 ? temp - : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp))), /*location*/ parameter)) ])); ts.setEmitFlags(forStatement, 524288 /* CustomPrologue */); @@ -49979,7 +53924,7 @@ var ts; * @param node A node. */ function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 186 /* ArrowFunction */) { captureThisForNode(statements, node, ts.createThis()); } } @@ -49989,11 +53934,52 @@ var ts; /*modifiers*/ undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("_this", /*type*/ undefined, initializer) - ]), originalStatement); + ])); ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 524288 /* CustomPrologue */); + ts.setTextRange(captureThisStatement, originalStatement); ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384 /* NewTarget */) { + var newTarget = void 0; + switch (node.kind) { + case 186 /* ArrowFunction */: + return statements; + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + // Methods and accessors cannot be constructors, so 'new.target' will + // always return 'undefined'. + newTarget = ts.createVoidZero(); + break; + case 151 /* Constructor */: + // Class constructors can only be called with `new`, so `this.constructor` + // should be relatively safe to use. + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); + break; + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + // Functions can be called or constructed, and may have a `this` due to + // being a member or when calling an imported function via `other_1.f()`. + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 92 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", + /*type*/ undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } /** * Adds statements to the class body function for a class to define the members of the * class. @@ -50005,20 +53991,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149 /* MethodDeclaration */: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + case 150 /* MethodDeclaration */: + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150 /* Constructor */: + case 151 /* Constructor */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -50033,7 +54019,7 @@ var ts; * @param member The SemicolonClassElement node. */ function transformSemicolonClassElementToStatement(member) { - return ts.createEmptyStatement(/*location*/ member); + return ts.setTextRange(ts.createEmptyStatement(), member); } /** * Transforms a MethodDeclaration into a statement for a class body function. @@ -50041,14 +54027,15 @@ var ts; * @param receiver The receiver for the member. * @param member The MethodDeclaration node. */ - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name); - var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined, container); ts.setEmitFlags(memberFunction, 1536 /* NoComments */); ts.setSourceMapRange(memberFunction, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), + var statement = ts.setTextRange(ts.createStatement(ts.createAssignment(memberName, memberFunction)), /*location*/ member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); @@ -50056,6 +54043,7 @@ var ts; // No source map should be emitted for this statement to align with the // old emitter. ts.setEmitFlags(statement, 48 /* NoSourceMap */); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return statement; } /** @@ -50064,13 +54052,13 @@ var ts; * @param receiver The receiver for the member. * @param accessors The set of related get/set accessors. */ - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), - /*location*/ ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, /*startsOnNewLine*/ false)); // The location for the statement is used to emit source maps only. // No comments should be emitted for this statement to align with the // old emitter. ts.setEmitFlags(statement, 1536 /* NoComments */); + ts.setSourceMapRange(statement, ts.getSourceMapRange(accessors.firstAccessor)); return statement; } /** @@ -50079,8 +54067,9 @@ var ts; * * @param receiver The receiver for the member. */ - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. var target = ts.getMutableClone(receiver); @@ -50091,7 +54080,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -50099,23 +54088,24 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); } - properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true))); + properties.push(ts.createPropertyAssignment("enumerable", ts.createTrue()), ts.createPropertyAssignment("configurable", ts.createTrue())); var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), /*typeArguments*/ undefined, [ target, propertyName, - ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true) + ts.createObjectLiteral(properties, /*multiLine*/ true) ]); if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return call; } /** @@ -50127,14 +54117,20 @@ var ts; if (node.transformFlags & 16384 /* ContainsLexicalThis */) { enableSubstitutionsForCapturedThis(); } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */); var func = ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node), node); + /*type*/ undefined, transformFunctionBody(node)); + ts.setTextRange(func, node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8 /* CapturesThis */); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; return func; } /** @@ -50143,12 +54139,24 @@ var ts; * @param node a FunctionExpression node. */ function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var ancestorFacts = ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */ + ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, node.asteriskToken, name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Visits a FunctionDeclaration node. @@ -50156,12 +54164,22 @@ var ts; * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Transforms a function-like node into a FunctionExpression. @@ -50170,18 +54188,24 @@ var ts; * @param location The source-map location for the new FunctionExpression. * @param name The name of the new FunctionExpression. */ - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */) + ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression( + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location), + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body), location), /*original*/ node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; } /** * Transforms the body of a function-like node. @@ -50199,8 +54223,8 @@ var ts; resumeLexicalEnvironment(); if (ts.isBlock(body)) { // ensureUseStrict is false because no new prologue-directive should be added. - // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array - statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + // addStandardPrologue will put already-existing directives at the beginning of the target statement-array + statementOffset = ts.addStandardPrologue(statements, body.statements, /*ensureUseStrict*/ false); } addCaptureThisForNodeIfNeeded(statements, node); addDefaultValueAssignmentsIfNeeded(statements, node); @@ -50210,6 +54234,8 @@ var ts; multiLine = true; } if (ts.isBlock(body)) { + // addCustomPrologue puts already-existing directives at the beginning of the target statement-array + statementOffset = ts.addCustomPrologue(statements, body.statements, statementOffset, visitor); statementsLocation = body.statements; ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); // If the original body was a multi-line block, this must be a multi-line block. @@ -50218,7 +54244,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185 /* ArrowFunction */); + ts.Debug.assert(node.kind === 186 /* ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -50234,7 +54260,8 @@ var ts; } } var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = ts.createReturn(expression, /*location*/ body); + var returnStatement = ts.createReturn(expression); + ts.setTextRange(returnStatement, body); ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */); statements.push(returnStatement); // To align with the source map emit for the old emitter, we set a custom @@ -50243,11 +54270,13 @@ var ts; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, /*copyOnWrite*/ false); // If we added any final generated statements, this must be a multi-line block if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), multiLine); + ts.setTextRange(block, node.body); if (!multiLine && singleLine) { ts.setEmitFlags(block, 1 /* SingleLine */); } @@ -50257,6 +54286,23 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.setTextRange(ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, /*copyOnWrite*/ true)), + /*location*/ updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + // A function body is not a block scope. + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */ + ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */) + : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -50265,9 +54311,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -50282,10 +54328,13 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { // If we are here it is most likely because our expression is a destructuring assignment. if (!needsDestructuringValue) { + // By default we always emit the RHS at the end of a flattened destructuring + // expression. If we are in a state where we do not need the destructuring value, + // we pass that information along to the children that care about it. switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -50303,9 +54352,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) { + var ancestorFacts = enterSubtree(0 /* None */, ts.hasModifier(node, 1 /* Export */) ? 32 /* ExportedVariableStatement */ : 0 /* None */); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3 /* BlockScoped */) === 0) { // we are inside a converted loop - hoist variable declarations var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -50319,18 +54371,22 @@ var ts; else { assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression)); } - (assignments || (assignments = [])).push(assignment); + assignments = ts.append(assignments, assignment); } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node); + updated = ts.setTextRange(ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); })), node); } else { // none of declarations has initializer - the entire variable statement can be deleted - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } /** * Visits a VariableDeclarationList that is block scoped (e.g. `let` or `const`). @@ -50338,25 +54394,29 @@ var ts; * @param node A VariableDeclarationList node. */ function visitVariableDeclarationList(node) { - if (node.flags & 3 /* BlockScoped */) { - enableSubstitutionsForBlockScopedBindings(); - } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 /* ContainsBindingPattern */ - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - // If the first or last declaration is a binding pattern, we need to modify - // the source map range for the declaration list. - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + if (node.transformFlags & 64 /* ES2015 */) { + if (node.flags & 3 /* BlockScoped */) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations); + ts.setOriginalNode(declarationList, node); + ts.setTextRange(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 /* ContainsBindingPattern */ + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + // If the first or last declaration is a binding pattern, we need to modify + // the source map range for the declaration list. + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - return declarationList; + return ts.visitEachChild(node, visitor, context); } /** * Gets a value indicating whether we should emit an explicit initializer for a variable @@ -50407,18 +54467,16 @@ var ts; var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false)); + && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 /* ForInStatement */ - && enclosingBlockScopeContainer.kind !== 213 /* ForOfStatement */ + && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false))); + && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0)); return emitExplicitInitializer; } /** @@ -50447,101 +54505,77 @@ var ts; * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node) { - // If we are here it is because the name contains a binding pattern. + var ancestorFacts = enterSubtree(32 /* ExportedVariableStatement */, 0 /* None */); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1 /* Export */); - return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, - /*value*/ undefined, hoistTempVariables); - } - return ts.visitEachChild(node, visitor, context); - } - function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, + /*value*/ undefined, (ancestorFacts & 32 /* ExportedVariableStatement */) !== 0); } else { - result = ts.visitEachChild(node, visitor, context); + updated = ts.visitEachChild(node, visitor, context); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels.set(node.label.text, node.label.text); + } + function resetLabel(node) { + convertedLoopState.labels.set(node.label.text, undefined); + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - return result; + var statement = ts.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, /*lookInLabeledStatements*/ false) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 213 /* ForStatement */: + return visitForStatement(node, outermostLabeledStatement); + case 214 /* ForInStatement */: + return visitForInStatement(node, outermostLabeledStatement); + case 215 /* ForOfStatement */: + return visitForOfStatement(node, outermostLabeledStatement); + } + } + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement); } - /** - * Visits a ForOfStatement and converts it into a compatible ForStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } - function convertForOfToFor(node, convertedLoopBodyStatements) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (var _i = 0, _a = expr; _i < _a.length; _i++) { - // var v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; + function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { var statements = []; - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var counter = ts.createLoopVariable(); - var rhsReference = expression.kind === 70 /* Identifier */ - ? ts.createUniqueName(expression.text) - : ts.createTempVariable(/*recordTempVariable*/ undefined); - var elementAccess = ts.createElementAccess(rhsReference, counter); - // Initialize LHS - // var v = _a[_i]; - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3 /* BlockScoped */) { + if (ts.isVariableDeclarationList(node.initializer)) { + if (node.initializer.flags & 3 /* BlockScoped */) { enableSubstitutionsForBlockScopedBindings(); } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + var firstOriginalDeclaration = ts.firstOrUndefined(node.initializer.declarations); if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { // This works whether the declaration is a var, let, or const. // It will use rhsIterationValue _a[_i] as the initializer. - var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, elementAccess); - var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer); - ts.setOriginalNode(declarationList, initializer); + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, boundValue); + var declarationList = ts.setTextRange(ts.createVariableDeclarationList(declarations), node.initializer); + ts.setOriginalNode(declarationList, node.initializer); // Adjust the source map range for the first declaration to align with the old // emitter. var firstDeclaration = declarations[0]; @@ -50553,27 +54587,24 @@ var ts; else { // The following call does not include the initializer, so we have // to emit it separately. - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ + statements.push(ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.setOriginalNode(ts.setTextRange(ts.createVariableDeclarationList([ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined), - /*type*/ undefined, ts.createElementAccess(rhsReference, counter)) - ], /*location*/ ts.moveRangePos(initializer, -1)), initializer), - /*location*/ ts.moveRangeEnd(initializer, -1))); + /*type*/ undefined, boundValue) + ]), ts.moveRangePos(node.initializer, -1)), node.initializer)), ts.moveRangeEnd(node.initializer, -1))); } } else { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. - var assignment = ts.createAssignment(initializer, elementAccess); + var assignment = ts.createAssignment(node.initializer, boundValue); if (ts.isDestructuringAssignment(assignment)) { - // This is a destructuring pattern, so we flatten the destructuring instead. - statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0 /* All */))); + ts.aggregateTransformFlags(assignment); + statements.push(ts.createStatement(visitBinaryExpression(assignment, /*needsDestructuringValue*/ false))); } else { - // Currently there is not way to check that assignment is binary expression of destructing assignment - // so we have to cast never type to binaryExpression - assignment.end = initializer.end; - statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1))); + assignment.end = node.initializer.end; + statements.push(ts.setTextRange(ts.createStatement(ts.visitNode(assignment, visitor, ts.isExpression)), ts.moveRangeEnd(node.initializer, -1))); } } var bodyLocation; @@ -50582,7 +54613,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -50592,22 +54623,92 @@ var ts; statements.push(statement); } } - // The old emitter does not emit source maps for the expression - ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression)); // The old emitter does not emit source maps for the block. // We add the location to preserve comments. - var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation), - /*location*/ bodyLocation); - ts.setEmitFlags(body, 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); - var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)), - ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression) - ], /*location*/ node.expression), 1048576 /* NoHoisting */), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), - /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body, + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), + /*multiLine*/ true), bodyLocation), 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); + } + function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) { + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (var _i = 0, _a = expr; _i < _a.length; _i++) { + // var v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (let v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + var counter = ts.createLoopVariable(); + var rhsReference = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined); + // The old emitter does not emit source maps for the expression + ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression)); + var forStatement = ts.setTextRange(ts.createFor( + /*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0)), ts.moveRangePos(node.expression, -1)), + ts.setTextRange(ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression), node.expression) + ]), node.expression), 1048576 /* NoHoisting */), + /*condition*/ ts.setTextRange(ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length")), node.expression), + /*incrementor*/ ts.setTextRange(ts.createPostfixIncrement(counter), node.expression), + /*statement*/ convertForOfStatementHead(node, ts.createElementAccess(rhsReference, counter), convertedLoopBodyStatements)), /*location*/ node); // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */); - return forStatement; + ts.setTextRange(forStatement, node); + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(/*recordTempVariable*/ undefined); + var values = ts.createValuesHelper(context, expression, node.expression); + var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor( + /*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + ts.createVariableDeclaration(result, /*type*/ undefined, next) + ]), node.expression), 1048576 /* NoHoisting */), + /*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")), + /*incrementor*/ ts.createAssignment(result, next), + /*statement*/ convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"), convertedLoopBodyStatements)), + /*location*/ node), 256 /* NoTokenTrailingSourceMaps */); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1 /* SingleLine */)), ts.createBlock([ + ts.createTry( + /*tryBlock*/ ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createFunctionCall(returnMethod, iterator, []))), 1 /* SingleLine */), + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1 /* SingleLine */) + ]), 1 /* SingleLine */)) + ])); } /** * Visits an ObjectLiteralExpression with computed propety names. @@ -50621,31 +54722,39 @@ var ts; // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 /* ContainsYield */ - || property.name.kind === 142 /* ComputedPropertyName */) { + if ((property.transformFlags & 16777216 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 143 /* ComputedPropertyName */) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - // For computed properties, we need to create a unique handle to the object - // literal so we can modify it without risking internal assignments tainting the object. - var temp = ts.createTempVariable(hoistVariableDeclaration); - // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, node.multiLine), 32768 /* Indented */)); - if (node.multiLine) { - assignment.startsOnNewLine = true; - } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - // We need to clone the temporary identifier so that we can write it on a - // new line - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var temp = ts.createTempVariable(hoistVariableDeclaration); + // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), 32768 /* Indented */)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + // We need to clone the temporary identifier so that we can write it on a + // new line + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); + } + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; @@ -50672,7 +54781,7 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { @@ -50681,7 +54790,9 @@ var ts; saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */; } - var result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -50690,11 +54801,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 226 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -50730,19 +54841,26 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + startLexicalEnvironment(); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4); - loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, /*multiline*/ true); } - if (!ts.isBlock(loopBody)) { - loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0 + else { + loopBody = ts.createBlock([loopBody], /*multiline*/ true); + } + var isAsyncBlockContainingAwait = hierarchyFacts & 4 /* AsyncFunctionBody */ && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -50825,25 +54943,22 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); + var clone_4 = ts.getMutableClone(node); // clean statement part - loop.statement = undefined; + clone_4.statement = undefined; // visit childnodes to transform initializer/condition/incrementor parts - loop = ts.visitEachChild(loop, visitor, context); + clone_4 = ts.visitEachChild(clone_4, visitor, context); // set loop statement - loop.statement = ts.createBlock(convertedLoopBodyStatements, - /*location*/ undefined, - /*multiline*/ true); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, /*multiline*/ true); // reset and re-aggregate the transform flags - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); } - statements.push(currentParent.kind === 219 /* LabeledStatement */ - ? ts.createLabel(currentParent.label, loop) - : loop); + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -50867,7 +54982,9 @@ var ts; !state.labeledNonLocalBreaks && !state.labeledNonLocalContinues; var call = ts.createCall(loopFunctionExpressionName, /*typeArguments*/ undefined, ts.map(parameters, function (p) { return p.name; })); - var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38 /* AsteriskToken */), call) : call; + var callResult = isAsyncBlockContainingAwait + ? ts.createYield(ts.createToken(38 /* AsteriskToken */), ts.setEmitFlags(call, 4194304 /* Iterator */)) + : call; if (isSimpleLoop) { statements.push(ts.createStatement(callResult)); copyOutParameters(state.loopOutParameters, 0 /* ToOriginal */, statements); @@ -50906,26 +55023,25 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; // if there are no outer converted loop or outer label in question is located inside outer converted loop // then emit labeled break\continue // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -50934,7 +55050,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -50949,7 +55065,7 @@ var ts; else { loopParameters.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name)); if (resolver.getNodeCheckFlags(decl) & 2097152 /* NeedsLoopOutParameter */) { - var outParamName = ts.createUniqueName("out_" + name.text); + var outParamName = ts.createUniqueName("out_" + ts.unescapeIdentifier(name.text)); loopOutParameters.push({ originalName: name, outParamName: outParamName }); } } @@ -50969,22 +55085,22 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257 /* PropertyAssignment */: + case 150 /* MethodDeclaration */: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 260 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149 /* MethodDeclaration */: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; default: ts.Debug.failBadSyntaxKind(node); break; @@ -50999,8 +55115,8 @@ var ts; * @param receiver The receiver for the assignment. */ function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), - /*location*/ property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } @@ -51014,8 +55130,8 @@ var ts; * @param receiver The receiver for the assignment. */ function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), - /*location*/ property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } @@ -51028,22 +55144,34 @@ var ts; * @param method The MethodDeclaration node. * @param receiver The receiver for the assignment. */ - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), - /*location*/ method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined, container)); + ts.setTextRange(expression, method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); - var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp); + ts.setTextRange(newVariableDeclaration, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); + var list = ts.createVariableDeclarationList(vars); + ts.setTextRange(list, node.variableDeclaration); + var destructure = ts.createVariableStatement(/*modifiers*/ undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -51060,20 +55188,41 @@ var ts; // Methods on classes are handled in visitClassDeclaration/visitClassExpression. // Methods with computed property names are handled in visitObjectLiteralExpression. ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined); + var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined, /*container*/ undefined); ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); - return ts.createPropertyAssignment(node.name, functionExpression, + return ts.setTextRange(ts.createPropertyAssignment(node.name, functionExpression), /*location*/ node); } + /** + * Visits an AccessorDeclaration of an ObjectLiteralExpression. + * + * @param node An AccessorDeclaration node. + */ + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return updated; + } /** * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment. * * @param node A ShorthandPropertyAssignment node. */ function visitShorthandPropertyAssignment(node) { - return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), + return ts.setTextRange(ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name)), /*location*/ node); } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0 /* ComputedPropertyNameExcludes */, 8192 /* ComputedPropertyNameIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 32768 /* NewTargetInComputedPropertyName */ : 0 /* None */); + return updated; + } /** * Visits a YieldExpression node. * @@ -51089,8 +55238,11 @@ var ts; * @param node An ArrayLiteralExpression node. */ function visitArrayLiteralExpression(node) { - // We are here because we contain a SpreadElementExpression. - return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + if (node.transformFlags & 64 /* ES2015 */) { + // We are here because we contain a SpreadElementExpression. + return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } /** * Visits a CallExpression that contains either a spread element or `super`. @@ -51098,7 +55250,11 @@ var ts; * @param node a CallExpression. */ function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + if (node.transformFlags & 64 /* ES2015 */) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), + /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false); @@ -51125,7 +55281,7 @@ var ts; // _super.apply(this, a.concat([b])) // _super.m.apply(this, a.concat([b])) // _super.prototype.m.apply(this, a.concat([b])) - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); } else { // [source] @@ -51137,18 +55293,18 @@ var ts; // _super.call(this, a) // _super.m.call(this, a) // _super.prototype.m.call(this, a) - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), /*location*/ node); } if (node.expression.kind === 96 /* SuperKeyword */) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } /** * Visits a NewExpression that contains a spread element. @@ -51156,16 +55312,18 @@ var ts; * @param node A NewExpression node. */ function visitNewExpression(node) { - // We are here because we contain a SpreadElementExpression. - ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0); - // [source] - // new C(...a) - // - // [output] - // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), - /*typeArguments*/ undefined, []); + if (node.transformFlags & 524288 /* ContainsSpread */) { + // We are here because we contain a SpreadElementExpression. + // [source] + // new C(...a) + // + // [output] + // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), + /*typeArguments*/ undefined, []); + } + return ts.visitEachChild(node, visitor, context); } /** * Transforms an array of Expression nodes that contains a SpreadExpression. @@ -51186,14 +55344,28 @@ var ts; var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) { return visitPartition(partition, multiLine, hasTrailingComma && end === numElements); })); - if (segments.length === 1) { - var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 /* ArrayLiteralExpression */ - ? ts.createArraySlice(segments[0]) - : segments[0]; + if (compilerOptions.downlevelIteration) { + if (segments.length === 1) { + var firstSegment = segments[0]; + if (ts.isCallExpression(firstSegment) + && ts.isIdentifier(firstSegment.expression) + && (ts.getEmitFlags(firstSegment.expression) & 4096 /* HelperName */) + && firstSegment.expression.text === "___spread") { + return segments[0]; + } + } + return ts.createSpreadHelper(context, segments); + } + else { + if (segments.length === 1) { + var firstElement = elements[0]; + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 /* ArrayLiteralExpression */ + ? ts.createArraySlice(segments[0]) + : segments[0]; + } + // Rewrite using the pattern .concat(, , ...) + return ts.createArrayConcat(segments.shift(), segments); } - // Rewrite using the pattern .concat(, , ...) - return ts.createArrayConcat(segments.shift(), segments); } function partitionSpread(node) { return ts.isSpreadExpression(node) @@ -51204,8 +55376,7 @@ var ts; return ts.map(chunk, visitExpressionOfSpread); } function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { - return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression), - /*location*/ undefined, multiLine); + return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, hasTrailingComma), visitor, ts.isExpression), multiLine); } function visitSpreadElement(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); @@ -51224,7 +55395,29 @@ var ts; * @param node A template literal. */ function visitTemplateLiteral(node) { - return ts.createLiteral(node.text, /*location*/ node); + return ts.setTextRange(ts.createLiteral(node.text), node); + } + /** + * Visits a string literal with an extended unicode escape. + * + * @param node A string literal. + */ + function visitStringLiteral(node) { + if (node.hasExtendedUnicodeEscape) { + return ts.setTextRange(ts.createLiteral(node.text), node); + } + return node; + } + /** + * Visits a binary or octal (ES6) numeric literal. + * + * @param node A string literal. + */ + function visitNumericLiteral(node) { + if (node.numericLiteralFlags & 48 /* BinaryOrOctalSpecifier */) { + return ts.setTextRange(ts.createNumericLiteral(node.text), node); + } + return node; } /** * Visits a TaggedTemplateExpression node. @@ -51284,7 +55477,7 @@ var ts; // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's // and LineTerminatorSequences are normalized to for both TV and TRV. text = text.replace(/\r\n?/g, "\n"); - return ts.createLiteral(text, /*location*/ node); + return ts.setTextRange(ts.createLiteral(text), node); } /** * Visits a TemplateExpression node. @@ -51306,7 +55499,8 @@ var ts; // "abc" + (1 << 2) + "" var expression = ts.reduceLeft(expressions, ts.createAdd); if (ts.nodeIsSynthesized(expression)) { - ts.setTextRange(expression, node); + expression.pos = node.pos; + expression.end = node.end; } return expression; } @@ -51368,27 +55562,42 @@ var ts; /** * Visits the `super` keyword */ - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32 /* Static */) - && currentParent.kind !== 179 /* CallExpression */ + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 /* NonStaticClassElement */ + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } + function visitMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */ && node.name.text === "target") { + if (hierarchyFacts & 8192 /* ComputedPropertyName */) { + hierarchyFacts |= 32768 /* NewTargetInComputedPropertyName */; + } + else { + hierarchyFacts |= 16384 /* NewTarget */; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } /** * Called by the printer just before a node is printed. * + * @param hint A hint as to the intended usage of the node. * @param node The node to be printed. + * @param emitCallback The callback used to emit the node. */ - function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; + function onEmitNode(hint, node, emitCallback) { if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */ + ? 65 /* FunctionIncludes */ | 16 /* CapturesThis */ + : 65 /* FunctionIncludes */); + previousOnEmitNode(hint, node, emitCallback); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return; } - previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; + previousOnEmitNode(hint, node, emitCallback); } /** * Enables a more costly code path for substitutions when we determine a source file @@ -51408,24 +55617,24 @@ var ts; if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { enabledSubstitutions |= 1 /* CapturedThis */; context.enableSubstitution(98 /* ThisKeyword */); - context.enableEmitNotification(150 /* Constructor */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(185 /* ArrowFunction */); - context.enableEmitNotification(184 /* FunctionExpression */); - context.enableEmitNotification(225 /* FunctionDeclaration */); + context.enableEmitNotification(151 /* Constructor */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(186 /* ArrowFunction */); + context.enableEmitNotification(185 /* FunctionExpression */); + context.enableEmitNotification(227 /* FunctionDeclaration */); } } /** * Hooks node substitutions. * - * @param emitContext The context for the emitter. + * @param hint The context for the emitter. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */) { return substituteExpression(node); } if (ts.isIdentifier(node)) { @@ -51442,7 +55651,7 @@ var ts; if (enabledSubstitutions & 2 /* BlockScopedBindings */) { var original = ts.getParseTreeNode(node, ts.isIdentifier); if (original && isNameOfDeclarationWithCollidingName(original)) { - return ts.getGeneratedNameForNode(original); + return ts.setTextRange(ts.getGeneratedNameForNode(original), node); } } return node; @@ -51456,10 +55665,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 223 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 225 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -51488,7 +55697,7 @@ var ts; if (enabledSubstitutions & 2 /* BlockScopedBindings */) { var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { - return ts.getGeneratedNameForNode(declaration.name); + return ts.setTextRange(ts.getGeneratedNameForNode(declaration.name), node); } } return node; @@ -51500,9 +55709,8 @@ var ts; */ function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) { - return ts.createIdentifier("_this", /*location*/ node); + && hierarchyFacts & 16 /* CapturesThis */) { + return ts.setTextRange(ts.createIdentifier("_this"), node); } return node; } @@ -51518,11 +55726,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -51530,7 +55738,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -51550,11 +55758,123 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); /// /// +/*@internal*/ +var ts; +(function (ts) { + /** + * Transforms ES5 syntax into ES3 syntax. + * + * @param context Context and state information for the transformation. + */ + function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + // enable emit notification only if using --jsx preserve or react-native + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(250 /* JsxOpeningElement */); + context.enableEmitNotification(251 /* JsxClosingElement */); + context.enableEmitNotification(249 /* JsxSelfClosingElement */); + noSubstitution = []; + } + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(260 /* PropertyAssignment */); + return transformSourceFile; + /** + * Transforms an ES5 source file to ES3. + * + * @param node A SourceFile + */ + function transformSourceFile(node) { + return node; + } + /** + * Called by the printer just before a node is printed. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emitCallback A callback used to emit the node. + */ + function onEmitNode(hint, node, emitCallback) { + switch (node.kind) { + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(hint, node, emitCallback); + } + /** + * Hooks node substitutions. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(hint, node); + } + node = previousOnSubstituteNode(hint, node); + if (ts.isPropertyAccessExpression(node)) { + return substitutePropertyAccessExpression(node); + } + else if (ts.isPropertyAssignment(node)) { + return substitutePropertyAssignment(node); + } + return node; + } + /** + * Substitutes a PropertyAccessExpression whose name is a reserved word. + * + * @param node A PropertyAccessExpression + */ + function substitutePropertyAccessExpression(node) { + var literalName = trySubstituteReservedName(node.name); + if (literalName) { + return ts.setTextRange(ts.createElementAccess(node.expression, literalName), node); + } + return node; + } + /** + * Substitutes a PropertyAssignment whose name is a reserved word. + * + * @param node A PropertyAssignment + */ + function substitutePropertyAssignment(node) { + var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); + if (literalName) { + return ts.updatePropertyAssignment(node, literalName, node.initializer); + } + return node; + } + /** + * If an identifier name is a reserved word, returns a string literal for the name. + * + * @param name An Identifier + */ + function trySubstituteReservedName(name) { + var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); + if (token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */) { + return ts.setTextRange(ts.createLiteral(name), name); + } + return undefined; + } + } + ts.transformES5 = transformES5; +})(ts || (ts = {})); +/// +/// // Transforms generator functions into a compatible ES5 representation with similar runtime // semantics. This is accomplished by first transforming the body of each generator // function into an intermediate representation that is the compiled into a JavaScript @@ -51725,13 +56045,15 @@ var ts; Instruction[Instruction["Catch"] = 6] = "Catch"; Instruction[Instruction["Endfinally"] = 7] = "Endfinally"; })(Instruction || (Instruction = {})); - var instructionNames = ts.createMap((_a = {}, - _a[2 /* Return */] = "return", - _a[3 /* Break */] = "break", - _a[4 /* Yield */] = "yield", - _a[5 /* YieldStar */] = "yield*", - _a[7 /* Endfinally */] = "endfinally", - _a)); + function getInstructionName(instruction) { + switch (instruction) { + case 2 /* Return */: return "return"; + case 3 /* Break */: return "break"; + case 4 /* Yield */: return "yield"; + case 5 /* YieldStar */: return "yield*"; + case 7 /* Endfinally */: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -51823,13 +56145,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209 /* DoStatement */: + case 211 /* DoStatement */: return visitDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return visitWhileStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -51842,24 +56164,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return visitAccessorDeclaration(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node); - case 215 /* BreakStatement */: + case 217 /* BreakStatement */: return visitBreakStatement(node); - case 214 /* ContinueStatement */: + case 216 /* ContinueStatement */: return visitContinueStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -51880,21 +56202,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return visitConditionalExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -51907,9 +56229,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -51927,12 +56249,12 @@ var ts; */ function visitFunctionDeclaration(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { - node = ts.setOriginalNode(ts.createFunctionDeclaration( + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration( /*decorators*/ undefined, node.modifiers, /*asteriskToken*/ undefined, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformGeneratorFunctionBody(node.body), + /*type*/ undefined, transformGeneratorFunctionBody(node.body)), /*location*/ node), node); } else { @@ -51965,12 +56287,12 @@ var ts; */ function visitFunctionExpression(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { - node = ts.setOriginalNode(ts.createFunctionExpression( + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformGeneratorFunctionBody(node.body), + /*type*/ undefined, transformGeneratorFunctionBody(node.body)), /*location*/ node), node); } else { @@ -52039,7 +56361,7 @@ var ts; state = ts.createTempVariable(/*recordTempVariable*/ undefined); // Build the generator resumeLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + var statementOffset = ts.addPrologue(statements, body.statements, /*ensureUseStrict*/ false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); ts.addRange(statements, endLexicalEnvironment()); @@ -52058,7 +56380,7 @@ var ts; operationArguments = savedOperationArguments; operationLocations = savedOperationLocations; state = savedState; - return ts.createBlock(statements, /*location*/ body, body.multiLine); + return ts.setTextRange(ts.createBlock(statements, body.multiLine), body); } /** * Visits a variable statement. @@ -52137,7 +56459,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -52149,7 +56471,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -52168,7 +56490,7 @@ var ts; } var operator = node.operatorToken.kind; if (isCompoundAssignment(operator)) { - return ts.createBinary(target, 57 /* EqualsToken */, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node); + return ts.setTextRange(ts.createAssignment(target, ts.setTextRange(ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node); } else { return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression)); @@ -52192,10 +56514,10 @@ var ts; // _a = a(); // .yield resumeLabel // _a + %sent% + c() - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -52330,17 +56652,19 @@ var ts; // .yield resumeLabel, (a()) // .mark resumeLabel // x = %sent%; - // NOTE: we are explicitly not handling YieldStar at this time. var resumeLabel = defineLabel(); var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (node.asteriskToken) { - emitYieldStar(expression, /*location*/ node); + var iterator = (ts.getEmitFlags(node.expression) & 4194304 /* Iterator */) === 0 + ? ts.createValuesHelper(context, expression, /*location*/ node) + : expression; + emitYieldStar(iterator, /*location*/ node); } else { emitYield(expression, /*location*/ node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(/*location*/ node); } /** * Visits an ArrayLiteralExpression that contains a YieldExpression. @@ -52368,26 +56692,27 @@ var ts; // .mark resumeLabel // ar = _a.concat([%sent%, 2]); var numInitialElements = countInitialNodesWithoutYield(elements); - var temp = declareLocal(); - var hasAssignedTemp = false; + var temp; if (numInitialElements > 0) { + temp = declareLocal(); var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); emitAssignment(temp, ts.createArrayLiteral(leadingElement ? [leadingElement].concat(initialElements) : initialElements)); leadingElement = undefined; - hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); - return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); + return temp + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.setTextRange(ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine), location); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { + var hasAssignedTemp = temp !== undefined; + if (!temp) { + temp = declareLocal(); + } emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, - /*location*/ undefined, multiLine)); - hasAssignedTemp = true; + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine)); leadingElement = undefined; expressions = []; } @@ -52417,8 +56742,7 @@ var ts; var multiLine = node.multiLine; var numInitialProperties = countInitialNodesWithoutYield(properties); var temp = declareLocal(); - emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, multiLine)); + emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), multiLine)); var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties); expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); return ts.inlineExpressions(expressions); @@ -52454,10 +56778,10 @@ var ts; // .yield resumeLabel // .mark resumeLabel // a = _a[%sent%] - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -52492,10 +56816,9 @@ var ts; // .mark resumeLabel // new (_b.apply(_a, _c.concat([%sent%, 2]))); var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, + return ts.setOriginalNode(ts.setTextRange(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, /*leadingElement*/ ts.createVoidZero())), - /*typeArguments*/ undefined, [], - /*location*/ node), node); + /*typeArguments*/ undefined, []), node), node); } return ts.visitEachChild(node, visitor, context); } @@ -52524,38 +56847,38 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204 /* Block */: + case 206 /* Block */: return transformAndEmitBlock(node); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return transformAndEmitIfStatement(node); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return transformAndEmitDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return transformAndEmitForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 214 /* ContinueStatement */: + case 216 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 215 /* BreakStatement */: + case 217 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return transformAndEmitWithStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return transformAndEmitTryStatement(node); default: - return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true)); + return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); } } function transformAndEmitBlock(node) { @@ -52572,7 +56895,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -52615,7 +56940,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -52738,8 +57063,7 @@ var ts; transformAndEmitVariableDeclarationList(initializer); } else { - emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), - /*location*/ initializer)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer)); } } markLabel(conditionLabel); @@ -52749,8 +57073,7 @@ var ts; transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); if (node.incrementor) { - emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), - /*location*/ node.incrementor)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor)); } emitBreak(conditionLabel); endLoopBlock(); @@ -52764,7 +57087,7 @@ var ts; beginScriptLoopBlock(); } var initializer = node.initializer; - if (ts.isVariableDeclarationList(initializer)) { + if (initializer && ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name); @@ -52772,7 +57095,7 @@ var ts; var variables = ts.getInitializedVariables(initializer); node = ts.updateFor(node, variables.length > 0 ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable)) - : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + : undefined, ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -52864,7 +57187,7 @@ var ts; var variable = _a[_i]; hoistVariableDeclaration(variable.name); } - node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -52903,11 +57226,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitReturnStatement(node) { - emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), + emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node); } function visitReturnStatement(node) { - return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), + return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node); } function transformAndEmitWithStatement(node) { @@ -52972,7 +57295,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 257 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -52985,7 +57308,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 256 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -53127,9 +57450,9 @@ var ts; } return -1; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */) { return substituteExpression(node); } return node; @@ -53141,17 +57464,17 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_36 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_36) { - var clone_6 = ts.getMutableClone(name_36); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -53160,7 +57483,7 @@ var ts; } function cacheExpression(node) { var temp; - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.getEmitFlags(node) & 4096 /* HelperName */) { return node; } temp = ts.createTempVariable(hoistVariableDeclaration); @@ -53288,15 +57611,23 @@ var ts; */ function beginCatchBlock(variable) { ts.Debug.assert(peekBlockKind() === 0 /* Exception */); - var text = variable.name.text; - var name = declareLocal(text); - if (!renamedCatchVariables) { - renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); - context.enableSubstitution(70 /* Identifier */); + // generated identifiers should already be unique within a file + var name; + if (ts.isGeneratedIdentifier(variable.name)) { + name = variable.name; + hoistVariableDeclaration(variable.name); + } + else { + var text = variable.name.text; + name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = ts.createMap(); + renamedCatchVariableDeclarations = []; + context.enableSubstitution(70 /* Identifier */); + } + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; } - renamedCatchVariables[text] = true; - renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1 /* Catch */); var endLabel = exception.endLabel; @@ -53566,7 +57897,7 @@ var ts; */ function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + ts.addSyntheticTrailingComment(literal, 3 /* MultiLineCommentTrivia */, getInstructionName(instruction)); return literal; } /** @@ -53577,10 +57908,10 @@ var ts; */ function createInlineBreak(label, location) { ts.Debug.assert(label > 0, "Invalid label: " + label); - return ts.createReturn(ts.createArrayLiteral([ + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), location); + ])), location); } /** * Creates a statement that can be used indicate a Return operation. @@ -53589,15 +57920,16 @@ var ts; * @param location An optional source map location for the statement. */ function createInlineReturn(expression, location) { - return ts.createReturn(ts.createArrayLiteral(expression + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2 /* Return */), expression] - : [createInstruction(2 /* Return */)]), location); + : [createInstruction(2 /* Return */)])), location); } /** * Creates an expression that can be used to resume from a Yield operation. */ function createGeneratorResume(location) { - return ts.createCall(ts.createPropertyAccess(state, "sent"), /*typeArguments*/ undefined, [], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(state, "sent"), + /*typeArguments*/ undefined, []), location); } /** * Emits an empty instruction. @@ -53743,7 +58075,6 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)], /*type*/ undefined, ts.createBlock(buildResult, - /*location*/ undefined, /*multiLine*/ buildResult.length > 0)), 262144 /* ReuseTempVariableScope */)); } /** @@ -54014,7 +58345,7 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeAssign(left, right, operationLocation) { - writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation)); + writeStatement(ts.setTextRange(ts.createStatement(ts.createAssignment(left, right)), operationLocation)); } /** * Writes a Throw operation to the current label's statement list. @@ -54025,7 +58356,7 @@ var ts; function writeThrow(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createThrow(expression, operationLocation)); + writeStatement(ts.setTextRange(ts.createThrow(expression), operationLocation)); } /** * Writes a Return operation to the current label's statement list. @@ -54036,9 +58367,9 @@ var ts; function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2 /* Return */), expression] - : [createInstruction(2 /* Return */)]), operationLocation)); + : [createInstruction(2 /* Return */)])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a Break operation to the current label's statement list. @@ -54048,10 +58379,10 @@ var ts; */ function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation)); + ])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a BreakWhenTrue operation to the current label's statement list. @@ -54061,10 +58392,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a BreakWhenFalse operation to the current label's statement list. @@ -54074,10 +58405,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a Yield operation to the current label's statement list. @@ -54087,9 +58418,9 @@ var ts; */ function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4 /* Yield */), expression] - : [createInstruction(4 /* Yield */)]), operationLocation)); + : [createInstruction(4 /* Yield */)])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a YieldStar instruction to the current label's statement list. @@ -54099,10 +58430,10 @@ var ts; */ function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(5 /* YieldStar */), expression - ]), operationLocation)); + ])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes an Endfinally instruction to the current label's statement list. @@ -54183,645 +58514,500 @@ var ts; name: "typescript:generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); -/// -/// +/// +/// +/// /*@internal*/ var ts; (function (ts) { - /** - * Transforms ES5 syntax into ES3 syntax. - * - * @param context Context and state information for the transformation. - */ - function transformES5(context) { + function transformModule(context) { + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var host = context.getEmitHost(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var moduleKind = ts.getEmitModuleKind(compilerOptions); var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(257 /* PropertyAssignment */); + context.onEmitNode = onEmitNode; + context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(261 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(264 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. + var currentSourceFile; // The current file. + var currentModuleInfo; // The ExternalModuleInfo for the current file. + var noSubstitution; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; /** - * Transforms an ES5 source file to ES3. + * Transforms the module aspects of a SourceFile. * - * @param node A SourceFile + * @param node The SourceFile node. */ function transformSourceFile(node) { - return node; + if (ts.isDeclarationFile(node) || !(ts.isExternalModule(node) || compilerOptions.isolatedModules)) { + return node; + } + currentSourceFile = node; + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + // Perform the transformation. + var transformModule = getTransformModuleDelegate(moduleKind); + var updated = transformModule(node); + currentSourceFile = undefined; + currentModuleInfo = undefined; + return ts.aggregateTransformFlags(updated); + } + function shouldEmitUnderscoreUnderscoreESModule() { + if (!currentModuleInfo.exportEquals && ts.isExternalModule(currentSourceFile)) { + return true; + } + return false; } /** - * Hooks node substitutions. + * Transforms a SourceFile into a CommonJS module. * - * @param emitContext The context for the emitter. - * @param node The node to substitute. + * @param node The SourceFile node. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isPropertyAccessExpression(node)) { - return substitutePropertyAccessExpression(node); + function transformCommonJSModule(node) { + startLexicalEnvironment(); + var statements = []; + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); } - else if (ts.isPropertyAssignment(node)) { - return substitutePropertyAssignment(node); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); + ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); + addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); + ts.addRange(statements, endLexicalEnvironment()); + var updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); + if (currentModuleInfo.hasExportStarsToExportValues) { + // If we have any `export * from ...` declarations + // we need to inform the emitter to add the __export helper. + ts.addEmitHelper(updated, exportStarHelper); } - return node; + return updated; } /** - * Substitutes a PropertyAccessExpression whose name is a reserved word. + * Transforms a SourceFile into an AMD module. * - * @param node A PropertyAccessExpression + * @param node The SourceFile node. */ - function substitutePropertyAccessExpression(node) { - var literalName = trySubstituteReservedName(node.name); - if (literalName) { - return ts.createElementAccess(node.expression, literalName, /*location*/ node); - } - return node; + function transformAMDModule(node) { + var define = ts.createIdentifier("define"); + var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); + // An AMD define function has the following shape: + // + // define(id?, dependencies?, factory); + // + // This has the shape of the following: + // + // define(name, ["module1", "module2"], function (module1Alias) { ... } + // + // The location of the alias in the parameter list in the factory function needs to + // match the position of the module name in the dependency list. + // + // To ensure this is true in cases of modules with no aliases, e.g.: + // + // import "module" + // + // or + // + // /// + // + // we need to add modules without alias names to the end of the dependencies list + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + // Create an updated SourceFile: + // + // define(moduleName?, ["module1", "module2"], function ... + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(define, + /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([ + // Add the dependency array argument: + // + // ["require", "exports", module1", "module2", ...] + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + // Add the module body function argument: + // + // function (require, exports, module1, module2) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ]))) + ]), + /*location*/ node.statements)); } /** - * Substitutes a PropertyAssignment whose name is a reserved word. + * Transforms a SourceFile into a UMD module. * - * @param node A PropertyAssignment + * @param node The SourceFile node. */ - function substitutePropertyAssignment(node) { - var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); - if (literalName) { - return ts.updatePropertyAssignment(node, literalName, node.initializer); - } - return node; + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "factory")], + /*type*/ undefined, ts.setTextRange(ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, [ + ts.createVariableDeclaration("v", + /*type*/ undefined, ts.createCall(ts.createIdentifier("factory"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1 /* SingleLine */) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), + /*typeArguments*/ undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], + /*multiLine*/ true), + /*location*/ undefined)); + // Create an updated SourceFile: + // + // (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 ...) + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, + /*typeArguments*/ undefined, [ + // Add the module body function argument: + // + // function (require, exports) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ])) + ]), + /*location*/ node.statements)); } /** - * If an identifier name is a reserved word, returns a string literal for the name. + * Collect the additional asynchronous dependencies for the module. * - * @param name An Identifier + * @param node The source file. + * @param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies. */ - function trySubstituteReservedName(name) { - var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); - if (token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */) { - return ts.createLiteral(name, /*location*/ name); + function collectAsynchronousDependencies(node, includeNonAmdDependencies) { + // names of modules with corresponding parameter in the factory function + var aliasedModuleNames = []; + // names of modules with no corresponding parameters in factory function + var unaliasedModuleNames = []; + // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding + // module names in aliasedModuleNames. + var importAliasNames = []; + // Fill in amd-dependency tags + for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { + var amdDependency = _a[_i]; + if (amdDependency.name) { + aliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, amdDependency.name)); + } + else { + unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + } } - return undefined; + for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { + var importNode = _c[_b]; + // Find the name of the external module + var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + // Find the name of the module alias, if there is one + var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); + // It is possible that externalModuleName is undefined if it is not string literal. + // This can happen in the invalid import syntax. + // E.g : "import * from alias from 'someLib';" + if (externalModuleName) { + if (includeNonAmdDependencies && importAliasName) { + // Set emitFlags on the name of the classDeclaration + // This is so that when printer will not substitute the identifier + ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */); + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName)); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; } - } - ts.transformES5 = transformES5; -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; -(function (ts) { - function transformES2015Module(context) { - var compilerOptions = context.getCompilerOptions(); - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261 /* SourceFile */); - context.enableSubstitution(70 /* Identifier */); - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; + /** + * Transforms a SourceFile into an AMD or UMD module body. + * + * @param node The SourceFile node. + */ + function transformAsynchronousModuleBody(node) { + startLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); } - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); - if (externalHelpersModuleName) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements); - ts.append(statements, ts.createImportDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); - ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + // Visit each statement of the module body. + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); + ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); + // Append the 'export =' statement if provided. + addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true); + // End the lexical environment for the module body + // and merge any new lexical declarations. + ts.addRange(statements, endLexicalEnvironment()); + var body = ts.createBlock(statements, /*multiLine*/ true); + if (currentModuleInfo.hasExportStarsToExportValues) { + // If we have any `export * from ...` declarations + // we need to inform the emitter to add the __export helper. + ts.addEmitHelper(body, exportStarHelper); + } + return body; + } + /** + * Adds the down-level representation of `export=` to the statement list if one exists + * in the source file. + * + * @param statements The Statement list to modify. + * @param emitAsReturn A value indicating whether to emit the `export=` statement as a + * return statement. + */ + function addExportEqualsIfNeeded(statements, emitAsReturn) { + if (currentModuleInfo.exportEquals) { + if (emitAsReturn) { + var statement = ts.createReturn(currentModuleInfo.exportEquals.expression); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */); + statements.push(statement); } else { - return ts.visitEachChild(node, visitor, context); + var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression)); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 1536 /* NoComments */); + statements.push(statement); } } - return node; } - function visitor(node) { + // + // Top-Level Source Element Visitors + // + /** + * Visits a node at the top level of the source file. + * + * @param node The node to visit. + */ + function sourceElementVisitor(node) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - // Elide `import=` as it is not legal with --module ES6 - return undefined; - case 240 /* ExportAssignment */: + case 237 /* ImportDeclaration */: + return visitImportDeclaration(node); + case 236 /* ImportEqualsDeclaration */: + return visitImportEqualsDeclaration(node); + case 243 /* ExportDeclaration */: + return visitExportDeclaration(node); + case 242 /* ExportAssignment */: return visitExportAssignment(node); + case 207 /* VariableStatement */: + return visitVariableStatement(node); + case 227 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 228 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 296 /* MergeDeclarationMarker */: + return visitMergeDeclarationMarker(node); + case 297 /* EndOfDeclarationMarker */: + return visitEndOfDeclarationMarker(node); + default: + // This visitor does not descend into the tree, as export/import statements + // are only transformed at the top level of a file. + return node; } - return node; - } - function visitExportAssignment(node) { - // Elide `export=` as it is not legal with --module ES6 - return node.isExportEquals ? undefined : node; } - // - // Emit Notification - // /** - * Hook for node emit. + * Visits an ImportDeclaration node. * - * @param emitContext A context hint for the emitter. - * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. + * @param node The node to visit. */ - function onEmitNode(emitContext, node, emitCallback) { - if (ts.isSourceFile(node)) { - currentSourceFile = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSourceFile = undefined; + function visitImportDeclaration(node) { + var statements; + var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); + if (moduleKind !== ts.ModuleKind.AMD) { + if (!node.importClause) { + // import "mod"; + return ts.setTextRange(ts.createStatement(createRequireCall(node)), node); + } + else { + var variables = []; + if (namespaceDeclaration && !ts.isDefaultImport(node)) { + // import * as n from "mod"; + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, createRequireCall(node))); + } + else { + // import d from "mod"; + // import { x, y } from "mod"; + // import d, { x, y } from "mod"; + // import d, * as n from "mod"; + variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), + /*type*/ undefined, createRequireCall(node))); + if (namespaceDeclaration && ts.isDefaultImport(node)) { + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, ts.getGeneratedNameForNode(node))); + } + } + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(variables, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)), + /*location*/ node)); + } + } + else if (namespaceDeclaration && ts.isDefaultImport(node)) { + // import d, * as n from "mod"; + statements = ts.append(statements, ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, ts.getGeneratedNameForNode(node)), + /*location*/ node) + ], languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */))); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); } else { - previousOnEmitNode(emitContext, node, emitCallback); + statements = appendExportsOfImportDeclaration(statements, node); } + return ts.singleOrMany(statements); } - // - // Substitutions - // /** - * Hooks node substitutions. + * Creates a `require()` call to import an external module. * - * @param emitContext A context hint for the emitter. - * @param node The node to substitute. + * @param importNode The declararation to import. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isIdentifier(node) && emitContext === 1 /* Expression */) { - return substituteExpressionIdentifier(node); - } - return node; - } - function substituteExpressionIdentifier(node) { - if (ts.getEmitFlags(node) & 4096 /* HelperName */) { - var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); - if (externalHelpersModuleName) { - return ts.createPropertyAccess(externalHelpersModuleName, node); - } + function createRequireCall(importNode) { + var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + var args = []; + if (moduleName) { + args.push(moduleName); } - return node; + return ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, args); } - } - ts.transformES2015Module = transformES2015Module; -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; -(function (ts) { - function transformSystemModule(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; - var compilerOptions = context.getCompilerOptions(); - var resolver = context.getEmitResolver(); - var host = context.getEmitHost(); - var previousOnSubstituteNode = context.onSubstituteNode; - var previousOnEmitNode = context.onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.onEmitNode = onEmitNode; - context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. - var exportFunctionsMap = ts.createMap(); // The export function associated with a source file. - var noSubstitutionMap = ts.createMap(); // Set of nodes for which substitution rules should be ignored for each file. - var currentSourceFile; // The current file. - var moduleInfo; // ExternalModuleInfo for the current file. - var exportFunction; // The export function for the current file. - var contextObject; // The context object for the current file. - var hoistedStatements; - var enclosingBlockScopedContainer; - var noSubstitution; // Set of nodes for which substitution rules should be ignored. - return transformSourceFile; /** - * Transforms the module aspects of a SourceFile. + * Visits an ImportEqualsDeclaration node. * - * @param node The SourceFile node. + * @param node The node to visit. */ - function transformSourceFile(node) { - if (ts.isDeclarationFile(node) - || !(ts.isExternalModule(node) - || compilerOptions.isolatedModules)) { - return node; - } - var id = ts.getOriginalNodeId(node); - currentSourceFile = node; - enclosingBlockScopedContainer = node; - // System modules have the following shape: - // - // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) - // - // The parameter 'exports' here is a callback '(name: string, value: T) => T' that - // is used to publish exported values. 'exports' returns its 'value' argument so in - // most cases expressions that mutate exported values can be rewritten as: - // - // expr -> exports('name', expr) - // - // The only exception in this rule is postfix unary operators, - // see comment to 'substitutePostfixUnaryExpression' for more details - // Collect information about the external module and dependency groups. - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - // Make sure that the name of the 'exports' function does not conflict with - // existing identifiers. - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); - contextObject = ts.createUniqueName("context"); - // Add the body of the module. - var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); - var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); - var moduleBodyFunction = ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) - ], - /*type*/ undefined, moduleBodyBlock); - // Write the call to `System.register` - // Clear the emit-helpers flag for later passes since we'll have already used it in the module body - // So the helper will be emit at the correct position instead of at the top of the source-file - var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ - ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), - /*typeArguments*/ undefined, moduleName - ? [moduleName, dependencies, moduleBodyFunction] - : [dependencies, moduleBodyFunction])) - ], node.statements)); - if (!(compilerOptions.outFile || compilerOptions.out)) { - ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); - } - if (noSubstitution) { - noSubstitutionMap[id] = noSubstitution; - noSubstitution = undefined; - } - currentSourceFile = undefined; - moduleInfo = undefined; - exportFunction = undefined; - contextObject = undefined; - hoistedStatements = undefined; - enclosingBlockScopedContainer = undefined; - return ts.aggregateTransformFlags(updated); - } - /** - * Collects the dependency groups for this files imports. - * - * @param externalImports The imports for the file. - */ - function collectDependencyGroups(externalImports) { - var groupIndices = ts.createMap(); - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; i++) { - var externalImport = externalImports[i]; - var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); - var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].externalImports.push(externalImport); + function visitImportEqualsDeclaration(node) { + ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + var statements; + if (moduleKind !== ts.ModuleKind.AMD) { + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(node.name, createRequireCall(node))), node)); } else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push({ - name: externalModuleName, - externalImports: [externalImport] - }); - } - } - return dependencyGroups; - } - /** - * Adds the statements for the module body function for the source file. - * - * @param node The source file for the module. - * @param dependencyGroups The grouped dependencies of the module. - */ - function createSystemModuleBody(node, dependencyGroups) { - // Shape of the body in system modules: - // - // function (exports) { - // - // - // - // return { - // setters: [ - // - // ], - // execute: function() { - // - // } - // } - // - // } - // - // i.e: - // - // import {x} from 'file1' - // var y = 1; - // export function foo() { return y + x(); } - // console.log(y); - // - // Will be transformed to: - // - // function(exports) { - // function foo() { return y + file_1.x(); } - // exports("foo", foo); - // var file_1, y; - // return { - // setters: [ - // function(v) { file_1 = v } - // ], - // execute(): function() { - // y = 1; - // console.log(y); - // } - // }; - // } - var statements = []; - // We start a new lexical environment in this function body, but *not* in the - // body of the execute function. This allows us to emit temporary declarations - // only in the outer module body and not in the inner one. - startLexicalEnvironment(); - // Add any prologue directives. - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - // var __moduleName = context_1 && context_1.id; - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("__moduleName", - /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) - ]))); - // Visit the synthetic external helpers import declaration if present - ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true); - // Visit the statements of the source file, emitting any transformations into - // the `executeStatements` array. We do this *before* we fill the `setters` array - // as we both emit transformations as well as aggregate some data used when creating - // setters. This allows us to reduce the number of times we need to loop through the - // statements of the source file. - var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); - // Emit early exports for function declarations. - ts.addRange(statements, hoistedStatements); - // We emit hoisted variables early to align roughly with our previous emit output. - // Two key differences in this approach are: - // - Temporary variables will appear at the top rather than at the bottom of the file - ts.addRange(statements, endLexicalEnvironment()); - var exportStarFunction = addExportStarIfNeeded(statements); - statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([ - ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), - ts.createPropertyAssignment("execute", ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, - /*parameters*/ [], - /*type*/ undefined, ts.createBlock(executeStatements, - /*location*/ undefined, - /*multiLine*/ true))) - ]), - /*multiLine*/ true))); - return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); - } - /** - * Adds an exportStar function to a statement list if it is needed for the file. - * - * @param statements A statement list. - */ - function addExportStarIfNeeded(statements) { - if (!moduleInfo.hasExportStarsToExportValues) { - return; - } - // when resolving exports local exported entries/indirect exported entries in the module - // should always win over entries with similar names that were added via star exports - // to support this we store names of local/indirect exported entries in a set. - // this set is used to filter names brought by star expors. - // local names set should only be added if we have anything exported - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { - // no exported declarations (export var ...) or export specifiers (export {x}) - // check if we have any non star export declarations. - var hasExportDeclarationWithExportClause = false; - for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { - var externalImport = _a[_i]; - if (externalImport.kind === 241 /* ExportDeclaration */ && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - // we still need to emit exportStar helper - var exportStarFunction_1 = createExportStarFunction(/*localNames*/ undefined); - statements.push(exportStarFunction_1); - return exportStarFunction_1.name; - } - } - var exportedNames = []; - if (moduleInfo.exportedNames) { - for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { - var exportedLocalName = _c[_b]; - if (exportedLocalName.text === "default") { - continue; - } - // write name of exported declaration, i.e 'export var x...' - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true))); - } - } - for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { - var externalImport = _e[_d]; - if (externalImport.kind !== 241 /* ExportDeclaration */) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - // export * from ... - continue; - } - for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { - var element = _g[_f]; - // write name of indirectly exported entry, i.e. 'export {x} from ...' - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true))); + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), + /*type*/ undefined, createRequireCall(node)) + ], + /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)), node)); } } - var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exportedNamesStorageRef, - /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*location*/ undefined, /*multiline*/ true)) - ]))); - var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); - statements.push(exportStarFunction); - return exportStarFunction.name; - } - /** - * Creates an exportStar function for the file, with an optional set of excluded local - * names. - * - * @param localNames An optional reference to an object containing a set of excluded local - * names. - */ - function createExportStarFunction(localNames) { - var exportStarFunction = ts.createUniqueName("exportStar"); - var m = ts.createIdentifier("m"); - var n = ts.createIdentifier("n"); - var exports = ts.createIdentifier("exports"); - var condition = ts.createStrictInequality(n, ts.createLiteral("default")); - if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), - /*typeArguments*/ undefined, [n]))); - } - return ts.createFunctionDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, exportStarFunction, - /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, m)], - /*type*/ undefined, ts.createBlock([ - ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exports, - /*type*/ undefined, ts.createObjectLiteral([])) - ])), - ts.createForIn(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(n, /*type*/ undefined) - ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */) - ])), - ts.createStatement(ts.createCall(exportFunction, - /*typeArguments*/ undefined, [exports])) - ], - /*location*/ undefined, - /*multiline*/ true)); - } - /** - * Creates an array setter callbacks for each dependency group. - * - * @param exportStarFunction A reference to an exportStarFunction for the file. - * @param dependencyGroups An array of grouped dependencies. - */ - function createSettersArray(exportStarFunction, dependencyGroups) { - var setters = []; - for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { - var group = dependencyGroups_1[_i]; - // derive a unique name for parameter from the first named entry in the group - var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); }); - var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""); - var statements = []; - for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) { - var entry = _b[_a]; - var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); - switch (entry.kind) { - case 235 /* ImportDeclaration */: - if (!entry.importClause) { - // 'import "..."' case - // module is imported only for side-effects, no emit required - break; - } - // fall-through - case 234 /* ImportEqualsDeclaration */: - ts.Debug.assert(importVariableName !== undefined); - // save import into the local - statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); - break; - case 241 /* ExportDeclaration */: - ts.Debug.assert(importVariableName !== undefined); - if (entry.exportClause) { - // export {a, b as c} from 'foo' - // - // emit as: - // - // exports_({ - // "a": _["a"], - // "c": _["b"] - // }); - var properties = []; - for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { - var e = _d[_c]; - properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); - } - statements.push(ts.createStatement(ts.createCall(exportFunction, - /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*location*/ undefined, /*multiline*/ true)]))); - } - else { - // export * from 'foo' - // - // emit as: - // - // exportStar(foo_1_1); - statements.push(ts.createStatement(ts.createCall(exportStarFunction, - /*typeArguments*/ undefined, [parameterName]))); - } - break; - } + else { + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node))), node)); } - setters.push(ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], - /*type*/ undefined, ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true))); - } - return ts.createArrayLiteral(setters, /*location*/ undefined, /*multiLine*/ true); - } - // - // Top-level Source Element Visitors - // - /** - * Visit source elements at the top-level of a module. - * - * @param node The node to visit. - */ - function sourceElementVisitor(node) { - switch (node.kind) { - case 235 /* ImportDeclaration */: - return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: - return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: - // ExportDeclarations are elided as they are handled via - // `appendExportsOfDeclaration`. - return undefined; - case 240 /* ExportAssignment */: - return visitExportAssignment(node); - default: - return nestedElementVisitor(node); - } - } - /** - * Visits an ImportDeclaration node. - * - * @param node The node to visit. - */ - function visitImportDeclaration(node) { - var statements; - if (node.importClause) { - hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); } else { - statements = appendExportsOfImportDeclaration(statements, node); + statements = appendExportsOfImportEqualsDeclaration(statements, node); } return ts.singleOrMany(statements); } /** - * Visits an ImportEqualsDeclaration node. + * Visits an ExportDeclaration node. * - * @param node The node to visit. + * @param The node to visit. */ - function visitImportEqualsDeclaration(node) { - ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); - var statements; - hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); - if (hasAssociatedEndOfDeclarationMarker(node)) { - // Defer exports until we encounter an EndOfDeclarationMarker node - var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + function visitExportDeclaration(node) { + if (!node.moduleSpecifier) { + // Elide export declarations with no module specifier as they are handled + // elsewhere. + return undefined; + } + var generatedName = ts.getGeneratedNameForNode(node); + if (node.exportClause) { + var statements = []; + // export { x, y } from "mod"; + if (moduleKind !== ts.ModuleKind.AMD) { + statements.push(ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(generatedName, + /*type*/ undefined, createRequireCall(node)) + ])), + /*location*/ node)); + } + for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { + var specifier = _a[_i]; + var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); + statements.push(ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue)), specifier)); + } + return ts.singleOrMany(statements); } else { - statements = appendExportsOfImportEqualsDeclaration(statements, node); + // export * from "mod"; + return ts.setTextRange(ts.createStatement(ts.createCall(ts.createIdentifier("__export"), + /*typeArguments*/ undefined, [ + moduleKind !== ts.ModuleKind.AMD + ? createRequireCall(node) + : generatedName + ])), node); } - return ts.singleOrMany(statements); } /** * Visits an ExportAssignment node. @@ -54830,33 +59016,37 @@ var ts; */ function visitExportAssignment(node) { if (node.isExportEquals) { - // Elide `export=` as it is illegal in a SystemJS module. return undefined; } - var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression); + var statements; var original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, /*allowComments*/ true); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); } else { - return createExportStatement(ts.createIdentifier("default"), expression, /*allowComments*/ true); + statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); } + return ts.singleOrMany(statements); } /** - * Visits a FunctionDeclaration, hoisting it to the outer module body function. + * Visits a FunctionDeclaration node. * * @param node The node to visit. */ function visitFunctionDeclaration(node) { + var statements; if (ts.hasModifier(node, 1 /* Export */)) { - hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), - /*type*/ undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration( + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, node.parameters, + /*type*/ undefined, node.body), + /*location*/ node), + /*original*/ node)); } else { - hoistedStatements = ts.append(hoistedStatements, node); + statements = ts.append(statements, node); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node @@ -54864,26 +59054,25 @@ var ts; deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { - hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); + statements = appendExportsOfHoistedDeclaration(statements, node); } - return undefined; + return ts.singleOrMany(statements); } /** - * Visits a ClassDeclaration, hoisting its name to the outer module body function. + * Visits a ClassDeclaration node. * * @param node The node to visit. */ function visitClassDeclaration(node) { var statements; - // Hoist the name of the class declaration to the outer module body function. - var name = ts.getLocalName(node); - hoistVariableDeclaration(name); - // Rewrite the class declaration into an assignment of a class expression. - statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression( - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), - /*location*/ node)), - /*location*/ node)); + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration( + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, node.heritageClauses, node.members), node), node)); + } + else { + statements = ts.append(statements, node); + } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); @@ -54895,116 +59084,65 @@ var ts; return ts.singleOrMany(statements); } /** - * Visits a variable statement, hoisting declared names to the top-level module body. - * Each declaration is rewritten into an assignment expression. + * Visits a VariableStatement node. * * @param node The node to visit. */ function visitVariableStatement(node) { - if (!shouldHoistVariableDeclarationList(node.declarationList)) { - return ts.visitNode(node, destructuringVisitor, ts.isStatement); - } + var statements; + var variables; var expressions; - var isExportedDeclaration = ts.hasModifier(node, 1 /* Export */); - var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); - for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - if (variable.initializer) { - expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); + if (ts.hasModifier(node, 1 /* Export */)) { + var modifiers = void 0; + // If we're exporting these variables, then these just become assignments to 'exports.x'. + // We only want to emit assignments for variables with initializers. + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) { + if (!modifiers) { + modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier); + } + variables = ts.append(variables, variable); + } + else if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable)); + } } - else { - hoistBindingElement(variable); + if (variables) { + statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); + } + if (expressions) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } } - var statements; - if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node)); + else { + statements = ts.append(statements, node); } - if (isMarkedDeclaration) { + if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); } else { - statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false); + statements = appendExportsOfVariableStatement(statements, node); } return ts.singleOrMany(statements); } /** - * Hoists the declared names of a VariableDeclaration or BindingElement. - * - * @param node The declaration to hoist. - */ - function hoistBindingElement(node) { - if (ts.isBindingPattern(node.name)) { - for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!ts.isOmittedExpression(element)) { - hoistBindingElement(element); - } - } - } - else { - hoistVariableDeclaration(ts.getSynthesizedClone(node.name)); - } - } - /** - * Determines whether a VariableDeclarationList should be hoisted. - * - * @param node The node to test. - */ - function shouldHoistVariableDeclarationList(node) { - // hoist only non-block scoped declarations or block scoped declarations parented by source file - return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */ - || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); - } - /** - * Transform an initialized variable declaration into an expression. + * Transforms an exported variable with an initializer into an expression. * * @param node The node to transform. - * @param isExportedDeclaration A value indicating whether the variable is exported. - */ - function transformInitializedVariable(node, isExportedDeclaration) { - var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; - return ts.isBindingPattern(node.name) - ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, - /*needsValue*/ false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); - } - /** - * Creates an assignment expression for an exported variable declaration. - * - * @param name The name of the variable. - * @param value The value of the variable's initializer. - * @param location The source map location for the assignment. - */ - function createExportedVariableAssignment(name, value, location) { - return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ true); - } - /** - * Creates an assignment expression for a non-exported variable declaration. - * - * @param name The name of the variable. - * @param value The value of the variable's initializer. - * @param location The source map location for the assignment. - */ - function createNonExportedVariableAssignment(name, value, location) { - return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ false); - } - /** - * Creates an assignment expression for a variable declaration. - * - * @param name The name of the variable. - * @param value The value of the variable's initializer. - * @param location The source map location for the assignment. - * @param isExportedDeclaration A value indicating whether the variable is exported. */ - function createVariableAssignment(name, value, location, isExportedDeclaration) { - hoistVariableDeclaration(ts.getSynthesizedClone(name)); - return isExportedDeclaration - ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location))) - : preventSubstitution(ts.createAssignment(name, value, location)); + function transformInitializedVariable(node) { + if (ts.isBindingPattern(node.name)) { + return ts.flattenDestructuringAssignment(node, + /*visitor*/ undefined, context, 0 /* All */, + /*needsValue*/ false, createExportExpression); + } + else { + return ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name), + /*location*/ node.name), node.initializer); + } } /** * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged @@ -55018,12 +59156,11 @@ var ts; // begin/end semantics of the declararation and to properly handle exports // we wrapped the leading variable declaration in a `MergeDeclarationMarker`. // - // To balance the declaration, we defer the exports of the elided variable - // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + // To balance the declaration, add the exports of the elided variable + // statement. + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); - var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } return node; } @@ -55063,7 +59200,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } var importClause = decl.importClause; @@ -55076,10 +59213,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -55090,7 +59227,7 @@ var ts; return statements; } /** - * Appends the export of an ImportEqualsDeclaration to a statement list, returning the + * Appends the exports of an ImportEqualsDeclaration to a statement list, returning the * statement list. * * @param statements A statement list to which the down-level export statements are to be @@ -55099,7 +59236,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportEqualsDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } return appendExportsOfDeclaration(statements, decl); @@ -55112,18 +59249,14 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param node The VariableStatement whose exports are to be recorded. - * @param exportSelf A value indicating whether to also export each VariableDeclaration of - * `nodes` declaration list. */ - function appendExportsOfVariableStatement(statements, node, exportSelf) { - if (moduleInfo.exportEquals) { + function appendExportsOfVariableStatement(statements, node) { + if (currentModuleInfo.exportEquals) { return statements; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.initializer || exportSelf) { - statements = appendExportsOfBindingElement(statements, decl, exportSelf); - } + statements = appendExportsOfBindingElement(statements, decl); } return statements; } @@ -55135,27 +59268,21 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration whose exports are to be recorded. - * @param exportSelf A value indicating whether to also export the declaration itself. */ - function appendExportsOfBindingElement(statements, decl, exportSelf) { - if (moduleInfo.exportEquals) { + function appendExportsOfBindingElement(statements, decl) { + if (currentModuleInfo.exportEquals) { return statements; } if (ts.isBindingPattern(decl.name)) { for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { - statements = appendExportsOfBindingElement(statements, element, exportSelf); + statements = appendExportsOfBindingElement(statements, element); } } } else if (!ts.isGeneratedIdentifier(decl.name)) { - var excludeName = void 0; - if (exportSelf) { - statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); - excludeName = decl.name.text; - } - statements = appendExportsOfDeclaration(statements, decl, excludeName); + statements = appendExportsOfDeclaration(statements, decl); } return statements; } @@ -55169,17 +59296,15 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfHoistedDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } - var excludeName; if (ts.hasModifier(decl, 1 /* Export */)) { - var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createLiteral("default") : decl.name; - statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); - excludeName = exportName.text; + var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createIdentifier("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), /*location*/ decl); } if (decl.name) { - statements = appendExportsOfDeclaration(statements, decl, excludeName); + statements = appendExportsOfDeclaration(statements, decl); } return statements; } @@ -55190,20 +59315,14 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration to export. - * @param excludeName An optional name to exclude from exports. */ - function appendExportsOfDeclaration(statements, decl, excludeName) { - if (moduleInfo.exportEquals) { - return statements; - } + function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; - if (exportSpecifier.name.text !== excludeName) { - statements = appendExportStatement(statements, exportSpecifier.name, name); - } + statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name); } } return statements; @@ -55217,21 +59336,41 @@ var ts; * appended. * @param exportName The name of the export. * @param expression The expression to export. + * @param location The location to use for source maps and comments for the export. * @param allowComments Whether to allow comments on the export. */ - function appendExportStatement(statements, exportName, expression, allowComments) { - statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)); + function appendExportStatement(statements, exportName, expression, location, allowComments) { + statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); return statements; } + function createUnderscoreUnderscoreESModule() { + var statement; + if (languageVersion === 0 /* ES3 */) { + statement = ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(/*value*/ true))); + } + else { + statement = ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("exports"), + ts.createLiteral("__esModule"), + ts.createObjectLiteral([ + ts.createPropertyAssignment("value", ts.createLiteral(/*value*/ true)) + ]) + ])); + } + ts.setEmitFlags(statement, 524288 /* CustomPrologue */); + return statement; + } /** * Creates a call to the current file's export function to export a value. * * @param name The bound name of the export. * @param value The exported value. + * @param location The location to use for source maps and comments for the export. * @param allowComments An optional value indicating whether to emit comments for the statement. */ - function createExportStatement(name, value, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value)); + function createExportStatement(name, value, location, allowComments) { + var statement = ts.setTextRange(ts.createStatement(createExportExpression(name, value)), location); ts.startOnNewLine(statement); if (!allowComments) { ts.setEmitFlags(statement, 1536 /* NoComments */); @@ -55243,290 +59382,10 @@ var ts; * * @param name The bound name of the export. * @param value The exported value. + * @param location The location to use for source maps and comments for the export. */ - function createExportExpression(name, value) { - var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; - return ts.createCall(exportFunction, /*typeArguments*/ undefined, [exportName, value]); - } - // - // Top-Level or Nested Source Element Visitors - // - /** - * Visit nested elements at the top-level of a module. - * - * @param node The node to visit. - */ - function nestedElementVisitor(node) { - switch (node.kind) { - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: - return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: - return visitClassDeclaration(node); - case 211 /* ForStatement */: - return visitForStatement(node); - case 212 /* ForInStatement */: - return visitForInStatement(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 209 /* DoStatement */: - return visitDoStatement(node); - case 210 /* WhileStatement */: - return visitWhileStatement(node); - case 219 /* LabeledStatement */: - return visitLabeledStatement(node); - case 217 /* WithStatement */: - return visitWithStatement(node); - case 218 /* SwitchStatement */: - return visitSwitchStatement(node); - case 232 /* CaseBlock */: - return visitCaseBlock(node); - case 253 /* CaseClause */: - return visitCaseClause(node); - case 254 /* DefaultClause */: - return visitDefaultClause(node); - case 221 /* TryStatement */: - return visitTryStatement(node); - case 256 /* CatchClause */: - return visitCatchClause(node); - case 204 /* Block */: - return visitBlock(node); - case 295 /* MergeDeclarationMarker */: - return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: - return visitEndOfDeclarationMarker(node); - default: - return destructuringVisitor(node); - } - } - /** - * Visits the body of a ForStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitForStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a ForInStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitForInStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a ForOfStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitForOfStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Determines whether to hoist the initializer of a ForStatement, ForInStatement, or - * ForOfStatement. - * - * @param node The node to test. - */ - function shouldHoistForInitializer(node) { - return ts.isVariableDeclarationList(node) - && shouldHoistVariableDeclarationList(node); - } - /** - * Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement - * - * @param node The node to visit. - */ - function visitForInitializer(node) { - if (shouldHoistForInitializer(node)) { - var expressions = void 0; - for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); - } - return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); - } - else { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - } - /** - * Visits the body of a DoStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitDoStatement(node) { - return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); - } - /** - * Visits the body of a WhileStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitWhileStatement(node) { - return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - } - /** - * Visits the body of a LabeledStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitLabeledStatement(node) { - return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - } - /** - * Visits the body of a WithStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitWithStatement(node) { - return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - } - /** - * Visits the body of a SwitchStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitSwitchStatement(node) { - return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); - } - /** - * Visits the body of a CaseBlock to hoist declarations. - * - * @param node The node to visit. - */ - function visitCaseBlock(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a CaseClause to hoist declarations. - * - * @param node The node to visit. - */ - function visitCaseClause(node) { - return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)); - } - /** - * Visits the body of a DefaultClause to hoist declarations. - * - * @param node The node to visit. - */ - function visitDefaultClause(node) { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - /** - * Visits the body of a TryStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitTryStatement(node) { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - /** - * Visits the body of a CatchClause to hoist declarations. - * - * @param node The node to visit. - */ - function visitCatchClause(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a Block to hoist declarations. - * - * @param node The node to visit. - */ - function visitBlock(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.visitEachChild(node, nestedElementVisitor, context); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - // - // Destructuring Assignment Visitors - // - /** - * Visit nodes to flatten destructuring assignments to exported symbols. - * - * @param node The node to visit. - */ - function destructuringVisitor(node) { - if (node.transformFlags & 1024 /* DestructuringAssignment */ - && node.kind === 192 /* BinaryExpression */) { - return visitDestructuringAssignment(node); - } - else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { - return ts.visitEachChild(node, destructuringVisitor, context); - } - else { - return node; - } - } - /** - * Visits a DestructuringAssignment to flatten destructuring to exported symbols. - * - * @param node The node to visit. - */ - function visitDestructuringAssignment(node) { - if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, - /*needsValue*/ true); - } - return ts.visitEachChild(node, destructuringVisitor, context); - } - /** - * Determines whether the target of a destructuring assigment refers to an exported symbol. - * - * @param node The destructuring target. - */ - function hasExportedReferenceInDestructuringTarget(node) { - if (ts.isAssignmentExpression(node)) { - return hasExportedReferenceInDestructuringTarget(node.left); - } - else if (ts.isSpreadExpression(node)) { - return hasExportedReferenceInDestructuringTarget(node.expression); - } - else if (ts.isObjectLiteralExpression(node)) { - return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); - } - else if (ts.isArrayLiteralExpression(node)) { - return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); - } - else if (ts.isShorthandPropertyAssignment(node)) { - return hasExportedReferenceInDestructuringTarget(node.name); - } - else if (ts.isPropertyAssignment(node)) { - return hasExportedReferenceInDestructuringTarget(node.initializer); - } - else if (ts.isIdentifier(node)) { - var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261 /* SourceFile */; - } - else { - return false; - } + function createExportExpression(name, value, location) { + return ts.setTextRange(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value), location); } // // Modifier Visitors @@ -55537,6 +59396,7 @@ var ts; * @param node The node to visit. */ function modifierVisitor(node) { + // Elide module-specific modifiers. switch (node.kind) { case 83 /* ExportKeyword */: case 78 /* DefaultKeyword */: @@ -55550,28 +59410,22 @@ var ts; /** * Hook for node emit notifications. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emit A callback used to emit the node in the printer. */ - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { - var id = ts.getOriginalNodeId(node); + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264 /* SourceFile */) { currentSourceFile = node; - moduleInfo = moduleInfoMap[id]; - exportFunction = exportFunctionsMap[id]; - noSubstitution = noSubstitutionMap[id]; - if (noSubstitution) { - delete noSubstitutionMap[id]; - } - previousOnEmitNode(emitContext, node, emitCallback); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; + noSubstitution = []; + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; - moduleInfo = undefined; - exportFunction = undefined; + currentModuleInfo = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } // @@ -55580,21 +59434,44 @@ var ts; /** * Hooks node substitutions. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (isSubstitutionPrevented(node)) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (node.id && noSubstitution[node.id]) { return node; } - if (emitContext === 1 /* Expression */) { + if (hint === 1 /* Expression */) { return substituteExpression(node); } + else if (ts.isShorthandPropertyAssignment(node)) { + return substituteShorthandPropertyAssignment(node); + } return node; } /** - * Substitute the expression, if necessary. + * Substitution for a ShorthandPropertyAssignment whose declaration name is an imported + * or exported symbol. + * + * @param node The node to substitute. + */ + function substituteShorthandPropertyAssignment(node) { + var name = node.name; + var exportedOrImportedName = substituteExpressionIdentifier(name); + if (exportedOrImportedName !== name) { + // A shorthand property with an assignment initializer is probably part of a + // destructuring assignment + if (node.objectAssignmentInitializer) { + var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); + } + return ts.setTextRange(ts.createPropertyAssignment(name, exportedOrImportedName), node); + } + return node; + } + /** + * Substitution for an Expression that may contain an imported or exported symbol. * * @param node The node to substitute. */ @@ -55602,16 +59479,17 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; } /** - * Substitution for an Identifier expression that may contain an imported or exported symbol. + * Substitution for an Identifier expression that may contain an imported or exported + * symbol. * * @param node The node to substitute. */ @@ -55623,21 +59501,21 @@ var ts; } return node; } - // When we see an identifier in an expression position that - // points to an imported symbol, we should substitute a qualified - // reference to the imported symbol if one is needed. - // - // - We do not substitute generated identifiers for any reason. - // - We do not substitute identifiers tagged with the LocalName flag. if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { + var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); + if (exportContainer && exportContainer.kind === 264 /* SourceFile */) { + return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), + /*location*/ node); + } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name)), /*location*/ node); } } @@ -55669,7 +59547,9 @@ var ts; var expression = node; for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) { var exportName = exportedNames_1[_i]; - expression = createExportExpression(exportName, preventSubstitution(expression)); + // Mark the node to prevent triggering this rule again. + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression, /*location*/ node); } return expression; } @@ -55698,18 +59578,15 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ - ? ts.createPrefix(node.operator, node.operand, + var expression = node.kind === 192 /* PostfixUnaryExpression */ + ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1)), /*location*/ node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { var exportName = exportedNames_2[_i]; - expression = createExportExpression(exportName, preventSubstitution(expression)); - } - if (node.kind === 191 /* PostfixUnaryExpression */) { - expression = node.operator === 42 /* PlusPlusToken */ - ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) - : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); + // Mark the node to prevent triggering this rule again. + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression); } return expression; } @@ -55717,79 +59594,59 @@ var ts; return node; } /** - * Gets the exports of a name. + * Gets the additional exports of a name. * * @param name The name. */ function getExports(name) { - var exportedNames; if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { - var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { - exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); - } - exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); + return currentModuleInfo + && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; } } - return exportedNames; - } - /** - * Prevent substitution of a node for this transformer. - * - * @param node The node which should not be substituted. - */ - function preventSubstitution(node) { - if (noSubstitution === undefined) - noSubstitution = ts.createMap(); - noSubstitution[ts.getNodeId(node)] = true; - return node; - } - /** - * Determines whether a node should not be substituted. - * - * @param node The node to test. - */ - function isSubstitutionPrevented(node) { - return noSubstitution && node.id && noSubstitution[node.id]; } } - ts.transformSystemModule = transformSystemModule; + ts.transformModule = transformModule; + // emit output for the __export helper function + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; })(ts || (ts = {})); /// /// +/// /*@internal*/ var ts; (function (ts) { - function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + function transformSystemModule(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. + context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(264 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. + var exportFunctionsMap = []; // The export function associated with a source file. + var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file. var currentSourceFile; // The current file. - var currentModuleInfo; // The ExternalModuleInfo for the current file. + var moduleInfo; // ExternalModuleInfo for the current file. + var exportFunction; // The export function for the current file. + var contextObject; // The context object for the current file. + var hoistedStatements; + var enclosingBlockScopedContainer; var noSubstitution; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; /** @@ -55803,238 +59660,383 @@ var ts; || compilerOptions.isolatedModules)) { return node; } + var id = ts.getOriginalNodeId(node); currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - // Perform the transformation. - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; - var updated = transformModule(node); - currentSourceFile = undefined; - currentModuleInfo = undefined; - return ts.aggregateTransformFlags(updated); - } - /** - * Transforms a SourceFile into a CommonJS module. - * - * @param node The SourceFile node. - */ - function transformCommonJSModule(node) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - if (currentModuleInfo.hasExportStarsToExportValues) { - ts.addEmitHelper(updated, exportStarHelper); - } - return updated; - } - /** - * Transforms a SourceFile into an AMD module. - * - * @param node The SourceFile node. - */ - function transformAMDModule(node) { - var define = ts.createIdentifier("define"); + enclosingBlockScopedContainer = node; + // System modules have the following shape: + // + // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) + // + // The parameter 'exports' here is a callback '(name: string, value: T) => T' that + // is used to publish exported values. 'exports' returns its 'value' argument so in + // most cases expressions that mutate exported values can be rewritten as: + // + // expr -> exports('name', expr) + // + // The only exception in this rule is postfix unary operators, + // see comment to 'substitutePostfixUnaryExpression' for more details + // Collect information about the external module and dependency groups. + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + // Make sure that the name of the 'exports' function does not conflict with + // existing identifiers. + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; + contextObject = ts.createUniqueName("context"); + // Add the body of the module. + var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); + var moduleBodyFunction = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) + ], + /*type*/ undefined, moduleBodyBlock); + // Write the call to `System.register` + // Clear the emit-helpers flag for later passes since we'll have already used it in the module body + // So the helper will be emit at the correct position instead of at the top of the source-file var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true); + var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), + /*typeArguments*/ undefined, moduleName + ? [moduleName, dependencies, moduleBodyFunction] + : [dependencies, moduleBodyFunction])) + ]), node.statements)), 1024 /* NoTrailingComments */); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } + if (noSubstitution) { + noSubstitutionMap[id] = noSubstitution; + noSubstitution = undefined; + } + currentSourceFile = undefined; + moduleInfo = undefined; + exportFunction = undefined; + contextObject = undefined; + hoistedStatements = undefined; + enclosingBlockScopedContainer = undefined; + return ts.aggregateTransformFlags(updated); } /** - * Transforms a SourceFile into a UMD module. + * Collects the dependency groups for this files imports. * - * @param node The SourceFile node. + * @param externalImports The imports for the file. */ - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); + function collectDependencyGroups(externalImports) { + var groupIndices = ts.createMap(); + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; i++) { + var externalImport = externalImports[i]; + var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); + if (externalModuleName) { + var text = externalModuleName.text; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { + // deduplicate/group entries in dependency list by the dependency name + dependencyGroups[groupIndex].externalImports.push(externalImport); + } + else { + groupIndices.set(text, dependencyGroups.length); + dependencyGroups.push({ + name: externalModuleName, + externalImports: [externalImport] + }); + } + } + } + return dependencyGroups; } /** - * Transforms a SourceFile into an AMD or UMD module. + * Adds the statements for the module body function for the source file. * - * @param node The SourceFile node. - * @param define The expression used to define the module. - * @param moduleName An expression for the module name, if available. - * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies. + * @param node The source file for the module. + * @param dependencyGroups The grouped dependencies of the module. */ - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - // An AMD define function has the following shape: - // - // define(id?, dependencies?, factory); - // - // This has the shape of the following: - // - // define(name, ["module1", "module2"], function (module1Alias) { ... } - // - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: + function createSystemModuleBody(node, dependencyGroups) { + // Shape of the body in system modules: // - // import "module" + // function (exports) { + // + // + // + // return { + // setters: [ + // + // ], + // execute: function() { + // + // } + // } + // + // } // - // or + // i.e: // - // /// + // import {x} from 'file1' + // var y = 1; + // export function foo() { return y + x(); } + // console.log(y); // - // we need to add modules without alias names to the end of the dependencies list - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; - // Create an updated SourceFile: + // Will be transformed to: // - // define(moduleName?, ["module1", "module2"], function ... - return ts.updateSourceFileNode(node, ts.createNodeArray([ - ts.createStatement(ts.createCall(define, - /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([ - // Add the dependency array argument: - // - // ["require", "exports", module1", "module2", ...] - ts.createArrayLiteral([ - ts.createLiteral("require"), - ts.createLiteral("exports") - ].concat(aliasedModuleNames, unaliasedModuleNames)), - // Add the module body function argument: - // - // function (require, exports, module1, module2) ... - ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") - ].concat(importAliasNames), - /*type*/ undefined, transformAsynchronousModuleBody(node)) - ]))) - ], - /*location*/ node.statements)); + // function(exports) { + // function foo() { return y + file_1.x(); } + // exports("foo", foo); + // var file_1, y; + // return { + // setters: [ + // function(v) { file_1 = v } + // ], + // execute(): function() { + // y = 1; + // console.log(y); + // } + // }; + // } + var statements = []; + // We start a new lexical environment in this function body, but *not* in the + // body of the execute function. This allows us to emit temporary declarations + // only in the outer module body and not in the inner one. + startLexicalEnvironment(); + // Add any prologue directives. + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + // var __moduleName = context_1 && context_1.id; + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("__moduleName", + /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) + ]))); + // Visit the synthetic external helpers import declaration if present + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement); + // Visit the statements of the source file, emitting any transformations into + // the `executeStatements` array. We do this *before* we fill the `setters` array + // as we both emit transformations as well as aggregate some data used when creating + // setters. This allows us to reduce the number of times we need to loop through the + // statements of the source file. + var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); + // Emit early exports for function declarations. + ts.addRange(statements, hoistedStatements); + // We emit hoisted variables early to align roughly with our previous emit output. + // Two key differences in this approach are: + // - Temporary variables will appear at the top rather than at the bottom of the file + ts.addRange(statements, endLexicalEnvironment()); + var exportStarFunction = addExportStarIfNeeded(statements); + var moduleObject = ts.createObjectLiteral([ + ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), + ts.createPropertyAssignment("execute", ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, ts.createBlock(executeStatements, /*multiLine*/ true))) + ]); + moduleObject.multiLine = true; + statements.push(ts.createReturn(moduleObject)); + return ts.createBlock(statements, /*multiLine*/ true); } /** - * Collect the additional asynchronous dependencies for the module. + * Adds an exportStar function to a statement list if it is needed for the file. * - * @param node The source file. - * @param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies. + * @param statements A statement list. */ - function collectAsynchronousDependencies(node, includeNonAmdDependencies) { - // names of modules with corresponding parameter in the factory function - var aliasedModuleNames = []; - // names of modules with no corresponding parameters in factory function - var unaliasedModuleNames = []; - // names of the parameters in the factory function; these - // parameters need to match the indexes of the corresponding - // module names in aliasedModuleNames. - var importAliasNames = []; - // Fill in amd-dependency tags - for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { - var amdDependency = _a[_i]; - if (amdDependency.name) { - aliasedModuleNames.push(ts.createLiteral(amdDependency.path)); - importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, amdDependency.name)); + function addExportStarIfNeeded(statements) { + if (!moduleInfo.hasExportStarsToExportValues) { + return; + } + // when resolving exports local exported entries/indirect exported entries in the module + // should always win over entries with similar names that were added via star exports + // to support this we store names of local/indirect exported entries in a set. + // this set is used to filter names brought by star expors. + // local names set should only be added if we have anything exported + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { + // no exported declarations (export var ...) or export specifiers (export {x}) + // check if we have any non star export declarations. + var hasExportDeclarationWithExportClause = false; + for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { + var externalImport = _a[_i]; + if (externalImport.kind === 243 /* ExportDeclaration */ && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } } - else { - unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + if (!hasExportDeclarationWithExportClause) { + // we still need to emit exportStar helper + var exportStarFunction_1 = createExportStarFunction(/*localNames*/ undefined); + statements.push(exportStarFunction_1); + return exportStarFunction_1.name; } } - for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { - var importNode = _c[_b]; - // Find the name of the external module - var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); - // Find the name of the module alias, if there is one - var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); - if (includeNonAmdDependencies && importAliasName) { - // Set emitFlags on the name of the classDeclaration - // This is so that when printer will not substitute the identifier - ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */); - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName)); + var exportedNames = []; + if (moduleInfo.exportedNames) { + for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { + var exportedLocalName = _c[_b]; + if (exportedLocalName.text === "default") { + continue; + } + // write name of exported declaration, i.e 'export var x...' + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createTrue())); } - else { - unaliasedModuleNames.push(externalModuleName); + } + for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { + var externalImport = _e[_d]; + if (externalImport.kind !== 243 /* ExportDeclaration */) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + // export * from ... + continue; + } + for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { + var element = _g[_f]; + // write name of indirectly exported entry, i.e. 'export {x} from ...' + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createTrue())); } } - return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exportedNamesStorageRef, + /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*multiline*/ true)) + ]))); + var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); + statements.push(exportStarFunction); + return exportStarFunction.name; } /** - * Transforms a SourceFile into an AMD or UMD module body. + * Creates an exportStar function for the file, with an optional set of excluded local + * names. * - * @param node The SourceFile node. + * @param localNames An optional reference to an object containing a set of excluded local + * names. */ - function transformAsynchronousModuleBody(node) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - // Visit each statement of the module body. - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - // End the lexical environment for the module body - // and merge any new lexical declarations. - ts.addRange(statements, endLexicalEnvironment()); - // Append the 'export =' statement if provided. - addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true); - var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); - if (currentModuleInfo.hasExportStarsToExportValues) { - // If we have any `export * from ...` declarations - // we need to inform the emitter to add the __export helper. - ts.addEmitHelper(body, exportStarHelper); + function createExportStarFunction(localNames) { + var exportStarFunction = ts.createUniqueName("exportStar"); + var m = ts.createIdentifier("m"); + var n = ts.createIdentifier("n"); + var exports = ts.createIdentifier("exports"); + var condition = ts.createStrictInequality(n, ts.createLiteral("default")); + if (localNames) { + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), + /*typeArguments*/ undefined, [n]))); } - return body; + return ts.createFunctionDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, exportStarFunction, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, m)], + /*type*/ undefined, ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exports, + /*type*/ undefined, ts.createObjectLiteral([])) + ])), + ts.createForIn(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(n, /*type*/ undefined) + ]), m, ts.createBlock([ + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */) + ])), + ts.createStatement(ts.createCall(exportFunction, + /*typeArguments*/ undefined, [exports])) + ], /*multiline*/ true)); } /** - * Adds the down-level representation of `export=` to the statement list if one exists - * in the source file. + * Creates an array setter callbacks for each dependency group. * - * @param statements The Statement list to modify. - * @param emitAsReturn A value indicating whether to emit the `export=` statement as a - * return statement. + * @param exportStarFunction A reference to an exportStarFunction for the file. + * @param dependencyGroups An array of grouped dependencies. */ - function addExportEqualsIfNeeded(statements, emitAsReturn) { - if (currentModuleInfo.exportEquals) { - if (emitAsReturn) { - var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, - /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */); - statements.push(statement); - } - else { - var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), - /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 1536 /* NoComments */); - statements.push(statement); + function createSettersArray(exportStarFunction, dependencyGroups) { + var setters = []; + for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { + var group = dependencyGroups_1[_i]; + // derive a unique name for parameter from the first named entry in the group + var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); }); + var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""); + var statements = []; + for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) { + var entry = _b[_a]; + var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); + switch (entry.kind) { + case 237 /* ImportDeclaration */: + if (!entry.importClause) { + // 'import "..."' case + // module is imported only for side-effects, no emit required + break; + } + // falls through + case 236 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== undefined); + // save import into the local + statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); + break; + case 243 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== undefined); + if (entry.exportClause) { + // export {a, b as c} from 'foo' + // + // emit as: + // + // exports_({ + // "a": _["a"], + // "c": _["b"] + // }); + var properties = []; + for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); + } + statements.push(ts.createStatement(ts.createCall(exportFunction, + /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*multiline*/ true)]))); + } + else { + // export * from 'foo' + // + // emit as: + // + // exportStar(foo_1_1); + statements.push(ts.createStatement(ts.createCall(exportStarFunction, + /*typeArguments*/ undefined, [parameterName]))); + } + break; + } } + setters.push(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], + /*type*/ undefined, ts.createBlock(statements, /*multiLine*/ true))); } + return ts.createArrayLiteral(setters, /*multiLine*/ true); } // - // Top-Level Source Element Visitors + // Top-level Source Element Visitors // /** - * Visits a node at the top level of the source file. + * Visit source elements at the top-level of a module. * * @param node The node to visit. */ function sourceElementVisitor(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: - return visitExportDeclaration(node); - case 240 /* ExportAssignment */: + case 243 /* ExportDeclaration */: + // ExportDeclarations are elided as they are handled via + // `appendExportsOfDeclaration`. + return undefined; + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: - return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: - return visitClassDeclaration(node); - case 295 /* MergeDeclarationMarker */: - return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: - return visitEndOfDeclarationMarker(node); default: - // This visitor does not descend into the tree, as export/import statements - // are only transformed at the top level of a file. - return node; + return nestedElementVisitor(node); } } /** @@ -56044,46 +60046,8 @@ var ts; */ function visitImportDeclaration(node) { var statements; - var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); - if (moduleKind !== ts.ModuleKind.AMD) { - if (!node.importClause) { - // import "mod"; - return ts.createStatement(createRequireCall(node), /*location*/ node); - } - else { - var variables = []; - if (namespaceDeclaration && !ts.isDefaultImport(node)) { - // import * as n from "mod"; - variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), - /*type*/ undefined, createRequireCall(node))); - } - else { - // import d from "mod"; - // import { x, y } from "mod"; - // import d, { x, y } from "mod"; - // import d, * as n from "mod"; - variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), - /*type*/ undefined, createRequireCall(node))); - if (namespaceDeclaration && ts.isDefaultImport(node)) { - variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), - /*type*/ undefined, ts.getGeneratedNameForNode(node))); - } - } - statements = ts.append(statements, ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList(variables, - /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), - /*location*/ node)); - } - } - else if (namespaceDeclaration && ts.isDefaultImport(node)) { - // import d, * as n from "mod"; - statements = ts.append(statements, ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), - /*type*/ undefined, ts.getGeneratedNameForNode(node), - /*location*/ node) - ], - /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */))); + if (node.importClause) { + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node @@ -56095,19 +60059,6 @@ var ts; } return ts.singleOrMany(statements); } - /** - * Creates a `require()` call to import an external module. - * - * @param importNode The declararation to import. - */ - function createRequireCall(importNode) { - var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); - var args = []; - if (moduleName) { - args.push(moduleName); - } - return ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, args); - } /** * Visits an ImportEqualsDeclaration node. * @@ -56116,28 +60067,7 @@ var ts; function visitImportEqualsDeclaration(node) { ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); var statements; - if (moduleKind !== ts.ModuleKind.AMD) { - if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), - /*location*/ node)); - } - else { - statements = ts.append(statements, ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), - /*type*/ undefined, createRequireCall(node)) - ], - /*location*/ undefined, - /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), - /*location*/ node)); - } - } - else { - if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), - /*location*/ node)); - } - } + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); @@ -56148,48 +60078,6 @@ var ts; } return ts.singleOrMany(statements); } - /** - * Visits an ExportDeclaration node. - * - * @param The node to visit. - */ - function visitExportDeclaration(node) { - if (!node.moduleSpecifier) { - // Elide export declarations with no module specifier as they are handled - // elsewhere. - return undefined; - } - var generatedName = ts.getGeneratedNameForNode(node); - if (node.exportClause) { - var statements = []; - // export { x, y } from "mod"; - if (moduleKind !== ts.ModuleKind.AMD) { - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(generatedName, - /*type*/ undefined, createRequireCall(node)) - ]), - /*location*/ node)); - } - for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { - var specifier = _a[_i]; - var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); - statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), - /*location*/ specifier)); - } - return ts.singleOrMany(statements); - } - else { - // export * from "mod"; - return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), - /*typeArguments*/ undefined, [ - moduleKind !== ts.ModuleKind.AMD - ? createRequireCall(node) - : generatedName - ]), - /*location*/ node); - } - } /** * Visits an ExportAssignment node. * @@ -56197,37 +60085,33 @@ var ts; */ function visitExportAssignment(node) { if (node.isExportEquals) { + // Elide `export=` as it is illegal in a SystemJS module. return undefined; } - var statements; + var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression); var original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, /*allowComments*/ true); } else { - statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); + return createExportStatement(ts.createIdentifier("default"), expression, /*allowComments*/ true); } - return ts.singleOrMany(statements); } /** - * Visits a FunctionDeclaration node. + * Visits a FunctionDeclaration, hoisting it to the outer module body function. * * @param node The node to visit. */ function visitFunctionDeclaration(node) { - var statements; if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), - /*typeParameters*/ undefined, node.parameters, - /*type*/ undefined, node.body, - /*location*/ node), - /*original*/ node)); + hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), + /*type*/ undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); } else { - statements = ts.append(statements, node); + hoistedStatements = ts.append(hoistedStatements, node); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node @@ -56235,27 +60119,24 @@ var ts; deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { - statements = appendExportsOfHoistedDeclaration(statements, node); + hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); } - return ts.singleOrMany(statements); + return undefined; } /** - * Visits a ClassDeclaration node. - * - * @param node The node to visit. - */ - function visitClassDeclaration(node) { - var statements; - if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), - /*typeParameters*/ undefined, node.heritageClauses, node.members, - /*location*/ node), - /*original*/ node)); - } - else { - statements = ts.append(statements, node); - } + * Visits a ClassDeclaration, hoisting its name to the outer module body function. + * + * @param node The node to visit. + */ + function visitClassDeclaration(node) { + var statements; + // Hoist the name of the class declaration to the outer module body function. + var name = ts.getLocalName(node); + hoistVariableDeclaration(name); + // Rewrite the class declaration into an assignment of a class expression. + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.createAssignment(name, ts.setTextRange(ts.createClassExpression( + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement)), node))), node)); if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); @@ -56267,66 +60148,117 @@ var ts; return ts.singleOrMany(statements); } /** - * Visits a VariableStatement node. + * Visits a variable statement, hoisting declared names to the top-level module body. + * Each declaration is rewritten into an assignment expression. * * @param node The node to visit. */ function visitVariableStatement(node) { - var statements; - var variables; + if (!shouldHoistVariableDeclarationList(node.declarationList)) { + return ts.visitNode(node, destructuringVisitor, ts.isStatement); + } var expressions; - if (ts.hasModifier(node, 1 /* Export */)) { - var modifiers = void 0; - // If we're exporting these variables, then these just become assignments to 'exports.x'. - // We only want to emit assignments for variables with initializers. - for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) { - if (!modifiers) { - modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier); - } - variables = ts.append(variables, variable); - } - else if (variable.initializer) { - expressions = ts.append(expressions, transformInitializedVariable(variable)); - } - } - if (variables) { - statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); + var isExportedDeclaration = ts.hasModifier(node, 1 /* Export */); + var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); } - if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node)); + else { + hoistBindingElement(variable); } } - else { - statements = ts.append(statements, node); + var statements; + if (expressions) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { + if (isMarkedDeclaration) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); } else { - statements = appendExportsOfVariableStatement(statements, node); + statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false); } return ts.singleOrMany(statements); } /** - * Transforms an exported variable with an initializer into an expression. + * Hoists the declared names of a VariableDeclaration or BindingElement. * - * @param node The node to transform. + * @param node The declaration to hoist. */ - function transformInitializedVariable(node) { + function hoistBindingElement(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenDestructuringAssignment(node, - /*visitor*/ undefined, context, 0 /* All */, - /*needsValue*/ false, createExportExpression); + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + hoistBindingElement(element); + } + } } else { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, - /*location*/ node.name), node.initializer); + hoistVariableDeclaration(ts.getSynthesizedClone(node.name)); } } + /** + * Determines whether a VariableDeclarationList should be hoisted. + * + * @param node The node to test. + */ + function shouldHoistVariableDeclarationList(node) { + // hoist only non-block scoped declarations or block scoped declarations parented by source file + return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 + && (enclosingBlockScopedContainer.kind === 264 /* SourceFile */ + || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); + } + /** + * Transform an initialized variable declaration into an expression. + * + * @param node The node to transform. + * @param isExportedDeclaration A value indicating whether the variable is exported. + */ + function transformInitializedVariable(node, isExportedDeclaration) { + var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; + return ts.isBindingPattern(node.name) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ false, createAssignment) + : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); + } + /** + * Creates an assignment expression for an exported variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + */ + function createExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ true); + } + /** + * Creates an assignment expression for a non-exported variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + */ + function createNonExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ false); + } + /** + * Creates an assignment expression for a variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + * @param isExportedDeclaration A value indicating whether the variable is exported. + */ + function createVariableAssignment(name, value, location, isExportedDeclaration) { + hoistVariableDeclaration(ts.getSynthesizedClone(name)); + return isExportedDeclaration + ? createExportExpression(name, preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location))) + : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)); + } /** * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged * and transformed declaration. @@ -56339,11 +60271,12 @@ var ts; // begin/end semantics of the declararation and to properly handle exports // we wrapped the leading variable declaration in a `MergeDeclarationMarker`. // - // To balance the declaration, add the exports of the elided variable - // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + // To balance the declaration, we defer the exports of the elided variable + // statement until we visit this declaration's `EndOfDeclarationMarker`. + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); + var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); } return node; } @@ -56383,7 +60316,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } var importClause = decl.importClause; @@ -56396,10 +60329,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56410,7 +60343,7 @@ var ts; return statements; } /** - * Appends the exports of an ImportEqualsDeclaration to a statement list, returning the + * Appends the export of an ImportEqualsDeclaration to a statement list, returning the * statement list. * * @param statements A statement list to which the down-level export statements are to be @@ -56419,7 +60352,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportEqualsDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } return appendExportsOfDeclaration(statements, decl); @@ -56432,14 +60365,18 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param node The VariableStatement whose exports are to be recorded. + * @param exportSelf A value indicating whether to also export each VariableDeclaration of + * `nodes` declaration list. */ - function appendExportsOfVariableStatement(statements, node) { - if (currentModuleInfo.exportEquals) { + function appendExportsOfVariableStatement(statements, node, exportSelf) { + if (moduleInfo.exportEquals) { return statements; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - statements = appendExportsOfBindingElement(statements, decl); + if (decl.initializer || exportSelf) { + statements = appendExportsOfBindingElement(statements, decl, exportSelf); + } } return statements; } @@ -56451,21 +60388,27 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration whose exports are to be recorded. + * @param exportSelf A value indicating whether to also export the declaration itself. */ - function appendExportsOfBindingElement(statements, decl) { - if (currentModuleInfo.exportEquals) { + function appendExportsOfBindingElement(statements, decl, exportSelf) { + if (moduleInfo.exportEquals) { return statements; } if (ts.isBindingPattern(decl.name)) { for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { - statements = appendExportsOfBindingElement(statements, element); + statements = appendExportsOfBindingElement(statements, element, exportSelf); } } } else if (!ts.isGeneratedIdentifier(decl.name)) { - statements = appendExportsOfDeclaration(statements, decl); + var excludeName = void 0; + if (exportSelf) { + statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); + excludeName = decl.name.text; + } + statements = appendExportsOfDeclaration(statements, decl, excludeName); } return statements; } @@ -56479,15 +60422,17 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfHoistedDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } + var excludeName; if (ts.hasModifier(decl, 1 /* Export */)) { - var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createIdentifier("default") : decl.name; - statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), /*location*/ decl); + var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createLiteral("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); + excludeName = exportName.text; } if (decl.name) { - statements = appendExportsOfDeclaration(statements, decl); + statements = appendExportsOfDeclaration(statements, decl, excludeName); } return statements; } @@ -56498,14 +60443,20 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration to export. + * @param excludeName An optional name to exclude from exports. */ - function appendExportsOfDeclaration(statements, decl) { + function appendExportsOfDeclaration(statements, decl, excludeName) { + if (moduleInfo.exportEquals) { + return statements; + } var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; - statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name); + if (exportSpecifier.name.text !== excludeName) { + statements = appendExportStatement(statements, exportSpecifier.name, name); + } } } return statements; @@ -56519,29 +60470,10 @@ var ts; * appended. * @param exportName The name of the export. * @param expression The expression to export. - * @param location The location to use for source maps and comments for the export. * @param allowComments Whether to allow comments on the export. */ - function appendExportStatement(statements, exportName, expression, location, allowComments) { - if (exportName.text === "default") { - var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 0 /* ES3 */) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); - } - else { - statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), - /*typeArguments*/ undefined, [ - ts.createIdentifier("exports"), - ts.createLiteral("__esModule"), - ts.createObjectLiteral([ - ts.createPropertyAssignment("value", ts.createLiteral(true)) - ]) - ]))); - } - } - } - statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); + function appendExportStatement(statements, exportName, expression, allowComments) { + statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)); return statements; } /** @@ -56549,11 +60481,10 @@ var ts; * * @param name The bound name of the export. * @param value The exported value. - * @param location The location to use for source maps and comments for the export. * @param allowComments An optional value indicating whether to emit comments for the statement. */ - function createExportStatement(name, value, location, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value), location); + function createExportStatement(name, value, allowComments) { + var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { ts.setEmitFlags(statement, 1536 /* NoComments */); @@ -56565,10 +60496,293 @@ var ts; * * @param name The bound name of the export. * @param value The exported value. - * @param location The location to use for source maps and comments for the export. */ - function createExportExpression(name, value, location) { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value, location); + function createExportExpression(name, value) { + var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; + return ts.createCall(exportFunction, /*typeArguments*/ undefined, [exportName, value]); + } + // + // Top-Level or Nested Source Element Visitors + // + /** + * Visit nested elements at the top-level of a module. + * + * @param node The node to visit. + */ + function nestedElementVisitor(node) { + switch (node.kind) { + case 207 /* VariableStatement */: + return visitVariableStatement(node); + case 227 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 228 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 213 /* ForStatement */: + return visitForStatement(node); + case 214 /* ForInStatement */: + return visitForInStatement(node); + case 215 /* ForOfStatement */: + return visitForOfStatement(node); + case 211 /* DoStatement */: + return visitDoStatement(node); + case 212 /* WhileStatement */: + return visitWhileStatement(node); + case 221 /* LabeledStatement */: + return visitLabeledStatement(node); + case 219 /* WithStatement */: + return visitWithStatement(node); + case 220 /* SwitchStatement */: + return visitSwitchStatement(node); + case 234 /* CaseBlock */: + return visitCaseBlock(node); + case 256 /* CaseClause */: + return visitCaseClause(node); + case 257 /* DefaultClause */: + return visitDefaultClause(node); + case 223 /* TryStatement */: + return visitTryStatement(node); + case 259 /* CatchClause */: + return visitCatchClause(node); + case 206 /* Block */: + return visitBlock(node); + case 296 /* MergeDeclarationMarker */: + return visitMergeDeclarationMarker(node); + case 297 /* EndOfDeclarationMarker */: + return visitEndOfDeclarationMarker(node); + default: + return destructuringVisitor(node); + } + } + /** + * Visits the body of a ForStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a ForInStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForInStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a ForOfStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForOfStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForOf(node, node.awaitModifier, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Determines whether to hoist the initializer of a ForStatement, ForInStatement, or + * ForOfStatement. + * + * @param node The node to test. + */ + function shouldHoistForInitializer(node) { + return ts.isVariableDeclarationList(node) + && shouldHoistVariableDeclarationList(node); + } + /** + * Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement + * + * @param node The node to visit. + */ + function visitForInitializer(node) { + if (!node) { + return node; + } + if (shouldHoistForInitializer(node)) { + var expressions = void 0; + for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); + } + return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); + } + else { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + } + /** + * Visits the body of a DoStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitDoStatement(node) { + return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); + } + /** + * Visits the body of a WhileStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitWhileStatement(node) { + return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + /** + * Visits the body of a LabeledStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitLabeledStatement(node) { + return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + /** + * Visits the body of a WithStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitWithStatement(node) { + return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + /** + * Visits the body of a SwitchStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitSwitchStatement(node) { + return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); + } + /** + * Visits the body of a CaseBlock to hoist declarations. + * + * @param node The node to visit. + */ + function visitCaseBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a CaseClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitCaseClause(node) { + return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)); + } + /** + * Visits the body of a DefaultClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitDefaultClause(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + /** + * Visits the body of a TryStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitTryStatement(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + /** + * Visits the body of a CatchClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitCatchClause(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a Block to hoist declarations. + * + * @param node The node to visit. + */ + function visitBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.visitEachChild(node, nestedElementVisitor, context); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + // + // Destructuring Assignment Visitors + // + /** + * Visit nodes to flatten destructuring assignments to exported symbols. + * + * @param node The node to visit. + */ + function destructuringVisitor(node) { + if (node.transformFlags & 1024 /* DestructuringAssignment */ + && node.kind === 193 /* BinaryExpression */) { + return visitDestructuringAssignment(node); + } + else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { + return ts.visitEachChild(node, destructuringVisitor, context); + } + else { + return node; + } + } + /** + * Visits a DestructuringAssignment to flatten destructuring to exported symbols. + * + * @param node The node to visit. + */ + function visitDestructuringAssignment(node) { + if (hasExportedReferenceInDestructuringTarget(node.left)) { + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ true); + } + return ts.visitEachChild(node, destructuringVisitor, context); + } + /** + * Determines whether the target of a destructuring assigment refers to an exported symbol. + * + * @param node The destructuring target. + */ + function hasExportedReferenceInDestructuringTarget(node) { + if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + return hasExportedReferenceInDestructuringTarget(node.left); + } + else if (ts.isSpreadExpression(node)) { + return hasExportedReferenceInDestructuringTarget(node.expression); + } + else if (ts.isObjectLiteralExpression(node)) { + return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isArrayLiteralExpression(node)) { + return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isShorthandPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.name); + } + else if (ts.isPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.initializer); + } + else if (ts.isIdentifier(node)) { + var container = resolver.getReferencedExportContainer(node); + return container !== undefined && container.kind === 264 /* SourceFile */; + } + else { + return false; + } } // // Modifier Visitors @@ -56579,7 +60793,6 @@ var ts; * @param node The node to visit. */ function modifierVisitor(node) { - // Elide module-specific modifiers. switch (node.kind) { case 83 /* ExportKeyword */: case 78 /* DefaultKeyword */: @@ -56593,22 +60806,28 @@ var ts; /** * Hook for node emit notifications. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. + * @param emitCallback A callback used to emit the node in the printer. */ - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264 /* SourceFile */) { + var id = ts.getOriginalNodeId(node); currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); - previousOnEmitNode(emitContext, node, emitCallback); + moduleInfo = moduleInfoMap[id]; + exportFunction = exportFunctionsMap[id]; + noSubstitution = noSubstitutionMap[id]; + if (noSubstitution) { + delete noSubstitutionMap[id]; + } + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; - currentModuleInfo = undefined; + moduleInfo = undefined; + exportFunction = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } // @@ -56617,44 +60836,21 @@ var ts; /** * Hooks node substitutions. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (node.id && noSubstitution[node.id]) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (isSubstitutionPrevented(node)) { return node; } - if (emitContext === 1 /* Expression */) { + if (hint === 1 /* Expression */) { return substituteExpression(node); } - else if (ts.isShorthandPropertyAssignment(node)) { - return substituteShorthandPropertyAssignment(node); - } - return node; - } - /** - * Substitution for a ShorthandPropertyAssignment whose declaration name is an imported - * or exported symbol. - * - * @param node The node to substitute. - */ - function substituteShorthandPropertyAssignment(node) { - var name = node.name; - var exportedOrImportedName = substituteExpressionIdentifier(name); - if (exportedOrImportedName !== name) { - // A shorthand property with an assignment initializer is probably part of a - // destructuring assignment - if (node.objectAssignmentInitializer) { - var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name, initializer, /*location*/ node); - } - return ts.createPropertyAssignment(name, exportedOrImportedName, /*location*/ node); - } return node; } /** - * Substitution for an Expression that may contain an imported or exported symbol. + * Substitute the expression, if necessary. * * @param node The node to substitute. */ @@ -56662,17 +60858,16 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 191 /* PostfixUnaryExpression */: - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; } /** - * Substitution for an Identifier expression that may contain an imported or exported - * symbol. + * Substitution for an Identifier expression that may contain an imported or exported symbol. * * @param node The node to substitute. */ @@ -56684,21 +60879,21 @@ var ts; } return node; } + // When we see an identifier in an expression position that + // points to an imported symbol, we should substitute a qualified + // reference to the imported symbol if one is needed. + // + // - We do not substitute generated identifiers for any reason. + // - We do not substitute identifiers tagged with the LocalName flag. if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { - var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { - return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), - /*location*/ node); - } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_37 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_37), + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name)), /*location*/ node); } } @@ -56730,9 +60925,7 @@ var ts; var expression = node; for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) { var exportName = exportedNames_3[_i]; - // Mark the node to prevent triggering this rule again. - noSubstitution[ts.getNodeId(expression)] = true; - expression = createExportExpression(exportName, expression, /*location*/ node); + expression = createExportExpression(exportName, preventSubstitution(expression)); } return expression; } @@ -56761,15 +60954,17 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ - ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1), - /*location*/ node) + var expression = node.kind === 192 /* PostfixUnaryExpression */ + ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; - // Mark the node to prevent triggering this rule again. - noSubstitution[ts.getNodeId(expression)] = true; - expression = createExportExpression(exportName, expression); + expression = createExportExpression(exportName, preventSubstitution(expression)); + } + if (node.kind === 192 /* PostfixUnaryExpression */) { + expression = node.operator === 42 /* PlusPlusToken */ + ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) + : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); } return expression; } @@ -56777,31 +60972,144 @@ var ts; return node; } /** - * Gets the additional exports of a name. + * Gets the exports of a name. * * @param name The name. */ function getExports(name) { + var exportedNames; if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { - return currentModuleInfo - && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; + var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); + if (exportContainer && exportContainer.kind === 264 /* SourceFile */) { + exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); + } + exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); } } + return exportedNames; + } + /** + * Prevent substitution of a node for this transformer. + * + * @param node The node which should not be substituted. + */ + function preventSubstitution(node) { + if (noSubstitution === undefined) + noSubstitution = []; + noSubstitution[ts.getNodeId(node)] = true; + return node; + } + /** + * Determines whether a node should not be substituted. + * + * @param node The node to test. + */ + function isSubstitutionPrevented(node) { + return noSubstitution && node.id && noSubstitution[node.id]; } - var _a; } - ts.transformModule = transformModule; - // emit output for the __export helper function - var exportStarHelper = { - name: "typescript:export-star", - scoped: true, - text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" - }; - // emit output for the UMD helper function. - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; + ts.transformSystemModule = transformSystemModule; +})(ts || (ts = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + function transformES2015Module(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(264 /* SourceFile */); + context.enableSubstitution(70 /* Identifier */); + var currentSourceFile; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.statements); + ts.append(statements, ts.createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } + } + return node; + } + function visitor(node) { + switch (node.kind) { + case 236 /* ImportEqualsDeclaration */: + // Elide `import=` as it is not legal with --module ES6 + return undefined; + case 242 /* ExportAssignment */: + return visitExportAssignment(node); + } + return node; + } + function visitExportAssignment(node) { + // Elide `export=` as it is not legal with --module ES6 + return node.isExportEquals ? undefined : node; + } + // + // Emit Notification + // + /** + * Hook for node emit. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(hint, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(hint, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(hint, node, emitCallback); + } + } + // + // Substitutions + // + /** + * Hooks node substitutions. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (ts.isIdentifier(node) && hint === 1 /* Expression */) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } + } + ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); /// /// @@ -56818,24 +61126,34 @@ var ts; /* @internal */ var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } + var TransformationState; + (function (TransformationState) { + TransformationState[TransformationState["Uninitialized"] = 0] = "Uninitialized"; + TransformationState[TransformationState["Initialized"] = 1] = "Initialized"; + TransformationState[TransformationState["Completed"] = 2] = "Completed"; + TransformationState[TransformationState["Disposed"] = 3] = "Disposed"; + })(TransformationState || (TransformationState = {})); var SyntaxKindFeatureFlags; (function (SyntaxKindFeatureFlags) { SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications"; })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})); - function getTransformers(compilerOptions) { + function getTransformers(compilerOptions, customTransformers) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var transformers = []; + ts.addRange(transformers, customTransformers && customTransformers.before); transformers.push(ts.transformTypeScript); if (jsx === 2 /* React */) { transformers.push(ts.transformJsx); @@ -56853,12 +61171,13 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); // The ES5 transformer is last so that it can substitute expressions like `exports.default` // for ES3. if (languageVersion < 1 /* ES5 */) { transformers.push(ts.transformES5); } + ts.addRange(transformers, customTransformers && customTransformers.after); return transformers; } ts.getTransformers = getTransformers; @@ -56866,13 +61185,14 @@ var ts; * Transforms an array of SourceFiles by passing them through each transformer. * * @param resolver The emit resolver provided by the checker. - * @param host The emit host. - * @param sourceFiles An array of source files - * @param transforms An array of Transformers. + * @param host The emit host object used to interact with the file system. + * @param options Compiler options to surface in the `TransformationContext`. + * @param nodes An array of nodes to transform. + * @param transforms An array of `TransformerFactory` callbacks. + * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ - function transformFiles(resolver, host, sourceFiles, transformers) { + function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { var enabledSyntaxKindFeatures = new Array(298 /* Count */); - var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -56880,10 +61200,13 @@ var ts; var lexicalEnvironmentStackOffset = 0; var lexicalEnvironmentSuspended = false; var emitHelpers; + var onSubstituteNode = function (_, node) { return node; }; + var onEmitNode = function (hint, node, callback) { return callback(hint, node); }; + var state = 0 /* Uninitialized */; // The transformation context is provided to each transformer as part of transformer // initialization. var context = { - getCompilerOptions: function () { return host.getCompilerOptions(); }, + getCompilerOptions: function () { return options; }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, startLexicalEnvironment: startLexicalEnvironment, @@ -56894,39 +61217,53 @@ var ts; hoistFunctionDeclaration: hoistFunctionDeclaration, requestEmitHelper: requestEmitHelper, readEmitHelpers: readEmitHelpers, - onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, - isSubstitutionEnabled: isSubstitutionEnabled, - onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); }, enableEmitNotification: enableEmitNotification, - isEmitNotificationEnabled: isEmitNotificationEnabled + isSubstitutionEnabled: isSubstitutionEnabled, + isEmitNotificationEnabled: isEmitNotificationEnabled, + get onSubstituteNode() { return onSubstituteNode; }, + set onSubstituteNode(value) { + ts.Debug.assert(state < 1 /* Initialized */, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onSubstituteNode = value; + }, + get onEmitNode() { return onEmitNode; }, + set onEmitNode(value) { + ts.Debug.assert(state < 1 /* Initialized */, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onEmitNode = value; + } }; + // Ensure the parse tree is clean before applying transformations + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + ts.performance.mark("beforeTransform"); // Chain together and initialize each transformer. var transformation = ts.chain.apply(void 0, transformers)(context); - // Transform each source file. - var transformed = ts.map(sourceFiles, transformSourceFile); - // Disable modification of the lexical environment. - lexicalEnvironmentDisabled = true; + // prevent modification of transformation hooks. + state = 1 /* Initialized */; + // Transform each node. + var transformed = ts.map(nodes, allowDtsFiles ? transformation : transformRoot); + // prevent modification of the lexical environment. + state = 2 /* Completed */; + ts.performance.mark("afterTransform"); + ts.performance.measure("transformTime", "beforeTransform", "afterTransform"); return { transformed: transformed, - emitNodeWithSubstitution: emitNodeWithSubstitution, - emitNodeWithNotification: emitNodeWithNotification + substituteNode: substituteNode, + emitNodeWithNotification: emitNodeWithNotification, + dispose: dispose }; - /** - * Transforms a source file. - * - * @param sourceFile The source file to transform. - */ - function transformSourceFile(sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return sourceFile; - } - return transformation(sourceFile); + function transformRoot(node) { + return node && (!ts.isSourceFile(node) || !ts.isDeclarationFile(node)) ? transformation(node) : node; } /** * Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ function enableSubstitution(kind) { + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 1 /* Substitution */; } /** @@ -56939,26 +61276,19 @@ var ts; /** * Emits a node with possible substitution. * - * @param emitContext The current emit context. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emitCallback The callback used to emit the node or its substitute. */ - function emitNodeWithSubstitution(emitContext, node, emitCallback) { - if (node) { - if (isSubstitutionEnabled(node)) { - var substitute = context.onSubstituteNode(emitContext, node); - if (substitute && substitute !== node) { - emitCallback(emitContext, substitute); - return; - } - } - emitCallback(emitContext, node); - } + function substituteNode(hint, node) { + ts.Debug.assert(state < 3 /* Disposed */, "Cannot substitute a node after the result is disposed."); + return node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node; } /** * Enables before/after emit notifications in the pretty printer for the provided SyntaxKind. */ function enableEmitNotification(kind) { + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 2 /* EmitNotifications */; } /** @@ -56972,17 +61302,18 @@ var ts; /** * Emits a node with possible emit notification. * - * @param emitContext The current emit context. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emitCallback The callback used to emit the node. */ - function emitNodeWithNotification(emitContext, node, emitCallback) { + function emitNodeWithNotification(hint, node, emitCallback) { + ts.Debug.assert(state < 3 /* Disposed */, "Cannot invoke TransformationResult callbacks after the result is disposed."); if (node) { if (isEmitNotificationEnabled(node)) { - context.onEmitNode(emitContext, node, emitCallback); + onEmitNode(hint, node, emitCallback); } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } } } @@ -56990,7 +61321,8 @@ var ts; * Records a hoisted variable declaration for the provided name within a lexical environment. */ function hoistVariableDeclaration(name) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); var decl = ts.createVariableDeclaration(name); if (!lexicalEnvironmentVariableDeclarations) { lexicalEnvironmentVariableDeclarations = [decl]; @@ -57003,7 +61335,8 @@ var ts; * Records a hoisted function declaration within a lexical environment. */ function hoistFunctionDeclaration(func) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); if (!lexicalEnvironmentFunctionDeclarations) { lexicalEnvironmentFunctionDeclarations = [func]; } @@ -57016,7 +61349,8 @@ var ts; * are pushed onto a stack, and the related storage variables are reset. */ function startLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); // Save the current lexical environment. Rather than resizing the array we adjust the // stack size variable. This allows us to reuse existing array slots we've @@ -57030,13 +61364,15 @@ var ts; } /** Suspends the current lexical environment, usually after visiting a parameter list. */ function suspendLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); lexicalEnvironmentSuspended = true; } /** Resumes a suspended lexical environment, usually before visiting a function body. */ function resumeLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); lexicalEnvironmentSuspended = false; } @@ -57045,7 +61381,8 @@ var ts; * any hoisted declarations added in this environment are returned. */ function endLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { @@ -57074,19 +61411,39 @@ var ts; return statements; } function requestEmitHelper(helper) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); emitHelpers = ts.append(emitHelpers, helper); } function readEmitHelpers() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); var helpers = emitHelpers; emitHelpers = undefined; return helpers; } - } - ts.transformFiles = transformFiles; - var _a; + function dispose() { + if (state < 3 /* Disposed */) { + // Clean up emit nodes on parse tree + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + // Release references to external entries for GC purposes. + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentVariableDeclarationsStack = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + lexicalEnvironmentFunctionDeclarationsStack = undefined; + onSubstituteNode = undefined; + onEmitNode = undefined; + emitHelpers = undefined; + // Prevent further use of the transformation result. + state = 3 /* Disposed */; + } + } + } + ts.transformNodes = transformNodes; })(ts || (ts = {})); /// /* @internal */ @@ -57131,10 +61488,9 @@ var ts; * * @param filePath The path to the generated output file. * @param sourceMapFilePath The path to the output source map file. - * @param sourceFiles The input source files for the program. - * @param isBundledEmit A value indicating whether the generated output file is a bundle. + * @param sourceFileOrBundle The input source file or bundle for the program. */ - function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + function initialize(filePath, sourceMapFilePath, sourceFileOrBundle) { if (disabled) { return; } @@ -57170,11 +61526,10 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (!isBundledEmit) { - ts.Debug.assert(sourceFiles.length === 1); + if (sourceFileOrBundle.kind === 264 /* SourceFile */) { // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { // The relative paths are relative to the common directory @@ -57297,31 +61652,32 @@ var ts; /** * Emits a node with possible leading and trailing source maps. * + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emitCallback The callback used to emit the node. */ - function emitNodeWithSourceMap(emitContext, node, emitCallback) { + function emitNodeWithSourceMap(hint, node, emitCallback) { if (disabled) { - return emitCallback(emitContext, node); + return emitCallback(hint, node); } if (node) { var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } if (emitFlags & 64 /* NoNestedSourceMaps */) { disabled = true; - emitCallback(emitContext, node); + emitCallback(hint, node); disabled = false; } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -57391,7 +61747,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -57456,11 +61812,10 @@ var ts; /* @internal */ var ts; (function (ts) { - function createCommentWriter(host, writer, sourceMap) { - var compilerOptions = host.getCompilerOptions(); - var extendedDiagnostics = compilerOptions.extendedDiagnostics; - var newLine = host.getNewLine(); - var emitPos = sourceMap.emitPos; + function createCommentWriter(printerOptions, emitPos) { + var extendedDiagnostics = printerOptions.extendedDiagnostics; + var newLine = ts.getNewLineCharacter(printerOptions); + var writer; var containerPos = -1; var containerEnd = -1; var declarationListContainerEnd = -1; @@ -57469,38 +61824,35 @@ var ts; var currentLineMap; var detachedCommentsInfo; var hasWrittenComment = false; - var disabled = compilerOptions.removeComments; + var disabled = printerOptions.removeComments; return { reset: reset, + setWriter: setWriter, setSourceFile: setSourceFile, emitNodeWithComments: emitNodeWithComments, emitBodyWithDetachedComments: emitBodyWithDetachedComments, emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition, + emitLeadingCommentsOfPosition: emitLeadingCommentsOfPosition, }; - function emitNodeWithComments(emitContext, node, emitCallback) { + function emitNodeWithComments(hint, node, emitCallback) { if (disabled) { - emitCallback(emitContext, node); + emitCallback(hint, node); return; } if (node) { - var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; - var emitFlags = ts.getEmitFlags(node); + hasWrittenComment = false; + var emitNode = node.emitNode; + var emitFlags = emitNode && emitNode.flags; + var _a = emitNode && emitNode.commentRange || node, pos = _a.pos, end = _a.end; if ((pos < 0 && end < 0) || (pos === end)) { // Both pos and end are synthesized, so just emit the node without comments. - if (emitFlags & 2048 /* NoNestedComments */) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); } else { if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node @@ -57519,23 +61871,16 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 2048 /* NoNestedComments */) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); if (extendedDiagnostics) { - ts.performance.mark("beginEmitNodeWithComment"); + ts.performance.mark("postEmitNodeWithComment"); } // Restore previous container state. containerPos = savedContainerPos; @@ -57547,11 +61892,75 @@ var ts; emitTrailingComments(end); } if (extendedDiagnostics) { - ts.performance.measure("commentTime", "beginEmitNodeWithComment"); + ts.performance.measure("commentTime", "postEmitNodeWithComment"); } } } } + function emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback) { + var leadingComments = emitNode && emitNode.leadingComments; + if (ts.some(leadingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("preEmitNodeWithSynthesizedComments"); + } + ts.forEach(leadingComments, emitLeadingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "preEmitNodeWithSynthesizedComments"); + } + } + emitNodeWithNestedComments(hint, node, emitFlags, emitCallback); + var trailingComments = emitNode && emitNode.trailingComments; + if (ts.some(trailingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("postEmitNodeWithSynthesizedComments"); + } + ts.forEach(trailingComments, emitTrailingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "postEmitNodeWithSynthesizedComments"); + } + } + } + function emitLeadingSynthesizedComment(comment) { + if (comment.kind === 2 /* SingleLineCommentTrivia */) { + writer.writeLine(); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine || comment.kind === 2 /* SingleLineCommentTrivia */) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + function emitTrailingSynthesizedComment(comment) { + if (!writer.isAtStartOfLine()) { + writer.write(" "); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + } + function writeSynthesizedComment(comment) { + var text = formatSynthesizedComment(comment); + var lineMap = comment.kind === 3 /* MultiLineCommentTrivia */ ? ts.computeLineStarts(text) : undefined; + ts.writeCommentRange(text, lineMap, writer, 0, text.length, newLine); + } + function formatSynthesizedComment(comment) { + return comment.kind === 3 /* MultiLineCommentTrivia */ + ? "/*" + comment.text + "*/" + : "//" + comment.text; + } + function emitNodeWithNestedComments(hint, node, emitFlags, emitCallback) { + if (emitFlags & 2048 /* NoNestedComments */) { + disabled = true; + emitCallback(hint, node); + disabled = false; + } + else { + emitCallback(hint, node); + } + } function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { if (extendedDiagnostics) { ts.performance.mark("preEmitBodyWithDetachedComments"); @@ -57579,6 +61988,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -57612,9 +62024,11 @@ var ts; hasWrittenComment = true; } // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -57622,6 +62036,12 @@ var ts; writer.write(" "); } } + function emitLeadingCommentsOfPosition(pos) { + if (disabled || pos === -1) { + return; + } + emitLeadingComments(pos, /*isEmittedNode*/ true); + } function emitTrailingComments(pos) { forEachTrailingCommentToEmit(pos, emitTrailingComment); } @@ -57630,9 +62050,11 @@ var ts; if (!writer.isAtStartOfLine()) { writer.write(" "); } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -57651,9 +62073,11 @@ var ts; } function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -57684,6 +62108,9 @@ var ts; currentLineMap = undefined; detachedCommentsInfo = undefined; } + function setWriter(output) { + writer = output; + } function setSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = currentSourceFile.text; @@ -57716,15 +62143,17 @@ var ts; } } function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); } /** * Determine if the given comment is a triple-slash * * @return true if the comment is a triple-slash comment else false - **/ + */ function isTripleSlashComment(commentPos, commentEnd) { // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments @@ -57747,15 +62176,17 @@ var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + function getDeclarationDiagnosticsFromFile(_a, sourceFileOrBundle) { var declarationFilePath = _a.declarationFilePath; - emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, /*emitOnlyDtsFiles*/ false); + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sourceFileOrBundle, /*emitOnlyDtsFiles*/ false); } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { + var sourceFiles = sourceFileOrBundle.kind === 265 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 265 /* Bundle */; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -57829,7 +62260,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 237 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -57855,9 +62286,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -57882,12 +62313,14 @@ var ts; var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.reportIllegalExtends = reportIllegalExtends; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -57903,10 +62336,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223 /* VariableDeclaration */) { + if (declaration.kind === 225 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 /* NamedImports */ || declaration.kind === 239 /* ImportSpecifier */ || declaration.kind === 236 /* ImportClause */) { + else if (declaration.kind === 240 /* NamedImports */ || declaration.kind === 241 /* ImportSpecifier */ || declaration.kind === 238 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -57924,7 +62357,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 237 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -57934,12 +62367,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -57958,8 +62391,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -57988,6 +62421,12 @@ var ts; handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true)); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } + function reportIllegalExtends() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, ts.declarationNameToString(errorNameNode))); + } + } function reportInaccessibleThisError() { if (errorNameNode) { reportedDeclarationError = true; @@ -57997,13 +62436,19 @@ var ts; function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); - if (type) { + // use the checker's type, not the declared type, + // for non-optional initialized parameters that aren't a parameter property + var shouldUseResolverType = declaration.kind === 145 /* Parameter */ && + resolver.isRequiredInitializedParameter(declaration); + if (type && !shouldUseResolverType) { // Write the type emitType(type); } else { errorNameNode = declaration.name; - resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); + var format = 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */ | + (shouldUseResolverType ? 4096 /* AddUndefined */ : 0); + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, format, writer); errorNameNode = undefined; } } @@ -58021,15 +62466,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { - var node = nodes_4[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var node = nodes_6[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -58057,49 +62502,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 167 /* ThisType */: - case 171 /* LiteralType */: + case 168 /* ThisType */: + case 172 /* LiteralType */: return writeTextOfNode(currentText, type); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(type); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(type); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(type); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(type); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(type); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenType(type); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(type); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(type); case 70 /* Identifier */: return emitEntityName(type); - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitEntityName(type); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -58107,8 +62553,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 141 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 142 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 142 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -58117,14 +62563,14 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 234 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 236 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 177 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 178 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -58224,7 +62670,7 @@ var ts; currentIdentifiers = node.identifiers; isCurrentFileExternalModule = ts.isExternalModule(node); enclosingDeclaration = node; - ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, /*removeComents*/ true); emitLines(node.statements); } // Return a temp variable name to be used in `export default` statements. @@ -58233,15 +62679,15 @@ var ts; // do not need to keep track of created temp names. function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_38 = baseName + "_" + count; - if (!(name_38 in currentIdentifiers)) { - return name_38; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -58288,10 +62734,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 /* ImportEqualsDeclaration */ || - (node.parent.kind === 261 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 236 /* ImportEqualsDeclaration */ || + (node.parent.kind === 264 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 264 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -58301,7 +62747,7 @@ var ts; }); } else { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -58319,23 +62765,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return writeVariableStatement(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return writeClassDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -58343,7 +62789,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 264 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -58352,7 +62798,7 @@ var ts; if (modifiers & 512 /* Default */) { write("default "); } - else if (node.kind !== 227 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 229 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -58404,7 +62850,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -58428,7 +62874,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 239 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -58449,13 +62895,13 @@ var ts; // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' // so compiler will treat them as external modules. - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 234 /* ImportEqualsDeclaration */) { + if (parent.kind === 236 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230 /* ModuleDeclaration */) { + else if (parent.kind === 232 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -58525,7 +62971,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231 /* ModuleBlock */) { + while (node.body && node.body.kind !== 233 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -58595,7 +63041,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); + return node.parent.kind === 150 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -58606,53 +63052,70 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 161 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 149 /* MethodDeclaration */ || - node.parent.kind === 148 /* MethodSignature */ || - node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.kind === 153 /* CallSignature */ || - node.parent.kind === 154 /* ConstructSignature */); + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 162 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 150 /* MethodDeclaration */ || + node.parent.kind === 149 /* MethodSignature */ || + node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.kind === 154 /* CallSignature */ || + node.parent.kind === 155 /* ConstructSignature */); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } + if (node.default && !isPrivateMethodTypeParameter(node)) { + write(" = "); + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 162 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 150 /* MethodDeclaration */ || + node.parent.kind === 149 /* MethodSignature */ || + node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.kind === 154 /* CallSignature */ || + node.parent.kind === 155 /* ConstructSignature */); + emitType(node.default); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.default, getTypeParameterConstraintVisibilityError); + } + } function getTypeParameterConstraintVisibilityError() { // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -58671,7 +63134,7 @@ var ts; write(">"); } } - function emitHeritageClause(typeReferences, isImplementsList) { + function emitHeritageClause(className, typeReferences, isImplementsList) { if (typeReferences) { write(isImplementsList ? " implements " : " extends "); emitCommaList(typeReferences, emitTypeOfTypeReference); @@ -58685,20 +63148,22 @@ var ts; } else { writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + errorNameNode = className; resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); + errorNameNode = undefined; } function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + if (node.parent.parent.kind === 228 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { // interface is inaccessible - diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + diagnosticMessage = ts.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -58730,9 +63195,10 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); + node.name; + emitHeritageClause(node.name, [baseTypeNode], /*isImplementsList*/ false); } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); + emitHeritageClause(node.name, ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); write(" {"); writeLine(); increaseIndent(); @@ -58753,7 +63219,7 @@ var ts; emitTypeParameters(node.typeParameters); var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); if (interfaceExtendsTypes && interfaceExtendsTypes.length) { - emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false); + emitHeritageClause(node.name, interfaceExtendsTypes, /*isImplementsList*/ false); } write(" {"); writeLine(); @@ -58777,7 +63243,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 223 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -58788,11 +63254,11 @@ var ts; writeTextOfNode(currentText, node.name); // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor // we don't want to emit property declaration with "?" - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */ || - (node.kind === 144 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */ || + (node.kind === 145 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) && node.parent.kind === 161 /* TypeLiteral */) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) && node.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -58805,14 +63271,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) { + else if (node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.hasModifier(node, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? @@ -58821,7 +63287,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -58853,7 +63319,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 /* OmittedExpression */) { + if (element.kind !== 199 /* OmittedExpression */) { elements.push(element); } } @@ -58923,7 +63389,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 151 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -58936,7 +63402,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 /* GetAccessor */ + return accessor.kind === 152 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -58945,7 +63411,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 153 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? @@ -58995,17 +63461,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) { + else if (node.kind === 150 /* MethodDeclaration */ || node.kind === 151 /* Constructor */) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150 /* Constructor */) { + else if (node.kind === 151 /* Constructor */) { write("constructor"); } else { @@ -59025,17 +63491,17 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { // Index signature can have readonly modifier emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { // Construct signature or constructor type write new Signature - if (node.kind === 154 /* ConstructSignature */ || node.kind === 159 /* ConstructorType */) { + if (node.kind === 155 /* ConstructSignature */ || node.kind === 160 /* ConstructorType */) { write("new "); } - else if (node.kind === 158 /* FunctionType */) { + else if (node.kind === 159 /* FunctionType */) { var currentOutput = writer.getText(); // Do not generate incorrect type when function type with type parameters is type argument // This could happen if user used space between two '<' making it error free @@ -59050,22 +63516,22 @@ var ts; } // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 158 /* FunctionType */ || node.kind === 159 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 159 /* FunctionType */ || node.kind === 160 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { + else if (node.kind !== 151 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -59079,26 +63545,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -59106,7 +63572,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59120,7 +63586,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59155,9 +63621,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.parent.kind === 161 /* TypeLiteral */) { + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8 /* Private */)) { @@ -59173,24 +63639,29 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 156 /* IndexSignature */: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -59198,7 +63669,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59211,7 +63682,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59223,12 +63694,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -59239,7 +63710,7 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198 /* OmittedExpression */) { + if (bindingElement.kind === 199 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -59248,7 +63719,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 174 /* BindingElement */) { + else if (bindingElement.kind === 175 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -59287,40 +63758,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 227 /* InterfaceDeclaration */: - case 226 /* ClassDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 229 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return writeFunctionDeclaration(node); - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return emitPropertyDeclaration(node); - case 260 /* EnumMember */: + case 263 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 261 /* SourceFile */: + case 264 /* SourceFile */: return emitSourceFile(node); } } @@ -59338,7 +63809,7 @@ var ts; } else { // Get the declaration file path - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, @@ -59346,8 +63817,9 @@ var ts; referencesOutput += "/// " + newLine; } return addedBundledEmitReference; - function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) { + function getDeclFileName(emitFileNames, sourceFileOrBundle) { // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path + var isBundledEmit = sourceFileOrBundle.kind === 265 /* Bundle */; if (isBundledEmit && !addBundledFileReference) { return; } @@ -59358,10 +63830,11 @@ var ts; } } /* @internal */ - function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { - var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles); + function writeDeclarationFile(declarationFilePath, sourceFileOrBundle, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { + var sourceFiles = sourceFileOrBundle.kind === 265 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -59384,83 +63857,73 @@ var ts; } ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); -/// +/// /// -/// -/// +/// +/// /// -/* @internal */ var ts; (function (ts) { - // Flags enum to track count of temp variables and a few dedicated names - var TempFlags; - (function (TempFlags) { - TempFlags[TempFlags["Auto"] = 0] = "Auto"; - TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; - TempFlags[TempFlags["_i"] = 268435456] = "_i"; - })(TempFlags || (TempFlags = {})); - var id = function (s) { return s; }; - var nullTransformers = [function (_) { return id; }]; + var delimiters = createDelimiterMap(); + var brackets = createBracketsMap(); + /*@internal*/ // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { - var delimiters = createDelimiterMap(); - var brackets = createBracketsMap(); + function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); var newLine = host.getNewLine(); - var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions); var writer = ts.createTextWriter(newLine); - var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var sourceMap = ts.createSourceMapWriter(host, writer); - var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap; - var comments = ts.createCommentWriter(host, writer, sourceMap); - var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition; - var nodeIdToGeneratedName; - var autoGeneratedIdToGeneratedName; - var generatedNameSet; - var tempFlags; var currentSourceFile; - var currentText; - var currentFileIdentifiers; var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); // Transform the source files - ts.performance.mark("beforeTransform"); - var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; - ts.performance.measure("transformTime", "beforeTransform"); + var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false); + // Create a printer to print the nodes + var printer = createPrinter(compilerOptions, { + // resolver hooks + hasGlobalName: resolver.hasGlobalName, + // transform hooks + onEmitNode: transform.emitNodeWithNotification, + substituteNode: transform.substituteNode, + // sourcemap hooks + onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, + onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, + onEmitSourceMapOfPosition: sourceMap.emitPos, + // emitter hooks + onEmitHelpers: emitHelpers, + onSetSourceFile: setSourceFile, + }); // Emit each output file ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); // Clean up emit nodes on parse tree - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; - ts.disposeEmitNodes(sourceFile); - } + transform.dispose(); return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitSourceFileOrBundle(_a, sourceFileOrBundle) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; // Make sure not to write js file and source map file if any of them cannot be written if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { - printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle); } } else { emitSkipped = true; } if (declarationFilePath) { - emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; + emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; } if (!emitSkipped && emittedFilesList) { if (!emitOnlyDtsFiles) { @@ -59474,26 +63937,24 @@ var ts; } } } - function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { - sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); - nodeIdToGeneratedName = []; - autoGeneratedIdToGeneratedName = []; - generatedNameSet = ts.createMap(); - bundledHelpers = isBundledEmit ? ts.createMap() : undefined; - isOwnFileEmit = !isBundledEmit; - // Emit helpers from all the files - if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; - emitHelpers(sourceFile, /*isBundle*/ true); - } - } - // Print each transformed source file. - ts.forEach(sourceFiles, printSourceFile); - writeLine(); + function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { + var bundle = sourceFileOrBundle.kind === 265 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 264 /* SourceFile */ ? sourceFileOrBundle : undefined; + var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); + if (bundle) { + bundledHelpers = ts.createMap(); + isOwnFileEmit = false; + printer.writeBundle(bundle, writer); + } + else { + isOwnFileEmit = true; + printer.writeFile(sourceFile, writer); + } + writer.writeLine(); var sourceMappingURL = sourceMap.getSourceMappingURL(); if (sourceMappingURL) { - write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment + writer.write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment } // Write the source map if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { @@ -59507,138 +63968,232 @@ var ts; ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); // Reset state sourceMap.reset(); - comments.reset(); writer.reset(); - tempFlags = 0 /* Auto */; currentSourceFile = undefined; - currentText = undefined; + bundledHelpers = undefined; isOwnFileEmit = false; } - function printSourceFile(node) { + function setSourceFile(node) { currentSourceFile = node; - currentText = node.text; - currentFileIdentifiers = node.identifiers; sourceMap.setSourceFile(node); - comments.setSourceFile(node); - pipelineEmitWithNotification(0 /* SourceFile */, node); } - /** - * Emits a node. - */ + function emitHelpers(node, writeLines) { + var helpersEmitted = false; + var bundle = node.kind === 265 /* Bundle */ ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; + } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + // Skip the helper if it can be skipped and the noEmitHelpers compiler + // option is set, or if it can be imported and the importHelpers compiler + // option is set. + if (shouldSkip) + continue; + // Skip the helper if it can be bundled but hasn't already been emitted and we + // are emitting a bundled module. + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + // Skip the helper if it is scoped and we are emitting bundled helpers + continue; + } + writeLines(helper.text); + helpersEmitted = true; + } + } + } + return helpersEmitted; + } + } + ts.emitFiles = emitFiles; + function createPrinter(printerOptions, handlers) { + if (printerOptions === void 0) { printerOptions = {}; } + if (handlers === void 0) { handlers = {}; } + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray; + var newLine = ts.getNewLineCharacter(printerOptions); + var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); + var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; + var currentSourceFile; + var nodeIdToGeneratedName; // Map of generated names for specific nodes. + var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. + var generatedNames; // Set of names generated by the NameGenerator. + var tempFlagsStack; // Stack of enclosing name generation scopes. + var tempFlags; // TempFlags for the current name generation scope. + var writer; + var ownWriter; + reset(); + return { + // public API + printNode: printNode, + printFile: printFile, + printBundle: printBundle, + // internal API + writeNode: writeNode, + writeFile: writeFile, + writeBundle: writeBundle + }; + function printNode(hint, node, sourceFile) { + switch (hint) { + case 0 /* SourceFile */: + ts.Debug.assert(ts.isSourceFile(node), "Expected a SourceFile node."); + break; + case 2 /* IdentifierName */: + ts.Debug.assert(ts.isIdentifier(node), "Expected an Identifier node."); + break; + case 1 /* Expression */: + ts.Debug.assert(ts.isExpression(node), "Expected an Expression node."); + break; + } + switch (node.kind) { + case 264 /* SourceFile */: return printFile(node); + case 265 /* Bundle */: return printBundle(node); + } + writeNode(hint, node, sourceFile, beginPrint()); + return endPrint(); + } + function printBundle(bundle) { + writeBundle(bundle, beginPrint()); + return endPrint(); + } + function printFile(sourceFile) { + writeFile(sourceFile, beginPrint()); + return endPrint(); + } + function writeNode(hint, node, sourceFile, output) { + var previousWriter = writer; + setWriter(output); + print(hint, node, sourceFile); + reset(); + writer = previousWriter; + } + function writeBundle(bundle, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(bundle); + emitPrologueDirectivesIfNeeded(bundle); + emitHelpersIndirect(bundle); + for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + print(0 /* SourceFile */, sourceFile, sourceFile); + } + reset(); + writer = previousWriter; + } + function writeFile(sourceFile, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(sourceFile); + emitPrologueDirectivesIfNeeded(sourceFile); + print(0 /* SourceFile */, sourceFile, sourceFile); + reset(); + writer = previousWriter; + } + function beginPrint() { + return ownWriter || (ownWriter = ts.createTextWriter(newLine)); + } + function endPrint() { + var text = ownWriter.getText(); + ownWriter.reset(); + return text; + } + function print(hint, node, sourceFile) { + setSourceFile(sourceFile); + pipelineEmitWithNotification(hint, node); + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + comments.setSourceFile(sourceFile); + if (onSetSourceFile) { + onSetSourceFile(sourceFile); + } + } + function setWriter(output) { + writer = output; + comments.setWriter(output); + } + function reset() { + nodeIdToGeneratedName = []; + autoGeneratedIdToGeneratedName = []; + generatedNames = ts.createMap(); + tempFlagsStack = []; + tempFlags = 0 /* Auto */; + comments.reset(); + setWriter(/*output*/ undefined); + } function emit(node) { pipelineEmitWithNotification(3 /* Unspecified */, node); } - /** - * Emits an IdentifierName. - */ function emitIdentifierName(node) { pipelineEmitWithNotification(2 /* IdentifierName */, node); } - /** - * Emits an expression node. - */ function emitExpression(node) { pipelineEmitWithNotification(1 /* Expression */, node); } - /** - * Emits a node with possible notification. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called from printSourceFile, emit, emitExpression, or - * emitIdentifierName. - */ - function pipelineEmitWithNotification(emitContext, node) { - emitNodeWithNotification(emitContext, node, pipelineEmitWithComments); - } - /** - * Emits a node with comments. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithNotification. - */ - function pipelineEmitWithComments(emitContext, node) { - // Do not emit comments for SourceFile - if (emitContext === 0 /* SourceFile */) { - pipelineEmitWithSourceMap(emitContext, node); - return; + function pipelineEmitWithNotification(hint, node) { + if (onEmitNode) { + onEmitNode(hint, node, pipelineEmitWithComments); } - emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap); - } - /** - * Emits a node with source maps. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithComments. - */ - function pipelineEmitWithSourceMap(emitContext, node) { - // Do not emit source mappings for SourceFile or IdentifierName - if (emitContext === 0 /* SourceFile */ - || emitContext === 2 /* IdentifierName */) { - pipelineEmitWithSubstitution(emitContext, node); - return; + else { + pipelineEmitWithComments(hint, node); } - emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution); - } - /** - * Emits a node with possible substitution. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithSourceMap or - * pipelineEmitInUnspecifiedContext (when picking a more specific context). - */ - function pipelineEmitWithSubstitution(emitContext, node) { - emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext); } - /** - * Emits a node. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithSubstitution. - */ - function pipelineEmitForContext(emitContext, node) { - switch (emitContext) { - case 0 /* SourceFile */: return pipelineEmitInSourceFileContext(node); - case 2 /* IdentifierName */: return pipelineEmitInIdentifierNameContext(node); - case 3 /* Unspecified */: return pipelineEmitInUnspecifiedContext(node); - case 1 /* Expression */: return pipelineEmitInExpressionContext(node); + function pipelineEmitWithComments(hint, node) { + node = trySubstituteNode(hint, node); + if (emitNodeWithComments && hint !== 0 /* SourceFile */) { + emitNodeWithComments(hint, node, pipelineEmitWithSourceMap); + } + else { + pipelineEmitWithSourceMap(hint, node); } } - /** - * Emits a node in the SourceFile EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInSourceFileContext(node) { - var kind = node.kind; - switch (kind) { - // Top-level nodes - case 261 /* SourceFile */: - return emitSourceFile(node); + function pipelineEmitWithSourceMap(hint, node) { + if (onEmitSourceMapOfNode && hint !== 0 /* SourceFile */ && hint !== 2 /* IdentifierName */) { + onEmitSourceMapOfNode(hint, node, pipelineEmitWithHint); + } + else { + pipelineEmitWithHint(hint, node); } } - /** - * Emits a node in the IdentifierName EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInIdentifierNameContext(node) { - var kind = node.kind; - switch (kind) { - // Identifiers - case 70 /* Identifier */: - return emitIdentifier(node); + function pipelineEmitWithHint(hint, node) { + switch (hint) { + case 0 /* SourceFile */: return pipelineEmitSourceFile(node); + case 2 /* IdentifierName */: return pipelineEmitIdentifierName(node); + case 1 /* Expression */: return pipelineEmitExpression(node); + case 3 /* Unspecified */: return pipelineEmitUnspecified(node); } } - /** - * Emits a node in the Unspecified EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInUnspecifiedContext(node) { + function pipelineEmitSourceFile(node) { + ts.Debug.assertNode(node, ts.isSourceFile); + emitSourceFile(node); + } + function pipelineEmitIdentifierName(node) { + ts.Debug.assertNode(node, ts.isIdentifier); + emitIdentifier(node); + } + function pipelineEmitUnspecified(node) { var kind = node.kind; + // Reserved words + // Strict mode reserved words + // Contextual keywords + if (ts.isKeyword(kind)) { + writeTokenText(kind); + return; + } switch (kind) { // Pseudo-literals case 13 /* TemplateHead */: @@ -59648,254 +64203,217 @@ var ts; // Identifiers case 70 /* Identifier */: return emitIdentifier(node); - // Reserved words - case 75 /* ConstKeyword */: - case 78 /* DefaultKeyword */: - case 83 /* ExportKeyword */: - case 104 /* VoidKeyword */: - // Strict mode reserved words - case 111 /* PrivateKeyword */: - case 112 /* ProtectedKeyword */: - case 113 /* PublicKeyword */: - case 114 /* StaticKeyword */: - // Contextual keywords - case 116 /* AbstractKeyword */: - case 117 /* AsKeyword */: - case 118 /* AnyKeyword */: - case 119 /* AsyncKeyword */: - case 120 /* AwaitKeyword */: - case 121 /* BooleanKeyword */: - case 122 /* ConstructorKeyword */: - case 123 /* DeclareKeyword */: - case 124 /* GetKeyword */: - case 125 /* IsKeyword */: - case 127 /* ModuleKeyword */: - case 128 /* NamespaceKeyword */: - case 129 /* NeverKeyword */: - case 130 /* ReadonlyKeyword */: - case 131 /* RequireKeyword */: - case 132 /* NumberKeyword */: - case 133 /* SetKeyword */: - case 134 /* StringKeyword */: - case 135 /* SymbolKeyword */: - case 136 /* TypeKeyword */: - case 137 /* UndefinedKeyword */: - case 138 /* FromKeyword */: - case 139 /* GlobalKeyword */: - case 140 /* OfKeyword */: - writeTokenText(kind); - return; // Parse tree nodes // Names - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitQualifiedName(node); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return emitTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return emitParameter(node); - case 145 /* Decorator */: + case 146 /* Decorator */: return emitDecorator(node); // Type members - case 146 /* PropertySignature */: + case 147 /* PropertySignature */: return emitPropertySignature(node); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return emitPropertyDeclaration(node); - case 148 /* MethodSignature */: + case 149 /* MethodSignature */: return emitMethodSignature(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return emitMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return emitConstructor(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 153 /* CallSignature */: + case 154 /* CallSignature */: return emitCallSignature(node); - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return emitConstructSignature(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return emitIndexSignature(node); // Types - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(node); - case 158 /* FunctionType */: + case 159 /* FunctionType */: return emitFunctionType(node); - case 159 /* ConstructorType */: + case 160 /* ConstructorType */: return emitConstructorType(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(node); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(node); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenthesizedType(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 167 /* ThisType */: + case 168 /* ThisType */: return emitThisType(); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return emitLiteralType(node); // Binding patterns - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return emitBindingElement(node); // Misc - case 202 /* TemplateSpan */: + case 204 /* TemplateSpan */: return emitTemplateSpan(node); - case 203 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 204 /* Block */: + case 206 /* Block */: return emitBlock(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return emitVariableStatement(node); - case 206 /* EmptyStatement */: + case 208 /* EmptyStatement */: return emitEmptyStatement(); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return emitExpressionStatement(node); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return emitIfStatement(node); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return emitDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return emitWhileStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return emitForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return emitForInStatement(node); - case 213 /* ForOfStatement */: + case 215 /* ForOfStatement */: return emitForOfStatement(node); - case 214 /* ContinueStatement */: + case 216 /* ContinueStatement */: return emitContinueStatement(node); - case 215 /* BreakStatement */: + case 217 /* BreakStatement */: return emitBreakStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return emitReturnStatement(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return emitWithStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return emitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return emitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return emitThrowStatement(node); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return emitTryStatement(node); - case 222 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return emitClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: return emitModuleBlock(node); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: return emitCaseBlock(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return emitImportDeclaration(node); - case 236 /* ImportClause */: + case 238 /* ImportClause */: return emitImportClause(node); - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: return emitNamespaceImport(node); - case 238 /* NamedImports */: + case 240 /* NamedImports */: return emitNamedImports(node); - case 239 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return emitImportSpecifier(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 242 /* NamedExports */: + case 244 /* NamedExports */: return emitNamedExports(node); - case 243 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return emitExportSpecifier(node); - case 244 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return; // Module references - case 245 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 248 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: return emitJsxOpeningElement(node); - case 249 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return emitJsxClosingElement(node); - case 250 /* JsxAttribute */: + case 252 /* JsxAttribute */: return emitJsxAttribute(node); - case 251 /* JsxSpreadAttribute */: + case 253 /* JsxAttributes */: + return emitJsxAttributes(node); + case 254 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 253 /* CaseClause */: + case 256 /* CaseClause */: return emitCaseClause(node); - case 254 /* DefaultClause */: + case 257 /* DefaultClause */: return emitDefaultClause(node); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: return emitHeritageClause(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 260 /* EnumMember */: + case 263 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with // substitution. if (ts.isExpression(node)) { - return pipelineEmitWithSubstitution(1 /* Expression */, node); + return pipelineEmitExpression(trySubstituteNode(1 /* Expression */, node)); + } + if (ts.isToken(node)) { + writeTokenText(kind); + return; } } - /** - * Emits a node in the Expression EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInExpressionContext(node) { + function pipelineEmitExpression(node) { var kind = node.kind; switch (kind) { // Literals @@ -59917,68 +64435,76 @@ var ts; writeTokenText(kind); return; // Expressions - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return emitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return emitNewExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return emitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return emitArrowFunction(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return emitDeleteExpression(node); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return emitVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return emitAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return emitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return emitConditionalExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return emitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return emitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return emitSpreadExpression(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return emitClassExpression(node); - case 198 /* OmittedExpression */: + case 199 /* OmittedExpression */: return; - case 200 /* AsExpression */: + case 201 /* AsExpression */: return emitAsExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return emitNonNullExpression(node); + case 203 /* MetaProperty */: + return emitMetaProperty(node); // JSX - case 246 /* JsxElement */: + case 248 /* JsxElement */: return emitJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 297 /* RawExpression */: - return writeLines(node.text); + } + } + function trySubstituteNode(hint, node) { + return node && substituteNode && substituteNode(hint, node) || node; + } + function emitHelpersIndirect(node) { + if (onEmitHelpers) { + onEmitHelpers(node, writeLines); } } // @@ -59987,9 +64513,6 @@ var ts; // SyntaxKind.NumericLiteral function emitNumericLiteral(node) { emitLiteral(node); - if (node.trailingComment) { - write(" /*" + node.trailingComment + "*/"); - } } // SyntaxKind.StringLiteral // SyntaxKind.RegularExpressionLiteral @@ -59999,7 +64522,7 @@ var ts; // SyntaxKind.TemplateTail function emitLiteral(node) { var text = getLiteralTextOfNode(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) + if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -60047,8 +64570,8 @@ var ts; writeIfPresent(node.dotDotDotToken, "..."); emit(node.name); writeIfPresent(node.questionToken, "?"); - emitExpressionWithPrefix(" = ", node.initializer); emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { write("@"); @@ -60098,7 +64621,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 152 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -60201,17 +64724,13 @@ var ts; write("{"); writeLine(); increaseIndent(); - if (node.readonlyToken) { - write("readonly "); - } + writeIfPresent(node.readonlyToken, "readonly "); write("["); emit(node.typeParameter.name); write(" in "); emit(node.typeParameter.constraint); write("]"); - if (node.questionToken) { - write("?"); - } + writeIfPresent(node.questionToken, "?"); write(": "); emit(node.type); write(";"); @@ -60277,7 +64796,7 @@ var ts; increaseIndent(); } var preferNewLine = node.multiLine ? 32768 /* PreferNewLine */ : 0 /* None */; - var allowTrailingComma = languageVersion >= 1 /* ES5 */ ? 32 /* AllowTrailingComma */ : 0 /* None */; + var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ ? 32 /* AllowTrailingComma */ : 0 /* None */; emitList(node, properties, 978 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine); if (indentedFlag) { decreaseIndent(); @@ -60289,7 +64808,7 @@ var ts; var indentAfterDot = false; if (!(ts.getEmitFlags(node) & 65536 /* NoIndentation */)) { var dotRangeStart = node.expression.end; - var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; + var dotRangeEnd = ts.skipTrivia(currentSourceFile.text, node.expression.end) + 1; var dotToken = { kind: 22 /* DotToken */, pos: dotRangeStart, end: dotRangeEnd }; indentBeforeDot = needsIndentation(node, node.expression, dotToken); indentAfterDot = needsIndentation(node, dotToken, node.name); @@ -60305,10 +64824,12 @@ var ts; // 1..toString is a valid property access, emit a dot after the literal // Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal function needsDotDotForPropertyAccess(expression) { - if (expression.kind === 8 /* NumericLiteral */) { - // check if numeric literal was originally written with a dot + expression = ts.skipPartiallyEmittedExpressions(expression); + if (ts.isNumericLiteral(expression)) { + // check if numeric literal is a decimal literal that was originally written with a dot var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; + return !expression.numericLiteralFlags + && text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { // check if constant enum value is integer @@ -60316,7 +64837,7 @@ var ts; // isFinite handles cases when constantValue is undefined return isFinite(constantValue) && Math.floor(constantValue) === constantValue - && compilerOptions.removeComments; + && printerOptions.removeComments; } } function emitElementAccessExpression(node) { @@ -60342,11 +64863,9 @@ var ts; emitExpression(node.template); } function emitTypeAssertionExpression(node) { - if (node.type) { - write("<"); - emit(node.type); - write(">"); - } + write("<"); + emit(node.type); + write(">"); emitExpression(node.expression); } function emitParenthesizedExpression(node) { @@ -60405,7 +64924,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 190 /* PrefixUnaryExpression */ + return operand.kind === 191 /* PrefixUnaryExpression */ && ((node.operator === 36 /* PlusToken */ && (operand.operator === 36 /* PlusToken */ || operand.operator === 42 /* PlusPlusToken */)) || (node.operator === 37 /* MinusToken */ && (operand.operator === 37 /* MinusToken */ || operand.operator === 43 /* MinusMinusToken */))); } @@ -60471,6 +64990,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } // // Misc // @@ -60490,6 +65014,10 @@ var ts; else { writeToken(16 /* OpenBraceToken */, node.pos, /*contextNode*/ node); emitBlockStatements(node); + // We have to call emitLeadingComments explicitly here because otherwise leading comments of the close brace token will not be emitted + increaseIndent(); + emitLeadingCommentsOfPosition(node.statements.end); + decreaseIndent(); writeToken(17 /* CloseBraceToken */, node.statements.end, /*contextNode*/ node); } } @@ -60519,27 +65047,27 @@ var ts; writeToken(18 /* OpenParenToken */, openParenPos, node); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81 /* ElseKeyword */, node.thenStatement.end, node); - if (node.elseStatement.kind === 208 /* IfStatement */) { + if (node.elseStatement.kind === 210 /* IfStatement */) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -60549,7 +65077,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60561,7 +65089,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60571,21 +65099,22 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); write(" "); + emitWithSuffix(node.awaitModifier, " "); writeToken(18 /* OpenParenToken */, openParenPos); emitForBinding(node.initializer); write(" of "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { emit(node); } else { @@ -60612,7 +65141,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97 /* SwitchKeyword */, node.pos); @@ -60636,9 +65165,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -60669,6 +65201,9 @@ var ts; emitIdentifierName(node.name); emitSignatureAndBody(node, emitSignatureHead); } + function emitBlockCallback(_hint, body) { + emitBlockFunctionBody(body); + } function emitSignatureAndBody(node, emitSignatureHead) { var body = node.body; if (body) { @@ -60679,14 +65214,23 @@ var ts; } if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) { emitSignatureHead(node); - emitBlockFunctionBody(body); + if (onEmitNode) { + onEmitNode(3 /* Unspecified */, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); emitSignatureHead(node); - emitBlockFunctionBody(body); - tempFlags = savedTempFlags; + if (onEmitNode) { + onEmitNode(3 /* Unspecified */, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } + popNameGenerationScope(); } if (indentedFlag) { decreaseIndent(); @@ -60741,9 +65285,15 @@ var ts; function emitBlockFunctionBody(body) { write(" {"); increaseIndent(); - emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body) + var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine - : emitBlockFunctionBodyWorker); + : emitBlockFunctionBodyWorker; + if (emitBodyWithDetachedComments) { + emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody); + } + else { + emitBlockFunctionBody(body); + } decreaseIndent(); writeToken(17 /* CloseBraceToken */, body.statements.end, body); } @@ -60753,8 +65303,9 @@ var ts; function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { // Emit all the prologue directives (like "use strict"). var statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true); - var helpersEmitted = emitHelpers(body); - if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) { + var pos = writer.getTextPos(); + emitHelpersIndirect(body); + if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384 /* SingleLineFunctionBodyStatements */); increaseIndent(); @@ -60777,15 +65328,14 @@ var ts; } emitTypeParameters(node, node.typeParameters); emitList(node, node.heritageClauses, 256 /* ClassHeritageClauses */); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 65 /* ClassMembers */); write("}"); + popNameGenerationScope(); if (indentedFlag) { decreaseIndent(); } - tempFlags = savedTempFlags; } function emitInterfaceDeclaration(node) { emitDecorators(node, node.decorators); @@ -60812,19 +65362,18 @@ var ts; emitModifiers(node, node.modifiers); write("enum "); emit(node.name); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 81 /* EnumMembers */); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } function emitModuleDeclaration(node) { emitModifiers(node, node.modifiers); write(node.flags & 16 /* Namespace */ ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230 /* ModuleDeclaration */) { + while (body.kind === 232 /* ModuleDeclaration */) { write("."); emit(body.name); body = body.body; @@ -60837,13 +65386,11 @@ var ts; write("{ }"); } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write("{"); - increaseIndent(); emitBlockStatements(node); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } } function emitCaseBlock(node) { @@ -60951,14 +65498,20 @@ var ts; write("<"); emitJsxTagName(node.tagName); write(" "); - emitList(node, node.attributes, 131328 /* JsxElementAttributes */); + // We are checking here so we won't re-enter the emiting pipeline and emit extra sourcemap + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write("/>"); } function emitJsxOpeningElement(node) { write("<"); emitJsxTagName(node.tagName); - writeIfAny(node.attributes, " "); - emitList(node, node.attributes, 131328 /* JsxElementAttributes */); + writeIfAny(node.attributes.properties, " "); + // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write(">"); } function emitJsxText(node) { @@ -60969,6 +65522,9 @@ var ts; emitJsxTagName(node.tagName); write(">"); } + function emitJsxAttributes(node) { + emitList(node, node.properties, 131328 /* JsxElementAttributes */); + } function emitJsxAttribute(node) { emit(node.name); emitWithPrefix("=", node.initializer); @@ -60981,6 +65537,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -61028,7 +65587,6 @@ var ts; emitList(node, node.types, 272 /* HeritageClauseTypes */); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73 /* CatchKeyword */, node.pos); write(" "); writeToken(18 /* OpenParenToken */, openParenPos); @@ -61051,7 +65609,7 @@ var ts; // "comment1" is not considered to be leading comment for node.initializer // but rather a trailing comment on the previous node. var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) { + if (emitTrailingCommentsOfPosition && (ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -61082,17 +65640,27 @@ var ts; // function emitSourceFile(node) { writeLine(); - emitShebang(); - emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker); + var statements = node.statements; + if (emitBodyWithDetachedComments) { + // Emit detached comment if there are no prologue directives or if the first node is synthesized. + // The synthesized node will have no leading comment so some comments may be missed. + var shouldEmitDetachedComment = statements.length === 0 || + !ts.isPrologueDirective(statements[0]) || + ts.nodeIsSynthesized(statements[0]); + if (shouldEmitDetachedComment) { + emitBodyWithDetachedComments(node, statements, emitSourceFileWorker); + return; + } + } + emitSourceFileWorker(node); } function emitSourceFileWorker(node) { var statements = node.statements; - var statementOffset = emitPrologueDirectives(statements); - var savedTempFlags = tempFlags; - tempFlags = 0; - emitHelpers(node); - emitList(node, statements, 1 /* MultiLine */, statementOffset); - tempFlags = savedTempFlags; + pushNameGenerationScope(); + emitHelpersIndirect(node); + var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); + emitList(node, statements, 1 /* MultiLine */, index === -1 ? statements.length : index); + popNameGenerationScope(); } // Transformation nodes function emitPartiallyEmittedExpression(node) { @@ -61102,13 +65670,20 @@ var ts; * Emits any prologue directives at the start of a Statement list, returning the * number of prologue directives written to the output. */ - function emitPrologueDirectives(statements, startWithNewLine) { + function emitPrologueDirectives(statements, startWithNewLine, seenPrologueDirectives) { for (var i = 0; i < statements.length; i++) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); + var statement = statements[i]; + if (ts.isPrologueDirective(statement)) { + var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true; + if (shouldEmitPrologueDirective) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statement); + if (seenPrologueDirectives) { + seenPrologueDirectives.set(statement.expression.text, statement.expression.text); + } } - emit(statements[i]); } else { // return index of the first non prologue directive @@ -61117,81 +65692,42 @@ var ts; } return statements.length; } - function emitHelpers(node, isBundle) { - var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); - var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; - var helpersEmitted = false; - var helpers = ts.getEmitHelpers(node); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - // Skip the helper if it can be skipped and the noEmitHelpers compiler - // option is set, or if it can be imported and the importHelpers compiler - // option is set. - if (shouldSkip) - continue; - // Skip the helper if it can be bundled but hasn't already been emitted and we - // are emitting a bundled module. - if (shouldBundle) { - if (bundledHelpers[helper.name]) { - continue; - } - bundledHelpers[helper.name] = true; - } - } - else if (isBundle) { - // Skip the helper if it is scoped and we are emitting bundled helpers - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } + function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + setSourceFile(sourceFileOrBundle); + emitPrologueDirectives(sourceFileOrBundle.statements); } - if (helpersEmitted) { - writeLine(); + else { + var seenPrologueDirectives = ts.createMap(); + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + setSourceFile(sourceFile); + emitPrologueDirectives(sourceFile.statements, /*startWithNewLine*/ true, seenPrologueDirectives); + } } - return helpersEmitted; } - function writeLines(text) { - var lines = text.split(/\r\n?|\n/g); - var indentation = guessIndentation(lines); - for (var i = 0; i < lines.length; i++) { - var line = indentation ? lines[i].slice(indentation) : lines[i]; - if (line.length) { - if (i > 0) { - writeLine(); - } - write(line); + function emitShebangIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + var shebang = ts.getShebang(sourceFileOrBundle.text); + if (shebang) { + write(shebang); + writeLine(); + return true; } } - } - function guessIndentation(lines) { - var indentation; - for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { - var line = lines_1[_a]; - for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { - if (!ts.isWhiteSpace(line.charCodeAt(i))) { - if (indentation === undefined || i < indentation) { - indentation = i; - break; - } + else { + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + // Emit only the first encountered shebang + if (emitShebangIfNeeded(sourceFile)) { + break; } } } - return indentation; } // // Helpers // - function emitShebang() { - var shebang = ts.getShebang(currentText); - if (shebang) { - write(shebang); - writeLine(); - } - } function emitModifiers(node, modifiers) { if (modifiers && modifiers.length) { emitList(node, modifiers, 256 /* Modifiers */); @@ -61216,8 +65752,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1 /* SingleLine */) { write(" "); emit(node); } @@ -61274,6 +65810,9 @@ var ts; if (format & 7680 /* BracketsMask */) { write(getOpeningBracket(format)); } + if (onBeforeEmitNodeArray) { + onBeforeEmitNodeArray(children); + } if (isEmpty) { // Write a line terminator if the parent node was multi-line if (format & 1 /* MultiLine */) { @@ -61306,6 +65845,15 @@ var ts; var child = children[start + i]; // Write the delimiter if this is not the first node. if (previousSibling) { + // i.e + // function commentedParameters( + // /* Parameter a */ + // a + // /* End of parameter a */ -> this comment isn't considered to be trailing comment of parameter "a" due to newline + // , + if (delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } write(delimiter); // Write either a line terminator or whitespace to separate the elements. if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) { @@ -61322,14 +65870,16 @@ var ts; write(" "); } } + // Emit this child. if (shouldEmitInterveningComments) { - var commentRange = ts.getCommentRange(child); - emitTrailingCommentsOfPosition(commentRange.pos); + if (emitTrailingCommentsOfPosition) { + var commentRange = ts.getCommentRange(child); + emitTrailingCommentsOfPosition(commentRange.pos); + } } else { shouldEmitInterveningComments = mayEmitInterveningComments; } - // Emit this child. emit(child); if (shouldDecreaseIndentAfterEmit) { decreaseIndent(); @@ -61342,6 +65892,15 @@ var ts; if (format & 16 /* CommaDelimited */ && hasTrailingComma) { write(","); } + // Emit any trailing comment of the last element in the list + // i.e + // var array = [... + // 2 + // /* end of element 2 */ + // ]; + if (previousSibling && delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } // Decrease the indent, if requested. if (format & 64 /* Indented */) { decreaseIndent(); @@ -61354,28 +65913,80 @@ var ts; write(" "); } } + if (onAfterEmitNodeArray) { + onAfterEmitNodeArray(children); + } if (format & 7680 /* BracketsMask */) { write(getClosingBracket(format)); } } + function write(s) { + writer.write(s); + } + function writeLine() { + writer.writeLine(); + } + function increaseIndent() { + writer.increaseIndent(); + } + function decreaseIndent() { + writer.decreaseIndent(); + } function writeIfAny(nodes, text) { - if (nodes && nodes.length > 0) { + if (ts.some(nodes)) { write(text); } } function writeIfPresent(node, text) { - if (node !== undefined) { + if (node) { write(text); } } function writeToken(token, pos, contextNode) { - return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText); + return onEmitSourceMapOfToken + ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) + : writeTokenText(token, pos); } function writeTokenText(token, pos) { var tokenString = ts.tokenToString(token); write(tokenString); return pos < 0 ? pos : pos + tokenString.length; } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { + write(" "); + } + else { + writeLine(); + } + } + function writeLines(text) { + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); + for (var i = 0; i < lines.length; i++) { + var line = indentation ? lines[i].slice(indentation) : lines[i]; + if (line.length) { + writeLine(); + write(line); + writeLine(); + } + } + } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } function increaseIndentIf(value, valueToWriteWhenNotIndenting) { if (value) { increaseIndent(); @@ -61485,15 +66096,23 @@ var ts; && !ts.nodeIsSynthesized(node2) && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } + function isSingleLineEmptyBlock(block) { + return !block.multiLine + && isEmptyBlock(block); + } + function isEmptyBlock(block) { + return block.statements.length === 0 + && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + } function skipSynthesizedParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { if (ts.isGeneratedIdentifier(node)) { - return getGeneratedIdentifier(node); + return generateName(node); } else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { return ts.unescapeIdentifier(node.text); @@ -61516,26 +66135,60 @@ var ts; return getLiteralTextOfNode(textSourceNode); } } - return ts.getLiteralText(node, currentSourceFile, languageVersion); + return ts.getLiteralText(node, currentSourceFile); } - function isSingleLineEmptyBlock(block) { - return !block.multiLine - && isEmptyBlock(block); + /** + * Push a new name generation scope. + */ + function pushNameGenerationScope() { + tempFlagsStack.push(tempFlags); + tempFlags = 0; } - function isEmptyBlock(block) { - return block.statements.length === 0 - && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + /** + * Pop the current name generation scope. + */ + function popNameGenerationScope() { + tempFlags = tempFlagsStack.pop(); + } + /** + * Generate the text for a generated identifier. + */ + function generateName(name) { + if (name.autoGenerateKind === 4 /* Node */) { + // Node names generate unique names based on their original node + // and are cached based on that node's id. + var node = getNodeForGeneratedName(name); + return generateNameCached(node); + } + else { + // Auto, Loop, and Unique names are cached based on their unique + // autoGenerateId. + var autoGenerateId = name.autoGenerateId; + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(makeName(name))); + } } + function generateNameCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } + /** + * Returns a value indicating whether a name is unique globally, within the current file, + * or within the NameGenerator. + */ function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name) + && !generatedNames.has(name); } + /** + * Returns a value indicating whether a name is unique within a container. + */ function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals) { + var local = node.locals.get(name); // We conservatively include alias symbols to cover cases where they're emitted as locals - if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { + if (local && local.flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { return false; } } @@ -61543,16 +66196,16 @@ var ts; return true; } /** - * Return the next available name in the pattern _a ... _z, _0, _1, ... - * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. - * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. - */ + * Return the next available name in the pattern _a ... _z, _0, _1, ... + * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. + * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. + */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_39 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_39)) { + var name = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_39; + return name; } } while (true) { @@ -61560,19 +66213,21 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_40 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_40)) { - return name_40; + if (isUniqueName(name)) { + return name; } } } } - // Generate a name that is unique within the current file and doesn't conflict with any names - // in global scope. The name is formed by adding an '_n' suffix to the specified base name, - // where n is a positive integer. Note that names generated by makeTempVariableName and - // makeUniqueName are guaranteed to never conflict. + /** + * Generate a name that is unique within the current file and doesn't conflict with any names + * in global scope. The name is formed by adding an '_n' suffix to the specified base name, + * where n is a positive integer. Note that names generated by makeTempVariableName and + * makeUniqueName are guaranteed to never conflict. + */ function makeUniqueName(baseName) { // Find the first unique 'name_n', where n is a positive number if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { @@ -61582,73 +66237,90 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNames.set(generatedName, generatedName); + return generatedName; } i++; } } + /** + * Generates a unique name for a ModuleDeclaration or EnumDeclaration. + */ function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation return isUniqueLocalName(name, node) ? name : makeUniqueName(name); } + /** + * Generates a unique name for an ImportDeclaration or ExportDeclaration. + */ function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); var baseName = expr.kind === 9 /* StringLiteral */ ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; return makeUniqueName(baseName); } + /** + * Generates a unique name for a default export. + */ function generateNameForExportDefault() { return makeUniqueName("default"); } + /** + * Generates a unique name for a class expression. + */ function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameCached(node.name); + } + return makeTempVariableName(0 /* Auto */); + } /** * Generates a unique name from a node. - * - * @param node A node. */ function generateNameForNode(node) { switch (node.kind) { case 70 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 235 /* ImportDeclaration */: - case 241 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 243 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: - case 240 /* ExportAssignment */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 242 /* ExportAssignment */: return generateNameForExportDefault(); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return generateNameForClassExpression(); + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0 /* Auto */); } } /** * Generates a unique identifier for a node. - * - * @param name A generated name. */ - function generateName(name) { + function makeName(name) { switch (name.autoGenerateKind) { case 1 /* Auto */: return makeTempVariableName(0 /* Auto */); case 2 /* Loop */: return makeTempVariableName(268435456 /* _i */); case 3 /* Unique */: - return makeUniqueName(name.text); + return makeUniqueName(ts.unescapeIdentifier(name.text)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } /** * Gets the node from which a name should be generated. - * - * @param name A generated name wrapper. */ function getNodeForGeneratedName(name) { var autoGenerateId = name.autoGenerateId; @@ -61668,53 +66340,40 @@ var ts; // otherwise, return the original node for the source; return node; } - /** - * Gets the generated identifier text from a generated identifier. - * - * @param name The generated identifier. - */ - function getGeneratedIdentifier(name) { - if (name.autoGenerateKind === 4 /* Node */) { - // Generated names generate unique names based on their original node - // and are cached based on that node's id - var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); - } - else { - // Auto, Loop, and Unique names are cached based on their unique - // autoGenerateId. - var autoGenerateId = name.autoGenerateId; - return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name))); - } - } - function createDelimiterMap() { - var delimiters = []; - delimiters[0 /* None */] = ""; - delimiters[16 /* CommaDelimited */] = ","; - delimiters[4 /* BarDelimited */] = " |"; - delimiters[8 /* AmpersandDelimited */] = " &"; - return delimiters; - } - function getDelimiter(format) { - return delimiters[format & 28 /* DelimitersMask */]; - } - function createBracketsMap() { - var brackets = []; - brackets[512 /* Braces */] = ["{", "}"]; - brackets[1024 /* Parenthesis */] = ["(", ")"]; - brackets[2048 /* AngleBrackets */] = ["<", ">"]; - brackets[4096 /* SquareBrackets */] = ["[", "]"]; - return brackets; - } - function getOpeningBracket(format) { - return brackets[format & 7680 /* BracketsMask */][0]; - } - function getClosingBracket(format) { - return brackets[format & 7680 /* BracketsMask */][1]; - } } - ts.emitFiles = emitFiles; + ts.createPrinter = createPrinter; + function createDelimiterMap() { + var delimiters = []; + delimiters[0 /* None */] = ""; + delimiters[16 /* CommaDelimited */] = ","; + delimiters[4 /* BarDelimited */] = " |"; + delimiters[8 /* AmpersandDelimited */] = " &"; + return delimiters; + } + function getDelimiter(format) { + return delimiters[format & 28 /* DelimitersMask */]; + } + function createBracketsMap() { + var brackets = []; + brackets[512 /* Braces */] = ["{", "}"]; + brackets[1024 /* Parenthesis */] = ["(", ")"]; + brackets[2048 /* AngleBrackets */] = ["<", ">"]; + brackets[4096 /* SquareBrackets */] = ["[", "]"]; + return brackets; + } + function getOpeningBracket(format) { + return brackets[format & 7680 /* BracketsMask */][0]; + } + function getClosingBracket(format) { + return brackets[format & 7680 /* BracketsMask */][1]; + } + // Flags enum to track count of temp variables and a few dedicated names + var TempFlags; + (function (TempFlags) { + TempFlags[TempFlags["Auto"] = 0] = "Auto"; + TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; + TempFlags[TempFlags["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); var ListFormat; (function (ListFormat) { ListFormat[ListFormat["None"] = 0] = "None"; @@ -61790,6 +66449,7 @@ var ts; var ts; (function (ts) { var emptyArray = []; + var ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } while (true) { @@ -61824,7 +66484,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { // Failed to find any common path component @@ -61857,8 +66518,6 @@ var ts; // otherwise use toLowerCase as a canonical form. return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - // returned by CScript sys environment - var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { var text; try { @@ -61869,20 +66528,18 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.message); } text = ""; } return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -61901,10 +66558,11 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); // If output has not been changed, and the file has no external modification - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -61912,11 +66570,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -62015,10 +66673,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_41 = names_1[_i]; - var result = name_41 in cache - ? cache[name_41] - : cache[name_41] = loader(name_41, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -62030,6 +66692,8 @@ var ts; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; + var cachedSemanticDiagnosticsForFile = {}; + var cachedDeclarationDiagnosticsForFile = {}; var resolvedTypeReferenceDirectives = ts.createMap(); var fileProcessingDiagnostics = ts.createDiagnosticCollection(); // The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules. @@ -62054,6 +66718,7 @@ var ts; var supportedExtensions = ts.getSupportedExtensions(options); // Map storing if there is emit blocking diagnostics for given input var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -62067,7 +66732,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -62113,6 +66779,8 @@ var ts; } } } + // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks + moduleResolutionCache = undefined; // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; program = { @@ -62147,7 +66815,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); @@ -62171,7 +66839,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -62245,7 +66913,7 @@ var ts; // combine results of resolutions and predicted results var j = 0; for (var i = 0; i < result.length; i++) { - if (result[i] == predictedToResolveToAmbientModuleMarker) { + if (result[i] === predictedToResolveToAmbientModuleMarker) { result[i] = undefined; } else { @@ -62378,7 +67046,7 @@ var ts; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } // update fileName -> file mapping - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -62407,7 +67075,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true)); @@ -62418,13 +67086,13 @@ var ts; function getTypeChecker() { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false)); } - function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { - return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); }); + function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers) { + return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers); }); } function isEmitBlocked(emitFileName) { return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); } - function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { + function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers) { var declarationDiagnostics = []; if (options.noEmit) { return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; @@ -62456,7 +67124,8 @@ var ts; // checked is to not pass the file to getEmitResolver. var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); ts.performance.mark("beforeEmit"); - var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles); + var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers); ts.performance.mark("afterEmit"); ts.performance.measure("Emit", "beforeEmit", "afterEmit"); return emitResult; @@ -62529,19 +67198,48 @@ var ts; } } function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedSemanticDiagnosticsForFile, getSemanticDiagnosticsForFileNoCache); + } + function getSemanticDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - // For JavaScript files, we don't want to report semantic errors. - // Instead, we'll report errors for using TypeScript-only constructs from within a - // JavaScript file when we get syntactic diagnostics for the file. - var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken); + // For JavaScript files, we don't want to report semantic errors unless explicitly requested. + var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + return ts.isSourceFileJavaScript(sourceFile) + ? ts.filter(diagnostics, shouldReportDiagnostic) + : diagnostics; }); } + /** + * Skip errors if previous line start with '// @ts-ignore' comment, not counting non-empty non-comment lines + */ + function shouldReportDiagnostic(diagnostic) { + var file = diagnostic.file, start = diagnostic.start; + if (file) { + var lineStarts = ts.getLineStarts(file); + var line = ts.computeLineAndCharacterOfPosition(lineStarts, start).line; + while (line > 0) { + var previousLineText = file.text.slice(lineStarts[line - 1], lineStarts[line]); + var result = ignoreDiagnosticCommentRegEx.exec(previousLineText); + if (!result) { + // non-empty line + return true; + } + if (result[3]) { + // @ts-ignore + return false; + } + line--; + } + } + return true; + } function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { return runWithCancellationToken(function () { var diagnostics = []; @@ -62552,23 +67250,23 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - // Pass through - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 223 /* VariableDeclaration */: + // falls through + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 225 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -62576,35 +67274,35 @@ var ts; } } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 107 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -62619,29 +67317,29 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226 /* ClassDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - // pass through - case 205 /* VariableStatement */: + // falls through + case 207 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 207 /* VariableStatement */); } break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { @@ -62653,16 +67351,16 @@ var ts; return; } break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -62670,8 +67368,8 @@ var ts; } break; } - for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { - var node = nodes_6[_b]; + for (var _b = 0, nodes_8 = nodes; _b < nodes_8.length; _b++) { + var node = nodes_8[_b]; walk(node); } } @@ -62683,7 +67381,8 @@ var ts; if (isConstValid) { continue; } - // Fallthrough to report error + // to report error, + // falls through case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: @@ -62711,12 +67410,34 @@ var ts; }); } function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache); + } + function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); // Don't actually write any files since we're just getting diagnostics. return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile); }); } + function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) { + var cachedResult = sourceFile + ? cache.perFile && cache.perFile.get(sourceFile.path) + : cache.allDiagnostics; + if (cachedResult) { + return cachedResult; + } + var result = getDiagnostics(sourceFile, cancellationToken) || emptyArray; + if (sourceFile) { + if (!cache.perFile) { + cache.perFile = ts.createFileMap(); + } + cache.perFile.set(sourceFile.path, result); + } + else { + cache.allDiagnostics = result; + } + return result; + } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); } @@ -62759,11 +67480,10 @@ var ts; && (options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) { // synthesize 'import "tslib"' declaration - var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */); - externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235 /* ImportDeclaration */); - importDecl.parent = file; + var externalHelpersModuleReference = ts.createLiteral(ts.externalHelpersModuleNameText); + var importDecl = ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined); externalHelpersModuleReference.parent = importDecl; + importDecl.parent = file; imports = [externalHelpersModuleReference]; } for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { @@ -62779,9 +67499,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -62796,7 +67516,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -62896,18 +67616,18 @@ var ts; } // If the file was previously found via a node_modules search, but is now being processed as a root file, // then everything it sucks in may also be marked incorrectly, and needs to be checked again. - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth === 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -62924,7 +67644,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case @@ -62973,7 +67693,7 @@ var ts; } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { // If we already found this library as a primary reference - nothing to do - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -63007,7 +67727,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -63056,7 +67776,7 @@ var ts; // This may still end up being an untyped module -- the file won't be included but imports will be allowed. var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -63075,8 +67795,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -63087,8 +67807,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -63182,7 +67902,7 @@ var ts; if (options.lib && options.noLib) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } - if (options.noImplicitUseStrict && options.alwaysStrict) { + if (options.noImplicitUseStrict && (options.alwaysStrict === undefined ? options.strict : options.alwaysStrict)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); } var languageVersion = options.target || 0 /* ES3 */; @@ -63228,6 +67948,9 @@ var ts; if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } + if (options.checkJs && !options.allowJs) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")); + } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); @@ -63247,7 +67970,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -63323,40 +68046,13 @@ var ts; ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; /* @internal */ ts.optionDeclarations = [ - { - name: "charset", - type: "string", - }, - ts.compileOnSaveCommandLineOption, - { - name: "declaration", - shortName: "d", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "diagnostics", - type: "boolean", - }, - { - name: "extendedDiagnostics", - type: "boolean", - experimental: true - }, - { - name: "emitBOM", - type: "boolean" - }, + // CommandLine only options { name: "help", shortName: "h", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, }, { @@ -63365,219 +68061,57 @@ var ts; type: "boolean" }, { - name: "init", - type: "boolean", - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, - }, - { - name: "inlineSourceMap", - type: "boolean", - }, - { - name: "inlineSources", - type: "boolean", - }, - { - name: "jsx", - type: ts.createMap({ - "preserve": 1 /* Preserve */, - "react": 2 /* React */ - }), - paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - }, - { - name: "reactNamespace", - type: "string", - description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit - }, - { - name: "jsxFactory", - type: "string", - description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h - }, - { - name: "listFiles", - type: "boolean", - }, - { - name: "locale", - type: "string", - }, - { - name: "mapRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: ts.Diagnostics.LOCATION, - }, - { - name: "module", - shortName: "m", - type: ts.createMap({ - "none": ts.ModuleKind.None, - "commonjs": ts.ModuleKind.CommonJS, - "amd": ts.ModuleKind.AMD, - "system": ts.ModuleKind.System, - "umd": ts.ModuleKind.UMD, - "es6": ts.ModuleKind.ES2015, - "es2015": ts.ModuleKind.ES2015, - }), - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - }, - { - name: "newLine", - type: ts.createMap({ - "crlf": 0 /* CarriageReturnLineFeed */, - "lf": 1 /* LineFeed */ - }), - description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - }, - { - name: "noEmit", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs, - }, - { - name: "noEmitHelpers", - type: "boolean" - }, - { - name: "noEmitOnError", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "noErrorTruncation", - type: "boolean" - }, - { - name: "noImplicitAny", + name: "all", type: "boolean", - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "noImplicitThis", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "noUnusedLocals", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_locals, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Show_all_compiler_options, }, { - name: "noUnusedParameters", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_parameters, - }, - { - name: "noLib", - type: "boolean", - }, - { - name: "noResolve", - type: "boolean", - }, - { - name: "skipDefaultLibCheck", - type: "boolean", - }, - { - name: "skipLibCheck", + name: "version", + shortName: "v", type: "boolean", - description: ts.Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "out", - type: "string", - isFilePath: false, - // for correct behaviour, please use outFile - paramType: ts.Diagnostics.FILE, - }, - { - name: "outFile", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, - paramType: ts.Diagnostics.FILE, - }, - { - name: "outDir", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Redirect_output_structure_to_the_directory, - paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_the_compiler_s_version, }, { - name: "preserveConstEnums", + name: "init", type: "boolean", - description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "pretty", - description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, - type: "boolean" + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, }, { name: "project", shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY - }, - { - name: "removeComments", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_comments_to_output, - }, - { - name: "rootDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.LOCATION, - description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - }, - { - name: "isolatedModules", - type: "boolean", - }, - { - name: "sourceMap", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_map_file, - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: ts.Diagnostics.LOCATION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY, + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, }, { - name: "suppressExcessPropertyErrors", + name: "pretty", type: "boolean", - description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, - experimental: true + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental }, { - name: "suppressImplicitAnyIndexErrors", - type: "boolean", - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, - }, - { - name: "stripInternal", + name: "watch", + shortName: "w", type: "boolean", - description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - experimental: true + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Watch_input_files, }, + // Basic { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES2015 */, @@ -63586,144 +68120,34 @@ var ts; "es2017": 4 /* ES2017 */, "esnext": 5 /* ESNext */, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, paramType: ts.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, }, { - name: "version", - shortName: "v", - type: "boolean", - description: ts.Diagnostics.Print_the_compiler_s_version, - }, - { - name: "watch", - shortName: "w", - type: "boolean", - description: ts.Diagnostics.Watch_input_files, - }, - { - name: "experimentalDecorators", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators - }, - { - name: "emitDecoratorMetadata", - type: "boolean", - experimental: true, - description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators - }, - { - name: "moduleResolution", - type: ts.createMap({ - "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic, + name: "module", + shortName: "m", + type: ts.createMapFromTemplate({ + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES2015, + "es2015": ts.ModuleKind.ES2015, }), - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - paramType: ts.Diagnostics.STRATEGY, - }, - { - name: "allowUnusedLabels", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unused_labels - }, - { - name: "noImplicitReturns", - type: "boolean", - description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value - }, - { - name: "noFallthroughCasesInSwitch", - type: "boolean", - description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement - }, - { - name: "allowUnreachableCode", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, - { - name: "baseUrl", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names - }, - { - // this option can only be specified in tsconfig.json - // use type = object to copy the value as-is - name: "paths", - type: "object", - isTSConfigOnly: true - }, - { - // this option can only be specified in tsconfig.json - // use type = object to copy the value as-is - name: "rootDirs", - type: "list", - isTSConfigOnly: true, - element: { - name: "rootDirs", - type: "string", - isFilePath: true - } - }, - { - name: "typeRoots", - type: "list", - element: { - name: "typeRoots", - type: "string", - isFilePath: true - } - }, - { - name: "types", - type: "list", - element: { - name: "types", - type: "string" - }, - description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation - }, - { - name: "traceResolution", - type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process - }, - { - name: "allowJs", - type: "boolean", - description: ts.Diagnostics.Allow_javascript_files_to_be_compiled - }, - { - name: "allowSyntheticDefaultImports", - type: "boolean", - description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking - }, - { - name: "noImplicitUseStrict", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output - }, - { - name: "maxNodeModuleJsDepth", - type: "number", - description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files - }, - { - name: "listEmittedFiles", - type: "boolean" + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, }, { name: "lib", type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ // JavaScript only "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", @@ -63731,6 +68155,7 @@ var ts; "es7": "lib.es2016.d.ts", "es2016": "lib.es2016.d.ts", "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", // Host only "dom": "lib.dom.d.ts", "dom.iterable": "lib.dom.iterable.d.ts", @@ -63750,28 +68175,487 @@ var ts; "es2017.object": "lib.es2017.object.d.ts", "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", "es2017.string": "lib.es2017.string.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", }), }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon }, { - name: "disableSizeLimit", - type: "boolean" + name: "allowJs", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled }, { - name: "strictNullChecks", + name: "checkJs", type: "boolean", - description: ts.Diagnostics.Enable_strict_null_checks + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Report_errors_in_js_files + }, + { + name: "jsx", + type: ts.createMapFromTemplate({ + "preserve": 1 /* Preserve */, + "react-native": 3 /* ReactNative */, + "react": 2 /* React */ + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_d_ts_file, + }, + { + name: "sourceMap", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_map_file, + }, + { + name: "outFile", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + }, + { + name: "outDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + }, + { + name: "rootDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + }, + { + name: "removeComments", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_comments_to_output, + }, + { + name: "noEmit", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_outputs, }, { name: "importHelpers", type: "boolean", + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Import_emit_helpers_from_tslib }, + { + name: "downlevelIteration", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 + }, + { + name: "isolatedModules", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule + }, + // Strict Type Checks + { + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_all_strict_type_checking_options + }, + { + name: "noImplicitAny", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, + }, + { + name: "strictNullChecks", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_strict_null_checks + }, + { + name: "noImplicitThis", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, { name: "alwaysStrict", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + }, + // Additional Checks + { + name: "noUnusedLocals", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_locals, + }, + { + name: "noUnusedParameters", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_parameters, + }, + { + name: "noImplicitReturns", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + // Module Resolution + { + name: "moduleResolution", + type: ts.createMapFromTemplate({ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic, + }), + paramType: ts.Diagnostics.STRATEGY, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "paths", + type: "object", + isTSConfigOnly: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime + }, + { + name: "typeRoots", + type: "list", + element: { + name: "typeRoots", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + // Source Maps + { + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + }, + { + name: "inlineSources", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + }, + // Experimental + { + name: "experimentalDecorators", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + // Advanced + { + name: "jsxFactory", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_verbose_diagnostic_information + }, + { + name: "traceResolution", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "listFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation + }, + { + name: "listEmittedFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation + }, + { + name: "out", + type: "string", + isFilePath: false, + // for correct behaviour, please use outFile + category: ts.Diagnostics.Advanced_Options, + paramType: ts.Diagnostics.FILE, + description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + }, + { + name: "charset", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_character_set_of_the_input_files + }, + { + name: "emitBOM", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + }, + { + name: "locale", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: ts.createMapFromTemplate({ + "crlf": 0 /* CarriageReturnLineFeed */, + "lf": 1 /* LineFeed */ + }), + paramType: ts.Diagnostics.NEWLINE, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + }, + { + name: "disableSizeLimit", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects + }, + { + name: "noImplicitUseStrict", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "noEmitHelpers", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + }, + { + name: "noEmitOnError", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, + }, + { + name: "preserveConstEnums", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, + }, + { + name: "allowUnusedLabels", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "allowUnreachableCode", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + }, + { + // A list of plugins to load in the language service + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts.Diagnostics.List_of_language_service_plugins } ]; /* @internal */ @@ -63808,8 +68692,7 @@ var ts; ts.defaultInitCompilerOptions = { module: ts.ModuleKind.CommonJS, target: 1 /* ES5 */, - noImplicitAny: false, - sourceMap: false, + strict: true }; var optionNameMapCache; /* @internal */ @@ -63834,9 +68717,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -63845,20 +68728,13 @@ var ts; ts.getOptionNameMap = getOptionNameMap; /* @internal */ function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; /* @internal */ function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; /* @internal */ @@ -63882,7 +68758,6 @@ var ts; } } ts.parseListTypeOption = parseListTypeOption; - /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -63905,11 +68780,12 @@ var ts; else if (s.charCodeAt(0) === 45 /* minus */) { s = s.slice(s.charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase(); // Try to translate short option names to their full equivalents. - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -63997,9 +68873,9 @@ var ts; } ts.parseCommandLine = parseCommandLine; /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName, readFile) { var text = ""; try { @@ -64012,10 +68888,10 @@ var ts; } ts.readConfigFile = readConfigFile; /** - * Parse the text of the tsconfig.json file - * @param fileName The path to the config file - * @param jsonText The text of the config file - */ + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ function parseConfigFileTextToJson(fileName, jsonText, stripComments) { if (stripComments === void 0) { stripComments = true; } try { @@ -64033,7 +68909,7 @@ var ts; * @param fileNames array of filenames to be generated into tsconfig.json */ /* @internal */ - function generateTSConfig(options, fileNames) { + function generateTSConfig(options, fileNames, newLine) { var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); var configurations = { compilerOptions: serializeCompilerOptions(compilerOptions) @@ -64042,7 +68918,7 @@ var ts; // only set the files property if we have at least one file configurations.files = fileNames; } - return configurations; + return writeConfigurations(); function getCustomTypeMapOfCommandLineOption(optionDefinition) { if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { // this is of a type CommandLineOptionOfPrimitiveType @@ -64057,58 +68933,130 @@ var ts; } function getNameOfCompilerOptionValue(value, customTypeMap) { // There is a typeMap associated with this command-line option so use it to map value back to its name - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_42 in options) { - if (ts.hasProperty(options, name_42)) { + for (var name in options) { + if (ts.hasProperty(options, name)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_42) { - case "init": - case "watch": - case "version": - case "help": - case "project": - break; - default: - var value = options[name_42]; - var optionDefinition = optionsNameMap[name_42.toLowerCase()]; - if (optionDefinition) { - var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - // There is no map associated with this compiler option then use the value as-is - // This is the case if the value is expect to be string, number, boolean or list of string - result[name_42] = value; - } - else { - if (optionDefinition.type === "list") { - var convertedValue = []; - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name_42] = convertedValue; - } - else { - // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_42] = getNameOfCompilerOptionValue(value, customTypeMap); - } + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { + continue; + } + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap) { + // There is no map associated with this compiler option then use the value as-is + // This is the case if the value is expect to be string, number, boolean or list of string + result[name] = value; + } + else { + if (optionDefinition.type === "list") { + var convertedValue = []; + for (var _i = 0, _a = value; _i < _a.length; _i++) { + var element = _a[_i]; + convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } + result[name] = convertedValue; } - break; + else { + // There is a typeMap associated with this command-line option so use it to map value back to its name + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); + } + } } } } return result; } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return ts.arrayFrom(option.type.keys())[0]; + } + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function writeConfigurations() { + // Filter applicable options to place in the file + var categorizedOptions = ts.reduceLeft(ts.filter(ts.optionDeclarations, function (o) { return o.category !== ts.Diagnostics.Command_line_Options && o.category !== ts.Diagnostics.Advanced_Options; }), function (memo, value) { + if (value.category) { + var name = ts.getLocaleSpecificMessage(value.category); + (memo[name] || (memo[name] = [])).push(value); + } + return memo; + }, {}); + // Serialize all options and thier descriptions + var marginLength = 0; + var seenKnownKeys = 0; + var nameColumn = []; + var descriptionColumn = []; + var knownKeysCount = ts.getOwnKeys(configurations.compilerOptions).length; + for (var category in categorizedOptions) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push("/* " + category + " */"); + descriptionColumn.push(""); + for (var _i = 0, _a = categorizedOptions[category]; _i < _a.length; _i++) { + var option = _a[_i]; + var optionName = void 0; + if (ts.hasProperty(configurations.compilerOptions, option.name)) { + optionName = "\"" + option.name + "\": " + JSON.stringify(configurations.compilerOptions[option.name]) + ((seenKnownKeys += 1) === knownKeysCount ? "" : ","); + } + else { + optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; + } + nameColumn.push(optionName); + descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); + marginLength = Math.max(optionName.length, marginLength); + } + } + // Write the output + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push(tab + "\"compilerOptions\": {"); + // Print out each row, aligning all the descriptions on the same column. + for (var i = 0; i < nameColumn.length; i++) { + var optionName = nameColumn[i]; + var description = descriptionColumn[i]; + result.push(tab + tab + optionName + makePadding(marginLength - optionName.length + 2) + description); + } + if (configurations.files && configurations.files.length) { + result.push(tab + "},"); + result.push(tab + "\"files\": ["); + for (var i = 0; i < configurations.files.length; i++) { + result.push("" + tab + tab + JSON.stringify(configurations.files[i]) + (i === configurations.files.length - 1 ? "" : ",")); + } + result.push(tab + "]"); + } + else { + result.push(tab + "}"); + } + result.push("}"); + return result.join(newLine); + } } ts.generateTSConfig = generateTSConfig; /** @@ -64136,16 +69084,18 @@ var ts; return output; } /** - * Parse the contents of a config file (tsconfig.json). - * @param json The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -64272,7 +69222,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -64323,8 +69273,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -64358,8 +69308,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -64449,7 +69400,7 @@ var ts; * @param host The host used to resolve files and directories. * @param errors An array for diagnostic reporting. */ - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); // The exclude spec list is converted into a regular expression, which allows us to quickly // test whether a file or directory should be excluded before recursively traversing the @@ -64476,14 +69427,14 @@ var ts; var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); // Literal files are always included verbatim. An "include" or "exclude" specification cannot // remove a literal file. if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -64504,14 +69455,13 @@ var ts; // same directory, we should remove it. removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -64519,8 +69469,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -64554,7 +69504,7 @@ var ts; // /a/b/a?z - Watch /a/b directly to catch any new file matching a?z var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -64576,14 +69526,15 @@ var ts; } } // Remove any subpaths under an existing recursively watched directory. - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } } return wildcardDirectories; } @@ -64610,11 +69561,11 @@ var ts; */ function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority); + var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); for (var i = 0 /* Highest */; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -64630,23 +69581,13 @@ var ts; */ function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority); + var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - /** - * Adds a file to an array of files. - * - * @param output The output array. - * @param file The file path. - */ - function addFileToOutput(output, file) { - output.push(file); - return output; - } /** * Gets a case sensitive key. * @@ -64673,7 +69614,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -64783,8 +69726,7 @@ var ts; ScriptElementKind.typeElement = "type"; /** enum E */ ScriptElementKind.enumElement = "enum"; - // TODO: GH#9983 - ScriptElementKind.enumMemberElement = "const"; + ScriptElementKind.enumMemberElement = "enum member"; /** * Inside module and script only * const v = .. @@ -64827,6 +69769,10 @@ var ts; ScriptElementKind.letElement = "let"; ScriptElementKind.directory = "directory"; ScriptElementKind.externalModuleName = "external module name"; + /** + * + */ + ScriptElementKind.jsxAttribute = "JSX attribute"; })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); var ScriptElementKindModifier; (function (ScriptElementKindModifier) { @@ -64912,33 +69858,34 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144 /* Parameter */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: - case 260 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 256 /* CatchClause */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: + case 263 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 259 /* CatchClause */: + case 252 /* JsxAttribute */: return 1 /* Value */; - case 143 /* TypeParameter */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 161 /* TypeLiteral */: + case 144 /* TypeParameter */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 162 /* TypeLiteral */: return 2 /* Type */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -64948,22 +69895,25 @@ var ts; else { return 4 /* Namespace */; } - case 238 /* NamedImports */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 240 /* NamedImports */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 261 /* SourceFile */: + case 264 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240 /* ExportAssignment */) { + if (node.kind === 264 /* SourceFile */) { + return 1 /* Value */; + } + else if (node.parent.kind === 242 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -64988,15 +69938,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 141 /* QualifiedName */ && + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 234 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 236 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141 /* QualifiedName */) { + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -65007,27 +69957,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141 /* QualifiedName */) { - while (root.parent && root.parent.kind === 141 /* QualifiedName */) { + if (root.parent.kind === 142 /* QualifiedName */) { + while (root.parent && root.parent.kind === 142 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 /* TypeReference */ && !isLastClause; + return root.parent.kind === 158 /* TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 177 /* PropertyAccessExpression */) { + if (root.parent.kind === 178 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 178 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 255 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 200 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 258 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 226 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || - (decl.kind === 227 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); + return (decl.kind === 228 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || + (decl.kind === 229 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); } return false; } @@ -65035,17 +69985,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 /* TypeReference */ || - (node.parent.kind === 199 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 /* TypeReference */ || + (node.parent.kind === 200 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 /* ThisKeyword */ && !ts.isPartOfExpression(node)) || - node.kind === 167 /* ThisType */; + node.kind === 168 /* ThisType */; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179 /* CallExpression */); + return isCallOrNewExpressionTarget(node, 180 /* CallExpression */); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180 /* NewExpression */); + return isCallOrNewExpressionTarget(node, 181 /* NewExpression */); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -65058,7 +70008,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -65068,13 +70018,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 /* Identifier */ && - (node.parent.kind === 215 /* BreakStatement */ || node.parent.kind === 214 /* ContinueStatement */) && + (node.parent.kind === 217 /* BreakStatement */ || node.parent.kind === 216 /* ContinueStatement */) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 /* Identifier */ && - node.parent.kind === 219 /* LabeledStatement */ && + node.parent.kind === 221 /* LabeledStatement */ && node.parent.label === node; } function isLabelName(node) { @@ -65082,15 +70032,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 232 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -65101,19 +70051,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 260 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 230 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* PropertyAssignment */: + case 263 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 232 /* ModuleDeclaration */: return node.parent.name === node; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return node.parent.argumentExpression === node; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return true; } } @@ -65162,17 +70112,17 @@ var ts; return undefined; } switch (node.kind) { - case 261 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 264 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return node; } } @@ -65180,46 +70130,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.ScriptElementKind.moduleElement; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.ScriptElementKind.classElement; - case 227 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; - case 228 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; - case 229 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; - case 223 /* VariableDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; + case 230 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; + case 231 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; + case 225 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return ts.ScriptElementKind.functionElement; - case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; - case 152 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 152 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; + case 153 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return ts.ScriptElementKind.memberFunctionElement; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return ts.ScriptElementKind.memberVariableElement; - case 155 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; - case 154 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; - case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; - case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; - case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; - case 260 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; - case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234 /* ImportEqualsDeclaration */: - case 239 /* ImportSpecifier */: - case 236 /* ImportClause */: - case 243 /* ExportSpecifier */: - case 237 /* NamespaceImport */: + case 156 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; + case 155 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; + case 154 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; + case 151 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; + case 144 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; + case 263 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; + case 145 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + case 236 /* ImportEqualsDeclaration */: + case 241 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 245 /* ExportSpecifier */: + case 239 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -65233,15 +70183,6 @@ var ts; } } ts.getNodeKind = getNodeKind; - function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 /* LiteralType */ ? node.parent : node; - var type = typeChecker.getTypeAtLocation(searchNode); - if (type && type.flags & 32 /* StringLiteral */) { - return type; - } - return undefined; - } - ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode; function isThis(node) { switch (node.kind) { case 98 /* ThisKeyword */: @@ -65249,7 +70190,7 @@ var ts; return true; case 70 /* Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144 /* Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145 /* Parameter */; default: return false; } @@ -65258,7 +70199,7 @@ var ts; // Matches the beginning of a triple slash directive var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= node.end) { + if (c.kind === 293 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -65497,7 +70438,7 @@ var ts; if (includeJsDocComment === void 0) { includeJsDocComment = false; } var current = sourceFile; outer: while (true) { - if (isToken(current)) { + if (ts.isToken(current)) { // exit early return current; } @@ -65522,8 +70463,8 @@ var ts; } } // find the child that contains 'position' - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; // all jsDocComment nodes were already visited if (ts.isJSDocNode(child)) { continue; @@ -65547,18 +70488,18 @@ var ts; } } /** - * The token on the left of the position is the token that strictly includes the position - * or sits to the left of the cursor if it is on a boundary. For example - * - * fo|o -> will return foo - * foo |bar -> will return foo - * - */ + * The token on the left of the position is the token that strictly includes the position + * or sits to the left of the cursor if it is on a boundary. For example + * + * fo|o -> will return foo + * foo |bar -> will return foo + * + */ function findTokenOnLeftOfPosition(file, position) { // Ideally, getTokenAtPosition should return a token. However, it is currently // broken, so we do a check to make sure the result was indeed a token. var tokenAtPosition = getTokenAtPosition(file, position); - if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { return tokenAtPosition; } return findPrecedingToken(position, file); @@ -65567,7 +70508,7 @@ var ts; function findNextToken(previousToken, parent) { return find(parent); function find(n) { - if (isToken(n) && n.pos === previousToken.end) { + if (ts.isToken(n) && n.pos === previousToken.end) { // this is token that starts at the end of previous token - return it return n; } @@ -65590,7 +70531,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); @@ -65598,11 +70539,11 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' @@ -65627,7 +70568,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 264 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -65686,17 +70627,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 255 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 255 /* JsxExpression */) { return true; } //
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 249 /* JsxClosingElement */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 251 /* JsxClosingElement */) { return true; } return false; @@ -65727,10 +70668,10 @@ var ts; // Internally, we represent the end of the comment at the newline and closing '/', respectively. return predicate ? ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && + (c.kind === 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && predicate(c); }) : ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); + (c.kind === 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); } return false; } @@ -65751,7 +70692,7 @@ var ts; */ function getJsDocTagAtPosition(sourceFile, position) { var node = ts.getTokenAtPosition(sourceFile, position); - if (isToken(node)) { + if (ts.isToken(node)) { switch (node.kind) { case 103 /* VarKeyword */: case 109 /* LetKeyword */: @@ -65808,19 +70749,15 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) { + if (node.kind === 158 /* TypeReference */ || node.kind === 180 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 /* ClassDeclaration */ || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 228 /* ClassDeclaration */ || node.kind === 229 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; - function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */; - } - ts.isToken = isToken; function isWord(kind) { return kind === 70 /* Identifier */ || ts.isKeyword(kind); } @@ -65877,18 +70814,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 /* ArrayLiteralExpression */ || - node.kind === 176 /* ObjectLiteralExpression */) { + if (node.kind === 176 /* ArrayLiteralExpression */ || + node.kind === 177 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 192 /* BinaryExpression */ && + if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 213 /* ForOfStatement */ && + if (node.parent.kind === 215 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -65896,7 +70833,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 260 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -65924,12 +70861,47 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118 /* AnyKeyword */: + case 121 /* BooleanKeyword */: + case 129 /* NeverKeyword */: + case 132 /* NumberKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: + case 136 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; + /** True if the symbol is for an external module, as opposed to a namespace. */ + function isExternalModuleSymbol(moduleSymbol) { + ts.Debug.assert(!!(moduleSymbol.flags & 1536 /* Module */)); + return moduleSymbol.name.charCodeAt(0) === 34 /* doubleQuote */; + } + ts.isExternalModuleSymbol = isExternalModuleSymbol; + /** Returns `true` the first time it encounters a node and `false` afterwards. */ + function nodeSeenTracker() { + var seen = []; + return function (node) { + var id = ts.getNodeId(node); + return !seen[id] && (seen[id] = true); + }; + } + ts.nodeSeenTracker = nodeSeenTracker; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -65946,13 +70918,15 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; function writeIndent() { if (lineStart) { @@ -66105,23 +71079,18 @@ var ts; function getDeclaredName(typeChecker, symbol, location) { // If this is an export or import specifier it could have been renamed using the 'as' syntax. // If so we want to search for whatever is under the cursor. - if (isImportOrExportSpecifierName(location)) { - return location.getText(); - } - else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142 /* ComputedPropertyName */) { + if (isImportOrExportSpecifierName(location) || ts.isStringOrNumericLiteral(location) && location.parent.kind === 143 /* ComputedPropertyName */) { return location.text; } // Try to get the local symbol if we're dealing with an 'export default' // since that symbol has the "true" name. var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); - return name; + return typeChecker.symbolToString(localExportDefaultSymbol || symbol); } ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 /* ImportSpecifier */ || location.parent.kind === 243 /* ExportSpecifier */) && + (location.parent.kind === 241 /* ImportSpecifier */ || location.parent.kind === 245 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -66137,7 +71106,6 @@ var ts; (name.charCodeAt(0) === 34 /* doubleQuote */ || name.charCodeAt(0) === 39 /* singleQuote */)) { return name.substring(1, length - 1); } - ; return name; } ts.stripQuotes = stripQuotes; @@ -66188,6 +71156,22 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getFirstNonSpaceCharacterPosition(text, position) { + while (ts.isWhiteSpace(text.charCodeAt(position))) { + position += 1; + } + return position; + } + ts.getFirstNonSpaceCharacterPosition = getFirstNonSpaceCharacterPosition; + function getOpenBrace(constructor, sourceFile) { + // First token is the open curly, this is where we want to put the 'super' call. + return constructor.body.getFirstToken(sourceFile); + } + ts.getOpenBrace = getOpenBrace; + function getOpenBraceOfClassLike(declaration, sourceFile) { + return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1); + } + ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike; })(ts || (ts = {})); var ts; (function (ts) { @@ -66236,7 +71220,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 /* GetKeyword */ || - keyword2 === 133 /* SetKeyword */ || + keyword2 === 134 /* SetKeyword */ || keyword2 === 122 /* ConstructorKeyword */ || keyword2 === 114 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -66255,9 +71239,9 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; - var length_4 = dense[i + 1]; + var length_5 = dense[i + 1]; var type = dense[i + 2]; // Make a whitespace entry between the last item and this one. if (lastEnd >= 0) { @@ -66266,8 +71250,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace }); } } - entries.push({ length: length_4, classification: convertClassification(type) }); - lastEnd = start + length_4; + entries.push({ length: length_5, classification: convertClassification(type) }); + lastEnd = start + length_5; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -66335,7 +71319,7 @@ var ts; case 5 /* InTemplateMiddleOrTail */: text = "}\n" + text; offset = 2; - // fallthrough + // falls through case 6 /* InTemplateSubstitutionPosition */: templateStack.push(13 /* TemplateHead */); break; @@ -66395,10 +71379,10 @@ var ts; angleBracketStack--; } else if (token === 118 /* AnyKeyword */ || - token === 134 /* StringKeyword */ || + token === 135 /* StringKeyword */ || token === 132 /* NumberKeyword */ || token === 121 /* BooleanKeyword */ || - token === 135 /* SymbolKeyword */) { + token === 136 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -66570,7 +71554,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */; + return token >= 71 /* FirstKeyword */ && token <= 141 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -66627,10 +71611,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -66681,7 +71665,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 /* ModuleDeclaration */ && + return declaration.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -66696,7 +71680,7 @@ var ts; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run // in a third of the time it would normally take. - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -66742,7 +71726,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -66845,16 +71829,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 281 /* JSDocParameterTag */: + case 285 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 284 /* JSDocTemplateTag */: + case 288 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 283 /* JSDocTypeTag */: + case 287 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 282 /* JSDocReturnTag */: + case 286 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -66941,22 +71925,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 249 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 250 /* JsxAttribute */: + case 252 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -66984,17 +71968,17 @@ var ts; if (token) { if (tokenKind === 57 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 223 /* VariableDeclaration */ || - token.parent.kind === 147 /* PropertyDeclaration */ || - token.parent.kind === 144 /* Parameter */ || - token.parent.kind === 250 /* JsxAttribute */) { + if (token.parent.kind === 225 /* VariableDeclaration */ || + token.parent.kind === 148 /* PropertyDeclaration */ || + token.parent.kind === 145 /* Parameter */ || + token.parent.kind === 252 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 192 /* BinaryExpression */ || - token.parent.kind === 190 /* PrefixUnaryExpression */ || - token.parent.kind === 191 /* PostfixUnaryExpression */ || - token.parent.kind === 193 /* ConditionalExpression */) { + if (token.parent.kind === 193 /* BinaryExpression */ || + token.parent.kind === 191 /* PrefixUnaryExpression */ || + token.parent.kind === 192 /* PostfixUnaryExpression */ || + token.parent.kind === 194 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -67004,7 +71988,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 250 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 252 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 11 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -67020,32 +72004,32 @@ var ts; else if (tokenKind === 70 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 144 /* Parameter */: + case 145 /* Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; } @@ -67062,9 +72046,8 @@ var ts; // Ignore nodes that don't intersect the original span to classify. if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); @@ -67075,259 +72058,31 @@ var ts; } ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; })(ts || (ts = {})); -/// /* @internal */ var ts; (function (ts) { var Completions; (function (Completions) { - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { - if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); - } - if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); - } - var completionData = getCompletionData(typeChecker, log, sourceFile, position); - if (!completionData) { - return undefined; - } - var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; - if (isJsDocTagName) { - // If the current position is a jsDoc tag name, only tag names should be provided for completion - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() }; - } - var entries = []; - if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); - } - else { - if (!symbols || symbols.length === 0) { - if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 249 /* JsxClosingElement */) { - // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, - // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. - // For example: - // var x =
completion list at "1" will contain "div" with type any - var tagName = location.parent.parent.openingElement.tagName; - entries.push({ - name: tagName.text, - kind: undefined, - kindModifiers: undefined, - sortText: "0", - }); - } - else { - return undefined; - } - } - getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - } - // Add keywords if this is not a member completion list - if (!isMemberCompletion && !isJsDocTagName) { - ts.addRange(entries, keywordCompletions); - } - return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_43 in nameTable) { - // Skip identifiers produced only from the current location - if (nameTable[name_43] === position) { - continue; - } - if (!uniqueNames[name_43]) { - uniqueNames[name_43] = name_43; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, /*performCharacterChecks*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } - } - } - return entries; - } - function createCompletionEntry(symbol, location, performCharacterChecks) { - // Try to get a valid display name for this symbol, if we could not find one, then ignore it. - // We would like to only show things that can be added after a dot, so for instance numeric properties can - // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - // TODO(drosen): Right now we just permit *all* semantic meanings when calling - // 'getSymbolKind' which is permissible given that it is backwards compatible; but - // really we should consider passing the meaning for the node so that we don't report - // that a suggestion for a value is an interface. We COULD also just do what - // 'getSymbolModifiers' does, which is to use the first declaration. - // Use a 'sortText' of 0' so that all symbol completion entries come before any other - // entries (like JavaScript identifier entries). - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; - } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; - } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9 /* StringLiteral */) { - return undefined; - } - if (node.parent.kind === 257 /* PropertyAssignment */ && - node.parent.parent.kind === 176 /* ObjectLiteralExpression */ && - node.parent.name === node) { - // Get quoted name of properties of the object literal expression - // i.e. interface ConfigFiles { - // 'jspm:dev': string - // } - // let files: ConfigFiles = { - // '/*completion position*/' - // } - // - // function foo(c: ConfigFiles) {} - // foo({ - // '/*completion position*/' - // }); - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - // Get all names of properties on the expression - // i.e. interface A { - // 'prop1': string - // } - // let a: A; - // a['/*completion position*/'] - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 235 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - // Get all known external module names or complete a path to a module - // i.e. import * as ns from "/*completion position*/"; - // import x = require("/*completion position*/"); - // var y = require("/*completion position*/"); - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - // Get string literal completions from specialized signatures of the target - // i.e. declare function f(a: 'A'); - // f("/*completion position*/") - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - // Get completion for string literal from string literal type - // i.e. var x: "hi" | "hello" = "/*completion position*/" - return getStringLiteralCompletionEntriesFromContextualType(node); - } - } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } - } - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; - } - return undefined; - } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - return undefined; - } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; - } - function addStringLiteralCompletionsFromType(type, result) { - if (!type) { - return; - } - if (type.flags & 65536 /* Union */) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32 /* StringLiteral */) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); - } - } - } - function getStringLiteralCompletionEntriesFromModuleNames(node) { + var PathCompletions; + (function (PathCompletions) { + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { var literalValue = ts.normalizeSlashes(node.text); var scriptPath = node.getSourceFile().path; var scriptDirectory = ts.getDirectoryPath(scriptPath); var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); var entries; if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, compilerOptions, host, scriptPath); } else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, host, scriptPath); } } else { // Check for node modules - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } return { isGlobalCompletion: false, @@ -67336,6 +72091,7 @@ var ts; entries: entries }; } + PathCompletions.getStringLiteralCompletionEntriesFromModuleNames = getStringLiteralCompletionEntriesFromModuleNames; /** * Takes a script path and returns paths for all potential folders that could be merged with its * containing folder via the "rootDirs" compiler option @@ -67355,21 +72111,21 @@ var ts; // Now find a path for each potential directory that is to be merged with the one containing the script return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { var basePath = compilerOptions.project || host.getCurrentDirectory(); var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); var result = []; for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); } return result; } /** * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. */ - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { if (result === void 0) { result = []; } if (fragment === undefined) { fragment = ""; @@ -67405,13 +72161,13 @@ var ts; continue; } var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - for (var foundFile in foundFiles) { + ts.forEachKey(foundFiles, function (foundFile) { result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); - } + }); } // If possible, get folder completion as well var directories = tryGetDirectories(host, baseDirectory); @@ -67432,14 +72188,14 @@ var ts; * Modules from node_modules (i.e. those listed in package.json) * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions */ - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; var result; if (baseUrl) { var fileExtensions = ts.getSupportedExtensions(compilerOptions); var projectDir = compilerOptions.project || host.getCurrentDirectory(); var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span, host); if (paths) { for (var path in paths) { if (paths.hasOwnProperty(path)) { @@ -67447,7 +72203,7 @@ var ts; if (paths[path]) { for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { var match = _c[_b]; result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } @@ -67468,13 +72224,13 @@ var ts; result = []; } getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { var moduleName = _e[_d]; result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { if (host.readDirectory) { var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; if (parsed) { @@ -67493,7 +72249,7 @@ var ts; // that encodes the suffix, but we would have to escape the character "?" which readDirectory // doesn't support. For now, this is safer but slower var includeGlob = normalizedSuffix ? "**/*" : "./*"; - var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + var matches = tryReadDirectory(host, baseDirectory, fileExtensions, /*exclude*/ undefined, [includeGlob]); if (matches) { var result = []; // Trim away prefix and suffix @@ -67504,8 +72260,8 @@ var ts; continue; } var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + var length_6 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_6))); } return result; } @@ -67513,7 +72269,7 @@ var ts; } return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { // Check If this is a nested module var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; @@ -67553,7 +72309,7 @@ var ts; } return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { var token = ts.getTokenAtPosition(sourceFile, position); if (!token) { return undefined; @@ -67589,7 +72345,7 @@ var ts; if (kind === "path") { // Give completions for a relative path var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, sourceFile.path); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, host, sourceFile.path); } else { // Give completions based on the typings available @@ -67599,6 +72355,7 @@ var ts; } return completionInfo; } + PathCompletions.getTripleSlashReferenceCompletion = getTripleSlashReferenceCompletion; function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { if (result === void 0) { result = []; } // Check for typings specified in compiler options @@ -67624,7 +72381,7 @@ var ts; } if (host.getDirectories) { // Also get all @types typings installed in visible node_modules directories - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { var packageJson = _d[_c]; var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); getCompletionEntriesFromDirectories(host, typesDir, span, result); @@ -67644,7 +72401,7 @@ var ts; } } } - function findPackageJsons(currentDir) { + function findPackageJsons(currentDir, host) { var paths = []; var currentConfigPath; while (true) { @@ -67652,11 +72409,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } - currentDir = parent_13; + currentDir = parent; } else { break; @@ -67667,7 +72424,7 @@ var ts; function enumerateNodeModulesVisibleToScript(host, scriptPath) { var result = []; if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { var packageJson = _a[_i]; var contents = tryReadingPackageJson(packageJson); if (!contents) { @@ -67731,26 +72488,326 @@ var ts; function normalizeAndPreserveTrailingSlash(path) { return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } + /** + * Matches a triple slash reference directive with an incomplete string literal for its path. Used + * to determine if the caret is currently within the string literal and capture the literal fragment + * for completions. + * For example, this matches + * + * /// +/* @internal */ +var ts; +(function (ts) { + var Completions; + (function (Completions) { + function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { + if (ts.isInReferenceComment(sourceFile, position)) { + return Completions.PathCompletions.getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); + } + if (ts.isInString(sourceFile, position)) { + return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); + } + var completionData = getCompletionData(typeChecker, log, sourceFile, position); + if (!completionData) { + return undefined; + } + var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, requestJsDocTagName = completionData.requestJsDocTagName, requestJsDocTag = completionData.requestJsDocTag; + if (requestJsDocTagName) { + // If the current position is a jsDoc tag name, only tag names should be provided for completion + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getJSDocTagNameCompletions() }; + } + if (requestJsDocTag) { + // If the current position is a jsDoc tag, only tags should be provided for completion + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getJSDocTagCompletions() }; + } + var entries = []; + if (ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); + } + else { + if (!symbols || symbols.length === 0) { + if (sourceFile.languageVariant === 1 /* JSX */ && + location.parent && location.parent.kind === 251 /* JsxClosingElement */) { + // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, + // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. + // For example: + // var x =
completion list at "1" will contain "div" with type any + var tagName = location.parent.parent.openingElement.tagName; + entries.push({ + name: tagName.text, + kind: undefined, + kindModifiers: undefined, + sortText: "0", + }); + } + else { + return undefined; + } + } + getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); + } + // Add keywords if this is not a member completion list + if (!isMemberCompletion && !requestJsDocTag && !requestJsDocTagName) { + ts.addRange(entries, keywordCompletions); + } + return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; + } + Completions.getCompletionsAtPosition = getCompletionsAtPosition; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target) { + var entries = []; + var nameTable = ts.getNameTable(sourceFile); + nameTable.forEach(function (pos, name) { + // Skip identifiers produced only from the current location + if (pos === position) { + return; + } + if (!uniqueNames.get(name)) { + uniqueNames.set(name, name); + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name), target, /*performCharacterChecks*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ts.ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); + } + } + }); + return entries; + } + function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target) { + // Try to get a valid display name for this symbol, if we could not find one, then ignore it. + // We would like to only show things that can be added after a dot, so for instance numeric properties can + // not be accessed with a dot (a.1 <- invalid) + var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location); + if (!displayName) { + return undefined; + } + // TODO(drosen): Right now we just permit *all* semantic meanings when calling + // 'getSymbolKind' which is permissible given that it is backwards compatible; but + // really we should consider passing the meaning for the node so that we don't report + // that a suggestion for a value is an interface. We COULD also just do what + // 'getSymbolModifiers' does, which is to use the first declaration. + // Use a 'sortText' of 0' so that all symbol completion entries come before any other + // entries (like JavaScript identifier entries). + return { + name: displayName, + kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks, typeChecker, target, log) { + var start = ts.timestamp(); + var uniqueNames = ts.createMap(); + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!uniqueNames.get(id)) { + entries.push(entry); + uniqueNames.set(id, id); + } + } + } + } + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log) { + var node = ts.findPrecedingToken(position, sourceFile); + if (!node || node.kind !== 9 /* StringLiteral */) { + return undefined; + } + if (node.parent.kind === 260 /* PropertyAssignment */ && + node.parent.parent.kind === 177 /* ObjectLiteralExpression */ && + node.parent.name === node) { + // Get quoted name of properties of the object literal expression + // i.e. interface ConfigFiles { + // 'jspm:dev': string + // } + // let files: ConfigFiles = { + // '/*completion position*/' + // } + // + // function foo(c: ConfigFiles) {} + // foo({ + // '/*completion position*/' + // }); + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); + } + else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + // Get all names of properties on the expression + // i.e. interface A { + // 'prop1': string + // } + // let a: A; + // a['/*completion position*/'] + return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log); + } + else if (node.parent.kind === 237 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) { + // Get all known external module names or complete a path to a module + // i.e. import * as ns from "/*completion position*/"; + // import x = require("/*completion position*/"); + // var y = require("/*completion position*/"); + return Completions.PathCompletions.getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker); + } + else if (isEqualityExpression(node.parent)) { + // Get completions from the type of the other operand + // i.e. switch (a) { + // case '/*completion position*/' + // } + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.left === node ? node.parent.right : node.parent.left), typeChecker); + } + else if (ts.isCaseOrDefaultClause(node.parent)) { + // Get completions from the type of the switch expression + // i.e. x === '/*completion position' + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.parent.parent.expression), typeChecker); + } + else { + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + // Get string literal completions from specialized signatures of the target + // i.e. declare function f(a: 'A'); + // f("/*completion position*/") + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker); + } + // Get completion for string literal from string literal type + // i.e. var x: "hi" | "hello" = "/*completion position*/" + return getStringLiteralCompletionEntriesFromType(typeChecker.getContextualType(node), typeChecker); + } + } + function getStringLiteralCompletionEntriesFromPropertyAssignment(element, typeChecker, target, log) { + var type = typeChecker.getContextualType(element.parent); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; + } + } + } + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker) { + var candidates = []; + var entries = []; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { + var candidate = candidates_3[_i]; + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker); + } + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + } + return undefined; + } + function getStringLiteralCompletionEntriesFromElementAccess(node, typeChecker, target, log) { + var type = typeChecker.getTypeAtLocation(node.expression); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; + } + } + return undefined; + } + function getStringLiteralCompletionEntriesFromType(type, typeChecker) { + if (type) { + var entries = []; + addStringLiteralCompletionsFromType(type, entries, typeChecker); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; + } + } + return undefined; + } + function addStringLiteralCompletionsFromType(type, result, typeChecker) { + if (type && type.flags & 16384 /* TypeParameter */) { + type = typeChecker.getApparentType(type); + } + if (!type) { + return; + } + if (type.flags & 65536 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + addStringLiteralCompletionsFromType(t, result, typeChecker); + } + } + else if (type.flags & 32 /* StringLiteral */) { + result.push({ + name: type.text, + kindModifiers: ts.ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.variableElement, + sortText: "0" + }); + } } - Completions.getCompletionsAtPosition = getCompletionsAtPosition; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; + var symbols = completionData.symbols, location_1 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_1) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), kind: symbolKind, displayParts: displayParts, - documentation: documentation + documentation: documentation, + tags: tags }; } } @@ -67762,7 +72819,8 @@ var ts; kind: ts.ScriptElementKind.keyword, kindModifiers: ts.ScriptElementKindModifier.none, displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)], - documentation: undefined + documentation: undefined, + tags: undefined }; } return undefined; @@ -67772,19 +72830,22 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_4 = completionData.location; + var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; }); + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); } return undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; function getCompletionData(typeChecker, log, sourceFile, position) { var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); - var isJsDocTagName = false; + // JsDoc tag-name is just the name of the JSDoc tagname (exclude "@") + var requestJsDocTagName = false; + // JsDoc tag includes both "@" and tag-name + var requestJsDocTag = false; var start = ts.timestamp(); var currentToken = ts.getTokenAtPosition(sourceFile, position); log("getCompletionData: Get current token: " + (ts.timestamp() - start)); @@ -67793,10 +72854,32 @@ var ts; var insideComment = ts.isInsideComment(sourceFile, currentToken, position); log("getCompletionData: Is inside comment: " + (ts.timestamp() - start)); if (insideComment) { - // The current position is next to the '@' sign, when no tag name being provided yet. - // Provide a full list of tag names - if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { - isJsDocTagName = true; + if (ts.hasDocComment(sourceFile, position)) { + // The current position is next to the '@' sign, when no tag name being provided yet. + // Provide a full list of tag names + if (sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { + requestJsDocTagName = true; + } + else { + // When completion is requested without "@", we will have check to make sure that + // there are no comments prefix the request position. We will only allow "*" and space. + // e.g + // /** |c| /* + // + // /** + // |c| + // */ + // + // /** + // * |c| + // */ + // + // /** + // * |c| + // */ + var lineStart = ts.getLineStartPositionForPosition(position, sourceFile); + requestJsDocTag = !(sourceFile.text.substring(lineStart, position).match(/[^\*|\s|(/\*\*)]/)); + } } // Completion should work inside certain JsDoc tags. For example: // /** @type {number | string} */ @@ -67805,12 +72888,12 @@ var ts; var tag = ts.getJsDocTagAtPosition(sourceFile, position); if (tag) { if (tag.tagName.pos <= position && position <= tag.tagName.end) { - isJsDocTagName = true; + requestJsDocTagName = true; } switch (tag.kind) { - case 283 /* JSDocTypeTag */: - case 281 /* JSDocParameterTag */: - case 282 /* JSDocReturnTag */: + case 287 /* JSDocTypeTag */: + case 285 /* JSDocParameterTag */: + case 286 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -67818,8 +72901,8 @@ var ts; break; } } - if (isJsDocTagName) { - return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName }; + if (requestJsDocTagName || requestJsDocTag) { + return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, requestJsDocTagName: requestJsDocTagName, requestJsDocTag: requestJsDocTag }; } if (!insideJsDocTagExpression) { // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal @@ -67855,13 +72938,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_14 = contextToken.parent, kind = contextToken.kind; - if (kind === 22 /* DotToken */) { - if (parent_14.kind === 177 /* PropertyAccessExpression */) { + var parent = contextToken.parent; + if (contextToken.kind === 22 /* DotToken */) { + if (parent.kind === 178 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_14.kind === 141 /* QualifiedName */) { + else if (parent.kind === 142 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -67872,13 +72955,34 @@ var ts; } } else if (sourceFile.languageVariant === 1 /* JSX */) { - if (kind === 26 /* LessThanToken */) { - isRightOfOpenTag = true; - location = contextToken; + // + // If the tagname is a property access expression, we will then walk up to the top most of property access expression. + // Then, try to get a JSX container and its associated attributes type. + if (parent && parent.kind === 178 /* PropertyAccessExpression */) { + contextToken = parent; + parent = parent.parent; } - else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 249 /* JsxClosingElement */) { - isStartingCloseTag = true; - location = contextToken; + switch (parent.kind) { + case 251 /* JsxClosingElement */: + if (contextToken.kind === 40 /* SlashToken */) { + isStartingCloseTag = true; + location = contextToken; + } + break; + case 193 /* BinaryExpression */: + if (!(parent.left.flags & 32768 /* ThisNodeHasError */)) { + // It has a left-hand side, so we're not in an opening JSX tag. + break; + } + // falls through + case 249 /* JsxSelfClosingElement */: + case 248 /* JsxElement */: + case 250 /* JsxOpeningElement */: + if (contextToken.kind === 26 /* LessThanToken */) { + isRightOfOpenTag = true; + location = contextToken; + } + break; } } } @@ -67919,13 +73023,13 @@ var ts; } } log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart)); - return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName }; + return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), requestJsDocTagName: requestJsDocTagName, requestJsDocTag: requestJsDocTag }; function getTypeScriptMemberSymbols() { // Right of dot member completion list isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -67981,11 +73085,11 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 247 /* JsxSelfClosingElement */) || (jsxContainer.kind === 248 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 249 /* JsxSelfClosingElement */) || (jsxContainer.kind === 250 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element - attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); + attrsType = typeChecker.getAllAttributesTypeFromJsxOpeningLikeElement(jsxContainer); if (attrsType) { - symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); + symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes.properties); isMemberCompletion = true; isNewIdentifierLocation = false; return true; @@ -68029,9 +73133,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 261 /* SourceFile */ || - scopeNode.kind === 194 /* TemplateExpression */ || - scopeNode.kind === 252 /* JsxExpression */ || + scopeNode.kind === 264 /* SourceFile */ || + scopeNode.kind === 195 /* TemplateExpression */ || + scopeNode.kind === 255 /* JsxExpression */ || ts.isStatement(scopeNode); } /// TODO filter meaning based on the current context @@ -68064,11 +73168,11 @@ var ts; return true; } if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 248 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 250 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 249 /* JsxClosingElement */ || contextToken.parent.kind === 247 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 246 /* JsxElement */; + if (contextToken.parent.kind === 251 /* JsxClosingElement */ || contextToken.parent.kind === 249 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 248 /* JsxElement */; } } return false; @@ -68078,40 +73182,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 179 /* CallExpression */ // func( a, | - || containingNodeKind === 150 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 180 /* NewExpression */ // new C(a, | - || containingNodeKind === 175 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 192 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 180 /* CallExpression */ // func( a, | + || containingNodeKind === 151 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 181 /* NewExpression */ // new C(a, | + || containingNodeKind === 176 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 193 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 159 /* FunctionType */; // var x: (s: string, list| case 18 /* OpenParenToken */: - return containingNodeKind === 179 /* CallExpression */ // func( | - || containingNodeKind === 150 /* Constructor */ // constructor( | - || containingNodeKind === 180 /* NewExpression */ // new C(a| - || containingNodeKind === 183 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 180 /* CallExpression */ // func( | + || containingNodeKind === 151 /* Constructor */ // constructor( | + || containingNodeKind === 181 /* NewExpression */ // new C(a| + || containingNodeKind === 184 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 167 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 20 /* OpenBracketToken */: - return containingNodeKind === 175 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 155 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 142 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 176 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 156 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 143 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 127 /* ModuleKeyword */: // module | case 128 /* NamespaceKeyword */: return true; case 22 /* DotToken */: - return containingNodeKind === 230 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 232 /* ModuleDeclaration */; // module A.| case 16 /* OpenBraceToken */: - return containingNodeKind === 226 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 228 /* ClassDeclaration */; // class A{ | case 57 /* EqualsToken */: - return containingNodeKind === 223 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 192 /* BinaryExpression */; // x = a| + return containingNodeKind === 225 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 193 /* BinaryExpression */; // x = a| case 13 /* TemplateHead */: - return containingNodeKind === 194 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 195 /* TemplateExpression */; // `aa ${| case 14 /* TemplateMiddle */: - return containingNodeKind === 202 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 204 /* TemplateSpan */; // `aa ${10} dd ${| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 148 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -68154,7 +73258,7 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 176 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 177 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; @@ -68164,7 +73268,7 @@ var ts; typeForObject = typeForObject && typeForObject.getNonNullableType(); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 172 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 173 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -68175,11 +73279,11 @@ var ts; // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); - if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) { + if (!canGetType && rootDeclaration.kind === 145 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) { + else if (rootDeclaration.parent.kind === 150 /* MethodDeclaration */ || rootDeclaration.parent.kind === 153 /* SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -68221,9 +73325,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 238 /* NamedImports */ ? - 235 /* ImportDeclaration */ : - 241 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 240 /* NamedImports */ ? + 237 /* ImportDeclaration */ : + 243 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -68231,12 +73335,13 @@ var ts; } isMemberCompletion = true; isNewIdentifierLocation = false; - var exports; - var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + symbols = ts.emptyArray; + return true; } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray; + var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); return true; } /** @@ -68248,9 +73353,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_15 = contextToken.parent; - if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) { - return parent_15; + var parent = contextToken.parent; + if (parent && (parent.kind === 177 /* ObjectLiteralExpression */ || parent.kind === 173 /* ObjectBindingPattern */)) { + return parent; } break; } @@ -68267,8 +73372,8 @@ var ts; case 16 /* OpenBraceToken */: // import { | case 25 /* CommaToken */: switch (contextToken.parent.kind) { - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return contextToken.parent; } } @@ -68277,37 +73382,55 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_16 = contextToken.parent; + var parent = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) { - return parent_16; + case 178 /* PropertyAccessExpression */: + case 253 /* JsxAttributes */: + case 252 /* JsxAttribute */: + case 254 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 249 /* JsxSelfClosingElement */ || parent.kind === 250 /* JsxOpeningElement */)) { + return parent; } - else if (parent_16.kind === 250 /* JsxAttribute */) { - return parent_16.parent; + else if (parent.kind === 252 /* JsxAttribute */) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + return parent.parent.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) { - return parent_16.parent; + if (parent && ((parent.kind === 252 /* JsxAttribute */) || (parent.kind === 254 /* JsxSpreadAttribute */))) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + return parent.parent.parent; } break; case 17 /* CloseBraceToken */: - if (parent_16 && - parent_16.kind === 252 /* JsxExpression */ && - parent_16.parent && - (parent_16.parent.kind === 250 /* JsxAttribute */)) { - return parent_16.parent.parent; + if (parent && + parent.kind === 255 /* JsxExpression */ && + parent.parent && parent.parent.kind === 252 /* JsxAttribute */) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + // each JsxAttribute can have initializer as JsxExpression + return parent.parent.parent.parent; } - if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) { - return parent_16.parent; + if (parent && parent.kind === 254 /* JsxSpreadAttribute */) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + return parent.parent.parent; } break; } @@ -68315,20 +73438,17 @@ var ts; return undefined; } function isFunction(kind) { + if (!ts.isFunctionLikeKind(kind)) { + return false; + } switch (kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 151 /* Constructor */: + case 160 /* ConstructorType */: + case 159 /* FunctionType */: + return false; + default: return true; } - return false; } /** * @returns true if we are certain that the currently edited location must define a new location; false otherwise. @@ -68337,66 +73457,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 223 /* VariableDeclaration */ || - containingNodeKind === 224 /* VariableDeclarationList */ || - containingNodeKind === 205 /* VariableStatement */ || - containingNodeKind === 229 /* EnumDeclaration */ || + return containingNodeKind === 225 /* VariableDeclaration */ || + containingNodeKind === 226 /* VariableDeclarationList */ || + containingNodeKind === 207 /* VariableStatement */ || + containingNodeKind === 231 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 226 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 173 /* ArrayBindingPattern */ || - containingNodeKind === 228 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 174 /* ArrayBindingPattern */ || + containingNodeKind === 230 /* TypeAliasDeclaration */; // type Map, K, | case 22 /* DotToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [.| case 55 /* ColonToken */: - return containingNodeKind === 174 /* BindingElement */; // var {x :html| + return containingNodeKind === 175 /* BindingElement */; // var {x :html| case 20 /* OpenBracketToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [x| case 18 /* OpenParenToken */: - return containingNodeKind === 256 /* CatchClause */ || + return containingNodeKind === 259 /* CatchClause */ || isFunction(containingNodeKind); case 16 /* OpenBraceToken */: - return containingNodeKind === 229 /* EnumDeclaration */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 161 /* TypeLiteral */; // const x : { | + return containingNodeKind === 231 /* EnumDeclaration */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 162 /* TypeLiteral */; // const x : { | case 24 /* SemicolonToken */: - return containingNodeKind === 146 /* PropertySignature */ && + return containingNodeKind === 147 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 227 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; | + (contextToken.parent.parent.kind === 229 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 162 /* TypeLiteral */); // const x : { a; | case 26 /* LessThanToken */: - return containingNodeKind === 226 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 228 /* TypeAliasDeclaration */ || + return containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 230 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 114 /* StaticKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; + return containingNodeKind === 148 /* PropertyDeclaration */; case 23 /* DotDotDotToken */: - return containingNodeKind === 144 /* Parameter */ || + return containingNodeKind === 145 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 173 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 174 /* ArrayBindingPattern */); // var [...z| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 144 /* Parameter */; + return containingNodeKind === 145 /* Parameter */; case 117 /* AsKeyword */: - return containingNodeKind === 239 /* ImportSpecifier */ || - containingNodeKind === 243 /* ExportSpecifier */ || - containingNodeKind === 237 /* NamespaceImport */; + return containingNodeKind === 241 /* ImportSpecifier */ || + containingNodeKind === 245 /* ExportSpecifier */ || + containingNodeKind === 239 /* NamespaceImport */; case 74 /* ClassKeyword */: case 82 /* EnumKeyword */: case 108 /* InterfaceKeyword */: case 88 /* FunctionKeyword */: case 103 /* VarKeyword */: case 124 /* GetKeyword */: - case 133 /* SetKeyword */: + case 134 /* SetKeyword */: case 90 /* ImportKeyword */: case 109 /* LetKeyword */: case 75 /* ConstKeyword */: case 115 /* YieldKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -68444,13 +73564,13 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_44 = element.propertyName || element.name; - existingImportsOrExports[name_44.text] = true; + var name = element.propertyName || element.name; + existingImportsOrExports.set(name.text, true); } - if (!ts.someProperties(existingImportsOrExports)) { + if (existingImportsOrExports.size === 0) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports.get(e.name); }); } /** * Filters out completion suggestions for named imports or exports. @@ -68466,12 +73586,12 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 257 /* PropertyAssignment */ && - m.kind !== 258 /* ShorthandPropertyAssignment */ && - m.kind !== 174 /* BindingElement */ && - m.kind !== 149 /* MethodDeclaration */ && - m.kind !== 151 /* GetAccessor */ && - m.kind !== 152 /* SetAccessor */) { + if (m.kind !== 260 /* PropertyAssignment */ && + m.kind !== 261 /* ShorthandPropertyAssignment */ && + m.kind !== 175 /* BindingElement */ && + m.kind !== 150 /* MethodDeclaration */ && + m.kind !== 152 /* GetAccessor */ && + m.kind !== 153 /* SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -68479,7 +73599,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 174 /* BindingElement */ && m.propertyName) { + if (m.kind === 175 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 70 /* Identifier */) { existingName = m.propertyName.text; @@ -68491,9 +73611,9 @@ var ts; // things like '__proto__' are not filtered out. existingName = m.name.text; } - existingMemberNames[existingName] = true; + existingMemberNames.set(existingName, true); } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.name); }); } /** * Filters out completion suggestions from 'symbols' according to existing JSX attributes. @@ -68509,11 +73629,11 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 250 /* JsxAttribute */) { - seenNames[attr.name.text] = true; + if (attr.kind === 252 /* JsxAttribute */) { + seenNames.set(attr.name.text, true); } } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + return ts.filter(symbols, function (a) { return !seenNames.get(a.name); }); } } /** @@ -68559,7 +73679,7 @@ var ts; } // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) { + for (var i = 71 /* FirstKeyword */; i <= 141 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ts.ScriptElementKind.keyword, @@ -68567,49 +73687,14 @@ var ts; sortText: "0" }); } - /** - * Matches a triple slash reference directive with an incomplete string literal for its path. Used - * to determine if the caret is currently within the string literal and capture the literal fragment - * for completions. - * For example, this matches - * - * /// = 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { + break; } - child = parent_17; } - return undefined; } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 215 /* BreakStatement */ || node.kind === 214 /* ContinueStatement */) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); + } + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return getLoopBreakContinueOccurrences(owner); + case 220 /* SwitchStatement */: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* SwitchKeyword */); + // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); + } + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + // If the "owner" is a function, then we equate 'return' and 'throw' statements in their + // ability to "jump out" of the function, and include occurrences for both. + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + } + return keywords; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + // If we didn't find a containing function with a block body, bail out. + if (!(func && hasKind(func.body, 206 /* Block */))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + // Include 'throw' statements that do not occur within a try block. + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + // Traverse upwards through all parent if-statements linked by their else-branches. + while (hasKind(ifStatement.parent, 210 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 89 /* IfKeyword */); + // Generally the 'else' keyword is second-to-last, so we traverse backwards. + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 81 /* ElseKeyword */)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 210 /* IfStatement */)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + // We'd like to highlight else/ifs together if they are only separated by whitespace + // (i.e. the keywords are separated by no comments, no newlines). + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 81 /* ElseKeyword */ && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. + var shouldCombindElseAndIf = true; + // Avoid recalculating getStart() by iterating backwards. + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; + break; } } + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; // skip the next keyword + continue; + } } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; + // Ordinary case: just highlight the keyword. + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); + } + return result; + } + /** + * Whether or not a 'node' is preceded by a label of the given string. + * Note: 'node' cannot be a SourceFile. + */ + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 221 /* LabeledStatement */; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; } - function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 218 /* SwitchStatement */: - if (statement.kind === 214 /* ContinueStatement */) { - continue; + } + return false; + } + })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } + // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have + // for those settings. + var buckets = ts.createMap(); + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); + } + function getBucketForCompilationSettings(key, createIfMissing) { + var bucket = buckets.get(key); + if (!bucket && createIfMissing) { + buckets.set(key, bucket = ts.createFileMap()); + } + return bucket; + } + function reportStats() { + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); + var sourceFiles = []; + entries.forEachValue(function (key, entry) { + sourceFiles.push({ + name: key, + refCount: entry.languageServiceRefCount, + references: entry.owners.slice(0) + }); + }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, undefined, 2); + } + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); + } + function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); + var entry = bucket.get(path); + if (!entry) { + ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); + // Have never seen this file with these settings. Create a new source file for it. + var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); + entry = { + sourceFile: sourceFile, + languageServiceRefCount: 0, + owners: [] + }; + bucket.set(path, entry); + } + else { + // We have an entry for this file. However, it may be for a different version of + // the script snapshot. If so, update it appropriately. Otherwise, we can just + // return it as is. + if (entry.sourceFile.version !== version) { + entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); + } + } + // If we're acquiring, then this is the first time this LS is asking for this document. + // Increase our ref count so we know there's another LS using the document. If we're + // not acquiring, then that means the LS is 'updating' the file instead, and that means + // it has already acquired the document previously. As such, we do not need to increase + // the ref count. + if (acquiring) { + entry.languageServiceRefCount++; + } + return entry.sourceFile; + } + function releaseDocument(fileName, compilationSettings) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + function releaseDocumentWithKey(path, key) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); + ts.Debug.assert(bucket !== undefined); + var entry = bucket.get(path); + entry.languageServiceRefCount--; + ts.Debug.assert(entry.languageServiceRefCount >= 0); + if (entry.languageServiceRefCount === 0) { + bucket.remove(path); + } + } + return { + acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, + updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, + releaseDocument: releaseDocument, + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings + }; + } + ts.createDocumentRegistry = createDocumentRegistry; +})(ts || (ts = {})); +/* Code for finding imports of an exported symbol. Used only by FindAllReferences. */ +/* @internal */ +var ts; +(function (ts) { + var FindAllReferences; + (function (FindAllReferences) { + /** Creates the imports map and returns an ImportTracker that uses it. Call this lazily to avoid calling `getDirectImportsMap` unnecessarily. */ + function createImportTracker(sourceFiles, checker, cancellationToken) { + var allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken); + return function (exportSymbol, exportInfo, isForRename) { + var _a = getImportersForExport(sourceFiles, allDirectImports, exportInfo, checker, cancellationToken), directImports = _a.directImports, indirectUsers = _a.indirectUsers; + return __assign({ indirectUsers: indirectUsers }, getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename)); + }; + } + FindAllReferences.createImportTracker = createImportTracker; + var ExportKind; + (function (ExportKind) { + ExportKind[ExportKind["Named"] = 0] = "Named"; + ExportKind[ExportKind["Default"] = 1] = "Default"; + ExportKind[ExportKind["ExportEquals"] = 2] = "ExportEquals"; + })(ExportKind = FindAllReferences.ExportKind || (FindAllReferences.ExportKind = {})); + var ImportExport; + (function (ImportExport) { + ImportExport[ImportExport["Import"] = 0] = "Import"; + ImportExport[ImportExport["Export"] = 1] = "Export"; + })(ImportExport = FindAllReferences.ImportExport || (FindAllReferences.ImportExport = {})); + /** Returns import statements that directly reference the exporting module, and a list of files that may access the module through a namespace. */ + function getImportersForExport(sourceFiles, allDirectImports, _a, checker, cancellationToken) { + var exportingModuleSymbol = _a.exportingModuleSymbol, exportKind = _a.exportKind; + var markSeenDirectImport = ts.nodeSeenTracker(); + var markSeenIndirectUser = ts.nodeSeenTracker(); + var directImports = []; + var isAvailableThroughGlobal = !!exportingModuleSymbol.globalExports; + var indirectUserDeclarations = isAvailableThroughGlobal ? undefined : []; + handleDirectImports(exportingModuleSymbol); + return { directImports: directImports, indirectUsers: getIndirectUsers() }; + function getIndirectUsers() { + if (isAvailableThroughGlobal) { + // It has `export as namespace`, so anything could potentially use it. + return sourceFiles; + } + // Module augmentations may use this module's exports without importing it. + for (var _i = 0, _a = exportingModuleSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (ts.isExternalModuleAugmentation(decl)) { + addIndirectUser(decl); + } + } + // This may return duplicates (if there are multiple module declarations in a single source file, all importing the same thing as a namespace), but `State.markSearchedSymbol` will handle that. + return indirectUserDeclarations.map(ts.getSourceFileOfNode); + } + function handleDirectImports(exportingModuleSymbol) { + var theseDirectImports = getDirectImports(exportingModuleSymbol); + if (theseDirectImports) + for (var _i = 0, theseDirectImports_1 = theseDirectImports; _i < theseDirectImports_1.length; _i++) { + var direct = theseDirectImports_1[_i]; + if (!markSeenDirectImport(direct)) { + continue; + } + cancellationToken.throwIfCancellationRequested(); + switch (direct.kind) { + case 180 /* CallExpression */: + if (!isAvailableThroughGlobal) { + var parent = direct.parent; + if (exportKind === 2 /* ExportEquals */ && parent.kind === 225 /* VariableDeclaration */) { + var name = parent.name; + if (name.kind === 70 /* Identifier */) { + directImports.push(name); + break; + } + } + // Don't support re-exporting 'require()' calls, so just add a single indirect user. + addIndirectUser(direct.getSourceFile()); + } + break; + case 236 /* ImportEqualsDeclaration */: + handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */)); + break; + case 237 /* ImportDeclaration */: + var namedBindings = direct.importClause && direct.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { + handleNamespaceImport(direct, namedBindings.name); } - // Fall through. - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; + else { + directImports.push(direct); } break; - default: - // Don't cross function boundaries. - if (ts.isFunctionLike(node_1)) { - return undefined; + case 243 /* ExportDeclaration */: + if (!direct.exportClause) { + // This is `export * from "foo"`, so imports of this module may import the export too. + handleDirectImports(getContainingModuleSymbol(direct, checker)); + } + else { + // This is `export { foo } from "foo"` and creates an alias symbol, so recursive search will get handle re-exports. + directImports.push(direct); } break; } } - return undefined; + } + function handleNamespaceImport(importDeclaration, name, isReExport) { + if (exportKind === 2 /* ExportEquals */) { + // This is a direct import, not import-as-namespace. + directImports.push(importDeclaration); } - function getModifierOccurrences(modifier, declaration) { - var container = declaration.parent; - // Make sure we only highlight the keyword when it makes sense to do so. - if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 226 /* ClassDeclaration */ || - container.kind === 197 /* ClassExpression */ || - (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) { - return undefined; - } + else if (!isAvailableThroughGlobal) { + var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); + ts.Debug.assert(sourceFileLike.kind === 264 /* SourceFile */ || sourceFileLike.kind === 232 /* ModuleDeclaration */); + if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { + addIndirectUsers(sourceFileLike); } - else if (modifier === 114 /* StaticKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { - return undefined; - } + else { + addIndirectUser(sourceFileLike); } - else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { - if (!(container.kind === 231 /* ModuleBlock */ || container.kind === 261 /* SourceFile */)) { - return undefined; - } + } + } + function addIndirectUser(sourceFileLike) { + ts.Debug.assert(!isAvailableThroughGlobal); + var isNew = markSeenIndirectUser(sourceFileLike); + if (isNew) { + indirectUserDeclarations.push(sourceFileLike); + } + return isNew; + } + /** Adds a module and all of its transitive dependencies as possible indirect users. */ + function addIndirectUsers(sourceFileLike) { + if (!addIndirectUser(sourceFileLike)) { + return; + } + var moduleSymbol = checker.getMergedSymbol(sourceFileLike.symbol); + ts.Debug.assert(!!(moduleSymbol.flags & 1536 /* Module */)); + var directImports = getDirectImports(moduleSymbol); + if (directImports) + for (var _i = 0, directImports_1 = directImports; _i < directImports_1.length; _i++) { + var directImport = directImports_1[_i]; + addIndirectUsers(getSourceFileLikeForImportDeclaration(directImport)); } - else if (modifier === 116 /* AbstractKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || declaration.kind === 226 /* ClassDeclaration */)) { - return undefined; - } + } + function getDirectImports(moduleSymbol) { + return allDirectImports.get(ts.getSymbolId(moduleSymbol).toString()); + } + } + /** + * Given the set of direct imports of a module, we need to find which ones import the particular exported symbol. + * The returned `importSearches` will result in the entire source file being searched. + * But re-exports will be placed in 'singleReferences' since they cannot be locally referenced. + */ + function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, checker, isForRename) { + var exportName = exportSymbol.name; + var importSearches = []; + var singleReferences = []; + function addSearch(location, symbol) { + importSearches.push([location, symbol]); + } + if (directImports) + for (var _i = 0, directImports_2 = directImports; _i < directImports_2.length; _i++) { + var decl = directImports_2[_i]; + handleImport(decl); + } + return { importSearches: importSearches, singleReferences: singleReferences }; + function handleImport(decl) { + if (decl.kind === 236 /* ImportEqualsDeclaration */) { + if (isExternalModuleImportEquals(decl)) { + handleNamespaceImportLike(decl.name); } - else { - // unsupported modifier - return undefined; + return; + } + if (decl.kind === 70 /* Identifier */) { + handleNamespaceImportLike(decl); + return; + } + // Ignore if there's a grammar error + if (decl.moduleSpecifier.kind !== 9 /* StringLiteral */) { + return; + } + if (decl.kind === 243 /* ExportDeclaration */) { + searchForNamedImport(decl.exportClause); + return; + } + var importClause = decl.importClause; + var namedBindings = importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { + handleNamespaceImportLike(namedBindings.name); + return; + } + if (exportKind === 0 /* Named */) { + searchForNamedImport(namedBindings); + } + else { + // `export =` might be imported by a default import if `--allowSyntheticDefaultImports` is on, so this handles both ExportKind.Default and ExportKind.ExportEquals + var name = importClause.name; + // If a default import has the same name as the default export, allow to rename it. + // Given `import f` and `export default function f`, we will rename both, but for `import g` we will rename just that. + if (name && (!isForRename || name.text === symbolName(exportSymbol))) { + var defaultImportAlias = checker.getSymbolAtLocation(name); + addSearch(name, defaultImportAlias); } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: - // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* Abstract */) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 150 /* Constructor */: - nodes = container.parameters.concat(container.parent.members); - break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - nodes = container.members; - // If we're an accessibility modifier, we're in an instance member and should search - // the constructor's parameter list for instance members as well. - if (modifierFlag & 28 /* AccessibilityModifier */) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 150 /* Constructor */ && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128 /* Abstract */) { - nodes = nodes.concat(container); - } - break; - default: - ts.Debug.fail("Invalid container kind."); + // 'default' might be accessed as a named import `{ default as foo }`. + if (!isForRename && exportKind === 1 /* Default */) { + ts.Debug.assert(exportName === "default"); + searchForNamedImport(namedBindings); } - ts.forEach(nodes, function (node) { - if (ts.getModifierFlags(node) & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + } + } + /** + * `import x = require("./x") or `import * as x from "./x"`. + * An `export =` may be imported by this syntax, so it may be a direct import. + * If it's not a direct import, it will be in `indirectUsers`, so we don't have to do anything here. + */ + function handleNamespaceImportLike(importName) { + // Don't rename an import that already has a different name than the export. + if (exportKind === 2 /* ExportEquals */ && (!isForRename || importName.text === exportName)) { + addSearch(importName, checker.getSymbolAtLocation(importName)); + } + } + function searchForNamedImport(namedBindings) { + if (namedBindings) + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var element = _a[_i]; + var name = element.name, propertyName = element.propertyName; + if ((propertyName || name).text !== exportName) { + continue; } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 113 /* PublicKeyword */: - return 4 /* Public */; - case 111 /* PrivateKeyword */: - return 8 /* Private */; - case 112 /* ProtectedKeyword */: - return 16 /* Protected */; - case 114 /* StaticKeyword */: - return 32 /* Static */; - case 83 /* ExportKeyword */: - return 1 /* Export */; - case 123 /* DeclareKeyword */: - return 2 /* Ambient */; - case 116 /* AbstractKeyword */: - return 128 /* Abstract */; - default: - ts.Debug.fail(); + if (propertyName) { + // This is `import { foo as bar } from "./a"` or `export { foo as bar } from "./a"`. `foo` isn't a local in the file, so just add it as a single reference. + singleReferences.push(propertyName); + if (!isForRename) { + // Search locally for `bar`. + addSearch(name, checker.getSymbolAtLocation(name)); + } + } + else { + var localSymbol = element.kind === 245 /* ExportSpecifier */ && element.propertyName + ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. + : checker.getSymbolAtLocation(name); + addSearch(name, localSymbol); } } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); + } + } + /** Returns 'true' is the namespace 'name' is re-exported from this module, and 'false' if it is only used locally. */ + function findNamespaceReExports(sourceFileLike, name, checker) { + var namespaceImportSymbol = checker.getSymbolAtLocation(name); + return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { + if (statement.kind !== 243 /* ExportDeclaration */) + return; + var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; + if (moduleSpecifier || !exportClause) + return; + for (var _i = 0, _b = exportClause.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (checker.getExportSpecifierLocalTargetSymbol(element) === namespaceImportSymbol) { return true; } - return false; } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* SetAccessor */); - return ts.map(keywords, getHighlightSpanForNode); - function tryPushAccessorKeyword(accessorSymbol, accessorKind) { - var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); - if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 133 /* SetKeyword */); }); + }); + } + /** Returns a map from a module symbol Id to all import statements that directly reference the module. */ + function getDirectImportsMap(sourceFiles, checker, cancellationToken) { + var map = ts.createMap(); + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; + cancellationToken.throwIfCancellationRequested(); + forEachImport(sourceFile, function (importDecl, moduleSpecifier) { + var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol) { + var id = ts.getSymbolId(moduleSymbol).toString(); + var imports = map.get(id); + if (!imports) { + map.set(id, imports = []); } + imports.push(importDecl); } + }); + } + return map; + } + /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ + function forEachPossibleImportOrExportStatement(sourceFileLike, action) { + return ts.forEach(sourceFileLike.kind === 264 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); + }); + } + /** Calls `action` for each import, re-export, or require() in a file. */ + function forEachImport(sourceFile, action) { + if (sourceFile.externalModuleIndicator) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier = _a[_i]; + action(importerFromModuleSpecifier(moduleSpecifier), moduleSpecifier); } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 122 /* ConstructorKeyword */); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { - // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 209 /* DoStatement */) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { - break; - } + } + else { + forEachPossibleImportOrExportStatement(sourceFile, function (statement) { + switch (statement.kind) { + case 243 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: { + var decl = statement; + if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9 /* StringLiteral */) { + action(decl, decl.moduleSpecifier); } + break; + } + case 236 /* ImportEqualsDeclaration */: { + var decl = statement; + var moduleReference = decl.moduleReference; + if (moduleReference.kind === 247 /* ExternalModuleReference */ && + moduleReference.expression.kind === 9 /* StringLiteral */) { + action(decl, moduleReference.expression); + } + break; } } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); + }); + if (sourceFile.flags & 65536 /* JavaScriptFile */) { + // Find all 'require()' calls. + sourceFile.forEachChild(function recur(node) { + if (ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { + action(node, node.arguments[0]); } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - return getLoopBreakContinueOccurrences(owner); - case 218 /* SwitchStatement */: - return getSwitchCaseDefaultOccurrences(owner); + else { + node.forEachChild(recur); } - } - return undefined; - } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* SwitchKeyword */); - // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. - ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); - } - }); }); - return ts.map(keywords, getHighlightSpanForNode); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); + } + } + function importerFromModuleSpecifier(moduleSpecifier) { + var decl = moduleSpecifier.parent; + if (decl.kind === 237 /* ImportDeclaration */ || decl.kind === 243 /* ExportDeclaration */) { + return decl; + } + ts.Debug.assert(decl.kind === 247 /* ExternalModuleReference */); + return decl.parent; + } + /** + * Given a local reference, we might notice that it's an import/export and recursively search for references of that. + * If at an import, look locally for the symbol it imports. + * If an an export, look for all imports of it. + * This doesn't handle export specifiers; that is done in `getReferencesAtExportSpecifier`. + * @param comingFromExport If we are doing a search for all exports, don't bother looking backwards for the imported symbol, since that's the reason we're here. + */ + function getImportOrExportSymbol(node, symbol, checker, comingFromExport) { + return comingFromExport ? getExport() : getExport() || getImport(); + function getExport() { + var parent = node.parent; + if (symbol.flags & 7340032 /* Export */) { + if (parent.kind === 178 /* PropertyAccessExpression */) { + // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. + // So check that we are at the declaration. + return symbol.declarations.some(function (d) { return d === parent; }) && parent.parent.kind === 193 /* BinaryExpression */ + ? getSpecialPropertyExport(parent.parent, /*useLhsSymbol*/ false) + : undefined; } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); + else { + var exportSymbol = symbol.exportSymbol; + ts.Debug.assert(!!exportSymbol); + return exportInfo(exportSymbol, getExportKindForDeclaration(parent)); } - return ts.map(keywords, getHighlightSpanForNode); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + else { + var exportNode = parent.kind === 225 /* VariableDeclaration */ ? ts.getAncestor(parent, 207 /* VariableStatement */) : parent; + if (ts.hasModifier(exportNode, 1 /* Export */)) { + if (exportNode.kind === 236 /* ImportEqualsDeclaration */ && exportNode.moduleReference === node) { + // We're at `Y` in `export import X = Y`. This is not the exported symbol, the left-hand-side is. So treat this as an import statement. + if (comingFromExport) { + return undefined; + } + var lhsSymbol = checker.getSymbolAtLocation(exportNode.name); + return { kind: 0 /* Import */, symbol: lhsSymbol, isNamedImport: false }; + } + else { + return exportInfo(symbol, getExportKindForDeclaration(exportNode)); + } } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); - }); - // If the "owner" is a function, then we equate 'return' and 'throw' statements in their - // ability to "jump out" of the function, and include occurrences for both. - if (ts.isFunctionBlock(owner)) { - ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); - }); + else if (parent.kind === 242 /* ExportAssignment */) { + // Get the symbol for the `export =` node; its parent is the module it's the export of. + var exportingModuleSymbol = parent.symbol.parent; + ts.Debug.assert(!!exportingModuleSymbol); + return { kind: 1 /* Export */, symbol: symbol, exportInfo: { exportingModuleSymbol: exportingModuleSymbol, exportKind: 2 /* ExportEquals */ } }; } - return ts.map(keywords, getHighlightSpanForNode); - } - function getReturnOccurrences(returnStatement) { - var func = ts.getContainingFunction(returnStatement); - // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 204 /* Block */))) { - return undefined; + else if (parent.kind === 193 /* BinaryExpression */) { + return getSpecialPropertyExport(parent, /*useLhsSymbol*/ true); } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); - }); - // Include 'throw' statements that do not occur within a try block. - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getIfElseOccurrences(ifStatement) { - var keywords = []; - // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 208 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { - ifStatement = ifStatement.parent; - } - // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. - while (ifStatement) { - var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 89 /* IfKeyword */); - // Generally the 'else' keyword is second-to-last, so we traverse backwards. - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 81 /* ElseKeyword */)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 208 /* IfStatement */)) { + else if (parent.parent.kind === 193 /* BinaryExpression */) { + return getSpecialPropertyExport(parent.parent, /*useLhsSymbol*/ true); + } + } + function getSpecialPropertyExport(node, useLhsSymbol) { + var kind; + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 1 /* ExportsProperty */: + kind = 0 /* Named */; break; - } - ifStatement = ifStatement.elseStatement; + case 2 /* ModuleExports */: + kind = 2 /* ExportEquals */; + break; + default: + return undefined; } - var result = []; - // We'd like to highlight else/ifs together if they are only separated by whitespace - // (i.e. the keywords are separated by no comments, no newlines). - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 81 /* ElseKeyword */ && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. - var shouldCombindElseAndIf = true; - // Avoid recalculating getStart() by iterating backwards. - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; // skip the next keyword - continue; - } - } - // Ordinary case: just highlight the keyword. - result.push(getHighlightSpanForNode(keywords[i])); + var sym = useLhsSymbol ? checker.getSymbolAtLocation(node.left.name) : symbol; + return sym && exportInfo(sym, kind); + } + } + function getImport() { + var isImport = isNodeImport(node); + if (!isImport) + return; + // A symbol being imported is always an alias. So get what that aliases to find the local symbol. + var importedSymbol = checker.getImmediateAliasedSymbol(symbol); + if (importedSymbol) { + // Search on the local symbol in the exporting module, not the exported symbol. + importedSymbol = skipExportSpecifierSymbol(importedSymbol, checker); + // Similarly, skip past the symbol for 'export =' + if (importedSymbol.name === "export=") { + importedSymbol = checker.getImmediateAliasedSymbol(importedSymbol); + } + if (symbolName(importedSymbol) === symbol.name) { + return __assign({ kind: 0 /* Import */, symbol: importedSymbol }, isImport); } - return result; } } + function exportInfo(symbol, kind) { + var exportInfo = getExportInfo(symbol, kind, checker); + return exportInfo && { kind: 1 /* Export */, symbol: symbol, exportInfo: exportInfo }; + } + // Not meant for use with export specifiers or export assignment. + function getExportKindForDeclaration(node) { + return ts.hasModifier(node, 512 /* Default */) ? 1 /* Default */ : 0 /* Named */; + } } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; - /** - * Whether or not a 'node' is preceded by a label of the given string. - * Note: 'node' cannot be a SourceFile. - */ - function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219 /* LabeledStatement */; owner = owner.parent) { - if (owner.label.text === labelName) { - return true; + FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; + function isNodeImport(node) { + var parent = node.parent; + switch (parent.kind) { + case 236 /* ImportEqualsDeclaration */: + return parent.name === node && isExternalModuleImportEquals(parent) + ? { isNamedImport: false } + : undefined; + case 241 /* ImportSpecifier */: + // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. + return parent.propertyName ? undefined : { isNamedImport: true }; + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + ts.Debug.assert(parent.name === node); + return { isNamedImport: false }; + default: + return undefined; + } + } + function getExportInfo(exportSymbol, exportKind, checker) { + var exportingModuleSymbol = checker.getMergedSymbol(exportSymbol.parent); // Need to get merged symbol in case there's an augmentation. + // `export` may appear in a namespace. In that case, just rely on global search. + return ts.isExternalModuleSymbol(exportingModuleSymbol) ? { exportingModuleSymbol: exportingModuleSymbol, exportKind: exportKind } : undefined; + } + FindAllReferences.getExportInfo = getExportInfo; + function symbolName(symbol) { + if (symbol.name !== "default") { + return symbol.name; + } + var name = ts.forEach(symbol.declarations, function (_a) { + var name = _a.name; + return name && name.kind === 70 /* Identifier */ && name.text; + }); + ts.Debug.assert(!!name); + return name; + } + /** If at an export specifier, go to the symbol it refers to. */ + function skipExportSpecifierSymbol(symbol, checker) { + // For `export { foo } from './bar", there's nothing to skip, because it does not create a new alias. But `export { foo } does. + if (symbol.declarations) + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) { + return checker.getExportSpecifierLocalTargetSymbol(declaration); + } } + return symbol; + } + function getContainingModuleSymbol(importer, checker) { + return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); + } + function getSourceFileLikeForImportDeclaration(node) { + if (node.kind === 180 /* CallExpression */) { + return node.getSourceFile(); } - return false; + var parent = node.parent; + if (parent.kind === 264 /* SourceFile */) { + return parent; + } + ts.Debug.assert(parent.kind === 233 /* ModuleBlock */ && isAmbientModuleDeclaration(parent.parent)); + return parent.parent; } - })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})); + function isAmbientModuleDeclaration(node) { + return node.kind === 232 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; + } + function isExternalModuleImportEquals(_a) { + var moduleReference = _a.moduleReference; + return moduleReference.kind === 247 /* ExternalModuleReference */ && moduleReference.expression.kind === 9 /* StringLiteral */; + } + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); +/// +/* @internal */ var ts; (function (ts) { - function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { - if (currentDirectory === void 0) { currentDirectory = ""; } - // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have - // for those settings. - var buckets = ts.createMap(); - var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyForCompilationSettings(settings) { - return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); + var FindAllReferences; + (function (FindAllReferences) { + function nodeEntry(node, isInString) { + return { type: "node", node: node, isInString: isInString }; } - function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; - if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + FindAllReferences.nodeEntry = nodeEntry; + function findReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position) { + var referencedSymbols = findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position); + if (!referencedSymbols || !referencedSymbols.length) { + return undefined; } - return bucket; + var out = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var _a = referencedSymbols_1[_i], definition = _a.definition, references = _a.references; + // Only include referenced symbols that have a valid definition. + if (definition) { + out.push({ definition: definitionToReferencedSymbolDefinitionInfo(definition, checker), references: references.map(toReferenceEntry) }); + } + } + return out; } - function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; - var sourceFiles = []; - entries.forEachValue(function (key, entry) { - sourceFiles.push({ - name: key, - refCount: entry.languageServiceRefCount, - references: entry.owners.slice(0) - }); - }); - sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); - return { - bucket: name, - sourceFiles: sourceFiles - }; - }); - return JSON.stringify(bucketInfoArray, undefined, 2); + FindAllReferences.findReferencedSymbols = findReferencedSymbols; + function getImplementationsAtPosition(checker, cancellationToken, sourceFiles, sourceFile, position) { + var node = ts.getTouchingPropertyName(sourceFile, position); + var referenceEntries = getImplementationReferenceEntries(checker, cancellationToken, sourceFiles, node); + return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); }); } - function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; + function getImplementationReferenceEntries(typeChecker, cancellationToken, sourceFiles, node) { + // If invoked directly on a shorthand property assignment, then return + // the declaration of the symbol being assigned (not the symbol being assigned to). + if (node.parent.kind === 261 /* ShorthandPropertyAssignment */) { + var result_4 = []; + FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, function (node) { return result_4.push(nodeEntry(node)); }); + return result_4; + } + else if (node.kind === 96 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) { + // References to and accesses on the super keyword only have one possible implementation, so no + // need to "Find all References" + var symbol = typeChecker.getSymbolAtLocation(node); + return symbol.valueDeclaration && [nodeEntry(symbol.valueDeclaration)]; + } + else { + // Perform "Find all References" and retrieve only those that are implementations + return getReferenceEntriesForNode(node, sourceFiles, typeChecker, cancellationToken, { implementations: true }); + } } - function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + function findReferencedEntries(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var x = flattenEntries(findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options)); + return ts.map(x, toReferenceEntry); } - function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + FindAllReferences.findReferencedEntries = findReferencedEntries; + function getReferenceEntriesForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + return flattenEntries(FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options)); } - function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); + FindAllReferences.getReferenceEntriesForNode = getReferenceEntriesForNode; + function findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); + return FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options); + } + function flattenEntries(referenceSymbols) { + return referenceSymbols && ts.flatMap(referenceSymbols, function (r) { return r.references; }); + } + function definitionToReferencedSymbolDefinitionInfo(def, checker) { + var info = (function () { + switch (def.type) { + case "symbol": { + var symbol = def.symbol, node_2 = def.node; + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var name_3 = displayParts_1.map(function (p) { return p.text; }).join(""); + return { node: node_2, name: name_3, kind: kind_1, displayParts: displayParts_1 }; + } + case "label": { + var node_3 = def.node; + return { node: node_3, name: node_3.text, kind: ts.ScriptElementKind.label, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + } + case "keyword": { + var node_4 = def.node; + var name_4 = ts.tokenToString(node_4.kind); + return { node: node_4, name: name_4, kind: ts.ScriptElementKind.keyword, displayParts: [{ text: name_4, kind: ts.ScriptElementKind.keyword }] }; + } + case "this": { + var node_5 = def.node; + var symbol = checker.getSymbolAtLocation(node_5); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; + return { node: node_5, name: "this", kind: ts.ScriptElementKind.variableElement, displayParts: displayParts_2 }; + } + case "string": { + var node_6 = def.node; + return { node: node_6, name: node_6.text, kind: ts.ScriptElementKind.variableElement, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + } + } + })(); + if (!info) { + return undefined; + } + var node = info.node, name = info.name, kind = info.kind, displayParts = info.displayParts; + var sourceFile = node.getSourceFile(); + return { + containerKind: "", + containerName: "", + fileName: sourceFile.fileName, + kind: kind, + name: name, + textSpan: ts.createTextSpanFromNode(node, sourceFile), + displayParts: displayParts + }; } - function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { - var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); - var entry = bucket.get(path); - if (!entry) { - ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); - // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); - entry = { - sourceFile: sourceFile, - languageServiceRefCount: 0, - owners: [] + function getDefinitionKindAndDisplayParts(symbol, node, checker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + return { displayParts: displayParts, kind: symbolKind }; + } + function toReferenceEntry(entry) { + if (entry.type === "span") { + return { textSpan: entry.textSpan, fileName: entry.fileName, isWriteAccess: false, isDefinition: false }; + } + var node = entry.node, isInString = entry.isInString; + return { + fileName: node.getSourceFile().fileName, + textSpan: getTextSpan(node), + isWriteAccess: isWriteAccess(node), + isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node), + isInString: isInString + }; + } + function toImplementationLocation(entry, checker) { + if (entry.type === "node") { + var node = entry.node; + return __assign({ textSpan: getTextSpan(node), fileName: node.getSourceFile().fileName }, implementationKindDisplayParts(node, checker)); + } + else { + var textSpan = entry.textSpan, fileName = entry.fileName; + return { textSpan: textSpan, fileName: fileName, kind: ts.ScriptElementKind.unknown, displayParts: [] }; + } + } + function implementationKindDisplayParts(node, checker) { + var symbol = checker.getSymbolAtLocation(ts.isDeclaration(node) && node.name ? node.name : node); + if (symbol) { + return getDefinitionKindAndDisplayParts(symbol, node, checker); + } + else if (node.kind === 177 /* ObjectLiteralExpression */) { + return { + kind: ts.ScriptElementKind.interfaceElement, + displayParts: [ts.punctuationPart(18 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(19 /* CloseParenToken */)] + }; + } + else if (node.kind === 198 /* ClassExpression */) { + return { + kind: ts.ScriptElementKind.localClassElement, + displayParts: [ts.punctuationPart(18 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(19 /* CloseParenToken */)] }; - bucket.set(path, entry); } else { - // We have an entry for this file. However, it may be for a different version of - // the script snapshot. If so, update it appropriately. Otherwise, we can just - // return it as is. - if (entry.sourceFile.version !== version) { - entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); - } + return { kind: ts.getNodeKind(node), displayParts: [] }; } - // If we're acquiring, then this is the first time this LS is asking for this document. - // Increase our ref count so we know there's another LS using the document. If we're - // not acquiring, then that means the LS is 'updating' the file instead, and that means - // it has already acquired the document previously. As such, we do not need to increase - // the ref count. - if (acquiring) { - entry.languageServiceRefCount++; + } + function toHighlightSpan(entry) { + if (entry.type === "span") { + var fileName_1 = entry.fileName, textSpan = entry.textSpan; + return { fileName: fileName_1, span: { textSpan: textSpan, kind: ts.HighlightSpanKind.reference } }; } - return entry.sourceFile; + var node = entry.node, isInString = entry.isInString; + var fileName = entry.node.getSourceFile().fileName; + var writeAccess = isWriteAccess(node); + var span = { + textSpan: getTextSpan(node), + kind: writeAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference, + isInString: isInString + }; + return { fileName: fileName, span: span }; } - function releaseDocument(fileName, compilationSettings) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return releaseDocumentWithKey(path, key); + FindAllReferences.toHighlightSpan = toHighlightSpan; + function getTextSpan(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 9 /* StringLiteral */) { + start += 1; + end -= 1; + } + return ts.createTextSpanFromBounds(start, end); } - function releaseDocumentWithKey(path, key) { - var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); - ts.Debug.assert(bucket !== undefined); - var entry = bucket.get(path); - entry.languageServiceRefCount--; - ts.Debug.assert(entry.languageServiceRefCount >= 0); - if (entry.languageServiceRefCount === 0) { - bucket.remove(path); + /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ + function isWriteAccess(node) { + if (node.kind === 70 /* Identifier */ && ts.isDeclarationName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 192 /* PostfixUnaryExpression */ || parent.kind === 191 /* PrefixUnaryExpression */) { + return true; + } + else if (parent.kind === 193 /* BinaryExpression */ && parent.left === node) { + var operator = parent.operatorToken.kind; + return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */; + } } + return false; } - return { - acquireDocument: acquireDocument, - acquireDocumentWithKey: acquireDocumentWithKey, - updateDocument: updateDocument, - updateDocumentWithKey: updateDocumentWithKey, - releaseDocument: releaseDocument, - releaseDocumentWithKey: releaseDocumentWithKey, - reportStats: reportStats, - getKeyForCompilationSettings: getKeyForCompilationSettings - }; - } - ts.createDocumentRegistry = createDocumentRegistry; + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); +/** Encapsulates the core find-all-references algorithm. */ /* @internal */ -var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { - var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8 /* NumericLiteral */: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; + var Core; + (function (Core) { + /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ + function getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + if (node.kind === 264 /* SourceFile */) { + return undefined; + } + if (!options.implementations) { + var special = getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken); + if (special) { + return special; } - // Fallthrough - case 70 /* Identifier */: - case 98 /* ThisKeyword */: - // case SyntaxKind.SuperKeyword: TODO:GH#9268 - case 122 /* ConstructorKeyword */: - case 9 /* StringLiteral */: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, /*implementations*/ false); + } + var symbol = checker.getSymbolAtLocation(node); + // Could not find a symbol e.g. unknown identifier + if (!symbol) { + // String literal might be a property (and thus have a symbol), so do this here rather than in getReferencedSymbolsSpecial. + if (!options.implementations && node.kind === 9 /* StringLiteral */) { + return getReferencesForStringLiteral(node, sourceFiles, cancellationToken); + } + // Can't have references to something that we have no symbol for. + return undefined; + } + // The symbol was an internal symbol and does not have a declaration e.g. undefined symbol + if (!symbol.declarations || !symbol.declarations.length) { + return undefined; + } + return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options); } - return undefined; - } - FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { - if (!implementations) { + Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + /** getReferencedSymbols for special node kinds. */ + function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } // Labels if (ts.isLabelName(node)) { if (ts.isJumpStatementTarget(node)) { var labelDefinition = ts.getTargetLabel(node.parent, node.text); // if we have a label definition, look within its statement for references, if not, then // the label is undefined and we have no results.. - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition); } else { // it is a label definition and not a target, search within the parent labeledStatement @@ -69311,129 +75098,164 @@ var ts; } } if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); + return getReferencesForThisKeyword(node, sourceFiles, cancellationToken); } if (node.kind === 96 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } - } - // `getSymbolAtLocation` normally returns the symbol of the class when given the constructor keyword, - // so we have to specify that we want the constructor symbol. - var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9 /* StringLiteral */) { - return getReferencesForStringLiteral(node, sourceFiles); - } - // Could not find a symbol e.g. unknown identifier - if (!symbol) { - // Can't have references to something that we have no symbol for. return undefined; } - var declarations = symbol.declarations; - // The symbol was an internal symbol and does not have a declaration e.g. undefined symbol - if (!declarations || !declarations.length) { - return undefined; - } - var result; - // Compute the meaning from the location and the symbol it references - var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); - // Get the text to search for. - // Note: if this is an external module symbol, the name doesn't include quotes. - var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - // Try to get the smallest valid scope that we can limit our search to; - // otherwise we'll need to search globally (i.e. include each file). - var scope = getSymbolScope(symbol); - // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. - var symbolToIndex = []; - if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); - } - else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; - cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + /** Core find-all-references algorithm for a normal symbol. */ + function getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options) { + symbol = skipPastExportOrImportSpecifier(symbol, node, checker); + // Compute the meaning from the location and the symbol it references + var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), symbol.declarations); + var result = []; + var state = createState(sourceFiles, node, checker, cancellationToken, searchMeaning, options, result); + var search = state.createSearch(node, symbol, /*comingFrom*/ undefined, { allSearchSymbols: populateSearchSymbolSet(symbol, node, checker, options.implementations) }); + // Try to get the smallest valid scope that we can limit our search to; + // otherwise we'll need to search globally (i.e. include each file). + var scope = getSymbolScope(symbol); + if (scope) { + getReferencesInContainer(scope, scope.getSourceFile(), search, state); + } + else { + // Global search + for (var _i = 0, _a = state.sourceFiles; _i < _a.length; _i++) { + var sourceFile = _a[_i]; + state.cancellationToken.throwIfCancellationRequested(); + searchForName(sourceFile, search, state); } } + return result; } - return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + /** Handle a few special cases relating to export/import specifiers. */ + function skipPastExportOrImportSpecifier(symbol, node, checker) { + var parent = node.parent; + if (ts.isExportSpecifier(parent)) { + return getLocalSymbolForExportSpecifier(node, symbol, parent, checker); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; + if (ts.isImportSpecifier(parent) && parent.propertyName === node) { + // We're at `foo` in `import { foo as bar }`. Probably intended to find all refs on the original, not just on the import. + return checker.getImmediateAliasedSymbol(symbol); + } + return symbol; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608 /* Alias */) { - // Default import get alias - var defaultImport = ts.getDeclarationOfKind(symbol, 236 /* ImportClause */); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 /* ImportSpecifier */ || - declaration.kind === 243 /* ExportSpecifier */) ? declaration : undefined; }); - if (importOrExportSpecifier && - // export { a } - (!importOrExportSpecifier.propertyName || - // export {a as class } where a is location - importOrExportSpecifier.propertyName === location)) { - // If Import specifier -> get alias - // else Export specifier -> get local target - return importOrExportSpecifier.kind === 239 /* ImportSpecifier */ ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + function createState(sourceFiles, originalLocation, checker, cancellationToken, searchMeaning, options, result) { + var symbolIdToReferences = []; + var inheritsFromCache = ts.createMap(); + // Source file ID → symbol ID → Whether the symbol has been searched for in the source file. + var sourceFileToSeenSymbols = []; + var isForConstructor = originalLocation.kind === 122 /* ConstructorKeyword */; + var importTracker; + return __assign({}, options, { sourceFiles: sourceFiles, isForConstructor: isForConstructor, checker: checker, cancellationToken: cancellationToken, searchMeaning: searchMeaning, inheritsFromCache: inheritsFromCache, getImportSearches: getImportSearches, createSearch: createSearch, referenceAdder: referenceAdder, addStringOrCommentReference: addStringOrCommentReference, + markSearchedSymbol: markSearchedSymbol, markSeenContainingTypeReference: ts.nodeSeenTracker(), markSeenReExportRHS: ts.nodeSeenTracker() }); + function getImportSearches(exportSymbol, exportInfo) { + if (!importTracker) + importTracker = FindAllReferences.createImportTracker(sourceFiles, checker, cancellationToken); + return importTracker(exportSymbol, exportInfo, options.isForRename); + } + function createSearch(location, symbol, comingFrom, searchOptions) { + if (searchOptions === void 0) { searchOptions = {}; } + // Note: if this is an external module symbol, the name doesn't include quotes. + var _a = searchOptions.text, text = _a === void 0 ? ts.stripQuotes(ts.getDeclaredName(checker, symbol, location)) : _a, _b = searchOptions.allSearchSymbols, allSearchSymbols = _b === void 0 ? undefined : _b; + var escapedText = ts.escapeIdentifier(text); + var parents = options.implementations && getParentSymbolsOfPropertyAccess(location, symbol, checker); + return { location: location, symbol: symbol, comingFrom: comingFrom, text: text, escapedText: escapedText, parents: parents, includes: includes }; + function includes(referenceSymbol) { + return allSearchSymbols ? ts.contains(allSearchSymbols, referenceSymbol) : referenceSymbol === symbol; + } + } + function referenceAdder(referenceSymbol, searchLocation) { + var symbolId = ts.getSymbolId(referenceSymbol); + var references = symbolIdToReferences[symbolId]; + if (!references) { + references = symbolIdToReferences[symbolId] = []; + result.push({ definition: { type: "symbol", symbol: referenceSymbol, node: searchLocation }, references: references }); + } + return function (node) { return references.push(FindAllReferences.nodeEntry(node)); }; + } + function addStringOrCommentReference(fileName, textSpan) { + result.push({ + definition: undefined, + references: [{ type: "span", fileName: fileName, textSpan: textSpan }] + }); + } + function markSearchedSymbol(sourceFile, symbol) { + var sourceId = ts.getNodeId(sourceFile); + var symbolId = ts.getSymbolId(symbol); + var seenSymbols = sourceFileToSeenSymbols[sourceId] || (sourceFileToSeenSymbols[sourceId] = []); + return !seenSymbols[symbolId] && (seenSymbols[symbolId] = true); + } + } + /** Search for all imports of a given exported symbol using `State.getImportSearches`. */ + function searchForImportsOfExport(exportLocation, exportSymbol, exportInfo, state) { + var _a = state.getImportSearches(exportSymbol, exportInfo), importSearches = _a.importSearches, singleReferences = _a.singleReferences, indirectUsers = _a.indirectUsers; + // For `import { foo as bar }` just add the reference to `foo`, and don't otherwise search in the file. + if (singleReferences.length) { + var addRef = state.referenceAdder(exportSymbol, exportLocation); + for (var _i = 0, singleReferences_1 = singleReferences; _i < singleReferences_1.length; _i++) { + var singleRef = singleReferences_1[_i]; + addRef(singleRef); + } + } + // For each import, find all references to that import in its source file. + for (var _b = 0, importSearches_1 = importSearches; _b < importSearches_1.length; _b++) { + var _c = importSearches_1[_b], importLocation = _c[0], importSymbol = _c[1]; + getReferencesInSourceFile(importLocation.getSourceFile(), state.createSearch(importLocation, importSymbol, 1 /* Export */), state); + } + if (indirectUsers.length) { + var indirectSearch = void 0; + switch (exportInfo.exportKind) { + case 0 /* Named */: + indirectSearch = state.createSearch(exportLocation, exportSymbol, 1 /* Export */); + break; + case 1 /* Default */: + // Search for a property access to '.default'. This can't be renamed. + indirectSearch = state.isForRename ? undefined : state.createSearch(exportLocation, exportSymbol, 1 /* Export */, { text: "default" }); + break; + case 2 /* ExportEquals */: + break; + } + if (indirectSearch) { + for (var _d = 0, indirectUsers_1 = indirectUsers; _d < indirectUsers_1.length; _d++) { + var indirectUser = indirectUsers_1[_d]; + searchForName(indirectUser, indirectSearch, state); + } } } - return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + // Go to the symbol we imported from and find references for it. + function searchForImportedSymbol(symbol, state) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + getReferencesInSourceFile(declaration.getSourceFile(), state.createSearch(declaration, symbol, 0 /* Import */), state); + } + } + /** Search for all occurences of an identifier in a source file (and filter out the ones that match). */ + function searchForName(sourceFile, search, state) { + if (ts.getNameTable(sourceFile).get(search.escapedText) !== undefined) { + getReferencesInSourceFile(sourceFile, search, state); + } } - function getPropertySymbolOfDestructuringAssignment(location) { + function getPropertySymbolOfDestructuringAssignment(location, checker) { return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + checker.getPropertySymbolOfDestructuringAssignment(location); } function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); return bindingElement && - bindingElement.parent.kind === 172 /* ObjectBindingPattern */ && + bindingElement.parent.kind === 173 /* ObjectBindingPattern */ && !bindingElement.propertyName; } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); + var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); } return undefined; } - function getInternedName(symbol, location) { - // If this is an export or import specifier it could have been renamed using the 'as' syntax. - // If so we want to search for whatever under the cursor. - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - // Try to get the local symbol if we're dealing with an 'export default' - // since that symbol has the "true" name. - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); - } /** * Determines the smallest scope in which a symbol may have named references. * Note that not every construct has been accounted for. This function can @@ -69445,55 +75267,57 @@ var ts; function getSymbolScope(symbol) { // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. - var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 184 /* FunctionExpression */ || valueDeclaration.kind === 197 /* ClassExpression */)) { + var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 185 /* FunctionExpression */ || valueDeclaration.kind === 198 /* ClassExpression */)) { return valueDeclaration; } + if (!declarations) { + return undefined; + } // If this is private property or method, the scope is the containing class - if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); + if (flags & (4 /* Property */ | 8192 /* Method */)) { + var privateDeclaration = ts.find(declarations, function (d) { return !!(ts.getModifierFlags(d) & 8 /* Private */); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 228 /* ClassDeclaration */); } } - // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visible outside its declaration scope. - if (symbol.flags & 8388608 /* Alias */) { - return undefined; - } // If symbol is of object binding pattern element without property name we would want to // look for property too and that could be anywhere if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { return undefined; } - // if this symbol is visible from its parent container, e.g. exported, then bail out - // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { + // If the symbol has a parent, it's globally visible. + // Unless that parent is an external module, then we should only search in the module (and recurse on the export later). + // But if the parent is a module that has `export as namespace`, then the symbol *is* globally visible. + if (parent && !((parent.flags & 1536 /* Module */) && ts.isExternalModuleSymbol(parent) && !parent.globalExports)) { + return undefined; + } + // If this is a synthetic property, it's a property and must be searched for globally. + if ((flags & 134217728 /* Transient */ && symbol.checkFlags & 6 /* Synthetic */)) { return undefined; } var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - // Different declarations have different containers, bail out - return undefined; - } - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { - // This is a global variable and not an external module, any declaration defined - // within this scope is visible outside the file - return undefined; - } - // The search scope is the container node - scope = container; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; + var container = ts.getContainerNode(declaration); + if (scope && scope !== container) { + // Different declarations have different containers, bail out + return undefined; } + if (!container || container.kind === 264 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + // This is a global variable and not an external module, any declaration defined + // within this scope is visible outside the file + return undefined; + } + // The search scope is the container node + scope = container; } - return scope; + // If symbol.parent, this means we are in an export of an external module. (Otherwise we would have returned `undefined` above.) + // For an export of a module, we may be in a declaration file, and it may be accessed elsewhere. E.g.: + // declare module "a" { export type T = number; } + // declare module "b" { import { T } from "a"; export const x: T; } + // So we must search the whole source file. (Because we will mark the source file as seen, we we won't return to it when searching for imports.) + return parent ? scope.getSourceFile() : scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { var positions = []; @@ -69508,7 +75332,6 @@ var ts; var symbolNameLength = symbolName.length; var position = text.indexOf(symbolName, start); while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); // If we are past the end, stop looking if (position > end) break; @@ -69529,279 +75352,320 @@ var ts; var sourceFile = container.getSourceFile(); var labelName = targetLabel.text; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.getWidth() !== labelName.length) { - return; + continue; } // Only pick labels that are either the target label, or have a target that is the target label if (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "label", node: targetLabel }, references: references }]; } function isValidReferencePosition(node, searchSymbolName) { - if (node) { - // Compare the length so we filter out strict superstrings of the symbol we are looking for - switch (node.kind) { - case 70 /* Identifier */: - return node.getWidth() === searchSymbolName.length; - case 9 /* StringLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - // For string literals we have two additional chars for the quotes - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8 /* NumericLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + // Compare the length so we filter out strict superstrings of the symbol we are looking for + switch (node && node.kind) { + case 70 /* Identifier */: + return node.getWidth() === searchSymbolName.length; + case 9 /* StringLiteral */: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + // For string literals we have two additional chars for the quotes + node.getWidth() === searchSymbolName.length + 2; + case 8 /* NumericLiteral */: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, ts.tokenToString(keywordKind), references); + } + return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd()); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push(FindAllReferences.nodeEntry(referenceLocation)); } } - return false; } - /** Search within node "container" for references for a search value, where the search value is defined as a - * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). - * searchLocation: a node where the search value - */ - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - // Build the set of symbols to search for, initially it has only the current symbol - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); - if (!isValidReferencePosition(referenceLocation, searchText)) { - // This wasn't the start of a token. Check to see if it might be a - // match in a comment or string if that's what the caller is asking - // for. - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { - // In the case where we're looking inside comments/strings, we don't have - // an actual definition. So just use 'undefined' here. Features like - // 'Rename' won't care (as they ignore the definitions), and features like - // 'FindReferences' will just filter out these results. - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, - /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122 /* ConstructorKeyword */) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); - } - } - }); + function getReferencesInSourceFile(sourceFile, search, state) { + state.cancellationToken.throwIfCancellationRequested(); + return getReferencesInContainer(sourceFile, sourceFile, search, state); + } + /** + * Search within node "container" for references for a search value, where the search value is defined as a + * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). + * searchLocation: a node where the search value + */ + function getReferencesInContainer(container, sourceFile, search, state) { + if (!state.markSearchedSymbol(sourceFile, search.symbol)) { + return; } - return; - /* If we are just looking for implementations and this is a property access expression, we need to get the - * symbol of the local type of the symbol the property is being accessed on. This is because our search - * symbol may have a different parent symbol if the local type's symbol does not declare the property - * being accessed (i.e. it is declared in some parent class or interface) - */ - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608 /* UnionOrIntersection */) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } - } - } + var start = state.findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, search.text, start, container.getEnd()); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + getReferencesAtLocation(sourceFile, position, search, state); + } + } + function getReferencesAtLocation(sourceFile, position, search, state) { + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, search.text)) { + // This wasn't the start of a token. Check to see if it might be a + // match in a comment or string if that's what the caller is asking + // for. + if (!state.implementations && (state.findInStrings && ts.isInString(sourceFile, position) || state.findInComments && ts.isInNonReferenceComment(sourceFile, position))) { + // In the case where we're looking inside comments/strings, we don't have + // an actual definition. So just use 'undefined' here. Features like + // 'Rename' won't care (as they ignore the definitions), and features like + // 'FindReferences' will just filter out these results. + state.addStringOrCommentReference(sourceFile.fileName, ts.createTextSpan(position, search.text.length)); } + return; + } + if (!(ts.getMeaningFromLocation(referenceLocation) & state.searchMeaning)) { + return; } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + var referenceSymbol = state.checker.getSymbolAtLocation(referenceLocation); + if (!referenceSymbol) { + return; + } + var parent = referenceLocation.parent; + if (ts.isImportSpecifier(parent) && parent.propertyName === referenceLocation) { + // This is added through `singleReferences` in ImportsResult. If we happen to see it again, don't add it again. + return; + } + if (ts.isExportSpecifier(parent)) { + ts.Debug.assert(referenceLocation.kind === 70 /* Identifier */); + getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state); + return; + } + var relatedSymbol = getRelatedSymbol(search, referenceSymbol, referenceLocation, state); + if (!relatedSymbol) { + getReferenceForShorthandProperty(referenceSymbol, search, state); + return; + } + if (state.isForConstructor) { + findConstructorReferences(referenceLocation, sourceFile, search, state); } - /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - // This is the class declaration containing the constructor. - addReferences(findOwnConstructorCalls(searchSymbol)); + else { + addReference(referenceLocation, relatedSymbol, search.location, state); + } + getImportOrExportReferences(referenceLocation, referenceSymbol, search, state); + } + function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + var exportDeclaration = parent.parent; + var localSymbol = getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, state.checker); + if (!search.includes(localSymbol)) { + return; + } + if (!propertyName) { + addRef(); + } + else if (referenceLocation === propertyName) { + // For `export { foo as bar } from "baz"`, "`foo`" will be added from the singleReferences for import searches of the original export. + // For `export { foo as bar };`, where `foo` is a local, so add it now. + if (!exportDeclaration.moduleSpecifier) { + addRef(); } - else { - // If this class appears in `extends C`, then the extending class' "super" calls are references. - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + if (!state.isForRename && state.markSeenReExportRHS(name)) { + addReference(name, referenceSymbol, name, state); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); + else { + if (state.markSeenReExportRHS(referenceLocation)) { + addRef(); + } + } + // For `export { foo as bar }`, rename `foo`, but not `bar`. + if (!(referenceLocation === propertyName && state.isForRename)) { + var exportKind = referenceLocation.originalKeywordKind === 78 /* DefaultKeyword */ ? 1 /* Default */ : 0 /* Named */; + var exportInfo = FindAllReferences.getExportInfo(referenceSymbol, exportKind, state.checker); + ts.Debug.assert(!!exportInfo); + searchForImportsOfExport(referenceLocation, referenceSymbol, exportInfo, state); + } + // At `export { x } from "foo"`, also search for the imported symbol `"foo".x`. + if (search.comingFrom !== 1 /* Export */ && exportDeclaration.moduleSpecifier && !propertyName) { + searchForImportedSymbol(state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier), state); + } + function addRef() { + addReference(referenceLocation, localSymbol, search.location, state); + } + } + function getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, checker) { + return isExportSpecifierAlias(referenceLocation, exportSpecifier) ? checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) : referenceSymbol; + } + function isExportSpecifierAlias(referenceLocation, exportSpecifier) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + ts.Debug.assert(propertyName === referenceLocation || name === referenceLocation); + if (propertyName) { + // Given `export { foo as bar } [from "someModule"]`: It's an alias at `foo`, but at `bar` it's a new symbol. + return propertyName === referenceLocation; + } + else { + // `export { foo } from "foo"` is a re-export. + // `export { foo };` is not a re-export, it creates an alias for the local variable `foo`. + return !parent.parent.moduleSpecifier; + } + } + function getImportOrExportReferences(referenceLocation, referenceSymbol, search, state) { + var importOrExport = FindAllReferences.getImportOrExportSymbol(referenceLocation, referenceSymbol, state.checker, search.comingFrom === 1 /* Export */); + if (!importOrExport) + return; + var symbol = importOrExport.symbol; + if (importOrExport.kind === 0 /* Import */) { + if (!state.isForRename || importOrExport.isNamedImport) { + searchForImportedSymbol(symbol, state); } } - /** `classSymbol` is the class where the constructor was defined. - * Reference the constructor and all calls to `new this()`. + else { + // We don't check for `state.isForRename`, even for default exports, because importers that previously matched the export name should be updated to continue matching. + searchForImportsOfExport(referenceLocation, symbol, importOrExport.exportInfo, state); + } + } + function getReferenceForShorthandProperty(_a, search, state) { + var flags = _a.flags, valueDeclaration = _a.valueDeclaration; + var shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration); + /* + * Because in short-hand property assignment, an identifier which stored as name of the short-hand property assignment + * has two meanings: property name and property value. Therefore when we do findAllReference at the position where + * an identifier is declared, the language service should return the position of the variable declaration as well as + * the position in short-hand property assignment excluding property accessing. However, if we do findAllReference at the + * position of property accessing, the referenceEntry of such position will be handled in the first case. */ - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149 /* MethodDeclaration */) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } - }); - return result; + if (!(flags & 134217728 /* Transient */) && search.includes(shorthandValueSymbol)) { + addReference(valueDeclaration.name, shorthandValueSymbol, search.location, state); + } + } + function addReference(referenceLocation, relatedSymbol, searchLocation, state) { + var addRef = state.referenceAdder(relatedSymbol, searchLocation); + if (state.implementations) { + addImplementationReferences(referenceLocation, addRef, state); } - /** Find references to `super` in the constructor of an extending class. */ - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; + else { + addRef(referenceLocation); + } + } + /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ + function findConstructorReferences(referenceLocation, sourceFile, search, state) { + if (ts.isNewExpressionTarget(referenceLocation)) { + addReference(referenceLocation, search.symbol, search.location, state); + } + var pusher = state.referenceAdder(search.symbol, search.location); + if (ts.isClassLike(referenceLocation.parent)) { + ts.Debug.assert(referenceLocation.parent.name === referenceLocation); + // This is the class declaration containing the constructor. + findOwnConstructorReferences(search.symbol, sourceFile, pusher); + } + else { + // If this class appears in `extends C`, then the extending class' "super" calls are references. + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending)) { + findSuperConstructorAccesses(classExtending, pusher); } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + /** + * `classSymbol` is the class where the constructor was defined. + * Reference the constructor and all calls to `new this()`. + */ + function findOwnConstructorReferences(classSymbol, sourceFile, addNode) { + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122 /* ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 151 /* Constructor */ && !!ctrKeyword); + addNode(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150 /* MethodDeclaration */) { var body = decl.body; if (body) { - forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); + forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + addNode(thisKeyword); } }); } } - ; - return result; + }); + } + /** Find references to `super` in the constructor of an extending class. */ + function findSuperConstructorAccesses(cls, addNode) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return; } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151 /* Constructor */); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { + if (ts.isCallExpressionTarget(node)) { + addNode(node); + } }); } - return result[index]; - } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } } } - function getImplementationReferenceEntryForNode(refNode, result) { + function addImplementationReferences(refNode, addReference, state) { // Check if we found a function/propertyAssignment/method with an implementation or initializer if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + addReference(refNode.parent); + return; } - else if (refNode.kind === 70 /* Identifier */) { - if (refNode.parent.kind === 258 /* ShorthandPropertyAssignment */) { - // Go ahead and dereference the shorthand assignment by going to its definition - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - // Check if the node is within an extends or implements clause - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); - } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204 /* Block */) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); - } + if (refNode.kind !== 70 /* Identifier */) { + return; + } + if (refNode.parent.kind === 261 /* ShorthandPropertyAssignment */) { + // Go ahead and dereference the shorthand assignment by going to its definition + getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); + } + // Check if the node is within an extends or implements clause + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + addReference(containingClass); + return; + } + // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference && state.markSeenContainingTypeReference(containingTypeReference)) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + addReference(parent.initializer); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206 /* Block */) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + addReference(returnStatement.expression); + } + }); } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (isImplementationExpression(parent.body)) { + addReference(parent.body); } } - } - // Type nodes can contain multiple references to the same type. For example: - // let x: Foo & (Foo & Bar) = ... - // Because we are returning the implementation locations and not the identifier locations, - // duplicate entries would be returned here as each of the type references is part of - // the same implementation. For that reason, check before we add a new entry - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + addReference(parent.expression); } } } @@ -69830,12 +75694,12 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ - && node.parent.kind === 255 /* HeritageClause */ + if (node.kind === 200 /* ExpressionWithTypeArguments */ + && node.parent.kind === 258 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 70 /* Identifier */ || node.kind === 177 /* PropertyAccessExpression */) { + else if (node.kind === 70 /* Identifier */ || node.kind === 178 /* PropertyAccessExpression */) { return getContainingClassIfInHeritageClause(node.parent); } } @@ -69845,15 +75709,18 @@ var ts; * Returns true if this is an expression that can be considered an implementation */ function isImplementationExpression(node) { - // Unwrap parentheses - if (node.kind === 183 /* ParenthesizedExpression */) { - return isImplementationExpression(node.expression); + switch (node.kind) { + case 184 /* ParenthesizedExpression */: + return isImplementationExpression(node.expression); + case 186 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 177 /* ObjectLiteralExpression */: + case 198 /* ClassExpression */: + case 176 /* ArrayLiteralExpression */: + return true; + default: + return false; } - return node.kind === 185 /* ArrowFunction */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 176 /* ObjectLiteralExpression */ || - node.kind === 197 /* ClassExpression */ || - node.kind === 175 /* ArrayLiteralExpression */; } /** * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol @@ -69874,7 +75741,7 @@ var ts; * @param parent Another class or interface Symbol * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results */ - function explicitlyInheritsFrom(child, parent, cachedResults) { + function explicitlyInheritsFrom(child, parent, cachedResults, checker) { var parentIsInterface = parent.getFlags() & 64 /* Interface */; return searchHierarchy(child); function searchHierarchy(symbol) { @@ -69882,11 +75749,12 @@ var ts; return true; } var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; } // Set the key so that we don't infinitely recurse - cachedResults[key] = false; + cachedResults.set(key, false); var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { if (ts.isClassLike(declaration)) { if (parentIsInterface) { @@ -69902,19 +75770,19 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 229 /* InterfaceDeclaration */) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; }); - cachedResults[key] = inherits; + cachedResults.set(key, inherits); return inherits; } function searchTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type && type.symbol) { return searchHierarchy(type.symbol); } @@ -69930,13 +75798,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -69946,49 +75814,48 @@ var ts; var references = []; var sourceFile = searchSpaceNode.getSourceFile(); var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.kind !== 96 /* SuperKeyword */) { - return; + continue; } var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "symbol", symbol: searchSpaceNode.symbol, node: superKeyword }, references: references }]; } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } - // fall through - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + // falls through + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - // Fall through - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + // falls through + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -69997,8 +75864,9 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261 /* SourceFile */) { + if (searchSpaceNode.kind === 264 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); }); @@ -70008,144 +75876,103 @@ var ts; possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, + definition: { type: "this", node: thisOrSuperKeyword }, references: references }]; function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); if (!node || !ts.isThis(node)) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 261 /* SourceFile */: - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); + case 264 /* SourceFile */: + if (container.kind === 264 /* SourceFile */ && !ts.isExternalModule(container)) { + result.push(FindAllReferences.nodeEntry(node)); } break; } }); } } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - // nothing to do here. moving on - return undefined; - } + function getReferencesForStringLiteral(node, sourceFiles, cancellationToken) { var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; + cancellationToken.throwIfCancellationRequested(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, node.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, node.text, possiblePositions, references); } return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, + definition: { type: "string", node: node }, references: references }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { - return; - } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { + for (var _i = 0, possiblePositions_5 = possiblePositions; _i < possiblePositions_5.length; _i++) { + var position = possiblePositions_5[_i]; + var node_7 = ts.getTouchingWord(sourceFile, position); + if (node_7 && node_7.kind === 9 /* StringLiteral */ && node_7.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_7, /*isInString*/ true)); } } } } - function populateSearchSymbolSet(symbol, location) { + // For certain symbol kinds, we need to include other symbols in the search set. + // This is not needed when searching for re-exports. + function populateSearchSymbolSet(symbol, location, checker, implementations) { // The search set contains at least the current symbol var result = [symbol]; - // If the location is name of property symbol from object literal destructuring pattern - // Search the property symbol - // for ( { property: p2 } of elems) { } - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258 /* ShorthandPropertyAssignment */) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - // If the symbol is an alias, add what it aliases to the list - // import {a} from "mod"; - // export {a} - // If the symbol is an alias to default declaration, add what it aliases to the list - // declare "mod" { export default class B { } } - // import B from "mod"; - //// For export specifiers, the exported name can be referring to a local symbol, e.g.: - //// import {a} from "mod"; - //// export {a as somethingElse} - //// We want the *local* declaration of 'a' as declared in the import, - //// *not* as declared within "mod" (or farther) - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } - // If the location is in a context sensitive location (i.e. in an object literal) try - // to get a contextual type for it, and add the property symbol from the contextual - // type to the search set + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + if (containingObjectLiteralElement.kind !== 261 /* ShorthandPropertyAssignment */) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); + if (propertySymbol) { + result.push(propertySymbol); + } + } + // If the location is in a context sensitive location (i.e. in an object literal) try + // to get a contextual type for it, and add the property symbol from the contextual + // type to the search set + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), function (contextualSymbol) { + ts.addRange(result, checker.getRootSymbols(contextualSymbol)); }); /* Because in short-hand property assignment, location has two meaning : property name and as value of the property - * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of - * property name and variable declaration of the identifier. - * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service - * should show both 'name' in 'obj' and 'name' in variable declaration - * const name = "Foo"; - * const obj = { name }; - * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment - * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration - * will be included correctly. - */ - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of + * property name and variable declaration of the identifier. + * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service + * should show both 'name' in 'obj' and 'name' in variable declaration + * const name = "Foo"; + * const obj = { name }; + * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment + * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration + * will be included correctly. + */ + var shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { result.push(shorthandValueSymbol); } @@ -70154,27 +75981,28 @@ var ts; // we should include both parameter declaration symbol and property declaration symbol // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ && + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 /* Parameter */ && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + ts.addRange(result, checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } // If this is symbol of binding element without propertyName declaration in Object binding pattern // Include the property in the search - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); if (bindingElementPropertySymbol) { result.push(bindingElementPropertySymbol); } // If this is a union property, add all the symbols from all its source symbols in all unioned types. // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + for (var _i = 0, _a = checker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; if (rootSymbol !== symbol) { result.push(rootSymbol); } // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap()); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), checker); } - }); + } return result; } /** @@ -70185,7 +76013,7 @@ var ts; * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. * The value of previousIterationSymbol is undefined when the function is first called. */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { if (!symbol) { return; } @@ -70200,7 +76028,7 @@ var ts; // the function will add any found symbol of the property-name, then its sub-routine will call // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (symbol.name in previousIterationSymbolsCache) { + if (previousIterationSymbolsCache.has(symbol.name)) { return; } if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { @@ -70209,7 +76037,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 229 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -70217,37 +76045,30 @@ var ts; return; function getPropertySymbolFromTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); + result.push.apply(result, checker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); } } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - // If we are searching for constructor uses, they must be 'new' expressions. - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) { + if (search.includes(referenceSymbol)) { + return referenceSymbol; } // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(referenceLocation); if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, state.checker), function (contextualSymbol) { + return ts.find(state.checker.getRootSymbols(contextualSymbol), search.includes); }); if (contextualSymbol) { return contextualSymbol; @@ -70256,23 +76077,23 @@ var ts; // Get the property symbol from the object literal's type and look if thats the search symbol // In below eg. get 'property' from type of elems iterating type // for ( { property: p2 } of elems) { } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, state.checker); + if (propertySymbol && search.includes(propertySymbol)) { return propertySymbol; } } // If the reference location is the binding element and doesn't have property name // then include the binding element in the related symbols // let { a } : { a }; - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, state.checker); + if (bindingElementPropertySymbol && search.includes(bindingElementPropertySymbol)) { return bindingElementPropertySymbol; } // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) // Or a union property, use its underlying unioned symbols - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + return ts.forEach(state.checker.getRootSymbols(referenceSymbol), function (rootSymbol) { // if it is in the list, then we are done - if (searchSymbols.indexOf(rootSymbol) >= 0) { + if (search.includes(rootSymbol)) { return rootSymbol; } // Finally, try all properties with the same name in any type the containing type extended or implemented, and @@ -70280,20 +76101,18 @@ var ts; // parent symbol if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { // Parents will only be defined if implementations is true - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, state.checker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), state.checker); + return ts.find(result, search.includes); } return undefined; }); } function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression)) { @@ -70303,15 +76122,16 @@ var ts; } return node.name.text; } - function getPropertySymbolsFromContextualType(node) { + /** Gets all symbols for one property. Does not get symbols for every property. */ + function getPropertySymbolsFromContextualType(node, checker) { var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); + var contextualType = checker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); + var symbol = contextualType.getProperty(name); + if (symbol) { + result_5.push(symbol); } if (contextualType.flags & 65536 /* Union */) { ts.forEach(contextualType.types, function (t) { @@ -70325,13 +76145,14 @@ var ts; } return undefined; } - /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - * then we need to widen the search to include type positions as well. - * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - * do not intersect in any of the three spaces. - */ + /** + * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations + * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class + * then we need to widen the search to include type positions as well. + * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated + * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) + * do not intersect in any of the three spaces. + */ function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { var lastIterationMeaning = void 0; @@ -70342,8 +76163,8 @@ var ts; // To achieve that we will keep iterating until the result stabilizes. // Remember the last meaning lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; var declarationMeaning = ts.getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -70353,143 +76174,93 @@ var ts; } return meaning; } - } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; - function convertReferences(referenceSymbols) { - if (!referenceSymbols) { - return undefined; - } - var referenceEntries = []; - for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { - var referenceSymbol = referenceSymbols_1[_i]; - ts.addRange(referenceEntries, referenceSymbol.references); - } - return referenceEntries; - } - FindAllReferences.convertReferences = convertReferences; - function isImplementation(node) { - if (!node) { - return false; - } - else if (ts.isVariableLike(node)) { - if (node.initializer) { - return true; - } - else if (node.kind === 223 /* VariableDeclaration */) { - var parentStatement = getParentStatementOfVariableDeclaration(node); - return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); + function isImplementation(node) { + if (!node) { + return false; } - } - else if (ts.isFunctionLike(node)) { - return !!node.body || ts.hasModifier(node, 2 /* Ambient */); - } - else { - switch (node.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + else if (ts.isVariableLike(node)) { + if (node.initializer) { return true; + } + else if (node.kind === 225 /* VariableDeclaration */) { + var parentStatement = getParentStatementOfVariableDeclaration(node); + return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); + } + } + else if (ts.isFunctionLike(node)) { + return !!node.body || ts.hasModifier(node, 2 /* Ambient */); + } + else { + switch (node.kind) { + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + return true; + } } + return false; } - return false; - } - function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205 /* VariableStatement */) { - ts.Debug.assert(node.parent.kind === 224 /* VariableDeclarationList */); - return node.parent.parent; + function getParentStatementOfVariableDeclaration(node) { + if (node.parent && node.parent.parent && node.parent.parent.kind === 207 /* VariableStatement */) { + ts.Debug.assert(node.parent.kind === 226 /* VariableDeclarationList */); + return node.parent.parent; + } } - } - function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) { - var refSymbol = typeChecker.getSymbolAtLocation(node); - var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); - if (shorthandSymbol) { - for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { - var declaration = _a[_i]; - if (ts.getMeaningFromDeclaration(declaration) & 1 /* Value */) { - result.push(getReferenceEntryFromNode(declaration)); + function getReferenceEntriesForShorthandPropertyAssignment(node, checker, addReference) { + var refSymbol = checker.getSymbolAtLocation(node); + var shorthandSymbol = checker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); + if (shorthandSymbol) { + for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.getMeaningFromDeclaration(declaration) & 1 /* Value */) { + addReference(declaration); + } } } } - } - FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; - function getReferenceEntryFromNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - if (node.kind === 9 /* StringLiteral */) { - start += 1; - end -= 1; + Core.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; + function forEachDescendantOfKind(node, kind, action) { + ts.forEachChild(node, function (child) { + if (child.kind === kind) { + action(child); + } + forEachDescendantOfKind(child, kind, action); + }); } - return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - isWriteAccess: isWriteAccess(node), - isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - }; - } - FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode; - /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ - function isWriteAccess(node) { - if (node.kind === 70 /* Identifier */ && ts.isDeclarationName(node)) { - return true; + /** Get `C` given `N` if `N` is in the position `class C extends N` or `class C extends foo.N` where `N` is an identifier. */ + function tryGetClassByExtendingIdentifier(node) { + return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); } - var parent = node.parent; - if (parent) { - if (parent.kind === 191 /* PostfixUnaryExpression */ || parent.kind === 190 /* PrefixUnaryExpression */) { - return true; - } - else if (parent.kind === 192 /* BinaryExpression */ && parent.left === node) { - var operator = parent.operatorToken.kind; - return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */; + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 9 /* StringLiteral */) { + return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } + return false; } - return false; - } - function forEachDescendantOfKind(node, kind, action) { - ts.forEachChild(node, function (child) { - if (child.kind === kind) { - action(child); + /** + * If we are just looking for implementations and this is a property access expression, we need to get the + * symbol of the local type of the symbol the property is being accessed on. This is because our search + * symbol may have a different parent symbol if the local type's symbol does not declare the property + * being accessed (i.e. it is declared in some parent class or interface) + */ + function getParentSymbolsOfPropertyAccess(location, symbol, checker) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); + if (!propertyAccessExpression) { + return undefined; + } + var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); + if (!localParentType) { + return undefined; + } + if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent) { + return [localParentType.symbol]; + } + else if (localParentType.flags & 196608 /* UnionOrIntersection */) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } - forEachDescendantOfKind(child, kind, action); - }); - } - /** - * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } - */ - function getContainingObjectLiteralElement(node) { - switch (node.kind) { - case 9 /* StringLiteral */: - case 8 /* NumericLiteral */: - if (node.parent.kind === 142 /* ComputedPropertyName */) { - return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; - } - // intential fall through - case 70 /* Identifier */: - return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; - } - return undefined; - } - function isObjectLiteralPropertyDeclaration(node) { - switch (node.kind) { - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return true; - } - return false; - } - /** Get `C` given `N` if `N` is in the position `class C extends N` or `class C extends foo.N` where `N` is an identifier. */ - function tryGetClassByExtendingIdentifier(node) { - return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); - } - function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 9 /* StringLiteral */) { - return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } - return false; - } + })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); /* @internal */ @@ -70510,11 +76281,9 @@ var ts; // Type reference directives var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -70524,7 +76293,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -70550,7 +76319,7 @@ var ts; // if (node.kind === 70 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 239 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 238 /* NamedImports */))) { + (declaration.kind === 241 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 240 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -70559,7 +76328,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 261 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -70570,6 +76339,37 @@ var ts; var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } + if (ts.isJsxOpeningLikeElement(node.parent)) { + // If there are errors when trying to figure out stateless component function, just return the first declaration + // For example: + // declare function /*firstSource*/MainButton(buttonProps: ButtonProps): JSX.Element; + // declare function /*secondSource*/MainButton(linkProps: LinkProps): JSX.Element; + // declare function /*thirdSource*/MainButton(props: ButtonProps | LinkProps): JSX.Element; + // let opt =
; // Error - We get undefined for resolved signature indicating an error, then just return the first declaration + var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName; + return [createDefinitionInfo(symbol.valueDeclaration, symbolKind, symbolName, containerName)]; + } + // If the current location we want to find its definition is in an object literal, try to get the contextual type for the + // object literal, lookup the property symbol in the contextual type, and use this for goto-definition. + // For example + // interface Props{ + // /*first*/prop1: number + // prop2: boolean + // } + // function Foo(arg: Props) {} + // Foo( { pr/*1*/op1: 10, prop2: true }) + var element = ts.getContainingObjectLiteralElement(node); + if (element) { + if (typeChecker.getContextualType(element.parent)) { + var result = []; + var propertySymbols = ts.getPropertySymbolsFromContextualType(typeChecker, element); + for (var _i = 0, propertySymbols_1 = propertySymbols; _i < propertySymbols_1.length; _i++) { + var propertySymbol = propertySymbols_1[_i]; + result.push.apply(result, getDefinitionFromSymbol(typeChecker, propertySymbol, node)); + } + return result; + } + } return getDefinitionFromSymbol(typeChecker, symbol, node); } GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition; @@ -70639,31 +76439,47 @@ var ts; return false; } function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + if (!signatureDeclarations) { + return false; + } var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150 /* Constructor */) || - (!selectConstructors && (d.kind === 225 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 /* Constructor */ : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + return true; + default: + return false; + } + } + /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */ function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + /** Creates a DefinitionInfo directly from the name of a declaration. */ + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -70711,43 +76527,17 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; - } - })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); -})(ts || (ts = {})); -/* @internal */ -var ts; -(function (ts) { - var GoToImplementation; - (function (GoToImplementation) { - function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - // If invoked directly on a shorthand property assignment, then return - // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { - var result = []; - ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); - return result.length > 0 ? result : undefined; - } - else if (node.kind === 96 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) { - // References to and accesses on the super keyword only have one possible implementation, so no - // need to "Find all References" - var symbol = typeChecker.getSymbolAtLocation(node); - return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)]; - } - else { - // Perform "Find all References" and retrieve only those that are implementations - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ true); - var result = ts.flatMap(referencedSymbols, function (symbol) { - return ts.map(symbol.references, function (_a) { - var textSpan = _a.textSpan, fileName = _a.fileName; - return ({ textSpan: textSpan, fileName: fileName }); - }); - }); - return result && result.length > 0 ? result : undefined; + var signature = callLike && typeChecker.getResolvedSignature(callLike); + if (signature) { + var decl = signature.declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } } + // Don't go to a function type, go to the value having that type. + return undefined; } - GoToImplementation.getImplementationAtPosition = getImplementationAtPosition; - })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {})); + })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); /* @internal */ var ts; @@ -70777,6 +76567,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -70795,7 +76586,8 @@ var ts; "prop", "version" ]; - var jsDocCompletionEntries; + var jsDocTagNameCompletionEntries; + var jsDocTagCompletionEntries; function getJsDocCommentsFromDeclarations(declarations) { // Only collect doc comments from duplicate declarations once: // In case of a union property there might be same declaration multiple times @@ -70822,6 +76614,30 @@ var ts; return documentationComment; } JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; + function getJsDocTagsFromDeclarations(declarations) { + // Only collect doc comments from duplicate declarations once. + var tags = []; + forEachUnique(declarations, function (declaration) { + var jsDocs = ts.getJSDocs(declaration); + if (!jsDocs) { + return; + } + for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) { + var doc = jsDocs_1[_i]; + var tagsForDoc = doc.tags; + if (tagsForDoc) { + tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 283 /* JSDocTag */; }).map(function (jsDocTag) { + return { + name: jsDocTag.tagName.text, + text: jsDocTag.comment + }; + })); + } + } + }); + return tags; + } + JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations; /** * Iterates through 'array' by index and performs the callback on each element of array until the callback * returns a truthy value, then returns that value. @@ -70829,7 +76645,7 @@ var ts; */ function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -70840,8 +76656,8 @@ var ts; } return undefined; } - function getAllJsDocCompletionEntries() { - return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + function getJSDocTagNameCompletions() { + return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: tagName, kind: ts.ScriptElementKind.keyword, @@ -70850,7 +76666,18 @@ var ts; }; })); } - JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries; + JsDoc.getJSDocTagNameCompletions = getJSDocTagNameCompletions; + function getJSDocTagCompletions() { + return jsDocTagCompletionEntries || (jsDocTagCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + return { + name: "@" + tagName, + kind: ts.ScriptElementKind.keyword, + kindModifiers: "", + sortText: "0" + }; + })); + } + JsDoc.getJSDocTagCompletions = getJSDocTagCompletions; /** * Checks if position points to a valid position to add JSDoc comments, and if so, * returns the appropriate template. Otherwise returns an empty string. @@ -70889,19 +76716,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: - case 226 /* ClassDeclaration */: - case 205 /* VariableStatement */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: + case 228 /* ClassDeclaration */: + case 207 /* VariableStatement */: break findOwner; - case 261 /* SourceFile */: + case 264 /* SourceFile */: return undefined; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 230 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 232 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -70913,14 +76740,21 @@ var ts; var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; - var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + // replace non-whitespace characters in prefix with spaces. + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character).replace(/\S/i, function () { return " "; }); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 /* Identifier */ ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } // A doc comment consists of the following // * The opening comment line @@ -70942,7 +76776,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205 /* VariableStatement */) { + if (commentOwner.kind === 207 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -70960,17 +76794,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 184 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return rightHandSide.parameters; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { return member.parameters; } } @@ -70990,8 +76824,6 @@ var ts; (function (ts) { var JsTyping; (function (JsTyping) { - ; - ; // A map of loose file names to library names // that we are confident require typings var safeList; @@ -71028,7 +76860,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; // Directories to search for package.json, bower.json and other typing information @@ -71047,41 +76879,43 @@ var ts; getTypingNamesFromJson(packageJsonPath, filesToWatch); var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var bowerComponentsPath = ts.combinePaths(searchDir, "bower_components"); + getTypingNamesFromPackagesFolder(bowerComponentsPath); var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromNodeModuleFolder(nodeModulesPath); + getTypingNamesFromPackagesFolder(nodeModulesPath); } getTypingNamesFromSourceFileNames(fileNames); // add typings for unresolved imports if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } // Add the cached typing locations for inferred typings that are already installed - for (var name_45 in packageNameToTypingLocation) { - if (name_45 in inferredTypings && !inferredTypings[name_45]) { - inferredTypings[name_45] = packageNameToTypingLocation[name_45]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); // Remove typings that the user has added to the exclude list for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; /** * Merge a given list of typingNames to the inferredTypings map @@ -71092,8 +76926,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -71132,7 +76966,7 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2 /* JSX */; }); if (hasJsxFile) { @@ -71140,20 +76974,22 @@ var ts; } } /** - * Infer typing names from node_module folder - * @param nodeModulesPath is the path to the "node_modules" folder + * Infer typing names from packages folder (ex: node_module, bower_components) + * @param packagesFolderPath is the path to the packages folder */ - function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + function getTypingNamesFromPackagesFolder(packagesFolderPath) { + filesToWatch.push(packagesFolderPath); // Todo: add support for ModuleResolutionHost too - if (!host.directoryExists(nodeModulesPath)) { + if (!host.directoryExists(packagesFolderPath)) { return; } var typingNames = []; - var fileNames = host.readDirectory(nodeModulesPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); + var fileNames = host.readDirectory(packagesFolderPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { var fileName = fileNames_2[_i]; var normalizedFileName = ts.normalizePath(fileName); - if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + var baseFileName = ts.getBaseFileName(normalizedFileName); + if (baseFileName !== "package.json" && baseFileName !== "bower.json") { continue; } var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); @@ -71164,7 +77000,7 @@ var ts; // npm 3's package.json contains a "_requiredBy" field // we should include all the top level module names for npm 2, and only module names whose // "_requiredBy" field starts with "#" or equals "/" for npm 3. - if (packageJson._requiredBy && + if (baseFileName === "package.json" && packageJson._requiredBy && ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { continue; } @@ -71175,7 +77011,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -71195,47 +77031,49 @@ var ts; function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_46 in nameToDeclarations) { - var declarations = nameToDeclarations[name_46]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; // continue to next named declarations } - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) { + var declaration = declarations_12[_i]; // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; // Break out of named declarations and go to the next source file. } - matches = patternMatcher.getMatches(containers, name_46); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; // continue to next named declarations } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; + _loop_4(sourceFile); + } // Remove imports when the imported declaration is already in the list and has the same name. rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 /* ImportClause */ || decl.kind === 239 /* ImportSpecifier */ || decl.kind === 234 /* ImportEqualsDeclaration */) { + if (decl.kind === 238 /* ImportClause */ || decl.kind === 241 /* ImportSpecifier */ || decl.kind === 236 /* ImportEqualsDeclaration */) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -71277,7 +77115,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142 /* ComputedPropertyName */) { + else if (declaration.name.kind === 143 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { @@ -71298,7 +77136,7 @@ var ts; } return true; } - if (expression.kind === 177 /* PropertyAccessExpression */) { + if (expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -71311,7 +77149,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } @@ -71357,7 +77195,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), // TODO(jfreeman): What should be the containerName when the container has a computed name? containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" @@ -71373,22 +77211,61 @@ var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { - function getNavigationBarItems(sourceFile) { + /** + * Matches all whitespace characters in a string. Eg: + * + * "app. + * + * onactivated" + * + * matches because of the newline, whereas + * + * "app.onactivated" + * + * does not match. + */ + var whiteSpaceRegex = /\s+/g; + // Keep sourceFile handy so we don't have to search for it every time we need to call `getText`. + var curCancellationToken; + var curSourceFile; + /** + * For performance, we keep navigation bar parents on a stack rather than passing them through each recursion. + * `parent` is the current parent and is *not* stored in parentsStack. + * `startNode` sets a new parent and `endNode` returns to the previous parent. + */ + var parentsStack = []; + var parent; + // NavigationBarItem requires an array, but will not mutate it, so just give it this for performance. + var emptyChildItemArray = []; + function getNavigationBarItems(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); - curSourceFile = undefined; - return result; + try { + return ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); + } + finally { + reset(); + } } NavigationBar.getNavigationBarItems = getNavigationBarItems; - function getNavigationTree(sourceFile) { + function getNavigationTree(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = convertToTree(rootNavigationBarNode(sourceFile)); - curSourceFile = undefined; - return result; + try { + return convertToTree(rootNavigationBarNode(sourceFile)); + } + finally { + reset(); + } } NavigationBar.getNavigationTree = getNavigationTree; - // Keep sourceFile handy so we don't have to search for it every time we need to call `getText`. - var curSourceFile; + function reset() { + curSourceFile = undefined; + curCancellationToken = undefined; + parentsStack = []; + parent = undefined; + emptyChildItemArray = []; + } function nodeText(node) { return node.getText(curSourceFile); } @@ -71403,13 +77280,6 @@ var ts; parent.children = [child]; } } - /* - For performance, we keep navigation bar parents on a stack rather than passing them through each recursion. - `parent` is the current parent and is *not* stored in parentsStack. - `startNode` sets a new parent and `endNode` returns to the previous parent. - */ - var parentsStack = []; - var parent; function rootNavigationBarNode(sourceFile) { ts.Debug.assert(!parentsStack.length); var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 }; @@ -71460,11 +77330,12 @@ var ts; } /** Look for navigation bar items in node's subtree, adding them to the current `parent`. */ function addChildrenRecursively(node) { + curCancellationToken.throwIfCancellationRequested(); if (!node || ts.isToken(node)) { return; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -71476,21 +77347,21 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 149 /* MethodSignature */: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 236 /* ImportClause */: + case 238 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -71502,7 +77373,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -71513,12 +77384,12 @@ var ts; } } break; - case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: var decl = node; - var name_47 = decl.name; - if (ts.isBindingPattern(name_47)) { - addChildrenRecursively(name_47); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -71528,12 +77399,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -71543,9 +77414,9 @@ var ts; } endNode(); break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -71553,21 +77424,21 @@ var ts; } endNode(); break; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243 /* ExportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 155 /* IndexSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 228 /* TypeAliasDeclaration */: + case 245 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 156 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 230 /* TypeAliasDeclaration */: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285 /* JSDocTypedefTag */) { + if (tag.kind === 289 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -71585,9 +77456,9 @@ var ts; // Anonymous items are never merged. return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -71605,7 +77476,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -71618,14 +77489,14 @@ var ts; }); /** a and b have the same name, but they may not be mergeable. */ function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 /* ModuleDeclaration */ || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 /* ModuleDeclaration */ || areSameModule(a, b)); // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230 /* ModuleDeclaration */) { + if (a.body.kind !== 232 /* ModuleDeclaration */) { return true; } return areSameModule(a.body, b.body); @@ -71653,39 +77524,20 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - // This isn't perfect, but it passes all of our tests. - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; /** * This differs from getItemName because this is just used for sorting. * We only sort nodes by name that have a more-or-less "direct" name, as opposed to `new()` and the like. * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var decl = node; @@ -71693,18 +77545,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: return getFunctionOrClassName(node); - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var name = node.name; @@ -71715,16 +77567,16 @@ var ts; } } switch (node.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -71732,15 +77584,15 @@ var ts; // (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the // navigation bar. return getFunctionOrClassName(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return "constructor"; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return "new()"; - case 153 /* CallSignature */: + case 154 /* CallSignature */: return "()"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "[]"; - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -71752,7 +77604,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -71781,24 +77633,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: - case 228 /* TypeAliasDeclaration */: - case 285 /* JSDocTypedefTag */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 264 /* SourceFile */: + case 230 /* TypeAliasDeclaration */: + case 289 /* JSDocTypedefTag */: return true; - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 223 /* VariableDeclaration */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 225 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -71808,10 +77660,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: + case 233 /* ModuleBlock */: + case 264 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: return true; default: return hasSomeImportantChild(item); @@ -71820,18 +77672,16 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; + return childKind !== 225 /* VariableDeclaration */ && childKind !== 175 /* BindingElement */; }); } } } - // NavigationBarItem requires an array, but will not mutate it, so just give it this for performance. - var emptyChildItemArray = []; function convertToTree(n) { return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -71840,7 +77690,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -71878,7 +77728,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -71889,28 +77739,34 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 230 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142 /* ComputedPropertyName */; + return !member.name || member.name.kind === 143 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 261 /* SourceFile */ + return node.kind === 264 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225 /* VariableDeclaration */) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223 /* VariableDeclaration */) { + else if (node.parent.kind === 225 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 /* BinaryExpression */ && + else if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 260 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -71921,22 +77777,8 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */ || node.kind === 197 /* ClassExpression */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */ || node.kind === 198 /* ClassExpression */; } - /** - * Matches all whitespace characters in a string. Eg: - * - * "app. - * - * onactivated" - * - * matches because of the newline, whereas - * - * "app.onactivated" - * - * does not match. - */ - var whiteSpaceRegex = /\s+/g; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); /* @internal */ @@ -71944,29 +77786,29 @@ var ts; (function (ts) { var OutliningElementsCollector; (function (OutliningElementsCollector) { - function collectElements(sourceFile) { + function collectElements(sourceFile, cancellationToken) { var elements = []; var collapseText = "..."; function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { if (hintSpanNode && startElement && endElement) { - var span_12 = { + var span_13 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_12); + elements.push(span_13); } } function addOutliningSpanComments(commentSpan, autoCollapse) { if (commentSpan) { - var span_13 = { + var span_14 = { textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_13); + elements.push(span_14); } } function addOutliningForLeadingCommentsForNode(n) { @@ -71978,6 +77820,7 @@ var ts; var singleLineCommentCount = 0; for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) { var currentComment = comments_4[_i]; + cancellationToken.throwIfCancellationRequested(); // For single line comments, combine consecutive ones (2 or more) into // a single span from the start of the first till the end of the last if (currentComment.kind === 2 /* SingleLineCommentTrivia */) { @@ -72003,19 +77846,20 @@ var ts; // Only outline spans of two or more consecutive single line comments if (count > 1) { var multipleSingleLineComments = { + kind: 2 /* SingleLineCommentTrivia */, pos: start, end: end, - kind: 2 /* SingleLineCommentTrivia */ }; addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false); } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 186 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; function walk(n) { + cancellationToken.throwIfCancellationRequested(); if (depth > maxDepth) { return; } @@ -72023,30 +77867,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204 /* Block */: + case 206 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_19.kind === 209 /* DoStatement */ || - parent_19.kind === 212 /* ForInStatement */ || - parent_19.kind === 213 /* ForOfStatement */ || - parent_19.kind === 211 /* ForStatement */ || - parent_19.kind === 208 /* IfStatement */ || - parent_19.kind === 210 /* WhileStatement */ || - parent_19.kind === 217 /* WithStatement */ || - parent_19.kind === 256 /* CatchClause */) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 /* DoStatement */ || + parent.kind === 214 /* ForInStatement */ || + parent.kind === 215 /* ForOfStatement */ || + parent.kind === 213 /* ForStatement */ || + parent.kind === 210 /* IfStatement */ || + parent.kind === 212 /* WhileStatement */ || + parent.kind === 219 /* WithStatement */ || + parent.kind === 259 /* CatchClause */) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221 /* TryStatement */) { + if (parent.kind === 223 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_19; + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -72056,36 +77900,37 @@ var ts; break; } } + // fall through. } // Block was a standalone block. In this case we want to only collapse // the span of the block, independent of any parent span. - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_15 = ts.createTextSpanFromNode(n); elements.push({ - textSpan: span_14, - hintSpan: span_14, + textSpan: span_15, + hintSpan: span_15, bannerText: collapseText, autoCollapse: autoCollapse(n) }); break; } - // Fallthrough. - case 231 /* ModuleBlock */: { + // falls through + case 233 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 232 /* CaseBlock */: { + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 234 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -72181,10 +78026,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -72212,10 +78058,10 @@ var ts; // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). var wordSpans = getWordSpans(candidate); for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span_15 = wordSpans_1[_i]; - if (partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ true)) { + var span_16 = wordSpans_1[_i]; + if (partStartsWith(candidate, span_16, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ false)); + /*isCaseSensitive:*/ partStartsWith(candidate, span_16, chunk.text, /*ignoreCase:*/ false)); } } } @@ -72465,7 +78311,8 @@ var ts; } // Assumes 'value' is already lowercase. function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -72474,7 +78321,7 @@ var ts; } // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -72546,7 +78393,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -72758,7 +78605,7 @@ var ts; else { if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; @@ -72789,7 +78636,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; @@ -72805,7 +78652,7 @@ var ts; token = nextToken(); if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" @@ -72835,7 +78682,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; @@ -72847,7 +78694,7 @@ var ts; } else if (token === 38 /* AsteriskToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" @@ -72999,93 +78846,89 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); - if (node) { - if (node.kind === 70 /* Identifier */ || - node.kind === 9 /* StringLiteral */ || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9 /* StringLiteral */) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + // Cannot rename `default` as in `import { default as foo } from "./someModule"; + if (node.kind === 70 /* Identifier */ && + node.originalKeywordKind === 78 /* DefaultKeyword */ && + symbol.parent.flags & 1536 /* Module */) { + return undefined; } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9 /* StringLiteral */) { - // Exclude the quotes - start += 1; - width -= 2; + else if (node.kind === 9 /* StringLiteral */) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } - return ts.createTextSpan(start, width); + var displayName = ts.stripQuotes(node.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9 /* StringLiteral */) { + // Exclude the quotes + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); /// @@ -73140,7 +78983,7 @@ var ts; // stack++; // break; // case TypeScript.SyntaxKind.CommaToken: - // if (stack == 0) { + // if (stack === 0) { // argumentIndex++; // } // break; @@ -73232,6 +79075,7 @@ var ts; ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; + ArgumentListKind[ArgumentListKind["JSXAttributesArguments"] = 3] = "JSXAttributesArguments"; })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {})); function getSignatureHelpItems(program, sourceFile, position, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -73263,7 +79107,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 180 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -73271,7 +79115,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 70 /* Identifier */ ? expression - : expression.kind === 177 /* PropertyAccessExpression */ + : expression.kind === 178 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -73281,10 +79125,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { - for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { - var declaration = declarations_10[_b]; + for (var _b = 0, declarations_13 = declarations; _b < declarations_13.length; _b++) { + var declaration = declarations_13[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -73304,21 +79148,21 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 180 /* CallExpression */ || node.parent.kind === 181 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: - // 1. The token introduces a list, and should begin a sig help session + // 1. The token introduces a list, and should begin a signature help session // 2. The token is either not associated with a list, or ends a list, so the session should end - // 3. The token is buried inside a list, and should give sig help + // 3. The token is buried inside a list, and should give signature help // // The following are examples of each: // // Case 1: - // foo<#T, U>(#a, b) -> The token introduces a list, and should begin a sig help session + // foo<#T, U>(#a, b) -> The token introduces a list, and should begin a signature help session // Case 2: // fo#o#(a, b)# -> The token is either not associated with a list, or ends a list, so the session should end // Case 3: - // foo(a#, #b#) -> The token is buried inside a list, and should give sig help + // foo(a#, #b#) -> The token is buried inside a list, and should give signature help // Find out if 'node' is an argument, a type argument, or neither if (node.kind === 26 /* LessThanToken */ || node.kind === 18 /* OpenParenToken */) { @@ -73337,7 +79181,7 @@ var ts; } // findListItemInfo can return undefined if we are not in parent's argument list // or type argument list. This includes cases where the cursor is: - // - To the right of the closing paren, non-substitution template, or template tail. + // - To the right of the closing parenthesis, non-substitution template, or template tail. // - Between the type arguments and the arguments (greater than token) // - On the target of the call (parent.func) // - On the 'new' keyword in a 'new' expression @@ -73358,25 +79202,25 @@ var ts; } return undefined; } - else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 182 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 204 /* TemplateSpan */ && node.parent.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -73385,8 +79229,25 @@ var ts; var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position); return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } + else if (node.parent && ts.isJsxOpeningLikeElement(node.parent)) { + // Provide a signature help for JSX opening element or JSX self-closing element. + // This is not guarantee that JSX tag-name is resolved into stateless function component. (that is done in "getSignatureHelpItems") + // i.e + // export function MainButton(props: ButtonProps, context: any): JSX.Element { ... } + // ' '' - // That will give us 2 non-commas. We then add one for the last comma, givin us an + // That will give us 2 non-commas. We then add one for the last comma, giving us an // arg count of 3. var listChildren = argumentsList.getChildren(); var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 25 /* CommaToken */; }); @@ -73494,7 +79355,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -73503,7 +79364,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 264 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -73516,6 +79377,7 @@ var ts; if (argumentInfo) { return argumentInfo; } + // TODO: Handle generic call with incomplete syntax } return undefined; } @@ -73596,7 +79458,8 @@ var ts; suffixDisplayParts: suffixDisplayParts, separatorDisplayParts: [ts.punctuationPart(25 /* CommaToken */), ts.spacePart()], parameters: signatureHelpParameters, - documentation: candidateSignature.getDocumentationComment() + documentation: candidateSignature.getDocumentationComment(), + tags: candidateSignature.getJsDocTags() }; }); var argumentIndex = argumentListInfo.argumentIndex; @@ -73646,9 +79509,9 @@ var ts; (function (SymbolDisplay) { // TODO(drosen): use contextual SemanticMeaning. function getSymbolKind(typeChecker, symbol, location) { - var flags = symbol.getFlags(); + var flags = symbol.flags; if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 198 /* ClassExpression */) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ts.ScriptElementKind.enumElement; @@ -73658,12 +79521,12 @@ var ts; return ts.ScriptElementKind.interfaceElement; if (flags & 262144 /* TypeParameter */) return ts.ScriptElementKind.typeParameterElement; - var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location); + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); if (result === ts.ScriptElementKind.unknown) { if (flags & 262144 /* TypeParameter */) return ts.ScriptElementKind.typeParameterElement; if (flags & 8 /* EnumMember */) - return ts.ScriptElementKind.variableElement; + return ts.ScriptElementKind.enumMemberElement; if (flags & 8388608 /* Alias */) return ts.ScriptElementKind.alias; if (flags & 1536 /* Module */) @@ -73672,7 +79535,7 @@ var ts; return result; } SymbolDisplay.getSymbolKind = getSymbolKind; - function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) { + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) { if (typeChecker.isUndefinedSymbol(symbol)) { return ts.ScriptElementKind.variableElement; } @@ -73682,6 +79545,7 @@ var ts; if (location.kind === 98 /* ThisKeyword */ && ts.isExpression(location)) { return ts.ScriptElementKind.parameterElement; } + var flags = symbol.flags; if (flags & 3 /* Variable */) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ts.ScriptElementKind.parameterElement; @@ -73705,7 +79569,7 @@ var ts; if (flags & 16384 /* Constructor */) return ts.ScriptElementKind.constructorImplementationElement; if (flags & 4 /* Property */) { - if (flags & 268435456 /* SyntheticProperty */) { + if (flags & 134217728 /* Transient */ && symbol.checkFlags & 6 /* Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); @@ -73725,6 +79589,9 @@ var ts; } return unionPropertyKind; } + if (location.parent && ts.isJsxAttribute(location.parent)) { + return ts.ScriptElementKind.jsxAttribute; + } return ts.ScriptElementKind.memberVariableElement; } return ts.ScriptElementKind.unknown; @@ -73740,8 +79607,9 @@ var ts; if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); } var displayParts = []; var documentation; + var tags; var symbolFlags = symbol.flags; - var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location); + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); var hasAddedSymbolInfo; var isThisExpression = location.kind === 98 /* ThisKeyword */ && ts.isExpression(location); var type; @@ -73754,7 +79622,7 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 178 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -73762,21 +79630,24 @@ var ts; } } // try get the call/construct signature from the type if it matches - var callExpression = void 0; - if (location.kind === 179 /* CallExpression */ || location.kind === 180 /* NewExpression */) { - callExpression = location; + var callExpressionLike = void 0; + if (location.kind === 180 /* CallExpression */ || location.kind === 181 /* NewExpression */) { + callExpressionLike = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { - callExpression = location.parent; + callExpressionLike = location.parent; + } + else if (location.parent && ts.isJsxOpeningLikeElement(location.parent) && ts.isFunctionLike(symbol.valueDeclaration)) { + callExpressionLike = location.parent; } - if (callExpression) { + if (callExpressionLike) { var candidateSignatures = []; - signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures); + signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); if (!signature && candidateSignatures.length) { // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */; + var useConstructSignatures = callExpressionLike.kind === 181 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 96 /* SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -73803,6 +79674,7 @@ var ts; addPrefixForAnyFunctionOrVar(symbol, symbolKind); } switch (symbolKind) { + case ts.ScriptElementKind.jsxAttribute: case ts.ScriptElementKind.memberVariableElement: case ts.ScriptElementKind.variableElement: case ts.ScriptElementKind.constElement: @@ -73829,24 +79701,24 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) { + (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 151 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150 /* Constructor */) { + if (functionDeclaration.kind === 151 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -73855,7 +79727,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 198 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -73878,7 +79750,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -73899,7 +79771,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 232 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -73920,28 +79792,28 @@ var ts; } else { // Method/function type parameter - var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */); + var declaration = ts.getDeclarationOfKind(symbol, 144 /* TypeParameter */); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154 /* ConstructSignature */) { + if (declaration.kind === 155 /* ConstructSignature */) { displayParts.push(ts.keywordPart(93 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) { + else if (declaration.kind !== 154 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 228 /* TypeAliasDeclaration */) { + else if (declaration.kind === 230 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -73950,9 +79822,10 @@ var ts; } } if (symbolFlags & 8 /* EnumMember */) { + symbolKind = ts.ScriptElementKind.enumMemberElement; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260 /* EnumMember */) { + if (declaration.kind === 263 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -73964,7 +79837,7 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233 /* NamespaceExportDeclaration */) { + if (symbol.declarations[0].kind === 235 /* NamespaceExportDeclaration */) { displayParts.push(ts.keywordPart(83 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */)); @@ -73975,7 +79848,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234 /* ImportEqualsDeclaration */) { + if (declaration.kind === 236 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -74011,6 +79884,7 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === ts.ScriptElementKind.memberVariableElement || + symbolKind === ts.ScriptElementKind.jsxAttribute || symbolFlags & 3 /* Variable */ || symbolKind === ts.ScriptElementKind.localVariableElement || isThisExpression) { @@ -74044,14 +79918,15 @@ var ts; } if (!documentation) { documentation = symbol.getDocumentationComment(); + tags = symbol.getJsDocTags(); if (documentation.length === 0 && symbol.flags & 4 /* Property */) { - // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` + // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 264 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 193 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -74059,6 +79934,7 @@ var ts; continue; } documentation = rhsSymbol.getDocumentationComment(); + tags = rhsSymbol.getJsDocTags(); if (documentation.length > 0) { break; } @@ -74066,7 +79942,7 @@ var ts; } } } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -74117,6 +79993,7 @@ var ts; displayParts.push(ts.punctuationPart(19 /* CloseParenToken */)); } documentation = signature.getDocumentationComment(); + tags = signature.getJsDocTags(); } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { @@ -74132,16 +80009,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 184 /* FunctionExpression */) { + if (declaration.kind === 185 /* FunctionExpression */) { return true; } - if (declaration.kind !== 223 /* VariableDeclaration */ && declaration.kind !== 225 /* FunctionDeclaration */) { + if (declaration.kind !== 225 /* VariableDeclaration */ && declaration.kind !== 227 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) { + if (parent.kind === 264 /* SourceFile */ || parent.kind === 233 /* ModuleBlock */) { return false; } } @@ -74194,7 +80071,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); // Output @@ -74246,13 +80123,14 @@ var ts; ts.transpile = transpile; var commandLineOptionsStringToEnum; /** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */ + /*@internal*/ function fixupCompilerOptions(options, diagnostics) { // Lazily create this value to fix module loading errors. commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -74263,7 +80141,7 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { // Supplied value isn't a valid enum value. diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } @@ -74271,10 +80149,11 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_5(opt); } return options; } + ts.fixupCompilerOptions = fixupCompilerOptions; })(ts || (ts = {})); /// /// @@ -74298,10 +80177,10 @@ var ts; ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText"; })(ScanAction || (ScanAction = {})); - function getFormattingScanner(sourceFile, startPos, endPos) { + function getFormattingScanner(text, languageVariant, startPos, endPos) { ts.Debug.assert(scanner === undefined, "Scanner should be undefined"); - scanner = sourceFile.languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; - scanner.setText(sourceFile.text); + scanner = languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; + scanner.setText(text); scanner.setTextPos(startPos); var wasNewLine = true; var leadingTrivia; @@ -74379,10 +80258,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 250 /* JsxAttribute */: - case 248 /* JsxOpeningElement */: - case 249 /* JsxClosingElement */: - case 247 /* JsxSelfClosingElement */: + case 252 /* JsxAttribute */: + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: return node.kind === 70 /* Identifier */; } } @@ -74503,8 +80382,8 @@ var ts; } function isOnToken() { ts.Debug.assert(scanner !== undefined); - var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken(); + var startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos(); return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current); } // when containing node in the tree is token @@ -74794,11 +80673,11 @@ var ts; this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 141 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space for dot this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -74815,10 +80694,10 @@ var ts; this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 80 /* DoKeyword */, 101 /* TryKeyword */, 86 /* FinallyKeyword */, 81 /* ElseKeyword */]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); @@ -74848,6 +80727,7 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109 /* LetKeyword */, 75 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95 /* ReturnKeyword */, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -74858,18 +80738,19 @@ var ts; this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 134 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 134 /* SetKeyword */, 114 /* StaticKeyword */, 137 /* TypeKeyword */, 139 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 139 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions @@ -74889,7 +80770,7 @@ var ts; // decorators this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 134 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); @@ -74905,6 +80786,8 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* SlashToken */, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57 /* EqualsToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57 /* EqualsToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + // No space before non-null assertion operator + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50 /* ExclamationToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -74935,7 +80818,7 @@ var ts; this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -74950,6 +80833,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; // These rules are lower in priority than user-configurable rules. this.LowPriorityCommonRules = [ @@ -74959,7 +80843,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; /// @@ -75017,9 +80900,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_48 in o) { - if (o[name_48] === rule) { - return name_48; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); @@ -75028,42 +80911,44 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 211 /* ForStatement */; + return context.contextNode.kind === 213 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 200 /* AsExpression */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: - case 156 /* TypePredicate */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 201 /* AsExpression */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 157 /* TypePredicate */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 174 /* BindingElement */: + case 175 /* BindingElement */: // equals in type X = ... - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: // equal in p = 0; - case 144 /* Parameter */: - case 260 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 263 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: + // "in" keyword in [P in keyof T]: T[P] + case 144 /* TypeParameter */: return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 213 /* ForOfStatement */: - return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */; + case 215 /* ForOfStatement */: + return context.currentTokenSpan.kind === 141 /* OfKeyword */ || context.nextTokenSpan.kind === 141 /* OfKeyword */; } return false; }; @@ -75071,7 +80956,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193 /* ConditionalExpression */; + return context.contextNode.kind === 194 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -75092,6 +80977,9 @@ var ts; //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 173 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); + }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -75115,97 +81003,103 @@ var ts; return true; } switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: - case 176 /* ObjectLiteralExpression */: - case 231 /* ModuleBlock */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 177 /* ObjectLiteralExpression */: + case 233 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // case SyntaxKind.MethodSignature: - case 153 /* CallSignature */: - case 184 /* FunctionExpression */: - case 150 /* Constructor */: - case 185 /* ArrowFunction */: + case 154 /* CallSignature */: + case 185 /* FunctionExpression */: + case 151 /* Constructor */: + case 186 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; + return context.contextNode.kind === 227 /* FunctionDeclaration */ || context.contextNode.kind === 185 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 161 /* TypeLiteral */: - case 230 /* ModuleDeclaration */: - case 241 /* ExportDeclaration */: - case 242 /* NamedExports */: - case 235 /* ImportDeclaration */: - case 238 /* NamedImports */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 162 /* TypeLiteral */: + case 232 /* ModuleDeclaration */: + case 243 /* ExportDeclaration */: + case 244 /* NamedExports */: + case 237 /* ImportDeclaration */: + case 240 /* NamedImports */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226 /* ClassDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 204 /* Block */: - case 256 /* CatchClause */: - case 231 /* ModuleBlock */: - case 218 /* SwitchStatement */: + case 228 /* ClassDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 259 /* CatchClause */: + case 233 /* ModuleBlock */: + case 220 /* SwitchStatement */: return true; + case 206 /* Block */: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 186 /* ArrowFunction */ && + blockParent.kind !== 185 /* FunctionExpression */) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208 /* IfStatement */: - case 218 /* SwitchStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 221 /* TryStatement */: - case 209 /* DoStatement */: - case 217 /* WithStatement */: + case 210 /* IfStatement */: + case 220 /* SwitchStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: + case 223 /* TryStatement */: + case 211 /* DoStatement */: + case 219 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 256 /* CatchClause */: + case 259 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176 /* ObjectLiteralExpression */; + return context.contextNode.kind === 177 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179 /* CallExpression */; + return context.contextNode.kind === 180 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180 /* NewExpression */; + return context.contextNode.kind === 181 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -75217,25 +81111,25 @@ var ts; return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185 /* ArrowFunction */; + return context.contextNode.kind === 186 /* ArrowFunction */; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246 /* JsxElement */; + return context.contextNode.kind !== 248 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252 /* JsxExpression */; + return context.contextNode.kind === 255 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250 /* JsxAttribute */; + return context.nextTokenParent.kind === 252 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250 /* JsxAttribute */; + return context.contextNode.kind === 252 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247 /* JsxSelfClosingElement */; + return context.contextNode.kind === 249 /* JsxSelfClosingElement */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -75250,41 +81144,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 226 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230 /* ModuleDeclaration */; + return context.contextNode.kind === 232 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 162 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 157 /* TypeReference */: - case 182 /* TypeAssertionExpression */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 158 /* TypeReference */: + case 183 /* TypeAssertionExpression */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -75295,13 +81190,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182 /* TypeAssertionExpression */; + return context.contextNode.kind === 183 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 188 /* VoidExpression */; + return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 189 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 /* YieldExpression */ && context.contextNode.expression !== undefined; + }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 202 /* NonNullExpression */; }; return Rules; }()); @@ -75325,7 +81223,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 /* LastToken */ + 1; + this.mapRowLength = 141 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); // new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); // new Array(this.map.length); @@ -75339,7 +81237,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 /* LastKeyword */ && column <= 141 /* LastKeyword */, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -75520,7 +81418,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 141 /* LastToken */; token++) { result.push(token); } return result; @@ -75564,9 +81462,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 141 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 141 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); @@ -75574,7 +81472,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 135 /* StringKeyword */, 121 /* BooleanKeyword */, 136 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -75610,6 +81508,9 @@ var ts; RulesProvider.prototype.getRulesMap = function () { return this.rulesMap; }; + RulesProvider.prototype.getFormatOptions = function () { + return this.options; + }; RulesProvider.prototype.ensureUpToDate = function (options) { if (!this.options || !ts.compareDataObjects(this.options, options)) { var activeRules = this.createActiveRules(options); @@ -75621,6 +81522,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -75701,6 +81608,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -75833,17 +81746,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 231 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 261 /* SourceFile */: - case 204 /* Block */: - case 231 /* ModuleBlock */: + return body && body.kind === 233 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 264 /* SourceFile */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -75863,9 +81776,9 @@ var ts; } } /** formatting is not applied to ranges that contain parse errors. - * This function will return a predicate that for a given text range will tell - * if there are any parse errors that overlap with the range. - */ + * This function will return a predicate that for a given text range will tell + * if there are any parse errors that overlap with the range. + */ function prepareRangeContainsErrorFunction(errors, originalRange) { if (!errors.length) { return rangeHasNoErrors; @@ -75903,10 +81816,10 @@ var ts; } } /** - * Start of the original range might fall inside the comment - scanner will not yield appropriate results - * This function will look for token that is located before the start of target range - * and return its end as start position for the scanner. - */ + * Start of the original range might fall inside the comment - scanner will not yield appropriate results + * This function will look for token that is located before the start of target range + * and return its end as start position for the scanner. + */ function getScanStartPosition(enclosingNode, originalRange, sourceFile) { var start = enclosingNode.getStart(sourceFile); if (start === originalRange.pos && enclosingNode.end === originalRange.end) { @@ -75956,14 +81869,21 @@ var ts; } return 0; } + /* @internal */ + function formatNode(node, sourceFileLike, languageVariant, initialIndentation, delta, rulesProvider) { + var range = { pos: 0, end: sourceFileLike.text.length }; + return formatSpanWorker(range, node, initialIndentation, delta, formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end), rulesProvider.getFormatOptions(), rulesProvider, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors + sourceFileLike); + } + formatting.formatNode = formatNode; function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { - var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); - // formatting context is used by rules provider - var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); // find the smallest node that fully wraps the range and compute the initial indentation for the node var enclosingNode = findEnclosingNode(originalRange, sourceFile); - var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); - var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options), getOwnOrInheritedDelta(enclosingNode, options, sourceFile), formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end), options, rulesProvider, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); + } + function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, options, rulesProvider, requestKind, rangeContainsError, sourceFile) { + // formatting context is used by rules provider + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); var previousRangeHasError; var previousRange; var previousParent; @@ -75978,13 +81898,12 @@ var ts; if (enclosingNode.decorators) { undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line; } - var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } if (!formattingScanner.isOnToken()) { var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); if (leadingTrivia) { - processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined); + processTrivia(leadingTrivia, enclosingNode, enclosingNode, /*dynamicIndentation*/ undefined); trimTrailingWhitespacesForRemainingRange(); } } @@ -75992,12 +81911,12 @@ var ts; return edits; // local functions /** Tries to compute the indentation for a list element. - * If list element is not in range then - * function will pick its actual indentation - * so it can be pushed downstream as inherited indentation. - * If list element is in the range - its indentation will be equal - * to inherited indentation from its predecessors. - */ + * If list element is not in range then + * function will pick its actual indentation + * so it can be pushed downstream as inherited indentation. + * If list element is in the range - its indentation will be equal + * to inherited indentation from its predecessors. + */ function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) || ts.rangeContainsStartEnd(range, startPos, endPos) /* Not to miss zero-range nodes e.g. JsxText */) { @@ -76048,20 +81967,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226 /* ClassDeclaration */: return 74 /* ClassKeyword */; - case 227 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; - case 225 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; - case 229 /* EnumDeclaration */: return 229 /* EnumDeclaration */; - case 151 /* GetAccessor */: return 124 /* GetKeyword */; - case 152 /* SetAccessor */: return 133 /* SetKeyword */; - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: return 74 /* ClassKeyword */; + case 229 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; + case 227 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; + case 231 /* EnumDeclaration */: return 231 /* EnumDeclaration */; + case 152 /* GetAccessor */: return 124 /* GetKeyword */; + case 153 /* SetAccessor */: return 134 /* SetKeyword */; + case 150 /* MethodDeclaration */: if (node.asteriskToken) { return 38 /* AsteriskToken */; - } /* - fall-through - */ - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: + } + // falls through + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: return node.name.kind; } } @@ -76091,18 +82009,31 @@ var ts; // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent case 16 /* OpenBraceToken */: case 17 /* CloseBraceToken */: - case 20 /* OpenBracketToken */: - case 21 /* CloseBracketToken */: case 18 /* OpenParenToken */: case 19 /* CloseParenToken */: case 81 /* ElseKeyword */: case 105 /* WhileKeyword */: case 56 /* AtToken */: return indentation; - default: - // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40 /* SlashToken */: + case 28 /* GreaterThanToken */: { + if (container.kind === 250 /* JsxOpeningElement */ || + container.kind === 251 /* JsxClosingElement */ || + container.kind === 249 /* JsxSelfClosingElement */) { + return indentation; + } + break; + } + case 20 /* OpenBracketToken */: + case 21 /* CloseBracketToken */: { + if (container.kind !== 171 /* MappedType */) { + return indentation; + } + break; + } } + // if token line equals to the line of containing node (this is a first token in the node) - use node indentation + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -76125,7 +82056,7 @@ var ts; }; function getEffectiveDelta(delta, child) { // Delta value should be zero when the node explicitly prevents indentation of the child node - return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; + return formatting.SmartIndenter.nodeWillIndentChild(node, child, /*indentByDefault*/ true) ? delta : 0; } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { @@ -76158,7 +82089,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -76192,7 +82123,7 @@ var ts; // stop when formatting scanner advances past the beginning of the child break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -76205,11 +82136,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 176 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -76232,11 +82163,11 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { // consume any tokens that precede the list as child elements of 'node' using its indentation scope - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -76254,7 +82185,7 @@ var ts; // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { // consume list end token - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -76461,7 +82392,7 @@ var ts; } // shift all parts on the delta size var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -76566,12 +82497,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 185 /* ArrowFunction */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 186 /* ArrowFunction */: if (node.typeParameters === list) { return 26 /* LessThanToken */; } @@ -76579,8 +82510,8 @@ var ts; return 18 /* OpenParenToken */; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -76588,7 +82519,7 @@ var ts; return 18 /* OpenParenToken */; } break; - case 157 /* TypeReference */: + case 158 /* TypeReference */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -76668,7 +82599,20 @@ var ts; (function (Value) { Value[Value["Unknown"] = -1] = "Unknown"; })(Value || (Value = {})); - function getIndentation(position, sourceFile, options) { + /** + * Computed indentation for a given position in source file + * @param position - position in file + * @param sourceFile - target source file + * @param options - set of editor options that control indentation + * @param assumeNewLineBeforeCloseBrace - false when getIndentation is called on the text from the real source file. + * true - when we need to assume that position is on the newline. This is usefult for codefixes, i.e. + * function f() { + * |} + * when inserting some text after open brace we would like to get the value of indentation as if newline was already there. + * However by default indentation at position | will be 0 so 'assumeNewLineBeforeCloseBrace' allows to override this behavior, + */ + function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { + if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } if (position > sourceFile.text.length) { return getBaseIndentation(options); // past EOF } @@ -76704,7 +82648,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 192 /* BinaryExpression */) { + if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 193 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -76720,8 +82664,10 @@ var ts; while (current) { if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); - if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { - indentationDelta = 0; + var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); + if (nextTokenKind !== 0 /* Unknown */) { + // handle cases when codefix is about to be inserted before the close brace + indentationDelta = assumeNewLineBeforeCloseBrace && nextTokenKind === 2 /* CloseBrace */ ? options.indentSize : 0; } else { indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0; @@ -76827,20 +82773,26 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 264 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); } + var NextTokenKind; + (function (NextTokenKind) { + NextTokenKind[NextTokenKind["Unknown"] = 0] = "Unknown"; + NextTokenKind[NextTokenKind["OpenBrace"] = 1] = "OpenBrace"; + NextTokenKind[NextTokenKind["CloseBrace"] = 2] = "CloseBrace"; + })(NextTokenKind || (NextTokenKind = {})); function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { var nextToken = ts.findNextToken(precedingToken, current); if (!nextToken) { - return false; + return 0 /* Unknown */; } if (nextToken.kind === 16 /* OpenBraceToken */) { // open braces are always indented at the parent level - return true; + return 1 /* OpenBrace */; } else if (nextToken.kind === 17 /* CloseBraceToken */) { // close braces are indented at the parent level if they are located on the same line with cursor @@ -76852,15 +82804,15 @@ var ts; // class A { // $} var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; - return lineAtPosition === nextTokenStartLine; + return lineAtPosition === nextTokenStartLine ? 2 /* CloseBrace */ : 0 /* Unknown */; } - return false; + return 0 /* Unknown */; } function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 210 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -76869,53 +82821,49 @@ var ts; return false; } SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getListIfStartEndIsInListRange(list, start, end) { + return list && ts.rangeContainsStartEnd(list, start, end) ? list : undefined; + } function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157 /* TypeReference */: - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { - return node.parent.typeArguments; - } - break; - case 176 /* ObjectLiteralExpression */: + case 158 /* TypeReference */: + return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); + case 177 /* ObjectLiteralExpression */: return node.parent.properties; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return node.parent.elements; - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 151 /* Constructor */: + case 160 /* ConstructorType */: + case 155 /* ConstructSignature */: { var start = node.getStart(sourceFile); - if (node.parent.typeParameters && - ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; - } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 180 /* NewExpression */: - case 179 /* CallExpression */: { + case 228 /* ClassDeclaration */: + return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); + case 181 /* NewExpression */: + case 180 /* CallExpression */: { var start = node.getStart(sourceFile); - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { - return node.parent.typeArguments; - } - if (node.parent.arguments && - ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { - return node.parent.arguments; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } + case 226 /* VariableDeclarationList */: + return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); + case 240 /* NamedImports */: + case 244 /* NamedExports */: + return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } return undefined; } + SmartIndenter.getContainingList = getContainingList; function getActualIndentationForListItem(node, sourceFile, options) { var containingList = getContainingList(node, sourceFile); return containingList ? getActualIndentationFromList(containingList) : -1 /* Unknown */; @@ -76930,8 +82878,8 @@ var ts; if (node.kind === 19 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) && + if (node.parent && (node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -76949,10 +82897,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: node = node.expression; break; default: @@ -77016,48 +82964,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 207 /* ExpressionStatement */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 175 /* ArrayLiteralExpression */: - case 204 /* Block */: - case 231 /* ModuleBlock */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 163 /* TupleType */: - case 232 /* CaseBlock */: - case 254 /* DefaultClause */: - case 253 /* CaseClause */: - case 183 /* ParenthesizedExpression */: - case 177 /* PropertyAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 205 /* VariableStatement */: - case 223 /* VariableDeclaration */: - case 240 /* ExportAssignment */: - case 216 /* ReturnStatement */: - case 193 /* ConditionalExpression */: - case 173 /* ArrayBindingPattern */: - case 172 /* ObjectBindingPattern */: - case 248 /* JsxOpeningElement */: - case 247 /* JsxSelfClosingElement */: - case 252 /* JsxExpression */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 144 /* Parameter */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 166 /* ParenthesizedType */: - case 181 /* TaggedTemplateExpression */: - case 189 /* AwaitExpression */: - case 242 /* NamedExports */: - case 238 /* NamedImports */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: + case 209 /* ExpressionStatement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 176 /* ArrayLiteralExpression */: + case 206 /* Block */: + case 233 /* ModuleBlock */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 164 /* TupleType */: + case 234 /* CaseBlock */: + case 257 /* DefaultClause */: + case 256 /* CaseClause */: + case 184 /* ParenthesizedExpression */: + case 178 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 207 /* VariableStatement */: + case 225 /* VariableDeclaration */: + case 242 /* ExportAssignment */: + case 218 /* ReturnStatement */: + case 194 /* ConditionalExpression */: + case 174 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 255 /* JsxExpression */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 145 /* Parameter */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 167 /* ParenthesizedType */: + case 182 /* TaggedTemplateExpression */: + case 190 /* AwaitExpression */: + case 244 /* NamedExports */: + case 240 /* NamedImports */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: return true; } return false; @@ -77066,27 +83015,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 208 /* IfStatement */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return childKind !== 204 /* Block */; - case 241 /* ExportDeclaration */: - return childKind !== 242 /* NamedExports */; - case 235 /* ImportDeclaration */: - return childKind !== 236 /* ImportClause */ || - (child.namedBindings && child.namedBindings.kind !== 238 /* NamedImports */); - case 246 /* JsxElement */: - return childKind !== 249 /* JsxClosingElement */; + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 210 /* IfStatement */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return childKind !== 206 /* Block */; + case 243 /* ExportDeclaration */: + return childKind !== 244 /* NamedExports */; + case 237 /* ImportDeclaration */: + return childKind !== 238 /* ImportClause */ || + (child.namedBindings && child.namedBindings.kind !== 240 /* NamedImports */); + case 248 /* JsxElement */: + return childKind !== 251 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -77104,10 +83053,589 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var textChanges; + (function (textChanges) { + /** + * Currently for simplicity we store recovered positions on the node itself. + * It can be changed to side-table later if we decide that current design is too invasive. + */ + function getPos(n) { + return n["__pos"]; + } + function setPos(n, pos) { + n["__pos"] = pos; + } + function getEnd(n) { + return n["__end"]; + } + function setEnd(n, end) { + n["__end"] = end; + } + var Position; + (function (Position) { + Position[Position["FullStart"] = 0] = "FullStart"; + Position[Position["Start"] = 1] = "Start"; + })(Position = textChanges.Position || (textChanges.Position = {})); + function skipWhitespacesAndLineBreaks(text, start) { + return ts.skipTrivia(text, start, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); + } + function hasCommentsBeforeLineBreak(text, start) { + var i = start; + while (i < text.length) { + var ch = text.charCodeAt(i); + if (ts.isWhiteSpaceSingleLine(ch)) { + i++; + continue; + } + return ch === 47 /* slash */; + } + return false; + } + function getSeparatorCharacter(separator) { + return ts.tokenToString(separator.kind); + } + textChanges.getSeparatorCharacter = getSeparatorCharacter; + function getAdjustedStartPosition(sourceFile, node, options, position) { + if (options.useNonAdjustedStartPosition) { + return node.getFullStart(); + } + var fullStart = node.getFullStart(); + var start = node.getStart(sourceFile); + if (fullStart === start) { + return start; + } + var fullStartLine = ts.getLineStartPositionForPosition(fullStart, sourceFile); + var startLine = ts.getLineStartPositionForPosition(start, sourceFile); + if (startLine === fullStartLine) { + // full start and start of the node are on the same line + // a, b; + // ^ ^ + // | start + // fullstart + // when b is replaced - we usually want to keep the leading trvia + // when b is deleted - we delete it + return position === Position.Start ? start : fullStart; + } + // get start position of the line following the line that contains fullstart position + var adjustedStartPosition = ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, fullStartLine) + 1, sourceFile); + // skip whitespaces/newlines + adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition); + return ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile); + } + textChanges.getAdjustedStartPosition = getAdjustedStartPosition; + function getAdjustedEndPosition(sourceFile, node, options) { + if (options.useNonAdjustedEndPosition) { + return node.getEnd(); + } + var end = node.getEnd(); + var newEnd = ts.skipTrivia(sourceFile.text, end, /*stopAfterLineBreak*/ true); + // check if last character before newPos is linebreak + // if yes - considered all skipped trivia to be trailing trivia of the node + return newEnd !== end && ts.isLineBreak(sourceFile.text.charCodeAt(newEnd - 1)) + ? newEnd + : end; + } + textChanges.getAdjustedEndPosition = getAdjustedEndPosition; + /** + * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element + */ + function isSeparator(node, candidate) { + return candidate && node.parent && (candidate.kind === 25 /* CommaToken */ || (candidate.kind === 24 /* SemicolonToken */ && node.parent.kind === 177 /* ObjectLiteralExpression */)); + } + function spaces(count) { + var s = ""; + for (var i = 0; i < count; i++) { + s += " "; + } + return s; + } + var ChangeTracker = (function () { + function ChangeTracker(newLine, rulesProvider, validator) { + this.newLine = newLine; + this.rulesProvider = rulesProvider; + this.validator = validator; + this.changes = []; + this.newLineCharacter = ts.getNewLineCharacter({ newLine: newLine }); + } + ChangeTracker.fromCodeFixContext = function (context) { + return new ChangeTracker(context.newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */, context.rulesProvider); + }; + ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, node, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteRange = function (sourceFile, range) { + this.changes.push({ sourceFile: sourceFile, range: range }); + return this; + }; + ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteNodeInList = function (sourceFile, node) { + var containingList = ts.formatting.SmartIndenter.getContainingList(node, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(node); + if (index < 0) { + return this; + } + if (containingList.length === 1) { + this.deleteNode(sourceFile, node); + return this; + } + if (index !== containingList.length - 1) { + var nextToken = ts.getTokenAtPosition(sourceFile, node.end); + if (nextToken && isSeparator(node, nextToken)) { + // find first non-whitespace position in the leading trivia of the node + var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); + var nextElement = containingList[index + 1]; + /// find first non-whitespace position in the leading trivia of the next node + var endPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, nextElement, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); + // shift next node so its first non-whitespace position will be moved to the first non-whitespace position of the deleted node + this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); + } + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end); + if (previousToken && isSeparator(node, previousToken)) { + this.deleteNodeRange(sourceFile, previousToken, node); + } + } + return this; + }; + ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, range: range, options: options, node: newNode }); + return this; + }; + ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, oldNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, oldNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, options: options, node: newNode, range: { pos: pos, end: pos } }); + return this; + }; + ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, before, options, Position.Start); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: startPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode, options) { + if (options === void 0) { options = {}; } + if ((ts.isStatementButNotDeclaration(after)) || + after.kind === 148 /* PropertyDeclaration */ || + after.kind === 147 /* PropertySignature */ || + after.kind === 149 /* MethodSignature */) { + // check if previous statement ends with semicolon + // if not - insert semicolon to preserve the code from changing the meaning due to ASI + if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) { + this.changes.push({ + sourceFile: sourceFile, + options: {}, + range: { pos: after.end, end: after.end }, + node: ts.createToken(24 /* SemicolonToken */) + }); + } + } + var endPosition = getAdjustedEndPosition(sourceFile, after, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: endPosition, end: endPosition } }); + return this; + }; + /** + * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, + * i.e. arguments in arguments lists, parameters in parameter lists etc. + * Note that separators are part of the node in statements and class elements. + */ + ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode) { + var containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(after); + if (index < 0) { + return this; + } + var end = after.getEnd(); + if (index !== containingList.length - 1) { + // any element except the last one + // use next sibling as an anchor + var nextToken = ts.getTokenAtPosition(sourceFile, after.end); + if (nextToken && isSeparator(after, nextToken)) { + // for list + // a, b, c + // create change for adding 'e' after 'a' as + // - find start of next element after a (it is b) + // - use this start as start and end position in final change + // - build text of change by formatting the text of node + separator + whitespace trivia of b + // in multiline case it will work as + // a, + // b, + // c, + // result - '*' denotes leading trivia that will be inserted after new text (displayed as '#') + // a,* + // ***insertedtext# + // ###b, + // c, + // find line and character of the next element + var lineAndCharOfNextElement = ts.getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart())); + // find line and character of the token that precedes next element (usually it is separator) + var lineAndCharOfNextToken = ts.getLineAndCharacterOfPosition(sourceFile, nextToken.end); + var prefix = void 0; + var startPos = void 0; + if (lineAndCharOfNextToken.line === lineAndCharOfNextElement.line) { + // next element is located on the same line with separator: + // a,$$$$b + // ^ ^ + // | |-next element + // |-separator + // where $$$ is some leading trivia + // for a newly inserted node we'll maintain the same relative position comparing to separator and replace leading trivia with spaces + // a, x,$$$$b + // ^ ^ ^ + // | | |-next element + // | |-new inserted node padded with spaces + // |-separator + startPos = nextToken.end; + prefix = spaces(lineAndCharOfNextElement.character - lineAndCharOfNextToken.character); + } + else { + // next element is located on different line that separator + // let insert position be the beginning of the line that contains next element + startPos = ts.getStartPositionOfLine(lineAndCharOfNextElement.line, sourceFile); + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: startPos, end: containingList[index + 1].getStart(sourceFile) }, + node: newNode, + useIndentationFromFile: true, + options: { + prefix: prefix, + // write separator and leading trivia of the next element as suffix + suffix: "" + ts.tokenToString(nextToken.kind) + sourceFile.text.substring(nextToken.end, containingList[index + 1].getStart(sourceFile)) + } + }); + } + } + else { + var afterStart = after.getStart(sourceFile); + var afterStartLinePosition = ts.getLineStartPositionForPosition(afterStart, sourceFile); + var separator = void 0; + var multilineList = false; + // insert element after the last element in the list that has more than one item + // pick the element preceding the after element to: + // - pick the separator + // - determine if list is a multiline + if (containingList.length === 1) { + // if list has only one element then we'll format is as multiline if node has comment in trailing trivia, or as singleline otherwise + // i.e. var x = 1 // this is x + // | new element will be inserted at this position + separator = 25 /* CommaToken */; + } + else { + // element has more than one element, pick separator from the list + var tokenBeforeInsertPosition = ts.findPrecedingToken(after.pos, sourceFile); + separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 25 /* CommaToken */; + // determine if list is multiline by checking lines of after element and element that precedes it. + var afterMinusOneStartLinePosition = ts.getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); + multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; + } + if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) { + // in this case we'll always treat containing list as multiline + multilineList = true; + } + if (multilineList) { + // insert separator immediately following the 'after' node to preserve comments in trailing trivia + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: ts.createToken(separator), + options: {} + }); + // use the same indentation as 'after' item + var indentation = ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(afterStartLinePosition, afterStart, sourceFile, this.rulesProvider.getFormatOptions()); + // insert element before the line break on the line that contains 'after' element + var insertPos = ts.skipTrivia(sourceFile.text, end, /*stopAfterLineBreak*/ true, /*stopAtComments*/ false); + if (insertPos !== end && ts.isLineBreak(sourceFile.text.charCodeAt(insertPos - 1))) { + insertPos--; + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: insertPos, end: insertPos }, + node: newNode, + options: { indentation: indentation, prefix: this.newLineCharacter } + }); + } + else { + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: newNode, + options: { prefix: ts.tokenToString(separator) + " " } + }); + } + } + return this; + }; + ChangeTracker.prototype.getChanges = function () { + var _this = this; + var changesPerFile = ts.createFileMap(); + // group changes per file + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var c = _a[_i]; + var changesInFile = changesPerFile.get(c.sourceFile.path); + if (!changesInFile) { + changesPerFile.set(c.sourceFile.path, changesInFile = []); + } + changesInFile.push(c); + } + // convert changes + var fileChangesList = []; + changesPerFile.forEachValue(function (path) { + var changesInFile = changesPerFile.get(path); + var sourceFile = changesInFile[0].sourceFile; + var fileTextChanges = { fileName: sourceFile.fileName, textChanges: [] }; + for (var _i = 0, _a = ChangeTracker.normalize(changesInFile); _i < _a.length; _i++) { + var c = _a[_i]; + fileTextChanges.textChanges.push({ + span: _this.computeSpan(c, sourceFile), + newText: _this.computeNewText(c, sourceFile) + }); + } + fileChangesList.push(fileTextChanges); + }); + return fileChangesList; + }; + ChangeTracker.prototype.computeSpan = function (change, _sourceFile) { + return ts.createTextSpanFromBounds(change.range.pos, change.range.end); + }; + ChangeTracker.prototype.computeNewText = function (change, sourceFile) { + if (!change.node) { + // deletion case + return ""; + } + var options = change.options || {}; + var nonFormattedText = getNonformattedText(change.node, sourceFile, this.newLine); + if (this.validator) { + this.validator(nonFormattedText); + } + var formatOptions = this.rulesProvider.getFormatOptions(); + var pos = change.range.pos; + var posStartsLine = ts.getLineStartPositionForPosition(pos, sourceFile) === pos; + var initialIndentation = change.options.indentation !== undefined + ? change.options.indentation + : change.useIndentationFromFile + ? ts.formatting.SmartIndenter.getIndentation(change.range.pos, sourceFile, formatOptions, posStartsLine || (change.options.prefix === this.newLineCharacter)) + : 0; + var delta = change.options.delta !== undefined + ? change.options.delta + : ts.formatting.SmartIndenter.shouldIndentChildNode(change.node) + ? formatOptions.indentSize + : 0; + var text = applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, this.rulesProvider); + // strip initial indentation (spaces or tabs) if text will be inserted in the middle of the line + // however keep indentation if it is was forced + text = posStartsLine || change.options.indentation !== undefined ? text : text.replace(/^\s+/, ""); + return (options.prefix || "") + text + (options.suffix || ""); + }; + ChangeTracker.normalize = function (changes) { + // order changes by start position + var normalized = ts.stableSort(changes, function (a, b) { return a.range.pos - b.range.pos; }); + // verify that change intervals do not overlap, except possibly at end points. + for (var i = 0; i < normalized.length - 2; i++) { + ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos); + } + return normalized; + }; + return ChangeTracker; + }()); + textChanges.ChangeTracker = ChangeTracker; + function getNonformattedText(node, sourceFile, newLine) { + var options = { newLine: newLine, target: sourceFile.languageVersion }; + var writer = new Writer(ts.getNewLineCharacter(options)); + var printer = ts.createPrinter(options, writer); + printer.writeNode(3 /* Unspecified */, node, sourceFile, writer); + return { text: writer.getText(), node: assignPositionsToNode(node) }; + } + textChanges.getNonformattedText = getNonformattedText; + function applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, rulesProvider) { + var lineMap = ts.computeLineStarts(nonFormattedText.text); + var file = { + text: nonFormattedText.text, + lineMap: lineMap, + getLineAndCharacterOfPosition: function (pos) { return ts.computeLineAndCharacterOfPosition(lineMap, pos); } + }; + var changes = ts.formatting.formatNode(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); + return applyChanges(nonFormattedText.text, changes); + } + textChanges.applyFormatting = applyFormatting; + function applyChanges(text, changes) { + for (var i = changes.length - 1; i >= 0; i--) { + var change = changes[i]; + text = "" + text.substring(0, change.span.start) + change.newText + text.substring(ts.textSpanEnd(change.span)); + } + return text; + } + textChanges.applyChanges = applyChanges; + function isTrivia(s) { + return ts.skipTrivia(s, 0) === s.length; + } + var nullTransformationContext = { + enableEmitNotification: ts.noop, + enableSubstitution: ts.noop, + endLexicalEnvironment: function () { return undefined; }, + getCompilerOptions: ts.notImplemented, + getEmitHost: ts.notImplemented, + getEmitResolver: ts.notImplemented, + hoistFunctionDeclaration: ts.noop, + hoistVariableDeclaration: ts.noop, + isEmitNotificationEnabled: ts.notImplemented, + isSubstitutionEnabled: ts.notImplemented, + onEmitNode: ts.noop, + onSubstituteNode: ts.notImplemented, + readEmitHelpers: ts.notImplemented, + requestEmitHelper: ts.noop, + resumeLexicalEnvironment: ts.noop, + startLexicalEnvironment: ts.noop, + suspendLexicalEnvironment: ts.noop + }; + function assignPositionsToNode(node) { + var visited = ts.visitEachChild(node, assignPositionsToNode, nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); + // create proxy node for non synthesized nodes + var newNode = ts.nodeIsSynthesized(visited) + ? visited + : (Proxy.prototype = visited, new Proxy()); + newNode.pos = getPos(node); + newNode.end = getEnd(node); + return newNode; + function Proxy() { } + } + function assignPositionsToNodeArray(nodes, visitor, test, start, count) { + var visited = ts.visitNodes(nodes, visitor, test, start, count); + if (!visited) { + return visited; + } + // clone nodearray if necessary + var nodeArray = visited === nodes ? ts.createNodeArray(visited.slice(0)) : visited; + nodeArray.pos = getPos(nodes); + nodeArray.end = getEnd(nodes); + return nodeArray; + } + var Writer = (function () { + function Writer(newLine) { + var _this = this; + this.lastNonTriviaPosition = 0; + this.writer = ts.createTextWriter(newLine); + this.onEmitNode = function (hint, node, printCallback) { + if (node) { + setPos(node, _this.lastNonTriviaPosition); + } + printCallback(hint, node); + if (node) { + setEnd(node, _this.lastNonTriviaPosition); + } + }; + this.onBeforeEmitNodeArray = function (nodes) { + if (nodes) { + setPos(nodes, _this.lastNonTriviaPosition); + } + }; + this.onAfterEmitNodeArray = function (nodes) { + if (nodes) { + setEnd(nodes, _this.lastNonTriviaPosition); + } + }; + } + Writer.prototype.setLastNonTriviaPosition = function (s, force) { + if (force || !isTrivia(s)) { + this.lastNonTriviaPosition = this.writer.getTextPos(); + var i = 0; + while (ts.isWhiteSpace(s.charCodeAt(s.length - i - 1))) { + i++; + } + // trim trailing whitespaces + this.lastNonTriviaPosition -= i; + } + }; + Writer.prototype.write = function (s) { + this.writer.write(s); + this.setLastNonTriviaPosition(s, /*force*/ false); + }; + Writer.prototype.writeTextOfNode = function (text, node) { + this.writer.writeTextOfNode(text, node); + }; + Writer.prototype.writeLine = function () { + this.writer.writeLine(); + }; + Writer.prototype.increaseIndent = function () { + this.writer.increaseIndent(); + }; + Writer.prototype.decreaseIndent = function () { + this.writer.decreaseIndent(); + }; + Writer.prototype.getText = function () { + return this.writer.getText(); + }; + Writer.prototype.rawWrite = function (s) { + this.writer.rawWrite(s); + this.setLastNonTriviaPosition(s, /*force*/ false); + }; + Writer.prototype.writeLiteral = function (s) { + this.writer.writeLiteral(s); + this.setLastNonTriviaPosition(s, /*force*/ true); + }; + Writer.prototype.getTextPos = function () { + return this.writer.getTextPos(); + }; + Writer.prototype.getLine = function () { + return this.writer.getLine(); + }; + Writer.prototype.getColumn = function () { + return this.writer.getColumn(); + }; + Writer.prototype.getIndent = function () { + return this.writer.getIndent(); + }; + Writer.prototype.isAtStartOfLine = function () { + return this.writer.isAtStartOfLine(); + }; + Writer.prototype.reset = function () { + this.writer.reset(); + this.lastNonTriviaPosition = 0; + }; + return Writer; + }()); + })(textChanges = ts.textChanges || (ts.textChanges = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -77142,25 +83670,226 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - // First token is the open curly, this is where we want to put the 'super' call. - return constructor.body.getFirstToken(sourceFile).getEnd(); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface + }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDeclaration = ts.getContainingClass(token); + if (!classDeclaration) { + return undefined; + } + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var classType = checker.getTypeAtLocation(classDeclaration); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDeclaration); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1 /* Number */); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0 /* String */); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var implementedType = checker.getTypeAtLocation(implementedTypeNode); + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8 /* Private */); }); + var newNodes = []; + createAndAddMissingIndexSignatureDeclaration(implementedType, 1 /* Number */, hasNumericIndexSignature, newNodes); + createAndAddMissingIndexSignatureDeclaration(implementedType, 0 /* String */, hasStringIndexSignature, newNodes); + newNodes = newNodes.concat(codefix.createMissingMemberNodes(classDeclaration, nonPrivateMembers, checker)); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (newNodes.length > 0) { + pushAction(result, newNodes, message); + } + } + return result; + function createAndAddMissingIndexSignatureDeclaration(type, kind, hasIndexSigOfKind, newNodes) { + if (hasIndexSigOfKind) { + return; + } + var indexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (!indexInfoOfKind) { + return; + } + var newIndexSignatureDeclaration = checker.indexInfoToIndexSignatureDeclaration(indexInfoOfKind, kind, classDeclaration); + newNodes.push(newIndexSignatureDeclaration); + } + function pushAction(result, newNodes, description) { + var newAction = { + description: description, + changes: codefix.newNodesToChanges(newNodes, openBrace, context) + }; + result.push(newAction); + } } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122 /* ConstructorKeyword */) { - return undefined; + errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code], + getCodeActions: getActionsForAddMissingMember + }); + function getActionsForAddMissingMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + // This is the identifier of the missing property. eg: + // this.missing = 1; + // ^^^^^^^ + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind !== 70 /* Identifier */) { + return undefined; + } + if (!ts.isPropertyAccessExpression(token.parent) || token.parent.expression.kind !== 98 /* ThisKeyword */) { + return undefined; + } + var classMemberDeclaration = ts.getThisContainer(token, /*includeArrowFunctions*/ false); + if (!ts.isClassElement(classMemberDeclaration)) { + return undefined; + } + var classDeclaration = classMemberDeclaration.parent; + if (!classDeclaration || !ts.isClassLike(classDeclaration)) { + return undefined; + } + var isStatic = ts.hasModifier(classMemberDeclaration, 32 /* Static */); + return ts.isInJavaScriptFile(sourceFile) ? getActionsForAddMissingMemberInJavaScriptFile() : getActionsForAddMissingMemberInTypeScriptFile(); + function getActionsForAddMissingMemberInJavaScriptFile() { + var memberName = token.getText(); + if (isStatic) { + if (classDeclaration.kind === 198 /* ClassExpression */) { + return undefined; + } + var className = classDeclaration.name.getText(); + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_static_property_0), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classDeclaration.getEnd(), length: 0 }, + newText: "" + context.newLineCharacter + className + "." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + else { + var classConstructor = ts.getFirstConstructorWithBody(classDeclaration); + if (!classConstructor) { + return undefined; + } + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_property_0_in_the_constructor), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classConstructor.body.getEnd() - 1, length: 0 }, + newText: "this." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; + } + } + function getActionsForAddMissingMemberInTypeScriptFile() { + var typeNode; + if (token.parent.parent.kind === 193 /* BinaryExpression */) { + var binaryExpression = token.parent.parent; + var checker = context.program.getTypeChecker(); + var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right))); + typeNode = checker.typeToTypeNode(widenedType, classDeclaration); + } + typeNode = typeNode || ts.createKeywordTypeNode(118 /* AnyKeyword */); + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var property = ts.createProperty( + /*decorators*/ undefined, + /*modifiers*/ isStatic ? [ts.createToken(114 /* StaticKeyword */)] : undefined, token.getText(sourceFile), + /*questionToken*/ undefined, typeNode, + /*initializer*/ undefined); + var propertyChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + propertyChangeTracker.insertNodeAfter(sourceFile, openBrace, property, { suffix: context.newLineCharacter }); + var actions = [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]), + changes: propertyChangeTracker.getChanges() }]; + if (!isStatic) { + var stringTypeNode = ts.createKeywordTypeNode(135 /* StringKeyword */); + var indexingParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, "x", + /*questionToken*/ undefined, stringTypeNode, + /*initializer*/ undefined); + var indexSignature = ts.createIndexSignatureDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, [indexingParameter], typeNode); + var indexSignatureChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + indexSignatureChangeTracker.insertNodeAfter(sourceFile, openBrace, indexSignature, { suffix: context.newLineCharacter }); + actions.push({ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]), + changes: indexSignatureChangeTracker.getChanges() + }); + } + return actions; } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + // This is the identifier in the case of a class declaration + // or the class keyword token in the case of a class expression. + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDeclaration = token.parent; + var extendsNode = ts.getClassExtendsHeritageClauseElement(classDeclaration); + var instantiatedExtendsType = checker.getTypeAtLocation(extendsNode); + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var newNodes = codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, checker); + var changes = codefix.newNodesToChanges(newNodes, ts.getOpenBraceOfClassLike(classDeclaration, sourceFile), context); + if (changes && changes.length > 0) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: changes + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8 /* Private */) && !!(flags & 128 /* Abstract */); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -77174,9 +83903,9 @@ var ts; if (!superCall) { return undefined; } - // figure out if the this access is actuall inside the supercall + // figure out if the `this` access is actually inside the supercall // i.e. super(this.a), since in that case we won't suggest a fix - if (superCall.expression && superCall.expression.kind == 179 /* CallExpression */) { + if (superCall.expression && superCall.expression.kind === 180 /* CallExpression */) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -77184,23 +83913,15 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); - var changes = [{ - fileName: sourceFile.fileName, textChanges: [{ - newText: superCall.getText(sourceFile), - span: { start: newPosition, length: 0 } - }, - { - newText: "", - span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) } - }] - }]; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(constructor, sourceFile), superCall, { suffix: context.newLineCharacter }); + changeTracker.deleteNode(sourceFile, superCall); return [{ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor), - changes: changes + changes: changeTracker.getChanges() }]; function findSuperCall(n) { - if (n.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { + if (n.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -77214,6 +83935,265 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122 /* ConstructorKeyword */) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + var superCall = ts.createStatement(ts.createCall(ts.createSuper(), /*typeArguments*/ undefined, /*argumentsArray*/ ts.emptyArray)); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(token.parent, sourceFile), superCall, { suffix: context.newLineCharacter }); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 /* Identifier */ && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84 /* ExtendsKeyword */)) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, extendsToken, ts.createToken(107 /* ImplementsKeyword */)); + // We replace existing keywords with commas. + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeTracker.replaceNode(sourceFile, keywordToken, ts.createToken(25 /* CommaToken */)); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: changeTracker.getChanges() + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 70 /* Identifier */) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createThis(), token)); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + // this handles var ["computed"] = 12; + if (token.kind === 20 /* OpenBracketToken */) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70 /* Identifier */: + switch (token.parent.kind) { + case 225 /* VariableDeclaration */: + switch (token.parent.parent.parent.kind) { + case 213 /* ForStatement */: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return deleteNode(forInitializer); + } + else { + return deleteNodeInList(token.parent); + } + case 215 /* ForOfStatement */: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { + var forOfInitializer = forOfStatement.initializer; + return replaceNode(forOfInitializer.declarations[0], ts.createObjectLiteral()); + } + break; + case 214 /* ForInStatement */: + // There is no valid fix in the case of: + // for .. in + return undefined; + case 259 /* CatchClause */: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return deleteNode(parameter); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return deleteNode(variableStatement); + } + else { + return deleteNodeInList(token.parent); + } + } + // TODO: #14885 + // falls through + case 144 /* TypeParameter */: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1); + if (!previousToken || previousToken.kind !== 26 /* LessThanToken */) { + return deleteRange(typeParameters); + } + var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end); + if (!nextToken || nextToken.kind !== 28 /* GreaterThanToken */) { + return deleteRange(typeParameters); + } + return deleteNodeRange(previousToken, nextToken); + } + else { + return deleteNodeInList(token.parent); + } + case 145 /* Parameter */: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return deleteNode(token.parent); + } + else { + return deleteNodeInList(token.parent); + } + // handle case where 'import a = A;' + case 236 /* ImportEqualsDeclaration */: + var importEquals = ts.getAncestor(token, 236 /* ImportEqualsDeclaration */); + return deleteNode(importEquals); + case 241 /* ImportSpecifier */: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + // Only 1 import and it is unused. So the entire declaration should be removed. + var importSpec = ts.getAncestor(token, 237 /* ImportDeclaration */); + return deleteNode(importSpec); + } + else { + // delete import specifier + return deleteNodeInList(token.parent); + } + // handle case where "import d, * as ns from './file'" + // or "'import {a, b as ns} from './file'" + case 238 /* ImportClause */: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = ts.getAncestor(importClause, 237 /* ImportDeclaration */); + return deleteNode(importDecl); + } + else { + // import |d,| * as ns from './file' + var start_4 = importClause.name.getStart(sourceFile); + var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end); + if (nextToken && nextToken.kind === 25 /* CommaToken */) { + // shift first non-whitespace position after comma to the start position of the node + return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, /*stopAfterLineBreaks*/ false, /*stopAtComments*/ true) }); + } + else { + return deleteNode(importClause.name); + } + } + case 239 /* NamespaceImport */: + var namespaceImport = token.parent; + if (namespaceImport.name === token && !namespaceImport.parent.name) { + var importDecl = ts.getAncestor(namespaceImport, 237 /* ImportDeclaration */); + return deleteNode(importDecl); + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1); + if (previousToken && previousToken.kind === 25 /* CommaToken */) { + var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart); + return deleteRange({ pos: startPosition, end: namespaceImport.end }); + } + return deleteRange(namespaceImport); + } + } + break; + case 148 /* PropertyDeclaration */: + case 239 /* NamespaceImport */: + return deleteNode(token.parent); + } + if (ts.isDeclarationName(token)) { + return deleteNode(token.parent); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return deleteNode(token.parent.parent); + } + else { + return undefined; + } + function deleteNode(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNode(sourceFile, n)); + } + function deleteRange(range) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteRange(sourceFile, range)); + } + function deleteNodeInList(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeInList(sourceFile, n)); + } + function deleteNodeRange(start, end) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeRange(sourceFile, start, end)); + } + function replaceNode(n, newNode) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).replaceNode(sourceFile, n, newNode)); + } + function makeChange(changeTracker) { + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), + changes: changeTracker.getChanges() + }]; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -77225,18 +84205,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -77249,12 +84230,13 @@ var ts; } switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) { case ModuleSpecifierComparison.Better: - // the new one is not worth considering if it is a new improt. + // the new one is not worth considering if it is a new import. // However if it is instead a insertion into existing import, the user might want to use // the module specifier even it is worse by our standards. So keep it. if (newAction.kind === "NewImport") { return; } + // falls through case ModuleSpecifierComparison.Equal: // the current one is safe. But it is still possible that the new one is worse // than another existing one. For example, you may have new imports from "./foo/bar" @@ -77280,8 +84262,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -77313,7 +84295,11 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics.Cannot_find_namespace_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -77323,18 +84309,22 @@ var ts; var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); // this is a module id -> module import declaration map - var cachedImportDeclarations = ts.createMap(); - var cachedNewImportInsertPosition; - var allPotentialModules = checker.getAmbientModules(); + var cachedImportDeclarations = []; + var lastImportDeclaration; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, /*isDefault*/ false, /*isNamespaceImport*/ true); + } + var candidateModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { - allPotentialModules.push(otherSourceFile.symbol); + candidateModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); - for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { - var moduleSymbol = allPotentialModules_1[_a]; + for (var _a = 0, candidateModules_1 = candidateModules; _a < candidateModules_1.length; _a++) { + var moduleSymbol = candidateModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); // check the default export var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); @@ -77356,8 +84346,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -77372,10 +84363,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } node = node.parent; @@ -77393,7 +84384,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { // With an existing import statement, there are more than one actions the user can do. @@ -77419,11 +84410,11 @@ var ts; var namespaceImportDeclaration; var namedImportDeclaration; var existingModuleSpecifier; - for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { - var declaration = declarations_11[_i]; - if (declaration.kind === 235 /* ImportDeclaration */) { + for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) { + var declaration = declarations_14[_i]; + if (declaration.kind === 237 /* ImportDeclaration */) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { // case: // import * as ns from "foo" namespaceImportDeclaration = declaration; @@ -77447,15 +84438,15 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { /** * If the existing import declaration already has a named import list, just * insert the identifier into that list. */ - var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var fileTextChanges = getTextChangeForImportClause(namedImportDeclaration.importClause); var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); - actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], fileTextChanges, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); } else { // we need to create a new import statement, but the existing module specifier can be reused. @@ -77463,55 +84454,35 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247 /* ExternalModuleReference */) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); } function getTextChangeForImportClause(importClause) { - var newImportText = isDefault ? "default as " + name : name; var importList = importClause.namedBindings; + var newImportSpecifier = ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name)); // case 1: // original text: import default from "module" // change to: import default, { name } from "module" - if (!importList && importClause.name) { - var start = importClause.name.getEnd(); - return { - newText: ", { " + newImportText + " }", - span: { start: start, length: 0 } - }; - } // case 2: // original text: import {} from "module" // change to: import { name } from "module" - if (importList.elements.length === 0) { - var start = importList.getStart(); - return { - newText: "{ " + newImportText + " }", - span: { start: start, length: importList.getEnd() - start } - }; + if (!importList || importList.elements.length === 0) { + var newImportClause = ts.createImportClause(importClause.name, ts.createNamedImports([newImportSpecifier])); + return createChangeTracker().replaceNode(sourceFile, importClause, newImportClause).getChanges(); } - // case 3: - // original text: import { foo, bar } from "module" - // change to: import { foo, bar, name } from "module" - var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); /** * If the import list has one import per line, preserve that. Otherwise, insert on same line as last element * import { * foo * } from "./module"; */ - var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); - var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); - var oneImportPerLine = endLine - startLine > importList.elements.length; - return { - newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, - span: { start: insertPoint, length: 0 } - }; + return createChangeTracker().insertNodeInListAfter(sourceFile, importList.elements[importList.elements.length - 1], newImportSpecifier).getChanges(); } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235 /* ImportDeclaration */) { + if (declaration.kind === 237 /* ImportDeclaration */) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -77528,47 +84499,52 @@ var ts; * namespace instead of altering the import declaration. For example, "foo" would * become "ns.foo" */ - return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], createChangeTracker().replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createIdentifier(namespacePrefix), name)).getChanges(), "CodeChange"); } } function getCodeActionForNewImport(moduleSpecifier) { - if (!cachedNewImportInsertPosition) { + if (!lastImportDeclaration) { // insert after any existing imports - var lastModuleSpecifierEnd = -1; - for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { - var moduleSpecifier_1 = _a[_i]; - var end = moduleSpecifier_1.getEnd(); - if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { - lastModuleSpecifierEnd = end; + for (var i = sourceFile.statements.length - 1; i >= 0; i--) { + var statement = sourceFile.statements[i]; + if (statement.kind === 236 /* ImportEqualsDeclaration */ || statement.kind === 237 /* ImportDeclaration */) { + lastImportDeclaration = statement; + break; } } - cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); } var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); - var importStatementText = isDefault - ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + var changeTracker = createChangeTracker(); + var importClause = isDefault + ? ts.createImportClause(ts.createIdentifier(name), /*namedBindings*/ undefined) + : isNamespaceImport + ? ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(name))) + : ts.createImportClause(/*name*/ undefined, ts.createNamedImports([ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name))])); + var importDecl = ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, importClause, ts.createLiteral(moduleSpecifierWithoutQuotes)); + if (!lastImportDeclaration) { + changeTracker.insertNodeAt(sourceFile, sourceFile.getStart(), importDecl, { suffix: "" + context.newLineCharacter + context.newLineCharacter }); + } + else { + changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl, { suffix: context.newLineCharacter }); + } // if this file doesn't have any import statements, insert an import statement and then insert a new line // between the only import statement and user code. Otherwise just insert the statement because chances // are there are already a new line seperating code and import statements. - var newText = cachedNewImportInsertPosition === sourceFile.getStart() - ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter - : "" + context.newLineCharacter + importStatementText + ";"; - return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], changeTracker.getChanges(), "NewImport", moduleSpecifierWithoutQuotes); function getModuleSpecifierForNewImport() { - var fileName = sourceFile.path; - var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var fileName = sourceFile.fileName; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().fileName; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) { + if (moduleSymbol.valueDeclaration.kind !== 264 /* SourceFile */) { return moduleSymbol.name; } } @@ -77576,11 +84552,11 @@ var ts; if (!options.baseUrl) { return undefined; } - var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); - var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + var relativeName = getRelativePathIfInDirectory(moduleFileName, options.baseUrl); if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -77600,7 +84576,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -77610,9 +84586,8 @@ var ts; } function tryGetModuleNameFromRootDirs() { if (options.rootDirs) { - var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName); }); - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, options.rootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, options.rootDirs); if (normalizedTargetPath !== undefined) { var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; return ts.removeFileExtension(relativePath); @@ -77676,7 +84651,7 @@ var ts; function getPathRelativeToRootDirs(path, rootDirs) { for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { var rootDir = rootDirs_2[_i]; - var relativeName = tryRemoveParentDirectoryName(path, rootDir); + var relativeName = getRelativePathIfInDirectory(path, rootDir); if (relativeName !== undefined) { return relativeName; } @@ -77690,25 +84665,23 @@ var ts; } return fileName; } + function getRelativePathIfInDirectory(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); + return ts.isRootedDiskPath(relativePath) || ts.startsWith(relativePath, "..") ? undefined : relativePath; + } function getRelativePath(path, directoryPath) { - var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; } - function tryRemoveParentDirectoryName(path, parentDirectory) { - var index = path.indexOf(parentDirectory); - if (index === 0) { - return ts.endsWith(parentDirectory, ts.directorySeparator) - ? path.substring(parentDirectory.length) - : path.substring(parentDirectory.length + 1); - } - return undefined; - } } } - function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + function createChangeTracker() { + return ts.textChanges.ChangeTracker.fromCodeFixContext(context); + } + function createCodeAction(description, diagnosticArgs, changes, kind, moduleSpecifier) { return { description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), - changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + changes: changes, kind: kind, moduleSpecifier: moduleSpecifier }; @@ -77723,155 +84696,275 @@ var ts; var codefix; (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - // this handles var ["computed"] = 12; - if (token.kind === 20 /* OpenBracketToken */) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70 /* Identifier */: - switch (token.parent.kind) { - case 223 /* VariableDeclaration */: - switch (token.parent.parent.parent.kind) { - case 211 /* ForStatement */: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213 /* ForOfStatement */: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212 /* ForInStatement */: - // There is no valid fix in the case of: - // for .. in - return undefined; - case 256 /* CatchClause */: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143 /* TypeParameter */: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144 /* Parameter */: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - // handle case where 'import a = A;' - case 234 /* ImportEqualsDeclaration */: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239 /* ImportSpecifier */: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - // Only 1 import and it is unused. So the entire declaration should be removed. - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - // handle case where "import d, * as ns from './file'" - // or "'import {a, b as ns} from './file'" - case 236 /* ImportClause */: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237 /* NamespaceImport */: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147 /* PropertyDeclaration */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237 /* NamespaceImport */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) { - importDecl = importDecl.parent; - } - return importDecl; + errorCodes: getApplicableDiagnosticCodes(), + getCodeActions: getDisableJsDiagnosticsCodeActions + }); + function getApplicableDiagnosticCodes() { + var allDiagnostcs = ts.Diagnostics; + return Object.keys(allDiagnostcs) + .filter(function (d) { return allDiagnostcs[d] && allDiagnostcs[d].category === ts.DiagnosticCategory.Error; }) + .map(function (d) { return allDiagnostcs[d].code; }); + } + function getIgnoreCommentLocationForLocation(sourceFile, position, newLineCharacter) { + var line = ts.getLineAndCharacterOfPosition(sourceFile, position).line; + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition); + // First try to see if we can put the '// @ts-ignore' on the previous line. + // We need to make sure that we are not in the middle of a string literal or a comment. + // We also want to check if the previous line holds a comment for a node on the next line + // if so, we do not want to separate the node from its comment if we can. + if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) { + var token = ts.getTouchingToken(sourceFile, startPosition); + var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile); + if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) { + return { + span: { start: startPosition, length: 0 }, + newText: "// @ts-ignore" + newLineCharacter + }; } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] + } + // If all fails, add an extra new line immediatlly before the error span. + return { + span: { start: position, length: 0 }, + newText: (position === startPosition ? "" : newLineCharacter) + "// @ts-ignore" + newLineCharacter + }; + } + function getDisableJsDiagnosticsCodeActions(context) { + var sourceFile = context.sourceFile, program = context.program, newLineCharacter = context.newLineCharacter, span = context.span; + if (!ts.isInJavaScriptFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { + return undefined; + } + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Ignore_this_error_message), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter)] + }] + }, + { + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Disable_checking_for_this_file), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { + start: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.pos : 0, + length: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.end - sourceFile.checkJsDirective.pos : 0 + }, + newText: "// @ts-nocheck" + newLineCharacter }] - }]; + }] + }]; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + function newNodesToChanges(newNodes, insertAfter, context) { + var sourceFile = context.sourceFile; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + for (var _i = 0, newNodes_1 = newNodes; _i < newNodes_1.length; _i++) { + var newNode = newNodes_1[_i]; + changeTracker.insertNodeAfter(sourceFile, insertAfter, newNode, { suffix: context.newLineCharacter }); + } + var changes = changeTracker.getChanges(); + if (!ts.some(changes)) { + return changes; + } + ts.Debug.assert(changes.length === 1); + var consolidatedChanges = [{ + fileName: changes[0].fileName, + textChanges: [{ + span: changes[0].textChanges[0].span, + newText: changes[0].textChanges.reduce(function (prev, cur) { return prev + cur.newText; }, "") + }] + }]; + return consolidatedChanges; + } + codefix.newNodesToChanges = newNodesToChanges; + /** + * Finds members of the resolved type that are missing in the class pointed to by class decl + * and generates source code for the missing members. + * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. + * @returns Empty string iff there are no member insertions. + */ + function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, checker) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); + var newNodes = []; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + var newNode = createNewNodeForMemberSymbol(symbol, classDeclaration, checker); + if (newNode) { + if (Array.isArray(newNode)) { + newNodes = newNodes.concat(newNode); + } + else { + newNodes.push(newNode); + } } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + return newNodes; + } + codefix.createMissingMemberNodes = createMissingMemberNodes; + /** + * @returns Empty string iff there we can't figure out a representation for `symbol` in `enclosingDeclaration`. + */ + function createNewNodeForMemberSymbol(symbol, enclosingDeclaration, checker) { + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return undefined; + } + var declaration = declarations[0]; + // Clone name to remove leading trivia. + var name = ts.getSynthesizedClone(declaration.name); + var visibilityModifier = createVisibilityModifier(ts.getModifierFlags(declaration)); + var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined; + var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); + var optional = !!(symbol.flags & 67108864 /* Optional */); + switch (declaration.kind) { + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 147 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + var typeNode = checker.typeToTypeNode(type, enclosingDeclaration); + var property = ts.createProperty( + /*decorators*/ undefined, modifiers, name, optional ? ts.createToken(54 /* QuestionToken */) : undefined, typeNode, + /*initializer*/ undefined); + return property; + case 149 /* MethodSignature */: + case 150 /* MethodDeclaration */: + // The signature for the implementation appears as an entry in `signatures` iff + // there is only one signature. + // If there are overloads and an implementation signature, it appears as an + // extra declaration that isn't a signature for `type`. + // If there is more than one overload but no implementation signature + // (eg: an abstract method or interface declaration), there is a 1-1 + // correspondence of declarations and signatures. + var signatures = checker.getSignaturesOfType(type, 0 /* Call */); + if (!ts.some(signatures)) { + return undefined; + } + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var signature = signatures[0]; + return signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + } + var signatureDeclarations = []; + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } + } + if (declarations.length > signatures.length) { + var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + var methodImplementingSignatures = createMethodImplementingSignatures(signatures, name, optional, modifiers); + signatureDeclarations.push(methodImplementingSignatures); } + return signatureDeclarations; + default: + return undefined; + } + function signatureToMethodDeclaration(signature, enclosingDeclaration, body) { + var signatureDeclaration = checker.signatureToSignatureDeclaration(signature, 150 /* MethodDeclaration */, enclosingDeclaration); + if (signatureDeclaration) { + signatureDeclaration.decorators = undefined; + signatureDeclaration.modifiers = modifiers; + signatureDeclaration.name = name; + signatureDeclaration.questionToken = optional ? ts.createToken(54 /* QuestionToken */) : undefined; + signatureDeclaration.body = body; } + return signatureDeclaration; } - }); + } + function createMethodImplementingSignatures(signatures, name, optional, modifiers) { + /** This is *a* signature with the maximal number of arguments, + * such that if there is a "maximal" signature without rest arguments, + * this is one of them. + */ + var maxArgsSignature = signatures[0]; + var minArgumentCount = signatures[0].minArgumentCount; + var someSigHasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + if (sig.hasRestParameter) { + someSigHasRestParameter = true; + } + if (sig.parameters.length >= maxArgsSignature.parameters.length && (!sig.hasRestParameter || maxArgsSignature.hasRestParameter)) { + maxArgsSignature = sig; + } + } + var maxNonRestArgs = maxArgsSignature.parameters.length - (maxArgsSignature.hasRestParameter ? 1 : 0); + var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.getName(); }); + var parameters = []; + for (var i = 0; i < maxNonRestArgs; i++) { + var anyType = ts.createKeywordTypeNode(118 /* AnyKeyword */); + var newParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, maxArgsParameterSymbolNames[i], + /*questionToken*/ i >= minArgumentCount ? ts.createToken(54 /* QuestionToken */) : undefined, anyType, + /*initializer*/ undefined); + parameters.push(newParameter); + } + if (someSigHasRestParameter) { + var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(118 /* AnyKeyword */)); + var restParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, ts.createToken(23 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.createToken(54 /* QuestionToken */) : undefined, anyArrayType, + /*initializer*/ undefined); + parameters.push(restParameter); + } + return createStubbedMethod(modifiers, name, optional, + /*typeParameters*/ undefined, parameters, + /*returnType*/ undefined); + } + function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType) { + return ts.createMethodDeclaration( + /*decorators*/ undefined, modifiers, + /*asteriskToken*/ undefined, name, optional ? ts.createToken(54 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, createStubbedMethodBody()); + } + codefix.createStubbedMethod = createStubbedMethod; + function createStubbedMethodBody() { + return ts.createBlock([ts.createThrow(ts.createNew(ts.createIdentifier("Error"), + /*typeArguments*/ undefined, [ts.createLiteral("Method not implemented.")]))], + /*multiline*/ true); + } + function createVisibilityModifier(flags) { + if (flags & 4 /* Public */) { + return ts.createToken(113 /* PublicKeyword */); + } + else if (flags & 16 /* Protected */) { + return ts.createToken(112 /* ProtectedKeyword */); + } + return undefined; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); -/// -/// -/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// /// /// /// @@ -77883,7 +84976,6 @@ var ts; /// /// /// -/// /// /// /// @@ -77897,14 +84989,15 @@ var ts; /// /// /// -/// +/// +/// /// var ts; (function (ts) { /** The version of the language service API */ ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) : + var node = kind >= 142 /* FirstNode */ ? new NodeObject(kind, pos, end) : kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -77962,11 +85055,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { - var node = nodes_7[_i]; + for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { + var node = nodes_9[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -77981,11 +85074,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141 /* FirstNode */) { + if (this.kind >= 142 /* FirstNode */) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 282 /* FirstJSDocTagNode */ && this.kind <= 292 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -78042,8 +85135,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 266 /* FirstJSDocNode */ || kid.kind > 292 /* LastJSDocNode */; }); + return child.kind < 142 /* FirstNode */ ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -78051,7 +85146,10 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 142 /* FirstNode */ ? child : child.getLastToken(sourceFile); + }; + NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { + return ts.forEachChild(this, cbNode, cbNodeArray); }; return NodeObject; }()); @@ -78105,6 +85203,9 @@ var ts; TokenOrIdentifierObject.prototype.getLastToken = function () { return undefined; }; + TokenOrIdentifierObject.prototype.forEachChild = function () { + return undefined; + }; return TokenOrIdentifierObject; }()); var SymbolObject = (function () { @@ -78127,6 +85228,12 @@ var ts; } return this.documentationComment; }; + SymbolObject.prototype.getJsDocTags = function () { + if (this.tags === undefined) { + this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations); + } + return this.tags; + }; return SymbolObject; }()); var TokenObject = (function (_super) { @@ -78210,6 +85317,12 @@ var ts; } return this.documentationComment; }; + SignatureObject.prototype.getJsDocTags = function () { + if (this.jsDocTags === undefined) { + this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : []; + } + return this.jsDocTags; + }; return SignatureObject; }()); var SourceFileObject = (function (_super) { @@ -78250,17 +85363,21 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { @@ -78268,9 +85385,9 @@ var ts; if (result_7 !== undefined) { return result_7; } - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -78290,10 +85407,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -78310,35 +85427,35 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 161 /* TypeLiteral */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 162 /* TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Only consider parameter properties if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) { break; } - // fall through - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: { + // falls through + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -78347,19 +85464,20 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + // falls through + case 263 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: addDeclaration(node); break; - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -78371,7 +85489,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -78620,6 +85738,36 @@ var ts; }; return CancellationTokenObject; }()); + /* @internal */ + /** A cancellation that throttles calls to the host */ + var ThrottledCancellationToken = (function () { + function ThrottledCancellationToken(hostCancellationToken, throttleWaitMilliseconds) { + if (throttleWaitMilliseconds === void 0) { throttleWaitMilliseconds = 20; } + this.hostCancellationToken = hostCancellationToken; + this.throttleWaitMilliseconds = throttleWaitMilliseconds; + // Store when we last tried to cancel. Checking cancellation can be expensive (as we have + // to marshall over to the host layer). So we only bother actually checking once enough + // time has passed. + this.lastCancellationCheckTime = 0; + } + ThrottledCancellationToken.prototype.isCancellationRequested = function () { + var time = ts.timestamp(); + var duration = Math.abs(time - this.lastCancellationCheckTime); + if (duration >= this.throttleWaitMilliseconds) { + // Check no more than once every throttle wait milliseconds + this.lastCancellationCheckTime = time; + return this.hostCancellationToken.isCancellationRequested(); + } + return false; + }; + ThrottledCancellationToken.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new ts.OperationCanceledException(); + } + }; + return ThrottledCancellationToken; + }()); + ts.ThrottledCancellationToken = ThrottledCancellationToken; function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -78801,6 +85949,7 @@ var ts; ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } + // We didn't already have the file. Fall through and acquire it from the registry. } // Could not find this file in the old program, create a new SourceFile for it. return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); @@ -78901,10 +86050,10 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 96 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -78914,7 +86063,8 @@ var ts; kindModifiers: ts.ScriptElementKindModifier.none, textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)), - documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined, + tags: type.symbol ? type.symbol.getJsDocTags() : undefined }; } } @@ -78926,7 +86076,8 @@ var ts; kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: displayPartsDocumentationsAndKind.displayParts, - documentation: displayPartsDocumentationsAndKind.documentation + documentation: displayPartsDocumentationsAndKind.documentation, + tags: displayPartsDocumentationsAndKind.tags }; } /// Goto definition @@ -78934,22 +86085,23 @@ var ts; synchronizeHostData(); return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position); } - /// Goto implementation - function getImplementationAtPosition(fileName, position) { - synchronizeHostData(); - return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position)); - } function getTypeDefinitionAtPosition(fileName, position) { synchronizeHostData(); return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position); } + /// Goto implementation + function getImplementationAtPosition(fileName, position) { + synchronizeHostData(); + return ts.FindAllReferences.getImplementationsAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); + } + /// References and Occurrences function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); } return results; } @@ -78959,9 +86111,7 @@ var ts; var sourceFile = getValidSourceFile(fileName); return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch); } - /// References and Occurrences function getOccurrencesAtPositionCore(fileName, position) { - synchronizeHostData(); return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName])); function convertDocumentHighlights(documentHighlights) { if (!documentHighlights) { @@ -78976,7 +86126,8 @@ var ts; fileName: entry.fileName, textSpan: highlightSpan.textSpan, isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference, - isDefinition: false + isDefinition: false, + isInString: highlightSpan.isInString, }); } } @@ -78984,21 +86135,18 @@ var ts; } } function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); - return ts.FindAllReferences.convertReferences(referencedSymbols); + return getReferences(fileName, position, { findInStrings: findInStrings, findInComments: findInComments, isForRename: true }); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); - return ts.FindAllReferences.convertReferences(referencedSymbols); + return getReferences(fileName, position); } - function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); - // Only include referenced symbols that have a valid definition. - return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); + function getReferences(fileName, position, options) { + synchronizeHostData(); + return ts.FindAllReferences.findReferencedEntries(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, options); } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + function findReferences(fileName, position) { synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); } /// NavigateTo function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { @@ -79017,7 +86165,8 @@ var ts; text: data }); } - var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles); + var customTransformers = host.getCustomTransformers && host.getCustomTransformers(); + var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); return { outputFiles: outputFiles, emitSkipped: emitOutput.emitSkipped @@ -79047,15 +86196,15 @@ var ts; return; } switch (node.kind) { - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 9 /* StringLiteral */: case 85 /* FalseKeyword */: case 100 /* TrueKeyword */: case 94 /* NullKeyword */: case 96 /* SuperKeyword */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 70 /* Identifier */: break; // Cant create the text span @@ -79072,7 +86221,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 230 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 232 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -79095,10 +86244,10 @@ var ts; return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); } function getNavigationBarItems(fileName) { - return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName)); + return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); } function getNavigationTree(fileName) { - return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName)); + return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); } function isTsOrTsxFile(fileName) { var kind = ts.getScriptKind(fileName, host); @@ -79131,7 +86280,7 @@ var ts; function getOutliningSpans(fileName) { // doesn't use compiler - no need to synchronize with host var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.OutliningElementsCollector.collectElements(sourceFile); + return ts.OutliningElementsCollector.collectElements(sourceFile, cancellationToken); } function getBraceMatchingAtPosition(fileName, position) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); @@ -79209,13 +86358,13 @@ var ts; } return []; } - function getCodeFixesAtPosition(fileName, start, end, errorCodes) { + function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var span = { start: start, length: end - start }; var newLineChar = ts.getNewLineOrDefaultFromHost(host); var allFixes = []; - ts.forEach(errorCodes, function (error) { + ts.forEach(ts.deduplicate(errorCodes), function (error) { cancellationToken.throwIfCancellationRequested(); var context = { errorCode: error, @@ -79224,7 +86373,8 @@ var ts; program: program, newLineCharacter: newLineChar, host: host, - cancellationToken: cancellationToken + cancellationToken: cancellationToken, + rulesProvider: getRuleProvider(formatOptions) }; var fixes = ts.codefix.getFixes(context); if (fixes) { @@ -79248,7 +86398,7 @@ var ts; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -79304,7 +86454,7 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + for (var i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -79435,6 +86585,7 @@ var ts; } ts.createLanguageService = createLanguageService; /* @internal */ + /** Names in the name table are escaped, so an identifier `__foo` will have a name table entry `___foo`. */ function getNameTable(sourceFile) { if (!sourceFile.nameTable) { initializeNameTable(sourceFile); @@ -79449,7 +86600,7 @@ var ts; function walk(node) { switch (node.kind) { case 70 /* Identifier */: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); break; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -79458,10 +86609,10 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 245 /* ExternalModuleReference */ || + node.parent.kind === 247 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); } break; default: @@ -79474,18 +86625,79 @@ var ts; } } } + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); + } } + function isObjectLiteralElement(node) { + switch (node.kind) { + case 252 /* JsxAttribute */: + case 254 /* JsxSpreadAttribute */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return true; + } + return false; + } + /** + * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } + */ + /* @internal */ + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + if (node.parent.kind === 143 /* ComputedPropertyName */) { + return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; + } + // falls through + case 70 /* Identifier */: + return isObjectLiteralElement(node.parent) && + (node.parent.parent.kind === 177 /* ObjectLiteralExpression */ || node.parent.parent.kind === 253 /* JsxAttributes */) && + node.parent.name === node ? node.parent : undefined; + } + return undefined; + } + ts.getContainingObjectLiteralElement = getContainingObjectLiteralElement; + /* @internal */ + function getPropertySymbolsFromContextualType(typeChecker, node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = ts.getTextOfPropertyName(node.name); + if (name && contextualType) { + var result_8 = []; + var symbol = contextualType.getProperty(name); + if (contextualType.flags & 65536 /* Union */) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_8.push(symbol); + } + }); + return result_8; + } + if (symbol) { + result_8.push(symbol); + return result_8; + } + } + return undefined; + } + ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 178 /* ElementAccessExpression */ && + node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** - * Get the path of the default library files (lib.d.ts) as distributed with the typescript - * node package. - * The functionality is not supported if the ts module is consumed outside of a node module. - */ + * Get the path of the default library files (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ function getDefaultLibFilePath(options) { // Check __dirname is defined and that we are on a node.js system. if (typeof __dirname !== "undefined") { @@ -79494,10 +86706,7 @@ var ts; throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); } ts.getDefaultLibFilePath = getDefaultLibFilePath; - function initializeServices() { - ts.objectAllocator = getServicesObjectAllocator(); - } - initializeServices(); + ts.objectAllocator = getServicesObjectAllocator(); })(ts || (ts = {})); // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -79562,113 +86771,114 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223 /* VariableDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 225 /* VariableDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return spanInVariableDeclaration(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return spanInParameterDeclaration(node); - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 204 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - // Fall through - case 231 /* ModuleBlock */: + // falls through + case 233 /* ModuleBlock */: return spanInBlock(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return spanInBlock(node.block); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 209 /* DoStatement */: + case 211 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 222 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 208 /* IfStatement */: + case 210 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return spanInForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 213 /* ForOfStatement */: + case 215 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 256 /* CaseClause */: + case 257 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 221 /* TryStatement */: + case 223 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 174 /* BindingElement */: + // falls through + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 263 /* EnumMember */: + case 175 /* BindingElement */: // span on complete node return textSpan(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 145 /* Decorator */: + case 146 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return undefined; // Tokens: case 24 /* SemicolonToken */: @@ -79698,7 +86908,7 @@ var ts; case 73 /* CatchKeyword */: case 86 /* FinallyKeyword */: return spanInNextNode(node); - case 140 /* OfKeyword */: + case 141 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -79711,13 +86921,13 @@ var ts; // a or ...c or d: x from // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 70 /* Identifier */ || - node.kind == 196 /* SpreadElement */ || - node.kind === 257 /* PropertyAssignment */ || - node.kind === 258 /* ShorthandPropertyAssignment */) && + node.kind === 197 /* SpreadElement */ || + node.kind === 260 /* PropertyAssignment */ || + node.kind === 261 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192 /* BinaryExpression */) { + if (node.kind === 193 /* BinaryExpression */) { var binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -79740,22 +86950,22 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209 /* DoStatement */: + case 211 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 145 /* Decorator */: + case 146 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return textSpan(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (node.parent.operatorToken.kind === 25 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -79764,13 +86974,13 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 257 /* PropertyAssignment */ && + if (node.parent.kind === 260 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 182 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 183 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNextNode(node.parent.type); } // return type of function go to previous token @@ -79778,8 +86988,8 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 223 /* VariableDeclaration */ || - node.parent.kind === 144 /* Parameter */)) { + if ((node.parent.kind === 225 /* VariableDeclaration */ || + node.parent.kind === 145 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -79787,7 +86997,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192 /* BinaryExpression */) { + if (node.parent.kind === 193 /* BinaryExpression */) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -79801,8 +87011,8 @@ var ts; } } function textSpanFromVariableDeclaration(variableDeclaration) { - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] === variableDeclaration) { + if (variableDeclaration.parent.kind === 226 /* VariableDeclarationList */ && + variableDeclaration.parent.declarations[0] === variableDeclaration) { // First declaration - include let keyword return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); } @@ -79813,7 +87023,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 212 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 214 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -79824,11 +87034,11 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 213 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 215 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] !== variableDeclaration) { + if (variableDeclaration.parent.kind === 226 /* VariableDeclarationList */ && + variableDeclaration.parent.declarations[0] !== variableDeclaration) { // If we cannot set breakpoint on this declaration, set it on previous one // Because the variable declaration may be binding pattern and // we would like to set breakpoint in last binding element if that's the case, @@ -79864,7 +87074,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 226 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); + (functionDeclaration.parent.kind === 228 /* ClassDeclaration */ && functionDeclaration.kind !== 151 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -79887,25 +87097,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } + // falls through // Set on parent if on same line otherwise on first statement - case 210 /* WhileStatement */: - case 208 /* IfStatement */: - case 212 /* ForInStatement */: + case 212 /* WhileStatement */: + case 210 /* IfStatement */: + case 214 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 226 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -79930,23 +87141,23 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 174 /* BindingElement */) { + if (bindingPattern.parent.kind === 175 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 /* ArrayBindingPattern */ && node.kind !== 172 /* ObjectBindingPattern */); - var elements = node.kind === 175 /* ArrayLiteralExpression */ ? + ts.Debug.assert(node.kind !== 174 /* ArrayBindingPattern */ && node.kind !== 173 /* ObjectBindingPattern */); + var elements = node.kind === 176 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -79954,18 +87165,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 192 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 193 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -79973,24 +87184,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 229 /* EnumDeclaration */: - case 226 /* ClassDeclaration */: + // falls through + case 231 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 204 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } - // fall through - case 256 /* CatchClause */: + // falls through + case 259 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -79998,7 +87210,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -80014,7 +87226,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -80029,12 +87241,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 /* DoStatement */ || - node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 211 /* DoStatement */ || + node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 183 /* ParenthesizedExpression */) { + if (node.parent.kind === 184 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -80043,21 +87255,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 183 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 184 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -80067,20 +87279,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 /* PropertyAssignment */ || - node.parent.kind === 144 /* Parameter */) { + node.parent.kind === 260 /* PropertyAssignment */ || + node.parent.kind === 145 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182 /* TypeAssertionExpression */) { + if (node.parent.kind === 183 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209 /* DoStatement */) { + if (node.parent.kind === 211 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -80088,7 +87300,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213 /* ForOfStatement */) { + if (node.parent.kind === 215 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -80100,6 +87312,26 @@ var ts; BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation; })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})); })(ts || (ts = {})); +/// +/// +var ts; +(function (ts) { + /** + * Transform one or more nodes using the supplied transformers. + * @param source A single `Node` or an array of `Node` objects. + * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. + * @param compilerOptions Optional compiler options. + */ + function transform(source, transformers, compilerOptions) { + var diagnostics = []; + compilerOptions = ts.fixupCompilerOptions(compilerOptions, diagnostics); + var nodes = ts.isArray(source) ? source : [source]; + var result = ts.transformNodes(/*resolver*/ undefined, /*emitHost*/ undefined, compilerOptions, nodes, transformers, /*allowDtsFiles*/ true); + result.diagnostics = ts.concatenate(result.diagnostics, diagnostics); + return result; + } + ts.transform = transform; +})(ts || (ts = {})); // // Copyright (c) Microsoft Corporation. All rights reserved. // @@ -80141,8 +87373,7 @@ var ts; ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { var oldSnapshotShim = oldSnapshot; var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); - // TODO: should this be '==='? - if (encoded == null) { + if (encoded === null) { return null; } var decoded = JSON.parse(encoded); @@ -80215,11 +87446,13 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); - // TODO: should this be '==='? - if (settingsJson == null || settingsJson == "") { + if (settingsJson === null || settingsJson === "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } - return JSON.parse(settingsJson); + var compilerOptions = JSON.parse(settingsJson); + // permit language service to handle all files (filtering should be performed on the host side) + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; }; LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); @@ -80242,7 +87475,7 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); - if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") { return null; } try { @@ -80255,7 +87488,7 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { var hostCancellationToken = this.shimHost.getCancellationToken(); - return new ThrottledCancellationToken(hostCancellationToken); + return new ts.ThrottledCancellationToken(hostCancellationToken); }; LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { return this.shimHost.getCurrentDirectory(); @@ -80279,27 +87512,6 @@ var ts; return LanguageServiceShimHostAdapter; }()); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; - /** A cancellation that throttles calls to the host */ - var ThrottledCancellationToken = (function () { - function ThrottledCancellationToken(hostCancellationToken) { - this.hostCancellationToken = hostCancellationToken; - // Store when we last tried to cancel. Checking cancellation can be expensive (as we have - // to marshall over to the host layer). So we only bother actually checking once enough - // time has passed. - this.lastCancellationCheckTime = 0; - } - ThrottledCancellationToken.prototype.isCancellationRequested = function () { - var time = ts.timestamp(); - var duration = Math.abs(time - this.lastCancellationCheckTime); - if (duration > 10) { - // Check no more than once every 10 ms. - this.lastCancellationCheckTime = time; - return this.hostCancellationToken.isCancellationRequested(); - } - return false; - }; - return ThrottledCancellationToken; - }()); var CoreServicesShimHostAdapter = (function () { function CoreServicesShimHostAdapter(shimHost) { var _this = this; @@ -80727,12 +87939,6 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] - }; - } return { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations @@ -80877,7 +88083,7 @@ var ts; this._shims.push(shim); }; TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (var i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; @@ -80906,4 +88112,4 @@ var TypeScript; // 'toolsVersion' gets consumed by the managed side, so it's not unused. // TODO: it should be moved into a namespace though. /* @internal */ -var toolsVersion = "2.2"; +var toolsVersion = "2.3"; diff --git a/node_modules/typescript/lib/typescriptServices.d.ts b/node_modules/typescript/lib/typescriptServices.d.ts index ecd018623..e47dfbe31 100644 --- a/node_modules/typescript/lib/typescriptServices.d.ts +++ b/node_modules/typescript/lib/typescriptServices.d.ts @@ -14,11 +14,36 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { + /** + * Type of objects whose values are all of the same type. + * The `in` and `for-in` operators can *not* be safely used, + * since `Object.prototype` may be modified by outside code. + */ interface MapLike { [index: string]: T; } - interface Map extends MapLike { - __mapBrand: any; + /** ES6 Map interface. */ + interface Map { + get(key: string): T; + has(key: string): boolean; + set(key: string, value: T): this; + delete(key: string): boolean; + clear(): void; + forEach(action: (value: T, key: string) => void): void; + readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, T]>; + } + /** ES6 Iterator type. */ + interface Iterator { + next(): { + value: T; + done: false; + } | { + value: never; + done: true; + }; } type Path = string & { __pathBrand: any; @@ -170,171 +195,171 @@ declare namespace ts { ReadonlyKeyword = 130, RequireKeyword = 131, NumberKeyword = 132, - SetKeyword = 133, - StringKeyword = 134, - SymbolKeyword = 135, - TypeKeyword = 136, - UndefinedKeyword = 137, - FromKeyword = 138, - GlobalKeyword = 139, - OfKeyword = 140, - QualifiedName = 141, - ComputedPropertyName = 142, - TypeParameter = 143, - Parameter = 144, - Decorator = 145, - PropertySignature = 146, - PropertyDeclaration = 147, - MethodSignature = 148, - MethodDeclaration = 149, - Constructor = 150, - GetAccessor = 151, - SetAccessor = 152, - CallSignature = 153, - ConstructSignature = 154, - IndexSignature = 155, - TypePredicate = 156, - TypeReference = 157, - FunctionType = 158, - ConstructorType = 159, - TypeQuery = 160, - TypeLiteral = 161, - ArrayType = 162, - TupleType = 163, - UnionType = 164, - IntersectionType = 165, - ParenthesizedType = 166, - ThisType = 167, - TypeOperator = 168, - IndexedAccessType = 169, - MappedType = 170, - LiteralType = 171, - ObjectBindingPattern = 172, - ArrayBindingPattern = 173, - BindingElement = 174, - ArrayLiteralExpression = 175, - ObjectLiteralExpression = 176, - PropertyAccessExpression = 177, - ElementAccessExpression = 178, - CallExpression = 179, - NewExpression = 180, - TaggedTemplateExpression = 181, - TypeAssertionExpression = 182, - ParenthesizedExpression = 183, - FunctionExpression = 184, - ArrowFunction = 185, - DeleteExpression = 186, - TypeOfExpression = 187, - VoidExpression = 188, - AwaitExpression = 189, - PrefixUnaryExpression = 190, - PostfixUnaryExpression = 191, - BinaryExpression = 192, - ConditionalExpression = 193, - TemplateExpression = 194, - YieldExpression = 195, - SpreadElement = 196, - ClassExpression = 197, - OmittedExpression = 198, - ExpressionWithTypeArguments = 199, - AsExpression = 200, - NonNullExpression = 201, - TemplateSpan = 202, - SemicolonClassElement = 203, - Block = 204, - VariableStatement = 205, - EmptyStatement = 206, - ExpressionStatement = 207, - IfStatement = 208, - DoStatement = 209, - WhileStatement = 210, - ForStatement = 211, - ForInStatement = 212, - ForOfStatement = 213, - ContinueStatement = 214, - BreakStatement = 215, - ReturnStatement = 216, - WithStatement = 217, - SwitchStatement = 218, - LabeledStatement = 219, - ThrowStatement = 220, - TryStatement = 221, - DebuggerStatement = 222, - VariableDeclaration = 223, - VariableDeclarationList = 224, - FunctionDeclaration = 225, - ClassDeclaration = 226, - InterfaceDeclaration = 227, - TypeAliasDeclaration = 228, - EnumDeclaration = 229, - ModuleDeclaration = 230, - ModuleBlock = 231, - CaseBlock = 232, - NamespaceExportDeclaration = 233, - ImportEqualsDeclaration = 234, - ImportDeclaration = 235, - ImportClause = 236, - NamespaceImport = 237, - NamedImports = 238, - ImportSpecifier = 239, - ExportAssignment = 240, - ExportDeclaration = 241, - NamedExports = 242, - ExportSpecifier = 243, - MissingDeclaration = 244, - ExternalModuleReference = 245, - JsxElement = 246, - JsxSelfClosingElement = 247, - JsxOpeningElement = 248, - JsxClosingElement = 249, - JsxAttribute = 250, - JsxSpreadAttribute = 251, - JsxExpression = 252, - CaseClause = 253, - DefaultClause = 254, - HeritageClause = 255, - CatchClause = 256, - PropertyAssignment = 257, - ShorthandPropertyAssignment = 258, - SpreadAssignment = 259, - EnumMember = 260, - SourceFile = 261, - JSDocTypeExpression = 262, - JSDocAllType = 263, - JSDocUnknownType = 264, - JSDocArrayType = 265, - JSDocUnionType = 266, - JSDocTupleType = 267, - JSDocNullableType = 268, - JSDocNonNullableType = 269, - JSDocRecordType = 270, - JSDocRecordMember = 271, - JSDocTypeReference = 272, - JSDocOptionalType = 273, - JSDocFunctionType = 274, - JSDocVariadicType = 275, - JSDocConstructorType = 276, - JSDocThisType = 277, - JSDocComment = 278, - JSDocTag = 279, - JSDocAugmentsTag = 280, - JSDocParameterTag = 281, - JSDocReturnTag = 282, - JSDocTypeTag = 283, - JSDocTemplateTag = 284, - JSDocTypedefTag = 285, - JSDocPropertyTag = 286, - JSDocTypeLiteral = 287, - JSDocLiteralType = 288, - JSDocNullKeyword = 289, - JSDocUndefinedKeyword = 290, - JSDocNeverKeyword = 291, - SyntaxList = 292, - NotEmittedStatement = 293, - PartiallyEmittedExpression = 294, - MergeDeclarationMarker = 295, - EndOfDeclarationMarker = 296, - RawExpression = 297, + ObjectKeyword = 133, + SetKeyword = 134, + StringKeyword = 135, + SymbolKeyword = 136, + TypeKeyword = 137, + UndefinedKeyword = 138, + FromKeyword = 139, + GlobalKeyword = 140, + OfKeyword = 141, + QualifiedName = 142, + ComputedPropertyName = 143, + TypeParameter = 144, + Parameter = 145, + Decorator = 146, + PropertySignature = 147, + PropertyDeclaration = 148, + MethodSignature = 149, + MethodDeclaration = 150, + Constructor = 151, + GetAccessor = 152, + SetAccessor = 153, + CallSignature = 154, + ConstructSignature = 155, + IndexSignature = 156, + TypePredicate = 157, + TypeReference = 158, + FunctionType = 159, + ConstructorType = 160, + TypeQuery = 161, + TypeLiteral = 162, + ArrayType = 163, + TupleType = 164, + UnionType = 165, + IntersectionType = 166, + ParenthesizedType = 167, + ThisType = 168, + TypeOperator = 169, + IndexedAccessType = 170, + MappedType = 171, + LiteralType = 172, + ObjectBindingPattern = 173, + ArrayBindingPattern = 174, + BindingElement = 175, + ArrayLiteralExpression = 176, + ObjectLiteralExpression = 177, + PropertyAccessExpression = 178, + ElementAccessExpression = 179, + CallExpression = 180, + NewExpression = 181, + TaggedTemplateExpression = 182, + TypeAssertionExpression = 183, + ParenthesizedExpression = 184, + FunctionExpression = 185, + ArrowFunction = 186, + DeleteExpression = 187, + TypeOfExpression = 188, + VoidExpression = 189, + AwaitExpression = 190, + PrefixUnaryExpression = 191, + PostfixUnaryExpression = 192, + BinaryExpression = 193, + ConditionalExpression = 194, + TemplateExpression = 195, + YieldExpression = 196, + SpreadElement = 197, + ClassExpression = 198, + OmittedExpression = 199, + ExpressionWithTypeArguments = 200, + AsExpression = 201, + NonNullExpression = 202, + MetaProperty = 203, + TemplateSpan = 204, + SemicolonClassElement = 205, + Block = 206, + VariableStatement = 207, + EmptyStatement = 208, + ExpressionStatement = 209, + IfStatement = 210, + DoStatement = 211, + WhileStatement = 212, + ForStatement = 213, + ForInStatement = 214, + ForOfStatement = 215, + ContinueStatement = 216, + BreakStatement = 217, + ReturnStatement = 218, + WithStatement = 219, + SwitchStatement = 220, + LabeledStatement = 221, + ThrowStatement = 222, + TryStatement = 223, + DebuggerStatement = 224, + VariableDeclaration = 225, + VariableDeclarationList = 226, + FunctionDeclaration = 227, + ClassDeclaration = 228, + InterfaceDeclaration = 229, + TypeAliasDeclaration = 230, + EnumDeclaration = 231, + ModuleDeclaration = 232, + ModuleBlock = 233, + CaseBlock = 234, + NamespaceExportDeclaration = 235, + ImportEqualsDeclaration = 236, + ImportDeclaration = 237, + ImportClause = 238, + NamespaceImport = 239, + NamedImports = 240, + ImportSpecifier = 241, + ExportAssignment = 242, + ExportDeclaration = 243, + NamedExports = 244, + ExportSpecifier = 245, + MissingDeclaration = 246, + ExternalModuleReference = 247, + JsxElement = 248, + JsxSelfClosingElement = 249, + JsxOpeningElement = 250, + JsxClosingElement = 251, + JsxAttribute = 252, + JsxAttributes = 253, + JsxSpreadAttribute = 254, + JsxExpression = 255, + CaseClause = 256, + DefaultClause = 257, + HeritageClause = 258, + CatchClause = 259, + PropertyAssignment = 260, + ShorthandPropertyAssignment = 261, + SpreadAssignment = 262, + EnumMember = 263, + SourceFile = 264, + Bundle = 265, + JSDocTypeExpression = 266, + JSDocAllType = 267, + JSDocUnknownType = 268, + JSDocArrayType = 269, + JSDocUnionType = 270, + JSDocTupleType = 271, + JSDocNullableType = 272, + JSDocNonNullableType = 273, + JSDocRecordType = 274, + JSDocRecordMember = 275, + JSDocTypeReference = 276, + JSDocOptionalType = 277, + JSDocFunctionType = 278, + JSDocVariadicType = 279, + JSDocConstructorType = 280, + JSDocThisType = 281, + JSDocComment = 282, + JSDocTag = 283, + JSDocAugmentsTag = 284, + JSDocParameterTag = 285, + JSDocReturnTag = 286, + JSDocTypeTag = 287, + JSDocTemplateTag = 288, + JSDocTypedefTag = 289, + JSDocPropertyTag = 290, + JSDocTypeLiteral = 291, + JSDocLiteralType = 292, + SyntaxList = 293, + NotEmittedStatement = 294, + PartiallyEmittedExpression = 295, + MergeDeclarationMarker = 296, + EndOfDeclarationMarker = 297, Count = 298, FirstAssignment = 57, LastAssignment = 69, @@ -343,15 +368,15 @@ declare namespace ts { FirstReservedWord = 71, LastReservedWord = 106, FirstKeyword = 71, - LastKeyword = 140, + LastKeyword = 141, FirstFutureReservedWord = 107, LastFutureReservedWord = 115, - FirstTypeNode = 156, - LastTypeNode = 171, + FirstTypeNode = 157, + LastTypeNode = 172, FirstPunctuation = 16, LastPunctuation = 69, FirstToken = 0, - LastToken = 140, + LastToken = 141, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -360,11 +385,11 @@ declare namespace ts { LastTemplateToken = 15, FirstBinaryOperator = 26, LastBinaryOperator = 69, - FirstNode = 141, - FirstJSDocNode = 262, - LastJSDocNode = 288, - FirstJSDocTagNode = 278, - LastJSDocTagNode = 291, + FirstNode = 142, + FirstJSDocNode = 266, + LastJSDocNode = 292, + FirstJSDocTagNode = 282, + LastJSDocTagNode = 292, } enum NodeFlags { None = 0, @@ -378,26 +403,20 @@ declare namespace ts { HasImplicitReturn = 128, HasExplicitReturn = 256, GlobalAugmentation = 512, - HasClassExtends = 1024, - HasDecorators = 2048, - HasParamDecorators = 4096, - HasAsyncFunctions = 8192, - HasSpreadAttribute = 16384, - HasRestAttribute = 32768, - DisallowInContext = 65536, - YieldContext = 131072, - DecoratorContext = 262144, - AwaitContext = 524288, - ThisNodeHasError = 1048576, - JavaScriptFile = 2097152, - ThisNodeOrAnySubNodesHasError = 4194304, - HasAggregatedChildData = 8388608, + HasAsyncFunctions = 1024, + DisallowInContext = 2048, + YieldContext = 4096, + DecoratorContext = 8192, + AwaitContext = 16384, + ThisNodeHasError = 32768, + JavaScriptFile = 65536, + ThisNodeOrAnySubNodesHasError = 131072, + HasAggregatedChildData = 262144, BlockScoped = 3, ReachabilityCheckFlags = 384, - EmitHelperFlags = 64512, - ReachabilityAndEmitFlags = 64896, - ContextFlags = 3080192, - TypeExcludesFlags = 655360, + ReachabilityAndEmitFlags = 1408, + ContextFlags = 96256, + TypeExcludesFlags = 20480, } enum ModifierFlags { None = 0, @@ -449,6 +468,7 @@ declare namespace ts { type EndOfFileToken = Token; type AtToken = Token; type ReadonlyToken = Token; + type AwaitKeywordToken = Token; type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; type ModifiersArray = NodeArray; interface Identifier extends PrimaryExpression { @@ -485,8 +505,10 @@ declare namespace ts { } interface TypeParameterDeclaration extends Declaration { kind: SyntaxKind.TypeParameter; + parent?: DeclarationWithTypeParameters; name: Identifier; constraint?: TypeNode; + default?: TypeNode; expression?: Expression; } interface SignatureDeclaration extends Declaration { @@ -504,17 +526,19 @@ declare namespace ts { type BindingName = Identifier | BindingPattern; interface VariableDeclaration extends Declaration { kind: SyntaxKind.VariableDeclaration; - parent?: VariableDeclarationList; + parent?: VariableDeclarationList | CatchClause; name: BindingName; type?: TypeNode; initializer?: Expression; } interface VariableDeclarationList extends Node { kind: SyntaxKind.VariableDeclarationList; + parent?: VariableStatement | ForStatement | ForOfStatement | ForInStatement; declarations: NodeArray; } interface ParameterDeclaration extends Declaration { kind: SyntaxKind.Parameter; + parent?: SignatureDeclaration; dotDotDotToken?: DotDotDotToken; name: BindingName; questionToken?: QuestionToken; @@ -523,6 +547,7 @@ declare namespace ts { } interface BindingElement extends Declaration { kind: SyntaxKind.BindingElement; + parent?: BindingPattern; propertyName?: PropertyName; dotDotDotToken?: DotDotDotToken; name: BindingName; @@ -546,7 +571,7 @@ declare namespace ts { _objectLiteralBrandBrand: any; name?: PropertyName; } - type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment; + type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration; interface PropertyAssignment extends ObjectLiteralElement { kind: SyntaxKind.PropertyAssignment; name: PropertyName; @@ -577,10 +602,12 @@ declare namespace ts { } interface ObjectBindingPattern extends Node { kind: SyntaxKind.ObjectBindingPattern; + parent?: VariableDeclaration | ParameterDeclaration | BindingElement; elements: NodeArray; } interface ArrayBindingPattern extends Node { kind: SyntaxKind.ArrayBindingPattern; + parent?: VariableDeclaration | ParameterDeclaration | BindingElement; elements: NodeArray; } type BindingPattern = ObjectBindingPattern | ArrayBindingPattern; @@ -615,41 +642,45 @@ declare namespace ts { } interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { kind: SyntaxKind.Constructor; + parent?: ClassDeclaration | ClassExpression; body?: FunctionBody; } + /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ interface SemicolonClassElement extends ClassElement { kind: SyntaxKind.SemicolonClassElement; + parent?: ClassDeclaration | ClassExpression; } interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.GetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.SetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { kind: SyntaxKind.IndexSignature; + parent?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode; } interface TypeNode extends Node { _typeNodeBrand: any; } interface KeywordTypeNode extends TypeNode { - kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.VoidKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.NullKeyword | SyntaxKind.NeverKeyword; } interface ThisTypeNode extends TypeNode { kind: SyntaxKind.ThisType; } - interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { - kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; - } - interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + type FunctionOrConstructorTypeNode = FunctionTypeNode | ConstructorTypeNode; + interface FunctionTypeNode extends TypeNode, SignatureDeclaration { kind: SyntaxKind.FunctionType; } - interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + interface ConstructorTypeNode extends TypeNode, SignatureDeclaration { kind: SyntaxKind.ConstructorType; } interface TypeReferenceNode extends TypeNode { @@ -678,15 +709,14 @@ declare namespace ts { kind: SyntaxKind.TupleType; elementTypes: NodeArray; } - interface UnionOrIntersectionTypeNode extends TypeNode { - kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType; - types: NodeArray; - } - interface UnionTypeNode extends UnionOrIntersectionTypeNode { + type UnionOrIntersectionTypeNode = UnionTypeNode | IntersectionTypeNode; + interface UnionTypeNode extends TypeNode { kind: SyntaxKind.UnionType; + types: NodeArray; } - interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { + interface IntersectionTypeNode extends TypeNode { kind: SyntaxKind.IntersectionType; + types: NodeArray; } interface ParenthesizedTypeNode extends TypeNode { kind: SyntaxKind.ParenthesizedType; @@ -704,6 +734,7 @@ declare namespace ts { } interface MappedTypeNode extends TypeNode, Declaration { kind: SyntaxKind.MappedType; + parent?: TypeAliasDeclaration; readonlyToken?: ReadonlyToken; typeParameter: TypeParameterDeclaration; questionToken?: QuestionToken; @@ -718,11 +749,14 @@ declare namespace ts { } interface Expression extends Node { _expressionBrand: any; - contextualType?: Type; } interface OmittedExpression extends Expression { kind: SyntaxKind.OmittedExpression; } + interface PartiallyEmittedExpression extends LeftHandSideExpression { + kind: SyntaxKind.PartiallyEmittedExpression; + expression: Expression; + } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } @@ -750,13 +784,13 @@ declare namespace ts { interface PrimaryExpression extends MemberExpression { _primaryExpressionBrand: any; } - interface NullLiteral extends PrimaryExpression { + interface NullLiteral extends PrimaryExpression, TypeNode { kind: SyntaxKind.NullKeyword; } - interface BooleanLiteral extends PrimaryExpression { + interface BooleanLiteral extends PrimaryExpression, TypeNode { kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword; } - interface ThisExpression extends PrimaryExpression { + interface ThisExpression extends PrimaryExpression, KeywordTypeNode { kind: SyntaxKind.ThisKeyword; } interface SuperExpression extends PrimaryExpression { @@ -864,16 +898,18 @@ declare namespace ts { } interface NumericLiteral extends LiteralExpression { kind: SyntaxKind.NumericLiteral; - trailingComment?: string; } interface TemplateHead extends LiteralLikeNode { kind: SyntaxKind.TemplateHead; + parent?: TemplateExpression; } interface TemplateMiddle extends LiteralLikeNode { kind: SyntaxKind.TemplateMiddle; + parent?: TemplateSpan; } interface TemplateTail extends LiteralLikeNode { kind: SyntaxKind.TemplateTail; + parent?: TemplateSpan; } type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral; interface TemplateExpression extends PrimaryExpression { @@ -883,6 +919,7 @@ declare namespace ts { } interface TemplateSpan extends Node { kind: SyntaxKind.TemplateSpan; + parent?: TemplateExpression; expression: Expression; literal: TemplateMiddle | TemplateTail; } @@ -899,18 +936,18 @@ declare namespace ts { expression: Expression; } /** - * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to - * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be - * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type - * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) - **/ + * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to + * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be + * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type + * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) + */ interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration { properties: NodeArray; } interface ObjectLiteralExpression extends ObjectLiteralExpressionBase { kind: SyntaxKind.ObjectLiteralExpression; } - type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; + type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression | ParenthesizedExpression; type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; interface PropertyAccessExpression extends MemberExpression, Declaration { kind: SyntaxKind.PropertyAccessExpression; @@ -945,6 +982,7 @@ declare namespace ts { } interface ExpressionWithTypeArguments extends TypeNode { kind: SyntaxKind.ExpressionWithTypeArguments; + parent?: HeritageClause; expression: LeftHandSideExpression; typeArguments?: NodeArray; } @@ -952,14 +990,14 @@ declare namespace ts { kind: SyntaxKind.NewExpression; expression: LeftHandSideExpression; typeArguments?: NodeArray; - arguments: NodeArray; + arguments?: NodeArray; } interface TaggedTemplateExpression extends MemberExpression { kind: SyntaxKind.TaggedTemplateExpression; tag: LeftHandSideExpression; template: TemplateLiteral; } - type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator; + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement; interface AsExpression extends Expression { kind: SyntaxKind.AsExpression; expression: Expression; @@ -975,49 +1013,67 @@ declare namespace ts { kind: SyntaxKind.NonNullExpression; expression: Expression; } + interface MetaProperty extends PrimaryExpression { + kind: SyntaxKind.MetaProperty; + keywordToken: SyntaxKind; + name: Identifier; + } interface JsxElement extends PrimaryExpression { kind: SyntaxKind.JsxElement; openingElement: JsxOpeningElement; children: NodeArray; closingElement: JsxClosingElement; } + type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; + type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; + interface JsxAttributes extends ObjectLiteralExpressionBase { + parent?: JsxOpeningLikeElement; + } interface JsxOpeningElement extends Expression { kind: SyntaxKind.JsxOpeningElement; + parent?: JsxElement; tagName: JsxTagNameExpression; - attributes: NodeArray; + attributes: JsxAttributes; } interface JsxSelfClosingElement extends PrimaryExpression { kind: SyntaxKind.JsxSelfClosingElement; tagName: JsxTagNameExpression; - attributes: NodeArray; + attributes: JsxAttributes; } - type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; - type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; - interface JsxAttribute extends Node { + interface JsxAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxAttribute; + parent?: JsxAttributes; name: Identifier; initializer?: StringLiteral | JsxExpression; } - interface JsxSpreadAttribute extends Node { + interface JsxSpreadAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxSpreadAttribute; + parent?: JsxAttributes; expression: Expression; } interface JsxClosingElement extends Node { kind: SyntaxKind.JsxClosingElement; + parent?: JsxElement; tagName: JsxTagNameExpression; } interface JsxExpression extends Expression { kind: SyntaxKind.JsxExpression; + parent?: JsxElement | JsxAttributeLike; + dotDotDotToken?: Token; expression?: Expression; } interface JsxText extends Node { kind: SyntaxKind.JsxText; + parent?: JsxElement; } type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; interface Statement extends Node { _statementBrand: any; } + interface NotEmittedStatement extends Statement { + kind: SyntaxKind.NotEmittedStatement; + } interface EmptyStatement extends Statement { kind: SyntaxKind.EmptyStatement; } @@ -1028,7 +1084,7 @@ declare namespace ts { kind: SyntaxKind.MissingDeclaration; name?: Identifier; } - type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; + type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause; interface Block extends Statement { kind: SyntaxKind.Block; statements: NodeArray; @@ -1072,6 +1128,7 @@ declare namespace ts { } interface ForOfStatement extends IterationStatement { kind: SyntaxKind.ForOfStatement; + awaitModifier?: AwaitKeywordToken; initializer: ForInitializer; expression: Expression; } @@ -1101,15 +1158,18 @@ declare namespace ts { } interface CaseBlock extends Node { kind: SyntaxKind.CaseBlock; + parent?: SwitchStatement; clauses: NodeArray; } interface CaseClause extends Node { kind: SyntaxKind.CaseClause; + parent?: CaseBlock; expression: Expression; statements: NodeArray; } interface DefaultClause extends Node { kind: SyntaxKind.DefaultClause; + parent?: CaseBlock; statements: NodeArray; } type CaseOrDefaultClause = CaseClause | DefaultClause; @@ -1130,6 +1190,7 @@ declare namespace ts { } interface CatchClause extends Node { kind: SyntaxKind.CatchClause; + parent?: TryStatement; variableDeclaration: VariableDeclaration; block: Block; } @@ -1165,8 +1226,9 @@ declare namespace ts { } interface HeritageClause extends Node { kind: SyntaxKind.HeritageClause; - token: SyntaxKind; - types?: NodeArray; + parent?: InterfaceDeclaration | ClassDeclaration | ClassExpression; + token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword; + types: NodeArray; } interface TypeAliasDeclaration extends DeclarationStatement { kind: SyntaxKind.TypeAliasDeclaration; @@ -1176,6 +1238,7 @@ declare namespace ts { } interface EnumMember extends Declaration { kind: SyntaxKind.EnumMember; + parent?: EnumDeclaration; name: PropertyName; initializer?: Expression; } @@ -1184,91 +1247,121 @@ declare namespace ts { name: Identifier; members: NodeArray; } - type ModuleBody = ModuleBlock | ModuleDeclaration; type ModuleName = Identifier | StringLiteral; + type ModuleBody = NamespaceBody | JSDocNamespaceBody; interface ModuleDeclaration extends DeclarationStatement { kind: SyntaxKind.ModuleDeclaration; - name: Identifier | StringLiteral; - body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier; + parent?: ModuleBody | SourceFile; + name: ModuleName; + body?: ModuleBody | JSDocNamespaceDeclaration; } + type NamespaceBody = ModuleBlock | NamespaceDeclaration; interface NamespaceDeclaration extends ModuleDeclaration { name: Identifier; - body: ModuleBlock | NamespaceDeclaration; + body: NamespaceBody; } + type JSDocNamespaceBody = Identifier | JSDocNamespaceDeclaration; interface JSDocNamespaceDeclaration extends ModuleDeclaration { name: Identifier; - body: JSDocNamespaceDeclaration | Identifier; + body: JSDocNamespaceBody; } interface ModuleBlock extends Node, Statement { kind: SyntaxKind.ModuleBlock; + parent?: ModuleDeclaration; statements: NodeArray; } type ModuleReference = EntityName | ExternalModuleReference; + /** + * One of: + * - import x = require("mod"); + * - import x = M.x; + */ interface ImportEqualsDeclaration extends DeclarationStatement { kind: SyntaxKind.ImportEqualsDeclaration; + parent?: SourceFile | ModuleBlock; name: Identifier; moduleReference: ModuleReference; } interface ExternalModuleReference extends Node { kind: SyntaxKind.ExternalModuleReference; + parent?: ImportEqualsDeclaration; expression?: Expression; } interface ImportDeclaration extends Statement { kind: SyntaxKind.ImportDeclaration; + parent?: SourceFile | ModuleBlock; importClause?: ImportClause; + /** If this is not a StringLiteral it will be a grammar error. */ moduleSpecifier: Expression; } type NamedImportBindings = NamespaceImport | NamedImports; interface ImportClause extends Declaration { kind: SyntaxKind.ImportClause; + parent?: ImportDeclaration; name?: Identifier; namedBindings?: NamedImportBindings; } interface NamespaceImport extends Declaration { kind: SyntaxKind.NamespaceImport; + parent?: ImportClause; name: Identifier; } interface NamespaceExportDeclaration extends DeclarationStatement { kind: SyntaxKind.NamespaceExportDeclaration; name: Identifier; - moduleReference: LiteralLikeNode; } interface ExportDeclaration extends DeclarationStatement { kind: SyntaxKind.ExportDeclaration; + parent?: SourceFile | ModuleBlock; exportClause?: NamedExports; + /** If this is not a StringLiteral it will be a grammar error. */ moduleSpecifier?: Expression; } interface NamedImports extends Node { kind: SyntaxKind.NamedImports; + parent?: ImportClause; elements: NodeArray; } interface NamedExports extends Node { kind: SyntaxKind.NamedExports; + parent?: ExportDeclaration; elements: NodeArray; } type NamedImportsOrExports = NamedImports | NamedExports; interface ImportSpecifier extends Declaration { kind: SyntaxKind.ImportSpecifier; + parent?: NamedImports; propertyName?: Identifier; name: Identifier; } interface ExportSpecifier extends Declaration { kind: SyntaxKind.ExportSpecifier; + parent?: NamedExports; propertyName?: Identifier; name: Identifier; } type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; interface ExportAssignment extends DeclarationStatement { kind: SyntaxKind.ExportAssignment; + parent?: SourceFile; isExportEquals?: boolean; expression: Expression; } interface FileReference extends TextRange { fileName: string; } + interface CheckJsDirective extends TextRange { + enabled: boolean; + } + type CommentKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia; interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; - kind: SyntaxKind; + kind: CommentKind; + } + interface SynthesizedComment extends CommentRange { + text: string; + pos: -1; + end: -1; } interface JSDocTypeExpression extends Node { kind: SyntaxKind.JSDocTypeExpression; @@ -1412,9 +1505,21 @@ declare namespace ts { ArrayMutation = 256, Referenced = 512, Shared = 1024, + PreFinally = 2048, + AfterFinally = 4096, Label = 12, Condition = 96, } + interface FlowLock { + locked?: boolean; + } + interface AfterFinallyFlow extends FlowNode, FlowLock { + antecedent: FlowNode; + } + interface PreFinallyFlow extends FlowNode { + antecedent: FlowNode; + lock: FlowLock; + } interface FlowNode { flags: FlowFlags; id?: number; @@ -1457,7 +1562,6 @@ declare namespace ts { statements: NodeArray; endOfFileToken: Token; fileName: string; - path: Path; text: string; amdDependencies: AmdDependency[]; moduleName: string; @@ -1476,6 +1580,10 @@ declare namespace ts { hasNoDefaultLib: boolean; languageVersion: ScriptTarget; } + interface Bundle extends Node { + kind: SyntaxKind.Bundle; + sourceFiles: SourceFile[]; + } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; getSourceFile(fileName: string): SourceFile; @@ -1486,9 +1594,9 @@ declare namespace ts { useCaseSensitiveFileNames: boolean; readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[]; /** - * Gets a value indicating whether the specified path exists and is a file. - * @param path The path to test. - */ + * Gets a value indicating whether the specified path exists and is a file. + * @param path The path to test. + */ fileExists(path: string): boolean; readFile(path: string): string; } @@ -1521,7 +1629,7 @@ declare namespace ts { * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter * will be invoked when writing the JavaScript and declaration files. */ - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; @@ -1532,6 +1640,12 @@ declare namespace ts { */ getTypeChecker(): TypeChecker; } + interface CustomTransformers { + /** Custom transformers to evaluate before built-in transformations. */ + before?: TransformerFactory[]; + /** Custom transformers to evaluate after built-in transformations. */ + after?: TransformerFactory[]; + } interface SourceMapSpan { /** Line number in the .js file. */ emittedLine: number; @@ -1575,11 +1689,20 @@ declare namespace ts { getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; + getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; - getBaseTypes(type: InterfaceType): ObjectType[]; + getBaseTypes(type: InterfaceType): BaseType[]; + getBaseTypeOfLiteralType(type: Type): Type; + getWidenedType(type: Type): Type; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; + /** Note that the resulting nodes cannot be checked. */ + typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode; + /** Note that the resulting nodes cannot be checked. */ + signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration; + /** Note that the resulting nodes cannot be checked. */ + indexInfoToIndexSignatureDeclaration(indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): IndexSignatureDeclaration; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; @@ -1587,6 +1710,8 @@ declare namespace ts { getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; + getTypeFromTypeNode(node: TypeNode): Type; + signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; @@ -1602,18 +1727,30 @@ declare namespace ts { isUnknownSymbol(symbol: Symbol): boolean; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + /** Follow all aliases to get the original symbol. */ getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; - getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; + getAllAttributesTypeFromJsxOpeningLikeElement(elementNode: JsxOpeningLikeElement): Type; getJsxIntrinsicTagNames(): Symbol[]; isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; + getApparentType(type: Type): Type; + } + enum NodeBuilderFlags { + None = 0, + allowThisInObjectLiteral = 1, + allowQualifedNameInPlaceOfIdentifier = 2, + allowTypeParameterInQualifiedName = 4, + allowAnonymousIdentifier = 8, + allowEmptyUnionOrIntersection = 16, + allowEmptyTuple = 32, } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1629,6 +1766,7 @@ declare namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -1636,6 +1774,7 @@ declare namespace ts { clear(): void; trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; + reportIllegalExtends(): void; } enum TypeFormatFlags { None = 0, @@ -1650,6 +1789,8 @@ declare namespace ts { InFirstTypeArgument = 256, InTypeAlias = 512, UseTypeAliasValue = 1024, + SuppressAnyReturnType = 2048, + AddUndefined = 4096, } enum SymbolFormatFlags { None = 0, @@ -1699,13 +1840,10 @@ declare namespace ts { ExportType = 2097152, ExportNamespace = 4194304, Alias = 8388608, - Instantiated = 16777216, - Merged = 33554432, - Transient = 67108864, - Prototype = 134217728, - SyntheticProperty = 268435456, - Optional = 536870912, - ExportStar = 1073741824, + Prototype = 16777216, + ExportStar = 33554432, + Optional = 67108864, + Transient = 134217728, Enum = 384, Variable = 3, Value = 107455, @@ -1771,6 +1909,7 @@ declare namespace ts { Intersection = 131072, Index = 262144, IndexedAccess = 524288, + NonPrimitive = 16777216, Literal = 480, StringOrNumberLiteral = 96, PossiblyFalsy = 7406, @@ -1780,9 +1919,10 @@ declare namespace ts { EnumLike = 272, UnionOrIntersection = 196608, StructuredType = 229376, - StructuredOrTypeParameter = 507904, - Narrowable = 1033215, - NotUnionOrUnit = 33281, + StructuredOrTypeVariable = 1032192, + TypeVariable = 540672, + Narrowable = 17810431, + NotUnionOrUnit = 16810497, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1798,7 +1938,7 @@ declare namespace ts { regularType?: LiteralType; } interface EnumType extends Type { - memberTypes: Map; + memberTypes: EnumLiteralType[]; } interface EnumLiteralType extends LiteralType { baseType: EnumType & UnionType; @@ -1819,12 +1959,14 @@ declare namespace ts { interface ObjectType extends Type { objectFlags: ObjectFlags; } + /** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */ interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; localTypeParameters: TypeParameter[]; thisType: TypeParameter; } + type BaseType = ObjectType | IntersectionType; interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; declaredCallSignatures: Signature[]; @@ -1832,6 +1974,16 @@ declare namespace ts { declaredStringIndexInfo: IndexInfo; declaredNumberIndexInfo: IndexInfo; } + /** + * Type references (TypeFlags.Reference). When a class or interface has type parameters or + * a "this" type, references to the class or interface are made using type references. The + * typeArguments property specifies the types to substitute for the type parameters of the + * class or interface and optionally includes an extra element that specifies the type to + * substitute for "this" in the resulting instantiation. When no extra argument is present, + * the type reference itself is substituted for "this". The typeArguments property is undefined + * if the class or interface has no type parameters and the reference isn't specifying an + * explicit "this" argument. + */ interface TypeReference extends ObjectType { target: GenericType; typeArguments: Type[]; @@ -1850,15 +2002,19 @@ declare namespace ts { elementType: Type; finalArrayType?: Type; } - interface TypeParameter extends Type { - constraint: Type; + interface TypeVariable extends Type { } - interface IndexType extends Type { - type: TypeParameter; + interface TypeParameter extends TypeVariable { + constraint: Type; + default?: Type; } - interface IndexedAccessType extends Type { + interface IndexedAccessType extends TypeVariable { objectType: Type; indexType: Type; + constraint?: Type; + } + interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } enum SignatureKind { Call = 0, @@ -1878,6 +2034,10 @@ declare namespace ts { isReadonly: boolean; declaration?: SignatureDeclaration; } + interface JsFileExtensionInfo { + extension: string; + isMixedContent: boolean; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -1913,7 +2073,10 @@ declare namespace ts { Classic = 1, NodeJs = 2, } - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike; + interface PluginImport { + name: string; + } + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[]; interface CompilerOptions { allowJs?: boolean; allowSyntheticDefaultImports?: boolean; @@ -1922,9 +2085,11 @@ declare namespace ts { alwaysStrict?: boolean; baseUrl?: string; charset?: string; + checkJs?: boolean; declaration?: boolean; declarationDir?: string; disableSizeLimit?: boolean; + downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; experimentalDecorators?: boolean; @@ -1969,6 +2134,7 @@ declare namespace ts { skipDefaultLibCheck?: boolean; sourceMap?: boolean; sourceRoot?: string; + strict?: boolean; strictNullChecks?: boolean; suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; @@ -2007,6 +2173,7 @@ declare namespace ts { None = 0, Preserve = 1, React = 2, + ReactNative = 3, } enum NewLineKind { CarriageReturnLineFeed = 0, @@ -2022,6 +2189,7 @@ declare namespace ts { JSX = 2, TS = 3, TSX = 4, + External = 5, } enum ScriptTarget { ES3 = 0, @@ -2102,7 +2270,6 @@ declare namespace ts { } interface ResolvedModuleWithFailedLookupLocations { resolvedModule: ResolvedModuleFull | undefined; - failedLookupLocations: string[]; } interface ResolvedTypeReferenceDirective { primary: boolean; @@ -2131,6 +2298,206 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getEnvironmentVariable?(name: string): string; } + enum EmitFlags { + SingleLine = 1, + AdviseOnEmitNode = 2, + NoSubstitution = 4, + CapturesThis = 8, + NoLeadingSourceMap = 16, + NoTrailingSourceMap = 32, + NoSourceMap = 48, + NoNestedSourceMaps = 64, + NoTokenLeadingSourceMaps = 128, + NoTokenTrailingSourceMaps = 256, + NoTokenSourceMaps = 384, + NoLeadingComments = 512, + NoTrailingComments = 1024, + NoComments = 1536, + NoNestedComments = 2048, + HelperName = 4096, + ExportName = 8192, + LocalName = 16384, + Indented = 32768, + NoIndentation = 65536, + AsyncFunctionBody = 131072, + ReuseTempVariableScope = 262144, + CustomPrologue = 524288, + NoHoisting = 1048576, + HasEndOfDeclarationMarker = 2097152, + Iterator = 4194304, + } + interface EmitHelper { + readonly name: string; + readonly scoped: boolean; + readonly text: string; + readonly priority?: number; + } + enum EmitHint { + SourceFile = 0, + Expression = 1, + IdentifierName = 2, + Unspecified = 3, + } + interface TransformationContext { + /** Gets the compiler options supplied to the transformer. */ + getCompilerOptions(): CompilerOptions; + /** Starts a new lexical environment. */ + startLexicalEnvironment(): void; + /** Suspends the current lexical environment, usually after visiting a parameter list. */ + suspendLexicalEnvironment(): void; + /** Resumes a suspended lexical environment, usually before visiting a function body. */ + resumeLexicalEnvironment(): void; + /** Ends a lexical environment, returning any declarations. */ + endLexicalEnvironment(): Statement[]; + /** Hoists a function declaration to the containing scope. */ + hoistFunctionDeclaration(node: FunctionDeclaration): void; + /** Hoists a variable declaration to the containing scope. */ + hoistVariableDeclaration(node: Identifier): void; + /** Records a request for a non-scoped emit helper in the current context. */ + requestEmitHelper(helper: EmitHelper): void; + /** Gets and resets the requested non-scoped emit helpers. */ + readEmitHelpers(): EmitHelper[] | undefined; + /** Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ + enableSubstitution(kind: SyntaxKind): void; + /** Determines whether expression substitutions are enabled for the provided node. */ + isSubstitutionEnabled(node: Node): boolean; + /** + * Hook used by transformers to substitute expressions just before they + * are emitted by the pretty printer. + * + * NOTE: Transformation hooks should only be modified during `Transformer` initialization, + * before returning the `NodeTransformer` callback. + */ + onSubstituteNode: (hint: EmitHint, node: Node) => Node; + /** + * Enables before/after emit notifications in the pretty printer for the provided + * SyntaxKind. + */ + enableEmitNotification(kind: SyntaxKind): void; + /** + * Determines whether before/after emit notifications should be raised in the pretty + * printer when it emits a node. + */ + isEmitNotificationEnabled(node: Node): boolean; + /** + * Hook used to allow transformers to capture state before or after + * the printer emits a node. + * + * NOTE: Transformation hooks should only be modified during `Transformer` initialization, + * before returning the `NodeTransformer` callback. + */ + onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; + } + interface TransformationResult { + /** Gets the transformed source files. */ + transformed: T[]; + /** Gets diagnostics for the transformation. */ + diagnostics?: Diagnostic[]; + /** + * Gets a substitute for a node, if one is available; otherwise, returns the original node. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + substituteNode(hint: EmitHint, node: Node): Node; + /** + * Emits a node with possible notification. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emitCallback A callback used to emit the node. + */ + emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + /** + * Clean up EmitNode entries on any parse-tree nodes. + */ + dispose(): void; + } + /** + * A function that is used to initialize and return a `Transformer` callback, which in turn + * will be used to transform one or more nodes. + */ + type TransformerFactory = (context: TransformationContext) => Transformer; + /** + * A function that transforms a node. + */ + type Transformer = (node: T) => T; + /** + * A function that accepts and possibly transforms a node. + */ + type Visitor = (node: Node) => VisitResult; + type VisitResult = T | T[]; + interface Printer { + /** + * Print a node and its subtree as-is, without any emit transformations. + * @param hint A value indicating the purpose of a node. This is primarily used to + * distinguish between an `Identifier` used in an expression position, versus an + * `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you + * should just pass `Unspecified`. + * @param node The node to print. The node and its subtree are printed as-is, without any + * emit transformations. + * @param sourceFile A source file that provides context for the node. The source text of + * the file is used to emit the original source content for literals and identifiers, while + * the identifiers of the source file are used when generating unique names to avoid + * collisions. + */ + printNode(hint: EmitHint, node: Node, sourceFile: SourceFile): string; + /** + * Prints a source file as-is, without any emit transformations. + */ + printFile(sourceFile: SourceFile): string; + /** + * Prints a bundle of source files as-is, without any emit transformations. + */ + printBundle(bundle: Bundle): string; + } + interface PrintHandlers { + /** + * A hook used by the Printer when generating unique names to avoid collisions with + * globally defined names that exist outside of the current source file. + */ + hasGlobalName?(name: string): boolean; + /** + * A hook used by the Printer to provide notifications prior to emitting a node. A + * compatible implementation **must** invoke `emitCallback` with the provided `hint` and + * `node` values. + * @param hint A hint indicating the intended purpose of the node. + * @param node The node to emit. + * @param emitCallback A callback that, when invoked, will emit the node. + * @example + * ```ts + * var printer = createPrinter(printerOptions, { + * onEmitNode(hint, node, emitCallback) { + * // set up or track state prior to emitting the node... + * emitCallback(hint, node); + * // restore state after emitting the node... + * } + * }); + * ``` + */ + onEmitNode?(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + /** + * A hook used by the Printer to perform just-in-time substitution of a node. This is + * primarily used by node transformations that need to substitute one node for another, + * such as replacing `myExportedVar` with `exports.myExportedVar`. + * @param hint A hint indicating the intended purpose of the node. + * @param node The node to emit. + * @example + * ```ts + * var printer = createPrinter(printerOptions, { + * substituteNode(hint, node) { + * // perform substitution if necessary... + * return node; + * } + * }); + * ``` + */ + substituteNode?(hint: EmitHint, node: Node): Node; + } + interface PrinterOptions { + removeComments?: boolean; + newLine?: NewLineKind; + } interface TextSpan { start: number; length: number; @@ -2145,8 +2512,10 @@ declare namespace ts { } declare namespace ts { /** The version of the TypeScript compiler release */ - const version = "2.2.0-dev.20161127"; + const version = "2.3.0-dev.20170419"; } +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; +declare function clearTimeout(handle: any): void; declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -2192,6 +2561,7 @@ declare namespace ts { directoryName: string; referenceCount: number; } + function getNodeMajorVersion(): number; let sys: System; } declare namespace ts { @@ -2237,12 +2607,12 @@ declare namespace ts { function isWhiteSpaceSingleLine(ch: number): boolean; function isLineBreak(ch: number): boolean; function couldStartTrivia(text: string, pos: number): boolean; - function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; - function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; - function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; /** Optionally, get the shebang */ function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; @@ -2282,15 +2652,414 @@ declare namespace ts { function getCombinedModifierFlags(node: Node): ModifierFlags; function getCombinedNodeFlags(node: Node): NodeFlags; /** - * Checks to see if the locale is in the appropriate format, - * and if it is, attempts to set the appropriate language. - */ + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ function validateLocaleAndSetLanguage(locale: string, sys: { getExecutingFilePath(): string; resolvePath(path: string): string; fileExists(fileName: string): boolean; readFile(fileName: string): string; }, errors?: Diagnostic[]): void; + function getOriginalNode(node: Node): Node; + function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; + /** + * Gets a value indicating whether a node originated in the parse tree. + * + * @param node The node to test. + */ + function isParseTreeNode(node: Node): boolean; + /** + * Gets the original parse tree node for a node. + * + * @param node The original node. + * @returns The original parse tree node if found; otherwise, undefined. + */ + function getParseTreeNode(node: Node): Node; + /** + * Gets the original parse tree node for a node. + * + * @param node The original node. + * @param nodeTest A callback used to ensure the correct type of parse tree node is returned. + * @returns The original parse tree node if found; otherwise, undefined. + */ + function getParseTreeNode(node: Node, nodeTest?: (node: Node) => node is T): T; + /** + * Remove extra underscore from escaped identifier text content. + * + * @param identifier The escaped identifier text. + * @returns The unescaped identifier text. + */ + function unescapeIdentifier(identifier: string): string; +} +declare namespace ts { + /** + * Make `elements` into a `NodeArray`. If `elements` is `undefined`, returns an empty `NodeArray`. + */ + function createNodeArray(elements?: T[], hasTrailingComma?: boolean): NodeArray; + function createLiteral(value: string): StringLiteral; + function createLiteral(value: number): NumericLiteral; + function createLiteral(value: boolean): BooleanLiteral; + /** Create a string literal whose source text is read from a source node during emit. */ + function createLiteral(sourceNode: StringLiteral | NumericLiteral | Identifier): StringLiteral; + function createLiteral(value: string | number | boolean): PrimaryExpression; + function createNumericLiteral(value: string): NumericLiteral; + function createIdentifier(text: string): Identifier; + /** Create a unique temporary variable. */ + function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined): Identifier; + /** Create a unique temporary variable for use in a loop. */ + function createLoopVariable(): Identifier; + /** Create a unique name based on the supplied text. */ + function createUniqueName(text: string): Identifier; + /** Create a unique name generated for a node. */ + function getGeneratedNameForNode(node: Node): Identifier; + function createToken(token: TKind): Token; + function createSuper(): SuperExpression; + function createThis(): ThisExpression & Token; + function createNull(): NullLiteral & Token; + function createTrue(): BooleanLiteral & Token; + function createFalse(): BooleanLiteral & Token; + function createQualifiedName(left: EntityName, right: string | Identifier): QualifiedName; + function updateQualifiedName(node: QualifiedName, left: EntityName, right: Identifier): QualifiedName; + function createComputedPropertyName(expression: Expression): ComputedPropertyName; + function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; + function createSignatureDeclaration(kind: SyntaxKind, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): SignatureDeclaration; + function createFunctionTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): FunctionTypeNode; + function updateFunctionTypeNode(node: FunctionTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): FunctionTypeNode; + function createConstructorTypeNode(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructorTypeNode; + function updateConstructorTypeNode(node: ConstructorTypeNode, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): CallSignatureDeclaration; + function updateCallSignatureDeclaration(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; + function createMethodSignature(typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined): MethodSignature; + function updateMethodSignature(node: MethodSignature, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined, name: PropertyName, questionToken: QuestionToken | undefined): MethodSignature; + function createKeywordTypeNode(kind: KeywordTypeNode["kind"]): KeywordTypeNode; + function createThisTypeNode(): ThisTypeNode; + function createLiteralTypeNode(literal: Expression): LiteralTypeNode; + function updateLiteralTypeNode(node: LiteralTypeNode, literal: Expression): LiteralTypeNode; + function createTypeReferenceNode(typeName: string | EntityName, typeArguments: TypeNode[] | undefined): TypeReferenceNode; + function updateTypeReferenceNode(node: TypeReferenceNode, typeName: EntityName, typeArguments: NodeArray | undefined): TypeReferenceNode; + function createTypePredicateNode(parameterName: Identifier | ThisTypeNode | string, type: TypeNode): TypePredicateNode; + function updateTypePredicateNode(node: TypePredicateNode, parameterName: Identifier | ThisTypeNode, type: TypeNode): TypePredicateNode; + function createTypeQueryNode(exprName: EntityName): TypeQueryNode; + function updateTypeQueryNode(node: TypeQueryNode, exprName: EntityName): TypeQueryNode; + function createArrayTypeNode(elementType: TypeNode): ArrayTypeNode; + function updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType, types: TypeNode[]): UnionTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.IntersectionType, types: TypeNode[]): IntersectionTypeNode; + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: TypeNode[]): UnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node: UnionOrIntersectionTypeNode, types: NodeArray): UnionOrIntersectionTypeNode; + function createTypeLiteralNode(members: TypeElement[]): TypeLiteralNode; + function updateTypeLiteralNode(node: TypeLiteralNode, members: NodeArray): TypeLiteralNode; + function createTupleTypeNode(elementTypes: TypeNode[]): TupleTypeNode; + function updateTypleTypeNode(node: TupleTypeNode, elementTypes: TypeNode[]): TupleTypeNode; + function createMappedTypeNode(readonlyToken: ReadonlyToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | undefined, type: TypeNode | undefined): MappedTypeNode; + function updateMappedTypeNode(node: MappedTypeNode, readonlyToken: ReadonlyToken | undefined, typeParameter: TypeParameterDeclaration, questionToken: QuestionToken | undefined, type: TypeNode | undefined): MappedTypeNode; + function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; + function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode; + function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; + function createTypeParameterDeclaration(name: string | Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; + function updateTypeParameterDeclaration(node: TypeParameterDeclaration, name: Identifier, constraint: TypeNode | undefined, defaultType: TypeNode | undefined): TypeParameterDeclaration; + function createPropertySignature(name: PropertyName | string, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature; + function updatePropertySignature(node: PropertySignature, name: PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): PropertySignature; + function createIndexSignatureDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node: IndexSignatureDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + function createParameter(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression): ParameterDeclaration; + function updateParameter(node: ParameterDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression | undefined): ParameterDeclaration; + function createDecorator(expression: Expression): Decorator; + function updateDecorator(node: Decorator, expression: Expression): Decorator; + function createProperty(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression): PropertyDeclaration; + function updateProperty(node: PropertyDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, type: TypeNode | undefined, initializer: Expression): PropertyDeclaration; + function createMethodDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; + function updateMethod(node: MethodDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; + function createConstructor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + function createGetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; + function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; + function createSetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; + function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; + function createObjectBindingPattern(elements: BindingElement[]): ObjectBindingPattern; + function updateObjectBindingPattern(node: ObjectBindingPattern, elements: BindingElement[]): ObjectBindingPattern; + function createArrayBindingPattern(elements: ArrayBindingElement[]): ArrayBindingPattern; + function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern; + function createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression): BindingElement; + function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined): BindingElement; + function createArrayLiteral(elements?: Expression[], multiLine?: boolean): ArrayLiteralExpression; + function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression; + function createObjectLiteral(properties?: ObjectLiteralElementLike[], multiLine?: boolean): ObjectLiteralExpression; + function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElementLike[]): ObjectLiteralExpression; + function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression; + function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression; + function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression; + function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; + function createCall(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]): CallExpression; + function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]): CallExpression; + function createNew(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined): NewExpression; + function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined): NewExpression; + function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; + function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; + function createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion; + function updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion; + function createParen(expression: Expression): ParenthesizedExpression; + function updateParen(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression; + function createFunctionExpression(modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression; + function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block): FunctionExpression; + function createArrowFunction(modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody): ArrowFunction; + function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: ConciseBody): ArrowFunction; + function createDelete(expression: Expression): DeleteExpression; + function updateDelete(node: DeleteExpression, expression: Expression): DeleteExpression; + function createTypeOf(expression: Expression): TypeOfExpression; + function updateTypeOf(node: TypeOfExpression, expression: Expression): TypeOfExpression; + function createVoid(expression: Expression): VoidExpression; + function updateVoid(node: VoidExpression, expression: Expression): VoidExpression; + function createAwait(expression: Expression): AwaitExpression; + function updateAwait(node: AwaitExpression, expression: Expression): AwaitExpression; + function createPrefix(operator: PrefixUnaryOperator, operand: Expression): PrefixUnaryExpression; + function updatePrefix(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression; + function createPostfix(operand: Expression, operator: PostfixUnaryOperator): PostfixUnaryExpression; + function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; + function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression): BinaryExpression; + function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression; + function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; + function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression): ConditionalExpression; + function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; + function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; + function updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; + function createYield(expression?: Expression): YieldExpression; + function createYield(asteriskToken: AsteriskToken, expression: Expression): YieldExpression; + function updateYield(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression): YieldExpression; + function createSpread(expression: Expression): SpreadElement; + function updateSpread(node: SpreadElement, expression: Expression): SpreadElement; + function createClassExpression(modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; + function updateClassExpression(node: ClassExpression, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; + function createOmittedExpression(): OmittedExpression; + function createExpressionWithTypeArguments(typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; + function updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; + function createAsExpression(expression: Expression, type: TypeNode): AsExpression; + function updateAsExpression(node: AsExpression, expression: Expression, type: TypeNode): AsExpression; + function createNonNullExpression(expression: Expression): NonNullExpression; + function updateNonNullExpression(node: NonNullExpression, expression: Expression): NonNullExpression; + function createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; + function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; + function createBlock(statements: Statement[], multiLine?: boolean): Block; + function updateBlock(node: Block, statements: Statement[]): Block; + function createVariableStatement(modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList | VariableDeclaration[]): VariableStatement; + function updateVariableStatement(node: VariableStatement, modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement; + function createVariableDeclarationList(declarations: VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList; + function updateVariableDeclarationList(node: VariableDeclarationList, declarations: VariableDeclaration[]): VariableDeclarationList; + function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression): VariableDeclaration; + function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined): VariableDeclaration; + function createEmptyStatement(): EmptyStatement; + function createStatement(expression: Expression): ExpressionStatement; + function updateStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; + function createIf(expression: Expression, thenStatement: Statement, elseStatement?: Statement): IfStatement; + function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined): IfStatement; + function createDo(statement: Statement, expression: Expression): DoStatement; + function updateDo(node: DoStatement, statement: Statement, expression: Expression): DoStatement; + function createWhile(expression: Expression, statement: Statement): WhileStatement; + function updateWhile(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement; + function createFor(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; + function updateFor(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement): ForStatement; + function createForIn(initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; + function updateForIn(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; + function createForOf(awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; + function updateForOf(node: ForOfStatement, awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; + function createContinue(label?: string | Identifier): ContinueStatement; + function updateContinue(node: ContinueStatement, label: Identifier | undefined): ContinueStatement; + function createBreak(label?: string | Identifier): BreakStatement; + function updateBreak(node: BreakStatement, label: Identifier | undefined): BreakStatement; + function createReturn(expression?: Expression): ReturnStatement; + function updateReturn(node: ReturnStatement, expression: Expression | undefined): ReturnStatement; + function createWith(expression: Expression, statement: Statement): WithStatement; + function updateWith(node: WithStatement, expression: Expression, statement: Statement): WithStatement; + function createSwitch(expression: Expression, caseBlock: CaseBlock): SwitchStatement; + function updateSwitch(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement; + function createLabel(label: string | Identifier, statement: Statement): LabeledStatement; + function updateLabel(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement; + function createThrow(expression: Expression): ThrowStatement; + function updateThrow(node: ThrowStatement, expression: Expression): ThrowStatement; + function createTry(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; + function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined): TryStatement; + function createFunctionDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; + function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; + function createClassDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; + function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; + function createEnumDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, members: EnumMember[]): EnumDeclaration; + function updateEnumDeclaration(node: EnumDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, members: EnumMember[]): EnumDeclaration; + function createModuleDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; + function updateModuleDeclaration(node: ModuleDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; + function createModuleBlock(statements: Statement[]): ModuleBlock; + function updateModuleBlock(node: ModuleBlock, statements: Statement[]): ModuleBlock; + function createCaseBlock(clauses: CaseOrDefaultClause[]): CaseBlock; + function updateCaseBlock(node: CaseBlock, clauses: CaseOrDefaultClause[]): CaseBlock; + function createImportEqualsDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + function createImportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier?: Expression): ImportDeclaration; + function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression | undefined): ImportDeclaration; + function createImportClause(name: Identifier, namedBindings: NamedImportBindings): ImportClause; + function updateImportClause(node: ImportClause, name: Identifier, namedBindings: NamedImportBindings): ImportClause; + function createNamespaceImport(name: Identifier): NamespaceImport; + function updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; + function createNamedImports(elements: ImportSpecifier[]): NamedImports; + function updateNamedImports(node: NamedImports, elements: ImportSpecifier[]): NamedImports; + function createImportSpecifier(propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; + function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; + function createExportAssignment(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, isExportEquals: boolean, expression: Expression): ExportAssignment; + function updateExportAssignment(node: ExportAssignment, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, expression: Expression): ExportAssignment; + function createExportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier?: Expression): ExportDeclaration; + function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration; + function createNamedExports(elements: ExportSpecifier[]): NamedExports; + function updateNamedExports(node: NamedExports, elements: ExportSpecifier[]): NamedExports; + function createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; + function updateExportSpecifier(node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier; + function createExternalModuleReference(expression: Expression): ExternalModuleReference; + function updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference; + function createJsxElement(openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; + function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; + function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement; + function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxSelfClosingElement; + function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; + function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributes): JsxOpeningElement; + function createJsxClosingElement(tagName: JsxTagNameExpression): JsxClosingElement; + function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; + function createJsxAttributes(properties: JsxAttributeLike[]): JsxAttributes; + function updateJsxAttributes(jsxAttributes: JsxAttributes, properties: JsxAttributeLike[]): JsxAttributes; + function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; + function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; + function createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute; + function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; + function createJsxExpression(dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined): JsxExpression; + function updateJsxExpression(node: JsxExpression, expression: Expression | undefined): JsxExpression; + function createHeritageClause(token: HeritageClause["token"], types: ExpressionWithTypeArguments[]): HeritageClause; + function updateHeritageClause(node: HeritageClause, types: ExpressionWithTypeArguments[]): HeritageClause; + function createCaseClause(expression: Expression, statements: Statement[]): CaseClause; + function updateCaseClause(node: CaseClause, expression: Expression, statements: Statement[]): CaseClause; + function createDefaultClause(statements: Statement[]): DefaultClause; + function updateDefaultClause(node: DefaultClause, statements: Statement[]): DefaultClause; + function createCatchClause(variableDeclaration: string | VariableDeclaration, block: Block): CatchClause; + function updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration, block: Block): CatchClause; + function createPropertyAssignment(name: string | PropertyName, initializer: Expression): PropertyAssignment; + function updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment; + function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression): ShorthandPropertyAssignment; + function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined): ShorthandPropertyAssignment; + function createSpreadAssignment(expression: Expression): SpreadAssignment; + function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; + function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember; + function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember; + function updateSourceFileNode(node: SourceFile, statements: Statement[]): SourceFile; + /** + * Creates a shallow, memberwise clone of a node for mutation. + */ + function getMutableClone(node: T): T; + /** + * Creates a synthetic statement to act as a placeholder for a not-emitted statement in + * order to preserve comments. + * + * @param original The original statement. + */ + function createNotEmittedStatement(original: Node): NotEmittedStatement; + /** + * Creates a synthetic expression to act as a placeholder for a not-emitted expression in + * order to preserve comments or sourcemap positions. + * + * @param expression The inner expression to emit. + * @param original The original outer expression. + * @param location The location for the expression. Defaults to the positions from "original" if provided. + */ + function createPartiallyEmittedExpression(expression: Expression, original?: Node): PartiallyEmittedExpression; + function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; + function createBundle(sourceFiles: SourceFile[]): Bundle; + function updateBundle(node: Bundle, sourceFiles: SourceFile[]): Bundle; + function createComma(left: Expression, right: Expression): Expression; + function createLessThan(left: Expression, right: Expression): Expression; + function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; + function createAssignment(left: Expression, right: Expression): BinaryExpression; + function createStrictEquality(left: Expression, right: Expression): BinaryExpression; + function createStrictInequality(left: Expression, right: Expression): BinaryExpression; + function createAdd(left: Expression, right: Expression): BinaryExpression; + function createSubtract(left: Expression, right: Expression): BinaryExpression; + function createPostfixIncrement(operand: Expression): PostfixUnaryExpression; + function createLogicalAnd(left: Expression, right: Expression): BinaryExpression; + function createLogicalOr(left: Expression, right: Expression): BinaryExpression; + function createLogicalNot(operand: Expression): PrefixUnaryExpression; + function createVoidZero(): VoidExpression; + function createExportDefault(expression: Expression): ExportAssignment; + function createExternalModuleExport(exportName: Identifier): ExportDeclaration; + /** + * Clears any EmitNode entries from parse-tree nodes. + * @param sourceFile A source file. + */ + function disposeEmitNodes(sourceFile: SourceFile): void; + function setTextRange(range: T, location: TextRange | undefined): T; + /** + * Gets flags that control emit behavior of a node. + */ + function getEmitFlags(node: Node): EmitFlags | undefined; + /** + * Sets flags that control emit behavior of a node. + */ + function setEmitFlags(node: T, emitFlags: EmitFlags): T; + /** + * Gets a custom text range to use when emitting source maps. + */ + function getSourceMapRange(node: Node): TextRange; + /** + * Sets a custom text range to use when emitting source maps. + */ + function setSourceMapRange(node: T, range: TextRange | undefined): T; + /** + * Gets the TextRange to use for source maps for a token of a node. + */ + function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange | undefined; + /** + * Sets the TextRange to use for source maps for a token of a node. + */ + function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange | undefined): T; + /** + * Gets a custom text range to use when emitting comments. + */ + function getCommentRange(node: Node): TextRange; + /** + * Sets a custom text range to use when emitting comments. + */ + function setCommentRange(node: T, range: TextRange): T; + function getSyntheticLeadingComments(node: Node): SynthesizedComment[] | undefined; + function setSyntheticLeadingComments(node: T, comments: SynthesizedComment[]): T; + function addSyntheticLeadingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T; + function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined; + function setSyntheticTrailingComments(node: T, comments: SynthesizedComment[]): T; + function addSyntheticTrailingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean): T; + /** + * Gets the constant value to emit for an expression. + */ + function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; + /** + * Sets the constant value to emit for an expression. + */ + function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelper(node: T, helper: EmitHelper): T; + /** + * Add EmitHelpers to a node. + */ + function addEmitHelpers(node: T, helpers: EmitHelper[] | undefined): T; + /** + * Removes an EmitHelper from a node. + */ + function removeEmitHelper(node: Node, helper: EmitHelper): boolean; + /** + * Gets the EmitHelpers of a node. + */ + function getEmitHelpers(node: Node): EmitHelper[] | undefined; + /** + * Moves matching emit helpers from a source node to a target node. + */ + function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; + function setOriginalNode(node: T, original: Node | undefined): T; } declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; @@ -2301,6 +3070,10 @@ declare namespace ts { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { + /** Array that is only intended to be pushed to, never read. */ + interface Push { + push(value: T): void; + } function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; @@ -2313,17 +3086,120 @@ declare namespace ts { */ function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; /** - * Given a set of options, returns the set of type directive names - * that should be included for this program automatically. - * This list could either come from the config file, - * or from enumerating the types root + initial secondary types lookup location. - * More type directives might appear in the program later as a result of loading actual source files; - * this list is only the set of defaults that are implicitly included. - */ + * Given a set of options, returns the set of type directive names + * that should be included for this program automatically. + * This list could either come from the config file, + * or from enumerating the types root + initial secondary types lookup location. + * More type directives might appear in the program later as a result of loading actual source files; + * this list is only the set of defaults that are implicitly included. + */ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + /** + * Cached module resolutions per containing directory. + * This assumes that any module id will have the same resolution for sibling files located in the same folder. + */ + interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; + } + /** + * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory + * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. + */ + interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; + } + interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; + } + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; +} +declare namespace ts { + /** + * Visits a Node using the supplied visitor, possibly returning a new Node in its place. + * + * @param node The Node to visit. + * @param visitor The callback used to visit the Node. + * @param test A callback to execute to verify the Node is valid. + * @param lift An optional callback to execute to lift a NodeArray into a valid Node. + */ + function visitNode(node: T, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T; + /** + * Visits a Node using the supplied visitor, possibly returning a new Node in its place. + * + * @param node The Node to visit. + * @param visitor The callback used to visit the Node. + * @param test A callback to execute to verify the Node is valid. + * @param lift An optional callback to execute to lift a NodeArray into a valid Node. + */ + function visitNode(node: T | undefined, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T | undefined; + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + function visitNodes(nodes: NodeArray, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; + /** + * Starts a new lexical environment and visits a statement list, ending the lexical environment + * and merging hoisted declarations upon completion. + */ + function visitLexicalEnvironment(statements: NodeArray, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray; + /** + * Starts a new lexical environment and visits a parameter list, suspending the lexical + * environment upon completion. + */ + function visitParameterList(nodes: NodeArray, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes): NodeArray; + /** + * Resumes a suspended lexical environment and visits a function body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody; + /** + * Resumes a suspended lexical environment and visits a function body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined; + /** + * Resumes a suspended lexical environment and visits a concise body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody; + /** + * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + * + * @param node The Node whose children will be visited. + * @param visitor The callback used to visit each child. + * @param context A lexical environment context for the visitor. + */ + function visitEachChild(node: T, visitor: Visitor, context: TransformationContext): T; + /** + * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + * + * @param node The Node whose children will be visited. + * @param visitor The callback used to visit each child. + * @param context A lexical environment context for the visitor. + */ + function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; +} +declare namespace ts { + function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer; } declare namespace ts { function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; @@ -2340,31 +3216,32 @@ declare namespace ts { function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; error?: Diagnostic; }; /** - * Parse the text of the tsconfig.json file - * @param fileName The path to the config file - * @param jsonText The text of the config file - */ + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments?: boolean): { config?: any; error?: Diagnostic; }; /** - * Parse the contents of a config file (tsconfig.json). - * @param json The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine; + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: JsFileExtensionInfo[]): ParsedCommandLine; function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; @@ -2391,12 +3268,14 @@ declare namespace ts { getText(sourceFile?: SourceFile): string; getFirstToken(sourceFile?: SourceFile): Node; getLastToken(sourceFile?: SourceFile): Node; + forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; } interface Symbol { getFlags(): SymbolFlags; getName(): string; getDeclarations(): Declaration[]; getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } interface Type { getFlags(): TypeFlags; @@ -2408,15 +3287,16 @@ declare namespace ts { getConstructSignatures(): Signature[]; getStringIndexType(): Type; getNumberIndexType(): Type; - getBaseTypes(): ObjectType[]; + getBaseTypes(): BaseType[]; getNonNullableType(): Type; } interface Signature { getDeclaration(): SignatureDeclaration; - getTypeParameters(): Type[]; + getTypeParameters(): TypeParameter[]; getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; @@ -2425,6 +3305,9 @@ declare namespace ts { getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } + interface SourceFileLike { + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + } /** * Represents an immutable snapshot of a script at a specified time.Once acquired, the * snapshot is observably immutable. i.e. the same calls with the same parameters will return @@ -2483,6 +3366,10 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists?(directoryName: string): boolean; getDirectories?(directoryName: string): string[]; + /** + * Gets a set of custom transformers to use during emit. + */ + getCustomTransformers?(): CustomTransformers | undefined; } interface LanguageService { cleanupSemanticCache(): void; @@ -2528,7 +3415,7 @@ declare namespace ts { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; - getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[]; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[]; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; getProgram(): Program; dispose(): void; @@ -2604,19 +3491,20 @@ declare namespace ts { /** The position in newText the caret should point to after the insertion. */ caretOffset: number; } - interface RenameLocation { + interface DocumentSpan { textSpan: TextSpan; fileName: string; } - interface ReferenceEntry { - textSpan: TextSpan; - fileName: string; + interface RenameLocation extends DocumentSpan { + } + interface ReferenceEntry extends DocumentSpan { isWriteAccess: boolean; isDefinition: boolean; + isInString?: true; } - interface ImplementationLocation { - textSpan: TextSpan; - fileName: string; + interface ImplementationLocation extends DocumentSpan { + kind: string; + displayParts: SymbolDisplayPart[]; } interface DocumentHighlights { fileName: string; @@ -2630,6 +3518,7 @@ declare namespace ts { } interface HighlightSpan { fileName?: string; + isInString?: true; textSpan: TextSpan; kind: string; } @@ -2669,6 +3558,7 @@ declare namespace ts { InsertSpaceAfterCommaDelimiter: boolean; InsertSpaceAfterSemicolonInForStatements: boolean; InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; @@ -2677,6 +3567,7 @@ declare namespace ts { InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; } @@ -2684,6 +3575,7 @@ declare namespace ts { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; @@ -2692,6 +3584,7 @@ declare namespace ts { insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } @@ -2738,12 +3631,17 @@ declare namespace ts { text: string; kind: string; } + interface JSDocTagInfo { + name: string; + text?: string; + } interface QuickInfo { kind: string; kindModifiers: string; textSpan: TextSpan; displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } interface RenameInfo { canRename: boolean; @@ -2774,6 +3672,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. @@ -2800,10 +3699,10 @@ declare namespace ts { kindModifiers: string; sortText: string; /** - * An optional span that indicates the text to be replaced by this completion item. It will be - * set if the required span differs from the one generated by the default replacement behavior and should - * be used in that case - */ + * An optional span that indicates the text to be replaced by this completion item. It will be + * set if the required span differs from the one generated by the default replacement behavior and should + * be used in that case + */ replacementSpan?: TextSpan; } interface CompletionEntryDetails { @@ -2812,6 +3711,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } interface OutliningSpan { /** The span of the document to actually collapse. */ @@ -2821,9 +3721,9 @@ declare namespace ts { /** The text to display in the editor for the collapsed region. */ bannerText: string; /** - * Whether or not this region should be automatically collapsed when - * the 'Collapse to Definitions' command is invoked. - */ + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ autoCollapse: boolean; } interface EmitOutput { @@ -2911,7 +3811,7 @@ declare namespace ts { const typeElement = "type"; /** enum E */ const enumElement = "enum"; - const enumMemberElement = "const"; + const enumMemberElement = "enum member"; /** * Inside module and script only * const v = .. @@ -2954,6 +3854,10 @@ declare namespace ts { const letElement = "let"; const directory = "directory"; const externalModuleName = "external module name"; + /** + * + */ + const jsxAttribute = "JSX attribute"; } namespace ScriptElementKindModifier { const none = ""; @@ -3022,61 +3926,61 @@ declare namespace ts { } declare namespace ts { /** - * The document registry represents a store of SourceFile objects that can be shared between - * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) - * of files in the context. - * SourceFile objects account for most of the memory usage by the language service. Sharing - * the same DocumentRegistry instance between different instances of LanguageService allow - * for more efficient memory utilization since all projects will share at least the library - * file (lib.d.ts). - * - * A more advanced use of the document registry is to serialize sourceFile objects to disk - * and re-hydrate them when needed. - * - * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it - * to all subsequent createLanguageService calls. - */ + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ interface DocumentRegistry { /** - * Request a stored SourceFile with a given fileName and compilationSettings. - * The first call to acquire will call createLanguageServiceSourceFile to generate - * the SourceFile if was not found in the registry. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - */ + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; /** - * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile - * to get an updated SourceFile. - * - * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the - * shape of a the resulting SourceFile. This allows the DocumentRegistry to store - * multiple copies of the same file for different compilation settings. - * @param scriptSnapshot Text of the file. - * @param version Current version of the file. - */ + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. + */ updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile; getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey; /** - * Informs the DocumentRegistry that a file is not needed any longer. - * - * Note: It is not allowed to call release on a SourceFile that was not acquired from - * this registry originally. - * - * @param fileName The name of the file to be released - * @param compilationSettings The compilation settings used to acquire the file - */ + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void; reportStats(): string; @@ -3120,9 +4024,18 @@ declare namespace ts { function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; /** - * Get the path of the default library files (lib.d.ts) as distributed with the typescript - * node package. - * The functionality is not supported if the ts module is consumed outside of a node module. - */ + * Get the path of the default library files (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ function getDefaultLibFilePath(options: CompilerOptions): string; } +declare namespace ts { + /** + * Transform one or more nodes using the supplied transformers. + * @param source A single `Node` or an array of `Node` objects. + * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. + * @param compilerOptions Optional compiler options. + */ + function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions): TransformationResult; +} diff --git a/node_modules/typescript/lib/typescriptServices.js b/node_modules/typescript/lib/typescriptServices.js index d4ad545cf..ad7cbabef 100644 --- a/node_modules/typescript/lib/typescriptServices.js +++ b/node_modules/typescript/lib/typescriptServices.js @@ -13,11 +13,24 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +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; }; +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 __()); + }; +})(); var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword @@ -168,191 +181,191 @@ var ts; SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword"; SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword"; SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 133] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 134] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 135] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 136] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 137] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 138] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 139] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 140] = "OfKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 133] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 134] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 135] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 136] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 137] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 138] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 139] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 140] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 141] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 141] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 142] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 142] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 143] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 143] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 144] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 145] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 144] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 145] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 146] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 147] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 148] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 149] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 150] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 151] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 152] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 153] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 154] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 155] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 147] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 148] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 149] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 150] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 151] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 152] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 153] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 154] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 155] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 156] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 156] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 157] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 158] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 159] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 160] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 161] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 162] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 163] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 164] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 165] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 166] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 167] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 168] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 169] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 170] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 171] = "LiteralType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 157] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 158] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 159] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 160] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 161] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 162] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 163] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 164] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 165] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 166] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 167] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 168] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 169] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 170] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 171] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 172] = "LiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 172] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 173] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 174] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 173] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 174] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 175] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 175] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 176] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 177] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 178] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 179] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 180] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 181] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 182] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 183] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 184] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 185] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 186] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 187] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 188] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 189] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 190] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 191] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 192] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 193] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 194] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 195] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 196] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 197] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 198] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 199] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 200] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 201] = "NonNullExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 176] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 177] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 178] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 179] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 180] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 181] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 182] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 183] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 184] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 185] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 186] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 187] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 188] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 189] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 190] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 191] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 192] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 193] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 194] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 195] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 196] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 197] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 198] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 199] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 200] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 201] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 202] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 203] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 202] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 203] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 204] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 205] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 204] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 205] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 206] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 207] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 208] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 209] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 210] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 211] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 212] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 213] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 214] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 215] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 216] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 217] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 218] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 219] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 220] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 221] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 222] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 223] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 224] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 225] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 226] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 227] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 228] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 229] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 230] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 231] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 232] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 233] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 234] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 235] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 236] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 237] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 238] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 239] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 240] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 241] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 242] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 243] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 244] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 206] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 207] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 208] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 209] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 210] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 211] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 212] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 213] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 214] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 215] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 216] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 217] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 218] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 219] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 220] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 221] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 222] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 223] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 224] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 225] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 226] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 227] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 228] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 229] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 230] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 231] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 232] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 233] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 234] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 235] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 236] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 237] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 238] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 239] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 240] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 241] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 242] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 243] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 244] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 245] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 246] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 247] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 246] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 247] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 248] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 249] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 250] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 251] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 252] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 248] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 249] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 250] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 251] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 252] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 253] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 254] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 255] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 253] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 254] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 255] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 256] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 256] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 257] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 258] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 259] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 257] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 258] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 259] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 260] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 261] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 262] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 260] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 263] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 261] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 264] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 265] = "Bundle"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 262] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 266] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 263] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 267] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 264] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 265] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 266] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 267] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 268] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 269] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 270] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 271] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 272] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 273] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 274] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 275] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 276] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 268] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 269] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 270] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 271] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 272] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 273] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 274] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 275] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 276] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 277] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 278] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 279] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 280] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 281] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 282] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 283] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 284] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 285] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 286] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 287] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 288] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 289] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 290] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 291] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 292] = "JSDocLiteralType"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; // Enum value count SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; // Markers @@ -363,15 +376,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 140] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 141] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 156] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 171] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 157] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 172] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 140] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 141] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -380,11 +393,11 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 142] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 266] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 292] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 282] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -399,28 +412,22 @@ var ts; NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn"; NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn"; NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation"; - NodeFlags[NodeFlags["HasClassExtends"] = 1024] = "HasClassExtends"; - NodeFlags[NodeFlags["HasDecorators"] = 2048] = "HasDecorators"; - NodeFlags[NodeFlags["HasParamDecorators"] = 4096] = "HasParamDecorators"; - NodeFlags[NodeFlags["HasAsyncFunctions"] = 8192] = "HasAsyncFunctions"; - NodeFlags[NodeFlags["HasSpreadAttribute"] = 16384] = "HasSpreadAttribute"; - NodeFlags[NodeFlags["HasRestAttribute"] = 32768] = "HasRestAttribute"; - NodeFlags[NodeFlags["DisallowInContext"] = 65536] = "DisallowInContext"; - NodeFlags[NodeFlags["YieldContext"] = 131072] = "YieldContext"; - NodeFlags[NodeFlags["DecoratorContext"] = 262144] = "DecoratorContext"; - NodeFlags[NodeFlags["AwaitContext"] = 524288] = "AwaitContext"; - NodeFlags[NodeFlags["ThisNodeHasError"] = 1048576] = "ThisNodeHasError"; - NodeFlags[NodeFlags["JavaScriptFile"] = 2097152] = "JavaScriptFile"; - NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 4194304] = "ThisNodeOrAnySubNodesHasError"; - NodeFlags[NodeFlags["HasAggregatedChildData"] = 8388608] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 1024] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 2048] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 4096] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 8192] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 16384] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 32768] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; - NodeFlags[NodeFlags["EmitHelperFlags"] = 64512] = "EmitHelperFlags"; - NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 64896] = "ReachabilityAndEmitFlags"; + NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; // Parsing context flags - NodeFlags[NodeFlags["ContextFlags"] = 3080192] = "ContextFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 96256] = "ContextFlags"; // Exclude these flags when parsing a Type - NodeFlags[NodeFlags["TypeExcludesFlags"] = 655360] = "TypeExcludesFlags"; + NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags"; })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); var ModifierFlags; (function (ModifierFlags) { @@ -469,6 +476,17 @@ var ts; GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique"; GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node"; })(GeneratedIdentifierKind = ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {})); + /* @internal */ + var NumericLiteralFlags; + (function (NumericLiteralFlags) { + NumericLiteralFlags[NumericLiteralFlags["None"] = 0] = "None"; + NumericLiteralFlags[NumericLiteralFlags["Scientific"] = 2] = "Scientific"; + NumericLiteralFlags[NumericLiteralFlags["Octal"] = 4] = "Octal"; + NumericLiteralFlags[NumericLiteralFlags["HexSpecifier"] = 8] = "HexSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinarySpecifier"] = 16] = "BinarySpecifier"; + NumericLiteralFlags[NumericLiteralFlags["OctalSpecifier"] = 32] = "OctalSpecifier"; + NumericLiteralFlags[NumericLiteralFlags["BinaryOrOctalSpecifier"] = 48] = "BinaryOrOctalSpecifier"; + })(NumericLiteralFlags = ts.NumericLiteralFlags || (ts.NumericLiteralFlags = {})); var FlowFlags; (function (FlowFlags) { FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable"; @@ -482,6 +500,8 @@ var ts; FlowFlags[FlowFlags["ArrayMutation"] = 256] = "ArrayMutation"; FlowFlags[FlowFlags["Referenced"] = 512] = "Referenced"; FlowFlags[FlowFlags["Shared"] = 1024] = "Shared"; + FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally"; + FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally"; FlowFlags[FlowFlags["Label"] = 12] = "Label"; FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {})); @@ -503,6 +523,16 @@ var ts; // Diagnostics were produced and outputs were generated in spite of them. ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var NodeBuilderFlags; + (function (NodeBuilderFlags) { + NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None"; + NodeBuilderFlags[NodeBuilderFlags["allowThisInObjectLiteral"] = 1] = "allowThisInObjectLiteral"; + NodeBuilderFlags[NodeBuilderFlags["allowQualifedNameInPlaceOfIdentifier"] = 2] = "allowQualifedNameInPlaceOfIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowTypeParameterInQualifiedName"] = 4] = "allowTypeParameterInQualifiedName"; + NodeBuilderFlags[NodeBuilderFlags["allowAnonymousIdentifier"] = 8] = "allowAnonymousIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyUnionOrIntersection"] = 16] = "allowEmptyUnionOrIntersection"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyTuple"] = 32] = "allowEmptyTuple"; + })(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {})); var TypeFormatFlags; (function (TypeFormatFlags) { TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; @@ -517,6 +547,8 @@ var ts; TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias"; TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue"; + TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 2048] = "SuppressAnyReturnType"; + TypeFormatFlags[TypeFormatFlags["AddUndefined"] = 4096] = "AddUndefined"; })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var SymbolFormatFlags; (function (SymbolFormatFlags) { @@ -549,8 +581,7 @@ var ts; TypePredicateKind[TypePredicateKind["This"] = 0] = "This"; TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier"; })(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {})); - /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator - * metadata */ + /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator metadata */ /* @internal */ var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { @@ -598,13 +629,10 @@ var ts; SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType"; SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace"; SymbolFlags[SymbolFlags["Alias"] = 8388608] = "Alias"; - SymbolFlags[SymbolFlags["Instantiated"] = 16777216] = "Instantiated"; - SymbolFlags[SymbolFlags["Merged"] = 33554432] = "Merged"; - SymbolFlags[SymbolFlags["Transient"] = 67108864] = "Transient"; - SymbolFlags[SymbolFlags["Prototype"] = 134217728] = "Prototype"; - SymbolFlags[SymbolFlags["SyntheticProperty"] = 268435456] = "SyntheticProperty"; - SymbolFlags[SymbolFlags["Optional"] = 536870912] = "Optional"; - SymbolFlags[SymbolFlags["ExportStar"] = 1073741824] = "ExportStar"; + SymbolFlags[SymbolFlags["Prototype"] = 16777216] = "Prototype"; + SymbolFlags[SymbolFlags["ExportStar"] = 33554432] = "ExportStar"; + SymbolFlags[SymbolFlags["Optional"] = 67108864] = "Optional"; + SymbolFlags[SymbolFlags["Transient"] = 134217728] = "Transient"; SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; @@ -648,11 +676,27 @@ var ts; SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable"; })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {})); /* @internal */ + var CheckFlags; + (function (CheckFlags) { + CheckFlags[CheckFlags["Instantiated"] = 1] = "Instantiated"; + CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty"; + CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod"; + CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly"; + CheckFlags[CheckFlags["Partial"] = 16] = "Partial"; + CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType"; + CheckFlags[CheckFlags["ContainsPublic"] = 64] = "ContainsPublic"; + CheckFlags[CheckFlags["ContainsProtected"] = 128] = "ContainsProtected"; + CheckFlags[CheckFlags["ContainsPrivate"] = 256] = "ContainsPrivate"; + CheckFlags[CheckFlags["ContainsStatic"] = 512] = "ContainsStatic"; + CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic"; + })(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {})); + /* @internal */ var NodeCheckFlags; (function (NodeCheckFlags) { NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["CaptureNewTarget"] = 8] = "CaptureNewTarget"; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; @@ -701,6 +745,9 @@ var ts; TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; /* @internal */ TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["NonPrimitive"] = 16777216] = "NonPrimitive"; + /* @internal */ + TypeFlags[TypeFlags["JsxAttributes"] = 33554432] = "JsxAttributes"; /* @internal */ TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable"; TypeFlags[TypeFlags["Literal"] = 480] = "Literal"; @@ -709,7 +756,7 @@ var ts; TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy"; TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 16015] = "Intrinsic"; + TypeFlags[TypeFlags["Intrinsic"] = 16793231] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 8190] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 262178] = "StringLike"; @@ -718,11 +765,12 @@ var ts; TypeFlags[TypeFlags["EnumLike"] = 272] = "EnumLike"; TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; - TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["StructuredOrTypeVariable"] = 1032192] = "StructuredOrTypeVariable"; + TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never - TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable"; - TypeFlags[TypeFlags["NotUnionOrUnit"] = 33281] = "NotUnionOrUnit"; + TypeFlags[TypeFlags["Narrowable"] = 17810431] = "Narrowable"; + TypeFlags[TypeFlags["NotUnionOrUnit"] = 16810497] = "NotUnionOrUnit"; /* @internal */ TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; /* @internal */ @@ -764,6 +812,8 @@ var ts; SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty"; /// this.name = expr SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty"; + // F.name = expr + SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["Property"] = 5] = "Property"; })(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); var DiagnosticCategory; (function (DiagnosticCategory) { @@ -790,6 +840,7 @@ var ts; JsxEmit[JsxEmit["None"] = 0] = "None"; JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve"; JsxEmit[JsxEmit["React"] = 2] = "React"; + JsxEmit[JsxEmit["ReactNative"] = 3] = "ReactNative"; })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); var NewLineKind; (function (NewLineKind) { @@ -803,6 +854,7 @@ var ts; ScriptKind[ScriptKind["JSX"] = 2] = "JSX"; ScriptKind[ScriptKind["TS"] = 3] = "TS"; ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; + ScriptKind[ScriptKind["External"] = 5] = "External"; })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {})); var ScriptTarget; (function (ScriptTarget) { @@ -1037,7 +1089,6 @@ var ts; TransformFlags[TransformFlags["TypeScriptClassSyntaxMask"] = 274432] = "TypeScriptClassSyntaxMask"; TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask"; })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); - /* @internal */ var EmitFlags; (function (EmitFlags) { EmitFlags[EmitFlags["SingleLine"] = 1] = "SingleLine"; @@ -1065,15 +1116,45 @@ var ts; EmitFlags[EmitFlags["CustomPrologue"] = 524288] = "CustomPrologue"; EmitFlags[EmitFlags["NoHoisting"] = 1048576] = "NoHoisting"; EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 2097152] = "HasEndOfDeclarationMarker"; + EmitFlags[EmitFlags["Iterator"] = 4194304] = "Iterator"; })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); + /** + * Used by the checker, this enum keeps track of external emit helpers that should be type + * checked. + */ /* @internal */ - var EmitContext; - (function (EmitContext) { - EmitContext[EmitContext["SourceFile"] = 0] = "SourceFile"; - EmitContext[EmitContext["Expression"] = 1] = "Expression"; - EmitContext[EmitContext["IdentifierName"] = 2] = "IdentifierName"; - EmitContext[EmitContext["Unspecified"] = 3] = "Unspecified"; - })(EmitContext = ts.EmitContext || (ts.EmitContext = {})); + var ExternalEmitHelpers; + (function (ExternalEmitHelpers) { + ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends"; + ExternalEmitHelpers[ExternalEmitHelpers["Assign"] = 2] = "Assign"; + ExternalEmitHelpers[ExternalEmitHelpers["Rest"] = 4] = "Rest"; + ExternalEmitHelpers[ExternalEmitHelpers["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers[ExternalEmitHelpers["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers[ExternalEmitHelpers["Param"] = 32] = "Param"; + ExternalEmitHelpers[ExternalEmitHelpers["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers[ExternalEmitHelpers["Generator"] = 128] = "Generator"; + ExternalEmitHelpers[ExternalEmitHelpers["Values"] = 256] = "Values"; + ExternalEmitHelpers[ExternalEmitHelpers["Read"] = 512] = "Read"; + ExternalEmitHelpers[ExternalEmitHelpers["Spread"] = 1024] = "Spread"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncGenerator"] = 2048] = "AsyncGenerator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncDelegator"] = 4096] = "AsyncDelegator"; + ExternalEmitHelpers[ExternalEmitHelpers["AsyncValues"] = 8192] = "AsyncValues"; + // Helpers included by ES2015 for..of + ExternalEmitHelpers[ExternalEmitHelpers["ForOfIncludes"] = 256] = "ForOfIncludes"; + // Helpers included by ES2017 for..await..of + ExternalEmitHelpers[ExternalEmitHelpers["ForAwaitOfIncludes"] = 8192] = "ForAwaitOfIncludes"; + // Helpers included by ES2015 spread + ExternalEmitHelpers[ExternalEmitHelpers["SpreadIncludes"] = 1536] = "SpreadIncludes"; + ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 8192] = "LastEmitHelper"; + })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); + var EmitHint; + (function (EmitHint) { + EmitHint[EmitHint["SourceFile"] = 0] = "SourceFile"; + EmitHint[EmitHint["Expression"] = 1] = "Expression"; + EmitHint[EmitHint["IdentifierName"] = 2] = "IdentifierName"; + EmitHint[EmitHint["Unspecified"] = 3] = "Unspecified"; + })(EmitHint = ts.EmitHint || (ts.EmitHint = {})); })(ts || (ts = {})); /*@internal*/ var ts; @@ -1101,8 +1182,8 @@ var ts; */ function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } @@ -1118,9 +1199,9 @@ var ts; */ function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; @@ -1130,7 +1211,7 @@ var ts; * @param markName The name of the mark. */ function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; /** @@ -1139,7 +1220,7 @@ var ts; * @param measureName The name of the measure whose durations should be accumulated. */ function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; /** @@ -1148,9 +1229,9 @@ var ts; * @param cb The action to perform for each measure */ function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; /** Enables (and resets) performance measurements for the compiler. */ @@ -1174,7 +1255,7 @@ var ts; var ts; (function (ts) { /** The version of the TypeScript compiler release */ - ts.version = "2.2.0-dev.20161127"; + ts.version = "2.3.0-dev.20170419"; })(ts || (ts = {})); /* @internal */ (function (ts) { @@ -1193,25 +1274,106 @@ var ts; Ternary[Ternary["Maybe"] = 1] = "Maybe"; Ternary[Ternary["True"] = -1] = "True"; })(Ternary = ts.Ternary || (ts.Ternary = {})); - var createObject = Object.create; // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); // tslint:disable-line:no-null-keyword + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(/*locales*/ undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + /** Create a MapLike with good performance. */ + function createDictionaryObject() { + var map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. // This disables creation of hidden classes, which are expensive when an object is // constantly changing shape. map["__"] = undefined; delete map["__"]; + return map; + } + /** Create a new map. If a template object is provided, the map will copy entries from it. */ + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); // Copies keys/values from template. Note that for..in will not throw if // template is undefined, and instead will just exit the loop. for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + // Internet Explorer's Map doesn't support iteration, so don't use it. + // tslint:disable-next-line:no-in-operator + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + // Keep the class inside a function so it doesn't get compiled if it's not used. + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + // tslint:disable-next-line:no-in-operator + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -1224,33 +1386,28 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } // path should already be well-formed so it does not need to be normalized function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -1270,6 +1427,10 @@ var ts; Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; })(Comparison = ts.Comparison || (ts.Comparison = {})); + function length(array) { + return array ? array.length : 0; + } + ts.length = length; /** * Iterates through 'array' by index and performs the callback on each element of array until the callback * returns a truthy value, then returns that value. @@ -1277,7 +1438,7 @@ var ts; */ function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1287,6 +1448,26 @@ var ts; return undefined; } ts.forEach = forEach; + /** + * Iterates through the parent chain of a node and performs the callback on each parent until the callback + * returns a truthy value, then returns that value. + * If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" + * At that point findAncestor returns undefined. + */ + function findAncestor(node, callback) { + while (node) { + var result = callback(node); + if (result === "quit") { + return undefined; + } + else if (result) { + return node; + } + node = node.parent; + } + return undefined; + } + ts.findAncestor = findAncestor; function zipWith(arrayA, arrayB, callback) { Debug.assert(arrayA.length === arrayB.length); for (var i = 0; i < arrayA.length; i++) { @@ -1301,7 +1482,7 @@ var ts; */ function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -1312,7 +1493,7 @@ var ts; ts.every = every; /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -1321,12 +1502,22 @@ var ts; return undefined; } ts.find = find; + /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */ + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; /** * Returns the first truthy result of `callback`, or else fails. * This is like `forEach`, but never returns undefined. */ function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1349,7 +1540,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -1359,7 +1550,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -1569,21 +1760,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -1901,9 +2089,6 @@ var ts; /** * Indicates whether a map-like contains an own property with the specified key. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * the 'in' operator. - * * @param map A map-like. * @param key A property key. */ @@ -1914,9 +2099,6 @@ var ts; /** * Gets the value of an owned property in a map-like. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * an indexer. - * * @param map A map-like. * @param key A property key. */ @@ -1941,56 +2123,61 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - /** - * Enumerates the properties of a Map, invoking a callback and returning the first truthy result. - * - * @param map A map for which properties should be enumerated. - * @param callback A callback to invoke for each property. - */ - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator, map) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(map ? map(value) : value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - /** - * Returns true if a Map has some matching property. - * - * @param map A map whose properties should be tested. - * @param predicate An optional callback used to test each property. - */ - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function convertToArray(iterator, f) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(f(value)); } - return false; + return result; + var _b; } - ts.someProperties = someProperties; + ts.convertToArray = convertToArray; /** - * Performs a shallow copy of the properties from a source Map to a target MapLike - * - * @param source A map from which properties should be copied. - * @param target A map to which properties should be copied. + * Calls `callback` for each entry in the map, returning the first truthy result. + * Use `map.forEach` instead for normal iteration. */ - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachEntry = forEachEntry; + /** `forEachEntry` for just keys. */ + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } + } + return undefined; + var _b; + } + ts.forEachKey = forEachKey; + /** Copy entries from `source` to `target`. */ + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); } - ts.appendProperty = appendProperty; + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -1998,51 +2185,14 @@ var ts; } for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { var arg = args_1[_a]; - for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) { - var p = _c[_b]; - t[p] = arg[p]; - } + for (var p in arg) + if (hasProperty(arg, p)) { + t[p] = arg[p]; + } } return t; } ts.assign = assign; - /** - * Reduce the properties of a map. - * - * NOTE: This is intended for use with Map objects. For MapLike objects, use - * reduceOwnProperties instead as it offers better runtime safety. - * - * @param map The map to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; - /** - * Reduce the properties defined on a map-like (but not from its prototype chain). - * - * NOTE: This is intended for use with MapLike objects. For Map objects, use - * reduceProperties instead as it offers better performance. - * - * @param map The map-like to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -2073,23 +2223,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -2116,36 +2257,32 @@ var ts; return result; } ts.extend = extend; - /** - * Adds the value to an array of values associated with the key, and returns the array. - * Creates the array if it does not already exist. - */ - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - /** - * Removes a value from an array of values associated with the key. - * Does not preserve the order of those values. - * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. - */ - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; /** * Tests whether a value is an array. */ @@ -2226,6 +2363,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -2328,9 +2466,12 @@ var ts; if (b === undefined) return 1 /* GreaterThan */; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - // accent means a ≠ b, a ≠ aÌ, a = A - var result = a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); + // Checking if "collator exists indicates that Intl is available. + // We still have to check if "collator.compare" is correct. If it is not, use "String.localeComapre" + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); // accent means a ≠ b, a ≠ aÌ, a = A return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */; } a = a.toUpperCase(); @@ -2403,7 +2544,7 @@ var ts; ts.normalizeSlashes = normalizeSlashes; /** * Returns length of path root (i.e. length of "/", "x:/", "//server/share/, file:///user/files") - */ + */ function getRootLength(path) { if (path.charCodeAt(0) === 47 /* slash */) { if (path.charCodeAt(1) !== 47 /* slash */) @@ -2775,6 +2916,17 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + // If excluding, match "foo/bar/baz...", but if including, only allow "foo". + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } @@ -2785,31 +2937,10 @@ var ts; * files or directories, does not match subdirectories that start with a . character */ var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - // If excluding, match "foo/bar/baz...", but if including, only allow "foo". - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; /** * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension, * and does not contain any glob characters itself. @@ -2888,6 +3019,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -2900,34 +3032,50 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + // Associate an array of results with each include regex. This keeps results in order of the "include" order. + // If there are no "includes", then just put everything in results[0]. + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); + } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -2952,7 +3100,7 @@ var ts; } // Sort the offsets array using either the literal or canonical path representations. includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } @@ -2961,7 +3109,7 @@ var ts; // subpath of an existing base path for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -3010,8 +3158,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = allSupportedExtensions.slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (extensions.indexOf(extInfo.extension) === -1) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -3022,11 +3181,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -3044,14 +3203,13 @@ var ts; (function (ExtensionPriority) { ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles"; ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles"; - ExtensionPriority[ExtensionPriority["Limit"] = 5] = "Limit"; ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest"; ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest"; })(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {})); function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--) { if (fileExtensionIs(path, supportedExtensions[i])) { - return adjustExtensionPriority(i); + return adjustExtensionPriority(i, supportedExtensions); } } // If its not in the list of supported extensions, this is likely a @@ -3062,27 +3220,27 @@ var ts; /** * Adjusts an extension priority to be the highest priority within the same range. */ - function adjustExtensionPriority(extensionPriority) { + function adjustExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) { return 0 /* TypeScriptFiles */; } - else if (extensionPriority < 5 /* Limit */) { + else if (extensionPriority < supportedExtensions.length) { return 2 /* DeclarationAndJavaScriptFiles */; } else { - return 5 /* Limit */; + return supportedExtensions.length; } } ts.adjustExtensionPriority = adjustExtensionPriority; /** * Gets the next lowest extension priority for a given priority. */ - function getNextLowestExtensionPriority(extensionPriority) { + function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) { return 2 /* DeclarationAndJavaScriptFiles */; } else { - return 5 /* Limit */; + return supportedExtensions.length; } } ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority; @@ -3329,144 +3487,30 @@ var ts; } } ts.tryGetExtensionFromPath = tryGetExtensionFromPath; + function isCheckJsEnabledForFile(sourceFile, compilerOptions) { + return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; + } + ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile; })(ts || (ts = {})); /// var ts; (function (ts) { - ts.sys = (function () { - function getWScriptSystem() { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - var shell = new ActiveXObject("WScript.Shell"); - var fileStream = new ActiveXObject("ADODB.Stream"); - fileStream.Type = 2 /*text*/; - var binaryStream = new ActiveXObject("ADODB.Stream"); - binaryStream.Type = 1 /*binary*/; - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); - } - function readFile(fileName, encoding) { - if (!fso.FileExists(fileName)) { - return undefined; - } - fileStream.Open(); - try { - if (encoding) { - fileStream.Charset = encoding; - fileStream.LoadFromFile(fileName); - } - else { - // Load file and read the first two bytes into a string with no interpretation - fileStream.Charset = "x-ansi"; - fileStream.LoadFromFile(fileName); - var bom = fileStream.ReadText(2) || ""; - // Position must be at 0 before encoding can be changed - fileStream.Position = 0; - // [0xFF,0xFE] and [0xFE,0xFF] mean utf-16 (little or big endian), otherwise default to utf-8 - fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; - } - // ReadText method always strips byte order mark from resulting string - return fileStream.ReadText(); - } - catch (e) { - throw e; - } - finally { - fileStream.Close(); - } - } - function writeFile(fileName, data, writeByteOrderMark) { - fileStream.Open(); - binaryStream.Open(); - try { - // Write characters in UTF-8 encoding - fileStream.Charset = "utf-8"; - fileStream.WriteText(data); - // If we don't want the BOM, then skip it by setting the starting location to 3 (size of BOM). - // If not, start from position 0, as the BOM will be added automatically when charset==utf8. - if (writeByteOrderMark) { - fileStream.Position = 0; - } - else { - fileStream.Position = 3; - } - fileStream.CopyTo(binaryStream); - binaryStream.SaveToFile(fileName, 2 /*overwrite*/); - } - finally { - binaryStream.Close(); - fileStream.Close(); - } - } - function getNames(collection) { - var result = []; - for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { - result.push(e.item().Name); - } - return result.sort(); - } - function getDirectories(path) { - var folder = fso.GetFolder(path); - return getNames(folder.subfolders); - } - function getAccessibleFileSystemEntries(path) { - try { - var folder = fso.GetFolder(path || "."); - var files = getNames(folder.files); - var directories = getNames(folder.subfolders); - return { files: files, directories: directories }; - } - catch (e) { - return { files: [], directories: [] }; - } - } - function readDirectory(path, extensions, excludes, includes) { - return ts.matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries); - } - var wscriptSystem = { - args: args, - newLine: "\r\n", - useCaseSensitiveFileNames: false, - write: function (s) { - WScript.StdOut.Write(s); - }, - readFile: readFile, - writeFile: writeFile, - resolvePath: function (path) { - return fso.GetAbsolutePathName(path); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - createDirectory: function (directoryName) { - if (!wscriptSystem.directoryExists(directoryName)) { - fso.CreateFolder(directoryName); - } - }, - getExecutingFilePath: function () { - return WScript.ScriptFullName; - }, - getCurrentDirectory: function () { - return shell.CurrentDirectory; - }, - getDirectories: getDirectories, - getEnvironmentVariable: function (name) { - return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%" + name + "%"); - }, - readDirectory: readDirectory, - exit: function (exitCode) { - try { - WScript.Quit(exitCode); - } - catch (e) { - } - } - }; - return wscriptSystem; + function getNodeMajorVersion() { + if (typeof process === "undefined") { + return undefined; + } + var version = process.version; + if (!version) { + return undefined; + } + var dot = version.indexOf("."); + if (dot === -1) { + return undefined; } + return parseInt(version.substring(1, dot)); + } + ts.getNodeMajorVersion = getNodeMajorVersion; + ts.sys = (function () { function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); @@ -3476,32 +3520,32 @@ var ts; function createWatchedFileSet() { var dirWatchers = ts.createMap(); // One file can have multiple watchers - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -3513,7 +3557,7 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" @@ -3521,18 +3565,20 @@ var ts; ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); // Some applications save a working file via rename operations - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } } var watchedFileSet = createWatchedFileSet(); - function isNode4OrLater() { - return parseInt(process.version.charAt(1)) >= 4; - } + var nodeVersion = getNodeMajorVersion(); + var isNode4OrLater = nodeVersion >= 4; function isFileSystemCaseSensitive() { // win32\win64 are case insensitive platforms if (platform === "win32" || platform === "win64") { @@ -3553,7 +3599,7 @@ var ts; if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { // Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js, // flip all byte pairs and treat as little endian. - len &= ~1; + len &= ~1; // Round down to a multiple of 2 for (var i = 0; i < len; i += 2) { var temp = buffer[i]; buffer[i] = buffer[i + 1]; @@ -3580,7 +3626,7 @@ var ts; var fd; try { fd = _fs.openSync(fileName, "w"); - _fs.writeSync(fd, data, undefined, "utf8"); + _fs.writeSync(fd, data, /*position*/ undefined, "utf8"); } finally { if (fd !== undefined) { @@ -3600,10 +3646,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -3685,9 +3731,10 @@ var ts; // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643) var options; if (!directoryExists(directoryName)) { + // do nothing if target folder does not exist return noOpFileWatcher; } - if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } else { @@ -3701,7 +3748,6 @@ var ts; // When deleting a file, the passed baseFileName is null callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } - ; }); }, resolvePath: function (path) { @@ -3765,6 +3811,7 @@ var ts; require("source-map-support").install(); } catch (e) { + // Could not enable source maps. } }, setTimeout: setTimeout, @@ -3820,9 +3867,6 @@ var ts; if (typeof ChakraHost !== "undefined") { sys = getChakraSystem(); } - else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - sys = getWScriptSystem(); - } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { // process and process.nextTick checks if current environment is node-like // process.browser check excludes webpack and browserify @@ -3897,11 +3941,11 @@ var ts; Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, - Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: "Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059", message: "Return expression in async function does not have a valid callable 'then' member." }, - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: "Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060", message: "Expression body for async arrow function does not have a valid callable 'then' member." }, + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", message: "The return type of an async function must either be a valid promise or must not contain a callable 'then' member." }, + A_promise_must_have_a_then_method: { code: 1059, category: ts.DiagnosticCategory.Error, key: "A_promise_must_have_a_then_method_1059", message: "A promise must have a 'then' method." }, + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: { code: 1060, category: ts.DiagnosticCategory.Error, key: "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", message: "The first parameter of the 'then' method of a promise must be a callback." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, @@ -3910,7 +3954,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -3926,6 +3970,7 @@ var ts; Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, + A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: { code: 1103, category: ts.DiagnosticCategory.Error, key: "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", message: "A 'for-await-of' statement is only allowed within an async function or async generator." }, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, @@ -3933,7 +3978,7 @@ var ts; Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, + Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'." }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, @@ -3965,9 +4010,9 @@ var ts; Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", message: "Cannot use imports, exports, or module augmentations when '--module' is 'none'." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing." }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, + const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized." }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, @@ -4016,11 +4061,12 @@ var ts; Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode" }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." }, @@ -4066,6 +4112,11 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1320, category: ts.DiagnosticCategory.Error, key: "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", message: "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1321, category: ts.DiagnosticCategory.Error, key: "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", message: "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1322, category: ts.DiagnosticCategory.Error, key: "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", message: "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -4109,6 +4160,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -4119,19 +4171,20 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter." }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, + Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'." }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, @@ -4171,12 +4224,12 @@ var ts; The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class." }, The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, + Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'." }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, @@ -4185,19 +4238,19 @@ var ts; Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, + Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'." }, All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, + Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'." }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged." }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged." }, Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'" }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name." }, + Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'." }, Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'" }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, @@ -4206,18 +4259,20 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, + Class_0_used_before_its_declaration: { code: 2449, category: ts.DiagnosticCategory.Error, key: "Class_0_used_before_its_declaration_2449", message: "Class '{0}' used before its declaration." }, + Enum_0_used_before_its_declaration: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Enum_0_used_before_its_declaration_2450", message: "Enum '{0}' used before its declaration." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, + Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'." }, An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" }, + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern." }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, @@ -4238,13 +4293,13 @@ var ts; let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'." }, The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause" }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause." }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, @@ -4256,6 +4311,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, + Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: { code: 2504, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", message: "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator." }, A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, @@ -4270,6 +4326,7 @@ var ts; All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, + An_async_iterator_must_have_a_next_method: { code: 2519, category: ts.DiagnosticCategory.Error, key: "An_async_iterator_must_have_a_next_method_2519", message: "An async iterator must have a 'next()' method." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, @@ -4293,23 +4350,33 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, + Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." }, + The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: { code: 2547, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", message: "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property." }, + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2548, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", message: "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2549, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", message: "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: { code: 2550, category: ts.DiagnosticCategory.Error, key: "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", message: "Generic type instantiation is excessively deep and possibly infinite." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, + Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'." }, JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, - Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property." }, + The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property." }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, + Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React." }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, - Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element." }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'." }, super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, @@ -4341,7 +4408,6 @@ var ts; All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, - A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." }, An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, @@ -4350,9 +4416,17 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference." }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property." }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, + Required_type_parameters_may_not_follow_optional_type_parameters: { code: 2706, category: ts.DiagnosticCategory.Error, key: "Required_type_parameters_may_not_follow_optional_type_parameters_2706", message: "Required type parameters may not follow optional type parameters." }, + Generic_type_0_requires_between_1_and_2_type_arguments: { code: 2707, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_between_1_and_2_type_arguments_2707", message: "Generic type '{0}' requires between {1} and {2} type arguments." }, + Cannot_use_namespace_0_as_a_value: { code: 2708, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_value_2708", message: "Cannot use namespace '{0}' as a value." }, + Cannot_use_namespace_0_as_a_type: { code: 2709, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_type_2709", message: "Cannot use namespace '{0}' as a type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -4363,8 +4437,8 @@ var ts; Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "'extends' clause of exported class '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "'extends' clause of exported interface '{0}' has or is using private name '{1}'." }, Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, @@ -4425,16 +4499,18 @@ var ts; Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced: { code: 4093, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced_4093", message: "'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", message: "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported_file_encoding_5013", message: "Unsupported file encoding." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}." }, Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}" }, + Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", message: "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, @@ -4443,12 +4519,12 @@ var ts; A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, - The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'." }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'." }, Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, - Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character." }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character." }, Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_should_be_an_array_5063", message: "Substitutions for pattern '{0}' should be an array." }, Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, @@ -4466,11 +4542,11 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'." }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -4485,11 +4561,12 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -4511,17 +4588,18 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context (experimental)." }, Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'." }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", message: "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit" }, Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, @@ -4532,23 +4610,23 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, + package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, - Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, - Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, - Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, - Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'." }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'." }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'." }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'." }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'." }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed." }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, @@ -4558,32 +4636,67 @@ var ts; Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, - Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'." }, Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, - Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'." }, Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, - Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'." }, Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." }, - File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" }, + File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it." }, _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." }, Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" }, - No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" }, + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files." }, Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" }, + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file." }, Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, + Show_diagnostic_information: { code: 6149, category: ts.DiagnosticCategory.Message, key: "Show_diagnostic_information_6149", message: "Show diagnostic information." }, + Show_verbose_diagnostic_information: { code: 6150, category: ts.DiagnosticCategory.Message, key: "Show_verbose_diagnostic_information_6150", message: "Show verbose diagnostic information." }, + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: { code: 6151, category: ts.DiagnosticCategory.Message, key: "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", message: "Emit a single file with source maps instead of having a separate file." }, + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: { code: 6152, category: ts.DiagnosticCategory.Message, key: "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", message: "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set." }, + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: { code: 6153, category: ts.DiagnosticCategory.Message, key: "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", message: "Transpile each file as a separate module (similar to 'ts.transpileModule')." }, + Print_names_of_generated_files_part_of_the_compilation: { code: 6154, category: ts.DiagnosticCategory.Message, key: "Print_names_of_generated_files_part_of_the_compilation_6154", message: "Print names of generated files part of the compilation." }, + Print_names_of_files_part_of_the_compilation: { code: 6155, category: ts.DiagnosticCategory.Message, key: "Print_names_of_files_part_of_the_compilation_6155", message: "Print names of files part of the compilation." }, + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: { code: 6156, category: ts.DiagnosticCategory.Message, key: "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", message: "The locale used when displaying messages to the user (e.g. 'en-us')" }, + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: { code: 6157, category: ts.DiagnosticCategory.Message, key: "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", message: "Do not generate custom helper functions like '__extends' in compiled output." }, + Do_not_include_the_default_library_file_lib_d_ts: { code: 6158, category: ts.DiagnosticCategory.Message, key: "Do_not_include_the_default_library_file_lib_d_ts_6158", message: "Do not include the default library file (lib.d.ts)." }, + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: { code: 6159, category: ts.DiagnosticCategory.Message, key: "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", message: "Do not add triple-slash references or imported modules to the list of compiled files." }, + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: { code: 6160, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", message: "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files." }, + List_of_folders_to_include_type_definitions_from: { code: 6161, category: ts.DiagnosticCategory.Message, key: "List_of_folders_to_include_type_definitions_from_6161", message: "List of folders to include type definitions from." }, + Disable_size_limitations_on_JavaScript_projects: { code: 6162, category: ts.DiagnosticCategory.Message, key: "Disable_size_limitations_on_JavaScript_projects_6162", message: "Disable size limitations on JavaScript projects." }, + The_character_set_of_the_input_files: { code: 6163, category: ts.DiagnosticCategory.Message, key: "The_character_set_of_the_input_files_6163", message: "The character set of the input files." }, + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: { code: 6164, category: ts.DiagnosticCategory.Message, key: "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", message: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files." }, + Do_not_truncate_error_messages: { code: 6165, category: ts.DiagnosticCategory.Message, key: "Do_not_truncate_error_messages_6165", message: "Do not truncate error messages." }, + Output_directory_for_generated_declaration_files: { code: 6166, category: ts.DiagnosticCategory.Message, key: "Output_directory_for_generated_declaration_files_6166", message: "Output directory for generated declaration files." }, + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: { code: 6167, category: ts.DiagnosticCategory.Message, key: "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", message: "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'." }, + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: { code: 6168, category: ts.DiagnosticCategory.Message, key: "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", message: "List of root folders whose combined content represents the structure of the project at runtime." }, + Show_all_compiler_options: { code: 6169, category: ts.DiagnosticCategory.Message, key: "Show_all_compiler_options_6169", message: "Show all compiler options." }, + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: { code: 6170, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", message: "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file" }, + Command_line_Options: { code: 6171, category: ts.DiagnosticCategory.Message, key: "Command_line_Options_6171", message: "Command-line Options" }, + Basic_Options: { code: 6172, category: ts.DiagnosticCategory.Message, key: "Basic_Options_6172", message: "Basic Options" }, + Strict_Type_Checking_Options: { code: 6173, category: ts.DiagnosticCategory.Message, key: "Strict_Type_Checking_Options_6173", message: "Strict Type-Checking Options" }, + Module_Resolution_Options: { code: 6174, category: ts.DiagnosticCategory.Message, key: "Module_Resolution_Options_6174", message: "Module Resolution Options" }, + Source_Map_Options: { code: 6175, category: ts.DiagnosticCategory.Message, key: "Source_Map_Options_6175", message: "Source Map Options" }, + Additional_Checks: { code: 6176, category: ts.DiagnosticCategory.Message, key: "Additional_Checks_6176", message: "Additional Checks" }, + Experimental_Options: { code: 6177, category: ts.DiagnosticCategory.Message, key: "Experimental_Options_6177", message: "Experimental Options" }, + Advanced_Options: { code: 6178, category: ts.DiagnosticCategory.Message, key: "Advanced_Options_6178", message: "Advanced Options" }, + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: { code: 6179, category: ts.DiagnosticCategory.Message, key: "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", message: "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'." }, + Enable_all_strict_type_checking_options: { code: 6180, category: ts.DiagnosticCategory.Message, key: "Enable_all_strict_type_checking_options_6180", message: "Enable all strict type-checking options." }, + List_of_language_service_plugins: { code: 6181, category: ts.DiagnosticCategory.Message, key: "List_of_language_service_plugins_6181", message: "List of language service plugins." }, + Scoped_package_detected_looking_in_0: { code: 6182, category: ts.DiagnosticCategory.Message, key: "Scoped_package_detected_looking_in_0_6182", message: "Scoped package detected, looking in '{0}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -4601,7 +4714,7 @@ var ts; _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists." }, Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, @@ -4625,7 +4738,7 @@ var ts; parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -4633,28 +4746,40 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'." }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: '{0}'." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig." }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, - Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, - Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, - Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}." }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}." }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." }, + Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." }, + Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'." }, + Disable_checking_for_this_file: { code: 90018, category: ts.DiagnosticCategory.Message, key: "Disable_checking_for_this_file_90018", message: "Disable checking for this file." }, + Ignore_this_error_message: { code: 90019, category: ts.DiagnosticCategory.Message, key: "Ignore_this_error_message_90019", message: "Ignore this error message." }, + Initialize_property_0_in_the_constructor: { code: 90020, category: ts.DiagnosticCategory.Message, key: "Initialize_property_0_in_the_constructor_90020", message: "Initialize property '{0}' in the constructor." }, + Initialize_static_property_0: { code: 90021, category: ts.DiagnosticCategory.Message, key: "Initialize_static_property_0_90021", message: "Initialize static property '{0}'." }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, + Report_errors_in_js_files: { code: 8019, category: ts.DiagnosticCategory.Message, key: "Report_errors_in_js_files_8019", message: "Report errors in .js files." }, }; })(ts || (ts = {})); /// @@ -4666,7 +4791,7 @@ var ts; return token >= 70 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116 /* AbstractKeyword */, "any": 118 /* AnyKeyword */, "as": 117 /* AsKeyword */, @@ -4690,7 +4815,7 @@ var ts; "false": 85 /* FalseKeyword */, "finally": 86 /* FinallyKeyword */, "for": 87 /* ForKeyword */, - "from": 138 /* FromKeyword */, + "from": 139 /* FromKeyword */, "function": 88 /* FunctionKeyword */, "get": 124 /* GetKeyword */, "if": 89 /* IfKeyword */, @@ -4708,27 +4833,28 @@ var ts; "new": 93 /* NewKeyword */, "null": 94 /* NullKeyword */, "number": 132 /* NumberKeyword */, + "object": 133 /* ObjectKeyword */, "package": 110 /* PackageKeyword */, "private": 111 /* PrivateKeyword */, "protected": 112 /* ProtectedKeyword */, "public": 113 /* PublicKeyword */, "readonly": 130 /* ReadonlyKeyword */, "require": 131 /* RequireKeyword */, - "global": 139 /* GlobalKeyword */, + "global": 140 /* GlobalKeyword */, "return": 95 /* ReturnKeyword */, - "set": 133 /* SetKeyword */, + "set": 134 /* SetKeyword */, "static": 114 /* StaticKeyword */, - "string": 134 /* StringKeyword */, + "string": 135 /* StringKeyword */, "super": 96 /* SuperKeyword */, "switch": 97 /* SwitchKeyword */, - "symbol": 135 /* SymbolKeyword */, + "symbol": 136 /* SymbolKeyword */, "this": 98 /* ThisKeyword */, "throw": 99 /* ThrowKeyword */, "true": 100 /* TrueKeyword */, "try": 101 /* TryKeyword */, - "type": 136 /* TypeKeyword */, + "type": 137 /* TypeKeyword */, "typeof": 102 /* TypeOfKeyword */, - "undefined": 137 /* UndefinedKeyword */, + "undefined": 138 /* UndefinedKeyword */, "var": 103 /* VarKeyword */, "void": 104 /* VoidKeyword */, "while": 105 /* WhileKeyword */, @@ -4736,7 +4862,7 @@ var ts; "yield": 115 /* YieldKeyword */, "async": 119 /* AsyncKeyword */, "await": 120 /* AwaitKeyword */, - "of": 140 /* OfKeyword */, + "of": 141 /* OfKeyword */, "{": 16 /* OpenBraceToken */, "}": 17 /* CloseBraceToken */, "(": 18 /* OpenParenToken */, @@ -4876,9 +5002,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -4888,7 +5014,7 @@ var ts; ts.tokenToString = tokenToString; /* @internal */ function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; /* @internal */ @@ -4904,6 +5030,7 @@ var ts; if (text.charCodeAt(pos) === 10 /* lineFeed */) { pos++; } + // falls through case 10 /* lineFeed */: result.push(lineStart); lineStart = pos; @@ -4962,7 +5089,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -5049,6 +5175,7 @@ var ts; if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) { pos++; } + // falls through case 10 /* lineFeed */: pos++; if (stopAfterLineBreak) { @@ -5121,7 +5248,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -5203,6 +5330,7 @@ var ts; if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) { pos++; } + // falls through case 10 /* lineFeed */: pos++; if (trailing) { @@ -5298,15 +5426,15 @@ var ts; if (!comments) { comments = []; } - comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); return comments; } function getLeadingCommentRanges(text, pos) { - return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); + return reduceEachLeadingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined); } ts.getLeadingCommentRanges = getLeadingCommentRanges; function getTrailingCommentRanges(text, pos) { - return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); + return reduceEachTrailingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined); } ts.getTrailingCommentRanges = getTrailingCommentRanges; /** Optionally, get the shebang */ @@ -5333,7 +5461,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -5357,6 +5485,7 @@ var ts; var precedingLineBreak; var hasExtendedUnicodeEscape; var tokenIsUnterminated; + var numericLiteralFlags; setText(text, start, length); return { getStartPos: function () { return startPos; }, @@ -5370,6 +5499,7 @@ var ts; isIdentifier: function () { return token === 70 /* Identifier */ || token > 106 /* LastReservedWord */; }, isReservedWord: function () { return token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */; }, isUnterminated: function () { return tokenIsUnterminated; }, + getNumericLiteralFlags: function () { return numericLiteralFlags; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -5406,6 +5536,7 @@ var ts; var end = pos; if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { pos++; + numericLiteralFlags = 2 /* Scientific */; if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) pos++; if (isDigit(text.charCodeAt(pos))) { @@ -5604,7 +5735,7 @@ var ts; if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) { pos++; } - // fall through + // falls through case 10 /* lineFeed */: case 8232 /* lineSeparator */: case 8233 /* paragraphSeparator */: @@ -5705,8 +5836,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 /* a */ && ch <= 122 /* z */) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70 /* Identifier */; @@ -5738,6 +5872,7 @@ var ts; hasExtendedUnicodeEscape = false; precedingLineBreak = false; tokenIsUnterminated = false; + numericLiteralFlags = 0; while (true) { tokenPos = pos; if (pos >= end) { @@ -5923,6 +6058,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 8 /* HexSpecifier */; return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { @@ -5933,6 +6069,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 16 /* BinarySpecifier */; return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { @@ -5943,16 +6080,19 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 32 /* OctalSpecifier */; return token = 8 /* NumericLiteral */; } // Try to parse as an octal if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); + numericLiteralFlags = 4 /* Octal */; return token = 8 /* NumericLiteral */; } // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being // permissive and allowing decimal digits of the form 08* and 09* (which many browsers also do). + // falls through case 49 /* _1 */: case 50 /* _2 */: case 51 /* _3 */: @@ -6206,7 +6346,14 @@ var ts; while (pos < end) { pos++; char = text.charCodeAt(pos); - if ((char === 123 /* openBrace */) || (char === 60 /* lessThan */)) { + if (char === 123 /* openBrace */) { + break; + } + if (char === 60 /* lessThan */) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7 /* ConflictMarkerTrivia */; + } break; } } @@ -6399,6 +6546,19 @@ var ts; return undefined; } ts.getDeclarationOfKind = getDeclarationOfKind; + function findDeclaration(symbol, predicate) { + var declarations = symbol.declarations; + if (declarations) { + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; + if (predicate(declaration)) { + return declaration; + } + } + } + return undefined; + } + ts.findDeclaration = findDeclaration; // Pool writers to avoid needing to allocate them for every symbol we write. var stringWriters = []; function getSingleLineStringWriter() { @@ -6413,6 +6573,7 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. @@ -6421,7 +6582,8 @@ var ts; decreaseIndent: ts.noop, clear: function () { return str_1 = ""; }, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; } return stringWriters.pop(); @@ -6437,25 +6599,25 @@ var ts; } ts.getFullWidth = getFullWidth; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { if (!sourceFile.resolvedModules) { sourceFile.resolvedModules = ts.createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } ts.setResolvedModule = setResolvedModule; function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { if (!sourceFile.resolvedTypeReferenceDirectiveNames) { sourceFile.resolvedTypeReferenceDirectiveNames = ts.createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; /* @internal */ @@ -6477,7 +6639,7 @@ var ts; } for (var i = 0; i < names.length; i++) { var newResolution = newResolutions[i]; - var oldResolution = oldResolutions && oldResolutions[names[i]]; + var oldResolution = oldResolutions && oldResolutions.get(names[i]); var changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -6491,28 +6653,28 @@ var ts; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); - return (node.flags & 4194304 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 131072 /* ThisNodeOrAnySubNodesHasError */) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 8388608 /* HasAggregatedChildData */)) { + if (!(node.flags & 262144 /* HasAggregatedChildData */)) { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. - var thisNodeOrAnySubNodesHasError = ((node.flags & 1048576 /* ThisNodeHasError */) !== 0) || + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { - node.flags |= 4194304 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 131072 /* ThisNodeOrAnySubNodesHasError */; } // Also mark that we've propagated the child information to this node. This way we can // always consult the bit directly on this node without needing to check its children // again. - node.flags |= 8388608 /* HasAggregatedChildData */; + node.flags |= 262144 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261 /* SourceFile */) { + while (node && node.kind !== 264 /* SourceFile */) { node = node.parent; } return node; @@ -6520,11 +6682,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return true; } return false; @@ -6599,6 +6761,10 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; + function isToken(n) { + return n.kind >= 0 /* FirstToken */ && n.kind <= 141 /* LastToken */; + } + ts.isToken = isToken; function getTokenPosOfNode(node, sourceFile, includeJsDoc) { // With nodes that have no width (i.e. 'Missing' nodes), we actually *don't* // want to skip trivia because this will launch us forward to the next token. @@ -6615,18 +6781,18 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 293 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; + return node.kind >= 266 /* FirstJSDocNode */ && node.kind <= 292 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */; + return node.kind >= 282 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6657,20 +6823,11 @@ var ts; return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; - function getLiteralText(node, sourceFile, languageVersion) { - // Any template literal or string literal with an extended escape - // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. - if (languageVersion < 2 /* ES2015 */ && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); - } + function getLiteralText(node, sourceFile) { // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. if (!nodeIsSynthesized(node) && node.parent) { - var text = getSourceTextOfNodeFromSourceFile(sourceFile, node); - if (languageVersion < 2 /* ES2015 */ && isBinaryOrOctalIntegerLiteral(node, text)) { - return node.text; - } - return text; + return getSourceTextOfNodeFromSourceFile(sourceFile, node); } // If we can't reach the original source text, use the canonical form if it's a number, // or an escaped quoted form of the original text if it's string-like. @@ -6691,19 +6848,6 @@ var ts; ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); } ts.getLiteralText = getLiteralText; - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98 /* b */: - case 66 /* B */: - case 111 /* o */: - case 79 /* O */: - return true; - } - } - return false; - } - ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; } @@ -6712,11 +6856,6 @@ var ts; return identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? "_" + identifier : identifier; } ts.escapeIdentifier = escapeIdentifier; - // Remove extra underscore from escaped identifier - function unescapeIdentifier(identifier) { - return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; - } - ts.unescapeIdentifier = unescapeIdentifier; // Make an identifier from an external module name by extracting the string after the last "/" and replacing // all non-alphanumeric characters with underscores function makeIdentifierFromModuleName(moduleName) { @@ -6730,26 +6869,26 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 /* VariableDeclaration */ && node.parent.kind === 256 /* CatchClause */; + return node.kind === 225 /* VariableDeclaration */ && node.parent.kind === 259 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 /* ModuleDeclaration */ && + return node && node.kind === 232 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; - /** Given a symbol for a module, checks that it is either an untyped import or a shorthand ambient module. */ + /** Given a symbol for a module, checks that it is a shorthand ambient module. */ function isShorthandAmbientModuleSymbol(moduleSymbol) { return isShorthandAmbientModule(moduleSymbol.valueDeclaration); } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node.kind === 230 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 232 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 /* SourceFile */ || - node.kind === 230 /* ModuleDeclaration */ || + return node.kind === 264 /* SourceFile */ || + node.kind === 232 /* ModuleDeclaration */ || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6765,32 +6904,36 @@ var ts; return false; } switch (node.parent.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: return ts.isExternalModule(node.parent); - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 256 /* CatchClause */: - case 230 /* ModuleDeclaration */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 264 /* SourceFile */: + case 234 /* CaseBlock */: + case 259 /* CatchClause */: + case 232 /* ModuleDeclaration */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return true; - case 204 /* Block */: + case 206 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !isFunctionLike(parentNode); @@ -6817,6 +6960,10 @@ var ts; return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); } ts.declarationNameToString = declarationNameToString; + function getNameFromIndexInfo(info) { + return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined; + } + ts.getNameFromIndexInfo = getNameFromIndexInfo; function getTextOfPropertyName(name) { switch (name.kind) { case 70 /* Identifier */: @@ -6824,7 +6971,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: if (isStringOrNumericLiteral(name.expression)) { return name.expression.text; } @@ -6835,10 +6982,10 @@ var ts; function entityNameToString(name) { switch (name.kind) { case 70 /* Identifier */: - return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); - case 141 /* QualifiedName */: + return getFullWidth(name) === 0 ? ts.unescapeIdentifier(name.text) : getTextOfNode(name); + case 142 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); } } @@ -6875,7 +7022,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204 /* Block */) { + if (node.body && node.body.kind === 206 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -6889,7 +7036,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -6898,23 +7045,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 228 /* TypeAliasDeclaration */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 263 /* EnumMember */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 230 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -6937,7 +7084,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 /* EnumDeclaration */ && isConst(node); + return node.kind === 231 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -6950,11 +7097,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 179 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; + return n.kind === 180 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 /* ExpressionStatement */ + return node.kind === 209 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -6967,10 +7114,10 @@ var ts; } ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 144 /* Parameter */ || - node.kind === 143 /* TypeParameter */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 185 /* ArrowFunction */) ? + var commentRanges = (node.kind === 145 /* Parameter */ || + node.kind === 144 /* TypeParameter */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 186 /* ArrowFunction */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); // True if the comment starts with '/**' but not if it is '/**/' @@ -6985,79 +7132,80 @@ var ts; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (156 /* FirstTypeNode */ <= node.kind && node.kind <= 171 /* LastTypeNode */) { + if (157 /* FirstTypeNode */ <= node.kind && node.kind <= 172 /* LastTypeNode */) { return true; } switch (node.kind) { case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: return true; case 104 /* VoidKeyword */: - return node.parent.kind !== 188 /* VoidExpression */; - case 199 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 189 /* VoidExpression */; + case 200 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 70 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 141 /* QualifiedName */: - case 177 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + // falls through + case 142 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: case 98 /* ThisKeyword */: - var parent_1 = node.parent; - if (parent_1.kind === 160 /* TypeQuery */) { + var parent = node.parent; + if (parent.kind === 161 /* TypeQuery */) { return false; } // Do not recursively call isPartOfTypeNode on the parent. In the example: // // let a: A.B.C; // - // Calling isPartOfTypeNode would consider the qualified name A.B a type node. Only C or - // A.B.C is a type node. - if (156 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 171 /* LastTypeNode */) { + // Calling isPartOfTypeNode would consider the qualified name A.B a type node. + // Only C and A.B.C are type nodes. + if (157 /* FirstTypeNode */ <= parent.kind && parent.kind <= 172 /* LastTypeNode */) { return true; } - switch (parent_1.kind) { - case 199 /* ExpressionWithTypeArguments */: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 143 /* TypeParameter */: - return node === parent_1.constraint; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 144 /* Parameter */: - case 223 /* VariableDeclaration */: - return node === parent_1.type; - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return node === parent_1.type; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - return node === parent_1.type; - case 182 /* TypeAssertionExpression */: - return node === parent_1.type; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 181 /* TaggedTemplateExpression */: + switch (parent.kind) { + case 200 /* ExpressionWithTypeArguments */: + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); + case 144 /* TypeParameter */: + return node === parent.constraint; + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + return node === parent.type; + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return node === parent.type; + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + return node === parent.type; + case 183 /* TypeAssertionExpression */: + return node === parent.type; + case 180 /* CallExpression */: + case 181 /* NewExpression */: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 182 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -7065,29 +7213,43 @@ var ts; return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 191 /* PrefixUnaryExpression */; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitor(node); - case 232 /* CaseBlock */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 254 /* DefaultClause */: - case 219 /* LabeledStatement */: - case 221 /* TryStatement */: - case 256 /* CatchClause */: + case 234 /* CaseBlock */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 256 /* CaseClause */: + case 257 /* DefaultClause */: + case 221 /* LabeledStatement */: + case 223 /* TryStatement */: + case 259 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -7097,29 +7259,30 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + return; + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. return; default: if (isFunctionLike(node)) { - var name_5 = node.name; - if (name_5 && name_5.kind === 142 /* ComputedPropertyName */) { + var name = node.name; + if (name && name.kind === 143 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. - traverse(name_5.expression); + traverse(name.expression); return; } } @@ -7132,17 +7295,35 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + function getRestParameterElementType(node) { + if (node && node.kind === 163 /* ArrayType */) { + return node.elementType; + } + else if (node && node.kind === 158 /* TypeReference */) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { - case 174 /* BindingElement */: - case 260 /* EnumMember */: - case 144 /* Parameter */: - case 257 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 258 /* ShorthandPropertyAssignment */: - case 223 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 263 /* EnumMember */: + case 145 /* Parameter */: + case 260 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 261 /* ShorthandPropertyAssignment */: + case 225 /* VariableDeclaration */: return true; } } @@ -7150,11 +7331,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */); + return node && (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); + return node && (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7163,19 +7344,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return true; } return false; @@ -7183,13 +7364,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return true; } return false; @@ -7197,30 +7378,42 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: return true; - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatementOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 221 /* LabeledStatement */) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 206 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 149 /* MethodDeclaration */ && node.parent.kind === 176 /* ObjectLiteralExpression */; + return node && node.kind === 150 /* MethodDeclaration */ && node.parent.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 149 /* MethodDeclaration */ && - (node.parent.kind === 176 /* ObjectLiteralExpression */ || - node.parent.kind === 197 /* ClassExpression */); + return node.kind === 150 /* MethodDeclaration */ && + (node.parent.kind === 177 /* ObjectLiteralExpression */ || + node.parent.kind === 198 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -7256,7 +7449,7 @@ var ts; return undefined; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -7271,9 +7464,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -7284,39 +7477,52 @@ var ts; node = node.parent; } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - // Fall through - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 230 /* ModuleDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 229 /* EnumDeclaration */: - case 261 /* SourceFile */: + // falls through + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 232 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 231 /* EnumDeclaration */: + case 264 /* SourceFile */: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, /*includeArrowFunctions*/ false); + if (container) { + switch (container.kind) { + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; /** - * Given an super call/property node, returns the closest node where - * - a super call/property access is legal in the node and not legal in the parent node the node. - * i.e. super call is legal in constructor but not legal in the class body. - * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher) - * - a super call/property is definitely illegal in the container (but might be legal in some subnode) - * i.e. super property access is illegal in function declaration but can be legal in the statement list - */ + * Given an super call/property node, returns the closest node where + * - a super call/property access is legal in the node and not legal in the parent node the node. + * i.e. super call is legal in constructor but not legal in the class body. + * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher) + * - a super call/property is definitely illegal in the container (but might be legal in some subnode) + * i.e. super property access is illegal in function declaration but can be legal in the statement list + */ function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; @@ -7324,26 +7530,27 @@ var ts; return node; } switch (node.kind) { - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: node = node.parent; break; - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + // falls through + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return node; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 145 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -7359,15 +7566,15 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */) { + if (func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183 /* ParenthesizedExpression */) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent = func.parent; + while (parent.kind === 184 /* ParenthesizedExpression */) { + prev = parent; + parent = parent.parent; } - if (parent_2.kind === 179 /* CallExpression */ && parent_2.expression === prev) { - return parent_2; + if (parent.kind === 180 /* CallExpression */ && parent.expression === prev) { + return parent; } } } @@ -7377,21 +7584,21 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 177 /* PropertyAccessExpression */ || kind === 178 /* ElementAccessExpression */) + return (kind === 178 /* PropertyAccessExpression */ || kind === 179 /* ElementAccessExpression */) && node.expression.kind === 96 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 276 /* JSDocTypeReference */: return node.typeName; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return node; } return undefined; @@ -7399,10 +7606,12 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function isCallLikeExpression(node) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 145 /* Decorator */: + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 146 /* Decorator */: return true; default: return false; @@ -7410,34 +7619,37 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { return node.tag; } + else if (isJsxOpeningLikeElement(node)) { + return node.tagName; + } // Will either be a CallExpression, NewExpression, or Decorator. return node.expression; } ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // classes are valid targets return true; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 226 /* ClassDeclaration */; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + return node.parent.kind === 228 /* ClassDeclaration */; + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && node.parent.kind === 226 /* ClassDeclaration */; - case 144 /* Parameter */: + && node.parent.kind === 228 /* ClassDeclaration */; + case 145 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return node.parent.body !== undefined - && (node.parent.kind === 150 /* Constructor */ - || node.parent.kind === 149 /* MethodDeclaration */ - || node.parent.kind === 152 /* SetAccessor */) - && node.parent.parent.kind === 226 /* ClassDeclaration */; + && (node.parent.kind === 151 /* Constructor */ + || node.parent.kind === 150 /* MethodDeclaration */ + || node.parent.kind === 153 /* SetAccessor */) + && node.parent.parent.kind === 228 /* ClassDeclaration */; } return false; } @@ -7453,19 +7665,19 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 149 /* MethodDeclaration */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 153 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } } ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 /* JsxOpeningElement */ || - parent.kind === 247 /* JsxSelfClosingElement */ || - parent.kind === 249 /* JsxClosingElement */) { + if (parent.kind === 250 /* JsxOpeningElement */ || + parent.kind === 249 /* JsxSelfClosingElement */ || + parent.kind === 251 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -7479,96 +7691,97 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 11 /* RegularExpressionLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 181 /* TaggedTemplateExpression */: - case 200 /* AsExpression */: - case 182 /* TypeAssertionExpression */: - case 201 /* NonNullExpression */: - case 183 /* ParenthesizedExpression */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 196 /* SpreadElement */: - case 194 /* TemplateExpression */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 182 /* TaggedTemplateExpression */: + case 201 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 202 /* NonNullExpression */: + case 184 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 197 /* SpreadElement */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: - case 198 /* OmittedExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: - case 195 /* YieldExpression */: - case 189 /* AwaitExpression */: + case 199 /* OmittedExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 196 /* YieldExpression */: + case 190 /* AwaitExpression */: + case 203 /* MetaProperty */: return true; - case 141 /* QualifiedName */: - while (node.parent.kind === 141 /* QualifiedName */) { + case 142 /* QualifiedName */: + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node); + return node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node); case 70 /* Identifier */: - if (node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node)) { + if (node.parent.kind === 161 /* TypeQuery */ || isJSXTagName(node)) { return true; } - // fall through + // falls through case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 98 /* ThisKeyword */: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 223 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: - case 174 /* BindingElement */: - return parent_3.initializer === node; - case 207 /* ExpressionStatement */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 216 /* ReturnStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 220 /* ThrowStatement */: - case 218 /* SwitchStatement */: - return parent_3.expression === node; - case 211 /* ForStatement */: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + var parent = node.parent; + switch (parent.kind) { + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 263 /* EnumMember */: + case 260 /* PropertyAssignment */: + case 175 /* BindingElement */: + return parent.initializer === node; + case 209 /* ExpressionStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 218 /* ReturnStatement */: + case 219 /* WithStatement */: + case 220 /* SwitchStatement */: + case 256 /* CaseClause */: + case 222 /* ThrowStatement */: + case 220 /* SwitchStatement */: + return parent.expression === node; + case 213 /* ForStatement */: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 226 /* VariableDeclarationList */) || forInStatement.expression === node; - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - return node === parent_3.expression; - case 202 /* TemplateSpan */: - return node === parent_3.expression; - case 142 /* ComputedPropertyName */: - return node === parent_3.expression; - case 145 /* Decorator */: - case 252 /* JsxExpression */: - case 251 /* JsxSpreadAttribute */: - case 259 /* SpreadAssignment */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + return node === parent.expression; + case 204 /* TemplateSpan */: + return node === parent.expression; + case 143 /* ComputedPropertyName */: + return node === parent.expression; + case 146 /* Decorator */: + case 255 /* JsxExpression */: + case 254 /* JsxSpreadAttribute */: + case 262 /* SpreadAssignment */: return true; - case 199 /* ExpressionWithTypeArguments */: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + case 200 /* ExpressionWithTypeArguments */: + return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent)) { return true; } } @@ -7583,7 +7796,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7592,7 +7805,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 245 /* ExternalModuleReference */; + return node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 247 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7600,21 +7813,27 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 2097152 /* JavaScriptFile */); + return node && !!(node.flags & 65536 /* JavaScriptFile */); } ts.isInJavaScriptFile = isInJavaScriptFile; /** * Returns true if the node is a CallExpression to the identifier 'require' with - * exactly one argument. + * exactly one argument (of the form 'require("name")'). * This function does not test if the node is in a JavaScript file or not. - */ - function isRequireCall(expression, checkArgumentIsStringLiteral) { - // of the form 'require("name")' - var isRequire = expression.kind === 179 /* CallExpression */ && - expression.expression.kind === 70 /* Identifier */ && - expression.expression.text === "require" && - expression.arguments.length === 1; - return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9 /* StringLiteral */); + */ + function isRequireCall(callExpression, checkArgumentIsStringLiteral) { + if (callExpression.kind !== 180 /* CallExpression */) { + return false; + } + var _a = callExpression, expression = _a.expression, args = _a.arguments; + if (expression.kind !== 70 /* Identifier */ || expression.text !== "require") { + return false; + } + if (args.length !== 1) { + return false; + } + var arg = args[0]; + return !checkArgumentIsStringLiteral || arg.kind === 9 /* StringLiteral */ || arg.kind === 12 /* NoSubstitutionTemplateLiteral */; } ts.isRequireCall = isRequireCall; function isSingleOrDoubleQuote(charCode) { @@ -7625,25 +7844,37 @@ var ts; * Returns true if the node is a variable declaration whose initializer is a function expression. * This function does not test if the node is in a JavaScript file or not. */ - function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223 /* VariableDeclaration */) { + function isDeclarationOfFunctionOrClassExpression(s) { + if (s.valueDeclaration && s.valueDeclaration.kind === 225 /* VariableDeclaration */) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */; + return declaration.initializer && (declaration.initializer.kind === 185 /* FunctionExpression */ || declaration.initializer.kind === 198 /* ClassExpression */); } return false; } - ts.isDeclarationOfFunctionExpression = isDeclarationOfFunctionExpression; + ts.isDeclarationOfFunctionOrClassExpression = isDeclarationOfFunctionOrClassExpression; + function getRightMostAssignedExpression(node) { + while (isAssignmentExpression(node, /*excludeCompoundAssignements*/ true)) { + node = node.right; + } + return node; + } + ts.getRightMostAssignedExpression = getRightMostAssignedExpression; + function isExportsIdentifier(node) { + return isIdentifier(node) && node.text === "exports"; + } + ts.isExportsIdentifier = isExportsIdentifier; + function isModuleExportsPropertyAccessExpression(node) { + return isPropertyAccessExpression(node) && isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports"; + } + ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression; /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property /// assignments we treat as special in the binder function getSpecialPropertyAssignmentKind(expression) { if (!isInJavaScriptFile(expression)) { return 0 /* None */; } - if (expression.kind !== 192 /* BinaryExpression */) { - return 0 /* None */; - } var expr = expression; - if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 177 /* PropertyAccessExpression */) { + if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 178 /* PropertyAccessExpression */) { return 0 /* None */; } var lhs = expr.left; @@ -7657,11 +7888,15 @@ var ts; // module.exports = expr return 2 /* ModuleExports */; } + else { + // F.x = expr + return 5 /* Property */; + } } else if (lhs.expression.kind === 98 /* ThisKeyword */) { return 4 /* ThisProperty */; } - else if (lhs.expression.kind === 177 /* PropertyAccessExpression */) { + else if (lhs.expression.kind === 178 /* PropertyAccessExpression */) { // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 70 /* Identifier */) { @@ -7679,35 +7914,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 245 /* ExternalModuleReference */) { + if (reference.kind === 247 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 241 /* ExportDeclaration */) { + if (node.kind === 243 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 230 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 232 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 239 /* NamespaceImport */) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 /* ImportDeclaration */ + return node.kind === 237 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } @@ -7715,13 +7950,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 144 /* Parameter */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 258 /* ShorthandPropertyAssignment */: - case 257 /* PropertyAssignment */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 261 /* ShorthandPropertyAssignment */: + case 260 /* PropertyAssignment */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -7729,28 +7964,36 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 /* JSDocFunctionType */ && + return node.kind === 278 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 276 /* JSDocConstructorType */; + node.parameters[0].type.kind === 280 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); } ts.getCommentsFromJSDoc = getCommentsFromJSDoc; + function hasJSDocParameterTags(node) { + var parameterTags = getJSDocTags(node, 285 /* JSDocParameterTag */); + return parameterTags && parameterTags.length > 0; + } + ts.hasJSDocParameterTags = hasJSDocParameterTags; function getJSDocTags(node, kind) { var docs = getJSDocs(node); if (docs) { var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281 /* JSDocParameterTag */) { + if (doc.kind === 285 /* JSDocParameterTag */) { if (doc.kind === kind) { result.push(doc); } } else { - result.push.apply(result, ts.filter(doc.tags, function (tag) { return tag.kind === kind; })); + var tags = doc.tags; + if (tags) { + result.push.apply(result, ts.filter(tags, function (tag) { return tag.kind === kind; })); + } } } return result; @@ -7776,9 +8019,9 @@ var ts; // var x = function(name) { return name.length; } var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205 /* VariableStatement */; + parent.parent.parent.kind === 207 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205 /* VariableStatement */; + parent.parent.kind === 207 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -7787,20 +8030,20 @@ var ts; } // Also recognize when the node is the RHS of an assignment expression var isSourceOfAssignmentExpressionStatement = parent && parent.parent && - parent.kind === 192 /* BinaryExpression */ && + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && - parent.parent.kind === 207 /* ExpressionStatement */; + parent.parent.kind === 209 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ && - parent && parent.kind === 230 /* ModuleDeclaration */; - var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */; + var isModuleDeclaration = node.kind === 232 /* ModuleDeclaration */ && + parent && parent.kind === 232 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 260 /* PropertyAssignment */; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } // Pull parameter comments from declaring function as well - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { cache = ts.concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -7809,23 +8052,24 @@ var ts; cache = ts.concatenate(cache, node.jsDoc); } } + ts.getJSDocs = getJSDocs; function getJSDocParameterTags(param) { if (!isParameter(param)) { return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281 /* JSDocParameterTag */); + var tags = getJSDocTags(func, 285 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 285 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { - var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); + var name_1 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 285 /* JSDocParameterTag */ && tag.parameterName.text === name_1; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7835,8 +8079,8 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */); - if (!tag && node.kind === 144 /* Parameter */) { + var tag = getFirstJSDocTag(node, 287 /* JSDocTypeTag */); + if (!tag && node.kind === 145 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { tag = ts.find(paramTags, function (tag) { return !!tag.typeExpression; }); @@ -7846,15 +8090,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 284 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 286 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 288 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -7866,9 +8110,9 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 2097152 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 275 /* JSDocVariadicType */ || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) { + if (node && (node.flags & 65536 /* JavaScriptFile */)) { + if (node.type && node.type.kind === 279 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 279 /* JSDocVariadicType */; })) { return true; } } @@ -7889,29 +8133,33 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 57 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 183 /* ParenthesizedExpression */: - case 175 /* ArrayLiteralExpression */: - case 196 /* SpreadElement */: + case 184 /* ParenthesizedExpression */: + case 176 /* ArrayLiteralExpression */: + case 197 /* SpreadElement */: node = parent; break; - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } - // Fall through - case 257 /* PropertyAssignment */: + node = parent.parent; + break; + case 260 /* PropertyAssignment */: + if (parent.name === node) { + return 0 /* None */; + } node = parent.parent; break; default: @@ -7923,11 +8171,24 @@ var ts; ts.getAssignmentTargetKind = getAssignmentTargetKind; // A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is - // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. + // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ a }] = xxx'. + // (Note that `p` is not a target in the above examples, only `a`.) function isAssignmentTarget(node) { return getAssignmentTargetKind(node) !== 0 /* None */; } ts.isAssignmentTarget = isAssignmentTarget; + // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped + function isDeleteTarget(node) { + if (node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { + return false; + } + node = node.parent; + while (node && node.kind === 184 /* ParenthesizedExpression */) { + node = node.parent; + } + return node && node.kind === 187 /* DeleteExpression */; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -7939,7 +8200,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 261 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 264 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -7953,7 +8214,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 /* ImportSpecifier */ || parent.kind === 243 /* ExportSpecifier */) { + if (parent.kind === 241 /* ImportSpecifier */ || parent.kind === 245 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -7966,7 +8227,7 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - node.parent.kind === 142 /* ComputedPropertyName */ && + node.parent.kind === 143 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -7974,31 +8235,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: - case 177 /* PropertyAccessExpression */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 263 /* EnumMember */: + case 260 /* PropertyAssignment */: + case 178 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 141 /* QualifiedName */) { + while (parent.kind === 142 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 160 /* TypeQuery */; + return parent.kind === 161 /* TypeQuery */; } return false; - case 174 /* BindingElement */: - case 239 /* ImportSpecifier */: + case 175 /* BindingElement */: + case 241 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 243 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -8014,13 +8275,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 233 /* NamespaceExportDeclaration */ || - node.kind === 236 /* ImportClause */ && !!node.name || - node.kind === 237 /* NamespaceImport */ || - node.kind === 239 /* ImportSpecifier */ || - node.kind === 243 /* ExportSpecifier */ || - node.kind === 240 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 235 /* NamespaceExportDeclaration */ || + node.kind === 238 /* ImportClause */ && !!node.name || + node.kind === 239 /* NamespaceImport */ || + node.kind === 241 /* ImportSpecifier */ || + node.kind === 245 /* ExportSpecifier */ || + node.kind === 242 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8106,17 +8367,62 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 71 /* FirstKeyword */ <= token && token <= 140 /* LastKeyword */; + return 71 /* FirstKeyword */ <= token && token <= 141 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */; } ts.isTrivia = isTrivia; - function isAsyncFunctionLike(node) { - return isFunctionLike(node) && hasModifier(node, 256 /* Async */) && !isAccessor(node); + var FunctionFlags; + (function (FunctionFlags) { + FunctionFlags[FunctionFlags["Normal"] = 0] = "Normal"; + FunctionFlags[FunctionFlags["Generator"] = 1] = "Generator"; + FunctionFlags[FunctionFlags["Async"] = 2] = "Async"; + FunctionFlags[FunctionFlags["AsyncOrAsyncGenerator"] = 3] = "AsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["Invalid"] = 4] = "Invalid"; + FunctionFlags[FunctionFlags["InvalidAsyncOrAsyncGenerator"] = 7] = "InvalidAsyncOrAsyncGenerator"; + FunctionFlags[FunctionFlags["InvalidGenerator"] = 5] = "InvalidGenerator"; + })(FunctionFlags = ts.FunctionFlags || (ts.FunctionFlags = {})); + function getFunctionFlags(node) { + var flags = 0 /* Normal */; + switch (node.kind) { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + if (node.asteriskToken) { + flags |= 1 /* Generator */; + } + // falls through + case 186 /* ArrowFunction */: + if (hasModifier(node, 256 /* Async */)) { + flags |= 2 /* Async */; + } + break; + } + if (!node.body) { + flags |= 4 /* Invalid */; + } + return flags; + } + ts.getFunctionFlags = getFunctionFlags; + function isAsyncFunction(node) { + switch (node.kind) { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + return node.body !== undefined + && node.asteriskToken === undefined + && hasModifier(node, 256 /* Async */); + } + return false; + } + ts.isAsyncFunction = isAsyncFunction; + function isNumericLiteral(node) { + return node.kind === 8 /* NumericLiteral */; } - ts.isAsyncFunctionLike = isAsyncFunctionLike; + ts.isNumericLiteral = isNumericLiteral; function isStringOrNumericLiteral(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ @@ -8135,7 +8441,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 142 /* ComputedPropertyName */ && + return name.kind === 143 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -8150,10 +8456,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 144 /* Parameter */) { + if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 145 /* Parameter */) { return name.text; } - if (name.kind === 142 /* ComputedPropertyName */) { + if (name.kind === 143 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -8201,11 +8507,11 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 144 /* Parameter */; + return root.kind === 145 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 174 /* BindingElement */) { + while (node.kind === 175 /* BindingElement */) { node = node.parent.parent; } return node; @@ -8213,15 +8519,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 184 /* FunctionExpression */ - || kind === 225 /* FunctionDeclaration */ - || kind === 185 /* ArrowFunction */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 230 /* ModuleDeclaration */ - || kind === 261 /* SourceFile */; + return kind === 151 /* Constructor */ + || kind === 185 /* FunctionExpression */ + || kind === 227 /* FunctionDeclaration */ + || kind === 186 /* ArrowFunction */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 232 /* ModuleDeclaration */ + || kind === 264 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8229,49 +8535,22 @@ var ts; || ts.positionIsSynthesized(node.end); } ts.nodeIsSynthesized = nodeIsSynthesized; - function getOriginalNode(node, nodeTest) { - if (node) { - while (node.original !== undefined) { - node = node.original; - } + function getOriginalSourceFileOrBundle(sourceFileOrBundle) { + if (sourceFileOrBundle.kind === 265 /* Bundle */) { + return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, getOriginalSourceFile)); } - return !nodeTest || nodeTest(node) ? node : undefined; + return getOriginalSourceFile(sourceFileOrBundle); } - ts.getOriginalNode = getOriginalNode; - /** - * Gets a value indicating whether a node originated in the parse tree. - * - * @param node The node to test. - */ - function isParseTreeNode(node) { - return (node.flags & 8 /* Synthesized */) === 0; + ts.getOriginalSourceFileOrBundle = getOriginalSourceFileOrBundle; + function getOriginalSourceFile(sourceFile) { + return ts.getParseTreeNode(sourceFile, isSourceFile) || sourceFile; } - ts.isParseTreeNode = isParseTreeNode; - function getParseTreeNode(node, nodeTest) { - if (isParseTreeNode(node)) { - return node; - } - node = getOriginalNode(node); - if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { - return node; - } - return undefined; - } - ts.getParseTreeNode = getParseTreeNode; function getOriginalSourceFiles(sourceFiles) { - var originalSourceFiles = []; - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; - var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile); - if (originalSourceFile) { - originalSourceFiles.push(originalSourceFile); - } - } - return originalSourceFiles; + return ts.sameMap(sourceFiles, getOriginalSourceFile); } ts.getOriginalSourceFiles = getOriginalSourceFiles; function getOriginalNodeId(node) { - node = getOriginalNode(node); + node = ts.getOriginalNode(node); return node ? ts.getNodeId(node) : 0; } ts.getOriginalNodeId = getOriginalNodeId; @@ -8282,23 +8561,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: - case 193 /* ConditionalExpression */: - case 195 /* YieldExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: + case 194 /* ConditionalExpression */: + case 196 /* YieldExpression */: return 1 /* Right */; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operator) { case 39 /* AsteriskAsteriskToken */: case 57 /* EqualsToken */: @@ -8322,15 +8601,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 181 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 192 /* BinaryExpression */) { + if (expression.kind === 193 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 190 /* PrefixUnaryExpression */ || expression.kind === 191 /* PostfixUnaryExpression */) { + else if (expression.kind === 191 /* PrefixUnaryExpression */ || expression.kind === 192 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -8348,37 +8627,36 @@ var ts; case 85 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: case 11 /* RegularExpressionLiteral */: case 12 /* NoSubstitutionTemplateLiteral */: - case 194 /* TemplateExpression */: - case 183 /* ParenthesizedExpression */: - case 198 /* OmittedExpression */: - case 297 /* RawExpression */: + case 195 /* TemplateExpression */: + case 184 /* ParenthesizedExpression */: + case 199 /* OmittedExpression */: return 19; - case 181 /* TaggedTemplateExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 182 /* TaggedTemplateExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: return 18; - case 180 /* NewExpression */: + case 181 /* NewExpression */: return hasArguments ? 18 : 17; - case 179 /* CallExpression */: + case 180 /* CallExpression */: return 17; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return 16; - case 190 /* PrefixUnaryExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 186 /* DeleteExpression */: - case 189 /* AwaitExpression */: + case 191 /* PrefixUnaryExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 187 /* DeleteExpression */: + case 190 /* AwaitExpression */: return 15; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (operatorKind) { case 50 /* ExclamationToken */: case 51 /* TildeToken */: @@ -8436,11 +8714,11 @@ var ts; default: return -1; } - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return 4; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return 2; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return 1; default: return -1; @@ -8463,21 +8741,15 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { - var diagnostic = _a[_i]; - diagnostic.file = newFile; - } + ts.forEach(fileDiagnostics.get(newFile.fileName), function (diagnostic) { return diagnostic.file = newFile; }); } function add(diagnostic) { var diagnostics; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -8494,16 +8766,16 @@ var ts; function getDiagnostics(fileName) { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } var allDiagnostics = []; function pushDiagnostic(d) { allDiagnostics.push(d); } ts.forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { - ts.forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(function (diagnostics) { + ts.forEach(diagnostics, pushDiagnostic); + }); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } function sortAndDeduplicate() { @@ -8512,9 +8784,9 @@ var ts; } diagnosticsModified = false; nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { - fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach(function (diagnostics, key) { + fileDiagnostics.set(key, ts.sortAndDeduplicateDiagnostics(diagnostics)); + }); } } ts.createDiagnosticCollection = createDiagnosticCollection; @@ -8524,7 +8796,7 @@ var ts; // the map below must be updated. Note that this regexp *does not* include the 'delete' character. // There is no reason for this other than that JSON.stringify does not handle it either. var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap = ts.createMap({ + var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -8544,13 +8816,12 @@ var ts; * Note that this doesn't actually wrap the input in double quotes. */ function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -8707,168 +8978,77 @@ var ts; */ function getSourceFilesToEmit(host, targetSourceFile) { var options = host.getCompilerOptions(); + var isSourceFileFromExternalLibrary = function (file) { return host.isSourceFileFromExternalLibrary(file); }; if (options.outFile || options.out) { var moduleKind = ts.getEmitModuleKind(options); - var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; - var sourceFiles = getAllEmittableSourceFiles(); + var moduleEmitEnabled_1 = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified - return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + return ts.filter(host.getSourceFiles(), function (sourceFile) { + return (moduleEmitEnabled_1 || !ts.isExternalModule(sourceFile)) && sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); + }); } else { - var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; - return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); - } - function getAllEmittableSourceFiles() { - return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; + return ts.filter(sourceFiles, function (sourceFile) { return sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary); }); } } ts.getSourceFilesToEmit = getSourceFilesToEmit; - /** Don't call this for `--outFile`, just for `--outDir` or plain emit. */ - function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { - return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); - } - ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; - function isNonDeclarationFile(sourceFile) { - return !isDeclarationFile(sourceFile); - } - /** - * Whether a file should be emitted in a non-`--outFile` case. - * Don't emit if source file is a declaration file, or was located under node_modules - */ - function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { - return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); - } - function isBundleEmitNonExternalModule(sourceFile) { - return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); + /** Don't call this for `--outFile`, just for `--outDir` or plain emit. `--outFile` needs additional checks. */ + function sourceFileMayBeEmitted(sourceFile, options, isSourceFileFromExternalLibrary) { + return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !isDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); } + ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; /** - * Iterates over each source file to emit. The source files are expected to have been - * transformed for use by the pretty printer. - * - * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support - * transformations. + * Iterates over the source files that are expected to have an emit output. * * @param host An EmitHost. - * @param sourceFiles The transformed source files to emit. * @param action The action to execute. + * @param sourceFilesOrTargetSourceFile + * If an array, the full list of source files to emit. + * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. */ - function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); var options = host.getCompilerOptions(); - // Emit on each source file if (options.outFile || options.out) { - onBundledEmit(sourceFiles); - } - else { - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; - // Don't emit if source file is a declaration file, or was located under node_modules - if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { - onSingleFileEmit(host, sourceFile); - } - } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], /*isBundledEmit*/ false); - } - function onBundledEmit(sourceFiles) { if (sourceFiles.length) { var jsFilePath = options.outFile || options.out; var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, /*isBundledEmit*/ true); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : ""; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, ts.createBundle(sourceFiles), emitOnlyDtsFiles); + } + } + else { + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFile, emitOnlyDtsFiles); } } } - ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + ts.forEachEmittedFile = forEachEmittedFile; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - /** - * Iterates over the source files that are expected to have an emit output. This function - * is used by the legacy emitter and the declaration emitter and should not be used by - * the tree transforming emitter. - * - * @param host An EmitHost. - * @param action The action to execute. - * @param targetSourceFile An optional target source file to emit. - */ - function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { - var options = host.getCompilerOptions(); - // Emit on each source file - if (options.outFile || options.out) { - onBundledEmit(host); - } - else { - var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; - if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { - onSingleFileEmit(host, sourceFile); + // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. + // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. + // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1 /* Preserve */) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; } } - } - function onSingleFileEmit(host, sourceFile) { - // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. - // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. - // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve - var extension = ".js"; - if (options.jsx === 1 /* Preserve */) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - extension = ".jsx"; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - // TypeScript source file preserving JSX syntax - extension = ".jsx"; - } - } - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: declarationFilePath - }; - action(emitFileNames, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles); - } - function onBundledEmit(host) { - // Can emit only sources that are not declaration file and are either non module code or module with - // --module or --target es6 specified. Files included by searching under node_modules are also not emitted. - var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && - !host.isSourceFileFromExternalLibrary(sourceFile) && - (!ts.isExternalModule(sourceFile) || - !!ts.getEmitModuleKind(options)); }); - if (bundledSources.length) { - var jsFilePath = options.outFile || options.out; - var emitFileNames = { - jsFilePath: jsFilePath, - sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined - }; - action(emitFileNames, bundledSources, /*isBundledEmit*/ true, emitOnlyDtsFiles); + else if (sourceFile.languageVariant === 1 /* JSX */) { + // TypeScript source file preserving JSX syntax + return ".jsx"; } } + return ".js"; } - ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -8893,7 +9073,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 150 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -8935,10 +9115,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 152 /* SetAccessor */) { + else if (accessor.kind === 153 /* SetAccessor */) { setAccessor = accessor; } else { @@ -8947,7 +9127,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 151 /* GetAccessor */ || member.kind === 152 /* SetAccessor */) + if ((member.kind === 152 /* GetAccessor */ || member.kind === 153 /* SetAccessor */) && hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -8958,10 +9138,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 151 /* GetAccessor */ && !getAccessor) { + if (member.kind === 152 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 152 /* SetAccessor */ && !setAccessor) { + if (member.kind === 153 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -9224,7 +9404,7 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ function tryGetClassExtendingExpressionWithTypeArguments(node) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ && + if (node.kind === 200 /* ExpressionWithTypeArguments */ && node.parent.token === 84 /* ExtendsKeyword */ && isClassLike(node.parent.parent)) { return node.parent.parent; @@ -9242,8 +9422,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 176 /* ObjectLiteralExpression */ - || kind === 175 /* ArrayLiteralExpression */; + return kind === 177 /* ObjectLiteralExpression */ + || kind === 176 /* ArrayLiteralExpression */; } return false; } @@ -9269,31 +9449,42 @@ var ts; return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; + function isExpressionWithTypeArgumentsInClassImplementsClause(node) { + return node.kind === 200 /* ExpressionWithTypeArguments */ + && isEntityNameExpression(node.expression) + && node.parent + && node.parent.token === 107 /* ImplementsKeyword */ + && node.parent.parent + && isClassLike(node.parent.parent); + } + ts.isExpressionWithTypeArgumentsInClassImplementsClause = isExpressionWithTypeArgumentsInClassImplementsClause; function isEntityNameExpression(node) { return node.kind === 70 /* Identifier */ || - node.kind === 177 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); + node.kind === 178 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; - function isEmptyObjectLiteralOrArrayLiteral(expression) { - var kind = expression.kind; - if (kind === 176 /* ObjectLiteralExpression */) { - return expression.properties.length === 0; - } - if (kind === 175 /* ArrayLiteralExpression */) { - return expression.elements.length === 0; - } - return false; + function isEmptyObjectLiteral(expression) { + return expression.kind === 177 /* ObjectLiteralExpression */ && + expression.properties.length === 0; } - ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; + ts.isEmptyObjectLiteral = isEmptyObjectLiteral; + function isEmptyArrayLiteral(expression) { + return expression.kind === 176 /* ArrayLiteralExpression */ && + expression.elements.length === 0; + } + ts.isEmptyArrayLiteral = isEmptyArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; + return isExportDefaultSymbol(symbol) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function isExportDefaultSymbol(symbol) { + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */); + } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); @@ -9333,47 +9524,6 @@ var ts; } return output; } - /** - * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph - * as the fallback implementation does not check for circular references by default. - */ - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - /** - * Serialize an object graph into a JSON string. - */ - function stringifyFallback(value) { - // JSON.stringify returns `undefined` here, instead of the string "undefined". - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** * Converts a string to a base-64 encoded ASCII string. @@ -9446,39 +9596,39 @@ var ts; || kind === 94 /* NullKeyword */) { return true; } - else if (kind === 177 /* PropertyAccessExpression */) { + else if (kind === 178 /* PropertyAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 178 /* ElementAccessExpression */) { + else if (kind === 179 /* ElementAccessExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1) && isSimpleExpressionWorker(node.argumentExpression, depth + 1); } - else if (kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */) { + else if (kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */) { return isSimpleExpressionWorker(node.operand, depth + 1); } - else if (kind === 192 /* BinaryExpression */) { + else if (kind === 193 /* BinaryExpression */) { return node.operatorToken.kind !== 39 /* AsteriskAsteriskToken */ && isSimpleExpressionWorker(node.left, depth + 1) && isSimpleExpressionWorker(node.right, depth + 1); } - else if (kind === 193 /* ConditionalExpression */) { + else if (kind === 194 /* ConditionalExpression */) { return isSimpleExpressionWorker(node.condition, depth + 1) && isSimpleExpressionWorker(node.whenTrue, depth + 1) && isSimpleExpressionWorker(node.whenFalse, depth + 1); } - else if (kind === 188 /* VoidExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 186 /* DeleteExpression */) { + else if (kind === 189 /* VoidExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 187 /* DeleteExpression */) { return isSimpleExpressionWorker(node.expression, depth + 1); } - else if (kind === 175 /* ArrayLiteralExpression */) { + else if (kind === 176 /* ArrayLiteralExpression */) { return node.elements.length === 0; } - else if (kind === 176 /* ObjectLiteralExpression */) { + else if (kind === 177 /* ObjectLiteralExpression */) { return node.properties.length === 0; } - else if (kind === 179 /* CallExpression */) { + else if (kind === 180 /* CallExpression */) { if (!isSimpleExpressionWorker(node.expression, depth + 1)) { return false; } @@ -9493,16 +9643,19 @@ var ts; } return false; } - var syntaxKindCache = ts.createMap(); + var syntaxKindCache = []; function formatSyntaxKind(kind) { var syntaxKindEnum = ts.SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + var cached = syntaxKindCache[kind]; + if (cached !== undefined) { + return cached; } - for (var name_7 in syntaxKindEnum) { - if (syntaxKindEnum[name_7] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_7 + ")"; + for (var name in syntaxKindEnum) { + if (syntaxKindEnum[name] === kind) { + var result = kind + " (" + name + ")"; + syntaxKindCache[kind] = result; + return result; } } } @@ -9511,6 +9664,14 @@ var ts; } } ts.formatSyntaxKind = formatSyntaxKind; + function getRangePos(range) { + return range ? range.pos : -1; + } + ts.getRangePos = getRangePos; + function getRangeEnd(range) { + return range ? range.end : -1; + } + ts.getRangeEnd = getRangeEnd; /** * Increases (or decreases) a position by the provided amount. * @@ -9642,11 +9803,11 @@ var ts; * declaration. */ function isDeclarationNameOfEnumOrNamespace(node) { - var parseNode = getParseTreeNode(node); + var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -9667,7 +9828,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ && declaration !== node) { + if (declaration.kind === 228 /* ClassDeclaration */ && declaration !== node) { return true; } } @@ -9732,6 +9893,10 @@ var ts; return node.kind === 70 /* Identifier */; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 189 /* VoidExpression */; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { // Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`. return isIdentifier(node) && node.autoGenerateKind > 0 /* None */; @@ -9744,16 +9909,16 @@ var ts; ts.isModifier = isModifier; // Names function isQualifiedName(node) { - return node.kind === 141 /* QualifiedName */; + return node.kind === 142 /* QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 142 /* ComputedPropertyName */; + return node.kind === 143 /* ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; function isEntityName(node) { var kind = node.kind; - return kind === 141 /* QualifiedName */ + return kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isEntityName = isEntityName; @@ -9762,7 +9927,7 @@ var ts; return kind === 70 /* Identifier */ || kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ - || kind === 142 /* ComputedPropertyName */; + || kind === 143 /* ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isModuleName(node) { @@ -9774,61 +9939,65 @@ var ts; function isBindingName(node) { var kind = node.kind; return kind === 70 /* Identifier */ - || kind === 172 /* ObjectBindingPattern */ - || kind === 173 /* ArrayBindingPattern */; + || kind === 173 /* ObjectBindingPattern */ + || kind === 174 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Signature elements function isTypeParameter(node) { - return node.kind === 143 /* TypeParameter */; + return node.kind === 144 /* TypeParameter */; } ts.isTypeParameter = isTypeParameter; function isParameter(node) { - return node.kind === 144 /* Parameter */; + return node.kind === 145 /* Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; } ts.isDecorator = isDecorator; // Type members function isMethodDeclaration(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassElement(node) { var kind = node.kind; - return kind === 150 /* Constructor */ - || kind === 147 /* PropertyDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 155 /* IndexSignature */ - || kind === 203 /* SemicolonClassElement */; + return kind === 151 /* Constructor */ + || kind === 148 /* PropertyDeclaration */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 156 /* IndexSignature */ + || kind === 205 /* SemicolonClassElement */; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 /* PropertyAssignment */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 259 /* SpreadAssignment */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 244 /* MissingDeclaration */; + return kind === 260 /* PropertyAssignment */ + || kind === 261 /* ShorthandPropertyAssignment */ + || kind === 262 /* SpreadAssignment */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 246 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type function isTypeNodeKind(kind) { - return (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) + return (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) || kind === 118 /* AnyKeyword */ || kind === 132 /* NumberKeyword */ + || kind === 133 /* ObjectKeyword */ || kind === 121 /* BooleanKeyword */ - || kind === 134 /* StringKeyword */ - || kind === 135 /* SymbolKeyword */ + || kind === 135 /* StringKeyword */ + || kind === 136 /* SymbolKeyword */ + || kind === 98 /* ThisKeyword */ || kind === 104 /* VoidKeyword */ + || kind === 138 /* UndefinedKeyword */ + || kind === 94 /* NullKeyword */ || kind === 129 /* NeverKeyword */ - || kind === 199 /* ExpressionWithTypeArguments */; + || kind === 200 /* ExpressionWithTypeArguments */; } /** * Node test that determines whether a node is a valid type node. @@ -9841,36 +10010,36 @@ var ts; ts.isTypeNode = isTypeNode; // Binding patterns function isArrayBindingPattern(node) { - return node.kind === 173 /* ArrayBindingPattern */; + return node.kind === 174 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isObjectBindingPattern(node) { - return node.kind === 172 /* ObjectBindingPattern */; + return node.kind === 173 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 173 /* ArrayBindingPattern */ - || kind === 172 /* ObjectBindingPattern */; + return kind === 174 /* ArrayBindingPattern */ + || kind === 173 /* ObjectBindingPattern */; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 175 /* ArrayLiteralExpression */ - || kind === 176 /* ObjectLiteralExpression */; + return kind === 176 /* ArrayLiteralExpression */ + || kind === 177 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; function isBindingElement(node) { - return node.kind === 174 /* BindingElement */; + return node.kind === 175 /* BindingElement */; } ts.isBindingElement = isBindingElement; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 174 /* BindingElement */ - || kind === 198 /* OmittedExpression */; + return kind === 175 /* BindingElement */ + || kind === 199 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -9878,9 +10047,9 @@ var ts; */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223 /* VariableDeclaration */: - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 175 /* BindingElement */: return true; } return false; @@ -9899,8 +10068,8 @@ var ts; */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return true; } return false; @@ -9911,8 +10080,8 @@ var ts; */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return true; } return false; @@ -9920,86 +10089,92 @@ var ts; ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; // Expression function isArrayLiteralExpression(node) { - return node.kind === 175 /* ArrayLiteralExpression */; + return node.kind === 176 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 176 /* ObjectLiteralExpression */; + return node.kind === 177 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 177 /* PropertyAccessExpression */; + return node.kind === 178 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isPropertyAccessOrQualifiedName(node) { + var kind = node.kind; + return kind === 178 /* PropertyAccessExpression */ + || kind === 142 /* QualifiedName */; + } + ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isElementAccessExpression(node) { - return node.kind === 178 /* ElementAccessExpression */; + return node.kind === 179 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isBinaryExpression(node) { - return node.kind === 192 /* BinaryExpression */; + return node.kind === 193 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 193 /* ConditionalExpression */; + return node.kind === 194 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isCallExpression(node) { - return node.kind === 179 /* CallExpression */; + return node.kind === 180 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 194 /* TemplateExpression */ + return kind === 195 /* TemplateExpression */ || kind === 12 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; function isSpreadExpression(node) { - return node.kind === 196 /* SpreadElement */; + return node.kind === 197 /* SpreadElement */; } ts.isSpreadExpression = isSpreadExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 199 /* ExpressionWithTypeArguments */; + return node.kind === 200 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isLeftHandSideExpressionKind(kind) { - return kind === 177 /* PropertyAccessExpression */ - || kind === 178 /* ElementAccessExpression */ - || kind === 180 /* NewExpression */ - || kind === 179 /* CallExpression */ - || kind === 246 /* JsxElement */ - || kind === 247 /* JsxSelfClosingElement */ - || kind === 181 /* TaggedTemplateExpression */ - || kind === 175 /* ArrayLiteralExpression */ - || kind === 183 /* ParenthesizedExpression */ - || kind === 176 /* ObjectLiteralExpression */ - || kind === 197 /* ClassExpression */ - || kind === 184 /* FunctionExpression */ + return kind === 178 /* PropertyAccessExpression */ + || kind === 179 /* ElementAccessExpression */ + || kind === 181 /* NewExpression */ + || kind === 180 /* CallExpression */ + || kind === 248 /* JsxElement */ + || kind === 249 /* JsxSelfClosingElement */ + || kind === 182 /* TaggedTemplateExpression */ + || kind === 176 /* ArrayLiteralExpression */ + || kind === 184 /* ParenthesizedExpression */ + || kind === 177 /* ObjectLiteralExpression */ + || kind === 198 /* ClassExpression */ + || kind === 185 /* FunctionExpression */ || kind === 70 /* Identifier */ || kind === 11 /* RegularExpressionLiteral */ || kind === 8 /* NumericLiteral */ || kind === 9 /* StringLiteral */ || kind === 12 /* NoSubstitutionTemplateLiteral */ - || kind === 194 /* TemplateExpression */ + || kind === 195 /* TemplateExpression */ || kind === 85 /* FalseKeyword */ || kind === 94 /* NullKeyword */ || kind === 98 /* ThisKeyword */ || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ - || kind === 201 /* NonNullExpression */ - || kind === 297 /* RawExpression */; + || kind === 202 /* NonNullExpression */ + || kind === 203 /* MetaProperty */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isUnaryExpressionKind(kind) { - return kind === 190 /* PrefixUnaryExpression */ - || kind === 191 /* PostfixUnaryExpression */ - || kind === 186 /* DeleteExpression */ - || kind === 187 /* TypeOfExpression */ - || kind === 188 /* VoidExpression */ - || kind === 189 /* AwaitExpression */ - || kind === 182 /* TypeAssertionExpression */ + return kind === 191 /* PrefixUnaryExpression */ + || kind === 192 /* PostfixUnaryExpression */ + || kind === 187 /* DeleteExpression */ + || kind === 188 /* TypeOfExpression */ + || kind === 189 /* VoidExpression */ + || kind === 190 /* AwaitExpression */ + || kind === 183 /* TypeAssertionExpression */ || isLeftHandSideExpressionKind(kind); } function isUnaryExpression(node) { @@ -10007,14 +10182,13 @@ var ts; } ts.isUnaryExpression = isUnaryExpression; function isExpressionKind(kind) { - return kind === 193 /* ConditionalExpression */ - || kind === 195 /* YieldExpression */ - || kind === 185 /* ArrowFunction */ - || kind === 192 /* BinaryExpression */ - || kind === 196 /* SpreadElement */ - || kind === 200 /* AsExpression */ - || kind === 198 /* OmittedExpression */ - || kind === 297 /* RawExpression */ + return kind === 194 /* ConditionalExpression */ + || kind === 196 /* YieldExpression */ + || kind === 186 /* ArrowFunction */ + || kind === 193 /* BinaryExpression */ + || kind === 197 /* SpreadElement */ + || kind === 201 /* AsExpression */ + || kind === 199 /* OmittedExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10023,16 +10197,16 @@ var ts; ts.isExpression = isExpression; function isAssertionExpression(node) { var kind = node.kind; - return kind === 182 /* TypeAssertionExpression */ - || kind === 200 /* AsExpression */; + return kind === 183 /* TypeAssertionExpression */ + || kind === 201 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294 /* PartiallyEmittedExpression */; + return node.kind === 295 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293 /* NotEmittedStatement */; + return node.kind === 294 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10041,17 +10215,17 @@ var ts; } ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isOmittedExpression(node) { - return node.kind === 198 /* OmittedExpression */; + return node.kind === 199 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; // Misc function isTemplateSpan(node) { - return node.kind === 202 /* TemplateSpan */; + return node.kind === 204 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; // Element function isBlock(node) { - return node.kind === 204 /* Block */; + return node.kind === 206 /* Block */; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10069,121 +10243,135 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223 /* VariableDeclaration */; + return node.kind === 225 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224 /* VariableDeclarationList */; + return node.kind === 226 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232 /* CaseBlock */; + return node.kind === 234 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 /* ModuleBlock */ - || kind === 230 /* ModuleDeclaration */; + return kind === 233 /* ModuleBlock */ + || kind === 232 /* ModuleDeclaration */ + || kind === 70 /* Identifier */; } ts.isModuleBody = isModuleBody; + function isNamespaceBody(node) { + var kind = node.kind; + return kind === 233 /* ModuleBlock */ + || kind === 232 /* ModuleDeclaration */; + } + ts.isNamespaceBody = isNamespaceBody; + function isJSDocNamespaceBody(node) { + var kind = node.kind; + return kind === 70 /* Identifier */ + || kind === 232 /* ModuleDeclaration */; + } + ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */; + return node.kind === 236 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236 /* ImportClause */; + return node.kind === 238 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 /* NamedImports */ - || kind === 237 /* NamespaceImport */; + return kind === 240 /* NamedImports */ + || kind === 239 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239 /* ImportSpecifier */; + return node.kind === 241 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242 /* NamedExports */; + return node.kind === 244 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243 /* ExportSpecifier */; + return node.kind === 245 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 /* ModuleDeclaration */ || node.kind === 229 /* EnumDeclaration */; + return node.kind === 232 /* ModuleDeclaration */ || node.kind === 231 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 185 /* ArrowFunction */ - || kind === 174 /* BindingElement */ - || kind === 226 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 150 /* Constructor */ - || kind === 229 /* EnumDeclaration */ - || kind === 260 /* EnumMember */ - || kind === 243 /* ExportSpecifier */ - || kind === 225 /* FunctionDeclaration */ - || kind === 184 /* FunctionExpression */ - || kind === 151 /* GetAccessor */ - || kind === 236 /* ImportClause */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 239 /* ImportSpecifier */ - || kind === 227 /* InterfaceDeclaration */ - || kind === 149 /* MethodDeclaration */ - || kind === 148 /* MethodSignature */ - || kind === 230 /* ModuleDeclaration */ - || kind === 233 /* NamespaceExportDeclaration */ - || kind === 237 /* NamespaceImport */ - || kind === 144 /* Parameter */ - || kind === 257 /* PropertyAssignment */ - || kind === 147 /* PropertyDeclaration */ - || kind === 146 /* PropertySignature */ - || kind === 152 /* SetAccessor */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 228 /* TypeAliasDeclaration */ - || kind === 143 /* TypeParameter */ - || kind === 223 /* VariableDeclaration */ - || kind === 285 /* JSDocTypedefTag */; + return kind === 186 /* ArrowFunction */ + || kind === 175 /* BindingElement */ + || kind === 228 /* ClassDeclaration */ + || kind === 198 /* ClassExpression */ + || kind === 151 /* Constructor */ + || kind === 231 /* EnumDeclaration */ + || kind === 263 /* EnumMember */ + || kind === 245 /* ExportSpecifier */ + || kind === 227 /* FunctionDeclaration */ + || kind === 185 /* FunctionExpression */ + || kind === 152 /* GetAccessor */ + || kind === 238 /* ImportClause */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 241 /* ImportSpecifier */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 252 /* JsxAttribute */ + || kind === 150 /* MethodDeclaration */ + || kind === 149 /* MethodSignature */ + || kind === 232 /* ModuleDeclaration */ + || kind === 235 /* NamespaceExportDeclaration */ + || kind === 239 /* NamespaceImport */ + || kind === 145 /* Parameter */ + || kind === 260 /* PropertyAssignment */ + || kind === 148 /* PropertyDeclaration */ + || kind === 147 /* PropertySignature */ + || kind === 153 /* SetAccessor */ + || kind === 261 /* ShorthandPropertyAssignment */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 144 /* TypeParameter */ + || kind === 225 /* VariableDeclaration */ + || kind === 289 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 225 /* FunctionDeclaration */ - || kind === 244 /* MissingDeclaration */ - || kind === 226 /* ClassDeclaration */ - || kind === 227 /* InterfaceDeclaration */ - || kind === 228 /* TypeAliasDeclaration */ - || kind === 229 /* EnumDeclaration */ - || kind === 230 /* ModuleDeclaration */ - || kind === 235 /* ImportDeclaration */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 241 /* ExportDeclaration */ - || kind === 240 /* ExportAssignment */ - || kind === 233 /* NamespaceExportDeclaration */; + return kind === 227 /* FunctionDeclaration */ + || kind === 246 /* MissingDeclaration */ + || kind === 228 /* ClassDeclaration */ + || kind === 229 /* InterfaceDeclaration */ + || kind === 230 /* TypeAliasDeclaration */ + || kind === 231 /* EnumDeclaration */ + || kind === 232 /* ModuleDeclaration */ + || kind === 237 /* ImportDeclaration */ + || kind === 236 /* ImportEqualsDeclaration */ + || kind === 243 /* ExportDeclaration */ + || kind === 242 /* ExportAssignment */ + || kind === 235 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 /* BreakStatement */ - || kind === 214 /* ContinueStatement */ - || kind === 222 /* DebuggerStatement */ - || kind === 209 /* DoStatement */ - || kind === 207 /* ExpressionStatement */ - || kind === 206 /* EmptyStatement */ - || kind === 212 /* ForInStatement */ - || kind === 213 /* ForOfStatement */ - || kind === 211 /* ForStatement */ - || kind === 208 /* IfStatement */ - || kind === 219 /* LabeledStatement */ - || kind === 216 /* ReturnStatement */ - || kind === 218 /* SwitchStatement */ - || kind === 220 /* ThrowStatement */ - || kind === 221 /* TryStatement */ - || kind === 205 /* VariableStatement */ - || kind === 210 /* WhileStatement */ - || kind === 217 /* WithStatement */ - || kind === 293 /* NotEmittedStatement */ - || kind === 296 /* EndOfDeclarationMarker */ - || kind === 295 /* MergeDeclarationMarker */; + return kind === 217 /* BreakStatement */ + || kind === 216 /* ContinueStatement */ + || kind === 224 /* DebuggerStatement */ + || kind === 211 /* DoStatement */ + || kind === 209 /* ExpressionStatement */ + || kind === 208 /* EmptyStatement */ + || kind === 214 /* ForInStatement */ + || kind === 215 /* ForOfStatement */ + || kind === 213 /* ForStatement */ + || kind === 210 /* IfStatement */ + || kind === 221 /* LabeledStatement */ + || kind === 218 /* ReturnStatement */ + || kind === 220 /* SwitchStatement */ + || kind === 222 /* ThrowStatement */ + || kind === 223 /* TryStatement */ + || kind === 207 /* VariableStatement */ + || kind === 212 /* WhileStatement */ + || kind === 219 /* WithStatement */ + || kind === 294 /* NotEmittedStatement */ + || kind === 297 /* EndOfDeclarationMarker */ + || kind === 296 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10204,93 +10392,104 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204 /* Block */; + || kind === 206 /* Block */; } ts.isStatement = isStatement; // Module references function isModuleReference(node) { var kind = node.kind; - return kind === 245 /* ExternalModuleReference */ - || kind === 141 /* QualifiedName */ + return kind === 247 /* ExternalModuleReference */ + || kind === 142 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isModuleReference = isModuleReference; // JSX function isJsxOpeningElement(node) { - return node.kind === 248 /* JsxOpeningElement */; + return node.kind === 250 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249 /* JsxClosingElement */; + return node.kind === 251 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { var kind = node.kind; return kind === 98 /* ThisKeyword */ || kind === 70 /* Identifier */ - || kind === 177 /* PropertyAccessExpression */; + || kind === 178 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 /* JsxElement */ - || kind === 252 /* JsxExpression */ - || kind === 247 /* JsxSelfClosingElement */ + return kind === 248 /* JsxElement */ + || kind === 255 /* JsxExpression */ + || kind === 249 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */; } ts.isJsxChild = isJsxChild; + function isJsxAttributes(node) { + var kind = node.kind; + return kind === 253 /* JsxAttributes */; + } + ts.isJsxAttributes = isJsxAttributes; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 /* JsxAttribute */ - || kind === 251 /* JsxSpreadAttribute */; + return kind === 252 /* JsxAttribute */ + || kind === 254 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251 /* JsxSpreadAttribute */; + return node.kind === 254 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250 /* JsxAttribute */; + return node.kind === 252 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 252 /* JsxExpression */; + || kind === 255 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; + function isJsxOpeningLikeElement(node) { + var kind = node.kind; + return kind === 250 /* JsxOpeningElement */ + || kind === 249 /* JsxSelfClosingElement */; + } + ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 /* CaseClause */ - || kind === 254 /* DefaultClause */; + return kind === 256 /* CaseClause */ + || kind === 257 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255 /* HeritageClause */; + return node.kind === 258 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256 /* CatchClause */; + return node.kind === 259 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 257 /* PropertyAssignment */; + return node.kind === 260 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258 /* ShorthandPropertyAssignment */; + return node.kind === 261 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; // Enum function isEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 263 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 261 /* SourceFile */; + return node.kind === 264 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10303,12 +10502,13 @@ var ts; function getDefaultLibFileName(options) { switch (options.target) { case 5 /* ESNext */: + return "lib.esnext.full.d.ts"; case 4 /* ES2017 */: - return "lib.es2017.d.ts"; + return "lib.es2017.full.d.ts"; case 3 /* ES2016 */: - return "lib.es2016.d.ts"; + return "lib.es2016.full.d.ts"; case 2 /* ES2015 */: - return "lib.es6.d.ts"; + return "lib.es6.d.ts"; // We don't use lib.es2015.full.d.ts due to breaking change. default: return "lib.d.ts"; } @@ -10516,13 +10716,13 @@ var ts; oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); } - return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN); + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength*/ newEndN - oldStartN); } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 143 /* TypeParameter */) { + if (d && d.kind === 144 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 229 /* InterfaceDeclaration */) { return current; } } @@ -10530,11 +10730,11 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 150 /* Constructor */ && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 151 /* Constructor */ && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 174 /* BindingElement */ || ts.isBindingPattern(node))) { + while (node && (node.kind === 175 /* BindingElement */ || ts.isBindingPattern(node))) { node = node.parent; } return node; @@ -10542,14 +10742,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -10565,23 +10765,23 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 226 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 207 /* VariableStatement */) { flags |= node.flags; } return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; /** - * Checks to see if the locale is in the appropriate format, - * and if it is, attempts to set the appropriate language. - */ + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ function validateLocaleAndSetLanguage(locale, sys, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { @@ -10632,27 +10832,60 @@ var ts; } } ts.validateLocaleAndSetLanguage = validateLocaleAndSetLanguage; + function getOriginalNode(node, nodeTest) { + if (node) { + while (node.original !== undefined) { + node = node.original; + } + } + return !nodeTest || nodeTest(node) ? node : undefined; + } + ts.getOriginalNode = getOriginalNode; + /** + * Gets a value indicating whether a node originated in the parse tree. + * + * @param node The node to test. + */ + function isParseTreeNode(node) { + return (node.flags & 8 /* Synthesized */) === 0; + } + ts.isParseTreeNode = isParseTreeNode; + function getParseTreeNode(node, nodeTest) { + if (node === undefined || isParseTreeNode(node)) { + return node; + } + node = getOriginalNode(node); + if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { + return node; + } + return undefined; + } + ts.getParseTreeNode = getParseTreeNode; + /** + * Remove extra underscore from escaped identifier text content. + * + * @param identifier The escaped identifier text. + * @returns The unescaped identifier text. + */ + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; })(ts || (ts = {})); /// /// -/* @internal */ var ts; (function (ts) { - var NodeConstructor; - var SourceFileConstructor; - function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 /* SourceFile */ - ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) - : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); - var node = location - ? new ConstructorForKind(kind, location.pos, location.end) - : new ConstructorForKind(kind, /*pos*/ -1, /*end*/ -1); - node.flags = flags | 8 /* Synthesized */; + function createSynthesizedNode(kind) { + var node = ts.createNode(kind, -1, -1); + node.flags |= 8 /* Synthesized */; return node; } + /* @internal */ function updateNode(updated, original) { if (updated !== original) { setOriginalNode(updated, original); + setTextRange(updated, original); if (original.startsOnNewLine) { updated.startsOnNewLine = true; } @@ -10661,7 +10894,10 @@ var ts; return updated; } ts.updateNode = updateNode; - function createNodeArray(elements, location, hasTrailingComma) { + /** + * Make `elements` into a `NodeArray`. If `elements` is `undefined`, returns an empty `NodeArray`. + */ + function createNodeArray(elements, hasTrailingComma) { if (elements) { if (ts.isNodeArray(elements)) { return elements; @@ -10671,38 +10907,22 @@ var ts; elements = []; } var array = elements; - if (location) { - array.pos = location.pos; - array.end = location.end; - } - else { - array.pos = -1; - array.end = -1; - } - if (hasTrailingComma) { - array.hasTrailingComma = true; - } + array.pos = -1; + array.end = -1; + array.hasTrailingComma = hasTrailingComma; return array; } ts.createNodeArray = createNodeArray; - function createSynthesizedNode(kind, startsOnNewLine) { - var node = createNode(kind, /*location*/ undefined); - node.startsOnNewLine = startsOnNewLine; - return node; - } - ts.createSynthesizedNode = createSynthesizedNode; - function createSynthesizedNodeArray(elements) { - return createNodeArray(elements, /*location*/ undefined); - } - ts.createSynthesizedNodeArray = createSynthesizedNodeArray; /** * Creates a shallow, memberwise clone of a node with no source map location. */ + /* @internal */ function getSynthesizedClone(node) { // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of // the original node. We also need to exclude specific properties and only include own- // properties (to skip members already defined on the shared prototype). - var clone = createNode(node.kind, /*location*/ undefined, node.flags); + var clone = createSynthesizedNode(node.kind); + clone.flags |= node.flags; setOriginalNode(clone, node); for (var key in node) { if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { @@ -10713,54 +10933,50 @@ var ts; return clone; } ts.getSynthesizedClone = getSynthesizedClone; - /** - * Creates a shallow, memberwise clone of a node for mutation. - */ - function getMutableClone(node) { - var clone = getSynthesizedClone(node); - clone.pos = node.pos; - clone.end = node.end; - clone.parent = node.parent; - return clone; - } - ts.getMutableClone = getMutableClone; - function createLiteral(value, location) { + function createLiteral(value) { if (typeof value === "number") { - var node = createNode(8 /* NumericLiteral */, location, /*flags*/ undefined); - node.text = value.toString(); - return node; - } - else if (typeof value === "boolean") { - return createNode(value ? 100 /* TrueKeyword */ : 85 /* FalseKeyword */, location, /*flags*/ undefined); + return createNumericLiteral(value + ""); } - else if (typeof value === "string") { - var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined); - node.text = value; - return node; + if (typeof value === "boolean") { + return value ? createTrue() : createFalse(); } - else if (value) { - var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined); - node.textSourceNode = value; - node.text = value.text; - return node; + if (typeof value === "string") { + return createStringLiteral(value); } + return createLiteralFromNode(value); } ts.createLiteral = createLiteral; + function createNumericLiteral(value) { + var node = createSynthesizedNode(8 /* NumericLiteral */); + node.text = value; + node.numericLiteralFlags = 0; + return node; + } + ts.createNumericLiteral = createNumericLiteral; + function createStringLiteral(text) { + var node = createSynthesizedNode(9 /* StringLiteral */); + node.text = text; + return node; + } + function createLiteralFromNode(sourceNode) { + var node = createStringLiteral(sourceNode.text); + node.textSourceNode = sourceNode; + return node; + } // Identifiers - var nextAutoGenerateId = 0; - function createIdentifier(text, location) { - var node = createNode(70 /* Identifier */, location); + function createIdentifier(text) { + var node = createSynthesizedNode(70 /* Identifier */); node.text = ts.escapeIdentifier(text); - node.originalKeywordKind = ts.stringToToken(text); + node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */; node.autoGenerateKind = 0 /* None */; node.autoGenerateId = 0; return node; } ts.createIdentifier = createIdentifier; - function createTempVariable(recordTempVariable, location) { - var name = createNode(70 /* Identifier */, location); - name.text = ""; - name.originalKeywordKind = 0 /* Unknown */; + var nextAutoGenerateId = 0; + /** Create a unique temporary variable. */ + function createTempVariable(recordTempVariable) { + var name = createIdentifier(""); name.autoGenerateKind = 1 /* Auto */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; @@ -10770,98 +10986,399 @@ var ts; return name; } ts.createTempVariable = createTempVariable; - function createLoopVariable(location) { - var name = createNode(70 /* Identifier */, location); - name.text = ""; - name.originalKeywordKind = 0 /* Unknown */; + /** Create a unique temporary variable for use in a loop. */ + function createLoopVariable() { + var name = createIdentifier(""); name.autoGenerateKind = 2 /* Loop */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createLoopVariable = createLoopVariable; - function createUniqueName(text, location) { - var name = createNode(70 /* Identifier */, location); - name.text = text; - name.originalKeywordKind = 0 /* Unknown */; + /** Create a unique name based on the supplied text. */ + function createUniqueName(text) { + var name = createIdentifier(text); name.autoGenerateKind = 3 /* Unique */; name.autoGenerateId = nextAutoGenerateId; nextAutoGenerateId++; return name; } ts.createUniqueName = createUniqueName; - function getGeneratedNameForNode(node, location) { - var name = createNode(70 /* Identifier */, location); - name.original = node; - name.text = ""; - name.originalKeywordKind = 0 /* Unknown */; + /** Create a unique name generated for a node. */ + function getGeneratedNameForNode(node) { + var name = createIdentifier(""); name.autoGenerateKind = 4 /* Node */; name.autoGenerateId = nextAutoGenerateId; + name.original = node; nextAutoGenerateId++; return name; } ts.getGeneratedNameForNode = getGeneratedNameForNode; // Punctuation function createToken(token) { - return createNode(token); + return createSynthesizedNode(token); } ts.createToken = createToken; // Reserved words function createSuper() { - var node = createNode(96 /* SuperKeyword */); - return node; + return createSynthesizedNode(96 /* SuperKeyword */); } ts.createSuper = createSuper; - function createThis(location) { - var node = createNode(98 /* ThisKeyword */, location); - return node; + function createThis() { + return createSynthesizedNode(98 /* ThisKeyword */); } ts.createThis = createThis; function createNull() { - var node = createNode(94 /* NullKeyword */); - return node; + return createSynthesizedNode(94 /* NullKeyword */); } ts.createNull = createNull; + function createTrue() { + return createSynthesizedNode(100 /* TrueKeyword */); + } + ts.createTrue = createTrue; + function createFalse() { + return createSynthesizedNode(85 /* FalseKeyword */); + } + ts.createFalse = createFalse; // Names - function createComputedPropertyName(expression, location) { - var node = createNode(142 /* ComputedPropertyName */, location); + function createQualifiedName(left, right) { + var node = createSynthesizedNode(142 /* QualifiedName */); + node.left = left; + node.right = asName(right); + return node; + } + ts.createQualifiedName = createQualifiedName; + function updateQualifiedName(node, left, right) { + return node.left !== left + || node.right !== right + ? updateNode(createQualifiedName(left, right), node) + : node; + } + ts.updateQualifiedName = updateQualifiedName; + function createComputedPropertyName(expression) { + var node = createSynthesizedNode(143 /* ComputedPropertyName */); node.expression = expression; return node; } ts.createComputedPropertyName = createComputedPropertyName; function updateComputedPropertyName(node, expression) { - if (node.expression !== expression) { - return updateNode(createComputedPropertyName(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createComputedPropertyName(expression), node) + : node; } ts.updateComputedPropertyName = updateComputedPropertyName; + // Type Elements + function createSignatureDeclaration(kind, typeParameters, parameters, type) { + var signatureDeclaration = createSynthesizedNode(kind); + signatureDeclaration.typeParameters = asNodeArray(typeParameters); + signatureDeclaration.parameters = asNodeArray(parameters); + signatureDeclaration.type = type; + return signatureDeclaration; + } + ts.createSignatureDeclaration = createSignatureDeclaration; + function updateSignatureDeclaration(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) + : node; + } + function createFunctionTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(159 /* FunctionType */, typeParameters, parameters, type); + } + ts.createFunctionTypeNode = createFunctionTypeNode; + function updateFunctionTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateFunctionTypeNode = updateFunctionTypeNode; + function createConstructorTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(160 /* ConstructorType */, typeParameters, parameters, type); + } + ts.createConstructorTypeNode = createConstructorTypeNode; + function updateConstructorTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructorTypeNode = updateConstructorTypeNode; + function createCallSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(154 /* CallSignature */, typeParameters, parameters, type); + } + ts.createCallSignatureDeclaration = createCallSignatureDeclaration; + function updateCallSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateCallSignatureDeclaration = updateCallSignatureDeclaration; + function createConstructSignatureDeclaration(typeParameters, parameters, type) { + return createSignatureDeclaration(155 /* ConstructSignature */, typeParameters, parameters, type); + } + ts.createConstructSignatureDeclaration = createConstructSignatureDeclaration; + function updateConstructSignatureDeclaration(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructSignatureDeclaration = updateConstructSignatureDeclaration; + function createMethodSignature(typeParameters, parameters, type, name, questionToken) { + var methodSignature = createSignatureDeclaration(149 /* MethodSignature */, typeParameters, parameters, type); + methodSignature.name = asName(name); + methodSignature.questionToken = questionToken; + return methodSignature; + } + ts.createMethodSignature = createMethodSignature; + function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.name !== name + || node.questionToken !== questionToken + ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) + : node; + } + ts.updateMethodSignature = updateMethodSignature; + // Types + function createKeywordTypeNode(kind) { + return createSynthesizedNode(kind); + } + ts.createKeywordTypeNode = createKeywordTypeNode; + function createThisTypeNode() { + return createSynthesizedNode(168 /* ThisType */); + } + ts.createThisTypeNode = createThisTypeNode; + function createLiteralTypeNode(literal) { + var literalTypeNode = createSynthesizedNode(172 /* LiteralType */); + literalTypeNode.literal = literal; + return literalTypeNode; + } + ts.createLiteralTypeNode = createLiteralTypeNode; + function updateLiteralTypeNode(node, literal) { + return node.literal !== literal + ? updateNode(createLiteralTypeNode(literal), node) + : node; + } + ts.updateLiteralTypeNode = updateLiteralTypeNode; + function createTypeReferenceNode(typeName, typeArguments) { + var typeReference = createSynthesizedNode(158 /* TypeReference */); + typeReference.typeName = asName(typeName); + typeReference.typeArguments = asNodeArray(typeArguments); + return typeReference; + } + ts.createTypeReferenceNode = createTypeReferenceNode; + function updateTypeReferenceNode(node, typeName, typeArguments) { + return node.typeName !== typeName + || node.typeArguments !== typeArguments + ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) + : node; + } + ts.updateTypeReferenceNode = updateTypeReferenceNode; + function createTypePredicateNode(parameterName, type) { + var typePredicateNode = createSynthesizedNode(157 /* TypePredicate */); + typePredicateNode.parameterName = asName(parameterName); + typePredicateNode.type = type; + return typePredicateNode; + } + ts.createTypePredicateNode = createTypePredicateNode; + function updateTypePredicateNode(node, parameterName, type) { + return node.parameterName !== parameterName + || node.type !== type + ? updateNode(createTypePredicateNode(parameterName, type), node) + : node; + } + ts.updateTypePredicateNode = updateTypePredicateNode; + function createTypeQueryNode(exprName) { + var typeQueryNode = createSynthesizedNode(161 /* TypeQuery */); + typeQueryNode.exprName = exprName; + return typeQueryNode; + } + ts.createTypeQueryNode = createTypeQueryNode; + function updateTypeQueryNode(node, exprName) { + return node.exprName !== exprName ? updateNode(createTypeQueryNode(exprName), node) : node; + } + ts.updateTypeQueryNode = updateTypeQueryNode; + function createArrayTypeNode(elementType) { + var arrayTypeNode = createSynthesizedNode(163 /* ArrayType */); + arrayTypeNode.elementType = elementType; + return arrayTypeNode; + } + ts.createArrayTypeNode = createArrayTypeNode; + function updateArrayTypeNode(node, elementType) { + return node.elementType !== elementType + ? updateNode(createArrayTypeNode(elementType), node) + : node; + } + ts.updateArrayTypeNode = updateArrayTypeNode; + function createUnionOrIntersectionTypeNode(kind, types) { + var unionTypeNode = createSynthesizedNode(kind); + unionTypeNode.types = createNodeArray(types); + return unionTypeNode; + } + ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node, types) { + return node.types !== types + ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) + : node; + } + ts.updateUnionOrIntersectionTypeNode = updateUnionOrIntersectionTypeNode; + function createTypeLiteralNode(members) { + var typeLiteralNode = createSynthesizedNode(162 /* TypeLiteral */); + typeLiteralNode.members = createNodeArray(members); + return typeLiteralNode; + } + ts.createTypeLiteralNode = createTypeLiteralNode; + function updateTypeLiteralNode(node, members) { + return node.members !== members + ? updateNode(createTypeLiteralNode(members), node) + : node; + } + ts.updateTypeLiteralNode = updateTypeLiteralNode; + function createTupleTypeNode(elementTypes) { + var tupleTypeNode = createSynthesizedNode(164 /* TupleType */); + tupleTypeNode.elementTypes = createNodeArray(elementTypes); + return tupleTypeNode; + } + ts.createTupleTypeNode = createTupleTypeNode; + function updateTypleTypeNode(node, elementTypes) { + return node.elementTypes !== elementTypes + ? updateNode(createTupleTypeNode(elementTypes), node) + : node; + } + ts.updateTypleTypeNode = updateTypleTypeNode; + function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { + var mappedTypeNode = createSynthesizedNode(171 /* MappedType */); + mappedTypeNode.readonlyToken = readonlyToken; + mappedTypeNode.typeParameter = typeParameter; + mappedTypeNode.questionToken = questionToken; + mappedTypeNode.type = type; + return mappedTypeNode; + } + ts.createMappedTypeNode = createMappedTypeNode; + function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { + return node.readonlyToken !== readonlyToken + || node.typeParameter !== typeParameter + || node.questionToken !== questionToken + || node.type !== type + ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) + : node; + } + ts.updateMappedTypeNode = updateMappedTypeNode; + function createTypeOperatorNode(type) { + var typeOperatorNode = createSynthesizedNode(169 /* TypeOperator */); + typeOperatorNode.operator = 126 /* KeyOfKeyword */; + typeOperatorNode.type = type; + return typeOperatorNode; + } + ts.createTypeOperatorNode = createTypeOperatorNode; + function updateTypeOperatorNode(node, type) { + return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; + } + ts.updateTypeOperatorNode = updateTypeOperatorNode; + function createIndexedAccessTypeNode(objectType, indexType) { + var indexedAccessTypeNode = createSynthesizedNode(170 /* IndexedAccessType */); + indexedAccessTypeNode.objectType = objectType; + indexedAccessTypeNode.indexType = indexType; + return indexedAccessTypeNode; + } + ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node, objectType, indexType) { + return node.objectType !== objectType + || node.indexType !== indexType + ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) + : node; + } + ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; + // Type Declarations + function createTypeParameterDeclaration(name, constraint, defaultType) { + var typeParameter = createSynthesizedNode(144 /* TypeParameter */); + typeParameter.name = asName(name); + typeParameter.constraint = constraint; + typeParameter.default = defaultType; + return typeParameter; + } + ts.createTypeParameterDeclaration = createTypeParameterDeclaration; + function updateTypeParameterDeclaration(node, name, constraint, defaultType) { + return node.name !== name + || node.constraint !== constraint + || node.default !== defaultType + ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) + : node; + } + ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; + // Signature elements + function createPropertySignature(name, questionToken, type, initializer) { + var propertySignature = createSynthesizedNode(147 /* PropertySignature */); + propertySignature.name = asName(name); + propertySignature.questionToken = questionToken; + propertySignature.type = type; + propertySignature.initializer = initializer; + return propertySignature; + } + ts.createPropertySignature = createPropertySignature; + function updatePropertySignature(node, name, questionToken, type, initializer) { + return node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createPropertySignature(name, questionToken, type, initializer), node) + : node; + } + ts.updatePropertySignature = updatePropertySignature; + function createIndexSignatureDeclaration(decorators, modifiers, parameters, type) { + var indexSignature = createSynthesizedNode(156 /* IndexSignature */); + indexSignature.decorators = asNodeArray(decorators); + indexSignature.modifiers = asNodeArray(modifiers); + indexSignature.parameters = createNodeArray(parameters); + indexSignature.type = type; + return indexSignature; + } + ts.createIndexSignatureDeclaration = createIndexSignatureDeclaration; + function updateIndexSignatureDeclaration(node, decorators, modifiers, parameters, type) { + return node.parameters !== parameters + || node.type !== type + || node.decorators !== decorators + || node.modifiers !== modifiers + ? updateNode(createIndexSignatureDeclaration(decorators, modifiers, parameters, type), node) + : node; + } + ts.updateIndexSignatureDeclaration = updateIndexSignatureDeclaration; // Signature elements - function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { - var node = createNode(144 /* Parameter */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + var node = createSynthesizedNode(145 /* Parameter */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.name = asName(name); node.questionToken = questionToken; node.type = type; - node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, dotDotDotToken, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer, /*location*/ node, /*flags*/ node.flags), node); - } - return node; + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer), node) + : node; } ts.updateParameter = updateParameter; + function createDecorator(expression) { + var node = createSynthesizedNode(146 /* Decorator */); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createDecorator = createDecorator; + function updateDecorator(node, expression) { + return node.expression !== expression + ? updateNode(createDecorator(expression), node) + : node; + } + ts.updateDecorator = updateDecorator; // Type members - function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { - var node = createNode(147 /* PropertyDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createProperty(decorators, modifiers, name, questionToken, type, initializer) { + var node = createSynthesizedNode(148 /* PropertyDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.questionToken = questionToken; node.type = type; node.initializer = initializer; @@ -10869,36 +11386,46 @@ var ts; } ts.createProperty = createProperty; function updateProperty(node, decorators, modifiers, name, type, initializer) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer), node) + : node; } ts.updateProperty = updateProperty; - function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(149 /* MethodDeclaration */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(150 /* MethodDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.questionToken = questionToken; + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } - ts.createMethod = createMethod; - function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + ts.createMethodDeclaration = createMethodDeclaration; + function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createMethodDeclaration(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) + : node; } ts.updateMethod = updateMethod; - function createConstructor(decorators, modifiers, parameters, body, location, flags) { - var node = createNode(150 /* Constructor */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createConstructor(decorators, modifiers, parameters, body) { + var node = createSynthesizedNode(151 /* Constructor */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = undefined; @@ -10907,17 +11434,19 @@ var ts; } ts.createConstructor = createConstructor; function updateConstructor(node, decorators, modifiers, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) { - return updateNode(createConstructor(decorators, modifiers, parameters, body, /*location*/ node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.parameters !== parameters + || node.body !== body + ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) + : node; } ts.updateConstructor = updateConstructor; - function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { - var node = createNode(151 /* GetAccessor */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createGetAccessor(decorators, modifiers, name, parameters, type, body) { + var node = createSynthesizedNode(152 /* GetAccessor */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.type = type; @@ -10926,17 +11455,21 @@ var ts; } ts.createGetAccessor = createGetAccessor; function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) + : node; } ts.updateGetAccessor = updateGetAccessor; - function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { - var node = createNode(152 /* SetAccessor */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createSetAccessor(decorators, modifiers, name, parameters, body) { + var node = createSynthesizedNode(153 /* SetAccessor */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); node.typeParameters = undefined; node.parameters = createNodeArray(parameters); node.body = body; @@ -10944,59 +11477,62 @@ var ts; } ts.createSetAccessor = createSetAccessor; function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) { - return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, /*location*/ node, node.flags), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.body !== body + ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) + : node; } ts.updateSetAccessor = updateSetAccessor; // Binding Patterns - function createObjectBindingPattern(elements, location) { - var node = createNode(172 /* ObjectBindingPattern */, location); + function createObjectBindingPattern(elements) { + var node = createSynthesizedNode(173 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); return node; } ts.createObjectBindingPattern = createObjectBindingPattern; function updateObjectBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createObjectBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createObjectBindingPattern(elements), node) + : node; } ts.updateObjectBindingPattern = updateObjectBindingPattern; - function createArrayBindingPattern(elements, location) { - var node = createNode(173 /* ArrayBindingPattern */, location); + function createArrayBindingPattern(elements) { + var node = createSynthesizedNode(174 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); return node; } ts.createArrayBindingPattern = createArrayBindingPattern; function updateArrayBindingPattern(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayBindingPattern(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayBindingPattern(elements), node) + : node; } ts.updateArrayBindingPattern = updateArrayBindingPattern; - function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { - var node = createNode(174 /* BindingElement */, location); - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createBindingElement(dotDotDotToken, propertyName, name, initializer) { + var node = createSynthesizedNode(175 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; + node.propertyName = asName(propertyName); + node.name = asName(name); node.initializer = initializer; return node; } ts.createBindingElement = createBindingElement; function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { - if (node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer) { - return updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer, node), node); - } - return node; + return node.propertyName !== propertyName + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.initializer !== initializer + ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) + : node; } ts.updateBindingElement = updateBindingElement; // Expression - function createArrayLiteral(elements, location, multiLine) { - var node = createNode(175 /* ArrayLiteralExpression */, location); - node.elements = parenthesizeListElements(createNodeArray(elements)); + function createArrayLiteral(elements, multiLine) { + var node = createSynthesizedNode(176 /* ArrayLiteralExpression */); + node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) { node.multiLine = true; } @@ -11004,14 +11540,13 @@ var ts; } ts.createArrayLiteral = createArrayLiteral; function updateArrayLiteral(node, elements) { - if (node.elements !== elements) { - return updateNode(createArrayLiteral(elements, node, node.multiLine), node); - } - return node; + return node.elements !== elements + ? updateNode(createArrayLiteral(elements, node.multiLine), node) + : node; } ts.updateArrayLiteral = updateArrayLiteral; - function createObjectLiteral(properties, location, multiLine) { - var node = createNode(176 /* ObjectLiteralExpression */, location); + function createObjectLiteral(properties, multiLine) { + var node = createSynthesizedNode(177 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); if (multiLine) { node.multiLine = true; @@ -11020,436 +11555,465 @@ var ts; } ts.createObjectLiteral = createObjectLiteral; function updateObjectLiteral(node, properties) { - if (node.properties !== properties) { - return updateNode(createObjectLiteral(properties, node, node.multiLine), node); - } - return node; + return node.properties !== properties + ? updateNode(createObjectLiteral(properties, node.multiLine), node) + : node; } ts.updateObjectLiteral = updateObjectLiteral; - function createPropertyAccess(expression, name, location, flags) { - var node = createNode(177 /* PropertyAccessExpression */, location, flags); - node.expression = parenthesizeForAccess(expression); - (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */; - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAccess(expression, name) { + var node = createSynthesizedNode(178 /* PropertyAccessExpression */); + node.expression = ts.parenthesizeForAccess(expression); + node.name = asName(name); + setEmitFlags(node, 65536 /* NoIndentation */); return node; } ts.createPropertyAccess = createPropertyAccess; function updatePropertyAccess(node, expression, name) { - if (node.expression !== expression || node.name !== name) { - var propertyAccess = createPropertyAccess(expression, name, /*location*/ node, node.flags); - // Because we are updating existed propertyAccess we want to inherit its emitFlags instead of using default from createPropertyAccess - (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node); - return updateNode(propertyAccess, node); - } - return node; + // Because we are updating existed propertyAccess we want to inherit its emitFlags + // instead of using the default from createPropertyAccess + return node.expression !== expression + || node.name !== name + ? updateNode(setEmitFlags(createPropertyAccess(expression, name), getEmitFlags(node)), node) + : node; } ts.updatePropertyAccess = updatePropertyAccess; - function createElementAccess(expression, index, location) { - var node = createNode(178 /* ElementAccessExpression */, location); - node.expression = parenthesizeForAccess(expression); - node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; + function createElementAccess(expression, index) { + var node = createSynthesizedNode(179 /* ElementAccessExpression */); + node.expression = ts.parenthesizeForAccess(expression); + node.argumentExpression = asExpression(index); return node; } ts.createElementAccess = createElementAccess; function updateElementAccess(node, expression, argumentExpression) { - if (node.expression !== expression || node.argumentExpression !== argumentExpression) { - return updateNode(createElementAccess(expression, argumentExpression, node), node); - } - return node; + return node.expression !== expression + || node.argumentExpression !== argumentExpression + ? updateNode(createElementAccess(expression, argumentExpression), node) + : node; } ts.updateElementAccess = updateElementAccess; - function createCall(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(179 /* CallExpression */, location, flags); - node.expression = parenthesizeForAccess(expression); - if (typeArguments) { - node.typeArguments = createNodeArray(typeArguments); - } - node.arguments = parenthesizeListElements(createNodeArray(argumentsArray)); + function createCall(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(180 /* CallExpression */); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); return node; } ts.createCall = createCall; function updateCall(node, expression, typeArguments, argumentsArray) { - if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) { - return updateNode(createCall(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node); - } - return node; + return expression !== node.expression + || typeArguments !== node.typeArguments + || argumentsArray !== node.arguments + ? updateNode(createCall(expression, typeArguments, argumentsArray), node) + : node; } ts.updateCall = updateCall; - function createNew(expression, typeArguments, argumentsArray, location, flags) { - var node = createNode(180 /* NewExpression */, location, flags); - node.expression = parenthesizeForNew(expression); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; + function createNew(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(181 /* NewExpression */); + node.expression = ts.parenthesizeForNew(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; return node; } ts.createNew = createNew; function updateNew(node, expression, typeArguments, argumentsArray) { - if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) { - return updateNode(createNew(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node); - } - return node; + return node.expression !== expression + || node.typeArguments !== typeArguments + || node.arguments !== argumentsArray + ? updateNode(createNew(expression, typeArguments, argumentsArray), node) + : node; } ts.updateNew = updateNew; - function createTaggedTemplate(tag, template, location) { - var node = createNode(181 /* TaggedTemplateExpression */, location); - node.tag = parenthesizeForAccess(tag); + function createTaggedTemplate(tag, template) { + var node = createSynthesizedNode(182 /* TaggedTemplateExpression */); + node.tag = ts.parenthesizeForAccess(tag); node.template = template; return node; } ts.createTaggedTemplate = createTaggedTemplate; function updateTaggedTemplate(node, tag, template) { - if (node.tag !== tag || node.template !== template) { - return updateNode(createTaggedTemplate(tag, template, node), node); - } - return node; + return node.tag !== tag + || node.template !== template + ? updateNode(createTaggedTemplate(tag, template), node) + : node; } ts.updateTaggedTemplate = updateTaggedTemplate; - function createParen(expression, location) { - var node = createNode(183 /* ParenthesizedExpression */, location); + function createTypeAssertion(type, expression) { + var node = createSynthesizedNode(183 /* TypeAssertionExpression */); + node.type = type; + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeAssertion = createTypeAssertion; + function updateTypeAssertion(node, type, expression) { + return node.type !== type + || node.expression !== expression + ? updateNode(createTypeAssertion(type, expression), node) + : node; + } + ts.updateTypeAssertion = updateTypeAssertion; + function createParen(expression) { + var node = createSynthesizedNode(184 /* ParenthesizedExpression */); node.expression = expression; return node; } ts.createParen = createParen; function updateParen(node, expression) { - if (node.expression !== expression) { - return updateNode(createParen(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createParen(expression), node) + : node; } ts.updateParen = updateParen; - function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(184 /* FunctionExpression */, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(185 /* FunctionExpression */); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionExpression = createFunctionExpression; - function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) { - if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.name !== name + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionExpression = updateFunctionExpression; - function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { - var node = createNode(185 /* ArrowFunction */, location, flags); - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + var node = createSynthesizedNode(186 /* ArrowFunction */); + node.modifiers = asNodeArray(modifiers); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35 /* EqualsGreaterThanToken */); - node.body = parenthesizeConciseBody(body); + node.body = ts.parenthesizeConciseBody(body); return node; } ts.createArrowFunction = createArrowFunction; function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) { - if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, /*location*/ node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body), node) + : node; } ts.updateArrowFunction = updateArrowFunction; - function createDelete(expression, location) { - var node = createNode(186 /* DeleteExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createDelete(expression) { + var node = createSynthesizedNode(187 /* DeleteExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createDelete = createDelete; function updateDelete(node, expression) { - if (node.expression !== expression) { - return updateNode(createDelete(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createDelete(expression), node) + : node; } ts.updateDelete = updateDelete; - function createTypeOf(expression, location) { - var node = createNode(187 /* TypeOfExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createTypeOf(expression) { + var node = createSynthesizedNode(188 /* TypeOfExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createTypeOf = createTypeOf; function updateTypeOf(node, expression) { - if (node.expression !== expression) { - return updateNode(createTypeOf(expression, node), expression); - } - return node; + return node.expression !== expression + ? updateNode(createTypeOf(expression), node) + : node; } ts.updateTypeOf = updateTypeOf; - function createVoid(expression, location) { - var node = createNode(188 /* VoidExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createVoid(expression) { + var node = createSynthesizedNode(189 /* VoidExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createVoid = createVoid; function updateVoid(node, expression) { - if (node.expression !== expression) { - return updateNode(createVoid(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createVoid(expression), node) + : node; } ts.updateVoid = updateVoid; - function createAwait(expression, location) { - var node = createNode(189 /* AwaitExpression */, location); - node.expression = parenthesizePrefixOperand(expression); + function createAwait(expression) { + var node = createSynthesizedNode(190 /* AwaitExpression */); + node.expression = ts.parenthesizePrefixOperand(expression); return node; } ts.createAwait = createAwait; function updateAwait(node, expression) { - if (node.expression !== expression) { - return updateNode(createAwait(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createAwait(expression), node) + : node; } ts.updateAwait = updateAwait; - function createPrefix(operator, operand, location) { - var node = createNode(190 /* PrefixUnaryExpression */, location); + function createPrefix(operator, operand) { + var node = createSynthesizedNode(191 /* PrefixUnaryExpression */); node.operator = operator; - node.operand = parenthesizePrefixOperand(operand); + node.operand = ts.parenthesizePrefixOperand(operand); return node; } ts.createPrefix = createPrefix; function updatePrefix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPrefix(node.operator, operand, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPrefix(node.operator, operand), node) + : node; } ts.updatePrefix = updatePrefix; - function createPostfix(operand, operator, location) { - var node = createNode(191 /* PostfixUnaryExpression */, location); - node.operand = parenthesizePostfixOperand(operand); + function createPostfix(operand, operator) { + var node = createSynthesizedNode(192 /* PostfixUnaryExpression */); + node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; } ts.createPostfix = createPostfix; function updatePostfix(node, operand) { - if (node.operand !== operand) { - return updateNode(createPostfix(operand, node.operator, node), node); - } - return node; + return node.operand !== operand + ? updateNode(createPostfix(operand, node.operator), node) + : node; } ts.updatePostfix = updatePostfix; - function createBinary(left, operator, right, location) { - var operatorToken = typeof operator === "number" ? createToken(operator) : operator; + function createBinary(left, operator, right) { + var node = createSynthesizedNode(193 /* BinaryExpression */); + var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; - var node = createNode(192 /* BinaryExpression */, location); - node.left = parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); + node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); node.operatorToken = operatorToken; - node.right = parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left); + node.right = ts.parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left); return node; } ts.createBinary = createBinary; function updateBinary(node, left, right) { - if (node.left !== left || node.right !== right) { - return updateNode(createBinary(left, node.operatorToken, right, /*location*/ node), node); - } - return node; + return node.left !== left + || node.right !== right + ? updateNode(createBinary(left, node.operatorToken, right), node) + : node; } ts.updateBinary = updateBinary; - function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonTokenOrLocation, whenFalse, location) { - var node = createNode(193 /* ConditionalExpression */, whenFalse ? location : colonTokenOrLocation); - node.condition = parenthesizeForConditionalHead(condition); - if (whenFalse) { - // second overload - node.questionToken = questionTokenOrWhenTrue; - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - node.colonToken = colonTokenOrLocation; - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); - } - else { - // first overload - node.questionToken = createToken(54 /* QuestionToken */); - node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); - node.colonToken = createToken(55 /* ColonToken */); - node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); - } + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { + var node = createSynthesizedNode(194 /* ConditionalExpression */); + node.condition = ts.parenthesizeForConditionalHead(condition); + node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(54 /* QuestionToken */); + node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); + node.colonToken = whenFalse ? colonToken : createToken(55 /* ColonToken */); + node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse); return node; } ts.createConditional = createConditional; function updateConditional(node, condition, whenTrue, whenFalse) { - if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) { - return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node); - } - return node; + return node.condition !== condition + || node.whenTrue !== whenTrue + || node.whenFalse !== whenFalse + ? updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse), node) + : node; } ts.updateConditional = updateConditional; - function createTemplateExpression(head, templateSpans, location) { - var node = createNode(194 /* TemplateExpression */, location); + function createTemplateExpression(head, templateSpans) { + var node = createSynthesizedNode(195 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; } ts.createTemplateExpression = createTemplateExpression; function updateTemplateExpression(node, head, templateSpans) { - if (node.head !== head || node.templateSpans !== templateSpans) { - return updateNode(createTemplateExpression(head, templateSpans, node), node); - } - return node; + return node.head !== head + || node.templateSpans !== templateSpans + ? updateNode(createTemplateExpression(head, templateSpans), node) + : node; } ts.updateTemplateExpression = updateTemplateExpression; - function createYield(asteriskToken, expression, location) { - var node = createNode(195 /* YieldExpression */, location); - node.asteriskToken = asteriskToken; - node.expression = expression; + function createYield(asteriskTokenOrExpression, expression) { + var node = createSynthesizedNode(196 /* YieldExpression */); + node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 38 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined; + node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 38 /* AsteriskToken */ ? asteriskTokenOrExpression : expression; return node; } ts.createYield = createYield; - function updateYield(node, expression) { - if (node.expression !== expression) { - return updateNode(createYield(node.asteriskToken, expression, node), node); - } - return node; + function updateYield(node, asteriskToken, expression) { + return node.expression !== expression + || node.asteriskToken !== asteriskToken + ? updateNode(createYield(asteriskToken, expression), node) + : node; } ts.updateYield = updateYield; - function createSpread(expression, location) { - var node = createNode(196 /* SpreadElement */, location); - node.expression = parenthesizeExpressionForList(expression); + function createSpread(expression) { + var node = createSynthesizedNode(197 /* SpreadElement */); + node.expression = ts.parenthesizeExpressionForList(expression); return node; } ts.createSpread = createSpread; function updateSpread(node, expression) { - if (node.expression !== expression) { - return updateNode(createSpread(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createSpread(expression), node) + : node; } ts.updateSpread = updateSpread; - function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(197 /* ClassExpression */, location); + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(198 /* ClassExpression */); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassExpression = createClassExpression; function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { - if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassExpression = updateClassExpression; - function createOmittedExpression(location) { - var node = createNode(198 /* OmittedExpression */, location); - return node; + function createOmittedExpression() { + return createSynthesizedNode(199 /* OmittedExpression */); } ts.createOmittedExpression = createOmittedExpression; - function createExpressionWithTypeArguments(typeArguments, expression, location) { - var node = createNode(199 /* ExpressionWithTypeArguments */, location); - node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; - node.expression = parenthesizeForAccess(expression); + function createExpressionWithTypeArguments(typeArguments, expression) { + var node = createSynthesizedNode(200 /* ExpressionWithTypeArguments */); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); return node; } ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; function updateExpressionWithTypeArguments(node, typeArguments, expression) { - if (node.typeArguments !== typeArguments || node.expression !== expression) { - return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node); - } - return node; + return node.typeArguments !== typeArguments + || node.expression !== expression + ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) + : node; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; + function createAsExpression(expression, type) { + var node = createSynthesizedNode(201 /* AsExpression */); + node.expression = expression; + node.type = type; + return node; + } + ts.createAsExpression = createAsExpression; + function updateAsExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? updateNode(createAsExpression(expression, type), node) + : node; + } + ts.updateAsExpression = updateAsExpression; + function createNonNullExpression(expression) { + var node = createSynthesizedNode(202 /* NonNullExpression */); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createNonNullExpression = createNonNullExpression; + function updateNonNullExpression(node, expression) { + return node.expression !== expression + ? updateNode(createNonNullExpression(expression), node) + : node; + } + ts.updateNonNullExpression = updateNonNullExpression; // Misc - function createTemplateSpan(expression, literal, location) { - var node = createNode(202 /* TemplateSpan */, location); + function createTemplateSpan(expression, literal) { + var node = createSynthesizedNode(204 /* TemplateSpan */); node.expression = expression; node.literal = literal; return node; } ts.createTemplateSpan = createTemplateSpan; function updateTemplateSpan(node, expression, literal) { - if (node.expression !== expression || node.literal !== literal) { - return updateNode(createTemplateSpan(expression, literal, node), node); - } - return node; + return node.expression !== expression + || node.literal !== literal + ? updateNode(createTemplateSpan(expression, literal), node) + : node; } ts.updateTemplateSpan = updateTemplateSpan; // Element - function createBlock(statements, location, multiLine, flags) { - var block = createNode(204 /* Block */, location, flags); + function createBlock(statements, multiLine) { + var block = createSynthesizedNode(206 /* Block */); block.statements = createNodeArray(statements); - if (multiLine) { - block.multiLine = true; - } + if (multiLine) + block.multiLine = multiLine; return block; } ts.createBlock = createBlock; function updateBlock(node, statements) { - if (statements !== node.statements) { - return updateNode(createBlock(statements, /*location*/ node, node.multiLine, node.flags), node); - } - return node; + return statements !== node.statements + ? updateNode(createBlock(statements, node.multiLine), node) + : node; } ts.updateBlock = updateBlock; - function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205 /* VariableStatement */, location, flags); + function createVariableStatement(modifiers, declarationList) { + var node = createSynthesizedNode(207 /* VariableStatement */); node.decorators = undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; return node; } ts.createVariableStatement = createVariableStatement; function updateVariableStatement(node, modifiers, declarationList) { - if (node.modifiers !== modifiers || node.declarationList !== declarationList) { - return updateNode(createVariableStatement(modifiers, declarationList, /*location*/ node, node.flags), node); - } - return node; + return node.modifiers !== modifiers + || node.declarationList !== declarationList + ? updateNode(createVariableStatement(modifiers, declarationList), node) + : node; } ts.updateVariableStatement = updateVariableStatement; - function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224 /* VariableDeclarationList */, location, flags); + function createVariableDeclarationList(declarations, flags) { + var node = createSynthesizedNode(226 /* VariableDeclarationList */); + node.flags |= flags; node.declarations = createNodeArray(declarations); return node; } ts.createVariableDeclarationList = createVariableDeclarationList; function updateVariableDeclarationList(node, declarations) { - if (node.declarations !== declarations) { - return updateNode(createVariableDeclarationList(declarations, /*location*/ node, node.flags), node); - } - return node; + return node.declarations !== declarations + ? updateNode(createVariableDeclarationList(declarations, node.flags), node) + : node; } ts.updateVariableDeclarationList = updateVariableDeclarationList; - function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223 /* VariableDeclaration */, location, flags); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createVariableDeclaration(name, type, initializer) { + var node = createSynthesizedNode(225 /* VariableDeclaration */); + node.name = asName(name); node.type = type; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createVariableDeclaration = createVariableDeclaration; function updateVariableDeclaration(node, name, type, initializer) { - if (node.name !== name || node.type !== type || node.initializer !== initializer) { - return updateNode(createVariableDeclaration(name, type, initializer, /*location*/ node, node.flags), node); - } - return node; + return node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createVariableDeclaration(name, type, initializer), node) + : node; } ts.updateVariableDeclaration = updateVariableDeclaration; - function createEmptyStatement(location) { - return createNode(206 /* EmptyStatement */, location); + function createEmptyStatement() { + return createSynthesizedNode(208 /* EmptyStatement */); } ts.createEmptyStatement = createEmptyStatement; - function createStatement(expression, location, flags) { - var node = createNode(207 /* ExpressionStatement */, location, flags); - node.expression = parenthesizeExpressionForExpressionStatement(expression); + function createStatement(expression) { + var node = createSynthesizedNode(209 /* ExpressionStatement */); + node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } ts.createStatement = createStatement; function updateStatement(node, expression) { - if (node.expression !== expression) { - return updateNode(createStatement(expression, /*location*/ node, node.flags), node); - } - return node; + return node.expression !== expression + ? updateNode(createStatement(expression), node) + : node; } ts.updateStatement = updateStatement; - function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208 /* IfStatement */, location); + function createIf(expression, thenStatement, elseStatement) { + var node = createSynthesizedNode(210 /* IfStatement */); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11457,42 +12021,43 @@ var ts; } ts.createIf = createIf; function updateIf(node, expression, thenStatement, elseStatement) { - if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) { - return updateNode(createIf(expression, thenStatement, elseStatement, /*location*/ node), node); - } - return node; + return node.expression !== expression + || node.thenStatement !== thenStatement + || node.elseStatement !== elseStatement + ? updateNode(createIf(expression, thenStatement, elseStatement), node) + : node; } ts.updateIf = updateIf; - function createDo(statement, expression, location) { - var node = createNode(209 /* DoStatement */, location); + function createDo(statement, expression) { + var node = createSynthesizedNode(211 /* DoStatement */); node.statement = statement; node.expression = expression; return node; } ts.createDo = createDo; function updateDo(node, statement, expression) { - if (node.statement !== statement || node.expression !== expression) { - return updateNode(createDo(statement, expression, node), node); - } - return node; + return node.statement !== statement + || node.expression !== expression + ? updateNode(createDo(statement, expression), node) + : node; } ts.updateDo = updateDo; - function createWhile(expression, statement, location) { - var node = createNode(210 /* WhileStatement */, location); + function createWhile(expression, statement) { + var node = createSynthesizedNode(212 /* WhileStatement */); node.expression = expression; node.statement = statement; return node; } ts.createWhile = createWhile; function updateWhile(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWhile(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWhile(expression, statement), node) + : node; } ts.updateWhile = updateWhile; - function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211 /* ForStatement */, location, /*flags*/ undefined); + function createFor(initializer, condition, incrementor, statement) { + var node = createSynthesizedNode(213 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11501,14 +12066,16 @@ var ts; } ts.createFor = createFor; function updateFor(node, initializer, condition, incrementor, statement) { - if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) { - return updateNode(createFor(initializer, condition, incrementor, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.condition !== condition + || node.incrementor !== incrementor + || node.statement !== statement + ? updateNode(createFor(initializer, condition, incrementor, statement), node) + : node; } ts.updateFor = updateFor; - function createForIn(initializer, expression, statement, location) { - var node = createNode(212 /* ForInStatement */, location); + function createForIn(initializer, expression, statement) { + var node = createSynthesizedNode(214 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11516,127 +12083,123 @@ var ts; } ts.createForIn = createForIn; function updateForIn(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForIn(initializer, expression, statement, node), node); - } - return node; + return node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForIn(initializer, expression, statement), node) + : node; } ts.updateForIn = updateForIn; - function createForOf(initializer, expression, statement, location) { - var node = createNode(213 /* ForOfStatement */, location); + function createForOf(awaitModifier, initializer, expression, statement) { + var node = createSynthesizedNode(215 /* ForOfStatement */); + node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; node.statement = statement; return node; } ts.createForOf = createForOf; - function updateForOf(node, initializer, expression, statement) { - if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { - return updateNode(createForOf(initializer, expression, statement, node), node); - } - return node; + function updateForOf(node, awaitModifier, initializer, expression, statement) { + return node.awaitModifier !== awaitModifier + || node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) + : node; } ts.updateForOf = updateForOf; - function createContinue(label, location) { - var node = createNode(214 /* ContinueStatement */, location); - if (label) { - node.label = label; - } + function createContinue(label) { + var node = createSynthesizedNode(216 /* ContinueStatement */); + node.label = asName(label); return node; } ts.createContinue = createContinue; function updateContinue(node, label) { - if (node.label !== label) { - return updateNode(createContinue(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createContinue(label), node) + : node; } ts.updateContinue = updateContinue; - function createBreak(label, location) { - var node = createNode(215 /* BreakStatement */, location); - if (label) { - node.label = label; - } + function createBreak(label) { + var node = createSynthesizedNode(217 /* BreakStatement */); + node.label = asName(label); return node; } ts.createBreak = createBreak; function updateBreak(node, label) { - if (node.label !== label) { - return updateNode(createBreak(label, node), node); - } - return node; + return node.label !== label + ? updateNode(createBreak(label), node) + : node; } ts.updateBreak = updateBreak; - function createReturn(expression, location) { - var node = createNode(216 /* ReturnStatement */, location); + function createReturn(expression) { + var node = createSynthesizedNode(218 /* ReturnStatement */); node.expression = expression; return node; } ts.createReturn = createReturn; function updateReturn(node, expression) { - if (node.expression !== expression) { - return updateNode(createReturn(expression, /*location*/ node), node); - } - return node; + return node.expression !== expression + ? updateNode(createReturn(expression), node) + : node; } ts.updateReturn = updateReturn; - function createWith(expression, statement, location) { - var node = createNode(217 /* WithStatement */, location); + function createWith(expression, statement) { + var node = createSynthesizedNode(219 /* WithStatement */); node.expression = expression; node.statement = statement; return node; } ts.createWith = createWith; function updateWith(node, expression, statement) { - if (node.expression !== expression || node.statement !== statement) { - return updateNode(createWith(expression, statement, node), node); - } - return node; + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWith(expression, statement), node) + : node; } ts.updateWith = updateWith; - function createSwitch(expression, caseBlock, location) { - var node = createNode(218 /* SwitchStatement */, location); - node.expression = parenthesizeExpressionForList(expression); + function createSwitch(expression, caseBlock) { + var node = createSynthesizedNode(220 /* SwitchStatement */); + node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; } ts.createSwitch = createSwitch; function updateSwitch(node, expression, caseBlock) { - if (node.expression !== expression || node.caseBlock !== caseBlock) { - return updateNode(createSwitch(expression, caseBlock, node), node); - } - return node; + return node.expression !== expression + || node.caseBlock !== caseBlock + ? updateNode(createSwitch(expression, caseBlock), node) + : node; } ts.updateSwitch = updateSwitch; - function createLabel(label, statement, location) { - var node = createNode(219 /* LabeledStatement */, location); - node.label = typeof label === "string" ? createIdentifier(label) : label; + function createLabel(label, statement) { + var node = createSynthesizedNode(221 /* LabeledStatement */); + node.label = asName(label); node.statement = statement; return node; } ts.createLabel = createLabel; function updateLabel(node, label, statement) { - if (node.label !== label || node.statement !== statement) { - return updateNode(createLabel(label, statement, node), node); - } - return node; + return node.label !== label + || node.statement !== statement + ? updateNode(createLabel(label, statement), node) + : node; } ts.updateLabel = updateLabel; - function createThrow(expression, location) { - var node = createNode(220 /* ThrowStatement */, location); + function createThrow(expression) { + var node = createSynthesizedNode(222 /* ThrowStatement */); node.expression = expression; return node; } ts.createThrow = createThrow; function updateThrow(node, expression) { - if (node.expression !== expression) { - return updateNode(createThrow(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createThrow(expression), node) + : node; } ts.updateThrow = updateThrow; - function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221 /* TryStatement */, location); + function createTry(tryBlock, catchClause, finallyBlock) { + var node = createSynthesizedNode(223 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11644,195 +12207,286 @@ var ts; } ts.createTry = createTry; function updateTry(node, tryBlock, catchClause, finallyBlock) { - if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) { - return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node); - } - return node; + return node.tryBlock !== tryBlock + || node.catchClause !== catchClause + || node.finallyBlock !== finallyBlock + ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) + : node; } ts.updateTry = updateTry; - function createCaseBlock(clauses, location) { - var node = createNode(232 /* CaseBlock */, location); - node.clauses = createNodeArray(clauses); - return node; - } - ts.createCaseBlock = createCaseBlock; - function updateCaseBlock(node, clauses) { - if (node.clauses !== clauses) { - return updateNode(createCaseBlock(clauses, node), node); - } - return node; - } - ts.updateCaseBlock = updateCaseBlock; - function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225 /* FunctionDeclaration */, location, flags); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(227 /* FunctionDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; node.body = body; return node; } ts.createFunctionDeclaration = createFunctionDeclaration; - function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { - return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); - } - return node; + function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; } ts.updateFunctionDeclaration = updateFunctionDeclaration; - function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226 /* ClassDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; - node.name = name; - node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; - node.heritageClauses = createNodeArray(heritageClauses); + function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(228 /* ClassDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); node.members = createNodeArray(members); return node; } ts.createClassDeclaration = createClassDeclaration; function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { - return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) + : node; } ts.updateClassDeclaration = updateClassDeclaration; - function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235 /* ImportDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createEnumDeclaration(decorators, modifiers, name, members) { + var node = createSynthesizedNode(231 /* EnumDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.members = createNodeArray(members); + return node; + } + ts.createEnumDeclaration = createEnumDeclaration; + function updateEnumDeclaration(node, decorators, modifiers, name, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.members !== members + ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) + : node; + } + ts.updateEnumDeclaration = updateEnumDeclaration; + function createModuleDeclaration(decorators, modifiers, name, body, flags) { + var node = createSynthesizedNode(232 /* ModuleDeclaration */); + node.flags |= flags; + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = name; + node.body = body; + return node; + } + ts.createModuleDeclaration = createModuleDeclaration; + function updateModuleDeclaration(node, decorators, modifiers, name, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.body !== body + ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) + : node; + } + ts.updateModuleDeclaration = updateModuleDeclaration; + function createModuleBlock(statements) { + var node = createSynthesizedNode(233 /* ModuleBlock */); + node.statements = createNodeArray(statements); + return node; + } + ts.createModuleBlock = createModuleBlock; + function updateModuleBlock(node, statements) { + return node.statements !== statements + ? updateNode(createModuleBlock(statements), node) + : node; + } + ts.updateModuleBlock = updateModuleBlock; + function createCaseBlock(clauses) { + var node = createSynthesizedNode(234 /* CaseBlock */); + node.clauses = createNodeArray(clauses); + return node; + } + ts.createCaseBlock = createCaseBlock; + function updateCaseBlock(node, clauses) { + return node.clauses !== clauses + ? updateNode(createCaseBlock(clauses), node) + : node; + } + ts.updateCaseBlock = updateCaseBlock; + function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { + var node = createSynthesizedNode(236 /* ImportEqualsDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.moduleReference = moduleReference; + return node; + } + ts.createImportEqualsDeclaration = createImportEqualsDeclaration; + function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.moduleReference !== moduleReference + ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) + : node; + } + ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; + function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { + var node = createSynthesizedNode(237 /* ImportDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createImportDeclaration = createImportDeclaration; function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) + : node; } ts.updateImportDeclaration = updateImportDeclaration; - function createImportClause(name, namedBindings, location) { - var node = createNode(236 /* ImportClause */, location); + function createImportClause(name, namedBindings) { + var node = createSynthesizedNode(238 /* ImportClause */); node.name = name; node.namedBindings = namedBindings; return node; } ts.createImportClause = createImportClause; function updateImportClause(node, name, namedBindings) { - if (node.name !== name || node.namedBindings !== namedBindings) { - return updateNode(createImportClause(name, namedBindings, node), node); - } - return node; + return node.name !== name + || node.namedBindings !== namedBindings + ? updateNode(createImportClause(name, namedBindings), node) + : node; } ts.updateImportClause = updateImportClause; - function createNamespaceImport(name, location) { - var node = createNode(237 /* NamespaceImport */, location); + function createNamespaceImport(name) { + var node = createSynthesizedNode(239 /* NamespaceImport */); node.name = name; return node; } ts.createNamespaceImport = createNamespaceImport; function updateNamespaceImport(node, name) { - if (node.name !== name) { - return updateNode(createNamespaceImport(name, node), node); - } - return node; + return node.name !== name + ? updateNode(createNamespaceImport(name), node) + : node; } ts.updateNamespaceImport = updateNamespaceImport; - function createNamedImports(elements, location) { - var node = createNode(238 /* NamedImports */, location); + function createNamedImports(elements) { + var node = createSynthesizedNode(240 /* NamedImports */); node.elements = createNodeArray(elements); return node; } ts.createNamedImports = createNamedImports; function updateNamedImports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedImports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedImports(elements), node) + : node; } ts.updateNamedImports = updateNamedImports; - function createImportSpecifier(propertyName, name, location) { - var node = createNode(239 /* ImportSpecifier */, location); + function createImportSpecifier(propertyName, name) { + var node = createSynthesizedNode(241 /* ImportSpecifier */); node.propertyName = propertyName; node.name = name; return node; } ts.createImportSpecifier = createImportSpecifier; function updateImportSpecifier(node, propertyName, name) { - if (node.propertyName !== propertyName || node.name !== name) { - return updateNode(createImportSpecifier(propertyName, name, node), node); - } - return node; + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createImportSpecifier(propertyName, name), node) + : node; } ts.updateImportSpecifier = updateImportSpecifier; - function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240 /* ExportAssignment */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportAssignment(decorators, modifiers, isExportEquals, expression) { + var node = createSynthesizedNode(242 /* ExportAssignment */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = expression; return node; } ts.createExportAssignment = createExportAssignment; function updateExportAssignment(node, decorators, modifiers, expression) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) { - return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.expression !== expression + ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) + : node; } ts.updateExportAssignment = updateExportAssignment; - function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241 /* ExportDeclaration */, location); - node.decorators = decorators ? createNodeArray(decorators) : undefined; - node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { + var node = createSynthesizedNode(243 /* ExportDeclaration */); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; node.moduleSpecifier = moduleSpecifier; return node; } ts.createExportDeclaration = createExportDeclaration; function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { - if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) { - return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node); - } - return node; + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.exportClause !== exportClause + || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) + : node; } ts.updateExportDeclaration = updateExportDeclaration; - function createNamedExports(elements, location) { - var node = createNode(242 /* NamedExports */, location); + function createNamedExports(elements) { + var node = createSynthesizedNode(244 /* NamedExports */); node.elements = createNodeArray(elements); return node; } ts.createNamedExports = createNamedExports; function updateNamedExports(node, elements) { - if (node.elements !== elements) { - return updateNode(createNamedExports(elements, node), node); - } - return node; + return node.elements !== elements + ? updateNode(createNamedExports(elements), node) + : node; } ts.updateNamedExports = updateNamedExports; - function createExportSpecifier(name, propertyName, location) { - var node = createNode(243 /* ExportSpecifier */, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + function createExportSpecifier(propertyName, name) { + var node = createSynthesizedNode(245 /* ExportSpecifier */); + node.propertyName = asName(propertyName); + node.name = asName(name); return node; } ts.createExportSpecifier = createExportSpecifier; - function updateExportSpecifier(node, name, propertyName) { - if (node.name !== name || node.propertyName !== propertyName) { - return updateNode(createExportSpecifier(name, propertyName, node), node); - } - return node; + function updateExportSpecifier(node, propertyName, name) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createExportSpecifier(propertyName, name), node) + : node; } ts.updateExportSpecifier = updateExportSpecifier; + // Module references + function createExternalModuleReference(expression) { + var node = createSynthesizedNode(247 /* ExternalModuleReference */); + node.expression = expression; + return node; + } + ts.createExternalModuleReference = createExternalModuleReference; + function updateExternalModuleReference(node, expression) { + return node.expression !== expression + ? updateNode(createExternalModuleReference(expression), node) + : node; + } + ts.updateExternalModuleReference = updateExternalModuleReference; // JSX - function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246 /* JsxElement */, location); + function createJsxElement(openingElement, children, closingElement) { + var node = createSynthesizedNode(248 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11840,96 +12494,108 @@ var ts; } ts.createJsxElement = createJsxElement; function updateJsxElement(node, openingElement, children, closingElement) { - if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) { - return updateNode(createJsxElement(openingElement, children, closingElement, node), node); - } - return node; + return node.openingElement !== openingElement + || node.children !== children + || node.closingElement !== closingElement + ? updateNode(createJsxElement(openingElement, children, closingElement), node) + : node; } ts.updateJsxElement = updateJsxElement; - function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247 /* JsxSelfClosingElement */, location); + function createJsxSelfClosingElement(tagName, attributes) { + var node = createSynthesizedNode(249 /* JsxSelfClosingElement */); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxSelfClosingElement = createJsxSelfClosingElement; function updateJsxSelfClosingElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxSelfClosingElement(tagName, attributes), node) + : node; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; - function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248 /* JsxOpeningElement */, location); + function createJsxOpeningElement(tagName, attributes) { + var node = createSynthesizedNode(250 /* JsxOpeningElement */); node.tagName = tagName; - node.attributes = createNodeArray(attributes); + node.attributes = attributes; return node; } ts.createJsxOpeningElement = createJsxOpeningElement; function updateJsxOpeningElement(node, tagName, attributes) { - if (node.tagName !== tagName || node.attributes !== attributes) { - return updateNode(createJsxOpeningElement(tagName, attributes, node), node); - } - return node; + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxOpeningElement(tagName, attributes), node) + : node; } ts.updateJsxOpeningElement = updateJsxOpeningElement; - function createJsxClosingElement(tagName, location) { - var node = createNode(249 /* JsxClosingElement */, location); + function createJsxClosingElement(tagName) { + var node = createSynthesizedNode(251 /* JsxClosingElement */); node.tagName = tagName; return node; } ts.createJsxClosingElement = createJsxClosingElement; function updateJsxClosingElement(node, tagName) { - if (node.tagName !== tagName) { - return updateNode(createJsxClosingElement(tagName, node), node); - } - return node; + return node.tagName !== tagName + ? updateNode(createJsxClosingElement(tagName), node) + : node; } ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer, location) { - var node = createNode(250 /* JsxAttribute */, location); + function createJsxAttributes(properties) { + var jsxAttributes = createSynthesizedNode(253 /* JsxAttributes */); + jsxAttributes.properties = createNodeArray(properties); + return jsxAttributes; + } + ts.createJsxAttributes = createJsxAttributes; + function updateJsxAttributes(jsxAttributes, properties) { + if (jsxAttributes.properties !== properties) { + return updateNode(createJsxAttributes(properties), jsxAttributes); + } + return jsxAttributes; + } + ts.updateJsxAttributes = updateJsxAttributes; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(252 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; } ts.createJsxAttribute = createJsxAttribute; function updateJsxAttribute(node, name, initializer) { - if (node.name !== name || node.initializer !== initializer) { - return updateNode(createJsxAttribute(name, initializer, node), node); - } - return node; + return node.name !== name + || node.initializer !== initializer + ? updateNode(createJsxAttribute(name, initializer), node) + : node; } ts.updateJsxAttribute = updateJsxAttribute; - function createJsxSpreadAttribute(expression, location) { - var node = createNode(251 /* JsxSpreadAttribute */, location); + function createJsxSpreadAttribute(expression) { + var node = createSynthesizedNode(254 /* JsxSpreadAttribute */); node.expression = expression; return node; } ts.createJsxSpreadAttribute = createJsxSpreadAttribute; function updateJsxSpreadAttribute(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxSpreadAttribute(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxSpreadAttribute(expression), node) + : node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252 /* JsxExpression */, location); + function createJsxExpression(dotDotDotToken, expression) { + var node = createSynthesizedNode(255 /* JsxExpression */); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { - if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); - } - return node; + return node.expression !== expression + ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) + : node; } ts.updateJsxExpression = updateJsxExpression; // Clauses - function createHeritageClause(token, types, location) { - var node = createNode(255 /* HeritageClause */, location); + function createHeritageClause(token, types) { + var node = createSynthesizedNode(258 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -11937,40 +12603,40 @@ var ts; ts.createHeritageClause = createHeritageClause; function updateHeritageClause(node, types) { if (node.types !== types) { - return updateNode(createHeritageClause(node.token, types, node), node); + return updateNode(createHeritageClause(node.token, types), node); } return node; } ts.updateHeritageClause = updateHeritageClause; - function createCaseClause(expression, statements, location) { - var node = createNode(253 /* CaseClause */, location); - node.expression = parenthesizeExpressionForList(expression); + function createCaseClause(expression, statements) { + var node = createSynthesizedNode(256 /* CaseClause */); + node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; } ts.createCaseClause = createCaseClause; function updateCaseClause(node, expression, statements) { if (node.expression !== expression || node.statements !== statements) { - return updateNode(createCaseClause(expression, statements, node), node); + return updateNode(createCaseClause(expression, statements), node); } return node; } ts.updateCaseClause = updateCaseClause; - function createDefaultClause(statements, location) { - var node = createNode(254 /* DefaultClause */, location); + function createDefaultClause(statements) { + var node = createSynthesizedNode(257 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } ts.createDefaultClause = createDefaultClause; function updateDefaultClause(node, statements) { if (node.statements !== statements) { - return updateNode(createDefaultClause(statements, node), node); + return updateNode(createDefaultClause(statements), node); } return node; } ts.updateDefaultClause = updateDefaultClause; - function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256 /* CatchClause */, location); + function createCatchClause(variableDeclaration, block) { + var node = createSynthesizedNode(259 /* CatchClause */); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11978,58 +12644,74 @@ var ts; ts.createCatchClause = createCatchClause; function updateCatchClause(node, variableDeclaration, block) { if (node.variableDeclaration !== variableDeclaration || node.block !== block) { - return updateNode(createCatchClause(variableDeclaration, block, node), node); + return updateNode(createCatchClause(variableDeclaration, block), node); } return node; } ts.updateCatchClause = updateCatchClause; // Property assignments - function createPropertyAssignment(name, initializer, location) { - var node = createNode(257 /* PropertyAssignment */, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; + function createPropertyAssignment(name, initializer) { + var node = createSynthesizedNode(260 /* PropertyAssignment */); + node.name = asName(name); node.questionToken = undefined; - node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; return node; } ts.createPropertyAssignment = createPropertyAssignment; function updatePropertyAssignment(node, name, initializer) { if (node.name !== name || node.initializer !== initializer) { - return updateNode(createPropertyAssignment(name, initializer, node), node); + return updateNode(createPropertyAssignment(name, initializer), node); } return node; } ts.updatePropertyAssignment = updatePropertyAssignment; - function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258 /* ShorthandPropertyAssignment */, location); - node.name = typeof name === "string" ? createIdentifier(name) : name; - node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; + function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { + var node = createSynthesizedNode(261 /* ShorthandPropertyAssignment */); + node.name = asName(name); + node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; - function createSpreadAssignment(expression, location) { - var node = createNode(259 /* SpreadAssignment */, location); - node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; - return node; - } - ts.createSpreadAssignment = createSpreadAssignment; function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) { - return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node); + return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node); } return node; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; + function createSpreadAssignment(expression) { + var node = createSynthesizedNode(262 /* SpreadAssignment */); + node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; + return node; + } + ts.createSpreadAssignment = createSpreadAssignment; function updateSpreadAssignment(node, expression) { if (node.expression !== expression) { - return updateNode(createSpreadAssignment(expression, node), node); + return updateNode(createSpreadAssignment(expression), node); } return node; } ts.updateSpreadAssignment = updateSpreadAssignment; + // Enum + function createEnumMember(name, initializer) { + var node = createSynthesizedNode(263 /* EnumMember */); + node.name = asName(name); + node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); + return node; + } + ts.createEnumMember = createEnumMember; + function updateEnumMember(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createEnumMember(name, initializer), node) + : node; + } + ts.updateEnumMember = updateEnumMember; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261 /* SourceFile */, /*location*/ node, node.flags); + var updated = createSynthesizedNode(264 /* SourceFile */); + updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -12088,6 +12770,17 @@ var ts; return node; } ts.updateSourceFileNode = updateSourceFileNode; + /** + * Creates a shallow, memberwise clone of a node for mutation. + */ + function getMutableClone(node) { + var clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + clone.parent = node.parent; + return clone; + } + ts.getMutableClone = getMutableClone; // Transformation nodes /** * Creates a synthetic statement to act as a placeholder for a not-emitted statement in @@ -12096,8 +12789,9 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(293 /* NotEmittedStatement */, /*location*/ original); + var node = createSynthesizedNode(294 /* NotEmittedStatement */); node.original = original; + setTextRange(node, original); return node; } ts.createNotEmittedStatement = createNotEmittedStatement; @@ -12105,8 +12799,9 @@ var ts; * Creates a synthetic element to act as a placeholder for the end of an emitted declaration in * order to properly emit exports. */ + /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createNode(296 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(297 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12116,8 +12811,9 @@ var ts; * Creates a synthetic element to act as a placeholder for the beginning of a merged declaration in * order to properly emit exports. */ + /* @internal */ function createMergeDeclarationMarker(original) { - var node = createNode(295 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(296 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12131,44 +12827,45 @@ var ts; * @param original The original outer expression. * @param location The location for the expression. Defaults to the positions from "original" if provided. */ - function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original); + function createPartiallyEmittedExpression(expression, original) { + var node = createSynthesizedNode(295 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; + setTextRange(node, original); return node; } ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; function updatePartiallyEmittedExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node); + return updateNode(createPartiallyEmittedExpression(expression, node.original), node); } return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - /** - * Creates a node that emits a string of raw text in an expression position. Raw text is never - * transformed, should be ES3 compliant, and should have the same precedence as - * PrimaryExpression. - * - * @param text The raw text of the node. - */ - function createRawExpression(text) { - var node = createNode(297 /* RawExpression */); - node.text = text; + function createBundle(sourceFiles) { + var node = ts.createNode(265 /* Bundle */); + node.sourceFiles = sourceFiles; return node; } - ts.createRawExpression = createRawExpression; + ts.createBundle = createBundle; + function updateBundle(node, sourceFiles) { + if (node.sourceFiles !== sourceFiles) { + return createBundle(sourceFiles); + } + return node; + } + ts.updateBundle = updateBundle; // Compound nodes function createComma(left, right) { return createBinary(left, 25 /* CommaToken */, right); } ts.createComma = createComma; - function createLessThan(left, right, location) { - return createBinary(left, 26 /* LessThanToken */, right, location); + function createLessThan(left, right) { + return createBinary(left, 26 /* LessThanToken */, right); } ts.createLessThan = createLessThan; - function createAssignment(left, right, location) { - return createBinary(left, 57 /* EqualsToken */, right, location); + function createAssignment(left, right) { + return createBinary(left, 57 /* EqualsToken */, right); } ts.createAssignment = createAssignment; function createStrictEquality(left, right) { @@ -12187,8 +12884,8 @@ var ts; return createBinary(left, 37 /* MinusToken */, right); } ts.createSubtract = createSubtract; - function createPostfixIncrement(operand, location) { - return createPostfix(operand, 42 /* PlusPlusToken */, location); + function createPostfixIncrement(operand) { + return createPostfix(operand, 42 /* PlusPlusToken */); } ts.createPostfixIncrement = createPostfixIncrement; function createLogicalAnd(left, right) { @@ -12207,61 +12904,378 @@ var ts; return createVoid(createLiteral(0)); } ts.createVoidZero = createVoidZero; + function createExportDefault(expression) { + return createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportEquals*/ false, expression); + } + ts.createExportDefault = createExportDefault; + function createExternalModuleExport(exportName) { + return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(/*propertyName*/ undefined, exportName)])); + } + ts.createExternalModuleExport = createExternalModuleExport; + function asName(name) { + return typeof name === "string" ? createIdentifier(name) : name; + } + function asExpression(value) { + return typeof value === "string" || typeof value === "number" ? createLiteral(value) : value; + } + function asNodeArray(array) { + return array ? createNodeArray(array) : undefined; + } + function asToken(value) { + return typeof value === "number" ? createToken(value) : value; + } + /** + * Clears any EmitNode entries from parse-tree nodes. + * @param sourceFile A source file. + */ + function disposeEmitNodes(sourceFile) { + // During transformation we may need to annotate a parse tree node with transient + // transformation properties. As parse tree nodes live longer than transformation + // nodes, we need to make sure we reclaim any memory allocated for custom ranges + // from these nodes to ensure we do not hold onto entire subtrees just for position + // information. We also need to reset these nodes to a pre-transformation state + // for incremental parsing scenarios so that we do not impact later emit. + sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); + var emitNode = sourceFile && sourceFile.emitNode; + var annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = undefined; + } + } + } + ts.disposeEmitNodes = disposeEmitNodes; + /** + * Associates a node with the current transformation, initializing + * various transient transformation properties. + */ + /* @internal */ + function getOrCreateEmitNode(node) { + if (!node.emitNode) { + if (ts.isParseTreeNode(node)) { + // To avoid holding onto transformation artifacts, we keep track of any + // parse tree node we are annotating. This allows us to clean them up after + // all transformations have completed. + if (node.kind === 264 /* SourceFile */) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = ts.getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } + return node.emitNode; + } + ts.getOrCreateEmitNode = getOrCreateEmitNode; + function setTextRange(range, location) { + if (location) { + range.pos = location.pos; + range.end = location.end; + } + return range; + } + ts.setTextRange = setTextRange; + /** + * Gets flags that control emit behavior of a node. + */ + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + ts.getEmitFlags = getEmitFlags; + /** + * Sets flags that control emit behavior of a node. + */ + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + ts.setEmitFlags = setEmitFlags; + /** + * Gets a custom text range to use when emitting source maps. + */ + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; + /** + * Sets a custom text range to use when emitting source maps. + */ + function setSourceMapRange(node, range) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + ts.setSourceMapRange = setSourceMapRange; + /** + * Gets the TextRange to use for source maps for a token of a node. + */ + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; + /** + * Sets the TextRange to use for source maps for a token of a node. + */ + function setTokenSourceMapRange(node, token, range) { + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); + tokenSourceMapRanges[token] = range; + return node; + } + ts.setTokenSourceMapRange = setTokenSourceMapRange; + /** + * Gets a custom text range to use when emitting comments. + */ + function getCommentRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + ts.getCommentRange = getCommentRange; + /** + * Sets a custom text range to use when emitting comments. + */ + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + ts.setCommentRange = setCommentRange; + function getSyntheticLeadingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.leadingComments; + } + ts.getSyntheticLeadingComments = getSyntheticLeadingComments; + function setSyntheticLeadingComments(node, comments) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + ts.setSyntheticLeadingComments = setSyntheticLeadingComments; + function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticLeadingComment = addSyntheticLeadingComment; + function getSyntheticTrailingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.trailingComments; + } + ts.getSyntheticTrailingComments = getSyntheticTrailingComments; + function setSyntheticTrailingComments(node, comments) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + ts.setSyntheticTrailingComments = setSyntheticTrailingComments; + function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticTrailingComment = addSyntheticTrailingComment; + /** + * Gets the constant value to emit for an expression. + */ + function getConstantValue(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + ts.getConstantValue = getConstantValue; + /** + * Sets the constant value to emit for an expression. + */ + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + ts.setConstantValue = setConstantValue; + /** + * Adds an EmitHelper to a node. + */ + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + /** + * Add EmitHelpers to a node. + */ + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + /** + * Removes an EmitHelper from a node. + */ + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + /** + * Gets the EmitHelpers of a node. + */ + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + /** + * Moves matching emit helpers from a source node to a target node. + */ + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + /* @internal */ + function compareEmitHelpers(x, y) { + if (x === y) + return 0 /* EqualTo */; + if (x.priority === y.priority) + return 0 /* EqualTo */; + if (x.priority === undefined) + return 1 /* GreaterThan */; + if (y.priority === undefined) + return -1 /* LessThan */; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) + destEmitNode = {}; + if (leadingComments) + destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) + destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments); + if (flags) + destEmitNode.flags = flags; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) + destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); + return destEmitNode; + } + function mergeTokenSourceMapRanges(sourceRanges, destRanges) { + if (!destRanges) + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } + return destRanges; + } +})(ts || (ts = {})); +/* @internal */ +(function (ts) { + // Compound nodes function createTypeCheck(value, tag) { return tag === "undefined" - ? createStrictEquality(value, createVoidZero()) - : createStrictEquality(createTypeOf(value), createLiteral(tag)); + ? ts.createStrictEquality(value, ts.createVoidZero()) + : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)); } ts.createTypeCheck = createTypeCheck; function createMemberAccessForPropertyName(target, memberName, location) { if (ts.isComputedPropertyName(memberName)) { - return createElementAccess(target, memberName.expression, location); + return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); } else { - var expression = ts.isIdentifier(memberName) ? createPropertyAccess(target, memberName, location) : createElementAccess(target, memberName, location); - (expression.emitNode || (expression.emitNode = {})).flags |= 64 /* NoNestedSourceMaps */; + var expression = ts.setTextRange(ts.isIdentifier(memberName) + ? ts.createPropertyAccess(target, memberName) + : ts.createElementAccess(target, memberName), memberName); + ts.getOrCreateEmitNode(expression).flags |= 64 /* NoNestedSourceMaps */; return expression; } } ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; function createFunctionCall(func, thisArg, argumentsList, location) { - return createCall(createPropertyAccess(func, "call"), + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), /*typeArguments*/ undefined, [ thisArg - ].concat(argumentsList), location); + ].concat(argumentsList)), location); } ts.createFunctionCall = createFunctionCall; function createFunctionApply(func, thisArg, argumentsExpression, location) { - return createCall(createPropertyAccess(func, "apply"), + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), /*typeArguments*/ undefined, [ thisArg, argumentsExpression - ], location); + ]), location); } ts.createFunctionApply = createFunctionApply; function createArraySlice(array, start) { var argumentsList = []; if (start !== undefined) { - argumentsList.push(typeof start === "number" ? createLiteral(start) : start); + argumentsList.push(typeof start === "number" ? ts.createLiteral(start) : start); } - return createCall(createPropertyAccess(array, "slice"), /*typeArguments*/ undefined, argumentsList); + return ts.createCall(ts.createPropertyAccess(array, "slice"), /*typeArguments*/ undefined, argumentsList); } ts.createArraySlice = createArraySlice; function createArrayConcat(array, values) { - return createCall(createPropertyAccess(array, "concat"), + return ts.createCall(ts.createPropertyAccess(array, "concat"), /*typeArguments*/ undefined, values); } ts.createArrayConcat = createArrayConcat; function createMathPow(left, right, location) { - return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), - /*typeArguments*/ undefined, [left, right], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), + /*typeArguments*/ undefined, [left, right]), location); } ts.createMathPow = createMathPow; function createReactNamespace(reactNamespace, parent) { // To ensure the emit resolver can properly resolve the namespace, we need to // treat this identifier as if it were a source tree node by clearing the `Synthesized` // flag and setting a parent node. - var react = createIdentifier(reactNamespace || "React"); + var react = ts.createIdentifier(reactNamespace || "React"); react.flags &= ~8 /* Synthesized */; // Set the parent that is in parse tree // this makes sure that parent chain is intact for checker to traverse complete scope tree @@ -12271,9 +13285,9 @@ var ts; function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { if (ts.isQualifiedName(jsxFactory)) { var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); - var right = createSynthesizedNode(70 /* Identifier */); + var right = ts.createIdentifier(jsxFactory.right.text); right.text = jsxFactory.right.text; - return createPropertyAccess(left, right); + return ts.createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); @@ -12282,7 +13296,7 @@ var ts; function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { return jsxFactoryEntity ? createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : - createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); } function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { var argumentsList = [tagName]; @@ -12291,7 +13305,7 @@ var ts; } if (children && children.length > 0) { if (!props) { - argumentsList.push(createNull()); + argumentsList.push(ts.createNull()); } if (children.length > 1) { for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { @@ -12304,35 +13318,89 @@ var ts; argumentsList.push(children[0]); } } - return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), - /*typeArguments*/ undefined, argumentsList, location); + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), + /*typeArguments*/ undefined, argumentsList), location); } ts.createExpressionForJsxElement = createExpressionForJsxElement; - function createExportDefault(expression) { - return createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportEquals*/ false, expression); - } - ts.createExportDefault = createExportDefault; - function createExternalModuleExport(exportName) { - return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(exportName)])); - } - ts.createExternalModuleExport = createExternalModuleExport; - function createLetStatement(name, initializer, location) { - return createVariableStatement(/*modifiers*/ undefined, createLetDeclarationList([createVariableDeclaration(name, /*type*/ undefined, initializer)]), location); - } - ts.createLetStatement = createLetStatement; - function createLetDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 1 /* Let */); - } - ts.createLetDeclarationList = createLetDeclarationList; - function createConstDeclarationList(declarations, location) { - return createVariableDeclarationList(declarations, location, 2 /* Const */); - } - ts.createConstDeclarationList = createConstDeclarationList; // Helpers function getHelperName(name) { - return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); + return ts.setEmitFlags(ts.createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); } ts.getHelperName = getHelperName; + var valuesHelper = { + name: "typescript:values", + scoped: false, + text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n " + }; + function createValuesHelper(context, expression, location) { + context.requestEmitHelper(valuesHelper); + return ts.setTextRange(ts.createCall(getHelperName("__values"), + /*typeArguments*/ undefined, [expression]), location); + } + ts.createValuesHelper = createValuesHelper; + var readHelper = { + name: "typescript:read", + scoped: false, + text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n " + }; + function createReadHelper(context, iteratorRecord, count, location) { + context.requestEmitHelper(readHelper); + return ts.setTextRange(ts.createCall(getHelperName("__read"), + /*typeArguments*/ undefined, count !== undefined + ? [iteratorRecord, ts.createLiteral(count)] + : [iteratorRecord]), location); + } + ts.createReadHelper = createReadHelper; + var spreadHelper = { + name: "typescript:spread", + scoped: false, + text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" + }; + function createSpreadHelper(context, argumentList, location) { + context.requestEmitHelper(readHelper); + context.requestEmitHelper(spreadHelper); + return ts.setTextRange(ts.createCall(getHelperName("__spread"), + /*typeArguments*/ undefined, argumentList), location); + } + ts.createSpreadHelper = createSpreadHelper; + // Utilities + function createForOfBindingStatement(node, boundValue) { + if (ts.isVariableDeclarationList(node)) { + var firstDeclaration = ts.firstOrUndefined(node.declarations); + var updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, + /*typeNode*/ undefined, boundValue); + return ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.updateVariableDeclarationList(node, [updatedDeclaration])), + /*location*/ node); + } + else { + var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), /*location*/ node); + return ts.setTextRange(ts.createStatement(updatedExpression), /*location*/ node); + } + } + ts.createForOfBindingStatement = createForOfBindingStatement; + function insertLeadingStatement(dest, source) { + if (ts.isBlock(dest)) { + return ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)); + } + else { + return ts.createBlock(ts.createNodeArray([dest, source]), /*multiLine*/ true); + } + } + ts.insertLeadingStatement = insertLeadingStatement; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 221 /* LabeledStatement */ + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12342,13 +13410,13 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return false; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -12359,22 +13427,27 @@ var ts; var thisArg; var target; if (ts.isSuperProperty(callee)) { - thisArg = createThis(); + thisArg = ts.createThis(); target = callee; } else if (callee.kind === 96 /* SuperKeyword */) { - thisArg = createThis(); - target = languageVersion < 2 /* ES2015 */ ? createIdentifier("_super", /*location*/ callee) : callee; + thisArg = ts.createThis(); + target = languageVersion < 2 /* ES2015 */ + ? ts.setTextRange(ts.createIdentifier("_super"), callee) + : callee; + } + else if (ts.getEmitFlags(callee) & 4096 /* HelperName */) { + thisArg = ts.createVoidZero(); + target = parenthesizeForAccess(callee); } else { switch (callee.kind) { - case 177 /* PropertyAccessExpression */: { + case 178 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` - thisArg = createTempVariable(recordTempVariable); - target = createPropertyAccess(createAssignment(thisArg, callee.expression, - /*location*/ callee.expression), callee.name, - /*location*/ callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12382,13 +13455,12 @@ var ts; } break; } - case 178 /* ElementAccessExpression */: { + case 179 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` - thisArg = createTempVariable(recordTempVariable); - target = createElementAccess(createAssignment(thisArg, callee.expression, - /*location*/ callee.expression), callee.argumentExpression, - /*location*/ callee); + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); + ts.setTextRange(target, callee); } else { thisArg = callee.expression; @@ -12398,7 +13470,7 @@ var ts; } default: { // for `a()` target is `a` and thisArg is `void 0` - thisArg = createVoidZero(); + thisArg = ts.createVoidZero(); target = parenthesizeForAccess(expression); break; } @@ -12408,42 +13480,42 @@ var ts; } ts.createCallBinding = createCallBinding; function inlineExpressions(expressions) { - return ts.reduceLeft(expressions, createComma); + return ts.reduceLeft(expressions, ts.createComma); } ts.inlineExpressions = inlineExpressions; function createExpressionFromEntityName(node) { if (ts.isQualifiedName(node)) { var left = createExpressionFromEntityName(node.left); - var right = getMutableClone(node.right); - return createPropertyAccess(left, right, /*location*/ node); + var right = ts.getMutableClone(node.right); + return ts.setTextRange(ts.createPropertyAccess(left, right), node); } else { - return getMutableClone(node); + return ts.getMutableClone(node); } } ts.createExpressionFromEntityName = createExpressionFromEntityName; function createExpressionForPropertyName(memberName) { if (ts.isIdentifier(memberName)) { - return createLiteral(memberName, /*location*/ undefined); + return ts.createLiteral(memberName); } else if (ts.isComputedPropertyName(memberName)) { - return getMutableClone(memberName.expression); + return ts.getMutableClone(memberName.expression); } else { - return getMutableClone(memberName); + return ts.getMutableClone(memberName); } } ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); } } @@ -12453,57 +13525,55 @@ var ts; if (property === firstAccessor) { var properties_1 = []; if (getAccessor) { - var getterFunction = createFunctionExpression(getAccessor.modifiers, + var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, /*asteriskToken*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, getAccessor.parameters, - /*type*/ undefined, getAccessor.body, - /*location*/ getAccessor); - setOriginalNode(getterFunction, getAccessor); - var getter = createPropertyAssignment("get", getterFunction); + /*type*/ undefined, getAccessor.body); + ts.setTextRange(getterFunction, getAccessor); + ts.setOriginalNode(getterFunction, getAccessor); + var getter = ts.createPropertyAssignment("get", getterFunction); properties_1.push(getter); } if (setAccessor) { - var setterFunction = createFunctionExpression(setAccessor.modifiers, + var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, /*asteriskToken*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, setAccessor.parameters, - /*type*/ undefined, setAccessor.body, - /*location*/ setAccessor); - setOriginalNode(setterFunction, setAccessor); - var setter = createPropertyAssignment("set", setterFunction); + /*type*/ undefined, setAccessor.body); + ts.setTextRange(setterFunction, setAccessor); + ts.setOriginalNode(setterFunction, setAccessor); + var setter = ts.createPropertyAssignment("set", setterFunction); properties_1.push(setter); } - properties_1.push(createPropertyAssignment("enumerable", createLiteral(true))); - properties_1.push(createPropertyAssignment("configurable", createLiteral(true))); - var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), + properties_1.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); + properties_1.push(ts.createPropertyAssignment("configurable", ts.createTrue())); + var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), /*typeArguments*/ undefined, [ receiver, createExpressionForPropertyName(property.name), - createObjectLiteral(properties_1, /*location*/ undefined, multiLine) - ], + ts.createObjectLiteral(properties_1, multiLine) + ]), /*location*/ firstAccessor); return ts.aggregateTransformFlags(expression); } return undefined; } function createExpressionForPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), property.initializer, - /*location*/ property), - /*original*/ property)); + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), property.initializer), property), property)); } function createExpressionForShorthandPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), getSynthesizedClone(property.name), + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), ts.getSynthesizedClone(property.name)), /*location*/ property), /*original*/ property)); } function createExpressionForMethodDeclaration(method, receiver) { - return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, /*location*/ method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, /*location*/ method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, /*name*/ undefined, /*typeParameters*/ undefined, method.parameters, - /*type*/ undefined, method.body, + /*type*/ undefined, method.body), /*location*/ method), - /*original*/ method), + /*original*/ method)), /*location*/ method), /*original*/ method)); } @@ -12525,7 +13595,7 @@ var ts; * Gets whether an identifier should only be referred to by its local name. */ function isLocalName(node) { - return (getEmitFlags(node) & 16384 /* LocalName */) !== 0; + return (ts.getEmitFlags(node) & 16384 /* LocalName */) !== 0; } ts.isLocalName = isLocalName; /** @@ -12547,7 +13617,7 @@ var ts; * name points to an exported symbol. */ function isExportName(node) { - return (getEmitFlags(node) & 8192 /* ExportName */) !== 0; + return (ts.getEmitFlags(node) & 8192 /* ExportName */) !== 0; } ts.isExportName = isExportName; /** @@ -12563,17 +13633,17 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_8 = getMutableClone(node.name); - emitFlags |= getEmitFlags(node.name); + var name = ts.getMutableClone(node.name); + emitFlags |= ts.getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48 /* NoSourceMap */; if (!allowComments) emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(name_8, emitFlags); - return name_8; + ts.setEmitFlags(name, emitFlags); + return name; } - return getGeneratedNameForNode(node); + return ts.getGeneratedNameForNode(node); } /** * Gets the exported name of a declaration for use in expressions. @@ -12602,19 +13672,20 @@ var ts; * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. */ function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { - var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name); + var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); + ts.setTextRange(qualifiedName, name); var emitFlags; if (!allowSourceMaps) emitFlags |= 48 /* NoSourceMap */; if (!allowComments) emitFlags |= 1536 /* NoComments */; if (emitFlags) - setEmitFlags(qualifiedName, emitFlags); + ts.setEmitFlags(qualifiedName, emitFlags); return qualifiedName; } ts.getNamespaceMemberName = getNamespaceMemberName; function convertToFunctionBody(node, multiLine) { - return ts.isBlock(node) ? node : createBlock([createReturn(node, /*location*/ node)], /*location*/ node, multiLine); + return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node); } ts.convertToFunctionBody = convertToFunctionBody; function isUseStrictPrologue(node) { @@ -12631,7 +13702,18 @@ var ts; * @param ensureUseStrict: boolean determining whether the function need to add prologue-directives * @param visitor: Optional callback used to visit any custom prologue directives. */ - function addPrologueDirectives(target, source, ensureUseStrict, visitor) { + function addPrologue(target, source, ensureUseStrict, visitor) { + var offset = addStandardPrologue(target, source, ensureUseStrict); + return addCustomPrologue(target, source, offset, visitor); + } + ts.addPrologue = addPrologue; + /** + * Add just the standard (string-expression) prologue-directives into target statement-array. + * The function needs to be called during each transformation step. + * This function needs to be called whenever we transform the statement + * list of a source file, namespace, or function-like body. + */ + function addStandardPrologue(target, source, ensureUseStrict) { ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); var foundUseStrict = false; var statementOffset = 0; @@ -12650,11 +13732,22 @@ var ts; statementOffset++; } if (ensureUseStrict && !foundUseStrict) { - target.push(startOnNewLine(createStatement(createLiteral("use strict")))); + target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))); } + return statementOffset; + } + ts.addStandardPrologue = addStandardPrologue; + /** + * Add just the custom prologue-directives into target statement-array. + * The function needs to be called during each transformation step. + * This function needs to be called whenever we transform the statement + * list of a source file, namespace, or function-like body. + */ + function addCustomPrologue(target, source, statementOffset, visitor) { + var numStatements = source.length; while (statementOffset < numStatements) { var statement = source[statementOffset]; - if (getEmitFlags(statement) & 524288 /* CustomPrologue */) { + if (ts.getEmitFlags(statement) & 524288 /* CustomPrologue */) { target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); } else { @@ -12664,7 +13757,7 @@ var ts; } return statementOffset; } - ts.addPrologueDirectives = addPrologueDirectives; + ts.addCustomPrologue = addCustomPrologue; function startsWithUseStrict(statements) { var firstStatement = ts.firstOrUndefined(statements); return firstStatement !== undefined @@ -12692,13 +13785,23 @@ var ts; } } if (!foundUseStrict) { - return createNodeArray([ - startOnNewLine(createStatement(createLiteral("use strict"))) - ].concat(statements), statements); + return ts.setTextRange(ts.createNodeArray([ + startOnNewLine(ts.createStatement(ts.createLiteral("use strict"))) + ].concat(statements)), statements); } return statements; } ts.ensureUseStrict = ensureUseStrict; + function parenthesizeConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(194 /* ConditionalExpression */, 54 /* QuestionToken */); + var emittedCondition = skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { + return ts.createParen(condition); + } + return condition; + } + ts.parenthesizeConditionalHead = parenthesizeConditionalHead; /** * Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended * order of operations. @@ -12711,11 +13814,11 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 183 /* ParenthesizedExpression */) { + if (skipped.kind === 184 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) - ? createParen(operand) + ? ts.createParen(operand) : operand; } ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; @@ -12745,8 +13848,8 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(192 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(193 /* BinaryExpression */, binaryOperator); var emittedOperand = skipPartiallyEmittedExpressions(operand); var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { @@ -12755,7 +13858,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 195 /* YieldExpression */) { + && operand.kind === 196 /* YieldExpression */) { return false; } return true; @@ -12843,7 +13946,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -12858,11 +13961,11 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(193 /* ConditionalExpression */, 54 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(194 /* ConditionalExpression */, 54 /* QuestionToken */); var emittedCondition = skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { - return createParen(condition); + return ts.createParen(condition); } return condition; } @@ -12871,10 +13974,11 @@ var ts; // per ES grammar both 'whenTrue' and 'whenFalse' parts of conditional expression are assignment expressions // so in case when comma expression is introduced as a part of previous transformations // if should be wrapped in parens since comma operator has the lowest precedence - return e.kind === 192 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ - ? createParen(e) + return e.kind === 193 /* BinaryExpression */ && e.operatorToken.kind === 25 /* CommaToken */ + ? ts.createParen(e) : e; } + ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; /** * Wraps an expression in parentheses if it is needed in order to use the expression * as the expression of a NewExpression node. @@ -12884,12 +13988,12 @@ var ts; function parenthesizeForNew(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); switch (emittedExpression.kind) { - case 179 /* CallExpression */: - return createParen(expression); - case 180 /* NewExpression */: + case 180 /* CallExpression */: + return ts.createParen(expression); + case 181 /* NewExpression */: return emittedExpression.arguments ? expression - : createParen(expression); + : ts.createParen(expression); } return parenthesizeForAccess(expression); } @@ -12902,32 +14006,29 @@ var ts; */ function parenthesizeForAccess(expression) { // isLeftHandSideExpression is almost the correct criterion for when it is not necessary - // to parenthesize the expression before a dot. The known exceptions are: + // to parenthesize the expression before a dot. The known exception is: // // NewExpression: // new C.x -> not the same as (new C).x - // NumericLiteral - // 1.x -> not the same as (1).x // var emittedExpression = skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 180 /* NewExpression */ || emittedExpression.arguments) - && emittedExpression.kind !== 8 /* NumericLiteral */) { + && (emittedExpression.kind !== 181 /* NewExpression */ || emittedExpression.arguments)) { return expression; } - return createParen(expression, /*location*/ expression); + return ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeForAccess = parenthesizeForAccess; function parenthesizePostfixOperand(operand) { return ts.isLeftHandSideExpression(operand) ? operand - : createParen(operand, /*location*/ operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePostfixOperand = parenthesizePostfixOperand; function parenthesizePrefixOperand(operand) { return ts.isUnaryExpression(operand) ? operand - : createParen(operand, /*location*/ operand); + : ts.setTextRange(ts.createParen(operand), operand); } ts.parenthesizePrefixOperand = parenthesizePrefixOperand; function parenthesizeListElements(elements) { @@ -12942,17 +14043,18 @@ var ts; } } if (result !== undefined) { - return createNodeArray(result, elements, elements.hasTrailingComma); + return ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements); } return elements; } + ts.parenthesizeListElements = parenthesizeListElements; function parenthesizeExpressionForList(expression) { var emittedExpression = skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, 25 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(193 /* BinaryExpression */, 25 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression - : createParen(expression, /*location*/ expression); + : ts.setTextRange(ts.createParen(expression), expression); } ts.parenthesizeExpressionForList = parenthesizeExpressionForList; function parenthesizeExpressionForExpressionStatement(expression) { @@ -12960,16 +14062,16 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 184 /* FunctionExpression */ || kind === 185 /* ArrowFunction */) { - var mutableCall = getMutableClone(emittedExpression); - mutableCall.expression = createParen(callee, /*location*/ callee); + if (kind === 185 /* FunctionExpression */ || kind === 186 /* ArrowFunction */) { + var mutableCall = ts.getMutableClone(emittedExpression); + mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreatePartiallyEmittedExpressions(expression, mutableCall); } } else { var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 176 /* ObjectLiteralExpression */ || leftmostExpressionKind === 184 /* FunctionExpression */) { - return createParen(expression, /*location*/ expression); + if (leftmostExpressionKind === 177 /* ObjectLiteralExpression */ || leftmostExpressionKind === 185 /* FunctionExpression */) { + return ts.setTextRange(ts.createParen(expression), expression); } } return expression; @@ -12983,7 +14085,7 @@ var ts; */ function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) { if (ts.isPartiallyEmittedExpression(originalOuterExpression)) { - var clone_1 = getMutableClone(originalOuterExpression); + var clone_1 = ts.getMutableClone(originalOuterExpression); clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression); return clone_1; } @@ -12992,21 +14094,21 @@ var ts; function getLeftmostExpression(node) { while (true) { switch (node.kind) { - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: node = node.operand; continue; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: node = node.left; continue; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: node = node.condition; continue; - case 179 /* CallExpression */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: node = node.expression; continue; - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13014,9 +14116,8 @@ var ts; } } function parenthesizeConciseBody(body) { - var emittedBody = skipPartiallyEmittedExpressions(body); - if (emittedBody.kind === 176 /* ObjectLiteralExpression */) { - return createParen(body, /*location*/ body); + if (!ts.isBlock(body) && getLeftmostExpression(body).kind === 177 /* ObjectLiteralExpression */) { + return ts.setTextRange(ts.createParen(body), body); } return body; } @@ -13047,7 +14148,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */) { + while (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } return node; @@ -13061,7 +14162,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294 /* PartiallyEmittedExpression */) { + while (node.kind === 295 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13072,188 +14173,6 @@ var ts; return node; } ts.startOnNewLine = startOnNewLine; - function setOriginalNode(node, original) { - node.original = original; - if (original) { - var emitNode = original.emitNode; - if (emitNode) - node.emitNode = mergeEmitNode(emitNode, node.emitNode); - } - return node; - } - ts.setOriginalNode = setOriginalNode; - function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; - if (!destEmitNode) - destEmitNode = {}; - if (flags) - destEmitNode.flags = flags; - if (commentRange) - destEmitNode.commentRange = commentRange; - if (sourceMapRange) - destEmitNode.sourceMapRange = sourceMapRange; - if (tokenSourceMapRanges) - destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); - if (constantValue !== undefined) - destEmitNode.constantValue = constantValue; - if (helpers) - destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); - return destEmitNode; - } - function mergeTokenSourceMapRanges(sourceRanges, destRanges) { - if (!destRanges) - destRanges = ts.createMap(); - ts.copyProperties(sourceRanges, destRanges); - return destRanges; - } - /** - * Clears any EmitNode entries from parse-tree nodes. - * @param sourceFile A source file. - */ - function disposeEmitNodes(sourceFile) { - // During transformation we may need to annotate a parse tree node with transient - // transformation properties. As parse tree nodes live longer than transformation - // nodes, we need to make sure we reclaim any memory allocated for custom ranges - // from these nodes to ensure we do not hold onto entire subtrees just for position - // information. We also need to reset these nodes to a pre-transformation state - // for incremental parsing scenarios so that we do not impact later emit. - sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); - var emitNode = sourceFile && sourceFile.emitNode; - var annotatedNodes = emitNode && emitNode.annotatedNodes; - if (annotatedNodes) { - for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { - var node = annotatedNodes_1[_i]; - node.emitNode = undefined; - } - } - } - ts.disposeEmitNodes = disposeEmitNodes; - /** - * Associates a node with the current transformation, initializing - * various transient transformation properties. - * - * @param node The node. - */ - function getOrCreateEmitNode(node) { - if (!node.emitNode) { - if (ts.isParseTreeNode(node)) { - // To avoid holding onto transformation artifacts, we keep track of any - // parse tree node we are annotating. This allows us to clean them up after - // all transformations have completed. - if (node.kind === 261 /* SourceFile */) { - return node.emitNode = { annotatedNodes: [node] }; - } - var sourceFile = ts.getSourceFileOfNode(node); - getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); - } - node.emitNode = {}; - } - return node.emitNode; - } - ts.getOrCreateEmitNode = getOrCreateEmitNode; - /** - * Gets flags that control emit behavior of a node. - * - * @param node The node. - */ - function getEmitFlags(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.flags; - } - ts.getEmitFlags = getEmitFlags; - /** - * Sets flags that control emit behavior of a node. - * - * @param node The node. - * @param emitFlags The NodeEmitFlags for the node. - */ - function setEmitFlags(node, emitFlags) { - getOrCreateEmitNode(node).flags = emitFlags; - return node; - } - ts.setEmitFlags = setEmitFlags; - /** - * Gets a custom text range to use when emitting source maps. - * - * @param node The node. - */ - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; - } - ts.getSourceMapRange = getSourceMapRange; - /** - * Sets a custom text range to use when emitting source maps. - * - * @param node The node. - * @param range The text range. - */ - function setSourceMapRange(node, range) { - getOrCreateEmitNode(node).sourceMapRange = range; - return node; - } - ts.setSourceMapRange = setSourceMapRange; - /** - * Gets the TextRange to use for source maps for a token of a node. - * - * @param node The node. - * @param token The token. - */ - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; - /** - * Sets the TextRange to use for source maps for a token of a node. - * - * @param node The node. - * @param token The token. - * @param range The text range. - */ - function setTokenSourceMapRange(node, token, range) { - var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); - tokenSourceMapRanges[token] = range; - return node; - } - ts.setTokenSourceMapRange = setTokenSourceMapRange; - /** - * Gets a custom text range to use when emitting comments. - * - * @param node The node. - */ - function getCommentRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.commentRange) || node; - } - ts.getCommentRange = getCommentRange; - /** - * Sets a custom text range to use when emitting comments. - */ - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; - /** - * Gets the constant value to emit for an expression. - */ - function getConstantValue(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.constantValue; - } - ts.getConstantValue = getConstantValue; - /** - * Sets the constant value to emit for an expression. - */ - function setConstantValue(node, value) { - var emitNode = getOrCreateEmitNode(node); - emitNode.constantValue = value; - return node; - } - ts.setConstantValue = setConstantValue; function getExternalHelpersModuleName(node) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); var emitNode = parseNode && parseNode.emitNode; @@ -13266,143 +14185,34 @@ var ts; if (externalHelpersModuleName) { return externalHelpersModuleName; } - var helpers = getEmitHelpers(node); + var helpers = ts.getEmitHelpers(node); if (helpers) { - for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { - var helper = helpers_1[_i]; + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; if (!helper.scoped) { var parseNode = ts.getOriginalNode(node, ts.isSourceFile); - var emitNode = getOrCreateEmitNode(parseNode); - return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = createUniqueName(ts.externalHelpersModuleNameText)); + var emitNode = ts.getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)); } } } } } ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; - /** - * Adds an EmitHelper to a node. - */ - function addEmitHelper(node, helper) { - var emitNode = getOrCreateEmitNode(node); - emitNode.helpers = ts.append(emitNode.helpers, helper); - return node; - } - ts.addEmitHelper = addEmitHelper; - /** - * Adds an EmitHelper to a node. - */ - function addEmitHelpers(node, helpers) { - if (ts.some(helpers)) { - var emitNode = getOrCreateEmitNode(node); - for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { - var helper = helpers_2[_i]; - if (!ts.contains(emitNode.helpers, helper)) { - emitNode.helpers = ts.append(emitNode.helpers, helper); - } - } - } - return node; - } - ts.addEmitHelpers = addEmitHelpers; - /** - * Removes an EmitHelper from a node. - */ - function removeEmitHelper(node, helper) { - var emitNode = node.emitNode; - if (emitNode) { - var helpers = emitNode.helpers; - if (helpers) { - return ts.orderedRemoveItem(helpers, helper); - } - } - return false; - } - ts.removeEmitHelper = removeEmitHelper; - /** - * Gets the EmitHelpers of a node. - */ - function getEmitHelpers(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.helpers; - } - ts.getEmitHelpers = getEmitHelpers; - /** - * Moves matching emit helpers from a source node to a target node. - */ - function moveEmitHelpers(source, target, predicate) { - var sourceEmitNode = source.emitNode; - var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; - if (!ts.some(sourceEmitHelpers)) - return; - var targetEmitNode = getOrCreateEmitNode(target); - var helpersRemoved = 0; - for (var i = 0; i < sourceEmitHelpers.length; i++) { - var helper = sourceEmitHelpers[i]; - if (predicate(helper)) { - helpersRemoved++; - if (!ts.contains(targetEmitNode.helpers, helper)) { - targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); - } - } - else if (helpersRemoved > 0) { - sourceEmitHelpers[i - helpersRemoved] = helper; - } - } - if (helpersRemoved > 0) { - sourceEmitHelpers.length -= helpersRemoved; - } - } - ts.moveEmitHelpers = moveEmitHelpers; - function compareEmitHelpers(x, y) { - if (x === y) - return 0 /* EqualTo */; - if (x.priority === y.priority) - return 0 /* EqualTo */; - if (x.priority === undefined) - return 1 /* GreaterThan */; - if (y.priority === undefined) - return -1 /* LessThan */; - return ts.compareValues(x.priority, y.priority); - } - ts.compareEmitHelpers = compareEmitHelpers; - function setTextRange(node, location) { - if (location) { - node.pos = location.pos; - node.end = location.end; - } - return node; - } - ts.setTextRange = setTextRange; - function setNodeFlags(node, flags) { - node.flags = flags; - return node; - } - ts.setNodeFlags = setNodeFlags; - function setMultiLine(node, multiLine) { - node.multiLine = multiLine; - return node; - } - ts.setMultiLine = setMultiLine; - function setHasTrailingComma(nodes, hasTrailingComma) { - nodes.hasTrailingComma = hasTrailingComma; - return nodes; - } - ts.setHasTrailingComma = setHasTrailingComma; /** * Get the name of that target module from an import or export declaration */ function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_9 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 /* ImportDeclaration */ && node.importClause) { - return getGeneratedNameForNode(node); + if (node.kind === 237 /* ImportDeclaration */ && node.importClause) { + return ts.getGeneratedNameForNode(node); } - if (node.kind === 241 /* ExportDeclaration */ && node.moduleSpecifier) { - return getGeneratedNameForNode(node); + if (node.kind === 243 /* ExportDeclaration */ && node.moduleSpecifier) { + return ts.getGeneratedNameForNode(node); } return undefined; } @@ -13420,7 +14230,7 @@ var ts; if (moduleName.kind === 9 /* StringLiteral */) { return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) || tryRenameExternalModule(moduleName, sourceFile) - || getSynthesizedClone(moduleName); + || ts.getSynthesizedClone(moduleName); } return undefined; } @@ -13430,10 +14240,8 @@ var ts; * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName, sourceFile) { - if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && ts.createLiteral(rename); } /** * Get the name of a module as should be written in the emitted output. @@ -13447,10 +14255,10 @@ var ts; return undefined; } if (file.moduleName) { - return createLiteral(file.moduleName); + return ts.createLiteral(file.moduleName); } if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) { - return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); + return ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); } return undefined; } @@ -13521,7 +14329,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -13533,11 +14341,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -13569,12 +14377,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 144 /* Parameter */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 175 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 196 /* SpreadElement */: - case 259 /* SpreadAssignment */: + case 197 /* SpreadElement */: + case 262 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -13586,7 +14394,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -13598,7 +14406,7 @@ var ts; : propertyName; } break; - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -13610,7 +14418,7 @@ var ts; : propertyName; } break; - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -13628,13 +14436,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -13644,10 +14452,12 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpread(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); } var expression = convertToAssignmentElementTarget(element.name); - return element.initializer ? setOriginalNode(createAssignment(expression, element.initializer, element), element) : expression; + return element.initializer + ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) + : expression; } ts.Debug.assertNode(element, ts.isExpression); return element; @@ -13657,14 +14467,14 @@ var ts; if (ts.isBindingElement(element)) { if (element.dotDotDotToken) { ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createSpreadAssignment(element.name, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); } if (element.propertyName) { var expression = convertToAssignmentElementTarget(element.name); - return setOriginalNode(createPropertyAssignment(element.propertyName, element.initializer ? createAssignment(expression, element.initializer) : expression, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element); } ts.Debug.assertNode(element.name, ts.isIdentifier); - return setOriginalNode(createShorthandPropertyAssignment(element.name, element.initializer, element), element); + return ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element); } ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); return element; @@ -13672,18 +14482,18 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 173 /* ArrayBindingPattern */: - case 175 /* ArrayLiteralExpression */: + case 174 /* ArrayBindingPattern */: + case 176 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 172 /* ObjectBindingPattern */: - case 176 /* ObjectLiteralExpression */: + case 173 /* ObjectBindingPattern */: + case 177 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } ts.convertToAssignmentPattern = convertToAssignmentPattern; function convertToObjectAssignmentPattern(node) { if (ts.isObjectBindingPattern(node)) { - return setOriginalNode(createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isObjectLiteralExpression); return node; @@ -13691,7 +14501,7 @@ var ts; ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; function convertToArrayAssignmentPattern(node) { if (ts.isArrayBindingPattern(node)) { - return setOriginalNode(createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement), node), node); + return ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node); } ts.Debug.assertNode(node, ts.isArrayLiteralExpression); return node; @@ -13707,37 +14517,37 @@ var ts; ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { var externalImports = []; - var exportSpecifiers = ts.createMap(); - var exportedBindings = ts.createMap(); + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; var uniqueExports = ts.createMap(); var exportedNames; var hasExportDefault = false; var exportEquals = undefined; var hasExportStarsToExportValues = false; var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions); - var externalHelpersImportDeclaration = externalHelpersModuleName && createImportDeclaration( + var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration( /*decorators*/ undefined, - /*modifiers*/ undefined, createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)), createLiteral(ts.externalHelpersModuleNameText)); + /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); if (externalHelpersImportDeclaration) { externalImports.push(externalHelpersImportDeclaration); } for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); break; - case 234 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + case 236 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -13753,27 +14563,27 @@ var ts; // export { x, y } for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; - if (!uniqueExports[specifier.name.text]) { - var name_10 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_10.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_10) - || resolver.getReferencedValueDeclaration(name_10); + if (!uniqueExports.get(specifier.name.text)) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(name.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); if (decl) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = ts.append(exportedNames, specifier.name); } } } break; - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13781,42 +14591,42 @@ var ts; } } break; - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export function x() { } - var name_11 = node.name; - if (!uniqueExports[name_11.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_11); - uniqueExports[name_11.text] = true; - exportedNames = ts.append(exportedNames, name_11); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } break; - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } if (!hasExportDefault) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } else { // export class x { } - var name_12 = node.name; - if (!uniqueExports[name_12.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); - uniqueExports[name_12.text] = true; - exportedNames = ts.append(exportedNames, name_12); + var name = node.name; + if (!uniqueExports.get(name.text)) { + multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); + uniqueExports.set(name.text, true); + exportedNames = ts.append(exportedNames, name); } } } @@ -13836,13 +14646,24 @@ var ts; } } else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = ts.append(exportedNames, decl.name); } } return exportedNames; } + /** Use a sparse array as a multi-map. */ + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } })(ts || (ts = {})); /// /// @@ -13854,13 +14675,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261 /* SourceFile */) { + if (kind === 264 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70 /* Identifier */) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 141 /* FirstNode */) { + else if (kind < 142 /* FirstNode */) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -13903,28 +14724,29 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: return visitNode(cbNode, node.expression); - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* PropertyAssignment */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -13933,24 +14755,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -13961,320 +14783,326 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 163 /* TupleType */: + case 164 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return visitNode(cbNode, node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 170 /* MappedType */: + case 171 /* MappedType */: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return visitNode(cbNode, node.literal); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 200 /* AsExpression */: + case 201 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 193 /* ConditionalExpression */: + case 203 /* MetaProperty */: + return visitNode(cbNode, node.name); + case 194 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 261 /* SourceFile */: + case 264 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213 /* ForOfStatement */: - return visitNode(cbNode, node.initializer) || + case 215 /* ForOfStatement */: + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return visitNode(cbNode, node.label); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 253 /* CaseClause */: + case 256 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254 /* DefaultClause */: + case 257 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 145 /* Decorator */: + case 146 /* Decorator */: return visitNode(cbNode, node.expression); - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 260 /* EnumMember */: + case 263 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236 /* ImportClause */: + case 238 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202 /* TemplateSpan */: + case 204 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 244 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 246 /* JsxElement */: + case 248 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || - visitNodes(cbNodes, node.attributes); - case 250 /* JsxAttribute */: + visitNode(cbNode, node.attributes); + case 253 /* JsxAttributes */: + return visitNodes(cbNodes, node.properties); + case 252 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251 /* JsxSpreadAttribute */: + case 254 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 252 /* JsxExpression */: - return visitNode(cbNode, node.expression); - case 249 /* JsxClosingElement */: + case 255 /* JsxExpression */: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 251 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 262 /* JSDocTypeExpression */: + case 266 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 266 /* JSDocUnionType */: + case 270 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 267 /* JSDocTupleType */: + case 271 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 265 /* JSDocArrayType */: + case 269 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 269 /* JSDocNonNullableType */: + case 273 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 268 /* JSDocNullableType */: + case 272 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 270 /* JSDocRecordType */: + case 274 /* JSDocRecordType */: return visitNode(cbNode, node.literal); - case 272 /* JSDocTypeReference */: + case 276 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273 /* JSDocOptionalType */: + case 277 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 274 /* JSDocFunctionType */: + case 278 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275 /* JSDocVariadicType */: + case 279 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 276 /* JSDocConstructorType */: + case 280 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 277 /* JSDocThisType */: + case 281 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 271 /* JSDocRecordMember */: + case 275 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278 /* JSDocComment */: + case 282 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 281 /* JSDocParameterTag */: + case 285 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282 /* JSDocReturnTag */: + case 286 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 283 /* JSDocTypeTag */: + case 287 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 280 /* JSDocAugmentsTag */: + case 284 /* JSDocAugmentsTag */: return visitNode(cbNode, node.typeExpression); - case 284 /* JSDocTemplateTag */: + case 288 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287 /* JSDocTypeLiteral */: + case 291 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286 /* JSDocPropertyTag */: + case 290 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 288 /* JSDocLiteralType */: + case 292 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14292,6 +15120,7 @@ var ts; return Parser.parseIsolatedEntityName(text, languageVersion); } ts.parseIsolatedEntityName = parseIsolatedEntityName; + // See also `isExternalOrCommonJsModule` in utilities.ts function isExternalModule(file) { return file.externalModuleIndicator !== undefined; } @@ -14334,7 +15163,7 @@ var ts; // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true); - var disallowInAndDecoratorContext = 65536 /* DisallowInContext */ | 262144 /* DecoratorContext */; + var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks var NodeConstructor; var TokenConstructor; @@ -14458,7 +15287,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 2097152 /* JavaScriptFile */ : 0 /* None */; + contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 65536 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); @@ -14546,7 +15375,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(261 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(264 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14566,16 +15395,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 65536 /* DisallowInContext */); + setContextFlag(val, 2048 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 131072 /* YieldContext */); + setContextFlag(val, 4096 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 262144 /* DecoratorContext */); + setContextFlag(val, 8192 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 524288 /* AwaitContext */); + setContextFlag(val, 16384 /* AwaitContext */); } function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are @@ -14616,40 +15445,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(65536 /* DisallowInContext */, func); + return doOutsideOfContext(2048 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(65536 /* DisallowInContext */, func); + return doInsideOfContext(2048 /* DisallowInContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(131072 /* YieldContext */, func); + return doInsideOfContext(4096 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(262144 /* DecoratorContext */, func); + return doInsideOfContext(8192 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(524288 /* AwaitContext */, func); + return doInsideOfContext(16384 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(524288 /* AwaitContext */, func); + return doOutsideOfContext(16384 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(131072 /* YieldContext */ | 524288 /* AwaitContext */, func); + return doInsideOfContext(4096 /* YieldContext */ | 16384 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(131072 /* YieldContext */); + return inContext(4096 /* YieldContext */); } function inDisallowInContext() { - return inContext(65536 /* DisallowInContext */); + return inContext(2048 /* DisallowInContext */); } function inDecoratorContext() { - return inContext(262144 /* DecoratorContext */); + return inContext(8192 /* DecoratorContext */); } function inAwaitContext() { - return inContext(524288 /* AwaitContext */); + return inContext(16384 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -14830,7 +15659,7 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 141 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : + return kind >= 142 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : kind === 70 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } @@ -14853,7 +15682,7 @@ var ts; // flag so that we don't mark any subsequent nodes. if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 1048576 /* ThisNodeHasError */; + node.flags |= 32768 /* ThisNodeHasError */; } return node; } @@ -14870,7 +15699,11 @@ var ts; } function internIdentifier(text) { text = ts.escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + var identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues // with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for @@ -14922,7 +15755,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(142 /* ComputedPropertyName */); + var node = createNode(143 /* ComputedPropertyName */); parseExpected(20 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -14975,6 +15808,7 @@ var ts; function nextTokenIsClassOrFunctionOrAsync() { nextToken(); return token() === 74 /* ClassKeyword */ || token() === 88 /* FunctionKeyword */ || + (token() === 116 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || (token() === 119 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element @@ -15015,7 +15849,7 @@ var ts; case 9 /* ObjectBindingElements */: return token() === 20 /* OpenBracketToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName(); case 7 /* HeritageClauseElement */: - // If we see { } then only consume it as an expression if it is followed by , or { + // If we see `{ ... }` then only consume it as an expression if it is followed by `,` or `{` // That way we won't consume the body of a class in its heritage clause. if (token() === 16 /* OpenBraceToken */) { return lookAhead(isValidHeritageClauseObjectLiteral); @@ -15247,7 +16081,7 @@ var ts; // differently depending on what mode it is in. // // This also applies to all our other context flags as well. - var nodeContextFlags = node.flags & 3080192 /* ContextFlags */; + var nodeContextFlags = node.flags & 96256 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -15329,14 +16163,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 150 /* Constructor */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 147 /* PropertyDeclaration */: - case 203 /* SemicolonClassElement */: + case 151 /* Constructor */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 205 /* SemicolonClassElement */: return true; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. @@ -15351,8 +16185,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 256 /* CaseClause */: + case 257 /* DefaultClause */: return true; } } @@ -15361,58 +16195,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 205 /* VariableStatement */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 207 /* ExpressionStatement */: - case 220 /* ThrowStatement */: - case 216 /* ReturnStatement */: - case 218 /* SwitchStatement */: - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 206 /* EmptyStatement */: - case 221 /* TryStatement */: - case 219 /* LabeledStatement */: - case 209 /* DoStatement */: - case 222 /* DebuggerStatement */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 207 /* VariableStatement */: + case 206 /* Block */: + case 210 /* IfStatement */: + case 209 /* ExpressionStatement */: + case 222 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 220 /* SwitchStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 208 /* EmptyStatement */: + case 223 /* TryStatement */: + case 221 /* LabeledStatement */: + case 211 /* DoStatement */: + case 224 /* DebuggerStatement */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 263 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 154 /* ConstructSignature */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 146 /* PropertySignature */: - case 153 /* CallSignature */: + case 155 /* ConstructSignature */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 147 /* PropertySignature */: + case 154 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223 /* VariableDeclaration */) { + if (node.kind !== 225 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -15433,7 +16267,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 144 /* Parameter */) { + if (node.kind !== 145 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -15480,7 +16314,6 @@ var ts; case 25 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected; } } - ; // Parses a comma-delimited list of elements function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; @@ -15546,7 +16379,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(22 /* DotToken */)) { - var node = createNode(141 /* QualifiedName */, entity.pos); // !!! + var node = createNode(142 /* QualifiedName */, entity.pos); // !!! node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -15585,7 +16418,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(194 /* TemplateExpression */); + var template = createNode(195 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 13 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = createNodeArray(); @@ -15597,7 +16430,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202 /* TemplateSpan */); + var span = createNode(204 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17 /* CloseBraceToken */) { @@ -15633,27 +16466,23 @@ var ts; if (scanner.isUnterminated()) { node.isUnterminated = true; } - var tokenPos = scanner.getTokenPos(); - nextToken(); - finishNode(node); // Octal literals are not allowed in strict mode or ES5 // Note that theoretically the following condition would hold true literals like 009, // which is not octal.But because of how the scanner separates the tokens, we would // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. // We also do not need to check for negatives because any prefix operator would be part of a // parent unary expression. - if (node.kind === 8 /* NumericLiteral */ - && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.isOctalLiteral = true; + if (node.kind === 8 /* NumericLiteral */) { + node.numericLiteralFlags = scanner.getNumericLiteralFlags(); } + nextToken(); + finishNode(node); return node; } // TYPES function parseTypeReference() { - var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - var node = createNode(157 /* TypeReference */, typeName.pos); - node.typeName = typeName; + var node = createNode(158 /* TypeReference */); + node.typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); } @@ -15661,24 +16490,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(156 /* TypePredicate */, lhs.pos); + var node = createNode(157 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(167 /* ThisType */); + var node = createNode(168 /* ThisType */); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(160 /* TypeQuery */); + var node = createNode(161 /* TypeQuery */); parseExpected(102 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(84 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -15699,6 +16528,9 @@ var ts; node.expression = parseUnaryExpressionOrHigher(); } } + if (parseOptional(57 /* EqualsToken */)) { + node.default = parseType(); + } return finishNode(node); } function parseTypeParameters() { @@ -15716,9 +16548,9 @@ var ts; return token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 /* AtToken */ || token() === 98 /* ThisKeyword */; } function parseParameter() { - var node = createNode(144 /* Parameter */); + var node = createNode(145 /* Parameter */); if (token() === 98 /* ThisKeyword */) { - node.name = createIdentifier(/*isIdentifier*/ true, undefined); + node.name = createIdentifier(/*isIdentifier*/ true); node.type = parseParameterType(); return finishNode(node); } @@ -15815,7 +16647,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 154 /* ConstructSignature */) { + if (kind === 155 /* ConstructSignature */) { parseExpected(93 /* NewKeyword */); } fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -15879,7 +16711,7 @@ var ts; return token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || token() === 21 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(155 /* IndexSignature */, fullStart); + var node = createNode(156 /* IndexSignature */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); @@ -15891,7 +16723,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(54 /* QuestionToken */); if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - var method = createNode(148 /* MethodSignature */, fullStart); + var method = createNode(149 /* MethodSignature */, fullStart); method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; @@ -15902,7 +16734,7 @@ var ts; return addJSDocComment(finishNode(method)); } else { - var property = createNode(146 /* PropertySignature */, fullStart); + var property = createNode(147 /* PropertySignature */, fullStart); property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; @@ -15918,14 +16750,14 @@ var ts; } } function isTypeMemberStart() { - var idToken; // Return true if we have the start of a signature member if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { return true; } + var idToken; // Eat up all modifiers, but hold on to the last one in case it is actually an identifier while (ts.isModifierKind(token())) { - idToken = token(); + idToken = true; nextToken(); } // Index signatures and computed property names are type members @@ -15934,7 +16766,7 @@ var ts; } // Try to get the first property-like token following all modifiers if (isLiteralPropertyName()) { - idToken = token(); + idToken = true; nextToken(); } // If we were able to get any potential identifier, check that it is @@ -15951,10 +16783,10 @@ var ts; } function parseTypeMember() { if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { - return parseSignatureMember(153 /* CallSignature */); + return parseSignatureMember(154 /* CallSignature */); } if (token() === 93 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(154 /* ConstructSignature */); + return parseSignatureMember(155 /* ConstructSignature */); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -15968,7 +16800,7 @@ var ts; return token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(161 /* TypeLiteral */); + var node = createNode(162 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -15991,14 +16823,14 @@ var ts; return token() === 20 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 91 /* InKeyword */; } function parseMappedTypeParameter() { - var node = createNode(143 /* TypeParameter */); + var node = createNode(144 /* TypeParameter */); node.name = parseIdentifier(); parseExpected(91 /* InKeyword */); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(170 /* MappedType */); + var node = createNode(171 /* MappedType */); parseExpected(16 /* OpenBraceToken */); node.readonlyToken = parseOptionalToken(130 /* ReadonlyKeyword */); parseExpected(20 /* OpenBracketToken */); @@ -16011,12 +16843,12 @@ var ts; return finishNode(node); } function parseTupleType() { - var node = createNode(163 /* TupleType */); + var node = createNode(164 /* TupleType */); node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(166 /* ParenthesizedType */); + var node = createNode(167 /* ParenthesizedType */); parseExpected(18 /* OpenParenToken */); node.type = parseType(); parseExpected(19 /* CloseParenToken */); @@ -16024,7 +16856,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 159 /* ConstructorType */) { + if (kind === 160 /* ConstructorType */) { parseExpected(93 /* NewKeyword */); } fillSignature(35 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -16035,7 +16867,7 @@ var ts; return token() === 22 /* DotToken */ ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(171 /* LiteralType */); + var node = createNode(172 /* LiteralType */); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -16046,12 +16878,13 @@ var ts; function parseNonArrayType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: - case 137 /* UndefinedKeyword */: + case 136 /* SymbolKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -16089,12 +16922,12 @@ var ts; function isStartOfType() { switch (token()) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 98 /* ThisKeyword */: case 102 /* TypeOfKeyword */: @@ -16102,11 +16935,14 @@ var ts; case 16 /* OpenBraceToken */: case 20 /* OpenBracketToken */: case 26 /* LessThanToken */: + case 48 /* BarToken */: + case 47 /* AmpersandToken */: case 93 /* NewKeyword */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: + case 133 /* ObjectKeyword */: return true; case 37 /* MinusToken */: return lookAhead(nextTokenIsNumericLiteral); @@ -16126,14 +16962,14 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(20 /* OpenBracketToken */)) { if (isStartOfType()) { - var node = createNode(169 /* IndexedAccessType */, type.pos); + var node = createNode(170 /* IndexedAccessType */, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(21 /* CloseBracketToken */); type = finishNode(node); } else { - var node = createNode(162 /* ArrayType */, type.pos); + var node = createNode(163 /* ArrayType */, type.pos); node.elementType = type; parseExpected(21 /* CloseBracketToken */); type = finishNode(node); @@ -16142,7 +16978,7 @@ var ts; return type; } function parseTypeOperator(operator) { - var node = createNode(168 /* TypeOperator */); + var node = createNode(169 /* TypeOperator */); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); @@ -16156,6 +16992,7 @@ var ts; return parseArrayTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { var types = createNodeArray([type], type.pos); @@ -16170,10 +17007,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(165 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); + return parseUnionOrIntersectionType(166 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(164 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); + return parseUnionOrIntersectionType(165 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); } function isStartOfFunctionType() { if (token() === 26 /* LessThanToken */) { @@ -16230,7 +17067,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(156 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(157 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -16249,14 +17086,14 @@ var ts; function parseType() { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - return doOutsideOfContext(655360 /* TypeExcludesFlags */, parseTypeWorker); + return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(158 /* FunctionType */); + return parseFunctionOrConstructorType(159 /* FunctionType */); } if (token() === 93 /* NewKeyword */) { - return parseFunctionOrConstructorType(159 /* ConstructorType */); + return parseFunctionOrConstructorType(160 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -16457,7 +17294,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(195 /* YieldExpression */); + var node = createNode(196 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -16479,13 +17316,13 @@ var ts; ts.Debug.assert(token() === 35 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(185 /* ArrowFunction */, asyncModifier.pos); + node = createNode(186 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(185 /* ArrowFunction */, identifier.pos); + node = createNode(186 /* ArrowFunction */, identifier.pos); } - var parameter = createNode(144 /* Parameter */, identifier.pos); + var parameter = createNode(145 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos); @@ -16667,7 +17504,7 @@ var ts; return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(185 /* ArrowFunction */); + var node = createNode(186 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */); // Arrow functions are never generators. @@ -16733,7 +17570,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(193 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(194 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -16746,7 +17583,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 91 /* InKeyword */ || t === 140 /* OfKeyword */; + return t === 91 /* InKeyword */ || t === 141 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -16854,39 +17691,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(192 /* BinaryExpression */, left.pos); + var node = createNode(193 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(200 /* AsExpression */, left.pos); + var node = createNode(201 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(186 /* DeleteExpression */); + var node = createNode(187 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(187 /* TypeOfExpression */); + var node = createNode(188 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(188 /* VoidExpression */); + var node = createNode(189 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -16902,7 +17739,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(189 /* AwaitExpression */); + var node = createNode(190 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -16945,7 +17782,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token() === 39 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 182 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 183 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -16990,6 +17827,7 @@ var ts; if (isAwaitExpression()) { return parseAwaitExpression(); } + // falls through default: return parseIncrementExpression(); } @@ -17023,7 +17861,7 @@ var ts; return false; } // We are in JSX context and the token is part of JSXElement. - // Fall through + // falls through default: return true; } @@ -17041,7 +17879,7 @@ var ts; */ function parseIncrementExpression() { if (token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) { - var node = createNode(190 /* PrefixUnaryExpression */); + var node = createNode(191 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -17054,7 +17892,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(191 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(192 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -17158,7 +17996,7 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(177 /* PropertyAccessExpression */, expression.pos); + var node = createNode(178 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(22 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -17183,8 +18021,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248 /* JsxOpeningElement */) { - var node = createNode(246 /* JsxElement */, opening.pos); + if (opening.kind === 250 /* JsxOpeningElement */) { + var node = createNode(248 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17194,7 +18032,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 249 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17209,7 +18047,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(192 /* BinaryExpression */, result.pos); + var badNode = createNode(193 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -17252,23 +18090,31 @@ var ts; parseErrorAtPosition(openingTagName.pos, openingTagName.end - openingTagName.pos, ts.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, ts.getTextOfNodeFromSourceText(sourceText, openingTagName)); break; } + else if (token() === 7 /* ConflictMarkerTrivia */) { + break; + } result.push(parseJsxChild()); } result.end = scanner.getTokenPos(); parsingContext = saveParsingContext; return result; } + function parseJsxAttributes() { + var jsxAttributes = createNode(253 /* JsxAttributes */); + jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); + return finishNode(jsxAttributes); + } function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); parseExpected(26 /* LessThanToken */); var tagName = parseJsxElementName(); - var attributes = parseList(13 /* JsxAttributes */, parseJsxAttribute); + var attributes = parseJsxAttributes(); var node; if (token() === 28 /* GreaterThanToken */) { // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(248 /* JsxOpeningElement */, fullStart); + node = createNode(250 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17280,7 +18126,7 @@ var ts; parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(247 /* JsxSelfClosingElement */, fullStart); + node = createNode(249 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -17296,7 +18142,7 @@ var ts; var expression = token() === 98 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(22 /* DotToken */)) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17304,9 +18150,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252 /* JsxExpression */); + var node = createNode(255 /* JsxExpression */); parseExpected(16 /* OpenBraceToken */); if (token() !== 17 /* CloseBraceToken */) { + node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -17323,7 +18170,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250 /* JsxAttribute */); + var node = createNode(252 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 57 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -17338,7 +18185,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251 /* JsxSpreadAttribute */); + var node = createNode(254 /* JsxSpreadAttribute */); parseExpected(16 /* OpenBraceToken */); parseExpected(23 /* DotDotDotToken */); node.expression = parseExpression(); @@ -17346,7 +18193,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249 /* JsxClosingElement */); + var node = createNode(251 /* JsxClosingElement */); parseExpected(27 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -17359,7 +18206,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(182 /* TypeAssertionExpression */); + var node = createNode(183 /* TypeAssertionExpression */); parseExpected(26 /* LessThanToken */); node.type = parseType(); parseExpected(28 /* GreaterThanToken */); @@ -17370,7 +18217,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(22 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(178 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -17378,14 +18225,14 @@ var ts; } if (token() === 50 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(201 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(202 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(20 /* OpenBracketToken */)) { - var indexedAccess = createNode(178 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(179 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -17401,7 +18248,7 @@ var ts; continue; } if (token() === 12 /* NoSubstitutionTemplateLiteral */ || token() === 13 /* TemplateHead */) { - var tagExpression = createNode(181 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(182 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token() === 12 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -17424,7 +18271,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -17432,7 +18279,7 @@ var ts; continue; } else if (token() === 18 /* OpenParenToken */) { - var callExpr = createNode(179 /* CallExpression */, expression.pos); + var callExpr = createNode(180 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -17542,28 +18389,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(183 /* ParenthesizedExpression */); + var node = createNode(184 /* ParenthesizedExpression */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(196 /* SpreadElement */); + var node = createNode(197 /* SpreadElement */); parseExpected(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 23 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 25 /* CommaToken */ ? createNode(198 /* OmittedExpression */) : + token() === 25 /* CommaToken */ ? createNode(199 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(175 /* ArrayLiteralExpression */); + var node = createNode(176 /* ArrayLiteralExpression */); parseExpected(20 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17574,10 +18421,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(124 /* GetKeyword */)) { - return parseAccessorDeclaration(151 /* GetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(152 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(133 /* SetKeyword */)) { - return parseAccessorDeclaration(152 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(134 /* SetKeyword */)) { + return parseAccessorDeclaration(153 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -17585,7 +18432,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(259 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(262 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -17610,7 +18457,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(261 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57 /* EqualsToken */); @@ -17621,7 +18468,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(260 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -17631,7 +18478,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(176 /* ObjectLiteralExpression */); + var node = createNode(177 /* ObjectLiteralExpression */); parseExpected(16 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17650,7 +18497,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNode(184 /* FunctionExpression */); + var node = createNode(185 /* FunctionExpression */); node.modifiers = parseModifiers(); parseExpected(88 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */); @@ -17672,8 +18519,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180 /* NewExpression */); + var fullStart = scanner.getStartPos(); parseExpected(93 /* NewKeyword */); + if (parseOptional(22 /* DotToken */)) { + var node_1 = createNode(203 /* MetaProperty */, fullStart); + node_1.keywordToken = 93 /* NewKeyword */; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(181 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18 /* OpenParenToken */) { @@ -17683,7 +18537,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204 /* Block */); + var node = createNode(206 /* Block */); if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17716,12 +18570,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206 /* EmptyStatement */); + var node = createNode(208 /* EmptyStatement */); parseExpected(24 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(208 /* IfStatement */); + var node = createNode(210 /* IfStatement */); parseExpected(89 /* IfKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17731,7 +18585,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209 /* DoStatement */); + var node = createNode(211 /* DoStatement */); parseExpected(80 /* DoKeyword */); node.statement = parseStatement(); parseExpected(105 /* WhileKeyword */); @@ -17746,7 +18600,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210 /* WhileStatement */); + var node = createNode(212 /* WhileStatement */); parseExpected(105 /* WhileKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17757,6 +18611,7 @@ var ts; function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(87 /* ForKeyword */); + var awaitToken = parseOptionalToken(120 /* AwaitKeyword */); parseExpected(18 /* OpenParenToken */); var initializer = undefined; if (token() !== 24 /* SemicolonToken */) { @@ -17768,22 +18623,23 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(91 /* InKeyword */)) { - var forInStatement = createNode(212 /* ForInStatement */, pos); - forInStatement.initializer = initializer; - forInStatement.expression = allowInAnd(parseExpression); - parseExpected(19 /* CloseParenToken */); - forOrForInOrForOfStatement = forInStatement; - } - else if (parseOptional(140 /* OfKeyword */)) { - var forOfStatement = createNode(213 /* ForOfStatement */, pos); + if (awaitToken ? parseExpected(141 /* OfKeyword */) : parseOptional(141 /* OfKeyword */)) { + var forOfStatement = createNode(215 /* ForOfStatement */, pos); + forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } + else if (parseOptional(91 /* InKeyword */)) { + var forInStatement = createNode(214 /* ForInStatement */, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(19 /* CloseParenToken */); + forOrForInOrForOfStatement = forInStatement; + } else { - var forStatement = createNode(211 /* ForStatement */, pos); + var forStatement = createNode(213 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(24 /* SemicolonToken */); if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) { @@ -17801,7 +18657,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); + parseExpected(kind === 217 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -17809,7 +18665,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216 /* ReturnStatement */); + var node = createNode(218 /* ReturnStatement */); parseExpected(95 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -17818,7 +18674,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217 /* WithStatement */); + var node = createNode(219 /* WithStatement */); parseExpected(106 /* WithKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17827,7 +18683,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253 /* CaseClause */); + var node = createNode(256 /* CaseClause */); parseExpected(72 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(55 /* ColonToken */); @@ -17835,7 +18691,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254 /* DefaultClause */); + var node = createNode(257 /* DefaultClause */); parseExpected(78 /* DefaultKeyword */); parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -17845,12 +18701,12 @@ var ts; return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218 /* SwitchStatement */); + var node = createNode(220 /* SwitchStatement */); parseExpected(97 /* SwitchKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); - var caseBlock = createNode(232 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(234 /* CaseBlock */, scanner.getStartPos()); parseExpected(16 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(17 /* CloseBraceToken */); @@ -17865,7 +18721,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(220 /* ThrowStatement */); + var node = createNode(222 /* ThrowStatement */); parseExpected(99 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -17873,7 +18729,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(221 /* TryStatement */); + var node = createNode(223 /* TryStatement */); parseExpected(101 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -17886,7 +18742,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256 /* CatchClause */); + var result = createNode(259 /* CatchClause */); parseExpected(73 /* CatchKeyword */); if (parseExpected(18 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17896,7 +18752,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222 /* DebuggerStatement */); + var node = createNode(224 /* DebuggerStatement */); parseExpected(77 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -17908,13 +18764,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) { - var labeledStatement = createNode(219 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(221 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(209 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -17924,6 +18780,10 @@ var ts; nextToken(); return ts.tokenIsIdentifierOrKeyword(token()) && !scanner.hasPrecedingLineBreak(); } + function nextTokenIsClassKeywordOnSameLine() { + nextToken(); + return token() === 74 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak(); + } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); return token() === 88 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); @@ -17964,7 +18824,7 @@ var ts; // // could be legal, it would add complexity for very little gain. case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: @@ -17982,7 +18842,7 @@ var ts; return false; } continue; - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: nextToken(); return token() === 16 /* OpenBraceToken */ || token() === 70 /* Identifier */ || token() === 83 /* ExportKeyword */; case 90 /* ImportKeyword */: @@ -18044,8 +18904,8 @@ var ts; case 108 /* InterfaceKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: - case 136 /* TypeKeyword */: - case 139 /* GlobalKeyword */: + case 137 /* TypeKeyword */: + case 140 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 113 /* PublicKeyword */: @@ -18095,9 +18955,9 @@ var ts; case 87 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 76 /* ContinueKeyword */: - return parseBreakOrContinueStatement(214 /* ContinueStatement */); + return parseBreakOrContinueStatement(216 /* ContinueStatement */); case 71 /* BreakKeyword */: - return parseBreakOrContinueStatement(215 /* BreakStatement */); + return parseBreakOrContinueStatement(217 /* BreakStatement */); case 95 /* ReturnKeyword */: return parseReturnStatement(); case 106 /* WithKeyword */: @@ -18117,7 +18977,7 @@ var ts; return parseDeclaration(); case 119 /* AsyncKeyword */: case 108 /* InterfaceKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: case 123 /* DeclareKeyword */: @@ -18131,7 +18991,7 @@ var ts; case 116 /* AbstractKeyword */: case 114 /* StaticKeyword */: case 130 /* ReadonlyKeyword */: - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -18154,11 +19014,11 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 108 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 82 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 139 /* GlobalKeyword */: + case 140 /* GlobalKeyword */: case 127 /* ModuleKeyword */: case 128 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -18179,7 +19039,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(244 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(246 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -18201,16 +19061,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 25 /* CommaToken */) { - return createNode(198 /* OmittedExpression */); + return createNode(199 /* OmittedExpression */); } - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(174 /* BindingElement */); + var node = createNode(175 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -18226,14 +19086,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(172 /* ObjectBindingPattern */); + var node = createNode(173 /* ObjectBindingPattern */); parseExpected(16 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(17 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(173 /* ArrayBindingPattern */); + var node = createNode(174 /* ArrayBindingPattern */); parseExpected(20 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(21 /* CloseBracketToken */); @@ -18252,7 +19112,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223 /* VariableDeclaration */); + var node = createNode(225 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -18261,7 +19121,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224 /* VariableDeclarationList */); + var node = createNode(226 /* VariableDeclarationList */); switch (token()) { case 103 /* VarKeyword */: break; @@ -18284,7 +19144,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token() === 140 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 141 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -18299,7 +19159,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205 /* VariableStatement */, fullStart); + var node = createNode(207 /* VariableStatement */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -18307,7 +19167,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225 /* FunctionDeclaration */, fullStart); + var node = createNode(227 /* FunctionDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88 /* FunctionKeyword */); @@ -18320,7 +19180,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(150 /* Constructor */, pos); + var node = createNode(151 /* Constructor */, pos); node.decorators = decorators; node.modifiers = modifiers; parseExpected(122 /* ConstructorKeyword */); @@ -18329,7 +19189,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(149 /* MethodDeclaration */, fullStart); + var method = createNode(150 /* MethodDeclaration */, fullStart); method.decorators = decorators; method.modifiers = modifiers; method.asteriskToken = asteriskToken; @@ -18342,7 +19202,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(147 /* PropertyDeclaration */, fullStart); + var property = createNode(148 /* PropertyDeclaration */, fullStart); property.decorators = decorators; property.modifiers = modifiers; property.name = name; @@ -18359,7 +19219,7 @@ var ts; // The checker may still error in the static case to explicitly disallow the yield expression. property.initializer = ts.hasModifier(property, 32 /* Static */) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(131072 /* YieldContext */ | 65536 /* DisallowInContext */, parseNonParameterInitializer); + : doOutsideOfContext(4096 /* YieldContext */ | 2048 /* DisallowInContext */, parseNonParameterInitializer); parseSemicolon(); return addJSDocComment(finishNode(property)); } @@ -18435,7 +19295,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 133 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 134 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -18465,7 +19325,7 @@ var ts; if (!parseOptional(56 /* AtToken */)) { break; } - var decorator = createNode(145 /* Decorator */, decoratorStart); + var decorator = createNode(146 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); if (!decorators) { @@ -18531,7 +19391,7 @@ var ts; } function parseClassElement() { if (token() === 24 /* SemicolonToken */) { - var result = createNode(203 /* SemicolonClassElement */); + var result = createNode(205 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -18559,8 +19419,8 @@ var ts; } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_13 = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_13, /*questionToken*/ undefined); + var name = createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -18569,10 +19429,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 197 /* ClassExpression */); + /*modifiers*/ undefined, 198 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 228 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -18615,9 +19475,10 @@ var ts; return undefined; } function parseHeritageClause() { - if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) { - var node = createNode(255 /* HeritageClause */); - node.token = token(); + var tok = token(); + if (tok === 84 /* ExtendsKeyword */ || tok === 107 /* ImplementsKeyword */) { + var node = createNode(258 /* HeritageClause */); + node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); return finishNode(node); @@ -18625,7 +19486,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(199 /* ExpressionWithTypeArguments */); + var node = createNode(200 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token() === 26 /* LessThanToken */) { node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); @@ -18639,7 +19500,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227 /* InterfaceDeclaration */, fullStart); + var node = createNode(229 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108 /* InterfaceKeyword */); @@ -18650,10 +19511,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* TypeAliasDeclaration */, fullStart); + var node = createNode(230 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - parseExpected(136 /* TypeKeyword */); + parseExpected(137 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); parseExpected(57 /* EqualsToken */); @@ -18666,13 +19527,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(260 /* EnumMember */, scanner.getStartPos()); + var node = createNode(263 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229 /* EnumDeclaration */, fullStart); + var node = createNode(231 /* EnumDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82 /* EnumKeyword */); @@ -18687,7 +19548,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(233 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(16 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(17 /* CloseBraceToken */); @@ -18698,7 +19559,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -18712,10 +19573,10 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(232 /* ModuleDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); node.flags |= 512 /* GlobalAugmentation */; @@ -18733,7 +19594,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = 0; - if (token() === 139 /* GlobalKeyword */) { + if (token() === 140 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -18759,7 +19620,7 @@ var ts; return nextToken() === 40 /* SlashToken */; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233 /* NamespaceExportDeclaration */, fullStart); + var exportDeclaration = createNode(235 /* NamespaceExportDeclaration */, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117 /* AsKeyword */); @@ -18774,22 +19635,12 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 25 /* CommaToken */ && token() !== 138 /* FromKeyword */) { - // ImportEquals declaration of type: - // import x = require("mod"); or - // import x = M.x; - var importEqualsDeclaration = createNode(234 /* ImportEqualsDeclaration */, fullStart); - importEqualsDeclaration.decorators = decorators; - importEqualsDeclaration.modifiers = modifiers; - importEqualsDeclaration.name = identifier; - parseExpected(57 /* EqualsToken */); - importEqualsDeclaration.moduleReference = parseModuleReference(); - parseSemicolon(); - return addJSDocComment(finishNode(importEqualsDeclaration)); + if (token() !== 25 /* CommaToken */ && token() !== 139 /* FromKeyword */) { + return parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier); } } // Import statement - var importDeclaration = createNode(235 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(237 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; // ImportDeclaration: @@ -18799,12 +19650,22 @@ var ts; token() === 38 /* AsteriskToken */ || token() === 16 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } + function parseImportEqualsDeclaration(fullStart, decorators, modifiers, identifier) { + var importEqualsDeclaration = createNode(236 /* ImportEqualsDeclaration */, fullStart); + importEqualsDeclaration.decorators = decorators; + importEqualsDeclaration.modifiers = modifiers; + importEqualsDeclaration.name = identifier; + parseExpected(57 /* EqualsToken */); + importEqualsDeclaration.moduleReference = parseModuleReference(); + parseSemicolon(); + return addJSDocComment(finishNode(importEqualsDeclaration)); + } function parseImportClause(identifier, fullStart) { // ImportClause: // ImportedDefaultBinding @@ -18812,7 +19673,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(236 /* ImportClause */, fullStart); + var importClause = createNode(238 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -18822,7 +19683,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(25 /* CommaToken */)) { - importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(238 /* NamedImports */); + importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(240 /* NamedImports */); } return finishNode(importClause); } @@ -18832,7 +19693,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(245 /* ExternalModuleReference */); + var node = createNode(247 /* ExternalModuleReference */); parseExpected(131 /* RequireKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -18855,7 +19716,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(237 /* NamespaceImport */); + var namespaceImport = createNode(239 /* NamespaceImport */); parseExpected(38 /* AsteriskToken */); parseExpected(117 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -18870,14 +19731,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 238 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 240 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243 /* ExportSpecifier */); + return parseImportOrExportSpecifier(245 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239 /* ImportSpecifier */); + return parseImportOrExportSpecifier(241 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -18902,27 +19763,27 @@ var ts; else { node.name = identifierName; } - if (kind === 239 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 241 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241 /* ExportDeclaration */, fullStart); + var node = createNode(243 /* ExportDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38 /* AsteriskToken */)) { - parseExpected(138 /* FromKeyword */); + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(244 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 138 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(138 /* FromKeyword */); + if (token() === 139 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(139 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -18930,7 +19791,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240 /* ExportAssignment */, fullStart); + var node = createNode(242 /* ExportAssignment */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57 /* EqualsToken */)) { @@ -18949,6 +19810,7 @@ var ts; var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; + var checkJsDirective = undefined; // Keep scanning all the leading trivia in the file until we get to something that // isn't trivia. Any single line comment will be analyzed to see if it is a // reference comment. @@ -18962,7 +19824,11 @@ var ts; break; } } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; + var range = { + kind: triviaScanner.getToken(), + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -19002,20 +19868,30 @@ var ts; amdDependencies.push(amdDependency); } } + var checkJsDirectiveRegEx = /^\/\/\/?\s*(@ts-check|@ts-nocheck)\s*$/gim; + var checkJsDirectiveMatchResult = checkJsDirectiveRegEx.exec(comment); + if (checkJsDirectiveMatchResult) { + checkJsDirective = { + enabled: ts.compareStrings(checkJsDirectiveMatchResult[1], "@ts-check", /*ignoreCase*/ true) === 0 /* EqualTo */, + end: range.end, + pos: range.pos + }; + } } } sourceFile.referencedFiles = referencedFiles; sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; + sourceFile.checkJsDirective = checkJsDirective; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */ - || node.kind === 235 /* ImportDeclaration */ - || node.kind === 240 /* ExportAssignment */ - || node.kind === 241 /* ExportDeclaration */ + || node.kind === 236 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 247 /* ExternalModuleReference */ + || node.kind === 237 /* ImportDeclaration */ + || node.kind === 242 /* ExportAssignment */ + || node.kind === 243 /* ExportDeclaration */ ? node : undefined; }); @@ -19090,7 +19966,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(262 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(266 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(16 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(17 /* CloseBraceToken */); @@ -19101,12 +19977,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48 /* BarToken */) { - var unionType = createNode(266 /* JSDocUnionType */, type.pos); + var unionType = createNode(270 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57 /* EqualsToken */) { - var optionalType = createNode(273 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(277 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -19117,20 +19993,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20 /* OpenBracketToken */) { - var arrayType = createNode(265 /* JSDocArrayType */, type.pos); + var arrayType = createNode(269 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token() === 54 /* QuestionToken */) { - var nullableType = createNode(268 /* JSDocNullableType */, type.pos); + var nullableType = createNode(272 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50 /* ExclamationToken */) { - var nonNullableType = createNode(269 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(273 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -19164,14 +20040,15 @@ var ts; case 98 /* ThisKeyword */: return parseJSDocThisType(); case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 129 /* NeverKeyword */: + case 133 /* ObjectKeyword */: return parseTokenNode(); case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -19182,27 +20059,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277 /* JSDocThisType */); + var result = createNode(281 /* JSDocThisType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276 /* JSDocConstructorType */); + var result = createNode(280 /* JSDocConstructorType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275 /* JSDocVariadicType */); + var result = createNode(279 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274 /* JSDocFunctionType */); + var result = createNode(278 /* JSDocFunctionType */); nextToken(); parseExpected(18 /* OpenParenToken */); result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -19215,7 +20092,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(144 /* Parameter */); + var parameter = createNode(145 /* Parameter */); parameter.type = parseJSDocType(); if (parseOptional(57 /* EqualsToken */)) { // TODO(rbuckton): Can this be changed to SyntaxKind.QuestionToken? @@ -19224,7 +20101,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272 /* JSDocTypeReference */); + var result = createNode(276 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -19259,24 +20136,24 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(141 /* QualifiedName */, left.pos); + var result = createNode(142 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270 /* JSDocRecordType */); + var result = createNode(274 /* JSDocRecordType */); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269 /* JSDocNonNullableType */); + var result = createNode(273 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267 /* JSDocTupleType */); + var result = createNode(271 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -19290,7 +20167,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266 /* JSDocUnionType */); + var result = createNode(270 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19 /* CloseParenToken */); @@ -19306,12 +20183,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263 /* JSDocAllType */); + var result = createNode(267 /* JSDocAllType */); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288 /* JSDocLiteralType */); + var result = createNode(292 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19334,11 +20211,11 @@ var ts; token() === 28 /* GreaterThanToken */ || token() === 57 /* EqualsToken */ || token() === 48 /* BarToken */) { - var result = createNode(264 /* JSDocUnknownType */, pos); + var result = createNode(268 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(268 /* JSDocNullableType */, pos); + var result = createNode(272 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -19437,7 +20314,7 @@ var ts; break; case 38 /* AsteriskToken */: var asterisk = scanner.getTokenText(); - if (state === 1 /* SawAsterisk */) { + if (state === 1 /* SawAsterisk */ || state === 2 /* SavingComments */) { // If we've already seen an asterisk, then we can no longer parse a tag on this line state = 2 /* SavingComments */; pushComment(asterisk); @@ -19458,7 +20335,10 @@ var ts; case 5 /* WhitespaceTrivia */: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin var whitespace = scanner.getTokenText(); - if (state === 2 /* SavingComments */ || margin !== undefined && indent + whitespace.length > margin) { + if (state === 2 /* SavingComments */) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -19466,6 +20346,8 @@ var ts; case 1 /* EndOfFileToken */: break; default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = 2 /* SavingComments */; pushComment(scanner.getTokenText()); break; } @@ -19498,7 +20380,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(278 /* JSDocComment */, start); + var result = createNode(282 /* JSDocComment */, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19556,7 +20438,7 @@ var ts; } function parseTagComments(indent) { var comments = []; - var state = 1 /* SawAsterisk */; + var state = 0 /* BeginningOfLine */; var margin; function pushComment(text) { if (!margin) { @@ -19597,7 +20479,8 @@ var ts; indent += scanner.getTokenText().length; break; } - // FALLTHROUGH otherwise to record the * as a comment + // record the * as a comment + // falls through default: state = 2 /* SavingComments */; // leading identifiers start recording as well pushComment(scanner.getTokenText()); @@ -19614,7 +20497,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279 /* JSDocTag */, atToken.pos); + var result = createNode(283 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -19671,7 +20554,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281 /* JSDocParameterTag */, atToken.pos); + var result = createNode(285 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19682,20 +20565,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 286 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282 /* JSDocReturnTag */, atToken.pos); + var result = createNode(286 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 287 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283 /* JSDocTypeTag */, atToken.pos); + var result = createNode(287 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19710,7 +20593,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(290 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -19719,7 +20602,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(284 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -19728,25 +20611,30 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(289 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); if (typedefTag.fullName) { var rightNode = typedefTag.fullName; - while (rightNode.kind !== 70 /* Identifier */) { + while (true) { + if (rightNode.kind === 70 /* Identifier */ || !rightNode.body) { + // if node is identifier - use it as name + // otherwise use name of the rightmost part that we were able to parse + typedefTag.name = rightNode.kind === 70 /* Identifier */ ? rightNode : rightNode.name; + break; + } rightNode = rightNode.body; } - typedefTag.name = rightNode; } typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272 /* JSDocTypeReference */) { + if (typeExpression.type.kind === 276 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { - var name_14 = jsDocTypeReference.name; - if (name_14.text === "Object") { + var name = jsDocTypeReference.name; + if (name.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -19760,7 +20648,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(291 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19790,6 +20678,7 @@ var ts; break; case 70 /* Identifier */: canParseTag = false; + break; case 1 /* EndOfFileToken */: break; } @@ -19801,7 +20690,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) { - var jsDocNamespaceNode = createNode(230 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(232 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -19847,20 +20736,20 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 288 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' var typeParameters = createNodeArray(); while (true) { - var name_15 = parseJSDocIdentifierName(); + var name = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_15) { + if (!name) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143 /* TypeParameter */, name_15.pos); - typeParameter.name = name_15; + var typeParameter = createNode(144 /* TypeParameter */, name.pos); + typeParameter.name = name; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25 /* CommaToken */) { @@ -19871,7 +20760,7 @@ var ts; break; } } - var result = createNode(284 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(288 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -20345,7 +21234,7 @@ var ts; if (position >= array.pos && position < array.end) { // position was in this array. Search through this array to see if we find a // viable element. - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -20391,16 +21280,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 230 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } - else if (node.kind === 231 /* ModuleBlock */) { + else if (node.kind === 233 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -20419,7 +21308,7 @@ var ts; }); return state_1; } - else if (node.kind === 230 /* ModuleDeclaration */) { + else if (node.kind === 232 /* ModuleDeclaration */) { var body = node.body; return body ? getModuleInstanceState(body) : 1 /* Instantiated */; } @@ -20532,7 +21421,7 @@ var ts; } return bindSourceFile; function bindInStrictMode(file, opts) { - if (opts.alwaysStrict && !ts.isDeclarationFile(file)) { + if ((opts.alwaysStrict === undefined ? opts.strict : opts.alwaysStrict) && !ts.isDeclarationFile(file)) { // bind in strict mode source files with alwaysStrict option return true; } @@ -20560,7 +21449,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 232 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -20573,7 +21462,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression)) { @@ -20585,27 +21474,28 @@ var ts; return node.name.text; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return "__constructor"; - case 158 /* FunctionType */: - case 153 /* CallSignature */: + case 159 /* FunctionType */: + case 154 /* CallSignature */: return "__call"; - case 159 /* ConstructorType */: - case 154 /* ConstructSignature */: + case 160 /* ConstructorType */: + case 155 /* ConstructSignature */: return "__new"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "__index"; - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return "__export"; - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2 /* ModuleExports */: // module.exports = ... return "export="; case 1 /* ExportsProperty */: case 4 /* ThisProperty */: + case 5 /* Property */: // exports.x = ... or this.y = ... return node.left.name.text; case 3 /* PrototypeProperty */: @@ -20614,22 +21504,22 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined; - case 274 /* JSDocFunctionType */: + case 278 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 144 /* Parameter */: + case 145 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 274 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 278 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -20684,15 +21574,18 @@ var ts; // Otherwise, we'll be merging into a compatible existing symbol (for example when // you have multiple 'vars' with the same name in the same container). In this case // just add this node into the declarations list of the symbol. - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(0 /* None */, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); + } if (name && (includes & 788448 /* Classifiable */)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { // Javascript constructor-declared symbols can be discarded in favor of // prototype symbols like methods. - symbol = symbolTable[name] = createSymbol(0 /* None */, name); + symbolTable.set(name, symbol = createSymbol(0 /* None */, name)); } else { if (node.name) { @@ -20716,7 +21609,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 242 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -20736,11 +21629,11 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 243 /* ExportSpecifier */ || (node.kind === 234 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 245 /* ExportSpecifier */ || (node.kind === 236 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + return declareSymbol(container.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } } else { @@ -20759,7 +21652,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 289 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20767,13 +21660,13 @@ var ts; var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolFlags & 793064 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolFlags & 1920 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); - var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + var local = declareSymbol(container.locals, /*parent*/ undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); node.localSymbol = local; return local; } else { - return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); + return declareSymbol(container.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } } } @@ -20840,14 +21733,13 @@ var ts; hasExplicitReturn = false; bindChildren(node); // Reset all reachability check related flags on node (for incremental scenarios) - // Reset all emit helper flags on node (for incremental scenarios) - node.flags &= ~64896 /* ReachabilityAndEmitFlags */; + node.flags &= ~1408 /* ReachabilityAndEmitFlags */; if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && ts.nodeIsPresent(node.body)) { node.flags |= 128 /* HasImplicitReturn */; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 264 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -20926,66 +21818,72 @@ var ts; return; } switch (node.kind) { - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: bindWhileStatement(node); break; - case 209 /* DoStatement */: + case 211 /* DoStatement */: bindDoStatement(node); break; - case 211 /* ForStatement */: + case 213 /* ForStatement */: bindForStatement(node); break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 208 /* IfStatement */: + case 210 /* IfStatement */: bindIfStatement(node); break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 221 /* TryStatement */: + case 223 /* TryStatement */: bindTryStatement(node); break; - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: bindSwitchStatement(node); break; - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: bindCaseBlock(node); break; - case 253 /* CaseClause */: + case 256 /* CaseClause */: bindCaseClause(node); break; - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: bindLabeledStatement(node); break; - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 179 /* CallExpression */: + case 180 /* CallExpression */: bindCallExpressionFlow(node); break; + case 282 /* JSDocComment */: + bindJSDocComment(node); + break; + case 289 /* JSDocTypedefTag */: + bindJSDocTypedefTag(node); + break; default: bindEachChild(node); break; @@ -20995,15 +21893,15 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return hasNarrowableArgument(expr); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return expr.operator === 50 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; @@ -21011,7 +21909,8 @@ var ts; function isNarrowableReference(expr) { return expr.kind === 70 /* Identifier */ || expr.kind === 98 /* ThisKeyword */ || - expr.kind === 177 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + expr.kind === 96 /* SuperKeyword */ || + expr.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -21022,14 +21921,14 @@ var ts; } } } - if (expr.expression.kind === 177 /* PropertyAccessExpression */ && + if (expr.expression.kind === 178 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 187 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; + return expr1.kind === 188 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { @@ -21050,9 +21949,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 57 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -21147,33 +22046,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208 /* IfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: + case 210 /* IfStatement */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: return parent.expression === node; - case 211 /* ForStatement */: - case 193 /* ConditionalExpression */: + case 213 /* ForStatement */: + case 194 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 183 /* ParenthesizedExpression */) { + if (node.kind === 184 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 190 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { + else if (node.kind === 191 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 192 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || + return node.kind === 193 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 53 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 183 /* ParenthesizedExpression */ || - node.parent.kind === 190 /* PrefixUnaryExpression */ && + while (node.parent.kind === 184 /* ParenthesizedExpression */ || + node.parent.kind === 191 /* PrefixUnaryExpression */ && node.parent.operator === 50 /* ExclamationToken */) { node = node.parent; } @@ -21215,7 +22114,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 221 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21249,10 +22148,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; + if (node.kind === 215 /* ForOfStatement */) { + bind(node.awaitModifier); + } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224 /* VariableDeclarationList */) { + if (node.initializer.kind !== 226 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21274,7 +22176,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216 /* ReturnStatement */) { + if (node.kind === 218 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21294,7 +22196,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 217 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -21330,7 +22232,32 @@ var ts; if (node.finallyBlock) { // in finally flow is combined from pre-try/flow from try/flow from catch // pre-flow is necessary to make sure that finally is reachable even if finally flows in both try and finally blocks are unreachable - addAntecedent(preFinallyLabel, preTryFlow); + // also for finally blocks we inject two extra edges into the flow graph. + // first -> edge that connects pre-try flow with the label at the beginning of the finally block, it has lock associated with it + // second -> edge that represents post-finally flow. + // these edges are used in following scenario: + // let a; (1) + // try { a = someOperation(); (2)} + // finally { (3) console.log(a) } (4) + // (5) a + // flow graph for this case looks roughly like this (arrows show ): + // (1-pre-try-flow) <--.. <-- (2-post-try-flow) + // ^ ^ + // |*****(3-pre-finally-label) -----| + // ^ + // |-- ... <-- (4-post-finally-label) <--- (5) + // In case when we walk the flow starting from inside the finally block we want to take edge '*****' into account + // since it ensures that finally is always reachable. However when we start outside the finally block and go through label (5) + // then edge '*****' should be discarded because label 4 is only reachable if post-finally label-4 is reachable + // Simply speaking code inside finally block is treated as reachable as pre-try-flow + // since we conservatively assume that any line in try block can throw or return in which case we'll enter finally. + // However code after finally is reachable only if control flow was not abrupted in try/catch or finally blocks - it should be composed from + // final flows of these blocks without taking pre-try flow into account. + // + // extra edges that we inject allows to control this behavior + // if when walking the flow we step on post-finally edge - we can mark matching pre-finally edge as locked so it will be skipped. + var preFinallyFlow = { flags: 2048 /* PreFinally */, antecedent: preTryFlow, lock: {} }; + addAntecedent(preFinallyLabel, preFinallyFlow); currentFlow = finishFlowLabel(preFinallyLabel); bind(node.finallyBlock); // if flow after finally is unreachable - keep it @@ -21346,6 +22273,11 @@ var ts; : unreachableFlow; } } + if (!(currentFlow.flags & 1 /* Unreachable */)) { + var afterFinallyFlow = { flags: 4096 /* AfterFinally */, antecedent: currentFlow }; + preFinallyFlow.lock = afterFinallyFlow; + currentFlow = afterFinallyFlow; + } } else { currentFlow = finishFlowLabel(preFinallyLabel); @@ -21360,7 +22292,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 257 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -21427,14 +22359,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 211 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { + if (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -21445,10 +22377,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 175 /* ArrayLiteralExpression */) { + else if (node.kind === 176 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 196 /* SpreadElement */) { + if (e.kind === 197 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -21456,16 +22388,16 @@ var ts; } } } - else if (node.kind === 176 /* ObjectLiteralExpression */) { + else if (node.kind === 177 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257 /* PropertyAssignment */) { + if (p.kind === 260 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258 /* ShorthandPropertyAssignment */) { + else if (p.kind === 261 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259 /* SpreadAssignment */) { + else if (p.kind === 262 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -21521,7 +22453,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) { + if (operator === 57 /* EqualsToken */ && node.left.kind === 179 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21532,7 +22464,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -21565,19 +22497,37 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) { + if (node.initializer || node.parent.parent.kind === 214 /* ForInStatement */ || node.parent.parent.kind === 215 /* ForOfStatement */) { bindInitializedVariableFlow(node); } } + function bindJSDocComment(node) { + ts.forEachChild(node, function (n) { + if (n.kind !== 289 /* JSDocTypedefTag */) { + bind(n); + } + }); + } + function bindJSDocTypedefTag(node) { + ts.forEachChild(node, function (n) { + // if the node has a fullName "A.B.C", that means symbol "C" was already bound + // when we visit "fullName"; so when we visit the name "C" as the next child of + // the jsDocTypedefTag, we should skip binding it. + if (node.fullName && n === node.name && node.fullName.kind !== 70 /* Identifier */) { + return; + } + bind(n); + }); + } function bindCallExpressionFlow(node) { // If the target of the call expression is a function expression or arrow function we have // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = node.expression; - while (expr.kind === 183 /* ParenthesizedExpression */) { + while (expr.kind === 184 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) { + if (expr.kind === 185 /* FunctionExpression */ || expr.kind === 186 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -21585,7 +22535,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 177 /* PropertyAccessExpression */) { + if (node.expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -21594,52 +22544,54 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 291 /* JSDocTypeLiteral */: + case 274 /* JSDocRecordType */: + case 253 /* JsxAttributes */: return 1 /* IsContainer */; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 274 /* JSDocFunctionType */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 278 /* JSDocFunctionType */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 261 /* SourceFile */: + case 264 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; } - case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + // falls through + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 256 /* CatchClause */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 232 /* CaseBlock */: + case 259 /* CatchClause */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 234 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 204 /* Block */: + case 206 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -21676,42 +22628,43 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261 /* SourceFile */: + case 264 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 161 /* TypeLiteral */: - case 176 /* ObjectLiteralExpression */: - case 227 /* InterfaceDeclaration */: - case 270 /* JSDocRecordType */: - case 287 /* JSDocTypeLiteral */: + case 162 /* TypeLiteral */: + case 177 /* ObjectLiteralExpression */: + case 229 /* InterfaceDeclaration */: + case 274 /* JSDocRecordType */: + case 291 /* JSDocTypeLiteral */: + case 253 /* JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: - case 228 /* TypeAliasDeclaration */: - case 170 /* MappedType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 278 /* JSDocFunctionType */: + case 230 /* TypeAliasDeclaration */: + case 171 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -21729,14 +22682,14 @@ var ts; function declareSourceFileMember(node, symbolFlags, symbolExcludes) { return ts.isExternalModule(file) ? declareModuleMember(node, symbolFlags, symbolExcludes) - : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); + : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 261 /* SourceFile */ || body.kind === 231 /* ModuleBlock */)) { + var body = node.kind === 264 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 264 /* SourceFile */ || body.kind === 233 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 /* ExportDeclaration */ || stat.kind === 240 /* ExportAssignment */) { + if (stat.kind === 243 /* ExportDeclaration */ || stat.kind === 242 /* ExportAssignment */) { return true; } } @@ -21760,7 +22713,7 @@ var ts; errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + declareModuleSymbol(node); } else { var pattern = void 0; @@ -21780,12 +22733,8 @@ var ts; } } else { - var state = getModuleInstanceState(node); - if (state === 0 /* NonInstantiated */) { - declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); - } - else { - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + var state = declareModuleSymbol(node); + if (state !== 0 /* NonInstantiated */) { if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { // if module was already merged with some function, class or non-const enum // treat is a non-const-enum-only @@ -21805,6 +22754,12 @@ var ts; } } } + function declareModuleSymbol(node) { + var state = getModuleInstanceState(node); + var instantiated = state !== 0 /* NonInstantiated */; + declareSymbolAndAddToSymbolTable(node, instantiated ? 512 /* ValueModule */ : 1024 /* NamespaceModule */, instantiated ? 106639 /* ValueModuleExcludes */ : 0 /* NamespaceModuleExcludes */); + return state; + } function bindFunctionOrConstructorType(node) { // For a given function symbol "<...>(...) => T" we want to generate a symbol identical // to the one we would get for: { <...>(...): T } @@ -21817,7 +22772,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node) { var ElementKind; @@ -21829,7 +22784,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { + if (prop.kind === 262 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { continue; } var identifier = prop.name; @@ -21841,12 +22796,12 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ + var currentKind = prop.kind === 260 /* PropertyAssignment */ || prop.kind === 261 /* ShorthandPropertyAssignment */ || prop.kind === 150 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; - var existingKind = seen[identifier.text]; + var existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { @@ -21857,27 +22812,33 @@ var ts; } return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object"); } + function bindJsxAttributes(node) { + return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__jsxAttributes"); + } + function bindJsxAttribute(node, symbolFlags, symbolExcludes) { + return declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); + } function bindAnonymousDeclaration(node, symbolFlags, name) { var symbol = createSymbol(symbolFlags, name); addDeclarationToSymbol(symbol, node, symbolFlags); } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; } - // fall through. + // falls through default: if (!blockScopeContainer.locals) { blockScopeContainer.locals = ts.createMap(); addToContainerChain(blockScopeContainer); } - declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); + declareSymbol(blockScopeContainer.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } } function bindBlockScopedVariableDeclaration(node) { @@ -21977,8 +22938,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 261 /* SourceFile */ && - blockScopeContainer.kind !== 230 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 264 /* SourceFile */ && + blockScopeContainer.kind !== 232 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -21988,7 +22949,7 @@ var ts; } } function checkStrictModeNumericLiteral(node) { - if (inStrictMode && node.isOctalLiteral) { + if (inStrictMode && node.numericLiteralFlags & 4 /* Octal */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); } } @@ -22028,6 +22989,18 @@ var ts; } node.parent = parent; var saveInStrictMode = inStrictMode; + // Even though in the AST the jsdoc @typedef node belongs to the current node, + // its symbol might be in the same scope with the current node's symbol. Consider: + // + // /** @typedef {string | number} MyType */ + // function foo(); + // + // Here the current node is "foo", which is a container, but the scope of "MyType" should + // not be inside "foo". Therefore we always bind @typedef before bind the parent node, + // and skip binding this tag later when binding all the other jsdoc tags. + if (ts.isInJavaScriptFile(node)) { + bindJSDocTypedefTagIfAny(node); + } // First we bind declaration nodes to a symbol if possible. We'll both create a symbol // and then potentially add the symbol to an appropriate symbol table. Possible // destination symbol tables are: @@ -22044,7 +23017,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 140 /* LastToken */) { + if (node.kind > 141 /* LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -22061,6 +23034,26 @@ var ts; } inStrictMode = saveInStrictMode; } + function bindJSDocTypedefTagIfAny(node) { + if (!node.jsDoc) { + return; + } + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + if (!jsDoc.tags) { + continue; + } + for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { + var tag = _c[_b]; + if (tag.kind === 289 /* JSDocTypedefTag */) { + var savedParent = parent; + parent = jsDoc; + bind(tag); + parent = savedParent; + } + } + } + } function updateStrictModeStatementList(statements) { if (!inStrictMode) { for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { @@ -22091,91 +23084,90 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 289 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); break; } + // falls through case 98 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 261 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 192 /* BinaryExpression */: - if (ts.isInJavaScriptFile(node)) { - var specialKind = ts.getSpecialPropertyAssignmentKind(node); - switch (specialKind) { - case 1 /* ExportsProperty */: - bindExportsPropertyAssignment(node); - break; - case 2 /* ModuleExports */: - bindModuleExportsAssignment(node); - break; - case 3 /* PrototypeProperty */: - bindPrototypePropertyAssignment(node); - break; - case 4 /* ThisProperty */: - bindThisPropertyAssignment(node); - break; - case 0 /* None */: - // Nothing to do - break; - default: - ts.Debug.fail("Unknown special property assignment kind"); - } + case 193 /* BinaryExpression */: + var specialKind = ts.getSpecialPropertyAssignmentKind(node); + switch (specialKind) { + case 1 /* ExportsProperty */: + bindExportsPropertyAssignment(node); + break; + case 2 /* ModuleExports */: + bindModuleExportsAssignment(node); + break; + case 3 /* PrototypeProperty */: + bindPrototypePropertyAssignment(node); + break; + case 4 /* ThisProperty */: + bindThisPropertyAssignment(node); + break; + case 5 /* Property */: + bindStaticPropertyAssignment(node); + break; + case 0 /* None */: + // Nothing to do + break; + default: + ts.Debug.fail("Unknown special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return checkStrictModeCatchClause(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return checkStrictModeWithStatement(node); - case 167 /* ThisType */: + case 168 /* ThisType */: seenThisKeyword = true; return; - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */); - case 144 /* Parameter */: + case 145 /* Parameter */: return bindParameter(node); - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - if (node.dotDotDotToken && node.parent.kind === 172 /* ObjectBindingPattern */) { - emitFlags |= 32768 /* HasRestAttribute */; - } + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 271 /* JSDocRecordMember */: - return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 286 /* JSDocPropertyTag */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 275 /* JSDocRecordMember */: + return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); + case 290 /* JSDocPropertyTag */: return bindJSDocProperty(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 260 /* EnumMember */: + case 263 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 259 /* SpreadAssignment */: - case 251 /* JsxSpreadAttribute */: + case 262 /* SpreadAssignment */: + case 254 /* JsxSpreadAttribute */: var root = container; var hasRest = false; while (root.parent) { - if (root.kind === 176 /* ObjectLiteralExpression */ && - root.parent.kind === 192 /* BinaryExpression */ && + if (root.kind === 177 /* ObjectLiteralExpression */ && + root.parent.kind === 193 /* BinaryExpression */ && root.parent.operatorToken.kind === 57 /* EqualsToken */ && root.parent.left === root) { hasRest = true; @@ -22183,88 +23175,92 @@ var ts; } root = root.parent; } - emitFlags |= hasRest ? 32768 /* HasRestAttribute */ : 16384 /* HasSpreadAttribute */; return; - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. - return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 225 /* FunctionDeclaration */: + return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); + case 227 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 274 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 278 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 161 /* TypeLiteral */: - case 170 /* MappedType */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 291 /* JSDocTypeLiteral */: + case 274 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return bindFunctionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } break; - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return bindModuleDeclaration(node); + // Jsx-attributes + case 253 /* JsxAttributes */: + return bindJsxAttributes(node); + case 252 /* JsxAttribute */: + return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports - case 234 /* ImportEqualsDeclaration */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 233 /* NamespaceExportDeclaration */: + case 235 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 236 /* ImportClause */: + case 238 /* ImportClause */: return bindImportClause(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return bindExportDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return bindExportAssignment(node); - case 261 /* SourceFile */: + case 264 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204 /* Block */: + case 206 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } - // Fall through - case 231 /* ModuleBlock */: + // falls through + case 233 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); } } @@ -22273,7 +23269,7 @@ var ts; if (parameterName && parameterName.kind === 70 /* Identifier */) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 167 /* ThisType */) { + if (parameterName && parameterName.kind === 168 /* ThisType */) { seenThisKeyword = true; } bind(type); @@ -22296,7 +23292,7 @@ var ts; // An export default clause with an expression exports a value // We want to exclude both class and function here, this is necessary to issue an error when there are both // default export-assignment and default export function and class declaration. - var flags = node.kind === 240 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 242 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) ? 8388608 /* Alias */ : 4 /* Property */; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */); @@ -22306,17 +23302,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261 /* SourceFile */) { + if (node.parent.kind !== 264 /* SourceFile */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_1 = node.parent; + if (!ts.isExternalModule(parent_1)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_1.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -22327,11 +23323,11 @@ var ts; function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { // Export * in some sort of block construct - bindAnonymousDeclaration(node, 1073741824 /* ExportStar */, getDeclarationName(node)); + bindAnonymousDeclaration(node, 33554432 /* ExportStar */, getDeclarationName(node)); } else if (!node.exportClause) { // All export * declarations are collected in an __export symbol - declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0 /* None */); + declareSymbol(container.symbol.exports, container.symbol, node, 33554432 /* ExportStar */, 0 /* None */); } } function bindImportClause(node) { @@ -22353,30 +23349,67 @@ var ts; setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node.left, 4 /* Property */ | 7340032 /* Export */, 0 /* None */); } + function isExportsOrModuleExportsOrAlias(node) { + return ts.isExportsIdentifier(node) || + ts.isModuleExportsPropertyAccessExpression(node) || + isNameOfExportsOrModuleExportsAliasDeclaration(node); + } + function isNameOfExportsOrModuleExportsAliasDeclaration(node) { + if (node.kind === 70 /* Identifier */) { + var symbol = lookupSymbolForName(node.text); + if (symbol && symbol.valueDeclaration && symbol.valueDeclaration.kind === 225 /* VariableDeclaration */) { + var declaration = symbol.valueDeclaration; + if (declaration.initializer) { + return isExportsOrModuleExportsOrAliasOrAssignemnt(declaration.initializer); + } + } + } + return false; + } + function isExportsOrModuleExportsOrAliasOrAssignemnt(node) { + return isExportsOrModuleExportsOrAlias(node) || + (ts.isAssignmentExpression(node, /*excludeCompoundAssignements*/ true) && (isExportsOrModuleExportsOrAliasOrAssignemnt(node.left) || isExportsOrModuleExportsOrAliasOrAssignemnt(node.right))); + } function bindModuleExportsAssignment(node) { + // A common practice in node modules is to set 'export = module.exports = {}', this ensures that 'exports' + // is still pointing to 'module.exports'. + // We do not want to consider this as 'export=' since a module can have only one of these. + // Similarlly we do not want to treat 'module.exports = exports' as an 'export='. + var assignedExpression = ts.getRightMostAssignedExpression(node.right); + if (ts.isEmptyObjectLiteral(assignedExpression) || isExportsOrModuleExportsOrAlias(assignedExpression)) { + // Mark it as a module in case there are no other exports in the file + setCommonJsModuleIndicator(node); + return; + } // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); declareSymbol(file.symbol.exports, file.symbol, node, 4 /* Property */ | 7340032 /* Export */ | 512 /* ValueModule */, 0 /* None */); } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - // Declare a 'member' if the container is an ES5 class or ES6 constructor - if (container.kind === 225 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { - container.symbol.members = container.symbol.members || ts.createMap(); - // It's acceptable for multiple 'this' assignments of the same identifier to occur - declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); - } - else if (container.kind === 150 /* Constructor */) { - // this.foo assignment in a JavaScript class - // Bind this property to the containing class - var saveContainer = container; - container = container.parent; - var symbol = bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* None */); - if (symbol) { - // constructor-declared symbols can be overwritten by subsequent method declarations - symbol.isReplaceableByMethod = true; - } - container = saveContainer; + var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); + switch (container.kind) { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + // Declare a 'member' if the container is an ES5 class or ES6 constructor + container.symbol.members = container.symbol.members || ts.createMap(); + // It's acceptable for multiple 'this' assignments of the same identifier to occur + declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); + break; + case 151 /* Constructor */: + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + // this.foo assignment in a JavaScript class + // Bind this property to the containing class + var containingClass = container.parent; + var symbol = declareSymbol(ts.hasModifier(container, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members, containingClass.symbol, node, 4 /* Property */, 0 /* None */); + if (symbol) { + // symbols declared through 'this' property assignements can be overwritten by subsequent method declarations + symbol.isReplaceableByMethod = true; + } + break; } } function bindPrototypePropertyAssignment(node) { @@ -22390,16 +23423,44 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - var funcSymbol = container.locals[constructorFunction.text]; - if (!funcSymbol || !(funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) { + bindPropertyAssignment(constructorFunction.text, leftSideOfAssignment, /*isPrototypeProperty*/ true); + } + function bindStaticPropertyAssignment(node) { + // We saw a node of the form 'x.y = z'. Declare a 'member' y on x if x was a function. + // Look up the function in the local scope, since prototype assignments should + // follow the function declaration + var leftSideOfAssignment = node.left; + var target = leftSideOfAssignment.expression; + // Fix up parent pointers since we're going to use these nodes before we bind into them + leftSideOfAssignment.parent = node; + target.parent = leftSideOfAssignment; + if (isNameOfExportsOrModuleExportsAliasDeclaration(target)) { + // This can be an alias for the 'exports' or 'module.exports' names, e.g. + // var util = module.exports; + // util.property = function ... + bindExportsPropertyAssignment(node); + } + else { + bindPropertyAssignment(target.text, leftSideOfAssignment, /*isPrototypeProperty*/ false); + } + } + function lookupSymbolForName(name) { + return (container.symbol && container.symbol.exports && container.symbol.exports.get(name)) || (container.locals && container.locals.get(name)); + } + function bindPropertyAssignment(functionName, propertyAccessExpression, isPrototypeProperty) { + var targetSymbol = lookupSymbolForName(functionName); + if (targetSymbol && ts.isDeclarationOfFunctionOrClassExpression(targetSymbol)) { + targetSymbol = targetSymbol.valueDeclaration.initializer.symbol; + } + if (!targetSymbol || !(targetSymbol.flags & (16 /* Function */ | 32 /* Class */))) { return; } // Set up the members collection if it doesn't exist already - if (!funcSymbol.members) { - funcSymbol.members = ts.createMap(); - } + var symbolTable = isPrototypeProperty ? + (targetSymbol.members || (targetSymbol.members = ts.createMap())) : + (targetSymbol.exports || (targetSymbol.exports = ts.createMap())); // Declare the method/property - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, 4 /* Property */, 0 /* PropertyExcludes */); + declareSymbol(symbolTable, targetSymbol, propertyAccessExpression, 4 /* Property */, 0 /* PropertyExcludes */); } function bindCallExpression(node) { // We're only inspecting call expressions to detect CommonJS modules, so we can skip @@ -22409,15 +23470,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 1024 /* HasClassExtends */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; - } - } - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -22425,7 +23478,7 @@ var ts; bindAnonymousDeclaration(node, 32 /* Class */, bindingName); // Add name of class expression into the map for semantic classifier if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } var symbol = node.symbol; @@ -22438,14 +23491,15 @@ var ts; // Note: we check for this here because this class may be merging into a module. The // module might have an exported variable called 'prototype'. We can't allow that as // that would clash with the built-in 'prototype' for the class. - var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + var prototypeSymbol = createSymbol(4 /* Property */ | 16777216 /* Prototype */, "prototype"); + var symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -22479,11 +23533,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (2048 /* HasDecorators */ | 4096 /* HasParamDecorators */); - } if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -22499,13 +23548,13 @@ var ts; // containing class. if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); } } function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024 /* HasAsyncFunctions */; } } checkStrictModeFunctionName(node); @@ -22519,8 +23568,8 @@ var ts; } function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow) { @@ -22532,11 +23581,8 @@ var ts; } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 8192 /* HasAsyncFunctions */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 2048 /* HasDecorators */; + if (ts.isAsyncFunction(node)) { + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { @@ -22561,13 +23607,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 206 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 208 /* EmptyStatement */) || // report error on class declarations - node.kind === 226 /* ClassDeclaration */ || + node.kind === 228 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 230 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 232 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 229 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 231 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -22581,7 +23627,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 /* VariableStatement */ || + (node.kind !== 207 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -22601,56 +23647,56 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); - case 144 /* Parameter */: + case 145 /* Parameter */: return computeParameter(node, subtreeFlags); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 150 /* Constructor */: + case 151 /* Constructor */: return computeConstructor(node, subtreeFlags); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return computePropertyDeclaration(node, subtreeFlags); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return computeMethod(node, subtreeFlags); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -22677,8 +23723,8 @@ var ts; switch (kind) { case 96 /* SuperKeyword */: return true; - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: var expression = node.expression; var expressionKind = expression.kind; return expressionKind === 96 /* SuperKeyword */; @@ -22702,12 +23748,12 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 177 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ESNext if they contain rest transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; } @@ -22757,8 +23803,8 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (expressionKind === 200 /* AsExpression */ - || expressionKind === 182 /* TypeAssertionExpression */) { + if (expressionKind === 201 /* AsExpression */ + || expressionKind === 183 /* TypeAssertionExpression */) { transformFlags |= 3 /* AssertTypeScript */; } // If the expression of a ParenthesizedExpression is a destructuring assignment, @@ -22883,10 +23929,9 @@ var ts; } // An async method declaration is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 16 /* AssertES2017 */; + transformFlags |= node.asteriskToken ? 8 /* AssertESNext */ : 16 /* AssertES2017 */; } - // Currently, we only support generators that were originally async function bodies. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + if (node.asteriskToken) { transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -22940,7 +23985,7 @@ var ts; } // An async function declaration is ES2017 syntax. if (modifierFlags & 256 /* Async */) { - transformFlags |= 16 /* AssertES2017 */; + transformFlags |= node.asteriskToken ? 8 /* AssertESNext */ : 16 /* AssertES2017 */; } // function declarations with object rest destructuring are ES Next syntax if (subtreeFlags & 1048576 /* ContainsObjectRest */) { @@ -22957,7 +24002,7 @@ var ts; // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + if (node.asteriskToken) { transformFlags |= 768 /* AssertGenerator */; } } @@ -22975,7 +24020,7 @@ var ts; } // An async function expression is ES2017 syntax. if (ts.hasModifier(node, 256 /* Async */)) { - transformFlags |= 16 /* AssertES2017 */; + transformFlags |= node.asteriskToken ? 8 /* AssertESNext */ : 16 /* AssertES2017 */; } // function expressions with object rest destructuring are ES Next syntax if (subtreeFlags & 1048576 /* ContainsObjectRest */) { @@ -22990,9 +24035,7 @@ var ts; // If a FunctionExpression is generator function and is the body of a // transformed async function, then this node can be transformed to a // down-level generator. - // Currently we do not support transforming any other generator fucntions - // down level. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + if (node.asteriskToken) { transformFlags |= 768 /* AssertGenerator */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -23123,9 +24166,9 @@ var ts; var excludeFlags = 536872257 /* NodeExcludes */; switch (kind) { case 119 /* AsyncKeyword */: - case 189 /* AwaitExpression */: - // async/await is ES2017 syntax - transformFlags |= 16 /* AssertES2017 */; + case 190 /* AwaitExpression */: + // async/await is ES2017 syntax, but may be ESNext syntax (for async generators) + transformFlags |= 8 /* AssertESNext */ | 16 /* AssertES2017 */; break; case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: @@ -23133,81 +24176,98 @@ var ts; case 116 /* AbstractKeyword */: case 123 /* DeclareKeyword */: case 75 /* ConstKeyword */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: - case 201 /* NonNullExpression */: + case 231 /* EnumDeclaration */: + case 263 /* EnumMember */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: + case 202 /* NonNullExpression */: case 130 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 248 /* JsxElement */: + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: case 10 /* JsxText */: - case 249 /* JsxClosingElement */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - case 252 /* JsxExpression */: + case 251 /* JsxClosingElement */: + case 252 /* JsxAttribute */: + case 253 /* JsxAttributes */: + case 254 /* JsxSpreadAttribute */: + case 255 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; - case 213 /* ForOfStatement */: - // for-of might be ESNext if it has a rest destructuring - transformFlags |= 8 /* AssertESNext */; - // FALLTHROUGH case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: - case 194 /* TemplateExpression */: - case 181 /* TaggedTemplateExpression */: - case 258 /* ShorthandPropertyAssignment */: + case 195 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 261 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: + case 203 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; - case 195 /* YieldExpression */: - // This node is ES6 syntax. - transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; + case 9 /* StringLiteral */: + if (node.hasExtendedUnicodeEscape) { + transformFlags |= 192 /* AssertES2015 */; + } + break; + case 8 /* NumericLiteral */: + if (node.numericLiteralFlags & 48 /* BinaryOrOctalSpecifier */) { + transformFlags |= 192 /* AssertES2015 */; + } + break; + case 215 /* ForOfStatement */: + // This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of). + if (node.awaitModifier) { + transformFlags |= 8 /* AssertESNext */; + } + transformFlags |= 192 /* AssertES2015 */; + break; + case 196 /* YieldExpression */: + // This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async + // generator). + transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; break; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 156 /* TypePredicate */: - case 157 /* TypeReference */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 160 /* TypeQuery */: - case 161 /* TypeLiteral */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 157 /* TypePredicate */: + case 158 /* TypeReference */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 161 /* TypeQuery */: + case 162 /* TypeLiteral */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 3 /* AssertTypeScript */; excludeFlags = -3 /* TypeExcludes */; break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: // Even though computed property names are ES6, we don't treat them as such. // This is so that they can flow through PropertyName transforms unaffected. // Instead, we mark the container as ES6, so that it can properly handle the transform. @@ -23224,10 +24284,10 @@ var ts; transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; } break; - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 96 /* SuperKeyword */: @@ -23238,28 +24298,28 @@ var ts; // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 16384 /* ContainsLexicalThis */; break; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; if (subtreeFlags & 524288 /* ContainsRest */) { transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; } excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; excludeFlags = 537396545 /* BindingPatternExcludes */; break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: transformFlags |= 192 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 524288 /* ContainsRest */; } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */ | 4096 /* ContainsDecorators */; break; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: excludeFlags = 540087617 /* ObjectLiteralExcludes */; if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -23277,8 +24337,8 @@ var ts; transformFlags |= 8 /* AssertESNext */; } break; - case 175 /* ArrayLiteralExpression */: - case 180 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: + case 181 /* NewExpression */: excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */; if (subtreeFlags & 524288 /* ContainsSpread */) { // If the this node contains a SpreadExpression, then it is an ES6 @@ -23286,23 +24346,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 216 /* ReturnStatement */: - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 218 /* ReturnStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -23318,56 +24378,57 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) { + if (kind >= 157 /* FirstTypeNode */ && kind <= 172 /* LastTypeNode */) { return -3 /* TypeExcludes */; } switch (kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 175 /* ArrayLiteralExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 176 /* ArrayLiteralExpression */: return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return 574674241 /* ModuleExcludes */; - case 144 /* Parameter */: + case 145 /* Parameter */: return 536872257 /* ParameterExcludes */; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return 601249089 /* ArrowFunctionExcludes */; - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: return 601281857 /* FunctionExcludes */; - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return 546309441 /* VariableDeclarationListExcludes */; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return 539358529 /* ClassExcludes */; - case 150 /* Constructor */: + case 151 /* Constructor */: return 601015617 /* ConstructorExcludes */; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return 601015617 /* MethodOrAccessorExcludes */; case 118 /* AnyKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: + case 133 /* ObjectKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 143 /* TypeParameter */: - case 146 /* PropertySignature */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 144 /* TypeParameter */: + case 147 /* PropertySignature */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 256 /* CatchClause */: + case 259 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return 537396545 /* BindingPatternExcludes */; default: return 536872257 /* NodeExcludes */; @@ -23406,10 +24467,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - /** Create Resolved from a file with unknown extension. */ - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */ function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; @@ -23422,37 +24479,29 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + /** Reads from "main" or "types"/"typings" depending on `extensions`. */ + function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); - switch (extensions) { - case 2 /* DtsOnly */: - case 0 /* TypeScript */: - return tryReadFromField("typings") || tryReadFromField("types"); - case 1 /* JavaScript */: - if (typeof jsonContent.main === "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); - } - return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main)); - } - return undefined; - } + return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); function tryReadFromField(fieldName) { - if (ts.hasProperty(jsonContent, fieldName)) { - var typesFile = jsonContent[fieldName]; - if (typeof typesFile === "string") { - var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); - } - return typesFilePath; + if (!ts.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); - } + return; + } + var fileName = jsonContent[fieldName]; + if (typeof fileName !== "string") { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); } + return; } + var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); + } + return path; } } function readJson(path, host) { @@ -23488,13 +24537,15 @@ var ts; function getDefaultTypeRoots(currentDirectory, host) { if (!host.directoryExists) { return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; + // And if it doesn't exist, tough. } var typeRoots; - forEachAncestorDirectory(currentDirectory, function (directory) { + forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -23555,7 +24606,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2 /* DtsOnly */, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -23572,7 +24627,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2 /* DtsOnly */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*cache*/ undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -23587,13 +24643,13 @@ var ts; } ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; /** - * Given a set of options, returns the set of type directive names - * that should be included for this program automatically. - * This list could either come from the config file, - * or from enumerating the types root + initial secondary types lookup location. - * More type directives might appear in the program later as a result of loading actual source files; - * this list is only the set of defaults that are implicitly included. - */ + * Given a set of options, returns the set of type directive names + * that should be included for this program automatically. + * This list could either come from the config file, + * or from enumerating the types root + initial secondary types lookup location. + * More type directives might appear in the program later as a result of loading actual source files; + * this list is only the set of defaults that are implicitly included. + */ function getAutomaticTypeDirectiveNames(options, host) { // Use explicit type list from tsconfig.json if (options.types) { @@ -23625,31 +24681,135 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); + if (!perModuleNameCache) { + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + /** + * At first this function add entry directory -> module resolution result to the table. + * Then it computes the set of parent folders for 'directory' that should have the same module resolution result + * and for every parent folder in set it adds entry: parent -> module resolution. . + * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. + * Set of parent folders that should have the same result will be: + * [ + * /a/b/c/d, /a/b/c, /a/b + * ] + * this means that request for module resolution from file in any of these folder will be immediately found in cache. + */ + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + // if entry is already in cache do nothing + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + // find common prefix between directory and resolved file name + // this common prefix should be the shorted path that has the same resolution + // directory: /a/b/c/d/e + // resolvedFileName: /a/b/foo.d.ts + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + if (current === commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + // find first position where directory and resolution differs + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + // find last directory separator before position i + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache.get(moduleName); + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache.set(moduleName, result); + // put result in per-module name cache + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -23842,38 +25002,45 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, /*jsOnly*/ false); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + /* @internal */ + function nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, jsOnly) { + if (jsOnly === void 0) { jsOnly = false; } var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { - var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); + var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, /*considerPackageJson*/ true); }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state, /*considerPackageJson*/ true); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } - ts.nodeModuleNameResolver = nodeModuleNameResolver; + ts.nodeModuleNameResolverWorker = nodeModuleNameResolverWorker; function realpath(path, host, traceEnabled) { if (!host.realpath) { return path; @@ -23884,12 +25051,35 @@ var ts; } return real; } - function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); + } + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); } /* @internal */ function directoryProbablyExists(directoryName, host) { @@ -23928,11 +25118,11 @@ var ts; } } switch (extensions) { - case 2 /* DtsOnly */: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0 /* TypeScript */: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1 /* JavaScript */: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -23942,120 +25132,191 @@ var ts; } /** Return the file if it exists. */ function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var packageJsonPath = pathToPackageJson(candidate); + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { considerPackageJson = true; } var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - // A package.json "typings" may specify an exact filename, or may choose to omit an extension. - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - // Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden. - return resolvedFromAnyFile(fromFile); - } - var x = tryAddingExtensions(typesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + if (considerPackageJson) { + var packageJsonPath = pathToPackageJson(candidate); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state); + if (fromPackageJson) { + return fromPackageJson; } } else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field); + if (directoryExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } + // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results + failedLookupLocations.push(packageJsonPath); } } - else { + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state); + if (!file) { + return undefined; + } + var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); + var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); + if (fromFile) { + var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + if (resolved) { + return resolved; + } if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); } - // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results - failedLookupLocations.push(packageJsonPath); } - return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + // Even if extensions is DtsOnly, we can still look up a .ts file as a result of package.json "types" + var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; + // Don't do package.json lookup recursively, because Node.js' package lookup doesn't. + return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, /*considerPackageJson*/ false); + } + /** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */ + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + /** True if `extension` is one of the supported `extensions`. */ + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly. - return loadModuleFromNodeModulesWorker(2 /* DtsOnly */, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true, /*cache*/ undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */ function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1 /* JavaScript */) { - return loadModuleFromNodeModulesFolder(2 /* DtsOnly */, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); + } + } + /** For a scoped package, we must look in `@types/foo__bar` instead of `@types/@foo/bar`. */ + function mangleScopedPackage(moduleName, state) { + if (ts.startsWith(moduleName, "@")) { + var replaceSlash = moduleName.replace(ts.directorySeparator, "__"); + if (replaceSlash !== moduleName) { + var mangled = replaceSlash.slice(1); // Take off the "@" + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; + } + } + return moduleName; + } + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { // Climb up parent directories looking for a module. var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state)); }); if (resolved_3) { return resolved_3; } - if (extensions === 0 /* TypeScript */) { + if (extensions === Extensions.TypeScript) { // If we didn't find the file normally, look it up in @types. return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state)); } } } @@ -24072,10 +25333,17 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2 /* DtsOnly */, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + /** + * Wraps value to SearchResult. + * @returns undefined if value is undefined or { value } otherwise + */ + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ function forEachAncestorDirectory(directory, callback) { while (true) { @@ -24128,23 +25396,34 @@ var ts; // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; var symbolCount = 0; + var symbolInstantiationDepth = 0; var emptyArray = []; var emptySymbols = ts.createMap(); var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); var modulekind = ts.getEmitModuleKind(compilerOptions); var noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters; var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; - var strictNullChecks = compilerOptions.strictNullChecks; + var strictNullChecks = compilerOptions.strictNullChecks === undefined ? compilerOptions.strict : compilerOptions.strictNullChecks; + var noImplicitAny = compilerOptions.noImplicitAny === undefined ? compilerOptions.strict : compilerOptions.noImplicitAny; + var noImplicitThis = compilerOptions.noImplicitThis === undefined ? compilerOptions.strict : compilerOptions.noImplicitThis; var emitResolver = createResolver(); - var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); + var nodeBuilder = createNodeBuilder(); + var undefinedSymbol = createSymbol(4 /* Property */, "undefined"); undefinedSymbol.declarations = []; - var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "arguments"); + var argumentsSymbol = createSymbol(4 /* Property */, "arguments"); + // for public members that accept a Node or one of its subtypes, we must guard against + // synthetic nodes created during transformations by calling `getParseTreeNode`. + // for most of these, we perform the guard only on `checker` to avoid any possible + // extra cost of calling `getParseTreeNode` when calling these functions from inside the + // checker. var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, @@ -24153,49 +25432,129 @@ var ts; isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, + getMergedSymbol: getMergedSymbol, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, - getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, + getTypeOfSymbolAtLocation: function (symbol, location) { + location = ts.getParseTreeNode(location); + return location ? getTypeOfSymbolAtLocation(symbol, location) : unknownType; + }, + getSymbolsOfParameterPropertyDeclaration: function (parameter, parameterName) { + parameter = ts.getParseTreeNode(parameter, ts.isParameter); + ts.Debug.assert(parameter !== undefined, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); + return getSymbolsOfParameterPropertyDeclaration(parameter, parameterName); + }, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getBaseTypeOfLiteralType: getBaseTypeOfLiteralType, + getWidenedType: getWidenedType, + getTypeFromTypeNode: function (node) { + node = ts.getParseTreeNode(node, ts.isTypeNode); + return node ? getTypeFromTypeNode(node) : unknownType; + }, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, - getSymbolsInScope: getSymbolsInScope, - getSymbolAtLocation: getSymbolAtLocation, - getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, - getTypeAtLocation: getTypeOfNode, - getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, - typeToString: typeToString, + typeToTypeNode: nodeBuilder.typeToTypeNode, + indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, + signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, + getSymbolsInScope: function (location, meaning) { + location = ts.getParseTreeNode(location); + return location ? getSymbolsInScope(location, meaning) : []; + }, + getSymbolAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getSymbolAtLocation(node) : undefined; + }, + getShorthandAssignmentValueSymbol: function (node) { + node = ts.getParseTreeNode(node); + return node ? getShorthandAssignmentValueSymbol(node) : undefined; + }, + getExportSpecifierLocalTargetSymbol: function (node) { + node = ts.getParseTreeNode(node, ts.isExportSpecifier); + return node ? getExportSpecifierLocalTargetSymbol(node) : undefined; + }, + getTypeAtLocation: function (node) { + node = ts.getParseTreeNode(node); + return node ? getTypeOfNode(node) : unknownType; + }, + getPropertySymbolOfDestructuringAssignment: function (location) { + location = ts.getParseTreeNode(location, ts.isIdentifier); + return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; + }, + signatureToString: function (signature, enclosingDeclaration, flags, kind) { + return signatureToString(signature, ts.getParseTreeNode(enclosingDeclaration), flags, kind); + }, + typeToString: function (type, enclosingDeclaration, flags) { + return typeToString(type, ts.getParseTreeNode(enclosingDeclaration), flags); + }, getSymbolDisplayBuilder: getSymbolDisplayBuilder, - symbolToString: symbolToString, + symbolToString: function (symbol, enclosingDeclaration, meaning) { + return symbolToString(symbol, ts.getParseTreeNode(enclosingDeclaration), meaning); + }, getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, getRootSymbols: getRootSymbols, - getContextualType: getContextualType, + getContextualType: function (node) { + node = ts.getParseTreeNode(node, ts.isExpression); + return node ? getContextualType(node) : undefined; + }, getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: getResolvedSignature, - getConstantValue: getConstantValue, - isValidPropertyAccess: isValidPropertyAccess, - getSignatureFromDeclaration: getSignatureFromDeclaration, - isImplementationOfOverload: isImplementationOfOverload, + getResolvedSignature: function (node, candidatesOutArray) { + node = ts.getParseTreeNode(node, ts.isCallLikeExpression); + return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + }, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, + isValidPropertyAccess: function (node, propertyName) { + node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); + return node ? isValidPropertyAccess(node, propertyName) : false; + }, + getSignatureFromDeclaration: function (declaration) { + declaration = ts.getParseTreeNode(declaration, ts.isFunctionLike); + return declaration ? getSignatureFromDeclaration(declaration) : undefined; + }, + isImplementationOfOverload: function (node) { + node = ts.getParseTreeNode(node, ts.isFunctionLike); + return node ? isImplementationOfOverload(node) : undefined; + }, + getImmediateAliasedSymbol: function (symbol) { + ts.Debug.assert((symbol.flags & 8388608 /* Alias */) !== 0, "Should only get Alias here."); + var links = getSymbolLinks(symbol); + if (!links.immediateTarget) { + var node = getDeclarationOfAliasSymbol(symbol); + ts.Debug.assert(!!node); + links.immediateTarget = getTargetOfAliasDeclaration(node, /*dontRecursivelyResolve*/ true); + } + return links.immediateTarget; + }, getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getExportsAndPropertiesOfModule: getExportsAndPropertiesOfModule, getAmbientModules: getAmbientModules, - getJsxElementAttributesType: getJsxElementAttributesType, + getAllAttributesTypeFromJsxOpeningLikeElement: function (node) { + node = ts.getParseTreeNode(node, ts.isJsxOpeningLikeElement); + return node ? getAllAttributesTypeFromJsxOpeningLikeElement(node) : undefined; + }, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, - isOptionalParameter: isOptionalParameter, + isOptionalParameter: function (node) { + node = ts.getParseTreeNode(node, ts.isParameter); + return node ? isOptionalParameter(node) : false; + }, tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { // we deliberately exclude augmentations // since we are only interested in declarations of the module itself return tryFindAmbientModule(moduleName, /*withAugmentations*/ false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -24204,8 +25563,8 @@ var ts; var numericLiteralTypes = ts.createMap(); var indexedAccessTypes = ts.createMap(); var evolvingArrayTypes = []; - var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); - var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); + var unknownSymbol = createSymbol(4 /* Property */, "unknown"); + var resolvingSymbol = createSymbol(0, "__resolving__"); var anyType = createIntrinsicType(1 /* Any */, "any"); var autoType = createIntrinsicType(1 /* Any */, "any"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); @@ -24222,8 +25581,9 @@ var ts; var voidType = createIntrinsicType(1024 /* Void */, "void"); var neverType = createIntrinsicType(8192 /* Never */, "never"); var silentNeverType = createIntrinsicType(8192 /* Never */, "never"); + var nonPrimitiveType = createIntrinsicType(16777216 /* NonPrimitive */, "object"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type"); + var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); emptyTypeLiteralSymbol.members = ts.createMap(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -24233,21 +25593,20 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); + var jsObjectLiteralIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); var globals = ts.createMap(); /** * List of every ambient module with a "*" wildcard. * Unlike other ambient modules, these can't be stored in `globals` because symbol tables only deal with exact matches. * This is only used if there is no exact match. - */ + */ var patternAmbientModules; - var getGlobalESSymbolConstructorSymbol; - var getGlobalPromiseConstructorSymbol; - var tryGetGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -24256,29 +25615,29 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; + var globalThisType; var anyArrayType; var autoArrayType; var anyReadonlyArrayType; // The library files are only loaded when the feature is used. // This allows users to just specify library files they want to used through --lib // and they will not get an error from not having unrelated library files - var getGlobalTemplateStringsArrayType; - var getGlobalESSymbolType; - var getGlobalIterableType; - var getGlobalIteratorType; - var getGlobalIterableIteratorType; - var getGlobalClassDecoratorType; - var getGlobalParameterDecoratorType; - var getGlobalPropertyDecoratorType; - var getGlobalMethodDecoratorType; - var getGlobalTypedPropertyDescriptorType; - var getGlobalPromiseType; - var tryGetGlobalPromiseType; - var getGlobalPromiseLikeType; - var getInstantiatedGlobalPromiseLikeType; - var getGlobalPromiseConstructorLikeType; - var getGlobalThenableType; - var jsxElementClassType; + var deferredGlobalESSymbolConstructorSymbol; + var deferredGlobalESSymbolType; + var deferredGlobalTypedPropertyDescriptorType; + var deferredGlobalPromiseType; + var deferredGlobalPromiseConstructorSymbol; + var deferredGlobalPromiseConstructorLikeType; + var deferredGlobalIterableType; + var deferredGlobalIteratorType; + var deferredGlobalIterableIteratorType; + var deferredGlobalAsyncIterableType; + var deferredGlobalAsyncIteratorType; + var deferredGlobalAsyncIterableIteratorType; + var deferredGlobalTemplateStringsArrayType; + var deferredJsxElementClassType; + var deferredJsxElementType; + var deferredJsxStatelessElementType; var deferredNodes; var deferredUnusedIdentifierNodes; var flowLoopStart = 0; @@ -24299,6 +25658,7 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); var TypeFacts; @@ -24364,7 +25724,7 @@ var ts; TypeFacts[TypeFacts["UndefinedFacts"] = 2457472] = "UndefinedFacts"; TypeFacts[TypeFacts["NullFacts"] = 2340752] = "NullFacts"; })(TypeFacts || (TypeFacts = {})); - var typeofEQFacts = ts.createMap({ + var typeofEQFacts = ts.createMapFromTemplate({ "string": 1 /* TypeofEQString */, "number": 2 /* TypeofEQNumber */, "boolean": 4 /* TypeofEQBoolean */, @@ -24373,7 +25733,7 @@ var ts; "object": 16 /* TypeofEQObject */, "function": 32 /* TypeofEQFunction */ }); - var typeofNEFacts = ts.createMap({ + var typeofNEFacts = ts.createMapFromTemplate({ "string": 128 /* TypeofNEString */, "number": 256 /* TypeofNENumber */, "boolean": 512 /* TypeofNEBoolean */, @@ -24382,14 +25742,14 @@ var ts; "object": 2048 /* TypeofNEObject */, "function": 4096 /* TypeofNEFunction */ }); - var typeofTypesByName = ts.createMap({ + var typeofTypesByName = ts.createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, "symbol": esSymbolType, "undefined": undefinedType }); - var jsxElementType; + var typeofType = createTypeofType(); var _jsxNamespace; var _jsxFactoryEntity; /** Things we lazy load from the JSX namespace */ @@ -24417,8 +25777,14 @@ var ts; TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); + var CheckMode; + (function (CheckMode) { + CheckMode[CheckMode["Normal"] = 0] = "Normal"; + CheckMode[CheckMode["SkipContextSensitive"] = 1] = "SkipContextSensitive"; + CheckMode[CheckMode["Inferential"] = 2] = "Inferential"; + })(CheckMode || (CheckMode = {})); var builtinGlobals = ts.createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -24450,7 +25816,12 @@ var ts; } function createSymbol(flags, name) { symbolCount++; - return new Symbol(flags, name); + var symbol = (new Symbol(flags | 134217728 /* Transient */, name)); + symbol.checkFlags = 0; + return symbol; + } + function isTransientSymbol(symbol) { + return (symbol.flags & 134217728 /* Transient */) !== 0; } function getExcludedSymbolFlags(flags) { var result = 0; @@ -24496,7 +25867,7 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 33554432 /* Merged */, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) @@ -24519,13 +25890,11 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 230 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 232 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 232 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -24538,6 +25907,9 @@ var ts; } recordMergedSymbol(target, source); } + else if (target.flags & 1024 /* NamespaceModule */) { + error(source.valueDeclaration.name, ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } else { var message_2 = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; @@ -24550,18 +25922,19 @@ var ts; } } function mergeSymbolTable(target, source) { - for (var id in source) { - var targetSymbol = target[id]; + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { - if (!(targetSymbol.flags & 33554432 /* Merged */)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + if (!(targetSymbol.flags & 134217728 /* Transient */)) { + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; @@ -24590,7 +25963,7 @@ var ts; if (mainModule.flags & 1920 /* Namespace */) { // if module symbol has already been merged - it is safe to use it. // otherwise clone it - mainModule = mainModule.flags & 33554432 /* Merged */ ? mainModule : cloneSymbol(mainModule); + mainModule = mainModule.flags & 134217728 /* Transient */ ? mainModule : cloneSymbol(mainModule); mergeSymbol(mainModule, moduleAugmentation.symbol); } else { @@ -24599,21 +25972,22 @@ var ts; } } function addToSymbolTable(target, source, message) { - for (var id in source) { - if (target[id]) { + source.forEach(function (sourceSymbol, id) { + var targetSymbol = target.get(id); + if (targetSymbol) { // Error on redeclarations - ts.forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id, message) { return function (declaration) { return diagnostics.add(ts.createDiagnosticForNode(declaration, message, id)); }; } } function getSymbolLinks(symbol) { - if (symbol.flags & 67108864 /* Transient */) + if (symbol.flags & 134217728 /* Transient */) return symbol; var id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}); @@ -24625,14 +25999,17 @@ var ts; function getObjectFlags(type) { return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } + function getCheckFlags(symbol) { + return symbol.flags & 134217728 /* Transient */ ? symbol.checkFlags : 0; + } function isGlobalSourceFile(node) { - return node.kind === 261 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 264 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { - var symbol = symbols[name]; + var symbol = symbols.get(name); if (symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } @@ -24669,12 +26046,12 @@ var ts; if (declarationFile !== useFile) { if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) || (!compilerOptions.outFile && !compilerOptions.out)) { - // nodes are in different files and order cannot be determines + // nodes are in different files and order cannot be determined return true; } // declaration is after usage // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) - if (isUsedInFunctionOrNonStaticProperty(usage)) { + if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { return true; } var sourceFiles = host.getSourceFiles(); @@ -24682,20 +26059,41 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== 223 /* VariableDeclaration */ || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 175 /* BindingElement */) { + // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) + var errorBindingElement = ts.getAncestor(usage, 175 /* BindingElement */); + if (errorBindingElement) { + return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || + declaration.pos < errorBindingElement.pos; + } + // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 225 /* VariableDeclaration */), usage); + } + else if (declaration.kind === 225 /* VariableDeclaration */) { + // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; + } + // declaration is after usage, but it can still be legal if usage is deferred: + // 1. inside an export specifier + // 2. inside a function + // 3. inside an instance property initializer, a reference to a non-instance property + // 4. inside a static property initializer, a reference to a static method in the same class + // or if usage is in a type context: + // 1. inside a type query (typeof in type position) + if (usage.parent.kind === 245 /* ExportSpecifier */) { + // export specifiers do not use the variable, they only make it available for use + return true; } - // declaration is after usage - // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) var container = ts.getEnclosingBlockScopeContainer(declaration); - return isUsedInFunctionOrNonStaticProperty(usage, container); + return isInTypeQuery(usage) || isUsedInFunctionOrInstanceProperty(usage, declaration, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205 /* VariableStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 207 /* VariableStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -24704,8 +26102,8 @@ var ts; break; } switch (declaration.parent.parent.kind) { - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: // ForIn/ForOf case - use site should not be used in expression part if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; @@ -24713,25 +26111,31 @@ var ts; } return false; } - function isUsedInFunctionOrNonStaticProperty(usage, container) { - var current = usage; - while (current) { + function isUsedInFunctionOrInstanceProperty(usage, declaration, container) { + return !!ts.findAncestor(usage, function (current) { if (current === container) { - return false; + return "quit"; } if (ts.isFunctionLike(current)) { return true; } - var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 147 /* PropertyDeclaration */ && - (ts.getModifierFlags(current.parent) & 32 /* Static */) === 0 && + var initializerOfProperty = current.parent && + current.parent.kind === 148 /* PropertyDeclaration */ && current.parent.initializer === current; - if (initializerOfNonStaticProperty) { - return true; + if (initializerOfProperty) { + if (ts.getModifierFlags(current.parent) & 32 /* Static */) { + if (declaration.kind === 150 /* MethodDeclaration */) { + return true; + } + } + else { + var isDeclarationInstanceProperty = declaration.kind === 148 /* PropertyDeclaration */ && !(ts.getModifierFlags(declaration) & 32 /* Static */); + if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { + return true; + } + } } - current = current.parent; - } - return false; + }); } } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and @@ -24756,11 +26160,11 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 282 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || - lastLocation.kind === 144 /* Parameter */ || - lastLocation.kind === 143 /* TypeParameter */ + lastLocation.kind === 145 /* Parameter */ || + lastLocation.kind === 144 /* TypeParameter */ : false; } if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { @@ -24769,9 +26173,9 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 144 /* Parameter */ || + lastLocation.kind === 145 /* Parameter */ || (lastLocation === location.type && - result.valueDeclaration.kind === 144 /* Parameter */); + result.valueDeclaration.kind === 145 /* Parameter */); } } if (useResult) { @@ -24783,16 +26187,17 @@ var ts; } } switch (location.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230 /* ModuleDeclaration */: + // falls through + case 232 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 264 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. - if (result = moduleExports["default"]) { + if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; @@ -24810,9 +26215,10 @@ var ts; // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, // which is not the desired behavior. - if (moduleExports[name] && - moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 243 /* ExportSpecifier */)) { + var moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === 8388608 /* Alias */ && + ts.getDeclarationOfKind(moduleExport, 245 /* ExportSpecifier */)) { break; } } @@ -24820,13 +26226,13 @@ var ts; break loop; } break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -24843,10 +26249,15 @@ var ts; } } break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) { + if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { + // ignore type parameters not declared in this container + result = undefined; + break; + } if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type @@ -24856,7 +26267,7 @@ var ts; } break loop; } - if (location.kind === 197 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 198 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -24872,9 +26283,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 229 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -24882,19 +26293,19 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -24907,7 +26318,7 @@ var ts; } } break; - case 145 /* Decorator */: + case 146 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -24916,7 +26327,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 144 /* Parameter */) { + if (location.parent && location.parent.kind === 145 /* Parameter */) { location = location.parent; } // @@ -24945,7 +26356,8 @@ var ts; !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && - !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { + !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && + !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } } @@ -24967,31 +26379,41 @@ var ts; // interface bar {} // } // const foo/*1*/: foo/*2*/.bar; - // The foo at /*1*/ and /*2*/ will share same symbol with two meaning - // block - scope variable and namespace module. However, only when we + // The foo at /*1*/ and /*2*/ will share same symbol with two meanings: + // block-scoped variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, - // we want to check for block- scoped - if (meaning & 2 /* BlockScopedVariable */) { + // we want to check for block-scoped + if (meaning & 2 /* BlockScopedVariable */ || + ((meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 107455 /* Value */) === 107455 /* Value */)) { var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); - if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */) { + if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } // If we're in an external module, we can't reference value symbols created from UMD export declarations if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 235 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } } return result; } + function isTypeParameterSymbolDeclaredInContainer(symbol, container) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.kind === 144 /* TypeParameter */ && decl.parent === container) { + return true; + } + } + return false; + } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { if ((errorLocation.kind === 70 /* Identifier */ && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { return false; } - var container = ts.getThisContainer(errorLocation, /* includeArrowFunctions */ true); + var container = ts.getThisContainer(errorLocation, /*includeArrowFunctions*/ true); var location = container; while (location) { if (ts.isClassLike(location.parent)) { @@ -25034,9 +26456,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: @@ -25063,13 +26485,38 @@ var ts; } return false; } + function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { + if (meaning & (107455 /* Value */ & ~1024 /* NamespaceModule */ & ~793064 /* Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, name); + return true; + } + } + else if (meaning & (793064 /* Type */ & ~1024 /* NamespaceModule */ & ~107455 /* Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* NamespaceModule */ & ~793064 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, name); + return true; + } + } + return false; + } function checkResolvedBlockScopedVariable(result, errorLocation) { - ts.Debug.assert((result.flags & 2 /* BlockScopedVariable */) !== 0); + ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */)); // Block-scoped variables cannot be used before their definition - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223 /* VariableDeclaration */), errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 231 /* EnumDeclaration */) ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + if (result.flags & 2 /* BlockScopedVariable */) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 32 /* Class */) { + error(errorLocation, ts.Diagnostics.Class_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + else if (result.flags & 384 /* Enum */) { + error(errorLocation, ts.Diagnostics.Enum_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } } } /* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached. @@ -25077,56 +26524,50 @@ var ts; * Return false if 'stopAt' node is reached or isFunctionLike(current) === true. */ function isSameScopeDescendentOf(initial, parent, stopAt) { - if (!parent) { - return false; - } - for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { - if (current === parent) { - return true; - } - } - return false; + return parent && !!ts.findAncestor(initial, function (n) { return n === stopAt || ts.isFunctionLike(n) ? "quit" : n === parent; }); } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 235 /* ImportDeclaration */) { - node = node.parent; - } - return node; + return ts.findAncestor(node, function (n) { return n.kind === 237 /* ImportDeclaration */; }); } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } - function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { + if (node.moduleReference.kind === 247 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } - return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); } - function getTargetOfImportClause(node) { + function getTargetOfImportClause(node, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = void 0; + if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + var exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default"), dontResolveAlias); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } else if (!exportDefaultSymbol && allowSyntheticDefaultImports) { - return resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } return exportDefaultSymbol; } } - function getTargetOfNamespaceImport(node) { + function getTargetOfNamespaceImport(node, dontResolveAlias) { var moduleSpecifier = node.parent.parent.moduleSpecifier; - return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); + return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier, dontResolveAlias); } // This function creates a synthetic symbol that combines the value side of one symbol with the // type/namespace side of another symbol. Consider this example: @@ -25161,12 +26602,9 @@ var ts; result.exports = valueSymbol.exports; return result; } - function getExportOfModule(symbol, name) { + function getExportOfModule(symbol, name, dontResolveAlias) { if (symbol.flags & 1536 /* Module */) { - var exportedSymbol = getExportsOfSymbol(symbol)[name]; - if (exportedSymbol) { - return resolveSymbol(exportedSymbol); - } + return resolveSymbol(getExportsOfSymbol(symbol).get(name), dontResolveAlias); } } function getPropertyOfVariable(symbol, name) { @@ -25177,74 +26615,75 @@ var ts; } } } - function getExternalModuleMember(node, specifier) { + function getExternalModuleMember(node, specifier, dontResolveAlias) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); - var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); + var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier, dontResolveAlias); if (targetSymbol) { - var name_16 = specifier.propertyName || specifier.name; - if (name_16.text) { + var name = specifier.propertyName || specifier.name; + if (name.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; // First check if module was specified with "export=". If so, get the member from the resolved type - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); } // if symbolFromVariable is export - get its final target - symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_16.text); + symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); + var symbolFromModule = getExportOfModule(targetSymbol, name.text, dontResolveAlias); // If the export member we're looking for is default, and there is no real default but allowSyntheticDefaultImports is on, return the entire module as the default - if (!symbolFromModule && allowSyntheticDefaultImports && name_16.text === "default") { - symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); + if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { + symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); + error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); } return symbol; } } } - function getTargetOfImportSpecifier(node) { - return getExternalModuleMember(node.parent.parent.parent, node); + function getTargetOfImportSpecifier(node, dontResolveAlias) { + return getExternalModuleMember(node.parent.parent.parent, node, dontResolveAlias); } - function getTargetOfNamespaceExportDeclaration(node) { - return resolveExternalModuleSymbol(node.parent.symbol); + function getTargetOfNamespaceExportDeclaration(node, dontResolveAlias) { + return resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias); } - function getTargetOfExportSpecifier(node) { + function getTargetOfExportSpecifier(node, dontResolveAlias) { return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */); + getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : + resolveEntityName(node.propertyName || node.name, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } - function getTargetOfExportAssignment(node) { - return resolveEntityName(node.expression, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */); + function getTargetOfExportAssignment(node, dontResolveAlias) { + return resolveEntityName(node.expression, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } - function getTargetOfAliasDeclaration(node) { + function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - return getTargetOfImportEqualsDeclaration(node); - case 236 /* ImportClause */: - return getTargetOfImportClause(node); - case 237 /* NamespaceImport */: - return getTargetOfNamespaceImport(node); - case 239 /* ImportSpecifier */: - return getTargetOfImportSpecifier(node); - case 243 /* ExportSpecifier */: - return getTargetOfExportSpecifier(node); - case 240 /* ExportAssignment */: - return getTargetOfExportAssignment(node); - case 233 /* NamespaceExportDeclaration */: - return getTargetOfNamespaceExportDeclaration(node); - } - } - function resolveSymbol(symbol) { - return symbol && symbol.flags & 8388608 /* Alias */ && !(symbol.flags & (107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */)) ? resolveAlias(symbol) : symbol; + case 236 /* ImportEqualsDeclaration */: + return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); + case 238 /* ImportClause */: + return getTargetOfImportClause(node, dontRecursivelyResolve); + case 239 /* NamespaceImport */: + return getTargetOfNamespaceImport(node, dontRecursivelyResolve); + case 241 /* ImportSpecifier */: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 245 /* ExportSpecifier */: + return getTargetOfExportSpecifier(node, dontRecursivelyResolve); + case 242 /* ExportAssignment */: + return getTargetOfExportAssignment(node, dontRecursivelyResolve); + case 235 /* NamespaceExportDeclaration */: + return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); + } + } + function resolveSymbol(symbol, dontResolveAlias) { + var shouldResolve = !dontResolveAlias && symbol && symbol.flags & 8388608 /* Alias */ && !(symbol.flags & (107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */)); + return shouldResolve ? resolveAlias(symbol) : symbol; } function resolveAlias(symbol) { ts.Debug.assert((symbol.flags & 8388608 /* Alias */) !== 0, "Should only get Alias here."); @@ -25286,11 +26725,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240 /* ExportAssignment */) { + if (node.kind === 242 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 243 /* ExportSpecifier */) { + else if (node.kind === 245 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -25312,20 +26751,22 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 141 /* QualifiedName */) { + if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 142 /* QualifiedName */) { return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 234 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 236 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol) { return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } - // Resolves a qualified name and any involved aliases + /** + * Resolves a qualified name and any involved aliases. + */ function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) { if (ts.nodeIsMissing(name)) { return undefined; @@ -25338,9 +26779,23 @@ var ts; return undefined; } } - else if (name.kind === 141 /* QualifiedName */ || name.kind === 177 /* PropertyAccessExpression */) { - var left = name.kind === 141 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 141 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 142 /* QualifiedName */ || name.kind === 178 /* PropertyAccessExpression */) { + var left = void 0; + if (name.kind === 142 /* QualifiedName */) { + left = name.left; + } + else if (name.kind === 178 /* PropertyAccessExpression */ && + (name.expression.kind === 184 /* ParenthesizedExpression */ || ts.isEntityNameExpression(name.expression))) { + left = name.expression; + } + else { + // If the expression in property-access expression is not entity-name or parenthsizedExpression (e.g. it is a call expression), it won't be able to successfully resolve the name. + // This is the case when we are trying to do any language service operation in heritage clauses. By return undefined, the getSymbolOfEntityNameOrPropertyAccessExpression + // will attempt to checkPropertyAccessExpression to resolve symbol. + // i.e class C extends foo()./*do language service operation here*/B {} + return undefined; + } + var right = name.kind === 142 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -25356,10 +26811,19 @@ var ts; return undefined; } } + else if (name.kind === 184 /* ParenthesizedExpression */) { + // If the expression in parenthesizedExpression is not an entity-name (e.g. it is a call expression), it won't be able to successfully resolve the name. + // This is the case when we are trying to do any language service operation in heritage clauses. + // By return undefined, the getSymbolOfEntityNameOrPropertyAccessExpression will attempt to checkPropertyAccessExpression to resolve symbol. + // i.e class C extends foo()./*do language service operation here*/B {} + return ts.isEntityNameExpression(name.expression) ? + resolveEntityName(name.expression, meaning, ignoreErrors, dontResolveAlias, location) : + undefined; + } else { ts.Debug.fail("Unknown entity name kind."); } - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); } function resolveExternalModuleName(location, moduleReferenceExpression) { @@ -25367,7 +26831,7 @@ var ts; } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { if (isForAugmentation === void 0) { isForAugmentation = false; } - if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) { + if (moduleReferenceExpression.kind !== 9 /* StringLiteral */ && moduleReferenceExpression.kind !== 12 /* NoSubstitutionTemplateLiteral */) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -25409,11 +26873,10 @@ var ts; // May be an untyped module. If so, ignore resolutionDiagnostic. if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - ts.Debug.assert(!!moduleNotFoundError); var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } - else if (compilerOptions.noImplicitAny && moduleNotFoundError) { + else if (noImplicitAny && moduleNotFoundError) { error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); } // Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first. @@ -25439,30 +26902,38 @@ var ts; } // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. - function resolveExternalModuleSymbol(moduleSymbol) { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias)) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may // combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable). - function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { - var symbol = resolveExternalModuleSymbol(moduleSymbol); - if (symbol && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { + function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression, dontResolveAlias) { + var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); + if (!dontResolveAlias && symbol && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; } function hasExportAssignmentSymbol(moduleSymbol) { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol) { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol) { + var exports = getExportsOfModuleAsArray(moduleSymbol); + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + ts.addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } function tryGetMemberInModuleExports(memberName, moduleSymbol) { var symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } function getExportsOfSymbol(symbol) { @@ -25477,24 +26948,28 @@ var ts; * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables */ function extendExportSymbols(target, source, lookupTable, exportNode) { - for (var id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + source && source.forEach(function (sourceSymbol, id) { + if (id === "default") + return; + var targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: ts.getTextOfNode(exportNode.moduleSpecifier) - }; + }); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + var collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; @@ -25510,27 +26985,27 @@ var ts; visitedSymbols.push(symbol); var symbols = ts.cloneMap(symbol.exports); // All export * declarations are collected in an __export symbol by the binder - var exportStars = symbol.exports["__export"]; + var exportStars = symbol.exports.get("__export"); if (exportStars) { var nestedSymbols = ts.createMap(); - var lookupTable = ts.createMap(); + var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier); var exportedSymbols = visit(resolvedModule); - extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node); + extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable_1, node); } - for (var id in lookupTable) { - var exportsWithDuplicate = lookupTable[id].exportsWithDuplicate; + lookupTable_1.forEach(function (_a, id) { + var exportsWithDuplicate = _a.exportsWithDuplicate; // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } - for (var _b = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _b < exportsWithDuplicate_1.length; _b++) { - var node = exportsWithDuplicate_1[_b]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable[id].specifierText, id)); + for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { + var node = exportsWithDuplicate_1[_i]; + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -25552,26 +27027,13 @@ var ts; : symbol; } function symbolIsValue(symbol) { - // If it is an instantiated symbol, then it is a value if the symbol it is an - // instantiation of is a value. - if (symbol.flags & 16777216 /* Instantiated */) { - return symbolIsValue(getSymbolLinks(symbol).target); - } - // If the symbol has the value flag, it is trivially a value. - if (symbol.flags & 107455 /* Value */) { - return true; - } - // If it is an alias, then it is a value if the symbol it resolves to is a value. - if (symbol.flags & 8388608 /* Alias */) { - return (resolveAlias(symbol).flags & 107455 /* Value */) !== 0; - } - return false; + return !!(symbol.flags & 107455 /* Value */ || symbol.flags & 8388608 /* Alias */ && resolveAlias(symbol).flags & 107455 /* Value */); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 150 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 151 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -25599,6 +27061,9 @@ var ts; type.symbol = symbol; return type; } + function createTypeofType() { + return getUnionType(ts.convertToArray(typeofEQFacts.keys(), function (s) { return getLiteralTypeForText(32 /* StringLiteral */, s); })); + } // A reserved member name starts with two underscores, but the third character cannot be an underscore // or the @ symbol. A third underscore indicates an escaped form of an identifer that started // with at least two underscores. The @ character indicates that the name is denoted by a well known ES @@ -25611,16 +27076,15 @@ var ts; } function getNamedMembers(members) { var result; - for (var id in members) { + members.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { @@ -25639,20 +27103,21 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location_1 = enclosingDeclaration; location_1; location_1 = location_1.parent) { + for (var location = enclosingDeclaration; location; location = location.parent) { // Locals of a source file are not in scope (because they get merged into the global symbol table) - if (location_1.locals && !isGlobalSourceFile(location_1)) { - if (result = callback(location_1.locals)) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { return result; } } - switch (location_1.kind) { - case 261 /* SourceFile */: - if (!ts.isExternalOrCommonJsModule(location_1)) { + switch (location.kind) { + case 264 /* SourceFile */: + if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230 /* ModuleDeclaration */: - if (result = callback(getSymbolOfNode(location_1).exports)) { + // falls through + case 232 /* ModuleDeclaration */: + if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; @@ -25666,6 +27131,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -25684,31 +27159,33 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - // Check if symbol is any of the alias - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 /* Alias */ - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { - if (!useOnlyExternalAliasing || - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols.get(symbol.name))) { + return [symbol]; + } + // Check if symbol is any of the alias + return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 /* Alias */ + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) { + if (!useOnlyExternalAliasing || + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -25720,7 +27197,7 @@ var ts; var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { // If symbol of this name is not available in the symbol table we are ok - var symbolFromSymbolTable = symbolTable[symbol.name]; + var symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { // Continue to the next symbol table return false; @@ -25731,7 +27208,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 245 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -25746,10 +27223,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: continue; default: return false; @@ -25822,15 +27299,12 @@ var ts; } return { accessibility: 0 /* Accessible */ }; function getExternalModuleContainer(declaration) { - for (; declaration; declaration = declaration.parent) { - if (hasExternalModuleSymbol(declaration)) { - return getSymbolOfNode(declaration); - } - } + var node = ts.findAncestor(declaration, hasExternalModuleSymbol); + return node && getSymbolOfNode(node); } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 264 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -25871,12 +27345,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 160 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 161 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ || - entityName.parent.kind === 234 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 142 /* QualifiedName */ || entityName.kind === 178 /* PropertyAccessExpression */ || + entityName.parent.kind === 236 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -25928,6 +27402,516 @@ var ts; } return result; } + function createNodeBuilder() { + var context; + return { + typeToTypeNode: function (type, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = typeToTypeNodeHelper(type); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + indexInfoToIndexSignatureDeclaration: function (indexInfo, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + }, + signatureToSignatureDeclaration: function (signature, kind, enclosingDeclaration, flags) { + context = createNodeBuilderContext(enclosingDeclaration, flags); + var resultingNode = signatureToSignatureDeclarationHelper(signature, kind); + var result = context.encounteredError ? undefined : resultingNode; + return result; + } + }; + function createNodeBuilderContext(enclosingDeclaration, flags) { + return { + enclosingDeclaration: enclosingDeclaration, + flags: flags, + encounteredError: false, + inObjectTypeLiteral: false, + checkAlias: true, + symbolStack: undefined + }; + } + function typeToTypeNodeHelper(type) { + if (!type) { + context.encounteredError = true; + // TODO(aozgaa): should we return implict any (undefined) or explicit any (keywordtypenode)? + return undefined; + } + if (type.flags & 1 /* Any */) { + return ts.createKeywordTypeNode(118 /* AnyKeyword */); + } + if (type.flags & 2 /* String */) { + return ts.createKeywordTypeNode(135 /* StringKeyword */); + } + if (type.flags & 4 /* Number */) { + return ts.createKeywordTypeNode(132 /* NumberKeyword */); + } + if (type.flags & 8 /* Boolean */) { + return ts.createKeywordTypeNode(121 /* BooleanKeyword */); + } + if (type.flags & 16 /* Enum */) { + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (type.flags & (32 /* StringLiteral */)) { + return ts.createLiteralTypeNode((ts.createLiteral(type.text))); + } + if (type.flags & (64 /* NumberLiteral */)) { + return ts.createLiteralTypeNode((ts.createNumericLiteral(type.text))); + } + if (type.flags & 128 /* BooleanLiteral */) { + return type.intrinsicName === "true" ? ts.createTrue() : ts.createFalse(); + } + if (type.flags & 256 /* EnumLiteral */) { + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (type.flags & 1024 /* Void */) { + return ts.createKeywordTypeNode(104 /* VoidKeyword */); + } + if (type.flags & 2048 /* Undefined */) { + return ts.createKeywordTypeNode(138 /* UndefinedKeyword */); + } + if (type.flags & 4096 /* Null */) { + return ts.createKeywordTypeNode(94 /* NullKeyword */); + } + if (type.flags & 8192 /* Never */) { + return ts.createKeywordTypeNode(129 /* NeverKeyword */); + } + if (type.flags & 512 /* ESSymbol */) { + return ts.createKeywordTypeNode(136 /* SymbolKeyword */); + } + if (type.flags & 16777216 /* NonPrimitive */) { + return ts.createKeywordTypeNode(133 /* ObjectKeyword */); + } + if (type.flags & 16384 /* TypeParameter */ && type.isThisType) { + if (context.inObjectTypeLiteral) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowThisInObjectLiteral)) { + context.encounteredError = true; + } + } + return ts.createThis(); + } + var objectFlags = getObjectFlags(type); + if (objectFlags & 4 /* Reference */) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + return typeReferenceToTypeNode(type); + } + if (objectFlags & 3 /* ClassOrInterface */) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + // TODO(aozgaa): handle type arguments. + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (type.flags & 16384 /* TypeParameter */) { + var name = symbolToName(type.symbol, /*expectsIdentifier*/ false); + // Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter. + return ts.createTypeReferenceNode(name, /*typeArguments*/ undefined); + } + if (context.checkAlias && type.aliasSymbol) { + var name = symbolToName(type.aliasSymbol, /*expectsIdentifier*/ false); + var typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments); + return ts.createTypeReferenceNode(name, typeArgumentNodes); + } + context.checkAlias = false; + if (type.flags & 65536 /* Union */) { + var formattedUnionTypes = formatUnionTypes(type.types); + var unionTypeNodes = formattedUnionTypes && mapToTypeNodeArray(formattedUnionTypes); + if (unionTypeNodes && unionTypeNodes.length > 0) { + return ts.createUnionOrIntersectionTypeNode(165 /* UnionType */, unionTypeNodes); + } + else { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyUnionOrIntersection)) { + context.encounteredError = true; + } + return undefined; + } + } + if (type.flags & 131072 /* Intersection */) { + return ts.createUnionOrIntersectionTypeNode(166 /* IntersectionType */, mapToTypeNodeArray(type.types)); + } + if (objectFlags & (16 /* Anonymous */ | 32 /* Mapped */)) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + // The type is an object literal type. + return createAnonymousTypeNode(type); + } + if (type.flags & 262144 /* Index */) { + var indexedType = type.type; + var indexTypeNode = typeToTypeNodeHelper(indexedType); + return ts.createTypeOperatorNode(indexTypeNode); + } + if (type.flags & 524288 /* IndexedAccess */) { + var objectTypeNode = typeToTypeNodeHelper(type.objectType); + var indexTypeNode = typeToTypeNodeHelper(type.indexType); + return ts.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); + } + ts.Debug.fail("Should be unreachable."); + function mapToTypeNodeArray(types) { + var result = []; + for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { + var type_1 = types_1[_i]; + var typeNode = typeToTypeNodeHelper(type_1); + if (typeNode) { + result.push(typeNode); + } + } + return result; + } + function createMappedTypeNodeFromType(type) { + ts.Debug.assert(!!(type.flags & 32768 /* Object */)); + var typeParameter = getTypeParameterFromMappedType(type); + var typeParameterNode = typeParameterToDeclaration(typeParameter); + var templateType = getTemplateTypeFromMappedType(type); + var templateTypeNode = typeToTypeNodeHelper(templateType); + var readonlyToken = type.declaration && type.declaration.readonlyToken ? ts.createToken(130 /* ReadonlyKeyword */) : undefined; + var questionToken = type.declaration && type.declaration.questionToken ? ts.createToken(54 /* QuestionToken */) : undefined; + return ts.createMappedTypeNode(readonlyToken, typeParameterNode, questionToken, templateTypeNode); + } + function createAnonymousTypeNode(type) { + var symbol = type.symbol; + if (symbol) { + // Always use 'typeof T' for type of class, enum, and module objects + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || + shouldWriteTypeOfFunctionSymbol()) { + return createTypeQueryNodeFromSymbol(symbol); + } + else if (ts.contains(context.symbolStack, symbol)) { + // If type is an anonymous type literal in a type alias declaration, use type alias name + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + // The specified symbol flags need to be reinterpreted as type flags + var entityName = symbolToName(typeAlias, /*expectsIdentifier*/ false); + return ts.createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + } + else { + return ts.createKeywordTypeNode(118 /* AnyKeyword */); + } + } + else { + // Since instantiations of the same anonymous type have the same symbol, tracking symbols instead + // of types allows us to catch circular references to instantiations of the same anonymous type + if (!context.symbolStack) { + context.symbolStack = []; + } + context.symbolStack.push(symbol); + var result = createTypeNodeFromObjectType(type); + context.symbolStack.pop(); + return result; + } + } + else { + // Anonymous types without a symbol are never circular. + return createTypeNodeFromObjectType(type); + } + function shouldWriteTypeOfFunctionSymbol() { + var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ && + ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32 /* Static */; })); + var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && + (symbol.parent || + ts.forEach(symbol.declarations, function (declaration) { + return declaration.parent.kind === 264 /* SourceFile */ || declaration.parent.kind === 233 /* ModuleBlock */; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + // typeof is allowed only for static/non local functions + return ts.contains(context.symbolStack, symbol); // it is type of the symbol uses itself recursively + } + } + } + function createTypeNodeFromObjectType(type) { + if (type.objectFlags & 32 /* Mapped */) { + if (getConstraintTypeFromMappedType(type).flags & (16384 /* TypeParameter */ | 262144 /* Index */)) { + return createMappedTypeNodeFromType(type); + } + } + var resolved = resolveStructuredTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + return ts.createTypeLiteralNode(/*members*/ undefined); + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + var signature = resolved.callSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 159 /* FunctionType */); + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + var signature = resolved.constructSignatures[0]; + return signatureToSignatureDeclarationHelper(signature, 160 /* ConstructorType */); + } + } + var saveInObjectTypeLiteral = context.inObjectTypeLiteral; + context.inObjectTypeLiteral = true; + var members = createTypeNodesFromResolvedType(resolved); + context.inObjectTypeLiteral = saveInObjectTypeLiteral; + return ts.createTypeLiteralNode(members); + } + function createTypeQueryNodeFromSymbol(symbol) { + var entityName = symbolToName(symbol, /*expectsIdentifier*/ false); + return ts.createTypeQueryNode(entityName); + } + function typeReferenceToTypeNode(type) { + var typeArguments = type.typeArguments || emptyArray; + if (type.target === globalArrayType) { + var elementType = typeToTypeNodeHelper(typeArguments[0]); + return ts.createArrayTypeNode(elementType); + } + else if (type.target.objectFlags & 8 /* Tuple */) { + if (typeArguments.length > 0) { + var tupleConstituentNodes = mapToTypeNodeArray(typeArguments.slice(0, getTypeReferenceArity(type))); + if (tupleConstituentNodes && tupleConstituentNodes.length > 0) { + return ts.createTupleTypeNode(tupleConstituentNodes); + } + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowEmptyTuple)) { + context.encounteredError = true; + } + return undefined; + } + else { + var outerTypeParameters = type.target.outerTypeParameters; + var i = 0; + var qualifiedName = undefined; + if (outerTypeParameters) { + var length_1 = outerTypeParameters.length; + while (i < length_1) { + // Find group of type arguments for type parameters with the same declaring container. + var start = i; + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + do { + i++; + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + // When type parameters are their own type arguments for the whole group (i.e. we have + // the default outer type arguments), we don't show the group. + if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { + var qualifiedNamePart = symbolToName(parent, /*expectsIdentifier*/ true); + if (!qualifiedName) { + qualifiedName = ts.createQualifiedName(qualifiedNamePart, /*right*/ undefined); + } + else { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = qualifiedNamePart; + qualifiedName = ts.createQualifiedName(qualifiedName, /*right*/ undefined); + } + } + } + } + var entityName = undefined; + var nameIdentifier = symbolToName(type.symbol, /*expectsIdentifier*/ true); + if (qualifiedName) { + ts.Debug.assert(!qualifiedName.right); + qualifiedName.right = nameIdentifier; + entityName = qualifiedName; + } + else { + entityName = nameIdentifier; + } + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + var typeArgumentNodes = ts.some(typeArguments) ? mapToTypeNodeArray(typeArguments.slice(i, typeParameterCount - i)) : undefined; + return ts.createTypeReferenceNode(entityName, typeArgumentNodes); + } + } + function createTypeNodesFromResolvedType(resolvedType) { + var typeElements = []; + for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 154 /* CallSignature */)); + } + for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { + var signature = _c[_b]; + typeElements.push(signatureToSignatureDeclarationHelper(signature, 155 /* ConstructSignature */)); + } + if (resolvedType.stringIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.stringIndexInfo, 0 /* String */)); + } + if (resolvedType.numberIndexInfo) { + typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.numberIndexInfo, 1 /* Number */)); + } + var properties = resolvedType.properties; + if (!properties) { + return typeElements; + } + for (var _d = 0, properties_2 = properties; _d < properties_2.length; _d++) { + var propertySymbol = properties_2[_d]; + var propertyType = getTypeOfSymbol(propertySymbol); + var oldDeclaration = propertySymbol.declarations && propertySymbol.declarations[0]; + if (!oldDeclaration) { + return; + } + var propertyName = oldDeclaration.name; + var optionalToken = propertySymbol.flags & 67108864 /* Optional */ ? ts.createToken(54 /* QuestionToken */) : undefined; + if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length) { + var signatures = getSignaturesOfType(propertyType, 0 /* Call */); + for (var _e = 0, signatures_1 = signatures; _e < signatures_1.length; _e++) { + var signature = signatures_1[_e]; + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 149 /* MethodSignature */); + methodDeclaration.name = propertyName; + methodDeclaration.questionToken = optionalToken; + typeElements.push(methodDeclaration); + } + } + else { + // TODO(aozgaa): should we create a node with explicit or implict any? + var propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType) : ts.createKeywordTypeNode(118 /* AnyKeyword */); + typeElements.push(ts.createPropertySignature(propertyName, optionalToken, propertyTypeNode, + /*initializer*/ undefined)); + } + } + return typeElements.length ? typeElements : undefined; + } + } + function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind) { + var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 135 /* StringKeyword */ : 132 /* NumberKeyword */); + var name = ts.getNameFromIndexInfo(indexInfo); + var indexingParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, name, + /*questionToken*/ undefined, indexerTypeNode, + /*initializer*/ undefined); + var typeNode = typeToTypeNodeHelper(indexInfo.type); + return ts.createIndexSignatureDeclaration( + /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(130 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + } + function signatureToSignatureDeclarationHelper(signature, kind) { + var typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter); }); + var parameters = signature.parameters.map(function (parameter) { return symbolToParameterDeclaration(parameter); }); + var returnTypeNode; + if (signature.typePredicate) { + var typePredicate = signature.typePredicate; + var parameterName = typePredicate.kind === 1 /* Identifier */ ? ts.createIdentifier(typePredicate.parameterName) : ts.createThisTypeNode(); + var typeNode = typeToTypeNodeHelper(typePredicate.type); + returnTypeNode = ts.createTypePredicateNode(parameterName, typeNode); + } + else { + var returnType = getReturnTypeOfSignature(signature); + returnTypeNode = returnType && typeToTypeNodeHelper(returnType); + } + var returnTypeNodeExceptAny = returnTypeNode && returnTypeNode.kind !== 118 /* AnyKeyword */ ? returnTypeNode : undefined; + return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNodeExceptAny); + } + function typeParameterToDeclaration(type) { + var constraint = getConstraintFromTypeParameter(type); + var constraintNode = constraint && typeToTypeNodeHelper(constraint); + var defaultParameter = getDefaultFromTypeParameter(type); + var defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter); + var name = symbolToName(type.symbol, /*expectsIdentifier*/ true); + return ts.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); + } + function symbolToParameterDeclaration(parameterSymbol) { + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 145 /* Parameter */); + var parameterType = getTypeOfSymbol(parameterSymbol); + var parameterTypeNode = typeToTypeNodeHelper(parameterType); + // TODO(aozgaa): In the future, check initializer accessibility. + var parameterNode = ts.createParameter(parameterDeclaration.decorators, parameterDeclaration.modifiers, parameterDeclaration.dotDotDotToken && ts.createToken(23 /* DotDotDotToken */), + // Clone name to remove trivia. + ts.getSynthesizedClone(parameterDeclaration.name), parameterDeclaration.questionToken && ts.createToken(54 /* QuestionToken */), parameterTypeNode, parameterDeclaration.initializer); + return parameterNode; + } + function symbolToName(symbol, expectsIdentifier) { + // Try to get qualified name if the symbol is not a type parameter and there is an enclosing declaration. + var chain; + var isTypeParameter = symbol.flags & 262144 /* TypeParameter */; + if (!isTypeParameter && context.enclosingDeclaration) { + chain = getSymbolChain(symbol, 0 /* None */, /*endOfChain*/ true); + ts.Debug.assert(chain && chain.length > 0); + } + else { + chain = [symbol]; + } + if (expectsIdentifier && chain.length !== 1 + && !context.encounteredError + && !(context.flags & ts.NodeBuilderFlags.allowQualifedNameInPlaceOfIdentifier)) { + context.encounteredError = true; + } + return createEntityNameFromSymbolChain(chain, chain.length - 1); + function createEntityNameFromSymbolChain(chain, index) { + ts.Debug.assert(chain && 0 <= index && index < chain.length); + // const parentIndex = index - 1; + var symbol = chain[index]; + var typeParameterString = ""; + if (index > 0) { + var parentSymbol = chain[index - 1]; + var typeParameters = void 0; + if (getCheckFlags(symbol) & 1 /* Instantiated */) { + typeParameters = getTypeParametersOfClassOrInterface(parentSymbol); + } + else { + var targetSymbol = getTargetSymbol(parentSymbol); + if (targetSymbol.flags & (32 /* Class */ | 64 /* Interface */ | 524288 /* TypeAlias */)) { + typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); + } + } + if (typeParameters && typeParameters.length > 0) { + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowTypeParameterInQualifiedName)) { + context.encounteredError = true; + } + var writer = ts.getSingleLineStringWriter(); + var displayBuilder = getSymbolDisplayBuilder(); + displayBuilder.buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, context.enclosingDeclaration, 0); + typeParameterString = writer.string(); + ts.releaseStringWriter(writer); + } + } + var symbolName = getNameOfSymbol(symbol); + var symbolNameWithTypeParameters = typeParameterString.length > 0 ? symbolName + "<" + typeParameterString + ">" : symbolName; + var identifier = ts.createIdentifier(symbolNameWithTypeParameters); + return index > 0 ? ts.createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1), identifier) : identifier; + } + /** @param endOfChain Set to false for recursive calls; non-recursive calls should always output something. */ + function getSymbolChain(symbol, meaning, endOfChain) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, /*useOnlyExternalAliasing*/ false); + var parentSymbol; + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], context.enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + // Go up and add our parent. + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + var parentChain = getSymbolChain(parent, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + if (parentChain) { + parentSymbol = parent; + accessibleSymbolChain = parentChain.concat(accessibleSymbolChain || [symbol]); + } + } + } + if (accessibleSymbolChain) { + return accessibleSymbolChain; + } + if ( + // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols. + endOfChain || + // If a parent symbol is an external module, don't write it. (We prefer just `x` vs `"foo/bar".x`.) + !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) && + // If a parent symbol is an anonymous type, don't write it. + !(symbol.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))) { + return [symbol]; + } + } + function getNameOfSymbol(symbol) { + var declaration = ts.firstOrUndefined(symbol.declarations); + if (declaration) { + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225 /* VariableDeclaration */) { + return ts.declarationNameToString(declaration.parent.name); + } + if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.allowAnonymousIdentifier)) { + context.encounteredError = true; + } + switch (declaration.kind) { + case 198 /* ClassExpression */: + return "(Anonymous class)"; + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return "(Anonymous function)"; + } + } + return symbol.name; + } + } + } function typePredicateToString(typePredicate, enclosingDeclaration, flags) { var writer = ts.getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); @@ -25971,11 +27955,8 @@ var ts; } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { - var node = type.symbol.declarations[0].parent; - while (node.kind === 166 /* ParenthesizedType */) { - node = node.parent; - } - if (node.kind === 228 /* TypeAliasDeclaration */) { + var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 167 /* ParenthesizedType */; }); + if (node.kind === 230 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -25983,29 +27964,32 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 /* ModuleBlock */ && + node.parent.kind === 233 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { return type.flags & 32 /* StringLiteral */ ? "\"" + ts.escapeString(type.text) + "\"" : type.text; } - function getSymbolDisplayBuilder() { - function getNameOfSymbol(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var declaration = symbol.declarations[0]; - if (declaration.name) { - return ts.declarationNameToString(declaration.name); - } - switch (declaration.kind) { - case 197 /* ClassExpression */: - return "(Anonymous class)"; - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - return "(Anonymous function)"; - } + function getNameOfSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + return ts.declarationNameToString(declaration.name); + } + if (declaration.parent && declaration.parent.kind === 225 /* VariableDeclaration */) { + return ts.declarationNameToString(declaration.parent.name); + } + switch (declaration.kind) { + case 198 /* ClassExpression */: + return "(Anonymous class)"; + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return "(Anonymous function)"; } - return symbol.name; } + return symbol.name; + } + function getSymbolDisplayBuilder() { /** * Writes only the name of the symbol out to the writer. Uses the original source text * for the name of the symbol if it is available to match how the user wrote the name. @@ -26047,7 +28031,7 @@ var ts; if (parentSymbol) { // Write type arguments of instantiated class/interface here if (flags & 1 /* WriteTypeParametersOrArguments */) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(symbol) & 1 /* Instantiated */) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { @@ -26075,9 +28059,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent) { + walkSymbol(parent, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26115,7 +28099,7 @@ var ts; function writeType(type, flags) { var nextFlags = flags & ~512 /* InTypeAlias */; // Write undefined/null type as any - if (type.flags & 16015 /* Intrinsic */) { + if (type.flags & 16793231 /* Intrinsic */) { // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && isTypeAny(type) ? "any" @@ -26142,7 +28126,7 @@ var ts; else if (!(flags & 512 /* InTypeAlias */) && type.aliasSymbol && isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === 0 /* Accessible */) { var typeArguments = type.aliasTypeArguments; - writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); + writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, ts.length(typeArguments), nextFlags); } else if (type.flags & 196608 /* UnionOrIntersection */) { writeUnionOrIntersectionType(type, nextFlags); @@ -26223,18 +28207,18 @@ var ts; var outerTypeParameters = type.target.outerTypeParameters; var i = 0; if (outerTypeParameters) { - var length_1 = outerTypeParameters.length; - while (i < length_1) { + var length_2 = outerTypeParameters.length; + while (i < length_2) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26261,7 +28245,8 @@ var ts; var symbol = type.symbol; if (symbol) { // Always use 'typeof T' for type of class, enum, and module objects - if (symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) || + symbol.flags & (384 /* Enum */ | 512 /* ValueModule */)) { writeTypeOfSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -26300,7 +28285,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 /* SourceFile */ || declaration.parent.kind === 231 /* ModuleBlock */; + return declaration.parent.kind === 264 /* SourceFile */ || declaration.parent.kind === 233 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26314,32 +28299,13 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130 /* ReadonlyKeyword */); - writeSpace(writer); - } - writePunctuation(writer, 20 /* OpenBracketToken */); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21 /* CloseBracketToken */); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeType(info.type, 0 /* None */); - writePunctuation(writer, 24 /* SemicolonToken */); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130 /* ReadonlyKeyword */); writeSpace(writer); } buildSymbolDisplay(prop, writer); - if (prop.flags & 536870912 /* Optional */) { + if (prop.flags & 67108864 /* Optional */) { writePunctuation(writer, 54 /* QuestionToken */); } } @@ -26416,15 +28382,15 @@ var ts; writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134 /* StringKeyword */); - writeIndexSignature(resolved.numberIndexInfo, 132 /* NumberKeyword */); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0 /* String */, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1 /* Number */, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0 /* Call */); - for (var _f = 0, signatures_1 = signatures; _f < signatures_1.length; _f++) { - var signature = signatures_1[_f]; + for (var _f = 0, signatures_2 = signatures; _f < signatures_2.length; _f++) { + var signature = signatures_2[_f]; writePropertyWithModifiers(p); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); writePunctuation(writer, 24 /* SemicolonToken */); @@ -26483,33 +28449,44 @@ var ts; writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } + var defaultType = getDefaultFromTypeParameter(tp); + if (defaultType) { + writeSpace(writer); + writePunctuation(writer, 57 /* EqualsToken */); + writeSpace(writer); + buildTypeDisplay(defaultType, writer, enclosingDeclaration, flags, symbolStack); + } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; - if (ts.isRestParameter(parameterNode)) { + if (parameterNode ? ts.isRestParameter(parameterNode) : isTransientSymbol(p) && p.isRestParameter) { writePunctuation(writer, 23 /* DotDotDotToken */); } - if (ts.isBindingPattern(parameterNode.name)) { + if (parameterNode && ts.isBindingPattern(parameterNode.name)) { buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); } else { appendSymbolNameOnly(p, writer); } - if (isOptionalParameter(parameterNode)) { + if (parameterNode && isOptionalParameter(parameterNode)) { writePunctuation(writer, 54 /* QuestionToken */); } writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); - buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); + var type = getTypeOfSymbol(p); + if (parameterNode && isRequiredInitializedParameter(parameterNode)) { + type = includeFalsyTypes(type, 2048 /* Undefined */); + } + buildTypeDisplay(type, writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. - if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { writePunctuation(writer, 16 /* OpenBraceToken */); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 17 /* CloseBraceToken */); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { writePunctuation(writer, 20 /* OpenBracketToken */); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); @@ -26523,9 +28500,9 @@ var ts; if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */); + ts.Debug.assert(bindingElement.kind === 175 /* BindingElement */); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); } @@ -26597,6 +28574,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 /* SuppressAnyReturnType */ && isTypeAny(returnType)) { + return; + } if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); writePunctuation(writer, 35 /* EqualsGreaterThanToken */); @@ -26609,7 +28590,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -26629,6 +28609,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130 /* ReadonlyKeyword */); + writeSpace(writer); + } + writePunctuation(writer, 20 /* OpenBracketToken */); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + switch (kind) { + case 1 /* Number */: + writeKeyword(writer, 132 /* NumberKeyword */); + break; + case 0 /* String */: + writeKeyword(writer, 135 /* StringKeyword */); + break; + } + writePunctuation(writer, 21 /* CloseBracketToken */); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24 /* SemicolonToken */); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -26639,6 +28645,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -26653,75 +28660,76 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 174 /* BindingElement */: + case 175 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } - // Otherwise fall through - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 225 /* FunctionDeclaration */: - case 229 /* EnumDeclaration */: - case 234 /* ImportEqualsDeclaration */: + // falls through + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 227 /* FunctionDeclaration */: + case 231 /* EnumDeclaration */: + case 236 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 236 /* ImportEqualsDeclaration */ && parent.kind !== 264 /* SourceFile */ && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_7); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + return isDeclarationVisible(parent); + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.getModifierFlags(node) & (8 /* Private */ | 16 /* Protected */)) { // Private/protected properties/methods are not visible return false; } - // Public properties/methods are visible if its parents are visible, so const it fall into next case statement - case 150 /* Constructor */: - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: - case 144 /* Parameter */: - case 231 /* ModuleBlock */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 157 /* TypeReference */: - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: + // Public properties/methods are visible if its parents are visible, so: + // falls through + case 151 /* Constructor */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: + case 145 /* Parameter */: + case 233 /* ModuleBlock */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 158 /* TypeReference */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: return false; // Type parameters are always visible - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: // Source file and namespace export are always visible - case 261 /* SourceFile */: - case 233 /* NamespaceExportDeclaration */: + case 264 /* SourceFile */: + case 235 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return false; default: return false; @@ -26730,10 +28738,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 242 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243 /* ExportSpecifier */) { + else if (node.parent.kind === 245 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -26778,8 +28786,8 @@ var ts; var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); if (resolutionCycleStartIndex >= 0) { // A cycle was found - var length_2 = resolutionTargets.length; - for (var i = resolutionCycleStartIndex; i < length_2; i++) { + var length_3 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_3; i++) { resolutionResults[i] = false; } return false; @@ -26823,21 +28831,20 @@ var ts; return resolutionResults.pop(); } function getDeclarationContainer(node) { - node = ts.getRootDeclaration(node); - while (node) { + node = ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 223 /* VariableDeclaration */: - case 224 /* VariableDeclarationList */: - case 239 /* ImportSpecifier */: - case 238 /* NamedImports */: - case 237 /* NamespaceImport */: - case 236 /* ImportClause */: - node = node.parent; - break; + case 225 /* VariableDeclaration */: + case 226 /* VariableDeclarationList */: + case 241 /* ImportSpecifier */: + case 240 /* NamedImports */: + case 239 /* NamespaceImport */: + case 238 /* ImportClause */: + return false; default: - return node.parent; + return true; } - } + }); + return node && node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -26855,9 +28862,6 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192 /* Never */) !== 0; - } // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node) { @@ -26865,24 +28869,29 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } function isComputedNonLiteralName(name) { - return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); + return name.kind === 143 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); } function getRestType(source, properties, symbol) { - ts.Debug.assert(!!(source.flags & 32768 /* Object */), "Rest types only support object types right now."); + source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (source.flags & 8192 /* Never */) { + return emptyObjectType; + } + if (source.flags & 65536 /* Union */) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } var members = ts.createMap(); var names = ts.createMap(); - for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_17 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_17)] = true; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var name = properties_3[_i]; + names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = prop.name in names; + var inNamesToRemove = names.has(prop.name); var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */); - var isMethod = prop.flags & 8192 /* Method */; var isSetOnlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { + members.set(prop.name, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0 /* String */); @@ -26907,9 +28916,9 @@ var ts; return parentType; } var type; - if (pattern.kind === 172 /* ObjectBindingPattern */) { + if (pattern.kind === 173 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & 32768 /* Object */)) { + if (!isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } @@ -26924,8 +28933,8 @@ var ts; } else { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name_18 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_18)) { + var name = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name)) { // computed properties with non-literal names are treated as 'any' return anyType; } @@ -26934,12 +28943,12 @@ var ts; } // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - var text = ts.getTextOfPropertyName(name_18); + var text = ts.getTextOfPropertyName(name); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { - error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } @@ -26948,7 +28957,7 @@ var ts; // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false); + var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false, /*allowAsyncIterable*/ false); if (declaration.dotDotDotToken) { // Rest element has an array type with the same element type as the parent type type = createArrayType(elementType); @@ -26979,7 +28988,7 @@ var ts; getUnionType([type, checkExpressionCached(declaration.initializer)], /*subtypeReduction*/ true) : type; } - function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { + function getTypeForDeclarationFromJSDocComment(declaration) { var jsdocType = ts.getJSDocType(declaration); if (jsdocType) { return getTypeFromTypeNode(jsdocType); @@ -26992,44 +29001,46 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 175 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 176 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048 /* Undefined */) : type; } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { // If this is a variable in a JavaScript file, then use the JSDoc type (if it has // one as its type), otherwise fallback to the below standard TS codepaths to // try to figure it out. - var type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration); + var type = getTypeForDeclarationFromJSDocComment(declaration); if (type && type !== unknownType) { return type; } } // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (declaration.parent.parent.kind === 212 /* ForInStatement */) { + if (declaration.parent.parent.kind === 214 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 215 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, // or it may have led to an error inside getElementTypeOfIterable. - return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; + var forOfStatement = declaration.parent.parent; + return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } // Use type from type annotation if one is present if (declaration.type) { - return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); + var declaredType = getTypeFromTypeNode(declaration.type); + return addOptionality(declaredType, /*optional*/ declaration.questionToken && includeOptionality); } - if ((compilerOptions.noImplicitAny || declaration.flags & 2097152 /* JavaScriptFile */) && - declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + if ((noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && + declaration.kind === 225 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -27043,11 +29054,11 @@ var ts; return autoArrayType; } } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 152 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151 /* GetAccessor */); + if (func.kind === 153 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 152 /* GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -27076,8 +29087,13 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); } + if (ts.isJsxAttribute(declaration)) { + // if JSX attribute doesn't have initializer, by default the attribute will have boolean value of true. + // I.e is sugar for + return trueType; + } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 258 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 261 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27087,6 +29103,38 @@ var ts; // No type specified and nothing can be inferred return undefined; } + function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol) { + var types = []; + var definedInConstructor = false; + var definedInMethod = false; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + var expression = declaration.kind === 193 /* BinaryExpression */ ? declaration : + declaration.kind === 178 /* PropertyAccessExpression */ ? ts.getAncestor(declaration, 193 /* BinaryExpression */) : + undefined; + if (!expression) { + return unknownType; + } + if (ts.isPropertyAccessExpression(expression.left) && expression.left.expression.kind === 98 /* ThisKeyword */) { + if (ts.getThisContainer(expression, /*includeArrowFunctions*/ false).kind === 151 /* Constructor */) { + definedInConstructor = true; + } + else { + definedInMethod = true; + } + } + if (expression.flags & 65536 /* JavaScriptFile */) { + // If there is a JSDoc type, use it + var type = getTypeForDeclarationFromJSDocComment(expression.parent); + if (type && type !== unknownType) { + types.push(getWidenedType(type)); + continue; + } + } + types.push(getWidenedLiteralType(checkExpressionCached(expression.right))); + } + return getWidenedType(addOptionality(getUnionType(types, /*subtypeReduction*/ true), definedInMethod && !definedInConstructor)); + } // Return the type implied by a binding pattern element. This is the type of the initializer of the element if // one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding // pattern. Otherwise, it is the type any. @@ -27097,7 +29145,7 @@ var ts; if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); } - if (reportErrors && compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + if (reportErrors && noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAnyError(element, anyType); } return anyType; @@ -27105,22 +29153,27 @@ var ts; // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { - // do not include computed properties or rests in the implied type + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); + return; + } var text = ts.getTextOfPropertyName(name); - var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); + var flags = 4 /* Property */ | (e.initializer ? 67108864 /* Optional */ : 0); var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -27153,7 +29206,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 172 /* ObjectBindingPattern */ + return pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -27175,7 +29228,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 257 /* PropertyAssignment */) { + if (declaration.kind === 260 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27183,7 +29236,7 @@ var ts; // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration - if (reportErrors && compilerOptions.noImplicitAny) { + if (reportErrors && noImplicitAny) { if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } @@ -27192,14 +29245,14 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 144 /* Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 145 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { // Handle prototype property - if (symbol.flags & 134217728 /* Prototype */) { + if (symbol.flags & 16777216 /* Prototype */) { return links.type = getTypeOfPrototypeProperty(symbol); } // Handle catch clause variables @@ -27208,10 +29261,10 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 240 /* ExportAssignment */) { + if (declaration.kind === 242 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 2097152 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 290 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27224,36 +29277,15 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 192 /* BinaryExpression */ || - declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) { - // Use JS Doc type if present on parent expression statement - if (declaration.flags & 2097152 /* JavaScriptFile */) { - var jsdocType = ts.getJSDocType(declaration.parent); - if (jsdocType) { - return links.type = getTypeFromTypeNode(jsdocType); - } - } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ? - checkExpressionCached(decl.right) : - checkExpressionCached(decl.parent.right); }); - type = getUnionType(declaredTypes, /*subtypeReduction*/ true); + if (declaration.kind === 193 /* BinaryExpression */ || + declaration.kind === 178 /* PropertyAccessExpression */ && declaration.parent.kind === 193 /* BinaryExpression */) { + type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } else { type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - // Variable has type annotation that circularly references the variable itself - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - // Variable has initializer that circularly references the variable itself - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -27261,7 +29293,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 151 /* GetAccessor */) { + if (accessor.kind === 152 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -27281,10 +29313,10 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */); - if (getter && getter.flags & 2097152 /* JavaScriptFile */) { - var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + var getter = ts.getDeclarationOfKind(symbol, 152 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 153 /* SetAccessor */); + if (getter && getter.flags & 65536 /* JavaScriptFile */) { + var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; } @@ -27310,7 +29342,7 @@ var ts; type = getReturnTypeFromBody(getter); } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { if (setter) { error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); } @@ -27325,8 +29357,8 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); + if (noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 152 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -27334,6 +29366,10 @@ var ts; } return links.type; } + function getBaseTypeVariableOfClass(symbol) { + var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); + return baseConstructorType.flags & 540672 /* TypeVariable */ ? baseConstructorType : undefined; + } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { @@ -27342,8 +29378,13 @@ var ts; } else { var type = createObjectType(16 /* Anonymous */, symbol); - links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? - includeFalsyTypes(type, 2048 /* Undefined */) : type; + if (symbol.flags & 32 /* Class */) { + var baseTypeVariable = getBaseTypeVariableOfClass(symbol); + links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; + } + else { + links.type = strictNullChecks && symbol.flags & 67108864 /* Optional */ ? includeFalsyTypes(type, 2048 /* Undefined */) : type; + } } } return links.type; @@ -27373,12 +29414,39 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (symbolInstantiationDepth === 100) { + error(symbol.valueDeclaration, ts.Diagnostics.Generic_type_instantiation_is_excessively_deep_and_possibly_infinite); + links.type = unknownType; + } + else { + if (!pushTypeResolution(symbol, 0 /* Type */)) { + return unknownType; + } + symbolInstantiationDepth++; + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + symbolInstantiationDepth--; + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; + } } return links.type; } + function reportCircularityError(symbol) { + // Check if variable has type annotation that circularly references the variable itself + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + // Otherwise variable has initializer that circularly references the variable itself + if (noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(symbol) & 1 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); } if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) { @@ -27398,22 +29466,33 @@ var ts; } return unknownType; } + function isReferenceToType(type, target) { + return type !== undefined + && target !== undefined + && (getObjectFlags(type) & 4 /* Reference */) !== 0 + && type.target === target; + } function getTargetType(type) { return getObjectFlags(type) & 4 /* Reference */ ? type.target : type; } function hasBaseType(type, checkBase) { return check(type); function check(type) { - var target = getTargetType(type); - return target === checkBase || ts.forEach(getBaseTypes(target), check); + if (getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */)) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(getBaseTypes(target), check); + } + else if (type.flags & 131072 /* Intersection */) { + return ts.forEach(type.types, check); + } } } // Appends the type parameters given by a list of declarations to a set of type parameters and returns the resulting set. // The function allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set // in-place and returns the same array. function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { - var declaration = declarations_2[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -27433,9 +29512,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || - node.kind === 225 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) { + if (node.kind === 228 /* ClassDeclaration */ || node.kind === 198 /* ClassExpression */ || + node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */ || node.kind === 186 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -27445,8 +29524,8 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); - return appendOuterTypeParameters(undefined, declaration); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); + return appendOuterTypeParameters(/*typeParameters*/ undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, // interface, or type alias. @@ -27454,8 +29533,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 226 /* ClassDeclaration */ || - node.kind === 197 /* ClassExpression */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */ || node.kind === 228 /* ClassDeclaration */ || + node.kind === 198 /* ClassExpression */ || node.kind === 230 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -27469,29 +29548,50 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } + // A type is a mixin constructor if it has a single construct signature taking no type parameters and a single + // rest parameter of type any[]. + function isMixinConstructorType(type) { + var signatures = getSignaturesOfType(type, 1 /* Construct */); + if (signatures.length === 1) { + var s = signatures[0]; + return !s.typeParameters && s.parameters.length === 1 && s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType; + } + return false; + } function isConstructorType(type) { - return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 1 /* Construct */).length > 0; + if (isValidBaseType(type) && getSignaturesOfType(type, 1 /* Construct */).length > 0) { + return true; + } + if (type.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(type); + return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint); + } + return false; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); } - function getConstructorsForTypeArguments(type, typeArgumentNodes) { - var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; - return ts.filter(getSignaturesOfType(type, 1 /* Construct */), function (sig) { return (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount; }); + function getConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var typeArgCount = ts.length(typeArgumentNodes); + var isJavaScript = ts.isInJavaScriptFile(location); + return ts.filter(getSignaturesOfType(type, 1 /* Construct */), function (sig) { return (isJavaScript || typeArgCount >= getMinTypeArgumentCount(sig.typeParameters)) && typeArgCount <= ts.length(sig.typeParameters); }); } - function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { - var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); + function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes, location) { + var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes, location); if (typeArgumentNodes) { var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); } return signatures; } - // The base constructor of a class can resolve to - // undefinedType if the class has no extends clause, - // unknownType if an error occurred during resolution of the extends expression, - // nullType if the extends expression is the null value, or - // an object type with at least one construct signature. + /** + * The base constructor of a class can resolve to + * * undefinedType if the class has no extends clause, + * * unknownType if an error occurred during resolution of the extends expression, + * * nullType if the extends expression is the null value, + * * anyType if the extends expression has type any, or + * * an object type with at least one construct signature. + */ function getBaseConstructorTypeOfClass(type) { if (!type.resolvedBaseConstructorType) { var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27502,7 +29602,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */)) { // Resolving the members of a class requires us to resolve the base class of that class. // We force resolution here such that we catch circularities now. resolveStructuredTypeMembers(baseConstructorType); @@ -27511,7 +29611,7 @@ var ts; error(type.symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); return type.resolvedBaseConstructorType = unknownType; } - if (baseConstructorType !== unknownType && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { + if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { error(baseTypeNode.expression, ts.Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); return type.resolvedBaseConstructorType = unknownType; } @@ -27540,8 +29640,8 @@ var ts; } function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; - var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 32768 /* Object */)) { + var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); + if (!(baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */ | 1 /* Any */))) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27554,11 +29654,14 @@ var ts; // type arguments in the same manner as a type reference to get the same error reporting experience. baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol); } + else if (baseConstructorType.flags & 1 /* Any */) { + baseType = baseConstructorType; + } else { // The class derives from a "class-like" constructor function, check that we have at least one construct signature // with a matching number of type parameters and use the return type of the first instantiated signature. Elsewhere // we check that all instantiated signatures return the same type. - var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); if (!constructors.length) { error(baseTypeNode.expression, ts.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return; @@ -27576,7 +29679,7 @@ var ts; if (baseType === unknownType) { return; } - if (!(getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */)) { + if (!isValidBaseType(baseType)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); return; } @@ -27602,16 +29705,22 @@ var ts; } return true; } + // A valid base type is `any`, any non-generic object type or intersection of non-generic + // object types. + function isValidBaseType(type) { + return type.flags & (32768 /* Object */ | 16777216 /* NonPrimitive */ | 1 /* Any */) && !isGenericMappedType(type) || + type.flags & 131072 /* Intersection */ && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); + } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 229 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */) { + if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -27638,7 +29747,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */) { + if (declaration.kind === 229 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -27676,7 +29785,7 @@ var ts; type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -27695,7 +29804,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 289 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -27706,7 +29815,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228 /* TypeAliasDeclaration */); + declaration = ts.getDeclarationOfKind(symbol, 230 /* TypeAliasDeclaration */); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -27716,7 +29825,7 @@ var ts; // an instantiation of the type alias with the type parameters supplied as type arguments. links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -27733,14 +29842,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */ || - expr.kind === 70 /* Identifier */ && !!symbol.exports[expr.text]; + expr.kind === 70 /* Identifier */ && !!symbol.exports.get(expr.text); } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -27765,10 +29874,10 @@ var ts; enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { var memberTypeList = []; - var memberTypes = ts.createMap(); + var memberTypes = []; for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 231 /* EnumDeclaration */) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -27785,7 +29894,7 @@ var ts; if (memberTypeList.length > 1) { enumType.flags |= 65536 /* Union */; enumType.types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -27806,9 +29915,6 @@ var ts; if (!links.declaredType) { var type = createType(16384 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -27821,7 +29927,6 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0); if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { return getDeclaredTypeOfClassOrInterface(symbol); } @@ -27860,19 +29965,20 @@ var ts; function isIndependentType(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 171 /* LiteralType */: + case 172 /* LiteralType */: return true; - case 162 /* ArrayType */: + case 163 /* ArrayType */: return isIndependentType(node.elementType); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -27885,7 +29991,7 @@ var ts; // A function-like declaration is considered independent (free of this references) if it has a return type // annotation that is considered independent and if each parameter is considered independent. function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 150 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 151 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -27906,12 +30012,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -27922,7 +30028,7 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -27932,15 +30038,15 @@ var ts; var result = ts.createMap(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -27948,8 +30054,8 @@ var ts; if (!type.declaredProperties) { var symbol = type.symbol; type.declaredProperties = getNamedMembers(symbol.members); - type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); type.declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); type.declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); } @@ -27957,7 +30063,14 @@ var ts; } function getTypeWithThisArgument(type, thisArgument) { if (getObjectFlags(type) & 4 /* Reference */) { - return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + var target = type.target; + var typeArguments = type.typeArguments; + if (ts.length(target.typeParameters) === ts.length(typeArguments)) { + return createTypeReference(target, ts.concatenate(typeArguments, [thisArgument || target.thisType])); + } + } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, function (t) { return getTypeWithThisArgument(t, thisArgument); })); } return type; } @@ -27993,10 +30106,14 @@ var ts; for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { var baseType = baseTypes_1[_i]; var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType)); callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */)); constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */)); - stringIndexInfo = stringIndexInfo || getIndexInfoOfType(instantiatedBaseType, 0 /* String */); + if (!stringIndexInfo) { + stringIndexInfo = instantiatedBaseType === anyType ? + createIndexInfo(anyType, /*isReadonly*/ false) : + getIndexInfoOfType(instantiatedBaseType, 0 /* String */); + } numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1 /* Number */); } } @@ -28035,14 +30152,16 @@ var ts; return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); + var isJavaScript = ts.isInJavaScriptFile(baseTypeNode); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); - var typeArgCount = typeArguments ? typeArguments.length : 0; + var typeArgCount = ts.length(typeArguments); var result = []; for (var _i = 0, baseSignatures_1 = baseSignatures; _i < baseSignatures_1.length; _i++) { var baseSig = baseSignatures_1[_i]; - var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; - if (typeParamCount === typeArgCount) { - var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + var minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters); + var typeParamCount = ts.length(baseSig.typeParameters); + if ((isJavaScript || typeArgCount >= minTypeArgumentCount) && typeArgCount <= typeParamCount) { + var sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, baseTypeNode)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; sig.resolvedReturnType = classType; result.push(sig); @@ -28105,7 +30224,7 @@ var ts; s = cloneSignature(signature); if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) { var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return getTypeOfSymbol(sig.thisParameter) || anyType; }), /*subtypeReduction*/ true); - s.thisParameter = createTransientSymbol(signature.thisParameter, thisType); + s.thisParameter = createSymbolWithType(signature.thisParameter, thisType); } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; @@ -28121,8 +30240,8 @@ var ts; function getUnionIndexInfo(types, kind) { var indexTypes = []; var isAnyReadonly = false; - for (var _i = 0, types_1 = types; _i < types_1.length; _i++) { - var type = types_1[_i]; + for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { + var type = types_2[_i]; var indexInfo = getIndexInfoOfType(type, kind); if (!indexInfo) { return undefined; @@ -28150,22 +30269,57 @@ var ts; function unionSpreadIndexInfos(info1, info2) { return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); } + function includeMixinType(type, types, index) { + var mixedTypes = []; + for (var i = 0; i < types.length; i++) { + if (i === index) { + mixedTypes.push(type); + } + else if (isMixinConstructorType(types[i])) { + mixedTypes.push(getReturnTypeOfSignature(getSignaturesOfType(types[i], 1 /* Construct */)[0])); + } + } + return getIntersectionType(mixedTypes); + } function resolveIntersectionTypeMembers(type) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). var callSignatures = emptyArray; var constructSignatures = emptyArray; - var stringIndexInfo = undefined; - var numberIndexInfo = undefined; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; + var stringIndexInfo; + var numberIndexInfo; + var types = type.types; + var mixinCount = ts.countWhere(types, isMixinConstructorType); + var _loop_3 = function (i) { + var t = type.types[i]; + // When an intersection type contains mixin constructor types, the construct signatures from + // those types are discarded and their return types are mixed into the return types of all + // other construct signatures in the intersection type. For example, the intersection type + // '{ new(...args: any[]) => A } & { new(s: string) => B }' has a single construct signature + // 'new(s: string) => A & B'. + if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { + var signatures = getSignaturesOfType(t, 1 /* Construct */); + if (signatures.length && mixinCount > 0) { + signatures = ts.map(signatures, function (s) { + var clone = cloneSignature(s); + clone.resolvedReturnType = includeMixinType(getReturnTypeOfSignature(s), types, i); + return clone; + }); + } + constructSignatures = ts.concatenate(constructSignatures, signatures); + } callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(t, 0 /* Call */)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(t, 1 /* Construct */)); stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */)); + }; + for (var i = 0; i < types.length; i++) { + _loop_3(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } + /** + * Converts an AnonymousType to a ResolvedType. + */ function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (type.target) { @@ -28178,8 +30332,8 @@ var ts; } else if (symbol.flags & 2048 /* TypeLiteral */) { var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var callSignatures = getSignaturesOfSymbol(members.get("__call")); + var constructSignatures = getSignaturesOfSymbol(members.get("__new")); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -28188,23 +30342,27 @@ var ts; // Combinations of function, class, enum and module var members = emptySymbols; var constructSignatures = emptyArray; - if (symbol.flags & 1952 /* HasExports */) { + var stringIndexInfo = undefined; + if (symbol.exports) { members = getExportsOfSymbol(symbol); } if (symbol.flags & 32 /* Class */) { var classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 32768 /* Object */) { + if (baseConstructorType.flags & (32768 /* Object */ | 131072 /* Intersection */ | 540672 /* TypeVariable */)) { members = createSymbolTable(getNamedMembers(members)); - addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); + addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); + } + else if (baseConstructorType === anyType) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); } } var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined; - setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, constructSignatures, stringIndexInfo, numberIndexInfo); // We resolve the members before computing the signatures because a signature may use // typeof with a qualified name expression that circularly references the type we are // in the process of resolving (see issue #6072). The temporarily empty signature list @@ -28218,7 +30376,6 @@ var ts; function resolveMappedTypeMembers(type) { var members = ts.createMap(); var stringIndexInfo; - var numberIndexInfo; // Resolve upfront such that recursive references see an empty object type. setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); // In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type, @@ -28226,43 +30383,53 @@ var ts; var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); - var isReadonly = !!type.declaration.readonlyToken; - var isOptional = !!type.declaration.questionToken; - // First, if the constraint type is a type parameter, obtain the base constraint. Then, - // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. - // Finally, iterate over the constituents of the resulting iteration type. - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentType(constraintType) : constraintType; - var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; - forEachType(iterationType, function (t) { + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); // The 'T' in 'keyof T' + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 169 /* TypeOperator */) { + // We have a { [P in keyof T]: X } + for (var _i = 0, _a = getPropertiesOfType(modifiersType); _i < _a.length; _i++) { + var propertySymbol = _a[_i]; + addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); + } + if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + addMemberForKeyType(stringType); + } + } + else { + // First, if the constraint type is a type parameter, obtain the base constraint. Then, + // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. + // Finally, iterate over the constituents of the resulting iteration type. + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t, propertySymbol) { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. - var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); - // If the current iteration type constituent is a literal type, create a property. - // Otherwise, for type string create a string index signature and for type number - // create a numeric index signature. - if (t.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */)) { + // If the current iteration type constituent is a string literal type, create a property. + // Otherwise, for type string create a string index signature. + if (t.flags & 32 /* StringLiteral */) { var propName = t.text; - var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; - members[propName] = prop; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 67108864 /* Optional */); + var prop = createSymbol(4 /* Property */ | (isOptional ? 67108864 /* Optional */ : 0), propName); + prop.checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? 8 /* Readonly */ : 0; + prop.type = propType; + if (propertySymbol) { + prop.syntheticOrigin = propertySymbol; + } + members.set(propName, prop); } else if (t.flags & 2 /* String */) { - stringIndexInfo = createIndexInfo(propType, isReadonly); - } - else if (t.flags & 4 /* Number */) { - numberIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } - }); - // If we created both a string and a numeric string index signature, and if the two index - // signatures have identical types, discard the redundant numeric index signature. - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeParameterFromMappedType(type) { return type.typeParameter || @@ -28275,16 +30442,34 @@ var ts; function getTemplateTypeFromMappedType(type) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } - function getErasedTemplateTypeFromMappedType(type) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 169 /* TypeOperator */) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint && constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; } function isGenericMappedType(type) { if (getObjectFlags(type) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (16384 /* TypeParameter */ | 262144 /* Index */)); + return maybeTypeOfKind(constraintType, 540672 /* TypeVariable */ | 262144 /* Index */); } return false; } @@ -28321,42 +30506,40 @@ var ts; return emptyArray; } /** If the given type is an object type and that type has a property by the given name, - * return the symbol for that property. Otherwise return undefined. */ + * return the symbol for that property. Otherwise return undefined. + */ function getPropertyOfObjectType(type, name) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } } } function getPropertiesOfUnionOrIntersectionType(type) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var current = _a[_i]; - for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { - var prop = _c[_b]; - getUnionOrIntersectionProperty(type, prop.name); - } - // The properties of a union type are those that are present in all constituent types, so - // we only need to check the properties of the first type - if (type.flags & 65536 /* Union */) { - break; - } - } - var props = type.resolvedProperties; - if (props) { - var result = []; - for (var key in props) { - var prop = props[key]; - // We need to filter out partial properties in union types - if (!(prop.flags & 268435456 /* SyntheticProperty */ && prop.isPartial)) { - result.push(prop); + if (!type.resolvedProperties) { + var members = ts.createMap(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var current = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!members.has(prop.name)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (combinedProp) { + members.set(prop.name, combinedProp); + } + } + } + // The properties of a union type are those that are present in all constituent types, so + // we only need to check the properties of the first type + if (type.flags & 65536 /* Union */) { + break; } } - return result; + type.resolvedProperties = getNamedMembers(members); } - return emptyArray; + return type.resolvedProperties; } function getPropertiesOfType(type) { type = getApparentType(type); @@ -28364,25 +30547,114 @@ var ts; getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } + function getConstraintOfType(type) { + return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : + type.flags & 524288 /* IndexedAccess */ ? getConstraintOfIndexedAccess(type) : + getBaseConstraintOfType(type); + } + function getConstraintOfTypeParameter(typeParameter) { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + function getConstraintOfIndexedAccess(type) { + var baseObjectType = getBaseConstraintOfType(type.objectType); + var baseIndexType = getBaseConstraintOfType(type.indexType); + return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; + } + function getBaseConstraintOfType(type) { + if (type.flags & (540672 /* TypeVariable */ | 196608 /* UnionOrIntersection */)) { + var constraint = getResolvedBaseConstraint(type); + if (constraint !== noConstraintType && constraint !== circularConstraintType) { + return constraint; + } + } + else if (type.flags & 262144 /* Index */) { + return stringType; + } + return undefined; + } + function hasNonCircularBaseConstraint(type) { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } /** - * The apparent type of a type parameter is the base constraint instantiated with the type parameter - * as the type argument for the 'this' type. + * Return the resolved base constraint of a type variable. The noConstraintType singleton is returned if the + * type variable has no constraint, and the circularConstraintType singleton is returned if the constraint + * circularly references the type variable. */ - function getApparentTypeOfTypeParameter(type) { - if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); - while (constraintType && constraintType.flags & 16384 /* TypeParameter */) { - constraintType = getConstraintOfTypeParameter(constraintType); + function getResolvedBaseConstraint(type) { + var typeStack; + var circular; + if (!type.resolvedBaseConstraint) { + typeStack = []; + var constraint = getBaseConstraint(type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + } + return type.resolvedBaseConstraint; + function getBaseConstraint(t) { + if (ts.contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + var result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + function computeBaseConstraint(t) { + if (t.flags & 16384 /* TypeParameter */) { + var constraint = getConstraintFromTypeParameter(t); + return t.isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & 196608 /* UnionOrIntersection */) { + var types = t.types; + var baseTypes = []; + for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { + var type_2 = types_3[_i]; + var baseType = getBaseConstraint(type_2); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & 65536 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & 131072 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + if (t.flags & 262144 /* Index */) { + return stringType; + } + if (t.flags & 524288 /* IndexedAccess */) { + var baseObjectType = getBaseConstraint(t.objectType); + var baseIndexType = getBaseConstraint(t.indexType); + var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; } - return type.resolvedApparentType; + } + function getApparentTypeOfIntersectionType(type) { + return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(type, type)); } /** - * The apparent type of an indexed access T[K] is the type of T's string index signature, if any. + * Gets the default type for a type parameter. + * + * If the type parameter is the result of an instantiation, this gets the instantiated + * default type of its target. If the type parameter has no default type, `undefined` + * is returned. + * + * This function *does not* perform a circularity check. */ - function getApparentTypeOfIndexedAccess(type) { - return getIndexTypeOfType(getApparentType(type.objectType), 0 /* String */) || type; + function getDefaultFromTypeParameter(typeParameter) { + if (!typeParameter.default) { + if (typeParameter.target) { + var targetDefault = getDefaultFromTypeParameter(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType; + } + else { + var defaultDeclaration = typeParameter.symbol && ts.forEach(typeParameter.symbol.declarations, function (decl) { return ts.isTypeParameter(decl) && decl.default; }); + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; + } + } + return typeParameter.default === noConstraintType ? undefined : typeParameter.default; } /** * For a type parameter, return the base constraint of the type parameter. For the string, number, @@ -28390,28 +30662,31 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - var t = type.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(type) : - type.flags & 524288 /* IndexedAccess */ ? getApparentTypeOfIndexedAccess(type) : - type; - return t.flags & 262178 /* StringLike */ ? globalStringType : - t.flags & 340 /* NumberLike */ ? globalNumberType : - t.flags & 136 /* BooleanLike */ ? globalBooleanType : - t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : - t; + var t = type.flags & 540672 /* TypeVariable */ ? getBaseConstraintOfType(type) || emptyObjectType : type; + return t.flags & 131072 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : + t.flags & 262178 /* StringLike */ ? globalStringType : + t.flags & 340 /* NumberLike */ ? globalNumberType : + t.flags & 136 /* BooleanLike */ ? globalBooleanType : + t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) : + t.flags & 16777216 /* NonPrimitive */ ? emptyObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { - var types = containingType.types; var props; + var types = containingType.types; + var isUnion = containingType.flags & 65536 /* Union */; + var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0; // Flags we want to propagate to the result if they exist in all source symbols - var commonFlags = (containingType.flags & 131072 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; - var isReadonly = false; - var isPartial = false; - for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { - var current = types_2[_i]; + var commonFlags = isUnion ? 0 /* None */ : 67108864 /* Optional */; + var syntheticFlag = 4 /* SyntheticMethod */; + var checkFlags = 0; + for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { + var current = types_4[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { + var modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; + if (prop && !(modifiers & excludeModifiers)) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -28419,25 +30694,29 @@ var ts; else if (!ts.contains(props, prop)) { props.push(prop); } - if (isReadonlySymbol(prop)) { - isReadonly = true; + checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) | + (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 64 /* ContainsPublic */ : 0) | + (modifiers & 16 /* Protected */ ? 128 /* ContainsProtected */ : 0) | + (modifiers & 8 /* Private */ ? 256 /* ContainsPrivate */ : 0) | + (modifiers & 32 /* Static */ ? 512 /* ContainsStatic */ : 0); + if (!isMethodLike(prop)) { + syntheticFlag = 2 /* SyntheticProperty */; } } - else if (containingType.flags & 65536 /* Union */) { - isPartial = true; + else if (isUnion) { + checkFlags |= 16 /* Partial */; } } } if (!props) { return undefined; } - if (props.length === 1 && !isPartial) { + if (props.length === 1 && !(checkFlags & 16 /* Partial */)) { return props[0]; } var propTypes = []; var declarations = []; var commonType = undefined; - var hasNonUniformType = false; for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { var prop = props_1[_a]; if (prop.declarations) { @@ -28448,17 +30727,15 @@ var ts; commonType = type; } else if (type !== commonType) { - hasNonUniformType = true; + checkFlags |= 32 /* HasNonUniformType */; } propTypes.push(type); } - var result = createSymbol(4 /* Property */ | 67108864 /* Transient */ | 268435456 /* SyntheticProperty */ | commonFlags, name); + var result = createSymbol(4 /* Property */ | commonFlags, name); + result.checkFlags = syntheticFlag | checkFlags; result.containingType = containingType; - result.hasNonUniformType = hasNonUniformType; - result.isPartial = isPartial; result.declarations = declarations; - result.isReadonly = isReadonly; - result.type = containingType.flags & 65536 /* Union */ ? getUnionType(propTypes) : getIntersectionType(propTypes); + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); return result; } // Return the symbol for a given property in a union or intersection type, or undefined if the property @@ -28467,12 +30744,12 @@ var ts; // these partial properties when identifying discriminant properties, but otherwise they are filtered out // and do not appear to be present in the union type. function getUnionOrIntersectionProperty(type, name) { - var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); - var property = properties[name]; + var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -28480,7 +30757,7 @@ var ts; function getPropertyOfUnionOrIntersectionType(type, name) { var property = getUnionOrIntersectionProperty(type, name); // We need to filter out partial properties in union types - return property && !(property.flags & 268435456 /* SyntheticProperty */ && property.isPartial) ? property : undefined; + return property && !(getCheckFlags(property) & 16 /* Partial */) ? property : undefined; } /** * Return the symbol for the property with the given name in the given type. Creates synthetic union properties when @@ -28494,7 +30771,7 @@ var ts; type = getApparentType(type); if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - var symbol = resolved.members[name]; + var symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -28561,7 +30838,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -28583,16 +30860,16 @@ var ts; } function symbolsToArray(symbols) { var result = []; - for (var id in symbols) { + symbols.forEach(function (symbol, id) { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 2097152 /* JavaScriptFile */) { - if (node.type && node.type.kind === 273 /* JSDocOptionalType */) { + if (node.flags & 65536 /* JavaScriptFile */) { + if (node.type && node.type.kind === 277 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -28603,7 +30880,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 277 /* JSDocOptionalType */; } } } @@ -28628,6 +30905,12 @@ var ts; ts.Debug.assert(parameterIndex >= 0); return parameterIndex >= signature.minArgumentCount; } + var iife = ts.getImmediatelyInvokedFunctionExpression(node.parent); + if (iife) { + return !node.type && + !node.dotDotDotToken && + ts.indexOf(node.parent.parameters, node) >= iife.arguments.length; + } return false; } function createTypePredicateFromTypePredicateNode(node) { @@ -28647,19 +30930,68 @@ var ts; }; } } + /** + * Gets the minimum number of type arguments needed to satisfy all non-optional type + * parameters. + */ + function getMinTypeArgumentCount(typeParameters) { + var minTypeArgumentCount = 0; + if (typeParameters) { + for (var i = 0; i < typeParameters.length; i++) { + if (!getDefaultFromTypeParameter(typeParameters[i])) { + minTypeArgumentCount = i + 1; + } + } + } + return minTypeArgumentCount; + } + /** + * Fill in default types for unsupplied type arguments. If `typeArguments` is undefined + * when a default type is supplied, a new array will be created and returned. + * + * @param typeArguments The supplied type arguments. + * @param typeParameters The requested type parameters. + * @param minTypeArgumentCount The minimum number of required type arguments. + */ + function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, location) { + var numTypeParameters = ts.length(typeParameters); + if (numTypeParameters) { + var numTypeArguments = ts.length(typeArguments); + var isJavaScript = ts.isInJavaScriptFile(location); + if ((isJavaScript || numTypeArguments >= minTypeArgumentCount) && numTypeArguments <= numTypeParameters) { + if (!typeArguments) { + typeArguments = []; + } + // Map an unsatisfied type parameter with a default type. + // If a type parameter does not have a default type, or if the default type + // is a forward reference, the empty object type is used. + for (var i = numTypeArguments; i < numTypeParameters; i++) { + typeArguments[i] = isJavaScript ? anyType : emptyObjectType; + } + for (var i = numTypeArguments; i < numTypeParameters; i++) { + var mapper = createTypeMapper(typeParameters, typeArguments); + var defaultType = getDefaultFromTypeParameter(typeParameters[i]); + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : isJavaScript ? anyType : emptyObjectType; + } + } + } + return typeArguments; + } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var parameters = []; var hasLiteralTypes = false; - var minArgumentCount = -1; + var minArgumentCount = 0; var thisParameter = undefined; var hasThisParameter = void 0; + var iife = ts.getImmediatelyInvokedFunctionExpression(declaration); var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); + var isUntypedSignatureInJSFile = !iife && !isJSConstructSignature && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration); // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; // Include parameter symbol instead of property symbol in the signature @@ -28674,43 +31006,36 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 171 /* LiteralType */) { + if (param.type && param.type.kind === 172 /* LiteralType */) { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - // If we see any required parameters, it means the prior ones were not in fact optional. - minArgumentCount = -1; + // Record a new minimum argument count if this is not an optional parameter + var isOptionalParameter_1 = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param) || + isUntypedSignatureInJSFile; + if (!isOptionalParameter_1) { + minArgumentCount = parameters.length; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 151 /* GetAccessor */ || declaration.kind === 152 /* SetAccessor */) && + if ((declaration.kind === 152 /* GetAccessor */ || declaration.kind === 153 /* SetAccessor */) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = declaration.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - var classType = declaration.kind === 150 /* Constructor */ ? + var classType = declaration.kind === 151 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 156 /* TypePredicate */ ? + var typePredicate = declaration.type && declaration.type.kind === 157 /* TypePredicate */ ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); @@ -28727,7 +31052,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 2097152 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -28735,35 +31060,63 @@ var ts; } // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 151 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 152 /* SetAccessor */); + if (declaration.kind === 152 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 153 /* SetAccessor */); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { return anyType; } } + function containsArgumentsReference(declaration) { + var links = getNodeLinks(declaration); + if (links.containsArgumentsReference === undefined) { + if (links.flags & 8192 /* CaptureArguments */) { + links.containsArgumentsReference = true; + } + else { + links.containsArgumentsReference = traverse(declaration.body); + } + } + return links.containsArgumentsReference; + function traverse(node) { + if (!node) + return false; + switch (node.kind) { + case 70 /* Identifier */: + return node.text === "arguments" && ts.isPartOfExpression(node); + case 148 /* PropertyDeclaration */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return node.name.kind === 143 /* ComputedPropertyName */ + && traverse(node.name); + default: + return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && ts.forEachChild(node, traverse); + } + } + } function getSignaturesOfSymbol(symbol) { if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 278 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -28810,7 +31163,7 @@ var ts; } if (!popTypeResolution()) { type = anyType; - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { var declaration = signature.declaration; if (declaration.name) { error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); @@ -28834,9 +31187,14 @@ var ts; return anyType; } function getSignatureInstantiation(signature, typeArguments) { + typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters)); var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); var id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + var instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true); @@ -28855,7 +31213,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 150 /* Constructor */ || signature.declaration.kind === 154 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 151 /* Constructor */ || signature.declaration.kind === 155 /* ConstructSignature */; var type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = emptyArray; @@ -28866,10 +31224,10 @@ var ts; return signature.isolatedSignatureType; } function getIndexSymbol(symbol) { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 134 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 135 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -28896,21 +31254,9 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 143 /* TypeParameter */).constraint; - } - function hasConstraintReferenceTo(type, target) { - var checked; - while (type && type.flags & 16384 /* TypeParameter */ && !(type.isThisType) && !ts.contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - var constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; + return ts.getDeclarationOfKind(type.symbol, 144 /* TypeParameter */).constraint; } - function getConstraintOfTypeParameter(typeParameter) { + function getConstraintFromTypeParameter(typeParameter) { if (!typeParameter.constraint) { if (typeParameter.target) { var targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -28918,28 +31264,23 @@ var ts; } else { var constraintDeclaration = getConstraintDeclaration(typeParameter); - var constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 144 /* TypeParameter */).parent); } function getTypeListId(types) { var result = ""; if (types) { - var length_3 = types.length; + var length_4 = types.length; var i = 0; - while (i < length_3) { + while (i < length_4) { var startId = types[i].id; var count = 1; - while (i + count < length_3 && types[i + count].id === startId + count) { + while (i + count < length_4 && types[i + count].id === startId + count) { count++; } if (result.length) { @@ -28960,8 +31301,8 @@ var ts; // that care about the presence of such types at arbitrary depth in a containing type. function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; - for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { - var type = types_3[_i]; + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var type = types_5[_i]; if (!(type.flags & excludeKinds)) { result |= type.flags; } @@ -28970,9 +31311,10 @@ var ts; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + var type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(4 /* Reference */, target.symbol); + type = createObjectType(4 /* Reference */, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -28988,21 +31330,26 @@ var ts; return type; } function getTypeReferenceArity(type) { - return type.target.typeParameters ? type.target.typeParameters.length : 0; + return ts.length(type.target.typeParameters); } // Get type from reference to class or interface function getTypeFromClassOrInterfaceReference(node, symbol) { var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (!ts.isInJavaScriptFile(node) && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */), minTypeArgumentCount, typeParameters.length); return unknownType; } // In a type reference, the outer type parameters of the referenced class or interface are automatically // supplied as type arguments and the type reference only specifies arguments for the local type parameters // of the class or interface. - return createTypeReference(type, ts.concatenate(type.outerTypeParameters, ts.map(node.typeArguments, getTypeFromTypeNode))); + var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, minTypeArgumentCount, node)); + return createTypeReference(type, typeArguments); } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); @@ -29015,7 +31362,11 @@ var ts; var links = getSymbolLinks(symbol); var typeParameters = links.typeParameters; var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + var instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); + } + return instantiation; } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the @@ -29024,8 +31375,12 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); + var numTypeArguments = ts.length(node.typeArguments); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, minTypeArgumentCount === typeParameters.length + ? ts.Diagnostics.Generic_type_0_requires_1_type_argument_s + : ts.Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), minTypeArgumentCount, typeParameters.length); return unknownType; } var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode); @@ -29047,11 +31402,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 157 /* TypeReference */: + case 158 /* TypeReference */: return node.typeName; - case 272 /* JSDocTypeReference */: + case 276 /* JSDocTypeReference */: return node.name; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -29077,7 +31432,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 272 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 276 /* JSDocTypeReference */) { // A JSDocTypeReference may have resolved to a value (as opposed to a type). In // that case, the type of this reference is just the type of the value we resolved // to. @@ -29085,19 +31440,54 @@ var ts; } return getTypeFromNonGenericTypeReference(node, symbol); } + function getPrimitiveTypeFromJSDocTypeReference(node) { + if (ts.isIdentifier(node.name)) { + switch (node.name.text) { + case "String": + return stringType; + case "Number": + return numberType; + case "Boolean": + return booleanType; + case "Void": + return voidType; + case "Undefined": + return undefinedType; + case "Null": + return nullType; + case "Object": + return anyType; + case "Function": + return anyFunctionType; + case "Array": + case "array": + return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined; + case "Promise": + case "promise": + return !node.typeArguments || !node.typeArguments.length ? createPromiseType(anyType) : undefined; + } + } + } + function getTypeFromJSDocNullableTypeNode(node) { + var type = getTypeFromTypeNode(node.type); + return strictNullChecks ? getUnionType([type, nullType]) : type; + } function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272 /* JSDocTypeReference */) { - var typeReferenceName = getTypeReferenceName(node); - symbol = resolveTypeReferenceName(typeReferenceName); - type = getTypeReferenceType(node, symbol); + if (node.kind === 276 /* JSDocTypeReference */) { + type = getPrimitiveTypeFromJSDocTypeReference(node); + if (!type) { + var typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(typeReferenceName); + type = getTypeReferenceType(node, symbol); + } } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 157 /* TypeReference */ + var typeNameOrExpression = node.kind === 158 /* TypeReference */ ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -29129,12 +31519,12 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { - var declaration = declarations_3[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var declaration = declarations_4[_i]; switch (declaration.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: return declaration; } } @@ -29147,24 +31537,68 @@ var ts; error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return arity ? emptyGenericType : emptyObjectType; } - if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + if (ts.length(type.typeParameters) !== arity) { error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); return arity ? emptyGenericType : emptyObjectType; } return type; } - function getGlobalValueSymbol(name) { - return getGlobalSymbol(name, 107455 /* Value */, ts.Diagnostics.Cannot_find_global_value_0); + function getGlobalValueSymbol(name, reportErrors) { + return getGlobalSymbol(name, 107455 /* Value */, reportErrors ? ts.Diagnostics.Cannot_find_global_value_0 : undefined); } - function getGlobalTypeSymbol(name) { - return getGlobalSymbol(name, 793064 /* Type */, ts.Diagnostics.Cannot_find_global_type_0); + function getGlobalTypeSymbol(name, reportErrors) { + return getGlobalSymbol(name, 793064 /* Type */, reportErrors ? ts.Diagnostics.Cannot_find_global_type_0 : undefined); } function getGlobalSymbol(name, meaning, diagnostic) { return resolveName(undefined, name, meaning, diagnostic, name); } - function getGlobalType(name, arity) { + function getGlobalType(name, arity, reportErrors) { + var symbol = getGlobalTypeSymbol(name, reportErrors); + return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : undefined; + } + function getGlobalTypedPropertyDescriptorType() { + return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", /*arity*/ 1, /*reportErrors*/ true)) || emptyGenericType; + } + function getGlobalTemplateStringsArrayType() { + return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", /*arity*/ 0, /*reportErrors*/ true)) || emptyObjectType; + } + function getGlobalESSymbolConstructorSymbol(reportErrors) { + return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)); + } + function getGlobalESSymbolType(reportErrors) { + return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", /*arity*/ 0, reportErrors)) || emptyObjectType; + } + function getGlobalPromiseType(reportErrors) { + return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalPromiseConstructorSymbol(reportErrors) { + return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)); + } + function getGlobalPromiseConstructorLikeType(reportErrors) { + return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", /*arity*/ 0, reportErrors)) || emptyObjectType; + } + function getGlobalAsyncIterableType(reportErrors) { + return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIteratorType(reportErrors) { + return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalAsyncIterableIteratorType(reportErrors) { + return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableType(reportErrors) { + return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalIteratorType(reportErrors) { + return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalIterableIteratorType(reportErrors) { + return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + function getGlobalTypeOrUndefined(name, arity) { if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); + var symbol = getGlobalSymbol(name, 793064 /* Type */, /*diagnostic*/ undefined); + return symbol && getTypeOfGlobalSymbol(symbol, arity); } /** * Returns a type that is inside a namespace at the global scope, e.g. @@ -29175,26 +31609,26 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793064 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - /** - * Creates a TypeReference for a generic `TypedPropertyDescriptor`. - */ - function createTypedPropertyDescriptorType(propertyType) { - var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyGenericType - ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) - : emptyObjectType; - } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } - function createIterableType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); + function createTypedPropertyDescriptorType(propertyType) { + return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); + } + function createAsyncIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableType(/*reportErrors*/ true), [iteratedType]); + } + function createAsyncIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableIteratorType(/*reportErrors*/ true), [iteratedType]); } - function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); + function createIterableType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableType(/*reportErrors*/ true), [iteratedType]); + } + function createIterableIteratorType(iteratedType) { + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(/*reportErrors*/ true), [iteratedType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -29219,7 +31653,7 @@ var ts; for (var i = 0; i < arity; i++) { var typeParameter = createType(16384 /* TypeParameter */); typeParameters.push(typeParameter); - var property = createSymbol(4 /* Property */ | 67108864 /* Transient */, "" + i); + var property = createSymbol(4 /* Property */, "" + i); property.type = typeParameter; properties.push(property); } @@ -29228,7 +31662,7 @@ var ts; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = ts.createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(16384 /* TypeParameter */); @@ -29312,14 +31746,14 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToUnion(typeSet, types) { - for (var _i = 0, types_4 = types; _i < types_4.length; _i++) { - var type = types_4[_i]; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; addTypeToUnion(typeSet, type); } } function containsIdenticalType(types, type) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var t = types_5[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var t = types_7[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -29327,8 +31761,9 @@ var ts; return false; } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var type = types_8[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -29414,10 +31849,11 @@ var ts; return types[0]; } var id = getTypeListId(types); - var type = unionTypes[id]; + var type = unionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */); - type = unionTypes[id] = createType(65536 /* Union */ | propagatedFlags); + type = createType(65536 /* Union */ | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29438,15 +31874,27 @@ var ts; else if (type.flags & 1 /* Any */) { typeSet.containsAny = true; } + else if (getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type)) { + typeSet.containsEmptyObject = true; + } else if (!(type.flags & 8192 /* Never */) && (strictNullChecks || !(type.flags & 6144 /* Nullable */)) && !ts.contains(typeSet, type)) { - typeSet.push(type); + if (type.flags & 32768 /* Object */) { + typeSet.containsObjectType = true; + } + if (type.flags & 65536 /* Union */ && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } + if (!(type.flags & 32768 /* Object */ && type.objectFlags & 16 /* Anonymous */ && + type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */) && containsIdenticalType(typeSet, type))) { + typeSet.push(type); + } } } // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var type = types_9[_i]; addTypeToIntersection(typeSet, type); } } @@ -29464,31 +31912,31 @@ var ts; if (types.length === 0) { return emptyObjectType; } - var _loop_2 = function (i) { - var type_1 = types[i]; - if (type_1.flags & 65536 /* Union */) { - return { value: getUnionType(ts.map(type_1.types, function (t) { return getIntersectionType(ts.replaceElement(types, i, t)); }), - /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments) }; - } - }; - for (var i = 0; i < types.length; i++) { - var state_2 = _loop_2(i); - if (typeof state_2 === "object") - return state_2.value; - } var typeSet = []; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { return anyType; } + if (typeSet.containsEmptyObject && !typeSet.containsObjectType) { + typeSet.push(emptyObjectType); + } if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), + /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); - var type = intersectionTypes[id]; + var type = intersectionTypes.get(id); if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 6144 /* Nullable */); - type = intersectionTypes[id] = createType(131072 /* Intersection */ | propagatedFlags); + type = createType(131072 /* Intersection */ | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -29502,7 +31950,7 @@ var ts; } return links.resolvedType; } - function getIndexTypeForTypeParameter(type) { + function getIndexTypeForGenericType(type) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(262144 /* Index */); type.resolvedIndexType.type = type; @@ -29518,7 +31966,7 @@ var ts; return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); } function getIndexType(type) { - return type.flags & 16384 /* TypeParameter */ ? getIndexTypeForTypeParameter(type) : + return maybeTypeOfKind(type, 540672 /* TypeVariable */) ? getIndexTypeForGenericType(type) : getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) : type.flags & 1 /* Any */ || getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromPropertyNames(type); @@ -29541,7 +31989,7 @@ var ts; return type; } function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; var propName = indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */ | 256 /* EnumLiteral */) ? indexType.text : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? @@ -29570,14 +32018,14 @@ var ts; getIndexInfoOfType(objectType, 0 /* String */) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } return indexInfo.type; } if (accessExpression && !isConstEnumObjectType(objectType)) { - if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { if (getIndexTypeOfType(objectType, 1 /* Number */)) { error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); } @@ -29589,7 +32037,7 @@ var ts; } } if (accessNode) { - var indexNode = accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + var indexNode = accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); } @@ -29599,32 +32047,32 @@ var ts; else { error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); } + return unknownType; } - return unknownType; + return anyType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 179 /* ElementAccessExpression */ ? accessNode : undefined; if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - var mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; - return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken); + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType, indexType, accessNode) { - if (indexType.flags & 16384 /* TypeParameter */ || - objectType.flags & 16384 /* TypeParameter */ && indexType.flags & 262144 /* Index */ || + // If the index type is generic, if the object type is generic and doesn't originate in an expression, + // or if the object type is a mapped type with a generic constraint, we are performing a higher-order + // index access where we cannot meaningfully access the properties of the object type. Note that for a + // generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to + // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved + // eagerly using the constraint type of 'this' at the given location. + if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || + maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 179 /* ElementAccessExpression */) || isGenericMappedType(objectType)) { - // If either the object type or the index type are type parameters, or if the object type is a mapped - // type with a generic constraint, we are performing a higher-order index access where we cannot - // meaningfully access the properties of the object type. In those cases, we first check that the - // index type is assignable to 'keyof T' for the object type. - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } + if (objectType.flags & 1 /* Any */) { + return objectType; } // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes // the index type for P. For example, for an index access { [P in K]: Box }[X], we construct the @@ -29634,8 +32082,13 @@ var ts; } // Otherwise we defer the operation by creating an indexed access type. var id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + var type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } + // In the following we resolve T[K] to the type of the property in T selected by K. var apparentObjectType = getApparentType(objectType); if (indexType.flags & 65536 /* Union */ && !(indexType.flags & 8190 /* Primitive */)) { var propTypes = []; @@ -29677,7 +32130,7 @@ var ts; if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers var aliasSymbol = getAliasSymbolForTypeNode(node); - if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -29690,7 +32143,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 230 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -29701,11 +32154,27 @@ var ts; * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left, right, isFromObjectLiteral) { - ts.Debug.assert(!!(left.flags & (32768 /* Object */ | 1 /* Any */)) && !!(right.flags & (32768 /* Object */ | 1 /* Any */)), "Only object types may be spread."); + function getSpreadType(left, right) { if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) { return anyType; } + left = filterType(left, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (left.flags & 8192 /* Never */) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (right.flags & 8192 /* Never */) { + return left; + } + if (left.flags & 65536 /* Union */) { + return mapType(left, function (t) { return getSpreadType(t, right); }); + } + if (right.flags & 65536 /* Union */) { + return mapType(right, function (t) { return getSpreadType(left, t); }); + } + if (right.flags & 16777216 /* NonPrimitive */) { + return emptyObjectType; + } var members = ts.createMap(); var skippedPrivateMembers = ts.createMap(); var stringIndexInfo; @@ -29722,42 +32191,55 @@ var ts; for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { var rightProp = _a[_i]; // we approximate own properties as non-methods plus methods that are inside the object literal - var isOwnProperty = !(rightProp.flags & 8192 /* Method */) || isFromObjectLiteral; var isSetterWithoutGetter = rightProp.flags & 65536 /* SetAccessor */ && !(rightProp.flags & 32768 /* GetAccessor */); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 /* Private */ | 16 /* Protected */)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } - else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { + members.set(rightProp.name, getNonReadonlySymbol(rightProp)); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 /* SetAccessor */ && !(leftProp.flags & 32768 /* GetAccessor */) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name) + || isClassMethod(leftProp)) { continue; } - if (leftProp.name in members) { - var rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + var rightProp = members.get(leftProp.name); var rightType = getTypeOfSymbol(rightProp); - if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 536870912 /* Optional */) { + if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 67108864 /* Optional */) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); - var flags = 4 /* Property */ | 67108864 /* Transient */ | (leftProp.flags & 536870912 /* Optional */); + var flags = 4 /* Property */ | (leftProp.flags & 67108864 /* Optional */); var result = createSymbol(flags, leftProp.name); result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072 /* NEUndefined */)]); result.leftSpread = leftProp; result.rightSpread = rightProp; result.declarations = declarations; - result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, getNonReadonlySymbol(leftProp)); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function getNonReadonlySymbol(prop) { + if (!isReadonlySymbol(prop)) { + return prop; + } + var flags = 4 /* Property */ | (prop.flags & 67108864 /* Optional */); + var result = createSymbol(flags, prop.name); + result.type = getTypeOfSymbol(prop); + result.declarations = prop.declarations; + result.syntheticOrigin = prop; + return result; + } + function isClassMethod(prop) { + return prop.flags & 8192 /* Method */ && ts.find(prop.declarations, function (decl) { return ts.isClassLike(decl.parent); }); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; @@ -29779,7 +32261,11 @@ var ts; } function getLiteralTypeForText(flags, text) { var map = flags & 32 /* StringLiteral */ ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + var type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); @@ -29807,9 +32293,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 229 /* InterfaceDeclaration */)) { if (!(ts.getModifierFlags(container) & 32 /* Static */) && - (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 151 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -29826,87 +32312,84 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 263 /* JSDocAllType */: - case 264 /* JSDocUnknownType */: + case 267 /* JSDocAllType */: + case 268 /* JSDocUnknownType */: return anyType; - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return stringType; case 132 /* NumberKeyword */: return numberType; case 121 /* BooleanKeyword */: return booleanType; - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return esSymbolType; case 104 /* VoidKeyword */: return voidType; - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: return undefinedType; case 94 /* NullKeyword */: return nullType; case 129 /* NeverKeyword */: return neverType; - case 289 /* JSDocNullKeyword */: - return nullType; - case 290 /* JSDocUndefinedKeyword */: - return undefinedType; - case 291 /* JSDocNeverKeyword */: - return neverType; - case 167 /* ThisType */: + case 133 /* ObjectKeyword */: + return nonPrimitiveType; + case 168 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 288 /* JSDocLiteralType */: + case 292 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); - case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 158 /* TypeReference */: + case 276 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return booleanType; - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 162 /* ArrayType */: - case 265 /* JSDocArrayType */: + case 163 /* ArrayType */: + case 269 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 164 /* UnionType */: - case 266 /* JSDocUnionType */: + case 165 /* UnionType */: + case 270 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 166 /* ParenthesizedType */: - case 268 /* JSDocNullableType */: - case 269 /* JSDocNonNullableType */: - case 276 /* JSDocConstructorType */: - case 277 /* JSDocThisType */: - case 273 /* JSDocOptionalType */: + case 272 /* JSDocNullableType */: + return getTypeFromJSDocNullableTypeNode(node); + case 167 /* ParenthesizedType */: + case 273 /* JSDocNonNullableType */: + case 280 /* JSDocConstructorType */: + case 281 /* JSDocThisType */: + case 277 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 270 /* JSDocRecordType */: + case 274 /* JSDocRecordType */: return getTypeFromTypeNode(node.literal); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 274 /* JSDocFunctionType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 162 /* TypeLiteral */: + case 291 /* JSDocTypeLiteral */: + case 278 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return getTypeFromMappedTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 70 /* Identifier */: - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267 /* JSDocTupleType */: + case 271 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 275 /* JSDocVariadicType */: + case 279 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -29933,13 +32416,13 @@ var ts; var instantiations = mapper.instantiations || (mapper.instantiations = []); return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source, target) { + function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } - function createBinaryTypeMapper(source1, target1, source2, target2) { + function makeBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createArrayTypeMapper(sources, targets) { + function makeArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { @@ -29950,15 +32433,23 @@ var ts; }; } function createTypeMapper(sources, targets) { - var count = sources.length; - var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } function createTypeEraser(sources) { - return createTypeMapper(sources, undefined); + return createTypeMapper(sources, /*targets*/ undefined); + } + /** + * Maps forward-references to later types parameters to the empty object type. + * This is used during inference when instantiating type parameter defaults. + */ + function createBackreferenceMapper(typeParameters, index) { + var mapper = function (t) { return ts.indexOf(typeParameters, t) >= index ? emptyObjectType : t; }; + mapper.mappedTypes = typeParameters; + return mapper; } function getInferenceMapper(context) { if (!context.mapper) { @@ -29983,7 +32474,12 @@ var ts; } function combineTypeMappers(mapper1, mapper2) { var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); + return mapper; + } + function createReplacementMapper(source, target, baseMapper) { + var mapper = function (t) { return t === source ? target : baseMapper(t); }; + mapper.mappedTypes = baseMapper.mappedTypes; return mapper; } function cloneTypeParameter(typeParameter) { @@ -30031,7 +32527,7 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(symbol) & 1 /* Instantiated */) { var links = getSymbolLinks(symbol); // If symbol being instantiated is itself a instantiation, fetch the original target and combine the // type mappers. This ensures that original type identities are properly preserved and that aliases @@ -30041,7 +32537,8 @@ var ts; } // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - var result = createSymbol(16777216 /* Instantiated */ | 67108864 /* Transient */ | symbol.flags, symbol.name); + var result = createSymbol(symbol.flags, symbol.name); + result.checkFlags = 1 /* Instantiated */; result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -30060,25 +32557,24 @@ var ts; return result; } function instantiateMappedType(type, mapper) { - // Check if we have an isomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some - // type parameter T. If so, the mapped type is distributive over a union type and when T is instantiated + // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some + // type variable T. If so, the mapped type is distributive over a union type and when T is instantiated // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for - // isomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a + // homomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a // union type A | undefined, we produce { [P in keyof A]: X } | undefined. var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144 /* Index */) { - var typeParameter_1 = constraintType.type; - var mappedTypeParameter = mapper(typeParameter_1); - if (typeParameter_1 !== mappedTypeParameter) { - return mapType(mappedTypeParameter, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeParameter_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + var typeVariable_1 = constraintType.type; + if (typeVariable_1.flags & 16384 /* TypeParameter */) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -30102,26 +32598,28 @@ var ts; // Starting with the parent of the symbol's declaration, check if the mapper maps any of // the type parameters introduced by enclosing declarations. We just pick the first // declaration since multiple declarations will all have the same parent anyway. - var node = symbol.declarations[0].parent; - while (node) { + return !!ts.findAncestor(symbol.declarations[0], function (node) { + if (node.kind === 232 /* ModuleDeclaration */ || node.kind === 264 /* SourceFile */) { + return "quit"; + } switch (node.kind) { - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -30131,25 +32629,34 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(node) || node.kind === 229 /* InterfaceDeclaration */) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: - return false; + case 171 /* MappedType */: + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { + return true; + } + break; + case 278 /* JSDocFunctionType */: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; } - node = node.parent; - } - return false; + }); } function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 /* SourceFile */ || parentKind === 231 /* ModuleBlock */; + return parentKind === 264 /* SourceFile */ || parentKind === 233 /* ModuleBlock */; } return false; } @@ -30226,28 +32733,36 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return node.operatorToken.kind === 53 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return isContextSensitive(node.expression); + case 253 /* JsxAttributes */: + return ts.forEach(node.properties, isContextSensitive); + case 252 /* JsxAttribute */: + // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. + return node.initializer && isContextSensitive(node.initializer); + case 255 /* JsxExpression */: + // It is possible to that node.expression is undefined (e.g
) + return node.expression && isContextSensitive(node.expression); } return false; } @@ -30261,7 +32776,7 @@ var ts; return true; } // For arrow functions we now know we're not context sensitive. - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { return false; } // If the first parameter is not an explicit 'this' parameter, then the function has @@ -30283,9 +32798,12 @@ var ts; result.properties = resolved.properties; result.callSignatures = emptyArray; result.constructSignatures = emptyArray; - type = result; + return result; } } + else if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(ts.map(type.types, getTypeWithoutSignatures)); + } return type; } // TYPE CHECKING @@ -30308,7 +32826,7 @@ var ts; // subtype of T but not structurally identical to T. This specifically means that two distinct but // structurally identical types (such as two classes) are not considered instances of each other. function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } /** * This is *not* a bi-directional relationship. @@ -30334,12 +32852,13 @@ var ts; return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { - return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; + return compareSignaturesRelated(source, target, /*checkAsCallback*/ false, ignoreReturnTypes, /*reportErrors*/ false, + /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; } /** * See signatureRelatedTo, compareSignaturesIdentical */ - function compareSignaturesRelated(source, target, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { + function compareSignaturesRelated(source, target, checkAsCallback, ignoreReturnTypes, reportErrors, errorReporter, compareTypes) { // TODO (drosen): De-duplicate code between related functions. if (source === target) { return -1 /* True */; @@ -30374,9 +32893,23 @@ var ts; var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); + var sourceType = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var targetType = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var sourceSig = getSingleCallSignature(getNonNullableType(sourceType)); + var targetSig = getSingleCallSignature(getNonNullableType(targetType)); + // In order to ensure that any generic type Foo is at least co-variant with respect to T no matter + // how Foo uses T, we need to relate parameters bi-variantly (given that parameters are input positions, + // they naturally relate only contra-variantly). However, if the source and target parameters both have + // function types with a single call signature, we known we are relating two callback parameters. In + // that case it is sufficient to only relate the parameters of the signatures co-variantly because, + // similar to return values, callback parameters are output positions. This means that a Promise, + // where T is used only in callback parameter positions, will be co-variant (as opposed to bi-variant) + // with respect to T. + var callbacks = sourceSig && targetSig && !sourceSig.typePredicate && !targetSig.typePredicate && + (getFalsyFlags(sourceType) & 6144 /* Nullable */) === (getFalsyFlags(targetType) & 6144 /* Nullable */); + var related = callbacks ? + compareSignaturesRelated(targetSig, sourceSig, /*checkAsCallback*/ true, /*ignoreReturnTypes*/ false, reportErrors, errorReporter, compareTypes) : + !checkAsCallback && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -30404,7 +32937,11 @@ var ts; } } else { - result &= compareTypes(sourceReturnType, targetReturnType, reportErrors); + // When relating callback signatures, we still need to relate return types bi-variantly as otherwise + // the containing type wouldn't be co-variant. For example, interface Foo { add(cb: () => T): void } + // wouldn't be co-variant for T without this rule. + result &= checkAsCallback && compareTypes(targetReturnType, sourceReturnType, /*reportErrors*/ false) || + compareTypes(sourceReturnType, targetReturnType, reportErrors); } } return result; @@ -30471,18 +33008,33 @@ var ts; sourceNonRestParamCount; } } + function isEmptyResolvedType(t) { + return t.properties.length === 0 && + t.callSignatures.length === 0 && + t.constructSignatures.length === 0 && + !t.stringIndexInfo && + !t.numberIndexInfo; + } + function isEmptyObjectType(type) { + return type.flags & 32768 /* Object */ ? isEmptyResolvedType(resolveStructuredTypeMembers(type)) : + type.flags & 65536 /* Union */ ? ts.forEach(type.types, isEmptyObjectType) : + type.flags & 131072 /* Intersection */ ? !ts.forEach(type.types, function (t) { return !isEmptyObjectType(t); }) : + false; + } function isEnumTypeRelatedTo(source, target, errorReporter) { if (source === target) { return true; } var id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + var relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) || (source.flags & 65536 /* Union */) !== (target.flags & 65536 /* Union */)) { - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } var targetEnumType = getTypeOfSymbol(target.symbol); for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) { @@ -30493,11 +33045,13 @@ var ts; if (errorReporter) { errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); } - return enumRelation[id] = false; + enumRelation.set(id, false); + return false; } } } - return enumRelation[id] = true; + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { if (target.flags & 8192 /* Never */) @@ -30518,6 +33072,8 @@ var ts; return true; if (source.flags & 4096 /* Null */ && (!strictNullChecks || target.flags & 4096 /* Null */)) return true; + if (source.flags & 32768 /* Object */ && target.flags & 16777216 /* NonPrimitive */) + return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & 1 /* Any */) return true; @@ -30549,13 +33105,13 @@ var ts; } if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { return related === 1 /* Succeeded */; } } - if (source.flags & 507904 /* StructuredOrTypeParameter */ || target.flags & 507904 /* StructuredOrTypeParameter */) { - return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); + if (source.flags & 1032192 /* StructuredOrTypeVariable */ || target.flags & 1032192 /* StructuredOrTypeVariable */) { + return checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined); } return false; } @@ -30619,14 +33175,35 @@ var ts; if ((globalStringType === source && stringType === target) || (globalNumberType === source && numberType === target) || (globalBooleanType === source && booleanType === target) || - (getGlobalESSymbolType() === source && esSymbolType === target)) { + (getGlobalESSymbolType(/*reportErrors*/ false) === source && esSymbolType === target)) { reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } - // Compare two types and return - // Ternary.True if they are related with no assumptions, - // Ternary.Maybe if they are related with assumptions of other relationships, or - // Ternary.False if they are not related. + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608 /* UnionOrIntersection */)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144 /* Nullable */) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } + /** + * Compare two types and return + * * Ternary.True if they are related with no assumptions, + * * Ternary.Maybe if they are related with assumptions of other relationships, or + * * Ternary.False if they are not related. + */ function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) { @@ -30654,7 +33231,7 @@ var ts; // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & 196608 /* UnionOrIntersection */) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -30673,122 +33250,37 @@ var ts; return result; } } - else if (target.flags & 65536 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */) && !(target.flags & 8190 /* Primitive */))) { - return result; - } - } - else if (target.flags & 131072 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { - return result; - } - } - else if (source.flags & 131072 /* Intersection */) { - // Check to see if any constituents of the intersection are immediately related to the target. - // - // Don't report errors though. Checking whether a constituent is related to the source is not actually - // useful and leads to some confusing error messages. Instead it is better to let the below checks - // take care of this, or to not elaborate at all. For instance, - // - // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. - // - // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection - // than to report that 'D' is not assignable to 'A' or 'B'. - // - // - For a primitive type or type parameter (such as 'number = A & B') there is no point in - // breaking the intersection apart. - if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { - return result; - } - } - if (target.flags & 16384 /* TypeParameter */) { - // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. - if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) { - if (!source.declaration.questionToken) { - var templateType = getTemplateTypeFromMappedType(source); - var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); - if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { - return result; - } - } - } - else { - // Given a type parameter K with a constraint keyof T, a type S is - // assignable to K if S is assignable to keyof T. - var constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & 262144 /* Index */) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } - } - else if (target.flags & 262144 /* Index */) { - // A keyof S is related to a keyof T if T is related to S. - if (source.flags & 262144 /* Index */) { - if (result = isRelatedTo(target.type, source.type, /*reportErrors*/ false)) { - return result; - } - } - // Given a type parameter T with a constraint C, a type S is assignable to - // keyof T if S is assignable to keyof C. - var constraint = getConstraintOfTypeParameter(target.type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } - } - } - else if (target.flags & 524288 /* IndexedAccess */) { - // if we have indexed access types with identical index types, see if relationship holds for - // the two object types. - if (source.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) { - if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { - return result; - } - } - } - if (source.flags & 16384 /* TypeParameter */) { - // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X. - if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) { - var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); - var templateType = getTemplateTypeFromMappedType(target); - if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + else { + if (target.flags & 65536 /* Union */) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */) && !(target.flags & 8190 /* Primitive */))) { return result; } } - else { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1 /* Any */) { - constraint = emptyObjectType; - } - // The constraint may need to be further instantiated with its 'this' type. - constraint = getTypeWithThisArgument(constraint, source); - // Report constraint errors only if the constraint is not the empty object type - var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; + else if (target.flags & 131072 /* Intersection */) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - } - else { - if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { - // We have type references to same target type, see if relationship holds for all type arguments - if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + else if (source.flags & 131072 /* Intersection */) { + // Check to see if any constituents of the intersection are immediately related to the target. + // + // Don't report errors though. Checking whether a constituent is related to the source is not actually + // useful and leads to some confusing error messages. Instead it is better to let the below checks + // take care of this, or to not elaborate at all. For instance, + // + // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. + // + // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection + // than to report that 'D' is not assignable to 'A' or 'B'. + // + // - For a primitive type or type parameter (such as 'number = A & B') there is no point in + // breaking the intersection apart. + if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { return result; } } - // Even if relationship doesn't hold for unions, intersections, or generic type references, - // it may hold in a structural comparison. - var apparentSource = getApparentType(source); - // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates - // to X. Failing both of those we want to check if the aggregation of A and B's members structurally - // relates to X. Thus, we include intersection types on the source side here. - if (apparentSource.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { - // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !(source.flags & 8190 /* Primitive */); - if (result = objectTypeRelatedTo(apparentSource, source, target, reportStructuralErrors)) { + if (source.flags & 1032192 /* StructuredOrTypeVariable */ || target.flags & 1032192 /* StructuredOrTypeVariable */) { + if (result = recursiveTypeRelatedTo(source, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -30808,13 +33300,7 @@ var ts; function isIdenticalTo(source, target) { var result; if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { - if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { - // We have type references to same target type, see if all type arguments are identical - if (result = typeArgumentsRelatedTo(source, target, /*reportErrors*/ false)) { - return result; - } - } - return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false); + return recursiveTypeRelatedTo(source, target, /*reportErrors*/ false); } if (source.flags & 65536 /* Union */ && target.flags & 65536 /* Union */ || source.flags & 131072 /* Intersection */ && target.flags & 131072 /* Intersection */) { @@ -30830,45 +33316,49 @@ var ts; // is considered known if the object type is empty and the check is for assignability, if the object type has // index signatures, or if the property is actually declared in the object type. In a union or intersection // type, a property is considered known if it is known in any constituent type. - function isKnownProperty(type, name) { + function isKnownProperty(type, name, isComparingJsxAttributes) { if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || - resolved.stringIndexInfo || - (resolved.numberIndexInfo && isNumericLiteralName(name)) || - getPropertyOfType(type, name)) { + if (resolved.stringIndexInfo || resolved.numberIndexInfo && isNumericLiteralName(name) || + getPropertyOfType(type, name) || isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) { + // For JSXAttributes, if the attribute has a hyphenated name, consider that the attribute to be known. return true; } } else if (type.flags & 196608 /* UnionOrIntersection */) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; - if (isKnownProperty(t, name)) { + if (isKnownProperty(t, name, isComparingJsxAttributes)) { return true; } } } return false; } - function isEmptyObjectType(t) { - return t.properties.length === 0 && - t.callSignatures.length === 0 && - t.constructSignatures.length === 0 && - !t.stringIndexInfo && - !t.numberIndexInfo; - } function hasExcessProperties(source, target, reportErrors) { if (maybeTypeOfKind(target, 32768 /* Object */) && !(getObjectFlags(target) & 512 /* ObjectLiteralPatternWithComputedProperties */)) { + var isComparingJsxAttributes = !!(source.flags & 33554432 /* JsxAttributes */); + if ((relation === assignableRelation || relation === comparableRelation) && + (isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) { + return false; + } for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (!isKnownProperty(target, prop.name)) { + if (!isKnownProperty(target, prop.name, isComparingJsxAttributes)) { if (reportErrors) { // We know *exactly* where things went wrong when comparing the types. // Use this property as the error node as this will be more helpful in // reasoning about what went wrong. ts.Debug.assert(!!errorNode); - errorNode = prop.valueDeclaration; - reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + if (ts.isJsxAttributes(errorNode)) { + // JsxAttributes has an object-literal flag and undergo same type-assignablity check as normal object-literal. + // However, using an object-literal error message will be very confusing to the users so we give different a message. + reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target)); + } + else { + errorNode = prop.valueDeclaration; + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } } return true; } @@ -30894,20 +33384,42 @@ var ts; if (target.flags & 65536 /* Union */ && containsType(targetTypes, source)) { return -1 /* True */; } - var len = targetTypes.length; - for (var i = 0; i < len; i++) { - var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { + var type = targetTypes_1[_i]; + var related = isRelatedTo(source, type, /*reportErrors*/ false); if (related) { return related; } } + if (reportErrors) { + var discriminantType = findMatchingDiscriminantType(source, target); + isRelatedTo(source, discriminantType || targetTypes[targetTypes.length - 1], /*reportErrors*/ true); + } return 0 /* False */; } + function findMatchingDiscriminantType(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + if (sourceProperties) { + for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { + var sourceProperty = sourceProperties_1[_i]; + if (isDiscriminantProperty(target, sourceProperty.name)) { + var sourceType = getTypeOfSymbol(sourceProperty); + for (var _a = 0, _b = target.types; _a < _b.length; _a++) { + var type = _b[_a]; + var targetType = getTypeOfPropertyOfType(type, sourceProperty.name); + if (targetType && isRelatedTo(sourceType, targetType)) { + return type; + } + } + } + } + } + } function typeRelatedToEachType(source, target, reportErrors) { var result = -1 /* True */; var targetTypes = target.types; - for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) { - var targetType = targetTypes_1[_i]; + for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) { + var targetType = targetTypes_2[_i]; var related = isRelatedTo(source, targetType, reportErrors); if (!related) { return 0 /* False */; @@ -30960,22 +33472,22 @@ var ts; } return result; } - // Determine if two object types are related by structure. First, check if the result is already available in the global cache. + // Determine if possibly recursive types are related. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are // equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion // and issue an error. Otherwise, actually compare the structure of the two types. - function objectTypeRelatedTo(source, originalSource, target, reportErrors) { + function recursiveTypeRelatedTo(source, target, reportErrors) { if (overflow) { return 0 /* False */; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; + var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2 /* Failed */) { // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported // failure and continue computing the relation such that errors get reported. - relation[id] = 3 /* FailedAndReported */; + relation.set(id, 3 /* FailedAndReported */); } else { return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; @@ -30984,7 +33496,7 @@ var ts; if (depth > 0) { for (var i = 0; i < depth; i++) { // If source and target are already being compared, consider them related with assumptions - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return 1 /* Maybe */; } } @@ -31002,75 +33514,192 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = ts.createMap(); - maybeStack[depth][id] = 1 /* Succeeded */; + maybeStack[depth].set(id, 1 /* Succeeded */); depth++; var saveExpandingFlags = expandingFlags; - if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) + if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth)) expandingFlags |= 1; - if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) + if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, depth)) expandingFlags |= 2; - var result; - if (expandingFlags === 3) { - result = 1 /* Maybe */; - } - else if (isGenericMappedType(source) || isGenericMappedType(target)) { - result = mappedTypeRelatedTo(source, target, reportErrors); - } - else { - result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); - if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 0 /* String */, reportErrors); - if (result) { - result &= indexTypesRelatedTo(source, originalSource, target, 1 /* Number */, reportErrors); - } - } - } - } - } + var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors) : 1 /* Maybe */; expandingFlags = saveExpandingFlags; depth--; if (result) { var maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyProperties(maybeCache, destinationCache); + ts.copyEntries(maybeCache, destinationCache); } else { // A false result goes straight into global cache (when something is false under assumptions it // will also be false without assumptions) - relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */; + relation.set(id, reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */); } return result; } - // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. - function mappedTypeRelatedTo(source, target, reportErrors) { - if (isGenericMappedType(target)) { - if (isGenericMappedType(source)) { - var result_2; - if (relation === identityRelation) { - var readonlyMatches = !source.declaration.readonlyToken === !target.declaration.readonlyToken; - var optionalMatches = !source.declaration.questionToken === !target.declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } + function structuredTypeRelatedTo(source, target, reportErrors) { + var result; + var saveErrorInfo = errorInfo; + if (target.flags & 16384 /* TypeParameter */) { + // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. + if (getObjectFlags(source) & 32 /* Mapped */ && getConstraintTypeFromMappedType(source) === getIndexType(target)) { + if (!source.declaration.questionToken) { + var templateType = getTemplateTypeFromMappedType(source); + var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source)); + if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) { + return result; } } + } + } + else if (target.flags & 262144 /* Index */) { + // A keyof S is related to a keyof T if T is related to S. + if (source.flags & 262144 /* Index */) { + if (result = isRelatedTo(target.type, source.type, /*reportErrors*/ false)) { + return result; + } + } + // A type S is assignable to keyof T if S is assignable to keyof C, where C is the + // constraint of T. + var constraint = getConstraintOfType(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + else if (target.flags & 524288 /* IndexedAccess */) { + // A type S is related to a type T[K] if S is related to A[K], where K is string-like and + // A is the apparent type of S. + var constraint = getConstraintOfType(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + if (source.flags & 16384 /* TypeParameter */) { + // A source type T is related to a target type { [P in keyof T]: X } if T[P] is related to X. + if (getObjectFlags(target) & 32 /* Mapped */ && getConstraintTypeFromMappedType(target) === getIndexType(source)) { + var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); + var templateType = getTemplateTypeFromMappedType(target); + if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else { + var constraint = getConstraintOfTypeParameter(source); + // A type parameter with no constraint is not related to the non-primitive object type. + if (constraint || !(target.flags & 16777216 /* NonPrimitive */)) { + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // Report constraint errors only if the constraint is not the empty object type + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } + } + else if (source.flags & 524288 /* IndexedAccess */) { + // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and + // A is the apparent type of S. + var constraint = getConstraintOfType(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else if (target.flags & 524288 /* IndexedAccess */ && source.indexType === target.indexType) { + // if we have indexed access types with identical index types, see if relationship holds for + // the two object types. + if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) { + return result; + } + } + } + else { + if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { + // We have type references to same target type, see if relationship holds for all type arguments + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { + return result; + } + } + // Even if relationship doesn't hold for unions, intersections, or generic type references, + // it may hold in a structural comparison. + var sourceIsPrimitive = !!(source.flags & 8190 /* Primitive */); + if (relation !== identityRelation) { + source = getApparentType(source); + } + // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates + // to X. Failing both of those we want to check if the aggregation of A and B's members structurally + // relates to X. Thus, we include intersection types on the source side here. + if (source.flags & (32768 /* Object */ | 131072 /* Intersection */) && target.flags & 32768 /* Object */) { + // Report structural errors only if we haven't reported any errors yet + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; + if (isGenericMappedType(source) || isGenericMappedType(target)) { + result = mappedTypeRelatedTo(source, target, reportStructuralErrors); + } else { - if (relation === comparableRelation || !source.declaration.questionToken || target.declaration.questionToken) { - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result_2 & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + result = propertiesRelatedTo(source, target, reportStructuralErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 0 /* String */, sourceIsPrimitive, reportStructuralErrors); + if (result) { + result &= indexTypesRelatedTo(source, target, 1 /* Number */, sourceIsPrimitive, reportStructuralErrors); + } + } } } } + if (result) { + errorInfo = saveErrorInfo; + return result; + } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1 /* True */; + return 0 /* False */; + } + // A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is + // related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice + // that S and T are contra-variant whereas X and Y are co-variant. + function mappedTypeRelatedTo(source, target, reportErrors) { + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else if (target.declaration.questionToken && isEmptyObjectType(source)) { + return -1 /* True */; + } + } + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { + return -1 /* True */; + } } return 0 /* False */; } @@ -31081,22 +33710,28 @@ var ts; var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128 /* ObjectLiteral */); - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var targetProp = properties_3[_i]; + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var targetProp = properties_4[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (!(targetProp.flags & 536870912 /* Optional */) || requireOptionalProperties) { + if (!(targetProp.flags & 67108864 /* Optional */) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } return 0 /* False */; } } - else if (!(targetProp.flags & 134217728 /* Prototype */)) { + else if (!(targetProp.flags & 16777216 /* Prototype */)) { var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) { + if (getCheckFlags(sourceProp) & 256 /* ContainsPrivate */) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); + } + return 0 /* False */; + } if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) { @@ -31110,12 +33745,9 @@ var ts; } } else if (targetPropFlags & 16 /* Protected */) { - var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined; - var targetClass = getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp)); - if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (!isValidOverrideOf(sourceProp, targetProp)) { if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)); } return 0 /* False */; } @@ -31135,7 +33767,7 @@ var ts; } result &= related; // When checking for comparability, be more lenient with optional properties. - if (relation !== comparableRelation && sourceProp.flags & 536870912 /* Optional */ && !(targetProp.flags & 536870912 /* Optional */)) { + if (relation !== comparableRelation && sourceProp.flags & 67108864 /* Optional */ && !(targetProp.flags & 67108864 /* Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -31163,8 +33795,8 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { - var sourceProp = sourceProperties_1[_i]; + for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { + var sourceProp = sourceProperties_2[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0 /* False */; @@ -31228,7 +33860,7 @@ var ts; * See signatureAssignableTo, compareSignaturesIdentical */ function signatureRelatedTo(source, target, reportErrors) { - return compareSignaturesRelated(source, target, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); + return compareSignaturesRelated(source, target, /*checkAsCallback*/ false, /*ignoreReturnTypes*/ false, reportErrors, reportError, isRelatedTo); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -31237,7 +33869,7 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; @@ -31270,12 +33902,12 @@ var ts; } return related; } - function indexTypesRelatedTo(source, originalSource, target, kind, reportErrors) { + function indexTypesRelatedTo(source, target, kind, sourceIsPrimitive, reportErrors) { if (relation === identityRelation) { return indexTypesIdenticalTo(source, target, kind); } var targetInfo = getIndexInfoOfType(target, kind); - if (!targetInfo || ((targetInfo.type.flags & 1 /* Any */) && !(originalSource.flags & 8190 /* Primitive */))) { + if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) { // Index signature of type any permits assignment from everything but primitives return -1 /* True */; } @@ -31337,6 +33969,45 @@ var ts; return false; } } + // Invoke the callback for each underlying property symbol of the given symbol and return the first + // value that isn't undefined. + function forEachProperty(prop, callback) { + if (getCheckFlags(prop) & 6 /* Synthetic */) { + for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { + var t = _a[_i]; + var p = getPropertyOfType(t, prop.name); + var result = p && forEachProperty(p, callback); + if (result) { + return result; + } + } + return undefined; + } + return callback(prop); + } + // Return the declaring class type of a property or undefined if property not declared in class + function getDeclaringClass(prop) { + return prop.parent && prop.parent.flags & 32 /* Class */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(prop)) : undefined; + } + // Return true if some underlying source property is declared in a class that derives + // from the given base class. + function isPropertyInClassDerivedFrom(prop, baseClass) { + return forEachProperty(prop, function (sp) { + var sourceClass = getDeclaringClass(sp); + return sourceClass ? hasBaseType(sourceClass, baseClass) : false; + }); + } + // Return true if source property is a valid override of protected parts of target property. + function isValidOverrideOf(sourceProp, targetProp) { + return !forEachProperty(targetProp, function (tp) { return getDeclarationModifierFlagsFromSymbol(tp) & 16 /* Protected */ ? + !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; }); + } + // Return true if the given class derives from each of the declaring classes of the protected + // constituents of the given property. + function isClassDerivedFromDeclaringClasses(checkClass, prop) { + return forEachProperty(prop, function (p) { return getDeclarationModifierFlagsFromSymbol(p) & 16 /* Protected */ ? + !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass; + } // Return true if the given type is the constructor type for an abstract class function isAbstractConstructorType(type) { if (getObjectFlags(type) & 16 /* Anonymous */) { @@ -31350,22 +34021,24 @@ var ts; } return false; } - // Return true if the given type is part of a deeply nested chain of generic instantiations. We consider this to be the case - // when structural type comparisons have been started for 10 or more instantiations of the same generic type. It is possible, - // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely expanding. - // Effectively, we will generate a false positive when two types are structurally equal to at least 10 levels, but unequal at - // some level beyond that. - function isDeeplyNestedGeneric(type, stack, depth) { - // We track type references (created by createTypeReference) and instantiated types (created by instantiateType) - if (getObjectFlags(type) & (4 /* Reference */ | 64 /* Instantiated */) && depth >= 5) { + // Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons + // for 5 or more occurrences or instantiations of the type have been recorded on the given stack. It is possible, + // though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely + // expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5 + // levels, but unequal at some level beyond that. + function isDeeplyNestedType(type, stack, depth) { + // We track all object types that have an associated symbol (representing the origin of the type) + if (depth >= 5 && type.flags & 32768 /* Object */) { var symbol = type.symbol; - var count = 0; - for (var i = 0; i < depth; i++) { - var t = stack[i]; - if (getObjectFlags(t) & (4 /* Reference */ | 64 /* Instantiated */) && t.symbol === symbol) { - count++; - if (count >= 5) - return true; + if (symbol) { + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 32768 /* Object */ && t.symbol === symbol) { + count++; + if (count >= 5) + return true; + } } } } @@ -31392,7 +34065,7 @@ var ts; } } else { - if ((sourceProp.flags & 536870912 /* Optional */) !== (targetProp.flags & 536870912 /* Optional */)) { + if ((sourceProp.flags & 67108864 /* Optional */) !== (targetProp.flags & 67108864 /* Optional */)) { return 0 /* False */; } } @@ -31436,7 +34109,7 @@ var ts; // the constraints with a common set of type arguments to get relatable entities in places where // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile, // particularly as we're comparing erased versions of the signatures below. - if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { + if (ts.length(source.typeParameters) !== ts.length(target.typeParameters)) { return 0 /* False */; } // Spec 1.0 Section 3.8.3 & 3.8.4: @@ -31476,8 +34149,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -31485,8 +34158,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -31592,8 +34265,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getFalsyFlags(t); } return result; @@ -31625,7 +34298,7 @@ var ts; types.push(undefinedType); if (flags & 4096 /* Null */) types.push(nullType); - return getUnionType(types, /*subtypeReduction*/ true); + return getUnionType(types); } function removeDefinitelyFalsyTypes(type) { return getFalsyFlags(type) & 7392 /* DefinitelyFalsy */ ? @@ -31644,8 +34317,8 @@ var ts; getSignaturesOfType(type, 0 /* Call */).length === 0 && getSignaturesOfType(type, 1 /* Construct */).length === 0; } - function createTransientSymbol(source, type) { - var symbol = createSymbol(source.flags | 67108864 /* Transient */, source.name); + function createSymbolWithType(source, type) { + var symbol = createSymbol(source.flags, source.name); symbol.declarations = source.declarations; symbol.parent = source.parent; symbol.type = type; @@ -31661,9 +34334,8 @@ var ts; var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createSymbolWithType(property, updated)); } - ; return members; } /** @@ -31687,11 +34359,19 @@ var ts; type.regularType = regularNew; return regularNew; } + function getWidenedProperty(prop) { + var original = getTypeOfSymbol(prop); + var widened = getWidenedType(original); + return widened === original ? prop : createSymbolWithType(prop, widened); + } function getWidenedTypeOfObjectLiteral(type) { - var members = transformTypeOfMembers(type, function (prop) { - var widened = getWidenedType(prop); - return prop === widened ? prop : widened; - }); + var members = ts.createMap(); + for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { + var prop = _a[_i]; + // Since get accessors already widen their return value there is no need to + // widen accessor based properties here. + members.set(prop.name, prop.flags & 4 /* Property */ ? getWidenedProperty(prop) : prop); + } var stringIndexInfo = getIndexInfoOfType(type, 0 /* String */); var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); @@ -31763,25 +34443,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 144 /* Parameter */: + case 145 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 174 /* BindingElement */: + case 175 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -31794,7 +34474,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152 /* ContainsWideningType */) { + if (produceDiagnostics && noImplicitAny && type.flags & 2097152 /* ContainsWideningType */) { // Report implicit any error within type if possible, otherwise report error on declaration if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); @@ -31821,13 +34501,14 @@ var ts; callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } - function createInferenceContext(signature, inferUnionTypes) { + function createInferenceContext(signature, inferUnionTypes, useAnyForNoInferences) { var inferences = ts.map(signature.typeParameters, createTypeInferencesObject); return { signature: signature, inferUnionTypes: inferUnionTypes, inferences: inferences, inferredTypes: new Array(signature.typeParameters.length), + useAnyForNoInferences: useAnyForNoInferences }; } function createTypeInferencesObject() { @@ -31841,25 +34522,73 @@ var ts; // Return true if the given type could possibly reference a type parameter for which // we perform type inference (i.e. a type parameter of a generic function). We cache // results for union and intersection types for performance reasons. - function couldContainTypeParameters(type) { + function couldContainTypeVariables(type) { var objectFlags = getObjectFlags(type); - return !!(type.flags & 16384 /* TypeParameter */ || - objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeParameters) || + return !!(type.flags & 540672 /* TypeVariable */ || + objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) || objectFlags & 32 /* Mapped */ || - type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type, typeParameter) { return type === typeParameter || type.flags & 196608 /* UnionOrIntersection */ && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); } - function inferTypes(context, originalSource, originalTarget) { - var typeParameters = context.signature.typeParameters; + // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct + // an object type with the same set of properties as the source type, where the type of each + // property is computed by inferring from the source property type to X for the type + // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0 /* String */); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 67108864 /* Optional */; + var members = createSymbolTable(properties); + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var prop = properties_5[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.name); + inferredProp.checkFlags = readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0; + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + members.set(prop.name, inferredProp); + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, /*subtypeReduction*/ true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; @@ -31875,7 +34604,7 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -31927,7 +34656,7 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384 /* TypeParameter */) { + if (target.flags & 540672 /* TypeVariable */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). // Because the anyFunctionType is internal, it should not be exposed to the user by adding @@ -31937,9 +34666,9 @@ var ts; if (source.flags & 8388608 /* ContainsAnyFunctionType */) { return; } - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { // Any inferences that are made to a type parameter in a union type are inferior // to inferences made to a flat (non-union) type. This is because if we infer to @@ -31953,7 +34682,7 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & 16384 /* TypeParameter */ && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -31972,25 +34701,25 @@ var ts; } else if (target.flags & 196608 /* UnionOrIntersection */) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - // First infer to each type in union or intersection that isn't a type parameter - for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { - var t = targetTypes_2[_d]; - if (t.flags & 16384 /* TypeParameter */ && ts.contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + var typeVariableCount = 0; + var typeVariable = void 0; + // First infer to each type in union or intersection that isn't a type variable + for (var _d = 0, targetTypes_3 = targetTypes; _d < targetTypes_3.length; _d++) { + var t = targetTypes_3[_d]; + if (t.flags & 540672 /* TypeVariable */ && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - // Next, if target containings a single naked type parameter, make a secondary inference to that type - // parameter. This gives meaningful results for union types in co-variant positions and intersection + // Next, if target containings a single naked type variable, make a secondary inference to that type + // variable. This gives meaningful results for union types in co-variant positions and intersection // types in contra-variant positions (such as callback parameters). - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -32008,14 +34737,14 @@ var ts; if (isInProcess(source, target)) { return; } - if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { + if (isDeeplyNestedType(source, sourceStack, depth) && isDeeplyNestedType(target, targetStack, depth)) { return; } var key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -32031,12 +34760,25 @@ var ts; function inferFromObjectTypes(source, target) { if (getObjectFlags(target) & 32 /* Mapped */) { var constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & 32 /* Mapped */) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); + if (constraintType.flags & 262144 /* Index */) { + // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X }, + // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source + // type and then make a secondary inference from that type to T. We make a secondary inference + // such that direct inferences to T get priority over inferences to Partial, for example. + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } return; } if (constraintType.flags & 16384 /* TypeParameter */) { + // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type + // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. inferFromTypes(getIndexType(source), constraintType); inferFromTypes(getUnionType(ts.map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); return; @@ -32049,8 +34791,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var targetProp = properties_6[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -32100,8 +34842,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -32151,11 +34893,20 @@ var ts; inferenceSucceeded = !!unionOrSuperType; } else { - // Infer the empty object type when no inferences were made. It is important to remember that - // in this case, inference still succeeds, meaning there is no error for not having inference - // candidates. An inference error only occurs when there are *conflicting* candidates, i.e. + // Infer either the default or the empty object type when no inferences were + // made. It is important to remember that in this case, inference still + // succeeds, meaning there is no error for not having inference candidates. An + // inference error only occurs when there are *conflicting* candidates, i.e. // candidates with no common supertype. - inferredType = emptyObjectType; + var defaultType = getDefaultFromTypeParameter(context.signature.typeParameters[index]); + if (defaultType) { + // Instantiate the default type. Any forward reference to a type + // parameter should be instantiated to the empty object type. + inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context.signature.typeParameters, index), getInferenceMapper(context))); + } + else { + inferredType = context.useAnyForNoInferences ? anyType : emptyObjectType; + } inferenceSucceeded = true; } context.inferredTypes[index] = inferredType; @@ -32196,19 +34947,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - while (node) { - switch (node.kind) { - case 160 /* TypeQuery */: - return true; - case 70 /* Identifier */: - case 141 /* QualifiedName */: - node = node.parent; - continue; - default: - return false; - } - } - ts.Debug.fail("should not get here"); + return !!ts.findAncestor(node, function (n) { return n.kind === 161 /* TypeQuery */ ? true : n.kind === 70 /* Identifier */ || n.kind === 142 /* QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -32222,7 +34961,7 @@ var ts; if (node.kind === 98 /* ThisKeyword */) { return "0"; } - if (node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 178 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -32233,7 +34972,7 @@ var ts; case 70 /* Identifier */: case 98 /* ThisKeyword */: return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return getLeftmostIdentifierOrThis(node.expression); } return undefined; @@ -32242,19 +34981,21 @@ var ts; switch (source.kind) { case 70 /* Identifier */: return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && + (target.kind === 225 /* VariableDeclaration */ || target.kind === 175 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98 /* ThisKeyword */: return target.kind === 98 /* ThisKeyword */; - case 177 /* PropertyAccessExpression */: - return target.kind === 177 /* PropertyAccessExpression */ && + case 96 /* SuperKeyword */: + return target.kind === 96 /* SuperKeyword */; + case 178 /* PropertyAccessExpression */: + return target.kind === 178 /* PropertyAccessExpression */ && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 177 /* PropertyAccessExpression */) { + while (source.kind === 178 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -32267,7 +35008,7 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 177 /* PropertyAccessExpression */ && + return target.kind === 178 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } @@ -32275,7 +35016,7 @@ var ts; if (expr.kind === 70 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } @@ -32284,9 +35025,9 @@ var ts; function isDiscriminantProperty(type, name) { if (type && type.flags & 65536 /* Union */) { var prop = getUnionOrIntersectionProperty(type, name); - if (prop && prop.flags & 268435456 /* SyntheticProperty */) { + if (prop && getCheckFlags(prop) & 2 /* SyntheticProperty */) { if (prop.isDiscriminantProperty === undefined) { - prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop)); + prop.isDiscriminantProperty = prop.checkFlags & 32 /* HasNonUniformType */ && isLiteralType(getTypeOfSymbol(prop)); } return prop.isDiscriminantProperty; } @@ -32305,7 +35046,7 @@ var ts; } } } - if (callExpression.expression.kind === 177 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 178 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -32347,8 +35088,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0 /* None */; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var t = types_14[_i]; result |= getTypeFacts(t); } return result; @@ -32358,7 +35099,7 @@ var ts; // check. This gives us a quicker out in the common case where an object type is not a function. var resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type) { var flags = type.flags; @@ -32401,9 +35142,11 @@ var ts; if (flags & 512 /* ESSymbol */) { return strictNullChecks ? 1981320 /* SymbolStrictFacts */ : 4193160 /* SymbolFacts */; } - if (flags & 16384 /* TypeParameter */) { - var constraint = getConstraintOfTypeParameter(type); - return getTypeFacts(constraint || emptyObjectType); + if (flags & 16777216 /* NonPrimitive */) { + return strictNullChecks ? 6166480 /* ObjectStrictFacts */ : 8378320 /* ObjectFacts */; + } + if (flags & 540672 /* TypeVariable */) { + return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType); } if (flags & 196608 /* UnionOrIntersection */) { return getTypeFactsOfTypes(type.types); @@ -32429,17 +35172,23 @@ var ts; } function getTypeOfDestructuredArrayElement(type, index) { return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || - checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || + checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; } function getTypeOfDestructuredSpreadExpression(type) { - return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); + return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ? + var isDestructuringDefaultAssignment = node.parent.kind === 176 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 260 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } + function isDestructuringAssignmentTarget(parent) { + return parent.parent.kind === 193 /* BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 215 /* ForOfStatement */ && parent.parent.initializer === parent; + } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), ts.indexOf(node.elements, element)); } @@ -32455,21 +35204,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return stringType; - case 213 /* ForOfStatement */: - return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 192 /* BinaryExpression */: + case 215 /* ForOfStatement */: + return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || unknownType; + case 193 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return undefinedType; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -32477,7 +35226,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 172 /* ObjectBindingPattern */ ? + var type = pattern.kind === 173 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : @@ -32495,35 +35244,35 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212 /* ForInStatement */) { + if (node.parent.parent.kind === 214 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 213 /* ForOfStatement */) { - return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; + if (node.parent.parent.kind === 215 /* ForOfStatement */) { + return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 /* VariableDeclaration */ ? + return node.kind === 225 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? + return node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 /* VariableDeclaration */ && node.initializer && + return node.kind === 225 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ && + node.kind !== 175 /* BindingElement */ && node.parent.kind === 193 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: switch (node.operatorToken.kind) { case 57 /* EqualsToken */: return getReferenceCandidate(node.left); @@ -32535,13 +35284,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 183 /* ParenthesizedExpression */ || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || - parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? + return parent.kind === 184 /* ParenthesizedExpression */ || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || + parent.kind === 193 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 256 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -32589,8 +35338,32 @@ var ts; } return f(type) ? type : neverType; } - function mapType(type, f) { - return type.flags & 65536 /* Union */ ? getUnionType(ts.map(type.types, f)) : f(type); + // Apply a mapping function to a type and return the resulting type. If the source type + // is a union type, the mapping function is applied to each constituent type and a union + // of the resulting types is returned. + function mapType(type, mapper) { + if (!(type.flags & 65536 /* Union */)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; + var t = mapper(current); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; } function extractTypesOfKind(type, kind) { return filterType(type, function (t) { return (t.flags & kind) !== 0; }); @@ -32634,7 +35407,7 @@ var ts; // we defer subtype reduction until the evolving array type is finalized into a manifest // array type. function addEvolvingArrayElementType(evolvingArrayType, node) { - var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); + var elementType = getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { @@ -32656,8 +35429,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (!(t.flags & 8192 /* Never */)) { if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; @@ -32680,11 +35453,11 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 177 /* PropertyAccessExpression */ && (parent.name.text === "length" || - parent.parent.kind === 179 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 178 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 178 /* PropertyAccessExpression */ && (parent.name.text === "length" || + parent.parent.kind === 180 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 179 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 192 /* BinaryExpression */ && + parent.parent.kind === 193 /* BinaryExpression */ && parent.parent.operatorToken.kind === 57 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -32711,14 +35484,12 @@ var ts; } return false; } - function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { + function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) { + if (initialType === void 0) { initialType = declaredType; } var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215 /* Narrowable */)) { + if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & 17810431 /* Narrowable */)) { return declaredType; } - var initialType = assumeInitialized ? declaredType : - declaredType === autoType || declaredType === autoArrayType ? undefinedType : - includeFalsyTypes(declaredType, 2048 /* Undefined */); var visitedFlowStart = visitedFlowCount; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; @@ -32727,7 +35498,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent.kind === 201 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { + if (reference.parent.kind === 202 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { return declaredType; } return resultType; @@ -32744,7 +35515,19 @@ var ts; } } var type = void 0; - if (flow.flags & 16 /* Assignment */) { + if (flow.flags & 4096 /* AfterFinally */) { + // block flow edge: finally -> pre-try (for larger explanation check comment in binder.ts - bindTryStatement + flow.locked = true; + type = getTypeAtFlowNode(flow.antecedent); + flow.locked = false; + } + else if (flow.flags & 2048 /* PreFinally */) { + // locked pre-finally flows are filtered out in getTypeAtFlowBranchLabel + // so here just redirect to antecedent + flow = flow.antecedent; + continue; + } + else if (flow.flags & 16 /* Assignment */) { type = getTypeAtFlowAssignment(flow); if (!type) { flow = flow.antecedent; @@ -32776,7 +35559,7 @@ var ts; else if (flow.flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 177 /* PropertyAccessExpression */) { + if (container && container !== flowContainer && reference.kind !== 178 /* PropertyAccessExpression */ && reference.kind !== 98 /* ThisKeyword */) { flow = container.flowNode; continue; } @@ -32830,7 +35613,7 @@ var ts; } function getTypeAtFlowArrayMutation(flow) { var node = flow.node; - var expr = node.kind === 179 /* CallExpression */ ? + var expr = node.kind === 180 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -32838,7 +35621,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -32897,6 +35680,12 @@ var ts; var seenIncomplete = false; for (var _i = 0, _a = flow.antecedents; _i < _a.length; _i++) { var antecedent = _a[_i]; + if (antecedent.flags & 2048 /* PreFinally */ && antecedent.lock.locked) { + // if flow correspond to branch from pre-try to finally and this branch is locked - this means that + // we initially have started following the flow outside the finally block. + // in this case we should ignore this branch. + continue; + } var flowType = getTypeAtFlowNode(antecedent); var type = getTypeFromFlowType(flowType); // If the type at a particular antecedent path is the declared type and the @@ -32929,8 +35718,9 @@ var ts; if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + var cached = cache.get(key); + if (cached) { + return cached; } // If this flow loop junction and reference are already being processed, return // the union of the types computed for each branch so far, marked as incomplete. @@ -32965,8 +35755,9 @@ var ts; // If we see a value appear in the cache it is a sign that control flow analysis // was restarted and completed by checkExpressionCached. We can simply pick up // the resulting type and bail out. - if (cache[key]) { - return cache[key]; + var cached_1 = cache.get(key); + if (cached_1) { + return cached_1; } if (!ts.contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -32990,10 +35781,11 @@ var ts; if (isIncomplete(firstAntecedentType)) { return createFlowType(result, /*incomplete*/ true); } - return cache[key] = result; + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 177 /* PropertyAccessExpression */ && + return expr.kind === 178 /* PropertyAccessExpression */ && declaredType.flags & 65536 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); @@ -33027,10 +35819,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 187 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { + if (left_1.kind === 188 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 187 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { + if (right_1.kind === 188 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -33076,7 +35868,7 @@ var ts; assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */; return getTypeWithFacts(type, facts); } - if (type.flags & 33281 /* NotUnionOrUnit */) { + if (type.flags & 16810497 /* NotUnionOrUnit */) { return type; } if (assumeTrue) { @@ -33107,14 +35899,22 @@ var ts; // We narrow a non-union type to an exact primitive type if the non-union type // is a supertype of that primitive type. For example, type 'any' can be narrowed // to one of the primitive types. - var targetType = typeofTypesByName[literal.text]; - if (targetType && isTypeSubtypeOf(targetType, type)) { - return targetType; + var targetType = typeofTypesByName.get(literal.text); + if (targetType) { + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(type) || anyType; + if (isTypeSubtypeOf(targetType, constraint)) { + return getIntersectionType([type, targetType]); + } + } } } var facts = assumeTrue ? - typeofEQFacts[literal.text] || 64 /* TypeofEQHostObject */ : - typeofNEFacts[literal.text] || 8192 /* TypeofNEHostObject */; + typeofEQFacts.get(literal.text) || 64 /* TypeofEQHostObject */ : + typeofNEFacts.get(literal.text) || 8192 /* TypeofNEHostObject */; return getTypeWithFacts(type, facts); } function narrowTypeBySwitchOnDiscriminant(type, switchStatement, clauseStart, clauseEnd) { @@ -33197,10 +35997,9 @@ var ts; // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the // two types. - var targetType = type.flags & 16384 /* TypeParameter */ ? getApparentType(type) : type; return isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : - isTypeAssignableTo(candidate, targetType) ? candidate : + isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); } function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { @@ -33229,7 +36028,7 @@ var ts; } else { var invokedExpression = ts.skipParentheses(callExpression.expression); - if (invokedExpression.kind === 178 /* ElementAccessExpression */ || invokedExpression.kind === 177 /* PropertyAccessExpression */) { + if (invokedExpression.kind === 179 /* ElementAccessExpression */ || invokedExpression.kind === 178 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; var possibleReference = ts.skipParentheses(accessExpression.expression); if (isMatchingReference(reference, possibleReference)) { @@ -33248,15 +36047,16 @@ var ts; switch (expr.kind) { case 70 /* Identifier */: case 98 /* ThisKeyword */: - case 177 /* PropertyAccessExpression */: + case 96 /* SuperKeyword */: + case 178 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: if (expr.operator === 50 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -33289,15 +36089,12 @@ var ts; return getTypeOfSymbol(symbol); } function getControlFlowContainer(node) { - while (true) { - node = node.parent; - if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 /* ModuleBlock */ || - node.kind === 261 /* SourceFile */ || - node.kind === 147 /* PropertyDeclaration */) { - return node; - } - } + return ts.findAncestor(node.parent, function (node) { + return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || + node.kind === 233 /* ModuleBlock */ || + node.kind === 264 /* SourceFile */ || + node.kind === 148 /* PropertyDeclaration */; + }); } // Check if a parameter is assigned anywhere within its declaring function. function isParameterAssigned(symbol) { @@ -33312,21 +36109,13 @@ var ts; return symbol.isAssigned || false; } function hasParentWithAssignmentsMarked(node) { - while (true) { - node = node.parent; - if (!node) { - return false; - } - if (ts.isFunctionLike(node) && getNodeLinks(node).flags & 4194304 /* AssignmentsMarked */) { - return true; - } - } + return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 4194304 /* AssignmentsMarked */); }); } function markParameterAssignments(node) { if (node.kind === 70 /* Identifier */) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144 /* Parameter */) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 145 /* Parameter */) { symbol.isAssigned = true; } } @@ -33338,6 +36127,15 @@ var ts; function isConstVariable(symbol) { return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType; } + /** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */ + function removeOptionalityFromDeclaredType(declaredType, declaration) { + var annotationIncludesUndefined = strictNullChecks && + declaration.kind === 145 /* Parameter */ && + declaration.initializer && + getFalsyFlags(declaredType) & 2048 /* Undefined */ && + !(getFalsyFlags(checkExpression(declaration.initializer)) & 2048 /* Undefined */); + return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 131072 /* NEUndefined */) : declaredType; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === unknownSymbol) { @@ -33352,16 +36150,14 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256 /* Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } - if (node.flags & 524288 /* AwaitContext */) { - getNodeLinks(container).flags |= 8192 /* CaptureArguments */; - } + getNodeLinks(container).flags |= 8192 /* CaptureArguments */; return getTypeOfSymbol(symbol); } if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -33373,7 +36169,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration_1.kind === 226 /* ClassDeclaration */ + if (declaration_1.kind === 228 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33385,14 +36181,14 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 197 /* ClassExpression */) { + else if (declaration_1.kind === 198 /* ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); while (container !== undefined) { if (container.parent === declaration_1) { - if (container.kind === 147 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { + if (container.kind === 148 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */; getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */; } @@ -33404,6 +36200,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -33426,15 +36223,15 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 144 /* Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 145 /* Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 184 /* FunctionExpression */ || - flowContainer.kind === 185 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 185 /* FunctionExpression */ || + flowContainer.kind === 186 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -33442,15 +36239,18 @@ var ts; // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); - var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); + var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, ts.getRootDeclaration(declaration)) : type) : + type === autoType || type === autoArrayType ? undefinedType : + includeFalsyTypes(type, 2048 /* Undefined */); + var flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized); // A variable is considered uninitialized when it is possible to analyze the entire control flow graph // from declaration to use, and when the variable's declared type doesn't include undefined but the // control flow based type does include undefined. if (type === autoType || type === autoArrayType) { if (flowType === autoType || flowType === autoArrayType) { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } @@ -33465,19 +36265,12 @@ var ts; return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isInsideFunction(node, threshold) { - var current = node; - while (current && current !== threshold) { - if (ts.isFunctionLike(current)) { - return true; - } - current = current.parent; - } - return false; + return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n); }); } function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 256 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 259 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -33502,8 +36295,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 211 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 224 /* VariableDeclarationList */).parent === container && + if (container.kind === 213 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 226 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -33515,9 +36308,9 @@ var ts; } } function isAssignedInBodyOfForStatement(node, container) { - var current = node; // skip parenthesized nodes - while (current.parent.kind === 183 /* ParenthesizedExpression */) { + var current = node; + while (current.parent.kind === 184 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -33525,7 +36318,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 190 /* PrefixUnaryExpression */ || current.parent.kind === 191 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 191 /* PrefixUnaryExpression */ || current.parent.kind === 192 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 42 /* PlusPlusToken */ || expr.operator === 43 /* MinusMinusToken */; } @@ -33534,19 +36327,11 @@ var ts; } // at this point we know that node is the target of assignment // now check that modification happens inside the statement part of the ForStatement - while (current !== container) { - if (current === container.statement) { - return true; - } - else { - current = current.parent; - } - } - return false; + return !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement; }); } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 147 /* PropertyDeclaration */ || container.kind === 150 /* Constructor */) { + if (container.kind === 148 /* PropertyDeclaration */ || container.kind === 151 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -33589,58 +36374,63 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; - if (container.kind === 150 /* Constructor */) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - // If a containing class does not have extends clause or the class extends null - // skip checking whether super statement is called before "this" accessing. - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + if (container.kind === 151 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 185 /* ArrowFunction */) { + if (container.kind === 186 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 150 /* Constructor */: + case 151 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (ts.getModifierFlags(container) & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); + // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -33652,8 +36442,8 @@ var ts; // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 184 /* FunctionExpression */ && - ts.isInJavaScriptFile(container.parent) && + if (container.kind === 185 /* FunctionExpression */ && + container.parent.kind === 193 /* BinaryExpression */ && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') var className = container.parent // x.prototype.y = f @@ -33673,7 +36463,7 @@ var ts; if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); var type = ts.hasModifier(container, 32 /* Static */) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; - return getFlowTypeOfReference(node, type, /*assumeInitialized*/ true, /*flowContainer*/ undefined); + return getFlowTypeOfReference(node, type); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); @@ -33681,7 +36471,7 @@ var ts; return type; } } - if (compilerOptions.noImplicitThis) { + if (noImplicitThis) { // With noImplicitThis, functions may not reference 'this' if it has type 'any' error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); } @@ -33689,28 +36479,23 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 278 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 281 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { - for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 144 /* Parameter */) { - return true; - } - } - return false; + return !!ts.findAncestor(node, function (n) { return n === constructorDecl ? "quit" : n.kind === 145 /* Parameter */; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 179 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 180 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 185 /* ArrowFunction */) { + while (container && container.kind === 186 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -33723,17 +36508,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = node; - while (current && current !== container && current.kind !== 142 /* ComputedPropertyName */) { - current = current.parent; - } - if (current && current.kind === 142 /* ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 143 /* ComputedPropertyName */; }); + if (current && current.kind === 143 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -33741,6 +36523,9 @@ var ts; } return unknownType; } + if (!isCallExpression && container.kind === 151 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; } @@ -33804,7 +36589,7 @@ var ts; // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment // while a property access can. - if (container.kind === 149 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { + if (container.kind === 150 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } @@ -33818,7 +36603,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (container.parent.kind === 177 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -33838,7 +36623,7 @@ var ts; } return unknownType; } - if (container.kind === 150 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 151 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; @@ -33853,7 +36638,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 150 /* Constructor */; + return container.kind === 151 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -33861,29 +36646,47 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 177 /* ObjectLiteralExpression */) { if (ts.getModifierFlags(container) & 32 /* Static */) { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */; } else { - return container.kind === 149 /* MethodDeclaration */ || - container.kind === 148 /* MethodSignature */ || - container.kind === 151 /* GetAccessor */ || - container.kind === 152 /* SetAccessor */ || - container.kind === 147 /* PropertyDeclaration */ || - container.kind === 146 /* PropertySignature */ || - container.kind === 150 /* Constructor */; + return container.kind === 150 /* MethodDeclaration */ || + container.kind === 149 /* MethodSignature */ || + container.kind === 152 /* GetAccessor */ || + container.kind === 153 /* SetAccessor */ || + container.kind === 148 /* PropertyDeclaration */ || + container.kind === 147 /* PropertySignature */ || + container.kind === 151 /* Constructor */; } } } return false; } } + function getContainingObjectLiteral(func) { + return (func.kind === 150 /* MethodDeclaration */ || + func.kind === 152 /* GetAccessor */ || + func.kind === 153 /* SetAccessor */) && func.parent.kind === 177 /* ObjectLiteralExpression */ ? func.parent : + func.kind === 185 /* FunctionExpression */ && func.parent.kind === 260 /* PropertyAssignment */ ? func.parent.parent : + undefined; + } + function getThisTypeArgument(type) { + return getObjectFlags(type) & 4 /* Reference */ && type.target === globalThisType ? type.typeArguments[0] : undefined; + } + function getThisTypeFromContextualType(type) { + return mapType(type, function (t) { + return t.flags & 131072 /* Intersection */ ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + }); + } function getContextualThisParameterType(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185 /* ArrowFunction */) { + if (func.kind === 186 /* ArrowFunction */) { + return undefined; + } + if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { var thisParameter = contextualSignature.thisParameter; @@ -33892,6 +36695,40 @@ var ts; } } } + if (noImplicitThis) { + var containingLiteral = getContainingObjectLiteral(func); + if (containingLiteral) { + // We have an object literal method. Check if the containing object literal has a contextual type + // that includes a ThisType. If so, T is the contextual type for 'this'. We continue looking in + // any directly enclosing object literals. + var contextualType = getApparentTypeOfContextualType(containingLiteral); + var literal = containingLiteral; + var type = contextualType; + while (type) { + var thisType = getThisTypeFromContextualType(type); + if (thisType) { + return instantiateType(thisType, getContextualMapper(containingLiteral)); + } + if (literal.parent.kind !== 260 /* PropertyAssignment */) { + break; + } + literal = literal.parent.parent; + type = getApparentTypeOfContextualType(literal); + } + // There was no contextual ThisType for the containing object literal, so the contextual type + // for 'this' is the non-null form of the contextual type for the containing object literal or + // the type of the object literal itself. + return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral); + } + // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the + // contextual type for 'this' is 'obj'. + if (func.parent.kind === 193 /* BinaryExpression */ && func.parent.operatorToken.kind === 57 /* EqualsToken */) { + var target = func.parent.left; + if (target.kind === 178 /* PropertyAccessExpression */ || target.kind === 179 /* ElementAccessExpression */) { + return checkExpressionCached(target.expression); + } + } + } return undefined; } // Return contextual type of parameter or undefined if no contextual type is available @@ -33899,23 +36736,23 @@ var ts; var func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { var iife = ts.getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { var indexOfParameter = ts.indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - var restTypes = []; - for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); - } - var links = getNodeLinks(iife); - var cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; - } + if (parameter.dotDotDotToken) { + var restTypes = []; + for (var i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); + } + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; + } + var links = getNodeLinks(iife); + var cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + var type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -33949,7 +36786,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 144 /* Parameter */) { + if (declaration.kind === 145 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -33960,11 +36797,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_19 = declaration.propertyName || declaration.name; - if (ts.isVariableLike(parentDeclaration) && + var name = declaration.propertyName || declaration.name; + if (parentDeclaration.kind !== 175 /* BindingElement */ && parentDeclaration.type && - !ts.isBindingPattern(name_19)) { - var text = ts.getTextOfPropertyName(name_19); + !ts.isBindingPattern(name)) { + var text = ts.getTextOfPropertyName(name); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -33975,33 +36812,34 @@ var ts; } function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); - if (ts.isAsyncFunctionLike(func)) { - var contextualReturnType = getContextualReturnType(func); - if (contextualReturnType) { - return getPromisedType(contextualReturnType); + if (func) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1 /* Generator */) { + return undefined; } - return undefined; - } - if (func && !func.asteriskToken) { - return getContextualReturnType(func); + var contextualReturnType = getContextualReturnType(func); + return functionFlags & 2 /* Async */ + ? contextualReturnType && getAwaitedTypeOfPromise(contextualReturnType) // Async function + : contextualReturnType; // Regular function } return undefined; } function getContextualTypeForYieldOperand(node) { var func = ts.getContainingFunction(node); if (func) { + var functionFlags = ts.getFunctionFlags(func); var contextualReturnType = getContextualReturnType(func); if (contextualReturnType) { return node.asteriskToken ? contextualReturnType - : getElementTypeOfIterableIterator(contextualReturnType); + : getIteratedTypeOfGenerator(contextualReturnType, (functionFlags & 2 /* Async */) !== 0); } } return undefined; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 144 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 145 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -34012,8 +36850,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 150 /* Constructor */ || - functionDecl.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152 /* SetAccessor */))) { + functionDecl.kind === 151 /* Constructor */ || + functionDecl.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 153 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -34035,7 +36873,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 181 /* TaggedTemplateExpression */) { + if (template.parent.kind === 182 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -34069,41 +36907,14 @@ var ts; } return undefined; } - // Apply a mapping function to a contextual type and return the resulting type. If the contextual type - // is a union type, the mapping function is applied to each constituent type and a union of the resulting - // types is returned. - function applyToContextualType(type, mapper) { - if (!(type.flags & 65536 /* Union */)) { - return mapper(type); - } - var types = type.types; - var mappedType; - var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; - var t = mapper(current); - if (t) { - if (!mappedType) { - mappedType = t; - } - else if (!mappedTypes) { - mappedTypes = [mappedType, t]; - } - else { - mappedTypes.push(t); - } - } - } - return mappedTypes ? getUnionType(mappedTypes) : mappedType; - } function getTypeOfPropertyOfContextualType(type, name) { - return applyToContextualType(type, function (t) { + return mapType(type, function (t) { var prop = t.flags & 229376 /* StructuredType */ ? getPropertyOfType(t, name) : undefined; return prop ? getTypeOfSymbol(prop) : undefined; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); + return mapType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }); } // Return true if the given contextual type is a tuple-like type function contextualTypeIsTupleLikeType(type) { @@ -34150,7 +36961,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */) - || (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined); + || getIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false); } return undefined; } @@ -34160,19 +36971,19 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxAttribute(attribute) { - var kind = attribute.kind; - var jsxElement = attribute.parent; - var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250 /* JsxAttribute */) { - if (!attrsType || isTypeAny(attrsType)) { + // When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type + // which is a type of the parameter of the signature we are trying out. + // If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName + var attributesType = getContextualType(attribute.parent); + if (ts.isJsxAttribute(attribute)) { + if (!attributesType || isTypeAny(attributesType)) { return undefined; } - return getTypeOfPropertyOfType(attrsType, attribute.name.text); + return getTypeOfPropertyOfType(attributesType, attribute.name.text); } - else if (attribute.kind === 251 /* JsxSpreadAttribute */) { - return attrsType; + else { + return attributesType; } - ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -34207,45 +37018,52 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223 /* VariableDeclaration */: - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 174 /* BindingElement */: + case 225 /* VariableDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 175 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 185 /* ArrowFunction */: - case 216 /* ReturnStatement */: + case 186 /* ArrowFunction */: + case 218 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 202 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */); + case 204 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 195 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return getContextualType(parent); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return getContextualType(parent); - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxAttribute */: + case 254 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + return getAttributesTypeFromJsxOpeningLikeElement(parent); } return undefined; } + function getContextualMapper(node) { + node = ts.findAncestor(node, function (n) { return !!n.contextualMapper; }); + return node ? node.contextualMapper : identityMapper; + } // If the given type is an object or union type, if that type has a single signature, and if // that signature is non-generic, return the signature. Otherwise return undefined. function getNonGenericSignature(type, node) { @@ -34273,7 +37091,7 @@ var ts; return sourceLength < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -34292,7 +37110,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; @@ -34302,8 +37120,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var current = types_17[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -34330,46 +37148,25 @@ var ts; } return result; } - /** - * Detect if the mapper implies an inference context. Specifically, there are 4 possible values - * for a mapper. Let's go through each one of them: - * - * 1. undefined - this means we are not doing inferential typing, but we may do contextual typing, - * which could cause us to assign a parameter a type - * 2. identityMapper - means we want to avoid assigning a parameter a type, whether or not we are in - * inferential typing (context is undefined for the identityMapper) - * 3. a mapper created by createInferenceMapper - we are doing inferential typing, we want to assign - * types to parameters and fix type parameters (context is defined) - * 4. an instantiation mapper created by createTypeMapper or createTypeEraser - this should never be - * passed as the contextual mapper when checking an expression (context is undefined for these) - * - * isInferentialContext is detecting if we are in case 3 - */ - function isInferentialContext(mapper) { - return mapper && mapper.context; - } - function checkSpreadExpression(node, contextualMapper) { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); + function checkSpreadExpression(node, checkMode) { + if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 1536 /* SpreadIncludes */); + } + var arrayOrIterableType = checkExpression(node.expression, checkMode); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterable*/ false); } function hasDefaultValue(node) { - return (node.kind === 174 /* BindingElement */ && !!node.initializer) || - (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); + return (node.kind === 175 /* BindingElement */ && !!node.initializer) || + (node.kind === 193 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); } - function checkArrayLiteral(node, contextualMapper) { + function checkArrayLiteral(node, checkMode) { var elements = node.elements; var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 196 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 197 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -34382,18 +37179,18 @@ var ts; // get the contextual element type from it. So we do something similar to // getContextualTypeForElementExpression, which will crucially not error // if there is no index type / iterated type. - var restArrayType = checkExpression(e.expression, contextualMapper); + var restArrayType = checkExpression(e.expression, checkMode); var restElementType = getIndexTypeOfType(restArrayType, 1 /* Number */) || - (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined); + getIteratedTypeOrElementType(restArrayType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false); if (restElementType) { elementTypes.push(restElementType); } } else { - var type = checkExpressionForMutableLocation(e, contextualMapper); + var type = checkExpressionForMutableLocation(e, checkMode); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 196 /* SpreadElement */; + hasSpreadElement = hasSpreadElement || e.kind === 197 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -34408,7 +37205,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 173 /* ArrayBindingPattern */ || pattern.kind === 175 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 174 /* ArrayBindingPattern */ || pattern.kind === 176 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -34416,7 +37213,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 198 /* OmittedExpression */) { + if (patternElement.kind !== 199 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -34433,7 +37230,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 142 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 143 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -34495,7 +37292,7 @@ var ts; var unionType = propTypes.length ? getUnionType(propTypes, /*subtypeReduction*/ true) : undefinedType; return createIndexInfo(unionType, /*isReadonly*/ false); } - function checkObjectLiteral(node, contextualMapper) { + function checkObjectLiteral(node, checkMode) { var inDestructuringPattern = ts.isAssignmentTarget(node); // Grammar checking checkGrammarObjectLiteralExpression(node, inDestructuringPattern); @@ -34505,7 +37302,8 @@ var ts; var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 172 /* ObjectBindingPattern */ || contextualType.pattern.kind === 176 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 173 /* ObjectBindingPattern */ || contextualType.pattern.kind === 177 /* ObjectLiteralExpression */); + var isJSObjectLiteral = !contextualType && ts.isInJavaScriptFile(node); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -34514,29 +37312,29 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 /* PropertyAssignment */ || - memberDecl.kind === 258 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 260 /* PropertyAssignment */ || + memberDecl.kind === 261 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257 /* PropertyAssignment */) { - type = checkPropertyAssignment(memberDecl, contextualMapper); + if (memberDecl.kind === 260 /* PropertyAssignment */) { + type = checkPropertyAssignment(memberDecl, checkMode); } - else if (memberDecl.kind === 149 /* MethodDeclaration */) { - type = checkObjectLiteralMethod(memberDecl, contextualMapper); + else if (memberDecl.kind === 150 /* MethodDeclaration */) { + type = checkObjectLiteralMethod(memberDecl, checkMode); } else { - ts.Debug.assert(memberDecl.kind === 258 /* ShorthandPropertyAssignment */); - type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 261 /* ShorthandPropertyAssignment */); + type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } typeFlags |= type.flags; - var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); + var prop = createSymbol(4 /* Property */ | member.flags, member.name); if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 257 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 260 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 261 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { - prop.flags |= 536870912 /* Optional */; + prop.flags |= 67108864 /* Optional */; } if (ts.hasDynamicName(memberDecl)) { patternWithComputedProperties = true; @@ -34547,9 +37345,9 @@ var ts; // binding pattern specifies a default value for the property, make the property optional. var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { - prop.flags |= impliedProp.flags & 536870912 /* Optional */; + prop.flags |= impliedProp.flags & 67108864 /* Optional */; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0 /* String */)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -34562,9 +37360,12 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259 /* SpreadAssignment */) { + else if (memberDecl.kind === 262 /* SpreadAssignment */) { + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(memberDecl, 2 /* Assign */); + } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = ts.createMap(); hasComputedStringProperty = false; @@ -34572,11 +37373,11 @@ var ts; typeFlags = 0; } var type = checkExpression(memberDecl.expression); - if (!(type.flags & (32768 /* Object */ | 1 /* Any */))) { + if (!isValidSpreadType(type)) { error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } @@ -34586,8 +37387,8 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 151 /* GetAccessor */ || memberDecl.kind === 152 /* SetAccessor */); - checkAccessorDeclaration(memberDecl); + ts.Debug.assert(memberDecl.kind === 152 /* GetAccessor */ || memberDecl.kind === 153 /* SetAccessor */); + checkNodeDeferred(memberDecl); } if (ts.hasDynamicName(memberDecl)) { if (isNumericName(memberDecl.name)) { @@ -34598,7 +37399,7 @@ var ts; } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } @@ -34607,27 +37408,30 @@ var ts; if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable[prop.name]) { - if (!(prop.flags & 536870912 /* Optional */)) { + if (!propertiesTable.get(prop.name)) { + if (!(prop.flags & 67108864 /* Optional */)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } } if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); + } + if (spread.flags & 32768 /* Object */) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; return spread; } return createObjectLiteralType(); function createObjectLiteralType() { - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined; + var stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0 /* String */) : undefined; + var numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1 /* Number */) : undefined; var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */; result.flags |= 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 14680064 /* PropagatingFlags */); @@ -34644,9 +37448,14 @@ var ts; return result; } } + function isValidSpreadType(type) { + return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */ | 16777216 /* NonPrimitive */) || + type.flags & 32768 /* Object */ && !isGenericMappedType(type) || + type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); + } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } function checkJsxElement(node) { // Check attributes @@ -34662,18 +37471,18 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: checkJsxExpression(child); break; - case 246 /* JsxElement */: + case 248 /* JsxElement */: checkJsxElement(child); break; - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } } - return jsxElementType || anyType; + return getJsxGlobalElementType() || anyType; } /** * Returns true iff the JSX element name would be a valid JS identifier, ignoring restrictions about keywords not being identifiers @@ -34687,81 +37496,114 @@ var ts; */ function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment - if (tagName.kind === 177 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { + if (tagName.kind === 178 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { return false; } else { return ts.isIntrinsicJsxName(tagName.text); } } - function checkJsxAttribute(node, elementAttributesType, nameTable) { - var correspondingPropType = undefined; - // Look up the corresponding property for this attribute - if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) { - // If there is no 'props' property, you may not have non-"data-" attributes - error(node.parent, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); - } - else if (elementAttributesType && !isTypeAny(elementAttributesType)) { - var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); - correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - if (isUnhyphenatedJsxName(node.name.text)) { - var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0 /* String */); - if (attributeType) { - correspondingPropType = attributeType; + /** + * Get attributes type of the JSX opening-like element. The result is from resolving "attributes" property of the opening-like element. + * + * @param openingLikeElement a JSX opening-like element + * @param filter a function to remove attributes that will not participate in checking whether attributes are assignable + * @return an anonymous type (similar to the one returned by checkObjectLiteral) in which its properties are attributes property. + * @remarks Because this function calls getSpreadType, it needs to use the same checks as checkObjectLiteral, + * which also calls getSpreadType. + */ + function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, filter, checkMode) { + var attributes = openingLikeElement.attributes; + var attributesTable = ts.createMap(); + var spread = emptyObjectType; + var attributesArray = []; + for (var _i = 0, _a = attributes.properties; _i < _a.length; _i++) { + var attributeDecl = _a[_i]; + var member = attributeDecl.symbol; + if (ts.isJsxAttribute(attributeDecl)) { + var exprType = attributeDecl.initializer ? + checkExpression(attributeDecl.initializer, checkMode) : + trueType; // is sugar for + var attributeSymbol = createSymbol(4 /* Property */ | 134217728 /* Transient */ | member.flags, member.name); + attributeSymbol.declarations = member.declarations; + attributeSymbol.parent = member.parent; + if (member.valueDeclaration) { + attributeSymbol.valueDeclaration = member.valueDeclaration; } - else { - // If there's no corresponding property with this name, error - if (!correspondingPropType) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; - } + attributeSymbol.type = exprType; + attributeSymbol.target = member; + attributesTable.set(attributeSymbol.name, attributeSymbol); + attributesArray.push(attributeSymbol); + } + else { + ts.Debug.assert(attributeDecl.kind === 254 /* JsxSpreadAttribute */); + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + var exprType = checkExpression(attributeDecl.expression); + if (!isValidSpreadType(exprType)) { + error(attributeDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); + return anyType; + } + if (isTypeAny(exprType)) { + return anyType; } + spread = getSpreadType(spread, exprType); } } - var exprType; - if (node.initializer) { - exprType = checkExpression(node.initializer); + if (spread !== emptyObjectType) { + if (attributesArray.length > 0) { + spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); + attributesArray = []; + attributesTable = ts.createMap(); + } + attributesArray = getPropertiesOfType(spread); } - else { - // is sugar for - exprType = booleanType; + attributesTable = ts.createMap(); + if (attributesArray) { + ts.forEach(attributesArray, function (attr) { + if (!filter || filter(attr)) { + attributesTable.set(attr.name, attr); + } + }); } - if (correspondingPropType) { - checkTypeAssignableTo(exprType, correspondingPropType, node); + return createJsxAttributesType(attributes.symbol, attributesTable); + /** + * Create anonymous type from given attributes symbol table. + * @param symbol a symbol of JsxAttributes containing attributes corresponding to attributesTable + * @param attributesTable a symbol table of attributes property + */ + function createJsxAttributesType(symbol, attributesTable) { + var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined); + var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576 /* FreshLiteral */; + result.flags |= 33554432 /* JsxAttributes */ | 4194304 /* ContainsObjectLiteral */ | freshObjectLiteralFlag; + result.objectFlags |= 128 /* ObjectLiteral */; + return result; } - nameTable[node.name.text] = true; - return exprType; } - function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { - var type = checkExpression(node.expression); - var props = getPropertiesOfType(type); - for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { - var prop = props_2[_i]; - // Is there a corresponding property in the element attributes type? Skip checking of properties - // that have already been assigned to, as these are not actually pushed into the resulting type - if (!nameTable[prop.name]) { - var targetPropSym = getPropertyOfType(elementAttributesType, prop.name); - if (targetPropSym) { - var msg = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); - checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); - } - nameTable[prop.name] = true; - } - } - return type; + /** + * Check attributes property of opening-like element. This function is called during chooseOverload to get call signature of a JSX opening-like element. + * (See "checkApplicableSignatureForJsxOpeningLikeElement" for how the function is used) + * @param node a JSXAttributes to be resolved of its type + */ + function checkJsxAttributes(node, checkMode) { + return createJsxAttributesTypeFromAttributesProperty(node.parent, /*filter*/ undefined, checkMode); } function getJsxType(name) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + var jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } /** - * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic - * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic - * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement). - * May also return unknownSymbol if both of these lookups fail. - */ + * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic + * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic + * string index signature (in which case nodeLinks.jsxFlags will be IntrinsicIndexedElement). + * May also return unknownSymbol if both of these lookups fail. + */ function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { @@ -34784,7 +37626,7 @@ var ts; return links.resolvedSymbol = unknownSymbol; } else { - if (compilerOptions.noImplicitAny) { + if (noImplicitAny) { error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); } return links.resolvedSymbol = unknownSymbol; @@ -34849,28 +37691,133 @@ var ts; } } /** - * Given React element instance type and the class type, resolve the Jsx type - * Pass elemType to handle individual type in the union typed element type. - */ - function getResolvedJsxType(node, elemType, elemClassType) { - if (!elemType) { - elemType = checkExpression(node.tagName); + * Get JSX attributes type by trying to resolve openingLikeElement as a stateless function component. + * Return only attributes type of successfully resolved call signature. + * This function assumes that the caller handled other possible element type of the JSX element (e.g. stateful component) + * Unlike tryGetAllJsxStatelessFunctionAttributesType, this function is a default behavior of type-checkers. + * @param openingLikeElement a JSX opening-like element to find attributes type + * @param elementType a type of the opening-like element. This elementType can't be an union type + * @param elemInstanceType an element instance type (the result of newing or invoking this tag) + * @param elementClassType a JSX-ElementClass type. This is a result of looking up ElementClass interface in the JSX global + */ + function defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536 /* Union */)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + // We don't call getResolvedSignature here because we have already resolve the type of JSX Element. + var callSignature = getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, /*candidatesOutArray*/ undefined); + if (callSignature !== unknownSignature) { + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return paramType; + } + } + } + } + return undefined; + } + /** + * Get JSX attributes type by trying to resolve openingLikeElement as a stateless function component. + * Return all attributes type of resolved call signature including candidate signatures. + * This function assumes that the caller handled other possible element type of the JSX element. + * This function is a behavior used by language service when looking up completion in JSX element. + * @param openingLikeElement a JSX opening-like element to find attributes type + * @param elementType a type of the opening-like element. This elementType can't be an union type + * @param elemInstanceType an element instance type (the result of newing or invoking this tag) + * @param elementClassType a JSX-ElementClass type. This is a result of looking up ElementClass interface in the JSX global + */ + function tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) { + ts.Debug.assert(!(elementType.flags & 65536 /* Union */)); + if (!elementClassType || !isTypeAssignableTo(elemInstanceType, elementClassType)) { + // Is this is a stateless function component? See if its single signature's return type is assignable to the JSX Element Type + var jsxStatelessElementType = getJsxGlobalStatelessElementType(); + if (jsxStatelessElementType) { + // We don't call getResolvedSignature because here we have already resolve the type of JSX Element. + var candidatesOutArray = []; + getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray); + var result = void 0; + var allMatchingAttributesType = void 0; + for (var _i = 0, candidatesOutArray_1 = candidatesOutArray; _i < candidatesOutArray_1.length; _i++) { + var candidate = candidatesOutArray_1[_i]; + var callReturnType = getReturnTypeOfSignature(candidate); + var paramType = callReturnType && (candidate.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(candidate.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxStatelessElementType)) { + var shouldBeCandidate = true; + for (var _a = 0, _b = openingLikeElement.attributes.properties; _a < _b.length; _a++) { + var attribute = _b[_a]; + if (ts.isJsxAttribute(attribute) && + isUnhyphenatedJsxName(attribute.name.text) && + !getPropertyOfType(paramType, attribute.name.text)) { + shouldBeCandidate = false; + break; + } + } + if (shouldBeCandidate) { + result = intersectTypes(result, paramType); + } + allMatchingAttributesType = intersectTypes(allMatchingAttributesType, paramType); + } + } + // If we can't find any matching, just return everything. + if (!result) { + result = allMatchingAttributesType; + } + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + result = intersectTypes(intrinsicAttributes, result); + } + return result; + } } - if (elemType.flags & 65536 /* Union */) { - var types = elemType.types; - return getUnionType(ts.map(types, function (type) { - return getResolvedJsxType(node, type, elemClassType); + return undefined; + } + /** + * Resolve attributes type of the given opening-like element. The attributes type is a type of attributes associated with the given elementType. + * For instance: + * declare function Foo(attr: { p1: string}): JSX.Element; + * ; // This function will try resolve "Foo" and return an attributes type of "Foo" which is "{ p1: string }" + * + * The function is intended to initially be called from getAttributesTypeFromJsxOpeningLikeElement which already handle JSX-intrinsic-element.. + * This function will try to resolve custom JSX attributes type in following order: string literal, stateless function, and stateful component + * + * @param openingLikeElement a non-intrinsic JSXOPeningLikeElement + * @param shouldIncludeAllStatelessAttributesType a boolean indicating whether to include all attributes types from all stateless function signature + * @param elementType an instance type of the given opening-like element. If undefined, the function will check type openinglikeElement's tagname. + * @param elementClassType a JSX-ElementClass type. This is a result of looking up ElementClass interface in the JSX global (imported from react.d.ts) + * @return attributes type if able to resolve the type of node + * anyType if there is no type ElementAttributesProperty or there is an error + * emptyObjectType if there is no "prop" in the element instance type + */ + function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) { + if (!elementType) { + elementType = checkExpression(openingLikeElement.tagName); + } + if (elementType.flags & 65536 /* Union */) { + var types = elementType.types; + return getUnionType(types.map(function (type) { + return resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, type, elementClassType); }), /*subtypeReduction*/ true); } // If the elemType is a string type, we have to return anyType to prevent an error downstream as we will try to find construct or call signature of the type - if (elemType.flags & 2 /* String */) { + if (elementType.flags & 2 /* String */) { return anyType; } - else if (elemType.flags & 32 /* StringLiteral */) { + else if (elementType.flags & 32 /* StringLiteral */) { // If the elemType is a stringLiteral type, we can then provide a check to make sure that the string literal type is one of the Jsx intrinsic element type + // For example: + // var CustomTag: "h1" = "h1"; + // Hello World var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { - var stringLiteralTypeName = elemType.text; + var stringLiteralTypeName = elementType.text; var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName); if (intrinsicProp) { return getTypeOfSymbol(intrinsicProp); @@ -34879,34 +37826,24 @@ var ts; if (indexSignatureType) { return indexSignatureType; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); + error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); } // If we need to report an error, we already done so here. So just return any to prevent any more error downstream return anyType; } // Get the element instance type (the result of newing or invoking this tag) - var elemInstanceType = getJsxElementInstanceType(node, elemType); - if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { - // Is this is a stateless function component? See if its single signature's return type is - // assignable to the JSX Element Type - if (jsxElementType) { - var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - // Intersect in JSX.IntrinsicAttributes if it exists - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); - } - return paramType; - } - } + var elemInstanceType = getJsxElementInstanceType(openingLikeElement, elementType); + // If we should include all stateless attributes type, then get all attributes type from all stateless function signature. + // Otherwise get only attributes type from the signature picked by choose-overload logic. + var statelessAttributesType = shouldIncludeAllStatelessAttributesType ? + tryGetAllJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType) : + defaultTryGetJsxStatelessFunctionAttributesType(openingLikeElement, elementType, elemInstanceType, elementClassType); + if (statelessAttributesType) { + return statelessAttributesType; } // Issue an error if this return type isn't assignable to JSX.ElementClass - if (elemClassType) { - checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); + if (elementClassType) { + checkTypeRelatedTo(elemInstanceType, elementClassType, assignableRelation, openingLikeElement, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); } if (isTypeAny(elemInstanceType)) { return elemInstanceType; @@ -34930,11 +37867,6 @@ var ts; // Props is of type 'any' or unknown return attributesType; } - else if (attributesType.flags & 65536 /* Union */) { - // Props cannot be a union type - error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); - return anyType; - } else { // Normal case -- add in IntrinsicClassElements and IntrinsicElements var apparentAttributesType = attributesType; @@ -34959,30 +37891,68 @@ var ts; } } /** - * Given an opening/self-closing element, get the 'element attributes type', i.e. the type that tells - * us which attributes are valid on a given element. + * Get attributes type of the given intrinsic opening-like Jsx element by resolving the tag name. + * The function is intended to be called from a function which has checked that the opening element is an intrinsic element. + * @param node an intrinsic JSX opening-like element */ - function getJsxElementAttributesType(node) { + function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { + ts.Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); var links = getNodeLinks(node); - if (!links.resolvedJsxType) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - var symbol = getIntrinsicTagSymbol(node); - if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { - return links.resolvedJsxType = getTypeOfSymbol(symbol); - } - else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { - return links.resolvedJsxType = getIndexInfoOfSymbol(symbol, 0 /* String */).type; - } - else { - return links.resolvedJsxType = unknownType; - } + if (!links.resolvedJsxElementAttributesType) { + var symbol = getIntrinsicTagSymbol(node); + if (links.jsxFlags & 1 /* IntrinsicNamedElement */) { + return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol); + } + else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) { + return links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, 0 /* String */).type; } else { - var elemClassType = getJsxGlobalElementClassType(); - return links.resolvedJsxType = getResolvedJsxType(node, undefined, elemClassType); + return links.resolvedJsxElementAttributesType = unknownType; } } - return links.resolvedJsxType; + return links.resolvedJsxElementAttributesType; + } + /** + * Get attributes type of the given custom opening-like JSX element. + * This function is intended to be called from a caller that handles intrinsic JSX element already. + * @param node a custom JSX opening-like element + * @param shouldIncludeAllStatelessAttributesType a boolean value used by language service to get all possible attributes type from an overload stateless function component + */ + function getCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType) { + var links = getNodeLinks(node); + if (!links.resolvedJsxElementAttributesType) { + var elemClassType = getJsxGlobalElementClassType(); + return links.resolvedJsxElementAttributesType = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, /*elementType*/ undefined, elemClassType); + } + return links.resolvedJsxElementAttributesType; + } + /** + * Get all possible attributes type, especially from an overload stateless function component, of the given JSX opening-like element. + * This function is called by language service (see: completions-tryGetGlobalSymbols). + * @param node a JSX opening-like element to get attributes type for + */ + function getAllAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + // Because in language service, the given JSX opening-like element may be incomplete and therefore, + // we can't resolve to exact signature if the element is a stateless function component so the best thing to do is return all attributes type from all overloads. + return getCustomJsxElementAttributesType(node, /*shouldIncludeAllStatelessAttributesType*/ true); + } + } + /** + * Get the attributes type, which indicates the attributes that are valid on the given JSXOpeningLikeElement. + * @param node a JSXOpeningLikeElement node + * @return an attributes type of the given node + */ + function getAttributesTypeFromJsxOpeningLikeElement(node) { + if (isJsxIntrinsicIdentifier(node.tagName)) { + return getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); + } + else { + return getCustomJsxElementAttributesType(node, /*shouldIncludeAllStatelessAttributesType*/ false); + } } /** * Given a JSX attribute, returns the symbol for the corresponds property @@ -34990,17 +37960,34 @@ var ts; * that have no matching element attributes type property. */ function getJsxAttributePropertySymbol(attrib) { - var attributesType = getJsxElementAttributesType(attrib.parent); + var attributesType = getAttributesTypeFromJsxOpeningLikeElement(attrib.parent.parent); var prop = getPropertyOfType(attributesType, attrib.name.text); return prop || unknownSymbol; } function getJsxGlobalElementClassType() { - if (!jsxElementClassType) { - jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + if (!deferredJsxElementClassType) { + deferredJsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + } + return deferredJsxElementClassType; + } + function getJsxGlobalElementType() { + if (!deferredJsxElementType) { + deferredJsxElementType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.Element); + } + return deferredJsxElementType; + } + function getJsxGlobalStatelessElementType() { + if (!deferredJsxStatelessElementType) { + var jsxElementType = getJsxGlobalElementType(); + if (jsxElementType) { + deferredJsxStatelessElementType = getUnionType([jsxElementType, nullType]); + } } - return jsxElementClassType; + return deferredJsxStatelessElementType; } - /// Returns all the properties of the Jsx.IntrinsicElements interface + /** + * Returns all the properties of the Jsx.IntrinsicElements interface + */ function getJsxIntrinsicTagNames() { var intrinsics = getJsxType(JsxNames.IntrinsicElements); return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; @@ -35010,8 +37997,8 @@ var ts; if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) { error(errorNode, ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); } - if (jsxElementType === undefined) { - if (compilerOptions.noImplicitAny) { + if (getJsxGlobalElementType() === undefined) { + if (noImplicitAny) { error(errorNode, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); } } @@ -35033,39 +38020,46 @@ var ts; markAliasSymbolAsReferenced(reactSym); } } - var targetAttributesType = getJsxElementAttributesType(node); - var nameTable = ts.createMap(); - // Process this array in right-to-left order so we know which - // attributes (mostly from spreads) are being overwritten and - // thus should have their types ignored - var sawSpreadedAny = false; - for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250 /* JsxAttribute */) { - checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); - } - else { - ts.Debug.assert(node.attributes[i].kind === 251 /* JsxSpreadAttribute */); - var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); - if (isTypeAny(spreadType)) { - sawSpreadedAny = true; - } - } + checkJsxAttributesAssignableToTagNameAttributes(node); + } + /** + * Check whether the given attributes of JSX opening-like element is assignable to the tagName attributes. + * Get the attributes type of the opening-like element through resolving the tagName, "target attributes" + * Check assignablity between given attributes property, "source attributes", and the "target attributes" + * @param openingLikeElement an opening-like JSX element to check its JSXAttributes + */ + function checkJsxAttributesAssignableToTagNameAttributes(openingLikeElement) { + // The function involves following steps: + // 1. Figure out expected attributes type by resolving tagName of the JSX opening-like element, targetAttributesType. + // During these steps, we will try to resolve the tagName as intrinsic name, stateless function, stateful component (in the order) + // 2. Solved JSX attributes type given by users, sourceAttributesType, which is by resolving "attributes" property of the JSX opening-like element. + // 3. Check if the two are assignable to each other + // targetAttributesType is a type of an attributes from resolving tagName of an opening-like JSX element. + var targetAttributesType = isJsxIntrinsicIdentifier(openingLikeElement.tagName) ? + getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : + getCustomJsxElementAttributesType(openingLikeElement, /*shouldIncludeAllStatelessAttributesType*/ false); + // sourceAttributesType is a type of an attributes properties. + // i.e
+ // attr1 and attr2 are treated as JSXAttributes attached in the JsxOpeningLikeElement as "attributes". + var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, function (attribute) { + return isUnhyphenatedJsxName(attribute.name) || !!(getPropertyOfType(targetAttributesType, attribute.name)); + }); + // If the targetAttributesType is an emptyObjectType, indicating that there is no property named 'props' on this instance type. + // but there exists a sourceAttributesType, we need to explicitly give an error as normal assignability check allow excess properties and will pass. + if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || sourceAttributesType.properties.length > 0)) { + error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); } - // Check that all required properties have been provided. If an 'any' - // was spreaded in, though, assume that it provided all required properties - if (targetAttributesType && !sawSpreadedAny) { - var targetProperties = getPropertiesOfType(targetAttributesType); - for (var i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & 536870912 /* Optional */) && - !nameTable[targetProperties[i].name]) { - error(node, ts.Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); - } - } + else { + checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); } } - function checkJsxExpression(node) { + function checkJsxExpression(node, checkMode) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression, checkMode); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; @@ -35074,14 +38068,32 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 147 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 148 /* PropertyDeclaration */; } function getDeclarationModifierFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; + if (s.valueDeclaration) { + var flags = ts.getCombinedModifierFlags(s.valueDeclaration); + return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */; + } + if (getCheckFlags(s) & 6 /* Synthetic */) { + var checkFlags = s.checkFlags; + var accessModifier = checkFlags & 256 /* ContainsPrivate */ ? 8 /* Private */ : + checkFlags & 64 /* ContainsPublic */ ? 4 /* Public */ : + 16 /* Protected */; + var staticModifier = checkFlags & 512 /* ContainsStatic */ ? 32 /* Static */ : 0; + return accessModifier | staticModifier; + } + if (s.flags & 16777216 /* Prototype */) { + return 4 /* Public */ | 32 /* Static */; + } + return 0; } function getDeclarationNodeFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } + function isMethodLike(symbol) { + return !!(symbol.flags & 8192 /* Method */ || getCheckFlags(symbol) & 4 /* SyntheticMethod */); + } /** * Check whether the requested property access is valid. * Returns true if node is a valid property access, and false otherwise. @@ -35090,12 +38102,16 @@ var ts; * @param type The type of left. * @param prop The symbol for the right hand side of the property access. */ - function checkClassPropertyAccess(node, left, type, prop) { + function checkPropertyAccessibility(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); - var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 223 /* VariableDeclaration */ ? + var errorNode = node.kind === 178 /* PropertyAccessExpression */ || node.kind === 225 /* VariableDeclaration */ ? node.name : node.right; + if (getCheckFlags(prop) & 256 /* ContainsPrivate */) { + // Synthetic property with private constituent property + error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); + return false; + } if (left.kind === 96 /* SuperKeyword */) { // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or @@ -35104,18 +38120,22 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 149 /* MethodDeclaration */) { - // `prop` refers to a *property* declared in the super class - // rather than a *method*, so it does not satisfy the above criteria. - error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - return false; + if (languageVersion < 2 /* ES2015 */) { + var hasNonMethodDeclaration = forEachProperty(prop, function (p) { + var propKind = getDeclarationKindFromSymbol(p); + return propKind !== 150 /* MethodDeclaration */ && propKind !== 149 /* MethodSignature */; + }); + if (hasNonMethodDeclaration) { + error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + return false; + } } if (flags & 128 /* Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an // additional error elsewhere. - error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } } @@ -35128,7 +38148,7 @@ var ts; if (flags & 8 /* Private */) { var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (!isNodeWithinClass(node, declaringClassDeclaration)) { - error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(getDeclaringClass(prop))); return false; } return true; @@ -35138,14 +38158,15 @@ var ts; if (left.kind === 96 /* SuperKeyword */) { return true; } - // Get the enclosing class that has the declaring class as its base type + // Find the first enclosing class that has the declaring classes of the protected constituents + // of the property as base classes var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); - return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + return isClassDerivedFromDeclaringClasses(enclosingClass, prop) ? enclosingClass : undefined; }); // A protected property is accessible if the property is within the declaring class or classes derived from it if (!enclosingClass) { - error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || type)); return false; } // No further restrictions for static properties @@ -35157,7 +38178,6 @@ var ts; // get the original type -- represented as the type constraint of the 'this' type type = getConstraintOfTypeParameter(type); } - // TODO: why is the first part of this check here? if (!(getObjectFlags(getTargetType(type)) & 3 /* ClassOrInterface */ && hasBaseType(type, enclosingClass))) { error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; @@ -35165,16 +38185,17 @@ var ts; return true; } function checkNonNullExpression(node) { - var type = checkExpression(node); - if (strictNullChecks) { - var kind = getFalsyFlags(type) & 6144 /* Nullable */; - if (kind) { - error(node, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + function checkNonNullType(type, errorNode) { + var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 6144 /* Nullable */; + if (kind) { + error(errorNode, kind & 2048 /* Undefined */ ? kind & 4096 /* Null */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + var t = getNonNullableType(type); + return t.flags & (6144 /* Nullable */ | 8192 /* Never */) ? unknownType : t; } return type; } @@ -35203,7 +38224,7 @@ var ts; noUnusedIdentifiers && (prop.flags & 106500 /* ClassMember */) && prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8 /* Private */)) { - if (prop.flags & 16777216 /* Instantiated */) { + if (getCheckFlags(prop) & 1 /* Instantiated */) { getSymbolLinks(prop).target.isReferenced = true; } else { @@ -35211,6 +38232,15 @@ var ts; } } } + function isInPropertyInitializer(node) { + while (node) { + if (node.parent && node.parent.kind === 148 /* PropertyDeclaration */ && node.parent.initializer === node) { + return true; + } + node = node.parent; + } + return false; + } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { var type = checkNonNullExpression(left); if (isTypeAny(type) || type === silentNeverType) { @@ -35223,16 +38253,30 @@ var ts; } var prop = getPropertyOfType(apparentType, right.text); if (!prop) { + var stringIndexType = getIndexTypeOfType(apparentType, 0 /* String */); + if (stringIndexType) { + return stringIndexType; + } if (right.text && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 /* TypeParameter */ && type.isThisType ? apparentType : type); } return unknownType; } + if (prop.valueDeclaration) { + if (isInPropertyInitializer(node) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + } + if (prop.valueDeclaration.kind === 228 /* ClassDeclaration */ && + node.parent && node.parent.kind !== 158 /* TypeReference */ && + !ts.isInAmbientContext(prop.valueDeclaration) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, ts.Diagnostics.Class_0_used_before_its_declaration, right.text); + } + } markPropertyAsReferenced(prop); getNodeLinks(node).resolvedSymbol = prop; - if (prop.parent && prop.parent.flags & 32 /* Class */) { - checkClassPropertyAccess(node, left, apparentType, prop); - } + checkPropertyAccessibility(node, left, apparentType, prop); var propType = getTypeOfSymbol(prop); var assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { @@ -35244,23 +38288,23 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 177 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || + if (node.kind !== 178 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 65536 /* Union */)) { return propType; } - var flowType = getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined); + var flowType = getFlowTypeOfReference(node, propType); return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 177 /* PropertyAccessExpression */ + var left = node.kind === 178 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); if (type !== unknownType && !isTypeAny(type)) { var prop = getPropertyOfType(getWidenedType(type), propertyName); - if (prop && prop.parent && prop.parent.flags & 32 /* Class */) { - return checkClassPropertyAccess(node, left, type, prop); + if (prop) { + return checkPropertyAccessibility(node, left, type, prop); } } return true; @@ -35270,7 +38314,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer.kind === 226 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -35299,7 +38343,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 /* ForInStatement */ && + if (node.kind === 214 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -35317,7 +38361,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 180 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 181 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -35337,7 +38381,7 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { @@ -35361,7 +38405,7 @@ var ts; if (!leftHandSideSymbol) { return false; } - var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + var globalESSymbol = getGlobalESSymbolConstructorSymbol(/*reportErrors*/ true); if (!globalESSymbol) { // Already errored when we tried to look up the symbol return false; @@ -35375,10 +38419,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 145 /* Decorator */) { + else if (node.kind !== 146 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -35405,16 +38449,16 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { - var signature = signatures_2[_i]; + for (var _i = 0, signatures_3 = signatures; _i < signatures_3.length; _i++) { + var signature = signatures_3[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent; index = cutoffIndex; } } @@ -35422,7 +38466,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35444,7 +38488,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 196 /* SpreadElement */) { + if (arg && arg.kind === 197 /* SpreadElement */) { return i; } } @@ -35457,13 +38501,17 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (ts.isJsxOpeningLikeElement(node)) { + // The arity check will be done in "checkApplicableSignatureForJsxOpeningLikeElement". + return true; + } + if (node.kind === 182 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 194 /* TemplateExpression */) { + if (tagExpression.template.kind === 195 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -35480,7 +38528,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* Decorator */) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -35489,19 +38537,21 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 180 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 181 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; - // If we are missing the close paren, the call is incomplete. + // If we are missing the close parenthesis, the call is incomplete. callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; spreadArgIndex = getSpreadArgumentIndex(args); } // If the user supplied type arguments, but the number of type arguments does not match // the declared number of type parameters, the call has an incorrect arity. + var numTypeParameters = ts.length(signature.typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + (typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { return false; } @@ -35531,10 +38581,10 @@ var ts; } // Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec) function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature, /*inferUnionTypes*/ true); + var context = createInferenceContext(signature, /*inferUnionTypes*/ true, /*useAnyForNoInferences*/ false); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -35565,7 +38615,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. @@ -35573,7 +38623,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type @@ -35584,7 +38634,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } // In the second pass we visit only context sensitive arguments, and only those that aren't excluded, this @@ -35598,7 +38648,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -35608,7 +38658,7 @@ var ts; var typeParameters = signature.typeParameters; var typeArgumentsAreAssignable = true; var mapper; - for (var i = 0; i < typeParameters.length; i++) { + for (var i = 0; i < typeArgumentNodes.length; i++) { if (typeArgumentsAreAssignable /* so far */) { var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -35628,9 +38678,44 @@ var ts; } return typeArgumentsAreAssignable; } + /** + * Check if the given signature can possibly be a signature called by the JSX opening-like element. + * @param node a JSX opening-like element we are trying to figure its call signature + * @param signature a candidate signature we are trying whether it is a call signature + * @param relation a relationship to check parameter and argument type + * @param excludeArgument + */ + function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation) { + // JSX opening-like element has correct arity for stateless-function component if the one of the following condition is true: + // 1. callIsIncomplete + // 2. attributes property has same number of properties as the parameter object type. + // We can figure that out by resolving attributes property and check number of properties in the resolved type + // If the call has correct arity, we will then check if the argument type and parameter type is assignable + var callIsIncomplete = node.attributes.end === node.end; // If we are missing the close "/>", the call is incomplete + if (callIsIncomplete) { + return true; + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; + // Stateless function components can have maximum of three arguments: "props", "context", and "updater". + // However "context" and "updater" are implicit and can't be specify by users. Only the first parameter, props, + // can be specified by users through attributes property. + var paramType = getTypeAtPosition(signature, 0); + var attributesType = checkExpressionWithContextualType(node.attributes, paramType, /*contextualMapper*/ undefined); + var argProperties = getPropertiesOfType(attributesType); + for (var _i = 0, argProperties_1 = argProperties; _i < argProperties_1.length; _i++) { + var arg = argProperties_1[_i]; + if (!getPropertyOfType(paramType, arg.name) && isUnhyphenatedJsxName(arg.name)) { + return false; + } + } + return checkTypeRelatedTo(attributesType, paramType, relation, /*errorNode*/ undefined, headMessage); + } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (ts.isJsxOpeningLikeElement(node)) { + return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation); + } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 180 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 181 /* NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -35647,7 +38732,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 199 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i); @@ -35669,12 +38754,12 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 179 /* CallExpression */) { + if (node.kind === 180 /* CallExpression */) { var callee = node.expression; - if (callee.kind === 177 /* PropertyAccessExpression */) { + if (callee.kind === 178 /* PropertyAccessExpression */) { return callee.expression; } - else if (callee.kind === 178 /* ElementAccessExpression */) { + else if (callee.kind === 179 /* ElementAccessExpression */) { return callee.expression; } } @@ -35690,53 +38775,56 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 181 /* TaggedTemplateExpression */) { + if (node.kind === 182 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 145 /* Decorator */) { + else if (node.kind === 146 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. return undefined; } + else if (ts.isJsxOpeningLikeElement(node)) { + args = node.attributes.properties.length > 0 ? [node.attributes] : emptyArray; + } else { args = node.arguments || emptyArray; } return args; } /** - * Returns the effective argument count for a node that works like a function invocation. - * If 'node' is a Decorator, the number of arguments is derived from the decoration - * target and the signature: - * If 'node.target' is a class declaration or class expression, the effective argument - * count is 1. - * If 'node.target' is a parameter declaration, the effective argument count is 3. - * If 'node.target' is a property declaration, the effective argument count is 2. - * If 'node.target' is a method or accessor declaration, the effective argument count - * is 3, although it can be 2 if the signature only accepts two arguments, allowing - * us to match a property decorator. - * Otherwise, the argument count is the length of the 'args' array. - */ + * Returns the effective argument count for a node that works like a function invocation. + * If 'node' is a Decorator, the number of arguments is derived from the decoration + * target and the signature: + * If 'node.target' is a class declaration or class expression, the effective argument + * count is 1. + * If 'node.target' is a parameter declaration, the effective argument count is 3. + * If 'node.target' is a property declaration, the effective argument count is 2. + * If 'node.target' is a method or accessor declaration, the effective argument count + * is 3, although it can be 2 if the signature only accepts two arguments, allowing + * us to match a property decorator. + * Otherwise, the argument count is the length of the 'args' array. + */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If we are emitting decorators for ES3, we will only pass two arguments. @@ -35746,7 +38834,7 @@ var ts; // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 144 /* Parameter */: + case 145 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -35757,38 +38845,38 @@ var ts; } } /** - * Returns the effective type of the first argument to a decorator. - * If 'node' is a class declaration or class expression, the effective argument type - * is the type of the static side of the class. - * If 'node' is a parameter declaration, the effective argument type is either the type - * of the static or instance side of the class for the parameter's parent method, - * depending on whether the method is declared static. - * For a constructor, the type is always the type of the static side of the class. - * If 'node' is a property, method, or accessor declaration, the effective argument - * type is the type of the static or instance side of the parent class for class - * element, depending on whether the element is declared static. - */ + * Returns the effective type of the first argument to a decorator. + * If 'node' is a class declaration or class expression, the effective argument type + * is the type of the static side of the class. + * If 'node' is a parameter declaration, the effective argument type is either the type + * of the static or instance side of the class for the parameter's parent method, + * depending on whether the method is declared static. + * For a constructor, the type is always the type of the static side of the class. + * If 'node' is a property, method, or accessor declaration, the effective argument + * type is the type of the static or instance side of the parent class for class + * element, depending on whether the element is declared static. + */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -35799,37 +38887,39 @@ var ts; return unknownType; } /** - * Returns the effective type for the second argument to a decorator. - * If 'node' is a parameter, its effective argument type is one of the following: - * If 'node.parent' is a constructor, the effective argument type is 'any', as we - * will emit `undefined`. - * If 'node.parent' is a member with an identifier, numeric, or string literal name, - * the effective argument type will be a string literal type for the member name. - * If 'node.parent' is a computed property name, the effective argument type will - * either be a symbol type or the string type. - * If 'node' is a member with an identifier, numeric, or string literal name, the - * effective argument type will be a string literal type for the member name. - * If 'node' is a computed property name, the effective argument type will either - * be a symbol type or the string type. - * A class decorator does not have a second argument type. - */ + * Returns the effective type for the second argument to a decorator. + * If 'node' is a parameter, its effective argument type is one of the following: + * If 'node.parent' is a constructor, the effective argument type is 'any', as we + * will emit `undefined`. + * If 'node.parent' is a member with an identifier, numeric, or string literal name, + * the effective argument type will be a string literal type for the member name. + * If 'node.parent' is a computed property name, the effective argument type will + * either be a symbol type or the string type. + * If 'node' is a member with an identifier, numeric, or string literal name, the + * effective argument type will be a string literal type for the member name. + * If 'node' is a computed property name, the effective argument type will either + * be a symbol type or the string type. + * A class decorator does not have a second argument type. + */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { node = node.parent; - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } + // For a non-constructor parameter decorator, the `propertyKey` will be either + // a string or a symbol, based on the name of the parameter's containing method. } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will @@ -35840,7 +38930,7 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getLiteralTypeForText(32 /* StringLiteral */, element.name.text); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512 /* ESSymbol */)) { return nameType; @@ -35857,30 +38947,30 @@ var ts; return unknownType; } /** - * Returns the effective argument type for the third argument to a decorator. - * If 'node' is a parameter, the effective argument type is the number type. - * If 'node' is a method or accessor, the effective argument type is a - * `TypedPropertyDescriptor` instantiated with the type of the member. - * Class and property decorators do not have a third effective argument. - */ + * Returns the effective argument type for the third argument to a decorator. + * If 'node' is a parameter, the effective argument type is the number type. + * If 'node' is a method or accessor, the effective argument type is a + * `TypedPropertyDescriptor` instantiated with the type of the member. + * Class and property decorators do not have a third effective argument. + */ function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 228 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 144 /* Parameter */) { + if (node.kind === 145 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 147 /* PropertyDeclaration */) { + if (node.kind === 148 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 149 /* MethodDeclaration */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 150 /* MethodDeclaration */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -35890,8 +38980,8 @@ var ts; return unknownType; } /** - * Returns the effective argument type for the provided argument to a decorator. - */ + * Returns the effective argument type for the provided argument to a decorator. + */ function getEffectiveDecoratorArgumentType(node, argIndex) { if (argIndex === 0) { return getEffectiveDecoratorFirstArgumentType(node.parent); @@ -35906,16 +38996,16 @@ var ts; return unknownType; } /** - * Gets the effective argument type for an argument in a call expression. - */ + * Gets the effective argument type for an argument in a call expression. + */ function getEffectiveArgumentType(node, argIndex) { // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -35923,25 +39013,25 @@ var ts; return undefined; } /** - * Gets the effective argument expression for an argument in a call expression. - */ + * Gets the effective argument expression for an argument in a call expression. + */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 145 /* Decorator */ || - (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */)) { + if (node.kind === 146 /* Decorator */ || + (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; } /** - * Gets the error node to use when reporting errors for an effective argument. - */ + * Gets the error node to use when reporting errors for an effective argument. + */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 145 /* Decorator */) { + if (node.kind === 146 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 182 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -35950,16 +39040,31 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 181 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 145 /* Decorator */; + var isTaggedTemplate = node.kind === 182 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 146 /* Decorator */; + var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var typeArguments; - if (!isTaggedTemplate && !isDecorator) { + if (!isTaggedTemplate && !isDecorator && !isJsxOpeningOrSelfClosingElement) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. if (node.expression.kind !== 96 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } + if (signatures.length === 1) { + var declaration = signatures[0].declaration; + if (declaration && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration)) { + if (containsArgumentsReference(declaration)) { + var signatureWithRest = cloneSignature(signatures[0]); + var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args"); + syntheticArgsSymbol.type = anyArrayType; + syntheticArgsSymbol.isRestParameter = true; + signatureWithRest.parameters = ts.concatenate(signatureWithRest.parameters, [syntheticArgsSymbol]); + signatureWithRest.hasRestParameter = true; + signatures = [signatureWithRest]; + } + } + } var candidates = candidatesOutArray || []; // reorderCandidates fills up the candidates array directly reorderCandidates(signatures, candidates); @@ -36022,7 +39127,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 180 /* CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -36051,6 +39156,10 @@ var ts; // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. if (candidateForArgumentError) { + if (isJsxOpeningOrSelfClosingElement) { + // We do not report any error here because any error will be handled in "resolveCustomJsxElementAttributesType". + return candidateForArgumentError; + } // excludeArgument is undefined, in this case also equivalent to [undefined, undefined, ...] // The importance of excludeArgument is to prevent us from typing function expression parameters // in arguments too early. If possible, we'd like to only type them once we know the correct @@ -36072,7 +39181,7 @@ var ts; if (headMessage) { diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); } - reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + reportNoCommonSupertypeError(inferenceCandidates, node.tagName || node.expression || node.tag, diagnosticChainHead); } } else { @@ -36113,20 +39222,20 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false) + ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false, /*useAnyForNoInferences*/ ts.isInJavaScriptFile(node)) : undefined; while (true) { candidate = originalCandidate; if (candidate.typeParameters) { var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = ts.map(typeArguments, getTypeFromTypeNode); + typeArgumentTypes = fillMissingTypeArguments(ts.map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, getMinTypeArgumentCount(candidate.typeParameters)); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); - typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; + typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; } if (!typeArgumentsAreValid) { break; @@ -36136,7 +39245,7 @@ var ts; if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; } - var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; + var index = excludeArgument ? ts.indexOf(excludeArgument, /*value*/ true) : -1; if (index < 0) { return candidate; } @@ -36175,7 +39284,7 @@ var ts; // with the type arguments specified in the extends clause. var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); if (baseTypeNode) { - var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments); + var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode); return resolveCall(node, baseConstructors, candidatesOutArray); } } @@ -36329,12 +39438,13 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; if (modifiers & 16 /* Protected */ && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } if (modifiers & 8 /* Private */) { @@ -36366,26 +39476,26 @@ var ts; return resolveCall(node, callSignatures, candidatesOutArray); } /** - * Gets the localized diagnostic head message to use for errors when resolving a decorator as a call expression. - */ + * Gets the localized diagnostic head message to use for errors when resolving a decorator as a call expression. + */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 144 /* Parameter */: + case 145 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } /** - * Resolves a decorator as if it were a call expression. - */ + * Resolves a decorator as if it were a call expression. + */ function resolveDecorator(node, candidatesOutArray) { var funcType = checkExpression(node.expression); var apparentType = getApparentType(funcType); @@ -36407,21 +39517,73 @@ var ts; } return resolveCall(node, callSignatures, candidatesOutArray, headMessage); } + /** + * This function is similar to getResolvedSignature but is exclusively for trying to resolve JSX stateless-function component. + * The main reason we have to use this function instead of getResolvedSignature because, the caller of this function will already check the type of openingLikeElement's tagName + * and pass the type as elementType. The elementType can not be a union (as such case should be handled by the caller of this function) + * Note: at this point, we are still not sure whether the opening-like element is a stateless function component or not. + * @param openingLikeElement an opening-like JSX element to try to resolve as JSX stateless function + * @param elementType an element type of the opneing-like element by checking opening-like element's tagname. + * @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service; + * the function will fill it up with appropriate candidate signatures + */ + function getResolvedJsxStatelessFunctionSignature(openingLikeElement, elementType, candidatesOutArray) { + ts.Debug.assert(!(elementType.flags & 65536 /* Union */)); + var callSignature = resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray); + return callSignature; + } + /** + * Try treating a given opening-like element as stateless function component and resolve a tagName to a function signature. + * @param openingLikeElement an JSX opening-like element we want to try resolve its stateless function if possible + * @param elementType a type of the opening-like JSX element, a result of resolving tagName in opening-like element. + * @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service; + * the function will fill it up with appropriate candidate signatures + * @return a resolved signature if we can find function matching function signature through resolve call or a first signature in the list of functions. + * otherwise return undefined if tag-name of the opening-like element doesn't have call signatures + */ + function resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray) { + // If this function is called from language service, elementType can be a union type. This is not possible if the function is called from compiler (see: resolveCustomJsxElementAttributesType) + if (elementType.flags & 65536 /* Union */) { + var types = elementType.types; + var result = void 0; + for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { + var type = types_18[_i]; + result = result || resolveStatelessJsxOpeningLikeElement(openingLikeElement, type, candidatesOutArray); + } + return result; + } + var callSignatures = elementType && getSignaturesOfType(elementType, 0 /* Call */); + if (callSignatures && callSignatures.length > 0) { + var callSignature = void 0; + callSignature = resolveCall(openingLikeElement, callSignatures, candidatesOutArray); + return callSignature; + } + return undefined; + } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 179 /* CallExpression */: + case 180 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 145 /* Decorator */: + case 146 /* Decorator */: return resolveDecorator(node, candidatesOutArray); + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + // This code-path is called by language service + return resolveStatelessJsxOpeningLikeElement(node, checkExpression(node.tagName), candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); } - // candidatesOutArray is passed by signature help in the language service, and collectCandidates - // must fill it up with the appropriate candidate signatures + /** + * Resolve a signature of a given call-like expression. + * @param node a call-like expression to try resolve a signature for + * @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service; + * the function will fill it up with appropriate candidate signatures + * @return a signature of the call-like expression or undefined if one can't be found + */ function getResolvedSignature(node, candidatesOutArray) { var links = getNodeLinks(node); // If getResolvedSignature has already been called, we will have cached the resolvedSignature. @@ -36464,12 +39626,12 @@ var ts; if (node.expression.kind === 96 /* SuperKeyword */) { return voidType; } - if (node.kind === 180 /* NewExpression */) { + if (node.kind === 181 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 150 /* Constructor */ && - declaration.kind !== 154 /* ConstructSignature */ && - declaration.kind !== 159 /* ConstructorType */ && + declaration.kind !== 151 /* Constructor */ && + declaration.kind !== 155 /* ConstructSignature */ && + declaration.kind !== 160 /* ConstructorType */ && !ts.isJSDocConstructSignature(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any, unless // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations @@ -36479,10 +39641,13 @@ var ts; var funcSymbol = node.expression.kind === 70 /* Identifier */ ? getResolvedSymbol(node.expression) : checkExpression(node.expression).symbol; - if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) { + if (funcSymbol && ts.isDeclarationOfFunctionOrClassExpression(funcSymbol)) { + funcSymbol = getSymbolOfNode(funcSymbol.valueDeclaration.initializer); + } + if (funcSymbol && funcSymbol.members && funcSymbol.flags & 16 /* Function */) { return getInferredClassType(funcSymbol); } - else if (compilerOptions.noImplicitAny) { + else if (noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; @@ -36509,9 +39674,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 225 /* FunctionDeclaration */ + ? 227 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 223 /* VariableDeclaration */ + ? 225 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -36538,6 +39703,22 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 151 /* Constructor */) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -36553,13 +39734,16 @@ var ts; pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } - function assignContextualParameterTypes(signature, context, mapper) { + function getTypeOfFirstParameterOfSignature(signature) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + } + function assignContextualParameterTypes(signature, context, mapper, checkMode) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); - if (isInferentialContext(mapper)) { + if (checkMode === 2 /* Inferential */) { for (var i = 0; i < len; i++) { var declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -36567,23 +39751,23 @@ var ts; var parameter = signature.thisParameter; if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { if (!parameter) { - signature.thisParameter = createTransientSymbol(context.thisParameter, undefined); + signature.thisParameter = createSymbolWithType(context.thisParameter, /*type*/ undefined); } - assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper); + assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper, checkMode); } } for (var i = 0; i < len; i++) { var parameter = signature.parameters[i]; if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeAtPosition(context, i); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); if (!parameter.valueDeclaration.type) { var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper, checkMode); } } } @@ -36602,19 +39786,19 @@ var ts; } } } - function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper, checkMode) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); // if inference didn't come up with anything but {}, fall back to the binding pattern if present. if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 172 /* ObjectBindingPattern */ || - parameter.valueDeclaration.name.kind === 173 /* ArrayBindingPattern */)) { + (parameter.valueDeclaration.name.kind === 173 /* ObjectBindingPattern */ || + parameter.valueDeclaration.name.kind === 174 /* ArrayBindingPattern */)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); } - else if (isInferentialContext(mapper)) { + else if (checkMode === 2 /* Inferential */) { // Even if the parameter already has a type, it might be because it was given a type while // processing the function as an argument to a prior signature during overload resolution. // If this was the case, it may have caused some type parameters to be fixed. So here, @@ -36644,7 +39828,7 @@ var ts; // T in the second overload so that we do not infer Base as a candidate for T // (inferring Base would make type argument inference inconsistent between the two // overloads). - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -36656,10 +39840,10 @@ var ts; } function createPromiseType(promisedType) { // creates a `Promise` type where `T` is the promisedType argument - var globalPromiseType = getGlobalPromiseType(); + var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type - promisedType = getAwaitedType(promisedType); + promisedType = getAwaitedType(promisedType) || emptyObjectType; return createTypeReference(globalPromiseType, [promisedType]); } return emptyObjectType; @@ -36670,53 +39854,63 @@ var ts; error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } + else if (!getGlobalPromiseConstructorSymbol(/*reportErrors*/ true)) { + error(func, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } return promiseType; } - function getReturnTypeFromBody(func, contextualMapper) { + function getReturnTypeFromBody(func, checkMode) { var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); if (!func.body) { return unknownType; } - var isAsync = ts.isAsyncFunctionLike(func); + var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 204 /* Block */) { - type = checkExpressionCached(func.body, contextualMapper); - if (isAsync) { + if (func.body.kind !== 206 /* Block */) { + type = checkExpressionCached(func.body, checkMode); + if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body should be unwrapped to its awaited type, which we will wrap in // the native Promise type later in this function. - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + type = checkAwaitedType(type, /*errorNode*/ func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } } else { var types = void 0; - var funcIsGenerator = !!func.asteriskToken; - if (funcIsGenerator) { - types = checkAndAggregateYieldOperandTypes(func, contextualMapper); - if (types.length === 0) { - var iterableIteratorAny = createIterableIteratorType(anyType); - if (compilerOptions.noImplicitAny) { + if (functionFlags & 1 /* Generator */) { + types = ts.concatenate(checkAndAggregateYieldOperandTypes(func, checkMode), checkAndAggregateReturnExpressionTypes(func, checkMode)); + if (!types || types.length === 0) { + var iterableIteratorAny = functionFlags & 2 /* Async */ + ? createAsyncIterableIteratorType(anyType) // AsyncGenerator function + : createIterableIteratorType(anyType); // Generator function + if (noImplicitAny) { error(func.asteriskToken, ts.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)); } return iterableIteratorAny; } } else { - types = checkAndAggregateReturnExpressionTypes(func, contextualMapper); + types = checkAndAggregateReturnExpressionTypes(func, checkMode); if (!types) { // For an async function, the return type will not be never, but rather a Promise for never. - return isAsync ? createPromiseReturnType(func, neverType) : neverType; + return functionFlags & 2 /* Async */ + ? createPromiseReturnType(func, neverType) // Async function + : neverType; // Normal function } if (types.length === 0) { // For an async function, the return type will not be void, but rather a Promise for void. - return isAsync ? createPromiseReturnType(func, voidType) : voidType; + return functionFlags & 2 /* Async */ + ? createPromiseReturnType(func, voidType) // Async function + : voidType; // Normal function } } // Return a union of the return expression types. type = getUnionType(types, /*subtypeReduction*/ true); - if (funcIsGenerator) { - type = createIterableIteratorType(type); + if (functionFlags & 1 /* Generator */) { + type = functionFlags & 2 /* Async */ + ? createAsyncIterableIteratorType(type) // AsyncGenerator function + : createIterableIteratorType(type); // Generator function } } if (!contextualSignature) { @@ -36731,17 +39925,25 @@ var ts; // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body is awaited type of the body, wrapped in a native Promise type. - return isAsync ? createPromiseReturnType(func, widenedType) : widenedType; + return (functionFlags & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */ + ? createPromiseReturnType(func, widenedType) // Async function + : widenedType; // Generator function, AsyncGenerator function, or normal function } - function checkAndAggregateYieldOperandTypes(func, contextualMapper) { + function checkAndAggregateYieldOperandTypes(func, checkMode) { var aggregatedTypes = []; + var functionFlags = ts.getFunctionFlags(func); ts.forEachYieldExpression(func.body, function (yieldExpression) { var expr = yieldExpression.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); + var type = checkExpressionCached(expr, checkMode); if (yieldExpression.asteriskToken) { // A yield* expression effectively yields everything that its operand yields - type = checkElementTypeOfIterable(type, yieldExpression.expression); + type = checkIteratedTypeOrElementType(type, yieldExpression.expression, /*allowStringInput*/ false, (functionFlags & 2 /* Async */) !== 0); + } + if (functionFlags & 2 /* Async */) { + type = checkAwaitedType(type, expr, yieldExpression.asteriskToken + ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member + : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (!ts.contains(aggregatedTypes, type)) { aggregatedTypes.push(type); @@ -36762,33 +39964,33 @@ var ts; if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { if (!(func.flags & 128 /* HasImplicitReturn */)) { return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 220 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; } - function checkAndAggregateReturnExpressionTypes(func, contextualMapper) { - var isAsync = ts.isAsyncFunctionLike(func); + function checkAndAggregateReturnExpressionTypes(func, checkMode) { + var functionFlags = ts.getFunctionFlags(func); var aggregatedTypes = []; var hasReturnWithNoExpression = functionHasImplicitReturn(func); var hasReturnOfTypeNever = false; ts.forEachReturnStatement(func.body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); - if (isAsync) { + var type = checkExpressionCached(expr, checkMode); + if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body should be unwrapped to its awaited type, which should be wrapped in // the native Promise type by the caller. - type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } if (type.flags & 8192 /* Never */) { hasReturnOfTypeNever = true; @@ -36802,7 +40004,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */)) { + func.kind === 185 /* FunctionExpression */ || func.kind === 186 /* ArrowFunction */)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -36831,7 +40033,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 /* Block */ || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 206 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -36863,22 +40065,22 @@ var ts; error(func.type || func, ts.Diagnostics.Not_all_code_paths_return_a_value); } } - function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 184 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 185 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards - if (contextualMapper === identityMapper && isContextSensitive(node)) { + if (checkMode === 1 /* SkipContextSensitive */ && isContextSensitive(node)) { checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); var contextSensitive = isContextSensitive(node); - var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + var mightFixTypeParameters = contextSensitive && checkMode === 2 /* Inferential */; // Check if function expression is contextually typed and assign parameter types if so. // See the comment in assignTypeToParameterAndFixTypeParameters to understand why we need to // check mightFixTypeParameters. @@ -36893,10 +40095,10 @@ var ts; if (contextualSignature) { var signature = getSignaturesOfType(type, 0 /* Call */)[0]; if (contextSensitive) { - assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + assignContextualParameterTypes(signature, contextualSignature, getContextualMapper(node), checkMode); } if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { - var returnType = getReturnTypeFromBody(node, contextualMapper); + var returnType = getReturnTypeFromBody(node, checkMode); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } @@ -36908,17 +40110,21 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) { + if (produceDiagnostics && node.kind !== 150 /* MethodDeclaration */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); - var isAsync = ts.isAsyncFunctionLike(node); - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); - if (!node.asteriskToken) { + ts.Debug.assert(node.kind !== 150 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + var functionFlags = ts.getFunctionFlags(node); + var returnOrPromisedType = node.type && + ((functionFlags & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */ ? + checkAsyncFunctionReturnType(node) : + getTypeFromTypeNode(node.type)); // AsyncGenerator function, Generator function, or normal function + if ((functionFlags & 1 /* Generator */) === 0) { // return is not necessary in the body of generators checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } @@ -36931,7 +40137,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204 /* Block */) { + if (node.body.kind === 206 /* Block */) { checkSourceElement(node.body); } else { @@ -36942,8 +40148,8 @@ var ts; // its return type annotation. var exprType = checkExpression(node.body); if (returnOrPromisedType) { - if (isAsync) { - var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); + if ((functionFlags & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */) { + var awaitedType = checkAwaitedType(exprType, node.body, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } else { @@ -36968,21 +40174,21 @@ var ts; // Get accessors without matching set accessors // Enum members // Unions and intersections of the above (unions and intersections eagerly set isReadonly on creation) - return symbol.isReadonly || - symbol.flags & 4 /* Property */ && (getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */) !== 0 || - symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 || + return !!(getCheckFlags(symbol) & 8 /* Readonly */ || + symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */ || + symbol.flags & 3 /* Variable */ && getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */ || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || - (symbol.flags & 8 /* EnumMember */) !== 0; + symbol.flags & 8 /* EnumMember */); } function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) && + (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) && expr.expression.kind === 98 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 150 /* Constructor */)) + if (!(func && func.kind === 151 /* Constructor */)) return true; // If func.parent is a class and symbol is a (readonly) property of that class, or // if func is a constructor and symbol is a (readonly) parameter property declared in it, @@ -36994,13 +40200,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */ || expr.kind === 179 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); if (node.kind === 70 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237 /* NamespaceImport */; + return declaration && declaration.kind === 239 /* NamespaceImport */; } } } @@ -37009,7 +40215,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipParentheses(expr); - if (node.kind !== 70 /* Identifier */ && node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + if (node.kind !== 70 /* Identifier */ && node.kind !== 178 /* PropertyAccessExpression */ && node.kind !== 179 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -37017,11 +40223,21 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 178 /* PropertyAccessExpression */ && expr.kind !== 179 /* ElementAccessExpression */) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { checkExpression(node.expression); - return stringType; + return typeofType; } function checkVoidExpression(node) { checkExpression(node.expression); @@ -37030,7 +40246,7 @@ var ts; function checkAwaitExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 524288 /* AwaitContext */)) { + if (!(node.flags & 16384 /* AwaitContext */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -37038,7 +40254,7 @@ var ts; } } var operandType = checkExpression(node.expression); - return checkAwaitedType(operandType, node); + return checkAwaitedType(operandType, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); @@ -37052,6 +40268,7 @@ var ts; case 36 /* PlusToken */: case 37 /* MinusToken */: case 51 /* TildeToken */: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, 512 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } @@ -37063,7 +40280,7 @@ var ts; booleanType; case 42 /* PlusPlusToken */: case 43 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37077,7 +40294,7 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); @@ -37092,8 +40309,8 @@ var ts; } if (type.flags & 196608 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_19 = types; _i < types_19.length; _i++) { + var t = types_19[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -37110,8 +40327,8 @@ var ts; } if (type.flags & 65536 /* Union */) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_20 = types; _i < types_20.length; _i++) { + var t = types_20[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -37120,8 +40337,8 @@ var ts; } if (type.flags & 131072 /* Intersection */) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_21 = types; _a < types_21.length; _a++) { + var t = types_21[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -37141,14 +40358,17 @@ var ts; } // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, - // and the right operand to be of type Any or a subtype of the 'Function' interface type. + // and the right operand to be of type Any, a subtype of the 'Function' interface type, or have a call or construct signature. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported if (isTypeOfKind(leftType, 8190 /* Primitive */)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + getSignaturesOfType(rightType, 0 /* Call */).length || + getSignaturesOfType(rightType, 1 /* Construct */).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; @@ -37157,6 +40377,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); // TypeScript 1.0 spec (April 2014): 4.15.5 // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. @@ -37164,37 +40386,37 @@ var ts; if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 340 /* NumberLike */ | 512 /* ESSymbol */))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */ | 16777216 /* NonPrimitive */)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var p = properties_5[_i]; + for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { + var p = properties_7[_i]; checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) { - var name_20 = property.name; - if (name_20.kind === 142 /* ComputedPropertyName */) { - checkComputedPropertyName(name_20); + if (property.kind === 260 /* PropertyAssignment */ || property.kind === 261 /* ShorthandPropertyAssignment */) { + var name = property.name; + if (name.kind === 143 /* ComputedPropertyName */) { + checkComputedPropertyName(name); } - if (isComputedNonLiteralName(name_20)) { + if (isComputedNonLiteralName(name)) { return undefined; } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 258 /* ShorthandPropertyAssignment */) { + if (property.kind === 261 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -37203,10 +40425,13 @@ var ts; } } else { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name)); } } - else if (property.kind === 259 /* SpreadAssignment */) { + else if (property.kind === 262 /* SpreadAssignment */) { + if (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(property, 4 /* Rest */); + } var nonRestNames = []; if (allProperties) { for (var i = 0; i < allProperties.length - 1; i++) { @@ -37220,22 +40445,25 @@ var ts; error(property, ts.Diagnostics.Property_assignment_expected); } } - function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { + function checkArrayLiteralAssignment(node, sourceType, checkMode) { + if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512 /* Read */); + } // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; + var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { - checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, checkMode); } return sourceType; } - function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { + function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 198 /* OmittedExpression */) { - if (element.kind !== 196 /* SpreadElement */) { + if (element.kind !== 199 /* OmittedExpression */) { + if (element.kind !== 197 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -37243,7 +40471,7 @@ var ts; ? getTypeOfPropertyOfType(sourceType, propName) : elementType; if (type) { - return checkDestructuringAssignment(element, type, contextualMapper); + return checkDestructuringAssignment(element, type, checkMode); } else { // We still need to check element expression here because we may need to set appropriate flag on the expression @@ -37263,20 +40491,20 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 192 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { + if (restExpression.kind === 193 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { - return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); + return checkDestructuringAssignment(restExpression, createArrayType(elementType), checkMode); } } } } return undefined; } - function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode) { var target; - if (exprOrAssignment.kind === 258 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 261 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -37285,28 +40513,28 @@ var ts; !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 2048 /* Undefined */)) { sourceType = getTypeWithFacts(sourceType, 131072 /* NEUndefined */); } - checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode); } target = exprOrAssignment.name; } else { target = exprOrAssignment; } - if (target.kind === 192 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { - checkBinaryExpression(target, contextualMapper); + if (target.kind === 193 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { + checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 176 /* ObjectLiteralExpression */) { + if (target.kind === 177 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 175 /* ArrayLiteralExpression */) { - return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + if (target.kind === 176 /* ArrayLiteralExpression */) { + return checkArrayLiteralAssignment(target, sourceType, checkMode); } - return checkReferenceAssignment(target, sourceType, contextualMapper); + return checkReferenceAssignment(target, sourceType, checkMode); } - function checkReferenceAssignment(target, sourceType, contextualMapper) { - var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 /* SpreadAssignment */ ? + function checkReferenceAssignment(target, sourceType, checkMode) { + var targetType = checkExpression(target, checkMode); + var error = target.parent.kind === 262 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -37328,35 +40556,35 @@ var ts; case 70 /* Identifier */: case 9 /* StringLiteral */: case 11 /* RegularExpressionLiteral */: - case 181 /* TaggedTemplateExpression */: - case 194 /* TemplateExpression */: + case 182 /* TaggedTemplateExpression */: + case 195 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: case 94 /* NullKeyword */: - case 137 /* UndefinedKeyword */: - case 184 /* FunctionExpression */: - case 197 /* ClassExpression */: - case 185 /* ArrowFunction */: - case 175 /* ArrayLiteralExpression */: - case 176 /* ObjectLiteralExpression */: - case 187 /* TypeOfExpression */: - case 201 /* NonNullExpression */: - case 247 /* JsxSelfClosingElement */: - case 246 /* JsxElement */: + case 138 /* UndefinedKeyword */: + case 185 /* FunctionExpression */: + case 198 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 176 /* ArrayLiteralExpression */: + case 177 /* ObjectLiteralExpression */: + case 188 /* TypeOfExpression */: + case 202 /* NonNullExpression */: + case 249 /* JsxSelfClosingElement */: + case 248 /* JsxElement */: return true; - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -37368,9 +40596,9 @@ var ts; } return false; // Some forms listed here for clarity - case 188 /* VoidExpression */: // Explicit opt-out - case 182 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 200 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 189 /* VoidExpression */: // Explicit opt-out + case 183 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 201 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -37385,16 +40613,16 @@ var ts; firstAssignableToSecond && !secondAssignableToFirst ? type2 : getUnionType([type1, type2], /*subtypeReduction*/ true); } - function checkBinaryExpression(node, contextualMapper) { - return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + function checkBinaryExpression(node, checkMode) { + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, checkMode, node); } - function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 57 /* EqualsToken */ && (left.kind === 176 /* ObjectLiteralExpression */ || left.kind === 175 /* ArrayLiteralExpression */)) { - return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); + if (operator === 57 /* EqualsToken */ && (left.kind === 177 /* ObjectLiteralExpression */ || left.kind === 176 /* ArrayLiteralExpression */)) { + return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode); } - var leftType = checkExpression(left, contextualMapper); - var rightType = checkExpression(right, contextualMapper); + var leftType = checkExpression(left, checkMode); + var rightType = checkExpression(right, checkMode); switch (operator) { case 38 /* AsteriskToken */: case 39 /* AsteriskAsteriskToken */: @@ -37421,18 +40649,8 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.1 - // These operators require their operands to be of type Any, the Number primitive type, - // or an enum type. Operands of an enum type are treated - // as having the primitive type Number. If one operand is the null or undefined value, - // it is treated as having the type of the other operand. - // The result is always of the Number primitive type. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion @@ -37455,16 +40673,10 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.2 - // The binary + operator requires both operands to be of the Number primitive type or an enum type, - // or at least one of the operands to be of type Any or the String primitive type. - // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & 6144 /* Nullable */) - leftType = rightType; - if (rightType.flags & 6144 /* Nullable */) - rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, 1 /* Any */ | 262178 /* StringLike */) && !isTypeOfKind(rightType, 1 /* Any */ | 262178 /* StringLike */)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } var resultType = void 0; if (isTypeOfKind(leftType, 340 /* NumberLike */) && isTypeOfKind(rightType, 340 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. @@ -37499,8 +40711,8 @@ var ts; case 29 /* LessThanEqualsToken */: case 30 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } @@ -37536,11 +40748,14 @@ var ts; checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 25 /* CommaToken */: - if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) { error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType; } + function isEvalNode(node) { + return node.kind === 70 /* Identifier */ && node.text === "eval"; + } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { var offendingSymbolOperand = maybeTypeOfKind(leftType, 512 /* ESSymbol */) ? left : @@ -37603,7 +40818,7 @@ var ts; function checkYieldExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 131072 /* YieldContext */) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096 /* YieldContext */) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -37614,23 +40829,40 @@ var ts; var func = ts.getContainingFunction(node); // If the user's code is syntactically correct, the func should always have a star. After all, // we are in a yield context. - if (func && func.asteriskToken) { + var functionFlags = func && ts.getFunctionFlags(func); + if (node.asteriskToken) { + if (functionFlags & 2 /* Async */) { + if (languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 4096 /* AsyncDelegator */); + } + } + else if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256 /* Values */); + } + } + if (functionFlags & 1 /* Generator */) { var expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined); var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { - expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); + expressionElementType = checkIteratedTypeOrElementType(expressionType, node.expression, /*allowStringInput*/ false, (functionFlags & 2 /* Async */) !== 0); } // There is no point in doing an assignability check if the function // has no explicit return type because the return type is directly computed // from the yield expressions. if (func.type) { - var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; + var signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(func.type), (functionFlags & 2 /* Async */) !== 0) || anyType; if (nodeIsYieldStar) { - checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, /*headMessage*/ undefined); + checkTypeAssignableTo(functionFlags & 2 /* Async */ + ? getAwaitedType(expressionElementType, node.expression, ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionElementType, signatureElementType, node.expression, + /*headMessage*/ undefined); } else { - checkTypeAssignableTo(expressionType, signatureElementType, node.expression, /*headMessage*/ undefined); + checkTypeAssignableTo(functionFlags & 2 /* Async */ + ? getAwaitedType(expressionType, node.expression, ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) + : expressionType, signatureElementType, node.expression, + /*headMessage*/ undefined); } } } @@ -37638,10 +40870,10 @@ var ts; // Both yield and yield* expressions have type 'any' return anyType; } - function checkConditionalExpression(node, contextualMapper) { + function checkConditionalExpression(node, checkMode) { checkExpression(node.condition); - var type1 = checkExpression(node.whenTrue, contextualMapper); - var type2 = checkExpression(node.whenFalse, contextualMapper); + var type1 = checkExpression(node.whenTrue, checkMode); + var type2 = checkExpression(node.whenFalse, checkMode); return getBestChoiceType(type1, type2); } function checkLiteralExpression(node) { @@ -37672,12 +40904,17 @@ var ts; } function checkExpressionWithContextualType(node, contextualType, contextualMapper) { var saveContextualType = node.contextualType; + var saveContextualMapper = node.contextualMapper; node.contextualType = contextualType; - var result = checkExpression(node, contextualMapper); + node.contextualMapper = contextualMapper; + var checkMode = contextualMapper === identityMapper ? 1 /* SkipContextSensitive */ : + contextualMapper ? 2 /* Inferential */ : 0 /* Normal */; + var result = checkExpression(node, checkMode); node.contextualType = saveContextualType; + node.contextualMapper = saveContextualMapper; return result; } - function checkExpressionCached(node, contextualMapper) { + function checkExpressionCached(node, checkMode) { var links = getNodeLinks(node); if (!links.resolvedType) { // When computing a type that we're going to cache, we need to ignore any ongoing control flow @@ -37685,83 +40922,87 @@ var ts; // to the top of the stack ensures all transient types are computed from a known point. var saveFlowLoopStart = flowLoopStart; flowLoopStart = flowLoopCount; - links.resolvedType = checkExpression(node, contextualMapper); + links.resolvedType = checkExpression(node, checkMode); flowLoopStart = saveFlowLoopStart; } return links.resolvedType; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 182 /* TypeAssertionExpression */ || node.kind === 200 /* AsExpression */; + return node.kind === 183 /* TypeAssertionExpression */ || node.kind === 201 /* AsExpression */; } function checkDeclarationInitializer(declaration) { - var type = checkExpressionCached(declaration.initializer); + var type = getTypeOfExpression(declaration.initializer, /*cache*/ true); return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } function isLiteralContextualType(contextualType) { if (contextualType) { - if (contextualType.flags & 16384 /* TypeParameter */) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & 540672 /* TypeVariable */) { + var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. - if (apparentType.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { + if (constraint.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */)); } return false; } - function checkExpressionForMutableLocation(node, contextualMapper) { - var type = checkExpression(node, contextualMapper); + function checkExpressionForMutableLocation(node, checkMode) { + var type = checkExpression(node, checkMode); return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); } - function checkPropertyAssignment(node, contextualMapper) { + function checkPropertyAssignment(node, checkMode) { // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } - return checkExpressionForMutableLocation(node.initializer, contextualMapper); + return checkExpressionForMutableLocation(node.initializer, checkMode); } - function checkObjectLiteralMethod(node, contextualMapper) { + function checkObjectLiteralMethod(node, checkMode) { // Grammar checking checkGrammarMethod(node); // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } - var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } - function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (isInferentialContext(contextualMapper)) { + function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { + if (checkMode === 2 /* Inferential */) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getApparentTypeOfContextualType(node); if (contextualType) { var contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { - return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, getContextualMapper(node))); } } } } return type; } - // Returns the type of an expression. Unlike checkExpression, this function is simply concerned - // with computing the type and may not fully check all contained sub-expressions for errors. - function getTypeOfExpression(node) { + /** + * Returns the type of an expression. Unlike checkExpression, this function is simply concerned + * with computing the type and may not fully check all contained sub-expressions for errors. + * A cache argument of true indicates that if the function performs a full type check, it is ok + * to cache the result. + */ + function getTypeOfExpression(node, cache) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === 179 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */) { + if (node.kind === 180 /* CallExpression */ && node.expression.kind !== 96 /* SuperKeyword */ && !ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { var funcType = checkNonNullExpression(node.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -37771,7 +41012,21 @@ var ts; // Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions // should have a parameter that indicates whether full error checking is required such that // we can perform the optimizations locally. - return checkExpression(node); + return cache ? checkExpressionCached(node) : checkExpression(node); + } + /** + * Returns the type of an expression. Unlike checkExpression, this function is simply concerned + * with computing the type and may not fully check all contained sub-expressions for errors. + * It is intended for uses where you know there is no contextual type, + * and requesting the contextual type might cause a circularity or other bad behaviour. + * It sets the contextual type of the node to any before calling getTypeOfExpression. + */ + function getContextFreeTypeOfExpression(node) { + var saveContextualType = node.contextualType; + node.contextualType = anyType; + var type = getTypeOfExpression(node); + node.contextualType = saveContextualType; + return type; } // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the @@ -37780,30 +41035,30 @@ var ts; // object, it serves as an indicator that all contained function and arrow expressions should be considered to // have the wildcard function type; this form of type check is used during overload resolution to exclude // contextually typed function and arrow expressions in the initial phase. - function checkExpression(node, contextualMapper) { + function checkExpression(node, checkMode) { var type; - if (node.kind === 141 /* QualifiedName */) { + if (node.kind === 142 /* QualifiedName */) { type = checkQualifiedName(node); } else { - var uninstantiatedType = checkExpressionWorker(node, contextualMapper); - type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + var uninstantiatedType = checkExpressionWorker(node, checkMode); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode); } if (isConstEnumObjectType(type)) { // enum object type for const enums are only permitted in: // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } } return type; } - function checkExpressionWorker(node, contextualMapper) { + function checkExpressionWorker(node, checkMode) { switch (node.kind) { case 70 /* Identifier */: return checkIdentifier(node); @@ -37818,66 +41073,70 @@ var ts; case 100 /* TrueKeyword */: case 85 /* FalseKeyword */: return checkLiteralExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return checkTemplateExpression(node); case 12 /* NoSubstitutionTemplateLiteral */: return stringType; case 11 /* RegularExpressionLiteral */: return globalRegExpType; - case 175 /* ArrayLiteralExpression */: - return checkArrayLiteral(node, contextualMapper); - case 176 /* ObjectLiteralExpression */: - return checkObjectLiteral(node, contextualMapper); - case 177 /* PropertyAccessExpression */: + case 176 /* ArrayLiteralExpression */: + return checkArrayLiteral(node, checkMode); + case 177 /* ObjectLiteralExpression */: + return checkObjectLiteral(node, checkMode); + case 178 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: return checkCallExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 183 /* ParenthesizedExpression */: - return checkExpression(node.expression, contextualMapper); - case 197 /* ClassExpression */: + case 184 /* ParenthesizedExpression */: + return checkExpression(node.expression, checkMode); + case 198 /* ClassExpression */: return checkClassExpression(node); - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 187 /* TypeOfExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 188 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: return checkAssertion(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return checkNonNullAssertion(node); - case 186 /* DeleteExpression */: + case 203 /* MetaProperty */: + return checkMetaProperty(node); + case 187 /* DeleteExpression */: return checkDeleteExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return checkVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return checkAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: - return checkBinaryExpression(node, contextualMapper); - case 193 /* ConditionalExpression */: - return checkConditionalExpression(node, contextualMapper); - case 196 /* SpreadElement */: - return checkSpreadExpression(node, contextualMapper); - case 198 /* OmittedExpression */: + case 193 /* BinaryExpression */: + return checkBinaryExpression(node, checkMode); + case 194 /* ConditionalExpression */: + return checkConditionalExpression(node, checkMode); + case 197 /* SpreadElement */: + return checkSpreadExpression(node, checkMode); + case 199 /* OmittedExpression */: return undefinedWideningType; - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return checkYieldExpression(node); - case 252 /* JsxExpression */: - return checkJsxExpression(node); - case 246 /* JsxElement */: + case 255 /* JsxExpression */: + return checkJsxExpression(node, checkMode); + case 248 /* JsxElement */: return checkJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 248 /* JsxOpeningElement */: + case 253 /* JsxAttributes */: + return checkJsxAttributes(node, checkMode); + case 250 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -37889,7 +41148,16 @@ var ts; grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); } checkSourceElement(node.constraint); - getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); + checkSourceElement(node.default); + var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, ts.Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } + var constraintType = getConstraintOfTypeParameter(typeParameter); + var defaultType = getDefaultFromTypeParameter(typeParameter); + if (constraintType && defaultType) { + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); } @@ -37905,7 +41173,7 @@ var ts; var func = ts.getContainingFunction(node); if (ts.getModifierFlags(node) & 92 /* ParameterPropertyModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 150 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 151 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -37916,7 +41184,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 150 /* Constructor */ || func.kind === 154 /* ConstructSignature */ || func.kind === 159 /* ConstructorType */) { + if (func.kind === 151 /* Constructor */ || func.kind === 155 /* ConstructSignature */ || func.kind === 160 /* ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -37926,14 +41194,6 @@ var ts; error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } } - function isSyntacticallyValidGenerator(node) { - if (!node.asteriskToken || !node.body) { - return false; - } - return node.kind === 149 /* MethodDeclaration */ || - node.kind === 225 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */; - } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { @@ -37967,7 +41227,7 @@ var ts; error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); + var leadingError = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, /*headMessage*/ undefined, leadingError); } @@ -37975,9 +41235,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_21 = _a[_i].name; - if (ts.isBindingPattern(name_21) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { + var name = _a[_i].name; + if (ts.isBindingPattern(name) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -37990,16 +41250,16 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 185 /* ArrowFunction */: - case 153 /* CallSignature */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 158 /* FunctionType */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + case 186 /* ArrowFunction */: + case 154 /* CallSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 159 /* FunctionType */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + var parent = node.parent; + if (node === parent.type) { + return parent; } } } @@ -38009,15 +41269,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_22 = element.name; - if (name_22.kind === 70 /* Identifier */ && - name_22.text === predicateVariableName) { + var name = element.name; + if (name.kind === 70 /* Identifier */ && + name.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_22.kind === 173 /* ArrayBindingPattern */ || - name_22.kind === 172 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { + else if (name.kind === 174 /* ArrayBindingPattern */ || + name.kind === 173 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } } @@ -38025,14 +41285,29 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 /* FunctionType */ || node.kind === 225 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || - node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ || - node.kind === 154 /* ConstructSignature */) { + else if (node.kind === 159 /* FunctionType */ || node.kind === 227 /* FunctionDeclaration */ || node.kind === 160 /* ConstructorType */ || + node.kind === 154 /* CallSignature */ || node.kind === 151 /* Constructor */ || + node.kind === 155 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } + var functionFlags = ts.getFunctionFlags(node); + if ((functionFlags & 7 /* InvalidAsyncOrAsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 64 /* Awaiter */); + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(node, 128 /* Generator */); + } + } + if ((functionFlags & 5 /* InvalidGenerator */) === 1 /* Generator */) { + if (functionFlags & 2 /* Async */ && languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 2048 /* AsyncGenerator */); + } + else if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(node, 128 /* Generator */); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -38040,25 +41315,28 @@ var ts; } if (produceDiagnostics) { checkCollisionWithArgumentsInGeneratedCode(node); - if (compilerOptions.noImplicitAny && !node.type) { + if (noImplicitAny && !node.type) { switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } } if (node.type) { - if (languageVersion >= 2 /* ES2015 */ && isSyntacticallyValidGenerator(node)) { + var functionFlags_1 = ts.getFunctionFlags(node); + if ((functionFlags_1 & 5 /* InvalidGenerator */) === 1 /* Generator */) { var returnType = getTypeFromTypeNode(node.type); if (returnType === voidType) { error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); } else { - var generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType; - var iterableIteratorInstantiation = createIterableIteratorType(generatorElementType); + var generatorElementType = getIteratedTypeOfGenerator(returnType, (functionFlags_1 & 2 /* Async */) !== 0) || anyType; + var iterableIteratorInstantiation = functionFlags_1 & 2 /* Async */ + ? createAsyncIterableIteratorType(generatorElementType) // AsyncGenerator function + : createIterableIteratorType(generatorElementType); // Generator function // Naively, one could check that IterableIterator is assignable to the return type annotation. // However, that would not catch the error in the following case. // @@ -38068,7 +41346,7 @@ var ts; checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } - else if (ts.isAsyncFunctionLike(node)) { + else if ((functionFlags_1 & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */) { checkAsyncFunctionReturnType(node); } } @@ -38078,17 +41356,18 @@ var ts; } } function checkClassForDuplicateDeclarations(node) { - var Accessor; - (function (Accessor) { - Accessor[Accessor["Getter"] = 1] = "Getter"; - Accessor[Accessor["Setter"] = 2] = "Setter"; - Accessor[Accessor["Property"] = 3] = "Property"; - })(Accessor || (Accessor = {})); + var Declaration; + (function (Declaration) { + Declaration[Declaration["Getter"] = 1] = "Getter"; + Declaration[Declaration["Setter"] = 2] = "Setter"; + Declaration[Declaration["Method"] = 4] = "Method"; + Declaration[Declaration["Property"] = 3] = "Property"; + })(Declaration || (Declaration = {})); var instanceNames = ts.createMap(); var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -38097,36 +41376,76 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114 /* StaticKeyword */; }); + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: addName(names, member.name, memberName, 1 /* Getter */); break; - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: addName(names, member.name, memberName, 2 /* Setter */); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: addName(names, member.name, memberName, 3 /* Property */); break; + case 150 /* MethodDeclaration */: + addName(names, member.name, memberName, 4 /* Method */); + break; } } } } function addName(names, location, name, meaning) { - var prev = names[name]; + var prev = names.get(name); if (prev) { - if (prev & meaning) { + if (prev & 4 /* Method */) { + if (meaning !== 4 /* Method */) { + error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); + } + } + else if (prev & meaning) { error(location, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); + } + } + } + /** + * Static members being set on a constructor function may conflict with built-in properties + * of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable + * built-in properties. This check issues a transpile error when a class has a static + * member with the same name as a non-writable built-in property. + * + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.3 + * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.5 + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-properties-of-the-function-constructor + * @see http://www.ecma-international.org/ecma-262/6.0/#sec-function-instances + */ + function checkClassForStaticPropertyNameConflicts(node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + var memberNameNode = member.name; + var isStatic = ts.getModifierFlags(member) & 32 /* Static */; + if (isStatic && memberNameNode) { + var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); + switch (memberName) { + case "name": + case "length": + case "caller": + case "arguments": + case "prototype": + var message = ts.Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; + var className = getNameOfSymbol(getSymbolOfNode(node)); + error(memberNameNode, message, memberName, className); + break; + } } } } @@ -38134,7 +41453,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 146 /* PropertySignature */) { + if (member.kind === 147 /* PropertySignature */) { var memberName = void 0; switch (member.name.kind) { case 9 /* StringLiteral */: @@ -38145,18 +41464,18 @@ var ts; default: continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, ts.Diagnostics.Duplicate_identifier_0, memberName); error(member.name, ts.Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227 /* InterfaceDeclaration */) { + if (node.kind === 229 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -38176,7 +41495,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -38252,12 +41571,12 @@ var ts; if (n.kind === 98 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 225 /* FunctionDeclaration */) { + else if (n.kind !== 185 /* FunctionExpression */ && n.kind !== 227 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 147 /* PropertyDeclaration */ && + return n.kind === 148 /* PropertyDeclaration */ && !(ts.getModifierFlags(n) & 32 /* Static */) && !!n.initializer; } @@ -38287,7 +41606,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -38311,7 +41630,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) { if (!(node.flags & 256 /* HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -38321,13 +41640,13 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; + var otherKind = node.kind === 152 /* GetAccessor */ ? 153 /* SetAccessor */ : 152 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if ((ts.getModifierFlags(node) & 28 /* AccessibilityModifier */) !== (ts.getModifierFlags(otherAccessor) & 28 /* AccessibilityModifier */)) { @@ -38343,17 +41662,12 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 151 /* GetAccessor */) { + if (node.kind === 152 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 176 /* ObjectLiteralExpression */) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } - else { - checkNodeDeferred(node); - } + checkSourceElement(node.body); + registerForUnusedIdentifiersCheck(node); } function checkAccessorDeclarationTypesIdentical(first, second, getAnnotatedType, message) { var firstType = getAnnotatedType(first); @@ -38362,14 +41676,11 @@ var ts; error(first, message); } } - function checkAccessorDeferred(node) { - checkSourceElement(node.body); - registerForUnusedIdentifiersCheck(node); - } function checkMissingDeclaration(node) { checkDecorators(node); } function checkTypeArgumentConstraints(typeParameters, typeArgumentNodes) { + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); var typeArguments; var mapper; var result = true; @@ -38377,7 +41688,7 @@ var ts; var constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { if (!typeArguments) { - typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); + typeArguments = fillMissingTypeArguments(ts.map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, minTypeArgumentCount); mapper = createTypeMapper(typeParameters, typeArguments); } var typeArgument = typeArguments[i]; @@ -38430,16 +41741,36 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type, accessNode) { + if (!(type.flags & 524288 /* IndexedAccess */)) { + return type; + } + // Check if the index type is assignable to 'keyof T' for the object type. + var objectType = type.objectType; + var indexType = type.indexType; + if (isTypeAssignableTo(indexType, getIndexType(objectType))) { + return type; + } + // Check if we're indexing with a numeric type and the object type is a generic + // type with a constraint that has a numeric index signature. + if (maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && isTypeOfKind(indexType, 340 /* NumberLike */)) { + var constraint = getBaseConstraintOfType(objectType); + if (constraint && getIndexInfoOfType(constraint, 1 /* Number */)) { + return type; + } + } + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + return type; + } function checkIndexedAccessType(node) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { checkSourceElement(node.typeParameter); checkSourceElement(node.type); var type = getTypeFromMappedTypeNode(node); var constraintType = getConstraintTypeFromMappedType(type); - var keyType = constraintType.flags & 16384 /* TypeParameter */ ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node); @@ -38448,9 +41779,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 227 /* InterfaceDeclaration */ && - n.parent.kind !== 226 /* ClassDeclaration */ && - n.parent.kind !== 197 /* ClassExpression */ && + if (n.parent.kind !== 229 /* InterfaceDeclaration */ && + n.parent.kind !== 228 /* ClassDeclaration */ && + n.parent.kind !== 198 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -38538,7 +41869,7 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */) && + var reportError = (node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */) && (ts.getModifierFlags(node) & 32 /* Static */) !== (ts.getModifierFlags(subsequentNode) & 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members @@ -38573,11 +41904,11 @@ var ts; } var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { - var current = declarations_4[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var current = declarations_5[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 229 /* InterfaceDeclaration */ || node.parent.kind === 162 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -38588,7 +41919,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 225 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { + if (node.kind === 227 /* FunctionDeclaration */ || node.kind === 150 /* MethodDeclaration */ || node.kind === 149 /* MethodSignature */ || node.kind === 151 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -38640,8 +41971,8 @@ var ts; if (bodyDeclaration) { var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); - for (var _a = 0, signatures_3 = signatures; _a < signatures_3.length; _a++) { - var signature = signatures_3[_a]; + for (var _a = 0, signatures_4 = signatures; _a < signatures_4.length; _a++) { + var signature = signatures_4[_a]; if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -38710,16 +42041,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -38729,25 +42060,16 @@ var ts; } } } - function checkNonThenableType(type, location, message) { - type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { - if (location) { - if (!message) { - message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; - } - error(location, message); - } - return unknownType; - } - return type; + function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage) { + var promisedType = getPromisedTypeOfPromise(type, errorNode); + return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage); } /** - * Gets the "promised type" of a promise. - * @param type The type of the promise. - * @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback. - */ - function getPromisedType(promise) { + * Gets the "promised type" of a promise. + * @param type The type of the promise. + * @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback. + */ + function getPromisedTypeOfPromise(promise, errorNode) { // // { // promise // then( // thenFunction @@ -38760,127 +42082,140 @@ var ts; if (isTypeAny(promise)) { return undefined; } - if (getObjectFlags(promise) & 4 /* Reference */) { - if (promise.target === tryGetGlobalPromiseType() - || promise.target === getGlobalPromiseLikeType()) { - return promise.typeArguments[0]; - } + var typeAsPromise = promise; + if (typeAsPromise.promisedTypeOfPromise) { + return typeAsPromise.promisedTypeOfPromise; } - var globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType(); - if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) { - return undefined; + if (isReferenceToType(promise, getGlobalPromiseType(/*reportErrors*/ false))) { + return typeAsPromise.promisedTypeOfPromise = promise.typeArguments[0]; } var thenFunction = getTypeOfPropertyOfType(promise, "then"); - if (!thenFunction || isTypeAny(thenFunction)) { + if (isTypeAny(thenFunction)) { return undefined; } - var thenSignatures = getSignaturesOfType(thenFunction, 0 /* Call */); + var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray; if (thenSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method); + } return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288 /* NEUndefinedOrNull */); if (isTypeAny(onfulfilledParameterType)) { return undefined; } var onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */); if (onfulfilledParameterSignatures.length === 0) { + if (errorNode) { + error(errorNode, ts.Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + } return undefined; } - return getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), /*subtypeReduction*/ true); - } - function getTypeOfFirstParameterOfSignature(signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return typeAsPromise.promisedTypeOfPromise = getUnionType(ts.map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), /*subtypeReduction*/ true); } /** - * Gets the "awaited type" of a type. - * @param type The type to await. - * @remarks The "awaited type" of an expression is its "promised type" if the expression is a - * Promise-like type; otherwise, it is the type of the expression. This is used to reflect - * The runtime behavior of the `await` keyword. - */ - function getAwaitedType(type) { - return checkAwaitedType(type, /*location*/ undefined, /*message*/ undefined); + * Gets the "awaited type" of a type. + * @param type The type to await. + * @remarks The "awaited type" of an expression is its "promised type" if the expression is a + * Promise-like type; otherwise, it is the type of the expression. This is used to reflect + * The runtime behavior of the `await` keyword. + */ + function checkAwaitedType(type, errorNode, diagnosticMessage) { + return getAwaitedType(type, errorNode, diagnosticMessage) || unknownType; } - function checkAwaitedType(type, location, message) { - return checkAwaitedTypeWorker(type); - function checkAwaitedTypeWorker(type) { - if (type.flags & 65536 /* Union */) { - var types = []; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var constituentType = _a[_i]; - types.push(checkAwaitedTypeWorker(constituentType)); - } - return getUnionType(types, /*subtypeReduction*/ true); + function getAwaitedType(type, errorNode, diagnosticMessage) { + var typeAsAwaitable = type; + if (typeAsAwaitable.awaitedTypeOfType) { + return typeAsAwaitable.awaitedTypeOfType; + } + if (isTypeAny(type)) { + return typeAsAwaitable.awaitedTypeOfType = type; + } + if (type.flags & 65536 /* Union */) { + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var constituentType = _a[_i]; + types = ts.append(types, getAwaitedType(constituentType, errorNode, diagnosticMessage)); } - else { - var promisedType = getPromisedType(type); - if (promisedType === undefined) { - // The type was not a PromiseLike, so it could not be unwrapped any further. - // As long as the type does not have a callable "then" property, it is - // safe to return the type; otherwise, an error will have been reported in - // the call to checkNonThenableType and we will return unknownType. - // - // An example of a non-promise "thenable" might be: - // - // await { then(): void {} } - // - // The "thenable" does not match the minimal definition for a PromiseLike. When - // a Promise/A+-compatible or ES6 promise tries to adopt this value, the promise - // will never settle. We treat this as an error to help flag an early indicator - // of a runtime problem. If the user wants to return this value from an async - // function, they would need to wrap it in some other value. If they want it to - // be treated as a promise, they can cast to . - return checkNonThenableType(type, location, message); - } - else { - if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { - // We have a bad actor in the form of a promise whose promised type is - // the same promise type, or a mutually recursive promise. Return the - // unknown type as we cannot guess the shape. If this were the actual - // case in the JavaScript, this Promise would never resolve. - // - // An example of a bad actor with a singly-recursive promise type might - // be: - // - // interface BadPromise { - // then( - // onfulfilled: (value: BadPromise) => any, - // onrejected: (error: any) => any): BadPromise; - // } - // - // The above interface will pass the PromiseLike check, and return a - // promised type of `BadPromise`. Since this is a self reference, we - // don't want to keep recursing ad infinitum. - // - // An example of a bad actor in the form of a mutually-recursive - // promise type might be: - // - // interface BadPromiseA { - // then( - // onfulfilled: (value: BadPromiseB) => any, - // onrejected: (error: any) => any): BadPromiseB; - // } - // - // interface BadPromiseB { - // then( - // onfulfilled: (value: BadPromiseA) => any, - // onrejected: (error: any) => any): BadPromiseA; - // } - // - if (location) { - error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); - } - return unknownType; - } - // Keep track of the type we're about to unwrap to avoid bad recursive promise types. - // See the comments above for more information. - awaitedTypeStack.push(type.id); - var awaitedType = checkAwaitedTypeWorker(promisedType); - awaitedTypeStack.pop(); - return awaitedType; + if (!types) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, /*subtypeReduction*/ true); + } + var promisedType = getPromisedTypeOfPromise(type); + if (promisedType) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { + // Verify that we don't have a bad actor in the form of a promise whose + // promised type is the same as the promise type, or a mutually recursive + // promise. If so, we return undefined as we cannot guess the shape. If this + // were the actual case in the JavaScript, this Promise would never resolve. + // + // An example of a bad actor with a singly-recursive promise type might + // be: + // + // interface BadPromise { + // then( + // onfulfilled: (value: BadPromise) => any, + // onrejected: (error: any) => any): BadPromise; + // } + // The above interface will pass the PromiseLike check, and return a + // promised type of `BadPromise`. Since this is a self reference, we + // don't want to keep recursing ad infinitum. + // + // An example of a bad actor in the form of a mutually-recursive + // promise type might be: + // + // interface BadPromiseA { + // then( + // onfulfilled: (value: BadPromiseB) => any, + // onrejected: (error: any) => any): BadPromiseB; + // } + // + // interface BadPromiseB { + // then( + // onfulfilled: (value: BadPromiseA) => any, + // onrejected: (error: any) => any): BadPromiseA; + // } + // + if (errorNode) { + error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); } + return undefined; + } + // Keep track of the type we're about to unwrap to avoid bad recursive promise types. + // See the comments above for more information. + awaitedTypeStack.push(type.id); + var awaitedType = getAwaitedType(promisedType, errorNode, diagnosticMessage); + awaitedTypeStack.pop(); + if (!awaitedType) { + return undefined; + } + return typeAsAwaitable.awaitedTypeOfType = awaitedType; + } + // The type was not a promise, so it could not be unwrapped any further. + // As long as the type does not have a callable "then" property, it is + // safe to return the type; otherwise, an error will be reported in + // the call to getNonThenableType and we will return undefined. + // + // An example of a non-promise "thenable" might be: + // + // await { then(): void {} } + // + // The "thenable" does not match the minimal definition for a promise. When + // a Promise/A+-compatible or ES6 promise tries to adopt this value, the promise + // will never settle. We treat this as an error to help flag an early indicator + // of a runtime problem. If the user wants to return this value from an async + // function, they would need to wrap it in some other value. If they want it to + // be treated as a promise, they can cast to . + var thenFunction = getTypeOfPropertyOfType(type, "then"); + if (thenFunction && getSignaturesOfType(thenFunction, 0 /* Call */).length > 0) { + if (errorNode) { + ts.Debug.assert(!!diagnosticMessage); + error(errorNode, diagnosticMessage); } + return undefined; } + return typeAsAwaitable.awaitedTypeOfType = type; } /** * Checks the return type of an async function to ensure it is a compatible @@ -38925,8 +42260,8 @@ var ts; if (returnType === unknownType) { return unknownType; } - var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) { + var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); + if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) { // The promise type was not a valid type reference to the global promise type, so we // report an error and return the unknown type. error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); @@ -38947,10 +42282,15 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455 /* Value */, /*ignoreErrors*/ true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + if (promiseConstructorName.kind === 70 /* Identifier */ && promiseConstructorName.text === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) { + error(node.type, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); + } + else { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + } return unknownType; } - var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(/*reportErrors*/ true); if (globalPromiseConstructorLikeType === emptyObjectType) { // If we couldn't resolve the global PromiseConstructorLike type we cannot verify // compatibility with __awaiter. @@ -38969,7 +42309,7 @@ var ts; } } // Get and return the awaited type of the return type. - return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return checkAwaitedType(returnType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); } /** Check a decorator */ function checkDecorator(node) { @@ -38982,22 +42322,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 144 /* Parameter */: + case 145 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -39020,6 +42360,9 @@ var ts; markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } /** Check the decorators of a node */ function checkDecorators(node) { if (!node.decorators) { @@ -39033,29 +42376,37 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); + if (node.kind === 145 /* Parameter */) { + checkExternalEmitHelpers(firstDecorator, 32 /* Param */); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced(node.type); break; - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: + case 148 /* PropertyDeclaration */: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; + case 145 /* Parameter */: markTypeNodeAsReferenced(node.type); break; } @@ -39067,6 +42418,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -39074,11 +42426,11 @@ var ts; function checkFunctionOrMethodDeclaration(node) { checkDecorators(node); checkSignatureDeclaration(node); - var isAsync = ts.isAsyncFunctionLike(node); + var functionFlags = ts.getFunctionFlags(node); // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 143 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -39109,17 +42461,19 @@ var ts; } } checkSourceElement(node.body); - if (!node.asteriskToken) { - var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if ((functionFlags & 1 /* Generator */) === 0) { + var returnOrPromisedType = node.type && (functionFlags & 2 /* Async */ + ? checkAsyncFunctionReturnType(node) // Async function + : getTypeFromTypeNode(node.type)); // normal function checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } if (produceDiagnostics && !node.type) { // Report an implicit any error if there is no body, no explicit return type, and node is not a private method // in an ambient context - if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { + if (noImplicitAny && ts.nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) { reportImplicitAnyError(node, anyType); } - if (node.asteriskToken && ts.nodeIsPresent(node.body)) { + if (functionFlags & 1 /* Generator */ && ts.nodeIsPresent(node.body)) { // A generator with a body and no type annotation can still cause errors. It can error if the // yielded values have no common supertype, or it can give an implicit any error if it has no // yielded values. The only way to trigger these errors is to try checking its return type. @@ -39138,56 +42492,54 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261 /* SourceFile */: - case 230 /* ModuleDeclaration */: + case 264 /* SourceFile */: + case 232 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 156 /* IndexSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: checkUnusedTypeParameters(node); break; } - ; } } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_3 = function (key) { - var local = node.locals[key]; + if (node.parent.kind !== 229 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + node.locals.forEach(function (local) { if (!local.isReferenced) { - if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) { + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 145 /* Parameter */) { var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && @@ -39200,22 +42552,28 @@ var ts; ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } - }; - for (var key in node.locals) { - _loop_3(key); - } + }); } } + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 /* VariableDeclaration */ && - (declaration.parent.parent.kind === 212 /* ForInStatement */ || - declaration.parent.parent.kind === 213 /* ForOfStatement */)) { + if (declaration.kind === 225 /* VariableDeclaration */ && + (declaration.parent.parent.kind === 214 /* ForInStatement */ || + declaration.parent.parent.kind === 215 /* ForOfStatement */)) { return; } } - error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 /* Identifier */ ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName) { return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); @@ -39228,12 +42586,12 @@ var ts; if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 149 /* MethodDeclaration */ || member.kind === 147 /* PropertyDeclaration */) { + if (member.kind === 150 /* MethodDeclaration */ || member.kind === 148 /* PropertyDeclaration */) { if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8 /* Private */) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 150 /* Constructor */) { + else if (member.kind === 151 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8 /* Private */) { @@ -39266,22 +42624,21 @@ var ts; } function checkUnusedModuleMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { - for (var key in node.locals) { - var local = node.locals[key]; + node.locals.forEach(function (local) { if (!local.isReferenced && !local.exportSymbol) { for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } - } + }); } } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 204 /* Block */) { + if (node.kind === 206 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -39304,12 +42661,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 147 /* PropertyDeclaration */ || - node.kind === 146 /* PropertySignature */ || - node.kind === 149 /* MethodDeclaration */ || - node.kind === 148 /* MethodSignature */ || - node.kind === 151 /* GetAccessor */ || - node.kind === 152 /* SetAccessor */) { + if (node.kind === 148 /* PropertyDeclaration */ || + node.kind === 147 /* PropertySignature */ || + node.kind === 150 /* MethodDeclaration */ || + node.kind === 149 /* MethodSignature */ || + node.kind === 152 /* GetAccessor */ || + node.kind === 153 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -39318,7 +42675,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 144 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 145 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -39329,10 +42686,14 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node) { - var current = node; - while (current) { + ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { var isDeclaration_1 = node.kind !== 70 /* Identifier */; if (isDeclaration_1) { @@ -39341,10 +42702,23 @@ var ts; else { error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); } - return; + return true; } - current = current.parent; - } + }); + } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + ts.findAncestor(node, function (current) { + if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) { + var isDeclaration_2 = node.kind !== 70 /* Identifier */; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return true; + } + }); } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { @@ -39357,8 +42731,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70 /* Identifier */; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70 /* Identifier */; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -39375,27 +42749,27 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 264 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 /* ES2017 */ || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 8192 /* HasAsyncFunctions */) { + if (parent.kind === 264 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39430,7 +42804,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 223 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 225 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -39440,24 +42814,24 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 205 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 226 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 207 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 204 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 231 /* ModuleBlock */ || - container.kind === 230 /* ModuleDeclaration */ || - container.kind === 261 /* SourceFile */); + (container.kind === 206 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 233 /* ModuleBlock */ || + container.kind === 232 /* ModuleDeclaration */ || + container.kind === 264 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name_23 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); + var name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } @@ -39465,7 +42839,7 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 144 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 145 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -39476,7 +42850,7 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 177 /* PropertyAccessExpression */) { + if (n.kind === 178 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } @@ -39495,27 +42869,28 @@ var ts; // so we need to do a bit of extra work to check if reference is legal var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 /* Parameter */) { + if (symbol.valueDeclaration.kind === 145 /* Parameter */ || + symbol.valueDeclaration.kind === 175 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { return; } // - parameter is wrapped in function-like entity - var current = n; - while (current !== node.initializer) { - if (ts.isFunctionLike(current.parent)) { - return; + if (ts.findAncestor(n, function (current) { + if (current === node.initializer) { + return "quit"; } - // computed property names/initializers in instance property declaration of class like entities - // are executed in constructor and thus deferred - if (current.parent.kind === 147 /* PropertyDeclaration */ && - !(ts.hasModifier(current.parent, 32 /* Static */)) && - ts.isClassLike(current.parent.parent)) { - return; - } - current = current.parent; + return ts.isFunctionLike(current.parent) || + // computed property names/initializers in instance property declaration of class like entities + // are executed in constructor and thus deferred + (current.parent.kind === 148 /* PropertyDeclaration */ && + !(ts.hasModifier(current.parent, 32 /* Static */)) && + ts.isClassLike(current.parent.parent)); + })) { + return; } + // fall through to report error } error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); } @@ -39536,40 +42911,46 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 174 /* BindingElement */) { + if (node.kind === 175 /* BindingElement */) { + if (node.parent.kind === 173 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(node, 4 /* Rest */); + } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 143 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); - var name_24 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); + var parent = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent); + var name = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent.initializer && property) { + checkPropertyAccessibility(parent, parent.initializer, parentType, property); } } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { + if (node.name.kind === 174 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 512 /* Read */); + } ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 144 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 145 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39580,7 +42961,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 214 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39600,21 +42981,22 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) { + if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { + if (node.kind === 225 /* VariableDeclaration */ || node.kind === 175 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 /* Parameter */ && right.kind === 223 /* VariableDeclaration */) || - (left.kind === 223 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { + if ((left.kind === 145 /* Parameter */ && right.kind === 225 /* VariableDeclaration */) || + (left.kind === 225 /* VariableDeclaration */ && right.kind === 145 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -39644,8 +43026,8 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 176 /* ObjectLiteralExpression */) { - if (ts.isAsyncFunctionLike(node)) { + if (node.modifiers && node.parent.kind === 177 /* ObjectLiteralExpression */) { + if (ts.getFunctionFlags(node) & 2 /* Async */) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } @@ -39665,7 +43047,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206 /* EmptyStatement */) { + if (node.thenStatement.kind === 208 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -39685,12 +43067,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 226 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -39708,19 +43090,29 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); + if (node.kind === 215 /* ForOfStatement */) { + if (node.awaitModifier) { + if (languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 8192 /* ForAwaitOfIncludes */); + } + } + else if (languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); + } + } // Check the LHS and RHS // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var iteratedType = checkRightHandSideOfForOf(node.expression); + var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); // There may be a destructuring assignment on the left side - if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -39752,7 +43144,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 226 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -39766,7 +43158,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { + if (varExpr.kind === 176 /* ArrayLiteralExpression */ || varExpr.kind === 177 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -39779,7 +43171,7 @@ var ts; } // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 16384 /* TypeParameter */ | 524288 /* IndexedAccess */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */ | 16777216 /* NonPrimitive */)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -39795,52 +43187,113 @@ var ts; checkVariableDeclaration(decl); } } - function checkRightHandSideOfForOf(rhsExpression) { + function checkRightHandSideOfForOf(rhsExpression, awaitModifier) { var expressionType = checkNonNullExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true, awaitModifier !== undefined); } - function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { + function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable) { if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= 2 /* ES2015 */) { - return checkElementTypeOfIterable(inputType, errorNode); + return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, /*checkAssignability*/ true) || anyType; + } + /** + * When consuming an iterable type in a for..of, spread, or iterator destructuring assignment + * we want to get the iterated type of an iterable for ES2015 or later, or the iterated type + * of a iterable (if defined globally) or element type of an array like for ES2015 or earlier. + */ + function getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, checkAssignability) { + var uplevelIteration = languageVersion >= 2 /* ES2015 */; + var downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; + // Get the iterated type of an `Iterable` or `IterableIterator` only in ES2015 + // or higher, when inside of an async generator or for-await-if, or when + // downlevelIteration is requested. + if (uplevelIteration || downlevelIteration || allowAsyncIterable) { + // We only report errors for an invalid iterable type in ES2015 or higher. + var iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterable, allowAsyncIterable, checkAssignability); + if (iteratedType || uplevelIteration) { + return iteratedType; + } } + var arrayType = inputType; + var reportedError = false; + var hasStringConstituent = false; + // If strings are permitted, remove any string-like constituents from the array type. + // This allows us to find other non-string element types from an array unioned with + // a string. if (allowStringInput) { - return checkElementTypeOfArrayOrString(inputType, errorNode); - } - if (isArrayLikeType(inputType)) { - var indexType = getIndexTypeOfType(inputType, 1 /* Number */); - if (indexType) { - return indexType; + if (arrayType.flags & 65536 /* Union */) { + // After we remove all types that are StringLike, we will know if there was a string constituent + // based on whether the result of filter is a new array. + var arrayTypes = inputType.types; + var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); }); + if (filteredTypes !== arrayTypes) { + arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); + } + } + else if (arrayType.flags & 262178 /* StringLike */) { + arrayType = neverType; + } + hasStringConstituent = arrayType !== inputType; + if (hasStringConstituent) { + if (languageVersion < 1 /* ES5 */) { + if (errorNode) { + error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + } + // Now that we've removed all the StringLike types, if no constituents remain, then the entire + // arrayOrStringType was a string. + if (arrayType.flags & 8192 /* Never */) { + return stringType; + } } } - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); + if (!isArrayLikeType(arrayType)) { + if (errorNode && !reportedError) { + // Which error we report depends on whether we allow strings or if there was a + // string constituent. For example, if the input type is number | string, we + // want to say that number is not an array type. But if the input was just + // number and string input is allowed, we want to say that number is not an + // array type or a string type. + var diagnostic = !allowStringInput || hasStringConstituent + ? downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type + : downlevelIteration + ? ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(errorNode, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : undefined; } - return unknownType; - } - /** - * When errorNode is undefined, it means we should not report any errors. - */ - function checkElementTypeOfIterable(iterable, errorNode) { - var elementType = getElementTypeOfIterable(iterable, errorNode); - // Now even though we have extracted the iteratedType, we will have to validate that the type - // passed in is actually an Iterable. - if (errorNode && elementType) { - checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode); + var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */); + if (hasStringConstituent && arrayElementType) { + // This is just an optimization for the case where arrayOrStringType is string | string[] + if (arrayElementType.flags & 262178 /* StringLike */) { + return stringType; + } + return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); } - return elementType || anyType; + return arrayElementType; } /** * We want to treat type as an iterable, and get the type it is an iterable of. The iterable * must have the following structure (annotated with the names of the variables below): * - * { // iterable - * [Symbol.iterator]: { // iteratorFunction - * (): Iterator + * { // iterable + * [Symbol.iterator]: { // iteratorMethod + * (): Iterator + * } + * } + * + * For an async iterable, we expect the following structure: + * + * { // iterable + * [Symbol.asyncIterator]: { // iteratorMethod + * (): AsyncIterator + * } * } - * } * * T is the type we are after. At every level that involves analyzing return types * of signatures, we union the return types of all the signatures. @@ -39852,166 +43305,170 @@ var ts; * caller requested it. Then the caller can decide what to do in the case where there is no iterated * type. This is different from returning anyType, because that would signify that we have matched the * whole pattern and that T (above) is 'any'. + * + * For a **for-of** statement, `yield*` (in a normal generator), spread, array + * destructuring, or normal generator we will only ever look for a `[Symbol.iterator]()` + * method. + * + * For an async generator we will only ever look at the `[Symbol.asyncIterator]()` method. + * + * For a **for-await-of** statement or a `yield*` in an async generator we will look for + * the `[Symbol.asyncIterator]()` method first, and then the `[Symbol.iterator]()` method. */ - function getElementTypeOfIterable(type, errorNode) { + function getIteratedTypeOfIterable(type, errorNode, isAsyncIterable, allowNonAsyncIterables, checkAssignability) { if (isTypeAny(type)) { return undefined; } var typeAsIterable = type; - if (!typeAsIterable.iterableElementType) { - // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable), - // then just grab its type argument. - if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableType()) { - typeAsIterable.iterableElementType = type.typeArguments[0]; + if (isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable) { + return isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable; + } + if (isAsyncIterable) { + // As an optimization, if the type is an instantiation of the global `AsyncIterable` + // or the global `AsyncIterableIterator` then just grab its type argument. + if (isReferenceToType(type, getGlobalAsyncIterableType(/*reportErrors*/ false)) || + isReferenceToType(type, getGlobalAsyncIterableIteratorType(/*reportErrors*/ false))) { + return typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0]; + } + } + if (!isAsyncIterable || allowNonAsyncIterables) { + // As an optimization, if the type is an instantiation of the global `Iterable` or + // `IterableIterator` then just grab its type argument. + if (isReferenceToType(type, getGlobalIterableType(/*reportErrors*/ false)) || + isReferenceToType(type, getGlobalIterableIteratorType(/*reportErrors*/ false))) { + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = type.typeArguments[0] + : typeAsIterable.iteratedTypeOfIterable = type.typeArguments[0]; + } + } + var iteratorMethodSignatures; + var mayBeIterable = false; + if (isAsyncIterable) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("asyncIterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; } - else { - var iteratorFunction = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); - if (isTypeAny(iteratorFunction)) { - return undefined; - } - var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, 0 /* Call */) : emptyArray; - if (iteratorFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); - } - return undefined; - } - typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(ts.map(iteratorFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true), errorNode); + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0 /* Call */); + } + if (!isAsyncIterable || (allowNonAsyncIterables && !ts.some(iteratorMethodSignatures))) { + var iteratorMethod = getTypeOfPropertyOfType(type, ts.getPropertyNameForKnownSymbolName("iterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; + } + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, 0 /* Call */); + mayBeIterable = true; + } + if (ts.some(iteratorMethodSignatures)) { + var iteratorMethodReturnType = getUnionType(ts.map(iteratorMethodSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); + var iteratedType = getIteratedTypeOfIterator(iteratorMethodReturnType, errorNode, /*isAsyncIterator*/ false); + if (checkAssignability && errorNode && iteratedType) { + // If `checkAssignability` was specified, we were called from + // `checkIteratedTypeOrElementType`. As such, we need to validate that + // the type passed in is actually an Iterable. + checkTypeAssignableTo(type, mayBeIterable + ? createIterableType(iteratedType) + : createAsyncIterableType(iteratedType), errorNode); } + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType + : typeAsIterable.iteratedTypeOfIterable = iteratedType; + } + if (errorNode) { + error(errorNode, isAsyncIterable + ? ts.Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : ts.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); } - return typeAsIterable.iterableElementType; + return undefined; } /** - * This function has very similar logic as getElementTypeOfIterable, except that it operates on + * This function has very similar logic as getIteratedTypeOfIterable, except that it operates on * Iterators instead of Iterables. Here is the structure: * * { // iterator - * next: { // iteratorNextFunction - * (): { // iteratorNextResult - * value: T // iteratorNextValue + * next: { // nextMethod + * (): { // nextResult + * value: T // nextValue * } * } * } * + * For an async iterator, we expect the following structure: + * + * { // iterator + * next: { // nextMethod + * (): PromiseLike<{ // nextResult + * value: T // nextValue + * }> + * } + * } */ - function getElementTypeOfIterator(type, errorNode) { + function getIteratedTypeOfIterator(type, errorNode, isAsyncIterator) { if (isTypeAny(type)) { return undefined; } var typeAsIterator = type; - if (!typeAsIterator.iteratorElementType) { - // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator), - // then just grab its type argument. - if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIteratorType()) { - typeAsIterator.iteratorElementType = type.typeArguments[0]; - } - else { - var iteratorNextFunction = getTypeOfPropertyOfType(type, "next"); - if (isTypeAny(iteratorNextFunction)) { - return undefined; - } - var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, 0 /* Call */) : emptyArray; - if (iteratorNextFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, ts.Diagnostics.An_iterator_must_have_a_next_method); - } - return undefined; - } - var iteratorNextResult = getUnionType(ts.map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); - if (isTypeAny(iteratorNextResult)) { - return undefined; - } - var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); - if (!iteratorNextValue) { - if (errorNode) { - error(errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); - } - return undefined; - } - typeAsIterator.iteratorElementType = iteratorNextValue; - } + if (isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator) { + return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator; + } + // As an optimization, if the type is an instantiation of the global `Iterator` (for + // a non-async iterator) or the global `AsyncIterator` (for an async-iterator) then + // just grab its type argument. + var getIteratorType = isAsyncIterator ? getGlobalAsyncIteratorType : getGlobalIteratorType; + if (isReferenceToType(type, getIteratorType(/*reportErrors*/ false))) { + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = type.typeArguments[0] + : typeAsIterator.iteratedTypeOfIterator = type.typeArguments[0]; + } + // Both async and non-async iterators must have a `next` method. + var nextMethod = getTypeOfPropertyOfType(type, "next"); + if (isTypeAny(nextMethod)) { + return undefined; } - return typeAsIterator.iteratorElementType; - } - function getElementTypeOfIterableIterator(type) { - if (isTypeAny(type)) { + var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0 /* Call */) : emptyArray; + if (nextMethodSignatures.length === 0) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.An_async_iterator_must_have_a_next_method + : ts.Diagnostics.An_iterator_must_have_a_next_method); + } return undefined; } - // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), - // then just grab its type argument. - if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableIteratorType()) { - return type.typeArguments[0]; + var nextResult = getUnionType(ts.map(nextMethodSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); + if (isTypeAny(nextResult)) { + return undefined; } - return getElementTypeOfIterable(type, /*errorNode*/ undefined) || - getElementTypeOfIterator(type, /*errorNode*/ undefined); - } - /** - * This function does the following steps: - * 1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents. - * 2. Take the element types of the array constituents. - * 3. Return the union of the element types, and string if there was a string constituent. - * - * For example: - * string -> string - * number[] -> number - * string[] | number[] -> string | number - * string | number[] -> string | number - * string | string[] | number[] -> string | number - * - * It also errors if: - * 1. Some constituent is neither a string nor an array. - * 2. Some constituent is a string and target is less than ES5 (because in ES3 string is not indexable). - */ - function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { - ts.Debug.assert(languageVersion < 2 /* ES2015 */); - var arrayType = arrayOrStringType; - if (arrayOrStringType.flags & 65536 /* Union */) { - // After we remove all types that are StringLike, we will know if there was a string constituent - // based on whether the result of filter is a new array. - var arrayTypes = arrayOrStringType.types; - var filteredTypes = ts.filter(arrayTypes, function (t) { return !(t.flags & 262178 /* StringLike */); }); - if (filteredTypes !== arrayTypes) { - arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); - } - } - else if (arrayOrStringType.flags & 262178 /* StringLike */) { - arrayType = neverType; - } - var hasStringConstituent = arrayOrStringType !== arrayType; - var reportedError = false; - if (hasStringConstituent) { - if (languageVersion < 1 /* ES5 */) { - error(errorNode, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - reportedError = true; - } - // Now that we've removed all the StringLike types, if no constituents remain, then the entire - // arrayOrStringType was a string. - if (arrayType.flags & 8192 /* Never */) { - return stringType; + // For an async iterator, we must get the awaited type of the return type. + if (isAsyncIterator) { + nextResult = getAwaitedTypeOfPromise(nextResult, errorNode, ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property); + if (isTypeAny(nextResult)) { + return undefined; } } - if (!isArrayLikeType(arrayType)) { - if (!reportedError) { - // Which error we report depends on whether there was a string constituent. For example, - // if the input type is number | string, we want to say that number is not an array type. - // But if the input was just number, we want to say that number is not an array type - // or a string type. - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; - error(errorNode, diagnostic, typeToString(arrayType)); + var nextValue = nextResult && getTypeOfPropertyOfType(nextResult, "value"); + if (!nextValue) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? ts.Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property + : ts.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); } - return hasStringConstituent ? stringType : unknownType; + return undefined; } - var arrayElementType = getIndexTypeOfType(arrayType, 1 /* Number */) || unknownType; - if (hasStringConstituent) { - // This is just an optimization for the case where arrayOrStringType is string | string[] - if (arrayElementType.flags & 262178 /* StringLike */) { - return stringType; - } - return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = nextValue + : typeAsIterator.iteratedTypeOfIterator = nextValue; + } + /** + * A generator may have a return type of `Iterator`, `Iterable`, or + * `IterableIterator`. An async generator may have a return type of `AsyncIterator`, + * `AsyncIterable`, or `AsyncIterableIterator`. This function can be used to extract + * the iterated type from this return type for contextual typing and verifying signatures. + */ + function getIteratedTypeOfGenerator(returnType, isAsyncGenerator) { + if (isTypeAny(returnType)) { + return undefined; } - return arrayElementType; + return getIteratedTypeOfIterable(returnType, /*errorNode*/ undefined, isAsyncGenerator, /*allowNonAsyncIterables*/ false, /*checkAssignability*/ false) + || getIteratedTypeOfIterator(returnType, /*errorNode*/ undefined, isAsyncGenerator); } function checkBreakOrContinueStatement(node) { // Grammar checking @@ -40019,10 +43476,12 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152 /* SetAccessor */))); + return !!(node.kind === 152 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 153 /* SetAccessor */))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { - var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + var unwrappedReturnType = (ts.getFunctionFlags(func) & 3 /* AsyncOrAsyncGenerator */) === 2 /* Async */ + ? getPromisedTypeOfPromise(returnType) // Async function + : returnType; // AsyncGenerator function, Generator function, or normal function return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 1024 /* Void */ | 1 /* Any */); } function checkReturnStatement(node) { @@ -40039,40 +43498,41 @@ var ts; var returnType = getReturnTypeOfSignature(signature); if (strictNullChecks || node.expression || returnType.flags & 8192 /* Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (func.asteriskToken) { + var functionFlags = ts.getFunctionFlags(func); + if (functionFlags & 1 /* Generator */) { // A generator does not need its return expressions checked against its return type. // Instead, the yield expressions are checked against the element type. // TODO: Check return expressions of generators when return type tracking is added // for generators. return; } - if (func.kind === 152 /* SetAccessor */) { + if (func.kind === 153 /* SetAccessor */) { if (node.expression) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 150 /* Constructor */) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + else if (func.kind === 151 /* Constructor */) { + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { - if (ts.isAsyncFunctionLike(func)) { - var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (functionFlags & 2 /* Async */) { + var promisedType = getPromisedTypeOfPromise(returnType); + var awaitedType = checkAwaitedType(exprType, node, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } - else if (func.kind !== 150 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 151 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -40081,7 +43541,7 @@ var ts; function checkWithStatement(node) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 524288 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -40102,7 +43562,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 254 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 257 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -40114,7 +43574,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 256 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable @@ -40140,18 +43600,16 @@ var ts; function checkLabeledStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - var current = node.parent; - while (current) { + ts.findAncestor(node.parent, function (current) { if (ts.isFunctionLike(current)) { - break; + return "quit"; } - if (current.kind === 219 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 221 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); - break; + return true; } - current = current.parent; - } + }); } // ensure that label is unique checkSourceElement(node.statement); @@ -40182,14 +43640,14 @@ var ts; grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var blockLocals = catchClause.block.locals; - if (blockLocals) { - for (var caughtName in catchClause.locals) { - var blockLocal = blockLocals[caughtName]; + var blockLocals_1 = catchClause.block.locals; + if (blockLocals_1) { + ts.forEachKey(catchClause.locals, function (caughtName) { + var blockLocal = blockLocals_1.get(caughtName); if (blockLocal && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -40241,15 +43699,16 @@ var ts; if (!indexType) { return; } + var propDeclaration = prop.valueDeclaration; // index is numeric and property name is not valid numeric literal - if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) { + if (indexKind === 1 /* Number */ && !(propDeclaration ? isNumericName(propDeclaration.name) : isNumericLiteralName(prop.name))) { return; } // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 142 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + if (propDeclaration && (propDeclaration.name.kind === 143 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { + errorNode = propDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; @@ -40279,16 +43738,26 @@ var ts; case "string": case "symbol": case "void": + case "object": error(name, message, name.text); } } - /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ + /** + * Check each type parameter and check that type parameters have no duplicate type parameter declarations + */ function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + var seenDefault = false; + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { + if (node.default) { + seenDefault = true; + } + else if (seenDefault) { + error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + } for (var j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); @@ -40299,22 +43768,64 @@ var ts; } } /** Check that type parameter lists are identical across multiple declarations */ - function checkTypeParameterListsIdentical(node, symbol) { + function checkTypeParameterListsIdentical(symbol) { if (symbol.declarations.length === 1) { return; } - var firstDecl; - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ || declaration.kind === 227 /* InterfaceDeclaration */) { - if (!firstDecl) { - firstDecl = declaration; + var links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + var declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (declarations.length <= 1) { + return; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { + // Report an error on every conflicting declaration. + var name = symbolToString(symbol); + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; + error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); } - else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { - error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + } + } + } + function areTypeParametersIdentical(declarations, typeParameters) { + var maxTypeArgumentCount = ts.length(typeParameters); + var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + // If this declaration has too few or too many type parameters, we report an error + var numTypeParameters = ts.length(declaration.typeParameters); + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + return false; + } + for (var i = 0; i < numTypeParameters; i++) { + var source = declaration.typeParameters[i]; + var target = typeParameters[i]; + // If the type parameter node does not have the same as the resolved type + // parameter at this position, we report an error. + if (source.name.text !== target.symbol.name) { + return false; + } + // If the type parameter node does not have an identical constraint as the resolved + // type parameter at this position, we report an error. + var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); + var targetConstraint = getConstraintFromTypeParameter(target); + if ((sourceConstraint || targetConstraint) && + (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { + return false; + } + // If the type parameter node has a default and it is not identical to the default + // for the type parameter at this position, we report an error. + var sourceDefault = source.default && getTypeFromTypeNode(source.default); + var targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + return false; } } } + return true; } function checkClassExpression(node) { checkClassLikeDeclaration(node); @@ -40334,11 +43845,12 @@ var ts; registerForUnusedIdentifiersCheck(node); } function checkClassLikeDeclaration(node) { - checkGrammarClassDeclarationHeritageClauses(node); + checkGrammarClassLikeDeclaration(node); checkDecorators(node); if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -40348,19 +43860,27 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); checkClassForDuplicateDeclarations(node); + // Only check for reserved static identifiers on non-ambient context. + if (!ts.isInAmbientContext(node)) { + checkClassForStaticPropertyNameConflicts(node); + } var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; - var staticBaseType = getBaseConstructorTypeOfClass(type); + var baseConstructorType = getBaseConstructorTypeOfClass(type); + var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); if (baseTypeNode.typeArguments) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); - for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); _i < _a.length; _i++) { + for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) { var constructor = _a[_i]; if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { break; @@ -40369,19 +43889,15 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && - !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226 /* ClassDeclaration */) { - if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { - error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); - } + if (baseConstructorType.flags & 540672 /* TypeVariable */ && !isMixinConstructorType(staticType)) { + error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 540672 /* TypeVariable */)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify // that all instantiated base constructor signatures return the same type. We can simply compare the type // references (as opposed to checking the structure of the types) because elsewhere we have already checked // that the base type is a class or interface type (and not, for example, an anonymous object type). - var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); + var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } @@ -40400,8 +43916,7 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = getObjectFlags(t) & 4 /* Reference */ ? t.target : t; - if (getObjectFlags(declaredType) & 3 /* ClassOrInterface */) { + if (isValidBaseType(t)) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -40431,11 +43946,16 @@ var ts; function getTargetSymbol(s) { // if symbol is instantiated its flags are not copied from the 'target' // so we'll need to get back original 'target' symbol to work with correct set of flags - return s.flags & 16777216 /* Instantiated */ ? getSymbolLinks(s).target : s; + return getCheckFlags(s) & 1 /* Instantiated */ ? s.target : s; } function getClassLikeDeclarationOfSymbol(symbol) { return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); } + function getClassOrInterfaceDeclarationsOfSymbol(symbol) { + return ts.filter(symbol.declarations, function (d) { + return d.kind === 228 /* ClassDeclaration */ || d.kind === 229 /* InterfaceDeclaration */; + }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { // TypeScript 1.0 spec (April 2014): 8.2.3 // A derived class inherits all members from its base class it doesn't override. @@ -40451,11 +43971,11 @@ var ts; // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration - var baseProperties = getPropertiesOfObjectType(baseType); + var baseProperties = getPropertiesOfType(baseType); for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); - if (base.flags & 134217728 /* Prototype */) { + if (base.flags & 16777216 /* Prototype */) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); @@ -40472,7 +43992,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128 /* Abstract */))) { - if (derivedClassDecl.kind === 197 /* ClassExpression */) { + if (derivedClassDecl.kind === 198 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -40483,7 +44003,7 @@ var ts; else { // derived overrides base. var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 8 /* Private */) || (derivedDeclarationFlags & 8 /* Private */)) { + if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) { // either base or derived property is private - not override, skip it continue; } @@ -40491,64 +44011,32 @@ var ts; // value of 'static' is not the same for properties - not override, skip it continue; } - if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & 98308 /* PropertyOrAccessor */) && (derived.flags & 98308 /* PropertyOrAccessor */))) { + if (isMethodLike(base) && isMethodLike(derived) || base.flags & 98308 /* PropertyOrAccessor */ && derived.flags & 98308 /* PropertyOrAccessor */) { // method is overridden with method or property/accessor is overridden with property/accessor - correct case continue; } var errorMessage = void 0; - if (base.flags & 8192 /* Method */) { + if (isMethodLike(base)) { if (derived.flags & 98304 /* Accessor */) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert((derived.flags & 4 /* Property */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } else if (base.flags & 4 /* Property */) { - ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert((base.flags & 98304 /* Accessor */) !== 0); - ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } - error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + error(derived.valueDeclaration.name || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } } } } function isAccessor(kind) { - return kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */; - } - function areTypeParametersIdentical(list1, list2) { - if (!list1 && !list2) { - return true; - } - if (!list1 || !list2 || list1.length !== list2.length) { - return false; - } - // TypeScript 1.0 spec (April 2014): - // When a generic interface has multiple declarations, all declarations must have identical type parameter - // lists, i.e. identical type parameter names with identical constraints in identical order. - for (var i = 0, len = list1.length; i < len; i++) { - var tp1 = list1[i]; - var tp2 = list2[i]; - if (tp1.name.text !== tp2.name.text) { - return false; - } - if (!tp1.constraint && !tp2.constraint) { - continue; - } - if (!tp1.constraint || !tp2.constraint) { - return false; - } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { - return false; - } - } - return true; + return kind === 152 /* GetAccessor */ || kind === 153 /* SetAccessor */; } function checkInheritedPropertiesAreIdentical(type, typeNode) { var baseTypes = getBaseTypes(type); @@ -40556,16 +44044,16 @@ var ts; return true; } var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; - var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var prop = properties_6[_a]; - var existing = seen[prop.name]; + var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); + for (var _a = 0, properties_8 = properties; _a < properties_8.length; _a++) { + var prop = properties_8[_a]; + var existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -40573,7 +44061,7 @@ var ts; ok = false; var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); + var errorInfo = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -40590,9 +44078,9 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 229 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -40699,7 +44187,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -40710,7 +44198,7 @@ var ts; case 51 /* TildeToken */: return ~value_1; } return undefined; - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -40734,12 +44222,13 @@ var ts; } return undefined; case 8 /* NumericLiteral */: + checkGrammarNumericLiteral(e); return +e.text; - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return evalConstant(e.expression); case 70 /* Identifier */: - case 178 /* ElementAccessExpression */: - case 177 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + case 178 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -40752,7 +44241,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 178 /* ElementAccessExpression */) { + if (e.kind === 179 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -40770,7 +44259,7 @@ var ts; if (current.kind === 70 /* Identifier */) { break; } - else if (current.kind === 177 /* PropertyAccessExpression */) { + else if (current.kind === 178 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -40814,6 +44303,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -40842,7 +44332,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 229 /* EnumDeclaration */) { + if (declaration.kind !== 231 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -40863,10 +44353,10 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { - var declaration = declarations_5[_i]; - if ((declaration.kind === 226 /* ClassDeclaration */ || - (declaration.kind === 225 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + if ((declaration.kind === 228 /* ClassDeclaration */ || + (declaration.kind === 227 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -40930,7 +44420,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 226 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 228 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -40943,7 +44433,7 @@ var ts; // We can detect if augmentation was applied using following rules: // - augmentation for a global scope is always applied // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module). - var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432 /* Merged */); + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 134217728 /* Transient */); if (checkBody && node.body) { // body of ambient external module is always a module block for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { @@ -40981,39 +44471,39 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: - var name_25 = node.name; - if (ts.isBindingPattern(name_25)) { - for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: + var name = node.name; + if (ts.isBindingPattern(name)) { + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - // fallthrough - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 225 /* FunctionDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: + // falls through + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 230 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -41023,7 +44513,7 @@ var ts; // this is done it two steps // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* Merged */); + var reportError = !(symbol.flags & 134217728 /* Transient */); if (!reportError) { // symbol should not originate in augmentation reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); @@ -41036,12 +44526,12 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return node; - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: do { node = node.left; } while (node.kind !== 70 /* Identifier */); return node; - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 70 /* Identifier */); @@ -41054,9 +44544,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 264 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 243 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -41089,7 +44579,7 @@ var ts; (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 /* ExportSpecifier */ ? + var message = node.kind === 245 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -41117,7 +44607,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -41174,8 +44664,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 233 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 233 /* ModuleBlock */ && + !node.moduleSpecifier && ts.isInAmbientContext(node); + if (node.parent.kind !== 264 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -41189,7 +44681,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 /* SourceFile */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 230 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 264 /* SourceFile */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 232 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -41215,9 +44707,14 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 261 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 230 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 264 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 232 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } // Grammar checking @@ -41243,18 +44740,13 @@ var ts; } } function hasExportedMembers(moduleSymbol) { - for (var id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return ts.forEachEntry(moduleSymbol.exports, function (_, id) { return id !== "export="; }); } function checkExternalModuleExports(node) { var moduleSymbol = getSymbolOfNode(node); var links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var exportEqualsSymbol = moduleSymbol.exports["export="]; + var exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { var declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -41263,35 +44755,35 @@ var ts; } // Checks for export * conflicts var exports = getExportsOfModule(moduleSymbol); - for (var id in exports) { + exports && exports.forEach(function (_a, id) { + var declarations = _a.declarations, flags = _a.flags; if (id === "__export") { - continue; + return; } - var _a = exports[id], declarations = _a.declarations, flags = _a.flags; // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. // (TS Exceptions: namespaces, function overloads, enums, and interfaces) if (flags & (1920 /* Namespace */ | 64 /* Interface */ | 384 /* Enum */)) { - continue; + return; } var exportedDeclarationsCount = ts.countWhere(declarations, isNotOverload); if (flags & 524288 /* TypeAlias */ && exportedDeclarationsCount <= 2) { // it is legal to merge type alias with other values // so count should be either 1 (just type alias) or 2 (type alias + merged value) - continue; + return; } if (exportedDeclarationsCount > 1) { - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; if (isNotOverload(declaration)) { diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); } } } - } + }); links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || + return (declaration.kind !== 227 /* FunctionDeclaration */ && declaration.kind !== 150 /* MethodDeclaration */) || !!declaration.body; } } @@ -41304,123 +44796,123 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return checkTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return checkParameter(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return checkPropertyDeclaration(node); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return checkSignatureDeclaration(node); - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return checkMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return checkConstructorDeclaration(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return checkAccessorDeclaration(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return checkTypeReferenceNode(node); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return checkTypePredicate(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return checkTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return checkTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return checkArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return checkTupleType(node); - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 166 /* ParenthesizedType */: - case 168 /* TypeOperator */: + case 167 /* ParenthesizedType */: + case 169 /* TypeOperator */: return checkSourceElement(node.type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return checkIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return checkMappedType(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return checkBlock(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return checkVariableStatement(node); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return checkExpressionStatement(node); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return checkIfStatement(node); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return checkDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return checkWhileStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return checkForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return checkForInStatement(node); - case 213 /* ForOfStatement */: + case 215 /* ForOfStatement */: return checkForOfStatement(node); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 216 /* ContinueStatement */: + case 217 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return checkReturnStatement(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return checkWithStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return checkSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return checkLabeledStatement(node); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return checkThrowStatement(node); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return checkTryStatement(node); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return checkBindingElement(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return checkClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return checkImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return checkExportDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return checkExportAssignment(node); - case 206 /* EmptyStatement */: + case 208 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 222 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 244 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -41442,17 +44934,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - checkAccessorDeferred(node); + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + checkAccessorDeclaration(node); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -41477,6 +44969,7 @@ var ts; // Grammar checking checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -41496,6 +44989,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1 /* TypeChecked */; } } @@ -41553,7 +45050,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 219 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -41562,12 +45059,12 @@ var ts; return false; } function getSymbolsInScope(location, meaning) { - var symbols = ts.createMap(); - var memberFlags = 0 /* None */; if (isInsideWithStatementBody(location)) { // We cannot answer semantic questions within a with block, do not proceed any further return []; } + var symbols = ts.createMap(); + var memberFlags = 0 /* None */; populateSymbols(); return symbolsToArray(symbols); function populateSymbols() { @@ -41576,25 +45073,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230 /* ModuleDeclaration */: + // falls through + case 232 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - // fall through; this fall-through is necessary because we would like to handle + // falls through + // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -41603,7 +45102,7 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793064 /* Type */); } break; - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -41631,17 +45130,16 @@ var ts; // We will copy all symbol regardless of its reserved name because // symbolsToArray will check whether the key is a reserved name and // it will not copy symbol with reserved name to the array - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source, meaning) { if (meaning) { - for (var id in source) { - var symbol = source[id]; + source.forEach(function (symbol) { copySymbol(symbol, meaning); - } + }); } } } @@ -41652,28 +45150,28 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 143 /* TypeParameter */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 144 /* TypeParameter */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 141 /* QualifiedName */) { + while (node.parent && node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } - return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 272 /* JSDocTypeReference */); + return node.parent && (node.parent.kind === 158 /* TypeReference */ || node.parent.kind === 276 /* JSDocTypeReference */); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 177 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 178 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 199 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 200 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -41690,13 +45188,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 142 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 236 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 242 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -41704,29 +45202,38 @@ var ts; function isInRightSideOfImportOrExportAssignment(node) { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } + function getSpecialPropertyAssignmentSymbolFromEntityName(entityName) { + var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case 1 /* ExportsProperty */: + case 3 /* PrototypeProperty */: + return getSymbolOfNode(entityName.parent); + case 4 /* ThisProperty */: + case 2 /* ModuleExports */: + case 5 /* Property */: + return getSymbolOfNode(entityName.parent.parent); + } + } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177 /* PropertyAccessExpression */) { - var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); - switch (specialPropertyAssignmentKind) { - case 1 /* ExportsProperty */: - case 3 /* PrototypeProperty */: - return getSymbolOfNode(entityName.parent); - case 4 /* ThisProperty */: - case 2 /* ModuleExports */: - return getSymbolOfNode(entityName.parent.parent); - default: + if (ts.isInJavaScriptFile(entityName) && + entityName.parent.kind === 178 /* PropertyAccessExpression */ && + entityName.parent === entityName.parent.parent.left) { + // Check if this is a special property assignment + var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); + if (specialPropertyAssignmentSymbol) { + return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 240 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 242 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + if (entityName.kind !== 178 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 234 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 236 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } @@ -41736,7 +45243,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 199 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 200 /* ExpressionWithTypeArguments */) { meaning = 793064 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -41747,9 +45254,12 @@ var ts; meaning = 1920 /* Namespace */; } meaning |= 8388608 /* Alias */; - return resolveEntityName(entityName, meaning); + var entityNameSymbol = resolveEntityName(entityName, meaning); + if (entityNameSymbol) { + return entityNameSymbol; + } } - else if (ts.isPartOfExpression(entityName)) { + if (ts.isPartOfExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { // Missing entity name. return undefined; @@ -41760,14 +45270,14 @@ var ts; } return resolveEntityName(entityName, 107455 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 177 /* PropertyAccessExpression */) { + else if (entityName.kind === 178 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 141 /* QualifiedName */) { + else if (entityName.kind === 142 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -41776,20 +45286,20 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 272 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; + var meaning = (entityName.parent.kind === 158 /* TypeReference */ || entityName.parent.kind === 276 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 250 /* JsxAttribute */) { + else if (entityName.parent.kind === 252 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 156 /* TypePredicate */) { + if (entityName.parent.kind === 157 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 264 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -41807,8 +45317,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 174 /* BindingElement */ && - node.parent.parent.kind === 172 /* ObjectBindingPattern */ && + else if (node.parent.kind === 175 /* BindingElement */ && + node.parent.parent.kind === 173 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -41819,8 +45329,8 @@ var ts; } switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 98 /* ThisKeyword */: var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); @@ -41830,16 +45340,16 @@ var ts; return sig.thisParameter; } } - // fallthrough + // falls through case 96 /* SuperKeyword */: var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 167 /* ThisType */: + case 168 /* ThisType */: return getTypeFromTypeNode(node).symbol; case 122 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 150 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 151 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -41847,17 +45357,17 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 /* ImportDeclaration */ || node.parent.kind === 241 /* ExportDeclaration */) && + ((node.parent.kind === 237 /* ImportDeclaration */ || node.parent.kind === 243 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) { return resolveExternalModuleName(node, node); } - // Fall through + // falls through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -41874,7 +45384,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 258 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 261 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -41891,7 +45401,13 @@ var ts; return unknownType; } if (ts.isPartOfTypeNode(node)) { - return getTypeFromTypeNode(node); + var typeFromTypeNode = getTypeFromTypeNode(node); + if (typeFromTypeNode && ts.isExpressionWithTypeArgumentsInClassImplementsClause(node)) { + var containingClass = ts.getContainingClass(node); + var classType = getTypeOfNode(containingClass); + typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType); + } + return typeFromTypeNode; } if (ts.isPartOfExpression(node)) { return getRegularTypeOfExpression(node); @@ -41899,7 +45415,10 @@ var ts; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { // A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the // extends clause of a class. We handle that case here. - return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; + var classNode = ts.getContainingClass(node); + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)); + var baseType = getBaseTypes(classType)[0]; + return baseType && getTypeWithThisArgument(baseType, classType.thisType); } if (isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration @@ -41936,31 +45455,31 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 176 /* ObjectLiteralExpression */ || expr.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 177 /* ObjectLiteralExpression */ || expr.kind === 176 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 213 /* ForOfStatement */) { - var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); + if (expr.parent.kind === 215 /* ForOfStatement */) { + var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 192 /* BinaryExpression */) { + if (expr.parent.kind === 193 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 257 /* PropertyAssignment */) { + if (expr.parent.kind === 260 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 175 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 176 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, ts.indexOf(expr.parent.elements, expr), elementType || unknownType); } // Gets the property symbol corresponding to the property in destructuring assignment @@ -41981,9 +45500,9 @@ var ts; return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } /** - * Gets either the static or instance type of a class element, based on - * whether the element is declared as "static". - */ + * Gets either the static or instance type of a class element, based on + * whether the element is declared as "static". + */ function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); return ts.getModifierFlags(node) & 32 /* Static */ @@ -41997,29 +45516,32 @@ var ts; var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 268435456 /* SyntheticProperty */) { + if (getCheckFlags(symbol) & 6 /* Synthetic */) { var symbols_3 = []; - var name_26 = symbol.name; + var name_2 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_26); + var symbol = getPropertyOfType(t, name_2); if (symbol) { symbols_3.push(symbol); } }); return symbols_3; } - else if (symbol.flags & 67108864 /* Transient */) { + else if (symbol.flags & 134217728 /* Transient */) { if (symbol.leftSpread) { var links = symbol; - return [links.leftSpread, links.rightSpread]; + return getRootSymbols(links.leftSpread).concat(getRootSymbols(links.rightSpread)); + } + if (symbol.syntheticOrigin) { + return getRootSymbols(symbol.syntheticOrigin); } var target = void 0; var next = symbol; @@ -42037,7 +45559,8 @@ var ts; if (!ts.isGeneratedIdentifier(node)) { node = ts.getParseTreeNode(node, ts.isIdentifier); if (node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + var isPropertyName_1 = node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; + return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } return false; @@ -42058,7 +45581,7 @@ var ts; // otherwise - check if at least one export is value symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 107455 /* Value */) - : ts.forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : ts.forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; function isValue(s) { @@ -42091,20 +45614,16 @@ var ts; } symbol = exportSymbol; } - var parentSymbol = getParentOfSymbol(symbol); - if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 261 /* SourceFile */) { - var symbolFile = parentSymbol.valueDeclaration; + var parentSymbol_1 = getParentOfSymbol(symbol); + if (parentSymbol_1) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 264 /* SourceFile */) { + var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. var symbolIsUmdExport = symbolFile !== referenceFile; return symbolIsUmdExport ? undefined : symbolFile; } - for (var n = node.parent; n; n = n.parent) { - if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) { - return n; - } - } + return ts.findAncestor(node.parent, function (n) { return ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol_1; }); } } } @@ -42150,7 +45669,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 204 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 206 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -42190,22 +45709,17 @@ var ts; return false; } function isValueAliasDeclaration(node) { - node = ts.getParseTreeNode(node); - if (node === undefined) { - // A synthesized node comes from an emit transformation and is always a value. - return true; - } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return node.expression && node.expression.kind === 70 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -42215,7 +45729,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 264 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -42236,11 +45750,6 @@ var ts; return isConstEnumSymbol(s) || s.constEnumOnlyModule; } function isReferencedAliasDeclaration(node, checkChildren) { - node = ts.getParseTreeNode(node); - // Purely synthesized nodes are always emitted. - if (node === undefined) { - return true; - } if (ts.isAliasSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node); if (symbol && getSymbolLinks(symbol).referenced) { @@ -42272,16 +45781,30 @@ var ts; } return false; } + function isRequiredInitializedParameter(parameter) { + return strictNullChecks && + !isOptionalParameter(parameter) && + parameter.initializer && + !(ts.getModifierFlags(parameter) & 92 /* ParameterPropertyModifier */); + } function getNodeCheckFlags(node) { - node = ts.getParseTreeNode(node); - return node ? getNodeLinks(node).flags : undefined; + return getNodeLinks(node).flags; } function getEnumMemberValue(node) { computeEnumMemberValues(node.parent); return getNodeLinks(node).enumMemberValue; } + function canHaveConstantValue(node) { + switch (node.kind) { + case 263 /* EnumMember */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: + return true; + } + return false; + } function getConstantValue(node) { - if (node.kind === 260 /* EnumMember */) { + if (node.kind === 263 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -42299,16 +45822,18 @@ var ts; function getTypeReferenceSerializationKind(typeName, location) { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); - var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); - if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { - return ts.TypeReferenceSerializationKind.Promise; - } - var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; - if (constructorType && isConstructorType(constructorType)) { - return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; - } // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. var typeSymbol = resolveEntityName(typeName, 793064 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); + if (valueSymbol && valueSymbol === typeSymbol) { + var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } + var constructorType = getTypeOfSymbol(valueSymbol); + if (constructorType && isConstructorType(constructorType)) { + return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; + } + } // We might not be able to resolve type symbol so use unknown type in that case (eg error case) if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; @@ -42354,6 +45879,9 @@ var ts; var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : unknownType; + if (flags & 4096 /* AddUndefined */) { + type = includeFalsyTypes(type, 2048 /* Undefined */); + } getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -42368,10 +45896,13 @@ var ts; var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); resolveBaseTypesOfClass(classType); var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + if (!baseType.symbol) { + writer.reportIllegalExtends(); + } getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -42382,9 +45913,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent = reference.parent; + if (ts.isDeclaration(parent) && reference === parent.name) { + location = getDeclarationContainer(parent); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -42420,34 +45951,48 @@ var ts; if (resolvedTypeReferenceDirectives) { // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = ts.createFileMap(); - for (var key in resolvedTypeReferenceDirectives) { - var resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { - continue; + return; } var file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer: getReferencedExportContainer, getReferencedImportDeclaration: getReferencedImportDeclaration, getReferencedDeclarationWithCollidingName: getReferencedDeclarationWithCollidingName, isDeclarationWithCollidingName: isDeclarationWithCollidingName, - isValueAliasDeclaration: isValueAliasDeclaration, + isValueAliasDeclaration: function (node) { + node = ts.getParseTreeNode(node); + // Synthesized nodes are always treated like values. + return node ? isValueAliasDeclaration(node) : true; + }, hasGlobalName: hasGlobalName, - isReferencedAliasDeclaration: isReferencedAliasDeclaration, - getNodeCheckFlags: getNodeCheckFlags, + isReferencedAliasDeclaration: function (node, checkChildren) { + node = ts.getParseTreeNode(node); + // Synthesized nodes are always treated as referenced. + return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + }, + getNodeCheckFlags: function (node) { + node = ts.getParseTreeNode(node); + return node ? getNodeCheckFlags(node) : undefined; + }, isTopLevelValueImportEqualsWithEntityName: isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible: isDeclarationVisible, isImplementationOfOverload: isImplementationOfOverload, + isRequiredInitializedParameter: isRequiredInitializedParameter, writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, - getConstantValue: getConstantValue, + getConstantValue: function (node) { + node = ts.getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, collectLinkedAliases: collectLinkedAliases, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, @@ -42470,7 +46015,7 @@ var ts; // property access can only be used as values // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 177 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) + var meaning = (node.kind === 178 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) ? 107455 /* Value */ | 1048576 /* ExportValue */ : 793064 /* Type */ | 1920 /* Namespace */; var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); @@ -42513,15 +46058,15 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent = getParentOfSymbol(current); + if (parent) { + current = parent; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 264 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -42541,7 +46086,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 264 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -42551,8 +46096,6 @@ var ts; } // Initialize global symbol table var augmentations; - var requestedExternalEmitHelpers = 0; - var firstFileRequestingExternalHelpers; for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { @@ -42567,20 +46110,11 @@ var ts; if (file.symbol && file.symbol.globalExports) { // Merge in UMD exports with first-in-wins semantics (see #9771) var source = file.symbol.globalExports; - for (var id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach(function (sourceSymbol, id) { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } - } - if ((compilerOptions.isolatedModules || ts.isExternalModule(file)) && !file.isDeclarationFile) { - var fileRequestedExternalEmitHelpers = file.flags & 64512 /* EmitHelperFlags */; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } + }); } } if (augmentations) { @@ -42597,110 +46131,67 @@ var ts; // Setup global builtins addToSymbolTable(globals, builtinGlobals, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedWideningType; - getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true); getSymbolLinks(unknownSymbol).type = unknownType; // Initialize special types - globalArrayType = getGlobalType("Array", /*arity*/ 1); - globalObjectType = getGlobalType("Object"); - globalFunctionType = getGlobalType("Function"); - globalStringType = getGlobalType("String"); - globalNumberType = getGlobalType("Number"); - globalBooleanType = getGlobalType("Boolean"); - globalRegExpType = getGlobalType("RegExp"); - jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); - getGlobalClassDecoratorType = ts.memoize(function () { return getGlobalType("ClassDecorator"); }); - getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); - getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); - getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); - getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); - getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); - getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); - tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793064 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); - getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); - getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); - getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); - tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol("Promise", 107455 /* Value */, /*diagnostic*/ undefined) && getGlobalPromiseConstructorSymbol(); }); - getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); - getGlobalThenableType = ts.memoize(createThenableType); - getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); - if (languageVersion >= 2 /* ES2015 */) { - getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); - getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", /*arity*/ 1); }); - getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", /*arity*/ 1); }); - getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", /*arity*/ 1); }); - } - else { - getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); - getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); - getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); - } + globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true); + globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true); + globalFunctionType = getGlobalType("Function", /*arity*/ 0, /*reportErrors*/ true); + globalStringType = getGlobalType("String", /*arity*/ 0, /*reportErrors*/ true); + globalNumberType = getGlobalType("Number", /*arity*/ 0, /*reportErrors*/ true); + globalBooleanType = getGlobalType("Boolean", /*arity*/ 0, /*reportErrors*/ true); + globalRegExpType = getGlobalType("RegExp", /*arity*/ 0, /*reportErrors*/ true); anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); - var symbol = getGlobalSymbol("ReadonlyArray", 793064 /* Type */, /*diagnostic*/ undefined); - globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); + globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", /*arity*/ 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; - // If we have specified that we are importing helpers, we should report global - // errors if we cannot resolve the helpers external module, or if it does not have - // the necessary helpers exported. - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - // Find the first reference to the helpers module. - var helpersModule = resolveExternalModule(firstFileRequestingExternalHelpers, ts.externalHelpersModuleNameText, ts.Diagnostics.Cannot_find_module_0, - /*errorNode*/ undefined); - // If we found the module, report errors if it does not have the necessary exports. - if (helpersModule) { - var exports = helpersModule.exports; - if (requestedExternalEmitHelpers & 1024 /* HasClassExtends */ && languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__extends", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 16384 /* HasSpreadAttribute */ && - (languageVersion < 5 /* ESNext */ || compilerOptions.jsx === 2 /* React */)) { - verifyHelperSymbol(exports, "__assign", 107455 /* Value */); - } - if (languageVersion < 5 /* ESNext */ && requestedExternalEmitHelpers & 32768 /* HasRestAttribute */) { - verifyHelperSymbol(exports, "__rest", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 2048 /* HasDecorators */) { - verifyHelperSymbol(exports, "__decorate", 107455 /* Value */); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", 107455 /* Value */); - } - } - if (requestedExternalEmitHelpers & 4096 /* HasParamDecorators */) { - verifyHelperSymbol(exports, "__param", 107455 /* Value */); - } - if (requestedExternalEmitHelpers & 8192 /* HasAsyncFunctions */) { - verifyHelperSymbol(exports, "__awaiter", 107455 /* Value */); - if (languageVersion < 2 /* ES2015 */) { - verifyHelperSymbol(exports, "__generator", 107455 /* Value */); + globalThisType = getGlobalTypeOrUndefined("ThisType", /*arity*/ 1); + } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions) && !ts.isInAmbientContext(location)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1 /* FirstEmitHelper */; helper <= 8192 /* LastEmitHelper */; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455 /* Value */); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols, name, meaning) { - var symbol = getSymbol(symbols, ts.escapeIdentifier(name), meaning); - if (!symbol) { - error(/*location*/ undefined, ts.Diagnostics.Module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); + function getHelperName(helper) { + switch (helper) { + case 1 /* Extends */: return "__extends"; + case 2 /* Assign */: return "__assign"; + case 4 /* Rest */: return "__rest"; + case 8 /* Decorate */: return "__decorate"; + case 16 /* Metadata */: return "__metadata"; + case 32 /* Param */: return "__param"; + case 64 /* Awaiter */: return "__awaiter"; + case 128 /* Generator */: return "__generator"; + case 256 /* Values */: return "__values"; + case 512 /* Read */: return "__read"; + case 1024 /* Spread */: return "__spread"; + case 2048 /* AsyncGenerator */: return "__asyncGenerator"; + case 4096 /* AsyncDelegator */: return "__asyncDelegator"; + case 8192 /* AsyncValues */: return "__asyncValues"; + default: ts.Debug.fail("Unrecognized helper."); } } - function createInstantiatedPromiseLikeType() { - var promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyGenericType) { - return createTypeReference(promiseLikeType, [anyType]); + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; } - return emptyObjectType; - } - function createThenableType() { - // build the thenable type that is used to verify against a non-promise "thenable" operand to `await`. - var thenPropertySymbol = createSymbol(67108864 /* Transient */ | 4 /* Property */, "then"); - getSymbolLinks(thenPropertySymbol).type = globalFunctionType; - var thenableType = createObjectType(16 /* Anonymous */); - thenableType.properties = [thenPropertySymbol]; - thenableType.members = createSymbolTable(thenableType.properties); - thenableType.callSignatures = []; - thenableType.constructSignatures = []; - return thenableType; + return externalHelpersModule; } // GRAMMAR CHECKING function checkGrammarDecorators(node) { @@ -42708,14 +46199,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 149 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 150 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */) { + else if (node.kind === 152 /* GetAccessor */ || node.kind === 153 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -42733,16 +46224,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 130 /* ReadonlyKeyword */) { - if (node.kind === 146 /* PropertySignature */ || node.kind === 148 /* MethodSignature */) { + if (node.kind === 147 /* PropertySignature */ || node.kind === 149 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 75 /* ConstKeyword */: - if (node.kind !== 229 /* EnumDeclaration */ && node.parent.kind === 226 /* ClassDeclaration */) { + if (node.kind !== 231 /* EnumDeclaration */ && node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */)); } break; @@ -42768,7 +46259,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -42791,10 +46282,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -42807,7 +46298,7 @@ var ts; if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */ && node.kind !== 155 /* IndexSignature */ && node.kind !== 144 /* Parameter */) { + else if (node.kind !== 148 /* PropertyDeclaration */ && node.kind !== 147 /* PropertySignature */ && node.kind !== 156 /* IndexSignature */ && node.kind !== 145 /* Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -42827,10 +46318,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -42842,13 +46333,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 233 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -42858,14 +46349,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226 /* ClassDeclaration */) { - if (node.kind !== 149 /* MethodDeclaration */ && - node.kind !== 147 /* PropertyDeclaration */ && - node.kind !== 151 /* GetAccessor */ && - node.kind !== 152 /* SetAccessor */) { + if (node.kind !== 228 /* ClassDeclaration */) { + if (node.kind !== 150 /* MethodDeclaration */ && + node.kind !== 148 /* PropertyDeclaration */ && + node.kind !== 152 /* GetAccessor */ && + node.kind !== 153 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { + if (!(node.parent.kind === 228 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -42884,7 +46375,7 @@ var ts; else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 144 /* Parameter */) { + else if (node.kind === 145 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -42892,7 +46383,7 @@ var ts; break; } } - if (node.kind === 150 /* Constructor */) { + if (node.kind === 151 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -42907,13 +46398,13 @@ var ts; } return; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 237 /* ImportDeclaration */ || node.kind === 236 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 145 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256 /* Async */) { @@ -42933,37 +46424,37 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 155 /* IndexSignature */: - case 230 /* ModuleDeclaration */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 144 /* Parameter */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 156 /* IndexSignature */: + case 232 /* ModuleDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: + case 242 /* ExportAssignment */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 145 /* Parameter */: return false; default: - if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { return false; } switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */); - case 227 /* InterfaceDeclaration */: - case 205 /* VariableStatement */: - case 228 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 207 /* VariableStatement */: + case 230 /* TypeAliasDeclaration */: return true; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */); default: ts.Debug.fail(); @@ -42976,14 +46467,11 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 149 /* MethodDeclaration */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - if (!node.asteriskToken) { - return false; - } - break; + case 150 /* MethodDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } @@ -43041,8 +46529,12 @@ var ts; return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } + function checkGrammarClassLikeDeclaration(node) { + var file = ts.getSourceFileOfNode(node); + return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file); + } function checkGrammarArrowFunction(node, file) { - if (node.kind === 185 /* ArrowFunction */) { + if (node.kind === 186 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -43077,7 +46569,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 134 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { + if (parameter.type.kind !== 135 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -43105,7 +46597,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { var arg = args_4[_i]; - if (arg.kind === 198 /* OmittedExpression */) { + if (arg.kind === 199 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -43178,28 +46670,25 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 142 /* ComputedPropertyName */) { + if (node.kind !== 143 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 192 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) { + if (computedPropertyName.expression.kind === 193 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 /* FunctionDeclaration */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 149 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 227 /* FunctionDeclaration */ || + node.kind === 185 /* FunctionExpression */ || + node.kind === 150 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } - if (languageVersion < 2 /* ES2015 */) { - return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher); - } } } function checkGrammarForInvalidQuestionMark(questionToken, message) { @@ -43215,15 +46704,15 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */) { + if (prop.kind === 262 /* SpreadAssignment */) { continue; } - var name_27 = prop.name; - if (name_27.kind === 142 /* ComputedPropertyName */) { + var name = prop.name; + if (name.kind === 143 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_27); + checkGrammarComputedPropertyName(name); } - if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 261 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -43232,7 +46721,7 @@ var ts; if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 149 /* MethodDeclaration */) { + if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 150 /* MethodDeclaration */) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -43246,69 +46735,69 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) { + if (prop.kind === 260 /* PropertyAssignment */ || prop.kind === 261 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_27.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_27); + if (name.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name); } currentKind = Property; } - else if (prop.kind === 149 /* MethodDeclaration */) { + else if (prop.kind === 150 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 151 /* GetAccessor */) { + else if (prop.kind === 152 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 152 /* SetAccessor */) { + else if (prop.kind === 153 /* SetAccessor */) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_27); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name); if (effectiveName === undefined) { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + var existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_27, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_27)); + grammarErrorOnNode(name, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { - return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_27, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } } function checkGrammarJsxElement(node) { var seen = ts.createMap(); - for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { + for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251 /* JsxSpreadAttribute */) { + if (attr.kind === 254 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_28 = jsxAttr.name; - if (!seen[name_28.text]) { - seen[name_28.text] = true; + var name = jsxAttr.name; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { - return grammarErrorOnNode(name_28, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 255 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -43317,7 +46806,12 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forInOrOfStatement.kind === 215 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) { + return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + } + } + if (forInOrOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -43332,20 +46826,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 214 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -43365,15 +46859,18 @@ var ts; else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128 /* Abstract */)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128 /* Abstract */) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 151 /* GetAccessor */ ? + return grammarErrorOnNode(accessor.name, kind === 152 /* GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 152 /* SetAccessor */) { + else if (kind === 153 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -43392,14 +46889,14 @@ var ts; } } /** Does the accessor have the right number of parameters? - - A get accessor has no parameters or a single `this` parameter. - A set accessor has one parameter or a `this` parameter and one more parameter */ + * A get accessor has no parameters or a single `this` parameter. + * A set accessor has one parameter or a `this` parameter and one more parameter. + */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 152 /* GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } @@ -43414,7 +46911,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 176 /* ObjectLiteralExpression */) { + if (node.parent.kind === 177 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } @@ -43435,10 +46932,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -43449,11 +46946,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 214 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 216 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -43461,8 +46958,8 @@ var ts; return false; } break; - case 218 /* SwitchStatement */: - if (node.kind === 215 /* BreakStatement */ && !node.label) { + case 220 /* SwitchStatement */: + if (node.kind === 217 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -43477,13 +46974,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 /* BreakStatement */ + var message = node.kind === 217 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 215 /* BreakStatement */ + var message = node.kind === 217 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -43495,7 +46992,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 173 /* ArrayBindingPattern */ || node.name.kind === 172 /* ObjectBindingPattern */) { + if (node.name.kind === 174 /* ArrayBindingPattern */ || node.name.kind === 173 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -43506,11 +47003,11 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.kind === 191 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 /* ForInStatement */ && node.parent.parent.kind !== 213 /* ForOfStatement */) { + if (node.parent.parent.kind !== 214 /* ForInStatement */ && node.parent.parent.kind !== 215 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -43539,6 +47036,10 @@ var ts; } } } + if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && + !ts.isInAmbientContext(node.parent.parent) && ts.hasModifier(node.parent.parent, 1 /* Export */)) { + checkESModuleMarker(node.name); + } var checkLetConstNames = (ts.isLet(node) || ts.isConst(node)); // 1. LexicalDeclaration : LetOrConst BindingList ; // It is a Syntax Error if the BoundNames of BindingList contains "let". @@ -43548,6 +47049,22 @@ var ts; // and its Identifier is eval or arguments return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } + function checkESModuleMarker(name) { + if (name.kind === 70 /* Identifier */) { + if (ts.unescapeIdentifier(name.text) === "__esModule") { + return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); + } + } + else { + var elements = name.elements; + for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { + var element = elements_2[_i]; + if (!ts.isOmittedExpression(element)) { + return checkESModuleMarker(element.name); + } + } + } + } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 70 /* Identifier */) { if (name.originalKeywordKind === 109 /* LetKeyword */) { @@ -43556,8 +47073,8 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { - var element = elements_2[_i]; + for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { + var element = elements_3[_i]; if (!ts.isOmittedExpression(element)) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -43575,15 +47092,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 210 /* IfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: return false; - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -43598,6 +47115,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -43638,7 +47162,7 @@ var ts; return true; } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 229 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -43646,7 +47170,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 161 /* TypeLiteral */) { + else if (node.parent.kind === 162 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -43671,13 +47195,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 227 /* InterfaceDeclaration */ || - node.kind === 228 /* TypeAliasDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 241 /* ExportDeclaration */ || - node.kind === 240 /* ExportAssignment */ || - node.kind === 233 /* NamespaceExportDeclaration */ || + if (node.kind === 229 /* InterfaceDeclaration */ || + node.kind === 230 /* TypeAliasDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 236 /* ImportEqualsDeclaration */ || + node.kind === 243 /* ExportDeclaration */ || + node.kind === 242 /* ExportAssignment */ || + node.kind === 235 /* NamespaceExportDeclaration */ || ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -43686,7 +47210,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 207 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -43712,7 +47236,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 204 /* Block */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 206 /* Block */ || node.parent.kind === 233 /* ModuleBlock */ || node.parent.kind === 264 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -43720,13 +47244,30 @@ var ts; } } else { + // We must be parented by a statement. If so, there's no need + // to report the error as our parent will have already done it. + // Debug.assert(isStatement(node.parent)); } } } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.numericLiteralFlags & 4 /* Octal */) { + var diagnosticMessage = void 0; + if (languageVersion >= 1 /* ES5 */) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 172 /* LiteralType */)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 263 /* EnumMember */)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37 /* MinusToken */; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -43739,11 +47280,11 @@ var ts; } function getAmbientModules() { var result = []; - for (var sym in globals) { + globals.forEach(function (global, sym) { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } @@ -43752,466 +47293,19 @@ var ts; /// /// /// -/* @internal */ var ts; (function (ts) { - ; - /** - * This map contains information about the shape of each Node in "types.ts" pertaining to how - * each node should be traversed during a transformation. - * - * Each edge corresponds to a property in a Node subtype that should be traversed when visiting - * each child. The properties are assigned in the order in which traversal should occur. - * - * We only add entries for nodes that do not have a create/update pair defined in factory.ts - * - * NOTE: This needs to be kept up to date with changes to nodes in "types.ts". Currently, this - * map is not comprehensive. Only node edges relevant to tree transformation are - * currently defined. We may extend this to be more comprehensive, and eventually - * supplant the existing `forEachChild` implementation if performance is not - * significantly impacted. - */ - var nodeEdgeTraversalMap = ts.createMap((_a = {}, - _a[141 /* QualifiedName */] = [ - { name: "left", test: ts.isEntityName }, - { name: "right", test: ts.isIdentifier } - ], - _a[145 /* Decorator */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[182 /* TypeAssertionExpression */] = [ - { name: "type", test: ts.isTypeNode }, - { name: "expression", test: ts.isUnaryExpression } - ], - _a[200 /* AsExpression */] = [ - { name: "expression", test: ts.isExpression }, - { name: "type", test: ts.isTypeNode } - ], - _a[201 /* NonNullExpression */] = [ - { name: "expression", test: ts.isLeftHandSideExpression } - ], - _a[229 /* EnumDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "members", test: ts.isEnumMember } - ], - _a[230 /* ModuleDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isModuleName }, - { name: "body", test: ts.isModuleBody } - ], - _a[231 /* ModuleBlock */] = [ - { name: "statements", test: ts.isStatement } - ], - _a[234 /* ImportEqualsDeclaration */] = [ - { name: "decorators", test: ts.isDecorator }, - { name: "modifiers", test: ts.isModifier }, - { name: "name", test: ts.isIdentifier }, - { name: "moduleReference", test: ts.isModuleReference } - ], - _a[245 /* ExternalModuleReference */] = [ - { name: "expression", test: ts.isExpression, optional: true } - ], - _a[260 /* EnumMember */] = [ - { name: "name", test: ts.isPropertyName }, - { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } - ], - _a)); - function reduceNode(node, f, initial) { - return node ? f(initial, node) : initial; - } - function reduceNodeArray(nodes, f, initial) { - return nodes ? f(initial, nodes) : initial; - } - /** - * Similar to `reduceLeft`, performs a reduction against each child of a node. - * NOTE: Unlike `forEachChild`, this does *not* visit every node. Only nodes added to the - * `nodeEdgeTraversalMap` above will be visited. - * - * @param node The node containing the children to reduce. - * @param initial The initial value to supply to the reduction. - * @param f The callback function - */ - function reduceEachChild(node, initial, cbNode, cbNodeArray) { - if (node === undefined) { - return initial; - } - var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; - var cbNodes = cbNodeArray || cbNode; - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { - return initial; - } - // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { - return initial; - } - var result = initial; - switch (node.kind) { - // Leaf nodes - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: - case 293 /* NotEmittedStatement */: - // No need to visit nodes with no children. - break; - // Names - case 142 /* ComputedPropertyName */: - result = reduceNode(node.expression, cbNode, result); - break; - // Signature elements - case 144 /* Parameter */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 145 /* Decorator */: - result = reduceNode(node.expression, cbNode, result); - break; - // Type member - case 147 /* PropertyDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 149 /* MethodDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 150 /* Constructor */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.body, cbNode, result); - break; - case 151 /* GetAccessor */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 152 /* SetAccessor */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.body, cbNode, result); - break; - // Binding patterns - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 174 /* BindingElement */: - result = reduceNode(node.propertyName, cbNode, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - // Expression - case 175 /* ArrayLiteralExpression */: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 176 /* ObjectLiteralExpression */: - result = reduceNodes(node.properties, cbNodes, result); - break; - case 177 /* PropertyAccessExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.name, cbNode, result); - break; - case 178 /* ElementAccessExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.argumentExpression, cbNode, result); - break; - case 179 /* CallExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); - break; - case 180 /* NewExpression */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - result = reduceNodes(node.arguments, cbNodes, result); - break; - case 181 /* TaggedTemplateExpression */: - result = reduceNode(node.tag, cbNode, result); - result = reduceNode(node.template, cbNode, result); - break; - case 184 /* FunctionExpression */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 185 /* ArrowFunction */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 183 /* ParenthesizedExpression */: - case 186 /* DeleteExpression */: - case 187 /* TypeOfExpression */: - case 188 /* VoidExpression */: - case 189 /* AwaitExpression */: - case 195 /* YieldExpression */: - case 196 /* SpreadElement */: - case 201 /* NonNullExpression */: - result = reduceNode(node.expression, cbNode, result); - break; - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: - result = reduceNode(node.operand, cbNode, result); - break; - case 192 /* BinaryExpression */: - result = reduceNode(node.left, cbNode, result); - result = reduceNode(node.right, cbNode, result); - break; - case 193 /* ConditionalExpression */: - result = reduceNode(node.condition, cbNode, result); - result = reduceNode(node.whenTrue, cbNode, result); - result = reduceNode(node.whenFalse, cbNode, result); - break; - case 194 /* TemplateExpression */: - result = reduceNode(node.head, cbNode, result); - result = reduceNodes(node.templateSpans, cbNodes, result); - break; - case 197 /* ClassExpression */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); - break; - case 199 /* ExpressionWithTypeArguments */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNodes(node.typeArguments, cbNodes, result); - break; - // Misc - case 202 /* TemplateSpan */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.literal, cbNode, result); - break; - // Element - case 204 /* Block */: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 205 /* VariableStatement */: - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.declarationList, cbNode, result); - break; - case 207 /* ExpressionStatement */: - result = reduceNode(node.expression, cbNode, result); - break; - case 208 /* IfStatement */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.thenStatement, cbNode, result); - result = reduceNode(node.elseStatement, cbNode, result); - break; - case 209 /* DoStatement */: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 211 /* ForStatement */: - result = reduceNode(node.initializer, cbNode, result); - result = reduceNode(node.condition, cbNode, result); - result = reduceNode(node.incrementor, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - result = reduceNode(node.initializer, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: - result = reduceNode(node.expression, cbNode, result); - break; - case 218 /* SwitchStatement */: - result = reduceNode(node.expression, cbNode, result); - result = reduceNode(node.caseBlock, cbNode, result); - break; - case 219 /* LabeledStatement */: - result = reduceNode(node.label, cbNode, result); - result = reduceNode(node.statement, cbNode, result); - break; - case 221 /* TryStatement */: - result = reduceNode(node.tryBlock, cbNode, result); - result = reduceNode(node.catchClause, cbNode, result); - result = reduceNode(node.finallyBlock, cbNode, result); - break; - case 223 /* VariableDeclaration */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 224 /* VariableDeclarationList */: - result = reduceNodes(node.declarations, cbNodes, result); - break; - case 225 /* FunctionDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.parameters, cbNodes, result); - result = reduceNode(node.type, cbNode, result); - result = reduceNode(node.body, cbNode, result); - break; - case 226 /* ClassDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.name, cbNode, result); - result = reduceNodes(node.typeParameters, cbNodes, result); - result = reduceNodes(node.heritageClauses, cbNodes, result); - result = reduceNodes(node.members, cbNodes, result); - break; - case 232 /* CaseBlock */: - result = reduceNodes(node.clauses, cbNodes, result); - break; - case 235 /* ImportDeclaration */: - result = reduceNodes(node.decorators, cbNodes, result); - result = reduceNodes(node.modifiers, cbNodes, result); - result = reduceNode(node.importClause, cbNode, result); - result = reduceNode(node.moduleSpecifier, cbNode, result); - break; - case 236 /* ImportClause */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.namedBindings, cbNode, result); - break; - case 237 /* NamespaceImport */: - result = reduceNode(node.name, cbNode, result); - break; - case 238 /* NamedImports */: - case 242 /* NamedExports */: - result = reduceNodes(node.elements, cbNodes, result); - break; - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: - result = reduceNode(node.propertyName, cbNode, result); - result = reduceNode(node.name, cbNode, result); - break; - case 240 /* ExportAssignment */: - result = ts.reduceLeft(node.decorators, cbNode, result); - result = ts.reduceLeft(node.modifiers, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; - case 241 /* ExportDeclaration */: - result = ts.reduceLeft(node.decorators, cbNode, result); - result = ts.reduceLeft(node.modifiers, cbNode, result); - result = reduceNode(node.exportClause, cbNode, result); - result = reduceNode(node.moduleSpecifier, cbNode, result); - break; - // JSX - case 246 /* JsxElement */: - result = reduceNode(node.openingElement, cbNode, result); - result = ts.reduceLeft(node.children, cbNode, result); - result = reduceNode(node.closingElement, cbNode, result); - break; - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: - result = reduceNode(node.tagName, cbNode, result); - result = reduceNodes(node.attributes, cbNodes, result); - break; - case 249 /* JsxClosingElement */: - result = reduceNode(node.tagName, cbNode, result); - break; - case 250 /* JsxAttribute */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 251 /* JsxSpreadAttribute */: - result = reduceNode(node.expression, cbNode, result); - break; - case 252 /* JsxExpression */: - result = reduceNode(node.expression, cbNode, result); - break; - // Clauses - case 253 /* CaseClause */: - result = reduceNode(node.expression, cbNode, result); - // fall-through - case 254 /* DefaultClause */: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 255 /* HeritageClause */: - result = reduceNodes(node.types, cbNodes, result); - break; - case 256 /* CatchClause */: - result = reduceNode(node.variableDeclaration, cbNode, result); - result = reduceNode(node.block, cbNode, result); - break; - // Property assignments - case 257 /* PropertyAssignment */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.initializer, cbNode, result); - break; - case 258 /* ShorthandPropertyAssignment */: - result = reduceNode(node.name, cbNode, result); - result = reduceNode(node.objectAssignmentInitializer, cbNode, result); - break; - case 259 /* SpreadAssignment */: - result = reduceNode(node.expression, cbNode, result); - break; - // Top-level nodes - case 261 /* SourceFile */: - result = reduceNodes(node.statements, cbNodes, result); - break; - case 294 /* PartiallyEmittedExpression */: - result = reduceNode(node.expression, cbNode, result); - break; - default: - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { - var edge = edgeTraversalPath_1[_i]; - var value = node[edge.name]; - if (value !== undefined) { - result = ts.isArray(value) - ? reduceNodes(value, cbNodes, result) - : cbNode(result, value); - } - } - } - break; - } - return result; - } - ts.reduceEachChild = reduceEachChild; - function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { + function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; } - aggregateTransformFlags(node); + ts.aggregateTransformFlags(node); var visited = visitor(node); if (visited === node) { return node; } var visitedNode; if (visited === undefined) { - if (!optional) { - Debug.failNotOptional(); - } return undefined; } else if (ts.isArray(visited)) { @@ -44220,17 +47314,23 @@ var ts; else { visitedNode = visited; } - if (parenthesize !== undefined) { - visitedNode = parenthesize(visitedNode, parentNode); - } - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); return visitedNode; } ts.visitNode = visitNode; - function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) { - if (nodes === undefined) { - return undefined; + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + function visitNodes(nodes, visitor, test, start, count) { + if (nodes === undefined || visitor === undefined) { + return nodes; } var updated; // Ensure start and count have valid values @@ -44245,38 +47345,32 @@ var ts; // If we are not visiting all of the original nodes, we must always create a new array. // Since this is a fragment of a node array, we do not copy over the previous location // and will only copy over `hasTrailingComma` if we are including the last element. - updated = ts.createNodeArray([], /*location*/ undefined, - /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length); + updated = ts.createNodeArray([], /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length); } // Visit each original node. for (var i = 0; i < count; i++) { var node = nodes[i + start]; - aggregateTransformFlags(node); + ts.aggregateTransformFlags(node); var visited = node !== undefined ? visitor(node) : undefined; if (updated !== undefined || visited === undefined || visited !== node) { if (updated === undefined) { // Ensure we have a copy of `nodes`, up to the current index. - updated = ts.createNodeArray(nodes.slice(0, i), /*location*/ nodes, nodes.hasTrailingComma); + updated = ts.createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma); + ts.setTextRange(updated, nodes); } if (visited) { if (ts.isArray(visited)) { for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { var visitedNode = visited_1[_i]; - visitedNode = parenthesize - ? parenthesize(visitedNode, parentNode) - : visitedNode; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); + ts.Debug.assertNode(visitedNode, test); + ts.aggregateTransformFlags(visitedNode); updated.push(visitedNode); } } else { - var visitedNode = parenthesize - ? parenthesize(visited, parentNode) - : visited; - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); + ts.Debug.assertNode(visited, test); + ts.aggregateTransformFlags(visited); + updated.push(visited); } } } @@ -44292,19 +47386,20 @@ var ts; context.startLexicalEnvironment(); statements = visitNodes(statements, visitor, ts.isStatement, start); if (ensureUseStrict && !ts.startsWithUseStrict(statements)) { - statements = ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements), statements); + statements = ts.setTextRange(ts.createNodeArray([ts.createStatement(ts.createLiteral("use strict"))].concat(statements)), statements); } var declarations = context.endLexicalEnvironment(); - return ts.createNodeArray(ts.concatenate(statements, declarations), statements); + return ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements); } ts.visitLexicalEnvironment = visitLexicalEnvironment; /** * Starts a new lexical environment and visits a parameter list, suspending the lexical * environment upon completion. */ - function visitParameterList(nodes, visitor, context) { + function visitParameterList(nodes, visitor, context, nodesVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } context.startLexicalEnvironment(); - var updated = visitNodes(nodes, visitor, ts.isParameterDeclaration); + var updated = nodesVisitor(nodes, visitor, ts.isParameterDeclaration); context.suspendLexicalEnvironment(); return updated; } @@ -44315,256 +47410,715 @@ var ts; var declarations = context.endLexicalEnvironment(); if (ts.some(declarations)) { var block = ts.convertToFunctionBody(updated); - var statements = mergeLexicalEnvironment(block.statements, declarations); + var statements = ts.mergeLexicalEnvironment(block.statements, declarations); return ts.updateBlock(block, statements); } return updated; } ts.visitFunctionBody = visitFunctionBody; - function visitEachChild(node, visitor, context) { + function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor) { + if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } if (node === undefined) { return undefined; } var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { - return node; - } - // We do not yet support types. - if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */) || kind === 168 /* ThisType */) { return node; } switch (node.kind) { - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: - case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: + case 297 /* EndOfDeclarationMarker */: + case 246 /* MissingDeclaration */: // No need to visit nodes with no children. return node; // Names - case 142 /* ComputedPropertyName */: + case 142 /* QualifiedName */: + return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier)); + case 143 /* ComputedPropertyName */: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); - // Signature elements - case 144 /* Parameter */: - return ts.updateParameter(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), node.dotDotDotToken, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - // Type member - case 147 /* PropertyDeclaration */: - return ts.updateProperty(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 149 /* MethodDeclaration */: - return ts.updateMethod(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 150 /* Constructor */: - return ts.updateConstructor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); - case 151 /* GetAccessor */: - return ts.updateGetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 152 /* SetAccessor */: - return ts.updateSetAccessor(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context)); + // Signatures and Signature Elements + case 159 /* FunctionType */: + return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 160 /* ConstructorType */: + return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 154 /* CallSignature */: + return ts.updateCallSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 155 /* ConstructSignature */: + return ts.updateConstructSignatureDeclaration(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 149 /* MethodSignature */: + return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); + case 156 /* IndexSignature */: + return ts.updateIndexSignatureDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 145 /* Parameter */: + return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 146 /* Decorator */: + return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression)); + // Types + case 158 /* TypeReference */: + return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + case 157 /* TypePredicate */: + return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode)); + case 161 /* TypeQuery */: + return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName)); + case 162 /* TypeLiteral */: + return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor)); + case 163 /* ArrayType */: + return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode)); + case 164 /* TupleType */: + return ts.updateTypleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode)); + case 165 /* UnionType */: + case 166 /* IntersectionType */: + return ts.updateUnionOrIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + case 167 /* ParenthesizedType */: + throw ts.Debug.fail("not implemented."); + case 169 /* TypeOperator */: + return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode)); + case 170 /* IndexedAccessType */: + return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode)); + case 171 /* MappedType */: + return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameter), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); + case 172 /* LiteralType */: + return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); + // Type Declarations + case 144 /* TypeParameter */: + return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode)); + // Type members + case 147 /* PropertySignature */: + return ts.updatePropertySignature(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 148 /* PropertyDeclaration */: + return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 150 /* MethodDeclaration */: + return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 151 /* Constructor */: + return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); + case 152 /* GetAccessor */: + return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 153 /* SetAccessor */: + return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); // Binding patterns - case 172 /* ObjectBindingPattern */: - return ts.updateObjectBindingPattern(node, visitNodes(node.elements, visitor, ts.isBindingElement)); - case 173 /* ArrayBindingPattern */: - return ts.updateArrayBindingPattern(node, visitNodes(node.elements, visitor, ts.isArrayBindingElement)); - case 174 /* BindingElement */: - return ts.updateBindingElement(node, node.dotDotDotToken, visitNode(node.propertyName, visitor, ts.isPropertyName, /*optional*/ true), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); + case 173 /* ObjectBindingPattern */: + return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + case 174 /* ArrayBindingPattern */: + return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + case 175 /* BindingElement */: + return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); // Expression - case 175 /* ArrayLiteralExpression */: - return ts.updateArrayLiteral(node, visitNodes(node.elements, visitor, ts.isExpression)); - case 176 /* ObjectLiteralExpression */: - return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 177 /* PropertyAccessExpression */: + case 176 /* ArrayLiteralExpression */: + return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + case 177 /* ObjectLiteralExpression */: + return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + case 178 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 179 /* CallExpression */: - return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 180 /* NewExpression */: - return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); - case 181 /* TaggedTemplateExpression */: + case 180 /* CallExpression */: + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 181 /* NewExpression */: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + case 182 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 183 /* ParenthesizedExpression */: + case 183 /* TypeAssertionExpression */: + return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 184 /* FunctionExpression */: - return ts.updateFunctionExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 185 /* ArrowFunction */: - return ts.updateArrowFunction(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 186 /* DeleteExpression */: + case 185 /* FunctionExpression */: + return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 186 /* ArrowFunction */: + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 187 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 194 /* TemplateExpression */: - return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); - case 195 /* YieldExpression */: - return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* SpreadElement */: + case 195 /* TemplateExpression */: + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + case 196 /* YieldExpression */: + return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); + case 197 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 197 /* ClassExpression */: - return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 199 /* ExpressionWithTypeArguments */: - return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 198 /* ClassExpression */: + return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 200 /* ExpressionWithTypeArguments */: + return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + case 201 /* AsExpression */: + return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); + case 202 /* NonNullExpression */: + return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Misc - case 202 /* TemplateSpan */: + case 204 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 204 /* Block */: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 205 /* VariableStatement */: - return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207 /* ExpressionStatement */: + case 206 /* Block */: + return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 207 /* VariableStatement */: + return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); + case 209 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* IfStatement */: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock)); - case 209 /* DoStatement */: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 210 /* WhileStatement */: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 211 /* ForStatement */: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 212 /* ForInStatement */: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 213 /* ForOfStatement */: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 214 /* ContinueStatement */: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 215 /* BreakStatement */: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 216 /* ReturnStatement */: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true)); - case 217 /* WithStatement */: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 218 /* SwitchStatement */: + case 210 /* IfStatement */: + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); + case 211 /* DoStatement */: + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + case 212 /* WhileStatement */: + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 213 /* ForStatement */: + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 214 /* ForInStatement */: + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 215 /* ForOfStatement */: + return ts.updateForOf(node, node.awaitModifier, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 216 /* ContinueStatement */: + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 217 /* BreakStatement */: + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); + case 218 /* ReturnStatement */: + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); + case 219 /* WithStatement */: + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 220 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 219 /* LabeledStatement */: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 220 /* ThrowStatement */: + case 221 /* LabeledStatement */: + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); + case 222 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 221 /* TryStatement */: - return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true)); - case 223 /* VariableDeclaration */: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 224 /* VariableDeclarationList */: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 225 /* FunctionDeclaration */: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 226 /* ClassDeclaration */: - return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232 /* CaseBlock */: - return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235 /* ImportDeclaration */: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 236 /* ImportClause */: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true)); - case 237 /* NamespaceImport */: + case 223 /* TryStatement */: + return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); + case 225 /* VariableDeclaration */: + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 226 /* VariableDeclarationList */: + return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + case 227 /* FunctionDeclaration */: + return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + case 228 /* ClassDeclaration */: + return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameter), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + case 231 /* EnumDeclaration */: + return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + case 232 /* ModuleDeclaration */: + return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); + case 233 /* ModuleBlock */: + return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 234 /* CaseBlock */: + return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + case 236 /* ImportEqualsDeclaration */: + return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); + case 237 /* ImportDeclaration */: + return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 238 /* ImportClause */: + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); + case 239 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 238 /* NamedImports */: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 239 /* ImportSpecifier */: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); - case 240 /* ExportAssignment */: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 241 /* ExportDeclaration */: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true)); - case 242 /* NamedExports */: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 243 /* ExportSpecifier */: - return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); + case 240 /* NamedImports */: + return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + case 241 /* ImportSpecifier */: + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + case 242 /* ExportAssignment */: + return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + case 243 /* ExportDeclaration */: + return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 244 /* NamedExports */: + return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + case 245 /* ExportSpecifier */: + return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); + // Module references + case 247 /* ExternalModuleReference */: + return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); // JSX - case 246 /* JsxElement */: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 247 /* JsxSelfClosingElement */: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 248 /* JsxOpeningElement */: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249 /* JsxClosingElement */: + case 248 /* JsxElement */: + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + case 253 /* JsxAttributes */: + return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + case 249 /* JsxSelfClosingElement */: + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 250 /* JsxOpeningElement */: + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNode(node.attributes, visitor, ts.isJsxAttributes)); + case 251 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 250 /* JsxAttribute */: + case 252 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 251 /* JsxSpreadAttribute */: + case 254 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 253 /* CaseClause */: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 254 /* DefaultClause */: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 255 /* HeritageClause */: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 256 /* CatchClause */: + case 256 /* CaseClause */: + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + case 257 /* DefaultClause */: + return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + case 258 /* HeritageClause */: + return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + case 259 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + // Enum + case 263 /* EnumMember */: + return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 261 /* SourceFile */: + case 264 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: - var updated = void 0; - var edgeTraversalPath = nodeEdgeTraversalMap[kind]; - if (edgeTraversalPath) { - for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { - var edge = edgeTraversalPath_2[_i]; - var value = node[edge.name]; - if (value !== undefined) { - var visited = ts.isArray(value) - ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node) - : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node); - if (updated !== undefined || visited !== value) { - if (updated === undefined) { - updated = ts.getMutableClone(node); - } - if (visited !== value) { - updated[edge.name] = visited; - } - } - } - } - } - return updated ? ts.updateNode(updated, node) : node; + return node; } - // return node; } ts.visitEachChild = visitEachChild; + /** + * Extracts the single node from a NodeArray. + * + * @param nodes The NodeArray. + */ + function extractSingleNode(nodes) { + ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return ts.singleOrUndefined(nodes); + } +})(ts || (ts = {})); +/* @internal */ +(function (ts) { + function reduceNode(node, f, initial) { + return node ? f(initial, node) : initial; + } + function reduceNodeArray(nodes, f, initial) { + return nodes ? f(initial, nodes) : initial; + } + /** + * Similar to `reduceLeft`, performs a reduction against each child of a node. + * NOTE: Unlike `forEachChild`, this does *not* visit every node. + * + * @param node The node containing the children to reduce. + * @param initial The initial value to supply to the reduction. + * @param f The callback function + */ + function reduceEachChild(node, initial, cbNode, cbNodeArray) { + if (node === undefined) { + return initial; + } + var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft; + var cbNodes = cbNodeArray || cbNode; + var kind = node.kind; + // No need to visit nodes with no children. + if ((kind > 0 /* FirstToken */ && kind <= 141 /* LastToken */)) { + return initial; + } + // We do not yet support types. + if ((kind >= 157 /* TypePredicate */ && kind <= 172 /* LiteralType */)) { + return initial; + } + var result = initial; + switch (node.kind) { + // Leaf nodes + case 205 /* SemicolonClassElement */: + case 208 /* EmptyStatement */: + case 199 /* OmittedExpression */: + case 224 /* DebuggerStatement */: + case 294 /* NotEmittedStatement */: + // No need to visit nodes with no children. + break; + // Names + case 142 /* QualifiedName */: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 143 /* ComputedPropertyName */: + result = reduceNode(node.expression, cbNode, result); + break; + // Signature elements + case 145 /* Parameter */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 146 /* Decorator */: + result = reduceNode(node.expression, cbNode, result); + break; + // Type member + case 148 /* PropertyDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 150 /* MethodDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 151 /* Constructor */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); + break; + case 152 /* GetAccessor */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 153 /* SetAccessor */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); + break; + // Binding patterns + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 175 /* BindingElement */: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + // Expression + case 176 /* ArrayLiteralExpression */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 177 /* ObjectLiteralExpression */: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 178 /* PropertyAccessExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 179 /* ElementAccessExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); + break; + case 180 /* CallExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 181 /* NewExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 182 /* TaggedTemplateExpression */: + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); + break; + case 183 /* TypeAssertionExpression */: + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 185 /* FunctionExpression */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 186 /* ArrowFunction */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 184 /* ParenthesizedExpression */: + case 187 /* DeleteExpression */: + case 188 /* TypeOfExpression */: + case 189 /* VoidExpression */: + case 190 /* AwaitExpression */: + case 196 /* YieldExpression */: + case 197 /* SpreadElement */: + case 202 /* NonNullExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + result = reduceNode(node.operand, cbNode, result); + break; + case 193 /* BinaryExpression */: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 194 /* ConditionalExpression */: + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.whenTrue, cbNode, result); + result = reduceNode(node.whenFalse, cbNode, result); + break; + case 195 /* TemplateExpression */: + result = reduceNode(node.head, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); + break; + case 198 /* ClassExpression */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 200 /* ExpressionWithTypeArguments */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + break; + case 201 /* AsExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.type, cbNode, result); + break; + case 202 /* NonNullExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + // Misc + case 204 /* TemplateSpan */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); + break; + // Element + case 206 /* Block */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 207 /* VariableStatement */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); + break; + case 209 /* ExpressionStatement */: + result = reduceNode(node.expression, cbNode, result); + break; + case 210 /* IfStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.thenStatement, cbNode, result); + result = reduceNode(node.elseStatement, cbNode, result); + break; + case 211 /* DoStatement */: + result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 212 /* WhileStatement */: + case 219 /* WithStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 213 /* ForStatement */: + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.condition, cbNode, result); + result = reduceNode(node.incrementor, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + result = reduceNode(node.initializer, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 218 /* ReturnStatement */: + case 222 /* ThrowStatement */: + result = reduceNode(node.expression, cbNode, result); + break; + case 220 /* SwitchStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); + break; + case 221 /* LabeledStatement */: + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 223 /* TryStatement */: + result = reduceNode(node.tryBlock, cbNode, result); + result = reduceNode(node.catchClause, cbNode, result); + result = reduceNode(node.finallyBlock, cbNode, result); + break; + case 225 /* VariableDeclaration */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 226 /* VariableDeclarationList */: + result = reduceNodes(node.declarations, cbNodes, result); + break; + case 227 /* FunctionDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 228 /* ClassDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.typeParameters, cbNodes, result); + result = reduceNodes(node.heritageClauses, cbNodes, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 231 /* EnumDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNodes(node.members, cbNodes, result); + break; + case 232 /* ModuleDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.body, cbNode, result); + break; + case 233 /* ModuleBlock */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 234 /* CaseBlock */: + result = reduceNodes(node.clauses, cbNodes, result); + break; + case 236 /* ImportEqualsDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.moduleReference, cbNode, result); + break; + case 237 /* ImportDeclaration */: + result = reduceNodes(node.decorators, cbNodes, result); + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.importClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); + break; + case 238 /* ImportClause */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); + break; + case 239 /* NamespaceImport */: + result = reduceNode(node.name, cbNode, result); + break; + case 240 /* NamedImports */: + case 244 /* NamedExports */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 241 /* ImportSpecifier */: + case 245 /* ExportSpecifier */: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 242 /* ExportAssignment */: + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 243 /* ExportDeclaration */: + result = ts.reduceLeft(node.decorators, cbNode, result); + result = ts.reduceLeft(node.modifiers, cbNode, result); + result = reduceNode(node.exportClause, cbNode, result); + result = reduceNode(node.moduleSpecifier, cbNode, result); + break; + // Module references + case 247 /* ExternalModuleReference */: + result = reduceNode(node.expression, cbNode, result); + break; + // JSX + case 248 /* JsxElement */: + result = reduceNode(node.openingElement, cbNode, result); + result = ts.reduceLeft(node.children, cbNode, result); + result = reduceNode(node.closingElement, cbNode, result); + break; + case 249 /* JsxSelfClosingElement */: + case 250 /* JsxOpeningElement */: + result = reduceNode(node.tagName, cbNode, result); + result = reduceNode(node.attributes, cbNode, result); + break; + case 253 /* JsxAttributes */: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 251 /* JsxClosingElement */: + result = reduceNode(node.tagName, cbNode, result); + break; + case 252 /* JsxAttribute */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 254 /* JsxSpreadAttribute */: + result = reduceNode(node.expression, cbNode, result); + break; + case 255 /* JsxExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + // Clauses + case 256 /* CaseClause */: + result = reduceNode(node.expression, cbNode, result); + // falls through + case 257 /* DefaultClause */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 258 /* HeritageClause */: + result = reduceNodes(node.types, cbNodes, result); + break; + case 259 /* CatchClause */: + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); + break; + // Property assignments + case 260 /* PropertyAssignment */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 261 /* ShorthandPropertyAssignment */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); + break; + case 262 /* SpreadAssignment */: + result = reduceNode(node.expression, cbNode, result); + break; + // Enum + case 263 /* EnumMember */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + // Top-level nodes + case 264 /* SourceFile */: + result = reduceNodes(node.statements, cbNodes, result); + break; + // Transformation nodes + case 295 /* PartiallyEmittedExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + default: + break; + } + return result; + } + ts.reduceEachChild = reduceEachChild; function mergeLexicalEnvironment(statements, declarations) { if (!ts.some(declarations)) { return statements; } return ts.isNodeArray(statements) - ? ts.createNodeArray(ts.concatenate(statements, declarations), statements) + ? ts.setTextRange(ts.createNodeArray(ts.concatenate(statements, declarations)), statements) : ts.addRange(statements, declarations); } ts.mergeLexicalEnvironment = mergeLexicalEnvironment; - function mergeFunctionBodyLexicalEnvironment(body, declarations) { - if (body && declarations !== undefined && declarations.length > 0) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements)); - } - else { - return ts.createBlock(ts.createNodeArray([ts.createReturn(body, /*location*/ body)].concat(declarations), body), - /*location*/ body, - /*multiLine*/ true); - } - } - return body; - } - ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment; /** * Lifts a NodeArray containing only Statement nodes to a block. * @@ -44575,15 +48129,6 @@ var ts; return ts.singleOrUndefined(nodes) || ts.createBlock(nodes); } ts.liftToBlock = liftToBlock; - /** - * Extracts the single node from a NodeArray. - * - * @param nodes The NodeArray. - */ - function extractSingleNode(nodes) { - Debug.assert(nodes.length <= 1, "Too many nodes written to output."); - return ts.singleOrUndefined(nodes); - } /** * Aggregates the TransformFlags for a Node and its subtree. */ @@ -44629,7 +48174,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 200 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -44647,9 +48192,6 @@ var ts; } var Debug; (function (Debug) { - Debug.failNotOptional = Debug.shouldAssert(1 /* Normal */) - ? function (message) { return Debug.assert(false, message || "Node not optional."); } - : ts.noop; Debug.failBadSyntaxKind = Debug.shouldAssert(1 /* Normal */) ? function (node, message) { return Debug.assert(false, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected."; }); } : ts.noop; @@ -44682,7 +48224,6 @@ var ts; } } })(Debug = ts.Debug || (ts.Debug = {})); - var _a; })(ts || (ts = {})); /// /// @@ -44710,7 +48251,7 @@ var ts; var value; if (ts.isDestructuringAssignment(node)) { value = node.right; - while (ts.isEmptyObjectLiteralOrArrayLiteral(node.left)) { + while (ts.isEmptyArrayLiteral(node.left) || ts.isEmptyObjectLiteral(node.left)) { if (ts.isDestructuringAssignment(value)) { location = node = value; value = node.right; @@ -44724,6 +48265,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: true, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -44772,7 +48314,7 @@ var ts; ts.Debug.assertNode(target, createAssignmentCallback ? ts.isIdentifier : ts.isExpression); var expression = createAssignmentCallback ? createAssignmentCallback(target, value, location) - : ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value, location); + : ts.setTextRange(ts.createAssignment(ts.visitNode(target, visitor, ts.isExpression), value), location); expression.original = original; emitExpression(expression); } @@ -44796,6 +48338,7 @@ var ts; var flattenContext = { context: context, level: level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: hoistTempVariables, emitExpression: emitExpression, emitBindingOrAssignment: emitBindingOrAssignment, @@ -44821,11 +48364,12 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_29 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_29, - /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name = _a.name, value = _a.value, location = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name, + /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value); variable.original = original; - if (ts.isIdentifier(name_29)) { + ts.setTextRange(variable, location); + if (ts.isIdentifier(name)) { ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */); } ts.aggregateTransformFlags(variable); @@ -44947,7 +48491,14 @@ var ts; function flattenArrayBindingOrAssignmentPattern(flattenContext, parent, pattern, value, location) { var elements = ts.getElementsOfBindingOrAssignmentPattern(pattern); var numElements = elements.length; - if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) { + if (flattenContext.level < 1 /* ObjectRest */ && flattenContext.downlevelIteration) { + // Read the elements of the iterable into an array + value = ensureIdentifier(flattenContext, ts.createReadHelper(flattenContext.context, value, numElements > 0 && ts.getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) + ? undefined + : numElements, location), + /*reuseIdentifierExpressions*/ false, location); + } + else if (numElements !== 1 && (flattenContext.level < 1 /* ObjectRest */ || numElements === 0)) { // For anything other than a single-element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. Additionally, if we have zero elements // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, @@ -45029,8 +48580,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_30 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_30); + var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name); } } /** @@ -45052,7 +48603,7 @@ var ts; var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); if (flattenContext.hoistTempVariables) { flattenContext.context.hoistVariableDeclaration(temp); - flattenContext.emitExpression(ts.createAssignment(temp, value, location)); + flattenContext.emitExpression(ts.setTextRange(ts.createAssignment(temp, value), location)); } else { flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined); @@ -45075,7 +48626,7 @@ var ts; return ts.createObjectLiteral(ts.map(elements, ts.convertToObjectAssignmentElement)); } function makeBindingElement(name) { - return ts.createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name); + return ts.createBindingElement(/*dotDotDotToken*/ undefined, /*propertyName*/ undefined, name); } function makeAssignmentElement(name) { return name; @@ -45083,10 +48634,11 @@ var ts; var restHelper = { name: "typescript:rest", scoped: false, - text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" }; /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement - * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`*/ + * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);` + */ function createRestCall(context, value, elements, computedTempVariables, location) { context.requestEmitHelper(restHelper); var propertyNames = []; @@ -45105,7 +48657,11 @@ var ts; } } } - return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + return ts.createCall(ts.getHelperName("__rest"), + /*typeArguments*/ undefined, [ + value, + ts.setTextRange(ts.createArrayLiteral(propertyNames), location) + ]); } })(ts || (ts = {})); /// @@ -45140,8 +48696,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -45205,15 +48761,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 231 /* ModuleBlock */: - case 204 /* Block */: + case 264 /* SourceFile */: + case 234 /* CaseBlock */: + case 233 /* ModuleBlock */: + case 206 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 226 /* ClassDeclaration */: - case 225 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 227 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -45260,13 +48816,13 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -45286,11 +48842,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 241 /* ExportDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 236 /* ImportClause */ || - (node.kind === 234 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 245 /* ExternalModuleReference */)) { + if (node.kind === 243 /* ExportDeclaration */ || + node.kind === 237 /* ImportDeclaration */ || + node.kind === 238 /* ImportClause */ || + (node.kind === 236 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 247 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -45320,19 +48876,19 @@ var ts; */ function classElementVisitorWorker(node) { switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // TypeScript constructors are transformed in `visitClassDeclaration`. // We elide them here as `visitorWorker` checks transform flags, which could // erronously include an ES6 constructor without TypeScript syntax. return undefined; - case 147 /* PropertyDeclaration */: - case 155 /* IndexSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 149 /* MethodDeclaration */: + case 148 /* PropertyDeclaration */: + case 156 /* IndexSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 150 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 203 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -45372,46 +48928,47 @@ var ts; case 123 /* DeclareKeyword */: case 130 /* ReadonlyKeyword */: // TypeScript accessibility and readonly modifiers are elided. - case 162 /* ArrayType */: - case 163 /* TupleType */: - case 161 /* TypeLiteral */: - case 156 /* TypePredicate */: - case 143 /* TypeParameter */: + case 163 /* ArrayType */: + case 164 /* TupleType */: + case 162 /* TypeLiteral */: + case 157 /* TypePredicate */: + case 144 /* TypeParameter */: case 118 /* AnyKeyword */: case 121 /* BooleanKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 129 /* NeverKeyword */: case 104 /* VoidKeyword */: - case 135 /* SymbolKeyword */: - case 159 /* ConstructorType */: - case 158 /* FunctionType */: - case 160 /* TypeQuery */: - case 157 /* TypeReference */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: - case 166 /* ParenthesizedType */: - case 167 /* ThisType */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 171 /* LiteralType */: + case 136 /* SymbolKeyword */: + case 160 /* ConstructorType */: + case 159 /* FunctionType */: + case 161 /* TypeQuery */: + case 158 /* TypeReference */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: + case 167 /* ParenthesizedType */: + case 168 /* ThisType */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 172 /* LiteralType */: // TypeScript type nodes are elided. - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: // TypeScript index signatures are elided. - case 145 /* Decorator */: + case 146 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. - case 147 /* PropertyDeclaration */: - // TypeScript property declarations are elided. - case 150 /* Constructor */: + case 148 /* PropertyDeclaration */: + // TypeScript property declarations are elided. + return undefined; + case 151 /* Constructor */: return visitConstructor(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -45422,7 +48979,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: // This is a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -45433,35 +48990,35 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: // This is a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -45471,33 +49028,33 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 182 /* TypeAssertionExpression */: - case 200 /* AsExpression */: + case 183 /* TypeAssertionExpression */: + case 201 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -45506,7 +49063,8 @@ var ts; } } function visitSourceFile(node) { - var alwaysStrict = compilerOptions.alwaysStrict && !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); + var alwaysStrict = (compilerOptions.alwaysStrict === undefined ? compilerOptions.strict : compilerOptions.alwaysStrict) && + !(ts.isExternalModule(node) && moduleKind === ts.ModuleKind.ES2015); return ts.updateSourceFileNode(node, ts.visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict)); } /** @@ -45602,13 +49160,14 @@ var ts; // } var classDeclaration = ts.createClassDeclaration( /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); - var emitFlags = ts.getEmitFlags(node); + /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause)); // To better align with the old emitter, we should not emit a trailing source map // entry if the class has static properties. + var emitFlags = ts.getEmitFlags(node); if (hasStaticProperties) { emitFlags |= 32 /* NoTrailingSourceMap */; } + ts.setTextRange(classDeclaration, node); ts.setOriginalNode(classDeclaration, node); ts.setEmitFlags(classDeclaration, emitFlags); return classDeclaration; @@ -45716,12 +49275,18 @@ var ts; // } var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, hasExtendsClause); - var classExpression = ts.createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members, location); + var classExpression = ts.createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members); ts.setOriginalNode(classExpression, node); + ts.setTextRange(classExpression, location); // let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference // or decoratedClassAlias if the class contain self-reference. - var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location); + var statement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(declName, + /*type*/ undefined, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression) + ], 1 /* Let */)); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, location); ts.setCommentRange(statement, node); return statement; } @@ -45738,10 +49303,11 @@ var ts; var staticProperties = getInitializedProperties(node, /*isStatic*/ true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84 /* ExtendsKeyword */; })); - var classExpression = ts.setOriginalNode(ts.createClassExpression( + var classExpression = ts.createClassExpression( /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, heritageClauses, members, - /*location*/ node), node); + /*typeParameters*/ undefined, heritageClauses, members); + ts.setOriginalNode(classExpression, node); + ts.setTextRange(classExpression, node); if (staticProperties.length > 0) { var expressions = []; var temp = ts.createTempVariable(hoistVariableDeclaration); @@ -45773,7 +49339,7 @@ var ts; members.push(constructor); } ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement)); - return ts.createNodeArray(members, /*location*/ node.members); + return ts.setTextRange(ts.createNodeArray(members), /*location*/ node.members); } /** * Transforms (or creates) a constructor for a class. @@ -45798,10 +49364,9 @@ var ts; // constructor(${parameters}) { // ${body} // } - return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor( + return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(ts.createConstructor( /*decorators*/ undefined, - /*modifiers*/ undefined, parameters, body, - /*location*/ constructor || node), constructor)); + /*modifiers*/ undefined, parameters, body), constructor || node), constructor)); } /** * Transforms (or creates) the parameters for the constructor of a class with @@ -45883,11 +49448,11 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); } // End the lexical environment. - ts.addRange(statements, endLexicalEnvironment()); - return ts.createBlock(ts.createNodeArray(statements, + statements = ts.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + return ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ constructor ? constructor.body.statements : node.members), - /*location*/ constructor ? constructor.body : undefined, - /*multiLine*/ true); + /*multiLine*/ true), + /*location*/ constructor ? constructor.body : undefined); } /** * Adds super call and preceding prologue directives into the list of statements. @@ -45899,13 +49464,13 @@ var ts; if (ctor.body) { var statements = ctor.body.statements; // add prologue directives to the list (if any) - var index = ts.addPrologueDirectives(result, statements, /*ensureUseStrict*/ false, visitor); + var index = ts.addPrologue(result, statements, /*ensureUseStrict*/ false, visitor); if (index === statements.length) { // list contains nothing but prologue directives (or empty) - exit return index; } var statement = statements[index]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -45942,9 +49507,7 @@ var ts; ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */); var localName = ts.getMutableClone(name); ts.setEmitFlags(localName, 1536 /* NoComments */); - return ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createThis(), propertyName, - /*location*/ node.name), localName), - /*location*/ ts.moveRangePos(node, -1))); + return ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createThis(), propertyName), node.name), localName)), ts.moveRangePos(node, -1))); } /** * Gets all property declarations with initializers on either the static or instance side of a class. @@ -45978,7 +49541,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member, isStatic) { - return member.kind === 147 /* PropertyDeclaration */ + return member.kind === 148 /* PropertyDeclaration */ && isStatic === ts.hasModifier(member, 32 /* Static */) && member.initializer !== undefined; } @@ -45989,8 +49552,8 @@ var ts; * @param receiver The receiver on which each property should be assigned. */ function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { - var property = properties_7[_i]; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -46005,8 +49568,8 @@ var ts; */ function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { - var property = properties_8[_i]; + for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { + var property = properties_10[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -46113,12 +49676,12 @@ var ts; */ function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return getAllDecoratorsOfAccessors(node, member); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -46135,10 +49698,11 @@ var ts; return undefined; } var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; - if (accessor !== firstAccessor) { + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + var decorators = firstAccessorWithDecorators.decorators; var parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -46179,14 +49743,14 @@ var ts; * @param node The declaration node. * @param allDecorators An object containing all of the decorators for the declaration. */ - function transformAllDecoratorsOfDeclaration(node, allDecorators) { + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { if (!allDecorators) { return undefined; } var decoratorExpressions = []; ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } /** @@ -46233,7 +49797,7 @@ var ts; */ function generateClassElementDecorationExpression(node, member) { var allDecorators = getAllDecoratorsOfClassElement(node, member); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -46270,7 +49834,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true); var descriptor = languageVersion > 0 /* ES3 */ - ? member.kind === 147 /* PropertyDeclaration */ + ? member.kind === 148 /* PropertyDeclaration */ ? ts.createVoidZero() : ts.createNull() : undefined; @@ -46296,7 +49860,7 @@ var ts; */ function generateConstructorDecorationExpression(node) { var allDecorators = getAllDecoratorsOfConstructor(node); - var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -46342,41 +49906,41 @@ var ts; * @param node The declaration node. * @param decoratorExpressions The destination array to which to add new decorator expressions. */ - function addTypeMetadata(node, decoratorExpressions) { + function addTypeMetadata(node, container, decoratorExpressions) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node, decoratorExpressions) { + function addOldTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } } } - function addNewTypeMetadata(node, decoratorExpressions) { + function addNewTypeMetadata(node, container, decoratorExpressions) { if (compilerOptions.emitDecoratorMetadata) { var properties = void 0; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node)))); } if (properties) { - decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true))); + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*multiLine*/ true))); } } } @@ -46389,10 +49953,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */ - || kind === 147 /* PropertyDeclaration */; + return kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */ + || kind === 148 /* PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -46402,7 +49966,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 149 /* MethodDeclaration */; + return node.kind === 150 /* MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -46412,12 +49976,16 @@ var ts; * @param node The node to test. */ function shouldAddParamTypesMetadata(node) { - var kind = node.kind; - return kind === 226 /* ClassDeclaration */ - || kind === 197 /* ClassExpression */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; + switch (node.kind) { + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return true; + } + return false; } /** * Serializes the type of a node for use with decorator type metadata. @@ -46426,43 +49994,26 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: - case 151 /* GetAccessor */: + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 152 /* GetAccessor */: return serializeTypeNode(node.type); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 150 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); } } - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node) { - if (node && node.kind === 162 /* ArrayType */) { - return node.elementType; - } - else if (node && node.kind === 157 /* TypeReference */) { - return ts.singleOrUndefined(node.typeArguments); - } - else { - return undefined; - } - } /** * Serializes the types of the parameters of a node for use with decorator type metadata. * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node) { + function serializeParameterTypesOfNode(node, container) { var valueDeclaration = ts.isClassLike(node) ? ts.getFirstConstructorWithBody(node) : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) @@ -46470,7 +50021,7 @@ var ts; : undefined; var expressions = []; if (valueDeclaration) { - var parameters = valueDeclaration.parameters; + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; @@ -46478,7 +50029,7 @@ var ts; continue; } if (parameter.dotDotDotToken) { - expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type))); + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); } else { expressions.push(serializeTypeOfNode(parameter)); @@ -46487,6 +50038,15 @@ var ts; } return ts.createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 152 /* GetAccessor */) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } /** * Serializes the return type of a node for use with decorator type metadata. * @@ -46496,7 +50056,7 @@ var ts; if (ts.isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } - else if (ts.isAsyncFunctionLike(node)) { + else if (ts.isAsyncFunction(node)) { return ts.createIdentifier("Promise"); } return ts.createVoidZero(); @@ -46525,21 +50085,26 @@ var ts; } switch (node.kind) { case 104 /* VoidKeyword */: + case 138 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 129 /* NeverKeyword */: return ts.createVoidZero(); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return serializeTypeNode(node.type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return ts.createIdentifier("Function"); - case 162 /* ArrayType */: - case 163 /* TupleType */: + case 163 /* ArrayType */: + case 164 /* TupleType */: return ts.createIdentifier("Array"); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: case 121 /* BooleanKeyword */: return ts.createIdentifier("Boolean"); - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: return ts.createIdentifier("String"); - case 171 /* LiteralType */: + case 133 /* ObjectKeyword */: + return ts.createIdentifier("Object"); + case 172 /* LiteralType */: switch (node.literal.kind) { case 9 /* StringLiteral */: return ts.createIdentifier("String"); @@ -46555,49 +50120,22 @@ var ts; break; case 132 /* NumberKeyword */: return ts.createIdentifier("Number"); - case 135 /* SymbolKeyword */: + case 136 /* SymbolKeyword */: return languageVersion < 2 /* ES2015 */ ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return serializeTypeReferenceNode(node); - case 165 /* IntersectionType */: - case 164 /* UnionType */: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - // Non identifier - if (serializedIndividual.kind !== 70 /* Identifier */) { - serializedUnion = undefined; - break; - } - // One of the individual is global object, return immediately - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - // Different types - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - // If we were able to find common type - if (serializedUnion) { - return serializedUnion; - } - } - // Fallthrough - case 160 /* TypeQuery */: - case 168 /* TypeOperator */: - case 169 /* IndexedAccessType */: - case 170 /* MappedType */: - case 161 /* TypeLiteral */: + case 166 /* IntersectionType */: + case 165 /* UnionType */: + return serializeUnionOrIntersectionType(node); + case 161 /* TypeQuery */: + case 169 /* TypeOperator */: + case 170 /* IndexedAccessType */: + case 171 /* MappedType */: + case 162 /* TypeLiteral */: case 118 /* AnyKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: break; default: ts.Debug.failBadSyntaxKind(node); @@ -46605,6 +50143,37 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + // If we dont have any other type already set, set the initial type + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + // One of the individual is global object, return immediately + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + // Different types + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + // Initialize the union type + serializedUnion = serializedIndividual; + } + } + // If we were able to find common type, use it + return serializedUnion; + } /** * Serializes a TypeReferenceNode to an appropriate JS constructor value for use with * decorator type metadata. @@ -46654,15 +50223,15 @@ var ts; case 70 /* Identifier */: // Create a clone of the name with a new parent, and treat it as if it were // a source tree node for the purposes of the checker. - var name_31 = ts.getMutableClone(node); - name_31.flags &= ~8 /* Synthesized */; - name_31.original = undefined; - name_31.parent = currentScope; + var name = ts.getMutableClone(node); + name.flags &= ~8 /* Synthesized */; + name.original = undefined; + name.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_31), ts.createLiteral("undefined")), name_31); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } - return name_31; - case 141 /* QualifiedName */: + return name; + case 142 /* QualifiedName */: return serializeQualifiedNameAsExpression(node, useFallback); } } @@ -46708,7 +50277,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeIdentifier(name.text)); } else { return ts.getSynthesizedClone(name); @@ -46730,7 +50299,7 @@ var ts; hoistVariableDeclaration(generatedName); expression = ts.createAssignment(generatedName, expression); } - return ts.setOriginalNode(ts.createComputedPropertyName(expression, /*location*/ name), name); + return ts.updateComputedPropertyName(name, expression); } else { return name; @@ -46748,7 +50317,7 @@ var ts; function visitHeritageClause(node) { if (node.token === 84 /* ExtendsKeyword */) { var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1); - return ts.createHeritageClause(84 /* ExtendsKeyword */, types, node); + return ts.setTextRange(ts.createHeritageClause(84 /* ExtendsKeyword */, types), node); } return undefined; } @@ -46761,9 +50330,8 @@ var ts; * @param node The ExpressionWithTypeArguments to transform. */ function visitExpressionWithTypeArguments(node) { - var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); - return ts.createExpressionWithTypeArguments( - /*typeArguments*/ undefined, expression, node); + return ts.updateExpressionWithTypeArguments(node, + /*typeArguments*/ undefined, ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); } /** * Determines whether to emit a function-like declaration. We should not emit the @@ -46778,7 +50346,7 @@ var ts; if (!shouldEmitFunctionLikeDeclaration(node)) { return undefined; } - return ts.visitEachChild(node, visitor, context); + return ts.updateConstructor(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), ts.visitNodes(node.modifiers, visitor, ts.isModifier), ts.visitParameterList(node.parameters, visitor, context), ts.visitFunctionBody(node.body, visitor, context)); } /** * Visits a method declaration of a class. @@ -46795,7 +50363,8 @@ var ts; return undefined; } var updated = ts.updateMethod(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), visitPropertyNameOfClassElement(node), + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, visitPropertyNameOfClassElement(node), + /*questionToken*/ undefined, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); if (updated !== node) { @@ -46877,7 +50446,7 @@ var ts; return ts.createNotEmittedStatement(node); } var updated = ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); if (isNamespaceExport(node)) { @@ -46896,12 +50465,12 @@ var ts; * @param node The function expression node. */ function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { + if (!shouldEmitFunctionLikeDeclaration(node)) { return ts.createOmittedExpression(); } - var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, + var updated = ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context)); + /*type*/ undefined, ts.visitFunctionBody(node.body, visitor, context) || ts.createBlock([])); return updated; } /** @@ -46933,11 +50502,11 @@ var ts; /*decorators*/ undefined, /*modifiers*/ undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), /*questionToken*/ undefined, - /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), - /*location*/ ts.moveRangePastModifiers(node)); + /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); // While we emit the source map for the node after skipping decorators and modifiers, // we need to emit the comments for the original range. ts.setOriginalNode(parameter, node); + ts.setTextRange(parameter, ts.moveRangePastModifiers(node)); ts.setCommentRange(parameter, node); ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */); @@ -46956,8 +50525,7 @@ var ts; // elide statement if there are no initialized variables. return undefined; } - return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), - /*location*/ node); + return ts.setTextRange(ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))), node); } else { return ts.visitEachChild(node, visitor, context); @@ -46970,7 +50538,7 @@ var ts; /*needsValue*/ false, createNamespaceExportExpression); } else { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression)), /*location*/ node); } } @@ -46996,13 +50564,13 @@ var ts; // code if the casted expression has a lower precedence than the rest of the // expression. // + // To preserve comments, we return a "PartiallyEmittedExpression" here which will + // preserve the position information of the original expression. + // // Due to the auto-parenthesization rules used by the visitor and factory functions // we can safely elide the parentheses here, as a new synthetic // ParenthesizedExpression will be inserted if we remove parentheses too // aggressively. - // - // To preserve comments, we return a "PartiallyEmittedExpression" here which will - // preserve the position information of the original expression. return ts.createPartiallyEmittedExpression(expression, node); } return ts.visitEachChild(node, visitor, context); @@ -47084,9 +50652,9 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], /*type*/ undefined, transformEnumBody(node, containerName)), - /*typeArguments*/ undefined, [moduleArg]), - /*location*/ node); + /*typeArguments*/ undefined, [moduleArg])); ts.setOriginalNode(enumStatement, node); + ts.setTextRange(enumStatement, node); ts.setEmitFlags(enumStatement, emitFlags); statements.push(enumStatement); // Add a DeclarationMarker for the enum to preserve trailing comments and mark @@ -47107,8 +50675,7 @@ var ts; ts.addRange(statements, ts.map(node.members, transformEnumMember)); ts.addRange(statements, endLexicalEnvironment()); currentNamespaceContainerName = savedCurrentNamespaceLocalName; - return ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), - /*location*/ undefined, + return ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ node.members), /*multiLine*/ true); } /** @@ -47121,9 +50688,7 @@ var ts; // we pass false as 'generateNameForComputedPropertyName' for a backward compatibility purposes // old emitter always generate 'expression' part of the name as-is. var name = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ false); - return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, - /*location*/ member), - /*location*/ member); + return ts.setTextRange(ts.createStatement(ts.setTextRange(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name), member)), member); } /** * Transforms the value of an enum member. @@ -47176,8 +50741,8 @@ var ts; if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = ts.createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } @@ -47187,9 +50752,9 @@ var ts; */ function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_32 = node.symbol && node.symbol.name; - if (name_32) { - return currentScopeFirstDeclarationsOfName[name_32] === node; + var name = node.symbol && node.symbol.name; + if (name) { + return currentScopeFirstDeclarationsOfName.get(name) === node; } } return false; @@ -47206,7 +50771,7 @@ var ts; recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 229 /* EnumDeclaration */) { + if (node.kind === 231 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -47298,9 +50863,9 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], /*type*/ undefined, transformModuleBody(node, containerName)), - /*typeArguments*/ undefined, [moduleArg]), - /*location*/ node); + /*typeArguments*/ undefined, [moduleArg])); ts.setOriginalNode(moduleStatement, node); + ts.setTextRange(moduleStatement, node); ts.setEmitFlags(moduleStatement, emitFlags); statements.push(moduleStatement); // Add a DeclarationMarker for the namespace to preserve trailing comments and mark @@ -47325,8 +50890,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231 /* ModuleBlock */) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 233 /* ModuleBlock */) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -47347,10 +50912,10 @@ var ts; currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; - var block = ts.createBlock(ts.createNodeArray(statements, + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ statementsLocation), - /*location*/ blockLocation, /*multiLine*/ true); + ts.setTextRange(block, blockLocation); // namespace hello.hi.world { // function foo() {} // @@ -47371,13 +50936,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (body.kind !== 231 /* ModuleBlock */) { + if (body.kind !== 233 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -47394,7 +50959,7 @@ var ts; return node; } // Elide the declaration if the import clause was elided. - var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, /*optional*/ true); + var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause); return importClause ? ts.updateImportDeclaration(node, /*decorators*/ undefined, @@ -47409,7 +50974,7 @@ var ts; function visitImportClause(node) { // Elide the import clause if we elide both its name and its named bindings. var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined; - var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, /*optional*/ true); + var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings); return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } /** @@ -47418,7 +50983,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 237 /* NamespaceImport */) { + if (node.kind === 239 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -47465,7 +51030,7 @@ var ts; return undefined; } // Elide the export declaration if all of its named exports are elided. - var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, /*optional*/ true); + var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports); return exportClause ? ts.updateExportDeclaration(node, /*decorators*/ undefined, @@ -47525,10 +51090,10 @@ var ts; if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { // export var ${name} = ${moduleReference}; // var ${name} = ${moduleReference}; - return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ + return ts.setOriginalNode(ts.setTextRange(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.setOriginalNode(ts.createVariableDeclaration(node.name, /*type*/ undefined, moduleReference), node) - ]), node), node); + ])), node), node); } else { // exports.${name} = ${moduleReference}; @@ -47573,7 +51138,7 @@ var ts; * Creates a statement for the provided expression. This is used in calls to `map`. */ function expressionToStatement(expression) { - return ts.createStatement(expression, /*location*/ undefined); + return ts.createStatement(expression); } function addExportMemberAssignment(statements, node) { var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), ts.getLocalName(node)); @@ -47583,10 +51148,10 @@ var ts; statements.push(statement); } function createNamespaceExport(exportName, exportValue, location) { - return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue), location); + return ts.setTextRange(ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue)), location); } function createNamespaceExportExpression(exportName, exportValue, location) { - return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location); + return ts.setTextRange(ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue), location); } function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { return ts.getNamespaceMemberName(currentNamespaceContainerName, name, /*allowComments*/ false, /*allowSourceMaps*/ true); @@ -47614,7 +51179,7 @@ var ts; function getClassAliasIfNeeded(node) { if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) { enableSubstitutionForClassAliases(); - var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default"); + var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.unescapeIdentifier(node.name.text) : "default"); classAliases[ts.getOriginalNodeId(node)] = classAlias; hoistVariableDeclaration(classAlias); return classAlias; @@ -47641,7 +51206,7 @@ var ts; // substitute class names inside of a class declaration. context.enableSubstitution(70 /* Identifier */); // Keep track of class aliases. - classAliases = ts.createMap(); + classAliases = []; } } function enableSubstitutionForNamespaceExports() { @@ -47650,44 +51215,49 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(70 /* Identifier */); - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); + context.enableSubstitution(261 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(230 /* ModuleDeclaration */); + context.enableEmitNotification(232 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 232 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 231 /* EnumDeclaration */; } /** * Hook for node emit. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emit A callback used to emit the node in the printer. */ - function onEmitNode(emitContext, node, emitCallback) { + function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; + var savedCurrentSourceFile = currentSourceFile; + if (ts.isSourceFile(node)) { + currentSourceFile = node; + } if (enabledSubstitutions & 2 /* NamespaceExports */ && isTransformedModuleDeclaration(node)) { applicableSubstitutions |= 2 /* NamespaceExports */; } if (enabledSubstitutions & 8 /* NonQualifiedEnumMembers */ && isTransformedEnumDeclaration(node)) { applicableSubstitutions |= 8 /* NonQualifiedEnumMembers */; } - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); applicableSubstitutions = savedApplicableSubstitutions; + currentSourceFile = savedCurrentSourceFile; } /** * Hooks node substitutions. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */) { return substituteExpression(node); } else if (ts.isShorthandPropertyAssignment(node)) { @@ -47697,16 +51267,16 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2 /* NamespaceExports */) { - var name_33 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_33); + var name = node.name; + var exportedName = trySubstituteNamespaceExportedName(name); if (exportedName) { // A shorthand property with an assignment initializer is probably part of a // destructuring assignment if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_33, initializer, /*location*/ node); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); } - return ts.createPropertyAssignment(name_33, exportedName, /*location*/ node); + return ts.setTextRange(ts.createPropertyAssignment(name, exportedName), node); } } return node; @@ -47715,9 +51285,9 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -47755,11 +51325,12 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 261 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 230 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 229 /* EnumDeclaration */); + if (container && container.kind !== 264 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 232 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 231 /* EnumDeclaration */); if (substitute) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node); + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), + /*location*/ node); } } } @@ -47774,16 +51345,15 @@ var ts; function substituteConstantValue(node) { var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { + // track the constant value on the node for the printer in needsDotDotForPropertyAccess + ts.setConstantValue(node, constantValue); var substitute = ts.createLiteral(constantValue); - ts.setSourceMapRange(substitute, node); - ts.setCommentRange(substitute, node); if (!compilerOptions.removeComments) { var propertyName = ts.isPropertyAccessExpression(node) ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - substitute.trailingComment = " " + propertyName + " "; + ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + propertyName + " "); } - ts.setConstantValue(node, constantValue); return substitute; } return node; @@ -47798,19 +51368,33 @@ var ts; } } ts.transformTypeScript = transformTypeScript; - var paramHelper = { - name: "typescript:param", + function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { + var argumentsArray = []; + argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*multiLine*/ true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + context.requestEmitHelper(decorateHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__decorate"), + /*typeArguments*/ undefined, argumentsArray), location); + } + var decorateHelper = { + name: "typescript:decorate", scoped: false, - priority: 4, - text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" + priority: 2, + text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" }; - function createParamHelper(context, expression, parameterOffset, location) { - context.requestEmitHelper(paramHelper); - return ts.createCall(ts.getHelperName("__param"), + function createMetadataHelper(context, metadataKey, metadataValue) { + context.requestEmitHelper(metadataHelper); + return ts.createCall(ts.getHelperName("__metadata"), /*typeArguments*/ undefined, [ - ts.createLiteral(parameterOffset), - expression - ], location); + ts.createLiteral(metadataKey), + metadataValue + ]); } var metadataHelper = { name: "typescript:metadata", @@ -47818,41 +51402,391 @@ var ts; priority: 3, text: "\n var __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };" }; - function createMetadataHelper(context, metadataKey, metadataValue) { - context.requestEmitHelper(metadataHelper); - return ts.createCall(ts.getHelperName("__metadata"), + function createParamHelper(context, expression, parameterOffset, location) { + context.requestEmitHelper(paramHelper); + return ts.setTextRange(ts.createCall(ts.getHelperName("__param"), /*typeArguments*/ undefined, [ - ts.createLiteral(metadataKey), - metadataValue - ]); + ts.createLiteral(parameterOffset), + expression + ]), location); } - var decorateHelper = { - name: "typescript:decorate", + var paramHelper = { + name: "typescript:param", scoped: false, - priority: 2, - text: "\n var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };" + priority: 4, + text: "\n var __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };" }; - function createDecorateHelper(context, decoratorExpressions, target, memberName, descriptor, location) { - context.requestEmitHelper(decorateHelper); - var argumentsArray = []; - argumentsArray.push(ts.createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); +})(ts || (ts = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + var ES2017SubstitutionFlags; + (function (ES2017SubstitutionFlags) { + /** Enables substitutions for async methods with `super` calls. */ + ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); + function transformES2017(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + // These variables contain state that changes as we descend into the tree. + var currentSourceFile; + /** + * Keeps track of whether expression substitution has been enabled for specific edge cases. + * They are persisted between each SourceFile transformation and should not be reset. + */ + var enabledSubstitutions; + /** + * This keeps track of containers where `super` is valid, for use with + * just-in-time substitution for `super` expressions inside of async methods. + */ + var enclosingSuperContainerFlags = 0; + // Save the previous transformation hooks. + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + // Set new transformation hooks. + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; + } + function visitor(node) { + if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) { + return node; + } + switch (node.kind) { + case 119 /* AsyncKeyword */: + // ES2017 async modifier should be elided for targets < ES2017 + return undefined; + case 190 /* AwaitExpression */: + return visitAwaitExpression(node); + case 150 /* MethodDeclaration */: + return visitMethodDeclaration(node); + case 227 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 185 /* FunctionExpression */: + return visitFunctionExpression(node); + case 186 /* ArrowFunction */: + return visitArrowFunction(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + /** + * Visits an AwaitExpression node. + * + * This function will be called any time a ES2017 await expression is encountered. + * + * @param node The node to visit. + */ + function visitAwaitExpression(node) { + return ts.setOriginalNode(ts.setTextRange(ts.createYield( + /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); + } + /** + * Visits a MethodDeclaration node. + * + * This function will be called when one of the following conditions are met: + * - The node is marked as async + * + * @param node The node to visit. + */ + function visitMethodDeclaration(node) { + return ts.updateMethod(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, + /*questionToken*/ undefined, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + /** + * Visits a FunctionDeclaration node. + * + * This function will be called when one of the following conditions are met: + * - The node is marked async + * + * @param node The node to visit. + */ + function visitFunctionDeclaration(node) { + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + /** + * Visits a FunctionExpression node. + * + * This function will be called when one of the following conditions are met: + * - The node is marked async + * + * @param node The node to visit. + */ + function visitFunctionExpression(node) { + return ts.updateFunctionExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + /** + * Visits an ArrowFunction. + * + * This function will be called when one of the following conditions are met: + * - The node is marked async + * + * @param node The node to visit. + */ + function visitArrowFunction(node) { + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* Async */ + ? transformAsyncFunctionBody(node) + : ts.visitFunctionBody(node.body, visitor, context)); + } + function transformAsyncFunctionBody(node) { + resumeLexicalEnvironment(); + var original = ts.getOriginalNode(node, ts.isFunctionLike); + var nodeType = original.type; + var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; + var isArrowFunction = node.kind === 186 /* ArrowFunction */; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; + // An async function is emit as an outer function that calls an inner + // generator function. To preserve lexical bindings, we pass the current + // `this` and `arguments` objects to `__awaiter`. The generator function + // passed to `__awaiter` is executed inside of the callback to the + // promise constructor. + if (!isArrowFunction) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); + statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.createBlock(statements, /*multiLine*/ true); + ts.setTextRange(block, node.body); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + if (languageVersion >= 2 /* ES2015 */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; + } + else { + var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); + var declarations = endLexicalEnvironment(); + if (ts.some(declarations)) { + var block = ts.convertToFunctionBody(expression); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(ts.concatenate(block.statements, declarations)), block.statements)); + } + return expression; + } + } + function transformFunctionBodyWorker(body, start) { + if (ts.isBlock(body)) { + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); + } + else { + startLexicalEnvironment(); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); + var declarations = endLexicalEnvironment(); + return ts.updateBlock(visited, ts.setTextRange(ts.createNodeArray(ts.concatenate(visited.statements, declarations)), visited.statements)); + } + } + function getPromiseConstructor(type) { + var typeName = type && ts.getEntityNameFromTypeNode(type); + if (typeName && ts.isEntityName(typeName)) { + var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { + return typeName; + } + } + return undefined; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { + enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; + // We need to enable substitutions for call, property access, and element access + // if we need to rewrite super calls. + context.enableSubstitution(180 /* CallExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); + // We need to be notified when entering and exiting declarations that bind super. + context.enableEmitNotification(228 /* ClassDeclaration */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(151 /* Constructor */); + } + } + /** + * Hook for node emit. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(hint, node, emitCallback) { + // If we need to support substitutions for `super` in an async method, + // we should track it here. + if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + /** + * Hooks node substitutions. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */ && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178 /* PropertyAccessExpression */: + return substitutePropertyAccessExpression(node); + case 179 /* ElementAccessExpression */: + return substituteElementAccessExpression(node); + case 180 /* CallExpression */: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), + /*typeArguments*/ undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 /* ClassDeclaration */ + || kind === 151 /* Constructor */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), location); } } - return ts.createCall(ts.getHelperName("__decorate"), /*typeArguments*/ undefined, argumentsArray, location); } + ts.transformES2017 = transformES2017; + var awaiterHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };" + }; + function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { + context.requestEmitHelper(awaiterHelper); + var generatorFunc = ts.createFunctionExpression( + /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, body); + // Mark this node as originally an async function + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; + return ts.createCall(ts.getHelperName("__awaiter"), + /*typeArguments*/ undefined, [ + ts.createThis(), + hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), + promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), + generatorFunc + ]); + } + ts.asyncSuperHelper = { + name: "typescript:async-super", + scoped: true, + text: "\n const _super = name => super[name];\n " + }; + ts.advancedAsyncSuperHelper = { + name: "typescript:advanced-async-super", + scoped: true, + text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);\n " + }; })(ts || (ts = {})); /// /// +/// /*@internal*/ var ts; (function (ts) { + var ESNextSubstitutionFlags; + (function (ESNextSubstitutionFlags) { + /** Enables substitutions for async methods with `super` calls. */ + ESNextSubstitutionFlags[ESNextSubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; + })(ESNextSubstitutionFlags || (ESNextSubstitutionFlags = {})); function transformESNext(context) { - var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var resolver = context.getEmitResolver(); + var compilerOptions = context.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var enabledSubstitutions; + var enclosingFunctionFlags; + var enclosingSuperContainerFlags = 0; return transformSourceFile; function transformSourceFile(node) { if (ts.isDeclarationFile(node)) { @@ -47868,53 +51802,95 @@ var ts; function visitorNoDestructuringValue(node) { return visitorWorker(node, /*noDestructuringValue*/ true); } + function visitorNoAsyncModifier(node) { + if (node.kind === 119 /* AsyncKeyword */) { + return undefined; + } + return node; + } function visitorWorker(node, noDestructuringValue) { if ((node.transformFlags & 8 /* ContainsESNext */) === 0) { return node; } switch (node.kind) { - case 176 /* ObjectLiteralExpression */: + case 190 /* AwaitExpression */: + return visitAwaitExpression(node); + case 196 /* YieldExpression */: + return visitYieldExpression(node); + case 221 /* LabeledStatement */: + return visitLabeledStatement(node); + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 211 /* ForStatement */: + case 215 /* ForOfStatement */: + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); + case 213 /* ForStatement */: return visitForStatement(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return visitVoidExpression(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return visitConstructorDeclaration(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 151 /* GetAccessor */: + case 152 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 152 /* SetAccessor */: + case 153 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); default: return ts.visitEachChild(node, visitor, context); } } + function visitAwaitExpression(node) { + if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.setOriginalNode(ts.setTextRange(ts.createYield( + /*asteriskToken*/ undefined, ts.createArrayLiteral([ts.createLiteral("await"), expression])), + /*location*/ node), node); + } + return ts.visitEachChild(node, visitor, context); + } + function visitYieldExpression(node) { + if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.updateYield(node, node.asteriskToken, node.asteriskToken + ? createAsyncDelegatorHelper(context, expression, expression) + : ts.createArrayLiteral(expression + ? [ts.createLiteral("yield"), expression] + : [ts.createLiteral("yield")])); + } + return ts.visitEachChild(node, visitor, context); + } + function visitLabeledStatement(node) { + if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) { + var statement = ts.unwrapInnermostStatementOfLabel(node); + if (statement.kind === 215 /* ForOfStatement */ && statement.awaitModifier) { + return visitForOfStatement(statement, node); + } + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), node); + } + return ts.visitEachChild(node, visitor, context); + } function chunkObjectLiteralElements(elements) { var chunkObject; var objects = []; - for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { - var e = elements_3[_i]; - if (e.kind === 259 /* SpreadAssignment */) { + for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { + var e = elements_4[_i]; + if (e.kind === 262 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -47926,7 +51902,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257 /* PropertyAssignment */) { + if (e.kind === 260 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -47948,7 +51924,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 176 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 177 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -47998,41 +51974,101 @@ var ts; * * @param node A ForOfStatement. */ - function visitForOfStatement(node) { - var leadingStatements; - var temp; - var initializer = ts.skipParentheses(node.initializer); - if (initializer.transformFlags & 1048576 /* ContainsObjectRest */) { - if (ts.isVariableDeclarationList(initializer)) { - temp = ts.createTempVariable(/*recordTempVariable*/ undefined); - var firstDeclaration = ts.firstOrUndefined(initializer.declarations); - var declarations = ts.flattenDestructuringBinding(firstDeclaration, visitor, context, 1 /* ObjectRest */, temp, - /*doNotRecordTempVariablesInLine*/ false, - /*skipInitializer*/ true); - if (ts.some(declarations)) { - var statement = ts.createVariableStatement( - /*modifiers*/ undefined, ts.updateVariableDeclarationList(initializer, declarations), - /*location*/ initializer); - leadingStatements = ts.append(leadingStatements, statement); - } - } - else if (ts.isAssignmentPattern(initializer)) { - temp = ts.createTempVariable(/*recordTempVariable*/ undefined); - var expression = ts.flattenDestructuringAssignment(ts.aggregateTransformFlags(ts.createAssignment(initializer, temp, /*location*/ node.initializer)), visitor, context, 1 /* ObjectRest */); - leadingStatements = ts.append(leadingStatements, ts.createStatement(expression, /*location*/ node.initializer)); - } + function visitForOfStatement(node, outermostLabeledStatement) { + if (node.initializer.transformFlags & 1048576 /* ContainsObjectRest */) { + node = transformForOfStatementWithObjectRest(node); } - if (temp) { - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); - var block = ts.isBlock(statement) - ? ts.updateBlock(statement, ts.createNodeArray(ts.concatenate(leadingStatements, statement.statements), statement.statements)) - : ts.createBlock(ts.append(leadingStatements, statement), statement, /*multiLine*/ true); - return ts.updateForOf(node, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(temp, /*type*/ undefined, /*initializer*/ undefined, node.initializer) - ], node.initializer, 1 /* Let */), expression, block); + if (node.awaitModifier) { + return transformForAwaitOfStatement(node, outermostLabeledStatement); } - return ts.visitEachChild(node, visitor, context); + else { + return ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement); + } + } + function transformForOfStatementWithObjectRest(node) { + var initializerWithoutParens = ts.skipParentheses(node.initializer); + if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) { + var bodyLocation = void 0; + var statementsLocation = void 0; + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var statements = [ts.createForOfBindingStatement(initializerWithoutParens, temp)]; + if (ts.isBlock(node.statement)) { + ts.addRange(statements, node.statement.statements); + bodyLocation = node.statement; + statementsLocation = node.statement.statements; + } + return ts.updateForOf(node, node.awaitModifier, ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(temp), node.initializer) + ], 1 /* Let */), node.initializer), node.expression, ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), + /*multiLine*/ true), bodyLocation)); + } + return node; + } + function convertForOfStatementHead(node, boundValue) { + var binding = ts.createForOfBindingStatement(node.initializer, boundValue); + var bodyLocation; + var statementsLocation; + var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; + var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + if (ts.isBlock(statement)) { + ts.addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), + /*multiLine*/ true), bodyLocation), 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); + } + function transformForAwaitOfStatement(node, outermostLabeledStatement) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(/*recordTempVariable*/ undefined); + var values = createAsyncValuesHelper(context, expression, /*location*/ node.expression); + var next = ts.createYield( + /*asteriskToken*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []) + ]) + : ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, [])); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor( + /*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + ts.createVariableDeclaration(result, /*type*/ undefined, next) + ]), node.expression), 1048576 /* NoHoisting */), + /*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")), + /*incrementor*/ ts.createAssignment(result, next), + /*statement*/ convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"))), + /*location*/ node), 256 /* NoTokenTrailingSourceMaps */); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1 /* SingleLine */)), ts.createBlock([ + ts.createTry( + /*tryBlock*/ ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createYield( + /*asteriskToken*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.createArrayLiteral([ + ts.createLiteral("await"), + ts.createFunctionCall(returnMethod, iterator, []) + ]) + : ts.createFunctionCall(returnMethod, iterator, [])))), 1 /* SingleLine */) + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1 /* SingleLine */) + ]), 1 /* SingleLine */)) + ])); } function visitParameter(node) { if (node.transformFlags & 1048576 /* ContainsObjectRest */) { @@ -48041,48 +52077,137 @@ var ts; return ts.updateParameter(node, /*decorators*/ undefined, /*modifiers*/ undefined, node.dotDotDotToken, ts.getGeneratedNameForNode(node), + /*questionToken*/ undefined, /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); } return ts.visitEachChild(node, visitor, context); } function visitConstructorDeclaration(node) { - return ts.updateConstructor(node, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0 /* Normal */; + var updated = ts.updateConstructor(node, /*decorators*/ undefined, node.modifiers, ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitGetAccessorDeclaration(node) { - return ts.updateGetAccessor(node, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0 /* Normal */; + var updated = ts.updateGetAccessor(node, /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitSetAccessorDeclaration(node) { - return ts.updateSetAccessor(node, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = 0 /* Normal */; + var updated = ts.updateSetAccessor(node, /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitParameterList(node.parameters, visitor, context), transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitMethodDeclaration(node) { - return ts.updateMethod(node, - /*decorators*/ undefined, node.modifiers, ts.visitNode(node.name, visitor, ts.isPropertyName), + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateMethod(node, + /*decorators*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 /* Async */ + ? undefined + : node.asteriskToken, ts.visitNode(node.name, visitor, ts.isPropertyName), ts.visitNode(/*questionToken*/ undefined, visitor, ts.isToken), /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node)); + /*type*/ undefined, enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, node.modifiers, node.name, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, enclosingFunctionFlags & 1 /* Generator */ + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 /* Async */ + ? undefined + : node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node)); + /*type*/ undefined, enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitArrowFunction(node) { - return ts.updateArrowFunction(node, node.modifiers, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateArrowFunction(node, node.modifiers, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, node.modifiers, node.name, + var savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = ts.getFunctionFlags(node); + var updated = ts.updateFunctionExpression(node, enclosingFunctionFlags & 1 /* Generator */ + ? ts.visitNodes(node.modifiers, visitorNoAsyncModifier, ts.isModifier) + : node.modifiers, enclosingFunctionFlags & 2 /* Async */ + ? undefined + : node.asteriskToken, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node)); + /*type*/ undefined, enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node)); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + function transformAsyncGeneratorFunctionBody(node) { + resumeLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); + appendObjectRestAssignmentsIfNeeded(statements, node); + statements.push(ts.createReturn(createAsyncGeneratorHelper(context, ts.createFunctionExpression( + /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), node.name && ts.getGeneratedNameForNode(node.name), + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, ts.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)))))); + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.updateBlock(node.body, statements); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + if (languageVersion >= 2 /* ES2015 */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, ts.asyncSuperHelper); + } + } + return block; } function transformFunctionBody(node) { resumeLexicalEnvironment(); - var leadingStatements; + var statementOffset = 0; + var statements = []; + var body = ts.visitNode(node.body, visitor, ts.isConciseBody); + if (ts.isBlock(body)) { + statementOffset = ts.addPrologue(statements, body.statements, /*ensureUseStrict*/ false, visitor); + } + ts.addRange(statements, appendObjectRestAssignmentsIfNeeded(/*statements*/ undefined, node)); + var trailingStatements = endLexicalEnvironment(); + if (statementOffset > 0 || ts.some(statements) || ts.some(trailingStatements)) { + var block = ts.convertToFunctionBody(body, /*multiLine*/ true); + ts.addRange(statements, block.statements.slice(statementOffset)); + ts.addRange(statements, trailingStatements); + return ts.updateBlock(block, ts.setTextRange(ts.createNodeArray(statements), block.statements)); + } + return body; + } + function appendObjectRestAssignmentsIfNeeded(statements, node) { for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; if (parameter.transformFlags & 1048576 /* ContainsObjectRest */) { @@ -48094,17 +52219,116 @@ var ts; var statement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList(declarations)); ts.setEmitFlags(statement, 524288 /* CustomPrologue */); - leadingStatements = ts.append(leadingStatements, statement); + statements = ts.append(statements, statement); } } } - var body = ts.visitNode(node.body, visitor, ts.isConciseBody); - var trailingStatements = endLexicalEnvironment(); - if (ts.some(leadingStatements) || ts.some(trailingStatements)) { - var block = ts.convertToFunctionBody(body, /*multiLine*/ true); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(ts.concatenate(leadingStatements, block.statements), trailingStatements), block.statements)); + return statements; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { + enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; + // We need to enable substitutions for call, property access, and element access + // if we need to rewrite super calls. + context.enableSubstitution(180 /* CallExpression */); + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(179 /* ElementAccessExpression */); + // We need to be notified when entering and exiting declarations that bind super. + context.enableEmitNotification(228 /* ClassDeclaration */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(151 /* Constructor */); + } + } + /** + * Called by the printer just before a node is printed. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to be printed. + * @param emitCallback The callback used to emit the node. + */ + function onEmitNode(hint, node, emitCallback) { + // If we need to support substitutions for `super` in an async method, + // we should track it here. + if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */); + if (superContainerFlags !== enclosingSuperContainerFlags) { + var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + /** + * Hooks node substitutions. + * + * @param hint The context for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */ && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 178 /* PropertyAccessExpression */: + return substitutePropertyAccessExpression(node); + case 179 /* ElementAccessExpression */: + return substituteElementAccessExpression(node); + case 180 /* CallExpression */: + return substituteCallExpression(node); + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + } + return node; + } + function substituteElementAccessExpression(node) { + if (node.expression.kind === 96 /* SuperKeyword */) { + return createSuperAccessInAsyncMethod(node.argumentExpression, node); + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), + /*typeArguments*/ undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 228 /* ClassDeclaration */ + || kind === 151 /* Constructor */ + || kind === 150 /* MethodDeclaration */ + || kind === 152 /* GetAccessor */ + || kind === 153 /* SetAccessor */; + } + function createSuperAccessInAsyncMethod(argumentExpression, location) { + if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { + return ts.setTextRange(ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), "value"), location); + } + else { + return ts.setTextRange(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), location); } - return body; } } ts.transformESNext = transformESNext; @@ -48115,11 +52339,51 @@ var ts; text: "\n var __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };" }; function createAssignHelper(context, attributesSegments) { + if (context.getCompilerOptions().target >= 2 /* ES2015 */) { + return ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "assign"), + /*typeArguments*/ undefined, attributesSegments); + } context.requestEmitHelper(assignHelper); return ts.createCall(ts.getHelperName("__assign"), /*typeArguments*/ undefined, attributesSegments); } ts.createAssignHelper = createAssignHelper; + var asyncGeneratorHelper = { + name: "typescript:asyncGenerator", + scoped: false, + text: "\n var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), q = [], c, i;\n return i = { next: verb(\"next\"), \"throw\": verb(\"throw\"), \"return\": verb(\"return\") }, i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }\n function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }\n function step(r) { r.done ? settle(c[2], r) : Promise.resolve(r.value[1]).then(r.value[0] === \"yield\" ? _yield : r.value[0] === \"delegate\" ? delegate : fulfill, reject); }\n function _yield(value) { settle(c[2], { value: value, done: false }); }\n function delegate(r) { step(r.done ? r : { value: [\"yield\", r.value], done: false }); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { c = void 0, f(v), next(); }\n };\n " + }; + function createAsyncGeneratorHelper(context, generatorFunc) { + context.requestEmitHelper(asyncGeneratorHelper); + // Mark this node as originally an async function + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; + return ts.createCall(ts.getHelperName("__asyncGenerator"), + /*typeArguments*/ undefined, [ + ts.createThis(), + ts.createIdentifier("arguments"), + generatorFunc + ]); + } + var asyncDelegator = { + name: "typescript:asyncDelegator", + scoped: false, + text: "\n var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i = { next: verb(\"next\"), \"throw\": verb(\"throw\", function (e) { throw e; }), \"return\": verb(\"return\", function (v) { return { value: v, done: true }; }) };\n return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { return function (v) { return { value: [\"delegate\", (o[n] || f).call(o, v)], done: false }; }; }\n };\n " + }; + function createAsyncDelegatorHelper(context, expression, location) { + context.requestEmitHelper(asyncDelegator); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncDelegator"), + /*typeArguments*/ undefined, [expression]), location); + } + var asyncValues = { + name: "typescript:asyncValues", + scoped: false, + text: "\n var __asyncValues = (this && this.__asyncIterator) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator];\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\n };\n " + }; + function createAsyncValuesHelper(context, expression, location) { + context.requestEmitHelper(asyncValues); + return ts.setTextRange(ts.createCall(ts.getHelperName("__asyncValues"), + /*typeArguments*/ undefined, [expression]), location); + } })(ts || (ts = {})); /// /// @@ -48129,7 +52393,6 @@ var ts; (function (ts) { function transformJsx(context) { var compilerOptions = context.getCompilerOptions(); - var currentSourceFile; return transformSourceFile; /** * Transform JSX-specific syntax in a SourceFile. @@ -48140,10 +52403,8 @@ var ts; if (ts.isDeclarationFile(node)) { return node; } - currentSourceFile = node; var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; return visited; } function visitor(node) { @@ -48156,11 +52417,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -48170,11 +52431,11 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return visitJsxExpression(node); - case 246 /* JsxElement */: + case 248 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); @@ -48190,7 +52451,7 @@ var ts; function visitJsxOpeningLikeElement(node, children, isChild, location) { var tagName = getTagName(node); var objectProperties; - var attrs = node.attributes; + var attrs = node.attributes.properties; if (attrs.length === 0) { // When there are no attributes, React wants "null" objectProperties = ts.createNull(); @@ -48229,13 +52490,16 @@ var ts; } function transformJsxAttributeInitializer(node) { if (node === undefined) { - return ts.createLiteral(true); + return ts.createTrue(); } else if (node.kind === 9 /* StringLiteral */) { var decoded = tryDecodeEntities(node.text); - return decoded ? ts.createLiteral(decoded, /*location*/ node) : node; + return decoded ? ts.setTextRange(ts.createLiteral(decoded), node) : node; } - else if (node.kind === 252 /* JsxExpression */) { + else if (node.kind === 255 /* JsxExpression */) { + if (node.expression === undefined) { + return ts.createTrue(); + } return visitJsxExpression(node); } else { @@ -48243,54 +52507,61 @@ var ts; } } function visitJsxText(node) { - var text = ts.getTextOfNode(node, /*includeTrivia*/ true); - var parts; + var fixed = fixupWhitespaceAndDecodeEntities(ts.getTextOfNode(node, /*includeTrivia*/ true)); + return fixed === undefined ? undefined : ts.createLiteral(fixed); + } + /** + * JSX trims whitespace at the end and beginning of lines, except that the + * start/end of a tag is considered a start/end of a line only if that line is + * on the same line as the closing tag. See examples in + * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model + * + * An equivalent algorithm would be: + * - If there is only one line, return it. + * - If there is only whitespace (but multiple lines), return `undefined`. + * - Split the text into lines. + * - 'trimRight' the first line, 'trimLeft' the last line, 'trim' middle lines. + * - Decode entities on each line (individually). + * - Remove empty lines and join the rest with " ". + */ + function fixupWhitespaceAndDecodeEntities(text) { + var acc; + // First non-whitespace character on this line. var firstNonWhitespace = 0; + // Last non-whitespace character on this line. var lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in - // tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + // These initial values are special because the first line is: + // firstNonWhitespace = 0 to indicate that we want leading whitsepace, + // but lastNonWhitespace = -1 as a special flag to indicate that we *don't* include the line if it's all whitespace. for (var i = 0; i < text.length; i++) { var c = text.charCodeAt(i); if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); + // If we've seen any non-whitespace characters on this line, add the 'trim' of the line. + // (lastNonWhitespace === -1 is a special flag to detect whether the first line is all whitespace.) + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } + // Reset firstNonWhitespace for the next line. + // Don't bother to reset lastNonWhitespace because we ignore it if firstNonWhitespace = -1. firstNonWhitespace = -1; } - else if (!ts.isWhiteSpace(c)) { + else if (!ts.isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; } } } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(ts.createLiteral(decodeEntities(part))); - } - if (parts) { - return ts.reduceLeft(parts, aggregateJsxTextParts); - } - return undefined; + return firstNonWhitespace !== -1 + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + : acc; } - /** - * Aggregates two expressions by interpolating them with a whitespace literal. - */ - function aggregateJsxTextParts(left, right) { - return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + function addLineOfJsxText(acc, trimmedLine) { + // We do not escape the string here as that is handled by the printer + // when it emits the literal. We do, however, need to decode JSX entities. + var decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } /** * Replace entities like " ", "{", and "�" with the characters they encode. @@ -48305,7 +52576,7 @@ var ts; return String.fromCharCode(parseInt(hex, 16)); } else { - var ch = entities[word]; + var ch = entities.get(word); // If this is not a valid entity, then just use `match` (replace it with itself, i.e. don't replace) return ch ? String.fromCharCode(ch) : match; } @@ -48317,16 +52588,16 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246 /* JsxElement */) { + if (node.kind === 248 /* JsxElement */) { return getTagName(node.openingElement); } else { - var name_34 = node.tagName; - if (ts.isIdentifier(name_34) && ts.isIntrinsicJsxName(name_34.text)) { - return ts.createLiteral(name_34.text); + var name = node.tagName; + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { + return ts.createLiteral(name.text); } else { - return ts.createExpressionFromEntityName(name_34); + return ts.createExpressionFromEntityName(name); } } } @@ -48349,7 +52620,7 @@ var ts; } } ts.transformJsx = transformJsx; - var entities = ts.createMap({ + var entities = ts.createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, @@ -48609,375 +52880,6 @@ var ts; /// /*@internal*/ var ts; -(function (ts) { - var ES2017SubstitutionFlags; - (function (ES2017SubstitutionFlags) { - /** Enables substitutions for async methods with `super` calls. */ - ES2017SubstitutionFlags[ES2017SubstitutionFlags["AsyncMethodsWithSuper"] = 1] = "AsyncMethodsWithSuper"; - })(ES2017SubstitutionFlags || (ES2017SubstitutionFlags = {})); - function transformES2017(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; - var resolver = context.getEmitResolver(); - var compilerOptions = context.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - // These variables contain state that changes as we descend into the tree. - var currentSourceFile; - /** - * Keeps track of whether expression substitution has been enabled for specific edge cases. - * They are persisted between each SourceFile transformation and should not be reset. - */ - var enabledSubstitutions; - /** - * This keeps track of containers where `super` is valid, for use with - * just-in-time substitution for `super` expressions inside of async methods. - */ - var currentSuperContainer; - // Save the previous transformation hooks. - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - // Set new transformation hooks. - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; - } - currentSourceFile = node; - var visited = ts.visitEachChild(node, visitor, context); - ts.addEmitHelpers(visited, context.readEmitHelpers()); - currentSourceFile = undefined; - return visited; - } - function visitor(node) { - if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) { - return node; - } - switch (node.kind) { - case 119 /* AsyncKeyword */: - // ES2017 async modifier should be elided for targets < ES2017 - return undefined; - case 189 /* AwaitExpression */: - // ES2017 'await' expressions must be transformed for targets < ES2017. - return visitAwaitExpression(node); - case 149 /* MethodDeclaration */: - // ES2017 method declarations may be 'async' - return visitMethodDeclaration(node); - case 225 /* FunctionDeclaration */: - // ES2017 function declarations may be 'async' - return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: - // ES2017 function expressions may be 'async' - return visitFunctionExpression(node); - case 185 /* ArrowFunction */: - // ES2017 arrow functions may be 'async' - return visitArrowFunction(node); - default: - return ts.visitEachChild(node, visitor, context); - } - } - /** - * Visits an AwaitExpression node. - * - * This function will be called any time a ES2017 await expression is encountered. - * - * @param node The node to visit. - */ - function visitAwaitExpression(node) { - return ts.setOriginalNode(ts.createYield( - /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression), - /*location*/ node), node); - } - /** - * Visits a MethodDeclaration node. - * - * This function will be called when one of the following conditions are met: - * - The node is marked as async - * - * @param node The node to visit. - */ - function visitMethodDeclaration(node) { - return ts.updateMethod(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - /** - * Visits a FunctionDeclaration node. - * - * This function will be called when one of the following conditions are met: - * - The node is marked async - * - * @param node The node to visit. - */ - function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - /** - * Visits a FunctionExpression node. - * - * This function will be called when one of the following conditions are met: - * - The node is marked async - * - * @param node The node to visit. - */ - function visitFunctionExpression(node) { - if (ts.nodeIsMissing(node.body)) { - return ts.createOmittedExpression(); - } - return ts.updateFunctionExpression(node, - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - /** - * Visits an ArrowFunction. - * - * This function will be called when one of the following conditions are met: - * - The node is marked async - * - * @param node The node to visit. - */ - function visitArrowFunction(node) { - return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, ts.isAsyncFunctionLike(node) - ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); - } - function transformAsyncFunctionBody(node) { - resumeLexicalEnvironment(); - var original = ts.getOriginalNode(node, ts.isFunctionLike); - var nodeType = original.type; - var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 185 /* ArrowFunction */; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; - // An async function is emit as an outer function that calls an inner - // generator function. To preserve lexical bindings, we pass the current - // `this` and `arguments` objects to `__awaiter`. The generator function - // passed to `__awaiter` is executed inside of the callback to the - // promise constructor. - if (!isArrowFunction) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); - statements.push(ts.createReturn(createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body, statementOffset)))); - ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(statements, /*location*/ node.body, /*multiLine*/ true); - // Minor optimization, emit `_super` helper to capture `super` access in an arrow. - // This step isn't needed if we eventually transform this to ES5. - if (languageVersion >= 2 /* ES2015 */) { - if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, advancedAsyncSuperHelper); - } - else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { - enableSubstitutionForAsyncMethodsWithSuper(); - ts.addEmitHelper(block, asyncSuperHelper); - } - } - return block; - } - else { - var expression = createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, transformFunctionBodyWorker(node.body)); - var declarations = endLexicalEnvironment(); - if (ts.some(declarations)) { - var block = ts.convertToFunctionBody(expression); - return ts.updateBlock(block, ts.createNodeArray(ts.concatenate(block.statements, declarations), block.statements)); - } - return expression; - } - } - function transformFunctionBodyWorker(body, start) { - if (ts.isBlock(body)) { - return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); - } - else { - startLexicalEnvironment(); - var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); - var declarations = endLexicalEnvironment(); - return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); - } - } - function getPromiseConstructor(type) { - var typeName = type && ts.getEntityNameFromTypeNode(type); - if (typeName && ts.isEntityName(typeName)) { - var serializationKind = resolver.getTypeReferenceSerializationKind(typeName); - if (serializationKind === ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue - || serializationKind === ts.TypeReferenceSerializationKind.Unknown) { - return typeName; - } - } - return undefined; - } - function enableSubstitutionForAsyncMethodsWithSuper() { - if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { - enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; - // We need to enable substitutions for call, property access, and element access - // if we need to rewrite super calls. - context.enableSubstitution(179 /* CallExpression */); - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(178 /* ElementAccessExpression */); - // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(226 /* ClassDeclaration */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(150 /* Constructor */); - } - } - function substituteExpression(node) { - switch (node.kind) { - case 177 /* PropertyAccessExpression */: - return substitutePropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: - return substituteElementAccessExpression(node); - case 179 /* CallExpression */: - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) { - return substituteCallExpression(node); - } - break; - } - return node; - } - function substitutePropertyAccessExpression(node) { - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node); - } - } - return node; - } - function substituteElementAccessExpression(node) { - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node); - } - } - return node; - } - function substituteCallExpression(node) { - var expression = node.expression; - if (ts.isSuperProperty(expression)) { - var flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - var argumentExpression = ts.isPropertyAccessExpression(expression) - ? substitutePropertyAccessExpression(expression) - : substituteElementAccessExpression(expression); - return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), - /*typeArguments*/ undefined, [ - ts.createThis() - ].concat(node.arguments)); - } - } - return node; - } - function isSuperContainer(node) { - var kind = node.kind; - return kind === 226 /* ClassDeclaration */ - || kind === 150 /* Constructor */ - || kind === 149 /* MethodDeclaration */ - || kind === 151 /* GetAccessor */ - || kind === 152 /* SetAccessor */; - } - /** - * Hook for node emit. - * - * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. - */ - function onEmitNode(emitContext, node, emitCallback) { - // If we need to support substitutions for `super` in an async method, - // we should track it here. - if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var savedCurrentSuperContainer = currentSuperContainer; - currentSuperContainer = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSuperContainer = savedCurrentSuperContainer; - } - else { - previousOnEmitNode(emitContext, node, emitCallback); - } - } - /** - * Hooks node substitutions. - * - * @param node The node to substitute. - * @param isExpression A value indicating whether the node is to be used in an expression - * position. - */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { - return substituteExpression(node); - } - return node; - } - function createSuperAccessInAsyncMethod(argumentExpression, flags, location) { - if (flags & 4096 /* AsyncMethodWithSuperBinding */) { - return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), - /*typeArguments*/ undefined, [argumentExpression]), "value", location); - } - else { - return ts.createCall(ts.createIdentifier("_super"), - /*typeArguments*/ undefined, [argumentExpression], location); - } - } - function getSuperContainerAsyncMethodFlags() { - return currentSuperContainer !== undefined - && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */); - } - } - ts.transformES2017 = transformES2017; - function createAwaiterHelper(context, hasLexicalArguments, promiseConstructor, body) { - context.requestEmitHelper(awaiterHelper); - var generatorFunc = ts.createFunctionExpression( - /*modifiers*/ undefined, ts.createToken(38 /* AsteriskToken */), - /*name*/ undefined, - /*typeParameters*/ undefined, - /*parameters*/ [], - /*type*/ undefined, body); - // Mark this node as originally an async function - (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= 131072 /* AsyncFunctionBody */; - return ts.createCall(ts.getHelperName("__awaiter"), - /*typeArguments*/ undefined, [ - ts.createThis(), - hasLexicalArguments ? ts.createIdentifier("arguments") : ts.createVoidZero(), - promiseConstructor ? ts.createExpressionFromEntityName(promiseConstructor) : ts.createVoidZero(), - generatorFunc - ]); - } - var awaiterHelper = { - name: "typescript:awaiter", - scoped: false, - priority: 5, - text: "\n var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n };" - }; - var asyncSuperHelper = { - name: "typescript:async-super", - scoped: true, - text: "\n const _super = name => super[name];" - }; - var advancedAsyncSuperHelper = { - name: "typescript:advanced-async-super", - scoped: true, - text: "\n const _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n })(name => super[name], (name, value) => super[name] = value);" - }; -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; (function (ts) { function transformES2016(context) { var hoistVariableDeclaration = context.hoistVariableDeclaration; @@ -48993,7 +52895,7 @@ var ts; return node; } switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -49018,25 +52920,21 @@ var ts; // Transforms `a[x] **= b` into `(_a = a)[_x = x] = Math.pow(_a[_x], b)` var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); var argumentExpressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createElementAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), ts.createAssignment(argumentExpressionTemp, left.argumentExpression, /*location*/ left.argumentExpression), - /*location*/ left); - value = ts.createElementAccess(expressionTemp, argumentExpressionTemp, - /*location*/ left); + target = ts.setTextRange(ts.createElementAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), ts.setTextRange(ts.createAssignment(argumentExpressionTemp, left.argumentExpression), left.argumentExpression)), left); + value = ts.setTextRange(ts.createElementAccess(expressionTemp, argumentExpressionTemp), left); } else if (ts.isPropertyAccessExpression(left)) { // Transforms `a.x **= b` into `(_a = a).x = Math.pow(_a.x, b)` var expressionTemp = ts.createTempVariable(hoistVariableDeclaration); - target = ts.createPropertyAccess(ts.createAssignment(expressionTemp, left.expression, /*location*/ left.expression), left.name, - /*location*/ left); - value = ts.createPropertyAccess(expressionTemp, left.name, - /*location*/ left); + target = ts.setTextRange(ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(expressionTemp, left.expression), left.expression), left.name), left); + value = ts.setTextRange(ts.createPropertyAccess(expressionTemp, left.name), left); } else { // Transforms `a **= b` into `a = Math.pow(a, b)` target = left; value = left; } - return ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node), /*location*/ node); + return ts.setTextRange(ts.createAssignment(target, ts.createMathPow(value, right, /*location*/ node)), node); } function visitExponentiationExpression(node) { // Transforms `a ** b` into `Math.pow(a, b)` @@ -49049,6 +52947,7 @@ var ts; })(ts || (ts = {})); /// /// +/// /*@internal*/ var ts; (function (ts) { @@ -49094,8 +52993,85 @@ var ts; */ SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; })(SuperCaptureResult || (SuperCaptureResult = {})); + // Facts we track as we traverse the tree + var HierarchyFacts; + (function (HierarchyFacts) { + HierarchyFacts[HierarchyFacts["None"] = 0] = "None"; + // + // Ancestor facts + // + HierarchyFacts[HierarchyFacts["Function"] = 1] = "Function"; + HierarchyFacts[HierarchyFacts["ArrowFunction"] = 2] = "ArrowFunction"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBody"] = 4] = "AsyncFunctionBody"; + HierarchyFacts[HierarchyFacts["NonStaticClassElement"] = 8] = "NonStaticClassElement"; + HierarchyFacts[HierarchyFacts["CapturesThis"] = 16] = "CapturesThis"; + HierarchyFacts[HierarchyFacts["ExportedVariableStatement"] = 32] = "ExportedVariableStatement"; + HierarchyFacts[HierarchyFacts["TopLevel"] = 64] = "TopLevel"; + HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block"; + HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement"; + HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock"; + HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement"; + HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper"; + HierarchyFacts[HierarchyFacts["ComputedPropertyName"] = 8192] = "ComputedPropertyName"; + // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. + // + // Ancestor masks + // + HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask"; + // We are always in *some* kind of block scope, but only specific block-scope containers are + // top-level or Blocks. + HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; + HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes"; + // A source file is a top-level block scope. + HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes"; + HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes"; + // Functions, methods, and accessors are both new lexical scopes and new block scopes. + HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes"; + HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes"; + // Arrow functions are lexically scoped to their container, but are new block scopes. + HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 16256] = "ArrowFunctionExcludes"; + // Constructors are both new lexical scopes and new block scopes. Constructors are also + // always considered non-static members of a class. + HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes"; + HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes"; + // 'do' and 'while' statements are not block scopes. We track that the subtree is contained + // within an IterationStatement to indicate whether the embedded statement is an + // IterationStatementBlock. + HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; + // 'for' statements are new block scopes and have special handling for 'let' declarations. + HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes"; + // 'for-in' and 'for-of' statements are new block scopes and have special handling for + // 'let' declarations. + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes"; + // Blocks (other than function bodies) are new block scopes. + HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes"; + HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes"; + // Computed property names track subtree flags differently than their containing members. + HierarchyFacts[HierarchyFacts["ComputedPropertyNameIncludes"] = 8192] = "ComputedPropertyNameIncludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameExcludes"] = 0] = "ComputedPropertyNameExcludes"; + // + // Subtree facts + // + HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget"; + HierarchyFacts[HierarchyFacts["NewTargetInComputedPropertyName"] = 32768] = "NewTargetInComputedPropertyName"; + // + // Subtree masks + // + HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask"; + HierarchyFacts[HierarchyFacts["PropagateNewTargetMask"] = 49152] = "PropagateNewTargetMask"; + })(HierarchyFacts || (HierarchyFacts = {})); function transformES2015(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -49103,15 +53079,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; /** * Used to track if we are emitting body of the converted loop */ @@ -49129,257 +53097,221 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0 /* None */; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); - } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072 /* AsyncFunctionBody */)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - // keep track of the enclosing variable statement when in the context of - // variable statements, variable declarations, binding elements, and binding - // patterns. - switch (currentNode.kind) { - case 205 /* VariableStatement */: - enclosingVariableStatement = currentNode; - break; - case 224 /* VariableDeclarationList */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; + /** + * Sets the `HierarchyFacts` for this node prior to visiting this node's subtree, returning the facts set prior to modification. + * @param excludeFacts The existing `HierarchyFacts` to reset before visiting the subtree. + * @param includeFacts The new `HierarchyFacts` to set before visiting the subtree. + */ + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */; + return ancestorFacts; } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + /** + * Restores the `HierarchyFacts` for this node's ancestor after visiting this node's + * subtree, propagating specific facts from the subtree. + * @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree. + * @param excludeFacts The existing `HierarchyFacts` of the subtree that should not be propagated. + * @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated. + */ + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression; + return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ + && node.kind === 218 /* ReturnStatement */ + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64 /* ES2015 */) !== 0 || - node.kind === 219 /* LabeledStatement */ || - (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && ts.isStatement(node)) + || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - // we want to dive in this branch either if node has children with ES2015 specific syntax - // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); - } - else { - result = visitNodesInConvertedLoop(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, /*isFunctionBody*/ true); } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216 /* ReturnStatement */: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 218 /* SwitchStatement */: - return visitSwitchStatement(node); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - return visitBreakOrContinueStatement(node); - case 98 /* ThisKeyword */: - return visitThisKeyword(node); - case 70 /* Identifier */: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96 /* SuperKeyword */) { + return visitSuperKeyword(/*isExpressionOfCall*/ true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114 /* StaticKeyword */: return undefined; // elide static keyword - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return visitClassDeclaration(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return visitClassExpression(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return visitParameter(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return visitArrowFunction(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return visitVariableDeclaration(node); case 70 /* Identifier */: return visitIdentifier(node); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 219 /* LabeledStatement */: + case 220 /* SwitchStatement */: + return visitSwitchStatement(node); + case 234 /* CaseBlock */: + return visitCaseBlock(node); + case 206 /* Block */: + return visitBlock(node, /*isFunctionBody*/ false); + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: + return visitBreakOrContinueStatement(node); + case 221 /* LabeledStatement */: return visitLabeledStatement(node); - case 209 /* DoStatement */: - return visitDoStatement(node); - case 210 /* WhileStatement */: - return visitWhileStatement(node); - case 211 /* ForStatement */: - return visitForStatement(node); - case 212 /* ForInStatement */: - return visitForInStatement(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 207 /* ExpressionStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); + case 213 /* ForStatement */: + return visitForStatement(node, /*outermostLabeledStatement*/ undefined); + case 214 /* ForInStatement */: + return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); + case 215 /* ForOfStatement */: + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); + case 209 /* ExpressionStatement */: return visitExpressionStatement(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return visitCatchClause(node); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 175 /* ArrayLiteralExpression */: + case 143 /* ComputedPropertyName */: + return visitComputedPropertyName(node); + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 12 /* NoSubstitutionTemplateLiteral */: case 13 /* TemplateHead */: case 14 /* TemplateMiddle */: case 15 /* TemplateTail */: return visitTemplateLiteral(node); - case 181 /* TaggedTemplateExpression */: + case 9 /* StringLiteral */: + return visitStringLiteral(node); + case 8 /* NumericLiteral */: + return visitNumericLiteral(node); + case 182 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return visitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return visitSpreadElement(node); case 96 /* SuperKeyword */: - return visitSuperKeyword(); - case 195 /* YieldExpression */: - // `yield` will be handled by a generators transform. - return ts.visitEachChild(node, visitor, context); - case 149 /* MethodDeclaration */: - return visitMethodDeclaration(node); - case 205 /* VariableStatement */: + return visitSuperKeyword(/*isExpressionOfCall*/ false); + case 98 /* ThisKeyword */: + return visitThisKeyword(node); + case 203 /* MetaProperty */: + return visitMetaProperty(node); + case 150 /* MethodDeclaration */: + return visitMethodDeclaration(node); + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return visitAccessorDeclaration(node); + case 207 /* VariableStatement */: return visitVariableStatement(node); + case 218 /* ReturnStatement */: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */); var statements = []; startLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); + var statementOffset = ts.addStandardPrologue(statements, node.statements, /*ensureUseStrict*/ false); addCaptureThisForNodeIfNeeded(statements, node); + statementOffset = ts.addCustomPrologue(statements, node.statements, statementOffset, visitor); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - // for switch statement allow only non-labeled break - convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + // for switch statement allow only non-labeled break + convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8 /* Return */; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8 /* Return */; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185 /* ArrowFunction */) { - // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2 /* ArrowFunction */) { + // if the enclosing function is an ArrowFunction then we use the captured 'this' keyword. + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -49388,7 +53320,7 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); @@ -49399,13 +53331,13 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 215 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + var jump = node.kind === 217 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -49416,7 +53348,7 @@ var ts; } } else { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 217 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -49464,8 +53396,9 @@ var ts; /*type*/ undefined, transformClassLikeDeclarationToExpression(node)); ts.setOriginalNode(variable, node); var statements = []; - var statement = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([variable]), /*location*/ node); + var statement = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([variable])); ts.setOriginalNode(statement, node); + ts.setTextRange(statement, node); ts.startOnNewLine(statement); statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) @@ -49583,7 +53516,7 @@ var ts; ts.setEmitFlags(statement, 1536 /* NoComments */ | 384 /* NoTokenSourceMaps */); statements.push(statement); ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), /*location*/ undefined, /*multiLine*/ true); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ node.members), /*multiLine*/ true); ts.setEmitFlags(block, 1536 /* NoComments */); return block; } @@ -49596,7 +53529,7 @@ var ts; */ function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { if (extendsClauseElement) { - statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), + statements.push(ts.setTextRange(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node))), /*location*/ extendsClauseElement)); } } @@ -49608,6 +53541,9 @@ var ts; * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration( @@ -49615,12 +53551,14 @@ var ts; /*modifiers*/ undefined, /*asteriskToken*/ undefined, ts.getDeclarationName(node), /*typeParameters*/ undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), - /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), - /*location*/ constructor || node); + /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper)); + ts.setTextRange(constructorFunction, constructor || node); if (extendsClauseElement) { ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; } /** * Transforms the parameters of the constructor declaration of a class. @@ -49658,38 +53596,46 @@ var ts; statementOffset = 0; } else if (constructor) { - // Otherwise, try to emit all potential prologue directives first. - statementOffset = ts.addPrologueDirectives(statements, constructor.body.statements, /*ensureUseStrict*/ false, visitor); + statementOffset = ts.addStandardPrologue(statements, constructor.body.statements, /*ensureUseStrict*/ false); } if (constructor) { addDefaultValueAssignmentsIfNeeded(statements, constructor); addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + if (!hasSynthesizedSuper) { + // If no super call has been synthesized, emit custom prologue directives. + statementOffset = ts.addCustomPrologue(statements, constructor.body.statements, statementOffset, visitor); + } ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + // determine whether the class is known syntactically to be a derived class (e.g. a + // class that extends a value that is not syntactically known to be `null`). + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94 /* NullKeyword */; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); // The last statement expression was replaced. Skip it. if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1 /* ReplaceSuperCapture */; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1 /* ReplaceSuperCapture */) { + hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset)); } // Return `_this` unless we're sure enough that it would be pointless to add a return statement. // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return. - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 /* ReplaceWithReturn */ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); - var block = ts.createBlock(ts.createNodeArray(statements, + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, /*copyOnWrite*/ false); + } + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), /*location*/ constructor ? constructor.body.statements : node.members), - /*location*/ constructor ? constructor.body : node, /*multiLine*/ true); + ts.setTextRange(block, constructor ? constructor.body : node); if (!constructor) { ts.setEmitFlags(block, 1536 /* NoComments */); } @@ -49702,17 +53648,17 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 216 /* ReturnStatement */) { + if (statement.kind === 218 /* ReturnStatement */) { return true; } - else if (statement.kind === 208 /* IfStatement */) { + else if (statement.kind === 210 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204 /* Block */) { + else if (statement.kind === 206 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -49725,9 +53671,9 @@ var ts; * * @returns The new statement offset into the `statements` array. */ - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { // If this isn't a derived class, just capture 'this' for arrow functions if necessary. - if (!hasExtendsClause) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -49770,16 +53716,18 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } - // Return the result if we have an immediate super() call on the last statement. - if (superCallExpression && statementOffset === ctorStatements.length - 1) { + // Return the result if we have an immediate super() call on the last statement, + // but only if the constructor itself doesn't use 'this' elsewhere. + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { var returnStatement = ts.createReturn(superCallExpression); - if (superCallExpression.kind !== 192 /* BinaryExpression */ - || superCallExpression.left.kind !== 179 /* CallExpression */) { + if (superCallExpression.kind !== 193 /* BinaryExpression */ + || superCallExpression.left.kind !== 180 /* CallExpression */) { ts.Debug.fail("Assumed generated super call would have form 'super.call(...) || this'."); } // Shift comments from the original super call to the return statement. @@ -49788,18 +53736,18 @@ var ts; return 2 /* ReplaceWithReturn */; } // Perform the capture. - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); // If we're actually replacing the original statement, we need to signal this to the caller. if (superCallExpression) { return 1 /* ReplaceSuperCapture */; } return 0 /* NoReplacement */; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } /** * Visits a parameter declaration. @@ -49814,25 +53762,25 @@ var ts; else if (ts.isBindingPattern(node.name)) { // Binding patterns are converted into a generated name and are // evaluated inside the function body. - return ts.setOriginalNode(ts.createParameter( + return ts.setOriginalNode(ts.setTextRange(ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, ts.getGeneratedNameForNode(node), /*questionToken*/ undefined, /*type*/ undefined, - /*initializer*/ undefined, + /*initializer*/ undefined), /*location*/ node), /*original*/ node); } else if (node.initializer) { // Initializers are elided - return ts.setOriginalNode(ts.createParameter( + return ts.setOriginalNode(ts.setTextRange(ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, node.name, /*questionToken*/ undefined, /*type*/ undefined, - /*initializer*/ undefined, + /*initializer*/ undefined), /*location*/ node), /*original*/ node); } @@ -49862,17 +53810,17 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_35 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; // A rest parameter cannot have a binding pattern or an initializer, // so let's just ignore it. if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_35)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_35, initializer); + if (ts.isBindingPattern(name)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_35, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer); } } } @@ -49907,13 +53855,11 @@ var ts; */ function addDefaultValueAssignmentForInitializer(statements, parameter, name, initializer) { initializer = ts.visitNode(initializer, visitor, ts.isExpression); - var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.createBlock([ - ts.createStatement(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer)), - /*location*/ parameter)) - ], /*location*/ parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */), - /*elseStatement*/ undefined, - /*location*/ parameter); + var statement = ts.createIf(ts.createTypeCheck(ts.getSynthesizedClone(name), "undefined"), ts.setEmitFlags(ts.setTextRange(ts.createBlock([ + ts.createStatement(ts.setTextRange(ts.createAssignment(ts.setEmitFlags(ts.getMutableClone(name), 48 /* NoSourceMap */), ts.setEmitFlags(initializer, 48 /* NoSourceMap */ | ts.getEmitFlags(initializer))), parameter)) + ]), parameter), 1 /* SingleLine */ | 32 /* NoTrailingSourceMap */ | 384 /* NoTokenSourceMaps */)); statement.startsOnNewLine = true; + ts.setTextRange(statement, parameter); ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 524288 /* CustomPrologue */); statements.push(statement); } @@ -49950,22 +53896,21 @@ var ts; var restIndex = node.parameters.length - 1; var temp = ts.createLoopVariable(); // var param = []; - statements.push(ts.setEmitFlags(ts.createVariableStatement( + statements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(declarationName, /*type*/ undefined, ts.createArrayLiteral([])) - ]), + ])), /*location*/ parameter), 524288 /* CustomPrologue */)); // for (var _i = restIndex; _i < arguments.length; _i++) { // param[_i - restIndex] = arguments[_i]; // } - var forStatement = ts.createFor(ts.createVariableDeclarationList([ + var forStatement = ts.createFor(ts.setTextRange(ts.createVariableDeclarationList([ ts.createVariableDeclaration(temp, /*type*/ undefined, ts.createLiteral(restIndex)) - ], /*location*/ parameter), ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length"), - /*location*/ parameter), ts.createPostfixIncrement(temp, /*location*/ parameter), ts.createBlock([ - ts.startOnNewLine(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 + ]), parameter), ts.setTextRange(ts.createLessThan(temp, ts.createPropertyAccess(ts.createIdentifier("arguments"), "length")), parameter), ts.setTextRange(ts.createPostfixIncrement(temp), parameter), ts.createBlock([ + ts.startOnNewLine(ts.setTextRange(ts.createStatement(ts.createAssignment(ts.createElementAccess(expressionName, restIndex === 0 ? temp - : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp)), + : ts.createSubtract(temp, ts.createLiteral(restIndex))), ts.createElementAccess(ts.createIdentifier("arguments"), temp))), /*location*/ parameter)) ])); ts.setEmitFlags(forStatement, 524288 /* CustomPrologue */); @@ -49979,7 +53924,7 @@ var ts; * @param node A node. */ function addCaptureThisForNodeIfNeeded(statements, node) { - if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 185 /* ArrowFunction */) { + if (node.transformFlags & 32768 /* ContainsCapturedLexicalThis */ && node.kind !== 186 /* ArrowFunction */) { captureThisForNode(statements, node, ts.createThis()); } } @@ -49989,11 +53934,52 @@ var ts; /*modifiers*/ undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration("_this", /*type*/ undefined, initializer) - ]), originalStatement); + ])); ts.setEmitFlags(captureThisStatement, 1536 /* NoComments */ | 524288 /* CustomPrologue */); + ts.setTextRange(captureThisStatement, originalStatement); ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384 /* NewTarget */) { + var newTarget = void 0; + switch (node.kind) { + case 186 /* ArrowFunction */: + return statements; + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + // Methods and accessors cannot be constructors, so 'new.target' will + // always return 'undefined'. + newTarget = ts.createVoidZero(); + break; + case 151 /* Constructor */: + // Class constructors can only be called with `new`, so `this.constructor` + // should be relatively safe to use. + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); + break; + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + // Functions can be called or constructed, and may have a `this` due to + // being a member or when calling an imported function via `other_1.f()`. + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 92 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", + /*type*/ undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } /** * Adds statements to the class body function for a class to define the members of the * class. @@ -50005,20 +53991,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 149 /* MethodDeclaration */: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + case 150 /* MethodDeclaration */: + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 150 /* Constructor */: + case 151 /* Constructor */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -50033,7 +54019,7 @@ var ts; * @param member The SemicolonClassElement node. */ function transformSemicolonClassElementToStatement(member) { - return ts.createEmptyStatement(/*location*/ member); + return ts.setTextRange(ts.createEmptyStatement(), member); } /** * Transforms a MethodDeclaration into a statement for a class body function. @@ -50041,14 +54027,15 @@ var ts; * @param receiver The receiver for the member. * @param member The MethodDeclaration node. */ - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name); - var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined, container); ts.setEmitFlags(memberFunction, 1536 /* NoComments */); ts.setSourceMapRange(memberFunction, sourceMapRange); - var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), + var statement = ts.setTextRange(ts.createStatement(ts.createAssignment(memberName, memberFunction)), /*location*/ member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); @@ -50056,6 +54043,7 @@ var ts; // No source map should be emitted for this statement to align with the // old emitter. ts.setEmitFlags(statement, 48 /* NoSourceMap */); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return statement; } /** @@ -50064,13 +54052,13 @@ var ts; * @param receiver The receiver for the member. * @param accessors The set of related get/set accessors. */ - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), - /*location*/ ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, /*startsOnNewLine*/ false)); // The location for the statement is used to emit source maps only. // No comments should be emitted for this statement to align with the // old emitter. ts.setEmitFlags(statement, 1536 /* NoComments */); + ts.setSourceMapRange(statement, ts.getSourceMapRange(accessors.firstAccessor)); return statement; } /** @@ -50079,8 +54067,9 @@ var ts; * * @param receiver The receiver for the member. */ - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. var target = ts.getMutableClone(receiver); @@ -50091,7 +54080,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -50099,23 +54088,24 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */); var setter = ts.createPropertyAssignment("set", setterFunction); ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); properties.push(setter); } - properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true))); + properties.push(ts.createPropertyAssignment("enumerable", ts.createTrue()), ts.createPropertyAssignment("configurable", ts.createTrue())); var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), /*typeArguments*/ undefined, [ target, propertyName, - ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true) + ts.createObjectLiteral(properties, /*multiLine*/ true) ]); if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return call; } /** @@ -50127,14 +54117,20 @@ var ts; if (node.transformFlags & 16384 /* ContainsLexicalThis */) { enableSubstitutionsForCapturedThis(); } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */); var func = ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformFunctionBody(node), node); + /*type*/ undefined, transformFunctionBody(node)); + ts.setTextRange(func, node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8 /* CapturesThis */); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; return func; } /** @@ -50143,12 +54139,24 @@ var ts; * @param node a FunctionExpression node. */ function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var ancestorFacts = ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */ + ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, node.asteriskToken, name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Visits a FunctionDeclaration node. @@ -50156,12 +54164,22 @@ var ts; * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Transforms a function-like node into a FunctionExpression. @@ -50170,18 +54188,24 @@ var ts; * @param location The source-map location for the new FunctionExpression. * @param name The name of the new FunctionExpression. */ - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */) + ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 227 /* FunctionDeclaration */ || node.kind === 185 /* FunctionExpression */)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression( + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location), + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body), location), /*original*/ node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; } /** * Transforms the body of a function-like node. @@ -50199,8 +54223,8 @@ var ts; resumeLexicalEnvironment(); if (ts.isBlock(body)) { // ensureUseStrict is false because no new prologue-directive should be added. - // addPrologueDirectives will simply put already-existing directives at the beginning of the target statement-array - statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + // addStandardPrologue will put already-existing directives at the beginning of the target statement-array + statementOffset = ts.addStandardPrologue(statements, body.statements, /*ensureUseStrict*/ false); } addCaptureThisForNodeIfNeeded(statements, node); addDefaultValueAssignmentsIfNeeded(statements, node); @@ -50210,6 +54234,8 @@ var ts; multiLine = true; } if (ts.isBlock(body)) { + // addCustomPrologue puts already-existing directives at the beginning of the target statement-array + statementOffset = ts.addCustomPrologue(statements, body.statements, statementOffset, visitor); statementsLocation = body.statements; ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, statementOffset)); // If the original body was a multi-line block, this must be a multi-line block. @@ -50218,7 +54244,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 185 /* ArrowFunction */); + ts.Debug.assert(node.kind === 186 /* ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -50234,7 +54260,8 @@ var ts; } } var expression = ts.visitNode(body, visitor, ts.isExpression); - var returnStatement = ts.createReturn(expression, /*location*/ body); + var returnStatement = ts.createReturn(expression); + ts.setTextRange(returnStatement, body); ts.setEmitFlags(returnStatement, 384 /* NoTokenSourceMaps */ | 32 /* NoTrailingSourceMap */ | 1024 /* NoTrailingComments */); statements.push(returnStatement); // To align with the source map emit for the old emitter, we set a custom @@ -50243,11 +54270,13 @@ var ts; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, /*copyOnWrite*/ false); // If we added any final generated statements, this must be a multi-line block if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } - var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), node.body, multiLine); + var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), multiLine); + ts.setTextRange(block, node.body); if (!multiLine && singleLine) { ts.setEmitFlags(block, 1 /* SingleLine */); } @@ -50257,6 +54286,23 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.setTextRange(ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, /*copyOnWrite*/ true)), + /*location*/ updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + // A function body is not a block scope. + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */ + ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */) + : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -50265,9 +54311,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -50282,10 +54328,13 @@ var ts; function visitParenthesizedExpression(node, needsDestructuringValue) { // If we are here it is most likely because our expression is a destructuring assignment. if (!needsDestructuringValue) { + // By default we always emit the RHS at the end of a flattened destructuring + // expression. If we are in a state where we do not need the destructuring value, + // we pass that information along to the children that care about it. switch (node.expression.kind) { - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -50303,9 +54352,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) { + var ancestorFacts = enterSubtree(0 /* None */, ts.hasModifier(node, 1 /* Export */) ? 32 /* ExportedVariableStatement */ : 0 /* None */); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3 /* BlockScoped */) === 0) { // we are inside a converted loop - hoist variable declarations var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -50319,18 +54371,22 @@ var ts; else { assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression)); } - (assignments || (assignments = [])).push(assignment); + assignments = ts.append(assignments, assignment); } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node); + updated = ts.setTextRange(ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); })), node); } else { // none of declarations has initializer - the entire variable statement can be deleted - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } /** * Visits a VariableDeclarationList that is block scoped (e.g. `let` or `const`). @@ -50338,25 +54394,29 @@ var ts; * @param node A VariableDeclarationList node. */ function visitVariableDeclarationList(node) { - if (node.flags & 3 /* BlockScoped */) { - enableSubstitutionsForBlockScopedBindings(); - } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 /* ContainsBindingPattern */ - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - // If the first or last declaration is a binding pattern, we need to modify - // the source map range for the declaration list. - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + if (node.transformFlags & 64 /* ES2015 */) { + if (node.flags & 3 /* BlockScoped */) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations); + ts.setOriginalNode(declarationList, node); + ts.setTextRange(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 /* ContainsBindingPattern */ + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + // If the first or last declaration is a binding pattern, we need to modify + // the source map range for the declaration list. + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - return declarationList; + return ts.visitEachChild(node, visitor, context); } /** * Gets a value indicating whether we should emit an explicit initializer for a variable @@ -50407,18 +54467,16 @@ var ts; var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false)); + && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 /* ForInStatement */ - && enclosingBlockScopeContainer.kind !== 213 /* ForOfStatement */ + && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false))); + && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0)); return emitExplicitInitializer; } /** @@ -50447,101 +54505,77 @@ var ts; * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node) { - // If we are here it is because the name contains a binding pattern. + var ancestorFacts = enterSubtree(32 /* ExportedVariableStatement */, 0 /* None */); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1 /* Export */); - return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, - /*value*/ undefined, hoistTempVariables); - } - return ts.visitEachChild(node, visitor, context); - } - function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, + /*value*/ undefined, (ancestorFacts & 32 /* ExportedVariableStatement */) !== 0); } else { - result = ts.visitEachChild(node, visitor, context); + updated = ts.visitEachChild(node, visitor, context); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels.set(node.label.text, node.label.text); + } + function resetLabel(node) { + convertedLoopState.labels.set(node.label.text, undefined); + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - return result; + var statement = ts.unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, /*lookInLabeledStatements*/ false) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 213 /* ForStatement */: + return visitForStatement(node, outermostLabeledStatement); + case 214 /* ForInStatement */: + return visitForInStatement(node, outermostLabeledStatement); + case 215 /* ForOfStatement */: + return visitForOfStatement(node, outermostLabeledStatement); + } + } + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement); } - /** - * Visits a ForOfStatement and converts it into a compatible ForStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } - function convertForOfToFor(node, convertedLoopBodyStatements) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (var _i = 0, _a = expr; _i < _a.length; _i++) { - // var v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - var expression = ts.visitNode(node.expression, visitor, ts.isExpression); - var initializer = node.initializer; + function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { var statements = []; - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we don't want to emit a temporary variable for the RHS, just use it directly. - var counter = ts.createLoopVariable(); - var rhsReference = expression.kind === 70 /* Identifier */ - ? ts.createUniqueName(expression.text) - : ts.createTempVariable(/*recordTempVariable*/ undefined); - var elementAccess = ts.createElementAccess(rhsReference, counter); - // Initialize LHS - // var v = _a[_i]; - if (ts.isVariableDeclarationList(initializer)) { - if (initializer.flags & 3 /* BlockScoped */) { + if (ts.isVariableDeclarationList(node.initializer)) { + if (node.initializer.flags & 3 /* BlockScoped */) { enableSubstitutionsForBlockScopedBindings(); } - var firstOriginalDeclaration = ts.firstOrUndefined(initializer.declarations); + var firstOriginalDeclaration = ts.firstOrUndefined(node.initializer.declarations); if (firstOriginalDeclaration && ts.isBindingPattern(firstOriginalDeclaration.name)) { // This works whether the declaration is a var, let, or const. // It will use rhsIterationValue _a[_i] as the initializer. - var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, elementAccess); - var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ initializer); - ts.setOriginalNode(declarationList, initializer); + var declarations = ts.flattenDestructuringBinding(firstOriginalDeclaration, visitor, context, 0 /* All */, boundValue); + var declarationList = ts.setTextRange(ts.createVariableDeclarationList(declarations), node.initializer); + ts.setOriginalNode(declarationList, node.initializer); // Adjust the source map range for the first declaration to align with the old // emitter. var firstDeclaration = declarations[0]; @@ -50553,27 +54587,24 @@ var ts; else { // The following call does not include the initializer, so we have // to emit it separately. - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.setOriginalNode(ts.createVariableDeclarationList([ + statements.push(ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.setOriginalNode(ts.setTextRange(ts.createVariableDeclarationList([ ts.createVariableDeclaration(firstOriginalDeclaration ? firstOriginalDeclaration.name : ts.createTempVariable(/*recordTempVariable*/ undefined), - /*type*/ undefined, ts.createElementAccess(rhsReference, counter)) - ], /*location*/ ts.moveRangePos(initializer, -1)), initializer), - /*location*/ ts.moveRangeEnd(initializer, -1))); + /*type*/ undefined, boundValue) + ]), ts.moveRangePos(node.initializer, -1)), node.initializer)), ts.moveRangeEnd(node.initializer, -1))); } } else { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. - var assignment = ts.createAssignment(initializer, elementAccess); + var assignment = ts.createAssignment(node.initializer, boundValue); if (ts.isDestructuringAssignment(assignment)) { - // This is a destructuring pattern, so we flatten the destructuring instead. - statements.push(ts.createStatement(ts.flattenDestructuringAssignment(assignment, visitor, context, 0 /* All */))); + ts.aggregateTransformFlags(assignment); + statements.push(ts.createStatement(visitBinaryExpression(assignment, /*needsDestructuringValue*/ false))); } else { - // Currently there is not way to check that assignment is binary expression of destructing assignment - // so we have to cast never type to binaryExpression - assignment.end = initializer.end; - statements.push(ts.createStatement(assignment, /*location*/ ts.moveRangeEnd(initializer, -1))); + assignment.end = node.initializer.end; + statements.push(ts.setTextRange(ts.createStatement(ts.visitNode(assignment, visitor, ts.isExpression)), ts.moveRangeEnd(node.initializer, -1))); } } var bodyLocation; @@ -50582,7 +54613,7 @@ var ts; ts.addRange(statements, convertedLoopBodyStatements); } else { - var statement = ts.visitNode(node.statement, visitor, ts.isStatement); + var statement = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); bodyLocation = statement; @@ -50592,22 +54623,92 @@ var ts; statements.push(statement); } } - // The old emitter does not emit source maps for the expression - ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression)); // The old emitter does not emit source maps for the block. // We add the location to preserve comments. - var body = ts.createBlock(ts.createNodeArray(statements, /*location*/ statementsLocation), - /*location*/ bodyLocation); - ts.setEmitFlags(body, 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); - var forStatement = ts.createFor(ts.setEmitFlags(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0), /*location*/ ts.moveRangePos(node.expression, -1)), - ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression) - ], /*location*/ node.expression), 1048576 /* NoHoisting */), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), - /*location*/ node.expression), ts.createPostfixIncrement(counter, /*location*/ node.expression), body, + return ts.setEmitFlags(ts.setTextRange(ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), + /*multiLine*/ true), bodyLocation), 48 /* NoSourceMap */ | 384 /* NoTokenSourceMaps */); + } + function convertForOfStatementForArray(node, outermostLabeledStatement, convertedLoopBodyStatements) { + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (var _i = 0, _a = expr; _i < _a.length; _i++) { + // var v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (let v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + var counter = ts.createLoopVariable(); + var rhsReference = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined); + // The old emitter does not emit source maps for the expression + ts.setEmitFlags(expression, 48 /* NoSourceMap */ | ts.getEmitFlags(expression)); + var forStatement = ts.setTextRange(ts.createFor( + /*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(counter, /*type*/ undefined, ts.createLiteral(0)), ts.moveRangePos(node.expression, -1)), + ts.setTextRange(ts.createVariableDeclaration(rhsReference, /*type*/ undefined, expression), node.expression) + ]), node.expression), 1048576 /* NoHoisting */), + /*condition*/ ts.setTextRange(ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length")), node.expression), + /*incrementor*/ ts.setTextRange(ts.createPostfixIncrement(counter), node.expression), + /*statement*/ convertForOfStatementHead(node, ts.createElementAccess(rhsReference, counter), convertedLoopBodyStatements)), /*location*/ node); // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */); - return forStatement; + ts.setTextRange(forStatement, node); + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var errorRecord = ts.createUniqueName("e"); + var catchVariable = ts.getGeneratedNameForNode(errorRecord); + var returnMethod = ts.createTempVariable(/*recordTempVariable*/ undefined); + var values = ts.createValuesHelper(context, expression, node.expression); + var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []); + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor( + /*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + ts.createVariableDeclaration(result, /*type*/ undefined, next) + ]), node.expression), 1048576 /* NoHoisting */), + /*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")), + /*incrementor*/ ts.createAssignment(result, next), + /*statement*/ convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"), convertedLoopBodyStatements)), + /*location*/ node), 256 /* NoTokenTrailingSourceMaps */); + return ts.createTry(ts.createBlock([ + ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel) + ]), ts.createCatchClause(ts.createVariableDeclaration(catchVariable), ts.setEmitFlags(ts.createBlock([ + ts.createStatement(ts.createAssignment(errorRecord, ts.createObjectLiteral([ + ts.createPropertyAssignment("error", catchVariable) + ]))) + ]), 1 /* SingleLine */)), ts.createBlock([ + ts.createTry( + /*tryBlock*/ ts.createBlock([ + ts.setEmitFlags(ts.createIf(ts.createLogicalAnd(ts.createLogicalAnd(result, ts.createLogicalNot(ts.createPropertyAccess(result, "done"))), ts.createAssignment(returnMethod, ts.createPropertyAccess(iterator, "return"))), ts.createStatement(ts.createFunctionCall(returnMethod, iterator, []))), 1 /* SingleLine */), + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ ts.setEmitFlags(ts.createBlock([ + ts.setEmitFlags(ts.createIf(errorRecord, ts.createThrow(ts.createPropertyAccess(errorRecord, "error"))), 1 /* SingleLine */) + ]), 1 /* SingleLine */)) + ])); } /** * Visits an ObjectLiteralExpression with computed propety names. @@ -50621,31 +54722,39 @@ var ts; // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 /* ContainsYield */ - || property.name.kind === 142 /* ComputedPropertyName */) { + if ((property.transformFlags & 16777216 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 143 /* ComputedPropertyName */) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - // For computed properties, we need to create a unique handle to the object - // literal so we can modify it without risking internal assignments tainting the object. - var temp = ts.createTempVariable(hoistVariableDeclaration); - // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, node.multiLine), 32768 /* Indented */)); - if (node.multiLine) { - assignment.startsOnNewLine = true; - } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - // We need to clone the temporary identifier so that we can write it on a - // new line - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var temp = ts.createTempVariable(hoistVariableDeclaration); + // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), node.multiLine), 32768 /* Indented */)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + // We need to clone the temporary identifier so that we can write it on a + // new line + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); + } + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; @@ -50672,7 +54781,7 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { @@ -50681,7 +54790,9 @@ var ts; saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */; } - var result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -50690,11 +54801,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 226 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -50730,19 +54841,26 @@ var ts; convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; } } - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + startLexicalEnvironment(); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock); + var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4); - loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, /*multiline*/ true); } - if (!ts.isBlock(loopBody)) { - loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0 + else { + loopBody = ts.createBlock([loopBody], /*multiline*/ true); + } + var isAsyncBlockContainingAwait = hierarchyFacts & 4 /* AsyncFunctionBody */ && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -50825,25 +54943,22 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); + var clone_4 = ts.getMutableClone(node); // clean statement part - loop.statement = undefined; + clone_4.statement = undefined; // visit childnodes to transform initializer/condition/incrementor parts - loop = ts.visitEachChild(loop, visitor, context); + clone_4 = ts.visitEachChild(clone_4, visitor, context); // set loop statement - loop.statement = ts.createBlock(convertedLoopBodyStatements, - /*location*/ undefined, - /*multiline*/ true); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, /*multiline*/ true); // reset and re-aggregate the transform flags - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); } - statements.push(currentParent.kind === 219 /* LabeledStatement */ - ? ts.createLabel(currentParent.label, loop) - : loop); + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -50867,7 +54982,9 @@ var ts; !state.labeledNonLocalBreaks && !state.labeledNonLocalContinues; var call = ts.createCall(loopFunctionExpressionName, /*typeArguments*/ undefined, ts.map(parameters, function (p) { return p.name; })); - var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38 /* AsteriskToken */), call) : call; + var callResult = isAsyncBlockContainingAwait + ? ts.createYield(ts.createToken(38 /* AsteriskToken */), ts.setEmitFlags(call, 4194304 /* Iterator */)) + : call; if (isSimpleLoop) { statements.push(ts.createStatement(callResult)); copyOutParameters(state.loopOutParameters, 0 /* ToOriginal */, statements); @@ -50906,26 +55023,25 @@ var ts; if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = ts.createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = ts.createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { if (!table) { return; } - for (var labelText in table) { - var labelMarker = table[labelText]; + table.forEach(function (labelMarker, labelText) { var statements = []; // if there are no outer converted loop or outer label in question is located inside outer converted loop // then emit labeled break\continue // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { var label = ts.createIdentifier(labelText); statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } @@ -50934,7 +55050,7 @@ var ts; statements.push(ts.createReturn(loopResultName)); } caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { var name = decl.name; @@ -50949,7 +55065,7 @@ var ts; else { loopParameters.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name)); if (resolver.getNodeCheckFlags(decl) & 2097152 /* NeedsLoopOutParameter */) { - var outParamName = ts.createUniqueName("out_" + name.text); + var outParamName = ts.createUniqueName("out_" + ts.unescapeIdentifier(name.text)); loopOutParameters.push({ originalName: name, outParamName: outParamName }); } } @@ -50969,22 +55085,22 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257 /* PropertyAssignment */: + case 150 /* MethodDeclaration */: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 260 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149 /* MethodDeclaration */: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; default: ts.Debug.failBadSyntaxKind(node); break; @@ -50999,8 +55115,8 @@ var ts; * @param receiver The receiver for the assignment. */ function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), - /*location*/ property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } @@ -51014,8 +55130,8 @@ var ts; * @param receiver The receiver for the assignment. */ function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), - /*location*/ property); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name)); + ts.setTextRange(expression, property); if (startsOnNewLine) { expression.startsOnNewLine = true; } @@ -51028,22 +55144,34 @@ var ts; * @param method The MethodDeclaration node. * @param receiver The receiver for the assignment. */ - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), - /*location*/ method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined, container)); + ts.setTextRange(expression, method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); - var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp); + ts.setTextRange(newVariableDeclaration, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); + var list = ts.createVariableDeclarationList(vars); + ts.setTextRange(list, node.variableDeclaration); + var destructure = ts.createVariableStatement(/*modifiers*/ undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -51060,20 +55188,41 @@ var ts; // Methods on classes are handled in visitClassDeclaration/visitClassExpression. // Methods with computed property names are handled in visitObjectLiteralExpression. ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined); + var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined, /*container*/ undefined); ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); - return ts.createPropertyAssignment(node.name, functionExpression, + return ts.setTextRange(ts.createPropertyAssignment(node.name, functionExpression), /*location*/ node); } + /** + * Visits an AccessorDeclaration of an ObjectLiteralExpression. + * + * @param node An AccessorDeclaration node. + */ + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return updated; + } /** * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment. * * @param node A ShorthandPropertyAssignment node. */ function visitShorthandPropertyAssignment(node) { - return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), + return ts.setTextRange(ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name)), /*location*/ node); } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0 /* ComputedPropertyNameExcludes */, 8192 /* ComputedPropertyNameIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 32768 /* NewTargetInComputedPropertyName */ : 0 /* None */); + return updated; + } /** * Visits a YieldExpression node. * @@ -51089,8 +55238,11 @@ var ts; * @param node An ArrayLiteralExpression node. */ function visitArrayLiteralExpression(node) { - // We are here because we contain a SpreadElementExpression. - return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + if (node.transformFlags & 64 /* ES2015 */) { + // We are here because we contain a SpreadElementExpression. + return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } /** * Visits a CallExpression that contains either a spread element or `super`. @@ -51098,7 +55250,11 @@ var ts; * @param node a CallExpression. */ function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + if (node.transformFlags & 64 /* ES2015 */) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), + /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false); @@ -51125,7 +55281,7 @@ var ts; // _super.apply(this, a.concat([b])) // _super.m.apply(this, a.concat([b])) // _super.prototype.m.apply(this, a.concat([b])) - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); } else { // [source] @@ -51137,18 +55293,18 @@ var ts; // _super.call(this, a) // _super.m.call(this, a) // _super.prototype.m.call(this, a) - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), /*location*/ node); } if (node.expression.kind === 96 /* SuperKeyword */) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } /** * Visits a NewExpression that contains a spread element. @@ -51156,16 +55312,18 @@ var ts; * @param node A NewExpression node. */ function visitNewExpression(node) { - // We are here because we contain a SpreadElementExpression. - ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0); - // [source] - // new C(...a) - // - // [output] - // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), - /*typeArguments*/ undefined, []); + if (node.transformFlags & 524288 /* ContainsSpread */) { + // We are here because we contain a SpreadElementExpression. + // [source] + // new C(...a) + // + // [output] + // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), + /*typeArguments*/ undefined, []); + } + return ts.visitEachChild(node, visitor, context); } /** * Transforms an array of Expression nodes that contains a SpreadExpression. @@ -51186,14 +55344,28 @@ var ts; var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) { return visitPartition(partition, multiLine, hasTrailingComma && end === numElements); })); - if (segments.length === 1) { - var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 /* ArrayLiteralExpression */ - ? ts.createArraySlice(segments[0]) - : segments[0]; + if (compilerOptions.downlevelIteration) { + if (segments.length === 1) { + var firstSegment = segments[0]; + if (ts.isCallExpression(firstSegment) + && ts.isIdentifier(firstSegment.expression) + && (ts.getEmitFlags(firstSegment.expression) & 4096 /* HelperName */) + && firstSegment.expression.text === "___spread") { + return segments[0]; + } + } + return ts.createSpreadHelper(context, segments); + } + else { + if (segments.length === 1) { + var firstElement = elements[0]; + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 176 /* ArrayLiteralExpression */ + ? ts.createArraySlice(segments[0]) + : segments[0]; + } + // Rewrite using the pattern .concat(, , ...) + return ts.createArrayConcat(segments.shift(), segments); } - // Rewrite using the pattern .concat(, , ...) - return ts.createArrayConcat(segments.shift(), segments); } function partitionSpread(node) { return ts.isSpreadExpression(node) @@ -51204,8 +55376,7 @@ var ts; return ts.map(chunk, visitExpressionOfSpread); } function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { - return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, /*location*/ undefined, hasTrailingComma), visitor, ts.isExpression), - /*location*/ undefined, multiLine); + return ts.createArrayLiteral(ts.visitNodes(ts.createNodeArray(chunk, hasTrailingComma), visitor, ts.isExpression), multiLine); } function visitSpreadElement(node) { return ts.visitNode(node.expression, visitor, ts.isExpression); @@ -51224,7 +55395,29 @@ var ts; * @param node A template literal. */ function visitTemplateLiteral(node) { - return ts.createLiteral(node.text, /*location*/ node); + return ts.setTextRange(ts.createLiteral(node.text), node); + } + /** + * Visits a string literal with an extended unicode escape. + * + * @param node A string literal. + */ + function visitStringLiteral(node) { + if (node.hasExtendedUnicodeEscape) { + return ts.setTextRange(ts.createLiteral(node.text), node); + } + return node; + } + /** + * Visits a binary or octal (ES6) numeric literal. + * + * @param node A string literal. + */ + function visitNumericLiteral(node) { + if (node.numericLiteralFlags & 48 /* BinaryOrOctalSpecifier */) { + return ts.setTextRange(ts.createNumericLiteral(node.text), node); + } + return node; } /** * Visits a TaggedTemplateExpression node. @@ -51284,7 +55477,7 @@ var ts; // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's // and LineTerminatorSequences are normalized to for both TV and TRV. text = text.replace(/\r\n?/g, "\n"); - return ts.createLiteral(text, /*location*/ node); + return ts.setTextRange(ts.createLiteral(text), node); } /** * Visits a TemplateExpression node. @@ -51306,7 +55499,8 @@ var ts; // "abc" + (1 << 2) + "" var expression = ts.reduceLeft(expressions, ts.createAdd); if (ts.nodeIsSynthesized(expression)) { - ts.setTextRange(expression, node); + expression.pos = node.pos; + expression.end = node.end; } return expression; } @@ -51368,27 +55562,42 @@ var ts; /** * Visits the `super` keyword */ - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32 /* Static */) - && currentParent.kind !== 179 /* CallExpression */ + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 /* NonStaticClassElement */ + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } + function visitMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */ && node.name.text === "target") { + if (hierarchyFacts & 8192 /* ComputedPropertyName */) { + hierarchyFacts |= 32768 /* NewTargetInComputedPropertyName */; + } + else { + hierarchyFacts |= 16384 /* NewTarget */; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } /** * Called by the printer just before a node is printed. * + * @param hint A hint as to the intended usage of the node. * @param node The node to be printed. + * @param emitCallback The callback used to emit the node. */ - function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; + function onEmitNode(hint, node, emitCallback) { if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */ + ? 65 /* FunctionIncludes */ | 16 /* CapturesThis */ + : 65 /* FunctionIncludes */); + previousOnEmitNode(hint, node, emitCallback); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return; } - previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; + previousOnEmitNode(hint, node, emitCallback); } /** * Enables a more costly code path for substitutions when we determine a source file @@ -51408,24 +55617,24 @@ var ts; if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { enabledSubstitutions |= 1 /* CapturedThis */; context.enableSubstitution(98 /* ThisKeyword */); - context.enableEmitNotification(150 /* Constructor */); - context.enableEmitNotification(149 /* MethodDeclaration */); - context.enableEmitNotification(151 /* GetAccessor */); - context.enableEmitNotification(152 /* SetAccessor */); - context.enableEmitNotification(185 /* ArrowFunction */); - context.enableEmitNotification(184 /* FunctionExpression */); - context.enableEmitNotification(225 /* FunctionDeclaration */); + context.enableEmitNotification(151 /* Constructor */); + context.enableEmitNotification(150 /* MethodDeclaration */); + context.enableEmitNotification(152 /* GetAccessor */); + context.enableEmitNotification(153 /* SetAccessor */); + context.enableEmitNotification(186 /* ArrowFunction */); + context.enableEmitNotification(185 /* FunctionExpression */); + context.enableEmitNotification(227 /* FunctionDeclaration */); } } /** * Hooks node substitutions. * - * @param emitContext The context for the emitter. + * @param hint The context for the emitter. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */) { return substituteExpression(node); } if (ts.isIdentifier(node)) { @@ -51442,7 +55651,7 @@ var ts; if (enabledSubstitutions & 2 /* BlockScopedBindings */) { var original = ts.getParseTreeNode(node, ts.isIdentifier); if (original && isNameOfDeclarationWithCollidingName(original)) { - return ts.getGeneratedNameForNode(original); + return ts.setTextRange(ts.getGeneratedNameForNode(original), node); } } return node; @@ -51456,10 +55665,10 @@ var ts; function isNameOfDeclarationWithCollidingName(node) { var parent = node.parent; switch (parent.kind) { - case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 223 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 225 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -51488,7 +55697,7 @@ var ts; if (enabledSubstitutions & 2 /* BlockScopedBindings */) { var declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { - return ts.getGeneratedNameForNode(declaration.name); + return ts.setTextRange(ts.getGeneratedNameForNode(declaration.name), node); } } return node; @@ -51500,9 +55709,8 @@ var ts; */ function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) { - return ts.createIdentifier("_this", /*location*/ node); + && hierarchyFacts & 16 /* CapturesThis */) { + return ts.setTextRange(ts.createIdentifier("_this"), node); } return node; } @@ -51518,11 +55726,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 209 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 180 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -51530,7 +55738,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 197 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -51550,11 +55758,123 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); /// /// +/*@internal*/ +var ts; +(function (ts) { + /** + * Transforms ES5 syntax into ES3 syntax. + * + * @param context Context and state information for the transformation. + */ + function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + // enable emit notification only if using --jsx preserve or react-native + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(250 /* JsxOpeningElement */); + context.enableEmitNotification(251 /* JsxClosingElement */); + context.enableEmitNotification(249 /* JsxSelfClosingElement */); + noSubstitution = []; + } + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + context.enableSubstitution(178 /* PropertyAccessExpression */); + context.enableSubstitution(260 /* PropertyAssignment */); + return transformSourceFile; + /** + * Transforms an ES5 source file to ES3. + * + * @param node A SourceFile + */ + function transformSourceFile(node) { + return node; + } + /** + * Called by the printer just before a node is printed. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emitCallback A callback used to emit the node. + */ + function onEmitNode(hint, node, emitCallback) { + switch (node.kind) { + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(hint, node, emitCallback); + } + /** + * Hooks node substitutions. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(hint, node); + } + node = previousOnSubstituteNode(hint, node); + if (ts.isPropertyAccessExpression(node)) { + return substitutePropertyAccessExpression(node); + } + else if (ts.isPropertyAssignment(node)) { + return substitutePropertyAssignment(node); + } + return node; + } + /** + * Substitutes a PropertyAccessExpression whose name is a reserved word. + * + * @param node A PropertyAccessExpression + */ + function substitutePropertyAccessExpression(node) { + var literalName = trySubstituteReservedName(node.name); + if (literalName) { + return ts.setTextRange(ts.createElementAccess(node.expression, literalName), node); + } + return node; + } + /** + * Substitutes a PropertyAssignment whose name is a reserved word. + * + * @param node A PropertyAssignment + */ + function substitutePropertyAssignment(node) { + var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); + if (literalName) { + return ts.updatePropertyAssignment(node, literalName, node.initializer); + } + return node; + } + /** + * If an identifier name is a reserved word, returns a string literal for the name. + * + * @param name An Identifier + */ + function trySubstituteReservedName(name) { + var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); + if (token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */) { + return ts.setTextRange(ts.createLiteral(name), name); + } + return undefined; + } + } + ts.transformES5 = transformES5; +})(ts || (ts = {})); +/// +/// // Transforms generator functions into a compatible ES5 representation with similar runtime // semantics. This is accomplished by first transforming the body of each generator // function into an intermediate representation that is the compiled into a JavaScript @@ -51725,13 +56045,15 @@ var ts; Instruction[Instruction["Catch"] = 6] = "Catch"; Instruction[Instruction["Endfinally"] = 7] = "Endfinally"; })(Instruction || (Instruction = {})); - var instructionNames = ts.createMap((_a = {}, - _a[2 /* Return */] = "return", - _a[3 /* Break */] = "break", - _a[4 /* Yield */] = "yield", - _a[5 /* YieldStar */] = "yield*", - _a[7 /* Endfinally */] = "endfinally", - _a)); + function getInstructionName(instruction) { + switch (instruction) { + case 2 /* Return */: return "return"; + case 3 /* Break */: return "break"; + case 4 /* Yield */: return "yield"; + case 5 /* YieldStar */: return "yield*"; + case 7 /* Endfinally */: return "endfinally"; + } + } function transformGenerators(context) { var resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistFunctionDeclaration = context.hoistFunctionDeclaration, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); @@ -51823,13 +56145,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209 /* DoStatement */: + case 211 /* DoStatement */: return visitDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return visitWhileStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return visitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -51842,24 +56164,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return visitAccessorDeclaration(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return visitVariableStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return visitForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return visitForInStatement(node); - case 215 /* BreakStatement */: + case 217 /* BreakStatement */: return visitBreakStatement(node); - case 214 /* ContinueStatement */: + case 216 /* ContinueStatement */: return visitContinueStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -51880,21 +56202,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return visitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return visitConditionalExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return visitYieldExpression(node); - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return visitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -51907,9 +56229,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return visitFunctionExpression(node); default: ts.Debug.failBadSyntaxKind(node); @@ -51927,12 +56249,12 @@ var ts; */ function visitFunctionDeclaration(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { - node = ts.setOriginalNode(ts.createFunctionDeclaration( + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration( /*decorators*/ undefined, node.modifiers, /*asteriskToken*/ undefined, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformGeneratorFunctionBody(node.body), + /*type*/ undefined, transformGeneratorFunctionBody(node.body)), /*location*/ node), node); } else { @@ -51965,12 +56287,12 @@ var ts; */ function visitFunctionExpression(node) { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { - node = ts.setOriginalNode(ts.createFunctionExpression( + if (node.asteriskToken) { + node = ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, node.name, /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, transformGeneratorFunctionBody(node.body), + /*type*/ undefined, transformGeneratorFunctionBody(node.body)), /*location*/ node), node); } else { @@ -52039,7 +56361,7 @@ var ts; state = ts.createTempVariable(/*recordTempVariable*/ undefined); // Build the generator resumeLexicalEnvironment(); - var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + var statementOffset = ts.addPrologue(statements, body.statements, /*ensureUseStrict*/ false, visitor); transformAndEmitStatements(body.statements, statementOffset); var buildResult = build(); ts.addRange(statements, endLexicalEnvironment()); @@ -52058,7 +56380,7 @@ var ts; operationArguments = savedOperationArguments; operationLocations = savedOperationLocations; state = savedState; - return ts.createBlock(statements, /*location*/ body, body.multiLine); + return ts.setTextRange(ts.createBlock(statements, body.multiLine), body); } /** * Visits a variable statement. @@ -52137,7 +56459,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -52149,7 +56471,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -52168,7 +56490,7 @@ var ts; } var operator = node.operatorToken.kind; if (isCompoundAssignment(operator)) { - return ts.createBinary(target, 57 /* EqualsToken */, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node); + return ts.setTextRange(ts.createAssignment(target, ts.setTextRange(ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression)), node)), node); } else { return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression)); @@ -52192,10 +56514,10 @@ var ts; // _a = a(); // .yield resumeLabel // _a + %sent% + c() - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -52330,17 +56652,19 @@ var ts; // .yield resumeLabel, (a()) // .mark resumeLabel // x = %sent%; - // NOTE: we are explicitly not handling YieldStar at this time. var resumeLabel = defineLabel(); var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (node.asteriskToken) { - emitYieldStar(expression, /*location*/ node); + var iterator = (ts.getEmitFlags(node.expression) & 4194304 /* Iterator */) === 0 + ? ts.createValuesHelper(context, expression, /*location*/ node) + : expression; + emitYieldStar(iterator, /*location*/ node); } else { emitYield(expression, /*location*/ node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(/*location*/ node); } /** * Visits an ArrayLiteralExpression that contains a YieldExpression. @@ -52368,26 +56692,27 @@ var ts; // .mark resumeLabel // ar = _a.concat([%sent%, 2]); var numInitialElements = countInitialNodesWithoutYield(elements); - var temp = declareLocal(); - var hasAssignedTemp = false; + var temp; if (numInitialElements > 0) { + temp = declareLocal(); var initialElements = ts.visitNodes(elements, visitor, ts.isExpression, 0, numInitialElements); emitAssignment(temp, ts.createArrayLiteral(leadingElement ? [leadingElement].concat(initialElements) : initialElements)); leadingElement = undefined; - hasAssignedTemp = true; } var expressions = ts.reduceLeft(elements, reduceElement, [], numInitialElements); - return hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, location, multiLine); + return temp + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.setTextRange(ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine), location); function reduceElement(expressions, element) { if (containsYield(element) && expressions.length > 0) { + var hasAssignedTemp = temp !== undefined; + if (!temp) { + temp = declareLocal(); + } emitAssignment(temp, hasAssignedTemp - ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, /*location*/ undefined, multiLine)]) - : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, - /*location*/ undefined, multiLine)); - hasAssignedTemp = true; + ? ts.createArrayConcat(temp, [ts.createArrayLiteral(expressions, multiLine)]) + : ts.createArrayLiteral(leadingElement ? [leadingElement].concat(expressions) : expressions, multiLine)); leadingElement = undefined; expressions = []; } @@ -52417,8 +56742,7 @@ var ts; var multiLine = node.multiLine; var numInitialProperties = countInitialNodesWithoutYield(properties); var temp = declareLocal(); - emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, multiLine)); + emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), multiLine)); var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties); expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); return ts.inlineExpressions(expressions); @@ -52454,10 +56778,10 @@ var ts; // .yield resumeLabel // .mark resumeLabel // a = _a[%sent%] - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -52492,10 +56816,9 @@ var ts; // .mark resumeLabel // new (_b.apply(_a, _c.concat([%sent%, 2]))); var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.setOriginalNode(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, + return ts.setOriginalNode(ts.setTextRange(ts.createNew(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isExpression)), thisArg, visitElements(node.arguments, /*leadingElement*/ ts.createVoidZero())), - /*typeArguments*/ undefined, [], - /*location*/ node), node); + /*typeArguments*/ undefined, []), node), node); } return ts.visitEachChild(node, visitor, context); } @@ -52524,38 +56847,38 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204 /* Block */: + case 206 /* Block */: return transformAndEmitBlock(node); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return transformAndEmitIfStatement(node); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return transformAndEmitDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return transformAndEmitForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 214 /* ContinueStatement */: + case 216 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 215 /* BreakStatement */: + case 217 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return transformAndEmitWithStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return transformAndEmitTryStatement(node); default: - return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true)); + return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); } } function transformAndEmitBlock(node) { @@ -52572,7 +56895,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -52615,7 +56940,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -52738,8 +57063,7 @@ var ts; transformAndEmitVariableDeclarationList(initializer); } else { - emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), - /*location*/ initializer)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression)), initializer)); } } markLabel(conditionLabel); @@ -52749,8 +57073,7 @@ var ts; transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); if (node.incrementor) { - emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), - /*location*/ node.incrementor)); + emitStatement(ts.setTextRange(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression)), node.incrementor)); } emitBreak(conditionLabel); endLoopBlock(); @@ -52764,7 +57087,7 @@ var ts; beginScriptLoopBlock(); } var initializer = node.initializer; - if (ts.isVariableDeclarationList(initializer)) { + if (initializer && ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { var variable = _a[_i]; hoistVariableDeclaration(variable.name); @@ -52772,7 +57095,7 @@ var ts; var variables = ts.getInitializedVariables(initializer); node = ts.updateFor(node, variables.length > 0 ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable)) - : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + : undefined, ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -52864,7 +57187,7 @@ var ts; var variable = _a[_i]; hoistVariableDeclaration(variable.name); } - node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); } else { node = ts.visitEachChild(node, visitor, context); @@ -52903,11 +57226,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitReturnStatement(node) { - emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), + emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node); } function visitReturnStatement(node) { - return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), + return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node); } function transformAndEmitWithStatement(node) { @@ -52972,7 +57295,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 257 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -52985,7 +57308,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 256 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -53127,9 +57450,9 @@ var ts; } return -1; } - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (emitContext === 1 /* Expression */) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (hint === 1 /* Expression */) { return substituteExpression(node); } return node; @@ -53141,17 +57464,17 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(node.text)) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_36 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_36) { - var clone_6 = ts.getMutableClone(name_36); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name = renamedCatchVariableDeclarations[ts.getOriginalNodeId(declaration)]; + if (name) { + var clone_7 = ts.getMutableClone(name); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -53160,7 +57483,7 @@ var ts; } function cacheExpression(node) { var temp; - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.getEmitFlags(node) & 4096 /* HelperName */) { return node; } temp = ts.createTempVariable(hoistVariableDeclaration); @@ -53288,15 +57611,23 @@ var ts; */ function beginCatchBlock(variable) { ts.Debug.assert(peekBlockKind() === 0 /* Exception */); - var text = variable.name.text; - var name = declareLocal(text); - if (!renamedCatchVariables) { - renamedCatchVariables = ts.createMap(); - renamedCatchVariableDeclarations = ts.createMap(); - context.enableSubstitution(70 /* Identifier */); + // generated identifiers should already be unique within a file + var name; + if (ts.isGeneratedIdentifier(variable.name)) { + name = variable.name; + hoistVariableDeclaration(variable.name); + } + else { + var text = variable.name.text; + name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = ts.createMap(); + renamedCatchVariableDeclarations = []; + context.enableSubstitution(70 /* Identifier */); + } + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; } - renamedCatchVariables[text] = true; - renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; var exception = peekBlock(); ts.Debug.assert(exception.state < 1 /* Catch */); var endLabel = exception.endLabel; @@ -53566,7 +57897,7 @@ var ts; */ function createInstruction(instruction) { var literal = ts.createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + ts.addSyntheticTrailingComment(literal, 3 /* MultiLineCommentTrivia */, getInstructionName(instruction)); return literal; } /** @@ -53577,10 +57908,10 @@ var ts; */ function createInlineBreak(label, location) { ts.Debug.assert(label > 0, "Invalid label: " + label); - return ts.createReturn(ts.createArrayLiteral([ + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), location); + ])), location); } /** * Creates a statement that can be used indicate a Return operation. @@ -53589,15 +57920,16 @@ var ts; * @param location An optional source map location for the statement. */ function createInlineReturn(expression, location) { - return ts.createReturn(ts.createArrayLiteral(expression + return ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2 /* Return */), expression] - : [createInstruction(2 /* Return */)]), location); + : [createInstruction(2 /* Return */)])), location); } /** * Creates an expression that can be used to resume from a Yield operation. */ function createGeneratorResume(location) { - return ts.createCall(ts.createPropertyAccess(state, "sent"), /*typeArguments*/ undefined, [], location); + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(state, "sent"), + /*typeArguments*/ undefined, []), location); } /** * Emits an empty instruction. @@ -53743,7 +58075,6 @@ var ts; /*name*/ undefined, /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, state)], /*type*/ undefined, ts.createBlock(buildResult, - /*location*/ undefined, /*multiLine*/ buildResult.length > 0)), 262144 /* ReuseTempVariableScope */)); } /** @@ -54014,7 +58345,7 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeAssign(left, right, operationLocation) { - writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation)); + writeStatement(ts.setTextRange(ts.createStatement(ts.createAssignment(left, right)), operationLocation)); } /** * Writes a Throw operation to the current label's statement list. @@ -54025,7 +58356,7 @@ var ts; function writeThrow(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createThrow(expression, operationLocation)); + writeStatement(ts.setTextRange(ts.createThrow(expression), operationLocation)); } /** * Writes a Return operation to the current label's statement list. @@ -54036,9 +58367,9 @@ var ts; function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2 /* Return */), expression] - : [createInstruction(2 /* Return */)]), operationLocation)); + : [createInstruction(2 /* Return */)])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a Break operation to the current label's statement list. @@ -54048,10 +58379,10 @@ var ts; */ function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation)); + ])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a BreakWhenTrue operation to the current label's statement list. @@ -54061,10 +58392,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a BreakWhenFalse operation to the current label's statement list. @@ -54074,10 +58405,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ])), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a Yield operation to the current label's statement list. @@ -54087,9 +58418,9 @@ var ts; */ function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4 /* Yield */), expression] - : [createInstruction(4 /* Yield */)]), operationLocation)); + : [createInstruction(4 /* Yield */)])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a YieldStar instruction to the current label's statement list. @@ -54099,10 +58430,10 @@ var ts; */ function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(5 /* YieldStar */), expression - ]), operationLocation)); + ])), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes an Endfinally instruction to the current label's statement list. @@ -54183,645 +58514,500 @@ var ts; name: "typescript:generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t;\n return { next: verb(0), \"throw\": verb(1), \"return\": verb(2) };\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; - var _a; })(ts || (ts = {})); -/// -/// +/// +/// +/// /*@internal*/ var ts; (function (ts) { - /** - * Transforms ES5 syntax into ES3 syntax. - * - * @param context Context and state information for the transformation. - */ - function transformES5(context) { + function transformModule(context) { + function getTransformModuleDelegate(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.AMD: return transformAMDModule; + case ts.ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var host = context.getEmitHost(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var moduleKind = ts.getEmitModuleKind(compilerOptions); var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(257 /* PropertyAssignment */); + context.onEmitNode = onEmitNode; + context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(261 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(264 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. + var currentSourceFile; // The current file. + var currentModuleInfo; // The ExternalModuleInfo for the current file. + var noSubstitution; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; /** - * Transforms an ES5 source file to ES3. + * Transforms the module aspects of a SourceFile. * - * @param node A SourceFile + * @param node The SourceFile node. */ function transformSourceFile(node) { - return node; + if (ts.isDeclarationFile(node) || !(ts.isExternalModule(node) || compilerOptions.isolatedModules)) { + return node; + } + currentSourceFile = node; + currentModuleInfo = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; + // Perform the transformation. + var transformModule = getTransformModuleDelegate(moduleKind); + var updated = transformModule(node); + currentSourceFile = undefined; + currentModuleInfo = undefined; + return ts.aggregateTransformFlags(updated); + } + function shouldEmitUnderscoreUnderscoreESModule() { + if (!currentModuleInfo.exportEquals && ts.isExternalModule(currentSourceFile)) { + return true; + } + return false; } /** - * Hooks node substitutions. + * Transforms a SourceFile into a CommonJS module. * - * @param emitContext The context for the emitter. - * @param node The node to substitute. + * @param node The SourceFile node. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isPropertyAccessExpression(node)) { - return substitutePropertyAccessExpression(node); + function transformCommonJSModule(node) { + startLexicalEnvironment(); + var statements = []; + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); } - else if (ts.isPropertyAssignment(node)) { - return substitutePropertyAssignment(node); + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); + ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); + addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); + ts.addRange(statements, endLexicalEnvironment()); + var updated = ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); + if (currentModuleInfo.hasExportStarsToExportValues) { + // If we have any `export * from ...` declarations + // we need to inform the emitter to add the __export helper. + ts.addEmitHelper(updated, exportStarHelper); } - return node; + return updated; } /** - * Substitutes a PropertyAccessExpression whose name is a reserved word. + * Transforms a SourceFile into an AMD module. * - * @param node A PropertyAccessExpression + * @param node The SourceFile node. */ - function substitutePropertyAccessExpression(node) { - var literalName = trySubstituteReservedName(node.name); - if (literalName) { - return ts.createElementAccess(node.expression, literalName, /*location*/ node); - } - return node; + function transformAMDModule(node) { + var define = ts.createIdentifier("define"); + var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); + // An AMD define function has the following shape: + // + // define(id?, dependencies?, factory); + // + // This has the shape of the following: + // + // define(name, ["module1", "module2"], function (module1Alias) { ... } + // + // The location of the alias in the parameter list in the factory function needs to + // match the position of the module name in the dependency list. + // + // To ensure this is true in cases of modules with no aliases, e.g.: + // + // import "module" + // + // or + // + // /// + // + // we need to add modules without alias names to the end of the dependencies list + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + // Create an updated SourceFile: + // + // define(moduleName?, ["module1", "module2"], function ... + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(define, + /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([ + // Add the dependency array argument: + // + // ["require", "exports", module1", "module2", ...] + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + // Add the module body function argument: + // + // function (require, exports, module1, module2) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ]))) + ]), + /*location*/ node.statements)); } /** - * Substitutes a PropertyAssignment whose name is a reserved word. + * Transforms a SourceFile into a UMD module. * - * @param node A PropertyAssignment + * @param node The SourceFile node. */ - function substitutePropertyAssignment(node) { - var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); - if (literalName) { - return ts.updatePropertyAssignment(node, literalName, node.initializer); - } - return node; + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "factory")], + /*type*/ undefined, ts.setTextRange(ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, [ + ts.createVariableDeclaration("v", + /*type*/ undefined, ts.createCall(ts.createIdentifier("factory"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1 /* SingleLine */) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), + /*typeArguments*/ undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], + /*multiLine*/ true), + /*location*/ undefined)); + // Create an updated SourceFile: + // + // (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 ...) + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, + /*typeArguments*/ undefined, [ + // Add the module body function argument: + // + // function (require, exports) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ])) + ]), + /*location*/ node.statements)); } /** - * If an identifier name is a reserved word, returns a string literal for the name. + * Collect the additional asynchronous dependencies for the module. * - * @param name An Identifier + * @param node The source file. + * @param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies. */ - function trySubstituteReservedName(name) { - var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); - if (token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */) { - return ts.createLiteral(name, /*location*/ name); + function collectAsynchronousDependencies(node, includeNonAmdDependencies) { + // names of modules with corresponding parameter in the factory function + var aliasedModuleNames = []; + // names of modules with no corresponding parameters in factory function + var unaliasedModuleNames = []; + // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding + // module names in aliasedModuleNames. + var importAliasNames = []; + // Fill in amd-dependency tags + for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { + var amdDependency = _a[_i]; + if (amdDependency.name) { + aliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, amdDependency.name)); + } + else { + unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + } } - return undefined; + for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { + var importNode = _c[_b]; + // Find the name of the external module + var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + // Find the name of the module alias, if there is one + var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); + // It is possible that externalModuleName is undefined if it is not string literal. + // This can happen in the invalid import syntax. + // E.g : "import * from alias from 'someLib';" + if (externalModuleName) { + if (includeNonAmdDependencies && importAliasName) { + // Set emitFlags on the name of the classDeclaration + // This is so that when printer will not substitute the identifier + ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */); + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName)); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; } - } - ts.transformES5 = transformES5; -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; -(function (ts) { - function transformES2015Module(context) { - var compilerOptions = context.getCompilerOptions(); - var previousOnEmitNode = context.onEmitNode; - var previousOnSubstituteNode = context.onSubstituteNode; - context.onEmitNode = onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261 /* SourceFile */); - context.enableSubstitution(70 /* Identifier */); - var currentSourceFile; - return transformSourceFile; - function transformSourceFile(node) { - if (ts.isDeclarationFile(node)) { - return node; + /** + * Transforms a SourceFile into an AMD or UMD module body. + * + * @param node The SourceFile node. + */ + function transformAsynchronousModuleBody(node) { + startLexicalEnvironment(); + var statements = []; + var statementOffset = ts.addPrologue(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + if (shouldEmitUnderscoreUnderscoreESModule()) { + ts.append(statements, createUnderscoreUnderscoreESModule()); } - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); - if (externalHelpersModuleName) { - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements); - ts.append(statements, ts.createImportDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); - ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); - return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); + // Visit each statement of the module body. + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement)); + ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); + // Append the 'export =' statement if provided. + addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true); + // End the lexical environment for the module body + // and merge any new lexical declarations. + ts.addRange(statements, endLexicalEnvironment()); + var body = ts.createBlock(statements, /*multiLine*/ true); + if (currentModuleInfo.hasExportStarsToExportValues) { + // If we have any `export * from ...` declarations + // we need to inform the emitter to add the __export helper. + ts.addEmitHelper(body, exportStarHelper); + } + return body; + } + /** + * Adds the down-level representation of `export=` to the statement list if one exists + * in the source file. + * + * @param statements The Statement list to modify. + * @param emitAsReturn A value indicating whether to emit the `export=` statement as a + * return statement. + */ + function addExportEqualsIfNeeded(statements, emitAsReturn) { + if (currentModuleInfo.exportEquals) { + if (emitAsReturn) { + var statement = ts.createReturn(currentModuleInfo.exportEquals.expression); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */); + statements.push(statement); } else { - return ts.visitEachChild(node, visitor, context); + var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression)); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 1536 /* NoComments */); + statements.push(statement); } } - return node; } - function visitor(node) { + // + // Top-Level Source Element Visitors + // + /** + * Visits a node at the top level of the source file. + * + * @param node The node to visit. + */ + function sourceElementVisitor(node) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - // Elide `import=` as it is not legal with --module ES6 - return undefined; - case 240 /* ExportAssignment */: + case 237 /* ImportDeclaration */: + return visitImportDeclaration(node); + case 236 /* ImportEqualsDeclaration */: + return visitImportEqualsDeclaration(node); + case 243 /* ExportDeclaration */: + return visitExportDeclaration(node); + case 242 /* ExportAssignment */: return visitExportAssignment(node); + case 207 /* VariableStatement */: + return visitVariableStatement(node); + case 227 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 228 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 296 /* MergeDeclarationMarker */: + return visitMergeDeclarationMarker(node); + case 297 /* EndOfDeclarationMarker */: + return visitEndOfDeclarationMarker(node); + default: + // This visitor does not descend into the tree, as export/import statements + // are only transformed at the top level of a file. + return node; } - return node; - } - function visitExportAssignment(node) { - // Elide `export=` as it is not legal with --module ES6 - return node.isExportEquals ? undefined : node; } - // - // Emit Notification - // /** - * Hook for node emit. + * Visits an ImportDeclaration node. * - * @param emitContext A context hint for the emitter. - * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. + * @param node The node to visit. */ - function onEmitNode(emitContext, node, emitCallback) { - if (ts.isSourceFile(node)) { - currentSourceFile = node; - previousOnEmitNode(emitContext, node, emitCallback); - currentSourceFile = undefined; + function visitImportDeclaration(node) { + var statements; + var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); + if (moduleKind !== ts.ModuleKind.AMD) { + if (!node.importClause) { + // import "mod"; + return ts.setTextRange(ts.createStatement(createRequireCall(node)), node); + } + else { + var variables = []; + if (namespaceDeclaration && !ts.isDefaultImport(node)) { + // import * as n from "mod"; + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, createRequireCall(node))); + } + else { + // import d from "mod"; + // import { x, y } from "mod"; + // import d, { x, y } from "mod"; + // import d, * as n from "mod"; + variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), + /*type*/ undefined, createRequireCall(node))); + if (namespaceDeclaration && ts.isDefaultImport(node)) { + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, ts.getGeneratedNameForNode(node))); + } + } + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(variables, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)), + /*location*/ node)); + } + } + else if (namespaceDeclaration && ts.isDefaultImport(node)) { + // import d, * as n from "mod"; + statements = ts.append(statements, ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.setTextRange(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, ts.getGeneratedNameForNode(node)), + /*location*/ node) + ], languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */))); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); } else { - previousOnEmitNode(emitContext, node, emitCallback); + statements = appendExportsOfImportDeclaration(statements, node); } + return ts.singleOrMany(statements); } - // - // Substitutions - // /** - * Hooks node substitutions. + * Creates a `require()` call to import an external module. * - * @param emitContext A context hint for the emitter. - * @param node The node to substitute. + * @param importNode The declararation to import. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (ts.isIdentifier(node) && emitContext === 1 /* Expression */) { - return substituteExpressionIdentifier(node); - } - return node; - } - function substituteExpressionIdentifier(node) { - if (ts.getEmitFlags(node) & 4096 /* HelperName */) { - var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); - if (externalHelpersModuleName) { - return ts.createPropertyAccess(externalHelpersModuleName, node); - } + function createRequireCall(importNode) { + var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + var args = []; + if (moduleName) { + args.push(moduleName); } - return node; + return ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, args); } - } - ts.transformES2015Module = transformES2015Module; -})(ts || (ts = {})); -/// -/// -/*@internal*/ -var ts; -(function (ts) { - function transformSystemModule(context) { - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; - var compilerOptions = context.getCompilerOptions(); - var resolver = context.getEmitResolver(); - var host = context.getEmitHost(); - var previousOnSubstituteNode = context.onSubstituteNode; - var previousOnEmitNode = context.onEmitNode; - context.onSubstituteNode = onSubstituteNode; - context.onEmitNode = onEmitNode; - context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. - var exportFunctionsMap = ts.createMap(); // The export function associated with a source file. - var noSubstitutionMap = ts.createMap(); // Set of nodes for which substitution rules should be ignored for each file. - var currentSourceFile; // The current file. - var moduleInfo; // ExternalModuleInfo for the current file. - var exportFunction; // The export function for the current file. - var contextObject; // The context object for the current file. - var hoistedStatements; - var enclosingBlockScopedContainer; - var noSubstitution; // Set of nodes for which substitution rules should be ignored. - return transformSourceFile; /** - * Transforms the module aspects of a SourceFile. + * Visits an ImportEqualsDeclaration node. * - * @param node The SourceFile node. + * @param node The node to visit. */ - function transformSourceFile(node) { - if (ts.isDeclarationFile(node) - || !(ts.isExternalModule(node) - || compilerOptions.isolatedModules)) { - return node; - } - var id = ts.getOriginalNodeId(node); - currentSourceFile = node; - enclosingBlockScopedContainer = node; - // System modules have the following shape: - // - // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) - // - // The parameter 'exports' here is a callback '(name: string, value: T) => T' that - // is used to publish exported values. 'exports' returns its 'value' argument so in - // most cases expressions that mutate exported values can be rewritten as: - // - // expr -> exports('name', expr) - // - // The only exception in this rule is postfix unary operators, - // see comment to 'substitutePostfixUnaryExpression' for more details - // Collect information about the external module and dependency groups. - moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - // Make sure that the name of the 'exports' function does not conflict with - // existing identifiers. - exportFunction = exportFunctionsMap[id] = ts.createUniqueName("exports"); - contextObject = ts.createUniqueName("context"); - // Add the body of the module. - var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); - var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); - var moduleBodyFunction = ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) - ], - /*type*/ undefined, moduleBodyBlock); - // Write the call to `System.register` - // Clear the emit-helpers flag for later passes since we'll have already used it in the module body - // So the helper will be emit at the correct position instead of at the top of the source-file - var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray([ - ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), - /*typeArguments*/ undefined, moduleName - ? [moduleName, dependencies, moduleBodyFunction] - : [dependencies, moduleBodyFunction])) - ], node.statements)); - if (!(compilerOptions.outFile || compilerOptions.out)) { - ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); - } - if (noSubstitution) { - noSubstitutionMap[id] = noSubstitution; - noSubstitution = undefined; - } - currentSourceFile = undefined; - moduleInfo = undefined; - exportFunction = undefined; - contextObject = undefined; - hoistedStatements = undefined; - enclosingBlockScopedContainer = undefined; - return ts.aggregateTransformFlags(updated); - } - /** - * Collects the dependency groups for this files imports. - * - * @param externalImports The imports for the file. - */ - function collectDependencyGroups(externalImports) { - var groupIndices = ts.createMap(); - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; i++) { - var externalImport = externalImports[i]; - var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); - var text = externalModuleName.text; - if (ts.hasProperty(groupIndices, text)) { - // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].externalImports.push(externalImport); + function visitImportEqualsDeclaration(node) { + ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + var statements; + if (moduleKind !== ts.ModuleKind.AMD) { + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(node.name, createRequireCall(node))), node)); } else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push({ - name: externalModuleName, - externalImports: [externalImport] - }); - } - } - return dependencyGroups; - } - /** - * Adds the statements for the module body function for the source file. - * - * @param node The source file for the module. - * @param dependencyGroups The grouped dependencies of the module. - */ - function createSystemModuleBody(node, dependencyGroups) { - // Shape of the body in system modules: - // - // function (exports) { - // - // - // - // return { - // setters: [ - // - // ], - // execute: function() { - // - // } - // } - // - // } - // - // i.e: - // - // import {x} from 'file1' - // var y = 1; - // export function foo() { return y + x(); } - // console.log(y); - // - // Will be transformed to: - // - // function(exports) { - // function foo() { return y + file_1.x(); } - // exports("foo", foo); - // var file_1, y; - // return { - // setters: [ - // function(v) { file_1 = v } - // ], - // execute(): function() { - // y = 1; - // console.log(y); - // } - // }; - // } - var statements = []; - // We start a new lexical environment in this function body, but *not* in the - // body of the execute function. This allows us to emit temporary declarations - // only in the outer module body and not in the inner one. - startLexicalEnvironment(); - // Add any prologue directives. - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - // var __moduleName = context_1 && context_1.id; - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration("__moduleName", - /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) - ]))); - // Visit the synthetic external helpers import declaration if present - ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true); - // Visit the statements of the source file, emitting any transformations into - // the `executeStatements` array. We do this *before* we fill the `setters` array - // as we both emit transformations as well as aggregate some data used when creating - // setters. This allows us to reduce the number of times we need to loop through the - // statements of the source file. - var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); - // Emit early exports for function declarations. - ts.addRange(statements, hoistedStatements); - // We emit hoisted variables early to align roughly with our previous emit output. - // Two key differences in this approach are: - // - Temporary variables will appear at the top rather than at the bottom of the file - ts.addRange(statements, endLexicalEnvironment()); - var exportStarFunction = addExportStarIfNeeded(statements); - statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([ - ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), - ts.createPropertyAssignment("execute", ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, - /*parameters*/ [], - /*type*/ undefined, ts.createBlock(executeStatements, - /*location*/ undefined, - /*multiLine*/ true))) - ]), - /*multiLine*/ true))); - return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); - } - /** - * Adds an exportStar function to a statement list if it is needed for the file. - * - * @param statements A statement list. - */ - function addExportStarIfNeeded(statements) { - if (!moduleInfo.hasExportStarsToExportValues) { - return; - } - // when resolving exports local exported entries/indirect exported entries in the module - // should always win over entries with similar names that were added via star exports - // to support this we store names of local/indirect exported entries in a set. - // this set is used to filter names brought by star expors. - // local names set should only be added if we have anything exported - if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { - // no exported declarations (export var ...) or export specifiers (export {x}) - // check if we have any non star export declarations. - var hasExportDeclarationWithExportClause = false; - for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { - var externalImport = _a[_i]; - if (externalImport.kind === 241 /* ExportDeclaration */ && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - // we still need to emit exportStar helper - var exportStarFunction_1 = createExportStarFunction(/*localNames*/ undefined); - statements.push(exportStarFunction_1); - return exportStarFunction_1.name; - } - } - var exportedNames = []; - if (moduleInfo.exportedNames) { - for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { - var exportedLocalName = _c[_b]; - if (exportedLocalName.text === "default") { - continue; - } - // write name of exported declaration, i.e 'export var x...' - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true))); - } - } - for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { - var externalImport = _e[_d]; - if (externalImport.kind !== 241 /* ExportDeclaration */) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - // export * from ... - continue; - } - for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { - var element = _g[_f]; - // write name of indirectly exported entry, i.e. 'export {x} from ...' - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true))); + statements = ts.append(statements, ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), + /*type*/ undefined, createRequireCall(node)) + ], + /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)), node)); } } - var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exportedNamesStorageRef, - /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*location*/ undefined, /*multiline*/ true)) - ]))); - var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); - statements.push(exportStarFunction); - return exportStarFunction.name; - } - /** - * Creates an exportStar function for the file, with an optional set of excluded local - * names. - * - * @param localNames An optional reference to an object containing a set of excluded local - * names. - */ - function createExportStarFunction(localNames) { - var exportStarFunction = ts.createUniqueName("exportStar"); - var m = ts.createIdentifier("m"); - var n = ts.createIdentifier("n"); - var exports = ts.createIdentifier("exports"); - var condition = ts.createStrictInequality(n, ts.createLiteral("default")); - if (localNames) { - condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), - /*typeArguments*/ undefined, [n]))); - } - return ts.createFunctionDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, exportStarFunction, - /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, m)], - /*type*/ undefined, ts.createBlock([ - ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(exports, - /*type*/ undefined, ts.createObjectLiteral([])) - ])), - ts.createForIn(ts.createVariableDeclarationList([ - ts.createVariableDeclaration(n, /*type*/ undefined) - ]), m, ts.createBlock([ - ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */) - ])), - ts.createStatement(ts.createCall(exportFunction, - /*typeArguments*/ undefined, [exports])) - ], - /*location*/ undefined, - /*multiline*/ true)); - } - /** - * Creates an array setter callbacks for each dependency group. - * - * @param exportStarFunction A reference to an exportStarFunction for the file. - * @param dependencyGroups An array of grouped dependencies. - */ - function createSettersArray(exportStarFunction, dependencyGroups) { - var setters = []; - for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { - var group = dependencyGroups_1[_i]; - // derive a unique name for parameter from the first named entry in the group - var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); }); - var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""); - var statements = []; - for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) { - var entry = _b[_a]; - var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); - switch (entry.kind) { - case 235 /* ImportDeclaration */: - if (!entry.importClause) { - // 'import "..."' case - // module is imported only for side-effects, no emit required - break; - } - // fall-through - case 234 /* ImportEqualsDeclaration */: - ts.Debug.assert(importVariableName !== undefined); - // save import into the local - statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); - break; - case 241 /* ExportDeclaration */: - ts.Debug.assert(importVariableName !== undefined); - if (entry.exportClause) { - // export {a, b as c} from 'foo' - // - // emit as: - // - // exports_({ - // "a": _["a"], - // "c": _["b"] - // }); - var properties = []; - for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { - var e = _d[_c]; - properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); - } - statements.push(ts.createStatement(ts.createCall(exportFunction, - /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*location*/ undefined, /*multiline*/ true)]))); - } - else { - // export * from 'foo' - // - // emit as: - // - // exportStar(foo_1_1); - statements.push(ts.createStatement(ts.createCall(exportStarFunction, - /*typeArguments*/ undefined, [parameterName]))); - } - break; - } + else { + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node))), node)); } - setters.push(ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], - /*type*/ undefined, ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true))); - } - return ts.createArrayLiteral(setters, /*location*/ undefined, /*multiLine*/ true); - } - // - // Top-level Source Element Visitors - // - /** - * Visit source elements at the top-level of a module. - * - * @param node The node to visit. - */ - function sourceElementVisitor(node) { - switch (node.kind) { - case 235 /* ImportDeclaration */: - return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: - return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: - // ExportDeclarations are elided as they are handled via - // `appendExportsOfDeclaration`. - return undefined; - case 240 /* ExportAssignment */: - return visitExportAssignment(node); - default: - return nestedElementVisitor(node); - } - } - /** - * Visits an ImportDeclaration node. - * - * @param node The node to visit. - */ - function visitImportDeclaration(node) { - var statements; - if (node.importClause) { - hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); } else { - statements = appendExportsOfImportDeclaration(statements, node); + statements = appendExportsOfImportEqualsDeclaration(statements, node); } return ts.singleOrMany(statements); } /** - * Visits an ImportEqualsDeclaration node. + * Visits an ExportDeclaration node. * - * @param node The node to visit. + * @param The node to visit. */ - function visitImportEqualsDeclaration(node) { - ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); - var statements; - hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); - if (hasAssociatedEndOfDeclarationMarker(node)) { - // Defer exports until we encounter an EndOfDeclarationMarker node - var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + function visitExportDeclaration(node) { + if (!node.moduleSpecifier) { + // Elide export declarations with no module specifier as they are handled + // elsewhere. + return undefined; + } + var generatedName = ts.getGeneratedNameForNode(node); + if (node.exportClause) { + var statements = []; + // export { x, y } from "mod"; + if (moduleKind !== ts.ModuleKind.AMD) { + statements.push(ts.setTextRange(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(generatedName, + /*type*/ undefined, createRequireCall(node)) + ])), + /*location*/ node)); + } + for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { + var specifier = _a[_i]; + var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); + statements.push(ts.setTextRange(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue)), specifier)); + } + return ts.singleOrMany(statements); } else { - statements = appendExportsOfImportEqualsDeclaration(statements, node); + // export * from "mod"; + return ts.setTextRange(ts.createStatement(ts.createCall(ts.createIdentifier("__export"), + /*typeArguments*/ undefined, [ + moduleKind !== ts.ModuleKind.AMD + ? createRequireCall(node) + : generatedName + ])), node); } - return ts.singleOrMany(statements); } /** * Visits an ExportAssignment node. @@ -54830,33 +59016,37 @@ var ts; */ function visitExportAssignment(node) { if (node.isExportEquals) { - // Elide `export=` as it is illegal in a SystemJS module. return undefined; } - var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression); + var statements; var original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, /*allowComments*/ true); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); } else { - return createExportStatement(ts.createIdentifier("default"), expression, /*allowComments*/ true); + statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); } + return ts.singleOrMany(statements); } /** - * Visits a FunctionDeclaration, hoisting it to the outer module body function. + * Visits a FunctionDeclaration node. * * @param node The node to visit. */ function visitFunctionDeclaration(node) { + var statements; if (ts.hasModifier(node, 1 /* Export */)) { - hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), - /*typeParameters*/ undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), - /*type*/ undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createFunctionDeclaration( + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, node.parameters, + /*type*/ undefined, node.body), + /*location*/ node), + /*original*/ node)); } else { - hoistedStatements = ts.append(hoistedStatements, node); + statements = ts.append(statements, node); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node @@ -54864,26 +59054,25 @@ var ts; deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { - hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); + statements = appendExportsOfHoistedDeclaration(statements, node); } - return undefined; + return ts.singleOrMany(statements); } /** - * Visits a ClassDeclaration, hoisting its name to the outer module body function. + * Visits a ClassDeclaration node. * * @param node The node to visit. */ function visitClassDeclaration(node) { var statements; - // Hoist the name of the class declaration to the outer module body function. - var name = ts.getLocalName(node); - hoistVariableDeclaration(name); - // Rewrite the class declaration into an assignment of a class expression. - statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression( - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), - /*location*/ node)), - /*location*/ node)); + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration( + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, node.heritageClauses, node.members), node), node)); + } + else { + statements = ts.append(statements, node); + } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); @@ -54895,116 +59084,65 @@ var ts; return ts.singleOrMany(statements); } /** - * Visits a variable statement, hoisting declared names to the top-level module body. - * Each declaration is rewritten into an assignment expression. + * Visits a VariableStatement node. * * @param node The node to visit. */ function visitVariableStatement(node) { - if (!shouldHoistVariableDeclarationList(node.declarationList)) { - return ts.visitNode(node, destructuringVisitor, ts.isStatement); - } + var statements; + var variables; var expressions; - var isExportedDeclaration = ts.hasModifier(node, 1 /* Export */); - var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); - for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - if (variable.initializer) { - expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); + if (ts.hasModifier(node, 1 /* Export */)) { + var modifiers = void 0; + // If we're exporting these variables, then these just become assignments to 'exports.x'. + // We only want to emit assignments for variables with initializers. + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) { + if (!modifiers) { + modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier); + } + variables = ts.append(variables, variable); + } + else if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable)); + } } - else { - hoistBindingElement(variable); + if (variables) { + statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); + } + if (expressions) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } } - var statements; - if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node)); + else { + statements = ts.append(statements, node); } - if (isMarkedDeclaration) { + if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); } else { - statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false); + statements = appendExportsOfVariableStatement(statements, node); } return ts.singleOrMany(statements); } /** - * Hoists the declared names of a VariableDeclaration or BindingElement. - * - * @param node The declaration to hoist. - */ - function hoistBindingElement(node) { - if (ts.isBindingPattern(node.name)) { - for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!ts.isOmittedExpression(element)) { - hoistBindingElement(element); - } - } - } - else { - hoistVariableDeclaration(ts.getSynthesizedClone(node.name)); - } - } - /** - * Determines whether a VariableDeclarationList should be hoisted. - * - * @param node The node to test. - */ - function shouldHoistVariableDeclarationList(node) { - // hoist only non-block scoped declarations or block scoped declarations parented by source file - return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */ - || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); - } - /** - * Transform an initialized variable declaration into an expression. + * Transforms an exported variable with an initializer into an expression. * * @param node The node to transform. - * @param isExportedDeclaration A value indicating whether the variable is exported. - */ - function transformInitializedVariable(node, isExportedDeclaration) { - var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; - return ts.isBindingPattern(node.name) - ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, - /*needsValue*/ false, createAssignment) - : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); - } - /** - * Creates an assignment expression for an exported variable declaration. - * - * @param name The name of the variable. - * @param value The value of the variable's initializer. - * @param location The source map location for the assignment. - */ - function createExportedVariableAssignment(name, value, location) { - return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ true); - } - /** - * Creates an assignment expression for a non-exported variable declaration. - * - * @param name The name of the variable. - * @param value The value of the variable's initializer. - * @param location The source map location for the assignment. - */ - function createNonExportedVariableAssignment(name, value, location) { - return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ false); - } - /** - * Creates an assignment expression for a variable declaration. - * - * @param name The name of the variable. - * @param value The value of the variable's initializer. - * @param location The source map location for the assignment. - * @param isExportedDeclaration A value indicating whether the variable is exported. */ - function createVariableAssignment(name, value, location, isExportedDeclaration) { - hoistVariableDeclaration(ts.getSynthesizedClone(name)); - return isExportedDeclaration - ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location))) - : preventSubstitution(ts.createAssignment(name, value, location)); + function transformInitializedVariable(node) { + if (ts.isBindingPattern(node.name)) { + return ts.flattenDestructuringAssignment(node, + /*visitor*/ undefined, context, 0 /* All */, + /*needsValue*/ false, createExportExpression); + } + else { + return ts.createAssignment(ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name), + /*location*/ node.name), node.initializer); + } } /** * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged @@ -55018,12 +59156,11 @@ var ts; // begin/end semantics of the declararation and to properly handle exports // we wrapped the leading variable declaration in a `MergeDeclarationMarker`. // - // To balance the declaration, we defer the exports of the elided variable - // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + // To balance the declaration, add the exports of the elided variable + // statement. + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); - var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } return node; } @@ -55063,7 +59200,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } var importClause = decl.importClause; @@ -55076,10 +59213,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -55090,7 +59227,7 @@ var ts; return statements; } /** - * Appends the export of an ImportEqualsDeclaration to a statement list, returning the + * Appends the exports of an ImportEqualsDeclaration to a statement list, returning the * statement list. * * @param statements A statement list to which the down-level export statements are to be @@ -55099,7 +59236,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportEqualsDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } return appendExportsOfDeclaration(statements, decl); @@ -55112,18 +59249,14 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param node The VariableStatement whose exports are to be recorded. - * @param exportSelf A value indicating whether to also export each VariableDeclaration of - * `nodes` declaration list. */ - function appendExportsOfVariableStatement(statements, node, exportSelf) { - if (moduleInfo.exportEquals) { + function appendExportsOfVariableStatement(statements, node) { + if (currentModuleInfo.exportEquals) { return statements; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.initializer || exportSelf) { - statements = appendExportsOfBindingElement(statements, decl, exportSelf); - } + statements = appendExportsOfBindingElement(statements, decl); } return statements; } @@ -55135,27 +59268,21 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration whose exports are to be recorded. - * @param exportSelf A value indicating whether to also export the declaration itself. */ - function appendExportsOfBindingElement(statements, decl, exportSelf) { - if (moduleInfo.exportEquals) { + function appendExportsOfBindingElement(statements, decl) { + if (currentModuleInfo.exportEquals) { return statements; } if (ts.isBindingPattern(decl.name)) { for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { - statements = appendExportsOfBindingElement(statements, element, exportSelf); + statements = appendExportsOfBindingElement(statements, element); } } } else if (!ts.isGeneratedIdentifier(decl.name)) { - var excludeName = void 0; - if (exportSelf) { - statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); - excludeName = decl.name.text; - } - statements = appendExportsOfDeclaration(statements, decl, excludeName); + statements = appendExportsOfDeclaration(statements, decl); } return statements; } @@ -55169,17 +59296,15 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfHoistedDeclaration(statements, decl) { - if (moduleInfo.exportEquals) { + if (currentModuleInfo.exportEquals) { return statements; } - var excludeName; if (ts.hasModifier(decl, 1 /* Export */)) { - var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createLiteral("default") : decl.name; - statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); - excludeName = exportName.text; + var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createIdentifier("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), /*location*/ decl); } if (decl.name) { - statements = appendExportsOfDeclaration(statements, decl, excludeName); + statements = appendExportsOfDeclaration(statements, decl); } return statements; } @@ -55190,20 +59315,14 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration to export. - * @param excludeName An optional name to exclude from exports. */ - function appendExportsOfDeclaration(statements, decl, excludeName) { - if (moduleInfo.exportEquals) { - return statements; - } + function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; - if (exportSpecifier.name.text !== excludeName) { - statements = appendExportStatement(statements, exportSpecifier.name, name); - } + statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name); } } return statements; @@ -55217,21 +59336,41 @@ var ts; * appended. * @param exportName The name of the export. * @param expression The expression to export. + * @param location The location to use for source maps and comments for the export. * @param allowComments Whether to allow comments on the export. */ - function appendExportStatement(statements, exportName, expression, allowComments) { - statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)); + function appendExportStatement(statements, exportName, expression, location, allowComments) { + statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); return statements; } + function createUnderscoreUnderscoreESModule() { + var statement; + if (languageVersion === 0 /* ES3 */) { + statement = ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(/*value*/ true))); + } + else { + statement = ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("exports"), + ts.createLiteral("__esModule"), + ts.createObjectLiteral([ + ts.createPropertyAssignment("value", ts.createLiteral(/*value*/ true)) + ]) + ])); + } + ts.setEmitFlags(statement, 524288 /* CustomPrologue */); + return statement; + } /** * Creates a call to the current file's export function to export a value. * * @param name The bound name of the export. * @param value The exported value. + * @param location The location to use for source maps and comments for the export. * @param allowComments An optional value indicating whether to emit comments for the statement. */ - function createExportStatement(name, value, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value)); + function createExportStatement(name, value, location, allowComments) { + var statement = ts.setTextRange(ts.createStatement(createExportExpression(name, value)), location); ts.startOnNewLine(statement); if (!allowComments) { ts.setEmitFlags(statement, 1536 /* NoComments */); @@ -55243,290 +59382,10 @@ var ts; * * @param name The bound name of the export. * @param value The exported value. + * @param location The location to use for source maps and comments for the export. */ - function createExportExpression(name, value) { - var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; - return ts.createCall(exportFunction, /*typeArguments*/ undefined, [exportName, value]); - } - // - // Top-Level or Nested Source Element Visitors - // - /** - * Visit nested elements at the top-level of a module. - * - * @param node The node to visit. - */ - function nestedElementVisitor(node) { - switch (node.kind) { - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: - return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: - return visitClassDeclaration(node); - case 211 /* ForStatement */: - return visitForStatement(node); - case 212 /* ForInStatement */: - return visitForInStatement(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 209 /* DoStatement */: - return visitDoStatement(node); - case 210 /* WhileStatement */: - return visitWhileStatement(node); - case 219 /* LabeledStatement */: - return visitLabeledStatement(node); - case 217 /* WithStatement */: - return visitWithStatement(node); - case 218 /* SwitchStatement */: - return visitSwitchStatement(node); - case 232 /* CaseBlock */: - return visitCaseBlock(node); - case 253 /* CaseClause */: - return visitCaseClause(node); - case 254 /* DefaultClause */: - return visitDefaultClause(node); - case 221 /* TryStatement */: - return visitTryStatement(node); - case 256 /* CatchClause */: - return visitCatchClause(node); - case 204 /* Block */: - return visitBlock(node); - case 295 /* MergeDeclarationMarker */: - return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: - return visitEndOfDeclarationMarker(node); - default: - return destructuringVisitor(node); - } - } - /** - * Visits the body of a ForStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitForStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a ForInStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitForInStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a ForOfStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitForOfStatement(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Determines whether to hoist the initializer of a ForStatement, ForInStatement, or - * ForOfStatement. - * - * @param node The node to test. - */ - function shouldHoistForInitializer(node) { - return ts.isVariableDeclarationList(node) - && shouldHoistVariableDeclarationList(node); - } - /** - * Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement - * - * @param node The node to visit. - */ - function visitForInitializer(node) { - if (shouldHoistForInitializer(node)) { - var expressions = void 0; - for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); - } - return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); - } - else { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - } - /** - * Visits the body of a DoStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitDoStatement(node) { - return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); - } - /** - * Visits the body of a WhileStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitWhileStatement(node) { - return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - } - /** - * Visits the body of a LabeledStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitLabeledStatement(node) { - return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - } - /** - * Visits the body of a WithStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitWithStatement(node) { - return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); - } - /** - * Visits the body of a SwitchStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitSwitchStatement(node) { - return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); - } - /** - * Visits the body of a CaseBlock to hoist declarations. - * - * @param node The node to visit. - */ - function visitCaseBlock(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a CaseClause to hoist declarations. - * - * @param node The node to visit. - */ - function visitCaseClause(node) { - return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)); - } - /** - * Visits the body of a DefaultClause to hoist declarations. - * - * @param node The node to visit. - */ - function visitDefaultClause(node) { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - /** - * Visits the body of a TryStatement to hoist declarations. - * - * @param node The node to visit. - */ - function visitTryStatement(node) { - return ts.visitEachChild(node, nestedElementVisitor, context); - } - /** - * Visits the body of a CatchClause to hoist declarations. - * - * @param node The node to visit. - */ - function visitCatchClause(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - /** - * Visits the body of a Block to hoist declarations. - * - * @param node The node to visit. - */ - function visitBlock(node) { - var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; - enclosingBlockScopedContainer = node; - node = ts.visitEachChild(node, nestedElementVisitor, context); - enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; - return node; - } - // - // Destructuring Assignment Visitors - // - /** - * Visit nodes to flatten destructuring assignments to exported symbols. - * - * @param node The node to visit. - */ - function destructuringVisitor(node) { - if (node.transformFlags & 1024 /* DestructuringAssignment */ - && node.kind === 192 /* BinaryExpression */) { - return visitDestructuringAssignment(node); - } - else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { - return ts.visitEachChild(node, destructuringVisitor, context); - } - else { - return node; - } - } - /** - * Visits a DestructuringAssignment to flatten destructuring to exported symbols. - * - * @param node The node to visit. - */ - function visitDestructuringAssignment(node) { - if (hasExportedReferenceInDestructuringTarget(node.left)) { - return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, - /*needsValue*/ true); - } - return ts.visitEachChild(node, destructuringVisitor, context); - } - /** - * Determines whether the target of a destructuring assigment refers to an exported symbol. - * - * @param node The destructuring target. - */ - function hasExportedReferenceInDestructuringTarget(node) { - if (ts.isAssignmentExpression(node)) { - return hasExportedReferenceInDestructuringTarget(node.left); - } - else if (ts.isSpreadExpression(node)) { - return hasExportedReferenceInDestructuringTarget(node.expression); - } - else if (ts.isObjectLiteralExpression(node)) { - return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); - } - else if (ts.isArrayLiteralExpression(node)) { - return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); - } - else if (ts.isShorthandPropertyAssignment(node)) { - return hasExportedReferenceInDestructuringTarget(node.name); - } - else if (ts.isPropertyAssignment(node)) { - return hasExportedReferenceInDestructuringTarget(node.initializer); - } - else if (ts.isIdentifier(node)) { - var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261 /* SourceFile */; - } - else { - return false; - } + function createExportExpression(name, value, location) { + return ts.setTextRange(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value), location); } // // Modifier Visitors @@ -55537,6 +59396,7 @@ var ts; * @param node The node to visit. */ function modifierVisitor(node) { + // Elide module-specific modifiers. switch (node.kind) { case 83 /* ExportKeyword */: case 78 /* DefaultKeyword */: @@ -55550,28 +59410,22 @@ var ts; /** * Hook for node emit notifications. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emit A callback used to emit the node in the printer. */ - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { - var id = ts.getOriginalNodeId(node); + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264 /* SourceFile */) { currentSourceFile = node; - moduleInfo = moduleInfoMap[id]; - exportFunction = exportFunctionsMap[id]; - noSubstitution = noSubstitutionMap[id]; - if (noSubstitution) { - delete noSubstitutionMap[id]; - } - previousOnEmitNode(emitContext, node, emitCallback); + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; + noSubstitution = []; + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; - moduleInfo = undefined; - exportFunction = undefined; + currentModuleInfo = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } // @@ -55580,21 +59434,44 @@ var ts; /** * Hooks node substitutions. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (isSubstitutionPrevented(node)) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (node.id && noSubstitution[node.id]) { return node; } - if (emitContext === 1 /* Expression */) { + if (hint === 1 /* Expression */) { return substituteExpression(node); } + else if (ts.isShorthandPropertyAssignment(node)) { + return substituteShorthandPropertyAssignment(node); + } return node; } /** - * Substitute the expression, if necessary. + * Substitution for a ShorthandPropertyAssignment whose declaration name is an imported + * or exported symbol. + * + * @param node The node to substitute. + */ + function substituteShorthandPropertyAssignment(node) { + var name = node.name; + var exportedOrImportedName = substituteExpressionIdentifier(name); + if (exportedOrImportedName !== name) { + // A shorthand property with an assignment initializer is probably part of a + // destructuring assignment + if (node.objectAssignmentInitializer) { + var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); + return ts.setTextRange(ts.createPropertyAssignment(name, initializer), node); + } + return ts.setTextRange(ts.createPropertyAssignment(name, exportedOrImportedName), node); + } + return node; + } + /** + * Substitution for an Expression that may contain an imported or exported symbol. * * @param node The node to substitute. */ @@ -55602,16 +59479,17 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 190 /* PrefixUnaryExpression */: - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; } /** - * Substitution for an Identifier expression that may contain an imported or exported symbol. + * Substitution for an Identifier expression that may contain an imported or exported + * symbol. * * @param node The node to substitute. */ @@ -55623,21 +59501,21 @@ var ts; } return node; } - // When we see an identifier in an expression position that - // points to an imported symbol, we should substitute a qualified - // reference to the imported symbol if one is needed. - // - // - We do not substitute generated identifiers for any reason. - // - We do not substitute identifiers tagged with the LocalName flag. if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { + var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); + if (exportContainer && exportContainer.kind === 264 /* SourceFile */) { + return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), + /*location*/ node); + } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), + var name = importDeclaration.propertyName || importDeclaration.name; + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name)), /*location*/ node); } } @@ -55669,7 +59547,9 @@ var ts; var expression = node; for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) { var exportName = exportedNames_1[_i]; - expression = createExportExpression(exportName, preventSubstitution(expression)); + // Mark the node to prevent triggering this rule again. + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression, /*location*/ node); } return expression; } @@ -55698,18 +59578,15 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ - ? ts.createPrefix(node.operator, node.operand, + var expression = node.kind === 192 /* PostfixUnaryExpression */ + ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1)), /*location*/ node) : node; for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { var exportName = exportedNames_2[_i]; - expression = createExportExpression(exportName, preventSubstitution(expression)); - } - if (node.kind === 191 /* PostfixUnaryExpression */) { - expression = node.operator === 42 /* PlusPlusToken */ - ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) - : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); + // Mark the node to prevent triggering this rule again. + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression); } return expression; } @@ -55717,79 +59594,59 @@ var ts; return node; } /** - * Gets the exports of a name. + * Gets the additional exports of a name. * * @param name The name. */ function getExports(name) { - var exportedNames; if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { - var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { - exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); - } - exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); + return currentModuleInfo + && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; } } - return exportedNames; - } - /** - * Prevent substitution of a node for this transformer. - * - * @param node The node which should not be substituted. - */ - function preventSubstitution(node) { - if (noSubstitution === undefined) - noSubstitution = ts.createMap(); - noSubstitution[ts.getNodeId(node)] = true; - return node; - } - /** - * Determines whether a node should not be substituted. - * - * @param node The node to test. - */ - function isSubstitutionPrevented(node) { - return noSubstitution && node.id && noSubstitution[node.id]; } } - ts.transformSystemModule = transformSystemModule; + ts.transformModule = transformModule; + // emit output for the __export helper function + var exportStarHelper = { + name: "typescript:export-star", + scoped: true, + text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" + }; })(ts || (ts = {})); /// /// +/// /*@internal*/ var ts; (function (ts) { - function transformModule(context) { - var transformModuleDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.None] = transformCommonJSModule, - _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, - _a[ts.ModuleKind.AMD] = transformAMDModule, - _a[ts.ModuleKind.UMD] = transformUMDModule, - _a)); - var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + function transformSystemModule(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var compilerOptions = context.getCompilerOptions(); var resolver = context.getEmitResolver(); var host = context.getEmitHost(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var moduleKind = ts.getEmitModuleKind(compilerOptions); var previousOnSubstituteNode = context.onSubstituteNode; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. - var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. - var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. + context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols. + context.enableSubstitution(193 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(191 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(192 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(264 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = []; // The ExternalModuleInfo for each file. + var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. + var exportFunctionsMap = []; // The export function associated with a source file. + var noSubstitutionMap = []; // Set of nodes for which substitution rules should be ignored for each file. var currentSourceFile; // The current file. - var currentModuleInfo; // The ExternalModuleInfo for the current file. + var moduleInfo; // ExternalModuleInfo for the current file. + var exportFunction; // The export function for the current file. + var contextObject; // The context object for the current file. + var hoistedStatements; + var enclosingBlockScopedContainer; var noSubstitution; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; /** @@ -55803,238 +59660,383 @@ var ts; || compilerOptions.isolatedModules)) { return node; } + var id = ts.getOriginalNodeId(node); currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(node)] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); - // Perform the transformation. - var transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ts.ModuleKind.None]; - var updated = transformModule(node); - currentSourceFile = undefined; - currentModuleInfo = undefined; - return ts.aggregateTransformFlags(updated); - } - /** - * Transforms a SourceFile into a CommonJS module. - * - * @param node The SourceFile node. - */ - function transformCommonJSModule(node) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - ts.addRange(statements, endLexicalEnvironment()); - addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); - var updated = ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); - if (currentModuleInfo.hasExportStarsToExportValues) { - ts.addEmitHelper(updated, exportStarHelper); - } - return updated; - } - /** - * Transforms a SourceFile into an AMD module. - * - * @param node The SourceFile node. - */ - function transformAMDModule(node) { - var define = ts.createIdentifier("define"); + enclosingBlockScopedContainer = node; + // System modules have the following shape: + // + // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) + // + // The parameter 'exports' here is a callback '(name: string, value: T) => T' that + // is used to publish exported values. 'exports' returns its 'value' argument so in + // most cases expressions that mutate exported values can be rewritten as: + // + // expr -> exports('name', expr) + // + // The only exception in this rule is postfix unary operators, + // see comment to 'substitutePostfixUnaryExpression' for more details + // Collect information about the external module and dependency groups. + moduleInfo = moduleInfoMap[id] = ts.collectExternalModuleInfo(node, resolver, compilerOptions); + // Make sure that the name of the 'exports' function does not conflict with + // existing identifiers. + exportFunction = ts.createUniqueName("exports"); + exportFunctionsMap[id] = exportFunction; + contextObject = ts.createUniqueName("context"); + // Add the body of the module. + var dependencyGroups = collectDependencyGroups(moduleInfo.externalImports); + var moduleBodyBlock = createSystemModuleBody(node, dependencyGroups); + var moduleBodyFunction = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) + ], + /*type*/ undefined, moduleBodyBlock); + // Write the call to `System.register` + // Clear the emit-helpers flag for later passes since we'll have already used it in the module body + // So the helper will be emit at the correct position instead of at the top of the source-file var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true); + var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray([ + ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), + /*typeArguments*/ undefined, moduleName + ? [moduleName, dependencies, moduleBodyFunction] + : [dependencies, moduleBodyFunction])) + ]), node.statements)), 1024 /* NoTrailingComments */); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); + } + if (noSubstitution) { + noSubstitutionMap[id] = noSubstitution; + noSubstitution = undefined; + } + currentSourceFile = undefined; + moduleInfo = undefined; + exportFunction = undefined; + contextObject = undefined; + hoistedStatements = undefined; + enclosingBlockScopedContainer = undefined; + return ts.aggregateTransformFlags(updated); } /** - * Transforms a SourceFile into a UMD module. + * Collects the dependency groups for this files imports. * - * @param node The SourceFile node. + * @param externalImports The imports for the file. */ - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); + function collectDependencyGroups(externalImports) { + var groupIndices = ts.createMap(); + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; i++) { + var externalImport = externalImports[i]; + var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); + if (externalModuleName) { + var text = externalModuleName.text; + var groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { + // deduplicate/group entries in dependency list by the dependency name + dependencyGroups[groupIndex].externalImports.push(externalImport); + } + else { + groupIndices.set(text, dependencyGroups.length); + dependencyGroups.push({ + name: externalModuleName, + externalImports: [externalImport] + }); + } + } + } + return dependencyGroups; } /** - * Transforms a SourceFile into an AMD or UMD module. + * Adds the statements for the module body function for the source file. * - * @param node The SourceFile node. - * @param define The expression used to define the module. - * @param moduleName An expression for the module name, if available. - * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies. + * @param node The source file for the module. + * @param dependencyGroups The grouped dependencies of the module. */ - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - // An AMD define function has the following shape: - // - // define(id?, dependencies?, factory); - // - // This has the shape of the following: - // - // define(name, ["module1", "module2"], function (module1Alias) { ... } - // - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: + function createSystemModuleBody(node, dependencyGroups) { + // Shape of the body in system modules: // - // import "module" + // function (exports) { + // + // + // + // return { + // setters: [ + // + // ], + // execute: function() { + // + // } + // } + // + // } // - // or + // i.e: // - // /// + // import {x} from 'file1' + // var y = 1; + // export function foo() { return y + x(); } + // console.log(y); // - // we need to add modules without alias names to the end of the dependencies list - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; - // Create an updated SourceFile: + // Will be transformed to: // - // define(moduleName?, ["module1", "module2"], function ... - return ts.updateSourceFileNode(node, ts.createNodeArray([ - ts.createStatement(ts.createCall(define, - /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([ - // Add the dependency array argument: - // - // ["require", "exports", module1", "module2", ...] - ts.createArrayLiteral([ - ts.createLiteral("require"), - ts.createLiteral("exports") - ].concat(aliasedModuleNames, unaliasedModuleNames)), - // Add the module body function argument: - // - // function (require, exports, module1, module2) ... - ts.createFunctionExpression( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, [ - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), - ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") - ].concat(importAliasNames), - /*type*/ undefined, transformAsynchronousModuleBody(node)) - ]))) - ], - /*location*/ node.statements)); + // function(exports) { + // function foo() { return y + file_1.x(); } + // exports("foo", foo); + // var file_1, y; + // return { + // setters: [ + // function(v) { file_1 = v } + // ], + // execute(): function() { + // y = 1; + // console.log(y); + // } + // }; + // } + var statements = []; + // We start a new lexical environment in this function body, but *not* in the + // body of the execute function. This allows us to emit temporary declarations + // only in the outer module body and not in the inner one. + startLexicalEnvironment(); + // Add any prologue directives. + var ensureUseStrict = compilerOptions.alwaysStrict || (!compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile)); + var statementOffset = ts.addPrologue(statements, node.statements, ensureUseStrict, sourceElementVisitor); + // var __moduleName = context_1 && context_1.id; + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("__moduleName", + /*type*/ undefined, ts.createLogicalAnd(contextObject, ts.createPropertyAccess(contextObject, "id"))) + ]))); + // Visit the synthetic external helpers import declaration if present + ts.visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement); + // Visit the statements of the source file, emitting any transformations into + // the `executeStatements` array. We do this *before* we fill the `setters` array + // as we both emit transformations as well as aggregate some data used when creating + // setters. This allows us to reduce the number of times we need to loop through the + // statements of the source file. + var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); + // Emit early exports for function declarations. + ts.addRange(statements, hoistedStatements); + // We emit hoisted variables early to align roughly with our previous emit output. + // Two key differences in this approach are: + // - Temporary variables will appear at the top rather than at the bottom of the file + ts.addRange(statements, endLexicalEnvironment()); + var exportStarFunction = addExportStarIfNeeded(statements); + var moduleObject = ts.createObjectLiteral([ + ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), + ts.createPropertyAssignment("execute", ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, ts.createBlock(executeStatements, /*multiLine*/ true))) + ]); + moduleObject.multiLine = true; + statements.push(ts.createReturn(moduleObject)); + return ts.createBlock(statements, /*multiLine*/ true); } /** - * Collect the additional asynchronous dependencies for the module. + * Adds an exportStar function to a statement list if it is needed for the file. * - * @param node The source file. - * @param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies. + * @param statements A statement list. */ - function collectAsynchronousDependencies(node, includeNonAmdDependencies) { - // names of modules with corresponding parameter in the factory function - var aliasedModuleNames = []; - // names of modules with no corresponding parameters in factory function - var unaliasedModuleNames = []; - // names of the parameters in the factory function; these - // parameters need to match the indexes of the corresponding - // module names in aliasedModuleNames. - var importAliasNames = []; - // Fill in amd-dependency tags - for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { - var amdDependency = _a[_i]; - if (amdDependency.name) { - aliasedModuleNames.push(ts.createLiteral(amdDependency.path)); - importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, amdDependency.name)); + function addExportStarIfNeeded(statements) { + if (!moduleInfo.hasExportStarsToExportValues) { + return; + } + // when resolving exports local exported entries/indirect exported entries in the module + // should always win over entries with similar names that were added via star exports + // to support this we store names of local/indirect exported entries in a set. + // this set is used to filter names brought by star expors. + // local names set should only be added if we have anything exported + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { + // no exported declarations (export var ...) or export specifiers (export {x}) + // check if we have any non star export declarations. + var hasExportDeclarationWithExportClause = false; + for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { + var externalImport = _a[_i]; + if (externalImport.kind === 243 /* ExportDeclaration */ && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } } - else { - unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + if (!hasExportDeclarationWithExportClause) { + // we still need to emit exportStar helper + var exportStarFunction_1 = createExportStarFunction(/*localNames*/ undefined); + statements.push(exportStarFunction_1); + return exportStarFunction_1.name; } } - for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { - var importNode = _c[_b]; - // Find the name of the external module - var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); - // Find the name of the module alias, if there is one - var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); - if (includeNonAmdDependencies && importAliasName) { - // Set emitFlags on the name of the classDeclaration - // This is so that when printer will not substitute the identifier - ts.setEmitFlags(importAliasName, 4 /* NoSubstitution */); - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName)); + var exportedNames = []; + if (moduleInfo.exportedNames) { + for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { + var exportedLocalName = _c[_b]; + if (exportedLocalName.text === "default") { + continue; + } + // write name of exported declaration, i.e 'export var x...' + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createTrue())); } - else { - unaliasedModuleNames.push(externalModuleName); + } + for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { + var externalImport = _e[_d]; + if (externalImport.kind !== 243 /* ExportDeclaration */) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + // export * from ... + continue; + } + for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { + var element = _g[_f]; + // write name of indirectly exported entry, i.e. 'export {x} from ...' + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createTrue())); } } - return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exportedNamesStorageRef, + /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*multiline*/ true)) + ]))); + var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); + statements.push(exportStarFunction); + return exportStarFunction.name; } /** - * Transforms a SourceFile into an AMD or UMD module body. + * Creates an exportStar function for the file, with an optional set of excluded local + * names. * - * @param node The SourceFile node. + * @param localNames An optional reference to an object containing a set of excluded local + * names. */ - function transformAsynchronousModuleBody(node) { - startLexicalEnvironment(); - var statements = []; - var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); - // Visit each statement of the module body. - ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, ts.isStatement, /*optional*/ true)); - ts.addRange(statements, ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset)); - // End the lexical environment for the module body - // and merge any new lexical declarations. - ts.addRange(statements, endLexicalEnvironment()); - // Append the 'export =' statement if provided. - addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true); - var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); - if (currentModuleInfo.hasExportStarsToExportValues) { - // If we have any `export * from ...` declarations - // we need to inform the emitter to add the __export helper. - ts.addEmitHelper(body, exportStarHelper); + function createExportStarFunction(localNames) { + var exportStarFunction = ts.createUniqueName("exportStar"); + var m = ts.createIdentifier("m"); + var n = ts.createIdentifier("n"); + var exports = ts.createIdentifier("exports"); + var condition = ts.createStrictInequality(n, ts.createLiteral("default")); + if (localNames) { + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), + /*typeArguments*/ undefined, [n]))); } - return body; + return ts.createFunctionDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, exportStarFunction, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, m)], + /*type*/ undefined, ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exports, + /*type*/ undefined, ts.createObjectLiteral([])) + ])), + ts.createForIn(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(n, /*type*/ undefined) + ]), m, ts.createBlock([ + ts.setEmitFlags(ts.createIf(condition, ts.createStatement(ts.createAssignment(ts.createElementAccess(exports, n), ts.createElementAccess(m, n)))), 1 /* SingleLine */) + ])), + ts.createStatement(ts.createCall(exportFunction, + /*typeArguments*/ undefined, [exports])) + ], /*multiline*/ true)); } /** - * Adds the down-level representation of `export=` to the statement list if one exists - * in the source file. + * Creates an array setter callbacks for each dependency group. * - * @param statements The Statement list to modify. - * @param emitAsReturn A value indicating whether to emit the `export=` statement as a - * return statement. + * @param exportStarFunction A reference to an exportStarFunction for the file. + * @param dependencyGroups An array of grouped dependencies. */ - function addExportEqualsIfNeeded(statements, emitAsReturn) { - if (currentModuleInfo.exportEquals) { - if (emitAsReturn) { - var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, - /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 384 /* NoTokenSourceMaps */ | 1536 /* NoComments */); - statements.push(statement); - } - else { - var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression), - /*location*/ currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 1536 /* NoComments */); - statements.push(statement); + function createSettersArray(exportStarFunction, dependencyGroups) { + var setters = []; + for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { + var group = dependencyGroups_1[_i]; + // derive a unique name for parameter from the first named entry in the group + var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); }); + var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""); + var statements = []; + for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) { + var entry = _b[_a]; + var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); + switch (entry.kind) { + case 237 /* ImportDeclaration */: + if (!entry.importClause) { + // 'import "..."' case + // module is imported only for side-effects, no emit required + break; + } + // falls through + case 236 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== undefined); + // save import into the local + statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); + break; + case 243 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== undefined); + if (entry.exportClause) { + // export {a, b as c} from 'foo' + // + // emit as: + // + // exports_({ + // "a": _["a"], + // "c": _["b"] + // }); + var properties = []; + for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); + } + statements.push(ts.createStatement(ts.createCall(exportFunction, + /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*multiline*/ true)]))); + } + else { + // export * from 'foo' + // + // emit as: + // + // exportStar(foo_1_1); + statements.push(ts.createStatement(ts.createCall(exportStarFunction, + /*typeArguments*/ undefined, [parameterName]))); + } + break; + } } + setters.push(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], + /*type*/ undefined, ts.createBlock(statements, /*multiLine*/ true))); } + return ts.createArrayLiteral(setters, /*multiLine*/ true); } // - // Top-Level Source Element Visitors + // Top-level Source Element Visitors // /** - * Visits a node at the top level of the source file. + * Visit source elements at the top-level of a module. * * @param node The node to visit. */ function sourceElementVisitor(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: - return visitExportDeclaration(node); - case 240 /* ExportAssignment */: + case 243 /* ExportDeclaration */: + // ExportDeclarations are elided as they are handled via + // `appendExportsOfDeclaration`. + return undefined; + case 242 /* ExportAssignment */: return visitExportAssignment(node); - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: - return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: - return visitClassDeclaration(node); - case 295 /* MergeDeclarationMarker */: - return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: - return visitEndOfDeclarationMarker(node); default: - // This visitor does not descend into the tree, as export/import statements - // are only transformed at the top level of a file. - return node; + return nestedElementVisitor(node); } } /** @@ -56044,46 +60046,8 @@ var ts; */ function visitImportDeclaration(node) { var statements; - var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); - if (moduleKind !== ts.ModuleKind.AMD) { - if (!node.importClause) { - // import "mod"; - return ts.createStatement(createRequireCall(node), /*location*/ node); - } - else { - var variables = []; - if (namespaceDeclaration && !ts.isDefaultImport(node)) { - // import * as n from "mod"; - variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), - /*type*/ undefined, createRequireCall(node))); - } - else { - // import d from "mod"; - // import { x, y } from "mod"; - // import d, { x, y } from "mod"; - // import d, * as n from "mod"; - variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), - /*type*/ undefined, createRequireCall(node))); - if (namespaceDeclaration && ts.isDefaultImport(node)) { - variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), - /*type*/ undefined, ts.getGeneratedNameForNode(node))); - } - } - statements = ts.append(statements, ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList(variables, - /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), - /*location*/ node)); - } - } - else if (namespaceDeclaration && ts.isDefaultImport(node)) { - // import d, * as n from "mod"; - statements = ts.append(statements, ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), - /*type*/ undefined, ts.getGeneratedNameForNode(node), - /*location*/ node) - ], - /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */))); + if (node.importClause) { + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node @@ -56095,19 +60059,6 @@ var ts; } return ts.singleOrMany(statements); } - /** - * Creates a `require()` call to import an external module. - * - * @param importNode The declararation to import. - */ - function createRequireCall(importNode) { - var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); - var args = []; - if (moduleName) { - args.push(moduleName); - } - return ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, args); - } /** * Visits an ImportEqualsDeclaration node. * @@ -56116,28 +60067,7 @@ var ts; function visitImportEqualsDeclaration(node) { ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); var statements; - if (moduleKind !== ts.ModuleKind.AMD) { - if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), - /*location*/ node)); - } - else { - statements = ts.append(statements, ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), - /*type*/ undefined, createRequireCall(node)) - ], - /*location*/ undefined, - /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), - /*location*/ node)); - } - } - else { - if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), - /*location*/ node)); - } - } + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); @@ -56148,48 +60078,6 @@ var ts; } return ts.singleOrMany(statements); } - /** - * Visits an ExportDeclaration node. - * - * @param The node to visit. - */ - function visitExportDeclaration(node) { - if (!node.moduleSpecifier) { - // Elide export declarations with no module specifier as they are handled - // elsewhere. - return undefined; - } - var generatedName = ts.getGeneratedNameForNode(node); - if (node.exportClause) { - var statements = []; - // export { x, y } from "mod"; - if (moduleKind !== ts.ModuleKind.AMD) { - statements.push(ts.createVariableStatement( - /*modifiers*/ undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(generatedName, - /*type*/ undefined, createRequireCall(node)) - ]), - /*location*/ node)); - } - for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { - var specifier = _a[_i]; - var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); - statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), - /*location*/ specifier)); - } - return ts.singleOrMany(statements); - } - else { - // export * from "mod"; - return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), - /*typeArguments*/ undefined, [ - moduleKind !== ts.ModuleKind.AMD - ? createRequireCall(node) - : generatedName - ]), - /*location*/ node); - } - } /** * Visits an ExportAssignment node. * @@ -56197,37 +60085,33 @@ var ts; */ function visitExportAssignment(node) { if (node.isExportEquals) { + // Elide `export=` as it is illegal in a SystemJS module. return undefined; } - var statements; + var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression); var original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, /*allowComments*/ true); } else { - statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); + return createExportStatement(ts.createIdentifier("default"), expression, /*allowComments*/ true); } - return ts.singleOrMany(statements); } /** - * Visits a FunctionDeclaration node. + * Visits a FunctionDeclaration, hoisting it to the outer module body function. * * @param node The node to visit. */ function visitFunctionDeclaration(node) { - var statements; if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), - /*typeParameters*/ undefined, node.parameters, - /*type*/ undefined, node.body, - /*location*/ node), - /*original*/ node)); + hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), + /*type*/ undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); } else { - statements = ts.append(statements, node); + hoistedStatements = ts.append(hoistedStatements, node); } if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node @@ -56235,27 +60119,24 @@ var ts; deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { - statements = appendExportsOfHoistedDeclaration(statements, node); + hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); } - return ts.singleOrMany(statements); + return undefined; } /** - * Visits a ClassDeclaration node. - * - * @param node The node to visit. - */ - function visitClassDeclaration(node) { - var statements; - if (ts.hasModifier(node, 1 /* Export */)) { - statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration( - /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), - /*typeParameters*/ undefined, node.heritageClauses, node.members, - /*location*/ node), - /*original*/ node)); - } - else { - statements = ts.append(statements, node); - } + * Visits a ClassDeclaration, hoisting its name to the outer module body function. + * + * @param node The node to visit. + */ + function visitClassDeclaration(node) { + var statements; + // Hoist the name of the class declaration to the outer module body function. + var name = ts.getLocalName(node); + hoistVariableDeclaration(name); + // Rewrite the class declaration into an assignment of a class expression. + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.createAssignment(name, ts.setTextRange(ts.createClassExpression( + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement)), node))), node)); if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); @@ -56267,66 +60148,117 @@ var ts; return ts.singleOrMany(statements); } /** - * Visits a VariableStatement node. + * Visits a variable statement, hoisting declared names to the top-level module body. + * Each declaration is rewritten into an assignment expression. * * @param node The node to visit. */ function visitVariableStatement(node) { - var statements; - var variables; + if (!shouldHoistVariableDeclarationList(node.declarationList)) { + return ts.visitNode(node, destructuringVisitor, ts.isStatement); + } var expressions; - if (ts.hasModifier(node, 1 /* Export */)) { - var modifiers = void 0; - // If we're exporting these variables, then these just become assignments to 'exports.x'. - // We only want to emit assignments for variables with initializers. - for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { - var variable = _a[_i]; - if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) { - if (!modifiers) { - modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier); - } - variables = ts.append(variables, variable); - } - else if (variable.initializer) { - expressions = ts.append(expressions, transformInitializedVariable(variable)); - } - } - if (variables) { - statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); + var isExportedDeclaration = ts.hasModifier(node, 1 /* Export */); + var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); } - if (expressions) { - statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node)); + else { + hoistBindingElement(variable); } } - else { - statements = ts.append(statements, node); + var statements; + if (expressions) { + statements = ts.append(statements, ts.setTextRange(ts.createStatement(ts.inlineExpressions(expressions)), node)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { + if (isMarkedDeclaration) { // Defer exports until we encounter an EndOfDeclarationMarker node var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); } else { - statements = appendExportsOfVariableStatement(statements, node); + statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false); } return ts.singleOrMany(statements); } /** - * Transforms an exported variable with an initializer into an expression. + * Hoists the declared names of a VariableDeclaration or BindingElement. * - * @param node The node to transform. + * @param node The declaration to hoist. */ - function transformInitializedVariable(node) { + function hoistBindingElement(node) { if (ts.isBindingPattern(node.name)) { - return ts.flattenDestructuringAssignment(node, - /*visitor*/ undefined, context, 0 /* All */, - /*needsValue*/ false, createExportExpression); + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + hoistBindingElement(element); + } + } } else { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, - /*location*/ node.name), node.initializer); + hoistVariableDeclaration(ts.getSynthesizedClone(node.name)); } } + /** + * Determines whether a VariableDeclarationList should be hoisted. + * + * @param node The node to test. + */ + function shouldHoistVariableDeclarationList(node) { + // hoist only non-block scoped declarations or block scoped declarations parented by source file + return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 + && (enclosingBlockScopedContainer.kind === 264 /* SourceFile */ + || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); + } + /** + * Transform an initialized variable declaration into an expression. + * + * @param node The node to transform. + * @param isExportedDeclaration A value indicating whether the variable is exported. + */ + function transformInitializedVariable(node, isExportedDeclaration) { + var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; + return ts.isBindingPattern(node.name) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ false, createAssignment) + : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); + } + /** + * Creates an assignment expression for an exported variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + */ + function createExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ true); + } + /** + * Creates an assignment expression for a non-exported variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + */ + function createNonExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ false); + } + /** + * Creates an assignment expression for a variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + * @param isExportedDeclaration A value indicating whether the variable is exported. + */ + function createVariableAssignment(name, value, location, isExportedDeclaration) { + hoistVariableDeclaration(ts.getSynthesizedClone(name)); + return isExportedDeclaration + ? createExportExpression(name, preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location))) + : preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location)); + } /** * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged * and transformed declaration. @@ -56339,11 +60271,12 @@ var ts; // begin/end semantics of the declararation and to properly handle exports // we wrapped the leading variable declaration in a `MergeDeclarationMarker`. // - // To balance the declaration, add the exports of the elided variable - // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + // To balance the declaration, we defer the exports of the elided variable + // statement until we visit this declaration's `EndOfDeclarationMarker`. + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 207 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); + var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); } return node; } @@ -56383,7 +60316,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } var importClause = decl.importClause; @@ -56396,10 +60329,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 240 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56410,7 +60343,7 @@ var ts; return statements; } /** - * Appends the exports of an ImportEqualsDeclaration to a statement list, returning the + * Appends the export of an ImportEqualsDeclaration to a statement list, returning the * statement list. * * @param statements A statement list to which the down-level export statements are to be @@ -56419,7 +60352,7 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfImportEqualsDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } return appendExportsOfDeclaration(statements, decl); @@ -56432,14 +60365,18 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param node The VariableStatement whose exports are to be recorded. + * @param exportSelf A value indicating whether to also export each VariableDeclaration of + * `nodes` declaration list. */ - function appendExportsOfVariableStatement(statements, node) { - if (currentModuleInfo.exportEquals) { + function appendExportsOfVariableStatement(statements, node, exportSelf) { + if (moduleInfo.exportEquals) { return statements; } for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - statements = appendExportsOfBindingElement(statements, decl); + if (decl.initializer || exportSelf) { + statements = appendExportsOfBindingElement(statements, decl, exportSelf); + } } return statements; } @@ -56451,21 +60388,27 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration whose exports are to be recorded. + * @param exportSelf A value indicating whether to also export the declaration itself. */ - function appendExportsOfBindingElement(statements, decl) { - if (currentModuleInfo.exportEquals) { + function appendExportsOfBindingElement(statements, decl, exportSelf) { + if (moduleInfo.exportEquals) { return statements; } if (ts.isBindingPattern(decl.name)) { for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { - statements = appendExportsOfBindingElement(statements, element); + statements = appendExportsOfBindingElement(statements, element, exportSelf); } } } else if (!ts.isGeneratedIdentifier(decl.name)) { - statements = appendExportsOfDeclaration(statements, decl); + var excludeName = void 0; + if (exportSelf) { + statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); + excludeName = decl.name.text; + } + statements = appendExportsOfDeclaration(statements, decl, excludeName); } return statements; } @@ -56479,15 +60422,17 @@ var ts; * @param decl The declaration whose exports are to be recorded. */ function appendExportsOfHoistedDeclaration(statements, decl) { - if (currentModuleInfo.exportEquals) { + if (moduleInfo.exportEquals) { return statements; } + var excludeName; if (ts.hasModifier(decl, 1 /* Export */)) { - var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createIdentifier("default") : decl.name; - statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), /*location*/ decl); + var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createLiteral("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); + excludeName = exportName.text; } if (decl.name) { - statements = appendExportsOfDeclaration(statements, decl); + statements = appendExportsOfDeclaration(statements, decl, excludeName); } return statements; } @@ -56498,14 +60443,20 @@ var ts; * appended. If `statements` is `undefined`, a new array is allocated if statements are * appended. * @param decl The declaration to export. + * @param excludeName An optional name to exclude from exports. */ - function appendExportsOfDeclaration(statements, decl) { + function appendExportsOfDeclaration(statements, decl, excludeName) { + if (moduleInfo.exportEquals) { + return statements; + } var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; - statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name); + if (exportSpecifier.name.text !== excludeName) { + statements = appendExportStatement(statements, exportSpecifier.name, name); + } } } return statements; @@ -56519,29 +60470,10 @@ var ts; * appended. * @param exportName The name of the export. * @param expression The expression to export. - * @param location The location to use for source maps and comments for the export. * @param allowComments Whether to allow comments on the export. */ - function appendExportStatement(statements, exportName, expression, location, allowComments) { - if (exportName.text === "default") { - var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 0 /* ES3 */) { - statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); - } - else { - statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), - /*typeArguments*/ undefined, [ - ts.createIdentifier("exports"), - ts.createLiteral("__esModule"), - ts.createObjectLiteral([ - ts.createPropertyAssignment("value", ts.createLiteral(true)) - ]) - ]))); - } - } - } - statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); + function appendExportStatement(statements, exportName, expression, allowComments) { + statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)); return statements; } /** @@ -56549,11 +60481,10 @@ var ts; * * @param name The bound name of the export. * @param value The exported value. - * @param location The location to use for source maps and comments for the export. * @param allowComments An optional value indicating whether to emit comments for the statement. */ - function createExportStatement(name, value, location, allowComments) { - var statement = ts.createStatement(createExportExpression(name, value), location); + function createExportStatement(name, value, allowComments) { + var statement = ts.createStatement(createExportExpression(name, value)); ts.startOnNewLine(statement); if (!allowComments) { ts.setEmitFlags(statement, 1536 /* NoComments */); @@ -56565,10 +60496,293 @@ var ts; * * @param name The bound name of the export. * @param value The exported value. - * @param location The location to use for source maps and comments for the export. */ - function createExportExpression(name, value, location) { - return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value, location); + function createExportExpression(name, value) { + var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; + return ts.createCall(exportFunction, /*typeArguments*/ undefined, [exportName, value]); + } + // + // Top-Level or Nested Source Element Visitors + // + /** + * Visit nested elements at the top-level of a module. + * + * @param node The node to visit. + */ + function nestedElementVisitor(node) { + switch (node.kind) { + case 207 /* VariableStatement */: + return visitVariableStatement(node); + case 227 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 228 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 213 /* ForStatement */: + return visitForStatement(node); + case 214 /* ForInStatement */: + return visitForInStatement(node); + case 215 /* ForOfStatement */: + return visitForOfStatement(node); + case 211 /* DoStatement */: + return visitDoStatement(node); + case 212 /* WhileStatement */: + return visitWhileStatement(node); + case 221 /* LabeledStatement */: + return visitLabeledStatement(node); + case 219 /* WithStatement */: + return visitWithStatement(node); + case 220 /* SwitchStatement */: + return visitSwitchStatement(node); + case 234 /* CaseBlock */: + return visitCaseBlock(node); + case 256 /* CaseClause */: + return visitCaseClause(node); + case 257 /* DefaultClause */: + return visitDefaultClause(node); + case 223 /* TryStatement */: + return visitTryStatement(node); + case 259 /* CatchClause */: + return visitCatchClause(node); + case 206 /* Block */: + return visitBlock(node); + case 296 /* MergeDeclarationMarker */: + return visitMergeDeclarationMarker(node); + case 297 /* EndOfDeclarationMarker */: + return visitEndOfDeclarationMarker(node); + default: + return destructuringVisitor(node); + } + } + /** + * Visits the body of a ForStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a ForInStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForInStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a ForOfStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForOfStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForOf(node, node.awaitModifier, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Determines whether to hoist the initializer of a ForStatement, ForInStatement, or + * ForOfStatement. + * + * @param node The node to test. + */ + function shouldHoistForInitializer(node) { + return ts.isVariableDeclarationList(node) + && shouldHoistVariableDeclarationList(node); + } + /** + * Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement + * + * @param node The node to visit. + */ + function visitForInitializer(node) { + if (!node) { + return node; + } + if (shouldHoistForInitializer(node)) { + var expressions = void 0; + for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); + } + return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); + } + else { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + } + /** + * Visits the body of a DoStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitDoStatement(node) { + return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); + } + /** + * Visits the body of a WhileStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitWhileStatement(node) { + return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + /** + * Visits the body of a LabeledStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitLabeledStatement(node) { + return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + /** + * Visits the body of a WithStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitWithStatement(node) { + return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, ts.liftToBlock)); + } + /** + * Visits the body of a SwitchStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitSwitchStatement(node) { + return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); + } + /** + * Visits the body of a CaseBlock to hoist declarations. + * + * @param node The node to visit. + */ + function visitCaseBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a CaseClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitCaseClause(node) { + return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)); + } + /** + * Visits the body of a DefaultClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitDefaultClause(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + /** + * Visits the body of a TryStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitTryStatement(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + /** + * Visits the body of a CatchClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitCatchClause(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a Block to hoist declarations. + * + * @param node The node to visit. + */ + function visitBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.visitEachChild(node, nestedElementVisitor, context); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + // + // Destructuring Assignment Visitors + // + /** + * Visit nodes to flatten destructuring assignments to exported symbols. + * + * @param node The node to visit. + */ + function destructuringVisitor(node) { + if (node.transformFlags & 1024 /* DestructuringAssignment */ + && node.kind === 193 /* BinaryExpression */) { + return visitDestructuringAssignment(node); + } + else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { + return ts.visitEachChild(node, destructuringVisitor, context); + } + else { + return node; + } + } + /** + * Visits a DestructuringAssignment to flatten destructuring to exported symbols. + * + * @param node The node to visit. + */ + function visitDestructuringAssignment(node) { + if (hasExportedReferenceInDestructuringTarget(node.left)) { + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ true); + } + return ts.visitEachChild(node, destructuringVisitor, context); + } + /** + * Determines whether the target of a destructuring assigment refers to an exported symbol. + * + * @param node The destructuring target. + */ + function hasExportedReferenceInDestructuringTarget(node) { + if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + return hasExportedReferenceInDestructuringTarget(node.left); + } + else if (ts.isSpreadExpression(node)) { + return hasExportedReferenceInDestructuringTarget(node.expression); + } + else if (ts.isObjectLiteralExpression(node)) { + return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isArrayLiteralExpression(node)) { + return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isShorthandPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.name); + } + else if (ts.isPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.initializer); + } + else if (ts.isIdentifier(node)) { + var container = resolver.getReferencedExportContainer(node); + return container !== undefined && container.kind === 264 /* SourceFile */; + } + else { + return false; + } } // // Modifier Visitors @@ -56579,7 +60793,6 @@ var ts; * @param node The node to visit. */ function modifierVisitor(node) { - // Elide module-specific modifiers. switch (node.kind) { case 83 /* ExportKeyword */: case 78 /* DefaultKeyword */: @@ -56593,22 +60806,28 @@ var ts; /** * Hook for node emit notifications. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. + * @param emitCallback A callback used to emit the node in the printer. */ - function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { + function onEmitNode(hint, node, emitCallback) { + if (node.kind === 264 /* SourceFile */) { + var id = ts.getOriginalNodeId(node); currentSourceFile = node; - currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; - noSubstitution = ts.createMap(); - previousOnEmitNode(emitContext, node, emitCallback); + moduleInfo = moduleInfoMap[id]; + exportFunction = exportFunctionsMap[id]; + noSubstitution = noSubstitutionMap[id]; + if (noSubstitution) { + delete noSubstitutionMap[id]; + } + previousOnEmitNode(hint, node, emitCallback); currentSourceFile = undefined; - currentModuleInfo = undefined; + moduleInfo = undefined; + exportFunction = undefined; noSubstitution = undefined; } else { - previousOnEmitNode(emitContext, node, emitCallback); + previousOnEmitNode(hint, node, emitCallback); } } // @@ -56617,44 +60836,21 @@ var ts; /** * Hooks node substitutions. * - * @param emitContext A context hint for the emitter. + * @param hint A hint as to the intended usage of the node. * @param node The node to substitute. */ - function onSubstituteNode(emitContext, node) { - node = previousOnSubstituteNode(emitContext, node); - if (node.id && noSubstitution[node.id]) { + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (isSubstitutionPrevented(node)) { return node; } - if (emitContext === 1 /* Expression */) { + if (hint === 1 /* Expression */) { return substituteExpression(node); } - else if (ts.isShorthandPropertyAssignment(node)) { - return substituteShorthandPropertyAssignment(node); - } - return node; - } - /** - * Substitution for a ShorthandPropertyAssignment whose declaration name is an imported - * or exported symbol. - * - * @param node The node to substitute. - */ - function substituteShorthandPropertyAssignment(node) { - var name = node.name; - var exportedOrImportedName = substituteExpressionIdentifier(name); - if (exportedOrImportedName !== name) { - // A shorthand property with an assignment initializer is probably part of a - // destructuring assignment - if (node.objectAssignmentInitializer) { - var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name, initializer, /*location*/ node); - } - return ts.createPropertyAssignment(name, exportedOrImportedName, /*location*/ node); - } return node; } /** - * Substitution for an Expression that may contain an imported or exported symbol. + * Substitute the expression, if necessary. * * @param node The node to substitute. */ @@ -56662,17 +60858,16 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return substituteExpressionIdentifier(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return substituteBinaryExpression(node); - case 191 /* PostfixUnaryExpression */: - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; } /** - * Substitution for an Identifier expression that may contain an imported or exported - * symbol. + * Substitution for an Identifier expression that may contain an imported or exported symbol. * * @param node The node to substitute. */ @@ -56684,21 +60879,21 @@ var ts; } return node; } + // When we see an identifier in an expression position that + // points to an imported symbol, we should substitute a qualified + // reference to the imported symbol if one is needed. + // + // - We do not substitute generated identifiers for any reason. + // - We do not substitute identifiers tagged with the LocalName flag. if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { - var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { - return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), - /*location*/ node); - } var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { if (ts.isImportClause(importDeclaration)) { - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default")), /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_37 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_37), + return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name)), /*location*/ node); } } @@ -56730,9 +60925,7 @@ var ts; var expression = node; for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) { var exportName = exportedNames_3[_i]; - // Mark the node to prevent triggering this rule again. - noSubstitution[ts.getNodeId(expression)] = true; - expression = createExportExpression(exportName, expression, /*location*/ node); + expression = createExportExpression(exportName, preventSubstitution(expression)); } return expression; } @@ -56761,15 +60954,17 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 191 /* PostfixUnaryExpression */ - ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1), - /*location*/ node) + var expression = node.kind === 192 /* PostfixUnaryExpression */ + ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { var exportName = exportedNames_4[_i]; - // Mark the node to prevent triggering this rule again. - noSubstitution[ts.getNodeId(expression)] = true; - expression = createExportExpression(exportName, expression); + expression = createExportExpression(exportName, preventSubstitution(expression)); + } + if (node.kind === 192 /* PostfixUnaryExpression */) { + expression = node.operator === 42 /* PlusPlusToken */ + ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) + : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); } return expression; } @@ -56777,31 +60972,144 @@ var ts; return node; } /** - * Gets the additional exports of a name. + * Gets the exports of a name. * * @param name The name. */ function getExports(name) { + var exportedNames; if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { - return currentModuleInfo - && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; + var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); + if (exportContainer && exportContainer.kind === 264 /* SourceFile */) { + exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); + } + exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); } } + return exportedNames; + } + /** + * Prevent substitution of a node for this transformer. + * + * @param node The node which should not be substituted. + */ + function preventSubstitution(node) { + if (noSubstitution === undefined) + noSubstitution = []; + noSubstitution[ts.getNodeId(node)] = true; + return node; + } + /** + * Determines whether a node should not be substituted. + * + * @param node The node to test. + */ + function isSubstitutionPrevented(node) { + return noSubstitution && node.id && noSubstitution[node.id]; } - var _a; } - ts.transformModule = transformModule; - // emit output for the __export helper function - var exportStarHelper = { - name: "typescript:export-star", - scoped: true, - text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" - }; - // emit output for the UMD helper function. - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; + ts.transformSystemModule = transformSystemModule; +})(ts || (ts = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + function transformES2015Module(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.enableEmitNotification(264 /* SourceFile */); + context.enableSubstitution(70 /* Identifier */); + var currentSourceFile; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions); + if (externalHelpersModuleName) { + var statements = []; + var statementOffset = ts.addPrologue(statements, node.statements); + ts.append(statements, ts.createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText))); + ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); + return ts.updateSourceFileNode(node, ts.setTextRange(ts.createNodeArray(statements), node.statements)); + } + else { + return ts.visitEachChild(node, visitor, context); + } + } + return node; + } + function visitor(node) { + switch (node.kind) { + case 236 /* ImportEqualsDeclaration */: + // Elide `import=` as it is not legal with --module ES6 + return undefined; + case 242 /* ExportAssignment */: + return visitExportAssignment(node); + } + return node; + } + function visitExportAssignment(node) { + // Elide `export=` as it is not legal with --module ES6 + return node.isExportEquals ? undefined : node; + } + // + // Emit Notification + // + /** + * Hook for node emit. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(hint, node, emitCallback) { + if (ts.isSourceFile(node)) { + currentSourceFile = node; + previousOnEmitNode(hint, node, emitCallback); + currentSourceFile = undefined; + } + else { + previousOnEmitNode(hint, node, emitCallback); + } + } + // + // Substitutions + // + /** + * Hooks node substitutions. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + function onSubstituteNode(hint, node) { + node = previousOnSubstituteNode(hint, node); + if (ts.isIdentifier(node) && hint === 1 /* Expression */) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); + } + } + return node; + } + } + ts.transformES2015Module = transformES2015Module; })(ts || (ts = {})); /// /// @@ -56818,24 +61126,34 @@ var ts; /* @internal */ var ts; (function (ts) { - var moduleTransformerMap = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, - _a[ts.ModuleKind.System] = ts.transformSystemModule, - _a[ts.ModuleKind.AMD] = ts.transformModule, - _a[ts.ModuleKind.CommonJS] = ts.transformModule, - _a[ts.ModuleKind.UMD] = ts.transformModule, - _a[ts.ModuleKind.None] = ts.transformModule, - _a)); + function getModuleTransformer(moduleKind) { + switch (moduleKind) { + case ts.ModuleKind.ES2015: + return ts.transformES2015Module; + case ts.ModuleKind.System: + return ts.transformSystemModule; + default: + return ts.transformModule; + } + } + var TransformationState; + (function (TransformationState) { + TransformationState[TransformationState["Uninitialized"] = 0] = "Uninitialized"; + TransformationState[TransformationState["Initialized"] = 1] = "Initialized"; + TransformationState[TransformationState["Completed"] = 2] = "Completed"; + TransformationState[TransformationState["Disposed"] = 3] = "Disposed"; + })(TransformationState || (TransformationState = {})); var SyntaxKindFeatureFlags; (function (SyntaxKindFeatureFlags) { SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications"; })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})); - function getTransformers(compilerOptions) { + function getTransformers(compilerOptions, customTransformers) { var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var transformers = []; + ts.addRange(transformers, customTransformers && customTransformers.before); transformers.push(ts.transformTypeScript); if (jsx === 2 /* React */) { transformers.push(ts.transformJsx); @@ -56853,12 +61171,13 @@ var ts; transformers.push(ts.transformES2015); transformers.push(ts.transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + transformers.push(getModuleTransformer(moduleKind)); // The ES5 transformer is last so that it can substitute expressions like `exports.default` // for ES3. if (languageVersion < 1 /* ES5 */) { transformers.push(ts.transformES5); } + ts.addRange(transformers, customTransformers && customTransformers.after); return transformers; } ts.getTransformers = getTransformers; @@ -56866,13 +61185,14 @@ var ts; * Transforms an array of SourceFiles by passing them through each transformer. * * @param resolver The emit resolver provided by the checker. - * @param host The emit host. - * @param sourceFiles An array of source files - * @param transforms An array of Transformers. + * @param host The emit host object used to interact with the file system. + * @param options Compiler options to surface in the `TransformationContext`. + * @param nodes An array of nodes to transform. + * @param transforms An array of `TransformerFactory` callbacks. + * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ - function transformFiles(resolver, host, sourceFiles, transformers) { + function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { var enabledSyntaxKindFeatures = new Array(298 /* Count */); - var lexicalEnvironmentDisabled = false; var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -56880,10 +61200,13 @@ var ts; var lexicalEnvironmentStackOffset = 0; var lexicalEnvironmentSuspended = false; var emitHelpers; + var onSubstituteNode = function (_, node) { return node; }; + var onEmitNode = function (hint, node, callback) { return callback(hint, node); }; + var state = 0 /* Uninitialized */; // The transformation context is provided to each transformer as part of transformer // initialization. var context = { - getCompilerOptions: function () { return host.getCompilerOptions(); }, + getCompilerOptions: function () { return options; }, getEmitResolver: function () { return resolver; }, getEmitHost: function () { return host; }, startLexicalEnvironment: startLexicalEnvironment, @@ -56894,39 +61217,53 @@ var ts; hoistFunctionDeclaration: hoistFunctionDeclaration, requestEmitHelper: requestEmitHelper, readEmitHelpers: readEmitHelpers, - onSubstituteNode: function (_emitContext, node) { return node; }, enableSubstitution: enableSubstitution, - isSubstitutionEnabled: isSubstitutionEnabled, - onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); }, enableEmitNotification: enableEmitNotification, - isEmitNotificationEnabled: isEmitNotificationEnabled + isSubstitutionEnabled: isSubstitutionEnabled, + isEmitNotificationEnabled: isEmitNotificationEnabled, + get onSubstituteNode() { return onSubstituteNode; }, + set onSubstituteNode(value) { + ts.Debug.assert(state < 1 /* Initialized */, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onSubstituteNode = value; + }, + get onEmitNode() { return onEmitNode; }, + set onEmitNode(value) { + ts.Debug.assert(state < 1 /* Initialized */, "Cannot modify transformation hooks after initialization has completed."); + ts.Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onEmitNode = value; + } }; + // Ensure the parse tree is clean before applying transformations + for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { + var node = nodes_4[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + ts.performance.mark("beforeTransform"); // Chain together and initialize each transformer. var transformation = ts.chain.apply(void 0, transformers)(context); - // Transform each source file. - var transformed = ts.map(sourceFiles, transformSourceFile); - // Disable modification of the lexical environment. - lexicalEnvironmentDisabled = true; + // prevent modification of transformation hooks. + state = 1 /* Initialized */; + // Transform each node. + var transformed = ts.map(nodes, allowDtsFiles ? transformation : transformRoot); + // prevent modification of the lexical environment. + state = 2 /* Completed */; + ts.performance.mark("afterTransform"); + ts.performance.measure("transformTime", "beforeTransform", "afterTransform"); return { transformed: transformed, - emitNodeWithSubstitution: emitNodeWithSubstitution, - emitNodeWithNotification: emitNodeWithNotification + substituteNode: substituteNode, + emitNodeWithNotification: emitNodeWithNotification, + dispose: dispose }; - /** - * Transforms a source file. - * - * @param sourceFile The source file to transform. - */ - function transformSourceFile(sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return sourceFile; - } - return transformation(sourceFile); + function transformRoot(node) { + return node && (!ts.isSourceFile(node) || !ts.isDeclarationFile(node)) ? transformation(node) : node; } /** * Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ function enableSubstitution(kind) { + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 1 /* Substitution */; } /** @@ -56939,26 +61276,19 @@ var ts; /** * Emits a node with possible substitution. * - * @param emitContext The current emit context. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emitCallback The callback used to emit the node or its substitute. */ - function emitNodeWithSubstitution(emitContext, node, emitCallback) { - if (node) { - if (isSubstitutionEnabled(node)) { - var substitute = context.onSubstituteNode(emitContext, node); - if (substitute && substitute !== node) { - emitCallback(emitContext, substitute); - return; - } - } - emitCallback(emitContext, node); - } + function substituteNode(hint, node) { + ts.Debug.assert(state < 3 /* Disposed */, "Cannot substitute a node after the result is disposed."); + return node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node; } /** * Enables before/after emit notifications in the pretty printer for the provided SyntaxKind. */ function enableEmitNotification(kind) { + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= 2 /* EmitNotifications */; } /** @@ -56972,17 +61302,18 @@ var ts; /** * Emits a node with possible emit notification. * - * @param emitContext The current emit context. + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emitCallback The callback used to emit the node. */ - function emitNodeWithNotification(emitContext, node, emitCallback) { + function emitNodeWithNotification(hint, node, emitCallback) { + ts.Debug.assert(state < 3 /* Disposed */, "Cannot invoke TransformationResult callbacks after the result is disposed."); if (node) { if (isEmitNotificationEnabled(node)) { - context.onEmitNode(emitContext, node, emitCallback); + onEmitNode(hint, node, emitCallback); } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } } } @@ -56990,7 +61321,8 @@ var ts; * Records a hoisted variable declaration for the provided name within a lexical environment. */ function hoistVariableDeclaration(name) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); var decl = ts.createVariableDeclaration(name); if (!lexicalEnvironmentVariableDeclarations) { lexicalEnvironmentVariableDeclarations = [decl]; @@ -57003,7 +61335,8 @@ var ts; * Records a hoisted function declaration within a lexical environment. */ function hoistFunctionDeclaration(func) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); if (!lexicalEnvironmentFunctionDeclarations) { lexicalEnvironmentFunctionDeclarations = [func]; } @@ -57016,7 +61349,8 @@ var ts; * are pushed onto a stack, and the related storage variables are reset. */ function startLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); // Save the current lexical environment. Rather than resizing the array we adjust the // stack size variable. This allows us to reuse existing array slots we've @@ -57030,13 +61364,15 @@ var ts; } /** Suspends the current lexical environment, usually after visiting a parameter list. */ function suspendLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); lexicalEnvironmentSuspended = true; } /** Resumes a suspended lexical environment, usually before visiting a function body. */ function resumeLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); lexicalEnvironmentSuspended = false; } @@ -57045,7 +61381,8 @@ var ts; * any hoisted declarations added in this environment are returned. */ function endLexicalEnvironment() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the lexical environment during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the lexical environment after transformation has completed."); ts.Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); var statements; if (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { @@ -57074,19 +61411,39 @@ var ts; return statements; } function requestEmitHelper(helper) { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); ts.Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); emitHelpers = ts.append(emitHelpers, helper); } function readEmitHelpers() { - ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + ts.Debug.assert(state > 0 /* Uninitialized */, "Cannot modify the transformation context during initialization."); + ts.Debug.assert(state < 2 /* Completed */, "Cannot modify the transformation context after transformation has completed."); var helpers = emitHelpers; emitHelpers = undefined; return helpers; } - } - ts.transformFiles = transformFiles; - var _a; + function dispose() { + if (state < 3 /* Disposed */) { + // Clean up emit nodes on parse tree + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; + ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node))); + } + // Release references to external entries for GC purposes. + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentVariableDeclarationsStack = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + lexicalEnvironmentFunctionDeclarationsStack = undefined; + onSubstituteNode = undefined; + onEmitNode = undefined; + emitHelpers = undefined; + // Prevent further use of the transformation result. + state = 3 /* Disposed */; + } + } + } + ts.transformNodes = transformNodes; })(ts || (ts = {})); /// /* @internal */ @@ -57131,10 +61488,9 @@ var ts; * * @param filePath The path to the generated output file. * @param sourceMapFilePath The path to the output source map file. - * @param sourceFiles The input source files for the program. - * @param isBundledEmit A value indicating whether the generated output file is a bundle. + * @param sourceFileOrBundle The input source file or bundle for the program. */ - function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + function initialize(filePath, sourceMapFilePath, sourceFileOrBundle) { if (disabled) { return; } @@ -57170,11 +61526,10 @@ var ts; } if (compilerOptions.mapRoot) { sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (!isBundledEmit) { - ts.Debug.assert(sourceFiles.length === 1); + if (sourceFileOrBundle.kind === 264 /* SourceFile */) { // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFileOrBundle, host, sourceMapDir)); } if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { // The relative paths are relative to the common directory @@ -57297,31 +61652,32 @@ var ts; /** * Emits a node with possible leading and trailing source maps. * + * @param hint A hint as to the intended usage of the node. * @param node The node to emit. * @param emitCallback The callback used to emit the node. */ - function emitNodeWithSourceMap(emitContext, node, emitCallback) { + function emitNodeWithSourceMap(hint, node, emitCallback) { if (disabled) { - return emitCallback(emitContext, node); + return emitCallback(hint, node); } if (node) { var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); } if (emitFlags & 64 /* NoNestedSourceMaps */) { disabled = true; - emitCallback(emitContext, node); + emitCallback(hint, node); disabled = false; } else { - emitCallback(emitContext, node); + emitCallback(hint, node); } - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -57391,7 +61747,7 @@ var ts; return; } encodeLastRecordedSourceMapSpan(); - return ts.stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, @@ -57456,11 +61812,10 @@ var ts; /* @internal */ var ts; (function (ts) { - function createCommentWriter(host, writer, sourceMap) { - var compilerOptions = host.getCompilerOptions(); - var extendedDiagnostics = compilerOptions.extendedDiagnostics; - var newLine = host.getNewLine(); - var emitPos = sourceMap.emitPos; + function createCommentWriter(printerOptions, emitPos) { + var extendedDiagnostics = printerOptions.extendedDiagnostics; + var newLine = ts.getNewLineCharacter(printerOptions); + var writer; var containerPos = -1; var containerEnd = -1; var declarationListContainerEnd = -1; @@ -57469,38 +61824,35 @@ var ts; var currentLineMap; var detachedCommentsInfo; var hasWrittenComment = false; - var disabled = compilerOptions.removeComments; + var disabled = printerOptions.removeComments; return { reset: reset, + setWriter: setWriter, setSourceFile: setSourceFile, emitNodeWithComments: emitNodeWithComments, emitBodyWithDetachedComments: emitBodyWithDetachedComments, emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition, + emitLeadingCommentsOfPosition: emitLeadingCommentsOfPosition, }; - function emitNodeWithComments(emitContext, node, emitCallback) { + function emitNodeWithComments(hint, node, emitCallback) { if (disabled) { - emitCallback(emitContext, node); + emitCallback(hint, node); return; } if (node) { - var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; - var emitFlags = ts.getEmitFlags(node); + hasWrittenComment = false; + var emitNode = node.emitNode; + var emitFlags = emitNode && emitNode.flags; + var _a = emitNode && emitNode.commentRange || node, pos = _a.pos, end = _a.end; if ((pos < 0 && end < 0) || (pos === end)) { // Both pos and end are synthesized, so just emit the node without comments. - if (emitFlags & 2048 /* NoNestedComments */) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); } else { if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node @@ -57519,23 +61871,16 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & 2048 /* NoNestedComments */) { - disabled = true; - emitCallback(emitContext, node); - disabled = false; - } - else { - emitCallback(emitContext, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); if (extendedDiagnostics) { - ts.performance.mark("beginEmitNodeWithComment"); + ts.performance.mark("postEmitNodeWithComment"); } // Restore previous container state. containerPos = savedContainerPos; @@ -57547,11 +61892,75 @@ var ts; emitTrailingComments(end); } if (extendedDiagnostics) { - ts.performance.measure("commentTime", "beginEmitNodeWithComment"); + ts.performance.measure("commentTime", "postEmitNodeWithComment"); } } } } + function emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback) { + var leadingComments = emitNode && emitNode.leadingComments; + if (ts.some(leadingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("preEmitNodeWithSynthesizedComments"); + } + ts.forEach(leadingComments, emitLeadingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "preEmitNodeWithSynthesizedComments"); + } + } + emitNodeWithNestedComments(hint, node, emitFlags, emitCallback); + var trailingComments = emitNode && emitNode.trailingComments; + if (ts.some(trailingComments)) { + if (extendedDiagnostics) { + ts.performance.mark("postEmitNodeWithSynthesizedComments"); + } + ts.forEach(trailingComments, emitTrailingSynthesizedComment); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "postEmitNodeWithSynthesizedComments"); + } + } + } + function emitLeadingSynthesizedComment(comment) { + if (comment.kind === 2 /* SingleLineCommentTrivia */) { + writer.writeLine(); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine || comment.kind === 2 /* SingleLineCommentTrivia */) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + function emitTrailingSynthesizedComment(comment) { + if (!writer.isAtStartOfLine()) { + writer.write(" "); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + } + function writeSynthesizedComment(comment) { + var text = formatSynthesizedComment(comment); + var lineMap = comment.kind === 3 /* MultiLineCommentTrivia */ ? ts.computeLineStarts(text) : undefined; + ts.writeCommentRange(text, lineMap, writer, 0, text.length, newLine); + } + function formatSynthesizedComment(comment) { + return comment.kind === 3 /* MultiLineCommentTrivia */ + ? "/*" + comment.text + "*/" + : "//" + comment.text; + } + function emitNodeWithNestedComments(hint, node, emitFlags, emitCallback) { + if (emitFlags & 2048 /* NoNestedComments */) { + disabled = true; + emitCallback(hint, node); + disabled = false; + } + else { + emitCallback(hint, node); + } + } function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { if (extendedDiagnostics) { ts.performance.mark("preEmitBodyWithDetachedComments"); @@ -57579,6 +61988,9 @@ var ts; } if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); @@ -57612,9 +62024,11 @@ var ts; hasWrittenComment = true; } // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -57622,6 +62036,12 @@ var ts; writer.write(" "); } } + function emitLeadingCommentsOfPosition(pos) { + if (disabled || pos === -1) { + return; + } + emitLeadingComments(pos, /*isEmittedNode*/ true); + } function emitTrailingComments(pos) { forEachTrailingCommentToEmit(pos, emitTrailingComment); } @@ -57630,9 +62050,11 @@ var ts; if (!writer.isAtStartOfLine()) { writer.write(" "); } - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -57651,9 +62073,11 @@ var ts; } function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); if (hasTrailingNewLine) { writer.writeLine(); } @@ -57684,6 +62108,9 @@ var ts; currentLineMap = undefined; detachedCommentsInfo = undefined; } + function setWriter(output) { + writer = output; + } function setSourceFile(sourceFile) { currentSourceFile = sourceFile; currentText = currentSourceFile.text; @@ -57716,15 +62143,17 @@ var ts; } } function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) { - emitPos(commentPos); + if (emitPos) + emitPos(commentPos); ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine); - emitPos(commentEnd); + if (emitPos) + emitPos(commentEnd); } /** * Determine if the given comment is a triple-slash * * @return true if the comment is a triple-slash comment else false - **/ + */ function isTripleSlashComment(commentPos, commentEnd) { // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments @@ -57747,15 +62176,17 @@ var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + ts.forEachEmittedFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + function getDeclarationDiagnosticsFromFile(_a, sourceFileOrBundle) { var declarationFilePath = _a.declarationFilePath; - emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, /*emitOnlyDtsFiles*/ false); + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sourceFileOrBundle, /*emitOnlyDtsFiles*/ false); } } ts.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) { + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles) { + var sourceFiles = sourceFileOrBundle.kind === 265 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; + var isBundledEmit = sourceFileOrBundle.kind === 265 /* Bundle */; var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); var write; @@ -57829,7 +62260,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 237 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -57855,9 +62286,9 @@ var ts; } }); if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { + ts.forEachKey(usedTypeDirectiveReferences, function (directive) { referencesOutput += "/// " + newLine; - } + }); } return { reportedDeclarationError: reportedDeclarationError, @@ -57882,12 +62313,14 @@ var ts; var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.reportIllegalExtends = reportIllegalExtends; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -57903,10 +62336,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223 /* VariableDeclaration */) { + if (declaration.kind === 225 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 /* NamedImports */ || declaration.kind === 239 /* ImportSpecifier */ || declaration.kind === 236 /* ImportClause */) { + else if (declaration.kind === 240 /* NamedImports */ || declaration.kind === 241 /* ImportSpecifier */ || declaration.kind === 238 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -57924,7 +62357,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 237 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -57934,12 +62367,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 232 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -57958,8 +62391,8 @@ var ts; } for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -57988,6 +62421,12 @@ var ts; handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true)); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } + function reportIllegalExtends() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, ts.declarationNameToString(errorNameNode))); + } + } function reportInaccessibleThisError() { if (errorNameNode) { reportedDeclarationError = true; @@ -57997,13 +62436,19 @@ var ts; function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); - if (type) { + // use the checker's type, not the declared type, + // for non-optional initialized parameters that aren't a parameter property + var shouldUseResolverType = declaration.kind === 145 /* Parameter */ && + resolver.isRequiredInitializedParameter(declaration); + if (type && !shouldUseResolverType) { // Write the type emitType(type); } else { errorNameNode = declaration.name; - resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); + var format = 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */ | + (shouldUseResolverType ? 4096 /* AddUndefined */ : 0); + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, format, writer); errorNameNode = undefined; } } @@ -58021,15 +62466,15 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { - var node = nodes_4[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var node = nodes_6[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn, canEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var node = nodes_5[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var node = nodes_7[_i]; if (!canEmitFn || canEmitFn(node)) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -58057,49 +62502,50 @@ var ts; function emitType(type) { switch (type.kind) { case 118 /* AnyKeyword */: - case 134 /* StringKeyword */: + case 135 /* StringKeyword */: case 132 /* NumberKeyword */: case 121 /* BooleanKeyword */: - case 135 /* SymbolKeyword */: + case 133 /* ObjectKeyword */: + case 136 /* SymbolKeyword */: case 104 /* VoidKeyword */: - case 137 /* UndefinedKeyword */: + case 138 /* UndefinedKeyword */: case 94 /* NullKeyword */: case 129 /* NeverKeyword */: - case 167 /* ThisType */: - case 171 /* LiteralType */: + case 168 /* ThisType */: + case 172 /* LiteralType */: return writeTextOfNode(currentText, type); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(type); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(type); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(type); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(type); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(type); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(type); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenType(type); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(type); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(type); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(type); - case 158 /* FunctionType */: - case 159 /* ConstructorType */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(type); case 70 /* Identifier */: return emitEntityName(type); - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitEntityName(type); - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -58107,8 +62553,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 141 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 141 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 142 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 142 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -58117,14 +62563,14 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 234 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 236 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 177 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 178 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -58224,7 +62670,7 @@ var ts; currentIdentifiers = node.identifiers; isCurrentFileExternalModule = ts.isExternalModule(node); enclosingDeclaration = node; - ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, /*removeComents*/ true); emitLines(node.statements); } // Return a temp variable name to be used in `export default` statements. @@ -58233,15 +62679,15 @@ var ts; // do not need to keep track of created temp names. function getExportDefaultTempVariableName() { var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } var count = 0; while (true) { count++; - var name_38 = baseName + "_" + count; - if (!(name_38 in currentIdentifiers)) { - return name_38; + var name = baseName + "_" + count; + if (!currentIdentifiers.has(name)) { + return name; } } } @@ -58288,10 +62734,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 /* ImportEqualsDeclaration */ || - (node.parent.kind === 261 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 236 /* ImportEqualsDeclaration */ || + (node.parent.kind === 264 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 264 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -58301,7 +62747,7 @@ var ts; }); } else { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -58319,23 +62765,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return writeVariableStatement(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return writeClassDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -58343,7 +62789,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 264 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -58352,7 +62798,7 @@ var ts; if (modifiers & 512 /* Default */) { write("default "); } - else if (node.kind !== 227 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 229 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -58404,7 +62850,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -58428,7 +62874,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 239 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -58449,13 +62895,13 @@ var ts; // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' // so compiler will treat them as external modules. - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 232 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 234 /* ImportEqualsDeclaration */) { + if (parent.kind === 236 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230 /* ModuleDeclaration */) { + else if (parent.kind === 232 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -58525,7 +62971,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231 /* ModuleBlock */) { + while (node.body && node.body.kind !== 233 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -58595,7 +63041,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 149 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); + return node.parent.kind === 150 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -58606,53 +63052,70 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 161 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 149 /* MethodDeclaration */ || - node.parent.kind === 148 /* MethodSignature */ || - node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.kind === 153 /* CallSignature */ || - node.parent.kind === 154 /* ConstructSignature */); + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 162 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 150 /* MethodDeclaration */ || + node.parent.kind === 149 /* MethodSignature */ || + node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.kind === 154 /* CallSignature */ || + node.parent.kind === 155 /* ConstructSignature */); emitType(node.constraint); } else { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } + if (node.default && !isPrivateMethodTypeParameter(node)) { + write(" = "); + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 162 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 150 /* MethodDeclaration */ || + node.parent.kind === 149 /* MethodSignature */ || + node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.kind === 154 /* CallSignature */ || + node.parent.kind === 155 /* ConstructSignature */); + emitType(node.default); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.default, getTypeParameterConstraintVisibilityError); + } + } function getTypeParameterConstraintVisibilityError() { // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -58671,7 +63134,7 @@ var ts; write(">"); } } - function emitHeritageClause(typeReferences, isImplementsList) { + function emitHeritageClause(className, typeReferences, isImplementsList) { if (typeReferences) { write(isImplementsList ? " implements " : " extends "); emitCommaList(typeReferences, emitTypeOfTypeReference); @@ -58685,20 +63148,22 @@ var ts; } else { writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + errorNameNode = className; resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); + errorNameNode = undefined; } function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + if (node.parent.parent.kind === 228 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { // interface is inaccessible - diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + diagnosticMessage = ts.Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -58730,9 +63195,10 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); + node.name; + emitHeritageClause(node.name, [baseTypeNode], /*isImplementsList*/ false); } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); + emitHeritageClause(node.name, ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); write(" {"); writeLine(); increaseIndent(); @@ -58753,7 +63219,7 @@ var ts; emitTypeParameters(node.typeParameters); var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); if (interfaceExtendsTypes && interfaceExtendsTypes.length) { - emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false); + emitHeritageClause(node.name, interfaceExtendsTypes, /*isImplementsList*/ false); } write(" {"); writeLine(); @@ -58777,7 +63243,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 223 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 225 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -58788,11 +63254,11 @@ var ts; writeTextOfNode(currentText, node.name); // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor // we don't want to emit property declaration with "?" - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */ || - (node.kind === 144 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */ || + (node.kind === 145 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) && node.parent.kind === 161 /* TypeLiteral */) { + if ((node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) && node.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (resolver.isLiteralConstDeclaration(node)) { @@ -58805,14 +63271,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 225 /* VariableDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) { + else if (node.kind === 148 /* PropertyDeclaration */ || node.kind === 147 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.hasModifier(node, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? @@ -58821,7 +63287,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -58853,7 +63319,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 198 /* OmittedExpression */) { + if (element.kind !== 199 /* OmittedExpression */) { elements.push(element); } } @@ -58923,7 +63389,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 151 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 152 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -58936,7 +63402,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 151 /* GetAccessor */ + return accessor.kind === 152 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -58945,7 +63411,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 152 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 153 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? @@ -58995,17 +63461,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) { + else if (node.kind === 150 /* MethodDeclaration */ || node.kind === 151 /* Constructor */) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 227 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 150 /* Constructor */) { + else if (node.kind === 151 /* Constructor */) { write("constructor"); } else { @@ -59025,17 +63491,17 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; var closeParenthesizedFunctionType = false; - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { // Index signature can have readonly modifier emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); write("["); } else { // Construct signature or constructor type write new Signature - if (node.kind === 154 /* ConstructSignature */ || node.kind === 159 /* ConstructorType */) { + if (node.kind === 155 /* ConstructSignature */ || node.kind === 160 /* ConstructorType */) { write("new "); } - else if (node.kind === 158 /* FunctionType */) { + else if (node.kind === 159 /* FunctionType */) { var currentOutput = writer.getText(); // Do not generate incorrect type when function type with type parameters is type argument // This could happen if user used space between two '<' making it error free @@ -59050,22 +63516,22 @@ var ts; } // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 155 /* IndexSignature */) { + if (node.kind === 156 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 158 /* FunctionType */ || node.kind === 159 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 161 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 159 /* FunctionType */ || node.kind === 160 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 162 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 150 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { + else if (node.kind !== 151 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -59079,26 +63545,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -59106,7 +63572,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 228 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59120,7 +63586,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59155,9 +63621,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 158 /* FunctionType */ || - node.parent.kind === 159 /* ConstructorType */ || - node.parent.parent.kind === 161 /* TypeLiteral */) { + if (node.parent.kind === 159 /* FunctionType */ || + node.parent.kind === 160 /* ConstructorType */ || + node.parent.parent.kind === 162 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!ts.hasModifier(node.parent, 8 /* Private */)) { @@ -59173,24 +63639,29 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 153 /* CallSignature */: + case 154 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 156 /* IndexSignature */: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -59198,7 +63669,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 228 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59211,7 +63682,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59223,12 +63694,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 173 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 174 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -59239,7 +63710,7 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 198 /* OmittedExpression */) { + if (bindingElement.kind === 199 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -59248,7 +63719,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 174 /* BindingElement */) { + else if (bindingElement.kind === 175 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -59287,40 +63758,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 227 /* InterfaceDeclaration */: - case 226 /* ClassDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 229 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return writeFunctionDeclaration(node); - case 154 /* ConstructSignature */: - case 153 /* CallSignature */: - case 155 /* IndexSignature */: + case 155 /* ConstructSignature */: + case 154 /* CallSignature */: + case 156 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return emitPropertyDeclaration(node); - case 260 /* EnumMember */: + case 263 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 261 /* SourceFile */: + case 264 /* SourceFile */: return emitSourceFile(node); } } @@ -59338,7 +63809,7 @@ var ts; } else { // Get the declaration file path - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, @@ -59346,8 +63817,9 @@ var ts; referencesOutput += "/// " + newLine; } return addedBundledEmitReference; - function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) { + function getDeclFileName(emitFileNames, sourceFileOrBundle) { // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path + var isBundledEmit = sourceFileOrBundle.kind === 265 /* Bundle */; if (isBundledEmit && !addBundledFileReference) { return; } @@ -59358,10 +63830,11 @@ var ts; } } /* @internal */ - function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { - var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles); + function writeDeclarationFile(declarationFilePath, sourceFileOrBundle, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFileOrBundle, emitOnlyDtsFiles); var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { + var sourceFiles = sourceFileOrBundle.kind === 265 /* Bundle */ ? sourceFileOrBundle.sourceFiles : [sourceFileOrBundle]; var declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); @@ -59384,83 +63857,73 @@ var ts; } ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); -/// +/// /// -/// -/// +/// +/// /// -/* @internal */ var ts; (function (ts) { - // Flags enum to track count of temp variables and a few dedicated names - var TempFlags; - (function (TempFlags) { - TempFlags[TempFlags["Auto"] = 0] = "Auto"; - TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; - TempFlags[TempFlags["_i"] = 268435456] = "_i"; - })(TempFlags || (TempFlags = {})); - var id = function (s) { return s; }; - var nullTransformers = [function (_) { return id; }]; + var delimiters = createDelimiterMap(); + var brackets = createBracketsMap(); + /*@internal*/ // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { - var delimiters = createDelimiterMap(); - var brackets = createBracketsMap(); + function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); var newLine = host.getNewLine(); - var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions); var writer = ts.createTextWriter(newLine); - var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; var sourceMap = ts.createSourceMapWriter(host, writer); - var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap; - var comments = ts.createCommentWriter(host, writer, sourceMap); - var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition; - var nodeIdToGeneratedName; - var autoGeneratedIdToGeneratedName; - var generatedNameSet; - var tempFlags; var currentSourceFile; - var currentText; - var currentFileIdentifiers; var bundledHelpers; var isOwnFileEmit; var emitSkipped = false; var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); // Transform the source files - ts.performance.mark("beforeTransform"); - var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; - ts.performance.measure("transformTime", "beforeTransform"); + var transform = ts.transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false); + // Create a printer to print the nodes + var printer = createPrinter(compilerOptions, { + // resolver hooks + hasGlobalName: resolver.hasGlobalName, + // transform hooks + onEmitNode: transform.emitNodeWithNotification, + substituteNode: transform.substituteNode, + // sourcemap hooks + onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, + onEmitSourceMapOfToken: sourceMap.emitTokenWithSourceMap, + onEmitSourceMapOfPosition: sourceMap.emitPos, + // emitter hooks + onEmitHelpers: emitHelpers, + onSetSourceFile: setSourceFile, + }); // Emit each output file ts.performance.mark("beforePrint"); - ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); // Clean up emit nodes on parse tree - for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { - var sourceFile = sourceFiles_4[_b]; - ts.disposeEmitNodes(sourceFile); - } + transform.dispose(); return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; - function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + function emitSourceFileOrBundle(_a, sourceFileOrBundle) { + var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; // Make sure not to write js file and source map file if any of them cannot be written if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { if (!emitOnlyDtsFiles) { - printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle); } } else { emitSkipped = true; } if (declarationFilePath) { - emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; + emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; } if (!emitSkipped && emittedFilesList) { if (!emitOnlyDtsFiles) { @@ -59474,26 +63937,24 @@ var ts; } } } - function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { - sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); - nodeIdToGeneratedName = []; - autoGeneratedIdToGeneratedName = []; - generatedNameSet = ts.createMap(); - bundledHelpers = isBundledEmit ? ts.createMap() : undefined; - isOwnFileEmit = !isBundledEmit; - // Emit helpers from all the files - if (isBundledEmit && moduleKind) { - for (var _a = 0, sourceFiles_5 = sourceFiles; _a < sourceFiles_5.length; _a++) { - var sourceFile = sourceFiles_5[_a]; - emitHelpers(sourceFile, /*isBundle*/ true); - } - } - // Print each transformed source file. - ts.forEach(sourceFiles, printSourceFile); - writeLine(); + function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle) { + var bundle = sourceFileOrBundle.kind === 265 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 264 /* SourceFile */ ? sourceFileOrBundle : undefined; + var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFileOrBundle); + if (bundle) { + bundledHelpers = ts.createMap(); + isOwnFileEmit = false; + printer.writeBundle(bundle, writer); + } + else { + isOwnFileEmit = true; + printer.writeFile(sourceFile, writer); + } + writer.writeLine(); var sourceMappingURL = sourceMap.getSourceMappingURL(); if (sourceMappingURL) { - write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment + writer.write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment } // Write the source map if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { @@ -59507,138 +63968,232 @@ var ts; ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); // Reset state sourceMap.reset(); - comments.reset(); writer.reset(); - tempFlags = 0 /* Auto */; currentSourceFile = undefined; - currentText = undefined; + bundledHelpers = undefined; isOwnFileEmit = false; } - function printSourceFile(node) { + function setSourceFile(node) { currentSourceFile = node; - currentText = node.text; - currentFileIdentifiers = node.identifiers; sourceMap.setSourceFile(node); - comments.setSourceFile(node); - pipelineEmitWithNotification(0 /* SourceFile */, node); } - /** - * Emits a node. - */ + function emitHelpers(node, writeLines) { + var helpersEmitted = false; + var bundle = node.kind === 265 /* Bundle */ ? node : undefined; + if (bundle && moduleKind === ts.ModuleKind.None) { + return; + } + var numNodes = bundle ? bundle.sourceFiles.length : 1; + for (var i = 0; i < numNodes; i++) { + var currentNode = bundle ? bundle.sourceFiles[i] : node; + var sourceFile = ts.isSourceFile(currentNode) ? currentNode : currentSourceFile; + var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); + var shouldBundle = ts.isSourceFile(currentNode) && !isOwnFileEmit; + var helpers = ts.getEmitHelpers(currentNode); + if (helpers) { + for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { + var helper = _b[_a]; + if (!helper.scoped) { + // Skip the helper if it can be skipped and the noEmitHelpers compiler + // option is set, or if it can be imported and the importHelpers compiler + // option is set. + if (shouldSkip) + continue; + // Skip the helper if it can be bundled but hasn't already been emitted and we + // are emitting a bundled module. + if (shouldBundle) { + if (bundledHelpers.get(helper.name)) { + continue; + } + bundledHelpers.set(helper.name, true); + } + } + else if (bundle) { + // Skip the helper if it is scoped and we are emitting bundled helpers + continue; + } + writeLines(helper.text); + helpersEmitted = true; + } + } + } + return helpersEmitted; + } + } + ts.emitFiles = emitFiles; + function createPrinter(printerOptions, handlers) { + if (printerOptions === void 0) { printerOptions = {}; } + if (handlers === void 0) { handlers = {}; } + var hasGlobalName = handlers.hasGlobalName, onEmitSourceMapOfNode = handlers.onEmitSourceMapOfNode, onEmitSourceMapOfToken = handlers.onEmitSourceMapOfToken, onEmitSourceMapOfPosition = handlers.onEmitSourceMapOfPosition, onEmitNode = handlers.onEmitNode, onEmitHelpers = handlers.onEmitHelpers, onSetSourceFile = handlers.onSetSourceFile, substituteNode = handlers.substituteNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray; + var newLine = ts.getNewLineCharacter(printerOptions); + var comments = ts.createCommentWriter(printerOptions, onEmitSourceMapOfPosition); + var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition, emitLeadingCommentsOfPosition = comments.emitLeadingCommentsOfPosition; + var currentSourceFile; + var nodeIdToGeneratedName; // Map of generated names for specific nodes. + var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. + var generatedNames; // Set of names generated by the NameGenerator. + var tempFlagsStack; // Stack of enclosing name generation scopes. + var tempFlags; // TempFlags for the current name generation scope. + var writer; + var ownWriter; + reset(); + return { + // public API + printNode: printNode, + printFile: printFile, + printBundle: printBundle, + // internal API + writeNode: writeNode, + writeFile: writeFile, + writeBundle: writeBundle + }; + function printNode(hint, node, sourceFile) { + switch (hint) { + case 0 /* SourceFile */: + ts.Debug.assert(ts.isSourceFile(node), "Expected a SourceFile node."); + break; + case 2 /* IdentifierName */: + ts.Debug.assert(ts.isIdentifier(node), "Expected an Identifier node."); + break; + case 1 /* Expression */: + ts.Debug.assert(ts.isExpression(node), "Expected an Expression node."); + break; + } + switch (node.kind) { + case 264 /* SourceFile */: return printFile(node); + case 265 /* Bundle */: return printBundle(node); + } + writeNode(hint, node, sourceFile, beginPrint()); + return endPrint(); + } + function printBundle(bundle) { + writeBundle(bundle, beginPrint()); + return endPrint(); + } + function printFile(sourceFile) { + writeFile(sourceFile, beginPrint()); + return endPrint(); + } + function writeNode(hint, node, sourceFile, output) { + var previousWriter = writer; + setWriter(output); + print(hint, node, sourceFile); + reset(); + writer = previousWriter; + } + function writeBundle(bundle, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(bundle); + emitPrologueDirectivesIfNeeded(bundle); + emitHelpersIndirect(bundle); + for (var _a = 0, _b = bundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + print(0 /* SourceFile */, sourceFile, sourceFile); + } + reset(); + writer = previousWriter; + } + function writeFile(sourceFile, output) { + var previousWriter = writer; + setWriter(output); + emitShebangIfNeeded(sourceFile); + emitPrologueDirectivesIfNeeded(sourceFile); + print(0 /* SourceFile */, sourceFile, sourceFile); + reset(); + writer = previousWriter; + } + function beginPrint() { + return ownWriter || (ownWriter = ts.createTextWriter(newLine)); + } + function endPrint() { + var text = ownWriter.getText(); + ownWriter.reset(); + return text; + } + function print(hint, node, sourceFile) { + setSourceFile(sourceFile); + pipelineEmitWithNotification(hint, node); + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + comments.setSourceFile(sourceFile); + if (onSetSourceFile) { + onSetSourceFile(sourceFile); + } + } + function setWriter(output) { + writer = output; + comments.setWriter(output); + } + function reset() { + nodeIdToGeneratedName = []; + autoGeneratedIdToGeneratedName = []; + generatedNames = ts.createMap(); + tempFlagsStack = []; + tempFlags = 0 /* Auto */; + comments.reset(); + setWriter(/*output*/ undefined); + } function emit(node) { pipelineEmitWithNotification(3 /* Unspecified */, node); } - /** - * Emits an IdentifierName. - */ function emitIdentifierName(node) { pipelineEmitWithNotification(2 /* IdentifierName */, node); } - /** - * Emits an expression node. - */ function emitExpression(node) { pipelineEmitWithNotification(1 /* Expression */, node); } - /** - * Emits a node with possible notification. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called from printSourceFile, emit, emitExpression, or - * emitIdentifierName. - */ - function pipelineEmitWithNotification(emitContext, node) { - emitNodeWithNotification(emitContext, node, pipelineEmitWithComments); - } - /** - * Emits a node with comments. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithNotification. - */ - function pipelineEmitWithComments(emitContext, node) { - // Do not emit comments for SourceFile - if (emitContext === 0 /* SourceFile */) { - pipelineEmitWithSourceMap(emitContext, node); - return; + function pipelineEmitWithNotification(hint, node) { + if (onEmitNode) { + onEmitNode(hint, node, pipelineEmitWithComments); } - emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap); - } - /** - * Emits a node with source maps. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithComments. - */ - function pipelineEmitWithSourceMap(emitContext, node) { - // Do not emit source mappings for SourceFile or IdentifierName - if (emitContext === 0 /* SourceFile */ - || emitContext === 2 /* IdentifierName */) { - pipelineEmitWithSubstitution(emitContext, node); - return; + else { + pipelineEmitWithComments(hint, node); } - emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution); - } - /** - * Emits a node with possible substitution. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithSourceMap or - * pipelineEmitInUnspecifiedContext (when picking a more specific context). - */ - function pipelineEmitWithSubstitution(emitContext, node) { - emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext); } - /** - * Emits a node. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitWithSubstitution. - */ - function pipelineEmitForContext(emitContext, node) { - switch (emitContext) { - case 0 /* SourceFile */: return pipelineEmitInSourceFileContext(node); - case 2 /* IdentifierName */: return pipelineEmitInIdentifierNameContext(node); - case 3 /* Unspecified */: return pipelineEmitInUnspecifiedContext(node); - case 1 /* Expression */: return pipelineEmitInExpressionContext(node); + function pipelineEmitWithComments(hint, node) { + node = trySubstituteNode(hint, node); + if (emitNodeWithComments && hint !== 0 /* SourceFile */) { + emitNodeWithComments(hint, node, pipelineEmitWithSourceMap); + } + else { + pipelineEmitWithSourceMap(hint, node); } } - /** - * Emits a node in the SourceFile EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInSourceFileContext(node) { - var kind = node.kind; - switch (kind) { - // Top-level nodes - case 261 /* SourceFile */: - return emitSourceFile(node); + function pipelineEmitWithSourceMap(hint, node) { + if (onEmitSourceMapOfNode && hint !== 0 /* SourceFile */ && hint !== 2 /* IdentifierName */) { + onEmitSourceMapOfNode(hint, node, pipelineEmitWithHint); + } + else { + pipelineEmitWithHint(hint, node); } } - /** - * Emits a node in the IdentifierName EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInIdentifierNameContext(node) { - var kind = node.kind; - switch (kind) { - // Identifiers - case 70 /* Identifier */: - return emitIdentifier(node); + function pipelineEmitWithHint(hint, node) { + switch (hint) { + case 0 /* SourceFile */: return pipelineEmitSourceFile(node); + case 2 /* IdentifierName */: return pipelineEmitIdentifierName(node); + case 1 /* Expression */: return pipelineEmitExpression(node); + case 3 /* Unspecified */: return pipelineEmitUnspecified(node); } } - /** - * Emits a node in the Unspecified EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInUnspecifiedContext(node) { + function pipelineEmitSourceFile(node) { + ts.Debug.assertNode(node, ts.isSourceFile); + emitSourceFile(node); + } + function pipelineEmitIdentifierName(node) { + ts.Debug.assertNode(node, ts.isIdentifier); + emitIdentifier(node); + } + function pipelineEmitUnspecified(node) { var kind = node.kind; + // Reserved words + // Strict mode reserved words + // Contextual keywords + if (ts.isKeyword(kind)) { + writeTokenText(kind); + return; + } switch (kind) { // Pseudo-literals case 13 /* TemplateHead */: @@ -59648,254 +64203,217 @@ var ts; // Identifiers case 70 /* Identifier */: return emitIdentifier(node); - // Reserved words - case 75 /* ConstKeyword */: - case 78 /* DefaultKeyword */: - case 83 /* ExportKeyword */: - case 104 /* VoidKeyword */: - // Strict mode reserved words - case 111 /* PrivateKeyword */: - case 112 /* ProtectedKeyword */: - case 113 /* PublicKeyword */: - case 114 /* StaticKeyword */: - // Contextual keywords - case 116 /* AbstractKeyword */: - case 117 /* AsKeyword */: - case 118 /* AnyKeyword */: - case 119 /* AsyncKeyword */: - case 120 /* AwaitKeyword */: - case 121 /* BooleanKeyword */: - case 122 /* ConstructorKeyword */: - case 123 /* DeclareKeyword */: - case 124 /* GetKeyword */: - case 125 /* IsKeyword */: - case 127 /* ModuleKeyword */: - case 128 /* NamespaceKeyword */: - case 129 /* NeverKeyword */: - case 130 /* ReadonlyKeyword */: - case 131 /* RequireKeyword */: - case 132 /* NumberKeyword */: - case 133 /* SetKeyword */: - case 134 /* StringKeyword */: - case 135 /* SymbolKeyword */: - case 136 /* TypeKeyword */: - case 137 /* UndefinedKeyword */: - case 138 /* FromKeyword */: - case 139 /* GlobalKeyword */: - case 140 /* OfKeyword */: - writeTokenText(kind); - return; // Parse tree nodes // Names - case 141 /* QualifiedName */: + case 142 /* QualifiedName */: return emitQualifiedName(node); - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: return emitTypeParameter(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return emitParameter(node); - case 145 /* Decorator */: + case 146 /* Decorator */: return emitDecorator(node); // Type members - case 146 /* PropertySignature */: + case 147 /* PropertySignature */: return emitPropertySignature(node); - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: return emitPropertyDeclaration(node); - case 148 /* MethodSignature */: + case 149 /* MethodSignature */: return emitMethodSignature(node); - case 149 /* MethodDeclaration */: + case 150 /* MethodDeclaration */: return emitMethodDeclaration(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return emitConstructor(node); - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: return emitAccessorDeclaration(node); - case 153 /* CallSignature */: + case 154 /* CallSignature */: return emitCallSignature(node); - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return emitConstructSignature(node); - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return emitIndexSignature(node); // Types - case 156 /* TypePredicate */: + case 157 /* TypePredicate */: return emitTypePredicate(node); - case 157 /* TypeReference */: + case 158 /* TypeReference */: return emitTypeReference(node); - case 158 /* FunctionType */: + case 159 /* FunctionType */: return emitFunctionType(node); - case 159 /* ConstructorType */: + case 160 /* ConstructorType */: return emitConstructorType(node); - case 160 /* TypeQuery */: + case 161 /* TypeQuery */: return emitTypeQuery(node); - case 161 /* TypeLiteral */: + case 162 /* TypeLiteral */: return emitTypeLiteral(node); - case 162 /* ArrayType */: + case 163 /* ArrayType */: return emitArrayType(node); - case 163 /* TupleType */: + case 164 /* TupleType */: return emitTupleType(node); - case 164 /* UnionType */: + case 165 /* UnionType */: return emitUnionType(node); - case 165 /* IntersectionType */: + case 166 /* IntersectionType */: return emitIntersectionType(node); - case 166 /* ParenthesizedType */: + case 167 /* ParenthesizedType */: return emitParenthesizedType(node); - case 199 /* ExpressionWithTypeArguments */: + case 200 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 167 /* ThisType */: + case 168 /* ThisType */: return emitThisType(); - case 168 /* TypeOperator */: + case 169 /* TypeOperator */: return emitTypeOperator(node); - case 169 /* IndexedAccessType */: + case 170 /* IndexedAccessType */: return emitIndexedAccessType(node); - case 170 /* MappedType */: + case 171 /* MappedType */: return emitMappedType(node); - case 171 /* LiteralType */: + case 172 /* LiteralType */: return emitLiteralType(node); // Binding patterns - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return emitBindingElement(node); // Misc - case 202 /* TemplateSpan */: + case 204 /* TemplateSpan */: return emitTemplateSpan(node); - case 203 /* SemicolonClassElement */: + case 205 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 204 /* Block */: + case 206 /* Block */: return emitBlock(node); - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: return emitVariableStatement(node); - case 206 /* EmptyStatement */: + case 208 /* EmptyStatement */: return emitEmptyStatement(); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: return emitExpressionStatement(node); - case 208 /* IfStatement */: + case 210 /* IfStatement */: return emitIfStatement(node); - case 209 /* DoStatement */: + case 211 /* DoStatement */: return emitDoStatement(node); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: return emitWhileStatement(node); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return emitForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: return emitForInStatement(node); - case 213 /* ForOfStatement */: + case 215 /* ForOfStatement */: return emitForOfStatement(node); - case 214 /* ContinueStatement */: + case 216 /* ContinueStatement */: return emitContinueStatement(node); - case 215 /* BreakStatement */: + case 217 /* BreakStatement */: return emitBreakStatement(node); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: return emitReturnStatement(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: return emitWithStatement(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: return emitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: return emitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: return emitThrowStatement(node); - case 221 /* TryStatement */: + case 223 /* TryStatement */: return emitTryStatement(node); - case 222 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 224 /* VariableDeclarationList */: + case 226 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 225 /* FunctionDeclaration */: + case 227 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: return emitClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: return emitModuleBlock(node); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: return emitCaseBlock(node); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: return emitImportDeclaration(node); - case 236 /* ImportClause */: + case 238 /* ImportClause */: return emitImportClause(node); - case 237 /* NamespaceImport */: + case 239 /* NamespaceImport */: return emitNamespaceImport(node); - case 238 /* NamedImports */: + case 240 /* NamedImports */: return emitNamedImports(node); - case 239 /* ImportSpecifier */: + case 241 /* ImportSpecifier */: return emitImportSpecifier(node); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: return emitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: return emitExportDeclaration(node); - case 242 /* NamedExports */: + case 244 /* NamedExports */: return emitNamedExports(node); - case 243 /* ExportSpecifier */: + case 245 /* ExportSpecifier */: return emitExportSpecifier(node); - case 244 /* MissingDeclaration */: + case 246 /* MissingDeclaration */: return; // Module references - case 245 /* ExternalModuleReference */: + case 247 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 248 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: return emitJsxOpeningElement(node); - case 249 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: return emitJsxClosingElement(node); - case 250 /* JsxAttribute */: + case 252 /* JsxAttribute */: return emitJsxAttribute(node); - case 251 /* JsxSpreadAttribute */: + case 253 /* JsxAttributes */: + return emitJsxAttributes(node); + case 254 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 252 /* JsxExpression */: + case 255 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 253 /* CaseClause */: + case 256 /* CaseClause */: return emitCaseClause(node); - case 254 /* DefaultClause */: + case 257 /* DefaultClause */: return emitDefaultClause(node); - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: return emitHeritageClause(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 257 /* PropertyAssignment */: + case 260 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 258 /* ShorthandPropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 259 /* SpreadAssignment */: + case 262 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 260 /* EnumMember */: + case 263 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with // substitution. if (ts.isExpression(node)) { - return pipelineEmitWithSubstitution(1 /* Expression */, node); + return pipelineEmitExpression(trySubstituteNode(1 /* Expression */, node)); + } + if (ts.isToken(node)) { + writeTokenText(kind); + return; } } - /** - * Emits a node in the Expression EmitContext. - * - * NOTE: Do not call this method directly. It is part of the emit pipeline - * and should only be called indirectly from pipelineEmitForContext. - */ - function pipelineEmitInExpressionContext(node) { + function pipelineEmitExpression(node) { var kind = node.kind; switch (kind) { // Literals @@ -59917,68 +64435,76 @@ var ts; writeTokenText(kind); return; // Expressions - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 176 /* ObjectLiteralExpression */: + case 177 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 177 /* PropertyAccessExpression */: + case 178 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 179 /* CallExpression */: + case 180 /* CallExpression */: return emitCallExpression(node); - case 180 /* NewExpression */: + case 181 /* NewExpression */: return emitNewExpression(node); - case 181 /* TaggedTemplateExpression */: + case 182 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 183 /* ParenthesizedExpression */: + case 184 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 184 /* FunctionExpression */: + case 185 /* FunctionExpression */: return emitFunctionExpression(node); - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: return emitArrowFunction(node); - case 186 /* DeleteExpression */: + case 187 /* DeleteExpression */: return emitDeleteExpression(node); - case 187 /* TypeOfExpression */: + case 188 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 188 /* VoidExpression */: + case 189 /* VoidExpression */: return emitVoidExpression(node); - case 189 /* AwaitExpression */: + case 190 /* AwaitExpression */: return emitAwaitExpression(node); - case 190 /* PrefixUnaryExpression */: + case 191 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 191 /* PostfixUnaryExpression */: + case 192 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: return emitBinaryExpression(node); - case 193 /* ConditionalExpression */: + case 194 /* ConditionalExpression */: return emitConditionalExpression(node); - case 194 /* TemplateExpression */: + case 195 /* TemplateExpression */: return emitTemplateExpression(node); - case 195 /* YieldExpression */: + case 196 /* YieldExpression */: return emitYieldExpression(node); - case 196 /* SpreadElement */: + case 197 /* SpreadElement */: return emitSpreadExpression(node); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return emitClassExpression(node); - case 198 /* OmittedExpression */: + case 199 /* OmittedExpression */: return; - case 200 /* AsExpression */: + case 201 /* AsExpression */: return emitAsExpression(node); - case 201 /* NonNullExpression */: + case 202 /* NonNullExpression */: return emitNonNullExpression(node); + case 203 /* MetaProperty */: + return emitMetaProperty(node); // JSX - case 246 /* JsxElement */: + case 248 /* JsxElement */: return emitJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 297 /* RawExpression */: - return writeLines(node.text); + } + } + function trySubstituteNode(hint, node) { + return node && substituteNode && substituteNode(hint, node) || node; + } + function emitHelpersIndirect(node) { + if (onEmitHelpers) { + onEmitHelpers(node, writeLines); } } // @@ -59987,9 +64513,6 @@ var ts; // SyntaxKind.NumericLiteral function emitNumericLiteral(node) { emitLiteral(node); - if (node.trailingComment) { - write(" /*" + node.trailingComment + "*/"); - } } // SyntaxKind.StringLiteral // SyntaxKind.RegularExpressionLiteral @@ -59999,7 +64522,7 @@ var ts; // SyntaxKind.TemplateTail function emitLiteral(node) { var text = getLiteralTextOfNode(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) + if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -60047,8 +64570,8 @@ var ts; writeIfPresent(node.dotDotDotToken, "..."); emit(node.name); writeIfPresent(node.questionToken, "?"); - emitExpressionWithPrefix(" = ", node.initializer); emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); } function emitDecorator(decorator) { write("@"); @@ -60098,7 +64621,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.kind === 151 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 152 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -60201,17 +64724,13 @@ var ts; write("{"); writeLine(); increaseIndent(); - if (node.readonlyToken) { - write("readonly "); - } + writeIfPresent(node.readonlyToken, "readonly "); write("["); emit(node.typeParameter.name); write(" in "); emit(node.typeParameter.constraint); write("]"); - if (node.questionToken) { - write("?"); - } + writeIfPresent(node.questionToken, "?"); write(": "); emit(node.type); write(";"); @@ -60277,7 +64796,7 @@ var ts; increaseIndent(); } var preferNewLine = node.multiLine ? 32768 /* PreferNewLine */ : 0 /* None */; - var allowTrailingComma = languageVersion >= 1 /* ES5 */ ? 32 /* AllowTrailingComma */ : 0 /* None */; + var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ ? 32 /* AllowTrailingComma */ : 0 /* None */; emitList(node, properties, 978 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine); if (indentedFlag) { decreaseIndent(); @@ -60289,7 +64808,7 @@ var ts; var indentAfterDot = false; if (!(ts.getEmitFlags(node) & 65536 /* NoIndentation */)) { var dotRangeStart = node.expression.end; - var dotRangeEnd = ts.skipTrivia(currentText, node.expression.end) + 1; + var dotRangeEnd = ts.skipTrivia(currentSourceFile.text, node.expression.end) + 1; var dotToken = { kind: 22 /* DotToken */, pos: dotRangeStart, end: dotRangeEnd }; indentBeforeDot = needsIndentation(node, node.expression, dotToken); indentAfterDot = needsIndentation(node, dotToken, node.name); @@ -60305,10 +64824,12 @@ var ts; // 1..toString is a valid property access, emit a dot after the literal // Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal function needsDotDotForPropertyAccess(expression) { - if (expression.kind === 8 /* NumericLiteral */) { - // check if numeric literal was originally written with a dot + expression = ts.skipPartiallyEmittedExpressions(expression); + if (ts.isNumericLiteral(expression)) { + // check if numeric literal is a decimal literal that was originally written with a dot var text = getLiteralTextOfNode(expression); - return text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; + return !expression.numericLiteralFlags + && text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; } else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { // check if constant enum value is integer @@ -60316,7 +64837,7 @@ var ts; // isFinite handles cases when constantValue is undefined return isFinite(constantValue) && Math.floor(constantValue) === constantValue - && compilerOptions.removeComments; + && printerOptions.removeComments; } } function emitElementAccessExpression(node) { @@ -60342,11 +64863,9 @@ var ts; emitExpression(node.template); } function emitTypeAssertionExpression(node) { - if (node.type) { - write("<"); - emit(node.type); - write(">"); - } + write("<"); + emit(node.type); + write(">"); emitExpression(node.expression); } function emitParenthesizedExpression(node) { @@ -60405,7 +64924,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 190 /* PrefixUnaryExpression */ + return operand.kind === 191 /* PrefixUnaryExpression */ && ((node.operator === 36 /* PlusToken */ && (operand.operator === 36 /* PlusToken */ || operand.operator === 42 /* PlusPlusToken */)) || (node.operator === 37 /* MinusToken */ && (operand.operator === 37 /* MinusToken */ || operand.operator === 43 /* MinusMinusToken */))); } @@ -60471,6 +64990,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } // // Misc // @@ -60490,6 +65014,10 @@ var ts; else { writeToken(16 /* OpenBraceToken */, node.pos, /*contextNode*/ node); emitBlockStatements(node); + // We have to call emitLeadingComments explicitly here because otherwise leading comments of the close brace token will not be emitted + increaseIndent(); + emitLeadingCommentsOfPosition(node.statements.end); + decreaseIndent(); writeToken(17 /* CloseBraceToken */, node.statements.end, /*contextNode*/ node); } } @@ -60519,27 +65047,27 @@ var ts; writeToken(18 /* OpenParenToken */, openParenPos, node); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81 /* ElseKeyword */, node.thenStatement.end, node); - if (node.elseStatement.kind === 208 /* IfStatement */) { + if (node.elseStatement.kind === 210 /* IfStatement */) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -60549,7 +65077,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60561,7 +65089,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60571,21 +65099,22 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); write(" "); + emitWithSuffix(node.awaitModifier, " "); writeToken(18 /* OpenParenToken */, openParenPos); emitForBinding(node.initializer); write(" of "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 226 /* VariableDeclarationList */) { emit(node); } else { @@ -60612,7 +65141,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97 /* SwitchKeyword */, node.pos); @@ -60636,9 +65165,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -60669,6 +65201,9 @@ var ts; emitIdentifierName(node.name); emitSignatureAndBody(node, emitSignatureHead); } + function emitBlockCallback(_hint, body) { + emitBlockFunctionBody(body); + } function emitSignatureAndBody(node, emitSignatureHead) { var body = node.body; if (body) { @@ -60679,14 +65214,23 @@ var ts; } if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) { emitSignatureHead(node); - emitBlockFunctionBody(body); + if (onEmitNode) { + onEmitNode(3 /* Unspecified */, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); emitSignatureHead(node); - emitBlockFunctionBody(body); - tempFlags = savedTempFlags; + if (onEmitNode) { + onEmitNode(3 /* Unspecified */, body, emitBlockCallback); + } + else { + emitBlockFunctionBody(body); + } + popNameGenerationScope(); } if (indentedFlag) { decreaseIndent(); @@ -60741,9 +65285,15 @@ var ts; function emitBlockFunctionBody(body) { write(" {"); increaseIndent(); - emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body) + var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine - : emitBlockFunctionBodyWorker); + : emitBlockFunctionBodyWorker; + if (emitBodyWithDetachedComments) { + emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody); + } + else { + emitBlockFunctionBody(body); + } decreaseIndent(); writeToken(17 /* CloseBraceToken */, body.statements.end, body); } @@ -60753,8 +65303,9 @@ var ts; function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { // Emit all the prologue directives (like "use strict"). var statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true); - var helpersEmitted = emitHelpers(body); - if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) { + var pos = writer.getTextPos(); + emitHelpersIndirect(body); + if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine) { decreaseIndent(); emitList(body, body.statements, 384 /* SingleLineFunctionBodyStatements */); increaseIndent(); @@ -60777,15 +65328,14 @@ var ts; } emitTypeParameters(node, node.typeParameters); emitList(node, node.heritageClauses, 256 /* ClassHeritageClauses */); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 65 /* ClassMembers */); write("}"); + popNameGenerationScope(); if (indentedFlag) { decreaseIndent(); } - tempFlags = savedTempFlags; } function emitInterfaceDeclaration(node) { emitDecorators(node, node.decorators); @@ -60812,19 +65362,18 @@ var ts; emitModifiers(node, node.modifiers); write("enum "); emit(node.name); - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write(" {"); emitList(node, node.members, 81 /* EnumMembers */); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } function emitModuleDeclaration(node) { emitModifiers(node, node.modifiers); write(node.flags & 16 /* Namespace */ ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230 /* ModuleDeclaration */) { + while (body.kind === 232 /* ModuleDeclaration */) { write("."); emit(body.name); body = body.body; @@ -60837,13 +65386,11 @@ var ts; write("{ }"); } else { - var savedTempFlags = tempFlags; - tempFlags = 0; + pushNameGenerationScope(); write("{"); - increaseIndent(); emitBlockStatements(node); write("}"); - tempFlags = savedTempFlags; + popNameGenerationScope(); } } function emitCaseBlock(node) { @@ -60951,14 +65498,20 @@ var ts; write("<"); emitJsxTagName(node.tagName); write(" "); - emitList(node, node.attributes, 131328 /* JsxElementAttributes */); + // We are checking here so we won't re-enter the emiting pipeline and emit extra sourcemap + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write("/>"); } function emitJsxOpeningElement(node) { write("<"); emitJsxTagName(node.tagName); - writeIfAny(node.attributes, " "); - emitList(node, node.attributes, 131328 /* JsxElementAttributes */); + writeIfAny(node.attributes.properties, " "); + // We are checking here so we won't re-enter the emitting pipeline and emit extra sourcemap + if (node.attributes.properties && node.attributes.properties.length > 0) { + emit(node.attributes); + } write(">"); } function emitJsxText(node) { @@ -60969,6 +65522,9 @@ var ts; emitJsxTagName(node.tagName); write(">"); } + function emitJsxAttributes(node) { + emitList(node, node.properties, 131328 /* JsxElementAttributes */); + } function emitJsxAttribute(node) { emit(node.name); emitWithPrefix("=", node.initializer); @@ -60981,6 +65537,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -61028,7 +65587,6 @@ var ts; emitList(node, node.types, 272 /* HeritageClauseTypes */); } function emitCatchClause(node) { - writeLine(); var openParenPos = writeToken(73 /* CatchKeyword */, node.pos); write(" "); writeToken(18 /* OpenParenToken */, openParenPos); @@ -61051,7 +65609,7 @@ var ts; // "comment1" is not considered to be leading comment for node.initializer // but rather a trailing comment on the previous node. var initializer = node.initializer; - if ((ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) { + if (emitTrailingCommentsOfPosition && (ts.getEmitFlags(initializer) & 512 /* NoLeadingComments */) === 0) { var commentRange = ts.getCommentRange(initializer); emitTrailingCommentsOfPosition(commentRange.pos); } @@ -61082,17 +65640,27 @@ var ts; // function emitSourceFile(node) { writeLine(); - emitShebang(); - emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker); + var statements = node.statements; + if (emitBodyWithDetachedComments) { + // Emit detached comment if there are no prologue directives or if the first node is synthesized. + // The synthesized node will have no leading comment so some comments may be missed. + var shouldEmitDetachedComment = statements.length === 0 || + !ts.isPrologueDirective(statements[0]) || + ts.nodeIsSynthesized(statements[0]); + if (shouldEmitDetachedComment) { + emitBodyWithDetachedComments(node, statements, emitSourceFileWorker); + return; + } + } + emitSourceFileWorker(node); } function emitSourceFileWorker(node) { var statements = node.statements; - var statementOffset = emitPrologueDirectives(statements); - var savedTempFlags = tempFlags; - tempFlags = 0; - emitHelpers(node); - emitList(node, statements, 1 /* MultiLine */, statementOffset); - tempFlags = savedTempFlags; + pushNameGenerationScope(); + emitHelpersIndirect(node); + var index = ts.findIndex(statements, function (statement) { return !ts.isPrologueDirective(statement); }); + emitList(node, statements, 1 /* MultiLine */, index === -1 ? statements.length : index); + popNameGenerationScope(); } // Transformation nodes function emitPartiallyEmittedExpression(node) { @@ -61102,13 +65670,20 @@ var ts; * Emits any prologue directives at the start of a Statement list, returning the * number of prologue directives written to the output. */ - function emitPrologueDirectives(statements, startWithNewLine) { + function emitPrologueDirectives(statements, startWithNewLine, seenPrologueDirectives) { for (var i = 0; i < statements.length; i++) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); + var statement = statements[i]; + if (ts.isPrologueDirective(statement)) { + var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true; + if (shouldEmitPrologueDirective) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statement); + if (seenPrologueDirectives) { + seenPrologueDirectives.set(statement.expression.text, statement.expression.text); + } } - emit(statements[i]); } else { // return index of the first non prologue directive @@ -61117,81 +65692,42 @@ var ts; } return statements.length; } - function emitHelpers(node, isBundle) { - var sourceFile = ts.isSourceFile(node) ? node : currentSourceFile; - var shouldSkip = compilerOptions.noEmitHelpers || (sourceFile && ts.getExternalHelpersModuleName(sourceFile) !== undefined); - var shouldBundle = ts.isSourceFile(node) && !isOwnFileEmit; - var helpersEmitted = false; - var helpers = ts.getEmitHelpers(node); - if (helpers) { - for (var _a = 0, _b = ts.stableSort(helpers, ts.compareEmitHelpers); _a < _b.length; _a++) { - var helper = _b[_a]; - if (!helper.scoped) { - // Skip the helper if it can be skipped and the noEmitHelpers compiler - // option is set, or if it can be imported and the importHelpers compiler - // option is set. - if (shouldSkip) - continue; - // Skip the helper if it can be bundled but hasn't already been emitted and we - // are emitting a bundled module. - if (shouldBundle) { - if (bundledHelpers[helper.name]) { - continue; - } - bundledHelpers[helper.name] = true; - } - } - else if (isBundle) { - // Skip the helper if it is scoped and we are emitting bundled helpers - continue; - } - writeLines(helper.text); - helpersEmitted = true; - } + function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + setSourceFile(sourceFileOrBundle); + emitPrologueDirectives(sourceFileOrBundle.statements); } - if (helpersEmitted) { - writeLine(); + else { + var seenPrologueDirectives = ts.createMap(); + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + setSourceFile(sourceFile); + emitPrologueDirectives(sourceFile.statements, /*startWithNewLine*/ true, seenPrologueDirectives); + } } - return helpersEmitted; } - function writeLines(text) { - var lines = text.split(/\r\n?|\n/g); - var indentation = guessIndentation(lines); - for (var i = 0; i < lines.length; i++) { - var line = indentation ? lines[i].slice(indentation) : lines[i]; - if (line.length) { - if (i > 0) { - writeLine(); - } - write(line); + function emitShebangIfNeeded(sourceFileOrBundle) { + if (ts.isSourceFile(sourceFileOrBundle)) { + var shebang = ts.getShebang(sourceFileOrBundle.text); + if (shebang) { + write(shebang); + writeLine(); + return true; } } - } - function guessIndentation(lines) { - var indentation; - for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { - var line = lines_1[_a]; - for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { - if (!ts.isWhiteSpace(line.charCodeAt(i))) { - if (indentation === undefined || i < indentation) { - indentation = i; - break; - } + else { + for (var _a = 0, _b = sourceFileOrBundle.sourceFiles; _a < _b.length; _a++) { + var sourceFile = _b[_a]; + // Emit only the first encountered shebang + if (emitShebangIfNeeded(sourceFile)) { + break; } } } - return indentation; } // // Helpers // - function emitShebang() { - var shebang = ts.getShebang(currentText); - if (shebang) { - write(shebang); - writeLine(); - } - } function emitModifiers(node, modifiers) { if (modifiers && modifiers.length) { emitList(node, modifiers, 256 /* Modifiers */); @@ -61216,8 +65752,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1 /* SingleLine */) { write(" "); emit(node); } @@ -61274,6 +65810,9 @@ var ts; if (format & 7680 /* BracketsMask */) { write(getOpeningBracket(format)); } + if (onBeforeEmitNodeArray) { + onBeforeEmitNodeArray(children); + } if (isEmpty) { // Write a line terminator if the parent node was multi-line if (format & 1 /* MultiLine */) { @@ -61306,6 +65845,15 @@ var ts; var child = children[start + i]; // Write the delimiter if this is not the first node. if (previousSibling) { + // i.e + // function commentedParameters( + // /* Parameter a */ + // a + // /* End of parameter a */ -> this comment isn't considered to be trailing comment of parameter "a" due to newline + // , + if (delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } write(delimiter); // Write either a line terminator or whitespace to separate the elements. if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) { @@ -61322,14 +65870,16 @@ var ts; write(" "); } } + // Emit this child. if (shouldEmitInterveningComments) { - var commentRange = ts.getCommentRange(child); - emitTrailingCommentsOfPosition(commentRange.pos); + if (emitTrailingCommentsOfPosition) { + var commentRange = ts.getCommentRange(child); + emitTrailingCommentsOfPosition(commentRange.pos); + } } else { shouldEmitInterveningComments = mayEmitInterveningComments; } - // Emit this child. emit(child); if (shouldDecreaseIndentAfterEmit) { decreaseIndent(); @@ -61342,6 +65892,15 @@ var ts; if (format & 16 /* CommaDelimited */ && hasTrailingComma) { write(","); } + // Emit any trailing comment of the last element in the list + // i.e + // var array = [... + // 2 + // /* end of element 2 */ + // ]; + if (previousSibling && delimiter && previousSibling.end !== parentNode.end) { + emitLeadingCommentsOfPosition(previousSibling.end); + } // Decrease the indent, if requested. if (format & 64 /* Indented */) { decreaseIndent(); @@ -61354,28 +65913,80 @@ var ts; write(" "); } } + if (onAfterEmitNodeArray) { + onAfterEmitNodeArray(children); + } if (format & 7680 /* BracketsMask */) { write(getClosingBracket(format)); } } + function write(s) { + writer.write(s); + } + function writeLine() { + writer.writeLine(); + } + function increaseIndent() { + writer.increaseIndent(); + } + function decreaseIndent() { + writer.decreaseIndent(); + } function writeIfAny(nodes, text) { - if (nodes && nodes.length > 0) { + if (ts.some(nodes)) { write(text); } } function writeIfPresent(node, text) { - if (node !== undefined) { + if (node) { write(text); } } function writeToken(token, pos, contextNode) { - return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText); + return onEmitSourceMapOfToken + ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) + : writeTokenText(token, pos); } function writeTokenText(token, pos) { var tokenString = ts.tokenToString(token); write(tokenString); return pos < 0 ? pos : pos + tokenString.length; } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { + write(" "); + } + else { + writeLine(); + } + } + function writeLines(text) { + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); + for (var i = 0; i < lines.length; i++) { + var line = indentation ? lines[i].slice(indentation) : lines[i]; + if (line.length) { + writeLine(); + write(line); + writeLine(); + } + } + } + function guessIndentation(lines) { + var indentation; + for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) { + var line = lines_1[_a]; + for (var i = 0; i < line.length && (indentation === undefined || i < indentation); i++) { + if (!ts.isWhiteSpace(line.charCodeAt(i))) { + if (indentation === undefined || i < indentation) { + indentation = i; + break; + } + } + } + } + return indentation; + } function increaseIndentIf(value, valueToWriteWhenNotIndenting) { if (value) { increaseIndent(); @@ -61485,15 +66096,23 @@ var ts; && !ts.nodeIsSynthesized(node2) && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } + function isSingleLineEmptyBlock(block) { + return !block.multiLine + && isEmptyBlock(block); + } + function isEmptyBlock(block) { + return block.statements.length === 0 + && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + } function skipSynthesizedParentheses(node) { - while (node.kind === 183 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 184 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { if (ts.isGeneratedIdentifier(node)) { - return getGeneratedIdentifier(node); + return generateName(node); } else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { return ts.unescapeIdentifier(node.text); @@ -61516,26 +66135,60 @@ var ts; return getLiteralTextOfNode(textSourceNode); } } - return ts.getLiteralText(node, currentSourceFile, languageVersion); + return ts.getLiteralText(node, currentSourceFile); } - function isSingleLineEmptyBlock(block) { - return !block.multiLine - && isEmptyBlock(block); + /** + * Push a new name generation scope. + */ + function pushNameGenerationScope() { + tempFlagsStack.push(tempFlags); + tempFlags = 0; } - function isEmptyBlock(block) { - return block.statements.length === 0 - && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + /** + * Pop the current name generation scope. + */ + function popNameGenerationScope() { + tempFlags = tempFlagsStack.pop(); + } + /** + * Generate the text for a generated identifier. + */ + function generateName(name) { + if (name.autoGenerateKind === 4 /* Node */) { + // Node names generate unique names based on their original node + // and are cached based on that node's id. + var node = getNodeForGeneratedName(name); + return generateNameCached(node); + } + else { + // Auto, Loop, and Unique names are cached based on their unique + // autoGenerateId. + var autoGenerateId = name.autoGenerateId; + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(makeName(name))); + } } + function generateNameCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } + /** + * Returns a value indicating whether a name is unique globally, within the current file, + * or within the NameGenerator. + */ function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentFileIdentifiers, name) && - !ts.hasProperty(generatedNameSet, name); + return !(hasGlobalName && hasGlobalName(name)) + && !currentSourceFile.identifiers.has(name) + && !generatedNames.has(name); } + /** + * Returns a value indicating whether a name is unique within a container. + */ function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals) { + var local = node.locals.get(name); // We conservatively include alias symbols to cover cases where they're emitted as locals - if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { + if (local && local.flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { return false; } } @@ -61543,16 +66196,16 @@ var ts; return true; } /** - * Return the next available name in the pattern _a ... _z, _0, _1, ... - * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. - * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. - */ + * Return the next available name in the pattern _a ... _z, _0, _1, ... + * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. + * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. + */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_39 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_39)) { + var name = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name)) { tempFlags |= flags; - return name_39; + return name; } } while (true) { @@ -61560,19 +66213,21 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_40 = count < 26 + var name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_40)) { - return name_40; + if (isUniqueName(name)) { + return name; } } } } - // Generate a name that is unique within the current file and doesn't conflict with any names - // in global scope. The name is formed by adding an '_n' suffix to the specified base name, - // where n is a positive integer. Note that names generated by makeTempVariableName and - // makeUniqueName are guaranteed to never conflict. + /** + * Generate a name that is unique within the current file and doesn't conflict with any names + * in global scope. The name is formed by adding an '_n' suffix to the specified base name, + * where n is a positive integer. Note that names generated by makeTempVariableName and + * makeUniqueName are guaranteed to never conflict. + */ function makeUniqueName(baseName) { // Find the first unique 'name_n', where n is a positive number if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { @@ -61582,73 +66237,90 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + generatedNames.set(generatedName, generatedName); + return generatedName; } i++; } } + /** + * Generates a unique name for a ModuleDeclaration or EnumDeclaration. + */ function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation return isUniqueLocalName(name, node) ? name : makeUniqueName(name); } + /** + * Generates a unique name for an ImportDeclaration or ExportDeclaration. + */ function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); var baseName = expr.kind === 9 /* StringLiteral */ ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; return makeUniqueName(baseName); } + /** + * Generates a unique name for a default export. + */ function generateNameForExportDefault() { return makeUniqueName("default"); } + /** + * Generates a unique name for a class expression. + */ function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameCached(node.name); + } + return makeTempVariableName(0 /* Auto */); + } /** * Generates a unique name from a node. - * - * @param node A node. */ function generateNameForNode(node) { switch (node.kind) { case 70 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 235 /* ImportDeclaration */: - case 241 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 243 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: - case 240 /* ExportAssignment */: + case 227 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 242 /* ExportAssignment */: return generateNameForExportDefault(); - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: return generateNameForClassExpression(); + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0 /* Auto */); } } /** * Generates a unique identifier for a node. - * - * @param name A generated name. */ - function generateName(name) { + function makeName(name) { switch (name.autoGenerateKind) { case 1 /* Auto */: return makeTempVariableName(0 /* Auto */); case 2 /* Loop */: return makeTempVariableName(268435456 /* _i */); case 3 /* Unique */: - return makeUniqueName(name.text); + return makeUniqueName(ts.unescapeIdentifier(name.text)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } /** * Gets the node from which a name should be generated. - * - * @param name A generated name wrapper. */ function getNodeForGeneratedName(name) { var autoGenerateId = name.autoGenerateId; @@ -61668,53 +66340,40 @@ var ts; // otherwise, return the original node for the source; return node; } - /** - * Gets the generated identifier text from a generated identifier. - * - * @param name The generated identifier. - */ - function getGeneratedIdentifier(name) { - if (name.autoGenerateKind === 4 /* Node */) { - // Generated names generate unique names based on their original node - // and are cached based on that node's id - var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); - } - else { - // Auto, Loop, and Unique names are cached based on their unique - // autoGenerateId. - var autoGenerateId = name.autoGenerateId; - return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name))); - } - } - function createDelimiterMap() { - var delimiters = []; - delimiters[0 /* None */] = ""; - delimiters[16 /* CommaDelimited */] = ","; - delimiters[4 /* BarDelimited */] = " |"; - delimiters[8 /* AmpersandDelimited */] = " &"; - return delimiters; - } - function getDelimiter(format) { - return delimiters[format & 28 /* DelimitersMask */]; - } - function createBracketsMap() { - var brackets = []; - brackets[512 /* Braces */] = ["{", "}"]; - brackets[1024 /* Parenthesis */] = ["(", ")"]; - brackets[2048 /* AngleBrackets */] = ["<", ">"]; - brackets[4096 /* SquareBrackets */] = ["[", "]"]; - return brackets; - } - function getOpeningBracket(format) { - return brackets[format & 7680 /* BracketsMask */][0]; - } - function getClosingBracket(format) { - return brackets[format & 7680 /* BracketsMask */][1]; - } } - ts.emitFiles = emitFiles; + ts.createPrinter = createPrinter; + function createDelimiterMap() { + var delimiters = []; + delimiters[0 /* None */] = ""; + delimiters[16 /* CommaDelimited */] = ","; + delimiters[4 /* BarDelimited */] = " |"; + delimiters[8 /* AmpersandDelimited */] = " &"; + return delimiters; + } + function getDelimiter(format) { + return delimiters[format & 28 /* DelimitersMask */]; + } + function createBracketsMap() { + var brackets = []; + brackets[512 /* Braces */] = ["{", "}"]; + brackets[1024 /* Parenthesis */] = ["(", ")"]; + brackets[2048 /* AngleBrackets */] = ["<", ">"]; + brackets[4096 /* SquareBrackets */] = ["[", "]"]; + return brackets; + } + function getOpeningBracket(format) { + return brackets[format & 7680 /* BracketsMask */][0]; + } + function getClosingBracket(format) { + return brackets[format & 7680 /* BracketsMask */][1]; + } + // Flags enum to track count of temp variables and a few dedicated names + var TempFlags; + (function (TempFlags) { + TempFlags[TempFlags["Auto"] = 0] = "Auto"; + TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; + TempFlags[TempFlags["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); var ListFormat; (function (ListFormat) { ListFormat[ListFormat["None"] = 0] = "None"; @@ -61790,6 +66449,7 @@ var ts; var ts; (function (ts) { var emptyArray = []; + var ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } while (true) { @@ -61824,7 +66484,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { // Failed to find any common path component @@ -61857,8 +66518,6 @@ var ts; // otherwise use toLowerCase as a canonical form. return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - // returned by CScript sys environment - var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { var text; try { @@ -61869,20 +66528,18 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.message); } text = ""; } return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined; } function directoryExists(directoryPath) { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (ts.sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -61901,10 +66558,11 @@ var ts; } var hash = ts.sys.createHash(data); var mtimeBefore = ts.sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - var fingerprint = outputFingerprints[fileName]; + if (mtimeBefore) { + var fingerprint = outputFingerprints.get(fileName); // If output has not been changed, and the file has no external modification - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -61912,11 +66570,11 @@ var ts; } ts.sys.writeFile(fileName, data, writeByteOrderMark); var mtimeAfter = ts.sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash: hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName, data, writeByteOrderMark, onError) { try { @@ -62015,10 +66673,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_41 = names_1[_i]; - var result = name_41 in cache - ? cache[name_41] - : cache[name_41] = loader(name_41, containingFile); + var name = names_1[_i]; + var result = void 0; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; @@ -62030,6 +66692,8 @@ var ts; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; + var cachedSemanticDiagnosticsForFile = {}; + var cachedDeclarationDiagnosticsForFile = {}; var resolvedTypeReferenceDirectives = ts.createMap(); var fileProcessingDiagnostics = ts.createDiagnosticCollection(); // The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules. @@ -62054,6 +66718,7 @@ var ts; var supportedExtensions = ts.getSupportedExtensions(options); // Map storing if there is emit blocking diagnostics for given input var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -62067,7 +66732,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -62113,6 +66779,8 @@ var ts; } } } + // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks + moduleResolutionCache = undefined; // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; program = { @@ -62147,7 +66815,7 @@ var ts; return program; function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { - var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); @@ -62171,7 +66839,7 @@ var ts; classifiableNames = ts.createMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; - ts.copyProperties(sourceFile.classifiableNames, classifiableNames); + ts.copyEntries(sourceFile.classifiableNames, classifiableNames); } } return classifiableNames; @@ -62245,7 +66913,7 @@ var ts; // combine results of resolutions and predicted results var j = 0; for (var i = 0; i < result.length; i++) { - if (result[i] == predictedToResolveToAmbientModuleMarker) { + if (result[i] === predictedToResolveToAmbientModuleMarker) { result[i] = undefined; } else { @@ -62378,7 +67046,7 @@ var ts; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } // update fileName -> file mapping - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -62407,7 +67075,7 @@ var ts; }; } function isSourceFileFromExternalLibrary(file) { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true)); @@ -62418,13 +67086,13 @@ var ts; function getTypeChecker() { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false)); } - function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { - return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); }); + function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers) { + return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers); }); } function isEmitBlocked(emitFileName) { return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); } - function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { + function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers) { var declarationDiagnostics = []; if (options.noEmit) { return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; @@ -62456,7 +67124,8 @@ var ts; // checked is to not pass the file to getEmitResolver. var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); ts.performance.mark("beforeEmit"); - var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles); + var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers); ts.performance.mark("afterEmit"); ts.performance.measure("Emit", "beforeEmit", "afterEmit"); return emitResult; @@ -62529,19 +67198,48 @@ var ts; } } function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedSemanticDiagnosticsForFile, getSemanticDiagnosticsForFileNoCache); + } + function getSemanticDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - // For JavaScript files, we don't want to report semantic errors. - // Instead, we'll report errors for using TypeScript-only constructs from within a - // JavaScript file when we get syntactic diagnostics for the file. - var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken); + // For JavaScript files, we don't want to report semantic errors unless explicitly requested. + var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); + return ts.isSourceFileJavaScript(sourceFile) + ? ts.filter(diagnostics, shouldReportDiagnostic) + : diagnostics; }); } + /** + * Skip errors if previous line start with '// @ts-ignore' comment, not counting non-empty non-comment lines + */ + function shouldReportDiagnostic(diagnostic) { + var file = diagnostic.file, start = diagnostic.start; + if (file) { + var lineStarts = ts.getLineStarts(file); + var line = ts.computeLineAndCharacterOfPosition(lineStarts, start).line; + while (line > 0) { + var previousLineText = file.text.slice(lineStarts[line - 1], lineStarts[line]); + var result = ignoreDiagnosticCommentRegEx.exec(previousLineText); + if (!result) { + // non-empty line + return true; + } + if (result[3]) { + // @ts-ignore + return false; + } + line--; + } + } + return true; + } function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { return runWithCancellationToken(function () { var diagnostics = []; @@ -62552,23 +67250,23 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 144 /* Parameter */: - case 147 /* PropertyDeclaration */: + case 145 /* Parameter */: + case 148 /* PropertyDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } - // Pass through - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 223 /* VariableDeclaration */: + // falls through + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 225 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -62576,35 +67274,35 @@ var ts; } } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255 /* HeritageClause */: + case 258 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 107 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 182 /* TypeAssertionExpression */: + case 183 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; @@ -62619,29 +67317,29 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226 /* ClassDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 228 /* ClassDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - // pass through - case 205 /* VariableStatement */: + // falls through + case 207 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 207 /* VariableStatement */); } break; - case 147 /* PropertyDeclaration */: + case 148 /* PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { @@ -62653,16 +67351,16 @@ var ts; return; } break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -62670,8 +67368,8 @@ var ts; } break; } - for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { - var node = nodes_6[_b]; + for (var _b = 0, nodes_8 = nodes; _b < nodes_8.length; _b++) { + var node = nodes_8[_b]; walk(node); } } @@ -62683,7 +67381,8 @@ var ts; if (isConstValid) { continue; } - // Fallthrough to report error + // to report error, + // falls through case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: @@ -62711,12 +67410,34 @@ var ts; }); } function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { + return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache); + } + function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); // Don't actually write any files since we're just getting diagnostics. return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile); }); } + function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) { + var cachedResult = sourceFile + ? cache.perFile && cache.perFile.get(sourceFile.path) + : cache.allDiagnostics; + if (cachedResult) { + return cachedResult; + } + var result = getDiagnostics(sourceFile, cancellationToken) || emptyArray; + if (sourceFile) { + if (!cache.perFile) { + cache.perFile = ts.createFileMap(); + } + cache.perFile.set(sourceFile.path, result); + } + else { + cache.allDiagnostics = result; + } + return result; + } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); } @@ -62759,11 +67480,10 @@ var ts; && (options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) { // synthesize 'import "tslib"' declaration - var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */); - externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235 /* ImportDeclaration */); - importDecl.parent = file; + var externalHelpersModuleReference = ts.createLiteral(ts.externalHelpersModuleNameText); + var importDecl = ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined); externalHelpersModuleReference.parent = importDecl; + importDecl.parent = file; imports = [externalHelpersModuleReference]; } for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { @@ -62779,9 +67499,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 243 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -62796,7 +67516,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -62896,18 +67616,18 @@ var ts; } // If the file was previously found via a node_modules search, but is now being processed as a root file, // then everything it sucks in may also be marked incorrectly, and needs to be checked again. - if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file_1.path] = false; + if (file_1 && sourceFilesFoundSearchingNodeModules.get(file_1.path) && currentNodeModulesDepth === 0) { + sourceFilesFoundSearchingNodeModules.set(file_1.path, false); if (!options.noResolve) { processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } - else if (file_1 && modulesWithElidedImports[file_1.path]) { + else if (file_1 && modulesWithElidedImports.get(file_1.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file_1.path] = false; + modulesWithElidedImports.set(file_1.path, false); processImportedModules(file_1); } } @@ -62924,7 +67644,7 @@ var ts; }); filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case @@ -62973,7 +67693,7 @@ var ts; } function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { // If we already found this library as a primary reference - nothing to do - var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -63007,7 +67727,7 @@ var ts; fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_type_definition_file_for_0, typeReferenceDirective)); } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } function createDiagnostic(refFile, refPos, refEnd, message) { @@ -63056,7 +67776,7 @@ var ts; // This may still end up being an untyped module -- the file won't be included but imports will be allowed. var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); @@ -63075,8 +67795,8 @@ var ts; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { - var file = sourceFiles_6[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -63087,8 +67807,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { - var sourceFile = sourceFiles_7[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -63182,7 +67902,7 @@ var ts; if (options.lib && options.noLib) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } - if (options.noImplicitUseStrict && options.alwaysStrict) { + if (options.noImplicitUseStrict && (options.alwaysStrict === undefined ? options.strict : options.alwaysStrict)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); } var languageVersion = options.target || 0 /* ES3 */; @@ -63228,6 +67948,9 @@ var ts; if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } + if (options.checkJs && !options.allowJs) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")); + } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); @@ -63247,7 +67970,7 @@ var ts; if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { + ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -63323,40 +68046,13 @@ var ts; ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; /* @internal */ ts.optionDeclarations = [ - { - name: "charset", - type: "string", - }, - ts.compileOnSaveCommandLineOption, - { - name: "declaration", - shortName: "d", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "diagnostics", - type: "boolean", - }, - { - name: "extendedDiagnostics", - type: "boolean", - experimental: true - }, - { - name: "emitBOM", - type: "boolean" - }, + // CommandLine only options { name: "help", shortName: "h", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, }, { @@ -63365,219 +68061,57 @@ var ts; type: "boolean" }, { - name: "init", - type: "boolean", - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, - }, - { - name: "inlineSourceMap", - type: "boolean", - }, - { - name: "inlineSources", - type: "boolean", - }, - { - name: "jsx", - type: ts.createMap({ - "preserve": 1 /* Preserve */, - "react": 2 /* React */ - }), - paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - }, - { - name: "reactNamespace", - type: "string", - description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit - }, - { - name: "jsxFactory", - type: "string", - description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h - }, - { - name: "listFiles", - type: "boolean", - }, - { - name: "locale", - type: "string", - }, - { - name: "mapRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: ts.Diagnostics.LOCATION, - }, - { - name: "module", - shortName: "m", - type: ts.createMap({ - "none": ts.ModuleKind.None, - "commonjs": ts.ModuleKind.CommonJS, - "amd": ts.ModuleKind.AMD, - "system": ts.ModuleKind.System, - "umd": ts.ModuleKind.UMD, - "es6": ts.ModuleKind.ES2015, - "es2015": ts.ModuleKind.ES2015, - }), - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - }, - { - name: "newLine", - type: ts.createMap({ - "crlf": 0 /* CarriageReturnLineFeed */, - "lf": 1 /* LineFeed */ - }), - description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - }, - { - name: "noEmit", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs, - }, - { - name: "noEmitHelpers", - type: "boolean" - }, - { - name: "noEmitOnError", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "noErrorTruncation", - type: "boolean" - }, - { - name: "noImplicitAny", + name: "all", type: "boolean", - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "noImplicitThis", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "noUnusedLocals", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_locals, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Show_all_compiler_options, }, { - name: "noUnusedParameters", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_parameters, - }, - { - name: "noLib", - type: "boolean", - }, - { - name: "noResolve", - type: "boolean", - }, - { - name: "skipDefaultLibCheck", - type: "boolean", - }, - { - name: "skipLibCheck", + name: "version", + shortName: "v", type: "boolean", - description: ts.Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "out", - type: "string", - isFilePath: false, - // for correct behaviour, please use outFile - paramType: ts.Diagnostics.FILE, - }, - { - name: "outFile", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, - paramType: ts.Diagnostics.FILE, - }, - { - name: "outDir", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Redirect_output_structure_to_the_directory, - paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_the_compiler_s_version, }, { - name: "preserveConstEnums", + name: "init", type: "boolean", - description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "pretty", - description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, - type: "boolean" + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, }, { name: "project", shortName: "p", type: "string", isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY - }, - { - name: "removeComments", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_comments_to_output, - }, - { - name: "rootDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.LOCATION, - description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - }, - { - name: "isolatedModules", - type: "boolean", - }, - { - name: "sourceMap", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_map_file, - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: ts.Diagnostics.LOCATION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY, + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, }, { - name: "suppressExcessPropertyErrors", + name: "pretty", type: "boolean", - description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, - experimental: true + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental }, { - name: "suppressImplicitAnyIndexErrors", - type: "boolean", - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, - }, - { - name: "stripInternal", + name: "watch", + shortName: "w", type: "boolean", - description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - experimental: true + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Watch_input_files, }, + // Basic { name: "target", shortName: "t", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES2015 */, @@ -63586,144 +68120,34 @@ var ts; "es2017": 4 /* ES2017 */, "esnext": 5 /* ESNext */, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, paramType: ts.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, }, { - name: "version", - shortName: "v", - type: "boolean", - description: ts.Diagnostics.Print_the_compiler_s_version, - }, - { - name: "watch", - shortName: "w", - type: "boolean", - description: ts.Diagnostics.Watch_input_files, - }, - { - name: "experimentalDecorators", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators - }, - { - name: "emitDecoratorMetadata", - type: "boolean", - experimental: true, - description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators - }, - { - name: "moduleResolution", - type: ts.createMap({ - "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic, + name: "module", + shortName: "m", + type: ts.createMapFromTemplate({ + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES2015, + "es2015": ts.ModuleKind.ES2015, }), - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - paramType: ts.Diagnostics.STRATEGY, - }, - { - name: "allowUnusedLabels", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unused_labels - }, - { - name: "noImplicitReturns", - type: "boolean", - description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value - }, - { - name: "noFallthroughCasesInSwitch", - type: "boolean", - description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement - }, - { - name: "allowUnreachableCode", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, - { - name: "baseUrl", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names - }, - { - // this option can only be specified in tsconfig.json - // use type = object to copy the value as-is - name: "paths", - type: "object", - isTSConfigOnly: true - }, - { - // this option can only be specified in tsconfig.json - // use type = object to copy the value as-is - name: "rootDirs", - type: "list", - isTSConfigOnly: true, - element: { - name: "rootDirs", - type: "string", - isFilePath: true - } - }, - { - name: "typeRoots", - type: "list", - element: { - name: "typeRoots", - type: "string", - isFilePath: true - } - }, - { - name: "types", - type: "list", - element: { - name: "types", - type: "string" - }, - description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation - }, - { - name: "traceResolution", - type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process - }, - { - name: "allowJs", - type: "boolean", - description: ts.Diagnostics.Allow_javascript_files_to_be_compiled - }, - { - name: "allowSyntheticDefaultImports", - type: "boolean", - description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking - }, - { - name: "noImplicitUseStrict", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output - }, - { - name: "maxNodeModuleJsDepth", - type: "number", - description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files - }, - { - name: "listEmittedFiles", - type: "boolean" + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, }, { name: "lib", type: "list", element: { name: "lib", - type: ts.createMap({ + type: ts.createMapFromTemplate({ // JavaScript only "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", @@ -63731,6 +68155,7 @@ var ts; "es7": "lib.es2016.d.ts", "es2016": "lib.es2016.d.ts", "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", // Host only "dom": "lib.dom.d.ts", "dom.iterable": "lib.dom.iterable.d.ts", @@ -63750,28 +68175,487 @@ var ts; "es2017.object": "lib.es2017.object.d.ts", "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", "es2017.string": "lib.es2017.string.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", }), }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon }, { - name: "disableSizeLimit", - type: "boolean" + name: "allowJs", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled }, { - name: "strictNullChecks", + name: "checkJs", type: "boolean", - description: ts.Diagnostics.Enable_strict_null_checks + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Report_errors_in_js_files + }, + { + name: "jsx", + type: ts.createMapFromTemplate({ + "preserve": 1 /* Preserve */, + "react-native": 3 /* ReactNative */, + "react": 2 /* React */ + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_d_ts_file, + }, + { + name: "sourceMap", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_map_file, + }, + { + name: "outFile", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + }, + { + name: "outDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + }, + { + name: "rootDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + }, + { + name: "removeComments", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_comments_to_output, + }, + { + name: "noEmit", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_outputs, }, { name: "importHelpers", type: "boolean", + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Import_emit_helpers_from_tslib }, + { + name: "downlevelIteration", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 + }, + { + name: "isolatedModules", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule + }, + // Strict Type Checks + { + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_all_strict_type_checking_options + }, + { + name: "noImplicitAny", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, + }, + { + name: "strictNullChecks", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_strict_null_checks + }, + { + name: "noImplicitThis", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, { name: "alwaysStrict", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + }, + // Additional Checks + { + name: "noUnusedLocals", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_locals, + }, + { + name: "noUnusedParameters", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_parameters, + }, + { + name: "noImplicitReturns", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + // Module Resolution + { + name: "moduleResolution", + type: ts.createMapFromTemplate({ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic, + }), + paramType: ts.Diagnostics.STRATEGY, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "paths", + type: "object", + isTSConfigOnly: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl + }, + { + // this option can only be specified in tsconfig.json + // use type = object to copy the value as-is + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime + }, + { + name: "typeRoots", + type: "list", + element: { + name: "typeRoots", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + // Source Maps + { + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + }, + { + name: "inlineSources", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + }, + // Experimental + { + name: "experimentalDecorators", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + // Advanced + { + name: "jsxFactory", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_verbose_diagnostic_information + }, + { + name: "traceResolution", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "listFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation + }, + { + name: "listEmittedFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation + }, + { + name: "out", + type: "string", + isFilePath: false, + // for correct behaviour, please use outFile + category: ts.Diagnostics.Advanced_Options, + paramType: ts.Diagnostics.FILE, + description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + }, + { + name: "charset", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_character_set_of_the_input_files + }, + { + name: "emitBOM", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + }, + { + name: "locale", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: ts.createMapFromTemplate({ + "crlf": 0 /* CarriageReturnLineFeed */, + "lf": 1 /* LineFeed */ + }), + paramType: ts.Diagnostics.NEWLINE, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + }, + { + name: "disableSizeLimit", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects + }, + { + name: "noImplicitUseStrict", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "noEmitHelpers", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + }, + { + name: "noEmitOnError", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, + }, + { + name: "preserveConstEnums", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, + }, + { + name: "allowUnusedLabels", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "allowUnreachableCode", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + }, + { + // A list of plugins to load in the language service + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts.Diagnostics.List_of_language_service_plugins } ]; /* @internal */ @@ -63808,8 +68692,7 @@ var ts; ts.defaultInitCompilerOptions = { module: ts.ModuleKind.CommonJS, target: 1 /* ES5 */, - noImplicitAny: false, - sourceMap: false, + strict: true }; var optionNameMapCache; /* @internal */ @@ -63834,9 +68717,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -63845,20 +68728,13 @@ var ts; ts.getOptionNameMap = getOptionNameMap; /* @internal */ function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; /* @internal */ function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; /* @internal */ @@ -63882,7 +68758,6 @@ var ts; } } ts.parseListTypeOption = parseListTypeOption; - /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -63905,11 +68780,12 @@ var ts; else if (s.charCodeAt(0) === 45 /* minus */) { s = s.slice(s.charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase(); // Try to translate short option names to their full equivalents. - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -63997,9 +68873,9 @@ var ts; } ts.parseCommandLine = parseCommandLine; /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ + * Read tsconfig.json file + * @param fileName The path to the config file + */ function readConfigFile(fileName, readFile) { var text = ""; try { @@ -64012,10 +68888,10 @@ var ts; } ts.readConfigFile = readConfigFile; /** - * Parse the text of the tsconfig.json file - * @param fileName The path to the config file - * @param jsonText The text of the config file - */ + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ function parseConfigFileTextToJson(fileName, jsonText, stripComments) { if (stripComments === void 0) { stripComments = true; } try { @@ -64033,7 +68909,7 @@ var ts; * @param fileNames array of filenames to be generated into tsconfig.json */ /* @internal */ - function generateTSConfig(options, fileNames) { + function generateTSConfig(options, fileNames, newLine) { var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); var configurations = { compilerOptions: serializeCompilerOptions(compilerOptions) @@ -64042,7 +68918,7 @@ var ts; // only set the files property if we have at least one file configurations.files = fileNames; } - return configurations; + return writeConfigurations(); function getCustomTypeMapOfCommandLineOption(optionDefinition) { if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { // this is of a type CommandLineOptionOfPrimitiveType @@ -64057,58 +68933,130 @@ var ts; } function getNameOfCompilerOptionValue(value, customTypeMap) { // There is a typeMap associated with this command-line option so use it to map value back to its name - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_42 in options) { - if (ts.hasProperty(options, name_42)) { + for (var name in options) { + if (ts.hasProperty(options, name)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_42) { - case "init": - case "watch": - case "version": - case "help": - case "project": - break; - default: - var value = options[name_42]; - var optionDefinition = optionsNameMap[name_42.toLowerCase()]; - if (optionDefinition) { - var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - // There is no map associated with this compiler option then use the value as-is - // This is the case if the value is expect to be string, number, boolean or list of string - result[name_42] = value; - } - else { - if (optionDefinition.type === "list") { - var convertedValue = []; - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name_42] = convertedValue; - } - else { - // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_42] = getNameOfCompilerOptionValue(value, customTypeMap); - } + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { + continue; + } + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap) { + // There is no map associated with this compiler option then use the value as-is + // This is the case if the value is expect to be string, number, boolean or list of string + result[name] = value; + } + else { + if (optionDefinition.type === "list") { + var convertedValue = []; + for (var _i = 0, _a = value; _i < _a.length; _i++) { + var element = _a[_i]; + convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } + result[name] = convertedValue; } - break; + else { + // There is a typeMap associated with this command-line option so use it to map value back to its name + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); + } + } } } } return result; } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return ts.arrayFrom(option.type.keys())[0]; + } + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function writeConfigurations() { + // Filter applicable options to place in the file + var categorizedOptions = ts.reduceLeft(ts.filter(ts.optionDeclarations, function (o) { return o.category !== ts.Diagnostics.Command_line_Options && o.category !== ts.Diagnostics.Advanced_Options; }), function (memo, value) { + if (value.category) { + var name = ts.getLocaleSpecificMessage(value.category); + (memo[name] || (memo[name] = [])).push(value); + } + return memo; + }, {}); + // Serialize all options and thier descriptions + var marginLength = 0; + var seenKnownKeys = 0; + var nameColumn = []; + var descriptionColumn = []; + var knownKeysCount = ts.getOwnKeys(configurations.compilerOptions).length; + for (var category in categorizedOptions) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push("/* " + category + " */"); + descriptionColumn.push(""); + for (var _i = 0, _a = categorizedOptions[category]; _i < _a.length; _i++) { + var option = _a[_i]; + var optionName = void 0; + if (ts.hasProperty(configurations.compilerOptions, option.name)) { + optionName = "\"" + option.name + "\": " + JSON.stringify(configurations.compilerOptions[option.name]) + ((seenKnownKeys += 1) === knownKeysCount ? "" : ","); + } + else { + optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; + } + nameColumn.push(optionName); + descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); + marginLength = Math.max(optionName.length, marginLength); + } + } + // Write the output + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push(tab + "\"compilerOptions\": {"); + // Print out each row, aligning all the descriptions on the same column. + for (var i = 0; i < nameColumn.length; i++) { + var optionName = nameColumn[i]; + var description = descriptionColumn[i]; + result.push(tab + tab + optionName + makePadding(marginLength - optionName.length + 2) + description); + } + if (configurations.files && configurations.files.length) { + result.push(tab + "},"); + result.push(tab + "\"files\": ["); + for (var i = 0; i < configurations.files.length; i++) { + result.push("" + tab + tab + JSON.stringify(configurations.files[i]) + (i === configurations.files.length - 1 ? "" : ",")); + } + result.push(tab + "]"); + } + else { + result.push(tab + "}"); + } + result.push("}"); + return result.join(newLine); + } } ts.generateTSConfig = generateTSConfig; /** @@ -64136,16 +69084,18 @@ var ts; return output; } /** - * Parse the contents of a config file (tsconfig.json). - * @param json The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -64272,7 +69222,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -64323,8 +69273,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -64358,8 +69308,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -64449,7 +69400,7 @@ var ts; * @param host The host used to resolve files and directories. * @param errors An array for diagnostic reporting. */ - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); // The exclude spec list is converted into a regular expression, which allows us to quickly // test whether a file or directory should be excluded before recursively traversing the @@ -64476,14 +69427,14 @@ var ts; var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); // Literal files are always included verbatim. An "include" or "exclude" specification cannot // remove a literal file. if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -64504,14 +69455,13 @@ var ts; // same directory, we should remove it. removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -64519,8 +69469,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -64554,7 +69504,7 @@ var ts; // /a/b/a?z - Watch /a/b directly to catch any new file matching a?z var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -64576,14 +69526,15 @@ var ts; } } // Remove any subpaths under an existing recursively watched directory. - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } } return wildcardDirectories; } @@ -64610,11 +69561,11 @@ var ts; */ function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority); + var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); for (var i = 0 /* Highest */; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -64630,23 +69581,13 @@ var ts; */ function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority); + var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - /** - * Adds a file to an array of files. - * - * @param output The output array. - * @param file The file path. - */ - function addFileToOutput(output, file) { - output.push(file); - return output; - } /** * Gets a case sensitive key. * @@ -64673,7 +69614,9 @@ var ts; this.text = text; } StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); }; StringScriptSnapshot.prototype.getLength = function () { return this.text.length; @@ -64783,8 +69726,7 @@ var ts; ScriptElementKind.typeElement = "type"; /** enum E */ ScriptElementKind.enumElement = "enum"; - // TODO: GH#9983 - ScriptElementKind.enumMemberElement = "const"; + ScriptElementKind.enumMemberElement = "enum member"; /** * Inside module and script only * const v = .. @@ -64827,6 +69769,10 @@ var ts; ScriptElementKind.letElement = "let"; ScriptElementKind.directory = "directory"; ScriptElementKind.externalModuleName = "external module name"; + /** + * + */ + ScriptElementKind.jsxAttribute = "JSX attribute"; })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); var ScriptElementKindModifier; (function (ScriptElementKindModifier) { @@ -64912,33 +69858,34 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 144 /* Parameter */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: - case 260 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 256 /* CatchClause */: + case 145 /* Parameter */: + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: + case 263 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 259 /* CatchClause */: + case 252 /* JsxAttribute */: return 1 /* Value */; - case 143 /* TypeParameter */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 161 /* TypeLiteral */: + case 144 /* TypeParameter */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 162 /* TypeLiteral */: return 2 /* Type */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -64948,22 +69895,25 @@ var ts; else { return 4 /* Namespace */; } - case 238 /* NamedImports */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 240 /* NamedImports */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 237 /* ImportDeclaration */: + case 242 /* ExportAssignment */: + case 243 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 261 /* SourceFile */: + case 264 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240 /* ExportAssignment */) { + if (node.kind === 264 /* SourceFile */) { + return 1 /* Value */; + } + else if (node.parent.kind === 242 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -64988,15 +69938,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 141 /* QualifiedName */ && + if (node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 234 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 236 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function isInRightSideOfImport(node) { - while (node.parent.kind === 141 /* QualifiedName */) { + while (node.parent.kind === 142 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -65007,27 +69957,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 141 /* QualifiedName */) { - while (root.parent && root.parent.kind === 141 /* QualifiedName */) { + if (root.parent.kind === 142 /* QualifiedName */) { + while (root.parent && root.parent.kind === 142 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 157 /* TypeReference */ && !isLastClause; + return root.parent.kind === 158 /* TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 177 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 177 /* PropertyAccessExpression */) { + if (root.parent.kind === 178 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 178 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 255 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 200 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 258 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 226 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || - (decl.kind === 227 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); + return (decl.kind === 228 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || + (decl.kind === 229 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); } return false; } @@ -65035,17 +69985,17 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 157 /* TypeReference */ || - (node.parent.kind === 199 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 158 /* TypeReference */ || + (node.parent.kind === 200 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 98 /* ThisKeyword */ && !ts.isPartOfExpression(node)) || - node.kind === 167 /* ThisType */; + node.kind === 168 /* ThisType */; } function isCallExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 179 /* CallExpression */); + return isCallOrNewExpressionTarget(node, 180 /* CallExpression */); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node) { - return isCallOrNewExpressionTarget(node, 180 /* NewExpression */); + return isCallOrNewExpressionTarget(node, 181 /* NewExpression */); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, kind) { @@ -65058,7 +70008,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 221 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -65068,13 +70018,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 /* Identifier */ && - (node.parent.kind === 215 /* BreakStatement */ || node.parent.kind === 214 /* ContinueStatement */) && + (node.parent.kind === 217 /* BreakStatement */ || node.parent.kind === 216 /* ContinueStatement */) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 /* Identifier */ && - node.parent.kind === 219 /* LabeledStatement */ && + node.parent.kind === 221 /* LabeledStatement */ && node.parent.label === node; } function isLabelName(node) { @@ -65082,15 +70032,15 @@ var ts; } ts.isLabelName = isLabelName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 142 /* QualifiedName */ && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 178 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 232 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -65101,19 +70051,19 @@ var ts; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 260 /* EnumMember */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 230 /* ModuleDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 260 /* PropertyAssignment */: + case 263 /* EnumMember */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 232 /* ModuleDeclaration */: return node.parent.name === node; - case 178 /* ElementAccessExpression */: + case 179 /* ElementAccessExpression */: return node.parent.argumentExpression === node; - case 142 /* ComputedPropertyName */: + case 143 /* ComputedPropertyName */: return true; } } @@ -65162,17 +70112,17 @@ var ts; return undefined; } switch (node.kind) { - case 261 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 264 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: return node; } } @@ -65180,46 +70130,46 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: return ts.ScriptElementKind.moduleElement; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: return ts.ScriptElementKind.classElement; - case 227 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; - case 228 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; - case 229 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; - case 223 /* VariableDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; + case 230 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; + case 231 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; + case 225 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 174 /* BindingElement */: + case 175 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return ts.ScriptElementKind.functionElement; - case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; - case 152 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 152 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; + case 153 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: return ts.ScriptElementKind.memberFunctionElement; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return ts.ScriptElementKind.memberVariableElement; - case 155 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; - case 154 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; - case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; - case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; - case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; - case 260 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; - case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234 /* ImportEqualsDeclaration */: - case 239 /* ImportSpecifier */: - case 236 /* ImportClause */: - case 243 /* ExportSpecifier */: - case 237 /* NamespaceImport */: + case 156 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; + case 155 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; + case 154 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; + case 151 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; + case 144 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; + case 263 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; + case 145 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + case 236 /* ImportEqualsDeclaration */: + case 241 /* ImportSpecifier */: + case 238 /* ImportClause */: + case 245 /* ExportSpecifier */: + case 239 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -65233,15 +70183,6 @@ var ts; } } ts.getNodeKind = getNodeKind; - function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 171 /* LiteralType */ ? node.parent : node; - var type = typeChecker.getTypeAtLocation(searchNode); - if (type && type.flags & 32 /* StringLiteral */) { - return type; - } - return undefined; - } - ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode; function isThis(node) { switch (node.kind) { case 98 /* ThisKeyword */: @@ -65249,7 +70190,7 @@ var ts; return true; case 70 /* Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 144 /* Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 145 /* Parameter */; default: return false; } @@ -65258,7 +70199,7 @@ var ts; // Matches the beginning of a triple slash directive var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= node.end) { + if (c.kind === 293 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -65497,7 +70438,7 @@ var ts; if (includeJsDocComment === void 0) { includeJsDocComment = false; } var current = sourceFile; outer: while (true) { - if (isToken(current)) { + if (ts.isToken(current)) { // exit early return current; } @@ -65522,8 +70463,8 @@ var ts; } } // find the child that contains 'position' - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; // all jsDocComment nodes were already visited if (ts.isJSDocNode(child)) { continue; @@ -65547,18 +70488,18 @@ var ts; } } /** - * The token on the left of the position is the token that strictly includes the position - * or sits to the left of the cursor if it is on a boundary. For example - * - * fo|o -> will return foo - * foo |bar -> will return foo - * - */ + * The token on the left of the position is the token that strictly includes the position + * or sits to the left of the cursor if it is on a boundary. For example + * + * fo|o -> will return foo + * foo |bar -> will return foo + * + */ function findTokenOnLeftOfPosition(file, position) { // Ideally, getTokenAtPosition should return a token. However, it is currently // broken, so we do a check to make sure the result was indeed a token. var tokenAtPosition = getTokenAtPosition(file, position); - if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { return tokenAtPosition; } return findPrecedingToken(position, file); @@ -65567,7 +70508,7 @@ var ts; function findNextToken(previousToken, parent) { return find(parent); function find(n) { - if (isToken(n) && n.pos === previousToken.end) { + if (ts.isToken(n) && n.pos === previousToken.end) { // this is token that starts at the end of previous token - return it return n; } @@ -65590,7 +70531,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); @@ -65598,11 +70539,11 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n)) { + if (ts.isToken(n)) { return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' @@ -65627,7 +70568,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 264 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -65686,17 +70627,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 255 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 255 /* JsxExpression */) { return true; } //
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 249 /* JsxClosingElement */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 251 /* JsxClosingElement */) { return true; } return false; @@ -65727,10 +70668,10 @@ var ts; // Internally, we represent the end of the comment at the newline and closing '/', respectively. return predicate ? ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && + (c.kind === 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && predicate(c); }) : ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); + (c.kind === 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); } return false; } @@ -65751,7 +70692,7 @@ var ts; */ function getJsDocTagAtPosition(sourceFile, position) { var node = ts.getTokenAtPosition(sourceFile, position); - if (isToken(node)) { + if (ts.isToken(node)) { switch (node.kind) { case 103 /* VarKeyword */: case 109 /* LetKeyword */: @@ -65808,19 +70749,15 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) { + if (node.kind === 158 /* TypeReference */ || node.kind === 180 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 /* ClassDeclaration */ || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 228 /* ClassDeclaration */ || node.kind === 229 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; - function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */; - } - ts.isToken = isToken; function isWord(kind) { return kind === 70 /* Identifier */ || ts.isKeyword(kind); } @@ -65877,18 +70814,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 175 /* ArrayLiteralExpression */ || - node.kind === 176 /* ObjectLiteralExpression */) { + if (node.kind === 176 /* ArrayLiteralExpression */ || + node.kind === 177 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 192 /* BinaryExpression */ && + if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 213 /* ForOfStatement */ && + if (node.parent.kind === 215 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -65896,7 +70833,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 260 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -65924,12 +70861,47 @@ var ts; } } ts.isInNonReferenceComment = isInNonReferenceComment; + function createTextSpanFromNode(node, sourceFile) { + return ts.createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + ts.createTextSpanFromNode = createTextSpanFromNode; + function isTypeKeyword(kind) { + switch (kind) { + case 118 /* AnyKeyword */: + case 121 /* BooleanKeyword */: + case 129 /* NeverKeyword */: + case 132 /* NumberKeyword */: + case 133 /* ObjectKeyword */: + case 135 /* StringKeyword */: + case 136 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + return true; + default: + return false; + } + } + ts.isTypeKeyword = isTypeKeyword; + /** True if the symbol is for an external module, as opposed to a namespace. */ + function isExternalModuleSymbol(moduleSymbol) { + ts.Debug.assert(!!(moduleSymbol.flags & 1536 /* Module */)); + return moduleSymbol.name.charCodeAt(0) === 34 /* doubleQuote */; + } + ts.isExternalModuleSymbol = isExternalModuleSymbol; + /** Returns `true` the first time it encounters a node and `false` afterwards. */ + function nodeSeenTracker() { + var seen = []; + return function (node) { + var id = ts.getNodeId(node); + return !seen[id] && (seen[id] = true); + }; + } + ts.nodeSeenTracker = nodeSeenTracker; })(ts || (ts = {})); // Display-part writer helpers /* @internal */ (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 145 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -65946,13 +70918,15 @@ var ts; writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, writeSymbol: writeSymbol, writeLine: writeLine, increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop + reportInaccessibleThisError: ts.noop, + reportIllegalExtends: ts.noop }; function writeIndent() { if (lineStart) { @@ -66105,23 +71079,18 @@ var ts; function getDeclaredName(typeChecker, symbol, location) { // If this is an export or import specifier it could have been renamed using the 'as' syntax. // If so we want to search for whatever is under the cursor. - if (isImportOrExportSpecifierName(location)) { - return location.getText(); - } - else if (ts.isStringOrNumericLiteral(location) && - location.parent.kind === 142 /* ComputedPropertyName */) { + if (isImportOrExportSpecifierName(location) || ts.isStringOrNumericLiteral(location) && location.parent.kind === 143 /* ComputedPropertyName */) { return location.text; } // Try to get the local symbol if we're dealing with an 'export default' // since that symbol has the "true" name. var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); - return name; + return typeChecker.symbolToString(localExportDefaultSymbol || symbol); } ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 /* ImportSpecifier */ || location.parent.kind === 243 /* ExportSpecifier */) && + (location.parent.kind === 241 /* ImportSpecifier */ || location.parent.kind === 245 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -66137,7 +71106,6 @@ var ts; (name.charCodeAt(0) === 34 /* doubleQuote */ || name.charCodeAt(0) === 39 /* singleQuote */)) { return name.substring(1, length - 1); } - ; return name; } ts.stripQuotes = stripQuotes; @@ -66188,6 +71156,22 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getFirstNonSpaceCharacterPosition(text, position) { + while (ts.isWhiteSpace(text.charCodeAt(position))) { + position += 1; + } + return position; + } + ts.getFirstNonSpaceCharacterPosition = getFirstNonSpaceCharacterPosition; + function getOpenBrace(constructor, sourceFile) { + // First token is the open curly, this is where we want to put the 'super' call. + return constructor.body.getFirstToken(sourceFile); + } + ts.getOpenBrace = getOpenBrace; + function getOpenBraceOfClassLike(declaration, sourceFile) { + return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1); + } + ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike; })(ts || (ts = {})); var ts; (function (ts) { @@ -66236,7 +71220,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 124 /* GetKeyword */ || - keyword2 === 133 /* SetKeyword */ || + keyword2 === 134 /* SetKeyword */ || keyword2 === 122 /* ConstructorKeyword */ || keyword2 === 114 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -66255,9 +71239,9 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; - var length_4 = dense[i + 1]; + var length_5 = dense[i + 1]; var type = dense[i + 2]; // Make a whitespace entry between the last item and this one. if (lastEnd >= 0) { @@ -66266,8 +71250,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace }); } } - entries.push({ length: length_4, classification: convertClassification(type) }); - lastEnd = start + length_4; + entries.push({ length: length_5, classification: convertClassification(type) }); + lastEnd = start + length_5; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -66335,7 +71319,7 @@ var ts; case 5 /* InTemplateMiddleOrTail */: text = "}\n" + text; offset = 2; - // fallthrough + // falls through case 6 /* InTemplateSubstitutionPosition */: templateStack.push(13 /* TemplateHead */); break; @@ -66395,10 +71379,10 @@ var ts; angleBracketStack--; } else if (token === 118 /* AnyKeyword */ || - token === 134 /* StringKeyword */ || + token === 135 /* StringKeyword */ || token === 132 /* NumberKeyword */ || token === 121 /* BooleanKeyword */ || - token === 135 /* SymbolKeyword */) { + token === 136 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -66570,7 +71554,7 @@ var ts; } } function isKeyword(token) { - return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */; + return token >= 71 /* FirstKeyword */ && token <= 141 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -66627,10 +71611,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 232 /* ModuleDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -66681,7 +71665,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 /* ModuleDeclaration */ && + return declaration.kind === 232 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -66696,7 +71680,7 @@ var ts; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run // in a third of the time it would normally take. - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -66742,7 +71726,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -66845,16 +71829,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 281 /* JSDocParameterTag */: + case 285 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 284 /* JSDocTemplateTag */: + case 288 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 283 /* JSDocTypeTag */: + case 287 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 282 /* JSDocReturnTag */: + case 286 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -66941,22 +71925,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248 /* JsxOpeningElement */: + case 250 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 249 /* JsxClosingElement */: + case 251 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 247 /* JsxSelfClosingElement */: + case 249 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 250 /* JsxAttribute */: + case 252 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -66984,17 +71968,17 @@ var ts; if (token) { if (tokenKind === 57 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 223 /* VariableDeclaration */ || - token.parent.kind === 147 /* PropertyDeclaration */ || - token.parent.kind === 144 /* Parameter */ || - token.parent.kind === 250 /* JsxAttribute */) { + if (token.parent.kind === 225 /* VariableDeclaration */ || + token.parent.kind === 148 /* PropertyDeclaration */ || + token.parent.kind === 145 /* Parameter */ || + token.parent.kind === 252 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 192 /* BinaryExpression */ || - token.parent.kind === 190 /* PrefixUnaryExpression */ || - token.parent.kind === 191 /* PostfixUnaryExpression */ || - token.parent.kind === 193 /* ConditionalExpression */) { + if (token.parent.kind === 193 /* BinaryExpression */ || + token.parent.kind === 191 /* PrefixUnaryExpression */ || + token.parent.kind === 192 /* PostfixUnaryExpression */ || + token.parent.kind === 194 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -67004,7 +71988,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 250 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 252 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 11 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -67020,32 +72004,32 @@ var ts; else if (tokenKind === 70 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 143 /* TypeParameter */: + case 144 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 144 /* Parameter */: + case 145 /* Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; } @@ -67062,9 +72046,8 @@ var ts; // Ignore nodes that don't intersect the original span to classify. if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); @@ -67075,259 +72058,31 @@ var ts; } ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; })(ts || (ts = {})); -/// /* @internal */ var ts; (function (ts) { var Completions; (function (Completions) { - function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { - if (ts.isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); - } - if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); - } - var completionData = getCompletionData(typeChecker, log, sourceFile, position); - if (!completionData) { - return undefined; - } - var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; - if (isJsDocTagName) { - // If the current position is a jsDoc tag name, only tag names should be provided for completion - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() }; - } - var entries = []; - if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); - } - else { - if (!symbols || symbols.length === 0) { - if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 249 /* JsxClosingElement */) { - // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, - // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. - // For example: - // var x =
completion list at "1" will contain "div" with type any - var tagName = location.parent.parent.openingElement.tagName; - entries.push({ - name: tagName.text, - kind: undefined, - kindModifiers: undefined, - sortText: "0", - }); - } - else { - return undefined; - } - } - getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - } - // Add keywords if this is not a member completion list - if (!isMemberCompletion && !isJsDocTagName) { - ts.addRange(entries, keywordCompletions); - } - return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - for (var name_43 in nameTable) { - // Skip identifiers produced only from the current location - if (nameTable[name_43] === position) { - continue; - } - if (!uniqueNames[name_43]) { - uniqueNames[name_43] = name_43; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_43), compilerOptions.target, /*performCharacterChecks*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } - } - } - return entries; - } - function createCompletionEntry(symbol, location, performCharacterChecks) { - // Try to get a valid display name for this symbol, if we could not find one, then ignore it. - // We would like to only show things that can be added after a dot, so for instance numeric properties can - // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - // TODO(drosen): Right now we just permit *all* semantic meanings when calling - // 'getSymbolKind' which is permissible given that it is backwards compatible; but - // really we should consider passing the meaning for the node so that we don't report - // that a suggestion for a value is an interface. We COULD also just do what - // 'getSymbolModifiers' does, which is to use the first declaration. - // Use a 'sortText' of 0' so that all symbol completion entries come before any other - // entries (like JavaScript identifier entries). - return { - name: displayName, - kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; - } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; - } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9 /* StringLiteral */) { - return undefined; - } - if (node.parent.kind === 257 /* PropertyAssignment */ && - node.parent.parent.kind === 176 /* ObjectLiteralExpression */ && - node.parent.name === node) { - // Get quoted name of properties of the object literal expression - // i.e. interface ConfigFiles { - // 'jspm:dev': string - // } - // let files: ConfigFiles = { - // '/*completion position*/' - // } - // - // function foo(c: ConfigFiles) {} - // foo({ - // '/*completion position*/' - // }); - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - // Get all names of properties on the expression - // i.e. interface A { - // 'prop1': string - // } - // let a: A; - // a['/*completion position*/'] - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === 235 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { - // Get all known external module names or complete a path to a module - // i.e. import * as ns from "/*completion position*/"; - // import x = require("/*completion position*/"); - // var y = require("/*completion position*/"); - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - // Get string literal completions from specialized signatures of the target - // i.e. declare function f(a: 'A'); - // f("/*completion position*/") - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - // Get completion for string literal from string literal type - // i.e. var x: "hi" | "hello" = "/*completion position*/" - return getStringLiteralCompletionEntriesFromContextualType(node); - } - } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } - } - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; - } - return undefined; - } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var type = typeChecker.getTypeAtLocation(node.expression); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - return undefined; - } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; - } - function addStringLiteralCompletionsFromType(type, result) { - if (!type) { - return; - } - if (type.flags & 65536 /* Union */) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32 /* StringLiteral */) { - result.push({ - name: type.text, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, - sortText: "0" - }); - } - } - } - function getStringLiteralCompletionEntriesFromModuleNames(node) { + var PathCompletions; + (function (PathCompletions) { + function getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker) { var literalValue = ts.normalizeSlashes(node.text); var scriptPath = node.getSourceFile().path; var scriptDirectory = ts.getDirectoryPath(scriptPath); var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); var entries; if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + var extensions = ts.getSupportedExtensions(compilerOptions); if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, compilerOptions, host, scriptPath); } else { - entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensions, /*includeExtensions*/ false, span, host, scriptPath); } } else { // Check for node modules - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); } return { isGlobalCompletion: false, @@ -67336,6 +72091,7 @@ var ts; entries: entries }; } + PathCompletions.getStringLiteralCompletionEntriesFromModuleNames = getStringLiteralCompletionEntriesFromModuleNames; /** * Takes a script path and returns paths for all potential folders that could be merged with its * containing folder via the "rootDirs" compiler option @@ -67355,21 +72111,21 @@ var ts; // Now find a path for each potential directory that is to be merged with the one containing the script return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { var basePath = compilerOptions.project || host.getCurrentDirectory(); var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); var result = []; for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { var baseDirectory = baseDirectories_1[_i]; - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); } return result; } /** * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. */ - function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, host, exclude, result) { if (result === void 0) { result = []; } if (fragment === undefined) { fragment = ""; @@ -67405,13 +72161,13 @@ var ts; continue; } var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - for (var foundFile in foundFiles) { + ts.forEachKey(foundFiles, function (foundFile) { result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); - } + }); } // If possible, get folder completion as well var directories = tryGetDirectories(host, baseDirectory); @@ -67432,14 +72188,14 @@ var ts; * Modules from node_modules (i.e. those listed in package.json) * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions */ - function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span, compilerOptions, host, typeChecker) { var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; var result; if (baseUrl) { var fileExtensions = ts.getSupportedExtensions(compilerOptions); var projectDir = compilerOptions.project || host.getCurrentDirectory(); var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span, host); if (paths) { for (var path in paths) { if (paths.hasOwnProperty(path)) { @@ -67447,7 +72203,7 @@ var ts; if (paths[path]) { for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { var pattern = _a[_i]; - for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { var match = _c[_b]; result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); } @@ -67468,13 +72224,13 @@ var ts; result = []; } getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { var moduleName = _e[_d]; result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); } return result; } - function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host) { if (host.readDirectory) { var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; if (parsed) { @@ -67493,7 +72249,7 @@ var ts; // that encodes the suffix, but we would have to escape the character "?" which readDirectory // doesn't support. For now, this is safer but slower var includeGlob = normalizedSuffix ? "**/*" : "./*"; - var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + var matches = tryReadDirectory(host, baseDirectory, fileExtensions, /*exclude*/ undefined, [includeGlob]); if (matches) { var result = []; // Trim away prefix and suffix @@ -67504,8 +72260,8 @@ var ts; continue; } var start = completePrefix.length; - var length_5 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + var length_6 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_6))); } return result; } @@ -67513,7 +72269,7 @@ var ts; } return undefined; } - function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options, typeChecker, host) { // Check If this is a nested module var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; @@ -67553,7 +72309,7 @@ var ts; } return ts.deduplicate(nonRelativeModules); } - function getTripleSlashReferenceCompletion(sourceFile, position) { + function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) { var token = ts.getTokenAtPosition(sourceFile, position); if (!token) { return undefined; @@ -67589,7 +72345,7 @@ var ts; if (kind === "path") { // Give completions for a relative path var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, sourceFile.path); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, host, sourceFile.path); } else { // Give completions based on the typings available @@ -67599,6 +72355,7 @@ var ts; } return completionInfo; } + PathCompletions.getTripleSlashReferenceCompletion = getTripleSlashReferenceCompletion; function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { if (result === void 0) { result = []; } // Check for typings specified in compiler options @@ -67624,7 +72381,7 @@ var ts; } if (host.getDirectories) { // Also get all @types typings installed in visible node_modules directories - for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { + for (var _c = 0, _d = findPackageJsons(scriptPath, host); _c < _d.length; _c++) { var packageJson = _d[_c]; var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); getCompletionEntriesFromDirectories(host, typesDir, span, result); @@ -67644,7 +72401,7 @@ var ts; } } } - function findPackageJsons(currentDir) { + function findPackageJsons(currentDir, host) { var paths = []; var currentConfigPath; while (true) { @@ -67652,11 +72409,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent = ts.getDirectoryPath(currentDir); + if (currentDir === parent) { break; } - currentDir = parent_13; + currentDir = parent; } else { break; @@ -67667,7 +72424,7 @@ var ts; function enumerateNodeModulesVisibleToScript(host, scriptPath) { var result = []; if (host.readFile && host.fileExists) { - for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { + for (var _i = 0, _a = findPackageJsons(scriptPath, host); _i < _a.length; _i++) { var packageJson = _a[_i]; var contents = tryReadingPackageJson(packageJson); if (!contents) { @@ -67731,26 +72488,326 @@ var ts; function normalizeAndPreserveTrailingSlash(path) { return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } + /** + * Matches a triple slash reference directive with an incomplete string literal for its path. Used + * to determine if the caret is currently within the string literal and capture the literal fragment + * for completions. + * For example, this matches + * + * /// +/* @internal */ +var ts; +(function (ts) { + var Completions; + (function (Completions) { + function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { + if (ts.isInReferenceComment(sourceFile, position)) { + return Completions.PathCompletions.getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); + } + if (ts.isInString(sourceFile, position)) { + return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); + } + var completionData = getCompletionData(typeChecker, log, sourceFile, position); + if (!completionData) { + return undefined; + } + var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, requestJsDocTagName = completionData.requestJsDocTagName, requestJsDocTag = completionData.requestJsDocTag; + if (requestJsDocTagName) { + // If the current position is a jsDoc tag name, only tag names should be provided for completion + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getJSDocTagNameCompletions() }; + } + if (requestJsDocTag) { + // If the current position is a jsDoc tag, only tags should be provided for completion + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getJSDocTagCompletions() }; + } + var entries = []; + if (ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); + } + else { + if (!symbols || symbols.length === 0) { + if (sourceFile.languageVariant === 1 /* JSX */ && + location.parent && location.parent.kind === 251 /* JsxClosingElement */) { + // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, + // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. + // For example: + // var x =
completion list at "1" will contain "div" with type any + var tagName = location.parent.parent.openingElement.tagName; + entries.push({ + name: tagName.text, + kind: undefined, + kindModifiers: undefined, + sortText: "0", + }); + } + else { + return undefined; + } + } + getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); + } + // Add keywords if this is not a member completion list + if (!isMemberCompletion && !requestJsDocTag && !requestJsDocTagName) { + ts.addRange(entries, keywordCompletions); + } + return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; + } + Completions.getCompletionsAtPosition = getCompletionsAtPosition; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target) { + var entries = []; + var nameTable = ts.getNameTable(sourceFile); + nameTable.forEach(function (pos, name) { + // Skip identifiers produced only from the current location + if (pos === position) { + return; + } + if (!uniqueNames.get(name)) { + uniqueNames.set(name, name); + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name), target, /*performCharacterChecks*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ts.ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); + } + } + }); + return entries; + } + function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target) { + // Try to get a valid display name for this symbol, if we could not find one, then ignore it. + // We would like to only show things that can be added after a dot, so for instance numeric properties can + // not be accessed with a dot (a.1 <- invalid) + var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location); + if (!displayName) { + return undefined; + } + // TODO(drosen): Right now we just permit *all* semantic meanings when calling + // 'getSymbolKind' which is permissible given that it is backwards compatible; but + // really we should consider passing the meaning for the node so that we don't report + // that a suggestion for a value is an interface. We COULD also just do what + // 'getSymbolModifiers' does, which is to use the first declaration. + // Use a 'sortText' of 0' so that all symbol completion entries come before any other + // entries (like JavaScript identifier entries). + return { + name: displayName, + kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks, typeChecker, target, log) { + var start = ts.timestamp(); + var uniqueNames = ts.createMap(); + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!uniqueNames.get(id)) { + entries.push(entry); + uniqueNames.set(id, id); + } + } + } + } + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log) { + var node = ts.findPrecedingToken(position, sourceFile); + if (!node || node.kind !== 9 /* StringLiteral */) { + return undefined; + } + if (node.parent.kind === 260 /* PropertyAssignment */ && + node.parent.parent.kind === 177 /* ObjectLiteralExpression */ && + node.parent.name === node) { + // Get quoted name of properties of the object literal expression + // i.e. interface ConfigFiles { + // 'jspm:dev': string + // } + // let files: ConfigFiles = { + // '/*completion position*/' + // } + // + // function foo(c: ConfigFiles) {} + // foo({ + // '/*completion position*/' + // }); + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); + } + else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + // Get all names of properties on the expression + // i.e. interface A { + // 'prop1': string + // } + // let a: A; + // a['/*completion position*/'] + return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log); + } + else if (node.parent.kind === 237 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) { + // Get all known external module names or complete a path to a module + // i.e. import * as ns from "/*completion position*/"; + // import x = require("/*completion position*/"); + // var y = require("/*completion position*/"); + return Completions.PathCompletions.getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker); + } + else if (isEqualityExpression(node.parent)) { + // Get completions from the type of the other operand + // i.e. switch (a) { + // case '/*completion position*/' + // } + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.left === node ? node.parent.right : node.parent.left), typeChecker); + } + else if (ts.isCaseOrDefaultClause(node.parent)) { + // Get completions from the type of the switch expression + // i.e. x === '/*completion position' + return getStringLiteralCompletionEntriesFromType(typeChecker.getTypeAtLocation(node.parent.parent.parent.expression), typeChecker); + } + else { + var argumentInfo = ts.SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + // Get string literal completions from specialized signatures of the target + // i.e. declare function f(a: 'A'); + // f("/*completion position*/") + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker); + } + // Get completion for string literal from string literal type + // i.e. var x: "hi" | "hello" = "/*completion position*/" + return getStringLiteralCompletionEntriesFromType(typeChecker.getContextualType(node), typeChecker); + } + } + function getStringLiteralCompletionEntriesFromPropertyAssignment(element, typeChecker, target, log) { + var type = typeChecker.getContextualType(element.parent); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; + } + } + } + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker) { + var candidates = []; + var entries = []; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { + var candidate = candidates_3[_i]; + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker); + } + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + } + return undefined; + } + function getStringLiteralCompletionEntriesFromElementAccess(node, typeChecker, target, log) { + var type = typeChecker.getTypeAtLocation(node.expression); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; + } + } + return undefined; + } + function getStringLiteralCompletionEntriesFromType(type, typeChecker) { + if (type) { + var entries = []; + addStringLiteralCompletionsFromType(type, entries, typeChecker); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; + } + } + return undefined; + } + function addStringLiteralCompletionsFromType(type, result, typeChecker) { + if (type && type.flags & 16384 /* TypeParameter */) { + type = typeChecker.getApparentType(type); + } + if (!type) { + return; + } + if (type.flags & 65536 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + addStringLiteralCompletionsFromType(t, result, typeChecker); + } + } + else if (type.flags & 32 /* StringLiteral */) { + result.push({ + name: type.text, + kindModifiers: ts.ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.variableElement, + sortText: "0" + }); + } } - Completions.getCompletionsAtPosition = getCompletionsAtPosition; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_3 = completionData.location; + var symbols = completionData.symbols, location_1 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_3) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_1) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), kind: symbolKind, displayParts: displayParts, - documentation: documentation + documentation: documentation, + tags: tags }; } } @@ -67762,7 +72819,8 @@ var ts; kind: ts.ScriptElementKind.keyword, kindModifiers: ts.ScriptElementKindModifier.none, displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)], - documentation: undefined + documentation: undefined, + tags: undefined }; } return undefined; @@ -67772,19 +72830,22 @@ var ts; // Compute all the completion symbols again. var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_4 = completionData.location; + var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_4) === entryName ? s : undefined; }); + return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); } return undefined; } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; function getCompletionData(typeChecker, log, sourceFile, position) { var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); - var isJsDocTagName = false; + // JsDoc tag-name is just the name of the JSDoc tagname (exclude "@") + var requestJsDocTagName = false; + // JsDoc tag includes both "@" and tag-name + var requestJsDocTag = false; var start = ts.timestamp(); var currentToken = ts.getTokenAtPosition(sourceFile, position); log("getCompletionData: Get current token: " + (ts.timestamp() - start)); @@ -67793,10 +72854,32 @@ var ts; var insideComment = ts.isInsideComment(sourceFile, currentToken, position); log("getCompletionData: Is inside comment: " + (ts.timestamp() - start)); if (insideComment) { - // The current position is next to the '@' sign, when no tag name being provided yet. - // Provide a full list of tag names - if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { - isJsDocTagName = true; + if (ts.hasDocComment(sourceFile, position)) { + // The current position is next to the '@' sign, when no tag name being provided yet. + // Provide a full list of tag names + if (sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { + requestJsDocTagName = true; + } + else { + // When completion is requested without "@", we will have check to make sure that + // there are no comments prefix the request position. We will only allow "*" and space. + // e.g + // /** |c| /* + // + // /** + // |c| + // */ + // + // /** + // * |c| + // */ + // + // /** + // * |c| + // */ + var lineStart = ts.getLineStartPositionForPosition(position, sourceFile); + requestJsDocTag = !(sourceFile.text.substring(lineStart, position).match(/[^\*|\s|(/\*\*)]/)); + } } // Completion should work inside certain JsDoc tags. For example: // /** @type {number | string} */ @@ -67805,12 +72888,12 @@ var ts; var tag = ts.getJsDocTagAtPosition(sourceFile, position); if (tag) { if (tag.tagName.pos <= position && position <= tag.tagName.end) { - isJsDocTagName = true; + requestJsDocTagName = true; } switch (tag.kind) { - case 283 /* JSDocTypeTag */: - case 281 /* JSDocParameterTag */: - case 282 /* JSDocReturnTag */: + case 287 /* JSDocTypeTag */: + case 285 /* JSDocParameterTag */: + case 286 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -67818,8 +72901,8 @@ var ts; break; } } - if (isJsDocTagName) { - return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName }; + if (requestJsDocTagName || requestJsDocTag) { + return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, requestJsDocTagName: requestJsDocTagName, requestJsDocTag: requestJsDocTag }; } if (!insideJsDocTagExpression) { // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal @@ -67855,13 +72938,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_14 = contextToken.parent, kind = contextToken.kind; - if (kind === 22 /* DotToken */) { - if (parent_14.kind === 177 /* PropertyAccessExpression */) { + var parent = contextToken.parent; + if (contextToken.kind === 22 /* DotToken */) { + if (parent.kind === 178 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_14.kind === 141 /* QualifiedName */) { + else if (parent.kind === 142 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -67872,13 +72955,34 @@ var ts; } } else if (sourceFile.languageVariant === 1 /* JSX */) { - if (kind === 26 /* LessThanToken */) { - isRightOfOpenTag = true; - location = contextToken; + // + // If the tagname is a property access expression, we will then walk up to the top most of property access expression. + // Then, try to get a JSX container and its associated attributes type. + if (parent && parent.kind === 178 /* PropertyAccessExpression */) { + contextToken = parent; + parent = parent.parent; } - else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 249 /* JsxClosingElement */) { - isStartingCloseTag = true; - location = contextToken; + switch (parent.kind) { + case 251 /* JsxClosingElement */: + if (contextToken.kind === 40 /* SlashToken */) { + isStartingCloseTag = true; + location = contextToken; + } + break; + case 193 /* BinaryExpression */: + if (!(parent.left.flags & 32768 /* ThisNodeHasError */)) { + // It has a left-hand side, so we're not in an opening JSX tag. + break; + } + // falls through + case 249 /* JsxSelfClosingElement */: + case 248 /* JsxElement */: + case 250 /* JsxOpeningElement */: + if (contextToken.kind === 26 /* LessThanToken */) { + isRightOfOpenTag = true; + location = contextToken; + } + break; } } } @@ -67919,13 +73023,13 @@ var ts; } } log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart)); - return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName }; + return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), requestJsDocTagName: requestJsDocTagName, requestJsDocTag: requestJsDocTag }; function getTypeScriptMemberSymbols() { // Right of dot member completion list isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */) { + if (node.kind === 70 /* Identifier */ || node.kind === 142 /* QualifiedName */ || node.kind === 178 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -67981,11 +73085,11 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 247 /* JsxSelfClosingElement */) || (jsxContainer.kind === 248 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 249 /* JsxSelfClosingElement */) || (jsxContainer.kind === 250 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element - attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); + attrsType = typeChecker.getAllAttributesTypeFromJsxOpeningLikeElement(jsxContainer); if (attrsType) { - symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); + symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes.properties); isMemberCompletion = true; isNewIdentifierLocation = false; return true; @@ -68029,9 +73133,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 261 /* SourceFile */ || - scopeNode.kind === 194 /* TemplateExpression */ || - scopeNode.kind === 252 /* JsxExpression */ || + scopeNode.kind === 264 /* SourceFile */ || + scopeNode.kind === 195 /* TemplateExpression */ || + scopeNode.kind === 255 /* JsxExpression */ || ts.isStatement(scopeNode); } /// TODO filter meaning based on the current context @@ -68064,11 +73168,11 @@ var ts; return true; } if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 248 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 250 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 249 /* JsxClosingElement */ || contextToken.parent.kind === 247 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 246 /* JsxElement */; + if (contextToken.parent.kind === 251 /* JsxClosingElement */ || contextToken.parent.kind === 249 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 248 /* JsxElement */; } } return false; @@ -68078,40 +73182,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 179 /* CallExpression */ // func( a, | - || containingNodeKind === 150 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 180 /* NewExpression */ // new C(a, | - || containingNodeKind === 175 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 192 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 180 /* CallExpression */ // func( a, | + || containingNodeKind === 151 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 181 /* NewExpression */ // new C(a, | + || containingNodeKind === 176 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 193 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 159 /* FunctionType */; // var x: (s: string, list| case 18 /* OpenParenToken */: - return containingNodeKind === 179 /* CallExpression */ // func( | - || containingNodeKind === 150 /* Constructor */ // constructor( | - || containingNodeKind === 180 /* NewExpression */ // new C(a| - || containingNodeKind === 183 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 180 /* CallExpression */ // func( | + || containingNodeKind === 151 /* Constructor */ // constructor( | + || containingNodeKind === 181 /* NewExpression */ // new C(a| + || containingNodeKind === 184 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 167 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 20 /* OpenBracketToken */: - return containingNodeKind === 175 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 155 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 142 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 176 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 156 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 143 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 127 /* ModuleKeyword */: // module | case 128 /* NamespaceKeyword */: return true; case 22 /* DotToken */: - return containingNodeKind === 230 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 232 /* ModuleDeclaration */; // module A.| case 16 /* OpenBraceToken */: - return containingNodeKind === 226 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 228 /* ClassDeclaration */; // class A{ | case 57 /* EqualsToken */: - return containingNodeKind === 223 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 192 /* BinaryExpression */; // x = a| + return containingNodeKind === 225 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 193 /* BinaryExpression */; // x = a| case 13 /* TemplateHead */: - return containingNodeKind === 194 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 195 /* TemplateExpression */; // `aa ${| case 14 /* TemplateMiddle */: - return containingNodeKind === 202 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 204 /* TemplateSpan */; // `aa ${10} dd ${| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 148 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -68154,7 +73258,7 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 176 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 177 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; @@ -68164,7 +73268,7 @@ var ts; typeForObject = typeForObject && typeForObject.getNonNullableType(); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 172 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 173 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -68175,11 +73279,11 @@ var ts; // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); - if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) { + if (!canGetType && rootDeclaration.kind === 145 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) { + else if (rootDeclaration.parent.kind === 150 /* MethodDeclaration */ || rootDeclaration.parent.kind === 153 /* SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -68221,9 +73325,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 238 /* NamedImports */ ? - 235 /* ImportDeclaration */ : - 241 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 240 /* NamedImports */ ? + 237 /* ImportDeclaration */ : + 243 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -68231,12 +73335,13 @@ var ts; } isMemberCompletion = true; isNewIdentifierLocation = false; - var exports; - var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + symbols = ts.emptyArray; + return true; } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray; + var exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); return true; } /** @@ -68248,9 +73353,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_15 = contextToken.parent; - if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) { - return parent_15; + var parent = contextToken.parent; + if (parent && (parent.kind === 177 /* ObjectLiteralExpression */ || parent.kind === 173 /* ObjectBindingPattern */)) { + return parent; } break; } @@ -68267,8 +73372,8 @@ var ts; case 16 /* OpenBraceToken */: // import { | case 25 /* CommaToken */: switch (contextToken.parent.kind) { - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 240 /* NamedImports */: + case 244 /* NamedExports */: return contextToken.parent; } } @@ -68277,37 +73382,55 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_16 = contextToken.parent; + var parent = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) { - return parent_16; + case 178 /* PropertyAccessExpression */: + case 253 /* JsxAttributes */: + case 252 /* JsxAttribute */: + case 254 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 249 /* JsxSelfClosingElement */ || parent.kind === 250 /* JsxOpeningElement */)) { + return parent; } - else if (parent_16.kind === 250 /* JsxAttribute */) { - return parent_16.parent; + else if (parent.kind === 252 /* JsxAttribute */) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + return parent.parent.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) { - return parent_16.parent; + if (parent && ((parent.kind === 252 /* JsxAttribute */) || (parent.kind === 254 /* JsxSpreadAttribute */))) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + return parent.parent.parent; } break; case 17 /* CloseBraceToken */: - if (parent_16 && - parent_16.kind === 252 /* JsxExpression */ && - parent_16.parent && - (parent_16.parent.kind === 250 /* JsxAttribute */)) { - return parent_16.parent.parent; + if (parent && + parent.kind === 255 /* JsxExpression */ && + parent.parent && parent.parent.kind === 252 /* JsxAttribute */) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + // each JsxAttribute can have initializer as JsxExpression + return parent.parent.parent.parent; } - if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) { - return parent_16.parent; + if (parent && parent.kind === 254 /* JsxSpreadAttribute */) { + // Currently we parse JsxOpeningLikeElement as: + // JsxOpeningLikeElement + // attributes: JsxAttributes + // properties: NodeArray + return parent.parent.parent; } break; } @@ -68315,20 +73438,17 @@ var ts; return undefined; } function isFunction(kind) { + if (!ts.isFunctionLikeKind(kind)) { + return false; + } switch (kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 155 /* IndexSignature */: + case 151 /* Constructor */: + case 160 /* ConstructorType */: + case 159 /* FunctionType */: + return false; + default: return true; } - return false; } /** * @returns true if we are certain that the currently edited location must define a new location; false otherwise. @@ -68337,66 +73457,66 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 223 /* VariableDeclaration */ || - containingNodeKind === 224 /* VariableDeclarationList */ || - containingNodeKind === 205 /* VariableStatement */ || - containingNodeKind === 229 /* EnumDeclaration */ || + return containingNodeKind === 225 /* VariableDeclaration */ || + containingNodeKind === 226 /* VariableDeclarationList */ || + containingNodeKind === 207 /* VariableStatement */ || + containingNodeKind === 231 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 226 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 173 /* ArrayBindingPattern */ || - containingNodeKind === 228 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 174 /* ArrayBindingPattern */ || + containingNodeKind === 230 /* TypeAliasDeclaration */; // type Map, K, | case 22 /* DotToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [.| case 55 /* ColonToken */: - return containingNodeKind === 174 /* BindingElement */; // var {x :html| + return containingNodeKind === 175 /* BindingElement */; // var {x :html| case 20 /* OpenBracketToken */: - return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 174 /* ArrayBindingPattern */; // var [x| case 18 /* OpenParenToken */: - return containingNodeKind === 256 /* CatchClause */ || + return containingNodeKind === 259 /* CatchClause */ || isFunction(containingNodeKind); case 16 /* OpenBraceToken */: - return containingNodeKind === 229 /* EnumDeclaration */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 161 /* TypeLiteral */; // const x : { | + return containingNodeKind === 231 /* EnumDeclaration */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 162 /* TypeLiteral */; // const x : { | case 24 /* SemicolonToken */: - return containingNodeKind === 146 /* PropertySignature */ && + return containingNodeKind === 147 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 227 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; | + (contextToken.parent.parent.kind === 229 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 162 /* TypeLiteral */); // const x : { a; | case 26 /* LessThanToken */: - return containingNodeKind === 226 /* ClassDeclaration */ || - containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 228 /* TypeAliasDeclaration */ || + return containingNodeKind === 228 /* ClassDeclaration */ || + containingNodeKind === 198 /* ClassExpression */ || + containingNodeKind === 229 /* InterfaceDeclaration */ || + containingNodeKind === 230 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 114 /* StaticKeyword */: - return containingNodeKind === 147 /* PropertyDeclaration */; + return containingNodeKind === 148 /* PropertyDeclaration */; case 23 /* DotDotDotToken */: - return containingNodeKind === 144 /* Parameter */ || + return containingNodeKind === 145 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 173 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 174 /* ArrayBindingPattern */); // var [...z| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: - return containingNodeKind === 144 /* Parameter */; + return containingNodeKind === 145 /* Parameter */; case 117 /* AsKeyword */: - return containingNodeKind === 239 /* ImportSpecifier */ || - containingNodeKind === 243 /* ExportSpecifier */ || - containingNodeKind === 237 /* NamespaceImport */; + return containingNodeKind === 241 /* ImportSpecifier */ || + containingNodeKind === 245 /* ExportSpecifier */ || + containingNodeKind === 239 /* NamespaceImport */; case 74 /* ClassKeyword */: case 82 /* EnumKeyword */: case 108 /* InterfaceKeyword */: case 88 /* FunctionKeyword */: case 103 /* VarKeyword */: case 124 /* GetKeyword */: - case 133 /* SetKeyword */: + case 134 /* SetKeyword */: case 90 /* ImportKeyword */: case 109 /* LetKeyword */: case 75 /* ConstKeyword */: case 115 /* YieldKeyword */: - case 136 /* TypeKeyword */: + case 137 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -68444,13 +73564,13 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_44 = element.propertyName || element.name; - existingImportsOrExports[name_44.text] = true; + var name = element.propertyName || element.name; + existingImportsOrExports.set(name.text, true); } - if (!ts.someProperties(existingImportsOrExports)) { + if (existingImportsOrExports.size === 0) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports.get(e.name); }); } /** * Filters out completion suggestions for named imports or exports. @@ -68466,12 +73586,12 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 257 /* PropertyAssignment */ && - m.kind !== 258 /* ShorthandPropertyAssignment */ && - m.kind !== 174 /* BindingElement */ && - m.kind !== 149 /* MethodDeclaration */ && - m.kind !== 151 /* GetAccessor */ && - m.kind !== 152 /* SetAccessor */) { + if (m.kind !== 260 /* PropertyAssignment */ && + m.kind !== 261 /* ShorthandPropertyAssignment */ && + m.kind !== 175 /* BindingElement */ && + m.kind !== 150 /* MethodDeclaration */ && + m.kind !== 152 /* GetAccessor */ && + m.kind !== 153 /* SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -68479,7 +73599,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 174 /* BindingElement */ && m.propertyName) { + if (m.kind === 175 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 70 /* Identifier */) { existingName = m.propertyName.text; @@ -68491,9 +73611,9 @@ var ts; // things like '__proto__' are not filtered out. existingName = m.name.text; } - existingMemberNames[existingName] = true; + existingMemberNames.set(existingName, true); } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.name); }); } /** * Filters out completion suggestions from 'symbols' according to existing JSX attributes. @@ -68509,11 +73629,11 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 250 /* JsxAttribute */) { - seenNames[attr.name.text] = true; + if (attr.kind === 252 /* JsxAttribute */) { + seenNames.set(attr.name.text, true); } } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + return ts.filter(symbols, function (a) { return !seenNames.get(a.name); }); } } /** @@ -68559,7 +73679,7 @@ var ts; } // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) { + for (var i = 71 /* FirstKeyword */; i <= 141 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ts.ScriptElementKind.keyword, @@ -68567,49 +73687,14 @@ var ts; sortText: "0" }); } - /** - * Matches a triple slash reference directive with an incomplete string literal for its path. Used - * to determine if the caret is currently within the string literal and capture the literal fragment - * for completions. - * For example, this matches - * - * /// = 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { + break; } - child = parent_17; } - return undefined; } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 215 /* BreakStatement */ || node.kind === 214 /* ContinueStatement */) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); + } + }); + return keywords; + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + return getLoopBreakContinueOccurrences(owner); + case 220 /* SwitchStatement */: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* SwitchKeyword */); + // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); + } + }); + }); + return keywords; + } + function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); + } + return keywords; + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + // If the "owner" is a function, then we equate 'return' and 'throw' statements in their + // ability to "jump out" of the function, and include occurrences for both. + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + } + return keywords; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + // If we didn't find a containing function with a block body, bail out. + if (!(func && hasKind(func.body, 206 /* Block */))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + // Include 'throw' statements that do not occur within a try block. + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + return keywords; + } + function getIfElseOccurrences(ifStatement, sourceFile) { + var keywords = []; + // Traverse upwards through all parent if-statements linked by their else-branches. + while (hasKind(ifStatement.parent, 210 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 89 /* IfKeyword */); + // Generally the 'else' keyword is second-to-last, so we traverse backwards. + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 81 /* ElseKeyword */)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 210 /* IfStatement */)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + // We'd like to highlight else/ifs together if they are only separated by whitespace + // (i.e. the keywords are separated by no comments, no newlines). + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 81 /* ElseKeyword */ && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. + var shouldCombindElseAndIf = true; + // Avoid recalculating getStart() by iterating backwards. + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; + break; } } + if (shouldCombindElseAndIf) { + result.push({ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; // skip the next keyword + continue; + } } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; + // Ordinary case: just highlight the keyword. + result.push(getHighlightSpanForNode(keywords[i], sourceFile)); + } + return result; + } + /** + * Whether or not a 'node' is preceded by a label of the given string. + * Note: 'node' cannot be a SourceFile. + */ + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 221 /* LabeledStatement */; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; } - function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 218 /* SwitchStatement */: - if (statement.kind === 214 /* ContinueStatement */) { - continue; + } + return false; + } + })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } + // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have + // for those settings. + var buckets = ts.createMap(); + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); + } + function getBucketForCompilationSettings(key, createIfMissing) { + var bucket = buckets.get(key); + if (!bucket && createIfMissing) { + buckets.set(key, bucket = ts.createFileMap()); + } + return bucket; + } + function reportStats() { + var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets.get(name); + var sourceFiles = []; + entries.forEachValue(function (key, entry) { + sourceFiles.push({ + name: key, + refCount: entry.languageServiceRefCount, + references: entry.owners.slice(0) + }); + }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, undefined, 2); + } + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); + } + function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); + var entry = bucket.get(path); + if (!entry) { + ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); + // Have never seen this file with these settings. Create a new source file for it. + var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); + entry = { + sourceFile: sourceFile, + languageServiceRefCount: 0, + owners: [] + }; + bucket.set(path, entry); + } + else { + // We have an entry for this file. However, it may be for a different version of + // the script snapshot. If so, update it appropriately. Otherwise, we can just + // return it as is. + if (entry.sourceFile.version !== version) { + entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); + } + } + // If we're acquiring, then this is the first time this LS is asking for this document. + // Increase our ref count so we know there's another LS using the document. If we're + // not acquiring, then that means the LS is 'updating' the file instead, and that means + // it has already acquired the document previously. As such, we do not need to increase + // the ref count. + if (acquiring) { + entry.languageServiceRefCount++; + } + return entry.sourceFile; + } + function releaseDocument(fileName, compilationSettings) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + function releaseDocumentWithKey(path, key) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); + ts.Debug.assert(bucket !== undefined); + var entry = bucket.get(path); + entry.languageServiceRefCount--; + ts.Debug.assert(entry.languageServiceRefCount >= 0); + if (entry.languageServiceRefCount === 0) { + bucket.remove(path); + } + } + return { + acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, + updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, + releaseDocument: releaseDocument, + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings + }; + } + ts.createDocumentRegistry = createDocumentRegistry; +})(ts || (ts = {})); +/* Code for finding imports of an exported symbol. Used only by FindAllReferences. */ +/* @internal */ +var ts; +(function (ts) { + var FindAllReferences; + (function (FindAllReferences) { + /** Creates the imports map and returns an ImportTracker that uses it. Call this lazily to avoid calling `getDirectImportsMap` unnecessarily. */ + function createImportTracker(sourceFiles, checker, cancellationToken) { + var allDirectImports = getDirectImportsMap(sourceFiles, checker, cancellationToken); + return function (exportSymbol, exportInfo, isForRename) { + var _a = getImportersForExport(sourceFiles, allDirectImports, exportInfo, checker, cancellationToken), directImports = _a.directImports, indirectUsers = _a.indirectUsers; + return __assign({ indirectUsers: indirectUsers }, getSearchesFromDirectImports(directImports, exportSymbol, exportInfo.exportKind, checker, isForRename)); + }; + } + FindAllReferences.createImportTracker = createImportTracker; + var ExportKind; + (function (ExportKind) { + ExportKind[ExportKind["Named"] = 0] = "Named"; + ExportKind[ExportKind["Default"] = 1] = "Default"; + ExportKind[ExportKind["ExportEquals"] = 2] = "ExportEquals"; + })(ExportKind = FindAllReferences.ExportKind || (FindAllReferences.ExportKind = {})); + var ImportExport; + (function (ImportExport) { + ImportExport[ImportExport["Import"] = 0] = "Import"; + ImportExport[ImportExport["Export"] = 1] = "Export"; + })(ImportExport = FindAllReferences.ImportExport || (FindAllReferences.ImportExport = {})); + /** Returns import statements that directly reference the exporting module, and a list of files that may access the module through a namespace. */ + function getImportersForExport(sourceFiles, allDirectImports, _a, checker, cancellationToken) { + var exportingModuleSymbol = _a.exportingModuleSymbol, exportKind = _a.exportKind; + var markSeenDirectImport = ts.nodeSeenTracker(); + var markSeenIndirectUser = ts.nodeSeenTracker(); + var directImports = []; + var isAvailableThroughGlobal = !!exportingModuleSymbol.globalExports; + var indirectUserDeclarations = isAvailableThroughGlobal ? undefined : []; + handleDirectImports(exportingModuleSymbol); + return { directImports: directImports, indirectUsers: getIndirectUsers() }; + function getIndirectUsers() { + if (isAvailableThroughGlobal) { + // It has `export as namespace`, so anything could potentially use it. + return sourceFiles; + } + // Module augmentations may use this module's exports without importing it. + for (var _i = 0, _a = exportingModuleSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (ts.isExternalModuleAugmentation(decl)) { + addIndirectUser(decl); + } + } + // This may return duplicates (if there are multiple module declarations in a single source file, all importing the same thing as a namespace), but `State.markSearchedSymbol` will handle that. + return indirectUserDeclarations.map(ts.getSourceFileOfNode); + } + function handleDirectImports(exportingModuleSymbol) { + var theseDirectImports = getDirectImports(exportingModuleSymbol); + if (theseDirectImports) + for (var _i = 0, theseDirectImports_1 = theseDirectImports; _i < theseDirectImports_1.length; _i++) { + var direct = theseDirectImports_1[_i]; + if (!markSeenDirectImport(direct)) { + continue; + } + cancellationToken.throwIfCancellationRequested(); + switch (direct.kind) { + case 180 /* CallExpression */: + if (!isAvailableThroughGlobal) { + var parent = direct.parent; + if (exportKind === 2 /* ExportEquals */ && parent.kind === 225 /* VariableDeclaration */) { + var name = parent.name; + if (name.kind === 70 /* Identifier */) { + directImports.push(name); + break; + } + } + // Don't support re-exporting 'require()' calls, so just add a single indirect user. + addIndirectUser(direct.getSourceFile()); + } + break; + case 236 /* ImportEqualsDeclaration */: + handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */)); + break; + case 237 /* ImportDeclaration */: + var namedBindings = direct.importClause && direct.importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { + handleNamespaceImport(direct, namedBindings.name); } - // Fall through. - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; + else { + directImports.push(direct); } break; - default: - // Don't cross function boundaries. - if (ts.isFunctionLike(node_1)) { - return undefined; + case 243 /* ExportDeclaration */: + if (!direct.exportClause) { + // This is `export * from "foo"`, so imports of this module may import the export too. + handleDirectImports(getContainingModuleSymbol(direct, checker)); + } + else { + // This is `export { foo } from "foo"` and creates an alias symbol, so recursive search will get handle re-exports. + directImports.push(direct); } break; } } - return undefined; + } + function handleNamespaceImport(importDeclaration, name, isReExport) { + if (exportKind === 2 /* ExportEquals */) { + // This is a direct import, not import-as-namespace. + directImports.push(importDeclaration); } - function getModifierOccurrences(modifier, declaration) { - var container = declaration.parent; - // Make sure we only highlight the keyword when it makes sense to do so. - if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 226 /* ClassDeclaration */ || - container.kind === 197 /* ClassExpression */ || - (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) { - return undefined; - } + else if (!isAvailableThroughGlobal) { + var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); + ts.Debug.assert(sourceFileLike.kind === 264 /* SourceFile */ || sourceFileLike.kind === 232 /* ModuleDeclaration */); + if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { + addIndirectUsers(sourceFileLike); } - else if (modifier === 114 /* StaticKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { - return undefined; - } + else { + addIndirectUser(sourceFileLike); } - else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { - if (!(container.kind === 231 /* ModuleBlock */ || container.kind === 261 /* SourceFile */)) { - return undefined; - } + } + } + function addIndirectUser(sourceFileLike) { + ts.Debug.assert(!isAvailableThroughGlobal); + var isNew = markSeenIndirectUser(sourceFileLike); + if (isNew) { + indirectUserDeclarations.push(sourceFileLike); + } + return isNew; + } + /** Adds a module and all of its transitive dependencies as possible indirect users. */ + function addIndirectUsers(sourceFileLike) { + if (!addIndirectUser(sourceFileLike)) { + return; + } + var moduleSymbol = checker.getMergedSymbol(sourceFileLike.symbol); + ts.Debug.assert(!!(moduleSymbol.flags & 1536 /* Module */)); + var directImports = getDirectImports(moduleSymbol); + if (directImports) + for (var _i = 0, directImports_1 = directImports; _i < directImports_1.length; _i++) { + var directImport = directImports_1[_i]; + addIndirectUsers(getSourceFileLikeForImportDeclaration(directImport)); } - else if (modifier === 116 /* AbstractKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || declaration.kind === 226 /* ClassDeclaration */)) { - return undefined; - } + } + function getDirectImports(moduleSymbol) { + return allDirectImports.get(ts.getSymbolId(moduleSymbol).toString()); + } + } + /** + * Given the set of direct imports of a module, we need to find which ones import the particular exported symbol. + * The returned `importSearches` will result in the entire source file being searched. + * But re-exports will be placed in 'singleReferences' since they cannot be locally referenced. + */ + function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, checker, isForRename) { + var exportName = exportSymbol.name; + var importSearches = []; + var singleReferences = []; + function addSearch(location, symbol) { + importSearches.push([location, symbol]); + } + if (directImports) + for (var _i = 0, directImports_2 = directImports; _i < directImports_2.length; _i++) { + var decl = directImports_2[_i]; + handleImport(decl); + } + return { importSearches: importSearches, singleReferences: singleReferences }; + function handleImport(decl) { + if (decl.kind === 236 /* ImportEqualsDeclaration */) { + if (isExternalModuleImportEquals(decl)) { + handleNamespaceImportLike(decl.name); } - else { - // unsupported modifier - return undefined; + return; + } + if (decl.kind === 70 /* Identifier */) { + handleNamespaceImportLike(decl); + return; + } + // Ignore if there's a grammar error + if (decl.moduleSpecifier.kind !== 9 /* StringLiteral */) { + return; + } + if (decl.kind === 243 /* ExportDeclaration */) { + searchForNamedImport(decl.exportClause); + return; + } + var importClause = decl.importClause; + var namedBindings = importClause.namedBindings; + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { + handleNamespaceImportLike(namedBindings.name); + return; + } + if (exportKind === 0 /* Named */) { + searchForNamedImport(namedBindings); + } + else { + // `export =` might be imported by a default import if `--allowSyntheticDefaultImports` is on, so this handles both ExportKind.Default and ExportKind.ExportEquals + var name = importClause.name; + // If a default import has the same name as the default export, allow to rename it. + // Given `import f` and `export default function f`, we will rename both, but for `import g` we will rename just that. + if (name && (!isForRename || name.text === symbolName(exportSymbol))) { + var defaultImportAlias = checker.getSymbolAtLocation(name); + addSearch(name, defaultImportAlias); } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: - // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* Abstract */) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 150 /* Constructor */: - nodes = container.parameters.concat(container.parent.members); - break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - nodes = container.members; - // If we're an accessibility modifier, we're in an instance member and should search - // the constructor's parameter list for instance members as well. - if (modifierFlag & 28 /* AccessibilityModifier */) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 150 /* Constructor */ && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128 /* Abstract */) { - nodes = nodes.concat(container); - } - break; - default: - ts.Debug.fail("Invalid container kind."); + // 'default' might be accessed as a named import `{ default as foo }`. + if (!isForRename && exportKind === 1 /* Default */) { + ts.Debug.assert(exportName === "default"); + searchForNamedImport(namedBindings); } - ts.forEach(nodes, function (node) { - if (ts.getModifierFlags(node) & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + } + } + /** + * `import x = require("./x") or `import * as x from "./x"`. + * An `export =` may be imported by this syntax, so it may be a direct import. + * If it's not a direct import, it will be in `indirectUsers`, so we don't have to do anything here. + */ + function handleNamespaceImportLike(importName) { + // Don't rename an import that already has a different name than the export. + if (exportKind === 2 /* ExportEquals */ && (!isForRename || importName.text === exportName)) { + addSearch(importName, checker.getSymbolAtLocation(importName)); + } + } + function searchForNamedImport(namedBindings) { + if (namedBindings) + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var element = _a[_i]; + var name = element.name, propertyName = element.propertyName; + if ((propertyName || name).text !== exportName) { + continue; } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 113 /* PublicKeyword */: - return 4 /* Public */; - case 111 /* PrivateKeyword */: - return 8 /* Private */; - case 112 /* ProtectedKeyword */: - return 16 /* Protected */; - case 114 /* StaticKeyword */: - return 32 /* Static */; - case 83 /* ExportKeyword */: - return 1 /* Export */; - case 123 /* DeclareKeyword */: - return 2 /* Ambient */; - case 116 /* AbstractKeyword */: - return 128 /* Abstract */; - default: - ts.Debug.fail(); + if (propertyName) { + // This is `import { foo as bar } from "./a"` or `export { foo as bar } from "./a"`. `foo` isn't a local in the file, so just add it as a single reference. + singleReferences.push(propertyName); + if (!isForRename) { + // Search locally for `bar`. + addSearch(name, checker.getSymbolAtLocation(name)); + } + } + else { + var localSymbol = element.kind === 245 /* ExportSpecifier */ && element.propertyName + ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. + : checker.getSymbolAtLocation(name); + addSearch(name, localSymbol); } } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); + } + } + /** Returns 'true' is the namespace 'name' is re-exported from this module, and 'false' if it is only used locally. */ + function findNamespaceReExports(sourceFileLike, name, checker) { + var namespaceImportSymbol = checker.getSymbolAtLocation(name); + return forEachPossibleImportOrExportStatement(sourceFileLike, function (statement) { + if (statement.kind !== 243 /* ExportDeclaration */) + return; + var _a = statement, exportClause = _a.exportClause, moduleSpecifier = _a.moduleSpecifier; + if (moduleSpecifier || !exportClause) + return; + for (var _i = 0, _b = exportClause.elements; _i < _b.length; _i++) { + var element = _b[_i]; + if (checker.getExportSpecifierLocalTargetSymbol(element) === namespaceImportSymbol) { return true; } - return false; } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 151 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 152 /* SetAccessor */); - return ts.map(keywords, getHighlightSpanForNode); - function tryPushAccessorKeyword(accessorSymbol, accessorKind) { - var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); - if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 124 /* GetKeyword */, 133 /* SetKeyword */); }); + }); + } + /** Returns a map from a module symbol Id to all import statements that directly reference the module. */ + function getDirectImportsMap(sourceFiles, checker, cancellationToken) { + var map = ts.createMap(); + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; + cancellationToken.throwIfCancellationRequested(); + forEachImport(sourceFile, function (importDecl, moduleSpecifier) { + var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); + if (moduleSymbol) { + var id = ts.getSymbolId(moduleSymbol).toString(); + var imports = map.get(id); + if (!imports) { + map.set(id, imports = []); } + imports.push(importDecl); } + }); + } + return map; + } + /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ + function forEachPossibleImportOrExportStatement(sourceFileLike, action) { + return ts.forEach(sourceFileLike.kind === 264 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); + }); + } + /** Calls `action` for each import, re-export, or require() in a file. */ + function forEachImport(sourceFile, action) { + if (sourceFile.externalModuleIndicator) { + for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { + var moduleSpecifier = _a[_i]; + action(importerFromModuleSpecifier(moduleSpecifier), moduleSpecifier); } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 122 /* ConstructorKeyword */); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { - // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 209 /* DoStatement */) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { - break; - } + } + else { + forEachPossibleImportOrExportStatement(sourceFile, function (statement) { + switch (statement.kind) { + case 243 /* ExportDeclaration */: + case 237 /* ImportDeclaration */: { + var decl = statement; + if (decl.moduleSpecifier && decl.moduleSpecifier.kind === 9 /* StringLiteral */) { + action(decl, decl.moduleSpecifier); } + break; + } + case 236 /* ImportEqualsDeclaration */: { + var decl = statement; + var moduleReference = decl.moduleReference; + if (moduleReference.kind === 247 /* ExternalModuleReference */ && + moduleReference.expression.kind === 9 /* StringLiteral */) { + action(decl, moduleReference.expression); + } + break; } } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); + }); + if (sourceFile.flags & 65536 /* JavaScriptFile */) { + // Find all 'require()' calls. + sourceFile.forEachChild(function recur(node) { + if (ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { + action(node, node.arguments[0]); } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - return getLoopBreakContinueOccurrences(owner); - case 218 /* SwitchStatement */: - return getSwitchCaseDefaultOccurrences(owner); + else { + node.forEachChild(recur); } - } - return undefined; - } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* SwitchKeyword */); - // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. - ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); - } - }); }); - return ts.map(keywords, getHighlightSpanForNode); } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); + } + } + function importerFromModuleSpecifier(moduleSpecifier) { + var decl = moduleSpecifier.parent; + if (decl.kind === 237 /* ImportDeclaration */ || decl.kind === 243 /* ExportDeclaration */) { + return decl; + } + ts.Debug.assert(decl.kind === 247 /* ExternalModuleReference */); + return decl.parent; + } + /** + * Given a local reference, we might notice that it's an import/export and recursively search for references of that. + * If at an import, look locally for the symbol it imports. + * If an an export, look for all imports of it. + * This doesn't handle export specifiers; that is done in `getReferencesAtExportSpecifier`. + * @param comingFromExport If we are doing a search for all exports, don't bother looking backwards for the imported symbol, since that's the reason we're here. + */ + function getImportOrExportSymbol(node, symbol, checker, comingFromExport) { + return comingFromExport ? getExport() : getExport() || getImport(); + function getExport() { + var parent = node.parent; + if (symbol.flags & 7340032 /* Export */) { + if (parent.kind === 178 /* PropertyAccessExpression */) { + // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. + // So check that we are at the declaration. + return symbol.declarations.some(function (d) { return d === parent; }) && parent.parent.kind === 193 /* BinaryExpression */ + ? getSpecialPropertyExport(parent.parent, /*useLhsSymbol*/ false) + : undefined; } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); + else { + var exportSymbol = symbol.exportSymbol; + ts.Debug.assert(!!exportSymbol); + return exportInfo(exportSymbol, getExportKindForDeclaration(parent)); } - return ts.map(keywords, getHighlightSpanForNode); } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; + else { + var exportNode = parent.kind === 225 /* VariableDeclaration */ ? ts.getAncestor(parent, 207 /* VariableStatement */) : parent; + if (ts.hasModifier(exportNode, 1 /* Export */)) { + if (exportNode.kind === 236 /* ImportEqualsDeclaration */ && exportNode.moduleReference === node) { + // We're at `Y` in `export import X = Y`. This is not the exported symbol, the left-hand-side is. So treat this as an import statement. + if (comingFromExport) { + return undefined; + } + var lhsSymbol = checker.getSymbolAtLocation(exportNode.name); + return { kind: 0 /* Import */, symbol: lhsSymbol, isNamedImport: false }; + } + else { + return exportInfo(symbol, getExportKindForDeclaration(exportNode)); + } } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); - }); - // If the "owner" is a function, then we equate 'return' and 'throw' statements in their - // ability to "jump out" of the function, and include occurrences for both. - if (ts.isFunctionBlock(owner)) { - ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); - }); + else if (parent.kind === 242 /* ExportAssignment */) { + // Get the symbol for the `export =` node; its parent is the module it's the export of. + var exportingModuleSymbol = parent.symbol.parent; + ts.Debug.assert(!!exportingModuleSymbol); + return { kind: 1 /* Export */, symbol: symbol, exportInfo: { exportingModuleSymbol: exportingModuleSymbol, exportKind: 2 /* ExportEquals */ } }; } - return ts.map(keywords, getHighlightSpanForNode); - } - function getReturnOccurrences(returnStatement) { - var func = ts.getContainingFunction(returnStatement); - // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 204 /* Block */))) { - return undefined; + else if (parent.kind === 193 /* BinaryExpression */) { + return getSpecialPropertyExport(parent, /*useLhsSymbol*/ true); } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); - }); - // Include 'throw' statements that do not occur within a try block. - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getIfElseOccurrences(ifStatement) { - var keywords = []; - // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 208 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { - ifStatement = ifStatement.parent; - } - // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. - while (ifStatement) { - var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 89 /* IfKeyword */); - // Generally the 'else' keyword is second-to-last, so we traverse backwards. - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 81 /* ElseKeyword */)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 208 /* IfStatement */)) { + else if (parent.parent.kind === 193 /* BinaryExpression */) { + return getSpecialPropertyExport(parent.parent, /*useLhsSymbol*/ true); + } + } + function getSpecialPropertyExport(node, useLhsSymbol) { + var kind; + switch (ts.getSpecialPropertyAssignmentKind(node)) { + case 1 /* ExportsProperty */: + kind = 0 /* Named */; break; - } - ifStatement = ifStatement.elseStatement; + case 2 /* ModuleExports */: + kind = 2 /* ExportEquals */; + break; + default: + return undefined; } - var result = []; - // We'd like to highlight else/ifs together if they are only separated by whitespace - // (i.e. the keywords are separated by no comments, no newlines). - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 81 /* ElseKeyword */ && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. - var shouldCombindElseAndIf = true; - // Avoid recalculating getStart() by iterating backwards. - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference - }); - i++; // skip the next keyword - continue; - } - } - // Ordinary case: just highlight the keyword. - result.push(getHighlightSpanForNode(keywords[i])); + var sym = useLhsSymbol ? checker.getSymbolAtLocation(node.left.name) : symbol; + return sym && exportInfo(sym, kind); + } + } + function getImport() { + var isImport = isNodeImport(node); + if (!isImport) + return; + // A symbol being imported is always an alias. So get what that aliases to find the local symbol. + var importedSymbol = checker.getImmediateAliasedSymbol(symbol); + if (importedSymbol) { + // Search on the local symbol in the exporting module, not the exported symbol. + importedSymbol = skipExportSpecifierSymbol(importedSymbol, checker); + // Similarly, skip past the symbol for 'export =' + if (importedSymbol.name === "export=") { + importedSymbol = checker.getImmediateAliasedSymbol(importedSymbol); + } + if (symbolName(importedSymbol) === symbol.name) { + return __assign({ kind: 0 /* Import */, symbol: importedSymbol }, isImport); } - return result; } } + function exportInfo(symbol, kind) { + var exportInfo = getExportInfo(symbol, kind, checker); + return exportInfo && { kind: 1 /* Export */, symbol: symbol, exportInfo: exportInfo }; + } + // Not meant for use with export specifiers or export assignment. + function getExportKindForDeclaration(node) { + return ts.hasModifier(node, 512 /* Default */) ? 1 /* Default */ : 0 /* Named */; + } } - DocumentHighlights.getDocumentHighlights = getDocumentHighlights; - /** - * Whether or not a 'node' is preceded by a label of the given string. - * Note: 'node' cannot be a SourceFile. - */ - function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219 /* LabeledStatement */; owner = owner.parent) { - if (owner.label.text === labelName) { - return true; + FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; + function isNodeImport(node) { + var parent = node.parent; + switch (parent.kind) { + case 236 /* ImportEqualsDeclaration */: + return parent.name === node && isExternalModuleImportEquals(parent) + ? { isNamedImport: false } + : undefined; + case 241 /* ImportSpecifier */: + // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. + return parent.propertyName ? undefined : { isNamedImport: true }; + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + ts.Debug.assert(parent.name === node); + return { isNamedImport: false }; + default: + return undefined; + } + } + function getExportInfo(exportSymbol, exportKind, checker) { + var exportingModuleSymbol = checker.getMergedSymbol(exportSymbol.parent); // Need to get merged symbol in case there's an augmentation. + // `export` may appear in a namespace. In that case, just rely on global search. + return ts.isExternalModuleSymbol(exportingModuleSymbol) ? { exportingModuleSymbol: exportingModuleSymbol, exportKind: exportKind } : undefined; + } + FindAllReferences.getExportInfo = getExportInfo; + function symbolName(symbol) { + if (symbol.name !== "default") { + return symbol.name; + } + var name = ts.forEach(symbol.declarations, function (_a) { + var name = _a.name; + return name && name.kind === 70 /* Identifier */ && name.text; + }); + ts.Debug.assert(!!name); + return name; + } + /** If at an export specifier, go to the symbol it refers to. */ + function skipExportSpecifierSymbol(symbol, checker) { + // For `export { foo } from './bar", there's nothing to skip, because it does not create a new alias. But `export { foo } does. + if (symbol.declarations) + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.isExportSpecifier(declaration) && !declaration.propertyName && !declaration.parent.parent.moduleSpecifier) { + return checker.getExportSpecifierLocalTargetSymbol(declaration); + } } + return symbol; + } + function getContainingModuleSymbol(importer, checker) { + return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); + } + function getSourceFileLikeForImportDeclaration(node) { + if (node.kind === 180 /* CallExpression */) { + return node.getSourceFile(); } - return false; + var parent = node.parent; + if (parent.kind === 264 /* SourceFile */) { + return parent; + } + ts.Debug.assert(parent.kind === 233 /* ModuleBlock */ && isAmbientModuleDeclaration(parent.parent)); + return parent.parent; } - })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})); + function isAmbientModuleDeclaration(node) { + return node.kind === 232 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */; + } + function isExternalModuleImportEquals(_a) { + var moduleReference = _a.moduleReference; + return moduleReference.kind === 247 /* ExternalModuleReference */ && moduleReference.expression.kind === 9 /* StringLiteral */; + } + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); +/// +/* @internal */ var ts; (function (ts) { - function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { - if (currentDirectory === void 0) { currentDirectory = ""; } - // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have - // for those settings. - var buckets = ts.createMap(); - var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyForCompilationSettings(settings) { - return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); + var FindAllReferences; + (function (FindAllReferences) { + function nodeEntry(node, isInString) { + return { type: "node", node: node, isInString: isInString }; } - function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; - if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); + FindAllReferences.nodeEntry = nodeEntry; + function findReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position) { + var referencedSymbols = findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position); + if (!referencedSymbols || !referencedSymbols.length) { + return undefined; } - return bucket; + var out = []; + for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { + var _a = referencedSymbols_1[_i], definition = _a.definition, references = _a.references; + // Only include referenced symbols that have a valid definition. + if (definition) { + out.push({ definition: definitionToReferencedSymbolDefinitionInfo(definition, checker), references: references.map(toReferenceEntry) }); + } + } + return out; } - function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; - var sourceFiles = []; - entries.forEachValue(function (key, entry) { - sourceFiles.push({ - name: key, - refCount: entry.languageServiceRefCount, - references: entry.owners.slice(0) - }); - }); - sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); - return { - bucket: name, - sourceFiles: sourceFiles - }; - }); - return JSON.stringify(bucketInfoArray, undefined, 2); + FindAllReferences.findReferencedSymbols = findReferencedSymbols; + function getImplementationsAtPosition(checker, cancellationToken, sourceFiles, sourceFile, position) { + var node = ts.getTouchingPropertyName(sourceFile, position); + var referenceEntries = getImplementationReferenceEntries(checker, cancellationToken, sourceFiles, node); + return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); }); } - function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; + function getImplementationReferenceEntries(typeChecker, cancellationToken, sourceFiles, node) { + // If invoked directly on a shorthand property assignment, then return + // the declaration of the symbol being assigned (not the symbol being assigned to). + if (node.parent.kind === 261 /* ShorthandPropertyAssignment */) { + var result_4 = []; + FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, function (node) { return result_4.push(nodeEntry(node)); }); + return result_4; + } + else if (node.kind === 96 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) { + // References to and accesses on the super keyword only have one possible implementation, so no + // need to "Find all References" + var symbol = typeChecker.getSymbolAtLocation(node); + return symbol.valueDeclaration && [nodeEntry(symbol.valueDeclaration)]; + } + else { + // Perform "Find all References" and retrieve only those that are implementations + return getReferenceEntriesForNode(node, sourceFiles, typeChecker, cancellationToken, { implementations: true }); + } } - function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + function findReferencedEntries(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var x = flattenEntries(findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options)); + return ts.map(x, toReferenceEntry); } - function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + FindAllReferences.findReferencedEntries = findReferencedEntries; + function getReferenceEntriesForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + return flattenEntries(FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options)); } - function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); + FindAllReferences.getReferenceEntriesForNode = getReferenceEntriesForNode; + function findAllReferencedSymbols(checker, cancellationToken, sourceFiles, sourceFile, position, options) { + var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); + return FindAllReferences.Core.getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options); + } + function flattenEntries(referenceSymbols) { + return referenceSymbols && ts.flatMap(referenceSymbols, function (r) { return r.references; }); + } + function definitionToReferencedSymbolDefinitionInfo(def, checker) { + var info = (function () { + switch (def.type) { + case "symbol": { + var symbol = def.symbol, node_2 = def.node; + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + var _a = getDefinitionKindAndDisplayParts(symbol, node_2, checker), displayParts_1 = _a.displayParts, kind_1 = _a.kind; + var name_3 = displayParts_1.map(function (p) { return p.text; }).join(""); + return { node: node_2, name: name_3, kind: kind_1, displayParts: displayParts_1 }; + } + case "label": { + var node_3 = def.node; + return { node: node_3, name: node_3.text, kind: ts.ScriptElementKind.label, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + } + case "keyword": { + var node_4 = def.node; + var name_4 = ts.tokenToString(node_4.kind); + return { node: node_4, name: name_4, kind: ts.ScriptElementKind.keyword, displayParts: [{ text: name_4, kind: ts.ScriptElementKind.keyword }] }; + } + case "this": { + var node_5 = def.node; + var symbol = checker.getSymbolAtLocation(node_5); + var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; + return { node: node_5, name: "this", kind: ts.ScriptElementKind.variableElement, displayParts: displayParts_2 }; + } + case "string": { + var node_6 = def.node; + return { node: node_6, name: node_6.text, kind: ts.ScriptElementKind.variableElement, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + } + } + })(); + if (!info) { + return undefined; + } + var node = info.node, name = info.name, kind = info.kind, displayParts = info.displayParts; + var sourceFile = node.getSourceFile(); + return { + containerKind: "", + containerName: "", + fileName: sourceFile.fileName, + kind: kind, + name: name, + textSpan: ts.createTextSpanFromNode(node, sourceFile), + displayParts: displayParts + }; } - function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { - var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); - var entry = bucket.get(path); - if (!entry) { - ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); - // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); - entry = { - sourceFile: sourceFile, - languageServiceRefCount: 0, - owners: [] + function getDefinitionKindAndDisplayParts(symbol, node, checker) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node.getSourceFile(), ts.getContainerNode(node), node), displayParts = _a.displayParts, symbolKind = _a.symbolKind; + return { displayParts: displayParts, kind: symbolKind }; + } + function toReferenceEntry(entry) { + if (entry.type === "span") { + return { textSpan: entry.textSpan, fileName: entry.fileName, isWriteAccess: false, isDefinition: false }; + } + var node = entry.node, isInString = entry.isInString; + return { + fileName: node.getSourceFile().fileName, + textSpan: getTextSpan(node), + isWriteAccess: isWriteAccess(node), + isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node), + isInString: isInString + }; + } + function toImplementationLocation(entry, checker) { + if (entry.type === "node") { + var node = entry.node; + return __assign({ textSpan: getTextSpan(node), fileName: node.getSourceFile().fileName }, implementationKindDisplayParts(node, checker)); + } + else { + var textSpan = entry.textSpan, fileName = entry.fileName; + return { textSpan: textSpan, fileName: fileName, kind: ts.ScriptElementKind.unknown, displayParts: [] }; + } + } + function implementationKindDisplayParts(node, checker) { + var symbol = checker.getSymbolAtLocation(ts.isDeclaration(node) && node.name ? node.name : node); + if (symbol) { + return getDefinitionKindAndDisplayParts(symbol, node, checker); + } + else if (node.kind === 177 /* ObjectLiteralExpression */) { + return { + kind: ts.ScriptElementKind.interfaceElement, + displayParts: [ts.punctuationPart(18 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(19 /* CloseParenToken */)] + }; + } + else if (node.kind === 198 /* ClassExpression */) { + return { + kind: ts.ScriptElementKind.localClassElement, + displayParts: [ts.punctuationPart(18 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(19 /* CloseParenToken */)] }; - bucket.set(path, entry); } else { - // We have an entry for this file. However, it may be for a different version of - // the script snapshot. If so, update it appropriately. Otherwise, we can just - // return it as is. - if (entry.sourceFile.version !== version) { - entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); - } + return { kind: ts.getNodeKind(node), displayParts: [] }; } - // If we're acquiring, then this is the first time this LS is asking for this document. - // Increase our ref count so we know there's another LS using the document. If we're - // not acquiring, then that means the LS is 'updating' the file instead, and that means - // it has already acquired the document previously. As such, we do not need to increase - // the ref count. - if (acquiring) { - entry.languageServiceRefCount++; + } + function toHighlightSpan(entry) { + if (entry.type === "span") { + var fileName_1 = entry.fileName, textSpan = entry.textSpan; + return { fileName: fileName_1, span: { textSpan: textSpan, kind: ts.HighlightSpanKind.reference } }; } - return entry.sourceFile; + var node = entry.node, isInString = entry.isInString; + var fileName = entry.node.getSourceFile().fileName; + var writeAccess = isWriteAccess(node); + var span = { + textSpan: getTextSpan(node), + kind: writeAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference, + isInString: isInString + }; + return { fileName: fileName, span: span }; } - function releaseDocument(fileName, compilationSettings) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return releaseDocumentWithKey(path, key); + FindAllReferences.toHighlightSpan = toHighlightSpan; + function getTextSpan(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 9 /* StringLiteral */) { + start += 1; + end -= 1; + } + return ts.createTextSpanFromBounds(start, end); } - function releaseDocumentWithKey(path, key) { - var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); - ts.Debug.assert(bucket !== undefined); - var entry = bucket.get(path); - entry.languageServiceRefCount--; - ts.Debug.assert(entry.languageServiceRefCount >= 0); - if (entry.languageServiceRefCount === 0) { - bucket.remove(path); + /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ + function isWriteAccess(node) { + if (node.kind === 70 /* Identifier */ && ts.isDeclarationName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 192 /* PostfixUnaryExpression */ || parent.kind === 191 /* PrefixUnaryExpression */) { + return true; + } + else if (parent.kind === 193 /* BinaryExpression */ && parent.left === node) { + var operator = parent.operatorToken.kind; + return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */; + } } + return false; } - return { - acquireDocument: acquireDocument, - acquireDocumentWithKey: acquireDocumentWithKey, - updateDocument: updateDocument, - updateDocumentWithKey: updateDocumentWithKey, - releaseDocument: releaseDocument, - releaseDocumentWithKey: releaseDocumentWithKey, - reportStats: reportStats, - getKeyForCompilationSettings: getKeyForCompilationSettings - }; - } - ts.createDocumentRegistry = createDocumentRegistry; + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); +/** Encapsulates the core find-all-references algorithm. */ /* @internal */ -var ts; (function (ts) { var FindAllReferences; (function (FindAllReferences) { - function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { - var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8 /* NumericLiteral */: - if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; + var Core; + (function (Core) { + /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ + function getReferencedSymbolsForNode(node, sourceFiles, checker, cancellationToken, options) { + if (options === void 0) { options = {}; } + if (node.kind === 264 /* SourceFile */) { + return undefined; + } + if (!options.implementations) { + var special = getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken); + if (special) { + return special; } - // Fallthrough - case 70 /* Identifier */: - case 98 /* ThisKeyword */: - // case SyntaxKind.SuperKeyword: TODO:GH#9268 - case 122 /* ConstructorKeyword */: - case 9 /* StringLiteral */: - return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, /*implementations*/ false); + } + var symbol = checker.getSymbolAtLocation(node); + // Could not find a symbol e.g. unknown identifier + if (!symbol) { + // String literal might be a property (and thus have a symbol), so do this here rather than in getReferencedSymbolsSpecial. + if (!options.implementations && node.kind === 9 /* StringLiteral */) { + return getReferencesForStringLiteral(node, sourceFiles, cancellationToken); + } + // Can't have references to something that we have no symbol for. + return undefined; + } + // The symbol was an internal symbol and does not have a declaration e.g. undefined symbol + if (!symbol.declarations || !symbol.declarations.length) { + return undefined; + } + return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options); } - return undefined; - } - FindAllReferences.findReferencedSymbols = findReferencedSymbols; - function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { - if (!implementations) { + Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + /** getReferencedSymbols for special node kinds. */ + function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { + if (ts.isTypeKeyword(node.kind)) { + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken); + } // Labels if (ts.isLabelName(node)) { if (ts.isJumpStatementTarget(node)) { var labelDefinition = ts.getTargetLabel(node.parent, node.text); // if we have a label definition, look within its statement for references, if not, then // the label is undefined and we have no results.. - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition); } else { // it is a label definition and not a target, search within the parent labeledStatement @@ -69311,129 +75098,164 @@ var ts; } } if (ts.isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); + return getReferencesForThisKeyword(node, sourceFiles, cancellationToken); } if (node.kind === 96 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } - } - // `getSymbolAtLocation` normally returns the symbol of the class when given the constructor keyword, - // so we have to specify that we want the constructor symbol. - var symbol = typeChecker.getSymbolAtLocation(node); - if (!implementations && !symbol && node.kind === 9 /* StringLiteral */) { - return getReferencesForStringLiteral(node, sourceFiles); - } - // Could not find a symbol e.g. unknown identifier - if (!symbol) { - // Can't have references to something that we have no symbol for. return undefined; } - var declarations = symbol.declarations; - // The symbol was an internal symbol and does not have a declaration e.g. undefined symbol - if (!declarations || !declarations.length) { - return undefined; - } - var result; - // Compute the meaning from the location and the symbol it references - var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); - // Get the text to search for. - // Note: if this is an external module symbol, the name doesn't include quotes. - var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - // Try to get the smallest valid scope that we can limit our search to; - // otherwise we'll need to search globally (i.e. include each file). - var scope = getSymbolScope(symbol); - // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. - var symbolToIndex = []; - if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); - } - else { - var internedName = getInternedName(symbol, node); - for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { - var sourceFile = sourceFiles_8[_i]; - cancellationToken.throwIfCancellationRequested(); - var nameTable = ts.getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + /** Core find-all-references algorithm for a normal symbol. */ + function getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options) { + symbol = skipPastExportOrImportSpecifier(symbol, node, checker); + // Compute the meaning from the location and the symbol it references + var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), symbol.declarations); + var result = []; + var state = createState(sourceFiles, node, checker, cancellationToken, searchMeaning, options, result); + var search = state.createSearch(node, symbol, /*comingFrom*/ undefined, { allSearchSymbols: populateSearchSymbolSet(symbol, node, checker, options.implementations) }); + // Try to get the smallest valid scope that we can limit our search to; + // otherwise we'll need to search globally (i.e. include each file). + var scope = getSymbolScope(symbol); + if (scope) { + getReferencesInContainer(scope, scope.getSourceFile(), search, state); + } + else { + // Global search + for (var _i = 0, _a = state.sourceFiles; _i < _a.length; _i++) { + var sourceFile = _a[_i]; + state.cancellationToken.throwIfCancellationRequested(); + searchForName(sourceFile, search, state); } } + return result; } - return result; - function getDefinition(symbol) { - var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; + /** Handle a few special cases relating to export/import specifiers. */ + function skipPastExportOrImportSpecifier(symbol, node, checker) { + var parent = node.parent; + if (ts.isExportSpecifier(parent)) { + return getLocalSymbolForExportSpecifier(node, symbol, parent, checker); } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; + if (ts.isImportSpecifier(parent) && parent.propertyName === node) { + // We're at `foo` in `import { foo as bar }`. Probably intended to find all refs on the original, not just on the import. + return checker.getImmediateAliasedSymbol(symbol); + } + return symbol; } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608 /* Alias */) { - // Default import get alias - var defaultImport = ts.getDeclarationOfKind(symbol, 236 /* ImportClause */); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 /* ImportSpecifier */ || - declaration.kind === 243 /* ExportSpecifier */) ? declaration : undefined; }); - if (importOrExportSpecifier && - // export { a } - (!importOrExportSpecifier.propertyName || - // export {a as class } where a is location - importOrExportSpecifier.propertyName === location)) { - // If Import specifier -> get alias - // else Export specifier -> get local target - return importOrExportSpecifier.kind === 239 /* ImportSpecifier */ ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + function createState(sourceFiles, originalLocation, checker, cancellationToken, searchMeaning, options, result) { + var symbolIdToReferences = []; + var inheritsFromCache = ts.createMap(); + // Source file ID → symbol ID → Whether the symbol has been searched for in the source file. + var sourceFileToSeenSymbols = []; + var isForConstructor = originalLocation.kind === 122 /* ConstructorKeyword */; + var importTracker; + return __assign({}, options, { sourceFiles: sourceFiles, isForConstructor: isForConstructor, checker: checker, cancellationToken: cancellationToken, searchMeaning: searchMeaning, inheritsFromCache: inheritsFromCache, getImportSearches: getImportSearches, createSearch: createSearch, referenceAdder: referenceAdder, addStringOrCommentReference: addStringOrCommentReference, + markSearchedSymbol: markSearchedSymbol, markSeenContainingTypeReference: ts.nodeSeenTracker(), markSeenReExportRHS: ts.nodeSeenTracker() }); + function getImportSearches(exportSymbol, exportInfo) { + if (!importTracker) + importTracker = FindAllReferences.createImportTracker(sourceFiles, checker, cancellationToken); + return importTracker(exportSymbol, exportInfo, options.isForRename); + } + function createSearch(location, symbol, comingFrom, searchOptions) { + if (searchOptions === void 0) { searchOptions = {}; } + // Note: if this is an external module symbol, the name doesn't include quotes. + var _a = searchOptions.text, text = _a === void 0 ? ts.stripQuotes(ts.getDeclaredName(checker, symbol, location)) : _a, _b = searchOptions.allSearchSymbols, allSearchSymbols = _b === void 0 ? undefined : _b; + var escapedText = ts.escapeIdentifier(text); + var parents = options.implementations && getParentSymbolsOfPropertyAccess(location, symbol, checker); + return { location: location, symbol: symbol, comingFrom: comingFrom, text: text, escapedText: escapedText, parents: parents, includes: includes }; + function includes(referenceSymbol) { + return allSearchSymbols ? ts.contains(allSearchSymbols, referenceSymbol) : referenceSymbol === symbol; + } + } + function referenceAdder(referenceSymbol, searchLocation) { + var symbolId = ts.getSymbolId(referenceSymbol); + var references = symbolIdToReferences[symbolId]; + if (!references) { + references = symbolIdToReferences[symbolId] = []; + result.push({ definition: { type: "symbol", symbol: referenceSymbol, node: searchLocation }, references: references }); + } + return function (node) { return references.push(FindAllReferences.nodeEntry(node)); }; + } + function addStringOrCommentReference(fileName, textSpan) { + result.push({ + definition: undefined, + references: [{ type: "span", fileName: fileName, textSpan: textSpan }] + }); + } + function markSearchedSymbol(sourceFile, symbol) { + var sourceId = ts.getNodeId(sourceFile); + var symbolId = ts.getSymbolId(symbol); + var seenSymbols = sourceFileToSeenSymbols[sourceId] || (sourceFileToSeenSymbols[sourceId] = []); + return !seenSymbols[symbolId] && (seenSymbols[symbolId] = true); + } + } + /** Search for all imports of a given exported symbol using `State.getImportSearches`. */ + function searchForImportsOfExport(exportLocation, exportSymbol, exportInfo, state) { + var _a = state.getImportSearches(exportSymbol, exportInfo), importSearches = _a.importSearches, singleReferences = _a.singleReferences, indirectUsers = _a.indirectUsers; + // For `import { foo as bar }` just add the reference to `foo`, and don't otherwise search in the file. + if (singleReferences.length) { + var addRef = state.referenceAdder(exportSymbol, exportLocation); + for (var _i = 0, singleReferences_1 = singleReferences; _i < singleReferences_1.length; _i++) { + var singleRef = singleReferences_1[_i]; + addRef(singleRef); + } + } + // For each import, find all references to that import in its source file. + for (var _b = 0, importSearches_1 = importSearches; _b < importSearches_1.length; _b++) { + var _c = importSearches_1[_b], importLocation = _c[0], importSymbol = _c[1]; + getReferencesInSourceFile(importLocation.getSourceFile(), state.createSearch(importLocation, importSymbol, 1 /* Export */), state); + } + if (indirectUsers.length) { + var indirectSearch = void 0; + switch (exportInfo.exportKind) { + case 0 /* Named */: + indirectSearch = state.createSearch(exportLocation, exportSymbol, 1 /* Export */); + break; + case 1 /* Default */: + // Search for a property access to '.default'. This can't be renamed. + indirectSearch = state.isForRename ? undefined : state.createSearch(exportLocation, exportSymbol, 1 /* Export */, { text: "default" }); + break; + case 2 /* ExportEquals */: + break; + } + if (indirectSearch) { + for (var _d = 0, indirectUsers_1 = indirectUsers; _d < indirectUsers_1.length; _d++) { + var indirectUser = indirectUsers_1[_d]; + searchForName(indirectUser, indirectSearch, state); + } } } - return undefined; } - function followAliasIfNecessary(symbol, location) { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + // Go to the symbol we imported from and find references for it. + function searchForImportedSymbol(symbol, state) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + getReferencesInSourceFile(declaration.getSourceFile(), state.createSearch(declaration, symbol, 0 /* Import */), state); + } + } + /** Search for all occurences of an identifier in a source file (and filter out the ones that match). */ + function searchForName(sourceFile, search, state) { + if (ts.getNameTable(sourceFile).get(search.escapedText) !== undefined) { + getReferencesInSourceFile(sourceFile, search, state); + } } - function getPropertySymbolOfDestructuringAssignment(location) { + function getPropertySymbolOfDestructuringAssignment(location, checker) { return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); + checker.getPropertySymbolOfDestructuringAssignment(location); } function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); return bindingElement && - bindingElement.parent.kind === 172 /* ObjectBindingPattern */ && + bindingElement.parent.kind === 173 /* ObjectBindingPattern */ && !bindingElement.propertyName; } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + var bindingElement = ts.getDeclarationOfKind(symbol, 175 /* BindingElement */); + var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); } return undefined; } - function getInternedName(symbol, location) { - // If this is an export or import specifier it could have been renamed using the 'as' syntax. - // If so we want to search for whatever under the cursor. - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - // Try to get the local symbol if we're dealing with an 'export default' - // since that symbol has the "true" name. - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); - } /** * Determines the smallest scope in which a symbol may have named references. * Note that not every construct has been accounted for. This function can @@ -69445,55 +75267,57 @@ var ts; function getSymbolScope(symbol) { // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. - var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 184 /* FunctionExpression */ || valueDeclaration.kind === 197 /* ClassExpression */)) { + var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 185 /* FunctionExpression */ || valueDeclaration.kind === 198 /* ClassExpression */)) { return valueDeclaration; } + if (!declarations) { + return undefined; + } // If this is private property or method, the scope is the containing class - if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); + if (flags & (4 /* Property */ | 8192 /* Method */)) { + var privateDeclaration = ts.find(declarations, function (d) { return !!(ts.getModifierFlags(d) & 8 /* Private */); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 228 /* ClassDeclaration */); } } - // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visible outside its declaration scope. - if (symbol.flags & 8388608 /* Alias */) { - return undefined; - } // If symbol is of object binding pattern element without property name we would want to // look for property too and that could be anywhere if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { return undefined; } - // if this symbol is visible from its parent container, e.g. exported, then bail out - // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { + // If the symbol has a parent, it's globally visible. + // Unless that parent is an external module, then we should only search in the module (and recurse on the export later). + // But if the parent is a module that has `export as namespace`, then the symbol *is* globally visible. + if (parent && !((parent.flags & 1536 /* Module */) && ts.isExternalModuleSymbol(parent) && !parent.globalExports)) { + return undefined; + } + // If this is a synthetic property, it's a property and must be searched for globally. + if ((flags & 134217728 /* Transient */ && symbol.checkFlags & 6 /* Synthetic */)) { return undefined; } var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; - var container = ts.getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - // Different declarations have different containers, bail out - return undefined; - } - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { - // This is a global variable and not an external module, any declaration defined - // within this scope is visible outside the file - return undefined; - } - // The search scope is the container node - scope = container; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; + var container = ts.getContainerNode(declaration); + if (scope && scope !== container) { + // Different declarations have different containers, bail out + return undefined; } + if (!container || container.kind === 264 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + // This is a global variable and not an external module, any declaration defined + // within this scope is visible outside the file + return undefined; + } + // The search scope is the container node + scope = container; } - return scope; + // If symbol.parent, this means we are in an export of an external module. (Otherwise we would have returned `undefined` above.) + // For an export of a module, we may be in a declaration file, and it may be accessed elsewhere. E.g.: + // declare module "a" { export type T = number; } + // declare module "b" { import { T } from "a"; export const x: T; } + // So we must search the whole source file. (Because we will mark the source file as seen, we we won't return to it when searching for imports.) + return parent ? scope.getSourceFile() : scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { var positions = []; @@ -69508,7 +75332,6 @@ var ts; var symbolNameLength = symbolName.length; var position = text.indexOf(symbolName, start); while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); // If we are past the end, stop looking if (position > end) break; @@ -69529,279 +75352,320 @@ var ts; var sourceFile = container.getSourceFile(); var labelName = targetLabel.text; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.getWidth() !== labelName.length) { - return; + continue; } // Only pick labels that are either the target label, or have a target that is the target label if (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ts.ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), - displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] - }; - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "label", node: targetLabel }, references: references }]; } function isValidReferencePosition(node, searchSymbolName) { - if (node) { - // Compare the length so we filter out strict superstrings of the symbol we are looking for - switch (node.kind) { - case 70 /* Identifier */: - return node.getWidth() === searchSymbolName.length; - case 9 /* StringLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - // For string literals we have two additional chars for the quotes - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8 /* NumericLiteral */: - if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; + // Compare the length so we filter out strict superstrings of the symbol we are looking for + switch (node && node.kind) { + case 70 /* Identifier */: + return node.getWidth() === searchSymbolName.length; + case 9 /* StringLiteral */: + return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + // For string literals we have two additional chars for the quotes + node.getWidth() === searchSymbolName.length + 2; + case 8 /* NumericLiteral */: + return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + default: + return false; + } + } + function getAllReferencesForKeyword(sourceFiles, keywordKind, cancellationToken) { + var references = []; + for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { + var sourceFile = sourceFiles_5[_i]; + cancellationToken.throwIfCancellationRequested(); + addReferencesForKeywordInFile(sourceFile, keywordKind, ts.tokenToString(keywordKind), references); + } + return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined; + } + function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile.getStart(), sourceFile.getEnd()); + for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) { + var position = possiblePositions_2[_i]; + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (referenceLocation.kind === kind) { + references.push(FindAllReferences.nodeEntry(referenceLocation)); } } - return false; } - /** Search within node "container" for references for a search value, where the search value is defined as a - * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). - * searchLocation: a node where the search value - */ - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var start = findInComments ? container.getFullStart() : container.getStart(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - var parents = getParentSymbolsOfPropertyAccess(); - var inheritsFromCache = ts.createMap(); - if (possiblePositions.length) { - // Build the set of symbols to search for, initially it has only the current symbol - var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); - if (!isValidReferencePosition(referenceLocation, searchText)) { - // This wasn't the start of a token. Check to see if it might be a - // match in a comment or string if that's what the caller is asking - // for. - if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || - (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { - // In the case where we're looking inside comments/strings, we don't have - // an actual definition. So just use 'undefined' here. Features like - // 'Rename' won't care (as they ignore the definitions), and features like - // 'FindReferences' will just filter out these results. - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: ts.createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, - /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache); - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === 122 /* ConstructorKeyword */) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); - } - } - }); + function getReferencesInSourceFile(sourceFile, search, state) { + state.cancellationToken.throwIfCancellationRequested(); + return getReferencesInContainer(sourceFile, sourceFile, search, state); + } + /** + * Search within node "container" for references for a search value, where the search value is defined as a + * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). + * searchLocation: a node where the search value + */ + function getReferencesInContainer(container, sourceFile, search, state) { + if (!state.markSearchedSymbol(sourceFile, search.symbol)) { + return; } - return; - /* If we are just looking for implementations and this is a property access expression, we need to get the - * symbol of the local type of the symbol the property is being accessed on. This is because our search - * symbol may have a different parent symbol if the local type's symbol does not declare the property - * being accessed (i.e. it is declared in some parent class or interface) - */ - function getParentSymbolsOfPropertyAccess() { - if (implementations) { - var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & 196608 /* UnionOrIntersection */) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } - } - } + var start = state.findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, search.text, start, container.getEnd()); + for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) { + var position = possiblePositions_3[_i]; + getReferencesAtLocation(sourceFile, position, search, state); + } + } + function getReferencesAtLocation(sourceFile, position, search, state) { + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, search.text)) { + // This wasn't the start of a token. Check to see if it might be a + // match in a comment or string if that's what the caller is asking + // for. + if (!state.implementations && (state.findInStrings && ts.isInString(sourceFile, position) || state.findInComments && ts.isInNonReferenceComment(sourceFile, position))) { + // In the case where we're looking inside comments/strings, we don't have + // an actual definition. So just use 'undefined' here. Features like + // 'Rename' won't care (as they ignore the definitions), and features like + // 'FindReferences' will just filter out these results. + state.addStringOrCommentReference(sourceFile.fileName, ts.createTextSpan(position, search.text.length)); } + return; + } + if (!(ts.getMeaningFromLocation(referenceLocation) & state.searchMeaning)) { + return; } - function getPropertyAccessExpressionFromRightHandSide(node) { - return ts.isRightSideOfPropertyAccess(node) && node.parent; + var referenceSymbol = state.checker.getSymbolAtLocation(referenceLocation); + if (!referenceSymbol) { + return; + } + var parent = referenceLocation.parent; + if (ts.isImportSpecifier(parent) && parent.propertyName === referenceLocation) { + // This is added through `singleReferences` in ImportsResult. If we happen to see it again, don't add it again. + return; + } + if (ts.isExportSpecifier(parent)) { + ts.Debug.assert(referenceLocation.kind === 70 /* Identifier */); + getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state); + return; + } + var relatedSymbol = getRelatedSymbol(search, referenceSymbol, referenceLocation, state); + if (!relatedSymbol) { + getReferenceForShorthandProperty(referenceSymbol, search, state); + return; + } + if (state.isForConstructor) { + findConstructorReferences(referenceLocation, sourceFile, search, state); } - /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ - function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { - ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); - var referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { - ts.Debug.assert(referenceClass.name === referenceLocation); - // This is the class declaration containing the constructor. - addReferences(findOwnConstructorCalls(searchSymbol)); + else { + addReference(referenceLocation, relatedSymbol, search.location, state); + } + getImportOrExportReferences(referenceLocation, referenceSymbol, search, state); + } + function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + var exportDeclaration = parent.parent; + var localSymbol = getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, state.checker); + if (!search.includes(localSymbol)) { + return; + } + if (!propertyName) { + addRef(); + } + else if (referenceLocation === propertyName) { + // For `export { foo as bar } from "baz"`, "`foo`" will be added from the singleReferences for import searches of the original export. + // For `export { foo as bar };`, where `foo` is a local, so add it now. + if (!exportDeclaration.moduleSpecifier) { + addRef(); } - else { - // If this class appears in `extends C`, then the extending class' "super" calls are references. - var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } + if (!state.isForRename && state.markSeenReExportRHS(name)) { + addReference(name, referenceSymbol, name, state); } } - function addReferences(references) { - if (references.length) { - var referencedSymbol = getReferencedSymbol(searchSymbol); - ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); + else { + if (state.markSeenReExportRHS(referenceLocation)) { + addRef(); + } + } + // For `export { foo as bar }`, rename `foo`, but not `bar`. + if (!(referenceLocation === propertyName && state.isForRename)) { + var exportKind = referenceLocation.originalKeywordKind === 78 /* DefaultKeyword */ ? 1 /* Default */ : 0 /* Named */; + var exportInfo = FindAllReferences.getExportInfo(referenceSymbol, exportKind, state.checker); + ts.Debug.assert(!!exportInfo); + searchForImportsOfExport(referenceLocation, referenceSymbol, exportInfo, state); + } + // At `export { x } from "foo"`, also search for the imported symbol `"foo".x`. + if (search.comingFrom !== 1 /* Export */ && exportDeclaration.moduleSpecifier && !propertyName) { + searchForImportedSymbol(state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier), state); + } + function addRef() { + addReference(referenceLocation, localSymbol, search.location, state); + } + } + function getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, checker) { + return isExportSpecifierAlias(referenceLocation, exportSpecifier) ? checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) : referenceSymbol; + } + function isExportSpecifierAlias(referenceLocation, exportSpecifier) { + var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; + ts.Debug.assert(propertyName === referenceLocation || name === referenceLocation); + if (propertyName) { + // Given `export { foo as bar } [from "someModule"]`: It's an alias at `foo`, but at `bar` it's a new symbol. + return propertyName === referenceLocation; + } + else { + // `export { foo } from "foo"` is a re-export. + // `export { foo };` is not a re-export, it creates an alias for the local variable `foo`. + return !parent.parent.moduleSpecifier; + } + } + function getImportOrExportReferences(referenceLocation, referenceSymbol, search, state) { + var importOrExport = FindAllReferences.getImportOrExportSymbol(referenceLocation, referenceSymbol, state.checker, search.comingFrom === 1 /* Export */); + if (!importOrExport) + return; + var symbol = importOrExport.symbol; + if (importOrExport.kind === 0 /* Import */) { + if (!state.isForRename || importOrExport.isNamedImport) { + searchForImportedSymbol(symbol, state); } } - /** `classSymbol` is the class where the constructor was defined. - * Reference the constructor and all calls to `new this()`. + else { + // We don't check for `state.isForRename`, even for default exports, because importers that previously matched the export name should be updated to continue matching. + searchForImportsOfExport(referenceLocation, symbol, importOrExport.exportInfo, state); + } + } + function getReferenceForShorthandProperty(_a, search, state) { + var flags = _a.flags, valueDeclaration = _a.valueDeclaration; + var shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration); + /* + * Because in short-hand property assignment, an identifier which stored as name of the short-hand property assignment + * has two meanings: property name and property value. Therefore when we do findAllReference at the position where + * an identifier is declared, the language service should return the position of the variable declaration as well as + * the position in short-hand property assignment excluding property accessing. However, if we do findAllReference at the + * position of property accessing, the referenceEntry of such position will be handled in the first case. */ - function findOwnConstructorCalls(classSymbol) { - var result = []; - for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); - var ctrKeyword = decl.getChildAt(0); - ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */); - result.push(ctrKeyword); - } - ts.forEachProperty(classSymbol.exports, function (member) { - var decl = member.valueDeclaration; - if (decl && decl.kind === 149 /* MethodDeclaration */) { - var body = decl.body; - if (body) { - forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { - if (ts.isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } - }); - return result; + if (!(flags & 134217728 /* Transient */) && search.includes(shorthandValueSymbol)) { + addReference(valueDeclaration.name, shorthandValueSymbol, search.location, state); + } + } + function addReference(referenceLocation, relatedSymbol, searchLocation, state) { + var addRef = state.referenceAdder(relatedSymbol, searchLocation); + if (state.implementations) { + addImplementationReferences(referenceLocation, addRef, state); } - /** Find references to `super` in the constructor of an extending class. */ - function superConstructorAccesses(cls) { - var symbol = cls.symbol; - var ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; + else { + addRef(referenceLocation); + } + } + /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ + function findConstructorReferences(referenceLocation, sourceFile, search, state) { + if (ts.isNewExpressionTarget(referenceLocation)) { + addReference(referenceLocation, search.symbol, search.location, state); + } + var pusher = state.referenceAdder(search.symbol, search.location); + if (ts.isClassLike(referenceLocation.parent)) { + ts.Debug.assert(referenceLocation.parent.name === referenceLocation); + // This is the class declaration containing the constructor. + findOwnConstructorReferences(search.symbol, sourceFile, pusher); + } + else { + // If this class appears in `extends C`, then the extending class' "super" calls are references. + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending)) { + findSuperConstructorAccesses(classExtending, pusher); } - var result = []; - for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { - var decl = _a[_i]; - ts.Debug.assert(decl.kind === 150 /* Constructor */); + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + /** + * `classSymbol` is the class where the constructor was defined. + * Reference the constructor and all calls to `new this()`. + */ + function findOwnConstructorReferences(classSymbol, sourceFile, addNode) { + for (var _i = 0, _a = classSymbol.members.get("__constructor").declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var ctrKeyword = ts.findChildOfKind(decl, 122 /* ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 151 /* Constructor */ && !!ctrKeyword); + addNode(ctrKeyword); + } + classSymbol.exports.forEach(function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 150 /* MethodDeclaration */) { var body = decl.body; if (body) { - forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { - if (ts.isCallExpressionTarget(node)) { - result.push(node); + forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + addNode(thisKeyword); } }); } } - ; - return result; + }); + } + /** Find references to `super` in the constructor of an extending class. */ + function findSuperConstructorAccesses(cls, addNode) { + var symbol = cls.symbol; + var ctr = symbol.members.get("__constructor"); + if (!ctr) { + return; } - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 151 /* Constructor */); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { + if (ts.isCallExpressionTarget(node)) { + addNode(node); + } }); } - return result[index]; - } - function addReferenceToRelatedSymbol(node, relatedSymbol) { - var references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } } } - function getImplementationReferenceEntryForNode(refNode, result) { + function addImplementationReferences(refNode, addReference, state) { // Check if we found a function/propertyAssignment/method with an implementation or initializer if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); + addReference(refNode.parent); + return; } - else if (refNode.kind === 70 /* Identifier */) { - if (refNode.parent.kind === 258 /* ShorthandPropertyAssignment */) { - // Go ahead and dereference the shorthand assignment by going to its definition - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - // Check if the node is within an extends or implements clause - var containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface - var containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); - } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204 /* Block */) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); - } + if (refNode.kind !== 70 /* Identifier */) { + return; + } + if (refNode.parent.kind === 261 /* ShorthandPropertyAssignment */) { + // Go ahead and dereference the shorthand assignment by going to its definition + getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); + } + // Check if the node is within an extends or implements clause + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + addReference(containingClass); + return; + } + // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface + var containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference && state.markSeenContainingTypeReference(containingTypeReference)) { + var parent = containingTypeReference.parent; + if (ts.isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + addReference(parent.initializer); + } + else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === 206 /* Block */) { + ts.forEachReturnStatement(parent.body, function (returnStatement) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + addReference(returnStatement.expression); + } + }); } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (isImplementationExpression(parent.body)) { + addReference(parent.body); } } - } - // Type nodes can contain multiple references to the same type. For example: - // let x: Foo & (Foo & Bar) = ... - // Because we are returning the implementation locations and not the identifier locations, - // duplicate entries would be returned here as each of the type references is part of - // the same implementation. For that reason, check before we add a new entry - function maybeAdd(a) { - if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { - result.push(a); + else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + addReference(parent.expression); } } } @@ -69830,12 +75694,12 @@ var ts; } function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { - if (node.kind === 199 /* ExpressionWithTypeArguments */ - && node.parent.kind === 255 /* HeritageClause */ + if (node.kind === 200 /* ExpressionWithTypeArguments */ + && node.parent.kind === 258 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } - else if (node.kind === 70 /* Identifier */ || node.kind === 177 /* PropertyAccessExpression */) { + else if (node.kind === 70 /* Identifier */ || node.kind === 178 /* PropertyAccessExpression */) { return getContainingClassIfInHeritageClause(node.parent); } } @@ -69845,15 +75709,18 @@ var ts; * Returns true if this is an expression that can be considered an implementation */ function isImplementationExpression(node) { - // Unwrap parentheses - if (node.kind === 183 /* ParenthesizedExpression */) { - return isImplementationExpression(node.expression); + switch (node.kind) { + case 184 /* ParenthesizedExpression */: + return isImplementationExpression(node.expression); + case 186 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 177 /* ObjectLiteralExpression */: + case 198 /* ClassExpression */: + case 176 /* ArrayLiteralExpression */: + return true; + default: + return false; } - return node.kind === 185 /* ArrowFunction */ || - node.kind === 184 /* FunctionExpression */ || - node.kind === 176 /* ObjectLiteralExpression */ || - node.kind === 197 /* ClassExpression */ || - node.kind === 175 /* ArrayLiteralExpression */; } /** * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol @@ -69874,7 +75741,7 @@ var ts; * @param parent Another class or interface Symbol * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results */ - function explicitlyInheritsFrom(child, parent, cachedResults) { + function explicitlyInheritsFrom(child, parent, cachedResults, checker) { var parentIsInterface = parent.getFlags() & 64 /* Interface */; return searchHierarchy(child); function searchHierarchy(symbol) { @@ -69882,11 +75749,12 @@ var ts; return true; } var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; + var cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; } // Set the key so that we don't infinitely recurse - cachedResults[key] = false; + cachedResults.set(key, false); var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { if (ts.isClassLike(declaration)) { if (parentIsInterface) { @@ -69902,19 +75770,19 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 229 /* InterfaceDeclaration */) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; }); - cachedResults[key] = inherits; + cachedResults.set(key, inherits); return inherits; } function searchTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type && type.symbol) { return searchHierarchy(type.symbol); } @@ -69930,13 +75798,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -69946,49 +75814,48 @@ var ts; var references = []; var sourceFile = searchSpaceNode.getSourceFile(); var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); + for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) { + var position = possiblePositions_4[_i]; var node = ts.getTouchingWord(sourceFile, position); if (!node || node.kind !== 96 /* SuperKeyword */) { - return; + continue; } var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); + references.push(FindAllReferences.nodeEntry(node)); } - }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; + } + return [{ definition: { type: "symbol", symbol: searchSpaceNode.symbol, node: superKeyword }, references: references }]; } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } - // fall through - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + // falls through + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 261 /* SourceFile */: + case 264 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - // Fall through - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + // falls through + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -69997,8 +75864,9 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261 /* SourceFile */) { + if (searchSpaceNode.kind === 264 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); }); @@ -70008,144 +75876,103 @@ var ts; possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); } - var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: displayParts - }, + definition: { type: "this", node: thisOrSuperKeyword }, references: references }]; function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); if (!node || !ts.isThis(node)) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 228 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); + result.push(FindAllReferences.nodeEntry(node)); } break; - case 261 /* SourceFile */: - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); + case 264 /* SourceFile */: + if (container.kind === 264 /* SourceFile */ && !ts.isExternalModule(container)) { + result.push(FindAllReferences.nodeEntry(node)); } break; } }); } } - function getReferencesForStringLiteral(node, sourceFiles) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - // nothing to do here. moving on - return undefined; - } + function getReferencesForStringLiteral(node, sourceFiles, cancellationToken) { var references = []; - for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { - var sourceFile = sourceFiles_9[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var sourceFile = sourceFiles_6[_i]; + cancellationToken.throwIfCancellationRequested(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, node.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, node.text, possiblePositions, references); } return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ts.ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] - }, + definition: { type: "string", node: node }, references: references }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { - return; - } - var type_2 = ts.getStringLiteralTypeForNode(node_2, typeChecker); - if (type_2 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) { + for (var _i = 0, possiblePositions_5 = possiblePositions; _i < possiblePositions_5.length; _i++) { + var position = possiblePositions_5[_i]; + var node_7 = ts.getTouchingWord(sourceFile, position); + if (node_7 && node_7.kind === 9 /* StringLiteral */ && node_7.text === searchText) { + references.push(FindAllReferences.nodeEntry(node_7, /*isInString*/ true)); } } } } - function populateSearchSymbolSet(symbol, location) { + // For certain symbol kinds, we need to include other symbols in the search set. + // This is not needed when searching for re-exports. + function populateSearchSymbolSet(symbol, location, checker, implementations) { // The search set contains at least the current symbol var result = [symbol]; - // If the location is name of property symbol from object literal destructuring pattern - // Search the property symbol - // for ( { property: p2 } of elems) { } - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258 /* ShorthandPropertyAssignment */) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - // If the symbol is an alias, add what it aliases to the list - // import {a} from "mod"; - // export {a} - // If the symbol is an alias to default declaration, add what it aliases to the list - // declare "mod" { export default class B { } } - // import B from "mod"; - //// For export specifiers, the exported name can be referring to a local symbol, e.g.: - //// import {a} from "mod"; - //// export {a as somethingElse} - //// We want the *local* declaration of 'a' as declared in the import, - //// *not* as declared within "mod" (or farther) - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } - // If the location is in a context sensitive location (i.e. in an object literal) try - // to get a contextual type for it, and add the property symbol from the contextual - // type to the search set + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(location); if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + if (containingObjectLiteralElement.kind !== 261 /* ShorthandPropertyAssignment */) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location, checker); + if (propertySymbol) { + result.push(propertySymbol); + } + } + // If the location is in a context sensitive location (i.e. in an object literal) try + // to get a contextual type for it, and add the property symbol from the contextual + // type to the search set + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, checker), function (contextualSymbol) { + ts.addRange(result, checker.getRootSymbols(contextualSymbol)); }); /* Because in short-hand property assignment, location has two meaning : property name and as value of the property - * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of - * property name and variable declaration of the identifier. - * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service - * should show both 'name' in 'obj' and 'name' in variable declaration - * const name = "Foo"; - * const obj = { name }; - * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment - * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration - * will be included correctly. - */ - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of + * property name and variable declaration of the identifier. + * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service + * should show both 'name' in 'obj' and 'name' in variable declaration + * const name = "Foo"; + * const obj = { name }; + * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment + * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration + * will be included correctly. + */ + var shorthandValueSymbol = checker.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { result.push(shorthandValueSymbol); } @@ -70154,27 +75981,28 @@ var ts; // we should include both parameter declaration symbol and property declaration symbol // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ && + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 145 /* Parameter */ && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + ts.addRange(result, checker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } // If this is symbol of binding element without propertyName declaration in Object binding pattern // Include the property in the search - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker); if (bindingElementPropertySymbol) { result.push(bindingElementPropertySymbol); } // If this is a union property, add all the symbols from all its source symbols in all unioned types. // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + for (var _i = 0, _a = checker.getRootSymbols(symbol); _i < _a.length; _i++) { + var rootSymbol = _a[_i]; if (rootSymbol !== symbol) { result.push(rootSymbol); } // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap()); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), checker); } - }); + } return result; } /** @@ -70185,7 +76013,7 @@ var ts; * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. * The value of previousIterationSymbol is undefined when the function is first called. */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache, checker) { if (!symbol) { return; } @@ -70200,7 +76028,7 @@ var ts; // the function will add any found symbol of the property-name, then its sub-routine will call // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (symbol.name in previousIterationSymbolsCache) { + if (previousIterationSymbolsCache.has(symbol.name)) { return; } if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { @@ -70209,7 +76037,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 229 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -70217,37 +76045,30 @@ var ts; return; function getPropertySymbolFromTypeReference(typeReference) { if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); + var type = checker.getTypeAtLocation(typeReference); if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + var propertySymbol = checker.getPropertyOfType(type, propertyName); if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); + result.push.apply(result, checker.getRootSymbols(propertySymbol)); } // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + previousIterationSymbolsCache.set(symbol.name, symbol); + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); } } } } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { - if (ts.contains(searchSymbols, referenceSymbol)) { - // If we are searching for constructor uses, they must be 'new' expressions. - return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) { + if (search.includes(referenceSymbol)) { + return referenceSymbol; } // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + var containingObjectLiteralElement = ts.getContainingObjectLiteralElement(referenceLocation); if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, state.checker), function (contextualSymbol) { + return ts.find(state.checker.getRootSymbols(contextualSymbol), search.includes); }); if (contextualSymbol) { return contextualSymbol; @@ -70256,23 +76077,23 @@ var ts; // Get the property symbol from the object literal's type and look if thats the search symbol // In below eg. get 'property' from type of elems iterating type // for ( { property: p2 } of elems) { } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, state.checker); + if (propertySymbol && search.includes(propertySymbol)) { return propertySymbol; } } // If the reference location is the binding element and doesn't have property name // then include the binding element in the related symbols // let { a } : { a }; - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, state.checker); + if (bindingElementPropertySymbol && search.includes(bindingElementPropertySymbol)) { return bindingElementPropertySymbol; } // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) // Or a union property, use its underlying unioned symbols - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + return ts.forEach(state.checker.getRootSymbols(referenceSymbol), function (rootSymbol) { // if it is in the list, then we are done - if (searchSymbols.indexOf(rootSymbol) >= 0) { + if (search.includes(rootSymbol)) { return rootSymbol; } // Finally, try all properties with the same name in any type the containing type extended or implemented, and @@ -70280,20 +76101,18 @@ var ts; // parent symbol if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { // Parents will only be defined if implementations is true - if (parents) { - if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { - return undefined; - } + if (search.parents && !ts.some(search.parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, state.checker); })) { + return undefined; } - var result_4 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_4, /*previousIterationSymbolsCache*/ ts.createMap()); - return ts.forEach(result_4, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap(), state.checker); + return ts.find(result, search.includes); } return undefined; }); } function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 142 /* ComputedPropertyName */) { + if (node.name.kind === 143 /* ComputedPropertyName */) { var nameExpression = node.name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteral(nameExpression)) { @@ -70303,15 +76122,16 @@ var ts; } return node.name.text; } - function getPropertySymbolsFromContextualType(node) { + /** Gets all symbols for one property. Does not get symbols for every property. */ + function getPropertySymbolsFromContextualType(node, checker) { var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); + var contextualType = checker.getContextualType(objectLiteral); var name = getNameFromObjectLiteralElement(node); if (name && contextualType) { var result_5 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_5.push(symbol_2); + var symbol = contextualType.getProperty(name); + if (symbol) { + result_5.push(symbol); } if (contextualType.flags & 65536 /* Union */) { ts.forEach(contextualType.types, function (t) { @@ -70325,13 +76145,14 @@ var ts; } return undefined; } - /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - * then we need to widen the search to include type positions as well. - * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - * do not intersect in any of the three spaces. - */ + /** + * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations + * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class + * then we need to widen the search to include type positions as well. + * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated + * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) + * do not intersect in any of the three spaces. + */ function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { var lastIterationMeaning = void 0; @@ -70342,8 +76163,8 @@ var ts; // To achieve that we will keep iterating until the result stabilizes. // Remember the last meaning lastIterationMeaning = meaning; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; var declarationMeaning = ts.getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -70353,143 +76174,93 @@ var ts; } return meaning; } - } - FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; - function convertReferences(referenceSymbols) { - if (!referenceSymbols) { - return undefined; - } - var referenceEntries = []; - for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { - var referenceSymbol = referenceSymbols_1[_i]; - ts.addRange(referenceEntries, referenceSymbol.references); - } - return referenceEntries; - } - FindAllReferences.convertReferences = convertReferences; - function isImplementation(node) { - if (!node) { - return false; - } - else if (ts.isVariableLike(node)) { - if (node.initializer) { - return true; - } - else if (node.kind === 223 /* VariableDeclaration */) { - var parentStatement = getParentStatementOfVariableDeclaration(node); - return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); + function isImplementation(node) { + if (!node) { + return false; } - } - else if (ts.isFunctionLike(node)) { - return !!node.body || ts.hasModifier(node, 2 /* Ambient */); - } - else { - switch (node.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + else if (ts.isVariableLike(node)) { + if (node.initializer) { return true; + } + else if (node.kind === 225 /* VariableDeclaration */) { + var parentStatement = getParentStatementOfVariableDeclaration(node); + return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); + } + } + else if (ts.isFunctionLike(node)) { + return !!node.body || ts.hasModifier(node, 2 /* Ambient */); + } + else { + switch (node.kind) { + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + return true; + } } + return false; } - return false; - } - function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205 /* VariableStatement */) { - ts.Debug.assert(node.parent.kind === 224 /* VariableDeclarationList */); - return node.parent.parent; + function getParentStatementOfVariableDeclaration(node) { + if (node.parent && node.parent.parent && node.parent.parent.kind === 207 /* VariableStatement */) { + ts.Debug.assert(node.parent.kind === 226 /* VariableDeclarationList */); + return node.parent.parent; + } } - } - function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) { - var refSymbol = typeChecker.getSymbolAtLocation(node); - var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); - if (shorthandSymbol) { - for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { - var declaration = _a[_i]; - if (ts.getMeaningFromDeclaration(declaration) & 1 /* Value */) { - result.push(getReferenceEntryFromNode(declaration)); + function getReferenceEntriesForShorthandPropertyAssignment(node, checker, addReference) { + var refSymbol = checker.getSymbolAtLocation(node); + var shorthandSymbol = checker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); + if (shorthandSymbol) { + for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.getMeaningFromDeclaration(declaration) & 1 /* Value */) { + addReference(declaration); + } } } } - } - FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; - function getReferenceEntryFromNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - if (node.kind === 9 /* StringLiteral */) { - start += 1; - end -= 1; + Core.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; + function forEachDescendantOfKind(node, kind, action) { + ts.forEachChild(node, function (child) { + if (child.kind === kind) { + action(child); + } + forEachDescendantOfKind(child, kind, action); + }); } - return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - isWriteAccess: isWriteAccess(node), - isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - }; - } - FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode; - /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ - function isWriteAccess(node) { - if (node.kind === 70 /* Identifier */ && ts.isDeclarationName(node)) { - return true; + /** Get `C` given `N` if `N` is in the position `class C extends N` or `class C extends foo.N` where `N` is an identifier. */ + function tryGetClassByExtendingIdentifier(node) { + return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); } - var parent = node.parent; - if (parent) { - if (parent.kind === 191 /* PostfixUnaryExpression */ || parent.kind === 190 /* PrefixUnaryExpression */) { - return true; - } - else if (parent.kind === 192 /* BinaryExpression */ && parent.left === node) { - var operator = parent.operatorToken.kind; - return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */; + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 9 /* StringLiteral */) { + return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } + return false; } - return false; - } - function forEachDescendantOfKind(node, kind, action) { - ts.forEachChild(node, function (child) { - if (child.kind === kind) { - action(child); + /** + * If we are just looking for implementations and this is a property access expression, we need to get the + * symbol of the local type of the symbol the property is being accessed on. This is because our search + * symbol may have a different parent symbol if the local type's symbol does not declare the property + * being accessed (i.e. it is declared in some parent class or interface) + */ + function getParentSymbolsOfPropertyAccess(location, symbol, checker) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location); + if (!propertyAccessExpression) { + return undefined; + } + var localParentType = checker.getTypeAtLocation(propertyAccessExpression.expression); + if (!localParentType) { + return undefined; + } + if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== symbol.parent) { + return [localParentType.symbol]; + } + else if (localParentType.flags & 196608 /* UnionOrIntersection */) { + return getSymbolsForClassAndInterfaceComponents(localParentType); } - forEachDescendantOfKind(child, kind, action); - }); - } - /** - * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } - */ - function getContainingObjectLiteralElement(node) { - switch (node.kind) { - case 9 /* StringLiteral */: - case 8 /* NumericLiteral */: - if (node.parent.kind === 142 /* ComputedPropertyName */) { - return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; - } - // intential fall through - case 70 /* Identifier */: - return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; - } - return undefined; - } - function isObjectLiteralPropertyDeclaration(node) { - switch (node.kind) { - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return true; - } - return false; - } - /** Get `C` given `N` if `N` is in the position `class C extends N` or `class C extends foo.N` where `N` is an identifier. */ - function tryGetClassByExtendingIdentifier(node) { - return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); - } - function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 9 /* StringLiteral */) { - return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); } - return false; - } + })(Core = FindAllReferences.Core || (FindAllReferences.Core = {})); })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); /* @internal */ @@ -70510,11 +76281,9 @@ var ts; // Type reference directives var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + var referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } var node = ts.getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -70524,7 +76293,7 @@ var ts; if (ts.isJumpStatementTarget(node)) { var labelName = node.text; var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -70550,7 +76319,7 @@ var ts; // if (node.kind === 70 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 239 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 238 /* NamedImports */))) { + (declaration.kind === 241 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 240 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -70559,7 +76328,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 261 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -70570,6 +76339,37 @@ var ts; var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } + if (ts.isJsxOpeningLikeElement(node.parent)) { + // If there are errors when trying to figure out stateless component function, just return the first declaration + // For example: + // declare function /*firstSource*/MainButton(buttonProps: ButtonProps): JSX.Element; + // declare function /*secondSource*/MainButton(linkProps: LinkProps): JSX.Element; + // declare function /*thirdSource*/MainButton(props: ButtonProps | LinkProps): JSX.Element; + // let opt =
; // Error - We get undefined for resolved signature indicating an error, then just return the first declaration + var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName; + return [createDefinitionInfo(symbol.valueDeclaration, symbolKind, symbolName, containerName)]; + } + // If the current location we want to find its definition is in an object literal, try to get the contextual type for the + // object literal, lookup the property symbol in the contextual type, and use this for goto-definition. + // For example + // interface Props{ + // /*first*/prop1: number + // prop2: boolean + // } + // function Foo(arg: Props) {} + // Foo( { pr/*1*/op1: 10, prop2: true }) + var element = ts.getContainingObjectLiteralElement(node); + if (element) { + if (typeChecker.getContextualType(element.parent)) { + var result = []; + var propertySymbols = ts.getPropertySymbolsFromContextualType(typeChecker, element); + for (var _i = 0, propertySymbols_1 = propertySymbols; _i < propertySymbols_1.length; _i++) { + var propertySymbol = propertySymbols_1[_i]; + result.push.apply(result, getDefinitionFromSymbol(typeChecker, propertySymbol, node)); + } + return result; + } + } return getDefinitionFromSymbol(typeChecker, symbol, node); } GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition; @@ -70639,31 +76439,47 @@ var ts; return false; } function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + if (!signatureDeclarations) { + return false; + } var declarations = []; var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 150 /* Constructor */) || - (!selectConstructors && (d.kind === 225 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { + for (var _i = 0, signatureDeclarations_1 = signatureDeclarations; _i < signatureDeclarations_1.length; _i++) { + var d = signatureDeclarations_1[_i]; + if (selectConstructors ? d.kind === 151 /* Constructor */ : isSignatureDeclaration(d)) { declarations.push(d); if (d.body) definition = d; } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + if (declarations.length) { + result.push(createDefinitionInfo(definition || ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } return false; } } + function isSignatureDeclaration(node) { + switch (node.kind) { + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + return true; + default: + return false; + } + } + /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */ function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + /** Creates a DefinitionInfo directly from the name of a declaration. */ + function createDefinitionInfoFromName(name, symbolKind, symbolName, containerName) { + var sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: ts.createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, @@ -70711,43 +76527,17 @@ var ts; } function tryGetSignatureDeclaration(typeChecker, node) { var callLike = getAncestorCallLikeExpression(node); - return callLike && typeChecker.getResolvedSignature(callLike).declaration; - } - })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); -})(ts || (ts = {})); -/* @internal */ -var ts; -(function (ts) { - var GoToImplementation; - (function (GoToImplementation) { - function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - // If invoked directly on a shorthand property assignment, then return - // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { - var result = []; - ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); - return result.length > 0 ? result : undefined; - } - else if (node.kind === 96 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) { - // References to and accesses on the super keyword only have one possible implementation, so no - // need to "Find all References" - var symbol = typeChecker.getSymbolAtLocation(node); - return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)]; - } - else { - // Perform "Find all References" and retrieve only those that are implementations - var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ true); - var result = ts.flatMap(referencedSymbols, function (symbol) { - return ts.map(symbol.references, function (_a) { - var textSpan = _a.textSpan, fileName = _a.fileName; - return ({ textSpan: textSpan, fileName: fileName }); - }); - }); - return result && result.length > 0 ? result : undefined; + var signature = callLike && typeChecker.getResolvedSignature(callLike); + if (signature) { + var decl = signature.declaration; + if (decl && isSignatureDeclaration(decl)) { + return decl; + } } + // Don't go to a function type, go to the value having that type. + return undefined; } - GoToImplementation.getImplementationAtPosition = getImplementationAtPosition; - })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {})); + })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); })(ts || (ts = {})); /* @internal */ var ts; @@ -70777,6 +76567,7 @@ var ts; "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -70795,7 +76586,8 @@ var ts; "prop", "version" ]; - var jsDocCompletionEntries; + var jsDocTagNameCompletionEntries; + var jsDocTagCompletionEntries; function getJsDocCommentsFromDeclarations(declarations) { // Only collect doc comments from duplicate declarations once: // In case of a union property there might be same declaration multiple times @@ -70822,6 +76614,30 @@ var ts; return documentationComment; } JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; + function getJsDocTagsFromDeclarations(declarations) { + // Only collect doc comments from duplicate declarations once. + var tags = []; + forEachUnique(declarations, function (declaration) { + var jsDocs = ts.getJSDocs(declaration); + if (!jsDocs) { + return; + } + for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) { + var doc = jsDocs_1[_i]; + var tagsForDoc = doc.tags; + if (tagsForDoc) { + tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 283 /* JSDocTag */; }).map(function (jsDocTag) { + return { + name: jsDocTag.tagName.text, + text: jsDocTag.comment + }; + })); + } + } + }); + return tags; + } + JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations; /** * Iterates through 'array' by index and performs the callback on each element of array until the callback * returns a truthy value, then returns that value. @@ -70829,7 +76645,7 @@ var ts; */ function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -70840,8 +76656,8 @@ var ts; } return undefined; } - function getAllJsDocCompletionEntries() { - return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + function getJSDocTagNameCompletions() { + return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: tagName, kind: ts.ScriptElementKind.keyword, @@ -70850,7 +76666,18 @@ var ts; }; })); } - JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries; + JsDoc.getJSDocTagNameCompletions = getJSDocTagNameCompletions; + function getJSDocTagCompletions() { + return jsDocTagCompletionEntries || (jsDocTagCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + return { + name: "@" + tagName, + kind: ts.ScriptElementKind.keyword, + kindModifiers: "", + sortText: "0" + }; + })); + } + JsDoc.getJSDocTagCompletions = getJSDocTagCompletions; /** * Checks if position points to a valid position to add JSDoc comments, and if so, * returns the appropriate template. Otherwise returns an empty string. @@ -70889,19 +76716,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: - case 226 /* ClassDeclaration */: - case 205 /* VariableStatement */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: + case 228 /* ClassDeclaration */: + case 207 /* VariableStatement */: break findOwner; - case 261 /* SourceFile */: + case 264 /* SourceFile */: return undefined; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 230 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 232 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -70913,14 +76740,21 @@ var ts; var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; - var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + // replace non-whitespace characters in prefix with spaces. + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character).replace(/\S/i, function () { return " "; }); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 /* Identifier */ ? currentName.text : "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } } // A doc comment consists of the following // * The opening comment line @@ -70942,7 +76776,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205 /* VariableStatement */) { + if (commentOwner.kind === 207 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -70960,17 +76794,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 183 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 184 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return rightHandSide.parameters; - case 197 /* ClassExpression */: + case 198 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 150 /* Constructor */) { + if (member.kind === 151 /* Constructor */) { return member.parameters; } } @@ -70990,8 +76824,6 @@ var ts; (function (ts) { var JsTyping; (function (JsTyping) { - ; - ; // A map of loose file names to library names // that we are confident require typings var safeList; @@ -71028,7 +76860,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; // Directories to search for package.json, bower.json and other typing information @@ -71047,41 +76879,43 @@ var ts; getTypingNamesFromJson(packageJsonPath, filesToWatch); var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var bowerComponentsPath = ts.combinePaths(searchDir, "bower_components"); + getTypingNamesFromPackagesFolder(bowerComponentsPath); var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromNodeModuleFolder(nodeModulesPath); + getTypingNamesFromPackagesFolder(nodeModulesPath); } getTypingNamesFromSourceFileNames(fileNames); // add typings for unresolved imports if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } // Add the cached typing locations for inferred typings that are already installed - for (var name_45 in packageNameToTypingLocation) { - if (name_45 in inferredTypings && !inferredTypings[name_45]) { - inferredTypings[name_45] = packageNameToTypingLocation[name_45]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); // Remove typings that the user has added to the exclude list for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; /** * Merge a given list of typingNames to the inferredTypings map @@ -71092,8 +76926,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -71132,7 +76966,7 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2 /* JSX */; }); if (hasJsxFile) { @@ -71140,20 +76974,22 @@ var ts; } } /** - * Infer typing names from node_module folder - * @param nodeModulesPath is the path to the "node_modules" folder + * Infer typing names from packages folder (ex: node_module, bower_components) + * @param packagesFolderPath is the path to the packages folder */ - function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + function getTypingNamesFromPackagesFolder(packagesFolderPath) { + filesToWatch.push(packagesFolderPath); // Todo: add support for ModuleResolutionHost too - if (!host.directoryExists(nodeModulesPath)) { + if (!host.directoryExists(packagesFolderPath)) { return; } var typingNames = []; - var fileNames = host.readDirectory(nodeModulesPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); + var fileNames = host.readDirectory(packagesFolderPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { var fileName = fileNames_2[_i]; var normalizedFileName = ts.normalizePath(fileName); - if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + var baseFileName = ts.getBaseFileName(normalizedFileName); + if (baseFileName !== "package.json" && baseFileName !== "bower.json") { continue; } var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); @@ -71164,7 +77000,7 @@ var ts; // npm 3's package.json contains a "_requiredBy" field // we should include all the top level module names for npm 2, and only module names whose // "_requiredBy" field starts with "#" or equals "/" for npm 3. - if (packageJson._requiredBy && + if (baseFileName === "package.json" && packageJson._requiredBy && ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { continue; } @@ -71175,7 +77011,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -71195,47 +77031,49 @@ var ts; function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - ts.forEach(sourceFiles, function (sourceFile) { + var _loop_4 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + return "continue"; } - var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_46 in nameToDeclarations) { - var declarations = nameToDeclarations[name_46]; + ts.forEachEntry(sourceFile.getNamedDeclarations(), function (declarations, name) { if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_46); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; // continue to next named declarations } - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) { + var declaration = declarations_12[_i]; // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { - return undefined; + return true; // Break out of named declarations and go to the next source file. } - matches = patternMatcher.getMatches(containers, name_46); + matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; // continue to next named declarations } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_46, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } - } - }); + }); + }; + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; + _loop_4(sourceFile); + } // Remove imports when the imported declaration is already in the list and has the same name. rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 /* ImportClause */ || decl.kind === 239 /* ImportSpecifier */ || decl.kind === 234 /* ImportEqualsDeclaration */) { + if (decl.kind === 238 /* ImportClause */ || decl.kind === 241 /* ImportSpecifier */ || decl.kind === 236 /* ImportEqualsDeclaration */) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -71277,7 +77115,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 142 /* ComputedPropertyName */) { + else if (declaration.name.kind === 143 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { @@ -71298,7 +77136,7 @@ var ts; } return true; } - if (expression.kind === 177 /* PropertyAccessExpression */) { + if (expression.kind === 178 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -71311,7 +77149,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } @@ -71357,7 +77195,7 @@ var ts; matchKind: ts.PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: ts.createTextSpanFromNode(declaration), // TODO(jfreeman): What should be the containerName when the container has a computed name? containerName: container && container.name ? container.name.text : "", containerKind: container && container.name ? ts.getNodeKind(container) : "" @@ -71373,22 +77211,61 @@ var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { - function getNavigationBarItems(sourceFile) { + /** + * Matches all whitespace characters in a string. Eg: + * + * "app. + * + * onactivated" + * + * matches because of the newline, whereas + * + * "app.onactivated" + * + * does not match. + */ + var whiteSpaceRegex = /\s+/g; + // Keep sourceFile handy so we don't have to search for it every time we need to call `getText`. + var curCancellationToken; + var curSourceFile; + /** + * For performance, we keep navigation bar parents on a stack rather than passing them through each recursion. + * `parent` is the current parent and is *not* stored in parentsStack. + * `startNode` sets a new parent and `endNode` returns to the previous parent. + */ + var parentsStack = []; + var parent; + // NavigationBarItem requires an array, but will not mutate it, so just give it this for performance. + var emptyChildItemArray = []; + function getNavigationBarItems(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); - curSourceFile = undefined; - return result; + try { + return ts.map(topLevelItems(rootNavigationBarNode(sourceFile)), convertToTopLevelItem); + } + finally { + reset(); + } } NavigationBar.getNavigationBarItems = getNavigationBarItems; - function getNavigationTree(sourceFile) { + function getNavigationTree(sourceFile, cancellationToken) { + curCancellationToken = cancellationToken; curSourceFile = sourceFile; - var result = convertToTree(rootNavigationBarNode(sourceFile)); - curSourceFile = undefined; - return result; + try { + return convertToTree(rootNavigationBarNode(sourceFile)); + } + finally { + reset(); + } } NavigationBar.getNavigationTree = getNavigationTree; - // Keep sourceFile handy so we don't have to search for it every time we need to call `getText`. - var curSourceFile; + function reset() { + curSourceFile = undefined; + curCancellationToken = undefined; + parentsStack = []; + parent = undefined; + emptyChildItemArray = []; + } function nodeText(node) { return node.getText(curSourceFile); } @@ -71403,13 +77280,6 @@ var ts; parent.children = [child]; } } - /* - For performance, we keep navigation bar parents on a stack rather than passing them through each recursion. - `parent` is the current parent and is *not* stored in parentsStack. - `startNode` sets a new parent and `endNode` returns to the previous parent. - */ - var parentsStack = []; - var parent; function rootNavigationBarNode(sourceFile) { ts.Debug.assert(!parentsStack.length); var root = { node: sourceFile, additionalNodes: undefined, parent: undefined, children: undefined, indent: 0 }; @@ -71460,11 +77330,12 @@ var ts; } /** Look for navigation bar items in node's subtree, adding them to the current `parent`. */ function addChildrenRecursively(node) { + curCancellationToken.throwIfCancellationRequested(); if (!node || ts.isToken(node)) { return; } switch (node.kind) { - case 150 /* Constructor */: + case 151 /* Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -71476,21 +77347,21 @@ var ts; } } break; - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 148 /* MethodSignature */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 149 /* MethodSignature */: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 236 /* ImportClause */: + case 238 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -71502,7 +77373,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 239 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -71513,12 +77384,12 @@ var ts; } } break; - case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: + case 175 /* BindingElement */: + case 225 /* VariableDeclaration */: var decl = node; - var name_47 = decl.name; - if (ts.isBindingPattern(name_47)) { - addChildrenRecursively(name_47); + var name = decl.name; + if (ts.isBindingPattern(name)) { + addChildrenRecursively(name); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -71528,12 +77399,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -71543,9 +77414,9 @@ var ts; } endNode(); break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -71553,21 +77424,21 @@ var ts; } endNode(); break; - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243 /* ExportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 155 /* IndexSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 228 /* TypeAliasDeclaration */: + case 245 /* ExportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 156 /* IndexSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 230 /* TypeAliasDeclaration */: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285 /* JSDocTypedefTag */) { + if (tag.kind === 289 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -71585,9 +77456,9 @@ var ts; // Anonymous items are never merged. return true; } - var itemsWithSameName = nameToItems[name]; + var itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } if (itemsWithSameName instanceof Array) { @@ -71605,7 +77476,7 @@ var ts; if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } function tryMerge(a, b) { @@ -71618,14 +77489,14 @@ var ts; }); /** a and b have the same name, but they may not be mergeable. */ function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 /* ModuleDeclaration */ || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 232 /* ModuleDeclaration */ || areSameModule(a, b)); // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230 /* ModuleDeclaration */) { + if (a.body.kind !== 232 /* ModuleDeclaration */) { return true; } return areSameModule(a.body, b.body); @@ -71653,39 +77524,20 @@ var ts; function compareChildren(child1, child2) { var name1 = tryGetName(child1.node), name2 = tryGetName(child2.node); if (name1 && name2) { - var cmp = localeCompareFix(name1, name2); + var cmp = ts.compareStringsCaseInsensitive(name1, name2); return cmp !== 0 ? cmp : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } else { return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". - var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { - // This isn't perfect, but it passes all of our tests. - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var chA = a.charAt(i), chB = b.charAt(i); - if (chA === "\"" && chB === "'") { - return 1; - } - if (chA === "'" && chB === "\"") { - return -1; - } - var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); - if (cmp !== 0) { - return cmp; - } - } - return a.length - b.length; - }; /** * This differs from getItemName because this is just used for sorting. * We only sort nodes by name that have a more-or-less "direct" name, as opposed to `new()` and the like. * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var decl = node; @@ -71693,18 +77545,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 197 /* ClassExpression */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 198 /* ClassExpression */: return getFunctionOrClassName(node); - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 232 /* ModuleDeclaration */) { return getModuleName(node); } var name = node.name; @@ -71715,16 +77567,16 @@ var ts; } } switch (node.kind) { - case 261 /* SourceFile */: + case 264 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -71732,15 +77584,15 @@ var ts; // (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the // navigation bar. return getFunctionOrClassName(node); - case 150 /* Constructor */: + case 151 /* Constructor */: return "constructor"; - case 154 /* ConstructSignature */: + case 155 /* ConstructSignature */: return "new()"; - case 153 /* CallSignature */: + case 154 /* CallSignature */: return "()"; - case 155 /* IndexSignature */: + case 156 /* IndexSignature */: return "[]"; - case 285 /* JSDocTypedefTag */: + case 289 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -71752,7 +77604,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 207 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -71781,24 +77633,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: - case 228 /* TypeAliasDeclaration */: - case 285 /* JSDocTypedefTag */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 231 /* EnumDeclaration */: + case 229 /* InterfaceDeclaration */: + case 232 /* ModuleDeclaration */: + case 264 /* SourceFile */: + case 230 /* TypeAliasDeclaration */: + case 289 /* JSDocTypedefTag */: return true; - case 150 /* Constructor */: - case 149 /* MethodDeclaration */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 223 /* VariableDeclaration */: + case 151 /* Constructor */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 225 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -71808,10 +77660,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: - case 149 /* MethodDeclaration */: - case 150 /* Constructor */: + case 233 /* ModuleBlock */: + case 264 /* SourceFile */: + case 150 /* MethodDeclaration */: + case 151 /* Constructor */: return true; default: return hasSomeImportantChild(item); @@ -71820,18 +77672,16 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; + return childKind !== 225 /* VariableDeclaration */ && childKind !== 175 /* BindingElement */; }); } } } - // NavigationBarItem requires an array, but will not mutate it, so just give it this for performance. - var emptyChildItemArray = []; function convertToTree(n) { return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToTree) }; @@ -71840,7 +77690,7 @@ var ts; return { text: getItemName(n.node), kind: ts.getNodeKind(n.node), - kindModifiers: ts.getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: ts.map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -71878,7 +77728,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 232 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -71889,28 +77739,34 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 230 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 232 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 142 /* ComputedPropertyName */; + return !member.name || member.name.kind === 143 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 261 /* SourceFile */ + return node.kind === 264 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : ts.createTextSpanFromNode(node, curSourceFile); + } + function getModifiers(node) { + if (node.parent && node.parent.kind === 225 /* VariableDeclaration */) { + node = node.parent; + } + return ts.getNodeModifiers(node); } function getFunctionOrClassName(node) { if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223 /* VariableDeclaration */) { + else if (node.parent.kind === 225 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 192 /* BinaryExpression */ && + else if (node.parent.kind === 193 /* BinaryExpression */ && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 260 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -71921,22 +77777,8 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */ || node.kind === 197 /* ClassExpression */; + return node.kind === 185 /* FunctionExpression */ || node.kind === 186 /* ArrowFunction */ || node.kind === 198 /* ClassExpression */; } - /** - * Matches all whitespace characters in a string. Eg: - * - * "app. - * - * onactivated" - * - * matches because of the newline, whereas - * - * "app.onactivated" - * - * does not match. - */ - var whiteSpaceRegex = /\s+/g; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); /* @internal */ @@ -71944,29 +77786,29 @@ var ts; (function (ts) { var OutliningElementsCollector; (function (OutliningElementsCollector) { - function collectElements(sourceFile) { + function collectElements(sourceFile, cancellationToken) { var elements = []; var collapseText = "..."; function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { if (hintSpanNode && startElement && endElement) { - var span_12 = { + var span_13 = { textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_12); + elements.push(span_13); } } function addOutliningSpanComments(commentSpan, autoCollapse) { if (commentSpan) { - var span_13 = { + var span_14 = { textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), bannerText: collapseText, autoCollapse: autoCollapse }; - elements.push(span_13); + elements.push(span_14); } } function addOutliningForLeadingCommentsForNode(n) { @@ -71978,6 +77820,7 @@ var ts; var singleLineCommentCount = 0; for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) { var currentComment = comments_4[_i]; + cancellationToken.throwIfCancellationRequested(); // For single line comments, combine consecutive ones (2 or more) into // a single span from the start of the first till the end of the last if (currentComment.kind === 2 /* SingleLineCommentTrivia */) { @@ -72003,19 +77846,20 @@ var ts; // Only outline spans of two or more consecutive single line comments if (count > 1) { var multipleSingleLineComments = { + kind: 2 /* SingleLineCommentTrivia */, pos: start, end: end, - kind: 2 /* SingleLineCommentTrivia */ }; addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false); } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 185 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 186 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; function walk(n) { + cancellationToken.throwIfCancellationRequested(); if (depth > maxDepth) { return; } @@ -72023,30 +77867,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204 /* Block */: + case 206 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_19.kind === 209 /* DoStatement */ || - parent_19.kind === 212 /* ForInStatement */ || - parent_19.kind === 213 /* ForOfStatement */ || - parent_19.kind === 211 /* ForStatement */ || - parent_19.kind === 208 /* IfStatement */ || - parent_19.kind === 210 /* WhileStatement */ || - parent_19.kind === 217 /* WithStatement */ || - parent_19.kind === 256 /* CatchClause */) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent.kind === 211 /* DoStatement */ || + parent.kind === 214 /* ForInStatement */ || + parent.kind === 215 /* ForOfStatement */ || + parent.kind === 213 /* ForStatement */ || + parent.kind === 210 /* IfStatement */ || + parent.kind === 212 /* WhileStatement */ || + parent.kind === 219 /* WithStatement */ || + parent.kind === 259 /* CatchClause */) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221 /* TryStatement */) { + if (parent.kind === 223 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_19; + var tryStatement = parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -72056,36 +77900,37 @@ var ts; break; } } + // fall through. } // Block was a standalone block. In this case we want to only collapse // the span of the block, independent of any parent span. - var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + var span_15 = ts.createTextSpanFromNode(n); elements.push({ - textSpan: span_14, - hintSpan: span_14, + textSpan: span_15, + hintSpan: span_15, bannerText: collapseText, autoCollapse: autoCollapse(n) }); break; } - // Fallthrough. - case 231 /* ModuleBlock */: { + // falls through + case 233 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 176 /* ObjectLiteralExpression */: - case 232 /* CaseBlock */: { + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 177 /* ObjectLiteralExpression */: + case 234 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -72181,10 +78026,11 @@ var ts; return totalMatch; } function getWordSpans(word) { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); + var spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); } - return stringToWordSpans[word]; + return spans; } function matchTextChunk(candidate, chunk, punctuationStripped) { var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); @@ -72212,10 +78058,10 @@ var ts; // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). var wordSpans = getWordSpans(candidate); for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span_15 = wordSpans_1[_i]; - if (partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ true)) { + var span_16 = wordSpans_1[_i]; + if (partStartsWith(candidate, span_16, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ false)); + /*isCaseSensitive:*/ partStartsWith(candidate, span_16, chunk.text, /*ignoreCase:*/ false)); } } } @@ -72465,7 +78311,8 @@ var ts; } // Assumes 'value' is already lowercase. function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -72474,7 +78321,7 @@ var ts; } // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -72546,7 +78393,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -72758,7 +78605,7 @@ var ts; else { if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; @@ -72789,7 +78636,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; @@ -72805,7 +78652,7 @@ var ts; token = nextToken(); if (token === 70 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" @@ -72835,7 +78682,7 @@ var ts; } if (token === 17 /* CloseBraceToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; @@ -72847,7 +78694,7 @@ var ts; } else if (token === 38 /* AsteriskToken */) { token = nextToken(); - if (token === 138 /* FromKeyword */) { + if (token === 139 /* FromKeyword */) { token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" @@ -72999,93 +78846,89 @@ var ts; var Rename; (function (Rename) { function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var getCanonicalDefaultLibName = ts.memoize(function () { return getCanonicalFileName(ts.normalizePath(defaultLibFileName)); }); var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); - if (node) { - if (node.kind === 70 /* Identifier */ || - node.kind === 9 /* StringLiteral */ || - ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - ts.isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9 /* StringLiteral */) { - var type = ts.getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ts.ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ts.ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } + var renameInfo = node && nodeIsEligibleForRename(node) + ? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) + : undefined; + return renameInfo || getRenameInfoError(ts.Diagnostics.You_cannot_rename_this_element); + function isDefinedInLibraryFile(declaration) { + if (!defaultLibFileName) { + return false; } + var sourceFile = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName)); + return canonicalName === getCanonicalDefaultLibName(); } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_1 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; + } + Rename.getRenameInfo = getRenameInfo; + function getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile) { + var symbol = typeChecker.getSymbolAtLocation(node); + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (ts.some(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); + } + // Cannot rename `default` as in `import { default as foo } from "./someModule"; + if (node.kind === 70 /* Identifier */ && + node.originalKeywordKind === 78 /* DefaultKeyword */ && + symbol.parent.flags & 1536 /* Module */) { + return undefined; } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, ts.SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined; } - return false; } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9 /* StringLiteral */) { - // Exclude the quotes - start += 1; - width -= 2; + else if (node.kind === 9 /* StringLiteral */) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } - return ts.createTextSpan(start, width); + var displayName = ts.stripQuotes(node.text); + return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); } } - Rename.getRenameInfo = getRenameInfo; + function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: fullDisplayName, + kindModifiers: kindModifiers, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + function getRenameInfoError(diagnostic) { + return { + canRename: false, + localizedErrorMessage: ts.getLocaleSpecificMessage(diagnostic), + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9 /* StringLiteral */) { + // Exclude the quotes + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + function nodeIsEligibleForRename(node) { + return node.kind === 70 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node); + } })(Rename = ts.Rename || (ts.Rename = {})); })(ts || (ts = {})); /// @@ -73140,7 +78983,7 @@ var ts; // stack++; // break; // case TypeScript.SyntaxKind.CommaToken: - // if (stack == 0) { + // if (stack === 0) { // argumentIndex++; // } // break; @@ -73232,6 +79075,7 @@ var ts; ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; + ArgumentListKind[ArgumentListKind["JSXAttributesArguments"] = 3] = "JSXAttributesArguments"; })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {})); function getSignatureHelpItems(program, sourceFile, position, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -73263,7 +79107,7 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 179 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 180 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -73271,7 +79115,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 70 /* Identifier */ ? expression - : expression.kind === 177 /* PropertyAccessExpression */ + : expression.kind === 178 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -73281,10 +79125,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameToDeclarations = sourceFile.getNamedDeclarations(); - var declarations = nameToDeclarations[name.text]; + var declarations = nameToDeclarations.get(name.text); if (declarations) { - for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { - var declaration = declarations_10[_b]; + for (var _b = 0, declarations_13 = declarations; _b < declarations_13.length; _b++) { + var declaration = declarations_13[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -73304,21 +79148,21 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 180 /* CallExpression */ || node.parent.kind === 181 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: - // 1. The token introduces a list, and should begin a sig help session + // 1. The token introduces a list, and should begin a signature help session // 2. The token is either not associated with a list, or ends a list, so the session should end - // 3. The token is buried inside a list, and should give sig help + // 3. The token is buried inside a list, and should give signature help // // The following are examples of each: // // Case 1: - // foo<#T, U>(#a, b) -> The token introduces a list, and should begin a sig help session + // foo<#T, U>(#a, b) -> The token introduces a list, and should begin a signature help session // Case 2: // fo#o#(a, b)# -> The token is either not associated with a list, or ends a list, so the session should end // Case 3: - // foo(a#, #b#) -> The token is buried inside a list, and should give sig help + // foo(a#, #b#) -> The token is buried inside a list, and should give signature help // Find out if 'node' is an argument, a type argument, or neither if (node.kind === 26 /* LessThanToken */ || node.kind === 18 /* OpenParenToken */) { @@ -73337,7 +79181,7 @@ var ts; } // findListItemInfo can return undefined if we are not in parent's argument list // or type argument list. This includes cases where the cursor is: - // - To the right of the closing paren, non-substitution template, or template tail. + // - To the right of the closing parenthesis, non-substitution template, or template tail. // - Between the type arguments and the arguments (greater than token) // - On the target of the call (parent.func) // - On the 'new' keyword in a 'new' expression @@ -73358,25 +79202,25 @@ var ts; } return undefined; } - else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 182 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 204 /* TemplateSpan */ && node.parent.parent.parent.kind === 182 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 195 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -73385,8 +79229,25 @@ var ts; var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node, position); return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } + else if (node.parent && ts.isJsxOpeningLikeElement(node.parent)) { + // Provide a signature help for JSX opening element or JSX self-closing element. + // This is not guarantee that JSX tag-name is resolved into stateless function component. (that is done in "getSignatureHelpItems") + // i.e + // export function MainButton(props: ButtonProps, context: any): JSX.Element { ... } + // ' '' - // That will give us 2 non-commas. We then add one for the last comma, givin us an + // That will give us 2 non-commas. We then add one for the last comma, giving us an // arg count of 3. var listChildren = argumentsList.getChildren(); var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 25 /* CommaToken */; }); @@ -73494,7 +79355,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 194 /* TemplateExpression */) { + if (template.kind === 195 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -73503,7 +79364,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 264 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -73516,6 +79377,7 @@ var ts; if (argumentInfo) { return argumentInfo; } + // TODO: Handle generic call with incomplete syntax } return undefined; } @@ -73596,7 +79458,8 @@ var ts; suffixDisplayParts: suffixDisplayParts, separatorDisplayParts: [ts.punctuationPart(25 /* CommaToken */), ts.spacePart()], parameters: signatureHelpParameters, - documentation: candidateSignature.getDocumentationComment() + documentation: candidateSignature.getDocumentationComment(), + tags: candidateSignature.getJsDocTags() }; }); var argumentIndex = argumentListInfo.argumentIndex; @@ -73646,9 +79509,9 @@ var ts; (function (SymbolDisplay) { // TODO(drosen): use contextual SemanticMeaning. function getSymbolKind(typeChecker, symbol, location) { - var flags = symbol.getFlags(); + var flags = symbol.flags; if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 198 /* ClassExpression */) ? ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ts.ScriptElementKind.enumElement; @@ -73658,12 +79521,12 @@ var ts; return ts.ScriptElementKind.interfaceElement; if (flags & 262144 /* TypeParameter */) return ts.ScriptElementKind.typeParameterElement; - var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location); + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); if (result === ts.ScriptElementKind.unknown) { if (flags & 262144 /* TypeParameter */) return ts.ScriptElementKind.typeParameterElement; if (flags & 8 /* EnumMember */) - return ts.ScriptElementKind.variableElement; + return ts.ScriptElementKind.enumMemberElement; if (flags & 8388608 /* Alias */) return ts.ScriptElementKind.alias; if (flags & 1536 /* Module */) @@ -73672,7 +79535,7 @@ var ts; return result; } SymbolDisplay.getSymbolKind = getSymbolKind; - function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) { + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) { if (typeChecker.isUndefinedSymbol(symbol)) { return ts.ScriptElementKind.variableElement; } @@ -73682,6 +79545,7 @@ var ts; if (location.kind === 98 /* ThisKeyword */ && ts.isExpression(location)) { return ts.ScriptElementKind.parameterElement; } + var flags = symbol.flags; if (flags & 3 /* Variable */) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ts.ScriptElementKind.parameterElement; @@ -73705,7 +79569,7 @@ var ts; if (flags & 16384 /* Constructor */) return ts.ScriptElementKind.constructorImplementationElement; if (flags & 4 /* Property */) { - if (flags & 268435456 /* SyntheticProperty */) { + if (flags & 134217728 /* Transient */ && symbol.checkFlags & 6 /* Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); @@ -73725,6 +79589,9 @@ var ts; } return unionPropertyKind; } + if (location.parent && ts.isJsxAttribute(location.parent)) { + return ts.ScriptElementKind.jsxAttribute; + } return ts.ScriptElementKind.memberVariableElement; } return ts.ScriptElementKind.unknown; @@ -73740,8 +79607,9 @@ var ts; if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); } var displayParts = []; var documentation; + var tags; var symbolFlags = symbol.flags; - var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location); + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); var hasAddedSymbolInfo; var isThisExpression = location.kind === 98 /* ThisKeyword */ && ts.isExpression(location); var type; @@ -73754,7 +79622,7 @@ var ts; var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 177 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 178 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -73762,21 +79630,24 @@ var ts; } } // try get the call/construct signature from the type if it matches - var callExpression = void 0; - if (location.kind === 179 /* CallExpression */ || location.kind === 180 /* NewExpression */) { - callExpression = location; + var callExpressionLike = void 0; + if (location.kind === 180 /* CallExpression */ || location.kind === 181 /* NewExpression */) { + callExpressionLike = location; } else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { - callExpression = location.parent; + callExpressionLike = location.parent; + } + else if (location.parent && ts.isJsxOpeningLikeElement(location.parent) && ts.isFunctionLike(symbol.valueDeclaration)) { + callExpressionLike = location.parent; } - if (callExpression) { + if (callExpressionLike) { var candidateSignatures = []; - signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures); + signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); if (!signature && candidateSignatures.length) { // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 180 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */; + var useConstructSignatures = callExpressionLike.kind === 181 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 96 /* SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -73803,6 +79674,7 @@ var ts; addPrefixForAnyFunctionOrVar(symbol, symbolKind); } switch (symbolKind) { + case ts.ScriptElementKind.jsxAttribute: case ts.ScriptElementKind.memberVariableElement: case ts.ScriptElementKind.variableElement: case ts.ScriptElementKind.constElement: @@ -73829,24 +79701,24 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) { + (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 151 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration.kind === 151 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 150 /* Constructor */) { + if (functionDeclaration.kind === 151 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ts.ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 154 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -73855,7 +79727,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 198 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -73878,7 +79750,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -73899,7 +79771,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 232 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -73920,28 +79792,28 @@ var ts; } else { // Method/function type parameter - var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */); + var declaration = ts.getDeclarationOfKind(symbol, 144 /* TypeParameter */); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 154 /* ConstructSignature */) { + if (declaration.kind === 155 /* ConstructSignature */) { displayParts.push(ts.keywordPart(93 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) { + else if (declaration.kind !== 154 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 228 /* TypeAliasDeclaration */) { + else if (declaration.kind === 230 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(137 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -73950,9 +79822,10 @@ var ts; } } if (symbolFlags & 8 /* EnumMember */) { + symbolKind = ts.ScriptElementKind.enumMemberElement; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260 /* EnumMember */) { + if (declaration.kind === 263 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -73964,7 +79837,7 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233 /* NamespaceExportDeclaration */) { + if (symbol.declarations[0].kind === 235 /* NamespaceExportDeclaration */) { displayParts.push(ts.keywordPart(83 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */)); @@ -73975,7 +79848,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234 /* ImportEqualsDeclaration */) { + if (declaration.kind === 236 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -74011,6 +79884,7 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === ts.ScriptElementKind.memberVariableElement || + symbolKind === ts.ScriptElementKind.jsxAttribute || symbolFlags & 3 /* Variable */ || symbolKind === ts.ScriptElementKind.localVariableElement || isThisExpression) { @@ -74044,14 +79918,15 @@ var ts; } if (!documentation) { documentation = symbol.getDocumentationComment(); + tags = symbol.getJsDocTags(); if (documentation.length === 0 && symbol.flags & 4 /* Property */) { - // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` + // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 264 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 193 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -74059,6 +79934,7 @@ var ts; continue; } documentation = rhsSymbol.getDocumentationComment(); + tags = rhsSymbol.getJsDocTags(); if (documentation.length > 0) { break; } @@ -74066,7 +79942,7 @@ var ts; } } } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -74117,6 +79993,7 @@ var ts; displayParts.push(ts.punctuationPart(19 /* CloseParenToken */)); } documentation = signature.getDocumentationComment(); + tags = signature.getJsDocTags(); } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { @@ -74132,16 +80009,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 184 /* FunctionExpression */) { + if (declaration.kind === 185 /* FunctionExpression */) { return true; } - if (declaration.kind !== 223 /* VariableDeclaration */ && declaration.kind !== 225 /* FunctionDeclaration */) { + if (declaration.kind !== 225 /* VariableDeclaration */ && declaration.kind !== 227 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) { + if (parent.kind === 264 /* SourceFile */ || parent.kind === 233 /* ModuleBlock */) { return false; } } @@ -74194,7 +80071,7 @@ var ts; sourceFile.moduleName = transpileOptions.moduleName; } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = ts.createMapFromTemplate(transpileOptions.renamedDependencies); } var newLine = ts.getNewLineCharacter(options); // Output @@ -74246,13 +80123,14 @@ var ts; ts.transpile = transpile; var commandLineOptionsStringToEnum; /** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */ + /*@internal*/ function fixupCompilerOptions(options, diagnostics) { // Lazily create this value to fix module loading errors. commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); options = ts.clone(options); - var _loop_4 = function (opt) { + var _loop_5 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -74263,7 +80141,7 @@ var ts; options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + if (!ts.forEachEntry(opt.type, function (v) { return v === value; })) { // Supplied value isn't a valid enum value. diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } @@ -74271,10 +80149,11 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_4(opt); + _loop_5(opt); } return options; } + ts.fixupCompilerOptions = fixupCompilerOptions; })(ts || (ts = {})); /// /// @@ -74298,10 +80177,10 @@ var ts; ScanAction[ScanAction["RescanJsxIdentifier"] = 4] = "RescanJsxIdentifier"; ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText"; })(ScanAction || (ScanAction = {})); - function getFormattingScanner(sourceFile, startPos, endPos) { + function getFormattingScanner(text, languageVariant, startPos, endPos) { ts.Debug.assert(scanner === undefined, "Scanner should be undefined"); - scanner = sourceFile.languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; - scanner.setText(sourceFile.text); + scanner = languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; + scanner.setText(text); scanner.setTextPos(startPos); var wasNewLine = true; var leadingTrivia; @@ -74379,10 +80258,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 250 /* JsxAttribute */: - case 248 /* JsxOpeningElement */: - case 249 /* JsxClosingElement */: - case 247 /* JsxSelfClosingElement */: + case 252 /* JsxAttribute */: + case 250 /* JsxOpeningElement */: + case 251 /* JsxClosingElement */: + case 249 /* JsxSelfClosingElement */: return node.kind === 70 /* Identifier */; } } @@ -74503,8 +80382,8 @@ var ts; } function isOnToken() { ts.Debug.assert(scanner !== undefined); - var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken(); + var startPos = lastTokenInfo ? lastTokenInfo.token.pos : scanner.getStartPos(); return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current); } // when containing node in the tree is token @@ -74794,11 +80673,11 @@ var ts; this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 141 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space for dot this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -74815,10 +80694,10 @@ var ts; this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 80 /* DoKeyword */, 101 /* TryKeyword */, 86 /* FinallyKeyword */, 81 /* ElseKeyword */]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); @@ -74848,6 +80727,7 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109 /* LetKeyword */, 75 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95 /* ReturnKeyword */, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -74858,18 +80738,19 @@ var ts; this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 134 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 134 /* SetKeyword */, 114 /* StaticKeyword */, 137 /* TypeKeyword */, 139 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 139 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions @@ -74889,7 +80770,7 @@ var ts; // decorators this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 134 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); @@ -74905,6 +80786,8 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* SlashToken */, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57 /* EqualsToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57 /* EqualsToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + // No space before non-null assertion operator + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50 /* ExclamationToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -74935,7 +80818,7 @@ var ts; this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -74950,6 +80833,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; // These rules are lower in priority than user-configurable rules. this.LowPriorityCommonRules = [ @@ -74959,7 +80843,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; /// @@ -75017,9 +80900,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_48 in o) { - if (o[name_48] === rule) { - return name_48; + for (var name in o) { + if (o[name] === rule) { + return name; } } throw new Error("Unknown rule"); @@ -75028,42 +80911,44 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 211 /* ForStatement */; + return context.contextNode.kind === 213 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 192 /* BinaryExpression */: - case 193 /* ConditionalExpression */: - case 200 /* AsExpression */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: - case 156 /* TypePredicate */: - case 164 /* UnionType */: - case 165 /* IntersectionType */: + case 193 /* BinaryExpression */: + case 194 /* ConditionalExpression */: + case 201 /* AsExpression */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 157 /* TypePredicate */: + case 165 /* UnionType */: + case 166 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 174 /* BindingElement */: + case 175 /* BindingElement */: // equals in type X = ... - case 228 /* TypeAliasDeclaration */: + case 230 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 223 /* VariableDeclaration */: + case 225 /* VariableDeclaration */: // equal in p = 0; - case 144 /* Parameter */: - case 260 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 145 /* Parameter */: + case 263 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: + // "in" keyword in [P in keyof T]: T[P] + case 144 /* TypeParameter */: return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 213 /* ForOfStatement */: - return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */; + case 215 /* ForOfStatement */: + return context.currentTokenSpan.kind === 141 /* OfKeyword */ || context.nextTokenSpan.kind === 141 /* OfKeyword */; } return false; }; @@ -75071,7 +80956,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 193 /* ConditionalExpression */; + return context.contextNode.kind === 194 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -75092,6 +80977,9 @@ var ts; //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 173 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); + }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -75115,97 +81003,103 @@ var ts; return true; } switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: - case 176 /* ObjectLiteralExpression */: - case 231 /* ModuleBlock */: + case 206 /* Block */: + case 234 /* CaseBlock */: + case 177 /* ObjectLiteralExpression */: + case 233 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: // case SyntaxKind.MethodSignature: - case 153 /* CallSignature */: - case 184 /* FunctionExpression */: - case 150 /* Constructor */: - case 185 /* ArrowFunction */: + case 154 /* CallSignature */: + case 185 /* FunctionExpression */: + case 151 /* Constructor */: + case 186 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 227 /* InterfaceDeclaration */: + case 229 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; + return context.contextNode.kind === 227 /* FunctionDeclaration */ || context.contextNode.kind === 185 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 161 /* TypeLiteral */: - case 230 /* ModuleDeclaration */: - case 241 /* ExportDeclaration */: - case 242 /* NamedExports */: - case 235 /* ImportDeclaration */: - case 238 /* NamedImports */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 162 /* TypeLiteral */: + case 232 /* ModuleDeclaration */: + case 243 /* ExportDeclaration */: + case 244 /* NamedExports */: + case 237 /* ImportDeclaration */: + case 240 /* NamedImports */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226 /* ClassDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 204 /* Block */: - case 256 /* CatchClause */: - case 231 /* ModuleBlock */: - case 218 /* SwitchStatement */: + case 228 /* ClassDeclaration */: + case 232 /* ModuleDeclaration */: + case 231 /* EnumDeclaration */: + case 259 /* CatchClause */: + case 233 /* ModuleBlock */: + case 220 /* SwitchStatement */: return true; + case 206 /* Block */: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 186 /* ArrowFunction */ && + blockParent.kind !== 185 /* FunctionExpression */) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208 /* IfStatement */: - case 218 /* SwitchStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 221 /* TryStatement */: - case 209 /* DoStatement */: - case 217 /* WithStatement */: + case 210 /* IfStatement */: + case 220 /* SwitchStatement */: + case 213 /* ForStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 212 /* WhileStatement */: + case 223 /* TryStatement */: + case 211 /* DoStatement */: + case 219 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 256 /* CatchClause */: + case 259 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 176 /* ObjectLiteralExpression */; + return context.contextNode.kind === 177 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 179 /* CallExpression */; + return context.contextNode.kind === 180 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 180 /* NewExpression */; + return context.contextNode.kind === 181 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -75217,25 +81111,25 @@ var ts; return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 185 /* ArrowFunction */; + return context.contextNode.kind === 186 /* ArrowFunction */; }; Rules.IsNonJsxSameLineTokenContext = function (context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246 /* JsxElement */; + return context.contextNode.kind !== 248 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252 /* JsxExpression */; + return context.contextNode.kind === 255 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250 /* JsxAttribute */; + return context.nextTokenParent.kind === 252 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250 /* JsxAttribute */; + return context.contextNode.kind === 252 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247 /* JsxSelfClosingElement */; + return context.contextNode.kind === 249 /* JsxSelfClosingElement */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -75250,41 +81144,42 @@ var ts; while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 145 /* Decorator */; + return node.kind === 146 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 226 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230 /* ModuleDeclaration */; + return context.contextNode.kind === 232 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 162 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 157 /* TypeReference */: - case 182 /* TypeAssertionExpression */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 199 /* ExpressionWithTypeArguments */: + case 158 /* TypeReference */: + case 183 /* TypeAssertionExpression */: + case 230 /* TypeAliasDeclaration */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 200 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -75295,13 +81190,16 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 182 /* TypeAssertionExpression */; + return context.contextNode.kind === 183 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 188 /* VoidExpression */; + return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 189 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 196 /* YieldExpression */ && context.contextNode.expression !== undefined; + }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 202 /* NonNullExpression */; }; return Rules; }()); @@ -75325,7 +81223,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 140 /* LastToken */ + 1; + this.mapRowLength = 141 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); // new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); // new Array(this.map.length); @@ -75339,7 +81237,7 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { - ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 141 /* LastKeyword */ && column <= 141 /* LastKeyword */, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; return rulesBucketIndex; }; @@ -75520,7 +81418,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 141 /* LastToken */; token++) { result.push(token); } return result; @@ -75564,9 +81462,9 @@ var ts; }()); TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 141 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 141 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); @@ -75574,7 +81472,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 135 /* StringKeyword */, 121 /* BooleanKeyword */, 136 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -75610,6 +81508,9 @@ var ts; RulesProvider.prototype.getRulesMap = function () { return this.rulesMap; }; + RulesProvider.prototype.getFormatOptions = function () { + return this.options; + }; RulesProvider.prototype.ensureUpToDate = function (options) { if (!this.options || !ts.compareDataObjects(this.options, options)) { var activeRules = this.createActiveRules(options); @@ -75621,6 +81522,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -75701,6 +81608,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -75833,17 +81746,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 228 /* ClassDeclaration */: + case 229 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 231 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 261 /* SourceFile */: - case 204 /* Block */: - case 231 /* ModuleBlock */: + return body && body.kind === 233 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 264 /* SourceFile */: + case 206 /* Block */: + case 233 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -75863,9 +81776,9 @@ var ts; } } /** formatting is not applied to ranges that contain parse errors. - * This function will return a predicate that for a given text range will tell - * if there are any parse errors that overlap with the range. - */ + * This function will return a predicate that for a given text range will tell + * if there are any parse errors that overlap with the range. + */ function prepareRangeContainsErrorFunction(errors, originalRange) { if (!errors.length) { return rangeHasNoErrors; @@ -75903,10 +81816,10 @@ var ts; } } /** - * Start of the original range might fall inside the comment - scanner will not yield appropriate results - * This function will look for token that is located before the start of target range - * and return its end as start position for the scanner. - */ + * Start of the original range might fall inside the comment - scanner will not yield appropriate results + * This function will look for token that is located before the start of target range + * and return its end as start position for the scanner. + */ function getScanStartPosition(enclosingNode, originalRange, sourceFile) { var start = enclosingNode.getStart(sourceFile); if (start === originalRange.pos && enclosingNode.end === originalRange.end) { @@ -75956,14 +81869,21 @@ var ts; } return 0; } + /* @internal */ + function formatNode(node, sourceFileLike, languageVariant, initialIndentation, delta, rulesProvider) { + var range = { pos: 0, end: sourceFileLike.text.length }; + return formatSpanWorker(range, node, initialIndentation, delta, formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end), rulesProvider.getFormatOptions(), rulesProvider, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors + sourceFileLike); + } + formatting.formatNode = formatNode; function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { - var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); - // formatting context is used by rules provider - var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); // find the smallest node that fully wraps the range and compute the initial indentation for the node var enclosingNode = findEnclosingNode(originalRange, sourceFile); - var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); - var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options), getOwnOrInheritedDelta(enclosingNode, options, sourceFile), formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end), options, rulesProvider, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); + } + function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, options, rulesProvider, requestKind, rangeContainsError, sourceFile) { + // formatting context is used by rules provider + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); var previousRangeHasError; var previousRange; var previousParent; @@ -75978,13 +81898,12 @@ var ts; if (enclosingNode.decorators) { undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(ts.getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line; } - var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } if (!formattingScanner.isOnToken()) { var leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); if (leadingTrivia) { - processTrivia(leadingTrivia, enclosingNode, enclosingNode, undefined); + processTrivia(leadingTrivia, enclosingNode, enclosingNode, /*dynamicIndentation*/ undefined); trimTrailingWhitespacesForRemainingRange(); } } @@ -75992,12 +81911,12 @@ var ts; return edits; // local functions /** Tries to compute the indentation for a list element. - * If list element is not in range then - * function will pick its actual indentation - * so it can be pushed downstream as inherited indentation. - * If list element is in the range - its indentation will be equal - * to inherited indentation from its predecessors. - */ + * If list element is not in range then + * function will pick its actual indentation + * so it can be pushed downstream as inherited indentation. + * If list element is in the range - its indentation will be equal + * to inherited indentation from its predecessors. + */ function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) || ts.rangeContainsStartEnd(range, startPos, endPos) /* Not to miss zero-range nodes e.g. JsxText */) { @@ -76048,20 +81967,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226 /* ClassDeclaration */: return 74 /* ClassKeyword */; - case 227 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; - case 225 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; - case 229 /* EnumDeclaration */: return 229 /* EnumDeclaration */; - case 151 /* GetAccessor */: return 124 /* GetKeyword */; - case 152 /* SetAccessor */: return 133 /* SetKeyword */; - case 149 /* MethodDeclaration */: + case 228 /* ClassDeclaration */: return 74 /* ClassKeyword */; + case 229 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; + case 227 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; + case 231 /* EnumDeclaration */: return 231 /* EnumDeclaration */; + case 152 /* GetAccessor */: return 124 /* GetKeyword */; + case 153 /* SetAccessor */: return 134 /* SetKeyword */; + case 150 /* MethodDeclaration */: if (node.asteriskToken) { return 38 /* AsteriskToken */; - } /* - fall-through - */ - case 147 /* PropertyDeclaration */: - case 144 /* Parameter */: + } + // falls through + case 148 /* PropertyDeclaration */: + case 145 /* Parameter */: return node.name.kind; } } @@ -76091,18 +82009,31 @@ var ts; // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent case 16 /* OpenBraceToken */: case 17 /* CloseBraceToken */: - case 20 /* OpenBracketToken */: - case 21 /* CloseBracketToken */: case 18 /* OpenParenToken */: case 19 /* CloseParenToken */: case 81 /* ElseKeyword */: case 105 /* WhileKeyword */: case 56 /* AtToken */: return indentation; - default: - // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40 /* SlashToken */: + case 28 /* GreaterThanToken */: { + if (container.kind === 250 /* JsxOpeningElement */ || + container.kind === 251 /* JsxClosingElement */ || + container.kind === 249 /* JsxSelfClosingElement */) { + return indentation; + } + break; + } + case 20 /* OpenBracketToken */: + case 21 /* CloseBracketToken */: { + if (container.kind !== 171 /* MappedType */) { + return indentation; + } + break; + } } + // if token line equals to the line of containing node (this is a first token in the node) - use node indentation + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -76125,7 +82056,7 @@ var ts; }; function getEffectiveDelta(delta, child) { // Delta value should be zero when the node explicitly prevents indentation of the child node - return formatting.SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; + return formatting.SmartIndenter.nodeWillIndentChild(node, child, /*indentByDefault*/ true) ? delta : 0; } } function processNode(node, contextNode, nodeStartLine, undecoratedNodeStartLine, indentation, delta) { @@ -76158,7 +82089,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -76192,7 +82123,7 @@ var ts; // stop when formatting scanner advances past the beginning of the child break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -76205,11 +82136,11 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 146 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 175 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 176 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -76232,11 +82163,11 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { // consume any tokens that precede the list as child elements of 'node' using its indentation scope - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -76254,7 +82185,7 @@ var ts; // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { // consume list end token - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -76461,7 +82392,7 @@ var ts; } // shift all parts on the delta size var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -76566,12 +82497,12 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 185 /* ArrowFunction */: + case 151 /* Constructor */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 186 /* ArrowFunction */: if (node.typeParameters === list) { return 26 /* LessThanToken */; } @@ -76579,8 +82510,8 @@ var ts; return 18 /* OpenParenToken */; } break; - case 179 /* CallExpression */: - case 180 /* NewExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -76588,7 +82519,7 @@ var ts; return 18 /* OpenParenToken */; } break; - case 157 /* TypeReference */: + case 158 /* TypeReference */: if (node.typeArguments === list) { return 26 /* LessThanToken */; } @@ -76668,7 +82599,20 @@ var ts; (function (Value) { Value[Value["Unknown"] = -1] = "Unknown"; })(Value || (Value = {})); - function getIndentation(position, sourceFile, options) { + /** + * Computed indentation for a given position in source file + * @param position - position in file + * @param sourceFile - target source file + * @param options - set of editor options that control indentation + * @param assumeNewLineBeforeCloseBrace - false when getIndentation is called on the text from the real source file. + * true - when we need to assume that position is on the newline. This is usefult for codefixes, i.e. + * function f() { + * |} + * when inserting some text after open brace we would like to get the value of indentation as if newline was already there. + * However by default indentation at position | will be 0 so 'assumeNewLineBeforeCloseBrace' allows to override this behavior, + */ + function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { + if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } if (position > sourceFile.text.length) { return getBaseIndentation(options); // past EOF } @@ -76704,7 +82648,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 192 /* BinaryExpression */) { + if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 193 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -76720,8 +82664,10 @@ var ts; while (current) { if (ts.positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); - if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { - indentationDelta = 0; + var nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile); + if (nextTokenKind !== 0 /* Unknown */) { + // handle cases when codefix is about to be inserted before the close brace + indentationDelta = assumeNewLineBeforeCloseBrace && nextTokenKind === 2 /* CloseBrace */ ? options.indentSize : 0; } else { indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0; @@ -76827,20 +82773,26 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 264 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); } + var NextTokenKind; + (function (NextTokenKind) { + NextTokenKind[NextTokenKind["Unknown"] = 0] = "Unknown"; + NextTokenKind[NextTokenKind["OpenBrace"] = 1] = "OpenBrace"; + NextTokenKind[NextTokenKind["CloseBrace"] = 2] = "CloseBrace"; + })(NextTokenKind || (NextTokenKind = {})); function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { var nextToken = ts.findNextToken(precedingToken, current); if (!nextToken) { - return false; + return 0 /* Unknown */; } if (nextToken.kind === 16 /* OpenBraceToken */) { // open braces are always indented at the parent level - return true; + return 1 /* OpenBrace */; } else if (nextToken.kind === 17 /* CloseBraceToken */) { // close braces are indented at the parent level if they are located on the same line with cursor @@ -76852,15 +82804,15 @@ var ts; // class A { // $} var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; - return lineAtPosition === nextTokenStartLine; + return lineAtPosition === nextTokenStartLine ? 2 /* CloseBrace */ : 0 /* Unknown */; } - return false; + return 0 /* Unknown */; } function getStartLineAndCharacterForNode(n, sourceFile) { return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 210 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -76869,53 +82821,49 @@ var ts; return false; } SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getListIfStartEndIsInListRange(list, start, end) { + return list && ts.rangeContainsStartEnd(list, start, end) ? list : undefined; + } function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 157 /* TypeReference */: - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { - return node.parent.typeArguments; - } - break; - case 176 /* ObjectLiteralExpression */: + case 158 /* TypeReference */: + return getListIfStartEndIsInListRange(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd()); + case 177 /* ObjectLiteralExpression */: return node.parent.properties; - case 175 /* ArrayLiteralExpression */: + case 176 /* ArrayLiteralExpression */: return node.parent.elements; - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: { + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 151 /* Constructor */: + case 160 /* ConstructorType */: + case 155 /* ConstructSignature */: { var start = node.getStart(sourceFile); - if (node.parent.typeParameters && - ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; - } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeParameters, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.parameters, start, node.getEnd()); } - case 180 /* NewExpression */: - case 179 /* CallExpression */: { + case 228 /* ClassDeclaration */: + return getListIfStartEndIsInListRange(node.parent.typeParameters, node.getStart(sourceFile), node.getEnd()); + case 181 /* NewExpression */: + case 180 /* CallExpression */: { var start = node.getStart(sourceFile); - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { - return node.parent.typeArguments; - } - if (node.parent.arguments && - ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { - return node.parent.arguments; - } - break; + return getListIfStartEndIsInListRange(node.parent.typeArguments, start, node.getEnd()) || + getListIfStartEndIsInListRange(node.parent.arguments, start, node.getEnd()); } + case 226 /* VariableDeclarationList */: + return getListIfStartEndIsInListRange(node.parent.declarations, node.getStart(sourceFile), node.getEnd()); + case 240 /* NamedImports */: + case 244 /* NamedExports */: + return getListIfStartEndIsInListRange(node.parent.elements, node.getStart(sourceFile), node.getEnd()); } } return undefined; } + SmartIndenter.getContainingList = getContainingList; function getActualIndentationForListItem(node, sourceFile, options) { var containingList = getContainingList(node, sourceFile); return containingList ? getActualIndentationFromList(containingList) : -1 /* Unknown */; @@ -76930,8 +82878,8 @@ var ts; if (node.kind === 19 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) && + if (node.parent && (node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -76949,10 +82897,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 177 /* PropertyAccessExpression */: - case 178 /* ElementAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 178 /* PropertyAccessExpression */: + case 179 /* ElementAccessExpression */: node = node.expression; break; default: @@ -77016,48 +82964,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 207 /* ExpressionStatement */: - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 175 /* ArrayLiteralExpression */: - case 204 /* Block */: - case 231 /* ModuleBlock */: - case 176 /* ObjectLiteralExpression */: - case 161 /* TypeLiteral */: - case 163 /* TupleType */: - case 232 /* CaseBlock */: - case 254 /* DefaultClause */: - case 253 /* CaseClause */: - case 183 /* ParenthesizedExpression */: - case 177 /* PropertyAccessExpression */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 205 /* VariableStatement */: - case 223 /* VariableDeclaration */: - case 240 /* ExportAssignment */: - case 216 /* ReturnStatement */: - case 193 /* ConditionalExpression */: - case 173 /* ArrayBindingPattern */: - case 172 /* ObjectBindingPattern */: - case 248 /* JsxOpeningElement */: - case 247 /* JsxSelfClosingElement */: - case 252 /* JsxExpression */: - case 148 /* MethodSignature */: - case 153 /* CallSignature */: - case 154 /* ConstructSignature */: - case 144 /* Parameter */: - case 158 /* FunctionType */: - case 159 /* ConstructorType */: - case 166 /* ParenthesizedType */: - case 181 /* TaggedTemplateExpression */: - case 189 /* AwaitExpression */: - case 242 /* NamedExports */: - case 238 /* NamedImports */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: + case 209 /* ExpressionStatement */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 231 /* EnumDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 176 /* ArrayLiteralExpression */: + case 206 /* Block */: + case 233 /* ModuleBlock */: + case 177 /* ObjectLiteralExpression */: + case 162 /* TypeLiteral */: + case 171 /* MappedType */: + case 164 /* TupleType */: + case 234 /* CaseBlock */: + case 257 /* DefaultClause */: + case 256 /* CaseClause */: + case 184 /* ParenthesizedExpression */: + case 178 /* PropertyAccessExpression */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 207 /* VariableStatement */: + case 225 /* VariableDeclaration */: + case 242 /* ExportAssignment */: + case 218 /* ReturnStatement */: + case 194 /* ConditionalExpression */: + case 174 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 250 /* JsxOpeningElement */: + case 249 /* JsxSelfClosingElement */: + case 255 /* JsxExpression */: + case 149 /* MethodSignature */: + case 154 /* CallSignature */: + case 155 /* ConstructSignature */: + case 145 /* Parameter */: + case 159 /* FunctionType */: + case 160 /* ConstructorType */: + case 167 /* ParenthesizedType */: + case 182 /* TaggedTemplateExpression */: + case 190 /* AwaitExpression */: + case 244 /* NamedExports */: + case 240 /* NamedImports */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: return true; } return false; @@ -77066,27 +83015,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 208 /* IfStatement */: - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 185 /* ArrowFunction */: - case 150 /* Constructor */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - return childKind !== 204 /* Block */; - case 241 /* ExportDeclaration */: - return childKind !== 242 /* NamedExports */; - case 235 /* ImportDeclaration */: - return childKind !== 236 /* ImportClause */ || - (child.namedBindings && child.namedBindings.kind !== 238 /* NamedImports */); - case 246 /* JsxElement */: - return childKind !== 249 /* JsxClosingElement */; + case 211 /* DoStatement */: + case 212 /* WhileStatement */: + case 214 /* ForInStatement */: + case 215 /* ForOfStatement */: + case 213 /* ForStatement */: + case 210 /* IfStatement */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 186 /* ArrowFunction */: + case 151 /* Constructor */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return childKind !== 206 /* Block */; + case 243 /* ExportDeclaration */: + return childKind !== 244 /* NamedExports */; + case 237 /* ImportDeclaration */: + return childKind !== 238 /* ImportClause */ || + (child.namedBindings && child.namedBindings.kind !== 240 /* NamedImports */); + case 248 /* JsxElement */: + return childKind !== 251 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -77104,10 +83053,589 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var textChanges; + (function (textChanges) { + /** + * Currently for simplicity we store recovered positions on the node itself. + * It can be changed to side-table later if we decide that current design is too invasive. + */ + function getPos(n) { + return n["__pos"]; + } + function setPos(n, pos) { + n["__pos"] = pos; + } + function getEnd(n) { + return n["__end"]; + } + function setEnd(n, end) { + n["__end"] = end; + } + var Position; + (function (Position) { + Position[Position["FullStart"] = 0] = "FullStart"; + Position[Position["Start"] = 1] = "Start"; + })(Position = textChanges.Position || (textChanges.Position = {})); + function skipWhitespacesAndLineBreaks(text, start) { + return ts.skipTrivia(text, start, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); + } + function hasCommentsBeforeLineBreak(text, start) { + var i = start; + while (i < text.length) { + var ch = text.charCodeAt(i); + if (ts.isWhiteSpaceSingleLine(ch)) { + i++; + continue; + } + return ch === 47 /* slash */; + } + return false; + } + function getSeparatorCharacter(separator) { + return ts.tokenToString(separator.kind); + } + textChanges.getSeparatorCharacter = getSeparatorCharacter; + function getAdjustedStartPosition(sourceFile, node, options, position) { + if (options.useNonAdjustedStartPosition) { + return node.getFullStart(); + } + var fullStart = node.getFullStart(); + var start = node.getStart(sourceFile); + if (fullStart === start) { + return start; + } + var fullStartLine = ts.getLineStartPositionForPosition(fullStart, sourceFile); + var startLine = ts.getLineStartPositionForPosition(start, sourceFile); + if (startLine === fullStartLine) { + // full start and start of the node are on the same line + // a, b; + // ^ ^ + // | start + // fullstart + // when b is replaced - we usually want to keep the leading trvia + // when b is deleted - we delete it + return position === Position.Start ? start : fullStart; + } + // get start position of the line following the line that contains fullstart position + var adjustedStartPosition = ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, fullStartLine) + 1, sourceFile); + // skip whitespaces/newlines + adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition); + return ts.getStartPositionOfLine(ts.getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile); + } + textChanges.getAdjustedStartPosition = getAdjustedStartPosition; + function getAdjustedEndPosition(sourceFile, node, options) { + if (options.useNonAdjustedEndPosition) { + return node.getEnd(); + } + var end = node.getEnd(); + var newEnd = ts.skipTrivia(sourceFile.text, end, /*stopAfterLineBreak*/ true); + // check if last character before newPos is linebreak + // if yes - considered all skipped trivia to be trailing trivia of the node + return newEnd !== end && ts.isLineBreak(sourceFile.text.charCodeAt(newEnd - 1)) + ? newEnd + : end; + } + textChanges.getAdjustedEndPosition = getAdjustedEndPosition; + /** + * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element + */ + function isSeparator(node, candidate) { + return candidate && node.parent && (candidate.kind === 25 /* CommaToken */ || (candidate.kind === 24 /* SemicolonToken */ && node.parent.kind === 177 /* ObjectLiteralExpression */)); + } + function spaces(count) { + var s = ""; + for (var i = 0; i < count; i++) { + s += " "; + } + return s; + } + var ChangeTracker = (function () { + function ChangeTracker(newLine, rulesProvider, validator) { + this.newLine = newLine; + this.rulesProvider = rulesProvider; + this.validator = validator; + this.changes = []; + this.newLineCharacter = ts.getNewLineCharacter({ newLine: newLine }); + } + ChangeTracker.fromCodeFixContext = function (context) { + return new ChangeTracker(context.newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */, context.rulesProvider); + }; + ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, node, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteRange = function (sourceFile, range) { + this.changes.push({ sourceFile: sourceFile, range: range }); + return this; + }; + ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.deleteNodeInList = function (sourceFile, node) { + var containingList = ts.formatting.SmartIndenter.getContainingList(node, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(node); + if (index < 0) { + return this; + } + if (containingList.length === 1) { + this.deleteNode(sourceFile, node); + return this; + } + if (index !== containingList.length - 1) { + var nextToken = ts.getTokenAtPosition(sourceFile, node.end); + if (nextToken && isSeparator(node, nextToken)) { + // find first non-whitespace position in the leading trivia of the node + var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); + var nextElement = containingList[index + 1]; + /// find first non-whitespace position in the leading trivia of the next node + var endPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, nextElement, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); + // shift next node so its first non-whitespace position will be moved to the first non-whitespace position of the deleted node + this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); + } + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end); + if (previousToken && isSeparator(node, previousToken)) { + this.deleteNodeRange(sourceFile, previousToken, node); + } + } + return this; + }; + ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, range: range, options: options, node: newNode }); + return this; + }; + ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, oldNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, oldNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { + if (options === void 0) { options = {}; } + this.changes.push({ sourceFile: sourceFile, options: options, node: newNode, range: { pos: pos, end: pos } }); + return this; + }; + ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, options) { + if (options === void 0) { options = {}; } + var startPosition = getAdjustedStartPosition(sourceFile, before, options, Position.Start); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: startPosition } }); + return this; + }; + ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode, options) { + if (options === void 0) { options = {}; } + if ((ts.isStatementButNotDeclaration(after)) || + after.kind === 148 /* PropertyDeclaration */ || + after.kind === 147 /* PropertySignature */ || + after.kind === 149 /* MethodSignature */) { + // check if previous statement ends with semicolon + // if not - insert semicolon to preserve the code from changing the meaning due to ASI + if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) { + this.changes.push({ + sourceFile: sourceFile, + options: {}, + range: { pos: after.end, end: after.end }, + node: ts.createToken(24 /* SemicolonToken */) + }); + } + } + var endPosition = getAdjustedEndPosition(sourceFile, after, options); + this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: endPosition, end: endPosition } }); + return this; + }; + /** + * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, + * i.e. arguments in arguments lists, parameters in parameter lists etc. + * Note that separators are part of the node in statements and class elements. + */ + ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode) { + var containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); + if (!containingList) { + ts.Debug.fail("node is not a list element"); + return this; + } + var index = containingList.indexOf(after); + if (index < 0) { + return this; + } + var end = after.getEnd(); + if (index !== containingList.length - 1) { + // any element except the last one + // use next sibling as an anchor + var nextToken = ts.getTokenAtPosition(sourceFile, after.end); + if (nextToken && isSeparator(after, nextToken)) { + // for list + // a, b, c + // create change for adding 'e' after 'a' as + // - find start of next element after a (it is b) + // - use this start as start and end position in final change + // - build text of change by formatting the text of node + separator + whitespace trivia of b + // in multiline case it will work as + // a, + // b, + // c, + // result - '*' denotes leading trivia that will be inserted after new text (displayed as '#') + // a,* + // ***insertedtext# + // ###b, + // c, + // find line and character of the next element + var lineAndCharOfNextElement = ts.getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart())); + // find line and character of the token that precedes next element (usually it is separator) + var lineAndCharOfNextToken = ts.getLineAndCharacterOfPosition(sourceFile, nextToken.end); + var prefix = void 0; + var startPos = void 0; + if (lineAndCharOfNextToken.line === lineAndCharOfNextElement.line) { + // next element is located on the same line with separator: + // a,$$$$b + // ^ ^ + // | |-next element + // |-separator + // where $$$ is some leading trivia + // for a newly inserted node we'll maintain the same relative position comparing to separator and replace leading trivia with spaces + // a, x,$$$$b + // ^ ^ ^ + // | | |-next element + // | |-new inserted node padded with spaces + // |-separator + startPos = nextToken.end; + prefix = spaces(lineAndCharOfNextElement.character - lineAndCharOfNextToken.character); + } + else { + // next element is located on different line that separator + // let insert position be the beginning of the line that contains next element + startPos = ts.getStartPositionOfLine(lineAndCharOfNextElement.line, sourceFile); + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: startPos, end: containingList[index + 1].getStart(sourceFile) }, + node: newNode, + useIndentationFromFile: true, + options: { + prefix: prefix, + // write separator and leading trivia of the next element as suffix + suffix: "" + ts.tokenToString(nextToken.kind) + sourceFile.text.substring(nextToken.end, containingList[index + 1].getStart(sourceFile)) + } + }); + } + } + else { + var afterStart = after.getStart(sourceFile); + var afterStartLinePosition = ts.getLineStartPositionForPosition(afterStart, sourceFile); + var separator = void 0; + var multilineList = false; + // insert element after the last element in the list that has more than one item + // pick the element preceding the after element to: + // - pick the separator + // - determine if list is a multiline + if (containingList.length === 1) { + // if list has only one element then we'll format is as multiline if node has comment in trailing trivia, or as singleline otherwise + // i.e. var x = 1 // this is x + // | new element will be inserted at this position + separator = 25 /* CommaToken */; + } + else { + // element has more than one element, pick separator from the list + var tokenBeforeInsertPosition = ts.findPrecedingToken(after.pos, sourceFile); + separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 25 /* CommaToken */; + // determine if list is multiline by checking lines of after element and element that precedes it. + var afterMinusOneStartLinePosition = ts.getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); + multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; + } + if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) { + // in this case we'll always treat containing list as multiline + multilineList = true; + } + if (multilineList) { + // insert separator immediately following the 'after' node to preserve comments in trailing trivia + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: ts.createToken(separator), + options: {} + }); + // use the same indentation as 'after' item + var indentation = ts.formatting.SmartIndenter.findFirstNonWhitespaceColumn(afterStartLinePosition, afterStart, sourceFile, this.rulesProvider.getFormatOptions()); + // insert element before the line break on the line that contains 'after' element + var insertPos = ts.skipTrivia(sourceFile.text, end, /*stopAfterLineBreak*/ true, /*stopAtComments*/ false); + if (insertPos !== end && ts.isLineBreak(sourceFile.text.charCodeAt(insertPos - 1))) { + insertPos--; + } + this.changes.push({ + sourceFile: sourceFile, + range: { pos: insertPos, end: insertPos }, + node: newNode, + options: { indentation: indentation, prefix: this.newLineCharacter } + }); + } + else { + this.changes.push({ + sourceFile: sourceFile, + range: { pos: end, end: end }, + node: newNode, + options: { prefix: ts.tokenToString(separator) + " " } + }); + } + } + return this; + }; + ChangeTracker.prototype.getChanges = function () { + var _this = this; + var changesPerFile = ts.createFileMap(); + // group changes per file + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var c = _a[_i]; + var changesInFile = changesPerFile.get(c.sourceFile.path); + if (!changesInFile) { + changesPerFile.set(c.sourceFile.path, changesInFile = []); + } + changesInFile.push(c); + } + // convert changes + var fileChangesList = []; + changesPerFile.forEachValue(function (path) { + var changesInFile = changesPerFile.get(path); + var sourceFile = changesInFile[0].sourceFile; + var fileTextChanges = { fileName: sourceFile.fileName, textChanges: [] }; + for (var _i = 0, _a = ChangeTracker.normalize(changesInFile); _i < _a.length; _i++) { + var c = _a[_i]; + fileTextChanges.textChanges.push({ + span: _this.computeSpan(c, sourceFile), + newText: _this.computeNewText(c, sourceFile) + }); + } + fileChangesList.push(fileTextChanges); + }); + return fileChangesList; + }; + ChangeTracker.prototype.computeSpan = function (change, _sourceFile) { + return ts.createTextSpanFromBounds(change.range.pos, change.range.end); + }; + ChangeTracker.prototype.computeNewText = function (change, sourceFile) { + if (!change.node) { + // deletion case + return ""; + } + var options = change.options || {}; + var nonFormattedText = getNonformattedText(change.node, sourceFile, this.newLine); + if (this.validator) { + this.validator(nonFormattedText); + } + var formatOptions = this.rulesProvider.getFormatOptions(); + var pos = change.range.pos; + var posStartsLine = ts.getLineStartPositionForPosition(pos, sourceFile) === pos; + var initialIndentation = change.options.indentation !== undefined + ? change.options.indentation + : change.useIndentationFromFile + ? ts.formatting.SmartIndenter.getIndentation(change.range.pos, sourceFile, formatOptions, posStartsLine || (change.options.prefix === this.newLineCharacter)) + : 0; + var delta = change.options.delta !== undefined + ? change.options.delta + : ts.formatting.SmartIndenter.shouldIndentChildNode(change.node) + ? formatOptions.indentSize + : 0; + var text = applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, this.rulesProvider); + // strip initial indentation (spaces or tabs) if text will be inserted in the middle of the line + // however keep indentation if it is was forced + text = posStartsLine || change.options.indentation !== undefined ? text : text.replace(/^\s+/, ""); + return (options.prefix || "") + text + (options.suffix || ""); + }; + ChangeTracker.normalize = function (changes) { + // order changes by start position + var normalized = ts.stableSort(changes, function (a, b) { return a.range.pos - b.range.pos; }); + // verify that change intervals do not overlap, except possibly at end points. + for (var i = 0; i < normalized.length - 2; i++) { + ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos); + } + return normalized; + }; + return ChangeTracker; + }()); + textChanges.ChangeTracker = ChangeTracker; + function getNonformattedText(node, sourceFile, newLine) { + var options = { newLine: newLine, target: sourceFile.languageVersion }; + var writer = new Writer(ts.getNewLineCharacter(options)); + var printer = ts.createPrinter(options, writer); + printer.writeNode(3 /* Unspecified */, node, sourceFile, writer); + return { text: writer.getText(), node: assignPositionsToNode(node) }; + } + textChanges.getNonformattedText = getNonformattedText; + function applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, rulesProvider) { + var lineMap = ts.computeLineStarts(nonFormattedText.text); + var file = { + text: nonFormattedText.text, + lineMap: lineMap, + getLineAndCharacterOfPosition: function (pos) { return ts.computeLineAndCharacterOfPosition(lineMap, pos); } + }; + var changes = ts.formatting.formatNode(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); + return applyChanges(nonFormattedText.text, changes); + } + textChanges.applyFormatting = applyFormatting; + function applyChanges(text, changes) { + for (var i = changes.length - 1; i >= 0; i--) { + var change = changes[i]; + text = "" + text.substring(0, change.span.start) + change.newText + text.substring(ts.textSpanEnd(change.span)); + } + return text; + } + textChanges.applyChanges = applyChanges; + function isTrivia(s) { + return ts.skipTrivia(s, 0) === s.length; + } + var nullTransformationContext = { + enableEmitNotification: ts.noop, + enableSubstitution: ts.noop, + endLexicalEnvironment: function () { return undefined; }, + getCompilerOptions: ts.notImplemented, + getEmitHost: ts.notImplemented, + getEmitResolver: ts.notImplemented, + hoistFunctionDeclaration: ts.noop, + hoistVariableDeclaration: ts.noop, + isEmitNotificationEnabled: ts.notImplemented, + isSubstitutionEnabled: ts.notImplemented, + onEmitNode: ts.noop, + onSubstituteNode: ts.notImplemented, + readEmitHelpers: ts.notImplemented, + requestEmitHelper: ts.noop, + resumeLexicalEnvironment: ts.noop, + startLexicalEnvironment: ts.noop, + suspendLexicalEnvironment: ts.noop + }; + function assignPositionsToNode(node) { + var visited = ts.visitEachChild(node, assignPositionsToNode, nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); + // create proxy node for non synthesized nodes + var newNode = ts.nodeIsSynthesized(visited) + ? visited + : (Proxy.prototype = visited, new Proxy()); + newNode.pos = getPos(node); + newNode.end = getEnd(node); + return newNode; + function Proxy() { } + } + function assignPositionsToNodeArray(nodes, visitor, test, start, count) { + var visited = ts.visitNodes(nodes, visitor, test, start, count); + if (!visited) { + return visited; + } + // clone nodearray if necessary + var nodeArray = visited === nodes ? ts.createNodeArray(visited.slice(0)) : visited; + nodeArray.pos = getPos(nodes); + nodeArray.end = getEnd(nodes); + return nodeArray; + } + var Writer = (function () { + function Writer(newLine) { + var _this = this; + this.lastNonTriviaPosition = 0; + this.writer = ts.createTextWriter(newLine); + this.onEmitNode = function (hint, node, printCallback) { + if (node) { + setPos(node, _this.lastNonTriviaPosition); + } + printCallback(hint, node); + if (node) { + setEnd(node, _this.lastNonTriviaPosition); + } + }; + this.onBeforeEmitNodeArray = function (nodes) { + if (nodes) { + setPos(nodes, _this.lastNonTriviaPosition); + } + }; + this.onAfterEmitNodeArray = function (nodes) { + if (nodes) { + setEnd(nodes, _this.lastNonTriviaPosition); + } + }; + } + Writer.prototype.setLastNonTriviaPosition = function (s, force) { + if (force || !isTrivia(s)) { + this.lastNonTriviaPosition = this.writer.getTextPos(); + var i = 0; + while (ts.isWhiteSpace(s.charCodeAt(s.length - i - 1))) { + i++; + } + // trim trailing whitespaces + this.lastNonTriviaPosition -= i; + } + }; + Writer.prototype.write = function (s) { + this.writer.write(s); + this.setLastNonTriviaPosition(s, /*force*/ false); + }; + Writer.prototype.writeTextOfNode = function (text, node) { + this.writer.writeTextOfNode(text, node); + }; + Writer.prototype.writeLine = function () { + this.writer.writeLine(); + }; + Writer.prototype.increaseIndent = function () { + this.writer.increaseIndent(); + }; + Writer.prototype.decreaseIndent = function () { + this.writer.decreaseIndent(); + }; + Writer.prototype.getText = function () { + return this.writer.getText(); + }; + Writer.prototype.rawWrite = function (s) { + this.writer.rawWrite(s); + this.setLastNonTriviaPosition(s, /*force*/ false); + }; + Writer.prototype.writeLiteral = function (s) { + this.writer.writeLiteral(s); + this.setLastNonTriviaPosition(s, /*force*/ true); + }; + Writer.prototype.getTextPos = function () { + return this.writer.getTextPos(); + }; + Writer.prototype.getLine = function () { + return this.writer.getLine(); + }; + Writer.prototype.getColumn = function () { + return this.writer.getColumn(); + }; + Writer.prototype.getIndent = function () { + return this.writer.getIndent(); + }; + Writer.prototype.isAtStartOfLine = function () { + return this.writer.isAtStartOfLine(); + }; + Writer.prototype.reset = function () { + this.writer.reset(); + this.lastNonTriviaPosition = 0; + }; + return Writer; + }()); + })(textChanges = ts.textChanges || (ts.textChanges = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { - var codeFixes = ts.createMap(); + var codeFixes = []; function registerCodeFix(action) { ts.forEach(action.errorCodes, function (error) { var fixes = codeFixes[error]; @@ -77142,25 +83670,226 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - // First token is the open curly, this is where we want to put the 'super' call. - return constructor.body.getFirstToken(sourceFile).getEnd(); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface + }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDeclaration = ts.getContainingClass(token); + if (!classDeclaration) { + return undefined; + } + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var classType = checker.getTypeAtLocation(classDeclaration); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDeclaration); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1 /* Number */); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0 /* String */); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var implementedType = checker.getTypeAtLocation(implementedTypeNode); + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8 /* Private */); }); + var newNodes = []; + createAndAddMissingIndexSignatureDeclaration(implementedType, 1 /* Number */, hasNumericIndexSignature, newNodes); + createAndAddMissingIndexSignatureDeclaration(implementedType, 0 /* String */, hasStringIndexSignature, newNodes); + newNodes = newNodes.concat(codefix.createMissingMemberNodes(classDeclaration, nonPrivateMembers, checker)); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (newNodes.length > 0) { + pushAction(result, newNodes, message); + } + } + return result; + function createAndAddMissingIndexSignatureDeclaration(type, kind, hasIndexSigOfKind, newNodes) { + if (hasIndexSigOfKind) { + return; + } + var indexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (!indexInfoOfKind) { + return; + } + var newIndexSignatureDeclaration = checker.indexInfoToIndexSignatureDeclaration(indexInfoOfKind, kind, classDeclaration); + newNodes.push(newIndexSignatureDeclaration); + } + function pushAction(result, newNodes, description) { + var newAction = { + description: description, + changes: codefix.newNodesToChanges(newNodes, openBrace, context) + }; + result.push(newAction); + } } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122 /* ConstructorKeyword */) { - return undefined; + errorCodes: [ts.Diagnostics.Property_0_does_not_exist_on_type_1.code], + getCodeActions: getActionsForAddMissingMember + }); + function getActionsForAddMissingMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + // This is the identifier of the missing property. eg: + // this.missing = 1; + // ^^^^^^^ + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind !== 70 /* Identifier */) { + return undefined; + } + if (!ts.isPropertyAccessExpression(token.parent) || token.parent.expression.kind !== 98 /* ThisKeyword */) { + return undefined; + } + var classMemberDeclaration = ts.getThisContainer(token, /*includeArrowFunctions*/ false); + if (!ts.isClassElement(classMemberDeclaration)) { + return undefined; + } + var classDeclaration = classMemberDeclaration.parent; + if (!classDeclaration || !ts.isClassLike(classDeclaration)) { + return undefined; + } + var isStatic = ts.hasModifier(classMemberDeclaration, 32 /* Static */); + return ts.isInJavaScriptFile(sourceFile) ? getActionsForAddMissingMemberInJavaScriptFile() : getActionsForAddMissingMemberInTypeScriptFile(); + function getActionsForAddMissingMemberInJavaScriptFile() { + var memberName = token.getText(); + if (isStatic) { + if (classDeclaration.kind === 198 /* ClassExpression */) { + return undefined; + } + var className = classDeclaration.name.getText(); + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_static_property_0), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classDeclaration.getEnd(), length: 0 }, + newText: "" + context.newLineCharacter + className + "." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + else { + var classConstructor = ts.getFirstConstructorWithBody(classDeclaration); + if (!classConstructor) { + return undefined; + } + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Initialize_property_0_in_the_constructor), [memberName]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classConstructor.body.getEnd() - 1, length: 0 }, + newText: "this." + memberName + " = undefined;" + context.newLineCharacter + }] + }] + }]; + } + } + function getActionsForAddMissingMemberInTypeScriptFile() { + var typeNode; + if (token.parent.parent.kind === 193 /* BinaryExpression */) { + var binaryExpression = token.parent.parent; + var checker = context.program.getTypeChecker(); + var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right))); + typeNode = checker.typeToTypeNode(widenedType, classDeclaration); + } + typeNode = typeNode || ts.createKeywordTypeNode(118 /* AnyKeyword */); + var openBrace = ts.getOpenBraceOfClassLike(classDeclaration, sourceFile); + var property = ts.createProperty( + /*decorators*/ undefined, + /*modifiers*/ isStatic ? [ts.createToken(114 /* StaticKeyword */)] : undefined, token.getText(sourceFile), + /*questionToken*/ undefined, typeNode, + /*initializer*/ undefined); + var propertyChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + propertyChangeTracker.insertNodeAfter(sourceFile, openBrace, property, { suffix: context.newLineCharacter }); + var actions = [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]), + changes: propertyChangeTracker.getChanges() }]; + if (!isStatic) { + var stringTypeNode = ts.createKeywordTypeNode(135 /* StringKeyword */); + var indexingParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, "x", + /*questionToken*/ undefined, stringTypeNode, + /*initializer*/ undefined); + var indexSignature = ts.createIndexSignatureDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, [indexingParameter], typeNode); + var indexSignatureChangeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + indexSignatureChangeTracker.insertNodeAfter(sourceFile, openBrace, indexSignature, { suffix: context.newLineCharacter }); + actions.push({ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]), + changes: indexSignatureChangeTracker.getChanges() + }); + } + return actions; } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + // This is the identifier in the case of a class declaration + // or the class keyword token in the case of a class expression. + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDeclaration = token.parent; + var extendsNode = ts.getClassExtendsHeritageClauseElement(classDeclaration); + var instantiatedExtendsType = checker.getTypeAtLocation(extendsNode); + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var newNodes = codefix.createMissingMemberNodes(classDeclaration, abstractAndNonPrivateExtendsSymbols, checker); + var changes = codefix.newNodesToChanges(newNodes, ts.getOpenBraceOfClassLike(classDeclaration, sourceFile), context); + if (changes && changes.length > 0) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: changes + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8 /* Private */) && !!(flags & 128 /* Abstract */); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -77174,9 +83903,9 @@ var ts; if (!superCall) { return undefined; } - // figure out if the this access is actuall inside the supercall + // figure out if the `this` access is actually inside the supercall // i.e. super(this.a), since in that case we won't suggest a fix - if (superCall.expression && superCall.expression.kind == 179 /* CallExpression */) { + if (superCall.expression && superCall.expression.kind === 180 /* CallExpression */) { var arguments_1 = superCall.expression.arguments; for (var i = 0; i < arguments_1.length; i++) { if (arguments_1[i].expression === token) { @@ -77184,23 +83913,15 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); - var changes = [{ - fileName: sourceFile.fileName, textChanges: [{ - newText: superCall.getText(sourceFile), - span: { start: newPosition, length: 0 } - }, - { - newText: "", - span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) } - }] - }]; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(constructor, sourceFile), superCall, { suffix: context.newLineCharacter }); + changeTracker.deleteNode(sourceFile, superCall); return [{ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor), - changes: changes + changes: changeTracker.getChanges() }]; function findSuperCall(n) { - if (n.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { + if (n.kind === 209 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -77214,6 +83935,265 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122 /* ConstructorKeyword */) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + var superCall = ts.createStatement(ts.createCall(ts.createSuper(), /*typeArguments*/ undefined, /*argumentsArray*/ ts.emptyArray)); + changeTracker.insertNodeAfter(sourceFile, ts.getOpenBrace(token.parent, sourceFile), superCall, { suffix: context.newLineCharacter }); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 /* Identifier */ && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84 /* ExtendsKeyword */)) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, extendsToken, ts.createToken(107 /* ImplementsKeyword */)); + // We replace existing keywords with commas. + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeTracker.replaceNode(sourceFile, keywordToken, ts.createToken(25 /* CommaToken */)); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: changeTracker.getChanges() + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 70 /* Identifier */) { + return undefined; + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createThis(), token)); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_this_to_unresolved_variable), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + // this handles var ["computed"] = 12; + if (token.kind === 20 /* OpenBracketToken */) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70 /* Identifier */: + switch (token.parent.kind) { + case 225 /* VariableDeclaration */: + switch (token.parent.parent.parent.kind) { + case 213 /* ForStatement */: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return deleteNode(forInitializer); + } + else { + return deleteNodeInList(token.parent); + } + case 215 /* ForOfStatement */: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 226 /* VariableDeclarationList */) { + var forOfInitializer = forOfStatement.initializer; + return replaceNode(forOfInitializer.declarations[0], ts.createObjectLiteral()); + } + break; + case 214 /* ForInStatement */: + // There is no valid fix in the case of: + // for .. in + return undefined; + case 259 /* CatchClause */: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return deleteNode(parameter); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return deleteNode(variableStatement); + } + else { + return deleteNodeInList(token.parent); + } + } + // TODO: #14885 + // falls through + case 144 /* TypeParameter */: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1); + if (!previousToken || previousToken.kind !== 26 /* LessThanToken */) { + return deleteRange(typeParameters); + } + var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end); + if (!nextToken || nextToken.kind !== 28 /* GreaterThanToken */) { + return deleteRange(typeParameters); + } + return deleteNodeRange(previousToken, nextToken); + } + else { + return deleteNodeInList(token.parent); + } + case 145 /* Parameter */: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return deleteNode(token.parent); + } + else { + return deleteNodeInList(token.parent); + } + // handle case where 'import a = A;' + case 236 /* ImportEqualsDeclaration */: + var importEquals = ts.getAncestor(token, 236 /* ImportEqualsDeclaration */); + return deleteNode(importEquals); + case 241 /* ImportSpecifier */: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + // Only 1 import and it is unused. So the entire declaration should be removed. + var importSpec = ts.getAncestor(token, 237 /* ImportDeclaration */); + return deleteNode(importSpec); + } + else { + // delete import specifier + return deleteNodeInList(token.parent); + } + // handle case where "import d, * as ns from './file'" + // or "'import {a, b as ns} from './file'" + case 238 /* ImportClause */: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = ts.getAncestor(importClause, 237 /* ImportDeclaration */); + return deleteNode(importDecl); + } + else { + // import |d,| * as ns from './file' + var start_4 = importClause.name.getStart(sourceFile); + var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end); + if (nextToken && nextToken.kind === 25 /* CommaToken */) { + // shift first non-whitespace position after comma to the start position of the node + return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, /*stopAfterLineBreaks*/ false, /*stopAtComments*/ true) }); + } + else { + return deleteNode(importClause.name); + } + } + case 239 /* NamespaceImport */: + var namespaceImport = token.parent; + if (namespaceImport.name === token && !namespaceImport.parent.name) { + var importDecl = ts.getAncestor(namespaceImport, 237 /* ImportDeclaration */); + return deleteNode(importDecl); + } + else { + var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1); + if (previousToken && previousToken.kind === 25 /* CommaToken */) { + var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart); + return deleteRange({ pos: startPosition, end: namespaceImport.end }); + } + return deleteRange(namespaceImport); + } + } + break; + case 148 /* PropertyDeclaration */: + case 239 /* NamespaceImport */: + return deleteNode(token.parent); + } + if (ts.isDeclarationName(token)) { + return deleteNode(token.parent); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return deleteNode(token.parent.parent); + } + else { + return undefined; + } + function deleteNode(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNode(sourceFile, n)); + } + function deleteRange(range) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteRange(sourceFile, range)); + } + function deleteNodeInList(n) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeInList(sourceFile, n)); + } + function deleteNodeRange(start, end) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).deleteNodeRange(sourceFile, start, end)); + } + function replaceNode(n, newNode) { + return makeChange(ts.textChanges.ChangeTracker.fromCodeFixContext(context).replaceNode(sourceFile, n, newNode)); + } + function makeChange(changeTracker) { + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), + changes: changeTracker.getChanges() + }]; + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -77225,18 +84205,19 @@ var ts; })(ModuleSpecifierComparison || (ModuleSpecifierComparison = {})); var ImportCodeActionMap = (function () { function ImportCodeActionMap() { - this.symbolIdToActionMap = ts.createMap(); + this.symbolIdToActionMap = []; } ImportCodeActionMap.prototype.addAction = function (symbolId, newAction) { if (!newAction) { return; } - if (!this.symbolIdToActionMap[symbolId]) { + var actions = this.symbolIdToActionMap[symbolId]; + if (!actions) { this.symbolIdToActionMap[symbolId] = [newAction]; return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } var updatedNewImports = []; @@ -77249,12 +84230,13 @@ var ts; } switch (this.compareModuleSpecifiers(existingAction.moduleSpecifier, newAction.moduleSpecifier)) { case ModuleSpecifierComparison.Better: - // the new one is not worth considering if it is a new improt. + // the new one is not worth considering if it is a new import. // However if it is instead a insertion into existing import, the user might want to use // the module specifier even it is worse by our standards. So keep it. if (newAction.kind === "NewImport") { return; } + // falls through case ModuleSpecifierComparison.Equal: // the current one is safe. But it is still possible that the new one is worse // than another existing one. For example, you may have new imports from "./foo/bar" @@ -77280,8 +84262,8 @@ var ts; }; ImportCodeActionMap.prototype.getAllActions = function () { var result = []; - for (var symbolId in this.symbolIdToActionMap) { - result = ts.concatenate(result, this.symbolIdToActionMap[symbolId]); + for (var key in this.symbolIdToActionMap) { + result = ts.concatenate(result, this.symbolIdToActionMap[key]); } return result; }; @@ -77313,7 +84295,11 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics.Cannot_find_namespace_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -77323,18 +84309,22 @@ var ts; var name = token.getText(); var symbolIdActionMap = new ImportCodeActionMap(); // this is a module id -> module import declaration map - var cachedImportDeclarations = ts.createMap(); - var cachedNewImportInsertPosition; - var allPotentialModules = checker.getAmbientModules(); + var cachedImportDeclarations = []; + var lastImportDeclaration; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, /*isDefault*/ false, /*isNamespaceImport*/ true); + } + var candidateModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; if (otherSourceFile !== sourceFile && ts.isExternalOrCommonJsModule(otherSourceFile)) { - allPotentialModules.push(otherSourceFile.symbol); + candidateModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); - for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { - var moduleSymbol = allPotentialModules_1[_a]; + for (var _a = 0, candidateModules_1 = candidateModules; _a < candidateModules_1.length; _a++) { + var moduleSymbol = candidateModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); // check the default export var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); @@ -77356,8 +84346,9 @@ var ts; return symbolIdActionMap.getAllActions(); function getImportDeclarations(moduleSymbol) { var moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + var cached = cachedImportDeclarations[moduleSymbolId]; + if (cached) { + return cached; } var existingDeclarations = []; for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { @@ -77372,10 +84363,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 237 /* ImportDeclaration */) { return node; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 236 /* ImportEqualsDeclaration */) { return node; } node = node.parent; @@ -77393,7 +84384,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { // With an existing import statement, there are more than one actions the user can do. @@ -77419,11 +84410,11 @@ var ts; var namespaceImportDeclaration; var namedImportDeclaration; var existingModuleSpecifier; - for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { - var declaration = declarations_11[_i]; - if (declaration.kind === 235 /* ImportDeclaration */) { + for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) { + var declaration = declarations_14[_i]; + if (declaration.kind === 237 /* ImportDeclaration */) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 239 /* NamespaceImport */) { // case: // import * as ns from "foo" namespaceImportDeclaration = declaration; @@ -77447,15 +84438,15 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { /** * If the existing import declaration already has a named import list, just * insert the identifier into that list. */ - var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); + var fileTextChanges = getTextChangeForImportClause(namedImportDeclaration.importClause); var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); - actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], textChange.newText, textChange.span, sourceFile.fileName, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); + actions.push(createCodeAction(ts.Diagnostics.Add_0_to_existing_import_declaration_from_1, [name, moduleSpecifierWithoutQuotes], fileTextChanges, "InsertingIntoExistingImport", moduleSpecifierWithoutQuotes)); } else { // we need to create a new import statement, but the existing module specifier can be reused. @@ -77463,55 +84454,35 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) { + if (declaration.moduleReference && declaration.moduleReference.kind === 247 /* ExternalModuleReference */) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); } function getTextChangeForImportClause(importClause) { - var newImportText = isDefault ? "default as " + name : name; var importList = importClause.namedBindings; + var newImportSpecifier = ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name)); // case 1: // original text: import default from "module" // change to: import default, { name } from "module" - if (!importList && importClause.name) { - var start = importClause.name.getEnd(); - return { - newText: ", { " + newImportText + " }", - span: { start: start, length: 0 } - }; - } // case 2: // original text: import {} from "module" // change to: import { name } from "module" - if (importList.elements.length === 0) { - var start = importList.getStart(); - return { - newText: "{ " + newImportText + " }", - span: { start: start, length: importList.getEnd() - start } - }; + if (!importList || importList.elements.length === 0) { + var newImportClause = ts.createImportClause(importClause.name, ts.createNamedImports([newImportSpecifier])); + return createChangeTracker().replaceNode(sourceFile, importClause, newImportClause).getChanges(); } - // case 3: - // original text: import { foo, bar } from "module" - // change to: import { foo, bar, name } from "module" - var insertPoint = importList.elements[importList.elements.length - 1].getEnd(); /** * If the import list has one import per line, preserve that. Otherwise, insert on same line as last element * import { * foo * } from "./module"; */ - var startLine = ts.getLineOfLocalPosition(sourceFile, importList.getStart()); - var endLine = ts.getLineOfLocalPosition(sourceFile, importList.getEnd()); - var oneImportPerLine = endLine - startLine > importList.elements.length; - return { - newText: "," + (oneImportPerLine ? context.newLineCharacter : " ") + newImportText, - span: { start: insertPoint, length: 0 } - }; + return createChangeTracker().insertNodeInListAfter(sourceFile, importList.elements[importList.elements.length - 1], newImportSpecifier).getChanges(); } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235 /* ImportDeclaration */) { + if (declaration.kind === 237 /* ImportDeclaration */) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -77528,47 +84499,52 @@ var ts; * namespace instead of altering the import declaration. For example, "foo" would * become "ns.foo" */ - return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], namespacePrefix + ".", { start: token.getStart(), length: 0 }, sourceFile.fileName, "CodeChange"); + return createCodeAction(ts.Diagnostics.Change_0_to_1, [name, namespacePrefix + "." + name], createChangeTracker().replaceNode(sourceFile, token, ts.createPropertyAccess(ts.createIdentifier(namespacePrefix), name)).getChanges(), "CodeChange"); } } function getCodeActionForNewImport(moduleSpecifier) { - if (!cachedNewImportInsertPosition) { + if (!lastImportDeclaration) { // insert after any existing imports - var lastModuleSpecifierEnd = -1; - for (var _i = 0, _a = sourceFile.imports; _i < _a.length; _i++) { - var moduleSpecifier_1 = _a[_i]; - var end = moduleSpecifier_1.getEnd(); - if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { - lastModuleSpecifierEnd = end; + for (var i = sourceFile.statements.length - 1; i >= 0; i--) { + var statement = sourceFile.statements[i]; + if (statement.kind === 236 /* ImportEqualsDeclaration */ || statement.kind === 237 /* ImportDeclaration */) { + lastImportDeclaration = statement; + break; } } - cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); } var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); - var importStatementText = isDefault - ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + var changeTracker = createChangeTracker(); + var importClause = isDefault + ? ts.createImportClause(ts.createIdentifier(name), /*namedBindings*/ undefined) + : isNamespaceImport + ? ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(ts.createIdentifier(name))) + : ts.createImportClause(/*name*/ undefined, ts.createNamedImports([ts.createImportSpecifier(/*propertyName*/ undefined, ts.createIdentifier(name))])); + var importDecl = ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, importClause, ts.createLiteral(moduleSpecifierWithoutQuotes)); + if (!lastImportDeclaration) { + changeTracker.insertNodeAt(sourceFile, sourceFile.getStart(), importDecl, { suffix: "" + context.newLineCharacter + context.newLineCharacter }); + } + else { + changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl, { suffix: context.newLineCharacter }); + } // if this file doesn't have any import statements, insert an import statement and then insert a new line // between the only import statement and user code. Otherwise just insert the statement because chances // are there are already a new line seperating code and import statements. - var newText = cachedNewImportInsertPosition === sourceFile.getStart() - ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter - : "" + context.newLineCharacter + importStatementText + ";"; - return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], newText, { start: cachedNewImportInsertPosition, length: 0 }, sourceFile.fileName, "NewImport", moduleSpecifierWithoutQuotes); + return createCodeAction(ts.Diagnostics.Import_0_from_1, [name, "\"" + moduleSpecifierWithoutQuotes + "\""], changeTracker.getChanges(), "NewImport", moduleSpecifierWithoutQuotes); function getModuleSpecifierForNewImport() { - var fileName = sourceFile.path; - var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; + var fileName = sourceFile.fileName; + var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().fileName; var sourceDirectory = ts.getDirectoryPath(fileName); var options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) { + if (moduleSymbol.valueDeclaration.kind !== 264 /* SourceFile */) { return moduleSymbol.name; } } @@ -77576,11 +84552,11 @@ var ts; if (!options.baseUrl) { return undefined; } - var normalizedBaseUrl = ts.toPath(options.baseUrl, ts.getDirectoryPath(options.baseUrl), getCanonicalFileName); - var relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); + var relativeName = getRelativePathIfInDirectory(moduleFileName, options.baseUrl); if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -77600,7 +84576,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -77610,9 +84586,8 @@ var ts; } function tryGetModuleNameFromRootDirs() { if (options.rootDirs) { - var normalizedRootDirs = ts.map(options.rootDirs, function (rootDir) { return ts.toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName); }); - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); + var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, options.rootDirs); + var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, options.rootDirs); if (normalizedTargetPath !== undefined) { var relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; return ts.removeFileExtension(relativePath); @@ -77676,7 +84651,7 @@ var ts; function getPathRelativeToRootDirs(path, rootDirs) { for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { var rootDir = rootDirs_2[_i]; - var relativeName = tryRemoveParentDirectoryName(path, rootDir); + var relativeName = getRelativePathIfInDirectory(path, rootDir); if (relativeName !== undefined) { return relativeName; } @@ -77690,25 +84665,23 @@ var ts; } return fileName; } + function getRelativePathIfInDirectory(path, directoryPath) { + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); + return ts.isRootedDiskPath(relativePath) || ts.startsWith(relativePath, "..") ? undefined : relativePath; + } function getRelativePath(path, directoryPath) { - var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); + var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; } - function tryRemoveParentDirectoryName(path, parentDirectory) { - var index = path.indexOf(parentDirectory); - if (index === 0) { - return ts.endsWith(parentDirectory, ts.directorySeparator) - ? path.substring(parentDirectory.length) - : path.substring(parentDirectory.length + 1); - } - return undefined; - } } } - function createCodeAction(description, diagnosticArgs, newText, span, fileName, kind, moduleSpecifier) { + function createChangeTracker() { + return ts.textChanges.ChangeTracker.fromCodeFixContext(context); + } + function createCodeAction(description, diagnosticArgs, changes, kind, moduleSpecifier) { return { description: ts.formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), - changes: [{ fileName: fileName, textChanges: [{ newText: newText, span: span }] }], + changes: changes, kind: kind, moduleSpecifier: moduleSpecifier }; @@ -77723,155 +84696,275 @@ var ts; var codefix; (function (codefix) { codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - // this handles var ["computed"] = 12; - if (token.kind === 20 /* OpenBracketToken */) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70 /* Identifier */: - switch (token.parent.kind) { - case 223 /* VariableDeclaration */: - switch (token.parent.parent.parent.kind) { - case 211 /* ForStatement */: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213 /* ForOfStatement */: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212 /* ForInStatement */: - // There is no valid fix in the case of: - // for .. in - return undefined; - case 256 /* CatchClause */: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143 /* TypeParameter */: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144 /* Parameter */: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - // handle case where 'import a = A;' - case 234 /* ImportEqualsDeclaration */: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239 /* ImportSpecifier */: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - // Only 1 import and it is unused. So the entire declaration should be removed. - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - // handle case where "import d, * as ns from './file'" - // or "'import {a, b as ns} from './file'" - case 236 /* ImportClause */: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237 /* NamespaceImport */: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147 /* PropertyDeclaration */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237 /* NamespaceImport */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) { - importDecl = importDecl.parent; - } - return importDecl; + errorCodes: getApplicableDiagnosticCodes(), + getCodeActions: getDisableJsDiagnosticsCodeActions + }); + function getApplicableDiagnosticCodes() { + var allDiagnostcs = ts.Diagnostics; + return Object.keys(allDiagnostcs) + .filter(function (d) { return allDiagnostcs[d] && allDiagnostcs[d].category === ts.DiagnosticCategory.Error; }) + .map(function (d) { return allDiagnostcs[d].code; }); + } + function getIgnoreCommentLocationForLocation(sourceFile, position, newLineCharacter) { + var line = ts.getLineAndCharacterOfPosition(sourceFile, position).line; + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition); + // First try to see if we can put the '// @ts-ignore' on the previous line. + // We need to make sure that we are not in the middle of a string literal or a comment. + // We also want to check if the previous line holds a comment for a node on the next line + // if so, we do not want to separate the node from its comment if we can. + if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) { + var token = ts.getTouchingToken(sourceFile, startPosition); + var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile); + if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) { + return { + span: { start: startPosition, length: 0 }, + newText: "// @ts-ignore" + newLineCharacter + }; } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] + } + // If all fails, add an extra new line immediatlly before the error span. + return { + span: { start: position, length: 0 }, + newText: (position === startPosition ? "" : newLineCharacter) + "// @ts-ignore" + newLineCharacter + }; + } + function getDisableJsDiagnosticsCodeActions(context) { + var sourceFile = context.sourceFile, program = context.program, newLineCharacter = context.newLineCharacter, span = context.span; + if (!ts.isInJavaScriptFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { + return undefined; + } + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Ignore_this_error_message), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter)] + }] + }, + { + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Disable_checking_for_this_file), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { + start: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.pos : 0, + length: sourceFile.checkJsDirective ? sourceFile.checkJsDirective.end - sourceFile.checkJsDirective.pos : 0 + }, + newText: "// @ts-nocheck" + newLineCharacter }] - }]; + }] + }]; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + function newNodesToChanges(newNodes, insertAfter, context) { + var sourceFile = context.sourceFile; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + for (var _i = 0, newNodes_1 = newNodes; _i < newNodes_1.length; _i++) { + var newNode = newNodes_1[_i]; + changeTracker.insertNodeAfter(sourceFile, insertAfter, newNode, { suffix: context.newLineCharacter }); + } + var changes = changeTracker.getChanges(); + if (!ts.some(changes)) { + return changes; + } + ts.Debug.assert(changes.length === 1); + var consolidatedChanges = [{ + fileName: changes[0].fileName, + textChanges: [{ + span: changes[0].textChanges[0].span, + newText: changes[0].textChanges.reduce(function (prev, cur) { return prev + cur.newText; }, "") + }] + }]; + return consolidatedChanges; + } + codefix.newNodesToChanges = newNodesToChanges; + /** + * Finds members of the resolved type that are missing in the class pointed to by class decl + * and generates source code for the missing members. + * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. + * @returns Empty string iff there are no member insertions. + */ + function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, checker) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); + var newNodes = []; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + var newNode = createNewNodeForMemberSymbol(symbol, classDeclaration, checker); + if (newNode) { + if (Array.isArray(newNode)) { + newNodes = newNodes.concat(newNode); + } + else { + newNodes.push(newNode); + } } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + return newNodes; + } + codefix.createMissingMemberNodes = createMissingMemberNodes; + /** + * @returns Empty string iff there we can't figure out a representation for `symbol` in `enclosingDeclaration`. + */ + function createNewNodeForMemberSymbol(symbol, enclosingDeclaration, checker) { + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return undefined; + } + var declaration = declarations[0]; + // Clone name to remove leading trivia. + var name = ts.getSynthesizedClone(declaration.name); + var visibilityModifier = createVisibilityModifier(ts.getModifierFlags(declaration)); + var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined; + var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); + var optional = !!(symbol.flags & 67108864 /* Optional */); + switch (declaration.kind) { + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 147 /* PropertySignature */: + case 148 /* PropertyDeclaration */: + var typeNode = checker.typeToTypeNode(type, enclosingDeclaration); + var property = ts.createProperty( + /*decorators*/ undefined, modifiers, name, optional ? ts.createToken(54 /* QuestionToken */) : undefined, typeNode, + /*initializer*/ undefined); + return property; + case 149 /* MethodSignature */: + case 150 /* MethodDeclaration */: + // The signature for the implementation appears as an entry in `signatures` iff + // there is only one signature. + // If there are overloads and an implementation signature, it appears as an + // extra declaration that isn't a signature for `type`. + // If there is more than one overload but no implementation signature + // (eg: an abstract method or interface declaration), there is a 1-1 + // correspondence of declarations and signatures. + var signatures = checker.getSignaturesOfType(type, 0 /* Call */); + if (!ts.some(signatures)) { + return undefined; + } + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var signature = signatures[0]; + return signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + } + var signatureDeclarations = []; + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } + } + if (declarations.length > signatures.length) { + var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); + var methodDeclaration = signatureToMethodDeclaration(signature, enclosingDeclaration, createStubbedMethodBody()); + if (methodDeclaration) { + signatureDeclarations.push(methodDeclaration); + } } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + var methodImplementingSignatures = createMethodImplementingSignatures(signatures, name, optional, modifiers); + signatureDeclarations.push(methodImplementingSignatures); } + return signatureDeclarations; + default: + return undefined; + } + function signatureToMethodDeclaration(signature, enclosingDeclaration, body) { + var signatureDeclaration = checker.signatureToSignatureDeclaration(signature, 150 /* MethodDeclaration */, enclosingDeclaration); + if (signatureDeclaration) { + signatureDeclaration.decorators = undefined; + signatureDeclaration.modifiers = modifiers; + signatureDeclaration.name = name; + signatureDeclaration.questionToken = optional ? ts.createToken(54 /* QuestionToken */) : undefined; + signatureDeclaration.body = body; } + return signatureDeclaration; } - }); + } + function createMethodImplementingSignatures(signatures, name, optional, modifiers) { + /** This is *a* signature with the maximal number of arguments, + * such that if there is a "maximal" signature without rest arguments, + * this is one of them. + */ + var maxArgsSignature = signatures[0]; + var minArgumentCount = signatures[0].minArgumentCount; + var someSigHasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + if (sig.hasRestParameter) { + someSigHasRestParameter = true; + } + if (sig.parameters.length >= maxArgsSignature.parameters.length && (!sig.hasRestParameter || maxArgsSignature.hasRestParameter)) { + maxArgsSignature = sig; + } + } + var maxNonRestArgs = maxArgsSignature.parameters.length - (maxArgsSignature.hasRestParameter ? 1 : 0); + var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.getName(); }); + var parameters = []; + for (var i = 0; i < maxNonRestArgs; i++) { + var anyType = ts.createKeywordTypeNode(118 /* AnyKeyword */); + var newParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, maxArgsParameterSymbolNames[i], + /*questionToken*/ i >= minArgumentCount ? ts.createToken(54 /* QuestionToken */) : undefined, anyType, + /*initializer*/ undefined); + parameters.push(newParameter); + } + if (someSigHasRestParameter) { + var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(118 /* AnyKeyword */)); + var restParameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, ts.createToken(23 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.createToken(54 /* QuestionToken */) : undefined, anyArrayType, + /*initializer*/ undefined); + parameters.push(restParameter); + } + return createStubbedMethod(modifiers, name, optional, + /*typeParameters*/ undefined, parameters, + /*returnType*/ undefined); + } + function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType) { + return ts.createMethodDeclaration( + /*decorators*/ undefined, modifiers, + /*asteriskToken*/ undefined, name, optional ? ts.createToken(54 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, createStubbedMethodBody()); + } + codefix.createStubbedMethod = createStubbedMethod; + function createStubbedMethodBody() { + return ts.createBlock([ts.createThrow(ts.createNew(ts.createIdentifier("Error"), + /*typeArguments*/ undefined, [ts.createLiteral("Method not implemented.")]))], + /*multiline*/ true); + } + function createVisibilityModifier(flags) { + if (flags & 4 /* Public */) { + return ts.createToken(113 /* PublicKeyword */); + } + else if (flags & 16 /* Protected */) { + return ts.createToken(112 /* ProtectedKeyword */); + } + return undefined; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); -/// -/// -/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// /// /// /// @@ -77883,7 +84976,6 @@ var ts; /// /// /// -/// /// /// /// @@ -77897,14 +84989,15 @@ var ts; /// /// /// -/// +/// +/// /// var ts; (function (ts) { /** The version of the language service API */ ts.servicesVersion = "0.5"; function createNode(kind, pos, end, parent) { - var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) : + var node = kind >= 142 /* FirstNode */ ? new NodeObject(kind, pos, end) : kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; @@ -77962,11 +85055,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { - var node = nodes_7[_i]; + for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { + var node = nodes_9[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -77981,11 +85074,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 141 /* FirstNode */) { + if (this.kind >= 142 /* FirstNode */) { ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 282 /* FirstJSDocTagNode */ && this.kind <= 292 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -78042,8 +85135,10 @@ var ts; if (!children.length) { return undefined; } - var child = children[0]; - return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + var child = ts.find(children, function (kid) { return kid.kind < 266 /* FirstJSDocNode */ || kid.kind > 292 /* LastJSDocNode */; }); + return child.kind < 142 /* FirstNode */ ? + child : + child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -78051,7 +85146,10 @@ var ts; if (!child) { return undefined; } - return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 142 /* FirstNode */ ? child : child.getLastToken(sourceFile); + }; + NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { + return ts.forEachChild(this, cbNode, cbNodeArray); }; return NodeObject; }()); @@ -78105,6 +85203,9 @@ var ts; TokenOrIdentifierObject.prototype.getLastToken = function () { return undefined; }; + TokenOrIdentifierObject.prototype.forEachChild = function () { + return undefined; + }; return TokenOrIdentifierObject; }()); var SymbolObject = (function () { @@ -78127,6 +85228,12 @@ var ts; } return this.documentationComment; }; + SymbolObject.prototype.getJsDocTags = function () { + if (this.tags === undefined) { + this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations); + } + return this.tags; + }; return SymbolObject; }()); var TokenObject = (function (_super) { @@ -78210,6 +85317,12 @@ var ts; } return this.documentationComment; }; + SignatureObject.prototype.getJsDocTags = function () { + if (this.jsDocTags === undefined) { + this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : []; + } + return this.jsDocTags; + }; return SignatureObject; }()); var SourceFileObject = (function (_super) { @@ -78250,17 +85363,21 @@ var ts; return this.namedDeclarations; }; SourceFileObject.prototype.computeNamedDeclarations = function () { - var result = ts.createMap(); + var result = ts.createMultiMap(); ts.forEachChild(this, visit); return result; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - ts.multiMapAdd(result, name, declaration); + result.add(name, declaration); } } function getDeclarations(name) { - return result[name] || (result[name] = []); + var declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration) { if (declaration.name) { @@ -78268,9 +85385,9 @@ var ts; if (result_7 !== undefined) { return result_7; } - if (declaration.name.kind === 142 /* ComputedPropertyName */) { + if (declaration.name.kind === 143 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 177 /* PropertyAccessExpression */) { + if (expr.kind === 178 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -78290,10 +85407,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 184 /* FunctionExpression */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: + case 227 /* FunctionDeclaration */: + case 185 /* FunctionExpression */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -78310,35 +85427,35 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; - case 226 /* ClassDeclaration */: - case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 161 /* TypeLiteral */: + case 228 /* ClassDeclaration */: + case 198 /* ClassExpression */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: + case 231 /* EnumDeclaration */: + case 232 /* ModuleDeclaration */: + case 236 /* ImportEqualsDeclaration */: + case 245 /* ExportSpecifier */: + case 241 /* ImportSpecifier */: + case 236 /* ImportEqualsDeclaration */: + case 238 /* ImportClause */: + case 239 /* NamespaceImport */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 162 /* TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 144 /* Parameter */: + case 145 /* Parameter */: // Only consider parameter properties if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) { break; } - // fall through - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: { + // falls through + case 225 /* VariableDeclaration */: + case 175 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -78347,19 +85464,20 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260 /* EnumMember */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + // falls through + case 263 /* EnumMember */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: addDeclaration(node); break; - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -78371,7 +85489,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 239 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -78620,6 +85738,36 @@ var ts; }; return CancellationTokenObject; }()); + /* @internal */ + /** A cancellation that throttles calls to the host */ + var ThrottledCancellationToken = (function () { + function ThrottledCancellationToken(hostCancellationToken, throttleWaitMilliseconds) { + if (throttleWaitMilliseconds === void 0) { throttleWaitMilliseconds = 20; } + this.hostCancellationToken = hostCancellationToken; + this.throttleWaitMilliseconds = throttleWaitMilliseconds; + // Store when we last tried to cancel. Checking cancellation can be expensive (as we have + // to marshall over to the host layer). So we only bother actually checking once enough + // time has passed. + this.lastCancellationCheckTime = 0; + } + ThrottledCancellationToken.prototype.isCancellationRequested = function () { + var time = ts.timestamp(); + var duration = Math.abs(time - this.lastCancellationCheckTime); + if (duration >= this.throttleWaitMilliseconds) { + // Check no more than once every throttle wait milliseconds + this.lastCancellationCheckTime = time; + return this.hostCancellationToken.isCancellationRequested(); + } + return false; + }; + ThrottledCancellationToken.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new ts.OperationCanceledException(); + } + }; + return ThrottledCancellationToken; + }()); + ts.ThrottledCancellationToken = ThrottledCancellationToken; function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -78801,6 +85949,7 @@ var ts; ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } + // We didn't already have the file. Fall through and acquire it from the registry. } // Could not find this file in the old program, create a new SourceFile for it. return documentRegistry.acquireDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); @@ -78901,10 +86050,10 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 70 /* Identifier */: - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 96 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -78914,7 +86063,8 @@ var ts; kindModifiers: ts.ScriptElementKindModifier.none, textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)), - documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined, + tags: type.symbol ? type.symbol.getJsDocTags() : undefined }; } } @@ -78926,7 +86076,8 @@ var ts; kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: displayPartsDocumentationsAndKind.displayParts, - documentation: displayPartsDocumentationsAndKind.documentation + documentation: displayPartsDocumentationsAndKind.documentation, + tags: displayPartsDocumentationsAndKind.tags }; } /// Goto definition @@ -78934,22 +86085,23 @@ var ts; synchronizeHostData(); return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position); } - /// Goto implementation - function getImplementationAtPosition(fileName, position) { - synchronizeHostData(); - return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position)); - } function getTypeDefinitionAtPosition(fileName, position) { synchronizeHostData(); return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position); } + /// Goto implementation + function getImplementationAtPosition(fileName, position) { + synchronizeHostData(); + return ts.FindAllReferences.getImplementationsAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); + } + /// References and Occurrences function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); } return results; } @@ -78959,9 +86111,7 @@ var ts; var sourceFile = getValidSourceFile(fileName); return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch); } - /// References and Occurrences function getOccurrencesAtPositionCore(fileName, position) { - synchronizeHostData(); return convertDocumentHighlights(getDocumentHighlights(fileName, position, [fileName])); function convertDocumentHighlights(documentHighlights) { if (!documentHighlights) { @@ -78976,7 +86126,8 @@ var ts; fileName: entry.fileName, textSpan: highlightSpan.textSpan, isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference, - isDefinition: false + isDefinition: false, + isInString: highlightSpan.isInString, }); } } @@ -78984,21 +86135,18 @@ var ts; } } function findRenameLocations(fileName, position, findInStrings, findInComments) { - var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); - return ts.FindAllReferences.convertReferences(referencedSymbols); + return getReferences(fileName, position, { findInStrings: findInStrings, findInComments: findInComments, isForRename: true }); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); - return ts.FindAllReferences.convertReferences(referencedSymbols); + return getReferences(fileName, position); } - function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); - // Only include referenced symbols that have a valid definition. - return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); + function getReferences(fileName, position, options) { + synchronizeHostData(); + return ts.FindAllReferences.findReferencedEntries(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, options); } - function findReferencedSymbols(fileName, position, findInStrings, findInComments) { + function findReferences(fileName, position) { synchronizeHostData(); - return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); } /// NavigateTo function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { @@ -79017,7 +86165,8 @@ var ts; text: data }); } - var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles); + var customTransformers = host.getCustomTransformers && host.getCustomTransformers(); + var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); return { outputFiles: outputFiles, emitSkipped: emitOutput.emitSkipped @@ -79047,15 +86196,15 @@ var ts; return; } switch (node.kind) { - case 177 /* PropertyAccessExpression */: - case 141 /* QualifiedName */: + case 178 /* PropertyAccessExpression */: + case 142 /* QualifiedName */: case 9 /* StringLiteral */: case 85 /* FalseKeyword */: case 100 /* TrueKeyword */: case 94 /* NullKeyword */: case 96 /* SuperKeyword */: case 98 /* ThisKeyword */: - case 167 /* ThisType */: + case 168 /* ThisType */: case 70 /* Identifier */: break; // Cant create the text span @@ -79072,7 +86221,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 230 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 232 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -79095,10 +86244,10 @@ var ts; return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); } function getNavigationBarItems(fileName) { - return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName)); + return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); } function getNavigationTree(fileName) { - return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName)); + return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName), cancellationToken); } function isTsOrTsxFile(fileName) { var kind = ts.getScriptKind(fileName, host); @@ -79131,7 +86280,7 @@ var ts; function getOutliningSpans(fileName) { // doesn't use compiler - no need to synchronize with host var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.OutliningElementsCollector.collectElements(sourceFile); + return ts.OutliningElementsCollector.collectElements(sourceFile, cancellationToken); } function getBraceMatchingAtPosition(fileName, position) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); @@ -79209,13 +86358,13 @@ var ts; } return []; } - function getCodeFixesAtPosition(fileName, start, end, errorCodes) { + function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var span = { start: start, length: end - start }; var newLineChar = ts.getNewLineOrDefaultFromHost(host); var allFixes = []; - ts.forEach(errorCodes, function (error) { + ts.forEach(ts.deduplicate(errorCodes), function (error) { cancellationToken.throwIfCancellationRequested(); var context = { errorCode: error, @@ -79224,7 +86373,8 @@ var ts; program: program, newLineCharacter: newLineChar, host: host, - cancellationToken: cancellationToken + cancellationToken: cancellationToken, + rulesProvider: getRuleProvider(formatOptions) }; var fixes = ts.codefix.getFixes(context); if (fixes) { @@ -79248,7 +86398,7 @@ var ts; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -79304,7 +86454,7 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + for (var i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -79435,6 +86585,7 @@ var ts; } ts.createLanguageService = createLanguageService; /* @internal */ + /** Names in the name table are escaped, so an identifier `__foo` will have a name table entry `___foo`. */ function getNameTable(sourceFile) { if (!sourceFile.nameTable) { initializeNameTable(sourceFile); @@ -79449,7 +86600,7 @@ var ts; function walk(node) { switch (node.kind) { case 70 /* Identifier */: - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); break; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: @@ -79458,10 +86609,10 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 245 /* ExternalModuleReference */ || + node.parent.kind === 247 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { - nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; + setNameTable(node.text, node); } break; default: @@ -79474,18 +86625,79 @@ var ts; } } } + function setNameTable(text, node) { + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); + } } + function isObjectLiteralElement(node) { + switch (node.kind) { + case 252 /* JsxAttribute */: + case 254 /* JsxSpreadAttribute */: + case 260 /* PropertyAssignment */: + case 261 /* ShorthandPropertyAssignment */: + case 150 /* MethodDeclaration */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + return true; + } + return false; + } + /** + * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } + */ + /* @internal */ + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + if (node.parent.kind === 143 /* ComputedPropertyName */) { + return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; + } + // falls through + case 70 /* Identifier */: + return isObjectLiteralElement(node.parent) && + (node.parent.parent.kind === 177 /* ObjectLiteralExpression */ || node.parent.parent.kind === 253 /* JsxAttributes */) && + node.parent.name === node ? node.parent : undefined; + } + return undefined; + } + ts.getContainingObjectLiteralElement = getContainingObjectLiteralElement; + /* @internal */ + function getPropertySymbolsFromContextualType(typeChecker, node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = ts.getTextOfPropertyName(node.name); + if (name && contextualType) { + var result_8 = []; + var symbol = contextualType.getProperty(name); + if (contextualType.flags & 65536 /* Union */) { + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result_8.push(symbol); + } + }); + return result_8; + } + if (symbol) { + result_8.push(symbol); + return result_8; + } + } + return undefined; + } + ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 178 /* ElementAccessExpression */ && + node.parent.kind === 179 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** - * Get the path of the default library files (lib.d.ts) as distributed with the typescript - * node package. - * The functionality is not supported if the ts module is consumed outside of a node module. - */ + * Get the path of the default library files (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ function getDefaultLibFilePath(options) { // Check __dirname is defined and that we are on a node.js system. if (typeof __dirname !== "undefined") { @@ -79494,10 +86706,7 @@ var ts; throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); } ts.getDefaultLibFilePath = getDefaultLibFilePath; - function initializeServices() { - ts.objectAllocator = getServicesObjectAllocator(); - } - initializeServices(); + ts.objectAllocator = getServicesObjectAllocator(); })(ts || (ts = {})); // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -79562,113 +86771,114 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205 /* VariableStatement */: + case 207 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223 /* VariableDeclaration */: - case 147 /* PropertyDeclaration */: - case 146 /* PropertySignature */: + case 225 /* VariableDeclaration */: + case 148 /* PropertyDeclaration */: + case 147 /* PropertySignature */: return spanInVariableDeclaration(node); - case 144 /* Parameter */: + case 145 /* Parameter */: return spanInParameterDeclaration(node); - case 225 /* FunctionDeclaration */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 184 /* FunctionExpression */: - case 185 /* ArrowFunction */: + case 227 /* FunctionDeclaration */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 185 /* FunctionExpression */: + case 186 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 204 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - // Fall through - case 231 /* ModuleBlock */: + // falls through + case 233 /* ModuleBlock */: return spanInBlock(node); - case 256 /* CatchClause */: + case 259 /* CatchClause */: return spanInBlock(node.block); - case 207 /* ExpressionStatement */: + case 209 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 216 /* ReturnStatement */: + case 218 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 210 /* WhileStatement */: + case 212 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 209 /* DoStatement */: + case 211 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 222 /* DebuggerStatement */: + case 224 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 208 /* IfStatement */: + case 210 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 219 /* LabeledStatement */: + case 221 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 217 /* BreakStatement */: + case 216 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 211 /* ForStatement */: + case 213 /* ForStatement */: return spanInForStatement(node); - case 212 /* ForInStatement */: + case 214 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 213 /* ForOfStatement */: + case 215 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 218 /* SwitchStatement */: + case 220 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 256 /* CaseClause */: + case 257 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 221 /* TryStatement */: + case 223 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 220 /* ThrowStatement */: + case 222 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 240 /* ExportAssignment */: + case 242 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 235 /* ImportDeclaration */: + case 237 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 241 /* ExportDeclaration */: + case 243 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 174 /* BindingElement */: + // falls through + case 228 /* ClassDeclaration */: + case 231 /* EnumDeclaration */: + case 263 /* EnumMember */: + case 175 /* BindingElement */: // span on complete node return textSpan(node); - case 217 /* WithStatement */: + case 219 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 145 /* Decorator */: + case 146 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: + case 173 /* ObjectBindingPattern */: + case 174 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 229 /* InterfaceDeclaration */: + case 230 /* TypeAliasDeclaration */: return undefined; // Tokens: case 24 /* SemicolonToken */: @@ -79698,7 +86908,7 @@ var ts; case 73 /* CatchKeyword */: case 86 /* FinallyKeyword */: return spanInNextNode(node); - case 140 /* OfKeyword */: + case 141 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -79711,13 +86921,13 @@ var ts; // a or ...c or d: x from // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 70 /* Identifier */ || - node.kind == 196 /* SpreadElement */ || - node.kind === 257 /* PropertyAssignment */ || - node.kind === 258 /* ShorthandPropertyAssignment */) && + node.kind === 197 /* SpreadElement */ || + node.kind === 260 /* PropertyAssignment */ || + node.kind === 261 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 192 /* BinaryExpression */) { + if (node.kind === 193 /* BinaryExpression */) { var binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -79740,22 +86950,22 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209 /* DoStatement */: + case 211 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 145 /* Decorator */: + case 146 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return textSpan(node); - case 192 /* BinaryExpression */: + case 193 /* BinaryExpression */: if (node.parent.operatorToken.kind === 25 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 185 /* ArrowFunction */: + case 186 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -79764,13 +86974,13 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 257 /* PropertyAssignment */ && + if (node.parent.kind === 260 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 182 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 183 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNextNode(node.parent.type); } // return type of function go to previous token @@ -79778,8 +86988,8 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 223 /* VariableDeclaration */ || - node.parent.kind === 144 /* Parameter */)) { + if ((node.parent.kind === 225 /* VariableDeclaration */ || + node.parent.kind === 145 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -79787,7 +86997,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 192 /* BinaryExpression */) { + if (node.parent.kind === 193 /* BinaryExpression */) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -79801,8 +87011,8 @@ var ts; } } function textSpanFromVariableDeclaration(variableDeclaration) { - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] === variableDeclaration) { + if (variableDeclaration.parent.kind === 226 /* VariableDeclarationList */ && + variableDeclaration.parent.declarations[0] === variableDeclaration) { // First declaration - include let keyword return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); } @@ -79813,7 +87023,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 212 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 214 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -79824,11 +87034,11 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 213 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 215 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } - var declarations = variableDeclaration.parent.declarations; - if (declarations && declarations[0] !== variableDeclaration) { + if (variableDeclaration.parent.kind === 226 /* VariableDeclarationList */ && + variableDeclaration.parent.declarations[0] !== variableDeclaration) { // If we cannot set breakpoint on this declaration, set it on previous one // Because the variable declaration may be binding pattern and // we would like to set breakpoint in last binding element if that's the case, @@ -79864,7 +87074,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 226 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); + (functionDeclaration.parent.kind === 228 /* ClassDeclaration */ && functionDeclaration.kind !== 151 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -79887,25 +87097,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230 /* ModuleDeclaration */: + case 232 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } + // falls through // Set on parent if on same line otherwise on first statement - case 210 /* WhileStatement */: - case 208 /* IfStatement */: - case 212 /* ForInStatement */: + case 212 /* WhileStatement */: + case 210 /* IfStatement */: + case 214 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 226 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -79930,23 +87141,23 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 174 /* BindingElement */) { + if (bindingPattern.parent.kind === 175 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 173 /* ArrayBindingPattern */ && node.kind !== 172 /* ObjectBindingPattern */); - var elements = node.kind === 175 /* ArrayLiteralExpression */ ? + ts.Debug.assert(node.kind !== 174 /* ArrayBindingPattern */ && node.kind !== 173 /* ObjectBindingPattern */); + var elements = node.kind === 176 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 199 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -79954,18 +87165,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 192 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 193 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229 /* EnumDeclaration */: + case 231 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226 /* ClassDeclaration */: + case 228 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -79973,24 +87184,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231 /* ModuleBlock */: + case 233 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 229 /* EnumDeclaration */: - case 226 /* ClassDeclaration */: + // falls through + case 231 /* EnumDeclaration */: + case 228 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 204 /* Block */: + case 206 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } - // fall through - case 256 /* CatchClause */: + // falls through + case 259 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232 /* CaseBlock */: + case 234 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -79998,7 +87210,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 172 /* ObjectBindingPattern */: + case 173 /* ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -80014,7 +87226,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 173 /* ArrayBindingPattern */: + case 174 /* ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -80029,12 +87241,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 /* DoStatement */ || - node.parent.kind === 179 /* CallExpression */ || - node.parent.kind === 180 /* NewExpression */) { + if (node.parent.kind === 211 /* DoStatement */ || + node.parent.kind === 180 /* CallExpression */ || + node.parent.kind === 181 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 183 /* ParenthesizedExpression */) { + if (node.parent.kind === 184 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -80043,21 +87255,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: - case 185 /* ArrowFunction */: - case 149 /* MethodDeclaration */: - case 148 /* MethodSignature */: - case 151 /* GetAccessor */: - case 152 /* SetAccessor */: - case 150 /* Constructor */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: - case 179 /* CallExpression */: - case 180 /* NewExpression */: - case 183 /* ParenthesizedExpression */: + case 185 /* FunctionExpression */: + case 227 /* FunctionDeclaration */: + case 186 /* ArrowFunction */: + case 150 /* MethodDeclaration */: + case 149 /* MethodSignature */: + case 152 /* GetAccessor */: + case 153 /* SetAccessor */: + case 151 /* Constructor */: + case 212 /* WhileStatement */: + case 211 /* DoStatement */: + case 213 /* ForStatement */: + case 215 /* ForOfStatement */: + case 180 /* CallExpression */: + case 181 /* NewExpression */: + case 184 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -80067,20 +87279,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 /* PropertyAssignment */ || - node.parent.kind === 144 /* Parameter */) { + node.parent.kind === 260 /* PropertyAssignment */ || + node.parent.kind === 145 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 182 /* TypeAssertionExpression */) { + if (node.parent.kind === 183 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209 /* DoStatement */) { + if (node.parent.kind === 211 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -80088,7 +87300,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213 /* ForOfStatement */) { + if (node.parent.kind === 215 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -80100,6 +87312,26 @@ var ts; BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation; })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})); })(ts || (ts = {})); +/// +/// +var ts; +(function (ts) { + /** + * Transform one or more nodes using the supplied transformers. + * @param source A single `Node` or an array of `Node` objects. + * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. + * @param compilerOptions Optional compiler options. + */ + function transform(source, transformers, compilerOptions) { + var diagnostics = []; + compilerOptions = ts.fixupCompilerOptions(compilerOptions, diagnostics); + var nodes = ts.isArray(source) ? source : [source]; + var result = ts.transformNodes(/*resolver*/ undefined, /*emitHost*/ undefined, compilerOptions, nodes, transformers, /*allowDtsFiles*/ true); + result.diagnostics = ts.concatenate(result.diagnostics, diagnostics); + return result; + } + ts.transform = transform; +})(ts || (ts = {})); // // Copyright (c) Microsoft Corporation. All rights reserved. // @@ -80141,8 +87373,7 @@ var ts; ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { var oldSnapshotShim = oldSnapshot; var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); - // TODO: should this be '==='? - if (encoded == null) { + if (encoded === null) { return null; } var decoded = JSON.parse(encoded); @@ -80215,11 +87446,13 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { var settingsJson = this.shimHost.getCompilationSettings(); - // TODO: should this be '==='? - if (settingsJson == null || settingsJson == "") { + if (settingsJson === null || settingsJson === "") { throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); } - return JSON.parse(settingsJson); + var compilerOptions = JSON.parse(settingsJson); + // permit language service to handle all files (filtering should be performed on the host side) + compilerOptions.allowNonTsExtensions = true; + return compilerOptions; }; LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { var encoded = this.shimHost.getScriptFileNames(); @@ -80242,7 +87475,7 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); - if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") { return null; } try { @@ -80255,7 +87488,7 @@ var ts; }; LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { var hostCancellationToken = this.shimHost.getCancellationToken(); - return new ThrottledCancellationToken(hostCancellationToken); + return new ts.ThrottledCancellationToken(hostCancellationToken); }; LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { return this.shimHost.getCurrentDirectory(); @@ -80279,27 +87512,6 @@ var ts; return LanguageServiceShimHostAdapter; }()); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; - /** A cancellation that throttles calls to the host */ - var ThrottledCancellationToken = (function () { - function ThrottledCancellationToken(hostCancellationToken) { - this.hostCancellationToken = hostCancellationToken; - // Store when we last tried to cancel. Checking cancellation can be expensive (as we have - // to marshall over to the host layer). So we only bother actually checking once enough - // time has passed. - this.lastCancellationCheckTime = 0; - } - ThrottledCancellationToken.prototype.isCancellationRequested = function () { - var time = ts.timestamp(); - var duration = Math.abs(time - this.lastCancellationCheckTime); - if (duration > 10) { - // Check no more than once every 10 ms. - this.lastCancellationCheckTime = time; - return this.hostCancellationToken.isCancellationRequested(); - } - return false; - }; - return ThrottledCancellationToken; - }()); var CoreServicesShimHostAdapter = (function () { function CoreServicesShimHostAdapter(shimHost) { var _this = this; @@ -80727,12 +87939,6 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { - return { - resolvedFileName: undefined, - failedLookupLocations: [] - }; - } return { resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations @@ -80877,7 +88083,7 @@ var ts; this._shims.push(shim); }; TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (var i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; @@ -80906,4 +88112,4 @@ var TypeScript; // 'toolsVersion' gets consumed by the managed side, so it's not unused. // TODO: it should be moved into a namespace though. /* @internal */ -var toolsVersion = "2.2"; +var toolsVersion = "2.3"; diff --git a/node_modules/typescript/lib/typingsInstaller.js b/node_modules/typescript/lib/typingsInstaller.js index 904f1444d..3e48c048f 100644 --- a/node_modules/typescript/lib/typingsInstaller.js +++ b/node_modules/typescript/lib/typingsInstaller.js @@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +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 __()); + }; +})(); var ts; (function (ts) { var OperationCanceledException = (function () { @@ -32,6 +37,16 @@ var ts; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var NodeBuilderFlags; + (function (NodeBuilderFlags) { + NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None"; + NodeBuilderFlags[NodeBuilderFlags["allowThisInObjectLiteral"] = 1] = "allowThisInObjectLiteral"; + NodeBuilderFlags[NodeBuilderFlags["allowQualifedNameInPlaceOfIdentifier"] = 2] = "allowQualifedNameInPlaceOfIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowTypeParameterInQualifiedName"] = 4] = "allowTypeParameterInQualifiedName"; + NodeBuilderFlags[NodeBuilderFlags["allowAnonymousIdentifier"] = 8] = "allowAnonymousIdentifier"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyUnionOrIntersection"] = 16] = "allowEmptyUnionOrIntersection"; + NodeBuilderFlags[NodeBuilderFlags["allowEmptyTuple"] = 32] = "allowEmptyTuple"; + })(NodeBuilderFlags = ts.NodeBuilderFlags || (ts.NodeBuilderFlags = {})); var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown"; @@ -93,32 +108,32 @@ var ts; var measures; function mark(markName) { if (enabled) { - marks[markName] = ts.timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, ts.timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } performance.mark = mark; function measure(measureName, startMarkName, endMarkName) { if (enabled) { - var end = endMarkName && marks[endMarkName] || ts.timestamp(); - var start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + var end = endMarkName && marks.get(endMarkName) || ts.timestamp(); + var start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } performance.measure = measure; function getCount(markName) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } performance.getCount = getCount; function getDuration(measureName) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } performance.getDuration = getDuration; function forEachMeasure(cb) { - for (var key in measures) { - cb(key, measures[key]); - } + measures.forEach(function (measure, key) { + cb(key, measure); + }); } performance.forEachMeasure = forEachMeasure; function enable() { @@ -137,22 +152,96 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.2.0-dev.20161127"; + ts.version = "2.3.0-dev.20170419"; })(ts || (ts = {})); (function (ts) { - var createObject = Object.create; - ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - function createMap(template) { - var map = createObject(null); + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; + ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + function createDictionaryObject() { + var map = Object.create(null); map["__"] = undefined; delete map["__"]; + return map; + } + function createMap() { + return new MapCtr(); + } + ts.createMap = createMap; + function createMapFromTemplate(template) { + var map = new MapCtr(); for (var key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } - ts.createMap = createMap; + ts.createMapFromTemplate = createMapFromTemplate; + var MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); + function shimMap() { + var MapIterator = (function () { + function MapIterator(data, selector) { + this.index = 0; + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + MapIterator.prototype.next = function () { + var index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined, done: true }; + }; + return MapIterator; + }()); + return (function () { + function class_1() { + this.data = createDictionaryObject(); + this.size = 0; + } + class_1.prototype.get = function (key) { + return this.data[key]; + }; + class_1.prototype.set = function (key, value) { + if (!this.has(key)) { + this.size++; + } + this.data[key] = value; + return this; + }; + class_1.prototype.has = function (key) { + return key in this.data; + }; + class_1.prototype.delete = function (key) { + if (this.has(key)) { + this.size--; + delete this.data[key]; + return true; + } + return false; + }; + class_1.prototype.clear = function () { + this.data = createDictionaryObject(); + this.size = 0; + }; + class_1.prototype.keys = function () { + return new MapIterator(this.data, function (_data, key) { return key; }); + }; + class_1.prototype.values = function () { + return new MapIterator(this.data, function (data, key) { return data[key]; }); + }; + class_1.prototype.entries = function () { + return new MapIterator(this.data, function (data, key) { return [key, data[key]]; }); + }; + class_1.prototype.forEach = function (action) { + for (var key in this.data) { + action(this.data[key], key); + } + }; + return class_1; + }()); + } function createFileMap(keyMapper) { var files = createMap(); return { @@ -165,32 +254,27 @@ var ts; clear: clear, }; function forEachValueInMap(f) { - for (var key in files) { - f(key, files[key]); - } + files.forEach(function (file, key) { + f(key, file); + }); } function getKeys() { - var keys = []; - for (var key in files) { - keys.push(key); - } - return keys; + return arrayFrom(files.keys()); } function get(path) { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path, value) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path) { - var key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path) { return keyMapper ? keyMapper(path) : path; @@ -204,9 +288,13 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + function length(array) { + return array ? array.length : 0; + } + ts.length = length; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -216,6 +304,20 @@ var ts; return undefined; } ts.forEach = forEach; + function findAncestor(node, callback) { + while (node) { + var result = callback(node); + if (result === "quit") { + return undefined; + } + else if (result) { + return node; + } + node = node.parent; + } + return undefined; + } + ts.findAncestor = findAncestor; function zipWith(arrayA, arrayB, callback) { Debug.assert(arrayA.length === arrayB.length); for (var i = 0; i < arrayA.length; i++) { @@ -225,7 +327,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -235,7 +337,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -244,8 +346,17 @@ var ts; return undefined; } ts.find = find; + function findIndex(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + ts.findIndex = findIndex; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -268,7 +379,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -278,7 +389,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -465,21 +576,18 @@ var ts; return result; } ts.spanMap = spanMap; - function mapObject(object, f) { - var result; - if (object) { - result = {}; - for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { - var v = _a[_i]; - var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; - if (key !== undefined) { - result[key] = value; - } - } + function mapEntries(map, f) { + if (!map) { + return undefined; } + var result = createMap(); + map.forEach(function (value, key) { + var _a = f(key, value), newKey = _a[0], newValue = _a[1]; + result.set(newKey, newValue); + }); return result; } - ts.mapObject = mapObject; + ts.mapEntries = mapEntries; function some(array, predicate) { if (array) { if (predicate) { @@ -763,38 +871,55 @@ var ts; return keys; } ts.getOwnKeys = getOwnKeys; - function forEachProperty(map, callback) { - var result; - for (var key in map) { - if (result = callback(map[key], key)) - break; + function arrayFrom(iterator, map) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(map ? map(value) : value); } return result; + var _b; } - ts.forEachProperty = forEachProperty; - function someProperties(map, predicate) { - for (var key in map) { - if (!predicate || predicate(map[key], key)) - return true; + ts.arrayFrom = arrayFrom; + function convertToArray(iterator, f) { + var result = []; + for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { + result.push(f(value)); } - return false; + return result; + var _b; + } + ts.convertToArray = convertToArray; + function forEachEntry(map, callback) { + var iterator = map.entries(); + for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { + var key = pair[0], value = pair[1]; + var result = callback(value, key); + if (result) { + return result; + } + } + return undefined; + var _b; } - ts.someProperties = someProperties; - function copyProperties(source, target) { - for (var key in source) { - target[key] = source[key]; + ts.forEachEntry = forEachEntry; + function forEachKey(map, callback) { + var iterator = map.keys(); + for (var _a = iterator.next(), key = _a.value, done = _a.done; !done; _b = iterator.next(), key = _b.value, done = _b.done, _b) { + var result = callback(key); + if (result) { + return result; + } } + return undefined; + var _b; } - ts.copyProperties = copyProperties; - function appendProperty(map, key, value) { - if (key === undefined || value === undefined) - return map; - if (map === undefined) - map = createMap(); - map[key] = value; - return map; + ts.forEachKey = forEachKey; + function copyEntries(source, target) { + source.forEach(function (value, key) { + target.set(key, value); + }); } - ts.appendProperty = appendProperty; + ts.copyEntries = copyEntries; function assign(t) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { @@ -802,31 +927,14 @@ var ts; } for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { var arg = args_1[_a]; - for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) { - var p = _c[_b]; - t[p] = arg[p]; - } + for (var p in arg) + if (hasProperty(arg, p)) { + t[p] = arg[p]; + } } return t; } ts.assign = assign; - function reduceProperties(map, callback, initial) { - var result = initial; - for (var key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceProperties = reduceProperties; - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; function equalOwnProperties(left, right, equalityComparer) { if (left === right) return true; @@ -851,23 +959,14 @@ var ts; var result = createMap(); for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { var value = array_8[_i]; - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; - function isEmpty(map) { - for (var id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } - ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); - copyProperties(map, clone); + copyEntries(map, clone); return clone; } ts.cloneMap = cloneMap; @@ -894,27 +993,32 @@ var ts; return result; } ts.extend = extend; - function multiMapAdd(map, key, value) { - var values = map[key]; + function createMultiMap() { + var map = createMap(); + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + ts.createMultiMap = createMultiMap; + function multiMapAdd(key, value) { + var values = this.get(key); if (values) { values.push(value); - return values; } else { - return map[key] = [value]; + this.set(key, values = [value]); } + return values; } - ts.multiMapAdd = multiMapAdd; - function multiMapRemove(map, key, value) { - var values = map[key]; + function multiMapRemove(key, value) { + var values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + this.delete(key); } } } - ts.multiMapRemove = multiMapRemove; function isArray(value) { return Array.isArray ? Array.isArray(value) : value instanceof Array; } @@ -990,6 +1094,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -1091,8 +1196,10 @@ var ts; if (b === undefined) return 1; if (ignoreCase) { - if (ts.collator && String.prototype.localeCompare) { - var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); + if (ts.collator) { + var result = ts.localeCompareIsCorrect ? + ts.collator.compare(a, b) : + a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 : result > 0 ? 1 : 0; } a = a.toUpperCase(); @@ -1474,36 +1581,26 @@ var ts; var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; var singleAsteriskRegexFragmentOther = "[^/]*"; function getRegularExpressionForWildcard(specs, basePath, usage) { + var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); + if (!patterns || !patterns.length) { + return undefined; + } + var pattern = patterns.map(function (pattern) { return "(" + pattern + ")"; }).join("|"); + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; + } + ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + function getRegularExpressionsForWildcards(specs, basePath, usage) { if (specs === undefined || specs.length === 0) { return undefined; } var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; - var pattern = ""; - var hasWrittenSubpattern = false; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!spec) { - continue; - } - var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); - if (subPattern === undefined) { - continue; - } - if (hasWrittenSubpattern) { - pattern += "|"; - } - pattern += "(" + subPattern + ")"; - hasWrittenSubpattern = true; - } - if (!pattern) { - return undefined; - } - var terminator = usage === "exclude" ? "($|/)" : "$"; - return "^(" + pattern + ")" + terminator; + return flatMap(specs, function (spec) { + return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + }); } - ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } @@ -1573,6 +1670,7 @@ var ts; currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); return { + includeFilePatterns: map(getRegularExpressionsForWildcards(includes, absolutePath, "files"), function (pattern) { return "^" + pattern + "$"; }), includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), @@ -1585,34 +1683,48 @@ var ts; currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; - var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); + var includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(function (pattern) { return new RegExp(pattern, regexFlag); }); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); var excludeRegex = patterns.excludePattern && new RegExp(patterns.excludePattern, regexFlag); - var result = []; + var results = includeFileRegexes ? includeFileRegexes.map(function () { return []; }) : [[]]; + var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; visitDirectory(basePath, combinePaths(currentDirectory, basePath)); } - return result; + return flatten(results); function visitDirectory(path, absolutePath) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; - for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { - var current = files_1[_i]; - var name_1 = combinePaths(path, current); + files = files.slice().sort(comparer); + directories = directories.slice().sort(comparer); + var _loop_1 = function (current) { + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); - if ((!extensions || fileExtensionIsAny(name_1, extensions)) && - (!includeFileRegex || includeFileRegex.test(absoluteName)) && - (!excludeRegex || !excludeRegex.test(absoluteName))) { - result.push(name_1); + if (extensions && !fileExtensionIsAny(name, extensions)) + return "continue"; + if (excludeRegex && excludeRegex.test(absoluteName)) + return "continue"; + if (!includeFileRegexes) { + results[0].push(name); + } + else { + var includeIndex = findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); }); + if (includeIndex !== -1) { + results[includeIndex].push(name); + } } + }; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var current = files_1[_i]; + _loop_1(current); } for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; - var name_2 = combinePaths(path, current); + var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name_2, absoluteName); + visitDirectory(name, absoluteName); } } } @@ -1628,14 +1740,14 @@ var ts; includeBasePaths.push(getIncludeBasePath(absolute)); } includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); - var _loop_1 = function (includeBasePath) { + var _loop_2 = function (includeBasePath) { if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { basePaths.push(includeBasePath); } }; for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { var includeBasePath = includeBasePaths_1[_a]; - _loop_1(includeBasePath); + _loop_2(includeBasePath); } } return basePaths; @@ -1673,8 +1785,19 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = allSupportedExtensions.slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (extensions.indexOf(extInfo.extension) === -1) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -1685,11 +1808,11 @@ var ts; return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); } ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; - function isSupportedSourceFileName(fileName, compilerOptions) { + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -1701,30 +1824,30 @@ var ts; function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--) { if (fileExtensionIs(path, supportedExtensions[i])) { - return adjustExtensionPriority(i); + return adjustExtensionPriority(i, supportedExtensions); } } return 0; } ts.getExtensionPriority = getExtensionPriority; - function adjustExtensionPriority(extensionPriority) { + function adjustExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 0; } - else if (extensionPriority < 5) { + else if (extensionPriority < supportedExtensions.length) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.adjustExtensionPriority = adjustExtensionPriority; - function getNextLowestExtensionPriority(extensionPriority) { + function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) { if (extensionPriority < 2) { return 2; } else { - return 5; + return supportedExtensions.length; } } ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority; @@ -1933,136 +2056,29 @@ var ts; } } ts.tryGetExtensionFromPath = tryGetExtensionFromPath; + function isCheckJsEnabledForFile(sourceFile, compilerOptions) { + return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; + } + ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile; })(ts || (ts = {})); var ts; (function (ts) { - ts.sys = (function () { - function getWScriptSystem() { - var fso = new ActiveXObject("Scripting.FileSystemObject"); - var shell = new ActiveXObject("WScript.Shell"); - var fileStream = new ActiveXObject("ADODB.Stream"); - fileStream.Type = 2; - var binaryStream = new ActiveXObject("ADODB.Stream"); - binaryStream.Type = 1; - var args = []; - for (var i = 0; i < WScript.Arguments.length; i++) { - args[i] = WScript.Arguments.Item(i); - } - function readFile(fileName, encoding) { - if (!fso.FileExists(fileName)) { - return undefined; - } - fileStream.Open(); - try { - if (encoding) { - fileStream.Charset = encoding; - fileStream.LoadFromFile(fileName); - } - else { - fileStream.Charset = "x-ansi"; - fileStream.LoadFromFile(fileName); - var bom = fileStream.ReadText(2) || ""; - fileStream.Position = 0; - fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; - } - return fileStream.ReadText(); - } - catch (e) { - throw e; - } - finally { - fileStream.Close(); - } - } - function writeFile(fileName, data, writeByteOrderMark) { - fileStream.Open(); - binaryStream.Open(); - try { - fileStream.Charset = "utf-8"; - fileStream.WriteText(data); - if (writeByteOrderMark) { - fileStream.Position = 0; - } - else { - fileStream.Position = 3; - } - fileStream.CopyTo(binaryStream); - binaryStream.SaveToFile(fileName, 2); - } - finally { - binaryStream.Close(); - fileStream.Close(); - } - } - function getNames(collection) { - var result = []; - for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { - result.push(e.item().Name); - } - return result.sort(); - } - function getDirectories(path) { - var folder = fso.GetFolder(path); - return getNames(folder.subfolders); - } - function getAccessibleFileSystemEntries(path) { - try { - var folder = fso.GetFolder(path || "."); - var files = getNames(folder.files); - var directories = getNames(folder.subfolders); - return { files: files, directories: directories }; - } - catch (e) { - return { files: [], directories: [] }; - } - } - function readDirectory(path, extensions, excludes, includes) { - return ts.matchFiles(path, extensions, excludes, includes, false, shell.CurrentDirectory, getAccessibleFileSystemEntries); - } - var wscriptSystem = { - args: args, - newLine: "\r\n", - useCaseSensitiveFileNames: false, - write: function (s) { - WScript.StdOut.Write(s); - }, - readFile: readFile, - writeFile: writeFile, - resolvePath: function (path) { - return fso.GetAbsolutePathName(path); - }, - fileExists: function (path) { - return fso.FileExists(path); - }, - directoryExists: function (path) { - return fso.FolderExists(path); - }, - createDirectory: function (directoryName) { - if (!wscriptSystem.directoryExists(directoryName)) { - fso.CreateFolder(directoryName); - } - }, - getExecutingFilePath: function () { - return WScript.ScriptFullName; - }, - getCurrentDirectory: function () { - return shell.CurrentDirectory; - }, - getDirectories: getDirectories, - getEnvironmentVariable: function (name) { - return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%" + name + "%"); - }, - readDirectory: readDirectory, - exit: function (exitCode) { - try { - WScript.Quit(exitCode); - } - catch (e) { - } - } - }; - return wscriptSystem; + function getNodeMajorVersion() { + if (typeof process === "undefined") { + return undefined; + } + var version = process.version; + if (!version) { + return undefined; + } + var dot = version.indexOf("."); + if (dot === -1) { + return undefined; } + return parseInt(version.substring(1, dot)); + } + ts.getNodeMajorVersion = getNodeMajorVersion; + ts.sys = (function () { function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); @@ -2071,32 +2087,32 @@ var ts; var useNonPollingWatchers = process.env["TSC_NONPOLLING_WATCHER"]; function createWatchedFileSet() { var dirWatchers = ts.createMap(); - var fileWatcherCallbacks = ts.createMap(); + var fileWatcherCallbacks = ts.createMultiMap(); return { addFile: addFile, removeFile: removeFile }; function reduceDirWatcherRefCountForFile(fileName) { var dirName = ts.getDirectoryPath(fileName); - var watcher = dirWatchers[dirName]; + var watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath) { - var watcher = dirWatchers[dirPath]; + var watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; } watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } function addFileWatcherCallback(filePath, callback) { - ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2108,24 +2124,26 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { var fileName = typeof relativeFileName !== "string" ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { - var fileCallback = _a[_i]; - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + var callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var fileCallback = callbacks_1[_i]; + fileCallback(fileName); + } } } } } var watchedFileSet = createWatchedFileSet(); - function isNode4OrLater() { - return parseInt(process.version.charAt(1)) >= 4; - } + var nodeVersion = getNodeMajorVersion(); + var isNode4OrLater = nodeVersion >= 4; function isFileSystemCaseSensitive() { if (platform === "win32" || platform === "win64") { return false; @@ -2182,10 +2200,10 @@ var ts; if (entry === "." || entry === "..") { continue; } - var name_3 = ts.combinePaths(path, entry); + var name = ts.combinePaths(path, entry); var stat = void 0; try { - stat = _fs.statSync(name_3); + stat = _fs.statSync(name); } catch (e) { continue; @@ -2262,7 +2280,7 @@ var ts; if (!directoryExists(directoryName)) { return noOpFileWatcher; } - if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } else { @@ -2272,7 +2290,6 @@ var ts; if (eventName === "rename") { callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } - ; }); }, resolvePath: function (path) { @@ -2389,9 +2406,6 @@ var ts; if (typeof ChakraHost !== "undefined") { sys = getChakraSystem(); } - else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - sys = getWScriptSystem(); - } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { sys = getNodeSystem(); } @@ -2460,11 +2474,11 @@ var ts; Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, - Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { code: 1059, category: ts.DiagnosticCategory.Error, key: "Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059", message: "Return expression in async function does not have a valid callable 'then' member." }, - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { code: 1060, category: ts.DiagnosticCategory.Error, key: "Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060", message: "Expression body for async arrow function does not have a valid callable 'then' member." }, + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", message: "The return type of an async function must either be a valid promise or must not contain a callable 'then' member." }, + A_promise_must_have_a_then_method: { code: 1059, category: ts.DiagnosticCategory.Error, key: "A_promise_must_have_a_then_method_1059", message: "A promise must have a 'then' method." }, + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: { code: 1060, category: ts.DiagnosticCategory.Error, key: "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", message: "The first parameter of the 'then' method of a promise must be a callback." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise type." }, In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, @@ -2473,7 +2487,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2489,6 +2503,7 @@ var ts; Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, + A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: { code: 1103, category: ts.DiagnosticCategory.Error, key: "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", message: "A 'for-await-of' statement is only allowed within an async function or async generator." }, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, @@ -2496,7 +2511,7 @@ var ts; Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'" }, + Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'." }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, @@ -2528,9 +2543,9 @@ var ts; Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", message: "Cannot use imports, exports, or module augmentations when '--module' is 'none'." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing" }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing." }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized" }, + const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized." }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, @@ -2579,11 +2594,12 @@ var ts; Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name" }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode" }, + A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." }, Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." }, @@ -2629,6 +2645,11 @@ var ts; Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1320, category: ts.DiagnosticCategory.Error, key: "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", message: "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1321, category: ts.DiagnosticCategory.Error, key: "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", message: "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member." }, + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1322, category: ts.DiagnosticCategory.Error, key: "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", message: "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2672,6 +2693,7 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, @@ -2682,19 +2704,20 @@ var ts; Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter." }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, + Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'." }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, @@ -2734,12 +2757,12 @@ var ts; The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class." }, The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'" }, + Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'." }, Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, @@ -2748,19 +2771,19 @@ var ts; Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'" }, + Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'." }, All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'" }, + Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'." }, In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged." }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged." }, Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'" }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name." }, + Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'." }, Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'" }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, @@ -2769,18 +2792,20 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, + Class_0_used_before_its_declaration: { code: 2449, category: ts.DiagnosticCategory.Error, key: "Class_0_used_before_its_declaration_2449", message: "Class '{0}' used before its declaration." }, + Enum_0_used_before_its_declaration: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Enum_0_used_before_its_declaration_2450", message: "Enum '{0}' used before its declaration." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, + Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'." }, An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" }, + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern." }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, @@ -2801,13 +2826,13 @@ var ts; let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'." }, The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause" }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause." }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, @@ -2819,6 +2844,7 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, + Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: { code: 2504, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", message: "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator." }, A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, @@ -2833,6 +2859,7 @@ var ts; All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, + An_async_iterator_must_have_a_next_method: { code: 2519, category: ts.DiagnosticCategory.Error, key: "An_async_iterator_must_have_a_next_method_2519", message: "An async iterator must have a 'next()' method." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, @@ -2856,23 +2883,33 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, + Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." }, + The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: { code: 2547, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", message: "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property." }, + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2548, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", message: "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2549, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", message: "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, + Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: { code: 2550, category: ts.DiagnosticCategory.Error, key: "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", message: "Generic type instantiation is excessively deep and possibly infinite." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'" }, + Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'." }, JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, - Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property." }, + The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property." }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, + Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React." }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element" }, - Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'" }, + JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element." }, + Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'." }, super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, @@ -2904,7 +2941,6 @@ var ts; All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, - A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." }, An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, @@ -2913,9 +2949,17 @@ var ts; The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference." }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property." }, + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, + Required_type_parameters_may_not_follow_optional_type_parameters: { code: 2706, category: ts.DiagnosticCategory.Error, key: "Required_type_parameters_may_not_follow_optional_type_parameters_2706", message: "Required type parameters may not follow optional type parameters." }, + Generic_type_0_requires_between_1_and_2_type_arguments: { code: 2707, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_between_1_and_2_type_arguments_2707", message: "Generic type '{0}' requires between {1} and {2} type arguments." }, + Cannot_use_namespace_0_as_a_value: { code: 2708, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_value_2708", message: "Cannot use namespace '{0}' as a value." }, + Cannot_use_namespace_0_as_a_type: { code: 2709, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_type_2709", message: "Cannot use namespace '{0}' as a type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2926,8 +2970,8 @@ var ts; Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "'extends' clause of exported class '{0}' has or is using private name '{1}'." }, + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "'extends' clause of exported interface '{0}' has or is using private name '{1}'." }, Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, @@ -2988,16 +3032,18 @@ var ts; Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, + extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced: { code: 4093, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced_4093", message: "'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", message: "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported_file_encoding_5013", message: "Unsupported file encoding." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}." }, Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}" }, + Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", message: "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, @@ -3006,12 +3052,12 @@ var ts; A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'" }, - The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'" }, + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'." }, + The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'." }, Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, - Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character" }, - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, + Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character." }, + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character." }, Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_should_be_an_array_5063", message: "Substitutions for pattern '{0}' should be an array." }, Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, @@ -3029,11 +3075,11 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_in_the_given_directory_6020", message: "Compile the project in the given directory." }, + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'." }, Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, @@ -3048,11 +3094,12 @@ var ts; LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, + FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -3074,17 +3121,18 @@ var ts; Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context. (experimental)" }, + Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context (experimental)." }, Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'." }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", message: "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit" }, Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, @@ -3095,23 +3143,23 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, + package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, - Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, - Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'" }, - Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, - Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'." }, + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'." }, + Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'." }, + Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'." }, + Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'." }, + Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed." }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, @@ -3121,32 +3169,67 @@ var ts; Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, - Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'." }, Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, - Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'." }, Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, - Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'" }, + Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'." }, Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." }, - File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it" }, + File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it." }, _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." }, Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" }, - No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" }, + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files." }, Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" }, + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file." }, Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, + Show_diagnostic_information: { code: 6149, category: ts.DiagnosticCategory.Message, key: "Show_diagnostic_information_6149", message: "Show diagnostic information." }, + Show_verbose_diagnostic_information: { code: 6150, category: ts.DiagnosticCategory.Message, key: "Show_verbose_diagnostic_information_6150", message: "Show verbose diagnostic information." }, + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: { code: 6151, category: ts.DiagnosticCategory.Message, key: "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", message: "Emit a single file with source maps instead of having a separate file." }, + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: { code: 6152, category: ts.DiagnosticCategory.Message, key: "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", message: "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set." }, + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: { code: 6153, category: ts.DiagnosticCategory.Message, key: "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", message: "Transpile each file as a separate module (similar to 'ts.transpileModule')." }, + Print_names_of_generated_files_part_of_the_compilation: { code: 6154, category: ts.DiagnosticCategory.Message, key: "Print_names_of_generated_files_part_of_the_compilation_6154", message: "Print names of generated files part of the compilation." }, + Print_names_of_files_part_of_the_compilation: { code: 6155, category: ts.DiagnosticCategory.Message, key: "Print_names_of_files_part_of_the_compilation_6155", message: "Print names of files part of the compilation." }, + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: { code: 6156, category: ts.DiagnosticCategory.Message, key: "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", message: "The locale used when displaying messages to the user (e.g. 'en-us')" }, + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: { code: 6157, category: ts.DiagnosticCategory.Message, key: "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", message: "Do not generate custom helper functions like '__extends' in compiled output." }, + Do_not_include_the_default_library_file_lib_d_ts: { code: 6158, category: ts.DiagnosticCategory.Message, key: "Do_not_include_the_default_library_file_lib_d_ts_6158", message: "Do not include the default library file (lib.d.ts)." }, + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: { code: 6159, category: ts.DiagnosticCategory.Message, key: "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", message: "Do not add triple-slash references or imported modules to the list of compiled files." }, + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: { code: 6160, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", message: "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files." }, + List_of_folders_to_include_type_definitions_from: { code: 6161, category: ts.DiagnosticCategory.Message, key: "List_of_folders_to_include_type_definitions_from_6161", message: "List of folders to include type definitions from." }, + Disable_size_limitations_on_JavaScript_projects: { code: 6162, category: ts.DiagnosticCategory.Message, key: "Disable_size_limitations_on_JavaScript_projects_6162", message: "Disable size limitations on JavaScript projects." }, + The_character_set_of_the_input_files: { code: 6163, category: ts.DiagnosticCategory.Message, key: "The_character_set_of_the_input_files_6163", message: "The character set of the input files." }, + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: { code: 6164, category: ts.DiagnosticCategory.Message, key: "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", message: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files." }, + Do_not_truncate_error_messages: { code: 6165, category: ts.DiagnosticCategory.Message, key: "Do_not_truncate_error_messages_6165", message: "Do not truncate error messages." }, + Output_directory_for_generated_declaration_files: { code: 6166, category: ts.DiagnosticCategory.Message, key: "Output_directory_for_generated_declaration_files_6166", message: "Output directory for generated declaration files." }, + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: { code: 6167, category: ts.DiagnosticCategory.Message, key: "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", message: "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'." }, + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: { code: 6168, category: ts.DiagnosticCategory.Message, key: "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", message: "List of root folders whose combined content represents the structure of the project at runtime." }, + Show_all_compiler_options: { code: 6169, category: ts.DiagnosticCategory.Message, key: "Show_all_compiler_options_6169", message: "Show all compiler options." }, + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: { code: 6170, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", message: "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file" }, + Command_line_Options: { code: 6171, category: ts.DiagnosticCategory.Message, key: "Command_line_Options_6171", message: "Command-line Options" }, + Basic_Options: { code: 6172, category: ts.DiagnosticCategory.Message, key: "Basic_Options_6172", message: "Basic Options" }, + Strict_Type_Checking_Options: { code: 6173, category: ts.DiagnosticCategory.Message, key: "Strict_Type_Checking_Options_6173", message: "Strict Type-Checking Options" }, + Module_Resolution_Options: { code: 6174, category: ts.DiagnosticCategory.Message, key: "Module_Resolution_Options_6174", message: "Module Resolution Options" }, + Source_Map_Options: { code: 6175, category: ts.DiagnosticCategory.Message, key: "Source_Map_Options_6175", message: "Source Map Options" }, + Additional_Checks: { code: 6176, category: ts.DiagnosticCategory.Message, key: "Additional_Checks_6176", message: "Additional Checks" }, + Experimental_Options: { code: 6177, category: ts.DiagnosticCategory.Message, key: "Experimental_Options_6177", message: "Experimental Options" }, + Advanced_Options: { code: 6178, category: ts.DiagnosticCategory.Message, key: "Advanced_Options_6178", message: "Advanced Options" }, + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: { code: 6179, category: ts.DiagnosticCategory.Message, key: "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", message: "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'." }, + Enable_all_strict_type_checking_options: { code: 6180, category: ts.DiagnosticCategory.Message, key: "Enable_all_strict_type_checking_options_6180", message: "Enable all strict type-checking options." }, + List_of_language_service_plugins: { code: 6181, category: ts.DiagnosticCategory.Message, key: "List_of_language_service_plugins_6181", message: "List of language service plugins." }, + Scoped_package_detected_looking_in_0: { code: 6182, category: ts.DiagnosticCategory.Message, key: "Scoped_package_detected_looking_in_0_6182", message: "Scoped package detected, looking in '{0}'" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3164,7 +3247,7 @@ var ts; _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists" }, + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists." }, Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, @@ -3188,7 +3271,7 @@ var ts; parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, @@ -3196,28 +3279,40 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'." }, An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." }, super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: '{0}'." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, + Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig." }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, - Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, - Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, - Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}." }, + Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}." }, + Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." }, + Add_declaration_for_missing_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Add_declaration_for_missing_property_0_90016", message: "Add declaration for missing property '{0}'." }, + Add_index_signature_for_missing_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_missing_property_0_90017", message: "Add index signature for missing property '{0}'." }, + Disable_checking_for_this_file: { code: 90018, category: ts.DiagnosticCategory.Message, key: "Disable_checking_for_this_file_90018", message: "Disable checking for this file." }, + Ignore_this_error_message: { code: 90019, category: ts.DiagnosticCategory.Message, key: "Ignore_this_error_message_90019", message: "Ignore this error message." }, + Initialize_property_0_in_the_constructor: { code: 90020, category: ts.DiagnosticCategory.Message, key: "Initialize_property_0_in_the_constructor_90020", message: "Initialize property '{0}' in the constructor." }, + Initialize_static_property_0: { code: 90021, category: ts.DiagnosticCategory.Message, key: "Initialize_static_property_0_90021", message: "Initialize static property '{0}'." }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, + Report_errors_in_js_files: { code: 8019, category: ts.DiagnosticCategory.Message, key: "Report_errors_in_js_files_8019", message: "Report errors in .js files." }, }; })(ts || (ts = {})); var ts; @@ -3226,7 +3321,7 @@ var ts; return token >= 70; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMap({ + var textToToken = ts.createMapFromTemplate({ "abstract": 116, "any": 118, "as": 117, @@ -3250,7 +3345,7 @@ var ts; "false": 85, "finally": 86, "for": 87, - "from": 138, + "from": 139, "function": 88, "get": 124, "if": 89, @@ -3268,27 +3363,28 @@ var ts; "new": 93, "null": 94, "number": 132, + "object": 133, "package": 110, "private": 111, "protected": 112, "public": 113, "readonly": 130, "require": 131, - "global": 139, + "global": 140, "return": 95, - "set": 133, + "set": 134, "static": 114, - "string": 134, + "string": 135, "super": 96, "switch": 97, - "symbol": 135, + "symbol": 136, "this": 98, "throw": 99, "true": 100, "try": 101, - "type": 136, + "type": 137, "typeof": 102, - "undefined": 137, + "undefined": 138, "var": 103, "void": 104, "while": 105, @@ -3296,7 +3392,7 @@ var ts; "yield": 115, "async": 119, "await": 120, - "of": 140, + "of": 141, "{": 16, "}": 17, "(": 18, @@ -3391,9 +3487,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name_4 in source) { - result[source[name_4]] = name_4; - } + source.forEach(function (value, name) { + result[value] = name; + }); return result; } var tokenStrings = makeReverseMap(textToToken); @@ -3402,7 +3498,7 @@ var ts; } ts.tokenToString = tokenToString; function stringToToken(s) { - return textToToken[s]; + return textToToken.get(s); } ts.stringToToken = stringToToken; function computeLineStarts(text) { @@ -3462,7 +3558,6 @@ var ts; return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -3598,7 +3693,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -3751,7 +3846,7 @@ var ts; if (!comments) { comments = []; } - comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); return comments; } function getLeadingCommentRanges(text, pos) { @@ -3784,7 +3879,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -3803,6 +3898,7 @@ var ts; var precedingLineBreak; var hasExtendedUnicodeEscape; var tokenIsUnterminated; + var numericLiteralFlags; setText(text, start, length); return { getStartPos: function () { return startPos; }, @@ -3816,6 +3912,7 @@ var ts; isIdentifier: function () { return token === 70 || token > 106; }, isReservedWord: function () { return token >= 71 && token <= 106; }, isUnterminated: function () { return tokenIsUnterminated; }, + getNumericLiteralFlags: function () { return numericLiteralFlags; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -3852,6 +3949,7 @@ var ts; var end = pos; if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { pos++; + numericLiteralFlags = 2; if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) pos++; if (isDigit(text.charCodeAt(pos))) { @@ -4121,8 +4219,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = 70; @@ -4151,6 +4252,7 @@ var ts; hasExtendedUnicodeEscape = false; precedingLineBreak = false; tokenIsUnterminated = false; + numericLiteralFlags = 0; while (true) { tokenPos = pos; if (pos >= end) { @@ -4332,6 +4434,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 8; return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { @@ -4342,6 +4445,7 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 16; return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { @@ -4352,10 +4456,12 @@ var ts; value = 0; } tokenValue = "" + value; + numericLiteralFlags = 32; return token = 8; } if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); + numericLiteralFlags = 4; return token = 8; } case 49: @@ -4602,7 +4708,14 @@ var ts; while (pos < end) { pos++; char = text.charCodeAt(pos); - if ((char === 123) || (char === 60)) { + if (char === 123) { + break; + } + if (char === 60) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7; + } break; } } @@ -4776,40 +4889,12 @@ var ts; (function (ts) { ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; ts.optionDeclarations = [ - { - name: "charset", - type: "string", - }, - ts.compileOnSaveCommandLineOption, - { - name: "declaration", - shortName: "d", - type: "boolean", - description: ts.Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "diagnostics", - type: "boolean", - }, - { - name: "extendedDiagnostics", - type: "boolean", - experimental: true - }, - { - name: "emitBOM", - type: "boolean" - }, { name: "help", shortName: "h", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, }, { @@ -4818,56 +4903,73 @@ var ts; type: "boolean" }, { - name: "init", + name: "all", type: "boolean", - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Show_all_compiler_options, }, { - name: "inlineSourceMap", + name: "version", + shortName: "v", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_the_compiler_s_version, }, { - name: "inlineSources", + name: "init", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, }, { - name: "jsx", - type: ts.createMap({ - "preserve": 1, - "react": 2 - }), - paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - }, - { - name: "reactNamespace", + name: "project", + shortName: "p", type: "string", - description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit + isFilePath: true, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY, + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, }, { - name: "jsxFactory", - type: "string", - description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h - }, - { - name: "listFiles", + name: "pretty", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental }, { - name: "locale", - type: "string", + name: "watch", + shortName: "w", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Watch_input_files, }, { - name: "mapRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: ts.Diagnostics.LOCATION, + name: "target", + shortName: "t", + type: ts.createMapFromTemplate({ + "es3": 0, + "es5": 1, + "es6": 2, + "es2015": 2, + "es2016": 3, + "es2017": 4, + "esnext": 5, + }), + paramType: ts.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, }, { name: "module", shortName: "m", - type: ts.createMap({ + type: ts.createMapFromTemplate({ "none": ts.ModuleKind.None, "commonjs": ts.ModuleKind.CommonJS, "amd": ts.ModuleKind.AMD, @@ -4876,238 +4978,232 @@ var ts; "es6": ts.ModuleKind.ES2015, "es2015": ts.ModuleKind.ES2015, }), - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, }, { - name: "newLine", - type: ts.createMap({ - "crlf": 0, - "lf": 1 - }), - description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - }, - { - name: "noEmit", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs, - }, - { - name: "noEmitHelpers", - type: "boolean" - }, - { - name: "noEmitOnError", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "noErrorTruncation", - type: "boolean" - }, - { - name: "noImplicitAny", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "noImplicitThis", - type: "boolean", - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "noUnusedLocals", - type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_locals, + name: "lib", + type: "list", + element: { + name: "lib", + type: ts.createMapFromTemplate({ + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", + "dom": "lib.dom.d.ts", + "dom.iterable": "lib.dom.iterable.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts", + "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", + "es2017.string": "lib.es2017.string.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", + }), + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon }, { - name: "noUnusedParameters", + name: "allowJs", type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_parameters, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled }, { - name: "noLib", + name: "checkJs", type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Report_errors_in_js_files }, { - name: "noResolve", - type: "boolean", + name: "jsx", + type: ts.createMapFromTemplate({ + "preserve": 1, + "react-native": 3, + "react": 2 + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, }, { - name: "skipDefaultLibCheck", + name: "declaration", + shortName: "d", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_d_ts_file, }, { - name: "skipLibCheck", + name: "sourceMap", type: "boolean", - description: ts.Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "out", - type: "string", - isFilePath: false, - paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_map_file, }, { name: "outFile", type: "string", isFilePath: true, - description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, }, { name: "outDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Redirect_output_structure_to_the_directory, paramType: ts.Diagnostics.DIRECTORY, - }, - { - name: "preserveConstEnums", - type: "boolean", - description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "pretty", - description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, - type: "boolean" - }, - { - name: "project", - shortName: "p", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Compile_the_project_in_the_given_directory, - paramType: ts.Diagnostics.DIRECTORY - }, - { - name: "removeComments", - type: "boolean", - description: ts.Diagnostics.Do_not_emit_comments_to_output, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, }, { name: "rootDir", type: "string", isFilePath: true, paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, }, { - name: "isolatedModules", + name: "removeComments", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_comments_to_output, }, { - name: "sourceMap", + name: "noEmit", type: "boolean", - description: ts.Diagnostics.Generates_corresponding_map_file, - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: ts.Diagnostics.LOCATION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_outputs, }, { - name: "suppressExcessPropertyErrors", + name: "importHelpers", type: "boolean", - description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, - experimental: true + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Import_emit_helpers_from_tslib }, { - name: "suppressImplicitAnyIndexErrors", + name: "downlevelIteration", type: "boolean", - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 }, { - name: "stripInternal", + name: "isolatedModules", type: "boolean", - description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - experimental: true + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule }, { - name: "target", - shortName: "t", - type: ts.createMap({ - "es3": 0, - "es5": 1, - "es6": 2, - "es2015": 2, - "es2016": 3, - "es2017": 4, - "esnext": 5, - }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, - paramType: ts.Diagnostics.VERSION, + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_all_strict_type_checking_options }, { - name: "version", - shortName: "v", + name: "noImplicitAny", type: "boolean", - description: ts.Diagnostics.Print_the_compiler_s_version, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, }, { - name: "watch", - shortName: "w", + name: "strictNullChecks", type: "boolean", - description: ts.Diagnostics.Watch_input_files, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_strict_null_checks }, { - name: "experimentalDecorators", + name: "noImplicitThis", type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, }, { - name: "emitDecoratorMetadata", + name: "alwaysStrict", type: "boolean", - experimental: true, - description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file }, { - name: "moduleResolution", - type: ts.createMap({ - "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic, - }), - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - paramType: ts.Diagnostics.STRATEGY, + name: "noUnusedLocals", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_locals, }, { - name: "allowUnusedLabels", + name: "noUnusedParameters", type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_parameters, }, { name: "noImplicitReturns", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value }, { name: "noFallthroughCasesInSwitch", type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement }, { - name: "allowUnreachableCode", - type: "boolean", - description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + name: "moduleResolution", + type: ts.createMapFromTemplate({ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic, + }), + paramType: ts.Diagnostics.STRATEGY, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, }, { name: "baseUrl", type: "string", isFilePath: true, + category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names }, { name: "paths", type: "object", - isTSConfigOnly: true + isTSConfigOnly: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl }, { name: "rootDirs", @@ -5117,7 +5213,9 @@ var ts; name: "rootDirs", type: "string", isFilePath: true - } + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime }, { name: "typeRoots", @@ -5126,7 +5224,9 @@ var ts; name: "typeRoots", type: "string", isFilePath: true - } + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from }, { name: "types", @@ -5135,88 +5235,253 @@ var ts; name: "types", type: "string" }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + }, + { + name: "inlineSources", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + }, + { + name: "experimentalDecorators", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + { + name: "jsxFactory", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_verbose_diagnostic_information + }, { name: "traceResolution", type: "boolean", + category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process }, { - name: "allowJs", + name: "listFiles", type: "boolean", - description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation }, { - name: "allowSyntheticDefaultImports", + name: "listEmittedFiles", type: "boolean", - description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation }, { - name: "noImplicitUseStrict", + name: "out", + type: "string", + isFilePath: false, + category: ts.Diagnostics.Advanced_Options, + paramType: ts.Diagnostics.FILE, + description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", type: "boolean", - description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files }, { - name: "maxNodeModuleJsDepth", - type: "number", - description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + name: "charset", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_character_set_of_the_input_files }, { - name: "listEmittedFiles", - type: "boolean" + name: "emitBOM", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files }, { - name: "lib", - type: "list", - element: { - name: "lib", - type: ts.createMap({ - "es5": "lib.es5.d.ts", - "es6": "lib.es2015.d.ts", - "es2015": "lib.es2015.d.ts", - "es7": "lib.es2016.d.ts", - "es2016": "lib.es2016.d.ts", - "es2017": "lib.es2017.d.ts", - "dom": "lib.dom.d.ts", - "dom.iterable": "lib.dom.iterable.d.ts", - "webworker": "lib.webworker.d.ts", - "scripthost": "lib.scripthost.d.ts", - "es2015.core": "lib.es2015.core.d.ts", - "es2015.collection": "lib.es2015.collection.d.ts", - "es2015.generator": "lib.es2015.generator.d.ts", - "es2015.iterable": "lib.es2015.iterable.d.ts", - "es2015.promise": "lib.es2015.promise.d.ts", - "es2015.proxy": "lib.es2015.proxy.d.ts", - "es2015.reflect": "lib.es2015.reflect.d.ts", - "es2015.symbol": "lib.es2015.symbol.d.ts", - "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", - "es2016.array.include": "lib.es2016.array.include.d.ts", - "es2017.object": "lib.es2017.object.d.ts", - "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", - "es2017.string": "lib.es2017.string.d.ts", - }), - }, - description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + name: "locale", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: ts.createMapFromTemplate({ + "crlf": 0, + "lf": 1 + }), + paramType: ts.Diagnostics.NEWLINE, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + }, + { + name: "disableSizeLimit", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects + }, + { + name: "noImplicitUseStrict", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "noEmitHelpers", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + }, + { + name: "noEmitOnError", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, }, { - name: "disableSizeLimit", - type: "boolean" + name: "preserveConstEnums", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, { - name: "strictNullChecks", + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", type: "boolean", - description: ts.Diagnostics.Enable_strict_null_checks + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, }, { - name: "importHelpers", + name: "allowUnusedLabels", type: "boolean", - description: ts.Diagnostics.Import_emit_helpers_from_tslib + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels }, { - name: "alwaysStrict", + name: "allowUnreachableCode", type: "boolean", - description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + }, + { + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts.Diagnostics.List_of_language_service_plugins } ]; ts.typeAcquisitionDeclarations = [ @@ -5248,8 +5513,7 @@ var ts; ts.defaultInitCompilerOptions = { module: ts.ModuleKind.CommonJS, target: 1, - noImplicitAny: false, - sourceMap: false, + strict: true }; var optionNameMapCache; function convertEnableAutoDiscoveryToEnable(typeAcquisition) { @@ -5271,9 +5535,9 @@ var ts; var optionNameMap = ts.createMap(); var shortOptionNames = ts.createMap(); ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; @@ -5281,19 +5545,12 @@ var ts; } ts.getOptionNameMap = getOptionNameMap; function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; function parseListTypeOption(opt, value, errors) { @@ -5337,11 +5594,12 @@ var ts; } else if (s.charCodeAt(0) === 45) { s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); - if (s in shortOptionNames) { - s = shortOptionNames[s]; + var short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - var opt = optionNameMap[s]; + var opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -5446,7 +5704,7 @@ var ts; } } ts.parseConfigFileTextToJson = parseConfigFileTextToJson; - function generateTSConfig(options, fileNames) { + function generateTSConfig(options, fileNames, newLine) { var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); var configurations = { compilerOptions: serializeCompilerOptions(compilerOptions) @@ -5454,7 +5712,7 @@ var ts; if (fileNames && fileNames.length) { configurations.files = fileNames; } - return configurations; + return writeConfigurations(); function getCustomTypeMapOfCommandLineOption(optionDefinition) { if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { return undefined; @@ -5467,53 +5725,121 @@ var ts; } } function getNameOfCompilerOptionValue(value, customTypeMap) { - for (var key in customTypeMap) { - if (customTypeMap[key] === value) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { return key; } - } - return undefined; + }); } function serializeCompilerOptions(options) { - var result = ts.createMap(); + var result = {}; var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_5 in options) { - if (ts.hasProperty(options, name_5)) { - switch (name_5) { - case "init": - case "watch": - case "version": - case "help": - case "project": - break; - default: - var value = options[name_5]; - var optionDefinition = optionsNameMap[name_5.toLowerCase()]; - if (optionDefinition) { - var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - result[name_5] = value; - } - else { - if (optionDefinition.type === "list") { - var convertedValue = []; - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name_5] = convertedValue; - } - else { - result[name_5] = getNameOfCompilerOptionValue(value, customTypeMap); - } + for (var name in options) { + if (ts.hasProperty(options, name)) { + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { + continue; + } + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap) { + result[name] = value; + } + else { + if (optionDefinition.type === "list") { + var convertedValue = []; + for (var _i = 0, _a = value; _i < _a.length; _i++) { + var element = _a[_i]; + convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } + result[name] = convertedValue; } - break; + else { + result[name] = getNameOfCompilerOptionValue(value, customTypeMap); + } + } } } } return result; } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return ts.arrayFrom(option.type.keys())[0]; + } + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function writeConfigurations() { + var categorizedOptions = ts.reduceLeft(ts.filter(ts.optionDeclarations, function (o) { return o.category !== ts.Diagnostics.Command_line_Options && o.category !== ts.Diagnostics.Advanced_Options; }), function (memo, value) { + if (value.category) { + var name = ts.getLocaleSpecificMessage(value.category); + (memo[name] || (memo[name] = [])).push(value); + } + return memo; + }, {}); + var marginLength = 0; + var seenKnownKeys = 0; + var nameColumn = []; + var descriptionColumn = []; + var knownKeysCount = ts.getOwnKeys(configurations.compilerOptions).length; + for (var category in categorizedOptions) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push("/* " + category + " */"); + descriptionColumn.push(""); + for (var _i = 0, _a = categorizedOptions[category]; _i < _a.length; _i++) { + var option = _a[_i]; + var optionName = void 0; + if (ts.hasProperty(configurations.compilerOptions, option.name)) { + optionName = "\"" + option.name + "\": " + JSON.stringify(configurations.compilerOptions[option.name]) + ((seenKnownKeys += 1) === knownKeysCount ? "" : ","); + } + else { + optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; + } + nameColumn.push(optionName); + descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); + marginLength = Math.max(optionName.length, marginLength); + } + } + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push(tab + "\"compilerOptions\": {"); + for (var i = 0; i < nameColumn.length; i++) { + var optionName = nameColumn[i]; + var description = descriptionColumn[i]; + result.push(tab + tab + optionName + makePadding(marginLength - optionName.length + 2) + description); + } + if (configurations.files && configurations.files.length) { + result.push(tab + "},"); + result.push(tab + "\"files\": ["); + for (var i = 0; i < configurations.files.length; i++) { + result.push("" + tab + tab + JSON.stringify(configurations.files[i]) + (i === configurations.files.length - 1 ? "" : ",")); + } + result.push(tab + "]"); + } + else { + result.push(tab + "}"); + } + result.push("}"); + return result.join(newLine); + } } ts.generateTSConfig = generateTSConfig; function removeComments(jsonText) { @@ -5533,10 +5859,12 @@ var ts; } return output; } - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -5658,7 +5986,7 @@ var ts; if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); } @@ -5709,8 +6037,8 @@ var ts; } var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); for (var id in jsonOptions) { - if (id in optionNameMap) { - var opt = optionNameMap[id]; + var opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -5744,8 +6072,9 @@ var ts; } function convertJsonOptionOfCustomType(opt, value, errors) { var key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + var val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -5762,7 +6091,7 @@ var ts; var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; var literalFileMap = ts.createMap(); @@ -5774,12 +6103,12 @@ var ts; exclude = validateSpecs(exclude, errors, true); } var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); if (fileNames) { for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { var fileName = fileNames_1[_i]; var file = ts.combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } if (include && include.length > 0) { @@ -5790,14 +6119,13 @@ var ts; } removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); var key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - var literalFiles = ts.reduceProperties(literalFileMap, addFileToOutput, []); - var wildcardFiles = ts.reduceProperties(wildcardFileMap, addFileToOutput, []); - wildcardFiles.sort(host.useCaseSensitiveFileNames ? ts.compareStrings : ts.compareStringsCaseInsensitive); + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); return { fileNames: literalFiles.concat(wildcardFiles), wildcardDirectories: wildcardDirectories @@ -5805,8 +6133,8 @@ var ts; } function validateSpecs(specs, errors, allowTrailingRecursion) { var validSpecs = []; - for (var _i = 0, specs_2 = specs; _i < specs_2.length; _i++) { - var spec = specs_2[_i]; + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + var spec = specs_1[_i]; if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); } @@ -5825,7 +6153,7 @@ var ts; function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = ts.createMap(); + var wildcardDirectories = {}; if (include !== undefined) { var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { @@ -5846,14 +6174,15 @@ var ts; } } } - for (var key in wildcardDirectories) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; + for (var key in wildcardDirectories) + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } } } - } } return wildcardDirectories; } @@ -5872,11 +6201,11 @@ var ts; } function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority); + var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); for (var i = 0; i < adjustedExtensionPriority; i++) { var higherPriorityExtension = extensions[i]; var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -5884,17 +6213,13 @@ var ts; } function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { var extensionPriority = ts.getExtensionPriority(file, extensions); - var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority); + var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); for (var i = nextExtensionPriority; i < extensions.length; i++) { var lowerPriorityExtension = extensions[i]; var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - function addFileToOutput(output, file) { - output.push(file); - return output; - } function caseSensitiveKeyMapper(key) { return key; } @@ -5906,8 +6231,6 @@ var ts; (function (ts) { var JsTyping; (function (JsTyping) { - ; - ; var safeList; var EmptySafeList = ts.createMap(); JsTyping.nodeCoreModuleList = [ @@ -5930,7 +6253,7 @@ var ts; }); if (!safeList) { var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; } var filesToWatch = []; var searchDirs = []; @@ -5948,38 +6271,40 @@ var ts; getTypingNamesFromJson(packageJsonPath, filesToWatch); var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var bowerComponentsPath = ts.combinePaths(searchDir, "bower_components"); + getTypingNamesFromPackagesFolder(bowerComponentsPath); var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromNodeModuleFolder(nodeModulesPath); + getTypingNamesFromPackagesFolder(nodeModulesPath); } getTypingNamesFromSourceFileNames(fileNames); if (unresolvedImports) { for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } - for (var name_6 in packageNameToTypingLocation) { - if (name_6 in inferredTypings && !inferredTypings[name_6]) { - inferredTypings[name_6] = packageNameToTypingLocation[name_6]; + packageNameToTypingLocation.forEach(function (typingLocation, name) { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } var newTypingNames = []; var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach(function (inferred, typing) { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; function mergeTypings(typingNames) { if (!typingNames) { @@ -5987,8 +6312,8 @@ var ts; } for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -6018,23 +6343,25 @@ var ts; var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return safeList.has(f); })); } var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); if (hasJsxFile) { mergeTypings(["react"]); } } - function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { - if (!host.directoryExists(nodeModulesPath)) { + function getTypingNamesFromPackagesFolder(packagesFolderPath) { + filesToWatch.push(packagesFolderPath); + if (!host.directoryExists(packagesFolderPath)) { return; } var typingNames = []; - var fileNames = host.readDirectory(nodeModulesPath, [".json"], undefined, undefined, 2); + var fileNames = host.readDirectory(packagesFolderPath, [".json"], undefined, undefined, 2); for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { var fileName = fileNames_2[_i]; var normalizedFileName = ts.normalizePath(fileName); - if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + var baseFileName = ts.getBaseFileName(normalizedFileName); + if (baseFileName !== "package.json" && baseFileName !== "bower.json") { continue; } var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); @@ -6042,7 +6369,7 @@ var ts; continue; } var packageJson = result.config; - if (packageJson._requiredBy && + if (baseFileName === "package.json" && packageJson._requiredBy && ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { continue; } @@ -6051,7 +6378,7 @@ var ts; } if (packageJson.typings) { var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); @@ -6069,12 +6396,15 @@ var ts; (function (server) { server.ActionSet = "action::set"; server.ActionInvalidate = "action::invalidate"; - server.EventInstall = "event::install"; + server.EventBeginInstallTypes = "event::beginInstallTypes"; + server.EventEndInstallTypes = "event::endInstallTypes"; + server.EventInitializationFailed = "event::initializationFailed"; var Arguments; (function (Arguments) { Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; Arguments.LogFile = "--logFile"; Arguments.EnableTelemetry = "--enableTelemetry"; + Arguments.TypingSafeListLocation = "--typingSafeListLocation"; })(Arguments = server.Arguments || (server.Arguments = {})); function hasArgument(argumentName) { return ts.sys.args.indexOf(argumentName) >= 0; @@ -6099,6 +6429,12 @@ var ts; return compilerOptions.traceResolution && host.trace !== undefined; } ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); function resolvedTypeScriptOnly(resolved) { if (!resolved) { return undefined; @@ -6106,9 +6442,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; @@ -6120,37 +6453,28 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); - switch (extensions) { - case 2: - case 0: - return tryReadFromField("typings") || tryReadFromField("types"); - case 1: - if (typeof jsonContent.main === "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); - } - return ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main)); - } - return undefined; - } + return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); function tryReadFromField(fieldName) { - if (ts.hasProperty(jsonContent, fieldName)) { - var typesFile = jsonContent[fieldName]; - if (typeof typesFile === "string") { - var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); - } - return typesFilePath; + if (!ts.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); - } + return; + } + var fileName = jsonContent[fieldName]; + if (typeof fileName !== "string") { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); } + return; + } + var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); } + return path; } } function readJson(path, host) { @@ -6183,11 +6507,12 @@ var ts; return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; } var typeRoots; - forEachAncestorDirectory(currentDirectory, function (directory) { + forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -6242,7 +6567,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -6258,7 +6587,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -6299,31 +6629,116 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); + if (!perModuleNameCache) { + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.contains(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + if (current === commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache.get(moduleName); + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache.set(moduleName, result); + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -6448,37 +6863,43 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, false); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + function nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, jsOnly) { + if (jsOnly === void 0) { jsOnly = false; } var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { - var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); + var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, true); }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state, true); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } - ts.nodeModuleNameResolver = nodeModuleNameResolver; + ts.nodeModuleNameResolverWorker = nodeModuleNameResolverWorker; function realpath(path, host, traceEnabled) { if (!host.realpath) { return path; @@ -6489,12 +6910,35 @@ var ts; } return real; } - function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); + } + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName); @@ -6522,11 +6966,11 @@ var ts; } } switch (extensions) { - case 2: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -6535,113 +6979,181 @@ var ts; } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var packageJsonPath = pathToPackageJson(candidate); + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { considerPackageJson = true; } var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); - } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + if (considerPackageJson) { + var packageJsonPath = pathToPackageJson(candidate); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state); + if (fromPackageJson) { + return fromPackageJson; } } else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field); + if (directoryExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } + failedLookupLocations.push(packageJsonPath); } } - else { + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state); + if (!file) { + return undefined; + } + var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); + var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); + if (fromFile) { + var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + if (resolved) { + return resolved; + } if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); } - failedLookupLocations.push(packageJsonPath); } - return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; + return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, false); + } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); + } + } + function mangleScopedPackage(moduleName, state) { + if (ts.startsWith(moduleName, "@")) { + var replaceSlash = moduleName.replace(ts.directorySeparator, "__"); + if (replaceSlash !== moduleName) { + var mangled = replaceSlash.slice(1); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; + } + } + return moduleName; + } + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); }); if (resolved_3) { return resolved_3; } - if (extensions === 0) { + if (extensions === Extensions.TypeScript) { return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); } } } @@ -6653,10 +7165,13 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } function forEachAncestorDirectory(directory, callback) { while (true) { var result = callback(directory); @@ -6727,13 +7242,12 @@ var ts; } typingsInstaller.validatePackageName = validatePackageName; var TypingsInstaller = (function () { - function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, telemetryEnabled, log) { + function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, log) { if (log === void 0) { log = nullLog; } this.installTypingHost = installTypingHost; this.globalCachePath = globalCachePath; this.safeListPath = safeListPath; this.throttleLimit = throttleLimit; - this.telemetryEnabled = telemetryEnabled; this.log = log; this.packageNameToTypingLocation = ts.createMap(); this.missingTypingsSet = ts.createMap(); @@ -6754,7 +7268,7 @@ var ts; if (this.log.isEnabled()) { this.log.writeLine("Closing file watchers for project '" + projectName + "'"); } - var watchers = this.projectWatchers[projectName]; + var watchers = this.projectWatchers.get(projectName); if (!watchers) { if (this.log.isEnabled()) { this.log.writeLine("No watchers are registered for project '" + projectName + "'"); @@ -6765,7 +7279,7 @@ var ts; var w = watchers_1[_i]; w.close(); } - delete this.projectWatchers[projectName]; + this.projectWatchers.delete(projectName); if (this.log.isEnabled()) { this.log.writeLine("Closing file watchers for project '" + projectName + "' - done."); } @@ -6799,7 +7313,7 @@ var ts; if (this.log.isEnabled()) { this.log.writeLine("Processing cache location '" + cacheLocation + "'"); } - if (this.knownCachesSet[cacheLocation]) { + if (this.knownCachesSet.get(cacheLocation)) { if (this.log.isEnabled()) { this.log.writeLine("Cache location was already processed..."); } @@ -6822,10 +7336,10 @@ var ts; } var typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost, this.log); if (!typingFile) { - this.missingTypingsSet[packageName] = true; + this.missingTypingsSet.set(packageName, true); continue; } - var existingTypingFile = this.packageNameToTypingLocation[packageName]; + var existingTypingFile = this.packageNameToTypingLocation.get(packageName); if (existingTypingFile === typingFile) { continue; } @@ -6837,14 +7351,14 @@ var ts; if (this.log.isEnabled()) { this.log.writeLine("Adding entry into typings cache: '" + packageName + "' => '" + typingFile + "'"); } - this.packageNameToTypingLocation[packageName] = typingFile; + this.packageNameToTypingLocation.set(packageName, typingFile); } } } if (this.log.isEnabled()) { this.log.writeLine("Finished processing cache location '" + cacheLocation + "'"); } - this.knownCachesSet[cacheLocation] = true; + this.knownCachesSet.set(cacheLocation, true); }; TypingsInstaller.prototype.filterTypings = function (typingsToInstall) { if (typingsToInstall.length === 0) { @@ -6853,12 +7367,12 @@ var ts; var result = []; for (var _i = 0, typingsToInstall_1 = typingsToInstall; _i < typingsToInstall_1.length; _i++) { var typing = typingsToInstall_1[_i]; - if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) { + if (this.missingTypingsSet.get(typing) || this.packageNameToTypingLocation.get(typing)) { continue; } var validationResult = validatePackageName(typing); if (validationResult === PackageNameValidationResult.Ok) { - if (typing in this.typesRegistry) { + if (this.typesRegistry.has(typing)) { result.push(typing); } else { @@ -6868,7 +7382,7 @@ var ts; } } else { - this.missingTypingsSet[typing] = true; + this.missingTypingsSet.set(typing, true); if (this.log.isEnabled()) { switch (validationResult) { case PackageNameValidationResult.EmptyName: @@ -6914,8 +7428,7 @@ var ts; this.log.writeLine("Installing typings " + JSON.stringify(typingsToInstall)); } var filteredTypings = this.filterTypings(typingsToInstall); - var scopedTypings = filteredTypings.map(function (x) { return "@types/" + x; }); - if (scopedTypings.length === 0) { + if (filteredTypings.length === 0) { if (this.log.isEnabled()) { this.log.writeLine("All typings are known to be missing or invalid - no need to go any further"); } @@ -6924,45 +7437,56 @@ var ts; this.ensurePackageDirectoryExists(cachePath); var requestId = this.installRunCount; this.installRunCount++; + this.sendResponse({ + kind: server.EventBeginInstallTypes, + eventId: requestId, + typingsInstallerVersion: ts.version, + projectName: req.projectName + }); + var scopedTypings = filteredTypings.map(typingsName); this.installTypingsAsync(requestId, scopedTypings, cachePath, function (ok) { - if (_this.telemetryEnabled) { - _this.sendResponse({ - kind: server.EventInstall, - packagesToInstall: scopedTypings, - installSuccess: ok, - typingsInstallerVersion: ts.version - }); - } - if (!ok) { - if (_this.log.isEnabled()) { - _this.log.writeLine("install request failed, marking packages as missing to prevent repeated requests: " + JSON.stringify(filteredTypings)); + try { + if (!ok) { + if (_this.log.isEnabled()) { + _this.log.writeLine("install request failed, marking packages as missing to prevent repeated requests: " + JSON.stringify(filteredTypings)); + } + for (var _i = 0, filteredTypings_1 = filteredTypings; _i < filteredTypings_1.length; _i++) { + var typing = filteredTypings_1[_i]; + _this.missingTypingsSet.set(typing, true); + } + return; } - for (var _i = 0, filteredTypings_1 = filteredTypings; _i < filteredTypings_1.length; _i++) { - var typing = filteredTypings_1[_i]; - _this.missingTypingsSet[typing] = true; + if (_this.log.isEnabled()) { + _this.log.writeLine("Installed typings " + JSON.stringify(scopedTypings)); } - return; - } - if (_this.log.isEnabled()) { - _this.log.writeLine("Installed typings " + JSON.stringify(scopedTypings)); - } - var installedTypingFiles = []; - for (var _a = 0, filteredTypings_2 = filteredTypings; _a < filteredTypings_2.length; _a++) { - var packageName = filteredTypings_2[_a]; - var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost, _this.log); - if (!typingFile) { - _this.missingTypingsSet[packageName] = true; - continue; + var installedTypingFiles = []; + for (var _a = 0, filteredTypings_2 = filteredTypings; _a < filteredTypings_2.length; _a++) { + var packageName = filteredTypings_2[_a]; + var typingFile = typingToFileName(cachePath, packageName, _this.installTypingHost, _this.log); + if (!typingFile) { + _this.missingTypingsSet.set(packageName, true); + continue; + } + if (!_this.packageNameToTypingLocation.has(packageName)) { + _this.packageNameToTypingLocation.set(packageName, typingFile); + } + installedTypingFiles.push(typingFile); } - if (!_this.packageNameToTypingLocation[packageName]) { - _this.packageNameToTypingLocation[packageName] = typingFile; + if (_this.log.isEnabled()) { + _this.log.writeLine("Installed typing files " + JSON.stringify(installedTypingFiles)); } - installedTypingFiles.push(typingFile); + _this.sendResponse(_this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); } - if (_this.log.isEnabled()) { - _this.log.writeLine("Installed typing files " + JSON.stringify(installedTypingFiles)); + finally { + _this.sendResponse({ + kind: server.EventEndInstallTypes, + eventId: requestId, + projectName: req.projectName, + packagesToInstall: scopedTypings, + installSuccess: ok, + typingsInstallerVersion: ts.version + }); } - _this.sendResponse(_this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); }); }; TypingsInstaller.prototype.ensureDirectoryExists = function (directory, host) { @@ -6995,7 +7519,7 @@ var ts; }, 2000); watchers.push(w); } - this.projectWatchers[projectName] = watchers; + this.projectWatchers.set(projectName, watchers); }; TypingsInstaller.prototype.createSetTypings = function (request, typings) { return { @@ -7013,7 +7537,7 @@ var ts; }; TypingsInstaller.prototype.executeWithThrottling = function () { var _this = this; - var _loop_2 = function () { + var _loop_3 = function () { this_1.inFlightRequestCount++; var request = this_1.pendingRunRequests.pop(); this_1.installWorker(request.requestId, request.args, request.cwd, function (ok) { @@ -7024,12 +7548,17 @@ var ts; }; var this_1 = this; while (this.inFlightRequestCount < this.throttleLimit && this.pendingRunRequests.length) { - _loop_2(); + _loop_3(); } }; return TypingsInstaller; }()); typingsInstaller.TypingsInstaller = TypingsInstaller; + function typingsName(packageName) { + return "@types/" + packageName + "@ts" + versionMajorMinor; + } + typingsInstaller.typingsName = typingsName; + var versionMajorMinor = ts.version.split(".").slice(0, 2).join("."); })(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {})); })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); @@ -7044,17 +7573,23 @@ var ts; var FileLog = (function () { function FileLog(logFile) { this.logFile = logFile; + this.logEnabled = true; } FileLog.prototype.isEnabled = function () { - return this.logFile !== undefined; + return this.logEnabled && this.logFile !== undefined; }; FileLog.prototype.writeLine = function (text) { - fs.appendFileSync(this.logFile, text + ts.sys.newLine); + try { + fs.appendFileSync(this.logFile, text + ts.sys.newLine); + } + catch (e) { + this.logEnabled = false; + } }; return FileLog; }()); function getNPMLocation(processName) { - if (path.basename(processName).indexOf("node") == 0) { + if (path.basename(processName).indexOf("node") === 0) { return "\"" + path.join(path.dirname(process.argv[0]), "npm") + "\""; } else { @@ -7070,7 +7605,7 @@ var ts; } try { var content = JSON.parse(host.readFile(typesRegistryFilePath)); - return ts.createMap(content.entries); + return ts.createMapFromTemplate(content.entries); } catch (e) { if (log.isEnabled()) { @@ -7085,8 +7620,8 @@ var ts; } var NodeTypingsInstaller = (function (_super) { __extends(NodeTypingsInstaller, _super); - function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, telemetryEnabled, log) { - var _this = _super.call(this, ts.sys, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, telemetryEnabled, log) || this; + function NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, throttleLimit, log) { + var _this = _super.call(this, ts.sys, globalTypingsCacheLocation, typingSafeListLocation ? ts.toPath(typingSafeListLocation, "", ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)) : ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, log) || this; if (_this.log.isEnabled()) { _this.log.writeLine("Process id: " + process.pid); } @@ -7103,6 +7638,10 @@ var ts; if (_this.log.isEnabled()) { _this.log.writeLine("Error updating " + TypesRegistryPackageName + " package: " + e.message); } + _this.delayedInitializationError = { + kind: "event::initializationFailed", + message: e.message + }; } _this.typesRegistry = loadTypesRegistryFile(getTypesRegistryFileLocation(globalTypingsCacheLocation), _this.installTypingHost, _this.log); return _this; @@ -7110,6 +7649,10 @@ var ts; NodeTypingsInstaller.prototype.listen = function () { var _this = this; process.on("message", function (req) { + if (_this.delayedInitializationError) { + _this.sendResponse(_this.delayedInitializationError); + _this.delayedInitializationError = undefined; + } switch (req.kind) { case "discover": _this.install(req); @@ -7155,7 +7698,7 @@ var ts; typingsInstaller.NodeTypingsInstaller = NodeTypingsInstaller; var logFilePath = server.findArgument(server.Arguments.LogFile); var globalTypingsCacheLocation = server.findArgument(server.Arguments.GlobalCacheLocation); - var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry); + var typingSafeListLocation = server.findArgument(server.Arguments.TypingSafeListLocation); var log = new FileLog(logFilePath); if (log.isEnabled()) { process.on("uncaughtException", function (e) { @@ -7168,7 +7711,7 @@ var ts; } process.exit(0); }); - var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, 5, telemetryEnabled, log); + var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, 5, log); installer.listen(); })(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {})); })(server = ts.server || (ts.server = {})); diff --git a/node_modules/typescript/package.json b/node_modules/typescript/package.json index cd55aa06f..b39c4e759 100644 --- a/node_modules/typescript/package.json +++ b/node_modules/typescript/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "2.2.0-dev.20161127", + "version": "2.3.0-dev.20170419", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ @@ -26,7 +26,7 @@ "tsserver": "./bin/tsserver" }, "engines": { - "node": ">=0.8.0" + "node": ">=4.2.0" }, "devDependencies": { "@types/browserify": "latest", @@ -60,7 +60,7 @@ "gulp-insert": "latest", "gulp-newer": "latest", "gulp-sourcemaps": "latest", - "gulp-typescript": "latest", + "gulp-typescript": "3.1.5", "into-stream": "latest", "istanbul": "latest", "jake": "latest", diff --git a/node_modules/v8flags/README.md b/node_modules/v8flags/README.md index 7cc6bbc13..ca6065b22 100644 --- a/node_modules/v8flags/README.md +++ b/node_modules/v8flags/README.md @@ -23,6 +23,8 @@ v8flags(function (err, results) { ## Release History +* 2017-04-18 - v2.1.0 - hash username to support invalid path characters +* 2017-03-31 - v2.0.12 - don't pollute global namespace * 2015-12-07 - v2.0.11 - cache to temp directory if home is present but unwritable * 2015-07-28 - v2.0.10 - don't throw for electron runtime, just call back with empty array * 2015-06-25 - v2.0.9 - call back with flags even if cache file can't be written diff --git a/node_modules/v8flags/index.js b/node_modules/v8flags/index.js index a368b5ced..40404d005 100644 --- a/node_modules/v8flags/index.js +++ b/node_modules/v8flags/index.js @@ -5,12 +5,14 @@ const os = require('os'); const fs = require('fs'); const path = require('path'); +const crypto = require('crypto'); const execFile = require('child_process').execFile; const env = process.env; -const user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; -const configfile = '.v8flags.'+process.versions.v8+'.'+user+'.json'; +const user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME || ''; const exclusions = ['--help']; +const configfile = '.v8flags.'+process.versions.v8+'.'+crypto.createHash('md5').update(user).digest('hex')+'.json'; + const failureMessage = [ 'Unable to cache a config file for v8flags to a your home directory', 'or a temporary folder. To fix this problem, please correct your', @@ -42,7 +44,7 @@ function tryOpenConfig (configpath, cb) { // if the config file is valid, it should be json and therefore // node should be able to require it directly. if this doesn't // throw, we're done! - content = require(configpath); + var content = require(configpath); process.nextTick(function () { cb(null, content); }); diff --git a/node_modules/v8flags/package.json b/node_modules/v8flags/package.json index 68001b170..b711a7282 100644 --- a/node_modules/v8flags/package.json +++ b/node_modules/v8flags/package.json @@ -1,7 +1,7 @@ { "name": "v8flags", "description": "Get available v8 flags.", - "version": "2.0.11", + "version": "2.1.1", "homepage": "https://github.com/tkellen/node-v8flags", "author": { "name": "Tyler Kellen", diff --git a/node_modules/vinyl-fs/node_modules/clone-stats/LICENSE.md b/node_modules/vinyl-fs/node_modules/clone-stats/LICENSE.md deleted file mode 100644 index 146cb32a7..000000000 --- a/node_modules/vinyl-fs/node_modules/clone-stats/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -## The MIT License (MIT) ## - -Copyright (c) 2014 Hugh Kennedy - -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/node_modules/vinyl-fs/node_modules/clone-stats/README.md b/node_modules/vinyl-fs/node_modules/clone-stats/README.md deleted file mode 100644 index 8b12b6fa5..000000000 --- a/node_modules/vinyl-fs/node_modules/clone-stats/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) # - -Safely clone node's -[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without -losing their class methods, i.e. `stat.isDirectory()` and co. - -## Usage ## - -[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats) - -### `copy = require('clone-stats')(stat)` ### - -Returns a clone of the original `fs.Stats` instance (`stat`). - -## License ## - -MIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details. diff --git a/node_modules/vinyl-fs/node_modules/clone-stats/index.js b/node_modules/vinyl-fs/node_modules/clone-stats/index.js deleted file mode 100644 index e797cfe6e..000000000 --- a/node_modules/vinyl-fs/node_modules/clone-stats/index.js +++ /dev/null @@ -1,13 +0,0 @@ -var Stat = require('fs').Stats - -module.exports = cloneStats - -function cloneStats(stats) { - var replacement = new Stat - - Object.keys(stats).forEach(function(key) { - replacement[key] = stats[key] - }) - - return replacement -} diff --git a/node_modules/vinyl-fs/node_modules/clone-stats/package.json b/node_modules/vinyl-fs/node_modules/clone-stats/package.json deleted file mode 100644 index 2880625c1..000000000 --- a/node_modules/vinyl-fs/node_modules/clone-stats/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "clone-stats", - "description": "Safely clone node's fs.Stats instances without losing their class methods", - "version": "0.0.1", - "main": "index.js", - "browser": "index.js", - "dependencies": {}, - "devDependencies": { - "tape": "~2.3.2" - }, - "scripts": { - "test": "node test" - }, - "author": "Hugh Kennedy (http://hughsk.io/)", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/hughsk/clone-stats" - }, - "bugs": { - "url": "https://github.com/hughsk/clone-stats/issues" - }, - "homepage": "https://github.com/hughsk/clone-stats", - "keywords": [ - "stats", - "fs", - "clone", - "copy", - "prototype" - ] -} diff --git a/node_modules/vinyl-fs/node_modules/clone-stats/test.js b/node_modules/vinyl-fs/node_modules/clone-stats/test.js deleted file mode 100644 index e4bb2814d..000000000 --- a/node_modules/vinyl-fs/node_modules/clone-stats/test.js +++ /dev/null @@ -1,36 +0,0 @@ -var test = require('tape') -var clone = require('./') -var fs = require('fs') - -test('file', function(t) { - compare(t, fs.statSync(__filename)) - t.end() -}) - -test('directory', function(t) { - compare(t, fs.statSync(__dirname)) - t.end() -}) - -function compare(t, stat) { - var copy = clone(stat) - - t.deepEqual(stat, copy, 'clone has equal properties') - t.ok(stat instanceof fs.Stats, 'original is an fs.Stat') - t.ok(copy instanceof fs.Stats, 'copy is an fs.Stat') - - ;['isDirectory' - , 'isFile' - , 'isBlockDevice' - , 'isCharacterDevice' - , 'isSymbolicLink' - , 'isFIFO' - , 'isSocket' - ].forEach(function(method) { - t.equal( - stat[method].call(stat) - , copy[method].call(copy) - , 'equal value for stat.' + method + '()' - ) - }) -} diff --git a/node_modules/vinyl-fs/node_modules/replace-ext/.npmignore b/node_modules/vinyl-fs/node_modules/replace-ext/.npmignore deleted file mode 100644 index b5ef13a3c..000000000 --- a/node_modules/vinyl-fs/node_modules/replace-ext/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -*.log -node_modules -build -*.node -components \ No newline at end of file diff --git a/node_modules/vinyl-fs/node_modules/replace-ext/.travis.yml b/node_modules/vinyl-fs/node_modules/replace-ext/.travis.yml deleted file mode 100644 index 8101b9fe7..000000000 --- a/node_modules/vinyl-fs/node_modules/replace-ext/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "0.7" - - "0.8" - - "0.9" - - "0.10" -after_script: - - npm run coveralls \ No newline at end of file diff --git a/node_modules/vinyl-fs/node_modules/replace-ext/LICENSE b/node_modules/vinyl-fs/node_modules/replace-ext/LICENSE deleted file mode 100755 index 7cbe012c6..000000000 --- a/node_modules/vinyl-fs/node_modules/replace-ext/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2014 Fractal - -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/node_modules/vinyl-fs/node_modules/replace-ext/README.md b/node_modules/vinyl-fs/node_modules/replace-ext/README.md deleted file mode 100644 index 05b5d21fd..000000000 --- a/node_modules/vinyl-fs/node_modules/replace-ext/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# replace-ext [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][david-image]][david-url] - - -## Information - - - - - - - - - - - - - -
Packagereplace-ext
DescriptionReplaces a file extension with another one
Node Version>= 0.4
- -## Usage - -```javascript -var replaceExt = require('replace-ext'); - -var path = '/some/dir/file.js'; -var npath = replaceExt(path, '.coffee'); - -console.log(npath); // /some/dir/file.coffee -``` - -[npm-url]: https://npmjs.org/package/replace-ext -[npm-image]: https://badge.fury.io/js/replace-ext.png - -[travis-url]: https://travis-ci.org/wearefractal/replace-ext -[travis-image]: https://travis-ci.org/wearefractal/replace-ext.png?branch=master - -[coveralls-url]: https://coveralls.io/r/wearefractal/replace-ext -[coveralls-image]: https://coveralls.io/repos/wearefractal/replace-ext/badge.png - -[depstat-url]: https://david-dm.org/wearefractal/replace-ext -[depstat-image]: https://david-dm.org/wearefractal/replace-ext.png - -[david-url]: https://david-dm.org/wearefractal/replace-ext -[david-image]: https://david-dm.org/wearefractal/replace-ext.png?theme=shields.io \ No newline at end of file diff --git a/node_modules/vinyl-fs/node_modules/replace-ext/index.js b/node_modules/vinyl-fs/node_modules/replace-ext/index.js deleted file mode 100644 index 3f76938e4..000000000 --- a/node_modules/vinyl-fs/node_modules/replace-ext/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var path = require('path'); - -module.exports = function(npath, ext) { - if (typeof npath !== 'string') return npath; - if (npath.length === 0) return npath; - - var nFileName = path.basename(npath, path.extname(npath))+ext; - return path.join(path.dirname(npath), nFileName); -}; \ No newline at end of file diff --git a/node_modules/vinyl-fs/node_modules/replace-ext/package.json b/node_modules/vinyl-fs/node_modules/replace-ext/package.json deleted file mode 100644 index 307d99b78..000000000 --- a/node_modules/vinyl-fs/node_modules/replace-ext/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name":"replace-ext", - "description":"Replaces a file extension with another one", - "version":"0.0.1", - "homepage":"http://github.com/wearefractal/replace-ext", - "repository":"git://github.com/wearefractal/replace-ext.git", - "author":"Fractal (http://wearefractal.com/)", - "main":"./index.js", - - "dependencies":{ - - }, - "devDependencies": { - "mocha": "~1.17.0", - "should": "~3.1.0", - "mocha-lcov-reporter": "~0.0.1", - "coveralls": "~2.6.1", - "istanbul": "~0.2.3", - "rimraf": "~2.2.5", - "jshint": "~2.4.1" - }, - "scripts": { - "test": "mocha --reporter spec && jshint", - "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" - }, - "engines": { - "node": ">= 0.4" - }, - "licenses":[ - { - "type":"MIT", - "url":"http://github.com/wearefractal/replace-ext/raw/master/LICENSE" - } - ] -} diff --git a/node_modules/vinyl-fs/node_modules/replace-ext/test/main.js b/node_modules/vinyl-fs/node_modules/replace-ext/test/main.js deleted file mode 100644 index 51377021b..000000000 --- a/node_modules/vinyl-fs/node_modules/replace-ext/test/main.js +++ /dev/null @@ -1,51 +0,0 @@ -var replaceExt = require('../'); -var path = require('path'); -var should = require('should'); -require('mocha'); - -describe('replace-ext', function() { - it('should return a valid replaced extension on nested', function(done) { - var fname = path.join(__dirname, './fixtures/test.coffee'); - var expected = path.join(__dirname, './fixtures/test.js'); - var nu = replaceExt(fname, '.js'); - should.exist(nu); - nu.should.equal(expected); - done(); - }); - - it('should return a valid replaced extension on flat', function(done) { - var fname = 'test.coffee'; - var expected = 'test.js'; - var nu = replaceExt(fname, '.js'); - should.exist(nu); - nu.should.equal(expected); - done(); - }); - - it('should not return a valid replaced extension on empty string', function(done) { - var fname = ''; - var expected = ''; - var nu = replaceExt(fname, '.js'); - should.exist(nu); - nu.should.equal(expected); - done(); - }); - - it('should return a valid removed extension on nested', function(done) { - var fname = path.join(__dirname, './fixtures/test.coffee'); - var expected = path.join(__dirname, './fixtures/test'); - var nu = replaceExt(fname, ''); - should.exist(nu); - nu.should.equal(expected); - done(); - }); - - it('should return a valid added extension on nested', function(done) { - var fname = path.join(__dirname, './fixtures/test'); - var expected = path.join(__dirname, './fixtures/test.js'); - var nu = replaceExt(fname, '.js'); - should.exist(nu); - nu.should.equal(expected); - done(); - }); -}); diff --git a/node_modules/vinyl/index.js b/node_modules/vinyl/index.js index af91a1273..db5dc2a64 100644 --- a/node_modules/vinyl/index.js +++ b/node_modules/vinyl/index.js @@ -214,6 +214,8 @@ Object.defineProperty(File.prototype, 'base', { base = removeTrailingSep(normalize(base)); if (base !== this._cwd) { this._base = base; + } else { + delete this._base; } }, }); diff --git a/node_modules/vinyl/package.json b/node_modules/vinyl/package.json index 3f407f18c..dc94e7685 100644 --- a/node_modules/vinyl/package.json +++ b/node_modules/vinyl/package.json @@ -1,6 +1,6 @@ { "name": "vinyl", - "version": "2.0.0", + "version": "2.0.2", "description": "Virtual file format.", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ @@ -29,7 +29,7 @@ "clone": "^1.0.0", "clone-buffer": "^1.0.0", "clone-stats": "^1.0.0", - "cloneable-readable": "^0.5.0", + "cloneable-readable": "^1.0.0", "is-stream": "^1.1.0", "remove-trailing-separator": "^1.0.1", "replace-ext": "^1.0.0" diff --git a/node_modules/when/dist/browser/when.debug.js b/node_modules/when/dist/browser/when.debug.js index 8b1b356a2..4f0097946 100644 --- a/node_modules/when/dist/browser/when.debug.js +++ b/node_modules/when/dist/browser/when.debug.js @@ -1092,13 +1092,23 @@ define(function(require) { } function settleOne(p) { - var h = Promise._handler(p); - if(h.state() === 0) { + // Optimize the case where we get an already-resolved when.js promise + // by extracting its state: + var handler; + if (p instanceof Promise) { + // This is our own Promise type and we can reach its handler internals: + handler = p._handler.join(); + } + if((handler && handler.state() === 0) || !handler) { + // Either still pending, or not a Promise at all: return toPromise(p).then(state.fulfilled, state.rejected); } - h._unreport(); - return state.inspect(h); + // The promise is our own, but it is already resolved. Take a shortcut. + // Since we're not actually handling the resolution, we need to disable + // rejection reporting. + handler._unreport(); + return state.inspect(handler); } /** @@ -1705,8 +1715,8 @@ define(function(require) { } function hasMutationObserver () { - return (typeof MutationObserver === 'function' && MutationObserver) || - (typeof WebKitMutationObserver === 'function' && WebKitMutationObserver); + return (typeof MutationObserver !== 'undefined' && MutationObserver) || + (typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver); } function initMutationObserver(MutationObserver) { @@ -2703,6 +2713,28 @@ define(function() { function noop() {} + function hasCustomEvent() { + if(typeof CustomEvent === 'function') { + try { + var ev = new CustomEvent('unhandledRejection'); + return ev instanceof CustomEvent; + } catch (ignoredException) {} + } + return false; + } + + function hasInternetExplorerCustomEvent() { + if(typeof document !== 'undefined' && typeof document.createEvent === 'function') { + try { + // Try to create one event to make sure it's supported + var ev = document.createEvent('CustomEvent'); + ev.initCustomEvent('eventType', false, true, {}); + return true; + } catch (ignoredException) {} + } + return false; + } + function initEmitRejection() { /*global process, self, CustomEvent*/ if(typeof process !== 'undefined' && process !== null @@ -2716,15 +2748,9 @@ define(function() { ? process.emit(type, rejection.value, rejection) : process.emit(type, rejection); }; - } else if(typeof self !== 'undefined' && typeof CustomEvent === 'function') { - return (function(noop, self, CustomEvent) { - var hasCustomEvent = false; - try { - var ev = new CustomEvent('unhandledRejection'); - hasCustomEvent = ev instanceof CustomEvent; - } catch (e) {} - - return !hasCustomEvent ? noop : function(type, rejection) { + } else if(typeof self !== 'undefined' && hasCustomEvent()) { + return (function (self, CustomEvent) { + return function (type, rejection) { var ev = new CustomEvent(type, { detail: { reason: rejection.value, @@ -2736,7 +2762,19 @@ define(function() { return !self.dispatchEvent(ev); }; - }(noop, self, CustomEvent)); + }(self, CustomEvent)); + } else if(typeof self !== 'undefined' && hasInternetExplorerCustomEvent()) { + return (function(self, document) { + return function(type, rejection) { + var ev = document.createEvent('CustomEvent'); + ev.initCustomEvent(type, false, true, { + reason: rejection.value, + key: rejection + }); + + return !self.dispatchEvent(ev); + }; + }(self, document)); } return noop; diff --git a/node_modules/when/dist/browser/when.debug.js.map b/node_modules/when/dist/browser/when.debug.js.map index f8fb33227..8f46e36d0 100644 --- a/node_modules/when/dist/browser/when.debug.js.map +++ b/node_modules/when/dist/browser/when.debug.js.map @@ -42,7 +42,7 @@ "when.js" ], "names": [], - "mappings": ";AAAA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "mappings": ";AAAA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC37BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", "sourcesContent": [ "require('../monitor/console');\nmodule.exports = require('./when.browserify.js');\n\n", "var when = module.exports = require('../when');\n\nwhen.callbacks = require('../callbacks');\nwhen.cancelable = require('../cancelable');\nwhen.delay = require('../delay');\nwhen.fn = require('../function');\nwhen.guard = require('../guard');\nwhen.keys = require('../keys');\nwhen.nodefn = when.node = require('../node');\nwhen.parallel = require('../parallel');\nwhen.pipeline = require('../pipeline');\nwhen.poll = require('../poll');\nwhen.sequence = require('../sequence');\nwhen.timeout = require('../timeout');\n", @@ -56,7 +56,7 @@ "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\t// Credit to Twisol (https://github.com/Twisol) for suggesting\n\t// this type of extensible queue + trampoline approach for next-tick conflation.\n\n\t/**\n\t * Async task scheduler\n\t * @param {function} async function to schedule a single async function\n\t * @constructor\n\t */\n\tfunction Scheduler(async) {\n\t\tthis._async = async;\n\t\tthis._running = false;\n\n\t\tthis._queue = this;\n\t\tthis._queueLen = 0;\n\t\tthis._afterQueue = {};\n\t\tthis._afterQueueLen = 0;\n\n\t\tvar self = this;\n\t\tthis.drain = function() {\n\t\t\tself._drain();\n\t\t};\n\t}\n\n\t/**\n\t * Enqueue a task\n\t * @param {{ run:function }} task\n\t */\n\tScheduler.prototype.enqueue = function(task) {\n\t\tthis._queue[this._queueLen++] = task;\n\t\tthis.run();\n\t};\n\n\t/**\n\t * Enqueue a task to run after the main task queue\n\t * @param {{ run:function }} task\n\t */\n\tScheduler.prototype.afterQueue = function(task) {\n\t\tthis._afterQueue[this._afterQueueLen++] = task;\n\t\tthis.run();\n\t};\n\n\tScheduler.prototype.run = function() {\n\t\tif (!this._running) {\n\t\t\tthis._running = true;\n\t\t\tthis._async(this.drain);\n\t\t}\n\t};\n\n\t/**\n\t * Drain the handler queue entirely, and then the after queue\n\t */\n\tScheduler.prototype._drain = function() {\n\t\tvar i = 0;\n\t\tfor (; i < this._queueLen; ++i) {\n\t\t\tthis._queue[i].run();\n\t\t\tthis._queue[i] = void 0;\n\t\t}\n\n\t\tthis._queueLen = 0;\n\t\tthis._running = false;\n\n\t\tfor (i = 0; i < this._afterQueueLen; ++i) {\n\t\t\tthis._afterQueue[i].run();\n\t\t\tthis._afterQueue[i] = void 0;\n\t\t}\n\n\t\tthis._afterQueueLen = 0;\n\t};\n\n\treturn Scheduler;\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\t/**\n\t * Custom error type for promises rejected by promise.timeout\n\t * @param {string} message\n\t * @constructor\n\t */\n\tfunction TimeoutError (message) {\n\t\tError.call(this);\n\t\tthis.message = message;\n\t\tthis.name = TimeoutError.name;\n\t\tif (typeof Error.captureStackTrace === 'function') {\n\t\t\tError.captureStackTrace(this, TimeoutError);\n\t\t}\n\t}\n\n\tTimeoutError.prototype = Object.create(Error.prototype);\n\tTimeoutError.prototype.constructor = TimeoutError;\n\n\treturn TimeoutError;\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\tmakeApply.tryCatchResolve = tryCatchResolve;\n\n\treturn makeApply;\n\n\tfunction makeApply(Promise, call) {\n\t\tif(arguments.length < 2) {\n\t\t\tcall = tryCatchResolve;\n\t\t}\n\n\t\treturn apply;\n\n\t\tfunction apply(f, thisArg, args) {\n\t\t\tvar p = Promise._defer();\n\t\t\tvar l = args.length;\n\t\t\tvar params = new Array(l);\n\t\t\tcallAndResolve({ f:f, thisArg:thisArg, args:args, params:params, i:l-1, call:call }, p._handler);\n\n\t\t\treturn p;\n\t\t}\n\n\t\tfunction callAndResolve(c, h) {\n\t\t\tif(c.i < 0) {\n\t\t\t\treturn call(c.f, c.thisArg, c.params, h);\n\t\t\t}\n\n\t\t\tvar handler = Promise._handler(c.args[c.i]);\n\t\t\thandler.fold(callAndResolveNext, c, void 0, h);\n\t\t}\n\n\t\tfunction callAndResolveNext(c, x, h) {\n\t\t\tc.params[c.i] = x;\n\t\t\tc.i -= 1;\n\t\t\tcallAndResolve(c, h);\n\t\t}\n\t}\n\n\tfunction tryCatchResolve(f, thisArg, args, resolver) {\n\t\ttry {\n\t\t\tresolver.resolve(f.apply(thisArg, args));\n\t\t} catch(e) {\n\t\t\tresolver.reject(e);\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar state = require('../state');\n\tvar applier = require('../apply');\n\n\treturn function array(Promise) {\n\n\t\tvar applyFold = applier(Promise);\n\t\tvar toPromise = Promise.resolve;\n\t\tvar all = Promise.all;\n\n\t\tvar ar = Array.prototype.reduce;\n\t\tvar arr = Array.prototype.reduceRight;\n\t\tvar slice = Array.prototype.slice;\n\n\t\t// Additional array combinators\n\n\t\tPromise.any = any;\n\t\tPromise.some = some;\n\t\tPromise.settle = settle;\n\n\t\tPromise.map = map;\n\t\tPromise.filter = filter;\n\t\tPromise.reduce = reduce;\n\t\tPromise.reduceRight = reduceRight;\n\n\t\t/**\n\t\t * When this promise fulfills with an array, do\n\t\t * onFulfilled.apply(void 0, array)\n\t\t * @param {function} onFulfilled function to apply\n\t\t * @returns {Promise} promise for the result of applying onFulfilled\n\t\t */\n\t\tPromise.prototype.spread = function(onFulfilled) {\n\t\t\treturn this.then(all).then(function(array) {\n\t\t\t\treturn onFulfilled.apply(this, array);\n\t\t\t});\n\t\t};\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * One-winner competitive race.\n\t\t * Return a promise that will fulfill when one of the promises\n\t\t * in the input array fulfills, or will reject when all promises\n\t\t * have rejected.\n\t\t * @param {array} promises\n\t\t * @returns {Promise} promise for the first fulfilled value\n\t\t */\n\t\tfunction any(promises) {\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\t\t\tvar l = promises.length>>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", + "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar state = require('../state');\n\tvar applier = require('../apply');\n\n\treturn function array(Promise) {\n\n\t\tvar applyFold = applier(Promise);\n\t\tvar toPromise = Promise.resolve;\n\t\tvar all = Promise.all;\n\n\t\tvar ar = Array.prototype.reduce;\n\t\tvar arr = Array.prototype.reduceRight;\n\t\tvar slice = Array.prototype.slice;\n\n\t\t// Additional array combinators\n\n\t\tPromise.any = any;\n\t\tPromise.some = some;\n\t\tPromise.settle = settle;\n\n\t\tPromise.map = map;\n\t\tPromise.filter = filter;\n\t\tPromise.reduce = reduce;\n\t\tPromise.reduceRight = reduceRight;\n\n\t\t/**\n\t\t * When this promise fulfills with an array, do\n\t\t * onFulfilled.apply(void 0, array)\n\t\t * @param {function} onFulfilled function to apply\n\t\t * @returns {Promise} promise for the result of applying onFulfilled\n\t\t */\n\t\tPromise.prototype.spread = function(onFulfilled) {\n\t\t\treturn this.then(all).then(function(array) {\n\t\t\t\treturn onFulfilled.apply(this, array);\n\t\t\t});\n\t\t};\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * One-winner competitive race.\n\t\t * Return a promise that will fulfill when one of the promises\n\t\t * in the input array fulfills, or will reject when all promises\n\t\t * have rejected.\n\t\t * @param {array} promises\n\t\t * @returns {Promise} promise for the first fulfilled value\n\t\t */\n\t\tfunction any(promises) {\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\t\t\tvar l = promises.length>>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function flow(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\t\tvar reject = Promise.reject;\n\t\tvar origCatch = Promise.prototype['catch'];\n\n\t\t/**\n\t\t * Handle the ultimate fulfillment value or rejection reason, and assume\n\t\t * responsibility for all errors. If an error propagates out of result\n\t\t * or handleFatalError, it will be rethrown to the host, resulting in a\n\t\t * loud stack track on most platforms and a crash on some.\n\t\t * @param {function?} onResult\n\t\t * @param {function?} onError\n\t\t * @returns {undefined}\n\t\t */\n\t\tPromise.prototype.done = function(onResult, onError) {\n\t\t\tthis._handler.visit(this._handler.receiver, onResult, onError);\n\t\t};\n\n\t\t/**\n\t\t * Add Error-type and predicate matching to catch. Examples:\n\t\t * promise.catch(TypeError, handleTypeError)\n\t\t * .catch(predicate, handleMatchedErrors)\n\t\t * .catch(handleRemainingErrors)\n\t\t * @param onRejected\n\t\t * @returns {*}\n\t\t */\n\t\tPromise.prototype['catch'] = Promise.prototype.otherwise = function(onRejected) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\treturn origCatch.call(this, onRejected);\n\t\t\t}\n\n\t\t\tif(typeof onRejected !== 'function') {\n\t\t\t\treturn this.ensure(rejectInvalidPredicate);\n\t\t\t}\n\n\t\t\treturn origCatch.call(this, createCatchFilter(arguments[1], onRejected));\n\t\t};\n\n\t\t/**\n\t\t * Wraps the provided catch handler, so that it will only be called\n\t\t * if the predicate evaluates truthy\n\t\t * @param {?function} handler\n\t\t * @param {function} predicate\n\t\t * @returns {function} conditional catch handler\n\t\t */\n\t\tfunction createCatchFilter(handler, predicate) {\n\t\t\treturn function(e) {\n\t\t\t\treturn evaluatePredicate(e, predicate)\n\t\t\t\t\t? handler.call(this, e)\n\t\t\t\t\t: reject(e);\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Ensures that onFulfilledOrRejected will be called regardless of whether\n\t\t * this promise is fulfilled or rejected. onFulfilledOrRejected WILL NOT\n\t\t * receive the promises' value or reason. Any returned value will be disregarded.\n\t\t * onFulfilledOrRejected may throw or return a rejected promise to signal\n\t\t * an additional error.\n\t\t * @param {function} handler handler to be called regardless of\n\t\t * fulfillment or rejection\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['finally'] = Promise.prototype.ensure = function(handler) {\n\t\t\tif(typeof handler !== 'function') {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\treturn this.then(function(x) {\n\t\t\t\treturn runSideEffect(handler, this, identity, x);\n\t\t\t}, function(e) {\n\t\t\t\treturn runSideEffect(handler, this, reject, e);\n\t\t\t});\n\t\t};\n\n\t\tfunction runSideEffect (handler, thisArg, propagate, value) {\n\t\t\tvar result = handler.call(thisArg);\n\t\t\treturn maybeThenable(result)\n\t\t\t\t? propagateValue(result, propagate, value)\n\t\t\t\t: propagate(value);\n\t\t}\n\n\t\tfunction propagateValue (result, propagate, x) {\n\t\t\treturn resolve(result).then(function () {\n\t\t\t\treturn propagate(x);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Recover from a failure by returning a defaultValue. If defaultValue\n\t\t * is a promise, it's fulfillment value will be used. If defaultValue is\n\t\t * a promise that rejects, the returned promise will reject with the\n\t\t * same reason.\n\t\t * @param {*} defaultValue\n\t\t * @returns {Promise} new promise\n\t\t */\n\t\tPromise.prototype['else'] = Promise.prototype.orElse = function(defaultValue) {\n\t\t\treturn this.then(void 0, function() {\n\t\t\t\treturn defaultValue;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Shortcut for .then(function() { return value; })\n\t\t * @param {*} value\n\t\t * @return {Promise} a promise that:\n\t\t * - is fulfilled if value is not a promise, or\n\t\t * - if value is a promise, will fulfill with its value, or reject\n\t\t * with its reason.\n\t\t */\n\t\tPromise.prototype['yield'] = function(value) {\n\t\t\treturn this.then(function() {\n\t\t\t\treturn value;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Runs a side effect when this promise fulfills, without changing the\n\t\t * fulfillment value.\n\t\t * @param {function} onFulfilledSideEffect\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.tap = function(onFulfilledSideEffect) {\n\t\t\treturn this.then(onFulfilledSideEffect)['yield'](this);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n\tfunction rejectInvalidPredicate() {\n\t\tthrow new TypeError('catch predicate must be a function');\n\t}\n\n\tfunction evaluatePredicate(e, predicate) {\n\t\treturn isError(predicate) ? e instanceof predicate : predicate(e);\n\t}\n\n\tfunction isError(predicate) {\n\t\treturn predicate === Error\n\t\t\t|| (predicate != null && predicate.prototype instanceof Error);\n\t}\n\n\tfunction maybeThenable(x) {\n\t\treturn (typeof x === 'object' || typeof x === 'function') && x !== null;\n\t}\n\n\tfunction identity(x) {\n\t\treturn x;\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n/** @author Jeff Escalante */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function fold(Promise) {\n\n\t\tPromise.prototype.fold = function(f, z) {\n\t\t\tvar promise = this._beget();\n\n\t\t\tthis._handler.fold(function(z, x, to) {\n\t\t\t\tPromise._handler(z).fold(function(x, z, to) {\n\t\t\t\t\tto.resolve(f.call(this, z, x));\n\t\t\t\t}, x, this, to);\n\t\t\t}, z, promise._handler.receiver, promise._handler);\n\n\t\t\treturn promise;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar inspect = require('../state').inspect;\n\n\treturn function inspection(Promise) {\n\n\t\tPromise.prototype.inspect = function() {\n\t\t\treturn inspect(Promise._handler(this));\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", @@ -65,10 +65,10 @@ "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar env = require('../env');\n\tvar TimeoutError = require('../TimeoutError');\n\n\tfunction setTimeout(f, ms, x, y) {\n\t\treturn env.setTimer(function() {\n\t\t\tf(x, y, ms);\n\t\t}, ms);\n\t}\n\n\treturn function timed(Promise) {\n\t\t/**\n\t\t * Return a new promise whose fulfillment value is revealed only\n\t\t * after ms milliseconds\n\t\t * @param {number} ms milliseconds\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.delay = function(ms) {\n\t\t\tvar p = this._beget();\n\t\t\tthis._handler.fold(handleDelay, ms, void 0, p._handler);\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction handleDelay(ms, x, h) {\n\t\t\tsetTimeout(resolveDelay, ms, x, h);\n\t\t}\n\n\t\tfunction resolveDelay(x, h) {\n\t\t\th.resolve(x);\n\t\t}\n\n\t\t/**\n\t\t * Return a new promise that rejects after ms milliseconds unless\n\t\t * this promise fulfills earlier, in which case the returned promise\n\t\t * fulfills with the same value.\n\t\t * @param {number} ms milliseconds\n\t\t * @param {Error|*=} reason optional rejection reason to use, defaults\n\t\t * to a TimeoutError if not provided\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.timeout = function(ms, reason) {\n\t\t\tvar p = this._beget();\n\t\t\tvar h = p._handler;\n\n\t\t\tvar t = setTimeout(onTimeout, ms, reason, p._handler);\n\n\t\t\tthis._handler.visit(h,\n\t\t\t\tfunction onFulfill(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.resolve(x); // this = h\n\t\t\t\t},\n\t\t\t\tfunction onReject(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.reject(x); // this = h\n\t\t\t\t},\n\t\t\t\th.notify);\n\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction onTimeout(reason, h, ms) {\n\t\t\tvar e = typeof reason === 'undefined'\n\t\t\t\t? new TimeoutError('timed out after ' + ms + 'ms')\n\t\t\t\t: reason;\n\t\t\th.reject(e);\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar setTimer = require('../env').setTimer;\n\tvar format = require('../format');\n\n\treturn function unhandledRejection(Promise) {\n\n\t\tvar logError = noop;\n\t\tvar logInfo = noop;\n\t\tvar localConsole;\n\n\t\tif(typeof console !== 'undefined') {\n\t\t\t// Alias console to prevent things like uglify's drop_console option from\n\t\t\t// removing console.log/error. Unhandled rejections fall into the same\n\t\t\t// category as uncaught exceptions, and build tools shouldn't silence them.\n\t\t\tlocalConsole = console;\n\t\t\tlogError = typeof localConsole.error !== 'undefined'\n\t\t\t\t? function (e) { localConsole.error(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\n\t\t\tlogInfo = typeof localConsole.info !== 'undefined'\n\t\t\t\t? function (e) { localConsole.info(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\t\t}\n\n\t\tPromise.onPotentiallyUnhandledRejection = function(rejection) {\n\t\t\tenqueue(report, rejection);\n\t\t};\n\n\t\tPromise.onPotentiallyUnhandledRejectionHandled = function(rejection) {\n\t\t\tenqueue(unreport, rejection);\n\t\t};\n\n\t\tPromise.onFatalRejection = function(rejection) {\n\t\t\tenqueue(throwit, rejection.value);\n\t\t};\n\n\t\tvar tasks = [];\n\t\tvar reported = [];\n\t\tvar running = null;\n\n\t\tfunction report(r) {\n\t\t\tif(!r.handled) {\n\t\t\t\treported.push(r);\n\t\t\t\tlogError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction unreport(r) {\n\t\t\tvar i = reported.indexOf(r);\n\t\t\tif(i >= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function addWith(Promise) {\n\t\t/**\n\t\t * Returns a promise whose handlers will be called with `this` set to\n\t\t * the supplied receiver. Subsequent promises derived from the\n\t\t * returned promise will also have their handlers called with receiver\n\t\t * as `this`. Calling `with` with undefined or no arguments will return\n\t\t * a promise whose handlers will again be called in the usual Promises/A+\n\t\t * way (no `this`) thus safely undoing any previous `with` in the\n\t\t * promise chain.\n\t\t *\n\t\t * WARNING: Promises returned from `with`/`withThis` are NOT Promises/A+\n\t\t * compliant, specifically violating 2.2.5 (http://promisesaplus.com/#point-41)\n\t\t *\n\t\t * @param {object} receiver `this` value for all handlers attached to\n\t\t * the returned promise.\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['with'] = Promise.prototype.withThis = function(receiver) {\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\t\t\tchild.receiver = receiver;\n\t\t\tthis._handler.chain(child, receiver);\n\t\t\treturn p;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === 'function' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === 'function' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", + "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t return (typeof MutationObserver !== 'undefined' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function liftAll(liftOne, combine, dst, src) {\n\t\tif(typeof combine === 'undefined') {\n\t\t\tcombine = defaultCombine;\n\t\t}\n\n\t\treturn Object.keys(src).reduce(function(dst, key) {\n\t\t\tvar f = src[key];\n\t\t\treturn typeof f === 'function' ? combine(dst, liftOne(f), key) : dst;\n\t\t}, typeof dst === 'undefined' ? defaultDst(src) : dst);\n\t};\n\n\tfunction defaultCombine(o, f, k) {\n\t\to[k] = f;\n\t\treturn o;\n\t}\n\n\tfunction defaultDst(src) {\n\t\treturn typeof src === 'function' ? src.bind() : Object.create(src);\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0 ? toFulfilledState(handler.value)\n\t\t\t : toRejectedState(handler.value);\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar PromiseMonitor = require('./monitor/PromiseMonitor');\n\tvar ConsoleReporter = require('./monitor/ConsoleReporter');\n\n\tvar promiseMonitor = new PromiseMonitor(new ConsoleReporter());\n\n\treturn function(Promise) {\n\t\treturn promiseMonitor.monitor(Promise);\n\t};\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar error = require('./error');\n\tvar unhandledRejectionsMsg = '[promises] Unhandled rejections: ';\n\tvar allHandledMsg = '[promises] All previously unhandled rejections have now been handled';\n\n\tfunction ConsoleReporter() {\n\t\tthis._previouslyReported = false;\n\t}\n\n\tConsoleReporter.prototype = initDefaultLogging();\n\n\tConsoleReporter.prototype.log = function(traces) {\n\t\tif(traces.length === 0) {\n\t\t\tif(this._previouslyReported) {\n\t\t\t\tthis._previouslyReported = false;\n\t\t\t\tthis.msg(allHandledMsg);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tthis._previouslyReported = true;\n\t\tthis.groupStart(unhandledRejectionsMsg + traces.length);\n\t\ttry {\n\t\t\tthis._log(traces);\n\t\t} finally {\n\t\t\tthis.groupEnd();\n\t\t}\n\t};\n\n\tConsoleReporter.prototype._log = function(traces) {\n\t\tfor(var i=0; i 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * `promisify` is a version of `lift` that allows fine-grained control over the\n\t * arguments that passed to the underlying function. It is intended to handle\n\t * functions that don't follow the common callback and errback positions.\n\t *\n\t * The control is done by passing an object whose 'callback' and/or 'errback'\n\t * keys, whose values are the corresponding 0-based indexes of the arguments on\n\t * the function. Negative values are interpreted as being relative to the end\n\t * of the arguments array.\n\t *\n\t * If arguments are given on the call to the 'promisified' function, they are\n\t * intermingled with the callback and errback. If a promise is given among them,\n\t * the execution of the function will only occur after its resolution.\n\t *\n\t * @example\n\t * var delay = callbacks.promisify(setTimeout, {\n\t *\t\tcallback: 0\n\t *\t});\n\t *\n\t * delay(100).then(function() {\n\t *\t\tconsole.log(\"This happens 100ms afterwards\");\n\t *\t});\n\t *\n\t * @example\n\t * function callbackAsLast(errback, followsStandards, callback) {\n\t *\t\tif(followsStandards) {\n\t *\t\t\tcallback(\"well done!\");\n\t *\t\t} else {\n\t *\t\t\terrback(\"some programmers just want to watch the world burn\");\n\t *\t\t}\n\t *\t}\n\t *\n\t * var promisified = callbacks.promisify(callbackAsLast, {\n\t *\t\tcallback: -1,\n\t *\t\terrback: 0,\n\t *\t});\n\t *\n\t * promisified(true).then(console.log, console.error);\n\t * promisified(false).then(console.log, console.error);\n\t *\n\t * @param {Function} asyncFunction traditional function to be decorated\n\t * @param {object} positions\n\t * @param {number} [positions.callback] index at which asyncFunction expects to\n\t * receive a success callback\n\t * @param {number} [positions.errback] index at which asyncFunction expects to\n\t * receive an error callback\n\t * @returns {function} promisified function that accepts\n\t *\n\t * @deprecated\n\t */\n\tfunction promisify(asyncFunction, positions) {\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\treturn Promise.all(arguments).then(function(args) {\n\t\t\t\tvar p = Promise._defer();\n\n\t\t\t\tvar callbackPos, errbackPos;\n\n\t\t\t\tif(typeof positions.callback === 'number') {\n\t\t\t\t\tcallbackPos = normalizePosition(args, positions.callback);\n\t\t\t\t}\n\n\t\t\t\tif(typeof positions.errback === 'number') {\n\t\t\t\t\terrbackPos = normalizePosition(args, positions.errback);\n\t\t\t\t}\n\n\t\t\t\tif(errbackPos < callbackPos) {\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t} else {\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t}\n\n\t\t\t\tasyncFunction.apply(thisArg, args);\n\n\t\t\t\treturn p;\n\t\t\t});\n\t\t};\n\t}\n\n\tfunction normalizePosition(args, pos) {\n\t\treturn pos < 0 ? (args.length + pos + 2) : pos;\n\t}\n\n\tfunction insertCallback(args, pos, callback, thisArg) {\n\t\tif(typeof pos === 'number') {\n\t\t\targs.splice(pos, 0, alwaysUnary(callback, thisArg));\n\t\t}\n\t}\n\n\tfunction alwaysUnary(fn, thisArg) {\n\t\treturn function() {\n\t\t\tif (arguments.length > 1) {\n\t\t\t\tfn.call(thisArg, slice.call(arguments));\n\t\t\t} else {\n\t\t\t\tfn.apply(thisArg, arguments);\n\t\t\t}\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n", @@ -49,7 +49,7 @@ "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\t// Credit to Twisol (https://github.com/Twisol) for suggesting\n\t// this type of extensible queue + trampoline approach for next-tick conflation.\n\n\t/**\n\t * Async task scheduler\n\t * @param {function} async function to schedule a single async function\n\t * @constructor\n\t */\n\tfunction Scheduler(async) {\n\t\tthis._async = async;\n\t\tthis._running = false;\n\n\t\tthis._queue = this;\n\t\tthis._queueLen = 0;\n\t\tthis._afterQueue = {};\n\t\tthis._afterQueueLen = 0;\n\n\t\tvar self = this;\n\t\tthis.drain = function() {\n\t\t\tself._drain();\n\t\t};\n\t}\n\n\t/**\n\t * Enqueue a task\n\t * @param {{ run:function }} task\n\t */\n\tScheduler.prototype.enqueue = function(task) {\n\t\tthis._queue[this._queueLen++] = task;\n\t\tthis.run();\n\t};\n\n\t/**\n\t * Enqueue a task to run after the main task queue\n\t * @param {{ run:function }} task\n\t */\n\tScheduler.prototype.afterQueue = function(task) {\n\t\tthis._afterQueue[this._afterQueueLen++] = task;\n\t\tthis.run();\n\t};\n\n\tScheduler.prototype.run = function() {\n\t\tif (!this._running) {\n\t\t\tthis._running = true;\n\t\t\tthis._async(this.drain);\n\t\t}\n\t};\n\n\t/**\n\t * Drain the handler queue entirely, and then the after queue\n\t */\n\tScheduler.prototype._drain = function() {\n\t\tvar i = 0;\n\t\tfor (; i < this._queueLen; ++i) {\n\t\t\tthis._queue[i].run();\n\t\t\tthis._queue[i] = void 0;\n\t\t}\n\n\t\tthis._queueLen = 0;\n\t\tthis._running = false;\n\n\t\tfor (i = 0; i < this._afterQueueLen; ++i) {\n\t\t\tthis._afterQueue[i].run();\n\t\t\tthis._afterQueue[i] = void 0;\n\t\t}\n\n\t\tthis._afterQueueLen = 0;\n\t};\n\n\treturn Scheduler;\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\t/**\n\t * Custom error type for promises rejected by promise.timeout\n\t * @param {string} message\n\t * @constructor\n\t */\n\tfunction TimeoutError (message) {\n\t\tError.call(this);\n\t\tthis.message = message;\n\t\tthis.name = TimeoutError.name;\n\t\tif (typeof Error.captureStackTrace === 'function') {\n\t\t\tError.captureStackTrace(this, TimeoutError);\n\t\t}\n\t}\n\n\tTimeoutError.prototype = Object.create(Error.prototype);\n\tTimeoutError.prototype.constructor = TimeoutError;\n\n\treturn TimeoutError;\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\tmakeApply.tryCatchResolve = tryCatchResolve;\n\n\treturn makeApply;\n\n\tfunction makeApply(Promise, call) {\n\t\tif(arguments.length < 2) {\n\t\t\tcall = tryCatchResolve;\n\t\t}\n\n\t\treturn apply;\n\n\t\tfunction apply(f, thisArg, args) {\n\t\t\tvar p = Promise._defer();\n\t\t\tvar l = args.length;\n\t\t\tvar params = new Array(l);\n\t\t\tcallAndResolve({ f:f, thisArg:thisArg, args:args, params:params, i:l-1, call:call }, p._handler);\n\n\t\t\treturn p;\n\t\t}\n\n\t\tfunction callAndResolve(c, h) {\n\t\t\tif(c.i < 0) {\n\t\t\t\treturn call(c.f, c.thisArg, c.params, h);\n\t\t\t}\n\n\t\t\tvar handler = Promise._handler(c.args[c.i]);\n\t\t\thandler.fold(callAndResolveNext, c, void 0, h);\n\t\t}\n\n\t\tfunction callAndResolveNext(c, x, h) {\n\t\t\tc.params[c.i] = x;\n\t\t\tc.i -= 1;\n\t\t\tcallAndResolve(c, h);\n\t\t}\n\t}\n\n\tfunction tryCatchResolve(f, thisArg, args, resolver) {\n\t\ttry {\n\t\t\tresolver.resolve(f.apply(thisArg, args));\n\t\t} catch(e) {\n\t\t\tresolver.reject(e);\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar state = require('../state');\n\tvar applier = require('../apply');\n\n\treturn function array(Promise) {\n\n\t\tvar applyFold = applier(Promise);\n\t\tvar toPromise = Promise.resolve;\n\t\tvar all = Promise.all;\n\n\t\tvar ar = Array.prototype.reduce;\n\t\tvar arr = Array.prototype.reduceRight;\n\t\tvar slice = Array.prototype.slice;\n\n\t\t// Additional array combinators\n\n\t\tPromise.any = any;\n\t\tPromise.some = some;\n\t\tPromise.settle = settle;\n\n\t\tPromise.map = map;\n\t\tPromise.filter = filter;\n\t\tPromise.reduce = reduce;\n\t\tPromise.reduceRight = reduceRight;\n\n\t\t/**\n\t\t * When this promise fulfills with an array, do\n\t\t * onFulfilled.apply(void 0, array)\n\t\t * @param {function} onFulfilled function to apply\n\t\t * @returns {Promise} promise for the result of applying onFulfilled\n\t\t */\n\t\tPromise.prototype.spread = function(onFulfilled) {\n\t\t\treturn this.then(all).then(function(array) {\n\t\t\t\treturn onFulfilled.apply(this, array);\n\t\t\t});\n\t\t};\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * One-winner competitive race.\n\t\t * Return a promise that will fulfill when one of the promises\n\t\t * in the input array fulfills, or will reject when all promises\n\t\t * have rejected.\n\t\t * @param {array} promises\n\t\t * @returns {Promise} promise for the first fulfilled value\n\t\t */\n\t\tfunction any(promises) {\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\t\t\tvar l = promises.length>>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", + "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar state = require('../state');\n\tvar applier = require('../apply');\n\n\treturn function array(Promise) {\n\n\t\tvar applyFold = applier(Promise);\n\t\tvar toPromise = Promise.resolve;\n\t\tvar all = Promise.all;\n\n\t\tvar ar = Array.prototype.reduce;\n\t\tvar arr = Array.prototype.reduceRight;\n\t\tvar slice = Array.prototype.slice;\n\n\t\t// Additional array combinators\n\n\t\tPromise.any = any;\n\t\tPromise.some = some;\n\t\tPromise.settle = settle;\n\n\t\tPromise.map = map;\n\t\tPromise.filter = filter;\n\t\tPromise.reduce = reduce;\n\t\tPromise.reduceRight = reduceRight;\n\n\t\t/**\n\t\t * When this promise fulfills with an array, do\n\t\t * onFulfilled.apply(void 0, array)\n\t\t * @param {function} onFulfilled function to apply\n\t\t * @returns {Promise} promise for the result of applying onFulfilled\n\t\t */\n\t\tPromise.prototype.spread = function(onFulfilled) {\n\t\t\treturn this.then(all).then(function(array) {\n\t\t\t\treturn onFulfilled.apply(this, array);\n\t\t\t});\n\t\t};\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * One-winner competitive race.\n\t\t * Return a promise that will fulfill when one of the promises\n\t\t * in the input array fulfills, or will reject when all promises\n\t\t * have rejected.\n\t\t * @param {array} promises\n\t\t * @returns {Promise} promise for the first fulfilled value\n\t\t */\n\t\tfunction any(promises) {\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\t\t\tvar l = promises.length>>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function flow(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\t\tvar reject = Promise.reject;\n\t\tvar origCatch = Promise.prototype['catch'];\n\n\t\t/**\n\t\t * Handle the ultimate fulfillment value or rejection reason, and assume\n\t\t * responsibility for all errors. If an error propagates out of result\n\t\t * or handleFatalError, it will be rethrown to the host, resulting in a\n\t\t * loud stack track on most platforms and a crash on some.\n\t\t * @param {function?} onResult\n\t\t * @param {function?} onError\n\t\t * @returns {undefined}\n\t\t */\n\t\tPromise.prototype.done = function(onResult, onError) {\n\t\t\tthis._handler.visit(this._handler.receiver, onResult, onError);\n\t\t};\n\n\t\t/**\n\t\t * Add Error-type and predicate matching to catch. Examples:\n\t\t * promise.catch(TypeError, handleTypeError)\n\t\t * .catch(predicate, handleMatchedErrors)\n\t\t * .catch(handleRemainingErrors)\n\t\t * @param onRejected\n\t\t * @returns {*}\n\t\t */\n\t\tPromise.prototype['catch'] = Promise.prototype.otherwise = function(onRejected) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\treturn origCatch.call(this, onRejected);\n\t\t\t}\n\n\t\t\tif(typeof onRejected !== 'function') {\n\t\t\t\treturn this.ensure(rejectInvalidPredicate);\n\t\t\t}\n\n\t\t\treturn origCatch.call(this, createCatchFilter(arguments[1], onRejected));\n\t\t};\n\n\t\t/**\n\t\t * Wraps the provided catch handler, so that it will only be called\n\t\t * if the predicate evaluates truthy\n\t\t * @param {?function} handler\n\t\t * @param {function} predicate\n\t\t * @returns {function} conditional catch handler\n\t\t */\n\t\tfunction createCatchFilter(handler, predicate) {\n\t\t\treturn function(e) {\n\t\t\t\treturn evaluatePredicate(e, predicate)\n\t\t\t\t\t? handler.call(this, e)\n\t\t\t\t\t: reject(e);\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Ensures that onFulfilledOrRejected will be called regardless of whether\n\t\t * this promise is fulfilled or rejected. onFulfilledOrRejected WILL NOT\n\t\t * receive the promises' value or reason. Any returned value will be disregarded.\n\t\t * onFulfilledOrRejected may throw or return a rejected promise to signal\n\t\t * an additional error.\n\t\t * @param {function} handler handler to be called regardless of\n\t\t * fulfillment or rejection\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['finally'] = Promise.prototype.ensure = function(handler) {\n\t\t\tif(typeof handler !== 'function') {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\treturn this.then(function(x) {\n\t\t\t\treturn runSideEffect(handler, this, identity, x);\n\t\t\t}, function(e) {\n\t\t\t\treturn runSideEffect(handler, this, reject, e);\n\t\t\t});\n\t\t};\n\n\t\tfunction runSideEffect (handler, thisArg, propagate, value) {\n\t\t\tvar result = handler.call(thisArg);\n\t\t\treturn maybeThenable(result)\n\t\t\t\t? propagateValue(result, propagate, value)\n\t\t\t\t: propagate(value);\n\t\t}\n\n\t\tfunction propagateValue (result, propagate, x) {\n\t\t\treturn resolve(result).then(function () {\n\t\t\t\treturn propagate(x);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Recover from a failure by returning a defaultValue. If defaultValue\n\t\t * is a promise, it's fulfillment value will be used. If defaultValue is\n\t\t * a promise that rejects, the returned promise will reject with the\n\t\t * same reason.\n\t\t * @param {*} defaultValue\n\t\t * @returns {Promise} new promise\n\t\t */\n\t\tPromise.prototype['else'] = Promise.prototype.orElse = function(defaultValue) {\n\t\t\treturn this.then(void 0, function() {\n\t\t\t\treturn defaultValue;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Shortcut for .then(function() { return value; })\n\t\t * @param {*} value\n\t\t * @return {Promise} a promise that:\n\t\t * - is fulfilled if value is not a promise, or\n\t\t * - if value is a promise, will fulfill with its value, or reject\n\t\t * with its reason.\n\t\t */\n\t\tPromise.prototype['yield'] = function(value) {\n\t\t\treturn this.then(function() {\n\t\t\t\treturn value;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Runs a side effect when this promise fulfills, without changing the\n\t\t * fulfillment value.\n\t\t * @param {function} onFulfilledSideEffect\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.tap = function(onFulfilledSideEffect) {\n\t\t\treturn this.then(onFulfilledSideEffect)['yield'](this);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n\tfunction rejectInvalidPredicate() {\n\t\tthrow new TypeError('catch predicate must be a function');\n\t}\n\n\tfunction evaluatePredicate(e, predicate) {\n\t\treturn isError(predicate) ? e instanceof predicate : predicate(e);\n\t}\n\n\tfunction isError(predicate) {\n\t\treturn predicate === Error\n\t\t\t|| (predicate != null && predicate.prototype instanceof Error);\n\t}\n\n\tfunction maybeThenable(x) {\n\t\treturn (typeof x === 'object' || typeof x === 'function') && x !== null;\n\t}\n\n\tfunction identity(x) {\n\t\treturn x;\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n/** @author Jeff Escalante */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function fold(Promise) {\n\n\t\tPromise.prototype.fold = function(f, z) {\n\t\t\tvar promise = this._beget();\n\n\t\t\tthis._handler.fold(function(z, x, to) {\n\t\t\t\tPromise._handler(z).fold(function(x, z, to) {\n\t\t\t\t\tto.resolve(f.call(this, z, x));\n\t\t\t\t}, x, this, to);\n\t\t\t}, z, promise._handler.receiver, promise._handler);\n\n\t\t\treturn promise;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar inspect = require('../state').inspect;\n\n\treturn function inspection(Promise) {\n\n\t\tPromise.prototype.inspect = function() {\n\t\t\treturn inspect(Promise._handler(this));\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", @@ -58,10 +58,10 @@ "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar env = require('../env');\n\tvar TimeoutError = require('../TimeoutError');\n\n\tfunction setTimeout(f, ms, x, y) {\n\t\treturn env.setTimer(function() {\n\t\t\tf(x, y, ms);\n\t\t}, ms);\n\t}\n\n\treturn function timed(Promise) {\n\t\t/**\n\t\t * Return a new promise whose fulfillment value is revealed only\n\t\t * after ms milliseconds\n\t\t * @param {number} ms milliseconds\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.delay = function(ms) {\n\t\t\tvar p = this._beget();\n\t\t\tthis._handler.fold(handleDelay, ms, void 0, p._handler);\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction handleDelay(ms, x, h) {\n\t\t\tsetTimeout(resolveDelay, ms, x, h);\n\t\t}\n\n\t\tfunction resolveDelay(x, h) {\n\t\t\th.resolve(x);\n\t\t}\n\n\t\t/**\n\t\t * Return a new promise that rejects after ms milliseconds unless\n\t\t * this promise fulfills earlier, in which case the returned promise\n\t\t * fulfills with the same value.\n\t\t * @param {number} ms milliseconds\n\t\t * @param {Error|*=} reason optional rejection reason to use, defaults\n\t\t * to a TimeoutError if not provided\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.timeout = function(ms, reason) {\n\t\t\tvar p = this._beget();\n\t\t\tvar h = p._handler;\n\n\t\t\tvar t = setTimeout(onTimeout, ms, reason, p._handler);\n\n\t\t\tthis._handler.visit(h,\n\t\t\t\tfunction onFulfill(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.resolve(x); // this = h\n\t\t\t\t},\n\t\t\t\tfunction onReject(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.reject(x); // this = h\n\t\t\t\t},\n\t\t\t\th.notify);\n\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction onTimeout(reason, h, ms) {\n\t\t\tvar e = typeof reason === 'undefined'\n\t\t\t\t? new TimeoutError('timed out after ' + ms + 'ms')\n\t\t\t\t: reason;\n\t\t\th.reject(e);\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar setTimer = require('../env').setTimer;\n\tvar format = require('../format');\n\n\treturn function unhandledRejection(Promise) {\n\n\t\tvar logError = noop;\n\t\tvar logInfo = noop;\n\t\tvar localConsole;\n\n\t\tif(typeof console !== 'undefined') {\n\t\t\t// Alias console to prevent things like uglify's drop_console option from\n\t\t\t// removing console.log/error. Unhandled rejections fall into the same\n\t\t\t// category as uncaught exceptions, and build tools shouldn't silence them.\n\t\t\tlocalConsole = console;\n\t\t\tlogError = typeof localConsole.error !== 'undefined'\n\t\t\t\t? function (e) { localConsole.error(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\n\t\t\tlogInfo = typeof localConsole.info !== 'undefined'\n\t\t\t\t? function (e) { localConsole.info(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\t\t}\n\n\t\tPromise.onPotentiallyUnhandledRejection = function(rejection) {\n\t\t\tenqueue(report, rejection);\n\t\t};\n\n\t\tPromise.onPotentiallyUnhandledRejectionHandled = function(rejection) {\n\t\t\tenqueue(unreport, rejection);\n\t\t};\n\n\t\tPromise.onFatalRejection = function(rejection) {\n\t\t\tenqueue(throwit, rejection.value);\n\t\t};\n\n\t\tvar tasks = [];\n\t\tvar reported = [];\n\t\tvar running = null;\n\n\t\tfunction report(r) {\n\t\t\tif(!r.handled) {\n\t\t\t\treported.push(r);\n\t\t\t\tlogError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction unreport(r) {\n\t\t\tvar i = reported.indexOf(r);\n\t\t\tif(i >= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function addWith(Promise) {\n\t\t/**\n\t\t * Returns a promise whose handlers will be called with `this` set to\n\t\t * the supplied receiver. Subsequent promises derived from the\n\t\t * returned promise will also have their handlers called with receiver\n\t\t * as `this`. Calling `with` with undefined or no arguments will return\n\t\t * a promise whose handlers will again be called in the usual Promises/A+\n\t\t * way (no `this`) thus safely undoing any previous `with` in the\n\t\t * promise chain.\n\t\t *\n\t\t * WARNING: Promises returned from `with`/`withThis` are NOT Promises/A+\n\t\t * compliant, specifically violating 2.2.5 (http://promisesaplus.com/#point-41)\n\t\t *\n\t\t * @param {object} receiver `this` value for all handlers attached to\n\t\t * the returned promise.\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['with'] = Promise.prototype.withThis = function(receiver) {\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\t\t\tchild.receiver = receiver;\n\t\t\tthis._handler.chain(child, receiver);\n\t\t\treturn p;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === 'function' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === 'function' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", + "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t return (typeof MutationObserver !== 'undefined' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function liftAll(liftOne, combine, dst, src) {\n\t\tif(typeof combine === 'undefined') {\n\t\t\tcombine = defaultCombine;\n\t\t}\n\n\t\treturn Object.keys(src).reduce(function(dst, key) {\n\t\t\tvar f = src[key];\n\t\t\treturn typeof f === 'function' ? combine(dst, liftOne(f), key) : dst;\n\t\t}, typeof dst === 'undefined' ? defaultDst(src) : dst);\n\t};\n\n\tfunction defaultCombine(o, f, k) {\n\t\to[k] = f;\n\t\treturn o;\n\t}\n\n\tfunction defaultDst(src) {\n\t\treturn typeof src === 'function' ? src.bind() : Object.create(src);\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0 ? toFulfilledState(handler.value)\n\t\t\t : toRejectedState(handler.value);\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", "/** @license MIT License (c) copyright 2013 original author or authors */\n\n/**\n * Collection of helpers for interfacing with node-style asynchronous functions\n * using promises.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar _liftAll = require('./lib/liftAll');\n\tvar setTimer = require('./lib/env').setTimer;\n\tvar slice = Array.prototype.slice;\n\n\tvar _apply = require('./lib/apply')(when.Promise, dispatch);\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tapply: apply,\n\t\tcall: call,\n\t\tcreateCallback: createCallback,\n\t\tbindCallback: bindCallback,\n\t\tliftCallback: liftCallback\n\t};\n\n\t/**\n\t * Takes a node-style async function and calls it immediately (with an optional\n\t * array of arguments or promises for arguments). It returns a promise whose\n\t * resolution depends on whether the async functions calls its callback with the\n\t * conventional error argument or not.\n\t *\n\t * With this it becomes possible to leverage existing APIs while still reaping\n\t * the benefits of promises.\n\t *\n\t * @example\n\t * function onlySmallNumbers(n, callback) {\n\t *\t\tif(n < 10) {\n\t *\t\t\tcallback(null, n + 10);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * var nodefn = require(\"when/node/function\");\n\t *\n\t * // Logs '15'\n\t * nodefn.apply(onlySmallNumbers, [5]).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.apply(onlySmallNumbers, [15]).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction apply(f, args) {\n\t\treturn _apply(f, this, args || []);\n\t}\n\n\tfunction dispatch(f, thisArg, args, h) {\n\t\tvar cb = createCallback(h);\n\t\ttry {\n\t\t\tswitch(args.length) {\n\t\t\t\tcase 2: f.call(thisArg, args[0], args[1], cb); break;\n\t\t\t\tcase 1: f.call(thisArg, args[0], cb); break;\n\t\t\t\tcase 0: f.call(thisArg, cb); break;\n\t\t\t\tdefault:\n\t\t\t\t\targs.push(cb);\n\t\t\t\t\tf.apply(thisArg, args);\n\t\t\t}\n\t\t} catch(e) {\n\t\t\th.reject(e);\n\t\t}\n\t}\n\n\t/**\n\t * Has the same behavior that {@link apply} has, with the difference that the\n\t * arguments to the function are provided individually, while {@link apply} accepts\n\t * a single array.\n\t *\n\t * @example\n\t * function sumSmallNumbers(x, y, callback) {\n\t *\t\tvar result = x + y;\n\t *\t\tif(result < 10) {\n\t *\t\t\tcallback(null, result);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * // Logs '5'\n\t * nodefn.call(sumSmallNumbers, 2, 3).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.call(sumSmallNumbers, 5, 10).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {...*} [args] arguments that will be forwarded to the function\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction call(f /*, args... */) {\n\t\treturn _apply(f, this, slice.call(arguments, 1));\n\t}\n\n\t/**\n\t * Takes a node-style function and returns new function that wraps the\n\t * original and, instead of taking a callback, returns a promise. Also, it\n\t * knows how to handle promises given as arguments, waiting for their\n\t * resolution before executing.\n\t *\n\t * Upon execution, the orginal function is executed as well. If it passes\n\t * a truthy value as the first argument to the callback, it will be\n\t * interpreted as an error condition, and the promise will be rejected\n\t * with it. Otherwise, the call is considered a resolution, and the promise\n\t * is resolved with the callback's second argument.\n\t *\n\t * @example\n\t * var fs = require(\"fs\"), nodefn = require(\"when/node/function\");\n\t *\n\t * var promiseRead = nodefn.lift(fs.readFile);\n\t *\n\t * // The promise is resolved with the contents of the file if everything\n\t * // goes ok\n\t * promiseRead('exists.txt').then(console.log, console.error);\n\t *\n\t * // And will be rejected if something doesn't work out\n\t * // (e.g. the files does not exist)\n\t * promiseRead('doesnt_exist.txt').then(console.log, console.error);\n\t *\n\t *\n\t * @param {Function} f node-style function to be lifted\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args1 = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\t// TODO: Simplify once partialing has been removed\n\t\t\tvar l = args1.length;\n\t\t\tvar al = arguments.length;\n\t\t\tvar args = new Array(al + l);\n\t\t\tvar i;\n\t\t\tfor(i=0; i 2) {\n\t\t\t\tresolver.resolve(slice.call(arguments, 1));\n\t\t\t} else {\n\t\t\t\tresolver.resolve(value);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Attaches a node-style callback to a promise, ensuring the callback is\n\t * called for either fulfillment or rejection. Returns a promise with the same\n\t * state as the passed-in promise.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tbindCallback(deferred.promise, callback);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Promise} promise The promise to be attached to.\n\t * @param {Function} callback The node-style callback to attach.\n\t * @returns {Promise} A promise with the same state as the passed-in promise.\n\t */\n\tfunction bindCallback(promise, callback) {\n\t\tpromise = when(promise);\n\n\t\tif (callback) {\n\t\t\tpromise.then(success, wrapped);\n\t\t}\n\n\t\treturn promise;\n\n\t\tfunction success(value) {\n\t\t\twrapped(null, value);\n\t\t}\n\n\t\tfunction wrapped(err, value) {\n\t\t\tsetTimer(function () {\n\t\t\t\tcallback(err, value);\n\t\t\t}, 0);\n\t\t}\n\t}\n\n\t/**\n\t * Takes a node-style callback and returns new function that accepts a\n\t * promise, calling the original callback when the promise is either\n\t * fulfilled or rejected with the appropriate arguments.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tvar wrapped = liftCallback(callback);\n\t *\n\t *\t// `wrapped` can now be passed around at will\n\t *\twrapped(deferred.promise);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Function} callback The node-style callback to wrap.\n\t * @returns {Function} The lifted, promise-accepting function.\n\t */\n\tfunction liftCallback(callback) {\n\t\treturn function(promise) {\n\t\t\treturn bindCallback(promise, callback);\n\t\t};\n\t}\n});\n\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n\n", "/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * parallel.js\n *\n * Run a set of task functions in parallel. All tasks will\n * receive the same args\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in parallel\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for array containing the\n\t * result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function parallel(tasks /*, args... */) {\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.map(tasks, function(task) {\n\t\t\t\treturn task.apply(void 0, args);\n\t\t\t});\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n", @@ -71,5 +71,5 @@ "/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * timeout.js\n *\n * Helper that returns a promise that rejects after a specified timeout,\n * if not explicitly resolved or rejected before that.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(trigger).timeout(ms)\n */\n return function timeout(msec, trigger) {\n\t\treturn when(trigger).timeout(msec);\n };\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n\n/**\n * Promises/A+ and when() implementation\n * when is part of the cujoJS family of libraries (http://cujojs.com/)\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function (require) {\n\n\tvar timed = require('./lib/decorators/timed');\n\tvar array = require('./lib/decorators/array');\n\tvar flow = require('./lib/decorators/flow');\n\tvar fold = require('./lib/decorators/fold');\n\tvar inspect = require('./lib/decorators/inspect');\n\tvar generate = require('./lib/decorators/iterate');\n\tvar progress = require('./lib/decorators/progress');\n\tvar withThis = require('./lib/decorators/with');\n\tvar unhandledRejection = require('./lib/decorators/unhandledRejection');\n\tvar TimeoutError = require('./lib/TimeoutError');\n\n\tvar Promise = [array, flow, fold, generate, progress,\n\t\tinspect, withThis, timed, unhandledRejection]\n\t\t.reduce(function(Promise, feature) {\n\t\t\treturn feature(Promise);\n\t\t}, require('./lib/Promise'));\n\n\tvar apply = require('./lib/apply')(Promise);\n\n\t// Public API\n\n\twhen.promise = promise; // Create a pending promise\n\twhen.resolve = Promise.resolve; // Create a resolved promise\n\twhen.reject = Promise.reject; // Create a rejected promise\n\n\twhen.lift = lift; // lift a function to return promises\n\twhen['try'] = attempt; // call a function and return a promise\n\twhen.attempt = attempt; // alias for when.try\n\n\twhen.iterate = Promise.iterate; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\twhen.unfold = Promise.unfold; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\n\twhen.join = join; // Join 2 or more promises\n\n\twhen.all = all; // Resolve a list of promises\n\twhen.settle = settle; // Settle a list of promises\n\n\twhen.any = lift(Promise.any); // One-winner race\n\twhen.some = lift(Promise.some); // Multi-winner race\n\twhen.race = lift(Promise.race); // First-to-settle race\n\n\twhen.map = map; // Array.map() for promises\n\twhen.filter = filter; // Array.filter() for promises\n\twhen.reduce = lift(Promise.reduce); // Array.reduce() for promises\n\twhen.reduceRight = lift(Promise.reduceRight); // Array.reduceRight() for promises\n\n\twhen.isPromiseLike = isPromiseLike; // Is something promise-like, aka thenable\n\n\twhen.Promise = Promise; // Promise constructor\n\twhen.defer = defer; // Create a {promise, resolve, reject} tuple\n\n\t// Error types\n\n\twhen.TimeoutError = TimeoutError;\n\n\t/**\n\t * Get a trusted promise for x, or by transforming x with onFulfilled\n\t *\n\t * @param {*} x\n\t * @param {function?} onFulfilled callback to be called when x is\n\t * successfully fulfilled. If promiseOrValue is an immediate value, callback\n\t * will be invoked immediately.\n\t * @param {function?} onRejected callback to be called when x is\n\t * rejected.\n\t * @param {function?} onProgress callback to be called when progress updates\n\t * are issued for x. @deprecated\n\t * @returns {Promise} a new promise that will fulfill with the return\n\t * value of callback or errback or the completion value of promiseOrValue if\n\t * callback and/or errback is not supplied.\n\t */\n\tfunction when(x, onFulfilled, onRejected, onProgress) {\n\t\tvar p = Promise.resolve(x);\n\t\tif (arguments.length < 2) {\n\t\t\treturn p;\n\t\t}\n\n\t\treturn p.then(onFulfilled, onRejected, onProgress);\n\t}\n\n\t/**\n\t * Creates a new promise whose fate is determined by resolver.\n\t * @param {function} resolver function(resolve, reject, notify)\n\t * @returns {Promise} promise whose fate is determine by resolver\n\t */\n\tfunction promise(resolver) {\n\t\treturn new Promise(resolver);\n\t}\n\n\t/**\n\t * Lift the supplied function, creating a version of f that returns\n\t * promises, and accepts promises as arguments.\n\t * @param {function} f\n\t * @returns {Function} version of f that returns promises\n\t */\n\tfunction lift(f) {\n\t\treturn function() {\n\t\t\tfor(var i=0, l=arguments.length, a=new Array(l); i1?d.call(arguments,1):[];return function(){return v(t,this,n.concat(d.call(arguments)))}}function u(t,n,e){return p(i,n,e,t)}function c(t,n){return function(){var e=this;return h.all(arguments).then(function(r){var o,i,u=h._defer();return"number"==typeof n.callback&&(o=f(r,n.callback)),"number"==typeof n.errback&&(i=f(r,n.errback)),o>i?(a(r,i,u._handler.reject,u._handler),a(r,o,u._handler.resolve,u._handler)):(a(r,o,u._handler.resolve,u._handler),a(r,i,u._handler.reject,u._handler)),t.apply(e,r),u})}}function f(t,n){return 0>n?t.length+n+2:n}function a(t,n,e,r){"number"==typeof n&&t.splice(n,0,s(e,r))}function s(t,n){return function(){arguments.length>1?t.call(n,d.call(arguments)):t.apply(n,arguments)}}var l=t("./when"),h=l.Promise,p=t("./lib/liftAll"),d=Array.prototype.slice,y=t("./lib/apply"),v=y(h,e);return{lift:i,liftAll:u,apply:n,call:o,promisify:c}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/apply":11,"./lib/liftAll":23,"./when":32}],3:[function(n,e,r){!function(t){t(function(){return function(t,n){return t.cancel=function(){try{t.reject(n(t))}catch(e){t.reject(e)}return t.promise},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],4:[function(n,e,r){!function(t){t(function(t){var n=t("./when");return function(t,e){return n(e).delay(t)}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],5:[function(n,e,r){!function(t){t(function(t){function n(t,n){return f(t,this,null==n?[]:a.call(n))}function e(t){var n=arguments.length>1?a.call(arguments,1):[];return function(){return f(t,this,n.concat(a.call(arguments)))}}function r(t,n,r){return c(e,n,r,t)}function o(t){var n=a.call(arguments,1);return function(){var e=this,r=a.call(arguments),o=u.apply(e,[t].concat(r));return i.reduce(n,function(t,n){return n.call(e,t)},o)}}var i=t("./when"),u=i["try"],c=t("./lib/liftAll"),f=t("./lib/apply")(i.Promise),a=Array.prototype.slice;return{lift:e,liftAll:r,call:u,apply:n,compose:o}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/apply":11,"./lib/liftAll":23,"./when":32}],6:[function(n,e,r){!function(t){t(function(t){function n(t,n){return function(){var e=o.call(arguments);return r(t()).withThis(this).then(function(t){return r(n.apply(this,e))["finally"](t)})}}function e(t){function n(){e=Math.max(e-1,0),o.length>0&&o.shift()(n)}var e=0,o=[];return function(){return r.promise(function(r){t>e?r(n):o.push(r),e+=1})}}var r=t("./when"),o=Array.prototype.slice;return n.n=e,n})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],7:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t){function n(t,n,e){this[t]=n,0===--f&&e.resolve(i)}for(var e,r=u._defer(),o=u._handler(r),i={},c=Object.keys(t),f=c.length,a=0;a>>0,a=f,s=[],l=0;f>l;++l)if(i=n[l],void 0!==i||l in n){if(o=t._handler(i),o.state()>0){c.become(o),t._visitRemaining(n,l,o);break}o.visit(c,e,r)}else--a;return 0===a&&c.reject(new RangeError("any(): array must not be empty")),u}function o(n,e){function r(t){this.resolved||(s.push(t),0===--p&&(l=null,this.resolve(s)))}function o(t){this.resolved||(l.push(t),0===--i&&(s=null,this.reject(l)))}var i,u,c,f=t._defer(),a=f._handler,s=[],l=[],h=n.length>>>0,p=0;for(c=0;h>c;++c)u=n[c],(void 0!==u||c in n)&&++p;for(e=Math.max(e,0),i=p-e+1,p=Math.min(e,p),e>p?a.reject(new RangeError("some(): array must contain at least "+e+" item(s), but had "+p)):0===p&&a.resolve(s),c=0;h>c;++c)u=n[c],(void 0!==u||c in n)&&t._handler(u).visit(a,r,o,a.notify);return f}function i(n,e){return t._traverse(e,n)}function u(n,e){var r=b.call(n);return t._traverse(e,r).then(function(t){return c(r,t)})}function c(n,e){for(var r=e.length,o=new Array(r),i=0,u=0;r>i;++i)e[i]&&(o[u++]=t._handler(n[i]).value);return o.length=u,o}function f(t){return y(t.map(a))}function a(e){var r=t._handler(e);return 0===r.state()?d(e).then(n.fulfilled,n.rejected):(r._unreport(),n.inspect(r))}function s(t,n){return arguments.length>2?v.call(t,h(n),arguments[2]):v.call(t,h(n))}function l(t,n){return arguments.length>2?m.call(t,h(n),arguments[2]):m.call(t,h(n))}function h(t){return function(n,e,r){return p(t,void 0,[n,e,r])}}var p=e(t),d=t.resolve,y=t.all,v=Array.prototype.reduce,m=Array.prototype.reduceRight,b=Array.prototype.slice;return t.any=r,t.some=o,t.settle=f,t.map=i,t.filter=u,t.reduce=s,t.reduceRight=l,t.prototype.spread=function(t){return this.then(y).then(function(n){return t.apply(this,n)})},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../apply":11,"../state":25}],13:[function(n,e,r){!function(t){"use strict";t(function(){function t(){throw new TypeError("catch predicate must be a function")}function n(t,n){return e(n)?t instanceof n:n(t)}function e(t){return t===Error||null!=t&&t.prototype instanceof Error}function r(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function o(t){return t}return function(e){function i(t,e){return function(r){return n(r,e)?t.call(this,r):a(r)}}function u(t,n,e,o){var i=t.call(n);return r(i)?c(i,e,o):e(o)}function c(t,n,e){return f(t).then(function(){return n(e)})}var f=e.resolve,a=e.reject,s=e.prototype["catch"];return e.prototype.done=function(t,n){this._handler.visit(this._handler.receiver,t,n)},e.prototype["catch"]=e.prototype.otherwise=function(n){return arguments.length<2?s.call(this,n):"function"!=typeof n?this.ensure(t):s.call(this,i(arguments[1],n))},e.prototype["finally"]=e.prototype.ensure=function(t){return"function"!=typeof t?this:this.then(function(n){return u(t,this,o,n)},function(n){return u(t,this,a,n)})},e.prototype["else"]=e.prototype.orElse=function(t){return this.then(void 0,function(){return t})},e.prototype["yield"]=function(t){return this.then(function(){return t})},e.prototype.tap=function(t){return this.then(t)["yield"](this)},e}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],14:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.fold=function(n,e){var r=this._beget();return this._handler.fold(function(e,r,o){t._handler(e).fold(function(t,e,r){r.resolve(n.call(this,e,t))},r,this,o)},e,r._handler.receiver,r._handler),r},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],15:[function(n,e,r){!function(t){"use strict";t(function(t){var n=t("../state").inspect;return function(t){return t.prototype.inspect=function(){return n(t._handler(this))},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../state":25}],16:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){function n(t,n,r,o){return e(function(n){return[n,t(n)]},n,r,o)}function e(t,n,o,i){function u(i,u){return r(o(i)).then(function(){return e(t,n,o,u)})}return r(i).then(function(e){return r(n(e)).then(function(n){return n?e:r(t(e)).spread(u)})})}var r=t.resolve;return t.iterate=n,t.unfold=e,t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],17:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.progress=function(t){return this.then(void 0,void 0,t)},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],18:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t,n,r,o){return e.setTimer(function(){t(r,o,n)},n)}var e=t("../env"),r=t("../TimeoutError");return function(t){function o(t,e,r){n(i,t,e,r)}function i(t,n){n.resolve(t)}function u(t,n,e){var o="undefined"==typeof t?new r("timed out after "+e+"ms"):t;n.reject(o)}return t.prototype.delay=function(t){var n=this._beget();return this._handler.fold(o,t,void 0,n._handler),n},t.prototype.timeout=function(t,r){var o=this._beget(),i=o._handler,c=n(u,t,r,o._handler);return this._handler.visit(i,function(t){e.clearTimer(c),this.resolve(t)},function(t){e.clearTimer(c),this.reject(t)},i.notify),o},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../TimeoutError":10,"../env":21}],19:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t){throw t}function e(){}var r=t("../env").setTimer,o=t("../format");return function(t){function i(t){t.handled||(p.push(t),s("Potentially unhandled rejection ["+t.id+"] "+o.formatError(t.value)))}function u(t){var n=p.indexOf(t);n>=0&&(p.splice(n,1),l("Handled previous rejection ["+t.id+"] "+o.formatObject(t.value)))}function c(t,n){h.push(t,n),null===d&&(d=r(f,0))}function f(){for(d=null;h.length>0;)h.shift()(h.shift())}var a,s=e,l=e;"undefined"!=typeof console&&(a=console,s="undefined"!=typeof a.error?function(t){a.error(t)}:function(t){a.log(t)},l="undefined"!=typeof a.info?function(t){a.info(t)}:function(t){a.log(t)}),t.onPotentiallyUnhandledRejection=function(t){c(i,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){c(u,t)},t.onFatalRejection=function(t){c(n,t.value)};var h=[],p=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../env":21,"../format":22}],20:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype["with"]=t.prototype.withThis=function(t){var n=this._beget(),e=n._handler;return e.receiver=t,this._handler.chain(e,t),n},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],21:[function(n,e,r){!function(t){"use strict";t(function(t){function n(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function e(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function r(t){function n(){var t=e;e=void 0,t()}var e,r=document.createTextNode(""),o=new t(n);o.observe(r,{characterData:!0});var i=0;return function(t){e=t,r.data=i^=1}}var o,i="undefined"!=typeof setTimeout&&setTimeout,u=function(t,n){return setTimeout(t,n)},c=function(t){return clearTimeout(t)},f=function(t){return i(t,0)};if(n())f=function(t){return process.nextTick(t)};else if(o=e())f=r(o);else if(!i){var a=t,s=a("vertx");u=function(t,n){return s.setTimer(n,t)},c=s.cancelTimer,f=s.runOnLoop||s.runOnContext}return{setTimer:u,clearTimer:c,asap:f}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{}],22:[function(n,e,r){!function(t){"use strict";t(function(){function t(t){var e="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:n(t);return t instanceof Error?e:e+" (WARNING: non-Error used)"}function n(t){var n=String(t);return"[object Object]"===n&&"undefined"!=typeof JSON&&(n=e(t,n)),n}function e(t,n){try{return JSON.stringify(t)}catch(e){return n}}return{formatError:t,formatObject:n,tryStringify:e}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],23:[function(n,e,r){!function(t){"use strict";t(function(){function t(t,n,e){return t[e]=n,t}function n(t){return"function"==typeof t?t.bind():Object.create(t)}return function(e,r,o,i){return"undefined"==typeof r&&(r=t),Object.keys(i).reduce(function(t,n){var o=i[n];return"function"==typeof o?r(t,e(o),n):t},"undefined"==typeof o?n(i):o)}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],24:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){function n(t,n){this._handler=t===g?n:e(t)}function e(t){function n(t){o.resolve(t)}function e(t){o.reject(t)}function r(t){o.notify(t)}var o=new w;try{t(n,e,r)}catch(i){e(i)}return o}function r(t){return L(t)?t:new n(g,new j(v(t)))}function o(t){return new n(g,new j(new A(t)))}function i(){return $}function u(){return new n(g,new w)}function c(t,n){var e=new w(t.receiver,t.join().context);return new n(g,e)}function f(t){return s(K,null,t)}function a(t,n){return s(N,t,n)}function s(t,e,r){function o(n,o,u){u.resolved||l(r,i,n,t(e,o,n),u)}function i(t,n,e){s[t]=n,0===--a&&e.become(new k(s))}for(var u,c="function"==typeof e?o:i,f=new w,a=r.length>>>0,s=new Array(a),h=0;h0?n(e,i.value,o):(o.become(i),h(t,e+1,i))}else n(e,r,o)}function h(t,n,e){for(var r=n;re&&t._unreport()}}function d(t){return"object"!=typeof t||null===t?o(new TypeError("non-iterable passed to race()")):0===t.length?i():1===t.length?r(t[0]):y(t)}function y(t){var e,r,o,i=new w;for(e=0;e0||"function"!=typeof n&&0>o)return new this.constructor(g,r);var i=this._beget(),u=i._handler;return r.chain(u,r.receiver,t,n,e),i},n.prototype["catch"]=function(t){return this.then(void 0,t)},n.prototype._beget=function(){return c(this._handler,this.constructor)},n.all=f,n.race=d,n._traverse=a,n._visitRemaining=h,g.prototype.when=g.prototype.become=g.prototype.notify=g.prototype.fail=g.prototype._unreport=g.prototype._report=D,g.prototype._state=0,g.prototype.state=function(){return this._state},g.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},g.prototype.chain=function(t,n,e,r,o){this.when({resolver:t,receiver:n,fulfilled:e,rejected:r,progress:o})},g.prototype.visit=function(t,n,e,r){this.chain(X,t,n,e,r)},g.prototype.fold=function(t,n,e,r){this.when(new Q(t,n,e,r))},J(g,_),_.prototype.become=function(t){t.fail()};var X=new _;J(g,w),w.prototype._state=0,w.prototype.resolve=function(t){this.become(v(t))},w.prototype.reject=function(t){this.resolved||this.become(new A(t))},w.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=R();return t},w.prototype.run=function(){var t=this.consumers,n=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var e=0;e0?e(r.value):n(r.value)}return{pending:t,fulfilled:e,rejected:n,inspect:r}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],26:[function(n,e,r){!function(t){t(function(t){function n(t,n){return p(t,this,n||[])}function e(t,n,e,r){var o=u(r);try{switch(e.length){case 2:t.call(n,e[0],e[1],o);break;case 1:t.call(n,e[0],o);break;case 0:t.call(n,o);break;default:e.push(o),t.apply(n,e)}}catch(i){r.reject(i)}}function r(t){return p(t,this,h.call(arguments,1))}function o(t){var n=arguments.length>1?h.call(arguments,1):[];return function(){var e,r=n.length,o=arguments.length,i=new Array(o+r);for(e=0;r>e;++e)i[e]=n[e];for(e=0;o>e;++e)i[e+r]=arguments[e];return p(t,this,i)}}function i(t,n,e){return s(o,n,e,t)}function u(t){return function(n,e){n?t.reject(n):arguments.length>2?t.resolve(h.call(arguments,1)):t.resolve(e)}}function c(t,n){function e(t){r(null,t)}function r(t,e){l(function(){n(t,e)},0)}return t=a(t),n&&t.then(e,r),t}function f(t){return function(n){return c(n,t)}}var a=t("./when"),s=t("./lib/liftAll"),l=t("./lib/env").setTimer,h=Array.prototype.slice,p=t("./lib/apply")(a.Promise,e);return{lift:o,liftAll:i,apply:n,call:r,createCallback:u,bindCallback:c,liftCallback:f}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/apply":11,"./lib/env":21,"./lib/liftAll":23,"./when":32}],27:[function(n,e,r){!function(t){t(function(t){var n=t("./when"),e=n.Promise.all,r=Array.prototype.slice;return function(t){return e(r.call(arguments,1)).then(function(e){return n.map(t,function(t){return t.apply(void 0,e)})})}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],28:[function(n,e,r){!function(t){t(function(t){var n=t("./when"),e=n.Promise.all,r=Array.prototype.slice;return function(t){var o=function(t,n){return o=function(t,n){return n(t)},n.apply(null,t)};return e(r.call(arguments,1)).then(function(e){return n.reduce(t,function(t,n){return o(t,n)},e)})}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],29:[function(n,e,r){!function(t){"use strict";t(function(t){var n=t("./when"),e=n["try"],r=t("./cancelable");return function(t,o,i,u){function c(t){s.resolve(t)}function f(t){e(o).then(a,h),void 0!==t&&s.notify(t)}function a(){l||n(t(),function(t){n(i(t),function(n){return n?c(t):f(t)},function(){f(t)})},h)}var s,l,h;return l=!1,s=r(n.defer(),function(){l=!0}),h=s.reject,i=i||function(){return!1},"function"!=typeof o&&(o=function(t){return function(){return n().delay(t)}}(o)),u?f():a(),s.promise=Object.create(s.promise),s.promise.cancel=s.cancel,s.promise}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./cancelable":3,"./when":32}],30:[function(n,e,r){!function(t){t(function(t){var n=t("./when"),e=n.Promise.all,r=Array.prototype.slice;return function(t){function o(t){return i.push(t),i}var i=[];return e(r.call(arguments,1)).then(function(e){return n.reduce(t,function(t,r){return n(r.apply(void 0,e),o)},i)})}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],31:[function(n,e,r){!function(t){t(function(t){var n=t("./when");return function(t,e){return n(e).timeout(t)}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],32:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t,n,e,r){var o=x.resolve(t);return arguments.length<2?o:o.then(n,e,r)}function e(t){return new x(t)}function r(t){return function(){for(var n=0,e=arguments.length,r=new Array(e);e>n;++n)r[n]=arguments[n];return k(t,this,r)}}function o(t){for(var n=0,e=arguments.length-1,r=new Array(e);e>n;++n)r[n]=arguments[n+1];return k(t,this,r)}function i(){return new u}function u(){function t(t){r._handler.resolve(t)}function n(t){r._handler.reject(t)}function e(t){r._handler.notify(t)}var r=x._defer();this.promise=r,this.resolve=t,this.reject=n,this.notify=e,this.resolver={resolve:t,reject:n,notify:e}}function c(t){return t&&"function"==typeof t.then}function f(){return x.all(arguments)}function a(t){return n(t,x.all)}function s(t){return n(t,x.settle)}function l(t,e){return n(t,function(t){return x.map(t,e)})}function h(t,e){return n(t,function(t){return x.filter(t,e)})}var p=t("./lib/decorators/timed"),d=t("./lib/decorators/array"),y=t("./lib/decorators/flow"),v=t("./lib/decorators/fold"),m=t("./lib/decorators/inspect"),b=t("./lib/decorators/iterate"),g=t("./lib/decorators/progress"),_=t("./lib/decorators/with"),w=t("./lib/decorators/unhandledRejection"),j=t("./lib/TimeoutError"),x=[d,y,v,b,g,m,_,p,w].reduce(function(t,n){return n(t)},t("./lib/Promise")),k=t("./lib/apply")(x);return n.promise=e,n.resolve=x.resolve,n.reject=x.reject,n.lift=r,n["try"]=o,n.attempt=o,n.iterate=x.iterate,n.unfold=x.unfold,n.join=f,n.all=a,n.settle=s,n.any=r(x.any),n.some=r(x.some),n.race=r(x.race),n.map=l,n.filter=h,n.reduce=r(x.reduce),n.reduceRight=r(x.reduceRight),n.isPromiseLike=c,n.Promise=x,n.defer=i,n.TimeoutError=j,n})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/Promise":8,"./lib/TimeoutError":10,"./lib/apply":11,"./lib/decorators/array":12,"./lib/decorators/flow":13,"./lib/decorators/fold":14,"./lib/decorators/inspect":15,"./lib/decorators/iterate":16,"./lib/decorators/progress":17,"./lib/decorators/timed":18,"./lib/decorators/unhandledRejection":19,"./lib/decorators/with":20}]},{},[1])(1)}); -//# sourceMappingURL=when.min.js.map \ No newline at end of file +!function(t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):"undefined"!=typeof window?window.when=t():"undefined"!=typeof global?global.when=t():"undefined"!=typeof self&&(self.when=t())}(function(){var t;return function n(t,e,r){function o(u,c){if(!e[u]){if(!t[u]){var f="function"==typeof require&&require;if(!c&&f)return f(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var a=e[u]={exports:{}};t[u][0].call(a.exports,function(n){var e=t[u][1][n];return o(e?e:n)},a,a.exports,n,t,e,r)}return e[u].exports}for(var i="function"==typeof require&&require,u=0;u1?d.call(arguments,1):[];return function(){return v(t,this,n.concat(d.call(arguments)))}}function u(t,n,e){return p(i,n,e,t)}function c(t,n){return function(){var e=this;return h.all(arguments).then(function(r){var o,i,u=h._defer();return"number"==typeof n.callback&&(o=f(r,n.callback)),"number"==typeof n.errback&&(i=f(r,n.errback)),o>i?(a(r,i,u._handler.reject,u._handler),a(r,o,u._handler.resolve,u._handler)):(a(r,o,u._handler.resolve,u._handler),a(r,i,u._handler.reject,u._handler)),t.apply(e,r),u})}}function f(t,n){return 0>n?t.length+n+2:n}function a(t,n,e,r){"number"==typeof n&&t.splice(n,0,s(e,r))}function s(t,n){return function(){arguments.length>1?t.call(n,d.call(arguments)):t.apply(n,arguments)}}var l=t("./when"),h=l.Promise,p=t("./lib/liftAll"),d=Array.prototype.slice,y=t("./lib/apply"),v=y(h,e);return{lift:i,liftAll:u,apply:n,call:o,promisify:c}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/apply":11,"./lib/liftAll":23,"./when":32}],3:[function(n,e,r){!function(t){t(function(){return function(t,n){return t.cancel=function(){try{t.reject(n(t))}catch(e){t.reject(e)}return t.promise},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],4:[function(n,e,r){!function(t){t(function(t){var n=t("./when");return function(t,e){return n(e).delay(t)}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],5:[function(n,e,r){!function(t){t(function(t){function n(t,n){return f(t,this,null==n?[]:a.call(n))}function e(t){var n=arguments.length>1?a.call(arguments,1):[];return function(){return f(t,this,n.concat(a.call(arguments)))}}function r(t,n,r){return c(e,n,r,t)}function o(t){var n=a.call(arguments,1);return function(){var e=this,r=a.call(arguments),o=u.apply(e,[t].concat(r));return i.reduce(n,function(t,n){return n.call(e,t)},o)}}var i=t("./when"),u=i["try"],c=t("./lib/liftAll"),f=t("./lib/apply")(i.Promise),a=Array.prototype.slice;return{lift:e,liftAll:r,call:u,apply:n,compose:o}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/apply":11,"./lib/liftAll":23,"./when":32}],6:[function(n,e,r){!function(t){t(function(t){function n(t,n){return function(){var e=o.call(arguments);return r(t()).withThis(this).then(function(t){return r(n.apply(this,e))["finally"](t)})}}function e(t){function n(){e=Math.max(e-1,0),o.length>0&&o.shift()(n)}var e=0,o=[];return function(){return r.promise(function(r){t>e?r(n):o.push(r),e+=1})}}var r=t("./when"),o=Array.prototype.slice;return n.n=e,n})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],7:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t){function n(t,n,e){this[t]=n,0===--f&&e.resolve(i)}for(var e,r=u._defer(),o=u._handler(r),i={},c=Object.keys(t),f=c.length,a=0;a>>0,a=f,s=[],l=0;f>l;++l)if(i=n[l],void 0!==i||l in n){if(o=t._handler(i),o.state()>0){c.become(o),t._visitRemaining(n,l,o);break}o.visit(c,e,r)}else--a;return 0===a&&c.reject(new RangeError("any(): array must not be empty")),u}function o(n,e){function r(t){this.resolved||(s.push(t),0===--p&&(l=null,this.resolve(s)))}function o(t){this.resolved||(l.push(t),0===--i&&(s=null,this.reject(l)))}var i,u,c,f=t._defer(),a=f._handler,s=[],l=[],h=n.length>>>0,p=0;for(c=0;h>c;++c)u=n[c],(void 0!==u||c in n)&&++p;for(e=Math.max(e,0),i=p-e+1,p=Math.min(e,p),e>p?a.reject(new RangeError("some(): array must contain at least "+e+" item(s), but had "+p)):0===p&&a.resolve(s),c=0;h>c;++c)u=n[c],(void 0!==u||c in n)&&t._handler(u).visit(a,r,o,a.notify);return f}function i(n,e){return t._traverse(e,n)}function u(n,e){var r=b.call(n);return t._traverse(e,r).then(function(t){return c(r,t)})}function c(n,e){for(var r=e.length,o=new Array(r),i=0,u=0;r>i;++i)e[i]&&(o[u++]=t._handler(n[i]).value);return o.length=u,o}function f(t){return y(t.map(a))}function a(e){var r;return e instanceof t&&(r=e._handler.join()),r&&0===r.state()||!r?d(e).then(n.fulfilled,n.rejected):(r._unreport(),n.inspect(r))}function s(t,n){return arguments.length>2?v.call(t,h(n),arguments[2]):v.call(t,h(n))}function l(t,n){return arguments.length>2?m.call(t,h(n),arguments[2]):m.call(t,h(n))}function h(t){return function(n,e,r){return p(t,void 0,[n,e,r])}}var p=e(t),d=t.resolve,y=t.all,v=Array.prototype.reduce,m=Array.prototype.reduceRight,b=Array.prototype.slice;return t.any=r,t.some=o,t.settle=f,t.map=i,t.filter=u,t.reduce=s,t.reduceRight=l,t.prototype.spread=function(t){return this.then(y).then(function(n){return t.apply(this,n)})},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../apply":11,"../state":25}],13:[function(n,e,r){!function(t){"use strict";t(function(){function t(){throw new TypeError("catch predicate must be a function")}function n(t,n){return e(n)?t instanceof n:n(t)}function e(t){return t===Error||null!=t&&t.prototype instanceof Error}function r(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function o(t){return t}return function(e){function i(t,e){return function(r){return n(r,e)?t.call(this,r):a(r)}}function u(t,n,e,o){var i=t.call(n);return r(i)?c(i,e,o):e(o)}function c(t,n,e){return f(t).then(function(){return n(e)})}var f=e.resolve,a=e.reject,s=e.prototype["catch"];return e.prototype.done=function(t,n){this._handler.visit(this._handler.receiver,t,n)},e.prototype["catch"]=e.prototype.otherwise=function(n){return arguments.length<2?s.call(this,n):"function"!=typeof n?this.ensure(t):s.call(this,i(arguments[1],n))},e.prototype["finally"]=e.prototype.ensure=function(t){return"function"!=typeof t?this:this.then(function(n){return u(t,this,o,n)},function(n){return u(t,this,a,n)})},e.prototype["else"]=e.prototype.orElse=function(t){return this.then(void 0,function(){return t})},e.prototype["yield"]=function(t){return this.then(function(){return t})},e.prototype.tap=function(t){return this.then(t)["yield"](this)},e}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],14:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.fold=function(n,e){var r=this._beget();return this._handler.fold(function(e,r,o){t._handler(e).fold(function(t,e,r){r.resolve(n.call(this,e,t))},r,this,o)},e,r._handler.receiver,r._handler),r},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],15:[function(n,e,r){!function(t){"use strict";t(function(t){var n=t("../state").inspect;return function(t){return t.prototype.inspect=function(){return n(t._handler(this))},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../state":25}],16:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){function n(t,n,r,o){return e(function(n){return[n,t(n)]},n,r,o)}function e(t,n,o,i){function u(i,u){return r(o(i)).then(function(){return e(t,n,o,u)})}return r(i).then(function(e){return r(n(e)).then(function(n){return n?e:r(t(e)).spread(u)})})}var r=t.resolve;return t.iterate=n,t.unfold=e,t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],17:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype.progress=function(t){return this.then(void 0,void 0,t)},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],18:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t,n,r,o){return e.setTimer(function(){t(r,o,n)},n)}var e=t("../env"),r=t("../TimeoutError");return function(t){function o(t,e,r){n(i,t,e,r)}function i(t,n){n.resolve(t)}function u(t,n,e){var o="undefined"==typeof t?new r("timed out after "+e+"ms"):t;n.reject(o)}return t.prototype.delay=function(t){var n=this._beget();return this._handler.fold(o,t,void 0,n._handler),n},t.prototype.timeout=function(t,r){var o=this._beget(),i=o._handler,c=n(u,t,r,o._handler);return this._handler.visit(i,function(t){e.clearTimer(c),this.resolve(t)},function(t){e.clearTimer(c),this.reject(t)},i.notify),o},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../TimeoutError":10,"../env":21}],19:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t){throw t}function e(){}var r=t("../env").setTimer,o=t("../format");return function(t){function i(t){t.handled||(p.push(t),s("Potentially unhandled rejection ["+t.id+"] "+o.formatError(t.value)))}function u(t){var n=p.indexOf(t);n>=0&&(p.splice(n,1),l("Handled previous rejection ["+t.id+"] "+o.formatObject(t.value)))}function c(t,n){h.push(t,n),null===d&&(d=r(f,0))}function f(){for(d=null;h.length>0;)h.shift()(h.shift())}var a,s=e,l=e;"undefined"!=typeof console&&(a=console,s="undefined"!=typeof a.error?function(t){a.error(t)}:function(t){a.log(t)},l="undefined"!=typeof a.info?function(t){a.info(t)}:function(t){a.log(t)}),t.onPotentiallyUnhandledRejection=function(t){c(i,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){c(u,t)},t.onFatalRejection=function(t){c(n,t.value)};var h=[],p=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"../env":21,"../format":22}],20:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){return t.prototype["with"]=t.prototype.withThis=function(t){var n=this._beget(),e=n._handler;return e.receiver=t,this._handler.chain(e,t),n},t}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],21:[function(n,e,r){!function(t){"use strict";t(function(t){function n(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function e(){return"undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver}function r(t){function n(){var t=e;e=void 0,t()}var e,r=document.createTextNode(""),o=new t(n);o.observe(r,{characterData:!0});var i=0;return function(t){e=t,r.data=i^=1}}var o,i="undefined"!=typeof setTimeout&&setTimeout,u=function(t,n){return setTimeout(t,n)},c=function(t){return clearTimeout(t)},f=function(t){return i(t,0)};if(n())f=function(t){return process.nextTick(t)};else if(o=e())f=r(o);else if(!i){var a=t,s=a("vertx");u=function(t,n){return s.setTimer(n,t)},c=s.cancelTimer,f=s.runOnLoop||s.runOnContext}return{setTimer:u,clearTimer:c,asap:f}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{}],22:[function(n,e,r){!function(t){"use strict";t(function(){function t(t){var e="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:n(t);return t instanceof Error?e:e+" (WARNING: non-Error used)"}function n(t){var n=String(t);return"[object Object]"===n&&"undefined"!=typeof JSON&&(n=e(t,n)),n}function e(t,n){try{return JSON.stringify(t)}catch(e){return n}}return{formatError:t,formatObject:n,tryStringify:e}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],23:[function(n,e,r){!function(t){"use strict";t(function(){function t(t,n,e){return t[e]=n,t}function n(t){return"function"==typeof t?t.bind():Object.create(t)}return function(e,r,o,i){return"undefined"==typeof r&&(r=t),Object.keys(i).reduce(function(t,n){var o=i[n];return"function"==typeof o?r(t,e(o),n):t},"undefined"==typeof o?n(i):o)}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],24:[function(n,e,r){!function(t){"use strict";t(function(){return function(t){function n(t,n){this._handler=t===g?n:e(t)}function e(t){function n(t){o.resolve(t)}function e(t){o.reject(t)}function r(t){o.notify(t)}var o=new w;try{t(n,e,r)}catch(i){e(i)}return o}function r(t){return L(t)?t:new n(g,new j(v(t)))}function o(t){return new n(g,new j(new k(t)))}function i(){return nt}function u(){return new n(g,new w)}function c(t,n){var e=new w(t.receiver,t.join().context);return new n(g,e)}function f(t){return s(K,null,t)}function a(t,n){return s(N,t,n)}function s(t,e,r){function o(n,o,u){u.resolved||l(r,i,n,t(e,o,n),u)}function i(t,n,e){s[t]=n,0===--a&&e.become(new E(s))}for(var u,c="function"==typeof e?o:i,f=new w,a=r.length>>>0,s=new Array(a),h=0;h0?n(e,i.value,o):(o.become(i),h(t,e+1,i))}else n(e,r,o)}function h(t,n,e){for(var r=n;re&&t._unreport()}}function d(t){return"object"!=typeof t||null===t?o(new TypeError("non-iterable passed to race()")):0===t.length?i():1===t.length?r(t[0]):y(t)}function y(t){var e,r,o,i=new w;for(e=0;e0||"function"!=typeof n&&0>o)return new this.constructor(g,r);var i=this._beget(),u=i._handler;return r.chain(u,r.receiver,t,n,e),i},n.prototype["catch"]=function(t){return this.then(void 0,t)},n.prototype._beget=function(){return c(this._handler,this.constructor)},n.all=f,n.race=d,n._traverse=a,n._visitRemaining=h,g.prototype.when=g.prototype.become=g.prototype.notify=g.prototype.fail=g.prototype._unreport=g.prototype._report=D,g.prototype._state=0,g.prototype.state=function(){return this._state},g.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},g.prototype.chain=function(t,n,e,r,o){this.when({resolver:t,receiver:n,fulfilled:e,rejected:r,progress:o})},g.prototype.visit=function(t,n,e,r){this.chain(Z,t,n,e,r)},g.prototype.fold=function(t,n,e,r){this.when(new Q(t,n,e,r))},J(g,_),_.prototype.become=function(t){t.fail()};var Z=new _;J(g,w),w.prototype._state=0,w.prototype.resolve=function(t){this.become(v(t))},w.prototype.reject=function(t){this.resolved||this.become(new k(t))},w.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=C();return t},w.prototype.run=function(){var t=this.consumers,n=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var e=0;e0?e(r.value):n(r.value)}return{pending:t,fulfilled:e,rejected:n,inspect:r}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t()})},{}],26:[function(n,e,r){!function(t){t(function(t){function n(t,n){return p(t,this,n||[])}function e(t,n,e,r){var o=u(r);try{switch(e.length){case 2:t.call(n,e[0],e[1],o);break;case 1:t.call(n,e[0],o);break;case 0:t.call(n,o);break;default:e.push(o),t.apply(n,e)}}catch(i){r.reject(i)}}function r(t){return p(t,this,h.call(arguments,1))}function o(t){var n=arguments.length>1?h.call(arguments,1):[];return function(){var e,r=n.length,o=arguments.length,i=new Array(o+r);for(e=0;r>e;++e)i[e]=n[e];for(e=0;o>e;++e)i[e+r]=arguments[e];return p(t,this,i)}}function i(t,n,e){return s(o,n,e,t)}function u(t){return function(n,e){n?t.reject(n):arguments.length>2?t.resolve(h.call(arguments,1)):t.resolve(e)}}function c(t,n){function e(t){r(null,t)}function r(t,e){l(function(){n(t,e)},0)}return t=a(t),n&&t.then(e,r),t}function f(t){return function(n){return c(n,t)}}var a=t("./when"),s=t("./lib/liftAll"),l=t("./lib/env").setTimer,h=Array.prototype.slice,p=t("./lib/apply")(a.Promise,e);return{lift:o,liftAll:i,apply:n,call:r,createCallback:u,bindCallback:c,liftCallback:f}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/apply":11,"./lib/env":21,"./lib/liftAll":23,"./when":32}],27:[function(n,e,r){!function(t){t(function(t){var n=t("./when"),e=n.Promise.all,r=Array.prototype.slice;return function(t){return e(r.call(arguments,1)).then(function(e){return n.map(t,function(t){return t.apply(void 0,e)})})}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],28:[function(n,e,r){!function(t){t(function(t){var n=t("./when"),e=n.Promise.all,r=Array.prototype.slice;return function(t){var o=function(t,n){return o=function(t,n){return n(t)},n.apply(null,t)};return e(r.call(arguments,1)).then(function(e){return n.reduce(t,function(t,n){return o(t,n)},e)})}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],29:[function(n,e,r){!function(t){"use strict";t(function(t){var n=t("./when"),e=n["try"],r=t("./cancelable");return function(t,o,i,u){function c(t){s.resolve(t)}function f(t){e(o).then(a,h),void 0!==t&&s.notify(t)}function a(){l||n(t(),function(t){n(i(t),function(n){return n?c(t):f(t)},function(){f(t)})},h)}var s,l,h;return l=!1,s=r(n.defer(),function(){l=!0}),h=s.reject,i=i||function(){return!1},"function"!=typeof o&&(o=function(t){return function(){return n().delay(t)}}(o)),u?f():a(),s.promise=Object.create(s.promise),s.promise.cancel=s.cancel,s.promise}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./cancelable":3,"./when":32}],30:[function(n,e,r){!function(t){t(function(t){var n=t("./when"),e=n.Promise.all,r=Array.prototype.slice;return function(t){function o(t){return i.push(t),i}var i=[];return e(r.call(arguments,1)).then(function(e){return n.reduce(t,function(t,r){return n(r.apply(void 0,e),o)},i)})}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],31:[function(n,e,r){!function(t){t(function(t){var n=t("./when");return function(t,e){return n(e).timeout(t)}})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./when":32}],32:[function(n,e,r){!function(t){"use strict";t(function(t){function n(t,n,e,r){var o=x.resolve(t);return arguments.length<2?o:o.then(n,e,r)}function e(t){return new x(t)}function r(t){return function(){for(var n=0,e=arguments.length,r=new Array(e);e>n;++n)r[n]=arguments[n];return E(t,this,r)}}function o(t){for(var n=0,e=arguments.length-1,r=new Array(e);e>n;++n)r[n]=arguments[n+1];return E(t,this,r)}function i(){return new u}function u(){function t(t){r._handler.resolve(t)}function n(t){r._handler.reject(t)}function e(t){r._handler.notify(t)}var r=x._defer();this.promise=r,this.resolve=t,this.reject=n,this.notify=e,this.resolver={resolve:t,reject:n,notify:e}}function c(t){return t&&"function"==typeof t.then}function f(){return x.all(arguments)}function a(t){return n(t,x.all)}function s(t){return n(t,x.settle)}function l(t,e){return n(t,function(t){return x.map(t,e)})}function h(t,e){return n(t,function(t){return x.filter(t,e)})}var p=t("./lib/decorators/timed"),d=t("./lib/decorators/array"),y=t("./lib/decorators/flow"),v=t("./lib/decorators/fold"),m=t("./lib/decorators/inspect"),b=t("./lib/decorators/iterate"),g=t("./lib/decorators/progress"),_=t("./lib/decorators/with"),w=t("./lib/decorators/unhandledRejection"),j=t("./lib/TimeoutError"),x=[d,y,v,b,g,m,_,p,w].reduce(function(t,n){return n(t)},t("./lib/Promise")),E=t("./lib/apply")(x);return n.promise=e,n.resolve=x.resolve,n.reject=x.reject,n.lift=r,n["try"]=o,n.attempt=o,n.iterate=x.iterate,n.unfold=x.unfold,n.join=f,n.all=a,n.settle=s,n.any=r(x.any),n.some=r(x.some),n.race=r(x.race),n.map=l,n.filter=h,n.reduce=r(x.reduce),n.reduceRight=r(x.reduceRight),n.isPromiseLike=c,n.Promise=x,n.defer=i,n.TimeoutError=j,n})}("function"==typeof t&&t.amd?t:function(t){e.exports=t(n)})},{"./lib/Promise":8,"./lib/TimeoutError":10,"./lib/apply":11,"./lib/decorators/array":12,"./lib/decorators/flow":13,"./lib/decorators/fold":14,"./lib/decorators/inspect":15,"./lib/decorators/iterate":16,"./lib/decorators/progress":17,"./lib/decorators/timed":18,"./lib/decorators/unhandledRejection":19,"./lib/decorators/with":20}]},{},[1])(1)}); +//# sourceMappingURL=dist/browser/when.min.js.map \ No newline at end of file diff --git a/node_modules/when/dist/browser/when.min.js.map b/node_modules/when/dist/browser/when.min.js.map index 3d25b9dcf..178a1a2ed 100644 --- a/node_modules/when/dist/browser/when.min.js.map +++ b/node_modules/when/dist/browser/when.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["build/when.browserify.js","callbacks.js","cancelable.js","delay.js","function.js","guard.js","keys.js","lib/Promise.js","lib/Scheduler.js","lib/TimeoutError.js","lib/apply.js","lib/decorators/array.js","lib/decorators/flow.js","lib/decorators/fold.js","lib/decorators/inspect.js","lib/decorators/iterate.js","lib/decorators/progress.js","lib/decorators/timed.js","lib/decorators/unhandledRejection.js","lib/decorators/with.js","lib/env.js","lib/format.js","lib/liftAll.js","lib/makePromise.js","lib/state.js","node.js","parallel.js","pipeline.js","poll.js","sequence.js","timeout.js","when.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/build/when.browserify.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/callbacks.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/cancelable.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/delay.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/function.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/guard.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/keys.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/Promise.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/Scheduler.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/TimeoutError.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/apply.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/array.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/flow.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/fold.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/inspect.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/iterate.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/progress.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/timed.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/unhandledRejection.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/decorators/with.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/env.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/format.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/liftAll.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/makePromise.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/lib/state.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/node.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/parallel.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/pipeline.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/poll.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/sequence.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/timeout.js","https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83/when.js"],"names":["when","module","exports","require","callbacks","cancelable","delay","fn","guard","keys","nodefn","node","parallel","pipeline","poll","sequence","timeout","define","apply","asyncFunction","extraAsyncArgs","_apply","this","dispatch","f","thisArg","args","h","push","alwaysUnary","resolve","reject","tryCatchResolve","resolver","e","call","slice","arguments","lift","length","concat","liftAll","src","combine","dst","_liftAll","promisify","positions","Promise","all","then","callbackPos","errbackPos","p","_defer","callback","normalizePosition","errback","insertCallback","_handler","pos","splice","Array","prototype","makeApply","amd","factory","deferred","canceler","cancel","promise","msec","value","compose","funcs","firstPromise","attempt","reduce","arg","func","condition","withThis","exit","n","allowed","count","Math","max","waiting","shift","object","settleKey","k","x","pending","results","Object","i","fold","map","mapWithKey","toPromise","o","settle","promises","states","populateResults","makePromise","Scheduler","async","asap","scheduler","_async","_running","_queue","_queueLen","_afterQueue","_afterQueueLen","self","drain","_drain","enqueue","task","run","afterQueue","TimeoutError","message","Error","name","captureStackTrace","create","constructor","l","params","callAndResolve","c","handler","callAndResolveNext","state","applier","any","handleFulfill","errors","handleReject","resolved","become","_visitRemaining","visit","RangeError","some","fulfill","nFulfill","nReject","min","notify","_traverse","filter","predicate","a","keep","filterSync","filtered","j","settleOne","fulfilled","rejected","_unreport","inspect","ar","liftCombine","reduceRight","arr","z","applyFold","spread","onFulfilled","array","rejectInvalidPredicate","TypeError","evaluatePredicate","isError","maybeThenable","identity","createCatchFilter","runSideEffect","propagate","result","propagateValue","origCatch","done","onResult","onError","receiver","otherwise","onRejected","ensure","orElse","defaultValue","tap","onFulfilledSideEffect","_beget","to","iterate","unfold","unspool","next","item","newSeed","seed","progress","onProgress","setTimeout","ms","y","env","setTimer","handleDelay","resolveDelay","onTimeout","reason","t","clearTimer","throwit","noop","format","report","r","handled","reported","logError","id","formatError","unreport","indexOf","logInfo","formatObject","tasks","running","flush","localConsole","console","error","log","info","onPotentiallyUnhandledRejection","rejection","onPotentiallyUnhandledRejectionHandled","onFatalRejection","child","chain","isNode","process","toString","hasMutationObserver","MutationObserver","WebKitMutationObserver","initMutationObserver","scheduled","document","createTextNode","observe","characterData","data","MutationObs","capturedSetTimeout","clearTimeout","nextTick","vertxRequire","vertx","cancelTimer","runOnLoop","runOnContext","s","stack","String","JSON","tryStringify","stringify","defaultCombine","defaultDst","bind","liftOne","key","environment","Handler","init","promiseResolve","promiseReject","promiseNotify","Pending","isPromise","Async","getHandler","Rejected","never","foreverPendingPromise","defer","begetFrom","parent","join","context","traverseWith","snd","traverse","tryCatch2","tryMap","mapAt","traverseAt","settleAt","Fulfilled","getHandlerMaybeThenable","visitRemaining","start","markAsHandled","race","runRace","getHandlerUntrusted","untrustedThen","Thenable","FailIfRejected","inheritedContext","createContext","consumers","thenable","AssimilateTask","errorId","_report","ReportTask","UnreportTask","cycle","ContinuationTask","continuation","ProgressTask","_then","tryAssimilate","Fold","failIfRejected","runContinuation1","enterContext","tryCatchReject","exitContext","runContinuation3","tryCatchReject3","runNotify","tryCatchReturn","b","inherit","Parent","Child","objectCreate","initEmitRejection","emit","type","CustomEvent","hasCustomEvent","ev","detail","bubbles","dispatchEvent","emitRejection","proto","fail","_state","q","cont","foreverPendingHandler","_resolve","_reject","_notify","toPendingState","toRejectedState","toFulfilledState","cb","createCallback","args1","al","err","bindCallback","success","wrapped","liftCallback","runTask","interval","verifier","delayInitialTask","certify","schedule","vote","canceled","verification","addResult","trigger","Deferred","isPromiseLike","mapFunc","timed","flow","generate","unhandledRejection","feature"],"mappings":"yqBgCAA,GAAAA,GAAAC,EAAAC,QAAAC,EAAA,UAEAH,GAAAI,UAAAD,EAAA,gBACAH,EAAAK,WAAAF,EAAA,iBACAH,EAAAM,MAAAH,EAAA,YACAH,EAAAO,GAAAJ,EAAA,eACAH,EAAAQ,MAAAL,EAAA,YACAH,EAAAS,KAAAN,EAAA,WACAH,EAAAU,OAAAV,EAAAW,KAAAR,EAAA,WACAH,EAAAY,SAAAT,EAAA,eACAH,EAAAa,SAAAV,EAAA,eACAH,EAAAc,KAAAX,EAAA,WACAH,EAAAe,SAAAZ,EAAA,eACAH,EAAAgB,QAAAb,EAAA,yOCHA,SAAAc,GACAA,EAAA,SAAAd,GAgDA,QAAAe,GAAAC,EAAAC,GACA,MAAAC,GAAAF,EAAAG,KAAAF,OAOA,QAAAG,GAAAC,EAAAC,EAAAC,EAAAC,GACAD,EAAAE,KAAAC,EAAAF,EAAAG,QAAAH,GAAAE,EAAAF,EAAAI,OAAAJ,IACAK,EAAAR,EAAAC,EAAAC,EAAAC,GAGA,QAAAK,GAAAR,EAAAC,EAAAC,EAAAO,GACA,IACAT,EAAAN,MAAAO,EAAAC,GACA,MAAAQ,GACAD,EAAAF,OAAAG,IAwBA,QAAAC,GAAAhB,GACA,MAAAE,GAAAF,EAAAG,KAAAc,EAAAD,KAAAE,UAAA,IAoCA,QAAAC,GAAAd,GACA,GAAAE,GAAAW,UAAAE,OAAA,EAAAH,EAAAD,KAAAE,UAAA,KACA,OAAA,YACA,MAAAhB,GAAAG,EAAAF,KAAAI,EAAAc,OAAAJ,EAAAD,KAAAE,cAeA,QAAAI,GAAAC,EAAAC,EAAAC,GACA,MAAAC,GAAAP,EAAAK,EAAAC,EAAAF,GAqDA,QAAAI,GAAA3B,EAAA4B,GAEA,MAAA,YACA,GAAAtB,GAAAH,IACA,OAAA0B,GAAAC,IAAAZ,WAAAa,KAAA,SAAAxB,GACA,GAEAyB,GAAAC,EAFAC,EAAAL,EAAAM,QAsBA,OAlBA,gBAAAP,GAAAQ,WACAJ,EAAAK,EAAA9B,EAAAqB,EAAAQ,WAGA,gBAAAR,GAAAU,UACAL,EAAAI,EAAA9B,EAAAqB,EAAAU,UAGAN,EAAAC,GACAM,EAAAhC,EAAA0B,EAAAC,EAAAM,SAAA5B,OAAAsB,EAAAM,UACAD,EAAAhC,EAAAyB,EAAAE,EAAAM,SAAA7B,QAAAuB,EAAAM,YAEAD,EAAAhC,EAAAyB,EAAAE,EAAAM,SAAA7B,QAAAuB,EAAAM,UACAD,EAAAhC,EAAA0B,EAAAC,EAAAM,SAAA5B,OAAAsB,EAAAM,WAGAxC,EAAAD,MAAAO,EAAAC,GAEA2B,KAKA,QAAAG,GAAA9B,EAAAkC,GACA,MAAA,GAAAA,EAAAlC,EAAAa,OAAAqB,EAAA,EAAAA,EAGA,QAAAF,GAAAhC,EAAAkC,EAAAL,EAAA9B,GACA,gBAAAmC,IACAlC,EAAAmC,OAAAD,EAAA,EAAA/B,EAAA0B,EAAA9B,IAIA,QAAAI,GAAAtB,EAAAkB,GACA,MAAA,YACAY,UAAAE,OAAA,EACAhC,EAAA4B,KAAAV,EAAAW,EAAAD,KAAAE,YAEA9B,EAAAW,MAAAO,EAAAY,YAnPA,GAAArC,GAAAG,EAAA,UACA6C,EAAAhD,EAAAgD,QACAH,EAAA1C,EAAA,iBACAiC,EAAA0B,MAAAC,UAAA3B,MAEA4B,EAAA7D,EAAA,eACAkB,EAAA2C,EAAAhB,EAAAzB,EAEA,QACAe,KAAAA,EACAG,QAAAA,EACAvB,MAAAA,EACAiB,KAAAA,EACAW,UAAAA,MA2OA,kBAAA7B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,6ECnPA,SAAAc,GACAA,EAAA,WAeA,MAAA,UAAAkD,EAAAC,GAaA,MAVAD,GAAAE,OAAA,WACA,IACAF,EAAApC,OAAAqC,EAAAD,IACA,MAAAjC,GACAiC,EAAApC,OAAAG,GAGA,MAAAiC,GAAAG,SAGAH,MAIA,kBAAAlD,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,+BCxCA,SAAAjD,GACAA,EAAA,SAAAd,GAEA,GAAAH,GAAAG,EAAA,SAKA,OAAA,UAAAoE,EAAAC,GACA,MAAAxE,GAAAwE,GAAAlE,MAAAiE,OAIA,kBAAAtD,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,yCCdA,SAAAc,GACAA,EAAA,SAAAd,GAwBA,QAAAe,GAAAM,EAAAE,GAEA,MAAAL,GAAAG,EAAAF,KAAA,MAAAI,KAAAU,EAAAD,KAAAT,IAeA,QAAAY,GAAAd,GACA,GAAAE,GAAAW,UAAAE,OAAA,EAAAH,EAAAD,KAAAE,UAAA,KACA,OAAA,YACA,MAAAhB,GAAAG,EAAAF,KAAAI,EAAAc,OAAAJ,EAAAD,KAAAE,cAeA,QAAAI,GAAAC,EAAAC,EAAAC,GACA,MAAAC,GAAAP,EAAAK,EAAAC,EAAAF,GAgBA,QAAA+B,GAAAjD,GACA,GAAAkD,GAAAtC,EAAAD,KAAAE,UAAA,EAEA,OAAA,YACA,GAAAZ,GAAAH,KACAI,EAAAU,EAAAD,KAAAE,WACAsC,EAAAC,EAAA1D,MAAAO,GAAAD,GAAAgB,OAAAd,GAEA,OAAA1B,GAAA6E,OAAAH,EAAA,SAAAI,EAAAC,GACA,MAAAA,GAAA5C,KAAAV,EAAAqD,IACAH,IApFA,GAAA3E,GAAAG,EAAA,UACAyE,EAAA5E,EAAA,OACA6C,EAAA1C,EAAA,iBACAkB,EAAAlB,EAAA,eAAAH,EAAAgD,SACAZ,EAAA0B,MAAAC,UAAA3B,KAEA,QACAE,KAAAA,EACAG,QAAAA,EACAN,KAAAyC,EACA1D,MAAAA,EACAuD,QAAAA,MA6EA,kBAAAxD,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,6EC3FA,SAAAc,GACAA,EAAA,SAAAd,GAiBA,QAAAK,GAAAwE,EAAAxD,GACA,MAAA,YACA,GAAAE,GAAAU,EAAAD,KAAAE,UAEA,OAAArC,GAAAgF,KAAAC,SAAA3D,MAAA4B,KAAA,SAAAgC,GACA,MAAAlF,GAAAwB,EAAAN,MAAAI,KAAAI,IAAA,WAAAwD,MAcA,QAAAC,GAAAC,GAeA,QAAAF,KACAG,EAAAC,KAAAC,IAAAF,EAAA,EAAA,GACAG,EAAAjD,OAAA,GACAiD,EAAAC,QAAAP,GAjBA,GAAAG,GAAA,EACAG,IAEA,OAAA,YACA,MAAAxF,GAAAsE,QAAA,SAAAxC,GACAsD,EAAAC,EACAvD,EAAAoD,GAEAM,EAAA5D,KAAAE,GAEAuD,GAAA,KA7CA,GAAArF,GAAAG,EAAA,UACAiC,EAAA0B,MAAAC,UAAA3B,KAIA,OAFA5B,GAAA2E,EAAAA,EAEA3E,KAqDA,kBAAAS,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,yCC9DA,SAAAc,GAAA,YACAA,GAAA,SAAAd,GAmBA,QAAA8C,GAAAyC,GAmBA,QAAAC,GAAAC,EAAAC,EAAA5D,GAEAX,KAAAsE,GAAAC,EACA,MAAAC,GACA7D,EAAAH,QAAAiE,GAfA,IAAA,GAAAH,GAPAvC,EAAAL,EAAAM,SACArB,EAAAe,EAAAW,SAAAN,GAEA0C,KACAtF,EAAAuF,OAAAvF,KAAAiF,GACAI,EAAArF,EAAA8B,OAEA0D,EAAA,EAAAA,EAAAxF,EAAA8B,SAAA0D,EACAL,EAAAnF,EAAAwF,GACAjD,EAAAW,SAAA+B,EAAAE,IAAAM,KAAAP,EAAAC,EAAAG,EAAA9D,EAOA,OAJA,KAAA6D,GACA7D,EAAAH,QAAAiE,GAGA1C,EAoBA,QAAA8C,GAAAT,EAAAlE,GAQA,QAAA4E,GAAAR,EAAAC,GACA,MAAArE,GAAAqE,EAAAD,GARA,MAAAS,GAAAX,GAAAxC,KAAA,SAAAwC,GACA,MAAAzC,GAAA+C,OAAAvF,KAAAiF,GAAAb,OAAA,SAAAyB,EAAAV,GAEA,MADAU,GAAAV,GAAAS,EAAAX,EAAAE,IAAAM,KAAAE,EAAAR,GACAU,UAgBA,QAAAC,GAAAb,GACA,GAAAjF,GAAAuF,OAAAvF,KAAAiF,GACAK,IAEA,IAAA,IAAAtF,EAAA8B,OACA,MAAA8D,GAAAN,EAGA,IAAA1C,GAAAL,EAAAM,SACArB,EAAAe,EAAAW,SAAAN,GACAmD,EAAA/F,EAAA0F,IAAA,SAAAP,GAAA,MAAAF,GAAAE,IAMA,OAJA5F,GAAAuG,OAAAC,GAAAtD,KAAA,SAAAuD,GACAC,EAAAjG,EAAAgG,EAAAV,EAAA9D,KAGAoB,EAGA,QAAAqD,GAAAjG,EAAAgG,EAAAV,EAAA9D,GACA,IAAA,GAAAgE,GAAA,EAAAA,EAAAxF,EAAA8B,OAAA0D,IACAF,EAAAtF,EAAAwF,IAAAQ,EAAAR,EAEAhE,GAAAH,QAAAiE,GAjGA,GAAA/F,GAAAG,EAAA,UACA6C,EAAAhD,EAAAgD,QACAqD,EAAArG,EAAA8B,OAEA,QACAmB,IAAAjD,EAAAsC,KAAAW,GACAkD,IAAAA,EACAI,OAAAA,MA8FA,kBAAAtF,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,yCC7GA,SAAAc,GAAA,YACAA,GAAA,SAAAd,GAEA,GAAAwG,GAAAxG,EAAA,iBACAyG,EAAAzG,EAAA,eACA0G,EAAA1G,EAAA,SAAA2G,IAEA,OAAAH,IACAI,UAAA,GAAAH,GAAAC,QAIA,kBAAA5F,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,2ECZA,SAAAc,GAAA,YACAA,GAAA,WAUA,QAAA2F,GAAAC,GACAvF,KAAA0F,OAAAH,EACAvF,KAAA2F,UAAA,EAEA3F,KAAA4F,OAAA5F,KACAA,KAAA6F,UAAA,EACA7F,KAAA8F,eACA9F,KAAA+F,eAAA,CAEA,IAAAC,GAAAhG,IACAA,MAAAiG,MAAA,WACAD,EAAAE,UAkDA,MA1CAZ,GAAA7C,UAAA0D,QAAA,SAAAC,GACApG,KAAA4F,OAAA5F,KAAA6F,aAAAO,EACApG,KAAAqG,OAOAf,EAAA7C,UAAA6D,WAAA,SAAAF,GACApG,KAAA8F,YAAA9F,KAAA+F,kBAAAK,EACApG,KAAAqG,OAGAf,EAAA7C,UAAA4D,IAAA,WACArG,KAAA2F,WACA3F,KAAA2F,UAAA,EACA3F,KAAA0F,OAAA1F,KAAAiG,SAOAX,EAAA7C,UAAAyD,OAAA,WAEA,IADA,GAAAvB,GAAA,EACAA,EAAA3E,KAAA6F,YAAAlB,EACA3E,KAAA4F,OAAAjB,GAAA0B,MACArG,KAAA4F,OAAAjB,GAAA,MAMA,KAHA3E,KAAA6F,UAAA,EACA7F,KAAA2F,UAAA,EAEAhB,EAAA,EAAAA,EAAA3E,KAAA+F,iBAAApB,EACA3E,KAAA8F,YAAAnB,GAAA0B,MACArG,KAAA8F,YAAAnB,GAAA,MAGA3E,MAAA+F,eAAA,GAGAT,KAGA,kBAAA3F,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCC3EA,SAAAjD,GAAA,YACAA,GAAA,WAOA,QAAA4G,GAAAC,GACAC,MAAA5F,KAAAb,MACAA,KAAAwG,QAAAA,EACAxG,KAAA0G,KAAAH,EAAAG,KACA,kBAAAD,OAAAE,mBACAF,MAAAE,kBAAA3G,KAAAuG,GAOA,MAHAA,GAAA9D,UAAAiC,OAAAkC,OAAAH,MAAAhE,WACA8D,EAAA9D,UAAAoE,YAAAN,EAEAA,KAEA,kBAAA5G,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCCtBA,SAAAjD,GAAA,YACAA,GAAA,WAMA,QAAA+C,GAAAhB,EAAAb,GAOA,QAAAjB,GAAAM,EAAAC,EAAAC,GACA,GAAA2B,GAAAL,EAAAM,SACA8E,EAAA1G,EAAAa,OACA8F,EAAA,GAAAvE,OAAAsE,EAGA,OAFAE,IAAA9G,EAAAA,EAAAC,QAAAA,EAAAC,KAAAA,EAAA2G,OAAAA,EAAApC,EAAAmC,EAAA,EAAAjG,KAAAA,GAAAkB,EAAAM,UAEAN,EAGA,QAAAiF,GAAAC,EAAA5G,GACA,GAAA4G,EAAAtC,EAAA,EACA,MAAA9D,GAAAoG,EAAA/G,EAAA+G,EAAA9G,QAAA8G,EAAAF,OAAA1G,EAGA,IAAA6G,GAAAxF,EAAAW,SAAA4E,EAAA7G,KAAA6G,EAAAtC,GACAuC,GAAAtC,KAAAuC,EAAAF,EAAA,OAAA5G,GAGA,QAAA8G,GAAAF,EAAA1C,EAAAlE,GACA4G,EAAAF,OAAAE,EAAAtC,GAAAJ,EACA0C,EAAAtC,GAAA,EACAqC,EAAAC,EAAA5G,GAvBA,MAJAU,WAAAE,OAAA,IACAJ,EAAAH,GAGAd,EA2BA,QAAAc,GAAAR,EAAAC,EAAAC,EAAAO,GACA,IACAA,EAAAH,QAAAN,EAAAN,MAAAO,EAAAC,IACA,MAAAQ,GACAD,EAAAF,OAAAG,IAtCA,MAFA8B,GAAAhC,gBAAAA,EAEAgC,KA2CA,kBAAA/C,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCChDA,SAAAjD,GAAA,YACAA,GAAA,SAAAd,GAEA,GAAAuI,GAAAvI,EAAA,YACAwI,EAAAxI,EAAA,WAEA,OAAA,UAAA6C,GA2CA,QAAA4F,GAAApC,GA+BA,QAAAqC,GAAAhD,GAEAiD,EAAA,KACAxH,KAAAQ,QAAA+D,GAGA,QAAAkD,GAAA7G,GAEAZ,KAAA0H,WAIAF,EAAAlH,KAAAM,GACA,MAAA4D,GACAxE,KAAAS,OAAA+G,IArCA,IAAA,GAAAnH,GAAAkE,EAPAxC,EAAAL,EAAAM,SACArB,EAAAoB,EAAAM,SACAyE,EAAA5B,EAAAjE,SAAA,EAEAuD,EAAAsC,EACAU,KAEA7C,EAAA,EAAAmC,EAAAnC,IAAAA,EAEA,GADAJ,EAAAW,EAAAP,GACA,SAAAJ,GAAAI,IAAAO,GAAA,CAMA,GADA7E,EAAAqB,EAAAW,SAAAkC,GACAlE,EAAA+G,QAAA,EAAA,CACAzG,EAAAgH,OAAAtH,GACAqB,EAAAkG,gBAAA1C,EAAAP,EAAAtE,EACA,OAEAA,EAAAwH,MAAAlH,EAAA4G,EAAAE,SAVAjD,CAkBA,OAJA,KAAAA,GACA7D,EAAAF,OAAA,GAAAqH,YAAA,mCAGA/F,EAiCA,QAAAgG,GAAA7C,EAAArB,GA8CA,QAAAmE,GAAAzD,GAEAvE,KAAA0H,WAIAjD,EAAAnE,KAAAiE,GACA,MAAA0D,IACAT,EAAA,KACAxH,KAAAQ,QAAAiE,KAIA,QAAAhE,GAAAG,GAEAZ,KAAA0H,WAIAF,EAAAlH,KAAAM,GACA,MAAAsH,IACAzD,EAAA,KACAzE,KAAAS,OAAA+G,KAlEA,GAQAU,GACA3D,EAAAI,EATA5C,EAAAL,EAAAM,SACArB,EAAAoB,EAAAM,SAEAoC,KACA+C,KAEAV,EAAA5B,EAAAjE,SAAA,EACAgH,EAAA,CAKA,KAAAtD,EAAA,EAAAmC,EAAAnC,IAAAA,EACAJ,EAAAW,EAAAP,IACA,SAAAJ,GAAAI,IAAAO,OAGA+C,CAgBA,KAZApE,EAAAG,KAAAC,IAAAJ,EAAA,GACAqE,EAAAD,EAAApE,EAAA,EACAoE,EAAAjE,KAAAmE,IAAAtE,EAAAoE,GAEApE,EAAAoE,EACAtH,EAAAF,OAAA,GAAAqH,YAAA,uCACAjE,EAAA,qBAAAoE,IACA,IAAAA,GACAtH,EAAAH,QAAAiE,GAIAE,EAAA,EAAAmC,EAAAnC,IAAAA,EACAJ,EAAAW,EAAAP,IACA,SAAAJ,GAAAI,IAAAO,KAIAxD,EAAAW,SAAAkC,GAAAsD,MAAAlH,EAAAqH,EAAAvH,EAAAE,EAAAyH,OAGA,OAAArG,GAoCA,QAAA8C,GAAAK,EAAAhF,GACA,MAAAwB,GAAA2G,UAAAnI,EAAAgF,GAYA,QAAAoD,GAAApD,EAAAqD,GACA,GAAAC,GAAA1H,EAAAD,KAAAqE,EACA,OAAAxD,GAAA2G,UAAAE,EAAAC,GAAA5G,KAAA,SAAA6G,GACA,MAAAC,GAAAF,EAAAC,KAIA,QAAAC,GAAAxD,EAAAuD,GAIA,IAAA,GAFA3B,GAAA2B,EAAAxH,OACA0H,EAAA,GAAAnG,OAAAsE,GACAnC,EAAA,EAAAiE,EAAA,EAAA9B,EAAAnC,IAAAA,EACA8D,EAAA9D,KACAgE,EAAAC,KAAAlH,EAAAW,SAAA6C,EAAAP,IAAAzB,MAIA,OADAyF,GAAA1H,OAAA2H,EACAD,EAWA,QAAA1D,GAAAC,GACA,MAAAvD,GAAAuD,EAAAL,IAAAgE,IAGA,QAAAA,GAAA9G,GACA,GAAA1B,GAAAqB,EAAAW,SAAAN,EACA,OAAA,KAAA1B,EAAA+G,QACArC,EAAAhD,GAAAH,KAAAwF,EAAA0B,UAAA1B,EAAA2B,WAGA1I,EAAA2I,YACA5B,EAAA6B,QAAA5I,IAaA,QAAAkD,GAAA2B,EAAAhF,GACA,MAAAa,WAAAE,OAAA,EAAAiI,EAAArI,KAAAqE,EAAAiE,EAAAjJ,GAAAa,UAAA,IACAmI,EAAArI,KAAAqE,EAAAiE,EAAAjJ,IAaA,QAAAkJ,GAAAlE,EAAAhF,GACA,MAAAa,WAAAE,OAAA,EAAAoI,EAAAxI,KAAAqE,EAAAiE,EAAAjJ,GAAAa,UAAA,IACAsI,EAAAxI,KAAAqE,EAAAiE,EAAAjJ,IAGA,QAAAiJ,GAAAjJ,GACA,MAAA,UAAAoJ,EAAA/E,EAAAI,GACA,MAAA4E,GAAArJ,EAAA,QAAAoJ,EAAA/E,EAAAI,KA9QA,GAAA4E,GAAAlC,EAAA3F,GACAqD,EAAArD,EAAAlB,QACAmB,EAAAD,EAAAC,IAEAuH,EAAA1G,MAAAC,UAAAc,OACA8F,EAAA7G,MAAAC,UAAA2G,YACAtI,EAAA0B,MAAAC,UAAA3B,KAyBA,OArBAY,GAAA4F,IAAAA,EACA5F,EAAAqG,KAAAA,EACArG,EAAAuD,OAAAA,EAEAvD,EAAAmD,IAAAA,EACAnD,EAAA4G,OAAAA,EACA5G,EAAA6B,OAAAA,EACA7B,EAAA0H,YAAAA,EAQA1H,EAAAe,UAAA+G,OAAA,SAAAC,GACA,MAAAzJ,MAAA4B,KAAAD,GAAAC,KAAA,SAAA8H,GACA,MAAAD,GAAA7J,MAAAI,KAAA0J,MAIAhI,MAqPA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,0DC5RA,SAAAc,GAAA,YACAA,GAAA,WAoIA,QAAAgK,KACA,KAAA,IAAAC,WAAA,sCAGA,QAAAC,GAAAjJ,EAAA2H,GACA,MAAAuB,GAAAvB,GAAA3H,YAAA2H,GAAAA,EAAA3H,GAGA,QAAAkJ,GAAAvB,GACA,MAAAA,KAAA9B,OACA,MAAA8B,GAAAA,EAAA9F,oBAAAgE,OAGA,QAAAsD,GAAAxF,GACA,OAAA,gBAAAA,IAAA,kBAAAA,KAAA,OAAAA,EAGA,QAAAyF,GAAAzF,GACA,MAAAA,GApJA,MAAA,UAAA7C,GA8CA,QAAAuI,GAAA/C,EAAAqB,GACA,MAAA,UAAA3H,GACA,MAAAiJ,GAAAjJ,EAAA2H,GACArB,EAAArG,KAAAb,KAAAY,GACAH,EAAAG,IA0BA,QAAAsJ,GAAAhD,EAAA/G,EAAAgK,EAAAjH,GACA,GAAAkH,GAAAlD,EAAArG,KAAAV,EACA,OAAA4J,GAAAK,GACAC,EAAAD,EAAAD,EAAAjH,GACAiH,EAAAjH,GAGA,QAAAmH,GAAAD,EAAAD,EAAA5F,GACA,MAAA/D,GAAA4J,GAAAxI,KAAA,WACA,MAAAuI,GAAA5F,KAnFA,GAAA/D,GAAAkB,EAAAlB,QACAC,EAAAiB,EAAAjB,OACA6J,EAAA5I,EAAAe,UAAA,QA2HA,OAhHAf,GAAAe,UAAA8H,KAAA,SAAAC,EAAAC,GACAzK,KAAAqC,SAAAwF,MAAA7H,KAAAqC,SAAAqI,SAAAF,EAAAC,IAWA/I,EAAAe,UAAA,SAAAf,EAAAe,UAAAkI,UAAA,SAAAC,GACA,MAAA7J,WAAAE,OAAA,EACAqJ,EAAAzJ,KAAAb,KAAA4K,GAGA,kBAAAA,GACA5K,KAAA6K,OAAAlB,GAGAW,EAAAzJ,KAAAb,KAAAiK,EAAAlJ,UAAA,GAAA6J,KA4BAlJ,EAAAe,UAAA,WAAAf,EAAAe,UAAAoI,OAAA,SAAA3D,GACA,MAAA,kBAAAA,GACAlH,KAGAA,KAAA4B,KAAA,SAAA2C,GACA,MAAA2F,GAAAhD,EAAAlH,KAAAgK,EAAAzF,IACA,SAAA3D,GACA,MAAAsJ,GAAAhD,EAAAlH,KAAAS,EAAAG,MAyBAc,EAAAe,UAAA,QAAAf,EAAAe,UAAAqI,OAAA,SAAAC,GACA,MAAA/K,MAAA4B,KAAA,OAAA,WACA,MAAAmJ,MAYArJ,EAAAe,UAAA,SAAA,SAAAS,GACA,MAAAlD,MAAA4B,KAAA,WACA,MAAAsB,MAUAxB,EAAAe,UAAAuI,IAAA,SAAAC,GACA,MAAAjL,MAAA4B,KAAAqJ,GAAA,SAAAjL,OAGA0B,MAyBA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCC1JA,SAAAjD,GAAA,YACAA,GAAA,WAEA,MAAA,UAAA+B,GAcA,MAZAA,GAAAe,UAAAmC,KAAA,SAAA1E,EAAAoJ,GACA,GAAAtG,GAAAhD,KAAAkL,QAQA,OANAlL,MAAAqC,SAAAuC,KAAA,SAAA0E,EAAA/E,EAAA4G,GACAzJ,EAAAW,SAAAiH,GAAA1E,KAAA,SAAAL,EAAA+E,EAAA6B,GACAA,EAAA3K,QAAAN,EAAAW,KAAAb,KAAAsJ,EAAA/E,KACAA,EAAAvE,KAAAmL,IACA7B,EAAAtG,EAAAX,SAAAqI,SAAA1H,EAAAX,UAEAW,GAGAtB,MAIA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCCtBA,SAAAjD,GAAA,YACAA,GAAA,SAAAd,GAEA,GAAAoK,GAAApK,EAAA,YAAAoK,OAEA,OAAA,UAAAvH,GAMA,MAJAA,GAAAe,UAAAwG,QAAA,WACA,MAAAA,GAAAvH,EAAAW,SAAArC,QAGA0B,MAIA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,4CCfA,SAAAc,GAAA,YACAA,GAAA,WAEA,MAAA,UAAA+B,GAqBA,QAAA0J,GAAAlL,EAAAwD,EAAAwD,EAAA3C,GACA,MAAA8G,GAAA,SAAA9G,GACA,OAAAA,EAAArE,EAAAqE,KACAb,EAAAwD,EAAA3C,GAiBA,QAAA8G,GAAAC,EAAA5H,EAAAwD,EAAA3C,GAOA,QAAAgH,GAAAC,EAAAC,GACA,MAAAjL,GAAA0G,EAAAsE,IAAA5J,KAAA,WACA,MAAAyJ,GAAAC,EAAA5H,EAAAwD,EAAAuE,KARA,MAAAjL,GAAA+D,GAAA3C,KAAA,SAAA8J,GACA,MAAAlL,GAAAkD,EAAAgI,IAAA9J,KAAA,SAAA2I,GACA,MAAAA,GAAAmB,EAAAlL,EAAA8K,EAAAI,IAAAlC,OAAA+B,OA1CA,GAAA/K,GAAAkB,EAAAlB,OAKA,OAHAkB,GAAA0J,QAAAA,EACA1J,EAAA2J,OAAAA,EAEA3J,MAkDA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCC5DA,SAAAjD,GAAA,YACAA,GAAA,WAEA,MAAA,UAAA+B,GAYA,MAJAA,GAAAe,UAAAkJ,SAAA,SAAAC,GACA,MAAA5L,MAAA4B,KAAA,OAAA,OAAAgK,IAGAlK,MAIA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCCnBA,SAAAjD,GAAA,YACAA,GAAA,SAAAd,GAKA,QAAAgN,GAAA3L,EAAA4L,EAAAvH,EAAAwH,GACA,MAAAC,GAAAC,SAAA,WACA/L,EAAAqE,EAAAwH,EAAAD,IACAA,GANA,GAAAE,GAAAnN,EAAA,UACA0H,EAAA1H,EAAA,kBAQA,OAAA,UAAA6C,GAaA,QAAAwK,GAAAJ,EAAAvH,EAAAlE,GACAwL,EAAAM,EAAAL,EAAAvH,EAAAlE,GAGA,QAAA8L,GAAA5H,EAAAlE,GACAA,EAAAG,QAAA+D,GAgCA,QAAA6H,GAAAC,EAAAhM,EAAAyL,GACA,GAAAlL,GAAA,mBAAAyL,GACA,GAAA9F,GAAA,mBAAAuF,EAAA,MACAO,CACAhM,GAAAI,OAAAG,GAGA,MAlDAc,GAAAe,UAAAzD,MAAA,SAAA8M,GACA,GAAA/J,GAAA/B,KAAAkL,QAEA,OADAlL,MAAAqC,SAAAuC,KAAAsH,EAAAJ,EAAA,OAAA/J,EAAAM,UACAN,GAoBAL,EAAAe,UAAA/C,QAAA,SAAAoM,EAAAO,GACA,GAAAtK,GAAA/B,KAAAkL,SACA7K,EAAA0B,EAAAM,SAEAiK,EAAAT,EAAAO,EAAAN,EAAAO,EAAAtK,EAAAM,SAaA,OAXArC,MAAAqC,SAAAwF,MAAAxH,EACA,SAAAkE,GACAyH,EAAAO,WAAAD,GACAtM,KAAAQ,QAAA+D,IAEA,SAAAA,GACAyH,EAAAO,WAAAD,GACAtM,KAAAS,OAAA8D,IAEAlE,EAAA+H,QAEArG,GAUAL,MAIA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,+DCzEA,SAAAc,GAAA,YACAA,GAAA,SAAAd,GAyEA,QAAA2N,GAAA5L,GACA,KAAAA,GAGA,QAAA6L,MA3EA,GAAAR,GAAApN,EAAA,UAAAoN,SACAS,EAAA7N,EAAA,YAEA,OAAA,UAAA6C,GAoCA,QAAAiL,GAAAC,GACAA,EAAAC,UACAC,EAAAxM,KAAAsM,GACAG,EAAA,oCAAAH,EAAAI,GAAA,KAAAN,EAAAO,YAAAL,EAAA1J,SAIA,QAAAgK,GAAAN,GACA,GAAAjI,GAAAmI,EAAAK,QAAAP,EACAjI,IAAA,IACAmI,EAAAvK,OAAAoC,EAAA,GACAyI,EAAA,+BAAAR,EAAAI,GAAA,KAAAN,EAAAW,aAAAT,EAAA1J,SAIA,QAAAiD,GAAAjG,EAAAqE,GACA+I,EAAAhN,KAAAJ,EAAAqE,GACA,OAAAgJ,IACAA,EAAAtB,EAAAuB,EAAA,IAIA,QAAAA,KAEA,IADAD,EAAA,KACAD,EAAArM,OAAA,GACAqM,EAAAnJ,QAAAmJ,EAAAnJ,SA3DA,GAEAsJ,GAFAV,EAAAN,EACAW,EAAAX,CAGA,oBAAAiB,WAIAD,EAAAC,QACAX,EAAA,mBAAAU,GAAAE,MACA,SAAA/M,GAAA6M,EAAAE,MAAA/M,IACA,SAAAA,GAAA6M,EAAAG,IAAAhN,IAEAwM,EAAA,mBAAAK,GAAAI,KACA,SAAAjN,GAAA6M,EAAAI,KAAAjN,IACA,SAAAA,GAAA6M,EAAAG,IAAAhN,KAGAc,EAAAoM,gCAAA,SAAAC,GACA5H,EAAAwG,EAAAoB,IAGArM,EAAAsM,uCAAA,SAAAD,GACA5H,EAAA+G,EAAAa,IAGArM,EAAAuM,iBAAA,SAAAF,GACA5H,EAAAqG,EAAAuB,EAAA7K,OAGA,IAAAoK,MACAR,KACAS,EAAA,IA+BA,OAAA7L,OAUA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,yDCjFA,SAAAc,GAAA,YACAA,GAAA,WAEA,MAAA,UAAA+B,GAyBA,MARAA,GAAAe,UAAA,QAAAf,EAAAe,UAAAkB,SAAA,SAAA+G,GACA,GAAA3I,GAAA/B,KAAAkL,SACAgD,EAAAnM,EAAAM,QAGA,OAFA6L,GAAAxD,SAAAA,EACA1K,KAAAqC,SAAA8L,MAAAD,EAAAxD,GACA3I,GAGAL,MAIA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCC/BA,SAAAjD,GAAA,YACAA,GAAA,SAAAd,GAqCA,QAAAuP,KACA,MAAA,mBAAAC,UACA,qBAAA3J,OAAAjC,UAAA6L,SAAAzN,KAAAwN,SAGA,QAAAE,KACA,MAAA,kBAAAC,mBAAAA,kBACA,kBAAAC,yBAAAA,uBAGA,QAAAC,GAAAF,GAMA,QAAAnI,KACA,GAAAnG,GAAAyO,CACAA,GAAA,OACAzO,IARA,GAAAyO,GACAtP,EAAAuP,SAAAC,eAAA,IACA7J,EAAA,GAAAwJ,GAAAnI,EACArB,GAAA8J,QAAAzP,GAAA0P,eAAA,GAQA,IAAApK,GAAA,CACA,OAAA,UAAAzE,GACAyO,EAAAzO,EACAb,EAAA2P,KAAArK,GAAA,GAtDA,GAAAsK,GACAC,EAAA,mBAAArD,aAAAA,WAGAI,EAAA,SAAA/L,EAAA4L,GAAA,MAAAD,YAAA3L,EAAA4L,IACAS,EAAA,SAAAD,GAAA,MAAA6C,cAAA7C,IACA9G,EAAA,SAAAtF,GAAA,MAAAgP,GAAAhP,EAAA,GAGA,IAAAkO,IACA5I,EAAA,SAAAtF,GAAA,MAAAmO,SAAAe,SAAAlP,QAEA,IAAA+O,EAAAV,IACA/I,EAAAkJ,EAAAO,OAEA,KAAAC,EAAA,CACA,GAAAG,GAAAxQ,EACAyQ,EAAAD,EAAA,QACApD,GAAA,SAAA/L,EAAA4L,GAAA,MAAAwD,GAAArD,SAAAH,EAAA5L,IACAqM,EAAA+C,EAAAC,YACA/J,EAAA8J,EAAAE,WAAAF,EAAAG,aAGA,OACAxD,SAAAA,EACAM,WAAAA,EACA/G,KAAAA,MAgCA,kBAAA7F,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,+BCpEA,SAAAc,GAAA,YACAA,GAAA,WAeA,QAAAsN,GAAArM,GACA,GAAA8O,GAAA,gBAAA9O,IAAA,OAAAA,IAAAA,EAAA+O,OAAA/O,EAAA4F,SAAA5F,EAAA+O,OAAA/O,EAAA4F,QAAA6G,EAAAzM,EACA,OAAAA,aAAA6F,OAAAiJ,EAAAA,EAAA,6BASA,QAAArC,GAAArI,GACA,GAAA0K,GAAAE,OAAA5K,EAIA,OAHA,oBAAA0K,GAAA,mBAAAG,QACAH,EAAAI,EAAA9K,EAAA0K,IAEAA,EAUA,QAAAI,GAAAvL,EAAAwG,GACA,IACA,MAAA8E,MAAAE,UAAAxL,GACA,MAAA3D,GACA,MAAAmK,IA3CA,OACAkC,YAAAA,EACAI,aAAAA,EACAyC,aAAAA,MA6CA,kBAAAnQ,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCCnDA,SAAAjD,GAAA,YACAA,GAAA,WAaA,QAAAqQ,GAAAhL,EAAA9E,EAAAoE,GAEA,MADAU,GAAAV,GAAApE,EACA8E,EAGA,QAAAiL,GAAA7O,GACA,MAAA,kBAAAA,GAAAA,EAAA8O,OAAAxL,OAAAkC,OAAAxF,GAjBA,MAAA,UAAA+O,EAAA9O,EAAAC,EAAAF,GAKA,MAJA,mBAAAC,KACAA,EAAA2O,GAGAtL,OAAAvF,KAAAiC,GAAAmC,OAAA,SAAAjC,EAAA8O,GACA,GAAAlQ,GAAAkB,EAAAgP,EACA,OAAA,kBAAAlQ,GAAAmB,EAAAC,EAAA6O,EAAAjQ,GAAAkQ,GAAA9O,GACA,mBAAAA,GAAA2O,EAAA7O,GAAAE,OAYA,kBAAA3B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCCvBA,SAAAjD,GAAA,YACAA,GAAA,WAEA,MAAA,UAAA0Q,GAkBA,QAAA3O,GAAAf,EAAAuG,GACAlH,KAAAqC,SAAA1B,IAAA2P,EAAApJ,EAAAqJ,EAAA5P,GAQA,QAAA4P,GAAA5P,GAgBA,QAAA6P,GAAAjM,GACA2C,EAAA1G,QAAA+D,GAOA,QAAAkM,GAAApE,GACAnF,EAAAzG,OAAA4L,GAQA,QAAAqE,GAAAnM,GACA2C,EAAAkB,OAAA7D,GAjCA,GAAA2C,GAAA,GAAAyJ,EAEA,KACAhQ,EAAA6P,EAAAC,EAAAC,GACA,MAAA9P,GACA6P,EAAA7P,GAGA,MAAAsG,GA4CA,QAAA1G,GAAA+D,GACA,MAAAqM,GAAArM,GAAAA,EACA,GAAA7C,GAAA4O,EAAA,GAAAO,GAAAC,EAAAvM,KAQA,QAAA9D,GAAA8D,GACA,MAAA,IAAA7C,GAAA4O,EAAA,GAAAO,GAAA,GAAAE,GAAAxM,KAOA,QAAAyM,KACA,MAAAC,GAQA,QAAAC,KACA,MAAA,IAAAxP,GAAA4O,EAAA,GAAAK,IAoDA,QAAAQ,GAAAC,EAAA1P,GACA,GAAAwM,GAAA,GAAAyC,GAAAS,EAAA1G,SAAA0G,EAAAC,OAAAC,QACA,OAAA,IAAA5P,GAAA4O,EAAApC,GAgBA,QAAAvM,GAAAuD,GACA,MAAAqM,GAAAC,EAAA,KAAAtM,GAUA,QAAAuM,GAAAvR,EAAAgF,GACA,MAAAqM,GAAAG,EAAAxR,EAAAgF,GAGA,QAAAqM,GAAAI,EAAAzR,EAAAgF,GAwBA,QAAA0M,GAAAjN,EAAAJ,EAAA5D,GACAA,EAAA+G,UACAmK,EAAA3M,EAAA4M,EAAAnN,EAAAgN,EAAAzR,EAAAqE,EAAAI,GAAAhE,GAIA,QAAAmR,GAAAnN,EAAAJ,EAAA5D,GACA8D,EAAAE,GAAAJ,EACA,MAAAC,GACA7D,EAAAgH,OAAA,GAAAoK,GAAAtN,IA1BA,IAAA,GAAAF,GANA2C,EAAA,kBAAAhH,GAAA0R,EAAAE,EAEAnR,EAAA,GAAAgQ,GACAnM,EAAAU,EAAAjE,SAAA,EACAwD,EAAA,GAAAjC,OAAAgC,GAEAG,EAAA,EAAAA,EAAAO,EAAAjE,SAAAN,EAAA+G,WAAA/C,EACAJ,EAAAW,EAAAP,GAEA,SAAAJ,GAAAI,IAAAO,GAKA2M,EAAA3M,EAAAgC,EAAAvC,EAAAJ,EAAA5D,KAJA6D,CAWA,OAJA,KAAAA,GACA7D,EAAAgH,OAAA,GAAAoK,GAAAtN,IAGA,GAAA/C,GAAA4O,EAAA3P,GAgBA,QAAAkR,GAAA3M,EAAAgC,EAAAvC,EAAAJ,EAAA5D,GACA,GAAAoJ,EAAAxF,GAAA,CACA,GAAAlE,GAAA2R,EAAAzN,GACAmL,EAAArP,EAAA+G,OAEA,KAAAsI,EACArP,EAAAuE,KAAAsC,EAAAvC,EAAA,OAAAhE,GACA+O,EAAA,EACAxI,EAAAvC,EAAAtE,EAAA6C,MAAAvC,IAEAA,EAAAgH,OAAAtH,GACA4R,EAAA/M,EAAAP,EAAA,EAAAtE,QAGA6G,GAAAvC,EAAAJ,EAAA5D,GAKA,QAAAsR,GAAA/M,EAAAgN,EAAAhL,GACA,IAAA,GAAAvC,GAAAuN,EAAAvN,EAAAO,EAAAjE,SAAA0D,EACAwN,EAAArB,EAAA5L,EAAAP,IAAAuC,GAIA,QAAAiL,GAAA9R,EAAA6G,GACA,GAAA7G,IAAA6G,EAAA,CAIA,GAAAwI,GAAArP,EAAA+G,OACA,KAAAsI,EACArP,EAAAwH,MAAAxH,EAAA,OAAAA,EAAA2I,WACA,EAAA0G,GACArP,EAAA2I,aAkBA,QAAAoJ,GAAAlN,GACA,MAAA,gBAAAA,IAAA,OAAAA,EACAzE,EAAA,GAAAmJ,WAAA,kCAKA,IAAA1E,EAAAjE,OAAA+P,IACA,IAAA9L,EAAAjE,OAAAT,EAAA0E,EAAA,IACAmN,EAAAnN,GAGA,QAAAmN,GAAAnN,GACA,GACAP,GAAAJ,EAAAlE,EADAM,EAAA,GAAAgQ,EAEA,KAAAhM,EAAA,EAAAA,EAAAO,EAAAjE,SAAA0D,EAEA,GADAJ,EAAAW,EAAAP,GACA,SAAAJ,GAAAI,IAAAO,GAAA,CAKA,GADA7E,EAAAyQ,EAAAvM,GACA,IAAAlE,EAAA+G,QAAA,CACAzG,EAAAgH,OAAAtH,GACA4R,EAAA/M,EAAAP,EAAA,EAAAtE,EACA,OAEAA,EAAAwH,MAAAlH,EAAAA,EAAAH,QAAAG,EAAAF,QAGA,MAAA,IAAAiB,GAAA4O,EAAA3P,GAWA,QAAAmQ,GAAAvM,GACA,MAAAqM,GAAArM,GACAA,EAAAlC,SAAAgP,OAEAtH,EAAAxF,GAAA+N,EAAA/N,GAAA,GAAAwN,GAAAxN,GASA,QAAAyN,GAAAzN,GACA,MAAAqM,GAAArM,GAAAA,EAAAlC,SAAAgP,OAAAiB,EAAA/N,GAQA,QAAA+N,GAAA/N,GACA,IACA,GAAAgO,GAAAhO,EAAA3C,IACA,OAAA,kBAAA2Q,GACA,GAAAC,GAAAD,EAAAhO,GACA,GAAAwN,GAAAxN,GACA,MAAA3D,GACA,MAAA,IAAAmQ,GAAAnQ,IAQA,QAAA0P,MAmDA,QAAAmC,MAcA,QAAA9B,GAAAjG,EAAAgI,GACAhR,EAAAiR,cAAA3S,KAAA0S,GAEA1S,KAAA4S,UAAA,OACA5S,KAAA0K,SAAAA,EACA1K,KAAAkH,QAAA,OACAlH,KAAA0H,UAAA,EAsGA,QAAAmJ,GAAA3J,GACAlH,KAAAkH,QAAAA,EAuBA,QAAAsL,GAAA5Q,EAAAiR,GACAlC,EAAA9P,KAAAb,MACAsN,EAAAnH,QAAA,GAAA2M,GAAAlR,EAAAiR,EAAA7S,OAUA,QAAA+R,GAAAxN,GACA7C,EAAAiR,cAAA3S,MACAA,KAAAkD,MAAAqB,EAsBA,QAAAwM,GAAAxM,GACA7C,EAAAiR,cAAA3S,MAEAA,KAAAgN,KAAA+F,EACA/S,KAAAkD,MAAAqB,EACAvE,KAAA6M,SAAA,EACA7M,KAAA8M,UAAA,EAEA9M,KAAAgT,UAoCA,QAAAC,GAAAlF,EAAAuD,GACAtR,KAAA+N,UAAAA,EACA/N,KAAAsR,QAAAA,EAWA,QAAA4B,GAAAnF,GACA/N,KAAA+N,UAAAA,EA0BA,QAAAoF,KACA,MAAA,IAAApC,GAAA,GAAAnH,WAAA,kBASA,QAAAwJ,GAAAC,EAAAnM,GACAlH,KAAAqT,aAAAA,EACArT,KAAAkH,QAAAA,EAWA,QAAAoM,GAAApQ,EAAAgE,GACAlH,KAAAkH,QAAAA,EACAlH,KAAAkD,MAAAA,EAsBA,QAAA4P,GAAAlR,EAAAiR,EAAAlS,GACAX,KAAAuT,MAAA3R,EACA5B,KAAA6S,SAAAA,EACA7S,KAAAW,SAAAA,EAYA,QAAA6S,GAAA5R,EAAAiR,EAAArS,EAAAC,EAAA2H,GACA,IACAxG,EAAAf,KAAAgS,EAAArS,EAAAC,EAAA2H,GACA,MAAAxH,GACAH,EAAAG,IAQA,QAAA6S,GAAAvT,EAAAoJ,EAAArC,EAAAkE,GACAnL,KAAAE,EAAAA,EAAAF,KAAAsJ,EAAAA,EAAAtJ,KAAAiH,EAAAA,EAAAjH,KAAAmL,GAAAA,EACAnL,KAAAW,SAAA+S,EACA1T,KAAA0K,SAAA1K,KAqBA,QAAA4Q,GAAArM,GACA,MAAAA,aAAA7C,GASA,QAAAqI,GAAAxF,GACA,OAAA,gBAAAA,IAAA,kBAAAA,KAAA,OAAAA,EAGA,QAAAoP,GAAAzT,EAAAG,EAAAqK,EAAAa,GACA,MAAA,kBAAArL,GACAqL,EAAA5D,OAAAtH,IAGAqB,EAAAkS,aAAAvT,GACAwT,EAAA3T,EAAAG,EAAA6C,MAAAwH,EAAAa,OACA7J,GAAAoS,eAGA,QAAAC,GAAA7T,EAAAqE,EAAAlE,EAAAqK,EAAAa,GACA,MAAA,kBAAArL,GACAqL,EAAA5D,OAAAtH,IAGAqB,EAAAkS,aAAAvT,GACA2T,EAAA9T,EAAAqE,EAAAlE,EAAA6C,MAAAwH,EAAAa,OACA7J,GAAAoS,eAMA,QAAAG,GAAA/T,EAAAqE,EAAAlE,EAAAqK,EAAAa,GACA,MAAA,kBAAArL,GACAqL,EAAAnD,OAAA7D,IAGA7C,EAAAkS,aAAAvT,GACA6T,EAAAhU,EAAAqE,EAAAmG,EAAAa,OACA7J,GAAAoS,eAGA,QAAApC,GAAAxR,EAAAsI,EAAA2L,GACA,IACA,MAAAjU,GAAAsI,EAAA2L,GACA,MAAAvT,GACA,MAAAH,GAAAG,IAQA,QAAAiT,GAAA3T,EAAAqE,EAAApE,EAAAoL,GACA,IACAA,EAAA5D,OAAAmJ,EAAA5Q,EAAAW,KAAAV,EAAAoE,KACA,MAAA3D,GACA2K,EAAA5D,OAAA,GAAAoJ,GAAAnQ,KAOA,QAAAoT,GAAA9T,EAAAqE,EAAAwH,EAAA5L,EAAAoL,GACA,IACArL,EAAAW,KAAAV,EAAAoE,EAAAwH,EAAAR,GACA,MAAA3K,GACA2K,EAAA5D,OAAA,GAAAoJ,GAAAnQ,KAQA,QAAAsT,GAAAhU,EAAAqE,EAAApE,EAAAoL,GACA,IACAA,EAAAnD,OAAAlI,EAAAW,KAAAV,EAAAoE,IACA,MAAA3D,GACA2K,EAAAnD,OAAAxH,IAIA,QAAAwT,GAAAC,EAAAC,GACAA,EAAA7R,UAAA8R,EAAAF,EAAA5R,WACA6R,EAAA7R,UAAAoE,YAAAyN,EAGA,QAAA9C,GAAAjN,EAAAwH,GACA,MAAAA,GAGA,QAAAU,MAEA,QAAA+H,KAEA,MAAA,mBAAAnG,UAAA,OAAAA,SACA,kBAAAA,SAAAoG,KAKA,SAAAC,EAAA3G,GACA,MAAA,uBAAA2G,EACArG,QAAAoG,KAAAC,EAAA3G,EAAA7K,MAAA6K,GACAM,QAAAoG,KAAAC,EAAA3G,IAEA,mBAAA/H,OAAA,kBAAA2O,aACA,SAAAlI,EAAAzG,EAAA2O,GACA,GAAAC,IAAA,CACA,KACA,GAAAC,GAAA,GAAAF,GAAA,qBACAC,GAAAC,YAAAF,GACA,MAAA/T,IAEA,MAAAgU,GAAA,SAAAF,EAAA3G,GACA,GAAA8G,GAAA,GAAAF,GAAAD,GACAI,QACAzI,OAAA0B,EAAA7K,MACAkN,IAAArC,GAEAgH,SAAA,EACAhW,YAAA,GAGA,QAAAiH,EAAAgP,cAAAH,IAVApI,GAYAA,EAAAzG,KAAA2O,aAGAlI,EA/4BA,GAAAa,GAAA+C,EAAA5K,UACAwP,EAAAT,IAEAD,EAAA7P,OAAAkC,QACA,SAAAsO,GACA,QAAAZ,MAEA,MADAA,GAAA7R,UAAAyS,EACA,GAAAZ,GA0DA5S,GAAAlB,QAAAA,EACAkB,EAAAjB,OAAAA,EACAiB,EAAAsP,MAAAA,EAEAtP,EAAAM,OAAAkP,EACAxP,EAAAW,SAAAyO,EAmDApP,EAAAe,UAAAb,KAAA,SAAA6H,EAAAmB,EAAAgB,GACA,GAAAwF,GAAApR,KAAAqC,SACA+E,EAAAgK,EAAAC,OAAAjK,OAEA,IAAA,kBAAAqC,IAAArC,EAAA,GACA,kBAAAwD,IAAA,EAAAxD,EAEA,MAAA,IAAApH,MAAA6G,YAAAyJ,EAAAc,EAGA,IAAArP,GAAA/B,KAAAkL,SACAgD,EAAAnM,EAAAM,QAIA,OAFA+O,GAAAjD,MAAAD,EAAAkD,EAAA1G,SAAAjB,EAAAmB,EAAAgB,GAEA7J,GASAL,EAAAe,UAAA,SAAA,SAAAmI,GACA,MAAA5K,MAAA4B,KAAA,OAAAgJ,IAQAlJ,EAAAe,UAAAyI,OAAA,WACA,MAAAiG,GAAAnR,KAAAqC,SAAArC,KAAA6G,cAUAnF,EAAAC,IAAAA,EACAD,EAAA0Q,KAAAA,EACA1Q,EAAA2G,UAAAoJ,EAgFA/P,EAAAkG,gBAAAqK,EAkHA3B,EAAA7N,UAAA/D,KACA4R,EAAA7N,UAAAkF,OACA2I,EAAA7N,UAAA2F,OACAkI,EAAA7N,UAAA0S,KACA7E,EAAA7N,UAAAuG,UACAsH,EAAA7N,UAAAuQ,QACAvG,EAEA6D,EAAA7N,UAAA2S,OAAA,EAEA9E,EAAA7N,UAAA2E,MAAA,WACA,MAAApH,MAAAoV,QAQA9E,EAAA7N,UAAA4O,KAAA,WAEA,IADA,GAAAhR,GAAAL,KACA,SAAAK,EAAA6G,SACA7G,EAAAA,EAAA6G,OAEA,OAAA7G,IAGAiQ,EAAA7N,UAAA0L,MAAA,SAAAhD,EAAAT,EAAA5B,EAAAC,EAAA4C,GACA3L,KAAAtB,MACAiC,SAAAwK,EACAT,SAAAA,EACA5B,UAAAA,EACAC,SAAAA,EACA4C,SAAAA,KAIA2E,EAAA7N,UAAAoF,MAAA,SAAA6C,EAAA5B,EAAAC,EAAA4C,GACA3L,KAAAmO,MAAAuF,EAAAhJ,EAAA5B,EAAAC,EAAA4C,IAGA2E,EAAA7N,UAAAmC,KAAA,SAAA1E,EAAAoJ,EAAArC,EAAAkE,GACAnL,KAAAtB,KAAA,GAAA+U,GAAAvT,EAAAoJ,EAAArC,EAAAkE,KASAiJ,EAAA9D,EAAAmC,GAEAA,EAAAhQ,UAAAkF,OAAA,SAAAtH,GACAA,EAAA8U,OAGA,IAAAzB,GAAA,GAAAjB,EAeA2B,GAAA9D,EAAAK,GAEAA,EAAAlO,UAAA2S,OAAA,EAEAzE,EAAAlO,UAAAjC,QAAA,SAAA+D,GACAvE,KAAA2H,OAAAmJ,EAAAvM,KAGAoM,EAAAlO,UAAAhC,OAAA,SAAA8D,GACAvE,KAAA0H,UAIA1H,KAAA2H,OAAA,GAAAoJ,GAAAxM,KAGAoM,EAAAlO,UAAA4O,KAAA,WACA,IAAArR,KAAA0H,SACA,MAAA1H,KAKA,KAFA,GAAAK,GAAAL,KAEA,SAAAK,EAAA6G,SAEA,GADA7G,EAAAA,EAAA6G,QACA7G,IAAAL,KACA,MAAAA,MAAAkH,QAAAiM,GAIA,OAAA9S,IAGAsQ,EAAAlO,UAAA4D,IAAA,WACA,GAAAgP,GAAArV,KAAA4S,UACA1L,EAAAlH,KAAAkH,OACAlH,MAAAkH,QAAAlH,KAAAkH,QAAAmK,OACArR,KAAA4S,UAAA,MAEA,KAAA,GAAAjO,GAAA,EAAAA,EAAA0Q,EAAApU,SAAA0D,EACAuC,EAAAxI,KAAA2W,EAAA1Q,KAIAgM,EAAAlO,UAAAkF,OAAA,SAAAT,GACAlH,KAAA0H,WAIA1H,KAAA0H,UAAA,EACA1H,KAAAkH,QAAAA,EACA,SAAAlH,KAAA4S,WACAtF,EAAAnH,QAAAnG,MAGA,SAAAA,KAAAsR,SACApK,EAAA8L,QAAAhT,KAAAsR,WAIAX,EAAAlO,UAAA/D,KAAA,SAAA2U,GACArT,KAAA0H,SACA4F,EAAAnH,QAAA,GAAAiN,GAAAC,EAAArT,KAAAkH,UAEA,SAAAlH,KAAA4S,UACA5S,KAAA4S,WAAAS,GAEArT,KAAA4S,UAAAtS,KAAA+S,IAQA1C,EAAAlO,UAAA2F,OAAA,SAAA7D,GACAvE,KAAA0H,UACA4F,EAAAnH,QAAA,GAAAmN,GAAA/O,EAAAvE,QAIA2Q,EAAAlO,UAAA0S,KAAA,SAAA7D,GACA,GAAArK,GAAA,mBAAAqK,GAAAtR,KAAAsR,QAAAA,CACAtR,MAAA0H,UAAA1H,KAAAkH,QAAAmK,OAAA8D,KAAAlO,IAGA0J,EAAAlO,UAAAuQ,QAAA,SAAA1B,GACAtR,KAAA0H,UAAA1H,KAAAkH,QAAAmK,OAAA2B,QAAA1B,IAGAX,EAAAlO,UAAAuG,UAAA,WACAhJ,KAAA0H,UAAA1H,KAAAkH,QAAAmK,OAAArI,aAYAoL,EAAA9D,EAAAO,GAEAA,EAAApO,UAAA/D,KAAA,SAAA2U,GACA/F,EAAAnH,QAAA,GAAAiN,GAAAC,EAAArT,QAGA6Q,EAAApO,UAAAuQ,QAAA,SAAA1B,GACAtR,KAAAqR,OAAA2B,QAAA1B,IAGAT,EAAApO,UAAAuG,UAAA,WACAhJ,KAAAqR,OAAArI,aAcAoL,EAAAzD,EAAA6B,GAYA4B,EAAA9D,EAAAyB,GAEAA,EAAAtP,UAAA2S,OAAA,EAEArD,EAAAtP,UAAAmC,KAAA,SAAA1E,EAAAoJ,EAAArC,EAAAkE,GACA4I,EAAA7T,EAAAoJ,EAAAtJ,KAAAiH,EAAAkE,IAGA4G,EAAAtP,UAAA/D,KAAA,SAAA4W,GACA3B,EAAA2B,EAAAxM,UAAA9I,KAAAsV,EAAA5K,SAAA4K,EAAA3U,UAGA,IAAAoS,GAAA,CAkBAqB,GAAA9D,EAAAS,GAEAA,EAAAtO,UAAA2S,OAAA,GAEArE,EAAAtO,UAAAmC,KAAA,SAAA1E,EAAAoJ,EAAArC,EAAAkE,GACAA,EAAAxD,OAAA3H,OAGA+Q,EAAAtO,UAAA/D,KAAA,SAAA4W,GACA,kBAAAA,GAAAvM,UACA/I,KAAAgJ,YAEA2K,EAAA2B,EAAAvM,SAAA/I,KAAAsV,EAAA5K,SAAA4K,EAAA3U,WAGAoQ,EAAAtO,UAAAuQ,QAAA,SAAA1B,GACAhE,EAAAhH,WAAA,GAAA2M,GAAAjT,KAAAsR,KAGAP,EAAAtO,UAAAuG,UAAA,WACAhJ,KAAA6M,UAGA7M,KAAA6M,SAAA,EACAS,EAAAhH,WAAA,GAAA4M,GAAAlT,SAGA+Q,EAAAtO,UAAA0S,KAAA,SAAA7D,GACAtR,KAAA8M,UAAA,EACAmI,EAAA,qBAAAjV,MACA0B,EAAAuM,iBAAAjO,KAAA,SAAAsR,EAAAtR,KAAAsR,QAAAA,IAQA2B,EAAAxQ,UAAA4D,IAAA,WACArG,KAAA+N,UAAAlB,SAAA7M,KAAA+N,UAAAjB,WACA9M,KAAA+N,UAAAjB,UAAA,EACAmI,EAAA,qBAAAjV,KAAA+N,YACArM,EAAAoM,gCAAA9N,KAAA+N,UAAA/N,KAAAsR,WAQA4B,EAAAzQ,UAAA4D,IAAA,WACArG,KAAA+N,UAAAjB,WACAmI,EAAA,mBAAAjV,KAAA+N,YACArM,EAAAsM,uCAAAhO,KAAA+N,aAOArM,EAAAiR,cACAjR,EAAAkS,aACAlS,EAAAoS,YACApS,EAAAoM,gCACApM,EAAAsM,uCACAtM,EAAAuM,iBACAxB,CAIA,IAAA8I,GAAA,GAAAjF,GACAW,EAAA,GAAAvP,GAAA4O,EAAAiF,EAgPA,OA/NAnC,GAAA3Q,UAAA4D,IAAA,WACArG,KAAAkH,QAAAmK,OAAA3S,KAAAsB,KAAAqT,eAYAC,EAAA7Q,UAAA4D,IAAA,WACA,GAAAgP,GAAArV,KAAAkH,QAAA0L,SACA,IAAA,SAAAyC,EAIA,IAAA,GAAApO,GAAAtC,EAAA,EAAAA,EAAA0Q,EAAApU,SAAA0D,EACAsC,EAAAoO,EAAA1Q,GACAsP,EAAAhN,EAAA0E,SAAA3L,KAAAkD,MAAAlD,KAAAkH,QAAAD,EAAAyD,SAAAzD,EAAAtG,WAiBAmS,EAAArQ,UAAA4D,IAAA,WAIA,QAAAmP,GAAAjR,GAAAlE,EAAAG,QAAA+D,GACA,QAAAkR,GAAAlR,GAAAlE,EAAAI,OAAA8D,GACA,QAAAmR,GAAAnR,GAAAlE,EAAA+H,OAAA7D,GALA,GAAAlE,GAAAL,KAAAW,QACA6S,GAAAxT,KAAAuT,MAAAvT,KAAA6S,SAAA2C,EAAAC,EAAAC,IAyBAjC,EAAAhR,UAAAqG,UAAA,SAAAvE,GACAvE,KAAAE,EAAAW,KAAAb,KAAAiH,EAAAjH,KAAAsJ,EAAA/E,EAAAvE,KAAAmL,KAGAsI,EAAAhR,UAAAsG,SAAA,SAAAxE,GACAvE,KAAAmL,GAAA1K,OAAA8D,IAGAkP,EAAAhR,UAAAkJ,SAAA,SAAApH,GACAvE,KAAAmL,GAAA/C,OAAA7D,IAqJA7C,MAGA,kBAAA/B,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCC15BA,SAAAjD,GAAA,YACAA,GAAA,WASA,QAAAgW,KACA,OAAAvO,MAAA,WAGA,QAAAwO,GAAAhV,GACA,OAAAwG,MAAA,WAAAiF,OAAAzL,GAGA,QAAAiV,GAAAtR,GACA,OAAA6C,MAAA,YAAAlE,MAAAqB,GAGA,QAAA0E,GAAA/B,GACA,GAAAE,GAAAF,EAAAE,OACA,OAAA,KAAAA,EAAAuO,IACAvO,EAAA,EAAAyO,EAAA3O,EAAAhE,OACA0S,EAAA1O,EAAAhE,OAvBA,OACAsB,QAAAmR,EACA7M,UAAA+M,EACA9M,SAAA6M,EACA3M,QAAAA,MAuBA,kBAAAtJ,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,gCCxBA,SAAAjD,GACAA,EAAA,SAAAd,GAiDA,QAAAe,GAAAM,EAAAE,GACA,MAAAL,GAAAG,EAAAF,KAAAI,OAGA,QAAAH,GAAAC,EAAAC,EAAAC,EAAAC,GACA,GAAAyV,GAAAC,EAAA1V,EACA,KACA,OAAAD,EAAAa,QACA,IAAA,GAAAf,EAAAW,KAAAV,EAAAC,EAAA,GAAAA,EAAA,GAAA0V,EAAA,MACA,KAAA,GAAA5V,EAAAW,KAAAV,EAAAC,EAAA,GAAA0V,EAAA,MACA,KAAA,GAAA5V,EAAAW,KAAAV,EAAA2V,EAAA,MACA,SACA1V,EAAAE,KAAAwV,GACA5V,EAAAN,MAAAO,EAAAC,IAEA,MAAAQ,GACAP,EAAAI,OAAAG,IA6BA,QAAAC,GAAAX,GACA,MAAAH,GAAAG,EAAAF,KAAAc,EAAAD,KAAAE,UAAA,IAiCA,QAAAC,GAAAd,GACA,GAAA8V,GAAAjV,UAAAE,OAAA,EAAAH,EAAAD,KAAAE,UAAA,KACA,OAAA,YAEA,GAGA4D,GAHAmC,EAAAkP,EAAA/U,OACAgV,EAAAlV,UAAAE,OACAb,EAAA,GAAAoC,OAAAyT,EAAAnP,EAEA,KAAAnC,EAAA,EAAAmC,EAAAnC,IAAAA,EACAvE,EAAAuE,GAAAqR,EAAArR,EAEA,KAAAA,EAAA,EAAAsR,EAAAtR,IAAAA,EACAvE,EAAAuE,EAAAmC,GAAA/F,UAAA4D,EAEA,OAAA5E,GAAAG,EAAAF,KAAAI,IAeA,QAAAe,GAAAC,EAAAC,EAAAC,GACA,MAAAC,GAAAP,EAAAK,EAAAC,EAAAF,GA4BA,QAAA2U,GAAApV,GACA,MAAA,UAAAuV,EAAAhT,GACAgT,EACAvV,EAAAF,OAAAyV,GACAnV,UAAAE,OAAA,EACAN,EAAAH,QAAAM,EAAAD,KAAAE,UAAA,IAEAJ,EAAAH,QAAA0C,IAyBA,QAAAiT,GAAAnT,EAAAf,GASA,QAAAmU,GAAAlT,GACAmT,EAAA,KAAAnT,GAGA,QAAAmT,GAAAH,EAAAhT,GACA+I,EAAA,WACAhK,EAAAiU,EAAAhT,IACA,GATA,MANAF,GAAAtE,EAAAsE,GAEAf,GACAe,EAAApB,KAAAwU,EAAAC,GAGArT,EAmCA,QAAAsT,GAAArU,GACA,MAAA,UAAAe,GACA,MAAAmT,GAAAnT,EAAAf,IApQA,GAAAvD,GAAAG,EAAA,UACA0C,EAAA1C,EAAA,iBACAoN,EAAApN,EAAA,aAAAoN,SACAnL,EAAA0B,MAAAC,UAAA3B,MAEAf,EAAAlB,EAAA,eAAAH,EAAAgD,QAAAzB,EAEA,QACAe,KAAAA,EACAG,QAAAA,EACAvB,MAAAA,EACAiB,KAAAA,EACAkV,eAAAA,EACAI,aAAAA,EACAG,aAAAA,MA2PA,kBAAA3W,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,6FC1QA,SAAAc,GACAA,EAAA,SAAAd,GAEA,GAAAH,GAAAG,EAAA,UACA8C,EAAAjD,EAAAgD,QAAAC,IACAb,EAAA0B,MAAAC,UAAA3B,KAUA,OAAA,UAAAwM,GACA,MAAA3L,GAAAb,EAAAD,KAAAE,UAAA,IAAAa,KAAA,SAAAxB,GACA,MAAA1B,GAAAmG,IAAAyI,EAAA,SAAAlH,GACA,MAAAA,GAAAxG,MAAA,OAAAQ,WAMA,kBAAAT,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,0CCvBA,SAAAc,GACAA,EAAA,SAAAd,GAEA,GAAAH,GAAAG,EAAA,UACA8C,EAAAjD,EAAAgD,QAAAC,IACAb,EAAA0B,MAAAC,UAAA3B,KAUA,OAAA,UAAAwM,GAGA,GAAAiJ,GAAA,SAAAnW,EAAAgG,GAKA,MAJAmQ,GAAA,SAAA/S,EAAA4C,GACA,MAAAA,GAAA5C,IAGA4C,EAAAxG,MAAA,KAAAQ,GAGA,OAAAuB,GAAAb,EAAAD,KAAAE,UAAA,IAAAa,KAAA,SAAAxB,GACA,MAAA1B,GAAA6E,OAAA+J,EAAA,SAAA9J,EAAA4C,GACA,MAAAmQ,GAAA/S,EAAA4C,IACAhG,SAKA,kBAAAT,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,0CCrCA,SAAAc,GAAA,YACAA,GAAA,SAAAd,GAEA,GAAAH,GAAAG,EAAA,UACAyE,EAAA5E,EAAA,OACAK,EAAAF,EAAA,eA0CA,OAAA,UAAAuH,EAAAoQ,EAAAC,EAAAC,GAeA,QAAAC,GAAAvM,GACAvH,EAAArC,QAAA4J,GAGA,QAAAwM,GAAAxM,GACA9G,EAAAkT,GAAA5U,KAAAiV,EAAApW,GACA,SAAA2J,GACAvH,EAAAuF,OAAAgC,GAIA,QAAAyM,KACAC,GACApY,EAAA0H,IACA,SAAAgE,GACA1L,EAAA+X,EAAArM,GACA,SAAA2M,GACA,MAAAA,GAAAJ,EAAAvM,GAAAwM,EAAAxM,IAEA,WAAAwM,EAAAxM,MAGA3J,GApCA,GAAAoC,GAAAiU,EAAArW,CAmDA,OAjDAqW,IAAA,EACAjU,EAAA9D,EAAAL,EAAAwS,QAAA,WAAA4F,GAAA,IACArW,EAAAoC,EAAApC,OAEAgW,EAAAA,GAAA,WAAA,OAAA,GAEA,kBAAAD,KACAA,EAAA,SAAAA,GACA,MAAA,YAAA,MAAA9X,KAAAM,MAAAwX,KACAA,IA6BAE,EACAE,IAGAC,IAIAhU,EAAAG,QAAA0B,OAAAkC,OAAA/D,EAAAG,SACAH,EAAAG,QAAAD,OAAAF,EAAAE,OAEAF,EAAAG,YAIA,kBAAArD,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,2DCrGA,SAAAc,GACAA,EAAA,SAAAd,GAEA,GAAAH,GAAAG,EAAA,UACA8C,EAAAjD,EAAAgD,QAAAC,IACAb,EAAA0B,MAAAC,UAAA3B,KAUA,OAAA,UAAAwM,GASA,QAAA0J,GAAA5M,GAEA,MADA3F,GAAAnE,KAAA8J,GACA3F,EAVA,GAAAA,KAEA,OAAA9C,GAAAb,EAAAD,KAAAE,UAAA,IAAAa,KAAA,SAAAxB,GACA,MAAA1B,GAAA6E,OAAA+J,EAAA,SAAA7I,EAAA2B,GACA,MAAA1H,GAAA0H,EAAAxG,MAAA,OAAAQ,GAAA4W,IACAvS,SAUA,kBAAA9E,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,0CC/BA,SAAAc,GACAA,EAAA,SAAAd,GAEA,GAAAH,GAAAG,EAAA,SAKA,OAAA,UAAAoE,EAAAgU,GACA,MAAAvY,GAAAuY,GAAAvX,QAAAuD,OAGA,kBAAAtD,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D,0CChBA,SAAAc,GAAA,YACAA,GAAA,SAAAd,GAwEA,QAAAH,GAAA6F,EAAAkF,EAAAmB,EAAAgB,GACA,GAAA7J,GAAAL,EAAAlB,QAAA+D,EACA,OAAAxD,WAAAE,OAAA,EACAc,EAGAA,EAAAH,KAAA6H,EAAAmB,EAAAgB,GAQA,QAAA5I,GAAArC,GACA,MAAA,IAAAe,GAAAf,GASA,QAAAK,GAAAd,GACA,MAAA,YACA,IAAA,GAAAyE,GAAA,EAAAmC,EAAA/F,UAAAE,OAAAuH,EAAA,GAAAhG,OAAAsE,GAAAA,EAAAnC,IAAAA,EACA6D,EAAA7D,GAAA5D,UAAA4D,EAEA,OAAA/E,GAAAM,EAAAF,KAAAwI,IAUA,QAAAlF,GAAApD,GAEA,IAAA,GAAAyE,GAAA,EAAAmC,EAAA/F,UAAAE,OAAA,EAAAuH,EAAA,GAAAhG,OAAAsE,GAAAA,EAAAnC,IAAAA,EACA6D,EAAA7D,GAAA5D,UAAA4D,EAAA,EAEA,OAAA/E,GAAAM,EAAAF,KAAAwI,GAQA,QAAA0I,KACA,MAAA,IAAAgG,GAGA,QAAAA,KAGA,QAAA1W,GAAA+D,GAAAxC,EAAAM,SAAA7B,QAAA+D,GACA,QAAA9D,GAAA8D,GAAAxC,EAAAM,SAAA5B,OAAA8D,GACA,QAAA6D,GAAA7D,GAAAxC,EAAAM,SAAA+F,OAAA7D,GAJA,GAAAxC,GAAAL,EAAAM,QAMAhC,MAAAgD,QAAAjB,EACA/B,KAAAQ,QAAAA,EACAR,KAAAS,OAAAA,EACAT,KAAAoI,OAAAA,EACApI,KAAAW,UAAAH,QAAAA,EAAAC,OAAAA,EAAA2H,OAAAA,GAWA,QAAA+O,GAAA5S,GACA,MAAAA,IAAA,kBAAAA,GAAA3C,KAUA,QAAAyP,KACA,MAAA3P,GAAAC,IAAAZ,WASA,QAAAY,GAAAuD,GACA,MAAAxG,GAAAwG,EAAAxD,EAAAC,KAUA,QAAAsD,GAAAC,GACA,MAAAxG,GAAAwG,EAAAxD,EAAAuD,QAYA,QAAAJ,GAAAK,EAAAkS,GACA,MAAA1Y,GAAAwG,EAAA,SAAAA,GACA,MAAAxD,GAAAmD,IAAAK,EAAAkS,KAaA,QAAA9O,GAAApD,EAAAqD,GACA,MAAA7J,GAAAwG,EAAA,SAAAA,GACA,MAAAxD,GAAA4G,OAAApD,EAAAqD,KAlNA,GAAA8O,GAAAxY,EAAA,0BACA6K,EAAA7K,EAAA,0BACAyY,EAAAzY,EAAA,yBACA+F,EAAA/F,EAAA,yBACAoK,EAAApK,EAAA,4BACA0Y,EAAA1Y,EAAA,4BACA8M,EAAA9M,EAAA,6BACA8E,EAAA9E,EAAA,yBACA2Y,EAAA3Y,EAAA,uCACA0H,EAAA1H,EAAA,sBAEA6C,GAAAgI,EAAA4N,EAAA1S,EAAA2S,EAAA5L,EACA1C,EAAAtF,EAAA0T,EAAAG,GACAjU,OAAA,SAAA7B,EAAA+V,GACA,MAAAA,GAAA/V,IACA7C,EAAA,kBAEAe,EAAAf,EAAA,eAAA6C,EAqMA,OAjMAhD,GAAAsE,QAAAA,EACAtE,EAAA8B,QAAAkB,EAAAlB,QACA9B,EAAA+B,OAAAiB,EAAAjB,OAEA/B,EAAAsC,KAAAA,EACAtC,EAAA,OAAA4E,EACA5E,EAAA4E,QAAAA,EAEA5E,EAAA0M,QAAA1J,EAAA0J,QACA1M,EAAA2M,OAAA3J,EAAA2J,OAEA3M,EAAA2S,KAAAA,EAEA3S,EAAAiD,IAAAA,EACAjD,EAAAuG,OAAAA,EAEAvG,EAAA4I,IAAAtG,EAAAU,EAAA4F,KACA5I,EAAAqJ,KAAA/G,EAAAU,EAAAqG,MACArJ,EAAA0T,KAAApR,EAAAU,EAAA0Q,MAEA1T,EAAAmG,IAAAA,EACAnG,EAAA4J,OAAAA,EACA5J,EAAA6E,OAAAvC,EAAAU,EAAA6B,QACA7E,EAAA0K,YAAApI,EAAAU,EAAA0H,aAEA1K,EAAAyY,cAAAA,EAEAzY,EAAAgD,QAAAA,EACAhD,EAAAwS,MAAAA,EAIAxS,EAAA6H,aAAAA,EAiKA7H,KAEA,kBAAAiB,IAAAA,EAAAgD,IAAAhD,EAAA,SAAAiD,GAAAjE,EAAAC,QAAAgE,EAAA/D;A/DnOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"generated.js","sourceRoot":"https://raw.githubusercontent.com/cujojs/when/1516d791439f28cbb8f1854d16fef15e904a8a83","sourcesContent":["var when = module.exports = require('../when');\n\nwhen.callbacks = require('../callbacks');\nwhen.cancelable = require('../cancelable');\nwhen.delay = require('../delay');\nwhen.fn = require('../function');\nwhen.guard = require('../guard');\nwhen.keys = require('../keys');\nwhen.nodefn = when.node = require('../node');\nwhen.parallel = require('../parallel');\nwhen.pipeline = require('../pipeline');\nwhen.poll = require('../poll');\nwhen.sequence = require('../sequence');\nwhen.timeout = require('../timeout');\n","/** @license MIT License (c) copyright 2013-2014 original author or authors */\n\n/**\n * Collection of helper functions for interacting with 'traditional',\n * callback-taking functions using a promise interface.\n *\n * @author Renato Zannon\n * @contributor Brian Cavalier\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar Promise = when.Promise;\n\tvar _liftAll = require('./lib/liftAll');\n\tvar slice = Array.prototype.slice;\n\n\tvar makeApply = require('./lib/apply');\n\tvar _apply = makeApply(Promise, dispatch);\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tapply: apply,\n\t\tcall: call,\n\t\tpromisify: promisify\n\t};\n\n\t/**\n\t * Takes a `traditional` callback-taking function and returns a promise for its\n\t * result, accepting an optional array of arguments (that might be values or\n\t * promises). It assumes that the function takes its callback and errback as\n\t * the last two arguments. The resolution of the promise depends on whether the\n\t * function will call its callback or its errback.\n\t *\n\t * @example\n\t * var domIsLoaded = callbacks.apply($);\n\t * domIsLoaded.then(function() {\n\t *\t\tdoMyDomStuff();\n\t *\t});\n\t *\n\t * @example\n\t * function existingAjaxyFunction(url, callback, errback) {\n\t *\t\t// Complex logic you'd rather not change\n\t *\t}\n\t *\n\t * var promise = callbacks.apply(existingAjaxyFunction, [\"/movies.json\"]);\n\t *\n\t * promise.then(function(movies) {\n\t *\t\t// Work with movies\n\t *\t}, function(reason) {\n\t *\t\t// Handle error\n\t *\t});\n\t *\n\t * @param {function} asyncFunction function to be called\n\t * @param {Array} [extraAsyncArgs] array of arguments to asyncFunction\n\t * @returns {Promise} promise for the callback value of asyncFunction\n\t */\n\tfunction apply(asyncFunction, extraAsyncArgs) {\n\t\treturn _apply(asyncFunction, this, extraAsyncArgs || []);\n\t}\n\n\t/**\n\t * Apply helper that allows specifying thisArg\n\t * @private\n\t */\n\tfunction dispatch(f, thisArg, args, h) {\n\t\targs.push(alwaysUnary(h.resolve, h), alwaysUnary(h.reject, h));\n\t\ttryCatchResolve(f, thisArg, args, h);\n\t}\n\n\tfunction tryCatchResolve(f, thisArg, args, resolver) {\n\t\ttry {\n\t\t\tf.apply(thisArg, args);\n\t\t} catch(e) {\n\t\t\tresolver.reject(e);\n\t\t}\n\t}\n\n\t/**\n\t * Works as `callbacks.apply` does, with the difference that the arguments to\n\t * the function are passed individually, instead of as an array.\n\t *\n\t * @example\n\t * function sumInFiveSeconds(a, b, callback) {\n\t *\t\tsetTimeout(function() {\n\t *\t\t\tcallback(a + b);\n\t *\t\t}, 5000);\n\t *\t}\n\t *\n\t * var sumPromise = callbacks.call(sumInFiveSeconds, 5, 10);\n\t *\n\t * // Logs '15' 5 seconds later\n\t * sumPromise.then(console.log);\n\t *\n\t * @param {function} asyncFunction function to be called\n\t * @param {...*} args arguments that will be forwarded to the function\n\t * @returns {Promise} promise for the callback value of asyncFunction\n\t */\n\tfunction call(asyncFunction/*, arg1, arg2...*/) {\n\t\treturn _apply(asyncFunction, this, slice.call(arguments, 1));\n\t}\n\n\t/**\n\t * Takes a 'traditional' callback/errback-taking function and returns a function\n\t * that returns a promise instead. The resolution/rejection of the promise\n\t * depends on whether the original function will call its callback or its\n\t * errback.\n\t *\n\t * If additional arguments are passed to the `lift` call, they will be prepended\n\t * on the calls to the original function, much like `Function.prototype.bind`.\n\t *\n\t * The resulting function is also \"promise-aware\", in the sense that, if given\n\t * promises as arguments, it will wait for their resolution before executing.\n\t *\n\t * @example\n\t * function traditionalAjax(method, url, callback, errback) {\n\t *\t\tvar xhr = new XMLHttpRequest();\n\t *\t\txhr.open(method, url);\n\t *\n\t *\t\txhr.onload = callback;\n\t *\t\txhr.onerror = errback;\n\t *\n\t *\t\txhr.send();\n\t *\t}\n\t *\n\t * var promiseAjax = callbacks.lift(traditionalAjax);\n\t * promiseAjax(\"GET\", \"/movies.json\").then(console.log, console.error);\n\t *\n\t * var promiseAjaxGet = callbacks.lift(traditionalAjax, \"GET\");\n\t * promiseAjaxGet(\"/movies.json\").then(console.log, console.error);\n\t *\n\t * @param {Function} f traditional async function to be decorated\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f/*, args...*/) {\n\t\tvar args = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * `promisify` is a version of `lift` that allows fine-grained control over the\n\t * arguments that passed to the underlying function. It is intended to handle\n\t * functions that don't follow the common callback and errback positions.\n\t *\n\t * The control is done by passing an object whose 'callback' and/or 'errback'\n\t * keys, whose values are the corresponding 0-based indexes of the arguments on\n\t * the function. Negative values are interpreted as being relative to the end\n\t * of the arguments array.\n\t *\n\t * If arguments are given on the call to the 'promisified' function, they are\n\t * intermingled with the callback and errback. If a promise is given among them,\n\t * the execution of the function will only occur after its resolution.\n\t *\n\t * @example\n\t * var delay = callbacks.promisify(setTimeout, {\n\t *\t\tcallback: 0\n\t *\t});\n\t *\n\t * delay(100).then(function() {\n\t *\t\tconsole.log(\"This happens 100ms afterwards\");\n\t *\t});\n\t *\n\t * @example\n\t * function callbackAsLast(errback, followsStandards, callback) {\n\t *\t\tif(followsStandards) {\n\t *\t\t\tcallback(\"well done!\");\n\t *\t\t} else {\n\t *\t\t\terrback(\"some programmers just want to watch the world burn\");\n\t *\t\t}\n\t *\t}\n\t *\n\t * var promisified = callbacks.promisify(callbackAsLast, {\n\t *\t\tcallback: -1,\n\t *\t\terrback: 0,\n\t *\t});\n\t *\n\t * promisified(true).then(console.log, console.error);\n\t * promisified(false).then(console.log, console.error);\n\t *\n\t * @param {Function} asyncFunction traditional function to be decorated\n\t * @param {object} positions\n\t * @param {number} [positions.callback] index at which asyncFunction expects to\n\t * receive a success callback\n\t * @param {number} [positions.errback] index at which asyncFunction expects to\n\t * receive an error callback\n\t * @returns {function} promisified function that accepts\n\t *\n\t * @deprecated\n\t */\n\tfunction promisify(asyncFunction, positions) {\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\treturn Promise.all(arguments).then(function(args) {\n\t\t\t\tvar p = Promise._defer();\n\n\t\t\t\tvar callbackPos, errbackPos;\n\n\t\t\t\tif(typeof positions.callback === 'number') {\n\t\t\t\t\tcallbackPos = normalizePosition(args, positions.callback);\n\t\t\t\t}\n\n\t\t\t\tif(typeof positions.errback === 'number') {\n\t\t\t\t\terrbackPos = normalizePosition(args, positions.errback);\n\t\t\t\t}\n\n\t\t\t\tif(errbackPos < callbackPos) {\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t} else {\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t}\n\n\t\t\t\tasyncFunction.apply(thisArg, args);\n\n\t\t\t\treturn p;\n\t\t\t});\n\t\t};\n\t}\n\n\tfunction normalizePosition(args, pos) {\n\t\treturn pos < 0 ? (args.length + pos + 2) : pos;\n\t}\n\n\tfunction insertCallback(args, pos, callback, thisArg) {\n\t\tif(typeof pos === 'number') {\n\t\t\targs.splice(pos, 0, alwaysUnary(callback, thisArg));\n\t\t}\n\t}\n\n\tfunction alwaysUnary(fn, thisArg) {\n\t\treturn function() {\n\t\t\tif (arguments.length > 1) {\n\t\t\t\tfn.call(thisArg, slice.call(arguments));\n\t\t\t} else {\n\t\t\t\tfn.apply(thisArg, arguments);\n\t\t\t}\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright B Cavalier & J Hann */\n\n/**\n * cancelable.js\n * @deprecated\n *\n * Decorator that makes a deferred \"cancelable\". It adds a cancel() method that\n * will call a special cancel handler function and then reject the deferred. The\n * cancel handler can be used to do resource cleanup, or anything else that should\n * be done before any other rejection handlers are executed.\n *\n * Usage:\n *\n * var cancelableDeferred = cancelable(when.defer(), myCancelHandler);\n *\n * @author brian@hovercraftstudios.com\n */\n\n(function(define) {\ndefine(function() {\n\n /**\n * Makes deferred cancelable, adding a cancel() method.\n\t * @deprecated\n *\n * @param deferred {Deferred} the {@link Deferred} to make cancelable\n * @param canceler {Function} cancel handler function to execute when this deferred\n\t * is canceled. This is guaranteed to run before all other rejection handlers.\n\t * The canceler will NOT be executed if the deferred is rejected in the standard\n\t * way, i.e. deferred.reject(). It ONLY executes if the deferred is canceled,\n\t * i.e. deferred.cancel()\n *\n * @returns deferred, with an added cancel() method.\n */\n return function(deferred, canceler) {\n // Add a cancel method to the deferred to reject the delegate\n // with the special canceled indicator.\n deferred.cancel = function() {\n\t\t\ttry {\n\t\t\t\tdeferred.reject(canceler(deferred));\n\t\t\t} catch(e) {\n\t\t\t\tdeferred.reject(e);\n\t\t\t}\n\n\t\t\treturn deferred.promise;\n };\n\n return deferred;\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * delay.js\n *\n * Helper that returns a promise that resolves after a delay.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(value).delay(ms)\n */\n return function delay(msec, value) {\n\t\treturn when(value).delay(msec);\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2013-2014 original author or authors */\n\n/**\n * Collection of helper functions for wrapping and executing 'traditional'\n * synchronous functions in a promise interface.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar _liftAll = require('./lib/liftAll');\n\tvar _apply = require('./lib/apply')(when.Promise);\n\tvar slice = Array.prototype.slice;\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tcall: attempt,\n\t\tapply: apply,\n\t\tcompose: compose\n\t};\n\n\t/**\n\t * Takes a function and an optional array of arguments (that might be promises),\n\t * and calls the function. The return value is a promise whose resolution\n\t * depends on the value returned by the function.\n\t * @param {function} f function to be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the return value of func\n\t */\n\tfunction apply(f, args) {\n\t\t// slice args just in case the caller passed an Arguments instance\n\t\treturn _apply(f, this, args == null ? [] : slice.call(args));\n\t}\n\n\t/**\n\t * Takes a 'regular' function and returns a version of that function that\n\t * returns a promise instead of a plain value, and handles thrown errors by\n\t * returning a rejected promise. Also accepts a list of arguments to be\n\t * prepended to the new function, as does Function.prototype.bind.\n\t *\n\t * The resulting function is promise-aware, in the sense that it accepts\n\t * promise arguments, and waits for their resolution.\n\t * @param {Function} f function to be bound\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * Composes multiple functions by piping their return values. It is\n\t * transparent to whether the functions return 'regular' values or promises:\n\t * the piped argument is always a resolved value. If one of the functions\n\t * throws or returns a rejected promise, the composed promise will be also\n\t * rejected.\n\t *\n\t * The arguments (or promises to arguments) given to the returned function (if\n\t * any), are passed directly to the first function on the 'pipeline'.\n\t * @param {Function} f the function to which the arguments will be passed\n\t * @param {...Function} [funcs] functions that will be composed, in order\n\t * @returns {Function} a promise-returning composition of the functions\n\t */\n\tfunction compose(f /*, funcs... */) {\n\t\tvar funcs = slice.call(arguments, 1);\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\tvar args = slice.call(arguments);\n\t\t\tvar firstPromise = attempt.apply(thisArg, [f].concat(args));\n\n\t\t\treturn when.reduce(funcs, function(arg, func) {\n\t\t\t\treturn func.call(thisArg, arg);\n\t\t\t}, firstPromise);\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Generalized promise concurrency guard\n * Adapted from original concept by Sakari Jokinen (Rocket Pack, Ltd.)\n *\n * @author Brian Cavalier\n * @author John Hann\n * @contributor Sakari Jokinen\n */\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar slice = Array.prototype.slice;\n\n\tguard.n = n;\n\n\treturn guard;\n\n\t/**\n\t * Creates a guarded version of f that can only be entered when the supplied\n\t * condition allows.\n\t * @param {function} condition represents a critical section that may only\n\t * be entered when allowed by the condition\n\t * @param {function} f function to guard\n\t * @returns {function} guarded version of f\n\t */\n\tfunction guard(condition, f) {\n\t\treturn function() {\n\t\t\tvar args = slice.call(arguments);\n\n\t\t\treturn when(condition()).withThis(this).then(function(exit) {\n\t\t\t\treturn when(f.apply(this, args))['finally'](exit);\n\t\t\t});\n\t\t};\n\t}\n\n\t/**\n\t * Creates a condition that allows only n simultaneous executions\n\t * of a guarded function\n\t * @param {number} allowed number of allowed simultaneous executions\n\t * @returns {function} condition function which returns a promise that\n\t * fulfills when the critical section may be entered. The fulfillment\n\t * value is a function (\"notifyExit\") that must be called when the critical\n\t * section has been exited.\n\t */\n\tfunction n(allowed) {\n\t\tvar count = 0;\n\t\tvar waiting = [];\n\n\t\treturn function enter() {\n\t\t\treturn when.promise(function(resolve) {\n\t\t\t\tif(count < allowed) {\n\t\t\t\t\tresolve(exit);\n\t\t\t\t} else {\n\t\t\t\t\twaiting.push(resolve);\n\t\t\t\t}\n\t\t\t\tcount += 1;\n\t\t\t});\n\t\t};\n\n\t\tfunction exit() {\n\t\t\tcount = Math.max(count - 1, 0);\n\t\t\tif(waiting.length > 0) {\n\t\t\t\twaiting.shift()(exit);\n\t\t\t}\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Licensed under the MIT License at:\n * http://www.opensource.org/licenses/mit-license.php\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar Promise = when.Promise;\n\tvar toPromise = when.resolve;\n\n\treturn {\n\t\tall: when.lift(all),\n\t\tmap: map,\n\t\tsettle: settle\n\t};\n\n\t/**\n\t * Resolve all the key-value pairs in the supplied object or promise\n\t * for an object.\n\t * @param {Promise|object} object or promise for object whose key-value pairs\n\t * will be resolved\n\t * @returns {Promise} promise for an object with the fully resolved key-value pairs\n\t */\n\tfunction all(object) {\n\t\tvar p = Promise._defer();\n\t\tvar resolver = Promise._handler(p);\n\n\t\tvar results = {};\n\t\tvar keys = Object.keys(object);\n\t\tvar pending = keys.length;\n\n\t\tfor(var i=0, k; i>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function flow(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\t\tvar reject = Promise.reject;\n\t\tvar origCatch = Promise.prototype['catch'];\n\n\t\t/**\n\t\t * Handle the ultimate fulfillment value or rejection reason, and assume\n\t\t * responsibility for all errors. If an error propagates out of result\n\t\t * or handleFatalError, it will be rethrown to the host, resulting in a\n\t\t * loud stack track on most platforms and a crash on some.\n\t\t * @param {function?} onResult\n\t\t * @param {function?} onError\n\t\t * @returns {undefined}\n\t\t */\n\t\tPromise.prototype.done = function(onResult, onError) {\n\t\t\tthis._handler.visit(this._handler.receiver, onResult, onError);\n\t\t};\n\n\t\t/**\n\t\t * Add Error-type and predicate matching to catch. Examples:\n\t\t * promise.catch(TypeError, handleTypeError)\n\t\t * .catch(predicate, handleMatchedErrors)\n\t\t * .catch(handleRemainingErrors)\n\t\t * @param onRejected\n\t\t * @returns {*}\n\t\t */\n\t\tPromise.prototype['catch'] = Promise.prototype.otherwise = function(onRejected) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\treturn origCatch.call(this, onRejected);\n\t\t\t}\n\n\t\t\tif(typeof onRejected !== 'function') {\n\t\t\t\treturn this.ensure(rejectInvalidPredicate);\n\t\t\t}\n\n\t\t\treturn origCatch.call(this, createCatchFilter(arguments[1], onRejected));\n\t\t};\n\n\t\t/**\n\t\t * Wraps the provided catch handler, so that it will only be called\n\t\t * if the predicate evaluates truthy\n\t\t * @param {?function} handler\n\t\t * @param {function} predicate\n\t\t * @returns {function} conditional catch handler\n\t\t */\n\t\tfunction createCatchFilter(handler, predicate) {\n\t\t\treturn function(e) {\n\t\t\t\treturn evaluatePredicate(e, predicate)\n\t\t\t\t\t? handler.call(this, e)\n\t\t\t\t\t: reject(e);\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Ensures that onFulfilledOrRejected will be called regardless of whether\n\t\t * this promise is fulfilled or rejected. onFulfilledOrRejected WILL NOT\n\t\t * receive the promises' value or reason. Any returned value will be disregarded.\n\t\t * onFulfilledOrRejected may throw or return a rejected promise to signal\n\t\t * an additional error.\n\t\t * @param {function} handler handler to be called regardless of\n\t\t * fulfillment or rejection\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['finally'] = Promise.prototype.ensure = function(handler) {\n\t\t\tif(typeof handler !== 'function') {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\treturn this.then(function(x) {\n\t\t\t\treturn runSideEffect(handler, this, identity, x);\n\t\t\t}, function(e) {\n\t\t\t\treturn runSideEffect(handler, this, reject, e);\n\t\t\t});\n\t\t};\n\n\t\tfunction runSideEffect (handler, thisArg, propagate, value) {\n\t\t\tvar result = handler.call(thisArg);\n\t\t\treturn maybeThenable(result)\n\t\t\t\t? propagateValue(result, propagate, value)\n\t\t\t\t: propagate(value);\n\t\t}\n\n\t\tfunction propagateValue (result, propagate, x) {\n\t\t\treturn resolve(result).then(function () {\n\t\t\t\treturn propagate(x);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Recover from a failure by returning a defaultValue. If defaultValue\n\t\t * is a promise, it's fulfillment value will be used. If defaultValue is\n\t\t * a promise that rejects, the returned promise will reject with the\n\t\t * same reason.\n\t\t * @param {*} defaultValue\n\t\t * @returns {Promise} new promise\n\t\t */\n\t\tPromise.prototype['else'] = Promise.prototype.orElse = function(defaultValue) {\n\t\t\treturn this.then(void 0, function() {\n\t\t\t\treturn defaultValue;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Shortcut for .then(function() { return value; })\n\t\t * @param {*} value\n\t\t * @return {Promise} a promise that:\n\t\t * - is fulfilled if value is not a promise, or\n\t\t * - if value is a promise, will fulfill with its value, or reject\n\t\t * with its reason.\n\t\t */\n\t\tPromise.prototype['yield'] = function(value) {\n\t\t\treturn this.then(function() {\n\t\t\t\treturn value;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Runs a side effect when this promise fulfills, without changing the\n\t\t * fulfillment value.\n\t\t * @param {function} onFulfilledSideEffect\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.tap = function(onFulfilledSideEffect) {\n\t\t\treturn this.then(onFulfilledSideEffect)['yield'](this);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n\tfunction rejectInvalidPredicate() {\n\t\tthrow new TypeError('catch predicate must be a function');\n\t}\n\n\tfunction evaluatePredicate(e, predicate) {\n\t\treturn isError(predicate) ? e instanceof predicate : predicate(e);\n\t}\n\n\tfunction isError(predicate) {\n\t\treturn predicate === Error\n\t\t\t|| (predicate != null && predicate.prototype instanceof Error);\n\t}\n\n\tfunction maybeThenable(x) {\n\t\treturn (typeof x === 'object' || typeof x === 'function') && x !== null;\n\t}\n\n\tfunction identity(x) {\n\t\treturn x;\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n/** @author Jeff Escalante */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function fold(Promise) {\n\n\t\tPromise.prototype.fold = function(f, z) {\n\t\t\tvar promise = this._beget();\n\n\t\t\tthis._handler.fold(function(z, x, to) {\n\t\t\t\tPromise._handler(z).fold(function(x, z, to) {\n\t\t\t\t\tto.resolve(f.call(this, z, x));\n\t\t\t\t}, x, this, to);\n\t\t\t}, z, promise._handler.receiver, promise._handler);\n\n\t\t\treturn promise;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar inspect = require('../state').inspect;\n\n\treturn function inspection(Promise) {\n\n\t\tPromise.prototype.inspect = function() {\n\t\t\treturn inspect(Promise._handler(this));\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function generate(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\n\t\tPromise.iterate = iterate;\n\t\tPromise.unfold = unfold;\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.iterate\n\t\t * Generate a (potentially infinite) stream of promised values:\n\t\t * x, f(x), f(f(x)), etc. until condition(x) returns true\n\t\t * @param {function} f function to generate a new x from the previous x\n\t\t * @param {function} condition function that, given the current x, returns\n\t\t * truthy when the iterate should stop\n\t\t * @param {function} handler function to handle the value produced by f\n\t\t * @param {*|Promise} x starting value, may be a promise\n\t\t * @return {Promise} the result of the last call to f before\n\t\t * condition returns true\n\t\t */\n\t\tfunction iterate(f, condition, handler, x) {\n\t\t\treturn unfold(function(x) {\n\t\t\t\treturn [x, f(x)];\n\t\t\t}, condition, handler, x);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.unfold\n\t\t * Generate a (potentially infinite) stream of promised values\n\t\t * by applying handler(generator(seed)) iteratively until\n\t\t * condition(seed) returns true.\n\t\t * @param {function} unspool function that generates a [value, newSeed]\n\t\t * given a seed.\n\t\t * @param {function} condition function that, given the current seed, returns\n\t\t * truthy when the unfold should stop\n\t\t * @param {function} handler function to handle the value produced by unspool\n\t\t * @param x {*|Promise} starting value, may be a promise\n\t\t * @return {Promise} the result of the last value produced by unspool before\n\t\t * condition returns true\n\t\t */\n\t\tfunction unfold(unspool, condition, handler, x) {\n\t\t\treturn resolve(x).then(function(seed) {\n\t\t\t\treturn resolve(condition(seed)).then(function(done) {\n\t\t\t\t\treturn done ? seed : resolve(unspool(seed)).spread(next);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tfunction next(item, newSeed) {\n\t\t\t\treturn resolve(handler(item)).then(function() {\n\t\t\t\t\treturn unfold(unspool, condition, handler, newSeed);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function progress(Promise) {\n\n\t\t/**\n\t\t * @deprecated\n\t\t * Register a progress handler for this promise\n\t\t * @param {function} onProgress\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.progress = function(onProgress) {\n\t\t\treturn this.then(void 0, void 0, onProgress);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar env = require('../env');\n\tvar TimeoutError = require('../TimeoutError');\n\n\tfunction setTimeout(f, ms, x, y) {\n\t\treturn env.setTimer(function() {\n\t\t\tf(x, y, ms);\n\t\t}, ms);\n\t}\n\n\treturn function timed(Promise) {\n\t\t/**\n\t\t * Return a new promise whose fulfillment value is revealed only\n\t\t * after ms milliseconds\n\t\t * @param {number} ms milliseconds\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.delay = function(ms) {\n\t\t\tvar p = this._beget();\n\t\t\tthis._handler.fold(handleDelay, ms, void 0, p._handler);\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction handleDelay(ms, x, h) {\n\t\t\tsetTimeout(resolveDelay, ms, x, h);\n\t\t}\n\n\t\tfunction resolveDelay(x, h) {\n\t\t\th.resolve(x);\n\t\t}\n\n\t\t/**\n\t\t * Return a new promise that rejects after ms milliseconds unless\n\t\t * this promise fulfills earlier, in which case the returned promise\n\t\t * fulfills with the same value.\n\t\t * @param {number} ms milliseconds\n\t\t * @param {Error|*=} reason optional rejection reason to use, defaults\n\t\t * to a TimeoutError if not provided\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.timeout = function(ms, reason) {\n\t\t\tvar p = this._beget();\n\t\t\tvar h = p._handler;\n\n\t\t\tvar t = setTimeout(onTimeout, ms, reason, p._handler);\n\n\t\t\tthis._handler.visit(h,\n\t\t\t\tfunction onFulfill(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.resolve(x); // this = h\n\t\t\t\t},\n\t\t\t\tfunction onReject(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.reject(x); // this = h\n\t\t\t\t},\n\t\t\t\th.notify);\n\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction onTimeout(reason, h, ms) {\n\t\t\tvar e = typeof reason === 'undefined'\n\t\t\t\t? new TimeoutError('timed out after ' + ms + 'ms')\n\t\t\t\t: reason;\n\t\t\th.reject(e);\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar setTimer = require('../env').setTimer;\n\tvar format = require('../format');\n\n\treturn function unhandledRejection(Promise) {\n\n\t\tvar logError = noop;\n\t\tvar logInfo = noop;\n\t\tvar localConsole;\n\n\t\tif(typeof console !== 'undefined') {\n\t\t\t// Alias console to prevent things like uglify's drop_console option from\n\t\t\t// removing console.log/error. Unhandled rejections fall into the same\n\t\t\t// category as uncaught exceptions, and build tools shouldn't silence them.\n\t\t\tlocalConsole = console;\n\t\t\tlogError = typeof localConsole.error !== 'undefined'\n\t\t\t\t? function (e) { localConsole.error(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\n\t\t\tlogInfo = typeof localConsole.info !== 'undefined'\n\t\t\t\t? function (e) { localConsole.info(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\t\t}\n\n\t\tPromise.onPotentiallyUnhandledRejection = function(rejection) {\n\t\t\tenqueue(report, rejection);\n\t\t};\n\n\t\tPromise.onPotentiallyUnhandledRejectionHandled = function(rejection) {\n\t\t\tenqueue(unreport, rejection);\n\t\t};\n\n\t\tPromise.onFatalRejection = function(rejection) {\n\t\t\tenqueue(throwit, rejection.value);\n\t\t};\n\n\t\tvar tasks = [];\n\t\tvar reported = [];\n\t\tvar running = null;\n\n\t\tfunction report(r) {\n\t\t\tif(!r.handled) {\n\t\t\t\treported.push(r);\n\t\t\t\tlogError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction unreport(r) {\n\t\t\tvar i = reported.indexOf(r);\n\t\t\tif(i >= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function addWith(Promise) {\n\t\t/**\n\t\t * Returns a promise whose handlers will be called with `this` set to\n\t\t * the supplied receiver. Subsequent promises derived from the\n\t\t * returned promise will also have their handlers called with receiver\n\t\t * as `this`. Calling `with` with undefined or no arguments will return\n\t\t * a promise whose handlers will again be called in the usual Promises/A+\n\t\t * way (no `this`) thus safely undoing any previous `with` in the\n\t\t * promise chain.\n\t\t *\n\t\t * WARNING: Promises returned from `with`/`withThis` are NOT Promises/A+\n\t\t * compliant, specifically violating 2.2.5 (http://promisesaplus.com/#point-41)\n\t\t *\n\t\t * @param {object} receiver `this` value for all handlers attached to\n\t\t * the returned promise.\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['with'] = Promise.prototype.withThis = function(receiver) {\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\t\t\tchild.receiver = receiver;\n\t\t\tthis._handler.chain(child, receiver);\n\t\t\treturn p;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === 'function' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === 'function' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function liftAll(liftOne, combine, dst, src) {\n\t\tif(typeof combine === 'undefined') {\n\t\t\tcombine = defaultCombine;\n\t\t}\n\n\t\treturn Object.keys(src).reduce(function(dst, key) {\n\t\t\tvar f = src[key];\n\t\t\treturn typeof f === 'function' ? combine(dst, liftOne(f), key) : dst;\n\t\t}, typeof dst === 'undefined' ? defaultDst(src) : dst);\n\t};\n\n\tfunction defaultCombine(o, f, k) {\n\t\to[k] = f;\n\t\treturn o;\n\t}\n\n\tfunction defaultDst(src) {\n\t\treturn typeof src === 'function' ? src.bind() : Object.create(src);\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0 ? toFulfilledState(handler.value)\n\t\t\t : toRejectedState(handler.value);\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2013 original author or authors */\n\n/**\n * Collection of helpers for interfacing with node-style asynchronous functions\n * using promises.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar _liftAll = require('./lib/liftAll');\n\tvar setTimer = require('./lib/env').setTimer;\n\tvar slice = Array.prototype.slice;\n\n\tvar _apply = require('./lib/apply')(when.Promise, dispatch);\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tapply: apply,\n\t\tcall: call,\n\t\tcreateCallback: createCallback,\n\t\tbindCallback: bindCallback,\n\t\tliftCallback: liftCallback\n\t};\n\n\t/**\n\t * Takes a node-style async function and calls it immediately (with an optional\n\t * array of arguments or promises for arguments). It returns a promise whose\n\t * resolution depends on whether the async functions calls its callback with the\n\t * conventional error argument or not.\n\t *\n\t * With this it becomes possible to leverage existing APIs while still reaping\n\t * the benefits of promises.\n\t *\n\t * @example\n\t * function onlySmallNumbers(n, callback) {\n\t *\t\tif(n < 10) {\n\t *\t\t\tcallback(null, n + 10);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * var nodefn = require(\"when/node/function\");\n\t *\n\t * // Logs '15'\n\t * nodefn.apply(onlySmallNumbers, [5]).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.apply(onlySmallNumbers, [15]).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction apply(f, args) {\n\t\treturn _apply(f, this, args || []);\n\t}\n\n\tfunction dispatch(f, thisArg, args, h) {\n\t\tvar cb = createCallback(h);\n\t\ttry {\n\t\t\tswitch(args.length) {\n\t\t\t\tcase 2: f.call(thisArg, args[0], args[1], cb); break;\n\t\t\t\tcase 1: f.call(thisArg, args[0], cb); break;\n\t\t\t\tcase 0: f.call(thisArg, cb); break;\n\t\t\t\tdefault:\n\t\t\t\t\targs.push(cb);\n\t\t\t\t\tf.apply(thisArg, args);\n\t\t\t}\n\t\t} catch(e) {\n\t\t\th.reject(e);\n\t\t}\n\t}\n\n\t/**\n\t * Has the same behavior that {@link apply} has, with the difference that the\n\t * arguments to the function are provided individually, while {@link apply} accepts\n\t * a single array.\n\t *\n\t * @example\n\t * function sumSmallNumbers(x, y, callback) {\n\t *\t\tvar result = x + y;\n\t *\t\tif(result < 10) {\n\t *\t\t\tcallback(null, result);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * // Logs '5'\n\t * nodefn.call(sumSmallNumbers, 2, 3).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.call(sumSmallNumbers, 5, 10).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {...*} [args] arguments that will be forwarded to the function\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction call(f /*, args... */) {\n\t\treturn _apply(f, this, slice.call(arguments, 1));\n\t}\n\n\t/**\n\t * Takes a node-style function and returns new function that wraps the\n\t * original and, instead of taking a callback, returns a promise. Also, it\n\t * knows how to handle promises given as arguments, waiting for their\n\t * resolution before executing.\n\t *\n\t * Upon execution, the orginal function is executed as well. If it passes\n\t * a truthy value as the first argument to the callback, it will be\n\t * interpreted as an error condition, and the promise will be rejected\n\t * with it. Otherwise, the call is considered a resolution, and the promise\n\t * is resolved with the callback's second argument.\n\t *\n\t * @example\n\t * var fs = require(\"fs\"), nodefn = require(\"when/node/function\");\n\t *\n\t * var promiseRead = nodefn.lift(fs.readFile);\n\t *\n\t * // The promise is resolved with the contents of the file if everything\n\t * // goes ok\n\t * promiseRead('exists.txt').then(console.log, console.error);\n\t *\n\t * // And will be rejected if something doesn't work out\n\t * // (e.g. the files does not exist)\n\t * promiseRead('doesnt_exist.txt').then(console.log, console.error);\n\t *\n\t *\n\t * @param {Function} f node-style function to be lifted\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args1 = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\t// TODO: Simplify once partialing has been removed\n\t\t\tvar l = args1.length;\n\t\t\tvar al = arguments.length;\n\t\t\tvar args = new Array(al + l);\n\t\t\tvar i;\n\t\t\tfor(i=0; i 2) {\n\t\t\t\tresolver.resolve(slice.call(arguments, 1));\n\t\t\t} else {\n\t\t\t\tresolver.resolve(value);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Attaches a node-style callback to a promise, ensuring the callback is\n\t * called for either fulfillment or rejection. Returns a promise with the same\n\t * state as the passed-in promise.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tbindCallback(deferred.promise, callback);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Promise} promise The promise to be attached to.\n\t * @param {Function} callback The node-style callback to attach.\n\t * @returns {Promise} A promise with the same state as the passed-in promise.\n\t */\n\tfunction bindCallback(promise, callback) {\n\t\tpromise = when(promise);\n\n\t\tif (callback) {\n\t\t\tpromise.then(success, wrapped);\n\t\t}\n\n\t\treturn promise;\n\n\t\tfunction success(value) {\n\t\t\twrapped(null, value);\n\t\t}\n\n\t\tfunction wrapped(err, value) {\n\t\t\tsetTimer(function () {\n\t\t\t\tcallback(err, value);\n\t\t\t}, 0);\n\t\t}\n\t}\n\n\t/**\n\t * Takes a node-style callback and returns new function that accepts a\n\t * promise, calling the original callback when the promise is either\n\t * fulfilled or rejected with the appropriate arguments.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tvar wrapped = liftCallback(callback);\n\t *\n\t *\t// `wrapped` can now be passed around at will\n\t *\twrapped(deferred.promise);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Function} callback The node-style callback to wrap.\n\t * @returns {Function} The lifted, promise-accepting function.\n\t */\n\tfunction liftCallback(callback) {\n\t\treturn function(promise) {\n\t\t\treturn bindCallback(promise, callback);\n\t\t};\n\t}\n});\n\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * parallel.js\n *\n * Run a set of task functions in parallel. All tasks will\n * receive the same args\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in parallel\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for array containing the\n\t * result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function parallel(tasks /*, args... */) {\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.map(tasks, function(task) {\n\t\t\t\treturn task.apply(void 0, args);\n\t\t\t});\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * pipeline.js\n *\n * Run a set of task functions in sequence, passing the result\n * of the previous as an argument to the next. Like a shell\n * pipeline, e.g. `cat file.txt | grep 'foo' | sed -e 's/foo/bar/g'\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in a pipeline where the next\n\t * tasks receives the result of the previous. The first task\n\t * will receive the initialArgs as its argument list.\n\t * @param tasks {Array|Promise} array or promise for array of task functions\n\t * @param [initialArgs...] {*} arguments to be passed to the first task\n\t * @return {Promise} promise for return value of the final task\n\t */\n\treturn function pipeline(tasks /* initialArgs... */) {\n\t\t// Self-optimizing function to run first task with multiple\n\t\t// args using apply, but subsequence tasks via direct invocation\n\t\tvar runTask = function(args, task) {\n\t\t\trunTask = function(arg, task) {\n\t\t\t\treturn task(arg);\n\t\t\t};\n\n\t\t\treturn task.apply(null, args);\n\t\t};\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(arg, task) {\n\t\t\t\treturn runTask(arg, task);\n\t\t\t}, args);\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2012-2013 original author or authors */\n\n/**\n * poll.js\n *\n * Helper that polls until cancelled or for a condition to become true.\n *\n * @author Scott Andrews\n */\n\n(function (define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar cancelable = require('./cancelable');\n\n\t/**\n\t * Periodically execute the task function on the msec delay. The result of\n\t * the task may be verified by watching for a condition to become true. The\n\t * returned deferred is cancellable if the polling needs to be cancelled\n\t * externally before reaching a resolved state.\n\t *\n\t * The next vote is scheduled after the results of the current vote are\n\t * verified and rejected.\n\t *\n\t * Polling may be terminated by the verifier returning a truthy value,\n\t * invoking cancel() on the returned promise, or the task function returning\n\t * a rejected promise.\n\t *\n\t * Usage:\n\t *\n\t * var count = 0;\n\t * function doSomething() { return count++ }\n\t *\n\t * // poll until cancelled\n\t * var p = poll(doSomething, 1000);\n\t * ...\n\t * p.cancel();\n\t *\n\t * // poll until condition is met\n\t * poll(doSomething, 1000, function(result) { return result > 10 })\n\t * .then(function(result) { assert result == 10 });\n\t *\n\t * // delay first vote\n\t * poll(doSomething, 1000, anyFunc, true);\n\t *\n\t * @param task {Function} function that is executed after every timeout\n\t * @param interval {number|Function} timeout in milliseconds\n\t * @param [verifier] {Function} function to evaluate the result of the vote.\n\t * May return a {Promise} or a {Boolean}. Rejecting the promise or a\n\t * falsey value will schedule the next vote.\n\t * @param [delayInitialTask] {boolean} if truthy, the first vote is scheduled\n\t * instead of immediate\n\t *\n\t * @returns {Promise}\n\t */\n\treturn function poll(task, interval, verifier, delayInitialTask) {\n\t\tvar deferred, canceled, reject;\n\n\t\tcanceled = false;\n\t\tdeferred = cancelable(when.defer(), function () { canceled = true; });\n\t\treject = deferred.reject;\n\n\t\tverifier = verifier || function () { return false; };\n\n\t\tif (typeof interval !== 'function') {\n\t\t\tinterval = (function (interval) {\n\t\t\t\treturn function () { return when().delay(interval); };\n\t\t\t})(interval);\n\t\t}\n\n\t\tfunction certify(result) {\n\t\t\tdeferred.resolve(result);\n\t\t}\n\n\t\tfunction schedule(result) {\n\t\t\tattempt(interval).then(vote, reject);\n\t\t\tif (result !== void 0) {\n\t\t\t\tdeferred.notify(result);\n\t\t\t}\n\t\t}\n\n\t\tfunction vote() {\n\t\t\tif (canceled) { return; }\n\t\t\twhen(task(),\n\t\t\t\tfunction (result) {\n\t\t\t\t\twhen(verifier(result),\n\t\t\t\t\t\tfunction (verification) {\n\t\t\t\t\t\t\treturn verification ? certify(result) : schedule(result);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfunction () { schedule(result); }\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\treject\n\t\t\t);\n\t\t}\n\n\t\tif (delayInitialTask) {\n\t\t\tschedule();\n\t\t} else {\n\t\t\t// if task() is blocking, vote will also block\n\t\t\tvote();\n\t\t}\n\n\t\t// make the promise cancelable\n\t\tdeferred.promise = Object.create(deferred.promise);\n\t\tdeferred.promise.cancel = deferred.cancel;\n\n\t\treturn deferred.promise;\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * sequence.js\n *\n * Run a set of task functions in sequence. All tasks will\n * receive the same args.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in sequence with no overlap\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for an array containing\n\t * the result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function sequence(tasks /*, args... */) {\n\t\tvar results = [];\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(results, task) {\n\t\t\t\treturn when(task.apply(void 0, args), addResult);\n\t\t\t}, results);\n\t\t});\n\n\t\tfunction addResult(result) {\n\t\t\tresults.push(result);\n\t\t\treturn results;\n\t\t}\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * timeout.js\n *\n * Helper that returns a promise that rejects after a specified timeout,\n * if not explicitly resolved or rejected before that.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(trigger).timeout(ms)\n */\n return function timeout(msec, trigger) {\n\t\treturn when(trigger).timeout(msec);\n };\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n\n/**\n * Promises/A+ and when() implementation\n * when is part of the cujoJS family of libraries (http://cujojs.com/)\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function (require) {\n\n\tvar timed = require('./lib/decorators/timed');\n\tvar array = require('./lib/decorators/array');\n\tvar flow = require('./lib/decorators/flow');\n\tvar fold = require('./lib/decorators/fold');\n\tvar inspect = require('./lib/decorators/inspect');\n\tvar generate = require('./lib/decorators/iterate');\n\tvar progress = require('./lib/decorators/progress');\n\tvar withThis = require('./lib/decorators/with');\n\tvar unhandledRejection = require('./lib/decorators/unhandledRejection');\n\tvar TimeoutError = require('./lib/TimeoutError');\n\n\tvar Promise = [array, flow, fold, generate, progress,\n\t\tinspect, withThis, timed, unhandledRejection]\n\t\t.reduce(function(Promise, feature) {\n\t\t\treturn feature(Promise);\n\t\t}, require('./lib/Promise'));\n\n\tvar apply = require('./lib/apply')(Promise);\n\n\t// Public API\n\n\twhen.promise = promise; // Create a pending promise\n\twhen.resolve = Promise.resolve; // Create a resolved promise\n\twhen.reject = Promise.reject; // Create a rejected promise\n\n\twhen.lift = lift; // lift a function to return promises\n\twhen['try'] = attempt; // call a function and return a promise\n\twhen.attempt = attempt; // alias for when.try\n\n\twhen.iterate = Promise.iterate; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\twhen.unfold = Promise.unfold; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\n\twhen.join = join; // Join 2 or more promises\n\n\twhen.all = all; // Resolve a list of promises\n\twhen.settle = settle; // Settle a list of promises\n\n\twhen.any = lift(Promise.any); // One-winner race\n\twhen.some = lift(Promise.some); // Multi-winner race\n\twhen.race = lift(Promise.race); // First-to-settle race\n\n\twhen.map = map; // Array.map() for promises\n\twhen.filter = filter; // Array.filter() for promises\n\twhen.reduce = lift(Promise.reduce); // Array.reduce() for promises\n\twhen.reduceRight = lift(Promise.reduceRight); // Array.reduceRight() for promises\n\n\twhen.isPromiseLike = isPromiseLike; // Is something promise-like, aka thenable\n\n\twhen.Promise = Promise; // Promise constructor\n\twhen.defer = defer; // Create a {promise, resolve, reject} tuple\n\n\t// Error types\n\n\twhen.TimeoutError = TimeoutError;\n\n\t/**\n\t * Get a trusted promise for x, or by transforming x with onFulfilled\n\t *\n\t * @param {*} x\n\t * @param {function?} onFulfilled callback to be called when x is\n\t * successfully fulfilled. If promiseOrValue is an immediate value, callback\n\t * will be invoked immediately.\n\t * @param {function?} onRejected callback to be called when x is\n\t * rejected.\n\t * @param {function?} onProgress callback to be called when progress updates\n\t * are issued for x. @deprecated\n\t * @returns {Promise} a new promise that will fulfill with the return\n\t * value of callback or errback or the completion value of promiseOrValue if\n\t * callback and/or errback is not supplied.\n\t */\n\tfunction when(x, onFulfilled, onRejected, onProgress) {\n\t\tvar p = Promise.resolve(x);\n\t\tif (arguments.length < 2) {\n\t\t\treturn p;\n\t\t}\n\n\t\treturn p.then(onFulfilled, onRejected, onProgress);\n\t}\n\n\t/**\n\t * Creates a new promise whose fate is determined by resolver.\n\t * @param {function} resolver function(resolve, reject, notify)\n\t * @returns {Promise} promise whose fate is determine by resolver\n\t */\n\tfunction promise(resolver) {\n\t\treturn new Promise(resolver);\n\t}\n\n\t/**\n\t * Lift the supplied function, creating a version of f that returns\n\t * promises, and accepts promises as arguments.\n\t * @param {function} f\n\t * @returns {Function} version of f that returns promises\n\t */\n\tfunction lift(f) {\n\t\treturn function() {\n\t\t\tfor(var i=0, l=arguments.length, a=new Array(l); i 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * `promisify` is a version of `lift` that allows fine-grained control over the\n\t * arguments that passed to the underlying function. It is intended to handle\n\t * functions that don't follow the common callback and errback positions.\n\t *\n\t * The control is done by passing an object whose 'callback' and/or 'errback'\n\t * keys, whose values are the corresponding 0-based indexes of the arguments on\n\t * the function. Negative values are interpreted as being relative to the end\n\t * of the arguments array.\n\t *\n\t * If arguments are given on the call to the 'promisified' function, they are\n\t * intermingled with the callback and errback. If a promise is given among them,\n\t * the execution of the function will only occur after its resolution.\n\t *\n\t * @example\n\t * var delay = callbacks.promisify(setTimeout, {\n\t *\t\tcallback: 0\n\t *\t});\n\t *\n\t * delay(100).then(function() {\n\t *\t\tconsole.log(\"This happens 100ms afterwards\");\n\t *\t});\n\t *\n\t * @example\n\t * function callbackAsLast(errback, followsStandards, callback) {\n\t *\t\tif(followsStandards) {\n\t *\t\t\tcallback(\"well done!\");\n\t *\t\t} else {\n\t *\t\t\terrback(\"some programmers just want to watch the world burn\");\n\t *\t\t}\n\t *\t}\n\t *\n\t * var promisified = callbacks.promisify(callbackAsLast, {\n\t *\t\tcallback: -1,\n\t *\t\terrback: 0,\n\t *\t});\n\t *\n\t * promisified(true).then(console.log, console.error);\n\t * promisified(false).then(console.log, console.error);\n\t *\n\t * @param {Function} asyncFunction traditional function to be decorated\n\t * @param {object} positions\n\t * @param {number} [positions.callback] index at which asyncFunction expects to\n\t * receive a success callback\n\t * @param {number} [positions.errback] index at which asyncFunction expects to\n\t * receive an error callback\n\t * @returns {function} promisified function that accepts\n\t *\n\t * @deprecated\n\t */\n\tfunction promisify(asyncFunction, positions) {\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\treturn Promise.all(arguments).then(function(args) {\n\t\t\t\tvar p = Promise._defer();\n\n\t\t\t\tvar callbackPos, errbackPos;\n\n\t\t\t\tif(typeof positions.callback === 'number') {\n\t\t\t\t\tcallbackPos = normalizePosition(args, positions.callback);\n\t\t\t\t}\n\n\t\t\t\tif(typeof positions.errback === 'number') {\n\t\t\t\t\terrbackPos = normalizePosition(args, positions.errback);\n\t\t\t\t}\n\n\t\t\t\tif(errbackPos < callbackPos) {\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t} else {\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t}\n\n\t\t\t\tasyncFunction.apply(thisArg, args);\n\n\t\t\t\treturn p;\n\t\t\t});\n\t\t};\n\t}\n\n\tfunction normalizePosition(args, pos) {\n\t\treturn pos < 0 ? (args.length + pos + 2) : pos;\n\t}\n\n\tfunction insertCallback(args, pos, callback, thisArg) {\n\t\tif(typeof pos === 'number') {\n\t\t\targs.splice(pos, 0, alwaysUnary(callback, thisArg));\n\t\t}\n\t}\n\n\tfunction alwaysUnary(fn, thisArg) {\n\t\treturn function() {\n\t\t\tif (arguments.length > 1) {\n\t\t\t\tfn.call(thisArg, slice.call(arguments));\n\t\t\t} else {\n\t\t\t\tfn.apply(thisArg, arguments);\n\t\t\t}\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright B Cavalier & J Hann */\n\n/**\n * cancelable.js\n * @deprecated\n *\n * Decorator that makes a deferred \"cancelable\". It adds a cancel() method that\n * will call a special cancel handler function and then reject the deferred. The\n * cancel handler can be used to do resource cleanup, or anything else that should\n * be done before any other rejection handlers are executed.\n *\n * Usage:\n *\n * var cancelableDeferred = cancelable(when.defer(), myCancelHandler);\n *\n * @author brian@hovercraftstudios.com\n */\n\n(function(define) {\ndefine(function() {\n\n /**\n * Makes deferred cancelable, adding a cancel() method.\n\t * @deprecated\n *\n * @param deferred {Deferred} the {@link Deferred} to make cancelable\n * @param canceler {Function} cancel handler function to execute when this deferred\n\t * is canceled. This is guaranteed to run before all other rejection handlers.\n\t * The canceler will NOT be executed if the deferred is rejected in the standard\n\t * way, i.e. deferred.reject(). It ONLY executes if the deferred is canceled,\n\t * i.e. deferred.cancel()\n *\n * @returns deferred, with an added cancel() method.\n */\n return function(deferred, canceler) {\n // Add a cancel method to the deferred to reject the delegate\n // with the special canceled indicator.\n deferred.cancel = function() {\n\t\t\ttry {\n\t\t\t\tdeferred.reject(canceler(deferred));\n\t\t\t} catch(e) {\n\t\t\t\tdeferred.reject(e);\n\t\t\t}\n\n\t\t\treturn deferred.promise;\n };\n\n return deferred;\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * delay.js\n *\n * Helper that returns a promise that resolves after a delay.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(value).delay(ms)\n */\n return function delay(msec, value) {\n\t\treturn when(value).delay(msec);\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2013-2014 original author or authors */\n\n/**\n * Collection of helper functions for wrapping and executing 'traditional'\n * synchronous functions in a promise interface.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar _liftAll = require('./lib/liftAll');\n\tvar _apply = require('./lib/apply')(when.Promise);\n\tvar slice = Array.prototype.slice;\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tcall: attempt,\n\t\tapply: apply,\n\t\tcompose: compose\n\t};\n\n\t/**\n\t * Takes a function and an optional array of arguments (that might be promises),\n\t * and calls the function. The return value is a promise whose resolution\n\t * depends on the value returned by the function.\n\t * @param {function} f function to be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the return value of func\n\t */\n\tfunction apply(f, args) {\n\t\t// slice args just in case the caller passed an Arguments instance\n\t\treturn _apply(f, this, args == null ? [] : slice.call(args));\n\t}\n\n\t/**\n\t * Takes a 'regular' function and returns a version of that function that\n\t * returns a promise instead of a plain value, and handles thrown errors by\n\t * returning a rejected promise. Also accepts a list of arguments to be\n\t * prepended to the new function, as does Function.prototype.bind.\n\t *\n\t * The resulting function is promise-aware, in the sense that it accepts\n\t * promise arguments, and waits for their resolution.\n\t * @param {Function} f function to be bound\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * Composes multiple functions by piping their return values. It is\n\t * transparent to whether the functions return 'regular' values or promises:\n\t * the piped argument is always a resolved value. If one of the functions\n\t * throws or returns a rejected promise, the composed promise will be also\n\t * rejected.\n\t *\n\t * The arguments (or promises to arguments) given to the returned function (if\n\t * any), are passed directly to the first function on the 'pipeline'.\n\t * @param {Function} f the function to which the arguments will be passed\n\t * @param {...Function} [funcs] functions that will be composed, in order\n\t * @returns {Function} a promise-returning composition of the functions\n\t */\n\tfunction compose(f /*, funcs... */) {\n\t\tvar funcs = slice.call(arguments, 1);\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\tvar args = slice.call(arguments);\n\t\t\tvar firstPromise = attempt.apply(thisArg, [f].concat(args));\n\n\t\t\treturn when.reduce(funcs, function(arg, func) {\n\t\t\t\treturn func.call(thisArg, arg);\n\t\t\t}, firstPromise);\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Generalized promise concurrency guard\n * Adapted from original concept by Sakari Jokinen (Rocket Pack, Ltd.)\n *\n * @author Brian Cavalier\n * @author John Hann\n * @contributor Sakari Jokinen\n */\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar slice = Array.prototype.slice;\n\n\tguard.n = n;\n\n\treturn guard;\n\n\t/**\n\t * Creates a guarded version of f that can only be entered when the supplied\n\t * condition allows.\n\t * @param {function} condition represents a critical section that may only\n\t * be entered when allowed by the condition\n\t * @param {function} f function to guard\n\t * @returns {function} guarded version of f\n\t */\n\tfunction guard(condition, f) {\n\t\treturn function() {\n\t\t\tvar args = slice.call(arguments);\n\n\t\t\treturn when(condition()).withThis(this).then(function(exit) {\n\t\t\t\treturn when(f.apply(this, args))['finally'](exit);\n\t\t\t});\n\t\t};\n\t}\n\n\t/**\n\t * Creates a condition that allows only n simultaneous executions\n\t * of a guarded function\n\t * @param {number} allowed number of allowed simultaneous executions\n\t * @returns {function} condition function which returns a promise that\n\t * fulfills when the critical section may be entered. The fulfillment\n\t * value is a function (\"notifyExit\") that must be called when the critical\n\t * section has been exited.\n\t */\n\tfunction n(allowed) {\n\t\tvar count = 0;\n\t\tvar waiting = [];\n\n\t\treturn function enter() {\n\t\t\treturn when.promise(function(resolve) {\n\t\t\t\tif(count < allowed) {\n\t\t\t\t\tresolve(exit);\n\t\t\t\t} else {\n\t\t\t\t\twaiting.push(resolve);\n\t\t\t\t}\n\t\t\t\tcount += 1;\n\t\t\t});\n\t\t};\n\n\t\tfunction exit() {\n\t\t\tcount = Math.max(count - 1, 0);\n\t\t\tif(waiting.length > 0) {\n\t\t\t\twaiting.shift()(exit);\n\t\t\t}\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Licensed under the MIT License at:\n * http://www.opensource.org/licenses/mit-license.php\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar Promise = when.Promise;\n\tvar toPromise = when.resolve;\n\n\treturn {\n\t\tall: when.lift(all),\n\t\tmap: map,\n\t\tsettle: settle\n\t};\n\n\t/**\n\t * Resolve all the key-value pairs in the supplied object or promise\n\t * for an object.\n\t * @param {Promise|object} object or promise for object whose key-value pairs\n\t * will be resolved\n\t * @returns {Promise} promise for an object with the fully resolved key-value pairs\n\t */\n\tfunction all(object) {\n\t\tvar p = Promise._defer();\n\t\tvar resolver = Promise._handler(p);\n\n\t\tvar results = {};\n\t\tvar keys = Object.keys(object);\n\t\tvar pending = keys.length;\n\n\t\tfor(var i=0, k; i>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function flow(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\t\tvar reject = Promise.reject;\n\t\tvar origCatch = Promise.prototype['catch'];\n\n\t\t/**\n\t\t * Handle the ultimate fulfillment value or rejection reason, and assume\n\t\t * responsibility for all errors. If an error propagates out of result\n\t\t * or handleFatalError, it will be rethrown to the host, resulting in a\n\t\t * loud stack track on most platforms and a crash on some.\n\t\t * @param {function?} onResult\n\t\t * @param {function?} onError\n\t\t * @returns {undefined}\n\t\t */\n\t\tPromise.prototype.done = function(onResult, onError) {\n\t\t\tthis._handler.visit(this._handler.receiver, onResult, onError);\n\t\t};\n\n\t\t/**\n\t\t * Add Error-type and predicate matching to catch. Examples:\n\t\t * promise.catch(TypeError, handleTypeError)\n\t\t * .catch(predicate, handleMatchedErrors)\n\t\t * .catch(handleRemainingErrors)\n\t\t * @param onRejected\n\t\t * @returns {*}\n\t\t */\n\t\tPromise.prototype['catch'] = Promise.prototype.otherwise = function(onRejected) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\treturn origCatch.call(this, onRejected);\n\t\t\t}\n\n\t\t\tif(typeof onRejected !== 'function') {\n\t\t\t\treturn this.ensure(rejectInvalidPredicate);\n\t\t\t}\n\n\t\t\treturn origCatch.call(this, createCatchFilter(arguments[1], onRejected));\n\t\t};\n\n\t\t/**\n\t\t * Wraps the provided catch handler, so that it will only be called\n\t\t * if the predicate evaluates truthy\n\t\t * @param {?function} handler\n\t\t * @param {function} predicate\n\t\t * @returns {function} conditional catch handler\n\t\t */\n\t\tfunction createCatchFilter(handler, predicate) {\n\t\t\treturn function(e) {\n\t\t\t\treturn evaluatePredicate(e, predicate)\n\t\t\t\t\t? handler.call(this, e)\n\t\t\t\t\t: reject(e);\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Ensures that onFulfilledOrRejected will be called regardless of whether\n\t\t * this promise is fulfilled or rejected. onFulfilledOrRejected WILL NOT\n\t\t * receive the promises' value or reason. Any returned value will be disregarded.\n\t\t * onFulfilledOrRejected may throw or return a rejected promise to signal\n\t\t * an additional error.\n\t\t * @param {function} handler handler to be called regardless of\n\t\t * fulfillment or rejection\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['finally'] = Promise.prototype.ensure = function(handler) {\n\t\t\tif(typeof handler !== 'function') {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\treturn this.then(function(x) {\n\t\t\t\treturn runSideEffect(handler, this, identity, x);\n\t\t\t}, function(e) {\n\t\t\t\treturn runSideEffect(handler, this, reject, e);\n\t\t\t});\n\t\t};\n\n\t\tfunction runSideEffect (handler, thisArg, propagate, value) {\n\t\t\tvar result = handler.call(thisArg);\n\t\t\treturn maybeThenable(result)\n\t\t\t\t? propagateValue(result, propagate, value)\n\t\t\t\t: propagate(value);\n\t\t}\n\n\t\tfunction propagateValue (result, propagate, x) {\n\t\t\treturn resolve(result).then(function () {\n\t\t\t\treturn propagate(x);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Recover from a failure by returning a defaultValue. If defaultValue\n\t\t * is a promise, it's fulfillment value will be used. If defaultValue is\n\t\t * a promise that rejects, the returned promise will reject with the\n\t\t * same reason.\n\t\t * @param {*} defaultValue\n\t\t * @returns {Promise} new promise\n\t\t */\n\t\tPromise.prototype['else'] = Promise.prototype.orElse = function(defaultValue) {\n\t\t\treturn this.then(void 0, function() {\n\t\t\t\treturn defaultValue;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Shortcut for .then(function() { return value; })\n\t\t * @param {*} value\n\t\t * @return {Promise} a promise that:\n\t\t * - is fulfilled if value is not a promise, or\n\t\t * - if value is a promise, will fulfill with its value, or reject\n\t\t * with its reason.\n\t\t */\n\t\tPromise.prototype['yield'] = function(value) {\n\t\t\treturn this.then(function() {\n\t\t\t\treturn value;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Runs a side effect when this promise fulfills, without changing the\n\t\t * fulfillment value.\n\t\t * @param {function} onFulfilledSideEffect\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.tap = function(onFulfilledSideEffect) {\n\t\t\treturn this.then(onFulfilledSideEffect)['yield'](this);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n\tfunction rejectInvalidPredicate() {\n\t\tthrow new TypeError('catch predicate must be a function');\n\t}\n\n\tfunction evaluatePredicate(e, predicate) {\n\t\treturn isError(predicate) ? e instanceof predicate : predicate(e);\n\t}\n\n\tfunction isError(predicate) {\n\t\treturn predicate === Error\n\t\t\t|| (predicate != null && predicate.prototype instanceof Error);\n\t}\n\n\tfunction maybeThenable(x) {\n\t\treturn (typeof x === 'object' || typeof x === 'function') && x !== null;\n\t}\n\n\tfunction identity(x) {\n\t\treturn x;\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n/** @author Jeff Escalante */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function fold(Promise) {\n\n\t\tPromise.prototype.fold = function(f, z) {\n\t\t\tvar promise = this._beget();\n\n\t\t\tthis._handler.fold(function(z, x, to) {\n\t\t\t\tPromise._handler(z).fold(function(x, z, to) {\n\t\t\t\t\tto.resolve(f.call(this, z, x));\n\t\t\t\t}, x, this, to);\n\t\t\t}, z, promise._handler.receiver, promise._handler);\n\n\t\t\treturn promise;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar inspect = require('../state').inspect;\n\n\treturn function inspection(Promise) {\n\n\t\tPromise.prototype.inspect = function() {\n\t\t\treturn inspect(Promise._handler(this));\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function generate(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\n\t\tPromise.iterate = iterate;\n\t\tPromise.unfold = unfold;\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.iterate\n\t\t * Generate a (potentially infinite) stream of promised values:\n\t\t * x, f(x), f(f(x)), etc. until condition(x) returns true\n\t\t * @param {function} f function to generate a new x from the previous x\n\t\t * @param {function} condition function that, given the current x, returns\n\t\t * truthy when the iterate should stop\n\t\t * @param {function} handler function to handle the value produced by f\n\t\t * @param {*|Promise} x starting value, may be a promise\n\t\t * @return {Promise} the result of the last call to f before\n\t\t * condition returns true\n\t\t */\n\t\tfunction iterate(f, condition, handler, x) {\n\t\t\treturn unfold(function(x) {\n\t\t\t\treturn [x, f(x)];\n\t\t\t}, condition, handler, x);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.unfold\n\t\t * Generate a (potentially infinite) stream of promised values\n\t\t * by applying handler(generator(seed)) iteratively until\n\t\t * condition(seed) returns true.\n\t\t * @param {function} unspool function that generates a [value, newSeed]\n\t\t * given a seed.\n\t\t * @param {function} condition function that, given the current seed, returns\n\t\t * truthy when the unfold should stop\n\t\t * @param {function} handler function to handle the value produced by unspool\n\t\t * @param x {*|Promise} starting value, may be a promise\n\t\t * @return {Promise} the result of the last value produced by unspool before\n\t\t * condition returns true\n\t\t */\n\t\tfunction unfold(unspool, condition, handler, x) {\n\t\t\treturn resolve(x).then(function(seed) {\n\t\t\t\treturn resolve(condition(seed)).then(function(done) {\n\t\t\t\t\treturn done ? seed : resolve(unspool(seed)).spread(next);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tfunction next(item, newSeed) {\n\t\t\t\treturn resolve(handler(item)).then(function() {\n\t\t\t\t\treturn unfold(unspool, condition, handler, newSeed);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function progress(Promise) {\n\n\t\t/**\n\t\t * @deprecated\n\t\t * Register a progress handler for this promise\n\t\t * @param {function} onProgress\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.progress = function(onProgress) {\n\t\t\treturn this.then(void 0, void 0, onProgress);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar env = require('../env');\n\tvar TimeoutError = require('../TimeoutError');\n\n\tfunction setTimeout(f, ms, x, y) {\n\t\treturn env.setTimer(function() {\n\t\t\tf(x, y, ms);\n\t\t}, ms);\n\t}\n\n\treturn function timed(Promise) {\n\t\t/**\n\t\t * Return a new promise whose fulfillment value is revealed only\n\t\t * after ms milliseconds\n\t\t * @param {number} ms milliseconds\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.delay = function(ms) {\n\t\t\tvar p = this._beget();\n\t\t\tthis._handler.fold(handleDelay, ms, void 0, p._handler);\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction handleDelay(ms, x, h) {\n\t\t\tsetTimeout(resolveDelay, ms, x, h);\n\t\t}\n\n\t\tfunction resolveDelay(x, h) {\n\t\t\th.resolve(x);\n\t\t}\n\n\t\t/**\n\t\t * Return a new promise that rejects after ms milliseconds unless\n\t\t * this promise fulfills earlier, in which case the returned promise\n\t\t * fulfills with the same value.\n\t\t * @param {number} ms milliseconds\n\t\t * @param {Error|*=} reason optional rejection reason to use, defaults\n\t\t * to a TimeoutError if not provided\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.timeout = function(ms, reason) {\n\t\t\tvar p = this._beget();\n\t\t\tvar h = p._handler;\n\n\t\t\tvar t = setTimeout(onTimeout, ms, reason, p._handler);\n\n\t\t\tthis._handler.visit(h,\n\t\t\t\tfunction onFulfill(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.resolve(x); // this = h\n\t\t\t\t},\n\t\t\t\tfunction onReject(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.reject(x); // this = h\n\t\t\t\t},\n\t\t\t\th.notify);\n\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction onTimeout(reason, h, ms) {\n\t\t\tvar e = typeof reason === 'undefined'\n\t\t\t\t? new TimeoutError('timed out after ' + ms + 'ms')\n\t\t\t\t: reason;\n\t\t\th.reject(e);\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar setTimer = require('../env').setTimer;\n\tvar format = require('../format');\n\n\treturn function unhandledRejection(Promise) {\n\n\t\tvar logError = noop;\n\t\tvar logInfo = noop;\n\t\tvar localConsole;\n\n\t\tif(typeof console !== 'undefined') {\n\t\t\t// Alias console to prevent things like uglify's drop_console option from\n\t\t\t// removing console.log/error. Unhandled rejections fall into the same\n\t\t\t// category as uncaught exceptions, and build tools shouldn't silence them.\n\t\t\tlocalConsole = console;\n\t\t\tlogError = typeof localConsole.error !== 'undefined'\n\t\t\t\t? function (e) { localConsole.error(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\n\t\t\tlogInfo = typeof localConsole.info !== 'undefined'\n\t\t\t\t? function (e) { localConsole.info(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\t\t}\n\n\t\tPromise.onPotentiallyUnhandledRejection = function(rejection) {\n\t\t\tenqueue(report, rejection);\n\t\t};\n\n\t\tPromise.onPotentiallyUnhandledRejectionHandled = function(rejection) {\n\t\t\tenqueue(unreport, rejection);\n\t\t};\n\n\t\tPromise.onFatalRejection = function(rejection) {\n\t\t\tenqueue(throwit, rejection.value);\n\t\t};\n\n\t\tvar tasks = [];\n\t\tvar reported = [];\n\t\tvar running = null;\n\n\t\tfunction report(r) {\n\t\t\tif(!r.handled) {\n\t\t\t\treported.push(r);\n\t\t\t\tlogError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction unreport(r) {\n\t\t\tvar i = reported.indexOf(r);\n\t\t\tif(i >= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function addWith(Promise) {\n\t\t/**\n\t\t * Returns a promise whose handlers will be called with `this` set to\n\t\t * the supplied receiver. Subsequent promises derived from the\n\t\t * returned promise will also have their handlers called with receiver\n\t\t * as `this`. Calling `with` with undefined or no arguments will return\n\t\t * a promise whose handlers will again be called in the usual Promises/A+\n\t\t * way (no `this`) thus safely undoing any previous `with` in the\n\t\t * promise chain.\n\t\t *\n\t\t * WARNING: Promises returned from `with`/`withThis` are NOT Promises/A+\n\t\t * compliant, specifically violating 2.2.5 (http://promisesaplus.com/#point-41)\n\t\t *\n\t\t * @param {object} receiver `this` value for all handlers attached to\n\t\t * the returned promise.\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['with'] = Promise.prototype.withThis = function(receiver) {\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\t\t\tchild.receiver = receiver;\n\t\t\tthis._handler.chain(child, receiver);\n\t\t\treturn p;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === 'function' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === 'function' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function liftAll(liftOne, combine, dst, src) {\n\t\tif(typeof combine === 'undefined') {\n\t\t\tcombine = defaultCombine;\n\t\t}\n\n\t\treturn Object.keys(src).reduce(function(dst, key) {\n\t\t\tvar f = src[key];\n\t\t\treturn typeof f === 'function' ? combine(dst, liftOne(f), key) : dst;\n\t\t}, typeof dst === 'undefined' ? defaultDst(src) : dst);\n\t};\n\n\tfunction defaultCombine(o, f, k) {\n\t\to[k] = f;\n\t\treturn o;\n\t}\n\n\tfunction defaultDst(src) {\n\t\treturn typeof src === 'function' ? src.bind() : Object.create(src);\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0 ? toFulfilledState(handler.value)\n\t\t\t : toRejectedState(handler.value);\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2013 original author or authors */\n\n/**\n * Collection of helpers for interfacing with node-style asynchronous functions\n * using promises.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar _liftAll = require('./lib/liftAll');\n\tvar setTimer = require('./lib/env').setTimer;\n\tvar slice = Array.prototype.slice;\n\n\tvar _apply = require('./lib/apply')(when.Promise, dispatch);\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tapply: apply,\n\t\tcall: call,\n\t\tcreateCallback: createCallback,\n\t\tbindCallback: bindCallback,\n\t\tliftCallback: liftCallback\n\t};\n\n\t/**\n\t * Takes a node-style async function and calls it immediately (with an optional\n\t * array of arguments or promises for arguments). It returns a promise whose\n\t * resolution depends on whether the async functions calls its callback with the\n\t * conventional error argument or not.\n\t *\n\t * With this it becomes possible to leverage existing APIs while still reaping\n\t * the benefits of promises.\n\t *\n\t * @example\n\t * function onlySmallNumbers(n, callback) {\n\t *\t\tif(n < 10) {\n\t *\t\t\tcallback(null, n + 10);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * var nodefn = require(\"when/node/function\");\n\t *\n\t * // Logs '15'\n\t * nodefn.apply(onlySmallNumbers, [5]).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.apply(onlySmallNumbers, [15]).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction apply(f, args) {\n\t\treturn _apply(f, this, args || []);\n\t}\n\n\tfunction dispatch(f, thisArg, args, h) {\n\t\tvar cb = createCallback(h);\n\t\ttry {\n\t\t\tswitch(args.length) {\n\t\t\t\tcase 2: f.call(thisArg, args[0], args[1], cb); break;\n\t\t\t\tcase 1: f.call(thisArg, args[0], cb); break;\n\t\t\t\tcase 0: f.call(thisArg, cb); break;\n\t\t\t\tdefault:\n\t\t\t\t\targs.push(cb);\n\t\t\t\t\tf.apply(thisArg, args);\n\t\t\t}\n\t\t} catch(e) {\n\t\t\th.reject(e);\n\t\t}\n\t}\n\n\t/**\n\t * Has the same behavior that {@link apply} has, with the difference that the\n\t * arguments to the function are provided individually, while {@link apply} accepts\n\t * a single array.\n\t *\n\t * @example\n\t * function sumSmallNumbers(x, y, callback) {\n\t *\t\tvar result = x + y;\n\t *\t\tif(result < 10) {\n\t *\t\t\tcallback(null, result);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * // Logs '5'\n\t * nodefn.call(sumSmallNumbers, 2, 3).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.call(sumSmallNumbers, 5, 10).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {...*} [args] arguments that will be forwarded to the function\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction call(f /*, args... */) {\n\t\treturn _apply(f, this, slice.call(arguments, 1));\n\t}\n\n\t/**\n\t * Takes a node-style function and returns new function that wraps the\n\t * original and, instead of taking a callback, returns a promise. Also, it\n\t * knows how to handle promises given as arguments, waiting for their\n\t * resolution before executing.\n\t *\n\t * Upon execution, the orginal function is executed as well. If it passes\n\t * a truthy value as the first argument to the callback, it will be\n\t * interpreted as an error condition, and the promise will be rejected\n\t * with it. Otherwise, the call is considered a resolution, and the promise\n\t * is resolved with the callback's second argument.\n\t *\n\t * @example\n\t * var fs = require(\"fs\"), nodefn = require(\"when/node/function\");\n\t *\n\t * var promiseRead = nodefn.lift(fs.readFile);\n\t *\n\t * // The promise is resolved with the contents of the file if everything\n\t * // goes ok\n\t * promiseRead('exists.txt').then(console.log, console.error);\n\t *\n\t * // And will be rejected if something doesn't work out\n\t * // (e.g. the files does not exist)\n\t * promiseRead('doesnt_exist.txt').then(console.log, console.error);\n\t *\n\t *\n\t * @param {Function} f node-style function to be lifted\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args1 = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\t// TODO: Simplify once partialing has been removed\n\t\t\tvar l = args1.length;\n\t\t\tvar al = arguments.length;\n\t\t\tvar args = new Array(al + l);\n\t\t\tvar i;\n\t\t\tfor(i=0; i 2) {\n\t\t\t\tresolver.resolve(slice.call(arguments, 1));\n\t\t\t} else {\n\t\t\t\tresolver.resolve(value);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Attaches a node-style callback to a promise, ensuring the callback is\n\t * called for either fulfillment or rejection. Returns a promise with the same\n\t * state as the passed-in promise.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tbindCallback(deferred.promise, callback);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Promise} promise The promise to be attached to.\n\t * @param {Function} callback The node-style callback to attach.\n\t * @returns {Promise} A promise with the same state as the passed-in promise.\n\t */\n\tfunction bindCallback(promise, callback) {\n\t\tpromise = when(promise);\n\n\t\tif (callback) {\n\t\t\tpromise.then(success, wrapped);\n\t\t}\n\n\t\treturn promise;\n\n\t\tfunction success(value) {\n\t\t\twrapped(null, value);\n\t\t}\n\n\t\tfunction wrapped(err, value) {\n\t\t\tsetTimer(function () {\n\t\t\t\tcallback(err, value);\n\t\t\t}, 0);\n\t\t}\n\t}\n\n\t/**\n\t * Takes a node-style callback and returns new function that accepts a\n\t * promise, calling the original callback when the promise is either\n\t * fulfilled or rejected with the appropriate arguments.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tvar wrapped = liftCallback(callback);\n\t *\n\t *\t// `wrapped` can now be passed around at will\n\t *\twrapped(deferred.promise);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Function} callback The node-style callback to wrap.\n\t * @returns {Function} The lifted, promise-accepting function.\n\t */\n\tfunction liftCallback(callback) {\n\t\treturn function(promise) {\n\t\t\treturn bindCallback(promise, callback);\n\t\t};\n\t}\n});\n\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * parallel.js\n *\n * Run a set of task functions in parallel. All tasks will\n * receive the same args\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in parallel\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for array containing the\n\t * result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function parallel(tasks /*, args... */) {\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.map(tasks, function(task) {\n\t\t\t\treturn task.apply(void 0, args);\n\t\t\t});\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * pipeline.js\n *\n * Run a set of task functions in sequence, passing the result\n * of the previous as an argument to the next. Like a shell\n * pipeline, e.g. `cat file.txt | grep 'foo' | sed -e 's/foo/bar/g'\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in a pipeline where the next\n\t * tasks receives the result of the previous. The first task\n\t * will receive the initialArgs as its argument list.\n\t * @param tasks {Array|Promise} array or promise for array of task functions\n\t * @param [initialArgs...] {*} arguments to be passed to the first task\n\t * @return {Promise} promise for return value of the final task\n\t */\n\treturn function pipeline(tasks /* initialArgs... */) {\n\t\t// Self-optimizing function to run first task with multiple\n\t\t// args using apply, but subsequence tasks via direct invocation\n\t\tvar runTask = function(args, task) {\n\t\t\trunTask = function(arg, task) {\n\t\t\t\treturn task(arg);\n\t\t\t};\n\n\t\t\treturn task.apply(null, args);\n\t\t};\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(arg, task) {\n\t\t\t\treturn runTask(arg, task);\n\t\t\t}, args);\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2012-2013 original author or authors */\n\n/**\n * poll.js\n *\n * Helper that polls until cancelled or for a condition to become true.\n *\n * @author Scott Andrews\n */\n\n(function (define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar cancelable = require('./cancelable');\n\n\t/**\n\t * Periodically execute the task function on the msec delay. The result of\n\t * the task may be verified by watching for a condition to become true. The\n\t * returned deferred is cancellable if the polling needs to be cancelled\n\t * externally before reaching a resolved state.\n\t *\n\t * The next vote is scheduled after the results of the current vote are\n\t * verified and rejected.\n\t *\n\t * Polling may be terminated by the verifier returning a truthy value,\n\t * invoking cancel() on the returned promise, or the task function returning\n\t * a rejected promise.\n\t *\n\t * Usage:\n\t *\n\t * var count = 0;\n\t * function doSomething() { return count++ }\n\t *\n\t * // poll until cancelled\n\t * var p = poll(doSomething, 1000);\n\t * ...\n\t * p.cancel();\n\t *\n\t * // poll until condition is met\n\t * poll(doSomething, 1000, function(result) { return result > 10 })\n\t * .then(function(result) { assert result == 10 });\n\t *\n\t * // delay first vote\n\t * poll(doSomething, 1000, anyFunc, true);\n\t *\n\t * @param task {Function} function that is executed after every timeout\n\t * @param interval {number|Function} timeout in milliseconds\n\t * @param [verifier] {Function} function to evaluate the result of the vote.\n\t * May return a {Promise} or a {Boolean}. Rejecting the promise or a\n\t * falsey value will schedule the next vote.\n\t * @param [delayInitialTask] {boolean} if truthy, the first vote is scheduled\n\t * instead of immediate\n\t *\n\t * @returns {Promise}\n\t */\n\treturn function poll(task, interval, verifier, delayInitialTask) {\n\t\tvar deferred, canceled, reject;\n\n\t\tcanceled = false;\n\t\tdeferred = cancelable(when.defer(), function () { canceled = true; });\n\t\treject = deferred.reject;\n\n\t\tverifier = verifier || function () { return false; };\n\n\t\tif (typeof interval !== 'function') {\n\t\t\tinterval = (function (interval) {\n\t\t\t\treturn function () { return when().delay(interval); };\n\t\t\t})(interval);\n\t\t}\n\n\t\tfunction certify(result) {\n\t\t\tdeferred.resolve(result);\n\t\t}\n\n\t\tfunction schedule(result) {\n\t\t\tattempt(interval).then(vote, reject);\n\t\t\tif (result !== void 0) {\n\t\t\t\tdeferred.notify(result);\n\t\t\t}\n\t\t}\n\n\t\tfunction vote() {\n\t\t\tif (canceled) { return; }\n\t\t\twhen(task(),\n\t\t\t\tfunction (result) {\n\t\t\t\t\twhen(verifier(result),\n\t\t\t\t\t\tfunction (verification) {\n\t\t\t\t\t\t\treturn verification ? certify(result) : schedule(result);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfunction () { schedule(result); }\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\treject\n\t\t\t);\n\t\t}\n\n\t\tif (delayInitialTask) {\n\t\t\tschedule();\n\t\t} else {\n\t\t\t// if task() is blocking, vote will also block\n\t\t\tvote();\n\t\t}\n\n\t\t// make the promise cancelable\n\t\tdeferred.promise = Object.create(deferred.promise);\n\t\tdeferred.promise.cancel = deferred.cancel;\n\n\t\treturn deferred.promise;\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * sequence.js\n *\n * Run a set of task functions in sequence. All tasks will\n * receive the same args.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in sequence with no overlap\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for an array containing\n\t * the result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function sequence(tasks /*, args... */) {\n\t\tvar results = [];\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(results, task) {\n\t\t\t\treturn when(task.apply(void 0, args), addResult);\n\t\t\t}, results);\n\t\t});\n\n\t\tfunction addResult(result) {\n\t\t\tresults.push(result);\n\t\t\treturn results;\n\t\t}\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * timeout.js\n *\n * Helper that returns a promise that rejects after a specified timeout,\n * if not explicitly resolved or rejected before that.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(trigger).timeout(ms)\n */\n return function timeout(msec, trigger) {\n\t\treturn when(trigger).timeout(msec);\n };\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n\n/**\n * Promises/A+ and when() implementation\n * when is part of the cujoJS family of libraries (http://cujojs.com/)\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function (require) {\n\n\tvar timed = require('./lib/decorators/timed');\n\tvar array = require('./lib/decorators/array');\n\tvar flow = require('./lib/decorators/flow');\n\tvar fold = require('./lib/decorators/fold');\n\tvar inspect = require('./lib/decorators/inspect');\n\tvar generate = require('./lib/decorators/iterate');\n\tvar progress = require('./lib/decorators/progress');\n\tvar withThis = require('./lib/decorators/with');\n\tvar unhandledRejection = require('./lib/decorators/unhandledRejection');\n\tvar TimeoutError = require('./lib/TimeoutError');\n\n\tvar Promise = [array, flow, fold, generate, progress,\n\t\tinspect, withThis, timed, unhandledRejection]\n\t\t.reduce(function(Promise, feature) {\n\t\t\treturn feature(Promise);\n\t\t}, require('./lib/Promise'));\n\n\tvar apply = require('./lib/apply')(Promise);\n\n\t// Public API\n\n\twhen.promise = promise; // Create a pending promise\n\twhen.resolve = Promise.resolve; // Create a resolved promise\n\twhen.reject = Promise.reject; // Create a rejected promise\n\n\twhen.lift = lift; // lift a function to return promises\n\twhen['try'] = attempt; // call a function and return a promise\n\twhen.attempt = attempt; // alias for when.try\n\n\twhen.iterate = Promise.iterate; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\twhen.unfold = Promise.unfold; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\n\twhen.join = join; // Join 2 or more promises\n\n\twhen.all = all; // Resolve a list of promises\n\twhen.settle = settle; // Settle a list of promises\n\n\twhen.any = lift(Promise.any); // One-winner race\n\twhen.some = lift(Promise.some); // Multi-winner race\n\twhen.race = lift(Promise.race); // First-to-settle race\n\n\twhen.map = map; // Array.map() for promises\n\twhen.filter = filter; // Array.filter() for promises\n\twhen.reduce = lift(Promise.reduce); // Array.reduce() for promises\n\twhen.reduceRight = lift(Promise.reduceRight); // Array.reduceRight() for promises\n\n\twhen.isPromiseLike = isPromiseLike; // Is something promise-like, aka thenable\n\n\twhen.Promise = Promise; // Promise constructor\n\twhen.defer = defer; // Create a {promise, resolve, reject} tuple\n\n\t// Error types\n\n\twhen.TimeoutError = TimeoutError;\n\n\t/**\n\t * Get a trusted promise for x, or by transforming x with onFulfilled\n\t *\n\t * @param {*} x\n\t * @param {function?} onFulfilled callback to be called when x is\n\t * successfully fulfilled. If promiseOrValue is an immediate value, callback\n\t * will be invoked immediately.\n\t * @param {function?} onRejected callback to be called when x is\n\t * rejected.\n\t * @param {function?} onProgress callback to be called when progress updates\n\t * are issued for x. @deprecated\n\t * @returns {Promise} a new promise that will fulfill with the return\n\t * value of callback or errback or the completion value of promiseOrValue if\n\t * callback and/or errback is not supplied.\n\t */\n\tfunction when(x, onFulfilled, onRejected, onProgress) {\n\t\tvar p = Promise.resolve(x);\n\t\tif (arguments.length < 2) {\n\t\t\treturn p;\n\t\t}\n\n\t\treturn p.then(onFulfilled, onRejected, onProgress);\n\t}\n\n\t/**\n\t * Creates a new promise whose fate is determined by resolver.\n\t * @param {function} resolver function(resolve, reject, notify)\n\t * @returns {Promise} promise whose fate is determine by resolver\n\t */\n\tfunction promise(resolver) {\n\t\treturn new Promise(resolver);\n\t}\n\n\t/**\n\t * Lift the supplied function, creating a version of f that returns\n\t * promises, and accepts promises as arguments.\n\t * @param {function} f\n\t * @returns {Function} version of f that returns promises\n\t */\n\tfunction lift(f) {\n\t\treturn function() {\n\t\t\tfor(var i=0, l=arguments.length, a=new Array(l); i 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * `promisify` is a version of `lift` that allows fine-grained control over the\n\t * arguments that passed to the underlying function. It is intended to handle\n\t * functions that don't follow the common callback and errback positions.\n\t *\n\t * The control is done by passing an object whose 'callback' and/or 'errback'\n\t * keys, whose values are the corresponding 0-based indexes of the arguments on\n\t * the function. Negative values are interpreted as being relative to the end\n\t * of the arguments array.\n\t *\n\t * If arguments are given on the call to the 'promisified' function, they are\n\t * intermingled with the callback and errback. If a promise is given among them,\n\t * the execution of the function will only occur after its resolution.\n\t *\n\t * @example\n\t * var delay = callbacks.promisify(setTimeout, {\n\t *\t\tcallback: 0\n\t *\t});\n\t *\n\t * delay(100).then(function() {\n\t *\t\tconsole.log(\"This happens 100ms afterwards\");\n\t *\t});\n\t *\n\t * @example\n\t * function callbackAsLast(errback, followsStandards, callback) {\n\t *\t\tif(followsStandards) {\n\t *\t\t\tcallback(\"well done!\");\n\t *\t\t} else {\n\t *\t\t\terrback(\"some programmers just want to watch the world burn\");\n\t *\t\t}\n\t *\t}\n\t *\n\t * var promisified = callbacks.promisify(callbackAsLast, {\n\t *\t\tcallback: -1,\n\t *\t\terrback: 0,\n\t *\t});\n\t *\n\t * promisified(true).then(console.log, console.error);\n\t * promisified(false).then(console.log, console.error);\n\t *\n\t * @param {Function} asyncFunction traditional function to be decorated\n\t * @param {object} positions\n\t * @param {number} [positions.callback] index at which asyncFunction expects to\n\t * receive a success callback\n\t * @param {number} [positions.errback] index at which asyncFunction expects to\n\t * receive an error callback\n\t * @returns {function} promisified function that accepts\n\t *\n\t * @deprecated\n\t */\n\tfunction promisify(asyncFunction, positions) {\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\treturn Promise.all(arguments).then(function(args) {\n\t\t\t\tvar p = Promise._defer();\n\n\t\t\t\tvar callbackPos, errbackPos;\n\n\t\t\t\tif(typeof positions.callback === 'number') {\n\t\t\t\t\tcallbackPos = normalizePosition(args, positions.callback);\n\t\t\t\t}\n\n\t\t\t\tif(typeof positions.errback === 'number') {\n\t\t\t\t\terrbackPos = normalizePosition(args, positions.errback);\n\t\t\t\t}\n\n\t\t\t\tif(errbackPos < callbackPos) {\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t} else {\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t}\n\n\t\t\t\tasyncFunction.apply(thisArg, args);\n\n\t\t\t\treturn p;\n\t\t\t});\n\t\t};\n\t}\n\n\tfunction normalizePosition(args, pos) {\n\t\treturn pos < 0 ? (args.length + pos + 2) : pos;\n\t}\n\n\tfunction insertCallback(args, pos, callback, thisArg) {\n\t\tif(typeof pos === 'number') {\n\t\t\targs.splice(pos, 0, alwaysUnary(callback, thisArg));\n\t\t}\n\t}\n\n\tfunction alwaysUnary(fn, thisArg) {\n\t\treturn function() {\n\t\t\tif (arguments.length > 1) {\n\t\t\t\tfn.call(thisArg, slice.call(arguments));\n\t\t\t} else {\n\t\t\t\tfn.apply(thisArg, arguments);\n\t\t\t}\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright B Cavalier & J Hann */\n\n/**\n * cancelable.js\n * @deprecated\n *\n * Decorator that makes a deferred \"cancelable\". It adds a cancel() method that\n * will call a special cancel handler function and then reject the deferred. The\n * cancel handler can be used to do resource cleanup, or anything else that should\n * be done before any other rejection handlers are executed.\n *\n * Usage:\n *\n * var cancelableDeferred = cancelable(when.defer(), myCancelHandler);\n *\n * @author brian@hovercraftstudios.com\n */\n\n(function(define) {\ndefine(function() {\n\n /**\n * Makes deferred cancelable, adding a cancel() method.\n\t * @deprecated\n *\n * @param deferred {Deferred} the {@link Deferred} to make cancelable\n * @param canceler {Function} cancel handler function to execute when this deferred\n\t * is canceled. This is guaranteed to run before all other rejection handlers.\n\t * The canceler will NOT be executed if the deferred is rejected in the standard\n\t * way, i.e. deferred.reject(). It ONLY executes if the deferred is canceled,\n\t * i.e. deferred.cancel()\n *\n * @returns deferred, with an added cancel() method.\n */\n return function(deferred, canceler) {\n // Add a cancel method to the deferred to reject the delegate\n // with the special canceled indicator.\n deferred.cancel = function() {\n\t\t\ttry {\n\t\t\t\tdeferred.reject(canceler(deferred));\n\t\t\t} catch(e) {\n\t\t\t\tdeferred.reject(e);\n\t\t\t}\n\n\t\t\treturn deferred.promise;\n };\n\n return deferred;\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * delay.js\n *\n * Helper that returns a promise that resolves after a delay.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(value).delay(ms)\n */\n return function delay(msec, value) {\n\t\treturn when(value).delay(msec);\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2013-2014 original author or authors */\n\n/**\n * Collection of helper functions for wrapping and executing 'traditional'\n * synchronous functions in a promise interface.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar _liftAll = require('./lib/liftAll');\n\tvar _apply = require('./lib/apply')(when.Promise);\n\tvar slice = Array.prototype.slice;\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tcall: attempt,\n\t\tapply: apply,\n\t\tcompose: compose\n\t};\n\n\t/**\n\t * Takes a function and an optional array of arguments (that might be promises),\n\t * and calls the function. The return value is a promise whose resolution\n\t * depends on the value returned by the function.\n\t * @param {function} f function to be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the return value of func\n\t */\n\tfunction apply(f, args) {\n\t\t// slice args just in case the caller passed an Arguments instance\n\t\treturn _apply(f, this, args == null ? [] : slice.call(args));\n\t}\n\n\t/**\n\t * Takes a 'regular' function and returns a version of that function that\n\t * returns a promise instead of a plain value, and handles thrown errors by\n\t * returning a rejected promise. Also accepts a list of arguments to be\n\t * prepended to the new function, as does Function.prototype.bind.\n\t *\n\t * The resulting function is promise-aware, in the sense that it accepts\n\t * promise arguments, and waits for their resolution.\n\t * @param {Function} f function to be bound\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * Composes multiple functions by piping their return values. It is\n\t * transparent to whether the functions return 'regular' values or promises:\n\t * the piped argument is always a resolved value. If one of the functions\n\t * throws or returns a rejected promise, the composed promise will be also\n\t * rejected.\n\t *\n\t * The arguments (or promises to arguments) given to the returned function (if\n\t * any), are passed directly to the first function on the 'pipeline'.\n\t * @param {Function} f the function to which the arguments will be passed\n\t * @param {...Function} [funcs] functions that will be composed, in order\n\t * @returns {Function} a promise-returning composition of the functions\n\t */\n\tfunction compose(f /*, funcs... */) {\n\t\tvar funcs = slice.call(arguments, 1);\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\tvar args = slice.call(arguments);\n\t\t\tvar firstPromise = attempt.apply(thisArg, [f].concat(args));\n\n\t\t\treturn when.reduce(funcs, function(arg, func) {\n\t\t\t\treturn func.call(thisArg, arg);\n\t\t\t}, firstPromise);\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Generalized promise concurrency guard\n * Adapted from original concept by Sakari Jokinen (Rocket Pack, Ltd.)\n *\n * @author Brian Cavalier\n * @author John Hann\n * @contributor Sakari Jokinen\n */\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar slice = Array.prototype.slice;\n\n\tguard.n = n;\n\n\treturn guard;\n\n\t/**\n\t * Creates a guarded version of f that can only be entered when the supplied\n\t * condition allows.\n\t * @param {function} condition represents a critical section that may only\n\t * be entered when allowed by the condition\n\t * @param {function} f function to guard\n\t * @returns {function} guarded version of f\n\t */\n\tfunction guard(condition, f) {\n\t\treturn function() {\n\t\t\tvar args = slice.call(arguments);\n\n\t\t\treturn when(condition()).withThis(this).then(function(exit) {\n\t\t\t\treturn when(f.apply(this, args))['finally'](exit);\n\t\t\t});\n\t\t};\n\t}\n\n\t/**\n\t * Creates a condition that allows only n simultaneous executions\n\t * of a guarded function\n\t * @param {number} allowed number of allowed simultaneous executions\n\t * @returns {function} condition function which returns a promise that\n\t * fulfills when the critical section may be entered. The fulfillment\n\t * value is a function (\"notifyExit\") that must be called when the critical\n\t * section has been exited.\n\t */\n\tfunction n(allowed) {\n\t\tvar count = 0;\n\t\tvar waiting = [];\n\n\t\treturn function enter() {\n\t\t\treturn when.promise(function(resolve) {\n\t\t\t\tif(count < allowed) {\n\t\t\t\t\tresolve(exit);\n\t\t\t\t} else {\n\t\t\t\t\twaiting.push(resolve);\n\t\t\t\t}\n\t\t\t\tcount += 1;\n\t\t\t});\n\t\t};\n\n\t\tfunction exit() {\n\t\t\tcount = Math.max(count - 1, 0);\n\t\t\tif(waiting.length > 0) {\n\t\t\t\twaiting.shift()(exit);\n\t\t\t}\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Licensed under the MIT License at:\n * http://www.opensource.org/licenses/mit-license.php\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar Promise = when.Promise;\n\tvar toPromise = when.resolve;\n\n\treturn {\n\t\tall: when.lift(all),\n\t\tmap: map,\n\t\tsettle: settle\n\t};\n\n\t/**\n\t * Resolve all the key-value pairs in the supplied object or promise\n\t * for an object.\n\t * @param {Promise|object} object or promise for object whose key-value pairs\n\t * will be resolved\n\t * @returns {Promise} promise for an object with the fully resolved key-value pairs\n\t */\n\tfunction all(object) {\n\t\tvar p = Promise._defer();\n\t\tvar resolver = Promise._handler(p);\n\n\t\tvar results = {};\n\t\tvar keys = Object.keys(object);\n\t\tvar pending = keys.length;\n\n\t\tfor(var i=0, k; i>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function flow(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\t\tvar reject = Promise.reject;\n\t\tvar origCatch = Promise.prototype['catch'];\n\n\t\t/**\n\t\t * Handle the ultimate fulfillment value or rejection reason, and assume\n\t\t * responsibility for all errors. If an error propagates out of result\n\t\t * or handleFatalError, it will be rethrown to the host, resulting in a\n\t\t * loud stack track on most platforms and a crash on some.\n\t\t * @param {function?} onResult\n\t\t * @param {function?} onError\n\t\t * @returns {undefined}\n\t\t */\n\t\tPromise.prototype.done = function(onResult, onError) {\n\t\t\tthis._handler.visit(this._handler.receiver, onResult, onError);\n\t\t};\n\n\t\t/**\n\t\t * Add Error-type and predicate matching to catch. Examples:\n\t\t * promise.catch(TypeError, handleTypeError)\n\t\t * .catch(predicate, handleMatchedErrors)\n\t\t * .catch(handleRemainingErrors)\n\t\t * @param onRejected\n\t\t * @returns {*}\n\t\t */\n\t\tPromise.prototype['catch'] = Promise.prototype.otherwise = function(onRejected) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\treturn origCatch.call(this, onRejected);\n\t\t\t}\n\n\t\t\tif(typeof onRejected !== 'function') {\n\t\t\t\treturn this.ensure(rejectInvalidPredicate);\n\t\t\t}\n\n\t\t\treturn origCatch.call(this, createCatchFilter(arguments[1], onRejected));\n\t\t};\n\n\t\t/**\n\t\t * Wraps the provided catch handler, so that it will only be called\n\t\t * if the predicate evaluates truthy\n\t\t * @param {?function} handler\n\t\t * @param {function} predicate\n\t\t * @returns {function} conditional catch handler\n\t\t */\n\t\tfunction createCatchFilter(handler, predicate) {\n\t\t\treturn function(e) {\n\t\t\t\treturn evaluatePredicate(e, predicate)\n\t\t\t\t\t? handler.call(this, e)\n\t\t\t\t\t: reject(e);\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Ensures that onFulfilledOrRejected will be called regardless of whether\n\t\t * this promise is fulfilled or rejected. onFulfilledOrRejected WILL NOT\n\t\t * receive the promises' value or reason. Any returned value will be disregarded.\n\t\t * onFulfilledOrRejected may throw or return a rejected promise to signal\n\t\t * an additional error.\n\t\t * @param {function} handler handler to be called regardless of\n\t\t * fulfillment or rejection\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['finally'] = Promise.prototype.ensure = function(handler) {\n\t\t\tif(typeof handler !== 'function') {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\treturn this.then(function(x) {\n\t\t\t\treturn runSideEffect(handler, this, identity, x);\n\t\t\t}, function(e) {\n\t\t\t\treturn runSideEffect(handler, this, reject, e);\n\t\t\t});\n\t\t};\n\n\t\tfunction runSideEffect (handler, thisArg, propagate, value) {\n\t\t\tvar result = handler.call(thisArg);\n\t\t\treturn maybeThenable(result)\n\t\t\t\t? propagateValue(result, propagate, value)\n\t\t\t\t: propagate(value);\n\t\t}\n\n\t\tfunction propagateValue (result, propagate, x) {\n\t\t\treturn resolve(result).then(function () {\n\t\t\t\treturn propagate(x);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Recover from a failure by returning a defaultValue. If defaultValue\n\t\t * is a promise, it's fulfillment value will be used. If defaultValue is\n\t\t * a promise that rejects, the returned promise will reject with the\n\t\t * same reason.\n\t\t * @param {*} defaultValue\n\t\t * @returns {Promise} new promise\n\t\t */\n\t\tPromise.prototype['else'] = Promise.prototype.orElse = function(defaultValue) {\n\t\t\treturn this.then(void 0, function() {\n\t\t\t\treturn defaultValue;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Shortcut for .then(function() { return value; })\n\t\t * @param {*} value\n\t\t * @return {Promise} a promise that:\n\t\t * - is fulfilled if value is not a promise, or\n\t\t * - if value is a promise, will fulfill with its value, or reject\n\t\t * with its reason.\n\t\t */\n\t\tPromise.prototype['yield'] = function(value) {\n\t\t\treturn this.then(function() {\n\t\t\t\treturn value;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Runs a side effect when this promise fulfills, without changing the\n\t\t * fulfillment value.\n\t\t * @param {function} onFulfilledSideEffect\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.tap = function(onFulfilledSideEffect) {\n\t\t\treturn this.then(onFulfilledSideEffect)['yield'](this);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n\tfunction rejectInvalidPredicate() {\n\t\tthrow new TypeError('catch predicate must be a function');\n\t}\n\n\tfunction evaluatePredicate(e, predicate) {\n\t\treturn isError(predicate) ? e instanceof predicate : predicate(e);\n\t}\n\n\tfunction isError(predicate) {\n\t\treturn predicate === Error\n\t\t\t|| (predicate != null && predicate.prototype instanceof Error);\n\t}\n\n\tfunction maybeThenable(x) {\n\t\treturn (typeof x === 'object' || typeof x === 'function') && x !== null;\n\t}\n\n\tfunction identity(x) {\n\t\treturn x;\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n/** @author Jeff Escalante */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function fold(Promise) {\n\n\t\tPromise.prototype.fold = function(f, z) {\n\t\t\tvar promise = this._beget();\n\n\t\t\tthis._handler.fold(function(z, x, to) {\n\t\t\t\tPromise._handler(z).fold(function(x, z, to) {\n\t\t\t\t\tto.resolve(f.call(this, z, x));\n\t\t\t\t}, x, this, to);\n\t\t\t}, z, promise._handler.receiver, promise._handler);\n\n\t\t\treturn promise;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar inspect = require('../state').inspect;\n\n\treturn function inspection(Promise) {\n\n\t\tPromise.prototype.inspect = function() {\n\t\t\treturn inspect(Promise._handler(this));\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function generate(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\n\t\tPromise.iterate = iterate;\n\t\tPromise.unfold = unfold;\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.iterate\n\t\t * Generate a (potentially infinite) stream of promised values:\n\t\t * x, f(x), f(f(x)), etc. until condition(x) returns true\n\t\t * @param {function} f function to generate a new x from the previous x\n\t\t * @param {function} condition function that, given the current x, returns\n\t\t * truthy when the iterate should stop\n\t\t * @param {function} handler function to handle the value produced by f\n\t\t * @param {*|Promise} x starting value, may be a promise\n\t\t * @return {Promise} the result of the last call to f before\n\t\t * condition returns true\n\t\t */\n\t\tfunction iterate(f, condition, handler, x) {\n\t\t\treturn unfold(function(x) {\n\t\t\t\treturn [x, f(x)];\n\t\t\t}, condition, handler, x);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.unfold\n\t\t * Generate a (potentially infinite) stream of promised values\n\t\t * by applying handler(generator(seed)) iteratively until\n\t\t * condition(seed) returns true.\n\t\t * @param {function} unspool function that generates a [value, newSeed]\n\t\t * given a seed.\n\t\t * @param {function} condition function that, given the current seed, returns\n\t\t * truthy when the unfold should stop\n\t\t * @param {function} handler function to handle the value produced by unspool\n\t\t * @param x {*|Promise} starting value, may be a promise\n\t\t * @return {Promise} the result of the last value produced by unspool before\n\t\t * condition returns true\n\t\t */\n\t\tfunction unfold(unspool, condition, handler, x) {\n\t\t\treturn resolve(x).then(function(seed) {\n\t\t\t\treturn resolve(condition(seed)).then(function(done) {\n\t\t\t\t\treturn done ? seed : resolve(unspool(seed)).spread(next);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tfunction next(item, newSeed) {\n\t\t\t\treturn resolve(handler(item)).then(function() {\n\t\t\t\t\treturn unfold(unspool, condition, handler, newSeed);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function progress(Promise) {\n\n\t\t/**\n\t\t * @deprecated\n\t\t * Register a progress handler for this promise\n\t\t * @param {function} onProgress\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.progress = function(onProgress) {\n\t\t\treturn this.then(void 0, void 0, onProgress);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar env = require('../env');\n\tvar TimeoutError = require('../TimeoutError');\n\n\tfunction setTimeout(f, ms, x, y) {\n\t\treturn env.setTimer(function() {\n\t\t\tf(x, y, ms);\n\t\t}, ms);\n\t}\n\n\treturn function timed(Promise) {\n\t\t/**\n\t\t * Return a new promise whose fulfillment value is revealed only\n\t\t * after ms milliseconds\n\t\t * @param {number} ms milliseconds\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.delay = function(ms) {\n\t\t\tvar p = this._beget();\n\t\t\tthis._handler.fold(handleDelay, ms, void 0, p._handler);\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction handleDelay(ms, x, h) {\n\t\t\tsetTimeout(resolveDelay, ms, x, h);\n\t\t}\n\n\t\tfunction resolveDelay(x, h) {\n\t\t\th.resolve(x);\n\t\t}\n\n\t\t/**\n\t\t * Return a new promise that rejects after ms milliseconds unless\n\t\t * this promise fulfills earlier, in which case the returned promise\n\t\t * fulfills with the same value.\n\t\t * @param {number} ms milliseconds\n\t\t * @param {Error|*=} reason optional rejection reason to use, defaults\n\t\t * to a TimeoutError if not provided\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.timeout = function(ms, reason) {\n\t\t\tvar p = this._beget();\n\t\t\tvar h = p._handler;\n\n\t\t\tvar t = setTimeout(onTimeout, ms, reason, p._handler);\n\n\t\t\tthis._handler.visit(h,\n\t\t\t\tfunction onFulfill(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.resolve(x); // this = h\n\t\t\t\t},\n\t\t\t\tfunction onReject(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.reject(x); // this = h\n\t\t\t\t},\n\t\t\t\th.notify);\n\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction onTimeout(reason, h, ms) {\n\t\t\tvar e = typeof reason === 'undefined'\n\t\t\t\t? new TimeoutError('timed out after ' + ms + 'ms')\n\t\t\t\t: reason;\n\t\t\th.reject(e);\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar setTimer = require('../env').setTimer;\n\tvar format = require('../format');\n\n\treturn function unhandledRejection(Promise) {\n\n\t\tvar logError = noop;\n\t\tvar logInfo = noop;\n\t\tvar localConsole;\n\n\t\tif(typeof console !== 'undefined') {\n\t\t\t// Alias console to prevent things like uglify's drop_console option from\n\t\t\t// removing console.log/error. Unhandled rejections fall into the same\n\t\t\t// category as uncaught exceptions, and build tools shouldn't silence them.\n\t\t\tlocalConsole = console;\n\t\t\tlogError = typeof localConsole.error !== 'undefined'\n\t\t\t\t? function (e) { localConsole.error(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\n\t\t\tlogInfo = typeof localConsole.info !== 'undefined'\n\t\t\t\t? function (e) { localConsole.info(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\t\t}\n\n\t\tPromise.onPotentiallyUnhandledRejection = function(rejection) {\n\t\t\tenqueue(report, rejection);\n\t\t};\n\n\t\tPromise.onPotentiallyUnhandledRejectionHandled = function(rejection) {\n\t\t\tenqueue(unreport, rejection);\n\t\t};\n\n\t\tPromise.onFatalRejection = function(rejection) {\n\t\t\tenqueue(throwit, rejection.value);\n\t\t};\n\n\t\tvar tasks = [];\n\t\tvar reported = [];\n\t\tvar running = null;\n\n\t\tfunction report(r) {\n\t\t\tif(!r.handled) {\n\t\t\t\treported.push(r);\n\t\t\t\tlogError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction unreport(r) {\n\t\t\tvar i = reported.indexOf(r);\n\t\t\tif(i >= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function addWith(Promise) {\n\t\t/**\n\t\t * Returns a promise whose handlers will be called with `this` set to\n\t\t * the supplied receiver. Subsequent promises derived from the\n\t\t * returned promise will also have their handlers called with receiver\n\t\t * as `this`. Calling `with` with undefined or no arguments will return\n\t\t * a promise whose handlers will again be called in the usual Promises/A+\n\t\t * way (no `this`) thus safely undoing any previous `with` in the\n\t\t * promise chain.\n\t\t *\n\t\t * WARNING: Promises returned from `with`/`withThis` are NOT Promises/A+\n\t\t * compliant, specifically violating 2.2.5 (http://promisesaplus.com/#point-41)\n\t\t *\n\t\t * @param {object} receiver `this` value for all handlers attached to\n\t\t * the returned promise.\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['with'] = Promise.prototype.withThis = function(receiver) {\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\t\t\tchild.receiver = receiver;\n\t\t\tthis._handler.chain(child, receiver);\n\t\t\treturn p;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t return (typeof MutationObserver !== 'undefined' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function liftAll(liftOne, combine, dst, src) {\n\t\tif(typeof combine === 'undefined') {\n\t\t\tcombine = defaultCombine;\n\t\t}\n\n\t\treturn Object.keys(src).reduce(function(dst, key) {\n\t\t\tvar f = src[key];\n\t\t\treturn typeof f === 'function' ? combine(dst, liftOne(f), key) : dst;\n\t\t}, typeof dst === 'undefined' ? defaultDst(src) : dst);\n\t};\n\n\tfunction defaultCombine(o, f, k) {\n\t\to[k] = f;\n\t\treturn o;\n\t}\n\n\tfunction defaultDst(src) {\n\t\treturn typeof src === 'function' ? src.bind() : Object.create(src);\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0 ? toFulfilledState(handler.value)\n\t\t\t : toRejectedState(handler.value);\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2013 original author or authors */\n\n/**\n * Collection of helpers for interfacing with node-style asynchronous functions\n * using promises.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar _liftAll = require('./lib/liftAll');\n\tvar setTimer = require('./lib/env').setTimer;\n\tvar slice = Array.prototype.slice;\n\n\tvar _apply = require('./lib/apply')(when.Promise, dispatch);\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tapply: apply,\n\t\tcall: call,\n\t\tcreateCallback: createCallback,\n\t\tbindCallback: bindCallback,\n\t\tliftCallback: liftCallback\n\t};\n\n\t/**\n\t * Takes a node-style async function and calls it immediately (with an optional\n\t * array of arguments or promises for arguments). It returns a promise whose\n\t * resolution depends on whether the async functions calls its callback with the\n\t * conventional error argument or not.\n\t *\n\t * With this it becomes possible to leverage existing APIs while still reaping\n\t * the benefits of promises.\n\t *\n\t * @example\n\t * function onlySmallNumbers(n, callback) {\n\t *\t\tif(n < 10) {\n\t *\t\t\tcallback(null, n + 10);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * var nodefn = require(\"when/node/function\");\n\t *\n\t * // Logs '15'\n\t * nodefn.apply(onlySmallNumbers, [5]).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.apply(onlySmallNumbers, [15]).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction apply(f, args) {\n\t\treturn _apply(f, this, args || []);\n\t}\n\n\tfunction dispatch(f, thisArg, args, h) {\n\t\tvar cb = createCallback(h);\n\t\ttry {\n\t\t\tswitch(args.length) {\n\t\t\t\tcase 2: f.call(thisArg, args[0], args[1], cb); break;\n\t\t\t\tcase 1: f.call(thisArg, args[0], cb); break;\n\t\t\t\tcase 0: f.call(thisArg, cb); break;\n\t\t\t\tdefault:\n\t\t\t\t\targs.push(cb);\n\t\t\t\t\tf.apply(thisArg, args);\n\t\t\t}\n\t\t} catch(e) {\n\t\t\th.reject(e);\n\t\t}\n\t}\n\n\t/**\n\t * Has the same behavior that {@link apply} has, with the difference that the\n\t * arguments to the function are provided individually, while {@link apply} accepts\n\t * a single array.\n\t *\n\t * @example\n\t * function sumSmallNumbers(x, y, callback) {\n\t *\t\tvar result = x + y;\n\t *\t\tif(result < 10) {\n\t *\t\t\tcallback(null, result);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * // Logs '5'\n\t * nodefn.call(sumSmallNumbers, 2, 3).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.call(sumSmallNumbers, 5, 10).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {...*} [args] arguments that will be forwarded to the function\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction call(f /*, args... */) {\n\t\treturn _apply(f, this, slice.call(arguments, 1));\n\t}\n\n\t/**\n\t * Takes a node-style function and returns new function that wraps the\n\t * original and, instead of taking a callback, returns a promise. Also, it\n\t * knows how to handle promises given as arguments, waiting for their\n\t * resolution before executing.\n\t *\n\t * Upon execution, the orginal function is executed as well. If it passes\n\t * a truthy value as the first argument to the callback, it will be\n\t * interpreted as an error condition, and the promise will be rejected\n\t * with it. Otherwise, the call is considered a resolution, and the promise\n\t * is resolved with the callback's second argument.\n\t *\n\t * @example\n\t * var fs = require(\"fs\"), nodefn = require(\"when/node/function\");\n\t *\n\t * var promiseRead = nodefn.lift(fs.readFile);\n\t *\n\t * // The promise is resolved with the contents of the file if everything\n\t * // goes ok\n\t * promiseRead('exists.txt').then(console.log, console.error);\n\t *\n\t * // And will be rejected if something doesn't work out\n\t * // (e.g. the files does not exist)\n\t * promiseRead('doesnt_exist.txt').then(console.log, console.error);\n\t *\n\t *\n\t * @param {Function} f node-style function to be lifted\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args1 = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\t// TODO: Simplify once partialing has been removed\n\t\t\tvar l = args1.length;\n\t\t\tvar al = arguments.length;\n\t\t\tvar args = new Array(al + l);\n\t\t\tvar i;\n\t\t\tfor(i=0; i 2) {\n\t\t\t\tresolver.resolve(slice.call(arguments, 1));\n\t\t\t} else {\n\t\t\t\tresolver.resolve(value);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Attaches a node-style callback to a promise, ensuring the callback is\n\t * called for either fulfillment or rejection. Returns a promise with the same\n\t * state as the passed-in promise.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tbindCallback(deferred.promise, callback);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Promise} promise The promise to be attached to.\n\t * @param {Function} callback The node-style callback to attach.\n\t * @returns {Promise} A promise with the same state as the passed-in promise.\n\t */\n\tfunction bindCallback(promise, callback) {\n\t\tpromise = when(promise);\n\n\t\tif (callback) {\n\t\t\tpromise.then(success, wrapped);\n\t\t}\n\n\t\treturn promise;\n\n\t\tfunction success(value) {\n\t\t\twrapped(null, value);\n\t\t}\n\n\t\tfunction wrapped(err, value) {\n\t\t\tsetTimer(function () {\n\t\t\t\tcallback(err, value);\n\t\t\t}, 0);\n\t\t}\n\t}\n\n\t/**\n\t * Takes a node-style callback and returns new function that accepts a\n\t * promise, calling the original callback when the promise is either\n\t * fulfilled or rejected with the appropriate arguments.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tvar wrapped = liftCallback(callback);\n\t *\n\t *\t// `wrapped` can now be passed around at will\n\t *\twrapped(deferred.promise);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Function} callback The node-style callback to wrap.\n\t * @returns {Function} The lifted, promise-accepting function.\n\t */\n\tfunction liftCallback(callback) {\n\t\treturn function(promise) {\n\t\t\treturn bindCallback(promise, callback);\n\t\t};\n\t}\n});\n\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * parallel.js\n *\n * Run a set of task functions in parallel. All tasks will\n * receive the same args\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in parallel\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for array containing the\n\t * result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function parallel(tasks /*, args... */) {\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.map(tasks, function(task) {\n\t\t\t\treturn task.apply(void 0, args);\n\t\t\t});\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * pipeline.js\n *\n * Run a set of task functions in sequence, passing the result\n * of the previous as an argument to the next. Like a shell\n * pipeline, e.g. `cat file.txt | grep 'foo' | sed -e 's/foo/bar/g'\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in a pipeline where the next\n\t * tasks receives the result of the previous. The first task\n\t * will receive the initialArgs as its argument list.\n\t * @param tasks {Array|Promise} array or promise for array of task functions\n\t * @param [initialArgs...] {*} arguments to be passed to the first task\n\t * @return {Promise} promise for return value of the final task\n\t */\n\treturn function pipeline(tasks /* initialArgs... */) {\n\t\t// Self-optimizing function to run first task with multiple\n\t\t// args using apply, but subsequence tasks via direct invocation\n\t\tvar runTask = function(args, task) {\n\t\t\trunTask = function(arg, task) {\n\t\t\t\treturn task(arg);\n\t\t\t};\n\n\t\t\treturn task.apply(null, args);\n\t\t};\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(arg, task) {\n\t\t\t\treturn runTask(arg, task);\n\t\t\t}, args);\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2012-2013 original author or authors */\n\n/**\n * poll.js\n *\n * Helper that polls until cancelled or for a condition to become true.\n *\n * @author Scott Andrews\n */\n\n(function (define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar cancelable = require('./cancelable');\n\n\t/**\n\t * Periodically execute the task function on the msec delay. The result of\n\t * the task may be verified by watching for a condition to become true. The\n\t * returned deferred is cancellable if the polling needs to be cancelled\n\t * externally before reaching a resolved state.\n\t *\n\t * The next vote is scheduled after the results of the current vote are\n\t * verified and rejected.\n\t *\n\t * Polling may be terminated by the verifier returning a truthy value,\n\t * invoking cancel() on the returned promise, or the task function returning\n\t * a rejected promise.\n\t *\n\t * Usage:\n\t *\n\t * var count = 0;\n\t * function doSomething() { return count++ }\n\t *\n\t * // poll until cancelled\n\t * var p = poll(doSomething, 1000);\n\t * ...\n\t * p.cancel();\n\t *\n\t * // poll until condition is met\n\t * poll(doSomething, 1000, function(result) { return result > 10 })\n\t * .then(function(result) { assert result == 10 });\n\t *\n\t * // delay first vote\n\t * poll(doSomething, 1000, anyFunc, true);\n\t *\n\t * @param task {Function} function that is executed after every timeout\n\t * @param interval {number|Function} timeout in milliseconds\n\t * @param [verifier] {Function} function to evaluate the result of the vote.\n\t * May return a {Promise} or a {Boolean}. Rejecting the promise or a\n\t * falsey value will schedule the next vote.\n\t * @param [delayInitialTask] {boolean} if truthy, the first vote is scheduled\n\t * instead of immediate\n\t *\n\t * @returns {Promise}\n\t */\n\treturn function poll(task, interval, verifier, delayInitialTask) {\n\t\tvar deferred, canceled, reject;\n\n\t\tcanceled = false;\n\t\tdeferred = cancelable(when.defer(), function () { canceled = true; });\n\t\treject = deferred.reject;\n\n\t\tverifier = verifier || function () { return false; };\n\n\t\tif (typeof interval !== 'function') {\n\t\t\tinterval = (function (interval) {\n\t\t\t\treturn function () { return when().delay(interval); };\n\t\t\t})(interval);\n\t\t}\n\n\t\tfunction certify(result) {\n\t\t\tdeferred.resolve(result);\n\t\t}\n\n\t\tfunction schedule(result) {\n\t\t\tattempt(interval).then(vote, reject);\n\t\t\tif (result !== void 0) {\n\t\t\t\tdeferred.notify(result);\n\t\t\t}\n\t\t}\n\n\t\tfunction vote() {\n\t\t\tif (canceled) { return; }\n\t\t\twhen(task(),\n\t\t\t\tfunction (result) {\n\t\t\t\t\twhen(verifier(result),\n\t\t\t\t\t\tfunction (verification) {\n\t\t\t\t\t\t\treturn verification ? certify(result) : schedule(result);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfunction () { schedule(result); }\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\treject\n\t\t\t);\n\t\t}\n\n\t\tif (delayInitialTask) {\n\t\t\tschedule();\n\t\t} else {\n\t\t\t// if task() is blocking, vote will also block\n\t\t\tvote();\n\t\t}\n\n\t\t// make the promise cancelable\n\t\tdeferred.promise = Object.create(deferred.promise);\n\t\tdeferred.promise.cancel = deferred.cancel;\n\n\t\treturn deferred.promise;\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * sequence.js\n *\n * Run a set of task functions in sequence. All tasks will\n * receive the same args.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in sequence with no overlap\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for an array containing\n\t * the result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function sequence(tasks /*, args... */) {\n\t\tvar results = [];\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(results, task) {\n\t\t\t\treturn when(task.apply(void 0, args), addResult);\n\t\t\t}, results);\n\t\t});\n\n\t\tfunction addResult(result) {\n\t\t\tresults.push(result);\n\t\t\treturn results;\n\t\t}\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * timeout.js\n *\n * Helper that returns a promise that rejects after a specified timeout,\n * if not explicitly resolved or rejected before that.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(trigger).timeout(ms)\n */\n return function timeout(msec, trigger) {\n\t\treturn when(trigger).timeout(msec);\n };\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n\n/**\n * Promises/A+ and when() implementation\n * when is part of the cujoJS family of libraries (http://cujojs.com/)\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function (require) {\n\n\tvar timed = require('./lib/decorators/timed');\n\tvar array = require('./lib/decorators/array');\n\tvar flow = require('./lib/decorators/flow');\n\tvar fold = require('./lib/decorators/fold');\n\tvar inspect = require('./lib/decorators/inspect');\n\tvar generate = require('./lib/decorators/iterate');\n\tvar progress = require('./lib/decorators/progress');\n\tvar withThis = require('./lib/decorators/with');\n\tvar unhandledRejection = require('./lib/decorators/unhandledRejection');\n\tvar TimeoutError = require('./lib/TimeoutError');\n\n\tvar Promise = [array, flow, fold, generate, progress,\n\t\tinspect, withThis, timed, unhandledRejection]\n\t\t.reduce(function(Promise, feature) {\n\t\t\treturn feature(Promise);\n\t\t}, require('./lib/Promise'));\n\n\tvar apply = require('./lib/apply')(Promise);\n\n\t// Public API\n\n\twhen.promise = promise; // Create a pending promise\n\twhen.resolve = Promise.resolve; // Create a resolved promise\n\twhen.reject = Promise.reject; // Create a rejected promise\n\n\twhen.lift = lift; // lift a function to return promises\n\twhen['try'] = attempt; // call a function and return a promise\n\twhen.attempt = attempt; // alias for when.try\n\n\twhen.iterate = Promise.iterate; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\twhen.unfold = Promise.unfold; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\n\twhen.join = join; // Join 2 or more promises\n\n\twhen.all = all; // Resolve a list of promises\n\twhen.settle = settle; // Settle a list of promises\n\n\twhen.any = lift(Promise.any); // One-winner race\n\twhen.some = lift(Promise.some); // Multi-winner race\n\twhen.race = lift(Promise.race); // First-to-settle race\n\n\twhen.map = map; // Array.map() for promises\n\twhen.filter = filter; // Array.filter() for promises\n\twhen.reduce = lift(Promise.reduce); // Array.reduce() for promises\n\twhen.reduceRight = lift(Promise.reduceRight); // Array.reduceRight() for promises\n\n\twhen.isPromiseLike = isPromiseLike; // Is something promise-like, aka thenable\n\n\twhen.Promise = Promise; // Promise constructor\n\twhen.defer = defer; // Create a {promise, resolve, reject} tuple\n\n\t// Error types\n\n\twhen.TimeoutError = TimeoutError;\n\n\t/**\n\t * Get a trusted promise for x, or by transforming x with onFulfilled\n\t *\n\t * @param {*} x\n\t * @param {function?} onFulfilled callback to be called when x is\n\t * successfully fulfilled. If promiseOrValue is an immediate value, callback\n\t * will be invoked immediately.\n\t * @param {function?} onRejected callback to be called when x is\n\t * rejected.\n\t * @param {function?} onProgress callback to be called when progress updates\n\t * are issued for x. @deprecated\n\t * @returns {Promise} a new promise that will fulfill with the return\n\t * value of callback or errback or the completion value of promiseOrValue if\n\t * callback and/or errback is not supplied.\n\t */\n\tfunction when(x, onFulfilled, onRejected, onProgress) {\n\t\tvar p = Promise.resolve(x);\n\t\tif (arguments.length < 2) {\n\t\t\treturn p;\n\t\t}\n\n\t\treturn p.then(onFulfilled, onRejected, onProgress);\n\t}\n\n\t/**\n\t * Creates a new promise whose fate is determined by resolver.\n\t * @param {function} resolver function(resolve, reject, notify)\n\t * @returns {Promise} promise whose fate is determine by resolver\n\t */\n\tfunction promise(resolver) {\n\t\treturn new Promise(resolver);\n\t}\n\n\t/**\n\t * Lift the supplied function, creating a version of f that returns\n\t * promises, and accepts promises as arguments.\n\t * @param {function} f\n\t * @returns {Function} version of f that returns promises\n\t */\n\tfunction lift(f) {\n\t\treturn function() {\n\t\t\tfor(var i=0, l=arguments.length, a=new Array(l); i 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * `promisify` is a version of `lift` that allows fine-grained control over the\n\t * arguments that passed to the underlying function. It is intended to handle\n\t * functions that don't follow the common callback and errback positions.\n\t *\n\t * The control is done by passing an object whose 'callback' and/or 'errback'\n\t * keys, whose values are the corresponding 0-based indexes of the arguments on\n\t * the function. Negative values are interpreted as being relative to the end\n\t * of the arguments array.\n\t *\n\t * If arguments are given on the call to the 'promisified' function, they are\n\t * intermingled with the callback and errback. If a promise is given among them,\n\t * the execution of the function will only occur after its resolution.\n\t *\n\t * @example\n\t * var delay = callbacks.promisify(setTimeout, {\n\t *\t\tcallback: 0\n\t *\t});\n\t *\n\t * delay(100).then(function() {\n\t *\t\tconsole.log(\"This happens 100ms afterwards\");\n\t *\t});\n\t *\n\t * @example\n\t * function callbackAsLast(errback, followsStandards, callback) {\n\t *\t\tif(followsStandards) {\n\t *\t\t\tcallback(\"well done!\");\n\t *\t\t} else {\n\t *\t\t\terrback(\"some programmers just want to watch the world burn\");\n\t *\t\t}\n\t *\t}\n\t *\n\t * var promisified = callbacks.promisify(callbackAsLast, {\n\t *\t\tcallback: -1,\n\t *\t\terrback: 0,\n\t *\t});\n\t *\n\t * promisified(true).then(console.log, console.error);\n\t * promisified(false).then(console.log, console.error);\n\t *\n\t * @param {Function} asyncFunction traditional function to be decorated\n\t * @param {object} positions\n\t * @param {number} [positions.callback] index at which asyncFunction expects to\n\t * receive a success callback\n\t * @param {number} [positions.errback] index at which asyncFunction expects to\n\t * receive an error callback\n\t * @returns {function} promisified function that accepts\n\t *\n\t * @deprecated\n\t */\n\tfunction promisify(asyncFunction, positions) {\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\treturn Promise.all(arguments).then(function(args) {\n\t\t\t\tvar p = Promise._defer();\n\n\t\t\t\tvar callbackPos, errbackPos;\n\n\t\t\t\tif(typeof positions.callback === 'number') {\n\t\t\t\t\tcallbackPos = normalizePosition(args, positions.callback);\n\t\t\t\t}\n\n\t\t\t\tif(typeof positions.errback === 'number') {\n\t\t\t\t\terrbackPos = normalizePosition(args, positions.errback);\n\t\t\t\t}\n\n\t\t\t\tif(errbackPos < callbackPos) {\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t} else {\n\t\t\t\t\tinsertCallback(args, callbackPos, p._handler.resolve, p._handler);\n\t\t\t\t\tinsertCallback(args, errbackPos, p._handler.reject, p._handler);\n\t\t\t\t}\n\n\t\t\t\tasyncFunction.apply(thisArg, args);\n\n\t\t\t\treturn p;\n\t\t\t});\n\t\t};\n\t}\n\n\tfunction normalizePosition(args, pos) {\n\t\treturn pos < 0 ? (args.length + pos + 2) : pos;\n\t}\n\n\tfunction insertCallback(args, pos, callback, thisArg) {\n\t\tif(typeof pos === 'number') {\n\t\t\targs.splice(pos, 0, alwaysUnary(callback, thisArg));\n\t\t}\n\t}\n\n\tfunction alwaysUnary(fn, thisArg) {\n\t\treturn function() {\n\t\t\tif (arguments.length > 1) {\n\t\t\t\tfn.call(thisArg, slice.call(arguments));\n\t\t\t} else {\n\t\t\t\tfn.apply(thisArg, arguments);\n\t\t\t}\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright B Cavalier & J Hann */\n\n/**\n * cancelable.js\n * @deprecated\n *\n * Decorator that makes a deferred \"cancelable\". It adds a cancel() method that\n * will call a special cancel handler function and then reject the deferred. The\n * cancel handler can be used to do resource cleanup, or anything else that should\n * be done before any other rejection handlers are executed.\n *\n * Usage:\n *\n * var cancelableDeferred = cancelable(when.defer(), myCancelHandler);\n *\n * @author brian@hovercraftstudios.com\n */\n\n(function(define) {\ndefine(function() {\n\n /**\n * Makes deferred cancelable, adding a cancel() method.\n\t * @deprecated\n *\n * @param deferred {Deferred} the {@link Deferred} to make cancelable\n * @param canceler {Function} cancel handler function to execute when this deferred\n\t * is canceled. This is guaranteed to run before all other rejection handlers.\n\t * The canceler will NOT be executed if the deferred is rejected in the standard\n\t * way, i.e. deferred.reject(). It ONLY executes if the deferred is canceled,\n\t * i.e. deferred.cancel()\n *\n * @returns deferred, with an added cancel() method.\n */\n return function(deferred, canceler) {\n // Add a cancel method to the deferred to reject the delegate\n // with the special canceled indicator.\n deferred.cancel = function() {\n\t\t\ttry {\n\t\t\t\tdeferred.reject(canceler(deferred));\n\t\t\t} catch(e) {\n\t\t\t\tdeferred.reject(e);\n\t\t\t}\n\n\t\t\treturn deferred.promise;\n };\n\n return deferred;\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * delay.js\n *\n * Helper that returns a promise that resolves after a delay.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(value).delay(ms)\n */\n return function delay(msec, value) {\n\t\treturn when(value).delay(msec);\n };\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2013-2014 original author or authors */\n\n/**\n * Collection of helper functions for wrapping and executing 'traditional'\n * synchronous functions in a promise interface.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar _liftAll = require('./lib/liftAll');\n\tvar _apply = require('./lib/apply')(when.Promise);\n\tvar slice = Array.prototype.slice;\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tcall: attempt,\n\t\tapply: apply,\n\t\tcompose: compose\n\t};\n\n\t/**\n\t * Takes a function and an optional array of arguments (that might be promises),\n\t * and calls the function. The return value is a promise whose resolution\n\t * depends on the value returned by the function.\n\t * @param {function} f function to be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the return value of func\n\t */\n\tfunction apply(f, args) {\n\t\t// slice args just in case the caller passed an Arguments instance\n\t\treturn _apply(f, this, args == null ? [] : slice.call(args));\n\t}\n\n\t/**\n\t * Takes a 'regular' function and returns a version of that function that\n\t * returns a promise instead of a plain value, and handles thrown errors by\n\t * returning a rejected promise. Also accepts a list of arguments to be\n\t * prepended to the new function, as does Function.prototype.bind.\n\t *\n\t * The resulting function is promise-aware, in the sense that it accepts\n\t * promise arguments, and waits for their resolution.\n\t * @param {Function} f function to be bound\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\treturn _apply(f, this, args.concat(slice.call(arguments)));\n\t\t};\n\t}\n\n\t/**\n\t * Lift all the functions/methods on src\n\t * @param {object|function} src source whose functions will be lifted\n\t * @param {function?} combine optional function for customizing the lifting\n\t * process. It is passed dst, the lifted function, and the property name of\n\t * the original function on src.\n\t * @param {(object|function)?} dst option destination host onto which to place lifted\n\t * functions. If not provided, liftAll returns a new object.\n\t * @returns {*} If dst is provided, returns dst with lifted functions as\n\t * properties. If dst not provided, returns a new object with lifted functions.\n\t */\n\tfunction liftAll(src, combine, dst) {\n\t\treturn _liftAll(lift, combine, dst, src);\n\t}\n\n\t/**\n\t * Composes multiple functions by piping their return values. It is\n\t * transparent to whether the functions return 'regular' values or promises:\n\t * the piped argument is always a resolved value. If one of the functions\n\t * throws or returns a rejected promise, the composed promise will be also\n\t * rejected.\n\t *\n\t * The arguments (or promises to arguments) given to the returned function (if\n\t * any), are passed directly to the first function on the 'pipeline'.\n\t * @param {Function} f the function to which the arguments will be passed\n\t * @param {...Function} [funcs] functions that will be composed, in order\n\t * @returns {Function} a promise-returning composition of the functions\n\t */\n\tfunction compose(f /*, funcs... */) {\n\t\tvar funcs = slice.call(arguments, 1);\n\n\t\treturn function() {\n\t\t\tvar thisArg = this;\n\t\t\tvar args = slice.call(arguments);\n\t\t\tvar firstPromise = attempt.apply(thisArg, [f].concat(args));\n\n\t\t\treturn when.reduce(funcs, function(arg, func) {\n\t\t\t\treturn func.call(thisArg, arg);\n\t\t\t}, firstPromise);\n\t\t};\n\t}\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Generalized promise concurrency guard\n * Adapted from original concept by Sakari Jokinen (Rocket Pack, Ltd.)\n *\n * @author Brian Cavalier\n * @author John Hann\n * @contributor Sakari Jokinen\n */\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar slice = Array.prototype.slice;\n\n\tguard.n = n;\n\n\treturn guard;\n\n\t/**\n\t * Creates a guarded version of f that can only be entered when the supplied\n\t * condition allows.\n\t * @param {function} condition represents a critical section that may only\n\t * be entered when allowed by the condition\n\t * @param {function} f function to guard\n\t * @returns {function} guarded version of f\n\t */\n\tfunction guard(condition, f) {\n\t\treturn function() {\n\t\t\tvar args = slice.call(arguments);\n\n\t\t\treturn when(condition()).withThis(this).then(function(exit) {\n\t\t\t\treturn when(f.apply(this, args))['finally'](exit);\n\t\t\t});\n\t\t};\n\t}\n\n\t/**\n\t * Creates a condition that allows only n simultaneous executions\n\t * of a guarded function\n\t * @param {number} allowed number of allowed simultaneous executions\n\t * @returns {function} condition function which returns a promise that\n\t * fulfills when the critical section may be entered. The fulfillment\n\t * value is a function (\"notifyExit\") that must be called when the critical\n\t * section has been exited.\n\t */\n\tfunction n(allowed) {\n\t\tvar count = 0;\n\t\tvar waiting = [];\n\n\t\treturn function enter() {\n\t\t\treturn when.promise(function(resolve) {\n\t\t\t\tif(count < allowed) {\n\t\t\t\t\tresolve(exit);\n\t\t\t\t} else {\n\t\t\t\t\twaiting.push(resolve);\n\t\t\t\t}\n\t\t\t\tcount += 1;\n\t\t\t});\n\t\t};\n\n\t\tfunction exit() {\n\t\t\tcount = Math.max(count - 1, 0);\n\t\t\tif(waiting.length > 0) {\n\t\t\t\twaiting.shift()(exit);\n\t\t\t}\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * Licensed under the MIT License at:\n * http://www.opensource.org/licenses/mit-license.php\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar Promise = when.Promise;\n\tvar toPromise = when.resolve;\n\n\treturn {\n\t\tall: when.lift(all),\n\t\tmap: map,\n\t\tsettle: settle\n\t};\n\n\t/**\n\t * Resolve all the key-value pairs in the supplied object or promise\n\t * for an object.\n\t * @param {Promise|object} object or promise for object whose key-value pairs\n\t * will be resolved\n\t * @returns {Promise} promise for an object with the fully resolved key-value pairs\n\t */\n\tfunction all(object) {\n\t\tvar p = Promise._defer();\n\t\tvar resolver = Promise._handler(p);\n\n\t\tvar results = {};\n\t\tvar keys = Object.keys(object);\n\t\tvar pending = keys.length;\n\n\t\tfor(var i=0, k; i>>0;\n\n\t\t\tvar pending = l;\n\t\t\tvar errors = [];\n\n\t\t\tfor (var h, x, i = 0; i < l; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif(x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = Promise._handler(x);\n\t\t\t\tif(h.state() > 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tPromise._visitRemaining(promises, i, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, handleFulfill, handleReject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.reject(new RangeError('any(): array must not be empty'));\n\t\t\t}\n\n\t\t\treturn p;\n\n\t\t\tfunction handleFulfill(x) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\terrors = null;\n\t\t\t\tthis.resolve(x); // this === resolver\n\t\t\t}\n\n\t\t\tfunction handleReject(e) {\n\t\t\t\t/*jshint validthis:true*/\n\t\t\t\tif(this.resolved) { // this === resolver\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\terrors.push(e);\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tthis.reject(errors);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * N-winner competitive race\n\t\t * Return a promise that will fulfill when n input promises have\n\t\t * fulfilled, or will reject when it becomes impossible for n\n\t\t * input promises to fulfill (ie when promises.length - n + 1\n\t\t * have rejected)\n\t\t * @param {array} promises\n\t\t * @param {number} n\n\t\t * @returns {Promise} promise for the earliest n fulfillment values\n\t\t *\n\t\t * @deprecated\n\t\t */\n\t\tfunction some(promises, n) {\n\t\t\t/*jshint maxcomplexity:7*/\n\t\t\tvar p = Promise._defer();\n\t\t\tvar resolver = p._handler;\n\n\t\t\tvar results = [];\n\t\t\tvar errors = [];\n\n\t\t\tvar l = promises.length>>>0;\n\t\t\tvar nFulfill = 0;\n\t\t\tvar nReject;\n\t\t\tvar x, i; // reused in both for() loops\n\n\t\t\t// First pass: count actual array items\n\t\t\tfor(i=0; i nFulfill) {\n\t\t\t\tresolver.reject(new RangeError('some(): array must contain at least '\n\t\t\t\t+ n + ' item(s), but had ' + nFulfill));\n\t\t\t} else if(nFulfill === 0) {\n\t\t\t\tresolver.resolve(results);\n\t\t\t}\n\n\t\t\t// Second pass: observe each array item, make progress toward goals\n\t\t\tfor(i=0; i 2 ? ar.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: ar.call(promises, liftCombine(f));\n\t\t}\n\n\t\t/**\n\t\t * Traditional reduce function, similar to `Array.prototype.reduceRight()`, but\n\t\t * input may contain promises and/or values, and reduceFunc\n\t\t * may return either a value or a promise, *and* initialValue may\n\t\t * be a promise for the starting value.\n\t\t * @param {Array|Promise} promises array or promise for an array of anything,\n\t\t * may contain a mix of promises and values.\n\t\t * @param {function(accumulated:*, x:*, index:Number):*} f reduce function\n\t\t * @returns {Promise} that will resolve to the final reduced value\n\t\t */\n\t\tfunction reduceRight(promises, f /*, initialValue */) {\n\t\t\treturn arguments.length > 2 ? arr.call(promises, liftCombine(f), arguments[2])\n\t\t\t\t\t: arr.call(promises, liftCombine(f));\n\t\t}\n\n\t\tfunction liftCombine(f) {\n\t\t\treturn function(z, x, i) {\n\t\t\t\treturn applyFold(f, void 0, [z,x,i]);\n\t\t\t};\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function flow(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\t\tvar reject = Promise.reject;\n\t\tvar origCatch = Promise.prototype['catch'];\n\n\t\t/**\n\t\t * Handle the ultimate fulfillment value or rejection reason, and assume\n\t\t * responsibility for all errors. If an error propagates out of result\n\t\t * or handleFatalError, it will be rethrown to the host, resulting in a\n\t\t * loud stack track on most platforms and a crash on some.\n\t\t * @param {function?} onResult\n\t\t * @param {function?} onError\n\t\t * @returns {undefined}\n\t\t */\n\t\tPromise.prototype.done = function(onResult, onError) {\n\t\t\tthis._handler.visit(this._handler.receiver, onResult, onError);\n\t\t};\n\n\t\t/**\n\t\t * Add Error-type and predicate matching to catch. Examples:\n\t\t * promise.catch(TypeError, handleTypeError)\n\t\t * .catch(predicate, handleMatchedErrors)\n\t\t * .catch(handleRemainingErrors)\n\t\t * @param onRejected\n\t\t * @returns {*}\n\t\t */\n\t\tPromise.prototype['catch'] = Promise.prototype.otherwise = function(onRejected) {\n\t\t\tif (arguments.length < 2) {\n\t\t\t\treturn origCatch.call(this, onRejected);\n\t\t\t}\n\n\t\t\tif(typeof onRejected !== 'function') {\n\t\t\t\treturn this.ensure(rejectInvalidPredicate);\n\t\t\t}\n\n\t\t\treturn origCatch.call(this, createCatchFilter(arguments[1], onRejected));\n\t\t};\n\n\t\t/**\n\t\t * Wraps the provided catch handler, so that it will only be called\n\t\t * if the predicate evaluates truthy\n\t\t * @param {?function} handler\n\t\t * @param {function} predicate\n\t\t * @returns {function} conditional catch handler\n\t\t */\n\t\tfunction createCatchFilter(handler, predicate) {\n\t\t\treturn function(e) {\n\t\t\t\treturn evaluatePredicate(e, predicate)\n\t\t\t\t\t? handler.call(this, e)\n\t\t\t\t\t: reject(e);\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Ensures that onFulfilledOrRejected will be called regardless of whether\n\t\t * this promise is fulfilled or rejected. onFulfilledOrRejected WILL NOT\n\t\t * receive the promises' value or reason. Any returned value will be disregarded.\n\t\t * onFulfilledOrRejected may throw or return a rejected promise to signal\n\t\t * an additional error.\n\t\t * @param {function} handler handler to be called regardless of\n\t\t * fulfillment or rejection\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['finally'] = Promise.prototype.ensure = function(handler) {\n\t\t\tif(typeof handler !== 'function') {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\treturn this.then(function(x) {\n\t\t\t\treturn runSideEffect(handler, this, identity, x);\n\t\t\t}, function(e) {\n\t\t\t\treturn runSideEffect(handler, this, reject, e);\n\t\t\t});\n\t\t};\n\n\t\tfunction runSideEffect (handler, thisArg, propagate, value) {\n\t\t\tvar result = handler.call(thisArg);\n\t\t\treturn maybeThenable(result)\n\t\t\t\t? propagateValue(result, propagate, value)\n\t\t\t\t: propagate(value);\n\t\t}\n\n\t\tfunction propagateValue (result, propagate, x) {\n\t\t\treturn resolve(result).then(function () {\n\t\t\t\treturn propagate(x);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Recover from a failure by returning a defaultValue. If defaultValue\n\t\t * is a promise, it's fulfillment value will be used. If defaultValue is\n\t\t * a promise that rejects, the returned promise will reject with the\n\t\t * same reason.\n\t\t * @param {*} defaultValue\n\t\t * @returns {Promise} new promise\n\t\t */\n\t\tPromise.prototype['else'] = Promise.prototype.orElse = function(defaultValue) {\n\t\t\treturn this.then(void 0, function() {\n\t\t\t\treturn defaultValue;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Shortcut for .then(function() { return value; })\n\t\t * @param {*} value\n\t\t * @return {Promise} a promise that:\n\t\t * - is fulfilled if value is not a promise, or\n\t\t * - if value is a promise, will fulfill with its value, or reject\n\t\t * with its reason.\n\t\t */\n\t\tPromise.prototype['yield'] = function(value) {\n\t\t\treturn this.then(function() {\n\t\t\t\treturn value;\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Runs a side effect when this promise fulfills, without changing the\n\t\t * fulfillment value.\n\t\t * @param {function} onFulfilledSideEffect\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.tap = function(onFulfilledSideEffect) {\n\t\t\treturn this.then(onFulfilledSideEffect)['yield'](this);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n\tfunction rejectInvalidPredicate() {\n\t\tthrow new TypeError('catch predicate must be a function');\n\t}\n\n\tfunction evaluatePredicate(e, predicate) {\n\t\treturn isError(predicate) ? e instanceof predicate : predicate(e);\n\t}\n\n\tfunction isError(predicate) {\n\t\treturn predicate === Error\n\t\t\t|| (predicate != null && predicate.prototype instanceof Error);\n\t}\n\n\tfunction maybeThenable(x) {\n\t\treturn (typeof x === 'object' || typeof x === 'function') && x !== null;\n\t}\n\n\tfunction identity(x) {\n\t\treturn x;\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n/** @author Jeff Escalante */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function fold(Promise) {\n\n\t\tPromise.prototype.fold = function(f, z) {\n\t\t\tvar promise = this._beget();\n\n\t\t\tthis._handler.fold(function(z, x, to) {\n\t\t\t\tPromise._handler(z).fold(function(x, z, to) {\n\t\t\t\t\tto.resolve(f.call(this, z, x));\n\t\t\t\t}, x, this, to);\n\t\t\t}, z, promise._handler.receiver, promise._handler);\n\n\t\t\treturn promise;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar inspect = require('../state').inspect;\n\n\treturn function inspection(Promise) {\n\n\t\tPromise.prototype.inspect = function() {\n\t\t\treturn inspect(Promise._handler(this));\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function generate(Promise) {\n\n\t\tvar resolve = Promise.resolve;\n\n\t\tPromise.iterate = iterate;\n\t\tPromise.unfold = unfold;\n\n\t\treturn Promise;\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.iterate\n\t\t * Generate a (potentially infinite) stream of promised values:\n\t\t * x, f(x), f(f(x)), etc. until condition(x) returns true\n\t\t * @param {function} f function to generate a new x from the previous x\n\t\t * @param {function} condition function that, given the current x, returns\n\t\t * truthy when the iterate should stop\n\t\t * @param {function} handler function to handle the value produced by f\n\t\t * @param {*|Promise} x starting value, may be a promise\n\t\t * @return {Promise} the result of the last call to f before\n\t\t * condition returns true\n\t\t */\n\t\tfunction iterate(f, condition, handler, x) {\n\t\t\treturn unfold(function(x) {\n\t\t\t\treturn [x, f(x)];\n\t\t\t}, condition, handler, x);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated Use github.com/cujojs/most streams and most.unfold\n\t\t * Generate a (potentially infinite) stream of promised values\n\t\t * by applying handler(generator(seed)) iteratively until\n\t\t * condition(seed) returns true.\n\t\t * @param {function} unspool function that generates a [value, newSeed]\n\t\t * given a seed.\n\t\t * @param {function} condition function that, given the current seed, returns\n\t\t * truthy when the unfold should stop\n\t\t * @param {function} handler function to handle the value produced by unspool\n\t\t * @param x {*|Promise} starting value, may be a promise\n\t\t * @return {Promise} the result of the last value produced by unspool before\n\t\t * condition returns true\n\t\t */\n\t\tfunction unfold(unspool, condition, handler, x) {\n\t\t\treturn resolve(x).then(function(seed) {\n\t\t\t\treturn resolve(condition(seed)).then(function(done) {\n\t\t\t\t\treturn done ? seed : resolve(unspool(seed)).spread(next);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tfunction next(item, newSeed) {\n\t\t\t\treturn resolve(handler(item)).then(function() {\n\t\t\t\t\treturn unfold(unspool, condition, handler, newSeed);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function progress(Promise) {\n\n\t\t/**\n\t\t * @deprecated\n\t\t * Register a progress handler for this promise\n\t\t * @param {function} onProgress\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.progress = function(onProgress) {\n\t\t\treturn this.then(void 0, void 0, onProgress);\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar env = require('../env');\n\tvar TimeoutError = require('../TimeoutError');\n\n\tfunction setTimeout(f, ms, x, y) {\n\t\treturn env.setTimer(function() {\n\t\t\tf(x, y, ms);\n\t\t}, ms);\n\t}\n\n\treturn function timed(Promise) {\n\t\t/**\n\t\t * Return a new promise whose fulfillment value is revealed only\n\t\t * after ms milliseconds\n\t\t * @param {number} ms milliseconds\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.delay = function(ms) {\n\t\t\tvar p = this._beget();\n\t\t\tthis._handler.fold(handleDelay, ms, void 0, p._handler);\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction handleDelay(ms, x, h) {\n\t\t\tsetTimeout(resolveDelay, ms, x, h);\n\t\t}\n\n\t\tfunction resolveDelay(x, h) {\n\t\t\th.resolve(x);\n\t\t}\n\n\t\t/**\n\t\t * Return a new promise that rejects after ms milliseconds unless\n\t\t * this promise fulfills earlier, in which case the returned promise\n\t\t * fulfills with the same value.\n\t\t * @param {number} ms milliseconds\n\t\t * @param {Error|*=} reason optional rejection reason to use, defaults\n\t\t * to a TimeoutError if not provided\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype.timeout = function(ms, reason) {\n\t\t\tvar p = this._beget();\n\t\t\tvar h = p._handler;\n\n\t\t\tvar t = setTimeout(onTimeout, ms, reason, p._handler);\n\n\t\t\tthis._handler.visit(h,\n\t\t\t\tfunction onFulfill(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.resolve(x); // this = h\n\t\t\t\t},\n\t\t\t\tfunction onReject(x) {\n\t\t\t\t\tenv.clearTimer(t);\n\t\t\t\t\tthis.reject(x); // this = h\n\t\t\t\t},\n\t\t\t\th.notify);\n\n\t\t\treturn p;\n\t\t};\n\n\t\tfunction onTimeout(reason, h, ms) {\n\t\t\tvar e = typeof reason === 'undefined'\n\t\t\t\t? new TimeoutError('timed out after ' + ms + 'ms')\n\t\t\t\t: reason;\n\t\t\th.reject(e);\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function(require) {\n\n\tvar setTimer = require('../env').setTimer;\n\tvar format = require('../format');\n\n\treturn function unhandledRejection(Promise) {\n\n\t\tvar logError = noop;\n\t\tvar logInfo = noop;\n\t\tvar localConsole;\n\n\t\tif(typeof console !== 'undefined') {\n\t\t\t// Alias console to prevent things like uglify's drop_console option from\n\t\t\t// removing console.log/error. Unhandled rejections fall into the same\n\t\t\t// category as uncaught exceptions, and build tools shouldn't silence them.\n\t\t\tlocalConsole = console;\n\t\t\tlogError = typeof localConsole.error !== 'undefined'\n\t\t\t\t? function (e) { localConsole.error(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\n\t\t\tlogInfo = typeof localConsole.info !== 'undefined'\n\t\t\t\t? function (e) { localConsole.info(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\t\t}\n\n\t\tPromise.onPotentiallyUnhandledRejection = function(rejection) {\n\t\t\tenqueue(report, rejection);\n\t\t};\n\n\t\tPromise.onPotentiallyUnhandledRejectionHandled = function(rejection) {\n\t\t\tenqueue(unreport, rejection);\n\t\t};\n\n\t\tPromise.onFatalRejection = function(rejection) {\n\t\t\tenqueue(throwit, rejection.value);\n\t\t};\n\n\t\tvar tasks = [];\n\t\tvar reported = [];\n\t\tvar running = null;\n\n\t\tfunction report(r) {\n\t\t\tif(!r.handled) {\n\t\t\t\treported.push(r);\n\t\t\t\tlogError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction unreport(r) {\n\t\t\tvar i = reported.indexOf(r);\n\t\t\tif(i >= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function addWith(Promise) {\n\t\t/**\n\t\t * Returns a promise whose handlers will be called with `this` set to\n\t\t * the supplied receiver. Subsequent promises derived from the\n\t\t * returned promise will also have their handlers called with receiver\n\t\t * as `this`. Calling `with` with undefined or no arguments will return\n\t\t * a promise whose handlers will again be called in the usual Promises/A+\n\t\t * way (no `this`) thus safely undoing any previous `with` in the\n\t\t * promise chain.\n\t\t *\n\t\t * WARNING: Promises returned from `with`/`withThis` are NOT Promises/A+\n\t\t * compliant, specifically violating 2.2.5 (http://promisesaplus.com/#point-41)\n\t\t *\n\t\t * @param {object} receiver `this` value for all handlers attached to\n\t\t * the returned promise.\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype['with'] = Promise.prototype.withThis = function(receiver) {\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\t\t\tchild.receiver = receiver;\n\t\t\tthis._handler.chain(child, receiver);\n\t\t\treturn p;\n\t\t};\n\n\t\treturn Promise;\n\t};\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t return (typeof MutationObserver !== 'undefined' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function liftAll(liftOne, combine, dst, src) {\n\t\tif(typeof combine === 'undefined') {\n\t\t\tcombine = defaultCombine;\n\t\t}\n\n\t\treturn Object.keys(src).reduce(function(dst, key) {\n\t\t\tvar f = src[key];\n\t\t\treturn typeof f === 'function' ? combine(dst, liftOne(f), key) : dst;\n\t\t}, typeof dst === 'undefined' ? defaultDst(src) : dst);\n\t};\n\n\tfunction defaultCombine(o, f, k) {\n\t\to[k] = f;\n\t\treturn o;\n\t}\n\n\tfunction defaultDst(src) {\n\t\treturn typeof src === 'function' ? src.bind() : Object.create(src);\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0 ? toFulfilledState(handler.value)\n\t\t\t : toRejectedState(handler.value);\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2013 original author or authors */\n\n/**\n * Collection of helpers for interfacing with node-style asynchronous functions\n * using promises.\n *\n * @author Brian Cavalier\n * @contributor Renato Zannon\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar _liftAll = require('./lib/liftAll');\n\tvar setTimer = require('./lib/env').setTimer;\n\tvar slice = Array.prototype.slice;\n\n\tvar _apply = require('./lib/apply')(when.Promise, dispatch);\n\n\treturn {\n\t\tlift: lift,\n\t\tliftAll: liftAll,\n\t\tapply: apply,\n\t\tcall: call,\n\t\tcreateCallback: createCallback,\n\t\tbindCallback: bindCallback,\n\t\tliftCallback: liftCallback\n\t};\n\n\t/**\n\t * Takes a node-style async function and calls it immediately (with an optional\n\t * array of arguments or promises for arguments). It returns a promise whose\n\t * resolution depends on whether the async functions calls its callback with the\n\t * conventional error argument or not.\n\t *\n\t * With this it becomes possible to leverage existing APIs while still reaping\n\t * the benefits of promises.\n\t *\n\t * @example\n\t * function onlySmallNumbers(n, callback) {\n\t *\t\tif(n < 10) {\n\t *\t\t\tcallback(null, n + 10);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * var nodefn = require(\"when/node/function\");\n\t *\n\t * // Logs '15'\n\t * nodefn.apply(onlySmallNumbers, [5]).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.apply(onlySmallNumbers, [15]).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {Array} [args] array of arguments to func\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction apply(f, args) {\n\t\treturn _apply(f, this, args || []);\n\t}\n\n\tfunction dispatch(f, thisArg, args, h) {\n\t\tvar cb = createCallback(h);\n\t\ttry {\n\t\t\tswitch(args.length) {\n\t\t\t\tcase 2: f.call(thisArg, args[0], args[1], cb); break;\n\t\t\t\tcase 1: f.call(thisArg, args[0], cb); break;\n\t\t\t\tcase 0: f.call(thisArg, cb); break;\n\t\t\t\tdefault:\n\t\t\t\t\targs.push(cb);\n\t\t\t\t\tf.apply(thisArg, args);\n\t\t\t}\n\t\t} catch(e) {\n\t\t\th.reject(e);\n\t\t}\n\t}\n\n\t/**\n\t * Has the same behavior that {@link apply} has, with the difference that the\n\t * arguments to the function are provided individually, while {@link apply} accepts\n\t * a single array.\n\t *\n\t * @example\n\t * function sumSmallNumbers(x, y, callback) {\n\t *\t\tvar result = x + y;\n\t *\t\tif(result < 10) {\n\t *\t\t\tcallback(null, result);\n\t *\t\t} else {\n\t *\t\t\tcallback(new Error(\"Calculation failed\"));\n\t *\t\t}\n\t *\t}\n\t *\n\t * // Logs '5'\n\t * nodefn.call(sumSmallNumbers, 2, 3).then(console.log, console.error);\n\t *\n\t * // Logs 'Calculation failed'\n\t * nodefn.call(sumSmallNumbers, 5, 10).then(console.log, console.error);\n\t *\n\t * @param {function} f node-style function that will be called\n\t * @param {...*} [args] arguments that will be forwarded to the function\n\t * @returns {Promise} promise for the value func passes to its callback\n\t */\n\tfunction call(f /*, args... */) {\n\t\treturn _apply(f, this, slice.call(arguments, 1));\n\t}\n\n\t/**\n\t * Takes a node-style function and returns new function that wraps the\n\t * original and, instead of taking a callback, returns a promise. Also, it\n\t * knows how to handle promises given as arguments, waiting for their\n\t * resolution before executing.\n\t *\n\t * Upon execution, the orginal function is executed as well. If it passes\n\t * a truthy value as the first argument to the callback, it will be\n\t * interpreted as an error condition, and the promise will be rejected\n\t * with it. Otherwise, the call is considered a resolution, and the promise\n\t * is resolved with the callback's second argument.\n\t *\n\t * @example\n\t * var fs = require(\"fs\"), nodefn = require(\"when/node/function\");\n\t *\n\t * var promiseRead = nodefn.lift(fs.readFile);\n\t *\n\t * // The promise is resolved with the contents of the file if everything\n\t * // goes ok\n\t * promiseRead('exists.txt').then(console.log, console.error);\n\t *\n\t * // And will be rejected if something doesn't work out\n\t * // (e.g. the files does not exist)\n\t * promiseRead('doesnt_exist.txt').then(console.log, console.error);\n\t *\n\t *\n\t * @param {Function} f node-style function to be lifted\n\t * @param {...*} [args] arguments to be prepended for the new function @deprecated\n\t * @returns {Function} a promise-returning function\n\t */\n\tfunction lift(f /*, args... */) {\n\t\tvar args1 = arguments.length > 1 ? slice.call(arguments, 1) : [];\n\t\treturn function() {\n\t\t\t// TODO: Simplify once partialing has been removed\n\t\t\tvar l = args1.length;\n\t\t\tvar al = arguments.length;\n\t\t\tvar args = new Array(al + l);\n\t\t\tvar i;\n\t\t\tfor(i=0; i 2) {\n\t\t\t\tresolver.resolve(slice.call(arguments, 1));\n\t\t\t} else {\n\t\t\t\tresolver.resolve(value);\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Attaches a node-style callback to a promise, ensuring the callback is\n\t * called for either fulfillment or rejection. Returns a promise with the same\n\t * state as the passed-in promise.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tbindCallback(deferred.promise, callback);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Promise} promise The promise to be attached to.\n\t * @param {Function} callback The node-style callback to attach.\n\t * @returns {Promise} A promise with the same state as the passed-in promise.\n\t */\n\tfunction bindCallback(promise, callback) {\n\t\tpromise = when(promise);\n\n\t\tif (callback) {\n\t\t\tpromise.then(success, wrapped);\n\t\t}\n\n\t\treturn promise;\n\n\t\tfunction success(value) {\n\t\t\twrapped(null, value);\n\t\t}\n\n\t\tfunction wrapped(err, value) {\n\t\t\tsetTimer(function () {\n\t\t\t\tcallback(err, value);\n\t\t\t}, 0);\n\t\t}\n\t}\n\n\t/**\n\t * Takes a node-style callback and returns new function that accepts a\n\t * promise, calling the original callback when the promise is either\n\t * fulfilled or rejected with the appropriate arguments.\n\t *\n\t * @example\n\t *\tvar deferred = when.defer();\n\t *\n\t *\tfunction callback(err, value) {\n\t *\t\t// Handle err or use value\n\t *\t}\n\t *\n\t *\tvar wrapped = liftCallback(callback);\n\t *\n\t *\t// `wrapped` can now be passed around at will\n\t *\twrapped(deferred.promise);\n\t *\n\t *\tdeferred.resolve('interesting value');\n\t *\n\t * @param {Function} callback The node-style callback to wrap.\n\t * @returns {Function} The lifted, promise-accepting function.\n\t */\n\tfunction liftCallback(callback) {\n\t\treturn function(promise) {\n\t\t\treturn bindCallback(promise, callback);\n\t\t};\n\t}\n});\n\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * parallel.js\n *\n * Run a set of task functions in parallel. All tasks will\n * receive the same args\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in parallel\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for array containing the\n\t * result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function parallel(tasks /*, args... */) {\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.map(tasks, function(task) {\n\t\t\t\treturn task.apply(void 0, args);\n\t\t\t});\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * pipeline.js\n *\n * Run a set of task functions in sequence, passing the result\n * of the previous as an argument to the next. Like a shell\n * pipeline, e.g. `cat file.txt | grep 'foo' | sed -e 's/foo/bar/g'\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in a pipeline where the next\n\t * tasks receives the result of the previous. The first task\n\t * will receive the initialArgs as its argument list.\n\t * @param tasks {Array|Promise} array or promise for array of task functions\n\t * @param [initialArgs...] {*} arguments to be passed to the first task\n\t * @return {Promise} promise for return value of the final task\n\t */\n\treturn function pipeline(tasks /* initialArgs... */) {\n\t\t// Self-optimizing function to run first task with multiple\n\t\t// args using apply, but subsequence tasks via direct invocation\n\t\tvar runTask = function(args, task) {\n\t\t\trunTask = function(arg, task) {\n\t\t\t\treturn task(arg);\n\t\t\t};\n\n\t\t\treturn task.apply(null, args);\n\t\t};\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(arg, task) {\n\t\t\t\treturn runTask(arg, task);\n\t\t\t}, args);\n\t\t});\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2012-2013 original author or authors */\n\n/**\n * poll.js\n *\n * Helper that polls until cancelled or for a condition to become true.\n *\n * @author Scott Andrews\n */\n\n(function (define) { 'use strict';\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar attempt = when['try'];\n\tvar cancelable = require('./cancelable');\n\n\t/**\n\t * Periodically execute the task function on the msec delay. The result of\n\t * the task may be verified by watching for a condition to become true. The\n\t * returned deferred is cancellable if the polling needs to be cancelled\n\t * externally before reaching a resolved state.\n\t *\n\t * The next vote is scheduled after the results of the current vote are\n\t * verified and rejected.\n\t *\n\t * Polling may be terminated by the verifier returning a truthy value,\n\t * invoking cancel() on the returned promise, or the task function returning\n\t * a rejected promise.\n\t *\n\t * Usage:\n\t *\n\t * var count = 0;\n\t * function doSomething() { return count++ }\n\t *\n\t * // poll until cancelled\n\t * var p = poll(doSomething, 1000);\n\t * ...\n\t * p.cancel();\n\t *\n\t * // poll until condition is met\n\t * poll(doSomething, 1000, function(result) { return result > 10 })\n\t * .then(function(result) { assert result == 10 });\n\t *\n\t * // delay first vote\n\t * poll(doSomething, 1000, anyFunc, true);\n\t *\n\t * @param task {Function} function that is executed after every timeout\n\t * @param interval {number|Function} timeout in milliseconds\n\t * @param [verifier] {Function} function to evaluate the result of the vote.\n\t * May return a {Promise} or a {Boolean}. Rejecting the promise or a\n\t * falsey value will schedule the next vote.\n\t * @param [delayInitialTask] {boolean} if truthy, the first vote is scheduled\n\t * instead of immediate\n\t *\n\t * @returns {Promise}\n\t */\n\treturn function poll(task, interval, verifier, delayInitialTask) {\n\t\tvar deferred, canceled, reject;\n\n\t\tcanceled = false;\n\t\tdeferred = cancelable(when.defer(), function () { canceled = true; });\n\t\treject = deferred.reject;\n\n\t\tverifier = verifier || function () { return false; };\n\n\t\tif (typeof interval !== 'function') {\n\t\t\tinterval = (function (interval) {\n\t\t\t\treturn function () { return when().delay(interval); };\n\t\t\t})(interval);\n\t\t}\n\n\t\tfunction certify(result) {\n\t\t\tdeferred.resolve(result);\n\t\t}\n\n\t\tfunction schedule(result) {\n\t\t\tattempt(interval).then(vote, reject);\n\t\t\tif (result !== void 0) {\n\t\t\t\tdeferred.notify(result);\n\t\t\t}\n\t\t}\n\n\t\tfunction vote() {\n\t\t\tif (canceled) { return; }\n\t\t\twhen(task(),\n\t\t\t\tfunction (result) {\n\t\t\t\t\twhen(verifier(result),\n\t\t\t\t\t\tfunction (verification) {\n\t\t\t\t\t\t\treturn verification ? certify(result) : schedule(result);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfunction () { schedule(result); }\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\treject\n\t\t\t);\n\t\t}\n\n\t\tif (delayInitialTask) {\n\t\t\tschedule();\n\t\t} else {\n\t\t\t// if task() is blocking, vote will also block\n\t\t\tvote();\n\t\t}\n\n\t\t// make the promise cancelable\n\t\tdeferred.promise = Object.create(deferred.promise);\n\t\tdeferred.promise.cancel = deferred.cancel;\n\n\t\treturn deferred.promise;\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * sequence.js\n *\n * Run a set of task functions in sequence. All tasks will\n * receive the same args.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\tvar all = when.Promise.all;\n\tvar slice = Array.prototype.slice;\n\n\t/**\n\t * Run array of tasks in sequence with no overlap\n\t * @param tasks {Array|Promise} array or promiseForArray of task functions\n\t * @param [args] {*} arguments to be passed to all tasks\n\t * @return {Promise} promise for an array containing\n\t * the result of each task in the array position corresponding\n\t * to position of the task in the tasks array\n\t */\n\treturn function sequence(tasks /*, args... */) {\n\t\tvar results = [];\n\n\t\treturn all(slice.call(arguments, 1)).then(function(args) {\n\t\t\treturn when.reduce(tasks, function(results, task) {\n\t\t\t\treturn when(task.apply(void 0, args), addResult);\n\t\t\t}, results);\n\t\t});\n\n\t\tfunction addResult(result) {\n\t\t\tresults.push(result);\n\t\t\treturn results;\n\t\t}\n\t};\n\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2011-2013 original author or authors */\n\n/**\n * timeout.js\n *\n * Helper that returns a promise that rejects after a specified timeout,\n * if not explicitly resolved or rejected before that.\n *\n * @author Brian Cavalier\n * @author John Hann\n */\n\n(function(define) {\ndefine(function(require) {\n\n\tvar when = require('./when');\n\n /**\n\t * @deprecated Use when(trigger).timeout(ms)\n */\n return function timeout(msec, trigger) {\n\t\treturn when(trigger).timeout(msec);\n };\n});\n})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n\n/**\n * Promises/A+ and when() implementation\n * when is part of the cujoJS family of libraries (http://cujojs.com/)\n * @author Brian Cavalier\n * @author John Hann\n */\n(function(define) { 'use strict';\ndefine(function (require) {\n\n\tvar timed = require('./lib/decorators/timed');\n\tvar array = require('./lib/decorators/array');\n\tvar flow = require('./lib/decorators/flow');\n\tvar fold = require('./lib/decorators/fold');\n\tvar inspect = require('./lib/decorators/inspect');\n\tvar generate = require('./lib/decorators/iterate');\n\tvar progress = require('./lib/decorators/progress');\n\tvar withThis = require('./lib/decorators/with');\n\tvar unhandledRejection = require('./lib/decorators/unhandledRejection');\n\tvar TimeoutError = require('./lib/TimeoutError');\n\n\tvar Promise = [array, flow, fold, generate, progress,\n\t\tinspect, withThis, timed, unhandledRejection]\n\t\t.reduce(function(Promise, feature) {\n\t\t\treturn feature(Promise);\n\t\t}, require('./lib/Promise'));\n\n\tvar apply = require('./lib/apply')(Promise);\n\n\t// Public API\n\n\twhen.promise = promise; // Create a pending promise\n\twhen.resolve = Promise.resolve; // Create a resolved promise\n\twhen.reject = Promise.reject; // Create a rejected promise\n\n\twhen.lift = lift; // lift a function to return promises\n\twhen['try'] = attempt; // call a function and return a promise\n\twhen.attempt = attempt; // alias for when.try\n\n\twhen.iterate = Promise.iterate; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\twhen.unfold = Promise.unfold; // DEPRECATED (use cujojs/most streams) Generate a stream of promises\n\n\twhen.join = join; // Join 2 or more promises\n\n\twhen.all = all; // Resolve a list of promises\n\twhen.settle = settle; // Settle a list of promises\n\n\twhen.any = lift(Promise.any); // One-winner race\n\twhen.some = lift(Promise.some); // Multi-winner race\n\twhen.race = lift(Promise.race); // First-to-settle race\n\n\twhen.map = map; // Array.map() for promises\n\twhen.filter = filter; // Array.filter() for promises\n\twhen.reduce = lift(Promise.reduce); // Array.reduce() for promises\n\twhen.reduceRight = lift(Promise.reduceRight); // Array.reduceRight() for promises\n\n\twhen.isPromiseLike = isPromiseLike; // Is something promise-like, aka thenable\n\n\twhen.Promise = Promise; // Promise constructor\n\twhen.defer = defer; // Create a {promise, resolve, reject} tuple\n\n\t// Error types\n\n\twhen.TimeoutError = TimeoutError;\n\n\t/**\n\t * Get a trusted promise for x, or by transforming x with onFulfilled\n\t *\n\t * @param {*} x\n\t * @param {function?} onFulfilled callback to be called when x is\n\t * successfully fulfilled. If promiseOrValue is an immediate value, callback\n\t * will be invoked immediately.\n\t * @param {function?} onRejected callback to be called when x is\n\t * rejected.\n\t * @param {function?} onProgress callback to be called when progress updates\n\t * are issued for x. @deprecated\n\t * @returns {Promise} a new promise that will fulfill with the return\n\t * value of callback or errback or the completion value of promiseOrValue if\n\t * callback and/or errback is not supplied.\n\t */\n\tfunction when(x, onFulfilled, onRejected, onProgress) {\n\t\tvar p = Promise.resolve(x);\n\t\tif (arguments.length < 2) {\n\t\t\treturn p;\n\t\t}\n\n\t\treturn p.then(onFulfilled, onRejected, onProgress);\n\t}\n\n\t/**\n\t * Creates a new promise whose fate is determined by resolver.\n\t * @param {function} resolver function(resolve, reject, notify)\n\t * @returns {Promise} promise whose fate is determine by resolver\n\t */\n\tfunction promise(resolver) {\n\t\treturn new Promise(resolver);\n\t}\n\n\t/**\n\t * Lift the supplied function, creating a version of f that returns\n\t * promises, and accepts promises as arguments.\n\t * @param {function} f\n\t * @returns {Function} version of f that returns promises\n\t */\n\tfunction lift(f) {\n\t\treturn function() {\n\t\t\tfor(var i=0, l=arguments.length, a=new Array(l); i= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === 'function' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === 'function' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", + "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t return (typeof MutationObserver !== 'undefined' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n", "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n", - "/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i=0&&(l.splice(e,1),h("Handled previous rejection ["+t.id+"] "+r.formatObject(t.value)))}function c(t,e){p.push(t,e),null===d&&(d=o(f,0))}function f(){for(d=null;p.length>0;)p.shift()(p.shift())}var s,a=n,h=n;"undefined"!=typeof console&&(s=console,a="undefined"!=typeof s.error?function(t){s.error(t)}:function(t){s.log(t)},h="undefined"!=typeof s.info?function(t){s.info(t)}:function(t){s.log(t)}),t.onPotentiallyUnhandledRejection=function(t){c(i,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){c(u,t)},t.onFatalRejection=function(t){c(e,t.value)};var p=[],l=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{"../env":5,"../format":6}],5:[function(e,n,o){!function(t){"use strict";t(function(t){function e(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function n(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function o(t){function e(){var t=n;n=void 0,t()}var n,o=document.createTextNode(""),r=new t(e);r.observe(o,{characterData:!0});var i=0;return function(t){n=t,o.data=i^=1}}var r,i="undefined"!=typeof setTimeout&&setTimeout,u=function(t,e){return setTimeout(t,e)},c=function(t){return clearTimeout(t)},f=function(t){return i(t,0)};if(e())f=function(t){return process.nextTick(t)};else if(r=n())f=o(r);else if(!i){var s=t,a=s("vertx");u=function(t,e){return a.setTimer(e,t)},c=a.cancelTimer,f=a.runOnLoop||a.runOnContext}return{setTimer:u,clearTimer:c,asap:f}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{}],6:[function(e,n,o){!function(t){"use strict";t(function(){function t(t){var n="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:e(t);return t instanceof Error?n:n+" (WARNING: non-Error used)"}function e(t){var e=String(t);return"[object Object]"===e&&"undefined"!=typeof JSON&&(e=n(t,e)),e}function n(t,e){try{return JSON.stringify(t)}catch(n){return e}}return{formatError:t,formatObject:e,tryStringify:n}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t()})},{}],7:[function(e,n,o){!function(t){"use strict";t(function(){return function(t){function e(t,e){this._handler=t===_?e:n(t)}function n(t){function e(t){r.resolve(t)}function n(t){r.reject(t)}function o(t){r.notify(t)}var r=new b;try{t(e,n,o)}catch(i){n(i)}return r}function o(t){return S(t)?t:new e(_,new x(y(t)))}function r(t){return new e(_,new x(new P(t)))}function i(){return $}function u(){return new e(_,new b)}function c(t,e){var n=new b(t.receiver,t.join().context);return new e(_,n)}function f(t){return a(K,null,t)}function s(t,e){return a(F,t,e)}function a(t,n,o){function r(e,r,u){u.resolved||h(o,i,e,t(n,r,e),u)}function i(t,e,n){a[t]=e,0===--s&&n.become(new q(a))}for(var u,c="function"==typeof n?r:i,f=new b,s=o.length>>>0,a=new Array(s),p=0;p0?e(n,i.value,r):(r.become(i),p(t,n+1,i))}else e(n,o,r)}function p(t,e,n){for(var o=e;on&&t._unreport()}}function d(t){return"object"!=typeof t||null===t?r(new TypeError("non-iterable passed to race()")):0===t.length?i():1===t.length?o(t[0]):v(t)}function v(t){var n,o,r,i=new b;for(n=0;n0||"function"!=typeof e&&0>r)return new this.constructor(_,o);var i=this._beget(),u=i._handler;return o.chain(u,o.receiver,t,e,n),i},e.prototype["catch"]=function(t){return this.then(void 0,t)},e.prototype._beget=function(){return c(this._handler,this.constructor)},e.all=f,e.race=d,e._traverse=s,e._visitRemaining=p,_.prototype.when=_.prototype.become=_.prototype.notify=_.prototype.fail=_.prototype._unreport=_.prototype._report=D,_.prototype._state=0,_.prototype.state=function(){return this._state},_.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},_.prototype.chain=function(t,e,n,o,r){this.when({resolver:t,receiver:e,fulfilled:n,rejected:o,progress:r})},_.prototype.visit=function(t,e,n,o){this.chain(X,t,e,n,o)},_.prototype.fold=function(t,e,n,o){this.when(new k(t,e,n,o))},J(_,w),w.prototype.become=function(t){t.fail()};var X=new w;J(_,b),b.prototype._state=0,b.prototype.resolve=function(t){this.become(y(t))},b.prototype.reject=function(t){this.resolved||this.become(new P(t))},b.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=O();return t},b.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n=0&&(l.splice(e,1),h("Handled previous rejection ["+t.id+"] "+r.formatObject(t.value)))}function c(t,e){p.push(t,e),null===d&&(d=o(f,0))}function f(){for(d=null;p.length>0;)p.shift()(p.shift())}var s,a=n,h=n;"undefined"!=typeof console&&(s=console,a="undefined"!=typeof s.error?function(t){s.error(t)}:function(t){s.log(t)},h="undefined"!=typeof s.info?function(t){s.info(t)}:function(t){s.log(t)}),t.onPotentiallyUnhandledRejection=function(t){c(i,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){c(u,t)},t.onFatalRejection=function(t){c(e,t.value)};var p=[],l=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{"../env":5,"../format":6}],5:[function(e,n,o){!function(t){"use strict";t(function(t){function e(){return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)}function n(){return"undefined"!=typeof MutationObserver&&MutationObserver||"undefined"!=typeof WebKitMutationObserver&&WebKitMutationObserver}function o(t){function e(){var t=n;n=void 0,t()}var n,o=document.createTextNode(""),r=new t(e);r.observe(o,{characterData:!0});var i=0;return function(t){n=t,o.data=i^=1}}var r,i="undefined"!=typeof setTimeout&&setTimeout,u=function(t,e){return setTimeout(t,e)},c=function(t){return clearTimeout(t)},f=function(t){return i(t,0)};if(e())f=function(t){return process.nextTick(t)};else if(r=n())f=o(r);else if(!i){var s=t,a=s("vertx");u=function(t,e){return a.setTimer(e,t)},c=a.cancelTimer,f=a.runOnLoop||a.runOnContext}return{setTimer:u,clearTimer:c,asap:f}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{}],6:[function(e,n,o){!function(t){"use strict";t(function(){function t(t){var n="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:e(t);return t instanceof Error?n:n+" (WARNING: non-Error used)"}function e(t){var e=String(t);return"[object Object]"===e&&"undefined"!=typeof JSON&&(e=n(t,e)),e}function n(t,e){try{return JSON.stringify(t)}catch(n){return e}}return{formatError:t,formatObject:e,tryStringify:n}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t()})},{}],7:[function(e,n,o){!function(t){"use strict";t(function(){return function(t){function e(t,e){this._handler=t===_?e:n(t)}function n(t){function e(t){r.resolve(t)}function n(t){r.reject(t)}function o(t){r.notify(t)}var r=new b;try{t(e,n,o)}catch(i){n(i)}return r}function o(t){return S(t)?t:new e(_,new x(y(t)))}function r(t){return new e(_,new x(new E(t)))}function i(){return et}function u(){return new e(_,new b)}function c(t,e){var n=new b(t.receiver,t.join().context);return new e(_,n)}function f(t){return a(K,null,t)}function s(t,e){return a(F,t,e)}function a(t,n,o){function r(e,r,u){u.resolved||h(o,i,e,t(n,r,e),u)}function i(t,e,n){a[t]=e,0===--s&&n.become(new C(a))}for(var u,c="function"==typeof n?r:i,f=new b,s=o.length>>>0,a=new Array(s),p=0;p0?e(n,i.value,r):(r.become(i),p(t,n+1,i))}else e(n,o,r)}function p(t,e,n){for(var o=e;on&&t._unreport()}}function d(t){return"object"!=typeof t||null===t?r(new TypeError("non-iterable passed to race()")):0===t.length?i():1===t.length?o(t[0]):v(t)}function v(t){var n,o,r,i=new b;for(n=0;n0||"function"!=typeof e&&0>r)return new this.constructor(_,o);var i=this._beget(),u=i._handler;return o.chain(u,o.receiver,t,e,n),i},e.prototype["catch"]=function(t){return this.then(void 0,t)},e.prototype._beget=function(){return c(this._handler,this.constructor)},e.all=f,e.race=d,e._traverse=s,e._visitRemaining=p,_.prototype.when=_.prototype.become=_.prototype.notify=_.prototype.fail=_.prototype._unreport=_.prototype._report=D,_.prototype._state=0,_.prototype.state=function(){return this._state},_.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},_.prototype.chain=function(t,e,n,o,r){this.when({resolver:t,receiver:e,fulfilled:n,rejected:o,progress:r})},_.prototype.visit=function(t,e,n,o){this.chain(Z,t,e,n,o)},_.prototype.fold=function(t,e,n,o){this.when(new k(t,e,n,o))},J(_,w),w.prototype.become=function(t){t.fail()};var Z=new w;J(_,b),b.prototype._state=0,b.prototype.resolve=function(t){this.become(y(t))},b.prototype.reject=function(t){this.resolved||this.become(new E(t))},b.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=R();return t},b.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === 'function' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === 'function' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === 'function' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === 'function' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t return (typeof MutationObserver !== 'undefined' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { 'use strict';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff \"best\" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn't\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== 'undefined' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire('vertx');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== 'undefined' &&\n\t\t\tObject.prototype.toString.call(process) === '[object process]';\n\t}\n\n\tfunction hasMutationObserver () {\n\t return (typeof MutationObserver !== 'undefined' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver !== 'undefined' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode('');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it's returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === 'object' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + ' (WARNING: non-Error used)';\n\t}\n\n\t/**\n\t * Format an object, detecting \"plain\" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === '[object Object]' && typeof JSON !== 'undefined') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));\n","/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { 'use strict';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise's fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise's fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== 'function' && state > 0) ||\n\t\t\t\t(typeof onRejected !== 'function' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype['catch'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array> -> Promise>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise's value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === 'function' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; ies6-shim/Promise.js", - "browserify-when": "mkdir -p dist/browser && browserify -s when build/when.browserify.js --no-detect-globals --debug | exorcist -b . -r https://raw.githubusercontent.com/cujojs/when/`git rev-parse HEAD` dist/browser/when.js.map >dist/browser/when.js", - "browserify-debug": "mkdir -p dist/browser && browserify -s when build/when.browserify-debug.js --no-detect-globals --debug | exorcist -b . -r https://raw.githubusercontent.com/cujojs/when/`git rev-parse HEAD` dist/browser/when.debug.js.map >dist/browser/when.debug.js", + "browserify-es6": "node scripts/browserify.js es6", + "browserify-when": "node scripts/browserify.js when", + "browserify-debug": "node scripts/browserify.js debug", "uglify": "npm run uglify-es6 && npm run uglify-when", - "uglify-es6": "cd es6-shim; uglifyjs Promise.js --compress --mangle --in-source-map Promise.js.map --source-map Promise.min.js.map -o Promise.min.js; cd ../..", - "uglify-when": "cd dist/browser; uglifyjs when.js --compress --mangle --in-source-map when.js.map --source-map when.min.js.map -o when.min.js; cd ../.." + "uglify-es6": "uglifyjs es6-shim/Promise.js --compress --mangle --in-source-map es6-shim/Promise.js.map --source-map es6-shim/Promise.min.js.map -o es6-shim/Promise.min.js", + "uglify-when": "uglifyjs dist/browser/when.js --compress --mangle --in-source-map dist/browser/when.js.map --source-map dist/browser/when.min.js.map -o dist/browser/when.min.js" } } diff --git a/node_modules/which/CHANGELOG.md b/node_modules/which/CHANGELOG.md index 698e8edb0..c44cfbec5 100644 --- a/node_modules/which/CHANGELOG.md +++ b/node_modules/which/CHANGELOG.md @@ -1,6 +1,18 @@ # Changes +## 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 diff --git a/node_modules/which/package.json b/node_modules/which/package.json index 9c7de7d9d..a67870ed1 100644 --- a/node_modules/which/package.json +++ b/node_modules/which/package.json @@ -2,7 +2,7 @@ "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": "1.2.12", + "version": "1.2.14", "repository": { "type": "git", "url": "git://github.com/isaacs/node-which.git" @@ -11,12 +11,12 @@ "bin": "./bin/which", "license": "ISC", "dependencies": { - "isexe": "^1.1.1" + "isexe": "^2.0.0" }, "devDependencies": { "mkdirp": "^0.5.0", "rimraf": "^2.3.3", - "tap": "^5.1.1" + "tap": "^10.3.0" }, "scripts": { "test": "tap test/*.js --cov", diff --git a/node_modules/zip-stream/README.md b/node_modules/zip-stream/README.md index 7169cdcef..ffc846a1e 100644 --- a/node_modules/zip-stream/README.md +++ b/node_modules/zip-stream/README.md @@ -1,4 +1,4 @@ -# zip-stream v1.1.0 [![Build Status](https://travis-ci.org/archiverjs/node-zip-stream.svg?branch=master)](https://travis-ci.org/archiverjs/node-zip-stream) [![Build status](https://ci.appveyor.com/api/projects/status/2sraarbaadwbtti2/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-zip-stream/branch/master) +# ZipStream v1.1.1 [![Build Status](https://travis-ci.org/archiverjs/node-zip-stream.svg?branch=master)](https://travis-ci.org/archiverjs/node-zip-stream) [![Build status](https://ci.appveyor.com/api/projects/status/2sraarbaadwbtti2/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-zip-stream/branch/master) zip-stream is a streaming zip archive generator based on the `ZipArchiveOutputStream` prototype found in the [compress-commons](https://www.npmjs.org/package/compress-commons) project. @@ -40,12 +40,6 @@ archive.entry('string contents', { name: 'string.txt' }, function(err, entry) { }); ``` -## Things of Interest - -- [Releases](https://github.com/archiverjs/node-zip-stream/releases) -- [Contributing](https://github.com/archiverjs/node-zip-stream/blob/master/CONTRIBUTING.md) -- [MIT License](https://github.com/archiverjs/node-zip-stream/blob/master/LICENSE) - ## Credits Concept inspired by Antoine van Wel's [zipstream](https://npmjs.org/package/zipstream) module, which is no longer being updated. \ No newline at end of file diff --git a/node_modules/zip-stream/index.js b/node_modules/zip-stream/index.js index 71f9fc4e7..0c3248bf8 100644 --- a/node_modules/zip-stream/index.js +++ b/node_modules/zip-stream/index.js @@ -38,7 +38,7 @@ var ZipStream = module.exports = function(options) { delete options.level; } - if (options.zlib.level && options.zlib.level === 0) { + if (typeof options.zlib.level === 'number' && options.zlib.level === 0) { options.store = true; } diff --git a/node_modules/zip-stream/package.json b/node_modules/zip-stream/package.json index 1fb2cf6fa..874dd0be5 100644 --- a/node_modules/zip-stream/package.json +++ b/node_modules/zip-stream/package.json @@ -1,6 +1,6 @@ { "name": "zip-stream", - "version": "1.1.0", + "version": "1.1.1", "description": "a streaming zip archive generator.", "homepage": "https://github.com/archiverjs/node-zip-stream", "author": { @@ -24,7 +24,7 @@ }, "scripts": { "test": "mocha --reporter dot", - "gendocs": "jsdoc -c jsdoc.json readme.md" + "jsdoc": "jsdoc -c jsdoc.json README.md" }, "dependencies": { "archiver-utils": "^1.3.0", @@ -33,10 +33,11 @@ "readable-stream": "^2.0.0" }, "devDependencies": { + "archiver-jsdoc-theme": "^1.0.0", + "jsdoc": "~3.4.0", "chai": "^3.4.0", - "jsdoc": "^3.4.0", "minami": "^1.1.0", - "mocha": "^2.3.3", + "mocha": "^3.2.0", "rimraf": "^2.4.3", "mkdirp": "^0.5.0" }, diff --git a/package.json b/package.json index 9c8dbc4eb..d750c3519 100644 --- a/package.json +++ b/package.json @@ -38,13 +38,24 @@ "selenium-webdriver": "^3.0.1", "serve-static": "^1.11.1", "systemjs": "^0.19.14", + "talertest": "file:tooling/talertest/", "through2": "^2.0.1", + "ts-loader": "^2.0.3", "typescript": "next", "typhonjs-istanbul-instrument-jspm": "^0.1.0", + "uglify-js": "git://github.com/mishoo/UglifyJS2#harmony", "vinyl": "^2.0.0", "vinyl-fs": "^2.4.3" }, "dependencies": { - "async": "^2.1.2" + "@types/react": "^15.0.22", + "@types/react-dom": "^15.5.0", + "async": "^2.1.2", + "html-webpack-plugin": "^2.28.0", + "jed": "^1.1.1", + "react": "^15.5.4", + "react-dom": "^15.5.4", + "urijs": "^1.18.10", + "webpack": "^2.4.1" } } diff --git a/pogen/.gitignore b/pogen/.gitignore deleted file mode 100644 index a6c7c2852..000000000 --- a/pogen/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.js diff --git a/pogen/dumpTree.ts b/pogen/dumpTree.ts deleted file mode 100644 index 958c79416..000000000 --- a/pogen/dumpTree.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - This file is part of TALER - (C) 2016 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see - */ - - -/** - * Print the syntax tree of a TypeScript program. - * - * @author Florian Dold - */ - -/// - -"use strict"; - -import {readFileSync} from "fs"; -import {execSync} from "child_process"; -import * as ts from "typescript"; - - -export function processFile(sourceFile: ts.SourceFile) { - processNode(sourceFile); - - function processNode(node: ts.Node, level=0) { - let indent = ""; - for (let i = 0; i < level; i++) { - indent = indent + " "; - } - console.log(indent + ts.SyntaxKind[node.kind]); - ts.forEachChild(node, (n) => processNode(n, level+1)); - } -} - -const fileNames = process.argv.slice(2); - -fileNames.forEach(fileName => { - let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES2016, /*setParentNodes */ true); - processFile(sourceFile); -}); diff --git a/pogen/example/messages.po b/pogen/example/messages.po deleted file mode 100644 index 1addae3f2..000000000 --- a/pogen/example/messages.po +++ /dev/null @@ -1,107 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-01-27 01:51+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: example/test.ts:3 -#, csharp-format -msgid "Hello1, World" -msgstr "" - -#: example/test.ts:4 -#, csharp-format -msgid "Hello2, World" -msgstr "" - -#: example/test.ts:5 -#, csharp-format -msgid "Hello3, World" -msgstr "" - -#. This is a comment and should be included -#: example/test.ts:9 -#, csharp-format -msgid "Hello4, World" -msgstr "" - -#: example/test.ts:12 -#, csharp-format -msgid "Hello5, World" -msgstr "" - -#: example/test.ts:13 -#, csharp-format -msgid "Hello6,{0} World" -msgstr "" - -#. This one has a multi line comment. -#. It has multiple lines, and a trailing empty line. -#. -#: example/test.ts:20 -#, csharp-format -msgid "Hello7,{0} World{1}" -msgstr "" - -#: example/test.ts:21 -#, csharp-format -msgid "{0}Hello8,{1} World{2}" -msgstr "" - -#. -#. This one has a multi line comment. -#. It has multiple lines, and a leading empty line. -#: example/test.ts:28 -#, csharp-format -msgid "Hello9,\" '\" World" -msgstr "" - -#: example/test.ts:32 -#, csharp-format -msgid "" -"Hello10\n" -" ,\" '\" Wo\n" -" rld" -msgstr "" - -#: example/test.ts:37 -#, csharp-format -msgid "" -"Hello11 this is a long long string\n" -"it will go over multiple lines and in the pofile\n" -"it should be wrapped and stuff" -msgstr "" - -#. This is a single line comment -#: example/test.ts:42 -#, csharp-format -msgid "" -"Hello12 this is a long long string it will go over multiple lines and in the " -"pofile it should be wrapped and stuff. asdf asdf asdf asdf asdf asdf asdf asdf " -"adsf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf " -"asdf" -msgstr "" - -#: example/test.ts:42 -#, csharp-format -msgid "This message appears twice" -msgstr "" - -#: example/test.ts:45 -#, csharp-format -msgid "This message appears twice" -msgstr "" - diff --git a/pogen/example/test.ts b/pogen/example/test.ts deleted file mode 100644 index d7d5d88d6..000000000 --- a/pogen/example/test.ts +++ /dev/null @@ -1,63 +0,0 @@ -declare var i18n: any; - -console.log(i18n`Hello1, World`); -console.log(i18n.foo()`Hello2, World`); -console.log(i18n.foo()`Hello3, World`); - - -/* This is a comment and should be included */ -console.log(i18n().foo()`Hello4, World`); - - -console.log(i18n.foo`Hello5, World`); -console.log(i18n.foo`Hello6,${123} World`); - -/* -This one has a multi line comment. -It has multiple lines, and a trailing empty line. - -*/ -console.log(/*lol*/i18n.foo`Hello7,${123} World${42}`); - - -i18n.plural(i18n`one ${"foo"}`, i18`many ${"bar"}`); - -i18n.plural(i18n.foo`one bla ${"foo"}`, i18.foo`many bla ${"bar"}`); - -let x = 42; - -i18n.plural(i18n`I have ${x} apple`, i18n`I have ${x} apples`); - -console.log(i18n`${"foo"}Hello8,${123} World${42}`); - -/* - -This one has a multi line comment. -It has multiple lines, and a leading empty line. -*/ -console.log(i18n`Hello9," '" World`); - -// Comments with space inbetween do not count - -console.log(i18n`Hello10 - ," '" Wo - rld`); - - -console.log(i18n`Hello11 this is a long long string -it will go over multiple lines and in the pofile -it should be wrapped and stuff`); - -// This is a single line comment -console.log(i18n`Hello12 this is a long long string it will go over multiple lines and in the pofile it should be wrapped and stuff. asdf asdf asdf asdf asdf asdf asdf asdf adsf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf`); - -function foo(...args: any[]) { -} - -console.log(foo`Another string, must be excluded`); - - -// First occurence -console.log(i18n`This message appears twice`); -// Second occurence -console.log(i18n`This message appears twice`); diff --git a/pogen/example/test2.tsx b/pogen/example/test2.tsx deleted file mode 100644 index 4133f86fb..000000000 --- a/pogen/example/test2.tsx +++ /dev/null @@ -1,15 +0,0 @@ -let x = foo -{bar} {" foo "} baz - - -let y = ( - - - singular form - second line - - - plural form - - -); diff --git a/pogen/pogen.ts b/pogen/pogen.ts deleted file mode 100644 index 1d31a878a..000000000 --- a/pogen/pogen.ts +++ /dev/null @@ -1,393 +0,0 @@ -/* - This file is part of TALER - (C) 2016 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see - */ - - -/** - * Generate .po file from list of source files. - * - * Note that duplicate message IDs are NOT merged, to get the same output as - * you would from xgettext, just run msguniq. - * - * @author Florian Dold - */ - -/// - -"use strict"; - -import {readFileSync} from "fs"; -import * as ts from "typescript"; - - -function wordwrap(str: string, width: number = 80): string[] { - var regex = '.{1,' + width + '}(\\s|$)|\\S+(\\s|$)'; - return str.match(RegExp(regex, 'g')); -} - -export function processFile(sourceFile: ts.SourceFile) { - processNode(sourceFile); - let lastTokLine = 0; - let preLastTokLine = 0; - - function getTemplate(node: ts.Node): string { - switch (node.kind) { - case ts.SyntaxKind.FirstTemplateToken: - return (node).text; - case ts.SyntaxKind.TemplateExpression: - let te = node; - let textFragments = [te.head.text]; - for (let tsp of te.templateSpans) { - textFragments.push(`%${(textFragments.length-1)/2+1}$s`); - textFragments.push(tsp.literal.text.replace(/%/g, "%%")); - } - return textFragments.join(''); - default: - return "(pogen.ts: unable to parse)"; - } - } - - function getComment(node: ts.Node): string { - let lc = ts.getLineAndCharacterOfPosition(sourceFile, node.pos); - let lastComments; - for (let l = preLastTokLine; l < lastTokLine; l++) { - let pos = ts.getPositionOfLineAndCharacter(sourceFile, l, 0); - let comments = ts.getTrailingCommentRanges(sourceFile.text, pos); - if (comments) { - lastComments = comments; - } - } - if (!lastComments) { - return; - } - let candidate = lastComments[lastComments.length-1]; - let candidateEndLine = ts.getLineAndCharacterOfPosition(sourceFile, candidate.end).line; - if (candidateEndLine != lc.line - 1) { - return; - } - let text = sourceFile.text.slice(candidate.pos, candidate.end); - switch (candidate.kind) { - case ts.SyntaxKind.SingleLineCommentTrivia: - // Remove comment leader - text = text.replace(/^[/][/]\s*/, ""); - break; - case ts.SyntaxKind.MultiLineCommentTrivia: - // Remove comment leader and trailer, - // handling white space just like xgettext. - text = text - .replace(/^[/][*](\s*?\n|\s*)?/, "") - .replace(/(\n[ \t]*?)?[*][/]$/, ""); - break; - } - return text; - } - - function getPath(node: ts.Node): string[] { - switch (node.kind) { - case ts.SyntaxKind.PropertyAccessExpression: - let pae = node; - return Array.prototype.concat(getPath(pae.expression), [pae.name.text]); - case ts.SyntaxKind.Identifier: - let id = node; - return [id.text]; - } - return ["(other)"]; - } - - function arrayEq(a1: T[], a2: T[]) { - if (a1.length != a2.length) { - return false; - } - for (let i = 0; i < a1.length; i++) { - if (a1[i] != a2[i]) { - return false; - } - } - return true; - } - - interface TemplateResult { - comment: string; - path: string[]; - template: string; - line: number; - } - - function processTaggedTemplateExpression(tte: ts.TaggedTemplateExpression): TemplateResult { - let lc = ts.getLineAndCharacterOfPosition(sourceFile, tte.pos); - if (lc.line != lastTokLine) { - preLastTokLine = lastTokLine; - lastTokLine = lc.line; - } - let path = getPath(tte.tag) - let res: TemplateResult = { - path, - line: lc.line, - comment: getComment(tte), - template: getTemplate(tte.template).replace(/"/g, '\\"'), - }; - return res; - } - - function formatMsgComment(line: number, comment?: string) { - if (comment) { - for (let cl of comment.split('\n')) { - console.log(`#. ${cl}`); - } - } - console.log(`#: ${sourceFile.fileName}:${line+1}`); - console.log(`#, c-format`); - } - - function formatMsgLine(head: string, msg: string) { - // Do escaping, wrap break at newlines - let parts = msg - .match(/(.*\n|.+$)/g) - .map((x) => x.replace(/\n/g, '\\n')) - .map((p) => wordwrap(p)) - .reduce((a,b) => a.concat(b)); - if (parts.length == 1) { - console.log(`${head} "${parts[0]}"`); - } else { - console.log(`${head} ""`); - for (let p of parts) { - console.log(`"${p}"`); - } - } - } - - interface JsxProcessingContext { - - } - - function getJsxElementPath(node: ts.Node) { - let path; - let process = (childNode) => { - switch (childNode.kind) { - case ts.SyntaxKind.JsxOpeningElement: - { - let e = childNode as ts.JsxOpeningElement; - return path = getPath(e.tagName); - } - default: - break; - } - }; - ts.forEachChild(node, process); - return path; - } - - function translateJsxExpression(node: ts.Node, h) { - switch (node.kind) { - case ts.SyntaxKind.StringLiteral: - { - let e = node as ts.StringLiteral; - return e.text; - } - default: - return `%${h[0]++}$s`; - } - } - - function trim(s) { - return s.replace(/^[ \n\t]*/, "").replace(/[ \n\t]*$/, ""); - } - - function getJsxContent(node: ts.Node) { - let fragments = []; - let holeNum = [1]; - let process = (childNode) => { - switch (childNode.kind) { - case ts.SyntaxKind.JsxText: - { - let e = childNode as ts.JsxText; - let t = e.getText().split("\n").map(trim).join("\n"); - fragments.push(t); - } - case ts.SyntaxKind.JsxOpeningElement: - break; - case ts.SyntaxKind.JsxElement: - fragments.push(`%${holeNum[0]++}$s`); - break; - case ts.SyntaxKind.JsxExpression: - { - let e = childNode as ts.JsxExpression; - fragments.push(translateJsxExpression(e.expression, holeNum)); - break; - } - case ts.SyntaxKind.JsxClosingElement: - break; - default: - let lc = ts.getLineAndCharacterOfPosition(childNode.getSourceFile(), childNode.getStart()); - console.error(`unrecognized syntax in JSX Element ${ts.SyntaxKind[childNode.kind]} (${childNode.getSourceFile().fileName}:${lc.line+1}:${lc.character+1}`); - break; - } - }; - ts.forEachChild(node, process); - return fragments.join(""); - } - - function getJsxSingular(node: ts.Node) { - let res; - let process = (childNode) => { - switch (childNode.kind) { - case ts.SyntaxKind.JsxElement: - { - let path = getJsxElementPath(childNode); - if (arrayEq(path, ["i18n", "TranslateSingular"])) { - res = getJsxContent(childNode); - } - } - default: - break; - } - }; - ts.forEachChild(node, process); - return res; - } - - function getJsxPlural(node: ts.Node) { - let res; - let process = (childNode) => { - switch (childNode.kind) { - case ts.SyntaxKind.JsxElement: - { - let path = getJsxElementPath(childNode); - if (arrayEq(path, ["i18n", "TranslatePlural"])) { - res = getJsxContent(childNode); - } - } - default: - break; - } - }; - ts.forEachChild(node, process); - return res; - } - - - function processNode(node: ts.Node) { - switch (node.kind) { - case ts.SyntaxKind.JsxElement: - let path = getJsxElementPath(node); - if (arrayEq(path, ["i18n", "Translate"])) { - let content = getJsxContent(node); - let {line} = ts.getLineAndCharacterOfPosition(sourceFile, node.pos); - let comment = getComment(node); - formatMsgComment(line, comment); - formatMsgLine("msgid", content); - console.log(`msgstr ""`); - console.log(); - return; - } - if (arrayEq(path, ["i18n", "TranslateSwitch"])) { - let {line} = ts.getLineAndCharacterOfPosition(sourceFile, node.pos); - let comment = getComment(node); - formatMsgComment(line, comment); - let singularForm = getJsxSingular(node); - if (!singularForm) { - console.error("singular form missing"); - process.exit(1); - } - let pluralForm = getJsxPlural(node); - if (!pluralForm) { - console.error("plural form missing"); - process.exit(1); - } - formatMsgLine("msgid", singularForm); - formatMsgLine("msgid_plural", pluralForm); - console.log(`msgstr[0] ""`); - console.log(`msgstr[1] ""`); - console.log(); - return; - } - break; - case ts.SyntaxKind.CallExpression: - { - // might be i18n.plural(i18n[.X]`...`, i18n[.X]`...`) - let ce = node; - let path = getPath(ce.expression); - if (!arrayEq(path, ["i18n", "plural"])) { - break; - } - if (ce.arguments[0].kind != ts.SyntaxKind.TaggedTemplateExpression) { - break; - } - if (ce.arguments[1].kind != ts.SyntaxKind.TaggedTemplateExpression) { - break; - } - let {line} = ts.getLineAndCharacterOfPosition(sourceFile, ce.pos); - let t1 = processTaggedTemplateExpression(ce.arguments[0]); - let t2 = processTaggedTemplateExpression(ce.arguments[1]); - let comment = getComment(ce); - - formatMsgComment(line, comment); - formatMsgLine("msgid", t1.template); - formatMsgLine("msgid_plural", t2.template); - console.log(`msgstr[0] ""`); - console.log(`msgstr[1] ""`); - console.log(); - - // Important: no processing for child i18n expressions here - return; - } - case ts.SyntaxKind.TaggedTemplateExpression: - { - let tte = node; - let {comment, template, line, path} = processTaggedTemplateExpression(tte); - if (path[0] != "i18n") { - break; - } - formatMsgComment(line, comment); - formatMsgLine("msgid", template); - console.log(`msgstr ""`); - console.log(); - break; - } - } - - ts.forEachChild(node, processNode); - } -} - -const fileNames = process.argv.slice(2); - -console.log( -`# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: 2016-11-23 00:00+0100\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=UTF-8\\n" -"Content-Transfer-Encoding: 8bit\\n"`); -console.log() - -fileNames.sort(); - -fileNames.forEach(fileName => { - let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES2016, /*setParentNodes */ true); - processFile(sourceFile); -}); diff --git a/pogen/tsconfig.json b/pogen/tsconfig.json deleted file mode 100644 index 3d2b2c002..000000000 --- a/pogen/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "noImplicitAny": false, - "sourceMap": false - }, - "files": [ - "pogen.ts" - ] -} diff --git a/src/background/background.html b/src/background/background.html index 621e0fbb9..962542f9a 100644 --- a/src/background/background.html +++ b/src/background/background.html @@ -1,9 +1,7 @@ - - - + (wallet bg page) diff --git a/src/background/background.ts b/src/background/background.ts index fe2359812..9b50caf9c 100644 --- a/src/background/background.ts +++ b/src/background/background.ts @@ -20,22 +20,9 @@ * @author Florian Dold */ -"use strict"; -window.addEventListener("load", () => { - - // TypeScript does not allow ".js" extensions in the - // module name, so SystemJS must add it. - System.config({ - defaultJSExtensions: true, - }); +import {wxMain} from "./../wxBackend"; - System.import("../wxBackend") - .then((wxMessaging: any) => { - // Export as global for debugger - (window as any).wx = wxMessaging; - wxMessaging.wxMain(); - }).catch((e: Error) => { - console.error("Loading Taler wallet background page failed.", e); - }); +window.addEventListener("load", () => { + wxMain(); }); diff --git a/src/components.ts b/src/components.ts index 066e6d07f..4ed746f67 100644 --- a/src/components.ts +++ b/src/components.ts @@ -21,6 +21,8 @@ * @author Florian Dold */ +import * as React from "react"; + export interface StateHolder { (): T; (newState: T): void; diff --git a/src/content_scripts/notify.ts b/src/content_scripts/notify.ts index bf91b79c9..8a25dd500 100644 --- a/src/content_scripts/notify.ts +++ b/src/content_scripts/notify.ts @@ -25,6 +25,8 @@ "use strict"; +import URI = require("urijs"); + declare var cloneInto: any; // Make sure we don't pollute the namespace too much. @@ -65,7 +67,7 @@ namespace TalerNotify { type: "hash-contract", detail: {contract} }; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { chrome.runtime.sendMessage(walletHashContractMsg, (resp: any) => { if (!resp.hash) { console.log("error", resp); @@ -95,7 +97,7 @@ namespace TalerNotify { historyEntry, }, }; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { chrome.runtime.sendMessage(walletMsg, (resp: any) => { resolve(); }); @@ -114,7 +116,7 @@ namespace TalerNotify { }, }, }; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { chrome.runtime.sendMessage(walletMsg, (resp: any) => { if (resp && resp.error) { reject(resp); @@ -162,7 +164,7 @@ namespace TalerNotify { const walletMsg = { type: "generate-nonce", }; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { chrome.runtime.sendMessage(walletMsg, (resp: any) => { resolve(resp); }); @@ -170,7 +172,7 @@ namespace TalerNotify { } function downloadContract(url: string, nonce: string): Promise { - let parsed_url = URI(url); + let parsed_url = new URI(url); url = parsed_url.setQuery({nonce}).href(); // FIXME: include and check nonce! return new Promise((resolve, reject) => { @@ -243,7 +245,7 @@ namespace TalerNotify { await putHistory(historyEntry); let offerId = await saveOffer(proposal); - const uri = URI(chrome.extension.getURL( + const uri = new URI(chrome.extension.getURL( "/src/pages/confirm-contract.html")); const params = { offerId: offerId.toString(), @@ -294,13 +296,13 @@ namespace TalerNotify { addHandler("taler-create-reserve", (msg: any) => { let params = { amount: JSON.stringify(msg.amount), - callback_url: URI(msg.callback_url) + callback_url: new URI(msg.callback_url) .absoluteTo(document.location.href), bank_url: document.location.href, wt_types: JSON.stringify(msg.wt_types), suggested_exchange_url: msg.suggested_exchange_url, }; - let uri = URI(chrome.extension.getURL("/src/pages/confirm-create-reserve.html")); + let uri = new URI(chrome.extension.getURL("/src/pages/confirm-create-reserve.html")); let redirectUrl = uri.query(params).href(); window.location.href = redirectUrl; }); @@ -309,7 +311,7 @@ namespace TalerNotify { let params = { req: JSON.stringify(msg), }; - let uri = URI(chrome.extension.getURL("/src/pages/add-auditor.html")); + let uri = new URI(chrome.extension.getURL("/src/pages/add-auditor.html")); let redirectUrl = uri.query(params).href(); window.location.href = redirectUrl; }); @@ -340,7 +342,7 @@ namespace TalerNotify { addHandler("taler-pay", async(msg: any, sendResponse: any) => { // current URL without fragment - let url = URI(document.location.href).fragment("").href(); + let url = new URI(document.location.href).fragment("").href(); let res = await queryPayment(url); logVerbose && console.log("taler-pay: got response", res); if (res && res.payReq) { diff --git a/src/cryptoApi-test.ts b/src/cryptoApi-test.ts index 8024b2c75..dde3ea899 100644 --- a/src/cryptoApi-test.ts +++ b/src/cryptoApi-test.ts @@ -1,6 +1,6 @@ import {CryptoApi} from "./cryptoApi"; -import {ReserveRecord, DenominationRecord, denominationRecordFromKeys} from "src/types"; -import {test, TestLib} from "testlib/talertest"; +import {ReserveRecord, DenominationRecord, denominationRecordFromKeys} from "./types"; +import {test, TestLib} from "talertest"; let masterPub1: string = "CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00"; diff --git a/src/cryptoApi.ts b/src/cryptoApi.ts index dbadb45e4..672b90d74 100644 --- a/src/cryptoApi.ts +++ b/src/cryptoApi.ts @@ -86,7 +86,7 @@ export class CryptoApi { ws.currentWorkItem = work; this.numBusy++; if (!ws.w) { - let w = new Worker("/src/cryptoWorker.js"); + let w = new Worker("/dist/cryptoWorker-bundle.js"); w.onmessage = (m: MessageEvent) => this.handleWorkerMessage(ws, m); w.onerror = (e: ErrorEvent) => this.handleWorkerError(ws, e); ws.w = w; @@ -215,7 +215,7 @@ export class CryptoApi { throw Error("assertion failed"); }); - return p.then((r) => { + return p.then((r: T) => { console.log(`rpc ${operation} took ${performance.now() - start}ms`); return r; }); @@ -223,29 +223,29 @@ export class CryptoApi { createPreCoin(denom: DenominationRecord, reserve: ReserveRecord): Promise { - return this.doRpc("createPreCoin", 1, denom, reserve); + return this.doRpc("createPreCoin", 1, denom, reserve); } hashString(str: string): Promise { - return this.doRpc("hashString", 1, str); + return this.doRpc("hashString", 1, str); } isValidDenom(denom: DenominationRecord, masterPub: string): Promise { - return this.doRpc("isValidDenom", 2, denom, masterPub); + return this.doRpc("isValidDenom", 2, denom, masterPub); } signDeposit(offer: OfferRecord, cds: CoinWithDenom[]): Promise { - return this.doRpc("signDeposit", 3, offer, cds); + return this.doRpc("signDeposit", 3, offer, cds); } createEddsaKeypair(): Promise<{priv: string, pub: string}> { - return this.doRpc("createEddsaKeypair", 1); + return this.doRpc<{priv: string, pub: string}>("createEddsaKeypair", 1); } rsaUnblind(sig: string, bk: string, pk: string): Promise { - return this.doRpc("rsaUnblind", 4, sig, bk, pk); + return this.doRpc("rsaUnblind", 4, sig, bk, pk); } createRefreshSession(exchangeBaseUrl: string, @@ -253,7 +253,7 @@ export class CryptoApi { meltCoin: CoinRecord, newCoinDenoms: DenominationRecord[], meltFee: AmountJson): Promise { - return this.doRpc("createRefreshSession", + return this.doRpc("createRefreshSession", 4, exchangeBaseUrl, kappa, diff --git a/src/cryptoLib.ts b/src/cryptoLib.ts deleted file mode 100644 index 717a681f4..000000000 --- a/src/cryptoLib.ts +++ /dev/null @@ -1,359 +0,0 @@ -/* - This file is part of TALER - (C) 2016 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see - */ - -/** - * Web worker for crypto operations. - * @author Florian Dold - */ - -"use strict"; - -import * as native from "./emscriptif"; -import { - PreCoinRecord, PayCoinInfo, AmountJson, - RefreshSessionRecord, RefreshPreCoinRecord, ReserveRecord, CoinStatus, -} from "./types"; -import create = chrome.alarms.create; -import {OfferRecord} from "./wallet"; -import {CoinWithDenom} from "./wallet"; -import {CoinPaySig, CoinRecord} from "./types"; -import {DenominationRecord, Amounts} from "./types"; -import {Amount} from "./emscriptif"; -import {HashContext} from "./emscriptif"; -import {RefreshMeltCoinAffirmationPS} from "./emscriptif"; -import {EddsaPublicKey} from "./emscriptif"; -import {HashCode} from "./emscriptif"; - - -export function main(worker: Worker) { - worker.onmessage = (msg: MessageEvent) => { - if (!Array.isArray(msg.data.args)) { - console.error("args must be array"); - return; - } - if (typeof msg.data.id != "number") { - console.error("RPC id must be number"); - } - if (typeof msg.data.operation != "string") { - console.error("RPC operation must be string"); - } - let f = (RpcFunctions as any)[msg.data.operation]; - if (!f) { - console.error(`unknown operation: '${msg.data.operation}'`); - return; - } - let res = f(...msg.data.args); - worker.postMessage({result: res, id: msg.data.id}); - } -} - - -namespace RpcFunctions { - - /** - * Create a pre-coin of the given denomination to be withdrawn from then given - * reserve. - */ - export function createPreCoin(denom: DenominationRecord, - reserve: ReserveRecord): PreCoinRecord { - let reservePriv = new native.EddsaPrivateKey(); - reservePriv.loadCrock(reserve.reserve_priv); - let reservePub = new native.EddsaPublicKey(); - reservePub.loadCrock(reserve.reserve_pub); - let denomPub = native.RsaPublicKey.fromCrock(denom.denomPub); - let coinPriv = native.EddsaPrivateKey.create(); - let coinPub = coinPriv.getPublicKey(); - let blindingFactor = native.RsaBlindingKeySecret.create(); - let pubHash: native.HashCode = coinPub.hash(); - let ev = native.rsaBlind(pubHash, - blindingFactor, - denomPub); - - if (!ev) { - throw Error("couldn't blind (malicious exchange key?)"); - } - - if (!denom.feeWithdraw) { - throw Error("Field fee_withdraw missing"); - } - - let amountWithFee = new native.Amount(denom.value); - amountWithFee.add(new native.Amount(denom.feeWithdraw)); - let withdrawFee = new native.Amount(denom.feeWithdraw); - - // Signature - let withdrawRequest = new native.WithdrawRequestPS({ - reserve_pub: reservePub, - amount_with_fee: amountWithFee.toNbo(), - withdraw_fee: withdrawFee.toNbo(), - h_denomination_pub: denomPub.encode().hash(), - h_coin_envelope: ev.hash() - }); - - var sig = native.eddsaSign(withdrawRequest.toPurpose(), reservePriv); - - let preCoin: PreCoinRecord = { - reservePub: reservePub.toCrock(), - blindingKey: blindingFactor.toCrock(), - coinPub: coinPub.toCrock(), - coinPriv: coinPriv.toCrock(), - denomPub: denomPub.encode().toCrock(), - exchangeBaseUrl: reserve.exchange_base_url, - withdrawSig: sig.toCrock(), - coinEv: ev.toCrock(), - coinValue: denom.value - }; - return preCoin; - } - - - export function isValidDenom(denom: DenominationRecord, - masterPub: string): boolean { - let p = new native.DenominationKeyValidityPS({ - master: native.EddsaPublicKey.fromCrock(masterPub), - denom_hash: native.RsaPublicKey.fromCrock(denom.denomPub) - .encode() - .hash(), - expire_legal: native.AbsoluteTimeNbo.fromTalerString(denom.stampExpireLegal), - expire_spend: native.AbsoluteTimeNbo.fromTalerString(denom.stampExpireDeposit), - expire_withdraw: native.AbsoluteTimeNbo.fromTalerString(denom.stampExpireWithdraw), - start: native.AbsoluteTimeNbo.fromTalerString(denom.stampStart), - value: (new native.Amount(denom.value)).toNbo(), - fee_deposit: (new native.Amount(denom.feeDeposit)).toNbo(), - fee_refresh: (new native.Amount(denom.feeRefresh)).toNbo(), - fee_withdraw: (new native.Amount(denom.feeWithdraw)).toNbo(), - fee_refund: (new native.Amount(denom.feeRefund)).toNbo(), - }); - - let nativeSig = new native.EddsaSignature(); - nativeSig.loadCrock(denom.masterSig); - - let nativePub = native.EddsaPublicKey.fromCrock(masterPub); - - return native.eddsaVerify(native.SignaturePurpose.MASTER_DENOMINATION_KEY_VALIDITY, - p.toPurpose(), - nativeSig, - nativePub); - - } - - - export function createEddsaKeypair(): {priv: string, pub: string} { - const priv = native.EddsaPrivateKey.create(); - const pub = priv.getPublicKey(); - return {priv: priv.toCrock(), pub: pub.toCrock()}; - } - - - export function rsaUnblind(sig: string, bk: string, pk: string): string { - let denomSig = native.rsaUnblind(native.RsaSignature.fromCrock(sig), - native.RsaBlindingKeySecret.fromCrock(bk), - native.RsaPublicKey.fromCrock(pk)); - return denomSig.encode().toCrock() - } - - - /** - * Generate updated coins (to store in the database) - * and deposit permissions for each given coin. - */ - export function signDeposit(offer: OfferRecord, - cds: CoinWithDenom[]): PayCoinInfo { - let ret: PayCoinInfo = []; - - - let feeList: AmountJson[] = cds.map((x) => x.denom.feeDeposit); - let fees = Amounts.add(Amounts.getZero(feeList[0].currency), ...feeList).amount; - // okay if saturates - fees = Amounts.sub(fees, offer.contract.max_fee).amount; - let total = Amounts.add(fees, offer.contract.amount).amount; - - let amountSpent = native.Amount.getZero(cds[0].coin.currentAmount.currency); - let amountRemaining = new native.Amount(total); - for (let cd of cds) { - let coinSpend: Amount; - - if (amountRemaining.value == 0 && amountRemaining.fraction == 0) { - break; - } - - if (amountRemaining.cmp(new native.Amount(cd.coin.currentAmount)) < 0) { - coinSpend = new native.Amount(amountRemaining.toJson()); - } else { - coinSpend = new native.Amount(cd.coin.currentAmount); - } - - amountSpent.add(coinSpend); - amountRemaining.sub(coinSpend); - - let feeDeposit: Amount = new native.Amount(cd.denom.feeDeposit); - - // Give the merchant at least the deposit fee, otherwise it'll reject - // the coin. - if (coinSpend.cmp(feeDeposit) < 0) { - coinSpend = feeDeposit; - } - - let newAmount = new native.Amount(cd.coin.currentAmount); - newAmount.sub(coinSpend); - cd.coin.currentAmount = newAmount.toJson(); - cd.coin.status = CoinStatus.TransactionPending; - - let d = new native.DepositRequestPS({ - h_contract: native.HashCode.fromCrock(offer.H_contract), - h_wire: native.HashCode.fromCrock(offer.contract.H_wire), - amount_with_fee: coinSpend.toNbo(), - coin_pub: native.EddsaPublicKey.fromCrock(cd.coin.coinPub), - deposit_fee: new native.Amount(cd.denom.feeDeposit).toNbo(), - merchant: native.EddsaPublicKey.fromCrock(offer.contract.merchant_pub), - refund_deadline: native.AbsoluteTimeNbo.fromTalerString(offer.contract.refund_deadline), - timestamp: native.AbsoluteTimeNbo.fromTalerString(offer.contract.timestamp), - }); - - let coinSig = native.eddsaSign(d.toPurpose(), - native.EddsaPrivateKey.fromCrock(cd.coin.coinPriv)) - .toCrock(); - - let s: CoinPaySig = { - coin_sig: coinSig, - coin_pub: cd.coin.coinPub, - ub_sig: cd.coin.denomSig, - denom_pub: cd.coin.denomPub, - f: coinSpend.toJson(), - }; - ret.push({sig: s, updatedCoin: cd.coin}); - } - return ret; - } - - - export function createRefreshSession(exchangeBaseUrl: string, - kappa: number, - meltCoin: CoinRecord, - newCoinDenoms: DenominationRecord[], - meltFee: AmountJson): RefreshSessionRecord { - - let valueWithFee = Amounts.getZero(newCoinDenoms[0].value.currency); - - for (let ncd of newCoinDenoms) { - valueWithFee = Amounts.add(valueWithFee, - ncd.value, - ncd.feeWithdraw).amount; - } - - // melt fee - valueWithFee = Amounts.add(valueWithFee, meltFee).amount; - - let sessionHc = new HashContext(); - - let transferPubs: string[] = []; - let transferPrivs: string[] = []; - - let preCoinsForGammas: RefreshPreCoinRecord[][] = []; - - for (let i = 0; i < kappa; i++) { - let t = native.EcdhePrivateKey.create(); - let pub = t.getPublicKey(); - sessionHc.read(pub); - transferPrivs.push(t.toCrock()); - transferPubs.push(pub.toCrock()); - } - - for (let i = 0; i < newCoinDenoms.length; i++) { - let r = native.RsaPublicKey.fromCrock(newCoinDenoms[i].denomPub); - sessionHc.read(r.encode()); - } - - sessionHc.read(native.EddsaPublicKey.fromCrock(meltCoin.coinPub)); - sessionHc.read((new native.Amount(valueWithFee)).toNbo()); - - for (let i = 0; i < kappa; i++) { - let preCoins: RefreshPreCoinRecord[] = []; - for (let j = 0; j < newCoinDenoms.length; j++) { - - let transferPriv = native.EcdhePrivateKey.fromCrock(transferPrivs[i]); - let oldCoinPub = native.EddsaPublicKey.fromCrock(meltCoin.coinPub); - let transferSecret = native.ecdhEddsa(transferPriv, oldCoinPub); - - let fresh = native.setupFreshCoin(transferSecret, j); - - let coinPriv = fresh.priv; - let coinPub = coinPriv.getPublicKey(); - let blindingFactor = fresh.blindingKey; - let pubHash: native.HashCode = coinPub.hash(); - let denomPub = native.RsaPublicKey.fromCrock(newCoinDenoms[j].denomPub); - let ev = native.rsaBlind(pubHash, - blindingFactor, - denomPub); - if (!ev) { - throw Error("couldn't blind (malicious exchange key?)"); - } - let preCoin: RefreshPreCoinRecord = { - blindingKey: blindingFactor.toCrock(), - coinEv: ev.toCrock(), - publicKey: coinPub.toCrock(), - privateKey: coinPriv.toCrock(), - }; - preCoins.push(preCoin); - sessionHc.read(ev); - } - preCoinsForGammas.push(preCoins); - } - - let sessionHash = new HashCode(); - sessionHash.alloc(); - sessionHc.finish(sessionHash); - - let confirmData = new RefreshMeltCoinAffirmationPS({ - coin_pub: EddsaPublicKey.fromCrock(meltCoin.coinPub), - amount_with_fee: (new Amount(valueWithFee)).toNbo(), - session_hash: sessionHash, - melt_fee: (new Amount(meltFee)).toNbo() - }); - - - let confirmSig: string = native.eddsaSign(confirmData.toPurpose(), - native.EddsaPrivateKey.fromCrock( - meltCoin.coinPriv)).toCrock(); - - let valueOutput = Amounts.getZero(newCoinDenoms[0].value.currency); - for (let denom of newCoinDenoms) { - valueOutput = Amounts.add(valueOutput, denom.value).amount; - } - - let refreshSession: RefreshSessionRecord = { - meltCoinPub: meltCoin.coinPub, - newDenoms: newCoinDenoms.map((d) => d.denomPub), - confirmSig, - valueWithFee, - transferPubs, - preCoinsForGammas, - hash: sessionHash.toCrock(), - norevealIndex: undefined, - exchangeBaseUrl, - transferPrivs, - finished: false, - valueOutput, - }; - - return refreshSession; - } - - export function hashString(str: string): string { - const b = native.ByteArray.fromStringWithNull(str); - return b.hash().toCrock(); - } -} diff --git a/src/cryptoWorker.ts b/src/cryptoWorker.ts index 661b6e174..0abcb36ff 100644 --- a/src/cryptoWorker.ts +++ b/src/cryptoWorker.ts @@ -21,44 +21,339 @@ "use strict"; +import * as native from "./emscriptif"; +import { + PreCoinRecord, PayCoinInfo, AmountJson, + RefreshSessionRecord, RefreshPreCoinRecord, ReserveRecord, CoinStatus, +} from "./types"; +import create = chrome.alarms.create; +import {OfferRecord} from "./wallet"; +import {CoinWithDenom} from "./wallet"; +import {CoinPaySig, CoinRecord} from "./types"; +import {DenominationRecord, Amounts} from "./types"; +import {Amount} from "./emscriptif"; +import {HashContext} from "./emscriptif"; +import {RefreshMeltCoinAffirmationPS} from "./emscriptif"; +import {EddsaPublicKey} from "./emscriptif"; +import {HashCode} from "./emscriptif"; -importScripts("/src/emscripten/taler-emscripten-lib.js", - "/src/vendor/system-csp-production.src.js"); - - -// TypeScript does not allow ".js" extensions in the -// module name, so SystemJS must add it. -System.config({ - defaultJSExtensions: true, - map: { - "src": "/src", - }, -}); - -// We expect that in the manifest, the emscripten js is loaded -// becore the background page. -// Currently it is not possible to use SystemJS to load the emscripten js. -declare var Module: any; -if ("object" !== typeof Module) { - throw Error("emscripten not loaded, no 'Module' defined"); -} +namespace RpcFunctions { -// Manually register the emscripten js as a SystemJS, so that -// we can use it from TypeScript by importing it. + /** + * Create a pre-coin of the given denomination to be withdrawn from then given + * reserve. + */ + export function createPreCoin(denom: DenominationRecord, + reserve: ReserveRecord): PreCoinRecord { + let reservePriv = new native.EddsaPrivateKey(); + reservePriv.loadCrock(reserve.reserve_priv); + let reservePub = new native.EddsaPublicKey(); + reservePub.loadCrock(reserve.reserve_pub); + let denomPub = native.RsaPublicKey.fromCrock(denom.denomPub); + let coinPriv = native.EddsaPrivateKey.create(); + let coinPub = coinPriv.getPublicKey(); + let blindingFactor = native.RsaBlindingKeySecret.create(); + let pubHash: native.HashCode = coinPub.hash(); + let ev = native.rsaBlind(pubHash, + blindingFactor, + denomPub); -{ - let mod = System.newModule({Module: Module, default: Module}); - let modName = System.normalizeSync("/src/emscripten/taler-emscripten-lib"); - console.log("registering", modName); - System.set(modName, mod); -} + if (!ev) { + throw Error("couldn't blind (malicious exchange key?)"); + } + + if (!denom.feeWithdraw) { + throw Error("Field fee_withdraw missing"); + } + + let amountWithFee = new native.Amount(denom.value); + amountWithFee.add(new native.Amount(denom.feeWithdraw)); + let withdrawFee = new native.Amount(denom.feeWithdraw); + + // Signature + let withdrawRequest = new native.WithdrawRequestPS({ + reserve_pub: reservePub, + amount_with_fee: amountWithFee.toNbo(), + withdraw_fee: withdrawFee.toNbo(), + h_denomination_pub: denomPub.encode().hash(), + h_coin_envelope: ev.hash() + }); + + var sig = native.eddsaSign(withdrawRequest.toPurpose(), reservePriv); + + let preCoin: PreCoinRecord = { + reservePub: reservePub.toCrock(), + blindingKey: blindingFactor.toCrock(), + coinPub: coinPub.toCrock(), + coinPriv: coinPriv.toCrock(), + denomPub: denomPub.encode().toCrock(), + exchangeBaseUrl: reserve.exchange_base_url, + withdrawSig: sig.toCrock(), + coinEv: ev.toCrock(), + coinValue: denom.value + }; + return preCoin; + } + + + export function isValidDenom(denom: DenominationRecord, + masterPub: string): boolean { + let p = new native.DenominationKeyValidityPS({ + master: native.EddsaPublicKey.fromCrock(masterPub), + denom_hash: native.RsaPublicKey.fromCrock(denom.denomPub) + .encode() + .hash(), + expire_legal: native.AbsoluteTimeNbo.fromTalerString(denom.stampExpireLegal), + expire_spend: native.AbsoluteTimeNbo.fromTalerString(denom.stampExpireDeposit), + expire_withdraw: native.AbsoluteTimeNbo.fromTalerString(denom.stampExpireWithdraw), + start: native.AbsoluteTimeNbo.fromTalerString(denom.stampStart), + value: (new native.Amount(denom.value)).toNbo(), + fee_deposit: (new native.Amount(denom.feeDeposit)).toNbo(), + fee_refresh: (new native.Amount(denom.feeRefresh)).toNbo(), + fee_withdraw: (new native.Amount(denom.feeWithdraw)).toNbo(), + fee_refund: (new native.Amount(denom.feeRefund)).toNbo(), + }); + + let nativeSig = new native.EddsaSignature(); + nativeSig.loadCrock(denom.masterSig); + + let nativePub = native.EddsaPublicKey.fromCrock(masterPub); + + return native.eddsaVerify(native.SignaturePurpose.MASTER_DENOMINATION_KEY_VALIDITY, + p.toPurpose(), + nativeSig, + nativePub); + + } + + + export function createEddsaKeypair(): {priv: string, pub: string} { + const priv = native.EddsaPrivateKey.create(); + const pub = priv.getPublicKey(); + return {priv: priv.toCrock(), pub: pub.toCrock()}; + } -System.import("/src/cryptoLib") - .then((m: any) => { - m.main(self); - }) - .catch((e: Error) => { - console.log("crypto worker failed"); - console.error(e.stack); + + export function rsaUnblind(sig: string, bk: string, pk: string): string { + let denomSig = native.rsaUnblind(native.RsaSignature.fromCrock(sig), + native.RsaBlindingKeySecret.fromCrock(bk), + native.RsaPublicKey.fromCrock(pk)); + return denomSig.encode().toCrock() + } + + + /** + * Generate updated coins (to store in the database) + * and deposit permissions for each given coin. + */ + export function signDeposit(offer: OfferRecord, + cds: CoinWithDenom[]): PayCoinInfo { + let ret: PayCoinInfo = []; + + + let feeList: AmountJson[] = cds.map((x) => x.denom.feeDeposit); + let fees = Amounts.add(Amounts.getZero(feeList[0].currency), ...feeList).amount; + // okay if saturates + fees = Amounts.sub(fees, offer.contract.max_fee).amount; + let total = Amounts.add(fees, offer.contract.amount).amount; + + let amountSpent = native.Amount.getZero(cds[0].coin.currentAmount.currency); + let amountRemaining = new native.Amount(total); + for (let cd of cds) { + let coinSpend: Amount; + + if (amountRemaining.value == 0 && amountRemaining.fraction == 0) { + break; + } + + if (amountRemaining.cmp(new native.Amount(cd.coin.currentAmount)) < 0) { + coinSpend = new native.Amount(amountRemaining.toJson()); + } else { + coinSpend = new native.Amount(cd.coin.currentAmount); + } + + amountSpent.add(coinSpend); + amountRemaining.sub(coinSpend); + + let feeDeposit: Amount = new native.Amount(cd.denom.feeDeposit); + + // Give the merchant at least the deposit fee, otherwise it'll reject + // the coin. + if (coinSpend.cmp(feeDeposit) < 0) { + coinSpend = feeDeposit; + } + + let newAmount = new native.Amount(cd.coin.currentAmount); + newAmount.sub(coinSpend); + cd.coin.currentAmount = newAmount.toJson(); + cd.coin.status = CoinStatus.TransactionPending; + + let d = new native.DepositRequestPS({ + h_contract: native.HashCode.fromCrock(offer.H_contract), + h_wire: native.HashCode.fromCrock(offer.contract.H_wire), + amount_with_fee: coinSpend.toNbo(), + coin_pub: native.EddsaPublicKey.fromCrock(cd.coin.coinPub), + deposit_fee: new native.Amount(cd.denom.feeDeposit).toNbo(), + merchant: native.EddsaPublicKey.fromCrock(offer.contract.merchant_pub), + refund_deadline: native.AbsoluteTimeNbo.fromTalerString(offer.contract.refund_deadline), + timestamp: native.AbsoluteTimeNbo.fromTalerString(offer.contract.timestamp), }); + + let coinSig = native.eddsaSign(d.toPurpose(), + native.EddsaPrivateKey.fromCrock(cd.coin.coinPriv)) + .toCrock(); + + let s: CoinPaySig = { + coin_sig: coinSig, + coin_pub: cd.coin.coinPub, + ub_sig: cd.coin.denomSig, + denom_pub: cd.coin.denomPub, + f: coinSpend.toJson(), + }; + ret.push({sig: s, updatedCoin: cd.coin}); + } + return ret; + } + + + export function createRefreshSession(exchangeBaseUrl: string, + kappa: number, + meltCoin: CoinRecord, + newCoinDenoms: DenominationRecord[], + meltFee: AmountJson): RefreshSessionRecord { + + let valueWithFee = Amounts.getZero(newCoinDenoms[0].value.currency); + + for (let ncd of newCoinDenoms) { + valueWithFee = Amounts.add(valueWithFee, + ncd.value, + ncd.feeWithdraw).amount; + } + + // melt fee + valueWithFee = Amounts.add(valueWithFee, meltFee).amount; + + let sessionHc = new HashContext(); + + let transferPubs: string[] = []; + let transferPrivs: string[] = []; + + let preCoinsForGammas: RefreshPreCoinRecord[][] = []; + + for (let i = 0; i < kappa; i++) { + let t = native.EcdhePrivateKey.create(); + let pub = t.getPublicKey(); + sessionHc.read(pub); + transferPrivs.push(t.toCrock()); + transferPubs.push(pub.toCrock()); + } + + for (let i = 0; i < newCoinDenoms.length; i++) { + let r = native.RsaPublicKey.fromCrock(newCoinDenoms[i].denomPub); + sessionHc.read(r.encode()); + } + + sessionHc.read(native.EddsaPublicKey.fromCrock(meltCoin.coinPub)); + sessionHc.read((new native.Amount(valueWithFee)).toNbo()); + + for (let i = 0; i < kappa; i++) { + let preCoins: RefreshPreCoinRecord[] = []; + for (let j = 0; j < newCoinDenoms.length; j++) { + + let transferPriv = native.EcdhePrivateKey.fromCrock(transferPrivs[i]); + let oldCoinPub = native.EddsaPublicKey.fromCrock(meltCoin.coinPub); + let transferSecret = native.ecdhEddsa(transferPriv, oldCoinPub); + + let fresh = native.setupFreshCoin(transferSecret, j); + + let coinPriv = fresh.priv; + let coinPub = coinPriv.getPublicKey(); + let blindingFactor = fresh.blindingKey; + let pubHash: native.HashCode = coinPub.hash(); + let denomPub = native.RsaPublicKey.fromCrock(newCoinDenoms[j].denomPub); + let ev = native.rsaBlind(pubHash, + blindingFactor, + denomPub); + if (!ev) { + throw Error("couldn't blind (malicious exchange key?)"); + } + let preCoin: RefreshPreCoinRecord = { + blindingKey: blindingFactor.toCrock(), + coinEv: ev.toCrock(), + publicKey: coinPub.toCrock(), + privateKey: coinPriv.toCrock(), + }; + preCoins.push(preCoin); + sessionHc.read(ev); + } + preCoinsForGammas.push(preCoins); + } + + let sessionHash = new HashCode(); + sessionHash.alloc(); + sessionHc.finish(sessionHash); + + let confirmData = new RefreshMeltCoinAffirmationPS({ + coin_pub: EddsaPublicKey.fromCrock(meltCoin.coinPub), + amount_with_fee: (new Amount(valueWithFee)).toNbo(), + session_hash: sessionHash, + melt_fee: (new Amount(meltFee)).toNbo() + }); + + + let confirmSig: string = native.eddsaSign(confirmData.toPurpose(), + native.EddsaPrivateKey.fromCrock( + meltCoin.coinPriv)).toCrock(); + + let valueOutput = Amounts.getZero(newCoinDenoms[0].value.currency); + for (let denom of newCoinDenoms) { + valueOutput = Amounts.add(valueOutput, denom.value).amount; + } + + let refreshSession: RefreshSessionRecord = { + meltCoinPub: meltCoin.coinPub, + newDenoms: newCoinDenoms.map((d) => d.denomPub), + confirmSig, + valueWithFee, + transferPubs, + preCoinsForGammas, + hash: sessionHash.toCrock(), + norevealIndex: undefined, + exchangeBaseUrl, + transferPrivs, + finished: false, + valueOutput, + }; + + return refreshSession; + } + + export function hashString(str: string): string { + const b = native.ByteArray.fromStringWithNull(str); + return b.hash().toCrock(); + } +} + + +let worker: Worker = (self as any) as Worker; + +worker.onmessage = (msg: MessageEvent) => { + if (!Array.isArray(msg.data.args)) { + console.error("args must be array"); + return; + } + if (typeof msg.data.id != "number") { + console.error("RPC id must be number"); + } + if (typeof msg.data.operation != "string") { + console.error("RPC operation must be string"); + } + let f = (RpcFunctions as any)[msg.data.operation]; + if (!f) { + console.error(`unknown operation: '${msg.data.operation}'`); + return; + } + let res = f(...msg.data.args); + worker.postMessage({result: res, id: msg.data.id}); +} diff --git a/src/emscripten/taler-emscripten-lib.d.ts b/src/emscripten/taler-emscripten-lib.d.ts index 97821d9ef..25cfc623e 100644 --- a/src/emscripten/taler-emscripten-lib.d.ts +++ b/src/emscripten/taler-emscripten-lib.d.ts @@ -30,27 +30,23 @@ export interface EmscFunGen { } -export declare namespace Module { - var cwrap: EmscFunGen; +export var cwrap: EmscFunGen; - function ccall(name: string, ret:"number"|"string", argTypes: any[], args: any[]): any +export function ccall(name: string, ret:"number"|"string", argTypes: any[], args: any[]): any - function stringToUTF8(s: string, addr: number, maxLength: number): void +export function stringToUTF8(s: string, addr: number, maxLength: number): void - function _free(ptr: number): void; +export function _free(ptr: number): void; - function _malloc(n: number): number; +export function _malloc(n: number): number; - function Pointer_stringify(p: number, len?: number): string; +export function Pointer_stringify(p: number, len?: number): string; - function getValue(ptr: number, type: string, noSafe?: boolean): number; +export function getValue(ptr: number, type: string, noSafe?: boolean): number; - function setValue(ptr: number, value: number, type: string, - noSafe?: boolean): void; +export function setValue(ptr: number, value: number, type: string, + noSafe?: boolean): void; - function writeStringToMemory(s: string, - buffer: number, - dontAddNull?: boolean): void; -} - -export default Module; +export function writeStringToMemory(s: string, + buffer: number, + dontAddNull?: boolean): void; diff --git a/src/emscripten/taler-emscripten-lib.js b/src/emscripten/taler-emscripten-lib.js index 9fe21d686..dcbea842c 100644 --- a/src/emscripten/taler-emscripten-lib.js +++ b/src/emscripten/taler-emscripten-lib.js @@ -1,23 +1,21 @@ -var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=console.log;if(!Module["printErr"])Module["printErr"]=console.warn;var nodeFS;var nodePath;Module["read"]=function read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.warn(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){abort("NO_DYNAMIC_EXECUTION=1 was set, cannot eval")}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var Runtime={setTempRet0:(function(value){tempRet0=value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),STACK_ALIGN:16,prepVararg:(function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr}),getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),dynCall:(function(sig,ptr,args){if(args&&args.length){assert(args.length==sig.length-1);assert("dynCall_"+sig in Module,"bad function pointer type - no table for sig '"+sig+"'");return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{assert(sig.length==1);assert("dynCall_"+sig in Module,"bad function pointer type - no table for sig '"+sig+"'");return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[],addFunction:(function(func){for(var i=0;i>2];var end=(ret+size+15|0)&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;var ABORT=0;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];if(!func){abort("NO_DYNAMIC_EXECUTION=1 was set, cannot eval")}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;((function(){var JSfuncs={"stackSave":(function(){Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore()}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=Runtime.stackAlloc(len);stringToUTF8(str,ret,len)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!=="array",'Return type should not be "array".');if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}Module["Pointer_stringify"]=Pointer_stringify;function AsciiToString(ptr){var str="";while(1){var ch=HEAP8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}Module["UTF8ArrayToString"]=UTF8ArrayToString;function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}Module["UTF8ToString"]=UTF8ToString;function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}Module["stringToUTF8Array"]=stringToUTF8Array;function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}Module["stringToUTF8"]=stringToUTF8;function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}Module["lengthBytesUTF8"]=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){var __cxa_demangle_func=Module["___cxa_demangle"]||Module["__cxa_demangle"];if(__cxa_demangle_func){try{var s=func.substr(1);var len=lengthBytesUTF8(s)+1;var buf=_malloc(len);stringToUTF8(s,buf,len);var status=_malloc(4);var ret=__cxa_demangle_func(buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}return func}Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}Module["stackTrace"]=stackTrace;var PAGE_SIZE=4096;var HEAP;var buffer;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+" "+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw"Runtime error: The application has corrupted its heap memory area (address zero)!"}function abortStackOverflow(allocSize){abort("Stack overflow! Attempted to allocate "+allocSize+" bytes on the stack, but stack has only "+(STACK_MAX-asm.stackSave()+allocSize)+" bytes available!")}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;var WASM_PAGE_SIZE=64*1024;var totalMemory=WASM_PAGE_SIZE;while(totalMemory0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){checkStackCookie();callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){checkStackCookie();if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i255){assert(false,"Character code "+chr+" ("+String.fromCharCode(chr)+") at offset "+i+" not in 0x00-0xFF.");chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var lastChar,end;if(dontAddNull){end=buffer+lengthBytesUTF8(string);lastChar=HEAP8[end]}stringToUTF8(string,buffer,Infinity);if(dontAddNull)HEAP8[end]=lastChar}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){assert(array.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)");HEAP8.set(array,buffer)}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=(function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32});Math.clz32=Math["clz32"];if(!Math["trunc"])Math["trunc"]=(function(x){return x<0?Math.ceil(x):Math.floor(x)});Math.trunc=Math["trunc"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;var runDependencyTracking={};function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random()}return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!=="undefined"){runDependencyWatcher=setInterval((function(){if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return}var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;Module.printErr("still waiting on run dependencies:")}Module.printErr("dependency: "+dep)}if(shown){Module.printErr("(end of list)")}}),1e4)}}else{Module.printErr("warning: run dependency added without ID")}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id]}else{Module.printErr("warning: run dependency removed without ID")}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var ASM_CONSTS=[];STATIC_BASE=8;STATICTOP=STATIC_BASE+73360;__ATINIT__.push({func:(function(){_GNUNET_util_cl_init()})},{func:(function(){_GNUNET_CRYPTO_random_init()})},{func:(function(){_gpg_err_init()})},{func:(function(){_TALER_gcrypt_init()})});allocate([0,0,0,0,0,0,0,0,102,154,0,127,199,106,69,159,152,186,249,23,254,223,149,34,17,154,0,127,199,106,69,159,152,186,249,23,254,223,149,51,6,154,0,127,199,106,69,159,152,186,249,23,254,223,149,33,255,255,255,255,255,255,255,255,34,174,40,215,152,47,138,66,205,101,239,35,145,68,55,113,47,59,77,236,207,251,192,181,188,219,137,129,165,219,181,233,56,181,72,243,91,194,86,57,25,208,5,182,241,17,241,89,155,79,25,175,164,130,63,146,24,129,109,218,213,94,28,171,66,2,3,163,152,170,7,216,190,111,112,69,1,91,131,18,140,178,228,78,190,133,49,36,226,180,255,213,195,125,12,85,111,137,123,242,116,93,190,114,177,150,22,59,254,177,222,128,53,18,199,37,167,6,220,155,148,38,105,207,116,241,155,193,210,74,241,158,193,105,155,228,227,37,79,56,134,71,190,239,181,213,140,139,198,157,193,15,101,156,172,119,204,161,12,36,117,2,43,89,111,44,233,45,131,228,166,110,170,132,116,74,212,251,65,189,220,169,176,92,181,83,17,131,218,136,249,118,171,223,102,238,82,81,62,152,16,50,180,45,109,198,49,168,63,33,251,152,200,39,3,176,228,14,239,190,199,127,89,191,194,143,168,61,243,11,224,198,37,167,10,147,71,145,167,213,111,130,3,224,81,99,202,6,112,110,14,10,103,41,41,20,252,47,210,70,133,10,183,39,38,201,38,92,56,33,27,46,237,42,196,90,252,109,44,77,223,179,149,157,19,13,56,83,222,99,175,139,84,115,10,101,168,178,119,60,187,10,106,118,230,174,237,71,46,201,194,129,59,53,130,20,133,44,114,146,100,3,241,76,161,232,191,162,1,48,66,188,75,102,26,168,145,151,248,208,112,139,75,194,48,190,84,6,163,81,108,199,24,82,239,214,25,232,146,209,16,169,101,85,36,6,153,214,42,32,113,87,133,53,14,244,184,209,187,50,112,160,106,16,200,208,210,184,22,193,164,25,83,171,65,81,8,108,55,30,153,235,142,223,76,119,72,39,168,72,155,225,181,188,176,52,99,90,201,197,179,12,28,57,203,138,65,227,74,170,216,78,115,227,99,119,79,202,156,91,163,184,178,214,243,111,46,104,252,178,239,93,238,130,143,116,96,47,23,67,111,99,165,120,114,171,240,161,20,120,200,132,236,57,100,26,8,2,199,140,40,30,99,35,250,255,190,144,233,189,130,222,235,108,80,164,21,121,198,178,247,163,249,190,43,83,114,227,242,120,113,198,156,97,38,234,206,62,39,202,7,194,192,33,199,184,134,209,30,235,224,205,214,125,218,234,120,209,110,238,127,79,125,245,186,111,23,114,170,103,240,6,166,152,200,162,197,125,99,10,174,13,249,190,4,152,63,17,27,71,28,19,53,11,113,27,132,125,4,35,245,119,219,40,147,36,199,64,123,171,202,50,188,190,201,21,10,190,158,60,76,13,16,156,196,103,29,67,182,66,62,203,190,212,197,76,42,126,101,252,156,41,127,89,236,250,214,58,171,111,203,95,23,88,71,74,140,25,68,108,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,102,85,0,0,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,37,89,0,0,2,0,0,0,49,89,0,0,4,0,0,0,61,89,0,0,8,0,0,0,73,89,0,0,16,0,0,0,86,89,0,0,32,0,0,0,96,89,0,0,64,0,0,0,107,89,0,0,128,0,0,0,119,89,0,0,0,1,0,0,132,89,0,0,0,2,0,0,144,89,0,0,0,4,0,0,157,89,0,0,0,8,0,0,167,89,0,0,0,16,0,0,178,89,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,17,0,0,0,0,0,0,0,2,0,0,0,11,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,0,0,0,0,2,0,0,0,11,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,0,0,0,0,2,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,0,0,0,0,164,17,0,0,220,28,0,0,80,29,0,0,176,32,0,0,240,48,0,0,0,0,0,0,210,140,0,0,0,1,0,0,0,0,0,0,2,0,0,0,1,0,0,0,102,96,0,0,169,96,0,0,175,96,0,0,243,96,0,0,54,97,0,0,121,97,0,0,188,97,0,0,193,97,0,0,192,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,204,97,0,0,255,97,0,0,50,98,0,0,101,98,0,0,152,98,0,0,203,98,0,0,254,98,0,0,3,99,0,0,224,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,14,99,0,0,73,99,0,0,132,99,0,0,191,99,0,0,250,99,0,0,53,100,0,0,254,98,0,0,112,100,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,123,100,0,0,190,100,0,0,1,101,0,0,68,101,0,0,135,101,0,0,202,101,0,0,254,98,0,0,13,102,0,0,128,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,24,102,0,0,123,102,0,0,222,102,0,0,65,103,0,0,164,103,0,0,7,104,0,0,254,98,0,0,106,104,0,0,9,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,117,104,0,0,252,104,0,0,131,105,0,0,9,106,0,0,143,106,0,0,22,107,0,0,254,98,0,0,157,107,0,0,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,107,0,0,216,107,0,0,3,108,0,0,46,108,0,0,89,108,0,0,132,108,0,0,254,98,0,0,175,108,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,108,0,0,242,108,0,0,37,109,0,0,88,109,0,0,139,109,0,0,190,109,0,0,254,98,0,0,241,109,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,110,0,0,60,110,0,0,119,110,0,0,178,110,0,0,237,110,0,0,40,111,0,0,254,98,0,0,99,111,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,115,111,0,0,182,111,0,0,249,111,0,0,60,112,0,0,127,112,0,0,194,112,0,0,254,98,0,0,5,113,0,0,64,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,113,0,0,104,113,0,0,187,113,0,0,14,114,0,0,97,114,0,0,180,114,0,0,254,98,0,0,7,115,0,0,128,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,115,0,0,122,115,0,0,221,115,0,0,64,116,0,0,163,116,0,0,6,117,0,0,254,98,0,0,105,117,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,117,0,0,252,117,0,0,127,118,0,0,2,119,0,0,133,119,0,0,8,120,0,0,254,98,0,0,139,120,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,153,120,0,0,220,120,0,0,31,121,0,0,98,121,0,0,165,121,0,0,232,121,0,0,254,98,0,0,43,122,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,122,0,0,131,122,0,0,198,122,0,0,9,123,0,0,76,123,0,0,143,123,0,0,254,98,0,0,210,123,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,231,123,0,0,42,124,0,0,109,124,0,0,176,124,0,0,76,123,0,0,243,124,0,0,254,98,0,0,54,125,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,125,0,0,142,125,0,0,209,125,0,0,20,126,0,0,87,126,0,0,154,126,0,0,254,98,0,0,221,126,0,0,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,126,0,0,220,120,0,0,110,127,0,0,241,127,0,0,116,128,0,0,247,128,0,0,254,98,0,0,122,129,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,129,0,0,13,130,0,0,144,130,0,0,19,131,0,0,150,131,0,0,25,132,0,0,254,98,0,0,156,132,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,132,0,0,47,133,0,0,178,133,0,0,53,134,0,0,184,134,0,0,59,135,0,0,254,98,0,0,190,135,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,135,0,0,87,126,0,0,220,120,0,0,11,136,0,0,78,136,0,0,145,136,0,0,254,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,210,140,0,0,212,136,0,0,193,97,0,0,235,136,0,0,193,97,0,0,255,136,0,0,193,97,0,0,10,137,0,0,193,97,0,0,20,137,0,0,3,99,0,0,29,137,0,0,3,99,0,0,39,137,0,0,3,99,0,0,52,137,0,0,112,100,0,0,61,137,0,0,112,100,0,0,81,137,0,0,112,100,0,0,92,137,0,0,112,100,0,0,102,137,0,0,13,102,0,0,111,137,0,0,13,102,0,0,121,137,0,0,13,102,0,0,134,137,0,0,106,104,0,0,143,137,0,0,106,104,0,0,153,137,0,0,106,104,0,0,166,137,0,0,157,107,0,0,175,137,0,0,175,108,0,0,196,137,0,0,241,109,0,0,217,137,0,0,99,111,0,0,238,137,0,0,5,113,0,0,3,138,0,0,7,115,0,0,24,138,0,0,105,117,0,0,46,138,0,0,139,120,0,0,68,138,0,0,43,122,0,0,85,138,0,0,210,123,0,0,102,138,0,0,54,125,0,0,119,138,0,0,43,122,0,0,136,138,0,0,54,125,0,0,160,138,0,0,43,122,0,0,184,138,0,0,54,125,0,0,201,138,0,0,122,129,0,0,218,138,0,0,156,132,0,0,238,138,0,0,190,135,0,0,2,139,0,0,0,0,0,0,0,0,0,0,110,141,0,0,124,141,0,0,153,141,0,0,22,75,122,123,252,248,25,226,227,149,251,231,59,86,224,163,135,189,100,34,46,131,31,214,16,39,12,215,234,37,5,84,151,88,191,117,192,90,153,74,109,3,79,101,248,240,230,253,202,234,177,163,77,74,107,75,99,110,7,10,56,188,231,55,158,141,0,0,172,141,0,0,181,141,0,0,135,170,124,222,165,239,97,157,79,240,180,36,26,29,108,176,35,121,244,226,206,78,194,120,122,208,179,5,69,225,124,222,218,168,51,183,214,184,167,2,3,139,39,78,174,163,244,228,190,157,145,78,235,97,241,112,46,105,108,32,58,18,104,84,202,141,0,0,217,141,0,0,12,142,0,0,250,115,176,8,157,86,162,132,239,176,240,117,108,137,11,233,177,181,219,221,142,232,26,54,85,248,62,51,178,39,157,57,191,62,132,130,121,167,34,200,6,180,133,164,126,103,200,7,185,70,163,55,190,232,148,38,116,39,136,89,225,50,146,251,33,142,0,0,48,142,0,0,99,142,0,0,176,186,70,86,55,69,140,105,144,229,168,197,246,29,74,247,229,118,217,127,249,75,135,45,231,111,128,80,54,30,227,219,169,28,165,193,26,162,94,180,214,121,39,92,197,120,128,99,165,241,151,65,18,12,79,45,226,173,235,235,16,162,152,221,125,142,0,0,141,142,0,0,196,142,0,0,128,178,66,99,199,193,163,235,183,20,147,193,221,123,232,180,155,70,209,244,27,74,238,193,18,27,1,55,131,248,243,82,107,86,208,55,224,95,37,152,189,15,210,33,93,106,30,82,149,230,79,115,246,63,10,236,139,145,90,152,93,120,101,152,72,143,0,0,89,143,0,0,196,142,0,0,227,123,106,119,93,200,125,186,164,223,169,249,110,94,63,253,222,189,113,248,134,114,137,134,93,245,163,45,32,205,201,68,182,2,44,172,60,73,130,177,13,94,235,85,195,228,222,21,19,70,118,251,109,224,68,96,101,201,116,64,250,140,106,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,141,0,0,124,141,0,0,153,141,0,0,175,69,210,227,118,72,64,49,97,127,120,210,181,138,107,27,156,126,244,100,245,160,27,71,228,46,195,115,99,34,68,94,142,34,64,202,94,105,226,199,139,50,57,236,250,178,22,73,158,141,0,0,172,141,0,0,181,141,0,0,175,208,57,68,216,72,149,98,107,8,37,244,171,70,144,127,21,249,218,219,228,16,30,198,130,170,3,76,124,235,197,156,250,234,158,169,7,110,222,127,74,241,82,232,178,250,156,182,202,141,0,0,217,141,0,0,12,142,0,0,136,6,38,8,211,230,173,138,10,162,172,224,20,200,168,111,10,166,53,217,71,172,159,235,232,62,244,229,89,102,20,75,42,90,179,157,193,56,20,185,78,58,182,225,1,163,79,39,33,142,0,0,48,142,0,0,99,142,0,0,62,138,105,183,120,60,37,133,25,51,171,98,144,175,108,167,122,153,129,72,8,80,0,156,197,87,124,110,31,87,59,78,104,1,221,35,196,167,214,121,204,248,163,134,198,116,207,251,125,142,0,0,141,142,0,0,196,142,0,0,78,206,8,68,133,129,62,144,136,210,198,58,4,27,197,180,79,158,241,1,42,43,88,143,60,209,31,5,3,58,196,198,12,46,246,171,64,48,254,130,150,36,141,241,99,244,73,82,72,143,0,0,89,143,0,0,196,142,0,0,102,23,23,142,148,31,2,13,53,30,47,37,78,143,211,44,96,36,32,254,176,184,251,154,220,206,187,130,70,30,153,197,166,120,204,49,231,153,23,109,56,96,230,17,12,70,82,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,141,0,0,124,141,0,0,153,141,0,0,91,220,193,70,191,96,117,78,106,4,36,38,8,149,117,199,90,0,63,8,157,39,57,131,157,236,88,185,100,236,56,67,158,141,0,0,172,141,0,0,181,141,0,0,176,52,76,97,216,219,56,83,92,168,175,206,175,11,241,43,136,29,194,0,201,131,61,167,38,233,55,108,46,50,207,247,202,141,0,0,217,141,0,0,12,142,0,0,119,62,169,30,54,128,14,70,133,77,184,235,208,145,129,167,41,89,9,139,62,248,193,34,217,99,85,20,206,213,101,254,33,142,0,0,48,142,0,0,99,142,0,0,130,85,138,56,154,68,60,14,164,204,129,152,153,242,8,58,133,240,250,163,229,120,248,7,122,46,63,244,103,41,102,91,125,142,0,0,141,142,0,0,196,142,0,0,96,228,49,89,30,224,182,127,13,138,38,170,203,245,183,127,142,11,198,33,55,40,197,20,5,70,4,15,14,227,127,84,72,143,0,0,89,143,0,0,196,142,0,0,155,9,255,167,27,148,47,203,39,99,95,188,213,176,233,68,191,220,99,100,79,7,19,147,138,127,81,83,92,58,53,226,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,141,0,0,124,141,0,0,153,141,0,0,163,14,1,9,139,198,219,191,69,105,15,58,126,158,109,15,139,190,162,163,158,97,72,0,143,208,94,68,158,141,0,0,172,141,0,0,181,141,0,0,137,111,177,18,138,187,223,25,104,50,16,124,212,157,243,63,71,180,177,22,153,18,186,79,83,104,75,34,202,141,0,0,217,141,0,0,12,142,0,0,127,179,203,53,136,198,193,246,255,169,105,77,125,106,210,100,147,101,176,193,246,93,105,209,236,131,51,234,33,142,0,0,48,142,0,0,99,142,0,0,108,17,80,104,116,1,60,172,106,42,188,27,179,130,98,124,236,106,144,216,110,252,1,45,231,175,236,90,125,142,0,0,141,142,0,0,196,142,0,0,149,233,160,219,150,32,149,173,174,190,155,45,111,13,188,226,212,153,241,18,242,210,183,39,63,166,135,14,72,143,0,0,89,143,0,0,196,142,0,0,58,133,65,102,172,93,159,2,63,84,213,23,208,179,157,189,148,103,112,219,156,43,149,201,246,245,101,209,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,30,0,0,240,31,0,0,180,30,0,0,48,32,0,0,112,32,0,0,196,29,0,0,0,0,0,0,156,2,0,0,247,147,0,0,2,0,0,0,252,147,0,0,1,0,0,0,0,148,0,0,8,0,0,0,7,148,0,0,3,0,0,0,17,148,0,0,3,0,0,0,24,148,0,0,9,0,0,0,31,148,0,0,10,0,0,0,38,148,0,0,11,0,0,0,45,148,0,0,5,0,0,0,49,148,0,0,45,1,0,0,53,148,0,0,6,0,0,0,59,148,0,0,7,0,0,0,0,0,0,0,0,0,0,0,92,50,0,0,4,30,0,0,0,0,0,0,7,0,0,0,2,0,0,0,187,148,0,0,228,17,0,0,244,17,0,0,16,0,0,0,128,0,0,0,248,1,0,0,1,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,3,151,0,0,12,151,0,0,19,151,0,0,0,0,0,0,167,150,0,0,1,0,0,0,190,150,0,0,3,0,0,0,213,150,0,0,5,0,0,0,236,150,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,107,193,190,226,46,64,159,150,233,61,126,17,115,147,23,42,59,63,217,46,183,45,173,32,51,52,73,248,232,60,251,74,174,45,138,87,30,3,172,156,158,183,111,172,69,175,142,81,200,166,69,55,160,179,169,63,205,227,205,173,159,28,229,139,48,200,28,70,163,92,228,17,229,251,193,25,26,10,82,239,38,117,31,103,163,203,177,64,177,128,140,241,135,164,244,223,246,159,36,69,223,79,155,23,173,43,65,123,230,108,55,16,192,75,5,53,124,93,28,14,234,196,198,111,159,247,242,230,5,0,0,0,43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,107,193,190,226,46,64,159,150,233,61,126,17,115,147,23,42,59,63,217,46,183,45,173,32,51,52,73,248,232,60,251,74,174,45,138,87,30,3,172,156,158,183,111,172,69,175,142,81,119,137,80,141,22,145,143,3,245,60,82,218,197,78,216,37,48,200,28,70,163,92,228,17,229,251,193,25,26,10,82,239,151,64,5,30,156,95,236,246,67,68,247,168,34,96,237,204,246,159,36,69,223,79,155,23,173,43,65,123,230,108,55,16,48,76,101,40,246,89,199,120,102,165,16,217,193,214,174,94,198,99,99,165,248,124,124,132,238,119,119,153,246,123,123,141,255,242,242,13,214,107,107,189,222,111,111,177,145,197,197,84,96,48,48,80,2,1,1,3,206,103,103,169,86,43,43,125,231,254,254,25,181,215,215,98,77,171,171,230,236,118,118,154,143,202,202,69,31,130,130,157,137,201,201,64,250,125,125,135,239,250,250,21,178,89,89,235,142,71,71,201,251,240,240,11,65,173,173,236,179,212,212,103,95,162,162,253,69,175,175,234,35,156,156,191,83,164,164,247,228,114,114,150,155,192,192,91,117,183,183,194,225,253,253,28,61,147,147,174,76,38,38,106,108,54,54,90,126,63,63,65,245,247,247,2,131,204,204,79,104,52,52,92,81,165,165,244,209,229,229,52,249,241,241,8,226,113,113,147,171,216,216,115,98,49,49,83,42,21,21,63,8,4,4,12,149,199,199,82,70,35,35,101,157,195,195,94,48,24,24,40,55,150,150,161,10,5,5,15,47,154,154,181,14,7,7,9,36,18,18,54,27,128,128,155,223,226,226,61,205,235,235,38,78,39,39,105,127,178,178,205,234,117,117,159,18,9,9,27,29,131,131,158,88,44,44,116,52,26,26,46,54,27,27,45,220,110,110,178,180,90,90,238,91,160,160,251,164,82,82,246,118,59,59,77,183,214,214,97,125,179,179,206,82,41,41,123,221,227,227,62,94,47,47,113,19,132,132,151,166,83,83,245,185,209,209,104,0,0,0,0,193,237,237,44,64,32,32,96,227,252,252,31,121,177,177,200,182,91,91,237,212,106,106,190,141,203,203,70,103,190,190,217,114,57,57,75,148,74,74,222,152,76,76,212,176,88,88,232,133,207,207,74,187,208,208,107,197,239,239,42,79,170,170,229,237,251,251,22,134,67,67,197,154,77,77,215,102,51,51,85,17,133,133,148,138,69,69,207,233,249,249,16,4,2,2,6,254,127,127,129,160,80,80,240,120,60,60,68,37,159,159,186,75,168,168,227,162,81,81,243,93,163,163,254,128,64,64,192,5,143,143,138,63,146,146,173,33,157,157,188,112,56,56,72,241,245,245,4,99,188,188,223,119,182,182,193,175,218,218,117,66,33,33,99,32,16,16,48,229,255,255,26,253,243,243,14,191,210,210,109,129,205,205,76,24,12,12,20,38,19,19,53,195,236,236,47,190,95,95,225,53,151,151,162,136,68,68,204,46,23,23,57,147,196,196,87,85,167,167,242,252,126,126,130,122,61,61,71,200,100,100,172,186,93,93,231,50,25,25,43,230,115,115,149,192,96,96,160,25,129,129,152,158,79,79,209,163,220,220,127,68,34,34,102,84,42,42,126,59,144,144,171,11,136,136,131,140,70,70,202,199,238,238,41,107,184,184,211,40,20,20,60,167,222,222,121,188,94,94,226,22,11,11,29,173,219,219,118,219,224,224,59,100,50,50,86,116,58,58,78,20,10,10,30,146,73,73,219,12,6,6,10,72,36,36,108,184,92,92,228,159,194,194,93,189,211,211,110,67,172,172,239,196,98,98,166,57,145,145,168,49,149,149,164,211,228,228,55,242,121,121,139,213,231,231,50,139,200,200,67,110,55,55,89,218,109,109,183,1,141,141,140,177,213,213,100,156,78,78,210,73,169,169,224,216,108,108,180,172,86,86,250,243,244,244,7,207,234,234,37,202,101,101,175,244,122,122,142,71,174,174,233,16,8,8,24,111,186,186,213,240,120,120,136,74,37,37,111,92,46,46,114,56,28,28,36,87,166,166,241,115,180,180,199,151,198,198,81,203,232,232,35,161,221,221,124,232,116,116,156,62,31,31,33,150,75,75,221,97,189,189,220,13,139,139,134,15,138,138,133,224,112,112,144,124,62,62,66,113,181,181,196,204,102,102,170,144,72,72,216,6,3,3,5,247,246,246,1,28,14,14,18,194,97,97,163,106,53,53,95,174,87,87,249,105,185,185,208,23,134,134,145,153,193,193,88,58,29,29,39,39,158,158,185,217,225,225,56,235,248,248,19,43,152,152,179,34,17,17,51,210,105,105,187,169,217,217,112,7,142,142,137,51,148,148,167,45,155,155,182,60,30,30,34,21,135,135,146,201,233,233,32,135,206,206,73,170,85,85,255,80,40,40,120,165,223,223,122,3,140,140,143,89,161,161,248,9,137,137,128,26,13,13,23,101,191,191,218,215,230,230,49,132,66,66,198,208,104,104,184,130,65,65,195,41,153,153,176,90,45,45,119,30,15,15,17,123,176,176,203,168,84,84,252,109,187,187,214,44,22,22,58,81,244,167,80,126,65,101,83,26,23,164,195,58,39,94,150,59,171,107,203,31,157,69,241,172,250,88,171,75,227,3,147,32,48,250,85,173,118,109,246,136,204,118,145,245,2,76,37,79,229,215,252,197,42,203,215,38,53,68,128,181,98,163,143,222,177,90,73,37,186,27,103,69,234,14,152,93,254,192,225,195,47,117,2,129,76,240,18,141,70,151,163,107,211,249,198,3,143,95,231,21,146,156,149,191,109,122,235,149,82,89,218,212,190,131,45,88,116,33,211,73,224,105,41,142,201,200,68,117,194,137,106,244,142,121,120,153,88,62,107,39,185,113,221,190,225,79,182,240,136,173,23,201,32,172,102,125,206,58,180,99,223,74,24,229,26,49,130,151,81,51,96,98,83,127,69,177,100,119,224,187,107,174,132,254,129,160,28,249,8,43,148,112,72,104,88,143,69,253,25,148,222,108,135,82,123,248,183,171,115,211,35,114,75,2,226,227,31,143,87,102,85,171,42,178,235,40,7,47,181,194,3,134,197,123,154,211,55,8,165,48,40,135,242,35,191,165,178,2,3,106,186,237,22,130,92,138,207,28,43,167,121,180,146,243,7,242,240,78,105,226,161,101,218,244,205,6,5,190,213,209,52,98,31,196,166,254,138,52,46,83,157,162,243,85,160,5,138,225,50,164,246,235,117,11,131,236,57,64,96,239,170,94,113,159,6,189,110,16,81,62,33,138,249,150,221,6,61,221,62,5,174,77,230,189,70,145,84,141,181,113,196,93,5,4,6,212,111,96,80,21,255,25,152,251,36,214,189,233,151,137,64,67,204,103,217,158,119,176,232,66,189,7,137,139,136,231,25,91,56,121,200,238,219,161,124,10,71,124,66,15,233,248,132,30,201,0,0,0,0,9,128,134,131,50,43,237,72,30,17,112,172,108,90,114,78,253,14,255,251,15,133,56,86,61,174,213,30,54,45,57,39,10,15,217,100,104,92,166,33,155,91,84,209,36,54,46,58,12,10,103,177,147,87,231,15,180,238,150,210,27,155,145,158,128,192,197,79,97,220,32,162,90,119,75,105,28,18,26,22,226,147,186,10,192,160,42,229,60,34,224,67,18,27,23,29,14,9,13,11,242,139,199,173,45,182,168,185,20,30,169,200,87,241,25,133,175,117,7,76,238,153,221,187,163,127,96,253,247,1,38,159,92,114,245,188,68,102,59,197,91,251,126,52,139,67,41,118,203,35,198,220,182,237,252,104,184,228,241,99,215,49,220,202,66,99,133,16,19,151,34,64,132,198,17,32,133,74,36,125,210,187,61,248,174,249,50,17,199,41,161,109,29,158,47,75,220,178,48,243,13,134,82,236,119,193,227,208,43,179,22,108,169,112,185,153,17,148,72,250,71,233,100,34,168,252,140,196,160,240,63,26,86,125,44,216,34,51,144,239,135,73,78,199,217,56,209,193,140,202,162,254,152,212,11,54,166,245,129,207,165,122,222,40,218,183,142,38,63,173,191,164,44,58,157,228,80,120,146,13,106,95,204,155,84,126,70,98,246,141,19,194,144,216,184,232,46,57,247,94,130,195,175,245,159,93,128,190,105,208,147,124,111,213,45,169,207,37,18,179,200,172,153,59,16,24,125,167,232,156,99,110,219,59,187,123,205,38,120,9,110,89,24,244,236,154,183,1,131,79,154,168,230,149,110,101,170,255,230,126,33,188,207,8,239,21,232,230,186,231,155,217,74,111,54,206,234,159,9,212,41,176,124,214,49,164,178,175,42,63,35,49,198,165,148,48,53,162,102,192,116,78,188,55,252,130,202,166,224,144,208,176,51,167,216,21,241,4,152,74,65,236,218,247,127,205,80,14,23,145,246,47,118,77,214,141,67,239,176,77,204,170,77,84,228,150,4,223,158,209,181,227,76,106,136,27,193,44,31,184,70,101,81,127,157,94,234,4,1,140,53,93,250,135,116,115,251,11,65,46,179,103,29,90,146,219,210,82,233,16,86,51,109,214,71,19,154,215,97,140,55,161,12,122,89,248,20,142,235,19,60,137,206,169,39,238,183,97,201,53,225,28,229,237,122,71,177,60,156,210,223,89,85,242,115,63,24,20,206,121,115,199,55,191,83,247,205,234,95,253,170,91,223,61,111,20,120,68,219,134,202,175,243,129,185,104,196,62,56,36,52,44,194,163,64,95,22,29,195,114,188,226,37,12,40,60,73,139,255,13,149,65,57,168,1,113,8,12,179,222,216,180,228,156,100,86,193,144,123,203,132,97,213,50,182,112,72,108,92,116,208,184,87,66,82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125,1,0,0,0,2,0,0,0,4,0,0,0,8,0,0,0,16,0,0,0,32,0,0,0,64,0,0,0,128,0,0,0,27,0,0,0,54,0,0,0,108,0,0,0,216,0,0,0,171,0,0,0,77,0,0,0,154,0,0,0,47,0,0,0,94,0,0,0,188,0,0,0,99,0,0,0,198,0,0,0,151,0,0,0,53,0,0,0,106,0,0,0,212,0,0,0,179,0,0,0,125,0,0,0,250,0,0,0,239,0,0,0,197,0,0,0,145,0,0,0,8,0,0,0,2,0,0,0,27,151,0,0,28,29,0,0,40,29,0,0,16,0,0,0,192,0,0,0,248,1,0,0,1,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,130,151,0,0,142,151,0,0,0,0,0,0,34,151,0,0,1,0,0,0,58,151,0,0,3,0,0,0,82,151,0,0,5,0,0,0,106,151,0,0,2,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,2,0,0,0,150,151,0,0,144,29,0,0,156,29,0,0,16,0,0,0,0,1,0,0,248,1,0,0,1,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,253,151,0,0,9,152,0,0,0,0,0,0,157,151,0,0,1,0,0,0,181,151,0,0,3,0,0,0,205,151,0,0,5,0,0,0,229,151,0,0,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,17,152,0,0,27,152,0,0,15,0,0,0,248,29,0,0,20,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,184,0,0,0,0,0,0,0,42,152,0,0,57,152,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,189,153,0,0,88,30,0,0,193,153,0,0,196,153,0,0,203,153,0,0,205,153,0,0,207,153,0,0,1,0,0,0,2,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,3,0,0,0,9,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,255,159,0,0,27,165,0,0,39,165,0,0,0,0,0,0,2,0,0,0,2,0,0,0,64,165,0,0,69,165,0,0,15,0,0,0,156,30,0,0,20,0,0,0,2,0,0,0,1,0,0,0,2,0,0,0,4,0,0,0,184,0,0,0,10,0,0,0,147,165,0,0,168,165,0,0,186,165,0,0,200,165,0,0,214,165,0,0,0,0,0,0,11,0,0,0,2,0,0,0,232,165,0,0,239,165,0,0,19,0,0,0,232,30,0,0,28,0,0,0,3,0,0,0,1,0,0,0,3,0,0,0,5,0,0,0,192,0,0,0,11,0,0,0,245,166,0,0,0,0,0,0,152,47,138,66,145,68,55,113,207,251,192,181,165,219,181,233,91,194,86,57,241,17,241,89,164,130,63,146,213,94,28,171,152,170,7,216,1,91,131,18,190,133,49,36,195,125,12,85,116,93,190,114,254,177,222,128,167,6,220,155,116,241,155,193,193,105,155,228,134,71,190,239,198,157,193,15,204,161,12,36,111,44,233,45,170,132,116,74,220,169,176,92,218,136,249,118,82,81,62,152,109,198,49,168,200,39,3,176,199,127,89,191,243,11,224,198,71,145,167,213,81,99,202,6,103,41,41,20,133,10,183,39,56,33,27,46,252,109,44,77,19,13,56,83,84,115,10,101,187,10,106,118,46,201,194,129,133,44,114,146,161,232,191,162,75,102,26,168,112,139,75,194,163,81,108,199,25,232,146,209,36,6,153,214,133,53,14,244,112,160,106,16,22,193,164,25,8,108,55,30,76,119,72,39,181,188,176,52,179,12,28,57,74,170,216,78,79,202,156,91,243,111,46,104,238,130,143,116,111,99,165,120,20,120,200,132,8,2,199,140,250,255,190,144,235,108,80,164,247,163,249,190,242,120,113,198,8,0,0,0,2,0,0,0,12,167,0,0,19,167,0,0,19,0,0,0,36,32,0,0,32,0,0,0,4,0,0,0,1,0,0,0,3,0,0,0,5,0,0,0,192,0,0,0,11,0,0,0,38,167,0,0,61,167,0,0,0,0,0,0,10,0,0,0,2,0,0,0,83,167,0,0,90,167,0,0,19,0,0,0,100,32,0,0,64,0,0,0,5,0,0,0,1,0,0,0,4,0,0,0,6,0,0,0,224,0,0,0,12,0,0,0,104,169,0,0,127,169,0,0,0,0,0,0,9,0,0,0,2,0,0,0,149,169,0,0,156,169,0,0,19,0,0,0,164,32,0,0,48,0,0,0,6,0,0,0,1,0,0,0,4,0,0,0,6,0,0,0,224,0,0,0,12,0,0,0,175,169,0,0,198,169,0,0,0,0,0,0,10,0,0,0,0,0,0,0,220,169,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,1,0,0,160,16,0,0,13,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,50,188,188,243,33,236,236,198,67,32,32,244,201,179,179,219,3,218,218,123,139,2,2,251,43,226,226,200,250,158,158,74,236,201,201,211,9,212,212,230,107,24,24,107,159,30,30,69,14,152,152,125,56,178,178,232,210,166,166,75,183,38,38,214,87,60,60,50,138,147,147,216,238,130,130,253,152,82,82,55,212,123,123,113,55,187,187,241,151,91,91,225,131,71,71,48,60,36,36,15,226,81,81,248,198,186,186,27,243,74,74,135,72,191,191,250,112,13,13,6,179,176,176,63,222,117,117,94,253,210,210,186,32,125,125,174,49,102,102,91,163,58,58,138,28,89,89,0,0,0,0,188,147,205,205,157,224,26,26,109,44,174,174,193,171,127,127,177,199,43,43,14,185,190,190,128,160,224,224,93,16,138,138,210,82,59,59,213,186,100,100,160,136,216,216,132,165,231,231,7,232,95,95,20,17,27,27,181,194,44,44,144,180,252,252,44,39,49,49,163,101,128,128,178,42,115,115,115,129,12,12,76,95,121,121,84,65,107,107,146,2,75,75,116,105,83,83,54,143,148,148,81,31,131,131,56,54,42,42,176,156,196,196,189,200,34,34,90,248,213,213,252,195,189,189,96,120,72,72,98,206,255,255,150,7,76,76,108,119,65,65,66,230,199,199,247,36,235,235,16,20,28,28,124,99,93,93,40,34,54,54,39,192,103,103,140,175,233,233,19,249,68,68,149,234,20,20,156,187,245,245,199,24,207,207,36,45,63,63,70,227,192,192,59,219,114,114,112,108,84,84,202,76,41,41,227,53,240,240,133,254,8,8,203,23,198,198,17,79,243,243,208,228,140,140,147,89,164,164,184,150,202,202,166,59,104,104,131,77,184,184,32,40,56,56,255,46,229,229,159,86,173,173,119,132,11,11,195,29,200,200,204,255,153,153,3,237,88,88,111,154,25,25,8,10,14,14,191,126,149,149,64,80,112,112,231,48,247,247,43,207,110,110,226,110,31,31,121,61,181,181,12,15,9,9,170,52,97,97,130,22,87,87,65,11,159,159,58,128,157,157,234,100,17,17,185,205,37,37,228,221,175,175,154,8,69,69,164,141,223,223,151,92,163,163,126,213,234,234,218,88,53,53,122,208,237,237,23,252,67,67,102,203,248,248,148,177,251,251,161,211,55,55,29,64,250,250,61,104,194,194,240,204,180,180,222,93,50,50,179,113,156,156,11,231,86,86,114,218,227,227,167,96,135,135,28,27,21,21,239,58,249,249,209,191,99,99,83,169,52,52,62,133,154,154,143,66,177,177,51,209,124,124,38,155,136,136,95,166,61,61,236,215,161,161,118,223,228,228,42,148,129,129,73,1,145,145,129,251,15,15,136,170,238,238,238,97,22,22,33,115,215,215,196,245,151,151,26,168,165,165,235,63,254,254,217,181,109,109,197,174,120,120,57,109,197,197,153,229,29,29,205,164,118,118,173,220,62,62,49,103,203,203,139,71,182,182,1,91,239,239,24,30,18,18,35,197,96,96,221,176,106,106,31,246,77,77,78,233,206,206,45,124,222,222,249,157,85,85,72,90,126,126,79,178,33,33,242,122,3,3,101,38,160,160,142,25,94,94,120,102,90,90,92,75,101,101,88,78,98,98,25,69,253,253,141,244,6,6,229,134,64,64,152,190,242,242,87,172,51,51,103,144,23,23,127,142,5,5,5,94,232,232,100,125,79,79,175,106,137,137,99,149,16,16,182,47,116,116,254,117,10,10,245,146,92,92,183,116,155,155,60,51,45,45,165,214,48,48,206,73,46,46,233,137,73,73,104,114,70,70,68,85,119,119,224,216,168,168,77,4,150,150,67,189,40,40,105,41,169,169,41,121,217,217,46,145,134,134,172,135,209,209,21,74,244,244,89,21,141,141,168,130,214,214,10,188,185,185,158,13,66,66,110,193,246,246,71,184,47,47,223,6,221,221,52,57,35,35,53,98,204,204,106,196,241,241,207,18,193,193,220,235,133,133,34,158,143,143,201,161,113,113,192,240,144,144,155,83,170,170,137,241,1,1,212,225,139,139,237,140,78,78,171,111,142,142,18,162,171,171,162,62,111,111,13,84,230,230,82,242,219,219,187,123,146,146,2,182,183,183,47,202,105,105,169,217,57,57,215,12,211,211,97,35,167,167,30,173,162,162,180,153,195,195,80,68,108,108,4,5,7,7,246,127,4,4,194,70,39,39,22,167,172,172,37,118,208,208,134,19,80,80,86,247,220,220,85,26,132,132,9,81,225,225,190,37,122,122,145,239,19,19,57,57,217,169,23,23,144,103,156,156,113,179,166,166,210,232,7,7,5,4,82,82,152,253,128,128,101,163,228,228,223,118,69,69,8,154,75,75,2,146,224,224,160,128,90,90,102,120,175,175,221,228,106,106,176,221,99,99,191,209,42,42,54,56,230,230,84,13,32,32,67,198,204,204,98,53,242,242,190,152,18,18,30,24,235,235,36,247,161,161,215,236,65,65,119,108,40,40,189,67,188,188,50,117,123,123,212,55,136,136,155,38,13,13,112,250,68,68,249,19,251,251,177,148,126,126,90,72,3,3,122,242,140,140,228,208,182,182,71,139,36,36,60,48,231,231,165,132,107,107,65,84,221,221,6,223,96,96,197,35,253,253,69,25,58,58,163,91,194,194,104,61,141,141,21,89,236,236,33,243,102,102,49,174,111,111,62,162,87,87,22,130,16,16,149,99,239,239,91,1,184,184,77,131,134,134,145,46,109,109,181,217,131,131,31,81,170,170,83,155,93,93,99,124,104,104,59,166,254,254,63,235,48,48,214,165,122,122,37,190,172,172,167,22,9,9,15,12,240,240,53,227,167,167,35,97,144,144,240,192,233,233,175,140,157,157,128,58,92,92,146,245,12,12,129,115,49,49,39,44,208,208,118,37,86,86,231,11,146,146,123,187,206,206,233,78,1,1,241,137,30,30,159,107,52,52,169,83,241,241,196,106,195,195,153,180,91,91,151,241,71,71,131,225,24,24,107,230,34,34,200,189,152,152,14,69,31,31,110,226,179,179,201,244,116,116,47,182,248,248,203,102,153,153,255,204,20,20,234,149,88,88,237,3,220,220,247,86,139,139,225,212,21,21,27,28,162,162,173,30,211,211,12,215,226,226,43,251,200,200,29,195,94,94,25,142,44,44,194,181,73,73,137,233,193,193,18,207,149,149,126,191,125,125,32,186,17,17,100,234,11,11,132,119,197,197,109,57,137,137,106,175,124,124,209,51,113,113,161,201,255,255,206,98,187,187,55,113,15,15,251,129,181,181,61,121,225,225,81,9,62,62,220,173,63,63,45,36,118,118,164,205,85,85,157,249,130,130,238,216,64,64,134,229,120,120,174,197,37,37,205,185,150,150,4,77,119,119,85,68,14,14,10,8,80,80,19,134,247,247,48,231,55,55,211,161,250,250,64,29,97,97,52,170,78,78,140,237,176,176,179,6,84,84,108,112,115,115,42,178,59,59,82,210,159,159,11,65,2,2,139,123,216,216,136,160,243,243,79,17,203,203,103,49,39,39,70,194,103,103,192,39,252,252,180,144,56,56,40,32,4,4,127,246,72,72,120,96,229,229,46,255,76,76,7,150,101,101,75,92,43,43,199,177,142,142,111,171,66,66,13,158,245,245,187,156,219,219,242,82,74,74,243,27,61,61,166,95,164,164,89,147,185,185,188,10,249,249,58,239,19,19,239,145,8,8,254,133,145,145,1,73,22,22,97,238,222,222,124,45,33,33,178,79,177,177,66,143,114,114,219,59,47,47,184,71,191,191,72,135,174,174,44,109,192,192,227,70,60,60,87,214,154,154,133,62,169,169,41,105,79,79,125,100,129,129,148,42,46,46,73,206,198,198,23,203,105,105,202,47,189,189,195,252,163,163,92,151,232,232,94,5,237,237,208,122,209,209,135,172,5,5,142,127,100,100,186,213,165,165,168,26,38,38,183,75,190,190,185,14,135,135,96,167,213,213,248,90,54,54,34,40,27,27,17,20,117,117,222,63,217,217,121,41,238,238,170,136,45,45,51,60],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([121,121,95,76,183,183,182,2,202,202,150,184,53,53,88,218,196,196,156,176,67,67,252,23,132,132,26,85,77,77,246,31,89,89,28,138,178,178,56,125,51,51,172,87,207,207,24,199,6,6,244,141,83,83,105,116,155,155,116,183,151,151,245,196,173,173,86,159,227,227,218,114,234,234,213,126,244,244,74,21,143,143,158,34,171,171,162,18,98,98,78,88,95,95,232,7,29,29,229,153,35,35,57,52,246,246,193,110,108,108,68,80,50,50,93,222,70,70,114,104,160,160,38,101,205,205,147,188,218,218,3,219,186,186,198,248,158,158,250,200,214,214,130,168,110,110,207,43,112,112,80,64,133,133,235,220,10,10,117,254,147,147,138,50,223,223,141,164,41,41,76,202,28,28,20,16,215,215,115,33,180,180,204,240,212,212,9,211,138,138,16,93,81,81,226,15,0,0,0,0,25,25,154,111,26,26,224,157,148,148,143,54,199,199,230,66,201,201,236,74,210,210,253,94,127,127,171,193,168,168,216,224,50,188,117,188,33,236,243,236,67,32,198,32,201,179,244,179,3,218,219,218,139,2,123,2,43,226,251,226,250,158,200,158,236,201,74,201,9,212,211,212,107,24,230,24,159,30,107,30,14,152,69,152,56,178,125,178,210,166,232,166,183,38,75,38,87,60,214,60,138,147,50,147,238,130,216,130,152,82,253,82,212,123,55,123,55,187,113,187,151,91,241,91,131,71,225,71,60,36,48,36,226,81,15,81,198,186,248,186,243,74,27,74,72,191,135,191,112,13,250,13,179,176,6,176,222,117,63,117,253,210,94,210,32,125,186,125,49,102,174,102,163,58,91,58,28,89,138,89,0,0,0,0,147,205,188,205,224,26,157,26,44,174,109,174,171,127,193,127,199,43,177,43,185,190,14,190,160,224,128,224,16,138,93,138,82,59,210,59,186,100,213,100,136,216,160,216,165,231,132,231,232,95,7,95,17,27,20,27,194,44,181,44,180,252,144,252,39,49,44,49,101,128,163,128,42,115,178,115,129,12,115,12,95,121,76,121,65,107,84,107,2,75,146,75,105,83,116,83,143,148,54,148,31,131,81,131,54,42,56,42,156,196,176,196,200,34,189,34,248,213,90,213,195,189,252,189,120,72,96,72,206,255,98,255,7,76,150,76,119,65,108,65,230,199,66,199,36,235,247,235,20,28,16,28,99,93,124,93,34,54,40,54,192,103,39,103,175,233,140,233,249,68,19,68,234,20,149,20,187,245,156,245,24,207,199,207,45,63,36,63,227,192,70,192,219,114,59,114,108,84,112,84,76,41,202,41,53,240,227,240,254,8,133,8,23,198,203,198,79,243,17,243,228,140,208,140,89,164,147,164,150,202,184,202,59,104,166,104,77,184,131,184,40,56,32,56,46,229,255,229,86,173,159,173,132,11,119,11,29,200,195,200,255,153,204,153,237,88,3,88,154,25,111,25,10,14,8,14,126,149,191,149,80,112,64,112,48,247,231,247,207,110,43,110,110,31,226,31,61,181,121,181,15,9,12,9,52,97,170,97,22,87,130,87,11,159,65,159,128,157,58,157,100,17,234,17,205,37,185,37,221,175,228,175,8,69,154,69,141,223,164,223,92,163,151,163,213,234,126,234,88,53,218,53,208,237,122,237,252,67,23,67,203,248,102,248,177,251,148,251,211,55,161,55,64,250,29,250,104,194,61,194,204,180,240,180,93,50,222,50,113,156,179,156,231,86,11,86,218,227,114,227,96,135,167,135,27,21,28,21,58,249,239,249,191,99,209,99,169,52,83,52,133,154,62,154,66,177,143,177,209,124,51,124,155,136,38,136,166,61,95,61,215,161,236,161,223,228,118,228,148,129,42,129,1,145,73,145,251,15,129,15,170,238,136,238,97,22,238,22,115,215,33,215,245,151,196,151,168,165,26,165,63,254,235,254,181,109,217,109,174,120,197,120,109,197,57,197,229,29,153,29,164,118,205,118,220,62,173,62,103,203,49,203,71,182,139,182,91,239,1,239,30,18,24,18,197,96,35,96,176,106,221,106,246,77,31,77,233,206,78,206,124,222,45,222,157,85,249,85,90,126,72,126,178,33,79,33,122,3,242,3,38,160,101,160,25,94,142,94,102,90,120,90,75,101,92,101,78,98,88,98,69,253,25,253,244,6,141,6,134,64,229,64,190,242,152,242,172,51,87,51,144,23,103,23,142,5,127,5,94,232,5,232,125,79,100,79,106,137,175,137,149,16,99,16,47,116,182,116,117,10,254,10,146,92,245,92,116,155,183,155,51,45,60,45,214,48,165,48,73,46,206,46,137,73,233,73,114,70,104,70,85,119,68,119,216,168,224,168,4,150,77,150,189,40,67,40,41,169,105,169,121,217,41,217,145,134,46,134,135,209,172,209,74,244,21,244,21,141,89,141,130,214,168,214,188,185,10,185,13,66,158,66,193,246,110,246,184,47,71,47,6,221,223,221,57,35,52,35,98,204,53,204,196,241,106,241,18,193,207,193,235,133,220,133,158,143,34,143,161,113,201,113,240,144,192,144,83,170,155,170,241,1,137,1,225,139,212,139,140,78,237,78,111,142,171,142,162,171,18,171,62,111,162,111,84,230,13,230,242,219,82,219,123,146,187,146,182,183,2,183,202,105,47,105,217,57,169,57,12,211,215,211,35,167,97,167,173,162,30,162,153,195,180,195,68,108,80,108,5,7,4,7,127,4,246,4,70,39,194,39,167,172,22,172,118,208,37,208,19,80,134,80,247,220,86,220,26,132,85,132,81,225,9,225,37,122,190,122,239,19,145,19,217,169,57,217,144,103,23,144,113,179,156,113,210,232,166,210,5,4,7,5,152,253,82,152,101,163,128,101,223,118,228,223,8,154,69,8,2,146,75,2,160,128,224,160,102,120,90,102,221,228,175,221,176,221,106,176,191,209,99,191,54,56,42,54,84,13,230,84,67,198,32,67,98,53,204,98,190,152,242,190,30,24,18,30,36,247,235,36,215,236,161,215,119,108,65,119,189,67,40,189,50,117,188,50,212,55,123,212,155,38,136,155,112,250,13,112,249,19,68,249,177,148,251,177,90,72,126,90,122,242,3,122,228,208,140,228,71,139,182,71,60,48,36,60,165,132,231,165,65,84,107,65,6,223,221,6,197,35,96,197,69,25,253,69,163,91,58,163,104,61,194,104,21,89,141,21,33,243,236,33,49,174,102,49,62,162,111,62,22,130,87,22,149,99,16,149,91,1,239,91,77,131,184,77,145,46,134,145,181,217,109,181,31,81,131,31,83,155,170,83,99,124,93,99,59,166,104,59,63,235,254,63,214,165,48,214,37,190,122,37,167,22,172,167,15,12,9,15,53,227,240,53,35,97,167,35,240,192,144,240,175,140,233,175,128,58,157,128,146,245,92,146,129,115,12,129,39,44,49,39,118,37,208,118,231,11,86,231,123,187,146,123,233,78,206,233,241,137,1,241,159,107,30,159,169,83,52,169,196,106,241,196,153,180,195,153,151,241,91,151,131,225,71,131,107,230,24,107,200,189,34,200,14,69,152,14,110,226,31,110,201,244,179,201,47,182,116,47,203,102,248,203,255,204,153,255,234,149,20,234,237,3,88,237,247,86,220,247,225,212,139,225,27,28,21,27,173,30,162,173,12,215,211,12,43,251,226,43,29,195,200,29,25,142,94,25,194,181,44,194,137,233,73,137,18,207,193,18,126,191,149,126,32,186,125,32,100,234,17,100,132,119,11,132,109,57,197,109,106,175,137,106,209,51,124,209,161,201,113,161,206,98,255,206,55,113,187,55,251,129,15,251,61,121,181,61,81,9,225,81,220,173,62,220,45,36,63,45,164,205,118,164,157,249,85,157,238,216,130,238,134,229,64,134,174,197,120,174,205,185,37,205,4,77,150,4,85,68,119,85,10,8,14,10,19,134,80,19,48,231,247,48,211,161,55,211,64,29,250,64,52,170,97,52,140,237,78,140,179,6,176,179,108,112,84,108,42,178,115,42,82,210,59,82,11,65,159,11,139,123,2,139,136,160,216,136,79,17,243,79,103,49,203,103,70,194,39,70,192,39,103,192,180,144,252,180,40,32,56,40,127,246,4,127,120,96,72,120,46,255,229,46,7,150,76,7,75,92,101,75,199,177,43,199,111,171,142,111,13,158,66,13,187,156,245,187,242,82,219,242,243,27,74,243,166,95,61,166,89,147,164,89,188,10,185,188,58,239,249,58,239,145,19,239,254,133,8,254,1,73,145,1,97,238,22,97,124,45,222,124,178,79,33,178,66,143,177,66,219,59,114,219,184,71,47,184,72,135,191,72,44,109,174,44,227,70,192,227,87,214,60,87,133,62,154,133,41,105,169,41,125,100,79,125,148,42,129,148,73,206,46,73,23,203,198,23,202,47,105,202,195,252,189,195,92,151,163,92,94,5,232,94,208,122,237,208,135,172,209,135,142,127,5,142,186,213,100,186,168,26,165,168,183,75,38,183,185,14,190,185,96,167,135,96,248,90,213,248,34,40,54,34,17,20,27,17,222,63,117,222,121,41,217,121,170,136,238,170,51,60,45,51,95,76,121,95,182,2,183,182,150,184,202,150,88,218,53,88,156,176,196,156,252,23,67,252,26,85,132,26,246,31,77,246,28,138,89,28,56,125,178,56,172,87,51,172,24,199,207,24,244,141,6,244,105,116,83,105,116,183,155,116,245,196,151,245,86,159,173,86,218,114,227,218,213,126,234,213,74,21,244,74,158,34,143,158,162,18,171,162,78,88,98,78,232,7,95,232,229,153,29,229,57,52,35,57,193,110,246,193,68,80,108,68,93,222,50,93,114,104,70,114,38,101,160,38,147,188,205,147,3,219,218,3,198,248,186,198,250,200,158,250,130,168,214,130,207,43,110,207,80,64,112,80,235,220,133,235,117,254,10,117,138,50,147,138,141,164,223,141,76,202,41,76,20,16,28,20,115,33,215,115,204,240,180,204,9,211,212,9,16,93,138,16,226,15,81,226,0,0,0,0,154,111,25,154,224,157,26,224,143,54,148,143,230,66,199,230,236,74,201,236,253,94,210,253,171,193,127,171,216,224,168,216,47,1,0,0,0,0,0,0,211,177,0,0,0,0,0,0,0,0,0,0,16,0,0,0,128,0,0,0,160,16,0,0,13,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,47,138,66,145,68,55,113,207,251,192,181,165,219,181,233,91,194,86,57,241,17,241,89,164,130,63,146,213,94,28,171,152,170,7,216,1,91,131,18,190,133,49,36,195,125,12,85,116,93,190,114,254,177,222,128,167,6,220,155,116,241,155,193,193,105,155,228,134,71,190,239,198,157,193,15,204,161,12,36,111,44,233,45,170,132,116,74,220,169,176,92,218,136,249,118,82,81,62,152,109,198,49,168,200,39,3,176,199,127,89,191,243,11,224,198,71,145,167,213,81,99,202,6,103,41,41,20,133,10,183,39,56,33,27,46,252,109,44,77,19,13,56,83,84,115,10,101,187,10,106,118,46,201,194,129,133,44,114,146,161,232,191,162,75,102,26,168,112,139,75,194,163,81,108,199,25,232,146,209,36,6,153,214,133,53,14,244,112,160,106,16,22,193,164,25,8,108,55,30,76,119,72,39,181,188,176,52,179,12,28,57,74,170,216,78,79,202,156,91,243,111,46,104,238,130,143,116,111,99,165,120,20,120,200,132,8,2,199,140,250,255,190,144,235,108,80,164,247,163,249,190,242,120,113,198,18,0,0,0,0,0,0,0,3,0,0,0,47,184,0,0,176,50,0,0,51,184,0,0,59,184,0,0,68,184,0,0,71,184,0,0,51,184,0,0,3,0,0,0,7,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,8,0,0,0,20,0,0,0,4,0,0,0,21,0,0,0,9,0,0,0,245,194,0,0,249,194,0,0,255,194,0,0,4,195,0,0,10,195,0,0,0,0,0,0,16,0,0,0,7,0,0,0,22,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,22,0,0,0,37,0,0,0,63,0,0,0,92,0,0,0,117,0,0,0,132,0,0,0,147,0,0,0,161,0,0,0,175,0,0,0,190,0,0,0,205,0,0,0,230,0,0,0,243,0,0,0,2,1,0,0,16,1,0,0,27,1,0,0,41,1,0,0,63,1,0,0,79,1,0,0,109,1,0,0,129,1,0,0,153,1,0,0,179,1,0,0,204,1,0,0,222,1,0,0,231,1,0,0,241,1,0,0,1,2,0,0,14,2,0,0,28,2,0,0,47,2,0,0,71,2,0,0,91,2,0,0,107,2,0,0,122,2,0,0,138,2,0,0,154,2,0,0,171,2,0,0,185,2,0,0,201,2,0,0,228,2,0,0,245,2,0,0,9,3,0,0,28,3,0,0,45,3,0,0,65,3,0,0,77,3,0,0,91,3,0,0,104,3,0,0,120,3,0,0,139,3,0,0,158,3,0,0,178,3,0,0,198,3,0,0,212,3,0,0,234,3,0,0,254,3,0,0,6,4,0,0,10,4,0,0,24,4,0,0,47,4,0,0,55,4,0,0,70,4,0,0,83,4,0,0,98,4,0,0,127,4,0,0,156,4,0,0,179,4,0,0,195,4,0,0,211,4,0,0,231,4,0,0,244,4,0,0,3,5,0,0,20,5,0,0,36,5,0,0,53,5,0,0,70,5,0,0,82,5,0,0,95,5,0,0,126,5,0,0,147,5,0,0,167,5,0,0,188,5,0,0,210,5,0,0,222,5,0,0,237,5,0,0,245,5,0,0,2,6,0,0,11,6,0,0,29,6,0,0,40,6,0,0,51,6,0,0,65,6,0,0,85,6,0,0,98,6,0,0,110,6,0,0,124,6,0,0,136,6,0,0,156,6,0,0,175,6,0,0,195,6,0,0,217,6,0,0,241,6,0,0,6,7,0,0,29,7,0,0,50,7,0,0,65,7,0,0,76,7,0,0,96,7,0,0,109,7,0,0,122,7,0,0,139,7,0,0,161,7,0,0,175,7,0,0,195,7,0,0,211,7,0,0,225,7,0,0,236,7,0,0,0,8,0,0,23,8,0,0,44,8,0,0,59,8,0,0,80,8,0,0,102,8,0,0,118,8,0,0,132,8,0,0,148,8,0,0,162,8,0,0,179,8,0,0,191,8,0,0,223,8,0,0,243,8,0,0,255,8,0,0,9,9,0,0,21,9,0,0,39,9,0,0,60,9,0,0,72,9,0,0,87,9,0,0,104,9,0,0,119,9,0,0,135,9,0,0,149,9,0,0,168,9,0,0,187,9,0,0,210,9,0,0,231,9,0,0,255,9,0,0,17,10,0,0,39,10,0,0,62,10,0,0,80,10,0,0,92,10,0,0,110,10,0,0,127,10,0,0,141,10,0,0,158,10,0,0,173,10,0,0,196,10,0,0,215,10,0,0,228,10,0,0,247,10,0,0,15,11,0,0,42,11,0,0,55,11,0,0,80,11,0,0,91,11,0,0,110,11,0,0,122,11,0,0,138,11,0,0,156,11,0,0,183,11,0,0,190,11,0,0,205,11,0,0,221,11,0,0,237,11,0,0,1,12,0,0,14,12,0,0,26,12,0,0,43,12,0,0,55,12,0,0,72,12,0,0,86,12,0,0,102,12,0,0,129,12,0,0,152,12,0,0,175,12,0,0,198,12,0,0,213,12,0,0,230,12,0,0,248,12,0,0,13,13,0,0,32,13,0,0,63,13,0,0,81,13,0,0,99,13,0,0,121,13,0,0,147,13,0,0,174,13,0,0,191,13,0,0,232,13,0,0,8,14,0,0,46,14,0,0,73,14,0,0,103,14,0,0,133,14,0,0,161,14,0,0,198,14,0,0,222,14,0,0,14,15,0,0,56,15,0,0,96,15,0,0,132,15,0,0,143,15,0,0,161,15,0,0,178,15,0,0,209,15,0,0,230,15,0,0,255,15,0,0,14,16,0,0,38,16,0,0,57,16,0,0,93,16,0,0,114,16,0,0,143,16,0,0,163,16,0,0,190,16,0,0,218,16,0,0,233,16,0,0,244,16,0,0,5,17,0,0,42,17,0,0,87,17,0,0,131,17,0,0,171,17,0,0,209,17,0,0,247,17,0,0,33,18,0,0,67,18,0,0,112,18,0,0,157,18,0,0,170,18,0,0,180,18,0,0,193,18,0,0,228,18,0,0,248,18,0,0,10,19,0,0,33,19,0,0,57,19,0,0,78,19,0,0,106,19,0,0,136,19,0,0,164,19,0,0,184,19,0,0,208,19,0,0,235,19,0,0,253,19,0,0,15,20,0,0,43,20,0,0,58,20,0,0,74,20,0,0,102,20,0,0,125,20,0,0,145,20,0,0,162,20,0,0,190,20,0,0,214,20,0,0,239,20,0,0,3,21,0,0,23,21,0,0,42,21,0,0,71,21,0,0,95,21,0,0,123,21,0,0,150,21,0,0,176,21,0,0,205,21,0,0,229,21,0,0,254,21,0,0,25,22,0,0,54,22,0,0,71,22,0,0,96,22,0,0,119,22,0,0,141,22,0,0,160,22,0,0,182,22,0,0,215,22,0,0,245,22,0,0,12,23,0,0,47,23,0,0,63,23,0,0,83,23,0,0,103,23,0,0,120,23,0,0,147,23,0,0,160,23,0,0,182,23,0,0,202,23,0,0,230,23,0,0,2,24,0,0,21,24,0,0,39,24,0,0,80,24,0,0,120,24,0,0,159,24,0,0,173,24,0,0,208,24,0,0,247,24,0,0,24,25,0,0,51,25,0,0,74,25,0,0,104,25,0,0,135,25,0,0,164,25,0,0,190,25,0,0,213,25,0,0,233,25,0,0,252,25,0,0,22,26,0,0,43,26,0,0,76,26,0,0,113,26,0,0,147,26,0,0,172,26,0,0,201,26,0,0,221,26,0,0,248,26,0,0,28,27,0,0,50,27,0,0,72,27,0,0,100,27,0,0,139,27,0,0,173,27,0,0,195,27,0,0,227,27,0,0,250,27,0,0,31,28,0,0,60,28,0,0,77,28,0,0,105,28,0,0,132,28,0,0,153,28,0,0,180,28,0,0,204,28,0,0,219,28,0,0,247,28,0,0,15,29,0,0,34,29,0,0,56,29,0,0,93,29,0,0,119,29,0,0,145,29,0,0,171,29,0,0,197,29,0,0,223,29,0,0,249,29,0,0,19,30,0,0,45,30,0,0,71,30,0,0,98,30,0,0,125,30,0,0,152,30,0,0,179,30,0,0,206,30,0,0,233,30,0,0,4,31,0,0,27,31,0,0,48,31,0,0,60,31,0,0,7,0,0,0,13,0,0,0,98,0,0,0,99,0,0,0,68,0,0,0,97,0,0,0,11,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,52,0,0,0,9,0,0,0,77,0,0,0,74,0,0,0,53,0,0,0,0,0,0,0,56,0,0,0,57,0,0,0,59,0,0,0,16,0,0,0,125,0,0,0,10,0,0,0,44,0,0,0,70,0,0,0,103,0,0,0,111,0,0,0,104,0,0,0,0,0,0,0,35,0,0,0,35,0,0,0,89,0,0,0,0,0,0,0,33,0,0,0,73,0,0,0,122,0,0,0,17,0,0,0,14,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,0,113,0,0,0,43,0,0,0,0,0,0,0,84,0,0,0,115,0,0,0,4,0,0,0,22,0,0,0,5,0,0,0,106,0,0,0,21,0,0,0,120,0,0,0,51,0,0,0,45,0,0,0,46,0,0,0,47,0,0,0,79,0,0,0,80,0,0,0,83,0,0,0,82,0,0,0,81,0,0,0,48,0,0,0,40,0,0,0,124,0,0,0,24,0,0,0,31,0,0,0,90,0,0,0,72,0,0,0,36,0,0,0,119,0,0,0,0,0,0,0,100,0,0,0,102,0,0,0,101,0,0,0,23,0,0,0,55,0,0,0,105,0,0,0,50,0,0,0,61,0,0,0,19,0,0,0,2,0,0,0,8,0,0,0,37,0,0,0,67,0,0,0,123,0,0,0,12,0,0,0,42,0,0,0,64,0,0,0,65,0,0,0,92,0,0,0,28,0,0,0,63,0,0,0,60,0,0,0,38,0,0,0,15,0,0,0,107,0,0,0,20,0,0,0,39,0,0,0,118,0,0,0,88,0,0,0,95,0,0,0,25,0,0,0,76,0,0,0,6,0,0,0,95,0,0,0,75,0,0,0,1,0,0,0,96,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,0,0,0,93,0,0,0,91,0,0,0,34,0,0,0,78,0,0,0,66,0,0,0,121,0,0,0,85,0,0,0,30,0,0,0,0,0,0,0,108,0,0,0,94,0,0,0,29,0,0,0,3,0,0,0,69,0,0,0,116,0,0,0,86,0,0,0,62,0,0,0,110,0,0,0,109,0,0,0,26,0,0,0,117,0,0,0,49,0,0,0,87,0,0,0,11,0,0,0,18,0,0,0,54,0,0,0,107,128,0,0,81,128,0,0,127,128,0,0,47,128,0,0,49,128,0,0,104,128,0,0,0,128,0,0,82,128,0,0,11,128,0,0,21,128,0,0,6,128,0,0,138,128,0,0,86,128,0,0,1,128,0,0,36,128,0,0,95,128,0,0,19,128,0,0,35,128,0,0,139,128,0,0,80,128,0,0,97,128,0,0,51,128,0,0,48,128,0,0,75,128,0,0,65,128,0,0,102,128,0,0,134,128,0,0,37,128,0,0,91,128,0,0,126,128,0,0,122,128,0,0,66,128,0,0,109,128,0,0,32,128,0,0,117,128,0,0,28,128,0,0,29,128,0,0,69,128,0,0,83,128,0,0,94,128,0,0,98,128,0,0,63,128,0,0,87,128,0,0,43,128,0,0,22,128,0,0,54,128,0,0,55,128,0,0,56,128,0,0,62,128,0,0,136,128,0,0,78,128,0,0,53,128,0,0,10,128,0,0,14,128,0,0,140,128,0,0,76,128,0,0,16,128,0,0,17,128,0,0,18,128,0,0,93,128,0,0,79,128,0,0,131,128,0,0,92,128,0,0,88,128,0,0,89,128,0,0,119,128,0,0,84,128,0,0,4,128,0,0,128,128,0,0,23,128,0,0,114,128,0,0,68,128,0,0,33,128,0,0,13,128,0,0,106,128,0,0,103,128,0,0,12,128,0,0,118,128,0,0,57,128,0,0,58,128,0,0,61,128,0,0,60,128,0,0,59,128,0,0,45,128,0,0,121,128,0,0,130,128,0,0,137,128,0,0,100,128,0,0,30,128,0,0,67,128,0,0,116,128,0,0,90,128,0,0,115,128,0,0,125,128,0,0,101,128,0,0,105,128,0,0,108,128,0,0,5,128,0,0,2,128,0,0,3,128,0,0,72,128,0,0,74,128,0,0,73,128,0,0,24,128,0,0,26,128,0,0,77,128,0,0,50,128,0,0,96,128,0,0,124,128,0,0,133,128,0,0,132,128,0,0,25,128,0,0,41,128,0,0,42,128,0,0,7,128,0,0,46,128,0,0,129,128,0,0,135,128,0,0,99,128,0,0,70,128,0,0,52,128,0,0,120,128,0,0,34,128,0,0,85,128,0,0,64,128,0,0,20,128,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,5,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,0,0,0,24,0,0,0,136,26,1,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,61,0,0,40,62,0,0,5,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,24,0,0,0,144,30,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,192,3,0,0,192,4,0,0,192,5,0,0,192,6,0,0,192,7,0,0,192,8,0,0,192,9,0,0,192,10,0,0,192,11,0,0,192,12,0,0,192,13,0,0,192,14,0,0,192,15,0,0,192,16,0,0,192,17,0,0,192,18,0,0,192,19,0,0,192,20,0,0,192,21,0,0,192,22,0,0,192,23,0,0,192,24,0,0,192,25,0,0,192,26,0,0,192,27,0,0,192,28,0,0,192,29,0,0,192,30,0,0,192,31,0,0,192,0,0,0,179,1,0,0,195,2,0,0,195,3,0,0,195,4,0,0,195,5,0,0,195,6,0,0,195,7,0,0,195,8,0,0,195,9,0,0,195,10,0,0,195,11,0,0,195,12,0,0,195,13,0,0,211,14,0,0,195,15,0,0,195,0,0,12,187,1,0,12,195,2,0,12,195,3,0,12,195,4,0,12,211,32,0,0,0,9,0,0,0,10,0,0,0,13,0,0,0,11,0,0,0,12,0,0,0,133,0,0,0,0,32,0,0,1,32,0,0,2,32,0,0,3,32,0,0,4,32,0,0,5,32,0,0,6,32,0,0,8,32,0,0,9,32,0,0,10,32,0,0,40,32,0,0,41,32,0,0,95,32,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,60,64,0,0,3,0,0,0,0,0,0,0,45,244,81,88,207,140,177,192,70,246,181,203,41,49,3,199,4,91,112,48,180,93,253,32,120,127,139,154,216,89,41,80,104,72,137,171,167,86,3,108,255,183,205,136,63,212,119,180,43,165,163,112,241,186,228,168,252,65,131,253,217,111,225,138,122,47,45,116,150,7,31,13,9,94,3,118,44,112,247,64,165,44,167,111,87,65,168,170,116,223,160,88,100,3,74,199,196,60,83,174,175,95,24,4,21,177,227,109,40,134,171,12,164,191,67,240,233,80,129,57,87,22,82,55,3,0,5,0,7,0,11,0,13,0,17,0,19,0,23,0,29,0,31,0,37,0,41,0,43,0,47,0,53,0,59,0,61,0,67,0,71,0,73,0,79,0,83,0,89,0,97,0,101,0,103,0,107,0,109,0,113,0,127,0,131,0,137,0,139,0,149,0,151,0,157,0,163,0,167,0,173,0,179,0,181,0,191,0,193,0,197,0,199,0,211,0,223,0,227,0,229,0,233,0,239,0,241,0,251,0,1,1,7,1,13,1,15,1,21,1,25,1,27,1,37,1,51,1,55,1,57,1,61,1,75,1,81,1,91,1,93,1,97,1,103,1,111,1,117,1,123,1,127,1,133,1,141,1,145,1,153,1,163,1,165,1,175,1,177,1,183,1,187,1,193,1,201,1,205,1,207,1,211,1,223,1,231,1,235,1,243,1,247,1,253,1,9,2,11,2,29,2,35,2,45,2,51,2,57,2,59,2,65,2,75,2,81,2,87,2,89,2,95,2,101,2,105,2,107,2,119,2,129,2,131,2,135,2,141,2,147,2,149,2,161,2,165,2,171,2,179,2,189,2,197,2,207,2,215,2,221,2,227,2,231,2,239,2,245,2,249,2,1,3,5,3,19,3,29,3,41,3,43,3,53,3,55,3,59,3,61,3,71,3,85,3,89,3,91,3,95,3,109,3,113,3,115,3,119,3,139,3,143,3,151,3,161,3,169,3,173,3,179,3,185,3,199,3,203,3,209,3,215,3,223,3,229,3,241,3,245,3,251,3,253,3,7,4,9,4,15,4,25,4,27,4,37,4,39,4,45,4,63,4,67,4,69,4,73,4,79,4,85,4,93,4,99,4,105,4,127,4,129,4,139,4,147,4,157,4,163,4,169,4,177,4,189,4,193,4,199,4,205,4,207,4,213,4,225,4,235,4,253,4,255,4,3,5,9,5,11,5,17,5,21,5,23,5,27,5,39,5,41,5,47,5,81,5,87,5,93,5,101,5,119,5,129,5,143,5,147,5,149,5,153,5,159,5,167,5,171,5,173,5,179,5,191,5,201,5,203,5,207,5,209,5,213,5,219,5,231,5,243,5,251,5,7,6,13,6,17,6,23,6,31,6,35,6,43,6,47,6,61,6,65,6,71,6,73,6,77,6,83,6,85,6,91,6,101,6,121,6,127,6,131,6,133,6,157,6,161,6,163,6,173,6,185,6,187,6,197,6,205,6,211,6,217,6,223,6,241,6,247,6,251,6,253,6,9,7,19,7,31,7,39,7,55,7,69,7,75,7,79,7,81,7,85,7,87,7,97,7,109,7,115,7,121,7,139,7,141,7,157,7,159,7,181,7,187,7,195,7,201,7,205,7,207,7,211,7,219,7,225,7,235,7,237,7,247,7,5,8,15,8,21,8,33,8,35,8,39,8,41,8,51,8,63,8,65,8,81,8,83,8,89,8,93,8,95,8,105,8,113,8,131,8,155,8,159,8,165,8,173,8,189,8,191,8,195,8,203,8,219,8,221,8,225,8,233,8,239,8,245,8,249,8,5,9,7,9,29,9,35,9,37,9,43,9,47,9,53,9,67,9,73,9,77,9,79,9,85,9,89,9,95,9,107,9,113,9,119,9,133,9,137,9,143,9,155,9,163,9,169,9,173,9,199,9,217,9,227,9,235,9,239,9,245,9,247,9,253,9,19,10,31,10,33,10,49,10,57,10,61,10,73,10,87,10,97,10,99,10,103,10,111,10,117,10,123,10,127,10,129,10,133,10,139,10,147,10,151,10,153,10,159,10,169,10,171,10,181,10,189,10,193,10,207,10,217,10,229,10,231,10,237,10,241,10,243,10,3,11,17,11,21,11,27,11,35,11,41,11,45,11,63,11,71,11,81,11,87,11,93,11,101,11,111,11,123,11,137,11,141,11,147,11,153,11,155,11,183,11,185,11,195,11,203,11,207,11,221,11,225,11,233,11,245,11,251,11,7,12,11,12,17,12,37,12,47,12,49,12,65,12,91,12,95,12,97,12,109,12,115,12,119,12,131,12,137,12,145,12,149,12,157,12,179,12,181,12,185,12,187,12,199,12,227,12,229,12,235,12,241,12,247,12,251,12,1,13,3,13,15,13,19,13,31,13,33,13,43,13,45,13,61,13,63,13,79,13,85,13,105,13,121,13,129,13,133,13,135,13,139,13,141,13,163,13,171,13,183,13,189,13,199,13,201,13,205,13,211,13,213,13,219,13,229,13,231,13,243,13,253,13,255,13,9,14,23,14,29,14,33,14,39,14,47,14,53,14,59,14,75,14,87,14,89,14,93,14,107,14,113,14,117,14,125,14,135,14,143,14,149,14,155,14,177,14,183,14,185,14,195,14,209,14,213,14,219,14,237,14,239,14,249,14,7,15,11,15,13,15,23,15,37,15,41,15,49,15,67,15,71,15,77,15,79,15,83,15,89,15,91,15,103,15,107,15,127,15,149,15,161,15,163,15,167,15,173,15,179,15,181,15,187,15,209,15,211,15,217,15,233,15,239,15,251,15,253,15,3,16,15,16,31,16,33,16,37,16,43,16,57,16,61,16,63,16,81,16,105,16,115,16,121,16,123,16,133,16,135,16,145,16,147,16,157,16,163,16,165,16,175,16,177,16,187,16,193,16,201,16,231,16,241,16,243,16,253,16,5,17,11,17,21,17,39,17,45,17,57,17,69,17,71,17,89,17,95,17,99,17,105,17,111,17,129,17,131,17,141,17,155,17,161,17,165,17,167,17,171,17,195,17,197,17,209,17,215,17,231,17,239,17,245,17,251,17,13,18,29,18,31,18,35,18,41,18,43,18,49,18,55,18,65,18,71,18,83,18,95,18,113,18,115,18,121,18,125,18,143,18,151,18,175,18,179,18,181,18,185,18,191,18,193,18,205,18,209,18,223,18,253,18,7,19,13,19,25,19,39,19,45,19,55,19,67,19,69,19,73,19,79,19,87,19,93,19,103,19,105,19,109,19,123,19,129,19,135,19,0,0,0,0,194,1,132,3,70,2,8,7,202,6,140,4,78,5,16,14,210,15,148,13,86,12,24,9,218,8,156,10,94,11,32,28,226,29,164,31,102,30,40,27,234,26,172,24,110,25,48,18,242,19,180,17,118,16,56,21,250,20,188,22,126,23,64,56,130,57,196,59,6,58,72,63,138,62,204,60,14,61,80,54,146,55,212,53,22,52,88,49,154,48,220,50,30,51,96,36,162,37,228,39,38,38,104,35,170,34,236,32,46,33,112,42,178,43,244,41,54,40,120,45,186,44,252,46,62,47,128,112,66,113,4,115,198,114,136,119,74,118,12,116,206,117,144,126,82,127,20,125,214,124,152,121,90,120,28,122,222,123,160,108,98,109,36,111,230,110,168,107,106,106,44,104,238,105,176,98,114,99,52,97,246,96,184,101,122,100,60,102,254,103,192,72,2,73,68,75,134,74,200,79,10,78,76,76,142,77,208,70,18,71,84,69,150,68,216,65,26,64,92,66,158,67,224,84,34,85,100,87,166,86,232,83,42,82,108,80,174,81,240,90,50,91,116,89,182,88,248,93,58,92,124,94,190,95,0,225,194,224,132,226,70,227,8,230,202,231,140,229,78,228,16,239,210,238,148,236,86,237,24,232,218,233,156,235,94,234,32,253,226,252,164,254,102,255,40,250,234,251,172,249,110,248,48,243,242,242,180,240,118,241,56,244,250,245,188,247,126,246,64,217,130,216,196,218,6,219,72,222,138,223,204,221,14,220,80,215,146,214,212,212,22,213,88,208,154,209,220,211,30,210,96,197,162,196,228,198,38,199,104,194,170,195,236,193,46,192,112,203,178,202,244,200,54,201,120,204,186,205,252,207,62,206,128,145,66,144,4,146,198,147,136,150,74,151,12,149,206,148,144,159,82,158,20,156,214,157,152,152,90,153,28,155,222,154,160,141,98,140,36,142,230,143,168,138,106,139,44,137,238,136,176,131,114,130,52,128,246,129,184,132,122,133,60,135,254,134,192,169,2,168,68,170,134,171,200,174,10,175,76,173,142,172,208,167,18,166,84,164,150,165,216,160,26,161,92,163,158,162,224,181,34,180,100,182,166,183,232,178,42,179,108,177,174,176,240,187,50,186,116,184,182,185,248,188,58,189,124,191,190,190,73,0,49,1,83,0,127,1,48,1,105,0,120,1,255,0,129,1,83,2,130,1,131,1,132,1,133,1,134,1,84,2,135,1,136,1,137,1,86,2,138,1,87,2,139,1,140,1,142,1,221,1,143,1,89,2,144,1,91,2,145,1,146,1,147,1,96,2,148,1,99,2,150,1,105,2,151,1,104,2,152,1,153,1,156,1,111,2,157,1,114,2,159,1,117,2,166,1,128,2,167,1,168,1,169,1,131,2,172,1,173,1,174,1,136,2,175,1,176,1,177,1,138,2,178,1,139,2,183,1,146,2,184,1,185,1,188,1,189,1,196,1,198,1,196,1,197,1,197,1,198,1,199,1,201,1,199,1,200,1,200,1,201,1,202,1,204,1,202,1,203,1,203,1,204,1,241,1,243,1,241,1,242,1,242,1,243,1,244,1,245,1,246,1,149,1,247,1,191,1,32,2,158,1,134,3,172,3,136,3,173,3,137,3,174,3,138,3,175,3,140,3,204,3,142,3,205,3,143,3,206,3,153,3,69,3,153,3,190,31,163,3,194,3,247,3,248,3,250,3,251,3,96,30,155,30,223,0,223,0,158,30,223,0,89,31,81,31,91,31,83,31,93,31,85,31,95,31,87,31,188,31,179,31,204,31,195,31,236,31,229,31,252,31,243,31,58,2,101,44,59,2,60,2,61,2,154,1,62,2,102,44,65,2,66,2,67,2,128,1,68,2,137,2,69,2,140,2,244,3,184,3,249,3,242,3,253,3,123,3,254,3,124,3,255,3,125,3,192,4,207,4,38,33,201,3,42,33,107,0,43,33,229,0,50,33,78,33,131,33,132,33,96,44,97,44,98,44,107,2,99,44,125,29,100,44,125,2,109,44,81,2,110,44,113,2,111,44,80,2,112,44,82,2,114,44,115,44,117,44,118,44,126,44,63,2,127,44,64,2,242,44,243,44,125,167,121,29,139,167,140,167,141,167,101,2,170,167,102,2,199,16,39,45,205,16,45,45,118,3,119,3,156,3,181,0,146,3,208,3,152,3,209,3,166,3,213,3,160,3,214,3,154,3,240,3,161,3,241,3,149,3,245,3,207,3,215,3,0,0,0,0,65,0,32,26,192,0,32,31,0,1,1,47,50,1,1,5,57,1,1,15,74,1,1,45,121,1,1,5,112,3,1,3,145,3,32,17,163,3,32,9,0,4,80,16,16,4,32,32,96,4,1,33,138,4,1,53,193,4,1,13,208,4,1,63,20,5,1,19,49,5,48,38,160,1,1,5,179,1,1,3,205,1,1,15,222,1,1,17,248,1,1,39,34,2,1,17,216,3,1,23,0,30,1,149,160,30,1,95,8,31,248,8,24,31,248,6,40,31,248,8,56,31,248,8,72,31,248,6,104,31,248,8,136,31,248,8,152,31,248,8,168,31,248,8,184,31,248,2,186,31,182,2,200,31,170,4,216,31,248,2,218,31,156,2,232,31,248,2,234,31,144,2,248,31,128,2,250,31,130,2,70,2,1,9,16,5,1,3,96,33,16,16,0,44,48,47,103,44,1,5,128,44,1,99,235,44,1,3,64,166,1,45,128,166,1,23,34,167,1,13,50,167,1,61,121,167,1,3,126,167,1,9,144,167,1,3,160,167,1,9,33,255,32,26,0,0,0,0,119,114,97,112,46,99,0,99,111,109,109,111,110,95,97,108,108,111,99,97,116,105,111,110,46,99,0,71,78,85,78,69,84,95,120,109,97,108,108,111,99,95,0,109,97,108,108,111,99,0,71,78,85,78,69,84,95,120,102,114,101,101,95,0,71,78,85,78,69,84,95,115,110,112,114,105,110,116,102,0,99,111,109,109,111,110,95,108,111,103,103,105,110,103,46,99,0,37,115,45,37,100,0,109,121,108,111,103,0,108,111,99,97,108,116,105,109,101,32,101,114,114,111,114,0,37,98,32,37,100,32,37,72,58,37,77,58,37,83,45,37,37,48,54,117,0,42,32,37,115,0,37,115,32,37,115,32,37,115,32,37,115,0,69,82,82,79,82,0,87,65,82,78,73,78,71,0,77,69,83,83,65,71,69,0,73,78,70,79,0,68,69,66,85,71,0,78,79,78,69,0,73,78,86,65,76,73,68,0,77,101,115,115,97,103,101,32,96,37,46,42,115,39,32,114,101,112,101,97,116,101,100,32,37,117,32,116,105,109,101,115,32,105,110,32,116,104,101,32,108,97,115,116,32,37,115,10,0,71,78,85,78,69,84,95,108,111,103,95,115,107,105,112,0,99,114,121,112,116,111,95,115,121,109,109,101,116,114,105,99,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,115,121,109,109,101,116,114,105,99,95,101,110,99,114,121,112,116,0,115,101,116,117,112,95,99,105,112,104,101,114,95,116,119,111,102,105,115,104,0,115,101,116,117,112,95,99,105,112,104,101,114,95,97,101,115,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,115,121,109,109,101,116,114,105,99,95,100,101,99,114,121,112,116,0,99,114,121,112,116,111,95,101,99,99,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,115,97,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,113,64,101,100,100,115,97,0,40,112,114,105,118,97,116,101,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,100,32,37,98,41,41,41,0,100,101,99,111,100,101,95,112,114,105,118,97,116,101,95,101,99,100,115,97,95,107,101,121,0,103,99,114,121,95,115,101,120,112,95,98,117,105,108,100,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,40,112,114,105,118,97,116,101,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,32,101,100,100,115,97,41,40,100,32,37,98,41,41,41,0,100,101,99,111,100,101,95,112,114,105,118,97,116,101,95,101,100,100,115,97,95,107,101,121,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,104,101,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,100,101,99,111,100,101,95,112,114,105,118,97,116,101,95,101,99,100,104,101,95,107,101,121,0,40,103,101,110,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,32,101,100,100,115,97,32,110,111,45,107,101,121,116,101,115,116,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,104,101,95,107,101,121,95,99,114,101,97,116,101,0,103,99,114,121,95,112,107,95,103,101,110,107,101,121,0,107,101,121,95,102,114,111,109,95,115,101,120,112,0,40,103,101,110,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,115,97,95,107,101,121,95,99,114,101,97,116,101,0,40,103,101,110,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,32,101,100,100,115,97,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,107,101,121,95,99,114,101,97,116,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,115,105,103,110,0,69,100,68,83,65,32,115,105,103,110,105,110,103,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,58,32,37,115,10,0,40,100,97,116,97,40,102,108,97,103,115,32,101,100,100,115,97,41,40,104,97,115,104,45,97,108,103,111,32,37,115,41,40,118,97,108,117,101,32,37,98,41,41,0,100,97,116,97,95,116,111,95,101,100,100,115,97,95,118,97,108,117,101,0,40,112,117,98,108,105,99,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,69,100,50,53,53,49,57,41,40,113,32,37,98,41,41,41,0,40,115,105,103,45,118,97,108,40,101,100,100,115,97,40,114,32,37,98,41,40,115,32,37,98,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,118,101,114,105,102,121,0,40,112,117,98,108,105,99,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,69,100,50,53,53,49,57,41,40,102,108,97,103,115,32,101,100,100,115,97,41,40,113,32,37,98,41,41,41,0,69,100,68,83,65,32,115,105,103,110,97,116,117,114,101,32,118,101,114,105,102,105,99,97,116,105,111,110,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,58,32,37,115,10,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,99,95,101,99,100,104,0,103,101,116,95,97,102,102,105,110,101,32,102,97,105,108,101,100],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240);allocate([71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,104,95,101,100,100,115,97,0,99,114,121,112,116,111,95,104,97,115,104,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,104,97,115,104,95,99,111,110,116,101,120,116,95,115,116,97,114,116,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,104,97,115,104,95,99,111,110,116,101,120,116,95,102,105,110,105,115,104,0,99,114,121,112,116,111,95,107,100,102,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,107,100,102,95,109,111,100,95,109,112,105,0,99,114,121,112,116,111,95,109,112,105,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,109,112,105,95,112,114,105,110,116,95,117,110,115,105,103,110,101,100,0,96,37,115,39,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,32,119,105,116,104,32,101,114,114,111,114,58,32,37,115,10,0,103,99,114,121,95,109,112,105,95,112,114,105,110,116,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,109,112,105,95,115,99,97,110,95,117,110,115,105,103,110,101,100,0,103,99,114,121,95,109,112,105,95,115,99,97,110,0,49,46,54,46,48,0,108,105,98,103,99,114,121,112,116,32,104,97,115,32,110,111,116,32,116,104,101,32,101,120,112,101,99,116,101,100,32,118,101,114,115,105,111,110,32,40,118,101,114,115,105,111,110,32,37,115,32,105,115,32,114,101,113,117,105,114,101,100,41,46,10,0,99,114,121,112,116,111,95,114,97,110,100,111,109,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,97,110,100,111,109,95,105,110,105,116,0,70,97,105,108,101,100,32,116,111,32,115,101,116,32,108,105,98,103,99,114,121,112,116,32,111,112,116,105,111,110,32,37,115,58,32,37,115,10,0,68,73,83,65,66,76,69,95,83,69,67,77,69,77,0,69,78,65,66,76,69,95,81,85,73,67,75,95,82,65,78,68,79,77,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,97,110,100,111,109,95,117,51,50,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,97,110,100,111,109,95,98,108,111,99,107,0,40,103,101,110,107,101,121,40,114,115,97,40,110,98,105,116,115,32,37,100,41,41,41,0,99,114,121,112,116,111,95,114,115,97,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,99,114,101,97,116,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,101,110,99,111,100,101,0,117,116,105,108,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,100,101,99,111,100,101,0,68,101,99,111,100,101,100,32,112,114,105,118,97,116,101,32,107,101,121,32,105,115,32,110,111,116,32,118,97,108,105,100,10,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,69,120,116,101,114,110,97,108,32,112,114,111,116,111,99,111,108,32,118,105,111,108,97,116,105,111,110,32,100,101,116,101,99,116,101,100,32,97,116,32,37,115,58,37,100,46,10,0,40,112,117,98,108,105,99,45,107,101,121,40,114,115,97,40,110,32,37,109,41,40,101,32,37,109,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,117,98,108,105,99,95,107,101,121,95,101,110,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,117,98,108,105,99,95,107,101,121,95,100,101,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,115,105,103,110,97,116,117,114,101,95,101,110,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,98,108,105,110,100,0,110,117,109,101,114,105,99,95,109,112,105,95,97,108,108,111,99,95,110,95,112,114,105,110,116,0,66,108,105,110,100,105,110,103,32,75,68,70,32,101,120,116,114,97,116,111,114,32,72,77,65,67,32,107,101,121,0,114,115,97,95,98,108,105,110,100,105,110,103,95,107,101,121,95,100,101,114,105,118,101,0,66,108,105,110,100,105,110,103,32,75,68,70,0,114,115,97,95,102,117,108,108,95,100,111,109,97,105,110,95,104,97,115,104,0,82,83,65,45,70,68,65,32,70,84,112,115,87,33,0,40,100,97,116,97,32,40,102,108,97,103,115,32,114,97,119,41,32,40,118,97,108,117,101,32,37,77,41,41,0,109,112,105,95,116,111,95,115,101,120,112,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,115,105,103,110,97,116,117,114,101,95,100,101,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,117,110,98,108,105,110,100,0,40,115,105,103,45,118,97,108,32,40,114,115,97,32,40,115,32,37,77,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,118,101,114,105,102,121,0,82,83,65,32,115,105,103,110,97,116,117,114,101,32,118,101,114,105,102,105,99,97,116,105,111,110,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,58,32,37,115,10,0,115,116,114,105,110,103,115,46,99,0,37,108,108,117,32,37,115,0,102,111,114,101,118,101,114,0,109,115,0,109,0,100,97,121,0,100,97,121,115,0,194,181,115,0,48,32,109,115,0,71,78,85,78,69,84,95,83,84,82,73,78,71,83,95,100,97,116,97,95,116,111,95,115,116,114,105,110,103,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,74,75,77,78,80,81,82,83,84,86,87,88,89,90,0,71,78,85,78,69,84,95,83,84,82,73,78,71,83,95,115,116,114,105,110,103,95,116,111,95,100,97,116,97,0,118,105,115,105,98,105,108,105,116,121,46,99,0,103,99,114,121,95,109,100,95,104,97,115,104,95,98,117,102,102,101,114,0,99,97,108,108,101,100,32,105,110,32,110,111,110,45,111,112,101,114,97,116,105,111,110,97,108,32,115,116,97,116,101,0,103,99,114,121,95,109,100,95,103,101,116,95,97,108,103,111,0,117,115,101,100,32,105,110,32,110,111,110,45,111,112,101,114,97,116,105,111,110,97,108,32,115,116,97,116,101,0,103,99,114,121,95,114,97,110,100,111,109,105,122,101,0,103,99,114,121,95,99,114,101,97,116,101,95,110,111,110,99,101,0,109,105,115,99,46,99,0,95,103,99,114,121,95,102,97,116,97,108,95,101,114,114,111,114,0,10,70,97,116,97,108,32,101,114,114,111,114,58,32,0,70,97,116,97,108,58,32,0,79,104,104,104,104,32,106,101,101,101,101,58,32,0,68,66,71,58,32,0,91,85,110,107,110,111,119,110,32,108,111,103,32,108,101,118,101,108,32,37,100,93,58,32,0,95,103,99,114,121,95,108,111,103,118,0,105,110,116,101,114,110,97,108,32,101,114,114,111,114,32,40,102,97,116,97,108,32,111,114,32,98,117,103,41,0,46,46,46,32,116,104,105,115,32,105,115,32,97,32,98,117,103,32,40,37,115,58,37,100,58,37,115,41,10,0,65,115,115,101,114,116,105,111,110,32,96,37,115,39,32,102,97,105,108,101,100,32,40,37,115,58,37,100,58,37,115,41,10,0,32,0,37,115,58,37,115,0,37,42,115,32,32,0,37,48,50,120,0,32,92,10,0,37,42,115,32,37,42,115,0,32,40,110,117,108,108,41,0,32,91,37,117,32,98,105,116,93,0,32,91,111,117,116,32,111,102,32,99,111,114,101,93,0,45,0,43,0,100,105,118,105,100,101,32,98,121,32,122,101,114,111,0,103,108,111,98,97,108,46,99,0,103,108,111,98,97,108,95,105,110,105,116,0,49,46,55,46,48,45,98,101,116,97,50,51,48,0,118,101,114,115,105,111,110,58,37,115,58,10,0,99,105,112,104,101,114,115,58,37,115,58,10,0,97,101,115,58,116,119,111,102,105,115,104,0,112,117,98,107,101,121,115,58,37,115,58,10,0,114,115,97,58,101,99,99,0,100,105,103,101,115,116,115,58,37,115,58,10,0,115,104,97,50,53,54,58,115,104,97,53,49,50,0,114,110,100,45,109,111,100,58,108,105,110,117,120,58,10,0,99,112,117,45,97,114,99,104,58,58,10,0,109,112,105,45,97,115,109,58,37,115,58,10,0,104,119,102,108,105,115,116,58,0,37,115,58,0,10,0,102,105,112,115,45,109,111,100,101,58,37,99,58,37,99,58,10,0,115,116,97,110,100,97,114,100,0,102,105,112,115,0,115,121,115,116,101,109,0,112,114,105,110,116,95,99,111,110,102,105,103,0,114,110,103,45,116,121,112,101,58,37,115,58,37,100,58,10,0,111,117,116,32,111,102,32,99,111,114,101,32,105,110,32,115,101,99,117,114,101,32,109,101,109,111,114,121,0,92,120,37,48,50,120,0,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,48,49,50,51,52,53,54,55,56,57,45,46,47,95,58,42,43,61,0,115,101,120,112,46,99,0,100,111,95,118,115,101,120,112,95,115,115,99,97,110,0,37,100,0,37,117,0,38,92,0,95,103,99,114,121,95,115,101,120,112,95,102,105,110,100,95,116,111,107,101,110,0,95,103,99,114,121,95,115,101,120,112,95,110,116,104,0,3,4,0,37,117,58,0,95,103,99,114,121,95,115,101,120,112,95,115,112,114,105,110,116,0,37,48,50,88,0,8,9,11,10,12,13,34,39,92,0,45,46,47,95,58,42,43,61,0,112,97,100,108,111,99,107,45,114,110,103,0,112,97,100,108,111,99,107,45,97,101,115,0,112,97,100,108,111,99,107,45,115,104,97,0,112,97,100,108,111,99,107,45,109,109,117,108,0,105,110,116,101,108,45,99,112,117,0,105,110,116,101,108,45,98,109,105,50,0,105,110,116,101,108,45,115,115,115,101,51,0,105,110,116,101,108,45,112,99,108,109,117,108,0,105,110,116,101,108,45,97,101,115,110,105,0,105,110,116,101,108,45,114,100,114,97,110,100,0,105,110,116,101,108,45,97,118,120,0,105,110,116,101,108,45,97,118,120,50,0,97,114,109,45,110,101,111,110,0,47,101,116,99,47,103,99,114,121,112,116,47,104,119,102,46,100,101,110,121,0,109,101,109,111,114,121,32,97,116,32,37,112,32,99,111,114,114,117,112,116,101,100,32,40,117,110,100,101,114,102,108,111,119,61,37,48,50,120,41,10,0,109,101,109,111,114,121,32,97,116,32,37,112,32,99,111,114,114,117,112,116,101,100,32,40,111,118,101,114,102,108,111,119,61,37,48,50,120,41,10,0,87,97,114,110,105,110,103,58,32,117,115,105,110,103,32,105,110,115,101,99,117,114,101,32,109,101,109,111,114,121,33,10,0,102,97,105,108,101,100,32,116,111,32,100,114,111,112,32,115,101,116,117,105,100,10,0,79,111,112,115,44,32,115,101,99,117,114,101,32,109,101,109,111,114,121,32,112,111,111,108,32,97,108,114,101,97,100,121,32,105,110,105,116,105,97,108,105,122,101,100,10,0,80,108,101,97,115,101,32,110,111,116,101,32,116,104,97,116,32,121,111,117,32,100,111,110,39,116,32,104,97,118,101,32,115,101,99,117,114,101,32,109,101,109,111,114,121,32,111,110,32,116,104,105,115,32,115,121,115,116,101,109,10,0,115,101,99,117,114,101,32,109,101,109,111,114,121,32,105,115,32,100,105,115,97,98,108,101,100,0,99,97,110,39,116,32,109,109,97,112,32,112,111,111,108,32,111,102,32,37,117,32,98,121,116,101,115,58,32,37,115,32,45,32,117,115,105,110,103,32,109,97,108,108,111,99,10,0,99,97,110,39,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,112,111,111,108,32,111,102,32,37,117,32,98,121,116,101,115,10,0,111,112,101,114,97,116,105,111,110,32,105,115,32,110,111,116,32,112,111,115,115,105,98,108,101,32,119,105,116,104,111,117,116,32,105,110,105,116,105,97,108,105,122,101,100,32,115,101,99,117,114,101,32,109,101,109,111,114,121,10,0,115,101,99,117,114,101,32,109,101,109,111,114,121,32,112,111,111,108,32,105,115,32,110,111,116,32,108,111,99,107,101,100,32,119,104,105,108,101,32,105,110,32,70,73,80,83,32,109,111,100,101,10,0,115,101,99,109,101,109,32,117,115,97,103,101,58,32,37,117,47,37,108,117,32,98,121,116,101,115,32,105,110,32,37,117,32,98,108,111,99,107,115,10,0,33,100,111,110,101,0,102,105,112,115,46,99,0,95,103,99,114,121,95,105,110,105,116,105,97,108,105,122,101,95,102,105,112,115,95,109,111,100,101,0,33,110,111,95,102,105,112,115,95,109,111,100,101,95,114,101,113,117,105,114,101,100,0,47,101,116,99,47,103,99,114,121,112,116,47,102,105,112,115,95,101,110,97,98,108,101,100,0,47,112,114,111,99,47,115,121,115,47,99,114,121,112,116,111,47,102,105,112,115,95,101,110,97,98,108,101,100,0,114,0,47,112,114,111,99,47,118,101,114,115,105,111,110,0,70,65,84,65,76,58,32,101,114,114,111,114,32,114,101,97,100,105,110,103,32,96,37,115,39,32,105,110,32,108,105,98,103,99,114,121,112,116,58,32,37,115,10,0,70,65,84,65,76,58,32,102,97,105,108,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,70,83,77,32,108,111,99,107,32,105,110,32,108,105,98,103,99,114,121,112,116,58,32,37,115,10,0,103,114,97,110,116,101,100,0,100,101,110,105,101,100,0,108,105,98,103,99,114,121,112,116,32,115,116,97,116,101,32,116,114,97,110,115,105,116,105,111,110,32,37,115,32,61,62,32,37,115,32,37,115,10,0,80,111,119,101,114,45,79,110,0,73,110,105,116,0,83,101,108,102,45,84,101,115,116,0,79,112,101,114,97,116,105,111,110,97,108,0,69,114,114,111,114,0,70,97,116,97,108,45,69,114,114,111,114,0,83,104,117,116,100,111,119,110,0,70,65,84,65,76,58,32,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,70,83,77,32,108,111,99,107,32,105,110,32,108,105,98,103,114,121,112,116,58,32,37,115,10,0,70,65,84,65,76,58,32,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,70,83,77,32,108,111,99,107,32,105,110,32,108,105,98,103,114,121,112,116,58,32,37,115,10,0,95,103,99,114,121,95,102,105,112,115,95,109,111,100,101,32,40,41,0,95,103,99,114,121,95,105,110,97,99,116,105,118,97,116,101,95,102,105,112,115,95,109,111,100,101,0,102,97,116,97,108,32,0,44,32,102,117,110,99,116,105,111,110,32,0,110,111,32,100,101,115,99,114,105,112,116,105,111,110,32,97,118,97,105,108,97,98,108,101,0,37,115,101,114,114,111,114,32,105,110,32,108,105,98,103,99,114,121,112,116,44,32,102,105,108,101,32,37,115,44,32,108,105,110,101,32,37,100,37,115,37,115,58,32,37,115,10,0,72,77,65,67,45,0,79,107,97,121,0,32,40,0,108,105,98,103,99,114,121,112,116,32,115,101,108,102,116,101,115,116,58,32,37,115,32,37,115,37,115,32,40,37,100,41,58,32,37,115,37,115,37,115,37,115,10,0,98,97,100,32,99,111,110,116,101,120,116,32,116,121,112,101,32,37,100,32,103,105,118,101,110,32,116,111,32,95,103,99,114,121,95,99,116,120,95,97,108,108,111,99,10,0,99,84,120,0,98,97,100,32,112,111,105,110,116,101,114,32,37,112,32,112,97,115,115,101,100,32,116,111,32,95,103,99,114,121,95,99,116,120,95,103,101,116,95,112,111,105,110,116,101,114,10,0,119,114,111,110,103,32,99,111,110,116,101,120,116,32,116,121,112,101,32,37,100,32,114,101,113,117,101,115,116,32,102,111,114,32,99,111,110,116,101,120,116,32,37,112,32,111,102,32,116,121,112,101,32,37,100,10,0,98,97,100,32,112,111,105,110,116,101,114,32,37,112,32,112,97,115,115,101,100,32,116,111,32,103,99,114,121,95,99,116,120,95,114,101,108,97,115,101,10,0,98,97,100,32,99,111,110,116,101,120,116,32,116,121,112,101,32,37,100,32,100,101,116,101,99,116,101,100,32,105,110,32,103,99,114,121,95,99,116,120,95,114,101,108,97,115,101,10,0,103,99,114,121,95,99,105,112,104,101,114,95,99,108,111,115,101,58,32,97,108,114,101,97,100,121,32,99,108,111,115,101,100,47,105,110,118,97,108,105,100,32,104,97,110,100,108,101,0,99,105,112,104,101,114,46,99,0,99,105,112,104,101,114,95,101,110,99,114,121,112,116,0,99,105,112,104,101,114,32,109,111,100,101,32,78,79,78,69,32,117,115,101,100,0,99,105,112,104,101,114,95,101,110,99,114,121,112,116,58,32,105,110,118,97,108,105,100,32,109,111,100,101,32,37,100,10,0,99,105,112,104,101,114,95,100,101,99,114,121,112,116,0,99,105,112,104,101,114,95,100,101,99,114,121,112,116,58,32,105,110,118,97,108,105,100,32,109,111,100,101,32,37,100,10,0,87,65,82,78,73,78,71,58,32,99,105,112,104,101,114,95,115,101,116,105,118,58,32,105,118,108,101,110,61,37,117,32,98,108,107,108,101,110,61,37,117,10,0,99,105,112,104,101,114,95,115,101,116,105,118,0,73,86,32,108,101,110,103,116,104,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,98,108,111,99,107,108,101,110,103,116,104,0,48,120,55,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,69,68,0,45,48,120,48,49,0,45,48,120,50,68,70,67,57,51,49,49,68,52,57,48,48,49,56,67,55,51,51,56,66,70,56,54,56,56,56,54,49,55,54,55,70,70,56,70,70,53,66,50,66,69,66,69,50,55,53,52,56,65,49,52,66,50,51,53,69,67,65,54,56,55,52,65,0,48,120,49,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,52,68,69,70,57,68,69,65,50,70,55,57,67,68,54,53,56,49,50,54,51,49,65,53,67,70,53,68,51,69,68,0,48,120,50,49,54,57,51,54,68,51,67,68,54,69,53,51,70,69,67,48,65,52,69,50,51,49,70,68,68,54,68,67,53,67,54,57,50,67,67,55,54,48,57,53,50,53,65,55,66,50,67,57,53,54,50,68,54,48,56,70,50,53,68,53,49,65,0,48,120,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,53,56,0,48,120,48,56,0,78,73,83,84,32,80,45,49,57,50,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,0,48,120,54,52,50,49,48,53,49,57,101,53,57,99,56,48,101,55,48,102,97,55,101,57,97,98,55,50,50,52,51,48,52,57,102,101,98,56,100,101,101,99,99,49,52,54,98,57,98,49,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,57,57,100,101,102,56,51,54,49,52,54,98,99,57,98,49,98,52,100,50,50,56,51,49,0,48,120,49,56,56,100,97,56,48,101,98,48,51,48,57,48,102,54,55,99,98,102,50,48,101,98,52,51,97,49,56,56,48,48,102,52,102,102,48,97,102,100,56,50,102,102,49,48,49,50,0,48,120,48,55,49,57,50,98,57,53,102,102,99,56,100,97,55,56,54,51,49,48,49,49,101,100,54,98,50,52,99,100,100,53,55,51,102,57,55,55,97,49,49,101,55,57,52,56,49,49,0,48,120,48,49,0,78,73,83,84,32,80,45,50,50,52,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,0,48,120,98,52,48,53,48,97,56,53,48,99,48,52,98,51,97,98,102,53,52,49,51,50,53,54,53,48,52,52,98,48,98,55,100,55,98,102,100,56,98,97,50,55,48,98,51,57,52,51,50,51,53,53,102,102,98,52,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,49,54,97,50,101,48,98,56,102,48,51,101,49,51,100,100,50,57,52,53,53,99,53,99,50,97,51,100,0,48,120,98,55,48,101,48,99,98,100,54,98,98,52,98,102,55,102,51,50,49,51,57,48,98,57,52,97,48,51,99,49,100,51,53,54,99,50,49,49,50,50,51,52,51,50,56,48,100,54,49,49,53,99,49,100,50,49,0,48,120,98,100,51,55,54,51,56,56,98,53,102,55,50,51,102,98,52,99,50,50,100,102,101,54,99,100,52,51,55,53,97,48,53,97,48,55,52,55,54,52,52,52,100,53,56,49,57,57,56,53,48,48,55,101,51,52,0,78,73,83,84,32,80,45,50,53,54,0,48,120,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,49,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,0,48,120,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,49,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,0,48,120,53,97,99,54,51,53,100,56,97,97,51,97,57,51,101,55,98,51,101,98,98,100,53,53,55,54,57,56,56,54,98,99,54,53,49,100,48,54,98,48,99,99,53,51,98,48,102,54,51,98,99,101,51,99,51,101,50,55,100,50,54,48,52,98,0,48,120,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,98,99,101,54,102,97,97,100,97,55,49,55,57,101,56,52,102,51,98,57,99,97,99,50,102,99,54,51,50,53,53,49,0,48,120,54,98,49,55,100,49,102,50,101,49,50,99,52,50,52,55,102,56,98,99,101,54,101,53,54,51,97,52,52,48,102,50,55,55,48,51,55,100,56,49,50,100,101,98,51,51,97,48,102,52,97,49,51,57,52,53,100,56,57,56,99,50,57,54,0,48,120,52,102,101,51,52,50,101,50,102,101,49,97,55,102,57,98,56,101,101,55,101,98,52,97,55,99,48,102,57,101,49,54,50,98,99,101,51,51,53,55,54,98,51,49,53,101,99,101,99,98,98,54,52,48,54,56,51,55,98,102,53,49,102,53,0,78,73,83,84,32,80,45,51,56,52,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,99,0,48,120,98,51,51,49,50,102,97,55,101,50,51,101,101,55,101,52,57,56,56,101,48,53,54,98,101,51,102,56,50,100,49,57,49,56,49,100,57,99,54,101,102,101,56,49,52,49,49,50,48,51,49,52,48,56,56,102,53,48,49,51,56,55,53,97,99,54,53,54,51,57,56,100,56,97,50,101,100,49,57,100,50,97,56,53,99,56,101,100,100,51,101,99,50,97,101,102,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,55,54,51,52,100,56,49,102,52,51,55,50,100,100,102,53,56,49,97,48,100,98,50,52,56,98,48,97,55,55,97,101,99,101,99,49,57,54,97,99,99,99,53,50,57,55,51,0,48,120,97,97,56,55,99,97,50,50,98,101,56,98,48,53,51,55,56,101,98,49,99,55,49,101,102,51,50,48,97,100,55,52,54,101,49,100,51,98,54,50,56,98,97,55,57,98,57,56,53,57,102,55,52,49,101,48,56,50,53,52,50,97,51,56,53,53,48,50,102,50,53,100,98,102,53,53,50,57,54,99,51,97,53,52,53,101,51,56,55,50,55,54,48,97,98,55,0,48,120,51,54,49,55,100,101,52,97,57,54,50,54,50,99,54,102,53,100,57,101,57,56,98,102,57,50,57,50,100,99,50,57,102,56,102,52,49,100,98,100,50,56,57,97,49,52,55,99,101,57,100,97,51,49,49,51,98,53,102,48,98,56,99,48,48,97,54,48,98,49,99,101,49,100,55,101,56,49,57,100,55,97,52,51,49,100,55,99,57,48,101,97,48,101,53,102,0,78,73,83,84,32,80,45,53,50,49,0,48,120,48,49,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,0,48,120,48,49,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,0,48,120,48,53,49,57,53,51,101,98,57,54,49,56,101,49,99,57,97,49,102,57,50,57,97,50,49,97,48,98,54,56,53,52,48,101,101,97,50,100,97,55,50,53,98,57,57,98,51,49,53,102,51,98,56,98,52,56,57,57,49,56,101,102,49,48,57,101,49,53,54,49,57,51,57,53,49,101,99,55,101,57,51,55,98,49,54,53,50,99,48,98,100,51,98,98,49,98,102,48,55,51,53,55,51,100,102,56,56,51,100,50,99,51,52,102,49,101,102,52,53,49,102,100,52,54,98,53,48,51,102,48,48,0,48,120,49,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,97,53,49,56,54,56,55,56,51,98,102,50,102,57,54,54,98,55,102,99,99,48,49,52,56,102,55,48,57,97,53,100,48,51,98,98,53,99,57,98,56,56,57,57,99,52,55,97,101,98,98,54,102,98,55,49,101,57,49,51,56,54,52,48,57,0,48,120,48,48,99,54,56,53,56,101,48,54,98,55,48,52,48,52,101,57,99,100,57,101,51,101,99,98,54,54,50,51,57,53,98,52,52,50,57,99,54,52,56,49,51,57,48,53,51,102,98,53,50,49,102,56,50,56,97,102,54,48,54,98,52,100,51,100,98,97,97,49,52,98,53,101,55,55,101,102,101,55,53,57,50,56,102,101,49,100,99,49,50,55,97,50,102,102,97,56,100,101,51,51,52,56,98,51,99,49,56,53,54,97,52,50,57,98,102,57,55,101,55,101,51,49,99,50,101,53,98,100,54,54,0,48,120,48,49,49,56,51,57,50,57,54,97,55,56,57,97,51,98,99,48,48,52,53,99,56,97,53,102,98,52,50,99,55,100,49,98,100,57,57,56,102,53,52,52,52,57,53,55,57,98,52,52,54,56,49,55,97,102,98,100,49,55,50,55,51,101,54,54,50,99,57,55,101,101,55,50,57,57,53,101,102,52,50,54,52,48,99,53,53,48,98,57,48,49,51,102,97,100,48,55,54,49,51,53,51,99,55,48,56,54,97,50,55,50,99,50,52,48,56,56,98,101,57,52,55,54,57,102,100,49,54,54,53,48,0,98,114,97,105,110,112,111,111,108,80,49,54,48,114,49,0,48,120,101,57,53,101,52,97,53,102,55,51,55,48,53,57,100,99,54,48,100,102,99,55,97,100,57,53,98,51,100,56,49,51,57,53,49,53,54,50,48,102,0,48,120,51,52,48,101,55,98,101,50,97,50,56,48,101,98,55,52,101,50,98,101,54,49,98,97,100,97,55,52,53,100,57,55,101,56,102,55,99,51,48,48,0,48,120,49,101,53,56,57,97,56,53,57,53,52,50,51,52,49,50,49,51,52,102,97,97,50,100,98,100,101,99,57,53,99,56,100,56,54,55,53,101,53,56,0,48,120,101,57,53,101,52,97,53,102,55,51,55,48,53,57,100,99,54,48,100,102,53,57,57,49,100,52,53,48,50,57,52,48,57,101,54,48,102,99,48,57,0,48,120,98,101,100,53,97,102,49,54,101,97,51,102,54,97,52,102,54,50,57,51,56,99,52,54,51,49,101,98,53,97,102,55,98,100,98,99,100,98,99,51,0,48,120,49,54,54,55,99,98,52,55,55,97,49,97,56,101,99,51,51,56,102,57,52,55,52,49,54,54,57,99,57,55,54,51,49,54,100,97,54,51,50,49,0,98,114,97,105,110,112,111,111,108,80,49,57,50,114,49,0,48,120,99,51,48,50,102,52,49,100,57,51,50,97,51,54,99,100,97,55,97,51,52,54,51,48,57,51,100,49,56,100,98,55,56,102,99,101,52,55,54,100,101,49,97,56,54,50,57,55,0,48,120,54,97,57,49,49,55,52,48,55,54,98,49,101,48,101,49,57,99,51,57,99,48,51,49,102,101,56,54,56,53,99,49,99,97,101,48,52,48,101,53,99,54,57,97,50,56,101,102,0,48,120,52,54,57,97,50,56,101,102,55,99,50,56,99,99,97,51,100,99,55,50,49,100,48,52,52,102,52,52,57,54,98,99,99,97,55,101,102,52,49,52,54,102,98,102,50,53,99,57,0,48,120,99,51,48,50,102,52,49,100,57,51,50,97,51,54,99,100,97,55,97,51,52,54,50,102,57,101,57,101,57,49,54,98,53,98,101,56,102,49,48,50,57,97,99,52,97,99,99,49,0,48,120,99,48,97,48,54,52,55,101,97,97,98,54,97,52,56,55,53,51,98,48,51,51,99,53,54,99,98,48,102,48,57,48,48,97,50,102,53,99,52,56,53,51,51,55,53,102,100,54,0,48,120,49,52,98,54,57,48,56,54,54,97,98,100,53,98,98,56,56,98,53,102,52,56,50,56,99,49,52,57,48,48,48,50,101,54,55,55,51,102,97,50,102,97,50,57,57,98,56,102,0,98,114,97,105,110,112,111,111,108,80,50,50,52,114,49,0,48,120,100,55,99,49,51,52,97,97,50,54,52,51,54,54,56,54,50,97,49,56,51,48,50,53,55,53,100,49,100,55,56,55,98,48,57,102,48,55,53,55,57,55,100,97,56,57,102,53,55,101,99,56,99,48,102,102,0,48,120,54,56,97,53,101,54,50,99,97,57,99,101,54,99,49,99,50,57,57,56,48,51,97,54,99,49,53,51,48,98,53,49,52,101,49,56,50,97,100,56,98,48,48,52,50,97,53,57,99,97,100,50,57,102,52,51,0,48,120,50,53,56,48,102,54,51,99,99,102,101,52,52,49,51,56,56,55,48,55,49,51,98,49,97,57,50,51,54,57,101,51,51,101,50,49,51,53,100,50,54,54,100,98,98,51,55,50,51,56,54,99,52,48,48,98,0,48,120,100,55,99,49,51,52,97,97,50,54,52,51,54,54,56,54,50,97,49,56,51,48,50,53,55,53,100,48,102,98,57,56,100,49,49,54,98,99,52,98,54,100,100,101,98,99,97,51,97,53,97,55,57,51,57,102,0,48,120,48,100,57,48,50,57,97,100,50,99,55,101,53,99,102,52,51,52,48,56,50,51,98,50,97,56,55,100,99,54,56,99,57,101,52,99,101,51,49,55,52,99,49,101,54,101,102,100,101,101,49,50,99,48,55,100,0,48,120,53,56,97,97,53,54,102,55,55,50,99,48,55,50,54,102,50,52,99,54,98,56,57,101,52,101,99,100,97,99,50,52,51,53,52,98,57,101,57,57,99,97,97,51,102,54,100,51,55,54,49,52,48,50,99,100,0,98,114,97,105,110,112,111,111,108,80,50,53,54,114,49,0,48,120,97,57,102,98,53,55,100,98,97,49,101,101,97,57,98,99,51,101,54,54,48,97,57,48,57,100,56,51,56,100,55,50,54,101,51,98,102,54,50,51,100,53,50,54,50,48,50,56,50,48,49,51,52,56,49,100,49,102,54,101,53,51,55,55,0,48,120,55,100,53,97,48,57,55,53,102,99,50,99,51,48,53,55,101,101,102,54,55,53,51,48,52,49,55,97,102,102,101,55,102,98,56,48,53,53,99,49,50,54,100,99,53,99,54,99,101,57,52,97,52,98,52,52,102,51,51,48,98,53,100,57,0,48,120,50,54,100,99,53,99,54,99,101,57,52,97,52,98,52,52,102,51,51,48,98,53,100,57,98,98,100,55,55,99,98,102,57,53,56,52,49,54,50,57,53,99,102,55,101,49,99,101,54,98,99,99,100,99,49,56,102,102,56,99,48,55,98,54,0,48,120,97,57,102,98,53,55,100,98,97,49,101,101,97,57,98,99,51,101,54,54,48,97,57,48,57,100,56,51,56,100,55,49,56,99,51,57,55,97,97,51,98,53,54,49,97,54,102,55,57,48,49,101,48,101,56,50,57,55,52,56,53,54,97,55,0,48,120,56,98,100,50,97,101,98,57,99,98,55,101,53,55,99,98,50,99,52,98,52,56,50,102,102,99,56,49,98,55,97,102,98,57,100,101,50,55,101,49,101,51,98,100,50,51,99,50,51,97,52,52,53,51,98,100,57,97,99,101,51,50,54,50,0,48,120,53,52,55,101,102,56,51,53,99,51,100,97,99,52,102,100,57,55,102,56,52,54,49,97,49,52,54,49,49,100,99,57,99,50,55,55,52,53,49,51,50,100,101,100,56,101,53,52,53,99,49,100,53,52,99,55,50,102,48,52,54,57,57,55,0,98,114,97,105,110,112,111,111,108,80,51,50,48,114,49,0,48,120,100,51,53,101,52,55,50,48,51,54,98,99,52,102,98,55,101,49,51,99,55,56,53,101,100,50,48,49,101,48,54,53,102,57,56,102,99,102,97,54,102,54,102,52,48,100,101,102,52,102,57,50,98,57,101,99,55,56,57,51,101,99,50,56,102,99,100,52,49,50,98,49,102,49,98,51,50,101,50,55,0,48,120,51,101,101,51,48,98,53,54,56,102,98,97,98,48,102,56,56,51,99,99,101,98,100,52,54,100,51,102,51,98,98,56,97,50,97,55,51,53,49,51,102,53,101,98,55,57,100,97,54,54,49,57,48,101,98,48,56,53,102,102,97,57,102,52,57,50,102,51,55,53,97,57,55,100,56,54,48,101,98,52,0,48,120,53,50,48,56,56,51,57,52,57,100,102,100,98,99,52,50,100,51,97,100,49,57,56,54,52,48,54,56,56,97,54,102,101,49,51,102,52,49,51,52,57,53,53,52,98,52,57,97,99,99,51,49,100,99,99,100,56,56,52,53,51,57,56,49,54,102,53,101,98,52,97,99,56,102,98,49,102,49,97,54,0,48,120,100,51,53,101,52,55,50,48,51,54,98,99,52,102,98,55,101,49,51,99,55,56,53,101,100,50,48,49,101,48,54,53,102,57,56,102,99,102,97,53,98,54,56,102,49,50,97,51,50,100,52,56,50,101,99,55,101,101,56,54,53,56,101,57,56,54,57,49,53,53,53,98,52,52,99,53,57,51,49,49,0,48,120,52,51,98,100,55,101,57,97,102,98,53,51,100,56,98,56,53,50,56,57,98,99,99,52,56,101,101,53,98,102,101,54,102,50,48,49,51,55,100,49,48,97,48,56,55,101,98,54,101,55,56,55,49,101,50,97,49,48,97,53,57,57,99,55,49,48,97,102,56,100,48,100,51,57,101,50,48,54,49,49,0,48,120,49,52,102,100,100,48,53,53,52,53,101,99,49,99,99,56,97,98,52,48,57,51,50,52,55,102,55,55,50,55,53,101,48,55,52,51,102,102,101,100,49,49,55,49,56,50,101,97,97,57,99,55,55,56,55,55,97,97,97,99,54,97,99,55,100,51,53,50,52,53,100,49,54,57,50,101,56,101,101,49,0,98,114,97,105,110,112,111,111,108,80,51,56,52,114,49,0,48,120,56,99,98,57,49,101,56,50,97,51,51,56,54,100,50,56,48,102,53,100,54,102,55,101,53,48,101,54,52,49,100,102,49,53,50,102,55,49,48,57,101,100,53,52,53,54,98,52,49,50,98,49,100,97,49,57,55,102,98,55,49,49,50,51,97,99,100,51,97,55,50,57,57,48,49,100,49,97,55,49,56,55,52,55,48,48,49,51,51,49,48,55,101,99,53,51,0,48,120,55,98,99,51,56,50,99,54,51,100,56,99,49,53,48,99,51,99,55,50,48,56,48,97,99,101,48,53,97,102,97,48,99,50,98,101,97,50,56,101,52,102,98,50,50,55,56,55,49,51,57,49,54,53,101,102,98,97,57,49,102,57,48,102,56,97,97,53,56,49,52,97,53,48,51,97,100,52,101,98,48,52,97,56,99,55,100,100,50,50,99,101,50,56,50,54,0,48,120,48,52,97,56,99,55,100,100,50,50,99,101,50,56,50,54,56,98,51,57,98,53,53,52,49,54,102,48,52,52,55,99,50,102,98,55,55,100,101,49,48,55,100,99,100,50,97,54,50,101,56,56,48,101,97,53,51,101,101,98,54,50,100,53,55,99,98,52,51,57,48,50,57,53,100,98,99,57,57,52,51,97,98,55,56,54,57,54,102,97,53,48,52,99,49,49,0,48,120,56,99,98,57,49,101,56,50,97,51,51,56,54,100,50,56,48,102,53,100,54,102,55,101,53,48,101,54,52,49,100,102,49,53,50,102,55,49,48,57,101,100,53,52,53,54,98,51,49,102,49,54,54,101,54,99,97,99,48,52,50,53,97,55,99,102,51,97,98,54,97,102,54,98,55,102,99,51,49,48,51,98,56,56,51,50,48,50,101,57,48,52,54,53,54,53,0,48,120,49,100,49,99,54,52,102,48,54,56,99,102,52,53,102,102,97,50,97,54,51,97,56,49,98,55,99,49,51,102,54,98,56,56,52,55,97,51,101,55,55,101,102,49,52,102,101,51,100,98,55,102,99,97,102,101,48,99,98,100,49,48,101,56,101,56,50,54,101,48,51,52,51,54,100,54,52,54,97,97,101,102,56,55,98,50,101,50,52,55,100,52,97,102,49,101,0,48,120,56,97,98,101,49,100,55,53,50,48,102,57,99,50,97,52,53,99,98,49,101,98,56,101,57,53,99,102,100,53,53,50,54,50,98,55,48,98,50,57,102,101,101,99,53,56,54,52,101,49,57,99,48,53,52,102,102,57,57,49,50,57,50,56,48,101,52,54,52,54,50,49,55,55,57,49,56,49,49,49,52,50,56,50,48,51,52,49,50,54,51,99,53,51,49,53,0,98,114,97,105,110,112,111,111,108,80,53,49,50,114,49,0,48,120,97,97,100,100,57,100,98,56,100,98,101,57,99,52,56,98,51,102,100,52,101,54,97,101,51,51,99,57,102,99,48,55,99,98,51,48,56,100,98,51,98,51,99,57,100,50,48,101,100,54,54,51,57,99,99,97,55,48,51,51,48,56,55,49,55,100,52,100,57,98,48,48,57,98,99,54,54,56,52,50,97,101,99,100,97,49,50,97,101,54,97,51,56,48,101,54,50,56,56,49,102,102,50,102,50,100,56,50,99,54,56,53,50,56,97,97,54,48,53,54,53,56,51,97,52,56,102,51,0,48,120,55,56,51,48,97,51,51,49,56,98,54,48,51,98,56,57,101,50,51,50,55,49,52,53,97,99,50,51,52,99,99,53,57,52,99,98,100,100,56,100,51,100,102,57,49,54,49,48,97,56,51,52,52,49,99,97,101,97,57,56,54,51,98,99,50,100,101,100,53,100,53,97,97,56,50,53,51,97,97,49,48,97,50,101,102,49,99,57,56,98,57,97,99,56,98,53,55,102,49,49,49,55,97,55,50,98,102,50,99,55,98,57,101,55,99,49,97,99,52,100,55,55,102,99,57,52,99,97,0,48,120,51,100,102,57,49,54,49,48,97,56,51,52,52,49,99,97,101,97,57,56,54,51,98,99,50,100,101,100,53,100,53,97,97,56,50,53,51,97,97,49,48,97,50,101,102,49,99,57,56,98,57,97,99,56,98,53,55,102,49,49,49,55,97,55,50,98,102,50,99,55,98,57,101,55,99,49,97,99,52,100,55,55,102,99,57,52,99,97,100,99,48,56,51,101,54,55,57,56,52,48,53,48,98,55,53,101,98,97,101,53,100,100,50,56,48,57,98,100,54,51,56,48,49,54,102,55,50,51,0,48,120,97,97,100,100,57,100,98,56,100,98,101,57,99,52,56,98,51,102,100,52,101,54,97,101,51,51,99,57,102,99,48,55,99,98,51,48,56,100,98,51,98,51,99,57,100,50,48,101,100,54,54,51,57,99,99,97,55,48,51,51,48,56,55,48,53,53,51,101,53,99,52,49,52,99,97,57,50,54,49,57,52,49,56,54,54,49,49,57,55,102,97,99,49,48,52,55,49,100,98,49,100,51,56,49,48,56,53,100,100,97,100,100,98,53,56,55,57,54,56,50,57,99,97,57,48,48,54,57,0,48,120,56,49,97,101,101,52,98,100,100,56,50,101,100,57,54,52,53,97,50,49,51,50,50,101,57,99,52,99,54,97,57,51,56,53,101,100,57,102,55,48,98,53,100,57,49,54,99,49,98,52,51,98,54,50,101,101,102,52,100,48,48,57,56,101,102,102,51,98,49,102,55,56,101,50,100,48,100,52,56,100,53,48,100,49,54,56,55,98,57,51,98,57,55,100,53,102,55,99,54,100,53,48,52,55,52,48,54,97,53,101,54,56,56,98,51,53,50,50,48,57,98,99,98,57,102,56,50,50],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480);allocate([48,120,55,100,100,101,51,56,53,100,53,54,54,51,51,50,101,99,99,48,101,97,98,102,97,57,99,102,55,56,50,50,102,100,102,50,48,57,102,55,48,48,50,52,97,53,55,98,49,97,97,48,48,48,99,53,53,98,56,56,49,102,56,49,49,49,98,50,100,99,100,101,52,57,52,97,53,102,52,56,53,101,53,98,99,97,52,98,100,56,56,97,50,55,54,51,97,101,100,49,99,97,50,98,50,102,97,56,102,48,53,52,48,54,55,56,99,100,49,101,48,102,51,97,100,56,48,56,57,50,0,71,79,83,84,50,48,48,49,45,116,101,115,116,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,52,51,49,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,55,0,48,120,53,102,98,102,102,52,57,56,97,97,57,51,56,99,101,55,51,57,98,56,101,48,50,50,102,98,97,102,101,102,52,48,53,54,51,102,54,101,54,97,51,52,55,50,102,99,50,97,53,49,52,99,48,99,101,57,100,97,101,50,51,98,55,101,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,53,48,102,101,56,97,49,56,57,50,57,55,54,49,53,52,99,53,57,99,102,99,49,57,51,97,99,99,102,53,98,51,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,50,0,48,120,48,56,101,50,97,56,97,48,101,54,53,49,52,55,100,52,98,100,54,51,49,54,48,51,48,101,49,54,100,49,57,99,56,53,99,57,55,102,48,97,57,99,97,50,54,55,49,50,50,98,57,54,97,98,98,99,101,97,55,101,56,102,99,56,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,65,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,57,55,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,57,52,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,97,54,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,54,99,54,49,49,48,55,48,57,57,53,97,100,49,48,48,52,53,56,52,49,98,48,57,98,55,54,49,98,56,57,51,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,0,48,120,56,100,57,49,101,52,55,49,101,48,57,56,57,99,100,97,50,55,100,102,53,48,53,97,52,53,51,102,50,98,55,54,51,53,50,57,52,102,50,100,100,102,50,51,101,51,98,49,50,50,97,99,99,57,57,99,57,101,57,102,49,101,49,52,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,66,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,99,57,57,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,99,57,54,0,48,120,51,101,49,97,102,52,49,57,97,50,54,57,97,53,102,56,54,54,97,55,100,51,99,50,53,99,51,100,102,56,48,97,101,57,55,57,50,53,57,51,55,51,102,102,50,98,49,56,50,102,52,57,100,52,99,101,55,101,49,98,98,99,56,98,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,53,102,55,48,48,99,102,102,102,49,97,54,50,52,101,53,101,52,57,55,49,54,49,98,99,99,56,97,49,57,56,102,0,48,120,51,102,97,56,49,50,52,51,53,57,102,57,54,54,56,48,98,56,51,100,49,99,51,101,98,50,99,48,55,48,101,53,99,53,52,53,99,57,56,53,56,100,48,51,101,99,102,98,55,52,52,98,102,56,100,55,49,55,55,49,55,101,102,99,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,67,0,48,120,57,98,57,102,54,48,53,102,53,97,56,53,56,49,48,55,97,98,49,101,99,56,53,101,54,98,52,49,99,56,97,97,99,102,56,52,54,101,56,54,55,56,57,48,53,49,100,51,55,57,57,56,102,55,98,57,48,50,50,100,55,53,57,98,0,48,120,57,98,57,102,54,48,53,102,53,97,56,53,56,49,48,55,97,98,49,101,99,56,53,101,54,98,52,49,99,56,97,97,99,102,56,52,54,101,56,54,55,56,57,48,53,49,100,51,55,57,57,56,102,55,98,57,48,50,50,100,55,53,57,56,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,48,53,97,0,48,120,57,98,57,102,54,48,53,102,53,97,56,53,56,49,48,55,97,98,49,101,99,56,53,101,54,98,52,49,99,56,97,97,53,56,50,99,97,51,53,49,49,101,100,100,102,98,55,52,102,48,50,102,51,97,54,53,57,56,57,56,48,98,98,57,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0,48,120,52,49,101,99,101,53,53,55,52,51,55,49,49,97,56,99,51,99,98,102,51,55,56,51,99,100,48,56,99,48,101,101,52,100,52,100,99,52,52,48,100,52,54,52,49,97,56,102,51,54,54,101,53,53,48,100,102,100,98,51,98,98,54,55,0,71,79,83,84,50,48,49,50,45,116,101,115,116,0,48,120,52,53,51,49,97,99,100,49,102,101,48,48,50,51,99,55,53,53,48,100,50,54,55,98,54,98,50,102,101,101,56,48,57,50,50,98,49,52,98,50,102,102,98,57,48,102,48,52,100,52,101,98,55,99,48,57,98,53,100,50,100,49,53,100,102,49,100,56,53,50,55,52,49,97,102,52,55,48,52,97,48,52,53,56,48,52,55,101,56,48,101,52,53,52,54,100,51,53,98,56,51,51,54,102,97,99,50,50,52,100,100,56,49,54,54,52,98,98,102,53,50,56,98,101,54,51,55,51,0,48,120,49,99,102,102,48,56,48,54,97,51,49,49,49,54,100,97,50,57,100,56,99,102,97,53,52,101,53,55,101,98,55,52,56,98,99,53,102,51,55,55,101,52,57,52,48,48,102,100,100,55,56,56,98,54,52,57,101,99,97,49,97,99,52,51,54,49,56,51,52,48,49,51,98,50,97,100,55,51,50,50,52,56,48,97,56,57,99,97,53,56,101,48,99,102,55,52,98,99,57,101,53,52,48,99,50,97,100,100,54,56,57,55,102,97,100,48,97,51,48,56,52,102,51,48,50,97,100,99,0,48,120,52,53,51,49,97,99,100,49,102,101,48,48,50,51,99,55,53,53,48,100,50,54,55,98,54,98,50,102,101,101,56,48,57,50,50,98,49,52,98,50,102,102,98,57,48,102,48,52,100,52,101,98,55,99,48,57,98,53,100,50,100,49,53,100,97,56,50,102,50,100,55,101,99,98,49,100,98,97,99,55,49,57,57,48,53,99,53,101,101,99,99,52,50,51,102,49,100,56,54,101,50,53,101,100,98,101,50,51,99,53,57,53,100,54,52,52,97,97,102,49,56,55,101,54,101,54,100,102,0,48,120,50,52,100,49,57,99,99,54,52,53,55,50,101,101,51,48,102,51,57,54,98,102,54,101,98,98,102,100,55,97,54,99,53,50,49,51,98,51,98,51,100,55,48,53,55,99,99,56,50,53,102,57,49,48,57,51,97,54,56,99,100,55,54,50,102,100,54,48,54,49,49,50,54,50,99,100,56,51,56,100,99,54,98,54,48,97,97,55,101,101,101,56,48,52,101,50,56,98,99,56,52,57,57,55,55,102,97,99,51,51,98,52,98,53,51,48,102,49,98,49,50,48,50,52,56,97,57,97,0,48,120,50,98,98,51,49,50,97,52,51,98,100,50,99,101,54,101,48,100,48,50,48,54,49,51,99,56,53,55,97,99,100,100,99,102,98,102,48,54,49,101,57,49,101,53,102,50,99,51,102,51,50,52,52,55,99,50,53,57,102,51,57,98,50,99,56,51,97,98,49,53,54,100,55,55,102,49,52,57,54,98,102,55,101,98,51,51,53,49,101,49,101,101,52,101,52,51,100,99,49,97,49,56,98,57,49,98,50,52,54,52,48,98,54,100,98,98,57,50,99,98,49,97,100,100,51,55,49,101,0,71,79,83,84,50,48,49,50,45,116,99,50,54,45,65,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,99,55,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,99,52,0,48,120,101,56,99,50,53,48,53,100,101,100,102,99,56,54,100,100,99,49,98,100,48,98,50,98,54,54,54,55,102,49,100,97,51,52,98,56,50,53,55,52,55,54,49,99,98,48,101,56,55,57,98,100,48,56,49,99,102,100,48,98,54,50,54,53,101,101,51,99,98,48,57,48,102,51,48,100,50,55,54,49,52,99,98,52,53,55,52,48,49,48,100,97,57,48,100,100,56,54,50,101,102,57,100,52,101,98,101,101,52,55,54,49,53,48,51,49,57,48,55,56,53,97,55,49,99,55,54,48,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,50,55,101,54,57,53,51,50,102,52,56,100,56,57,49,49,54,102,102,50,50,98,56,100,52,101,48,53,54,48,54,48,57,98,52,98,51,56,97,98,102,97,100,50,98,56,53,100,99,97,99,100,98,49,52,49,49,102,49,48,98,50,55,53,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,51,0,48,120,55,53,48,51,99,102,101,56,55,97,56,51,54,97,101,51,97,54,49,98,56,56,49,54,101,50,53,52,53,48,101,54,99,101,53,101,49,99,57,51,97,99,102,49,97,98,99,49,55,55,56,48,54,52,102,100,99,98,101,102,97,57,50,49,100,102,49,54,50,54,98,101,52,102,100,48,51,54,101,57,51,100,55,53,101,54,97,53,48,101,51,97,52,49,101,57,56,48,50,56,102,101,53,102,99,50,51,53,102,53,98,56,56,57,97,53,56,57,99,98,53,50,49,53,102,50,97,52,0,71,79,83,84,50,48,49,50,45,116,99,50,54,45,66,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,54,102,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,54,99,0,48,120,54,56,55,100,49,98,52,53,57,100,99,56,52,49,52,53,55,101,51,101,48,54,99,102,54,102,53,101,50,53,49,55,98,57,55,99,55,100,54,49,52,97,102,49,51,56,98,99,98,102,56,53,100,99,56,48,54,99,52,98,50,56,57,102,51,101,57,54,53,100,50,100,98,49,52,49,54,100,50,49,55,102,56,98,50,55,54,102,97,100,49,97,98,54,57,99,53,48,102,55,56,98,101,101,49,102,97,51,49,48,54,101,102,98,56,99,99,98,99,55,99,53,49,52,48,49,49,54,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,52,57,97,49,101,99,49,52,50,53,54,53,97,53,52,53,97,99,102,100,98,55,55,98,100,57,100,52,48,99,102,97,56,98,57,57,54,55,49,50,49,48,49,98,101,97,48,101,99,54,51,52,54,99,53,52,51,55,52,102,50,53,98,100,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,50,0,48,120,49,97,56,102,55,101,100,97,51,56,57,98,48,57,52,99,50,99,48,55,49,101,51,54,52,55,97,56,57,52,48,102,51,99,49,50,51,98,54,57,55,53,55,56,99,50,49,51,98,101,54,100,100,57,101,54,99,56,101,99,55,51,51,53,100,99,98,50,50,56,102,100,49,101,100,102,52,97,51,57,49,53,50,99,98,99,97,97,102,56,99,48,51,57,56,56,50,56,48,52,49,48,53,53,102,57,52,99,101,101,101,99,55,101,50,49,51,52,48,55,56,48,102,101,52,49,98,100,0,115,101,99,112,50,53,54,107,49,0,48,120,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,69,70,70,70,70,70,67,50,70,0,48,120,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,69,66,65,65,69,68,67,69,54,65,70,52,56,65,48,51,66,66,70,68,50,53,69,56,67,68,48,51,54,52,49,52,49,0,48,120,55,57,66,69,54,54,55,69,70,57,68,67,66,66,65,67,53,53,65,48,54,50,57,53,67,69,56,55,48,66,48,55,48,50,57,66,70,67,68,66,50,68,67,69,50,56,68,57,53,57,70,50,56,49,53,66,49,54,70,56,49,55,57,56,0,48,120,52,56,51,65,68,65,55,55,50,54,65,51,67,52,54,53,53,68,65,52,70,66,70,67,48,69,49,49,48,56,65,56,70,68,49,55,66,52,52,56,65,54,56,53,53,52,49,57,57,67,52,55,68,48,56,70,70,66,49,48,68,52,66,56,0,49,46,51,46,54,46,49,46,52,46,49,46,49,49,53,57,49,46,49,53,46,49,0,49,46,50,46,56,52,48,46,49,48,48,52,53,46,51,46,49,46,49,0,112,114,105,109,101,49,57,50,118,49,0,115,101,99,112,49,57,50,114,49,0,110,105,115,116,112,49,57,50,0,115,101,99,112,50,50,52,114,49,0,49,46,51,46,49,51,50,46,48,46,51,51,0,110,105,115,116,112,50,50,52,0,49,46,50,46,56,52,48,46,49,48,48,52,53,46,51,46,49,46,55,0,112,114,105,109,101,50,53,54,118,49,0,115,101,99,112,50,53,54,114,49,0,110,105,115,116,112,50,53,54,0,115,101,99,112,51,56,52,114,49,0,49,46,51,46,49,51,50,46,48,46,51,52,0,110,105,115,116,112,51,56,52,0,115,101,99,112,53,50,49,114,49,0,49,46,51,46,49,51,50,46,48,46,51,53,0,110,105,115,116,112,53,50,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,51,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,53,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,55,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,57,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,49,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,49,51,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,48,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,49,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,50,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,51,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,88,99,104,65,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,88,99,104,66,0,49,46,50,46,54,52,51,46,50,46,50,46,51,54,46,48,0,49,46,50,46,54,52,51,46,50,46,50,46,51,54,46,49,0,49,46,50,46,54,52,51,46,55,46,49,46,50,46,49,46,50,46,49,0,49,46,50,46,54,52,51,46,55,46,49,46,50,46,49,46,50,46,50,0,49,46,51,46,49,51,50,46,48,46,49,48,0,48,120,48,52,0,45,112,97,98,103,110,104,0,98,0,103,0,104,0,100,0,46,120,0,46,121,0,46,122,0,101,99,99,32,103,101,116,32,112,97,114,97,109,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,40,112,117,98,108,105,99,45,107,101,121,40,101,99,99,40,112,37,109,41,40,97,37,109,41,40,98,37,109,41,40,103,37,109,41,40,110,37,109,41,40,104,37,109,41,41,41,0,103,46,120,0,103,46,121,0,113,46,120,0,113,46,121,0,101,100,100,115,97,95,101,110,99,111,100,101,112,111,105,110,116,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,48,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,68,0,50,66,56,51,50,52,56,48,52,70,67,49,68,70,48,66,50,66,52,68,48,48,57,57,51,68,70,66,68,55,65,55,50,70,52,51,49,56,48,54,65,68,50,70,69,52,55,56,67,52,69,69,49,66,50,55,52,65,48,69,65,48,66,48,0,115,99,97,110,110,105,110,103,32,69,67,67,32,112,97,114,97,109,101,116,101,114,32,102,97,105,108,101,100,58,32,37,115,10,0,101,99,103,101,110,32,32,32,32,32,32,112,107,0,42,32,101,95,112,107,0,32,32,101,95,112,107,0,32,32,32,32,32,109,0,32,32,32,114,0,32,32,32,101,95,114,0,32,72,40,82,43,41,0,32,32,32,101,95,115,0,87,101,105,101,114,115,116,114,97,115,115,0,69,100,119,97,114,100,115,0,83,116,97,110,100,97,114,100,0,69,100,50,53,53,49,57,0,109,112,105,95,112,114,105,110,116,32,102,97,105,108,101,100,58,32,37,115,10,0,109,112,105,95,115,99,97,110,32,102,97,105,108,101,100,58,32,37,115,10,0,104,109,97,99,0,97,108,103,111,114,105,116,104,109,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,105,110,118,97,108,105,100,32,116,101,115,116,115,32,100,97,116,97,0,103,99,114,121,95,109,100,95,115,101,116,107,101,121,32,102,97,105,108,101,100,0,103,99,114,121,95,109,100,95,114,101,97,100,32,102,97,105,108,101,100,0,100,111,101,115,32,110,111,116,32,109,97,116,99,104,0,100,97,116,97,45,50,56,32,107,101,121,45,52,0,119,104,97,116,32,100,111,32,121,97,32,119,97,110,116,32,102,111,114,32,110,111,116,104,105,110,103,63,0,74,101,102,101,0,100,97,116,97,45,57,32,107,101,121,45,50,48,0,72,105,32,84,104,101,114,101,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,100,97,116,97,45,53,48,32,107,101,121,45,50,48,0,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,0,100,97,116,97,45,53,48,32,107,101,121,45,50,54,0,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,100,97,116,97,45,53,52,32,107,101,121,45,49,51,49,0,84,101,115,116,32,85,115,105,110,103,32,76,97,114,103,101,114,32,84,104,97,110,32,66,108,111,99,107,45,83,105,122,101,32,75,101,121,32,45,32,72,97,115,104,32,75,101,121,32,70,105,114,115,116,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,0,100,97,116,97,45,49,53,50,32,107,101,121,45,49,51,49,0,84,104,105,115,32,105,115,32,97,32,116,101,115,116,32,117,115,105,110,103,32,97,32,108,97,114,103,101,114,32,116,104,97,110,32,98,108,111,99,107,45,115,105,122,101,32,107,101,121,32,97,110,100,32,97,32,108,97,114,103,101,114,32,116,104,97,110,32,98,108,111,99,107,45,115,105,122,101,32,100,97,116,97,46,32,84,104,101,32,107,101,121,32,110,101,101,100,115,32,116,111,32,98,101,32,104,97,115,104,101,100,32,98,101,102,111,114,101,32,98,101,105,110,103,32,117,115,101,100,32,98,121,32,116,104,101,32,72,77,65,67,32,97,108,103,111,114,105,116,104,109,46,0,95,103,99,114,121,95,104,109,97,99,50,53,54,95,110,101,119,32,102,97,105,108,101,100,0,95,103,99,114,121,95,104,109,97,99,50,53,54,95,102,105,110,97,108,105,122,101,32,102,97,105,108,101,100,0,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,105,110,32,115,101,99,111,110,100,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110,0,70,73,80,83,45,49,57,56,97,44,32,65,46,49,0,83,97,109,112,108,101,32,35,49,0,79,76,163,213,214,139,167,204,10,18,8,201,198,30,156,93,160,64,60,10,0,70,73,80,83,45,49,57,56,97,44,32,65,46,50,0,83,97,109,112,108,101,32,35,50,0,9,34,211,64,95,170,61,25,79,130,164,88,48,115,125,92,198,199,93,36,0,70,73,80,83,45,49,57,56,97,44,32,65,46,51,0,83,97,109,112,108,101,32,35,51,0,188,244,30,171,139,178,216,2,243,208,92,175,124,176,146,236,248,209,163,170,0,70,73,80,83,45,49,57,56,97,44,32,65,46,52,0,83,97,109,112,108,101,32,35,52,0,158,168,134,239,226,104,219,236,206,66,12,117,36,223,50,224,117,26,42,38,0,111,105,100,46,0,79,73,68,46,0,109,100,95,101,110,97,98,108,101,58,32,97,108,103,111,114,105,116,104,109,32,37,100,32,110,111,116,32,97,118,97,105,108,97,98,108,101,10,0,77,68,53,32,117,115,101,100,0,109,100,46,99,0,109,100,95,119,114,105,116,101,0,79,111,112,115,58,32,109,100,32,100,101,98,117,103,32,97,108,114,101,97,100,121,32,115,116,97,114,116,101,100,10,0,100,98,103,109,100,45,37,48,53,100,46,37,46,49,48,115,0,119,0,109,100,32,100,101,98,117,103,58,32,99,97,110,39,116,32,111,112,101,110,32,37,115,10,0,109,111,114,101,32,116,104,97,110,32,111,110,101,32,97,108,103,111,114,105,116,104,109,32,105,110,32,109,100,95,114,101,97,100,40,48,41,10,0,109,100,95,114,101,97,100,0,109,100,95,103,101,116,95,97,108,103,111,0,112,111,115,115,105,98,108,101,32,117,115,97,103,101,32,101,114,114,111,114,0,87,65,82,78,73,78,71,58,32,109,111,114,101,32,116,104,97,110,32,111,110,101,32,97,108,103,111,114,105,116,104,109,32,105,110,32,109,100,95,103,101,116,95,97,108,103,111,40,41,10,0,107,101,121,108,101,110,32,60,61,32,104,100,45,62,99,116,120,45,62,109,97,99,112,97,100,115,95,66,115,105,122,101,0,112,114,101,112,97,114,101,95,109,97,99,112,97,100,115,0,103,99,114,121,95,109,100,95,111,112,101,110,32,102,97,105,108,101,100,32,102,111,114,32,97,108,103,111,32,37,100,58,32,37,115,0,110,111,32,65,83,78,46,49,32,79,73,68,32,102,111,114,32,109,100,32,97,108,103,111,32,37,100,10,0,112,114,105,109,101,103,101,110,0,99,97,110,39,116,32,103,101,110,101,114,97,116,101,32,97,32,112,114,105,109,101,32,119,105,116,104,32,108,101,115,115,32,116,104,97,110,32,37,100,32,98,105,116,115,10,0,111,118,101,114,102,108,111,119,32,105,110,32,112,114,105,109,101,32,103,101,110,101,114,97,116,105,111,110,10,0,95,103,99,114,121,95,109,112,105,95,99,109,112,40,32,40,120,41,44,32,40,110,109,105,110,117,115,49,41,32,41,32,60,32,48,32,38,38,32,95,103,99,114,121,95,109,112,105,95,99,109,112,95,117,105,40,32,40,120,41,44,32,40,49,41,32,41,32,62,32,48,0,112,114,105,109,101,103,101,110,46,99,0,105,115,95,112,114,105,109,101,0,112,115,115,0,114,97,119,0,99,111,109,112,0,111,97,101,112,0,112,107,99,115,49,0,112,97,114,97,109,0,110,111,99,111,109,112,0,114,102,99,54,57,55,57,0,110,111,112,97,114,97,109,0,112,107,99,115,49,45,114,97,119,0,105,103,110,105,110,118,102,108,97,103,0,110,111,45,107,101,121,116,101,115,116,0,110,111,45,98,108,105,110,100,105,110,103,0,117,115,101,45,102,105,112,115,49,56,54,0,117,115,101,45,102,105,112,115,49,56,54,45,50,0,110,98,105,116,115,0,114,115,97,45,117,115,101,45,101,0,115,105,103,45,118,97,108,0,104,97,115,104,45,97,108,103,111,0,108,97,98,101,108,0,114,97,110,100,111,109,45,111,118,101,114,114,105,100,101,0,115,104,97,49,0,109,100,53,0,115,104,97,50,53,54,0,114,105,112,101,109,100,49,54,48,0,114,109,100,49,54,48,0,115,104,97,51,56,52,0,115,104,97,53,49,50,0,115,104,97,50,50,52,0,109,100,50,0,109,100,52,0,116,105,103,101,114,0,104,97,118,97,108,0,100,97,116,97,0,104,97,115,104,0,115,97,108,116,45,108,101,110,103,116,104,0,63,0,112,114,105,118,97,116,101,45,107,101,121,0,112,117,98,108,105,99,45,107,101,121,0,103,101,110,107,101,121,0,97,108,103,111,114,105,116,104,109,32,100,105,115,97,98,108,101,100,0,97,108,103,111,114,105,116,104,109,32,110,111,116,32,102,111,117,110,100,0,110,111,32,115,101,108,102,116,101,115,116,32,97,118,97,105,108,97,98,108,101,0,109,111,100,117,108,101,0,65,69,83,0,99,105,112,104,101,114,0,8,9,10,11,13,14,15,16,18,19,20,21,23,24,25,26,28,29,30,31,33,34,35,36,38,39,40,41,43,44,45,46,6,154,0,127,199,106,69,159,152,186,249,23,254,223,149,33,8,14,149,23,235,22,119,113,154,207,114,128,134,4,10,227,65,69,83,45,50,53,54,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,65,69,83,45,50,53,54,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,4,5,6,7,9,10,11,12,14,15,16,17,19,20,21,22,24,25,26,27,29,30,31,32,118,119,116,117,241,242,243,244,248,249,230,231,119,112,113,114,93,30,242,13,206,214,188,188,18,19,26,199,197,71,136,170,65,69,83,45,49,57,50,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,65,69,83,45,49,57,50,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,99,102,98,0,111,102,98,0,110,111,32,116,101,115,116,32,100,97,116,97,32,102,111,114,32,116,104,105,115,32,109,111,100,101,0,111,112,101,110,0,115,101,116,32,107,101,121,0,115,101,116,32,73,86,0,101,110,99,114,121,112,116,32,99,111,109,109,97,110,100,0,101,110,99,114,121,112,116,32,109,105,115,109,97,116,99,104,0,100,101,99,114,121,112,116,32,99,111,109,109,97,110,100,0,100,101,99,114,121,112,116,32,109,105,115,109,97,116,99,104,0,232,233,234,235,237,238,239,240,242,243,244,245,247,248,249,250,1,75,175,34,120,166,157,51,29,81,128,16,54,67,233,154,103,67,195,209,81,154,180,242,205,154,120,171,9,165,17,189,65,69,83,45,49,50,56,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,65,69,83,45,49,50,56,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,49,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,51,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,0,82,73,74,78,68,65,69,76,0,65,69,83,49,50,56,0,65,69,83,45,49,50,56,0,65,69,83,49,57,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,49,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,51,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,52,0,82,73,74,78,68,65,69,76,49,57,50,0,65,69,83,45,49,57,50,0,65,69,83,50,53,54,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,49,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,51,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,52,0,82,73,74,78,68,65,69,76,50,53,54,0,65,69,83,45,50,53,54,0,82,73,80,69,77,68,49,54,48,0,48,33,48,9,6,5,43,36,3,2,1,5,0,4,20,49,46,51,46,51,54,46,51,46,51,46,49,46,50,0,49,46,51,46,51,54,46,51,46,50,46,49,0,105,32,62,32,48,0,114,115,97,45,99,111,109,109,111,110,46,99,0,95,103,99,114,121,95,114,115,97,95,112,107,99,115,49,95,101,110,99,111,100,101,95,102,111,114,95,101,110,99,0,110,32,61,61,32,110,102,114,97,109,101,0,80,75,67,83,35,49,32,98,108,111,99,107,32,116,121,112,101,32,50,32,101,110,99,111,100,101,100,32,100,97,116,97,0,118,97,108,117,101,32,101,120,116,114,97,99,116,101,100,32,102,114,111,109,32,80,75,67,83,35,49,32,98,108,111,99,107,32,116,121,112,101,32,50,32,101,110,99,111,100,101,100,32,100,97,116,97,0,105,32,62,32,49,0,95,103,99,114,121,95,114,115,97,95,112,107,99,115,49,95,101,110,99,111,100,101,95,102,111,114,95,115,105,103,0,80,75,67,83,35,49,32,98,108,111,99,107,32,116,121,112,101,32,49,32,101,110,99,111,100,101,100,32,100,97,116,97,0,95,103,99,114,121,95,114,115,97,95,112,107,99,115,49,95,101,110,99,111,100,101,95,114,97,119,95,102,111,114,95,115,105,103,0,79,65,69,80,32,101,110,99,111,100,101,100,32,100,97,116,97,0,118,97,108,117,101,32,101,120,116,114,97,99,116,101,100,32,102,114,111,109,32,79,65,69,80,32,101,110,99,111,100,101,100,32,100,97,116,97,0,104,108,101,110,0,95,103,99,114,121,95,114,115,97,95,112,115,115,95,101,110,99,111,100,101,0,80,83,83,32,101,110,99,111,100,101,100,32,100,97,116,97,0,95,103,99,114,121,95,114,115,97,95,112,115,115,95,118,101,114,105,102,121,0,82,83,65,0,110,101,0,110,101,100,112,113,117,0,97,0,115,0,110,0,99,111,110,118,101,114,116,0,40,112,114,105,118,97,116,101,45,107,101,121,32,40,114,115,97,32,32,40,110,32,35,48,48,101,48,99,101,57,54,102,57,48,98,54,99,57,101,48,50,102,51,57,50,50,98,101,97,100,97,57,51,102,101,53,48,97,56,55,53,101,97,99,54,98,99,99,49,56,98,98,57,97,57,99,102,50,101,56,52,57,54,53,99,97,97,32,32,32,32,32,32,50,100,49,102,102,57,53,97,55,102,53,52,50,52,54,53,99,54,99,48,99,49,57,100,50,55,54,101,52,53,50,54,99,101,48,52,56,56,54,56,97,55,97,57,49,52,102,100,51,52,51,99,99,51,97,56,55,100,100,55,52,50,57,49,32,32,32,32,32,32,102,102,99,53,54,53,53,48,54,100,53,98,98,98,50,53,99,98,97,99,54,97,48,101,50,100,100,49,102,56,98,99,97,97,98,48,100,52,97,50,57,99,50,102,51,55,99,57,53,48,102,51,54,51,52,56,52,98,102,50,54,57,102,55,32,32,32,32,32,32,56,57,49,52,52,48,52,54,52,98,97,102,55,57,56,50,55,101,48,51,97,51,54,101,55,48,98,56,49,52,57,51,56,101,101,98,100,99,54,51,101,57,54,52,50,52,55,98,101,55,53,100,99,53,56,98,48,49,52,98,55,101,97,50,53,49,35,41,32,32,40,101,32,35,48,49,48,48,48,49,35,41,32,32,40,100,32,35,48,52,54,49,50,57,102,50,52,56,57,100,55,49,53,55,57,98,101,48,97,55,53,102,101,48,50,57,98,100,54,99,100,98,53,55,52,101,98,102,53,55,101,97,56,97,53,98,48,102,100,97,57,52,50,99,97,98,57,52,51,98,49,49,32,32,32,32,32,32,55,100,55,98,98,57,53,101,53,100,50,56,56,55,53,101,48,102,57,102,99,53,102,99,99,48,54,97,55,50,102,54,100,53,48,50,52,54,52,100,97,98,100,101,100,55,56,101,102,54,98,55,49,54,49,55,55,98,56,51,100,53,98,100,32,32,32,32,32,32,99,53,52,51,100,99,53,100,51,102,101,100,57,51,50,101,53,57,102,53,56,57,55,101,57,50,101,54,102,53,56,97,48,102,51,51,52,50,52,49,48,54,97,51,98,54,102,97,50,99,98,102,56,55,55,53,49,48,101,52,97,99,50,49,32,32,32,32,32,32,99,51,101,101,52,55,56,53,49,101,57,55,100,49,50,57,57,54,50,50,50,97,99,51,53,54,54,100,52,99,99,98,48,98,56,51,100,49,54,52,48,55,52,97,98,102,55,100,101,54,53,53,102,99,50,52,52,54,100,97,49,55,56,49,35,41,32,32,40,112,32,35,48,48,101,56,54,49,98,55,48,48,101,49,55,101,56,97,102,101,54,56,51,55,101,55,53,49,50,101,51,53,98,54,99,97,49,49,100,48,97,101,52,55,100,56,98,56,53,49,54,49,99,54,55,98,97,102,54,52,51,55,55,50,49,51,32,32,32,32,32,32,102,101,53,50,100,55,55,50,102,50,48,51,53,98,51,99,97,56,51,48,97,102,52,49,100,56,97,52,49,50,48,101,49,99,49,99,55,48,100,49,50,99,99,50,50,102,48,48,100,50,56,100,51,49,100,100,52,56,97,56,100,52,50,52,102,49,35,41,32,32,40,113,32,35,48,48,102,55,97,55,99,97,53,51,54,55,99,54,54,49,102,56,101,54,50,100,102,51,52,102,48,100,48,53,99,49,48,99,56,56,101,53,52,57,50,51,52,56,100,100,55,98,100,100,99,57,52,50,99,57,97,56,102,51,54,57,102,57,32,32,32,32,32,32,51,53,97,48,55,55,56,53,100,50,100,98,56,48,53,50,49,53,101,100,55,56,54,101,52,50,56,53,100,102,49,54,53,56,101,101,100,51,99,101,56,52,102,52,54,57,98,56,49,98,53,48,100,51,53,56,52,48,55,98,52,97,100,51,54,49,35,41,32,32,40,117,32,35,51,48,52,53,53,57,97,57,101,97,100,53,54,100,50,51,48,57,100,50,48,51,56,49,49,97,54,52,49,98,98,49,97,48,57,54,50,54,98,99,56,101,98,51,54,102,102,102,97,50,51,99,57,54,56,101,99,53,98,100,56,57,49,101,32,32,32,32,32,32,101,98,98,97,102,99,55,51,97,101,54,54,54,101,48,49,98,97,55,99,56,57,57,48,98,97,101,48,54,99,99,50,98,98,101,49,48,98,55,53,101,54,57,102,99,97,99,98,51,53,51,97,54,52,55,51,48,55,57,100,56,101,57,98,35,41,41,41,0,40,112,117,98,108,105,99,45,107,101,121,32,40,114,115,97,32,32,40,110,32,35,48,48,101,48,99,101,57,54,102,57,48,98,54,99,57,101,48,50,102,51,57,50,50,98,101,97,100,97,57,51,102,101,53,48,97,56,55,53,101,97,99,54,98,99,99,49,56,98,98,57,97,57,99,102,50,101,56,52,57,54,53,99,97,97,32,32,32,32,32,32,50,100,49,102,102,57,53,97,55,102,53,52,50,52,54,53,99,54,99,48,99,49,57,100,50,55,54,101,52,53,50,54,99,101,48,52,56,56,54,56,97,55,97,57,49,52,102,100,51,52,51,99,99,51,97,56,55,100,100,55,52,50,57,49,32,32,32,32,32,32,102,102,99,53,54,53,53,48,54,100,53,98,98,98,50,53,99,98,97,99,54,97,48,101,50,100,100,49,102,56,98,99,97,97,98,48,100,52,97,50,57,99,50,102,51,55,99,57,53,48,102,51,54,51,52,56,52,98,102,50,54,57,102,55,32,32,32,32,32,32,56,57,49,52,52,48,52,54,52,98,97,102,55,57,56,50,55,101,48,51,97,51,54,101,55,48,98,56,49,52,57,51,56,101,101,98,100,99,54,51,101,57,54,52,50,52,55,98,101,55,53,100,99,53,56,98,48,49,52,98,55,101,97,50,53,49,35,41,32,32,40,101,32,35,48,49,48,48,48,49,35,41,41,41,0,107,101,121,32,99,111,110,115,105,115,116,101,110,99,121,0,115,105,103,110,0,101,110,99,114,121,112,116,0,40,100,97,116,97,32,40,102,108,97,103,115,32,114,97,119,41,32,40,118,97,108,117,101,32,37,109,41,41,0,99,111,110,118,101,114,116,105,110,103,32,100,97,116,97,32,102,97,105,108,101,100,0,101,110,99,114,121,112,116,32,102,97,105,108,101,100,0,103,99,114,121,95,112,107,95,100,101,99,114,121,112,116,32,114,101,116,117,114,110,101,100,32,103,97,114,98,97,103,101,0,99,105,112,104,101,114,116,101,120,116,32,109,97,116,99,104,101,115,32,112,108,97,105,110,116,101,120,116,0,100,101,99,114,121,112,116,32,102,97,105,108,101,100,0,118,97,108,117,101,0,100,101,99,114,121,112,116,32,114,101,116,117,114,110,101,100,32,110,111,32,112,108,97,105,110,116,101,120,116,0,109,105,115,109,97,116,99,104,0,101,110,99,45,118,97,108,0,114,115,97,0,40,100,97,116,97],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+30720);allocate([32,40,102,108,97,103,115,32,112,107,99,115,49,41,32,40,104,97,115,104,32,115,104,97,49,32,35,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,48,48,97,97,98,98,99,99,100,100,101,101,102,102,49,48,50,48,51,48,52,48,35,41,41,0,40,100,97,116,97,32,40,102,108,97,103,115,32,112,107,99,115,49,41,32,40,104,97,115,104,32,115,104,97,49,32,35,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,48,48,97,97,98,98,99,99,100,100,101,101,102,102,56,48,50,48,51,48,52,48,35,41,41,0,115,105,103,110,105,110,103,32,102,97,105,108,101,100,0,118,101,114,105,102,121,32,102,97,105,108,101,100,0,98,97,100,32,115,105,103,110,97,116,117,114,101,32,110,111,116,32,100,101,116,101,99,116,101,100,0,114,115,97,95,118,101,114,105,102,121,32,100,97,116,97,0,114,115,97,95,118,101,114,105,102,121,32,32,115,105,103,0,114,115,97,95,118,101,114,105,102,121,32,32,32,32,110,0,114,115,97,95,118,101,114,105,102,121,32,32,32,32,101,0,114,115,97,95,118,101,114,105,102,121,32,32,99,109,112,0,114,115,97,95,118,101,114,105,102,121,32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,115,105,103,110,32,32,32,100,97,116,97,0,110,101,100,112,63,113,63,117,63,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,110,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,101,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,100,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,112,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,113,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,117,0,114,115,97,95,115,105,103,110,32,32,32,32,114,101,115,0,40,115,105,103,45,118,97,108,40,114,115,97,40,115,37,98,41,41,41,0,40,115,105,103,45,118,97,108,40,114,115,97,40,115,37,77,41,41,41,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,100,101,99,114,121,112,116,32,100,97,116,97,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,110,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,101,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,100,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,112,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,113,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,117,0,114,115,97,95,100,101,99,114,121,112,116,32,32,114,101,115,0,40,118,97,108,117,101,32,37,98,41,0,37,109,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,101,110,99,114,121,112,116,32,100,97,116,97,0,114,115,97,95,101,110,99,114,121,112,116,32,32,32,32,110,0,114,115,97,95,101,110,99,114,121,112,116,32,32,32,32,101,0,114,115,97,95,101,110,99,114,121,112,116,32,32,114,101,115,0,40,101,110,99,45,118,97,108,40,114,115,97,40,97,37,98,41,41,41,0,40,101,110,99,45,118,97,108,40,114,115,97,40,97,37,109,41,41,41,0,114,115,97,95,101,110,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,116,101,115,116,107,101,121,32,32,32,32,61,62,32,37,115,10,0,100,101,114,105,118,101,45,112,97,114,109,115,0,117,115,101,45,120,57,51,49,0,40,109,105,115,99,45,107,101,121,45,105,110,102,111,40,112,45,113,45,115,119,97,112,112,101,100,41,41,0,40,107,101,121,45,100,97,116,97,32,40,112,117,98,108,105,99,45,107,101,121,32,32,40,114,115,97,40,110,37,109,41,40,101,37,109,41,41,41,32,40,112,114,105,118,97,116,101,45,107,101,121,32,32,40,114,115,97,40,110,37,109,41,40,101,37,109,41,40,100,37,109,41,40,112,37,109,41,40,113,37,109,41,40,117,37,109,41,41,41,32,37,83,41,0,114,115,97,46,99,0,103,101,110,101,114,97,116,101,95,115,116,100,0,32,32,112,61,32,0,32,32,113,61,32,0,112,104,105,61,32,0,32,32,103,61,32,0,32,32,102,61,32,0,32,32,110,61,32,0,32,32,101,61,32,0,32,32,100,61,32,0,32,32,117,61,32,0,115,101,108,102,45,116,101,115,116,32,97,102,116,101,114,32,107,101,121,32,103,101,110,101,114,97,116,105,111,110,32,102,97,105,108,101,100,0,88,112,49,0,88,112,50,0,88,112,0,88,113,49,0,88,113,50,0,88,113,0,95,103,99,114,121,95,109,112,105,95,103,99,100,32,40,32,40,103,41,44,32,40,101,41,44,32,40,112,104,105,41,32,41,0,103,101,110,101,114,97,116,101,95,120,57,51,49,0,112,32,97,110,100,32,113,32,97,114,101,32,115,119,97,112,112,101,100,10,0,32,32,113,0,32,32,110,0,32,32,101,0,32,32,100,0,32,32,117,0,95,103,99,114,121,95,109,112,105,95,103,101,116,95,110,98,105,116,115,32,40,40,120,105,41,41,32,61,61,32,49,48,49,0,103,101,110,95,120,57,51,49,95,112,97,114,109,95,120,105,0,95,103,99,114,121,95,109,112,105,95,103,101,116,95,110,98,105,116,115,32,40,40,120,112,41,41,32,61,61,32,110,98,105,116,115,0,103,101,110,95,120,57,51,49,95,112,97,114,109,95,120,112,0,111,112,101,110,112,103,112,45,114,115,97,0,111,105,100,46,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,0,83,72,65,49,0,48,33,48,9,6,5,43,14,3,2,26,5,0,4,20,169,153,62,54,71,6,129,106,186,62,37,113,120,80,194,108,156,208,216,157,0,132,152,62,68,28,59,210,110,186,174,74,161,249,81,41,229,229,70,112,241,0,52,170,151,60,212,196,218,164,246,30,235,43,219,173,39,49,101,52,1,111,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,53,0,49,46,50,46,56,52,48,46,49,48,48,52,48,46,52,46,51,0,49,46,51,46,49,52,46,51,46,50,46,50,54,0,49,46,51,46,49,52,46,51,46,50,46,50,57,0,49,46,50,46,56,52,48,46,49,48,48,52,53,46,52,46,49,0,83,72,65,50,50,52,0,48,45,48,13,6,9,96,134,72,1,101,3,4,2,4,5,0,4,28,186,120,22,191,143,1,207,234,65,65,64,222,93,174,34,35,176,3,97,163,150,23,122,156,180,16,255,97,242,0,21,173,0,97,98,99,100,98,99,100,101,99,100,101,102,100,101,102,103,101,102,103,104,102,103,104,105,103,104,105,106,104,105,106,107,105,106,107,108,106,107,108,109,107,108,109,110,108,109,110,111,109,110,111,112,110,111,112,113,0,36,141,106,97,210,6,56,184,229,192,38,147,12,62,96,57,163,60,228,89,100,255,33,103,246,236,237,212,25,219,6,193,0,205,199,110,92,153,20,251,146,129,161,199,226,132,215,62,103,241,128,154,72,164,151,32,14,4,109,57,204,199,17,44,208,0,35,9,125,34,52,5,216,34,134,66,164,119,189,162,85,179,42,173,188,228,189,160,179,247,227,108,157,167,0,117,56,139,22,81,39,118,204,93,186,93,161,253,137,1,80,176,198,69,92,180,245,139,25,82,82,37,37,0,32,121,70,85,152,12,145,216,187,180,193,234,151,97,138,75,240,63,66,88,25,72,178,238,78,231,173,103,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,52,0,83,72,65,50,53,54,0,48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,49,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,49,0,83,72,65,53,49,50,0,48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64,115,104,111,114,116,32,115,116,114,105,110,103,0,97,98,99,0,221,175,53,161,147,97,122,186,204,65,115,73,174,32,65,49,18,230,250,78,137,169,126,162,10,158,238,230,75,85,211,154,33,146,153,42,39,79,193,168,54,186,60,35,163,254,235,189,69,77,68,35,100,60,232,14,42,154,201,79,165,76,164,159,0,108,111,110,103,32,115,116,114,105,110,103,0,97,98,99,100,101,102,103,104,98,99,100,101,102,103,104,105,99,100,101,102,103,104,105,106,100,101,102,103,104,105,106,107,101,102,103,104,105,106,107,108,102,103,104,105,106,107,108,109,103,104,105,106,107,108,109,110,104,105,106,107,108,109,110,111,105,106,107,108,109,110,111,112,106,107,108,109,110,111,112,113,107,108,109,110,111,112,113,114,108,109,110,111,112,113,114,115,109,110,111,112,113,114,115,116,110,111,112,113,114,115,116,117,0,142,149,155,117,218,227,19,218,140,244,247,40,20,252,20,63,143,119,121,198,235,159,127,161,114,153,174,173,182,136,144,24,80,29,40,158,73,0,247,228,51,27,153,222,196,181,67,58,199,211,41,238,182,221,38,84,94,150,229,91,135,75,233,9,0,111,110,101,32,109,105,108,108,105,111,110,32,34,97,34,0,231,24,72,61,12,231,105,100,78,46,66,199,188,21,180,99,142,31,152,177,59,32,68,40,86,50,168,3,175,169,115,235,222,15,242,68,135,126,166,10,76,176,67,44,229,119,195,27,235,0,156,92,44,73,170,46,78,173,178,23,173,140,192,155,0,100,105,103,101,115,116,0,203,0,117,63,69,163,94,139,181,160,61,105,154,198,80,7,39,44,50,171,14,222,209,99,26,139,96,90,67,255,91,237,128,134,7,43,161,231,204,35,88,186,236,161,52,200,37,167,0,9,51,12,51,247,17,71,232,61,25,47,199,130,205,27,71,83,17,27,23,59,59,5,210,47,160,128,134,227,176,247,18,252,199,199,26,85,126,45,185,102,195,233,250,145,116,96,57,0,157,14,24,9,113,100,116,203,8,110,131,78,49,10,74,28,237,20,158,156,0,242,72,82,121,114,206,197,112,76,42,91,7,184,179,220,56,236,196,235,174,151,221,216,127,61,137,133,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,51,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,51,0,83,72,65,51,56,52,0,48,65,48,13,6,9,96,134,72,1,101,3,4,2,2,5,0,4,48,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,50,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,50,0,84,87,79,70,73,83,72,0,37,115,10,0,0,1,23,2,46,24,83,3,106,47,147,25,52,84,69,4,92,107,182,48,166,148,75,26,140,53,129,85,170,70,13,5,36,93,135,108,155,183,193,49,43,167,163,149,152,76,202,27,230,141,115,54,205,130,18,86,98,171,240,71,79,14,189,6,212,37,210,94,39,136,102,109,214,156,121,184,8,194,223,50,104,44,253,168,138,164,90,150,41,153,34,77,96,203,228,28,123,231,59,142,158,116,244,55,216,206,249,131,111,19,178,87,225,99,220,172,196,241,175,72,10,80,66,15,186,190,199,7,222,213,120,38,101,211,209,95,227,40,33,137,89,103,252,110,177,215,248,157,243,122,58,185,198,9,65,195,174,224,219,51,68,105,146,45,82,254,22,169,12,139,128,165,74,91,181,151,201,42,162,154,192,35,134,78,188,97,239,204,17,229,114,29,61,124,235,232,233,60,234,143,125,159,236,117,30,245,62,56,246,217,63,207,118,250,31,132,160,112,237,20,144,179,126,88,251,226,32,100,208,221,119,173,218,197,64,242,57,176,247,73,180,11,127,81,21,67,145,16,113,187,238,191,133,200,161,1,2,4,8,16,32,64,128,77,154,121,242,169,31,62,124,248,189,55,110,220,245,167,3,6,12,24,48,96,192,205,215,227,139,91,182,33,66,132,69,138,89,178,41,82,164,5,10,20,40,80,160,13,26,52,104,208,237,151,99,198,193,207,211,235,155,123,246,161,15,30,60,120,240,173,23,46,92,184,61,122,244,165,7,14,28,56,112,224,141,87,174,17,34,68,136,93,186,57,114,228,133,71,142,81,162,9,18,36,72,144,109,218,249,191,51,102,204,213,231,131,75,150,97,194,201,223,243,171,27,54,108,216,253,183,35,70,140,85,170,25,50,100,200,221,247,163,11,22,44,88,176,45,90,180,37,74,148,101,202,217,255,179,43,86,172,21,42,84,168,29,58,116,232,157,119,238,145,111,222,241,175,19,38,76,152,125,250,185,63,126,252,181,39,78,156,117,234,153,127,254,177,47,94,188,53,106,212,229,135,67,134,65,130,73,146,105,210,233,159,115,230,129,79,158,113,226,137,95,190,49,98,196,197,199,195,203,219,251,187,59,118,236,149,103,206,209,239,147,107,214,225,143,83,166,1,2,4,8,16,32,64,128,77,154,121,242,169,31,62,124,248,189,55,110,220,245,167,3,6,12,24,48,96,192,205,215,227,139,91,182,33,66,132,69,138,89,178,41,82,164,5,10,20,40,80,160,13,26,52,104,208,237,151,99,198,193,207,211,235,155,123,246,161,15,30,60,120,240,173,23,46,92,184,61,122,244,165,7,14,28,56,112,224,141,87,174,17,34,68,136,93,186,57,114,228,133,71,142,81,162,9,18,36,72,144,109,218,249,191,51,102,204,213,231,131,75,150,97,194,201,223,243,171,27,54,108,216,253,183,35,70,140,85,170,25,50,100,200,221,247,163,11,22,44,88,176,45,90,180,37,74,148,101,202,217,255,179,43,86,172,21,42,84,168,29,58,116,232,157,119,238,145,111,222,241,175,19,38,76,152,125,250,185,63,126,252,181,39,78,156,117,234,153,127,254,177,47,94,188,53,106,212,229,135,67,134,65,130,73,146,105,210,233,159,115,230,129,79,158,113,226,137,95,190,49,98,196,197,199,195,203,169,117,103,243,179,198,232,244,4,219,253,123,163,251,118,200,154,74,146,211,128,230,120,107,228,69,221,125,209,232,56,75,13,214,198,50,53,216,152,253,24,55,247,113,236,241,108,225,67,48,117,15,55,248,38,27,250,135,19,250,148,6,72,63,242,94,208,186,139,174,48,91,132,138,84,0,223,188,35,157,25,109,91,193,61,177,89,14,243,128,174,93,162,210,130,213,99,160,1,132,131,7,46,20,217,181,81,144,155,44,124,163,166,178,235,115,165,76,190,84,22,146,12,116,227,54,97,81,192,56,140,176,58,189,245,90,115,252,44,96,37,98,11,150,187,108,78,66,137,247,107,16,83,124,106,40,180,39,241,140,225,19,230,149,189,156,69,199,226,36,244,70,182,59,102,112,204,202,149,227,3,133,86,203,212,17,28,208,30,147,215,184,251,166,195,131,142,32,181,255,233,159,207,119,191,195,186,204,234,3,119,111,57,8,175,191,51,64,201,231,98,43,113,226,129,121,121,12,9,170,173,130,36,65,205,58,249,234,216,185,229,228,197,154,185,164,77,151,68,126,8,218,134,122,231,23,161,102,29,148,170,161,237,29,6,61,112,240,178,222,210,179,65,11,123,114,160,167,17,28,49,239,194,209,39,83,144,62,32,143,246,51,96,38,255,95,150,236,92,118,177,42,171,73,158,129,156,136,82,238,27,33,95,196,147,26,10,235,239,217,145,197,133,57,73,153,238,205,45,173,79,49,143,139,59,1,71,24,135,35,109,221,70,31,214,78,62,45,105,249,100,72,42,79,206,242,203,101,47,142,252,120,151,92,5,88,122,25,172,141,127,229,213,152,26,87,75,103,14,127,167,5,90,100,40,175,20,99,63,182,41,254,136,245,60,183,76,60,2,165,184,206,218,233,176,104,23,68,85,224,31,77,138,67,125,105,87,41,199,46,141,172,116,21,183,89,196,168,159,10,114,158,126,110,21,71,34,223,18,52,88,53,7,106,153,207,52,220,110,34,80,201,222,192,104,155,101,137,188,212,219,237,248,171,200,18,168,162,43,13,64,82,220,187,254,2,50,47,164,169,202,215,16,97,33,30,240,180,211,80,93,4,15,246,0,194,111,22,157,37,54,134,66,86,74,85,94,9,193,190,224,145,117,243,198,244,219,123,251,200,74,211,230,107,69,125,232,75,214,50,216,253,55,113,241,225,48,15,248,27,135,250,6,63,94,186,174,91,138,0,188,157,109,193,177,14,128,93,210,213,160,132,7,20,181,144,44,163,178,115,76,84,146,116,54,81,56,176,189,90,252,96,98,150,108,66,247,16,124,40,39,140,19,149,156,199,36,70,59,112,202,227,133,203,17,208,147,184,166,131,32,255,159,119,195,204,3,111,8,191,64,231,43,226,121,12,170,130,65,58,234,185,228,154,164,151,126,218,122,23,102,148,161,29,61,240,222,179,11,114,167,28,239,209,83,62,143,51,38,95,236,118,42,73,129,136,238,33,196,26,235,217,197,57,153,205,173,49,139,1,24,35,221,31,78,45,249,72,79,242,101,142,120,92,88,25,141,229,152,87,103,127,5,100,175,99,182,254,245,183,60,165,206,233,104,68,224,77,67,105,41,46,172,21,89,168,10,158,110,71,223,52,53,106,207,220,34,201,192,155,137,212,237,171,18,162,13,82,187,2,47,169,215,97,30,180,80,4,246,194,22,37,134,86,85,9,190,145,169,103,179,232,4,253,163,118,154,146,128,120,228,221,209,56,13,198,53,152,24,247,236,108,67,117,55,38,250,19,148,72,242,208,139,48,132,84,223,35,25,91,61,89,243,174,162,130,99,1,131,46,217,81,155,124,166,235,165,190,22,12,227,97,192,140,58,245,115,44,37,11,187,78,137,107,83,106,180,241,225,230,189,69,226,244,182,102,204,149,3,86,212,28,30,215,251,195,142,181,233,207,191,186,234,119,57,175,51,201,98,113,129,121,9,173,36,205,249,216,229,197,185,77,68,8,134,231,161,29,170,237,6,112,178,210,65,123,160,17,49,194,39,144,32,246,96,255,150,92,177,171,158,156,82,27,95,147,10,239,145,133,73,238,45,79,143,59,71,135,109,70,214,62,105,100,42,206,203,47,252,151,5,122,172,127,213,26,75,14,167,90,40,20,63,41,136,60,76,2,184,218,176,23,85,31,138,125,87,199,141,116,183,196,159,114,126,21,34,18,88,7,153,52,110,80,222,104,101,188,219,248,200,168,43,64,220,254,50,164,202,16,33,240,211,93,15,0,111,157,54,66,74,94,193,224,159,88,159,92,246,18,44,50,182,191,236,47,42,232,195,90,212,145,219,22,231,177,195,158,134,203,8,107,120,159,84,25,1,159,152,9,222,23,17,133,143,170,195,163,186,32,251,195,84,119,111,102,105,115,104,45,49,50,56,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,84,119,111,102,105,115,104,45,49,50,56,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,212,59,183,85,110,163,46,70,242,162,130,183,212,91,78,13,87,255,115,157,77,201,44,27,215,252,1,112,12,200,33,111,144,175,233,27,178,136,84,79,44,50,220,35,155,38,53,230,108,180,86,28,64,191,10,151,5,147,28,182,212,8,231,250,84,119,111,102,105,115,104,45,50,53,54,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,84,119,111,102,105,115,104,45,50,53,54,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,84,87,79,70,73,83,72,49,50,56,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,110,111,110,99,101,32,98,117,102,102,101,114,32,108,111,99,107,58,32,37,115,10,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,110,111,110,99,101,32,98,117,102,102,101,114,32,108,111,99,107,58,32,37,115,10,0,37,115,46,42,0,37,115,46,88,0,37,115,58,32,71,101,116,116,105,110,103,32,89,45,99,111,111,114,100,105,110,97,116,101,32,111,110,32,37,115,32,105,115,32,110,111,116,32,115,117,112,112,111,114,116,101,100,10,0,95,103,99,114,121,95,109,112,105,95,101,99,95,103,101,116,95,97,102,102,105,110,101,0,77,111,110,116,103,111,109,101,114,121,0,101,99,95,105,110,118,109,58,32,105,110,118,101,114,115,101,32,100,111,101,115,32,110,111,116,32,101,120,105,115,116,58,10,0,32,32,97,0,32,32,112,0,71,67,82,89,80,84,95,66,65,82,82,69,84,84,0,37,115,58,32,37,115,32,110,111,116,32,121,101,116,32,115,117,112,112,111,114,116,101,100,10,0,95,103,99,114,121,95,109,112,105,95,101,99,95,100,117,112,95,112,111,105,110,116,0,95,103,99,114,121,95,109,112,105,95,101,99,95,97,100,100,95,112,111,105,110,116,115,0,0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,33,98,112,95,109,97,114,107,101,114,0,109,112,105,45,112,111,119,46,99,0,95,103,99,114,121,95,109,112,105,95,112,111,119,109,0,114,101,115,45,62,100,32,61,61,32,114,112,0,105,32,61,61,32,110,108,105,109,98,115,0,109,112,105,99,111,100,101,114,46,99,0,95,103,99,114,121,95,109,112,105,95,115,101,116,95,98,117,102,102,101,114,0,58,103,101,110,101,114,105,99,47,109,112,105,104,45,97,100,100,49,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,115,117,98,49,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,109,117,108,49,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,109,117,108,50,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,109,117,108,51,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,108,115,104,105,102,116,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,114,115,104,105,102,116,46,99,0,105,110,118,97,108,105,100,32,109,112,105,95,99,111,110,115,116,32,115,101,108,101,99,116,111,114,32,37,100,10,0,87,97,114,110,105,110,103,58,32,116,114,121,105,110,103,32,116,111,32,99,104,97,110,103,101,32,97,110,32,105,109,109,117,116,97,98,108,101,32,77,80,73,10,0,105,110,118,97,108,105,100,32,102,108,97,103,32,118,97,108,117,101,32,105,110,32,109,112,105,95,102,114,101,101,10,0,109,112,105,95,103,101,116,95,111,112,97,113,117,101,32,111,110,32,110,111,114,109,97,108,32,109,112,105,10,0,109,112,105,95,115,101,116,95,99,111,110,100,58,32,100,105,102,102,101,114,101,110,116,32,115,105,122,101,115,10,0,109,112,105,95,115,119,97,112,95,99,111,110,100,58,32,100,105,102,102,101,114,101,110,116,32,115,105,122,101,115,10,0,105,110,118,97,108,105,100,32,102,108,97,103,32,118,97,108,117,101,10,0,77,80,73,32,115,117,98,115,121,115,116,101,109,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,10,0,10,10,84,104,105,115,32,105,115,32,76,105,98,103,99,114,121,112,116,32,49,46,55,46,48,45,98,101,116,97,50,51,48,32,45,32,84,104,101,32,71,78,85,32,67,114,121,112,116,111,32,76,105,98,114,97,114,121,10,67,111,112,121,114,105,103,104,116,32,40,67,41,32,50,48,48,48,45,50,48,49,50,32,70,114,101,101,32,83,111,102,116,119,97,114,101,32,70,111,117,110,100,97,116,105,111,110,44,32,73,110,99,46,10,67,111,112,121,114,105,103,104,116,32,40,67,41,32,50,48,49,50,45,50,48,49,52,32,103,49,48,32,67,111,100,101,32,71,109,98,72,10,67,111,112,121,114,105,103,104,116,32,40,67,41,32,50,48,49,51,45,50,48,49,52,32,74,117,115,115,105,32,75,105,118,105,108,105,110,110,97,10,10,40,97,51,54,101,101,55,53,48,32,50,48,49,55,45,48,51,45,48,57,84,49,51,58,51,57,43,48,48,48,48,41,10,10,10,0,99,105,112,104,101,114,45,99,109,97,99,46,99,0,99,109,97,99,95,103,101,110,101,114,97,116,101,95,115,117,98,107,101,121,115,0,99,45,62,117,110,117,115,101,100,32,60,32,98,108,111,99,107,115,105,122,101,0,99,105,112,104,101,114,45,99,116,114,46,99,0,95,103,99,114,121,95,99,105,112,104,101,114,95,99,116,114,95,101,110,99,114,121,112,116,0,117,110,117,115,101,100,32,61,61,32,98,108,111,99,107,115,105,122,101,0,99,105,112,104,101,114,45,103,99,109,46,99,0,100,111,95,103,104,97,115,104,95,98,117,102,0,102,97,105,108,101,100,32,116,111,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,0,115,101,116,107,101,121,32,102,97,105,108,101,100,0,115,101,108,102,116,101,115,116,32,102,111,114,32,67,66,67,32,102,97,105,108,101,100,32,45,32,115,101,101,32,115,121,115,108,111,103,32,102,111,114,32,100,101,116,97,105,108,115,0,115,101,108,102,116,101,115,116,32,102,111,114,32,67,70,66,32,102,97,105,108,101,100,32,45,32,115,101,101,32,115,121,115,108,111,103,32,102,111,114,32,100,101,116,97,105,108,115,0,115,101,108,102,116,101,115,116,32,102,111,114,32,67,84,82,32,102,97,105,108,101,100,32,45,32,115,101,101,32,115,121,115,108,111,103,32,102,111,114,32,100,101,116,97,105,108,115,0,69,67,67,0,112,97,98,103,110,104,113,0,112,97,98,103,110,104,113,100,0,115,119,0,114,115,0,102,108,97,103,115,0,112,63,97,63,98,63,103,63,110,63,104,63,47,113,0,112,63,97,63,98,63,103,63,110,63,104,63,113,0,47,113,0,113,0,99,117,114,118,101,0,112,97,98,103,110,104,113,40,49,58,37,99,37,117,58,0,41,0,108,111,119,45,108,101,118,101,108,0,112,117,98,107,101,121,0,112,0,101,99,99,95,118,101,114,105,102,121,32,100,97,116,97,0,47,114,115,0,101,99,99,95,118,101,114,105,102,121,32,32,115,95,114,0,101,99,99,95,118,101,114,105,102,121,32,32,115,95,115,0,45,112,63,97,63,98,63,103,63,110,63,104,63,47,113,0,43,69,100,68,83,65,0,101,99,99,95,118,101,114,105,102,121,32,105,110,102,111,58,32,37,115,47,37,115,37,115,10,0,101,99,99,95,118,101,114,105,102,121,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,112,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,97,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,98,0,101,99,99,95,118,101,114,105,102,121,32,32,103,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,110,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,104,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,113,0,71,111,111,100,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,61,62,32,37,115,10,0,101,99,99,95,115,105,103,110,32,32,32,100,97,116,97,0,45,112,63,97,63,98,63,103,63,110,63,104,63,47,113,63,43,100,0,47,113,63,43,100,0,101,99,99,95,115,105,103,110,32,32,32,105,110,102,111,58,32,37,115,47,37,115,37,115,10,0,101,99,99,95,115,105,103,110,32,32,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,112,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,97,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,98,0,101,99,99,95,115,105,103,110,32,32,32,32,103,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,110,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,104,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,113,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,100,0,40,115,105,103,45,118,97,108,40,101,100,100,115,97,40,114,37,77,41,40,115,37,77,41,41,41,0,40,115,105,103,45,118,97,108,40,103,111,115,116,40,114,37,77,41,40,115,37,77,41,41,41,0,40,115,105,103,45,118,97,108,40,101,99,100,115,97,40,114,37,77,41,40,115,37,77,41,41,41,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,61,62,32,37,115,10,0,101,0,101,99,99,95,100,101,99,114,121,112,116,32,32,100,95,101,0,45,112,63,97,63,98,63,103,63,110,63,104,63,43,100,0,101,99,99,95,100,101,99,114,121,112,116,32,105,110,102,111,58,32,37,115,47,37,115,10,0,101,99,99,95,100,101,99,114,121,112,116,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,112,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,97,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,98,0,101,99,99,95,100,101,99,114,121,112,116,32,32,103,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,110,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,104,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,100,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,101,99,99,95,100,101,99,114,121,112,116,32,32,114,101,115,0,40,118,97,108,117,101,32,37,109,41,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,101,99,99,95,101,110,99,114,121,112,116,32,100,97,116,97,0,45,112,63,97,63,98,63,103,63,110,63,104,63,43,113,0,101,99,99,95,101,110,99,114,121,112,116,32,105,110,102,111,58,32,37,115,47,37,115,10,0,101,99,99,95,101,110,99,114,121,112,116,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,112,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,97,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,98,0,101,99,99,95,101,110,99,114,121,112,116,32,32,103,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,110,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,104,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,113,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,107,100,71,10,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,107,71,10,0,40,101,110,99,45,118,97,108,40,101,99,100,104,40,115,37,109,41,40,101,37,109,41,41,41,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,101,99,99,95,116,101,115,116,107,101,121,32,105,110,102,58,32,37,115,47,37,115,10,0,101,99,99,95,116,101,115,116,107,101,121,32,110,97,109,58,32,37,115,10,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,112,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,97,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,98,0,101,99,99,95,116,101,115,116,107,101,121,32,103,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,110,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,104,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,113,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,100,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,61,62,32,37,115,10,0,66,97,100,32,99,104,101,99,107,58,32,80,111,105,110,116,32,39,71,39,32,100,111,101,115,32,110,111,116,32,98,101,108,111,110,103,32,116,111,32,99,117,114,118,101,32,39,69,39,33,10,0,66,97,100,32,99,104,101,99,107,58,32,39,71,39,32,99,97,110,110,111,116,32,98,101,32,80,111,105,110,116,32,97,116,32,73,110,102,105,110,105,116,121,33,10,0,99,104,101,99,107,95,115,101,99,114,101,116,95,107,101,121,58,32,69,32,105,115,32,110,111,116,32,97,32,99,117,114,118,101,32,111,102,32,111,114,100,101,114,32,110,10,0,66,97,100,32,99,104,101,99,107,58,32,81,32,99,97,110,32,110,111,116,32,98,101,32,97,32,80,111,105,110,116,32,97,116,32,73,110,102,105,110,105,116,121,33,10,0,66,97,100,32,99,104,101,99,107,58,32,99,111,109,112,117,116,97,116,105,111,110,32,111,102,32,100,71,32,102,97,105,108,101,100,10,0,66,97,100,32,99,104,101,99,107,58,32,84,104,101,114,101,32,105,115,32,78,79,32,99,111,114,114,101,115,112,111,110,100,101,110,99,101,32,98,101,116,119,101,101,110,32,39,100,39,32,97,110,100,32,39,81,39,33,10,0,116,114,97,110,115,105,101,110,116,45,107,101,121,0,101,99,103,101,110,32,99,117,114,118,101,32,105,110,102,111,58,32,37,115,47,37,115,10,0,101,99,103,101,110,32,99,117,114,118,101,32,117,115,101,100,58,32,37,115,10,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,112,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,97,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,98,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,110,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,104,0,101,99,103,101,110,32,99,117,114,118,101,32,71,0,101,99,103,101,110,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,37,115,10,0,71,0,81,0,40,99,117,114,118,101,32,37,115,41,0,40,102,108,97,103,115,32,112,97,114,97,109,41,0,40,102,108,97,103,115,32,101,100,100,115,97,41,0,40,102,108,97,103,115,32,112,97,114,97,109,32,101,100,100,115,97,41,0,40,107,101,121,45,100,97,116,97,32,40,112,117,98,108,105,99,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,112,37,109,41,40,97,37,109,41,40,98,37,109,41,40,103,37,109,41,40,110,37,109,41,40,104,37,109,41,40,113,37,109,41,41,41,32,40,112,114,105,118,97,116,101,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,112,37,109,41,40,97,37,109,41,40,98,37,109,41,40,103,37,109,41,40,110,37,109,41,40,104,37,109,41,40,113,37,109,41,40,100,37,109,41,41,41,32,41,0,40,107,101,121,45,100,97,116,97,32,40,112,117,98,108,105,99,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,113,37,109,41,41,41,32,40,112,114,105,118,97,116,101,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,113,37,109,41,40,100,37,109,41,41,41,32,41,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,112,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,97,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,98,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,71,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,110,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,104,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,81,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,100,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,117,115,105,110,103,32,69,100,50,53,53,49,57,43,69,100,68,83,65,10,0,101,99,103,101,110,32,99,111,110,118,101,114,116,101,100,32,81,32,116,111,32,97,32,99,111,109,112,108,105,97,110,116,32,112,111,105,110,116,10,0,101,99,103,101,110,32,100,105,100,110,39,116,32,110,101,101,100,32,116,111,32,99,111,110,118,101,114,116,32,81,32,116,111,32,97,32,99,111,109,112,108,105,97,110,116,32,112,111,105,110,116,10,0,84,101,115,116,105,110,103,32,107,101,121,46,10,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,104,107,81,10,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,104,100,107,71,10,0,69,67,68,72,32,116,101,115,116,32,102,97,105,108,101,100,46,10,0,69,67,68,83,65,32,111,112,101,114,97,116,105,111,110,58,32,115,105,103,110,32,102,97,105,108,101,100,10,0,69,67,68,83,65,32,111,112,101,114,97,116,105,111,110,58,32,115,105,103,110,44,32,118,101,114,105,102,121,32,102,97,105,108,101,100,10,0,69,67,68,83,65,32,111,112,101,114,97,116,105,111,110,58,32,115,105,103,110,44,32,118,101,114,105,102,121,32,111,107,46,10,0,101,99,99,0,101,99,100,115,97,0,101,99,100,104,0,101,100,100,115,97,0,103,111,115,116,0,100,105,103,101,115,116,32,115,105,122,101,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,101,120,112,101,99,116,101,100,32,115,105,122,101,0,103,99,114,121,95,109,100,95,111,112,101,110,32,102,97,105,108,101,100,0,105,110,118,97,108,105,100,32,68,65,84,65,77,79,68,69,0,100,105,103,101,115,116,32,109,105,115,109,97,116,99,104,0,104,97,115,104,45,99,111,109,109,111,110,46,99,0,95,103,99,114,121,95,109,100,95,98,108,111,99,107,95,119,114,105,116,101,0,80,111,108,121,49,51,48,53,32,115,101,108,102,116,101,115,116,32,102,97,105,108,101,100,32,40,37,115,41,10,0,142,153,59,159,72,104,18,115,194,150,80,186,50,252,118,206,72,51,46,167,22,77,150,164,71,111,184,197,49,161,24,106,192,223,193,124,152,220,232,123,77,167,240,17,236,72,201,114,113,210,194,15,155,146,143,226,39,13,111,184,99,213,23,56,180,142,238,227,20,167,204,138,185,50,22,69,72,229,38,174,144,34,67,104,81,122,207,234,189,107,179,115,43,192,233,218,153,131,43,97,202,1,182,222,86,36,74,158,136,213,249,179,121,115,246,34,164,61,20,166,89,155,31,101,76,180,90,116,227,85,165,238,166,167,37,28,30,114,145,109,17,194,203,33,77,60,37,37,57,18,29,142,35,78,101,45,101,31,164,200,207,248,128,243,255,199,112,63,148,0,229,42,125,251,75,61,51,5,217,80,111,108,121,49,51,48,53,32,116,101,115,116,32,49,32,102,97,105,108,101,100,46,0,80,111,108,121,49,51,48,53,32,116,101,115,116,32,50,32,102,97,105,108,101,100,46,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,111,108,121,49,51,48,53,32,116,101,115,116,32,51,32,102,97,105,108,101,100,46,0,1,2,3,4,5,6,7,255,254,253,252,251,250,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,100,175,226,232,214,173,123,189,210,135,249,124,68,98,61,57,80,111,108,121,49,51,48,53,32,116,101,115,116,32,52,32,102,97,105,108,101,100,46,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,112,111,111,108,32,108,111,99,107,58,32,37,115,10,0,87,65,82,78,73,78,71,58,32,117,115,105,110,103,32,105,110,115,101,99,117,114,101,32,114,97,110,100,111,109,32,110,117,109,98,101,114,32,103,101,110,101,114,97,116,111,114,33,33,10,0,112,111,111,108,95,105,115,95,108,111,99,107,101,100,0,114,97,110,100,111,109,45,99,115,112,114,110,103,46,99,0,97,100,100,95,114,97,110,100,111,109,110,101,115,115,0,109,105,120,95,112,111,111,108,0,110,111,32,101,110,116,114,111,112,121,32,103,97,116,104,101,114,105,110,103,32,109,111,100,117,108,101,32,100,101,116,101,99,116,101,100,10,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,112,111,111,108,32,108,111,99,107,58,32,37,115,10,0,32,40,104,119,114,110,103,32,102,97,105,108,101,100,41,0,114,97,110,100,111,109,32,117,115,97,103,101,58,32,112,111,111,108,115,105,122,101,61,37,100,32,109,105,120,101,100,61,37,108,117,32,112,111,108,108,115,61,37,108,117,47,37,108,117,32,97,100,100,101,100,61,37,108,117,47,37,108,117,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,111,117,116,109,105,120,61,37,108,117,32,103,101,116,108,118,108,49,61,37,108,117,47,37,108,117,32,103,101,116,108,118,108,50,61,37,108,117,47,37,108,117,37,115,10,0,114,101,97,100,95,112,111,111,108,0,116,111,111,32,109,97,110,121,32,114,97,110,100,111,109,32,98,105,116,115,32,114,101,113,117,101,115,116,101,100,10,0,100,111,95,102,97,115,116,95,114,97,110,100,111,109,95,112,111,108,108,0,83,108,111,119,32,101,110,116,114,111,112,121,32,103,97,116,104,101,114,105,110,103,32,109,111,100,117,108,101,32,110,111,116,32,121,101,116,32,105,110,105,116,105,97,108,105,122,101,100,10,0,78,111,32,119,97,121,32,116,111,32,103,97,116,104,101,114,32,101,110,116,114,111,112,121,32,102,111,114,32,116,104,101,32,82,78,71,10,0,114,101,97,100,95,115,101,101,100,95,102,105,108,101,0,99,97,110,39,116,32,111,112,101,110,32,96,37,115,39,58,32,37,115,10,0,99,97,110,39,116,32,115,116,97,116,32,96,37,115,39,58,32,37,115,10,0,96,37,115,39,32,105,115,32,110,111,116,32,97,32,114,101,103,117,108,97,114,32,102,105,108,101,32,45,32,105,103,110,111,114,101,100,10,0,110,111,116,101,58,32,114,97,110,100,111,109,95,115,101,101,100,32,102,105,108,101,32,105,115,32,101,109,112,116,121,10,0,119,97,114,110,105,110,103,58,32,105,110,118,97,108,105,100,32,115,105,122,101,32,111,102,32,114,97,110,100,111,109,95,115,101,101,100,32,102,105,108,101,32,45,32,110,111,116,32,117,115,101,100,10,0,99,97,110,39,116,32,114,101,97,100,32,96,37,115,39,58,32,37,115,10,0,99,97,110,39,116,32,108,111,99,107,32,96,37,115],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+40960);allocate([39,58,32,37,115,10,0,119,97,105,116,105,110,103,32,102,111,114,32,108,111,99,107,32,111,110,32,96,37,115,39,46,46,46,10,0,95,103,99,114,121,95,114,110,103,99,115,112,114,110,103,95,115,101,116,95,115,101,101,100,95,102,105,108,101,0,110,111,116,101,58,32,114,97,110,100,111,109,95,115,101,101,100,32,102,105,108,101,32,110,111,116,32,117,112,100,97,116,101,100,10,0,99,97,110,39,116,32,99,114,101,97,116,101,32,96,37,115,39,58,32,37,115,10,0,99,97,110,39,116,32,119,114,105,116,101,32,96,37,115,39,58,32,37,115,10,0,99,97,110,39,116,32,99,108,111,115,101,32,96,37,115,39,58,32,37,115,10,0,33,110,111,110,99,101,95,99,111,110,116,101,120,116,45,62,116,101,115,116,95,100,116,95,112,116,114,0,114,97,110,100,111,109,45,102,105,112,115,46,99,0,95,103,99,114,121,95,114,110,103,102,105,112,115,95,105,110,105,116,105,97,108,105,122,101,0,33,115,116,100,95,114,110,103,95,99,111,110,116,101,120,116,45,62,116,101,115,116,95,100,116,95,112,116,114,0,33,115,116,114,111,110,103,95,114,110,103,95,99,111,110,116,101,120,116,45,62,116,101,115,116,95,100,116,95,112,116,114,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,109,101,109,111,114,121,32,99,111,114,114,117,112,116,105,111,110,32,100,101,116,101,99,116,101,100,32,105,110,32,82,78,71,32,99,111,110,116,101,120,116,32,37,112,10,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,114,110,103,95,99,116,120,0,102,111,114,107,32,119,105,116,104,111,117,116,32,112,114,111,112,101,114,32,114,101,45,105,110,105,116,105,97,108,105,122,97,116,105,111,110,32,100,101,116,101,99,116,101,100,32,105,110,32,82,78,71,0,115,101,118,101,114,101,32,101,114,114,111,114,32,103,101,116,116,105,110,103,32,114,97,110,100,111,109,10,0,102,105,112,115,95,114,110,103,95,105,115,95,108,111,99,107,101,100,0,120,57,51,49,95,97,101,115,95,100,114,105,118,101,114,0,114,110,103,95,99,116,120,45,62,99,105,112,104,101,114,95,104,100,0,114,110,103,95,99,116,120,45,62,105,115,95,115,101,101,100,101,100,0,116,101,109,112,118,97,108,117,101,95,102,111,114,95,120,57,51,49,95,97,101,115,95,100,114,105,118,101,114,0,100,117,112,108,105,99,97,116,101,32,49,50,56,32,98,105,116,32,98,108,111,99,107,32,114,101,116,117,114,110,101,100,32,98,121,32,82,78,71,0,108,101,110,103,116,104,32,61,61,32,49,54,0,101,110,99,114,121,112,116,95,97,101,115,0,65,69,83,32,101,110,99,114,121,112,116,105,111,110,32,105,110,32,82,78,71,32,102,97,105,108,101,100,58,32,37,115,10,0,120,57,51,49,95,103,101,116,95,100,116,0,103,101,116,116,105,109,101,111,102,100,97,121,40,41,32,102,97,105,108,101,100,58,32,37,115,10,0,120,57,51,49,95,114,101,115,101,101,100,0,120,57,51,49,95,103,101,110,101,114,97,116,101,95,115,101,101,100,0,33,101,110,116,114,111,112,121,95,99,111,108,108,101,99,116,95,98,117,102,102,101,114,0,103,101,116,95,101,110,116,114,111,112,121,0,101,114,114,111,114,32,103,101,116,116,105,110,103,32,101,110,116,114,111,112,121,32,100,97,116,97,10,0,101,110,116,114,111,112,121,95,99,111,108,108,101,99,116,95,99,98,0,101,110,116,114,111,112,121,95,99,111,108,108,101,99,116,95,98,117,102,102,101,114,0,120,57,51,49,95,103,101,110,101,114,97,116,101,95,107,101,121,0,101,114,114,111,114,32,99,114,101,97,116,105,110,103,32,99,105,112,104,101,114,32,99,111,110,116,101,120,116,32,102,111,114,32,82,78,71,58,32,37,115,10,0,101,114,114,111,114,32,99,114,101,97,116,105,110,103,32,107,101,121,32,102,111,114,32,82,78,71,58,32,37,115,10,0,115,101,108,102,116,101,115,116,95,107,97,116,0,101,114,114,111,114,32,99,114,101,97,116,105,110,103,32,99,105,112,104,101,114,32,99,111,110,116,101,120,116,32,102,111,114,32,82,78,71,0,185,202,127,214,160,245,211,66,25,109,132,145,118,28,59,190,72,178,130,152,104,194,128,0,0,0,40,24,0,0,37,0,82,23,141,41,162,213,132,18,157,137,154,69,130,2,247,119,66,156,8,61,130,244,138,64,102,181,73,39,171,66,199,195,14,183,97,60,254,176,190,115,247,110,109,111,29,163,20,250,187,75,193,14,197,251,205,70,190,40,97,231,3,43,55,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,149,189,74,82,226,158,215,19,211,19,250,32,233,141,188,200,209,229,17,89,82,247,250,55,56,180,197,206,178,176,154,13,156,197,13,22,225,188,237,207,96,98,9,157,32,131,126,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,128,0,129,1,130,2,131,3,160,32,161,33,162,34,163,35,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,150,237,204,195,221,4,127,117,99,25,55,111,21,34,87,86,122,20,118,119,149,23,126,200,146,232,221,21,203,31,188,177,37,62,46,162,65,27,221,245,33,72,65,113,179,141,47,76,101,114,114,111,114,32,115,101,116,116,105,110,103,32,107,101,121,32,102,111,114,32,82,78,71,0,88,57,46,51,49,32,82,78,71,32,99,111,114,101,32,102,117,110,99,116,105,111,110,32,102,97,105,108,101,100,0,82,78,71,32,111,117,116,112,117,116,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,107,110,111,119,110,32,118,97,108,117,101,0,102,111,114,107,32,100,101,116,101,99,116,105,111,110,32,102,97,105,108,101,100,0,114,97,110,100,111,109,0,75,65,84,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,83,121,115,116,101,109,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,83,121,115,116,101,109,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,98,117,102,102,101,114,0,114,97,110,100,111,109,45,115,121,115,116,101,109,46,99,0,103,101,116,95,114,97,110,100,111,109,0,101,114,114,111,114,32,114,101,97,100,105,110,103,32,114,97,110,100,111,109,32,102,114,111,109,32,115,121,115,116,101,109,32,82,78,71,32,40,114,99,61,37,100,41,10,0,115,121,115,116,101,109,95,114,110,103,95,105,115,95,108,111,99,107,101,100,0,114,101,97,100,95,99,98,0,114,101,97,100,95,99,98,95,98,117,102,102,101,114,0,47,100,101,118,47,114,97,110,100,111,109,0,47,100,101,118,47,117,114,97,110,100,111,109,0,110,101,101,100,95,101,110,116,114,111,112,121,0,115,101,108,101,99,116,40,41,32,101,114,114,111,114,58,32,37,115,10,0,98,111,103,117,115,32,114,101,97,100,32,102,114,111,109,32,114,97,110,100,111,109,32,100,101,118,105,99,101,32,40,110,61,37,100,41,10,0,114,101,97,100,32,101,114,114,111,114,32,111,110,32,114,97,110,100,111,109,32,100,101,118,105,99,101,58,32,37,115,10,0,111,112,101,110,95,100,101,118,95,114,97,110,100,111,109,0,119,97,105,116,95,100,101,118,95,114,97,110,100,111,109,0,99,97,110,39,116,32,111,112,101,110,32,37,115,58,32,37,115,10,0,101,114,114,111,114,32,115,101,116,116,105,110,103,32,70,68,95,67,76,79,69,88,69,67,32,111,110,32,102,100,32,37,100,58,32,37,115,10,0,99,104,111,111,115,105,110,103,32,97,32,114,97,110,100,111,109,32,107,32,111,102,32,37,117,32,98,105,116,115,32,97,116,32,115,101,99,108,101,118,101,108,32,37,100,10,0,9,107,32,116,111,111,32,108,97,114,103,101,32,45,32,97,103,97,105,110,10,0,9,107,32,105,115,32,122,101,114,111,32,45,32,97,103,97,105,110,10,0,1,0,101,99,100,115,97,32,115,105,103,110,32,104,97,115,104,32,32,0,101,99,100,115,97,32,115,105,103,110,32,114,101,115,117,108,116,32,114,32,0,101,99,100,115,97,32,115,105,103,110,32,114,101,115,117,108,116,32,115,32,0,103,111,115,116,32,115,105,103,110,32,104,97,115,104,32,32,0,101,99,99,32,115,105,103,110,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,103,111,115,116,32,115,105,103,110,32,114,101,115,117,108,116,32,114,32,0,103,111,115,116,32,115,105,103,110,32,114,101,115,117,108,116,32,115,32,0,101,99,99,32,118,101,114,105,102,121,58,32,82,101,106,101,99,116,101,100,10,0,101,99,99,32,118,101,114,105,102,121,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,32,32,32,32,32,120,0,32,32,32,32,32,114,0,32,32,32,32,32,115,0,101,99,99,32,118,101,114,105,102,121,58,32,78,111,116,32,118,101,114,105,102,105,101,100,10,0,101,99,99,32,118,101,114,105,102,121,58,32,65,99,99,101,112,116,101,100,10,0,33,34,108,111,99,107,32,65,66,73,32,118,101,114,115,105,111,110,34,0,112,111,115,105,120,45,108,111,99,107,46,99,0,103,101,116,95,108,111,99,107,95,111,98,106,101,99,116,0,33,115,116,114,101,97,109,45,62,102,108,97,103,115,46,119,114,105,116,105,110,103,0,101,115,116,114,101,97,109,46,99,0,101,115,95,101,109,112,116,121,0,115,116,114,101,97,109,45,62,102,108,97,103,115,46,119,114,105,116,105,110,103,0,101,115,95,102,108,117,115,104,0,83,117,99,99,101,115,115,0,71,101,110,101,114,97,108,32,101,114,114,111,114,0,85,110,107,110,111,119,110,32,112,97,99,107,101,116,0,85,110,107,110,111,119,110,32,118,101,114,115,105,111,110,32,105,110,32,112,97,99,107,101,116,0,73,110,118,97,108,105,100,32,112,117,98,108,105,99,32,107,101,121,32,97,108,103,111,114,105,116,104,109,0,73,110,118,97,108,105,100,32,100,105,103,101,115,116,32,97,108,103,111,114,105,116,104,109,0,66,97,100,32,112,117,98,108,105,99,32,107,101,121,0,66,97,100,32,115,101,99,114,101,116,32,107,101,121,0,66,97,100,32,115,105,103,110,97,116,117,114,101,0,78,111,32,112,117,98,108,105,99,32,107,101,121,0,67,104,101,99,107,115,117,109,32,101,114,114,111,114,0,66,97,100,32,112,97,115,115,112,104,114,97,115,101,0,73,110,118,97,108,105,100,32,99,105,112,104,101,114,32,97,108,103,111,114,105,116,104,109,0,75,101,121,114,105,110,103,32,111,112,101,110,0,73,110,118,97,108,105,100,32,112,97,99,107,101,116,0,73,110,118,97,108,105,100,32,97,114,109,111,114,0,78,111,32,117,115,101,114,32,73,68,0,78,111,32,115,101,99,114,101,116,32,107,101,121,0,87,114,111,110,103,32,115,101,99,114,101,116,32,107,101,121,32,117,115,101,100,0,66,97,100,32,115,101,115,115,105,111,110,32,107,101,121,0,85,110,107,110,111,119,110,32,99,111,109,112,114,101,115,115,105,111,110,32,97,108,103,111,114,105,116,104,109,0,78,117,109,98,101,114,32,105,115,32,110,111,116,32,112,114,105,109,101,0,73,110,118,97,108,105,100,32,101,110,99,111,100,105,110,103,32,109,101,116,104,111,100,0,73,110,118,97,108,105,100,32,101,110,99,114,121,112,116,105,111,110,32,115,99,104,101,109,101,0,73,110,118,97,108,105,100,32,115,105,103,110,97,116,117,114,101,32,115,99,104,101,109,101,0,73,110,118,97,108,105,100,32,97,116,116,114,105,98,117,116,101,0,78,111,32,118,97,108,117,101,0,78,111,116,32,102,111,117,110,100,0,86,97,108,117,101,32,110,111,116,32,102,111,117,110,100,0,83,121,110,116,97,120,32,101,114,114,111,114,0,66,97,100,32,77,80,73,32,118,97,108,117,101,0,73,110,118,97,108,105,100,32,112,97,115,115,112,104,114,97,115,101,0,73,110,118,97,108,105,100,32,115,105,103,110,97,116,117,114,101,32,99,108,97,115,115,0,82,101,115,111,117,114,99,101,115,32,101,120,104,97,117,115,116,101,100,0,73,110,118,97,108,105,100,32,107,101,121,114,105,110,103,0,84,114,117,115,116,32,68,66,32,101,114,114,111,114,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,0,73,110,118,97,108,105,100,32,117,115,101,114,32,73,68,0,85,110,101,120,112,101,99,116,101,100,32,101,114,114,111,114,0,84,105,109,101,32,99,111,110,102,108,105,99,116,0,75,101,121,115,101,114,118,101,114,32,101,114,114,111,114,0,87,114,111,110,103,32,112,117,98,108,105,99,32,107,101,121,32,97,108,103,111,114,105,116,104,109,0,84,114,105,98,117,116,101,32,116,111,32,68,46,32,65,46,0,87,101,97,107,32,101,110,99,114,121,112,116,105,111,110,32,107,101,121,0,73,110,118,97,108,105,100,32,107,101,121,32,108,101,110,103,116,104,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,83,121,110,116,97,120,32,101,114,114,111,114,32,105,110,32,85,82,73,0,73,110,118,97,108,105,100,32,85,82,73,0,78,101,116,119,111,114,107,32,101,114,114,111,114,0,85,110,107,110,111,119,110,32,104,111,115,116,0,83,101,108,102,116,101,115,116,32,102,97,105,108,101,100,0,68,97,116,97,32,110,111,116,32,101,110,99,114,121,112,116,101,100,0,68,97,116,97,32,110,111,116,32,112,114,111,99,101,115,115,101,100,0,85,110,117,115,97,98,108,101,32,112,117,98,108,105,99,32,107,101,121,0,85,110,117,115,97,98,108,101,32,115,101,99,114,101,116,32,107,101,121,0,73,110,118,97,108,105,100,32,118,97,108,117,101,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,99,104,97,105,110,0,77,105,115,115,105,110,103,32,99,101,114,116,105,102,105,99,97,116,101,0,78,111,32,100,97,116,97,0,66,117,103,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,73,110,118,97,108,105,100,32,111,112,101,114,97,116,105,111,110,32,99,111,100,101,0,84,105,109,101,111,117,116,0,73,110,116,101,114,110,97,108,32,101,114,114,111,114,0,69,79,70,32,40,103,99,114,121,112,116,41,0,73,110,118,97,108,105,100,32,111,98,106,101,99,116,0,80,114,111,118,105,100,101,100,32,111,98,106,101,99,116,32,105,115,32,116,111,111,32,115,104,111,114,116,0,80,114,111,118,105,100,101,100,32,111,98,106,101,99,116,32,105,115,32,116,111,111,32,108,97,114,103,101,0,77,105,115,115,105,110,103,32,105,116,101,109,32,105,110,32,111,98,106,101,99,116,0,78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,67,111,110,102,108,105,99,116,105,110,103,32,117,115,101,0,73,110,118,97,108,105,100,32,99,105,112,104,101,114,32,109,111,100,101,0,73,110,118,97,108,105,100,32,102,108,97,103,0,73,110,118,97,108,105,100,32,104,97,110,100,108,101,0,82,101,115,117,108,116,32,116,114,117,110,99,97,116,101,100,0,73,110,99,111,109,112,108,101,116,101,32,108,105,110,101,0,73,110,118,97,108,105,100,32,114,101,115,112,111,110,115,101,0,78,111,32,97,103,101,110,116,32,114,117,110,110,105,110,103,0,65,103,101,110,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,100,97,116,97,0,85,110,115,112,101,99,105,102,105,99,32,65,115,115,117,97,110,32,115,101,114,118,101,114,32,102,97,117,108,116,0,71,101,110,101,114,97,108,32,65,115,115,117,97,110,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,115,101,115,115,105,111,110,32,107,101,121,0,73,110,118,97,108,105,100,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,115,117,112,112,111,114,116,101,100,32,97,108,103,111,114,105,116,104,109,0,78,111,32,112,105,110,101,110,116,114,121,0,112,105,110,101,110,116,114,121,32,101,114,114,111,114,0,66,97,100,32,80,73,78,0,73,110,118,97,108,105,100,32,110,97,109,101,0,66,97,100,32,100,97,116,97,0,73,110,118,97,108,105,100,32,112,97,114,97,109,101,116,101,114,0,87,114,111,110,103,32,99,97,114,100,0,78,111,32,100,105,114,109,110,103,114,0,100,105,114,109,110,103,114,32,101,114,114,111,114,0,67,101,114,116,105,102,105,99,97,116,101,32,114,101,118,111,107,101,100,0,78,111,32,67,82,76,32,107,110,111,119,110,0,67,82,76,32,116,111,111,32,111,108,100,0,76,105,110,101,32,116,111,111,32,108,111,110,103,0,78,111,116,32,116,114,117,115,116,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,108,101,100,0,66,97,100,32,67,65,32,99,101,114,116,105,102,105,99,97,116,101,0,67,101,114,116,105,102,105,99,97,116,101,32,101,120,112,105,114,101,100,0,67,101,114,116,105,102,105,99,97,116,101,32,116,111,111,32,121,111,117,110,103,0,85,110,115,117,112,112,111,114,116,101,100,32,99,101,114,116,105,102,105,99,97,116,101,0,85,110,107,110,111,119,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,115,117,112,112,111,114,116,101,100,32,112,114,111,116,101,99,116,105,111,110,0,67,111,114,114,117,112,116,101,100,32,112,114,111,116,101,99,116,105,111,110,0,65,109,98,105,103,117,111,117,115,32,110,97,109,101,0,67,97,114,100,32,101,114,114,111,114,0,67,97,114,100,32,114,101,115,101,116,32,114,101,113,117,105,114,101,100,0,67,97,114,100,32,114,101,109,111,118,101,100,0,73,110,118,97,108,105,100,32,99,97,114,100,0,67,97,114,100,32,110,111,116,32,112,114,101,115,101,110,116,0,78,111,32,80,75,67,83,49,53,32,97,112,112,108,105,99,97,116,105,111,110,0,78,111,116,32,99,111,110,102,105,114,109,101,100,0,67,111,110,102,105,103,117,114,97,116,105,111,110,32,101,114,114,111,114,0,78,111,32,112,111,108,105,99,121,32,109,97,116,99,104,0,73,110,118,97,108,105,100,32,105,110,100,101,120,0,73,110,118,97,108,105,100,32,73,68,0,78,111,32,83,109,97,114,116,67,97,114,100,32,100,97,101,109,111,110,0,83,109,97,114,116,67,97,114,100,32,100,97,101,109,111,110,32,101,114,114,111,114,0,85,110,115,117,112,112,111,114,116,101,100,32,112,114,111,116,111,99,111,108,0,66,97,100,32,80,73,78,32,109,101,116,104,111,100,0,67,97,114,100,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,0,85,110,115,117,112,112,111,114,116,101,100,32,111,112,101,114,97,116,105,111,110,0,87,114,111,110,103,32,107,101,121,32,117,115,97,103,101,0,78,111,116,104,105,110,103,32,102,111,117,110,100,0,87,114,111,110,103,32,98,108,111,98,32,116,121,112,101,0,77,105,115,115,105,110,103,32,118,97,108,117,101,0,72,97,114,100,119,97,114,101,32,112,114,111,98,108,101,109,0,80,73,78,32,98,108,111,99,107,101,100,0,67,111,110,100,105,116,105,111,110,115,32,111,102,32,117,115,101,32,110,111,116,32,115,97,116,105,115,102,105,101,100,0,80,73,78,115,32,97,114,101,32,110,111,116,32,115,121,110,99,101,100,0,73,110,118,97,108,105,100,32,67,82,76,0,66,69,82,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,66,69,82,0,69,108,101,109,101,110,116,32,110,111,116,32,102,111,117,110,100,0,73,100,101,110,116,105,102,105,101,114,32,110,111,116,32,102,111,117,110,100,0,73,110,118,97,108,105,100,32,116,97,103,0,73,110,118,97,108,105,100,32,108,101,110,103,116,104,0,73,110,118,97,108,105,100,32,107,101,121,32,105,110,102,111,0,85,110,101,120,112,101,99,116,101,100,32,116,97,103,0,78,111,116,32,68,69,82,32,101,110,99,111,100,101,100,0,78,111,32,67,77,83,32,111,98,106,101,99,116,0,73,110,118,97,108,105,100,32,67,77,83,32,111,98,106,101,99,116,0,85,110,107,110,111,119,110,32,67,77,83,32,111,98,106,101,99,116,0,85,110,115,117,112,112,111,114,116,101,100,32,67,77,83,32,111,98,106,101,99,116,0,85,110,115,117,112,112,111,114,116,101,100,32,101,110,99,111,100,105,110,103,0,85,110,115,117,112,112,111,114,116,101,100,32,67,77,83,32,118,101,114,115,105,111,110,0,85,110,107,110,111,119,110,32,97,108,103,111,114,105,116,104,109,0,73,110,118,97,108,105,100,32,99,114,121,112,116,111,32,101,110,103,105,110,101,0,80,117,98,108,105,99,32,107,101,121,32,110,111,116,32,116,114,117,115,116,101,100,0,68,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,0,75,101,121,32,101,120,112,105,114,101,100,0,83,105,103,110,97,116,117,114,101,32,101,120,112,105,114,101,100,0,69,110,99,111,100,105,110,103,32,112,114,111,98,108,101,109,0,73,110,118,97,108,105,100,32,115,116,97,116,101,0,68,117,112,108,105,99,97,116,101,100,32,118,97,108,117,101,0,77,105,115,115,105,110,103,32,97,99,116,105,111,110,0,65,83,78,46,49,32,109,111,100,117,108,101,32,110,111,116,32,102,111,117,110,100,0,73,110,118,97,108,105,100,32,79,73,68,32,115,116,114,105,110,103,0,73,110,118,97,108,105,100,32,116,105,109,101,0,73,110,118,97,108,105,100,32,67,82,76,32,111,98,106,101,99,116,0,85,110,115,117,112,112,111,114,116,101,100,32,67,82,76,32,118,101,114,115,105,111,110,0,73,110,118,97,108,105,100,32,99,101,114,116,105,102,105,99,97,116,101,32,111,98,106,101,99,116,0,85,110,107,110,111,119,110,32,110,97,109,101,0,65,32,108,111,99,97,108,101,32,102,117,110,99,116,105,111,110,32,102,97,105,108,101,100,0,78,111,116,32,108,111,99,107,101,100,0,80,114,111,116,111,99,111,108,32,118,105,111,108,97,116,105,111,110,0,73,110,118,97,108,105,100,32,77,65,67,0,73,110,118,97,108,105,100,32,114,101,113,117,101,115,116,0,85,110,107,110,111,119,110,32,101,120,116,101,110,115,105,111,110,0,85,110,107,110,111,119,110,32,99,114,105,116,105,99,97,108,32,101,120,116,101,110,115,105,111,110,0,76,111,99,107,101,100,0,85,110,107,110,111,119,110,32,111,112,116,105,111,110,0,85,110,107,110,111,119,110,32,99,111,109,109,97,110,100,0,78,111,116,32,111,112,101,114,97,116,105,111,110,97,108,0,78,111,32,112,97,115,115,112,104,114,97,115,101,32,103,105,118,101,110,0,78,111,32,80,73,78,32,103,105,118,101,110,0,78,111,116,32,101,110,97,98,108,101,100,0,78,111,32,99,114,121,112,116,111,32,101,110,103,105,110,101,0,77,105,115,115,105,110,103,32,107,101,121,0,84,111,111,32,109,97,110,121,32,111,98,106,101,99,116,115,0,76,105,109,105,116,32,114,101,97,99,104,101,100,0,78,111,116,32,105,110,105,116,105,97,108,105,122,101,100,0,77,105,115,115,105,110,103,32,105,115,115,117,101,114,32,99,101,114,116,105,102,105,99,97,116,101,0,78,111,32,107,101,121,115,101,114,118,101,114,32,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,101,108,108,105,112,116,105,99,32,99,117,114,118,101,0,85,110,107,110,111,119,110,32,101,108,108,105,112,116,105,99,32,99,117,114,118,101,0,68,117,112,108,105,99,97,116,101,100,32,107,101,121,0,65,109,98,105,103,117,111,117,115,32,114,101,115,117,108,116,0,78,111,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,87,114,111,110,103,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,66,97,100,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,67,111,110,102,108,105,99,116,32,105,110,32,116,104,101,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,66,114,111,107,101,110,32,112,117,98,108,105,99,32,107,101,121,0,66,114,111,107,101,110,32,115,101,99,114,101,116,32,107,101,121,0,73,110,118,97,108,105,100,32,77,65,67,32,97,108,103,111,114,105,116,104,109,0,79,112,101,114,97,116,105,111,110,32,102,117,108,108,121,32,99,97,110,99,101,108,108,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,121,101,116,32,102,105,110,105,115,104,101,100,0,66,117,102,102,101,114,32,116,111,111,32,115,104,111,114,116,0,73,110,118,97,108,105,100,32,108,101,110,103,116,104,32,115,112,101,99,105,102,105,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,83,116,114,105,110,103,32,116,111,111,32,108,111,110,103,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,109,97,116,99,104,101,100,32,112,97,114,101,110,116,104,101,115,101,115,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,83,45,101,120,112,114,101,115,115,105,111,110,32,110,111,116,32,99,97,110,111,110,105,99,97,108,0,66,97,100,32,99,104,97,114,97,99,116,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,66,97,100,32,113,117,111,116,97,116,105,111,110,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,90,101,114,111,32,112,114,101,102,105,120,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,78,101,115,116,101,100,32,100,105,115,112,108,97,121,32,104,105,110,116,115,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,109,97,116,99,104,101,100,32,100,105,115,112,108,97,121,32,104,105,110,116,115,0,85,110,101,120,112,101,99,116,101,100,32,114,101,115,101,114,118,101,100,32,112,117,110,99,116,117,97,116,105,111,110,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,66,97,100,32,104,101,120,97,100,101,99,105,109,97,108,32,99,104,97,114,97,99,116,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,79,100,100,32,104,101,120,97,100,101,99,105,109,97,108,32,110,117,109,98,101,114,115,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,66,97,100,32,111,99,116,97,108,32,99,104,97,114,97,99,116,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,76,101,103,97,99,121,32,107,101,121,0,82,101,113,117,101,115,116,32,116,111,111,32,115,104,111,114,116,0,82,101,113,117,101,115,116,32,116,111,111,32,108,111,110,103,0,79,98,106,101,99,116,32,105,115,32,105,110,32,116,101,114,109,105,110,97,116,105,111,110,32,115,116,97,116,101,0,78,111,32,99,101,114,116,105,102,105,99,97,116,101,32,99,104,97,105,110,0,67,101,114,116,105,102,105,99,97,116,101,32,105,115,32,116,111,111,32,108,97,114,103,101,0,73,110,118,97,108,105,100,32,114,101,99,111,114,100,0,84,104,101,32,77,65,67,32,100,111,101,115,32,110,111,116,32,118,101,114,105,102,121,0,85,110,101,120,112,101,99,116,101,100,32,109,101,115,115,97,103,101,0,67,111,109,112,114,101,115,115,105,111,110,32,111,114,32,100,101,99,111,109,112,114,101,115,115,105,111,110,32,102,97,105,108,101,100,0,65,32,99,111,117,110,116,101,114,32,119,111,117,108,100,32,119,114,97,112,0,70,97,116,97,108,32,97,108,101,114,116,32,109,101,115,115,97,103,101,32,114,101,99,101,105,118,101,100,0,78,111,32,99,105,112,104,101,114,32,97,108,103,111,114,105,116,104,109,0,77,105,115,115,105,110,103,32,99,108,105,101,110,116,32,99,101,114,116,105,102,105,99,97,116,101,0,67,108,111,115,101,32,110,111,116,105,102,105,99,97,116,105,111,110,32,114,101,99,101,105,118,101,100,0,84,105,99,107,101,116,32,101,120,112,105,114,101,100,0,66,97,100,32,116,105,99,107,101,116,0,85,110,107,110,111,119,110,32,105,100,101,110,116,105,116,121,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,114,101,113,117,101,115,116,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,118,101,114,105,102,121,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,104,97,110,103,101,32,99,105,112,104,101,114,32,109,101,115,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,108,105,101,110,116,32,104,101,108,108,111,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,115,101,114,118,101,114,32,104,101,108,108,111,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,115,101,114,118,101,114,32,104,101,108,108,111,32,100,111,110,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,115,104,97,107,101,0,66,97,100,32,102,105,110,105,115,104,101,100,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,115,101,114,118,101,114,32,107,101,121,32,101,120,99,104,97,110,103,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,108,105,101,110,116,32,107,101,121,32,101,120,99,104,97,110,103,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,111,103,117,115,32,115,116,114,105,110,103,0,70,111,114,98,105,100,100,101,110,0,75,101,121,32,100,105,115,97,98,108,101,100,0,78,111,116,32,112,111,115,115,105,98,108,101,32,119,105,116,104,32,97,32,99,97,114,100,32,98,97,115,101,100,32,107,101,121,0,73,110,118,97,108,105,100,32,108,111,99,107,32,111,98,106,101,99,116,0,71,101,110,101,114,97,108,32,73,80,67,32,101,114,114,111,114,0,73,80,67,32,97,99,99,101,112,116,32,99,97,108,108,32,102,97,105,108,101,100,0,73,80,67,32,99,111,110,110,101,99,116,32,99,97,108,108,32,102,97,105,108,101,100,0,73,110,118,97,108,105,100,32,73,80,67,32,114,101,115,112,111,110,115,101,0,73,110,118,97,108,105,100,32,118,97,108,117,101,32,112,97,115,115,101,100,32,116,111,32,73,80,67,0,73,110,99,111,109,112,108,101,116,101,32,108,105,110,101,32,112,97,115,115,101,100,32,116,111,32,73,80,67,0,76,105,110,101,32,112,97,115,115,101,100,32,116,111,32,73,80,67,32,116,111,111,32,108,111,110,103,0,78,101,115,116,101,100,32,73,80,67,32,99,111,109,109,97,110,100,115,0,78,111,32,100,97,116,97,32,99,97,108,108,98,97,99,107,32,105,110,32,73,80,67,0,78,111,32,105,110,113,117,105,114,101,32,99,97,108,108,98,97,99,107,32,105,110,32,73,80,67,0,78,111,116,32,97,110,32,73,80,67,32,115,101,114,118,101,114,0,78,111,116,32,97,110,32,73,80,67,32,99,108,105,101,110,116,0,80,114,111,98,108,101,109,32,115,116,97,114,116,105,110,103,32,73,80,67,32,115,101,114,118,101,114,0,73,80,67,32,114,101,97,100,32,101,114,114,111,114,0,73,80,67,32,119,114,105,116,101,32,101,114,114,111,114,0,84,111,111,32,109,117,99,104,32,100,97,116,97,32,102,111,114,32,73,80,67,32,108,97,121,101,114,0,85,110,101,120,112,101,99,116,101,100,32,73,80,67,32,99,111,109,109,97,110,100,0,85,110,107,110,111,119,110,32,73,80,67,32,99,111,109,109,97,110,100,0,73,80,67,32,115,121,110,116,97,120,32,101,114,114,111,114,0,73,80,67,32,99,97,108,108,32,104,97,115,32,98,101,101,110,32,99,97,110,99,101,108,108,101,100,0,78,111,32,105,110,112,117,116,32,115,111,117,114,99,101,32,102,111,114,32,73,80,67,0,78,111,32,111,117,116,112,117,116,32,115,111,117,114,99,101,32,102,111,114,32,73,80,67,0,73,80,67,32,112,97,114,97,109,101,116,101,114,32,101,114,114,111,114,0,85,110,107,110,111,119,110,32,73,80,67,32,105,110,113,117,105,114,101,0,71,101,110,101,114,97,108,32,76,68,65,80,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,97,116,116,114,105,98,117,116,101,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,110,97,109,101,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,115,101,99,117,114,105,116,121,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,115,101,114,118,105,99,101,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,117,112,100,97,116,101,32,101,114,114,111,114,0,69,120,112,101,114,105,109,101,110,116,97,108,32,76,68,65,80,32,101,114,114,111,114,32,99,111,100,101,0,80,114,105,118,97,116,101,32,76,68,65,80,32,101,114,114,111,114,32,99,111,100,101,0,79,116,104,101,114,32,103,101,110,101,114,97,108,32,76,68,65,80,32,101,114,114,111,114,0,76,68,65,80,32,99,111,110,110,101,99,116,105,110,103,32,102,97,105,108,101,100,32,40,88,41,0,76,68,65,80,32,114,101,102,101,114,114,97,108,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,0,76,68,65,80,32,99,108,105,101,110,116,32,108,111,111,112,0,78,111,32,76,68,65,80,32,114,101,115,117,108,116,115,32,114,101,116,117,114,110,101,100,0,76,68,65,80,32,99,111,110,116,114,111,108,32,110,111,116,32,102,111,117,110,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,76,68,65,80,0,76,68,65,80,32,99,111,110,110,101,99,116,32,101,114,114,111,114,0,79,117,116,32,111,102,32,109,101,109,111,114,121,32,105,110,32,76,68,65,80,0,66,97,100,32,112,97,114,97,109,101,116,101,114,32,116,111,32,97,110,32,76,68,65,80,32,114,111,117,116,105,110,101,0,85,115,101,114,32,99,97,110,99,101,108,108,101,100,32,76,68,65,80,32,111,112,101,114,97,116,105,111,110,0,66,97,100,32,76,68,65,80,32,115,101,97,114,99,104,32,102,105,108,116,101,114,0,85,110,107,110,111,119,110,32,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,32,109,101,116,104,111,100,0,84,105,109,101,111,117,116,32,105,110,32,76,68,65,80,0,76,68,65,80,32,100,101,99,111,100,105,110,103,32,101,114,114,111,114,0,76,68,65,80,32,101,110,99,111,100,105,110,103,32,101,114,114,111,114,0,76,68,65,80,32,108,111,99,97,108,32,101,114,114,111,114,0,67,97,110,110,111,116,32,99,111,110,116,97,99,116,32,76,68,65,80,32,115,101,114,118,101,114,0,76,68,65,80,32,115,117,99,99,101,115,115,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,115,32,101,114,114,111,114,0,76,68,65,80,32,112,114,111,116,111,99,111,108,32,101,114,114,111,114,0,84,105,109,101,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,32,105,110,32,76,68,65,80,0,83,105,122,101,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,32,105,110,32,76,68,65,80,0,76,68,65,80,32,99,111,109,112,97,114,101,32,102,97,108,115,101,0,76,68,65,80,32,99,111,109,112,97,114,101,32,116,114,117,101,0,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,32,109,101,116,104,111,100,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,116,114,111,110,103,40,101,114,41,32,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,32,114,101,113,117,105,114,101,100,0,80,97,114,116,105,97,108,32,76,68,65,80,32,114,101,115,117,108,116,115,43,114,101,102,101,114,114,97,108,32,114,101,99,101,105,118,101,100,0,76,68,65,80,32,114,101,102,101,114,114,97,108,0,65,100,109,105,110,105,115,116,114,97,116,105,118,101,32,76,68,65,80,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,0,67,114,105,116,105,99,97,108,32,76,68,65,80,32,101,120,116,101,110,115,105,111,110,32,105,115,32,117,110,97,118,97,105,108,97,98,108,101,0,67,111,110,102,105,100,101,110,116,105,97,108,105,116,121,32,114,101,113,117,105,114,101,100,32,98,121,32,76,68,65,80,0,76,68,65,80,32,83,65,83,76,32,98,105,110,100,32,105,110,32,112,114,111,103,114,101,115,115,0,78,111,32,115,117,99,104,32,76,68,65,80,32,97,116,116,114,105,98,117,116,101,0,85,110,100,101,102,105,110,101,100,32,76,68,65,80,32,97,116,116,114,105,98,117,116,101,32,116,121,112,101,0,73,110,97,112,112,114,111,112,114,105,97,116,101,32,109,97,116,99,104,105,110,103,32,105,110,32,76,68,65,80,0,67,111,110,115,116,114,97,105,110,116,32,118,105,111,108,97,116,105,111,110,32,105,110,32,76,68,65,80,0,76,68,65,80,32,116,121,112,101,32,111,114,32,118,97,108,117,101,32,101,120,105,115,116,115,0,73,110,118,97,108,105,100,32,115,121,110,116,97,120,32,105,110,32,76,68,65,80,0,78,111,32,115,117,99,104,32,76,68,65,80,32,111,98,106,101,99,116,0,76,68,65,80,32,97,108,105,97,115,32,112,114,111,98,108,101,109,0,73,110,118,97,108,105,100,32,68,78,32,115,121,110,116,97,120,32,105,110,32,76,68,65,80,0,76,68,65,80,32,101,110,116,114,121,32,105,115,32,97,32,108,101,97,102,0,76,68,65,80,32,97,108,105,97,115,32,100,101,114,101,102,101,114,101,110,99,105,110,103,32,112,114,111,98,108,101,109,0,76,68,65,80,32,112,114,111,120,121,32,97,117,116,104,111,114,105,122,97,116,105,111,110,32,102,97,105,108,117,114,101,32,40,88,41,0,73,110,97,112,112,114,111,112,114,105,97,116,101,32,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,0,73,110,118,97,108,105,100,32,76,68,65,80,32,99,114,101,100,101,110,116,105,97,108,115,0,73,110,115,117,102,102,105,99,105,101,110,116,32,97,99,99,101,115,115,32,102,111,114,32,76,68,65,80,0,76,68,65,80,32,115,101,114,118,101,114,32,105,115,32,98,117,115,121,0,76,68,65,80,32,115,101,114,118,101,114,32,105,115,32,117,110,97,118,97,105,108,97,98,108,101,0,76,68,65,80,32,115,101,114,118,101,114,32,105,115,32,117,110,119,105,108,108,105,110,103,32,116,111,32,112,101,114,102,111,114,109,0,76,111,111,112,32,100,101,116,101,99,116,101,100,32,98,121,32,76,68,65,80,0,76,68,65,80,32,110,97,109,105,110,103,32,118,105,111,108,97,116,105,111,110,0,76,68,65,80,32,111,98,106,101,99,116,32,99,108,97,115,115,32,118,105,111,108,97,116,105,111,110,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,110,111,116,32,97,108,108,111,119,101,100,32,111,110,32,110,111,110,45,108,101,97,102,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,110,111,116,32,97,108,108,111,119,101,100,32,111,110,32,82,68,78,0,65,108,114,101,97,100,121,32,101,120,105,115,116,115,32,40,76,68,65,80,41,0,67,97,110,110,111,116,32,109,111,100,105,102,121,32,76,68,65,80,32,111,98,106,101,99,116,32,99,108,97,115,115,0,76,68,65,80,32,114,101,115,117,108,116,115,32,116,111,111,32,108,97,114,103,101,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,97,102,102,101,99,116,115,32,109,117,108,116,105,112,108,101,32,68,83,65,115,0,86,105,114,116,117,97,108,32,76,68,65,80,32,108,105,115,116,32,118,105,101,119,32,101,114,114,111,114,0,79,116,104,101,114,32,76,68,65,80,32,101,114,114,111,114,0,82,101,115,111,117,114,99,101,115,32,101,120,104,97,117,115,116,101,100,32,105,110,32,76,67,85,80,0,83,101,99,117,114,105,116,121,32,118,105,111,108,97,116,105,111,110,32,105,110,32,76,67,85,80,0,73,110,118,97,108,105,100,32,100,97,116,97,32,105,110,32,76,67,85,80,0,85,110,115,117,112,112,111,114,116,101,100,32,115,99,104,101,109,101,32,105,110,32,76,67,85,80,0,82,101,108,111,97,100,32,114,101,113,117,105,114,101,100,32,105,110,32,76,67,85,80,0,76,68,65,80,32,99,97,110,99,101,108,108,101,100,0,78,111,32,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,116,111,32,99,97,110,99,101,108,0,84,111,111,32,108,97,116,101,32,116,111,32,99,97,110,99,101,108,32,76,68,65,80,0,67,97,110,110,111,116,32,99,97,110,99,101,108,32,76,68,65,80,0,76,68,65,80,32,97,115,115,101,114,116,105,111,110,32,102,97,105,108,101,100,0,80,114,111,120,105,101,100,32,97,117,116,104,111,114,105,122,97,116,105,111,110,32,100,101,110,105,101,100,32,98,121,32,76,68,65,80,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,50,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,51,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,52,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,53,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,54,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,55,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,56,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,57,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,48,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,49,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,50,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+51200);allocate([101,32,49,51,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,52,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,53,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,54,0,83,121,115,116,101,109,32,101,114,114,111,114,32,119,47,111,32,101,114,114,110,111,0,85,110,107,110,111,119,110,32,115,121,115,116,101,109,32,101,114,114,111,114,0,69,110,100,32,111,102,32,102,105,108,101,0,85,110,107,110,111,119,110,32,101,114,114,111,114,32,99,111,100,101,0,97,109,111,117,110,116,46,99,0,84,65,76,69,82,95,97,109,111,117,110,116,95,99,109,112,0,84,65,76,69,82,95,97,109,111,117,110,116,95,115,117,98,116,114,97,99,116,0,84,65,76,69,82,95,97,109,111,117,110,116,95,97,100,100,0,49,46,54,46,49,0,108,105,98,103,99,114,121,112,116,32,118,101,114,115,105,111,110,32,109,105,115,109,97,116,99,104,10,0,70,97,116,97,108,32,101,114,114,111,114,32,105,110,32,108,105,98,103,99,114,121,112,116,58,32,37,115,10,0,99,114,121,112,116,111,46,99,0,65,115,115,101,114,116,105,111,110,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,46,10,0,116,97,108,101,114,45,99,111,105,110,45,100,101,114,105,118,97,116,105,111,110,0,84,65,76,69,82,95,115,101,116,117,112,95,102,114,101,115,104,95,99,111,105,110,0,18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40,41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67,68,69,70,71,72,73,16,16,16,74,75,76,77,78,16,16,16,79,80,16,16,16,16,81,16,16,16,16,16,16,16,16,16,17,17,17,82,83,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,84,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,85,16,16,16,16,86,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,87,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,88,89,90,91,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,92,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254,255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,195,255,3,0,31,80,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,223,60,64,215,255,255,251,255,255,255,255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,254,255,255,255,127,2,254,255,255,255,255,0,0,0,0,0,255,191,182,0,255,255,255,7,7,0,0,0,255,7,255,255,255,255,255,255,255,254,255,195,255,255,255,255,255,255,255,255,255,255,255,255,239,31,254,225,255,159,0,0,255,255,255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255,255,255,3,0,255,255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255,1,0,0,0,0,0,0,0,0,253,31,0,0,0,0,0,0,240,3,255,127,255,255,255,255,255,255,255,239,255,223,225,255,207,255,254,254,238,159,249,255,255,253,197,227,159,89,128,176,207,255,3,0,238,135,249,255,255,253,109,195,135,25,2,94,192,255,63,0,238,191,251,255,255,253,237,227,191,27,1,0,207,255,0,0,238,159,249,255,255,253,237,227,159,25,192,176,207,255,2,0,236,199,61,214,24,199,255,195,199,29,129,0,192,255,0,0,238,223,253,255,255,253,239,227,223,29,96,3,207,255,0,0,236,223,253,255,255,253,239,227,223,29,96,64,207,255,6,0,236,223,253,255,255,255,255,231,223,93,128,0,207,255,0,252,236,255,127,252,255,255,251,47,127,128,95,255,0,0,12,0,254,255,255,255,255,127,255,7,63,32,255,3,0,0,0,0,150,37,240,254,174,236,255,59,95,32,255,243,0,0,0,0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,255,255,254,255,255,255,31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,255,3,255,255,231,193,255,255,127,64,255,51,255,255,255,255,191,32,255,255,255,255,255,247,255,255,255,255,255,255,255,255,255,61,127,61,255,255,255,255,255,61,255,255,255,255,61,127,61,255,127,255,255,255,255,255,255,255,61,255,255,255,255,255,255,255,255,135,0,0,0,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,31,0,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,159,255,255,254,255,255,7,255,255,255,255,255,255,255,255,255,199,1,0,255,223,15,0,255,255,15,0,255,255,15,0,255,223,13,0,255,255,255,255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,3,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,7,255,255,255,255,255,255,255,255,63,0,255,255,255,31,255,15,255,1,192,255,255,255,255,63,31,0,255,255,255,255,255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,255,255,255,255,255,255,127,254,255,31,0,255,3,255,3,128,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,243,255,255,255,255,255,255,191,255,3,0,255,255,255,255,255,255,63,0,255,227,255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,222,111,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,255,255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,243,224,67,0,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,0,255,255,255,255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255,255,255,255,255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127,255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254,255,255,255,255,255,255,255,255,255,255,247,224,255,255,255,255,63,254,255,255,255,255,255,255,255,255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,255,255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255,255,127,240,143,255,255,255,128,255,255,255,255,255,255,255,255,255,255,0,0,0,0,128,255,252,255,255,255,255,255,255,255,255,255,255,255,255,121,15,0,255,7,0,0,0,0,0,0,0,0,0,255,187,247,255,255,255,0,0,0,255,255,255,255,255,255,15,0,255,255,255,255,255,255,255,255,15,0,255,3,0,0,252,8,255,255,255,255,255,7,255,255,255,255,7,0,255,255,255,31,255,255,255,255,255,255,247,255,0,128,255,3,0,0,0,0,255,255,255,255,255,255,127,0,255,63,255,3,255,255,127,4,255,255,255,255,255,255,255,127,5,0,0,56,255,255,60,0,126,126,126,0,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,255,255,15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,95,219,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,255,255,252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,255,3,254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,255,127,252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0,0,255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255,255,63,255,255,255,255,15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,3,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,145,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,63,0,255,255,255,3,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,239,254,255,255,15,0,0,0,0,0,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,63,0,0,0,192,255,0,0,252,255,255,255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,255,255,255,255,199,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,30,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,63,0,255,3,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,31,0,255,255,255,255,255,127,0,0,248,255,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,255,255,255,223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,255,123,95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,253,255,255,247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,255,253,255,255,255,253,255,255,247,207,255,255,255,255,255,255,239,255,255,255,150,254,247,10,132,234,150,170,150,247,247,94,255,251,255,15,238,251,255,15,0,0,0,0,0,0,0,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0,18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,16,16,34,35,16,36,37,38,39,40,41,42,43,16,44,45,46,17,47,48,17,17,49,17,17,17,50,51,52,53,54,55,56,57,17,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,58,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,59,16,60,61,62,63,64,65,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,66,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,67,16,16,68,16,69,70,71,16,72,16,73,16,16,16,16,74,75,76,77,16,16,78,16,79,80,16,16,16,16,81,16,16,16,16,16,16,16,16,16,16,16,16,16,82,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,83,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,84,85,86,87,16,16,88,89,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,90,16,91,92,93,94,95,96,97,98,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,254,255,0,252,1,0,0,248,1,0,0,120,0,0,0,0,255,251,223,251,0,0,128,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,252,255,224,175,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,32,64,176,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,134,254,255,255,255,0,64,73,0,0,0,0,0,24,0,223,255,0,200,0,0,0,0,0,0,0,1,0,60,0,0,0,0,0,0,0,0,0,0,0,0,16,224,1,30,0,96,255,191,0,0,0,0,0,0,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,207,3,0,0,0,3,0,32,255,127,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,0,0,0,16,0,32,30,0,48,0,1,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,252,15,0,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,3,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,253,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,255,7,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,255,0,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,63,2,0,0,0,0,0,0,0,0,0,4,0,0,0,0,16,0,0,0,0,0,0,128,0,128,192,223,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,254,255,255,255,0,252,255,255,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,192,255,223,255,7,0,0,0,0,0,0,0,0,0,0,128,6,0,252,0,0,24,62,0,0,128,191,0,204,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,96,255,255,255,31,0,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,1,0,0,24,0,0,0,0,0,0,0,0,0,56,0,0,0,0,16,0,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,254,127,47,0,0,255,3,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,196,255,255,255,255,0,0,0,192,0,0,0,0,0,0,0,0,1,0,224,159,0,0,0,0,127,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,16,0,0,252,255,255,255,31,0,0,0,0,0,12,0,0,0,0,0,0,64,0,12,240,0,0,0,0,0,0,192,248,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,255,0,255,255,255,33,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,127,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,3,224,0,224,0,224,0,96,128,248,255,255,255,252,255,255,255,255,255,127,31,252,241,127,255,127,0,0,255,255,255,3,0,0,255,255,255,255,1,0,123,3,208,193,175,66,0,12,31,188,255,255,0,0,0,0,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,255,255,255,127,0,0,0,255,7,0,0,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,252,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,135,3,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,127,255,15,0,0,0,0,0,0,0,0,255,255,255,251,255,255,255,255,255,255,255,255,255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,255,15,30,255,255,255,1,252,193,224,0,0,0,0,0,0,0,0,0,0,0,30,1,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,255,255,255,255,15,0,0,0,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,0,0,0,0,0,192,0,224,0,0,0,0,0,0,0,0,0,0,0,128,15,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,255,127,0,3,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,8,0,0,0,15,255,3,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,16,192,0,0,255,255,3,7,0,0,0,0,0,248,0,0,0,0,8,128,0,0,0,0,0,0,0,0,0,0,8,0,255,63,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0,0,128,11,0,0,0,0,0,0,0,128,2,0,0,192,0,0,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,255,255,3,127,0,255,255,255,255,247,255,127,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,254,255,0,252,1,0,0,248,1,0,0,248,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,0,48,135,255,255,255,255,255,143,255,0,0,0,0,0,0,224,255,255,7,255,15,0,0,0,0,0,0,255,255,255,255,255,63,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,143,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,255,0,255,1,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,63,252,255,63,0,0,0,3,0,0,0,0,0,0,254,3,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,255,255,255,255,127,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,127,0,255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,8,0,0,0,8,0,0,32,0,0,0,32,0,0,128,0,0,0,128,0,0,0,2,0,0,0,2,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,255,255,255,255,255,15,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,127,254,127,254,255,254,255,0,0,0,0,255,7,255,255,255,127,255,255,255,255,255,255,255,15,255,255,255,255,255,7,0,0,0,0,0,0,0,0,192,255,255,255,7,0,255,255,255,255,255,7,255,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,191,255,255,255,255,255,255,255,255,31,255,255,15,0,255,255,255,255,223,7,0,0,255,255,1,0,255,255,255,255,255,255,255,127,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,30,255,255,255,255,255,255,255,63,15,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,255,255,255,255,255,255,255,255,225,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,255,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,4,7,3,6,5,0,114,119,97,0,47,112,114,111,99,47,115,101,108,102,47,102,100,47,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+61440);var tempDoublePtr=STATICTOP;STATICTOP+=16;assert(tempDoublePtr%8==0);var PROCINFO={ppid:1,pid:42,sid:42,pgid:42};var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var ERRNO_MESSAGES={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;else Module.printErr("failed to set errno from JS");return value}var PATH={splitPath:(function(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)}),normalizeArray:(function(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}),normalize:(function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter((function(p){return!!p})),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path}),dirname:(function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir}),basename:(function(path){if(path==="/")return"/";var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)}),extname:(function(path){return PATH.splitPath(path)[3]}),join:(function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))}),join2:(function(l,r){return PATH.normalize(l+"/"+r)}),resolve:(function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter((function(p){return!!p})),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."}),relative:(function(from,to){from=PATH.resolve(from).substr(1);to=PATH.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()}),put_char:(function(tty,val){if(val===null||val===10){Module["print"](UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}}),flush:(function(tty){if(tty.output&&tty.output.length>0){Module["print"](UTF8ArrayToString(tty.output,0));tty.output=[]}})},default_tty1_ops:{put_char:(function(tty,val){if(val===null||val===10){Module["printErr"](UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}}),flush:(function(tty){if(tty.output&&tty.output.length>0){Module["printErr"](UTF8ArrayToString(tty.output,0));tty.output=[]}})}};var MEMFS={ops_table:null,mount:(function(mount){return MEMFS.createNode(null,"/",16384|511,0)}),createNode:(function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node}),getFileDataAsRegularArray:(function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;inode.contents.length){node.contents=MEMFS.getFileDataAsRegularArray(node);node.usedBytes=node.contents.length}if(!node.contents||node.contents.subarray){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return}if(!node.contents&&newCapacity>0)node.contents=[];while(node.contents.lengthnewSize)node.contents.length=newSize;else while(node.contents.length=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+lengthe2.timestamp){create.push(key);total++}}));var remove=[];Object.keys(dst.entries).forEach((function(key){var e=dst.entries[key];var e2=src.entries[key];if(!e2){remove.push(key);total++}}));if(!total){return callback(null)}var completed=0;var db=src.type==="remote"?src.db:dst.db;var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readwrite");var store=transaction.objectStore(IDBFS.DB_STORE_NAME);function done(err){if(err){if(!done.errored){done.errored=true;return callback(err)}return}if(++completed>=total){return callback(null)}}transaction.onerror=(function(e){done(this.error);e.preventDefault()});create.sort().forEach((function(path){if(dst.type==="local"){IDBFS.loadRemoteEntry(store,path,(function(err,entry){if(err)return done(err);IDBFS.storeLocalEntry(path,entry,done)}))}else{IDBFS.loadLocalEntry(path,(function(err,entry){if(err)return done(err);IDBFS.storeRemoteEntry(store,path,entry,done)}))}}));remove.sort().reverse().forEach((function(path){if(dst.type==="local"){IDBFS.removeLocalEntry(path,done)}else{IDBFS.removeRemoteEntry(store,path,done)}}))})};var NODEFS={isWindows:false,staticInit:(function(){NODEFS.isWindows=!!process.platform.match(/^win/)}),mount:(function(mount){assert(ENVIRONMENT_IS_NODE);return NODEFS.createNode(null,"/",NODEFS.getMode(mount.opts.root),0)}),createNode:(function(parent,name,mode,dev){if(!FS.isDir(mode)&&!FS.isFile(mode)&&!FS.isLink(mode)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node=FS.createNode(parent,name,mode);node.node_ops=NODEFS.node_ops;node.stream_ops=NODEFS.stream_ops;return node}),getMode:(function(path){var stat;try{stat=fs.lstatSync(path);if(NODEFS.isWindows){stat.mode=stat.mode|(stat.mode&146)>>1}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return stat.mode}),realPath:(function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)}),flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:(function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;if(flags in NODEFS.flagsToPermissionStringMap){return NODEFS.flagsToPermissionStringMap[flags]}else{throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}}),node_ops:{getattr:(function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}}),setattr:(function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),lookup:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)}),mknod:(function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,"",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node}),rename:(function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),unlink:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),rmdir:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),readdir:(function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),symlink:(function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),readlink:(function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}})},stream_ops:{open:(function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsToPermissionString(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),close:(function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),read:(function(stream,buffer,offset,length,position){if(length===0)return 0;var nbuffer=new Buffer(length);var res;try{res=fs.readSync(stream.nfd,nbuffer,0,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(res>0){for(var i=0;i=stream.node.size)return 0;var chunk=stream.node.contents.slice(position,position+length);var ab=WORKERFS.reader.readAsArrayBuffer(chunk);buffer.set(new Uint8Array(ab),offset);return chunk.size}),write:(function(stream,buffer,offset,length,position){throw new FS.ErrnoError(ERRNO_CODES.EIO)}),llseek:(function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.size}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position})}};STATICTOP+=16;STATICTOP+=16;STATICTOP+=16;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:(function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)}),lookupPath:(function(path,opts){path=PATH.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(ERRNO_CODES.ELOOP)}var parts=PATH.normalizeArray(path.split("/").filter((function(p){return!!p})),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(ERRNO_CODES.ELOOP)}}}}return{path:current_path,node:current}}),getPath:(function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}}),hashName:(function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length}),hashAddNode:(function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node}),hashRemoveNode:(function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}}),lookupNode:(function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)}),createNode:(function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=(function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev});FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:(function(){return(this.mode&readMode)===readMode}),set:(function(val){val?this.mode|=readMode:this.mode&=~readMode})},write:{get:(function(){return(this.mode&writeMode)===writeMode}),set:(function(val){val?this.mode|=writeMode:this.mode&=~writeMode})},isFolder:{get:(function(){return FS.isDir(this.mode)})},isDevice:{get:(function(){return FS.isChrdev(this.mode)})}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node}),destroyNode:(function(node){FS.hashRemoveNode(node)}),isRoot:(function(node){return node===node.parent}),isMountpoint:(function(node){return!!node.mounted}),isFile:(function(mode){return(mode&61440)===32768}),isDir:(function(mode){return(mode&61440)===16384}),isLink:(function(mode){return(mode&61440)===40960}),isChrdev:(function(mode){return(mode&61440)===8192}),isBlkdev:(function(mode){return(mode&61440)===24576}),isFIFO:(function(mode){return(mode&61440)===4096}),isSocket:(function(mode){return(mode&49152)===49152}),flagModes:{"r":0,"rs":1052672,"r+":2,"w":577,"wx":705,"xw":705,"w+":578,"wx+":706,"xw+":706,"a":1089,"ax":1217,"xa":1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:(function(str){var flags=FS.flagModes[str];if(typeof flags==="undefined"){throw new Error("Unknown file open mode: "+str)}return flags}),flagsToPermissionString:(function(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms}),nodePermissions:(function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf("r")!==-1&&!(node.mode&292)){return ERRNO_CODES.EACCES}else if(perms.indexOf("w")!==-1&&!(node.mode&146)){return ERRNO_CODES.EACCES}else if(perms.indexOf("x")!==-1&&!(node.mode&73)){return ERRNO_CODES.EACCES}return 0}),mayLookup:(function(dir){var err=FS.nodePermissions(dir,"x");if(err)return err;if(!dir.node_ops.lookup)return ERRNO_CODES.EACCES;return 0}),mayCreate:(function(dir,name){try{var node=FS.lookupNode(dir,name);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(dir,"wx")}),mayDelete:(function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,"wx");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return ERRNO_CODES.ENOTDIR}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return ERRNO_CODES.EBUSY}}else{if(FS.isDir(node.mode)){return ERRNO_CODES.EISDIR}}return 0}),mayOpen:(function(node,flags){if(!node){return ERRNO_CODES.ENOENT}if(FS.isLink(node.mode)){return ERRNO_CODES.ELOOP}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return ERRNO_CODES.EISDIR}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))}),MAX_OPEN_FDS:4096,nextfd:(function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(ERRNO_CODES.EMFILE)}),getStream:(function(fd){return FS.streams[fd]}),createStream:(function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=(function(){});FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:(function(){return this.node}),set:(function(val){this.node=val})},isRead:{get:(function(){return(this.flags&2097155)!==1})},isWrite:{get:(function(){return(this.flags&2097155)!==0})},isAppend:{get:(function(){return this.flags&1024})}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream}),closeStream:(function(fd){FS.streams[fd]=null}),chrdev_stream_ops:{open:(function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}}),llseek:(function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)})},major:(function(dev){return dev>>8}),minor:(function(dev){return dev&255}),makedev:(function(ma,mi){return ma<<8|mi}),registerDevice:(function(dev,ops){FS.devices[dev]={stream_ops:ops}}),getDevice:(function(dev){return FS.devices[dev]}),getMounts:(function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts}),syncfs:(function(populate,callback){if(typeof populate==="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(err){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach((function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)}))}),mount:(function(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot}),unmount:(function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach((function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}}));node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)}),lookup:(function(parent,name){return parent.node_ops.lookup(parent,name)}),mknod:(function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}return parent.node_ops.mknod(parent,name,mode,dev)}),create:(function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)}),mkdir:(function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)}),mkdirTree:(function(path,mode){var dirs=path.split("/");var d="";for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(function(from,to){if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);if(typeof Uint8Array!="undefined")xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||"",true)}});var lazyArray=this;lazyArray.setDataGetter((function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]==="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]==="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]}));if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;console.log("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!=="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:(function(){if(!this.lengthKnown){this.cacheLength()}return this._length})},chunkSize:{get:(function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize})}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:(function(){return this.contents.length})}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach((function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(ERRNO_CODES.EIO)}return fn.apply(null,arguments)}}));stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(ERRNO_CODES.EIO)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i>2]=stat.dev;HEAP32[buf+4>>2]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;HEAP32[buf+36>>2]=stat.size;HEAP32[buf+40>>2]=4096;HEAP32[buf+44>>2]=stat.blocks;HEAP32[buf+48>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+52>>2]=0;HEAP32[buf+56>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ino;return 0}),doMsync:(function(addr,stream,len,flags){var buffer=new Uint8Array(HEAPU8.subarray(addr,addr+len));FS.msync(stream,buffer,0,len,flags)}),doMkdir:(function(path,mode){path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}),doMknod:(function(path,mode,dev){switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-ERRNO_CODES.EINVAL}FS.mknod(path,mode,dev);return 0}),doReadlink:(function(path,buf,bufsize){if(bufsize<=0)return-ERRNO_CODES.EINVAL;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len}),doAccess:(function(path,amode){if(amode&~7){return-ERRNO_CODES.EINVAL}var node;var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-ERRNO_CODES.EACCES}return 0}),doDup:(function(path,flags,suggestFD){var suggest=FS.getStream(suggestFD);if(suggest)FS.close(suggest);return FS.open(path,flags,0,suggestFD,suggestFD).fd}),doReadv:(function(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}),varargs:0,get:(function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret}),getStr:(function(){var ret=Pointer_stringify(SYSCALLS.get());return ret}),getStreamFromFD:(function(){var stream=FS.getStream(SYSCALLS.get());if(!stream)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return stream}),getSocketFromFD:(function(){var socket=SOCKFS.getSocket(SYSCALLS.get());if(!socket)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return socket}),getSocketAddress:(function(allowNull){var addrp=SYSCALLS.get(),addrlen=SYSCALLS.get();if(allowNull&&addrp===0)return null;var info=__read_sockaddr(addrp,addrlen);if(info.errno)throw new FS.ErrnoError(info.errno);info.addr=DNS.lookup_addr(info.addr)||info.addr;return info}),get64:(function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low}),getZero:(function(){assert(SYSCALLS.get()===0)})};function ___syscall64(which,varargs){SYSCALLS.varargs=varargs;try{return PROCINFO.ppid}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_i64Subtract"]=_i64Subtract;function _sysconf(name){switch(name){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator==="object")return navigator["hardwareConcurrency"]||1;return 1}}___setErrNo(ERRNO_CODES.EINVAL);return-1}function ___syscall20(which,varargs){SYSCALLS.varargs=varargs;try{return PROCINFO.pid}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _pthread_mutex_destroy(){}Module["_memset"]=_memset;function ___syscall75(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_pthread_mutex_lock"]=_pthread_mutex_lock;function _atexit(func,arg){__ATEXIT__.unshift({func:func,arg:arg})}function _abort(){Module["abort"]()}function ___syscall195(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall194(which,varargs){SYSCALLS.varargs=varargs;try{var fd=SYSCALLS.get(),zero=SYSCALLS.getZero(),length=SYSCALLS.get64();FS.ftruncate(fd,length);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall197(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall202(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall199(){return ___syscall202.apply(null,arguments)}Module["_i64Add"]=_i64Add;var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC);Module["_llvm_cttz_i32"]=_llvm_cttz_i32;Module["___udivmoddi4"]=___udivmoddi4;Module["___divdi3"]=___divdi3;function _pthread_mutex_init(){}function ___lock(){}function ___unlock(){}function ___assert_fail(condition,filename,line,func){ABORT=true;throw"Assertion failed: "+Pointer_stringify(condition)+", at: "+[filename?Pointer_stringify(filename):"unknown filename",line,func?Pointer_stringify(func):"unknown function"]+" at "+stackTrace()}function _clock(){if(_clock.start===undefined)_clock.start=Date.now();return(Date.now()-_clock.start)*(1e6/1e3)|0}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;Module["_memmove"]=_memmove;function ___syscall91(which,varargs){SYSCALLS.varargs=varargs;try{var addr=SYSCALLS.get(),len=SYSCALLS.get();var info=SYSCALLS.mappings[addr];if(!info)return 0;if(len===info.len){var stream=FS.getStream(info.fd);SYSCALLS.doMsync(addr,stream,len,info.flags);FS.munmap(stream);SYSCALLS.mappings[addr]=null;if(info.allocated){_free(info.malloc)}}return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_llvm_bswap_i32"]=_llvm_bswap_i32;function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0};case 21506:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0};case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0};case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL};case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)};default:abort("bad ioctl syscall "+op)}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}var ___tm_current=STATICTOP;STATICTOP+=48;var ___tm_timezone=allocate(intArrayFromString("GMT"),"i8",ALLOC_STATIC);var _tzname=STATICTOP;STATICTOP+=16;var _daylight=STATICTOP;STATICTOP+=16;var _timezone=STATICTOP;STATICTOP+=16;function _tzset(){if(_tzset.called)return;_tzset.called=true;HEAP32[_timezone>>2]=-(new Date).getTimezoneOffset()*60;var winter=new Date(2e3,0,1);var summer=new Date(2e3,6,1);HEAP32[_daylight>>2]=Number(winter.getTimezoneOffset()!=summer.getTimezoneOffset());function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocate(intArrayFromString(winterName),"i8",ALLOC_NORMAL);var summerNamePtr=allocate(intArrayFromString(summerName),"i8",ALLOC_NORMAL);if(summer.getTimezoneOffset()>2]=winterNamePtr;HEAP32[_tzname+4>>2]=summerNamePtr}else{HEAP32[_tzname>>2]=summerNamePtr;HEAP32[_tzname+4>>2]=winterNamePtr}}function _localtime_r(time,tmPtr){_tzset();var date=new Date(HEAP32[time>>2]*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var start=new Date(date.getFullYear(),0,1);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var summerOffset=(new Date(2e3,6,1)).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=date.getTimezoneOffset()==Math.min(winterOffset,summerOffset)|0;HEAP32[tmPtr+32>>2]=dst;var zonePtr=HEAP32[_tzname+(dst?Runtime.QUANTUM_SIZE:0)>>2];HEAP32[tmPtr+40>>2]=zonePtr;return tmPtr}function _localtime(time){return _localtime_r(time,___tm_current)}function ___syscall77(which,varargs){SYSCALLS.varargs=varargs;try{var who=SYSCALLS.get(),usage=SYSCALLS.get();_memset(usage,0,136);HEAP32[usage>>2]=1;HEAP32[usage+4>>2]=2;HEAP32[usage+8>>2]=3;HEAP32[usage+12>>2]=4;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_bitshift64Ashr"]=_bitshift64Ashr;Module["_bitshift64Lshr"]=_bitshift64Lshr;function ___syscall33(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),amode=SYSCALLS.get();return SYSCALLS.doAccess(path,amode)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _pthread_cleanup_push(routine,arg){__ATEXIT__.push((function(){Module["dynCall_vi"](routine,arg)}));_pthread_cleanup_push.level=__ATEXIT__.length}var _environ=STATICTOP;STATICTOP+=16;function ___buildEnvironment(env){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV["USER"]=ENV["LOGNAME"]="web_user";ENV["PATH"]="/";ENV["PWD"]="/";ENV["HOME"]="/home/web_user";ENV["LANG"]="C";ENV["_"]=Module["thisProgram"];poolPtr=allocate(TOTAL_ENV_SIZE,"i8",ALLOC_STATIC);envPtr=allocate(MAX_ENV_VALUES*4,"i8*",ALLOC_STATIC);HEAP32[envPtr>>2]=poolPtr;HEAP32[_environ>>2]=envPtr}else{envPtr=HEAP32[_environ>>2];poolPtr=HEAP32[envPtr>>2]}var strings=[];var totalSize=0;for(var key in env){if(typeof env[key]==="string"){var line=key+"="+env[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error("Environment size exceeded TOTAL_ENV_SIZE!")}var ptrSize=4;for(var i=0;i>2]=poolPtr;poolPtr+=line.length+1}HEAP32[envPtr+strings.length*ptrSize>>2]=0}var ENV={};function _getenv(name){if(name===0)return 0;name=Pointer_stringify(name);if(!ENV.hasOwnProperty(name))return 0;if(_getenv.ret)_free(_getenv.ret);_getenv.ret=allocate(intArrayFromString(ENV[name]),"i8",ALLOC_NORMAL);return _getenv.ret}function _gettimeofday(ptr){var now=Date.now();HEAP32[ptr>>2]=now/1e3|0;HEAP32[ptr+4>>2]=now%1e3*1e3|0;return 0}Module["_pthread_mutex_unlock"]=_pthread_mutex_unlock;function ___syscall3(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get(),count=SYSCALLS.get();return FS.read(stream,HEAP8,buf,count)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _llvm_stackrestore(p){var self=_llvm_stacksave;var ret=self.LLVM_SAVEDSTACKS[p];self.LLVM_SAVEDSTACKS.splice(p,1);Runtime.stackRestore(ret)}Module["___udivdi3"]=___udivdi3;Module["___muldsi3"]=___muldsi3;Module["___muldi3"]=___muldi3;Module["_sbrk"]=_sbrk;Module["_bitshift64Shl"]=_bitshift64Shl;function _llvm_stacksave(){var self=_llvm_stacksave;if(!self.LLVM_SAVEDSTACKS){self.LLVM_SAVEDSTACKS=[]}self.LLVM_SAVEDSTACKS.push(Runtime.stackSave());return self.LLVM_SAVEDSTACKS.length-1}function _pthread_cleanup_pop(){assert(_pthread_cleanup_push.level==__ATEXIT__.length,"cannot pop if something else added meanwhile!");__ATEXIT__.pop();_pthread_cleanup_push.level=__ATEXIT__.length}Module["___uremdi3"]=___uremdi3;function ___syscall340(which,varargs){SYSCALLS.varargs=varargs;try{var pid=SYSCALLS.get(),resource=SYSCALLS.get(),new_limit=SYSCALLS.get(),old_limit=SYSCALLS.get();if(old_limit){HEAP32[old_limit>>2]=-1;HEAP32[old_limit+4>>2]=-1;HEAP32[old_limit+8>>2]=-1;HEAP32[old_limit+12>>2]=-1}return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall4(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get(),count=SYSCALLS.get();return FS.write(stream,HEAP8,buf,count)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall192(which,varargs){SYSCALLS.varargs=varargs;try{var addr=SYSCALLS.get(),len=SYSCALLS.get(),prot=SYSCALLS.get(),flags=SYSCALLS.get(),fd=SYSCALLS.get(),off=SYSCALLS.get();off<<=12;var ptr;var allocated=false;if(fd===-1){ptr=_memalign(PAGE_SIZE,len);if(!ptr)return-ERRNO_CODES.ENOMEM;_memset(ptr,0,len);allocated=true}else{var info=FS.getStream(fd);if(!info)return-ERRNO_CODES.EBADF;var res=FS.mmap(info,HEAPU8,addr,len,off,prot,flags);ptr=res.ptr;allocated=res.allocated}SYSCALLS.mappings[ptr]={malloc:ptr,len:len,allocated:allocated,fd:fd,flags:flags};return ptr}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall201(){return ___syscall202.apply(null,arguments)}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]);return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?Pointer_stringify(tm_zone):""};var pattern=Pointer_stringify(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":(function(date){return WEEKDAYS[date.tm_wday].substring(0,3)}),"%A":(function(date){return WEEKDAYS[date.tm_wday]}),"%b":(function(date){return MONTHS[date.tm_mon].substring(0,3)}),"%B":(function(date){return MONTHS[date.tm_mon]}),"%C":(function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)}),"%d":(function(date){return leadingNulls(date.tm_mday,2)}),"%e":(function(date){return leadingSomething(date.tm_mday,2," ")}),"%g":(function(date){return getWeekBasedYear(date).toString().substring(2)}),"%G":(function(date){return getWeekBasedYear(date)}),"%H":(function(date){return leadingNulls(date.tm_hour,2)}),"%I":(function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)}),"%j":(function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)}),"%m":(function(date){return leadingNulls(date.tm_mon+1,2)}),"%M":(function(date){return leadingNulls(date.tm_min,2)}),"%n":(function(){return"\n"}),"%p":(function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}else{return"PM"}}),"%S":(function(date){return leadingNulls(date.tm_sec,2)}),"%t":(function(){return"\t"}),"%u":(function(date){var day=new Date(date.tm_year+1900,date.tm_mon+1,date.tm_mday,0,0,0,0);return day.getDay()||7}),"%U":(function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"}),"%V":(function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)}),"%Z":(function(date){return date.tm_zone}),"%%":(function(){return"%"})};for(var rule in EXPANSION_RULES_2){if(pattern.indexOf(rule)>=0){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function ___syscall191(which,varargs){SYSCALLS.varargs=varargs;try{var resource=SYSCALLS.get(),rlim=SYSCALLS.get();HEAP32[rlim>>2]=-1;HEAP32[rlim+4>>2]=-1;HEAP32[rlim+8>>2]=-1;HEAP32[rlim+12>>2]=-1;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){HEAP32[ptr>>2]=ret}return ret}function ___syscall142(which,varargs){SYSCALLS.varargs=varargs;try{var nfds=SYSCALLS.get(),readfds=SYSCALLS.get(),writefds=SYSCALLS.get(),exceptfds=SYSCALLS.get(),timeout=SYSCALLS.get();assert(nfds<=64,"nfds must be less than or equal to 64");assert(!exceptfds,"exceptfds not supported");var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);function check(fd,low,high,val){return fd<32?low&val:high&val}for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_pthread_self"]=_pthread_self;function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;assert(offset_high===0);FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doWritev(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["___remdi3"]=___remdi3;function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-ERRNO_CODES.EINVAL}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd};case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0};case 12:case 12:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0};case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}FS.staticInit();__ATINIT__.unshift((function(){if(!Module["noFSInit"]&&!FS.init.initialized)FS.init()}));__ATMAIN__.push((function(){FS.ignorePermissions=false}));__ATEXIT__.push((function(){FS.quit()}));Module["FS_createFolder"]=FS.createFolder;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createLink"]=FS.createLink;Module["FS_createDevice"]=FS.createDevice;Module["FS_unlink"]=FS.unlink;__ATINIT__.unshift((function(){TTY.init()}));__ATEXIT__.push((function(){TTY.shutdown()}));if(ENVIRONMENT_IS_NODE){var fs=require("fs");var NODEJS_PATH=require("path");NODEFS.staticInit()}___buildEnvironment(ENV);DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC);STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP);STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;staticSealed=true;assert(DYNAMIC_BASE1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.warn(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){abort("NO_DYNAMIC_EXECUTION=1 was set, cannot eval")}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var Runtime={setTempRet0:(function(value){tempRet0=value;return value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),STACK_ALIGN:16,prepVararg:(function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr}),getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),dynCall:(function(sig,ptr,args){if(args&&args.length){assert(args.length==sig.length-1);assert("dynCall_"+sig in Module,"bad function pointer type - no table for sig '"+sig+"'");return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{assert(sig.length==1);assert("dynCall_"+sig in Module,"bad function pointer type - no table for sig '"+sig+"'");return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[],addFunction:(function(func){for(var i=0;i>2];var end=(ret+size+15|0)&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;var ABORT=0;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];if(!func){abort("NO_DYNAMIC_EXECUTION=1 was set, cannot eval")}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;((function(){var JSfuncs={"stackSave":(function(){Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore()}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=Runtime.stackAlloc(len);stringToUTF8(str,ret,len)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!=="array",'Return type should not be "array".');if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}Module["Pointer_stringify"]=Pointer_stringify;function AsciiToString(ptr){var str="";while(1){var ch=HEAP8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}Module["UTF8ArrayToString"]=UTF8ArrayToString;function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}Module["UTF8ToString"]=UTF8ToString;function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}Module["stringToUTF8Array"]=stringToUTF8Array;function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}Module["stringToUTF8"]=stringToUTF8;function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}Module["lengthBytesUTF8"]=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){var __cxa_demangle_func=Module["___cxa_demangle"]||Module["__cxa_demangle"];if(__cxa_demangle_func){try{var s=func.substr(1);var len=lengthBytesUTF8(s)+1;var buf=_malloc(len);stringToUTF8(s,buf,len);var status=_malloc(4);var ret=__cxa_demangle_func(buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}return func}Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){var js=jsStackTrace();if(Module["extraStackTrace"])js+="\n"+Module["extraStackTrace"]();return demangleAll(js)}Module["stackTrace"]=stackTrace;var PAGE_SIZE=16384;var HEAP;var buffer;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+" "+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw"Runtime error: The application has corrupted its heap memory area (address zero)!"}function abortStackOverflow(allocSize){abort("Stack overflow! Attempted to allocate "+allocSize+" bytes on the stack, but stack has only "+(STACK_MAX-asm.stackSave()+allocSize)+" bytes available!")}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){checkStackCookie();callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){checkStackCookie();if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i255){assert(false,"Character code "+chr+" ("+String.fromCharCode(chr)+") at offset "+i+" not in 0x00-0xFF.");chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var lastChar,end;if(dontAddNull){end=buffer+lengthBytesUTF8(string);lastChar=HEAP8[end]}stringToUTF8(string,buffer,Infinity);if(dontAddNull)HEAP8[end]=lastChar}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){assert(array.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)");HEAP8.set(array,buffer)}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=(function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32});Math.clz32=Math["clz32"];if(!Math["trunc"])Math["trunc"]=(function(x){return x<0?Math.ceil(x):Math.floor(x)});Math.trunc=Math["trunc"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;var runDependencyTracking={};function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random()}return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!=="undefined"){runDependencyWatcher=setInterval((function(){if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return}var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;Module.printErr("still waiting on run dependencies:")}Module.printErr("dependency: "+dep)}if(shown){Module.printErr("(end of list)")}}),1e4)}}else{Module.printErr("warning: run dependency added without ID")}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id]}else{Module.printErr("warning: run dependency removed without ID")}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var ASM_CONSTS=[];STATIC_BASE=8;STATICTOP=STATIC_BASE+72896;__ATINIT__.push({func:(function(){_GNUNET_util_cl_init()})},{func:(function(){_GNUNET_CRYPTO_random_init()})},{func:(function(){_gpg_err_init()})},{func:(function(){_TALER_gcrypt_init()})});allocate([0,0,0,0,0,0,0,0,102,154,0,127,199,106,69,159,152,186,249,23,254,223,149,34,17,154,0,127,199,106,69,159,152,186,249,23,254,223,149,51,6,154,0,127,199,106,69,159,152,186,249,23,254,223,149,33,255,255,255,255,255,255,255,255,34,174,40,215,152,47,138,66,205,101,239,35,145,68,55,113,47,59,77,236,207,251,192,181,188,219,137,129,165,219,181,233,56,181,72,243,91,194,86,57,25,208,5,182,241,17,241,89,155,79,25,175,164,130,63,146,24,129,109,218,213,94,28,171,66,2,3,163,152,170,7,216,190,111,112,69,1,91,131,18,140,178,228,78,190,133,49,36,226,180,255,213,195,125,12,85,111,137,123,242,116,93,190,114,177,150,22,59,254,177,222,128,53,18,199,37,167,6,220,155,148,38,105,207,116,241,155,193,210,74,241,158,193,105,155,228,227,37,79,56,134,71,190,239,181,213,140,139,198,157,193,15,101,156,172,119,204,161,12,36,117,2,43,89,111,44,233,45,131,228,166,110,170,132,116,74,212,251,65,189,220,169,176,92,181,83,17,131,218,136,249,118,171,223,102,238,82,81,62,152,16,50,180,45,109,198,49,168,63,33,251,152,200,39,3,176,228,14,239,190,199,127,89,191,194,143,168,61,243,11,224,198,37,167,10,147,71,145,167,213,111,130,3,224,81,99,202,6,112,110,14,10,103,41,41,20,252,47,210,70,133,10,183,39,38,201,38,92,56,33,27,46,237,42,196,90,252,109,44,77,223,179,149,157,19,13,56,83,222,99,175,139,84,115,10,101,168,178,119,60,187,10,106,118,230,174,237,71,46,201,194,129,59,53,130,20,133,44,114,146,100,3,241,76,161,232,191,162,1,48,66,188,75,102,26,168,145,151,248,208,112,139,75,194,48,190,84,6,163,81,108,199,24,82,239,214,25,232,146,209,16,169,101,85,36,6,153,214,42,32,113,87,133,53,14,244,184,209,187,50,112,160,106,16,200,208,210,184,22,193,164,25,83,171,65,81,8,108,55,30,153,235,142,223,76,119,72,39,168,72,155,225,181,188,176,52,99,90,201,197,179,12,28,57,203,138,65,227,74,170,216,78,115,227,99,119,79,202,156,91,163,184,178,214,243,111,46,104,252,178,239,93,238,130,143,116,96,47,23,67,111,99,165,120,114,171,240,161,20,120,200,132,236,57,100,26,8,2,199,140,40,30,99,35,250,255,190,144,233,189,130,222,235,108,80,164,21,121,198,178,247,163,249,190,43,83,114,227,242,120,113,198,156,97,38,234,206,62,39,202,7,194,192,33,199,184,134,209,30,235,224,205,214,125,218,234,120,209,110,238,127,79,125,245,186,111,23,114,170,103,240,6,166,152,200,162,197,125,99,10,174,13,249,190,4,152,63,17,27,71,28,19,53,11,113,27,132,125,4,35,245,119,219,40,147,36,199,64,123,171,202,50,188,190,201,21,10,190,158,60,76,13,16,156,196,103,29,67,182,66,62,203,190,212,197,76,42,126,101,252,156,41,127,89,236,250,214,58,171,111,203,95,23,88,71,74,140,25,68,108,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,210,84,0,0,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,145,88,0,0,2,0,0,0,157,88,0,0,4,0,0,0,169,88,0,0,8,0,0,0,181,88,0,0,16,0,0,0,194,88,0,0,32,0,0,0,204,88,0,0,64,0,0,0,215,88,0,0,128,0,0,0,227,88,0,0,0,1,0,0,240,88,0,0,0,2,0,0,252,88,0,0,0,4,0,0,9,89,0,0,0,8,0,0,19,89,0,0,0,16,0,0,30,89,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,139,0,0,0,1,0,0,0,0,0,0,2,0,0,0,1,0,0,0,213,98,0,0,24,99,0,0,30,99,0,0,98,99,0,0,165,99,0,0,232,99,0,0,43,100,0,0,147,95,0,0,192,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,48,100,0,0,99,100,0,0,150,100,0,0,201,100,0,0,252,100,0,0,47,101,0,0,98,101,0,0,208,95,0,0,224,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,103,101,0,0,162,101,0,0,221,101,0,0,24,102,0,0,83,102,0,0,142,102,0,0,98,101,0,0,251,95,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,201,102,0,0,12,103,0,0,79,103,0,0,146,103,0,0,213,103,0,0,24,104,0,0,98,101,0,0,56,96,0,0,128,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,91,104,0,0,190,104,0,0,33,105,0,0,132,105,0,0,231,105,0,0,74,106,0,0,98,101,0,0,99,96,0,0,9,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,173,106,0,0,52,107,0,0,187,107,0,0,65,108,0,0,199,108,0,0,78,109,0,0,98,101,0,0,142,96,0,0,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,213,109,0,0,0,110,0,0,43,110,0,0,86,110,0,0,129,110,0,0,172,110,0,0,98,101,0,0,179,96,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,215,110,0,0,10,111,0,0,61,111,0,0,112,111,0,0,163,111,0,0,214,111,0,0,98,101,0,0,216,96,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,112,0,0,68,112,0,0,127,112,0,0,186,112,0,0,245,112,0,0,48,113,0,0,98,101,0,0,253,96,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,113,0,0,174,113,0,0,241,113,0,0,52,114,0,0,119,114,0,0,186,114,0,0,98,101,0,0,34,97,0,0,64,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,114,0,0,80,115,0,0,163,115,0,0,246,115,0,0,73,116,0,0,156,116,0,0,98,101,0,0,71,97,0,0,128,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,239,116,0,0,82,117,0,0,181,117,0,0,24,118,0,0,123,118,0,0,222,118,0,0,98,101,0,0,109,97,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,119,0,0,196,119,0,0,71,120,0,0,202,120,0,0,77,121,0,0,208,121,0,0,98,101,0,0,147,97,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,122,0,0,150,122,0,0,217,122,0,0,28,123,0,0,95,123,0,0,162,123,0,0,98,101,0,0,178,97,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,229,123,0,0,40,124,0,0,107,124,0,0,174,124,0,0,241,124,0,0,52,125,0,0,98,101,0,0,216,97,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,125,0,0,186,125,0,0,253,125,0,0,64,126,0,0,241,124,0,0,131,126,0,0,98,101,0,0,254,97,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,198,126,0,0,9,127,0,0,76,127,0,0,143,127,0,0,210,127,0,0,21,128,0,0,98,101,0,0,88,128,0,0,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,102,128,0,0,150,122,0,0,233,128,0,0,108,129,0,0,239,129,0,0,114,130,0,0,98,101,0,0,118,98,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,245,130,0,0,120,131,0,0,251,131,0,0,126,132,0,0,1,133,0,0,132,133,0,0,98,101,0,0,154,98,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,134,0,0,138,134,0,0,13,135,0,0,144,135,0,0,19,136,0,0,150,136,0,0,98,101,0,0,190,98,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,137,0,0,210,127,0,0,150,122,0,0,92,137,0,0,159,137,0,0,226,137,0,0,98,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,139,0,0,124,95,0,0,147,95,0,0,158,95,0,0,147,95,0,0,178,95,0,0,147,95,0,0,189,95,0,0,147,95,0,0,199,95,0,0,208,95,0,0,219,95,0,0,208,95,0,0,229,95,0,0,208,95,0,0,242,95,0,0,251,95,0,0,6,96,0,0,251,95,0,0,26,96,0,0,251,95,0,0,37,96,0,0,251,95,0,0,47,96,0,0,56,96,0,0,67,96,0,0,56,96,0,0,77,96,0,0,56,96,0,0,90,96,0,0,99,96,0,0,110,96,0,0,99,96,0,0,120,96,0,0,99,96,0,0,133,96,0,0,142,96,0,0,158,96,0,0,179,96,0,0,195,96,0,0,216,96,0,0,232,96,0,0,253,96,0,0,13,97,0,0,34,97,0,0,50,97,0,0,71,97,0,0,87,97,0,0,109,97,0,0,125,97,0,0,147,97,0,0,161,97,0,0,178,97,0,0,199,97,0,0,216,97,0,0,237,97,0,0,254,97,0,0,19,98,0,0,178,97,0,0,36,98,0,0,254,97,0,0,60,98,0,0,178,97,0,0,84,98,0,0,254,97,0,0,101,98,0,0,118,98,0,0,134,98,0,0,154,98,0,0,170,98,0,0,190,98,0,0,200,98,0,0,0,0,0,0,0,0,0,0,79,141,0,0,93,141,0,0,122,141,0,0,163,14,1,9,139,198,219,191,69,105,15,58,126,158,109,15,139,190,162,163,158,97,72,0,143,208,94,68,127,141,0,0,141,141,0,0,150,141,0,0,137,111,177,18,138,187,223,25,104,50,16,124,212,157,243,63,71,180,177,22,153,18,186,79,83,104,75,34,171,141,0,0,186,141,0,0,237,141,0,0,127,179,203,53,136,198,193,246,255,169,105,77,125,106,210,100,147,101,176,193,246,93,105,209,236,131,51,234,2,142,0,0,17,142,0,0,68,142,0,0,108,17,80,104,116,1,60,172,106,42,188,27,179,130,98,124,236,106,144,216,110,252,1,45,231,175,236,90,94,142,0,0,110,142,0,0,165,142,0,0,149,233,160,219,150,32,149,173,174,190,155,45,111,13,188,226,212,153,241,18,242,210,183,39,63,166,135,14,41,143,0,0,58,143,0,0,165,142,0,0,58,133,65,102,172,93,159,2,63,84,213,23,208,179,157,189,148,103,112,219,156,43,149,201,246,245,101,209,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,141,0,0,93,141,0,0,122,141,0,0,91,220,193,70,191,96,117,78,106,4,36,38,8,149,117,199,90,0,63,8,157,39,57,131,157,236,88,185,100,236,56,67,127,141,0,0,141,141,0,0,150,141,0,0,176,52,76,97,216,219,56,83,92,168,175,206,175,11,241,43,136,29,194,0,201,131,61,167,38,233,55,108,46,50,207,247,171,141,0,0,186,141,0,0,237,141,0,0,119,62,169,30,54,128,14,70,133,77,184,235,208,145,129,167,41,89,9,139,62,248,193,34,217,99,85,20,206,213,101,254,2,142,0,0,17,142,0,0,68,142,0,0,130,85,138,56,154,68,60,14,164,204,129,152,153,242,8,58,133,240,250,163,229,120,248,7,122,46,63,244,103,41,102,91,94,142,0,0,110,142,0,0,165,142,0,0,96,228,49,89,30,224,182,127,13,138,38,170,203,245,183,127,142,11,198,33,55,40,197,20,5,70,4,15,14,227,127,84,41,143,0,0,58,143,0,0,165,142,0,0,155,9,255,167,27,148,47,203,39,99,95,188,213,176,233,68,191,220,99,100,79,7,19,147,138,127,81,83,92,58,53,226,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,141,0,0,93,141,0,0,122,141,0,0,175,69,210,227,118,72,64,49,97,127,120,210,181,138,107,27,156,126,244,100,245,160,27,71,228,46,195,115,99,34,68,94,142,34,64,202,94,105,226,199,139,50,57,236,250,178,22,73,127,141,0,0,141,141,0,0,150,141,0,0,175,208,57,68,216,72,149,98,107,8,37,244,171,70,144,127,21,249,218,219,228,16,30,198,130,170,3,76,124,235,197,156,250,234,158,169,7,110,222,127,74,241,82,232,178,250,156,182,171,141,0,0,186,141,0,0,237,141,0,0,136,6,38,8,211,230,173,138,10,162,172,224,20,200,168,111,10,166,53,217,71,172,159,235,232,62,244,229,89,102,20,75,42,90,179,157,193,56,20,185,78,58,182,225,1,163,79,39,2,142,0,0,17,142,0,0,68,142,0,0,62,138,105,183,120,60,37,133,25,51,171,98,144,175,108,167,122,153,129,72,8,80,0,156,197,87,124,110,31,87,59,78,104,1,221,35,196,167,214,121,204,248,163,134,198,116,207,251,94,142,0,0,110,142,0,0,165,142,0,0,78,206,8,68,133,129,62,144,136,210,198,58,4,27,197,180,79,158,241,1,42,43,88,143,60,209,31,5,3,58,196,198,12,46,246,171,64,48,254,130,150,36,141,241,99,244,73,82,41,143,0,0,58,143,0,0,165,142,0,0,102,23,23,142,148,31,2,13,53,30,47,37,78,143,211,44,96,36,32,254,176,184,251,154,220,206,187,130,70,30,153,197,166,120,204,49,231,153,23,109,56,96,230,17,12,70,82,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,141,0,0,93,141,0,0,122,141,0,0,22,75,122,123,252,248,25,226,227,149,251,231,59,86,224,163,135,189,100,34,46,131,31,214,16,39,12,215,234,37,5,84,151,88,191,117,192,90,153,74,109,3,79,101,248,240,230,253,202,234,177,163,77,74,107,75,99,110,7,10,56,188,231,55,127,141,0,0,141,141,0,0,150,141,0,0,135,170,124,222,165,239,97,157,79,240,180,36,26,29,108,176,35,121,244,226,206,78,194,120,122,208,179,5,69,225,124,222,218,168,51,183,214,184,167,2,3,139,39,78,174,163,244,228,190,157,145,78,235,97,241,112,46,105,108,32,58,18,104,84,171,141,0,0,186,141,0,0,237,141,0,0,250,115,176,8,157,86,162,132,239,176,240,117,108,137,11,233,177,181,219,221,142,232,26,54,85,248,62,51,178,39,157,57,191,62,132,130,121,167,34,200,6,180,133,164,126,103,200,7,185,70,163,55,190,232,148,38,116,39,136,89,225,50,146,251,2,142,0,0,17,142,0,0,68,142,0,0,176,186,70,86,55,69,140,105,144,229,168,197,246,29,74,247,229,118,217,127,249,75,135,45,231,111,128,80,54,30,227,219,169,28,165,193,26,162,94,180,214,121,39,92,197,120,128,99,165,241,151,65,18,12,79,45,226,173,235,235,16,162,152,221,94,142,0,0,110,142,0,0,165,142,0,0,128,178,66,99,199,193,163,235,183,20,147,193,221,123,232,180,155,70,209,244,27,74,238,193,18,27,1,55,131,248,243,82,107,86,208,55,224,95,37,152,189,15,210,33,93,106,30,82,149,230,79,115,246,63,10,236,139,145,90,152,93,120,101,152,41,143,0,0,58,143,0,0,165,142,0,0,227,123,106,119,93,200,125,186,164,223,169,249,110,94,63,253,222,189,113,248,134,114,137,134,93,245,163,45,32,205,201,68,182,2,44,172,60,73,130,177,13,94,235,85,195,228,222,21,19,70,118,251,109,224,68,96,101,201,116,64,250,140,106,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,146,0,0,2,0,0,0,198,146,0,0,1,0,0,0,202,146,0,0,8,0,0,0,209,146,0,0,3,0,0,0,219,146,0,0,3,0,0,0,226,146,0,0,9,0,0,0,233,146,0,0,10,0,0,0,240,146,0,0,11,0,0,0,247,146,0,0,5,0,0,0,251,146,0,0,45,1,0,0,255,146,0,0,6,0,0,0,5,147,0,0,7,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,2,0,0,0,133,147,0,0,64,17,0,0,80,17,0,0,16,0,0,0,128,0,0,0,248,1,0,0,1,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,215,149,0,0,224,149,0,0,231,149,0,0,0,0,0,0,123,149,0,0,1,0,0,0,146,149,0,0,3,0,0,0,169,149,0,0,5,0,0,0,192,149,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,107,193,190,226,46,64,159,150,233,61,126,17,115,147,23,42,59,63,217,46,183,45,173,32,51,52,73,248,232,60,251,74,174,45,138,87,30,3,172,156,158,183,111,172,69,175,142,81,200,166,69,55,160,179,169,63,205,227,205,173,159,28,229,139,48,200,28,70,163,92,228,17,229,251,193,25,26,10,82,239,38,117,31,103,163,203,177,64,177,128,140,241,135,164,244,223,246,159,36,69,223,79,155,23,173,43,65,123,230,108,55,16,192,75,5,53,124,93,28,14,234,196,198,111,159,247,242,230,5,0,0,0,43,126,21,22,40,174,210,166,171,247,21,136,9,207,79,60,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,107,193,190,226,46,64,159,150,233,61,126,17,115,147,23,42,59,63,217,46,183,45,173,32,51,52,73,248,232,60,251,74,174,45,138,87,30,3,172,156,158,183,111,172,69,175,142,81,119,137,80,141,22,145,143,3,245,60,82,218,197,78,216,37,48,200,28,70,163,92,228,17,229,251,193,25,26,10,82,239,151,64,5,30,156,95,236,246,67,68,247,168,34,96,237,204,246,159,36,69,223,79,155,23,173,43,65,123,230,108,55,16,48,76,101,40,246,89,199,120,102,165,16,217,193,214,174,94,198,99,99,165,248,124,124,132,238,119,119,153,246,123,123,141,255,242,242,13,214,107,107,189,222,111,111,177,145,197,197,84,96,48,48,80,2,1,1,3,206,103,103,169,86,43,43,125,231,254,254,25,181,215,215,98,77,171,171,230,236,118,118,154,143,202,202,69,31,130,130,157,137,201,201,64,250,125,125,135,239,250,250,21,178,89,89,235,142,71,71,201,251,240,240,11,65,173,173,236,179,212,212,103,95,162,162,253,69,175,175,234,35,156,156,191,83,164,164,247,228,114,114,150,155,192,192,91,117,183,183,194,225,253,253,28,61,147,147,174,76,38,38,106,108,54,54,90,126,63,63,65,245,247,247,2,131,204,204,79,104,52,52,92,81,165,165,244,209,229,229,52,249,241,241,8,226,113,113,147,171,216,216,115,98,49,49,83,42,21,21,63,8,4,4,12,149,199,199,82,70,35,35,101,157,195,195,94,48,24,24,40,55,150,150,161,10,5,5,15,47,154,154,181,14,7,7,9,36,18,18,54,27,128,128,155,223,226,226,61,205,235,235,38,78,39,39,105,127,178,178,205,234,117,117,159,18,9,9,27,29,131,131,158,88,44,44,116,52,26,26,46,54,27,27,45,220,110,110,178,180,90,90,238,91,160,160,251,164,82,82,246,118,59,59,77,183,214,214,97,125,179,179,206,82,41,41,123,221,227,227,62,94,47,47,113,19,132,132,151,166,83,83,245,185,209,209,104,0,0,0,0,193,237,237,44,64,32,32,96,227,252,252,31,121,177,177,200,182,91,91,237,212,106,106,190,141,203,203,70,103,190,190,217,114,57,57,75,148,74,74,222,152,76,76,212,176,88,88,232,133,207,207,74,187,208,208,107,197,239,239,42,79,170,170,229,237,251,251,22,134,67,67,197,154,77,77,215,102,51,51,85,17,133,133,148,138,69,69,207,233,249,249,16,4,2,2,6,254,127,127,129,160,80,80,240,120,60,60,68,37,159,159,186,75,168,168,227,162,81,81,243,93,163,163,254,128,64,64,192,5,143,143,138,63,146,146,173,33,157,157,188,112,56,56,72,241,245,245,4,99,188,188,223,119,182,182,193,175,218,218,117,66,33,33,99,32,16,16,48,229,255,255,26,253,243,243,14,191,210,210,109,129,205,205,76,24,12,12,20,38,19,19,53,195,236,236,47,190,95,95,225,53,151,151,162,136,68,68,204,46,23,23,57,147,196,196,87,85,167,167,242,252,126,126,130,122,61,61,71,200,100,100,172,186,93,93,231,50,25,25,43,230,115,115,149,192,96,96,160,25,129,129,152,158,79,79,209,163,220,220,127,68,34,34,102,84,42,42,126,59,144,144,171,11,136,136,131,140,70,70,202,199,238,238,41,107,184,184,211,40,20,20,60,167,222,222,121,188,94,94,226,22,11,11,29,173,219,219,118,219,224,224,59,100,50,50,86,116,58,58,78,20,10,10,30,146,73,73,219,12,6,6,10,72,36,36,108,184,92,92,228,159,194,194,93,189,211,211,110,67,172,172,239,196,98,98,166,57,145,145,168,49,149,149,164,211,228,228,55,242,121,121,139,213,231,231,50,139,200,200,67,110,55,55,89,218,109,109,183,1,141,141,140,177,213,213,100,156,78,78,210,73,169,169,224,216,108,108,180,172,86,86,250,243,244,244,7,207,234,234,37,202,101,101,175,244,122,122,142,71,174,174,233,16,8,8,24,111,186,186,213,240,120,120,136,74,37,37,111,92,46,46,114,56,28,28,36,87,166,166,241,115,180,180,199,151,198,198,81,203,232,232,35,161,221,221,124,232,116,116,156,62,31,31,33,150,75,75,221,97,189,189,220,13,139,139,134,15,138,138,133,224,112,112,144,124,62,62,66,113,181,181,196,204,102,102,170,144,72,72,216,6,3,3,5,247,246,246,1,28,14,14,18,194,97,97,163,106,53,53,95,174,87,87,249,105,185,185,208,23,134,134,145,153,193,193,88,58,29,29,39,39,158,158,185,217,225,225,56,235,248,248,19,43,152,152,179,34,17,17,51,210,105,105,187,169,217,217,112,7,142,142,137,51,148,148,167,45,155,155,182,60,30,30,34,21,135,135,146,201,233,233,32,135,206,206,73,170,85,85,255,80,40,40,120,165,223,223,122,3,140,140,143,89,161,161,248,9,137,137,128,26,13,13,23,101,191,191,218,215,230,230,49,132,66,66,198,208,104,104,184,130,65,65,195,41,153,153,176,90,45,45,119,30,15,15,17,123,176,176,203,168,84,84,252,109,187,187,214,44,22,22,58,81,244,167,80,126,65,101,83,26,23,164,195,58,39,94,150,59,171,107,203,31,157,69,241,172,250,88,171,75,227,3,147,32,48,250,85,173,118,109,246,136,204,118,145,245,2,76,37,79,229,215,252,197,42,203,215,38,53,68,128,181,98,163,143,222,177,90,73,37,186,27,103,69,234,14,152,93,254,192,225,195,47,117,2,129,76,240,18,141,70,151,163,107,211,249,198,3,143,95,231,21,146,156,149,191,109,122,235,149,82,89,218,212,190,131,45,88,116,33,211,73,224,105,41,142,201,200,68,117,194,137,106,244,142,121,120,153,88,62,107,39,185,113,221,190,225,79,182,240,136,173,23,201,32,172,102,125,206,58,180,99,223,74,24,229,26,49,130,151,81,51,96,98,83,127,69,177,100,119,224,187,107,174,132,254,129,160,28,249,8,43,148,112,72,104,88,143,69,253,25,148,222,108,135,82,123,248,183,171,115,211,35,114,75,2,226,227,31,143,87,102,85,171,42,178,235,40,7,47,181,194,3,134,197,123,154,211,55,8,165,48,40,135,242,35,191,165,178,2,3,106,186,237,22,130,92,138,207,28,43,167,121,180,146,243,7,242,240,78,105,226,161,101,218,244,205,6,5,190,213,209,52,98,31,196,166,254,138,52,46,83,157,162,243,85,160,5,138,225,50,164,246,235,117,11,131,236,57,64,96,239,170,94,113,159,6,189,110,16,81,62,33,138,249,150,221,6,61,221,62,5,174,77,230,189,70,145,84,141,181,113,196,93,5,4,6,212,111,96,80,21,255,25,152,251,36,214,189,233,151,137,64,67,204,103,217,158,119,176,232,66,189,7,137,139,136,231,25,91,56,121,200,238,219,161,124,10,71,124,66,15,233,248,132,30,201,0,0,0,0,9,128,134,131,50,43,237,72,30,17,112,172,108,90,114,78,253,14,255,251,15,133,56,86,61,174,213,30,54,45,57,39,10,15,217,100,104,92,166,33,155,91,84,209,36,54,46,58,12,10,103,177,147,87,231,15,180,238,150,210,27,155,145,158,128,192,197,79,97,220,32,162,90,119,75,105,28,18,26,22,226,147,186,10,192,160,42,229,60,34,224,67,18,27,23,29,14,9,13,11,242,139,199,173,45,182,168,185,20,30,169,200,87,241,25,133,175,117,7,76,238,153,221,187,163,127,96,253,247,1,38,159,92,114,245,188,68,102,59,197,91,251,126,52,139,67,41,118,203,35,198,220,182,237,252,104,184,228,241,99,215,49,220,202,66,99,133,16,19,151,34,64,132,198,17,32,133,74,36,125,210,187,61,248,174,249,50,17,199,41,161,109,29,158,47,75,220,178,48,243,13,134,82,236,119,193,227,208,43,179,22,108,169,112,185,153,17,148,72,250,71,233,100,34,168,252,140,196,160,240,63,26,86,125,44,216,34,51,144,239,135,73,78,199,217,56,209,193,140,202,162,254,152,212,11,54,166,245,129,207,165,122,222,40,218,183,142,38,63,173,191,164,44,58,157,228,80,120,146,13,106,95,204,155,84,126,70,98,246,141,19,194,144,216,184,232,46,57,247,94,130,195,175,245,159,93,128,190,105,208,147,124,111,213,45,169,207,37,18,179,200,172,153,59,16,24,125,167,232,156,99,110,219,59,187,123,205,38,120,9,110,89,24,244,236,154,183,1,131,79,154,168,230,149,110,101,170,255,230,126,33,188,207,8,239,21,232,230,186,231,155,217,74,111,54,206,234,159,9,212,41,176,124,214,49,164,178,175,42,63,35,49,198,165,148,48,53,162,102,192,116,78,188,55,252,130,202,166,224,144,208,176,51,167,216,21,241,4,152,74,65,236,218,247,127,205,80,14,23,145,246,47,118,77,214,141,67,239,176,77,204,170,77,84,228,150,4,223,158,209,181,227,76,106,136,27,193,44,31,184,70,101,81,127,157,94,234,4,1,140,53,93,250,135,116,115,251,11,65,46,179,103,29,90,146,219,210,82,233,16,86,51,109,214,71,19,154,215,97,140,55,161,12,122,89,248,20,142,235,19,60,137,206,169,39,238,183,97,201,53,225,28,229,237,122,71,177,60,156,210,223,89,85,242,115,63,24,20,206,121,115,199,55,191,83,247,205,234,95,253,170,91,223,61,111,20,120,68,219,134,202,175,243,129,185,104,196,62,56,36,52,44,194,163,64,95,22,29,195,114,188,226,37,12,40,60,73,139,255,13,149,65,57,168,1,113,8,12,179,222,216,180,228,156,100,86,193,144,123,203,132,97,213,50,182,112,72,108,92,116,208,184,87,66,82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125,1,0,0,0,2,0,0,0,4,0,0,0,8,0,0,0,16,0,0,0,32,0,0,0,64,0,0,0,128,0,0,0,27,0,0,0,54,0,0,0,108,0,0,0,216,0,0,0,171,0,0,0,77,0,0,0,154,0,0,0,47,0,0,0,94,0,0,0,188,0,0,0,99,0,0,0,198,0,0,0,151,0,0,0,53,0,0,0,106,0,0,0,212,0,0,0,179,0,0,0,125,0,0,0,250,0,0,0,239,0,0,0,197,0,0,0,145,0,0,0,8,0,0,0,2,0,0,0,239,149,0,0,120,28,0,0,132,28,0,0,16,0,0,0,192,0,0,0,248,1,0,0,1,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,86,150,0,0,98,150,0,0,0,0,0,0,246,149,0,0,1,0,0,0,14,150,0,0,3,0,0,0,38,150,0,0,5,0,0,0,62,150,0,0,2,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,2,0,0,0,106,150,0,0,236,28,0,0,248,28,0,0,16,0,0,0,0,1,0,0,248,1,0,0,1,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,209,150,0,0,221,150,0,0,0,0,0,0,113,150,0,0,1,0,0,0,137,150,0,0,3,0,0,0,161,150,0,0,5,0,0,0,185,150,0,0,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,229,150,0,0,239,150,0,0,15,0,0,0,84,29,0,0,20,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,184,0,0,0,0,0,0,0,254,150,0,0,13,151,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,145,152,0,0,180,29,0,0,149,152,0,0,152,152,0,0,159,152,0,0,161,152,0,0,163,152,0,0,1,0,0,0,2,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,3,0,0,0,9,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,245,158,0,0,246,163,0,0,2,164,0,0,0,0,0,0,2,0,0,0,2,0,0,0,27,164,0,0,32,164,0,0,15,0,0,0,248,29,0,0,20,0,0,0,2,0,0,0,1,0,0,0,2,0,0,0,4,0,0,0,184,0,0,0,10,0,0,0,110,164,0,0,131,164,0,0,149,164,0,0,163,164,0,0,177,164,0,0,0,0,0,0,11,0,0,0,2,0,0,0,195,164,0,0,202,164,0,0,19,0,0,0,68,30,0,0,28,0,0,0,3,0,0,0,1,0,0,0,3,0,0,0,5,0,0,0,192,0,0,0,11,0,0,0,208,165,0,0,0,0,0,0,8,0,0,0,2,0,0,0,231,165,0,0,238,165,0,0,19,0,0,0,128,30,0,0,32,0,0,0,4,0,0,0,1,0,0,0,3,0,0,0,5,0,0,0,192,0,0,0,11,0,0,0,1,166,0,0,24,166,0,0,0,0,0,0,10,0,0,0,2,0,0,0,46,166,0,0,53,166,0,0,19,0,0,0,192,30,0,0,64,0,0,0,5,0,0,0,1,0,0,0,4,0,0,0,6,0,0,0,224,0,0,0,12,0,0,0,67,168,0,0,90,168,0,0,0,0,0,0,9,0,0,0,2,0,0,0,112,168,0,0,119,168,0,0,19,0,0,0,0,31,0,0,48,0,0,0,6,0,0,0,1,0,0,0,4,0,0,0,6,0,0,0,224,0,0,0,12,0,0,0,138,168,0,0,161,168,0,0,0,0,0,0,10,0,0,0,0,0,0,0,183,168,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,1,0,0,160,16,0,0,13,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,50,188,188,243,33,236,236,198,67,32,32,244,201,179,179,219,3,218,218,123,139,2,2,251,43,226,226,200,250,158,158,74,236,201,201,211,9,212,212,230,107,24,24,107,159,30,30,69,14,152,152,125,56,178,178,232,210,166,166,75,183,38,38,214,87,60,60,50,138,147,147,216,238,130,130,253,152,82,82,55,212,123,123,113,55,187,187,241,151,91,91,225,131,71,71,48,60,36,36,15,226,81,81,248,198,186,186,27,243,74,74,135,72,191,191,250,112,13,13,6,179,176,176,63,222,117,117,94,253,210,210,186,32,125,125,174,49,102,102,91,163,58,58,138,28,89,89,0,0,0,0,188,147,205,205,157,224,26,26,109,44,174,174,193,171,127,127,177,199,43,43,14,185,190,190,128,160,224,224,93,16,138,138,210,82,59,59,213,186,100,100,160,136,216,216,132,165,231,231,7,232,95,95,20,17,27,27,181,194,44,44,144,180,252,252,44,39,49,49,163,101,128,128,178,42,115,115,115,129,12,12,76,95,121,121,84,65,107,107,146,2,75,75,116,105,83,83,54,143,148,148,81,31,131,131,56,54,42,42,176,156,196,196,189,200,34,34,90,248,213,213,252,195,189,189,96,120,72,72,98,206,255,255,150,7,76,76,108,119,65,65,66,230,199,199,247,36,235,235,16,20,28,28,124,99,93,93,40,34,54,54,39,192,103,103,140,175,233,233,19,249,68,68,149,234,20,20,156,187,245,245,199,24,207,207,36,45,63,63,70,227,192,192,59,219,114,114,112,108,84,84,202,76,41,41,227,53,240,240,133,254,8,8,203,23,198,198,17,79,243,243,208,228,140,140,147,89,164,164,184,150,202,202,166,59,104,104,131,77,184,184,32,40,56,56,255,46,229,229,159,86,173,173,119,132,11,11,195,29,200,200,204,255,153,153,3,237,88,88,111,154,25,25,8,10,14,14,191,126,149,149,64,80,112,112,231,48,247,247,43,207,110,110,226,110,31,31,121,61,181,181,12,15,9,9,170,52,97,97,130,22,87,87,65,11,159,159,58,128,157,157,234,100,17,17,185,205,37,37,228,221,175,175,154,8,69,69,164,141,223,223,151,92,163,163,126,213,234,234,218,88,53,53,122,208,237,237,23,252,67,67,102,203,248,248,148,177,251,251,161,211,55,55,29,64,250,250,61,104,194,194,240,204,180,180,222,93,50,50,179,113,156,156,11,231,86,86,114,218,227,227,167,96,135,135,28,27,21,21,239,58,249,249,209,191,99,99,83,169,52,52,62,133,154,154,143,66,177,177,51,209,124,124,38,155,136,136,95,166,61,61,236,215,161,161,118,223,228,228,42,148,129,129,73,1,145,145,129,251,15,15,136,170,238,238,238,97,22,22,33,115,215,215,196,245,151,151,26,168,165,165,235,63,254,254,217,181,109,109,197,174,120,120,57,109,197,197,153,229,29,29,205,164,118,118,173,220,62,62,49,103,203,203,139,71,182,182,1,91,239,239,24,30,18,18,35,197,96,96,221,176,106,106,31,246,77,77,78,233,206,206,45,124,222,222,249,157,85,85,72,90,126,126,79,178,33,33,242,122,3,3,101,38,160,160,142,25,94,94,120,102,90,90,92,75,101,101,88,78,98,98,25,69,253,253,141,244,6,6,229,134,64,64,152,190,242,242,87,172,51,51,103,144,23,23,127,142,5,5,5,94,232,232,100,125,79,79,175,106,137,137,99,149,16,16,182,47,116,116,254,117,10,10,245,146,92,92,183,116,155,155,60,51,45,45,165,214,48,48,206,73,46,46,233,137,73,73,104,114,70,70,68,85,119,119,224,216,168,168,77,4,150,150,67,189,40,40,105,41,169,169,41,121,217,217,46,145,134,134,172,135,209,209,21,74,244,244,89,21,141,141,168,130,214,214,10,188,185,185,158,13,66,66,110,193,246,246,71,184,47,47,223,6,221,221,52,57,35,35,53,98,204,204,106,196,241,241,207,18,193,193,220,235,133,133,34,158,143,143,201,161,113,113,192,240,144,144,155,83,170,170,137,241,1,1,212,225,139,139,237,140,78,78,171,111,142,142,18,162,171,171,162,62,111,111,13,84,230,230,82,242,219,219,187,123,146,146,2,182,183,183,47,202,105,105,169,217,57,57,215,12,211,211,97,35,167,167,30,173,162,162,180,153,195,195,80,68,108,108,4,5,7,7,246,127,4,4,194,70,39,39,22,167,172,172,37,118,208,208,134,19,80,80,86,247,220,220,85,26,132,132,9,81,225,225,190,37,122,122,145,239,19,19,57,57,217,169,23,23,144,103,156,156,113,179,166,166,210,232,7,7,5,4,82,82,152,253,128,128,101,163,228,228,223,118,69,69,8,154,75,75,2,146,224,224,160,128,90,90,102,120,175,175,221,228,106,106,176,221,99,99,191,209,42,42,54,56,230,230,84,13,32,32,67,198,204,204,98,53,242,242,190,152,18,18,30,24,235,235,36,247,161,161,215,236,65,65,119,108,40,40,189,67,188,188,50,117,123,123,212,55,136,136,155,38,13,13,112,250,68,68,249,19,251,251,177,148,126,126,90,72,3,3,122,242,140,140,228,208,182,182,71,139,36,36,60,48,231,231,165,132,107,107,65,84,221,221,6,223,96,96,197,35,253,253,69,25,58,58,163,91,194,194,104,61,141,141,21,89,236,236,33,243,102,102,49,174,111,111,62,162,87,87,22,130,16,16,149,99,239,239,91,1,184,184,77,131,134,134,145,46,109,109,181,217,131,131,31,81,170,170,83,155,93,93,99,124,104,104,59,166,254,254,63,235,48,48,214,165,122,122,37,190,172,172,167,22,9,9,15,12,240,240,53,227,167,167,35,97,144,144,240,192,233,233,175,140,157,157,128,58,92,92,146,245,12,12,129,115,49,49,39,44,208,208,118,37,86,86,231,11,146,146,123,187,206,206,233,78,1,1,241,137,30,30,159,107,52,52,169,83,241,241,196,106,195,195,153,180,91,91,151,241,71,71,131,225,24,24,107,230,34,34,200,189,152,152,14,69,31,31,110,226,179,179,201,244,116,116,47,182,248,248,203,102,153,153,255,204,20,20,234,149,88,88,237,3,220,220,247,86,139,139,225,212,21,21,27,28,162,162,173,30,211,211,12,215,226,226,43,251,200,200,29,195,94,94,25,142,44,44,194,181,73,73,137,233,193,193,18,207,149,149,126,191,125,125,32,186,17,17,100,234,11,11,132,119,197,197,109,57,137,137,106,175,124,124,209,51,113,113,161,201,255,255,206,98,187,187,55,113,15,15,251,129,181,181,61,121,225,225,81,9,62,62,220,173,63,63,45,36,118,118,164,205,85,85,157,249,130,130,238,216,64,64,134,229,120,120,174,197,37,37,205,185,150,150,4,77,119,119,85,68,14,14,10,8,80,80,19,134,247,247,48,231,55,55,211,161,250,250,64,29,97,97,52,170,78,78,140,237,176,176,179,6,84,84,108,112,115,115,42,178,59,59,82,210,159,159,11,65,2,2,139,123,216,216,136,160,243,243,79,17,203,203,103,49,39,39,70,194,103,103,192,39,252,252,180,144,56,56,40,32,4,4,127,246,72,72,120,96,229,229,46,255,76,76,7,150,101,101,75,92,43,43,199,177,142,142,111,171,66,66,13,158,245,245,187,156,219,219,242,82,74,74,243,27,61,61,166,95,164,164,89,147,185,185,188,10,249,249,58,239,19,19,239,145,8,8,254,133,145,145,1,73,22,22,97,238,222,222,124,45,33,33,178,79,177,177,66,143,114,114,219,59,47,47,184,71,191,191,72,135,174,174,44,109,192,192,227,70,60,60,87,214,154,154,133,62,169,169,41,105,79,79,125,100,129,129,148,42,46,46,73,206,198,198,23,203,105,105,202,47,189,189,195,252,163,163,92,151,232,232,94,5,237,237,208,122,209,209,135,172,5,5,142,127,100,100,186,213,165,165,168,26,38,38,183,75,190,190,185,14,135,135,96,167,213,213,248,90,54,54,34,40,27,27,17,20,117,117,222,63,217,217,121,41,238,238,170,136,45,45,51,60,121,121,95,76,183,183,182,2,202,202,150,184,53,53,88,218,196,196,156,176,67,67,252,23,132,132,26,85,77,77,246,31,89,89,28,138,178,178,56,125,51,51,172,87,207,207,24,199,6,6,244,141,83,83,105,116,155,155,116,183,151,151,245,196,173,173,86,159,227,227,218,114,234,234,213,126,244,244,74,21,143,143,158,34,171,171,162,18,98,98,78,88,95,95,232,7,29,29,229,153,35,35,57,52,246,246,193,110,108,108,68,80,50,50,93,222,70,70,114,104,160,160,38,101,205,205,147,188,218,218,3,219,186,186,198,248,158,158,250,200,214,214,130,168,110,110,207,43,112,112,80,64,133,133,235,220,10,10,117,254,147,147,138,50,223,223,141,164,41,41,76,202,28,28,20,16,215,215,115,33,180,180,204,240,212,212,9,211,138,138,16,93,81,81,226,15,0,0,0,0,25,25,154,111,26,26,224,157,148,148,143,54,199,199,230,66,201,201,236,74,210,210,253,94,127,127,171,193,168,168,216,224,50,188,117,188,33,236,243,236,67,32,198,32,201,179,244,179,3,218,219,218,139,2,123,2,43,226,251,226,250,158,200,158,236,201,74,201,9,212,211,212,107,24,230,24,159,30,107,30,14,152,69,152,56,178,125,178,210,166,232,166,183,38,75,38,87,60,214,60,138,147,50,147,238,130,216,130,152,82,253,82,212,123,55,123,55,187,113,187,151,91,241,91,131,71,225,71,60,36,48,36,226,81,15,81,198,186,248,186,243,74,27,74,72,191,135,191,112,13,250,13,179,176,6,176,222,117,63,117,253,210,94,210,32,125,186,125,49,102,174,102,163,58,91,58,28,89,138,89,0,0,0,0,147,205,188,205,224,26,157,26,44,174,109,174,171,127,193,127,199,43,177,43,185,190,14,190,160,224,128,224,16,138,93,138,82,59,210,59],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([186,100,213,100,136,216,160,216,165,231,132,231,232,95,7,95,17,27,20,27,194,44,181,44,180,252,144,252,39,49,44,49,101,128,163,128,42,115,178,115,129,12,115,12,95,121,76,121,65,107,84,107,2,75,146,75,105,83,116,83,143,148,54,148,31,131,81,131,54,42,56,42,156,196,176,196,200,34,189,34,248,213,90,213,195,189,252,189,120,72,96,72,206,255,98,255,7,76,150,76,119,65,108,65,230,199,66,199,36,235,247,235,20,28,16,28,99,93,124,93,34,54,40,54,192,103,39,103,175,233,140,233,249,68,19,68,234,20,149,20,187,245,156,245,24,207,199,207,45,63,36,63,227,192,70,192,219,114,59,114,108,84,112,84,76,41,202,41,53,240,227,240,254,8,133,8,23,198,203,198,79,243,17,243,228,140,208,140,89,164,147,164,150,202,184,202,59,104,166,104,77,184,131,184,40,56,32,56,46,229,255,229,86,173,159,173,132,11,119,11,29,200,195,200,255,153,204,153,237,88,3,88,154,25,111,25,10,14,8,14,126,149,191,149,80,112,64,112,48,247,231,247,207,110,43,110,110,31,226,31,61,181,121,181,15,9,12,9,52,97,170,97,22,87,130,87,11,159,65,159,128,157,58,157,100,17,234,17,205,37,185,37,221,175,228,175,8,69,154,69,141,223,164,223,92,163,151,163,213,234,126,234,88,53,218,53,208,237,122,237,252,67,23,67,203,248,102,248,177,251,148,251,211,55,161,55,64,250,29,250,104,194,61,194,204,180,240,180,93,50,222,50,113,156,179,156,231,86,11,86,218,227,114,227,96,135,167,135,27,21,28,21,58,249,239,249,191,99,209,99,169,52,83,52,133,154,62,154,66,177,143,177,209,124,51,124,155,136,38,136,166,61,95,61,215,161,236,161,223,228,118,228,148,129,42,129,1,145,73,145,251,15,129,15,170,238,136,238,97,22,238,22,115,215,33,215,245,151,196,151,168,165,26,165,63,254,235,254,181,109,217,109,174,120,197,120,109,197,57,197,229,29,153,29,164,118,205,118,220,62,173,62,103,203,49,203,71,182,139,182,91,239,1,239,30,18,24,18,197,96,35,96,176,106,221,106,246,77,31,77,233,206,78,206,124,222,45,222,157,85,249,85,90,126,72,126,178,33,79,33,122,3,242,3,38,160,101,160,25,94,142,94,102,90,120,90,75,101,92,101,78,98,88,98,69,253,25,253,244,6,141,6,134,64,229,64,190,242,152,242,172,51,87,51,144,23,103,23,142,5,127,5,94,232,5,232,125,79,100,79,106,137,175,137,149,16,99,16,47,116,182,116,117,10,254,10,146,92,245,92,116,155,183,155,51,45,60,45,214,48,165,48,73,46,206,46,137,73,233,73,114,70,104,70,85,119,68,119,216,168,224,168,4,150,77,150,189,40,67,40,41,169,105,169,121,217,41,217,145,134,46,134,135,209,172,209,74,244,21,244,21,141,89,141,130,214,168,214,188,185,10,185,13,66,158,66,193,246,110,246,184,47,71,47,6,221,223,221,57,35,52,35,98,204,53,204,196,241,106,241,18,193,207,193,235,133,220,133,158,143,34,143,161,113,201,113,240,144,192,144,83,170,155,170,241,1,137,1,225,139,212,139,140,78,237,78,111,142,171,142,162,171,18,171,62,111,162,111,84,230,13,230,242,219,82,219,123,146,187,146,182,183,2,183,202,105,47,105,217,57,169,57,12,211,215,211,35,167,97,167,173,162,30,162,153,195,180,195,68,108,80,108,5,7,4,7,127,4,246,4,70,39,194,39,167,172,22,172,118,208,37,208,19,80,134,80,247,220,86,220,26,132,85,132,81,225,9,225,37,122,190,122,239,19,145,19,217,169,57,217,144,103,23,144,113,179,156,113,210,232,166,210,5,4,7,5,152,253,82,152,101,163,128,101,223,118,228,223,8,154,69,8,2,146,75,2,160,128,224,160,102,120,90,102,221,228,175,221,176,221,106,176,191,209,99,191,54,56,42,54,84,13,230,84,67,198,32,67,98,53,204,98,190,152,242,190,30,24,18,30,36,247,235,36,215,236,161,215,119,108,65,119,189,67,40,189,50,117,188,50,212,55,123,212,155,38,136,155,112,250,13,112,249,19,68,249,177,148,251,177,90,72,126,90,122,242,3,122,228,208,140,228,71,139,182,71,60,48,36,60,165,132,231,165,65,84,107,65,6,223,221,6,197,35,96,197,69,25,253,69,163,91,58,163,104,61,194,104,21,89,141,21,33,243,236,33,49,174,102,49,62,162,111,62,22,130,87,22,149,99,16,149,91,1,239,91,77,131,184,77,145,46,134,145,181,217,109,181,31,81,131,31,83,155,170,83,99,124,93,99,59,166,104,59,63,235,254,63,214,165,48,214,37,190,122,37,167,22,172,167,15,12,9,15,53,227,240,53,35,97,167,35,240,192,144,240,175,140,233,175,128,58,157,128,146,245,92,146,129,115,12,129,39,44,49,39,118,37,208,118,231,11,86,231,123,187,146,123,233,78,206,233,241,137,1,241,159,107,30,159,169,83,52,169,196,106,241,196,153,180,195,153,151,241,91,151,131,225,71,131,107,230,24,107,200,189,34,200,14,69,152,14,110,226,31,110,201,244,179,201,47,182,116,47,203,102,248,203,255,204,153,255,234,149,20,234,237,3,88,237,247,86,220,247,225,212,139,225,27,28,21,27,173,30,162,173,12,215,211,12,43,251,226,43,29,195,200,29,25,142,94,25,194,181,44,194,137,233,73,137,18,207,193,18,126,191,149,126,32,186,125,32,100,234,17,100,132,119,11,132,109,57,197,109,106,175,137,106,209,51,124,209,161,201,113,161,206,98,255,206,55,113,187,55,251,129,15,251,61,121,181,61,81,9,225,81,220,173,62,220,45,36,63,45,164,205,118,164,157,249,85,157,238,216,130,238,134,229,64,134,174,197,120,174,205,185,37,205,4,77,150,4,85,68,119,85,10,8,14,10,19,134,80,19,48,231,247,48,211,161,55,211,64,29,250,64,52,170,97,52,140,237,78,140,179,6,176,179,108,112,84,108,42,178,115,42,82,210,59,82,11,65,159,11,139,123,2,139,136,160,216,136,79,17,243,79,103,49,203,103,70,194,39,70,192,39,103,192,180,144,252,180,40,32,56,40,127,246,4,127,120,96,72,120,46,255,229,46,7,150,76,7,75,92,101,75,199,177,43,199,111,171,142,111,13,158,66,13,187,156,245,187,242,82,219,242,243,27,74,243,166,95,61,166,89,147,164,89,188,10,185,188,58,239,249,58,239,145,19,239,254,133,8,254,1,73,145,1,97,238,22,97,124,45,222,124,178,79,33,178,66,143,177,66,219,59,114,219,184,71,47,184,72,135,191,72,44,109,174,44,227,70,192,227,87,214,60,87,133,62,154,133,41,105,169,41,125,100,79,125,148,42,129,148,73,206,46,73,23,203,198,23,202,47,105,202,195,252,189,195,92,151,163,92,94,5,232,94,208,122,237,208,135,172,209,135,142,127,5,142,186,213,100,186,168,26,165,168,183,75,38,183,185,14,190,185,96,167,135,96,248,90,213,248,34,40,54,34,17,20,27,17,222,63,117,222,121,41,217,121,170,136,238,170,51,60,45,51,95,76,121,95,182,2,183,182,150,184,202,150,88,218,53,88,156,176,196,156,252,23,67,252,26,85,132,26,246,31,77,246,28,138,89,28,56,125,178,56,172,87,51,172,24,199,207,24,244,141,6,244,105,116,83,105,116,183,155,116,245,196,151,245,86,159,173,86,218,114,227,218,213,126,234,213,74,21,244,74,158,34,143,158,162,18,171,162,78,88,98,78,232,7,95,232,229,153,29,229,57,52,35,57,193,110,246,193,68,80,108,68,93,222,50,93,114,104,70,114,38,101,160,38,147,188,205,147,3,219,218,3,198,248,186,198,250,200,158,250,130,168,214,130,207,43,110,207,80,64,112,80,235,220,133,235,117,254,10,117,138,50,147,138,141,164,223,141,76,202,41,76,20,16,28,20,115,33,215,115,204,240,180,204,9,211,212,9,16,93,138,16,226,15,81,226,0,0,0,0,154,111,25,154,224,157,26,224,143,54,148,143,230,66,199,230,236,74,201,236,253,94,210,253,171,193,127,171,216,224,168,216,47,1,0,0,0,0,0,0,174,176,0,0,0,0,0,0,0,0,0,0,16,0,0,0,128,0,0,0,160,16,0,0,13,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,47,138,66,145,68,55,113,207,251,192,181,165,219,181,233,91,194,86,57,241,17,241,89,164,130,63,146,213,94,28,171,152,170,7,216,1,91,131,18,190,133,49,36,195,125,12,85,116,93,190,114,254,177,222,128,167,6,220,155,116,241,155,193,193,105,155,228,134,71,190,239,198,157,193,15,204,161,12,36,111,44,233,45,170,132,116,74,220,169,176,92,218,136,249,118,82,81,62,152,109,198,49,168,200,39,3,176,199,127,89,191,243,11,224,198,71,145,167,213,81,99,202,6,103,41,41,20,133,10,183,39,56,33,27,46,252,109,44,77,19,13,56,83,84,115,10,101,187,10,106,118,46,201,194,129,133,44,114,146,161,232,191,162,75,102,26,168,112,139,75,194,163,81,108,199,25,232,146,209,36,6,153,214,133,53,14,244,112,160,106,16,22,193,164,25,8,108,55,30,76,119,72,39,181,188,176,52,179,12,28,57,74,170,216,78,79,202,156,91,243,111,46,104,238,130,143,116,111,99,165,120,20,120,200,132,8,2,199,140,250,255,190,144,235,108,80,164,247,163,249,190,242,120,113,198,18,0,0,0,0,0,0,0,3,0,0,0,10,183,0,0,12,49,0,0,14,183,0,0,22,183,0,0,31,183,0,0,34,183,0,0,14,183,0,0,3,0,0,0,7,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,8,0,0,0,20,0,0,0,4,0,0,0,21,0,0,0,9,0,0,0,191,193,0,0,195,193,0,0,201,193,0,0,206,193,0,0,212,193,0,0,0,0,0,0,16,0,0,0,7,0,0,0,22,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,22,0,0,0,37,0,0,0,63,0,0,0,92,0,0,0,117,0,0,0,132,0,0,0,147,0,0,0,161,0,0,0,175,0,0,0,190,0,0,0,205,0,0,0,230,0,0,0,243,0,0,0,2,1,0,0,16,1,0,0,27,1,0,0,41,1,0,0,63,1,0,0,79,1,0,0,109,1,0,0,129,1,0,0,153,1,0,0,179,1,0,0,204,1,0,0,222,1,0,0,231,1,0,0,241,1,0,0,1,2,0,0,14,2,0,0,28,2,0,0,47,2,0,0,71,2,0,0,91,2,0,0,107,2,0,0,122,2,0,0,138,2,0,0,154,2,0,0,171,2,0,0,185,2,0,0,201,2,0,0,228,2,0,0,245,2,0,0,9,3,0,0,28,3,0,0,45,3,0,0,65,3,0,0,77,3,0,0,91,3,0,0,104,3,0,0,120,3,0,0,139,3,0,0,158,3,0,0,178,3,0,0,198,3,0,0,212,3,0,0,234,3,0,0,254,3,0,0,6,4,0,0,10,4,0,0,24,4,0,0,47,4,0,0,55,4,0,0,70,4,0,0,83,4,0,0,98,4,0,0,127,4,0,0,156,4,0,0,179,4,0,0,195,4,0,0,211,4,0,0,231,4,0,0,244,4,0,0,3,5,0,0,20,5,0,0,36,5,0,0,53,5,0,0,70,5,0,0,82,5,0,0,95,5,0,0,126,5,0,0,147,5,0,0,167,5,0,0,188,5,0,0,210,5,0,0,222,5,0,0,237,5,0,0,245,5,0,0,2,6,0,0,11,6,0,0,29,6,0,0,40,6,0,0,51,6,0,0,65,6,0,0,85,6,0,0,98,6,0,0,110,6,0,0,124,6,0,0,136,6,0,0,156,6,0,0,175,6,0,0,195,6,0,0,217,6,0,0,241,6,0,0,6,7,0,0,29,7,0,0,50,7,0,0,65,7,0,0,76,7,0,0,96,7,0,0,109,7,0,0,122,7,0,0,139,7,0,0,161,7,0,0,175,7,0,0,195,7,0,0,211,7,0,0,225,7,0,0,236,7,0,0,0,8,0,0,23,8,0,0,44,8,0,0,59,8,0,0,80,8,0,0,102,8,0,0,118,8,0,0,132,8,0,0,148,8,0,0,162,8,0,0,179,8,0,0,191,8,0,0,223,8,0,0,243,8,0,0,255,8,0,0,9,9,0,0,21,9,0,0,39,9,0,0,60,9,0,0,72,9,0,0,87,9,0,0,104,9,0,0,119,9,0,0,135,9,0,0,149,9,0,0,168,9,0,0,187,9,0,0,210,9,0,0,231,9,0,0,255,9,0,0,17,10,0,0,39,10,0,0,62,10,0,0,80,10,0,0,92,10,0,0,110,10,0,0,127,10,0,0,141,10,0,0,158,10,0,0,173,10,0,0,196,10,0,0,215,10,0,0,228,10,0,0,247,10,0,0,15,11,0,0,42,11,0,0,55,11,0,0,80,11,0,0,91,11,0,0,110,11,0,0,122,11,0,0,138,11,0,0,156,11,0,0,183,11,0,0,190,11,0,0,205,11,0,0,221,11,0,0,237,11,0,0,1,12,0,0,14,12,0,0,26,12,0,0,43,12,0,0,55,12,0,0,72,12,0,0,86,12,0,0,102,12,0,0,129,12,0,0,152,12,0,0,175,12,0,0,198,12,0,0,213,12,0,0,230,12,0,0,248,12,0,0,13,13,0,0,32,13,0,0,63,13,0,0,81,13,0,0,99,13,0,0,121,13,0,0,147,13,0,0,174,13,0,0,191,13,0,0,232,13,0,0,8,14,0,0,46,14,0,0,73,14,0,0,103,14,0,0,133,14,0,0,161,14,0,0,198,14,0,0,222,14,0,0,14,15,0,0,56,15,0,0,96,15,0,0,132,15,0,0,143,15,0,0,161,15,0,0,178,15,0,0,209,15,0,0,230,15,0,0,255,15,0,0,14,16,0,0,38,16,0,0,57,16,0,0,93,16,0,0,114,16,0,0,143,16,0,0,163,16,0,0,190,16,0,0,218,16,0,0,233,16,0,0,244,16,0,0,5,17,0,0,42,17,0,0,87,17,0,0,131,17,0,0,171,17,0,0,209,17,0,0,247,17,0,0,33,18,0,0,67,18,0,0,112,18,0,0,157,18,0,0,170,18,0,0,180,18,0,0,193,18,0,0,228,18,0,0,248,18,0,0,10,19,0,0,33,19,0,0,57,19,0,0,78,19,0,0,106,19,0,0,136,19,0,0,164,19,0,0,184,19,0,0,208,19,0,0,235,19,0,0,253,19,0,0,15,20,0,0,43,20,0,0,58,20,0,0,74,20,0,0,102,20,0,0,125,20,0,0,145,20,0,0,162,20,0,0,190,20,0,0,214,20,0,0,239,20,0,0,3,21,0,0,23,21,0,0,42,21,0,0,71,21,0,0,95,21,0,0,123,21,0,0,150,21,0,0,176,21,0,0,205,21,0,0,229,21,0,0,254,21,0,0,25,22,0,0,54,22,0,0,71,22,0,0,96,22,0,0,119,22,0,0,141,22,0,0,160,22,0,0,182,22,0,0,215,22,0,0,245,22,0,0,12,23,0,0,47,23,0,0,63,23,0,0,83,23,0,0,103,23,0,0,120,23,0,0,147,23,0,0,160,23,0,0,182,23,0,0,202,23,0,0,230,23,0,0,2,24,0,0,21,24,0,0,39,24,0,0,80,24,0,0,120,24,0,0,159,24,0,0,173,24,0,0,208,24,0,0,247,24,0,0,24,25,0,0,51,25,0,0,74,25,0,0,104,25,0,0,135,25,0,0,164,25,0,0,190,25,0,0,213,25,0,0,233,25,0,0,252,25,0,0,22,26,0,0,43,26,0,0,76,26,0,0,113,26,0,0,147,26,0,0,172,26,0,0,201,26,0,0,221,26,0,0,248,26,0,0,28,27,0,0,50,27,0,0,72,27,0,0,100,27,0,0,139,27,0,0,173,27,0,0,195,27,0,0,227,27,0,0,250,27,0,0,31,28,0,0,60,28,0,0,77,28,0,0,105,28,0,0,132,28,0,0,153,28,0,0,180,28,0,0,204,28,0,0,219,28,0,0,247,28,0,0,15,29,0,0,34,29,0,0,56,29,0,0,93,29,0,0,119,29,0,0,145,29,0,0,171,29,0,0,197,29,0,0,223,29,0,0,249,29,0,0,19,30,0,0,45,30,0,0,71,30,0,0,98,30,0,0,125,30,0,0,152,30,0,0,179,30,0,0,206,30,0,0,233,30,0,0,4,31,0,0,27,31,0,0,48,31,0,0,60,31,0,0,7,0,0,0,13,0,0,0,98,0,0,0,99,0,0,0,68,0,0,0,97,0,0,0,11,0,0,0,114,0,0,0,0,0,0,0,0,0,0,0,52,0,0,0,9,0,0,0,77,0,0,0,74,0,0,0,53,0,0,0,0,0,0,0,56,0,0,0,57,0,0,0,59,0,0,0,16,0,0,0,125,0,0,0,10,0,0,0,44,0,0,0,70,0,0,0,103,0,0,0,111,0,0,0,104,0,0,0,0,0,0,0,35,0,0,0,35,0,0,0,89,0,0,0,0,0,0,0,33,0,0,0,73,0,0,0,122,0,0,0,17,0,0,0,14,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,0,113,0,0,0,43,0,0,0,0,0,0,0,84,0,0,0,115,0,0,0,4,0,0,0,22,0,0,0,5,0,0,0,106,0,0,0,21,0,0,0,120,0,0,0,51,0,0,0,45,0,0,0,46,0,0,0,47,0,0,0,79,0,0,0,80,0,0,0,83,0,0,0,82,0,0,0,81,0,0,0,48,0,0,0,40,0,0,0,124,0,0,0,24,0,0,0,31,0,0,0,90,0,0,0,72,0,0,0,36,0,0,0,119,0,0,0,0,0,0,0,100,0,0,0,102,0,0,0,101,0,0,0,23,0,0,0,55,0,0,0,105,0,0,0,50,0,0,0,61,0,0,0,19,0,0,0,2,0,0,0,8,0,0,0,37,0,0,0,67,0,0,0,123,0,0,0,12,0,0,0,42,0,0,0,64,0,0,0,65,0,0,0,92,0,0,0,28,0,0,0,63,0,0,0,60,0,0,0,38,0,0,0,15,0,0,0,107,0,0,0,20,0,0,0,39,0,0,0,118,0,0,0,88,0,0,0,95,0,0,0,25,0,0,0,76,0,0,0,6,0,0,0,95,0,0,0,75,0,0,0,1,0,0,0,96,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,0,0,0,93,0,0,0,91,0,0,0,34,0,0,0,78,0,0,0,66,0,0,0,121,0,0,0,85,0,0,0,30,0,0,0,0,0,0,0,108,0,0,0,94,0,0,0,29,0,0,0,3,0,0,0,69,0,0,0,116,0,0,0,86,0,0,0,62,0,0,0,110,0,0,0,109,0,0,0,26,0,0,0,117,0,0,0,49,0,0,0,87,0,0,0,11,0,0,0,18,0,0,0,54,0,0,0,107,128,0,0,81,128,0,0,127,128,0,0,47,128,0,0,49,128,0,0,104,128,0,0,0,128,0,0,82,128,0,0,11,128,0,0,21,128,0,0,6,128,0,0,138,128,0,0,86,128,0,0,1,128,0,0,36,128,0,0,95,128,0,0,19,128,0,0,35,128,0,0,139,128,0,0,80,128,0,0,97,128,0,0,51,128,0,0,48,128,0,0,75,128,0,0,65,128,0,0,102,128,0,0,134,128,0,0,37,128,0,0,91,128,0,0,126,128,0,0,122,128,0,0,66,128,0,0,109,128,0,0,32,128,0,0,117,128,0,0,28,128,0,0,29,128,0,0,69,128,0,0,83,128,0,0,94,128,0,0,98,128,0,0,63,128,0,0,87,128,0,0,43,128,0,0,22,128,0,0,54,128,0,0,55,128,0,0,56,128,0,0,62,128,0,0,136,128,0,0,78,128,0,0,53,128,0,0,10,128,0,0,14,128,0,0,140,128,0,0,76,128,0,0,16,128,0,0,17,128,0,0,18,128,0,0,93,128,0,0,79,128,0,0,131,128,0,0,92,128,0,0,88,128,0,0,89,128,0,0,119,128,0,0,84,128,0,0,4,128,0,0,128,128,0,0,23,128,0,0,114,128,0,0,68,128,0,0,33,128,0,0,13,128,0,0,106,128,0,0,103,128,0,0,12,128,0,0,118,128,0,0,57,128,0,0,58,128,0,0,61,128,0,0,60,128,0,0,59,128,0,0,45,128,0,0,121,128,0,0,130,128,0,0,137,128,0,0,100,128,0,0,30,128,0,0,67,128,0,0,116,128,0,0,90,128,0,0,115,128,0,0,125,128,0,0,101,128,0,0,105,128,0,0,108,128,0,0,5,128,0,0,2,128,0,0,3,128,0,0,72,128,0,0,74,128,0,0,73,128,0,0,24,128,0,0,26,128,0,0,77,128,0,0,50,128,0,0,96,128,0,0,124,128,0,0,133,128,0,0,132,128,0,0,25,128,0,0,41,128,0,0,42,128,0,0,7,128,0,0,46,128,0,0,129,128,0,0,135,128,0,0,99,128,0,0,70,128,0,0,52,128,0,0,120,128,0,0,34,128,0,0,85,128,0,0,64,128,0,0,20,128,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,5,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,0,0,0,24,0,0,0,176,24,1,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,20,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,60,0,0,128,61,0,0,5,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,24,0,0,0,184,28,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,192,3,0,0,192,4,0,0,192,5,0,0,192,6,0,0,192,7,0,0,192,8,0,0,192,9,0,0,192,10,0,0,192,11,0,0,192,12,0,0,192,13,0,0,192,14,0,0,192,15,0,0,192,16,0,0,192,17,0,0,192,18,0,0,192,19,0,0,192,20,0,0,192,21,0,0,192,22,0,0,192,23,0,0,192,24,0,0,192,25,0,0,192,26,0,0,192,27,0,0,192,28,0,0,192,29,0,0,192,30,0,0,192,31,0,0,192,0,0,0,179,1,0,0,195,2,0,0,195,3,0,0,195,4,0,0,195,5,0,0,195,6,0,0,195,7,0,0,195,8,0,0,195,9,0,0,195,10,0,0,195,11,0,0,195,12,0,0,195,13,0,0,211,14,0,0,195,15,0,0,195,0,0,12,187,1,0,12,195,2,0,12,195,3,0,12,195,4,0,12,211,32,0,0,0,9,0,0,0,10,0,0,0,13,0,0,0,11,0,0,0,12,0,0,0,133,0,0,0,0,32,0,0,1,32,0,0,2,32,0,0,3,32,0,0,4,32,0,0,5,32,0,0,6,32,0,0,8,32,0,0,9,32,0,0,10,32,0,0,40,32,0,0,41,32,0,0,95,32,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,172,63,0,0,3,0,0,0,0,0,0,0,45,244,81,88,207,140,177,192,70,246,181,203,41,49,3,199,4,91,112,48,180,93,253,32,120,127,139,154,216,89,41,80,104,72,137,171,167,86,3,108,255,183,205,136,63,212,119,180,43,165,163,112,241,186,228,168,252,65,131,253,217,111,225,138,122,47,45,116,150,7,31,13,9,94,3,118,44,112,247,64,165,44,167,111,87,65,168,170,116,223,160,88,100,3,74,199,196,60,83,174,175,95,24,4,21,177,227,109,40,134,171,12,164,191,67,240,233,80,129,57,87,22,82,55,3,0,5,0,7,0,11,0,13,0,17,0,19,0,23,0,29,0,31,0,37,0,41,0,43,0,47,0,53,0,59,0,61,0,67,0,71,0,73,0,79,0,83,0,89,0,97,0,101,0,103,0,107,0,109,0,113,0,127,0,131,0,137,0,139,0,149,0,151,0,157,0,163,0,167,0,173,0,179,0,181,0,191,0,193,0,197,0,199,0,211,0,223,0,227,0,229,0,233,0,239,0,241,0,251,0,1,1,7,1,13,1,15,1,21,1,25,1,27,1,37,1,51,1,55,1,57,1,61,1,75,1,81,1,91,1,93,1,97,1,103,1,111,1,117,1,123,1,127,1,133,1,141,1,145,1,153,1,163,1,165,1,175,1,177,1,183,1,187,1,193,1,201,1,205,1,207,1,211,1,223,1,231,1,235,1,243,1,247,1,253,1,9,2,11,2,29,2,35,2,45,2,51,2,57,2,59,2,65,2,75,2,81,2,87,2,89,2,95,2,101,2,105,2,107,2,119,2,129,2,131,2,135,2,141,2,147,2,149,2,161,2,165,2,171,2,179,2,189,2,197,2,207,2,215,2,221,2,227,2,231,2,239,2,245,2,249,2,1,3,5,3,19,3,29,3,41,3,43,3,53,3,55,3,59,3,61,3,71,3,85,3,89,3,91,3,95,3,109,3,113,3,115,3,119,3,139,3,143,3,151,3,161,3,169,3,173,3,179,3,185,3,199,3,203,3,209,3,215,3,223,3,229,3,241,3,245,3,251,3,253,3,7,4,9,4,15,4,25,4,27,4,37,4,39,4,45,4,63,4,67,4,69,4,73,4,79,4,85,4,93,4,99,4,105,4,127,4,129,4,139,4,147,4,157,4,163,4,169,4,177,4,189,4,193,4,199,4,205,4,207,4,213,4,225,4,235,4,253,4,255,4,3,5,9,5,11,5,17,5,21,5,23,5,27,5,39,5,41,5,47,5,81,5,87,5,93,5,101,5,119,5,129,5,143,5,147,5,149,5,153,5,159,5,167,5,171,5,173,5,179,5,191,5,201,5,203,5,207,5,209,5,213,5,219,5,231,5,243,5,251,5,7,6,13,6,17,6,23,6,31,6,35,6,43,6,47,6,61,6,65,6,71,6,73,6,77,6,83,6,85,6,91,6,101,6,121,6,127,6,131,6,133,6,157,6,161,6,163,6,173,6,185,6,187,6,197,6,205,6,211,6,217,6,223,6,241,6,247,6,251,6,253,6,9,7,19,7,31,7,39,7,55,7,69,7,75,7,79,7,81,7,85,7,87,7,97,7,109,7,115,7,121,7,139,7,141,7,157,7,159,7,181,7,187,7,195,7,201,7,205,7,207,7,211,7,219,7,225,7,235,7,237,7,247,7,5,8,15,8,21,8,33,8,35,8,39,8,41,8,51,8,63,8,65,8,81,8,83,8,89,8,93,8,95,8,105,8,113,8,131,8,155,8,159,8,165,8,173,8,189,8,191,8,195,8,203,8,219,8,221,8,225,8,233,8,239,8,245,8,249,8,5,9,7,9,29,9,35,9,37,9,43,9,47,9,53,9,67,9,73,9,77,9,79,9,85,9,89,9,95,9,107,9,113,9,119,9,133,9,137,9,143,9,155,9,163,9,169,9,173,9,199,9,217,9,227,9,235,9,239,9,245,9,247,9,253,9,19,10,31,10,33,10,49,10,57,10,61,10,73,10,87,10,97,10,99,10,103,10,111,10,117,10,123,10,127,10,129,10,133,10,139,10,147,10,151,10,153,10,159,10,169,10,171,10,181,10,189,10,193,10,207,10,217,10,229,10,231,10,237,10,241,10,243,10,3,11,17,11,21,11,27,11,35,11,41,11,45,11,63,11,71,11,81,11,87,11,93,11,101,11,111,11,123,11,137,11,141,11,147,11,153,11,155,11,183,11,185,11,195,11,203,11,207,11,221,11,225,11,233,11,245,11,251,11,7,12,11,12,17,12,37,12,47,12,49,12,65,12,91,12,95,12,97,12,109,12,115,12,119,12,131,12,137,12,145,12,149,12,157,12,179,12,181,12,185,12,187,12,199,12,227,12,229,12,235,12,241,12,247,12,251,12,1,13,3,13,15,13,19,13,31,13,33,13,43,13,45,13,61,13,63,13,79,13,85,13,105,13,121,13,129,13,133,13,135,13,139,13,141,13,163,13,171,13,183,13,189,13,199,13,201,13,205,13,211,13,213,13,219,13,229,13,231,13,243,13,253,13,255,13,9,14,23,14,29,14,33,14,39,14,47,14,53,14,59,14,75,14,87,14,89,14,93,14,107,14,113,14,117,14,125,14,135,14,143,14,149,14,155,14,177,14,183,14,185,14,195,14,209,14,213,14,219,14,237,14,239,14,249,14,7,15,11,15,13,15,23,15,37,15,41,15,49,15,67,15,71,15,77,15,79,15,83,15,89,15,91,15,103,15,107,15,127,15,149,15,161,15,163,15,167,15,173,15,179,15,181,15,187,15,209,15,211,15,217,15,233,15,239,15,251,15,253,15,3,16,15,16,31,16,33,16,37,16,43,16,57,16,61,16,63,16,81,16,105,16,115,16,121,16,123,16,133,16,135,16,145,16,147,16,157,16,163,16,165,16,175,16,177,16,187,16,193,16,201,16,231,16,241,16,243,16,253,16,5,17,11,17,21,17,39,17,45,17,57,17,69,17,71,17,89,17,95,17,99,17,105,17,111,17,129,17,131,17,141,17,155,17,161,17,165,17,167,17,171,17,195,17,197,17,209,17,215,17,231,17,239,17,245,17,251,17,13,18,29,18,31,18,35,18,41,18,43,18,49,18,55,18,65,18,71,18,83,18,95,18,113,18,115,18,121,18,125,18,143,18,151,18,175,18,179,18,181,18,185,18,191,18,193,18,205,18,209,18,223,18,253,18,7,19,13,19,25,19,39,19,45,19,55,19,67,19,69,19,73,19,79,19,87,19,93,19,103,19,105,19,109,19,123,19,129,19,135,19,0,0,0,0,194,1,132,3,70,2,8,7,202,6,140,4,78,5,16,14,210,15,148,13,86,12,24,9,218,8,156,10,94,11,32,28,226,29,164,31,102,30,40,27,234,26,172,24,110,25,48,18,242,19,180,17,118,16,56,21,250,20,188,22,126,23,64,56,130,57,196,59,6,58,72,63,138,62,204,60,14,61,80,54,146,55,212,53,22,52,88,49,154,48,220,50,30,51,96,36,162,37,228,39,38,38,104,35,170,34,236,32,46,33,112,42,178,43,244,41,54,40,120,45,186,44,252,46,62,47,128,112,66,113,4,115,198,114,136,119,74,118,12,116,206,117,144,126,82,127,20,125,214,124,152,121,90,120,28,122,222,123,160,108,98,109,36,111,230,110,168,107,106,106,44,104,238,105,176,98,114,99,52,97,246,96,184,101,122,100,60,102,254,103,192,72,2,73,68,75,134,74,200,79,10,78,76,76,142,77,208,70,18,71,84,69,150,68,216,65,26,64,92,66,158,67,224,84,34,85,100,87,166,86,232,83,42,82,108,80,174,81,240,90,50,91,116,89,182,88,248,93,58,92,124,94,190,95,0,225,194,224,132,226,70,227,8,230,202,231,140,229,78,228,16,239,210,238,148,236,86,237,24,232,218,233,156,235,94,234,32,253,226,252,164,254,102,255,40,250,234,251,172,249,110,248,48,243,242,242,180,240,118,241,56,244,250,245,188,247,126,246,64,217,130,216,196,218,6,219,72,222,138,223,204,221,14,220,80,215,146,214,212,212,22,213,88,208,154,209,220,211,30,210,96,197,162,196,228,198,38,199,104,194,170,195,236,193,46,192,112,203,178,202,244,200,54,201,120,204,186,205,252,207,62,206,128,145,66,144,4,146,198,147,136,150,74,151,12,149,206,148,144,159,82,158,20,156,214,157,152,152,90,153,28,155,222,154,160,141,98,140,36,142,230,143,168,138,106,139,44,137,238,136,176,131,114,130,52,128,246,129,184,132,122,133,60,135,254,134,192,169,2,168,68,170,134,171,200,174,10,175,76,173,142,172,208,167,18,166,84,164,150,165,216,160,26,161,92,163,158,162,224,181,34,180,100,182,166,183,232,178,42,179,108,177,174,176,240,187,50,186,116,184,182,185,248,188,58,189,124,191,190,190,73,0,49,1,83,0,127,1,48,1,105,0,120,1,255,0,129,1,83,2,130,1,131,1,132,1,133,1,134,1,84,2,135,1,136,1,137,1,86,2,138,1,87,2,139,1,140,1,142,1,221,1,143,1,89,2,144,1,91,2,145,1,146,1,147,1,96,2,148,1,99,2,150,1,105,2,151,1,104,2,152,1,153,1,156,1,111,2,157,1,114,2,159,1,117,2,166,1,128,2,167,1,168,1,169,1,131,2,172,1,173,1,174,1,136,2,175,1,176,1,177,1,138,2,178,1,139,2,183,1,146,2,184,1,185,1,188,1,189,1,196,1,198,1,196,1,197,1,197,1,198,1,199,1,201,1,199,1,200,1,200,1,201,1,202,1,204,1,202,1,203,1,203,1,204,1,241,1,243,1,241,1,242,1,242,1,243,1,244,1,245,1,246,1,149,1,247,1,191,1,32,2,158,1,134,3,172,3,136,3,173,3,137,3,174,3,138,3,175,3,140,3,204,3,142,3,205,3,143,3,206,3,153,3,69,3,153,3,190,31,163,3,194,3,247,3,248,3,250,3,251,3,96,30,155,30,158,30,223,0,89,31,81,31,91,31,83,31,93,31,85,31,95,31,87,31,188,31,179,31,204,31,195,31,236,31,229,31,252,31,243,31,58,2,101,44,59,2,60,2,61,2,154,1,62,2,102,44,65,2,66,2,67,2,128,1,68,2,137,2,69,2,140,2,244,3,184,3,249,3,242,3,253,3,123,3,254,3,124,3,255,3,125,3,192,4,207,4,38,33,201,3,42,33,107,0,43,33,229,0,50,33,78,33,131,33,132,33,96,44,97,44,98,44,107,2,99,44,125,29,100,44,125,2,109,44,81,2,110,44,113,2,111,44,80,2,112,44,82,2,114,44,115,44,117,44,118,44,126,44,63,2,127,44,64,2,242,44,243,44,125,167,121,29,139,167,140,167,141,167,101,2,170,167,102,2,199,16,39,45,205,16,45,45,118,3,119,3,156,3,181,0,146,3,208,3,152,3,209,3,166,3,213,3,160,3,214,3,154,3,240,3,161,3,241,3,149,3,245,3,207,3,215,3,0,0,0,0,65,0,32,26,192,0,32,31,0,1,1,47,50,1,1,5,57,1,1,15,74,1,1,45,121,1,1,5,112,3,1,3,145,3,32,17,163,3,32,9,0,4,80,16,16,4,32,32,96,4,1,33,138,4,1,53,193,4,1,13,208,4,1,63,20,5,1,19,49,5,48,38,160,1,1,5,179,1,1,3,205,1,1,15,222,1,1,17,248,1,1,39,34,2,1,17,216,3,1,23,0,30,1,149,160,30,1,95,8,31,248,8,24,31,248,6,40,31,248,8,56,31,248,8,72,31,248,6,104,31,248,8,136,31,248,8,152,31,248,8,168,31,248,8,184,31,248,2,186,31,182,2,200,31,170,4,216,31,248,2,218,31,156,2,232,31,248,2,234,31,144,2,248,31,128,2,250,31,130,2,70,2,1,9,16,5,1,3,96,33,16,16,0,44,48,47,103,44,1,5,128,44,1,99,235,44,1,3,64,166,1,45,128,166,1,23,34,167,1,13,50,167,1,61,121,167,1,3,126,167,1,9,144,167,1,3,160,167,1,9,33,255,32,26,0,0,0,0,119,114,97,112,46,99,0,99,111,109,109,111,110,95,97,108,108,111,99,97,116,105,111,110,46,99,0,71,78,85,78,69,84,95,120,109,97,108,108,111,99,95,0,109,97,108,108,111,99,0,71,78,85,78,69,84,95,120,102,114,101,101,95,0,71,78,85,78,69,84,95,115,110,112,114,105,110,116,102,0,99,111,109,109,111,110,95,108,111,103,103,105,110,103,46,99,0,37,115,45,37,100,0,109,121,108,111,103,0,108,111,99,97,108,116,105,109,101,32,101,114,114,111,114,0,37,98,32,37,100,32,37,72,58,37,77,58,37,83,45,37,37,48,54,117,0,42,32,37,115,0,37,115,32,37,115,32,37,115,32,37,115,0,69,82,82,79,82,0,87,65,82,78,73,78,71,0,77,69,83,83,65,71,69,0,73,78,70,79,0,68,69,66,85,71,0,78,79,78,69,0,73,78,86,65,76,73,68,0,77,101,115,115,97,103,101,32,96,37,46,42,115,39,32,114,101,112,101,97,116,101,100,32,37,117,32,116,105,109,101,115,32,105,110,32,116,104,101,32,108,97,115,116,32,37,115,10,0,71,78,85,78,69,84,95,108,111,103,95,115,107,105,112,0,99,114,121,112,116,111,95,115,121,109,109,101,116,114,105,99,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,115,121,109,109,101,116,114,105,99,95,101,110,99,114,121,112,116,0,115,101,116,117,112,95,99,105,112,104,101,114,95,116,119,111,102,105,115,104,0,115,101,116,117,112,95,99,105,112,104,101,114,95,97,101,115,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,115,121,109,109,101,116,114,105,99,95,100,101,99,114,121,112,116,0,99,114,121,112,116,111,95,101,99,99,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,115,97,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,113,64,101,100,100,115,97,0,40,112,114,105,118,97,116,101,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,100,32,37,98,41,41,41,0,100,101,99,111,100,101,95,112,114,105,118,97,116,101,95,101,99,100,115,97,95,107,101,121,0,103,99,114,121,95,115,101,120,112,95,98,117,105,108,100,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,40,112,114,105,118,97,116,101,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,32,101,100,100,115,97,41,40,100,32,37,98,41,41,41,0,100,101,99,111,100,101,95,112,114,105,118,97,116,101,95,101,100,100,115,97,95,107,101,121,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,104,101,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,100,101,99,111,100,101,95,112,114,105,118,97,116,101,95,101,99,100,104,101,95,107,101,121,0,40,103,101,110,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,32,101,100,100,115,97,32,110,111,45,107,101,121,116,101,115,116,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,104,101,95,107,101,121,95,99,114,101,97,116,101,0,103,99,114,121,95,112,107,95,103,101,110,107,101,121,0,107,101,121,95,102,114,111,109,95,115,101,120,112,0,40,103,101,110,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,115,97,95,107,101,121,95,99,114,101,97,116,101,0,40,103,101,110,107,101,121,40,101,99,99,40,99,117,114,118,101,32,34,69,100,50,53,53,49,57,34,41,40,102,108,97,103,115,32,101,100,100,115,97,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,107,101,121,95,99,114,101,97,116,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,115,105,103,110,0,69,100,68,83,65,32,115,105,103,110,105,110,103,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,58,32,37,115,10,0,40,100,97,116,97,40,102,108,97,103,115,32,101,100,100,115,97,41,40,104,97,115,104,45,97,108,103,111,32,37,115,41,40,118,97,108,117,101,32,37,98,41,41,0,100,97,116,97,95,116,111,95,101,100,100,115,97,95,118,97,108,117,101,0,40,112,117,98,108,105,99,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,69,100,50,53,53,49,57,41,40,113,32,37,98,41,41,41,0,40,115,105,103,45,118,97,108,40,101,100,100,115,97,40,114,32,37,98,41,40,115,32,37,98,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,100,100,115,97,95,118,101,114,105,102,121,0,40,112,117,98,108,105,99,45,107,101,121,40,101,99,99,40,99,117,114,118,101,32,69,100,50,53,53,49,57,41,40,102,108,97,103,115,32,101,100,100,115,97,41,40,113,32,37,98,41,41,41,0,69,100,68,83,65,32,115,105,103,110,97,116,117,114,101,32,118,101,114,105,102,105,99,97,116,105,111,110,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,58,32,37,115,10,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,99,95,101,99,100,104,0,103,101,116,95,97,102,102,105,110,101,32,102,97,105,108,101,100,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,101,99,100,104,95,101,100,100,115,97,0,99,114,121,112,116,111,95,104,97,115,104,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,104,97,115,104,95,99,111,110,116,101,120,116,95,115,116,97,114,116,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,104,97,115,104,95,99,111,110,116,101,120,116,95,102,105,110,105,115,104,0,99,114,121,112,116,111,95,107,100,102,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,107,100,102,95,109,111,100,95,109,112,105,0,99,114,121],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240);allocate([112,116,111,95,109,112,105,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,109,112,105,95,112,114,105,110,116,95,117,110,115,105,103,110,101,100,0,96,37,115,39,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,32,119,105,116,104,32,101,114,114,111,114,58,32,37,115,10,0,103,99,114,121,95,109,112,105,95,112,114,105,110,116,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,109,112,105,95,115,99,97,110,95,117,110,115,105,103,110,101,100,0,103,99,114,121,95,109,112,105,95,115,99,97,110,0,49,46,54,46,48,0,108,105,98,103,99,114,121,112,116,32,104,97,115,32,110,111,116,32,116,104,101,32,101,120,112,101,99,116,101,100,32,118,101,114,115,105,111,110,32,40,118,101,114,115,105,111,110,32,37,115,32,105,115,32,114,101,113,117,105,114,101,100,41,46,10,0,99,114,121,112,116,111,95,114,97,110,100,111,109,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,97,110,100,111,109,95,105,110,105,116,0,70,97,105,108,101,100,32,116,111,32,115,101,116,32,108,105,98,103,99,114,121,112,116,32,111,112,116,105,111,110,32,37,115,58,32,37,115,10,0,68,73,83,65,66,76,69,95,83,69,67,77,69,77,0,69,78,65,66,76,69,95,81,85,73,67,75,95,82,65,78,68,79,77,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,97,110,100,111,109,95,117,51,50,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,97,110,100,111,109,95,98,108,111,99,107,0,40,103,101,110,107,101,121,40,114,115,97,40,110,98,105,116,115,32,37,100,41,41,41,0,99,114,121,112,116,111,95,114,115,97,46,99,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,99,114,101,97,116,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,101,110,99,111,100,101,0,117,116,105,108,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,100,101,99,111,100,101,0,68,101,99,111,100,101,100,32,112,114,105,118,97,116,101,32,107,101,121,32,105,115,32,110,111,116,32,118,97,108,105,100,10,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,114,105,118,97,116,101,95,107,101,121,95,103,101,116,95,112,117,98,108,105,99,0,69,120,116,101,114,110,97,108,32,112,114,111,116,111,99,111,108,32,118,105,111,108,97,116,105,111,110,32,100,101,116,101,99,116,101,100,32,97,116,32,37,115,58,37,100,46,10,0,40,112,117,98,108,105,99,45,107,101,121,40,114,115,97,40,110,32,37,109,41,40,101,32,37,109,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,117,98,108,105,99,95,107,101,121,95,101,110,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,112,117,98,108,105,99,95,107,101,121,95,100,101,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,115,105,103,110,97,116,117,114,101,95,101,110,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,98,108,105,110,100,0,110,117,109,101,114,105,99,95,109,112,105,95,97,108,108,111,99,95,110,95,112,114,105,110,116,0,66,108,105,110,100,105,110,103,32,75,68,70,32,101,120,116,114,97,116,111,114,32,72,77,65,67,32,107,101,121,0,114,115,97,95,98,108,105,110,100,105,110,103,95,107,101,121,95,100,101,114,105,118,101,0,66,108,105,110,100,105,110,103,32,75,68,70,0,114,115,97,95,102,117,108,108,95,100,111,109,97,105,110,95,104,97,115,104,0,82,83,65,45,70,68,65,32,70,84,112,115,87,33,0,40,100,97,116,97,32,40,102,108,97,103,115,32,114,97,119,41,32,40,118,97,108,117,101,32,37,77,41,41,0,109,112,105,95,116,111,95,115,101,120,112,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,115,105,103,110,97,116,117,114,101,95,100,101,99,111,100,101,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,117,110,98,108,105,110,100,0,40,115,105,103,45,118,97,108,32,40,114,115,97,32,40,115,32,37,77,41,41,41,0,71,78,85,78,69,84,95,67,82,89,80,84,79,95,114,115,97,95,118,101,114,105,102,121,0,82,83,65,32,115,105,103,110,97,116,117,114,101,32,118,101,114,105,102,105,99,97,116,105,111,110,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,58,32,37,115,10,0,115,116,114,105,110,103,115,46,99,0,37,108,108,117,32,37,115,0,102,111,114,101,118,101,114,0,109,115,0,109,0,100,97,121,0,100,97,121,115,0,194,181,115,0,48,32,109,115,0,71,78,85,78,69,84,95,83,84,82,73,78,71,83,95,100,97,116,97,95,116,111,95,115,116,114,105,110,103,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,74,75,77,78,80,81,82,83,84,86,87,88,89,90,0,71,78,85,78,69,84,95,83,84,82,73,78,71,83,95,115,116,114,105,110,103,95,116,111,95,100,97,116,97,0,118,105,115,105,98,105,108,105,116,121,46,99,0,103,99,114,121,95,109,100,95,104,97,115,104,95,98,117,102,102,101,114,0,99,97,108,108,101,100,32,105,110,32,110,111,110,45,111,112,101,114,97,116,105,111,110,97,108,32,115,116,97,116,101,0,103,99,114,121,95,109,100,95,103,101,116,95,97,108,103,111,0,117,115,101,100,32,105,110,32,110,111,110,45,111,112,101,114,97,116,105,111,110,97,108,32,115,116,97,116,101,0,103,99,114,121,95,114,97,110,100,111,109,105,122,101,0,103,99,114,121,95,99,114,101,97,116,101,95,110,111,110,99,101,0,109,105,115,99,46,99,0,95,103,99,114,121,95,102,97,116,97,108,95,101,114,114,111,114,0,10,70,97,116,97,108,32,101,114,114,111,114,58,32,0,70,97,116,97,108,58,32,0,79,104,104,104,104,32,106,101,101,101,101,58,32,0,68,66,71,58,32,0,91,85,110,107,110,111,119,110,32,108,111,103,32,108,101,118,101,108,32,37,100,93,58,32,0,95,103,99,114,121,95,108,111,103,118,0,105,110,116,101,114,110,97,108,32,101,114,114,111,114,32,40,102,97,116,97,108,32,111,114,32,98,117,103,41,0,46,46,46,32,116,104,105,115,32,105,115,32,97,32,98,117,103,32,40,37,115,58,37,100,58,37,115,41,10,0,65,115,115,101,114,116,105,111,110,32,96,37,115,39,32,102,97,105,108,101,100,32,40,37,115,58,37,100,58,37,115,41,10,0,32,0,37,115,58,37,115,0,37,42,115,32,32,0,37,48,50,120,0,32,92,10,0,37,42,115,32,37,42,115,0,32,40,110,117,108,108,41,0,32,91,37,117,32,98,105,116,93,0,32,91,111,117,116,32,111,102,32,99,111,114,101,93,0,45,0,43,0,100,105,118,105,100,101,32,98,121,32,122,101,114,111,0,103,108,111,98,97,108,46,99,0,103,108,111,98,97,108,95,105,110,105,116,0,49,46,55,46,48,45,98,101,116,97,50,51,48,0,118,101,114,115,105,111,110,58,37,115,58,10,0,99,105,112,104,101,114,115,58,37,115,58,10,0,97,101,115,58,116,119,111,102,105,115,104,0,112,117,98,107,101,121,115,58,37,115,58,10,0,114,115,97,58,101,99,99,0,100,105,103,101,115,116,115,58,37,115,58,10,0,115,104,97,50,53,54,58,115,104,97,53,49,50,0,114,110,100,45,109,111,100,58,108,105,110,117,120,58,10,0,99,112,117,45,97,114,99,104,58,58,10,0,109,112,105,45,97,115,109,58,37,115,58,10,0,104,119,102,108,105,115,116,58,0,37,115,58,0,10,0,102,105,112,115,45,109,111,100,101,58,37,99,58,37,99,58,10,0,112,114,105,110,116,95,99,111,110,102,105,103,0,115,121,115,116,101,109,0,102,105,112,115,0,115,116,97,110,100,97,114,100,0,114,110,103,45,116,121,112,101,58,37,115,58,37,100,58,10,0,111,117,116,32,111,102,32,99,111,114,101,32,105,110,32,115,101,99,117,114,101,32,109,101,109,111,114,121,0,92,120,37,48,50,120,0,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,48,49,50,51,52,53,54,55,56,57,45,46,47,95,58,42,43,61,0,115,101,120,112,46,99,0,100,111,95,118,115,101,120,112,95,115,115,99,97,110,0,37,100,0,37,117,0,38,92,0,95,103,99,114,121,95,115,101,120,112,95,102,105,110,100,95,116,111,107,101,110,0,95,103,99,114,121,95,115,101,120,112,95,110,116,104,0,3,4,0,8,9,11,10,12,13,34,39,92,0,45,46,47,95,58,42,43,61,0,37,48,50,88,0,37,117,58,0,95,103,99,114,121,95,115,101,120,112,95,115,112,114,105,110,116,0,112,97,100,108,111,99,107,45,114,110,103,0,112,97,100,108,111,99,107,45,97,101,115,0,112,97,100,108,111,99,107,45,115,104,97,0,112,97,100,108,111,99,107,45,109,109,117,108,0,105,110,116,101,108,45,99,112,117,0,105,110,116,101,108,45,98,109,105,50,0,105,110,116,101,108,45,115,115,115,101,51,0,105,110,116,101,108,45,112,99,108,109,117,108,0,105,110,116,101,108,45,97,101,115,110,105,0,105,110,116,101,108,45,114,100,114,97,110,100,0,105,110,116,101,108,45,97,118,120,0,105,110,116,101,108,45,97,118,120,50,0,97,114,109,45,110,101,111,110,0,47,101,116,99,47,103,99,114,121,112,116,47,104,119,102,46,100,101,110,121,0,109,101,109,111,114,121,32,97,116,32,37,112,32,99,111,114,114,117,112,116,101,100,32,40,117,110,100,101,114,102,108,111,119,61,37,48,50,120,41,10,0,109,101,109,111,114,121,32,97,116,32,37,112,32,99,111,114,114,117,112,116,101,100,32,40,111,118,101,114,102,108,111,119,61,37,48,50,120,41,10,0,102,97,105,108,101,100,32,116,111,32,100,114,111,112,32,115,101,116,117,105,100,10,0,115,101,99,117,114,101,32,109,101,109,111,114,121,32,105,115,32,100,105,115,97,98,108,101,100,0,99,97,110,39,116,32,109,109,97,112,32,112,111,111,108,32,111,102,32,37,117,32,98,121,116,101,115,58,32,37,115,32,45,32,117,115,105,110,103,32,109,97,108,108,111,99,10,0,99,97,110,39,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,112,111,111,108,32,111,102,32,37,117,32,98,121,116,101,115,10,0,80,108,101,97,115,101,32,110,111,116,101,32,116,104,97,116,32,121,111,117,32,100,111,110,39,116,32,104,97,118,101,32,115,101,99,117,114,101,32,109,101,109,111,114,121,32,111,110,32,116,104,105,115,32,115,121,115,116,101,109,10,0,79,111,112,115,44,32,115,101,99,117,114,101,32,109,101,109,111,114,121,32,112,111,111,108,32,97,108,114,101,97,100,121,32,105,110,105,116,105,97,108,105,122,101,100,10,0,111,112,101,114,97,116,105,111,110,32,105,115,32,110,111,116,32,112,111,115,115,105,98,108,101,32,119,105,116,104,111,117,116,32,105,110,105,116,105,97,108,105,122,101,100,32,115,101,99,117,114,101,32,109,101,109,111,114,121,10,0,115,101,99,109,101,109,32,117,115,97,103,101,58,32,37,117,47,37,108,117,32,98,121,116,101,115,32,105,110,32,37,117,32,98,108,111,99,107,115,10,0,33,100,111,110,101,0,102,105,112,115,46,99,0,95,103,99,114,121,95,105,110,105,116,105,97,108,105,122,101,95,102,105,112,115,95,109,111,100,101,0,33,110,111,95,102,105,112,115,95,109,111,100,101,95,114,101,113,117,105,114,101,100,0,47,101,116,99,47,103,99,114,121,112,116,47,102,105,112,115,95,101,110,97,98,108,101,100,0,47,112,114,111,99,47,115,121,115,47,99,114,121,112,116,111,47,102,105,112,115,95,101,110,97,98,108,101,100,0,114,0,47,112,114,111,99,47,118,101,114,115,105,111,110,0,70,65,84,65,76,58,32,101,114,114,111,114,32,114,101,97,100,105,110,103,32,96,37,115,39,32,105,110,32,108,105,98,103,99,114,121,112,116,58,32,37,115,10,0,70,65,84,65,76,58,32,102,97,105,108,101,100,32,116,111,32,99,114,101,97,116,101,32,116,104,101,32,70,83,77,32,108,111,99,107,32,105,110,32,108,105,98,103,99,114,121,112,116,58,32,37,115,10,0,70,65,84,65,76,58,32,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,70,83,77,32,108,111,99,107,32,105,110,32,108,105,98,103,114,121,112,116,58,32,37,115,10,0,70,65,84,65,76,58,32,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,70,83,77,32,108,111,99,107,32,105,110,32,108,105,98,103,114,121,112,116,58,32,37,115,10,0,83,104,117,116,100,111,119,110,0,70,97,116,97,108,45,69,114,114,111,114,0,69,114,114,111,114,0,79,112,101,114,97,116,105,111,110,97,108,0,83,101,108,102,45,84,101,115,116,0,73,110,105,116,0,80,111,119,101,114,45,79,110,0,103,114,97,110,116,101,100,0,100,101,110,105,101,100,0,108,105,98,103,99,114,121,112,116,32,115,116,97,116,101,32,116,114,97,110,115,105,116,105,111,110,32,37,115,32,61,62,32,37,115,32,37,115,10,0,95,103,99,114,121,95,102,105,112,115,95,109,111,100,101,32,40,41,0,95,103,99,114,121,95,105,110,97,99,116,105,118,97,116,101,95,102,105,112,115,95,109,111,100,101,0,110,111,32,100,101,115,99,114,105,112,116,105,111,110,32,97,118,97,105,108,97,98,108,101,0,37,115,101,114,114,111,114,32,105,110,32,108,105,98,103,99,114,121,112,116,44,32,102,105,108,101,32,37,115,44,32,108,105,110,101,32,37,100,37,115,37,115,58,32,37,115,10,0,44,32,102,117,110,99,116,105,111,110,32,0,102,97,116,97,108,32,0,72,77,65,67,45,0,79,107,97,121,0,32,40,0,108,105,98,103,99,114,121,112,116,32,115,101,108,102,116,101,115,116,58,32,37,115,32,37,115,37,115,32,40,37,100,41,58,32,37,115,37,115,37,115,37,115,10,0,98,97,100,32,99,111,110,116,101,120,116,32,116,121,112,101,32,37,100,32,103,105,118,101,110,32,116,111,32,95,103,99,114,121,95,99,116,120,95,97,108,108,111,99,10,0,99,84,120,0,98,97,100,32,112,111,105,110,116,101,114,32,37,112,32,112,97,115,115,101,100,32,116,111,32,95,103,99,114,121,95,99,116,120,95,103,101,116,95,112,111,105,110,116,101,114,10,0,119,114,111,110,103,32,99,111,110,116,101,120,116,32,116,121,112,101,32,37,100,32,114,101,113,117,101,115,116,32,102,111,114,32,99,111,110,116,101,120,116,32,37,112,32,111,102,32,116,121,112,101,32,37,100,10,0,98,97,100,32,112,111,105,110,116,101,114,32,37,112,32,112,97,115,115,101,100,32,116,111,32,103,99,114,121,95,99,116,120,95,114,101,108,97,115,101,10,0,98,97,100,32,99,111,110,116,101,120,116,32,116,121,112,101,32,37,100,32,100,101,116,101,99,116,101,100,32,105,110,32,103,99,114,121,95,99,116,120,95,114,101,108,97,115,101,10,0,103,99,114,121,95,99,105,112,104,101,114,95,99,108,111,115,101,58,32,97,108,114,101,97,100,121,32,99,108,111,115,101,100,47,105,110,118,97,108,105,100,32,104,97,110,100,108,101,0,99,105,112,104,101,114,46,99,0,99,105,112,104,101,114,95,101,110,99,114,121,112,116,0,99,105,112,104,101,114,32,109,111,100,101,32,78,79,78,69,32,117,115,101,100,0,99,105,112,104,101,114,95,101,110,99,114,121,112,116,58,32,105,110,118,97,108,105,100,32,109,111,100,101,32,37,100,10,0,99,105,112,104,101,114,95,100,101,99,114,121,112,116,0,99,105,112,104,101,114,95,100,101,99,114,121,112,116,58,32,105,110,118,97,108,105,100,32,109,111,100,101,32,37,100,10,0,87,65,82,78,73,78,71,58,32,99,105,112,104,101,114,95,115,101,116,105,118,58,32,105,118,108,101,110,61,37,117,32,98,108,107,108,101,110,61,37,117,10,0,99,105,112,104,101,114,95,115,101,116,105,118,0,73,86,32,108,101,110,103,116,104,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,98,108,111,99,107,108,101,110,103,116,104,0,49,46,51,46,54,46,49,46,52,46,49,46,49,49,53,57,49,46,49,53,46,49,0,78,73,83,84,32,80,45,49,57,50,0,49,46,50,46,56,52,48,46,49,48,48,52,53,46,51,46,49,46,49,0,112,114,105,109,101,49,57,50,118,49,0,115,101,99,112,49,57,50,114,49,0,110,105,115,116,112,49,57,50,0,78,73,83,84,32,80,45,50,50,52,0,115,101,99,112,50,50,52,114,49,0,49,46,51,46,49,51,50,46,48,46,51,51,0,110,105,115,116,112,50,50,52,0,78,73,83,84,32,80,45,50,53,54,0,49,46,50,46,56,52,48,46,49,48,48,52,53,46,51,46,49,46,55,0,112,114,105,109,101,50,53,54,118,49,0,115,101,99,112,50,53,54,114,49,0,110,105,115,116,112,50,53,54,0,78,73,83,84,32,80,45,51,56,52,0,115,101,99,112,51,56,52,114,49,0,49,46,51,46,49,51,50,46,48,46,51,52,0,110,105,115,116,112,51,56,52,0,78,73,83,84,32,80,45,53,50,49,0,115,101,99,112,53,50,49,114,49,0,49,46,51,46,49,51,50,46,48,46,51,53,0,110,105,115,116,112,53,50,49,0,98,114,97,105,110,112,111,111,108,80,49,54,48,114,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,49,0,98,114,97,105,110,112,111,111,108,80,49,57,50,114,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,51,0,98,114,97,105,110,112,111,111,108,80,50,50,52,114,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,53,0,98,114,97,105,110,112,111,111,108,80,50,53,54,114,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,55,0,98,114,97,105,110,112,111,111,108,80,51,50,48,114,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,57,0,98,114,97,105,110,112,111,111,108,80,51,56,52,114,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,49,49,0,98,114,97,105,110,112,111,111,108,80,53,49,50,114,49,0,49,46,51,46,51,54,46,51,46,51,46,50,46,56,46,49,46,49,46,49,51,0,71,79,83,84,50,48,48,49,45,116,101,115,116,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,48,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,65,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,49,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,66,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,50,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,67,0,49,46,50,46,54,52,51,46,50,46,50,46,51,53,46,51,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,88,99,104,65,0,71,79,83,84,50,48,48,49,45,67,114,121,112,116,111,80,114,111,45,88,99,104,66,0,49,46,50,46,54,52,51,46,50,46,50,46,51,54,46,48,0,49,46,50,46,54,52,51,46,50,46,50,46,51,54,46,49,0,71,79,83,84,50,48,49,50,45,116,99,50,54,45,65,0,49,46,50,46,54,52,51,46,55,46,49,46,50,46,49,46,50,46,49,0,71,79,83,84,50,48,49,50,45,116,99,50,54,45,66,0,49,46,50,46,54,52,51,46,55,46,49,46,50,46,49,46,50,46,50,0,115,101,99,112,50,53,54,107,49,0,49,46,51,46,49,51,50,46,48,46,49,48,0,48,120,55,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,69,68,0,45,48,120,48,49,0,45,48,120,50,68,70,67,57,51,49,49,68,52,57,48,48,49,56,67,55,51,51,56,66,70,56,54,56,56,56,54,49,55,54,55,70,70,56,70,70,53,66,50,66,69,66,69,50,55,53,52,56,65,49,52,66,50,51,53,69,67,65,54,56,55,52,65,0,48,120,49,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,52,68,69,70,57,68,69,65,50,70,55,57,67,68,54,53,56,49,50,54,51,49,65,53,67,70,53,68,51,69,68,0,48,120,50,49,54,57,51,54,68,51,67,68,54,69,53,51,70,69,67,48,65,52,69,50,51,49,70,68,68,54,68,67,53,67,54,57,50,67,67,55,54,48,57,53,50,53,65,55,66,50,67,57,53,54,50,68,54,48,56,70,50,53,68,53,49,65,0,48,120,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,53,56,0,48,120,48,56,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,0,48,120,54,52,50,49,48,53,49,57,101,53,57,99,56,48,101,55,48,102,97,55,101,57,97,98,55,50,50,52,51,48,52,57,102,101,98,56,100,101,101,99,99,49,52,54,98,57,98,49,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,57,57,100,101,102,56,51,54,49,52,54,98,99,57,98,49,98,52,100,50,50,56,51,49,0,48,120,49,56,56,100,97,56,48,101,98,48,51,48,57,48,102,54,55,99,98,102,50,48,101,98,52,51,97,49,56,56,48,48,102,52,102,102,48,97,102,100,56,50,102,102,49,48,49,50,0,48,120,48,55,49,57,50,98,57,53,102,102,99,56,100,97,55,56,54,51,49,48,49,49,101,100,54,98,50,52,99,100,100,53,55,51,102,57,55,55,97,49,49,101,55,57,52,56,49,49,0,48,120,48,49,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,0,48,120,98,52,48,53,48,97,56,53,48,99,48,52,98,51,97,98,102,53,52,49,51,50,53,54,53,48,52,52,98,48,98,55,100,55,98,102,100,56,98,97,50,55,48,98,51,57,52,51,50,51,53,53,102,102,98,52,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,49,54,97,50,101,48,98,56,102,48,51,101,49,51,100,100,50,57,52,53,53,99,53,99,50,97,51,100,0,48,120,98,55,48,101,48,99,98,100,54,98,98,52,98,102,55,102,51,50,49,51,57,48,98,57,52,97,48,51,99,49,100,51,53,54,99,50,49,49,50,50,51,52,51,50,56,48,100,54,49,49,53,99,49,100,50,49,0,48,120,98,100,51,55,54,51,56,56,98,53,102,55,50,51,102,98,52,99,50,50,100,102,101,54,99,100,52,51,55,53,97,48,53,97,48,55,52,55,54,52,52,52,100,53,56,49,57,57,56,53,48,48,55,101,51,52,0,48,120,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,49,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,0,48,120,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,49,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,0,48,120,53,97,99,54,51,53,100,56,97,97,51,97,57,51,101,55,98,51,101,98,98,100,53,53,55,54,57,56,56,54,98,99,54,53,49,100,48,54,98,48,99,99,53,51,98,48,102,54,51,98,99,101,51,99,51,101,50,55,100,50,54,48,52,98,0,48,120,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,98,99,101,54,102,97,97,100,97,55,49,55,57,101,56,52,102,51,98,57,99,97,99,50,102,99,54,51,50,53,53,49,0,48,120,54,98,49,55,100,49,102,50,101,49,50,99,52,50,52,55,102,56,98,99,101,54,101,53,54,51,97,52,52,48,102,50,55,55,48,51,55,100,56,49,50,100,101,98,51,51,97,48,102,52,97,49,51,57,52,53,100,56,57,56,99,50,57,54,0,48,120,52,102,101,51,52,50,101,50,102,101,49,97,55,102,57,98,56,101,101,55,101,98,52,97,55,99,48,102,57,101,49,54,50,98,99,101,51,51,53,55,54,98,51,49,53,101,99,101,99,98,98,54,52,48,54,56,51,55,98,102,53,49,102,53,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,102,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,102,102,102,102,102,102,102,102,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,102,102,102,102,102,102,102,99,0,48,120,98,51,51,49,50,102,97,55,101,50,51,101,101,55,101,52,57,56,56,101,48,53,54,98,101,51,102,56,50,100,49,57,49,56,49,100,57,99,54,101,102,101,56,49,52,49,49,50,48,51,49,52,48,56,56,102,53,48,49,51,56,55,53,97,99,54,53,54,51,57,56,100,56,97,50,101,100,49,57,100,50,97,56,53,99,56,101,100,100,51,101,99,50,97,101,102,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,55,54,51,52,100,56,49,102,52,51,55,50,100,100,102,53,56,49,97,48,100,98,50,52,56,98,48,97,55,55,97,101,99,101,99,49,57,54,97,99,99,99,53,50,57,55,51,0,48,120,97,97,56,55,99,97,50,50,98,101,56,98,48,53,51,55,56,101,98,49,99,55,49,101,102,51,50,48,97,100,55,52,54,101,49,100,51,98,54,50,56,98,97,55,57,98,57,56,53,57,102,55,52,49,101,48,56,50,53,52,50,97,51,56,53,53,48,50,102,50,53,100,98,102,53,53,50,57,54,99,51,97,53,52,53,101,51,56,55,50,55,54,48,97,98,55,0,48,120,51,54,49,55,100,101,52,97,57,54,50,54,50,99,54,102,53,100,57,101,57,56,98,102,57,50,57,50,100,99,50,57,102,56,102,52,49,100,98,100,50,56,57,97,49,52,55,99,101,57,100,97,51,49,49,51,98,53,102,48,98,56,99,48,48,97,54,48,98,49,99,101,49,100,55,101,56,49,57,100,55,97,52,51,49,100,55,99,57,48,101,97,48,101,53,102,0,48,120,48,49,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,0,48,120,48,49,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,99,0,48,120,48,53,49,57,53,51,101,98,57,54,49,56,101,49,99,57,97,49,102,57,50,57,97,50,49,97,48,98,54,56,53,52,48,101,101,97,50,100,97,55,50,53,98,57,57,98,51,49,53,102,51,98,56,98,52,56,57,57,49,56,101,102,49,48,57,101,49,53,54,49,57,51,57,53,49,101,99,55,101,57,51,55,98,49,54,53,50,99,48,98,100,51,98,98,49,98,102,48,55,51,53,55,51,100,102,56,56,51,100,50,99,51,52,102,49,101,102,52,53,49,102,100,52,54,98,53,48,51,102,48,48,0,48,120,49,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,97,53,49,56,54,56,55,56,51,98,102,50,102,57,54,54,98,55,102,99,99,48,49,52,56,102,55,48,57,97,53,100,48,51,98,98,53,99,57,98,56,56,57,57,99,52,55,97,101,98,98,54,102,98,55,49,101,57,49,51,56,54,52,48,57,0,48,120,48,48,99,54,56,53,56,101,48,54,98,55,48,52,48,52,101,57,99,100,57,101,51,101,99,98,54,54,50,51,57,53,98,52,52,50,57,99,54,52,56,49,51,57,48,53,51,102,98,53,50,49,102,56,50,56,97,102,54,48,54,98,52,100,51,100,98,97,97,49,52,98,53,101,55,55,101,102,101,55,53,57,50,56,102,101,49,100,99,49,50,55,97,50,102,102,97,56,100,101,51,51,52,56,98,51,99,49,56,53,54,97,52,50,57,98,102,57,55,101,55,101,51,49,99,50,101,53,98,100,54,54,0,48,120,48,49,49,56,51,57,50,57,54,97,55,56,57,97,51,98,99,48,48,52,53,99,56,97,53,102,98,52,50,99,55,100,49,98,100,57,57,56,102,53,52,52,52,57,53,55,57,98,52,52,54,56,49,55,97,102,98,100,49,55,50,55,51,101,54,54,50,99,57,55,101,101,55,50,57,57,53,101,102,52,50,54,52,48,99,53,53,48,98,57,48,49,51,102,97,100,48,55,54,49,51,53,51,99,55,48,56,54,97,50,55,50,99,50,52,48,56,56,98,101,57,52,55,54,57,102,100,49,54,54,53,48,0,48,120,101,57,53,101,52,97,53,102,55,51,55,48,53,57,100,99,54,48,100,102,99,55,97,100,57,53,98,51,100,56,49,51,57,53,49,53,54,50,48,102,0,48,120,51,52,48,101,55,98,101,50,97,50,56,48,101,98,55,52,101,50,98,101,54,49,98,97,100,97,55,52,53,100,57,55,101,56,102,55,99,51,48,48,0,48,120,49,101,53,56,57,97,56,53,57,53,52,50,51,52,49,50,49,51,52,102,97,97,50,100,98,100,101,99,57,53,99,56,100,56,54,55,53,101,53,56,0,48,120,101,57,53,101,52,97,53,102,55,51,55,48,53,57,100,99,54,48,100,102,53,57,57,49,100,52,53,48,50,57,52,48,57,101,54,48,102,99,48,57,0,48,120,98,101,100,53,97,102,49,54,101,97,51,102,54,97,52,102,54,50,57,51,56,99,52,54,51,49,101,98,53,97,102,55,98,100,98,99,100,98,99,51,0,48,120,49,54,54,55,99,98,52,55,55,97,49,97,56,101,99,51,51,56,102,57,52,55,52,49,54,54,57,99,57,55,54,51,49,54,100,97,54,51,50,49,0,48,120,99,51,48,50,102,52,49,100,57,51,50,97,51,54,99,100,97,55,97,51,52,54,51,48,57,51,100,49,56,100,98,55,56,102,99,101,52,55,54,100,101,49,97,56,54,50,57,55,0,48,120,54,97,57,49,49,55,52,48,55,54,98,49,101,48,101,49,57,99,51,57,99,48,51,49,102,101,56,54,56,53,99,49,99,97,101,48,52,48,101,53,99,54,57,97,50,56,101,102,0,48,120,52,54,57,97,50,56,101,102,55,99,50,56,99,99,97,51,100,99,55,50,49,100,48,52,52,102,52,52,57,54,98,99,99,97,55,101,102,52,49,52,54,102,98,102,50,53,99,57,0,48,120,99,51,48,50,102,52,49,100,57,51,50,97,51,54,99,100,97,55,97,51,52,54,50,102,57,101,57,101,57,49,54,98,53,98,101,56,102,49,48,50,57,97,99,52,97,99,99,49,0,48,120,99,48,97,48,54,52,55,101,97,97,98,54,97,52,56,55,53,51,98,48,51,51,99,53,54,99,98,48,102,48,57,48,48,97,50,102,53,99,52,56,53,51,51,55,53,102,100,54,0,48,120,49,52,98,54,57,48,56,54,54,97,98,100,53,98,98,56,56,98,53,102,52,56,50,56,99,49,52,57,48,48,48,50,101,54,55,55,51,102,97,50,102,97,50,57,57,98,56,102,0,48,120,100,55,99,49,51,52,97,97,50,54,52,51,54,54,56,54,50,97,49,56,51,48,50,53,55,53,100,49,100,55,56,55,98,48,57,102,48,55,53,55,57,55,100,97,56,57,102,53,55,101,99,56,99,48,102,102,0,48,120,54,56,97,53,101,54,50,99,97,57,99,101,54,99,49,99,50,57,57,56,48,51,97,54,99,49,53,51,48,98,53,49,52,101,49,56,50,97,100,56,98,48,48,52,50,97,53,57,99,97,100,50,57,102,52,51,0,48,120,50,53,56,48,102,54,51,99,99,102,101,52,52,49,51,56,56,55,48,55,49,51,98,49,97,57,50,51,54,57,101,51,51,101,50,49,51,53,100,50,54,54,100,98,98,51,55,50,51,56,54,99,52,48,48,98,0,48,120,100,55,99,49,51,52,97,97,50,54,52,51,54,54,56,54,50,97,49,56,51,48,50,53,55,53,100,48,102,98,57,56,100,49,49,54,98,99,52,98,54,100,100,101,98,99,97,51,97,53,97,55,57,51,57,102,0,48,120,48,100,57,48,50,57,97,100,50,99,55,101,53,99,102,52,51,52,48,56,50,51,98,50,97,56,55,100,99,54,56,99,57,101,52,99,101,51,49,55,52,99,49,101,54,101,102,100,101,101,49,50,99,48,55,100,0,48,120,53,56,97,97,53,54,102,55,55,50,99,48,55,50,54,102,50,52,99,54,98,56,57,101,52,101,99,100,97,99,50,52,51,53,52,98,57,101,57,57,99,97,97,51,102,54,100,51,55,54,49,52,48,50,99,100,0,48,120,97,57,102,98,53,55,100,98,97,49,101,101,97,57,98,99,51,101,54,54,48,97,57,48,57,100,56,51,56,100,55,50,54,101,51,98,102,54,50,51,100,53,50,54,50,48,50,56,50,48,49,51,52,56,49,100,49,102,54,101,53,51,55,55,0,48,120,55,100,53,97,48,57,55,53,102,99,50,99,51,48,53,55,101,101,102,54,55,53,51,48,52,49,55,97,102,102,101,55,102,98,56,48,53,53,99,49,50,54,100,99,53,99,54,99,101,57,52,97,52,98,52,52,102,51,51,48,98,53,100,57,0,48,120,50,54,100,99,53,99,54,99,101,57,52,97,52,98,52,52,102,51,51,48,98,53,100,57,98,98,100,55,55,99,98,102,57,53,56,52,49,54,50,57,53,99,102,55,101,49,99,101,54,98,99,99,100,99,49,56,102,102,56,99,48,55,98,54,0,48,120,97,57,102,98,53,55,100,98,97,49,101,101,97,57,98,99,51,101,54,54,48,97,57,48,57,100,56,51,56,100,55,49,56,99,51,57,55,97,97,51,98,53,54,49,97,54,102,55,57,48,49,101,48,101,56,50,57,55,52,56,53,54,97,55,0,48,120,56,98,100,50,97,101,98,57,99,98,55,101,53,55,99,98,50,99,52,98,52,56,50,102,102,99,56,49,98,55,97,102,98,57,100,101,50,55,101,49,101,51,98,100,50,51,99,50,51,97,52,52,53,51,98,100,57,97,99,101,51,50,54,50,0,48,120,53,52,55,101,102,56,51,53,99,51,100,97,99,52,102,100,57,55,102,56,52,54,49,97,49,52,54,49,49,100,99,57,99,50,55,55,52,53,49,51,50,100,101,100,56,101,53,52,53,99,49,100,53,52,99,55,50,102,48,52,54,57,57,55,0,48,120,100,51,53,101,52,55,50,48,51,54,98,99,52,102,98,55,101,49,51,99,55,56,53,101,100,50,48,49,101,48,54,53,102,57,56,102,99,102,97,54,102,54,102,52,48,100,101,102,52,102,57,50,98,57,101,99,55,56,57,51,101,99,50,56,102,99,100,52,49,50,98,49,102,49,98,51,50,101,50,55,0,48,120,51,101,101,51,48,98,53,54,56,102,98,97,98,48,102,56,56,51,99,99,101,98,100,52,54,100,51,102,51,98,98,56,97,50,97,55,51,53,49,51,102,53,101,98,55,57,100,97,54,54,49,57,48,101,98,48,56,53,102,102,97,57,102,52,57,50,102,51,55,53,97,57,55,100,56,54,48,101,98,52,0,48,120,53,50,48,56,56,51,57,52,57,100,102,100,98,99,52,50,100,51,97,100,49,57,56,54,52,48,54,56,56,97,54,102,101,49,51,102,52,49,51,52,57,53,53,52,98,52,57,97,99,99,51,49,100,99,99,100,56,56,52,53,51,57,56,49,54,102,53,101,98,52,97,99,56,102,98,49,102,49,97,54,0,48,120,100,51,53,101,52,55,50,48,51,54,98,99,52,102,98,55,101,49,51,99,55,56,53,101,100,50,48,49,101,48,54,53,102,57,56,102,99,102,97,53,98,54,56,102,49,50,97,51,50,100,52,56,50,101,99,55,101,101,56,54,53,56,101,57,56,54,57,49,53,53,53,98,52,52,99,53,57,51,49,49,0,48,120,52,51,98,100,55,101,57,97,102,98,53,51,100,56,98,56,53,50,56,57,98,99,99,52,56,101,101,53,98,102,101,54,102,50,48,49,51,55,100,49,48,97,48,56,55,101,98,54,101,55,56,55,49,101,50,97,49,48,97,53,57,57,99,55,49,48,97,102,56,100,48,100,51,57,101,50,48,54,49,49,0,48,120,49,52,102,100,100,48,53,53,52,53,101,99,49,99,99,56,97,98,52,48,57,51,50,52,55,102,55,55,50,55,53,101,48,55,52,51,102,102,101,100,49,49,55,49,56,50,101,97,97,57,99,55,55,56,55,55,97,97,97,99,54,97,99,55,100,51,53,50,52,53,100,49,54,57,50,101,56,101,101,49,0,48,120,56,99,98,57,49,101,56,50,97,51,51,56,54,100,50,56,48,102,53,100,54,102,55,101,53,48,101,54,52,49,100,102,49,53,50,102,55,49,48,57,101,100,53,52,53,54,98,52,49,50,98,49,100,97,49,57,55,102,98,55,49,49,50,51,97,99,100,51,97,55,50,57,57,48,49,100,49,97,55,49,56,55,52,55,48,48,49,51,51,49,48,55,101,99,53,51,0,48,120,55,98,99,51,56,50,99,54,51,100,56,99,49,53,48,99,51,99,55,50,48,56,48,97,99,101,48,53,97,102,97,48,99,50,98,101,97,50,56,101,52,102,98,50,50,55,56,55,49,51,57,49,54,53,101,102,98,97,57,49,102,57,48,102,56,97,97,53,56,49,52,97,53,48,51,97,100,52,101,98,48,52,97,56,99,55,100,100,50,50,99,101,50,56,50,54,0,48,120,48,52,97,56,99,55,100,100,50,50,99,101,50,56,50,54,56,98,51,57,98,53,53,52,49,54,102,48,52,52,55,99,50,102,98,55,55,100,101,49,48,55,100,99,100,50,97,54,50,101,56,56,48,101,97,53,51,101,101,98,54,50,100,53,55,99,98,52,51,57,48,50,57,53,100,98,99,57,57,52,51,97,98,55,56,54,57,54,102,97,53,48,52,99,49,49,0,48,120,56,99,98,57,49,101,56,50,97,51,51,56,54,100,50,56,48,102,53,100,54,102,55,101,53,48,101,54,52,49,100,102,49,53,50,102,55,49,48,57,101,100,53,52,53,54,98,51,49,102,49,54,54,101,54,99,97,99,48,52,50,53,97,55,99,102,51,97,98,54,97,102,54,98,55,102,99,51,49,48,51,98,56,56,51,50,48,50,101,57,48,52,54,53,54,53,0,48,120,49,100,49,99,54,52,102,48,54,56,99,102,52,53,102,102,97,50,97,54,51,97,56,49,98,55,99,49,51,102,54,98,56,56,52,55,97,51,101,55,55,101,102,49,52,102,101,51,100,98,55,102,99,97,102,101,48,99,98,100,49,48,101,56,101,56,50,54,101,48,51,52,51,54,100,54,52,54,97,97,101,102,56,55,98,50,101,50,52,55,100,52,97,102,49,101,0,48,120,56,97,98,101,49,100,55,53,50,48,102,57,99,50,97,52,53,99,98,49,101,98,56,101,57,53,99,102,100,53,53,50,54,50,98,55,48,98,50,57,102,101,101,99,53,56,54,52,101,49,57,99,48,53,52,102,102,57,57,49,50,57,50,56,48,101,52,54,52,54,50,49,55,55,57,49,56,49,49,49,52,50,56,50,48,51,52,49,50,54,51,99,53,51,49,53,0,48,120,97,97,100,100,57,100,98,56,100,98,101,57,99,52,56,98,51,102,100,52,101,54,97,101,51,51,99,57,102,99,48,55,99,98,51,48,56,100,98,51,98,51,99,57,100,50,48,101,100,54,54,51,57,99,99,97,55,48,51,51,48,56,55,49,55,100,52,100,57,98,48,48,57,98,99,54,54,56,52,50,97,101,99,100,97,49,50,97,101,54,97,51,56,48,101,54,50,56,56,49,102,102,50,102,50,100,56,50,99,54,56,53,50,56,97,97,54,48,53,54,53,56,51,97,52,56,102,51,0,48,120,55,56,51,48,97,51,51,49,56,98,54,48,51,98,56,57,101,50,51,50,55,49,52,53,97,99,50,51,52,99,99,53,57,52,99,98,100,100,56,100,51,100,102,57,49,54,49,48,97,56,51,52,52,49,99,97,101,97,57,56,54,51,98,99,50,100],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480);allocate([101,100,53,100,53,97,97,56,50,53,51,97,97,49,48,97,50,101,102,49,99,57,56,98,57,97,99,56,98,53,55,102,49,49,49,55,97,55,50,98,102,50,99,55,98,57,101,55,99,49,97,99,52,100,55,55,102,99,57,52,99,97,0,48,120,51,100,102,57,49,54,49,48,97,56,51,52,52,49,99,97,101,97,57,56,54,51,98,99,50,100,101,100,53,100,53,97,97,56,50,53,51,97,97,49,48,97,50,101,102,49,99,57,56,98,57,97,99,56,98,53,55,102,49,49,49,55,97,55,50,98,102,50,99,55,98,57,101,55,99,49,97,99,52,100,55,55,102,99,57,52,99,97,100,99,48,56,51,101,54,55,57,56,52,48,53,48,98,55,53,101,98,97,101,53,100,100,50,56,48,57,98,100,54,51,56,48,49,54,102,55,50,51,0,48,120,97,97,100,100,57,100,98,56,100,98,101,57,99,52,56,98,51,102,100,52,101,54,97,101,51,51,99,57,102,99,48,55,99,98,51,48,56,100,98,51,98,51,99,57,100,50,48,101,100,54,54,51,57,99,99,97,55,48,51,51,48,56,55,48,53,53,51,101,53,99,52,49,52,99,97,57,50,54,49,57,52,49,56,54,54,49,49,57,55,102,97,99,49,48,52,55,49,100,98,49,100,51,56,49,48,56,53,100,100,97,100,100,98,53,56,55,57,54,56,50,57,99,97,57,48,48,54,57,0,48,120,56,49,97,101,101,52,98,100,100,56,50,101,100,57,54,52,53,97,50,49,51,50,50,101,57,99,52,99,54,97,57,51,56,53,101,100,57,102,55,48,98,53,100,57,49,54,99,49,98,52,51,98,54,50,101,101,102,52,100,48,48,57,56,101,102,102,51,98,49,102,55,56,101,50,100,48,100,52,56,100,53,48,100,49,54,56,55,98,57,51,98,57,55,100,53,102,55,99,54,100,53,48,52,55,52,48,54,97,53,101,54,56,56,98,51,53,50,50,48,57,98,99,98,57,102,56,50,50,0,48,120,55,100,100,101,51,56,53,100,53,54,54,51,51,50,101,99,99,48,101,97,98,102,97,57,99,102,55,56,50,50,102,100,102,50,48,57,102,55,48,48,50,52,97,53,55,98,49,97,97,48,48,48,99,53,53,98,56,56,49,102,56,49,49,49,98,50,100,99,100,101,52,57,52,97,53,102,52,56,53,101,53,98,99,97,52,98,100,56,56,97,50,55,54,51,97,101,100,49,99,97,50,98,50,102,97,56,102,48,53,52,48,54,55,56,99,100,49,101,48,102,51,97,100,56,48,56,57,50,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,52,51,49,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,55,0,48,120,53,102,98,102,102,52,57,56,97,97,57,51,56,99,101,55,51,57,98,56,101,48,50,50,102,98,97,102,101,102,52,48,53,54,51,102,54,101,54,97,51,52,55,50,102,99,50,97,53,49,52,99,48,99,101,57,100,97,101,50,51,98,55,101,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,53,48,102,101,56,97,49,56,57,50,57,55,54,49,53,52,99,53,57,99,102,99,49,57,51,97,99,99,102,53,98,51,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,50,0,48,120,48,56,101,50,97,56,97,48,101,54,53,49,52,55,100,52,98,100,54,51,49,54,48,51,48,101,49,54,100,49,57,99,56,53,99,57,55,102,48,97,57,99,97,50,54,55,49,50,50,98,57,54,97,98,98,99,101,97,55,101,56,102,99,56,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,57,55,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,57,52,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,97,54,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,54,99,54,49,49,48,55,48,57,57,53,97,100,49,48,48,52,53,56,52,49,98,48,57,98,55,54,49,98,56,57,51,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,0,48,120,56,100,57,49,101,52,55,49,101,48,57,56,57,99,100,97,50,55,100,102,53,48,53,97,52,53,51,102,50,98,55,54,51,53,50,57,52,102,50,100,100,102,50,51,101,51,98,49,50,50,97,99,99,57,57,99,57,101,57,102,49,101,49,52,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,99,57,57,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,99,57,54,0,48,120,51,101,49,97,102,52,49,57,97,50,54,57,97,53,102,56,54,54,97,55,100,51,99,50,53,99,51,100,102,56,48,97,101,57,55,57,50,53,57,51,55,51,102,102,50,98,49,56,50,102,52,57,100,52,99,101,55,101,49,98,98,99,56,98,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,53,102,55,48,48,99,102,102,102,49,97,54,50,52,101,53,101,52,57,55,49,54,49,98,99,99,56,97,49,57,56,102,0,48,120,51,102,97,56,49,50,52,51,53,57,102,57,54,54,56,48,98,56,51,100,49,99,51,101,98,50,99,48,55,48,101,53,99,53,52,53,99,57,56,53,56,100,48,51,101,99,102,98,55,52,52,98,102,56,100,55,49,55,55,49,55,101,102,99,0,48,120,57,98,57,102,54,48,53,102,53,97,56,53,56,49,48,55,97,98,49,101,99,56,53,101,54,98,52,49,99,56,97,97,99,102,56,52,54,101,56,54,55,56,57,48,53,49,100,51,55,57,57,56,102,55,98,57,48,50,50,100,55,53,57,98,0,48,120,57,98,57,102,54,48,53,102,53,97,56,53,56,49,48,55,97,98,49,101,99,56,53,101,54,98,52,49,99,56,97,97,99,102,56,52,54,101,56,54,55,56,57,48,53,49,100,51,55,57,57,56,102,55,98,57,48,50,50,100,55,53,57,56,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,48,53,97,0,48,120,57,98,57,102,54,48,53,102,53,97,56,53,56,49,48,55,97,98,49,101,99,56,53,101,54,98,52,49,99,56,97,97,53,56,50,99,97,51,53,49,49,101,100,100,102,98,55,52,102,48,50,102,51,97,54,53,57,56,57,56,48,98,98,57,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0,48,120,52,49,101,99,101,53,53,55,52,51,55,49,49,97,56,99,51,99,98,102,51,55,56,51,99,100,48,56,99,48,101,101,52,100,52,100,99,52,52,48,100,52,54,52,49,97,56,102,51,54,54,101,53,53,48,100,102,100,98,51,98,98,54,55,0,71,79,83,84,50,48,49,50,45,116,101,115,116,0,48,120,52,53,51,49,97,99,100,49,102,101,48,48,50,51,99,55,53,53,48,100,50,54,55,98,54,98,50,102,101,101,56,48,57,50,50,98,49,52,98,50,102,102,98,57,48,102,48,52,100,52,101,98,55,99,48,57,98,53,100,50,100,49,53,100,102,49,100,56,53,50,55,52,49,97,102,52,55,48,52,97,48,52,53,56,48,52,55,101,56,48,101,52,53,52,54,100,51,53,98,56,51,51,54,102,97,99,50,50,52,100,100,56,49,54,54,52,98,98,102,53,50,56,98,101,54,51,55,51,0,48,120,49,99,102,102,48,56,48,54,97,51,49,49,49,54,100,97,50,57,100,56,99,102,97,53,52,101,53,55,101,98,55,52,56,98,99,53,102,51,55,55,101,52,57,52,48,48,102,100,100,55,56,56,98,54,52,57,101,99,97,49,97,99,52,51,54,49,56,51,52,48,49,51,98,50,97,100,55,51,50,50,52,56,48,97,56,57,99,97,53,56,101,48,99,102,55,52,98,99,57,101,53,52,48,99,50,97,100,100,54,56,57,55,102,97,100,48,97,51,48,56,52,102,51,48,50,97,100,99,0,48,120,52,53,51,49,97,99,100,49,102,101,48,48,50,51,99,55,53,53,48,100,50,54,55,98,54,98,50,102,101,101,56,48,57,50,50,98,49,52,98,50,102,102,98,57,48,102,48,52,100,52,101,98,55,99,48,57,98,53,100,50,100,49,53,100,97,56,50,102,50,100,55,101,99,98,49,100,98,97,99,55,49,57,57,48,53,99,53,101,101,99,99,52,50,51,102,49,100,56,54,101,50,53,101,100,98,101,50,51,99,53,57,53,100,54,52,52,97,97,102,49,56,55,101,54,101,54,100,102,0,48,120,50,52,100,49,57,99,99,54,52,53,55,50,101,101,51,48,102,51,57,54,98,102,54,101,98,98,102,100,55,97,54,99,53,50,49,51,98,51,98,51,100,55,48,53,55,99,99,56,50,53,102,57,49,48,57,51,97,54,56,99,100,55,54,50,102,100,54,48,54,49,49,50,54,50,99,100,56,51,56,100,99,54,98,54,48,97,97,55,101,101,101,56,48,52,101,50,56,98,99,56,52,57,57,55,55,102,97,99,51,51,98,52,98,53,51,48,102,49,98,49,50,48,50,52,56,97,57,97,0,48,120,50,98,98,51,49,50,97,52,51,98,100,50,99,101,54,101,48,100,48,50,48,54,49,51,99,56,53,55,97,99,100,100,99,102,98,102,48,54,49,101,57,49,101,53,102,50,99,51,102,51,50,52,52,55,99,50,53,57,102,51,57,98,50,99,56,51,97,98,49,53,54,100,55,55,102,49,52,57,54,98,102,55,101,98,51,51,53,49,101,49,101,101,52,101,52,51,100,99,49,97,49,56,98,57,49,98,50,52,54,52,48,98,54,100,98,98,57,50,99,98,49,97,100,100,51,55,49,101,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,99,55,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,100,99,52,0,48,120,101,56,99,50,53,48,53,100,101,100,102,99,56,54,100,100,99,49,98,100,48,98,50,98,54,54,54,55,102,49,100,97,51,52,98,56,50,53,55,52,55,54,49,99,98,48,101,56,55,57,98,100,48,56,49,99,102,100,48,98,54,50,54,53,101,101,51,99,98,48,57,48,102,51,48,100,50,55,54,49,52,99,98,52,53,55,52,48,49,48,100,97,57,48,100,100,56,54,50,101,102,57,100,52,101,98,101,101,52,55,54,49,53,48,51,49,57,48,55,56,53,97,55,49,99,55,54,48,0,48,120,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,50,55,101,54,57,53,51,50,102,52,56,100,56,57,49,49,54,102,102,50,50,98,56,100,52,101,48,53,54,48,54,48,57,98,52,98,51,56,97,98,102,97,100,50,98,56,53,100,99,97,99,100,98,49,52,49,49,102,49,48,98,50,55,53,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,51,0,48,120,55,53,48,51,99,102,101,56,55,97,56,51,54,97,101,51,97,54,49,98,56,56,49,54,101,50,53,52,53,48,101,54,99,101,53,101,49,99,57,51,97,99,102,49,97,98,99,49,55,55,56,48,54,52,102,100,99,98,101,102,97,57,50,49,100,102,49,54,50,54,98,101,52,102,100,48,51,54,101,57,51,100,55,53,101,54,97,53,48,101,51,97,52,49,101,57,56,48,50,56,102,101,53,102,99,50,51,53,102,53,98,56,56,57,97,53,56,57,99,98,53,50,49,53,102,50,97,52,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,54,102,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,54,99,0,48,120,54,56,55,100,49,98,52,53,57,100,99,56,52,49,52,53,55,101,51,101,48,54,99,102,54,102,53,101,50,53,49,55,98,57,55,99,55,100,54,49,52,97,102,49,51,56,98,99,98,102,56,53,100,99,56,48,54,99,52,98,50,56,57,102,51,101,57,54,53,100,50,100,98,49,52,49,54,100,50,49,55,102,56,98,50,55,54,102,97,100,49,97,98,54,57,99,53,48,102,55,56,98,101,101,49,102,97,51,49,48,54,101,102,98,56,99,99,98,99,55,99,53,49,52,48,49,49,54,0,48,120,56,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,52,57,97,49,101,99,49,52,50,53,54,53,97,53,52,53,97,99,102,100,98,55,55,98,100,57,100,52,48,99,102,97,56,98,57,57,54,55,49,50,49,48,49,98,101,97,48,101,99,54,51,52,54,99,53,52,51,55,52,102,50,53,98,100,0,48,120,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,50,0,48,120,49,97,56,102,55,101,100,97,51,56,57,98,48,57,52,99,50,99,48,55,49,101,51,54,52,55,97,56,57,52,48,102,51,99,49,50,51,98,54,57,55,53,55,56,99,50,49,51,98,101,54,100,100,57,101,54,99,56,101,99,55,51,51,53,100,99,98,50,50,56,102,100,49,101,100,102,52,97,51,57,49,53,50,99,98,99,97,97,102,56,99,48,51,57,56,56,50,56,48,52,49,48,53,53,102,57,52,99,101,101,101,99,55,101,50,49,51,52,48,55,56,48,102,101,52,49,98,100,0,48,120,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,69,70,70,70,70,70,67,50,70,0,48,120,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,69,66,65,65,69,68,67,69,54,65,70,52,56,65,48,51,66,66,70,68,50,53,69,56,67,68,48,51,54,52,49,52,49,0,48,120,55,57,66,69,54,54,55,69,70,57,68,67,66,66,65,67,53,53,65,48,54,50,57,53,67,69,56,55,48,66,48,55,48,50,57,66,70,67,68,66,50,68,67,69,50,56,68,57,53,57,70,50,56,49,53,66,49,54,70,56,49,55,57,56,0,48,120,52,56,51,65,68,65,55,55,50,54,65,51,67,52,54,53,53,68,65,52,70,66,70,67,48,69,49,49,48,56,65,56,70,68,49,55,66,52,52,56,65,54,56,53,53,52,49,57,57,67,52,55,68,48,56,70,70,66,49,48,68,52,66,56,0,48,120,48,52,0,45,112,97,98,103,110,104,0,98,0,103,0,104,0,100,0,46,120,0,46,121,0,46,122,0,101,99,99,32,103,101,116,32,112,97,114,97,109,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,40,112,117,98,108,105,99,45,107,101,121,40,101,99,99,40,112,37,109,41,40,97,37,109,41,40,98,37,109,41,40,103,37,109,41,40,110,37,109,41,40,104,37,109,41,41,41,0,103,46,120,0,103,46,121,0,113,46,120,0,113,46,121,0,101,100,100,115,97,95,101,110,99,111,100,101,112,111,105,110,116,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,48,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,68,0,115,99,97,110,110,105,110,103,32,69,67,67,32,112,97,114,97,109,101,116,101,114,32,102,97,105,108,101,100,58,32,37,115,10,0,50,66,56,51,50,52,56,48,52,70,67,49,68,70,48,66,50,66,52,68,48,48,57,57,51,68,70,66,68,55,65,55,50,70,52,51,49,56,48,54,65,68,50,70,69,52,55,56,67,52,69,69,49,66,50,55,52,65,48,69,65,48,66,48,0,101,99,103,101,110,32,32,32,32,32,32,112,107,0,42,32,101,95,112,107,0,32,32,101,95,112,107,0,32,32,32,32,32,109,0,32,32,32,114,0,32,32,32,101,95,114,0,32,72,40,82,43,41,0,32,32,32,101,95,115,0,69,100,119,97,114,100,115,0,87,101,105,101,114,115,116,114,97,115,115,0,69,100,50,53,53,49,57,0,83,116,97,110,100,97,114,100,0,109,112,105,95,112,114,105,110,116,32,102,97,105,108,101,100,58,32,37,115,10,0,109,112,105,95,115,99,97,110,32,102,97,105,108,101,100,58,32,37,115,10,0,83,97,109,112,108,101,32,35,49,0,79,76,163,213,214,139,167,204,10,18,8,201,198,30,156,93,160,64,60,10,0,83,97,109,112,108,101,32,35,50,0,9,34,211,64,95,170,61,25,79,130,164,88,48,115,125,92,198,199,93,36,0,83,97,109,112,108,101,32,35,51,0,188,244,30,171,139,178,216,2,243,208,92,175,124,176,146,236,248,209,163,170,0,83,97,109,112,108,101,32,35,52,0,158,168,134,239,226,104,219,236,206,66,12,117,36,223,50,224,117,26,42,38,0,70,73,80,83,45,49,57,56,97,44,32,65,46,49,0,70,73,80,83,45,49,57,56,97,44,32,65,46,50,0,70,73,80,83,45,49,57,56,97,44,32,65,46,51,0,70,73,80,83,45,49,57,56,97,44,32,65,46,52,0,104,109,97,99,0,95,103,99,114,121,95,104,109,97,99,50,53,54,95,110,101,119,32,102,97,105,108,101,100,0,95,103,99,114,121,95,104,109,97,99,50,53,54,95,102,105,110,97,108,105,122,101,32,102,97,105,108,101,100,0,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,105,110,32,115,101,99,111,110,100,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110,0,97,108,103,111,114,105,116,104,109,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,100,97,116,97,45,50,56,32,107,101,121,45,52,0,119,104,97,116,32,100,111,32,121,97,32,119,97,110,116,32,102,111,114,32,110,111,116,104,105,110,103,63,0,74,101,102,101,0,100,97,116,97,45,57,32,107,101,121,45,50,48,0,72,105,32,84,104,101,114,101,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,100,97,116,97,45,53,48,32,107,101,121,45,50,48,0,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,0,100,97,116,97,45,53,48,32,107,101,121,45,50,54,0,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,100,97,116,97,45,53,52,32,107,101,121,45,49,51,49,0,84,101,115,116,32,85,115,105,110,103,32,76,97,114,103,101,114,32,84,104,97,110,32,66,108,111,99,107,45,83,105,122,101,32,75,101,121,32,45,32,72,97,115,104,32,75,101,121,32,70,105,114,115,116,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,0,100,97,116,97,45,49,53,50,32,107,101,121,45,49,51,49,0,84,104,105,115,32,105,115,32,97,32,116,101,115,116,32,117,115,105,110,103,32,97,32,108,97,114,103,101,114,32,116,104,97,110,32,98,108,111,99,107,45,115,105,122,101,32,107,101,121,32,97,110,100,32,97,32,108,97,114,103,101,114,32,116,104,97,110,32,98,108,111,99,107,45,115,105,122,101,32,100,97,116,97,46,32,84,104,101,32,107,101,121,32,110,101,101,100,115,32,116,111,32,98,101,32,104,97,115,104,101,100,32,98,101,102,111,114,101,32,98,101,105,110,103,32,117,115,101,100,32,98,121,32,116,104,101,32,72,77,65,67,32,97,108,103,111,114,105,116,104,109,46,0,100,111,101,115,32,110,111,116,32,109,97,116,99,104,0,103,99,114,121,95,109,100,95,115,101,116,107,101,121,32,102,97,105,108,101,100,0,103,99,114,121,95,109,100,95,114,101,97,100,32,102,97,105,108,101,100,0,105,110,118,97,108,105,100,32,116,101,115,116,115,32,100,97,116,97,0,111,105,100,46,0,79,73,68,46,0,109,100,95,101,110,97,98,108,101,58,32,97,108,103,111,114,105,116,104,109,32,37,100,32,110,111,116,32,97,118,97,105,108,97,98,108,101,10,0,77,68,53,32,117,115,101,100,0,109,100,46,99,0,109,100,95,119,114,105,116,101,0,109,100,95,103,101,116,95,97,108,103,111,0,112,111,115,115,105,98,108,101,32,117,115,97,103,101,32,101,114,114,111,114,0,87,65,82,78,73,78,71,58,32,109,111,114,101,32,116,104,97,110,32,111,110,101,32,97,108,103,111,114,105,116,104,109,32,105,110,32,109,100,95,103,101,116,95,97,108,103,111,40,41,10,0,109,111,114,101,32,116,104,97,110,32,111,110,101,32,97,108,103,111,114,105,116,104,109,32,105,110,32,109,100,95,114,101,97,100,40,48,41,10,0,109,100,95,114,101,97,100,0,107,101,121,108,101,110,32,60,61,32,104,100,45,62,99,116,120,45,62,109,97,99,112,97,100,115,95,66,115,105,122,101,0,112,114,101,112,97,114,101,95,109,97,99,112,97,100,115,0,103,99,114,121,95,109,100,95,111,112,101,110,32,102,97,105,108,101,100,32,102,111,114,32,97,108,103,111,32,37,100,58,32,37,115,0,110,111,32,65,83,78,46,49,32,79,73,68,32,102,111,114,32,109,100,32,97,108,103,111,32,37,100,10,0,112,114,105,109,101,103,101,110,0,99,97,110,39,116,32,103,101,110,101,114,97,116,101,32,97,32,112,114,105,109,101,32,119,105,116,104,32,108,101,115,115,32,116,104,97,110,32,37,100,32,98,105,116,115,10,0,111,118,101,114,102,108,111,119,32,105,110,32,112,114,105,109,101,32,103,101,110,101,114,97,116,105,111,110,10,0,95,103,99,114,121,95,109,112,105,95,99,109,112,40,32,40,120,41,44,32,40,110,109,105,110,117,115,49,41,32,41,32,60,32,48,32,38,38,32,95,103,99,114,121,95,109,112,105,95,99,109,112,95,117,105,40,32,40,120,41,44,32,40,49,41,32,41,32,62,32,48,0,112,114,105,109,101,103,101,110,46,99,0,105,115,95,112,114,105,109,101,0,112,115,115,0,114,97,119,0,99,111,109,112,0,111,97,101,112,0,112,107,99,115,49,0,112,97,114,97,109,0,110,111,99,111,109,112,0,114,102,99,54,57,55,57,0,110,111,112,97,114,97,109,0,112,107,99,115,49,45,114,97,119,0,105,103,110,105,110,118,102,108,97,103,0,110,111,45,107,101,121,116,101,115,116,0,110,111,45,98,108,105,110,100,105,110,103,0,117,115,101,45,102,105,112,115,49,56,54,0,117,115,101,45,102,105,112,115,49,56,54,45,50,0,110,98,105,116,115,0,114,115,97,45,117,115,101,45,101,0,115,105,103,45,118,97,108,0,104,97,115,104,45,97,108,103,111,0,108,97,98,101,108,0,114,97,110,100,111,109,45,111,118,101,114,114,105,100,101,0,115,104,97,49,0,109,100,53,0,115,104,97,50,53,54,0,114,105,112,101,109,100,49,54,48,0,114,109,100,49,54,48,0,115,104,97,51,56,52,0,115,104,97,53,49,50,0,115,104,97,50,50,52,0,109,100,50,0,109,100,52,0,116,105,103,101,114,0,104,97,118,97,108,0,100,97,116,97,0,104,97,115,104,0,115,97,108,116,45,108,101,110,103,116,104,0,63,0,112,114,105,118,97,116,101,45,107,101,121,0,112,117,98,108,105,99,45,107,101,121,0,103,101,110,107,101,121,0,97,108,103,111,114,105,116,104,109,32,100,105,115,97,98,108,101,100,0,97,108,103,111,114,105,116,104,109,32,110,111,116,32,102,111,117,110,100,0,110,111,32,115,101,108,102,116,101,115,116,32,97,118,97,105,108,97,98,108,101,0,109,111,100,117,108,101,0,65,69,83,0,232,233,234,235,237,238,239,240,242,243,244,245,247,248,249,250,1,75,175,34,120,166,157,51,29,81,128,16,54,67,233,154,103,67,195,209,81,154,180,242,205,154,120,171,9,165,17,189,65,69,83,45,49,50,56,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,65,69,83,45,49,50,56,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,99,102,98,0,111,102,98,0,108,111,119,45,108,101,118,101,108,0,99,105,112,104,101,114,0,4,5,6,7,9,10,11,12,14,15,16,17,19,20,21,22,24,25,26,27,29,30,31,32,118,119,116,117,241,242,243,244,248,249,230,231,119,112,113,114,93,30,242,13,206,214,188,188,18,19,26,199,197,71,136,170,65,69,83,45,49,57,50,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,65,69,83,45,49,57,50,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,8,9,10,11,13,14,15,16,18,19,20,21,23,24,25,26,28,29,30,31,33,34,35,36,38,39,40,41,43,44,45,46,6,154,0,127,199,106,69,159,152,186,249,23,254,223,149,33,8,14,149,23,235,22,119,113,154,207,114,128,134,4,10,227,65,69,83,45,50,53,54,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,65,69,83,45,50,53,54,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,110,111,32,116,101,115,116,32,100,97,116,97,32,102,111,114,32,116,104,105,115,32,109,111,100,101,0,111,112,101,110,0,115,101,116,32,107,101,121,0,115,101,116,32,73,86,0,101,110,99,114,121,112,116,32,99,111,109,109,97,110,100,0,101,110,99,114,121,112,116,32,109,105,115,109,97,116,99,104,0,100,101,99,114,121,112,116,32,99,111,109,109,97,110,100,0,100,101,99,114,121,112,116,32,109,105,115,109,97,116,99,104,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,49,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,51,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,0,82,73,74,78,68,65,69,76,0,65,69,83,49,50,56,0,65,69,83,45,49,50,56,0,65,69,83,49,57,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,49,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,51,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,50,52,0,82,73,74,78,68,65,69,76,49,57,50,0,65,69,83,45,49,57,50,0,65,69,83,50,53,54,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,49,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,50,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,51,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,49,46,52,52,0,82,73,74,78,68,65,69,76,50,53,54,0,65,69,83,45,50,53,54,0,82,73,80,69,77,68,49,54,48,0,48,33,48,9,6,5,43,36,3,2,1,5,0,4,20,49,46,51,46,51,54,46,51,46,51,46,49,46,50,0,49,46,51,46,51,54,46,51,46,50,46,49,0,105,32,62,32,48,0,114,115,97,45,99,111,109,109,111,110,46,99,0,95,103,99,114,121,95,114,115,97,95,112,107,99,115,49,95,101,110,99,111,100,101,95,102,111,114,95,101,110,99,0,110,32,61,61,32,110,102,114,97,109,101,0,80,75,67,83,35,49,32,98,108,111,99,107,32,116,121,112,101,32,50,32,101,110,99,111,100,101,100,32,100,97,116,97,0,118,97,108,117,101,32,101,120,116,114,97,99,116,101,100,32,102,114,111,109,32,80,75,67,83,35,49,32,98,108,111,99,107,32,116,121,112,101,32,50,32,101,110,99,111,100,101,100,32,100,97,116,97,0,105,32,62,32,49,0,95,103,99,114,121,95,114,115,97,95,112,107,99,115,49,95,101,110,99,111,100,101,95,102,111,114,95,115,105,103,0,80,75,67,83,35,49,32,98,108,111,99,107,32,116,121,112,101,32,49,32,101,110,99,111,100,101,100,32,100,97,116,97,0,95,103,99,114,121,95,114,115,97,95,112,107,99,115,49,95,101,110,99,111,100,101,95,114,97,119,95,102,111,114,95,115,105,103,0,79,65,69,80,32,101,110,99,111,100,101,100,32,100,97,116,97,0,118,97,108,117,101,32,101,120,116,114,97,99,116,101,100,32,102,114,111,109,32,79,65,69,80,32,101,110,99,111,100,101,100,32,100,97,116,97,0,104,108,101,110,0,95,103,99,114,121,95,114,115,97,95,112,115,115,95,101,110,99,111,100,101,0,80,83,83,32,101,110,99,111,100,101,100,32,100,97,116,97,0,95,103,99,114,121,95,114,115,97,95,112,115,115,95,118,101,114,105,102,121,0,82,83,65,0,110,101,0,110,101,100,112,113,117,0,97,0,115,0,110,0,40,112,114,105,118,97,116,101,45,107,101,121,32,40,114,115,97,32,32,40,110,32,35,48,48,101,48,99,101,57,54,102,57,48,98,54,99,57,101,48,50,102,51,57,50,50,98,101,97,100,97,57,51,102,101,53,48,97,56,55,53,101,97,99,54,98,99,99,49,56,98,98,57,97,57,99,102,50,101,56,52,57,54,53,99,97,97,32,32,32,32,32,32,50,100,49,102,102,57,53,97,55,102,53,52,50,52,54,53,99,54,99,48,99,49,57,100,50,55,54,101,52,53,50,54,99,101,48,52,56,56,54,56,97,55,97,57,49,52,102,100,51,52,51,99,99,51,97,56,55,100,100,55,52,50,57,49,32,32,32,32,32,32,102,102,99,53,54,53,53,48,54,100,53,98,98,98,50,53,99,98,97,99,54,97,48,101,50,100,100,49,102,56,98,99,97,97,98,48,100,52,97,50,57,99,50,102,51,55,99,57,53,48,102,51,54,51,52,56,52,98,102,50,54,57,102,55,32,32,32,32,32,32,56,57,49,52,52,48,52,54,52,98,97,102,55,57,56,50,55,101,48,51,97,51,54,101,55,48,98,56,49,52,57,51,56,101,101,98,100,99,54,51,101,57,54,52,50,52,55,98,101,55,53,100,99,53,56,98,48,49,52,98,55,101,97,50,53,49,35,41,32,32,40,101,32,35,48,49,48,48,48,49,35,41,32,32,40,100,32,35,48,52,54,49,50,57,102,50,52,56,57,100,55,49,53,55,57,98,101,48,97,55,53,102,101,48,50,57,98,100,54,99,100,98,53,55,52,101,98,102,53,55,101,97,56,97,53,98,48,102,100,97,57,52,50,99,97,98,57,52,51,98,49,49,32,32,32,32,32,32,55,100,55,98,98,57,53,101,53,100,50,56,56,55,53,101,48,102,57,102,99,53,102,99,99,48,54,97,55,50,102,54,100,53,48,50,52,54,52,100,97,98,100,101,100,55,56,101,102,54,98,55,49,54,49,55,55,98,56,51,100,53,98,100,32,32,32,32,32,32,99,53,52,51,100,99,53,100,51,102,101,100,57,51,50,101,53,57,102,53,56,57,55,101,57,50,101,54,102,53,56,97,48,102,51,51,52,50,52,49,48,54,97,51,98,54,102,97,50,99,98,102,56,55,55,53,49,48,101,52,97,99,50,49,32,32,32,32,32,32,99,51,101,101,52,55,56,53,49,101,57,55,100,49,50,57,57,54,50,50,50,97,99,51,53,54,54,100,52,99,99,98,48,98,56,51,100,49,54,52,48,55,52,97,98,102,55,100,101,54,53,53,102,99,50,52,52,54,100,97,49,55,56,49,35,41,32,32,40,112,32,35,48,48,101,56,54,49,98,55,48,48,101,49,55,101,56,97,102,101,54,56,51,55,101,55,53,49,50,101,51,53,98,54,99,97,49,49,100,48,97,101,52,55,100,56,98,56,53,49,54,49,99,54,55,98,97,102,54,52,51,55,55,50,49,51,32,32,32,32,32,32,102,101,53,50,100,55,55,50,102,50,48,51,53,98,51,99,97,56,51,48,97,102,52,49,100,56,97,52,49,50,48,101,49,99,49,99,55,48,100,49,50,99,99,50,50,102,48,48,100,50,56,100,51,49,100,100,52,56,97,56,100,52,50,52,102,49,35,41,32,32,40,113,32,35,48,48,102,55,97,55,99,97,53,51,54,55,99,54,54,49,102,56,101,54,50,100,102,51,52,102,48,100,48,53,99,49,48,99,56,56,101,53,52,57,50,51,52,56,100,100,55,98,100,100,99,57,52,50,99,57,97,56,102,51,54,57,102,57,32,32,32,32,32,32,51,53,97,48,55,55,56,53,100,50,100,98,56,48,53,50,49,53,101,100,55,56,54,101,52,50,56,53,100,102,49,54,53,56,101,101,100,51,99,101,56,52,102,52,54,57,98,56,49,98,53,48,100,51,53,56,52,48,55,98,52,97,100,51,54,49,35,41,32,32,40,117,32,35,51,48,52,53,53,57,97,57,101,97,100,53,54,100,50,51,48,57,100,50,48,51,56,49,49,97,54,52,49,98,98,49,97,48,57,54,50,54,98,99,56,101,98,51,54,102,102,102,97,50,51,99,57,54,56,101,99,53,98,100,56,57,49,101,32,32,32,32,32,32,101,98,98,97,102,99,55,51,97,101,54,54,54,101,48,49,98,97,55,99,56,57,57,48,98,97,101,48,54,99,99,50,98,98,101,49,48,98,55,53,101,54,57,102,99,97,99,98,51,53,51,97,54,52,55,51,48,55,57,100,56,101,57,98,35,41,41,41,0,40,112,117,98,108,105,99,45,107,101,121,32,40,114,115,97,32,32,40,110,32,35,48,48,101,48,99,101,57,54,102,57,48,98,54,99,57,101,48,50,102,51,57,50,50,98,101,97,100,97,57,51,102,101,53,48,97,56,55,53,101,97,99,54,98,99,99,49,56,98,98,57,97,57,99,102,50,101,56,52,57,54,53,99,97,97,32,32,32,32,32,32,50,100,49,102,102,57,53,97,55,102,53,52,50,52,54,53,99,54,99,48,99,49,57,100,50,55,54,101,52,53,50,54,99,101,48,52,56,56,54,56,97,55,97,57,49,52,102,100,51,52,51,99,99,51,97,56,55,100,100,55,52,50,57,49,32,32,32,32,32,32,102,102,99,53,54,53,53,48,54,100,53,98,98,98,50,53,99,98,97,99,54,97,48,101,50,100,100,49,102,56,98,99,97,97,98,48,100,52,97,50,57,99,50,102,51,55,99,57,53,48,102,51,54,51,52,56,52,98,102,50,54,57,102,55,32,32,32,32,32,32,56,57,49,52,52,48,52,54,52,98,97,102,55,57,56,50,55,101,48,51,97,51,54,101,55,48,98,56,49,52,57,51,56,101,101,98,100,99,54,51,101,57,54,52,50,52,55,98,101,55,53,100,99,53,56,98,48,49,52,98,55,101,97,50,53,49,35,41,32,32,40,101,32,35,48,49,48,48,48,49,35,41,41,41,0,40,100,97,116,97,32,40,102,108,97,103,115,32,112,107,99,115,49,41,32,40,104,97,115,104,32,115,104,97,49,32,35,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,48,48,97,97,98,98,99,99,100,100,101,101,102,102,49,48,50,48,51,48,52,48,35,41,41,0,40,100,97,116,97,32,40,102,108,97,103,115,32,112,107,99,115,49,41,32,40,104,97,115,104,32,115,104,97,49,32,35,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,48,48,97,97,98,98,99,99,100,100,101,101,102,102,56,48,50,48,51,48,52,48,35,41,41,0,98,97,100,32,115,105,103,110,97,116,117,114,101,32,110,111,116,32,100,101,116,101,99,116,101,100,0,99,111,110,118,101,114,116,105,110,103,32,100,97,116,97,32,102,97,105,108,101,100,0,115,105,103,110,105,110,103,32,102,97,105,108,101,100,0,118,101,114,105,102,121,32,102,97,105,108,101,100,0,40,100,97,116,97,32,40,102,108,97,103,115,32,114,97,119,41,32,40,118,97,108,117,101,32,37,109,41,41,0,101,110,99,45,118,97,108,0,114,115,97,0,118,97,108,117,101,0,109,105,115,109,97,116,99,104,0,101,110,99,114,121,112,116,32,102,97,105,108,101,100,0,103,99,114,121,95,112,107,95,100,101,99,114,121,112,116,32,114,101,116,117,114,110,101,100,32,103,97,114,98,97,103,101,0,99,105,112,104,101,114,116,101,120,116,32,109,97,116,99,104,101,115,32,112,108,97,105,110,116,101,120,116,0,100,101,99,114,121,112,116,32,102,97,105,108,101,100,0,100,101,99,114,121,112,116,32,114,101,116,117,114,110,101,100,32,110,111,32,112,108,97,105,110,116,101,120,116,0,99,111,110,118,101,114,116,0,107,101,121,32,99,111,110,115,105,115,116,101,110,99,121,0,115,105,103,110,0,101,110,99,114,121,112,116,0,112,117,98,107,101,121,0,114,115,97,95,118,101,114,105,102,121,32,100,97,116,97,0,114,115,97,95,118,101,114,105,102,121,32,32,115,105,103,0,114,115,97,95,118,101,114,105,102,121,32,32,32,32,110,0,114,115,97,95,118,101,114,105,102,121,32,32,32,32,101,0,114,115,97,95,118,101,114,105,102,121,32,32,99,109,112,0,114,115,97,95,118,101,114,105,102,121],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+30720);allocate([32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,115,105,103,110,32,32,32,100,97,116,97,0,110,101,100,112,63,113,63,117,63,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,110,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,101,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,100,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,112,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,113,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,117,0,114,115,97,95,115,105,103,110,32,32,32,32,114,101,115,0,40,115,105,103,45,118,97,108,40,114,115,97,40,115,37,98,41,41,41,0,40,115,105,103,45,118,97,108,40,114,115,97,40,115,37,77,41,41,41,0,114,115,97,95,115,105,103,110,32,32,32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,100,101,99,114,121,112,116,32,100,97,116,97,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,110,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,101,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,100,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,112,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,113,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,117,0,114,115,97,95,100,101,99,114,121,112,116,32,32,114,101,115,0,40,118,97,108,117,101,32,37,98,41,0,37,109,0,114,115,97,95,100,101,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,101,110,99,114,121,112,116,32,100,97,116,97,0,114,115,97,95,101,110,99,114,121,112,116,32,32,32,32,110,0,114,115,97,95,101,110,99,114,121,112,116,32,32,32,32,101,0,114,115,97,95,101,110,99,114,121,112,116,32,32,114,101,115,0,40,101,110,99,45,118,97,108,40,114,115,97,40,97,37,98,41,41,41,0,40,101,110,99,45,118,97,108,40,114,115,97,40,97,37,109,41,41,41,0,114,115,97,95,101,110,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,114,115,97,95,116,101,115,116,107,101,121,32,32,32,32,61,62,32,37,115,10,0,100,101,114,105,118,101,45,112,97,114,109,115,0,117,115,101,45,120,57,51,49,0,95,103,99,114,121,95,109,112,105,95,103,101,116,95,110,98,105,116,115,32,40,40,120,112,41,41,32,61,61,32,110,98,105,116,115,0,114,115,97,46,99,0,103,101,110,95,120,57,51,49,95,112,97,114,109,95,120,112,0,95,103,99,114,121,95,109,112,105,95,103,101,116,95,110,98,105,116,115,32,40,40,120,105,41,41,32,61,61,32,49,48,49,0,103,101,110,95,120,57,51,49,95,112,97,114,109,95,120,105,0,88,112,49,0,88,112,50,0,88,112,0,88,113,49,0,88,113,50,0,88,113,0,95,103,99,114,121,95,109,112,105,95,103,99,100,32,40,32,40,103,41,44,32,40,101,41,44,32,40,112,104,105,41,32,41,0,103,101,110,101,114,97,116,101,95,120,57,51,49,0,112,32,97,110,100,32,113,32,97,114,101,32,115,119,97,112,112,101,100,10,0,32,32,113,0,32,32,110,0,32,32,101,0,32,32,100,0,32,32,117,0,115,101,108,102,45,116,101,115,116,32,97,102,116,101,114,32,107,101,121,32,103,101,110,101,114,97,116,105,111,110,32,102,97,105,108,101,100,0,40,109,105,115,99,45,107,101,121,45,105,110,102,111,40,112,45,113,45,115,119,97,112,112,101,100,41,41,0,103,101,110,101,114,97,116,101,95,115,116,100,0,32,32,112,61,32,0,32,32,113,61,32,0,112,104,105,61,32,0,32,32,103,61,32,0,32,32,102,61,32,0,32,32,110,61,32,0,32,32,101,61,32,0,32,32,100,61,32,0,32,32,117,61,32,0,40,107,101,121,45,100,97,116,97,32,40,112,117,98,108,105,99,45,107,101,121,32,32,40,114,115,97,40,110,37,109,41,40,101,37,109,41,41,41,32,40,112,114,105,118,97,116,101,45,107,101,121,32,32,40,114,115,97,40,110,37,109,41,40,101,37,109,41,40,100,37,109,41,40,112,37,109,41,40,113,37,109,41,40,117,37,109,41,41,41,32,37,83,41,0,111,112,101,110,112,103,112,45,114,115,97,0,111,105,100,46,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,0,83,72,65,49,0,48,33,48,9,6,5,43,14,3,2,26,5,0,4,20,169,153,62,54,71,6,129,106,186,62,37,113,120,80,194,108,156,208,216,157,0,132,152,62,68,28,59,210,110,186,174,74,161,249,81,41,229,229,70,112,241,0,52,170,151,60,212,196,218,164,246,30,235,43,219,173,39,49,101,52,1,111,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,53,0,49,46,50,46,56,52,48,46,49,48,48,52,48,46,52,46,51,0,49,46,51,46,49,52,46,51,46,50,46,50,54,0,49,46,51,46,49,52,46,51,46,50,46,50,57,0,49,46,50,46,56,52,48,46,49,48,48,52,53,46,52,46,49,0,83,72,65,50,50,52,0,48,45,48,13,6,9,96,134,72,1,101,3,4,2,4,5,0,4,28,35,9,125,34,52,5,216,34,134,66,164,119,189,162,85,179,42,173,188,228,189,160,179,247,227,108,157,167,0,97,98,99,100,98,99,100,101,99,100,101,102,100,101,102,103,101,102,103,104,102,103,104,105,103,104,105,106,104,105,106,107,105,106,107,108,106,107,108,109,107,108,109,110,108,109,110,111,109,110,111,112,110,111,112,113,0,117,56,139,22,81,39,118,204,93,186,93,161,253,137,1,80,176,198,69,92,180,245,139,25,82,82,37,37,0,32,121,70,85,152,12,145,216,187,180,193,234,151,97,138,75,240,63,66,88,25,72,178,238,78,231,173,103,0,186,120,22,191,143,1,207,234,65,65,64,222,93,174,34,35,176,3,97,163,150,23,122,156,180,16,255,97,242,0,21,173,0,36,141,106,97,210,6,56,184,229,192,38,147,12,62,96,57,163,60,228,89,100,255,33,103,246,236,237,212,25,219,6,193,0,205,199,110,92,153,20,251,146,129,161,199,226,132,215,62,103,241,128,154,72,164,151,32,14,4,109,57,204,199,17,44,208,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,52,0,83,72,65,50,53,54,0,48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,49,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,49,0,83,72,65,53,49,50,0,48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64,97,98,99,0,203,0,117,63,69,163,94,139,181,160,61,105,154,198,80,7,39,44,50,171,14,222,209,99,26,139,96,90,67,255,91,237,128,134,7,43,161,231,204,35,88,186,236,161,52,200,37,167,0,97,98,99,100,101,102,103,104,98,99,100,101,102,103,104,105,99,100,101,102,103,104,105,106,100,101,102,103,104,105,106,107,101,102,103,104,105,106,107,108,102,103,104,105,106,107,108,109,103,104,105,106,107,108,109,110,104,105,106,107,108,109,110,111,105,106,107,108,109,110,111,112,106,107,108,109,110,111,112,113,107,108,109,110,111,112,113,114,108,109,110,111,112,113,114,115,109,110,111,112,113,114,115,116,110,111,112,113,114,115,116,117,0,9,51,12,51,247,17,71,232,61,25,47,199,130,205,27,71,83,17,27,23,59,59,5,210,47,160,128,134,227,176,247,18,252,199,199,26,85,126,45,185,102,195,233,250,145,116,96,57,0,157,14,24,9,113,100,116,203,8,110,131,78,49,10,74,28,237,20,158,156,0,242,72,82,121,114,206,197,112,76,42,91,7,184,179,220,56,236,196,235,174,151,221,216,127,61,137,133,0,115,104,111,114,116,32,115,116,114,105,110,103,0,108,111,110,103,32,115,116,114,105,110,103,0,111,110,101,32,109,105,108,108,105,111,110,32,34,97,34,0,100,105,103,101,115,116,0,221,175,53,161,147,97,122,186,204,65,115,73,174,32,65,49,18,230,250,78,137,169,126,162,10,158,238,230,75,85,211,154,33,146,153,42,39,79,193,168,54,186,60,35,163,254,235,189,69,77,68,35,100,60,232,14,42,154,201,79,165,76,164,159,0,142,149,155,117,218,227,19,218,140,244,247,40,20,252,20,63,143,119,121,198,235,159,127,161,114,153,174,173,182,136,144,24,80,29,40,158,73,0,247,228,51,27,153,222,196,181,67,58,199,211,41,238,182,221,38,84,94,150,229,91,135,75,233,9,0,231,24,72,61,12,231,105,100,78,46,66,199,188,21,180,99,142,31,152,177,59,32,68,40,86,50,168,3,175,169,115,235,222,15,242,68,135,126,166,10,76,176,67,44,229,119,195,27,235,0,156,92,44,73,170,46,78,173,178,23,173,140,192,155,0,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,51,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,51,0,83,72,65,51,56,52,0,48,65,48,13,6,9,96,134,72,1,101,3,4,2,2,5,0,4,48,50,46,49,54,46,56,52,48,46,49,46,49,48,49,46,51,46,52,46,50,46,50,0,49,46,50,46,56,52,48,46,49,49,51,53,52,57,46,49,46,49,46,49,50,0,84,87,79,70,73,83,72,0,159,88,159,92,246,18,44,50,182,191,236,47,42,232,195,90,212,145,219,22,231,177,195,158,134,203,8,107,120,159,84,25,1,159,152,9,222,23,17,133,143,170,195,163,186,32,251,195,212,59,183,85,110,163,46,70,242,162,130,183,212,91,78,13,87,255,115,157,77,201,44,27,215,252,1,112,12,200,33,111,144,175,233,27,178,136,84,79,44,50,220,35,155,38,53,230,108,180,86,28,64,191,10,151,5,147,28,182,212,8,231,250,84,119,111,102,105,115,104,45,50,53,54,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,84,119,111,102,105,115,104,45,50,53,54,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,84,119,111,102,105,115,104,45,49,50,56,32,116,101,115,116,32,100,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,84,119,111,102,105,115,104,45,49,50,56,32,116,101,115,116,32,101,110,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,46,0,37,115,10,0,0,1,23,2,46,24,83,3,106,47,147,25,52,84,69,4,92,107,182,48,166,148,75,26,140,53,129,85,170,70,13,5,36,93,135,108,155,183,193,49,43,167,163,149,152,76,202,27,230,141,115,54,205,130,18,86,98,171,240,71,79,14,189,6,212,37,210,94,39,136,102,109,214,156,121,184,8,194,223,50,104,44,253,168,138,164,90,150,41,153,34,77,96,203,228,28,123,231,59,142,158,116,244,55,216,206,249,131,111,19,178,87,225,99,220,172,196,241,175,72,10,80,66,15,186,190,199,7,222,213,120,38,101,211,209,95,227,40,33,137,89,103,252,110,177,215,248,157,243,122,58,185,198,9,65,195,174,224,219,51,68,105,146,45,82,254,22,169,12,139,128,165,74,91,181,151,201,42,162,154,192,35,134,78,188,97,239,204,17,229,114,29,61,124,235,232,233,60,234,143,125,159,236,117,30,245,62,56,246,217,63,207,118,250,31,132,160,112,237,20,144,179,126,88,251,226,32,100,208,221,119,173,218,197,64,242,57,176,247,73,180,11,127,81,21,67,145,16,113,187,238,191,133,200,161,1,2,4,8,16,32,64,128,77,154,121,242,169,31,62,124,248,189,55,110,220,245,167,3,6,12,24,48,96,192,205,215,227,139,91,182,33,66,132,69,138,89,178,41,82,164,5,10,20,40,80,160,13,26,52,104,208,237,151,99,198,193,207,211,235,155,123,246,161,15,30,60,120,240,173,23,46,92,184,61,122,244,165,7,14,28,56,112,224,141,87,174,17,34,68,136,93,186,57,114,228,133,71,142,81,162,9,18,36,72,144,109,218,249,191,51,102,204,213,231,131,75,150,97,194,201,223,243,171,27,54,108,216,253,183,35,70,140,85,170,25,50,100,200,221,247,163,11,22,44,88,176,45,90,180,37,74,148,101,202,217,255,179,43,86,172,21,42,84,168,29,58,116,232,157,119,238,145,111,222,241,175,19,38,76,152,125,250,185,63,126,252,181,39,78,156,117,234,153,127,254,177,47,94,188,53,106,212,229,135,67,134,65,130,73,146,105,210,233,159,115,230,129,79,158,113,226,137,95,190,49,98,196,197,199,195,203,219,251,187,59,118,236,149,103,206,209,239,147,107,214,225,143,83,166,1,2,4,8,16,32,64,128,77,154,121,242,169,31,62,124,248,189,55,110,220,245,167,3,6,12,24,48,96,192,205,215,227,139,91,182,33,66,132,69,138,89,178,41,82,164,5,10,20,40,80,160,13,26,52,104,208,237,151,99,198,193,207,211,235,155,123,246,161,15,30,60,120,240,173,23,46,92,184,61,122,244,165,7,14,28,56,112,224,141,87,174,17,34,68,136,93,186,57,114,228,133,71,142,81,162,9,18,36,72,144,109,218,249,191,51,102,204,213,231,131,75,150,97,194,201,223,243,171,27,54,108,216,253,183,35,70,140,85,170,25,50,100,200,221,247,163,11,22,44,88,176,45,90,180,37,74,148,101,202,217,255,179,43,86,172,21,42,84,168,29,58,116,232,157,119,238,145,111,222,241,175,19,38,76,152,125,250,185,63,126,252,181,39,78,156,117,234,153,127,254,177,47,94,188,53,106,212,229,135,67,134,65,130,73,146,105,210,233,159,115,230,129,79,158,113,226,137,95,190,49,98,196,197,199,195,203,169,117,103,243,179,198,232,244,4,219,253,123,163,251,118,200,154,74,146,211,128,230,120,107,228,69,221,125,209,232,56,75,13,214,198,50,53,216,152,253,24,55,247,113,236,241,108,225,67,48,117,15,55,248,38,27,250,135,19,250,148,6,72,63,242,94,208,186,139,174,48,91,132,138,84,0,223,188,35,157,25,109,91,193,61,177,89,14,243,128,174,93,162,210,130,213,99,160,1,132,131,7,46,20,217,181,81,144,155,44,124,163,166,178,235,115,165,76,190,84,22,146,12,116,227,54,97,81,192,56,140,176,58,189,245,90,115,252,44,96,37,98,11,150,187,108,78,66,137,247,107,16,83,124,106,40,180,39,241,140,225,19,230,149,189,156,69,199,226,36,244,70,182,59,102,112,204,202,149,227,3,133,86,203,212,17,28,208,30,147,215,184,251,166,195,131,142,32,181,255,233,159,207,119,191,195,186,204,234,3,119,111,57,8,175,191,51,64,201,231,98,43,113,226,129,121,121,12,9,170,173,130,36,65,205,58,249,234,216,185,229,228,197,154,185,164,77,151,68,126,8,218,134,122,231,23,161,102,29,148,170,161,237,29,6,61,112,240,178,222,210,179,65,11,123,114,160,167,17,28,49,239,194,209,39,83,144,62,32,143,246,51,96,38,255,95,150,236,92,118,177,42,171,73,158,129,156,136,82,238,27,33,95,196,147,26,10,235,239,217,145,197,133,57,73,153,238,205,45,173,79,49,143,139,59,1,71,24,135,35,109,221,70,31,214,78,62,45,105,249,100,72,42,79,206,242,203,101,47,142,252,120,151,92,5,88,122,25,172,141,127,229,213,152,26,87,75,103,14,127,167,5,90,100,40,175,20,99,63,182,41,254,136,245,60,183,76,60,2,165,184,206,218,233,176,104,23,68,85,224,31,77,138,67,125,105,87,41,199,46,141,172,116,21,183,89,196,168,159,10,114,158,126,110,21,71,34,223,18,52,88,53,7,106,153,207,52,220,110,34,80,201,222,192,104,155,101,137,188,212,219,237,248,171,200,18,168,162,43,13,64,82,220,187,254,2,50,47,164,169,202,215,16,97,33,30,240,180,211,80,93,4,15,246,0,194,111,22,157,37,54,134,66,86,74,85,94,9,193,190,224,145,117,243,198,244,219,123,251,200,74,211,230,107,69,125,232,75,214,50,216,253,55,113,241,225,48,15,248,27,135,250,6,63,94,186,174,91,138,0,188,157,109,193,177,14,128,93,210,213,160,132,7,20,181,144,44,163,178,115,76,84,146,116,54,81,56,176,189,90,252,96,98,150,108,66,247,16,124,40,39,140,19,149,156,199,36,70,59,112,202,227,133,203,17,208,147,184,166,131,32,255,159,119,195,204,3,111,8,191,64,231,43,226,121,12,170,130,65,58,234,185,228,154,164,151,126,218,122,23,102,148,161,29,61,240,222,179,11,114,167,28,239,209,83,62,143,51,38,95,236,118,42,73,129,136,238,33,196,26,235,217,197,57,153,205,173,49,139,1,24,35,221,31,78,45,249,72,79,242,101,142,120,92,88,25,141,229,152,87,103,127,5,100,175,99,182,254,245,183,60,165,206,233,104,68,224,77,67,105,41,46,172,21,89,168,10,158,110,71,223,52,53,106,207,220,34,201,192,155,137,212,237,171,18,162,13,82,187,2,47,169,215,97,30,180,80,4,246,194,22,37,134,86,85,9,190,145,169,103,179,232,4,253,163,118,154,146,128,120,228,221,209,56,13,198,53,152,24,247,236,108,67,117,55,38,250,19,148,72,242,208,139,48,132,84,223,35,25,91,61,89,243,174,162,130,99,1,131,46,217,81,155,124,166,235,165,190,22,12,227,97,192,140,58,245,115,44,37,11,187,78,137,107,83,106,180,241,225,230,189,69,226,244,182,102,204,149,3,86,212,28,30,215,251,195,142,181,233,207,191,186,234,119,57,175,51,201,98,113,129,121,9,173,36,205,249,216,229,197,185,77,68,8,134,231,161,29,170,237,6,112,178,210,65,123,160,17,49,194,39,144,32,246,96,255,150,92,177,171,158,156,82,27,95,147,10,239,145,133,73,238,45,79,143,59,71,135,109,70,214,62,105,100,42,206,203,47,252,151,5,122,172,127,213,26,75,14,167,90,40,20,63,41,136,60,76,2,184,218,176,23,85,31,138,125,87,199,141,116,183,196,159,114,126,21,34,18,88,7,153,52,110,80,222,104,101,188,219,248,200,168,43,64,220,254,50,164,202,16,33,240,211,93,15,0,111,157,54,66,74,94,193,224,84,87,79,70,73,83,72,49,50,56,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,110,111,110,99,101,32,98,117,102,102,101,114,32,108,111,99,107,58,32,37,115,10,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,110,111,110,99,101,32,98,117,102,102,101,114,32,108,111,99,107,58,32,37,115,10,0,37,115,46,42,0,37,115,46,88,0,101,99,95,105,110,118,109,58,32,105,110,118,101,114,115,101,32,100,111,101,115,32,110,111,116,32,101,120,105,115,116,58,10,0,32,32,97,0,32,32,112,0,37,115,58,32,71,101,116,116,105,110,103,32,89,45,99,111,111,114,100,105,110,97,116,101,32,111,110,32,37,115,32,105,115,32,110,111,116,32,115,117,112,112,111,114,116,101,100,10,0,95,103,99,114,121,95,109,112,105,95,101,99,95,103,101,116,95,97,102,102,105,110,101,0,77,111,110,116,103,111,109,101,114,121,0,71,67,82,89,80,84,95,66,65,82,82,69,84,84,0,37,115,58,32,37,115,32,110,111,116,32,121,101,116,32,115,117,112,112,111,114,116,101,100,10,0,95,103,99,114,121,95,109,112,105,95,101,99,95,100,117,112,95,112,111,105,110,116,0,95,103,99,114,121,95,109,112,105,95,101,99,95,97,100,100,95,112,111,105,110,116,115,0,0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,33,98,112,95,109,97,114,107,101,114,0,109,112,105,45,112,111,119,46,99,0,95,103,99,114,121,95,109,112,105,95,112,111,119,109,0,114,101,115,45,62,100,32,61,61,32,114,112,0,105,32,61,61,32,110,108,105,109,98,115,0,109,112,105,99,111,100,101,114,46,99,0,95,103,99,114,121,95,109,112,105,95,115,101,116,95,98,117,102,102,101,114,0,58,103,101,110,101,114,105,99,47,109,112,105,104,45,97,100,100,49,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,115,117,98,49,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,109,117,108,49,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,109,117,108,50,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,109,117,108,51,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,108,115,104,105,102,116,46,99,58,103,101,110,101,114,105,99,47,109,112,105,104,45,114,115,104,105,102,116,46,99,0,87,97,114,110,105,110,103,58,32,116,114,121,105,110,103,32,116,111,32,99,104,97,110,103,101,32,97,110,32,105,109,109,117,116,97,98,108,101,32,77,80,73,10,0,105,110,118,97,108,105,100,32,102,108,97,103,32,118,97,108,117,101,32,105,110,32,109,112,105,95,102,114,101,101,10,0,109,112,105,95,103,101,116,95,111,112,97,113,117,101,32,111,110,32,110,111,114,109,97,108,32,109,112,105,10,0,109,112,105,95,115,101,116,95,99,111,110,100,58,32,100,105,102,102,101,114,101,110,116,32,115,105,122,101,115,10,0,109,112,105,95,115,119,97,112,95,99,111,110,100,58,32,100,105,102,102,101,114,101,110,116,32,115,105,122,101,115,10,0,105,110,118,97,108,105,100,32,102,108,97,103,32,118,97,108,117,101,10,0,105,110,118,97,108,105,100,32,109,112,105,95,99,111,110,115,116,32,115,101,108,101,99,116,111,114,32,37,100,10,0,77,80,73,32,115,117,98,115,121,115,116,101,109,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,10,0,10,10,84,104,105,115,32,105,115,32,76,105,98,103,99,114,121,112,116,32,49,46,55,46,48,45,98,101,116,97,50,51,48,32,45,32,84,104,101,32,71,78,85,32,67,114,121,112,116,111,32,76,105,98,114,97,114,121,10,67,111,112,121,114,105,103,104,116,32,40,67,41,32,50,48,48,48,45,50,48,49,50,32,70,114,101,101,32,83,111,102,116,119,97,114,101,32,70,111,117,110,100,97,116,105,111,110,44,32,73,110,99,46,10,67,111,112,121,114,105,103,104,116,32,40,67,41,32,50,48,49,50,45,50,48,49,52,32,103,49,48,32,67,111,100,101,32,71,109,98,72,10,67,111,112,121,114,105,103,104,116,32,40,67,41,32,50,48,49,51,45,50,48,49,52,32,74,117,115,115,105,32,75,105,118,105,108,105,110,110,97,10,10,40,97,51,54,101,101,55,53,48,32,50,48,49,55,45,48,51,45,49,48,84,50,49,58,51,54,43,48,48,48,48,41,10,10,10,0,99,105,112,104,101,114,45,99,109,97,99,46,99,0,99,109,97,99,95,103,101,110,101,114,97,116,101,95,115,117,98,107,101,121,115,0,99,45,62,117,110,117,115,101,100,32,60,32,98,108,111,99,107,115,105,122,101,0,99,105,112,104,101,114,45,99,116,114,46,99,0,95,103,99,114,121,95,99,105,112,104,101,114,95,99,116,114,95,101,110,99,114,121,112,116,0,117,110,117,115,101,100,32,61,61,32,98,108,111,99,107,115,105,122,101,0,99,105,112,104,101,114,45,103,99,109,46,99,0,100,111,95,103,104,97,115,104,95,98,117,102,0,115,101,108,102,116,101,115,116,32,102,111,114,32,67,66,67,32,102,97,105,108,101,100,32,45,32,115,101,101,32,115,121,115,108,111,103,32,102,111,114,32,100,101,116,97,105,108,115,0,115,101,116,107,101,121,32,102,97,105,108,101,100,0,102,97,105,108,101,100,32,116,111,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,0,115,101,108,102,116,101,115,116,32,102,111,114,32,67,70,66,32,102,97,105,108,101,100,32,45,32,115,101,101,32,115,121,115,108,111,103,32,102,111,114,32,100,101,116,97,105,108,115,0,115,101,108,102,116,101,115,116,32,102,111,114,32,67,84,82,32,102,97,105,108,101,100,32,45,32,115,101,101,32,115,121,115,108,111,103,32,102,111,114,32,100,101,116,97,105,108,115,0,69,67,67,0,112,97,98,103,110,104,113,0,112,97,98,103,110,104,113,100,0,115,119,0,114,115,0,102,108,97,103,115,0,112,63,97,63,98,63,103,63,110,63,104,63,47,113,0,112,63,97,63,98,63,103,63,110,63,104,63,113,0,47,113,0,113,0,99,117,114,118,101,0,112,97,98,103,110,104,113,40,49,58,37,99,37,117,58,0,41,0,112,0,101,99,99,95,118,101,114,105,102,121,32,100,97,116,97,0,47,114,115,0,101,99,99,95,118,101,114,105,102,121,32,32,115,95,114,0,101,99,99,95,118,101,114,105,102,121,32,32,115,95,115,0,45,112,63,97,63,98,63,103,63,110,63,104,63,47,113,0,43,69,100,68,83,65,0,101,99,99,95,118,101,114,105,102,121,32,105,110,102,111,58,32,37,115,47,37,115,37,115,10,0,101,99,99,95,118,101,114,105,102,121,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,112,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,97,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,98,0,101,99,99,95,118,101,114,105,102,121,32,32,103,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,110,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,104,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,113,0,71,111,111,100,0,101,99,99,95,118,101,114,105,102,121,32,32,32,32,61,62,32,37,115,10,0,101,99,99,95,115,105,103,110,32,32,32,100,97,116,97,0,45,112,63,97,63,98,63,103,63,110,63,104,63,47,113,63,43,100,0,47,113,63,43,100,0,101,99,99,95,115,105,103,110,32,32,32,105,110,102,111,58,32,37,115,47,37,115,37,115,10,0,101,99,99,95,115,105,103,110,32,32,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,112,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,97,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,98,0,101,99,99,95,115,105,103,110,32,32,32,32,103,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,110,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,104,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,113,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,100,0,40,115,105,103,45,118,97,108,40,101,100,100,115,97,40,114,37,77,41,40,115,37,77,41,41,41,0,40,115,105,103,45,118,97,108,40,103,111,115,116,40,114,37,77,41,40,115,37,77,41,41,41,0,40,115,105,103,45,118,97,108,40,101,99,100,115,97,40,114,37,77,41,40,115,37,77,41,41,41,0,101,99,99,95,115,105,103,110,32,32,32,32,32,32,61,62,32,37,115,10,0,101,0,101,99,99,95,100,101,99,114,121,112,116,32,32,100,95,101,0,45,112,63,97,63,98,63,103,63,110,63,104,63,43,100,0,101,99,99,95,100,101,99,114,121,112,116,32,105,110,102,111,58,32,37,115,47,37,115,10,0,101,99,99,95,100,101,99,114,121,112,116,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,112,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,97,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,98,0,101,99,99,95,100,101,99,114,121,112,116,32,32,103,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,110,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,104,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,100,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,101,99,99,95,100,101,99,114,121,112,116,32,32,114,101,115,0,40,118,97,108,117,101,32,37,109,41,0,101,99,99,95,100,101,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,101,99,99,95,101,110,99,114,121,112,116,32,100,97,116,97,0,45,112,63,97,63,98,63,103,63,110,63,104,63,43,113,0,101,99,99,95,101,110,99,114,121,112,116,32,105,110,102,111,58,32,37,115,47,37,115,10,0,101,99,99,95,101,110,99,114,121,112,116,32,110,97,109,101,58,32,37,115,10,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,112,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,97,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,98,0,101,99,99,95,101,110,99,114,121,112,116,32,32,103,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,110,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,104,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,113,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,107,100,71,10,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,107,71,10,0,40,101,110,99,45,118,97,108,40,101,99,100,104,40,115,37,109,41,40,101,37,109,41,41,41,0,101,99,99,95,101,110,99,114,121,112,116,32,32,32,32,61,62,32,37,115,10,0,101,99,99,95,116,101,115,116,107,101,121,32,105,110,102,58,32,37,115,47,37,115,10,0,101,99,99,95,116,101,115,116,107,101,121,32,110,97,109,58,32,37,115,10,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,112,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,97,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,98,0,101,99,99,95,116,101,115,116,107,101,121,32,103,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,110,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,104,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,113,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,100,0,66,97,100,32,99,104,101,99,107,58,32,80,111,105,110,116,32,39,71,39,32,100,111,101,115,32,110,111,116,32,98,101,108,111,110,103,32,116,111,32,99,117,114,118,101,32,39,69,39,33,10,0,66,97,100,32,99,104,101,99,107,58,32,39,71,39,32,99,97,110,110,111,116,32,98,101,32,80,111,105,110,116,32,97,116,32,73,110,102,105,110,105,116,121,33,10,0,99,104,101,99,107,95,115,101,99,114,101,116,95,107,101,121,58,32,69,32,105,115,32,110,111,116,32,97,32,99,117,114,118,101,32,111,102,32,111,114,100,101,114,32,110,10,0,66,97,100,32,99,104,101,99,107,58,32,81,32,99,97,110,32,110,111,116,32,98,101,32,97,32,80,111,105,110,116,32,97,116,32,73,110,102,105,110,105,116,121,33,10,0,66,97,100,32,99,104,101,99,107,58,32,99,111,109,112,117,116,97,116,105,111,110,32,111,102,32,100,71,32,102,97,105,108,101,100,10,0,66,97,100,32,99,104,101,99,107,58,32,84,104,101,114,101,32,105,115,32,78,79,32,99,111,114,114,101,115,112,111,110,100,101,110,99,101,32,98,101,116,119,101,101,110,32,39,100,39,32,97,110,100,32,39,81,39,33,10,0,101,99,99,95,116,101,115,116,107,101,121,32,32,32,61,62,32,37,115,10,0,116,114,97,110,115,105,101,110,116,45,107,101,121,0,101,99,103,101,110,32,99,117,114,118,101,32,105,110,102,111,58,32,37,115,47,37,115,10,0,101,99,103,101,110,32,99,117,114,118,101,32,117,115,101,100,58,32,37,115,10,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,112,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,97,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,98,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,110,0,101,99,103,101,110,32,99,117,114,118,101,32,32,32,104,0,101,99,103,101,110,32,99,117,114,118,101,32,71,0,101,99,103,101,110,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,37,115,10,0,81,0,101,99,103,101,110,32,99,111,110,118,101,114,116,101,100,32,81,32,116,111,32,97,32,99,111,109,112,108,105,97,110,116,32,112,111,105,110,116,10,0,101,99,103,101,110,32,100,105,100,110,39,116,32,110,101,101,100,32,116,111,32,99,111,110,118,101,114,116,32,81,32,116,111,32,97,32,99,111,109,112,108,105,97,110,116,32,112,111,105,110,116,10,0,84,101,115,116,105,110,103,32,107,101,121,46,10,0,69,67,68,83,65,32,111,112,101,114,97,116,105,111,110,58,32,115,105,103,110,32,102,97,105,108,101,100,10,0,69,67,68,83,65,32,111,112,101,114,97,116,105,111,110,58,32,115,105,103,110,44,32,118,101,114,105,102,121,32,102,97,105,108,101,100,10,0,69,67,68,83,65,32,111,112,101,114,97,116,105,111,110,58,32,115,105,103,110,44,32,118,101,114,105,102,121,32,111,107,46,10,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,104,107,81,10,0,101,99,100,104,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,32,102,111,114,32,104,100,107,71,10,0,69,67,68,72,32,116,101,115,116,32,102,97,105,108,101,100,46,10,0,71,0,40,99,117,114,118,101,32,37,115,41,0,40,102,108,97,103,115,32,112,97,114,97,109,41,0,40,102,108,97,103,115,32,101,100,100,115,97,41,0,40,102,108,97,103,115,32,112,97,114,97,109,32,101,100,100,115,97,41,0,40,107,101,121,45,100,97,116,97,32,40,112,117,98,108,105,99,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,112,37,109,41,40,97,37,109,41,40,98,37,109,41,40,103,37,109,41,40,110,37,109,41,40,104,37,109,41,40,113,37,109,41,41,41,32,40,112,114,105,118,97,116,101,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,112,37,109,41,40,97,37,109,41,40,98,37,109,41,40,103,37,109,41,40,110,37,109,41,40,104,37,109,41,40,113,37,109,41,40,100,37,109,41,41,41,32,41,0,40,107,101,121,45,100,97,116,97,32,40,112,117,98,108,105,99,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,113,37,109,41,41,41,32,40,112,114,105,118,97,116,101,45,107,101,121,32,32,40,101,99,99,37,83,37,83,40,113,37,109,41,40,100,37,109,41,41,41,32,41,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,112,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,97,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,98,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,71,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,110,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,104,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,81,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,100,0,101,99,103,101,110,32,114,101,115,117,108,116,32,32,117,115,105,110,103,32,69,100,50,53,53,49,57,43,69,100,68,83,65,10,0,101,99,99,0,101,99,100,115,97,0,101,99,100,104,0,101,100,100,115,97,0,103,111,115,116,0,100,105,103,101,115,116,32,109,105,115,109,97,116,99,104,0,105,110,118,97,108,105,100,32,68,65,84,65,77,79,68,69,0,100,105,103,101,115,116,32,115,105,122,101,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,101,120,112,101,99,116,101,100,32,115,105,122,101,0,103,99,114,121,95,109,100,95,111,112,101,110,32,102,97,105,108,101,100,0,104,97,115,104,45,99,111,109,109,111,110,46,99,0,95,103,99,114,121,95,109,100,95,98,108,111,99,107,95,119,114,105,116,101,0,238,166,167,37,28,30,114,145,109,17,194,203,33,77,60,37,37,57,18,29,142,35,78,101,45,101,31,164,200,207,248,128,142,153,59,159,72,104,18,115,194,150,80,186,50,252,118,206,72,51,46,167,22,77,150,164,71,111,184,197,49,161,24,106,192,223,193,124,152,220,232,123,77,167,240,17,236,72,201,114,113,210,194,15,155,146,143,226,39,13,111,184,99,213,23,56,180,142,238,227,20,167,204,138,185,50,22,69,72,229,38,174,144,34,67,104,81,122,207,234,189,107,179,115,43,192,233,218,153,131,43,97,202,1,182,222,86,36,74,158,136,213,249,179,121,115,246,34,164,61,20,166,89,155,31,101,76,180,90,116,227,85,165,243,255,199,112,63,148,0,229,42,125,251,75,61,51,5,217,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,255,254,253,252,251,250,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,100,175,226,232,214,173,123,189,210,135,249,124,68,98,61,57,80,111,108,121,49,51,48,53,32,116,101,115,116,32,52,32,102,97,105,108,101,100,46,0,80,111,108,121,49,51,48,53,32,116,101,115,116,32,49,32,102,97,105,108,101,100,46,0,80,111,108,121,49,51,48,53,32,116,101,115,116,32,50,32,102,97,105,108,101,100,46,0,80,111,108,121,49,51,48,53,32,116,101,115,116,32,51,32,102,97,105,108,101,100,46,0,80,111,108,121,49,51,48,53,32,115,101,108,102,116,101,115,116,32,102,97,105,108,101,100,32,40,37,115,41,10,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,112,111,111,108,32,108,111,99,107,58,32,37,115,10,0,110,111,32,101,110,116,114,111,112,121,32,103,97,116,104,101,114,105,110,103,32,109,111,100,117,108,101,32,100,101,116,101,99,116,101,100,10,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,112,111,111,108,32,108,111,99,107,58,32,37,115,10,0,32,40,104,119,114,110,103,32,102,97,105,108,101,100,41,0,114,97,110,100,111,109,32,117,115,97,103,101,58,32,112,111,111,108,115,105,122,101,61,37,100,32,109,105,120,101,100,61,37,108,117,32,112,111,108,108,115,61,37,108,117,47,37,108,117,32,97,100,100,101,100,61,37,108,117,47,37,108,117,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,111,117,116,109,105,120,61,37,108,117,32,103,101,116,108,118,108,49,61,37,108,117,47,37,108,117,32,103,101,116,108,118,108,50,61,37,108,117,47,37,108,117,37,115,10,0,112,111,111,108,95,105,115,95,108,111,99,107,101,100,0,114,97,110,100,111,109,45,99,115,112,114,110,103,46,99,0,109,105,120,95,112,111,111,108,0,114,101,97,100,95,112,111,111,108,0,97,100,100,95,114,97,110,100,111,109,110,101,115,115,0,116,111,111,32,109,97,110,121,32,114,97,110,100,111,109,32,98,105,116,115,32,114,101,113,117,101,115,116,101,100,10,0,99,97,110,39,116,32,111,112,101,110,32,96,37,115,39,58,32,37,115,10,0,99,97,110,39,116,32,115,116,97,116,32,96,37,115,39,58,32,37,115,10,0,96,37,115,39,32,105,115,32,110,111,116,32,97,32,114,101,103,117,108,97,114,32,102,105,108,101,32,45,32,105,103,110,111,114,101,100,10,0,110,111,116,101,58,32,114,97,110,100,111,109,95,115,101,101,100,32,102,105,108,101,32,105,115,32,101,109,112,116,121,10,0,119,97,114,110,105,110,103,58,32,105,110,118,97,108,105,100,32,115,105,122,101,32,111,102,32,114,97,110,100,111,109,95,115,101,101,100,32,102,105,108,101,32,45,32,110,111,116,32,117,115,101,100,10,0,99,97,110,39,116,32,114,101,97,100,32,96,37,115,39,58,32,37,115,10,0,83,108,111,119,32,101,110,116,114,111,112,121,32,103,97,116,104,101,114,105,110,103,32,109,111,100,117,108,101,32,110,111,116,32,121,101,116,32,105,110,105,116,105,97,108,105,122,101,100,10,0,78,111,32,119,97,121,32,116,111,32,103,97,116,104,101,114,32,101,110,116,114,111,112,121,32,102,111,114,32,116,104,101,32,82,78,71,10,0,100,111,95,102,97,115,116,95,114,97,110,100,111,109,95,112,111,108,108,0,99,97,110,39,116,32,108,111,99,107,32,96,37,115,39,58,32,37,115,10,0,119,97,105,116,105,110,103,32,102,111,114,32,108,111,99,107,32,111,110,32,96,37,115,39,46,46,46,10,0,95,103,99,114,121,95,114,110,103,99,115,112,114,110,103,95,115,101,116,95,115,101,101,100,95,102,105,108,101,0,110,111,116,101,58,32,114,97,110,100,111,109,95,115,101,101,100,32,102,105,108,101,32,110,111,116,32,117,112,100,97,116,101,100,10,0,99,97,110,39,116,32,99,114,101,97,116,101,32,96,37,115,39,58,32,37,115,10,0,99,97,110,39,116,32,119,114,105,116,101,32,96,37,115,39,58,32,37,115,10,0,99,97,110,39,116,32,99,108,111,115,101,32,96,37,115,39,58,32,37,115,10,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,33,110,111,110,99,101,95,99,111,110,116,101,120,116,45,62,116,101,115,116,95,100,116,95,112,116,114,0,114,97,110,100,111,109,45,102,105,112,115,46,99,0,95,103,99,114,121,95,114,110,103,102,105,112,115,95,105,110,105,116,105,97,108,105,122,101,0,33,115,116,100,95,114,110,103,95,99,111,110,116,101,120,116,45,62,116,101,115,116,95,100,116,95,112,116,114,0,33,115,116,114,111,110,103,95,114,110,103,95,99,111,110,116,101,120,116,45,62,116,101,115,116,95,100,116,95,112,116,114,0,109,101,109,111,114,121,32,99,111,114,114,117,112,116,105,111,110,32,100,101,116,101,99,116,101,100,32,105,110,32,82,78,71,32,99,111,110,116,101,120,116],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+40960);allocate([32,37,112,10,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,114,110,103,95,99,116,120,0,102,111,114,107,32,119,105,116,104,111,117,116,32,112,114,111,112,101,114,32,114,101,45,105,110,105,116,105,97,108,105,122,97,116,105,111,110,32,100,101,116,101,99,116,101,100,32,105,110,32,82,78,71,0,115,101,118,101,114,101,32,101,114,114,111,114,32,103,101,116,116,105,110,103,32,114,97,110,100,111,109,10,0,102,105,112,115,95,114,110,103,95,105,115,95,108,111,99,107,101,100,0,120,57,51,49,95,97,101,115,95,100,114,105,118,101,114,0,114,110,103,95,99,116,120,45,62,99,105,112,104,101,114,95,104,100,0,114,110,103,95,99,116,120,45,62,105,115,95,115,101,101,100,101,100,0,116,101,109,112,118,97,108,117,101,95,102,111,114,95,120,57,51,49,95,97,101,115,95,100,114,105,118,101,114,0,120,57,51,49,95,103,101,116,95,100,116,0,103,101,116,116,105,109,101,111,102,100,97,121,40,41,32,102,97,105,108,101,100,58,32,37,115,10,0,65,69,83,32,101,110,99,114,121,112,116,105,111,110,32,105,110,32,82,78,71,32,102,97,105,108,101,100,58,32,37,115,10,0,100,117,112,108,105,99,97,116,101,32,49,50,56,32,98,105,116,32,98,108,111,99,107,32,114,101,116,117,114,110,101,100,32,98,121,32,82,78,71,0,120,57,51,49,95,114,101,115,101,101,100,0,33,101,110,116,114,111,112,121,95,99,111,108,108,101,99,116,95,98,117,102,102,101,114,0,103,101,116,95,101,110,116,114,111,112,121,0,101,114,114,111,114,32,103,101,116,116,105,110,103,32,101,110,116,114,111,112,121,32,100,97,116,97,10,0,101,110,116,114,111,112,121,95,99,111,108,108,101,99,116,95,99,98,0,101,110,116,114,111,112,121,95,99,111,108,108,101,99,116,95,98,117,102,102,101,114,0,120,57,51,49,95,103,101,110,101,114,97,116,101,95,107,101,121,0,101,114,114,111,114,32,99,114,101,97,116,105,110,103,32,99,105,112,104,101,114,32,99,111,110,116,101,120,116,32,102,111,114,32,82,78,71,58,32,37,115,10,0,101,114,114,111,114,32,99,114,101,97,116,105,110,103,32,107,101,121,32,102,111,114,32,82,78,71,58,32,37,115,10,0,115,101,108,102,116,101,115,116,95,107,97,116,0,185,202,127,214,160,245,211,66,25,109,132,145,118,28,59,190,72,178,130,152,104,194,128,0,0,0,40,24,0,0,37,0,82,23,141,41,162,213,132,18,157,137,154,69,130,2,247,119,66,156,8,61,130,244,138,64,102,181,73,39,171,66,199,195,14,183,97,60,254,176,190,115,247,110,109,111,29,163,20,250,187,75,193,14,197,251,205,70,190,40,97,231,3,43,55,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,149,189,74,82,226,158,215,19,211,19,250,32,233,141,188,200,209,229,17,89,82,247,250,55,56,180,197,206,178,176,154,13,156,197,13,22,225,188,237,207,96,98,9,157,32,131,126,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,128,0,129,1,130,2,131,3,160,32,161,33,162,34,163,35,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,150,237,204,195,221,4,127,117,99,25,55,111,21,34,87,86,122,20,118,119,149,23,126,200,146,232,221,21,203,31,188,177,37,62,46,162,65,27,221,245,33,72,65,113,179,141,47,76,88,57,46,51,49,32,82,78,71,32,99,111,114,101,32,102,117,110,99,116,105,111,110,32,102,97,105,108,101,100,0,82,78,71,32,111,117,116,112,117,116,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,107,110,111,119,110,32,118,97,108,117,101,0,101,114,114,111,114,32,99,114,101,97,116,105,110,103,32,99,105,112,104,101,114,32,99,111,110,116,101,120,116,32,102,111,114,32,82,78,71,0,101,114,114,111,114,32,115,101,116,116,105,110,103,32,107,101,121,32,102,111,114,32,82,78,71,0,102,111,114,107,32,100,101,116,101,99,116,105,111,110,32,102,97,105,108,101,100,0,114,97,110,100,111,109,0,75,65,84,0,102,97,105,108,101,100,32,116,111,32,97,99,113,117,105,114,101,32,116,104,101,32,83,121,115,116,101,109,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,102,97,105,108,101,100,32,116,111,32,114,101,108,101,97,115,101,32,116,104,101,32,83,121,115,116,101,109,32,82,78,71,32,108,111,99,107,58,32,37,115,10,0,98,117,102,102,101,114,0,114,97,110,100,111,109,45,115,121,115,116,101,109,46,99,0,103,101,116,95,114,97,110,100,111,109,0,101,114,114,111,114,32,114,101,97,100,105,110,103,32,114,97,110,100,111,109,32,102,114,111,109,32,115,121,115,116,101,109,32,82,78,71,32,40,114,99,61,37,100,41,10,0,115,121,115,116,101,109,95,114,110,103,95,105,115,95,108,111,99,107,101,100,0,114,101,97,100,95,99,98,0,114,101,97,100,95,99,98,95,98,117,102,102,101,114,0,47,100,101,118,47,114,97,110,100,111,109,0,47,100,101,118,47,117,114,97,110,100,111,109,0,110,101,101,100,95,101,110,116,114,111,112,121,0,115,101,108,101,99,116,40,41,32,101,114,114,111,114,58,32,37,115,10,0,98,111,103,117,115,32,114,101,97,100,32,102,114,111,109,32,114,97,110,100,111,109,32,100,101,118,105,99,101,32,40,110,61,37,100,41,10,0,114,101,97,100,32,101,114,114,111,114,32,111,110,32,114,97,110,100,111,109,32,100,101,118,105,99,101,58,32,37,115,10,0,111,112,101,110,95,100,101,118,95,114,97,110,100,111,109,0,119,97,105,116,95,100,101,118,95,114,97,110,100,111,109,0,99,97,110,39,116,32,111,112,101,110,32,37,115,58,32,37,115,10,0,101,114,114,111,114,32,115,101,116,116,105,110,103,32,70,68,95,67,76,79,69,88,69,67,32,111,110,32,102,100,32,37,100,58,32,37,115,10,0,99,104,111,111,115,105,110,103,32,97,32,114,97,110,100,111,109,32,107,32,111,102,32,37,117,32,98,105,116,115,32,97,116,32,115,101,99,108,101,118,101,108,32,37,100,10,0,9,107,32,116,111,111,32,108,97,114,103,101,32,45,32,97,103,97,105,110,10,0,9,107,32,105,115,32,122,101,114,111,32,45,32,97,103,97,105,110,10,0,1,0,101,99,100,115,97,32,115,105,103,110,32,104,97,115,104,32,32,0,101,99,100,115,97,32,115,105,103,110,32,114,101,115,117,108,116,32,114,32,0,101,99,100,115,97,32,115,105,103,110,32,114,101,115,117,108,116,32,115,32,0,103,111,115,116,32,115,105,103,110,32,104,97,115,104,32,32,0,101,99,99,32,115,105,103,110,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,103,111,115,116,32,115,105,103,110,32,114,101,115,117,108,116,32,114,32,0,103,111,115,116,32,115,105,103,110,32,114,101,115,117,108,116,32,115,32,0,101,99,99,32,118,101,114,105,102,121,58,32,82,101,106,101,99,116,101,100,10,0,101,99,99,32,118,101,114,105,102,121,58,32,70,97,105,108,101,100,32,116,111,32,103,101,116,32,97,102,102,105,110,101,32,99,111,111,114,100,105,110,97,116,101,115,10,0,32,32,32,32,32,120,0,32,32,32,32,32,114,0,32,32,32,32,32,115,0,101,99,99,32,118,101,114,105,102,121,58,32,78,111,116,32,118,101,114,105,102,105,101,100,10,0,101,99,99,32,118,101,114,105,102,121,58,32,65,99,99,101,112,116,101,100,10,0,33,34,108,111,99,107,32,65,66,73,32,118,101,114,115,105,111,110,34,0,112,111,115,105,120,45,108,111,99,107,46,99,0,103,101,116,95,108,111,99,107,95,111,98,106,101,99,116,0,115,116,114,101,97,109,45,62,102,108,97,103,115,46,119,114,105,116,105,110,103,0,101,115,116,114,101,97,109,46,99,0,101,115,95,102,108,117,115,104,0,83,117,99,99,101,115,115,0,71,101,110,101,114,97,108,32,101,114,114,111,114,0,85,110,107,110,111,119,110,32,112,97,99,107,101,116,0,85,110,107,110,111,119,110,32,118,101,114,115,105,111,110,32,105,110,32,112,97,99,107,101,116,0,73,110,118,97,108,105,100,32,112,117,98,108,105,99,32,107,101,121,32,97,108,103,111,114,105,116,104,109,0,73,110,118,97,108,105,100,32,100,105,103,101,115,116,32,97,108,103,111,114,105,116,104,109,0,66,97,100,32,112,117,98,108,105,99,32,107,101,121,0,66,97,100,32,115,101,99,114,101,116,32,107,101,121,0,66,97,100,32,115,105,103,110,97,116,117,114,101,0,78,111,32,112,117,98,108,105,99,32,107,101,121,0,67,104,101,99,107,115,117,109,32,101,114,114,111,114,0,66,97,100,32,112,97,115,115,112,104,114,97,115,101,0,73,110,118,97,108,105,100,32,99,105,112,104,101,114,32,97,108,103,111,114,105,116,104,109,0,75,101,121,114,105,110,103,32,111,112,101,110,0,73,110,118,97,108,105,100,32,112,97,99,107,101,116,0,73,110,118,97,108,105,100,32,97,114,109,111,114,0,78,111,32,117,115,101,114,32,73,68,0,78,111,32,115,101,99,114,101,116,32,107,101,121,0,87,114,111,110,103,32,115,101,99,114,101,116,32,107,101,121,32,117,115,101,100,0,66,97,100,32,115,101,115,115,105,111,110,32,107,101,121,0,85,110,107,110,111,119,110,32,99,111,109,112,114,101,115,115,105,111,110,32,97,108,103,111,114,105,116,104,109,0,78,117,109,98,101,114,32,105,115,32,110,111,116,32,112,114,105,109,101,0,73,110,118,97,108,105,100,32,101,110,99,111,100,105,110,103,32,109,101,116,104,111,100,0,73,110,118,97,108,105,100,32,101,110,99,114,121,112,116,105,111,110,32,115,99,104,101,109,101,0,73,110,118,97,108,105,100,32,115,105,103,110,97,116,117,114,101,32,115,99,104,101,109,101,0,73,110,118,97,108,105,100,32,97,116,116,114,105,98,117,116,101,0,78,111,32,118,97,108,117,101,0,78,111,116,32,102,111,117,110,100,0,86,97,108,117,101,32,110,111,116,32,102,111,117,110,100,0,83,121,110,116,97,120,32,101,114,114,111,114,0,66,97,100,32,77,80,73,32,118,97,108,117,101,0,73,110,118,97,108,105,100,32,112,97,115,115,112,104,114,97,115,101,0,73,110,118,97,108,105,100,32,115,105,103,110,97,116,117,114,101,32,99,108,97,115,115,0,82,101,115,111,117,114,99,101,115,32,101,120,104,97,117,115,116,101,100,0,73,110,118,97,108,105,100,32,107,101,121,114,105,110,103,0,84,114,117,115,116,32,68,66,32,101,114,114,111,114,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,0,73,110,118,97,108,105,100,32,117,115,101,114,32,73,68,0,85,110,101,120,112,101,99,116,101,100,32,101,114,114,111,114,0,84,105,109,101,32,99,111,110,102,108,105,99,116,0,75,101,121,115,101,114,118,101,114,32,101,114,114,111,114,0,87,114,111,110,103,32,112,117,98,108,105,99,32,107,101,121,32,97,108,103,111,114,105,116,104,109,0,84,114,105,98,117,116,101,32,116,111,32,68,46,32,65,46,0,87,101,97,107,32,101,110,99,114,121,112,116,105,111,110,32,107,101,121,0,73,110,118,97,108,105,100,32,107,101,121,32,108,101,110,103,116,104,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,83,121,110,116,97,120,32,101,114,114,111,114,32,105,110,32,85,82,73,0,73,110,118,97,108,105,100,32,85,82,73,0,78,101,116,119,111,114,107,32,101,114,114,111,114,0,85,110,107,110,111,119,110,32,104,111,115,116,0,83,101,108,102,116,101,115,116,32,102,97,105,108,101,100,0,68,97,116,97,32,110,111,116,32,101,110,99,114,121,112,116,101,100,0,68,97,116,97,32,110,111,116,32,112,114,111,99,101,115,115,101,100,0,85,110,117,115,97,98,108,101,32,112,117,98,108,105,99,32,107,101,121,0,85,110,117,115,97,98,108,101,32,115,101,99,114,101,116,32,107,101,121,0,73,110,118,97,108,105,100,32,118,97,108,117,101,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,99,104,97,105,110,0,77,105,115,115,105,110,103,32,99,101,114,116,105,102,105,99,97,116,101,0,78,111,32,100,97,116,97,0,66,117,103,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,73,110,118,97,108,105,100,32,111,112,101,114,97,116,105,111,110,32,99,111,100,101,0,84,105,109,101,111,117,116,0,73,110,116,101,114,110,97,108,32,101,114,114,111,114,0,69,79,70,32,40,103,99,114,121,112,116,41,0,73,110,118,97,108,105,100,32,111,98,106,101,99,116,0,80,114,111,118,105,100,101,100,32,111,98,106,101,99,116,32,105,115,32,116,111,111,32,115,104,111,114,116,0,80,114,111,118,105,100,101,100,32,111,98,106,101,99,116,32,105,115,32,116,111,111,32,108,97,114,103,101,0,77,105,115,115,105,110,103,32,105,116,101,109,32,105,110,32,111,98,106,101,99,116,0,78,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,67,111,110,102,108,105,99,116,105,110,103,32,117,115,101,0,73,110,118,97,108,105,100,32,99,105,112,104,101,114,32,109,111,100,101,0,73,110,118,97,108,105,100,32,102,108,97,103,0,73,110,118,97,108,105,100,32,104,97,110,100,108,101,0,82,101,115,117,108,116,32,116,114,117,110,99,97,116,101,100,0,73,110,99,111,109,112,108,101,116,101,32,108,105,110,101,0,73,110,118,97,108,105,100,32,114,101,115,112,111,110,115,101,0,78,111,32,97,103,101,110,116,32,114,117,110,110,105,110,103,0,65,103,101,110,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,100,97,116,97,0,85,110,115,112,101,99,105,102,105,99,32,65,115,115,117,97,110,32,115,101,114,118,101,114,32,102,97,117,108,116,0,71,101,110,101,114,97,108,32,65,115,115,117,97,110,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,115,101,115,115,105,111,110,32,107,101,121,0,73,110,118,97,108,105,100,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,115,117,112,112,111,114,116,101,100,32,97,108,103,111,114,105,116,104,109,0,78,111,32,112,105,110,101,110,116,114,121,0,112,105,110,101,110,116,114,121,32,101,114,114,111,114,0,66,97,100,32,80,73,78,0,73,110,118,97,108,105,100,32,110,97,109,101,0,66,97,100,32,100,97,116,97,0,73,110,118,97,108,105,100,32,112,97,114,97,109,101,116,101,114,0,87,114,111,110,103,32,99,97,114,100,0,78,111,32,100,105,114,109,110,103,114,0,100,105,114,109,110,103,114,32,101,114,114,111,114,0,67,101,114,116,105,102,105,99,97,116,101,32,114,101,118,111,107,101,100,0,78,111,32,67,82,76,32,107,110,111,119,110,0,67,82,76,32,116,111,111,32,111,108,100,0,76,105,110,101,32,116,111,111,32,108,111,110,103,0,78,111,116,32,116,114,117,115,116,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,108,101,100,0,66,97,100,32,67,65,32,99,101,114,116,105,102,105,99,97,116,101,0,67,101,114,116,105,102,105,99,97,116,101,32,101,120,112,105,114,101,100,0,67,101,114,116,105,102,105,99,97,116,101,32,116,111,111,32,121,111,117,110,103,0,85,110,115,117,112,112,111,114,116,101,100,32,99,101,114,116,105,102,105,99,97,116,101,0,85,110,107,110,111,119,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,115,117,112,112,111,114,116,101,100,32,112,114,111,116,101,99,116,105,111,110,0,67,111,114,114,117,112,116,101,100,32,112,114,111,116,101,99,116,105,111,110,0,65,109,98,105,103,117,111,117,115,32,110,97,109,101,0,67,97,114,100,32,101,114,114,111,114,0,67,97,114,100,32,114,101,115,101,116,32,114,101,113,117,105,114,101,100,0,67,97,114,100,32,114,101,109,111,118,101,100,0,73,110,118,97,108,105,100,32,99,97,114,100,0,67,97,114,100,32,110,111,116,32,112,114,101,115,101,110,116,0,78,111,32,80,75,67,83,49,53,32,97,112,112,108,105,99,97,116,105,111,110,0,78,111,116,32,99,111,110,102,105,114,109,101,100,0,67,111,110,102,105,103,117,114,97,116,105,111,110,32,101,114,114,111,114,0,78,111,32,112,111,108,105,99,121,32,109,97,116,99,104,0,73,110,118,97,108,105,100,32,105,110,100,101,120,0,73,110,118,97,108,105,100,32,73,68,0,78,111,32,83,109,97,114,116,67,97,114,100,32,100,97,101,109,111,110,0,83,109,97,114,116,67,97,114,100,32,100,97,101,109,111,110,32,101,114,114,111,114,0,85,110,115,117,112,112,111,114,116,101,100,32,112,114,111,116,111,99,111,108,0,66,97,100,32,80,73,78,32,109,101,116,104,111,100,0,67,97,114,100,32,110,111,116,32,105,110,105,116,105,97,108,105,122,101,100,0,85,110,115,117,112,112,111,114,116,101,100,32,111,112,101,114,97,116,105,111,110,0,87,114,111,110,103,32,107,101,121,32,117,115,97,103,101,0,78,111,116,104,105,110,103,32,102,111,117,110,100,0,87,114,111,110,103,32,98,108,111,98,32,116,121,112,101,0,77,105,115,115,105,110,103,32,118,97,108,117,101,0,72,97,114,100,119,97,114,101,32,112,114,111,98,108,101,109,0,80,73,78,32,98,108,111,99,107,101,100,0,67,111,110,100,105,116,105,111,110,115,32,111,102,32,117,115,101,32,110,111,116,32,115,97,116,105,115,102,105,101,100,0,80,73,78,115,32,97,114,101,32,110,111,116,32,115,121,110,99,101,100,0,73,110,118,97,108,105,100,32,67,82,76,0,66,69,82,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,66,69,82,0,69,108,101,109,101,110,116,32,110,111,116,32,102,111,117,110,100,0,73,100,101,110,116,105,102,105,101,114,32,110,111,116,32,102,111,117,110,100,0,73,110,118,97,108,105,100,32,116,97,103,0,73,110,118,97,108,105,100,32,108,101,110,103,116,104,0,73,110,118,97,108,105,100,32,107,101,121,32,105,110,102,111,0,85,110,101,120,112,101,99,116,101,100,32,116,97,103,0,78,111,116,32,68,69,82,32,101,110,99,111,100,101,100,0,78,111,32,67,77,83,32,111,98,106,101,99,116,0,73,110,118,97,108,105,100,32,67,77,83,32,111,98,106,101,99,116,0,85,110,107,110,111,119,110,32,67,77,83,32,111,98,106,101,99,116,0,85,110,115,117,112,112,111,114,116,101,100,32,67,77,83,32,111,98,106,101,99,116,0,85,110,115,117,112,112,111,114,116,101,100,32,101,110,99,111,100,105,110,103,0,85,110,115,117,112,112,111,114,116,101,100,32,67,77,83,32,118,101,114,115,105,111,110,0,85,110,107,110,111,119,110,32,97,108,103,111,114,105,116,104,109,0,73,110,118,97,108,105,100,32,99,114,121,112,116,111,32,101,110,103,105,110,101,0,80,117,98,108,105,99,32,107,101,121,32,110,111,116,32,116,114,117,115,116,101,100,0,68,101,99,114,121,112,116,105,111,110,32,102,97,105,108,101,100,0,75,101,121,32,101,120,112,105,114,101,100,0,83,105,103,110,97,116,117,114,101,32,101,120,112,105,114,101,100,0,69,110,99,111,100,105,110,103,32,112,114,111,98,108,101,109,0,73,110,118,97,108,105,100,32,115,116,97,116,101,0,68,117,112,108,105,99,97,116,101,100,32,118,97,108,117,101,0,77,105,115,115,105,110,103,32,97,99,116,105,111,110,0,65,83,78,46,49,32,109,111,100,117,108,101,32,110,111,116,32,102,111,117,110,100,0,73,110,118,97,108,105,100,32,79,73,68,32,115,116,114,105,110,103,0,73,110,118,97,108,105,100,32,116,105,109,101,0,73,110,118,97,108,105,100,32,67,82,76,32,111,98,106,101,99,116,0,85,110,115,117,112,112,111,114,116,101,100,32,67,82,76,32,118,101,114,115,105,111,110,0,73,110,118,97,108,105,100,32,99,101,114,116,105,102,105,99,97,116,101,32,111,98,106,101,99,116,0,85,110,107,110,111,119,110,32,110,97,109,101,0,65,32,108,111,99,97,108,101,32,102,117,110,99,116,105,111,110,32,102,97,105,108,101,100,0,78,111,116,32,108,111,99,107,101,100,0,80,114,111,116,111,99,111,108,32,118,105,111,108,97,116,105,111,110,0,73,110,118,97,108,105,100,32,77,65,67,0,73,110,118,97,108,105,100,32,114,101,113,117,101,115,116,0,85,110,107,110,111,119,110,32,101,120,116,101,110,115,105,111,110,0,85,110,107,110,111,119,110,32,99,114,105,116,105,99,97,108,32,101,120,116,101,110,115,105,111,110,0,76,111,99,107,101,100,0,85,110,107,110,111,119,110,32,111,112,116,105,111,110,0,85,110,107,110,111,119,110,32,99,111,109,109,97,110,100,0,78,111,116,32,111,112,101,114,97,116,105,111,110,97,108,0,78,111,32,112,97,115,115,112,104,114,97,115,101,32,103,105,118,101,110,0,78,111,32,80,73,78,32,103,105,118,101,110,0,78,111,116,32,101,110,97,98,108,101,100,0,78,111,32,99,114,121,112,116,111,32,101,110,103,105,110,101,0,77,105,115,115,105,110,103,32,107,101,121,0,84,111,111,32,109,97,110,121,32,111,98,106,101,99,116,115,0,76,105,109,105,116,32,114,101,97,99,104,101,100,0,78,111,116,32,105,110,105,116,105,97,108,105,122,101,100,0,77,105,115,115,105,110,103,32,105,115,115,117,101,114,32,99,101,114,116,105,102,105,99,97,116,101,0,78,111,32,107,101,121,115,101,114,118,101,114,32,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,101,108,108,105,112,116,105,99,32,99,117,114,118,101,0,85,110,107,110,111,119,110,32,101,108,108,105,112,116,105,99,32,99,117,114,118,101,0,68,117,112,108,105,99,97,116,101,100,32,107,101,121,0,65,109,98,105,103,117,111,117,115,32,114,101,115,117,108,116,0,78,111,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,87,114,111,110,103,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,66,97,100,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,67,111,110,102,108,105,99,116,32,105,110,32,116,104,101,32,99,114,121,112,116,111,32,99,111,110,116,101,120,116,0,66,114,111,107,101,110,32,112,117,98,108,105,99,32,107,101,121,0,66,114,111,107,101,110,32,115,101,99,114,101,116,32,107,101,121,0,73,110,118,97,108,105,100,32,77,65,67,32,97,108,103,111,114,105,116,104,109,0,79,112,101,114,97,116,105,111,110,32,102,117,108,108,121,32,99,97,110,99,101,108,108,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,121,101,116,32,102,105,110,105,115,104,101,100,0,66,117,102,102,101,114,32,116,111,111,32,115,104,111,114,116,0,73,110,118,97,108,105,100,32,108,101,110,103,116,104,32,115,112,101,99,105,102,105,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,83,116,114,105,110,103,32,116,111,111,32,108,111,110,103,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,109,97,116,99,104,101,100,32,112,97,114,101,110,116,104,101,115,101,115,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,83,45,101,120,112,114,101,115,115,105,111,110,32,110,111,116,32,99,97,110,111,110,105,99,97,108,0,66,97,100,32,99,104,97,114,97,99,116,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,66,97,100,32,113,117,111,116,97,116,105,111,110,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,90,101,114,111,32,112,114,101,102,105,120,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,78,101,115,116,101,100,32,100,105,115,112,108,97,121,32,104,105,110,116,115,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,85,110,109,97,116,99,104,101,100,32,100,105,115,112,108,97,121,32,104,105,110,116,115,0,85,110,101,120,112,101,99,116,101,100,32,114,101,115,101,114,118,101,100,32,112,117,110,99,116,117,97,116,105,111,110,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,66,97,100,32,104,101,120,97,100,101,99,105,109,97,108,32,99,104,97,114,97,99,116,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,79,100,100,32,104,101,120,97,100,101,99,105,109,97,108,32,110,117,109,98,101,114,115,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,66,97,100,32,111,99,116,97,108,32,99,104,97,114,97,99,116,101,114,32,105,110,32,83,45,101,120,112,114,101,115,115,105,111,110,0,76,101,103,97,99,121,32,107,101,121,0,82,101,113,117,101,115,116,32,116,111,111,32,115,104,111,114,116,0,82,101,113,117,101,115,116,32,116,111,111,32,108,111,110,103,0,79,98,106,101,99,116,32,105,115,32,105,110,32,116,101,114,109,105,110,97,116,105,111,110,32,115,116,97,116,101,0,78,111,32,99,101,114,116,105,102,105,99,97,116,101,32,99,104,97,105,110,0,67,101,114,116,105,102,105,99,97,116,101,32,105,115,32,116,111,111,32,108,97,114,103,101,0,73,110,118,97,108,105,100,32,114,101,99,111,114,100,0,84,104,101,32,77,65,67,32,100,111,101,115,32,110,111,116,32,118,101,114,105,102,121,0,85,110,101,120,112,101,99,116,101,100,32,109,101,115,115,97,103,101,0,67,111,109,112,114,101,115,115,105,111,110,32,111,114,32,100,101,99,111,109,112,114,101,115,115,105,111,110,32,102,97,105,108,101,100,0,65,32,99,111,117,110,116,101,114,32,119,111,117,108,100,32,119,114,97,112,0,70,97,116,97,108,32,97,108,101,114,116,32,109,101,115,115,97,103,101,32,114,101,99,101,105,118,101,100,0,78,111,32,99,105,112,104,101,114,32,97,108,103,111,114,105,116,104,109,0,77,105,115,115,105,110,103,32,99,108,105,101,110,116,32,99,101,114,116,105,102,105,99,97,116,101,0,67,108,111,115,101,32,110,111,116,105,102,105,99,97,116,105,111,110,32,114,101,99,101,105,118,101,100,0,84,105,99,107,101,116,32,101,120,112,105,114,101,100,0,66,97,100,32,116,105,99,107,101,116,0,85,110,107,110,111,119,110,32,105,100,101,110,116,105,116,121,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,114,101,113,117,101,115,116,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,101,114,116,105,102,105,99,97,116,101,32,118,101,114,105,102,121,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,104,97,110,103,101,32,99,105,112,104,101,114,32,109,101,115,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,108,105,101,110,116,32,104,101,108,108,111,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,115,101,114,118,101,114,32,104,101,108,108,111,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,115,101,114,118,101,114,32,104,101,108,108,111,32,100,111,110,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,115,104,97,107,101,0,66,97,100,32,102,105,110,105,115,104,101,100,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,115,101,114,118,101,114,32,107,101,121,32,101,120,99,104,97,110,103,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,97,100,32,99,108,105,101,110,116,32,107,101,121,32,101,120,99,104,97,110,103,101,32,109,101,115,115,97,103,101,32,105,110,32,104,97,110,100,115,104,97,107,101,0,66,111,103,117,115,32,115,116,114,105,110,103,0,70,111,114,98,105,100,100,101,110,0,75,101,121,32,100,105,115,97,98,108,101,100,0,78,111,116,32,112,111,115,115,105,98,108,101,32,119,105,116,104,32,97,32,99,97,114,100,32,98,97,115,101,100,32,107,101,121,0,73,110,118,97,108,105,100,32,108,111,99,107,32,111,98,106,101,99,116,0,71,101,110,101,114,97,108,32,73,80,67,32,101,114,114,111,114,0,73,80,67,32,97,99,99,101,112,116,32,99,97,108,108,32,102,97,105,108,101,100,0,73,80,67,32,99,111,110,110,101,99,116,32,99,97,108,108,32,102,97,105,108,101,100,0,73,110,118,97,108,105,100,32,73,80,67,32,114,101,115,112,111,110,115,101,0,73,110,118,97,108,105,100,32,118,97,108,117,101,32,112,97,115,115,101,100,32,116,111,32,73,80,67,0,73,110,99,111,109,112,108,101,116,101,32,108,105,110,101,32,112,97,115,115,101,100,32,116,111,32,73,80,67,0,76,105,110,101,32,112,97,115,115,101,100,32,116,111,32,73,80,67,32,116,111,111,32,108,111,110,103,0,78,101,115,116,101,100,32,73,80,67,32,99,111,109,109,97,110,100,115,0,78,111,32,100,97,116,97,32,99,97,108,108,98,97,99,107,32,105,110,32,73,80,67,0,78,111,32,105,110,113,117,105,114,101,32,99,97,108,108,98,97,99,107,32,105,110,32,73,80,67,0,78,111,116,32,97,110,32,73,80,67,32,115,101,114,118,101,114,0,78,111,116,32,97,110,32,73,80,67,32,99,108,105,101,110,116,0,80,114,111,98,108,101,109,32,115,116,97,114,116,105,110,103,32,73,80,67,32,115,101,114,118,101,114,0,73,80,67,32,114,101,97,100,32,101,114,114,111,114,0,73,80,67,32,119,114,105,116,101,32,101,114,114,111,114,0,84,111,111,32,109,117,99,104,32,100,97,116,97,32,102,111,114,32,73,80,67,32,108,97,121,101,114,0,85,110,101,120,112,101,99,116,101,100,32,73,80,67,32,99,111,109,109,97,110,100,0,85,110,107,110,111,119,110,32,73,80,67,32,99,111,109,109,97,110,100,0,73,80,67,32,115,121,110,116,97,120,32,101,114,114,111,114,0,73,80,67,32,99,97,108,108,32,104,97,115,32,98,101,101,110,32,99,97,110,99,101,108,108,101,100,0,78,111,32,105,110,112,117,116,32,115,111,117,114,99,101,32,102,111,114,32,73,80,67,0,78,111,32,111,117,116,112,117,116,32,115,111,117,114,99,101,32,102,111,114,32,73,80,67,0,73,80,67,32,112,97,114,97,109,101,116,101,114,32,101,114,114,111,114,0,85,110,107,110,111,119,110,32,73,80,67,32,105,110,113,117,105,114,101,0,71,101,110,101,114,97,108,32,76,68,65,80,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,97,116,116,114,105,98,117,116,101,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,110,97,109,101,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,115,101,99,117,114,105,116,121,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,115,101,114,118,105,99,101,32,101,114,114,111,114,0,71,101,110,101,114,97,108,32,76,68,65,80,32,117,112,100,97,116,101,32,101,114,114,111,114,0,69,120,112,101,114,105,109,101,110,116,97,108,32,76,68,65,80,32,101,114,114,111,114,32,99,111,100,101,0,80,114,105,118,97,116,101,32,76,68,65,80,32,101,114,114,111,114,32,99,111,100,101,0,79,116,104,101,114,32,103,101,110,101,114,97,108,32,76,68,65,80,32,101,114,114,111,114,0,76,68,65,80,32,99,111,110,110,101,99,116,105,110,103,32,102,97,105,108,101,100,32,40,88,41,0,76,68,65,80,32,114,101,102,101,114,114,97,108,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,0,76,68,65,80,32,99,108,105,101,110,116,32,108,111,111,112,0,78,111,32,76,68,65,80,32,114,101,115,117,108,116,115,32,114,101,116,117,114,110,101,100,0,76,68,65,80,32,99,111,110,116,114,111,108,32,110,111,116,32,102,111,117,110,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,76,68,65,80,0,76,68,65,80,32,99,111,110,110,101,99,116,32,101,114,114,111,114,0,79,117,116,32,111,102,32,109,101,109,111,114,121,32,105,110,32,76,68,65,80,0,66,97,100,32,112,97,114,97,109,101,116,101,114,32,116,111,32,97,110,32,76,68,65,80,32,114,111,117,116,105,110,101,0,85,115,101,114,32,99,97,110,99,101,108,108,101,100,32,76,68,65,80,32,111,112,101,114,97,116,105,111,110,0,66,97,100,32,76,68,65,80,32,115,101,97,114,99,104,32,102,105,108,116,101,114,0,85,110,107,110,111,119,110,32,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,32,109,101,116,104,111,100,0,84,105,109,101,111,117,116,32,105,110,32,76,68,65,80,0,76,68,65,80,32,100,101,99,111,100,105,110,103,32,101,114,114,111,114,0,76,68,65,80,32,101,110,99,111,100,105,110,103,32,101,114,114,111,114,0,76,68,65,80,32,108,111,99,97,108,32,101,114,114,111,114,0,67,97,110,110,111,116,32,99,111,110,116,97,99,116,32,76,68,65,80,32,115,101,114,118,101,114,0,76,68,65,80,32,115,117,99,99,101,115,115,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,115,32,101,114,114,111,114,0,76,68,65,80,32,112,114,111,116,111,99,111,108,32,101,114,114,111,114,0,84,105,109,101,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,32,105,110,32,76,68,65,80,0,83,105,122,101,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,32,105,110,32,76,68,65,80,0,76,68,65,80,32,99,111,109,112,97,114,101,32,102,97,108,115,101,0,76,68,65,80,32,99,111,109,112,97,114,101,32,116,114,117,101,0,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,32,109,101,116,104,111,100,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,116,114,111,110,103,40,101,114,41,32,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,32,114,101,113,117,105,114,101,100,0,80,97,114,116,105,97,108,32,76,68,65,80,32,114,101,115,117,108,116,115,43,114,101,102,101,114,114,97,108,32,114,101,99,101,105,118,101,100,0,76,68,65,80,32,114,101,102,101,114,114,97,108,0,65,100,109,105,110,105,115,116,114,97,116,105,118,101,32,76,68,65,80,32,108,105,109,105,116,32,101,120,99,101,101,100,101,100,0,67,114,105,116,105,99,97,108,32,76,68,65,80,32,101,120,116,101,110,115,105,111,110,32,105,115,32,117,110,97,118,97,105,108,97,98,108,101,0,67,111,110,102,105,100,101,110,116,105,97,108,105,116,121,32,114,101,113,117,105,114,101,100,32,98,121,32,76,68,65,80,0,76,68,65,80,32,83,65,83,76,32,98,105,110,100,32,105,110,32,112,114,111,103,114,101,115,115,0,78,111,32,115,117,99,104,32,76,68,65,80,32,97,116,116,114,105,98,117,116,101,0,85,110,100,101,102,105,110,101,100,32,76,68,65,80,32,97,116,116,114,105,98,117,116,101,32,116,121,112,101,0,73,110,97,112,112,114,111,112,114,105,97,116,101,32,109,97,116,99,104,105,110,103,32,105,110,32,76,68,65,80,0,67,111,110,115,116,114,97,105,110,116,32,118,105,111,108,97,116,105,111,110,32,105,110,32,76,68,65,80,0,76,68,65,80,32,116,121,112,101,32,111,114,32,118,97,108,117,101,32,101,120,105,115,116,115,0,73,110,118,97,108,105,100,32,115,121,110,116,97,120,32,105,110,32,76,68,65,80,0,78,111,32,115,117,99,104,32,76,68,65,80,32,111,98,106,101,99,116,0,76,68,65,80,32,97,108,105,97,115,32,112,114,111,98,108,101,109,0,73,110,118,97,108,105,100,32,68,78,32,115,121,110,116,97,120,32,105,110,32,76,68,65,80,0,76,68,65,80,32,101,110,116,114,121,32,105,115,32,97,32,108,101,97,102,0,76,68,65,80,32,97,108,105,97,115,32,100,101,114,101,102,101,114,101,110,99,105,110,103,32,112,114,111,98,108,101,109,0,76,68,65,80,32,112,114,111,120,121,32,97,117,116,104,111,114,105,122,97,116,105,111,110,32,102,97,105,108,117,114,101,32,40,88,41,0,73,110,97,112,112,114,111,112,114,105,97,116,101,32,76,68,65,80,32,97,117,116,104,101,110,116,105,99,97,116,105,111,110,0,73,110,118,97,108,105,100,32,76,68,65,80,32,99,114,101,100,101,110,116,105,97,108,115,0,73,110,115,117,102,102,105,99,105,101,110,116,32,97,99,99,101,115,115,32,102,111,114,32,76,68,65,80,0,76,68,65,80,32,115,101,114,118,101,114,32,105,115,32,98,117,115,121,0,76,68,65,80,32,115,101,114,118,101,114,32,105,115,32,117,110,97,118,97,105,108,97,98,108,101,0,76,68,65,80,32,115,101,114,118,101,114,32,105,115,32,117,110,119,105,108,108,105,110,103,32,116,111,32,112,101,114,102,111,114,109,0,76,111,111,112,32,100,101,116,101,99,116,101,100,32,98,121,32,76,68,65,80,0,76,68,65,80,32,110,97,109,105,110,103,32,118,105,111,108,97,116,105,111,110,0,76,68,65,80,32,111,98,106,101,99,116,32,99,108,97,115,115,32,118,105,111,108,97,116,105,111,110,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,110,111,116,32,97,108,108,111,119,101,100,32,111,110,32,110,111,110,45,108,101,97,102,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,110,111,116,32,97,108,108,111,119,101,100,32,111,110,32,82,68,78,0,65,108,114,101,97,100,121,32,101,120,105,115,116,115,32,40,76,68,65,80,41,0,67,97,110,110,111,116,32,109,111,100,105,102,121,32,76,68,65,80,32,111,98,106,101,99,116,32,99,108,97,115,115,0,76,68,65,80,32,114,101,115,117,108,116,115,32,116,111,111,32,108,97,114,103,101,0,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,97,102,102,101,99,116,115,32,109,117,108,116,105,112,108,101,32,68,83,65,115,0,86,105,114,116,117,97,108,32,76,68,65,80,32,108,105,115,116,32,118,105,101,119,32,101,114,114,111,114,0,79,116,104,101,114,32,76,68,65,80,32,101,114,114,111,114,0,82,101,115,111,117,114,99,101,115,32,101,120,104,97,117,115,116,101,100,32,105,110,32,76,67,85,80,0,83,101,99,117,114,105,116,121,32,118,105,111,108,97,116,105,111,110,32,105,110,32,76,67,85,80,0,73,110,118,97,108,105,100,32,100,97,116,97,32,105,110,32,76,67,85,80,0,85,110,115,117,112,112,111,114,116,101,100,32,115,99,104,101,109,101,32,105,110,32,76,67,85,80,0,82,101,108,111,97,100,32,114,101,113,117,105,114,101,100,32,105,110,32,76,67,85,80,0,76,68,65,80,32,99,97,110,99,101,108,108,101,100,0,78,111,32,76,68,65,80,32,111,112,101,114,97,116,105,111,110,32,116,111,32,99,97,110,99,101,108,0,84,111,111,32,108,97,116,101,32,116,111,32,99,97,110,99,101,108,32,76,68,65,80,0,67,97,110,110,111,116,32,99,97,110,99,101,108,32,76,68,65,80,0,76,68,65,80,32,97,115,115,101,114,116,105,111,110,32,102,97,105,108,101,100,0,80,114,111,120,105,101,100,32,97,117,116,104,111,114,105,122,97,116,105,111,110,32,100,101,110,105,101,100,32,98,121,32,76,68,65,80,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,50,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,51,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,52,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,53,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,54,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,55,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,56,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,57,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,48,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,49,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,50,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,51,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,52,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,53,0,85,115,101,114,32,100,101,102,105,110,101,100,32,101,114,114,111,114,32,99,111,100,101,32,49,54,0,83,121,115,116,101,109,32,101,114,114,111,114,32,119,47,111,32,101,114,114,110,111,0,85,110,107,110,111,119,110,32,115,121,115,116,101,109,32,101,114,114,111,114,0,69,110,100,32,111,102,32,102,105,108,101,0,85,110,107,110,111,119,110,32,101,114,114,111,114,32,99,111,100,101,0,97,109,111,117,110,116,46,99,0,84,65,76,69,82,95,97,109,111,117,110,116,95,99,109,112,0,84,65,76,69,82,95,97,109,111,117,110,116,95,115,117,98,116,114,97,99,116,0,84,65,76,69,82,95,97,109,111,117,110,116,95,97,100,100,0,49,46,54,46,49,0,108,105,98,103,99,114,121,112,116,32,118,101,114,115,105,111,110,32,109,105,115,109,97,116,99,104,10,0,70,97,116,97,108,32,101,114,114,111,114,32,105,110,32,108,105,98,103,99,114,121,112,116,58,32,37,115,10,0,99,114,121,112,116,111,46,99,0,65,115,115,101,114,116,105,111,110,32,102,97,105,108,101,100,32,97,116,32,37,115,58,37,100,46,10,0,116,97,108,101,114,45,99,111,105,110,45,100,101,114,105,118,97,116,105,111,110,0,84,65,76,69,82,95,115,101,116,117,112,95,102,114,101,115,104,95,99,111,105,110,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,255,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+51200);allocate([24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,4,7,3,6,5,0,18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40,41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67,68,69,70,71,72,73,16,16,16,74,75,76,77,78,16,16,16,79,80,16,16,16,16,81,16,16,16,16,16,16,16,16,16,17,17,17,82,83,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,84,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,85,16,16,16,16,86,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,87,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,88,89,90,91,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,92,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254,255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,195,255,3,0,31,80,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,223,60,64,215,255,255,251,255,255,255,255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,254,255,255,255,127,2,254,255,255,255,255,0,0,0,0,0,255,191,182,0,255,255,255,7,7,0,0,0,255,7,255,255,255,255,255,255,255,254,255,195,255,255,255,255,255,255,255,255,255,255,255,255,239,31,254,225,255,159,0,0,255,255,255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255,255,255,3,0,255,255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255,1,0,0,0,0,0,0,0,0,253,31,0,0,0,0,0,0,240,3,255,127,255,255,255,255,255,255,255,239,255,223,225,255,207,255,254,254,238,159,249,255,255,253,197,227,159,89,128,176,207,255,3,0,238,135,249,255,255,253,109,195,135,25,2,94,192,255,63,0,238,191,251,255,255,253,237,227,191,27,1,0,207,255,0,0,238,159,249,255,255,253,237,227,159,25,192,176,207,255,2,0,236,199,61,214,24,199,255,195,199,29,129,0,192,255,0,0,238,223,253,255,255,253,239,227,223,29,96,3,207,255,0,0,236,223,253,255,255,253,239,227,223,29,96,64,207,255,6,0,236,223,253,255,255,255,255,231,223,93,128,0,207,255,0,252,236,255,127,252,255,255,251,47,127,128,95,255,0,0,12,0,254,255,255,255,255,127,255,7,63,32,255,3,0,0,0,0,150,37,240,254,174,236,255,59,95,32,255,243,0,0,0,0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,255,255,254,255,255,255,31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,255,3,255,255,231,193,255,255,127,64,255,51,255,255,255,255,191,32,255,255,255,255,255,247,255,255,255,255,255,255,255,255,255,61,127,61,255,255,255,255,255,61,255,255,255,255,61,127,61,255,127,255,255,255,255,255,255,255,61,255,255,255,255,255,255,255,255,135,0,0,0,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,31,0,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,159,255,255,254,255,255,7,255,255,255,255,255,255,255,255,255,199,1,0,255,223,15,0,255,255,15,0,255,255,15,0,255,223,13,0,255,255,255,255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,3,255,255,255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,7,255,255,255,255,255,255,255,255,63,0,255,255,255,31,255,15,255,1,192,255,255,255,255,63,31,0,255,255,255,255,255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,255,255,255,255,255,255,127,254,255,31,0,255,3,255,3,128,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,243,255,255,255,255,255,255,191,255,3,0,255,255,255,255,255,255,63,0,255,227,255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,222,111,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,255,255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,243,224,67,0,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,0,255,255,255,255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255,255,255,255,255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127,255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254,255,255,255,255,255,255,255,255,255,255,247,224,255,255,255,255,63,254,255,255,255,255,255,255,255,255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,255,255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255,255,127,240,143,255,255,255,128,255,255,255,255,255,255,255,255,255,255,0,0,0,0,128,255,252,255,255,255,255,255,255,255,255,255,255,255,255,121,15,0,255,7,0,0,0,0,0,0,0,0,0,255,187,247,255,255,255,0,0,0,255,255,255,255,255,255,15,0,255,255,255,255,255,255,255,255,15,0,255,3,0,0,252,8,255,255,255,255,255,7,255,255,255,255,7,0,255,255,255,31,255,255,255,255,255,255,247,255,0,128,255,3,0,0,0,0,255,255,255,255,255,255,127,0,255,63,255,3,255,255,127,4,255,255,255,255,255,255,255,127,5,0,0,56,255,255,60,0,126,126,126,0,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,255,255,15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,95,219,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,255,255,252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,255,3,254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,255,127,252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0,0,255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255,255,63,255,255,255,255,15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,3,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,145,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,63,0,255,255,255,3,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,239,254,255,255,15,0,0,0,0,0,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,63,0,0,0,192,255,0,0,252,255,255,255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,255,255,255,255,199,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,30,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,63,0,255,3,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,31,0,255,255,255,255,255,127,0,0,248,255,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,255,255,255,223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,255,123,95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,253,255,255,247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,255,253,255,255,255,253,255,255,247,207,255,255,255,255,255,255,239,255,255,255,150,254,247,10,132,234,150,170,150,247,247,94,255,251,255,15,238,251,255,15,0,0,0,0,0,0,0,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0,18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,16,16,34,35,16,36,37,38,39,40,41,42,43,16,44,45,46,17,47,48,17,17,49,17,17,17,50,51,52,53,54,55,56,57,17,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,58,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,59,16,60,61,62,63,64,65,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,66,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,67,16,16,68,16,69,70,71,16,72,16,73,16,16,16,16,74,75,76,77,16,16,78,16,79,80,16,16,16,16,81,16,16,16,16,16,16,16,16,16,16,16,16,16,82,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,83,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,84,85,86,87,16,16,88,89,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,90,16,91,92,93,94,95,96,97,98,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,254,255,0,252,1,0,0,248,1,0,0,120,0,0,0,0,255,251,223,251,0,0,128,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,252,255,224,175,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,32,64,176,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,134,254,255,255,255,0,64,73,0,0,0,0,0,24,0,223,255,0,200,0,0,0,0,0,0,0,1,0,60,0,0,0,0,0,0,0,0,0,0,0,0,16,224,1,30,0,96,255,191,0,0,0,0,0,0,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,207,3,0,0,0,3,0,32,255,127,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,0,0,0,16,0,32,30,0,48,0,1,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,252,15,0,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,3,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,253,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,255,7,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,255,0,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,63,2,0,0,0,0,0,0,0,0,0,4,0,0,0,0,16,0,0,0,0,0,0,128,0,128,192,223,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,254,255,255,255,0,252,255,255,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,192,255,223,255,7,0,0,0,0,0,0,0,0,0,0,128,6,0,252,0,0,24,62,0,0,128,191,0,204,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,96,255,255,255,31,0,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,1,0,0,24,0,0,0,0,0,0,0,0,0,56,0,0,0,0,16,0,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,254,127,47,0,0,255,3,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,196,255,255,255,255,0,0,0,192,0,0,0,0,0,0,0,0,1,0,224,159,0,0,0,0,127,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,16,0,0,252,255,255,255,31,0,0,0,0,0,12,0,0,0,0,0,0,64,0,12,240,0,0,0,0,0,0,192,248,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,255,0,255,255,255,33,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,127,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,3,224,0,224,0,224,0,96,128,248,255,255,255,252,255,255,255,255,255,127,31,252,241,127,255,127,0,0,255,255,255,3,0,0,255,255,255,255,1,0,123,3,208,193,175,66,0,12,31,188,255,255,0,0,0,0,0,2,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,255,255,255,127,0,0,0,255,7,0,0,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,252,255,255,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,135,3,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,127,255,15,0,0,0,0,0,0,0,0,255,255,255,251,255,255,255,255,255,255,255,255,255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,255,15,30,255,255,255,1,252,193,224,0,0,0,0,0,0,0,0,0,0,0,30,1,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,255,255,255,255,15,0,0,0,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,0,0,0,0,0,192,0,224,0,0,0,0,0,0,0,0,0,0,0,128,15,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,255,127,0,3,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,8,0,0,0,15,255,3,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,16,192,0,0,255,255,3,7,0,0,0,0,0,248,0,0,0,0,8,128,0,0,0,0,0,0,0,0,0,0,8,0,255,63,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0,0,128,11,0,0,0,0,0,0,0,128,2,0,0,192,0,0,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,255,255,3,127,0,255,255,255,255,247,255,127,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,254,255,0,252,1,0,0,248,1,0,0,248,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,0,48,135,255,255,255,255,255,143,255,0,0,0,0,0,0,224,255,255,7,255,15,0,0,0,0,0,0,255,255,255,255,255,63,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,143,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,255,0,255,1,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,63,252,255,63,0,0,0,3,0,0,0,0,0,0,254,3,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,255,255,255,255,127,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,127,0,255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,8,0,0,0,8,0,0,32,0,0,0,32,0,0,128,0,0,0,128,0,0,0,2,0,0,0,2,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,255,255,255,255,255,15,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,127,254,127,254,255,254,255,0,0,0,0,255,7,255,255,255,127,255,255,255,255,255,255,255,15,255,255,255,255,255,7,0,0,0,0,0,0,0,0,192,255,255,255,7,0,255,255,255,255,255,7,255,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,191,255,255,255,255,255,255,255,255,31,255,255,15,0,255,255,255,255,223,7,0,0,255,255,1,0,255,255,255,255,255,255,255,127,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,30,255,255,255,255,255,255,255,63,15,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,255,255,255,255,255,255,255,255,225,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,63,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,119,97,0,47,112,114,111,99,47,115,101,108,102,47,102,100,47,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+61440);var tempDoublePtr=STATICTOP;STATICTOP+=16;assert(tempDoublePtr%8==0);var PROCINFO={ppid:1,pid:42,sid:42,pgid:42};var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var ERRNO_MESSAGES={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;else Module.printErr("failed to set errno from JS");return value}var PATH={splitPath:(function(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)}),normalizeArray:(function(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}),normalize:(function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter((function(p){return!!p})),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path}),dirname:(function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir}),basename:(function(path){if(path==="/")return"/";var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)}),extname:(function(path){return PATH.splitPath(path)[3]}),join:(function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))}),join2:(function(l,r){return PATH.normalize(l+"/"+r)}),resolve:(function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter((function(p){return!!p})),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."}),relative:(function(from,to){from=PATH.resolve(from).substr(1);to=PATH.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()}),put_char:(function(tty,val){if(val===null||val===10){Module["print"](UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}}),flush:(function(tty){if(tty.output&&tty.output.length>0){Module["print"](UTF8ArrayToString(tty.output,0));tty.output=[]}})},default_tty1_ops:{put_char:(function(tty,val){if(val===null||val===10){Module["printErr"](UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}}),flush:(function(tty){if(tty.output&&tty.output.length>0){Module["printErr"](UTF8ArrayToString(tty.output,0));tty.output=[]}})}};var MEMFS={ops_table:null,mount:(function(mount){return MEMFS.createNode(null,"/",16384|511,0)}),createNode:(function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node}),getFileDataAsRegularArray:(function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;inode.contents.length){node.contents=MEMFS.getFileDataAsRegularArray(node);node.usedBytes=node.contents.length}if(!node.contents||node.contents.subarray){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return}if(!node.contents&&newCapacity>0)node.contents=[];while(node.contents.lengthnewSize)node.contents.length=newSize;else while(node.contents.length=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+lengthe2.timestamp){create.push(key);total++}}));var remove=[];Object.keys(dst.entries).forEach((function(key){var e=dst.entries[key];var e2=src.entries[key];if(!e2){remove.push(key);total++}}));if(!total){return callback(null)}var completed=0;var db=src.type==="remote"?src.db:dst.db;var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readwrite");var store=transaction.objectStore(IDBFS.DB_STORE_NAME);function done(err){if(err){if(!done.errored){done.errored=true;return callback(err)}return}if(++completed>=total){return callback(null)}}transaction.onerror=(function(e){done(this.error);e.preventDefault()});create.sort().forEach((function(path){if(dst.type==="local"){IDBFS.loadRemoteEntry(store,path,(function(err,entry){if(err)return done(err);IDBFS.storeLocalEntry(path,entry,done)}))}else{IDBFS.loadLocalEntry(path,(function(err,entry){if(err)return done(err);IDBFS.storeRemoteEntry(store,path,entry,done)}))}}));remove.sort().reverse().forEach((function(path){if(dst.type==="local"){IDBFS.removeLocalEntry(path,done)}else{IDBFS.removeRemoteEntry(store,path,done)}}))})};var NODEFS={isWindows:false,staticInit:(function(){NODEFS.isWindows=!!process.platform.match(/^win/)}),mount:(function(mount){assert(ENVIRONMENT_IS_NODE);return NODEFS.createNode(null,"/",NODEFS.getMode(mount.opts.root),0)}),createNode:(function(parent,name,mode,dev){if(!FS.isDir(mode)&&!FS.isFile(mode)&&!FS.isLink(mode)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node=FS.createNode(parent,name,mode);node.node_ops=NODEFS.node_ops;node.stream_ops=NODEFS.stream_ops;return node}),getMode:(function(path){var stat;try{stat=fs.lstatSync(path);if(NODEFS.isWindows){stat.mode=stat.mode|(stat.mode&146)>>1}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return stat.mode}),realPath:(function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)}),flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:(function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;if(flags in NODEFS.flagsToPermissionStringMap){return NODEFS.flagsToPermissionStringMap[flags]}else{throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}}),node_ops:{getattr:(function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}}),setattr:(function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),lookup:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)}),mknod:(function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,"",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node}),rename:(function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),unlink:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),rmdir:(function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),readdir:(function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),symlink:(function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),readlink:(function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}})},stream_ops:{open:(function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsToPermissionString(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),close:(function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}),read:(function(stream,buffer,offset,length,position){if(length===0)return 0;var nbuffer=new Buffer(length);var res;try{res=fs.readSync(stream.nfd,nbuffer,0,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(res>0){for(var i=0;i=stream.node.size)return 0;var chunk=stream.node.contents.slice(position,position+length);var ab=WORKERFS.reader.readAsArrayBuffer(chunk);buffer.set(new Uint8Array(ab),offset);return chunk.size}),write:(function(stream,buffer,offset,length,position){throw new FS.ErrnoError(ERRNO_CODES.EIO)}),llseek:(function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.size}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position})}};STATICTOP+=16;STATICTOP+=16;STATICTOP+=16;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:(function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)}),lookupPath:(function(path,opts){path=PATH.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(ERRNO_CODES.ELOOP)}var parts=PATH.normalizeArray(path.split("/").filter((function(p){return!!p})),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(ERRNO_CODES.ELOOP)}}}}return{path:current_path,node:current}}),getPath:(function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}}),hashName:(function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length}),hashAddNode:(function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node}),hashRemoveNode:(function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}}),lookupNode:(function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)}),createNode:(function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=(function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev});FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:(function(){return(this.mode&readMode)===readMode}),set:(function(val){val?this.mode|=readMode:this.mode&=~readMode})},write:{get:(function(){return(this.mode&writeMode)===writeMode}),set:(function(val){val?this.mode|=writeMode:this.mode&=~writeMode})},isFolder:{get:(function(){return FS.isDir(this.mode)})},isDevice:{get:(function(){return FS.isChrdev(this.mode)})}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node}),destroyNode:(function(node){FS.hashRemoveNode(node)}),isRoot:(function(node){return node===node.parent}),isMountpoint:(function(node){return!!node.mounted}),isFile:(function(mode){return(mode&61440)===32768}),isDir:(function(mode){return(mode&61440)===16384}),isLink:(function(mode){return(mode&61440)===40960}),isChrdev:(function(mode){return(mode&61440)===8192}),isBlkdev:(function(mode){return(mode&61440)===24576}),isFIFO:(function(mode){return(mode&61440)===4096}),isSocket:(function(mode){return(mode&49152)===49152}),flagModes:{"r":0,"rs":1052672,"r+":2,"w":577,"wx":705,"xw":705,"w+":578,"wx+":706,"xw+":706,"a":1089,"ax":1217,"xa":1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:(function(str){var flags=FS.flagModes[str];if(typeof flags==="undefined"){throw new Error("Unknown file open mode: "+str)}return flags}),flagsToPermissionString:(function(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms}),nodePermissions:(function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf("r")!==-1&&!(node.mode&292)){return ERRNO_CODES.EACCES}else if(perms.indexOf("w")!==-1&&!(node.mode&146)){return ERRNO_CODES.EACCES}else if(perms.indexOf("x")!==-1&&!(node.mode&73)){return ERRNO_CODES.EACCES}return 0}),mayLookup:(function(dir){var err=FS.nodePermissions(dir,"x");if(err)return err;if(!dir.node_ops.lookup)return ERRNO_CODES.EACCES;return 0}),mayCreate:(function(dir,name){try{var node=FS.lookupNode(dir,name);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(dir,"wx")}),mayDelete:(function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,"wx");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return ERRNO_CODES.ENOTDIR}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return ERRNO_CODES.EBUSY}}else{if(FS.isDir(node.mode)){return ERRNO_CODES.EISDIR}}return 0}),mayOpen:(function(node,flags){if(!node){return ERRNO_CODES.ENOENT}if(FS.isLink(node.mode)){return ERRNO_CODES.ELOOP}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return ERRNO_CODES.EISDIR}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))}),MAX_OPEN_FDS:4096,nextfd:(function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(ERRNO_CODES.EMFILE)}),getStream:(function(fd){return FS.streams[fd]}),createStream:(function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=(function(){});FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:(function(){return this.node}),set:(function(val){this.node=val})},isRead:{get:(function(){return(this.flags&2097155)!==1})},isWrite:{get:(function(){return(this.flags&2097155)!==0})},isAppend:{get:(function(){return this.flags&1024})}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream}),closeStream:(function(fd){FS.streams[fd]=null}),chrdev_stream_ops:{open:(function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}}),llseek:(function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)})},major:(function(dev){return dev>>8}),minor:(function(dev){return dev&255}),makedev:(function(ma,mi){return ma<<8|mi}),registerDevice:(function(dev,ops){FS.devices[dev]={stream_ops:ops}}),getDevice:(function(dev){return FS.devices[dev]}),getMounts:(function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts}),syncfs:(function(populate,callback){if(typeof populate==="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(err){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach((function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)}))}),mount:(function(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot}),unmount:(function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach((function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}}));node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)}),lookup:(function(parent,name){return parent.node_ops.lookup(parent,name)}),mknod:(function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}return parent.node_ops.mknod(parent,name,mode,dev)}),create:(function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)}),mkdir:(function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)}),mkdirTree:(function(path,mode){var dirs=path.split("/");var d="";for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(function(from,to){if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);if(typeof Uint8Array!="undefined")xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||"",true)}});var lazyArray=this;lazyArray.setDataGetter((function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]==="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]==="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]}));if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;console.log("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!=="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:(function(){if(!this.lengthKnown){this.cacheLength()}return this._length})},chunkSize:{get:(function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize})}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:(function(){return this.contents.length})}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach((function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(ERRNO_CODES.EIO)}return fn.apply(null,arguments)}}));stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(ERRNO_CODES.EIO)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i>2]=stat.dev;HEAP32[buf+4>>2]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;HEAP32[buf+36>>2]=stat.size;HEAP32[buf+40>>2]=4096;HEAP32[buf+44>>2]=stat.blocks;HEAP32[buf+48>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+52>>2]=0;HEAP32[buf+56>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ino;return 0}),doMsync:(function(addr,stream,len,flags){var buffer=new Uint8Array(HEAPU8.subarray(addr,addr+len));FS.msync(stream,buffer,0,len,flags)}),doMkdir:(function(path,mode){path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}),doMknod:(function(path,mode,dev){switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-ERRNO_CODES.EINVAL}FS.mknod(path,mode,dev);return 0}),doReadlink:(function(path,buf,bufsize){if(bufsize<=0)return-ERRNO_CODES.EINVAL;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len}),doAccess:(function(path,amode){if(amode&~7){return-ERRNO_CODES.EINVAL}var node;var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-ERRNO_CODES.EACCES}return 0}),doDup:(function(path,flags,suggestFD){var suggest=FS.getStream(suggestFD);if(suggest)FS.close(suggest);return FS.open(path,flags,0,suggestFD,suggestFD).fd}),doReadv:(function(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2];var len=HEAP32[iov+(i*8+4)>>2];var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}),varargs:0,get:(function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret}),getStr:(function(){var ret=Pointer_stringify(SYSCALLS.get());return ret}),getStreamFromFD:(function(){var stream=FS.getStream(SYSCALLS.get());if(!stream)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return stream}),getSocketFromFD:(function(){var socket=SOCKFS.getSocket(SYSCALLS.get());if(!socket)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return socket}),getSocketAddress:(function(allowNull){var addrp=SYSCALLS.get(),addrlen=SYSCALLS.get();if(allowNull&&addrp===0)return null;var info=__read_sockaddr(addrp,addrlen);if(info.errno)throw new FS.ErrnoError(info.errno);info.addr=DNS.lookup_addr(info.addr)||info.addr;return info}),get64:(function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low}),getZero:(function(){assert(SYSCALLS.get()===0)})};function ___syscall64(which,varargs){SYSCALLS.varargs=varargs;try{return PROCINFO.ppid}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_i64Subtract"]=_i64Subtract;function _sysconf(name){switch(name){case 30:return PAGE_SIZE;case 85:var maxHeapSize=2*1024*1024*1024-16777216;maxHeapSize=HEAPU8.length;return maxHeapSize/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator==="object")return navigator["hardwareConcurrency"]||1;return 1}}___setErrNo(ERRNO_CODES.EINVAL);return-1}function ___syscall20(which,varargs){SYSCALLS.varargs=varargs;try{return PROCINFO.pid}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _pthread_mutex_destroy(){}Module["_memset"]=_memset;Module["_pthread_mutex_lock"]=_pthread_mutex_lock;function _atexit(func,arg){__ATEXIT__.unshift({func:func,arg:arg})}function _abort(){Module["abort"]()}function ___syscall195(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall194(which,varargs){SYSCALLS.varargs=varargs;try{var fd=SYSCALLS.get(),zero=SYSCALLS.getZero(),length=SYSCALLS.get64();FS.ftruncate(fd,length);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall197(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall202(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall199(){return ___syscall202.apply(null,arguments)}Module["_i64Add"]=_i64Add;var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC);Module["_llvm_cttz_i32"]=_llvm_cttz_i32;Module["___udivmoddi4"]=___udivmoddi4;Module["___divdi3"]=___divdi3;function _pthread_mutex_init(){}function ___lock(){}function ___unlock(){}function ___assert_fail(condition,filename,line,func){ABORT=true;throw"Assertion failed: "+Pointer_stringify(condition)+", at: "+[filename?Pointer_stringify(filename):"unknown filename",line,func?Pointer_stringify(func):"unknown function"]+" at "+stackTrace()}function _clock(){if(_clock.start===undefined)_clock.start=Date.now();return(Date.now()-_clock.start)*(1e6/1e3)|0}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;Module["_memmove"]=_memmove;function ___syscall91(which,varargs){SYSCALLS.varargs=varargs;try{var addr=SYSCALLS.get(),len=SYSCALLS.get();var info=SYSCALLS.mappings[addr];if(!info)return 0;if(len===info.len){var stream=FS.getStream(info.fd);SYSCALLS.doMsync(addr,stream,len,info.flags);FS.munmap(stream);SYSCALLS.mappings[addr]=null;if(info.allocated){_free(info.malloc)}}return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_llvm_bswap_i32"]=_llvm_bswap_i32;function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0};case 21506:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0};case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0};case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL};case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)};case 21523:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0};default:abort("bad ioctl syscall "+op)}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}var ___tm_current=STATICTOP;STATICTOP+=48;var ___tm_timezone=allocate(intArrayFromString("GMT"),"i8",ALLOC_STATIC);var _tzname=STATICTOP;STATICTOP+=16;var _daylight=STATICTOP;STATICTOP+=16;var _timezone=STATICTOP;STATICTOP+=16;function _tzset(){if(_tzset.called)return;_tzset.called=true;HEAP32[_timezone>>2]=-(new Date).getTimezoneOffset()*60;var winter=new Date(2e3,0,1);var summer=new Date(2e3,6,1);HEAP32[_daylight>>2]=Number(winter.getTimezoneOffset()!=summer.getTimezoneOffset());function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocate(intArrayFromString(winterName),"i8",ALLOC_NORMAL);var summerNamePtr=allocate(intArrayFromString(summerName),"i8",ALLOC_NORMAL);if(summer.getTimezoneOffset()>2]=winterNamePtr;HEAP32[_tzname+4>>2]=summerNamePtr}else{HEAP32[_tzname>>2]=summerNamePtr;HEAP32[_tzname+4>>2]=winterNamePtr}}function _localtime_r(time,tmPtr){_tzset();var date=new Date(HEAP32[time>>2]*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var start=new Date(date.getFullYear(),0,1);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var summerOffset=(new Date(2e3,6,1)).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=date.getTimezoneOffset()==Math.min(winterOffset,summerOffset)|0;HEAP32[tmPtr+32>>2]=dst;var zonePtr=HEAP32[_tzname+(dst?Runtime.QUANTUM_SIZE:0)>>2];HEAP32[tmPtr+40>>2]=zonePtr;return tmPtr}function _localtime(time){return _localtime_r(time,___tm_current)}function ___syscall77(which,varargs){SYSCALLS.varargs=varargs;try{var who=SYSCALLS.get(),usage=SYSCALLS.get();_memset(usage,0,136);HEAP32[usage>>2]=1;HEAP32[usage+4>>2]=2;HEAP32[usage+8>>2]=3;HEAP32[usage+12>>2]=4;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_bitshift64Ashr"]=_bitshift64Ashr;Module["_bitshift64Lshr"]=_bitshift64Lshr;function ___syscall33(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),amode=SYSCALLS.get();return SYSCALLS.doAccess(path,amode)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}var _environ=STATICTOP;STATICTOP+=16;function ___buildEnvironment(env){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV["USER"]=ENV["LOGNAME"]="web_user";ENV["PATH"]="/";ENV["PWD"]="/";ENV["HOME"]="/home/web_user";ENV["LANG"]="C";ENV["_"]=Module["thisProgram"];poolPtr=allocate(TOTAL_ENV_SIZE,"i8",ALLOC_STATIC);envPtr=allocate(MAX_ENV_VALUES*4,"i8*",ALLOC_STATIC);HEAP32[envPtr>>2]=poolPtr;HEAP32[_environ>>2]=envPtr}else{envPtr=HEAP32[_environ>>2];poolPtr=HEAP32[envPtr>>2]}var strings=[];var totalSize=0;for(var key in env){if(typeof env[key]==="string"){var line=key+"="+env[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error("Environment size exceeded TOTAL_ENV_SIZE!")}var ptrSize=4;for(var i=0;i>2]=poolPtr;poolPtr+=line.length+1}HEAP32[envPtr+strings.length*ptrSize>>2]=0}var ENV={};function _getenv(name){if(name===0)return 0;name=Pointer_stringify(name);if(!ENV.hasOwnProperty(name))return 0;if(_getenv.ret)_free(_getenv.ret);_getenv.ret=allocate(intArrayFromString(ENV[name]),"i8",ALLOC_NORMAL);return _getenv.ret}function _gettimeofday(ptr){var now=Date.now();HEAP32[ptr>>2]=now/1e3|0;HEAP32[ptr+4>>2]=now%1e3*1e3|0;return 0}Module["_pthread_mutex_unlock"]=_pthread_mutex_unlock;function ___syscall3(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get(),count=SYSCALLS.get();return FS.read(stream,HEAP8,buf,count)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _llvm_stackrestore(p){var self=_llvm_stacksave;var ret=self.LLVM_SAVEDSTACKS[p];self.LLVM_SAVEDSTACKS.splice(p,1);Runtime.stackRestore(ret)}Module["___udivdi3"]=___udivdi3;Module["___muldsi3"]=___muldsi3;Module["___muldi3"]=___muldi3;Module["_sbrk"]=_sbrk;Module["_bitshift64Shl"]=_bitshift64Shl;function _llvm_stacksave(){var self=_llvm_stacksave;if(!self.LLVM_SAVEDSTACKS){self.LLVM_SAVEDSTACKS=[]}self.LLVM_SAVEDSTACKS.push(Runtime.stackSave());return self.LLVM_SAVEDSTACKS.length-1}Module["___uremdi3"]=___uremdi3;function ___syscall4(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get(),count=SYSCALLS.get();return FS.write(stream,HEAP8,buf,count)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall192(which,varargs){SYSCALLS.varargs=varargs;try{var addr=SYSCALLS.get(),len=SYSCALLS.get(),prot=SYSCALLS.get(),flags=SYSCALLS.get(),fd=SYSCALLS.get(),off=SYSCALLS.get();off<<=12;var ptr;var allocated=false;if(fd===-1){ptr=_memalign(PAGE_SIZE,len);if(!ptr)return-ERRNO_CODES.ENOMEM;_memset(ptr,0,len);allocated=true}else{var info=FS.getStream(fd);if(!info)return-ERRNO_CODES.EBADF;var res=FS.mmap(info,HEAPU8,addr,len,off,prot,flags);ptr=res.ptr;allocated=res.allocated}SYSCALLS.mappings[ptr]={malloc:ptr,len:len,allocated:allocated,fd:fd,flags:flags};return ptr}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall201(){return ___syscall202.apply(null,arguments)}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]);return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?Pointer_stringify(tm_zone):""};var pattern=Pointer_stringify(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":(function(date){return WEEKDAYS[date.tm_wday].substring(0,3)}),"%A":(function(date){return WEEKDAYS[date.tm_wday]}),"%b":(function(date){return MONTHS[date.tm_mon].substring(0,3)}),"%B":(function(date){return MONTHS[date.tm_mon]}),"%C":(function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)}),"%d":(function(date){return leadingNulls(date.tm_mday,2)}),"%e":(function(date){return leadingSomething(date.tm_mday,2," ")}),"%g":(function(date){return getWeekBasedYear(date).toString().substring(2)}),"%G":(function(date){return getWeekBasedYear(date)}),"%H":(function(date){return leadingNulls(date.tm_hour,2)}),"%I":(function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)}),"%j":(function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)}),"%m":(function(date){return leadingNulls(date.tm_mon+1,2)}),"%M":(function(date){return leadingNulls(date.tm_min,2)}),"%n":(function(){return"\n"}),"%p":(function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}else{return"PM"}}),"%S":(function(date){return leadingNulls(date.tm_sec,2)}),"%t":(function(){return"\t"}),"%u":(function(date){var day=new Date(date.tm_year+1900,date.tm_mon+1,date.tm_mday,0,0,0,0);return day.getDay()||7}),"%U":(function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"}),"%V":(function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)}),"%Z":(function(date){return date.tm_zone}),"%%":(function(){return"%"})};for(var rule in EXPANSION_RULES_2){if(pattern.indexOf(rule)>=0){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){HEAP32[ptr>>2]=ret}return ret}function ___syscall142(which,varargs){SYSCALLS.varargs=varargs;try{var nfds=SYSCALLS.get(),readfds=SYSCALLS.get(),writefds=SYSCALLS.get(),exceptfds=SYSCALLS.get(),timeout=SYSCALLS.get();assert(nfds<=64,"nfds must be less than or equal to 64");assert(!exceptfds,"exceptfds not supported");var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);function check(fd,low,high,val){return fd<32?low&val:high&val}for(var fd=0;fd>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;assert(offset_high===0);FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doWritev(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["___remdi3"]=___remdi3;function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-ERRNO_CODES.EINVAL}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd};case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0};case 12:case 12:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0};case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}FS.staticInit();__ATINIT__.unshift((function(){if(!Module["noFSInit"]&&!FS.init.initialized)FS.init()}));__ATMAIN__.push((function(){FS.ignorePermissions=false}));__ATEXIT__.push((function(){FS.quit()}));Module["FS_createFolder"]=FS.createFolder;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createLink"]=FS.createLink;Module["FS_createDevice"]=FS.createDevice;Module["FS_unlink"]=FS.unlink;__ATINIT__.unshift((function(){TTY.init()}));__ATEXIT__.push((function(){TTY.shutdown()}));if(ENVIRONMENT_IS_NODE){var fs=require("fs");var NODEJS_PATH=require("path");NODEFS.staticInit()}___buildEnvironment(ENV);DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC);STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP);STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;staticSealed=true;assert(DYNAMIC_BASE=(m|0))$(a|0);return b|0}function Gb(){return l|0}function Hb(a){a=a|0;l=a}function Ib(a,b){a=a|0;b=b|0;l=a;m=b}function Jb(a,b){a=a|0;b=b|0;if(!o){o=a;p=b}}function Kb(a){a=a|0;D=a}function Lb(){return D|0}function Mb(a){a=a|0;var b=0;b=Ub(32,19158,38)|0;oc(a,b);return b|0}function Nb(a){a=a|0;var b=0;b=Ub(32,19158,56)|0;mc(a,b);return b|0}function Ob(a){a=a|0;var b=0;b=Ub(32,19158,73)|0;qc(a,b);return b|0}function Pb(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0;e=d+8|0;f=Ub(e,19158,87)|0;_w(f+8|0,c|0,d|0)|0;d=Iv(b)|0;b=f+4|0;a[b>>0]=d;a[b+1>>0]=d>>8;a[b+2>>0]=d>>16;a[b+3>>0]=d>>24;d=Iv(e)|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;return f|0}function Qb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;if((iu(e,g)|0)!=1){h=0;l=f;return h|0}e=g;c[e>>2]=a;c[e+4>>2]=b;c[g+8>>2]=d;d=Ub(24,19158,117)|0;c[d>>2]=c[g>>2];c[d+4>>2]=c[g+4>>2];c[d+8>>2]=c[g+8>>2];c[d+12>>2]=c[g+12>>2];c[d+16>>2]=c[g+16>>2];c[d+20>>2]=c[g+20>>2];h=d;l=f;return h|0}function Rb(a){a=a|0;var b=0;b=a;D=c[b+4>>2]|0;return c[b>>2]|0}function Sb(a){a=a|0;return c[a+8>>2]|0}function Tb(a){a=a|0;return a+12|0}function Ub(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+24|0;g=e+8|0;h=e;i=e+56|0;j=e+52|0;k=e+48|0;n=e+44|0;o=e+40|0;p=e+36|0;q=e+32|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;if((c[i>>2]|0)>>>0>41943040){c[o>>2]=74;if((c[182]|0)==-1)c[182]=$b(1,0,19165,19185,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[182]|0))_b();o=c[k>>2]|0;c[h>>2]=c[j>>2];c[h+4>>2]=o;cc(1,61747,h);_b()}c[n>>2]=Vb(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0)|0;if(c[n>>2]|0){l=e;return c[n>>2]|0}c[p>>2]=81;if((c[183]|0)==-1)c[183]=$b(1,21128,19165,19185,c[p>>2]|0)|0;if((ac()|0)<=0){if(c[183]|0){p=Nu(c[(xu()|0)>>2]|0)|0;c[g>>2]=19201;c[g+4>>2]=19165;c[g+8>>2]=81;c[g+12>>2]=p;hc(1,21128,20679,g)}}else bc(-1,0);c[q>>2]=82;if((c[184]|0)==-1)c[184]=$b(1,0,19165,19185,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[184]|0))_b();c[f>>2]=19165;c[f+4>>2]=82;cc(1,61747,f);_b();return 0}function Vb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e;c[g>>2]=a;c[e+8>>2]=b;c[e+4>>2]=d;c[h>>2]=Kw(c[g>>2]|0)|0;if(!(c[h>>2]|0)){c[f>>2]=0;i=c[f>>2]|0;l=e;return i|0}else{Uw(c[h>>2]|0,0,c[g>>2]|0)|0;c[f>>2]=c[h>>2];i=c[f>>2]|0;l=e;return i|0}return 0}function Wb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(c[g>>2]|0){Lw(c[g>>2]|0);l=e;return}c[j>>2]=311;if((c[185]|0)==-1)c[185]=$b(1,0,19165,19208,c[j>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[185]|0))_b();j=c[i>>2]|0;c[f>>2]=c[h>>2];c[f+4>>2]=j;cc(1,61747,f);_b()}function Xb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f;h=f+44|0;i=f+40|0;j=f+36|0;k=f+32|0;n=f+16|0;o=f+8|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[n>>2]=e;c[k>>2]=Tu(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,n)|0;if((c[k>>2]|0)>>>0<(c[i>>2]|0)>>>0){l=f;return c[k>>2]|0}c[o>>2]=506;if((c[186]|0)==-1)c[186]=$b(1,0,19165,19222,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[186]|0))_b();c[g>>2]=19165;c[g+4>>2]=506;cc(1,61747,g);_b();return 0}function Yb(){c[17680]=c[3977];return}function Zb(){return}function _b(){Aa()}function $b(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+32|0;i=g+28|0;j=g+24|0;k=g+20|0;n=g+16|0;o=g+12|0;p=g+8|0;q=g+4|0;r=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;if(!(c[j>>2]|0))c[j>>2]=c[17681];if((c[17682]|0)>=0&0==(c[17683]|0)){c[h>>2]=(c[i>>2]|0)<=(c[17682]|0)&1;s=c[h>>2]|0;l=g;return s|0}c[r>>2]=(c[17682]|0)>=0&1;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[17684]|0))break;c[p>>2]=(c[17685]|0)+((c[q>>2]|0)*112|0);if(!(c[r>>2]|0?!(c[(c[p>>2]|0)+108>>2]|0):0))t=9;if((((((t|0)==9?(t=0,(c[o>>2]|0)>=(c[(c[p>>2]|0)+96>>2]|0)):0)?(c[o>>2]|0)<=(c[(c[p>>2]|0)+100>>2]|0):0)?0==(Gw(c[p>>2]|0,c[j>>2]|0,0,0,0)|0):0)?0==(Gw((c[p>>2]|0)+32|0,c[k>>2]|0,0,0,0)|0):0)?0==(Gw((c[p>>2]|0)+64|0,c[n>>2]|0,0,0,0)|0):0){t=14;break}c[q>>2]=(c[q>>2]|0)+1}if((t|0)==14){c[h>>2]=(c[i>>2]|0)<=(c[(c[p>>2]|0)+104>>2]|0)&1;s=c[h>>2]|0;l=g;return s|0}p=c[i>>2]|0;if((c[17682]|0)>=0){c[h>>2]=(p|0)<=(c[17682]|0)&1;s=c[h>>2]|0;l=g;return s|0}else{c[h>>2]=(p|0)<=4&1;s=c[h>>2]|0;l=g;return s|0}return 0}function ac(){return c[17690]|0}function bc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d;f=d+20|0;g=d+16|0;h=d+12|0;i=d+8|0;c[f>>2]=a;c[g>>2]=b;if(c[f>>2]|0){c[17690]=(c[17690]|0)+(c[f>>2]|0);l=d;return}c[h>>2]=0==(c[17690]|0)&1;c[17690]=0;if((c[g>>2]|0)==0|(c[h>>2]|0)!=0){l=d;return}c[i>>2]=906;if((c[188]|0)==-1)c[188]=$b(1,0,19238,19416,c[i>>2]|0)|0;if((ac()|0)>0){bc(-1,0);l=d;return}if(!(c[188]|0)){l=d;return}c[e>>2]=19238;c[e+4>>2]=906;cc(1,61747,e);l=d;return}function cc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;dc(c[f>>2]|0,c[17686]|0,c[g>>2]|0,h);l=e;return}function dc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0;g=l;l=l+240|0;if((l|0)>=(m|0))$(240);h=g+40|0;i=g+32|0;j=g+24|0;k=g+108|0;n=g+104|0;o=g+100|0;p=g+96|0;q=g+176|0;r=g+112|0;s=g+92|0;t=g+88|0;u=g+72|0;v=g+68|0;w=g+64|0;x=g+16|0;y=g+56|0;z=g+8|0;A=g+48|0;B=g;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[u>>2]=c[c[p>>2]>>2];c[t>>2]=(Tu(0,0,c[o>>2]|0,u)|0)+1;if(!(c[t>>2]|0)){c[v>>2]=952;if((c[187]|0)==-1)c[187]=$b(1,0,19238,19261,c[v>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[187]|0))_b();c[j>>2]=19238;c[j+4>>2]=952;cc(1,61747,j);_b()}j=q;v=j+64|0;do{a[j>>0]=0;j=j+1|0}while((j|0)<(v|0));j=c[t>>2]|0;c[w>>2]=Za()|0;v=j;j=l;l=l+((1*v|0)+15&-16)|0;if((l|0)>=(m|0))$((1*v|0)+15&-16|0);lb(y|0,0)|0;v=vd()|0;u=x;c[u>>2]=v;c[u+4>>2]=D;u=x;v=c[u+4>>2]|0;f=(v|0)>0|(v|0)==0&(c[u>>2]|0)>>>0>0;u=x;v=Zw(c[u>>2]|0,c[u+4>>2]|0,1e3,0)|0;u=c[y>>2]|0;e=Ww(u|0,((u|0)<0)<<31>>31|0,v|0,D|0)|0;c[y>>2]=e;do if(f){e=x;v=lx(c[e>>2]|0,c[e+4>>2]|0,1e3,0)|0;e=gx(v|0,D|0,1e3,0)|0;v=y+4|0;u=c[v>>2]|0;d=Ww(u|0,((u|0)<0)<<31>>31|0,e|0,D|0)|0;c[v>>2]=d;d=c[y+4>>2]|0;v=((d|0)<0)<<31>>31;if((v|0)>0|(v|0)==0&d>>>0>1e6){d=y+4|0;v=c[d>>2]|0;e=Tw(v|0,((v|0)<0)<<31>>31|0,1e6,0)|0;c[d>>2]=e;c[y>>2]=(c[y>>2]|0)+1}}else{e=c[y+4>>2]|0;d=((e|0)<0)<<31>>31;v=x;u=lx(c[v>>2]|0,c[v+4>>2]|0,1e3,0)|0;v=Tw(0,0,u|0,D|0)|0;u=gx(v|0,D|0,1e3,0)|0;v=D;b=x;C=lx(c[b>>2]|0,c[b+4>>2]|0,1e3,0)|0;b=gx(C|0,D|0,1e3,0)|0;C=D;if((d|0)>(v|0)|(d|0)==(v|0)&e>>>0>u>>>0){u=y+4|0;e=c[u>>2]|0;v=Ww(e|0,((e|0)<0)<<31>>31|0,b|0,C|0)|0;c[u>>2]=v;break}else{v=Ww(1e6,0,b|0,C|0)|0;C=y+4|0;b=c[C>>2]|0;u=Ww(b|0,((b|0)<0)<<31>>31|0,v|0,D|0)|0;c[C>>2]=u;c[y>>2]=(c[y>>2]|0)+-1;break}}while(0);c[s>>2]=pb(y|0)|0;if(!(c[s>>2]|0))tv(q,19267)|0;else{Sa(r|0,64,19283,c[s>>2]|0)|0;c[i>>2]=c[y+4>>2];Su(q,64,r,i)|0}Tu(j,c[t>>2]|0,c[o>>2]|0,c[p>>2]|0)|0;p=70688;if(0!=(c[k>>2]&64|0)&(0!=(c[p>>2]|0)?1:0!=(c[p+4>>2]|0))?0==(Hv(j,71806,256)|0):0){c[17687]=(c[17687]|0)+1;c[h>>2]=c[17672];c[h+4>>2]=c[17673];p=zd(h)|0;h=z;c[h>>2]=p;c[h+4>>2]=D;h=z;z=c[h+4>>2]|0;if(z>>>0>10|(z|0)==10&(c[h>>2]|0)>>>0>250327040|(c[17687]|0)>>>0>1e3)ec(q);c[A>>2]=1;E=c[w>>2]|0;Ea(E|0);l=g;return}ec(q);Nv(71806,j,256)|0;c[17687]=0;c[17688]=c[k>>2];h=xd()|0;z=B;c[z>>2]=h;c[z+4>>2]=D;c[17672]=c[B>>2];c[17673]=c[B+4>>2];Nv(72062,c[n>>2]|0,32)|0;fc(c[k>>2]|0,c[n>>2]|0,q,j);c[A>>2]=0;E=c[w>>2]|0;Ea(E|0);l=g;return}function ec(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;d=l;l=l+640|0;if((l|0)>=(m|0))$(640);e=d+32|0;f=d+16|0;g=d+52|0;h=d+56|0;i=d+48|0;j=d+44|0;k=d+40|0;n=d+8|0;o=d;c[g>>2]=b;b=70688;if((0==(c[b>>2]|0)?0==(c[b+4>>2]|0):0)|0==(c[17687]|0)){l=d;return}c[i>>2]=0;c[j>>2]=_u(71806,0,256)|0;if(c[j>>2]|0){if((c[j>>2]|0)!=71806)c[j>>2]=(c[j>>2]|0)+-1}else c[j>>2]=72061;if((a[c[j>>2]>>0]|0)==10){c[i>>2]=1;a[c[j>>2]>>0]=0};c[e>>2]=c[17672];c[e+4>>2]=c[17673];b=zd(e)|0;p=n;c[p>>2]=b;c[p+4>>2]=D;c[e>>2]=c[n>>2];c[e+4>>2]=c[n+4>>2];c[k>>2]=qd(e,1)|0;e=c[17687]|0;n=c[k>>2]|0;c[f>>2]=256;c[f+4>>2]=71806;c[f+8>>2]=e;c[f+12>>2]=n;Su(h,576,19367,f)|0;if((c[i>>2]|0)==1)a[c[j>>2]>>0]=10;fc(c[17688]|0,72062,c[g>>2]|0,h);h=xd()|0;g=o;c[g>>2]=h;c[g+4>>2]=D;c[17672]=c[o>>2];c[17673]=c[o+4>>2];c[17687]=0;l=d;return}function fc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+8|0;h=f;i=f+40|0;j=f+36|0;k=f+32|0;n=f+28|0;o=f+24|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;if(0!=(c[17680]|0)&0==(c[17689]|0)){e=c[17680]|0;if((c[i>>2]|0)==4){c[h>>2]=c[n>>2];Fv(e,19304,h)|0}else{h=c[k>>2]|0;d=c[j>>2]|0;b=gc(c[i>>2]|0)|0;a=c[n>>2]|0;c[g>>2]=h;c[g+4>>2]=d;c[g+8>>2]=b;c[g+12>>2]=a;Fv(e,19309,g)|0}Rv(c[17680]|0)|0}c[o>>2]=c[17689];while(1){if(!(c[o>>2]|0))break;vb[c[(c[o>>2]|0)+4>>2]&15](c[(c[o>>2]|0)+8>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0);c[o>>2]=c[c[o>>2]>>2]}l=f;return}function gc(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;do if((c[e>>2]&1|0)<=0){if((c[e>>2]&2|0)>0){c[d>>2]=19327;break}if((c[e>>2]&4|0)>0){c[d>>2]=19335;break}if((c[e>>2]&8|0)>0){c[d>>2]=19343;break}if((c[e>>2]&16|0)>0){c[d>>2]=19348;break}if(!(c[e>>2]&-65)){c[d>>2]=19354;break}else{c[d>>2]=19359;break}}else c[d>>2]=19321;while(0);l=b;return c[d>>2]|0}function hc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+176|0;if((l|0)>=(m|0))$(176);g=f;h=f+32|0;i=f+28|0;j=f+24|0;k=f+8|0;n=f+40|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;if(!(c[i>>2]|0))c[i>>2]=c[17681];c[k>>2]=e;e=c[i>>2]|0;i=_v()|0;c[g>>2]=e;c[g+4>>2]=i;Xb(n,128,19255,g)|0;dc(c[h>>2]|0,n,c[j>>2]|0,k);l=f;return}function ic(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;g=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=g+8|0;i=g;j=g+56|0;k=g+52|0;n=g+48|0;o=g+44|0;p=g+40|0;q=g+36|0;r=g+32|0;s=g+28|0;t=g+24|0;u=g+20|0;v=g+16|0;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;f=c[n>>2]|0;c[s>>2]=Za()|0;e=f;d=l;l=l+((1*e|0)+15&-16)|0;if((l|0)>=(m|0))$((1*e|0)+15&-16|0);if(1!=(jc(r,c[o>>2]|0,c[p>>2]|0)|0)){c[j>>2]=-1;c[t>>2]=1;w=c[s>>2]|0;Ea(w|0);x=c[j>>2]|0;l=g;return x|0}if(oe(c[r>>2]|0,d,c[n>>2]|0,c[k>>2]|0,c[n>>2]|0)|0){c[u>>2]=136;if((c[189]|0)==-1)c[189]=$b(1,0,19432,19451,c[u>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[189]|0))_b();c[i>>2]=19432;c[i+4>>2]=136;cc(1,61747,i);_b()}je(c[r>>2]|0);if(1!=(kc(r,c[o>>2]|0,c[p>>2]|0)|0)){c[j>>2]=-1;c[t>>2]=1;w=c[s>>2]|0;Ea(w|0);x=c[j>>2]|0;l=g;return x|0}if(!(oe(c[r>>2]|0,c[q>>2]|0,c[n>>2]|0,d,c[n>>2]|0)|0)){je(c[r>>2]|0);Uw(d|0,0,f|0)|0;c[j>>2]=c[n>>2];c[t>>2]=1;w=c[s>>2]|0;Ea(w|0);x=c[j>>2]|0;l=g;return x|0}c[v>>2]=140;if((c[190]|0)==-1)c[190]=$b(1,0,19432,19451,c[v>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[190]|0))_b();c[h>>2]=19432;c[h+4>>2]=140;cc(1,61747,h);_b();return 0}function jc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+16|0;g=e+8|0;h=e;i=e+48|0;j=e+44|0;k=e+40|0;n=e+36|0;o=e+32|0;p=e+28|0;q=e+24|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;if(ie(c[i>>2]|0,9,2,0)|0){c[o>>2]=68;if((c[194]|0)==-1)c[194]=$b(1,0,19432,19504,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[194]|0))_b();c[h>>2]=19432;c[h+4>>2]=68;cc(1,61747,h);_b()}c[n>>2]=ke(c[c[i>>2]>>2]|0,c[j>>2]|0,32)|0;if(0!=(c[n>>2]|0)?((c[n>>2]&255)<<24>>24|0)!=43:0){c[p>>2]=72;if((c[195]|0)==-1)c[195]=$b(1,0,19432,19504,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[195]|0))_b();c[g>>2]=19432;c[g+4>>2]=72;cc(1,61747,g);_b()}c[n>>2]=ne(c[c[i>>2]>>2]|0,c[k>>2]|0,16)|0;if(!(c[n>>2]|0)){l=e;return 1}if(((c[n>>2]&255)<<24>>24|0)==43){l=e;return 1}c[q>>2]=76;if((c[196]|0)==-1)c[196]=$b(1,0,19432,19504,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[196]|0))_b();c[f>>2]=19432;c[f+4>>2]=76;cc(1,61747,f);_b();return 0}function kc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+16|0;g=e+8|0;h=e;i=e+48|0;j=e+44|0;k=e+40|0;n=e+36|0;o=e+32|0;p=e+28|0;q=e+24|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;if(ie(c[i>>2]|0,10,2,0)|0){c[o>>2]=98;if((c[191]|0)==-1)c[191]=$b(1,0,19432,19483,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[191]|0))_b();c[h>>2]=19432;c[h+4>>2]=98;cc(1,61747,h);_b()}c[n>>2]=ke(c[c[i>>2]>>2]|0,(c[j>>2]|0)+32|0,32)|0;if(0!=(c[n>>2]|0)?((c[n>>2]&255)<<24>>24|0)!=43:0){c[p>>2]=102;if((c[192]|0)==-1)c[192]=$b(1,0,19432,19483,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[192]|0))_b();c[g>>2]=19432;c[g+4>>2]=102;cc(1,61747,g);_b()}c[n>>2]=ne(c[c[i>>2]>>2]|0,(c[k>>2]|0)+16|0,16)|0;if(!(c[n>>2]|0)){l=e;return 1}if(((c[n>>2]&255)<<24>>24|0)==43){l=e;return 1}c[q>>2]=106;if((c[193]|0)==-1)c[193]=$b(1,0,19432,19483,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[193]|0))_b();c[f>>2]=19432;c[f+4>>2]=106;cc(1,61747,f);_b();return 0}function lc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;g=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=g+8|0;i=g;j=g+56|0;k=g+52|0;n=g+48|0;o=g+44|0;p=g+40|0;q=g+36|0;r=g+32|0;s=g+28|0;t=g+24|0;u=g+20|0;v=g+16|0;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;f=c[n>>2]|0;c[s>>2]=Za()|0;e=f;d=l;l=l+((1*e|0)+15&-16)|0;if((l|0)>=(m|0))$((1*e|0)+15&-16|0);if(1!=(kc(r,c[o>>2]|0,c[p>>2]|0)|0)){c[j>>2]=-1;c[t>>2]=1;w=c[s>>2]|0;Ea(w|0);x=c[j>>2]|0;l=g;return x|0}if(pe(c[r>>2]|0,d,c[n>>2]|0,c[k>>2]|0,c[n>>2]|0)|0){c[u>>2]=172;if((c[197]|0)==-1)c[197]=$b(1,0,19432,19521,c[u>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[197]|0))_b();c[i>>2]=19432;c[i+4>>2]=172;cc(1,61747,i);_b()}je(c[r>>2]|0);if(1!=(jc(r,c[o>>2]|0,c[p>>2]|0)|0)){c[j>>2]=-1;c[t>>2]=1;w=c[s>>2]|0;Ea(w|0);x=c[j>>2]|0;l=g;return x|0}if(!(pe(c[r>>2]|0,c[q>>2]|0,c[n>>2]|0,d,c[n>>2]|0)|0)){je(c[r>>2]|0);Uw(d|0,0,f|0)|0;c[j>>2]=c[n>>2];c[t>>2]=1;w=c[s>>2]|0;Ea(w|0);x=c[j>>2]|0;l=g;return x|0}c[v>>2]=176;if((c[198]|0)==-1)c[198]=$b(1,0,19432,19521,c[v>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[198]|0))_b();c[h>>2]=19432;c[h+4>>2]=176;cc(1,61747,h);_b();return 0}function mc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d+16|0;f=d+8|0;g=d;h=d+52|0;i=d+48|0;j=d+44|0;k=d+40|0;n=d+36|0;o=d+32|0;p=d+28|0;q=d+24|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=nc(c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[o>>2]=231;if((c[199]|0)==-1)c[199]=$b(1,0,19553,19566,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[199]|0))_b();c[g>>2]=19553;c[g+4>>2]=231;cc(1,61747,g);_b()}if(_d(k,c[j>>2]|0,0)|0){c[p>>2]=232;if((c[200]|0)==-1)c[200]=$b(1,0,19553,19566,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[200]|0))_b();c[f>>2]=19553;c[f+4>>2]=232;cc(1,61747,f);_b()}Kd(c[j>>2]|0);c[n>>2]=$d(19601,c[k>>2]|0,0)|0;if(c[n>>2]|0){Oc(c[i>>2]|0,32,c[n>>2]|0);Qd(c[n>>2]|0);Fe(c[k>>2]|0);l=d;return}c[q>>2]=235;if((c[201]|0)==-1)c[201]=$b(1,0,19553,19566,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[201]|0))_b();c[e>>2]=19553;c[e+4>>2]=235;cc(1,61747,e);_b()}function nc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+64|0;if((l|0)>=(m|0))$(64);d=b+24|0;e=b+8|0;f=b;g=b+48|0;h=b+44|0;i=b+40|0;j=b+36|0;k=b+32|0;c[g>>2]=a;a=c[g>>2]|0;c[f>>2]=32;c[f+4>>2]=a;c[i>>2]=Jd(h,0,19609,f)|0;if(!(c[i>>2]|0)){l=b;return c[h>>2]|0}c[j>>2]=136;if((c[202]|0)==-1)c[202]=$b(1,21128,19553,19651,c[j>>2]|0)|0;if((ac()|0)<=0){if(c[202]|0){j=Cd(c[i>>2]|0)|0;c[e>>2]=19676;c[e+4>>2]=19553;c[e+8>>2]=136;c[e+12>>2]=j;hc(1,21128,20679,e)}}else bc(-1,0);c[k>>2]=137;if((c[203]|0)==-1)c[203]=$b(1,0,19553,19651,c[k>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[203]|0))_b();c[d>>2]=19553;c[d+4>>2]=137;cc(1,61747,d);_b();return 0}function oc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d+16|0;f=d+8|0;g=d;h=d+52|0;i=d+48|0;j=d+44|0;k=d+40|0;n=d+36|0;o=d+32|0;p=d+28|0;q=d+24|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=pc(c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[o>>2]=257;if((c[204]|0)==-1)c[204]=$b(1,0,19553,19692,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[204]|0))_b();c[g>>2]=19553;c[g+4>>2]=257;cc(1,61747,g);_b()}if(_d(k,c[j>>2]|0,0)|0){c[p>>2]=258;if((c[205]|0)==-1)c[205]=$b(1,0,19553,19692,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[205]|0))_b();c[f>>2]=19553;c[f+4>>2]=258;cc(1,61747,f);_b()}Kd(c[j>>2]|0);c[n>>2]=$d(19601,c[k>>2]|0,0)|0;if(c[n>>2]|0){Oc(c[i>>2]|0,32,c[n>>2]|0);Qd(c[n>>2]|0);Fe(c[k>>2]|0);l=d;return}c[q>>2]=261;if((c[206]|0)==-1)c[206]=$b(1,0,19553,19692,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[206]|0))_b();c[e>>2]=19553;c[e+4>>2]=261;cc(1,61747,e);_b()}function pc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+64|0;if((l|0)>=(m|0))$(64);d=b+24|0;e=b+8|0;f=b;g=b+48|0;h=b+44|0;i=b+40|0;j=b+36|0;k=b+32|0;c[g>>2]=a;a=c[g>>2]|0;c[f>>2]=32;c[f+4>>2]=a;c[i>>2]=Jd(h,0,19727,f)|0;if(!(c[i>>2]|0)){l=b;return c[h>>2]|0}c[j>>2]=169;if((c[207]|0)==-1)c[207]=$b(1,21128,19553,19782,c[j>>2]|0)|0;if((ac()|0)<=0){if(c[207]|0){j=Cd(c[i>>2]|0)|0;c[e>>2]=19676;c[e+4>>2]=19553;c[e+8>>2]=169;c[e+12>>2]=j;hc(1,21128,20679,e)}}else bc(-1,0);c[k>>2]=170;if((c[208]|0)==-1)c[208]=$b(1,0,19553,19782,c[k>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[208]|0))_b();c[d>>2]=19553;c[d+4>>2]=170;cc(1,61747,d);_b();return 0}function qc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d+16|0;f=d+8|0;g=d;h=d+52|0;i=d+48|0;j=d+44|0;k=d+40|0;n=d+36|0;o=d+32|0;p=d+28|0;q=d+24|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=rc(c[h>>2]|0)|0;if(!(c[j>>2]|0)){c[o>>2]=283;if((c[209]|0)==-1)c[209]=$b(1,0,19553,19807,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[209]|0))_b();c[g>>2]=19553;c[g+4>>2]=283;cc(1,61747,g);_b()}if(_d(k,c[j>>2]|0,0)|0){c[p>>2]=284;if((c[210]|0)==-1)c[210]=$b(1,0,19553,19807,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[210]|0))_b();c[f>>2]=19553;c[f+4>>2]=284;cc(1,61747,f);_b()}Kd(c[j>>2]|0);c[n>>2]=$d(19601,c[k>>2]|0,0)|0;if(c[n>>2]|0){Oc(c[i>>2]|0,32,c[n>>2]|0);Qd(c[n>>2]|0);Fe(c[k>>2]|0);l=d;return}c[q>>2]=287;if((c[211]|0)==-1)c[211]=$b(1,0,19553,19807,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[211]|0))_b();c[e>>2]=19553;c[e+4>>2]=287;cc(1,61747,e);_b()}function rc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+64|0;if((l|0)>=(m|0))$(64);d=b+24|0;e=b+8|0;f=b;g=b+48|0;h=b+44|0;i=b+40|0;j=b+36|0;k=b+32|0;c[g>>2]=a;a=c[g>>2]|0;c[f>>2]=32;c[f+4>>2]=a;c[i>>2]=Jd(h,0,19609,f)|0;if(!(c[i>>2]|0)){l=b;return c[h>>2]|0}c[j>>2]=202;if((c[212]|0)==-1)c[212]=$b(1,21128,19553,19842,c[j>>2]|0)|0;if((ac()|0)<=0){if(c[212]|0){j=Cd(c[i>>2]|0)|0;c[e>>2]=19676;c[e+4>>2]=19553;c[e+8>>2]=202;c[e+12>>2]=j;hc(1,21128,20679,e)}}else bc(-1,0);c[k>>2]=203;if((c[213]|0)==-1)c[213]=$b(1,0,19553,19842,c[k>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[213]|0))_b();c[d>>2]=19553;c[d+4>>2]=203;cc(1,61747,d);_b();return 0}function sc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;a=l;l=l+96|0;if((l|0)>=(m|0))$(96);b=a+40|0;d=a+24|0;e=a+8|0;f=a+88|0;g=a+84|0;h=a+80|0;i=a+76|0;j=a+72|0;k=a+68|0;n=a+64|0;o=a+60|0;p=a+56|0;q=Jd(i,0,19867,a)|0;c[k>>2]=q;if(q){c[n>>2]=505;if((c[214]|0)==-1)c[214]=$b(1,21128,19553,19922,c[n>>2]|0)|0;if((ac()|0)<=0){if(c[214]|0){n=Cd(c[k>>2]|0)|0;c[e>>2]=19676;c[e+4>>2]=19553;c[e+8>>2]=505;c[e+12>>2]=n;hc(1,21128,20679,e)}}else bc(-1,0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}e=te(h,c[i>>2]|0)|0;c[k>>2]=e;if(e){c[o>>2]=510;if((c[215]|0)==-1)c[215]=$b(1,21128,19553,19922,c[o>>2]|0)|0;if((ac()|0)<=0){if(c[215]|0){o=Cd(c[k>>2]|0)|0;c[d>>2]=19953;c[d+4>>2]=19553;c[d+8>>2]=510;c[d+12>>2]=o;hc(1,21128,20679,d)}}else bc(-1,0);Kd(c[i>>2]|0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}Kd(c[i>>2]|0);i=tc(j,c[h>>2]|0,37977,35618)|0;c[k>>2]=i;if(!i){Kd(c[h>>2]|0);c[g>>2]=Ub(32,19553,530)|0;Oc(c[g>>2]|0,32,c[j>>2]|0);Qd(c[j>>2]|0);c[f>>2]=c[g>>2];r=c[f>>2]|0;l=a;return r|0}c[p>>2]=525;if((c[216]|0)==-1)c[216]=$b(1,21128,19553,19922,c[p>>2]|0)|0;if((ac()|0)<=0){if(c[216]|0){p=Cd(c[k>>2]|0)|0;c[b>>2]=19968;c[b+4>>2]=19553;c[b+8>>2]=525;c[b+12>>2]=p;hc(1,21128,20679,b)}}else bc(-1,0);Kd(c[h>>2]|0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}function tc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;n=g+20|0;o=g+16|0;p=g+12|0;q=g+8|0;r=g+4|0;s=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=Md(c[j>>2]|0,c[k>>2]|0,0)|0;if(!(c[o>>2]|0)){c[h>>2]=1;t=c[h>>2]|0;l=g;return t|0}c[p>>2]=Nd(c[o>>2]|0)|0;Kd(c[o>>2]|0);c[o>>2]=c[p>>2];if(!(c[o>>2]|0)){c[h>>2]=2;t=c[h>>2]|0;l=g;return t|0}c[s>>2]=0;c[q>>2]=c[n>>2];while(1){u=c[o>>2]|0;if(!(a[c[q>>2]>>0]|0)){v=18;break}c[p>>2]=Md(u,c[q>>2]|0,1)|0;if(!(c[p>>2]|0)){v=8;break}n=Od(c[p>>2]|0,1,5)|0;c[(c[i>>2]|0)+(c[s>>2]<<2)>>2]=n;Kd(c[p>>2]|0);if(!(c[(c[i>>2]|0)+(c[s>>2]<<2)>>2]|0)){v=13;break}c[q>>2]=(c[q>>2]|0)+1;c[s>>2]=(c[s>>2]|0)+1}if((v|0)==8){c[r>>2]=0;while(1){if((c[r>>2]|0)>>>0>=(c[s>>2]|0)>>>0)break;Ie(c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]|0);c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]=0;c[r>>2]=(c[r>>2]|0)+1}Kd(c[o>>2]|0);c[h>>2]=3;t=c[h>>2]|0;l=g;return t|0}else if((v|0)==13){c[r>>2]=0;while(1){if((c[r>>2]|0)>>>0>=(c[s>>2]|0)>>>0)break;Ie(c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]|0);c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]=0;c[r>>2]=(c[r>>2]|0)+1}Kd(c[o>>2]|0);c[h>>2]=4;t=c[h>>2]|0;l=g;return t|0}else if((v|0)==18){Kd(u);c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}return 0}function uc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;a=l;l=l+96|0;if((l|0)>=(m|0))$(96);b=a+40|0;d=a+24|0;e=a+8|0;f=a+88|0;g=a+84|0;h=a+80|0;i=a+76|0;j=a+72|0;k=a+68|0;n=a+64|0;o=a+60|0;p=a+56|0;q=Jd(i,0,19982,a)|0;c[k>>2]=q;if(q){c[n>>2]=555;if((c[217]|0)==-1)c[217]=$b(1,21128,19553,20020,c[n>>2]|0)|0;if((ac()|0)<=0){if(c[217]|0){n=Cd(c[k>>2]|0)|0;c[e>>2]=19676;c[e+4>>2]=19553;c[e+8>>2]=555;c[e+12>>2]=n;hc(1,21128,20679,e)}}else bc(-1,0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}e=te(h,c[i>>2]|0)|0;c[k>>2]=e;if(e){c[o>>2]=560;if((c[218]|0)==-1)c[218]=$b(1,21128,19553,20020,c[o>>2]|0)|0;if((ac()|0)<=0){if(c[218]|0){o=Cd(c[k>>2]|0)|0;c[d>>2]=19953;c[d+4>>2]=19553;c[d+8>>2]=560;c[d+12>>2]=o;hc(1,21128,20679,d)}}else bc(-1,0);Kd(c[i>>2]|0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}Kd(c[i>>2]|0);i=tc(j,c[h>>2]|0,37977,35618)|0;c[k>>2]=i;if(!i){Kd(c[h>>2]|0);c[g>>2]=Ub(32,19553,580)|0;Oc(c[g>>2]|0,32,c[j>>2]|0);Qd(c[j>>2]|0);c[f>>2]=c[g>>2];r=c[f>>2]|0;l=a;return r|0}c[p>>2]=575;if((c[219]|0)==-1)c[219]=$b(1,21128,19553,20020,c[p>>2]|0)|0;if((ac()|0)<=0){if(c[219]|0){p=Cd(c[k>>2]|0)|0;c[b>>2]=19968;c[b+4>>2]=19553;c[b+8>>2]=575;c[b+12>>2]=p;hc(1,21128,20679,b)}}else bc(-1,0);Kd(c[h>>2]|0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}function vc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;a=l;l=l+96|0;if((l|0)>=(m|0))$(96);b=a+40|0;d=a+24|0;e=a+8|0;f=a+88|0;g=a+84|0;h=a+80|0;i=a+76|0;j=a+72|0;k=a+68|0;n=a+64|0;o=a+60|0;p=a+56|0;q=Jd(i,0,20051,a)|0;c[k>>2]=q;if(q){c[n>>2]=604;if((c[220]|0)==-1)c[220]=$b(1,21128,19553,20095,c[n>>2]|0)|0;if((ac()|0)<=0){if(c[220]|0){n=Cd(c[k>>2]|0)|0;c[e>>2]=19676;c[e+4>>2]=19553;c[e+8>>2]=604;c[e+12>>2]=n;hc(1,21128,20679,e)}}else bc(-1,0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}e=te(h,c[i>>2]|0)|0;c[k>>2]=e;if(e){c[o>>2]=609;if((c[221]|0)==-1)c[221]=$b(1,21128,19553,20095,c[o>>2]|0)|0;if((ac()|0)<=0){if(c[221]|0){o=Cd(c[k>>2]|0)|0;c[d>>2]=19953;c[d+4>>2]=19553;c[d+8>>2]=609;c[d+12>>2]=o;hc(1,21128,20679,d)}}else bc(-1,0);Kd(c[i>>2]|0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}Kd(c[i>>2]|0);i=tc(j,c[h>>2]|0,37977,35618)|0;c[k>>2]=i;if(!i){Kd(c[h>>2]|0);c[g>>2]=Ub(32,19553,629)|0;Oc(c[g>>2]|0,32,c[j>>2]|0);Qd(c[j>>2]|0);c[f>>2]=c[g>>2];r=c[f>>2]|0;l=a;return r|0}c[p>>2]=624;if((c[222]|0)==-1)c[222]=$b(1,21128,19553,20095,c[p>>2]|0)|0;if((ac()|0)<=0){if(c[222]|0){p=Cd(c[k>>2]|0)|0;c[b>>2]=19968;c[b+4>>2]=19553;c[b+8>>2]=624;c[b+12>>2]=p;hc(1,21128,20679,b)}}else bc(-1,0);Kd(c[h>>2]|0);c[f>>2]=0;r=c[f>>2]|0;l=a;return r|0}function wc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+16|0;g=e;h=e+68|0;i=e+64|0;j=e+60|0;k=e+56|0;n=e+52|0;o=e+48|0;p=e+44|0;q=e+40|0;r=e+32|0;s=e+28|0;t=e+24|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=pc(c[i>>2]|0)|0;c[p>>2]=xc(c[j>>2]|0)|0;j=qe(o,c[p>>2]|0,c[n>>2]|0)|0;c[q>>2]=j;if(j){c[s>>2]=807;if((c[223]|0)==-1)c[223]=$b(2,21128,19553,20126,c[s>>2]|0)|0;if((ac()|0)<=0){if(c[223]|0){s=Cd(c[q>>2]|0)|0;c[g>>2]=19553;c[g+4>>2]=807;c[g+8>>2]=s;hc(2,21128,20151,g)}}else bc(-1,0);Kd(c[p>>2]|0);Kd(c[n>>2]|0);c[h>>2]=-1;u=c[h>>2]|0;l=e;return u|0}Kd(c[n>>2]|0);Kd(c[p>>2]|0);p=tc(r,c[o>>2]|0,37839,47175)|0;c[q>>2]=p;if(!p){Kd(c[o>>2]|0);Oc(c[k>>2]|0,32,c[r>>2]|0);Oc((c[k>>2]|0)+32|0,32,c[r+4>>2]|0);Qd(c[r>>2]|0);Qd(c[r+4>>2]|0);c[h>>2]=1;u=c[h>>2]|0;l=e;return u|0}c[t>>2]=819;if((c[224]|0)==-1)c[224]=$b(1,0,19553,20126,c[t>>2]|0)|0;if((ac()|0)<=0){if(c[224]|0){c[f>>2]=19553;c[f+4>>2]=819;cc(1,61747,f)}}else bc(-1,0);Kd(c[o>>2]|0);c[h>>2]=-1;u=c[h>>2]|0;l=e;return u|0}function xc(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;b=l;l=l+128|0;if((l|0)>=(m|0))$(128);e=b+16|0;f=b;g=b+116|0;h=b+112|0;i=b+48|0;j=b+40|0;k=b+36|0;n=b+32|0;c[h>>2]=a;a=c[h>>2]|0;o=c[h>>2]|0;Bc(a,Mv(d[o>>0]|d[o+1>>0]<<8|d[o+2>>0]<<16|d[o+3>>0]<<24)|0,i);c[f>>2]=37919;c[f+4>>2]=64;c[f+8>>2]=i;i=Jd(j,0,20186,f)|0;c[k>>2]=i;if(!i){c[g>>2]=c[j>>2];p=c[g>>2]|0;l=b;return p|0}c[n>>2]=698;if((c[225]|0)==-1)c[225]=$b(1,21128,19553,20230,c[n>>2]|0)|0;if((ac()|0)<=0){if(c[225]|0){n=Cd(c[k>>2]|0)|0;c[e>>2]=19676;c[e+4>>2]=19553;c[e+8>>2]=698;c[e+12>>2]=n;hc(1,21128,20679,e)}}else bc(-1,0);c[g>>2]=0;p=c[g>>2]|0;l=b;return p|0}function yc(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;g=l;l=l+96|0;if((l|0)>=(m|0))$(96);h=g+40|0;i=g+32|0;j=g+16|0;k=g;n=g+92|0;o=g+88|0;p=g+84|0;q=g+80|0;r=g+76|0;s=g+72|0;t=g+68|0;u=g+64|0;v=g+60|0;w=g+56|0;x=g+52|0;c[o>>2]=a;c[p>>2]=b;c[q>>2]=e;c[r>>2]=f;f=c[o>>2]|0;o=(c[p>>2]|0)+4|0;if((f|0)!=(Mv(d[o>>0]|d[o+1>>0]<<8|d[o+2>>0]<<16|d[o+3>>0]<<24)|0)){c[n>>2]=-1;y=c[n>>2]|0;l=g;return y|0}o=c[q>>2]|0;f=(c[q>>2]|0)+32|0;c[k>>2]=32;c[k+4>>2]=o;c[k+8>>2]=32;c[k+12>>2]=f;f=Jd(t,0,20289,k)|0;c[v>>2]=f;if(f){c[w>>2]=918;if((c[226]|0)==-1)c[226]=$b(1,21128,19553,20318,c[w>>2]|0)|0;if((ac()|0)<=0){if(c[226]|0){w=Cd(c[v>>2]|0)|0;c[j>>2]=19676;c[j+4>>2]=19553;c[j+8>>2]=918;c[j+12>>2]=w;hc(1,21128,20679,j)}}else bc(-1,0);c[n>>2]=-1;y=c[n>>2]|0;l=g;return y|0}c[s>>2]=xc(c[p>>2]|0)|0;p=c[r>>2]|0;c[i>>2]=32;c[i+4>>2]=p;p=Jd(u,0,20345,i)|0;c[v>>2]=p;if(p){Kd(c[s>>2]|0);Kd(c[t>>2]|0);c[n>>2]=-1;y=c[n>>2]|0;l=g;return y|0}c[v>>2]=re(c[t>>2]|0,c[s>>2]|0,c[u>>2]|0)|0;Kd(c[u>>2]|0);Kd(c[s>>2]|0);Kd(c[t>>2]|0);if(!(c[v>>2]|0)){c[n>>2]=1;y=c[n>>2]|0;l=g;return y|0}c[x>>2]=938;if((c[227]|0)==-1)c[227]=$b(8,21128,19553,20318,c[x>>2]|0)|0;if((ac()|0)<=0){if(c[227]|0){x=Cd(c[v>>2]|0)|0;c[h>>2]=19553;c[h+4>>2]=938;c[h+8>>2]=x;hc(8,21128,20397,h)}}else bc(-1,0);c[n>>2]=-1;y=c[n>>2]|0;l=g;return y|0}function zc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;e=l;l=l+144|0;if((l|0)>=(m|0))$(144);f=e+40|0;g=e+32|0;h=e+16|0;i=e+8|0;j=e;k=e+104|0;n=e+100|0;o=e+96|0;p=e+92|0;q=e+88|0;r=e+84|0;s=e+80|0;t=e+76|0;u=e+72|0;v=e+68|0;w=e+112|0;x=e+64|0;y=e+60|0;z=e+56|0;A=e+52|0;B=e+48|0;c[n>>2]=a;c[o>>2]=b;c[p>>2]=d;d=c[o>>2]|0;c[j>>2]=32;c[j+4>>2]=d;if(Jd(u,0,20250,j)|0){c[k>>2]=-1;C=c[k>>2]|0;l=e;return C|0}if(_d(t,c[u>>2]|0,0)|0){c[y>>2]=972;if((c[228]|0)==-1)c[228]=$b(1,0,19553,20447,c[y>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[228]|0))_b();c[i>>2]=19553;c[i+4>>2]=972;cc(1,61747,i);_b()}Kd(c[u>>2]|0);c[r>>2]=ae(47216,c[t>>2]|0,0)|0;Qc(s,c[n>>2]|0,32);c[q>>2]=Yd(0)|0;ce(c[q>>2]|0,c[s>>2]|0,c[r>>2]|0,c[t>>2]|0);Zd(c[r>>2]|0);Qd(c[s>>2]|0);c[v>>2]=Pd(256)|0;if(be(c[v>>2]|0,0,c[q>>2]|0,c[t>>2]|0)|0){c[z>>2]=989;if((c[229]|0)==-1)c[229]=$b(1,21128,19553,20447,c[z>>2]|0)|0;if((ac()|0)<=0){if(c[229]|0){z=Cd(0)|0;c[h>>2]=20470;c[h+4>>2]=19553;c[h+8>>2]=989;c[h+12>>2]=z;hc(1,21128,20679,h)}}else bc(-1,0);Zd(c[q>>2]|0);Fe(c[t>>2]|0);c[k>>2]=-1;C=c[k>>2]|0;l=e;return C|0}Zd(c[q>>2]|0);Fe(c[t>>2]|0);c[x>>2]=32;if(he(c[v>>2]|0,2)|0){c[A>>2]=998;if((c[230]|0)==-1)c[230]=$b(1,0,19553,20447,c[A>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[230]|0))_b();c[g>>2]=19553;c[g+4>>2]=998;cc(1,61747,g);_b()}if(!(Td(1,w,c[x>>2]|0,x,c[v>>2]|0)|0)){Bc(w,c[x>>2]|0,c[p>>2]|0);Qd(c[v>>2]|0);c[k>>2]=1;C=c[k>>2]|0;l=e;return C|0}c[B>>2]=1005;if((c[231]|0)==-1)c[231]=$b(1,0,19553,20447,c[B>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[231]|0))_b();c[f>>2]=19553;c[f+4>>2]=1005;cc(1,61747,f);_b();return 0}function Ac(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;e=l;l=l+144|0;if((l|0)>=(m|0))$(144);f=e+40|0;g=e+32|0;h=e+16|0;i=e+8|0;j=e;k=e+104|0;n=e+100|0;o=e+96|0;p=e+92|0;q=e+88|0;r=e+84|0;s=e+80|0;t=e+76|0;u=e+72|0;v=e+68|0;w=e+112|0;x=e+64|0;y=e+60|0;z=e+56|0;A=e+52|0;B=e+48|0;c[n>>2]=a;c[o>>2]=b;c[p>>2]=d;d=c[o>>2]|0;c[j>>2]=32;c[j+4>>2]=d;if(Jd(u,0,20250,j)|0){c[k>>2]=-1;C=c[k>>2]|0;l=e;return C|0}if(_d(t,c[u>>2]|0,0)|0){c[y>>2]=1403;if((c[232]|0)==-1)c[232]=$b(1,0,19553,20488,c[y>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[232]|0))_b();c[i>>2]=19553;c[i+4>>2]=1403;cc(1,61747,i);_b()}Kd(c[u>>2]|0);c[r>>2]=ae(47216,c[t>>2]|0,0)|0;Qc(s,c[n>>2]|0,32);c[q>>2]=Yd(0)|0;ce(c[q>>2]|0,c[s>>2]|0,c[r>>2]|0,c[t>>2]|0);Zd(c[r>>2]|0);Qd(c[s>>2]|0);c[v>>2]=Pd(256)|0;if(be(c[v>>2]|0,0,c[q>>2]|0,c[t>>2]|0)|0){c[z>>2]=1420;if((c[233]|0)==-1)c[233]=$b(1,21128,19553,20488,c[z>>2]|0)|0;if((ac()|0)<=0){if(c[233]|0){z=Cd(0)|0;c[h>>2]=20470;c[h+4>>2]=19553;c[h+8>>2]=1420;c[h+12>>2]=z;hc(1,21128,20679,h)}}else bc(-1,0);Zd(c[q>>2]|0);Fe(c[t>>2]|0);c[k>>2]=-1;C=c[k>>2]|0;l=e;return C|0}Zd(c[q>>2]|0);Fe(c[t>>2]|0);c[x>>2]=32;if(he(c[v>>2]|0,2)|0){c[A>>2]=1429;if((c[234]|0)==-1)c[234]=$b(1,0,19553,20488,c[A>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[234]|0))_b();c[g>>2]=19553;c[g+4>>2]=1429;cc(1,61747,g);_b()}if(!(Td(1,w,c[x>>2]|0,x,c[v>>2]|0)|0)){Bc(w,c[x>>2]|0,c[p>>2]|0);Qd(c[v>>2]|0);c[k>>2]=1;C=c[k>>2]|0;l=e;return C|0}c[B>>2]=1436;if((c[235]|0)==-1)c[235]=$b(1,0,19553,20488,c[B>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[235]|0))_b();c[f>>2]=19553;c[f+4>>2]=1436;cc(1,61747,f);_b();return 0}function Bc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;ze(10,c[h>>2]|0,c[f>>2]|0,c[g>>2]|0);l=e;return}function Cc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=15;while(1){if((c[g>>2]|0)<0)break;b=Sc(c[e>>2]|0,-1)|0;c[(c[f>>2]|0)+(c[g>>2]<<2)>>2]=b;c[g>>2]=(c[g>>2]|0)+-1}l=d;return}function Dc(){var a=0,b=0,d=0,e=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+12|0;e=a+8|0;c[d>>2]=Ub(4,20513,425)|0;if(!(ue(c[d>>2]|0,10,0)|0)){l=a;return c[d>>2]|0}c[e>>2]=429;if((c[236]|0)==-1)c[236]=$b(1,0,20513,20527,c[e>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[236]|0))_b();c[b>>2]=20513;c[b+4>>2]=429;cc(1,61747,b);_b();return 0}function Ec(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;xe(c[c[f>>2]>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function Fc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=ye(c[c[g>>2]>>2]|0,0)|0;if(c[i>>2]|0){if(!(c[h>>2]|0)){k=c[g>>2]|0;Gc(k);l=e;return}d=c[h>>2]|0;h=c[i>>2]|0;i=d+64|0;do{a[d>>0]=a[h>>0]|0;d=d+1|0;h=h+1|0}while((d|0)<(i|0));k=c[g>>2]|0;Gc(k);l=e;return}c[j>>2]=462;if((c[237]|0)==-1)c[237]=$b(1,0,20513,20560,c[j>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[237]|0))_b();c[f>>2]=20513;c[f+4>>2]=462;cc(1,61747,f);_b()}function Gc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;ve(c[c[d>>2]>>2]|0);Wb(c[d>>2]|0,20513,480);l=b;return}function Hc(b,d,e,f,g,h,i,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0;n=l;l=l+144|0;if((l|0)>=(m|0))$(144);o=n+136|0;p=n+132|0;q=n+128|0;r=n+124|0;s=n+120|0;t=n+116|0;u=n+112|0;v=n+108|0;w=n+104|0;x=n+100|0;y=n+96|0;z=n+92|0;A=n+88|0;B=n+84|0;C=n+80|0;D=n+76|0;E=n+72|0;F=n+68|0;G=n+64|0;H=n+60|0;I=n+56|0;J=n+40|0;K=n+36|0;L=n+32|0;M=n+28|0;N=n+24|0;O=n+20|0;P=n+16|0;Q=n+12|0;R=n+8|0;S=n+4|0;T=n;c[p>>2]=b;c[q>>2]=d;c[r>>2]=e;c[s>>2]=f;c[t>>2]=g;c[u>>2]=h;c[v>>2]=i;c[w>>2]=j;c[x>>2]=k;c[E>>2]=Be(c[s>>2]|0)|0;c[F>>2]=Be(c[r>>2]|0)|0;k=c[F>>2]|0;c[G>>2]=Za()|0;j=k;k=l;l=l+((1*j|0)+15&-16)|0;if((l|0)>=(m|0))$((1*j|0)+15&-16|0);if(!(c[E>>2]|0)){c[o>>2]=-1;c[K>>2]=1;U=c[G>>2]|0;Ea(U|0);V=c[o>>2]|0;l=n;return V|0}if(ue(y,c[r>>2]|0,2)|0){c[o>>2]=-1;c[K>>2]=1;U=c[G>>2]|0;Ea(U|0);V=c[o>>2]|0;l=n;return V|0}if(ue(z,c[s>>2]|0,2)|0){ve(c[y>>2]|0);c[o>>2]=-1;c[K>>2]=1;U=c[G>>2]|0;Ea(U|0);V=c[o>>2]|0;l=n;return V|0}c[J>>2]=c[c[x>>2]>>2];c[I>>2]=0;while(1){s=(c[J>>2]|0)+(4-1)&~(4-1);r=c[s>>2]|0;c[J>>2]=s+4;c[L>>2]=r;if(!(c[L>>2]|0))break;r=(c[J>>2]|0)+(4-1)&~(4-1);s=c[r>>2]|0;c[J>>2]=r+4;c[M>>2]=s;c[I>>2]=(c[I>>2]|0)+(c[M>>2]|0)}Uw(c[p>>2]|0,0,c[q>>2]|0)|0;a:do if((Ic(c[y>>2]|0,c[t>>2]|0,c[u>>2]|0,c[v>>2]|0,c[w>>2]|0,k)|0)!=1)W=45;else{c[C>>2]=((c[q>>2]|0)>>>0)/((c[E>>2]|0)>>>0)|0;c[D>>2]=((c[q>>2]|0)>>>0)%((c[E>>2]|0)>>>0)|0;c[N>>2]=(c[E>>2]|0)+(c[I>>2]|0)+1;M=c[N>>2]|0;c[O>>2]=Za()|0;L=M;M=l;l=l+((1*L|0)+15&-16)|0;if((l|0)>=(m|0))$((1*L|0)+15&-16|0);c[Q>>2]=M+(c[E>>2]|0);c[J>>2]=c[c[x>>2]>>2];while(1){L=(c[J>>2]|0)+(4-1)&~(4-1);s=c[L>>2]|0;c[J>>2]=L+4;c[R>>2]=s;s=c[R>>2]|0;c[P>>2]=s;if(!s)break;s=(c[J>>2]|0)+(4-1)&~(4-1);L=c[s>>2]|0;c[J>>2]=s+4;c[T>>2]=L;c[S>>2]=c[T>>2];if(c[S>>2]|0)_w(c[Q>>2]|0,c[P>>2]|0,c[S>>2]|0)|0;c[Q>>2]=(c[Q>>2]|0)+(c[S>>2]|0)}do if((c[C>>2]|0)>>>0>0){a[M+(c[E>>2]|0)+(c[I>>2]|0)>>0]=1;c[A>>2]=Jc(c[z>>2]|0,k,c[F>>2]|0,M+(c[E>>2]|0)|0,(c[I>>2]|0)+1|0)|0;if(!(c[A>>2]|0)){c[K>>2]=4;break}if(c[E>>2]|0)_w(c[p>>2]|0,c[A>>2]|0,c[E>>2]|0)|0;c[p>>2]=(c[p>>2]|0)+(c[E>>2]|0);W=22}else W=22;while(0);do if((W|0)==22){c[B>>2]=1;while(1){if((c[B>>2]|0)>>>0>=(c[C>>2]|0)>>>0)break;if(c[E>>2]|0)_w(M|0,(c[p>>2]|0)+(0-(c[E>>2]|0))|0,c[E>>2]|0)|0;Uw(M+(c[E>>2]|0)+(c[I>>2]|0)|0,(c[B>>2]|0)+1&255|0,1)|0;we(c[z>>2]|0);c[A>>2]=Jc(c[z>>2]|0,k,c[F>>2]|0,M,c[N>>2]|0)|0;if(!(c[A>>2]|0)){W=27;break}if(c[E>>2]|0)_w(c[p>>2]|0,c[A>>2]|0,c[E>>2]|0)|0;c[p>>2]=(c[p>>2]|0)+(c[E>>2]|0);c[B>>2]=(c[B>>2]|0)+1}if((W|0)==27){c[K>>2]=4;break}if((c[D>>2]|0)>>>0>0){if((c[C>>2]|0)>>>0>0){if(c[E>>2]|0)_w(M|0,(c[p>>2]|0)+(0-(c[E>>2]|0))|0,c[E>>2]|0)|0;c[B>>2]=(c[B>>2]|0)+1}Uw(M+(c[E>>2]|0)+(c[I>>2]|0)|0,c[B>>2]&255|0,1)|0;we(c[z>>2]|0);L=c[z>>2]|0;s=c[F>>2]|0;if((c[C>>2]|0)>>>0>0)c[A>>2]=Jc(L,k,s,M,c[N>>2]|0)|0;else c[A>>2]=Jc(L,k,s,M+(c[E>>2]|0)|0,(c[N>>2]|0)-(c[E>>2]|0)|0)|0;if(!(c[A>>2]|0)){c[K>>2]=4;break}if(c[D>>2]|0)_w(c[p>>2]|0,c[A>>2]|0,c[D>>2]|0)|0}c[H>>2]=1;c[K>>2]=22}while(0);Ea(c[O>>2]|0);switch(c[K>>2]|0){case 4:{W=45;break a;break}case 22:{break a;break}default:{}}U=c[G>>2]|0;Ea(U|0);V=c[o>>2]|0;l=n;return V|0}while(0);if((W|0)==45)c[H>>2]=-1;ve(c[y>>2]|0);ve(c[z>>2]|0);c[o>>2]=c[H>>2];c[K>>2]=1;U=c[G>>2]|0;Ea(U|0);V=c[o>>2]|0;l=n;return V|0}function Ic(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+28|0;j=h+24|0;k=h+20|0;n=h+16|0;o=h+12|0;p=h+8|0;q=h+4|0;r=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=Jc(c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0)|0;if(!(c[r>>2]|0)){c[i>>2]=-1;s=c[i>>2]|0;l=h;return s|0}if(Be(Ae(c[j>>2]|0)|0)|0){p=c[q>>2]|0;q=c[r>>2]|0;_w(p|0,q|0,Be(Ae(c[j>>2]|0)|0)|0)|0}c[i>>2]=1;s=c[i>>2]|0;l=h;return s|0}function Jc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;Ce(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;xe(c[h>>2]|0,c[k>>2]|0,c[n>>2]|0);n=ye(c[h>>2]|0,0)|0;l=g;return n|0}function Kc(a,b,d,e,f,g,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;k=l;l=l+64|0;if((l|0)>=(m|0))$(64);n=k+52|0;o=k+48|0;p=k+44|0;q=k+40|0;r=k+36|0;s=k+32|0;t=k+28|0;u=k+24|0;v=k+8|0;w=k;c[n>>2]=a;c[o>>2]=b;c[p>>2]=d;c[q>>2]=e;c[r>>2]=f;c[s>>2]=g;c[t>>2]=h;c[u>>2]=i;c[v>>2]=j;c[w>>2]=Hc(c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0,c[r>>2]|0,c[s>>2]|0,c[t>>2]|0,c[u>>2]|0,v)|0;l=k;return c[w>>2]|0}function Lc(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+24|0;k=i+20|0;n=i+16|0;o=i+12|0;p=i+8|0;q=i+4|0;r=i;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;h=Hc(c[j>>2]|0,c[k>>2]|0,10,8,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0,c[r>>2]|0)|0;l=i;return h|0}function Mc(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);j=i+44|0;k=i+40|0;n=i+36|0;o=i+32|0;p=i+28|0;q=i+24|0;r=i+8|0;s=i;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=Lc(c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0,r)|0;l=i;return c[s>>2]|0}function Nc(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;i=l;l=l+112|0;if((l|0)>=(m|0))$(112);j=i+40|0;k=i+32|0;n=i+24|0;o=i;p=i+108|0;q=i+104|0;r=i+100|0;s=i+96|0;t=i+92|0;u=i+88|0;v=i+84|0;w=i+80|0;x=i+76|0;y=i+72|0;z=i+68|0;A=i+64|0;B=i+60|0;C=i+56|0;D=i+52|0;E=i+48|0;c[p>>2]=a;c[q>>2]=b;c[r>>2]=d;c[s>>2]=e;c[t>>2]=f;c[u>>2]=g;c[v>>2]=h;c[x>>2]=de(c[q>>2]|0)|0;c[z>>2]=0;while(1){h=((((c[x>>2]|0)-1|0)>>>0)/8|0)+1|0;c[A>>2]=Za()|0;g=h;f=l;l=l+((1*g|0)+15&-16)|0;if((l|0)>=(m|0))$((1*g|0)+15&-16|0);g=c[r>>2]|0;e=c[s>>2]|0;d=c[t>>2]|0;b=c[u>>2]|0;a=c[v>>2]|0;F=hv(c[v>>2]|0)|0;c[o>>2]=a;c[o+4>>2]=F;c[o+8>>2]=z;c[o+12>>2]=4;c[o+16>>2]=0;c[o+20>>2]=0;c[w>>2]=Mc(f,h,g,e,d,b,o)|0;if(1!=(c[w>>2]|0)){G=3;break}c[w>>2]=Sd(c[p>>2]|0,5,f,h,y)|0;if(c[w>>2]|0){G=11;break}fe(c[c[p>>2]>>2]|0,c[x>>2]|0);if(ee(c[c[p>>2]>>2]|0,c[x>>2]|0)|0){G=19;break}c[z>>2]=(c[z>>2]|0)+1;if(0>(Rd(c[c[p>>2]>>2]|0,c[q>>2]|0)|0))c[E>>2]=3;else{Qd(c[c[p>>2]>>2]|0);c[E>>2]=0}Ea(c[A>>2]|0);if((c[E>>2]|0)>>>0>=1){G=30;break}}if((G|0)==3){c[B>>2]=155;if((c[238]|0)==-1)c[238]=$b(1,0,20594,20607,c[B>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[238]|0))_b();c[n>>2]=20594;c[n+4>>2]=155;cc(1,61747,n);_b()}else if((G|0)==11){c[C>>2]=162;if((c[239]|0)==-1)c[239]=$b(1,0,20594,20607,c[C>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[239]|0))_b();c[k>>2]=20594;c[k+4>>2]=162;cc(1,61747,k);_b()}else if((G|0)==19){c[D>>2]=165;if((c[240]|0)==-1)c[240]=$b(1,0,20594,20607,c[D>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[240]|0))_b();c[j>>2]=20594;c[j+4>>2]=165;cc(1,61747,j);_b()}else if((G|0)==30){l=i;return}}function Oc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+24|0;g=e+8|0;h=e;i=e+68|0;j=e+64|0;k=e+60|0;n=e+56|0;o=e+52|0;p=e+48|0;q=e+44|0;r=e+40|0;s=e+36|0;t=e+32|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;if(he(c[k>>2]|0,2)|0){c[q>>2]=ge(c[k>>2]|0,p)|0;if(c[q>>2]|0){c[n>>2]=(((c[p>>2]|0)+7|0)>>>0)/8|0;if((c[n>>2]|0)>>>0>(c[j>>2]|0)>>>0)c[n>>2]=c[j>>2];if(c[n>>2]|0)_w(c[i>>2]|0,c[q>>2]|0,c[n>>2]|0)|0;if((c[n>>2]|0)>>>0>=(c[j>>2]|0)>>>0){l=e;return}Uw((c[i>>2]|0)+(c[n>>2]|0)|0,0,(c[j>>2]|0)-(c[n>>2]|0)|0)|0;l=e;return}c[r>>2]=89;if((c[241]|0)==-1)c[241]=$b(1,0,20633,20646,c[r>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[241]|0))_b();c[h>>2]=20633;c[h+4>>2]=89;cc(1,61747,h);_b()}else{c[n>>2]=c[j>>2];h=Td(5,c[i>>2]|0,c[n>>2]|0,n,c[k>>2]|0)|0;c[o>>2]=h;if(!h){Pc(c[i>>2]|0,c[n>>2]|0,c[j>>2]|0);l=e;return}c[s>>2]=110;if((c[242]|0)==-1)c[242]=$b(1,21128,20633,20646,c[s>>2]|0)|0;if((ac()|0)<=0){if(c[242]|0){s=Cd(c[o>>2]|0)|0;c[g>>2]=20716;c[g+4>>2]=20633;c[g+8>>2]=110;c[g+12>>2]=s;hc(1,21128,20679,g)}}else bc(-1,0);c[t>>2]=111;if((c[243]|0)==-1)c[243]=$b(1,0,20633,20646,c[t>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[243]|0))_b();c[f>>2]=20633;c[f+4>>2]=111;cc(1,61747,f);_b()}}function Pc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];if((c[g>>2]|0)>>>0>=(c[h>>2]|0)>>>0){l=e;return}$w((c[i>>2]|0)+((c[h>>2]|0)-(c[g>>2]|0))|0,c[f>>2]|0,c[g>>2]|0)|0;Uw(c[f>>2]|0,0,(c[h>>2]|0)-(c[g>>2]|0)|0)|0;l=e;return}function Qc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+16|0;g=e;h=e+44|0;i=e+40|0;j=e+36|0;k=e+32|0;n=e+28|0;o=e+24|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;d=Sd(c[h>>2]|0,5,c[i>>2]|0,c[j>>2]|0,j)|0;c[k>>2]=d;if(!d){l=e;return}c[n>>2]=140;if((c[244]|0)==-1)c[244]=$b(1,21128,20633,20731,c[n>>2]|0)|0;if((ac()|0)<=0){if(c[244]|0){n=Cd(c[k>>2]|0)|0;c[g>>2]=20763;c[g+4>>2]=20633;c[g+8>>2]=140;c[g+12>>2]=n;hc(1,21128,20679,g)}}else bc(-1,0);c[o>>2]=141;if((c[245]|0)==-1)c[245]=$b(1,0,20633,20731,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[245]|0))_b();c[f>>2]=20633;c[f+4>>2]=141;cc(1,61747,f);_b()}function Rc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;a=l;l=l+80|0;if((l|0)>=(m|0))$(80);b=a+56|0;d=a+48|0;e=a+40|0;f=a+32|0;g=a+24|0;h=a+16|0;i=a+8|0;j=a;k=a+64|0;n=a+60|0;if(Gd(20777)|0){c[h>>2]=0;o=Hd(37,h)|0;c[k>>2]=o;if(o|0){o=c[3977]|0;h=Cd(c[k>>2]|0)|0;c[g>>2]=20930;c[g+4>>2]=h;Fv(o,20891,g)|0}c[f>>2]=0;g=Hd(44,f)|0;c[k>>2]=g;if(!g){c[d>>2]=0;Hd(38,d)|0;c[b>>2]=0;Hd(48,b)|0;p=kb(0)|0;q=Sc(2,-1)|0;r=p^q;Tc(r);l=a;return}g=c[3977]|0;f=Cd(c[k>>2]|0)|0;c[e>>2]=20945;c[e+4>>2]=f;Fv(g,20891,e)|0;c[d>>2]=0;Hd(38,d)|0;c[b>>2]=0;Hd(48,b)|0;p=kb(0)|0;q=Sc(2,-1)|0;r=p^q;Tc(r);l=a;return}a=c[3977]|0;c[j>>2]=20777;Fv(a,20783,j)|0;c[n>>2]=286;if((c[246]|0)==-1)c[246]=$b(1,0,20849,20865,c[n>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[246]|0))_b();c[i>>2]=20849;c[i+4>>2]=286;cc(1,61747,i);_b()}function Sc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0.0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d+16|0;f=d+8|0;g=d;h=d+48|0;i=d+44|0;j=d+40|0;k=d+36|0;n=d+32|0;o=d+28|0;p=d+24|0;c[i>>2]=a;c[j>>2]=b;if((c[j>>2]|0)>>>0<=0){c[o>>2]=157;if((c[247]|0)==-1)c[247]=$b(1,0,20849,20965,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[247]|0))_b();c[g>>2]=20849;c[g+4>>2]=157;cc(1,61747,g);_b()}switch(c[i>>2]|0){case 1:{i=c[17691]|0;c[17691]=i+1;if(!((i>>>0)%256|0)){c[f>>2]=0;Hd(48,f)|0}c[n>>2]=-1-(4294967295%((c[j>>2]|0)>>>0)|0);do De(k,4,1);while((c[k>>2]|0)>>>0>=(c[n>>2]|0)>>>0);c[h>>2]=((c[k>>2]|0)>>>0)%((c[j>>2]|0)>>>0)|0;q=c[h>>2]|0;l=d;return q|0}case 2:{c[n>>2]=-1-(4294967295%((c[j>>2]|0)>>>0)|0);do Ee(k,4);while((c[k>>2]|0)>>>0>=(c[n>>2]|0)>>>0);c[h>>2]=((c[k>>2]|0)>>>0)%((c[j>>2]|0)>>>0)|0;q=c[h>>2]|0;l=d;return q|0}case 0:{r=+((c[j>>2]|0)>>>0);c[k>>2]=~~(r*+Uc())>>>0;if((c[k>>2]|0)>>>0>=(c[j>>2]|0)>>>0)c[k>>2]=(c[j>>2]|0)-1;c[h>>2]=c[k>>2];q=c[h>>2]|0;l=d;return q|0}default:{c[p>>2]=189;if((c[248]|0)==-1)c[248]=$b(1,0,20849,20965,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[248]|0))_b();c[e>>2]=20849;c[e+4>>2]=189;cc(1,61747,e);_b()}}return 0}function Tc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;xw(c[d>>2]|0);l=b;return}function Uc(){return +(+(zw()|0)/2147483647.0)}function Vc(){Ge(0,0);return}function Wc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+16|0;g=e+8|0;h=e;i=e+36|0;j=e+32|0;k=e+28|0;n=e+24|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;switch(c[i>>2]|0){case 1:{i=c[17692]|0;c[17692]=i+1;if(!((i>>>0)%256|0)){c[h>>2]=0;Hd(48,h)|0}De(c[j>>2]|0,c[k>>2]|0,1);l=e;return}case 2:{Ee(c[j>>2]|0,c[k>>2]|0);l=e;return}case 0:{h=c[17692]|0;c[17692]=h+1;if(!((h>>>0)%256|0)){c[g>>2]=0;Hd(48,g)|0}De(c[j>>2]|0,c[k>>2]|0,0);l=e;return}default:{c[n>>2]=135;if((c[249]|0)==-1)c[249]=$b(1,0,20849,20990,c[n>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[249]|0))_b();c[f>>2]=20849;c[f+4>>2]=135;cc(1,61747,f);_b()}}}function Xc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;b=l;l=l+48|0;if((l|0)>=(m|0))$(48);d=b+16|0;e=b+8|0;f=b;g=b+44|0;h=b+40|0;i=b+36|0;j=b+32|0;k=b+28|0;n=b+24|0;c[g>>2]=a;c[f>>2]=c[g>>2];if(Jd(j,0,21017,f)|0){c[k>>2]=155;if((c[250]|0)==-1)c[250]=$b(1,0,21041,21054,c[k>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[250]|0))_b();c[e>>2]=21041;c[e+4>>2]=155;cc(1,61747,e);_b()}if(!(te(i,c[j>>2]|0)|0)){Kd(c[j>>2]|0);c[h>>2]=Ub(4,21041,164)|0;c[c[h>>2]>>2]=c[i>>2];l=b;return c[h>>2]|0}c[n>>2]=158;if((c[251]|0)==-1)c[251]=$b(1,0,21041,21054,c[n>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[251]|0))_b();c[d>>2]=21041;c[d+4>>2]=158;cc(1,61747,d);_b();return 0}function Yc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Kd(c[c[d>>2]>>2]|0);Wb(c[d>>2]|0,21041,179);l=b;return}function Zc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=Ld(c[c[f>>2]>>2]|0,0,0,0)|0;c[i>>2]=Ub(c[h>>2]|0,21041,202)|0;b=(c[h>>2]|0)-1|0;if((b|0)==(Ld(c[c[f>>2]>>2]|0,0,c[i>>2]|0,c[h>>2]|0)|0)){c[c[g>>2]>>2]=c[i>>2];l=d;return c[h>>2]|0}c[j>>2]=207;if((c[252]|0)==-1)c[252]=$b(1,0,21041,21091,c[j>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[252]|0))_b();c[e>>2]=21041;c[e+4>>2]=207;cc(1,61747,e);_b();return 0}function _c(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+8|0;f=d;g=d+32|0;h=d+28|0;i=d+24|0;j=d+20|0;k=d+16|0;n=d+12|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=Ub(4,21041,226)|0;if(Id(c[j>>2]|0,c[h>>2]|0,c[i>>2]|0,0)|0){c[k>>2]=234;if((c[253]|0)==-1)c[253]=$b(2,21128,21041,21133,c[k>>2]|0)|0;if((ac()|0)<=0){if(c[253]|0)hc(2,21128,21170,f)}else bc(-1,0);Wb(c[j>>2]|0,21041,235);c[g>>2]=0;o=c[g>>2]|0;l=d;return o|0}if(!(se(c[c[j>>2]>>2]|0)|0)){c[g>>2]=c[j>>2];o=c[g>>2]|0;l=d;return o|0}c[n>>2]=241;if((c[254]|0)==-1)c[254]=$b(2,21128,21041,21133,c[n>>2]|0)|0;if((ac()|0)<=0){if(c[254]|0)hc(2,21128,21170,e)}else bc(-1,0);Yc(c[j>>2]|0);c[g>>2]=0;o=c[g>>2]|0;l=d;return o|0}function $c(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;b=l;l=l+64|0;if((l|0)>=(m|0))$(64);d=b+8|0;e=b;f=b+48|0;g=b+44|0;h=b+40|0;i=b+32|0;j=b+24|0;k=b+20|0;n=b+16|0;c[g>>2]=a;c[j>>2]=ad(i,c[c[g>>2]>>2]|0,37989,39361)|0;if(c[j>>2]|0)c[j>>2]=ad(i,c[c[g>>2]>>2]|0,37977,39361)|0;if(c[j>>2]|0)c[j>>2]=ad(i,c[c[g>>2]>>2]|0,40959,39361)|0;if(!(c[j>>2]|0)){g=c[i+4>>2]|0;c[d>>2]=c[i>>2];c[d+4>>2]=g;c[j>>2]=Jd(k,0,21293,d)|0;Qd(c[i>>2]|0);Qd(c[i+4>>2]|0);c[h>>2]=Ub(4,21041,280)|0;c[c[h>>2]>>2]=c[k>>2];c[f>>2]=c[h>>2];o=c[f>>2]|0;l=b;return o|0}c[n>>2]=270;if((c[255]|0)==-1)c[255]=$b(2,0,21041,21204,c[n>>2]|0)|0;if((ac()|0)<=0){if(c[255]|0){c[e>>2]=21041;c[e+4>>2]=270;cc(66,21245,e)}}else bc(-1,0);c[f>>2]=0;o=c[f>>2]|0;l=b;return o|0}function ad(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;n=g+20|0;o=g+16|0;p=g+12|0;q=g+8|0;r=g+4|0;s=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=Md(c[j>>2]|0,c[k>>2]|0,0)|0;c[o>>2]=f;if(!f){c[h>>2]=1;t=c[h>>2]|0;l=g;return t|0}c[p>>2]=Nd(c[o>>2]|0)|0;Kd(c[o>>2]|0);c[o>>2]=c[p>>2];if(!(c[o>>2]|0)){c[h>>2]=2;t=c[h>>2]|0;l=g;return t|0}c[s>>2]=0;c[q>>2]=c[n>>2];while(1){u=c[o>>2]|0;if(!(a[c[q>>2]>>0]|0)){v=18;break}n=Md(u,c[q>>2]|0,1)|0;c[p>>2]=n;if(!n){v=8;break}n=Od(c[p>>2]|0,1,5)|0;c[(c[i>>2]|0)+(c[s>>2]<<2)>>2]=n;Kd(c[p>>2]|0);if(!(c[(c[i>>2]|0)+(c[s>>2]<<2)>>2]|0)){v=13;break}c[q>>2]=(c[q>>2]|0)+1;c[s>>2]=(c[s>>2]|0)+1}if((v|0)==8){c[r>>2]=0;while(1){if((c[r>>2]|0)>>>0>=(c[s>>2]|0)>>>0)break;Ie(c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]|0);c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]=0;c[r>>2]=(c[r>>2]|0)+1}Kd(c[o>>2]|0);c[h>>2]=3;t=c[h>>2]|0;l=g;return t|0}else if((v|0)==13){c[r>>2]=0;while(1){if((c[r>>2]|0)>>>0>=(c[s>>2]|0)>>>0)break;Ie(c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]|0);c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]=0;c[r>>2]=(c[r>>2]|0)+1}Kd(c[o>>2]|0);c[h>>2]=4;t=c[h>>2]|0;l=g;return t|0}else if((v|0)==18){Kd(u);c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}return 0}function bd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Kd(c[c[d>>2]>>2]|0);Wb(c[d>>2]|0,21041,295);l=b;return}function cd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=Ld(c[c[f>>2]>>2]|0,3,0,0)|0;c[i>>2]=Ub(c[h>>2]|0,21041,318)|0;b=(c[h>>2]|0)-1|0;if((b|0)==(Ld(c[c[f>>2]>>2]|0,3,c[i>>2]|0,c[h>>2]|0)|0)){c[c[g>>2]>>2]=c[i>>2];l=d;return c[h>>2]|0}c[j>>2]=323;if((c[256]|0)==-1)c[256]=$b(1,0,21041,21323,c[j>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[256]|0))_b();c[e>>2]=21041;c[e+4>>2]=323;cc(1,61747,e);_b();return 0}function dd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+8|0;f=d;g=d+44|0;h=d+40|0;i=d+36|0;j=d+32|0;k=d+28|0;n=d+24|0;o=d+20|0;p=d+16|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=Ub(4,21041,367)|0;if(Id(c[j>>2]|0,c[h>>2]|0,c[i>>2]|0,0)|0){c[o>>2]=374;if((c[257]|0)==-1)c[257]=$b(2,0,21041,21359,c[o>>2]|0)|0;if((ac()|0)<=0){if(c[257]|0){c[f>>2]=21041;c[f+4>>2]=374;cc(66,21245,f)}}else bc(-1,0);Wb(c[j>>2]|0,21041,375);c[g>>2]=0;q=c[g>>2]|0;l=d;return q|0}c[n>>2]=ad(k,c[c[j>>2]>>2]|0,37989,39375)|0;if(c[n>>2]|0)c[n>>2]=ad(k,c[c[j>>2]>>2]|0,40959,39375)|0;if(!(c[n>>2]|0)){Qd(c[k>>2]|0);c[g>>2]=c[j>>2];q=c[g>>2]|0;l=d;return q|0}c[p>>2]=385;if((c[258]|0)==-1)c[258]=$b(1,0,21041,21359,c[p>>2]|0)|0;if((ac()|0)<=0){if(c[258]|0){c[e>>2]=21041;c[e+4>>2]=385;cc(1,61747,e)}}else bc(-1,0);Kd(c[c[j>>2]>>2]|0);Wb(c[j>>2]|0,21041,387);c[g>>2]=0;q=c[g>>2]|0;l=d;return q|0}function ed(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=Ld(c[c[f>>2]>>2]|0,3,0,0)|0;c[i>>2]=Ub(c[h>>2]|0,21041,958)|0;b=(c[h>>2]|0)-1|0;if((b|0)==(Ld(c[c[f>>2]>>2]|0,3,c[i>>2]|0,c[h>>2]|0)|0)){c[c[g>>2]>>2]=c[i>>2];l=d;return c[h>>2]|0}c[j>>2]=963;if((c[259]|0)==-1)c[259]=$b(1,0,21041,21395,c[j>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[259]|0))_b();c[e>>2]=21041;c[e+4>>2]=963;cc(1,61747,e);_b();return 0}function fd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;g=l;l=l+80|0;if((l|0)>=(m|0))$(80);h=g+8|0;i=g;j=g+76|0;k=g+72|0;n=g+68|0;o=g+64|0;p=g+60|0;q=g+56|0;r=g+52|0;s=g+48|0;t=g+40|0;u=g+32|0;v=g+28|0;w=g+24|0;x=g+20|0;y=g+16|0;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;if(!((c[p>>2]|0)!=0&(c[q>>2]|0)!=0)){c[x>>2]=738;if((c[260]|0)==-1)c[260]=$b(1,0,21041,21430,c[x>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[260]|0))_b();c[i>>2]=21041;c[i+4>>2]=738;cc(1,61747,i);_b()}c[w>>2]=ad(t,c[c[o>>2]>>2]|0,37989,39361)|0;if(c[w>>2]|0)c[w>>2]=ad(t,c[c[o>>2]>>2]|0,40959,39361)|0;if(!(c[w>>2]|0)){c[s>>2]=gd(c[o>>2]|0,c[k>>2]|0)|0;do if(c[s>>2]|0){c[r>>2]=hd(c[o>>2]|0,c[n>>2]|0)|0;if(!(c[r>>2]|0)){Qd(c[s>>2]|0);break}c[u>>2]=Pd(0)|0;Vd(c[u>>2]|0,c[c[r>>2]>>2]|0,c[t+4>>2]|0,c[t>>2]|0);c[v>>2]=Pd(0)|0;Ud(c[v>>2]|0,c[s>>2]|0,c[u>>2]|0,c[t>>2]|0);Qd(c[s>>2]|0);Qd(c[t>>2]|0);Qd(c[t+4>>2]|0);Qd(c[u>>2]|0);id(c[r>>2]|0);k=jd(c[v>>2]|0,c[p>>2]|0)|0;c[c[q>>2]>>2]=k;Qd(c[v>>2]|0);c[j>>2]=1;z=c[j>>2]|0;l=g;return z|0}while(0);Qd(c[t>>2]|0);Qd(c[t+4>>2]|0);c[c[p>>2]>>2]=0;c[c[q>>2]>>2]=0;c[j>>2]=0;z=c[j>>2]|0;l=g;return z|0}c[y>>2]=744;if((c[261]|0)==-1)c[261]=$b(1,0,21041,21430,c[y>>2]|0)|0;if((ac()|0)<=0){if(c[261]|0){c[h>>2]=21041;c[h+4>>2]=744;cc(1,61747,h)}}else bc(-1,0);c[c[p>>2]>>2]=0;c[c[q>>2]>>2]=0;c[j>>2]=0;z=c[j>>2]|0;l=g;return z|0}function gd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d+8|0;f=d;g=d+52|0;h=d+48|0;i=d+44|0;j=d+40|0;k=d+36|0;n=d+32|0;o=d+28|0;p=d+24|0;q=d+20|0;r=d+16|0;c[h>>2]=a;c[i>>2]=b;if(ad(k,c[c[h>>2]>>2]|0,40959,39375)|0){c[q>>2]=689;if((c[266]|0)==-1)c[266]=$b(1,0,21041,21548,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[266]|0))_b();c[f>>2]=21041;c[f+4>>2]=689;cc(1,61747,f);_b()}if(!(he(c[k>>2]|0,2)|0)){c[o>>2]=cd(c[h>>2]|0,n)|0;Nc(j,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[i>>2]|0,64,21569);Wb(c[n>>2]|0,21041,704);c[p>>2]=kd(c[j>>2]|0,c[k>>2]|0)|0;Qd(c[k>>2]|0);k=c[j>>2]|0;if(c[p>>2]|0){c[g>>2]=k;s=c[g>>2]|0;l=d;return s|0}else{Qd(k);c[g>>2]=0;s=c[g>>2]|0;l=d;return s|0}}c[r>>2]=691;if((c[267]|0)==-1)c[267]=$b(1,0,21041,21548,c[r>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[267]|0))_b();c[e>>2]=21041;c[e+4>>2]=691;cc(1,61747,e);_b();return 0}function hd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d+16|0;f=d+8|0;g=d;h=d+52|0;i=d+48|0;j=d+44|0;k=d+40|0;n=d+36|0;o=d+32|0;p=d+28|0;q=d+24|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=21480;c[k>>2]=Ub(4,21041,434)|0;if(!(c[k>>2]|0)){c[o>>2]=435;if((c[263]|0)==-1)c[263]=$b(1,0,21041,21511,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[263]|0))_b();c[g>>2]=21041;c[g+4>>2]=435;cc(1,61747,g);_b()}if(ad(n,c[c[h>>2]>>2]|0,40959,39375)|0){c[p>>2]=438;if((c[264]|0)==-1)c[264]=$b(1,0,21041,21511,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[264]|0))_b();c[f>>2]=21041;c[f+4>>2]=438;cc(1,61747,f);_b()}if(!(he(c[n>>2]|0,2)|0)){f=c[k>>2]|0;p=c[n>>2]|0;h=c[j>>2]|0;g=hv(c[j>>2]|0)|0;Nc(f,p,h,g,c[i>>2]|0,32,21535);if(kd(c[c[k>>2]>>2]|0,c[n>>2]|0)|0){r=c[n>>2]|0;Qd(r);s=c[k>>2]|0;l=d;return s|0}Wb(c[k>>2]|0,21041,448);c[k>>2]=0;r=c[n>>2]|0;Qd(r);s=c[k>>2]|0;l=d;return s|0}c[q>>2]=440;if((c[265]|0)==-1)c[265]=$b(1,0,21041,21511,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[265]|0))_b();c[e>>2]=21041;c[e+4>>2]=440;cc(1,61747,e);_b();return 0}function id(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Qd(c[c[d>>2]>>2]|0);Wb(c[d>>2]|0,21041,631);l=b;return}function jd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d;f=d+28|0;g=d+24|0;h=d+20|0;i=d+16|0;j=d+8|0;c[f>>2]=a;c[g>>2]=b;Td(5,0,0,h,c[f>>2]|0)|0;c[i>>2]=Ub(c[h>>2]|0,21041,655)|0;if(!(Td(5,c[i>>2]|0,c[h>>2]|0,d+12|0,c[f>>2]|0)|0)){c[c[g>>2]>>2]=c[i>>2];l=d;return c[h>>2]|0}c[j>>2]=661;if((c[262]|0)==-1)c[262]=$b(1,0,21041,21454,c[j>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[262]|0))_b();c[e>>2]=21041;c[e+4>>2]=661;cc(1,61747,e);_b();return 0}function kd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=Pd(0)|0;c[h>>2]=Wd(c[g>>2]|0,c[e>>2]|0,c[f>>2]|0)|0;Qd(c[g>>2]|0);l=d;return c[h>>2]|0}function ld(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+8|0;e=b;f=b+24|0;g=b+20|0;h=b+16|0;c[f>>2]=a;c[g>>2]=0;c[e>>2]=c[f>>2];if(!(Jd(g,0,21584,e)|0)){l=b;return c[g>>2]|0}c[h>>2]=806;if((c[268]|0)==-1)c[268]=$b(1,0,21041,21614,c[h>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[268]|0))_b();c[d>>2]=21041;c[d+4>>2]=806;cc(1,61747,d);_b();return 0}function md(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Kd(c[c[d>>2]>>2]|0);Wb(c[d>>2]|0,21041,936);l=b;return}function nd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+8|0;f=d;g=d+44|0;h=d+40|0;i=d+36|0;j=d+32|0;k=d+28|0;n=d+24|0;o=d+20|0;p=d+16|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=Ub(4,21041,985)|0;if(Id(c[j>>2]|0,c[h>>2]|0,c[i>>2]|0,0)|0){c[o>>2]=992;if((c[269]|0)==-1)c[269]=$b(2,0,21041,21626,c[o>>2]|0)|0;if((ac()|0)<=0){if(c[269]|0){c[f>>2]=21041;c[f+4>>2]=992;cc(66,21245,f)}}else bc(-1,0);Wb(c[j>>2]|0,21041,993);c[g>>2]=0;q=c[g>>2]|0;l=d;return q|0}c[k>>2]=ad(n,c[c[j>>2]>>2]|0,37839,39373)|0;if(c[k>>2]|0)c[k>>2]=ad(n,c[c[j>>2]>>2]|0,40959,39373)|0;if(!(c[k>>2]|0)){Qd(c[n>>2]|0);c[g>>2]=c[j>>2];q=c[g>>2]|0;l=d;return q|0}c[p>>2]=1003;if((c[270]|0)==-1)c[270]=$b(2,0,21041,21626,c[p>>2]|0)|0;if((ac()|0)<=0){if(c[270]|0){c[e>>2]=21041;c[e+4>>2]=1003;cc(66,21245,e)}}else bc(-1,0);Kd(c[c[j>>2]>>2]|0);Wb(c[j>>2]|0,21041,1005);c[g>>2]=0;q=c[g>>2]|0;l=d;return q|0}function od(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;e=l;l=l+112|0;if((l|0)>=(m|0))$(112);f=e+40|0;g=e+32|0;h=e+24|0;i=e+16|0;j=e+8|0;k=e;n=e+108|0;o=e+104|0;p=e+100|0;q=e+96|0;r=e+92|0;s=e+88|0;t=e+84|0;u=e+80|0;v=e+76|0;w=e+72|0;x=e+68|0;y=e+64|0;z=e+60|0;A=e+56|0;B=e+52|0;C=e+48|0;c[o>>2]=a;c[p>>2]=b;c[q>>2]=d;c[w>>2]=ad(s,c[c[q>>2]>>2]|0,37989,39375)|0;if(c[w>>2]|0)c[w>>2]=ad(s,c[c[q>>2]>>2]|0,40959,39375)|0;if(c[w>>2]|0){c[y>>2]=1066;if((c[271]|0)==-1)c[271]=$b(2,0,21041,21661,c[y>>2]|0)|0;if((ac()|0)<=0){if(c[271]|0){c[k>>2]=21041;c[k+4>>2]=1066;cc(66,21245,k)}}else bc(-1,0);c[n>>2]=0;D=c[n>>2]|0;l=e;return D|0}c[w>>2]=ad(t,c[c[o>>2]>>2]|0,37839,39373)|0;if(c[w>>2]|0)c[w>>2]=ad(t,c[c[o>>2]>>2]|0,40959,39373)|0;if(c[w>>2]|0){Qd(c[s>>2]|0);c[z>>2]=1075;if((c[272]|0)==-1)c[272]=$b(2,0,21041,21661,c[z>>2]|0)|0;if((ac()|0)<=0){if(c[272]|0){c[j>>2]=21041;c[j+4>>2]=1075;cc(66,21245,j)}}else bc(-1,0);c[n>>2]=0;D=c[n>>2]|0;l=e;return D|0}c[r>>2]=hd(c[q>>2]|0,c[p>>2]|0)|0;if(!(c[r>>2]|0)){c[A>>2]=1086;if((c[273]|0)==-1)c[273]=$b(2,0,21041,21661,c[A>>2]|0)|0;if((ac()|0)<=0){if(c[273]|0){c[i>>2]=21041;c[i+4>>2]=1086;cc(66,21245,i)}}else bc(-1,0);Qd(c[s>>2]|0);Qd(c[t>>2]|0);c[n>>2]=0;D=c[n>>2]|0;l=e;return D|0}c[u>>2]=Pd(0)|0;if(1!=(Xd(c[u>>2]|0,c[c[r>>2]>>2]|0,c[s>>2]|0)|0)){c[B>>2]=1100;if((c[274]|0)==-1)c[274]=$b(2,0,21041,21661,c[B>>2]|0)|0;if((ac()|0)<=0){if(c[274]|0){c[h>>2]=21041;c[h+4>>2]=1100;cc(66,21245,h)}}else bc(-1,0);Qd(c[u>>2]|0);id(c[r>>2]|0);Qd(c[s>>2]|0);Qd(c[t>>2]|0);c[n>>2]=0;D=c[n>>2]|0;l=e;return D|0}c[v>>2]=Pd(0)|0;Ud(c[v>>2]|0,c[t>>2]|0,c[u>>2]|0,c[s>>2]|0);Qd(c[s>>2]|0);Qd(c[u>>2]|0);Qd(c[t>>2]|0);id(c[r>>2]|0);c[x>>2]=Ub(4,21041,1115)|0;r=c[x>>2]|0;c[g>>2]=c[v>>2];if(!(Jd(r,0,21687,g)|0)){Qd(c[v>>2]|0);c[n>>2]=c[x>>2];D=c[n>>2]|0;l=e;return D|0}c[C>>2]=1120;if((c[275]|0)==-1)c[275]=$b(1,0,21041,21661,c[C>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[275]|0))_b();c[f>>2]=21041;c[f+4>>2]=1120;cc(1,61747,f);_b();return 0}function pd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+8|0;g=e;h=e+52|0;i=e+48|0;j=e+44|0;k=e+40|0;n=e+36|0;o=e+32|0;p=e+28|0;q=e+24|0;r=e+20|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[o>>2]=gd(c[k>>2]|0,c[i>>2]|0)|0;if(!(c[o>>2]|0)){c[q>>2]=1146;if((c[276]|0)==-1)c[276]=$b(2,0,21041,21710,c[q>>2]|0)|0;if((ac()|0)<=0){if(c[276]|0){c[g>>2]=21041;c[g+4>>2]=1146;cc(66,21245,g)}}else bc(-1,0);c[h>>2]=0;s=c[h>>2]|0;l=e;return s|0}c[n>>2]=ld(c[o>>2]|0)|0;Qd(c[o>>2]|0);c[p>>2]=re(c[c[j>>2]>>2]|0,c[n>>2]|0,c[c[k>>2]>>2]|0)|0;Kd(c[n>>2]|0);if(!(c[p>>2]|0)){c[h>>2]=1;s=c[h>>2]|0;l=e;return s|0}c[r>>2]=1169;if((c[277]|0)==-1)c[277]=$b(2,21128,21041,21710,c[r>>2]|0)|0;if((ac()|0)<=0){if(c[277]|0){r=Cd(c[p>>2]|0)|0;c[f>>2]=21041;c[f+4>>2]=1168;c[f+8>>2]=r;hc(2,21128,21735,f)}}else bc(-1,0);c[h>>2]=-1;s=c[h>>2]|0;l=e;return s|0}function qd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+16|0;f=d+40|0;g=d+36|0;h=d+32|0;i=d+8|0;j=d;c[g>>2]=b;c[h>>2]=21823;b=a;k=c[b+4>>2]|0;n=i;c[n>>2]=c[b>>2];c[n+4>>2]=k;k=wd()|0;n=j;c[n>>2]=k;c[n+4>>2]=D;n=j;j=a;if((c[n>>2]|0)==(c[j>>2]|0)?(c[n+4>>2]|0)==(c[j+4>>2]|0):0){c[f>>2]=21801;o=c[f>>2]|0;l=d;return o|0}j=a;if(0==(c[j>>2]|0)?0==(c[j+4>>2]|0):0){c[f>>2]=21827;o=c[f>>2]|0;l=d;return o|0}j=i;a=c[j+4>>2]|0;if(!(!(1==(c[g>>2]|0)&(a>>>0>0|(a|0)==0&(c[j>>2]|0)>>>0>5e3))?(j=i,a=jx(c[j>>2]|0,c[j+4>>2]|0,1e3,0)|0,!(0==(a|0)&0==(D|0))):0))p=7;do if((p|0)==7){a=i;j=ex(c[a>>2]|0,c[a+4>>2]|0,1e3,0)|0;a=i;c[a>>2]=j;c[a+4>>2]=D;c[h>>2]=21809;a=i;j=c[a+4>>2]|0;if(!(1==(c[g>>2]|0)&(j>>>0>0|(j|0)==0&(c[a>>2]|0)>>>0>5e3))?(a=i,j=jx(c[a>>2]|0,c[a+4>>2]|0,1e3,0)|0,!(0==(j|0)&0==(D|0))):0)break;j=i;a=ex(c[j>>2]|0,c[j+4>>2]|0,1e3,0)|0;j=i;c[j>>2]=a;c[j+4>>2]=D;c[h>>2]=39373;j=i;a=c[j+4>>2]|0;if(!(1==(c[g>>2]|0)&(a>>>0>0|(a|0)==0&(c[j>>2]|0)>>>0>300))?(j=i,a=jx(c[j>>2]|0,c[j+4>>2]|0,60,0)|0,!(0==(a|0)&0==(D|0))):0)break;a=i;j=ex(c[a>>2]|0,c[a+4>>2]|0,60,0)|0;a=i;c[a>>2]=j;c[a+4>>2]=D;c[h>>2]=21812;a=i;j=c[a+4>>2]|0;if(!(1==(c[g>>2]|0)&(j>>>0>0|(j|0)==0&(c[a>>2]|0)>>>0>300))?(a=i,j=jx(c[a>>2]|0,c[a+4>>2]|0,60,0)|0,!(0==(j|0)&0==(D|0))):0)break;j=i;a=ex(c[j>>2]|0,c[j+4>>2]|0,60,0)|0;j=i;c[j>>2]=a;c[j+4>>2]=D;c[h>>2]=35616;j=i;a=c[j+4>>2]|0;if(!(1==(c[g>>2]|0)&(a>>>0>0|(a|0)==0&(c[j>>2]|0)>>>0>120))?(j=i,a=jx(c[j>>2]|0,c[j+4>>2]|0,24,0)|0,!(0==(a|0)&0==(D|0))):0)break;a=i;j=ex(c[a>>2]|0,c[a+4>>2]|0,24,0)|0;a=i;c[a>>2]=j;c[a+4>>2]=D;a=i;if(1==(c[a>>2]|0)?0==(c[a+4>>2]|0):0){c[h>>2]=21814;break}else{c[h>>2]=21818;break}}while(0);g=i;i=c[g+4>>2]|0;p=c[h>>2]|0;h=e;c[h>>2]=c[g>>2];c[h+4>>2]=i;c[e+8>>2]=p;Xb(72095,128,21793,e)|0;c[f>>2]=72095;o=c[f>>2]|0;l=d;return o|0}function rd(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;h=l;l=l+96|0;if((l|0)>=(m|0))$(96);i=h+24|0;j=h+16|0;k=h+8|0;n=h;o=h+84|0;p=h+80|0;q=h+76|0;r=h+72|0;s=h+68|0;t=h+64|0;u=h+60|0;v=h+56|0;w=h+52|0;x=h+48|0;y=h+44|0;z=h+40|0;A=h+36|0;B=h+32|0;c[p>>2]=b;c[q>>2]=e;c[r>>2]=f;c[s>>2]=g;c[x>>2]=c[p>>2];if((c[s>>2]|0)>>>0<((((c[q>>2]<<3)+4|0)>>>0)/5|0)>>>0){c[y>>2]=883;if((c[278]|0)==-1)c[278]=$b(1,0,21783,21832,c[y>>2]|0)|0;if((ac()|0)<=0){if(c[278]|0){c[n>>2]=21783;c[n+4>>2]=883;cc(1,61747,n)}}else bc(-1,0);c[o>>2]=0;C=c[o>>2]|0;l=h;return C|0}c[w>>2]=0;c[t>>2]=0;c[u>>2]=0;c[v>>2]=0;while(1){if(!((c[u>>2]|0)>>>0<(c[q>>2]|0)>>>0?1:(c[w>>2]|0)>>>0>0)){D=32;break}if((c[w>>2]|0)>>>0<5?(c[u>>2]|0)>>>0<(c[q>>2]|0)>>>0:0){n=c[v>>2]<<8;y=c[u>>2]|0;c[u>>2]=y+1;c[v>>2]=n|(d[(c[x>>2]|0)+y>>0]|0);c[w>>2]=(c[w>>2]|0)+8}if((c[w>>2]|0)>>>0<5){c[v>>2]=c[v>>2]<<5-(c[w>>2]|0);if((c[w>>2]|0)!=((c[q>>2]<<3>>>0)%5|0|0)){D=15;break}c[w>>2]=5}if((c[t>>2]|0)>>>0>=(c[s>>2]|0)>>>0){D=24;break}y=a[(c[281]|0)+((c[v>>2]|0)>>>((c[w>>2]|0)-5|0)&31)>>0]|0;n=c[t>>2]|0;c[t>>2]=n+1;a[(c[r>>2]|0)+n>>0]=y;c[w>>2]=(c[w>>2]|0)-5}if((D|0)==15){c[z>>2]=900;if((c[279]|0)==-1)c[279]=$b(1,0,21783,21832,c[z>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[279]|0))_b();c[k>>2]=21783;c[k+4>>2]=900;cc(1,61747,k);_b()}else if((D|0)==24){c[A>>2]=905;if((c[280]|0)==-1)c[280]=$b(1,0,21783,21832,c[A>>2]|0)|0;if((ac()|0)<=0){if(c[280]|0){c[j>>2]=21783;c[j+4>>2]=905;cc(1,61747,j)}}else bc(-1,0);c[o>>2]=0;C=c[o>>2]|0;l=h;return C|0}else if((D|0)==32){if(!(c[w>>2]|0)){if((c[t>>2]|0)>>>0<(c[s>>2]|0)>>>0)a[(c[r>>2]|0)+(c[t>>2]|0)>>0]=0;c[o>>2]=(c[r>>2]|0)+(c[t>>2]|0);C=c[o>>2]|0;l=h;return C|0}c[B>>2]=911;if((c[282]|0)==-1)c[282]=$b(1,0,21783,21832,c[B>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[282]|0))_b();c[i>>2]=21783;c[i+4>>2]=911;cc(1,61747,i);_b()}return 0}function sd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[g>>2]=b;c[h>>2]=d;c[j>>2]=c[h>>2]<<3;if((((c[j>>2]|0)>>>0)%5|0)>>>0>0)c[j>>2]=(c[j>>2]|0)+(5-(((c[j>>2]|0)>>>0)%5|0));c[j>>2]=((c[j>>2]|0)>>>0)/5|0;c[i>>2]=Ub((c[j>>2]|0)+1|0,21783,939)|0;c[k>>2]=rd(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;if(!(c[k>>2]|0)){Wb(c[i>>2]|0,21783,943);c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}else{a[c[k>>2]>>0]=0;c[f>>2]=c[i>>2];n=c[f>>2]|0;l=e;return n|0}return 0}function td(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;g=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=g;i=g+60|0;j=g+56|0;k=g+52|0;n=g+48|0;o=g+44|0;p=g+40|0;q=g+36|0;r=g+32|0;s=g+28|0;t=g+24|0;u=g+20|0;v=g+16|0;w=g+12|0;x=g+8|0;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[w>>2]=c[o>>2]<<3;if(!(c[k>>2]|0))if(!(c[o>>2]|0)){c[i>>2]=1;y=c[i>>2]|0;l=g;return y|0}else{c[i>>2]=-1;y=c[i>>2]|0;l=g;return y|0}c[v>>2]=c[n>>2];c[q>>2]=c[o>>2];c[p>>2]=c[k>>2];if((((c[w>>2]|0)>>>0)%5|0)>>>0>0){c[s>>2]=((c[w>>2]|0)>>>0)%5|0;c[u>>2]=5-(c[s>>2]|0);o=(c[p>>2]|0)+-1|0;c[p>>2]=o;n=ud(a[(c[j>>2]|0)+o>>0]|0)|0;c[t>>2]=n;c[r>>2]=n>>c[u>>2]}else{c[s>>2]=5;c[u>>2]=0;n=(c[p>>2]|0)+-1|0;c[p>>2]=n;o=ud(a[(c[j>>2]|0)+n>>0]|0)|0;c[t>>2]=o;c[r>>2]=o}if(((((c[w>>2]|0)+(c[u>>2]|0)|0)>>>0)/5|0|0)!=(c[k>>2]|0)){c[i>>2]=-1;y=c[i>>2]|0;l=g;return y|0}if(-1==(c[t>>2]|0)){c[i>>2]=-1;y=c[i>>2]|0;l=g;return y|0}while(1){z=c[p>>2]|0;if((c[q>>2]|0)>>>0<=0){A=25;break}if(!z){A=14;break}k=(c[p>>2]|0)+-1|0;c[p>>2]=k;u=ud(a[(c[j>>2]|0)+k>>0]|0)|0;c[t>>2]=u;c[r>>2]=u<>2]|c[r>>2];if(-1==(c[t>>2]|0)){A=22;break}c[s>>2]=(c[s>>2]|0)+5;if((c[s>>2]|0)>>>0<8)continue;u=c[r>>2]&255;k=(c[q>>2]|0)+-1|0;c[q>>2]=k;a[(c[v>>2]|0)+k>>0]=u;c[r>>2]=(c[r>>2]|0)>>>8;c[s>>2]=(c[s>>2]|0)-8}if((A|0)==14){c[x>>2]=1003;if((c[283]|0)==-1)c[283]=$b(1,0,21783,21895,c[x>>2]|0)|0;if((ac()|0)<=0){if(c[283]|0){c[h>>2]=21783;c[h+4>>2]=1003;cc(1,61747,h)}}else bc(-1,0);c[i>>2]=-1;y=c[i>>2]|0;l=g;return y|0}else if((A|0)==22){c[i>>2]=-1;y=c[i>>2]|0;l=g;return y|0}else if((A|0)==25)if(0!=(z|0)|0!=(c[s>>2]|0)){c[i>>2]=-1;y=c[i>>2]|0;l=g;return y|0}else{c[i>>2]=1;y=c[i>>2]|0;l=g;return y|0}return 0}function ud(b){b=b|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+4|0;g=e+8|0;h=e;a[g>>0]=b;switch(d[g>>0]|0|0){case 111:case 79:{a[g>>0]=48;break}case 76:case 108:case 73:case 105:{a[g>>0]=49;break}case 85:case 117:{a[g>>0]=86;break}default:{}}if((d[g>>0]|0|0)>=48?(d[g>>0]|0|0)<=57:0){c[f>>2]=(d[g>>0]|0)-48;i=c[f>>2]|0;l=e;return i|0}if((d[g>>0]|0|0)>=97?(d[g>>0]|0|0)<=122:0)a[g>>0]=gv(d[g>>0]|0)|0;c[h>>2]=0;if((d[g>>0]|0|0)>=65?(d[g>>0]|0|0)<=90:0){if(73<(d[g>>0]|0|0))c[h>>2]=(c[h>>2]|0)+1;if(76<(d[g>>0]|0|0))c[h>>2]=(c[h>>2]|0)+1;if(79<(d[g>>0]|0|0))c[h>>2]=(c[h>>2]|0)+1;if(85<(d[g>>0]|0|0))c[h>>2]=(c[h>>2]|0)+1;c[f>>2]=(d[g>>0]|0)-65+10-(c[h>>2]|0);i=c[f>>2]|0;l=e;return i|0}c[f>>2]=-1;i=c[f>>2]|0;l=e;return i|0}function vd(){var a=0;a=70696;D=c[a+4>>2]|0;return c[a>>2]|0}function wd(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;c[b>>2]=c[16];c[b+4>>2]=c[17];d=b;D=c[d+4>>2]|0;l=a;return c[d>>2]|0}function xd(){var a=0,b=0,d=0,e=0,f=0,g=0;a=l;l=l+32|0;if((l|0)>=(m|0))$(32);b=a+8|0;d=a;e=a+16|0;lb(e|0,0)|0;f=c[e>>2]|0;g=gx(f|0,((f|0)<0)<<31>>31|0,1e3,0)|0;f=gx(g|0,D|0,1e3,0)|0;g=c[e+4>>2]|0;e=Ww(f|0,D|0,g|0,((g|0)<0)<<31>>31|0)|0;g=70696;f=Ww(e|0,D|0,c[g>>2]|0,c[g+4>>2]|0)|0;g=d;c[g>>2]=f;c[g+4>>2]=D;c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];d=b;D=c[d+4>>2]|0;l=a;return c[d>>2]|0}function yd(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;c[b>>2]=c[17676];c[b+4>>2]=c[17677];d=b;D=c[d+4>>2]|0;l=a;return c[d>>2]|0}function zd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+24|0;e=b+16|0;f=b+8|0;g=b;h=xd()|0;i=g;c[i>>2]=h;c[i+4>>2]=D;c[e>>2]=c[g>>2];c[e+4>>2]=c[g+4>>2];g=a;i=c[g+4>>2]|0;h=e;j=c[h+4>>2]|0;if(i>>>0>j>>>0|((i|0)==(j|0)?(c[g>>2]|0)>>>0>(c[h>>2]|0)>>>0:0)){h=yd()|0;g=d;c[g>>2]=h;c[g+4>>2]=D;k=d;n=k;o=c[n>>2]|0;p=k+4|0;q=p;r=c[q>>2]|0;D=r;l=b;return o|0}else{g=e;e=a;a=Tw(c[g>>2]|0,c[g+4>>2]|0,c[e>>2]|0,c[e+4>>2]|0)|0;e=f;c[e>>2]=a;c[e+4>>2]=D;c[d>>2]=c[f>>2];c[d+4>>2]=c[f+4>>2];k=d;n=k;o=c[n>>2]|0;p=k+4|0;q=p;r=c[q>>2]|0;D=r;l=b;return o|0}return 0}function Ad(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;f=e;c[f>>2]=a;c[f+4>>2]=b;b=Iv(c[e>>2]|0)|0;f=Ww(0,b|0,Iv(c[e+4>>2]|0)|0,0)|0;l=d;return f|0}function Bd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;f=e;c[f>>2]=a;c[f+4>>2]=b;b=Mv(c[e>>2]|0)|0;f=Ww(0,b|0,Mv(c[e+4>>2]|0)|0,0)|0;l=d;return f|0}function Cd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Dd(c[d>>2]|0)|0;l=b;return a|0}function Dd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Bt(c[d>>2]|0)|0;l=b;return a|0}function Ed(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function Fd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Ed(1,c[d>>2]|0)|0;l=b;return a|0}function Gd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=gf(c[d>>2]|0)|0;l=b;return a|0}function Hd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d;c[e>>2]=a;c[g>>2]=b;c[f>>2]=Fd(kf(c[e>>2]|0,g)|0)|0;l=d;return c[f>>2]|0}function Id(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=Fd(Sf(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0)|0;l=f;return e|0}function Jd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[k>>2]=e;c[j>>2]=dg(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,k)|0;k=Fd(c[j>>2]|0)|0;l=f;return k|0}function Kd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Rf(c[d>>2]|0);l=b;return}function Ld(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=fg(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;l=f;return e|0}function Md(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Tf(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function Nd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=bg(c[d>>2]|0)|0;l=b;return a|0}function Od(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=$f(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function Pd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Rp(c[d>>2]|0)|0;l=b;return a|0}function Qd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Tp(c[d>>2]|0);l=b;return}function Rd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=wo(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function Sd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=Fd(Zo(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0)|0;l=g;return f|0}function Td(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=Fd(bp(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0)|0;l=g;return f|0}function Ud(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;Ro(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}function Vd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;So(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}function Wd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Fo(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function Xd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Lo(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function Yd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=xn(c[d>>2]|0)|0;l=b;return a|0}function Zd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;zn(c[d>>2]|0);l=b;return}function _d(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Fd(Wh(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0)|0;l=e;return d|0}function $d(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Jn(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function ae(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Kn(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function be(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=c[g>>2]|0;g=c[h>>2]|0;h=c[i>>2]|0;i=tn(e,g,h,rh(c[j>>2]|0,1)|0)|0;l=f;return i|0}function ce(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=c[g>>2]|0;g=c[h>>2]|0;h=c[i>>2]|0;$n(e,g,h,rh(c[j>>2]|0,1)|0);l=f;return}function de(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=lo(c[d>>2]|0)|0;l=b;return a|0}function ee(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=mo(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function fe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;po(c[e>>2]|0,c[f>>2]|0);l=d;return}function ge(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=Gp(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function he(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=Vp(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function ie(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;e=(ef()|0)!=0;d=c[h>>2]|0;if(e){c[g>>2]=Fd(wh(d,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0)|0)|0;n=c[g>>2]|0;l=f;return n|0}else{c[d>>2]=0;c[g>>2]=Fd(176)|0;n=c[g>>2]|0;l=f;return n|0}return 0}function je(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Bh(c[d>>2]|0);l=b;return}function ke(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(ef()|0){c[f>>2]=le(Jh(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0)|0;j=c[f>>2]|0;l=e;return j|0}else{c[f>>2]=Fd(176)|0;j=c[f>>2]|0;l=e;return j|0}return 0}function le(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=me(32,c[d>>2]|0)|0;l=b;return a|0}function me(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=Ed(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function ne(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(ef()|0){c[f>>2]=le(Lh(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0)|0;j=c[f>>2]|0;l=e;return j|0}else{c[f>>2]=Fd(176)|0;j=c[f>>2]|0;l=e;return j|0}return 0}function oe(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;n=g+4|0;o=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;if(ef()|0){c[h>>2]=Fd(Ch(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0)|0;p=c[h>>2]|0;l=g;return p|0}if(c[j>>2]|0)Uw(c[j>>2]|0,66,c[k>>2]|0)|0;c[h>>2]=Fd(176)|0;p=c[h>>2]|0;l=g;return p|0}function pe(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;n=g+4|0;o=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;if(ef()|0){c[h>>2]=Fd(Gh(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0)|0;p=c[h>>2]|0;l=g;return p|0}else{c[h>>2]=Fd(176)|0;p=c[h>>2]|0;l=g;return p|0}return 0}function qe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;d=(ef()|0)!=0;b=c[g>>2]|0;if(d){c[f>>2]=Fd(Wj(b,c[h>>2]|0,c[i>>2]|0)|0)|0;j=c[f>>2]|0;l=e;return j|0}else{c[b>>2]=0;c[f>>2]=Fd(176)|0;j=c[f>>2]|0;l=e;return j|0}return 0}function re(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(ef()|0){c[f>>2]=Fd(Xj(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0)|0;j=c[f>>2]|0;l=e;return j|0}else{c[f>>2]=Fd(176)|0;j=c[f>>2]|0;l=e;return j|0}return 0}function se(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;if(ef()|0){c[d>>2]=Fd(Yj(c[e>>2]|0)|0)|0;f=c[d>>2]|0;l=b;return f|0}else{c[d>>2]=Fd(176)|0;f=c[d>>2]|0;l=b;return f|0}return 0}function te(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;b=(ef()|0)!=0;a=c[f>>2]|0;if(b){c[e>>2]=Fd(Zj(a,c[g>>2]|0)|0)|0;h=c[e>>2]|0;l=d;return h|0}else{c[a>>2]=0;c[e>>2]=Fd(176)|0;h=c[e>>2]|0;l=d;return h|0}return 0}function ue(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;d=(ef()|0)!=0;b=c[g>>2]|0;if(d){c[f>>2]=Fd(Si(b,c[h>>2]|0,c[i>>2]|0)|0)|0;j=c[f>>2]|0;l=e;return j|0}else{c[b>>2]=0;c[f>>2]=Fd(176)|0;j=c[f>>2]|0;l=e;return j|0}return 0}function ve(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;_i(c[d>>2]|0);l=b;return}function we(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Zi(c[d>>2]|0);l=b;return}function xe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(!(ef()|0)){l=e;return}$i(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function ye(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=lj(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function ze(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(!(ef()|0))dh(21925,1175,21938,0,21958);hj(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}function Ae(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;if(ef()|0){c[d>>2]=nj(c[e>>2]|0)|0;f=c[d>>2]|0;l=b;return f|0}else{dh(21925,1198,21990,0,22007);c[d>>2]=0;f=c[d>>2]|0;l=b;return f|0}return 0}function Be(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=oj(c[d>>2]|0)|0;l=b;return a|0}function Ce(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(ef()|0){c[f>>2]=Fd(fj(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0)|0;j=c[f>>2]|0;l=e;return j|0}else{c[f>>2]=Fd(176)|0;j=c[f>>2]|0;l=e;return j|0}return 0}function De(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(!(ef()|0)){dh(21925,1287,22037,1,21958);Yg()}jn(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function Ee(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(ef()|0)){dh(21925,1340,22052,1,21958);Yg()}nn(c[e>>2]|0,c[f>>2]|0);l=d;return}function Fe(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;sh(c[d>>2]|0);l=b;return}function Ge(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;Gf(c[e>>2]|0,c[f>>2]|0);l=d;return}function He(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;Ke(c[e>>2]|0,c[f>>2]|0);l=d;return}function Ie(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;vf(c[d>>2]|0);l=b;return}function Je(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;if(c[17693]|0){c[d>>2]=yb[c[17693]&15](c[e>>2]|0)|0;f=c[d>>2]|0;l=b;return f|0}else{c[d>>2]=c[e>>2];f=c[d>>2]|0;l=b;return f|0}return 0}function Ke(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;c[17694]=c[f>>2];c[17695]=c[e>>2];l=d;return}function Le(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0))c[f>>2]=Bt(c[e>>2]|0)|0;if(c[17695]|0?(Wg()|0)==0:0)zb[c[17695]&7](c[17694]|0,c[e>>2]|0,c[f>>2]|0);dh(22070,86,22077,1,c[f>>2]|0);Me(22095);Me(c[f>>2]|0);Me(22526);Tg();Aa()}function Me(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;c[d>>2]=a;a=c[d>>2]|0;c[b>>2]=ew(2,a,hv(c[d>>2]|0)|0)|0;l=b;return}function Ne(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;c[17698]=c[d>>2];l=b;return}function Oe(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return (c[17698]|0)>=(c[d>>2]|0)|0}function Pe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;g=e+12|0;h=e+8|0;i=e+4|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(c[17696]|0)Eb[c[17696]&1](c[17697]|0,c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);else{switch(c[g>>2]|0){case 30:case 20:case 10:case 0:break;case 40:{Yv(22110,c[3977]|0)|0;break}case 50:{Yv(22118,c[3977]|0)|0;break}case 100:{Yv(22132,c[3977]|0)|0;break}default:{d=c[3977]|0;c[f>>2]=c[g>>2];Fv(d,22138,f)|0}}Uu(c[3977]|0,c[h>>2]|0,c[i>>2]|0)|0}if((c[g>>2]|0)==40|(c[g>>2]|0)==50){dh(22070,140,22163,1,22174);Tg();Aa()}else{l=e;return}}function Qe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;Pe(c[f>>2]|0,c[g>>2]|0,h);l=e;return}function Re(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;g=e+20|0;h=e+16|0;i=e+12|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;d=c[h>>2]|0;h=c[i>>2]|0;c[f>>2]=c[g>>2];c[f+4>>2]=d;c[f+8>>2]=h;Qe(50,22204,f);Aa()}function Se(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;h=f+28|0;i=f+24|0;j=f+20|0;k=f+16|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;e=c[i>>2]|0;i=c[j>>2]|0;j=c[k>>2]|0;c[g>>2]=c[h>>2];c[g+4>>2]=e;c[g+8>>2]=i;c[g+12>>2]=j;Qe(50,22234,g);Aa()}function Te(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;c[e>>2]=a;c[f>>2]=b;Pe(10,c[e>>2]|0,f);l=d;return}function Ue(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e;c[e+20>>2]=a;c[f>>2]=b;c[g>>2]=d;Pe(10,c[f>>2]|0,g);l=e;return 0}function Ve(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;c[e>>2]=a;c[f>>2]=b;Pe(30,c[e>>2]|0,f);l=d;return}function We(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;c[e>>2]=a;c[f>>2]=b;Pe(40,c[e>>2]|0,f);Aa()}function Xe(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;c[e>>2]=a;c[f>>2]=b;Pe(50,c[e>>2]|0,f);Aa()}function Ye(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;c[e>>2]=a;c[f>>2]=b;Pe(100,c[e>>2]|0,f);l=d;return}function Ze(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;c[e>>2]=a;if(!(c[e>>2]|0)){l=d;return}c[f>>2]=b;Pe(0,c[e>>2]|0,f);l=d;return}function _e(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;$e(c[f>>2]|0,22268,c[g>>2]|0,c[h>>2]|0);l=e;return}function $e(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;h=l;l=l+96|0;if((l|0)>=(m|0))$(96);i=h+56|0;j=h+40|0;k=h+32|0;n=h+24|0;o=h+16|0;p=h+8|0;q=h;r=h+84|0;s=h+80|0;t=h+76|0;u=h+72|0;v=h+68|0;w=h+64|0;x=h+60|0;c[r>>2]=b;c[s>>2]=e;c[t>>2]=f;c[u>>2]=g;c[v>>2]=0;c[w>>2]=0;if((c[r>>2]|0?a[c[r>>2]>>0]|0:0)?(c[v>>2]=1,g=c[s>>2]|0,c[q>>2]=c[r>>2],c[q+4>>2]=g,Ye(22270,q),(c[u>>2]|0?(a[(c[s>>2]|0)+1>>0]|0)==91:0)&(c[t>>2]|0)!=0):0){Ze(22526,p);c[s>>2]=22268;c[o>>2]=hv(c[r>>2]|0)|0;c[o+4>>2]=72319;Ye(22276,o)}a:do if(c[u>>2]|0){c[x>>2]=c[t>>2];while(1){o=c[u>>2]|0;c[u>>2]=o+-1;if(!o)break a;c[n>>2]=d[c[x>>2]>>0];Ze(22282,n);if(c[v>>2]|0?(o=(c[w>>2]|0)+1|0,c[w>>2]=o,(o|0)==32&(c[u>>2]|0)!=0):0){c[w>>2]=0;Ze(22287,k);o=hv(c[r>>2]|0)|0;p=hv(c[s>>2]|0)|0;c[j>>2]=o;c[j+4>>2]=72319;c[j+8>>2]=p;c[j+12>>2]=72319;Ye(22291,j)}c[x>>2]=(c[x>>2]|0)+1}}while(0);if(!(c[r>>2]|0)){l=h;return}Ze(22526,i);l=h;return}function af(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d;f=d+28|0;g=d+24|0;h=d+20|0;i=d+16|0;j=d+12|0;k=d+8|0;n=d+4|0;o=d+32|0;c[f>>2]=a;c[g>>2]=b;if(!(c[g>>2]|0)){$e(c[f>>2]|0?c[f>>2]|0:22268,22299,0,0);l=d;return}if(c[g>>2]|0?c[(c[g>>2]|0)+12>>2]&4|0:0){c[n>>2]=Gp(c[g>>2]|0,k)|0;c[e>>2]=c[k>>2];Su(o,30,22307,e)|0;$e(c[f>>2]|0?c[f>>2]|0:22268,o,c[n>>2]|0,(((c[k>>2]|0)+7|0)>>>0)/8|0);l=d;return}c[h>>2]=Vo(c[g>>2]|0,0,i,j)|0;if(!(c[h>>2]|0)){$e(c[f>>2]|0?c[f>>2]|0:22268,22317,0,0);l=d;return}g=c[f>>2]|0;f=c[j>>2]|0?22332:22334;if(c[i>>2]|0)$e(g,f,c[h>>2]|0,c[i>>2]|0);else $e(g,f,72319,1);vf(c[h>>2]|0);l=d;return}function bf(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+28|0;g=e+24|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+32|0;n=e;o=e+8|0;c[f>>2]=b;c[g>>2]=(((c[f>>2]|0)!=0^1)&1)+(c[f>>2]|0)+63&-64;f=c[g>>2]|0;c[h>>2]=Za()|0;g=f;b=l;l=l+((1*g|0)+15&-16)|0;if((l|0)>=(m|0))$((1*g|0)+15&-16|0);c[i>>2]=b;c[j>>2]=f;a[k>>0]=0;f=n;c[f>>2]=d[k>>0];c[f+4>>2]=0;while(1){if(!(c[i>>2]&7|0?(c[j>>2]|0)!=0:0))break;a[c[i>>2]>>0]=a[k>>0]|0;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+-1}if((c[j>>2]|0)>>>0>=8){f=n;b=gx(c[f>>2]|0,c[f+4>>2]|0,16843009,16843009)|0;f=n;c[f>>2]=b;c[f+4>>2]=D;do{c[o>>2]=c[i>>2];f=n;b=c[f+4>>2]|0;g=c[o>>2]|0;c[g>>2]=c[f>>2];c[g+4>>2]=b;c[j>>2]=(c[j>>2]|0)-8;c[i>>2]=(c[i>>2]|0)+8}while((c[j>>2]|0)>>>0>=8)}while(1){if(!(c[j>>2]|0))break;a[c[i>>2]>>0]=a[k>>0]|0;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+-1}Ea(c[h>>2]|0);l=e;return}function cf(){return}function df(){Ft(33);Le(Ct(c[(xu()|0)>>2]|0)|0,22336)}function ef(){if(!(c[17699]|0))ff();return fh()|0}function ff(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;c[b>>2]=0;if(c[17699]|0){l=a;return}c[17699]=1;Xm(0);Vg(c[17700]|0);rg();c[b>>2]=Nh()|0;if((((((c[b>>2]|0)==0?(c[b>>2]=vj()|0,(c[b>>2]|0)==0):0)?(c[b>>2]=_j()|0,(c[b>>2]|0)==0):0)?(c[b>>2]=wj()|0,(c[b>>2]|0)==0):0)?(c[b>>2]=Gg()|0,(c[b>>2]|0)==0):0)?(c[b>>2]=tp()|0,(c[b>>2]|0)==0):0){l=a;return}Re(22351,123,22360)}function gf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+36|0;f=d+32|0;g=d+28|0;h=d+24|0;i=d+20|0;j=d+16|0;k=d+12|0;n=d+8|0;o=d+4|0;p=d;c[f>>2]=b;c[g>>2]=22372;if((c[f>>2]|0?(a[c[f>>2]>>0]|0)==1:0)?(a[(c[f>>2]|0)+1>>0]|0)==1:0){c[e>>2]=Xp()|0;q=c[e>>2]|0;l=d;return q|0}ff();b=c[g>>2]|0;if(!(c[f>>2]|0)){c[e>>2]=b;q=c[e>>2]|0;l=d;return q|0}c[p>>2]=hf(b,h,i,j)|0;if(!(c[p>>2]|0)){c[e>>2]=0;q=c[e>>2]|0;l=d;return q|0}if(!(hf(c[f>>2]|0,k,n,o)|0)){c[e>>2]=0;q=c[e>>2]|0;l=d;return q|0}do if((c[h>>2]|0)<=(c[k>>2]|0)){if((c[h>>2]|0)==(c[k>>2]|0)?(c[i>>2]|0)>(c[n>>2]|0):0)break;if(((c[h>>2]|0)==(c[k>>2]|0)?(c[i>>2]|0)==(c[n>>2]|0):0)?(c[j>>2]|0)>(c[o>>2]|0):0)break;if(((c[h>>2]|0)==(c[k>>2]|0)?(c[i>>2]|0)==(c[n>>2]|0):0)?(c[j>>2]|0)==(c[o>>2]|0):0)break;c[e>>2]=0;q=c[e>>2]|0;l=d;return q|0}while(0);c[e>>2]=c[g>>2];q=c[e>>2]|0;l=d;return q|0}function hf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[i>>2]=jf(c[i>>2]|0,c[j>>2]|0)|0;if(c[i>>2]|0?(a[c[i>>2]>>0]|0)==46:0){c[i>>2]=(c[i>>2]|0)+1;c[i>>2]=jf(c[i>>2]|0,c[k>>2]|0)|0;if(c[i>>2]|0?(a[c[i>>2]>>0]|0)==46:0){c[i>>2]=(c[i>>2]|0)+1;c[i>>2]=jf(c[i>>2]|0,c[n>>2]|0)|0;if(c[i>>2]|0){c[h>>2]=c[i>>2];o=c[h>>2]|0;l=g;return o|0}else{c[h>>2]=0;o=c[h>>2]|0;l=g;return o|0}}c[h>>2]=0;o=c[h>>2]|0;l=g;return o|0}c[h>>2]=0;o=c[h>>2]|0;l=g;return o|0}function jf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;if((a[c[g>>2]>>0]|0)==48?Cw(a[(c[g>>2]|0)+1>>0]|0)|0:0){c[f>>2]=0;j=c[f>>2]|0;l=e;return j|0}while(1){d=(Cw(a[c[g>>2]>>0]|0)|0)!=0;k=c[i>>2]|0;if(!d)break;c[i>>2]=k*10;c[i>>2]=(c[i>>2]|0)+((a[c[g>>2]>>0]|0)-48);c[g>>2]=(c[g>>2]|0)+1}c[c[h>>2]>>2]=k;c[f>>2]=(c[i>>2]|0)<0?0:c[g>>2]|0;j=c[f>>2]|0;l=e;return j|0}function kf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;d=l;l=l+176|0;if((l|0)>=(m|0))$(176);e=d+168|0;f=d+164|0;g=d+160|0;h=d+156|0;i=d+152|0;j=d+148|0;k=d+144|0;n=d+140|0;o=d+136|0;p=d+132|0;q=d+128|0;r=d+124|0;s=d+120|0;t=d+116|0;u=d+112|0;v=d+108|0;w=d+104|0;x=d+100|0;y=d+96|0;z=d+92|0;A=d+88|0;B=d+84|0;C=d+80|0;D=d+76|0;E=d+72|0;F=d+68|0;G=d+64|0;H=d+60|0;I=d+56|0;J=d+52|0;K=d+48|0;L=d+44|0;M=d+40|0;N=d+36|0;O=d+32|0;P=d+28|0;Q=d+24|0;R=d+20|0;S=d+16|0;T=d+12|0;U=d+8|0;V=d+4|0;W=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=0;do switch(c[e>>2]|0){case 31:{tg();X=c[g>>2]|0;l=d;return X|0}case 44:{Xm(0);bn();X=c[g>>2]|0;l=d;return X|0}case 51:{if(!(en()|0)){X=c[g>>2]|0;l=d;return X|0}c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}case 13:{$m();X=c[g>>2]|0;l=d;return X|0}case 14:{Ug();X=c[g>>2]|0;l=d;return X|0}case 30:{ff();Cg(0);X=c[g>>2]|0;l=d;return X|0}case 37:{ff();c[17701]=1;X=c[g>>2]|0;l=d;return X|0}case 24:{ff();b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[h>>2]=Y;Cg(c[h>>2]|0);if(!((Bg()|0)&4)){X=c[g>>2]|0;l=d;return X|0}c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}case 25:{ff();Tg();X=c[g>>2]|0;l=d;return X|0}case 27:{Xm(0);zg(Bg()|0|1);X=c[g>>2]|0;l=d;return X|0}case 28:{Xm(0);zg(Bg()|0|2);X=c[g>>2]|0;l=d;return X|0}case 29:{Xm(0);zg((Bg()|0)&-3);X=c[g>>2]|0;l=d;return X|0}case 22:{ff();an();X=c[g>>2]|0;l=d;return X|0}case 45:{Xm(0);Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[i>>2]=b;kn(c[i>>2]|0);X=c[g>>2]|0;l=d;return X|0}case 46:{Xm(0);if(!(ef()|0)){X=c[g>>2]|0;l=d;return X|0}ln();X=c[g>>2]|0;l=d;return X|0}case 19:{Xm(0);b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[j>>2]=Y;Ne(c[j>>2]|0);X=c[g>>2]|0;l=d;return X|0}case 20:{Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[k>>2]=b;c[17702]=c[17702]|c[k>>2];X=c[g>>2]|0;l=d;return X|0}case 21:{b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[n>>2]=Y;c[17702]=c[17702]&~c[n>>2];X=c[g>>2]|0;l=d;return X|0}case 36:{ff();X=c[g>>2]|0;l=d;return X|0}case 40:{if(!(c[17699]|0)){X=c[g>>2]|0;l=d;return X|0}c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}case 39:{if(!(c[17703]|0)){X=c[g>>2]|0;l=d;return X|0}c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}case 38:{if(c[17703]|0){X=c[g>>2]|0;l=d;return X|0}ff();Ym(0);c[17703]=1;ef()|0;X=c[g>>2]|0;l=d;return X|0}case 47:{Xm(0);ff();X=c[g>>2]|0;l=d;return X|0}case 48:{Xm(0);Ym(1);if(!(ef()|0)){X=c[g>>2]|0;l=d;return X|0}mn();X=c[g>>2]|0;l=d;return X|0}case 52:{c[g>>2]=lf(60)|0;X=c[g>>2]|0;l=d;return X|0}case 49:{Xm(0);Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[o>>2]=b;cn(c[o>>2]|0);X=c[g>>2]|0;l=d;return X|0}case 50:{Xm(0);Ym(1);b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[p>>2]=Y;dn(((c[p>>2]|0)!=0^1^1)&1)|0;X=c[g>>2]|0;l=d;return X|0}case 70:{Zm();X=c[g>>2]|0;l=d;return X|0}case 53:{Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[r>>2]=b;c[q>>2]=c[r>>2];Xm(0);mf(c[q>>2]|0?28:27,c[q>>2]|0);X=c[g>>2]|0;l=d;return X|0}case 54:{Xm(0);if(!(oh()|0)){X=c[g>>2]|0;l=d;return X|0}c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}case 55:{if(!(Wg()|0)){X=c[g>>2]|0;l=d;return X|0}if((eh()|0)!=0|(c[17701]|0)!=0){X=c[g>>2]|0;l=d;return X|0}c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}case 56:{Xm(0);if(!(c[17699]|0)){c[17700]=1;X=c[g>>2]|0;l=d;return X|0}if(ph()|0)gh(1)|0;if(!(fh()|0)){X=c[g>>2]|0;l=d;return X|0}c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}case 57:{ff();c[g>>2]=gh(1)|0;X=c[g>>2]|0;l=d;return X|0}case 58:{b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[t>>2]=Y;c[s>>2]=c[t>>2];Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[v>>2]=b;c[u>>2]=c[v>>2];b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[x>>2]=Y;c[w>>2]=c[x>>2];Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[z>>2]=b;c[y>>2]=c[z>>2];b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[B>>2]=Y;c[A>>2]=c[B>>2];Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[D>>2]=b;c[C>>2]=c[D>>2];b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[F>>2]=Y;c[E>>2]=c[F>>2];Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[H>>2]=b;c[G>>2]=c[H>>2];if(ef()|0){c[g>>2]=pn(c[s>>2]|0,c[u>>2]|0,c[w>>2]|0,c[y>>2]|0,c[A>>2]|0,c[C>>2]|0,c[E>>2]|0,c[G>>2]|0)|0;X=c[g>>2]|0;l=d;return X|0}else{c[g>>2]=176;X=c[g>>2]|0;l=d;return X|0}break}case 59:{b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[J>>2]=Y;c[I>>2]=c[J>>2];Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[L>>2]=b;c[K>>2]=c[L>>2];b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[N>>2]=Y;c[M>>2]=c[N>>2];if(ef()|0){c[g>>2]=qn(c[I>>2]|0,c[K>>2]|0,c[M>>2]|0)|0;X=c[g>>2]|0;l=d;return X|0}else{c[g>>2]=176;X=c[g>>2]|0;l=d;return X|0}break}case 60:{Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[P>>2]=b;c[O>>2]=c[P>>2];rn(c[O>>2]|0);X=c[g>>2]|0;l=d;return X|0}case 61:{b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[Q>>2]=Y;c[g>>2]=nf(c[Q>>2]|0)|0;X=c[g>>2]|0;l=d;return X|0}case 63:{Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[S>>2]=b;c[R>>2]=c[S>>2];c[g>>2]=og(c[R>>2]|0)|0;X=c[g>>2]|0;l=d;return X|0}case 64:{if(c[17699]|0){c[g>>2]=1;X=c[g>>2]|0;l=d;return X|0}else{Xm(0);bh();X=c[g>>2]|0;l=d;return X|0}break}case 65:{b=c[f>>2]|0;a=(c[b>>2]|0)+(4-1)&~(4-1);Y=c[a>>2]|0;c[b>>2]=a+4;c[U>>2]=Y;c[T>>2]=c[U>>2];if((c[T>>2]|0)<=0){X=c[g>>2]|0;l=d;return X|0}Xm(c[T>>2]|0);X=c[g>>2]|0;l=d;return X|0}case 66:{Y=c[f>>2]|0;a=(c[Y>>2]|0)+(4-1)&~(4-1);b=c[a>>2]|0;c[Y>>2]=a+4;c[W>>2]=b;c[V>>2]=c[W>>2];if(!(c[V>>2]|0)){X=c[g>>2]|0;l=d;return X|0}b=_m(((c[17699]|0)!=0^1)&1)|0;c[c[V>>2]>>2]=b;X=c[g>>2]|0;l=d;return X|0}case 67:{Xm(0);zg(Bg()|0|8);X=c[g>>2]|0;l=d;return X|0}case 68:{Xm(0);zg(Bg()|0|16);X=c[g>>2]|0;l=d;return X|0}case 72:case 71:{c[g>>2]=69;X=c[g>>2]|0;l=d;return X|0}case 62:case 23:{X=c[g>>2]|0;l=d;return X|0}default:{Xm(0);c[g>>2]=61;X=c[g>>2]|0;l=d;return X|0}}while(0);return 0}function lf(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=of(1,c[d>>2]|0)|0;l=b;return a|0}function mf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;d=l;l=l+128|0;if((l|0)>=(m|0))$(128);e=d+88|0;f=d+80|0;g=d+72|0;h=d+64|0;i=d+48|0;j=d+24|0;k=d+16|0;n=d+8|0;o=d;p=d+116|0;q=d+112|0;r=d+108|0;s=d+104|0;t=d+100|0;u=d+96|0;c[p>>2]=a;c[q>>2]=b;b=c[p>>2]|0;a=c[q>>2]|0;c[o>>2]=22372;ub[b&63](a,22386,o)|0;o=c[p>>2]|0;a=c[q>>2]|0;c[n>>2]=22412;ub[o&63](a,22399,n)|0;n=c[p>>2]|0;a=c[q>>2]|0;c[k>>2]=22437;ub[n&63](a,22424,k)|0;k=c[p>>2]|0;a=c[q>>2]|0;c[j>>2]=22458;ub[k&63](a,22445,j)|0;ub[c[p>>2]&63](c[q>>2]|0,22472,d+32|0)|0;ub[c[p>>2]&63](c[q>>2]|0,22488,d+40|0)|0;j=c[p>>2]|0;a=c[q>>2]|0;c[i>>2]=sp()|0;ub[j&63](a,22500,i)|0;c[r>>2]=pg()|0;ub[c[p>>2]&63](c[q>>2]|0,22513,d+56|0)|0;c[t>>2]=0;while(1){i=qg(c[t>>2]|0,s)|0;c[u>>2]=i;if(!i)break;if(c[r>>2]&c[s>>2]|0){i=c[p>>2]|0;a=c[q>>2]|0;c[h>>2]=c[u>>2];ub[i&63](a,22522,h)|0}c[t>>2]=(c[t>>2]|0)+1}ub[c[p>>2]&63](c[q>>2]|0,22526,g)|0;g=c[p>>2]|0;h=c[q>>2]|0;s=(Wg()|0)!=0;r=(ah()|0)!=0;c[f>>2]=s?121:110;c[f+4>>2]=r?121:110;ub[g&63](h,22528,f)|0;c[t>>2]=_m(0)|0;switch(c[t>>2]|0){case 1:{c[u>>2]=22546;v=c[p>>2]|0;w=c[q>>2]|0;x=c[u>>2]|0;y=c[t>>2]|0;c[e>>2]=x;z=e+4|0;c[z>>2]=y;ub[v&63](w,22580,e)|0;l=d;return}case 2:{c[u>>2]=22555;v=c[p>>2]|0;w=c[q>>2]|0;x=c[u>>2]|0;y=c[t>>2]|0;c[e>>2]=x;z=e+4|0;c[z>>2]=y;ub[v&63](w,22580,e)|0;l=d;return}case 3:{c[u>>2]=22560;v=c[p>>2]|0;w=c[q>>2]|0;x=c[u>>2]|0;y=c[t>>2]|0;c[e>>2]=x;z=e+4|0;c[z>>2]=y;ub[v&63](w,22580,e)|0;l=d;return}default:Re(22351,321,22567)}}function nf(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=0;switch(c[d>>2]|0){case 30111:{c[e>>2]=Gt(1136)|0;break}case 30112:{c[e>>2]=Ht(1136)|0;break}case 30113:{c[e>>2]=It(1136)|0;break}case 30114:{c[e>>2]=Jt(1136)|0;break}default:c[e>>2]=61}l=b;return c[e>>2]|0}function of(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function pf(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=0;qf(c[d>>2]|0,0,e)|0;l=b;return c[e>>2]|0}function qf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;do if(c[g>>2]&1|0?!(rf()|0):0)if(c[17705]|0){c[j>>2]=yb[c[17705]&15](c[f>>2]|0)|0;break}else{c[j>>2]=vg(c[f>>2]|0)|0;break}else k=6;while(0);do if((k|0)==6)if(c[17704]|0){c[j>>2]=yb[c[17704]&15](c[f>>2]|0)|0;break}else{c[j>>2]=ug(c[f>>2]|0)|0;break}while(0);if(c[j>>2]|0){c[c[h>>2]>>2]=c[j>>2];n=c[i>>2]|0;l=e;return n|0}if(!(c[(xu()|0)>>2]|0))Ft(12);c[i>>2]=Ct(c[(xu()|0)>>2]|0)|0;n=c[i>>2]|0;l=e;return n|0}function rf(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;do if(c[17701]|0)if(ah()|0){c[17701]=0;c[b>>2]=0;break}else{c[b>>2]=c[17701];break}else c[b>>2]=0;while(0);l=a;return c[b>>2]|0}function sf(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=0;qf(c[d>>2]|0,1,e)|0;l=b;return c[e>>2]|0}function tf(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;do if(!(rf()|0))if(c[17706]|0){c[d>>2]=yb[c[17706]&15](c[e>>2]|0)|0;break}else{c[d>>2]=Sg(c[e>>2]|0)|0;break}else c[d>>2]=0;while(0);l=b;return c[d>>2]|0}function uf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;b=c[g>>2]|0;if(!(c[f>>2]|0)){c[e>>2]=pf(b)|0;i=c[e>>2]|0;l=d;return i|0}if(!b){vf(c[f>>2]|0);c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}if(c[17707]|0)c[h>>2]=Db[c[17707]&7](c[f>>2]|0,c[g>>2]|0)|0;else c[h>>2]=wg(c[f>>2]|0,c[g>>2]|0)|0;if((c[h>>2]|0)==0?(c[(xu()|0)>>2]|0)==0:0)Ft(12);c[e>>2]=c[h>>2];i=c[e>>2]|0;l=d;return i|0}function vf(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;if(!(c[d>>2]|0)){l=b;return}c[e>>2]=c[(xu()|0)>>2];if(c[17708]|0)wb[c[17708]&15](c[d>>2]|0);else yg(c[d>>2]|0);if(!(c[e>>2]|0)){l=b;return}Ft(c[e>>2]|0);l=b;return}function wf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=S(c[f>>2]|0,c[g>>2]|0)|0;if(c[g>>2]|0?(((c[h>>2]|0)>>>0)/((c[g>>2]|0)>>>0)|0|0)!=(c[f>>2]|0):0){Ft(12);c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}c[i>>2]=pf(c[h>>2]|0)|0;if(c[i>>2]|0)Uw(c[i>>2]|0,0,c[h>>2]|0)|0;c[e>>2]=c[i>>2];j=c[e>>2]|0;l=d;return j|0}function xf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=S(c[f>>2]|0,c[g>>2]|0)|0;if(c[g>>2]|0?(((c[h>>2]|0)>>>0)/((c[g>>2]|0)>>>0)|0|0)!=(c[f>>2]|0):0){Ft(12);c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}c[i>>2]=sf(c[h>>2]|0)|0;if(c[i>>2]|0)Uw(c[i>>2]|0,0,c[h>>2]|0)|0;c[e>>2]=c[i>>2];j=c[e>>2]|0;l=d;return j|0}function yf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=0;c[f>>2]=0;c[f>>2]=hv(c[d>>2]|0)|0;a=(tf(c[d>>2]|0)|0)!=0;g=(c[f>>2]|0)+1|0;if(a)c[e>>2]=sf(g)|0;else c[e>>2]=pf(g)|0;if(!(c[e>>2]|0)){h=c[e>>2]|0;l=b;return h|0}tv(c[e>>2]|0,c[d>>2]|0)|0;h=c[e>>2]|0;l=b;return h|0}function zf(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;while(1){a=pf(c[d>>2]|0)|0;c[e>>2]=a;if(!((a|0)!=0^1)){f=6;break}a=(Wg()|0)==0;if(!(a&(c[17709]|0)!=0)){f=5;break}if(!(ub[c[17709]&63](c[17710]|0,c[d>>2]|0,0)|0)){f=5;break}}if((f|0)==5)Le(Ct(c[(xu()|0)>>2]|0)|0,0);else if((f|0)==6){l=b;return c[e>>2]|0}return 0}function Af(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;while(1){b=uf(c[e>>2]|0,c[f>>2]|0)|0;c[g>>2]=b;if(!((b|0)!=0^1)){h=6;break}b=(Wg()|0)==0;if(!(b&(c[17709]|0)!=0)){h=5;break}b=c[17709]|0;a=c[17710]|0;i=c[f>>2]|0;j=(tf(c[e>>2]|0)|0)!=0;if(!(ub[b&63](a,i,j?3:2)|0)){h=5;break}}if((h|0)==5)Le(Ct(c[(xu()|0)>>2]|0)|0,0);else if((h|0)==6){l=d;return c[g>>2]|0}return 0}function Bf(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;while(1){a=sf(c[d>>2]|0)|0;c[e>>2]=a;if(!((a|0)!=0^1)){f=6;break}a=(Wg()|0)==0;if(!(a&(c[17709]|0)!=0)){f=5;break}if(!(ub[c[17709]&63](c[17710]|0,c[d>>2]|0,1)|0)){f=5;break}}if((f|0)==5){d=Ct(c[(xu()|0)>>2]|0)|0;Le(d,Je(22597)|0)}else if((f|0)==6){l=b;return c[e>>2]|0}return 0}function Cf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=S(c[e>>2]|0,c[f>>2]|0)|0;if(c[f>>2]|0?(((c[g>>2]|0)>>>0)/((c[f>>2]|0)>>>0)|0|0)!=(c[e>>2]|0):0){Ft(12);Le(Ct(c[(xu()|0)>>2]|0)|0,0)}c[h>>2]=zf(c[g>>2]|0)|0;Uw(c[h>>2]|0,0,c[g>>2]|0)|0;l=d;return c[h>>2]|0}function Df(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=S(c[e>>2]|0,c[f>>2]|0)|0;if(c[f>>2]|0?(((c[g>>2]|0)>>>0)/((c[f>>2]|0)>>>0)|0|0)!=(c[e>>2]|0):0){Ft(12);Le(Ct(c[(xu()|0)>>2]|0)|0,0)}c[h>>2]=Bf(c[g>>2]|0)|0;Uw(c[h>>2]|0,0,c[g>>2]|0)|0;l=d;return c[h>>2]|0}function Ef(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;do{a=yf(c[d>>2]|0)|0;c[e>>2]=a;if(!((a|0)!=0^1)){h=8;break}c[f>>2]=hv(c[d>>2]|0)|0;c[g>>2]=((tf(c[d>>2]|0)|0)!=0^1^1)&1;a=(Wg()|0)==0;if(!(a&(c[17709]|0)!=0))break}while((ub[c[17709]&63](c[17710]|0,c[f>>2]|0,c[g>>2]|0)|0)!=0);if((h|0)==8){l=b;return c[e>>2]|0}e=Ct(c[(xu()|0)>>2]|0)|0;if(!(c[g>>2]|0)){i=0;Le(e,i)}i=Je(22597)|0;Le(e,i);return 0}function Ff(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;if(Wg()|0)c[d>>2]=0;else c[d>>2]=c[17702]&c[e>>2];l=b;return c[d>>2]|0}function Gf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;xj(c[e>>2]|0,c[f>>2]|0);Vm(c[e>>2]|0,c[f>>2]|0);l=d;return}function Hf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g;i=g+32|0;j=g+28|0;k=g+24|0;n=g+20|0;o=g+16|0;p=g+12|0;q=g+8|0;r=g+4|0;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;if(!(c[j>>2]|0)){c[i>>2]=45;s=c[i>>2]|0;l=g;return s|0}c[c[j>>2]>>2]=0;if(!((((c[o>>2]|0)<0|(c[o>>2]|0)>1)^1)&(c[k>>2]|0)!=0)){c[i>>2]=45;s=c[i>>2]|0;l=g;return s|0}if((c[n>>2]|0)!=0|(c[o>>2]|0)!=0){if((c[n>>2]|0)==0&(c[o>>2]|0)!=0)c[n>>2]=hv(c[k>>2]|0)|0}else{c[n>>2]=If(c[k>>2]|0,0,0,q)|0;if(!(c[n>>2]|0)){c[i>>2]=c[q>>2];s=c[i>>2]|0;l=g;return s|0}}c[q>>2]=Jf(r,0,c[k>>2]|0,c[n>>2]|0,0,0,h)|0;if(c[q>>2]|0){c[i>>2]=c[q>>2];s=c[i>>2]|0;l=g;return s|0}c[c[j>>2]>>2]=c[r>>2];if(c[p>>2]|0)wb[c[p>>2]&15](c[k>>2]|0);c[i>>2]=0;s=c[i>>2]|0;l=g;return s|0}function If(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+44|0;i=g+40|0;j=g+36|0;k=g+32|0;n=g+28|0;o=g+24|0;p=g+20|0;q=g+16|0;r=g+4|0;s=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[p>>2]=0;c[q>>2]=0;c[r>>2]=0;c[s>>2]=0;if(!(c[k>>2]|0))c[k>>2]=g+12;if(!(c[n>>2]|0))c[n>>2]=g+8;c[c[n>>2]>>2]=0;c[c[k>>2]>>2]=0;if(!(c[i>>2]|0)){c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}if((d[c[i>>2]>>0]|0|0)!=40){c[c[n>>2]>>2]=204;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}c[o>>2]=c[i>>2];a:while(1){if(c[j>>2]|0?(c[r>>2]|0)>>>0>=(c[j>>2]|0)>>>0:0){u=12;break}i=d[c[o>>2]>>0]|0;do if(c[q>>2]|0)if((i|0)==58){if(c[j>>2]|0?((c[r>>2]|0)+(c[q>>2]|0)|0)>>>0>=(c[j>>2]|0)>>>0:0){u=17;break a}c[r>>2]=(c[r>>2]|0)+(c[q>>2]|0);c[o>>2]=(c[o>>2]|0)+(c[q>>2]|0);c[q>>2]=0;break}else{if((d[c[o>>2]>>0]|0|0)<48){u=22;break a}if((d[c[o>>2]>>0]|0|0)>57){u=22;break a}c[q>>2]=((c[q>>2]|0)*10|0)+((d[c[o>>2]>>0]|0)-48);break}else{if((i|0)==40){if(c[p>>2]|0){u=25;break a}c[s>>2]=(c[s>>2]|0)+1;break}if((d[c[o>>2]>>0]|0|0)==41){if(!(c[s>>2]|0)){u=29;break a}if(c[p>>2]|0){u=31;break a}f=(c[s>>2]|0)+-1|0;c[s>>2]=f;if(f|0)break;else{u=33;break a}}if((d[c[o>>2]>>0]|0|0)==91){if(c[p>>2]|0){u=36;break a}c[p>>2]=c[o>>2];break}if((d[c[o>>2]>>0]|0|0)==93){if(!(c[p>>2]|0)){u=40;break a}c[p>>2]=0;break}if((d[c[o>>2]>>0]|0|0)<48){u=47;break a}if((d[c[o>>2]>>0]|0|0)>57){u=47;break a}if((d[c[o>>2]>>0]|0|0)==48){u=45;break a}c[q>>2]=(d[c[o>>2]>>0]|0)-48}while(0);c[o>>2]=(c[o>>2]|0)+1;c[r>>2]=(c[r>>2]|0)+1}switch(u|0){case 12:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=202;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 17:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=202;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 22:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=201;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 25:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=209;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 29:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=203;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 31:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=209;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 33:{u=(c[r>>2]|0)+1|0;c[r>>2]=u;c[h>>2]=u;t=c[h>>2]|0;l=g;return t|0}case 36:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=208;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 40:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=209;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 45:{c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=207;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}case 47:{if((d[c[o>>2]>>0]|0|0)!=38?(d[c[o>>2]>>0]|0|0)!=92:0){c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=205;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}c[c[k>>2]>>2]=c[r>>2];c[c[n>>2]>>2]=210;c[h>>2]=0;t=c[h>>2]|0;l=g;return t|0}}return 0}function Jf(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);j=i+40|0;k=i+36|0;n=i+32|0;o=i+28|0;p=i+24|0;q=i+20|0;r=i+16|0;s=i;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[s>>2]=h;c[r>>2]=Kf(c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0,s)|0;l=i;return c[r>>2]|0}function Kf(e,f,g,h,i,j,k){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0;n=l;l=l+432|0;if((l|0)>=(m|0))$(432);o=n+16|0;p=n+8|0;q=n+320|0;r=n+316|0;s=n+312|0;t=n+308|0;u=n+304|0;v=n+300|0;w=n+296|0;x=n+292|0;y=n+288|0;z=n+284|0;A=n+280|0;B=n+276|0;C=n+272|0;E=n+268|0;F=n+264|0;G=n+260|0;H=n+256|0;I=n+252|0;J=n+248|0;K=n+244|0;L=n+240|0;M=n+224|0;N=n+220|0;O=n+216|0;P=n+212|0;Q=n+344|0;R=n+208|0;S=n+204|0;T=n+200|0;U=n+342|0;V=n+340|0;W=n+196|0;X=n+338|0;Y=n+192|0;Z=n+188|0;_=n+336|0;aa=n+184|0;ba=n+180|0;ca=n+176|0;da=n+172|0;ea=n+168|0;fa=n+164|0;ga=n+160|0;ha=n+156|0;ia=n+152|0;ja=n+334|0;ka=n+148|0;la=n+144|0;ma=n+140|0;na=n+332|0;oa=n+136|0;pa=n+132|0;qa=n+128|0;ra=n+124|0;sa=n+330|0;ta=n+120|0;ua=n+116|0;va=n+112|0;wa=n+108|0;xa=n+104|0;ya=n+100|0;za=n+96|0;Aa=n+328|0;Ba=n+92|0;Ca=n+88|0;Da=n+382|0;Ea=n+84|0;Fa=n+80|0;Ga=n+326|0;Ha=n+76|0;Ia=n+72|0;Ja=n+347|0;Ka=n+68|0;La=n+64|0;Ma=n+324|0;Na=n+60|0;Oa=n+56|0;Pa=n+52|0;Qa=n+48|0;Ra=n+44|0;Sa=n+40|0;Ta=n+36|0;Ua=n+32|0;Va=n+28|0;Wa=n+24|0;Xa=n+346|0;Ya=n;Za=n+20|0;c[r>>2]=e;c[s>>2]=f;c[t>>2]=g;c[u>>2]=h;c[v>>2]=i;c[w>>2]=j;c[x>>2]=k;c[y>>2]=0;c[B>>2]=0;c[C>>2]=0;c[E>>2]=0;c[F>>2]=0;c[G>>2]=0;c[H>>2]=0;c[I>>2]=0;c[J>>2]=0;c[K>>2]=0;c[L>>2]=0;c[N>>2]=0;c[O>>2]=0;if(!(c[r>>2]|0)){c[q>>2]=45;_a=c[q>>2]|0;l=n;return _a|0}c[c[r>>2]>>2]=0;if(!(c[t>>2]|0)){c[q>>2]=45;_a=c[q>>2]|0;l=n;return _a|0}if(!(c[s>>2]|0))c[s>>2]=n+236;c[M+4>>2]=(c[u>>2]|0)+2;if(c[u>>2]|0?tf(c[t>>2]|0)|0:0)c[M>>2]=sf(1+(c[M+4>>2]|0)-1|0)|0;else c[M>>2]=pf(1+(c[M+4>>2]|0)-1|0)|0;a:do if(c[M>>2]|0){c[M+8>>2]=c[M>>2];c[z>>2]=c[t>>2];c[A>>2]=c[u>>2];b:while(1){if(!(c[A>>2]|0)){$a=220;break}if(!((c[E>>2]|0)==0|(c[F>>2]|0)!=0)){if(!(Vv(22633,a[c[z>>2]>>0]|0)|0)){c[L>>2]=(c[z>>2]|0)-(c[E>>2]|0);c[P>>2]=Lf(M,c[L>>2]|0)|0;if(c[P>>2]|0){$a=18;break}k=M+8|0;j=c[k>>2]|0;c[k>>2]=j+1;a[j>>0]=1;b[Q>>1]=c[L>>2];j=c[M+8>>2]|0;a[j>>0]=a[Q>>0]|0;a[j+1>>0]=a[Q+1>>0]|0;j=M+8|0;c[j>>2]=(c[j>>2]|0)+2;_w(c[M+8>>2]|0,c[E>>2]|0,c[L>>2]|0)|0;j=M+8|0;c[j>>2]=(c[j>>2]|0)+(c[L>>2]|0);c[E>>2]=0;$a=20}}else $a=20;c:do if(($a|0)==20){$a=0;if(c[C>>2]|0){j=a[c[z>>2]>>0]|0;if(!(c[K>>2]|0)){if((j|0)==92){c[K>>2]=1;break}if((a[c[z>>2]>>0]|0)!=34)break;c[C>>2]=(c[C>>2]|0)+1;c[T>>2]=Lf(M,(c[z>>2]|0)-(c[C>>2]|0)|0)|0;if(c[T>>2]|0){$a=59;break b}k=M+8|0;i=c[k>>2]|0;c[k>>2]=i+1;a[i>>0]=1;c[R>>2]=c[M+8>>2];b[U>>1]=0;i=c[M+8>>2]|0;a[i>>0]=a[U>>0]|0;a[i+1>>0]=a[U+1>>0]|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+2;c[S>>2]=Mf(c[C>>2]|0,(c[z>>2]|0)-(c[C>>2]|0)|0,c[M+8>>2]|0)|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+(c[S>>2]|0);b[V>>1]=c[S>>2];i=c[R>>2]|0;a[i>>0]=a[V>>0]|0;a[i+1>>0]=a[V+1>>0]|0;c[R>>2]=(c[R>>2]|0)+2;c[C>>2]=0;break}switch(j|0){case 92:case 39:case 34:case 114:case 102:case 110:case 118:case 116:case 98:{c[K>>2]=0;break c;break}case 55:case 54:case 53:case 52:case 51:case 50:case 49:case 48:{if((c[A>>2]|0)>>>0<=2){$a=29;break b}if((a[(c[z>>2]|0)+1>>0]|0)<48){$a=29;break b}if((a[(c[z>>2]|0)+1>>0]|0)>55){$a=29;break b}if((a[(c[z>>2]|0)+2>>0]|0)<48){$a=29;break b}if((a[(c[z>>2]|0)+2>>0]|0)>55){$a=29;break b}c[z>>2]=(c[z>>2]|0)+2;c[A>>2]=(c[A>>2]|0)-2;c[K>>2]=0;break c;break}case 120:{if((c[A>>2]|0)>>>0<=2){$a=44;break b}if(!((a[(c[z>>2]|0)+1>>0]|0)>=48?(a[(c[z>>2]|0)+1>>0]|0)<=57:0))$a=34;do if(($a|0)==34){$a=0;if((a[(c[z>>2]|0)+1>>0]|0)>=65?(a[(c[z>>2]|0)+1>>0]|0)<=70:0)break;if((a[(c[z>>2]|0)+1>>0]|0)<97){$a=44;break b}if((a[(c[z>>2]|0)+1>>0]|0)>102){$a=44;break b}}while(0);if(!((a[(c[z>>2]|0)+2>>0]|0)>=48?(a[(c[z>>2]|0)+2>>0]|0)<=57:0))$a=40;do if(($a|0)==40){$a=0;if((a[(c[z>>2]|0)+2>>0]|0)>=65?(a[(c[z>>2]|0)+2>>0]|0)<=70:0)break;if((a[(c[z>>2]|0)+2>>0]|0)<97){$a=44;break b}if((a[(c[z>>2]|0)+2>>0]|0)>102){$a=44;break b}}while(0);c[z>>2]=(c[z>>2]|0)+2;c[A>>2]=(c[A>>2]|0)-2;c[K>>2]=0;break c;break}case 13:{if(c[A>>2]|0?(a[(c[z>>2]|0)+1>>0]|0)==10:0){c[z>>2]=(c[z>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+-1}c[K>>2]=0;break c;break}case 10:{if(c[A>>2]|0?(a[(c[z>>2]|0)+1>>0]|0)==13:0){c[z>>2]=(c[z>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+-1}c[K>>2]=0;break c;break}default:{$a=54;break b}}}if(c[F>>2]|0){if(Ru(a[c[z>>2]>>0]|0)|0){c[J>>2]=(c[J>>2]|0)+1;break}if((a[c[z>>2]>>0]|0)!=35)if(Nf(c[z>>2]|0)|0)break;else{$a=82;break b}if(c[J>>2]&1|0){$a=66;break b}c[L>>2]=(c[J>>2]|0)/2|0;c[W>>2]=Lf(M,c[L>>2]|0)|0;if(c[W>>2]|0){$a=68;break b}j=M+8|0;i=c[j>>2]|0;c[j>>2]=i+1;a[i>>0]=1;b[X>>1]=c[L>>2];i=c[M+8>>2]|0;a[i>>0]=a[X>>0]|0;a[i+1>>0]=a[X+1>>0]|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+2;c[F>>2]=(c[F>>2]|0)+1;while(1){if((c[F>>2]|0)>>>0>=(c[z>>2]|0)>>>0)break;if(!(Nf(c[F>>2]|0)|0)){c[Y>>2]=Of(d[c[F>>2]>>0]|0)|0;c[F>>2]=(c[F>>2]|0)+1;while(1){if((c[F>>2]|0)>>>0>=(c[z>>2]|0)>>>0)break;if(!(Nf(c[F>>2]|0)|0))break;c[F>>2]=(c[F>>2]|0)+1}if((c[F>>2]|0)>>>0<(c[z>>2]|0)>>>0){c[Y>>2]=c[Y>>2]<<4;i=Of(d[c[F>>2]>>0]|0)|0;c[Y>>2]=(c[Y>>2]|0)+i}i=c[Y>>2]&255;j=M+8|0;k=c[j>>2]|0;c[j>>2]=k+1;a[k>>0]=i}c[F>>2]=(c[F>>2]|0)+1}c[F>>2]=0;break}if(c[G>>2]|0){if((a[c[z>>2]>>0]|0)!=124)break;c[G>>2]=0;break}if(c[B>>2]|0){if((a[c[z>>2]>>0]|0)>=48?(a[c[z>>2]>>0]|0)<=57:0)break;if((a[c[z>>2]>>0]|0)==58){c[L>>2]=Aw(c[B>>2]|0)|0;c[B>>2]=0;if((c[L>>2]|0)>>>0>((c[A>>2]|0)-1|0)>>>0){$a=91;break b}c[Z>>2]=Lf(M,c[L>>2]|0)|0;if(c[Z>>2]|0){$a=93;break b}i=M+8|0;k=c[i>>2]|0;c[i>>2]=k+1;a[k>>0]=1;b[_>>1]=c[L>>2];k=c[M+8>>2]|0;a[k>>0]=a[_>>0]|0;a[k+1>>0]=a[_+1>>0]|0;k=M+8|0;c[k>>2]=(c[k>>2]|0)+2;_w(c[M+8>>2]|0,(c[z>>2]|0)+1|0,c[L>>2]|0)|0;k=M+8|0;c[k>>2]=(c[k>>2]|0)+(c[L>>2]|0);c[A>>2]=(c[A>>2]|0)-(c[L>>2]|0);c[z>>2]=(c[z>>2]|0)+(c[L>>2]|0);break}if((a[c[z>>2]>>0]|0)==34){c[B>>2]=0;c[C>>2]=c[z>>2];c[K>>2]=0;break}if((a[c[z>>2]>>0]|0)==35){c[B>>2]=0;c[F>>2]=c[z>>2];c[J>>2]=0;break}if((a[c[z>>2]>>0]|0)!=124){$a=101;break b}c[B>>2]=0;c[G>>2]=c[z>>2];break}k=a[c[z>>2]>>0]|0;if(!(c[I>>2]|0)){if((k|0)==40){if(c[H>>2]|0){$a=179;break b}c[Sa>>2]=Lf(M,0)|0;if(c[Sa>>2]|0){$a=181;break b}i=M+8|0;j=c[i>>2]|0;c[i>>2]=j+1;a[j>>0]=3;c[O>>2]=(c[O>>2]|0)+1;break}if((a[c[z>>2]>>0]|0)==41){if(c[H>>2]|0){$a=185;break b}c[Ta>>2]=Lf(M,0)|0;if(c[Ta>>2]|0){$a=187;break b}j=M+8|0;i=c[j>>2]|0;c[j>>2]=i+1;a[i>>0]=4;c[O>>2]=(c[O>>2]|0)+-1;break}i=c[z>>2]|0;if((a[c[z>>2]>>0]|0)==34){c[C>>2]=i;c[K>>2]=0;break}j=c[z>>2]|0;if((a[i>>0]|0)==35){c[F>>2]=j;c[J>>2]=0;break}i=c[z>>2]|0;if((a[j>>0]|0)==124){c[G>>2]=i;break}if((a[i>>0]|0)==91){ab=c[z>>2]|0;if(c[H>>2]|0){$a=197;break b}c[H>>2]=ab;break}if((a[c[z>>2]>>0]|0)==93){if(!(c[H>>2]|0)){$a=201;break b}c[H>>2]=0;break}do if((a[c[z>>2]>>0]|0)>=48){if((a[c[z>>2]>>0]|0)>57)break;bb=c[z>>2]|0;if((a[c[z>>2]>>0]|0)==48){$a=206;break b}c[B>>2]=bb;break c}while(0);i=(Vv(22633,a[c[z>>2]>>0]|0)|0)!=0;j=c[z>>2]|0;if(i){c[E>>2]=j;break}if(Nf(j)|0)break;cb=c[z>>2]|0;if((a[c[z>>2]>>0]|0)==123){$a=212;break b}if(Vv(22732,a[cb>>0]|0)|0){$a=214;break b}if(!(c[v>>2]|0)){$a=218;break b}if((a[c[z>>2]>>0]|0)!=37){$a=218;break b}c[I>>2]=c[z>>2];break}do if((k|0)!=109?(a[c[z>>2]>>0]|0)!=77:0){if((a[c[z>>2]>>0]|0)==115){if(c[w>>2]|0){j=c[N>>2]|0;c[N>>2]=j+1;c[oa>>2]=c[c[(c[w>>2]|0)+(j<<2)>>2]>>2]}else{j=c[x>>2]|0;i=(c[j>>2]|0)+(4-1)&~(4-1);h=c[i>>2]|0;c[j>>2]=i+4;c[qa>>2]=h;c[oa>>2]=c[qa>>2]}c[pa>>2]=hv(c[oa>>2]|0)|0;c[ra>>2]=Lf(M,c[pa>>2]|0)|0;if(c[ra>>2]|0){$a=135;break b}h=M+8|0;i=c[h>>2]|0;c[h>>2]=i+1;a[i>>0]=1;b[sa>>1]=c[pa>>2];i=c[M+8>>2]|0;a[i>>0]=a[sa>>0]|0;a[i+1>>0]=a[sa+1>>0]|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+2;_w(c[M+8>>2]|0,c[oa>>2]|0,c[pa>>2]|0)|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+(c[pa>>2]|0);break}if((a[c[z>>2]>>0]|0)==98){if(c[w>>2]|0){i=c[N>>2]|0;c[N>>2]=i+1;c[ua>>2]=c[c[(c[w>>2]|0)+(i<<2)>>2]>>2]}else{i=c[x>>2]|0;h=(c[i>>2]|0)+(4-1)&~(4-1);j=c[h>>2]|0;c[i>>2]=h+4;c[va>>2]=j;c[ua>>2]=c[va>>2]}if(c[w>>2]|0){j=c[N>>2]|0;c[N>>2]=j+1;c[ta>>2]=c[c[(c[w>>2]|0)+(j<<2)>>2]>>2]}else{j=c[x>>2]|0;h=(c[j>>2]|0)+(4-1)&~(4-1);i=c[h>>2]|0;c[j>>2]=h+4;c[wa>>2]=i;c[ta>>2]=c[wa>>2]}c[xa>>2]=Lf(M,c[ua>>2]|0)|0;if(c[xa>>2]|0){$a=145;break b}do if(c[ua>>2]|0){if(tf(c[M>>2]|0)|0)break;if(!(tf(c[ta>>2]|0)|0))break;c[ya>>2]=sf(1+(c[M+4>>2]|0)-1|0)|0;if(!(c[ya>>2]|0)){$a=150;break b}c[za>>2]=c[ya>>2];_w(c[za>>2]|0,c[M>>2]|0,(c[M+8>>2]|0)-(c[M>>2]|0)|0)|0;c[M+8>>2]=(c[za>>2]|0)+((c[M+8>>2]|0)-(c[M>>2]|0));vf(c[M>>2]|0);c[M>>2]=c[ya>>2]}while(0);i=M+8|0;h=c[i>>2]|0;c[i>>2]=h+1;a[h>>0]=1;b[Aa>>1]=c[ua>>2];h=c[M+8>>2]|0;a[h>>0]=a[Aa>>0]|0;a[h+1>>0]=a[Aa+1>>0]|0;h=M+8|0;c[h>>2]=(c[h>>2]|0)+2;_w(c[M+8>>2]|0,c[ta>>2]|0,c[ua>>2]|0)|0;h=M+8|0;c[h>>2]=(c[h>>2]|0)+(c[ua>>2]|0);break}if((a[c[z>>2]>>0]|0)==100){if(c[w>>2]|0){h=c[N>>2]|0;c[N>>2]=h+1;c[Ba>>2]=c[c[(c[w>>2]|0)+(h<<2)>>2]>>2]}else{h=c[x>>2]|0;i=(c[h>>2]|0)+(4-1)&~(4-1);j=c[i>>2]|0;c[h>>2]=i+4;c[Ea>>2]=j;c[Ba>>2]=c[Ea>>2]}c[p>>2]=c[Ba>>2];Dv(Da,22726,p)|0;c[Ca>>2]=hv(Da)|0;c[Fa>>2]=Lf(M,c[Ca>>2]|0)|0;if(c[Fa>>2]|0){$a=158;break b}j=M+8|0;i=c[j>>2]|0;c[j>>2]=i+1;a[i>>0]=1;b[Ga>>1]=c[Ca>>2];i=c[M+8>>2]|0;a[i>>0]=a[Ga>>0]|0;a[i+1>>0]=a[Ga+1>>0]|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+2;_w(c[M+8>>2]|0,Da|0,c[Ca>>2]|0)|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+(c[Ca>>2]|0);break}if((a[c[z>>2]>>0]|0)==117){if(c[w>>2]|0){i=c[N>>2]|0;c[N>>2]=i+1;c[Ha>>2]=c[c[(c[w>>2]|0)+(i<<2)>>2]>>2]}else{i=c[x>>2]|0;j=(c[i>>2]|0)+(4-1)&~(4-1);h=c[j>>2]|0;c[i>>2]=j+4;c[Ka>>2]=h;c[Ha>>2]=c[Ka>>2]}c[o>>2]=c[Ha>>2];Dv(Ja,22729,o)|0;c[Ia>>2]=hv(Ja)|0;c[La>>2]=Lf(M,c[Ia>>2]|0)|0;if(c[La>>2]|0){$a=165;break b}h=M+8|0;j=c[h>>2]|0;c[h>>2]=j+1;a[j>>0]=1;b[Ma>>1]=c[Ia>>2];j=c[M+8>>2]|0;a[j>>0]=a[Ma>>0]|0;a[j+1>>0]=a[Ma+1>>0]|0;j=M+8|0;c[j>>2]=(c[j>>2]|0)+2;_w(c[M+8>>2]|0,Ja|0,c[Ia>>2]|0)|0;j=M+8|0;c[j>>2]=(c[j>>2]|0)+(c[Ia>>2]|0);break}if((a[c[z>>2]>>0]|0)!=83){$a=175;break b}if(c[w>>2]|0){j=c[N>>2]|0;c[N>>2]=j+1;c[Na>>2]=c[c[(c[w>>2]|0)+(j<<2)>>2]>>2]}else{j=c[x>>2]|0;h=(c[j>>2]|0)+(4-1)&~(4-1);i=c[h>>2]|0;c[j>>2]=h+4;c[Qa>>2]=i;c[Na>>2]=c[Qa>>2]}c[Oa>>2]=Pf(c[Na>>2]|0,Pa)|0;if(!(c[Oa>>2]|0))break;c[Ra>>2]=Lf(M,c[Oa>>2]|0)|0;if(c[Ra>>2]|0){$a=173;break b}_w(c[M+8>>2]|0,(c[Na>>2]|0)+(c[Pa>>2]|0)|0,c[Oa>>2]|0)|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+(c[Oa>>2]|0)}else $a=105;while(0);do if(($a|0)==105){$a=0;c[ba>>2]=0;c[ca>>2]=(a[c[z>>2]>>0]|0)==109?1:5;if(c[w>>2]|0){k=c[N>>2]|0;c[N>>2]=k+1;c[aa>>2]=c[c[(c[w>>2]|0)+(k<<2)>>2]>>2]}else{k=c[x>>2]|0;i=(c[k>>2]|0)+(4-1)&~(4-1);h=c[i>>2]|0;c[k>>2]=i+4;c[da>>2]=h;c[aa>>2]=c[da>>2]}if(Vp(c[aa>>2]|0,2)|0){c[ea>>2]=Gp(c[aa>>2]|0,fa)|0;c[ba>>2]=(((c[fa>>2]|0)+7|0)>>>0)/8|0;if(!((c[ea>>2]|0)!=0&(c[ba>>2]|0)!=0))break;c[ga>>2]=Lf(M,c[ba>>2]|0)|0;if(c[ga>>2]|0){$a=111;break b}do if(!(tf(c[M>>2]|0)|0)){if(!(Vp(c[aa>>2]|0,1)|0))break;c[ha>>2]=sf(1+(c[M+4>>2]|0)-1|0)|0;if(!(c[ha>>2]|0)){$a=115;break b}c[ia>>2]=c[ha>>2];_w(c[ia>>2]|0,c[M>>2]|0,(c[M+8>>2]|0)-(c[M>>2]|0)|0)|0;c[M+8>>2]=(c[ia>>2]|0)+((c[M+8>>2]|0)-(c[M>>2]|0));vf(c[M>>2]|0);c[M>>2]=c[ha>>2]}while(0);h=M+8|0;i=c[h>>2]|0;c[h>>2]=i+1;a[i>>0]=1;b[ja>>1]=c[ba>>2];i=c[M+8>>2]|0;a[i>>0]=a[ja>>0]|0;a[i+1>>0]=a[ja+1>>0]|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+2;_w(c[M+8>>2]|0,c[ea>>2]|0,c[ba>>2]|0)|0;i=M+8|0;c[i>>2]=(c[i>>2]|0)+(c[ba>>2]|0);break}if(bp(c[ca>>2]|0,0,0,ba,c[aa>>2]|0)|0){$a=119;break b}c[ka>>2]=Lf(M,c[ba>>2]|0)|0;if(c[ka>>2]|0){$a=121;break b}do if(!(tf(c[M>>2]|0)|0)){if(!(Vp(c[aa>>2]|0,1)|0))break;c[la>>2]=sf(1+(c[M+4>>2]|0)-1|0)|0;if(!(c[la>>2]|0)){$a=125;break b}c[ma>>2]=c[la>>2];_w(c[ma>>2]|0,c[M>>2]|0,(c[M+8>>2]|0)-(c[M>>2]|0)|0)|0;c[M+8>>2]=(c[ma>>2]|0)+((c[M+8>>2]|0)-(c[M>>2]|0));vf(c[M>>2]|0);c[M>>2]=c[la>>2]}while(0);i=M+8|0;h=c[i>>2]|0;c[i>>2]=h+1;a[h>>0]=1;b[na>>1]=c[ba>>2];h=c[M+8>>2]|0;a[h>>0]=a[na>>0]|0;a[h+1>>0]=a[na+1>>0]|0;h=M+8|0;c[h>>2]=(c[h>>2]|0)+2;if(bp(c[ca>>2]|0,c[M+8>>2]|0,c[ba>>2]|0,ba,c[aa>>2]|0)|0){$a=128;break b}h=M+8|0;c[h>>2]=(c[h>>2]|0)+(c[ba>>2]|0)}while(0);c[I>>2]=0}while(0);c[z>>2]=(c[z>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+-1}switch($a|0){case 18:{c[y>>2]=c[P>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 29:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=206;break a;break}case 44:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=206;break a;break}case 54:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=206;break a;break}case 59:{c[y>>2]=c[T>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 66:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=212;break a;break}case 68:{c[y>>2]=c[W>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 82:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=211;break a;break}case 91:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=202;break a;break}case 93:{c[y>>2]=c[Z>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 101:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=201;break a;break}case 111:{c[y>>2]=c[ga>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 115:{c[y>>2]=Ct(c[(xu()|0)>>2]|0)|0;break a;break}case 119:{Re(22704,1433,22711);break}case 121:{c[y>>2]=c[ka>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 125:{c[y>>2]=Ct(c[(xu()|0)>>2]|0)|0;break a;break}case 128:{Re(22704,1460,22711);break}case 135:{c[y>>2]=c[ra>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 145:{c[y>>2]=c[xa>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 150:{c[y>>2]=Ct(c[(xu()|0)>>2]|0)|0;break a;break}case 158:{c[y>>2]=c[Fa>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 165:{c[y>>2]=c[La>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 173:{c[y>>2]=c[Ra>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 175:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=201;break a;break}case 179:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=209;break a;break}case 181:{c[y>>2]=c[Sa>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 185:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=209;break a;break}case 187:{c[y>>2]=c[Ta>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a;break}case 197:{c[c[s>>2]>>2]=ab-(c[t>>2]|0);c[y>>2]=208;break a;break}case 201:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=209;break a;break}case 206:{c[c[s>>2]>>2]=bb-(c[t>>2]|0);c[y>>2]=207;break a;break}case 212:{c[c[s>>2]>>2]=cb-(c[t>>2]|0);c[y>>2]=210;break a;break}case 214:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=210;break a;break}case 218:{c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);c[y>>2]=205;break a;break}case 220:{c[Ua>>2]=Lf(M,0)|0;if(c[Ua>>2]|0){c[y>>2]=c[Ua>>2];c[c[s>>2]>>2]=(c[z>>2]|0)-(c[t>>2]|0);break a}h=M+8|0;i=c[h>>2]|0;c[h>>2]=i+1;a[i>>0]=0;if((c[O>>2]|0)==0|(c[y>>2]|0)!=0)break a;c[y>>2]=203;break a;break}}}else{c[y>>2]=Ct(c[(xu()|0)>>2]|0)|0;c[c[s>>2]>>2]=0}while(0);s=c[M>>2]|0;if(c[y>>2]|0){if(s|0){d:do if(tf(c[M>>2]|0)|0){c[Va>>2]=c[M>>2];c[Wa>>2]=1+(c[M+4>>2]|0)-1;a[Xa>>0]=0;O=Ya;c[O>>2]=d[Xa>>0];c[O+4>>2]=0;while(1){if(!(c[Va>>2]&7|0?(c[Wa>>2]|0)!=0:0))break;a[c[Va>>2]>>0]=a[Xa>>0]|0;c[Va>>2]=(c[Va>>2]|0)+1;c[Wa>>2]=(c[Wa>>2]|0)+-1}if((c[Wa>>2]|0)>>>0>=8){O=Ya;t=gx(c[O>>2]|0,c[O+4>>2]|0,16843009,16843009)|0;O=Ya;c[O>>2]=t;c[O+4>>2]=D;do{c[Za>>2]=c[Va>>2];O=Ya;t=c[O+4>>2]|0;z=c[Za>>2]|0;c[z>>2]=c[O>>2];c[z+4>>2]=t;c[Wa>>2]=(c[Wa>>2]|0)-8;c[Va>>2]=(c[Va>>2]|0)+8}while((c[Wa>>2]|0)>>>0>=8)}while(1){if(!(c[Wa>>2]|0))break d;a[c[Va>>2]>>0]=a[Xa>>0]|0;c[Va>>2]=(c[Va>>2]|0)+1;c[Wa>>2]=(c[Wa>>2]|0)+-1}}while(0);vf(c[M>>2]|0)}}else{M=Qf(s)|0;c[c[r>>2]>>2]=M}c[q>>2]=c[y>>2];_a=c[q>>2]|0;l=n;return _a|0}function Lf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+24|0;f=d+20|0;g=d+16|0;h=d+12|0;i=d+8|0;j=d+4|0;k=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=(c[(c[f>>2]|0)+8>>2]|0)-(c[c[f>>2]>>2]|0);do if(((c[h>>2]|0)+(c[g>>2]|0)+2+1|0)>>>0>=(c[(c[f>>2]|0)+4>>2]|0)>>>0){c[k>>2]=(c[(c[f>>2]|0)+4>>2]|0)+((c[g>>2]|0)+2+1<<1);if((c[k>>2]|0)>>>0<=(c[(c[f>>2]|0)+4>>2]|0)>>>0){c[e>>2]=67;n=c[e>>2]|0;l=d;return n|0}c[i>>2]=uf(c[c[f>>2]>>2]|0,1+(c[k>>2]|0)-1|0)|0;if(c[i>>2]|0){c[(c[f>>2]|0)+4>>2]=c[k>>2];c[j>>2]=c[i>>2];c[(c[f>>2]|0)+8>>2]=(c[j>>2]|0)+(c[h>>2]|0);c[c[f>>2]>>2]=c[i>>2];break}c[e>>2]=Ct(c[(xu()|0)>>2]|0)|0;n=c[e>>2]|0;l=d;return n|0}while(0);c[e>>2]=0;n=c[e>>2]|0;l=d;return n|0}function Mf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+24|0;i=g+20|0;j=g+16|0;k=g+12|0;n=g+8|0;o=g+4|0;p=g;c[h>>2]=b;c[i>>2]=e;c[j>>2]=f;c[k>>2]=0;c[n>>2]=c[h>>2];c[o>>2]=c[j>>2];c[p>>2]=c[i>>2];while(1){if(!(c[p>>2]|0))break;i=d[c[n>>2]>>0]|0;do if(!(c[k>>2]|0))if((i|0)==92){c[k>>2]=1;break}else{h=a[c[n>>2]>>0]|0;f=c[o>>2]|0;c[o>>2]=f+1;a[f>>0]=h;break}else{a:do switch(i|0){case 98:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=8;break}case 116:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=9;break}case 118:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=11;break}case 110:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=10;break}case 102:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=12;break}case 114:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=13;break}case 34:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=34;break}case 39:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=39;break}case 92:{h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=92;break}case 13:{if((c[p>>2]|0)>>>0>1?(d[(c[n>>2]|0)+1>>0]|0|0)==10:0){c[n>>2]=(c[n>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+-1}break}case 10:{if((c[p>>2]|0)>>>0>1?(d[(c[n>>2]|0)+1>>0]|0|0)==13:0){c[n>>2]=(c[n>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+-1}break}case 120:{if((c[p>>2]|0)>>>0>2){if(!((d[(c[n>>2]|0)+1>>0]|0|0)>=48?(d[(c[n>>2]|0)+1>>0]|0|0)<=57:0))q=23;do if((q|0)==23){q=0;if((d[(c[n>>2]|0)+1>>0]|0|0)>=65?(d[(c[n>>2]|0)+1>>0]|0|0)<=70:0)break;if((d[(c[n>>2]|0)+1>>0]|0|0)<97)break a;if((d[(c[n>>2]|0)+1>>0]|0|0)>102)break a}while(0);if(!((d[(c[n>>2]|0)+2>>0]|0|0)>=48?(d[(c[n>>2]|0)+2>>0]|0|0)<=57:0))q=29;do if((q|0)==29){q=0;if((d[(c[n>>2]|0)+2>>0]|0|0)>=65?(d[(c[n>>2]|0)+2>>0]|0|0)<=70:0)break;if((d[(c[n>>2]|0)+2>>0]|0|0)<97)break a;if((d[(c[n>>2]|0)+2>>0]|0|0)>102)break a}while(0);c[n>>2]=(c[n>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+-1;h=d[c[n>>2]>>0]|0;if((d[c[n>>2]>>0]|0|0)<=57)r=h-48|0;else{f=d[c[n>>2]>>0]|0;r=((h|0)<=70?f-65|0:f-97|0)+10|0}f=d[(c[n>>2]|0)+1>>0]|0;if((d[(c[n>>2]|0)+1>>0]|0|0)<=57)s=f-48|0;else{h=d[(c[n>>2]|0)+1>>0]|0;s=((f|0)<=70?h-65|0:h-97|0)+10|0}h=c[o>>2]|0;c[o>>2]=h+1;a[h>>0]=(r<<4)+s;c[n>>2]=(c[n>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+-1}break}default:if(((((((c[p>>2]|0)>>>0>2?(d[c[n>>2]>>0]|0|0)>=48:0)?(d[c[n>>2]>>0]|0|0)<=55:0)?(d[(c[n>>2]|0)+1>>0]|0|0)>=48:0)?(d[(c[n>>2]|0)+1>>0]|0|0)<=55:0)?(d[(c[n>>2]|0)+2>>0]|0|0)>=48:0)?(d[(c[n>>2]|0)+2>>0]|0|0)<=55:0){h=((d[c[n>>2]>>0]|0)-48<<6)+((d[(c[n>>2]|0)+1>>0]|0)-48<<3)+((d[(c[n>>2]|0)+2>>0]|0)-48)&255;f=c[o>>2]|0;c[o>>2]=f+1;a[f>>0]=h;c[n>>2]=(c[n>>2]|0)+2;c[p>>2]=(c[p>>2]|0)-2}}while(0);c[k>>2]=0}while(0);c[p>>2]=(c[p>>2]|0)+-1;c[n>>2]=(c[n>>2]|0)+1}l=g;return (c[o>>2]|0)-(c[j>>2]|0)|0}function Nf(b){b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[f>>2]=b;switch(a[c[f>>2]>>0]|0){case 10:case 13:case 12:case 11:case 9:case 32:{c[e>>2]=1;break}default:c[e>>2]=0}l=d;return c[e>>2]|0}function Of(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;a=c[e>>2]|0;do if(!((c[e>>2]|0)>=48&(c[e>>2]|0)<=57)){f=c[e>>2]|0;if((a|0)>=65&(c[e>>2]|0)<=70){c[d>>2]=10+f-65;break}if((f|0)>=97&(c[e>>2]|0)<=102){c[d>>2]=10+(c[e>>2]|0)-97;break}else{c[d>>2]=0;break}}else c[d>>2]=a-48;while(0);l=b;return c[d>>2]|0}function Pf(b,f){b=b|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;n=g+24|0;o=g+4|0;p=g;c[i>>2]=b;c[j>>2]=f;c[p>>2]=0;c[c[j>>2]>>2]=0;a:do if(c[i>>2]|0){c[k>>2]=c[i>>2];while(1){f=d[c[k>>2]>>0]|0;c[o>>2]=f;if(!f)break a;c[k>>2]=(c[k>>2]|0)+1;if((c[o>>2]|0)==1){f=c[k>>2]|0;a[n>>0]=a[f>>0]|0;a[n+1>>0]=a[f+1>>0]|0;c[k>>2]=(c[k>>2]|0)+(2+(e[n>>1]|0));continue}if((c[o>>2]|0)!=3){if((c[o>>2]|0)!=4)continue;c[p>>2]=(c[p>>2]|0)+-1;if(c[p>>2]|0)continue;else break}if(!(c[p>>2]|0))c[c[j>>2]>>2]=(c[k>>2]|0)+-1-(c[i>>2]|0);c[p>>2]=(c[p>>2]|0)+1}c[h>>2]=(c[k>>2]|0)-(c[i>>2]|0);q=c[h>>2]|0;l=g;return q|0}while(0);c[h>>2]=0;q=c[h>>2]|0;l=g;return q|0}function Qf(a){a=a|0;var b=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+8|0;f=b+4|0;g=b;c[f>>2]=a;do if(c[f>>2]|0){c[g>>2]=c[f>>2];if(!(d[c[g>>2]>>0]|0)){Rf(c[f>>2]|0);c[e>>2]=0;break}if((d[c[g>>2]>>0]|0|0)==3?(d[(c[g>>2]|0)+1>>0]|0|0)==4:0){Rf(c[f>>2]|0);c[e>>2]=0;break}c[e>>2]=c[f>>2]}else c[e>>2]=0;while(0);l=b;return c[e>>2]|0}function Rf(b){b=b|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+28|0;h=f+24|0;i=f+20|0;j=f+32|0;k=f+16|0;n=f+12|0;o=f+34|0;p=f;q=f+8|0;c[g>>2]=b;if(!(c[g>>2]|0)){l=f;return}a:do if(tf(c[g>>2]|0)|0){c[h>>2]=c[g>>2];while(1){b=d[c[h>>2]>>0]|0;c[i>>2]=b;if(!b)break;c[h>>2]=(c[h>>2]|0)+1;if((c[i>>2]|0)!=1)continue;b=c[h>>2]|0;a[j>>0]=a[b>>0]|0;a[j+1>>0]=a[b+1>>0]|0;c[h>>2]=(c[h>>2]|0)+2;c[h>>2]=(c[h>>2]|0)+(e[j>>1]|0)}c[k>>2]=c[g>>2];c[n>>2]=(c[h>>2]|0)-(c[g>>2]|0);a[o>>0]=0;b=p;c[b>>2]=d[o>>0];c[b+4>>2]=0;while(1){if(!(c[k>>2]&7|0?(c[n>>2]|0)!=0:0))break;a[c[k>>2]>>0]=a[o>>0]|0;c[k>>2]=(c[k>>2]|0)+1;c[n>>2]=(c[n>>2]|0)+-1}if((c[n>>2]|0)>>>0>=8){b=p;r=gx(c[b>>2]|0,c[b+4>>2]|0,16843009,16843009)|0;b=p;c[b>>2]=r;c[b+4>>2]=D;do{c[q>>2]=c[k>>2];b=p;r=c[b+4>>2]|0;s=c[q>>2]|0;c[s>>2]=c[b>>2];c[s+4>>2]=r;c[n>>2]=(c[n>>2]|0)-8;c[k>>2]=(c[k>>2]|0)+8}while((c[n>>2]|0)>>>0>=8)}while(1){if(!(c[n>>2]|0))break a;a[c[k>>2]>>0]=a[o>>0]|0;c[k>>2]=(c[k>>2]|0)+1;c[n>>2]=(c[n>>2]|0)+-1}}while(0);vf(c[g>>2]|0);l=f;return}function Sf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=Hf(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,0)|0;l=f;return e|0}function Tf(f,g,h){f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);j=i+32|0;k=i+28|0;n=i+24|0;o=i+20|0;p=i+16|0;q=i+36|0;r=i+12|0;s=i+8|0;t=i+4|0;u=i;c[k>>2]=f;c[n>>2]=g;c[o>>2]=h;if(!(c[k>>2]|0)){c[j>>2]=0;v=c[j>>2]|0;l=i;return v|0}if(!(c[o>>2]|0))c[o>>2]=hv(c[n>>2]|0)|0;c[p>>2]=c[k>>2];while(1){if(!(d[c[p>>2]>>0]|0)){w=29;break}if((d[c[p>>2]>>0]|0|0)==3?(d[(c[p>>2]|0)+1>>0]|0|0)==1:0){c[r>>2]=c[p>>2];c[p>>2]=(c[p>>2]|0)+2;k=c[p>>2]|0;a[q>>0]=a[k>>0]|0;a[q+1>>0]=a[k+1>>0]|0;c[p>>2]=(c[p>>2]|0)+2;if((e[q>>1]|0|0)==(c[o>>2]|0)?(Jv(c[p>>2]|0,c[n>>2]|0,c[o>>2]|0)|0)==0:0)break;c[p>>2]=(c[p>>2]|0)+(e[q>>1]|0);continue}if((d[c[p>>2]>>0]|0|0)==1){k=(c[p>>2]|0)+1|0;c[p>>2]=k;a[q>>0]=a[k>>0]|0;a[q+1>>0]=a[k+1>>0]|0;c[p>>2]=(c[p>>2]|0)+2;c[p>>2]=(c[p>>2]|0)+(e[q>>1]|0);continue}else{c[p>>2]=(c[p>>2]|0)+1;continue}}if((w|0)==29){c[j>>2]=0;v=c[j>>2]|0;l=i;return v|0}c[u>>2]=1;c[p>>2]=(c[p>>2]|0)+(e[q>>1]|0);a:while(1){x=c[p>>2]|0;if(!(c[u>>2]|0))break;do if((d[x>>0]|0|0)!=1){if((d[c[p>>2]>>0]|0|0)==3){c[u>>2]=(c[u>>2]|0)+1;break}if((d[c[p>>2]>>0]|0|0)!=4)if(!(d[c[p>>2]>>0]|0)){w=20;break a}else break;else{c[u>>2]=(c[u>>2]|0)+-1;break}}else{o=(c[p>>2]|0)+1|0;c[p>>2]=o;a[q>>0]=a[o>>0]|0;a[q+1>>0]=a[o+1>>0]|0;c[p>>2]=(c[p>>2]|0)+(2+(e[q>>1]|0));c[p>>2]=(c[p>>2]|0)+-1}while(0);c[p>>2]=(c[p>>2]|0)+1}if((w|0)==20)Re(22704,481,22735);b[q>>1]=x-(c[r>>2]|0);c[s>>2]=pf(1+(e[q>>1]|0)|0)|0;if(c[s>>2]|0){c[t>>2]=c[s>>2];_w(c[t>>2]|0,c[r>>2]|0,e[q>>1]|0|0)|0;c[t>>2]=(c[t>>2]|0)+(e[q>>1]|0);q=c[t>>2]|0;c[t>>2]=q+1;a[q>>0]=0;c[j>>2]=Qf(c[s>>2]|0)|0;v=c[j>>2]|0;l=i;return v|0}else{c[j>>2]=0;v=c[j>>2]|0;l=i;return v|0}return 0}function Uf(b){b=b|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f+24|0;k=f+8|0;n=f+4|0;o=f;c[h>>2]=b;c[n>>2]=0;c[o>>2]=0;if(!(c[h>>2]|0)){c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}c[i>>2]=c[h>>2];while(1){h=d[c[i>>2]>>0]|0;c[k>>2]=h;if(!h)break;c[i>>2]=(c[i>>2]|0)+1;if((c[k>>2]|0)==1){h=c[i>>2]|0;a[j>>0]=a[h>>0]|0;a[j+1>>0]=a[h+1>>0]|0;c[i>>2]=(c[i>>2]|0)+(2+(e[j>>1]|0));if((c[o>>2]|0)!=1)continue;c[n>>2]=(c[n>>2]|0)+1;continue}if((c[k>>2]|0)!=3){if((c[k>>2]|0)!=4)continue;c[o>>2]=(c[o>>2]|0)+-1;continue}if((c[o>>2]|0)==1)c[n>>2]=(c[n>>2]|0)+1;c[o>>2]=(c[o>>2]|0)+1}c[g>>2]=c[n>>2];p=c[g>>2]|0;l=f;return p|0}function Vf(f,g){f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+28|0;j=h+24|0;k=h+20|0;n=h+16|0;o=h+32|0;p=h+12|0;q=h+8|0;r=h+4|0;s=h;c[j>>2]=f;c[k>>2]=g;c[r>>2]=0;if(c[j>>2]|0?(d[c[j>>2]>>0]|0|0)==3:0){c[n>>2]=c[j>>2];while(1){j=(c[k>>2]|0)>0;c[n>>2]=(c[n>>2]|0)+1;t=(d[c[n>>2]>>0]|0|0)==1;if(!j)break;if(t){j=(c[n>>2]|0)+1|0;c[n>>2]=j;a[o>>0]=a[j>>0]|0;a[o+1>>0]=a[j+1>>0]|0;c[n>>2]=(c[n>>2]|0)+(2+(e[o>>1]|0));c[n>>2]=(c[n>>2]|0)+-1;if(c[r>>2]|0)continue;c[k>>2]=(c[k>>2]|0)+-1;continue}if((d[c[n>>2]>>0]|0|0)==3){c[r>>2]=(c[r>>2]|0)+1;continue}if((d[c[n>>2]>>0]|0|0)!=4)if(!(d[c[n>>2]>>0]|0)){u=15;break}else continue;c[r>>2]=(c[r>>2]|0)+-1;if(c[r>>2]|0)continue;c[k>>2]=(c[k>>2]|0)+-1}if((u|0)==15){c[i>>2]=0;v=c[i>>2]|0;l=h;return v|0}do if(t){k=(c[n>>2]|0)+1|0;a[o>>0]=a[k>>0]|0;a[o+1>>0]=a[k+1>>0]|0;c[p>>2]=pf(5+(e[o>>1]|0)+1|0)|0;if(c[p>>2]|0){c[q>>2]=c[p>>2];k=c[q>>2]|0;c[q>>2]=k+1;a[k>>0]=3;_w(c[q>>2]|0,c[n>>2]|0,3+(e[o>>1]|0)|0)|0;c[q>>2]=(c[q>>2]|0)+(3+(e[o>>1]|0));k=c[q>>2]|0;c[q>>2]=k+1;a[k>>0]=4;a[c[q>>2]>>0]=0;break}c[i>>2]=0;v=c[i>>2]|0;l=h;return v|0}else{if((d[c[n>>2]>>0]|0|0)!=3){c[p>>2]=0;break}c[s>>2]=c[n>>2];c[r>>2]=1;a:do{c[n>>2]=(c[n>>2]|0)+1;do if((d[c[n>>2]>>0]|0|0)!=1){if((d[c[n>>2]>>0]|0|0)==3){c[r>>2]=(c[r>>2]|0)+1;break}if((d[c[n>>2]>>0]|0|0)!=4)if(!(d[c[n>>2]>>0]|0)){u=29;break a}else break;else{c[r>>2]=(c[r>>2]|0)+-1;break}}else{k=(c[n>>2]|0)+1|0;c[n>>2]=k;a[o>>0]=a[k>>0]|0;a[o+1>>0]=a[k+1>>0]|0;c[n>>2]=(c[n>>2]|0)+(2+(e[o>>1]|0));c[n>>2]=(c[n>>2]|0)+-1}while(0)}while((c[r>>2]|0)!=0);if((u|0)==29)Re(22704,673,22757);b[o>>1]=(c[n>>2]|0)+1-(c[s>>2]|0);c[p>>2]=pf(1+(e[o>>1]|0)|0)|0;if(c[p>>2]|0){c[q>>2]=c[p>>2];_w(c[q>>2]|0,c[s>>2]|0,e[o>>1]|0|0)|0;c[q>>2]=(c[q>>2]|0)+(e[o>>1]|0);k=c[q>>2]|0;c[q>>2]=k+1;a[k>>0]=0;break}c[i>>2]=0;v=c[i>>2]|0;l=h;return v|0}while(0);c[i>>2]=Qf(c[p>>2]|0)|0;v=c[i>>2]|0;l=h;return v|0}c[i>>2]=0;v=c[i>>2]|0;l=h;return v|0}function Wf(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Vf(c[d>>2]|0,0)|0;l=b;return a|0}function Xf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Yf(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function Yf(b,f,g){b=b|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+20|0;j=h+16|0;k=h+12|0;n=h+8|0;o=h+4|0;p=h+24|0;q=h;c[j>>2]=b;c[k>>2]=f;c[n>>2]=g;c[q>>2]=0;c[c[n>>2]>>2]=0;if(!(c[j>>2]|0)){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}c[o>>2]=c[j>>2];if((d[c[o>>2]>>0]|0|0)!=3){if(c[k>>2]|0){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}}else c[o>>2]=(c[o>>2]|0)+1;a:while(1){s=(d[c[o>>2]>>0]|0|0)==1;if((c[k>>2]|0)<=0)break;do if(s){j=(c[o>>2]|0)+1|0;c[o>>2]=j;a[p>>0]=a[j>>0]|0;a[p+1>>0]=a[j+1>>0]|0;c[o>>2]=(c[o>>2]|0)+(2+(e[p>>1]|0));c[o>>2]=(c[o>>2]|0)+-1;if(!(c[q>>2]|0))c[k>>2]=(c[k>>2]|0)+-1}else{if((d[c[o>>2]>>0]|0|0)==3){c[q>>2]=(c[q>>2]|0)+1;break}if((d[c[o>>2]>>0]|0|0)!=4)if(!(d[c[o>>2]>>0]|0)){t=17;break a}else break;c[q>>2]=(c[q>>2]|0)+-1;if(!(c[q>>2]|0))c[k>>2]=(c[k>>2]|0)+-1}while(0);c[o>>2]=(c[o>>2]|0)+1}if((t|0)==17){c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}if(s){s=(c[o>>2]|0)+1|0;c[o>>2]=s;a[p>>0]=a[s>>0]|0;a[p+1>>0]=a[s+1>>0]|0;c[c[n>>2]>>2]=e[p>>1];c[i>>2]=(c[o>>2]|0)+2;r=c[i>>2]|0;l=h;return r|0}else{c[i>>2]=0;r=c[i>>2]|0;l=h;return r|0}return 0}function Zf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;n=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[c[i>>2]>>2]=0;c[j>>2]=Yf(c[g>>2]|0,c[h>>2]|0,k)|0;if(!((c[j>>2]|0)!=0&(c[k>>2]|0)!=0)){c[f>>2]=0;o=c[f>>2]|0;l=e;return o|0}c[n>>2]=pf(c[k>>2]|0)|0;if(c[n>>2]|0){_w(c[n>>2]|0,c[j>>2]|0,c[k>>2]|0)|0;c[c[i>>2]>>2]=c[k>>2];c[f>>2]=c[n>>2];o=c[f>>2]|0;l=e;return o|0}else{c[f>>2]=0;o=c[f>>2]|0;l=e;return o|0}return 0}function _f(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[g>>2]=b;c[h>>2]=d;c[i>>2]=Yf(c[g>>2]|0,c[h>>2]|0,j)|0;if(!((c[i>>2]|0)==0|(c[j>>2]|0)>>>0<1)?((c[j>>2]|0)+1|0)>>>0>=1:0){c[k>>2]=pf((c[j>>2]|0)+1|0)|0;if(c[k>>2]|0){_w(c[k>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;a[(c[k>>2]|0)+(c[j>>2]|0)>>0]=0;c[f>>2]=c[k>>2];n=c[f>>2]|0;l=e;return n|0}else{c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}}c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}function $f(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+28|0;g=e+24|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+8|0;n=e+4|0;o=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;do if((c[i>>2]|0)==8){c[n>>2]=Zf(c[g>>2]|0,c[h>>2]|0,j)|0;if(!(c[n>>2]|0)){c[f>>2]=0;p=c[f>>2]|0;l=e;return p|0}if(tf(c[g>>2]|0)|0)q=Sp(0)|0;else q=Rp(0)|0;c[k>>2]=q;if(c[k>>2]|0){Ep(c[k>>2]|0,c[n>>2]|0,c[j>>2]<<3)|0;break}else{vf(c[n>>2]|0);break}}else{if(!(c[i>>2]|0))c[i>>2]=1;c[o>>2]=Yf(c[g>>2]|0,c[h>>2]|0,j)|0;if(!(c[o>>2]|0)){c[f>>2]=0;p=c[f>>2]|0;l=e;return p|0}if(Zo(k,c[i>>2]|0,c[o>>2]|0,c[j>>2]|0,0)|0){c[f>>2]=0;p=c[f>>2]|0;l=e;return p|0}}while(0);c[f>>2]=c[k>>2];p=c[f>>2]|0;l=e;return p|0}function ag(f){f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+28|0;i=g+24|0;j=g+20|0;k=g+16|0;n=g+32|0;o=g+12|0;p=g+8|0;q=g+4|0;r=g;c[i>>2]=f;c[q>>2]=0;c[r>>2]=1;if(c[i>>2]|0?(d[c[i>>2]>>0]|0|0)==3:0){c[j>>2]=c[i>>2];while(1){i=(c[r>>2]|0)>0;c[j>>2]=(c[j>>2]|0)+1;s=c[j>>2]|0;if(!i)break;if((d[s>>0]|0|0)==1){i=(c[j>>2]|0)+1|0;c[j>>2]=i;a[n>>0]=a[i>>0]|0;a[n+1>>0]=a[i+1>>0]|0;c[j>>2]=(c[j>>2]|0)+(2+(e[n>>1]|0));c[j>>2]=(c[j>>2]|0)+-1;if(c[q>>2]|0)continue;c[r>>2]=(c[r>>2]|0)+-1;continue}if((d[c[j>>2]>>0]|0|0)==3){c[q>>2]=(c[q>>2]|0)+1;continue}if((d[c[j>>2]>>0]|0|0)!=4)if(!(d[c[j>>2]>>0]|0)){t=15;break}else continue;c[q>>2]=(c[q>>2]|0)+-1;if(c[q>>2]|0)continue;c[r>>2]=(c[r>>2]|0)+-1}if((t|0)==15){c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}c[k>>2]=s;c[q>>2]=0;a:do{do if((d[c[j>>2]>>0]|0|0)!=1){if((d[c[j>>2]>>0]|0|0)==3){c[q>>2]=(c[q>>2]|0)+1;break}if((d[c[j>>2]>>0]|0|0)!=4)if(!(d[c[j>>2]>>0]|0)){t=24;break a}else break;else{c[q>>2]=(c[q>>2]|0)+-1;break}}else{s=(c[j>>2]|0)+1|0;c[j>>2]=s;a[n>>0]=a[s>>0]|0;a[n+1>>0]=a[s+1>>0]|0;c[j>>2]=(c[j>>2]|0)+(2+(e[n>>1]|0));c[j>>2]=(c[j>>2]|0)+-1}while(0);c[j>>2]=(c[j>>2]|0)+1}while((c[q>>2]|0)!=0);if((t|0)==24){c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}b[n>>1]=(c[j>>2]|0)-(c[k>>2]|0);c[o>>2]=pf(1+(e[n>>1]|0)+2|0)|0;if(c[o>>2]|0){c[p>>2]=c[o>>2];j=c[p>>2]|0;c[p>>2]=j+1;a[j>>0]=3;_w(c[p>>2]|0,c[k>>2]|0,e[n>>1]|0|0)|0;c[p>>2]=(c[p>>2]|0)+(e[n>>1]|0);n=c[p>>2]|0;c[p>>2]=n+1;a[n>>0]=4;n=c[p>>2]|0;c[p>>2]=n+1;a[n>>0]=0;c[h>>2]=Qf(c[o>>2]|0)|0;u=c[h>>2]|0;l=g;return u|0}else{c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}}c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}function bg(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=ag(c[d>>2]|0)|0;c[f>>2]=Wf(c[e>>2]|0)|0;Rf(c[e>>2]|0);l=b;return c[f>>2]|0}function cg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[k>>2]=e;e=c[g>>2]|0;g=c[h>>2]|0;h=c[i>>2]|0;c[j>>2]=Kf(e,g,h,hv(c[i>>2]|0)|0,1,0,k)|0;l=f;return c[j>>2]|0}function dg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=c[g>>2]|0;g=c[h>>2]|0;h=c[i>>2]|0;d=hv(c[i>>2]|0)|0;i=Kf(e,g,h,d,1,0,c[j>>2]|0)|0;l=f;return i|0}function eg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=Jf(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,0,0,f)|0;l=f;return e|0} -function Yn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;vn(c[(c[j>>2]|0)+48+16>>2]|0,c[(c[h>>2]|0)+8>>2]|0,c[(c[i>>2]|0)+8>>2]|0,c[j>>2]|0);Qn(c[(c[j>>2]|0)+48+16+4>>2]|0,c[(c[j>>2]|0)+48+16>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+8>>2]|0,c[c[h>>2]>>2]|0,c[c[i>>2]>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+4>>2]|0,c[(c[i>>2]|0)+4>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+16>>2]|0,c[(c[j>>2]|0)+24>>2]|0,c[(c[j>>2]|0)+48+16+8>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+16>>2]|0,c[(c[j>>2]|0)+48+16+16>>2]|0,c[(c[j>>2]|0)+48+16+12>>2]|0,c[j>>2]|0);Sn(c[(c[j>>2]|0)+48+16+20>>2]|0,c[(c[j>>2]|0)+48+16+4>>2]|0,c[(c[j>>2]|0)+48+16+16>>2]|0,c[j>>2]|0);Pn(c[(c[j>>2]|0)+48+16+24>>2]|0,c[(c[j>>2]|0)+48+16+4>>2]|0,c[(c[j>>2]|0)+48+16+16>>2]|0,c[j>>2]|0);Pn(c[(c[j>>2]|0)+48+16+28>>2]|0,c[c[h>>2]>>2]|0,c[(c[h>>2]|0)+4>>2]|0,c[j>>2]|0);Pn(c[c[g>>2]>>2]|0,c[c[i>>2]>>2]|0,c[(c[i>>2]|0)+4>>2]|0,c[j>>2]|0);vn(c[c[g>>2]>>2]|0,c[c[g>>2]>>2]|0,c[(c[j>>2]|0)+48+16+28>>2]|0,c[j>>2]|0);Sn(c[c[g>>2]>>2]|0,c[c[g>>2]>>2]|0,c[(c[j>>2]|0)+48+16+8>>2]|0,c[j>>2]|0);Sn(c[c[g>>2]>>2]|0,c[c[g>>2]>>2]|0,c[(c[j>>2]|0)+48+16+12>>2]|0,c[j>>2]|0);vn(c[c[g>>2]>>2]|0,c[c[g>>2]>>2]|0,c[(c[j>>2]|0)+48+16+20>>2]|0,c[j>>2]|0);vn(c[c[g>>2]>>2]|0,c[c[g>>2]>>2]|0,c[(c[j>>2]|0)+48+16>>2]|0,c[j>>2]|0);i=c[(c[g>>2]|0)+4>>2]|0;h=c[j>>2]|0;if((c[(c[j>>2]|0)+4>>2]|0)==1){Kp(i,c[h+48+16+8>>2]|0)|0;Jp(c[(c[g>>2]|0)+4>>2]|0,c[(c[g>>2]|0)+4>>2]|0);Sn(c[(c[g>>2]|0)+4>>2]|0,c[(c[j>>2]|0)+48+16+12>>2]|0,c[(c[g>>2]|0)+4>>2]|0,c[j>>2]|0);k=c[g>>2]|0;n=k+4|0;o=c[n>>2]|0;p=c[g>>2]|0;q=p+4|0;r=c[q>>2]|0;s=c[j>>2]|0;t=s+48|0;u=t+16|0;v=u+24|0;w=c[v>>2]|0;x=c[j>>2]|0;vn(o,r,w,x);y=c[g>>2]|0;z=y+4|0;A=c[z>>2]|0;B=c[g>>2]|0;C=B+4|0;D=c[C>>2]|0;E=c[j>>2]|0;F=E+48|0;G=F+16|0;H=c[G>>2]|0;I=c[j>>2]|0;vn(A,D,H,I);J=c[g>>2]|0;K=J+8|0;L=c[K>>2]|0;M=c[j>>2]|0;N=M+48|0;O=N+16|0;P=O+20|0;Q=c[P>>2]|0;R=c[j>>2]|0;S=R+48|0;T=S+16|0;U=T+24|0;V=c[U>>2]|0;W=c[j>>2]|0;vn(L,Q,V,W);l=f;return}else{vn(i,c[h+20>>2]|0,c[(c[j>>2]|0)+48+16+8>>2]|0,c[j>>2]|0);Sn(c[(c[g>>2]|0)+4>>2]|0,c[(c[j>>2]|0)+48+16+12>>2]|0,c[(c[g>>2]|0)+4>>2]|0,c[j>>2]|0);k=c[g>>2]|0;n=k+4|0;o=c[n>>2]|0;p=c[g>>2]|0;q=p+4|0;r=c[q>>2]|0;s=c[j>>2]|0;t=s+48|0;u=t+16|0;v=u+24|0;w=c[v>>2]|0;x=c[j>>2]|0;vn(o,r,w,x);y=c[g>>2]|0;z=y+4|0;A=c[z>>2]|0;B=c[g>>2]|0;C=B+4|0;D=c[C>>2]|0;E=c[j>>2]|0;F=E+48|0;G=F+16|0;H=c[G>>2]|0;I=c[j>>2]|0;vn(A,D,H,I);J=c[g>>2]|0;K=J+8|0;L=c[K>>2]|0;M=c[j>>2]|0;N=M+48|0;O=N+16|0;P=O+20|0;Q=c[P>>2]|0;R=c[j>>2]|0;S=R+48|0;T=S+16|0;U=T+24|0;V=c[U>>2]|0;W=c[j>>2]|0;vn(L,Q,V,W);l=f;return}}function Zn(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=b;if((d[(c[f>>2]|0)+48>>0]|0)>>>1&1|0){g=c[f>>2]|0;h=g+48|0;i=h+8|0;j=c[i>>2]|0;l=e;return j|0}b=(c[f>>2]|0)+48|0;a[b>>0]=a[b>>0]&-3|2;if(!(c[(c[f>>2]|0)+48+8>>2]|0)){b=vp(0)|0;c[(c[f>>2]|0)+48+8>>2]=b}b=c[(c[f>>2]|0)+48+8>>2]|0;k=Wp(2)|0;un(b,k,c[f>>2]|0);g=c[f>>2]|0;h=g+48|0;i=h+8|0;j=c[i>>2]|0;l=e;return j|0}function _n(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;Kp(c[c[e>>2]>>2]|0,c[c[f>>2]>>2]|0)|0;Kp(c[(c[e>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0)|0;Kp(c[(c[e>>2]|0)+8>>2]|0,c[(c[f>>2]|0)+8>>2]|0)|0;l=d;return}function $n(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;f=l;l=l+176|0;if((l|0)>=(m|0))$(176);g=f+168|0;h=f+164|0;i=f+160|0;j=f+156|0;k=f+152|0;n=f+148|0;o=f+144|0;p=f+140|0;q=f+136|0;r=f+132|0;s=f+128|0;t=f+124|0;u=f+112|0;v=f+100|0;w=f+88|0;x=f+84|0;y=f+80|0;z=f+68|0;A=f+64|0;B=f+60|0;C=f+48|0;D=f+36|0;E=f+32|0;F=f+28|0;G=f+24|0;H=f+20|0;I=f+16|0;J=f+12|0;K=f+8|0;L=f+4|0;M=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if((c[c[j>>2]>>2]|0)==2){c[x>>2]=lo(c[h>>2]|0)|0;Op(c[c[g>>2]>>2]|0,0)|0;Op(c[(c[g>>2]|0)+4>>2]|0,1)|0;Op(c[(c[g>>2]|0)+8>>2]|0,1)|0;if(c[h>>2]|0?c[(c[h>>2]|0)+12>>2]&1|0:0){yn(z);c[y>>2]=(c[x>>2]|0)-1;while(1){if((c[y>>2]|0)<0)break;Ln(c[g>>2]|0,c[g>>2]|0,c[j>>2]|0);Vn(z,c[g>>2]|0,c[i>>2]|0,c[j>>2]|0);if(mo(c[h>>2]|0,c[y>>2]|0)|0)_n(c[g>>2]|0,z);c[y>>2]=(c[y>>2]|0)+-1}An(z);l=f;return}c[y>>2]=(c[x>>2]|0)-1;while(1){if((c[y>>2]|0)<0)break;Ln(c[g>>2]|0,c[g>>2]|0,c[j>>2]|0);if(mo(c[h>>2]|0,c[y>>2]|0)|0)Vn(c[g>>2]|0,c[g>>2]|0,c[i>>2]|0,c[j>>2]|0);c[y>>2]=(c[y>>2]|0)+-1}l=f;return}if((c[c[j>>2]>>2]|0)==1){c[A>>2]=lo(c[h>>2]|0)|0;yn(u);yn(v);yn(C);yn(D);Op(c[u>>2]|0,1)|0;Dp(c[v>>2]|0);c[v>>2]=Ip(c[c[i>>2]>>2]|0)|0;Op(c[v+8>>2]|0,1)|0;c[J>>2]=(((c[A>>2]|0)+32-1<<1>>>0)/32|0)+1;Ap(c[u>>2]|0,c[J>>2]|0);Ap(c[u+8>>2]|0,c[J>>2]|0);Ap(c[v>>2]|0,c[J>>2]|0);Ap(c[v+8>>2]|0,c[J>>2]|0);Ap(c[C>>2]|0,c[J>>2]|0);Ap(c[C+8>>2]|0,c[J>>2]|0);Ap(c[D>>2]|0,c[J>>2]|0);Ap(c[D+8>>2]|0,c[J>>2]|0);c[E>>2]=u;c[F>>2]=v;c[G>>2]=C;c[H>>2]=D;c[B>>2]=(c[A>>2]|0)-1;while(1){if((c[B>>2]|0)<0)break;c[I>>2]=mo(c[h>>2]|0,c[B>>2]|0)|0;Qp(c[c[E>>2]>>2]|0,c[c[F>>2]>>2]|0,c[I>>2]|0);Qp(c[(c[E>>2]|0)+8>>2]|0,c[(c[F>>2]|0)+8>>2]|0,c[I>>2]|0);ao(c[G>>2]|0,c[H>>2]|0,c[E>>2]|0,c[F>>2]|0,c[c[i>>2]>>2]|0,c[j>>2]|0);Qp(c[c[G>>2]>>2]|0,c[c[H>>2]>>2]|0,c[I>>2]|0);Qp(c[(c[G>>2]|0)+8>>2]|0,c[(c[H>>2]|0)+8>>2]|0,c[I>>2]|0);c[K>>2]=c[E>>2];c[E>>2]=c[G>>2];c[G>>2]=c[K>>2];c[K>>2]=c[F>>2];c[F>>2]=c[H>>2];c[H>>2]=c[K>>2];c[B>>2]=(c[B>>2]|0)+-1}Bp(c[(c[g>>2]|0)+4>>2]|0);c[I>>2]=c[A>>2]&1;Qp(c[u>>2]|0,c[C>>2]|0,c[I>>2]|0);Qp(c[u+8>>2]|0,c[C+8>>2]|0,c[I>>2]|0);if(!(c[(c[u+8>>2]|0)+4>>2]|0)){Op(c[c[g>>2]>>2]|0,1)|0;Op(c[(c[g>>2]|0)+8>>2]|0,0)|0}else{c[o>>2]=Rp(0)|0;un(c[o>>2]|0,c[u+8>>2]|0,c[j>>2]|0);vn(c[c[g>>2]>>2]|0,c[u>>2]|0,c[o>>2]|0,c[j>>2]|0);Op(c[(c[g>>2]|0)+8>>2]|0,1)|0;Dp(c[o>>2]|0)}An(u);An(v);An(C);An(D);l=f;return}c[k>>2]=Lp(c[(c[j>>2]|0)+16>>2]|0)|0;c[n>>2]=Lp(c[(c[j>>2]|0)+16>>2]|0)|0;c[q>>2]=Lp(c[(c[j>>2]|0)+16>>2]|0)|0;c[p>>2]=Ip(c[h>>2]|0)|0;c[r>>2]=Ip(c[(c[i>>2]|0)+4>>2]|0)|0;if(c[(c[p>>2]|0)+8>>2]|0){c[(c[p>>2]|0)+8>>2]=0;un(c[r>>2]|0,c[r>>2]|0,c[j>>2]|0)}if(vo(c[(c[i>>2]|0)+8>>2]|0,1)|0){c[L>>2]=Lp(c[(c[j>>2]|0)+16>>2]|0)|0;c[M>>2]=Lp(c[(c[j>>2]|0)+16>>2]|0)|0;vn(c[L>>2]|0,c[(c[i>>2]|0)+8>>2]|0,c[(c[i>>2]|0)+8>>2]|0,c[j>>2]|0);vn(c[M>>2]|0,c[(c[i>>2]|0)+8>>2]|0,c[L>>2]|0,c[j>>2]|0);un(c[L>>2]|0,c[L>>2]|0,c[j>>2]|0);vn(c[k>>2]|0,c[c[i>>2]>>2]|0,c[L>>2]|0,c[j>>2]|0);un(c[M>>2]|0,c[M>>2]|0,c[j>>2]|0);vn(c[n>>2]|0,c[r>>2]|0,c[M>>2]|0,c[j>>2]|0);Dp(c[L>>2]|0);Dp(c[M>>2]|0)}else{Kp(c[k>>2]|0,c[c[i>>2]>>2]|0)|0;Kp(c[n>>2]|0,c[r>>2]|0)|0}c[o>>2]=Ip(Wp(1)|0)|0;M=c[q>>2]|0;L=c[p>>2]|0;Qo(M,L,Wp(3)|0);c[t>>2]=lo(c[q>>2]|0)|0;if((c[t>>2]|0)>>>0<2){c[t>>2]=2;Bp(c[c[g>>2]>>2]|0);Bp(c[(c[g>>2]|0)+4>>2]|0);Bp(c[(c[g>>2]|0)+8>>2]|0)}else{Kp(c[c[g>>2]>>2]|0,c[c[i>>2]>>2]|0)|0;Kp(c[(c[g>>2]|0)+4>>2]|0,c[r>>2]|0)|0;Kp(c[(c[g>>2]|0)+8>>2]|0,c[(c[i>>2]|0)+8>>2]|0)|0}Dp(c[r>>2]|0);c[r>>2]=0;c[u>>2]=c[k>>2];c[k>>2]=0;c[u+4>>2]=c[n>>2];c[n>>2]=0;c[u+8>>2]=c[o>>2];c[o>>2]=0;yn(v);yn(w);c[s>>2]=(c[t>>2]|0)-2;while(1){if((c[s>>2]|0)>>>0<=0)break;Ln(c[g>>2]|0,c[g>>2]|0,c[j>>2]|0);if((mo(c[q>>2]|0,c[s>>2]|0)|0)==1?(mo(c[p>>2]|0,c[s>>2]|0)|0)==0:0){_n(v,c[g>>2]|0);Vn(c[g>>2]|0,v,u,c[j>>2]|0)}if((mo(c[q>>2]|0,c[s>>2]|0)|0)==0?(mo(c[p>>2]|0,c[s>>2]|0)|0)==1:0){_n(v,c[g>>2]|0);_n(w,u);Sn(c[w+4>>2]|0,c[(c[j>>2]|0)+16>>2]|0,c[w+4>>2]|0,c[j>>2]|0);Vn(c[g>>2]|0,v,w,c[j>>2]|0)}c[s>>2]=(c[s>>2]|0)+-1}An(u);An(v);An(w);Dp(c[q>>2]|0);Dp(c[p>>2]|0);l=f;return}function ao(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+20|0;j=h+16|0;k=h+12|0;n=h+8|0;o=h+4|0;p=h;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;Pn(c[c[j>>2]>>2]|0,c[c[n>>2]>>2]|0,c[(c[n>>2]|0)+8>>2]|0,c[p>>2]|0);Sn(c[(c[n>>2]|0)+8>>2]|0,c[c[n>>2]>>2]|0,c[(c[n>>2]|0)+8>>2]|0,c[p>>2]|0);Pn(c[c[i>>2]>>2]|0,c[c[k>>2]>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[p>>2]|0);Sn(c[(c[k>>2]|0)+8>>2]|0,c[c[k>>2]>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[p>>2]|0);vn(c[c[n>>2]>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[c[j>>2]>>2]|0,c[p>>2]|0);vn(c[(c[n>>2]|0)+8>>2]|0,c[c[i>>2]>>2]|0,c[(c[n>>2]|0)+8>>2]|0,c[p>>2]|0);Qn(c[c[k>>2]>>2]|0,c[c[i>>2]>>2]|0,c[p>>2]|0);Qn(c[(c[k>>2]|0)+8>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[p>>2]|0);Pn(c[c[j>>2]>>2]|0,c[c[n>>2]>>2]|0,c[(c[n>>2]|0)+8>>2]|0,c[p>>2]|0);Sn(c[(c[n>>2]|0)+8>>2]|0,c[c[n>>2]>>2]|0,c[(c[n>>2]|0)+8>>2]|0,c[p>>2]|0);vn(c[c[i>>2]>>2]|0,c[c[k>>2]>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[p>>2]|0);Sn(c[(c[k>>2]|0)+8>>2]|0,c[c[k>>2]>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[p>>2]|0);Qn(c[c[j>>2]>>2]|0,c[c[j>>2]>>2]|0,c[p>>2]|0);Qn(c[(c[j>>2]|0)+8>>2]|0,c[(c[n>>2]|0)+8>>2]|0,c[p>>2]|0);vn(c[(c[i>>2]|0)+8>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[(c[p>>2]|0)+20>>2]|0,c[p>>2]|0);vn(c[(c[j>>2]|0)+8>>2]|0,c[(c[j>>2]|0)+8>>2]|0,c[o>>2]|0,c[p>>2]|0);Pn(c[(c[i>>2]|0)+8>>2]|0,c[c[k>>2]>>2]|0,c[(c[i>>2]|0)+8>>2]|0,c[p>>2]|0);vn(c[(c[i>>2]|0)+8>>2]|0,c[(c[i>>2]|0)+8>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[p>>2]|0);l=h;return}function bo(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+28|0;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;k=d+4|0;n=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=0;c[i>>2]=Rp(0)|0;c[j>>2]=Rp(0)|0;c[k>>2]=Rp(0)|0;a:do switch(c[c[g>>2]>>2]|0){case 0:{c[n>>2]=Rp(0)|0;if(tn(c[i>>2]|0,c[j>>2]|0,c[f>>2]|0,c[g>>2]|0)|0){c[e>>2]=0;o=c[e>>2]|0;l=d;return o|0}Qn(c[j>>2]|0,c[j>>2]|0,c[g>>2]|0);co(c[n>>2]|0,c[i>>2]|0,c[g>>2]|0);vn(c[k>>2]|0,c[(c[g>>2]|0)+20>>2]|0,c[i>>2]|0,c[g>>2]|0);Pn(c[k>>2]|0,c[k>>2]|0,c[(c[g>>2]|0)+24>>2]|0,c[g>>2]|0);Pn(c[k>>2]|0,c[k>>2]|0,c[n>>2]|0,c[g>>2]|0);if(!(wo(c[j>>2]|0,c[k>>2]|0)|0))c[h>>2]=1;Tp(c[n>>2]|0);break}case 1:{if(!(tn(c[i>>2]|0,0,c[f>>2]|0,c[g>>2]|0)|0)){b=c[k>>2]|0;a=c[(c[g>>2]|0)+20>>2]|0;p=Wp(4)|0;vn(b,a,p,c[g>>2]|0);p=c[k>>2]|0;a=c[k>>2]|0;b=Wp(2)|0;Pn(p,a,b,c[g>>2]|0);vn(c[k>>2]|0,c[k>>2]|0,c[i>>2]|0,c[g>>2]|0);Qn(c[j>>2]|0,c[i>>2]|0,c[g>>2]|0);Pn(c[k>>2]|0,c[k>>2]|0,c[j>>2]|0,c[g>>2]|0);b=c[k>>2]|0;a=c[k>>2]|0;p=Wp(1)|0;Pn(b,a,p,c[g>>2]|0);vn(c[k>>2]|0,c[k>>2]|0,c[i>>2]|0,c[g>>2]|0);vn(c[k>>2]|0,c[k>>2]|0,c[(c[g>>2]|0)+24>>2]|0,c[g>>2]|0);p=c[j>>2]|0;a=c[(c[g>>2]|0)+16>>2]|0;b=Wp(1)|0;Sn(p,a,b,c[g>>2]|0);so(c[j>>2]|0,c[j>>2]|0,1);Un(c[k>>2]|0,c[k>>2]|0,c[j>>2]|0,c[g>>2]|0);c[h>>2]=vo(c[k>>2]|0,1)|0;break a}c[e>>2]=0;o=c[e>>2]|0;l=d;return o|0}case 2:{if(tn(c[i>>2]|0,c[j>>2]|0,c[f>>2]|0,c[g>>2]|0)|0){c[e>>2]=0;o=c[e>>2]|0;l=d;return o|0}Qn(c[i>>2]|0,c[i>>2]|0,c[g>>2]|0);Qn(c[j>>2]|0,c[j>>2]|0,c[g>>2]|0);b=c[k>>2]|0;if((c[(c[g>>2]|0)+4>>2]|0)==1){Kp(b,c[i>>2]|0)|0;Jp(c[k>>2]|0,c[k>>2]|0)}else vn(b,c[(c[g>>2]|0)+20>>2]|0,c[i>>2]|0,c[g>>2]|0);Pn(c[k>>2]|0,c[k>>2]|0,c[j>>2]|0,c[g>>2]|0);Sn(c[k>>2]|0,c[k>>2]|0,Wp(1)|0,c[g>>2]|0);vn(c[i>>2]|0,c[i>>2]|0,c[j>>2]|0,c[g>>2]|0);vn(c[i>>2]|0,c[i>>2]|0,c[(c[g>>2]|0)+24>>2]|0,c[g>>2]|0);Sn(c[k>>2]|0,c[k>>2]|0,c[i>>2]|0,c[g>>2]|0);if(!(vo(c[k>>2]|0,0)|0))c[h>>2]=1;break}default:{}}while(0);Tp(c[k>>2]|0);Tp(c[i>>2]|0);Tp(c[j>>2]|0);c[e>>2]=c[h>>2];o=c[e>>2]|0;l=d;return o|0}function co(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=c[f>>2]|0;f=c[g>>2]|0;g=Wp(3)|0;So(d,f,g,c[(c[h>>2]|0)+16>>2]|0);l=e;return}function eo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+36|0;g=e+32|0;h=e+28|0;i=e+24|0;j=e+20|0;k=e+16|0;n=e+12|0;o=e+8|0;p=e+4|0;q=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[k>>2]=c[(c[g>>2]|0)+4>>2];c[o>>2]=c[(c[g>>2]|0)+8>>2];c[p>>2]=0;c[n>>2]=(c[k>>2]|0)+1;if((c[c[f>>2]>>2]|0)<(c[n>>2]|0))Ap(c[f>>2]|0,c[n>>2]|0);c[j>>2]=c[(c[g>>2]|0)+16>>2];c[i>>2]=c[(c[f>>2]|0)+16>>2];do if(c[k>>2]|0){if(!(c[o>>2]|0)){c[q>>2]=Go(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[h>>2]|0)|0;c[(c[i>>2]|0)+(c[k>>2]<<2)>>2]=c[q>>2];c[n>>2]=(c[k>>2]|0)+(c[q>>2]|0);break}if((c[k>>2]|0)==1?(c[c[j>>2]>>2]|0)>>>0<(c[h>>2]|0)>>>0:0){c[c[i>>2]>>2]=(c[h>>2]|0)-(c[c[j>>2]>>2]|0);c[n>>2]=1;break}Io(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[h>>2]|0)|0;c[n>>2]=(c[k>>2]|0)-((c[(c[i>>2]|0)+((c[k>>2]|0)-1<<2)>>2]|0)==0&1);c[p>>2]=1}else{c[c[i>>2]>>2]=c[h>>2];c[n>>2]=c[h>>2]|0?1:0}while(0);c[(c[f>>2]|0)+4>>2]=c[n>>2];c[(c[f>>2]|0)+8>>2]=c[p>>2];l=e;return}function fo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+52|0;g=e+48|0;h=e+44|0;i=e+40|0;j=e+36|0;k=e+32|0;n=e+28|0;o=e+24|0;p=e+20|0;q=e+16|0;r=e+12|0;s=e+8|0;t=e+4|0;u=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if((c[(c[g>>2]|0)+4>>2]|0)<(c[(c[h>>2]|0)+4>>2]|0)){c[n>>2]=c[(c[h>>2]|0)+4>>2];c[q>>2]=c[(c[h>>2]|0)+8>>2];c[o>>2]=c[(c[g>>2]|0)+4>>2];c[r>>2]=c[(c[g>>2]|0)+8>>2];c[p>>2]=(c[n>>2]|0)+1;if((c[c[f>>2]>>2]|0)<(c[p>>2]|0))Ap(c[f>>2]|0,c[p>>2]|0);c[j>>2]=c[(c[h>>2]|0)+16>>2];c[k>>2]=c[(c[g>>2]|0)+16>>2]}else{c[n>>2]=c[(c[g>>2]|0)+4>>2];c[q>>2]=c[(c[g>>2]|0)+8>>2];c[o>>2]=c[(c[h>>2]|0)+4>>2];c[r>>2]=c[(c[h>>2]|0)+8>>2];c[p>>2]=(c[n>>2]|0)+1;if((c[c[f>>2]>>2]|0)<(c[p>>2]|0))Ap(c[f>>2]|0,c[p>>2]|0);c[j>>2]=c[(c[g>>2]|0)+16>>2];c[k>>2]=c[(c[h>>2]|0)+16>>2]}c[i>>2]=c[(c[f>>2]|0)+16>>2];c[s>>2]=0;do if(c[o>>2]|0){if((c[q>>2]|0)==(c[r>>2]|0)){c[u>>2]=Ho(c[i>>2]|0,c[j>>2]|0,c[n>>2]|0,c[k>>2]|0,c[o>>2]|0)|0;c[(c[i>>2]|0)+(c[n>>2]<<2)>>2]=c[u>>2];c[p>>2]=(c[n>>2]|0)+(c[u>>2]|0);if(!(c[q>>2]|0))break;c[s>>2]=1;break}if((c[n>>2]|0)!=(c[o>>2]|0)){Jo(c[i>>2]|0,c[j>>2]|0,c[n>>2]|0,c[k>>2]|0,c[o>>2]|0)|0;c[p>>2]=c[n>>2];while(1){if((c[p>>2]|0)<=0)break;if(c[(c[i>>2]|0)+((c[p>>2]|0)-1<<2)>>2]|0)break;c[p>>2]=(c[p>>2]|0)+-1}c[s>>2]=c[q>>2];break}h=(Ko(c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0)<0;g=c[i>>2]|0;if(h){rp(g,c[k>>2]|0,c[j>>2]|0,c[n>>2]|0)|0;c[p>>2]=c[n>>2];while(1){if((c[p>>2]|0)<=0)break;if(c[(c[i>>2]|0)+((c[p>>2]|0)-1<<2)>>2]|0)break;c[p>>2]=(c[p>>2]|0)+-1}if(c[q>>2]|0)break;c[s>>2]=1;break}else{rp(g,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0;c[p>>2]=c[n>>2];while(1){if((c[p>>2]|0)<=0)break;if(c[(c[i>>2]|0)+((c[p>>2]|0)-1<<2)>>2]|0)break;c[p>>2]=(c[p>>2]|0)+-1}if(!(c[q>>2]|0))break;c[s>>2]=1;break}}else{c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[n>>2]|0))break;c[(c[i>>2]|0)+(c[t>>2]<<2)>>2]=c[(c[j>>2]|0)+(c[t>>2]<<2)>>2];c[t>>2]=(c[t>>2]|0)+1}c[p>>2]=c[n>>2];c[s>>2]=c[q>>2]}while(0);c[(c[f>>2]|0)+4>>2]=c[p>>2];c[(c[f>>2]|0)+8>>2]=c[s>>2];l=e;return}function go(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+36|0;g=e+32|0;h=e+28|0;i=e+24|0;j=e+20|0;k=e+16|0;n=e+12|0;o=e+8|0;p=e+4|0;q=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[k>>2]=c[(c[g>>2]|0)+4>>2];c[o>>2]=c[(c[g>>2]|0)+8>>2];c[p>>2]=0;c[n>>2]=(c[k>>2]|0)+1;if((c[c[f>>2]>>2]|0)<(c[n>>2]|0))Ap(c[f>>2]|0,c[n>>2]|0);c[j>>2]=c[(c[g>>2]|0)+16>>2];c[i>>2]=c[(c[f>>2]|0)+16>>2];do if(c[k>>2]|0){if(c[o>>2]|0){c[q>>2]=Go(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[h>>2]|0)|0;c[(c[i>>2]|0)+(c[k>>2]<<2)>>2]=c[q>>2];c[n>>2]=(c[k>>2]|0)+(c[q>>2]|0);break}if((c[k>>2]|0)==1?(c[c[j>>2]>>2]|0)>>>0<(c[h>>2]|0)>>>0:0){c[c[i>>2]>>2]=(c[h>>2]|0)-(c[c[j>>2]>>2]|0);c[n>>2]=1;c[p>>2]=1;break}Io(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[h>>2]|0)|0;c[n>>2]=(c[k>>2]|0)-((c[(c[i>>2]|0)+((c[k>>2]|0)-1<<2)>>2]|0)==0&1)}else{c[c[i>>2]>>2]=c[h>>2];c[n>>2]=c[h>>2]|0?1:0;c[p>>2]=1}while(0);c[(c[f>>2]|0)+4>>2]=c[n>>2];c[(c[f>>2]|0)+8>>2]=c[p>>2];l=e;return}function ho(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=Ip(c[h>>2]|0)|0;c[(c[i>>2]|0)+8>>2]=((c[(c[i>>2]|0)+8>>2]|0)!=0^1)&1;fo(c[f>>2]|0,c[g>>2]|0,c[i>>2]|0);Dp(c[i>>2]|0);l=e;return}function io(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;fo(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);Mo(c[g>>2]|0,c[g>>2]|0,c[j>>2]|0);l=f;return}function jo(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;ho(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);Mo(c[g>>2]|0,c[g>>2]|0,c[j>>2]|0);l=f;return}function ko(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(c[d>>2]|0?c[(c[d>>2]|0)+12>>2]&4|0:0){l=b;return}while(1){if(!(c[(c[d>>2]|0)+4>>2]|0)){e=6;break}if(!((c[(c[(c[d>>2]|0)+16>>2]|0)+((c[(c[d>>2]|0)+4>>2]|0)-1<<2)>>2]|0)!=0^1)){e=6;break}a=(c[d>>2]|0)+4|0;c[a>>2]=(c[a>>2]|0)+-1}if((e|0)==6){l=b;return}}function lo(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=b+20|0;f=b+16|0;g=b+12|0;h=b+8|0;i=b+4|0;j=b;c[f>>2]=a;if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&4|0:0){c[e>>2]=c[(c[f>>2]|0)+8>>2];k=c[e>>2]|0;l=b;return k|0}ko(c[f>>2]|0);if(c[(c[f>>2]|0)+4>>2]|0){c[h>>2]=c[(c[(c[f>>2]|0)+16>>2]|0)+((c[(c[f>>2]|0)+4>>2]|0)-1<<2)>>2];if(c[h>>2]|0){c[i>>2]=c[h>>2];h=c[i>>2]|0;c[j>>2]=(c[i>>2]|0)>>>0<65536?(h>>>0<256?0:8):h>>>0<16777216?16:24;c[g>>2]=32-((d[45848+((c[i>>2]|0)>>>(c[j>>2]|0))>>0]|0)+(c[j>>2]|0))}else c[g>>2]=32;c[g>>2]=32-(c[g>>2]|0)+((c[(c[f>>2]|0)+4>>2]|0)-1<<5)}else c[g>>2]=0;c[e>>2]=c[g>>2];k=c[e>>2]|0;l=b;return k|0}function mo(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=((c[g>>2]|0)>>>0)/32|0;c[i>>2]=((c[g>>2]|0)>>>0)%32|0;if((c[h>>2]|0)>>>0>=(c[(c[f>>2]|0)+4>>2]|0)>>>0){c[e>>2]=0;k=c[e>>2]|0;l=d;return k|0}else{c[j>>2]=c[(c[(c[f>>2]|0)+16>>2]|0)+(c[h>>2]<<2)>>2];c[e>>2]=c[j>>2]&1<>2]|0?1:0;k=c[e>>2]|0;l=d;return k|0}return 0}function no(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=a;c[f>>2]=b;if(c[e>>2]|0?c[(c[e>>2]|0)+12>>2]&16|0:0){Cp();l=d;return}c[h>>2]=((c[f>>2]|0)>>>0)/32|0;c[i>>2]=((c[f>>2]|0)>>>0)%32|0;if((c[h>>2]|0)>>>0>=(c[(c[e>>2]|0)+4>>2]|0)>>>0){c[g>>2]=c[(c[e>>2]|0)+4>>2];while(1){if((c[g>>2]|0)>>>0>=(c[c[e>>2]>>2]|0)>>>0)break;c[(c[(c[e>>2]|0)+16>>2]|0)+(c[g>>2]<<2)>>2]=0;c[g>>2]=(c[g>>2]|0)+1}Ap(c[e>>2]|0,(c[h>>2]|0)+1|0);c[(c[e>>2]|0)+4>>2]=(c[h>>2]|0)+1}g=(c[(c[e>>2]|0)+16>>2]|0)+(c[h>>2]<<2)|0;c[g>>2]=c[g>>2]|1<>2];l=d;return}function oo(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=a;c[f>>2]=b;if(c[e>>2]|0?c[(c[e>>2]|0)+12>>2]&16|0:0){Cp();l=d;return}c[h>>2]=((c[f>>2]|0)>>>0)/32|0;c[i>>2]=((c[f>>2]|0)>>>0)%32|0;if((c[h>>2]|0)>>>0>=(c[(c[e>>2]|0)+4>>2]|0)>>>0){c[g>>2]=c[(c[e>>2]|0)+4>>2];while(1){if((c[g>>2]|0)>>>0>=(c[c[e>>2]>>2]|0)>>>0)break;c[(c[(c[e>>2]|0)+16>>2]|0)+(c[g>>2]<<2)>>2]=0;c[g>>2]=(c[g>>2]|0)+1}Ap(c[e>>2]|0,(c[h>>2]|0)+1|0);c[(c[e>>2]|0)+4>>2]=(c[h>>2]|0)+1}g=(c[(c[e>>2]|0)+16>>2]|0)+(c[h>>2]<<2)|0;c[g>>2]=c[g>>2]|1<>2];c[i>>2]=(c[i>>2]|0)+1;while(1){if((c[i>>2]|0)>>>0>=32)break;g=(c[(c[e>>2]|0)+16>>2]|0)+(c[h>>2]<<2)|0;c[g>>2]=c[g>>2]&~(1<>2]);c[i>>2]=(c[i>>2]|0)+1}c[(c[e>>2]|0)+4>>2]=(c[h>>2]|0)+1;l=d;return}function po(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;if(c[e>>2]|0?c[(c[e>>2]|0)+12>>2]&16|0:0){Cp();l=d;return}c[g>>2]=((c[f>>2]|0)>>>0)/32|0;c[h>>2]=((c[f>>2]|0)>>>0)%32|0;if((c[g>>2]|0)>>>0>=(c[(c[e>>2]|0)+4>>2]|0)>>>0){l=d;return}while(1){if((c[h>>2]|0)>>>0>=32)break;f=(c[(c[e>>2]|0)+16>>2]|0)+(c[g>>2]<<2)|0;c[f>>2]=c[f>>2]&~(1<>2]);c[h>>2]=(c[h>>2]|0)+1}c[(c[e>>2]|0)+4>>2]=(c[g>>2]|0)+1;l=d;return}function qo(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;if(c[e>>2]|0?c[(c[e>>2]|0)+12>>2]&16|0:0){Cp();l=d;return}c[g>>2]=((c[f>>2]|0)>>>0)/32|0;c[h>>2]=((c[f>>2]|0)>>>0)%32|0;if((c[g>>2]|0)>>>0>=(c[(c[e>>2]|0)+4>>2]|0)>>>0){l=d;return}f=(c[(c[e>>2]|0)+16>>2]|0)+(c[g>>2]<<2)|0;c[f>>2]=c[f>>2]&~(1<>2]);l=d;return}function ro(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[(c[e>>2]|0)+16>>2];c[h>>2]=c[(c[e>>2]|0)+4>>2];if(c[e>>2]|0?c[(c[e>>2]|0)+12>>2]&16|0:0){Cp();l=d;return}if((c[f>>2]|0)>>>0>=(c[h>>2]|0)>>>0){c[(c[e>>2]|0)+4>>2]=0;l=d;return}c[i>>2]=0;while(1){j=c[i>>2]|0;if((c[i>>2]|0)>>>0>=((c[h>>2]|0)-(c[f>>2]|0)|0)>>>0)break;c[(c[g>>2]|0)+(c[i>>2]<<2)>>2]=c[(c[g>>2]|0)+(j+(c[f>>2]|0)<<2)>>2];c[i>>2]=(c[i>>2]|0)+1}c[(c[g>>2]|0)+(j<<2)>>2]=0;j=(c[e>>2]|0)+4|0;c[j>>2]=(c[j>>2]|0)-(c[f>>2]|0);l=d;return}function so(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;n=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[k>>2]=((c[h>>2]|0)>>>0)/32|0;c[n>>2]=((c[h>>2]|0)>>>0)%32|0;if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&16|0:0){Cp();l=e;return}h=c[k>>2]|0;a:do if((c[f>>2]|0)==(c[g>>2]|0)){if(h>>>0>=(c[(c[f>>2]|0)+4>>2]|0)>>>0){c[(c[f>>2]|0)+4>>2]=0;l=e;return}if(c[k>>2]|0){c[j>>2]=0;while(1){o=c[j>>2]|0;if((c[j>>2]|0)>>>0>=((c[(c[f>>2]|0)+4>>2]|0)-(c[k>>2]|0)|0)>>>0)break;c[(c[(c[f>>2]|0)+16>>2]|0)+(c[j>>2]<<2)>>2]=c[(c[(c[f>>2]|0)+16>>2]|0)+(o+(c[k>>2]|0)<<2)>>2];c[j>>2]=(c[j>>2]|0)+1}c[(c[(c[f>>2]|0)+16>>2]|0)+(o<<2)>>2]=0;d=(c[f>>2]|0)+4|0;c[d>>2]=(c[d>>2]|0)-(c[k>>2]|0)}if(c[n>>2]|0?(c[(c[f>>2]|0)+4>>2]|0)!=0:0)qp(c[(c[f>>2]|0)+16>>2]|0,c[(c[f>>2]|0)+16>>2]|0,c[(c[f>>2]|0)+4>>2]|0,c[n>>2]|0)|0}else{c[i>>2]=c[(c[g>>2]|0)+4>>2];c[(c[f>>2]|0)+8>>2]=c[(c[g>>2]|0)+8>>2];d=(c[c[f>>2]>>2]|0)<(c[i>>2]|0);if(!h){if(d)Ap(c[f>>2]|0,c[i>>2]|0);c[(c[f>>2]|0)+4>>2]=c[i>>2];if(!(c[i>>2]|0))break;if(c[n>>2]|0){qp(c[(c[f>>2]|0)+16>>2]|0,c[(c[g>>2]|0)+16>>2]|0,c[(c[f>>2]|0)+4>>2]|0,c[n>>2]|0)|0;break}c[j>>2]=0;while(1){if((c[j>>2]|0)>>>0>=(c[(c[f>>2]|0)+4>>2]|0)>>>0)break a;c[(c[(c[f>>2]|0)+16>>2]|0)+(c[j>>2]<<2)>>2]=c[(c[(c[g>>2]|0)+16>>2]|0)+(c[j>>2]<<2)>>2];c[j>>2]=(c[j>>2]|0)+1}}if(d)Ap(c[f>>2]|0,c[i>>2]|0);c[(c[f>>2]|0)+4>>2]=c[i>>2];c[j>>2]=0;while(1){p=c[j>>2]|0;if((c[j>>2]|0)>>>0>=(c[(c[g>>2]|0)+4>>2]|0)>>>0)break;c[(c[(c[f>>2]|0)+16>>2]|0)+(c[j>>2]<<2)>>2]=c[(c[(c[g>>2]|0)+16>>2]|0)+(p<<2)>>2];c[j>>2]=(c[j>>2]|0)+1}c[(c[f>>2]|0)+4>>2]=p;if((c[k>>2]|0)>>>0>=(c[(c[f>>2]|0)+4>>2]|0)>>>0){c[(c[f>>2]|0)+4>>2]=0;l=e;return}if(c[k>>2]|0){c[j>>2]=0;while(1){q=c[j>>2]|0;if((c[j>>2]|0)>>>0>=((c[(c[f>>2]|0)+4>>2]|0)-(c[k>>2]|0)|0)>>>0)break;c[(c[(c[f>>2]|0)+16>>2]|0)+(c[j>>2]<<2)>>2]=c[(c[(c[f>>2]|0)+16>>2]|0)+(q+(c[k>>2]|0)<<2)>>2];c[j>>2]=(c[j>>2]|0)+1}c[(c[(c[f>>2]|0)+16>>2]|0)+(q<<2)>>2]=0;d=(c[f>>2]|0)+4|0;c[d>>2]=(c[d>>2]|0)-(c[k>>2]|0)}if(c[n>>2]|0?(c[(c[f>>2]|0)+4>>2]|0)!=0:0)qp(c[(c[f>>2]|0)+16>>2]|0,c[(c[f>>2]|0)+16>>2]|0,c[(c[f>>2]|0)+4>>2]|0,c[n>>2]|0)|0}while(0);while(1){if((c[(c[f>>2]|0)+4>>2]|0)<=0){r=40;break}if(c[(c[(c[f>>2]|0)+16>>2]|0)+((c[(c[f>>2]|0)+4>>2]|0)-1<<2)>>2]|0){r=40;break}n=(c[f>>2]|0)+4|0;c[n>>2]=(c[n>>2]|0)+-1}if((r|0)==40){l=e;return}}function to(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=a;c[f>>2]=b;c[h>>2]=c[(c[e>>2]|0)+4>>2];if(!((c[f>>2]|0)!=0&(c[h>>2]|0)!=0)){l=d;return}if((c[c[e>>2]>>2]|0)>>>0<((c[h>>2]|0)+(c[f>>2]|0)|0)>>>0)Ap(c[e>>2]|0,(c[h>>2]|0)+(c[f>>2]|0)|0);c[g>>2]=c[(c[e>>2]|0)+16>>2];c[i>>2]=(c[h>>2]|0)-1;while(1){if((c[i>>2]|0)<0)break;c[(c[g>>2]|0)+((c[i>>2]|0)+(c[f>>2]|0)<<2)>>2]=c[(c[g>>2]|0)+(c[i>>2]<<2)>>2];c[i>>2]=(c[i>>2]|0)+-1}c[i>>2]=0;while(1){if((c[i>>2]|0)>>>0>=(c[f>>2]|0)>>>0)break;c[(c[g>>2]|0)+(c[i>>2]<<2)>>2]=0;c[i>>2]=(c[i>>2]|0)+1}i=(c[e>>2]|0)+4|0;c[i>>2]=(c[i>>2]|0)+(c[f>>2]|0);l=d;return}function uo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+36|0;g=e+32|0;h=e+28|0;i=e+24|0;j=e+20|0;k=e+16|0;n=e+12|0;o=e+8|0;p=e+4|0;q=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=((c[h>>2]|0)>>>0)/32|0;c[j>>2]=((c[h>>2]|0)>>>0)%32|0;if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&16|0:0){Cp();l=e;return}if(!(c[h>>2]|0?1:(c[f>>2]|0)!=(c[g>>2]|0))){l=e;return}if((c[f>>2]|0)!=(c[g>>2]|0)){c[k>>2]=c[(c[g>>2]|0)+4>>2];c[n>>2]=c[(c[g>>2]|0)+8>>2];if((c[c[f>>2]>>2]|0)>>>0<((c[k>>2]|0)+(c[i>>2]|0)+1|0)>>>0)Ap(c[f>>2]|0,(c[k>>2]|0)+(c[i>>2]|0)+1|0);c[o>>2]=c[(c[f>>2]|0)+16>>2];c[p>>2]=c[(c[g>>2]|0)+16>>2];c[q>>2]=0;while(1){if((c[q>>2]|0)>>>0>=(c[k>>2]|0)>>>0)break;c[(c[o>>2]|0)+(c[q>>2]<<2)>>2]=c[(c[p>>2]|0)+(c[q>>2]<<2)>>2];c[q>>2]=(c[q>>2]|0)+1}c[(c[f>>2]|0)+4>>2]=c[k>>2];c[(c[f>>2]|0)+12>>2]=c[(c[g>>2]|0)+12>>2];c[(c[f>>2]|0)+8>>2]=c[n>>2]}if((c[i>>2]|0)==0|(c[j>>2]|0)!=0){if(c[h>>2]|0){to(c[f>>2]|0,(c[i>>2]|0)+1|0);so(c[f>>2]|0,c[f>>2]|0,32-(c[j>>2]|0)|0)}}else to(c[f>>2]|0,c[i>>2]|0);while(1){if((c[(c[f>>2]|0)+4>>2]|0)<=0){r=19;break}if(c[(c[(c[f>>2]|0)+16>>2]|0)+((c[(c[f>>2]|0)+4>>2]|0)-1<<2)>>2]|0){r=19;break}i=(c[f>>2]|0)+4|0;c[i>>2]=(c[i>>2]|0)+-1}if((r|0)==19){l=e;return}}function vo(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=c[g>>2];ko(c[f>>2]|0);do if(c[(c[f>>2]|0)+4>>2]|0){if(c[(c[f>>2]|0)+8>>2]|0){c[e>>2]=-1;break}if((c[(c[f>>2]|0)+4>>2]|0)!=1){c[e>>2]=1;break}if((c[c[(c[f>>2]|0)+16>>2]>>2]|0)>>>0>(c[h>>2]|0)>>>0){c[e>>2]=1;break}if((c[c[(c[f>>2]|0)+16>>2]>>2]|0)>>>0<(c[h>>2]|0)>>>0){c[e>>2]=-1;break}else{c[e>>2]=0;break}}else c[e>>2]=0-((c[h>>2]|0)!=0&1);while(0);l=d;return c[e>>2]|0}function wo(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0?(c[(c[f>>2]|0)+12>>2]&4|0)!=0:0))k=3;do if((k|0)==3){if(c[g>>2]|0?c[(c[g>>2]|0)+12>>2]&4|0:0)break;ko(c[f>>2]|0);ko(c[g>>2]|0);c[h>>2]=c[(c[f>>2]|0)+4>>2];c[i>>2]=c[(c[g>>2]|0)+4>>2];if((c[(c[f>>2]|0)+8>>2]|0)==0?c[(c[g>>2]|0)+8>>2]|0:0){c[e>>2]=1;n=c[e>>2]|0;l=d;return n|0}if(c[(c[f>>2]|0)+8>>2]|0?(c[(c[g>>2]|0)+8>>2]|0)==0:0){c[e>>2]=-1;n=c[e>>2]|0;l=d;return n|0}if(((c[h>>2]|0)!=(c[i>>2]|0)?(c[(c[f>>2]|0)+8>>2]|0)==0:0)?(c[(c[g>>2]|0)+8>>2]|0)==0:0){c[e>>2]=(c[h>>2]|0)-(c[i>>2]|0);n=c[e>>2]|0;l=d;return n|0}if(((c[h>>2]|0)!=(c[i>>2]|0)?c[(c[f>>2]|0)+8>>2]|0:0)?c[(c[g>>2]|0)+8>>2]|0:0){c[e>>2]=(c[i>>2]|0)+(c[h>>2]|0);n=c[e>>2]|0;l=d;return n|0}if(!(c[h>>2]|0)){c[e>>2]=0;n=c[e>>2]|0;l=d;return n|0}b=Ko(c[(c[f>>2]|0)+16>>2]|0,c[(c[g>>2]|0)+16>>2]|0,c[h>>2]|0)|0;c[j>>2]=b;if(!b){c[e>>2]=0;n=c[e>>2]|0;l=d;return n|0}if((((c[j>>2]|0)<0?1:0)|0)==((c[(c[f>>2]|0)+8>>2]|0?1:0)|0)){c[e>>2]=1;n=c[e>>2]|0;l=d;return n|0}else{c[e>>2]=-1;n=c[e>>2]|0;l=d;return n|0}}while(0);do if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&4|0:0){if(c[g>>2]|0?c[(c[g>>2]|0)+12>>2]&4|0:0)break;c[e>>2]=-1;n=c[e>>2]|0;l=d;return n|0}while(0);if(c[f>>2]|0){if(c[g>>2]|0?(c[(c[f>>2]|0)+12>>2]&4|0)==0:0)k=13}else if(c[g>>2]|0)k=13;if((k|0)==13?c[(c[g>>2]|0)+12>>2]&4|0:0){c[e>>2]=1;n=c[e>>2]|0;l=d;return n|0}if((c[(c[f>>2]|0)+8>>2]|0)==0?(c[(c[g>>2]|0)+8>>2]|0)==0:0){c[e>>2]=0;n=c[e>>2]|0;l=d;return n|0}if((c[(c[f>>2]|0)+8>>2]|0)<(c[(c[g>>2]|0)+8>>2]|0)){c[e>>2]=-1;n=c[e>>2]|0;l=d;return n|0}if((c[(c[f>>2]|0)+8>>2]|0)>(c[(c[g>>2]|0)+8>>2]|0)){c[e>>2]=1;n=c[e>>2]|0;l=d;return n|0}else{c[e>>2]=Jv(c[(c[f>>2]|0)+16>>2]|0,c[(c[g>>2]|0)+16>>2]|0,((c[(c[f>>2]|0)+8>>2]|0)+7|0)/8|0)|0;n=c[e>>2]|0;l=d;return n|0}return 0}function xo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[(c[h>>2]|0)+8>>2];c[j>>2]=0;if((c[f>>2]|0)==(c[h>>2]|0)){c[j>>2]=Ip(c[h>>2]|0)|0;c[h>>2]=c[j>>2]}yo(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);if((c[i>>2]|0?1:0)^(c[(c[g>>2]|0)+8>>2]|0?1:0)|0?c[(c[f>>2]|0)+4>>2]|0:0)fo(c[f>>2]|0,c[f>>2]|0,c[h>>2]|0);if(!(c[j>>2]|0)){l=e;return}Dp(c[j>>2]|0);l=e;return}function yo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;zo(0,c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function zo(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0;g=l;l=l+160|0;if((l|0)>=(m|0))$(160);h=g+144|0;i=g+140|0;j=g+136|0;k=g+132|0;n=g+128|0;o=g+124|0;p=g+120|0;q=g+116|0;r=g+112|0;s=g+108|0;t=g+104|0;u=g+100|0;v=g+96|0;w=g+92|0;x=g+88|0;y=g+84|0;z=g+64|0;A=g+44|0;B=g+40|0;C=g+36|0;D=g+32|0;E=g+28|0;F=g+24|0;G=g+20|0;H=g+16|0;I=g+12|0;J=g+8|0;K=g+4|0;L=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[r>>2]=c[(c[j>>2]|0)+4>>2];c[s>>2]=c[(c[k>>2]|0)+4>>2];c[v>>2]=c[(c[j>>2]|0)+8>>2];c[w>>2]=c[(c[j>>2]|0)+8>>2]^c[(c[k>>2]|0)+8>>2];c[B>>2]=0;c[u>>2]=(c[r>>2]|0)+1;Ap(c[i>>2]|0,c[u>>2]|0);c[t>>2]=(c[u>>2]|0)-(c[s>>2]|0);if((c[t>>2]|0)<=0){a:do if((c[j>>2]|0)!=(c[i>>2]|0)){c[(c[i>>2]|0)+4>>2]=c[(c[j>>2]|0)+4>>2];c[(c[i>>2]|0)+8>>2]=c[(c[j>>2]|0)+8>>2];c[C>>2]=0;while(1){if((c[C>>2]|0)>=(c[r>>2]|0))break a;c[(c[(c[i>>2]|0)+16>>2]|0)+(c[C>>2]<<2)>>2]=c[(c[(c[j>>2]|0)+16>>2]|0)+(c[C>>2]<<2)>>2];c[C>>2]=(c[C>>2]|0)+1}}while(0);if(!(c[h>>2]|0)){l=g;return}c[(c[h>>2]|0)+4>>2]=0;c[(c[h>>2]|0)+8>>2]=0;l=g;return}if(c[h>>2]|0)Ap(c[h>>2]|0,c[t>>2]|0);c[n>>2]=c[(c[j>>2]|0)+16>>2];c[o>>2]=c[(c[k>>2]|0)+16>>2];c[q>>2]=c[(c[i>>2]|0)+16>>2];j=(c[h>>2]|0)!=0;if((c[s>>2]|0)==1){if(j){c[p>>2]=c[(c[h>>2]|0)+16>>2];c[D>>2]=hp(c[p>>2]|0,c[n>>2]|0,c[r>>2]|0,c[c[o>>2]>>2]|0)|0;c[t>>2]=(c[t>>2]|0)-((c[(c[p>>2]|0)+((c[t>>2]|0)-1<<2)>>2]|0)==0&1);c[(c[h>>2]|0)+4>>2]=c[t>>2];c[(c[h>>2]|0)+8>>2]=c[w>>2]}else c[D>>2]=fp(c[n>>2]|0,c[r>>2]|0,c[c[o>>2]>>2]|0)|0;c[c[q>>2]>>2]=c[D>>2];c[u>>2]=c[D>>2]|0?1:0;c[(c[i>>2]|0)+4>>2]=c[u>>2];c[(c[i>>2]|0)+8>>2]=c[v>>2];l=g;return}b:do if(j){c[p>>2]=c[(c[h>>2]|0)+16>>2];if((c[p>>2]|0)==(c[n>>2]|0)){c[A+(c[B>>2]<<2)>>2]=c[r>>2];if(c[h>>2]|0)M=(c[(c[h>>2]|0)+12>>2]&1|0)!=0;else M=0;D=wp(c[r>>2]|0,M&1)|0;C=c[B>>2]|0;c[B>>2]=C+1;c[z+(C<<2)>>2]=D;c[n>>2]=D;c[E>>2]=0;while(1){if((c[E>>2]|0)>=(c[r>>2]|0))break b;c[(c[n>>2]|0)+(c[E>>2]<<2)>>2]=c[(c[p>>2]|0)+(c[E>>2]<<2)>>2];c[E>>2]=(c[E>>2]|0)+1}}}else c[p>>2]=(c[q>>2]|0)+(c[s>>2]<<2);while(0);c[F>>2]=c[(c[o>>2]|0)+((c[s>>2]|0)-1<<2)>>2];E=c[F>>2]|0;c[G>>2]=(c[F>>2]|0)>>>0<65536?(E>>>0<256?0:8):E>>>0<16777216?16:24;c[x>>2]=32-((d[45848+((c[F>>2]|0)>>>(c[G>>2]|0))>>0]|0)+(c[G>>2]|0));do if(c[x>>2]|0){c[A+(c[B>>2]<<2)>>2]=c[s>>2];if(c[k>>2]|0)N=(c[(c[k>>2]|0)+12>>2]&1|0)!=0;else N=0;G=wp(c[s>>2]|0,N&1)|0;F=c[B>>2]|0;c[B>>2]=F+1;c[z+(F<<2)>>2]=G;c[H>>2]=G;ip(c[H>>2]|0,c[o>>2]|0,c[s>>2]|0,c[x>>2]|0)|0;c[o>>2]=c[H>>2];c[I>>2]=ip(c[q>>2]|0,c[n>>2]|0,c[r>>2]|0,c[x>>2]|0)|0;if(c[I>>2]|0){c[(c[q>>2]|0)+(c[r>>2]<<2)>>2]=c[I>>2];c[u>>2]=(c[r>>2]|0)+1;break}else{c[u>>2]=c[r>>2];break}}else{if((c[o>>2]|0)!=(c[q>>2]|0)){if(c[h>>2]|0?(c[o>>2]|0)==(c[p>>2]|0):0)O=32}else O=32;if((O|0)==32){c[A+(c[B>>2]<<2)>>2]=c[s>>2];if(c[k>>2]|0)P=(c[(c[k>>2]|0)+12>>2]&1|0)!=0;else P=0;G=wp(c[s>>2]|0,P&1)|0;F=c[B>>2]|0;c[B>>2]=F+1;c[z+(F<<2)>>2]=G;c[J>>2]=G;c[K>>2]=0;while(1){if((c[K>>2]|0)>=(c[s>>2]|0))break;c[(c[J>>2]|0)+(c[K>>2]<<2)>>2]=c[(c[o>>2]|0)+(c[K>>2]<<2)>>2];c[K>>2]=(c[K>>2]|0)+1}c[o>>2]=c[J>>2]}c:do if((c[q>>2]|0)!=(c[n>>2]|0)){c[L>>2]=0;while(1){if((c[L>>2]|0)>=(c[r>>2]|0))break c;c[(c[q>>2]|0)+(c[L>>2]<<2)>>2]=c[(c[n>>2]|0)+(c[L>>2]<<2)>>2];c[L>>2]=(c[L>>2]|0)+1}}while(0);c[u>>2]=c[r>>2]}while(0);c[y>>2]=gp(c[p>>2]|0,0,c[q>>2]|0,c[u>>2]|0,c[o>>2]|0,c[s>>2]|0)|0;if(c[h>>2]|0){c[t>>2]=(c[u>>2]|0)-(c[s>>2]|0);if(c[y>>2]|0){c[(c[p>>2]|0)+(c[t>>2]<<2)>>2]=c[y>>2];c[t>>2]=(c[t>>2]|0)+1}c[(c[h>>2]|0)+4>>2]=c[t>>2];c[(c[h>>2]|0)+8>>2]=c[w>>2]}c[u>>2]=c[s>>2];while(1){if((c[u>>2]|0)<=0)break;if(c[(c[q>>2]|0)+((c[u>>2]|0)-1<<2)>>2]|0)break;c[u>>2]=(c[u>>2]|0)+-1}if((c[x>>2]|0)!=0&(c[u>>2]|0)!=0){qp(c[q>>2]|0,c[q>>2]|0,c[u>>2]|0,c[x>>2]|0)|0;c[u>>2]=(c[u>>2]|0)-((c[(c[q>>2]|0)+((c[u>>2]|0)-1<<2)>>2]|0)==0?1:0)}c[(c[i>>2]|0)+4>>2]=c[u>>2];c[(c[i>>2]|0)+8>>2]=c[v>>2];while(1){if(!(c[B>>2]|0))break;c[B>>2]=(c[B>>2]|0)+-1;yp(c[z+(c[B>>2]<<2)>>2]|0,c[A+(c[B>>2]<<2)>>2]|0)}l=g;return}function Ao(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=fp(c[(c[g>>2]|0)+16>>2]|0,c[(c[g>>2]|0)+4>>2]|0,c[h>>2]|0)|0;if(c[i>>2]|0?c[(c[g>>2]|0)+8>>2]|0:0)c[i>>2]=(c[h>>2]|0)-(c[i>>2]|0);if(!(c[f>>2]|0)){j=c[i>>2]|0;l=e;return j|0}c[c[(c[f>>2]|0)+16>>2]>>2]=c[i>>2];c[(c[f>>2]|0)+4>>2]=c[i>>2]|0?1:0;j=c[i>>2]|0;l=e;return j|0}function Bo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=vp(c[(c[f>>2]|0)+4>>2]|0)|0;Co(c[f>>2]|0,c[i>>2]|0,c[g>>2]|0,c[h>>2]|0);Dp(c[i>>2]|0);l=e;return}function Co(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;n=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=c[(c[j>>2]|0)+8>>2];c[n>>2]=0;if(!((c[g>>2]|0)!=(c[j>>2]|0)?(c[h>>2]|0)!=(c[j>>2]|0):0)){c[n>>2]=Ip(c[j>>2]|0)|0;c[j>>2]=c[n>>2]}zo(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);if(c[k>>2]^c[(c[i>>2]|0)+8>>2]|0?c[(c[h>>2]|0)+4>>2]|0:0){go(c[g>>2]|0,c[g>>2]|0,1);fo(c[h>>2]|0,c[h>>2]|0,c[j>>2]|0)}if(!(c[n>>2]|0)){l=f;return}Dp(c[n>>2]|0);l=f;return}function Do(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+32|0;g=e+28|0;h=e+24|0;i=e+20|0;j=e+16|0;k=e+12|0;n=e+8|0;o=e+4|0;p=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[(c[g>>2]|0)+4>>2];c[k>>2]=((c[h>>2]|0)>>>0)/32|0;c[j>>2]=(c[i>>2]|0)-(c[k>>2]|0);d=c[f>>2]|0;if((c[k>>2]|0)>=(c[i>>2]|0)){c[d+4>>2]=0;l=e;return}if((c[d>>2]|0)<(c[j>>2]|0))Ap(c[f>>2]|0,c[j>>2]|0);c[n>>2]=c[(c[f>>2]|0)+16>>2];c[o>>2]=c[(c[g>>2]|0)+16>>2];c[h>>2]=((c[h>>2]|0)>>>0)%32|0;a:do if(c[h>>2]|0){qp(c[n>>2]|0,(c[o>>2]|0)+(c[k>>2]<<2)|0,c[j>>2]|0,c[h>>2]|0)|0;c[j>>2]=(c[j>>2]|0)-(((c[(c[n>>2]|0)+((c[j>>2]|0)-1<<2)>>2]|0)!=0^1)&1)}else{c[p>>2]=0;while(1){if((c[p>>2]|0)>=(c[j>>2]|0))break a;c[(c[n>>2]|0)+(c[p>>2]<<2)>>2]=c[(c[o>>2]|0)+(c[k>>2]<<2)+(c[p>>2]<<2)>>2];c[p>>2]=(c[p>>2]|0)+1}}while(0);c[(c[f>>2]|0)+4>>2]=c[j>>2];l=e;return}function Eo(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=((fp(c[(c[e>>2]|0)+16>>2]|0,c[(c[e>>2]|0)+4>>2]|0,c[f>>2]|0)|0)!=0^1)&1;l=d;return b|0}function Fo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=Ip(c[g>>2]|0)|0;c[j>>2]=Ip(c[h>>2]|0)|0;c[(c[i>>2]|0)+8>>2]=0;c[(c[j>>2]|0)+8>>2]=0;while(1){h=(vo(c[j>>2]|0,0)|0)!=0;k=c[f>>2]|0;n=c[i>>2]|0;if(!h)break;xo(k,n,c[j>>2]|0);Kp(c[i>>2]|0,c[j>>2]|0)|0;Kp(c[j>>2]|0,c[f>>2]|0)|0}Kp(k,n)|0;Dp(c[i>>2]|0);Dp(c[j>>2]|0);j=((vo(c[f>>2]|0,1)|0)!=0^1)&1;l=e;return j|0}function Go(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+24|0;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;n=f+4|0;o=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;e=c[i>>2]|0;c[i>>2]=e+4;c[n>>2]=c[e>>2];c[k>>2]=(c[k>>2]|0)+(c[n>>2]|0);e=c[k>>2]|0;d=c[h>>2]|0;c[h>>2]=d+4;c[d>>2]=e;a:do if((c[k>>2]|0)>>>0<(c[n>>2]|0)>>>0){while(1){e=(c[j>>2]|0)+-1|0;c[j>>2]=e;if(!e)break;e=c[i>>2]|0;c[i>>2]=e+4;c[n>>2]=(c[e>>2]|0)+1;e=c[n>>2]|0;d=c[h>>2]|0;c[h>>2]=d+4;c[d>>2]=e;if(c[n>>2]|0)break a}c[g>>2]=1;p=c[g>>2]|0;l=f;return p|0}while(0);b:do if((c[h>>2]|0)!=(c[i>>2]|0)){c[o>>2]=0;while(1){if((c[o>>2]|0)>=((c[j>>2]|0)-1|0))break b;c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]=c[(c[i>>2]|0)+(c[o>>2]<<2)>>2];c[o>>2]=(c[o>>2]|0)+1}}while(0);c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}function Ho(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;n=g+4|0;o=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=0;if(c[n>>2]|0)c[o>>2]=ep(c[h>>2]|0,c[i>>2]|0,c[k>>2]|0,c[n>>2]|0)|0;if(!((c[j>>2]|0)-(c[n>>2]|0)|0)){p=c[o>>2]|0;l=g;return p|0}c[o>>2]=Go((c[h>>2]|0)+(c[n>>2]<<2)|0,(c[i>>2]|0)+(c[n>>2]<<2)|0,(c[j>>2]|0)-(c[n>>2]|0)|0,c[o>>2]|0)|0;p=c[o>>2]|0;l=g;return p|0}function Io(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+24|0;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;n=f+4|0;o=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;e=c[i>>2]|0;c[i>>2]=e+4;c[n>>2]=c[e>>2];c[k>>2]=(c[n>>2]|0)-(c[k>>2]|0);e=c[k>>2]|0;d=c[h>>2]|0;c[h>>2]=d+4;c[d>>2]=e;a:do if((c[k>>2]|0)>>>0>(c[n>>2]|0)>>>0){while(1){e=(c[j>>2]|0)+-1|0;c[j>>2]=e;if(!e)break;e=c[i>>2]|0;c[i>>2]=e+4;c[n>>2]=c[e>>2];e=(c[n>>2]|0)-1|0;d=c[h>>2]|0;c[h>>2]=d+4;c[d>>2]=e;if(c[n>>2]|0)break a}c[g>>2]=1;p=c[g>>2]|0;l=f;return p|0}while(0);b:do if((c[h>>2]|0)!=(c[i>>2]|0)){c[o>>2]=0;while(1){if((c[o>>2]|0)>=((c[j>>2]|0)-1|0))break b;c[(c[h>>2]|0)+(c[o>>2]<<2)>>2]=c[(c[i>>2]|0)+(c[o>>2]<<2)>>2];c[o>>2]=(c[o>>2]|0)+1}}while(0);c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}function Jo(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;n=g+4|0;o=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=0;if(c[n>>2]|0)c[o>>2]=rp(c[h>>2]|0,c[i>>2]|0,c[k>>2]|0,c[n>>2]|0)|0;if(!((c[j>>2]|0)-(c[n>>2]|0)|0)){p=c[o>>2]|0;l=g;return p|0}c[o>>2]=Io((c[h>>2]|0)+(c[n>>2]<<2)|0,(c[i>>2]|0)+(c[n>>2]<<2)|0,(c[j>>2]|0)-(c[n>>2]|0)|0,c[o>>2]|0)|0;p=c[o>>2]|0;l=g;return p|0}function Ko(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;n=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=(c[i>>2]|0)-1;while(1){if((c[j>>2]|0)<0){o=5;break}c[k>>2]=c[(c[g>>2]|0)+(c[j>>2]<<2)>>2];c[n>>2]=c[(c[h>>2]|0)+(c[j>>2]<<2)>>2];if((c[k>>2]|0)!=(c[n>>2]|0)){o=6;break}c[j>>2]=(c[j>>2]|0)+-1}if((o|0)==5){c[f>>2]=0;p=c[f>>2]|0;l=e;return p|0}else if((o|0)==6){c[f>>2]=(c[k>>2]|0)>>>0>(c[n>>2]|0)>>>0?1:-1;p=c[f>>2]|0;l=e;return p|0}return 0}function Lo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+68|0;g=e+64|0;h=e+60|0;i=e+56|0;j=e+52|0;k=e+48|0;n=e+44|0;o=e+40|0;p=e+36|0;q=e+32|0;r=e+28|0;s=e+24|0;t=e+20|0;u=e+16|0;v=e+12|0;w=e+8|0;x=e+4|0;y=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[o>>2]=0;c[r>>2]=0;c[u>>2]=0;if(!(vo(c[h>>2]|0,0)|0)){c[f>>2]=0;z=c[f>>2]|0;l=e;return z|0}if(!(vo(c[i>>2]|0,1)|0)){c[f>>2]=0;z=c[f>>2]|0;l=e;return z|0}c[j>>2]=Ip(c[h>>2]|0)|0;c[k>>2]=Ip(c[i>>2]|0)|0;c[w>>2]=0;while(1){if(mo(c[j>>2]|0,0)|0)break;if(!((mo(c[k>>2]|0,0)|0)!=0^1))break;so(c[j>>2]|0,c[j>>2]|0,1);so(c[k>>2]|0,c[k>>2]|0,1);c[w>>2]=(c[w>>2]|0)+1}c[y>>2]=mo(c[k>>2]|0,0)|0;c[n>>2]=up(1)|0;if(!(c[y>>2]|0))c[o>>2]=up(0)|0;c[p>>2]=Ip(c[j>>2]|0)|0;c[q>>2]=Ip(c[k>>2]|0)|0;if(!(c[y>>2]|0)){c[r>>2]=vp(c[(c[j>>2]|0)+4>>2]|0)|0;ho(c[r>>2]|0,c[n>>2]|0,c[j>>2]|0)}c[s>>2]=Ip(c[k>>2]|0)|0;if(mo(c[j>>2]|0,0)|0){c[t>>2]=up(0)|0;if(!(c[y>>2]|0)){c[u>>2]=up(1)|0;c[(c[u>>2]|0)+8>>2]=1}c[v>>2]=Ip(c[k>>2]|0)|0;c[(c[v>>2]|0)+8>>2]=((c[(c[v>>2]|0)+8>>2]|0)!=0^1)&1}else{c[t>>2]=up(1)|0;if(!(c[y>>2]|0))c[u>>2]=up(0)|0;c[v>>2]=Ip(c[j>>2]|0)|0;A=20}while(1){if((A|0)==20){A=0;w=(c[y>>2]|0)!=0;i=(mo(c[t>>2]|0,0)|0)!=0;if(w){if(i)fo(c[t>>2]|0,c[t>>2]|0,c[k>>2]|0);so(c[t>>2]|0,c[t>>2]|0,1);so(c[v>>2]|0,c[v>>2]|0,1);continue}if(!(!i?!(mo(c[u>>2]|0,0)|0):0)){fo(c[t>>2]|0,c[t>>2]|0,c[k>>2]|0);ho(c[u>>2]|0,c[u>>2]|0,c[j>>2]|0)}so(c[t>>2]|0,c[t>>2]|0,1);so(c[u>>2]|0,c[u>>2]|0,1);so(c[v>>2]|0,c[v>>2]|0,1)}if((mo(c[v>>2]|0,0)|0)!=0^1){A=20;continue}if(c[(c[v>>2]|0)+8>>2]|0){ho(c[q>>2]|0,c[k>>2]|0,c[t>>2]|0);c[x>>2]=c[(c[j>>2]|0)+8>>2];c[(c[j>>2]|0)+8>>2]=((c[(c[j>>2]|0)+8>>2]|0)!=0^1)&1;if(!(c[y>>2]|0))ho(c[r>>2]|0,c[j>>2]|0,c[u>>2]|0);c[(c[j>>2]|0)+8>>2]=c[x>>2];c[x>>2]=c[(c[v>>2]|0)+8>>2];c[(c[v>>2]|0)+8>>2]=((c[(c[v>>2]|0)+8>>2]|0)!=0^1)&1;Kp(c[s>>2]|0,c[v>>2]|0)|0;c[(c[v>>2]|0)+8>>2]=c[x>>2]}else{Kp(c[n>>2]|0,c[t>>2]|0)|0;if(!(c[y>>2]|0))Kp(c[o>>2]|0,c[u>>2]|0)|0;Kp(c[p>>2]|0,c[v>>2]|0)|0}ho(c[t>>2]|0,c[n>>2]|0,c[q>>2]|0);if(!(c[y>>2]|0))ho(c[u>>2]|0,c[o>>2]|0,c[r>>2]|0);ho(c[v>>2]|0,c[p>>2]|0,c[s>>2]|0);if(c[(c[t>>2]|0)+8>>2]|0?(fo(c[t>>2]|0,c[t>>2]|0,c[k>>2]|0),(c[y>>2]|0)==0):0)ho(c[u>>2]|0,c[u>>2]|0,c[j>>2]|0);if(vo(c[v>>2]|0,0)|0)A=20;else break}Kp(c[g>>2]|0,c[n>>2]|0)|0;Dp(c[n>>2]|0);Dp(c[q>>2]|0);Dp(c[t>>2]|0);if(!(c[y>>2]|0)){Dp(c[o>>2]|0);Dp(c[r>>2]|0);Dp(c[u>>2]|0)}Dp(c[p>>2]|0);Dp(c[s>>2]|0);Dp(c[v>>2]|0);Dp(c[j>>2]|0);Dp(c[k>>2]|0);c[f>>2]=1;z=c[f>>2]|0;l=e;return z|0}function Mo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;xo(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function No(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;ko(c[e>>2]|0);c[g>>2]=Cf(1,28)|0;b=c[e>>2]|0;if(c[f>>2]|0){f=Ip(b)|0;c[c[g>>2]>>2]=f;c[(c[g>>2]|0)+4>>2]=1}else c[c[g>>2]>>2]=b;c[(c[g>>2]|0)+8>>2]=c[(c[e>>2]|0)+4>>2];c[h>>2]=vp((c[(c[g>>2]|0)+8>>2]|0)+1|0)|0;Op(c[h>>2]|0,1)|0;to(c[h>>2]|0,c[(c[g>>2]|0)+8>>2]<<1);Bo(c[h>>2]|0,c[h>>2]|0,c[e>>2]|0);c[(c[g>>2]|0)+12>>2]=c[h>>2];h=vp((c[(c[g>>2]|0)+8>>2]<<1)+1|0)|0;c[(c[g>>2]|0)+16>>2]=h;h=vp((c[(c[g>>2]|0)+8>>2]<<1)+1|0)|0;c[(c[g>>2]|0)+20>>2]=h;l=d;return c[g>>2]|0}function Oo(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(!(c[d>>2]|0)){l=b;return}Dp(c[(c[d>>2]|0)+12>>2]|0);Dp(c[(c[d>>2]|0)+16>>2]|0);Dp(c[(c[d>>2]|0)+20>>2]|0);if(c[(c[d>>2]|0)+24>>2]|0)Dp(c[(c[d>>2]|0)+24>>2]|0);if(c[(c[d>>2]|0)+4>>2]|0)Dp(c[c[d>>2]>>2]|0);vf(c[d>>2]|0);l=b;return}function Po(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+32|0;g=e+28|0;h=e+24|0;i=e+20|0;j=e+16|0;k=e+12|0;n=e+8|0;o=e+4|0;p=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[c[h>>2]>>2];c[j>>2]=c[(c[h>>2]|0)+8>>2];c[k>>2]=c[(c[h>>2]|0)+12>>2];c[n>>2]=c[(c[h>>2]|0)+16>>2];c[o>>2]=c[(c[h>>2]|0)+20>>2];ko(c[g>>2]|0);if((c[(c[g>>2]|0)+4>>2]|0)>(c[j>>2]<<1|0)){Mo(c[f>>2]|0,c[g>>2]|0,c[i>>2]|0);l=e;return}c[p>>2]=c[(c[g>>2]|0)+8>>2];c[(c[g>>2]|0)+8>>2]=0;Kp(c[o>>2]|0,c[g>>2]|0)|0;ro(c[o>>2]|0,(c[j>>2]|0)-1|0);Qo(c[o>>2]|0,c[o>>2]|0,c[k>>2]|0);ro(c[o>>2]|0,(c[j>>2]|0)+1|0);Kp(c[n>>2]|0,c[g>>2]|0)|0;if((c[(c[n>>2]|0)+4>>2]|0)>((c[j>>2]|0)+1|0))c[(c[n>>2]|0)+4>>2]=(c[j>>2]|0)+1;Qo(c[o>>2]|0,c[o>>2]|0,c[i>>2]|0);if((c[(c[o>>2]|0)+4>>2]|0)>((c[j>>2]|0)+1|0))c[(c[o>>2]|0)+4>>2]=(c[j>>2]|0)+1;ho(c[f>>2]|0,c[n>>2]|0,c[o>>2]|0);if(c[(c[f>>2]|0)+8>>2]|0){if(!(c[(c[h>>2]|0)+24>>2]|0)){o=vp((c[j>>2]|0)+2|0)|0;c[(c[h>>2]|0)+24>>2]=o;Op(c[(c[h>>2]|0)+24>>2]|0,1)|0;to(c[(c[h>>2]|0)+24>>2]|0,(c[j>>2]|0)+1|0)}fo(c[f>>2]|0,c[f>>2]|0,c[(c[h>>2]|0)+24>>2]|0)}while(1){if((wo(c[f>>2]|0,c[i>>2]|0)|0)<0)break;ho(c[f>>2]|0,c[f>>2]|0,c[i>>2]|0)}c[(c[g>>2]|0)+8>>2]=c[p>>2];l=e;return}function Qo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;e=l;l=l+96|0;if((l|0)>=(m|0))$(96);f=e+84|0;g=e+80|0;h=e+76|0;i=e+72|0;j=e+68|0;k=e+64|0;n=e+60|0;o=e+56|0;p=e+52|0;q=e+48|0;r=e+44|0;s=e+40|0;t=e+36|0;u=e+32|0;v=e+28|0;w=e+24|0;x=e+20|0;y=e+16|0;z=e+12|0;A=e+8|0;B=e+4|0;C=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;if((c[(c[g>>2]|0)+4>>2]|0)<(c[(c[h>>2]|0)+4>>2]|0)){c[i>>2]=c[(c[h>>2]|0)+4>>2];c[r>>2]=c[(c[h>>2]|0)+8>>2];if(c[h>>2]|0)D=(c[(c[h>>2]|0)+12>>2]&1|0)!=0;else D=0;c[t>>2]=D&1;c[n>>2]=c[(c[h>>2]|0)+16>>2];c[j>>2]=c[(c[g>>2]|0)+4>>2];c[s>>2]=c[(c[g>>2]|0)+8>>2];if(c[g>>2]|0)E=(c[(c[g>>2]|0)+12>>2]&1|0)!=0;else E=0;c[u>>2]=E&1;c[o>>2]=c[(c[g>>2]|0)+16>>2]}else{c[i>>2]=c[(c[g>>2]|0)+4>>2];c[r>>2]=c[(c[g>>2]|0)+8>>2];if(c[g>>2]|0)F=(c[(c[g>>2]|0)+12>>2]&1|0)!=0;else F=0;c[t>>2]=F&1;c[n>>2]=c[(c[g>>2]|0)+16>>2];c[j>>2]=c[(c[h>>2]|0)+4>>2];c[s>>2]=c[(c[h>>2]|0)+8>>2];if(c[h>>2]|0)G=(c[(c[h>>2]|0)+12>>2]&1|0)!=0;else G=0;c[u>>2]=G&1;c[o>>2]=c[(c[h>>2]|0)+16>>2]}c[v>>2]=c[r>>2]^c[s>>2];c[p>>2]=c[(c[f>>2]|0)+16>>2];c[k>>2]=(c[i>>2]|0)+(c[j>>2]|0);if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&1|0:0)H=19;else H=14;do if((H|0)==14){if(!(c[g>>2]|0?(c[(c[g>>2]|0)+12>>2]&1|0)!=0:0)){if(!(c[h>>2]|0)){H=19;break}if(!(c[(c[h>>2]|0)+12>>2]&1)){H=19;break}}c[p>>2]=wp(c[k>>2]|0,1)|0;c[w>>2]=2}while(0);a:do if((H|0)==19){h=(c[p>>2]|0)==(c[n>>2]|0);if((c[c[f>>2]>>2]|0)<(c[k>>2]|0)){if(!h?(c[p>>2]|0)!=(c[o>>2]|0):0){Ap(c[f>>2]|0,c[k>>2]|0);c[p>>2]=c[(c[f>>2]|0)+16>>2];break}if(c[f>>2]|0)I=(c[(c[f>>2]|0)+12>>2]&1|0)!=0;else I=0;c[p>>2]=wp(c[k>>2]|0,I&1)|0;c[w>>2]=1;break}if(!h){if((c[p>>2]|0)!=(c[o>>2]|0))break;c[y>>2]=c[j>>2];h=wp(c[j>>2]|0,c[u>>2]|0)|0;c[x>>2]=h;c[o>>2]=h;c[A>>2]=0;while(1){if((c[A>>2]|0)>=(c[j>>2]|0))break a;c[(c[o>>2]|0)+(c[A>>2]<<2)>>2]=c[(c[p>>2]|0)+(c[A>>2]<<2)>>2];c[A>>2]=(c[A>>2]|0)+1}}c[y>>2]=c[i>>2];h=wp(c[i>>2]|0,c[t>>2]|0)|0;c[x>>2]=h;c[n>>2]=h;if((c[p>>2]|0)==(c[o>>2]|0))c[o>>2]=c[n>>2];c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[i>>2]|0))break a;c[(c[n>>2]|0)+(c[z>>2]<<2)>>2]=c[(c[p>>2]|0)+(c[z>>2]<<2)>>2];c[z>>2]=(c[z>>2]|0)+1}}while(0);if(c[j>>2]|0){c[q>>2]=op(c[p>>2]|0,c[n>>2]|0,c[i>>2]|0,c[o>>2]|0,c[j>>2]|0)|0;c[k>>2]=(c[k>>2]|0)-(c[q>>2]|0?0:1)}else c[k>>2]=0;if(c[w>>2]|0){if((c[w>>2]|0)==2){c[B>>2]=wp(c[k>>2]|0,0)|0;c[C>>2]=0;while(1){if((c[C>>2]|0)>=(c[k>>2]|0))break;c[(c[B>>2]|0)+(c[C>>2]<<2)>>2]=c[(c[p>>2]|0)+(c[C>>2]<<2)>>2];c[C>>2]=(c[C>>2]|0)+1}yp(c[p>>2]|0,0);c[p>>2]=c[B>>2]}zp(c[f>>2]|0,c[p>>2]|0,c[k>>2]|0)}c[(c[f>>2]|0)+4>>2]=c[k>>2];c[(c[f>>2]|0)+8>>2]=c[v>>2];if(!(c[x>>2]|0)){l=e;return}yp(c[x>>2]|0,c[y>>2]|0);l=e;return}function Ro(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;Qo(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);yo(c[g>>2]|0,c[g>>2]|0,c[j>>2]|0);l=f;return}function So(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;g=l;l=l+512|0;if((l|0)>=(m|0))$(512);h=g+504|0;i=g+500|0;j=g+496|0;k=g+492|0;n=g+488|0;o=g+484|0;p=g+480|0;q=g+476|0;r=g+472|0;s=g+468|0;t=g+464|0;u=g+460|0;v=g+456|0;w=g+452|0;x=g+448|0;y=g+444|0;z=g+440|0;A=g+436|0;B=g+432|0;C=g+428|0;D=g+424|0;E=g+420|0;F=g+416|0;G=g+412|0;H=g+408|0;I=g+404|0;J=g+400|0;K=g+396|0;L=g+392|0;M=g+328|0;N=g+264|0;O=g+260|0;P=g+256|0;Q=g+252|0;R=g+248|0;S=g+244|0;T=g+240|0;U=g+236|0;V=g+232|0;W=g+228|0;X=g+224|0;Y=g+220|0;Z=g+216|0;_=g+212|0;aa=g+208|0;ba=g+204|0;ca=g+200|0;da=g+196|0;ea=g+192|0;fa=g+164|0;ga=g+160|0;ha=g+156|0;ia=g+152|0;ja=g+148|0;ka=g+144|0;la=g+140|0;ma=g+136|0;na=g+132|0;oa=g+128|0;pa=g+124|0;qa=g+120|0;ra=g+116|0;sa=g+112|0;ta=g+108|0;ua=g+104|0;va=g+100|0;wa=g+80|0;xa=g+60|0;ya=g+56|0;za=g+52|0;Aa=g+48|0;Ba=g+44|0;Ca=g+24|0;Da=g+4|0;Ea=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[E>>2]=0;c[F>>2]=0;c[G>>2]=0;c[H>>2]=0;c[I>>2]=0;c[J>>2]=0;c[K>>2]=0;c[L>>2]=0;c[r>>2]=c[(c[j>>2]|0)+4>>2];c[s>>2]=c[(c[k>>2]|0)+4>>2];c[B>>2]=c[s>>2]<<1;c[v>>2]=c[(c[k>>2]|0)+8>>2];do if((c[r>>2]<<5|0)<=512){if((c[r>>2]<<5|0)>256){c[O>>2]=4;break}if((c[r>>2]<<5|0)>128){c[O>>2]=3;break}if((c[r>>2]<<5|0)>64){c[O>>2]=2;break}else{c[O>>2]=1;break}}else c[O>>2]=5;while(0);if(c[j>>2]|0)Fa=(c[(c[j>>2]|0)+12>>2]&1|0)!=0;else Fa=0;c[y>>2]=Fa&1;if(c[k>>2]|0)Ga=(c[(c[k>>2]|0)+12>>2]&1|0)!=0;else Ga=0;c[z>>2]=Ga&1;if(c[i>>2]|0)Ha=(c[(c[i>>2]|0)+12>>2]&1|0)!=0;else Ha=0;c[A>>2]=Ha&1;c[n>>2]=c[(c[h>>2]|0)+16>>2];c[o>>2]=c[(c[j>>2]|0)+16>>2];if(!(c[s>>2]|0))df();do if(c[r>>2]|0){c[I>>2]=c[z>>2]|0?c[s>>2]|0:0;j=wp(c[s>>2]|0,c[z>>2]|0)|0;c[E>>2]=j;c[p>>2]=j;c[S>>2]=c[(c[(c[k>>2]|0)+16>>2]|0)+((c[s>>2]|0)-1<<2)>>2];j=c[S>>2]|0;c[T>>2]=(c[S>>2]|0)>>>0<65536?(j>>>0<256?0:8):j>>>0<16777216?16:24;c[C>>2]=32-((d[45848+((c[S>>2]|0)>>>(c[T>>2]|0))>>0]|0)+(c[T>>2]|0));a:do if(c[C>>2]|0)ip(c[p>>2]|0,c[(c[k>>2]|0)+16>>2]|0,c[s>>2]|0,c[C>>2]|0)|0;else{c[U>>2]=0;while(1){if((c[U>>2]|0)>=(c[s>>2]|0))break a;c[(c[p>>2]|0)+(c[U>>2]<<2)>>2]=c[(c[(c[k>>2]|0)+16>>2]|0)+(c[U>>2]<<2)>>2];c[U>>2]=(c[U>>2]|0)+1}}while(0);c[t>>2]=c[(c[i>>2]|0)+4>>2];c[w>>2]=c[(c[i>>2]|0)+8>>2];b:do if((c[t>>2]|0)>(c[s>>2]|0)){c[J>>2]=c[A>>2]|0?(c[t>>2]|0)+1|0:0;j=wp((c[t>>2]|0)+1|0,c[A>>2]|0)|0;c[F>>2]=j;c[q>>2]=j;c[V>>2]=0;while(1){if((c[V>>2]|0)>=(c[t>>2]|0))break;c[(c[q>>2]|0)+(c[V>>2]<<2)>>2]=c[(c[(c[i>>2]|0)+16>>2]|0)+(c[V>>2]<<2)>>2];c[V>>2]=(c[V>>2]|0)+1}gp((c[q>>2]|0)+(c[s>>2]<<2)|0,0,c[q>>2]|0,c[t>>2]|0,c[p>>2]|0,c[s>>2]|0)|0;c[t>>2]=c[s>>2];while(1){if((c[t>>2]|0)<=0)break b;if(c[(c[q>>2]|0)+((c[t>>2]|0)-1<<2)>>2]|0)break b;c[t>>2]=(c[t>>2]|0)+-1}}else c[q>>2]=c[(c[i>>2]|0)+16>>2];while(0);if(!(c[t>>2]|0)){c[(c[h>>2]|0)+4>>2]=0;c[(c[h>>2]|0)+8>>2]=0;break}c:do if((c[n>>2]|0)==(c[q>>2]|0)){if(c[F>>2]|0)Se(46104,46115,515,46125);c[J>>2]=c[A>>2]|0?c[t>>2]|0:0;j=wp(c[t>>2]|0,c[A>>2]|0)|0;c[F>>2]=j;c[q>>2]=j;c[W>>2]=0;while(1){if((c[W>>2]|0)>=(c[t>>2]|0))break c;c[(c[q>>2]|0)+(c[W>>2]<<2)>>2]=c[(c[n>>2]|0)+(c[W>>2]<<2)>>2];c[W>>2]=(c[W>>2]|0)+1}}while(0);d:do if((c[n>>2]|0)==(c[o>>2]|0)){c[K>>2]=c[y>>2]|0?c[r>>2]|0:0;j=wp(c[r>>2]|0,c[y>>2]|0)|0;c[G>>2]=j;c[o>>2]=j;c[X>>2]=0;while(1){if((c[X>>2]|0)>=(c[r>>2]|0))break d;c[(c[o>>2]|0)+(c[X>>2]<<2)>>2]=c[(c[n>>2]|0)+(c[X>>2]<<2)>>2];c[X>>2]=(c[X>>2]|0)+1}}while(0);if((c[c[h>>2]>>2]|0)<(c[B>>2]|0)){Ap(c[h>>2]|0,c[B>>2]|0);c[n>>2]=c[(c[h>>2]|0)+16>>2]}if(c[z>>2]|0)Ia=(c[s>>2]|0)+1<<1;else Ia=0;c[L>>2]=Ia;j=wp((c[s>>2]|0)+1<<1,c[z>>2]|0)|0;c[H>>2]=j;c[aa>>2]=j;c[fa>>2]=0;c[fa+4>>2]=0;c[fa+8>>2]=0;c[fa+12>>2]=0;c[fa+16>>2]=0;c[fa+20>>2]=0;c[fa+24>>2]=0;c[D>>2]=(c[c[o>>2]>>2]&1|0?(c[w>>2]|0)!=0:0)&1;if((c[O>>2]|0)>1)To(c[aa>>2]|0,ba,c[q>>2]|0,c[t>>2]|0,c[q>>2]|0,c[t>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);j=wp(c[t>>2]|0,c[y>>2]|0)|0;c[M>>2]=j;c[P>>2]=j;j=c[t>>2]|0;c[N>>2]=j;c[R>>2]=j;c[Q>>2]=j;c[ha>>2]=0;while(1){if((c[ha>>2]|0)>=(c[t>>2]|0))break;c[(c[M>>2]|0)+(c[ha>>2]<<2)>>2]=c[(c[q>>2]|0)+(c[ha>>2]<<2)>>2];c[ha>>2]=(c[ha>>2]|0)+1}c[Y>>2]=1;while(1){if((c[Y>>2]|0)>=(1<<(c[O>>2]|0)-1|0))break;j=c[n>>2]|0;if((c[ba>>2]|0)>=(c[Q>>2]|0))To(j,u,c[aa>>2]|0,c[ba>>2]|0,c[P>>2]|0,c[Q>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);else To(j,u,c[P>>2]|0,c[Q>>2]|0,c[aa>>2]|0,c[ba>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);j=wp(c[u>>2]|0,c[y>>2]|0)|0;c[M+(c[Y>>2]<<2)>>2]=j;c[P>>2]=j;j=c[u>>2]|0;c[N+(c[Y>>2]<<2)>>2]=j;c[Q>>2]=j;if((c[R>>2]|0)<(c[Q>>2]|0))c[R>>2]=c[Q>>2];c[ia>>2]=0;while(1){if((c[ia>>2]|0)>=(c[u>>2]|0))break;c[(c[M+(c[Y>>2]<<2)>>2]|0)+(c[ia>>2]<<2)>>2]=c[(c[n>>2]|0)+(c[ia>>2]<<2)>>2];c[ia>>2]=(c[ia>>2]|0)+1}c[Y>>2]=(c[Y>>2]|0)+1}c[P>>2]=wp(c[R>>2]|0,c[y>>2]|0)|0;c[ja>>2]=0;while(1){if((c[ja>>2]|0)>=(c[R>>2]|0))break;c[(c[P>>2]|0)+(c[ja>>2]<<2)>>2]=0;c[ja>>2]=(c[ja>>2]|0)+1}c[Y>>2]=(c[r>>2]|0)-1;c[x>>2]=0;e:do if((c[O>>2]|0)==1)c[u>>2]=c[t>>2];else{c[u>>2]=c[s>>2];c[ka>>2]=0;while(1){if((c[ka>>2]|0)>=(c[u>>2]|0))break e;c[(c[n>>2]|0)+(c[ka>>2]<<2)>>2]=0;c[ka>>2]=(c[ka>>2]|0)+1}}while(0);c[la>>2]=0;while(1){if((c[la>>2]|0)>=(c[t>>2]|0))break;c[(c[n>>2]|0)+(c[la>>2]<<2)>>2]=c[(c[q>>2]|0)+(c[la>>2]<<2)>>2];c[la>>2]=(c[la>>2]|0)+1}c[da>>2]=c[(c[o>>2]|0)+(c[Y>>2]<<2)>>2];c[ma>>2]=c[da>>2];j=c[ma>>2]|0;c[na>>2]=(c[ma>>2]|0)>>>0<65536?(j>>>0<256?0:8):j>>>0<16777216?16:24;c[ca>>2]=32-((d[45848+((c[ma>>2]|0)>>>(c[na>>2]|0))>>0]|0)+(c[na>>2]|0));c[da>>2]=c[da>>2]<>2]<<1;c[ca>>2]=31-(c[ca>>2]|0);c[Z>>2]=0;while(1){if(!(c[da>>2]|0)){c[Z>>2]=(c[Z>>2]|0)+(c[ca>>2]|0);c[Y>>2]=(c[Y>>2]|0)+-1;if((c[Y>>2]|0)<0){Ja=86;break}c[da>>2]=c[(c[o>>2]|0)+(c[Y>>2]<<2)>>2];c[ca>>2]=32;continue}c[qa>>2]=c[da>>2];j=c[qa>>2]|0;c[ra>>2]=(c[qa>>2]|0)>>>0<65536?(j>>>0<256?0:8):j>>>0<16777216?16:24;c[oa>>2]=32-((d[45848+((c[qa>>2]|0)>>>(c[ra>>2]|0))>>0]|0)+(c[ra>>2]|0));c[da>>2]=c[da>>2]<>2];c[ca>>2]=(c[ca>>2]|0)-(c[oa>>2]|0);c[Z>>2]=(c[Z>>2]|0)+(c[oa>>2]|0);if((c[ca>>2]|0)>=(c[O>>2]|0)){c[pa>>2]=(c[da>>2]|0)>>>(32-(c[O>>2]|0)|0);c[da>>2]=c[da>>2]<>2];c[ca>>2]=(c[ca>>2]|0)-(c[O>>2]|0)}else{c[Y>>2]=(c[Y>>2]|0)+-1;if((c[Y>>2]|0)<0){Ja=91;break}c[oa>>2]=c[ca>>2];c[pa>>2]=(c[da>>2]|0)>>>(32-(c[O>>2]|0)|0)|(c[(c[o>>2]|0)+(c[Y>>2]<<2)>>2]|0)>>>(32-(c[O>>2]|0)+(c[oa>>2]|0)|0);c[da>>2]=c[(c[o>>2]|0)+(c[Y>>2]<<2)>>2]<<(c[O>>2]|0)-(c[oa>>2]|0);c[ca>>2]=32-(c[O>>2]|0)+(c[oa>>2]|0)}c[sa>>2]=c[pa>>2];c[ua>>2]=c[sa>>2]&0-(c[sa>>2]|0);j=c[ua>>2]|0;c[va>>2]=(c[ua>>2]|0)>>>0<65536?(j>>>0<256?0:8):j>>>0<16777216?16:24;c[ta>>2]=32-((d[45848+((c[ua>>2]|0)>>>(c[va>>2]|0))>>0]|0)+(c[va>>2]|0));c[oa>>2]=31-(c[ta>>2]|0);c[pa>>2]=(c[pa>>2]|0)>>>(c[oa>>2]|0)>>>1;c[Z>>2]=(c[Z>>2]|0)+((c[O>>2]|0)-(c[oa>>2]|0));while(1){if(!(c[Z>>2]|0))break;To(c[aa>>2]|0,ba,c[n>>2]|0,c[u>>2]|0,c[n>>2]|0,c[u>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);c[ga>>2]=c[n>>2];c[n>>2]=c[aa>>2];c[aa>>2]=c[ga>>2];c[u>>2]=c[ba>>2];c[Z>>2]=(c[Z>>2]|0)+-1}c[Q>>2]=0;c[_>>2]=0;while(1){if((c[_>>2]|0)>=(1<<(c[O>>2]|0)-1|0))break;j=c[N+(c[_>>2]<<2)>>2]|0;c[wa+4>>2]=j;c[wa>>2]=j;j=c[N+(c[_>>2]<<2)>>2]|0;c[xa+4>>2]=j;c[xa>>2]=j;c[xa+8>>2]=0;c[wa+8>>2]=0;c[xa+12>>2]=0;c[wa+12>>2]=0;c[wa+16>>2]=c[P>>2];c[xa+16>>2]=c[M+(c[_>>2]<<2)>>2];Np(wa,xa,(c[_>>2]|0)==(c[pa>>2]|0)&1)|0;c[Q>>2]=c[Q>>2]|c[N+(c[_>>2]<<2)>>2]&0-((c[_>>2]|0)==(c[pa>>2]|0)&1);c[_>>2]=(c[_>>2]|0)+1}To(c[aa>>2]|0,ba,c[n>>2]|0,c[u>>2]|0,c[P>>2]|0,c[Q>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);c[ga>>2]=c[n>>2];c[n>>2]=c[aa>>2];c[aa>>2]=c[ga>>2];c[u>>2]=c[ba>>2];c[Z>>2]=c[oa>>2]}if((Ja|0)==86)c[ca>>2]=0;else if((Ja|0)==91)c[da>>2]=(c[da>>2]|0)>>>(32-(c[ca>>2]|0)|0);if(c[ca>>2]|0){c[Z>>2]=(c[Z>>2]|0)+(c[ca>>2]|0);c[ya>>2]=c[da>>2];c[Aa>>2]=c[ya>>2]&0-(c[ya>>2]|0);j=c[Aa>>2]|0;c[Ba>>2]=(c[Aa>>2]|0)>>>0<65536?(j>>>0<256?0:8):j>>>0<16777216?16:24;c[za>>2]=32-((d[45848+((c[Aa>>2]|0)>>>(c[Ba>>2]|0))>>0]|0)+(c[Ba>>2]|0));c[ca>>2]=31-(c[za>>2]|0);c[da>>2]=(c[da>>2]|0)>>>(c[ca>>2]|0);c[Z>>2]=(c[Z>>2]|0)-(c[ca>>2]|0)}while(1){j=c[Z>>2]|0;c[Z>>2]=j+-1;if(!j)break;To(c[aa>>2]|0,ba,c[n>>2]|0,c[u>>2]|0,c[n>>2]|0,c[u>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);c[ga>>2]=c[n>>2];c[n>>2]=c[aa>>2];c[aa>>2]=c[ga>>2];c[u>>2]=c[ba>>2]}f:do if(c[da>>2]|0){c[Q>>2]=0;c[_>>2]=0;while(1){if((c[_>>2]|0)>=(1<<(c[O>>2]|0)-1|0))break;j=c[N+(c[_>>2]<<2)>>2]|0;c[Ca+4>>2]=j;c[Ca>>2]=j;j=c[N+(c[_>>2]<<2)>>2]|0;c[Da+4>>2]=j;c[Da>>2]=j;c[Da+8>>2]=0;c[Ca+8>>2]=0;c[Da+12>>2]=0;c[Ca+12>>2]=0;c[Ca+16>>2]=c[P>>2];c[Da+16>>2]=c[M+(c[_>>2]<<2)>>2];Np(Ca,Da,(c[_>>2]|0)==((c[da>>2]|0)>>>1|0)&1)|0;c[Q>>2]=c[Q>>2]|c[N+(c[_>>2]<<2)>>2]&0-((c[_>>2]|0)==((c[da>>2]|0)>>>1|0)&1);c[_>>2]=(c[_>>2]|0)+1}To(c[aa>>2]|0,ba,c[n>>2]|0,c[u>>2]|0,c[P>>2]|0,c[Q>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);c[ga>>2]=c[n>>2];c[n>>2]=c[aa>>2];c[aa>>2]=c[ga>>2];c[u>>2]=c[ba>>2];while(1){if(!(c[ca>>2]|0))break f;To(c[aa>>2]|0,ba,c[n>>2]|0,c[u>>2]|0,c[n>>2]|0,c[u>>2]|0,c[p>>2]|0,c[s>>2]|0,fa);c[ga>>2]=c[n>>2];c[n>>2]=c[aa>>2];c[aa>>2]=c[ga>>2];c[u>>2]=c[ba>>2];c[ca>>2]=(c[ca>>2]|0)+-1}}while(0);j=c[(c[h>>2]|0)+16>>2]|0;Ha=c[n>>2]|0;do if(c[C>>2]|0){c[ea>>2]=ip(j,Ha,c[u>>2]|0,c[C>>2]|0)|0;c[n>>2]=c[(c[h>>2]|0)+16>>2];if(!(c[ea>>2]|0))break;c[(c[n>>2]|0)+(c[u>>2]<<2)>>2]=c[ea>>2];c[u>>2]=(c[u>>2]|0)+1}else{if((j|0)==(Ha|0))break;c[Ea>>2]=0;while(1){if((c[Ea>>2]|0)>=(c[u>>2]|0))break;c[(c[(c[h>>2]|0)+16>>2]|0)+(c[Ea>>2]<<2)>>2]=c[(c[n>>2]|0)+(c[Ea>>2]<<2)>>2];c[Ea>>2]=(c[Ea>>2]|0)+1}c[n>>2]=c[(c[h>>2]|0)+16>>2]}while(0);if((c[u>>2]|0)>=(c[s>>2]|0)){gp((c[n>>2]|0)+(c[s>>2]<<2)|0,0,c[n>>2]|0,c[u>>2]|0,c[p>>2]|0,c[s>>2]|0)|0;c[u>>2]=c[s>>2]}if(c[C>>2]|0)qp(c[n>>2]|0,c[n>>2]|0,c[u>>2]|0,c[C>>2]|0)|0;while(1){if((c[u>>2]|0)<=0)break;if(c[(c[n>>2]|0)+((c[u>>2]|0)-1<<2)>>2]|0)break;c[u>>2]=(c[u>>2]|0)+-1}pp(fa);c[Y>>2]=0;while(1){if((c[Y>>2]|0)>=(1<<(c[O>>2]|0)-1|0))break;if(c[y>>2]|0)Ka=c[N+(c[Y>>2]<<2)>>2]|0;else Ka=0;yp(c[M+(c[Y>>2]<<2)>>2]|0,Ka);c[Y>>2]=(c[Y>>2]|0)+1}yp(c[P>>2]|0,c[y>>2]|0?c[R>>2]|0:0);g:do if((c[D>>2]|0)!=0&(c[u>>2]|0)!=0){if(c[C>>2]|0)qp(c[p>>2]|0,c[p>>2]|0,c[s>>2]|0,c[C>>2]|0)|0;Jo(c[n>>2]|0,c[p>>2]|0,c[s>>2]|0,c[n>>2]|0,c[u>>2]|0)|0;c[u>>2]=c[s>>2];c[x>>2]=c[v>>2];while(1){if((c[u>>2]|0)<=0)break g;if(c[(c[n>>2]|0)+((c[u>>2]|0)-1<<2)>>2]|0)break g;c[u>>2]=(c[u>>2]|0)+-1}}while(0);if((c[(c[h>>2]|0)+16>>2]|0)==(c[n>>2]|0)){c[(c[h>>2]|0)+4>>2]=c[u>>2];c[(c[h>>2]|0)+8>>2]=c[x>>2];break}else Se(46140,46115,786,46125)}else{if((c[s>>2]|0)==1)La=(c[c[(c[k>>2]|0)+16>>2]>>2]|0)==1;else La=0;c[(c[h>>2]|0)+4>>2]=La?0:1;if(c[(c[h>>2]|0)+4>>2]|0){if((c[c[h>>2]>>2]|0)<1)Ap(c[h>>2]|0,1);c[n>>2]=c[(c[h>>2]|0)+16>>2];c[c[n>>2]>>2]=1}c[(c[h>>2]|0)+8>>2]=0}while(0);if(c[E>>2]|0)yp(c[E>>2]|0,c[I>>2]|0);if(c[F>>2]|0)yp(c[F>>2]|0,c[J>>2]|0);if(c[G>>2]|0)yp(c[G>>2]|0,c[K>>2]|0);if(!(c[H>>2]|0)){l=g;return}yp(c[H>>2]|0,c[L>>2]|0);l=g;return}function To(a,b,d,e,f,g,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;k=l;l=l+48|0;if((l|0)>=(m|0))$(48);n=k+32|0;o=k+28|0;p=k+24|0;q=k+20|0;r=k+16|0;s=k+12|0;t=k+8|0;u=k+4|0;v=k;c[n>>2]=a;c[o>>2]=b;c[p>>2]=d;c[q>>2]=e;c[r>>2]=f;c[s>>2]=g;c[t>>2]=h;c[u>>2]=i;c[v>>2]=j;j=c[n>>2]|0;i=c[p>>2]|0;p=c[q>>2]|0;h=c[r>>2]|0;r=c[s>>2]|0;if((c[s>>2]|0)<16)op(j,i,p,h,r)|0;else np(j,i,p,h,r,c[v>>2]|0);if(((c[q>>2]|0)+(c[s>>2]|0)|0)>(c[u>>2]|0)){gp((c[n>>2]|0)+(c[u>>2]<<2)|0,0,c[n>>2]|0,(c[q>>2]|0)+(c[s>>2]|0)|0,c[t>>2]|0,c[u>>2]|0)|0;c[c[o>>2]>>2]=c[u>>2];l=k;return}else{c[c[o>>2]>>2]=(c[q>>2]|0)+(c[s>>2]|0);l=k;return}}function Uo(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;b=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=b+32|0;f=b+28|0;g=b+24|0;h=b+20|0;i=b+16|0;j=b+12|0;k=b+8|0;n=b+4|0;o=b;c[e>>2]=a;c[g>>2]=0;c[f>>2]=0;while(1){if((c[f>>2]|0)>>>0>=(c[(c[e>>2]|0)+4>>2]|0)>>>0){p=6;break}if(c[(c[(c[e>>2]|0)+16>>2]|0)+(c[f>>2]<<2)>>2]|0)break;c[g>>2]=(c[g>>2]|0)+32;c[f>>2]=(c[f>>2]|0)+1}if((p|0)==6){q=c[g>>2]|0;l=b;return q|0}c[i>>2]=c[(c[(c[e>>2]|0)+16>>2]|0)+(c[f>>2]<<2)>>2];c[j>>2]=c[i>>2];c[n>>2]=c[j>>2]&0-(c[j>>2]|0);j=c[n>>2]|0;c[o>>2]=(c[n>>2]|0)>>>0<65536?(j>>>0<256?0:8):j>>>0<16777216?16:24;c[k>>2]=32-((d[45848+((c[n>>2]|0)>>>(c[o>>2]|0))>>0]|0)+(c[o>>2]|0));c[h>>2]=31-(c[k>>2]|0);c[g>>2]=(c[g>>2]|0)+(c[h>>2]|0);q=c[g>>2]|0;l=b;return q|0}function Vo(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=Wo(c[g>>2]|0,c[h>>2]|0,0,c[i>>2]|0,c[j>>2]|0,0)|0;l=f;return e|0}function Wo(b,e,f,g,h,i){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;j=l;l=l+64|0;if((l|0)>=(m|0))$(64);k=j+60|0;n=j+56|0;o=j+52|0;p=j+48|0;q=j+44|0;r=j+40|0;s=j+36|0;t=j+32|0;u=j+28|0;v=j+24|0;w=j+20|0;x=j+16|0;y=j+12|0;z=j+8|0;A=j+4|0;B=j;c[n>>2]=b;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;if(c[r>>2]|0)c[c[r>>2]>>2]=c[(c[n>>2]|0)+8>>2];c[c[q>>2]>>2]=c[(c[n>>2]|0)+4>>2]<<2;if(c[c[q>>2]>>2]|0)C=c[c[q>>2]>>2]|0;else C=1;c[A>>2]=C;if((c[A>>2]|0)>>>0<(c[o>>2]|0)>>>0)c[A>>2]=c[o>>2];C=c[A>>2]|0;A=c[p>>2]|0;if((c[p>>2]|0)<0)c[B>>2]=C+(0-A);else c[B>>2]=C+A;do if(c[s>>2]|0)D=13;else{if(c[n>>2]|0?c[(c[n>>2]|0)+12>>2]&1|0:0){D=13;break}E=pf(c[B>>2]|0)|0}while(0);if((D|0)==13)E=sf(c[B>>2]|0)|0;c[v>>2]=E;if(!(c[v>>2]|0)){c[k>>2]=0;F=c[k>>2]|0;l=j;return F|0}E=c[v>>2]|0;if((c[p>>2]|0)<0)c[u>>2]=E+(0-(c[p>>2]|0));else c[u>>2]=E;c[t>>2]=c[u>>2];c[z>>2]=(c[(c[n>>2]|0)+4>>2]|0)-1;while(1){if((c[z>>2]|0)<0)break;c[y>>2]=c[(c[(c[n>>2]|0)+16>>2]|0)+(c[z>>2]<<2)>>2];E=(c[y>>2]|0)>>>24&255;p=c[t>>2]|0;c[t>>2]=p+1;a[p>>0]=E;E=(c[y>>2]|0)>>>16&255;p=c[t>>2]|0;c[t>>2]=p+1;a[p>>0]=E;E=(c[y>>2]|0)>>>8&255;p=c[t>>2]|0;c[t>>2]=p+1;a[p>>0]=E;E=c[y>>2]&255;p=c[t>>2]|0;c[t>>2]=p+1;a[p>>0]=E;c[z>>2]=(c[z>>2]|0)+-1}if(c[o>>2]|0){c[w>>2]=c[c[q>>2]>>2];c[z>>2]=0;while(1){if((c[z>>2]|0)>>>0>=(((c[w>>2]|0)>>>0)/2|0)>>>0)break;c[x>>2]=d[(c[u>>2]|0)+(c[z>>2]|0)>>0];a[(c[u>>2]|0)+(c[z>>2]|0)>>0]=a[(c[u>>2]|0)+((c[w>>2]|0)-1-(c[z>>2]|0))>>0]|0;a[(c[u>>2]|0)+((c[w>>2]|0)-1-(c[z>>2]|0))>>0]=c[x>>2];c[z>>2]=(c[z>>2]|0)+1}c[t>>2]=(c[u>>2]|0)+(c[w>>2]|0);while(1){if((c[w>>2]|0)>>>0>=(c[o>>2]|0)>>>0)break;z=c[t>>2]|0;c[t>>2]=z+1;a[z>>0]=0;c[w>>2]=(c[w>>2]|0)+1}c[c[q>>2]>>2]=c[w>>2];c[k>>2]=c[v>>2];F=c[k>>2]|0;l=j;return F|0}else{c[t>>2]=c[u>>2];while(1){if(!(c[c[q>>2]>>2]|0))break;if(!((a[c[t>>2]>>0]|0)!=0^1))break;c[t>>2]=(c[t>>2]|0)+1;w=c[q>>2]|0;c[w>>2]=(c[w>>2]|0)+-1}if((c[t>>2]|0)!=(c[u>>2]|0))$w(c[u>>2]|0,c[t>>2]|0,c[c[q>>2]>>2]|0)|0;c[k>>2]=c[v>>2];F=c[k>>2]|0;l=j;return F|0}return 0}function Xo(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=Wo(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,0)|0;l=g;return f|0}function Yo(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+32|0;i=g+28|0;j=g+24|0;k=g+20|0;n=g+16|0;o=g+12|0;p=g+8|0;q=g+4|0;r=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=c[i>>2];if(c[h>>2]|0?c[(c[h>>2]|0)+12>>2]&16|0:0){Cp();l=g;return}c[q>>2]=(((c[j>>2]|0)+4-1|0)>>>0)/4|0;if((c[c[h>>2]>>2]|0)<(c[q>>2]|0))Ap(c[h>>2]|0,c[q>>2]|0);c[(c[h>>2]|0)+8>>2]=c[k>>2];c[r>>2]=0;c[o>>2]=(c[n>>2]|0)+(c[j>>2]|0)+-1;while(1){s=c[o>>2]|0;if((c[o>>2]|0)>>>0<((c[n>>2]|0)+4|0)>>>0)break;c[o>>2]=s+-1;c[p>>2]=d[s>>0];j=c[o>>2]|0;c[o>>2]=j+-1;c[p>>2]=c[p>>2]|(d[j>>0]|0)<<8;j=c[o>>2]|0;c[o>>2]=j+-1;c[p>>2]=c[p>>2]|(d[j>>0]|0)<<16;j=c[o>>2]|0;c[o>>2]=j+-1;c[p>>2]=c[p>>2]|(d[j>>0]|0)<<24;j=c[p>>2]|0;k=c[r>>2]|0;c[r>>2]=k+1;c[(c[(c[h>>2]|0)+16>>2]|0)+(k<<2)>>2]=j}if(s>>>0>=(c[n>>2]|0)>>>0){s=c[o>>2]|0;c[o>>2]=s+-1;c[p>>2]=d[s>>0];if((c[o>>2]|0)>>>0>=(c[n>>2]|0)>>>0){s=c[o>>2]|0;c[o>>2]=s+-1;c[p>>2]=c[p>>2]|(d[s>>0]|0)<<8}if((c[o>>2]|0)>>>0>=(c[n>>2]|0)>>>0){s=c[o>>2]|0;c[o>>2]=s+-1;c[p>>2]=c[p>>2]|(d[s>>0]|0)<<16}if((c[o>>2]|0)>>>0>=(c[n>>2]|0)>>>0){n=c[o>>2]|0;c[o>>2]=n+-1;c[p>>2]=c[p>>2]|(d[n>>0]|0)<<24}n=c[p>>2]|0;p=c[r>>2]|0;c[r>>2]=p+1;c[(c[(c[h>>2]|0)+16>>2]|0)+(p<<2)>>2]=n}c[(c[h>>2]|0)+4>>2]=c[r>>2];if((c[r>>2]|0)==(c[q>>2]|0)){l=g;return}else Se(46153,46165,377,46176)}function Zo(a,b,e,f,g){a=a|0;b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;h=l;l=l+64|0;if((l|0)>=(m|0))$(64);i=h+48|0;j=h+44|0;k=h+40|0;n=h+36|0;o=h+32|0;p=h+28|0;q=h+24|0;r=h+20|0;s=h+16|0;t=h+12|0;u=h+8|0;v=h+4|0;w=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=c[n>>2];c[r>>2]=0;if(c[q>>2]|0)x=(tf(c[q>>2]|0)|0)!=0;else x=0;c[t>>2]=x&1;if((c[k>>2]|0)==3)c[s>>2]=0;else c[s>>2]=c[o>>2];if((c[k>>2]|0)==1){c[u>>2]=c[q>>2];x=(((c[s>>2]|0)+4-1|0)>>>0)/4|0;if(c[t>>2]|0)y=xp(x)|0;else y=vp(x)|0;c[r>>2]=y;if(c[s>>2]|0?(Yo(c[r>>2]|0,c[u>>2]|0,c[s>>2]|0,0),c[(c[r>>2]|0)+8>>2]=(((d[c[u>>2]>>0]|0)&128|0)!=0^1^1)&1,c[(c[r>>2]|0)+8>>2]|0):0){_o(c[r>>2]|0);eo(c[r>>2]|0,c[r>>2]|0,1);c[(c[r>>2]|0)+8>>2]=1}u=c[r>>2]|0;if(c[j>>2]|0){ko(u);c[c[j>>2]>>2]=c[r>>2]}else Dp(u);if(c[p>>2]|0)c[c[p>>2]>>2]=c[s>>2];c[i>>2]=0;z=c[i>>2]|0;l=h;return z|0}if((c[k>>2]|0)==5){u=(((c[s>>2]|0)+4-1|0)>>>0)/4|0;if(c[t>>2]|0)A=xp(u)|0;else A=vp(u)|0;c[r>>2]=A;if(c[s>>2]|0)Yo(c[r>>2]|0,c[q>>2]|0,c[s>>2]|0,0);A=c[r>>2]|0;if(c[j>>2]|0){ko(A);c[c[j>>2]>>2]=c[r>>2]}else Dp(A);if(c[p>>2]|0)c[c[p>>2]>>2]=c[s>>2];c[i>>2]=0;z=c[i>>2]|0;l=h;return z|0}if((c[k>>2]|0)==2){c[r>>2]=$o(c[q>>2]|0,s,c[t>>2]|0)|0;if(c[p>>2]|0)c[c[p>>2]>>2]=c[s>>2];A=c[r>>2]|0;if(!((c[j>>2]|0)!=0&(c[r>>2]|0)!=0)){if(A|0){Dp(c[r>>2]|0);c[r>>2]=0}}else{ko(A);c[c[j>>2]>>2]=c[r>>2]}c[i>>2]=c[r>>2]|0?0:65;z=c[i>>2]|0;l=h;return z|0}if((c[k>>2]|0)!=3){if((c[k>>2]|0)!=4){c[i>>2]=45;z=c[i>>2]|0;l=h;return z|0}if(c[o>>2]|0){c[i>>2]=45;z=c[i>>2]|0;l=h;return z|0}if(c[t>>2]|0)B=xp(0)|0;else B=vp(0)|0;c[r>>2]=B;if(ap(c[r>>2]|0,c[q>>2]|0)|0){Dp(c[r>>2]|0);c[i>>2]=65;z=c[i>>2]|0;l=h;return z|0}B=c[r>>2]|0;if(c[j>>2]|0){ko(B);c[c[j>>2]>>2]=c[r>>2]}else Dp(B);if(c[p>>2]|0){B=hv(c[q>>2]|0)|0;c[c[p>>2]>>2]=B}c[i>>2]=0;z=c[i>>2]|0;l=h;return z|0}c[v>>2]=c[q>>2];if((c[s>>2]|0)!=0&(c[s>>2]|0)>>>0<4){c[i>>2]=66;z=c[i>>2]|0;l=h;return z|0}c[w>>2]=(d[c[v>>2]>>0]|0)<<24|(d[(c[v>>2]|0)+1>>0]|0)<<16|(d[(c[v>>2]|0)+2>>0]|0)<<8|(d[(c[v>>2]|0)+3>>0]|0);c[v>>2]=(c[v>>2]|0)+4;if(c[s>>2]|0)c[s>>2]=(c[s>>2]|0)-4;if(c[s>>2]|0?(c[w>>2]|0)>>>0>(c[s>>2]|0)>>>0:0){c[i>>2]=67;z=c[i>>2]|0;l=h;return z|0}s=(((c[w>>2]|0)+4-1|0)>>>0)/4|0;if(c[t>>2]|0)C=xp(s)|0;else C=vp(s)|0;c[r>>2]=C;if(c[w>>2]|0?(Yo(c[r>>2]|0,c[v>>2]|0,c[w>>2]|0,0),c[(c[r>>2]|0)+8>>2]=(((d[c[v>>2]>>0]|0)&128|0)!=0^1^1)&1,c[(c[r>>2]|0)+8>>2]|0):0){_o(c[r>>2]|0);eo(c[r>>2]|0,c[r>>2]|0,1);c[(c[r>>2]|0)+8>>2]=1}if(c[p>>2]|0)c[c[p>>2]>>2]=(c[w>>2]|0)+4;w=c[r>>2]|0;if(c[j>>2]|0){ko(w);c[c[j>>2]>>2]=c[r>>2]}else Dp(w);c[i>>2]=0;z=c[i>>2]|0;l=h;return z|0}function _o(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+16|0;e=b+12|0;f=b+8|0;g=b+4|0;h=b;c[d>>2]=a;c[h>>2]=lo(c[d>>2]|0)|0;if(c[d>>2]|0?c[(c[d>>2]|0)+12>>2]&16|0:0){Cp();l=b;return}ko(c[d>>2]|0);c[e>>2]=c[(c[d>>2]|0)+16>>2];c[f>>2]=c[(c[d>>2]|0)+4>>2];c[g>>2]=0;while(1){if((c[g>>2]|0)>>>0>=(c[f>>2]|0)>>>0)break;a=(c[e>>2]|0)+(c[g>>2]<<2)|0;c[a>>2]=~c[a>>2];c[g>>2]=(c[g>>2]|0)+1}c[(c[d>>2]|0)+8>>2]=0;po(c[d>>2]|0,(c[h>>2]|0)-1|0);l=b;return}function $o(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+40|0;h=f+36|0;i=f+32|0;j=f+28|0;k=f+24|0;n=f+20|0;o=f+16|0;p=f+12|0;q=f+8|0;r=f+4|0;s=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=e;c[q>>2]=0;c[s>>2]=0;if((c[c[h>>2]>>2]|0)>>>0<2){t=c[q>>2]|0;u=c[h>>2]|0;c[u>>2]=t;v=c[s>>2]|0;l=f;return v|0}c[n>>2]=(d[c[g>>2]>>0]|0)<<8|(d[(c[g>>2]|0)+1>>0]|0);if((c[n>>2]|0)>>>0>16384){t=c[q>>2]|0;u=c[h>>2]|0;c[u>>2]=t;v=c[s>>2]|0;l=f;return v|0}c[g>>2]=(c[g>>2]|0)+2;c[q>>2]=2;c[o>>2]=(((c[n>>2]|0)+7|0)>>>0)/8|0;c[p>>2]=(((c[o>>2]|0)+4-1|0)>>>0)/4|0;n=c[p>>2]|0;if(c[i>>2]|0)w=xp(n)|0;else w=vp(n)|0;c[s>>2]=w;c[j>>2]=4-(((c[o>>2]|0)>>>0)%4|0);c[j>>2]=(c[j>>2]|0)%4|0;o=c[p>>2]|0;c[(c[s>>2]|0)+4>>2]=o;c[k>>2]=o;c[(c[s>>2]|0)+8>>2]=0;a:while(1){if((c[k>>2]|0)<=0){x=14;break}c[r>>2]=0;while(1){if((c[j>>2]|0)>=4)break;o=(c[q>>2]|0)+1|0;c[q>>2]=o;if(o>>>0>(c[c[h>>2]>>2]|0)>>>0)break a;c[r>>2]=c[r>>2]<<8;o=c[g>>2]|0;c[g>>2]=o+1;c[r>>2]=c[r>>2]|(d[o>>0]|0);c[j>>2]=(c[j>>2]|0)+1}c[j>>2]=0;c[(c[(c[s>>2]|0)+16>>2]|0)+((c[k>>2]|0)-1<<2)>>2]=c[r>>2];c[k>>2]=(c[k>>2]|0)+-1}if((x|0)==14){t=c[q>>2]|0;u=c[h>>2]|0;c[u>>2]=t;v=c[s>>2]|0;l=f;return v|0}Dp(c[s>>2]|0);c[s>>2]=0;t=c[q>>2]|0;u=c[h>>2]|0;c[u>>2]=t;v=c[s>>2]|0;l=f;return v|0}function ap(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+52|0;g=e+48|0;h=e+44|0;i=e+40|0;j=e+36|0;k=e+32|0;n=e+28|0;o=e+24|0;p=e+20|0;q=e+16|0;r=e+12|0;s=e+8|0;t=e+4|0;u=e;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;c[j>>2]=0;if((a[c[h>>2]>>0]|0)==45){c[i>>2]=1;c[h>>2]=(c[h>>2]|0)+1}if((a[c[h>>2]>>0]|0)==48?(a[(c[h>>2]|0)+1>>0]|0)==120:0)c[h>>2]=(c[h>>2]|0)+2;c[r>>2]=(hv(c[h>>2]|0)|0)<<2;if(((c[r>>2]|0)>>>0)%8|0|0)c[j>>2]=1;c[s>>2]=(((c[r>>2]|0)+7|0)>>>0)/8|0;c[t>>2]=(((c[s>>2]|0)+4-1|0)>>>0)/4|0;if((c[c[g>>2]>>2]|0)>>>0<(c[t>>2]|0)>>>0)Ap(c[g>>2]|0,c[t>>2]|0);c[k>>2]=4-(((c[s>>2]|0)>>>0)%4|0);c[k>>2]=(c[k>>2]|0)%4|0;s=c[t>>2]|0;c[(c[g>>2]|0)+4>>2]=s;c[n>>2]=s;c[(c[g>>2]|0)+8>>2]=c[i>>2];a:while(1){if((c[n>>2]|0)<=0){v=37;break}c[u>>2]=0;while(1){if((c[k>>2]|0)>=4)break;if(c[j>>2]|0){c[p>>2]=48;c[j>>2]=0}else{i=c[h>>2]|0;c[h>>2]=i+1;c[p>>2]=a[i>>0]}if(!(c[p>>2]|0)){v=18;break a}i=c[h>>2]|0;c[h>>2]=i+1;c[q>>2]=a[i>>0];if(!(c[q>>2]|0)){v=20;break a}i=c[p>>2]|0;do if((c[p>>2]|0)>=48&(c[p>>2]|0)<=57)c[o>>2]=i-48;else{s=c[p>>2]|0;if((i|0)>=97&(c[p>>2]|0)<=102){c[o>>2]=s-97+10;break}if(!((s|0)>=65&(c[p>>2]|0)<=70)){v=27;break a}c[o>>2]=(c[p>>2]|0)-65+10}while(0);c[o>>2]=c[o>>2]<<4;i=c[q>>2]|0;do if((c[q>>2]|0)>=48&(c[q>>2]|0)<=57)c[o>>2]=c[o>>2]|i-48;else{s=c[q>>2]|0;if((i|0)>=97&(c[q>>2]|0)<=102){c[o>>2]=c[o>>2]|s-97+10;break}if(!((s|0)>=65&(c[q>>2]|0)<=70)){v=34;break a}c[o>>2]=c[o>>2]|(c[q>>2]|0)-65+10}while(0);c[u>>2]=c[u>>2]<<8;c[u>>2]=c[u>>2]|c[o>>2];c[k>>2]=(c[k>>2]|0)+1}c[k>>2]=0;c[(c[(c[g>>2]|0)+16>>2]|0)+((c[n>>2]|0)-1<<2)>>2]=c[u>>2];c[n>>2]=(c[n>>2]|0)+-1}if((v|0)==18){Bp(c[g>>2]|0);c[f>>2]=1;w=c[f>>2]|0;l=e;return w|0}else if((v|0)==20){Bp(c[g>>2]|0);c[f>>2]=1;w=c[f>>2]|0;l=e;return w|0}else if((v|0)==27){Bp(c[g>>2]|0);c[f>>2]=1;w=c[f>>2]|0;l=e;return w|0}else if((v|0)==34){Bp(c[g>>2]|0);c[f>>2]=1;w=c[f>>2]|0;l=e;return w|0}else if((v|0)==37){c[f>>2]=0;w=c[f>>2]|0;l=e;return w|0}return 0}function bp(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;i=l;l=l+128|0;if((l|0)>=(m|0))$(128);j=i+112|0;k=i+108|0;n=i+104|0;o=i+100|0;p=i+96|0;q=i+92|0;r=i+88|0;s=i+84|0;t=i+76|0;u=i+72|0;v=i+68|0;w=i+64|0;x=i+60|0;y=i+56|0;z=i+52|0;A=i+48|0;B=i+44|0;C=i+40|0;D=i+36|0;E=i+32|0;F=i+28|0;G=i+24|0;H=i+20|0;I=i+16|0;J=i+12|0;K=i+8|0;L=i+4|0;M=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;c[r>>2]=lo(c[q>>2]|0)|0;if(!(c[p>>2]|0))c[p>>2]=i+80;if(c[(c[q>>2]|0)+8>>2]|0?vo(c[q>>2]|0,0)|0:0)c[t>>2]=1;else c[t>>2]=0;c[s>>2]=c[o>>2];c[c[p>>2]>>2]=0;if((c[k>>2]|0)==1){c[v>>2]=0;c[u>>2]=Vo(c[q>>2]|0,0,w,0)|0;if(!(c[u>>2]|0)){c[j>>2]=Et()|0;N=c[j>>2]|0;l=i;return N|0}if(c[t>>2]|0){cp(c[u>>2]|0,c[w>>2]|0);if(!((d[c[u>>2]>>0]|0)&128)){c[w>>2]=(c[w>>2]|0)+1;c[v>>2]=2}}else if(c[w>>2]|0?(d[c[u>>2]>>0]|0)&128|0:0){c[w>>2]=(c[w>>2]|0)+1;c[v>>2]=1}if(c[n>>2]|0?(c[w>>2]|0)>>>0>(c[s>>2]|0)>>>0:0){vf(c[u>>2]|0);c[j>>2]=66;N=c[j>>2]|0;l=i;return N|0}if(c[n>>2]|0){c[x>>2]=c[n>>2];if((c[v>>2]|0)!=1){if(c[v>>2]|0){o=c[x>>2]|0;c[x>>2]=o+1;a[o>>0]=-1}}else{o=c[x>>2]|0;c[x>>2]=o+1;a[o>>0]=0}_w(c[x>>2]|0,c[u>>2]|0,(c[w>>2]|0)-(((c[v>>2]|0)!=0^1^1)&1)|0)|0}vf(c[u>>2]|0);c[c[p>>2]>>2]=c[w>>2];c[j>>2]=0;N=c[j>>2]|0;l=i;return N|0}if((c[k>>2]|0)==5){c[y>>2]=(((c[r>>2]|0)+7|0)>>>0)/8|0;if(c[n>>2]|0?(c[y>>2]|0)>>>0>(c[s>>2]|0)>>>0:0){c[j>>2]=66;N=c[j>>2]|0;l=i;return N|0}do if(c[n>>2]|0){c[z>>2]=Vo(c[q>>2]|0,0,y,0)|0;if(c[z>>2]|0){_w(c[n>>2]|0,c[z>>2]|0,c[y>>2]|0)|0;vf(c[z>>2]|0);break}c[j>>2]=Et()|0;N=c[j>>2]|0;l=i;return N|0}while(0);c[c[p>>2]>>2]=c[y>>2];c[j>>2]=0;N=c[j>>2]|0;l=i;return N|0}if((c[k>>2]|0)==2){c[A>>2]=(((c[r>>2]|0)+7|0)>>>0)/8|0;if(c[t>>2]|0){c[j>>2]=45;N=c[j>>2]|0;l=i;return N|0}if(c[n>>2]|0?((c[A>>2]|0)+2|0)>>>0>(c[s>>2]|0)>>>0:0){c[j>>2]=66;N=c[j>>2]|0;l=i;return N|0}do if(c[n>>2]|0){c[C>>2]=c[n>>2];a[c[C>>2]>>0]=(c[r>>2]|0)>>>8;a[(c[C>>2]|0)+1>>0]=c[r>>2];c[B>>2]=Vo(c[q>>2]|0,0,A,0)|0;if(c[B>>2]|0){_w((c[C>>2]|0)+2|0,c[B>>2]|0,c[A>>2]|0)|0;vf(c[B>>2]|0);break}c[j>>2]=Et()|0;N=c[j>>2]|0;l=i;return N|0}while(0);c[c[p>>2]>>2]=(c[A>>2]|0)+2;c[j>>2]=0;N=c[j>>2]|0;l=i;return N|0}if((c[k>>2]|0)==3){c[E>>2]=0;c[D>>2]=Vo(c[q>>2]|0,0,F,0)|0;if(!(c[D>>2]|0)){c[j>>2]=Et()|0;N=c[j>>2]|0;l=i;return N|0}if(c[t>>2]|0){cp(c[D>>2]|0,c[F>>2]|0);if(!((d[c[D>>2]>>0]|0)&128)){c[F>>2]=(c[F>>2]|0)+1;c[E>>2]=2}}else if(c[F>>2]|0?(d[c[D>>2]>>0]|0)&128|0:0){c[F>>2]=(c[F>>2]|0)+1;c[E>>2]=1}if(c[n>>2]|0?((c[F>>2]|0)+4|0)>>>0>(c[s>>2]|0)>>>0:0){vf(c[D>>2]|0);c[j>>2]=66;N=c[j>>2]|0;l=i;return N|0}if(c[n>>2]|0){c[G>>2]=c[n>>2];A=(c[F>>2]|0)>>>24&255;B=c[G>>2]|0;c[G>>2]=B+1;a[B>>0]=A;A=(c[F>>2]|0)>>>16&255;B=c[G>>2]|0;c[G>>2]=B+1;a[B>>0]=A;A=(c[F>>2]|0)>>>8&255;B=c[G>>2]|0;c[G>>2]=B+1;a[B>>0]=A;A=c[F>>2]&255;B=c[G>>2]|0;c[G>>2]=B+1;a[B>>0]=A;if((c[E>>2]|0)!=1){if(c[E>>2]|0){A=c[G>>2]|0;c[G>>2]=A+1;a[A>>0]=-1}}else{A=c[G>>2]|0;c[G>>2]=A+1;a[A>>0]=0}_w(c[G>>2]|0,c[D>>2]|0,(c[F>>2]|0)-(((c[E>>2]|0)!=0^1^1)&1)|0)|0}vf(c[D>>2]|0);c[c[p>>2]>>2]=4+(c[F>>2]|0);c[j>>2]=0;N=c[j>>2]|0;l=i;return N|0}if((c[k>>2]|0)!=4){c[j>>2]=45;N=c[j>>2]|0;l=i;return N|0}c[J>>2]=0;c[K>>2]=0;c[H>>2]=Vo(c[q>>2]|0,0,K,0)|0;if(!(c[H>>2]|0)){c[j>>2]=Et()|0;N=c[j>>2]|0;l=i;return N|0}if(!(c[K>>2]|0?!((d[c[H>>2]>>0]|0)&128|0):0))c[J>>2]=2;if(c[n>>2]|0?((c[K>>2]<<1)+(c[J>>2]|0)+(c[t>>2]|0)+1|0)>>>0>(c[s>>2]|0)>>>0:0){vf(c[H>>2]|0);c[j>>2]=66;N=c[j>>2]|0;l=i;return N|0}if(c[n>>2]|0){c[L>>2]=c[n>>2];if(c[t>>2]|0){s=c[L>>2]|0;c[L>>2]=s+1;a[s>>0]=45}if(c[J>>2]|0){s=c[L>>2]|0;c[L>>2]=s+1;a[s>>0]=48;s=c[L>>2]|0;c[L>>2]=s+1;a[s>>0]=48}c[I>>2]=0;while(1){if((c[I>>2]|0)>>>0>=(c[K>>2]|0)>>>0)break;c[M>>2]=d[(c[H>>2]|0)+(c[I>>2]|0)>>0];s=(c[M>>2]|0)>>>4;q=((c[M>>2]|0)>>>4>>>0<10?48+s|0:65+s-10|0)&255;s=c[L>>2]|0;c[L>>2]=s+1;a[s>>0]=q;c[M>>2]=c[M>>2]&15;q=c[M>>2]|0;s=((c[M>>2]|0)>>>0<10?48+q|0:65+q-10|0)&255;q=c[L>>2]|0;c[L>>2]=q+1;a[q>>0]=s;c[I>>2]=(c[I>>2]|0)+1}I=c[L>>2]|0;c[L>>2]=I+1;a[I>>0]=0;c[c[p>>2]>>2]=(c[L>>2]|0)-(c[n>>2]|0)}else c[c[p>>2]>>2]=(c[K>>2]<<1)+(c[J>>2]|0)+(c[t>>2]|0)+1;vf(c[H>>2]|0);c[j>>2]=0;N=c[j>>2]|0;l=i;return N|0}function cp(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+8|0;h=f+4|0;i=f;c[g>>2]=b;c[h>>2]=e;c[i>>2]=(c[h>>2]|0)-1;while(1){if((c[i>>2]|0)<0)break;if(!((a[(c[g>>2]|0)+(c[i>>2]|0)>>0]|0)!=0^1))break;c[i>>2]=(c[i>>2]|0)+-1}if((c[i>>2]|0)<0){l=f;return}h=d[(c[g>>2]|0)+(c[i>>2]|0)>>0]|0;do if(!(d[(c[g>>2]|0)+(c[i>>2]|0)>>0]&1|0)){e=d[(c[g>>2]|0)+(c[i>>2]|0)>>0]|0;if(h&2|0){a[(c[g>>2]|0)+(c[i>>2]|0)>>0]=(e^252|2)&254;break}b=d[(c[g>>2]|0)+(c[i>>2]|0)>>0]|0;if(e&4|0){a[(c[g>>2]|0)+(c[i>>2]|0)>>0]=(b^248|4)&252;break}e=d[(c[g>>2]|0)+(c[i>>2]|0)>>0]|0;if(b&8|0){a[(c[g>>2]|0)+(c[i>>2]|0)>>0]=(e^240|8)&248;break}b=d[(c[g>>2]|0)+(c[i>>2]|0)>>0]|0;if(e&16|0){a[(c[g>>2]|0)+(c[i>>2]|0)>>0]=(b^224|16)&240;break}e=d[(c[g>>2]|0)+(c[i>>2]|0)>>0]|0;if(b&32|0){a[(c[g>>2]|0)+(c[i>>2]|0)>>0]=(e^192|32)&224;break}b=(c[g>>2]|0)+(c[i>>2]|0)|0;if(e&64|0){a[(c[g>>2]|0)+(c[i>>2]|0)>>0]=(d[b>>0]^128|64)&192;break}else{a[b>>0]=-128;break}}else a[(c[g>>2]|0)+(c[i>>2]|0)>>0]=h^254|1;while(0);c[i>>2]=(c[i>>2]|0)+-1;while(1){if((c[i>>2]|0)<0)break;h=(c[g>>2]|0)+(c[i>>2]|0)|0;a[h>>0]=d[h>>0]^255;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function dp(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+36|0;h=f+32|0;i=f+28|0;j=f+24|0;k=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;r=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if((((c[h>>2]|0)!=0^1)&1|0)==(((c[i>>2]|0)!=0^1)&1|0)){c[g>>2]=45;s=c[g>>2]|0;l=f;return s|0}if(c[h>>2]|0)c[c[h>>2]>>2]=0;c[n>>2]=bp(5,0,0,o,c[j>>2]|0)|0;if(c[n>>2]|0){c[g>>2]=c[n>>2];s=c[g>>2]|0;l=f;return s|0}if((c[o>>2]|0)>>>0>(c[k>>2]|0)>>>0){c[g>>2]=67;s=c[g>>2]|0;l=f;return s|0}if((c[o>>2]|0)>>>0<(c[k>>2]|0)>>>0)t=(c[k>>2]|0)-(c[o>>2]|0)|0;else t=0;c[p>>2]=t;c[q>>2]=(c[o>>2]|0)+(c[p>>2]|0);if(!(c[i>>2]|0)){if(c[j>>2]|0?c[(c[j>>2]|0)+12>>2]&1|0:0)u=sf(c[q>>2]|0)|0;else u=pf(c[q>>2]|0)|0;c[r>>2]=u;if(!(c[r>>2]|0)){c[n>>2]=Et()|0;c[g>>2]=c[n>>2];s=c[g>>2]|0;l=f;return s|0}}else c[r>>2]=c[i>>2];if(c[p>>2]|0)Uw(c[r>>2]|0,0,c[p>>2]|0)|0;c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[n>>2]=bp(5,(c[r>>2]|0)+(c[p>>2]|0)|0,(c[o>>2]|0)-(c[p>>2]|0)|0,0,c[j>>2]|0)|0;if(c[n>>2]|0){vf(c[r>>2]|0);c[g>>2]=c[n>>2];s=c[g>>2]|0;l=f;return s|0}if(c[h>>2]|0)c[c[h>>2]>>2]=c[r>>2];c[g>>2]=0;s=c[g>>2]|0;l=f;return s|0}function ep(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;p=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[p>>2]=0-(c[j>>2]|0);c[h>>2]=(c[h>>2]|0)+(0-(c[p>>2]|0)<<2);c[i>>2]=(c[i>>2]|0)+(0-(c[p>>2]|0)<<2);c[g>>2]=(c[g>>2]|0)+(0-(c[p>>2]|0)<<2);c[o>>2]=0;do{c[n>>2]=c[(c[i>>2]|0)+(c[p>>2]<<2)>>2];c[k>>2]=c[(c[h>>2]|0)+(c[p>>2]<<2)>>2];c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);c[o>>2]=(c[n>>2]|0)>>>0<(c[o>>2]|0)>>>0&1;c[n>>2]=(c[n>>2]|0)+(c[k>>2]|0);c[o>>2]=(c[o>>2]|0)+((c[n>>2]|0)>>>0<(c[k>>2]|0)>>>0&1);c[(c[g>>2]|0)+(c[p>>2]<<2)>>2]=c[n>>2];j=(c[p>>2]|0)+1|0;c[p>>2]=j}while((j|0)!=0);l=f;return c[o>>2]|0}function fp(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0;f=l;l=l+144|0;if((l|0)>=(m|0))$(144);g=f+128|0;h=f+124|0;i=f+120|0;j=f+116|0;k=f+112|0;n=f+108|0;o=f+104|0;p=f+100|0;q=f+96|0;r=f+92|0;s=f+88|0;t=f+84|0;u=f+80|0;v=f+76|0;w=f+72|0;x=f+68|0;y=f+64|0;z=f+60|0;A=f+56|0;B=f+52|0;C=f+48|0;D=f+44|0;E=f+40|0;F=f+36|0;G=f+32|0;H=f+28|0;I=f+24|0;J=f+20|0;K=f+16|0;L=f+12|0;M=f+8|0;N=f+4|0;O=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=e;if(!(c[i>>2]|0)){c[g>>2]=0;P=c[g>>2]|0;l=f;return P|0}c[s>>2]=c[j>>2];e=c[s>>2]|0;c[t>>2]=(c[s>>2]|0)>>>0<65536?(e>>>0<256?0:8):e>>>0<16777216?16:24;c[r>>2]=32-((d[45848+((c[s>>2]|0)>>>(c[t>>2]|0))>>0]|0)+(c[t>>2]|0));if(!(c[r>>2]|0)){c[k>>2]=(c[i>>2]|0)-1;c[p>>2]=c[(c[h>>2]|0)+(c[k>>2]<<2)>>2];if((c[p>>2]|0)>>>0>=(c[j>>2]|0)>>>0)c[p>>2]=0;else c[k>>2]=(c[k>>2]|0)+-1;while(1){if((c[k>>2]|0)<0)break;c[o>>2]=c[(c[h>>2]|0)+(c[k>>2]<<2)>>2];c[I>>2]=(c[j>>2]|0)>>>16;c[J>>2]=c[j>>2]&65535;c[M>>2]=((c[p>>2]|0)>>>0)%((c[I>>2]|0)>>>0)|0;c[K>>2]=((c[p>>2]|0)>>>0)/((c[I>>2]|0)>>>0)|0;c[O>>2]=S(c[K>>2]|0,c[J>>2]|0)|0;c[M>>2]=c[M>>2]<<16|(c[o>>2]|0)>>>16;if(((c[M>>2]|0)>>>0<(c[O>>2]|0)>>>0?(c[K>>2]=(c[K>>2]|0)+-1,c[M>>2]=(c[M>>2]|0)+(c[j>>2]|0),(c[M>>2]|0)>>>0>=(c[j>>2]|0)>>>0):0)?(c[M>>2]|0)>>>0<(c[O>>2]|0)>>>0:0){c[K>>2]=(c[K>>2]|0)+-1;c[M>>2]=(c[M>>2]|0)+(c[j>>2]|0)}c[M>>2]=(c[M>>2]|0)-(c[O>>2]|0);c[N>>2]=((c[M>>2]|0)>>>0)%((c[I>>2]|0)>>>0)|0;c[L>>2]=((c[M>>2]|0)>>>0)/((c[I>>2]|0)>>>0)|0;c[O>>2]=S(c[L>>2]|0,c[J>>2]|0)|0;c[N>>2]=c[N>>2]<<16|c[o>>2]&65535;if(((c[N>>2]|0)>>>0<(c[O>>2]|0)>>>0?(c[L>>2]=(c[L>>2]|0)+-1,c[N>>2]=(c[N>>2]|0)+(c[j>>2]|0),(c[N>>2]|0)>>>0>=(c[j>>2]|0)>>>0):0)?(c[N>>2]|0)>>>0<(c[O>>2]|0)>>>0:0){c[L>>2]=(c[L>>2]|0)+-1;c[N>>2]=(c[N>>2]|0)+(c[j>>2]|0)}c[N>>2]=(c[N>>2]|0)-(c[O>>2]|0);c[q>>2]=c[K>>2]<<16|c[L>>2];c[p>>2]=c[N>>2];c[k>>2]=(c[k>>2]|0)+-1}c[g>>2]=c[p>>2];P=c[g>>2]|0;l=f;return P|0}c[j>>2]=c[j>>2]<>2];c[n>>2]=c[(c[h>>2]|0)+((c[i>>2]|0)-1<<2)>>2];c[p>>2]=(c[n>>2]|0)>>>(32-(c[r>>2]|0)|0);c[k>>2]=(c[i>>2]|0)-2;while(1){if((c[k>>2]|0)<0)break;c[o>>2]=c[(c[h>>2]|0)+(c[k>>2]<<2)>>2];c[u>>2]=(c[j>>2]|0)>>>16;c[v>>2]=c[j>>2]&65535;c[y>>2]=((c[p>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0;c[w>>2]=((c[p>>2]|0)>>>0)/((c[u>>2]|0)>>>0)|0;c[A>>2]=S(c[w>>2]|0,c[v>>2]|0)|0;c[y>>2]=c[y>>2]<<16|(c[n>>2]<>2]|(c[o>>2]|0)>>>(32-(c[r>>2]|0)|0))>>>16;if(((c[y>>2]|0)>>>0<(c[A>>2]|0)>>>0?(c[w>>2]=(c[w>>2]|0)+-1,c[y>>2]=(c[y>>2]|0)+(c[j>>2]|0),(c[y>>2]|0)>>>0>=(c[j>>2]|0)>>>0):0)?(c[y>>2]|0)>>>0<(c[A>>2]|0)>>>0:0){c[w>>2]=(c[w>>2]|0)+-1;c[y>>2]=(c[y>>2]|0)+(c[j>>2]|0)}c[y>>2]=(c[y>>2]|0)-(c[A>>2]|0);c[z>>2]=((c[y>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0;c[x>>2]=((c[y>>2]|0)>>>0)/((c[u>>2]|0)>>>0)|0;c[A>>2]=S(c[x>>2]|0,c[v>>2]|0)|0;c[z>>2]=c[z>>2]<<16|(c[n>>2]<>2]|(c[o>>2]|0)>>>(32-(c[r>>2]|0)|0))&65535;if(((c[z>>2]|0)>>>0<(c[A>>2]|0)>>>0?(c[x>>2]=(c[x>>2]|0)+-1,c[z>>2]=(c[z>>2]|0)+(c[j>>2]|0),(c[z>>2]|0)>>>0>=(c[j>>2]|0)>>>0):0)?(c[z>>2]|0)>>>0<(c[A>>2]|0)>>>0:0){c[x>>2]=(c[x>>2]|0)+-1;c[z>>2]=(c[z>>2]|0)+(c[j>>2]|0)}c[z>>2]=(c[z>>2]|0)-(c[A>>2]|0);c[q>>2]=c[w>>2]<<16|c[x>>2];c[p>>2]=c[z>>2];c[n>>2]=c[o>>2];c[k>>2]=(c[k>>2]|0)+-1}c[B>>2]=(c[j>>2]|0)>>>16;c[C>>2]=c[j>>2]&65535;c[F>>2]=((c[p>>2]|0)>>>0)%((c[B>>2]|0)>>>0)|0;c[D>>2]=((c[p>>2]|0)>>>0)/((c[B>>2]|0)>>>0)|0;c[H>>2]=S(c[D>>2]|0,c[C>>2]|0)|0;c[F>>2]=c[F>>2]<<16|c[n>>2]<>2]>>>16;if(((c[F>>2]|0)>>>0<(c[H>>2]|0)>>>0?(c[D>>2]=(c[D>>2]|0)+-1,c[F>>2]=(c[F>>2]|0)+(c[j>>2]|0),(c[F>>2]|0)>>>0>=(c[j>>2]|0)>>>0):0)?(c[F>>2]|0)>>>0<(c[H>>2]|0)>>>0:0){c[D>>2]=(c[D>>2]|0)+-1;c[F>>2]=(c[F>>2]|0)+(c[j>>2]|0)}c[F>>2]=(c[F>>2]|0)-(c[H>>2]|0);c[G>>2]=((c[F>>2]|0)>>>0)%((c[B>>2]|0)>>>0)|0;c[E>>2]=((c[F>>2]|0)>>>0)/((c[B>>2]|0)>>>0)|0;c[H>>2]=S(c[E>>2]|0,c[C>>2]|0)|0;c[G>>2]=c[G>>2]<<16|c[n>>2]<>2]&65535;if(((c[G>>2]|0)>>>0<(c[H>>2]|0)>>>0?(c[E>>2]=(c[E>>2]|0)+-1,c[G>>2]=(c[G>>2]|0)+(c[j>>2]|0),(c[G>>2]|0)>>>0>=(c[j>>2]|0)>>>0):0)?(c[G>>2]|0)>>>0<(c[H>>2]|0)>>>0:0){c[E>>2]=(c[E>>2]|0)+-1;c[G>>2]=(c[G>>2]|0)+(c[j>>2]|0)}c[G>>2]=(c[G>>2]|0)-(c[H>>2]|0);c[q>>2]=c[D>>2]<<16|c[E>>2];c[p>>2]=c[G>>2];c[g>>2]=(c[p>>2]|0)>>>(c[r>>2]|0);P=c[g>>2]|0;l=f;return P|0}function gp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0;h=l;l=l+320|0;if((l|0)>=(m|0))$(320);i=h+316|0;j=h+312|0;k=h+308|0;n=h+304|0;o=h+300|0;p=h+296|0;q=h+292|0;r=h+288|0;s=h+284|0;t=h+280|0;u=h+276|0;v=h+272|0;w=h+268|0;x=h+264|0;y=h+260|0;z=h+256|0;A=h+252|0;B=h+248|0;C=h+244|0;D=h+240|0;E=h+236|0;F=h+232|0;G=h+228|0;H=h+224|0;I=h+220|0;J=h+216|0;K=h+212|0;L=h+208|0;M=h+204|0;N=h+200|0;O=h+196|0;P=h+192|0;Q=h+188|0;R=h+184|0;T=h+180|0;U=h+176|0;V=h+172|0;W=h+168|0;X=h+164|0;Y=h+160|0;Z=h+156|0;_=h+152|0;aa=h+148|0;ba=h+144|0;ca=h+140|0;da=h+136|0;ea=h+132|0;fa=h+128|0;ga=h+124|0;ha=h+120|0;ia=h+116|0;ja=h+112|0;ka=h+108|0;la=h+104|0;ma=h+100|0;na=h+96|0;oa=h+92|0;pa=h+88|0;qa=h+84|0;ra=h+80|0;sa=h+76|0;ta=h+72|0;ua=h+68|0;va=h+64|0;wa=h+60|0;xa=h+56|0;ya=h+52|0;za=h+48|0;Aa=h+44|0;Ba=h+40|0;Ca=h+36|0;Da=h+32|0;Ea=h+28|0;Fa=h+24|0;Ga=h+20|0;Ha=h+16|0;Ia=h+12|0;Ja=h+8|0;Ka=h+4|0;La=h;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=0;switch(c[p>>2]|0){case 0:{df();break}case 1:{c[t>>2]=c[c[o>>2]>>2];c[s>>2]=c[(c[k>>2]|0)+((c[n>>2]|0)-1<<2)>>2];if((c[s>>2]|0)>>>0>=(c[t>>2]|0)>>>0){c[s>>2]=(c[s>>2]|0)-(c[t>>2]|0);c[q>>2]=1}c[i>>2]=(c[i>>2]|0)+(c[j>>2]<<2);c[r>>2]=(c[n>>2]|0)-2;while(1){if((c[r>>2]|0)<0)break;c[u>>2]=(c[t>>2]|0)>>>16;c[v>>2]=c[t>>2]&65535;c[y>>2]=((c[s>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0;c[w>>2]=((c[s>>2]|0)>>>0)/((c[u>>2]|0)>>>0)|0;c[A>>2]=S(c[w>>2]|0,c[v>>2]|0)|0;c[y>>2]=c[y>>2]<<16|(c[(c[k>>2]|0)+(c[r>>2]<<2)>>2]|0)>>>16;if(((c[y>>2]|0)>>>0<(c[A>>2]|0)>>>0?(c[w>>2]=(c[w>>2]|0)+-1,c[y>>2]=(c[y>>2]|0)+(c[t>>2]|0),(c[y>>2]|0)>>>0>=(c[t>>2]|0)>>>0):0)?(c[y>>2]|0)>>>0<(c[A>>2]|0)>>>0:0){c[w>>2]=(c[w>>2]|0)+-1;c[y>>2]=(c[y>>2]|0)+(c[t>>2]|0)}c[y>>2]=(c[y>>2]|0)-(c[A>>2]|0);c[z>>2]=((c[y>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0;c[x>>2]=((c[y>>2]|0)>>>0)/((c[u>>2]|0)>>>0)|0;c[A>>2]=S(c[x>>2]|0,c[v>>2]|0)|0;c[z>>2]=c[z>>2]<<16|c[(c[k>>2]|0)+(c[r>>2]<<2)>>2]&65535;if(((c[z>>2]|0)>>>0<(c[A>>2]|0)>>>0?(c[x>>2]=(c[x>>2]|0)+-1,c[z>>2]=(c[z>>2]|0)+(c[t>>2]|0),(c[z>>2]|0)>>>0>=(c[t>>2]|0)>>>0):0)?(c[z>>2]|0)>>>0<(c[A>>2]|0)>>>0:0){c[x>>2]=(c[x>>2]|0)+-1;c[z>>2]=(c[z>>2]|0)+(c[t>>2]|0)}c[z>>2]=(c[z>>2]|0)-(c[A>>2]|0);c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]=c[w>>2]<<16|c[x>>2];c[s>>2]=c[z>>2];c[r>>2]=(c[r>>2]|0)+-1}c[i>>2]=(c[i>>2]|0)+(0-(c[j>>2]|0)<<2);c[r>>2]=(c[j>>2]|0)-1;while(1){if((c[r>>2]|0)<0)break;c[B>>2]=(c[t>>2]|0)>>>16;c[C>>2]=c[t>>2]&65535;c[F>>2]=((c[s>>2]|0)>>>0)%((c[B>>2]|0)>>>0)|0;c[D>>2]=((c[s>>2]|0)>>>0)/((c[B>>2]|0)>>>0)|0;c[H>>2]=S(c[D>>2]|0,c[C>>2]|0)|0;c[F>>2]=c[F>>2]<<16;if(((c[F>>2]|0)>>>0<(c[H>>2]|0)>>>0?(c[D>>2]=(c[D>>2]|0)+-1,c[F>>2]=(c[F>>2]|0)+(c[t>>2]|0),(c[F>>2]|0)>>>0>=(c[t>>2]|0)>>>0):0)?(c[F>>2]|0)>>>0<(c[H>>2]|0)>>>0:0){c[D>>2]=(c[D>>2]|0)+-1;c[F>>2]=(c[F>>2]|0)+(c[t>>2]|0)}c[F>>2]=(c[F>>2]|0)-(c[H>>2]|0);c[G>>2]=((c[F>>2]|0)>>>0)%((c[B>>2]|0)>>>0)|0;c[E>>2]=((c[F>>2]|0)>>>0)/((c[B>>2]|0)>>>0)|0;c[H>>2]=S(c[E>>2]|0,c[C>>2]|0)|0;c[G>>2]=c[G>>2]<<16;if(((c[G>>2]|0)>>>0<(c[H>>2]|0)>>>0?(c[E>>2]=(c[E>>2]|0)+-1,c[G>>2]=(c[G>>2]|0)+(c[t>>2]|0),(c[G>>2]|0)>>>0>=(c[t>>2]|0)>>>0):0)?(c[G>>2]|0)>>>0<(c[H>>2]|0)>>>0:0){c[E>>2]=(c[E>>2]|0)+-1;c[G>>2]=(c[G>>2]|0)+(c[t>>2]|0)}c[G>>2]=(c[G>>2]|0)-(c[H>>2]|0);c[(c[i>>2]|0)+(c[r>>2]<<2)>>2]=c[D>>2]<<16|c[E>>2];c[s>>2]=c[G>>2];c[r>>2]=(c[r>>2]|0)+-1}c[c[k>>2]>>2]=c[s>>2];Ma=c[q>>2]|0;l=h;return Ma|0}case 2:{c[k>>2]=(c[k>>2]|0)+((c[n>>2]|0)-2<<2);c[M>>2]=c[(c[o>>2]|0)+4>>2];c[N>>2]=c[c[o>>2]>>2];c[J>>2]=c[(c[k>>2]|0)+4>>2];c[K>>2]=c[c[k>>2]>>2];do if((c[J>>2]|0)>>>0>=(c[M>>2]|0)>>>0){if((c[J>>2]|0)>>>0<=(c[M>>2]|0)>>>0?(c[K>>2]|0)>>>0<(c[N>>2]|0)>>>0:0)break;c[O>>2]=(c[K>>2]|0)-(c[N>>2]|0);c[J>>2]=(c[J>>2]|0)-(c[M>>2]|0)-((c[O>>2]|0)>>>0>(c[K>>2]|0)>>>0&1);c[K>>2]=c[O>>2];c[q>>2]=1}while(0);c[I>>2]=(c[j>>2]|0)+(c[n>>2]|0)-2-1;while(1){if((c[I>>2]|0)<0)break;O=c[k>>2]|0;if((c[I>>2]|0)>=(c[j>>2]|0))c[k>>2]=O+-4;else c[O>>2]=0;do if((c[J>>2]|0)==(c[M>>2]|0)){c[P>>2]=-1;c[Q>>2]=(c[K>>2]|0)+(c[M>>2]|0);if((c[Q>>2]|0)>>>0<(c[M>>2]|0)>>>0){c[R>>2]=(c[c[k>>2]>>2]|0)+(c[N>>2]|0);c[J>>2]=(c[Q>>2]|0)-(c[N>>2]|0)+0+((c[R>>2]|0)>>>0<(c[c[k>>2]>>2]|0)>>>0&1);c[K>>2]=c[R>>2];c[(c[i>>2]|0)+(c[I>>2]<<2)>>2]=c[P>>2];break}else{c[J>>2]=(c[N>>2]|0)-(c[N>>2]|0?1:0);c[K>>2]=0-(c[N>>2]|0);Na=52;break}}else{c[T>>2]=(c[M>>2]|0)>>>16;c[U>>2]=c[M>>2]&65535;c[X>>2]=((c[J>>2]|0)>>>0)%((c[T>>2]|0)>>>0)|0;c[V>>2]=((c[J>>2]|0)>>>0)/((c[T>>2]|0)>>>0)|0;c[Z>>2]=S(c[V>>2]|0,c[U>>2]|0)|0;c[X>>2]=c[X>>2]<<16|(c[K>>2]|0)>>>16;if(((c[X>>2]|0)>>>0<(c[Z>>2]|0)>>>0?(c[V>>2]=(c[V>>2]|0)+-1,c[X>>2]=(c[X>>2]|0)+(c[M>>2]|0),(c[X>>2]|0)>>>0>=(c[M>>2]|0)>>>0):0)?(c[X>>2]|0)>>>0<(c[Z>>2]|0)>>>0:0){c[V>>2]=(c[V>>2]|0)+-1;c[X>>2]=(c[X>>2]|0)+(c[M>>2]|0)}c[X>>2]=(c[X>>2]|0)-(c[Z>>2]|0);c[Y>>2]=((c[X>>2]|0)>>>0)%((c[T>>2]|0)>>>0)|0;c[W>>2]=((c[X>>2]|0)>>>0)/((c[T>>2]|0)>>>0)|0;c[Z>>2]=S(c[W>>2]|0,c[U>>2]|0)|0;c[Y>>2]=c[Y>>2]<<16|c[K>>2]&65535;if(((c[Y>>2]|0)>>>0<(c[Z>>2]|0)>>>0?(c[W>>2]=(c[W>>2]|0)+-1,c[Y>>2]=(c[Y>>2]|0)+(c[M>>2]|0),(c[Y>>2]|0)>>>0>=(c[M>>2]|0)>>>0):0)?(c[Y>>2]|0)>>>0<(c[Z>>2]|0)>>>0:0){c[W>>2]=(c[W>>2]|0)+-1;c[Y>>2]=(c[Y>>2]|0)+(c[M>>2]|0)}c[Y>>2]=(c[Y>>2]|0)-(c[Z>>2]|0);c[P>>2]=c[V>>2]<<16|c[W>>2];c[Q>>2]=c[Y>>2];c[ha>>2]=c[N>>2];c[ia>>2]=c[P>>2];c[da>>2]=c[ha>>2]&65535;c[fa>>2]=(c[ha>>2]|0)>>>16;c[ea>>2]=c[ia>>2]&65535;c[ga>>2]=(c[ia>>2]|0)>>>16;c[_>>2]=S(c[da>>2]|0,c[ea>>2]|0)|0;c[aa>>2]=S(c[da>>2]|0,c[ga>>2]|0)|0;c[ba>>2]=S(c[fa>>2]|0,c[ea>>2]|0)|0;c[ca>>2]=S(c[fa>>2]|0,c[ga>>2]|0)|0;c[aa>>2]=(c[aa>>2]|0)+((c[_>>2]|0)>>>16);c[aa>>2]=(c[aa>>2]|0)+(c[ba>>2]|0);if((c[aa>>2]|0)>>>0<(c[ba>>2]|0)>>>0)c[ca>>2]=(c[ca>>2]|0)+65536;c[J>>2]=(c[ca>>2]|0)+((c[aa>>2]|0)>>>16);c[K>>2]=((c[aa>>2]&65535)<<16)+(c[_>>2]&65535);Na=52}while(0);if((Na|0)==52){Na=0;c[L>>2]=c[c[k>>2]>>2];do{if((c[J>>2]|0)>>>0<=(c[Q>>2]|0)>>>0){if((c[J>>2]|0)!=(c[Q>>2]|0))break;if((c[K>>2]|0)>>>0<=(c[L>>2]|0)>>>0)break}c[P>>2]=(c[P>>2]|0)+-1;c[ja>>2]=(c[K>>2]|0)-(c[N>>2]|0);c[J>>2]=(c[J>>2]|0)-0-((c[ja>>2]|0)>>>0>(c[K>>2]|0)>>>0&1);c[K>>2]=c[ja>>2];c[Q>>2]=(c[Q>>2]|0)+(c[M>>2]|0)}while((c[Q>>2]|0)>>>0>=(c[M>>2]|0)>>>0);c[(c[i>>2]|0)+(c[I>>2]<<2)>>2]=c[P>>2];c[ka>>2]=(c[L>>2]|0)-(c[K>>2]|0);c[J>>2]=(c[Q>>2]|0)-(c[J>>2]|0)-((c[ka>>2]|0)>>>0>(c[L>>2]|0)>>>0&1);c[K>>2]=c[ka>>2]}c[I>>2]=(c[I>>2]|0)+-1}c[(c[k>>2]|0)+4>>2]=c[J>>2];c[c[k>>2]>>2]=c[K>>2];Ma=c[q>>2]|0;l=h;return Ma|0}default:{c[k>>2]=(c[k>>2]|0)+((c[n>>2]|0)-(c[p>>2]|0)<<2);c[ma>>2]=c[(c[o>>2]|0)+((c[p>>2]|0)-1<<2)>>2];c[na>>2]=c[(c[o>>2]|0)+((c[p>>2]|0)-2<<2)>>2];c[oa>>2]=c[(c[k>>2]|0)+((c[p>>2]|0)-1<<2)>>2];do if((c[oa>>2]|0)>>>0>=(c[ma>>2]|0)>>>0){if((c[oa>>2]|0)>>>0<=(c[ma>>2]|0)>>>0?(Ko(c[k>>2]|0,c[o>>2]|0,(c[p>>2]|0)-1|0)|0)<0:0)break;rp(c[k>>2]|0,c[k>>2]|0,c[o>>2]|0,c[p>>2]|0)|0;c[oa>>2]=c[(c[k>>2]|0)+((c[p>>2]|0)-1<<2)>>2];c[q>>2]=1}while(0);c[la>>2]=(c[j>>2]|0)+(c[n>>2]|0)-(c[p>>2]|0)-1;while(1){if((c[la>>2]|0)<0)break;if((c[la>>2]|0)>=(c[j>>2]|0)){c[k>>2]=(c[k>>2]|0)+-4;c[ra>>2]=c[(c[k>>2]|0)+(c[p>>2]<<2)>>2]}else{c[ra>>2]=c[(c[k>>2]|0)+((c[p>>2]|0)-1<<2)>>2];c[ta>>2]=(c[p>>2]|0)-1-1;while(1){if((c[ta>>2]|0)<0)break;c[(c[k>>2]|0)+4+(c[ta>>2]<<2)>>2]=c[(c[k>>2]|0)+(c[ta>>2]<<2)>>2];c[ta>>2]=(c[ta>>2]|0)+-1}c[c[k>>2]>>2]=0}a:do if((c[oa>>2]|0)==(c[ma>>2]|0))c[pa>>2]=-1;else{c[va>>2]=(c[ma>>2]|0)>>>16;c[wa>>2]=c[ma>>2]&65535;c[za>>2]=((c[oa>>2]|0)>>>0)%((c[va>>2]|0)>>>0)|0;c[xa>>2]=((c[oa>>2]|0)>>>0)/((c[va>>2]|0)>>>0)|0;c[Ba>>2]=S(c[xa>>2]|0,c[wa>>2]|0)|0;c[za>>2]=c[za>>2]<<16|(c[(c[k>>2]|0)+((c[p>>2]|0)-1<<2)>>2]|0)>>>16;if(((c[za>>2]|0)>>>0<(c[Ba>>2]|0)>>>0?(c[xa>>2]=(c[xa>>2]|0)+-1,c[za>>2]=(c[za>>2]|0)+(c[ma>>2]|0),(c[za>>2]|0)>>>0>=(c[ma>>2]|0)>>>0):0)?(c[za>>2]|0)>>>0<(c[Ba>>2]|0)>>>0:0){c[xa>>2]=(c[xa>>2]|0)+-1;c[za>>2]=(c[za>>2]|0)+(c[ma>>2]|0)}c[za>>2]=(c[za>>2]|0)-(c[Ba>>2]|0);c[Aa>>2]=((c[za>>2]|0)>>>0)%((c[va>>2]|0)>>>0)|0;c[ya>>2]=((c[za>>2]|0)>>>0)/((c[va>>2]|0)>>>0)|0;c[Ba>>2]=S(c[ya>>2]|0,c[wa>>2]|0)|0;c[Aa>>2]=c[Aa>>2]<<16|c[(c[k>>2]|0)+((c[p>>2]|0)-1<<2)>>2]&65535;if(((c[Aa>>2]|0)>>>0<(c[Ba>>2]|0)>>>0?(c[ya>>2]=(c[ya>>2]|0)+-1,c[Aa>>2]=(c[Aa>>2]|0)+(c[ma>>2]|0),(c[Aa>>2]|0)>>>0>=(c[ma>>2]|0)>>>0):0)?(c[Aa>>2]|0)>>>0<(c[Ba>>2]|0)>>>0:0){c[ya>>2]=(c[ya>>2]|0)+-1;c[Aa>>2]=(c[Aa>>2]|0)+(c[ma>>2]|0)}c[Aa>>2]=(c[Aa>>2]|0)-(c[Ba>>2]|0);c[pa>>2]=c[xa>>2]<<16|c[ya>>2];c[ua>>2]=c[Aa>>2];c[Ka>>2]=c[na>>2];c[La>>2]=c[pa>>2];c[Ga>>2]=c[Ka>>2]&65535;c[Ia>>2]=(c[Ka>>2]|0)>>>16;c[Ha>>2]=c[La>>2]&65535;c[Ja>>2]=(c[La>>2]|0)>>>16;c[Ca>>2]=S(c[Ga>>2]|0,c[Ha>>2]|0)|0;c[Da>>2]=S(c[Ga>>2]|0,c[Ja>>2]|0)|0;c[Ea>>2]=S(c[Ia>>2]|0,c[Ha>>2]|0)|0;c[Fa>>2]=S(c[Ia>>2]|0,c[Ja>>2]|0)|0;c[Da>>2]=(c[Da>>2]|0)+((c[Ca>>2]|0)>>>16);c[Da>>2]=(c[Da>>2]|0)+(c[Ea>>2]|0);if((c[Da>>2]|0)>>>0<(c[Ea>>2]|0)>>>0)c[Fa>>2]=(c[Fa>>2]|0)+65536;c[qa>>2]=(c[Fa>>2]|0)+((c[Da>>2]|0)>>>16);c[oa>>2]=((c[Da>>2]&65535)<<16)+(c[Ca>>2]&65535);while(1){if((c[qa>>2]|0)>>>0<=(c[ua>>2]|0)>>>0){if((c[qa>>2]|0)!=(c[ua>>2]|0))break a;if((c[oa>>2]|0)>>>0<=(c[(c[k>>2]|0)+((c[p>>2]|0)-2<<2)>>2]|0)>>>0)break a}c[pa>>2]=(c[pa>>2]|0)+-1;c[ua>>2]=(c[ua>>2]|0)+(c[ma>>2]|0);if((c[ua>>2]|0)>>>0<(c[ma>>2]|0)>>>0)break a;c[qa>>2]=(c[qa>>2]|0)-((c[oa>>2]|0)>>>0<(c[na>>2]|0)>>>0&1);c[oa>>2]=(c[oa>>2]|0)-(c[na>>2]|0)}}while(0);c[sa>>2]=kp(c[k>>2]|0,c[o>>2]|0,c[p>>2]|0,c[pa>>2]|0)|0;if((c[ra>>2]|0)!=(c[sa>>2]|0)){ep(c[k>>2]|0,c[k>>2]|0,c[o>>2]|0,c[p>>2]|0)|0;c[pa>>2]=(c[pa>>2]|0)+-1}c[(c[i>>2]|0)+(c[la>>2]<<2)>>2]=c[pa>>2];c[oa>>2]=c[(c[k>>2]|0)+((c[p>>2]|0)-1<<2)>>2];c[la>>2]=(c[la>>2]|0)+-1}Ma=c[q>>2]|0;l=h;return Ma|0}}return 0}function hp(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;g=l;l=l+144|0;if((l|0)>=(m|0))$(144);h=g+128|0;i=g+124|0;j=g+120|0;k=g+116|0;n=g+112|0;o=g+108|0;p=g+104|0;q=g+100|0;r=g+96|0;s=g+92|0;t=g+88|0;u=g+84|0;v=g+80|0;w=g+76|0;x=g+72|0;y=g+68|0;z=g+64|0;A=g+60|0;B=g+56|0;C=g+52|0;D=g+48|0;E=g+44|0;F=g+40|0;G=g+36|0;H=g+32|0;I=g+28|0;J=g+24|0;K=g+20|0;L=g+16|0;M=g+12|0;N=g+8|0;O=g+4|0;P=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;if(!(c[k>>2]|0)){c[h>>2]=0;Q=c[h>>2]|0;l=g;return Q|0}c[t>>2]=c[n>>2];f=c[t>>2]|0;c[u>>2]=(c[t>>2]|0)>>>0<65536?(f>>>0<256?0:8):f>>>0<16777216?16:24;c[s>>2]=32-((d[45848+((c[t>>2]|0)>>>(c[u>>2]|0))>>0]|0)+(c[u>>2]|0));if(!(c[s>>2]|0)){c[o>>2]=(c[k>>2]|0)-1;c[r>>2]=c[(c[j>>2]|0)+(c[o>>2]<<2)>>2];if((c[r>>2]|0)>>>0>=(c[n>>2]|0)>>>0)c[r>>2]=0;else{u=c[o>>2]|0;c[o>>2]=u+-1;c[(c[i>>2]|0)+(u<<2)>>2]=0}while(1){if((c[o>>2]|0)<0)break;c[q>>2]=c[(c[j>>2]|0)+(c[o>>2]<<2)>>2];c[J>>2]=(c[n>>2]|0)>>>16;c[K>>2]=c[n>>2]&65535;c[N>>2]=((c[r>>2]|0)>>>0)%((c[J>>2]|0)>>>0)|0;c[L>>2]=((c[r>>2]|0)>>>0)/((c[J>>2]|0)>>>0)|0;c[P>>2]=S(c[L>>2]|0,c[K>>2]|0)|0;c[N>>2]=c[N>>2]<<16|(c[q>>2]|0)>>>16;if(((c[N>>2]|0)>>>0<(c[P>>2]|0)>>>0?(c[L>>2]=(c[L>>2]|0)+-1,c[N>>2]=(c[N>>2]|0)+(c[n>>2]|0),(c[N>>2]|0)>>>0>=(c[n>>2]|0)>>>0):0)?(c[N>>2]|0)>>>0<(c[P>>2]|0)>>>0:0){c[L>>2]=(c[L>>2]|0)+-1;c[N>>2]=(c[N>>2]|0)+(c[n>>2]|0)}c[N>>2]=(c[N>>2]|0)-(c[P>>2]|0);c[O>>2]=((c[N>>2]|0)>>>0)%((c[J>>2]|0)>>>0)|0;c[M>>2]=((c[N>>2]|0)>>>0)/((c[J>>2]|0)>>>0)|0;c[P>>2]=S(c[M>>2]|0,c[K>>2]|0)|0;c[O>>2]=c[O>>2]<<16|c[q>>2]&65535;if(((c[O>>2]|0)>>>0<(c[P>>2]|0)>>>0?(c[M>>2]=(c[M>>2]|0)+-1,c[O>>2]=(c[O>>2]|0)+(c[n>>2]|0),(c[O>>2]|0)>>>0>=(c[n>>2]|0)>>>0):0)?(c[O>>2]|0)>>>0<(c[P>>2]|0)>>>0:0){c[M>>2]=(c[M>>2]|0)+-1;c[O>>2]=(c[O>>2]|0)+(c[n>>2]|0)}c[O>>2]=(c[O>>2]|0)-(c[P>>2]|0);c[(c[i>>2]|0)+(c[o>>2]<<2)>>2]=c[L>>2]<<16|c[M>>2];c[r>>2]=c[O>>2];c[o>>2]=(c[o>>2]|0)+-1}c[h>>2]=c[r>>2];Q=c[h>>2]|0;l=g;return Q|0}c[n>>2]=c[n>>2]<>2];c[p>>2]=c[(c[j>>2]|0)+((c[k>>2]|0)-1<<2)>>2];c[r>>2]=(c[p>>2]|0)>>>(32-(c[s>>2]|0)|0);c[o>>2]=(c[k>>2]|0)-2;while(1){if((c[o>>2]|0)<0)break;c[q>>2]=c[(c[j>>2]|0)+(c[o>>2]<<2)>>2];c[v>>2]=(c[n>>2]|0)>>>16;c[w>>2]=c[n>>2]&65535;c[z>>2]=((c[r>>2]|0)>>>0)%((c[v>>2]|0)>>>0)|0;c[x>>2]=((c[r>>2]|0)>>>0)/((c[v>>2]|0)>>>0)|0;c[B>>2]=S(c[x>>2]|0,c[w>>2]|0)|0;c[z>>2]=c[z>>2]<<16|(c[p>>2]<>2]|(c[q>>2]|0)>>>(32-(c[s>>2]|0)|0))>>>16;if(((c[z>>2]|0)>>>0<(c[B>>2]|0)>>>0?(c[x>>2]=(c[x>>2]|0)+-1,c[z>>2]=(c[z>>2]|0)+(c[n>>2]|0),(c[z>>2]|0)>>>0>=(c[n>>2]|0)>>>0):0)?(c[z>>2]|0)>>>0<(c[B>>2]|0)>>>0:0){c[x>>2]=(c[x>>2]|0)+-1;c[z>>2]=(c[z>>2]|0)+(c[n>>2]|0)}c[z>>2]=(c[z>>2]|0)-(c[B>>2]|0);c[A>>2]=((c[z>>2]|0)>>>0)%((c[v>>2]|0)>>>0)|0;c[y>>2]=((c[z>>2]|0)>>>0)/((c[v>>2]|0)>>>0)|0;c[B>>2]=S(c[y>>2]|0,c[w>>2]|0)|0;c[A>>2]=c[A>>2]<<16|(c[p>>2]<>2]|(c[q>>2]|0)>>>(32-(c[s>>2]|0)|0))&65535;if(((c[A>>2]|0)>>>0<(c[B>>2]|0)>>>0?(c[y>>2]=(c[y>>2]|0)+-1,c[A>>2]=(c[A>>2]|0)+(c[n>>2]|0),(c[A>>2]|0)>>>0>=(c[n>>2]|0)>>>0):0)?(c[A>>2]|0)>>>0<(c[B>>2]|0)>>>0:0){c[y>>2]=(c[y>>2]|0)+-1;c[A>>2]=(c[A>>2]|0)+(c[n>>2]|0)}c[A>>2]=(c[A>>2]|0)-(c[B>>2]|0);c[(c[i>>2]|0)+((c[o>>2]|0)+1<<2)>>2]=c[x>>2]<<16|c[y>>2];c[r>>2]=c[A>>2];c[p>>2]=c[q>>2];c[o>>2]=(c[o>>2]|0)+-1}c[C>>2]=(c[n>>2]|0)>>>16;c[D>>2]=c[n>>2]&65535;c[G>>2]=((c[r>>2]|0)>>>0)%((c[C>>2]|0)>>>0)|0;c[E>>2]=((c[r>>2]|0)>>>0)/((c[C>>2]|0)>>>0)|0;c[I>>2]=S(c[E>>2]|0,c[D>>2]|0)|0;c[G>>2]=c[G>>2]<<16|c[p>>2]<>2]>>>16;if(((c[G>>2]|0)>>>0<(c[I>>2]|0)>>>0?(c[E>>2]=(c[E>>2]|0)+-1,c[G>>2]=(c[G>>2]|0)+(c[n>>2]|0),(c[G>>2]|0)>>>0>=(c[n>>2]|0)>>>0):0)?(c[G>>2]|0)>>>0<(c[I>>2]|0)>>>0:0){c[E>>2]=(c[E>>2]|0)+-1;c[G>>2]=(c[G>>2]|0)+(c[n>>2]|0)}c[G>>2]=(c[G>>2]|0)-(c[I>>2]|0);c[H>>2]=((c[G>>2]|0)>>>0)%((c[C>>2]|0)>>>0)|0;c[F>>2]=((c[G>>2]|0)>>>0)/((c[C>>2]|0)>>>0)|0;c[I>>2]=S(c[F>>2]|0,c[D>>2]|0)|0;c[H>>2]=c[H>>2]<<16|c[p>>2]<>2]&65535;if(((c[H>>2]|0)>>>0<(c[I>>2]|0)>>>0?(c[F>>2]=(c[F>>2]|0)+-1,c[H>>2]=(c[H>>2]|0)+(c[n>>2]|0),(c[H>>2]|0)>>>0>=(c[n>>2]|0)>>>0):0)?(c[H>>2]|0)>>>0<(c[I>>2]|0)>>>0:0){c[F>>2]=(c[F>>2]|0)+-1;c[H>>2]=(c[H>>2]|0)+(c[n>>2]|0)}c[H>>2]=(c[H>>2]|0)-(c[I>>2]|0);c[c[i>>2]>>2]=c[E>>2]<<16|c[F>>2];c[r>>2]=c[H>>2];c[h>>2]=(c[r>>2]|0)>>>(c[s>>2]|0);Q=c[h>>2]|0;l=g;return Q|0}function ip(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+36|0;h=f+32|0;i=f+28|0;j=f+24|0;k=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;r=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[o>>2]=c[j>>2];c[g>>2]=(c[g>>2]|0)+4;c[p>>2]=32-(c[o>>2]|0);c[q>>2]=(c[i>>2]|0)-1;c[n>>2]=c[(c[h>>2]|0)+(c[q>>2]<<2)>>2];c[r>>2]=(c[n>>2]|0)>>>(c[p>>2]|0);c[k>>2]=c[n>>2];while(1){i=(c[q>>2]|0)+-1|0;c[q>>2]=i;if((i|0)<0)break;c[n>>2]=c[(c[h>>2]|0)+(c[q>>2]<<2)>>2];c[(c[g>>2]|0)+(c[q>>2]<<2)>>2]=c[k>>2]<>2]|(c[n>>2]|0)>>>(c[p>>2]|0);c[k>>2]=c[n>>2]}c[(c[g>>2]|0)+(c[q>>2]<<2)>>2]=c[k>>2]<>2];l=f;return c[r>>2]|0}function jp(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;f=l;l=l+80|0;if((l|0)>=(m|0))$(80);g=f+68|0;h=f+64|0;i=f+60|0;j=f+56|0;k=f+52|0;n=f+48|0;o=f+44|0;p=f+40|0;q=f+36|0;r=f+32|0;s=f+28|0;t=f+24|0;u=f+20|0;v=f+16|0;w=f+12|0;x=f+8|0;y=f+4|0;z=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[n>>2]=0-(c[i>>2]|0);c[h>>2]=(c[h>>2]|0)+(0-(c[n>>2]|0)<<2);c[g>>2]=(c[g>>2]|0)+(0-(c[n>>2]|0)<<2);c[k>>2]=0;do{c[y>>2]=c[(c[h>>2]|0)+(c[n>>2]<<2)>>2];c[z>>2]=c[j>>2];c[u>>2]=c[y>>2]&65535;c[w>>2]=(c[y>>2]|0)>>>16;c[v>>2]=c[z>>2]&65535;c[x>>2]=(c[z>>2]|0)>>>16;c[q>>2]=S(c[u>>2]|0,c[v>>2]|0)|0;c[r>>2]=S(c[u>>2]|0,c[x>>2]|0)|0;c[s>>2]=S(c[w>>2]|0,c[v>>2]|0)|0;c[t>>2]=S(c[w>>2]|0,c[x>>2]|0)|0;c[r>>2]=(c[r>>2]|0)+((c[q>>2]|0)>>>16);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);if((c[r>>2]|0)>>>0<(c[s>>2]|0)>>>0)c[t>>2]=(c[t>>2]|0)+65536;c[o>>2]=(c[t>>2]|0)+((c[r>>2]|0)>>>16);c[p>>2]=((c[r>>2]&65535)<<16)+(c[q>>2]&65535);c[p>>2]=(c[p>>2]|0)+(c[k>>2]|0);c[k>>2]=((c[p>>2]|0)>>>0<(c[k>>2]|0)>>>0?1:0)+(c[o>>2]|0);c[(c[g>>2]|0)+(c[n>>2]<<2)>>2]=c[p>>2];i=(c[n>>2]|0)+1|0;c[n>>2]=i}while((i|0)!=0);l=f;return c[k>>2]|0}function kp(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;f=l;l=l+80|0;if((l|0)>=(m|0))$(80);g=f+72|0;h=f+68|0;i=f+64|0;j=f+60|0;k=f+56|0;n=f+52|0;o=f+48|0;p=f+44|0;q=f+40|0;r=f+36|0;s=f+32|0;t=f+28|0;u=f+24|0;v=f+20|0;w=f+16|0;x=f+12|0;y=f+8|0;z=f+4|0;A=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[n>>2]=0-(c[i>>2]|0);c[g>>2]=(c[g>>2]|0)+(0-(c[n>>2]|0)<<2);c[h>>2]=(c[h>>2]|0)+(0-(c[n>>2]|0)<<2);c[k>>2]=0;do{c[z>>2]=c[(c[h>>2]|0)+(c[n>>2]<<2)>>2];c[A>>2]=c[j>>2];c[v>>2]=c[z>>2]&65535;c[x>>2]=(c[z>>2]|0)>>>16;c[w>>2]=c[A>>2]&65535;c[y>>2]=(c[A>>2]|0)>>>16;c[r>>2]=S(c[v>>2]|0,c[w>>2]|0)|0;c[s>>2]=S(c[v>>2]|0,c[y>>2]|0)|0;c[t>>2]=S(c[x>>2]|0,c[w>>2]|0)|0;c[u>>2]=S(c[x>>2]|0,c[y>>2]|0)|0;c[s>>2]=(c[s>>2]|0)+((c[r>>2]|0)>>>16);c[s>>2]=(c[s>>2]|0)+(c[t>>2]|0);if((c[s>>2]|0)>>>0<(c[t>>2]|0)>>>0)c[u>>2]=(c[u>>2]|0)+65536;c[o>>2]=(c[u>>2]|0)+((c[s>>2]|0)>>>16);c[p>>2]=((c[s>>2]&65535)<<16)+(c[r>>2]&65535);c[p>>2]=(c[p>>2]|0)+(c[k>>2]|0);c[k>>2]=((c[p>>2]|0)>>>0<(c[k>>2]|0)>>>0?1:0)+(c[o>>2]|0);c[q>>2]=c[(c[g>>2]|0)+(c[n>>2]<<2)>>2];c[p>>2]=(c[q>>2]|0)-(c[p>>2]|0);c[k>>2]=(c[k>>2]|0)+((c[p>>2]|0)>>>0>(c[q>>2]|0)>>>0?1:0);c[(c[g>>2]|0)+(c[n>>2]<<2)>>2]=c[p>>2];i=(c[n>>2]|0)+1|0;c[n>>2]=i}while((i|0)!=0);l=f;return c[k>>2]|0}function lp(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+32|0;h=f+28|0;i=f+24|0;j=f+20|0;k=f+16|0;n=f+12|0;o=f+8|0;p=f+4|0;q=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[o>>2]=c[c[i>>2]>>2];if((c[o>>2]|0)>>>0<=1){a:do if((c[o>>2]|0)==1){c[p>>2]=0;while(1){if((c[p>>2]|0)>=(c[j>>2]|0))break a;c[(c[g>>2]|0)+(c[p>>2]<<2)>>2]=c[(c[h>>2]|0)+(c[p>>2]<<2)>>2];c[p>>2]=(c[p>>2]|0)+1}}else{c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[j>>2]|0))break a;c[(c[g>>2]|0)+(c[q>>2]<<2)>>2]=0;c[q>>2]=(c[q>>2]|0)+1}}while(0);c[n>>2]=0}else c[n>>2]=jp(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,c[o>>2]|0)|0;c[(c[g>>2]|0)+(c[j>>2]<<2)>>2]=c[n>>2];c[g>>2]=(c[g>>2]|0)+4;c[k>>2]=1;while(1){if((c[k>>2]|0)>=(c[j>>2]|0))break;c[o>>2]=c[(c[i>>2]|0)+(c[k>>2]<<2)>>2];if((c[o>>2]|0)>>>0<=1){c[n>>2]=0;if((c[o>>2]|0)==1)c[n>>2]=ep(c[g>>2]|0,c[g>>2]|0,c[h>>2]|0,c[j>>2]|0)|0}else c[n>>2]=qt(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0,c[o>>2]|0)|0;c[(c[g>>2]|0)+(c[j>>2]<<2)>>2]=c[n>>2];c[g>>2]=(c[g>>2]|0)+4;c[k>>2]=(c[k>>2]|0)+1}l=f;return c[n>>2]|0}function mp(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+44|0;i=g+40|0;j=g+36|0;k=g+32|0;n=g+28|0;o=g+24|0;p=g+20|0;q=g+16|0;r=g+12|0;s=g+8|0;t=g+4|0;u=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=c[k>>2]|0;if(c[k>>2]&1|0){c[o>>2]=f-1;e=c[h>>2]|0;d=c[i>>2]|0;b=c[j>>2]|0;a=c[o>>2]|0;if((c[o>>2]|0)<16)lp(e,d,b,a)|0;else mp(e,d,b,a,c[n>>2]|0);c[p>>2]=qt((c[h>>2]|0)+(c[o>>2]<<2)|0,c[i>>2]|0,c[o>>2]|0,c[(c[j>>2]|0)+(c[o>>2]<<2)>>2]|0)|0;c[(c[h>>2]|0)+((c[o>>2]|0)+(c[o>>2]|0)<<2)>>2]=c[p>>2];c[p>>2]=qt((c[h>>2]|0)+(c[o>>2]<<2)|0,c[j>>2]|0,c[k>>2]|0,c[(c[i>>2]|0)+(c[o>>2]<<2)>>2]|0)|0;c[(c[h>>2]|0)+((c[o>>2]|0)+(c[k>>2]|0)<<2)>>2]=c[p>>2];l=g;return}c[q>>2]=f>>1;f=(c[h>>2]|0)+(c[k>>2]<<2)|0;p=(c[i>>2]|0)+(c[q>>2]<<2)|0;o=(c[j>>2]|0)+(c[q>>2]<<2)|0;a=c[q>>2]|0;if((c[q>>2]|0)<16)lp(f,p,o,a)|0;else mp(f,p,o,a,c[n>>2]|0);a=(Ko((c[i>>2]|0)+(c[q>>2]<<2)|0,c[i>>2]|0,c[q>>2]|0)|0)>=0;o=c[h>>2]|0;p=c[i>>2]|0;if(a){rp(o,p+(c[q>>2]<<2)|0,c[i>>2]|0,c[q>>2]|0)|0;c[s>>2]=0}else{rp(o,p,(c[i>>2]|0)+(c[q>>2]<<2)|0,c[q>>2]|0)|0;c[s>>2]=1}p=(Ko((c[j>>2]|0)+(c[q>>2]<<2)|0,c[j>>2]|0,c[q>>2]|0)|0)>=0;o=(c[h>>2]|0)+(c[q>>2]<<2)|0;a=c[j>>2]|0;if(p){rp(o,a+(c[q>>2]<<2)|0,c[j>>2]|0,c[q>>2]|0)|0;c[s>>2]=c[s>>2]^1}else rp(o,a,(c[j>>2]|0)+(c[q>>2]<<2)|0,c[q>>2]|0)|0;a=c[n>>2]|0;o=c[h>>2]|0;p=(c[h>>2]|0)+(c[q>>2]<<2)|0;f=c[q>>2]|0;if((c[q>>2]|0)<16)lp(a,o,p,f)|0;else mp(a,o,p,f,(c[n>>2]|0)+(c[k>>2]<<2)|0);c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[q>>2]|0))break;c[(c[h>>2]|0)+(c[q>>2]<<2)+(c[t>>2]<<2)>>2]=c[(c[h>>2]|0)+(c[k>>2]<<2)+(c[t>>2]<<2)>>2];c[t>>2]=(c[t>>2]|0)+1}c[r>>2]=ep((c[h>>2]|0)+(c[k>>2]<<2)|0,(c[h>>2]|0)+(c[k>>2]<<2)|0,(c[h>>2]|0)+(c[k>>2]<<2)+(c[q>>2]<<2)|0,c[q>>2]|0)|0;t=(c[h>>2]|0)+(c[q>>2]<<2)|0;f=(c[h>>2]|0)+(c[q>>2]<<2)|0;p=c[n>>2]|0;o=c[k>>2]|0;if(c[s>>2]|0){s=rp(t,f,p,o)|0;c[r>>2]=(c[r>>2]|0)-s}else{s=ep(t,f,p,o)|0;c[r>>2]=(c[r>>2]|0)+s}s=c[n>>2]|0;o=c[i>>2]|0;i=c[j>>2]|0;j=c[q>>2]|0;if((c[q>>2]|0)<16)lp(s,o,i,j)|0;else mp(s,o,i,j,(c[n>>2]|0)+(c[k>>2]<<2)|0);j=ep((c[h>>2]|0)+(c[q>>2]<<2)|0,(c[h>>2]|0)+(c[q>>2]<<2)|0,c[n>>2]|0,c[k>>2]|0)|0;c[r>>2]=(c[r>>2]|0)+j;if(c[r>>2]|0)Go((c[h>>2]|0)+(c[q>>2]<<2)+(c[k>>2]<<2)|0,(c[h>>2]|0)+(c[q>>2]<<2)+(c[k>>2]<<2)|0,c[q>>2]|0,c[r>>2]|0)|0;c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[q>>2]|0))break;c[(c[h>>2]|0)+(c[u>>2]<<2)>>2]=c[(c[n>>2]|0)+(c[u>>2]<<2)>>2];c[u>>2]=(c[u>>2]|0)+1}c[r>>2]=ep((c[h>>2]|0)+(c[q>>2]<<2)|0,(c[h>>2]|0)+(c[q>>2]<<2)|0,(c[n>>2]|0)+(c[q>>2]<<2)|0,c[q>>2]|0)|0;if(!(c[r>>2]|0)){l=g;return}Go((c[h>>2]|0)+(c[k>>2]<<2)|0,(c[h>>2]|0)+(c[k>>2]<<2)|0,c[k>>2]|0,1)|0;l=g;return}function np(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+24|0;j=h+20|0;k=h+16|0;n=h+12|0;o=h+8|0;p=h+4|0;q=h;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;if(!(c[(c[p>>2]|0)+4>>2]|0?(c[(c[p>>2]|0)+12>>2]|0)>=(c[o>>2]|0):0)){if(c[(c[p>>2]|0)+4>>2]|0)yp(c[(c[p>>2]|0)+4>>2]|0,c[(c[p>>2]|0)+8>>2]|0);c[(c[p>>2]|0)+8>>2]=c[o>>2]<<1;g=c[o>>2]<<1;if(tf(c[j>>2]|0)|0)r=1;else r=(tf(c[n>>2]|0)|0)!=0;f=wp(g,r&1)|0;c[(c[p>>2]|0)+4>>2]=f;c[(c[p>>2]|0)+12>>2]=c[o>>2]}f=c[i>>2]|0;r=c[j>>2]|0;g=c[n>>2]|0;e=c[o>>2]|0;if((c[o>>2]|0)<16)lp(f,r,g,e)|0;else mp(f,r,g,e,c[(c[p>>2]|0)+4>>2]|0);c[i>>2]=(c[i>>2]|0)+(c[o>>2]<<2);c[j>>2]=(c[j>>2]|0)+(c[o>>2]<<2);c[k>>2]=(c[k>>2]|0)-(c[o>>2]|0);if((c[k>>2]|0)>=(c[o>>2]|0)){if(!(c[(c[p>>2]|0)+16>>2]|0?(c[(c[p>>2]|0)+24>>2]|0)>=(c[o>>2]|0):0)){if(c[(c[p>>2]|0)+16>>2]|0)yp(c[(c[p>>2]|0)+16>>2]|0,c[(c[p>>2]|0)+20>>2]|0);c[(c[p>>2]|0)+20>>2]=c[o>>2]<<1;e=c[o>>2]<<1;if(tf(c[j>>2]|0)|0)s=1;else s=(tf(c[n>>2]|0)|0)!=0;g=wp(e,s&1)|0;c[(c[p>>2]|0)+16>>2]=g;c[(c[p>>2]|0)+24>>2]=c[o>>2]}do{g=c[(c[p>>2]|0)+16>>2]|0;s=c[j>>2]|0;e=c[n>>2]|0;r=c[o>>2]|0;if((c[o>>2]|0)<16)lp(g,s,e,r)|0;else mp(g,s,e,r,c[(c[p>>2]|0)+4>>2]|0);c[q>>2]=ep(c[i>>2]|0,c[i>>2]|0,c[(c[p>>2]|0)+16>>2]|0,c[o>>2]|0)|0;Go((c[i>>2]|0)+(c[o>>2]<<2)|0,(c[(c[p>>2]|0)+16>>2]|0)+(c[o>>2]<<2)|0,c[o>>2]|0,c[q>>2]|0)|0;c[i>>2]=(c[i>>2]|0)+(c[o>>2]<<2);c[j>>2]=(c[j>>2]|0)+(c[o>>2]<<2);c[k>>2]=(c[k>>2]|0)-(c[o>>2]|0)}while((c[k>>2]|0)>=(c[o>>2]|0))}if(!(c[k>>2]|0)){l=h;return}r=c[p>>2]|0;if((c[k>>2]|0)<16)op(c[r+4>>2]|0,c[n>>2]|0,c[o>>2]|0,c[j>>2]|0,c[k>>2]|0)|0;else{if(!(c[r>>2]|0)){r=Cf(1,28)|0;c[c[p>>2]>>2]=r}np(c[(c[p>>2]|0)+4>>2]|0,c[n>>2]|0,c[o>>2]|0,c[j>>2]|0,c[k>>2]|0,c[c[p>>2]>>2]|0)}c[q>>2]=ep(c[i>>2]|0,c[i>>2]|0,c[(c[p>>2]|0)+4>>2]|0,c[o>>2]|0)|0;Go((c[i>>2]|0)+(c[o>>2]<<2)|0,(c[(c[p>>2]|0)+4>>2]|0)+(c[o>>2]<<2)|0,c[k>>2]|0,c[q>>2]|0)|0;l=h;return}function op(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;g=l;l=l+80|0;if((l|0)>=(m|0))$(80);h=g+72|0;i=g+68|0;j=g+64|0;k=g+60|0;n=g+56|0;o=g+52|0;p=g+48|0;q=g+44|0;r=g+16|0;s=g+12|0;t=g+8|0;u=g+4|0;v=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=(c[i>>2]|0)+(c[k>>2]<<2)+(c[o>>2]<<2)+-4;if((c[o>>2]|0)>=16){c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;c[r+12>>2]=0;c[r+16>>2]=0;c[r+20>>2]=0;c[r+24>>2]=0;np(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,r);pp(r);c[h>>2]=c[c[p>>2]>>2];w=c[h>>2]|0;l=g;return w|0}if(!(c[o>>2]|0)){c[h>>2]=0;w=c[h>>2]|0;l=g;return w|0}c[t>>2]=c[c[n>>2]>>2];if((c[t>>2]|0)>>>0<=1){a:do if((c[t>>2]|0)==1){c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[k>>2]|0))break a;c[(c[i>>2]|0)+(c[u>>2]<<2)>>2]=c[(c[j>>2]|0)+(c[u>>2]<<2)>>2];c[u>>2]=(c[u>>2]|0)+1}}else{c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[k>>2]|0))break a;c[(c[i>>2]|0)+(c[v>>2]<<2)>>2]=0;c[v>>2]=(c[v>>2]|0)+1}}while(0);c[q>>2]=0}else c[q>>2]=jp(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[t>>2]|0)|0;c[(c[i>>2]|0)+(c[k>>2]<<2)>>2]=c[q>>2];c[i>>2]=(c[i>>2]|0)+4;c[s>>2]=1;while(1){if((c[s>>2]|0)>=(c[o>>2]|0))break;c[t>>2]=c[(c[n>>2]|0)+(c[s>>2]<<2)>>2];if((c[t>>2]|0)>>>0<=1){c[q>>2]=0;if((c[t>>2]|0)==1)c[q>>2]=ep(c[i>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0)|0}else c[q>>2]=qt(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[t>>2]|0)|0;c[(c[i>>2]|0)+(c[k>>2]<<2)>>2]=c[q>>2];c[i>>2]=(c[i>>2]|0)+4;c[s>>2]=(c[s>>2]|0)+1}c[h>>2]=c[q>>2];w=c[h>>2]|0;l=g;return w|0}function pp(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;if(c[(c[d>>2]|0)+16>>2]|0)yp(c[(c[d>>2]|0)+16>>2]|0,c[(c[d>>2]|0)+20>>2]|0);if(c[(c[d>>2]|0)+4>>2]|0)yp(c[(c[d>>2]|0)+4>>2]|0,c[(c[d>>2]|0)+8>>2]|0);c[d>>2]=c[c[d>>2]>>2];while(1){if(!(c[d>>2]|0))break;c[e>>2]=c[c[d>>2]>>2];if(c[(c[d>>2]|0)+16>>2]|0)yp(c[(c[d>>2]|0)+16>>2]|0,c[(c[d>>2]|0)+20>>2]|0);if(c[(c[d>>2]|0)+4>>2]|0)yp(c[(c[d>>2]|0)+4>>2]|0,c[(c[d>>2]|0)+8>>2]|0);vf(c[d>>2]|0);c[d>>2]=c[e>>2]}l=b;return}function qp(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+36|0;h=f+32|0;i=f+28|0;j=f+24|0;k=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;r=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[o>>2]=c[j>>2];c[g>>2]=(c[g>>2]|0)+-4;c[p>>2]=32-(c[o>>2]|0);c[k>>2]=c[c[h>>2]>>2];c[r>>2]=c[k>>2]<>2];c[n>>2]=c[k>>2];c[q>>2]=1;while(1){if((c[q>>2]|0)>=(c[i>>2]|0))break;c[k>>2]=c[(c[h>>2]|0)+(c[q>>2]<<2)>>2];c[(c[g>>2]|0)+(c[q>>2]<<2)>>2]=(c[n>>2]|0)>>>(c[o>>2]|0)|c[k>>2]<>2];c[n>>2]=c[k>>2];c[q>>2]=(c[q>>2]|0)+1}c[(c[g>>2]|0)+(c[q>>2]<<2)>>2]=(c[n>>2]|0)>>>(c[o>>2]|0);l=f;return c[r>>2]|0}function rp(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;p=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[p>>2]=0-(c[j>>2]|0);c[h>>2]=(c[h>>2]|0)+(0-(c[p>>2]|0)<<2);c[i>>2]=(c[i>>2]|0)+(0-(c[p>>2]|0)<<2);c[g>>2]=(c[g>>2]|0)+(0-(c[p>>2]|0)<<2);c[o>>2]=0;do{c[n>>2]=c[(c[i>>2]|0)+(c[p>>2]<<2)>>2];c[k>>2]=c[(c[h>>2]|0)+(c[p>>2]<<2)>>2];c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);c[o>>2]=(c[n>>2]|0)>>>0<(c[o>>2]|0)>>>0&1;c[n>>2]=(c[k>>2]|0)-(c[n>>2]|0);c[o>>2]=(c[o>>2]|0)+((c[n>>2]|0)>>>0>(c[k>>2]|0)>>>0&1);c[(c[g>>2]|0)+(c[p>>2]<<2)>>2]=c[n>>2];j=(c[p>>2]|0)+1|0;c[p>>2]=j}while((j|0)!=0);l=f;return c[o>>2]|0}function sp(){return 46198}function tp(){var a=0,b=0,d=0,e=0,f=0,g=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+8|0;e=a+4|0;c[d>>2]=0;a:while(1){if((c[d>>2]|0)>=6){f=12;break}switch(c[d>>2]|0){case 0:{c[e>>2]=0;break}case 1:{c[e>>2]=1;break}case 2:{c[e>>2]=2;break}case 3:{c[e>>2]=3;break}case 4:{c[e>>2]=4;break}case 5:{c[e>>2]=8;break}default:{f=10;break a}}g=up(c[e>>2]|0)|0;c[71004+(c[d>>2]<<2)>>2]=g;c[(c[71004+(c[d>>2]<<2)>>2]|0)+12>>2]=48;c[d>>2]=(c[d>>2]|0)+1}if((f|0)==10){c[b>>2]=c[d>>2];Xe(46342,b)}else if((f|0)==12){l=a;return 0}return 0}function up(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=vp(1)|0;c[c[(c[e>>2]|0)+16>>2]>>2]=c[d>>2];c[(c[e>>2]|0)+4>>2]=c[d>>2]|0?1:0;c[(c[e>>2]|0)+8>>2]=0;l=b;return c[e>>2]|0}function vp(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=zf(20)|0;if(c[d>>2]|0)f=wp(c[d>>2]|0,0)|0;else f=0;c[(c[e>>2]|0)+16>>2]=f;c[c[e>>2]>>2]=c[d>>2];c[(c[e>>2]|0)+4>>2]=0;c[(c[e>>2]|0)+8>>2]=0;c[(c[e>>2]|0)+12>>2]=0;l=b;return c[e>>2]|0}function wp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[h>>2]=(c[e>>2]|0?c[e>>2]|0:1)<<2;b=c[h>>2]|0;if(c[f>>2]|0)i=Bf(b)|0;else i=zf(b)|0;c[g>>2]=i;if(c[e>>2]|0){j=c[g>>2]|0;l=d;return j|0}c[c[g>>2]>>2]=0;j=c[g>>2]|0;l=d;return j|0}function xp(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=zf(20)|0;if(c[d>>2]|0)f=wp(c[d>>2]|0,1)|0;else f=0;c[(c[e>>2]|0)+16>>2]=f;c[c[e>>2]>>2]=c[d>>2];c[(c[e>>2]|0)+12>>2]=1;c[(c[e>>2]|0)+4>>2]=0;c[(c[e>>2]|0)+8>>2]=0;l=b;return c[e>>2]|0}function yp(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+32|0;o=f;p=f+8|0;c[g>>2]=b;c[h>>2]=e;if(!(c[g>>2]|0)){l=f;return}c[i>>2]=c[h>>2]<<2;a:do if(c[i>>2]|0){c[j>>2]=c[g>>2];c[k>>2]=c[i>>2];a[n>>0]=0;h=o;c[h>>2]=d[n>>0];c[h+4>>2]=0;while(1){if(!(c[j>>2]&7|0?(c[k>>2]|0)!=0:0))break;a[c[j>>2]>>0]=a[n>>0]|0;c[j>>2]=(c[j>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+-1}if((c[k>>2]|0)>>>0>=8){h=o;e=gx(c[h>>2]|0,c[h+4>>2]|0,16843009,16843009)|0;h=o;c[h>>2]=e;c[h+4>>2]=D;do{c[p>>2]=c[j>>2];h=o;e=c[h+4>>2]|0;b=c[p>>2]|0;c[b>>2]=c[h>>2];c[b+4>>2]=e;c[k>>2]=(c[k>>2]|0)-8;c[j>>2]=(c[j>>2]|0)+8}while((c[k>>2]|0)>>>0>=8)}while(1){if(!(c[k>>2]|0))break a;a[c[j>>2]>>0]=a[n>>0]|0;c[j>>2]=(c[j>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+-1}}while(0);vf(c[g>>2]|0);l=f;return}function zp(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;yp(c[(c[f>>2]|0)+16>>2]|0,c[c[f>>2]>>2]|0);c[(c[f>>2]|0)+16>>2]=c[g>>2];c[c[f>>2]>>2]=c[h>>2];l=e;return}function Ap(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;b=c[e>>2]|0;if((c[f>>2]|0)>>>0<=(c[c[e>>2]>>2]|0)>>>0){c[g>>2]=c[b+4>>2];while(1){if((c[g>>2]|0)>>>0>=(c[c[e>>2]>>2]|0)>>>0)break;c[(c[(c[e>>2]|0)+16>>2]|0)+(c[g>>2]<<2)>>2]=0;c[g>>2]=(c[g>>2]|0)+1}l=d;return}a=c[e>>2]|0;a:do if(!(c[b+16>>2]|0)){h=c[f>>2]|0;if(c[a+12>>2]&1|0){i=Df(h,4)|0;c[(c[e>>2]|0)+16>>2]=i;break}else{i=Cf(h,4)|0;c[(c[e>>2]|0)+16>>2]=i;break}}else{i=Af(c[a+16>>2]|0,c[f>>2]<<2)|0;c[(c[e>>2]|0)+16>>2]=i;c[g>>2]=c[c[e>>2]>>2];while(1){if((c[g>>2]|0)>>>0>=(c[f>>2]|0)>>>0)break a;c[(c[(c[e>>2]|0)+16>>2]|0)+(c[g>>2]<<2)>>2]=0;c[g>>2]=(c[g>>2]|0)+1}}while(0);c[c[e>>2]>>2]=c[f>>2];l=d;return}function Bp(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(c[d>>2]|0?c[(c[d>>2]|0)+12>>2]&16|0:0){Cp();l=b;return}c[(c[d>>2]|0)+4>>2]=0;c[(c[d>>2]|0)+12>>2]=0;l=b;return}function Cp(){var a=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);Te(46373,a);l=a;return}function Dp(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;c[d>>2]=a;if(!(c[d>>2]|0)){l=b;return}if(c[(c[d>>2]|0)+12>>2]&32|0){l=b;return}a=c[(c[d>>2]|0)+16>>2]|0;if(c[(c[d>>2]|0)+12>>2]&4|0)vf(a);else yp(a,c[c[d>>2]>>2]|0);if(c[(c[d>>2]|0)+12>>2]&-3864|0)Xe(46417,b);vf(c[d>>2]|0);l=b;return}function Ep(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0))c[g>>2]=vp(0)|0;if(c[g>>2]|0?c[(c[g>>2]|0)+12>>2]&16|0:0){Cp();c[f>>2]=c[g>>2];j=c[f>>2]|0;l=e;return j|0}d=c[(c[g>>2]|0)+16>>2]|0;if(c[(c[g>>2]|0)+12>>2]&4|0)vf(d);else yp(d,c[c[g>>2]>>2]|0);c[(c[g>>2]|0)+16>>2]=c[h>>2];c[c[g>>2]>>2]=0;c[(c[g>>2]|0)+4>>2]=0;c[(c[g>>2]|0)+8>>2]=c[i>>2];c[(c[g>>2]|0)+12>>2]=4|c[(c[g>>2]|0)+12>>2]&3840;if(tf(c[(c[g>>2]|0)+16>>2]|0)|0){i=(c[g>>2]|0)+12|0;c[i>>2]=c[i>>2]|1}c[f>>2]=c[g>>2];j=c[f>>2]|0;l=e;return j|0}function Fp(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[k>>2]=(((c[i>>2]|0)+7|0)>>>0)/8|0;d=(tf(c[h>>2]|0)|0)!=0;b=c[k>>2]|0;if(d)n=sf(b)|0;else n=pf(b)|0;c[j>>2]=n;if(c[j>>2]|0){_w(c[j>>2]|0,c[h>>2]|0,c[k>>2]|0)|0;c[f>>2]=Ep(c[g>>2]|0,c[j>>2]|0,c[i>>2]|0)|0;o=c[f>>2]|0;l=e;return o|0}else{c[f>>2]=0;o=c[f>>2]|0;l=e;return o|0}return 0}function Gp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;c[e>>2]=a;c[f>>2]=b;if(!(c[(c[e>>2]|0)+12>>2]&4))Xe(46449,d);if(c[f>>2]|0)c[c[f>>2]>>2]=c[(c[e>>2]|0)+8>>2];l=d;return c[(c[e>>2]|0)+16>>2]|0}function Hp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=Gp(c[f>>2]|0,c[g>>2]|0)|0;if((c[h>>2]|0)==0&(c[g>>2]|0)!=0){c[e>>2]=0;k=c[e>>2]|0;l=d;return k|0}c[j>>2]=(((c[c[g>>2]>>2]|0)+7|0)>>>0)/8|0;g=(tf(c[h>>2]|0)|0)!=0;f=c[j>>2]|0;if(g)n=sf(f)|0;else n=pf(f)|0;c[i>>2]=n;if(c[i>>2]|0)_w(c[i>>2]|0,c[h>>2]|0,c[j>>2]|0)|0;c[e>>2]=c[i>>2];k=c[e>>2]|0;l=d;return k|0}function Ip(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;if(c[d>>2]|0?c[(c[d>>2]|0)+12>>2]&4|0:0){a=(tf(c[(c[d>>2]|0)+16>>2]|0)|0)!=0;h=((c[(c[d>>2]|0)+8>>2]|0)+7|0)/8|0;if(a)i=Bf(h)|0;else i=zf(h)|0;c[g>>2]=i;if(c[(c[d>>2]|0)+16>>2]|0)_w(c[g>>2]|0,c[(c[d>>2]|0)+16>>2]|0,((c[(c[d>>2]|0)+8>>2]|0)+7|0)/8|0|0)|0;c[f>>2]=Ep(0,c[g>>2]|0,c[(c[d>>2]|0)+8>>2]|0)|0;g=(c[f>>2]|0)+12|0;c[g>>2]=c[g>>2]&-49;j=c[f>>2]|0;l=b;return j|0}if(!(c[d>>2]|0)){c[f>>2]=0;j=c[f>>2]|0;l=b;return j|0}if(c[d>>2]|0?c[(c[d>>2]|0)+12>>2]&1|0:0)k=xp(c[(c[d>>2]|0)+4>>2]|0)|0;else k=vp(c[(c[d>>2]|0)+4>>2]|0)|0;c[f>>2]=k;c[(c[f>>2]|0)+4>>2]=c[(c[d>>2]|0)+4>>2];c[(c[f>>2]|0)+8>>2]=c[(c[d>>2]|0)+8>>2];c[(c[f>>2]|0)+12>>2]=c[(c[d>>2]|0)+12>>2];k=(c[f>>2]|0)+12|0;c[k>>2]=c[k>>2]&-49;c[e>>2]=0;while(1){if((c[e>>2]|0)>=(c[(c[f>>2]|0)+4>>2]|0))break;c[(c[(c[f>>2]|0)+16>>2]|0)+(c[e>>2]<<2)>>2]=c[(c[(c[d>>2]|0)+16>>2]|0)+(c[e>>2]<<2)>>2];c[e>>2]=(c[e>>2]|0)+1}j=c[f>>2]|0;l=b;return j|0}function Jp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=c[e>>2]|0;if((c[e>>2]|0)==(c[f>>2]|0)){if(b|0?c[(c[e>>2]|0)+12>>2]&16|0:0){Cp();l=d;return}}else Kp(b,c[f>>2]|0)|0;c[(c[e>>2]|0)+8>>2]=((c[(c[f>>2]|0)+8>>2]|0)!=0^1)&1;l=d;return}function Kp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+28|0;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;k=d+4|0;n=d;c[f>>2]=a;c[g>>2]=b;c[j>>2]=c[(c[g>>2]|0)+4>>2];c[k>>2]=c[(c[g>>2]|0)+8>>2];if(!(c[f>>2]|0))c[f>>2]=vp(c[(c[g>>2]|0)+4>>2]|0)|0;if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&16|0:0){Cp();c[e>>2]=c[f>>2];o=c[e>>2]|0;l=d;return o|0}if((c[c[f>>2]>>2]|0)<(c[j>>2]|0))Ap(c[f>>2]|0,c[j>>2]|0);c[h>>2]=c[(c[f>>2]|0)+16>>2];c[i>>2]=c[(c[g>>2]|0)+16>>2];c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[j>>2]|0))break;c[(c[h>>2]|0)+(c[n>>2]<<2)>>2]=c[(c[i>>2]|0)+(c[n>>2]<<2)>>2];c[n>>2]=(c[n>>2]|0)+1}c[(c[f>>2]|0)+4>>2]=c[j>>2];c[(c[f>>2]|0)+12>>2]=c[(c[g>>2]|0)+12>>2];g=(c[f>>2]|0)+12|0;c[g>>2]=c[g>>2]&-49;c[(c[f>>2]|0)+8>>2]=c[k>>2];c[e>>2]=c[f>>2];o=c[e>>2]|0;l=d;return o|0}function Lp(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;if(c[d>>2]|0?c[(c[d>>2]|0)+12>>2]&4|0:0){c[f>>2]=((c[(c[d>>2]|0)+8>>2]|0)+7|0)/8|0;a=(tf(c[(c[d>>2]|0)+16>>2]|0)|0)!=0;h=c[f>>2]|0;if(a)i=sf(h)|0;else i=pf(h)|0;c[g>>2]=i;_w(c[g>>2]|0,c[(c[d>>2]|0)+16>>2]|0,c[f>>2]|0)|0;c[e>>2]=Ep(0,c[g>>2]|0,c[(c[d>>2]|0)+8>>2]|0)|0;j=c[e>>2]|0;l=b;return j|0}if(!(c[d>>2]|0)){c[e>>2]=0;j=c[e>>2]|0;l=b;return j|0}if(c[d>>2]|0?c[(c[d>>2]|0)+12>>2]&1|0:0)k=xp(c[(c[d>>2]|0)+4>>2]|0)|0;else k=vp(c[(c[d>>2]|0)+4>>2]|0)|0;c[e>>2]=k;c[(c[e>>2]|0)+4>>2]=0;c[(c[e>>2]|0)+8>>2]=0;c[(c[e>>2]|0)+12>>2]=c[(c[d>>2]|0)+12>>2];j=c[e>>2]|0;l=b;return j|0}function Mp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(c[e>>2]|0){if(c[e>>2]|0?c[(c[e>>2]|0)+12>>2]&16|0:0){Cp();l=d;return}zp(c[e>>2]|0,c[(c[f>>2]|0)+16>>2]|0,c[c[f>>2]>>2]|0);c[(c[e>>2]|0)+4>>2]=c[(c[f>>2]|0)+4>>2];c[(c[e>>2]|0)+8>>2]=c[(c[f>>2]|0)+8>>2];c[(c[e>>2]|0)+12>>2]=c[(c[f>>2]|0)+12>>2];c[c[f>>2]>>2]=0;c[(c[f>>2]|0)+4>>2]=0;c[(c[f>>2]|0)+16>>2]=0}Dp(c[f>>2]|0);l=d;return}function Np(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+28|0;g=e+24|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+8|0;n=e+4|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=c[c[g>>2]>>2];c[k>>2]=0-(((c[h>>2]|0)!=0^1^1)&1);if((c[c[f>>2]>>2]|0)!=(c[c[g>>2]>>2]|0))Xe(46479,e);c[i>>2]=0;while(1){o=c[k>>2]|0;if((c[i>>2]|0)>=(c[j>>2]|0))break;c[n>>2]=o&(c[(c[(c[f>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]^c[(c[(c[g>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]);c[(c[(c[f>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]=c[(c[(c[f>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]^c[n>>2];c[i>>2]=(c[i>>2]|0)+1}c[n>>2]=o&(c[(c[f>>2]|0)+4>>2]^c[(c[g>>2]|0)+4>>2]);c[(c[f>>2]|0)+4>>2]=c[(c[f>>2]|0)+4>>2]^c[n>>2];c[n>>2]=c[k>>2]&(c[(c[f>>2]|0)+8>>2]^c[(c[g>>2]|0)+8>>2]);c[(c[f>>2]|0)+8>>2]=c[(c[f>>2]|0)+8>>2]^c[n>>2];l=e;return c[f>>2]|0}function Op(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;if(!(c[f>>2]|0))c[f>>2]=vp(1)|0;if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&16|0:0){Cp();c[e>>2]=c[f>>2];h=c[e>>2]|0;l=d;return h|0}if((c[c[f>>2]>>2]|0)<1)Ap(c[f>>2]|0,1);c[c[(c[f>>2]|0)+16>>2]>>2]=c[g>>2];c[(c[f>>2]|0)+4>>2]=c[g>>2]|0?1:0;c[(c[f>>2]|0)+8>>2]=0;c[(c[f>>2]|0)+12>>2]=0;c[e>>2]=c[f>>2];h=c[e>>2]|0;l=d;return h|0}function Pp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+24|0;f=d+20|0;g=d;c[e>>2]=a;c[f>>2]=b;b=c[e>>2]|0;c[g>>2]=c[b>>2];c[g+4>>2]=c[b+4>>2];c[g+8>>2]=c[b+8>>2];c[g+12>>2]=c[b+12>>2];c[g+16>>2]=c[b+16>>2];b=c[e>>2]|0;e=c[f>>2]|0;c[b>>2]=c[e>>2];c[b+4>>2]=c[e+4>>2];c[b+8>>2]=c[e+8>>2];c[b+12>>2]=c[e+12>>2];c[b+16>>2]=c[e+16>>2];e=c[f>>2]|0;c[e>>2]=c[g>>2];c[e+4>>2]=c[g+4>>2];c[e+8>>2]=c[g+8>>2];c[e+12>>2]=c[g+12>>2];c[e+16>>2]=c[g+16>>2];l=d;return}function Qp(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+28|0;g=e+24|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+8|0;n=e+4|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=c[c[f>>2]>>2];c[k>>2]=0-(((c[h>>2]|0)!=0^1^1)&1);if((c[c[f>>2]>>2]|0)!=(c[c[g>>2]>>2]|0))Xe(46510,e);c[i>>2]=0;while(1){o=c[k>>2]|0;if((c[i>>2]|0)>=(c[j>>2]|0))break;c[n>>2]=o&(c[(c[(c[f>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]^c[(c[(c[g>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]);c[(c[(c[f>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]=c[(c[(c[f>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]^c[n>>2];c[(c[(c[g>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]=c[(c[(c[g>>2]|0)+16>>2]|0)+(c[i>>2]<<2)>>2]^c[n>>2];c[i>>2]=(c[i>>2]|0)+1}c[n>>2]=o&(c[(c[f>>2]|0)+4>>2]^c[(c[g>>2]|0)+4>>2]);c[(c[f>>2]|0)+4>>2]=c[(c[f>>2]|0)+4>>2]^c[n>>2];c[(c[g>>2]|0)+4>>2]=c[(c[g>>2]|0)+4>>2]^c[n>>2];c[n>>2]=c[k>>2]&(c[(c[f>>2]|0)+8>>2]^c[(c[g>>2]|0)+8>>2]);c[(c[f>>2]|0)+8>>2]=c[(c[f>>2]|0)+8>>2]^c[n>>2];c[(c[g>>2]|0)+8>>2]=c[(c[g>>2]|0)+8>>2]^c[n>>2];l=e;return}function Rp(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=vp((((c[d>>2]|0)+32-1|0)>>>0)/32|0)|0;l=b;return a|0}function Sp(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=xp((((c[d>>2]|0)+32-1|0)>>>0)/32|0)|0;l=b;return a|0}function Tp(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Dp(c[d>>2]|0);l=b;return}function Up(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=(((c[g>>2]|0)+7|0)>>>0)/8|0;if(c[f>>2]|0?c[(c[f>>2]|0)+12>>2]&16|0:0){Cp();l=e;return}g=(c[f>>2]|0)!=0;if(!(c[h>>2]|0)){if(g?c[(c[f>>2]|0)+12>>2]&1|0:0)k=Bf(c[j>>2]|0)|0;else k=zf(c[j>>2]|0)|0;c[i>>2]=k;nn(c[i>>2]|0,c[j>>2]|0)}else{if(g?c[(c[f>>2]|0)+12>>2]&1|0:0)n=hn(c[j>>2]|0,c[h>>2]|0)|0;else n=fn(c[j>>2]|0,c[h>>2]|0)|0;c[i>>2]=n}Yo(c[f>>2]|0,c[i>>2]|0,c[j>>2]|0,0);vf(c[i>>2]|0);l=e;return}function Vp(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;c[f>>2]=a;c[g>>2]=b;switch(c[g>>2]|0){case 1:{c[e>>2]=((c[(c[f>>2]|0)+12>>2]&1|0)!=0^1^1)&1;h=c[e>>2]|0;l=d;return h|0}case 2:{c[e>>2]=((c[(c[f>>2]|0)+12>>2]&4|0)!=0^1^1)&1;h=c[e>>2]|0;l=d;return h|0}case 4:{c[e>>2]=((c[(c[f>>2]|0)+12>>2]&16|0)!=0^1^1)&1;h=c[e>>2]|0;l=d;return h|0}case 8:{c[e>>2]=((c[(c[f>>2]|0)+12>>2]&32|0)!=0^1^1)&1;h=c[e>>2]|0;l=d;return h|0}case 2048:case 1024:case 512:case 256:{c[e>>2]=((c[(c[f>>2]|0)+12>>2]&c[g>>2]|0)!=0^1^1)&1;h=c[e>>2]|0;l=d;return h|0}default:Xe(46542,d)}return 0}function Wp(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;e=b+12|0;c[e>>2]=a;a=c[e>>2]|0;if((c[e>>2]|0)<0|(c[e>>2]|0)>>>0>6){c[d>>2]=a;Xe(46342,d)}if(c[71004+(a<<2)>>2]|0){l=b;return c[71004+(c[e>>2]<<2)>>2]|0}else Xe(46562,b+8|0);return 0}function Xp(){return 46593}function Yp(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;f=l;l=l+96|0;if((l|0)>=(m|0))$(96);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+32|0;o=f+8|0;p=f+4|0;q=f;c[h>>2]=b;c[i>>2]=e;c[j>>2]=Kw(172)|0;if(!(c[j>>2]|0)){c[g>>2]=0;r=c[g>>2]|0;l=f;return r|0}c[c[j>>2]>>2]=1779033703;c[(c[j>>2]|0)+4>>2]=-1150833019;c[(c[j>>2]|0)+8>>2]=1013904242;c[(c[j>>2]|0)+12>>2]=-1521486534;c[(c[j>>2]|0)+16>>2]=1359893119;c[(c[j>>2]|0)+20>>2]=-1694144372;c[(c[j>>2]|0)+24>>2]=528734635;c[(c[j>>2]|0)+28>>2]=1541459225;c[(c[j>>2]|0)+32>>2]=0;c[(c[j>>2]|0)+36>>2]=0;e=(c[j>>2]|0)+40|0;a[e>>0]=a[e>>0]&-2;e=(c[j>>2]|0)+40|0;a[e>>0]=a[e>>0]&-3;a:do if(c[h>>2]|0){e=n;b=e+64|0;do{a[e>>0]=0;e=e+1|0}while((e|0)<(b|0));e=(c[j>>2]|0)+105|0;b=e+64|0;do{a[e>>0]=0;e=e+1|0}while((e|0)<(b|0));do if((c[i>>2]|0)>>>0<=64){_w(n|0,c[h>>2]|0,c[i>>2]|0)|0;_w((c[j>>2]|0)+105|0,c[h>>2]|0,c[i>>2]|0)|0}else{c[o>>2]=Yp(0,0)|0;if(c[o>>2]|0){Zp(c[o>>2]|0,c[h>>2]|0,c[i>>2]|0);_p(c[o>>2]|0);e=n;s=(c[o>>2]|0)+41|0;b=e+32|0;do{a[e>>0]=a[s>>0]|0;e=e+1|0;s=s+1|0}while((e|0)<(b|0));e=(c[j>>2]|0)+105|0;s=(c[o>>2]|0)+41|0;b=e+32|0;do{a[e>>0]=a[s>>0]|0;e=e+1|0;s=s+1|0}while((e|0)<(b|0));$p(c[o>>2]|0);break}Lw(c[j>>2]|0);c[g>>2]=0;r=c[g>>2]|0;l=f;return r|0}while(0);c[k>>2]=0;while(1){if((c[k>>2]|0)>=64)break;e=n+(c[k>>2]|0)|0;a[e>>0]=(d[e>>0]|0)^54;e=(c[j>>2]|0)+105+(c[k>>2]|0)|0;a[e>>0]=(d[e>>0]|0)^92;c[k>>2]=(c[k>>2]|0)+1}e=(c[j>>2]|0)+40|0;a[e>>0]=a[e>>0]&-3|2;Zp(c[j>>2]|0,n,64);c[p>>2]=n;c[q>>2]=64;while(1){if(!(c[q>>2]|0))break a;a[c[p>>2]>>0]=0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}}while(0);c[g>>2]=c[j>>2];r=c[g>>2]|0;l=f;return r|0}function Zp(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[h>>2];if((a[(c[g>>2]|0)+40>>0]<<7&255)<<24>>24>>7<<24>>24|0){l=f;return}if((c[(c[g>>2]|0)+36>>2]|0)==64){aq(c[g>>2]|0,(c[g>>2]|0)+41|0);c[(c[g>>2]|0)+36>>2]=0;h=(c[g>>2]|0)+32|0;c[h>>2]=(c[h>>2]|0)+1}if(!(c[j>>2]|0)){l=f;return}if(c[(c[g>>2]|0)+36>>2]|0){while(1){if(!(c[i>>2]|0))break;if((c[(c[g>>2]|0)+36>>2]|0)>=64)break;h=c[j>>2]|0;c[j>>2]=h+1;e=a[h>>0]|0;h=(c[g>>2]|0)+36|0;d=c[h>>2]|0;c[h>>2]=d+1;a[(c[g>>2]|0)+41+d>>0]=e;c[i>>2]=(c[i>>2]|0)+-1}Zp(c[g>>2]|0,0,0);if(!(c[i>>2]|0)){l=f;return}}while(1){if((c[i>>2]|0)>>>0<64)break;aq(c[g>>2]|0,c[j>>2]|0);c[(c[g>>2]|0)+36>>2]=0;e=(c[g>>2]|0)+32|0;c[e>>2]=(c[e>>2]|0)+1;c[i>>2]=(c[i>>2]|0)-64;c[j>>2]=(c[j>>2]|0)+64}while(1){if(!(c[i>>2]|0)){k=15;break}if((c[(c[g>>2]|0)+36>>2]|0)>=64){k=15;break}e=c[j>>2]|0;c[j>>2]=e+1;d=a[e>>0]|0;e=(c[g>>2]|0)+36|0;h=c[e>>2]|0;c[e>>2]=h+1;a[(c[g>>2]|0)+41+h>>0]=d;c[i>>2]=(c[i>>2]|0)+-1}if((k|0)==15){l=f;return}}function _p(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=b;if((a[(c[e>>2]|0)+40>>0]<<7&255)<<24>>24>>7<<24>>24|0){l=d;return}Zp(c[e>>2]|0,0,0);c[f>>2]=c[(c[e>>2]|0)+32>>2];c[h>>2]=c[f>>2]<<6;c[g>>2]=(c[f>>2]|0)>>>26;c[f>>2]=c[h>>2];b=(c[h>>2]|0)+(c[(c[e>>2]|0)+36>>2]|0)|0;c[h>>2]=b;if(b>>>0<(c[f>>2]|0)>>>0)c[g>>2]=(c[g>>2]|0)+1;c[f>>2]=c[h>>2];c[h>>2]=c[h>>2]<<3;c[g>>2]=c[g>>2]<<3;c[g>>2]=c[g>>2]|(c[f>>2]|0)>>>29;f=(c[(c[e>>2]|0)+36>>2]|0)<56;b=(c[e>>2]|0)+36|0;j=c[b>>2]|0;c[b>>2]=j+1;a[(c[e>>2]|0)+41+j>>0]=-128;a:do if(f)while(1){if((c[(c[e>>2]|0)+36>>2]|0)>=56)break a;j=(c[e>>2]|0)+36|0;b=c[j>>2]|0;c[j>>2]=b+1;a[(c[e>>2]|0)+41+b>>0]=0}else{while(1){k=c[e>>2]|0;if((c[(c[e>>2]|0)+36>>2]|0)>=64)break;b=k+36|0;j=c[b>>2]|0;c[b>>2]=j+1;a[(c[e>>2]|0)+41+j>>0]=0}Zp(k,0,0);j=(c[e>>2]|0)+41|0;b=j+56|0;do{a[j>>0]=0;j=j+1|0}while((j|0)<(b|0))}while(0);a[(c[e>>2]|0)+41+56>>0]=(c[g>>2]|0)>>>24;a[(c[e>>2]|0)+41+57>>0]=(c[g>>2]|0)>>>16;a[(c[e>>2]|0)+41+58>>0]=(c[g>>2]|0)>>>8;a[(c[e>>2]|0)+41+59>>0]=c[g>>2];a[(c[e>>2]|0)+41+60>>0]=(c[h>>2]|0)>>>24;a[(c[e>>2]|0)+41+61>>0]=(c[h>>2]|0)>>>16;a[(c[e>>2]|0)+41+62>>0]=(c[h>>2]|0)>>>8;a[(c[e>>2]|0)+41+63>>0]=c[h>>2];aq(c[e>>2]|0,(c[e>>2]|0)+41|0);c[i>>2]=(c[e>>2]|0)+41;h=(c[c[e>>2]>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[c[e>>2]>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[c[e>>2]>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[c[e>>2]>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+4>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+4>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+4>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[(c[e>>2]|0)+4>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+8>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+8>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+8>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[(c[e>>2]|0)+8>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+12>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+12>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+12>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[(c[e>>2]|0)+12>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+16>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+16>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+16>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[(c[e>>2]|0)+16>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+20>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+20>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+20>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[(c[e>>2]|0)+20>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+24>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+24>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+24>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[(c[e>>2]|0)+24>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+28>>2]|0)>>>24&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+28>>2]|0)>>>16&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[(c[e>>2]|0)+28>>2]|0)>>>8&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=c[(c[e>>2]|0)+28>>2]&255;g=c[i>>2]|0;c[i>>2]=g+1;a[g>>0]=h;h=(c[e>>2]|0)+40|0;a[h>>0]=a[h>>0]&-2|1;l=d;return}function $p(b){b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=b;if(!(c[e>>2]|0)){l=d;return}a:do if((a[(c[e>>2]|0)+40>>0]<<6&255)<<24>>24>>7<<24>>24|0){c[f>>2]=(c[e>>2]|0)+105;c[g>>2]=64;while(1){if(!(c[g>>2]|0))break a;a[c[f>>2]>>0]=0;c[f>>2]=(c[f>>2]|0)+1;c[g>>2]=(c[g>>2]|0)+-1}}while(0);Lw(c[e>>2]|0);l=d;return}function aq(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;e=l;l=l+384|0;if((l|0)>=(m|0))$(384);f=e+376|0;g=e+372|0;h=e+368|0;i=e+364|0;j=e+360|0;k=e+356|0;n=e+352|0;o=e+348|0;p=e+344|0;q=e+340|0;r=e+336|0;s=e+332|0;t=e+328|0;u=e+264|0;v=e+8|0;w=e+4|0;x=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[g>>2];c[i>>2]=c[c[f>>2]>>2];c[j>>2]=c[(c[f>>2]|0)+4>>2];c[k>>2]=c[(c[f>>2]|0)+8>>2];c[n>>2]=c[(c[f>>2]|0)+12>>2];c[o>>2]=c[(c[f>>2]|0)+16>>2];c[p>>2]=c[(c[f>>2]|0)+20>>2];c[q>>2]=c[(c[f>>2]|0)+24>>2];c[r>>2]=c[(c[f>>2]|0)+28>>2];c[w>>2]=0;c[x>>2]=u;while(1){if((c[w>>2]|0)>=16)break;g=c[h>>2]|0;c[h>>2]=g+1;a[(c[x>>2]|0)+3>>0]=a[g>>0]|0;g=c[h>>2]|0;c[h>>2]=g+1;a[(c[x>>2]|0)+2>>0]=a[g>>0]|0;g=c[h>>2]|0;c[h>>2]=g+1;a[(c[x>>2]|0)+1>>0]=a[g>>0]|0;g=c[h>>2]|0;c[h>>2]=g+1;a[c[x>>2]>>0]=a[g>>0]|0;c[w>>2]=(c[w>>2]|0)+1;c[x>>2]=(c[x>>2]|0)+4}c[w>>2]=0;while(1){if((c[w>>2]|0)>=16)break;c[v+(c[w>>2]<<2)>>2]=c[u+(c[w>>2]<<2)>>2];c[w>>2]=(c[w>>2]|0)+1}while(1){if((c[w>>2]|0)>=64)break;u=bq(c[v+((c[w>>2]|0)-2<<2)>>2]|0,17)|0;x=u^(bq(c[v+((c[w>>2]|0)-2<<2)>>2]|0,19)|0);u=(x^(c[v+((c[w>>2]|0)-2<<2)>>2]|0)>>>10)+(c[v+((c[w>>2]|0)-7<<2)>>2]|0)|0;x=bq(c[v+((c[w>>2]|0)-15<<2)>>2]|0,7)|0;h=x^(bq(c[v+((c[w>>2]|0)-15<<2)>>2]|0,18)|0);c[v+(c[w>>2]<<2)>>2]=u+(h^(c[v+((c[w>>2]|0)-15<<2)>>2]|0)>>>3)+(c[v+((c[w>>2]|0)-16<<2)>>2]|0);c[w>>2]=(c[w>>2]|0)+1}c[w>>2]=0;while(1){if((c[w>>2]|0)>=64)break;h=c[r>>2]|0;u=bq(c[o>>2]|0,6)|0;x=u^(bq(c[o>>2]|0,11)|0);u=h+(x^(bq(c[o>>2]|0,25)|0))|0;c[s>>2]=u+(c[q>>2]^c[o>>2]&(c[p>>2]^c[q>>2]))+(c[12636+(c[w>>2]<<2)>>2]|0)+(c[v+(c[w>>2]<<2)>>2]|0);u=bq(c[i>>2]|0,2)|0;x=u^(bq(c[i>>2]|0,13)|0);u=x^(bq(c[i>>2]|0,22)|0);c[t>>2]=u+(c[i>>2]&c[j>>2]|c[k>>2]&(c[i>>2]|c[j>>2]));c[r>>2]=c[q>>2];c[q>>2]=c[p>>2];c[p>>2]=c[o>>2];c[o>>2]=(c[n>>2]|0)+(c[s>>2]|0);c[n>>2]=c[k>>2];c[k>>2]=c[j>>2];c[j>>2]=c[i>>2];c[i>>2]=(c[s>>2]|0)+(c[t>>2]|0);c[w>>2]=(c[w>>2]|0)+1}w=c[f>>2]|0;c[w>>2]=(c[w>>2]|0)+(c[i>>2]|0);i=(c[f>>2]|0)+4|0;c[i>>2]=(c[i>>2]|0)+(c[j>>2]|0);j=(c[f>>2]|0)+8|0;c[j>>2]=(c[j>>2]|0)+(c[k>>2]|0);k=(c[f>>2]|0)+12|0;c[k>>2]=(c[k>>2]|0)+(c[n>>2]|0);n=(c[f>>2]|0)+16|0;c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);o=(c[f>>2]|0)+20|0;c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);p=(c[f>>2]|0)+24|0;c[p>>2]=(c[p>>2]|0)+(c[q>>2]|0);q=(c[f>>2]|0)+28|0;c[q>>2]=(c[q>>2]|0)+(c[r>>2]|0);l=e;return}function bq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return (c[e>>2]|0)>>>(c[f>>2]|0)|c[e>>2]<<32-(c[f>>2]|0)|0}function cq(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=b;c[h>>2]=d;_p(c[g>>2]|0);do if((a[(c[g>>2]|0)+40>>0]<<6&255)<<24>>24>>7<<24>>24|0){c[i>>2]=Yp(0,0)|0;if(c[i>>2]|0){Zp(c[i>>2]|0,(c[g>>2]|0)+105|0,64);Zp(c[i>>2]|0,(c[g>>2]|0)+41|0,32);_p(c[i>>2]|0);d=(c[g>>2]|0)+41|0;b=(c[i>>2]|0)+41|0;j=d+32|0;do{a[d>>0]=a[b>>0]|0;d=d+1|0;b=b+1|0}while((d|0)<(j|0));$p(c[i>>2]|0);break}Lw(c[g>>2]|0);c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}while(0);if(c[h>>2]|0)c[c[h>>2]>>2]=32;c[f>>2]=(c[g>>2]|0)+41;k=c[f>>2]|0;l=e;return k|0}function dq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;i=l;l=l+80|0;if((l|0)>=(m|0))$(80);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+24|0;u=i+20|0;v=i+16|0;w=i+12|0;x=i+8|0;y=i+64|0;z=i+4|0;A=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[(c[(c[k>>2]|0)+12>>2]|0)+20>>2]|0)!=16){c[j>>2]=139;B=c[j>>2]|0;l=i;return B|0}if((c[o>>2]|0)>>>0<((c[q>>2]|0)+8|0)>>>0){c[j>>2]=200;B=c[j>>2]|0;l=i;return B|0}if(((c[q>>2]|0)>>>0)%8|0|0){c[j>>2]=45;B=c[j>>2]|0;l=i;return B|0}c[t>>2]=((c[q>>2]|0)>>>0)/8|0;if((c[t>>2]|0)>>>0<2){c[j>>2]=45;B=c[j>>2]|0;l=i;return B|0}c[z>>2]=0;c[v>>2]=c[n>>2];c[w>>2]=c[n>>2];c[x>>2]=(c[k>>2]|0)+80;n=c[w>>2]|0;if((d[(c[k>>2]|0)+56>>0]|0)>>>1&1|0){o=(c[k>>2]|0)+64|0;a[n>>0]=a[o>>0]|0;a[n+1>>0]=a[o+1>>0]|0;a[n+2>>0]=a[o+2>>0]|0;a[n+3>>0]=a[o+3>>0]|0;a[n+4>>0]=a[o+4>>0]|0;a[n+5>>0]=a[o+5>>0]|0;a[n+6>>0]=a[o+6>>0]|0;a[n+7>>0]=a[o+7>>0]|0}else{a[n>>0]=166;a[n+1>>0]=166;a[n+2>>0]=166;a[n+3>>0]=166;a[n+4>>0]=166;a[n+5>>0]=166;a[n+6>>0]=166;a[n+7>>0]=166}$w((c[v>>2]|0)+8|0,c[p>>2]|0,c[q>>2]|0)|0;a[y>>0]=0;a[y+1>>0]=0;a[y+2>>0]=0;a[y+3>>0]=0;a[y+4>>0]=0;a[y+5>>0]=0;a[y+6>>0]=0;a[y+7>>0]=0;c[r>>2]=0;while(1){if((c[r>>2]|0)>5)break;c[u>>2]=1;while(1){if((c[u>>2]|0)>>>0>(c[t>>2]|0)>>>0)break;q=c[x>>2]|0;p=c[w>>2]|0;a[q>>0]=a[p>>0]|0;a[q+1>>0]=a[p+1>>0]|0;a[q+2>>0]=a[p+2>>0]|0;a[q+3>>0]=a[p+3>>0]|0;a[q+4>>0]=a[p+4>>0]|0;a[q+5>>0]=a[p+5>>0]|0;a[q+6>>0]=a[p+6>>0]|0;a[q+7>>0]=a[p+7>>0]|0;p=(c[x>>2]|0)+8|0;q=(c[v>>2]|0)+(c[u>>2]<<3)|0;a[p>>0]=a[q>>0]|0;a[p+1>>0]=a[q+1>>0]|0;a[p+2>>0]=a[q+2>>0]|0;a[p+3>>0]=a[q+3>>0]|0;a[p+4>>0]=a[q+4>>0]|0;a[p+5>>0]=a[q+5>>0]|0;a[p+6>>0]=a[q+6>>0]|0;a[p+7>>0]=a[q+7>>0]|0;c[A>>2]=ub[c[(c[(c[k>>2]|0)+12>>2]|0)+36>>2]&63]((c[k>>2]|0)+496|0,c[x>>2]|0,c[x>>2]|0)|0;c[z>>2]=(c[A>>2]|0)>>>0>(c[z>>2]|0)>>>0?c[A>>2]|0:c[z>>2]|0;c[s>>2]=7;while(1){if((c[s>>2]|0)<0)break;q=y+(c[s>>2]|0)|0;a[q>>0]=(a[q>>0]|0)+1<<24>>24;if(a[y+(c[s>>2]|0)>>0]|0)break;c[s>>2]=(c[s>>2]|0)+-1}eq(c[w>>2]|0,c[x>>2]|0,y,8);q=(c[v>>2]|0)+(c[u>>2]<<3)|0;p=(c[x>>2]|0)+8|0;a[q>>0]=a[p>>0]|0;a[q+1>>0]=a[p+1>>0]|0;a[q+2>>0]=a[p+2>>0]|0;a[q+3>>0]=a[p+3>>0]|0;a[q+4>>0]=a[p+4>>0]|0;a[q+5>>0]=a[p+5>>0]|0;a[q+6>>0]=a[p+6>>0]|0;a[q+7>>0]=a[p+7>>0]|0;c[u>>2]=(c[u>>2]|0)+1}c[r>>2]=(c[r>>2]|0)+1}if((c[z>>2]|0)>>>0>0){bf((c[z>>2]|0)+16|0);cf()}c[j>>2]=0;B=c[j>>2]|0;l=i;return B|0}function eq(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function fq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;i=l;l=l+80|0;if((l|0)>=(m|0))$(80);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+24|0;u=i+20|0;v=i+16|0;w=i+12|0;x=i+8|0;y=i+64|0;z=i+4|0;A=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[(c[(c[k>>2]|0)+12>>2]|0)+20>>2]|0)!=16){c[j>>2]=139;B=c[j>>2]|0;l=i;return B|0}if(((c[o>>2]|0)+8|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;B=c[j>>2]|0;l=i;return B|0}if(((c[q>>2]|0)>>>0)%8|0|0){c[j>>2]=45;B=c[j>>2]|0;l=i;return B|0}c[t>>2]=((c[q>>2]|0)>>>0)/8|0;if((c[t>>2]|0)>>>0<3){c[j>>2]=45;B=c[j>>2]|0;l=i;return B|0}c[z>>2]=0;c[v>>2]=c[n>>2];c[w>>2]=(c[k>>2]|0)+96;c[x>>2]=(c[k>>2]|0)+80;n=c[w>>2]|0;o=c[p>>2]|0;a[n>>0]=a[o>>0]|0;a[n+1>>0]=a[o+1>>0]|0;a[n+2>>0]=a[o+2>>0]|0;a[n+3>>0]=a[o+3>>0]|0;a[n+4>>0]=a[o+4>>0]|0;a[n+5>>0]=a[o+5>>0]|0;a[n+6>>0]=a[o+6>>0]|0;a[n+7>>0]=a[o+7>>0]|0;$w(c[v>>2]|0,(c[p>>2]|0)+8|0,(c[q>>2]|0)-8|0)|0;c[t>>2]=(c[t>>2]|0)+-1;c[u>>2]=(c[t>>2]|0)*6;c[s>>2]=0;while(1){if(!((c[s>>2]|0)<8?(c[s>>2]|0)>>>0<4:0))break;a[y+(7-(c[s>>2]|0))>>0]=(c[u>>2]|0)>>>(c[s>>2]<<3);c[s>>2]=(c[s>>2]|0)+1}while(1){if((c[s>>2]|0)>=8)break;a[y+(7-(c[s>>2]|0))>>0]=0;c[s>>2]=(c[s>>2]|0)+1}c[r>>2]=5;while(1){if((c[r>>2]|0)<0)break;c[u>>2]=c[t>>2];while(1){if((c[u>>2]|0)>>>0<1)break;eq(c[x>>2]|0,c[w>>2]|0,y,8);q=(c[x>>2]|0)+8|0;p=(c[v>>2]|0)+((c[u>>2]|0)-1<<3)|0;a[q>>0]=a[p>>0]|0;a[q+1>>0]=a[p+1>>0]|0;a[q+2>>0]=a[p+2>>0]|0;a[q+3>>0]=a[p+3>>0]|0;a[q+4>>0]=a[p+4>>0]|0;a[q+5>>0]=a[p+5>>0]|0;a[q+6>>0]=a[p+6>>0]|0;a[q+7>>0]=a[p+7>>0]|0;c[A>>2]=ub[c[(c[(c[k>>2]|0)+12>>2]|0)+40>>2]&63]((c[k>>2]|0)+496|0,c[x>>2]|0,c[x>>2]|0)|0;c[z>>2]=(c[A>>2]|0)>>>0>(c[z>>2]|0)>>>0?c[A>>2]|0:c[z>>2]|0;c[s>>2]=7;while(1){if((c[s>>2]|0)<0)break;p=y+(c[s>>2]|0)|0;a[p>>0]=(a[p>>0]|0)+-1<<24>>24;if((d[y+(c[s>>2]|0)>>0]|0|0)!=255)break;c[s>>2]=(c[s>>2]|0)+-1}p=c[w>>2]|0;q=c[x>>2]|0;a[p>>0]=a[q>>0]|0;a[p+1>>0]=a[q+1>>0]|0;a[p+2>>0]=a[q+2>>0]|0;a[p+3>>0]=a[q+3>>0]|0;a[p+4>>0]=a[q+4>>0]|0;a[p+5>>0]=a[q+5>>0]|0;a[p+6>>0]=a[q+6>>0]|0;a[p+7>>0]=a[q+7>>0]|0;q=(c[v>>2]|0)+((c[u>>2]|0)-1<<3)|0;p=(c[x>>2]|0)+8|0;a[q>>0]=a[p>>0]|0;a[q+1>>0]=a[p+1>>0]|0;a[q+2>>0]=a[p+2>>0]|0;a[q+3>>0]=a[p+3>>0]|0;a[q+4>>0]=a[p+4>>0]|0;a[q+5>>0]=a[p+5>>0]|0;a[q+6>>0]=a[p+6>>0]|0;a[q+7>>0]=a[p+7>>0]|0;c[u>>2]=(c[u>>2]|0)+-1}c[r>>2]=(c[r>>2]|0)+-1}a:do if((d[(c[k>>2]|0)+56>>0]|0)>>>1&1|0)c[r>>2]=Jv(c[w>>2]|0,(c[k>>2]|0)+64|0,8)|0;else{c[r>>2]=0;c[s>>2]=0;while(1){if((c[s>>2]|0)>=8)break a;if((d[(c[w>>2]|0)+(c[s>>2]|0)>>0]|0|0)!=166)break;c[s>>2]=(c[s>>2]|0)+1}c[r>>2]=1}while(0);if((c[z>>2]|0)>>>0>0){bf((c[z>>2]|0)+16|0);cf()}c[j>>2]=c[r>>2]|0?10:0;B=c[j>>2]|0;l=i;return B|0} -function fg(b,f,g,h){b=b|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;i=l;l=l+80|0;if((l|0)>=(m|0))$(80);j=i;k=i+48|0;n=i+44|0;o=i+40|0;p=i+36|0;q=i+32|0;r=i+28|0;s=i+24|0;t=i+52|0;u=i+56|0;v=i+20|0;w=i+16|0;x=i+12|0;y=i+8|0;z=i+4|0;c[n>>2]=b;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;c[v>>2]=0;c[x>>2]=0;c[r>>2]=c[n>>2]|0?c[n>>2]|0:22772;c[s>>2]=c[p>>2];a:while(1){if(!(d[c[r>>2]>>0]|0)){A=55;break}switch(d[c[r>>2]>>0]|0|0){case 3:{c[r>>2]=(c[r>>2]|0)+1;if((c[o>>2]|0)!=1){if(c[x>>2]|0)c[v>>2]=(c[v>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+(c[x>>2]|0)}c[v>>2]=(c[v>>2]|0)+1;if(c[p>>2]|0){if((c[v>>2]|0)>>>0>=(c[q>>2]|0)>>>0){A=10;break a}b:do if((c[o>>2]|0)!=1){if(c[x>>2]|0){n=c[s>>2]|0;c[s>>2]=n+1;a[n>>0]=10}c[w>>2]=0;while(1){if((c[w>>2]|0)>=(c[x>>2]|0))break b;n=c[s>>2]|0;c[s>>2]=n+1;a[n>>0]=32;c[w>>2]=(c[w>>2]|0)+1}}while(0);n=c[s>>2]|0;c[s>>2]=n+1;a[n>>0]=40}c[x>>2]=(c[x>>2]|0)+1;continue a;break}case 4:{c[r>>2]=(c[r>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+1;if(c[p>>2]|0){if((c[v>>2]|0)>>>0>=(c[q>>2]|0)>>>0){A=21;break a}n=c[s>>2]|0;c[s>>2]=n+1;a[n>>0]=41}c[x>>2]=(c[x>>2]|0)+-1;if((d[c[r>>2]>>0]|0|0)==3)continue a;if(!((c[o>>2]|0)!=1?(d[c[r>>2]>>0]|0|0)!=0:0))continue a;c[v>>2]=(c[v>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+(c[x>>2]|0);if(!(c[p>>2]|0))continue a;if((c[v>>2]|0)>>>0>=(c[q>>2]|0)>>>0){A=27;break a}n=c[s>>2]|0;c[s>>2]=n+1;a[n>>0]=10;c[w>>2]=0;while(1){if((c[w>>2]|0)>=(c[x>>2]|0))continue a;n=c[s>>2]|0;c[s>>2]=n+1;a[n>>0]=32;c[w>>2]=(c[w>>2]|0)+1}break}case 1:{c[r>>2]=(c[r>>2]|0)+1;n=c[r>>2]|0;a[t>>0]=a[n>>0]|0;a[t+1>>0]=a[n+1>>0]|0;c[r>>2]=(c[r>>2]|0)+2;if((c[o>>2]|0)==3){n=gg(c[r>>2]|0,e[t>>1]|0)|0;c[y>>2]=n;switch(n|0){case 1:{c[z>>2]=hg(c[r>>2]|0,e[t>>1]|0,0)|0;break}case 2:{c[z>>2]=ig(c[r>>2]|0,e[t>>1]|0,0)|0;break}default:c[z>>2]=jg(c[r>>2]|0,e[t>>1]|0,0)|0}c[v>>2]=(c[v>>2]|0)+(c[z>>2]|0);if(c[p>>2]|0){if((c[v>>2]|0)>>>0>=(c[q>>2]|0)>>>0){A=38;break a}switch(c[y>>2]|0){case 1:{hg(c[r>>2]|0,e[t>>1]|0,c[s>>2]|0)|0;break}case 2:{ig(c[r>>2]|0,e[t>>1]|0,c[s>>2]|0)|0;break}default:jg(c[r>>2]|0,e[t>>1]|0,c[s>>2]|0)|0}c[s>>2]=(c[s>>2]|0)+(c[z>>2]|0)}if((d[(c[r>>2]|0)+(e[t>>1]|0)>>0]|0|0)!=4?(c[v>>2]=(c[v>>2]|0)+1,c[p>>2]|0):0){if((c[v>>2]|0)>>>0>=(c[q>>2]|0)>>>0){A=47;break a}n=c[s>>2]|0;c[s>>2]=n+1;a[n>>0]=32}}else{c[j>>2]=e[t>>1];Dv(u,22775,j)|0;n=hv(u)|0;c[v>>2]=(c[v>>2]|0)+(n+(e[t>>1]|0));if(c[p>>2]|0){if((c[v>>2]|0)>>>0>=(c[q>>2]|0)>>>0){A=51;break a}c[s>>2]=uv(c[s>>2]|0,u)|0;_w(c[s>>2]|0,c[r>>2]|0,e[t>>1]|0|0)|0;c[s>>2]=(c[s>>2]|0)+(e[t>>1]|0)}}c[r>>2]=(c[r>>2]|0)+(e[t>>1]|0);continue a;break}default:{A=54;break a}}}if((A|0)==10){c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}else if((A|0)==21){c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}else if((A|0)==27){c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}else if((A|0)==38){c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}else if((A|0)==47){c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}else if((A|0)==51){c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}else if((A|0)==54)Re(22704,2008,22779);else if((A|0)==55){do if((c[o>>2]|0)!=1?(c[v>>2]=(c[v>>2]|0)+1,c[p>>2]|0):0){if((c[v>>2]|0)>>>0<(c[q>>2]|0)>>>0){A=c[s>>2]|0;c[s>>2]=A+1;a[A>>0]=10;break}c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}while(0);o=c[v>>2]|0;do if(c[p>>2]|0){if(o>>>0<(c[q>>2]|0)>>>0){A=c[s>>2]|0;c[s>>2]=A+1;a[A>>0]=0;break}c[k>>2]=0;B=c[k>>2]|0;l=i;return B|0}else c[v>>2]=o+1;while(0);c[k>>2]=c[v>>2];B=c[k>>2]|0;l=i;return B|0}return 0}function gg(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[h>>2]=b;c[i>>2]=e;c[k>>2]=1;if(!(c[i>>2]|0)){c[g>>2]=1;n=c[g>>2]|0;l=f;return n|0}if(d[c[h>>2]>>0]&128|0){c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}if(!(a[c[h>>2]>>0]|0)){c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}c[j>>2]=c[h>>2];while(1){if(!(c[i>>2]|0))break;if((d[c[j>>2]>>0]|0)>=32){if((d[c[j>>2]>>0]|0)>=127?(d[c[j>>2]>>0]|0)<=160:0)o=12}else o=12;if((o|0)==12?(o=0,(Vv(22802,d[c[j>>2]>>0]|0)|0)==0):0){o=13;break}do if(c[k>>2]|0){if((d[c[j>>2]>>0]|0)>=65?(d[c[j>>2]>>0]|0)<=90:0)break;if((d[c[j>>2]>>0]|0)>=97?(d[c[j>>2]>>0]|0)<=122:0)break;if((d[c[j>>2]>>0]|0)>=48?(d[c[j>>2]>>0]|0)<=57:0)break;if(!(Vv(22812,d[c[j>>2]>>0]|0)|0))c[k>>2]=0}while(0);c[j>>2]=(c[j>>2]|0)+1;c[i>>2]=(c[i>>2]|0)+-1}if((o|0)==13){c[g>>2]=0;n=c[g>>2]|0;l=f;return n|0}c[j>>2]=c[h>>2];do if(c[k>>2]|0){if((d[c[j>>2]>>0]|0)>=48?(d[c[j>>2]>>0]|0)<=57:0)break;c[g>>2]=2;n=c[g>>2]|0;l=f;return n|0}while(0);c[g>>2]=1;n=c[g>>2]|0;l=f;return n|0}function hg(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g;i=g+24|0;j=g+20|0;k=g+16|0;n=g+12|0;o=g+8|0;p=g+4|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;if(!(c[n>>2]|0)){c[p>>2]=2;while(1){if(!(c[k>>2]|0))break;a:do switch(d[c[j>>2]>>0]|0|0){case 92:case 39:case 34:case 13:case 12:case 10:case 11:case 9:case 8:{c[p>>2]=(c[p>>2]|0)+2;break}default:{do if((d[c[j>>2]>>0]|0|0)>=32){if((d[c[j>>2]>>0]|0|0)>=127?(d[c[j>>2]>>0]|0|0)<=160:0)break;c[p>>2]=(c[p>>2]|0)+1;break a}while(0);c[p>>2]=(c[p>>2]|0)+4}}while(0);c[k>>2]=(c[k>>2]|0)+-1;c[j>>2]=(c[j>>2]|0)+1}c[i>>2]=c[p>>2];q=c[i>>2]|0;l=g;return q|0}c[o>>2]=c[n>>2];p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=34;while(1){if(!(c[k>>2]|0))break;b:do switch(d[c[j>>2]>>0]|0|0){case 8:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=98;break}case 9:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=116;break}case 11:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=118;break}case 10:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=110;break}case 12:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=102;break}case 13:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=114;break}case 34:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=34;break}case 39:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=39;break}case 92:{p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;p=c[o>>2]|0;c[o>>2]=p+1;a[p>>0]=92;break}default:{do if((d[c[j>>2]>>0]|0|0)>=32){if((d[c[j>>2]>>0]|0|0)>=127?(d[c[j>>2]>>0]|0|0)<=160:0)break;p=a[c[j>>2]>>0]|0;f=c[o>>2]|0;c[o>>2]=f+1;a[f>>0]=p;break b}while(0);p=c[o>>2]|0;c[h>>2]=d[c[j>>2]>>0];Dv(p,22626,h)|0;c[o>>2]=(c[o>>2]|0)+4}}while(0);c[k>>2]=(c[k>>2]|0)+-1;c[j>>2]=(c[j>>2]|0)+1}j=c[o>>2]|0;c[o>>2]=j+1;a[j>>0]=34;c[i>>2]=(c[o>>2]|0)-(c[n>>2]|0);q=c[i>>2]|0;l=g;return q|0}function ig(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(!(c[h>>2]|0)){i=c[g>>2]|0;l=e;return i|0}_w(c[h>>2]|0,c[f>>2]|0,c[g>>2]|0)|0;i=c[g>>2]|0;l=e;return i|0}function jg(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g;i=g+16|0;j=g+12|0;k=g+8|0;n=g+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;if(!(c[k>>2]|0)){o=c[j>>2]|0;p=o<<1;q=p+2|0;l=g;return q|0}f=c[k>>2]|0;c[k>>2]=f+1;a[f>>0]=35;c[n>>2]=0;while(1){r=c[k>>2]|0;if((c[n>>2]|0)>>>0>=(c[j>>2]|0)>>>0)break;c[h>>2]=d[(c[i>>2]|0)+(c[n>>2]|0)>>0];Dv(r,22797,h)|0;c[n>>2]=(c[n>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+2}c[k>>2]=r+1;a[r>>0]=35;o=c[j>>2]|0;p=o<<1;q=p+2|0;l=g;return q|0}function kg(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;g=l;l=l+192|0;if((l|0)>=(m|0))$(192);h=g+164|0;i=g+160|0;j=g+156|0;k=g+152|0;n=g+148|0;o=g+144|0;p=g+140|0;q=g+136|0;r=g+56|0;s=g+168|0;t=g+48|0;u=g+44|0;v=g+40|0;w=g+36|0;x=g+32|0;y=g+28|0;z=g+24|0;A=g+20|0;B=g+16|0;C=g+12|0;D=g+8|0;E=g+4|0;F=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[v>>2]=43;c[w>>2]=0;f=s;e=f+20|0;do{a[f>>0]=0;f=f+1|0}while((f|0)<(e|0));c[p>>2]=c[k>>2];c[t>>2]=0;while(1){G=a[c[p>>2]>>0]|0;if(!(a[c[p>>2]>>0]|0?(c[t>>2]|0)>>>0<20:0)){H=18;break}if((((((G<<24>>24|0)!=38?(a[c[p>>2]>>0]|0)!=43:0)?(a[c[p>>2]>>0]|0)!=45:0)?(a[c[p>>2]>>0]|0)!=47:0)?(a[c[p>>2]>>0]|0)!=63:0)?(Nf(c[p>>2]|0)|0)==0:0){if((a[c[p>>2]>>0]|0)==39){c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=Vv(c[p>>2]|0,39)|0;if(!(c[q>>2]|0)){H=12;break}if((c[q>>2]|0)==(c[p>>2]|0)){H=12;break}c[p>>2]=c[q>>2]}f=c[n>>2]|0;e=(c[f>>2]|0)+(4-1)&~(4-1);d=c[e>>2]|0;c[f>>2]=e+4;c[x>>2]=d;c[r+(c[t>>2]<<2)>>2]=c[x>>2];if(!(c[r+(c[t>>2]<<2)>>2]|0)){H=15;break}c[t>>2]=(c[t>>2]|0)+1}c[p>>2]=(c[p>>2]|0)+1}if((H|0)==12){c[h>>2]=29;I=c[h>>2]|0;l=g;return I|0}else if((H|0)==15){c[h>>2]=128;I=c[h>>2]|0;l=g;return I|0}else if((H|0)==18){if(G<<24>>24){c[h>>2]=183;I=c[h>>2]|0;l=g;return I|0}G=c[n>>2]|0;n=(c[G>>2]|0)+(4-1)&~(4-1);x=c[n>>2]|0;c[G>>2]=n+4;c[y>>2]=x;if(c[y>>2]|0){c[h>>2]=45;I=c[h>>2]|0;l=g;return I|0}while(1){if(!(c[j>>2]|0)){H=33;break}if(!(a[c[j>>2]>>0]|0)){H=33;break}c[p>>2]=Vv(c[j>>2]|0,33)|0;if((c[p>>2]|0)==(c[j>>2]|0)){H=25;break}if(c[p>>2]|0)J=(c[p>>2]|0)-(c[j>>2]|0)|0;else J=0;c[z>>2]=J;c[u>>2]=Tf(c[i>>2]|0,c[j>>2]|0,c[z>>2]|0)|0;if(!(c[u>>2]|0)){H=29;break}c[i>>2]=c[u>>2];c[u>>2]=0;Rf(c[w>>2]|0);c[w>>2]=c[i>>2];if(c[z>>2]|0){c[j>>2]=(c[j>>2]|0)+((c[z>>2]|0)+1);continue}else{c[j>>2]=0;continue}}do if((H|0)==25)c[o>>2]=27;else if((H|0)==29)c[o>>2]=27;else if((H|0)==33){c[p>>2]=c[k>>2];c[t>>2]=0;a:while(1){if(!(a[c[p>>2]>>0]|0)){H=76;break}if((((a[c[p>>2]>>0]|0)!=38?(a[c[p>>2]>>0]|0)!=43:0)?(a[c[p>>2]>>0]|0)!=45:0)?(a[c[p>>2]>>0]|0)!=47:0){if((Nf(c[p>>2]|0)|0)==0?(a[c[p>>2]>>0]|0)!=63:0){if((a[c[p>>2]>>0]|0)==39){c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=Vv(c[p>>2]|0,39)|0;if(!(c[q>>2]|0)){H=45;break}if((c[q>>2]|0)==(c[p>>2]|0)){H=45;break}c[u>>2]=Tf(c[i>>2]|0,c[p>>2]|0,(c[q>>2]|0)-(c[p>>2]|0)|0)|0;c[p>>2]=c[q>>2]}else c[u>>2]=Tf(c[i>>2]|0,c[p>>2]|0,1)|0;do if(!(c[u>>2]|0)?(a[(c[p>>2]|0)+1>>0]|0)==63:0){j=c[r+(c[t>>2]<<2)>>2]|0;if((c[v>>2]|0)!=38){c[j>>2]=0;break}c[A>>2]=j;if(!(c[(c[A>>2]|0)+12>>2]|0)){c[c[A>>2]>>2]=0;c[(c[A>>2]|0)+4>>2]=0}c[(c[A>>2]|0)+8>>2]=0}else H=55;while(0);if((H|0)==55){H=0;if(!(c[u>>2]|0)){H=56;break}do if((c[v>>2]|0)!=38){if((c[v>>2]|0)==47){j=$f(c[u>>2]|0,1,8)|0;c[c[r+(c[t>>2]<<2)>>2]>>2]=j;break}j=c[u>>2]|0;if((c[v>>2]|0)==45){z=$f(j,1,1)|0;c[c[r+(c[t>>2]<<2)>>2]>>2]=z;break}else{z=$f(j,1,5)|0;c[c[r+(c[t>>2]<<2)>>2]>>2]=z;break}}else{c[B>>2]=c[r+(c[t>>2]<<2)>>2];z=c[u>>2]|0;if(!(c[(c[B>>2]|0)+12>>2]|0)){j=Zf(z,1,c[B>>2]|0)|0;c[(c[B>>2]|0)+12>>2]=j;if(!(c[(c[B>>2]|0)+12>>2]|0)){H=65;break a}c[(c[B>>2]|0)+8>>2]=c[c[B>>2]>>2];c[(c[B>>2]|0)+4>>2]=0;a[s+(c[t>>2]|0)>>0]=2;break}c[C>>2]=Xf(z,1,D)|0;if(!((c[C>>2]|0)!=0&(c[D>>2]|0)!=0)){H=60;break a}if(((c[(c[B>>2]|0)+4>>2]|0)+(c[D>>2]|0)|0)>>>0>(c[c[B>>2]>>2]|0)>>>0){H=62;break a}_w((c[(c[B>>2]|0)+12>>2]|0)+(c[(c[B>>2]|0)+4>>2]|0)|0,c[C>>2]|0,c[D>>2]|0)|0;c[(c[B>>2]|0)+8>>2]=c[D>>2];a[s+(c[t>>2]|0)>>0]=1}while(0);Rf(c[u>>2]|0);c[u>>2]=0;if(!(c[c[r+(c[t>>2]<<2)>>2]>>2]|0)){H=73;break}}c[t>>2]=(c[t>>2]|0)+1}}else c[v>>2]=a[c[p>>2]>>0];c[p>>2]=(c[p>>2]|0)+1}if((H|0)==45){c[o>>2]=29;break}else if((H|0)==56){c[o>>2]=68;break}else if((H|0)==60){c[o>>2]=65;break}else if((H|0)==62){c[o>>2]=200;break}else if((H|0)==65){c[o>>2]=65;break}else if((H|0)==73){c[o>>2]=65;break}else if((H|0)==76){Rf(c[w>>2]|0);c[h>>2]=0;I=c[h>>2]|0;l=g;return I|0}}while(0);Rf(c[w>>2]|0);Rf(c[u>>2]|0);while(1){u=c[t>>2]|0;c[t>>2]=u+-1;if(!u)break;u=c[t>>2]|0;if(!(a[s+(c[t>>2]|0)>>0]|0)){Tp(c[c[r+(u<<2)>>2]>>2]|0);c[c[r+(c[t>>2]<<2)>>2]>>2]=0;continue}w=c[r+(c[t>>2]<<2)>>2]|0;if((((a[s+u>>0]|0)!=0^1)&1|0)==1){c[E>>2]=w;c[(c[E>>2]|0)+8>>2]=0;continue}else{c[F>>2]=w;vf(c[(c[F>>2]|0)+12>>2]|0);c[(c[F>>2]|0)+12>>2]=0;c[(c[F>>2]|0)+8>>2]=0;c[(c[F>>2]|0)+4>>2]=0;c[c[F>>2]>>2]=0;continue}}c[h>>2]=c[o>>2];I=c[h>>2]|0;l=g;return I|0}return 0}function lg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[k>>2]=e;c[j>>2]=kg(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,k)|0;k=mg(c[j>>2]|0)|0;l=f;return k|0}function mg(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=ng(1,c[d>>2]|0)|0;l=b;return a|0}function ng(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function og(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=0;while(1){if((c[f>>2]|0)>>>0>=13){g=6;break}a=(Fu(c[1180+(c[f>>2]<<3)+4>>2]|0,c[e>>2]|0)|0)!=0;h=c[f>>2]|0;if(!a){g=4;break}c[f>>2]=h+1}if((g|0)==4){c[17711]=c[17711]|c[1180+(h<<3)>>2];c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}else if((g|0)==6){c[d>>2]=88;i=c[d>>2]|0;l=b;return i|0}return 0}function pg(){return c[17712]|0}function qg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;if((c[f>>2]|0)<0|(c[f>>2]|0)>>>0>=13){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}if(c[g>>2]|0)c[c[g>>2]>>2]=c[1180+(c[f>>2]<<3)>>2];c[e>>2]=c[1180+(c[f>>2]<<3)+4>>2];h=c[e>>2]|0;l=d;return h|0}function rg(){c[17712]=0;if(Wg()|0)return;sg();c[17712]=c[17712]&~c[17711];return}function sg(){var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;b=l;l=l+288|0;if((l|0)>=(m|0))$(288);d=b+20|0;e=b+16|0;f=b+24|0;g=b+12|0;h=b+8|0;i=b+4|0;j=b;c[d>>2]=22971;c[j>>2]=0;c[e>>2]=Pv(c[d>>2]|0,23624)|0;if(!(c[e>>2]|0)){l=b;return}while(1){if(!(Gv(f,256,c[e>>2]|0)|0))break;c[j>>2]=(c[j>>2]|0)+1;c[g>>2]=f;while(1){if(a[c[g>>2]>>0]&128|0)break;if(!(vv(a[c[g>>2]>>0]|0)|0))break;c[g>>2]=(c[g>>2]|0)+1}c[h>>2]=Vv(c[g>>2]|0,10)|0;if(c[h>>2]|0)a[c[h>>2]>>0]=0;d=c[g>>2]|0;if(a[c[g>>2]>>0]|0)k=(hv(c[g>>2]|0)|0)-1|0;else k=0;c[h>>2]=d+k;while(1){if((c[h>>2]|0)>>>0<=(c[g>>2]|0)>>>0)break;if((a[c[h>>2]>>0]&128|0)==0?vv(a[c[h>>2]>>0]|0)|0:0)a[c[h>>2]>>0]=0;c[h>>2]=(c[h>>2]|0)+-1}if(!(a[c[g>>2]>>0]|0))continue;if((a[c[g>>2]>>0]|0)==35)continue;c[i>>2]=0;while(1){if((c[i>>2]|0)>>>0>=13)break;d=(Fu(c[1180+(c[i>>2]<<3)+4>>2]|0,c[g>>2]|0)|0)!=0;n=c[i>>2]|0;if(!d){o=23;break}c[i>>2]=n+1}if((o|0)==23){o=0;c[17711]=c[17711]|c[1180+(n<<3)>>2]}}aw(c[e>>2]|0)|0;Qv(c[e>>2]|0)|0;l=b;return}function tg(){c[17713]=1;return}function ug(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=b;if(!(c[f>>2]|0)){Ft(22);c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}b=c[f>>2]|0;if(!(c[17713]|0)){c[e>>2]=Kw(b)|0;h=c[e>>2]|0;l=d;return h|0}i=Kw(b+0+5|0)|0;c[g>>2]=i;if(i|0){a[c[g>>2]>>0]=c[f>>2];a[(c[g>>2]|0)+1>>0]=(c[f>>2]|0)>>>8;a[(c[g>>2]|0)+2>>0]=(c[f>>2]|0)>>>16;a[(c[g>>2]|0)+3>>0]=85;a[(c[g>>2]|0)+(4+(c[f>>2]|0))>>0]=-86;c[e>>2]=(c[g>>2]|0)+4;h=c[e>>2]|0;l=d;return h|0}else{c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}return 0}function vg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=b;if(!(c[f>>2]|0)){Ft(22);c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}b=c[f>>2]|0;if(!(c[17713]|0)){c[e>>2]=Hg(b)|0;h=c[e>>2]|0;l=d;return h|0}i=Hg(b+0+5|0)|0;c[g>>2]=i;if(i|0){a[c[g>>2]>>0]=c[f>>2];a[(c[g>>2]|0)+1>>0]=(c[f>>2]|0)>>>8;a[(c[g>>2]|0)+2>>0]=(c[f>>2]|0)>>>16;a[(c[g>>2]|0)+3>>0]=-52;a[(c[g>>2]|0)+(4+(c[f>>2]|0))>>0]=-86;c[e>>2]=(c[g>>2]|0)+4;h=c[e>>2]|0;l=d;return h|0}else{c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}return 0}function wg(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[g>>2]=a;c[h>>2]=b;b=c[g>>2]|0;if(!(c[17713]|0)){a=(Sg(b)|0)!=0;n=c[g>>2]|0;o=c[h>>2]|0;if(a){c[f>>2]=Rg(n,o)|0;p=c[f>>2]|0;l=e;return p|0}else{c[f>>2]=Nw(n,o)|0;p=c[f>>2]|0;l=e;return p|0}}c[i>>2]=b;if(!(c[g>>2]|0)){c[f>>2]=ug(c[h>>2]|0)|0;p=c[f>>2]|0;l=e;return p|0}xg(c[i>>2]|0);c[k>>2]=d[(c[i>>2]|0)+-4>>0];c[k>>2]=c[k>>2]|(d[(c[i>>2]|0)+-3>>0]|0)<<8;c[k>>2]=c[k>>2]|(d[(c[i>>2]|0)+-2>>0]|0)<<16;if((c[k>>2]|0)>>>0>=(c[h>>2]|0)>>>0){c[f>>2]=c[g>>2];p=c[f>>2]|0;l=e;return p|0}b=c[h>>2]|0;if((d[(c[i>>2]|0)+-1>>0]|0|0)==204)c[j>>2]=vg(b)|0;else c[j>>2]=ug(b)|0;if(c[j>>2]|0){_w(c[j>>2]|0,c[g>>2]|0,c[k>>2]|0)|0;Uw((c[j>>2]|0)+(c[k>>2]|0)|0,0,(c[h>>2]|0)-(c[k>>2]|0)|0)|0;yg(c[i>>2]|0);c[f>>2]=c[j>>2];p=c[f>>2]|0;l=e;return p|0}else{c[f>>2]=0;p=c[f>>2]|0;l=e;return p|0}return 0}function xg(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=b+8|0;f=b;g=b+24|0;h=b+20|0;i=b+16|0;c[g>>2]=a;if(!(c[17713]|0)){l=b;return}c[h>>2]=c[g>>2];if(!(c[h>>2]|0)){l=b;return}if((d[(c[h>>2]|0)+-1>>0]|0|0)!=85?(d[(c[h>>2]|0)+-1>>0]|0|0)!=204:0){g=d[(c[h>>2]|0)+-1>>0]|0;c[f>>2]=c[h>>2];c[f+4>>2]=g;We(22992,f)}c[i>>2]=d[(c[h>>2]|0)+-4>>0];c[i>>2]=c[i>>2]|(d[(c[h>>2]|0)+-3>>0]|0)<<8;c[i>>2]=c[i>>2]|(d[(c[h>>2]|0)+-2>>0]|0)<<16;if((d[(c[h>>2]|0)+(c[i>>2]|0)>>0]|0|0)!=170){i=d[(c[h>>2]|0)+-1>>0]|0;c[e>>2]=c[h>>2];c[e+4>>2]=i;We(23033,e)}else{l=b;return}}function yg(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];if(!(c[e>>2]|0)){l=b;return}if(c[17713]|0){xg(c[e>>2]|0);a=(Sg(c[d>>2]|0)|0)!=0;f=(c[e>>2]|0)+-4|0;if(a){Pg(f);l=b;return}else{Lw(f);l=b;return}}else{f=(Sg(c[d>>2]|0)|0)!=0;d=c[e>>2]|0;if(f){Pg(d);l=b;return}else{Lw(d);l=b;return}}}function zg(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;Ht(1284)|0;c[e>>2]=c[17714];c[17715]=c[d>>2]&1;c[17714]=c[d>>2]&2;c[17716]=c[d>>2]&8;c[17717]=c[d>>2]&16;if(!((((c[e>>2]|0)==0|(c[17714]|0)!=0)^1)&(c[17718]|0)!=0)){It(1284)|0;l=b;return}c[17718]=0;Ag();It(1284)|0;l=b;return}function Ag(){var a=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);if(c[17715]|0){l=a;return}Te(Je(23073)|0,a);l=a;return}function Bg(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;Ht(1284)|0;c[b>>2]=c[17715]|0?1:0;c[b>>2]=c[b>>2]|(c[17714]|0?2:0);c[b>>2]=c[b>>2]|(c[17719]|0?4:0);c[b>>2]=c[b>>2]|(c[17716]|0?8:0);c[b>>2]=c[b>>2]|(c[17717]|0?16:0);It(1284)|0;l=a;return c[b>>2]|0}function Cg(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Ht(1284)|0;Dg(c[d>>2]|0);It(1284)|0;l=b;return}function Dg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+8|0;e=b;f=b+16|0;g=b+12|0;c[f>>2]=a;if(c[f>>2]|0){if((c[f>>2]|0)>>>0<16384)c[f>>2]=16384;if(c[17721]|0){Ve(23129,d);l=b;return}else{Eg(c[f>>2]|0);Fg(c[17722]|0,c[f>>2]|0);l=b;return}}c[17720]=1;c[g>>2]=kw()|0;f=c[g>>2]|0;if((f|0)==(nw()|0)){l=b;return}if(ow(c[g>>2]|0)|0)We(23106,e);g=kw()|0;if((g|0)!=(nw()|0))We(23106,e);if(ow(0)|0){l=b;return}else We(23106,e)}function Eg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;b=l;l=l+48|0;if((l|0)>=(m|0))$(48);d=b+16|0;e=b+8|0;f=b+32|0;g=b+28|0;h=b+24|0;i=b+20|0;c[f>>2]=a;c[17723]=c[f>>2];if(c[17720]|0)Xe(23237,b);c[h>>2]=Ra(30)|0;c[g>>2]=(c[h>>2]|0)!=-1&(c[h>>2]|0)>0?c[h>>2]|0:4096;c[17723]=(c[17723]|0)+(c[g>>2]|0)-1&~((c[g>>2]|0)-1);c[17722]=rw(0,c[17723]|0,3,34,-1,0)|0;if((c[17722]|0)==(-1|0)){g=c[17723]|0;h=Nu(c[(xu()|0)>>2]|0)|0;c[e>>2]=g;c[e+4>>2]=h;Te(23263,e)}else{c[17724]=1;c[17721]=1}if(c[17721]|0){j=c[17722]|0;c[i>>2]=j;k=c[17723]|0;n=c[i>>2]|0;c[n>>2]=k;o=c[i>>2]|0;p=o+4|0;c[p>>2]=0;l=b;return}c[17722]=Kw(c[17723]|0)|0;if(!(c[17722]|0)){c[d>>2]=c[17723];We(23311,d)}c[17721]=1;j=c[17722]|0;c[i>>2]=j;k=c[17723]|0;n=c[i>>2]|0;c[n>>2]=k;o=c[i>>2]|0;p=o+4|0;c[p>>2]=0;l=b;return}function Fg(a,b){a=a|0;b=b|0;var d=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[d+8>>2]=a;c[d+4>>2]=b;if(c[17716]|0){l=d;return}Te(23175,d);l=d;return}function Gg(){return 0}function Hg(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;Ht(1284)|0;c[e>>2]=Ig(c[d>>2]|0)|0;It(1284)|0;l=b;return c[e>>2]|0}function Ig(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+8|0;e=b;f=b+20|0;g=b+16|0;h=b+12|0;c[g>>2]=a;if((c[17721]|0)==0?(Dg(32768),(c[17721]|0)==0):0){Te(Je(23351)|0,e);Ft(12);c[f>>2]=0;i=c[f>>2]|0;l=b;return i|0}if(c[17719]|0?Wg()|0:0){Te(Je(23412)|0,d);Ft(12);c[f>>2]=0;i=c[f>>2]|0;l=b;return i|0}if(!((c[17718]|0)==0|(c[17714]|0)!=0)){c[17718]=0;Ag()}c[g>>2]=((((c[g>>2]|0)+31|0)>>>0)/32|0)<<5;c[h>>2]=Jg(c[17722]|0,c[g>>2]|0)|0;if(c[h>>2]|0)Kg(c[g>>2]|0,0);c[f>>2]=c[h>>2]|0?(c[h>>2]|0)+8|0:0;i=c[f>>2]|0;l=b;return i|0}function Jg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[e>>2];while(1){if(!(Lg(c[g>>2]|0)|0))break;if((c[(c[g>>2]|0)+4>>2]&1|0)==0?(c[c[g>>2]>>2]|0)>>>0>=(c[f>>2]|0)>>>0:0){i=5;break}c[g>>2]=Ng(c[g>>2]|0)|0}if((i|0)==5?(i=(c[g>>2]|0)+4|0,c[i>>2]=c[i>>2]|1,((c[c[g>>2]>>2]|0)-(c[f>>2]|0)|0)>>>0>8):0){c[h>>2]=(c[g>>2]|0)+8+(c[f>>2]|0);c[c[h>>2]>>2]=(c[c[g>>2]>>2]|0)-(c[f>>2]|0)-8;c[(c[h>>2]|0)+4>>2]=0;c[c[g>>2]>>2]=c[f>>2];Mg(c[h>>2]|0)}if(Lg(c[g>>2]|0)|0){j=c[g>>2]|0;l=d;return j|0}Ft(12);c[g>>2]=0;j=c[g>>2]|0;l=d;return j|0}function Kg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(c[e>>2]|0){c[17725]=(c[17725]|0)+(c[e>>2]|0);c[17726]=(c[17726]|0)+1}if(!(c[f>>2]|0)){l=d;return}c[17725]=(c[17725]|0)-(c[f>>2]|0);c[17726]=(c[17726]|0)+-1;l=d;return}function Lg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=c[d>>2];c[f>>2]=c[17722];if((c[e>>2]|0)>>>0<(c[f>>2]|0)>>>0){g=0;h=g&1;l=b;return h|0}g=(c[e>>2]|0)>>>0<((c[f>>2]|0)+(c[17723]|0)|0)>>>0;h=g&1;l=b;return h|0}function Mg(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=Og(c[d>>2]|0)|0;c[f>>2]=Ng(c[d>>2]|0)|0;if(c[e>>2]|0?(c[(c[e>>2]|0)+4>>2]&1|0)==0:0){a=c[e>>2]|0;c[a>>2]=(c[a>>2]|0)+(8+(c[c[d>>2]>>2]|0));c[d>>2]=c[e>>2]}if(!(c[f>>2]|0)){l=b;return}if(c[(c[f>>2]|0)+4>>2]&1|0){l=b;return}e=c[d>>2]|0;c[e>>2]=(c[e>>2]|0)+(8+(c[c[f>>2]>>2]|0));l=b;return}function Ng(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=(c[d>>2]|0)+8+(c[c[d>>2]>>2]|0);if(Lg(c[e>>2]|0)|0){f=c[e>>2]|0;l=b;return f|0}c[e>>2]=0;f=c[e>>2]|0;l=b;return f|0}function Og(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;if((c[d>>2]|0)==(c[17722]|0)){c[e>>2]=0;g=c[e>>2]|0;l=b;return g|0}c[e>>2]=c[17722];while(1){c[f>>2]=Ng(c[e>>2]|0)|0;if((c[f>>2]|0)==(c[d>>2]|0))break;c[e>>2]=c[f>>2]}g=c[e>>2]|0;l=b;return g|0}function Pg(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Ht(1284)|0;Qg(c[d>>2]|0);It(1284)|0;l=b;return}function Qg(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0;e=l;l=l+96|0;if((l|0)>=(m|0))$(96);f=e+88|0;g=e+84|0;h=e+80|0;i=e+76|0;j=e+72|0;k=e+95|0;n=e+24|0;o=e+68|0;p=e+64|0;q=e+60|0;r=e+94|0;s=e+16|0;t=e+56|0;u=e+52|0;v=e+48|0;w=e+93|0;x=e+8|0;y=e+44|0;z=e+40|0;A=e+36|0;B=e+92|0;C=e;E=e+32|0;c[f>>2]=b;if(!(c[f>>2]|0)){l=e;return}c[g>>2]=(c[f>>2]|0)+-8;c[h>>2]=c[c[g>>2]>>2];c[i>>2]=(c[g>>2]|0)+8;c[j>>2]=c[h>>2];a[k>>0]=-1;f=n;c[f>>2]=d[k>>0];c[f+4>>2]=0;while(1){if(!(c[i>>2]&7|0?(c[j>>2]|0)!=0:0))break;a[c[i>>2]>>0]=a[k>>0]|0;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+-1}if((c[j>>2]|0)>>>0>=8){f=n;b=gx(c[f>>2]|0,c[f+4>>2]|0,16843009,16843009)|0;f=n;c[f>>2]=b;c[f+4>>2]=D;do{c[o>>2]=c[i>>2];f=n;b=c[f+4>>2]|0;F=c[o>>2]|0;c[F>>2]=c[f>>2];c[F+4>>2]=b;c[j>>2]=(c[j>>2]|0)-8;c[i>>2]=(c[i>>2]|0)+8}while((c[j>>2]|0)>>>0>=8)}while(1){if(!(c[j>>2]|0))break;a[c[i>>2]>>0]=a[k>>0]|0;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+-1}c[p>>2]=(c[g>>2]|0)+8;c[q>>2]=c[h>>2];a[r>>0]=-86;j=s;c[j>>2]=d[r>>0];c[j+4>>2]=0;while(1){if(!(c[p>>2]&7|0?(c[q>>2]|0)!=0:0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}if((c[q>>2]|0)>>>0>=8){j=s;i=gx(c[j>>2]|0,c[j+4>>2]|0,16843009,16843009)|0;j=s;c[j>>2]=i;c[j+4>>2]=D;do{c[t>>2]=c[p>>2];j=s;i=c[j+4>>2]|0;k=c[t>>2]|0;c[k>>2]=c[j>>2];c[k+4>>2]=i;c[q>>2]=(c[q>>2]|0)-8;c[p>>2]=(c[p>>2]|0)+8}while((c[q>>2]|0)>>>0>=8)}while(1){if(!(c[q>>2]|0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}c[u>>2]=(c[g>>2]|0)+8;c[v>>2]=c[h>>2];a[w>>0]=85;q=x;c[q>>2]=d[w>>0];c[q+4>>2]=0;while(1){if(!(c[u>>2]&7|0?(c[v>>2]|0)!=0:0))break;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}if((c[v>>2]|0)>>>0>=8){q=x;p=gx(c[q>>2]|0,c[q+4>>2]|0,16843009,16843009)|0;q=x;c[q>>2]=p;c[q+4>>2]=D;do{c[y>>2]=c[u>>2];q=x;p=c[q+4>>2]|0;r=c[y>>2]|0;c[r>>2]=c[q>>2];c[r+4>>2]=p;c[v>>2]=(c[v>>2]|0)-8;c[u>>2]=(c[u>>2]|0)+8}while((c[v>>2]|0)>>>0>=8)}while(1){if(!(c[v>>2]|0))break;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}c[z>>2]=(c[g>>2]|0)+8;c[A>>2]=c[h>>2];a[B>>0]=0;v=C;c[v>>2]=d[B>>0];c[v+4>>2]=0;while(1){if(!(c[z>>2]&7|0?(c[A>>2]|0)!=0:0))break;a[c[z>>2]>>0]=a[B>>0]|0;c[z>>2]=(c[z>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+-1}if((c[A>>2]|0)>>>0>=8){v=C;u=gx(c[v>>2]|0,c[v+4>>2]|0,16843009,16843009)|0;v=C;c[v>>2]=u;c[v+4>>2]=D;do{c[E>>2]=c[z>>2];v=C;u=c[v+4>>2]|0;w=c[E>>2]|0;c[w>>2]=c[v>>2];c[w+4>>2]=u;c[A>>2]=(c[A>>2]|0)-8;c[z>>2]=(c[z>>2]|0)+8}while((c[A>>2]|0)>>>0>=8)}while(1){if(!(c[A>>2]|0))break;a[c[z>>2]>>0]=a[B>>0]|0;c[z>>2]=(c[z>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+-1}Kg(0,c[h>>2]|0);h=(c[g>>2]|0)+4|0;c[h>>2]=c[h>>2]&-2;Mg(c[g>>2]|0);l=e;return}function Rg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=a;c[f>>2]=b;Ht(1284)|0;c[g>>2]=(c[e>>2]|0)+(0-8);c[h>>2]=c[c[g>>2]>>2];if((c[f>>2]|0)>>>0<(c[h>>2]|0)>>>0){c[i>>2]=c[e>>2];It(1284)|0;j=c[i>>2]|0;l=d;return j|0}c[i>>2]=Ig(c[f>>2]|0)|0;if(!(c[i>>2]|0)){It(1284)|0;j=c[i>>2]|0;l=d;return j|0}_w(c[i>>2]|0,c[e>>2]|0,c[h>>2]|0)|0;Uw((c[i>>2]|0)+(c[h>>2]|0)|0,0,(c[f>>2]|0)-(c[h>>2]|0)|0)|0;Qg(c[e>>2]|0);It(1284)|0;j=c[i>>2]|0;l=d;return j|0}function Sg(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(c[17721]|0)e=(Lg(c[d>>2]|0)|0)!=0;else e=0;l=b;return e&1|0}function Tg(){var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;b=l;l=l+96|0;if((l|0)>=(m|0))$(96);e=b+76|0;f=b+72|0;g=b+83|0;h=b+24|0;i=b+68|0;j=b+64|0;k=b+60|0;n=b+82|0;o=b+16|0;p=b+56|0;q=b+52|0;r=b+48|0;s=b+81|0;t=b+8|0;u=b+44|0;v=b+40|0;w=b+36|0;x=b+80|0;y=b;z=b+32|0;if(!(c[17721]|0)){l=b;return}c[e>>2]=c[17722];c[f>>2]=c[17723];a[g>>0]=-1;A=h;c[A>>2]=d[g>>0];c[A+4>>2]=0;while(1){if(!(c[e>>2]&7|0?(c[f>>2]|0)!=0:0))break;a[c[e>>2]>>0]=a[g>>0]|0;c[e>>2]=(c[e>>2]|0)+1;c[f>>2]=(c[f>>2]|0)+-1}if((c[f>>2]|0)>>>0>=8){A=h;B=gx(c[A>>2]|0,c[A+4>>2]|0,16843009,16843009)|0;A=h;c[A>>2]=B;c[A+4>>2]=D;do{c[i>>2]=c[e>>2];A=h;B=c[A+4>>2]|0;C=c[i>>2]|0;c[C>>2]=c[A>>2];c[C+4>>2]=B;c[f>>2]=(c[f>>2]|0)-8;c[e>>2]=(c[e>>2]|0)+8}while((c[f>>2]|0)>>>0>=8)}while(1){if(!(c[f>>2]|0))break;a[c[e>>2]>>0]=a[g>>0]|0;c[e>>2]=(c[e>>2]|0)+1;c[f>>2]=(c[f>>2]|0)+-1}c[j>>2]=c[17722];c[k>>2]=c[17723];a[n>>0]=-86;f=o;c[f>>2]=d[n>>0];c[f+4>>2]=0;while(1){if(!(c[j>>2]&7|0?(c[k>>2]|0)!=0:0))break;a[c[j>>2]>>0]=a[n>>0]|0;c[j>>2]=(c[j>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+-1}if((c[k>>2]|0)>>>0>=8){f=o;e=gx(c[f>>2]|0,c[f+4>>2]|0,16843009,16843009)|0;f=o;c[f>>2]=e;c[f+4>>2]=D;do{c[p>>2]=c[j>>2];f=o;e=c[f+4>>2]|0;g=c[p>>2]|0;c[g>>2]=c[f>>2];c[g+4>>2]=e;c[k>>2]=(c[k>>2]|0)-8;c[j>>2]=(c[j>>2]|0)+8}while((c[k>>2]|0)>>>0>=8)}while(1){if(!(c[k>>2]|0))break;a[c[j>>2]>>0]=a[n>>0]|0;c[j>>2]=(c[j>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+-1}c[q>>2]=c[17722];c[r>>2]=c[17723];a[s>>0]=85;k=t;c[k>>2]=d[s>>0];c[k+4>>2]=0;while(1){if(!(c[q>>2]&7|0?(c[r>>2]|0)!=0:0))break;a[c[q>>2]>>0]=a[s>>0]|0;c[q>>2]=(c[q>>2]|0)+1;c[r>>2]=(c[r>>2]|0)+-1}if((c[r>>2]|0)>>>0>=8){k=t;j=gx(c[k>>2]|0,c[k+4>>2]|0,16843009,16843009)|0;k=t;c[k>>2]=j;c[k+4>>2]=D;do{c[u>>2]=c[q>>2];k=t;j=c[k+4>>2]|0;n=c[u>>2]|0;c[n>>2]=c[k>>2];c[n+4>>2]=j;c[r>>2]=(c[r>>2]|0)-8;c[q>>2]=(c[q>>2]|0)+8}while((c[r>>2]|0)>>>0>=8)}while(1){if(!(c[r>>2]|0))break;a[c[q>>2]>>0]=a[s>>0]|0;c[q>>2]=(c[q>>2]|0)+1;c[r>>2]=(c[r>>2]|0)+-1}c[v>>2]=c[17722];c[w>>2]=c[17723];a[x>>0]=0;r=y;c[r>>2]=d[x>>0];c[r+4>>2]=0;while(1){if(!(c[v>>2]&7|0?(c[w>>2]|0)!=0:0))break;a[c[v>>2]>>0]=a[x>>0]|0;c[v>>2]=(c[v>>2]|0)+1;c[w>>2]=(c[w>>2]|0)+-1}if((c[w>>2]|0)>>>0>=8){r=y;q=gx(c[r>>2]|0,c[r+4>>2]|0,16843009,16843009)|0;r=y;c[r>>2]=q;c[r+4>>2]=D;do{c[z>>2]=c[v>>2];r=y;q=c[r+4>>2]|0;s=c[z>>2]|0;c[s>>2]=c[r>>2];c[s+4>>2]=q;c[w>>2]=(c[w>>2]|0)-8;c[v>>2]=(c[v>>2]|0)+8}while((c[w>>2]|0)>>>0>=8)}while(1){if(!(c[w>>2]|0))break;a[c[v>>2]>>0]=a[x>>0]|0;c[v>>2]=(c[v>>2]|0)+1;c[w>>2]=(c[w>>2]|0)+-1}if(c[17724]|0)uw(c[17722]|0,c[17723]|0)|0;c[17722]=0;c[17721]=0;c[17723]=0;c[17719]=0;l=b;return}function Ug(){var a=0,b=0,d=0,e=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;Ht(1284)|0;if(!(c[17721]|0)){It(1284)|0;l=a;return}d=c[17723]|0;e=c[17726]|0;c[b>>2]=c[17725];c[b+4>>2]=d;c[b+8>>2]=e;Te(23465,b);It(1284)|0;l=a;return}function Vg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;b=l;l=l+544|0;if((l|0)>=(m|0))$(544);d=b+8|0;e=b;f=b+28|0;g=b+24|0;h=b+20|0;i=b+16|0;j=b+288|0;k=b+12|0;n=b+32|0;c[f>>2]=a;if(c[17727]|0){if(Wg()|0){Xg(5);Yg()}if(c[17727]|0)Se(23506,23512,114,23519)}c[17727]=1;do if(c[f>>2]|0){if(c[17728]|0)Se(23546,23512,121,23519)}else{if(!($v(23569,0)|0)){if(!(c[17728]|0))break;Se(23546,23512,132,23519)}c[h>>2]=Pv(23594,23624)|0;if(!(c[h>>2]|0)){a=c[(xu()|0)>>2]|0;c[i>>2]=a;if((a|0)!=2&(c[i>>2]|0)!=13?($v(23626,0)|0)==0:0){a=Nu(c[i>>2]|0)|0;c[e>>2]=23594;c[e+4>>2]=a;Te(23640,e);Aa()}}else{if(Gv(j,256,c[h>>2]|0)|0?Aw(j)|0:0){Qv(c[h>>2]|0)|0;if(!(c[17728]|0))break;Se(23546,23512,151,23519)}Qv(c[h>>2]|0)|0}c[17728]=1}while(0);if(c[17728]|0){l=b;return}c[g>>2]=Gt(1328)|0;if(c[g>>2]|0){c[d>>2]=Bt(c[g>>2]|0)|0;Te(23684,d);Aa()}c[k>>2]=Pv(23569,23624)|0;if(c[k>>2]|0){if(Gv(n,256,c[k>>2]|0)|0?Aw(n)|0:0)c[17729]=1;Qv(c[k>>2]|0)|0}Xg(1);l=b;return}function Wg(){return ((c[17728]|0)!=0^1)&1|0}function Xg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b;e=b+20|0;f=b+16|0;g=b+12|0;c[e>>2]=a;c[f>>2]=0;Zg();c[g>>2]=c[17730];switch(c[17730]|0){case 0:{if((c[e>>2]|0)==1|(c[e>>2]|0)==4|(c[e>>2]|0)==5)c[f>>2]=1;break}case 1:{if((c[e>>2]|0)==2|(c[e>>2]|0)==4|(c[e>>2]|0)==5)c[f>>2]=1;break}case 2:{if((c[e>>2]|0)==3|(c[e>>2]|0)==4|(c[e>>2]|0)==5)c[f>>2]=1;break}case 3:{if((c[e>>2]|0)==6|(c[e>>2]|0)==2|(c[e>>2]|0)==4|(c[e>>2]|0)==5)c[f>>2]=1;break}case 4:{if((c[e>>2]|0)==6|(c[e>>2]|0)==4|(c[e>>2]|0)==5|(c[e>>2]|0)==2)c[f>>2]=1;break}case 5:{if((c[e>>2]|0)==6)c[f>>2]=1;break}default:{}}if(c[f>>2]|0)c[17730]=c[e>>2];_g();if(!(c[f>>2]|0?!(Oe(2)|0):0)){a=$g(c[g>>2]|0)|0;g=$g(c[e>>2]|0)|0;e=c[f>>2]|0?23739:23747;c[d>>2]=a;c[d+4>>2]=g;c[d+8>>2]=e;Te(23754,d)}if(c[f>>2]|0){l=b;return}else{Yg();l=b;return}}function Yg(){Rv(0)|0;Aa()}function Zg(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[d>>2]=Ht(1328)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;Te(23912,b);Aa()}else{l=a;return}}function _g(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[d>>2]=It(1328)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;Te(23857,b);Aa()}else{l=a;return}}function $g(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;switch(c[d>>2]|0){case 0:{c[e>>2]=23794;break}case 1:{c[e>>2]=23803;break}case 2:{c[e>>2]=23808;break}case 3:{c[e>>2]=23818;break}case 4:{c[e>>2]=23830;break}case 5:{c[e>>2]=23836;break}case 6:{c[e>>2]=23848;break}default:c[e>>2]=37975}l=b;return c[e>>2]|0}function ah(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;if(Wg()|0)c[b>>2]=c[17729];else c[b>>2]=0;l=a;return c[b>>2]|0}function bh(){c[17729]=1;return}function ch(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(!(Wg()|0))Se(23967,23512,295,23986);if(ah()|0){dh(23512,300,23986,0,c[d>>2]|0);l=b;return}Zg();if(c[17731]|0){_g();l=b;return}else{c[17731]=1;_g();l=b;return}}function dh(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g;i=g+40|0;j=g+36|0;k=g+32|0;n=g+28|0;o=g+24|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;if(!(Wg()|0)){l=g;return}Xg(c[n>>2]|0?5:4);f=c[i>>2]|0;i=c[j>>2]|0;j=c[k>>2]|0?24020:72319;e=c[k>>2]|0?c[k>>2]|0:72319;k=c[o>>2]|0?c[o>>2]|0:24032;c[h>>2]=c[n>>2]|0?24013:72319;c[h+4>>2]=f;c[h+8>>2]=i;c[h+12>>2]=j;c[h+16>>2]=e;c[h+20>>2]=k;Te(24057,h);l=g;return}function eh(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a+4|0;d=a;if(Wg()|0){Zg();c[d>>2]=c[17731];_g();c[b>>2]=c[d>>2]}else c[b>>2]=0;l=a;return c[b>>2]|0}function fh(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;if(!(Wg()|0)){c[b>>2]=1;d=c[b>>2]|0;l=a;return d|0}Zg();if((c[17730]|0)==1){_g();gh(0)|0;Zg()}c[b>>2]=(c[17730]|0)==3&1;_g();d=c[b>>2]|0;l=a;return d|0}function gh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=4;c[f>>2]=50;if(Wg()|0)Xg(2);if((((((hh(c[d>>2]|0)|0)==0?(ih(c[d>>2]|0)|0)==0:0)?(jh(c[d>>2]|0)|0)==0:0)?(kh()|0)==0:0)?(lh(c[d>>2]|0)|0)==0:0)?(mh()|0)==0:0){c[e>>2]=3;c[f>>2]=0}if(!(Wg()|0)){g=c[f>>2]|0;l=b;return g|0}Xg(c[e>>2]|0);g=c[f>>2]|0;l=b;return g|0}function hh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;c[g>>2]=0;c[e>>2]=0;while(1){if(!(c[1432+(c[e>>2]<<2)>>2]|0))break;c[f>>2]=Oh(c[1432+(c[e>>2]<<2)>>2]|0,c[d>>2]|0,1)|0;a=c[1432+(c[e>>2]<<2)>>2]|0;if(c[f>>2]|0)h=Bt(c[f>>2]|0)|0;else h=0;nh(38079,a,0,h);if(c[f>>2]|0)c[g>>2]=1;c[e>>2]=(c[e>>2]|0)+1}l=b;return c[g>>2]|0}function ih(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;c[g>>2]=0;c[e>>2]=0;while(1){if(!(c[1408+(c[e>>2]<<2)>>2]|0))break;c[f>>2]=sj(c[1408+(c[e>>2]<<2)>>2]|0,c[d>>2]|0,1)|0;a=c[1408+(c[e>>2]<<2)>>2]|0;if(c[f>>2]|0)h=Bt(c[f>>2]|0)|0;else h=0;nh(43214,a,0,h);if(c[f>>2]|0)c[g>>2]=1;c[e>>2]=(c[e>>2]|0)+1}l=b;return c[g>>2]|0}function jh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;c[g>>2]=0;c[e>>2]=0;while(1){if(!(c[1384+(c[e>>2]<<2)>>2]|0))break;c[f>>2]=Bi(c[1384+(c[e>>2]<<2)>>2]|0,c[d>>2]|0,1)|0;a=c[1384+(c[e>>2]<<2)>>2]|0;if(c[f>>2]|0)h=Bt(c[f>>2]|0)|0;else h=0;nh(36101,a,0,h);if(c[f>>2]|0)c[g>>2]=1;c[e>>2]=(c[e>>2]|0)+1}l=b;return c[g>>2]|0}function kh(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;c[b>>2]=on(1)|0;if(c[b>>2]|0)d=Bt(c[b>>2]|0)|0;else d=0;nh(52643,0,0,d);l=a;return ((c[b>>2]|0)!=0^1^1)&1|0}function lh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;c[g>>2]=0;c[e>>2]=0;while(1){if(!(c[1372+(c[e>>2]<<2)>>2]|0))break;c[f>>2]=$j(c[1372+(c[e>>2]<<2)>>2]|0,c[d>>2]|0,1)|0;a=c[1372+(c[e>>2]<<2)>>2]|0;if(c[f>>2]|0)h=Bt(c[f>>2]|0)|0;else h=0;nh(47252,a,0,h);if(c[f>>2]|0)c[g>>2]=1;c[e>>2]=(c[e>>2]|0)+1}l=b;return c[g>>2]|0}function mh(){return 0}function nh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f;h=f+44|0;i=f+40|0;j=f+36|0;k=f+32|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if((c[k>>2]|0)==0?(Oe(2)|0)==0:0){l=f;return}e=(Fu(c[h>>2]|0,36101)|0)!=0;d=e?c[h>>2]|0:43214;e=(Fu(c[h>>2]|0,36101)|0)!=0^1;b=e?24105:72319;do if(Fu(c[h>>2]|0,38079)|0){if(!(Fu(c[h>>2]|0,43214)|0)){n=Pi(c[i>>2]|0)|0;break}if(!(Fu(c[h>>2]|0,36101)|0)){n=Pi(c[i>>2]|0)|0;break}if(Fu(c[h>>2]|0,47252)|0)n=72319;else n=Qj(c[i>>2]|0)|0}else n=th(c[i>>2]|0)|0;while(0);h=c[i>>2]|0;i=c[k>>2]|0?c[k>>2]|0:24111;k=c[j>>2]|0?24116:72319;e=c[j>>2]|0?c[j>>2]|0:72319;a=c[j>>2]|0?47240:72319;c[g>>2]=d;c[g+4>>2]=b;c[g+8>>2]=n;c[g+12>>2]=h;c[g+16>>2]=i;c[g+20>>2]=k;c[g+24>>2]=e;c[g+28>>2]=a;Te(24119,g);l=f;return}function oh(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;if(Wg()|0){Zg();c[b>>2]=(c[17730]|0)==3&1;_g()}else c[b>>2]=1;l=a;return c[b>>2]|0}function ph(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;if(Wg()|0){Zg();c[b>>2]=((c[17730]|0)==3?1:(c[17730]|0)==4)&1;_g();d=c[b>>2]|0;l=a;return d|0}else{c[b>>2]=1;d=c[b>>2]|0;l=a;return d|0}return 0}function qh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;n=f+4|0;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if((c[i>>2]|0)!=1){c[g>>2]=c[i>>2];Xe(24163,g)}if((c[j>>2]|0)>>>0<8)c[j>>2]=8;c[n>>2]=wf(1,8+(c[j>>2]|0)|0)|0;if(c[n>>2]|0){j=c[n>>2]|0;a[j>>0]=a[24209]|0;a[j+1>>0]=a[24210]|0;a[j+2>>0]=a[24211]|0;a[(c[n>>2]|0)+3>>0]=c[i>>2];c[(c[n>>2]|0)+4>>2]=c[k>>2];c[h>>2]=c[n>>2];o=c[h>>2]|0;l=f;return o|0}else{c[h>>2]=0;o=c[h>>2]|0;l=f;return o|0}return 0}function rh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+8|0;g=e;h=e+24|0;i=e+20|0;c[h>>2]=b;c[i>>2]=d;if(!(c[h>>2]|0)){j=c[h>>2]|0;c[g>>2]=j;We(24213,g)}if(Jv(c[h>>2]|0,24209,3)|0){j=c[h>>2]|0;c[g>>2]=j;We(24213,g)}if((a[(c[h>>2]|0)+3>>0]|0)!=(c[i>>2]|0)){g=c[h>>2]|0;j=a[(c[h>>2]|0)+3>>0]|0;c[f>>2]=c[i>>2];c[f+4>>2]=g;c[f+8>>2]=j;We(24261,f)}else{l=e;return (c[h>>2]|0)+8|0}return 0}function sh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d;g=d+12|0;c[g>>2]=b;if(!(c[g>>2]|0)){l=d;return}b=(Jv(c[g>>2]|0,24209,3)|0)!=0;h=c[g>>2]|0;if(b){c[f>>2]=h;We(24318,f)}f=c[g>>2]|0;if((a[h+3>>0]|0)!=1){c[e>>2]=a[f+3>>0];We(24360,e)}if(c[f+4>>2]|0)wb[c[(c[g>>2]|0)+4>>2]&15]((c[g>>2]|0)+8|0);vf(c[g>>2]|0);l=d;return}function th(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=uh(c[d>>2]|0)|0;if(!(c[e>>2]|0)){f=37975;l=b;return f|0}f=c[(c[e>>2]|0)+8>>2]|0;l=b;return f|0}function uh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[e>>2]=vh(c[e>>2]|0)|0;c[f>>2]=0;while(1){a=c[1452+(c[f>>2]<<2)>>2]|0;c[g>>2]=a;if(!a){h=6;break}if((c[e>>2]|0)==(c[c[g>>2]>>2]|0)){h=4;break}c[f>>2]=(c[f>>2]|0)+1}if((h|0)==4){c[d>>2]=c[g>>2];i=c[d>>2]|0;l=b;return i|0}else if((h|0)==6){c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}return 0}function vh(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return c[d>>2]|0}function wh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;n=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[n>>2]=0;if((c[i>>2]|0)>=65536)c[k>>2]=71;else c[k>>2]=xh(n,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;c[c[g>>2]>>2]=c[k>>2]|0?0:c[n>>2]|0;l=f;return c[k>>2]|0}function xh(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;n=g+20|0;o=g+16|0;p=g+12|0;q=g+8|0;r=g+4|0;s=g;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=f;c[n>>2]=c[k>>2]&1;c[p>>2]=0;mn();c[o>>2]=uh(c[i>>2]|0)|0;do if(c[o>>2]|0)if(a[(c[o>>2]|0)+4>>0]&1|0){c[q>>2]=12;break}else{c[q>>2]=0;break}else c[q>>2]=12;while(0);do if(!(c[q>>2]|0)){if((c[k>>2]&-16|0)==0?(c[k>>2]&0|0)==0:0)break;c[q>>2]=12}while(0);a:do if(!(c[q>>2]|0)){f=c[j>>2]|0;b:do if((f|0)<6)switch(f|0){case 5:case 2:case 3:case 1:{break b;break}case 4:{if(c[(c[o>>2]|0)+44>>2]|0?c[(c[o>>2]|0)+48>>2]|0:0)break a;c[q>>2]=71;break a;break}case 0:{if((Wg()|0)==0?Ff(0)|0:0)break a;c[q>>2]=71;break a;break}default:{t=37;break b}}else{if((f|0)<9){switch(f|0){case 7:case 6:{break b;break}case 8:break;default:{t=37;break b}}if((c[(c[o>>2]|0)+20>>2]|0)!=16)c[q>>2]=71;if(c[(c[o>>2]|0)+36>>2]|0?c[(c[o>>2]|0)+40>>2]|0:0)break a;c[q>>2]=71;break a}if((f|0)<11){switch(f|0){case 9:{break b;break}case 10:break;default:{t=37;break b}}if((c[(c[o>>2]|0)+44>>2]|0?c[(c[o>>2]|0)+48>>2]|0:0)?c[(c[o>>2]|0)+60>>2]|0:0){if((c[c[o>>2]>>2]|0)==316)break a;c[q>>2]=71;break a}c[q>>2]=71;break a}if((f|0)>=65537)switch(f|0){case 65537:{break b;break}default:{t=37;break b}}switch(f|0){case 11:break;default:{t=37;break b}}if(c[(c[o>>2]|0)+36>>2]|0?c[(c[o>>2]|0)+40>>2]|0:0){if((c[(c[o>>2]|0)+20>>2]|0)==16)break a;c[q>>2]=71;break a}c[q>>2]=71;break a}while(0);if((t|0)==37){c[q>>2]=71;break}if(c[(c[o>>2]|0)+36>>2]|0?c[(c[o>>2]|0)+40>>2]|0:0)break;c[q>>2]=71}while(0);if(c[q>>2]|0){u=c[q>>2]|0;v=(u|0)!=0;w=c[p>>2]|0;x=v?0:w;y=c[h>>2]|0;c[y>>2]=x;z=c[q>>2]|0;A=yh(z)|0;l=g;return A|0}c[r>>2]=512+(c[(c[o>>2]|0)+28>>2]<<1)-16+15;t=c[r>>2]|0;if(c[n>>2]|0)c[p>>2]=xf(1,t)|0;else c[p>>2]=wf(1,t)|0;if(!(c[p>>2]|0)){c[q>>2]=Et()|0;u=c[q>>2]|0;v=(u|0)!=0;w=c[p>>2]|0;x=v?0:w;y=c[h>>2]|0;c[y>>2]=x;z=c[q>>2]|0;A=yh(z)|0;l=g;return A|0}c[s>>2]=0;if(c[p>>2]&15|0){c[s>>2]=16-(c[p>>2]&15);c[p>>2]=(c[p>>2]|0)+(c[s>>2]|0)}c[c[p>>2]>>2]=c[n>>2]|0?1183944770:604576100;c[(c[p>>2]|0)+4>>2]=(c[r>>2]|0)-(c[s>>2]|0);c[(c[p>>2]|0)+8>>2]=c[s>>2];c[(c[p>>2]|0)+12>>2]=c[o>>2];c[(c[p>>2]|0)+16>>2]=c[i>>2];c[(c[p>>2]|0)+48>>2]=c[j>>2];c[(c[p>>2]|0)+52>>2]=c[k>>2];switch(c[i>>2]|0){case 9:case 8:case 7:{c[(c[p>>2]|0)+20>>2]=1;c[(c[p>>2]|0)+20+4>>2]=2;c[(c[p>>2]|0)+20+8>>2]=1;c[(c[p>>2]|0)+20+12>>2]=3;c[(c[p>>2]|0)+20+16>>2]=4;c[(c[p>>2]|0)+20+20>>2]=5;c[(c[p>>2]|0)+20+24>>2]=2;break}case 303:case 10:{c[(c[p>>2]|0)+20+12>>2]=6;c[(c[p>>2]|0)+20+4>>2]=7;c[(c[p>>2]|0)+20+16>>2]=8;break}default:{}}if((c[j>>2]|0)!=11){u=c[q>>2]|0;v=(u|0)!=0;w=c[p>>2]|0;x=v?0:w;y=c[h>>2]|0;c[y>>2]=x;z=c[q>>2]|0;A=yh(z)|0;l=g;return A|0}a[(c[p>>2]|0)+128+352>>0]=16;u=c[q>>2]|0;v=(u|0)!=0;w=c[p>>2]|0;x=v?0:w;y=c[h>>2]|0;c[y>>2]=x;z=c[q>>2]|0;A=yh(z)|0;l=g;return A|0}function yh(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=zh(32,c[d>>2]|0)|0;l=b;return a|0}function zh(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=Ah(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function Ah(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function Bh(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+28|0;k=e;n=e+8|0;c[f>>2]=b;if(!(c[f>>2]|0)){l=e;return}if((c[c[f>>2]>>2]|0)!=1183944770?(c[c[f>>2]>>2]|0)!=604576100:0)Le(63,24409);c[c[f>>2]>>2]=0;c[g>>2]=c[(c[f>>2]|0)+8>>2];c[h>>2]=c[f>>2];c[i>>2]=c[(c[f>>2]|0)+4>>2];a[j>>0]=0;b=k;c[b>>2]=d[j>>0];c[b+4>>2]=0;while(1){if(!(c[h>>2]&7|0?(c[i>>2]|0)!=0:0))break;a[c[h>>2]>>0]=a[j>>0]|0;c[h>>2]=(c[h>>2]|0)+1;c[i>>2]=(c[i>>2]|0)+-1}if((c[i>>2]|0)>>>0>=8){b=k;o=gx(c[b>>2]|0,c[b+4>>2]|0,16843009,16843009)|0;b=k;c[b>>2]=o;c[b+4>>2]=D;do{c[n>>2]=c[h>>2];b=k;o=c[b+4>>2]|0;p=c[n>>2]|0;c[p>>2]=c[b>>2];c[p+4>>2]=o;c[i>>2]=(c[i>>2]|0)-8;c[h>>2]=(c[h>>2]|0)+8}while((c[i>>2]|0)>>>0>=8)}while(1){if(!(c[i>>2]|0))break;a[c[h>>2]>>0]=a[j>>0]|0;c[h>>2]=(c[h>>2]|0)+1;c[i>>2]=(c[i>>2]|0)+-1}vf((c[f>>2]|0)+(0-(c[g>>2]|0))|0);l=e;return}function Ch(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+20|0;i=g+16|0;j=g+12|0;k=g+8|0;n=g+4|0;o=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;if(!(c[k>>2]|0)){c[k>>2]=c[i>>2];c[n>>2]=c[j>>2]}c[o>>2]=Dh(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0;if(!((c[o>>2]|0)!=0&(c[i>>2]|0)!=0)){p=c[o>>2]|0;l=g;return p|0}Uw(c[i>>2]|0,66,c[j>>2]|0)|0;p=c[o>>2]|0;l=g;return p|0}function Dh(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g;i=g+24|0;j=g+20|0;k=g+16|0;n=g+12|0;o=g+8|0;p=g+4|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;f=c[(c[i>>2]|0)+48>>2]|0;a:do if((f|0)>=6){if((f|0)<9)switch(f|0){case 6:{c[p>>2]=yq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 7:{c[p>>2]=dq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 8:{c[p>>2]=oq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24504,h)}}if((f|0)<11)switch(f|0){case 9:{c[p>>2]=Bq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 10:{c[p>>2]=nr(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24504,h)}}if((f|0)<65537)switch(f|0){case 11:{c[p>>2]=er(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24504,h)}}else switch(f|0){case 65537:{c[p>>2]=71;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24504,h)}}}else switch(f|0){case 1:{c[p>>2]=Eh(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 3:{c[p>>2]=gq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 2:{c[p>>2]=qq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 5:{c[p>>2]=ir(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 4:{Eb[c[(c[(c[i>>2]|0)+12>>2]|0)+44>>2]&1]((c[i>>2]|0)+496|0,c[j>>2]|0,c[n>>2]|0,c[o>>2]|0);c[p>>2]=0;break a;break}case 0:{if((Wg()|0)==0?Ff(0)|0:0){if((c[n>>2]|0)!=(c[j>>2]|0))$w(c[j>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;c[p>>2]=0;break a}dh(24458,875,24467,0,24482);c[p>>2]=71;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24504,h)}}while(0);l=g;return c[p>>2]|0}function Eh(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=Fh(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[(c[(c[h>>2]|0)+12>>2]|0)+36>>2]|0)|0;l=g;return f|0}function Fh(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+44|0;j=h+40|0;k=h+36|0;n=h+32|0;o=h+28|0;p=h+24|0;q=h+20|0;r=h+16|0;s=h+12|0;t=h+8|0;u=h+4|0;v=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=c[(c[(c[j>>2]|0)+12>>2]|0)+20>>2];if((c[n>>2]|0)>>>0<(c[p>>2]|0)>>>0){c[i>>2]=200;w=c[i>>2]|0;l=h;return w|0}if(((c[p>>2]|0)>>>0)%((c[r>>2]|0)>>>0)|0|0){c[i>>2]=139;w=c[i>>2]|0;l=h;return w|0}c[t>>2]=((c[p>>2]|0)>>>0)/((c[r>>2]|0)>>>0)|0;c[u>>2]=0;c[s>>2]=0;while(1){if((c[s>>2]|0)>>>0>=(c[t>>2]|0)>>>0)break;c[v>>2]=ub[c[q>>2]&63]((c[j>>2]|0)+496|0,c[k>>2]|0,c[o>>2]|0)|0;c[u>>2]=(c[v>>2]|0)>>>0>(c[u>>2]|0)>>>0?c[v>>2]|0:c[u>>2]|0;c[o>>2]=(c[o>>2]|0)+(c[r>>2]|0);c[k>>2]=(c[k>>2]|0)+(c[r>>2]|0);c[s>>2]=(c[s>>2]|0)+1}if((c[u>>2]|0)>>>0>0){bf((c[u>>2]|0)+16|0);cf()}c[i>>2]=0;w=c[i>>2]|0;l=h;return w|0}function Gh(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;if(!(c[k>>2]|0)){c[k>>2]=c[i>>2];c[n>>2]=c[j>>2]}f=Hh(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0;l=g;return f|0}function Hh(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g;i=g+24|0;j=g+20|0;k=g+16|0;n=g+12|0;o=g+8|0;p=g+4|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;f=c[(c[i>>2]|0)+48>>2]|0;a:do if((f|0)>=6){if((f|0)<9)switch(f|0){case 6:{c[p>>2]=yq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 7:{c[p>>2]=fq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 8:{c[p>>2]=pq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24552,h)}}if((f|0)<11)switch(f|0){case 9:{c[p>>2]=Kq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 10:{c[p>>2]=qr(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24552,h)}}if((f|0)<65537)switch(f|0){case 11:{c[p>>2]=hr(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24552,h)}}else switch(f|0){case 65537:{c[p>>2]=71;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24552,h)}}}else switch(f|0){case 1:{c[p>>2]=Ih(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 3:{c[p>>2]=jq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 2:{c[p>>2]=tq(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 5:{c[p>>2]=ir(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;break a;break}case 4:{Eb[c[(c[(c[i>>2]|0)+12>>2]|0)+48>>2]&1]((c[i>>2]|0)+496|0,c[j>>2]|0,c[n>>2]|0,c[o>>2]|0);c[p>>2]=0;break a;break}case 0:{if((Wg()|0)==0?Ff(0)|0:0){if((c[n>>2]|0)!=(c[j>>2]|0))$w(c[j>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;c[p>>2]=0;break a}dh(24458,992,24537,0,24482);c[p>>2]=71;break a;break}default:{q=c[i>>2]|0;r=q+48|0;s=c[r>>2]|0;c[h>>2]=s;We(24552,h)}}while(0);l=g;return c[p>>2]|0}function Ih(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=Fh(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[(c[(c[h>>2]|0)+12>>2]|0)+40>>2]|0)|0;l=g;return f|0}function Jh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Kh(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function Kh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=ub[c[(c[(c[g>>2]|0)+12>>2]|0)+32>>2]&63]((c[g>>2]|0)+496|0,c[h>>2]|0,c[i>>2]|0)|0;i=c[g>>2]|0;a:do if(!(c[j>>2]|0)){_w(i+496+(c[(c[(c[g>>2]|0)+12>>2]|0)+28>>2]|0)|0,(c[g>>2]|0)+496|0,c[(c[(c[g>>2]|0)+12>>2]|0)+28>>2]|0)|0;h=(c[g>>2]|0)+56|0;a[h>>0]=a[h>>0]&-2|1;h=c[(c[g>>2]|0)+48>>2]|0;if((h|0)<10){switch(h|0){case 9:break;default:break a}Lq(c[g>>2]|0);break}if((h|0)<65537){switch(h|0){case 10:break;default:break a}rr(c[g>>2]|0);break}else{switch(h|0){case 65537:break;default:break a}wq(c[g>>2]|0)|0;break}}else{h=i+56|0;a[h>>0]=a[h>>0]&-2}while(0);l=f;return c[j>>2]|0}function Lh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;switch(c[(c[f>>2]|0)+48>>2]|0){case 8:{c[i>>2]=lq(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;break}case 9:{c[i>>2]=Cq(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;break}case 10:{c[i>>2]=mr(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;break}case 11:{c[i>>2]=ar(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;break}default:c[i>>2]=Mh(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0}l=e;return c[i>>2]|0}function Mh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;e=c[i>>2]|0;if(c[(c[(c[i>>2]|0)+12>>2]|0)+60>>2]|0){zb[c[(c[e+12>>2]|0)+60>>2]&7]((c[i>>2]|0)+496|0,c[j>>2]|0,c[k>>2]|0);c[h>>2]=0;n=c[h>>2]|0;l=f;return n|0}Uw(e+64|0,0,c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2]|0)|0;if(c[j>>2]|0){if((c[k>>2]|0)!=(c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2]|0)){e=c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2]|0;c[g>>2]=c[k>>2];c[g+4>>2]=e;Te(24585,g);dh(24458,682,24628,0,24641)}if((c[k>>2]|0)>>>0>(c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2]|0)>>>0)c[k>>2]=c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2];_w((c[i>>2]|0)+64|0,c[j>>2]|0,c[k>>2]|0)|0;k=(c[i>>2]|0)+56|0;a[k>>0]=a[k>>0]&-3|2}else{k=(c[i>>2]|0)+56|0;a[k>>0]=a[k>>0]&-3}c[(c[i>>2]|0)+112>>2]=0;c[h>>2]=0;n=c[h>>2]|0;l=f;return n|0}function Nh(){return 0}function Oh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=0;c[k>>2]=uh(c[g>>2]|0)|0;if((c[k>>2]|0?(a[(c[k>>2]|0)+4>>0]&1|0)==0:0)?c[(c[k>>2]|0)+52>>2]|0:0){c[j>>2]=ub[c[(c[k>>2]|0)+52>>2]&63](c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0;n=c[j>>2]|0;o=Ph(n)|0;l=f;return o|0}c[j>>2]=12;if(!(c[i>>2]|0)){n=c[j>>2]|0;o=Ph(n)|0;l=f;return o|0}h=c[i>>2]|0;i=c[g>>2]|0;if(c[k>>2]|0?!(a[(c[k>>2]|0)+4>>0]&1|0):0)p=38046;else p=c[k>>2]|0?38007:38026;Eb[h&1](38079,i,38068,p);n=c[j>>2]|0;o=Ph(n)|0;l=f;return o|0}function Ph(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Ah(1,c[d>>2]|0)|0;l=b;return a|0}function Qh(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+24|0;i=g+20|0;j=g+16|0;k=g+12|0;n=g+8|0;o=g+4|0;p=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[p>>2]=0;if(!(c[j>>2]|0)){c[o>>2]=0;while(1){if(!(c[1476+((c[o>>2]|0)*48|0)>>2]|0))break;if((c[i>>2]|0)==(c[1476+((c[o>>2]|0)*48|0)+4>>2]|0)?(c[1476+((c[o>>2]|0)*48|0)+12>>2]|0)==0:0)break;c[o>>2]=(c[o>>2]|0)+1}if(!(c[1476+((c[o>>2]|0)*48|0)>>2]|0))c[o>>2]=-1}else c[o>>2]=Rh(c[j>>2]|0)|0;if((c[o>>2]|0)<0){c[h>>2]=188;q=c[h>>2]|0;l=g;return q|0}c[p>>2]=c[1476+((c[o>>2]|0)*48|0)>>2];if(Wg()|0?(a[1476+((c[o>>2]|0)*48|0)+8>>0]&1|0)==0:0){c[h>>2]=60;q=c[h>>2]|0;l=g;return q|0}if((c[1476+((c[o>>2]|0)*48|0)+12>>2]|0)>>>0>=3){c[h>>2]=59;q=c[h>>2]|0;l=g;return q|0}if(c[n>>2]|0)c[c[n>>2]>>2]=c[1476+((c[o>>2]|0)*48|0)+4>>2];if(c[k>>2]|0){c[c[k>>2]>>2]=c[1476+((c[o>>2]|0)*48|0)+12>>2];c[(c[k>>2]|0)+4>>2]=c[1476+((c[o>>2]|0)*48|0)+16>>2];if(!(c[(c[k>>2]|0)+8>>2]|0)){n=Sh(c[1476+((c[o>>2]|0)*48|0)+20>>2]|0)|0;c[(c[k>>2]|0)+8>>2]=n}if(!(c[(c[k>>2]|0)+12>>2]|0)){n=Sh(c[1476+((c[o>>2]|0)*48|0)+24>>2]|0)|0;c[(c[k>>2]|0)+12>>2]=n}if(!(c[(c[k>>2]|0)+16>>2]|0)){n=Sh(c[1476+((c[o>>2]|0)*48|0)+28>>2]|0)|0;c[(c[k>>2]|0)+16>>2]=n}if(!(c[(c[k>>2]|0)+32>>2]|0)){n=Sh(c[1476+((c[o>>2]|0)*48|0)+32>>2]|0)|0;c[(c[k>>2]|0)+32>>2]=n}if(!(c[(c[k>>2]|0)+36>>2]|0)){n=Sh(c[1476+((c[o>>2]|0)*48|0)+44>>2]|0)|0;c[(c[k>>2]|0)+36>>2]=n}if(!(c[(c[k>>2]|0)+20>>2]|0)){n=Sh(c[1476+((c[o>>2]|0)*48|0)+36>>2]|0)|0;c[(c[k>>2]|0)+20>>2]=n}if(!(c[(c[k>>2]|0)+20+4>>2]|0)){n=Sh(c[1476+((c[o>>2]|0)*48|0)+40>>2]|0)|0;c[(c[k>>2]|0)+20+4>>2]=n}if(!(c[(c[k>>2]|0)+20+8>>2]|0)){n=up(1)|0;c[(c[k>>2]|0)+20+8>>2]=n}if(!(c[(c[k>>2]|0)+40>>2]|0))c[(c[k>>2]|0)+40>>2]=c[p>>2]}c[h>>2]=0;q=c[h>>2]|0;l=g;return q|0}function Rh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[f>>2]=0;while(1){if(!(c[1476+((c[f>>2]|0)*48|0)>>2]|0))break;a=(Fu(c[e>>2]|0,c[1476+((c[f>>2]|0)*48|0)>>2]|0)|0)!=0;h=c[f>>2]|0;if(!a){i=4;break}c[f>>2]=h+1}if((i|0)==4){c[d>>2]=h;j=c[d>>2]|0;l=b;return j|0}a:do if(!(c[1476+((c[f>>2]|0)*48|0)>>2]|0)){c[g>>2]=0;while(1){if(!(c[2532+(c[g>>2]<<3)>>2]|0))break;if(!(Fu(c[e>>2]|0,c[2532+(c[g>>2]<<3)+4>>2]|0)|0))break;c[g>>2]=(c[g>>2]|0)+1}if(c[2532+(c[g>>2]<<3)>>2]|0){c[f>>2]=0;while(1){if(!(c[1476+((c[f>>2]|0)*48|0)>>2]|0))break a;h=(Fu(c[2532+(c[g>>2]<<3)>>2]|0,c[1476+((c[f>>2]|0)*48|0)>>2]|0)|0)!=0;k=c[f>>2]|0;if(!h)break;c[f>>2]=k+1}c[d>>2]=k;j=c[d>>2]|0;l=b;return j|0}}while(0);c[d>>2]=-1;j=c[d>>2]|0;l=b;return j|0}function Sh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;e=b+12|0;f=b+8|0;g=b+4|0;c[e>>2]=a;c[f>>2]=Zo(g,4,c[e>>2]|0,0,0)|0;if(c[f>>2]|0){c[d>>2]=Bt(c[f>>2]|0)|0;We(35925,d)}else{l=b;return c[g>>2]|0}return 0}function Th(a,b,d,e,f,g,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;k=l;l=l+64|0;if((l|0)>=(m|0))$(64);n=k+48|0;o=k+44|0;p=k+40|0;q=k+36|0;r=k+32|0;s=k+28|0;t=k+24|0;u=k+20|0;v=k+16|0;w=k+12|0;x=k+8|0;y=k+4|0;z=k;c[o>>2]=a;c[p>>2]=b;c[q>>2]=d;c[r>>2]=e;c[s>>2]=f;c[t>>2]=g;c[u>>2]=h;c[v>>2]=i;c[w>>2]=j;c[x>>2]=Rh(c[o>>2]|0)|0;if((c[x>>2]|0)<0){c[n>>2]=188;A=c[n>>2]|0;l=k;return A|0}do if(c[u>>2]|0){c[z>>2]=4;o=hv((c[1476+((c[x>>2]|0)*48|0)+36>>2]|0)+2|0)|0;c[z>>2]=(c[z>>2]|0)+o;o=hv((c[1476+((c[x>>2]|0)*48|0)+40>>2]|0)+2|0)|0;c[z>>2]=(c[z>>2]|0)+o;c[z>>2]=(c[z>>2]|0)+1;c[y>>2]=pf(c[z>>2]|0)|0;if(c[y>>2]|0){o=uv(c[y>>2]|0,35599)|0;j=uv(o,(c[1476+((c[x>>2]|0)*48|0)+36>>2]|0)+2|0)|0;tv(j,(c[1476+((c[x>>2]|0)*48|0)+40>>2]|0)+2|0)|0;Tp(c[c[u>>2]>>2]|0);j=Sh(c[y>>2]|0)|0;c[c[u>>2]>>2]=j;vf(c[y>>2]|0);break}c[n>>2]=Et()|0;A=c[n>>2]|0;l=k;return A|0}while(0);if(c[p>>2]|0)c[c[p>>2]>>2]=c[1476+((c[x>>2]|0)*48|0)+12>>2];if(c[q>>2]|0)c[c[q>>2]>>2]=c[1476+((c[x>>2]|0)*48|0)+16>>2];if(c[r>>2]|0){Tp(c[c[r>>2]>>2]|0);q=Sh(c[1476+((c[x>>2]|0)*48|0)+20>>2]|0)|0;c[c[r>>2]>>2]=q}if(c[s>>2]|0){Tp(c[c[s>>2]>>2]|0);q=Sh(c[1476+((c[x>>2]|0)*48|0)+24>>2]|0)|0;c[c[s>>2]>>2]=q}if(c[t>>2]|0){Tp(c[c[t>>2]>>2]|0);q=Sh(c[1476+((c[x>>2]|0)*48|0)+28>>2]|0)|0;c[c[t>>2]>>2]=q}if(c[v>>2]|0){Tp(c[c[v>>2]>>2]|0);q=Sh(c[1476+((c[x>>2]|0)*48|0)+32>>2]|0)|0;c[c[v>>2]>>2]=q}if(c[w>>2]|0){Tp(c[c[w>>2]>>2]|0);q=Sh(c[1476+((c[x>>2]|0)*48|0)+44>>2]|0)|0;c[c[w>>2]>>2]=q}c[n>>2]=0;A=c[n>>2]|0;l=k;return A|0}function Uh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;e=l;l=l+128|0;if((l|0)>=(m|0))$(128);f=e;g=e+112|0;h=e+108|0;i=e+104|0;j=e+100|0;k=e+96|0;n=e+92|0;o=e+48|0;p=e+44|0;q=e+40|0;r=e+36|0;s=e+32|0;t=e+28|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[n>>2]=0;c[p>>2]=0;c[q>>2]=0;d=o;b=d+44|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(b|0));if(c[j>>2]|0)c[c[j>>2]>>2]=0;if(!(c[h>>2]|0)){c[r>>2]=c[i>>2];if((c[r>>2]|0)>=0&(c[r>>2]|0)>>>0<22?(c[n>>2]=c[1476+((c[r>>2]|0)*48|0)>>2],c[j>>2]|0):0)c[c[j>>2]>>2]=c[1476+((c[r>>2]|0)*48|0)+4>>2];c[g>>2]=c[n>>2];u=c[g>>2]|0;l=e;return u|0}i=c[h>>2]|0;c[f>>2]=o+8;c[f+4>>2]=o+12;c[f+8>>2]=o+16;c[f+12>>2]=p;c[f+16>>2]=o+32;c[f+20>>2]=o+36;c[f+24>>2]=0;c[k>>2]=Vh(lg(i,0,35604,f)|0)|0;a:do if((c[k>>2]|0)==68){c[s>>2]=Tf(c[h>>2]|0,47218,5)|0;if(c[s>>2]|0?(c[t>>2]=_f(c[s>>2]|0,1)|0,Rf(c[s>>2]|0),c[t>>2]|0):0){c[r>>2]=Rh(c[t>>2]|0)|0;vf(c[t>>2]|0);if((c[r>>2]|0)>=0?(c[n>>2]=c[1476+((c[r>>2]|0)*48|0)>>2],c[j>>2]|0):0)c[c[j>>2]>>2]=c[1476+((c[r>>2]|0)*48|0)+4>>2];c[g>>2]=c[n>>2];u=c[g>>2]|0;l=e;return u|0}}else if(!(c[k>>2]|0)){if(c[p>>2]|0?(yn(o+20|0),zi(o+20|0,c[p>>2]|0)|0):0)break;c[r>>2]=0;while(1){if(!(c[1476+((c[r>>2]|0)*48|0)>>2]|0))break a;Dp(c[q>>2]|0);c[q>>2]=Sh(c[1476+((c[r>>2]|0)*48|0)+20>>2]|0)|0;if(((((((wo(c[q>>2]|0,c[o+8>>2]|0)|0)==0?(Dp(c[q>>2]|0),c[q>>2]=Sh(c[1476+((c[r>>2]|0)*48|0)+24>>2]|0)|0,(wo(c[q>>2]|0,c[o+12>>2]|0)|0)==0):0)?(Dp(c[q>>2]|0),c[q>>2]=Sh(c[1476+((c[r>>2]|0)*48|0)+28>>2]|0)|0,(wo(c[q>>2]|0,c[o+16>>2]|0)|0)==0):0)?(Dp(c[q>>2]|0),c[q>>2]=Sh(c[1476+((c[r>>2]|0)*48|0)+32>>2]|0)|0,(wo(c[q>>2]|0,c[o+32>>2]|0)|0)==0):0)?(Dp(c[q>>2]|0),c[q>>2]=Sh(c[1476+((c[r>>2]|0)*48|0)+44>>2]|0)|0,(wo(c[q>>2]|0,c[o+36>>2]|0)|0)==0):0)?(Dp(c[q>>2]|0),c[q>>2]=Sh(c[1476+((c[r>>2]|0)*48|0)+36>>2]|0)|0,(wo(c[q>>2]|0,c[o+20>>2]|0)|0)==0):0)?(Dp(c[q>>2]|0),c[q>>2]=Sh(c[1476+((c[r>>2]|0)*48|0)+40>>2]|0)|0,(wo(c[q>>2]|0,c[o+20+4>>2]|0)|0)==0):0)break;c[r>>2]=(c[r>>2]|0)+1}c[n>>2]=c[1476+((c[r>>2]|0)*48|0)>>2];if(c[j>>2]|0)c[c[j>>2]>>2]=c[1476+((c[r>>2]|0)*48|0)+4>>2]}while(0);Tp(c[q>>2]|0);Tp(c[o+8>>2]|0);Tp(c[o+12>>2]|0);Tp(c[o+16>>2]|0);Tp(c[p>>2]|0);An(o+20|0);Tp(c[o+32>>2]|0);Tp(c[o+36>>2]|0);c[g>>2]=c[n>>2];u=c[g>>2]|0;l=e;return u|0}function Vh(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return c[d>>2]&65535|0}function Wh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+76|0;g=e+72|0;h=e+68|0;i=e+64|0;j=e+60|0;k=e+56|0;n=e+52|0;o=e+48|0;p=e+44|0;q=e+40|0;r=e+36|0;s=e+32|0;t=e+28|0;u=e+24|0;v=e+20|0;w=e+16|0;x=e+12|0;y=e+8|0;z=e+4|0;A=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[j>>2]=0;c[k>>2]=0;c[n>>2]=0;c[o>>2]=0;c[p>>2]=0;c[q>>2]=0;c[r>>2]=0;c[s>>2]=0;c[t>>2]=0;c[u>>2]=0;c[v>>2]=0;c[w>>2]=0;c[c[f>>2]>>2]=0;do if(c[g>>2]|0){c[x>>2]=Tf(c[g>>2]|0,47178,0)|0;if(c[x>>2]|0?(c[i>>2]=Fj(c[x>>2]|0,w,0)|0,Rf(c[x>>2]|0),c[x>>2]=0,c[i>>2]|0):0)break;c[x>>2]=Tf(c[g>>2]|0,47218,5)|0;if(c[x>>2]|0?(c[w>>2]&512|0)==0:0){B=13;break}c[i>>2]=Xh(o,c[g>>2]|0,47259)|0;if((((((c[i>>2]|0)==0?(c[i>>2]=Xh(p,c[g>>2]|0,39371)|0,(c[i>>2]|0)==0):0)?(c[i>>2]=Xh(q,c[g>>2]|0,35612)|0,(c[i>>2]|0)==0):0)?(c[i>>2]=Yh(r,c[g>>2]|0,35614,0)|0,(c[i>>2]|0)==0):0)?(c[i>>2]=Xh(s,c[g>>2]|0,39375)|0,(c[i>>2]|0)==0):0)?(c[i>>2]=Xh(t,c[g>>2]|0,35616)|0,(c[i>>2]|0)==0):0)B=13}else{c[x>>2]=0;B=13}while(0);do if((B|0)==13){if((c[x>>2]|0)!=0|(c[h>>2]|0)!=0){if(c[x>>2]|0){c[y>>2]=_f(c[x>>2]|0,1)|0;Rf(c[x>>2]|0);if(!(c[y>>2]|0)){c[i>>2]=65;break}}else c[y>>2]=0;c[z>>2]=wf(1,44)|0;if(!(c[z>>2]|0)){c[i>>2]=Et()|0;vf(c[y>>2]|0);break}c[i>>2]=Qh(0,c[y>>2]|0?c[y>>2]|0:c[h>>2]|0,c[z>>2]|0,0)|0;vf(c[y>>2]|0);d=c[z>>2]|0;if(c[i>>2]|0){vf(d);break}c[k>>2]=c[d>>2];c[n>>2]=c[(c[z>>2]|0)+4>>2];if(!(c[o>>2]|0)){c[o>>2]=c[(c[z>>2]|0)+8>>2];c[(c[z>>2]|0)+8>>2]=0}if(!(c[p>>2]|0)){c[p>>2]=c[(c[z>>2]|0)+12>>2];c[(c[z>>2]|0)+12>>2]=0}if(!(c[q>>2]|0)){c[q>>2]=c[(c[z>>2]|0)+16>>2];c[(c[z>>2]|0)+16>>2]=0}if(!(c[r>>2]|0)){c[r>>2]=Cn(0,c[(c[z>>2]|0)+20>>2]|0,c[(c[z>>2]|0)+20+4>>2]|0,c[(c[z>>2]|0)+20+8>>2]|0)|0;c[(c[z>>2]|0)+20>>2]=0;c[(c[z>>2]|0)+20+4>>2]=0;c[(c[z>>2]|0)+20+8>>2]=0}if(!(c[s>>2]|0)){c[s>>2]=c[(c[z>>2]|0)+32>>2];c[(c[z>>2]|0)+32>>2]=0}if(!(c[t>>2]|0)){c[t>>2]=c[(c[z>>2]|0)+36>>2];c[(c[z>>2]|0)+36>>2]=0}si(c[z>>2]|0);vf(c[z>>2]|0)}c[i>>2]=Gn(j,c[k>>2]|0,c[n>>2]|0,c[w>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0)|0;if(!(c[i>>2]|0)){c[A>>2]=rh(c[j>>2]|0,1)|0;if(c[q>>2]|0){Dp(c[(c[A>>2]|0)+24>>2]|0);c[(c[A>>2]|0)+24>>2]=c[q>>2];c[q>>2]=0}if(c[r>>2]|0){c[(c[A>>2]|0)+28>>2]=c[r>>2];c[r>>2]=0}if(c[s>>2]|0){c[(c[A>>2]|0)+32>>2]=c[s>>2];c[s>>2]=0}if(c[t>>2]|0){c[(c[A>>2]|0)+36>>2]=c[t>>2];c[t>>2]=0}if(c[g>>2]|0){c[i>>2]=Yh(u,c[g>>2]|0,47216,c[A>>2]|0)|0;if(c[i>>2]|0)break;c[i>>2]=Xh(v,c[g>>2]|0,35618)|0;if(c[i>>2]|0)break}if(c[u>>2]|0){c[(c[A>>2]|0)+40>>2]=c[u>>2];c[u>>2]=0}if(c[v>>2]|0){c[(c[A>>2]|0)+44>>2]=c[v>>2];c[v>>2]=0}c[c[f>>2]>>2]=c[j>>2];c[j>>2]=0}}while(0);sh(c[j>>2]|0);Dp(c[o>>2]|0);Dp(c[p>>2]|0);Dp(c[q>>2]|0);zn(c[r>>2]|0);Dp(c[s>>2]|0);Dp(c[t>>2]|0);zn(c[u>>2]|0);Dp(c[v>>2]|0);l=e;return c[i>>2]|0}function Xh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;c[j>>2]=Tf(c[g>>2]|0,c[h>>2]|0,0)|0;if(!(c[j>>2]|0)){k=c[i>>2]|0;l=e;return k|0}h=$f(c[j>>2]|0,1,5)|0;c[c[f>>2]>>2]=h;Rf(c[j>>2]|0);if(c[c[f>>2]>>2]|0){k=c[i>>2]|0;l=e;return k|0}c[i>>2]=65;k=c[i>>2]|0;l=e;return k|0}function Yh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;f=l;l=l+64|0;if((l|0)>=(m|0))$(64);g=f+48|0;h=f+44|0;i=f+40|0;j=f+36|0;k=f+32|0;n=f+28|0;o=f+24|0;p=f+20|0;q=f+16|0;r=f+12|0;s=f+8|0;t=f+4|0;u=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[o>>2]=Tf(c[i>>2]|0,c[j>>2]|0,0)|0;if(c[o>>2]|0){c[q>>2]=$f(c[o>>2]|0,1,8)|0;Rf(c[o>>2]|0);if(!(c[q>>2]|0)){c[g>>2]=65;v=c[g>>2]|0;l=f;return v|0}c[p>>2]=xn(0)|0;if(c[k>>2]|0?(c[(c[k>>2]|0)+4>>2]|0)==1:0)c[n>>2]=hi(c[q>>2]|0,c[k>>2]|0,c[p>>2]|0,0,0)|0;else c[n>>2]=zi(c[p>>2]|0,c[q>>2]|0)|0;Dp(c[q>>2]|0);if(c[n>>2]|0){zn(c[p>>2]|0);c[p>>2]=0;c[g>>2]=c[n>>2];v=c[g>>2]|0;l=f;return v|0}}else{c[s>>2]=0;c[t>>2]=0;c[u>>2]=0;c[r>>2]=pf((hv(c[j>>2]|0)|0)+2+1|0)|0;if(!(c[r>>2]|0)){c[g>>2]=Et()|0;v=c[g>>2]|0;l=f;return v|0}tv(uv(c[r>>2]|0,c[j>>2]|0)|0,35620)|0;c[n>>2]=Xh(s,c[i>>2]|0,c[r>>2]|0)|0;q=c[r>>2]|0;if(c[n>>2]|0){vf(q);c[g>>2]=c[n>>2];v=c[g>>2]|0;l=f;return v|0}tv(uv(q,c[j>>2]|0)|0,35623)|0;c[n>>2]=Xh(t,c[i>>2]|0,c[r>>2]|0)|0;if(c[n>>2]|0){Dp(c[s>>2]|0);vf(c[r>>2]|0);c[g>>2]=c[n>>2];v=c[g>>2]|0;l=f;return v|0}tv(uv(c[r>>2]|0,c[j>>2]|0)|0,35626)|0;c[n>>2]=Xh(u,c[i>>2]|0,c[r>>2]|0)|0;if(c[n>>2]|0){Dp(c[t>>2]|0);Dp(c[s>>2]|0);vf(c[r>>2]|0);c[g>>2]=c[n>>2];v=c[g>>2]|0;l=f;return v|0}if(!(c[u>>2]|0))c[u>>2]=Op(0,1)|0;n=c[s>>2]|0;if((c[s>>2]|0)!=0&(c[t>>2]|0)!=0)c[p>>2]=Cn(0,n,c[t>>2]|0,c[u>>2]|0)|0;else{Dp(n);Dp(c[t>>2]|0);Dp(c[u>>2]|0);c[p>>2]=0}vf(c[r>>2]|0)}if(c[p>>2]|0)c[c[h>>2]>>2]=c[p>>2];c[g>>2]=0;v=c[g>>2]|0;l=f;return v|0}function Zh(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;b=l;l=l+144|0;if((l|0)>=(m|0))$(144);d=b+8|0;e=b;f=b+132|0;g=b+128|0;h=b+124|0;i=b+80|0;j=b+76|0;k=b+72|0;n=b+68|0;o=b+40|0;p=b+36|0;q=b+32|0;c[g>>2]=a;a=i;r=a+44|0;do{c[a>>2]=0;a=a+4|0}while((a|0)<(r|0));if(Qh(0,c[g>>2]|0,i,h)|0){c[f>>2]=0;s=c[f>>2]|0;l=b;return s|0}c[k>>2]=Rp(0)|0;c[n>>2]=Rp(0)|0;c[j>>2]=En(0,0,0,c[i+8>>2]|0,c[i+12>>2]|0,0)|0;if(tn(c[k>>2]|0,c[n>>2]|0,i+20|0,c[j>>2]|0)|0)We(35629,e);In(c[j>>2]|0);An(i+20|0);c[o>>2]=c[i+8>>2];c[o+4>>2]=c[i+12>>2];c[o+8>>2]=c[i+16>>2];c[o+12>>2]=xi(c[k>>2]|0,c[n>>2]|0,c[i+8>>2]|0)|0;c[o+16>>2]=c[i+32>>2];c[o+20>>2]=c[i+36>>2];c[o+24>>2]=0;Dp(c[k>>2]|0);Dp(c[n>>2]|0);n=c[o+4>>2]|0;k=c[o+8>>2]|0;i=c[o+12>>2]|0;j=c[o+16>>2]|0;e=c[o+20>>2]|0;c[d>>2]=c[o>>2];c[d+4>>2]=n;c[d+8>>2]=k;c[d+12>>2]=i;c[d+16>>2]=j;c[d+20>>2]=e;if(cg(p,0,35678,d)|0)c[p>>2]=0;c[q>>2]=0;while(1){if(!(c[o+(c[q>>2]<<2)>>2]|0))break;Tp(c[o+(c[q>>2]<<2)>>2]|0);c[q>>2]=(c[q>>2]|0)+1}c[f>>2]=c[p>>2];s=c[f>>2]|0;l=b;return s|0}function _h(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;n=f;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(!(a[c[h>>2]>>0]|0)){c[g>>2]=0;o=c[g>>2]|0;l=f;return o|0}if((Fu(c[h>>2]|0,47259)|0)==0?c[(c[i>>2]|0)+16>>2]|0:0){if(c[(c[i>>2]|0)+16>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[i>>2]|0)+16>>2]|0)+12>>2]&32|0)==0):0)p=c[(c[i>>2]|0)+16>>2]|0;else p=Ip(c[(c[i>>2]|0)+16>>2]|0)|0;c[g>>2]=p;o=c[g>>2]|0;l=f;return o|0}if((Fu(c[h>>2]|0,39371)|0)==0?c[(c[i>>2]|0)+20>>2]|0:0){if(c[(c[i>>2]|0)+20>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[i>>2]|0)+20>>2]|0)+12>>2]&32|0)==0):0)q=c[(c[i>>2]|0)+20>>2]|0;else q=Ip(c[(c[i>>2]|0)+20>>2]|0)|0;c[g>>2]=q;o=c[g>>2]|0;l=f;return o|0}if((Fu(c[h>>2]|0,35612)|0)==0?c[(c[i>>2]|0)+24>>2]|0:0){if(c[(c[i>>2]|0)+24>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[i>>2]|0)+24>>2]|0)+12>>2]&32|0)==0):0)r=c[(c[i>>2]|0)+24>>2]|0;else r=Ip(c[(c[i>>2]|0)+24>>2]|0)|0;c[g>>2]=r;o=c[g>>2]|0;l=f;return o|0}if((Fu(c[h>>2]|0,39375)|0)==0?c[(c[i>>2]|0)+32>>2]|0:0){if(c[(c[i>>2]|0)+32>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[i>>2]|0)+32>>2]|0)+12>>2]&32|0)==0):0)s=c[(c[i>>2]|0)+32>>2]|0;else s=Ip(c[(c[i>>2]|0)+32>>2]|0)|0;c[g>>2]=s;o=c[g>>2]|0;l=f;return o|0}if((Fu(c[h>>2]|0,35616)|0)==0?c[(c[i>>2]|0)+36>>2]|0:0){if(c[(c[i>>2]|0)+36>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[i>>2]|0)+36>>2]|0)+12>>2]&32|0)==0):0)t=c[(c[i>>2]|0)+36>>2]|0;else t=Ip(c[(c[i>>2]|0)+36>>2]|0)|0;c[g>>2]=t;o=c[g>>2]|0;l=f;return o|0}if((Fu(c[h>>2]|0,35618)|0)==0?c[(c[i>>2]|0)+44>>2]|0:0){if(c[(c[i>>2]|0)+44>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[i>>2]|0)+44>>2]|0)+12>>2]&32|0)==0):0)u=c[(c[i>>2]|0)+44>>2]|0;else u=Ip(c[(c[i>>2]|0)+44>>2]|0)|0;c[g>>2]=u;o=c[g>>2]|0;l=f;return o|0}if(((Fu(c[h>>2]|0,35726)|0)==0?c[(c[i>>2]|0)+28>>2]|0:0)?c[c[(c[i>>2]|0)+28>>2]>>2]|0:0){if(c[c[(c[i>>2]|0)+28>>2]>>2]|0?!(c[j>>2]|0?1:(c[(c[c[(c[i>>2]|0)+28>>2]>>2]|0)+12>>2]&32|0)==0):0)v=c[c[(c[i>>2]|0)+28>>2]>>2]|0;else v=Ip(c[c[(c[i>>2]|0)+28>>2]>>2]|0)|0;c[g>>2]=v;o=c[g>>2]|0;l=f;return o|0}if(((Fu(c[h>>2]|0,35730)|0)==0?c[(c[i>>2]|0)+28>>2]|0:0)?c[(c[(c[i>>2]|0)+28>>2]|0)+4>>2]|0:0){if(c[(c[(c[i>>2]|0)+28>>2]|0)+4>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[(c[i>>2]|0)+28>>2]|0)+4>>2]|0)+12>>2]&32|0)==0):0)w=c[(c[(c[i>>2]|0)+28>>2]|0)+4>>2]|0;else w=Ip(c[(c[(c[i>>2]|0)+28>>2]|0)+4>>2]|0)|0;c[g>>2]=w;o=c[g>>2]|0;l=f;return o|0}if(((Fu(c[h>>2]|0,35734)|0)==0?c[(c[i>>2]|0)+40>>2]|0:0)?c[c[(c[i>>2]|0)+40>>2]>>2]|0:0){if(c[c[(c[i>>2]|0)+40>>2]>>2]|0?!(c[j>>2]|0?1:(c[(c[c[(c[i>>2]|0)+40>>2]>>2]|0)+12>>2]&32|0)==0):0)x=c[c[(c[i>>2]|0)+40>>2]>>2]|0;else x=Ip(c[c[(c[i>>2]|0)+40>>2]>>2]|0)|0;c[g>>2]=x;o=c[g>>2]|0;l=f;return o|0}if(((Fu(c[h>>2]|0,35738)|0)==0?c[(c[i>>2]|0)+40>>2]|0:0)?c[(c[(c[i>>2]|0)+40>>2]|0)+4>>2]|0:0){if(c[(c[(c[i>>2]|0)+28>>2]|0)+4>>2]|0?!(c[j>>2]|0?1:(c[(c[(c[(c[i>>2]|0)+28>>2]|0)+4>>2]|0)+12>>2]&32|0)==0):0)y=c[(c[(c[i>>2]|0)+40>>2]|0)+4>>2]|0;else y=Ip(c[(c[(c[i>>2]|0)+40>>2]|0)+4>>2]|0)|0;c[g>>2]=y;o=c[g>>2]|0;l=f;return o|0}if((Fu(c[h>>2]|0,35614)|0)==0?c[(c[i>>2]|0)+28>>2]|0:0){c[g>>2]=yi(c[(c[i>>2]|0)+28>>2]|0,c[i>>2]|0)|0;o=c[g>>2]|0;l=f;return o|0}do if((a[c[h>>2]>>0]|0)==113){if(a[(c[h>>2]|0)+1>>0]|0?(a[(c[h>>2]|0)+1>>0]|0)!=64:0)break;if(!(c[(c[i>>2]|0)+40>>2]|0)){y=Ai(0,c[i>>2]|0,0,0)|0;c[(c[i>>2]|0)+40>>2]=y}if(!(c[(c[i>>2]|0)+40>>2]|0)){c[g>>2]=0;o=c[g>>2]|0;l=f;return o|0}if((a[(c[h>>2]|0)+1>>0]|0)!=64){c[g>>2]=yi(c[(c[i>>2]|0)+40>>2]|0,c[i>>2]|0)|0;o=c[g>>2]|0;l=f;return o|0}if((Fu((c[h>>2]|0)+2|0,49924)|0)==0?(c[c[i>>2]>>2]|0)==2:0){if(ci(c[(c[i>>2]|0)+40>>2]|0,c[i>>2]|0,0,0,0,k,n)|0)break;c[g>>2]=Ep(0,c[k>>2]|0,c[n>>2]<<3)|0;o=c[g>>2]|0;l=f;return o|0}}while(0);c[g>>2]=0;o=c[g>>2]|0;l=f;return o|0}function $h(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;if((Fu(c[f>>2]|0,35614)|0)==0?c[(c[g>>2]|0)+28>>2]|0:0){c[e>>2]=ai(c[(c[g>>2]|0)+28>>2]|0)|0;h=c[e>>2]|0;l=d;return h|0}if(!(Fu(c[f>>2]|0,47216)|0)){if(!(c[(c[g>>2]|0)+40>>2]|0)){f=Ai(0,c[g>>2]|0,0,0)|0;c[(c[g>>2]|0)+40>>2]=f}if(c[(c[g>>2]|0)+40>>2]|0){c[e>>2]=ai(c[(c[g>>2]|0)+40>>2]|0)|0;h=c[e>>2]|0;l=d;return h|0}}c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}function ai(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;if(c[d>>2]|0){c[e>>2]=xn(0)|0;bi(c[e>>2]|0,c[d>>2]|0);f=c[e>>2]|0;l=b;return f|0}else{c[e>>2]=0;f=c[e>>2]|0;l=b;return f|0}return 0}function bi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;Kp(c[c[e>>2]>>2]|0,c[c[f>>2]>>2]|0)|0;Kp(c[(c[e>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0)|0;Kp(c[(c[e>>2]|0)+8>>2]|0,c[(c[f>>2]|0)+8>>2]|0)|0;l=d;return}function ci(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);j=i+40|0;k=i+36|0;n=i+32|0;o=i+28|0;p=i+24|0;q=i+20|0;r=i+16|0;s=i+12|0;t=i+8|0;u=i+4|0;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;if(c[n>>2]|0)v=c[n>>2]|0;else v=Rp(0)|0;c[t>>2]=v;if(c[o>>2]|0)w=c[o>>2]|0;else w=Rp(0)|0;c[u>>2]=w;if(tn(c[t>>2]|0,c[u>>2]|0,c[j>>2]|0,c[k>>2]|0)|0){Ve(35742,i);c[s>>2]=63}else c[s>>2]=di(c[t>>2]|0,c[u>>2]|0,((c[(c[k>>2]|0)+12>>2]|0)>>>0)/8|0,c[p>>2]|0,c[q>>2]|0,c[r>>2]|0)|0;if(!(c[n>>2]|0))Dp(c[t>>2]|0);if(c[o>>2]|0){x=c[s>>2]|0;l=i;return x|0}Dp(c[u>>2]|0);x=c[s>>2]|0;l=i;return x|0}function di(b,e,f,g,h,i){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;j=l;l=l+48|0;if((l|0)>=(m|0))$(48);k=j+36|0;n=j+32|0;o=j+28|0;p=j+24|0;q=j+20|0;r=j+16|0;s=j+12|0;t=j+8|0;u=j+4|0;v=j;c[n>>2]=b;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;c[v>>2]=c[q>>2]|0?1:0;c[t>>2]=Xo(c[o>>2]|0,c[p>>2]|0,c[v>>2]|0?-1:0,u,0)|0;if(!(c[t>>2]|0)){c[k>>2]=Et()|0;w=c[k>>2]|0;l=j;return w|0}p=(mo(c[n>>2]|0,0)|0)!=0;if(p&(c[u>>2]|0)!=0){p=(c[t>>2]|0)+((c[v>>2]|0)+(c[u>>2]|0)-1)|0;a[p>>0]=d[p>>0]|0|128}if(c[v>>2]|0)a[c[t>>2]>>0]=64;c[c[r>>2]>>2]=c[t>>2];c[c[s>>2]>>2]=(c[u>>2]|0)+(c[v>>2]|0);c[k>>2]=0;w=c[k>>2]|0;l=j;return w|0}function ei(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+36|0;g=e+32|0;h=e+28|0;i=e+24|0;j=e+20|0;k=e+16|0;n=e+12|0;o=e+8|0;p=e+4|0;q=e;c[g>>2]=a;c[h>>2]=b;if(c[g>>2]|0?c[(c[g>>2]|0)+12>>2]&4|0:0){c[j>>2]=Gp(c[g>>2]|0,k)|0;if(!(c[j>>2]|0)){c[f>>2]=65;r=c[f>>2]|0;l=e;return r|0}c[k>>2]=(((c[k>>2]|0)+7|0)>>>0)/8|0;do if((c[k>>2]|0)>>>0>1?((c[k>>2]|0)>>>0)%2|0|0:0){b=c[j>>2]|0;if((d[c[j>>2]>>0]|0|0)!=4){if((d[b>>0]|0|0)!=64)break;if(Fp(c[g>>2]|0,(c[j>>2]|0)+1|0,(c[k>>2]|0)-1<<3)|0)break;c[f>>2]=Et()|0;r=c[f>>2]|0;l=e;return r|0}c[i>>2]=Zo(n,1,b+1|0,(((c[k>>2]|0)-1|0)>>>0)/2|0,0)|0;if(c[i>>2]|0){c[f>>2]=c[i>>2];r=c[f>>2]|0;l=e;return r|0}c[i>>2]=Zo(o,1,(c[j>>2]|0)+1+((((c[k>>2]|0)-1|0)>>>0)/2|0)|0,(((c[k>>2]|0)-1|0)>>>0)/2|0,0)|0;b=c[n>>2]|0;if(c[i>>2]|0){Dp(b);c[f>>2]=c[i>>2];r=c[f>>2]|0;l=e;return r|0}c[i>>2]=di(b,c[o>>2]|0,((c[h>>2]|0)>>>0)/8|0,0,p,q)|0;Dp(c[n>>2]|0);Dp(c[o>>2]|0);if(!(c[i>>2]|0)){Ep(c[g>>2]|0,c[p>>2]|0,c[q>>2]<<3)|0;break}c[f>>2]=c[i>>2];r=c[f>>2]|0;l=e;return r|0}while(0);c[f>>2]=0;r=c[f>>2]|0;l=e;return r|0}c[f>>2]=65;r=c[f>>2]|0;l=e;return r|0}function fi(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+36|0;h=f+32|0;i=f+28|0;j=f+24|0;k=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;r=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=0;if((c[(c[k>>2]|0)+4>>2]|0)!=1){c[g>>2]=69;s=c[g>>2]|0;l=f;return s|0}if(!(c[17732]|0))c[17732]=gi(35795)|0;if(!(c[17733]|0))c[17733]=Op(0,7)|0;c[o>>2]=Rp(0)|0;c[p>>2]=Rp(0)|0;c[q>>2]=Rp(0)|0;c[r>>2]=Rp(0)|0;Ro(c[o>>2]|0,c[i>>2]|0,c[i>>2]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[p>>2]|0,c[(c[k>>2]|0)+24>>2]|0,c[o>>2]|0,c[(c[k>>2]|0)+16>>2]|0);go(c[o>>2]|0,c[o>>2]|0,1);eo(c[p>>2]|0,c[p>>2]|0,1);i=c[q>>2]|0;e=c[p>>2]|0;d=Wp(3)|0;So(i,e,d,c[(c[k>>2]|0)+16>>2]|0);So(c[r>>2]|0,c[p>>2]|0,c[17733]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[r>>2]|0,c[r>>2]|0,c[o>>2]|0,c[(c[k>>2]|0)+16>>2]|0);So(c[r>>2]|0,c[r>>2]|0,c[17732]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[r>>2]|0,c[r>>2]|0,c[o>>2]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[h>>2]|0,c[r>>2]|0,c[q>>2]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[r>>2]|0,c[h>>2]|0,c[h>>2]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[r>>2]|0,c[r>>2]|0,c[p>>2]|0,c[(c[k>>2]|0)+16>>2]|0);Jp(c[r>>2]|0,c[r>>2]|0);if(!(wo(c[r>>2]|0,c[o>>2]|0)|0)){if(!(c[17734]|0))c[17734]=gi(35860)|0;Ro(c[h>>2]|0,c[h>>2]|0,c[17734]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[r>>2]|0,c[h>>2]|0,c[h>>2]|0,c[(c[k>>2]|0)+16>>2]|0);Ro(c[r>>2]|0,c[r>>2]|0,c[p>>2]|0,c[(c[k>>2]|0)+16>>2]|0);Jp(c[r>>2]|0,c[r>>2]|0);if(!(wo(c[r>>2]|0,c[o>>2]|0)|0))c[n>>2]=65}d=mo(c[h>>2]|0,0)|0;if((d|0)!=(((c[j>>2]|0)!=0^1^1)&1|0))ho(c[h>>2]|0,c[(c[k>>2]|0)+16>>2]|0,c[h>>2]|0);Dp(c[r>>2]|0);Dp(c[q>>2]|0);Dp(c[p>>2]|0);Dp(c[o>>2]|0);c[g>>2]=c[n>>2];s=c[g>>2]|0;l=f;return s|0}function gi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;e=b+12|0;f=b+8|0;g=b+4|0;c[e>>2]=a;c[f>>2]=Zo(g,4,c[e>>2]|0,0,0)|0;if(c[f>>2]|0){c[d>>2]=Bt(c[f>>2]|0)|0;We(35925,d)}else{l=b;return c[g>>2]|0}return 0}function hi(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);j=i+48|0;k=i+44|0;n=i+40|0;o=i+36|0;p=i+32|0;q=i+28|0;r=i+24|0;s=i+20|0;t=i+16|0;u=i+12|0;v=i+8|0;w=i+4|0;x=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;do if(c[k>>2]|0?c[(c[k>>2]|0)+12>>2]&4|0:0){c[v>>2]=Gp(c[k>>2]|0,t)|0;if(!(c[v>>2]|0)){c[j>>2]=65;y=c[j>>2]|0;l=i;return y|0}c[t>>2]=(((c[t>>2]|0)+7|0)>>>0)/8|0;do if((c[t>>2]|0)>>>0>1?((c[t>>2]|0)>>>0)%2|0|0:0){h=c[v>>2]|0;if((d[c[v>>2]>>0]|0|0)!=4){if((d[h>>0]|0|0)!=64)break;c[t>>2]=(c[t>>2]|0)+-1;c[v>>2]=(c[v>>2]|0)+1;break}c[r>>2]=Zo(w,1,h+1|0,(((c[t>>2]|0)-1|0)>>>0)/2|0,0)|0;if(c[r>>2]|0){c[j>>2]=c[r>>2];y=c[j>>2]|0;l=i;return y|0}c[r>>2]=Zo(x,1,(c[v>>2]|0)+1+((((c[t>>2]|0)-1|0)>>>0)/2|0)|0,(((c[t>>2]|0)-1|0)>>>0)/2|0,0)|0;if(c[r>>2]|0){Dp(c[w>>2]|0);c[j>>2]=c[r>>2];y=c[j>>2]|0;l=i;return y|0}if(c[p>>2]|0?(c[r>>2]=di(c[w>>2]|0,c[x>>2]|0,((c[(c[n>>2]|0)+12>>2]|0)>>>0)/8|0,0,c[p>>2]|0,c[q>>2]|0)|0,c[r>>2]|0):0){Dp(c[w>>2]|0);Dp(c[x>>2]|0);c[j>>2]=c[r>>2];y=c[j>>2]|0;l=i;return y|0}Mp(c[c[o>>2]>>2]|0,c[w>>2]|0);Mp(c[(c[o>>2]|0)+4>>2]|0,c[x>>2]|0);Op(c[(c[o>>2]|0)+8>>2]|0,1)|0;c[j>>2]=0;y=c[j>>2]|0;l=i;return y|0}while(0);c[s>>2]=pf(c[t>>2]|0?c[t>>2]|0:1)|0;if(c[s>>2]|0){_w(c[s>>2]|0,c[v>>2]|0,c[t>>2]|0)|0;ii(c[s>>2]|0,c[t>>2]|0);break}c[j>>2]=Et()|0;y=c[j>>2]|0;l=i;return y|0}else z=21;while(0);if((z|0)==21?(c[s>>2]=Vo(c[k>>2]|0,((c[(c[n>>2]|0)+12>>2]|0)>>>0)/8|0,t,0)|0,(c[s>>2]|0)==0):0){c[j>>2]=Et()|0;y=c[j>>2]|0;l=i;return y|0}if(c[t>>2]|0){c[u>>2]=(((d[c[s>>2]>>0]|0)&128|0)!=0^1^1)&1;k=c[s>>2]|0;a[k>>0]=(d[k>>0]|0)&127}else c[u>>2]=0;Yo(c[(c[o>>2]|0)+4>>2]|0,c[s>>2]|0,c[t>>2]|0,0);if(c[p>>2]|0){if((c[u>>2]|0)!=0&(c[t>>2]|0)!=0){k=c[s>>2]|0;a[k>>0]=d[k>>0]|0|128}ii(c[s>>2]|0,c[t>>2]|0);c[c[p>>2]>>2]=c[s>>2];if(c[q>>2]|0)c[c[q>>2]>>2]=c[t>>2]}else vf(c[s>>2]|0);c[r>>2]=fi(c[c[o>>2]>>2]|0,c[(c[o>>2]|0)+4>>2]|0,c[u>>2]|0,c[n>>2]|0)|0;Op(c[(c[o>>2]|0)+8>>2]|0,1)|0;c[j>>2]=c[r>>2];y=c[j>>2]|0;l=i;return y|0}function ii(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=b;c[h>>2]=e;c[j>>2]=0;while(1){if((c[j>>2]|0)>>>0>=(((c[h>>2]|0)>>>0)/2|0)>>>0)break;c[i>>2]=d[(c[g>>2]|0)+(c[j>>2]|0)>>0];a[(c[g>>2]|0)+(c[j>>2]|0)>>0]=a[(c[g>>2]|0)+((c[h>>2]|0)-1-(c[j>>2]|0))>>0]|0;a[(c[g>>2]|0)+((c[h>>2]|0)-1-(c[j>>2]|0))>>0]=c[i>>2];c[j>>2]=(c[j>>2]|0)+1}l=f;return}function ji(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;g=l;l=l+80|0;if((l|0)>=(m|0))$(80);h=g+68|0;i=g+64|0;j=g+60|0;k=g+56|0;n=g+52|0;o=g+48|0;p=g+44|0;q=g+40|0;r=g+8|0;s=g+4|0;t=g;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[o>>2]=0;c[c[i>>2]>>2]=0;c[s>>2]=10;if((c[s>>2]|0)!=10){c[h>>2]=5;u=c[h>>2]|0;l=g;return u|0}c[t>>2]=(((c[(c[k>>2]|0)+12>>2]|0)+7|0)>>>0)/8|0;if((c[t>>2]|0)!=32){c[h>>2]=63;u=c[h>>2]|0;l=g;return u|0}c[q>>2]=xf(2,c[t>>2]|0)|0;if(!(c[q>>2]|0)){c[h>>2]=Et()|0;u=c[h>>2]|0;l=g;return u|0};c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;c[r+12>>2]=0;c[r+16>>2]=0;c[r+20>>2]=0;c[r+24>>2]=0;c[r+28>>2]=0;c[o>>2]=Vo(c[j>>2]|0,0,p,0)|0;j=c[q>>2]|0;if(!(c[o>>2]|0)){vf(j);c[h>>2]=Et()|0;u=c[h>>2]|0;l=g;return u|0}c[r+12>>2]=j;c[r+4>>2]=0;if((c[t>>2]|0)>>>0>(c[p>>2]|0)>>>0)v=(c[t>>2]|0)-(c[p>>2]|0)|0;else v=0;c[r+8>>2]=v;c[r+16+12>>2]=c[o>>2];c[r+16+4>>2]=0;c[r+16+8>>2]=c[p>>2];c[n>>2]=mj(c[s>>2]|0,0,c[q>>2]|0,r,2)|0;vf(c[o>>2]|0);o=c[q>>2]|0;if(c[n>>2]|0){vf(o);c[h>>2]=c[n>>2];u=c[h>>2]|0;l=g;return u|0}else{ii(o,32);a[c[q>>2]>>0]=(d[c[q>>2]>>0]|0)&127|64;o=(c[q>>2]|0)+31|0;a[o>>0]=(d[o>>0]|0)&248;c[c[i>>2]>>2]=c[q>>2];c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}return 0}function ki(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;h=l;l=l+96|0;if((l|0)>=(m|0))$(96);i=h+80|0;j=h+76|0;k=h+72|0;n=h+68|0;o=h+64|0;p=h+60|0;q=h+56|0;r=h+52|0;s=h+48|0;t=h+36|0;u=h+32|0;v=h+28|0;w=h+24|0;x=h+8|0;y=h;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[p>>2]=32;c[y>>2]=0;yn(t);c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;c[x+12>>2]=0;if(c[n>>2]&32|0)c[u>>2]=1;else c[u>>2]=2;c[q>>2]=Sp(0)|0;c[r>>2]=Rp(0)|0;c[s>>2]=Rp(0)|0;c[y>>2]=sf(c[p>>2]<<1)|0;if(!(c[y>>2]|0)){c[o>>2]=li()|0;An(t);z=c[q>>2]|0;Tp(z);A=c[r>>2]|0;Tp(A);B=c[s>>2]|0;Tp(B);C=c[y>>2]|0;vf(C);D=c[o>>2]|0;l=h;return D|0}c[w>>2]=c[p>>2];c[v>>2]=hn(c[w>>2]|0,c[u>>2]|0)|0;c[x+12>>2]=c[v>>2];c[x+8>>2]=c[w>>2];c[o>>2]=mj(10,0,c[y>>2]|0,x,1)|0;if(c[o>>2]|0){An(t);z=c[q>>2]|0;Tp(z);A=c[r>>2]|0;Tp(A);B=c[s>>2]|0;Tp(B);C=c[y>>2]|0;vf(C);D=c[o>>2]|0;l=h;return D|0}x=Ep(0,c[v>>2]|0,c[w>>2]<<3)|0;c[(c[i>>2]|0)+56>>2]=x;c[v>>2]=0;ii(c[y>>2]|0,32);a[c[y>>2]>>0]=(d[c[y>>2]>>0]|0)&127|64;v=(c[y>>2]|0)+31|0;a[v>>0]=(d[v>>0]|0)&248;Yo(c[q>>2]|0,c[y>>2]|0,32,0);vf(c[y>>2]|0);c[y>>2]=0;$n(t,c[q>>2]|0,(c[j>>2]|0)+20|0,c[k>>2]|0);if(Ff(1)|0)sn(35960,t,c[k>>2]|0);c[c[i>>2]>>2]=c[c[j>>2]>>2];c[(c[i>>2]|0)+4>>2]=c[(c[j>>2]|0)+4>>2];k=Ip(c[(c[j>>2]|0)+8>>2]|0)|0;c[(c[i>>2]|0)+8>>2]=k;k=Ip(c[(c[j>>2]|0)+12>>2]|0)|0;c[(c[i>>2]|0)+12>>2]=k;k=Ip(c[(c[j>>2]|0)+16>>2]|0)|0;c[(c[i>>2]|0)+16>>2]=k;yn((c[i>>2]|0)+20|0);mi((c[i>>2]|0)+20|0,(c[j>>2]|0)+20|0);k=Ip(c[(c[j>>2]|0)+32>>2]|0)|0;c[(c[i>>2]|0)+32>>2]=k;k=Ip(c[(c[j>>2]|0)+36>>2]|0)|0;c[(c[i>>2]|0)+36>>2]=k;yn((c[i>>2]|0)+44|0);mi((c[i>>2]|0)+44|0,t);An(t);z=c[q>>2]|0;Tp(z);A=c[r>>2]|0;Tp(A);B=c[s>>2]|0;Tp(B);C=c[y>>2]|0;vf(C);D=c[o>>2]|0;l=h;return D|0}function li(){return ni(Et()|0)|0}function mi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;Kp(c[c[e>>2]>>2]|0,c[c[f>>2]>>2]|0)|0;Kp(c[(c[e>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0)|0;Kp(c[(c[e>>2]|0)+8>>2]|0,c[(c[f>>2]|0)+8>>2]|0)|0;l=d;return}function ni(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=oi(1,c[d>>2]|0)|0;l=b;return a|0}function oi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function pi(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;h=l;l=l+160|0;if((l|0)>=(m|0))$(160);i=h+156|0;j=h+152|0;k=h+148|0;n=h+144|0;o=h+140|0;p=h+136|0;q=h+132|0;r=h+128|0;s=h+124|0;t=h+120|0;u=h+116|0;v=h+112|0;w=h+64|0;x=h+60|0;y=h+56|0;z=h+52|0;A=h+48|0;B=h+44|0;C=h+40|0;D=h+28|0;E=h+16|0;F=h+12|0;G=h+8|0;H=h+4|0;I=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[s>>2]=0;c[z>>2]=0;c[B>>2]=0;g=w;f=g+48|0;do{c[g>>2]=0;g=g+4|0}while((g|0)<(f|0));if(c[j>>2]|0?c[(c[j>>2]|0)+12>>2]&4|0:0){yn(D);yn(E);c[F>>2]=Sp(0)|0;c[G>>2]=Rp(0)|0;c[H>>2]=Rp(0)|0;c[I>>2]=Rp(0)|0;c[s>>2]=En(c[c[k>>2]>>2]|0,c[(c[k>>2]|0)+4>>2]|0,0,c[(c[k>>2]|0)+8>>2]|0,c[(c[k>>2]|0)+12>>2]|0,c[(c[k>>2]|0)+16>>2]|0)|0;c[t>>2]=(((c[(c[s>>2]|0)+12>>2]|0)+7|0)>>>0)/8|0;if((c[t>>2]|0)!=32){c[i>>2]=63;J=c[i>>2]|0;l=h;return J|0}c[r>>2]=ji(v,c[(c[k>>2]|0)+56>>2]|0,c[s>>2]|0)|0;do if(!(c[r>>2]|0)){Yo(c[F>>2]|0,c[v>>2]|0,32,0);if(c[q>>2]|0){c[r>>2]=hi(c[q>>2]|0,c[s>>2]|0,E,B,C)|0;if(c[r>>2]|0)break;if(Ff(1)|0)_e(35974,c[B>>2]|0,c[C>>2]|0);if(!(bo(E,c[s>>2]|0)|0)){c[r>>2]=195;break}}else{$n(E,c[F>>2]|0,(c[k>>2]|0)+20|0,c[s>>2]|0);c[r>>2]=ci(E,c[s>>2]|0,c[G>>2]|0,c[H>>2]|0,0,B,C)|0;if(c[r>>2]|0)break;if(Ff(1)|0)_e(35981,c[B>>2]|0,c[C>>2]|0)}c[x>>2]=Gp(c[j>>2]|0,u)|0;c[y>>2]=(((c[u>>2]|0)+7|0)>>>0)/8|0;if(Ff(1)|0)_e(35988,c[x>>2]|0,c[y>>2]|0);c[w+12>>2]=c[v>>2];c[w+4>>2]=32;c[w+8>>2]=32;c[w+16+12>>2]=c[x>>2];c[w+16+8>>2]=c[y>>2];c[r>>2]=mj(c[p>>2]|0,0,c[v>>2]|0,w,2)|0;if(!(c[r>>2]|0)){ii(c[v>>2]|0,64);if(Ff(1)|0)_e(53410,c[v>>2]|0,64);Yo(c[I>>2]|0,c[v>>2]|0,64,0);$n(D,c[I>>2]|0,(c[k>>2]|0)+20|0,c[s>>2]|0);if(Ff(1)|0)sn(35995,D,c[s>>2]|0);c[r>>2]=ci(D,c[s>>2]|0,c[G>>2]|0,c[H>>2]|0,0,z,A)|0;if(!(c[r>>2]|0)){if(Ff(1)|0)_e(36e3,c[z>>2]|0,c[A>>2]|0);c[w+12>>2]=c[z>>2];c[w+4>>2]=0;c[w+8>>2]=c[A>>2];c[w+16+12>>2]=c[B>>2];c[w+16+4>>2]=0;c[w+16+8>>2]=c[C>>2];c[w+32+12>>2]=c[x>>2];c[w+32+4>>2]=0;c[w+32+8>>2]=c[y>>2];c[r>>2]=mj(c[p>>2]|0,0,c[v>>2]|0,w,3)|0;if(!(c[r>>2]|0)){Ep(c[n>>2]|0,c[z>>2]|0,c[A>>2]<<3)|0;c[z>>2]=0;ii(c[v>>2]|0,64);if(Ff(1)|0)_e(36007,c[v>>2]|0,64);Yo(c[o>>2]|0,c[v>>2]|0,64,0);Ro(c[o>>2]|0,c[o>>2]|0,c[F>>2]|0,c[(c[k>>2]|0)+32>>2]|0);io(c[o>>2]|0,c[o>>2]|0,c[I>>2]|0,c[(c[k>>2]|0)+32>>2]|0);c[r>>2]=qi(c[o>>2]|0,c[t>>2]|0,z,A)|0;if(!(c[r>>2]|0)){if(Ff(1)|0)_e(36014,c[z>>2]|0,c[A>>2]|0);Ep(c[o>>2]|0,c[z>>2]|0,c[A>>2]<<3)|0;c[z>>2]=0;c[r>>2]=0}}}}}while(0);Tp(c[F>>2]|0);Tp(c[G>>2]|0);Tp(c[H>>2]|0);Tp(c[I>>2]|0);vf(c[v>>2]|0);In(c[s>>2]|0);An(D);An(E);vf(c[B>>2]|0);vf(c[z>>2]|0);c[i>>2]=c[r>>2];J=c[i>>2]|0;l=h;return J|0}c[i>>2]=79;J=c[i>>2]|0;l=h;return J|0}function qi(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+24|0;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;n=f+4|0;o=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=Vo(c[h>>2]|0,c[i>>2]|0,o,0)|0;if(c[n>>2]|0){c[c[j>>2]>>2]=c[n>>2];c[c[k>>2]>>2]=c[o>>2];c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}else{c[g>>2]=Et()|0;p=c[g>>2]|0;l=f;return p|0}return 0}function ri(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;h=l;l=l+240|0;if((l|0)>=(m|0))$(240);i=h+172|0;j=h+168|0;k=h+164|0;n=h+160|0;o=h+156|0;p=h+152|0;q=h+148|0;r=h+144|0;s=h+140|0;t=h+136|0;u=h+132|0;v=h+120|0;w=h+116|0;x=h+112|0;y=h+108|0;z=h+104|0;A=h+100|0;B=h+96|0;C=h+92|0;D=h+88|0;E=h+176|0;F=h+40|0;G=h+36|0;H=h+32|0;I=h+20|0;J=h+8|0;K=h+4|0;L=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[s>>2]=0;c[w>>2]=0;c[A>>2]=0;if(((c[j>>2]|0?(c[n>>2]|0?(c[(c[j>>2]|0)+12>>2]&4|0)!=0:0):0)?(c[o>>2]|0?(c[(c[n>>2]|0)+12>>2]&4|0)!=0:0):0)?c[(c[o>>2]|0)+12>>2]&4|0:0){if((c[p>>2]|0)!=10){c[i>>2]=5;M=c[i>>2]|0;l=h;return M|0}yn(v);yn(I);yn(J);c[G>>2]=Rp(0)|0;c[H>>2]=Rp(0)|0;c[s>>2]=En(c[c[k>>2]>>2]|0,c[(c[k>>2]|0)+4>>2]|0,0,c[(c[k>>2]|0)+8>>2]|0,c[(c[k>>2]|0)+12>>2]|0,c[(c[k>>2]|0)+16>>2]|0)|0;c[t>>2]=((c[(c[s>>2]|0)+12>>2]|0)>>>0)/8|0;if((c[t>>2]|0)!=32){c[i>>2]=63;M=c[i>>2]|0;l=h;return M|0}c[r>>2]=hi(c[q>>2]|0,c[s>>2]|0,v,w,x)|0;a:do if(!(c[r>>2]|0)){if(!(bo(v,c[s>>2]|0)|0)){c[r>>2]=195;break}if(Ff(1)|0)_e(35981,c[w>>2]|0,c[x>>2]|0);if((c[x>>2]|0)!=(c[t>>2]|0)){c[r>>2]=139;break}c[y>>2]=Gp(c[j>>2]|0,u)|0;c[B>>2]=(((c[u>>2]|0)+7|0)>>>0)/8|0;if(Ff(1)|0)_e(35988,c[y>>2]|0,c[B>>2]|0);c[z>>2]=Gp(c[n>>2]|0,u)|0;c[C>>2]=(((c[u>>2]|0)+7|0)>>>0)/8|0;if(Ff(1)|0)_e(53410,c[z>>2]|0,c[C>>2]|0);if((c[C>>2]|0)!=(c[t>>2]|0)){c[r>>2]=139;break}c[F+12>>2]=c[z>>2];c[F+4>>2]=0;c[F+8>>2]=c[C>>2];c[F+16+12>>2]=c[w>>2];c[F+16+4>>2]=0;c[F+16+8>>2]=c[x>>2];c[F+32+12>>2]=c[y>>2];c[F+32+4>>2]=0;c[F+32+8>>2]=c[B>>2];c[r>>2]=mj(c[p>>2]|0,0,E,F,3)|0;if(!(c[r>>2]|0)){ii(E,64);if(Ff(1)|0)_e(36007,E,64);Yo(c[G>>2]|0,E,64,0);c[K>>2]=Hp(c[o>>2]|0,u)|0;c[L>>2]=(((c[u>>2]|0)+7|0)>>>0)/8|0;ii(c[K>>2]|0,c[L>>2]|0);if(Ff(1)|0)_e(53417,c[K>>2]|0,c[L>>2]|0);Yo(c[H>>2]|0,c[K>>2]|0,c[L>>2]|0,0);vf(c[K>>2]|0);if((c[L>>2]|0)!=(c[t>>2]|0)){c[r>>2]=139;break}$n(I,c[H>>2]|0,(c[k>>2]|0)+20|0,c[s>>2]|0);$n(J,c[G>>2]|0,v,c[s>>2]|0);Jp(c[J>>2]|0,c[J>>2]|0);Vn(I,I,J,c[s>>2]|0);c[r>>2]=ci(I,c[s>>2]|0,c[H>>2]|0,c[G>>2]|0,0,A,D)|0;if(!(c[r>>2]|0)){do if((c[D>>2]|0)==(c[C>>2]|0)){if(Jv(c[A>>2]|0,c[z>>2]|0,c[D>>2]|0)|0)break;c[r>>2]=0;break a}while(0);c[r>>2]=8}}}while(0);vf(c[w>>2]|0);vf(c[A>>2]|0);In(c[s>>2]|0);Tp(c[H>>2]|0);Tp(c[G>>2]|0);An(I);An(J);An(v);c[i>>2]=c[r>>2];M=c[i>>2]|0;l=h;return M|0}c[i>>2]=79;M=c[i>>2]|0;l=h;return M|0}function si(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Dp(c[(c[d>>2]|0)+8>>2]|0);c[(c[d>>2]|0)+8>>2]=0;Dp(c[(c[d>>2]|0)+12>>2]|0);c[(c[d>>2]|0)+12>>2]=0;Dp(c[(c[d>>2]|0)+16>>2]|0);c[(c[d>>2]|0)+16>>2]=0;An((c[d>>2]|0)+20|0);Dp(c[(c[d>>2]|0)+32>>2]|0);c[(c[d>>2]|0)+32>>2]=0;Dp(c[(c[d>>2]|0)+36>>2]|0);c[(c[d>>2]|0)+36>>2]=0;l=b;return}function ti(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d;c[e>>2]=c[b>>2];c[e+4>>2]=c[b+4>>2];c[e+40>>2]=c[b+40>>2];c[e+8>>2]=Ip(c[b+8>>2]|0)|0;c[e+12>>2]=Ip(c[b+12>>2]|0)|0;c[e+16>>2]=Ip(c[b+16>>2]|0)|0;yn(e+20|0);ui(e+20|0,b+20|0);c[e+32>>2]=Ip(c[b+32>>2]|0)|0;c[e+36>>2]=Ip(c[b+36>>2]|0)|0;b=a;a=e;e=b+44|0;do{c[b>>2]=c[a>>2];b=b+4|0;a=a+4|0}while((b|0)<(e|0));l=d;return}function ui(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;Kp(c[c[e>>2]>>2]|0,c[c[f>>2]>>2]|0)|0;Kp(c[(c[e>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0)|0;Kp(c[(c[e>>2]|0)+8>>2]|0,c[(c[f>>2]|0)+8>>2]|0)|0;l=d;return}function vi(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=37975;switch(c[d>>2]|0){case 0:{c[e>>2]=36021;break}case 1:{c[e>>2]=45707;break}case 2:{c[e>>2]=36033;break}default:{}}l=b;return c[e>>2]|0}function wi(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=37975;switch(c[d>>2]|0){case 0:{c[e>>2]=36041;break}case 1:{c[e>>2]=36050;break}default:{}}l=b;return c[e>>2]|0}function xi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;f=l;l=l+64|0;if((l|0)>=(m|0))$(64);g=f+16|0;h=f+8|0;i=f;j=f+52|0;k=f+48|0;n=f+44|0;o=f+40|0;p=f+36|0;q=f+32|0;r=f+28|0;s=f+24|0;t=f+20|0;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[p>>2]=(((lo(c[n>>2]|0)|0)+7|0)>>>0)/8|0;c[r>>2]=zf(1+(c[p>>2]<<1)|0)|0;a[c[r>>2]>>0]=4;c[s>>2]=(c[r>>2]|0)+1;c[o>>2]=bp(5,c[s>>2]|0,c[p>>2]|0,q,c[j>>2]|0)|0;if(c[o>>2]|0){c[i>>2]=Bt(c[o>>2]|0)|0;We(36058,i)}if((c[q>>2]|0)>>>0<(c[p>>2]|0)>>>0){$w((c[s>>2]|0)+((c[p>>2]|0)-(c[q>>2]|0))|0,c[s>>2]|0,c[q>>2]|0)|0;Uw(c[s>>2]|0,0,(c[p>>2]|0)-(c[q>>2]|0)|0)|0}c[s>>2]=(c[s>>2]|0)+(c[p>>2]|0);c[o>>2]=bp(5,c[s>>2]|0,c[p>>2]|0,q,c[k>>2]|0)|0;if(c[o>>2]|0){c[h>>2]=Bt(c[o>>2]|0)|0;We(36058,h)}if((c[q>>2]|0)>>>0<(c[p>>2]|0)>>>0){$w((c[s>>2]|0)+((c[p>>2]|0)-(c[q>>2]|0))|0,c[s>>2]|0,c[q>>2]|0)|0;Uw(c[s>>2]|0,0,(c[p>>2]|0)-(c[q>>2]|0)|0)|0}c[o>>2]=Zo(t,5,c[r>>2]|0,1+(c[p>>2]<<1)|0,0)|0;if(c[o>>2]|0){c[g>>2]=Bt(c[o>>2]|0)|0;We(36080,g)}else{vf(c[r>>2]|0);l=f;return c[t>>2]|0}return 0}function yi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=Rp(0)|0;c[h>>2]=Rp(0)|0;if(tn(c[g>>2]|0,c[h>>2]|0,c[e>>2]|0,c[f>>2]|0)|0)c[i>>2]=0;else c[i>>2]=xi(c[g>>2]|0,c[h>>2]|0,c[(c[f>>2]|0)+16>>2]|0)|0;Dp(c[g>>2]|0);Dp(c[h>>2]|0);l=d;return c[i>>2]|0}function zi(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+36|0;g=e+32|0;h=e+28|0;i=e+24|0;j=e+20|0;k=e+16|0;n=e+12|0;o=e+8|0;p=e+4|0;q=e;c[g>>2]=a;c[h>>2]=b;do if(c[h>>2]|0?c[(c[h>>2]|0)+12>>2]&4|0:0){c[k>>2]=Gp(c[h>>2]|0,q)|0;if(c[k>>2]|0){c[j>>2]=(((c[q>>2]|0)+7|0)>>>0)/8|0;c[n>>2]=0;break}c[f>>2]=65;r=c[f>>2]|0;l=e;return r|0}else s=6;while(0);do if((s|0)==6){c[j>>2]=(((lo(c[h>>2]|0)|0)+7|0)>>>0)/8|0;c[n>>2]=zf(c[j>>2]|0)|0;c[i>>2]=bp(5,c[n>>2]|0,c[j>>2]|0,j,c[h>>2]|0)|0;q=c[n>>2]|0;if(!(c[i>>2]|0)){c[k>>2]=q;break}vf(q);c[f>>2]=c[i>>2];r=c[f>>2]|0;l=e;return r|0}while(0);if((c[j>>2]|0)>>>0<1){vf(c[n>>2]|0);c[f>>2]=65;r=c[f>>2]|0;l=e;return r|0}if((d[c[k>>2]>>0]|0|0)!=4){vf(c[n>>2]|0);c[f>>2]=69;r=c[f>>2]|0;l=e;return r|0}if((((c[j>>2]|0)-1|0)>>>0)%2|0|0){vf(c[n>>2]|0);c[f>>2]=65;r=c[f>>2]|0;l=e;return r|0}c[j>>2]=(((c[j>>2]|0)-1|0)>>>0)/2|0;c[i>>2]=Zo(o,5,(c[k>>2]|0)+1|0,c[j>>2]|0,0)|0;if(c[i>>2]|0){vf(c[n>>2]|0);c[f>>2]=c[i>>2];r=c[f>>2]|0;l=e;return r|0}c[i>>2]=Zo(p,5,(c[k>>2]|0)+1+(c[j>>2]|0)|0,c[j>>2]|0,0)|0;vf(c[n>>2]|0);if(c[i>>2]|0){Dp(c[o>>2]|0);c[f>>2]=c[i>>2];r=c[f>>2]|0;l=e;return r|0}else{Kp(c[c[g>>2]>>2]|0,c[o>>2]|0)|0;Kp(c[(c[g>>2]|0)+4>>2]|0,c[p>>2]|0)|0;Op(c[(c[g>>2]|0)+8>>2]|0,1)|0;Dp(c[o>>2]|0);Dp(c[p>>2]|0);c[f>>2]=0;r=c[f>>2]|0;l=e;return r|0}return 0}function Ai(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+24|0;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;n=f+4|0;o=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if(!(c[j>>2]|0))c[j>>2]=c[(c[i>>2]|0)+28>>2];if(!(c[k>>2]|0))c[k>>2]=c[(c[i>>2]|0)+44>>2];if(((c[k>>2]|0)!=0&(c[j>>2]|0)!=0?c[(c[i>>2]|0)+16>>2]|0:0)?c[(c[i>>2]|0)+20>>2]|0:0){if((c[c[i>>2]>>2]|0)==2?(c[(c[i>>2]|0)+24>>2]|0)==0:0){c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}if((c[(c[i>>2]|0)+4>>2]|0)==1?c[(c[i>>2]|0)+8>>2]&4096|0:0){if(ji(o,c[k>>2]|0,c[i>>2]|0)|0){c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}c[n>>2]=Sp(0)|0;Yo(c[n>>2]|0,c[o>>2]|0,32,0);vf(c[o>>2]|0);if(!(c[h>>2]|0))c[h>>2]=xn(0)|0;if(c[h>>2]|0)$n(c[h>>2]|0,c[n>>2]|0,c[j>>2]|0,c[i>>2]|0);Dp(c[n>>2]|0)}else{if(!(c[h>>2]|0))c[h>>2]=xn(0)|0;if(c[h>>2]|0)$n(c[h>>2]|0,c[k>>2]|0,c[j>>2]|0,c[i>>2]|0)}c[g>>2]=c[h>>2];p=c[g>>2]|0;l=f;return p|0}c[g>>2]=0;p=c[g>>2]|0;l=f;return p|0}function Bi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;if(pj(c[f>>2]|0,8,0,0)|0){c[i>>2]=5;if(c[h>>2]|0)Eb[c[h>>2]&1](36101,c[f>>2]|0,38068,36106)}else c[i>>2]=Ci(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;h=Di(c[i>>2]|0)|0;l=e;return h|0}function Ci(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;switch(c[f>>2]|0){case 2:{c[i>>2]=Fi(c[g>>2]|0,c[h>>2]|0)|0;break}case 11:{c[i>>2]=Gi(c[g>>2]|0,c[h>>2]|0)|0;break}case 8:{c[i>>2]=Hi(c[g>>2]|0,c[h>>2]|0)|0;break}case 9:{c[i>>2]=Ii(c[g>>2]|0,c[h>>2]|0)|0;break}case 10:{c[i>>2]=Ji(c[g>>2]|0,c[h>>2]|0)|0;break}default:c[i>>2]=5}l=e;return c[i>>2]|0}function Di(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Ei(1,c[d>>2]|0)|0;l=b;return a|0}function Ei(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function Fi(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+160|0;if((l|0)>=(m|0))$(160);f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+32|0;n=e+4|0;o=e;c[g>>2]=b;c[h>>2]=d;c[i>>2]=36945;c[n>>2]=0;while(1){if((c[n>>2]|0)>=64)break;a[k+(c[n>>2]|0)>>0]=c[n>>2];c[n>>2]=(c[n>>2]|0)+1}c[j>>2]=Ki(2,36960,9,k,64,36970,20)|0;do if(!(c[j>>2]|0)){if(c[g>>2]|0){c[i>>2]=36991;c[n>>2]=0;c[o>>2]=48;while(1){if((c[n>>2]|0)>=20)break;d=c[o>>2]|0;c[o>>2]=d+1;a[k+(c[n>>2]|0)>>0]=d;c[n>>2]=(c[n>>2]|0)+1}c[j>>2]=Ki(2,37006,9,k,20,37016,20)|0;if(c[j>>2]|0)break;c[i>>2]=37037;c[n>>2]=0;c[o>>2]=80;while(1){if((c[n>>2]|0)>=100)break;d=c[o>>2]|0;c[o>>2]=d+1;a[k+(c[n>>2]|0)>>0]=d;c[n>>2]=(c[n>>2]|0)+1}c[j>>2]=Ki(2,37052,9,k,100,37062,20)|0;if(c[j>>2]|0)break;c[i>>2]=37083;c[n>>2]=0;c[o>>2]=112;while(1){if((c[n>>2]|0)>=49)break;d=c[o>>2]|0;c[o>>2]=d+1;a[k+(c[n>>2]|0)>>0]=d;c[n>>2]=(c[n>>2]|0)+1}c[j>>2]=Ki(2,37098,9,k,49,37108,20)|0;if(c[j>>2]|0)break}c[f>>2]=0;p=c[f>>2]|0;l=e;return p|0}while(0);if(c[h>>2]|0)Eb[c[h>>2]&1](36101,2,c[i>>2]|0,c[j>>2]|0);c[f>>2]=50;p=c[f>>2]|0;l=e;return p|0}function Gi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[j>>2]=0;while(1){if(!(c[4088+((c[j>>2]|0)*40|0)>>2]|0)){k=6;break}c[h>>2]=c[4088+((c[j>>2]|0)*40|0)>>2];b=c[4088+((c[j>>2]|0)*40|0)+4>>2]|0;a=hv(c[4088+((c[j>>2]|0)*40|0)+4>>2]|0)|0;n=c[4088+((c[j>>2]|0)*40|0)+8>>2]|0;o=hv(c[4088+((c[j>>2]|0)*40|0)+8>>2]|0)|0;c[i>>2]=Ki(11,b,a,n,o,4088+((c[j>>2]|0)*40|0)+12|0,28)|0;if(c[i>>2]|0)break;if(!(c[f>>2]|0)){k=6;break}c[j>>2]=(c[j>>2]|0)+1}if((k|0)==6){c[e>>2]=0;p=c[e>>2]|0;l=d;return p|0}if(c[g>>2]|0)Eb[c[g>>2]&1](36101,11,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;p=c[e>>2]|0;l=d;return p|0}function Hi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+32|0;f=d+28|0;g=d+24|0;h=d+20|0;i=d+16|0;j=d+12|0;k=d+8|0;n=d+4|0;o=d;c[f>>2]=a;c[g>>2]=b;c[j>>2]=0;while(1){if(!(c[3780+((c[j>>2]|0)*44|0)>>2]|0)){p=13;break}c[h>>2]=c[3780+((c[j>>2]|0)*44|0)>>2];b=c[3780+((c[j>>2]|0)*44|0)+4>>2]|0;a=hv(c[3780+((c[j>>2]|0)*44|0)+4>>2]|0)|0;q=c[3780+((c[j>>2]|0)*44|0)+8>>2]|0;r=hv(c[3780+((c[j>>2]|0)*44|0)+8>>2]|0)|0;c[i>>2]=Ki(8,b,a,q,r,3780+((c[j>>2]|0)*44|0)+12|0,32)|0;if(c[i>>2]|0)break;r=c[3780+((c[j>>2]|0)*44|0)+8>>2]|0;c[k>>2]=Yp(r,hv(c[3780+((c[j>>2]|0)*44|0)+8>>2]|0)|0)|0;if(!(c[k>>2]|0)){p=5;break}r=c[k>>2]|0;q=c[3780+((c[j>>2]|0)*44|0)+4>>2]|0;Zp(r,q,hv(c[3780+((c[j>>2]|0)*44|0)+4>>2]|0)|0);c[n>>2]=cq(c[k>>2]|0,o)|0;if(!(c[n>>2]|0)){p=7;break}if((c[o>>2]|0)!=32){p=10;break}if(Jv(c[n>>2]|0,3780+((c[j>>2]|0)*44|0)+12|0,32)|0){p=10;break}$p(c[k>>2]|0);if(!(c[f>>2]|0)){p=13;break}c[j>>2]=(c[j>>2]|0)+1}if((p|0)==5)c[i>>2]=36850;else if((p|0)==7){c[i>>2]=36875;$p(c[k>>2]|0)}else if((p|0)==10){c[i>>2]=36905;$p(c[k>>2]|0)}else if((p|0)==13){c[e>>2]=0;s=c[e>>2]|0;l=d;return s|0}if(c[g>>2]|0)Eb[c[g>>2]&1](36101,8,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;s=c[e>>2]|0;l=d;return s|0}function Ii(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[j>>2]=0;while(1){if(!(c[3360+((c[j>>2]|0)*60|0)>>2]|0)){k=6;break}c[h>>2]=c[3360+((c[j>>2]|0)*60|0)>>2];b=c[3360+((c[j>>2]|0)*60|0)+4>>2]|0;a=hv(c[3360+((c[j>>2]|0)*60|0)+4>>2]|0)|0;n=c[3360+((c[j>>2]|0)*60|0)+8>>2]|0;o=hv(c[3360+((c[j>>2]|0)*60|0)+8>>2]|0)|0;c[i>>2]=Ki(9,b,a,n,o,3360+((c[j>>2]|0)*60|0)+12|0,48)|0;if(c[i>>2]|0)break;if(!(c[f>>2]|0)){k=6;break}c[j>>2]=(c[j>>2]|0)+1}if((k|0)==6){c[e>>2]=0;p=c[e>>2]|0;l=d;return p|0}if(c[g>>2]|0)Eb[c[g>>2]&1](36101,9,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;p=c[e>>2]|0;l=d;return p|0}function Ji(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[j>>2]=0;while(1){if(!(c[2828+((c[j>>2]|0)*76|0)>>2]|0)){k=6;break}c[h>>2]=c[2828+((c[j>>2]|0)*76|0)>>2];b=c[2828+((c[j>>2]|0)*76|0)+4>>2]|0;a=hv(c[2828+((c[j>>2]|0)*76|0)+4>>2]|0)|0;n=c[2828+((c[j>>2]|0)*76|0)+8>>2]|0;o=hv(c[2828+((c[j>>2]|0)*76|0)+8>>2]|0)|0;c[i>>2]=Ki(10,b,a,n,o,2828+((c[j>>2]|0)*76|0)+12|0,64)|0;if(c[i>>2]|0)break;if(!(c[f>>2]|0)){k=6;break}c[j>>2]=(c[j>>2]|0)+1}if((k|0)==6){c[e>>2]=0;p=c[e>>2]|0;l=d;return p|0}if(c[g>>2]|0)Eb[c[g>>2]&1](36101,10,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;p=c[e>>2]|0;l=d;return p|0}function Ki(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);j=i+36|0;k=i+32|0;n=i+28|0;o=i+24|0;p=i+20|0;q=i+16|0;r=i+12|0;s=i+8|0;t=i+4|0;u=i;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=h;h=oj(c[k>>2]|0)|0;do if((h|0)==(c[s>>2]|0)){if(Si(t,c[k>>2]|0,2)|0){c[j>>2]=49976;break}g=(fj(c[t>>2]|0,c[p>>2]|0,c[q>>2]|0)|0)!=0;f=c[t>>2]|0;if(g){_i(f);c[j>>2]=36149;break}$i(f,c[n>>2]|0,c[o>>2]|0);c[u>>2]=lj(c[t>>2]|0,c[k>>2]|0)|0;if(!(c[u>>2]|0)){_i(c[t>>2]|0);c[j>>2]=36171;break}f=(Jv(c[u>>2]|0,c[r>>2]|0,c[s>>2]|0)|0)!=0;_i(c[t>>2]|0);if(f){c[j>>2]=36191;break}else{c[j>>2]=0;break}}else c[j>>2]=36130;while(0);l=i;return c[j>>2]|0}function Li(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;do if(c[e>>2]|0){c[f>>2]=Mi(c[e>>2]|0,0)|0;if(c[f>>2]|0){c[d>>2]=c[c[f>>2]>>2];break}c[f>>2]=Ni(c[e>>2]|0)|0;if(c[f>>2]|0){c[d>>2]=c[c[f>>2]>>2];break}else{c[d>>2]=0;break}}else c[d>>2]=0;while(0);l=b;return c[d>>2]|0}function Mi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;do if(c[f>>2]|0){if(Hv(c[f>>2]|0,37129,4)|0?Hv(c[f>>2]|0,37134,4)|0:0)break;c[f>>2]=(c[f>>2]|0)+4}while(0);c[h>>2]=Oi(c[f>>2]|0)|0;a:do if(c[h>>2]|0?c[(c[h>>2]|0)+20>>2]|0:0){c[i>>2]=0;while(1){if(!(c[(c[(c[h>>2]|0)+20>>2]|0)+(c[i>>2]<<2)>>2]|0))break a;if(!(sv(c[f>>2]|0,c[(c[(c[h>>2]|0)+20>>2]|0)+(c[i>>2]<<2)>>2]|0)|0))break;c[i>>2]=(c[i>>2]|0)+1}if(c[g>>2]|0)c[c[g>>2]>>2]=c[(c[(c[h>>2]|0)+20>>2]|0)+(c[i>>2]<<2)>>2];c[e>>2]=c[h>>2];j=c[e>>2]|0;l=d;return j|0}while(0);c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}function Ni(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[g>>2]=0;while(1){a=c[4368+(c[g>>2]<<2)>>2]|0;c[f>>2]=a;if(!a){h=6;break}if(!(sv(c[e>>2]|0,c[(c[f>>2]|0)+8>>2]|0)|0)){h=4;break}c[g>>2]=(c[g>>2]|0)+1}if((h|0)==4){c[d>>2]=c[f>>2];i=c[d>>2]|0;l=b;return i|0}else if((h|0)==6){c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}return 0}function Oi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+20|0;e=b+16|0;f=b+12|0;g=b+8|0;h=b+4|0;i=b;c[e>>2]=a;c[h>>2]=0;a:while(1){a=c[4368+(c[h>>2]<<2)>>2]|0;c[f>>2]=a;if(!a){j=10;break}c[g>>2]=c[(c[f>>2]|0)+20>>2];b:do if(c[g>>2]|0){c[i>>2]=0;while(1){if(!(c[(c[g>>2]|0)+(c[i>>2]<<2)>>2]|0))break b;if(!(sv(c[e>>2]|0,c[(c[g>>2]|0)+(c[i>>2]<<2)>>2]|0)|0)){j=7;break a}c[i>>2]=(c[i>>2]|0)+1}}while(0);c[h>>2]=(c[h>>2]|0)+1}if((j|0)==7){c[d>>2]=c[f>>2];k=c[d>>2]|0;l=b;return k|0}else if((j|0)==10){c[d>>2]=0;k=c[d>>2]|0;l=b;return k|0}return 0}function Pi(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=Qi(c[d>>2]|0)|0;if(!(c[e>>2]|0)){f=37975;l=b;return f|0}f=c[(c[e>>2]|0)+8>>2]|0;l=b;return f|0}function Qi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[e>>2]=Ri(c[e>>2]|0)|0;c[f>>2]=0;while(1){a=c[4368+(c[f>>2]<<2)>>2]|0;c[g>>2]=a;if(!a){h=6;break}if((c[e>>2]|0)==(c[c[g>>2]>>2]|0)){h=4;break}c[f>>2]=(c[f>>2]|0)+1}if((h|0)==4){c[d>>2]=c[g>>2];i=c[d>>2]|0;l=b;return i|0}else if((h|0)==6){c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}return 0}function Ri(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return c[d>>2]|0}function Si(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(c[h>>2]&-260|0)c[i>>2]=45;else c[i>>2]=Ti(j,c[g>>2]|0,c[h>>2]|0)|0;c[c[f>>2]>>2]=c[i>>2]|0?0:c[j>>2]|0;l=e;return c[i>>2]|0}function Ti(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+36|0;h=f+32|0;i=f+28|0;j=f+24|0;k=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;r=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=0;c[k>>2]=((c[i>>2]&1|0)!=0^1^1)&1;c[n>>2]=((c[i>>2]&2|0)!=0^1^1)&1;c[o>>2]=c[k>>2]|0?512:1024;c[r>>2]=16+(c[o>>2]|0);c[r>>2]=((((c[r>>2]|0)+8-1|0)>>>0)/8|0)<<3;o=(c[r>>2]|0)+28|0;if(c[k>>2]|0)c[q>>2]=sf(o)|0;else c[q>>2]=pf(o)|0;if(!(c[q>>2]|0))c[j>>2]=Ct(c[(xu()|0)>>2]|0)|0;if((c[j>>2]|0)==0?(o=(c[q>>2]|0)+(c[r>>2]|0)|0,c[p>>2]=o,c[c[q>>2]>>2]=o,c[(c[q>>2]|0)+8>>2]=(c[r>>2]|0)-16+1,c[(c[q>>2]|0)+4>>2]=0,o=c[c[q>>2]>>2]|0,c[o>>2]=0,c[o+4>>2]=0,c[o+8>>2]=0,c[o+12>>2]=0,c[o+16>>2]=0,c[o+20>>2]=0,c[o+24>>2]=0,c[c[p>>2]>>2]=c[k>>2]|0?378630161:285677921,c[(c[p>>2]|0)+4>>2]=(c[r>>2]|0)+28,r=(c[p>>2]|0)+12|0,a[r>>0]=a[r>>0]&-2|c[k>>2]&1,k=(c[p>>2]|0)+12|0,a[k>>0]=a[k>>0]&-5|(((c[i>>2]&256|0)!=0^1^1)&1)<<2&255,c[n>>2]|0):0){switch(c[h>>2]|0){case 10:case 9:{c[(c[p>>2]|0)+24>>2]=128;break}case 311:case 308:{c[(c[p>>2]|0)+24>>2]=32;break}default:c[(c[p>>2]|0)+24>>2]=64}n=sf(c[(c[p>>2]|0)+24>>2]<<1)|0;c[(c[p>>2]|0)+20>>2]=n;if(!(c[(c[p>>2]|0)+20>>2]|0)){c[j>>2]=Ct(c[(xu()|0)>>2]|0)|0;Ui(c[q>>2]|0)}}if(((c[j>>2]|0)==0?(mn(),c[h>>2]|0):0)?(c[j>>2]=Vi(c[q>>2]|0,c[h>>2]|0)|0,c[j>>2]|0):0)Ui(c[q>>2]|0);if(c[j>>2]|0){s=c[j>>2]|0;l=f;return s|0}c[c[g>>2]>>2]=c[q>>2];s=c[j>>2]|0;l=f;return s|0}function Ui(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+68|0;g=e+64|0;h=e+60|0;i=e+56|0;j=e+52|0;k=e+74|0;n=e+16|0;o=e+48|0;p=e+44|0;q=e+40|0;r=e+73|0;s=e+8|0;t=e+36|0;u=e+32|0;v=e+28|0;w=e+72|0;x=e;y=e+24|0;c[f>>2]=b;if(!(c[f>>2]|0)){l=e;return}if(c[(c[c[f>>2]>>2]|0)+8>>2]|0)Wi(c[f>>2]|0);c[g>>2]=c[(c[c[f>>2]>>2]|0)+16>>2];while(1){if(!(c[g>>2]|0))break;c[h>>2]=c[(c[g>>2]|0)+4>>2];c[i>>2]=c[g>>2];c[j>>2]=c[(c[g>>2]|0)+8>>2];a[k>>0]=0;b=n;c[b>>2]=d[k>>0];c[b+4>>2]=0;while(1){if(!(c[i>>2]&7|0?(c[j>>2]|0)!=0:0))break;a[c[i>>2]>>0]=a[k>>0]|0;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+-1}if((c[j>>2]|0)>>>0>=8){b=n;z=gx(c[b>>2]|0,c[b+4>>2]|0,16843009,16843009)|0;b=n;c[b>>2]=z;c[b+4>>2]=D;do{c[o>>2]=c[i>>2];b=n;z=c[b+4>>2]|0;A=c[o>>2]|0;c[A>>2]=c[b>>2];c[A+4>>2]=z;c[j>>2]=(c[j>>2]|0)-8;c[i>>2]=(c[i>>2]|0)+8}while((c[j>>2]|0)>>>0>=8)}while(1){if(!(c[j>>2]|0))break;a[c[i>>2]>>0]=a[k>>0]|0;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+-1}vf(c[g>>2]|0);c[g>>2]=c[h>>2]}if(c[(c[c[f>>2]>>2]|0)+20>>2]|0){c[p>>2]=c[(c[c[f>>2]>>2]|0)+20>>2];c[q>>2]=c[(c[c[f>>2]>>2]|0)+24>>2]<<1;a[r>>0]=0;h=s;c[h>>2]=d[r>>0];c[h+4>>2]=0;while(1){if(!(c[p>>2]&7|0?(c[q>>2]|0)!=0:0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}if((c[q>>2]|0)>>>0>=8){h=s;g=gx(c[h>>2]|0,c[h+4>>2]|0,16843009,16843009)|0;h=s;c[h>>2]=g;c[h+4>>2]=D;do{c[t>>2]=c[p>>2];h=s;g=c[h+4>>2]|0;j=c[t>>2]|0;c[j>>2]=c[h>>2];c[j+4>>2]=g;c[q>>2]=(c[q>>2]|0)-8;c[p>>2]=(c[p>>2]|0)+8}while((c[q>>2]|0)>>>0>=8)}while(1){if(!(c[q>>2]|0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}vf(c[(c[c[f>>2]>>2]|0)+20>>2]|0)}c[u>>2]=c[f>>2];c[v>>2]=c[(c[c[f>>2]>>2]|0)+4>>2];a[w>>0]=0;q=x;c[q>>2]=d[w>>0];c[q+4>>2]=0;while(1){if(!(c[u>>2]&7|0?(c[v>>2]|0)!=0:0))break;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}if((c[v>>2]|0)>>>0>=8){q=x;p=gx(c[q>>2]|0,c[q+4>>2]|0,16843009,16843009)|0;q=x;c[q>>2]=p;c[q+4>>2]=D;do{c[y>>2]=c[u>>2];q=x;p=c[q+4>>2]|0;r=c[y>>2]|0;c[r>>2]=c[q>>2];c[r+4>>2]=p;c[v>>2]=(c[v>>2]|0)-8;c[u>>2]=(c[u>>2]|0)+8}while((c[v>>2]|0)>>>0>=8)}while(1){if(!(c[v>>2]|0))break;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}vf(c[f>>2]|0);l=e;return}function Vi(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f;h=f+32|0;i=f+28|0;j=f+24|0;k=f+20|0;n=f+16|0;o=f+12|0;p=f+8|0;q=f+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=c[c[i>>2]>>2];c[p>>2]=0;c[o>>2]=c[(c[k>>2]|0)+16>>2];while(1){if(!(c[o>>2]|0))break;if((c[c[c[o>>2]>>2]>>2]|0)==(c[j>>2]|0)){r=4;break}c[o>>2]=c[(c[o>>2]|0)+4>>2]}if((r|0)==4){c[h>>2]=0;s=c[h>>2]|0;l=f;return s|0}c[n>>2]=Qi(c[j>>2]|0)|0;if(!(c[n>>2]|0)){c[g>>2]=c[j>>2];Ye(37139,g);c[p>>2]=5}if(((c[p>>2]|0)==0&(c[j>>2]|0)==1?Wg()|0:0)?(ch(37178),ah()|0):0)c[p>>2]=5;do if(!(c[p>>2]|0)){c[q>>2]=24+(c[(c[n>>2]|0)+44>>2]|0)-8;j=c[q>>2]|0;if(a[(c[k>>2]|0)+12>>0]&1|0)c[o>>2]=sf(j)|0;else c[o>>2]=pf(j)|0;if(c[o>>2]|0){c[c[o>>2]>>2]=c[n>>2];c[(c[o>>2]|0)+4>>2]=c[(c[k>>2]|0)+16>>2];c[(c[o>>2]|0)+8>>2]=c[q>>2];c[(c[k>>2]|0)+16>>2]=c[o>>2];xb[c[(c[c[o>>2]>>2]|0)+28>>2]&7]((c[o>>2]|0)+16|0,(d[(c[k>>2]|0)+12>>0]|0)>>>2&1|0?256:0);break}else{c[p>>2]=Ct(c[(xu()|0)>>2]|0)|0;break}}while(0);c[h>>2]=c[p>>2];s=c[h>>2]|0;l=f;return s|0}function Wi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+20|0;e=b+16|0;f=b+8|0;g=b;c[d>>2]=a;if(c[(c[c[d>>2]>>2]|0)+8>>2]|0){if(c[(c[d>>2]|0)+4>>2]|0)Xi(c[d>>2]|0,0,0);Qv(c[(c[c[d>>2]>>2]|0)+8>>2]|0)|0;c[(c[c[d>>2]>>2]|0)+8>>2]=0}c[e>>2]=c[d>>2];d=f;c[d>>2]=42;c[d+4>>2]=0;d=f;f=gx(c[e>>2]|0,0,c[d>>2]|0,c[d+4>>2]|0)|0;d=g;c[d>>2]=f;c[d+4>>2]=D;l=b;return}function Xi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(c[(c[c[f>>2]>>2]|0)+8>>2]|0){if(c[(c[f>>2]|0)+4>>2]|0?(Zv((c[f>>2]|0)+12|0,c[(c[f>>2]|0)+4>>2]|0,1,c[(c[c[f>>2]>>2]|0)+8>>2]|0)|0)!=1:0)Re(37187,630,37192);if(c[h>>2]|0?(Zv(c[g>>2]|0,c[h>>2]|0,1,c[(c[c[f>>2]>>2]|0)+8>>2]|0)|0)!=1:0)Re(37187,632,37192)}c[i>>2]=c[(c[c[f>>2]>>2]|0)+16>>2];while(1){j=(c[f>>2]|0)+4|0;if(!(c[i>>2]|0))break;if(c[j>>2]|0)zb[c[(c[c[i>>2]>>2]|0)+32>>2]&7]((c[i>>2]|0)+16|0,(c[f>>2]|0)+12|0,c[(c[f>>2]|0)+4>>2]|0);zb[c[(c[c[i>>2]>>2]|0)+32>>2]&7]((c[i>>2]|0)+16|0,c[g>>2]|0,c[h>>2]|0);c[i>>2]=c[(c[i>>2]|0)+4>>2]}c[j>>2]=0;l=e;return}function Yi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+80|0;if((l|0)>=(m|0))$(80);e=d+16|0;f=d+8|0;g=d+24|0;h=d+20|0;i=d+28|0;c[g>>2]=a;c[h>>2]=b;if(Wg()|0){l=d;return}if(c[(c[c[g>>2]>>2]|0)+8>>2]|0){Ye(37201,d);l=d;return}c[17735]=(c[17735]|0)+1;b=c[h>>2]|0;c[f>>2]=c[17735];c[f+4>>2]=b;Su(i,49,37233,f)|0;f=Pv(i,37250)|0;c[(c[c[g>>2]>>2]|0)+8>>2]=f;if(c[(c[c[g>>2]>>2]|0)+8>>2]|0){l=d;return}c[e>>2]=i;Ye(37252,e);l=d;return}function Zi(b){b=b|0;var e=0,f=0,g=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+4|0;g=e;c[f>>2]=b;b=(c[c[f>>2]>>2]|0)+12|0;a[b>>0]=a[b>>0]&-3;c[(c[f>>2]|0)+4>>2]=0;c[g>>2]=c[(c[c[f>>2]>>2]|0)+16>>2];while(1){if(!(c[g>>2]|0))break;Uw((c[g>>2]|0)+16|0,0,c[(c[c[g>>2]>>2]|0)+44>>2]|0)|0;xb[c[(c[c[g>>2]>>2]|0)+28>>2]&7]((c[g>>2]|0)+16|0,(d[(c[c[f>>2]>>2]|0)+12>>0]|0)>>>2&1|0?256:0);c[g>>2]=c[(c[g>>2]|0)+4>>2]}if(!(c[(c[c[f>>2]>>2]|0)+20>>2]|0)){l=e;return}Xi(c[f>>2]|0,c[(c[c[f>>2]>>2]|0)+20>>2]|0,c[(c[c[f>>2]>>2]|0)+24>>2]|0);l=e;return}function _i(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Ui(c[d>>2]|0);l=b;return}function $i(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;Xi(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function aj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[f+4>>2]=e;c[j>>2]=0;switch(c[h>>2]|0){case 5:{bj(c[g>>2]|0);break}case 32:{Yi(c[g>>2]|0,c[i>>2]|0);break}case 33:{Wi(c[g>>2]|0);break}default:c[j>>2]=61}l=f;return c[j>>2]|0}function bj(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+24|0;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;n=e;c[f>>2]=b;if((d[(c[c[f>>2]>>2]|0)+12>>0]|0)>>>1&1|0){l=e;return}if(c[(c[f>>2]|0)+4>>2]|0)Xi(c[f>>2]|0,0,0);c[g>>2]=c[(c[c[f>>2]>>2]|0)+16>>2];while(1){if(!(c[g>>2]|0))break;wb[c[(c[c[g>>2]>>2]|0)+36>>2]&15]((c[g>>2]|0)+16|0);c[g>>2]=c[(c[g>>2]|0)+4>>2]}g=(c[c[f>>2]>>2]|0)+12|0;a[g>>0]=a[g>>0]&-3|2;if(!(c[(c[c[f>>2]>>2]|0)+20>>2]|0)){l=e;return}c[h>>2]=cj(c[f>>2]|0)|0;c[i>>2]=dj(c[f>>2]|0,c[h>>2]|0)|0;c[j>>2]=ej(c[h>>2]|0)|0;c[n>>2]=Ti(k,c[h>>2]|0,(a[(c[c[f>>2]>>2]|0)+12>>0]&1|0?1:0)|((d[(c[c[f>>2]>>2]|0)+12>>0]|0)>>>2&1|0?256:0))|0;if(c[n>>2]|0)Le(c[n>>2]|0,0);Xi(c[k>>2]|0,(c[(c[c[f>>2]>>2]|0)+20>>2]|0)+(c[(c[c[f>>2]>>2]|0)+24>>2]|0)|0,c[(c[c[f>>2]>>2]|0)+24>>2]|0);Xi(c[k>>2]|0,c[i>>2]|0,c[j>>2]|0);bj(c[k>>2]|0);f=c[i>>2]|0;i=dj(c[k>>2]|0,c[h>>2]|0)|0;_w(f|0,i|0,c[j>>2]|0)|0;Ui(c[k>>2]|0);l=e;return}function cj(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;e=b+8|0;f=b+4|0;c[e>>2]=a;c[f>>2]=c[(c[c[e>>2]>>2]|0)+16>>2];if(c[f>>2]|0?c[(c[f>>2]|0)+4>>2]|0:0){dh(37187,980,37324,0,37336);Ve(37357,d)}if(!(c[f>>2]|0)){g=0;l=b;return g|0}g=c[c[c[f>>2]>>2]>>2]|0;l=b;return g|0}function dj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=c[(c[c[g>>2]>>2]|0)+16>>2];if(!(c[h>>2]|0)){if(!(c[i>>2]|0))Re(37187,816,37316);if(c[(c[i>>2]|0)+4>>2]|0)Ye(37277,e);c[f>>2]=yb[c[(c[c[i>>2]>>2]|0)+40>>2]&15]((c[i>>2]|0)+16|0)|0;j=c[f>>2]|0;l=d;return j|0}c[i>>2]=c[(c[c[g>>2]>>2]|0)+16>>2];while(1){if(!(c[i>>2]|0)){k=11;break}n=c[i>>2]|0;if((c[c[c[i>>2]>>2]>>2]|0)==(c[h>>2]|0))break;c[i>>2]=c[n+4>>2]}if((k|0)==11)Re(37187,816,37316);c[f>>2]=yb[c[(c[n>>2]|0)+40>>2]&15]((c[i>>2]|0)+16|0)|0;j=c[f>>2]|0;l=d;return j|0}function ej(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=Qi(c[d>>2]|0)|0;if(!(c[e>>2]|0)){f=0;l=b;return f|0}f=c[(c[e>>2]|0)+24>>2]|0;l=b;return f|0}function fj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(c[(c[c[f>>2]>>2]|0)+20>>2]|0){c[i>>2]=gj(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;if(!(c[i>>2]|0))Zi(c[f>>2]|0)}else c[i>>2]=70;l=e;return c[i>>2]|0}function gj(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+32|0;i=g+28|0;j=g+24|0;k=g+20|0;n=g+16|0;o=g+12|0;p=g+8|0;q=g+4|0;r=g;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[o>>2]=cj(c[i>>2]|0)|0;c[p>>2]=0;if(!(c[o>>2]|0)){c[h>>2]=5;s=c[h>>2]|0;l=g;return s|0}do if((c[k>>2]|0)>>>0>(c[(c[c[i>>2]>>2]|0)+24>>2]|0)>>>0){c[p>>2]=sf(ej(c[o>>2]|0)|0)|0;if(c[p>>2]|0){hj(c[o>>2]|0,c[p>>2]|0,c[j>>2]|0,c[k>>2]|0);c[j>>2]=c[p>>2];c[k>>2]=ej(c[o>>2]|0)|0;if((c[k>>2]|0)>>>0<=(c[(c[c[i>>2]>>2]|0)+24>>2]|0)>>>0)break;Se(37408,37187,716,37441)}else{c[h>>2]=Ct(c[(xu()|0)>>2]|0)|0;s=c[h>>2]|0;l=g;return s|0}}while(0);Uw(c[(c[c[i>>2]>>2]|0)+20>>2]|0,0,c[(c[c[i>>2]>>2]|0)+24>>2]<<1|0)|0;c[q>>2]=c[(c[c[i>>2]>>2]|0)+20>>2];c[r>>2]=(c[(c[c[i>>2]>>2]|0)+20>>2]|0)+(c[(c[c[i>>2]>>2]|0)+24>>2]|0);_w(c[q>>2]|0,c[j>>2]|0,c[k>>2]|0)|0;_w(c[r>>2]|0,c[j>>2]|0,c[k>>2]|0)|0;c[n>>2]=0;while(1){if((c[n>>2]|0)>=(c[(c[c[i>>2]>>2]|0)+24>>2]|0))break;k=(c[q>>2]|0)+(c[n>>2]|0)|0;a[k>>0]=(d[k>>0]|0)^54;k=(c[r>>2]|0)+(c[n>>2]|0)|0;a[k>>0]=(d[k>>0]|0)^92;c[n>>2]=(c[n>>2]|0)+1}vf(c[p>>2]|0);c[h>>2]=0;s=c[h>>2]|0;l=g;return s|0}function hj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;h=f+28|0;i=f+24|0;j=f+20|0;k=f+16|0;n=f+12|0;o=f+8|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if((c[h>>2]|0)==2){Xl(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0);l=f;return}if((c[h>>2]|0)==3?(Wg()|0)==0:0){bl(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0);l=f;return}if(((c[h>>2]|0)==1?Wg()|0:0)?(ch(37178),ah()|0):0)Yg();c[o>>2]=Ti(n,c[h>>2]|0,0)|0;if(c[o>>2]|0){e=c[h>>2]|0;d=Bt(ij(c[o>>2]|0)|0)|0;c[g>>2]=e;c[g+4>>2]=d;Xe(37457,g)}Xi(c[n>>2]|0,c[j>>2]|0,c[k>>2]|0);bj(c[n>>2]|0);k=c[i>>2]|0;i=dj(c[n>>2]|0,c[h>>2]|0)|0;_w(k|0,i|0,ej(c[h>>2]|0)|0)|0;Ui(c[n>>2]|0);l=f;return}function ij(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=jj(32,c[d>>2]|0)|0;l=b;return a|0}function jj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=kj(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function kj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function lj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;aj(c[e>>2]|0,5,0,0)|0;b=dj(c[e>>2]|0,c[f>>2]|0)|0;l=d;return b|0}function mj(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+32|0;i=g+28|0;j=g+24|0;k=g+20|0;n=g+16|0;o=g+12|0;p=g+8|0;q=g+4|0;r=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;if((c[n>>2]|0)==0|(c[o>>2]|0)<0){c[h>>2]=45;s=c[h>>2]|0;l=g;return s|0}if(c[j>>2]&-3|0){c[h>>2]=45;s=c[h>>2]|0;l=g;return s|0}c[p>>2]=((c[j>>2]&2|0)!=0^1^1)&1;if((c[p>>2]|0)!=0&(c[o>>2]|0)<1){c[h>>2]=45;s=c[h>>2]|0;l=g;return s|0}if((c[i>>2]|0)!=2|(c[p>>2]|0)!=0){if(((c[i>>2]|0)==1?Wg()|0:0)?(ch(37178),ah()|0):0)Yg();c[r>>2]=Ti(q,c[i>>2]|0,c[p>>2]|0?2:0)|0;if(c[r>>2]|0){c[h>>2]=c[r>>2];s=c[h>>2]|0;l=g;return s|0}do if(c[p>>2]|0){c[r>>2]=fj(c[q>>2]|0,(c[(c[n>>2]|0)+12>>2]|0)+(c[(c[n>>2]|0)+4>>2]|0)|0,c[(c[n>>2]|0)+8>>2]|0)|0;if(!(c[r>>2]|0)){c[n>>2]=(c[n>>2]|0)+16;c[o>>2]=(c[o>>2]|0)+-1;break}Ui(c[q>>2]|0);c[h>>2]=c[r>>2];s=c[h>>2]|0;l=g;return s|0}while(0);while(1){t=c[q>>2]|0;if(!(c[o>>2]|0))break;Xi(t,(c[(c[n>>2]|0)+12>>2]|0)+(c[(c[n>>2]|0)+4>>2]|0)|0,c[(c[n>>2]|0)+8>>2]|0);c[n>>2]=(c[n>>2]|0)+16;c[o>>2]=(c[o>>2]|0)+-1}bj(t);t=c[k>>2]|0;r=dj(c[q>>2]|0,c[i>>2]|0)|0;_w(t|0,r|0,ej(c[i>>2]|0)|0)|0;Ui(c[q>>2]|0)}else Yl(c[k>>2]|0,c[n>>2]|0,c[o>>2]|0);c[h>>2]=0;s=c[h>>2]|0;l=g;return s|0}function nj(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=cj(c[d>>2]|0)|0;l=b;return a|0}function oj(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=ej(c[d>>2]|0)|0;l=b;return a|0}function pj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+24|0;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;n=f+4|0;o=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;a:do switch(c[h>>2]|0){case 8:{if((c[i>>2]|0)!=0|(c[j>>2]|0)!=0){c[k>>2]=45;break a}else{c[k>>2]=qj(c[g>>2]|0)|0;break a}break}case 10:{c[k>>2]=qj(c[g>>2]|0)|0;if(!(c[k>>2]|0)){c[n>>2]=rj(c[g>>2]|0,o,0)|0;if(c[i>>2]|0?(c[c[j>>2]>>2]|0)>>>0>=(c[o>>2]|0)>>>0:0){_w(c[i>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;c[c[j>>2]>>2]=c[o>>2];break a}if((c[i>>2]|0)==0&(c[j>>2]|0)!=0){c[c[j>>2]>>2]=c[o>>2];break a}if(c[i>>2]|0){c[k>>2]=66;break a}else{c[k>>2]=45;break a}}break}case 57:{if(c[j>>2]|0)p=c[c[j>>2]>>2]|0;else p=0;c[k>>2]=tj(sj(c[g>>2]|0,p,0)|0)|0;break}default:c[k>>2]=61}while(0);l=f;return c[k>>2]|0}function qj(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=b;c[g>>2]=Qi(c[f>>2]|0)|0;if(c[g>>2]|0?(a[(c[g>>2]|0)+4>>0]&1|0)==0:0){c[e>>2]=0;h=c[e>>2]|0;l=d;return h|0}c[e>>2]=5;h=c[e>>2]|0;l=d;return h|0}function rj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;g=e+20|0;h=e+16|0;i=e+12|0;j=e+8|0;k=e+4|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[k>>2]=0;c[j>>2]=Qi(c[g>>2]|0)|0;if(!(c[j>>2]|0)){c[f>>2]=c[g>>2];Xe(37493,f)}if(c[h>>2]|0)c[c[h>>2]>>2]=c[(c[j>>2]|0)+16>>2];if(!(c[i>>2]|0)){n=c[j>>2]|0;o=n+12|0;p=c[o>>2]|0;c[k>>2]=p;q=c[k>>2]|0;l=e;return q|0}c[c[i>>2]>>2]=c[(c[j>>2]|0)+24>>2];n=c[j>>2]|0;o=n+12|0;p=c[o>>2]|0;c[k>>2]=p;q=c[k>>2]|0;l=e;return q|0}function sj(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=0;c[k>>2]=Qi(c[g>>2]|0)|0;if((c[k>>2]|0?(a[(c[k>>2]|0)+4>>0]&1|0)==0:0)?c[(c[k>>2]|0)+48>>2]|0:0){c[j>>2]=ub[c[(c[k>>2]|0)+48>>2]&63](c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0;n=c[j>>2]|0;o=uj(n)|0;l=f;return o|0}if(c[k>>2]|0)p=(c[(c[k>>2]|0)+48>>2]|0)!=0;else p=0;c[j>>2]=p?5:69;if(!(c[i>>2]|0)){n=c[j>>2]|0;o=uj(n)|0;l=f;return o|0}p=c[i>>2]|0;i=c[g>>2]|0;if(c[k>>2]|0?!(a[(c[k>>2]|0)+4>>0]&1|0):0)q=38046;else q=c[k>>2]|0?38007:38026;Eb[p&1](43214,i,38068,q);n=c[j>>2]|0;o=uj(n)|0;l=f;return o|0}function tj(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return c[d>>2]&65535|0}function uj(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=kj(1,c[d>>2]|0)|0;l=b;return a|0}function vj(){return 0}function wj(){return 0}function xj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;c[17736]=c[e>>2];c[17737]=c[f>>2];l=d;return}function yj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=zj(c[g>>2]|0,1,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;Aj(10);l=f;return c[k>>2]|0}function zj(a,b,d,f,g){a=a|0;b=b|0;d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;h=l;l=l+96|0;if((l|0)>=(m|0))$(96);i=h+8|0;j=h;k=h+80|0;n=h+76|0;o=h+72|0;p=h+68|0;q=h+64|0;r=h+60|0;s=h+56|0;t=h+52|0;u=h+48|0;v=h+44|0;w=h+40|0;x=h+36|0;y=h+32|0;z=h+28|0;A=h+24|0;B=h+20|0;C=h+16|0;D=h+12|0;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=f;c[q>>2]=g;if((c[k>>2]|0)>>>0<16){c[j>>2]=16;We(37531,j)}c[C>>2]=zf(c[1099]<<2)|0;c[u>>2]=up(2)|0;c[v>>2]=up(3)|0;j=c[k>>2]|0;if(c[n>>2]|0)E=Sp(j)|0;else E=Rp(j)|0;c[r>>2]=E;c[w>>2]=Lp(c[r>>2]|0)|0;c[t>>2]=Lp(c[r>>2]|0)|0;c[s>>2]=Lp(c[r>>2]|0)|0;c[B>>2]=0;c[A>>2]=0;a:while(1){c[D>>2]=0;Up(c[r>>2]|0,c[k>>2]|0,c[o>>2]|0);oo(c[r>>2]|0,(c[k>>2]|0)-1|0);if(c[n>>2]|0)no(c[r>>2]|0,(c[k>>2]|0)-2|0);no(c[r>>2]|0,0);c[x>>2]=0;while(1){E=e[16568+(c[x>>2]<<1)>>1]|0;c[y>>2]=E;if(!E)break;E=Ao(0,c[r>>2]|0,c[y>>2]|0)|0;c[(c[C>>2]|0)+(c[x>>2]<<2)>>2]=E;c[x>>2]=(c[x>>2]|0)+1}c[z>>2]=0;while(1){if((c[z>>2]|0)>>>0>=2e4)break;c[A>>2]=(c[A>>2]|0)+1;c[x>>2]=0;while(1){E=e[16568+(c[x>>2]<<1)>>1]|0;c[y>>2]=E;if(!E)break;while(1){if(((c[(c[C>>2]|0)+(c[x>>2]<<2)>>2]|0)+(c[z>>2]|0)|0)>>>0<(c[y>>2]|0)>>>0)break;E=(c[C>>2]|0)+(c[x>>2]<<2)|0;c[E>>2]=(c[E>>2]|0)-(c[y>>2]|0)}if(!((c[(c[C>>2]|0)+(c[x>>2]<<2)>>2]|0)+(c[z>>2]|0)|0))break;c[x>>2]=(c[x>>2]|0)+1}if(!(c[y>>2]|0)){eo(c[s>>2]|0,c[r>>2]|0,c[z>>2]|0);c[B>>2]=(c[B>>2]|0)+1;go(c[t>>2]|0,c[s>>2]|0,1);So(c[w>>2]|0,c[u>>2]|0,c[t>>2]|0,c[s>>2]|0);if((vo(c[w>>2]|0,1)|0)==0?Bj(c[s>>2]|0,5,B)|0:0){if(!(mo(c[s>>2]|0,(c[k>>2]|0)-1-(c[n>>2]|0)|0)|0)){F=24;break}if(!(c[p>>2]|0)){F=28;break a}if(!(Db[c[p>>2]&7](c[q>>2]|0,c[s>>2]|0)|0)){F=28;break a}Aj(47)}E=(c[D>>2]|0)+1|0;c[D>>2]=E;if((E|0)==10){Aj(46);c[D>>2]=0}}c[z>>2]=(c[z>>2]|0)+2}if((F|0)==24){F=0;Aj(10);Ye(37578,i)}Aj(58)}if((F|0)==28){Dp(c[u>>2]|0);Dp(c[v>>2]|0);Dp(c[w>>2]|0);Dp(c[t>>2]|0);Dp(c[r>>2]|0);vf(c[C>>2]|0);l=h;return c[s>>2]|0}return 0}function Aj(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(!(c[17736]|0)){l=b;return}vb[c[17736]&15](c[17737]|0,37522,c[d>>2]|0,0,0);l=b;return}function Bj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+52|0;g=e+48|0;h=e+44|0;i=e+40|0;j=e+36|0;k=e+32|0;n=e+28|0;o=e+24|0;p=e+20|0;q=e+16|0;r=e+12|0;s=e+8|0;t=e+4|0;u=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=vp(c[(c[f>>2]|0)+4>>2]|0)|0;c[j>>2]=vp(c[(c[f>>2]|0)+4>>2]|0)|0;c[k>>2]=vp(c[(c[f>>2]|0)+4>>2]|0)|0;c[n>>2]=vp(c[(c[f>>2]|0)+4>>2]|0)|0;c[o>>2]=up(2)|0;c[t>>2]=0;c[u>>2]=lo(c[f>>2]|0)|0;if((c[g>>2]|0)<5)c[g>>2]=5;go(c[n>>2]|0,c[f>>2]|0,1);c[p>>2]=Ip(c[n>>2]|0)|0;c[s>>2]=Uo(c[p>>2]|0)|0;Do(c[p>>2]|0,c[p>>2]|0,c[s>>2]|0);c[q>>2]=0;a:while(1){if((c[q>>2]|0)>>>0>=(c[g>>2]|0)>>>0){v=22;break}d=c[h>>2]|0;c[d>>2]=(c[d>>2]|0)+1;d=c[i>>2]|0;if(c[q>>2]|0){Up(d,c[u>>2]|0,0);b=(mo(c[i>>2]|0,(c[u>>2]|0)-2|0)|0)!=0;oo(c[i>>2]|0,(c[u>>2]|0)-2|0);if(!b)qo(c[i>>2]|0,(c[u>>2]|0)-2|0);if((wo(c[i>>2]|0,c[n>>2]|0)|0)>=0){v=11;break}if((vo(c[i>>2]|0,1)|0)<=0){v=11;break}}else Op(d,2)|0;So(c[j>>2]|0,c[i>>2]|0,c[p>>2]|0,c[f>>2]|0);if(vo(c[j>>2]|0,1)|0?wo(c[j>>2]|0,c[n>>2]|0)|0:0){c[r>>2]=1;while(1){if((c[r>>2]|0)>>>0<(c[s>>2]|0)>>>0)w=(wo(c[j>>2]|0,c[n>>2]|0)|0)!=0;else w=0;x=c[j>>2]|0;if(!w)break;So(x,c[j>>2]|0,c[o>>2]|0,c[f>>2]|0);if(!(vo(c[j>>2]|0,1)|0)){v=23;break a}c[r>>2]=(c[r>>2]|0)+1}if(wo(x,c[n>>2]|0)|0){v=23;break}}Aj(43);c[q>>2]=(c[q>>2]|0)+1}if((v|0)==11)Se(37608,37680,951,37691);else if((v|0)==22){c[t>>2]=1;y=c[i>>2]|0;Dp(y);z=c[j>>2]|0;Dp(z);A=c[k>>2]|0;Dp(A);B=c[n>>2]|0;Dp(B);C=c[p>>2]|0;Dp(C);D=c[o>>2]|0;Dp(D);E=c[t>>2]|0;l=e;return E|0}else if((v|0)==23){y=c[i>>2]|0;Dp(y);z=c[j>>2]|0;Dp(z);A=c[k>>2]|0;Dp(A);B=c[n>>2]|0;Dp(B);C=c[p>>2]|0;Dp(C);D=c[o>>2]|0;Dp(D);E=c[t>>2]|0;l=e;return E|0}return 0}function Cj(a,b,d,f,g){a=a|0;b=b|0;d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;u=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=f;c[p>>2]=g;c[s>>2]=0;c[q>>2]=0;while(1){g=e[16568+(c[q>>2]<<1)>>1]|0;c[r>>2]=g;v=c[j>>2]|0;if(!g)break;if(Eo(v,c[r>>2]|0)|0){w=4;break}c[q>>2]=(c[q>>2]|0)+1}if((w|0)==4){c[i>>2]=((vo(c[j>>2]|0,c[r>>2]|0)|0)!=0^1)&1;x=c[i>>2]|0;l=h;return x|0}c[t>>2]=Lp(v)|0;c[u>>2]=Lp(c[j>>2]|0)|0;go(c[u>>2]|0,c[j>>2]|0,1);So(c[t>>2]|0,c[k>>2]|0,c[u>>2]|0,c[j>>2]|0);Dp(c[u>>2]|0);u=(vo(c[t>>2]|0,1)|0)!=0;Dp(c[t>>2]|0);if(u){Aj(46);c[i>>2]=0;x=c[i>>2]|0;l=h;return x|0}if(!(c[o>>2]|0?!(ub[c[o>>2]&63](c[p>>2]|0,2,c[j>>2]|0)|0):0))w=10;do if((w|0)==10?Bj(c[j>>2]|0,c[n>>2]|0,s)|0:0){if(c[o>>2]|0?(ub[c[o>>2]&63](c[p>>2]|0,1,c[j>>2]|0)|0)==0:0)break;c[i>>2]=1;x=c[i>>2]|0;l=h;return x|0}while(0);Aj(46);c[i>>2]=0;x=c[i>>2]|0;l=h;return x|0}function Dj(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;h=l;l=l+64|0;if((l|0)>=(m|0))$(64);i=h+60|0;j=h+56|0;k=h+52|0;n=h+48|0;o=h+44|0;p=h+40|0;q=h+36|0;r=h+32|0;s=h+28|0;t=h+24|0;u=h+20|0;v=h+16|0;w=h+12|0;x=h+8|0;y=h+4|0;z=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;if(!((c[j>>2]|0)!=0&(c[k>>2]|0)!=0&(c[n>>2]|0)!=0)){c[i>>2]=0;A=c[i>>2]|0;l=h;return A|0}if(c[o>>2]|0?mo(c[o>>2]|0,0)|0:0){c[r>>2]=Ej(c[k>>2]|0)|0;c[s>>2]=Ej(c[n>>2]|0)|0;c[t>>2]=Lp(c[j>>2]|0)|0;Qo(c[t>>2]|0,c[r>>2]|0,c[s>>2]|0);c[w>>2]=Lp(c[r>>2]|0)|0;Lo(c[w>>2]|0,c[s>>2]|0,c[r>>2]|0)|0;Qo(c[w>>2]|0,c[w>>2]|0,c[s>>2]|0);c[v>>2]=c[w>>2];c[w>>2]=Lp(c[s>>2]|0)|0;Lo(c[w>>2]|0,c[r>>2]|0,c[s>>2]|0)|0;Qo(c[w>>2]|0,c[w>>2]|0,c[r>>2]|0);ho(c[v>>2]|0,c[v>>2]|0,c[w>>2]|0);if(c[(c[v>>2]|0)+8>>2]|0)fo(c[v>>2]|0,c[v>>2]|0,c[t>>2]|0);c[u>>2]=c[w>>2];c[w>>2]=0;jo(c[u>>2]|0,c[v>>2]|0,c[j>>2]|0,c[t>>2]|0);fo(c[u>>2]|0,c[u>>2]|0,c[j>>2]|0);Dp(c[v>>2]|0);if((wo(c[u>>2]|0,c[j>>2]|0)|0)<0)fo(c[u>>2]|0,c[u>>2]|0,c[t>>2]|0);c[x>>2]=up(2)|0;c[y>>2]=Lp(c[u>>2]|0)|0;go(c[t>>2]|0,c[t>>2]|0,1);go(c[u>>2]|0,c[u>>2]|0,1);while(1){c[z>>2]=Fo(c[y>>2]|0,c[o>>2]|0,c[u>>2]|0)|0;eo(c[u>>2]|0,c[u>>2]|0,1);if(c[z>>2]|0){if(Cj(c[u>>2]|0,c[x>>2]|0,64,0,0)|0)break}else Aj(47);fo(c[u>>2]|0,c[u>>2]|0,c[t>>2]|0)}Dp(c[y>>2]|0);Dp(c[x>>2]|0);Dp(c[t>>2]|0);Aj(10);t=c[r>>2]|0;if(c[p>>2]|0)c[c[p>>2]>>2]=t;else Dp(t);t=c[s>>2]|0;if(c[q>>2]|0)c[c[q>>2]>>2]=t;else Dp(t);c[i>>2]=c[u>>2];A=c[i>>2]|0;l=h;return A|0}c[i>>2]=0;A=c[i>>2]|0;l=h;return A|0}function Ej(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=up(2)|0;c[f>>2]=Ip(c[d>>2]|0)|0;no(c[f>>2]|0,0);while(1){if(!((Cj(c[f>>2]|0,c[e>>2]|0,64,0,0)|0)!=0^1))break;eo(c[f>>2]|0,c[f>>2]|0,2)}Dp(c[e>>2]|0);l=b;return c[f>>2]|0}function Fj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+36|0;g=e+32|0;h=e+28|0;i=e+24|0;j=e+20|0;k=e+16|0;n=e+12|0;o=e+8|0;p=e+4|0;q=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=0;c[o>>2]=5;c[p>>2]=0;c[q>>2]=0;if(c[f>>2]|0)r=(Uf(c[f>>2]|0)|0)-1|0;else r=0;c[n>>2]=r;while(1){if((c[n>>2]|0)<=0)break;c[j>>2]=Xf(c[f>>2]|0,c[n>>2]|0,k)|0;a:do if(c[j>>2]|0)do switch(c[k>>2]|0){case 3:{if((Jv(c[j>>2]|0,37700,3)|0)==0&(c[o>>2]|0)==5){c[o>>2]=4;c[p>>2]=c[p>>2]|4;break a}if((Jv(c[j>>2]|0,37704,3)|0)==0&(c[o>>2]|0)==5){c[o>>2]=0;c[p>>2]=c[p>>2]|16;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 4:{if(!(Jv(c[j>>2]|0,37708,4)|0)){c[p>>2]=c[p>>2]|1024;break a}if((Jv(c[j>>2]|0,37713,4)|0)==0&(c[o>>2]|0)==5){c[o>>2]=3;c[p>>2]=c[p>>2]|4;break a}if(!(Jv(c[j>>2]|0,49930,4)|0)){c[o>>2]=0;c[p>>2]=c[p>>2]|8192;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 5:{if(!(Jv(c[j>>2]|0,49924,5)|0)){c[o>>2]=0;c[p>>2]=c[p>>2]|4096;break a}if((Jv(c[j>>2]|0,37718,5)|0)==0&(c[o>>2]|0)==5){c[o>>2]=1;c[p>>2]=c[p>>2]|4;break a}if(!(Jv(c[j>>2]|0,37724,5)|0)){c[p>>2]=c[p>>2]|512;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 6:{if(!(Jv(c[j>>2]|0,37730,6)|0)){c[p>>2]=c[p>>2]|2048;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 7:{if(!(Jv(c[j>>2]|0,37737,7)|0)){c[p>>2]=c[p>>2]|2;break a}if((Jv(c[j>>2]|0,37745,7)|0)==0|(c[q>>2]|0)!=0)break a;c[i>>2]=72;break a;break}case 8:{if(!(Jv(c[j>>2]|0,41808,8)|0)){c[p>>2]=c[p>>2]|64;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 9:{if((Jv(c[j>>2]|0,37753,9)|0)==0&(c[o>>2]|0)==5){c[o>>2]=2;c[p>>2]=c[p>>2]|4;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 10:{if(!(Jv(c[j>>2]|0,37763,10)|0)){c[q>>2]=1;break a}if(!(Jv(c[j>>2]|0,37774,10)|0)){c[p>>2]=c[p>>2]|16384;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 11:{if(!(Jv(c[j>>2]|0,37785,11)|0)){c[p>>2]=c[p>>2]|1;break a}if(!(Jv(c[j>>2]|0,37797,11)|0)){c[p>>2]=c[p>>2]|128;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}case 13:{if(!(Jv(c[j>>2]|0,37809,13)|0)){c[p>>2]=c[p>>2]|256;break a}if(!(Jv(c[j>>2]|0,48942,13)|0)){c[p>>2]=c[p>>2]|32;break a}if(c[q>>2]|0)break a;c[i>>2]=72;break a;break}default:{if(c[q>>2]|0)break a;c[i>>2]=72;break a}}while(0);while(0);c[n>>2]=(c[n>>2]|0)+-1}if(c[g>>2]|0)c[c[g>>2]>>2]=c[p>>2];if(!(c[h>>2]|0)){s=c[i>>2]|0;l=e;return s|0}c[c[h>>2]>>2]=c[o>>2];s=c[i>>2]|0;l=e;return s|0}function Gj(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+16|0;g=e+12|0;h=e+8|0;i=e+20|0;j=e+4|0;k=e;c[g>>2]=b;c[h>>2]=d;c[c[h>>2]>>2]=0;c[g>>2]=Tf(c[g>>2]|0,37823,0)|0;if(!(c[g>>2]|0)){c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}c[j>>2]=Xf(c[g>>2]|0,1,k)|0;if((c[j>>2]|0)==0|(c[k>>2]|0)>>>0>=49){Rf(c[g>>2]|0);c[f>>2]=65;n=c[f>>2]|0;l=e;return n|0}else{_w(i|0,c[j>>2]|0,c[k>>2]|0)|0;a[i+(c[k>>2]|0)>>0]=0;k=wv(i,0,0)|0;c[c[h>>2]>>2]=k;Rf(c[g>>2]|0);c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}return 0}function Hj(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+16|0;g=e+12|0;h=e+8|0;i=e+20|0;j=e+4|0;k=e;c[g>>2]=b;c[h>>2]=d;c[c[h>>2]>>2]=0;c[g>>2]=Tf(c[g>>2]|0,37829,0)|0;if(!(c[g>>2]|0)){c[c[h>>2]>>2]=65537;c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}c[j>>2]=Xf(c[g>>2]|0,1,k)|0;if((c[j>>2]|0)==0|(c[k>>2]|0)>>>0>=49){Rf(c[g>>2]|0);c[f>>2]=65;n=c[f>>2]|0;l=e;return n|0}else{_w(i|0,c[j>>2]|0,c[k>>2]|0)|0;a[i+(c[k>>2]|0)>>0]=0;k=wv(i,0,0)|0;c[c[h>>2]>>2]=k;Rf(c[g>>2]|0);c[f>>2]=0;n=c[f>>2]|0;l=e;return n|0}return 0}function Ij(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+32|0;h=f+28|0;i=f+24|0;j=f+20|0;k=f+16|0;n=f+12|0;o=f+8|0;p=f+4|0;q=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[n>>2]=0;c[o>>2]=0;c[p>>2]=0;c[c[i>>2]>>2]=0;if(c[j>>2]|0)c[c[j>>2]>>2]=0;c[n>>2]=Tf(c[g>>2]|0,37839,0)|0;do if(c[n>>2]|0){c[o>>2]=Vf(c[n>>2]|0,1)|0;if(!(c[o>>2]|0)){c[k>>2]=68;break}c[p>>2]=_f(c[o>>2]|0,0)|0;if(!(c[p>>2]|0)){c[k>>2]=65;break}if(!(Fu(c[p>>2]|0,47178)|0)){Rf(c[o>>2]|0);c[o>>2]=Vf(c[n>>2]|0,2)|0;if(!(c[o>>2]|0)){c[k>>2]=65;break}vf(c[p>>2]|0);c[p>>2]=_f(c[o>>2]|0,0)|0;if(!(c[p>>2]|0)){c[k>>2]=65;break}}c[q>>2]=0;while(1){if(!(c[(c[h>>2]|0)+(c[q>>2]<<2)>>2]|0))break;if(!(sv(c[p>>2]|0,c[(c[h>>2]|0)+(c[q>>2]<<2)>>2]|0)|0))break;c[q>>2]=(c[q>>2]|0)+1}if(!(c[(c[h>>2]|0)+(c[q>>2]<<2)>>2]|0)){c[k>>2]=70;break}if(c[j>>2]|0){if(!(Fu(c[p>>2]|0,49924)|0))c[c[j>>2]>>2]=4096;if(!(Fu(c[p>>2]|0,49930)|0))c[c[j>>2]>>2]=8192}c[c[i>>2]>>2]=c[o>>2];c[o>>2]=0;c[k>>2]=0}else c[k>>2]=65;while(0);vf(c[p>>2]|0);Rf(c[o>>2]|0);Rf(c[n>>2]|0);l=f;return c[k>>2]|0}function Jj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+44|0;h=f+40|0;i=f+36|0;j=f+32|0;k=f+28|0;n=f+24|0;o=f+20|0;p=f+16|0;q=f+12|0;r=f+8|0;s=f+4|0;t=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=0;c[n>>2]=0;c[o>>2]=0;c[p>>2]=0;c[r>>2]=0;c[c[i>>2]>>2]=0;c[n>>2]=Tf(c[g>>2]|0,40951,0)|0;do if(c[n>>2]|0){c[o>>2]=Vf(c[n>>2]|0,1)|0;if(!(c[o>>2]|0)){c[k>>2]=68;break}c[p>>2]=_f(c[o>>2]|0,0)|0;if(!(c[p>>2]|0)){c[k>>2]=65;break}if(!(Fu(c[p>>2]|0,47178)|0)){c[k>>2]=Fj(c[o>>2]|0,r,(c[j>>2]|0)+8|0)|0;if(c[k>>2]|0)break;if((c[(c[j>>2]|0)+8>>2]|0)==4){c[k>>2]=70;break}if((c[(c[j>>2]|0)+8>>2]|0)==3){Rf(c[o>>2]|0);c[o>>2]=Tf(c[n>>2]|0,37847,0)|0;if(c[o>>2]|0){c[t>>2]=Xf(c[o>>2]|0,1,q)|0;if(c[t>>2]|0){g=Kj(c[t>>2]|0,c[q>>2]|0)|0;c[(c[j>>2]|0)+16>>2]=g;if(!(c[(c[j>>2]|0)+16>>2]|0))c[k>>2]=5}else c[k>>2]=68;if(c[k>>2]|0)break}Rf(c[o>>2]|0);c[o>>2]=Tf(c[n>>2]|0,37857,0)|0;if(c[o>>2]|0){c[t>>2]=Xf(c[o>>2]|0,1,q)|0;do if(c[t>>2]|0){if((c[q>>2]|0)>>>0>0){g=pf(c[q>>2]|0)|0;c[(c[j>>2]|0)+20>>2]=g;if(c[(c[j>>2]|0)+20>>2]|0){_w(c[(c[j>>2]|0)+20>>2]|0,c[t>>2]|0,c[q>>2]|0)|0;c[(c[j>>2]|0)+24>>2]=c[q>>2];break}else{c[k>>2]=Et()|0;break}}}else c[k>>2]=68;while(0);if(c[k>>2]|0)break}}c[s>>2]=2;a:while(1){Rf(c[o>>2]|0);g=Vf(c[n>>2]|0,c[s>>2]|0)|0;c[o>>2]=g;if(!g)break;c[t>>2]=Xf(c[o>>2]|0,0,q)|0;if(!((c[q>>2]|0)==9?!(Jv(c[t>>2]|0,37847,9)|0):0))u=30;do if((u|0)==30){u=0;if((c[q>>2]|0)==5?(Jv(c[t>>2]|0,37857,5)|0)==0:0)break;if((c[q>>2]|0)!=15)break a;if(Jv(c[t>>2]|0,37863,15)|0)break a}while(0);c[s>>2]=(c[s>>2]|0)+1}if(!(c[o>>2]|0)){c[k>>2]=68;break}vf(c[p>>2]|0);c[p>>2]=_f(c[o>>2]|0,0)|0;if(!(c[p>>2]|0)){c[k>>2]=65;break}}else c[r>>2]=c[r>>2]|8;c[s>>2]=0;while(1){if(!(c[(c[h>>2]|0)+(c[s>>2]<<2)>>2]|0))break;if(!(sv(c[p>>2]|0,c[(c[h>>2]|0)+(c[s>>2]<<2)>>2]|0)|0))break;c[s>>2]=(c[s>>2]|0)+1}if(c[(c[h>>2]|0)+(c[s>>2]<<2)>>2]|0){c[c[i>>2]>>2]=c[o>>2];c[o>>2]=0;g=(c[j>>2]|0)+12|0;c[g>>2]=c[g>>2]|c[r>>2];c[k>>2]=0;break}else{c[k>>2]=70;break}}else c[k>>2]=65;while(0);vf(c[p>>2]|0);Rf(c[o>>2]|0);Rf(c[n>>2]|0);l=f;return c[k>>2]|0}function Kj(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=b;c[g>>2]=d;c[i>>2]=0;while(1){if(!(c[4400+(c[i>>2]<<3)>>2]|0))break;d=hv(c[4400+(c[i>>2]<<3)>>2]|0)|0;if((d|0)==(c[g>>2]|0)?(Jv(c[4400+(c[i>>2]<<3)>>2]|0,c[f>>2]|0,c[g>>2]|0)|0)==0:0)break;c[i>>2]=(c[i>>2]|0)+1}if(c[4400+(c[i>>2]<<3)>>2]|0){c[h>>2]=c[4400+(c[i>>2]<<3)+4>>2];k=c[h>>2]|0;l=e;return k|0}c[j>>2]=pf((c[g>>2]|0)+1|0)|0;if(c[j>>2]|0){_w(c[j>>2]|0,c[f>>2]|0,c[g>>2]|0)|0;a[(c[j>>2]|0)+(c[g>>2]|0)>>0]=0;c[h>>2]=Li(c[j>>2]|0)|0;vf(c[j>>2]|0);k=c[h>>2]|0;l=e;return k|0}else{c[h>>2]=0;k=c[h>>2]|0;l=e;return k|0}return 0}function Lj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[c[f>>2]>>2]=c[g>>2];c[(c[f>>2]|0)+4>>2]=c[h>>2];c[(c[f>>2]|0)+8>>2]=5;c[(c[f>>2]|0)+12>>2]=0;c[(c[f>>2]|0)+16>>2]=2;c[(c[f>>2]|0)+20>>2]=0;c[(c[f>>2]|0)+24>>2]=0;c[(c[f>>2]|0)+28>>2]=20;c[(c[f>>2]|0)+32>>2]=0;c[(c[f>>2]|0)+36>>2]=0;l=e;return}function Mj(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;vf(c[(c[d>>2]|0)+20>>2]|0);l=b;return} -function gq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+24|0;u=i+20|0;v=i+16|0;w=i+12|0;x=i+8|0;y=i+4|0;z=i;A=i+60|0;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;c[u>>2]=c[(c[(c[k>>2]|0)+12>>2]|0)+20>>2];c[v>>2]=c[(c[(c[k>>2]|0)+12>>2]|0)+36>>2];c[w>>2]=((c[q>>2]|0)>>>0)/((c[u>>2]|0)>>>0)|0;if((c[o>>2]|0)>>>0<(c[(c[k>>2]|0)+52>>2]&8|0?c[u>>2]|0:c[q>>2]|0)>>>0){c[j>>2]=200;B=c[j>>2]|0;l=i;return B|0}do if(((c[q>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0|0){if((c[q>>2]|0)>>>0>(c[u>>2]|0)>>>0?c[(c[k>>2]|0)+52>>2]&4|0:0)break;c[j>>2]=139;B=c[j>>2]|0;l=i;return B|0}while(0);c[x>>2]=0;if((c[(c[k>>2]|0)+52>>2]&4|0?(c[q>>2]|0)>>>0>(c[u>>2]|0)>>>0:0)?(((c[q>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0|0)==0:0)c[w>>2]=(c[w>>2]|0)+-1;o=c[k>>2]|0;if(c[(c[k>>2]|0)+20+8>>2]|0){Cb[c[o+20+8>>2]&1]((c[k>>2]|0)+496|0,(c[k>>2]|0)+64|0,c[n>>2]|0,c[p>>2]|0,c[w>>2]|0,c[(c[k>>2]|0)+52>>2]&8);h=S(c[w>>2]|0,c[u>>2]|0)|0;c[p>>2]=(c[p>>2]|0)+h;if(!(c[(c[k>>2]|0)+52>>2]&8)){h=S(c[w>>2]|0,c[u>>2]|0)|0;c[n>>2]=(c[n>>2]|0)+h}}else{c[s>>2]=o+64;c[r>>2]=0;while(1){if((c[r>>2]|0)>>>0>=(c[w>>2]|0)>>>0)break;hq(c[n>>2]|0,c[p>>2]|0,c[s>>2]|0,c[u>>2]|0);c[y>>2]=ub[c[v>>2]&63]((c[k>>2]|0)+496|0,c[n>>2]|0,c[n>>2]|0)|0;c[x>>2]=(c[y>>2]|0)>>>0>(c[x>>2]|0)>>>0?c[y>>2]|0:c[x>>2]|0;c[s>>2]=c[n>>2];c[p>>2]=(c[p>>2]|0)+(c[u>>2]|0);if(!(c[(c[k>>2]|0)+52>>2]&8))c[n>>2]=(c[n>>2]|0)+(c[u>>2]|0);c[r>>2]=(c[r>>2]|0)+1}if((c[s>>2]|0)!=((c[k>>2]|0)+64|0))iq((c[k>>2]|0)+64|0,c[s>>2]|0,c[u>>2]|0)}if(c[(c[k>>2]|0)+52>>2]&4|0?(c[q>>2]|0)>>>0>(c[u>>2]|0)>>>0:0){if(!(((c[q>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0))c[z>>2]=c[u>>2];else c[z>>2]=((c[q>>2]|0)>>>0)%((c[u>>2]|0)>>>0)|0;c[n>>2]=(c[n>>2]|0)+(0-(c[u>>2]|0));c[s>>2]=(c[k>>2]|0)+64;c[t>>2]=0;while(1){if((c[t>>2]|0)>>>0>=(c[z>>2]|0)>>>0)break;a[A>>0]=a[(c[p>>2]|0)+(c[t>>2]|0)>>0]|0;a[(c[n>>2]|0)+((c[u>>2]|0)+(c[t>>2]|0))>>0]=a[(c[n>>2]|0)+(c[t>>2]|0)>>0]|0;q=d[A>>0]|0;r=c[s>>2]|0;c[s>>2]=r+1;a[(c[n>>2]|0)+(c[t>>2]|0)>>0]=q^(d[r>>0]|0);c[t>>2]=(c[t>>2]|0)+1}while(1){if((c[t>>2]|0)>>>0>=(c[u>>2]|0)>>>0)break;A=c[s>>2]|0;c[s>>2]=A+1;a[(c[n>>2]|0)+(c[t>>2]|0)>>0]=0^(d[A>>0]|0);c[t>>2]=(c[t>>2]|0)+1}c[y>>2]=ub[c[v>>2]&63]((c[k>>2]|0)+496|0,c[n>>2]|0,c[n>>2]|0)|0;c[x>>2]=(c[y>>2]|0)>>>0>(c[x>>2]|0)>>>0?c[y>>2]|0:c[x>>2]|0;iq((c[k>>2]|0)+64|0,c[n>>2]|0,c[u>>2]|0)}if((c[x>>2]|0)>>>0>0){bf((c[x>>2]|0)+16|0);cf()}c[j>>2]=0;B=c[j>>2]|0;l=i;return B|0}function hq(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function iq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=c[h>>2];c[f>>2]=3;if(!((c[j>>2]|c[k>>2])&3)){c[n>>2]=c[j>>2];c[o>>2]=c[k>>2];while(1){if((c[i>>2]|0)>>>0<4)break;h=c[o>>2]|0;c[o>>2]=h+4;g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;c[i>>2]=(c[i>>2]|0)-4}c[j>>2]=c[n>>2];c[k>>2]=c[o>>2]}while(1){if(!(c[i>>2]|0))break;o=c[k>>2]|0;c[k>>2]=o+1;n=a[o>>0]|0;o=c[j>>2]|0;c[j>>2]=o+1;a[o>>0]=n;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function jq(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;h=l;l=l+64|0;if((l|0)>=(m|0))$(64);i=h+52|0;j=h+48|0;k=h+44|0;n=h+40|0;o=h+36|0;p=h+32|0;q=h+28|0;r=h+24|0;s=h+20|0;t=h+16|0;u=h+12|0;v=h+8|0;w=h+4|0;x=h;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[s>>2]=c[(c[(c[j>>2]|0)+12>>2]|0)+20>>2];c[t>>2]=c[(c[(c[j>>2]|0)+12>>2]|0)+40>>2];c[u>>2]=((c[p>>2]|0)>>>0)/((c[s>>2]|0)>>>0)|0;if((c[n>>2]|0)>>>0<(c[p>>2]|0)>>>0){c[i>>2]=200;y=c[i>>2]|0;l=h;return y|0}do if(((c[p>>2]|0)>>>0)%((c[s>>2]|0)>>>0)|0|0){if((c[p>>2]|0)>>>0>(c[s>>2]|0)>>>0?c[(c[j>>2]|0)+52>>2]&4|0:0)break;c[i>>2]=139;y=c[i>>2]|0;l=h;return y|0}while(0);c[v>>2]=0;if(c[(c[j>>2]|0)+52>>2]&4|0?(c[p>>2]|0)>>>0>(c[s>>2]|0)>>>0:0){c[u>>2]=(c[u>>2]|0)+-1;if(!(((c[p>>2]|0)>>>0)%((c[s>>2]|0)>>>0)|0))c[u>>2]=(c[u>>2]|0)+-1;iq((c[j>>2]|0)+96|0,(c[j>>2]|0)+64|0,c[s>>2]|0)}a:do if(c[(c[j>>2]|0)+20+12>>2]|0){vb[c[(c[j>>2]|0)+20+12>>2]&15]((c[j>>2]|0)+496|0,(c[j>>2]|0)+64|0,c[k>>2]|0,c[o>>2]|0,c[u>>2]|0);n=S(c[u>>2]|0,c[s>>2]|0)|0;c[o>>2]=(c[o>>2]|0)+n;n=S(c[u>>2]|0,c[s>>2]|0)|0;c[k>>2]=(c[k>>2]|0)+n}else{c[q>>2]=0;while(1){if((c[q>>2]|0)>>>0>=(c[u>>2]|0)>>>0)break a;c[w>>2]=ub[c[t>>2]&63]((c[j>>2]|0)+496|0,(c[j>>2]|0)+96|0,c[o>>2]|0)|0;c[v>>2]=(c[w>>2]|0)>>>0>(c[v>>2]|0)>>>0?c[w>>2]|0:c[v>>2]|0;kq(c[k>>2]|0,(c[j>>2]|0)+96|0,(c[j>>2]|0)+64|0,c[o>>2]|0,c[s>>2]|0);c[o>>2]=(c[o>>2]|0)+(c[s>>2]|0);c[k>>2]=(c[k>>2]|0)+(c[s>>2]|0);c[q>>2]=(c[q>>2]|0)+1}}while(0);if(c[(c[j>>2]|0)+52>>2]&4|0?(c[p>>2]|0)>>>0>(c[s>>2]|0)>>>0:0){if(!(((c[p>>2]|0)>>>0)%((c[s>>2]|0)>>>0)|0))c[x>>2]=c[s>>2];else c[x>>2]=((c[p>>2]|0)>>>0)%((c[s>>2]|0)>>>0)|0;iq((c[j>>2]|0)+96|0,(c[j>>2]|0)+64|0,c[s>>2]|0);iq((c[j>>2]|0)+64|0,(c[o>>2]|0)+(c[s>>2]|0)|0,c[x>>2]|0);c[w>>2]=ub[c[t>>2]&63]((c[j>>2]|0)+496|0,c[k>>2]|0,c[o>>2]|0)|0;c[v>>2]=(c[w>>2]|0)>>>0>(c[v>>2]|0)>>>0?c[w>>2]|0:c[v>>2]|0;hq(c[k>>2]|0,c[k>>2]|0,(c[j>>2]|0)+64|0,c[x>>2]|0);iq((c[k>>2]|0)+(c[s>>2]|0)|0,c[k>>2]|0,c[x>>2]|0);c[r>>2]=c[x>>2];while(1){if((c[r>>2]|0)>>>0>=(c[s>>2]|0)>>>0)break;a[(c[j>>2]|0)+64+(c[r>>2]|0)>>0]=a[(c[k>>2]|0)+(c[r>>2]|0)>>0]|0;c[r>>2]=(c[r>>2]|0)+1}c[w>>2]=ub[c[t>>2]&63]((c[j>>2]|0)+496|0,c[k>>2]|0,(c[j>>2]|0)+64|0)|0;c[v>>2]=(c[w>>2]|0)>>>0>(c[v>>2]|0)>>>0?c[w>>2]|0:c[v>>2]|0;hq(c[k>>2]|0,c[k>>2]|0,(c[j>>2]|0)+96|0,c[s>>2]|0)}if((c[v>>2]|0)>>>0>0){bf((c[v>>2]|0)+16|0);cf()}c[i>>2]=0;y=c[i>>2]|0;l=h;return y|0}function kq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+24|0;u=i+60|0;v=i+20|0;w=i+16|0;x=i+12|0;y=i+8|0;z=i+4|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[k>>2];c[t>>2]=c[o>>2];c[i>>2]=3;if(!((c[t>>2]|c[s>>2]|c[q>>2]|c[r>>2])&3)){c[v>>2]=c[q>>2];c[y>>2]=c[s>>2];c[w>>2]=c[r>>2];c[x>>2]=c[t>>2];while(1){if((c[p>>2]|0)>>>0<4)break;o=c[x>>2]|0;c[x>>2]=o+4;c[z>>2]=c[o>>2];o=c[c[w>>2]>>2]|0;k=c[y>>2]|0;c[y>>2]=k+4;n=o^c[k>>2];k=c[v>>2]|0;c[v>>2]=k+4;c[k>>2]=n;n=c[z>>2]|0;k=c[w>>2]|0;c[w>>2]=k+4;c[k>>2]=n;c[p>>2]=(c[p>>2]|0)-4}c[q>>2]=c[v>>2];c[s>>2]=c[y>>2];c[r>>2]=c[w>>2];c[t>>2]=c[x>>2]}while(1){if(!(c[p>>2]|0))break;x=c[t>>2]|0;c[t>>2]=x+1;a[u>>0]=a[x>>0]|0;x=d[c[r>>2]>>0]|0;w=c[s>>2]|0;c[s>>2]=w+1;y=(x^(d[w>>0]|0))&255;w=c[q>>2]|0;c[q>>2]=w+1;a[w>>0]=y;y=a[u>>0]|0;w=c[r>>2]|0;c[r>>2]=w+1;a[w>>0]=y;c[p>>2]=(c[p>>2]|0)+-1}l=i;return}function lq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;n=f;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=15-(c[j>>2]|0);c[n>>2]=(c[k>>2]|0)-1;if(!(c[i>>2]|0)){c[g>>2]=45;o=c[g>>2]|0;l=f;return o|0}if((c[k>>2]|0)>>>0<2|(c[k>>2]|0)>>>0>8){c[g>>2]=139;o=c[g>>2]|0;l=f;return o|0}else{Uw((c[h>>2]|0)+128|0,0,368)|0;c[(c[h>>2]|0)+56>>2]=0;e=(c[h>>2]|0)+64|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;e=(c[h>>2]|0)+80|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;e=(c[h>>2]|0)+96|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[(c[h>>2]|0)+112>>2]=0;a[(c[h>>2]|0)+80>>0]=c[n>>2];_w((c[h>>2]|0)+80+1|0,c[i>>2]|0,c[j>>2]|0)|0;Uw((c[h>>2]|0)+80+(1+(c[j>>2]|0))|0,0,c[k>>2]|0)|0;a[(c[h>>2]|0)+64>>0]=c[n>>2];_w((c[h>>2]|0)+64+1|0,c[i>>2]|0,c[j>>2]|0)|0;Uw((c[h>>2]|0)+64+(1+(c[j>>2]|0))|0,0,c[k>>2]|0)|0;k=(c[h>>2]|0)+128+56|0;a[k>>0]=a[k>>0]&-2|1;c[g>>2]=0;o=c[g>>2]|0;l=f;return o|0}return 0}function mq(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;h=l;l=l+96|0;if((l|0)>=(m|0))$(96);i=h+64|0;j=h+60|0;k=h+56|0;n=h+52|0;o=h+48|0;p=h+40|0;q=h+72|0;r=h+36|0;s=h+32|0;t=h+28|0;u=h+24|0;v=h+20|0;w=h+16|0;x=h+68|0;y=h;z=h+12|0;A=h+8|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[h+44>>2]=16;c[p>>2]=c[(c[(c[j>>2]|0)+12>>2]|0)+36>>2];c[r>>2]=0;c[s>>2]=c[(c[j>>2]|0)+128+36>>2];if((c[n>>2]|0)==0?!((c[s>>2]|0)!=0&(c[o>>2]|0)!=0):0){c[i>>2]=0;B=c[i>>2]|0;l=h;return B|0}a:do{b:do if((c[s>>2]|0)>>>0>0?1:((c[n>>2]|0)+(c[s>>2]|0)|0)>>>0<16)while(1){if(!(c[n>>2]|0?(c[s>>2]|0)>>>0<16:0))break b;g=c[k>>2]|0;c[k>>2]=g+1;f=a[g>>0]|0;g=c[s>>2]|0;c[s>>2]=g+1;a[(c[j>>2]|0)+128+20+g>>0]=f;c[n>>2]=(c[n>>2]|0)+-1}while(0);c:do if(!(c[n>>2]|0)){if(!(c[o>>2]|0))break a;while(1){if((c[s>>2]|0)>>>0>=16)break c;f=c[s>>2]|0;c[s>>2]=f+1;a[(c[j>>2]|0)+128+20+f>>0]=0}}while(0);if((c[s>>2]|0)>>>0>0){nq((c[j>>2]|0)+64|0,(c[j>>2]|0)+64|0,(c[j>>2]|0)+128+20|0,16);c[u>>2]=ub[c[p>>2]&63]((c[j>>2]|0)+496|0,(c[j>>2]|0)+64|0,(c[j>>2]|0)+64|0)|0;c[r>>2]=(c[r>>2]|0)>>>0>(c[u>>2]|0)>>>0?c[r>>2]|0:c[u>>2]|0;c[s>>2]=0}d:do if(c[(c[j>>2]|0)+20+8>>2]|0){c[t>>2]=((c[n>>2]|0)>>>0)/16|0;Cb[c[(c[j>>2]|0)+20+8>>2]&1]((c[j>>2]|0)+496|0,(c[j>>2]|0)+64|0,q,c[k>>2]|0,c[t>>2]|0,1);c[k>>2]=(c[k>>2]|0)+(c[t>>2]<<4);c[n>>2]=(c[n>>2]|0)-(c[t>>2]<<4);c[v>>2]=q;c[w>>2]=16;a[x>>0]=0;f=y;c[f>>2]=d[x>>0];c[f+4>>2]=0;while(1){if(!(c[v>>2]&7|0?(c[w>>2]|0)!=0:0))break;a[c[v>>2]>>0]=a[x>>0]|0;c[v>>2]=(c[v>>2]|0)+1;c[w>>2]=(c[w>>2]|0)+-1}if((c[w>>2]|0)>>>0>=8){f=y;g=gx(c[f>>2]|0,c[f+4>>2]|0,16843009,16843009)|0;f=y;c[f>>2]=g;c[f+4>>2]=D;do{c[z>>2]=c[v>>2];f=y;g=c[f+4>>2]|0;e=c[z>>2]|0;c[e>>2]=c[f>>2];c[e+4>>2]=g;c[w>>2]=(c[w>>2]|0)-8;c[v>>2]=(c[v>>2]|0)+8}while((c[w>>2]|0)>>>0>=8)}while(1){if(!(c[w>>2]|0))break d;a[c[v>>2]>>0]=a[x>>0]|0;c[v>>2]=(c[v>>2]|0)+1;c[w>>2]=(c[w>>2]|0)+-1}}else while(1){if((c[n>>2]|0)>>>0<16)break d;nq((c[j>>2]|0)+64|0,(c[j>>2]|0)+64|0,c[k>>2]|0,16);c[A>>2]=ub[c[p>>2]&63]((c[j>>2]|0)+496|0,(c[j>>2]|0)+64|0,(c[j>>2]|0)+64|0)|0;c[r>>2]=(c[r>>2]|0)>>>0>(c[A>>2]|0)>>>0?c[r>>2]|0:c[A>>2]|0;c[n>>2]=(c[n>>2]|0)-16;c[k>>2]=(c[k>>2]|0)+16}while(0)}while((c[n>>2]|0)>>>0>0);c[(c[j>>2]|0)+128+36>>2]=c[s>>2];if(c[r>>2]|0)c[r>>2]=(c[r>>2]|0)+16;c[i>>2]=c[r>>2];B=c[i>>2]|0;l=h;return B|0}function nq(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function oq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+24|0;k=i+20|0;n=i+16|0;o=i+12|0;p=i+8|0;q=i+4|0;r=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[o>>2]|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;s=c[j>>2]|0;l=i;return s|0}if(((a[(c[k>>2]|0)+128+56>>0]&1|0?((d[(c[k>>2]|0)+56>>0]|0)>>>2&1|0)==0:0)?(d[(c[k>>2]|0)+128+56>>0]|0)>>>1&1|0:0)?(h=(c[k>>2]|0)+128+8|0,g=c[h+4>>2]|0,!(g>>>0>0|(g|0)==0&(c[h>>2]|0)>>>0>0)):0){h=(c[k>>2]|0)+128|0;g=c[h+4>>2]|0;if(0>g>>>0|(0==(g|0)?(c[q>>2]|0)>>>0>(c[h>>2]|0)>>>0:0)){c[j>>2]=139;s=c[j>>2]|0;l=i;return s|0}h=(c[k>>2]|0)+128|0;g=h;f=Tw(c[g>>2]|0,c[g+4>>2]|0,c[q>>2]|0,0)|0;g=h;c[g>>2]=f;c[g+4>>2]=D;c[r>>2]=mq(c[k>>2]|0,c[p>>2]|0,c[q>>2]|0,0)|0;if(c[r>>2]|0){bf((c[r>>2]|0)+20|0);cf()}c[j>>2]=yq(c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0)|0;s=c[j>>2]|0;l=i;return s|0}c[j>>2]=156;s=c[j>>2]|0;l=i;return s|0}function pq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+28|0;k=i+24|0;n=i+20|0;o=i+16|0;p=i+12|0;q=i+8|0;r=i+4|0;s=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[o>>2]|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;t=c[j>>2]|0;l=i;return t|0}if(((a[(c[k>>2]|0)+128+56>>0]&1|0?((d[(c[k>>2]|0)+56>>0]|0)>>>2&1|0)==0:0)?(d[(c[k>>2]|0)+128+56>>0]|0)>>>1&1|0:0)?(h=(c[k>>2]|0)+128+8|0,g=c[h+4>>2]|0,!(g>>>0>0|(g|0)==0&(c[h>>2]|0)>>>0>0)):0){h=(c[k>>2]|0)+128|0;g=c[h+4>>2]|0;if(0>g>>>0|(0==(g|0)?(c[q>>2]|0)>>>0>(c[h>>2]|0)>>>0:0)){c[j>>2]=139;t=c[j>>2]|0;l=i;return t|0}c[r>>2]=yq(c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0)|0;if(c[r>>2]|0){c[j>>2]=c[r>>2];t=c[j>>2]|0;l=i;return t|0}p=(c[k>>2]|0)+128|0;o=p;h=Tw(c[o>>2]|0,c[o+4>>2]|0,c[q>>2]|0,0)|0;o=p;c[o>>2]=h;c[o+4>>2]=D;c[s>>2]=mq(c[k>>2]|0,c[n>>2]|0,c[q>>2]|0,0)|0;if(c[s>>2]|0){bf((c[s>>2]|0)+20|0);cf()}c[j>>2]=c[r>>2];t=c[j>>2]|0;l=i;return t|0}c[j>>2]=156;t=c[j>>2]|0;l=i;return t|0}function qq(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;g=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=g+48|0;i=g+44|0;j=g+40|0;k=g+36|0;n=g+32|0;o=g+28|0;p=g+24|0;q=g+20|0;r=g+16|0;s=g+12|0;t=g+8|0;u=g+4|0;v=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[q>>2]=c[(c[(c[i>>2]|0)+12>>2]|0)+36>>2];c[r>>2]=c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2];c[s>>2]=(c[r>>2]|0)+(c[r>>2]|0);if((c[k>>2]|0)>>>0<(c[o>>2]|0)>>>0){c[h>>2]=200;w=c[h>>2]|0;l=g;return w|0}if((c[o>>2]|0)>>>0<=(c[(c[i>>2]|0)+112>>2]|0)>>>0){c[p>>2]=(c[i>>2]|0)+64+(c[r>>2]|0)+(0-(c[(c[i>>2]|0)+112>>2]|0));rq(c[j>>2]|0,c[p>>2]|0,c[n>>2]|0,c[o>>2]|0);k=(c[i>>2]|0)+112|0;c[k>>2]=(c[k>>2]|0)-(c[o>>2]|0);c[h>>2]=0;w=c[h>>2]|0;l=g;return w|0}c[t>>2]=0;if(c[(c[i>>2]|0)+112>>2]|0){c[o>>2]=(c[o>>2]|0)-(c[(c[i>>2]|0)+112>>2]|0);c[p>>2]=(c[i>>2]|0)+64+(c[r>>2]|0)+(0-(c[(c[i>>2]|0)+112>>2]|0));rq(c[j>>2]|0,c[p>>2]|0,c[n>>2]|0,c[(c[i>>2]|0)+112>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[(c[i>>2]|0)+112>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[(c[i>>2]|0)+112>>2]|0);c[(c[i>>2]|0)+112>>2]=0}if((c[o>>2]|0)>>>0>=(c[s>>2]|0)>>>0?c[(c[i>>2]|0)+20>>2]|0:0){c[v>>2]=((c[o>>2]|0)>>>0)/((c[r>>2]|0)>>>0)|0;vb[c[(c[i>>2]|0)+20>>2]&15]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,c[j>>2]|0,c[n>>2]|0,c[v>>2]|0);p=S(c[v>>2]|0,c[r>>2]|0)|0;c[j>>2]=(c[j>>2]|0)+p;p=S(c[v>>2]|0,c[r>>2]|0)|0;c[n>>2]=(c[n>>2]|0)+p;p=S(c[v>>2]|0,c[r>>2]|0)|0;c[o>>2]=(c[o>>2]|0)-p}else x=10;a:do if((x|0)==10)while(1){x=0;if((c[o>>2]|0)>>>0<(c[s>>2]|0)>>>0)break a;c[u>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[t>>2]=(c[u>>2]|0)>>>0>(c[t>>2]|0)>>>0?c[u>>2]|0:c[t>>2]|0;rq(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[r>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[o>>2]=(c[o>>2]|0)-(c[r>>2]|0);x=10}while(0);if((c[o>>2]|0)>>>0>=(c[r>>2]|0)>>>0){sq((c[i>>2]|0)+96|0,(c[i>>2]|0)+64|0,c[r>>2]|0);c[u>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[t>>2]=(c[u>>2]|0)>>>0>(c[t>>2]|0)>>>0?c[u>>2]|0:c[t>>2]|0;rq(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[r>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[o>>2]=(c[o>>2]|0)-(c[r>>2]|0)}if(c[o>>2]|0){sq((c[i>>2]|0)+96|0,(c[i>>2]|0)+64|0,c[r>>2]|0);c[u>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[t>>2]=(c[u>>2]|0)>>>0>(c[t>>2]|0)>>>0?c[u>>2]|0:c[t>>2]|0;c[(c[i>>2]|0)+112>>2]=c[r>>2];r=(c[i>>2]|0)+112|0;c[r>>2]=(c[r>>2]|0)-(c[o>>2]|0);rq(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[o>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[o>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);c[o>>2]=0}if((c[t>>2]|0)>>>0>0){bf((c[t>>2]|0)+16|0);cf()}c[h>>2]=0;w=c[h>>2]|0;l=g;return w|0}function rq(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[q>>2]|c[o>>2]|c[p>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[t>>2]|0;c[t>>2]=k+4;j=c[k>>2]|0;k=c[s>>2]|0;c[s>>2]=k+4;i=c[k>>2]^j;c[k>>2]=i;k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[q>>2]|0;c[q>>2]=t+1;s=d[t>>0]|0;t=c[p>>2]|0;c[p>>2]=t+1;r=((d[t>>0]|0)^s)&255;a[t>>0]=r;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function sq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=c[h>>2];c[f>>2]=3;if(!((c[j>>2]|c[k>>2])&3)){c[n>>2]=c[j>>2];c[o>>2]=c[k>>2];while(1){if((c[i>>2]|0)>>>0<4)break;h=c[o>>2]|0;c[o>>2]=h+4;g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;c[i>>2]=(c[i>>2]|0)-4}c[j>>2]=c[n>>2];c[k>>2]=c[o>>2]}while(1){if(!(c[i>>2]|0))break;o=c[k>>2]|0;c[k>>2]=o+1;n=a[o>>0]|0;o=c[j>>2]|0;c[j>>2]=o+1;a[o>>0]=n;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function tq(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;g=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=g+48|0;i=g+44|0;j=g+40|0;k=g+36|0;n=g+32|0;o=g+28|0;p=g+24|0;q=g+20|0;r=g+16|0;s=g+12|0;t=g+8|0;u=g+4|0;v=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[q>>2]=c[(c[(c[i>>2]|0)+12>>2]|0)+36>>2];c[r>>2]=c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2];c[s>>2]=(c[r>>2]|0)+(c[r>>2]|0);if((c[k>>2]|0)>>>0<(c[o>>2]|0)>>>0){c[h>>2]=200;w=c[h>>2]|0;l=g;return w|0}if((c[o>>2]|0)>>>0<=(c[(c[i>>2]|0)+112>>2]|0)>>>0){c[p>>2]=(c[i>>2]|0)+64+(c[r>>2]|0)+(0-(c[(c[i>>2]|0)+112>>2]|0));uq(c[j>>2]|0,c[p>>2]|0,c[n>>2]|0,c[o>>2]|0);k=(c[i>>2]|0)+112|0;c[k>>2]=(c[k>>2]|0)-(c[o>>2]|0);c[h>>2]=0;w=c[h>>2]|0;l=g;return w|0}c[t>>2]=0;if(c[(c[i>>2]|0)+112>>2]|0){c[o>>2]=(c[o>>2]|0)-(c[(c[i>>2]|0)+112>>2]|0);c[p>>2]=(c[i>>2]|0)+64+(c[r>>2]|0)+(0-(c[(c[i>>2]|0)+112>>2]|0));uq(c[j>>2]|0,c[p>>2]|0,c[n>>2]|0,c[(c[i>>2]|0)+112>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[(c[i>>2]|0)+112>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[(c[i>>2]|0)+112>>2]|0);c[(c[i>>2]|0)+112>>2]=0}if((c[o>>2]|0)>>>0>=(c[s>>2]|0)>>>0?c[(c[i>>2]|0)+20+4>>2]|0:0){c[v>>2]=((c[o>>2]|0)>>>0)/((c[r>>2]|0)>>>0)|0;vb[c[(c[i>>2]|0)+20+4>>2]&15]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,c[j>>2]|0,c[n>>2]|0,c[v>>2]|0);p=S(c[v>>2]|0,c[r>>2]|0)|0;c[j>>2]=(c[j>>2]|0)+p;p=S(c[v>>2]|0,c[r>>2]|0)|0;c[n>>2]=(c[n>>2]|0)+p;p=S(c[v>>2]|0,c[r>>2]|0)|0;c[o>>2]=(c[o>>2]|0)-p}else x=10;a:do if((x|0)==10)while(1){x=0;if((c[o>>2]|0)>>>0<(c[s>>2]|0)>>>0)break a;c[u>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[t>>2]=(c[u>>2]|0)>>>0>(c[t>>2]|0)>>>0?c[u>>2]|0:c[t>>2]|0;uq(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[r>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[o>>2]=(c[o>>2]|0)-(c[r>>2]|0);x=10}while(0);if((c[o>>2]|0)>>>0>=(c[r>>2]|0)>>>0){sq((c[i>>2]|0)+96|0,(c[i>>2]|0)+64|0,c[r>>2]|0);c[u>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[t>>2]=(c[u>>2]|0)>>>0>(c[t>>2]|0)>>>0?c[u>>2]|0:c[t>>2]|0;uq(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[r>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[o>>2]=(c[o>>2]|0)-(c[r>>2]|0)}if(c[o>>2]|0){sq((c[i>>2]|0)+96|0,(c[i>>2]|0)+64|0,c[r>>2]|0);c[u>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[t>>2]=(c[u>>2]|0)>>>0>(c[t>>2]|0)>>>0?c[u>>2]|0:c[t>>2]|0;c[(c[i>>2]|0)+112>>2]=c[r>>2];r=(c[i>>2]|0)+112|0;c[r>>2]=(c[r>>2]|0)-(c[o>>2]|0);uq(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[o>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[o>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);c[o>>2]=0}if((c[t>>2]|0)>>>0>0){bf((c[t>>2]|0)+16|0);cf()}c[h>>2]=0;w=c[h>>2]|0;l=g;return w|0}function uq(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;vq(c[g>>2]|0,c[i>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}function vq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+24|0;u=i+60|0;v=i+20|0;w=i+16|0;x=i+12|0;y=i+8|0;z=i+4|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[k>>2];c[t>>2]=c[o>>2];c[i>>2]=3;if(!((c[t>>2]|c[s>>2]|c[q>>2]|c[r>>2])&3)){c[v>>2]=c[q>>2];c[y>>2]=c[s>>2];c[w>>2]=c[r>>2];c[x>>2]=c[t>>2];while(1){if((c[p>>2]|0)>>>0<4)break;o=c[x>>2]|0;c[x>>2]=o+4;c[z>>2]=c[o>>2];o=c[c[w>>2]>>2]|0;k=c[y>>2]|0;c[y>>2]=k+4;n=o^c[k>>2];k=c[v>>2]|0;c[v>>2]=k+4;c[k>>2]=n;n=c[z>>2]|0;k=c[w>>2]|0;c[w>>2]=k+4;c[k>>2]=n;c[p>>2]=(c[p>>2]|0)-4}c[q>>2]=c[v>>2];c[s>>2]=c[y>>2];c[r>>2]=c[w>>2];c[t>>2]=c[x>>2]}while(1){if(!(c[p>>2]|0))break;x=c[t>>2]|0;c[t>>2]=x+1;a[u>>0]=a[x>>0]|0;x=d[c[r>>2]>>0]|0;w=c[s>>2]|0;c[s>>2]=w+1;y=(x^(d[w>>0]|0))&255;w=c[q>>2]|0;c[q>>2]=w+1;a[w>>0]=y;y=a[u>>0]|0;w=c[r>>2]|0;c[r>>2]=w+1;a[w>>0]=y;c[p>>2]=(c[p>>2]|0)+-1}l=i;return}function wq(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;xq(c[d>>2]|0);l=b;return 0}function xq(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=l;l=l+80|0;if((l|0)>=(m|0))$(80);f=e+56|0;g=e+52|0;h=e+64|0;i=e+63|0;j=e+62|0;k=e+61|0;n=e+48|0;o=e+44|0;p=e+40|0;q=e+24|0;r=e+16|0;s=e+12|0;t=e+60|0;u=e;v=e+8|0;c[f>>2]=b;c[g>>2]=c[(c[(c[f>>2]|0)+12>>2]|0)+20>>2];if(16<(c[g>>2]|0)>>>0)Re(46822,113,46836);Uw(q|0,0,c[g>>2]|0)|0;c[n>>2]=ub[c[(c[(c[f>>2]|0)+12>>2]|0)+36>>2]&63]((c[f>>2]|0)+496|0,q,q)|0;a[h>>0]=(c[g>>2]|0)==16?135:27;c[p>>2]=0;while(1){if((c[p>>2]|0)>=2)break;a[i>>0]=0;c[o>>2]=(c[g>>2]|0)-1;while(1){if((c[o>>2]|0)<0)break;a[k>>0]=a[q+(c[o>>2]|0)>>0]|0;a[j>>0]=d[i>>0]|0|(d[k>>0]|0)<<1;a[i>>0]=(d[k>>0]|0)>>7;a[q+(c[o>>2]|0)>>0]=d[j>>0]|0;a[(c[f>>2]|0)+128+1+(c[p>>2]<<4)+(c[o>>2]|0)>>0]=a[q+(c[o>>2]|0)>>0]|0;c[o>>2]=(c[o>>2]|0)+-1}b=q+((c[g>>2]|0)-1)|0;a[b>>0]=(d[b>>0]|0)^(d[i>>0]|0|0?d[h>>0]|0:0);a[(c[f>>2]|0)+128+1+(c[p>>2]<<4)+((c[g>>2]|0)-1)>>0]=a[q+((c[g>>2]|0)-1)>>0]|0;c[p>>2]=(c[p>>2]|0)+1}c[r>>2]=q;c[s>>2]=16;a[t>>0]=0;q=u;c[q>>2]=d[t>>0];c[q+4>>2]=0;while(1){if(!(c[r>>2]&7|0?(c[s>>2]|0)!=0:0))break;a[c[r>>2]>>0]=a[t>>0]|0;c[r>>2]=(c[r>>2]|0)+1;c[s>>2]=(c[s>>2]|0)+-1}if((c[s>>2]|0)>>>0>=8){q=u;p=gx(c[q>>2]|0,c[q+4>>2]|0,16843009,16843009)|0;q=u;c[q>>2]=p;c[q+4>>2]=D;do{c[v>>2]=c[r>>2];q=u;p=c[q+4>>2]|0;g=c[v>>2]|0;c[g>>2]=c[q>>2];c[g+4>>2]=p;c[s>>2]=(c[s>>2]|0)-8;c[r>>2]=(c[r>>2]|0)+8}while((c[s>>2]|0)>>>0>=8)}while(1){if(!(c[s>>2]|0))break;a[c[r>>2]>>0]=a[t>>0]|0;c[r>>2]=(c[r>>2]|0)+1;c[s>>2]=(c[s>>2]|0)+-1}if(!(c[n>>2]|0)){l=e;return}bf((c[n>>2]|0)+16|0);cf();l=e;return}function yq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0;i=l;l=l+96|0;if((l|0)>=(m|0))$(96);j=i+68|0;k=i+64|0;n=i+60|0;o=i+56|0;p=i+52|0;q=i+48|0;r=i+44|0;s=i+40|0;t=i+36|0;u=i+32|0;v=i+28|0;w=i+24|0;x=i+20|0;y=i+80|0;z=i+16|0;A=i+12|0;B=i+72|0;C=i;E=i+8|0;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;c[t>>2]=c[(c[(c[k>>2]|0)+12>>2]|0)+36>>2];c[u>>2]=c[(c[(c[k>>2]|0)+12>>2]|0)+20>>2];if((c[o>>2]|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;F=c[j>>2]|0;l=i;return F|0}c[w>>2]=0;if(c[(c[k>>2]|0)+112>>2]|0){if((c[(c[k>>2]|0)+112>>2]|0)>>>0>=(c[u>>2]|0)>>>0)Se(46858,46880,53,46893);c[s>>2]=(c[u>>2]|0)-(c[(c[k>>2]|0)+112>>2]|0);if((c[(c[k>>2]|0)+112>>2]|0)>>>0>(c[q>>2]|0)>>>0)G=c[q>>2]|0;else G=c[(c[k>>2]|0)+112>>2]|0;c[r>>2]=G;zq(c[n>>2]|0,c[p>>2]|0,(c[k>>2]|0)+96+(c[s>>2]|0)|0,c[r>>2]|0);G=(c[k>>2]|0)+112|0;c[G>>2]=(c[G>>2]|0)-(c[r>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[q>>2]=(c[q>>2]|0)-(c[r>>2]|0)}c[v>>2]=((c[q>>2]|0)>>>0)/((c[u>>2]|0)>>>0)|0;if(c[v>>2]|0?c[(c[k>>2]|0)+20+16>>2]|0:0){vb[c[(c[k>>2]|0)+20+16>>2]&15]((c[k>>2]|0)+496|0,(c[k>>2]|0)+80|0,c[n>>2]|0,c[p>>2]|0,c[v>>2]|0);G=S(c[v>>2]|0,c[u>>2]|0)|0;c[p>>2]=(c[p>>2]|0)+G;G=S(c[v>>2]|0,c[u>>2]|0)|0;c[n>>2]=(c[n>>2]|0)+G;G=S(c[v>>2]|0,c[u>>2]|0)|0;c[q>>2]=(c[q>>2]|0)-G}a:do if(c[q>>2]|0){do{c[x>>2]=ub[c[t>>2]&63]((c[k>>2]|0)+496|0,y,(c[k>>2]|0)+80|0)|0;c[w>>2]=(c[x>>2]|0)>>>0>(c[w>>2]|0)>>>0?c[x>>2]|0:c[w>>2]|0;c[s>>2]=c[u>>2];while(1){if((c[s>>2]|0)<=0)break;G=(c[k>>2]|0)+80+((c[s>>2]|0)-1)|0;a[G>>0]=(a[G>>0]|0)+1<<24>>24;if(d[(c[k>>2]|0)+80+((c[s>>2]|0)-1)>>0]|0|0)break;c[s>>2]=(c[s>>2]|0)+-1}c[r>>2]=(c[u>>2]|0)>>>0<(c[q>>2]|0)>>>0?c[u>>2]|0:c[q>>2]|0;zq(c[n>>2]|0,c[p>>2]|0,y,c[r>>2]|0);c[q>>2]=(c[q>>2]|0)-(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[r>>2]|0)}while((c[q>>2]|0)!=0);c[(c[k>>2]|0)+112>>2]=(c[u>>2]|0)-(c[r>>2]|0);if(c[(c[k>>2]|0)+112>>2]|0)Aq((c[k>>2]|0)+96+(c[r>>2]|0)|0,y+(c[r>>2]|0)|0,c[(c[k>>2]|0)+112>>2]|0);c[z>>2]=y;c[A>>2]=16;a[B>>0]=0;G=C;c[G>>2]=d[B>>0];c[G+4>>2]=0;while(1){if(!(c[z>>2]&7|0?(c[A>>2]|0)!=0:0))break;a[c[z>>2]>>0]=a[B>>0]|0;c[z>>2]=(c[z>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+-1}if((c[A>>2]|0)>>>0>=8){G=C;v=gx(c[G>>2]|0,c[G+4>>2]|0,16843009,16843009)|0;G=C;c[G>>2]=v;c[G+4>>2]=D;do{c[E>>2]=c[z>>2];G=C;v=c[G+4>>2]|0;o=c[E>>2]|0;c[o>>2]=c[G>>2];c[o+4>>2]=v;c[A>>2]=(c[A>>2]|0)-8;c[z>>2]=(c[z>>2]|0)+8}while((c[A>>2]|0)>>>0>=8)}while(1){if(!(c[A>>2]|0))break a;a[c[z>>2]>>0]=a[B>>0]|0;c[z>>2]=(c[z>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+-1}}while(0);if((c[w>>2]|0)>>>0>0){bf((c[w>>2]|0)+16|0);cf()}c[j>>2]=0;F=c[j>>2]|0;l=i;return F|0}function zq(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function Aq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=c[h>>2];c[f>>2]=3;if(!((c[j>>2]|c[k>>2])&3)){c[n>>2]=c[j>>2];c[o>>2]=c[k>>2];while(1){if((c[i>>2]|0)>>>0<4)break;h=c[o>>2]|0;c[o>>2]=h+4;g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;c[i>>2]=(c[i>>2]|0)-4}c[j>>2]=c[n>>2];c[k>>2]=c[o>>2]}while(1){if(!(c[i>>2]|0))break;o=c[k>>2]|0;c[k>>2]=o+1;n=a[o>>0]|0;o=c[j>>2]|0;c[j>>2]=o+1;a[o>>0]=n;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function Bq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+24|0;k=i+20|0;n=i+16|0;o=i+12|0;p=i+8|0;q=i+4|0;r=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[(c[(c[k>>2]|0)+12>>2]|0)+20>>2]|0)!=16){c[j>>2]=12;s=c[j>>2]|0;l=i;return s|0}if((c[o>>2]|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;s=c[j>>2]|0;l=i;return s|0}if((d[(c[k>>2]|0)+128+68>>0]|0)>>>2&1|0){c[j>>2]=139;s=c[j>>2]|0;l=i;return s|0}if(((d[(c[k>>2]|0)+56>>0]|0)>>>2&1|0)==0?(a[(c[k>>2]|0)+128+68>>0]&1|0)==0:0){if(!((d[(c[k>>2]|0)+56>>0]|0)>>>1&1))Cq(c[k>>2]|0,72251,16)|0;if((d[(c[k>>2]|0)+128+68>>0]|0)>>>3&1|0){c[j>>2]=156;s=c[j>>2]|0;l=i;return s|0}if(!((d[(c[k>>2]|0)+128+68>>0]|0)>>>1&1)){Dq(c[k>>2]|0,(c[k>>2]|0)+128|0,0,0,1);h=(c[k>>2]|0)+128+68|0;a[h>>0]=a[h>>0]&-3|2}Eq((c[k>>2]|0)+128+44|0,c[q>>2]|0);h=(Fq((c[k>>2]|0)+128+44|0)|0)!=0;g=c[k>>2]|0;if(!h){h=g+128+68|0;a[h>>0]=a[h>>0]&-5|4;c[j>>2]=139;s=c[j>>2]|0;l=i;return s|0}c[r>>2]=yq(g,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0)|0;if(c[r>>2]|0){c[j>>2]=c[r>>2];s=c[j>>2]|0;l=i;return s|0}else{Dq(c[k>>2]|0,(c[k>>2]|0)+128|0,c[n>>2]|0,c[q>>2]|0,0);c[j>>2]=0;s=c[j>>2]|0;l=i;return s|0}}c[j>>2]=156;s=c[j>>2]|0;l=i;return s|0}function Cq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+8|0;h=f+4|0;i=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;e=(c[g>>2]|0)+56|0;a[e>>0]=a[e>>0]&-3;e=(c[g>>2]|0)+56|0;a[e>>0]=a[e>>0]&-5;e=(c[g>>2]|0)+128+68|0;a[e>>0]=a[e>>0]&-9;if(!(Wg()|0)){j=c[g>>2]|0;k=c[h>>2]|0;n=c[i>>2]|0;o=Hq(j,k,n)|0;l=f;return o|0}e=(c[g>>2]|0)+128+68|0;a[e>>0]=a[e>>0]&-9|8;j=c[g>>2]|0;k=c[h>>2]|0;n=c[i>>2]|0;o=Hq(j,k,n)|0;l=f;return o|0}function Dq(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;u=h;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=16;c[q>>2]=c[(c[i>>2]|0)+128+32>>2];c[r>>2]=c[(c[i>>2]|0)+128+96>>2];c[u>>2]=0;if((c[n>>2]|0)==0?!((c[q>>2]|0)!=0&(c[o>>2]|0)!=0):0){l=h;return}a:do{if((c[q>>2]|0)>>>0>0?1:((c[n>>2]|0)+(c[q>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[t>>2]=(c[p>>2]|0)-(c[q>>2]|0);c[t>>2]=(c[t>>2]|0)>>>0<(c[n>>2]|0)>>>0?c[t>>2]|0:c[n>>2]|0;Gq((c[i>>2]|0)+128+16+(c[q>>2]|0)|0,c[k>>2]|0,c[t>>2]|0);c[q>>2]=(c[q>>2]|0)+(c[t>>2]|0);c[k>>2]=(c[k>>2]|0)+(c[t>>2]|0);c[n>>2]=(c[n>>2]|0)-(c[t>>2]|0)}b:do if(!(c[n>>2]|0)){if(!(c[o>>2]|0))break a;while(1){if((c[q>>2]|0)>>>0>=(c[p>>2]|0)>>>0)break b;g=c[q>>2]|0;c[q>>2]=g+1;a[(c[i>>2]|0)+128+16+g>>0]=0}}while(0);if((c[q>>2]|0)>>>0>0){if((c[q>>2]|0)!=(c[p>>2]|0)){v=11;break}c[u>>2]=Bb[c[r>>2]&7](c[i>>2]|0,c[j>>2]|0,(c[i>>2]|0)+128+16|0,1)|0;c[q>>2]=0}c[s>>2]=((c[n>>2]|0)>>>0)/((c[p>>2]|0)>>>0)|0;if(c[s>>2]|0){c[u>>2]=Bb[c[r>>2]&7](c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[s>>2]|0)|0;g=S(c[p>>2]|0,c[s>>2]|0)|0;c[k>>2]=(c[k>>2]|0)+g;g=S(c[p>>2]|0,c[s>>2]|0)|0;c[n>>2]=(c[n>>2]|0)-g}}while((c[n>>2]|0)>>>0>0);if((v|0)==11)Se(46918,46938,499,46951);c[(c[i>>2]|0)+128+32>>2]=c[q>>2];if(!(c[u>>2]|0)){l=h;return}bf(c[u>>2]|0);cf();l=h;return}function Eq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=c[e>>2]|0;c[b>>2]=(c[b>>2]|0)+(c[f>>2]|0);if((c[c[e>>2]>>2]|0)>>>0>=(c[f>>2]|0)>>>0){l=d;return}f=(c[e>>2]|0)+4|0;c[f>>2]=(c[f>>2]|0)+1;l=d;return}function Fq(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;do if((c[(c[e>>2]|0)+4>>2]|0)>>>0<=15){if((c[(c[e>>2]|0)+4>>2]|0)>>>0<15){c[d>>2]=1;break}if((c[c[e>>2]>>2]|0)>>>0<=4294967264){c[d>>2]=1;break}else{c[d>>2]=0;break}}else c[d>>2]=0;while(0);l=b;return c[d>>2]|0}function Gq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=c[h>>2];c[f>>2]=3;if(!((c[j>>2]|c[k>>2])&3)){c[n>>2]=c[j>>2];c[o>>2]=c[k>>2];while(1){if((c[i>>2]|0)>>>0<4)break;h=c[o>>2]|0;c[o>>2]=h+4;g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;c[i>>2]=(c[i>>2]|0)-4}c[j>>2]=c[n>>2];c[k>>2]=c[o>>2]}while(1){if(!(c[i>>2]|0))break;o=c[k>>2]|0;c[k>>2]=o+1;n=a[o>>0]|0;o=c[j>>2]|0;c[j>>2]=o+1;a[o>>0]=n;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function Hq(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;g=l;l=l+96|0;if((l|0)>=(m|0))$(96);h=g+76|0;i=g+72|0;j=g+68|0;k=g+64|0;n=g+56|0;o=g+40|0;p=g+36|0;q=g+32|0;r=g+81|0;s=g+8|0;t=g+28|0;u=g+24|0;v=g+20|0;w=g+80|0;x=g;y=g+16|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;f=(c[i>>2]|0)+128+36|0;c[f>>2]=0;c[f+4>>2]=0;f=(c[i>>2]|0)+128+44|0;c[f>>2]=0;c[f+4>>2]=0;f=(c[i>>2]|0)+128|0;c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[f+12>>2]=0;f=(c[i>>2]|0)+128+68|0;a[f>>0]=a[f>>0]&-5;f=(c[i>>2]|0)+128+68|0;a[f>>0]=a[f>>0]&-2;f=(c[i>>2]|0)+128+68|0;a[f>>0]=a[f>>0]&-3;if(!(c[k>>2]|0)){c[h>>2]=139;z=c[h>>2]|0;l=g;return z|0}a:do if((c[k>>2]|0)!=12){c[n>>2]=0;c[n+4>>2]=0;f=(c[i>>2]|0)+80|0;c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[f+12>>2]=0;Eq(n,c[k>>2]|0);f=(Iq(n)|0)!=0;e=c[i>>2]|0;if(!f){f=e+128+68|0;a[f>>0]=a[f>>0]&-5|4;c[h>>2]=139;z=c[h>>2]|0;l=g;return z|0}Dq(e,(c[i>>2]|0)+80|0,c[j>>2]|0,c[k>>2]|0,1);c[o+8+4>>2]=ax(c[n>>2]<<3|0)|0;c[o+8>>2]=ax((c[n>>2]|0)>>>29|c[n+4>>2]<<3|0)|0;c[o+4>>2]=0;c[o>>2]=0;Dq(c[i>>2]|0,(c[i>>2]|0)+80|0,o,16,1);c[p>>2]=n;c[q>>2]=8;a[r>>0]=0;e=s;c[e>>2]=d[r>>0];c[e+4>>2]=0;while(1){if(!(c[p>>2]&7|0?(c[q>>2]|0)!=0:0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}if((c[q>>2]|0)>>>0>=8){e=s;f=gx(c[e>>2]|0,c[e+4>>2]|0,16843009,16843009)|0;e=s;c[e>>2]=f;c[e+4>>2]=D;do{c[t>>2]=c[p>>2];e=s;f=c[e+4>>2]|0;b=c[t>>2]|0;c[b>>2]=c[e>>2];c[b+4>>2]=f;c[q>>2]=(c[q>>2]|0)-8;c[p>>2]=(c[p>>2]|0)+8}while((c[q>>2]|0)>>>0>=8)}while(1){if(!(c[q>>2]|0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}c[u>>2]=o;c[v>>2]=16;a[w>>0]=0;f=x;c[f>>2]=d[w>>0];c[f+4>>2]=0;while(1){if(!(c[u>>2]&7|0?(c[v>>2]|0)!=0:0))break;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}if((c[v>>2]|0)>>>0>=8){f=x;b=gx(c[f>>2]|0,c[f+4>>2]|0,16843009,16843009)|0;f=x;c[f>>2]=b;c[f+4>>2]=D;do{c[y>>2]=c[u>>2];f=x;b=c[f+4>>2]|0;e=c[y>>2]|0;c[e>>2]=c[f>>2];c[e+4>>2]=b;c[v>>2]=(c[v>>2]|0)-8;c[u>>2]=(c[u>>2]|0)+8}while((c[v>>2]|0)>>>0>=8)}while(1){if(!(c[v>>2]|0))break a;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}}else{_w((c[i>>2]|0)+80|0,c[j>>2]|0,c[k>>2]|0)|0;a[(c[i>>2]|0)+80+14>>0]=0;a[(c[i>>2]|0)+80+13>>0]=0;a[(c[i>>2]|0)+80+12>>0]=0;a[(c[i>>2]|0)+80+15>>0]=1}while(0);ub[c[(c[(c[i>>2]|0)+12>>2]|0)+36>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+128+52|0,(c[i>>2]|0)+80|0)|0;Jq((c[i>>2]|0)+80|0,1)|0;c[(c[i>>2]|0)+112>>2]=0;k=(c[i>>2]|0)+56|0;a[k>>0]=a[k>>0]&-3|2;k=(c[i>>2]|0)+56|0;a[k>>0]=a[k>>0]&-5;c[h>>2]=0;z=c[h>>2]|0;l=g;return z|0}function Iq(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;do if((c[(c[e>>2]|0)+4>>2]|0)>>>0<=536870911){if((c[(c[e>>2]|0)+4>>2]|0)>>>0<536870911){c[d>>2]=1;break}if((c[c[e>>2]>>2]|0)>>>0<=4294967295){c[d>>2]=1;break}else{c[d>>2]=0;break}}else c[d>>2]=0;while(0);l=b;return c[d>>2]|0}function Jq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[d+8>>2]=16;c[g>>2]=(c[e>>2]|0)+16+-4;e=ax(c[c[g>>2]>>2]|0)|0;c[h>>2]=e+(c[f>>2]|0);f=ax(c[h>>2]|0)|0;c[c[g>>2]>>2]=f;l=d;return c[h>>2]|0}function Kq(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+20|0;k=i+16|0;n=i+12|0;o=i+8|0;p=i+4|0;q=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[(c[(c[k>>2]|0)+12>>2]|0)+20>>2]|0)!=16){c[j>>2]=12;r=c[j>>2]|0;l=i;return r|0}if((c[o>>2]|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;r=c[j>>2]|0;l=i;return r|0}if((d[(c[k>>2]|0)+128+68>>0]|0)>>>2&1|0){c[j>>2]=139;r=c[j>>2]|0;l=i;return r|0}if(((d[(c[k>>2]|0)+56>>0]|0)>>>2&1|0)==0?(a[(c[k>>2]|0)+128+68>>0]&1|0)==0:0){if(!((d[(c[k>>2]|0)+56>>0]|0)>>>1&1))Cq(c[k>>2]|0,72267,16)|0;if(!((d[(c[k>>2]|0)+128+68>>0]|0)>>>1&1)){Dq(c[k>>2]|0,(c[k>>2]|0)+128|0,0,0,1);h=(c[k>>2]|0)+128+68|0;a[h>>0]=a[h>>0]&-3|2}Eq((c[k>>2]|0)+128+44|0,c[q>>2]|0);h=(Fq((c[k>>2]|0)+128+44|0)|0)!=0;g=c[k>>2]|0;if(h){Dq(g,(c[k>>2]|0)+128|0,c[p>>2]|0,c[q>>2]|0,0);c[j>>2]=yq(c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0)|0;r=c[j>>2]|0;l=i;return r|0}else{q=g+128+68|0;a[q>>0]=a[q>>0]&-5|4;c[j>>2]=139;r=c[j>>2]|0;l=i;return r|0}}c[j>>2]=156;r=c[j>>2]|0;l=i;return r|0}function Lq(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=(c[d>>2]|0)+128+80|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;ub[c[(c[(c[d>>2]|0)+12>>2]|0)+36>>2]&63]((c[d>>2]|0)+496|0,(c[d>>2]|0)+128+80|0,(c[d>>2]|0)+128+80|0)|0;Mq(c[d>>2]|0);l=b;return}function Mq(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;c[(c[d>>2]|0)+128+96>>2]=2;Oq((c[d>>2]|0)+128+80|0,(c[d>>2]|0)+128+100|0);l=b;return}function Nq(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[f+4>>2]=16;c[k>>2]=0;while(1){if(!(c[j>>2]|0))break;c[k>>2]=Rq(c[h>>2]|0,c[i>>2]|0,(c[g>>2]|0)+128+100|0)|0;c[i>>2]=(c[i>>2]|0)+16;c[j>>2]=(c[j>>2]|0)+-1}l=f;return (c[k>>2]|0)+(c[k>>2]|0?20:0)|0}function Oq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[c[f>>2]>>2]=0;c[(c[f>>2]|0)+4>>2]=0;c[(c[f>>2]|0)+8>>2]=0;c[(c[f>>2]|0)+12>>2]=0;b=Pq(c[e>>2]|0)|0;c[(c[f>>2]|0)+128>>2]=b;b=Pq((c[e>>2]|0)+4|0)|0;c[(c[f>>2]|0)+132>>2]=b;b=Pq((c[e>>2]|0)+8|0)|0;c[(c[f>>2]|0)+136>>2]=b;b=Pq((c[e>>2]|0)+12|0)|0;c[(c[f>>2]|0)+140>>2]=b;c[g>>2]=4;while(1){if((c[g>>2]|0)<=0)break;c[(c[f>>2]|0)+((c[g>>2]<<2)+0<<2)>>2]=c[(c[f>>2]|0)+((c[g>>2]<<1<<2)+0<<2)>>2];c[(c[f>>2]|0)+((c[g>>2]<<2)+1<<2)>>2]=c[(c[f>>2]|0)+((c[g>>2]<<1<<2)+1<<2)>>2];c[(c[f>>2]|0)+((c[g>>2]<<2)+2<<2)>>2]=c[(c[f>>2]|0)+((c[g>>2]<<1<<2)+2<<2)>>2];c[(c[f>>2]|0)+((c[g>>2]<<2)+3<<2)>>2]=c[(c[f>>2]|0)+((c[g>>2]<<1<<2)+3<<2)>>2];Qq(c[f>>2]|0,c[g>>2]|0);c[g>>2]=(c[g>>2]|0)/2|0}c[g>>2]=2;while(1){if((c[g>>2]|0)>=16)break;c[h>>2]=1;while(1){i=c[g>>2]|0;if((c[h>>2]|0)>=(c[g>>2]|0))break;c[(c[f>>2]|0)+(((c[g>>2]|0)+(c[h>>2]|0)<<2)+0<<2)>>2]=c[(c[f>>2]|0)+((i<<2)+0<<2)>>2]^c[(c[f>>2]|0)+((c[h>>2]<<2)+0<<2)>>2];c[(c[f>>2]|0)+(((c[g>>2]|0)+(c[h>>2]|0)<<2)+1<<2)>>2]=c[(c[f>>2]|0)+((c[g>>2]<<2)+1<<2)>>2]^c[(c[f>>2]|0)+((c[h>>2]<<2)+1<<2)>>2];c[(c[f>>2]|0)+(((c[g>>2]|0)+(c[h>>2]|0)<<2)+2<<2)>>2]=c[(c[f>>2]|0)+((c[g>>2]<<2)+2<<2)>>2]^c[(c[f>>2]|0)+((c[h>>2]<<2)+2<<2)>>2];c[(c[f>>2]|0)+(((c[g>>2]|0)+(c[h>>2]|0)<<2)+3<<2)>>2]=c[(c[f>>2]|0)+((c[g>>2]<<2)+3<<2)>>2]^c[(c[f>>2]|0)+((c[h>>2]<<2)+3<<2)>>2];c[h>>2]=(c[h>>2]|0)+1}c[g>>2]=i<<1}l=d;return}function Pq(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];l=b;return (d[c[f>>2]>>0]|0)<<24|(d[(c[f>>2]|0)+1>>0]|0)<<16|(d[(c[f>>2]|0)+2>>0]|0)<<8|(d[(c[f>>2]|0)+3>>0]|0)|0}function Qq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+28|0;f=d+24|0;g=d+8|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[(c[e>>2]|0)+((c[f>>2]<<2)+0<<2)>>2];c[g+4>>2]=c[(c[e>>2]|0)+((c[f>>2]<<2)+1<<2)>>2];c[g+8>>2]=c[(c[e>>2]|0)+((c[f>>2]<<2)+2<<2)>>2];c[g+12>>2]=c[(c[e>>2]|0)+((c[f>>2]<<2)+3<<2)>>2];c[h>>2]=c[g+12>>2]&1|0?225:0;c[(c[e>>2]|0)+((c[f>>2]<<2)+3<<2)>>2]=(c[g+12>>2]|0)>>>1^c[g+8>>2]<<31;c[(c[e>>2]|0)+((c[f>>2]<<2)+2<<2)>>2]=(c[g+8>>2]|0)>>>1^c[g+4>>2]<<31;c[(c[e>>2]|0)+((c[f>>2]<<2)+1<<2)>>2]=(c[g+4>>2]|0)>>>1^c[g>>2]<<31;c[(c[e>>2]|0)+((c[f>>2]<<2)+0<<2)>>2]=(c[g>>2]|0)>>>1^c[h>>2]<<24;l=d;return}function Rq(a,b,f){a=a|0;b=b|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+80|0;if((l|0)>=(m|0))$(80);h=g+56|0;i=g+52|0;j=g+48|0;k=g+64|0;n=g+32|0;o=g+24|0;p=g+20|0;q=g+16|0;r=g+4|0;s=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=f;Sq(k,c[h>>2]|0,c[i>>2]|0,16);c[s>>2]=15;c[o>>2]=d[k+(c[s>>2]|0)>>0];c[p>>2]=(c[j>>2]|0)+((c[o>>2]&15)<<2<<2);c[o>>2]=(c[o>>2]&240)>>>4;c[q>>2]=(c[j>>2]|0)+(c[o>>2]<<2<<2);i=(c[s>>2]|0)+-1|0;c[s>>2]=i;c[o>>2]=d[k+i>>0];i=(c[c[p>>2]>>2]|0)>>>4;f=ix(e[17906+((c[(c[p>>2]|0)+12>>2]<<4&240)<<1)>>1]|0|0,0,16)|0;c[n>>2]=i^f^c[c[q>>2]>>2];c[n+4>>2]=(c[(c[p>>2]|0)+4>>2]|0)>>>4^c[c[p>>2]>>2]<<28^c[(c[q>>2]|0)+4>>2];c[n+8>>2]=(c[(c[p>>2]|0)+8>>2]|0)>>>4^c[(c[p>>2]|0)+4>>2]<<28^c[(c[q>>2]|0)+8>>2];c[n+12>>2]=(c[(c[p>>2]|0)+12>>2]|0)>>>4^c[(c[p>>2]|0)+8>>2]<<28^c[(c[q>>2]|0)+12>>2];while(1){c[p>>2]=(c[j>>2]|0)+((c[o>>2]&15)<<2<<2);c[o>>2]=(c[o>>2]&240)>>>4;c[q>>2]=(c[j>>2]|0)+(c[o>>2]<<2<<2);c[r>>2]=c[n>>2];c[r+4>>2]=c[n+4>>2];c[r+8>>2]=c[n+8>>2];c[n>>2]=(c[r>>2]|0)>>>8^(e[17906+((c[n+12>>2]&255)<<1)>>1]|0)<<16^c[c[q>>2]>>2];c[n+4>>2]=c[r>>2]<<24^(c[n+4>>2]|0)>>>8^c[(c[q>>2]|0)+4>>2];c[n+8>>2]=c[r+4>>2]<<24^(c[n+8>>2]|0)>>>8^c[(c[q>>2]|0)+8>>2];c[n+12>>2]=c[r+8>>2]<<24^(c[n+12>>2]|0)>>>8^c[(c[q>>2]|0)+12>>2];f=(c[c[p>>2]>>2]|0)>>>4;i=ix(e[17906+((c[(c[p>>2]|0)+12>>2]<<4&240)<<1)>>1]|0|0,0,16)|0;c[n>>2]=c[n>>2]^(f^i);i=n+4|0;c[i>>2]=c[i>>2]^((c[(c[p>>2]|0)+4>>2]|0)>>>4^c[c[p>>2]>>2]<<28);i=n+8|0;c[i>>2]=c[i>>2]^((c[(c[p>>2]|0)+8>>2]|0)>>>4^c[(c[p>>2]|0)+4>>2]<<28);i=n+12|0;c[i>>2]=c[i>>2]^((c[(c[p>>2]|0)+12>>2]|0)>>>4^c[(c[p>>2]|0)+8>>2]<<28);if(!(c[s>>2]|0))break;i=(c[s>>2]|0)+-1|0;c[s>>2]=i;c[o>>2]=d[k+i>>0]}Tq(c[h>>2]|0,c[n>>2]|0);Tq((c[h>>2]|0)+4|0,c[n+4>>2]|0);Tq((c[h>>2]|0)+8|0,c[n+8>>2]|0);Tq((c[h>>2]|0)+12|0,c[n+12>>2]|0);l=g;return 76}function Sq(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function Tq(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];a[c[h>>2]>>0]=(c[g>>2]|0)>>>24;a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)>>>16;a[(c[h>>2]|0)+2>>0]=(c[g>>2]|0)>>>8;a[(c[h>>2]|0)+3>>0]=c[g>>2];l=e;return}function Uq(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f;k=f+8|0;c[h>>2]=a;c[i>>2]=b;b=j;c[b>>2]=d;c[b+4>>2]=e;e=j;c[k>>2]=Vq(c[e>>2]|0,c[e+4>>2]|0)|0;if((c[k>>2]|0)<16){c[g>>2]=(c[h>>2]|0)+128+32+(c[k>>2]<<4);n=c[g>>2]|0;l=f;return n|0}Wq(c[i>>2]|0,(c[h>>2]|0)+128+32+240|0);c[k>>2]=(c[k>>2]|0)-16;while(1){o=c[i>>2]|0;if(!(c[k>>2]|0))break;Xq(o);c[k>>2]=(c[k>>2]|0)+-1}c[g>>2]=o;n=c[g>>2]|0;l=f;return n|0}function Vq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d;g=f;c[g>>2]=a;c[g+4>>2]=b;b=f;g=c[b+4>>2]|0;if((c[f>>2]|0)!=0|0!=0){c[e>>2]=$q(c[b>>2]|0)|0;h=c[e>>2]|0;l=d;return h|0}else{c[e>>2]=32+($q(g)|0);h=c[e>>2]|0;l=d;return h|0}return 0}function Wq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if((c[e>>2]|0)!=(c[f>>2]|0))_q(c[e>>2]|0,c[f>>2]|0,16);Xq(c[e>>2]|0);l=d;return}function Xq(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+24|0;e=b+16|0;f=b+8|0;g=b;c[d>>2]=a;a=Yq(c[d>>2]|0)|0;h=f;c[h>>2]=a;c[h+4>>2]=D;h=Yq((c[d>>2]|0)+8|0)|0;a=g;c[a>>2]=h;c[a+4>>2]=D;a=f;h=bx(c[a>>2]|0,c[a+4>>2]|0,63)|0;a=e;c[a>>2]=h;c[a+4>>2]=D;a=f;h=f;i=Ww(c[a>>2]|0,c[a+4>>2]|0,c[h>>2]|0,c[h+4>>2]|0)|0;h=D;a=g;j=cx(c[a>>2]|0,c[a+4>>2]|0,63)|0;a=f;c[a>>2]=i^j;c[a+4>>2]=h^D;h=g;a=g;j=Ww(c[h>>2]|0,c[h+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=g;c[a>>2]=j^c[e>>2]&135;c[a+4>>2]=D;a=f;Zq(c[d>>2]|0,c[a>>2]|0,c[a+4>>2]|0);a=g;Zq((c[d>>2]|0)+8|0,c[a>>2]|0,c[a+4>>2]|0);l=b;return}function Yq(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];e=ix(d[c[f>>2]>>0]|0|0,0,56)|0;a=D;g=ix(d[(c[f>>2]|0)+1>>0]|0|0,0,48)|0;h=a|D;a=ix(d[(c[f>>2]|0)+2>>0]|0|0,0,40)|0;i=h|D|(d[(c[f>>2]|0)+3>>0]|0);h=ix(d[(c[f>>2]|0)+4>>0]|0|0,0,24)|0;j=i|D;i=ix(d[(c[f>>2]|0)+5>>0]|0|0,0,16)|0;k=j|D;j=ix(d[(c[f>>2]|0)+6>>0]|0|0,0,8)|0;D=k|D;l=b;return e|g|a|h|i|j|(d[(c[f>>2]|0)+7>>0]|0)|0}function Zq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f;i=f+8|0;c[g>>2]=b;b=h;c[b>>2]=d;c[b+4>>2]=e;c[i>>2]=c[g>>2];g=h;e=cx(c[g>>2]|0,c[g+4>>2]|0,56)|0;a[c[i>>2]>>0]=e;e=h;g=cx(c[e>>2]|0,c[e+4>>2]|0,48)|0;a[(c[i>>2]|0)+1>>0]=g;g=h;e=cx(c[g>>2]|0,c[g+4>>2]|0,40)|0;a[(c[i>>2]|0)+2>>0]=e;a[(c[i>>2]|0)+3>>0]=c[h+4>>2];e=h;g=cx(c[e>>2]|0,c[e+4>>2]|0,24)|0;a[(c[i>>2]|0)+4>>0]=g;g=h;e=cx(c[g>>2]|0,c[g+4>>2]|0,16)|0;a[(c[i>>2]|0)+5>>0]=e;e=h;g=cx(c[e>>2]|0,c[e+4>>2]|0,8)|0;a[(c[i>>2]|0)+6>>0]=g;a[(c[i>>2]|0)+7>>0]=c[h>>2];l=f;return}function _q(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=c[h>>2];c[f>>2]=3;if(!((c[j>>2]|c[k>>2])&3)){c[n>>2]=c[j>>2];c[o>>2]=c[k>>2];while(1){if((c[i>>2]|0)>>>0<4)break;h=c[o>>2]|0;c[o>>2]=h+4;g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;c[i>>2]=(c[i>>2]|0)-4}c[j>>2]=c[n>>2];c[k>>2]=c[o>>2]}while(1){if(!(c[i>>2]|0))break;o=c[k>>2]|0;c[k>>2]=o+1;n=a[o>>0]|0;o=c[j>>2]|0;c[j>>2]=o+1;a[o>>0]=n;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function $q(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=(c[d>>2]|0)!=0;e=Xw(c[d>>2]|0)|0;l=b;return (a?e:32)|0}function ar(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0;g=l;l=l+128|0;if((l|0)>=(m|0))$(128);h=g+68|0;i=g+64|0;j=g+60|0;k=g+56|0;n=g+104|0;o=g+80|0;p=g+52|0;q=g+48|0;r=g+44|0;s=g+40|0;t=g+36|0;u=g+32|0;v=g+73|0;w=g+8|0;x=g+28|0;y=g+24|0;z=g+20|0;A=g+72|0;B=g;C=g+16|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[r>>2]=0;if(!(a[(c[i>>2]|0)+56>>0]&1)){c[h>>2]=156;E=c[h>>2]|0;l=g;return E|0}switch(d[(c[i>>2]|0)+128+352>>0]|0|0){case 16:case 12:case 8:break;default:{c[h>>2]=59;E=c[h>>2]|0;l=g;return E|0}}if((c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2]|0)!=16){c[h>>2]=12;E=c[h>>2]|0;l=g;return E|0}if(!(c[j>>2]|0)){c[h>>2]=45;E=c[h>>2]|0;l=g;return E|0}if((c[k>>2]|0)>>>0>15|(c[k>>2]|0)>>>0<8|(c[k>>2]|0)>>>0>=16){c[h>>2]=139;E=c[h>>2]|0;l=g;return E|0}f=n;e=f+16|0;do{a[f>>0]=0;f=f+1|0}while((f|0)<(e|0));c[s>>2]=ub[c[(c[(c[i>>2]|0)+12>>2]|0)+36>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+128|0,n)|0;c[r>>2]=(c[s>>2]|0)>>>0>(c[r>>2]|0)>>>0?c[s>>2]|0:c[r>>2]|0;Wq((c[i>>2]|0)+128+16|0,(c[i>>2]|0)+128|0);Wq((c[i>>2]|0)+128+32|0,(c[i>>2]|0)+128+16|0);c[q>>2]=1;while(1){if((c[q>>2]|0)>=16)break;Wq((c[i>>2]|0)+128+32+(c[q>>2]<<4)|0,(c[i>>2]|0)+128+32+((c[q>>2]|0)-1<<4)|0);c[q>>2]=(c[q>>2]|0)+1}Uw(n|0,0,16-(c[k>>2]|0)|0)|0;_q(n+(16-(c[k>>2]|0))|0,c[j>>2]|0,c[k>>2]|0);a[n>>0]=(((d[(c[i>>2]|0)+128+352>>0]|0)<<3|0)%128|0)<<1;j=n+(16-(c[k>>2]|0)-1)|0;a[j>>0]=d[j>>0]|0|1;c[p>>2]=(d[n+15>>0]|0)&63;j=n+15|0;a[j>>0]=(d[j>>0]|0)&192;c[s>>2]=ub[c[(c[(c[i>>2]|0)+12>>2]|0)+36>>2]&63]((c[i>>2]|0)+496|0,n,n)|0;c[r>>2]=(c[s>>2]|0)>>>0>(c[r>>2]|0)>>>0?c[s>>2]|0:c[r>>2]|0;_q(o,n,16);br(o+16|0,n,n+1|0,8);cr((c[i>>2]|0)+64|0,o,c[p>>2]|0,16);p=(c[i>>2]|0)+56|0;a[p>>0]=a[p>>0]&-3|2;p=(c[i>>2]|0)+80|0;c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;c[p+12>>2]=0;p=(c[i>>2]|0)+128+304|0;c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;c[p+12>>2]=0;p=(c[i>>2]|0)+128+320|0;c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;c[p+12>>2]=0;p=(c[i>>2]|0)+96|0;c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;c[p+12>>2]=0;c[(c[i>>2]|0)+112>>2]=0;p=(c[i>>2]|0)+56|0;a[p>>0]=a[p>>0]&-5;p=(c[i>>2]|0)+56|0;a[p>>0]=a[p>>0]&-9;p=(c[i>>2]|0)+128+336|0;c[p>>2]=0;c[p+4>>2]=0;p=(c[i>>2]|0)+128+344|0;c[p>>2]=0;c[p+4>>2]=0;p=(c[i>>2]|0)+128+353|0;a[p>>0]=a[p>>0]&-2;p=(c[i>>2]|0)+128+353|0;a[p>>0]=a[p>>0]&-3;c[t>>2]=n;c[u>>2]=16;a[v>>0]=0;n=w;c[n>>2]=d[v>>0];c[n+4>>2]=0;while(1){if(!(c[t>>2]&7|0?(c[u>>2]|0)!=0:0))break;a[c[t>>2]>>0]=a[v>>0]|0;c[t>>2]=(c[t>>2]|0)+1;c[u>>2]=(c[u>>2]|0)+-1}if((c[u>>2]|0)>>>0>=8){n=w;p=gx(c[n>>2]|0,c[n+4>>2]|0,16843009,16843009)|0;n=w;c[n>>2]=p;c[n+4>>2]=D;do{c[x>>2]=c[t>>2];n=w;p=c[n+4>>2]|0;i=c[x>>2]|0;c[i>>2]=c[n>>2];c[i+4>>2]=p;c[u>>2]=(c[u>>2]|0)-8;c[t>>2]=(c[t>>2]|0)+8}while((c[u>>2]|0)>>>0>=8)}while(1){if(!(c[u>>2]|0))break;a[c[t>>2]>>0]=a[v>>0]|0;c[t>>2]=(c[t>>2]|0)+1;c[u>>2]=(c[u>>2]|0)+-1}c[y>>2]=o;c[z>>2]=24;a[A>>0]=0;o=B;c[o>>2]=d[A>>0];c[o+4>>2]=0;while(1){if(!(c[y>>2]&7|0?(c[z>>2]|0)!=0:0))break;a[c[y>>2]>>0]=a[A>>0]|0;c[y>>2]=(c[y>>2]|0)+1;c[z>>2]=(c[z>>2]|0)+-1}if((c[z>>2]|0)>>>0>=8){o=B;u=gx(c[o>>2]|0,c[o+4>>2]|0,16843009,16843009)|0;o=B;c[o>>2]=u;c[o+4>>2]=D;do{c[C>>2]=c[y>>2];o=B;u=c[o+4>>2]|0;t=c[C>>2]|0;c[t>>2]=c[o>>2];c[t+4>>2]=u;c[z>>2]=(c[z>>2]|0)-8;c[y>>2]=(c[y>>2]|0)+8}while((c[z>>2]|0)>>>0>=8)}while(1){if(!(c[z>>2]|0))break;a[c[y>>2]>>0]=a[A>>0]|0;c[y>>2]=(c[y>>2]|0)+1;c[z>>2]=(c[z>>2]|0)+-1}if((c[r>>2]|0)>>>0>0){bf((c[r>>2]|0)+16|0);cf()}c[h>>2]=0;E=c[h>>2]|0;l=g;return E|0}function br(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function cr(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+16|0;j=h+12|0;k=h+8|0;n=h+4|0;o=h;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[j>>2]=(c[j>>2]|0)+(((c[k>>2]|0)>>>0)/8|0);c[o>>2]=((c[k>>2]|0)>>>0)%8|0;if(c[o>>2]|0){while(1){if(!(c[n>>2]|0))break;a[c[i>>2]>>0]=(d[c[j>>2]>>0]|0)<>2]|(d[(c[j>>2]|0)+1>>0]|0)>>8-(c[o>>2]|0);c[n>>2]=(c[n>>2]|0)+-1;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+1}l=h;return}else{while(1){if(!(c[n>>2]|0))break;a[c[i>>2]>>0]=a[c[j>>2]>>0]|0;c[n>>2]=(c[n>>2]|0)+-1;c[i>>2]=(c[i>>2]|0)+1;c[j>>2]=(c[j>>2]|0)+1}l=h;return}}function dr(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+28|0;i=g+24|0;j=g+20|0;k=g+16|0;n=g+12|0;o=g+8|0;p=g+4|0;c[h>>2]=b;c[i>>2]=e;c[j>>2]=f;c[k>>2]=c[h>>2];c[n>>2]=c[i>>2];c[g>>2]=3;if(!((c[k>>2]|c[n>>2])&3)){c[o>>2]=c[k>>2];c[p>>2]=c[n>>2];while(1){if((c[j>>2]|0)>>>0<4)break;i=c[p>>2]|0;c[p>>2]=i+4;h=c[i>>2]|0;i=c[o>>2]|0;c[o>>2]=i+4;c[i>>2]=c[i>>2]^h;c[j>>2]=(c[j>>2]|0)-4}c[k>>2]=c[o>>2];c[n>>2]=c[p>>2]}while(1){if(!(c[j>>2]|0))break;p=c[n>>2]|0;c[n>>2]=p+1;o=d[p>>0]|0;p=c[k>>2]|0;c[k>>2]=p+1;a[p>>0]=(d[p>>0]|0)^o;c[j>>2]=(c[j>>2]|0)+-1}l=g;return}function er(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=fr(c[h>>2]|0,1,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0;l=g;return f|0}function fr(b,e,f,g,h,i){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;j=l;l=l+80|0;if((l|0)>=(m|0))$(80);k=j+40|0;n=j+36|0;o=j+32|0;p=j+28|0;q=j+24|0;r=j+20|0;s=j+16|0;t=j+64|0;u=j+12|0;v=j+8|0;w=j+4|0;x=j;y=j+48|0;c[n>>2]=b;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;c[u>>2]=0;c[w>>2]=((c[s>>2]|0)>>>0)/16|0;if((d[(c[n>>2]|0)+56>>0]|0)>>>1&1|0?(a[(c[n>>2]|0)+128+353>>0]&1|0)==0:0){if((c[(c[(c[n>>2]|0)+12>>2]|0)+20>>2]|0)!=16){c[k>>2]=12;z=c[k>>2]|0;l=j;return z|0}if((c[q>>2]|0)>>>0<(c[s>>2]|0)>>>0){c[k>>2]=200;z=c[k>>2]|0;l=j;return z|0}if(((d[(c[n>>2]|0)+56>>0]|0)>>>3&1|0)==0?((c[s>>2]|0)>>>0)%16|0|0:0){c[k>>2]=139;z=c[k>>2]|0;l=j;return z|0}if(c[w>>2]|0?c[(c[n>>2]|0)+20+20>>2]|0:0){vb[c[(c[n>>2]|0)+20+20>>2]&15](c[n>>2]|0,c[p>>2]|0,c[r>>2]|0,c[w>>2]|0,c[o>>2]|0);c[r>>2]=(c[r>>2]|0)+(c[w>>2]<<4);c[p>>2]=(c[p>>2]|0)+(c[w>>2]<<4);c[s>>2]=(c[s>>2]|0)-(c[w>>2]<<4);c[q>>2]=(c[q>>2]|0)-(c[w>>2]<<4);c[w>>2]=0}if(c[w>>2]|0){i=c[(c[n>>2]|0)+12>>2]|0;if(c[o>>2]|0)A=c[i+36>>2]|0;else A=c[i+40>>2]|0;c[x>>2]=A;if(c[o>>2]|0)gr((c[n>>2]|0)+80|0,c[r>>2]|0,c[w>>2]|0);while(1){if((c[s>>2]|0)>>>0<16)break;A=(c[n>>2]|0)+128+336|0;i=A;h=Ww(c[i>>2]|0,c[i+4>>2]|0,1,0)|0;i=A;c[i>>2]=h;c[i+4>>2]=D;i=(c[n>>2]|0)+64|0;h=(c[n>>2]|0)+128+336|0;dr(i,Uq(c[n>>2]|0,t,c[h>>2]|0,c[h+4>>2]|0)|0,16);br(c[p>>2]|0,(c[n>>2]|0)+64|0,c[r>>2]|0,16);c[v>>2]=ub[c[x>>2]&63]((c[n>>2]|0)+496|0,c[p>>2]|0,c[p>>2]|0)|0;c[u>>2]=(c[v>>2]|0)>>>0>(c[u>>2]|0)>>>0?c[v>>2]|0:c[u>>2]|0;dr(c[p>>2]|0,(c[n>>2]|0)+64|0,16);c[r>>2]=(c[r>>2]|0)+16;c[s>>2]=(c[s>>2]|0)-16;c[p>>2]=(c[p>>2]|0)+16;c[q>>2]=-16}if(!(c[o>>2]|0))gr((c[n>>2]|0)+80|0,(c[p>>2]|0)+(0-(c[w>>2]<<4))|0,c[w>>2]|0)}do if(c[s>>2]|0){dr((c[n>>2]|0)+64|0,(c[n>>2]|0)+128|0,16);c[v>>2]=ub[c[(c[(c[n>>2]|0)+12>>2]|0)+36>>2]&63]((c[n>>2]|0)+496|0,y,(c[n>>2]|0)+64|0)|0;c[u>>2]=(c[v>>2]|0)>>>0>(c[u>>2]|0)>>>0?c[v>>2]|0:c[u>>2]|0;if(c[o>>2]|0){_q(t,c[r>>2]|0,c[s>>2]|0);Uw(t+(c[s>>2]|0)|0,0,16-(c[s>>2]|0)|0)|0;a[t+(c[s>>2]|0)>>0]=-128;dr((c[n>>2]|0)+80|0,t,16);br(c[p>>2]|0,c[r>>2]|0,y,c[s>>2]|0);break}else{_q(t,y,16);_q(t,c[r>>2]|0,c[s>>2]|0);dr(t,y,16);a[t+(c[s>>2]|0)>>0]=-128;_q(c[p>>2]|0,t,c[s>>2]|0);dr((c[n>>2]|0)+80|0,t,16);break}}while(0);if((d[(c[n>>2]|0)+56>>0]|0)>>>3&1|0){br((c[n>>2]|0)+128+288|0,(c[n>>2]|0)+80|0,(c[n>>2]|0)+64|0,16);dr((c[n>>2]|0)+128+288|0,(c[n>>2]|0)+128+16|0,16);c[v>>2]=ub[c[(c[(c[n>>2]|0)+12>>2]|0)+36>>2]&63]((c[n>>2]|0)+496|0,(c[n>>2]|0)+128+288|0,(c[n>>2]|0)+128+288|0)|0;c[u>>2]=(c[v>>2]|0)>>>0>(c[u>>2]|0)>>>0?c[v>>2]|0:c[u>>2]|0;v=(c[n>>2]|0)+128+353|0;a[v>>0]=a[v>>0]&-2|1}if((c[u>>2]|0)>>>0>0){bf((c[u>>2]|0)+16|0);cf()}c[k>>2]=0;z=c[k>>2]|0;l=j;return z|0}c[k>>2]=156;z=c[k>>2]|0;l=j;return z|0}function gr(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;while(1){if((c[h>>2]|0)>>>0<=0)break;dr(c[f>>2]|0,c[g>>2]|0,16);c[g>>2]=(c[g>>2]|0)+16;c[h>>2]=(c[h>>2]|0)+-1}l=e;return}function hr(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;f=fr(c[h>>2]|0,0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0;l=g;return f|0}function ir(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+40|0;i=g+36|0;j=g+32|0;k=g+28|0;n=g+24|0;o=g+20|0;p=g+16|0;q=g+12|0;r=g+8|0;s=g+4|0;t=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[q>>2]=c[(c[(c[i>>2]|0)+12>>2]|0)+36>>2];c[r>>2]=c[(c[(c[i>>2]|0)+12>>2]|0)+20>>2];if((c[k>>2]|0)>>>0<(c[o>>2]|0)>>>0){c[h>>2]=200;u=c[h>>2]|0;l=g;return u|0}if((c[o>>2]|0)>>>0<=(c[(c[i>>2]|0)+112>>2]|0)>>>0){c[p>>2]=(c[i>>2]|0)+64+(c[r>>2]|0)+(0-(c[(c[i>>2]|0)+112>>2]|0));jr(c[j>>2]|0,c[p>>2]|0,c[n>>2]|0,c[o>>2]|0);k=(c[i>>2]|0)+112|0;c[k>>2]=(c[k>>2]|0)-(c[o>>2]|0);c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}c[s>>2]=0;if(c[(c[i>>2]|0)+112>>2]|0){c[o>>2]=(c[o>>2]|0)-(c[(c[i>>2]|0)+112>>2]|0);c[p>>2]=(c[i>>2]|0)+64+(c[r>>2]|0)+(0-(c[(c[i>>2]|0)+112>>2]|0));jr(c[j>>2]|0,c[p>>2]|0,c[n>>2]|0,c[(c[i>>2]|0)+112>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[(c[i>>2]|0)+112>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[(c[i>>2]|0)+112>>2]|0);c[(c[i>>2]|0)+112>>2]=0}while(1){if((c[o>>2]|0)>>>0<(c[r>>2]|0)>>>0)break;c[t>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[s>>2]=(c[t>>2]|0)>>>0>(c[s>>2]|0)>>>0?c[t>>2]|0:c[s>>2]|0;jr(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[r>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[r>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[o>>2]=(c[o>>2]|0)-(c[r>>2]|0)}if(c[o>>2]|0){c[t>>2]=ub[c[q>>2]&63]((c[i>>2]|0)+496|0,(c[i>>2]|0)+64|0,(c[i>>2]|0)+64|0)|0;c[s>>2]=(c[t>>2]|0)>>>0>(c[s>>2]|0)>>>0?c[t>>2]|0:c[s>>2]|0;c[(c[i>>2]|0)+112>>2]=c[r>>2];r=(c[i>>2]|0)+112|0;c[r>>2]=(c[r>>2]|0)-(c[o>>2]|0);jr(c[j>>2]|0,(c[i>>2]|0)+64|0,c[n>>2]|0,c[o>>2]|0);c[j>>2]=(c[j>>2]|0)+(c[o>>2]|0);c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);c[o>>2]=0}if((c[s>>2]|0)>>>0>0){bf((c[s>>2]|0)+16|0);cf()}c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}function jr(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function kr(b){b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;f=d+8|0;c[e>>2]=b;a[f>>0]=0;a[f+1>>0]=0;a[f+2>>0]=0;a[f+3>>0]=0;a[f+4>>0]=0;a[f+5>>0]=0;a[f+6>>0]=0;a[f+7>>0]=0;b=mr(c[e>>2]|0,f,8)|0;l=d;return b|0}function lr(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=0;b=c[f>>2]|0;c[b>>2]=(c[b>>2]|0)+(c[g>>2]|0);if((c[c[f>>2]>>2]|0)>>>0>=(c[g>>2]|0)>>>0){c[e>>2]=c[h>>2];i=c[e>>2]|0;l=d;return i|0}else{g=(c[f>>2]|0)+4|0;c[g>>2]=(c[g>>2]|0)+1;c[e>>2]=((c[(c[f>>2]|0)+4>>2]|0)>>>0<1?1:(c[h>>2]|0)!=0)&1;i=c[e>>2]|0;l=d;return i|0}return 0}function mr(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+112|0;if((l|0)>=(m|0))$(112);h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;n=g+48|0;o=g+20|0;p=g+16|0;q=g+12|0;r=g+40|0;s=g;t=g+8|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;if((c[j>>2]|0)==0&(c[k>>2]|0)!=12){c[h>>2]=45;u=c[h>>2]|0;l=g;return u|0}f=(c[i>>2]|0)+128+20|0;e=f+92|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(e|0));c[(c[i>>2]|0)+128>>2]=0;c[(c[i>>2]|0)+128+4>>2]=0;c[(c[i>>2]|0)+128+8>>2]=0;c[(c[i>>2]|0)+128+8+4>>2]=0;b=(c[i>>2]|0)+128+16|0;a[b>>0]=a[b>>0]&-3;b=(c[i>>2]|0)+128+16|0;a[b>>0]=a[b>>0]&-2;b=(c[i>>2]|0)+56|0;a[b>>0]=a[b>>0]&-5;b=(c[i>>2]|0)+56|0;a[b>>0]=a[b>>0]&-3;zb[c[(c[(c[i>>2]|0)+12>>2]|0)+60>>2]&7]((c[i>>2]|0)+496|0,c[j>>2]|0,c[k>>2]|0);f=n;e=f+64|0;do{a[f>>0]=0;f=f+1|0}while((f|0)<(e|0));Eb[c[(c[(c[i>>2]|0)+12>>2]|0)+44>>2]&1]((c[i>>2]|0)+496|0,n,n,64);c[o>>2]=Sr((c[i>>2]|0)+128+20|0,n,32)|0;c[p>>2]=n;c[q>>2]=64;a[r>>0]=0;n=s;c[n>>2]=d[r>>0];c[n+4>>2]=0;while(1){if(!(c[p>>2]&7|0?(c[q>>2]|0)!=0:0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}if((c[q>>2]|0)>>>0>=8){n=s;f=gx(c[n>>2]|0,c[n+4>>2]|0,16843009,16843009)|0;n=s;c[n>>2]=f;c[n+4>>2]=D;do{c[t>>2]=c[p>>2];n=s;f=c[n+4>>2]|0;e=c[t>>2]|0;c[e>>2]=c[n>>2];c[e+4>>2]=f;c[q>>2]=(c[q>>2]|0)-8;c[p>>2]=(c[p>>2]|0)+8}while((c[q>>2]|0)>>>0>=8)}while(1){if(!(c[q>>2]|0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}if(c[o>>2]|0){c[h>>2]=c[o>>2];u=c[h>>2]|0;l=g;return u|0}else{o=(c[i>>2]|0)+56|0;a[o>>0]=a[o>>0]&-3|2;c[h>>2]=0;u=c[h>>2]|0;l=g;return u|0}return 0}function nr(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+24|0;k=i+20|0;n=i+16|0;o=i+12|0;p=i+8|0;q=i+4|0;r=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[o>>2]|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;s=c[j>>2]|0;l=i;return s|0}if((d[(c[k>>2]|0)+56>>0]|0)>>>2&1|0){c[j>>2]=156;s=c[j>>2]|0;l=i;return s|0}if((d[(c[k>>2]|0)+128+16>>0]|0)>>>1&1|0){c[j>>2]=139;s=c[j>>2]|0;l=i;return s|0}if(((d[(c[k>>2]|0)+56>>0]|0)>>>1&1|0)==0?(c[r>>2]=kr(c[k>>2]|0)|0,c[r>>2]|0):0){c[j>>2]=c[r>>2];s=c[j>>2]|0;l=i;return s|0}if(!(a[(c[k>>2]|0)+128+16>>0]&1))or(c[k>>2]|0);r=(lr((c[k>>2]|0)+128+8|0,c[q>>2]|0)|0)!=0;o=c[k>>2]|0;if(r){r=o+128+16|0;a[r>>0]=a[r>>0]&-3|2;c[j>>2]=139;s=c[j>>2]|0;l=i;return s|0}else{Eb[c[(c[o+12>>2]|0)+44>>2]&1]((c[k>>2]|0)+496|0,c[n>>2]|0,c[p>>2]|0,c[q>>2]|0);Or((c[k>>2]|0)+128+20|0,c[n>>2]|0,c[q>>2]|0);c[j>>2]=0;s=c[j>>2]|0;l=i;return s|0}return 0}function or(b){b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;pr(c[e>>2]|0,(c[e>>2]|0)+128|0);b=(c[e>>2]|0)+128+16|0;a[b>>0]=a[b>>0]&-2|1;c[(c[e>>2]|0)+128+8>>2]=0;c[(c[e>>2]|0)+128+8+4>>2]=0;l=d;return}function pr(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;if((((c[c[f>>2]>>2]|0)>>>0)%16|0)>>>0<=0){l=d;return}c[g>>2]=16-(((c[c[f>>2]>>2]|0)>>>0)%16|0);Or((c[e>>2]|0)+128+20|0,72283,c[g>>2]|0);l=d;return}function qr(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+24|0;k=i+20|0;n=i+16|0;o=i+12|0;p=i+8|0;q=i+4|0;r=i;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;if((c[o>>2]|0)>>>0<(c[q>>2]|0)>>>0){c[j>>2]=200;s=c[j>>2]|0;l=i;return s|0}if((d[(c[k>>2]|0)+56>>0]|0)>>>2&1|0){c[j>>2]=156;s=c[j>>2]|0;l=i;return s|0}if((d[(c[k>>2]|0)+128+16>>0]|0)>>>1&1|0){c[j>>2]=139;s=c[j>>2]|0;l=i;return s|0}if(((d[(c[k>>2]|0)+56>>0]|0)>>>1&1|0)==0?(c[r>>2]=kr(c[k>>2]|0)|0,c[r>>2]|0):0){c[j>>2]=c[r>>2];s=c[j>>2]|0;l=i;return s|0}if(!(a[(c[k>>2]|0)+128+16>>0]&1))or(c[k>>2]|0);r=(lr((c[k>>2]|0)+128+8|0,c[q>>2]|0)|0)!=0;o=(c[k>>2]|0)+128|0;if(r){r=o+16|0;a[r>>0]=a[r>>0]&-3|2;c[j>>2]=139;s=c[j>>2]|0;l=i;return s|0}else{Or(o+20|0,c[p>>2]|0,c[q>>2]|0);Eb[c[(c[(c[k>>2]|0)+12>>2]|0)+48>>2]&1]((c[k>>2]|0)+496|0,c[n>>2]|0,c[p>>2]|0,c[q>>2]|0);c[j>>2]=0;s=c[j>>2]|0;l=i;return s|0}return 0}function rr(b){b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;c[(c[e>>2]|0)+128>>2]=0;c[(c[e>>2]|0)+128+4>>2]=0;c[(c[e>>2]|0)+128+8>>2]=0;c[(c[e>>2]|0)+128+8+4>>2]=0;b=(c[e>>2]|0)+128+16|0;a[b>>0]=a[b>>0]&-3;b=(c[e>>2]|0)+128+16|0;a[b>>0]=a[b>>0]&-2;b=(c[e>>2]|0)+56|0;a[b>>0]=a[b>>0]&-5;b=(c[e>>2]|0)+56|0;a[b>>0]=a[b>>0]&-3;l=d;return}function sr(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;j=l;l=l+80|0;if((l|0)>=(m|0))$(80);k=j+72|0;n=j+64|0;o=j+60|0;p=j+56|0;q=j+52|0;r=j+48|0;s=j+44|0;t=j+40|0;u=j+36|0;v=j+32|0;w=j+28|0;x=j+24|0;y=j+20|0;z=j+16|0;A=j+12|0;B=j+8|0;C=j+4|0;D=j;c[j+68>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;c[C>>2]=(c[s>>2]|0)+15;c[C>>2]=(c[C>>2]|0)-(c[C>>2]&15);c[D>>2]=(c[C>>2]|0)+(c[r>>2]<<1)+((S(c[r>>2]|0,c[q>>2]|0)|0)*3|0)+16;c[B>>2]=wf(1,c[D>>2]|0)|0;if(!(c[B>>2]|0)){c[k>>2]=46964;E=c[k>>2]|0;l=j;return E|0}c[u>>2]=16-(c[B>>2]&15)&15;c[v>>2]=(c[B>>2]|0)+(c[u>>2]|0);c[z>>2]=(c[v>>2]|0)+(c[C>>2]|0);c[A>>2]=(c[z>>2]|0)+(c[r>>2]|0);c[w>>2]=(c[A>>2]|0)+(c[r>>2]|0);c[x>>2]=(c[w>>2]|0)+(S(c[q>>2]|0,c[r>>2]|0)|0);c[y>>2]=(c[x>>2]|0)+(S(c[q>>2]|0,c[r>>2]|0)|0);if(ub[c[n>>2]&63](c[v>>2]|0,16,16)|0){vf(c[B>>2]|0);c[k>>2]=46990;E=c[k>>2]|0;l=j;return E|0}Uw(c[z>>2]|0,78,c[r>>2]|0)|0;Uw(c[A>>2]|0,78,c[r>>2]|0)|0;c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[r>>2]|0))break;a[(c[w>>2]|0)+(c[t>>2]|0)>>0]=c[t>>2];c[t>>2]=(c[t>>2]|0)+1}tr(c[y>>2]|0,c[z>>2]|0,c[w>>2]|0,c[r>>2]|0);ub[c[o>>2]&63](c[v>>2]|0,c[y>>2]|0,c[y>>2]|0)|0;_w(c[z>>2]|0,c[y>>2]|0,c[r>>2]|0)|0;vb[c[p>>2]&15](c[v>>2]|0,c[A>>2]|0,c[x>>2]|0,c[y>>2]|0,1);if(Jv(c[x>>2]|0,c[w>>2]|0,c[r>>2]|0)|0){vf(c[B>>2]|0);c[k>>2]=47004;E=c[k>>2]|0;l=j;return E|0}if(Jv(c[A>>2]|0,c[z>>2]|0,c[r>>2]|0)|0){vf(c[B>>2]|0);c[k>>2]=47004;E=c[k>>2]|0;l=j;return E|0}Uw(c[z>>2]|0,95,c[r>>2]|0)|0;Uw(c[A>>2]|0,95,c[r>>2]|0)|0;c[t>>2]=0;while(1){if((c[t>>2]|0)>=(S(c[q>>2]|0,c[r>>2]|0)|0))break;a[(c[w>>2]|0)+(c[t>>2]|0)>>0]=c[t>>2];c[t>>2]=(c[t>>2]|0)+1}c[t>>2]=0;while(1){if((c[t>>2]|0)>=(S(c[q>>2]|0,c[r>>2]|0)|0))break;tr((c[y>>2]|0)+(c[t>>2]|0)|0,c[z>>2]|0,(c[w>>2]|0)+(c[t>>2]|0)|0,c[r>>2]|0);ub[c[o>>2]&63](c[v>>2]|0,(c[y>>2]|0)+(c[t>>2]|0)|0,(c[y>>2]|0)+(c[t>>2]|0)|0)|0;_w(c[z>>2]|0,(c[y>>2]|0)+(c[t>>2]|0)|0,c[r>>2]|0)|0;c[t>>2]=(c[t>>2]|0)+(c[r>>2]|0)}vb[c[p>>2]&15](c[v>>2]|0,c[A>>2]|0,c[x>>2]|0,c[y>>2]|0,c[q>>2]|0);if(Jv(c[x>>2]|0,c[w>>2]|0,S(c[q>>2]|0,c[r>>2]|0)|0)|0){vf(c[B>>2]|0);c[k>>2]=47004;E=c[k>>2]|0;l=j;return E|0}q=(Jv(c[A>>2]|0,c[z>>2]|0,c[r>>2]|0)|0)!=0;vf(c[B>>2]|0);if(q){c[k>>2]=47004;E=c[k>>2]|0;l=j;return E|0}else{c[k>>2]=0;E=c[k>>2]|0;l=j;return E|0}return 0}function tr(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function ur(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;j=l;l=l+80|0;if((l|0)>=(m|0))$(80);k=j+72|0;n=j+64|0;o=j+60|0;p=j+56|0;q=j+52|0;r=j+48|0;s=j+44|0;t=j+40|0;u=j+36|0;v=j+32|0;w=j+28|0;x=j+24|0;y=j+20|0;z=j+16|0;A=j+12|0;B=j+8|0;C=j+4|0;D=j;c[j+68>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;c[C>>2]=(c[s>>2]|0)+15;c[C>>2]=(c[C>>2]|0)-(c[C>>2]&15);c[D>>2]=(c[C>>2]|0)+(c[r>>2]<<1)+((S(c[r>>2]|0,c[q>>2]|0)|0)*3|0)+16;c[B>>2]=wf(1,c[D>>2]|0)|0;if(!(c[B>>2]|0)){c[k>>2]=46964;E=c[k>>2]|0;l=j;return E|0}c[u>>2]=16-(c[B>>2]&15)&15;c[v>>2]=(c[B>>2]|0)+(c[u>>2]|0);c[z>>2]=(c[v>>2]|0)+(c[C>>2]|0);c[A>>2]=(c[z>>2]|0)+(c[r>>2]|0);c[w>>2]=(c[A>>2]|0)+(c[r>>2]|0);c[x>>2]=(c[w>>2]|0)+(S(c[q>>2]|0,c[r>>2]|0)|0);c[y>>2]=(c[x>>2]|0)+(S(c[q>>2]|0,c[r>>2]|0)|0);if(ub[c[n>>2]&63](c[v>>2]|0,32,16)|0){vf(c[B>>2]|0);c[k>>2]=46990;E=c[k>>2]|0;l=j;return E|0}Uw(c[z>>2]|0,-45,c[r>>2]|0)|0;Uw(c[A>>2]|0,-45,c[r>>2]|0)|0;c[t>>2]=0;while(1){if((c[t>>2]|0)>=(c[r>>2]|0))break;a[(c[w>>2]|0)+(c[t>>2]|0)>>0]=c[t>>2];c[t>>2]=(c[t>>2]|0)+1}ub[c[o>>2]&63](c[v>>2]|0,c[y>>2]|0,c[z>>2]|0)|0;vr(c[z>>2]|0,c[y>>2]|0,c[w>>2]|0,c[r>>2]|0);vb[c[p>>2]&15](c[v>>2]|0,c[A>>2]|0,c[x>>2]|0,c[y>>2]|0,1);if(Jv(c[x>>2]|0,c[w>>2]|0,c[r>>2]|0)|0){vf(c[B>>2]|0);c[k>>2]=47053;E=c[k>>2]|0;l=j;return E|0}if(Jv(c[A>>2]|0,c[z>>2]|0,c[r>>2]|0)|0){vf(c[B>>2]|0);c[k>>2]=47053;E=c[k>>2]|0;l=j;return E|0}Uw(c[z>>2]|0,-26,c[r>>2]|0)|0;Uw(c[A>>2]|0,-26,c[r>>2]|0)|0;c[t>>2]=0;while(1){if((c[t>>2]|0)>=(S(c[q>>2]|0,c[r>>2]|0)|0))break;a[(c[w>>2]|0)+(c[t>>2]|0)>>0]=c[t>>2];c[t>>2]=(c[t>>2]|0)+1}c[t>>2]=0;while(1){if((c[t>>2]|0)>=(S(c[q>>2]|0,c[r>>2]|0)|0))break;ub[c[o>>2]&63](c[v>>2]|0,(c[y>>2]|0)+(c[t>>2]|0)|0,c[z>>2]|0)|0;vr(c[z>>2]|0,(c[y>>2]|0)+(c[t>>2]|0)|0,(c[w>>2]|0)+(c[t>>2]|0)|0,c[r>>2]|0);c[t>>2]=(c[t>>2]|0)+(c[r>>2]|0)}vb[c[p>>2]&15](c[v>>2]|0,c[A>>2]|0,c[x>>2]|0,c[y>>2]|0,c[q>>2]|0);if(Jv(c[x>>2]|0,c[w>>2]|0,S(c[q>>2]|0,c[r>>2]|0)|0)|0){vf(c[B>>2]|0);c[k>>2]=47053;E=c[k>>2]|0;l=j;return E|0}q=(Jv(c[A>>2]|0,c[z>>2]|0,c[r>>2]|0)|0)!=0;vf(c[B>>2]|0);if(q){c[k>>2]=47053;E=c[k>>2]|0;l=j;return E|0}else{c[k>>2]=0;E=c[k>>2]|0;l=j;return E|0}return 0}function vr(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[q>>2]|c[o>>2]|c[p>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[t>>2]|0;c[t>>2]=k+4;j=c[k>>2]|0;k=c[s>>2]|0;c[s>>2]=k+4;i=c[k>>2]^j;c[k>>2]=i;k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[q>>2]|0;c[q>>2]=t+1;s=d[t>>0]|0;t=c[p>>2]|0;c[p>>2]=t+1;r=((d[t>>0]|0)^s)&255;a[t>>0]=r;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function wr(b,e,f,g,h,i,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;k=l;l=l+96|0;if((l|0)>=(m|0))$(96);n=k+84|0;o=k+76|0;p=k+72|0;q=k+68|0;r=k+64|0;s=k+60|0;t=k+56|0;u=k+52|0;v=k+48|0;w=k+44|0;x=k+40|0;y=k+36|0;z=k+32|0;A=k+28|0;B=k+24|0;C=k+20|0;D=k+16|0;E=k+12|0;F=k+8|0;G=k+4|0;H=k;c[k+80>>2]=b;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;c[t>>2]=j;c[G>>2]=(c[t>>2]|0)+15;c[G>>2]=(c[G>>2]|0)-(c[G>>2]&15);c[H>>2]=(c[G>>2]|0)+(c[s>>2]<<1)+((S(c[s>>2]|0,c[r>>2]|0)|0)<<2)+16;c[F>>2]=wf(1,c[H>>2]|0)|0;if(!(c[F>>2]|0)){c[n>>2]=46964;I=c[n>>2]|0;l=k;return I|0}c[w>>2]=16-(c[F>>2]&15)&15;c[y>>2]=(c[F>>2]|0)+(c[w>>2]|0);c[D>>2]=(c[y>>2]|0)+(c[G>>2]|0);c[E>>2]=(c[D>>2]|0)+(c[s>>2]|0);c[z>>2]=(c[E>>2]|0)+(c[s>>2]|0);c[A>>2]=(c[z>>2]|0)+(S(c[r>>2]|0,c[s>>2]|0)|0);c[B>>2]=(c[A>>2]|0)+(S(c[r>>2]|0,c[s>>2]|0)|0);c[C>>2]=(c[B>>2]|0)+(S(c[r>>2]|0,c[s>>2]|0)|0);if(ub[c[o>>2]&63](c[y>>2]|0,48,16)|0){vf(c[F>>2]|0);c[n>>2]=46990;I=c[n>>2]|0;l=k;return I|0}Uw(c[D>>2]|0,-1,c[s>>2]|0)|0;c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[s>>2]|0))break;a[(c[z>>2]|0)+(c[u>>2]|0)>>0]=c[u>>2];c[u>>2]=(c[u>>2]|0)+1}ub[c[p>>2]&63](c[y>>2]|0,c[B>>2]|0,c[D>>2]|0)|0;c[u>>2]=0;while(1){if((c[u>>2]|0)>=(c[s>>2]|0))break;o=(c[B>>2]|0)+(c[u>>2]|0)|0;a[o>>0]=d[o>>0]^d[(c[z>>2]|0)+(c[u>>2]|0)>>0];c[u>>2]=(c[u>>2]|0)+1}c[u>>2]=c[s>>2];while(1){if((c[u>>2]|0)<=0)break;o=(c[D>>2]|0)+((c[u>>2]|0)-1)|0;a[o>>0]=(a[o>>0]|0)+1<<24>>24;if(a[(c[D>>2]|0)+((c[u>>2]|0)-1)>>0]|0)break;c[u>>2]=(c[u>>2]|0)+-1}Uw(c[E>>2]|0,-1,c[s>>2]|0)|0;vb[c[q>>2]&15](c[y>>2]|0,c[E>>2]|0,c[A>>2]|0,c[B>>2]|0,1);if(Jv(c[A>>2]|0,c[z>>2]|0,c[s>>2]|0)|0){vf(c[F>>2]|0);c[n>>2]=47102;I=c[n>>2]|0;l=k;return I|0}if(Jv(c[E>>2]|0,c[D>>2]|0,c[s>>2]|0)|0){vf(c[F>>2]|0);c[n>>2]=47102;I=c[n>>2]|0;l=k;return I|0}Uw(c[D>>2]|0,87,(c[s>>2]|0)-4|0)|0;a[(c[D>>2]|0)+((c[s>>2]|0)-1)>>0]=1;a[(c[D>>2]|0)+((c[s>>2]|0)-2)>>0]=0;a[(c[D>>2]|0)+((c[s>>2]|0)-3)>>0]=0;a[(c[D>>2]|0)+((c[s>>2]|0)-4)>>0]=0;Uw(c[E>>2]|0,87,(c[s>>2]|0)-4|0)|0;a[(c[E>>2]|0)+((c[s>>2]|0)-1)>>0]=1;a[(c[E>>2]|0)+((c[s>>2]|0)-2)>>0]=0;a[(c[E>>2]|0)+((c[s>>2]|0)-3)>>0]=0;a[(c[E>>2]|0)+((c[s>>2]|0)-4)>>0]=0;c[u>>2]=0;while(1){if((c[u>>2]|0)>=(S(c[s>>2]|0,c[r>>2]|0)|0))break;o=c[u>>2]&255;a[(c[z>>2]|0)+(c[u>>2]|0)>>0]=o;a[(c[A>>2]|0)+(c[u>>2]|0)>>0]=o;c[u>>2]=(c[u>>2]|0)+1}c[u>>2]=0;while(1){if((c[u>>2]|0)>=(S(c[s>>2]|0,c[r>>2]|0)|0))break;ub[c[p>>2]&63](c[y>>2]|0,(c[B>>2]|0)+(c[u>>2]|0)|0,c[D>>2]|0)|0;c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[s>>2]|0))break;o=(c[B>>2]|0)+((c[u>>2]|0)+(c[v>>2]|0))|0;a[o>>0]=d[o>>0]^d[(c[z>>2]|0)+((c[u>>2]|0)+(c[v>>2]|0))>>0];c[v>>2]=(c[v>>2]|0)+1}c[v>>2]=c[s>>2];while(1){if((c[v>>2]|0)<=0)break;o=(c[D>>2]|0)+((c[v>>2]|0)-1)|0;a[o>>0]=(a[o>>0]|0)+1<<24>>24;if(a[(c[D>>2]|0)+((c[v>>2]|0)-1)>>0]|0)break;c[v>>2]=(c[v>>2]|0)+-1}c[u>>2]=(c[u>>2]|0)+(c[s>>2]|0)}vb[c[q>>2]&15](c[y>>2]|0,c[E>>2]|0,c[C>>2]|0,c[A>>2]|0,c[r>>2]|0);if(Jv(c[C>>2]|0,c[B>>2]|0,S(c[s>>2]|0,c[r>>2]|0)|0)|0){vf(c[F>>2]|0);c[n>>2]=47102;I=c[n>>2]|0;l=k;return I|0}if(Jv(c[E>>2]|0,c[D>>2]|0,c[s>>2]|0)|0){vf(c[F>>2]|0);c[n>>2]=47102;I=c[n>>2]|0;l=k;return I|0}c[x>>2]=0;while(1){if((c[x>>2]|0)>=(c[r>>2]|0)){J=56;break}Uw(c[D>>2]|0,-1,c[s>>2]|0)|0;C=(c[D>>2]|0)+((c[s>>2]|0)-1)|0;a[C>>0]=(d[C>>0]|0)-(c[x>>2]|0);a[(c[D>>2]|0)+1>>0]=0;a[c[D>>2]>>0]=0;a[(c[D>>2]|0)+2>>0]=7;c[u>>2]=0;while(1){if((c[u>>2]|0)>=(S(c[s>>2]|0,c[r>>2]|0)|0))break;a[(c[z>>2]|0)+(c[u>>2]|0)>>0]=c[u>>2];c[u>>2]=(c[u>>2]|0)+1}c[u>>2]=0;while(1){if((c[u>>2]|0)>=(S(c[s>>2]|0,c[r>>2]|0)|0))break;ub[c[p>>2]&63](c[y>>2]|0,(c[B>>2]|0)+(c[u>>2]|0)|0,c[D>>2]|0)|0;c[v>>2]=0;while(1){if((c[v>>2]|0)>=(c[s>>2]|0))break;C=(c[B>>2]|0)+((c[u>>2]|0)+(c[v>>2]|0))|0;a[C>>0]=d[C>>0]^d[(c[z>>2]|0)+((c[u>>2]|0)+(c[v>>2]|0))>>0];c[v>>2]=(c[v>>2]|0)+1}c[v>>2]=c[s>>2];while(1){if((c[v>>2]|0)<=0)break;C=(c[D>>2]|0)+((c[v>>2]|0)-1)|0;a[C>>0]=(a[C>>0]|0)+1<<24>>24;if(a[(c[D>>2]|0)+((c[v>>2]|0)-1)>>0]|0)break;c[v>>2]=(c[v>>2]|0)+-1}c[u>>2]=(c[u>>2]|0)+(c[s>>2]|0)}Uw(c[E>>2]|0,-1,c[s>>2]|0)|0;C=(c[E>>2]|0)+((c[s>>2]|0)-1)|0;a[C>>0]=(d[C>>0]|0)-(c[x>>2]|0);a[(c[E>>2]|0)+1>>0]=0;a[c[E>>2]>>0]=0;a[(c[E>>2]|0)+2>>0]=7;vb[c[q>>2]&15](c[y>>2]|0,c[E>>2]|0,c[A>>2]|0,c[B>>2]|0,c[r>>2]|0);if(Jv(c[A>>2]|0,c[z>>2]|0,S(c[s>>2]|0,c[r>>2]|0)|0)|0){J=52;break}if(Jv(c[E>>2]|0,c[D>>2]|0,c[s>>2]|0)|0){J=54;break}c[x>>2]=(c[x>>2]|0)+1}if((J|0)==52){vf(c[F>>2]|0);c[n>>2]=47102;I=c[n>>2]|0;l=k;return I|0}else if((J|0)==54){vf(c[F>>2]|0);c[n>>2]=47102;I=c[n>>2]|0;l=k;return I|0}else if((J|0)==56){vf(c[F>>2]|0);c[n>>2]=0;I=c[n>>2]|0;l=k;return I|0}return 0}function xr(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0;d=l;l=l+352|0;if((l|0)>=(m|0))$(352);e=d+160|0;f=d+128|0;g=d+48|0;h=d+40|0;i=d+32|0;j=d+24|0;k=d+16|0;n=d+8|0;o=d;p=d+344|0;q=d+340|0;r=d+336|0;s=d+332|0;t=d+328|0;u=d+284|0;v=d+224|0;w=d+220|0;x=d+216|0;y=d+212|0;z=d+208|0;A=d+204|0;B=d+200|0;C=d+196|0;D=d+192|0;E=d+188|0;F=d+184|0;G=d+180|0;H=d+176|0;I=d+172|0;J=d+168|0;K=d+164|0;c[q>>2]=a;c[r>>2]=b;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;c[A>>2]=0;c[C>>2]=0;c[D>>2]=0;c[E>>2]=0;c[F>>2]=0;c[G>>2]=0;c[H>>2]=0;c[I>>2]=0;b=u;a=b+44|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(a|0));b=v;a=b+60|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(a|0));c[s>>2]=Gj(c[q>>2]|0,t)|0;if(c[s>>2]|0){c[p>>2]=c[s>>2];L=c[p>>2]|0;l=d;return L|0}c[B>>2]=Tf(c[q>>2]|0,47218,0)|0;if(c[B>>2]|0?(c[A>>2]=_f(c[B>>2]|0,1)|0,Rf(c[B>>2]|0),(c[A>>2]|0)==0):0){c[p>>2]=65;L=c[p>>2]|0;l=d;return L|0}c[B>>2]=Tf(c[q>>2]|0,47178,0)|0;if(!(c[B>>2]|0?(c[s>>2]=Fj(c[B>>2]|0,I,0)|0,Rf(c[B>>2]|0),(c[s>>2]|0)!=0):0))M=8;do if((M|0)==8){c[B>>2]=Tf(c[q>>2]|0,48942,0)|0;if(c[B>>2]|0){c[I>>2]=c[I>>2]|32;Rf(c[B>>2]|0)}if(!((c[t>>2]|0)!=0|(c[A>>2]|0)!=0)){c[p>>2]=68;L=c[p>>2]|0;l=d;return L|0}c[s>>2]=Qh(c[t>>2]|0,c[A>>2]|0,u,t)|0;vf(c[A>>2]|0);c[A>>2]=0;if(!(c[s>>2]|0)){if(Ff(1)|0){b=vi(c[u>>2]|0)|0;a=wi(c[u+4>>2]|0)|0;c[o>>2]=b;c[o+4>>2]=a;Ye(48956,o);if(c[u+40>>2]|0){c[n>>2]=c[u+40>>2];Ye(48981,n)}af(49003,c[u+8>>2]|0);af(49019,c[u+12>>2]|0);af(49035,c[u+16>>2]|0);af(49051,c[u+32>>2]|0);af(49067,c[u+36>>2]|0);sn(49083,u+20|0,0)}c[C>>2]=En(c[u>>2]|0,c[u+4>>2]|0,0,c[u+8>>2]|0,c[u+12>>2]|0,c[u+16>>2]|0)|0;a=c[C>>2]|0;b=c[I>>2]|0;if(c[I>>2]&4096|0)c[s>>2]=ki(v,u,a,b)|0;else c[s>>2]=Ir(v,u,a,b,c[t>>2]|0,y,z)|0;if(!(c[s>>2]|0)){c[w>>2]=Rp(0)|0;c[x>>2]=Rp(0)|0;if(tn(c[w>>2]|0,c[x>>2]|0,v+20|0,c[C>>2]|0)|0){c[k>>2]=49145;We(49097,k)}c[F>>2]=xi(c[w>>2]|0,c[x>>2]|0,c[v+8>>2]|0)|0;do if((c[v+4>>2]|0)==1?!(c[I>>2]&2048|0):0){c[s>>2]=ci(v+44|0,c[C>>2]|0,c[w>>2]|0,c[x>>2]|0,((c[I>>2]&1024|0)!=0^1^1)&1,J,K)|0;if(!(c[s>>2]|0)){c[G>>2]=Rp(0)|0;Ep(c[G>>2]|0,c[J>>2]|0,c[K>>2]<<3)|0;c[J>>2]=0;break}c[p>>2]=c[s>>2];L=c[p>>2]|0;l=d;return L|0}else M=28;while(0);if((M|0)==28){if((c[y>>2]|0)==0?(c[y>>2]=Rp(0)|0,c[z>>2]=Rp(0)|0,tn(c[y>>2]|0,c[z>>2]|0,v+44|0,c[C>>2]|0)|0):0){c[j>>2]=49147;We(49097,j)}c[G>>2]=xi(c[y>>2]|0,c[z>>2]|0,c[v+8>>2]|0)|0}c[H>>2]=c[v+56>>2];c[v+56>>2]=0;if(c[u+40>>2]|0?(c[i>>2]=c[u+40>>2],c[s>>2]=cg(D,0,49149,i)|0,c[s>>2]|0):0)break;if(!(!(c[I>>2]&512|0)?!(c[I>>2]&4096|0):0)){if(c[I>>2]&512|0?c[I>>2]&4096|0:0)N=49188;else N=c[I>>2]&512|0?49160:49174;c[s>>2]=cg(E,0,N,h)|0;if(c[s>>2]|0)break}if(c[I>>2]&512|0?c[u+40>>2]|0:0){b=c[r>>2]|0;a=c[E>>2]|0;O=c[v+8>>2]|0;P=c[v+12>>2]|0;Q=c[v+16>>2]|0;R=c[F>>2]|0;S=c[v+32>>2]|0;T=c[v+36>>2]|0;U=c[G>>2]|0;V=c[D>>2]|0;W=c[E>>2]|0;X=c[v+8>>2]|0;Y=c[v+12>>2]|0;Z=c[v+16>>2]|0;_=c[F>>2]|0;aa=c[v+32>>2]|0;ba=c[v+36>>2]|0;ca=c[G>>2]|0;da=c[H>>2]|0;c[g>>2]=c[D>>2];c[g+4>>2]=a;c[g+8>>2]=O;c[g+12>>2]=P;c[g+16>>2]=Q;c[g+20>>2]=R;c[g+24>>2]=S;c[g+28>>2]=T;c[g+32>>2]=U;c[g+36>>2]=V;c[g+40>>2]=W;c[g+44>>2]=X;c[g+48>>2]=Y;c[g+52>>2]=Z;c[g+56>>2]=_;c[g+60>>2]=aa;c[g+64>>2]=ba;c[g+68>>2]=ca;c[g+72>>2]=da;c[s>>2]=cg(b,0,49208,g)|0}else{b=c[r>>2]|0;da=c[E>>2]|0;ca=c[G>>2]|0;ba=c[D>>2]|0;aa=c[E>>2]|0;_=c[G>>2]|0;Z=c[H>>2]|0;c[f>>2]=c[D>>2];c[f+4>>2]=da;c[f+8>>2]=ca;c[f+12>>2]=ba;c[f+16>>2]=aa;c[f+20>>2]=_;c[f+24>>2]=Z;c[s>>2]=cg(b,0,49344,f)|0}if(((c[s>>2]|0)==0?Ff(1)|0:0)?(af(49420,c[v+8>>2]|0),af(49436,c[v+12>>2]|0),af(49452,c[v+16>>2]|0),af(49468,c[F>>2]|0),af(49484,c[v+32>>2]|0),af(49500,c[v+36>>2]|0),af(49516,c[G>>2]|0),af(49532,c[H>>2]|0),c[I>>2]&4096|0):0)Ye(49548,e)}}}while(0);Dp(c[H>>2]|0);Dp(c[G>>2]|0);Dp(c[F>>2]|0);si(v);An(v+44|0);Dp(c[v+56>>2]|0);si(u);Dp(c[w>>2]|0);Dp(c[x>>2]|0);Dp(c[y>>2]|0);Dp(c[z>>2]|0);In(c[C>>2]|0);Rf(c[E>>2]|0);Rf(c[D>>2]|0);c[p>>2]=c[s>>2];L=c[p>>2]|0;l=d;return L|0}function yr(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;b=l;l=l+176|0;if((l|0)>=(m|0))$(176);d=b+72|0;e=b+64|0;f=b+56|0;g=b+40|0;h=b;i=b+168|0;j=b+164|0;k=b+160|0;n=b+156|0;o=b+152|0;p=b+148|0;q=b+144|0;r=b+140|0;s=b+80|0;t=b+76|0;c[j>>2]=a;c[n>>2]=0;c[o>>2]=0;c[p>>2]=0;c[q>>2]=0;c[r>>2]=0;c[t>>2]=0;a=s;u=a+60|0;do{c[a>>2]=0;a=a+4|0}while((a|0)<(u|0));c[n>>2]=Tf(c[j>>2]|0,47178,0)|0;if(!(c[n>>2]|0?(c[k>>2]=Fj(c[n>>2]|0,o,0)|0,(c[k>>2]|0)!=0):0))v=3;do if((v|0)==3){a=c[j>>2]|0;if(c[o>>2]&512|0){c[h>>2]=s+8;c[h+4>>2]=s+12;c[h+8>>2]=s+16;c[h+12>>2]=q;c[h+16>>2]=s+32;c[h+20>>2]=s+36;c[h+24>>2]=r;c[h+28>>2]=s+56;c[h+32>>2]=0;c[k>>2]=lg(a,0,47535,h)|0}else{c[g>>2]=r;c[g+4>>2]=s+56;c[g+8>>2]=0;c[k>>2]=lg(a,0,47554,g)|0}if(!(c[k>>2]|0)){Rf(c[n>>2]|0);c[n>>2]=Tf(c[j>>2]|0,47218,5)|0;if((c[n>>2]|0?(c[p>>2]=_f(c[n>>2]|0,1)|0,c[p>>2]|0):0)?(c[k>>2]=Th(c[p>>2]|0,s,s+4|0,s+8|0,s+12|0,s+16|0,q,s+32|0,s+36|0)|0,c[k>>2]|0):0){c[i>>2]=c[k>>2];w=c[i>>2]|0;l=b;return w|0}if(c[q>>2]|0?(yn(s+20|0),c[k>>2]=zi(s+20|0,c[q>>2]|0)|0,c[k>>2]|0):0)break;if(!(c[p>>2]|0)){c[s>>2]=c[o>>2]&4096|0?2:0;c[s+4>>2]=c[o>>2]&4096|0?1:0}if(Ff(1)|0){a=vi(c[s>>2]|0)|0;u=wi(c[s+4>>2]|0)|0;c[f>>2]=a;c[f+4>>2]=u;Ye(48463,f);if(c[s+40>>2]|0){c[e>>2]=c[s+40>>2];Ye(48487,e)}af(48508,c[s+8>>2]|0);af(48524,c[s+12>>2]|0);af(48540,c[s+16>>2]|0);sn(48556,s+20|0,0);af(48570,c[s+32>>2]|0);af(48586,c[s+36>>2]|0);af(48602,c[r>>2]|0);if(!(Wg()|0))af(48618,c[s+56>>2]|0)}if((((((c[s+8>>2]|0?c[s+12>>2]|0:0)?c[s+16>>2]|0:0)?c[s+20>>2]|0:0)?c[s+32>>2]|0:0)?c[s+36>>2]|0:0)?c[s+56>>2]|0:0){c[t>>2]=En(c[s>>2]|0,c[s+4>>2]|0,0,c[s+8>>2]|0,c[s+12>>2]|0,c[s+16>>2]|0)|0;if(!(c[r>>2]|0)){c[k>>2]=68;break}yn(s+44|0);if((c[(c[t>>2]|0)+4>>2]|0)==1)c[k>>2]=hi(c[r>>2]|0,c[t>>2]|0,s+44|0,0,0)|0;else c[k>>2]=zi(s+44|0,c[r>>2]|0)|0;if(c[k>>2]|0)break;if(!(Hr(s,c[t>>2]|0,c[o>>2]|0)|0))break;c[k>>2]=7;break}c[k>>2]=68}}while(0);In(c[t>>2]|0);Tp(c[s+8>>2]|0);Tp(c[s+12>>2]|0);Tp(c[s+16>>2]|0);Tp(c[q>>2]|0);An(s+20|0);Tp(c[s+32>>2]|0);Tp(c[s+36>>2]|0);Tp(c[r>>2]|0);An(s+44|0);Tp(c[s+56>>2]|0);vf(c[p>>2]|0);Rf(c[n>>2]|0);if(Ff(1)|0){c[d>>2]=Bt(c[k>>2]|0)|0;Ye(48634,d)}c[i>>2]=c[k>>2];w=c[i>>2]|0;l=b;return w|0}function zr(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;e=l;l=l+256|0;if((l|0)>=(m|0))$(256);f=e+72|0;g=e+64|0;h=e+56|0;i=e+48|0;j=e+40|0;k=e+32|0;n=e;o=e+248|0;p=e+244|0;q=e+240|0;r=e+236|0;s=e+232|0;t=e+192|0;u=e+184|0;v=e+180|0;w=e+176|0;x=e+172|0;y=e+168|0;z=e+164|0;A=e+160|0;B=e+104|0;C=e+96|0;D=e+84|0;E=e+80|0;F=e+76|0;c[p>>2]=a;c[q>>2]=b;c[r>>2]=d;c[u>>2]=0;c[v>>2]=0;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;c[A>>2]=0;c[C>>2]=0;d=B;b=d+56|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(b|0));Lj(t,0,Dr(c[r>>2]|0)|0);c[s>>2]=Nj(c[q>>2]|0,A,t)|0;do if(!(c[s>>2]|0)){if(Ff(1)|0)af(48123,c[A>>2]|0);if(c[A>>2]|0?c[(c[A>>2]|0)+12>>2]&4|0:0){c[s>>2]=79;break}q=c[r>>2]|0;c[n>>2]=B+8;c[n+4>>2]=B+12;c[n+8>>2]=B+16;c[n+12>>2]=w;c[n+16>>2]=B+32;c[n+20>>2]=B+36;c[n+24>>2]=x;c[n+28>>2]=0;c[s>>2]=lg(q,0,48140,n)|0;if(!(c[s>>2]|0)){if(c[w>>2]|0?(yn(B+20|0),c[s>>2]=zi(B+20|0,c[w>>2]|0)|0,c[s>>2]|0):0)break;Rf(c[u>>2]|0);c[u>>2]=Tf(c[r>>2]|0,47218,5)|0;if((c[u>>2]|0?(c[v>>2]=_f(c[u>>2]|0,1)|0,c[v>>2]|0):0)?(c[s>>2]=Qh(0,c[v>>2]|0,B,0)|0,c[s>>2]|0):0){c[o>>2]=c[s>>2];G=c[o>>2]|0;l=e;return G|0}if(!(c[v>>2]|0)){c[B>>2]=0;c[B+4>>2]=0}if(Ff(1)|0){q=vi(c[B>>2]|0)|0;d=wi(c[B+4>>2]|0)|0;c[k>>2]=q;c[k+4>>2]=d;Ye(48156,k);if(c[B+40>>2]|0){c[j>>2]=c[B+40>>2];Ye(48181,j)}af(48203,c[B+8>>2]|0);af(48220,c[B+12>>2]|0);af(48237,c[B+16>>2]|0);sn(48254,B+20|0,0);af(48269,c[B+32>>2]|0);af(48286,c[B+36>>2]|0);af(48303,c[x>>2]|0)}if(((((c[B+8>>2]|0?c[B+12>>2]|0:0)?c[B+16>>2]|0:0)?c[B+20>>2]|0:0)?c[B+32>>2]|0:0)?(c[B+36>>2]|0)!=0&(c[x>>2]|0)!=0:0){if(c[x>>2]|0?(yn(B+44|0),c[s>>2]=zi(B+44|0,c[x>>2]|0)|0,c[s>>2]|0):0)break;c[C>>2]=En(c[B>>2]|0,c[B+4>>2]|0,0,c[B+8>>2]|0,c[B+12>>2]|0,c[B+16>>2]|0)|0;c[E>>2]=Rp(0)|0;c[F>>2]=Rp(0)|0;yn(D);$n(D,c[A>>2]|0,B+44|0,c[C>>2]|0);if(tn(c[E>>2]|0,c[F>>2]|0,D,c[C>>2]|0)|0)We(48320,i);c[y>>2]=xi(c[E>>2]|0,c[F>>2]|0,c[B+8>>2]|0)|0;$n(D,c[A>>2]|0,B+20|0,c[C>>2]|0);if(tn(c[E>>2]|0,c[F>>2]|0,D,c[C>>2]|0)|0)We(48368,h);else{c[z>>2]=xi(c[E>>2]|0,c[F>>2]|0,c[B+8>>2]|0)|0;Dp(c[E>>2]|0);Dp(c[F>>2]|0);An(D);d=c[p>>2]|0;q=c[z>>2]|0;c[g>>2]=c[y>>2];c[g+4>>2]=q;c[s>>2]=cg(d,0,48415,g)|0;break}}c[s>>2]=68}}while(0);Tp(c[B+8>>2]|0);Tp(c[B+12>>2]|0);Tp(c[B+16>>2]|0);Tp(c[w>>2]|0);An(B+20|0);Tp(c[B+32>>2]|0);Tp(c[B+36>>2]|0);Tp(c[x>>2]|0);An(B+44|0);Tp(c[A>>2]|0);Tp(c[y>>2]|0);Tp(c[z>>2]|0);vf(c[v>>2]|0);In(c[C>>2]|0);Mj(t);if(Ff(1)|0){c[f>>2]=Bt(c[s>>2]|0)|0;Ye(48441,f)}c[o>>2]=c[s>>2];G=c[o>>2]|0;l=e;return G|0}function Ar(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;e=l;l=l+256|0;if((l|0)>=(m|0))$(256);f=e+72|0;g=e+64|0;h=e+56|0;i=e+48|0;j=e+40|0;k=e+8|0;n=e;o=e+248|0;p=e+244|0;q=e+240|0;r=e+236|0;s=e+232|0;t=e+192|0;u=e+188|0;v=e+184|0;w=e+124|0;x=e+120|0;y=e+116|0;z=e+112|0;A=e+100|0;B=e+88|0;C=e+84|0;D=e+80|0;E=e+76|0;c[p>>2]=a;c[q>>2]=b;c[r>>2]=d;c[u>>2]=0;c[v>>2]=0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;c[C>>2]=0;d=w;b=d+60|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(b|0));yn(A);yn(B);Lj(t,1,Dr(c[r>>2]|0)|0);c[s>>2]=Jj(c[q>>2]|0,12976,u,t)|0;do if((c[s>>2]|0)==0?(q=c[u>>2]|0,c[n>>2]=v,c[n+4>>2]=0,c[s>>2]=lg(q,0,47834,n)|0,(c[s>>2]|0)==0):0){if(Ff(1)|0)af(47836,c[v>>2]|0);if(c[v>>2]|0?c[(c[v>>2]|0)+12>>2]&4|0:0){c[s>>2]=79;break}q=c[r>>2]|0;c[k>>2]=w+8;c[k+4>>2]=w+12;c[k+8>>2]=w+16;c[k+12>>2]=x;c[k+16>>2]=w+32;c[k+20>>2]=w+36;c[k+24>>2]=w+56;c[k+28>>2]=0;c[s>>2]=lg(q,0,47853,k)|0;if(!(c[s>>2]|0)){if(c[x>>2]|0?(yn(w+20|0),c[s>>2]=zi(w+20|0,c[x>>2]|0)|0,c[s>>2]|0):0)break;Rf(c[u>>2]|0);c[u>>2]=Tf(c[r>>2]|0,47218,5)|0;if((c[u>>2]|0?(c[y>>2]=_f(c[u>>2]|0,1)|0,c[y>>2]|0):0)?(c[s>>2]=Qh(0,c[y>>2]|0,w,0)|0,c[s>>2]|0):0){c[o>>2]=c[s>>2];F=c[o>>2]|0;l=e;return F|0}if(!(c[y>>2]|0)){c[w>>2]=0;c[w+4>>2]=0}if(Ff(1)|0){q=vi(c[w>>2]|0)|0;d=wi(c[w+4>>2]|0)|0;c[j>>2]=q;c[j+4>>2]=d;Ye(47869,j);if(c[w+40>>2]|0){c[i>>2]=c[w+40>>2];Ye(47894,i)}af(47916,c[w+8>>2]|0);af(47933,c[w+12>>2]|0);af(47950,c[w+16>>2]|0);sn(47967,w+20|0,0);af(47982,c[w+32>>2]|0);af(47999,c[w+36>>2]|0);if(!(Wg()|0))af(48016,c[w+56>>2]|0)}if((((((c[w+8>>2]|0?c[w+12>>2]|0:0)?c[w+16>>2]|0:0)?c[w+20>>2]|0:0)?c[w+32>>2]|0:0)?c[w+36>>2]|0:0)?c[w+56>>2]|0:0){c[s>>2]=zi(A,c[v>>2]|0)|0;if(c[s>>2]|0){An(A);c[o>>2]=c[s>>2];F=c[o>>2]|0;l=e;return F|0}c[z>>2]=En(c[w>>2]|0,c[w+4>>2]|0,0,c[w+8>>2]|0,c[w+12>>2]|0,c[w+16>>2]|0)|0;$n(B,c[w+56>>2]|0,A,c[z>>2]|0);c[D>>2]=Rp(0)|0;c[E>>2]=Rp(0)|0;if(tn(c[D>>2]|0,c[E>>2]|0,B,c[z>>2]|0)|0)We(48033,h);c[C>>2]=xi(c[D>>2]|0,c[E>>2]|0,c[w+8>>2]|0)|0;if(c[C>>2]|0)c[s>>2]=0;else c[s>>2]=Et()|0;Dp(c[D>>2]|0);Dp(c[E>>2]|0);if(Ff(1)|0)af(48073,c[C>>2]|0);if(c[s>>2]|0)break;d=c[p>>2]|0;c[g>>2]=c[C>>2];c[s>>2]=cg(d,0,48090,g)|0;break}c[s>>2]=68}}while(0);An(B);An(A);Tp(c[C>>2]|0);Tp(c[w+8>>2]|0);Tp(c[w+12>>2]|0);Tp(c[w+16>>2]|0);Tp(c[x>>2]|0);An(w+20|0);Tp(c[w+32>>2]|0);Tp(c[w+36>>2]|0);Tp(c[w+56>>2]|0);Tp(c[v>>2]|0);vf(c[y>>2]|0);Rf(c[u>>2]|0);In(c[z>>2]|0);Mj(t);if(Ff(1)|0){c[f>>2]=Bt(c[s>>2]|0)|0;Ye(48101,f)}c[o>>2]=c[s>>2];F=c[o>>2]|0;l=e;return F|0}function Br(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=l;l=l+272|0;if((l|0)>=(m|0))$(272);f=e+104|0;g=e+96|0;h=e+88|0;i=e+80|0;j=e+72|0;k=e+56|0;n=e+40|0;o=e;p=e+256|0;q=e+252|0;r=e+248|0;s=e+244|0;t=e+240|0;u=e+200|0;v=e+192|0;w=e+188|0;x=e+184|0;y=e+180|0;z=e+176|0;A=e+116|0;B=e+112|0;C=e+108|0;c[q>>2]=a;c[r>>2]=b;c[s>>2]=d;c[v>>2]=0;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;c[B>>2]=0;c[C>>2]=0;d=A;b=d+60|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(b|0));Lj(u,2,0);c[t>>2]=Nj(c[r>>2]|0,v,u)|0;do if(!(c[t>>2]|0)){if(Ff(1)|0)af(47519,c[v>>2]|0);r=c[s>>2]|0;if(c[u+12>>2]&512|0){c[o>>2]=A+8;c[o+4>>2]=A+12;c[o+8>>2]=A+16;c[o+12>>2]=y;c[o+16>>2]=A+32;c[o+20>>2]=A+36;c[o+24>>2]=z;c[o+28>>2]=A+56;c[o+32>>2]=0;c[t>>2]=lg(r,0,47535,o)|0}else{c[n>>2]=z;c[n+4>>2]=A+56;c[n+8>>2]=0;c[t>>2]=lg(r,0,47554,n)|0}if(!(c[t>>2]|0)){if(c[y>>2]|0?(yn(A+20|0),c[t>>2]=zi(A+20|0,c[y>>2]|0)|0,c[t>>2]|0):0)break;Rf(c[w>>2]|0);c[w>>2]=Tf(c[s>>2]|0,47218,5)|0;if((c[w>>2]|0?(c[x>>2]=_f(c[w>>2]|0,1)|0,c[x>>2]|0):0)?(c[t>>2]=Qh(0,c[x>>2]|0,A,0)|0,c[t>>2]|0):0){c[p>>2]=c[t>>2];D=c[p>>2]|0;l=e;return D|0}if(!(c[x>>2]|0)){c[A>>2]=c[u+12>>2]&4096|0?2:0;c[A+4>>2]=c[u+12>>2]&4096|0?1:0}if(Ff(1)|0){r=vi(c[A>>2]|0)|0;d=wi(c[A+4>>2]|0)|0;b=c[u+12>>2]&4096|0?47329:72319;c[k>>2]=r;c[k+4>>2]=d;c[k+8>>2]=b;Ye(47560,k);if(c[A+40>>2]|0){c[j>>2]=c[A+40>>2];Ye(47586,j)}af(47607,c[A+8>>2]|0);af(47623,c[A+12>>2]|0);af(47639,c[A+16>>2]|0);sn(47655,A+20|0,0);af(47669,c[A+32>>2]|0);af(47685,c[A+36>>2]|0);af(47701,c[z>>2]|0);if(!(Wg()|0))af(47717,c[A+56>>2]|0)}if((((((c[A+8>>2]|0?c[A+12>>2]|0:0)?c[A+16>>2]|0:0)?c[A+20>>2]|0:0)?c[A+32>>2]|0:0)?c[A+36>>2]|0:0)?c[A+56>>2]|0:0){c[B>>2]=Rp(0)|0;c[C>>2]=Rp(0)|0;if(c[u+12>>2]&4096|0){c[t>>2]=pi(c[v>>2]|0,A,c[B>>2]|0,c[C>>2]|0,c[u+16>>2]|0,c[z>>2]|0)|0;if(c[t>>2]|0)break;b=c[q>>2]|0;d=c[C>>2]|0;c[i>>2]=c[B>>2];c[i+4>>2]=d;c[t>>2]=cg(b,0,47733,i)|0;break}b=c[v>>2]|0;d=c[B>>2]|0;r=c[C>>2]|0;if(c[u+12>>2]&8192|0){c[t>>2]=yt(b,A,d,r)|0;if(c[t>>2]|0)break;a=c[q>>2]|0;E=c[C>>2]|0;c[h>>2]=c[B>>2];c[h+4>>2]=E;c[t>>2]=cg(a,0,47760,h)|0;break}else{c[t>>2]=wt(b,A,d,r,c[u+12>>2]|0,c[u+16>>2]|0)|0;if(c[t>>2]|0)break;r=c[q>>2]|0;d=c[C>>2]|0;c[g>>2]=c[B>>2];c[g+4>>2]=d;c[t>>2]=cg(r,0,47786,g)|0;break}}c[t>>2]=68}}while(0);Tp(c[A+8>>2]|0);Tp(c[A+12>>2]|0);Tp(c[A+16>>2]|0);Tp(c[y>>2]|0);An(A+20|0);Tp(c[A+32>>2]|0);Tp(c[A+36>>2]|0);Tp(c[z>>2]|0);An(A+44|0);Tp(c[A+56>>2]|0);Tp(c[B>>2]|0);Tp(c[C>>2]|0);vf(c[x>>2]|0);Tp(c[v>>2]|0);Rf(c[w>>2]|0);Mj(u);if(Ff(1)|0){c[f>>2]=Bt(c[t>>2]|0)|0;Ye(47813,f)}c[p>>2]=c[t>>2];D=c[p>>2]|0;l=e;return D|0}function Cr(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;e=l;l=l+272|0;if((l|0)>=(m|0))$(272);f=e+80|0;g=e+72|0;h=e+56|0;i=e+48|0;j=e+16|0;k=e;n=e+256|0;o=e+252|0;p=e+248|0;q=e+244|0;r=e+240|0;s=e+200|0;t=e+192|0;u=e+188|0;v=e+184|0;w=e+180|0;x=e+176|0;y=e+172|0;z=e+168|0;A=e+112|0;B=e+104|0;C=e+100|0;D=e+96|0;E=e+92|0;F=e+88|0;G=e+84|0;c[o>>2]=a;c[p>>2]=b;c[q>>2]=d;c[t>>2]=0;c[u>>2]=0;c[v>>2]=0;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;d=A;b=d+56|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(b|0));Lj(s,3,Dr(c[q>>2]|0)|0);c[r>>2]=Nj(c[p>>2]|0,z,s)|0;a:do if(!(c[r>>2]|0)){if(Ff(1)|0)af(47261,c[z>>2]|0);c[r>>2]=Ij(c[o>>2]|0,12976,t,B)|0;if((c[r>>2]|0)==0?(p=c[t>>2]|0,d=c[B>>2]&4096|0?47277:47175,c[k>>2]=x,c[k+4>>2]=y,c[k+8>>2]=0,c[r>>2]=lg(p,0,d,k)|0,(c[r>>2]|0)==0):0){if(Ff(1)|0){af(47281,c[x>>2]|0);af(47297,c[y>>2]|0)}if(c[s+12>>2]&4096^c[B>>2]&4096|0){c[r>>2]=70;break}d=c[q>>2]|0;if(c[s+12>>2]&512|0){c[j>>2]=A+8;c[j+4>>2]=A+12;c[j+8>>2]=A+16;c[j+12>>2]=v;c[j+16>>2]=A+32;c[j+20>>2]=A+32;c[j+24>>2]=w;c[j+28>>2]=0;c[r>>2]=lg(d,0,47313,j)|0}else{c[i>>2]=w;c[i+4>>2]=0;c[r>>2]=lg(d,0,47213,i)|0}if(!(c[r>>2]|0)){if(c[v>>2]|0?(yn(A+20|0),c[r>>2]=zi(A+20|0,c[v>>2]|0)|0,c[r>>2]|0):0)break;Rf(c[t>>2]|0);c[t>>2]=Tf(c[q>>2]|0,47218,5)|0;if((c[t>>2]|0?(c[u>>2]=_f(c[t>>2]|0,1)|0,c[u>>2]|0):0)?(c[r>>2]=Qh(0,c[u>>2]|0,A,0)|0,c[r>>2]|0):0){c[n>>2]=c[r>>2];H=c[n>>2]|0;l=e;return H|0}if(!(c[u>>2]|0)){c[A>>2]=c[B>>2]&4096|0?2:0;c[A+4>>2]=c[B>>2]&4096|0?1:0}if(Ff(1)|0){d=vi(c[A>>2]|0)|0;p=wi(c[A+4>>2]|0)|0;b=c[B>>2]&4096|0?47329:72319;c[h>>2]=d;c[h+4>>2]=p;c[h+8>>2]=b;Ye(47336,h);if(c[A+40>>2]|0){c[g>>2]=c[A+40>>2];Ye(47362,g)}af(47383,c[A+8>>2]|0);af(47399,c[A+12>>2]|0);af(47415,c[A+16>>2]|0);sn(47431,A+20|0,0);af(47445,c[A+32>>2]|0);af(47461,c[A+36>>2]|0);af(47477,c[w>>2]|0)}if(((((c[A+8>>2]|0?c[A+12>>2]|0:0)?c[A+16>>2]|0:0)?c[A+20>>2]|0:0)?c[A+32>>2]|0:0)?(c[A+36>>2]|0)!=0&(c[w>>2]|0)!=0:0){if(c[B>>2]&4096|0){c[r>>2]=ri(c[z>>2]|0,A,c[x>>2]|0,c[y>>2]|0,c[s+16>>2]|0,c[w>>2]|0)|0;break}b=(c[B>>2]&8192|0)!=0;yn(A+44|0);if(b){c[r>>2]=zi(A+44|0,c[w>>2]|0)|0;if(c[r>>2]|0)break;c[r>>2]=zt(c[z>>2]|0,A,c[x>>2]|0,c[y>>2]|0)|0;break}if((c[A+4>>2]|0)==1){c[C>>2]=En(c[A>>2]|0,c[A+4>>2]|0,0,c[A+8>>2]|0,c[A+12>>2]|0,c[A+16>>2]|0)|0;c[r>>2]=hi(c[w>>2]|0,c[C>>2]|0,A+44|0,0,0)|0;In(c[C>>2]|0)}else c[r>>2]=zi(A+44|0,c[w>>2]|0)|0;if(c[r>>2]|0)break;do if(c[z>>2]|0){if(!(c[(c[z>>2]|0)+12>>2]&4))break;c[F>>2]=lo(c[A+32>>2]|0)|0;c[D>>2]=Gp(c[z>>2]|0,E)|0;c[r>>2]=Zo(G,5,c[D>>2]|0,(((c[E>>2]|0)+7|0)>>>0)/8|0,0)|0;if(c[r>>2]|0)break a;if((c[E>>2]|0)>>>0>(c[F>>2]|0)>>>0)so(c[G>>2]|0,c[G>>2]|0,(c[E>>2]|0)-(c[F>>2]|0)|0);c[r>>2]=xt(c[G>>2]|0,A,c[x>>2]|0,c[y>>2]|0)|0;Tp(c[G>>2]|0);break a}while(0);c[r>>2]=xt(c[z>>2]|0,A,c[x>>2]|0,c[y>>2]|0)|0;break}c[r>>2]=68}}}while(0);Tp(c[A+8>>2]|0);Tp(c[A+12>>2]|0);Tp(c[A+16>>2]|0);Tp(c[v>>2]|0);An(A+20|0);Tp(c[A+32>>2]|0);Tp(c[A+36>>2]|0);Tp(c[w>>2]|0);An(A+44|0);Tp(c[z>>2]|0);Tp(c[x>>2]|0);Tp(c[y>>2]|0);vf(c[u>>2]|0);Rf(c[t>>2]|0);Mj(s);if(Ff(1)|0){if(c[r>>2]|0)I=Bt(c[r>>2]|0)|0;else I=47493;c[f>>2]=I;Ye(47498,f)}c[n>>2]=c[r>>2];H=c[n>>2]|0;l=e;return H|0}function Dr(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+20|0;e=b+16|0;f=b+12|0;g=b+8|0;h=b+4|0;i=b;c[e>>2]=a;c[h>>2]=0;c[f>>2]=Tf(c[e>>2]|0,47259,1)|0;if(c[f>>2]|0){c[g>>2]=$f(c[f>>2]|0,1,5)|0;Rf(c[f>>2]|0);if(c[g>>2]|0){c[h>>2]=lo(c[g>>2]|0)|0;Tp(c[g>>2]|0)}}else{c[f>>2]=Tf(c[e>>2]|0,47218,5)|0;if(!(c[f>>2]|0)){c[d>>2]=0;j=c[d>>2]|0;l=b;return j|0}c[i>>2]=_f(c[f>>2]|0,1)|0;Rf(c[f>>2]|0);if(!(c[i>>2]|0)){c[d>>2]=0;j=c[d>>2]|0;l=b;return j|0}if(Qh(0,c[i>>2]|0,0,h)|0)c[h>>2]=0;vf(c[i>>2]|0)}c[d>>2]=c[h>>2];j=c[d>>2]|0;l=b;return j|0}function Er(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e;c[g>>2]=a;c[e+4>>2]=b;c[h>>2]=d;if((c[g>>2]|0)!=18){c[f>>2]=4;i=c[f>>2]|0;l=e;return i|0}else{c[f>>2]=Gr(c[h>>2]|0)|0;i=c[f>>2]|0;l=e;return i|0}return 0}function Fr(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;e=l;l=l+208|0;if((l|0)>=(m|0))$(208);f=e+88|0;g=e+80|0;h=e+72|0;i=e+64|0;j=e+32|0;k=e;n=e+172|0;o=e+168|0;p=e+164|0;q=e+160|0;r=e+132|0;s=e+128|0;t=e+124|0;u=e+120|0;v=e+116|0;w=e+112|0;x=e+176|0;y=e+108|0;z=e+104|0;A=e+100|0;B=e+96|0;c[n>>2]=b;c[o>>2]=d;c[t>>2]=0;c[u>>2]=0;c[v>>2]=0;c[w>>2]=0;c[s>>2]=0;while(1){if((c[s>>2]|0)>=7)break;c[r+(c[s>>2]<<2)>>2]=0;c[s>>2]=(c[s>>2]|0)+1}c[q>>2]=Tf(c[o>>2]|0,47178,0)|0;if(!(c[q>>2]|0?(c[p>>2]=Fj(c[q>>2]|0,u,0)|0,(c[p>>2]|0)!=0):0))C=6;a:do if((C|0)==6){d=(c[u>>2]&4096|0)!=0;b=c[o>>2]|0;do if(c[u>>2]&512|0){D=r+4|0;E=r+8|0;F=r+12|0;G=r+16|0;H=r+20|0;I=r+24|0;if(d){c[k>>2]=r;c[k+4>>2]=D;c[k+8>>2]=E;c[k+12>>2]=F;c[k+16>>2]=G;c[k+20>>2]=H;c[k+24>>2]=I;c[k+28>>2]=0;c[p>>2]=lg(b,0,47184,k)|0;break}else{c[j>>2]=r;c[j+4>>2]=D;c[j+8>>2]=E;c[j+12>>2]=F;c[j+16>>2]=G;c[j+20>>2]=H;c[j+24>>2]=I;c[j+28>>2]=0;c[p>>2]=lg(b,0,47199,j)|0;break}}else{I=r+24|0;if(d){c[i>>2]=I;c[i+4>>2]=0;c[p>>2]=lg(b,0,47213,i)|0;break}else{c[h>>2]=I;c[h+4>>2]=0;c[p>>2]=lg(b,0,47216,h)|0;break}}while(0);if(!(c[p>>2]|0)){Rf(c[q>>2]|0);c[q>>2]=Tf(c[o>>2]|0,47218,5)|0;if((c[q>>2]|0?(c[t>>2]=_f(c[q>>2]|0,1)|0,c[t>>2]|0):0)?(c[p>>2]=Th(c[t>>2]|0,v,w,r,r+4|0,r+8|0,r+12|0,r+16|0,r+20|0)|0,c[p>>2]|0):0)break;if(!(c[t>>2]|0)){c[v>>2]=c[u>>2]&4096|0?2:0;c[w>>2]=c[u>>2]&4096|0?1:0}c[s>>2]=0;while(1){if((c[s>>2]|0)>=7)break;if(!(c[r+(c[s>>2]<<2)>>2]|0)){C=22;break}ko(c[r+(c[s>>2]<<2)>>2]|0);c[s>>2]=(c[s>>2]|0)+1}if((C|0)==22){c[p>>2]=68;break}if(c[u>>2]&4096|0){if((c[w>>2]|0)==1)c[p>>2]=ei(c[r+24>>2]|0,256)|0;else c[p>>2]=69;if(c[p>>2]|0)break}c[s>>2]=0;b:while(1){if((c[s>>2]|0)>=7)break a;do if((c[s>>2]|0)!=5){if(c[r+(c[s>>2]<<2)>>2]|0?c[(c[r+(c[s>>2]<<2)>>2]|0)+12>>2]&4|0:0){c[y>>2]=Gp(c[r+(c[s>>2]<<2)>>2]|0,z)|0;c[z>>2]=(((c[z>>2]|0)+7|0)>>>0)/8|0;b=c[z>>2]|0;c[g>>2]=a[47224+(c[s>>2]|0)>>0];c[g+4>>2]=b;Su(x,30,47231,g)|0;b=c[n>>2]|0;$i(b,x,hv(x)|0);$i(c[n>>2]|0,c[y>>2]|0,c[z>>2]|0);$i(c[n>>2]|0,47240,1);break}c[A>>2]=Vo(c[r+(c[s>>2]<<2)>>2]|0,0,B,0)|0;if(!(c[A>>2]|0))break b;b=c[B>>2]|0;c[f>>2]=a[47224+(c[s>>2]|0)>>0];c[f+4>>2]=b;Su(x,30,47231,f)|0;b=c[n>>2]|0;$i(b,x,hv(x)|0);$i(c[n>>2]|0,c[A>>2]|0,c[B>>2]|0);$i(c[n>>2]|0,47240,1);vf(c[A>>2]|0)}while(0);c[s>>2]=(c[s>>2]|0)+1}c[p>>2]=Et()|0}}while(0);vf(c[t>>2]|0);Rf(c[q>>2]|0);c[s>>2]=0;while(1){if((c[s>>2]|0)>=7)break;Tp(c[r+(c[s>>2]<<2)>>2]|0);c[s>>2]=(c[s>>2]|0)+1}l=e;return c[p>>2]|0}function Gr(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[f>>2]=47242;c[g>>2]=0;if(!(c[g>>2]|0)){c[d>>2]=0;h=c[d>>2]|0;l=b;return h|0}if(c[e>>2]|0)Eb[c[e>>2]&1](47252,18,c[f>>2]|0,c[g>>2]|0);c[d>>2]=50;h=c[d>>2]|0;l=b;return h|0}function Hr(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=l;l=l+112|0;if((l|0)>=(m|0))$(112);f=e+64|0;g=e+56|0;h=e+48|0;i=e+40|0;j=e+32|0;k=e+24|0;n=e+16|0;o=e+8|0;p=e;q=e+108|0;r=e+104|0;s=e+100|0;t=e+96|0;u=e+84|0;v=e+80|0;w=e+76|0;x=e+72|0;y=e+68|0;c[q>>2]=a;c[r>>2]=b;c[s>>2]=d;c[t>>2]=1;c[x>>2]=0;c[y>>2]=0;yn(u);c[v>>2]=Rp(0)|0;if((c[c[r>>2]>>2]|0)==1)c[w>>2]=0;else c[w>>2]=Rp(0)|0;a:do if(!(bo((c[q>>2]|0)+20|0,c[r>>2]|0)|0)){if(Ff(1)|0)Ye(48655,p)}else{if(!(vo(c[(c[q>>2]|0)+20+8>>2]|0,0)|0)){if(!(Ff(1)|0))break;Ye(48707,o);break}if((c[(c[q>>2]|0)+4>>2]|0)!=1?($n(u,c[(c[q>>2]|0)+32>>2]|0,(c[q>>2]|0)+20|0,c[r>>2]|0),vo(c[u+8>>2]|0,0)|0):0){if(!(Ff(1)|0))break;Ye(48752,n);break}if(!(vo(c[(c[q>>2]|0)+44+8>>2]|0,0)|0)){if(!(Ff(1)|0))break;Ye(48799,k);break}if(!(Ai(u,c[r>>2]|0,(c[q>>2]|0)+20|0,c[(c[q>>2]|0)+56>>2]|0)|0)){if(!(Ff(1)|0))break;Ye(48845,j);break}if(tn(c[v>>2]|0,c[w>>2]|0,u,c[r>>2]|0)|0){if(!(Ff(1)|0))break;Ye(48799,i);break}do if(!(c[s>>2]&4096)){if(!(vo(c[(c[q>>2]|0)+44+8>>2]|0,1)|0)){if(!(wo(c[v>>2]|0,c[(c[q>>2]|0)+44>>2]|0)|0)){if(c[w>>2]|0)break;if(!(wo(c[w>>2]|0,c[(c[q>>2]|0)+44+4>>2]|0)|0))break}if(!(Ff(1)|0))break a;Ye(48882,h);break a}c[x>>2]=Rp(0)|0;c[y>>2]=Rp(0)|0;if(tn(c[x>>2]|0,c[y>>2]|0,(c[q>>2]|0)+44|0,c[r>>2]|0)|0){if(!(Ff(1)|0))break a;Ye(48799,g);break a}if((wo(c[v>>2]|0,c[x>>2]|0)|0)==0?(wo(c[w>>2]|0,c[y>>2]|0)|0)==0:0)break;if(!(Ff(1)|0))break a;Ye(48882,f);break a}while(0);c[t>>2]=0}while(0);Dp(c[x>>2]|0);Dp(c[v>>2]|0);Dp(c[w>>2]|0);Dp(c[y>>2]|0);An(u);l=e;return c[t>>2]|0}function Ir(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;j=l;l=l+96|0;if((l|0)>=(m|0))$(96);k=j+16|0;n=j+8|0;o=j;p=j+80|0;q=j+76|0;r=j+72|0;s=j+68|0;t=j+64|0;u=j+60|0;v=j+56|0;w=j+44|0;x=j+40|0;y=j+36|0;z=j+32|0;A=j+28|0;B=j+24|0;C=j+20|0;c[p>>2]=b;c[q>>2]=d;c[r>>2]=e;c[s>>2]=f;c[t>>2]=g;c[u>>2]=h;c[v>>2]=i;c[A>>2]=lo(c[(c[q>>2]|0)+8>>2]|0)|0;yn(w);if(c[s>>2]&32|0)c[x>>2]=1;else c[x>>2]=2;if((c[(c[r>>2]|0)+4>>2]|0)==1){i=Sp(256)|0;c[(c[p>>2]|0)+56>>2]=i;c[B>>2]=hn(32,c[x>>2]|0)|0;i=c[B>>2]|0;a[i>>0]=a[i>>0]&127;i=c[B>>2]|0;a[i>>0]=a[i>>0]|64;i=(c[B>>2]|0)+31|0;a[i>>0]=a[i>>0]&248;Yo(c[(c[p>>2]|0)+56>>2]|0,c[B>>2]|0,32,0);vf(c[B>>2]|0)}else{B=rt(c[(c[q>>2]|0)+32>>2]|0,c[x>>2]|0)|0;c[(c[p>>2]|0)+56>>2]=B}$n(w,c[(c[p>>2]|0)+56>>2]|0,(c[q>>2]|0)+20|0,c[r>>2]|0);c[c[p>>2]>>2]=c[c[q>>2]>>2];c[(c[p>>2]|0)+4>>2]=c[(c[q>>2]|0)+4>>2];B=Ip(c[(c[q>>2]|0)+8>>2]|0)|0;c[(c[p>>2]|0)+8>>2]=B;B=Ip(c[(c[q>>2]|0)+12>>2]|0)|0;c[(c[p>>2]|0)+12>>2]=B;B=Ip(c[(c[q>>2]|0)+16>>2]|0)|0;c[(c[p>>2]|0)+16>>2]=B;yn((c[p>>2]|0)+20|0);Jr((c[p>>2]|0)+20|0,(c[q>>2]|0)+20|0);B=Ip(c[(c[q>>2]|0)+32>>2]|0)|0;c[(c[p>>2]|0)+32>>2]=B;B=Ip(c[(c[q>>2]|0)+36>>2]|0)|0;c[(c[p>>2]|0)+36>>2]=B;yn((c[p>>2]|0)+44|0);c[y>>2]=Rp(c[A>>2]|0)|0;c[z>>2]=Rp(c[A>>2]|0)|0;if(tn(c[y>>2]|0,c[z>>2]|0,w,c[r>>2]|0)|0){c[o>>2]=49147;We(49097,o)}do if((c[(c[q>>2]|0)+4>>2]|0)!=1){c[C>>2]=Rp(c[A>>2]|0)|0;o=c[C>>2]|0;r=c[(c[q>>2]|0)+8>>2]|0;if(!(c[c[q>>2]>>2]|0))ho(o,r,c[z>>2]|0);else ho(o,r,c[y>>2]|0);if((wo(c[C>>2]|0,c[z>>2]|0)|0)>=0){Dp(c[C>>2]|0);Jr((c[p>>2]|0)+44|0,w);if(!(Ff(1)|0))break;Ye(49623,k);break}if(!(c[c[q>>2]>>2]|0)){Dp(c[z>>2]|0);c[z>>2]=c[C>>2]}else{Dp(c[y>>2]|0);c[y>>2]=c[C>>2]}ho(c[(c[p>>2]|0)+56>>2]|0,c[(c[q>>2]|0)+32>>2]|0,c[(c[p>>2]|0)+56>>2]|0);r=(c[p>>2]|0)+44|0;o=c[y>>2]|0;B=c[z>>2]|0;Bn(r,o,B,Wp(1)|0)|0;if(Ff(1)|0)Ye(49583,n)}else Jr((c[p>>2]|0)+44|0,w);while(0);c[c[u>>2]>>2]=c[y>>2];c[c[v>>2]>>2]=c[z>>2];An(w);if(c[s>>2]&16384|0){l=j;return 0}s=c[p>>2]|0;w=(c[t>>2]|0)-64|0;if((c[c[p>>2]>>2]|0)!=1){Kr(s,w);l=j;return 0}else{Lr(s,w);l=j;return 0}return 0}function Jr(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;Kp(c[c[e>>2]>>2]|0,c[c[f>>2]>>2]|0)|0;Kp(c[(c[e>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0)|0;Kp(c[(c[e>>2]|0)+8>>2]|0,c[(c[f>>2]|0)+8>>2]|0)|0;l=d;return}function Kr(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;d=l;l=l+224|0;if((l|0)>=(m|0))$(224);e=d+168|0;f=d+24|0;g=d+16|0;h=d+8|0;i=d+164|0;j=d+160|0;k=d+104|0;n=d+100|0;o=d+88|0;p=d+84|0;q=d+80|0;r=d+76|0;s=d+72|0;t=d+28|0;c[i>>2]=a;c[j>>2]=b;c[n>>2]=Rp(c[j>>2]|0)|0;c[p>>2]=Rp(c[j>>2]|0)|0;c[q>>2]=Rp(c[j>>2]|0)|0;c[r>>2]=Rp(c[j>>2]|0)|0;c[s>>2]=Rp(c[j>>2]|0)|0;if(Ff(1)|0)Ye(49676,d);yn(o);b=e;a=c[i>>2]|0;u=b+44|0;do{c[b>>2]=c[a>>2];b=b+4|0;a=a+4|0}while((b|0)<(u|0));ti(t,e);b=k;a=t;u=b+44|0;do{c[b>>2]=c[a>>2];b=b+4|0;a=a+4|0}while((b|0)<(u|0));yn(k+44|0);Jr(k+44|0,(c[i>>2]|0)+44|0);Up(c[n>>2]|0,c[j>>2]|0,0);if(wt(c[n>>2]|0,c[i>>2]|0,c[r>>2]|0,c[s>>2]|0,0,0)|0)We(49806,h);if(xt(c[n>>2]|0,k,c[r>>2]|0,c[s>>2]|0)|0)We(49836,g);if(!(Ff(1)|0)){v=k+44|0;An(v);si(k);An(o);w=c[s>>2]|0;Dp(w);x=c[r>>2]|0;Dp(x);y=c[q>>2]|0;Dp(y);z=c[p>>2]|0;Dp(z);A=c[n>>2]|0;Dp(A);l=d;return}Ye(49874,f);v=k+44|0;An(v);si(k);An(o);w=c[s>>2]|0;Dp(w);x=c[r>>2]|0;Dp(x);y=c[q>>2]|0;Dp(y);z=c[p>>2]|0;Dp(z);A=c[n>>2]|0;Dp(A);l=d;return}function Lr(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=l;l=l+224|0;if((l|0)>=(m|0))$(224);f=e+168|0;g=e+24|0;h=e+16|0;i=e+8|0;j=e+164|0;k=e+160|0;n=e+104|0;o=e+100|0;p=e+88|0;q=e+84|0;r=e+80|0;s=e+76|0;t=e+32|0;u=e+28|0;c[j>>2]=b;c[k>>2]=d;if(Ff(1)|0)Ye(49676,e);yn(p);d=f;b=c[j>>2]|0;v=d+44|0;do{c[d>>2]=c[b>>2];d=d+4|0;b=b+4|0}while((d|0)<(v|0));ti(t,f);d=n;b=t;v=d+44|0;do{c[d>>2]=c[b>>2];d=d+4|0;b=b+4|0}while((d|0)<(v|0));yn(n+44|0);Jr(n+44|0,(c[j>>2]|0)+44|0);if((c[(c[j>>2]|0)+4>>2]|0)==1){c[o>>2]=Rp(256)|0;c[u>>2]=fn(32,0)|0;b=c[u>>2]|0;a[b>>0]=a[b>>0]&127;b=c[u>>2]|0;a[b>>0]=a[b>>0]|64;b=(c[u>>2]|0)+31|0;a[b>>0]=a[b>>0]&248;Yo(c[o>>2]|0,c[u>>2]|0,32,0);vf(c[u>>2]|0)}else{c[o>>2]=Rp(c[k>>2]|0)|0;Up(c[o>>2]|0,c[k>>2]|0,0)}c[s>>2]=En(c[n>>2]|0,c[n+4>>2]|0,0,c[n+8>>2]|0,c[n+12>>2]|0,c[n+16>>2]|0)|0;c[q>>2]=Rp(0)|0;c[r>>2]=Rp(0)|0;$n(p,c[o>>2]|0,n+44|0,c[s>>2]|0);if((c[(c[j>>2]|0)+4>>2]|0)!=1)$n(p,c[(c[s>>2]|0)+36>>2]|0,p,c[s>>2]|0);if(tn(c[q>>2]|0,0,p,c[s>>2]|0)|0)We(49690,i);$n(p,c[o>>2]|0,n+20|0,c[s>>2]|0);$n(p,c[(c[j>>2]|0)+56>>2]|0,p,c[s>>2]|0);if((c[(c[j>>2]|0)+4>>2]|0)!=1)$n(p,c[(c[s>>2]|0)+36>>2]|0,p,c[s>>2]|0);if(tn(c[r>>2]|0,0,p,c[s>>2]|0)|0)We(49738,h);if(wo(c[q>>2]|0,c[r>>2]|0)|0)We(49787,g);else{Dp(c[q>>2]|0);Dp(c[r>>2]|0);In(c[s>>2]|0);An(n+44|0);si(n);An(p);Dp(c[o>>2]|0);l=e;return}}function Mr(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;h=l;l=l+1056|0;if((l|0)>=(m|0))$(1056);i=h+44|0;j=h+40|0;k=h+36|0;n=h+32|0;o=h+28|0;p=h+24|0;q=h+20|0;r=h+16|0;s=h+12|0;t=h+8|0;u=h+4|0;v=h+48|0;w=h;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=0;c[s>>2]=0;g=oj(c[j>>2]|0)|0;if((g|0)!=(c[q>>2]|0)){c[i>>2]=49935;x=c[i>>2]|0;l=h;return x|0}c[s>>2]=Si(t,c[j>>2]|0,0)|0;if(c[s>>2]|0){c[i>>2]=49976;x=c[i>>2]|0;l=h;return x|0}a:do switch(c[k>>2]|0){case 0:{$i(c[t>>2]|0,c[n>>2]|0,c[o>>2]|0);break}case 1:{Uw(v|0,97,1e3)|0;c[w>>2]=0;while(1){if((c[w>>2]|0)>=1e3)break a;$i(c[t>>2]|0,v,1e3);c[w>>2]=(c[w>>2]|0)+1}break}default:c[r>>2]=49996}while(0);if((c[r>>2]|0)==0?(c[u>>2]=lj(c[t>>2]|0,c[j>>2]|0)|0,Jv(c[u>>2]|0,c[p>>2]|0,c[q>>2]|0)|0):0)c[r>>2]=50013;_i(c[t>>2]|0);c[i>>2]=c[r>>2];x=c[i>>2]|0;l=h;return x|0}function Nr(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;p=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[h>>2];c[k>>2]=c[g>>2];c[n>>2]=0;c[o>>2]=c[(c[k>>2]|0)+148>>2];if(128<(c[o>>2]|0)>>>0)Re(50029,112,50043);if(!(c[(c[k>>2]|0)+152>>2]|0)){l=f;return}if((c[(c[k>>2]|0)+144>>2]|0)==(c[o>>2]|0)?(c[n>>2]=ub[c[(c[k>>2]|0)+152>>2]&63](c[k>>2]|0,c[k>>2]|0,1)|0,bf(c[n>>2]|0),cf(),c[n>>2]=0,c[(c[k>>2]|0)+144>>2]=0,g=(c[k>>2]|0)+128|0,h=g,e=Ww(c[h>>2]|0,c[h+4>>2]|0,1,0)|0,h=D,d=g,c[d>>2]=e,c[d+4>>2]=h,!((e|0)!=0|(h|0)!=0)):0){h=(c[k>>2]|0)+136|0;e=h;d=Ww(c[e>>2]|0,c[e+4>>2]|0,1,0)|0;e=h;c[e>>2]=d;c[e+4>>2]=D}if(!(c[j>>2]|0)){l=f;return}if(c[(c[k>>2]|0)+144>>2]|0){while(1){if(!(c[i>>2]|0))break;if((c[(c[k>>2]|0)+144>>2]|0)>>>0>=(c[o>>2]|0)>>>0)break;e=c[j>>2]|0;c[j>>2]=e+1;d=a[e>>0]|0;e=(c[k>>2]|0)+144|0;h=c[e>>2]|0;c[e>>2]=h+1;a[(c[k>>2]|0)+h>>0]=d;c[i>>2]=(c[i>>2]|0)+-1}Nr(c[k>>2]|0,0,0);if(!(c[i>>2]|0)){l=f;return}}if((c[i>>2]|0)>>>0>=(c[o>>2]|0)>>>0){c[p>>2]=((c[i>>2]|0)>>>0)/((c[o>>2]|0)>>>0)|0;c[n>>2]=ub[c[(c[k>>2]|0)+152>>2]&63](c[k>>2]|0,c[j>>2]|0,c[p>>2]|0)|0;c[(c[k>>2]|0)+144>>2]=0;d=(c[k>>2]|0)+128|0;h=Ww(c[d>>2]|0,c[d+4>>2]|0,c[p>>2]|0,0)|0;d=D;e=(d>>>0<0|((d|0)==0?h>>>0<(c[p>>2]|0)>>>0:0))&1;h=(c[k>>2]|0)+136|0;d=h;g=Ww(c[d>>2]|0,c[d+4>>2]|0,e|0,((e|0)<0)<<31>>31|0)|0;e=h;c[e>>2]=g;c[e+4>>2]=D;e=(c[k>>2]|0)+128|0;g=e;h=Ww(c[g>>2]|0,c[g+4>>2]|0,c[p>>2]|0,0)|0;g=e;c[g>>2]=h;c[g+4>>2]=D;g=S(c[p>>2]|0,c[o>>2]|0)|0;c[i>>2]=(c[i>>2]|0)-g;g=S(c[p>>2]|0,c[o>>2]|0)|0;c[j>>2]=(c[j>>2]|0)+g}bf(c[n>>2]|0);cf();while(1){if(!(c[i>>2]|0)){q=19;break}if((c[(c[k>>2]|0)+144>>2]|0)>>>0>=(c[o>>2]|0)>>>0){q=19;break}n=c[j>>2]|0;c[j>>2]=n+1;g=a[n>>0]|0;n=(c[k>>2]|0)+144|0;p=c[n>>2]|0;c[n>>2]=p+1;a[(c[k>>2]|0)+p>>0]=g;c[i>>2]=(c[i>>2]|0)+-1}if((q|0)==19){l=f;return}}function Or(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+28|0;g=e+24|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+8|0;n=e+4|0;o=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=Pr(c[f>>2]|0)|0;c[j>>2]=0;c[k>>2]=c[c[(c[f>>2]|0)+84>>2]>>2];do if(c[(c[f>>2]|0)+88>>2]|0){c[n>>2]=(c[k>>2]|0)-(c[(c[f>>2]|0)+88>>2]|0);if((c[n>>2]|0)>>>0>(c[h>>2]|0)>>>0)c[n>>2]=c[h>>2];Qr((c[f>>2]|0)+68+(c[(c[f>>2]|0)+88>>2]|0)|0,c[g>>2]|0,c[n>>2]|0);c[h>>2]=(c[h>>2]|0)-(c[n>>2]|0);c[g>>2]=(c[g>>2]|0)+(c[n>>2]|0);d=(c[f>>2]|0)+88|0;c[d>>2]=(c[d>>2]|0)+(c[n>>2]|0);if((c[(c[f>>2]|0)+88>>2]|0)>>>0<(c[k>>2]|0)>>>0){l=e;return}else{c[j>>2]=ub[c[(c[(c[f>>2]|0)+84>>2]|0)+8>>2]&63](c[i>>2]|0,(c[f>>2]|0)+68|0,c[k>>2]|0)|0;c[(c[f>>2]|0)+88>>2]=0;break}}while(0);if((c[h>>2]|0)>>>0>=(c[k>>2]|0)>>>0){c[o>>2]=c[h>>2]&~((c[k>>2]|0)-1);c[j>>2]=ub[c[(c[(c[f>>2]|0)+84>>2]|0)+8>>2]&63](c[i>>2]|0,c[g>>2]|0,c[o>>2]|0)|0;c[g>>2]=(c[g>>2]|0)+(c[o>>2]|0);c[h>>2]=(c[h>>2]|0)-(c[o>>2]|0)}if(c[h>>2]|0){Qr((c[f>>2]|0)+68+(c[(c[f>>2]|0)+88>>2]|0)|0,c[g>>2]|0,c[h>>2]|0);g=(c[f>>2]|0)+88|0;c[g>>2]=(c[g>>2]|0)+(c[h>>2]|0)}if(!(c[j>>2]|0)){l=e;return}bf(c[j>>2]|0);cf();l=e;return}function Pr(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];c[e>>2]=(c[e>>2]|0)+3;c[e>>2]=(c[e>>2]|0)+(0-(c[e>>2]&3));l=b;return c[e>>2]|0}function Qr(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=c[h>>2];c[f>>2]=3;if(!((c[j>>2]|c[k>>2])&3)){c[n>>2]=c[j>>2];c[o>>2]=c[k>>2];while(1){if((c[i>>2]|0)>>>0<4)break;h=c[o>>2]|0;c[o>>2]=h+4;g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;c[i>>2]=(c[i>>2]|0)-4}c[j>>2]=c[n>>2];c[k>>2]=c[o>>2]}while(1){if(!(c[i>>2]|0))break;o=c[k>>2]|0;c[k>>2]=o+1;n=a[o>>0]|0;o=c[j>>2]|0;c[j>>2]=o+1;a[o>>0]=n;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function Rr(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=Pr(c[e>>2]|0)|0;c[h>>2]=Bb[c[(c[(c[e>>2]|0)+84>>2]|0)+12>>2]&7](c[g>>2]|0,(c[e>>2]|0)+68|0,c[(c[e>>2]|0)+88>>2]|0,c[f>>2]|0)|0;bf(c[h>>2]|0);cf();l=d;return}function Sr(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+80|0;if((l|0)>=(m|0))$(80);h=g+8|0;i=g+40|0;j=g+36|0;k=g+32|0;n=g+28|0;o=g+48|0;p=g+20|0;q=g+16|0;r=g+44|0;s=g;t=g+12|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[g+24>>2]=pg()|0;if((c[17757]|0)==0?(c[17757]=1,c[17758]=Tr()|0,c[17758]|0):0){c[h>>2]=c[17758];Ve(50064,h)}if((c[n>>2]|0)!=32){c[i>>2]=44;u=c[i>>2]|0;l=g;return u|0}if(c[17758]|0){c[i>>2]=50;u=c[i>>2]|0;l=g;return u|0}c[(c[j>>2]|0)+84>>2]=13e3;Qr(o,c[k>>2]|0,32);Ur(c[j>>2]|0,o);c[p>>2]=o;c[q>>2]=32;a[r>>0]=0;o=s;c[o>>2]=d[r>>0];c[o+4>>2]=0;while(1){if(!(c[p>>2]&7|0?(c[q>>2]|0)!=0:0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}if((c[q>>2]|0)>>>0>=8){o=s;j=gx(c[o>>2]|0,c[o+4>>2]|0,16843009,16843009)|0;o=s;c[o>>2]=j;c[o+4>>2]=D;do{c[t>>2]=c[p>>2];o=s;j=c[o+4>>2]|0;k=c[t>>2]|0;c[k>>2]=c[o>>2];c[k+4>>2]=j;c[q>>2]=(c[q>>2]|0)-8;c[p>>2]=(c[p>>2]|0)+8}while((c[q>>2]|0)>>>0>=8)}while(1){if(!(c[q>>2]|0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}c[i>>2]=0;u=c[i>>2]|0;l=g;return u|0}function Tr(){var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;b=l;l=l+512|0;if((l|0)>=(m|0))$(512);d=b+192|0;e=b+100|0;f=b+8|0;g=b+472|0;h=b+216|0;i=b+200|0;j=b+4|0;k=b;n=e;o=n+92|0;do{c[n>>2]=0;n=n+4|0}while((n|0)<(o|0));n=f;o=n+92|0;do{c[n>>2]=0;n=n+4|0}while((n|0)<(o|0));n=i;o=n+16|0;do{a[n>>0]=0;n=n+1|0}while((n|0)<(o|0));_r(i,50095,131,50226);if(Jv(50258,i,16)|0){c[d>>2]=50274;p=c[d>>2]|0;l=b;return p|0}n=i;o=n+16|0;do{a[n>>0]=0;n=n+1|0}while((n|0)<(o|0));Sr(e,50226,32)|0;Or(e,50095,32);Or(e,50127,64);Or(e,50191,16);Or(e,50207,8);Or(e,50215,4);Or(e,50219,2);Or(e,50221,1);Or(e,50222,1);Or(e,50223,1);Or(e,50224,1);Or(e,50225,1);Rr(e,i);if(Jv(50258,i,16)|0){c[d>>2]=50298;p=c[d>>2]|0;l=b;return p|0}n=i;o=n+16|0;do{a[n>>0]=0;n=n+1|0}while((n|0)<(o|0));_r(i,50322,16,50338);if(Jv(50370,i,16)|0){c[d>>2]=50386;p=c[d>>2]|0;l=b;return p|0}Sr(f,50410,32)|0;c[j>>2]=0;while(1){if((c[j>>2]|0)>>>0>=256)break;c[k>>2]=0;while(1){if((c[k>>2]|0)>>>0>=32)break;a[g+(c[k>>2]|0)>>0]=c[j>>2];c[k>>2]=(c[k>>2]|0)+1}c[k>>2]=0;while(1){if((c[k>>2]|0)>>>0>=(c[j>>2]|0)>>>0)break;a[h+(c[k>>2]|0)>>0]=c[j>>2];c[k>>2]=(c[k>>2]|0)+1}_r(i,h,c[j>>2]|0,g);Or(f,i,16);c[j>>2]=(c[j>>2]|0)+1}Rr(f,i);if(Jv(50442,i,16)|0){c[d>>2]=50458;p=c[d>>2]|0;l=b;return p|0}else{c[d>>2]=0;p=c[d>>2]|0;l=b;return p|0}return 0}function Ur(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=Pr(c[e>>2]|0)|0;c[(c[e>>2]|0)+88>>2]=0;xb[c[(c[(c[e>>2]|0)+84>>2]|0)+4>>2]&7](c[g>>2]|0,c[f>>2]|0);l=d;return}function Vr(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];f=(Zr(c[g>>2]|0)|0)&67108863;c[c[h>>2]>>2]=f;f=(Zr((c[g>>2]|0)+3|0)|0)>>>2&67108611;c[(c[h>>2]|0)+4>>2]=f;f=(Zr((c[g>>2]|0)+6|0)|0)>>>4&67092735;c[(c[h>>2]|0)+8>>2]=f;f=(Zr((c[g>>2]|0)+9|0)|0)>>>6&66076671;c[(c[h>>2]|0)+12>>2]=f;f=(Zr((c[g>>2]|0)+12|0)|0)>>>8&1048575;c[(c[h>>2]|0)+16>>2]=f;c[(c[h>>2]|0)+20>>2]=0;c[(c[h>>2]|0)+20+4>>2]=0;c[(c[h>>2]|0)+20+8>>2]=0;c[(c[h>>2]|0)+20+12>>2]=0;c[(c[h>>2]|0)+20+16>>2]=0;f=Zr((c[g>>2]|0)+16|0)|0;c[(c[h>>2]|0)+40>>2]=f;f=Zr((c[g>>2]|0)+20|0)|0;c[(c[h>>2]|0)+40+4>>2]=f;f=Zr((c[g>>2]|0)+24|0)|0;c[(c[h>>2]|0)+40+8>>2]=f;f=Zr((c[g>>2]|0)+28|0)|0;c[(c[h>>2]|0)+40+12>>2]=f;a[(c[h>>2]|0)+56>>0]=0;l=e;return}function Wr(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0;f=l;l=l+128|0;if((l|0)>=(m|0))$(128);g=f+116|0;h=f+112|0;i=f+108|0;j=f+104|0;k=f+100|0;n=f+96|0;o=f+92|0;p=f+88|0;q=f+84|0;r=f+80|0;s=f+76|0;t=f+72|0;u=f+68|0;v=f+64|0;w=f+60|0;x=f+56|0;y=f+52|0;z=f+48|0;A=f+44|0;B=f+32|0;C=f+24|0;E=f+16|0;F=f+8|0;G=f;H=f+40|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=d[(c[j>>2]|0)+56>>0]|0|0?0:16777216;c[n>>2]=c[c[j>>2]>>2];c[o>>2]=c[(c[j>>2]|0)+4>>2];c[p>>2]=c[(c[j>>2]|0)+8>>2];c[q>>2]=c[(c[j>>2]|0)+12>>2];c[r>>2]=c[(c[j>>2]|0)+16>>2];c[s>>2]=(c[o>>2]|0)*5;c[t>>2]=(c[p>>2]|0)*5;c[u>>2]=(c[q>>2]|0)*5;c[v>>2]=(c[r>>2]|0)*5;c[w>>2]=c[(c[j>>2]|0)+20>>2];c[x>>2]=c[(c[j>>2]|0)+20+4>>2];c[y>>2]=c[(c[j>>2]|0)+20+8>>2];c[z>>2]=c[(c[j>>2]|0)+20+12>>2];c[A>>2]=c[(c[j>>2]|0)+20+16>>2];while(1){if((c[i>>2]|0)>>>0<16)break;g=(Zr(c[h>>2]|0)|0)&67108863;c[w>>2]=(c[w>>2]|0)+g;g=(Zr((c[h>>2]|0)+3|0)|0)>>>2&67108863;c[x>>2]=(c[x>>2]|0)+g;g=(Zr((c[h>>2]|0)+6|0)|0)>>>4&67108863;c[y>>2]=(c[y>>2]|0)+g;g=(Zr((c[h>>2]|0)+9|0)|0)>>>6&67108863;c[z>>2]=(c[z>>2]|0)+g;g=(Zr((c[h>>2]|0)+12|0)|0)>>>8;c[A>>2]=(c[A>>2]|0)+(g|c[k>>2]);g=gx(c[w>>2]|0,0,c[n>>2]|0,0)|0;e=D;b=gx(c[x>>2]|0,0,c[v>>2]|0,0)|0;a=Ww(g|0,e|0,b|0,D|0)|0;b=D;e=gx(c[y>>2]|0,0,c[u>>2]|0,0)|0;g=Ww(a|0,b|0,e|0,D|0)|0;e=D;b=gx(c[z>>2]|0,0,c[t>>2]|0,0)|0;a=Ww(g|0,e|0,b|0,D|0)|0;b=D;e=gx(c[A>>2]|0,0,c[s>>2]|0,0)|0;g=Ww(a|0,b|0,e|0,D|0)|0;e=B;c[e>>2]=g;c[e+4>>2]=D;e=gx(c[w>>2]|0,0,c[o>>2]|0,0)|0;g=D;b=gx(c[x>>2]|0,0,c[n>>2]|0,0)|0;a=Ww(e|0,g|0,b|0,D|0)|0;b=D;g=gx(c[y>>2]|0,0,c[v>>2]|0,0)|0;e=Ww(a|0,b|0,g|0,D|0)|0;g=D;b=gx(c[z>>2]|0,0,c[u>>2]|0,0)|0;a=Ww(e|0,g|0,b|0,D|0)|0;b=D;g=gx(c[A>>2]|0,0,c[t>>2]|0,0)|0;e=Ww(a|0,b|0,g|0,D|0)|0;g=C;c[g>>2]=e;c[g+4>>2]=D;g=gx(c[w>>2]|0,0,c[p>>2]|0,0)|0;e=D;b=gx(c[x>>2]|0,0,c[o>>2]|0,0)|0;a=Ww(g|0,e|0,b|0,D|0)|0;b=D;e=gx(c[y>>2]|0,0,c[n>>2]|0,0)|0;g=Ww(a|0,b|0,e|0,D|0)|0;e=D;b=gx(c[z>>2]|0,0,c[v>>2]|0,0)|0;a=Ww(g|0,e|0,b|0,D|0)|0;b=D;e=gx(c[A>>2]|0,0,c[u>>2]|0,0)|0;g=Ww(a|0,b|0,e|0,D|0)|0;e=E;c[e>>2]=g;c[e+4>>2]=D;e=gx(c[w>>2]|0,0,c[q>>2]|0,0)|0;g=D;b=gx(c[x>>2]|0,0,c[p>>2]|0,0)|0;a=Ww(e|0,g|0,b|0,D|0)|0;b=D;g=gx(c[y>>2]|0,0,c[o>>2]|0,0)|0;e=Ww(a|0,b|0,g|0,D|0)|0;g=D;b=gx(c[z>>2]|0,0,c[n>>2]|0,0)|0;a=Ww(e|0,g|0,b|0,D|0)|0;b=D;g=gx(c[A>>2]|0,0,c[v>>2]|0,0)|0;e=Ww(a|0,b|0,g|0,D|0)|0;g=F;c[g>>2]=e;c[g+4>>2]=D;g=gx(c[w>>2]|0,0,c[r>>2]|0,0)|0;e=D;b=gx(c[x>>2]|0,0,c[q>>2]|0,0)|0;a=Ww(g|0,e|0,b|0,D|0)|0;b=D;e=gx(c[y>>2]|0,0,c[p>>2]|0,0)|0;g=Ww(a|0,b|0,e|0,D|0)|0;e=D;b=gx(c[z>>2]|0,0,c[o>>2]|0,0)|0;a=Ww(g|0,e|0,b|0,D|0)|0;b=D;e=gx(c[A>>2]|0,0,c[n>>2]|0,0)|0;g=Ww(a|0,b|0,e|0,D|0)|0;e=G;c[e>>2]=g;c[e+4>>2]=D;e=B;g=cx(c[e>>2]|0,c[e+4>>2]|0,26)|0;c[H>>2]=g;c[w>>2]=c[B>>2]&67108863;g=C;e=Ww(c[g>>2]|0,c[g+4>>2]|0,c[H>>2]|0,0)|0;g=C;c[g>>2]=e;c[g+4>>2]=D;g=C;e=cx(c[g>>2]|0,c[g+4>>2]|0,26)|0;c[H>>2]=e;c[x>>2]=c[C>>2]&67108863;e=E;g=Ww(c[e>>2]|0,c[e+4>>2]|0,c[H>>2]|0,0)|0;e=E;c[e>>2]=g;c[e+4>>2]=D;e=E;g=cx(c[e>>2]|0,c[e+4>>2]|0,26)|0;c[H>>2]=g;c[y>>2]=c[E>>2]&67108863;g=F;e=Ww(c[g>>2]|0,c[g+4>>2]|0,c[H>>2]|0,0)|0;g=F;c[g>>2]=e;c[g+4>>2]=D;g=F;e=cx(c[g>>2]|0,c[g+4>>2]|0,26)|0;c[H>>2]=e;c[z>>2]=c[F>>2]&67108863;e=G;g=Ww(c[e>>2]|0,c[e+4>>2]|0,c[H>>2]|0,0)|0;e=G;c[e>>2]=g;c[e+4>>2]=D;e=G;g=cx(c[e>>2]|0,c[e+4>>2]|0,26)|0;c[H>>2]=g;c[A>>2]=c[G>>2]&67108863;c[w>>2]=(c[w>>2]|0)+((c[H>>2]|0)*5|0);c[H>>2]=(c[w>>2]|0)>>>26;c[w>>2]=c[w>>2]&67108863;c[x>>2]=(c[x>>2]|0)+(c[H>>2]|0);c[h>>2]=(c[h>>2]|0)+16;c[i>>2]=(c[i>>2]|0)-16}c[(c[j>>2]|0)+20>>2]=c[w>>2];c[(c[j>>2]|0)+20+4>>2]=c[x>>2];c[(c[j>>2]|0)+20+8>>2]=c[y>>2];c[(c[j>>2]|0)+20+12>>2]=c[z>>2];c[(c[j>>2]|0)+20+16>>2]=c[A>>2];l=f;return 124}function Xr(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0;g=l;l=l+112|0;if((l|0)>=(m|0))$(112);h=g+80|0;i=g+76|0;j=g+72|0;k=g+68|0;n=g+64|0;o=g+60|0;p=g+56|0;q=g+52|0;r=g+48|0;s=g+44|0;t=g+40|0;u=g+36|0;v=g+32|0;w=g+28|0;x=g+24|0;y=g+20|0;z=g;A=g+16|0;B=g+12|0;C=g+88|0;E=g+8|0;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=f;c[n>>2]=c[h>>2];c[B>>2]=0;if(c[j>>2]|0){h=C;f=h+16|0;do{a[h>>0]=0;h=h+1|0}while((h|0)<(f|0));c[E>>2]=0;while(1){if((c[E>>2]|0)>>>0>=(c[j>>2]|0)>>>0)break;a[C+(c[E>>2]|0)>>0]=a[(c[i>>2]|0)+(c[E>>2]|0)>>0]|0;c[E>>2]=(c[E>>2]|0)+1}a[C+(c[j>>2]|0)>>0]=1;a[(c[n>>2]|0)+56>>0]=1;c[B>>2]=Wr(c[n>>2]|0,C,16)|0}c[o>>2]=c[(c[n>>2]|0)+20>>2];c[p>>2]=c[(c[n>>2]|0)+20+4>>2];c[q>>2]=c[(c[n>>2]|0)+20+8>>2];c[r>>2]=c[(c[n>>2]|0)+20+12>>2];c[s>>2]=c[(c[n>>2]|0)+20+16>>2];c[t>>2]=(c[p>>2]|0)>>>26;c[p>>2]=c[p>>2]&67108863;c[q>>2]=(c[q>>2]|0)+(c[t>>2]|0);c[t>>2]=(c[q>>2]|0)>>>26;c[q>>2]=c[q>>2]&67108863;c[r>>2]=(c[r>>2]|0)+(c[t>>2]|0);c[t>>2]=(c[r>>2]|0)>>>26;c[r>>2]=c[r>>2]&67108863;c[s>>2]=(c[s>>2]|0)+(c[t>>2]|0);c[t>>2]=(c[s>>2]|0)>>>26;c[s>>2]=c[s>>2]&67108863;c[o>>2]=(c[o>>2]|0)+((c[t>>2]|0)*5|0);c[t>>2]=(c[o>>2]|0)>>>26;c[o>>2]=c[o>>2]&67108863;c[p>>2]=(c[p>>2]|0)+(c[t>>2]|0);c[u>>2]=(c[o>>2]|0)+5;c[t>>2]=(c[u>>2]|0)>>>26;c[u>>2]=c[u>>2]&67108863;c[v>>2]=(c[p>>2]|0)+(c[t>>2]|0);c[t>>2]=(c[v>>2]|0)>>>26;c[v>>2]=c[v>>2]&67108863;c[w>>2]=(c[q>>2]|0)+(c[t>>2]|0);c[t>>2]=(c[w>>2]|0)>>>26;c[w>>2]=c[w>>2]&67108863;c[x>>2]=(c[r>>2]|0)+(c[t>>2]|0);c[t>>2]=(c[x>>2]|0)>>>26;c[x>>2]=c[x>>2]&67108863;c[y>>2]=(c[s>>2]|0)+(c[t>>2]|0)-67108864;c[A>>2]=((c[y>>2]|0)>>>31)-1;c[u>>2]=c[u>>2]&c[A>>2];c[v>>2]=c[v>>2]&c[A>>2];c[w>>2]=c[w>>2]&c[A>>2];c[x>>2]=c[x>>2]&c[A>>2];c[y>>2]=c[y>>2]&c[A>>2];c[A>>2]=~c[A>>2];c[o>>2]=c[o>>2]&c[A>>2]|c[u>>2];c[p>>2]=c[p>>2]&c[A>>2]|c[v>>2];c[q>>2]=c[q>>2]&c[A>>2]|c[w>>2];c[r>>2]=c[r>>2]&c[A>>2]|c[x>>2];c[s>>2]=c[s>>2]&c[A>>2]|c[y>>2];c[o>>2]=c[o>>2]|c[p>>2]<<26;c[p>>2]=(c[p>>2]|0)>>>6|c[q>>2]<<20;c[q>>2]=(c[q>>2]|0)>>>12|c[r>>2]<<14;c[r>>2]=(c[r>>2]|0)>>>18|c[s>>2]<<8;s=Ww(c[o>>2]|0,0,c[(c[n>>2]|0)+40>>2]|0,0)|0;y=z;c[y>>2]=s;c[y+4>>2]=D;c[o>>2]=c[z>>2];y=Ww(c[p>>2]|0,0,c[(c[n>>2]|0)+40+4>>2]|0,0)|0;s=Ww(y|0,D|0,c[z+4>>2]|0,0)|0;y=z;c[y>>2]=s;c[y+4>>2]=D;c[p>>2]=c[z>>2];y=Ww(c[q>>2]|0,0,c[(c[n>>2]|0)+40+8>>2]|0,0)|0;s=Ww(y|0,D|0,c[z+4>>2]|0,0)|0;y=z;c[y>>2]=s;c[y+4>>2]=D;c[q>>2]=c[z>>2];y=Ww(c[r>>2]|0,0,c[(c[n>>2]|0)+40+12>>2]|0,0)|0;s=Ww(y|0,D|0,c[z+4>>2]|0,0)|0;y=z;c[y>>2]=s;c[y+4>>2]=D;c[r>>2]=c[z>>2];Yr(c[k>>2]|0,c[o>>2]|0);Yr((c[k>>2]|0)+4|0,c[p>>2]|0);Yr((c[k>>2]|0)+8|0,c[q>>2]|0);Yr((c[k>>2]|0)+12|0,c[r>>2]|0);c[(c[n>>2]|0)+20>>2]=0;c[(c[n>>2]|0)+20+4>>2]=0;c[(c[n>>2]|0)+20+8>>2]=0;c[(c[n>>2]|0)+20+12>>2]=0;c[(c[n>>2]|0)+20+16>>2]=0;c[c[n>>2]>>2]=0;c[(c[n>>2]|0)+4>>2]=0;c[(c[n>>2]|0)+8>>2]=0;c[(c[n>>2]|0)+12>>2]=0;c[(c[n>>2]|0)+16>>2]=0;c[(c[n>>2]|0)+40>>2]=0;c[(c[n>>2]|0)+40+4>>2]=0;c[(c[n>>2]|0)+40+8>>2]=0;c[(c[n>>2]|0)+40+12>>2]=0;l=g;return 100+(c[B>>2]|0)|0}function Yr(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];a[(c[h>>2]|0)+3>>0]=(c[g>>2]|0)>>>24;a[(c[h>>2]|0)+2>>0]=(c[g>>2]|0)>>>16;a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)>>>8;a[c[h>>2]>>0]=c[g>>2];l=e;return}function Zr(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];l=b;return (d[(c[f>>2]|0)+3>>0]|0)<<24|(d[(c[f>>2]|0)+2>>0]|0)<<16|(d[(c[f>>2]|0)+1>>0]|0)<<8|(d[c[f>>2]>>0]|0)|0}function _r(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+144|0;if((l|0)>=(m|0))$(144);i=h+124|0;j=h+120|0;k=h+116|0;n=h+112|0;o=h+20|0;p=h+16|0;q=h+12|0;r=h+128|0;s=h;t=h+8|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;g=o;f=g+92|0;do{c[g>>2]=0;g=g+4|0}while((g|0)<(f|0));Sr(o,c[n>>2]|0,32)|0;Or(o,c[j>>2]|0,c[k>>2]|0);Rr(o,c[i>>2]|0);c[p>>2]=o;c[q>>2]=92;a[r>>0]=0;o=s;c[o>>2]=d[r>>0];c[o+4>>2]=0;while(1){if(!(c[p>>2]&7|0?(c[q>>2]|0)!=0:0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}if((c[q>>2]|0)>>>0>=8){o=s;i=gx(c[o>>2]|0,c[o+4>>2]|0,16843009,16843009)|0;o=s;c[o>>2]=i;c[o+4>>2]=D;do{c[t>>2]=c[p>>2];o=s;i=c[o+4>>2]|0;k=c[t>>2]|0;c[k>>2]=c[o>>2];c[k+4>>2]=i;c[q>>2]=(c[q>>2]|0)-8;c[p>>2]=(c[p>>2]|0)+8}while((c[q>>2]|0)>>>0>=8)}while(1){if(!(c[q>>2]|0))break;a[c[p>>2]>>0]=a[r>>0]|0;c[p>>2]=(c[p>>2]|0)+1;c[q>>2]=(c[q>>2]|0)+-1}l=h;return}function $r(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(c[d>>2]|0){bs();l=b;return}else{as();l=b;return}}function as(){if(c[17782]|0)return;c[17782]=1;return}function bs(){var a=0,b=0;as();cs();if(c[17759]|0){gs();return}if(c[17760]|0)a=Df(1,664)|0;else a=Cf(1,664)|0;c[17759]=a;if(c[17760]|0)b=Df(1,664)|0;else b=Cf(1,664)|0;c[17761]=b;c[17762]=ds()|0;if(!(c[17762]|0)){c[17763]=1;c[17762]=3}c[17764]=fs()|0;gs();return}function cs(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[d>>2]=Ht(13016)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;We(50663,b)}else{c[17765]=1;l=a;return}}function ds(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;if(($v(52864,4)|0)==0?($v(52876,4)|0)==0:0){c[d>>2]=4;l=a;return c[d>>2]|0}We(Je(50625)|0,b);return 0}function es(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+24|0;i=g+20|0;j=g+12|0;k=g+8|0;n=g+4|0;c[g+28>>2]=b;c[h>>2]=d;c[i>>2]=e;c[g+16>>2]=f;if(!(c[17766]|0)){Te(Je(50519)|0,g);c[17766]=1;f=kb(0)|0;vw(S(f,_v()|0)|0)}f=zf(c[i>>2]|0)|0;c[k>>2]=f;c[n>>2]=f;c[j>>2]=c[i>>2];while(1){f=c[j>>2]|0;c[j>>2]=f+-1;if(!f)break;f=1+~~(+(ww()|0)*256.0/2147483648.0)-1&255;e=c[n>>2]|0;c[n>>2]=e+1;a[e>>0]=f}hs(c[k>>2]|0,c[i>>2]|0,c[h>>2]|0);vf(c[k>>2]|0);l=g;return 0}function fs(){return 0}function gs(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[17765]=0;c[d>>2]=It(13016)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;We(50482,b)}else{l=a;return}}function hs(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;i=g+12|0;j=g+8|0;k=g+4|0;n=g;c[h>>2]=b;c[i>>2]=e;c[j>>2]=f;c[k>>2]=c[h>>2];c[n>>2]=0;if(!(c[17765]|0))Se(50570,50585,1074,50601);c[17775]=(c[17775]|0)+(c[i>>2]|0);c[17776]=(c[17776]|0)+1;while(1){h=c[i>>2]|0;c[i>>2]=h+-1;if(!h)break;h=c[k>>2]|0;c[k>>2]=h+1;f=d[h>>0]|0;h=c[17777]|0;c[17777]=h+1;e=(c[17759]|0)+h|0;a[e>>0]=(d[e>>0]|0)^f;c[n>>2]=(c[n>>2]|0)+1;if((c[17777]|0)>>>0<600)continue;if(!((c[j>>2]|0)>>>0<3|(c[17778]|0)!=0)?(c[17779]=(c[17779]|0)+(c[n>>2]|0),c[n>>2]=0,(c[17779]|0)>>>0>=600):0)c[17778]=1;c[17777]=0;is(c[17759]|0);c[17767]=(c[17767]|0)+1;c[17780]=((c[i>>2]|0)!=0^1)&1}l=g;return}function is(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;e=l;l=l+224|0;if((l|0)>=(m|0))$(224);f=e+208|0;g=e+204|0;h=e+200|0;i=e+196|0;j=e+192|0;k=e+188|0;n=e;o=e+184|0;c[f>>2]=b;c[g>>2]=(c[f>>2]|0)+600;if(!(c[17765]|0))Se(50570,50585,615,50616);$k(n);c[i>>2]=(c[f>>2]|0)+600;b=c[g>>2]|0;p=(c[i>>2]|0)+-20|0;q=b+20|0;do{a[b>>0]=a[p>>0]|0;b=b+1|0;p=p+1|0}while((b|0)<(q|0));b=(c[g>>2]|0)+20|0;p=c[f>>2]|0;q=b+44|0;do{a[b>>0]=a[p>>0]|0;b=b+1|0;p=p+1|0}while((b|0)<(q|0));al(n,c[g>>2]|0);b=c[f>>2]|0;p=c[g>>2]|0;q=b+20|0;do{a[b>>0]=a[p>>0]|0;b=b+1|0;p=p+1|0}while((b|0)<(q|0));a:do if(c[17781]|0?(c[f>>2]|0)==(c[17759]|0):0){c[j>>2]=0;while(1){if((c[j>>2]|0)>=20)break a;r=(c[f>>2]|0)+(c[j>>2]|0)|0;a[r>>0]=(d[r>>0]|0)^(d[72298+(c[j>>2]|0)>>0]|0);c[j>>2]=(c[j>>2]|0)+1}}while(0);c[h>>2]=c[f>>2];c[k>>2]=1;while(1){if((c[k>>2]|0)>=30)break;b=c[g>>2]|0;p=c[h>>2]|0;q=b+20|0;do{a[b>>0]=a[p>>0]|0;b=b+1|0;p=p+1|0}while((b|0)<(q|0));c[h>>2]=(c[h>>2]|0)+20;b:do if(((c[h>>2]|0)+20+64|0)>>>0<(c[i>>2]|0)>>>0){b=(c[g>>2]|0)+20|0;p=(c[h>>2]|0)+20|0;q=b+44|0;do{a[b>>0]=a[p>>0]|0;b=b+1|0;p=p+1|0}while((b|0)<(q|0))}else{c[o>>2]=(c[h>>2]|0)+20;c[j>>2]=20;while(1){if((c[j>>2]|0)>=64)break b;if((c[o>>2]|0)>>>0>=(c[i>>2]|0)>>>0)c[o>>2]=c[f>>2];r=c[o>>2]|0;c[o>>2]=r+1;a[(c[g>>2]|0)+(c[j>>2]|0)>>0]=a[r>>0]|0;c[j>>2]=(c[j>>2]|0)+1}}while(0);al(n,c[g>>2]|0);b=c[h>>2]|0;p=c[g>>2]|0;q=b+20|0;do{a[b>>0]=a[p>>0]|0;b=b+1|0;p=p+1|0}while((b|0)<(q|0));c[k>>2]=(c[k>>2]|0)+1}if((c[f>>2]|0)!=(c[17759]|0)){bf(384);cf();l=e;return}bl(72298,c[f>>2]|0,600);c[17781]=1;bf(384);cf();l=e;return}function js(){cs();nt(0,0,0,0)|0;c[17778]=0;gs();return}function ks(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;a=l;l=l+48|0;if((l|0)>=(m|0))$(48);b=a;d=c[17767]|0;e=c[17769]|0;f=c[17770]|0;g=c[17776]|0;h=c[17775]|0;i=c[17768]|0;j=c[17772]|0;k=c[17771]|0;n=c[17774]|0;o=c[17773]|0;p=(kt()|0)!=0;c[b>>2]=600;c[b+4>>2]=d;c[b+8>>2]=e;c[b+12>>2]=f;c[b+16>>2]=g;c[b+20>>2]=h;c[b+24>>2]=i;c[b+28>>2]=j;c[b+32>>2]=k;c[b+36>>2]=n;c[b+40>>2]=o;c[b+44>>2]=p?50700:72319;Te(50716,b);l=a;return}function ls(){c[17760]=1;return}function ms(){c[17783]=1;return}function ns(a){a=a|0;var b=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[b>>2]=a;l=b;return}function os(a){a=a|0;var b=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[b>>2]=a;l=b;return 0}function ps(){bs();return (c[17763]|0?1:(c[17783]|0)!=0)&1|0}function qs(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;bs();if((c[17783]|0)!=0&(c[h>>2]|0)>>>0>1)c[h>>2]=1;c[h>>2]=c[h>>2]&3;cs();d=c[g>>2]|0;if((c[h>>2]|0)>>>0>=2){c[17773]=(c[17773]|0)+d;c[17774]=(c[17774]|0)+1}else{c[17771]=(c[17771]|0)+d;c[17772]=(c[17772]|0)+1}c[i>>2]=c[f>>2];while(1){if((c[g>>2]|0)>>>0<=0)break;c[j>>2]=(c[g>>2]|0)>>>0>600?600:c[g>>2]|0;rs(c[i>>2]|0,c[j>>2]|0,c[h>>2]|0);c[g>>2]=(c[g>>2]|0)-(c[j>>2]|0);c[i>>2]=(c[i>>2]|0)+(c[j>>2]|0)}gs();l=e;return}function rs(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;f=l;l=l+64|0;if((l|0)>=(m|0))$(64);g=f;h=f+48|0;i=f+44|0;j=f+40|0;k=f+36|0;n=f+32|0;o=f+28|0;p=f+24|0;q=f+20|0;r=f+16|0;s=f+12|0;t=f+8|0;u=f+4|0;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(!(c[17765]|0))Se(50570,50585,934,50840);while(1){c[p>>2]=_v()|0;if((c[3265]|0)==-1)c[3265]=c[p>>2];if((c[3265]|0)!=(c[p>>2]|0)){c[3265]=c[p>>2];c[q>>2]=c[3265];hs(q,4,0);c[17780]=0}if(!(c[17765]|0)){v=8;break}if((c[i>>2]|0)>>>0>600){v=10;break}if((c[17778]|0)==0?ss()|0:0)c[17778]=1;if(!((c[j>>2]|0)!=2|(c[17784]|0)!=0)){c[17785]=0;c[r>>2]=(c[i>>2]|0)-(c[17785]|0);if((c[r>>2]|0)>>>0>=16){if((c[r>>2]|0)>>>0>600){v=18;break}}else c[r>>2]=16;ts(4,c[r>>2]|0,2);c[17785]=(c[17785]|0)+(c[r>>2]|0);c[17784]=1}if((c[j>>2]|0)==2?(c[17785]|0)>>>0<(c[i>>2]|0)>>>0:0){if((c[17785]|0)<0)c[17785]=0;c[s>>2]=(c[i>>2]|0)-(c[17785]|0);if((c[s>>2]|0)>>>0>600){v=25;break}ts(4,c[s>>2]|0,2);c[17785]=(c[17785]|0)+(c[s>>2]|0)}while(1){if(!((c[17778]|0)!=0^1))break;us()}vs();c[t>>2]=c[3265];hs(t,4,0);if(!(c[17780]|0)){is(c[17759]|0);c[17767]=(c[17767]|0)+1}c[k>>2]=0;c[o>>2]=c[17761];c[n>>2]=c[17759];while(1){if((c[k>>2]|0)>=150)break;c[c[o>>2]>>2]=(c[c[n>>2]>>2]|0)+-1515870811;c[k>>2]=(c[k>>2]|0)+1;c[o>>2]=(c[o>>2]|0)+4;c[n>>2]=(c[n>>2]|0)+4}is(c[17759]|0);c[17767]=(c[17767]|0)+1;is(c[17761]|0);c[17768]=(c[17768]|0)+1;while(1){e=c[i>>2]|0;c[i>>2]=e+-1;if(!e)break;e=c[17786]|0;c[17786]=e+1;d=a[(c[17761]|0)+e>>0]|0;e=c[h>>2]|0;c[h>>2]=e+1;a[e>>0]=d;if((c[17786]|0)>>>0>=600)c[17786]=0;c[17785]=(c[17785]|0)+-1}if((c[17785]|0)<0)c[17785]=0;Uw(c[17761]|0,0,600)|0;d=_v()|0;if((d|0)==(c[p>>2]|0)){v=43;break}c[u>>2]=_v()|0;hs(u,4,0);c[17780]=0;c[3265]=c[u>>2]}if((v|0)==8)Se(50570,50585,953,50840);else if((v|0)==10)Xe(50850,g);else if((v|0)==18)Re(50585,979,50840);else if((v|0)==25)Re(50585,995,50840);else if((v|0)==43){l=f;return}}function ss(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;a=l;l=l+768|0;if((l|0)>=(m|0))$(768);b=a+48|0;d=a+40|0;e=a+32|0;f=a+24|0;g=a+16|0;h=a+8|0;i=a+152|0;j=a+148|0;k=a+72|0;n=a+160|0;o=a+68|0;p=a+64|0;q=a+60|0;r=a+56|0;if(!(c[17765]|0))Se(50570,50585,743,50991);if(!(c[17787]|0)){c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}c[j>>2]=gw(c[17787]|0,0,a)|0;if((c[j>>2]|0)==-1?(c[(xu()|0)>>2]|0)==2:0){c[17788]=1;c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}if((c[j>>2]|0)==-1){t=Je(51006)|0;u=c[17787]|0;v=Nu(c[(xu()|0)>>2]|0)|0;c[h>>2]=u;c[h+4>>2]=v;Te(t,h);c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}h=(ws(c[j>>2]|0,c[17787]|0,0)|0)!=0;t=c[j>>2]|0;if(h){Kv(t)|0;c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}if(cw(t,k)|0){t=Je(51027)|0;h=c[17787]|0;v=Nu(c[(xu()|0)>>2]|0)|0;c[g>>2]=h;c[g+4>>2]=v;Te(t,g);Kv(c[j>>2]|0)|0;c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}if((c[k+12>>2]&61440|0)!=32768){g=Je(51048)|0;c[f>>2]=c[17787];Te(g,f);Kv(c[j>>2]|0)|0;c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}if(!(c[k+36>>2]|0)){Te(Je(51086)|0,e);Kv(c[j>>2]|0)|0;c[17788]=1;c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}if((c[k+36>>2]|0)!=600){Te(Je(51119)|0,d);Kv(c[j>>2]|0)|0;c[i>>2]=0;s=c[i>>2]|0;l=a;return s|0}do{c[o>>2]=fw(c[j>>2]|0,n,600)|0;if((c[o>>2]|0)!=-1)break}while((c[(xu()|0)>>2]|0)==4);if((c[o>>2]|0)!=600){o=Je(51173)|0;d=c[17787]|0;k=Nu(c[(xu()|0)>>2]|0)|0;c[b>>2]=d;c[b+4>>2]=k;We(o,b)}Kv(c[j>>2]|0)|0;hs(n,600,0);c[p>>2]=_v()|0;hs(p,4,0);c[q>>2]=kb(0)|0;hs(q,4,0);c[r>>2]=Ta()|0;hs(r,4,0);ts(0,16,0);c[17788]=1;c[i>>2]=1;s=c[i>>2]|0;l=a;return s|0}function ts(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(!(c[17762]|0))We(50902,e);if((Bb[c[17762]&7](3,c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0)<0)We(50953,e+8|0);else{l=e;return}}function us(){c[17769]=(c[17769]|0)+1;ts(3,120,1);return}function vs(){var a=0,b=0,d=0,e=0,f=0;a=l;l=l+160|0;if((l|0)>=(m|0))$(160);b=a+144|0;d=a+8|0;e=a+4|0;f=a;if(!(c[17765]|0))Se(50570,50585,1180,50882);c[17770]=(c[17770]|0)+1;if(c[17764]|0)xb[c[17764]&7](3,2);if(lb(b|0,0)|0)Re(50585,1198,50882);else{hs(b,4,2);hs(b+4|0,4,2);Bw(0,d)|0;hs(d,136,2);Uw(d|0,0,136)|0;c[e>>2]=kb(0)|0;hs(e,4,2);c[f>>2]=Ta()|0;hs(f,4,2);lt(3,2);l=a;return}}function ws(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;f=l;l=l+64|0;if((l|0)>=(m|0))$(64);g=f+16|0;h=f+8|0;i=f;j=f+60|0;k=f+56|0;n=f+52|0;o=f+48|0;p=f+32|0;q=f+24|0;r=f+20|0;c[k>>2]=a;c[n>>2]=d;c[o>>2]=e;c[r>>2]=0;c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;c[p+12>>2]=0;b[p>>1]=c[o>>2]|0?1:0;b[p+2>>1]=0;while(1){o=c[k>>2]|0;c[i>>2]=p;if((Lv(o,13,i)|0)!=-1){s=10;break}if((c[(xu()|0)>>2]|0)!=11?(c[(xu()|0)>>2]|0)!=13:0){s=5;break}if((c[r>>2]|0)>2){o=Je(51215)|0;c[g>>2]=c[n>>2];Te(o,g)}c[q>>2]=c[r>>2];c[q+4>>2]=25e4;dw(0,0,0,0,q)|0;if((c[r>>2]|0)>=10)continue;c[r>>2]=(c[r>>2]|0)+1}if((s|0)==5){r=Je(51194)|0;q=c[n>>2]|0;n=Nu(c[(xu()|0)>>2]|0)|0;c[h>>2]=q;c[h+4>>2]=n;Te(r,h);c[j>>2]=-1;t=c[j>>2]|0;l=f;return t|0}else if((s|0)==10){c[j>>2]=0;t=c[j>>2]|0;l=f;return t|0}return 0}function xs(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(c[17787]|0)Re(50585,673,51244);else{c[17787]=Ef(c[d>>2]|0)|0;l=b;return}}function ys(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;a=l;l=l+64|0;if((l|0)>=(m|0))$(64);b=a+40|0;d=a+32|0;e=a+24|0;f=a+16|0;g=a+8|0;h=a+60|0;i=a+56|0;j=a+52|0;k=a+48|0;as();cs();if(!((c[17787]|0)!=0&(c[17759]|0)!=0&(c[17778]|0)!=0)){gs();l=a;return}if(!(c[17788]|0)){gs();Te(Je(51274)|0,a);l=a;return}c[k>>2]=0;c[i>>2]=c[17761];c[h>>2]=c[17759];while(1){if((c[k>>2]|0)>=150)break;c[c[i>>2]>>2]=(c[c[h>>2]>>2]|0)+-1515870811;c[k>>2]=(c[k>>2]|0)+1;c[i>>2]=(c[i>>2]|0)+4;c[h>>2]=(c[h>>2]|0)+4}is(c[17759]|0);c[17767]=(c[17767]|0)+1;is(c[17761]|0);c[17768]=(c[17768]|0)+1;h=c[17787]|0;c[g>>2]=384;c[j>>2]=gw(h,65,g)|0;do if((c[j>>2]|0)!=-1){g=(ws(c[j>>2]|0,c[17787]|0,1)|0)!=0;h=c[j>>2]|0;if(g){Kv(h)|0;break}if(pw(h,0)|0){h=Je(51333)|0;g=c[17787]|0;i=Nu(c[(xu()|0)>>2]|0)|0;c[e>>2]=g;c[e+4>>2]=i;Te(h,e);Kv(c[j>>2]|0)|0;break}do{c[k>>2]=ew(c[j>>2]|0,c[17761]|0,600)|0;if((c[k>>2]|0)!=-1)break}while((c[(xu()|0)>>2]|0)==4);if((c[k>>2]|0)!=600){h=Je(51333)|0;i=c[17787]|0;g=Nu(c[(xu()|0)>>2]|0)|0;c[d>>2]=i;c[d+4>>2]=g;Te(h,d)}if(Kv(c[j>>2]|0)|0){h=Je(51355)|0;g=c[17787]|0;i=Nu(c[(xu()|0)>>2]|0)|0;c[b>>2]=g;c[b+4>>2]=i;Te(h,b)}}else{h=Je(51310)|0;i=c[17787]|0;g=Nu(c[(xu()|0)>>2]|0)|0;c[f>>2]=i;c[f+4>>2]=g;Te(h,f)}while(0);gs();l=a;return}function zs(){as();cs();if(!(c[17759]|0)){gs();return}vs();gs();return}function As(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Bs();if(!(c[d>>2]|0)){l=b;return}Cs();do if(c[17789]|0){if(c[(c[17790]|0)+52>>2]|0)Se(51377,51405,767,51419);if(c[(c[17791]|0)+52>>2]|0)Se(51444,51405,768,51419);if(c[(c[17792]|0)+52>>2]|0)Se(51474,51405,769,51419);else{Es(c[17790]|0);Es(c[17791]|0);Es(c[17792]|0);break}}else{c[17789]=Bf(48)|0;c[17790]=Cf(1,68)|0;Ds(c[17790]|0);c[17791]=Df(1,68)|0;Ds(c[17791]|0);c[17792]=Df(1,68)|0;Ds(c[17792]|0)}while(0);Fs();l=b;return}function Bs(){if(c[17794]|0)return;c[17794]=1;c[17793]=0;return}function Cs(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[d>>2]=Ht(13064)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;We(51589,b)}else{c[17793]=1;l=a;return}}function Ds(b){b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;a[c[e>>2]>>0]=17;a[(c[e>>2]|0)+16>>0]=42;a[(c[e>>2]|0)+33>>0]=-119;a[(c[e>>2]|0)+50>>0]=-4;l=d;return}function Es(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b;f=b+4|0;c[f>>2]=a;if((((d[c[f>>2]>>0]|0|0)==17?(d[(c[f>>2]|0)+16>>0]|0|0)==42:0)?(d[(c[f>>2]|0)+33>>0]|0|0)==137:0)?(d[(c[f>>2]|0)+50>>0]|0|0)==252:0){l=b;return}c[e>>2]=c[f>>2];We(51543,e)}function Fs(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[17793]=0;c[d>>2]=It(13064)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;We(51507,b)}else{l=a;return}}function Gs(){Cs();nt(0,0,0,0)|0;Fs();return}function Hs(){return}function Is(){return 0}function Js(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;As(1);Cs();d=c[f>>2]|0;f=c[g>>2]|0;if((c[h>>2]|0)==2){Ks(d,f,c[17792]|0);Fs();l=e;return}else{Ks(d,f,c[17791]|0);Fs();l=e;return}} -function Nj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;e=l;l=l+160|0;if((l|0)>=(m|0))$(160);f=e+144|0;g=e+140|0;h=e+136|0;i=e+132|0;j=e+128|0;k=e+124|0;n=e+120|0;o=e+116|0;p=e+112|0;q=e+108|0;r=e+104|0;s=e+100|0;t=e+96|0;u=e+92|0;v=e+88|0;w=e+84|0;x=e+80|0;y=e+76|0;z=e+72|0;A=e+68|0;B=e+64|0;C=e+60|0;D=e+56|0;E=e+52|0;F=e+48|0;G=e+44|0;H=e+40|0;I=e+36|0;J=e+32|0;K=e+28|0;L=e+24|0;M=e+20|0;N=e+16|0;O=e+12|0;P=e+8|0;Q=e+4|0;R=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=0;c[r>>2]=0;c[s>>2]=0;c[c[h>>2]>>2]=0;c[k>>2]=Tf(c[g>>2]|0,37953,0)|0;if(!(c[k>>2]|0)){d=$f(c[g>>2]|0,0,0)|0;c[c[h>>2]>>2]=d;c[f>>2]=c[c[h>>2]>>2]|0?0:65;S=c[f>>2]|0;l=e;return S|0}c[t>>2]=Tf(c[k>>2]|0,47178,0)|0;if(c[t>>2]|0){if(Fj(c[t>>2]|0,s,(c[i>>2]|0)+8|0)|0)c[r>>2]=1;Rf(c[t>>2]|0)}if((c[(c[i>>2]|0)+8>>2]|0)==5)c[(c[i>>2]|0)+8>>2]=0;c[n>>2]=Tf(c[k>>2]|0,37958,0)|0;if(c[n>>2]|0)T=0;else T=Tf(c[k>>2]|0,40906,0)|0;c[o>>2]=T;a:do if(((c[n>>2]|0)!=0^1)&1^((c[o>>2]|0)!=0^1)&1|0){if(c[r>>2]|0){c[j>>2]=72;break}if((c[(c[i>>2]|0)+8>>2]|0)==0?c[s>>2]&4096|0:0){if(!(c[o>>2]|0)){c[j>>2]=65;break}c[u>>2]=Tf(c[k>>2]|0,37847,0)|0;if(c[u>>2]|0){c[q>>2]=Xf(c[u>>2]|0,1,p)|0;if(c[q>>2]|0){T=Kj(c[q>>2]|0,c[p>>2]|0)|0;c[(c[i>>2]|0)+16>>2]=T;if(!(c[(c[i>>2]|0)+16>>2]|0))c[j>>2]=5}else c[j>>2]=68;Rf(c[u>>2]|0)}else c[j>>2]=65;if(c[j>>2]|0)break;c[v>>2]=Zf(c[o>>2]|0,1,w)|0;if(c[v>>2]|0){if(c[w>>2]<<3>>>0<(c[w>>2]|0)>>>0){vf(c[v>>2]|0);c[j>>2]=67}}else{c[w>>2]=0;c[v>>2]=pf(1)|0;if(!(c[v>>2]|0))c[j>>2]=Et()|0}if(c[j>>2]|0)break;T=Ep(0,c[v>>2]|0,c[w>>2]<<3)|0;c[c[h>>2]>>2]=T;break}do if(c[n>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==0:0){if((c[s>>2]&16|0)==0?(c[s>>2]&2|0)==0:0)break;if((Uf(c[n>>2]|0)|0)!=3){c[j>>2]=65;break a}T=Xf(c[n>>2]|0,1,p)|0;c[q>>2]=T;if(!((T|0)!=0&(c[p>>2]|0)!=0)){c[j>>2]=65;break a}T=Kj(c[q>>2]|0,c[p>>2]|0)|0;c[(c[i>>2]|0)+16>>2]=T;if(!(c[(c[i>>2]|0)+16>>2]|0)){c[j>>2]=5;break a}T=Zf(c[n>>2]|0,2,y)|0;c[x>>2]=T;if(!T){c[j>>2]=65;break a}T=c[x>>2]|0;if(c[y>>2]<<3>>>0<(c[y>>2]|0)>>>0){vf(T);c[j>>2]=67;break a}else{t=Ep(0,T,c[y>>2]<<3)|0;c[c[h>>2]>>2]=t;break a}}while(0);if(c[o>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==0:0){if(c[s>>2]&2|0){c[j>>2]=70;break}t=$f(c[o>>2]|0,1,5)|0;c[c[h>>2]>>2]=t;if(c[c[h>>2]>>2]|0)break;c[j>>2]=65;break}if((c[o>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==1:0)?(c[c[i>>2]>>2]|0)==0:0){c[C>>2]=0;c[D>>2]=0;t=Xf(c[o>>2]|0,1,A)|0;c[z>>2]=t;if(!((t|0)!=0&(c[A>>2]|0)!=0)){c[j>>2]=65;break}c[B>>2]=Tf(c[k>>2]|0,37863,0)|0;if(c[B>>2]|0){c[q>>2]=Xf(c[B>>2]|0,1,p)|0;do if(c[q>>2]|0){if((c[p>>2]|0)>>>0>0){c[C>>2]=pf(c[p>>2]|0)|0;if(c[C>>2]|0){_w(c[C>>2]|0,c[q>>2]|0,c[p>>2]|0)|0;c[D>>2]=c[p>>2];break}else{c[j>>2]=Et()|0;break}}}else c[j>>2]=68;while(0);Rf(c[B>>2]|0);if(c[j>>2]|0)break}c[j>>2]=cl(c[h>>2]|0,c[(c[i>>2]|0)+4>>2]|0,c[z>>2]|0,c[A>>2]|0,c[C>>2]|0,c[D>>2]|0)|0;vf(c[C>>2]|0);break}do if(c[n>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==1:0){if((c[c[i>>2]>>2]|0)!=2?(c[c[i>>2]>>2]|0)!=3:0)break;if((Uf(c[n>>2]|0)|0)!=3){c[j>>2]=65;break a}t=Xf(c[n>>2]|0,1,p)|0;c[q>>2]=t;if(!((t|0)!=0&(c[p>>2]|0)!=0)){c[j>>2]=65;break a}t=Kj(c[q>>2]|0,c[p>>2]|0)|0;c[(c[i>>2]|0)+16>>2]=t;if(!(c[(c[i>>2]|0)+16>>2]|0)){c[j>>2]=5;break a}t=Xf(c[n>>2]|0,2,F)|0;c[E>>2]=t;if((t|0)!=0&(c[F>>2]|0)!=0){c[j>>2]=gl(c[h>>2]|0,c[(c[i>>2]|0)+4>>2]|0,c[E>>2]|0,c[F>>2]|0,c[(c[i>>2]|0)+16>>2]|0)|0;break a}else{c[j>>2]=65;break a}}while(0);do if(c[o>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==2:0){if((c[c[i>>2]>>2]|0)!=2?(c[c[i>>2]>>2]|0)!=3:0)break;if((Uf(c[o>>2]|0)|0)!=2){c[j>>2]=65;break a}t=Xf(c[o>>2]|0,1,H)|0;c[G>>2]=t;if((t|0)!=0&(c[H>>2]|0)!=0){c[j>>2]=hl(c[h>>2]|0,c[(c[i>>2]|0)+4>>2]|0,c[G>>2]|0,c[H>>2]|0)|0;break a}else{c[j>>2]=65;break a}}while(0);if((c[o>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==3:0)?(c[c[i>>2]>>2]|0)==0:0){t=Xf(c[o>>2]|0,1,J)|0;c[I>>2]=t;if(!((t|0)!=0&(c[J>>2]|0)!=0)){c[j>>2]=65;break}c[L>>2]=0;c[M>>2]=0;c[K>>2]=Tf(c[k>>2]|0,37847,0)|0;if(c[K>>2]|0){c[q>>2]=Xf(c[K>>2]|0,1,p)|0;do if(c[q>>2]|0){t=Kj(c[q>>2]|0,c[p>>2]|0)|0;c[(c[i>>2]|0)+16>>2]=t;if(c[(c[i>>2]|0)+16>>2]|0)break;c[j>>2]=5}else c[j>>2]=68;while(0);Rf(c[K>>2]|0);if(c[j>>2]|0)break}c[K>>2]=Tf(c[k>>2]|0,37857,0)|0;if(c[K>>2]|0){c[q>>2]=Xf(c[K>>2]|0,1,p)|0;do if(c[q>>2]|0){if((c[p>>2]|0)>>>0<=0)break;t=pf(c[p>>2]|0)|0;c[(c[i>>2]|0)+20>>2]=t;if(c[(c[i>>2]|0)+20>>2]|0){_w(c[(c[i>>2]|0)+20>>2]|0,c[q>>2]|0,c[p>>2]|0)|0;c[(c[i>>2]|0)+24>>2]=c[p>>2];break}else{c[j>>2]=Et()|0;break}}else c[j>>2]=68;while(0);Rf(c[K>>2]|0);if(c[j>>2]|0)break}c[K>>2]=Tf(c[k>>2]|0,37863,0)|0;if(c[K>>2]|0){c[q>>2]=Xf(c[K>>2]|0,1,p)|0;do if(c[q>>2]|0){if((c[p>>2]|0)>>>0<=0)break;c[L>>2]=pf(c[p>>2]|0)|0;if(c[L>>2]|0){_w(c[L>>2]|0,c[q>>2]|0,c[p>>2]|0)|0;c[M>>2]=c[p>>2];break}else{c[j>>2]=Et()|0;break}}else c[j>>2]=68;while(0);Rf(c[K>>2]|0);if(c[j>>2]|0)break}c[j>>2]=il(c[h>>2]|0,c[(c[i>>2]|0)+4>>2]|0,c[(c[i>>2]|0)+16>>2]|0,c[I>>2]|0,c[J>>2]|0,c[(c[i>>2]|0)+20>>2]|0,c[(c[i>>2]|0)+24>>2]|0,c[L>>2]|0,c[M>>2]|0)|0;vf(c[L>>2]|0);break}if((c[n>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==4:0)?(c[c[i>>2]>>2]|0)==2:0){if((Uf(c[n>>2]|0)|0)!=3){c[j>>2]=65;break}t=Xf(c[n>>2]|0,1,p)|0;c[q>>2]=t;if(!((t|0)!=0&(c[p>>2]|0)!=0)){c[j>>2]=65;break}c[P>>2]=0;c[Q>>2]=0;t=Kj(c[q>>2]|0,c[p>>2]|0)|0;c[(c[i>>2]|0)+16>>2]=t;if(!(c[(c[i>>2]|0)+16>>2]|0)){c[j>>2]=5;break}t=Xf(c[n>>2]|0,2,O)|0;c[N>>2]=t;if(!((t|0)!=0&(c[O>>2]|0)!=0)){c[j>>2]=65;break}c[R>>2]=Tf(c[k>>2]|0,37963,0)|0;do if(c[R>>2]|0){c[q>>2]=Xf(c[R>>2]|0,1,p)|0;if(c[q>>2]|0){t=wv(c[q>>2]|0,0,10)|0;c[(c[i>>2]|0)+28>>2]=t;Rf(c[R>>2]|0);break}else{c[j>>2]=68;break a}}while(0);c[R>>2]=Tf(c[k>>2]|0,37863,0)|0;if(c[R>>2]|0){c[q>>2]=Xf(c[R>>2]|0,1,p)|0;do if(c[q>>2]|0){if((c[p>>2]|0)>>>0<=0)break;c[P>>2]=pf(c[p>>2]|0)|0;if(c[P>>2]|0){_w(c[P>>2]|0,c[q>>2]|0,c[p>>2]|0)|0;c[Q>>2]=c[p>>2];break}else{c[j>>2]=Et()|0;break}}else c[j>>2]=68;while(0);Rf(c[R>>2]|0);if(c[j>>2]|0)break}c[j>>2]=ml(c[h>>2]|0,(c[(c[i>>2]|0)+4>>2]|0)-1|0,c[(c[i>>2]|0)+16>>2]|0,c[N>>2]|0,c[O>>2]|0,c[(c[i>>2]|0)+28>>2]|0,c[P>>2]|0,c[Q>>2]|0)|0;vf(c[P>>2]|0);break}if((c[n>>2]|0?(c[(c[i>>2]|0)+8>>2]|0)==4:0)?(c[c[i>>2]>>2]|0)==3:0){if((Uf(c[n>>2]|0)|0)!=3){c[j>>2]=65;break}t=Xf(c[n>>2]|0,1,p)|0;c[q>>2]=t;if(!((t|0)!=0&(c[p>>2]|0)!=0)){c[j>>2]=65;break}t=Kj(c[q>>2]|0,c[p>>2]|0)|0;c[(c[i>>2]|0)+16>>2]=t;if(!(c[(c[i>>2]|0)+16>>2]|0)){c[j>>2]=5;break}t=$f(c[n>>2]|0,2,5)|0;c[c[h>>2]>>2]=t;if(!(c[c[h>>2]>>2]|0))c[j>>2]=65;c[(c[i>>2]|0)+32>>2]=5;c[(c[i>>2]|0)+36>>2]=c[c[h>>2]>>2];break}c[j>>2]=70}else c[j>>2]=65;while(0);Rf(c[k>>2]|0);Rf(c[n>>2]|0);Rf(c[o>>2]|0);if(c[j>>2]|0){vf(c[(c[i>>2]|0)+20>>2]|0);c[(c[i>>2]|0)+20>>2]=0}else c[(c[i>>2]|0)+12>>2]=c[s>>2];c[f>>2]=c[j>>2];S=c[f>>2]|0;l=e;return S|0}function Oj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[e>>2];c[h>>2]=c[(c[g>>2]|0)+36>>2];e=nl(c[h>>2]|0,c[f>>2]|0,(c[(c[g>>2]|0)+4>>2]|0)-1|0,c[(c[g>>2]|0)+16>>2]|0,c[(c[g>>2]|0)+28>>2]|0)|0;l=d;return e|0}function Pj(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+16|0;e=b+12|0;f=b+8|0;g=b+4|0;h=b;c[e>>2]=a;c[g>>2]=0;a:while(1){a=c[4504+(c[g>>2]<<2)>>2]|0;c[f>>2]=a;if(!a){i=11;break}a=(sv(c[e>>2]|0,c[(c[f>>2]|0)+12>>2]|0)|0)!=0;j=c[f>>2]|0;if(!a){i=4;break}c[h>>2]=c[j+16>>2];while(1){if(!(c[c[h>>2]>>2]|0))break;if(!(sv(c[e>>2]|0,c[c[h>>2]>>2]|0)|0)){i=8;break a}c[h>>2]=(c[h>>2]|0)+4}c[g>>2]=(c[g>>2]|0)+1}if((i|0)==4){c[d>>2]=j;k=c[d>>2]|0;l=b;return k|0}else if((i|0)==8){c[d>>2]=c[f>>2];k=c[d>>2]|0;l=b;return k|0}else if((i|0)==11){c[d>>2]=0;k=c[d>>2]|0;l=b;return k|0}return 0}function Qj(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=Rj(c[e>>2]|0)|0;if(c[f>>2]|0){c[d>>2]=c[(c[f>>2]|0)+12>>2];g=c[d>>2]|0;l=b;return g|0}else{c[d>>2]=37975;g=c[d>>2]|0;l=b;return g|0}return 0}function Rj(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[e>>2]=Sj(c[e>>2]|0)|0;c[f>>2]=0;while(1){a=c[4504+(c[f>>2]<<2)>>2]|0;c[g>>2]=a;if(!a){h=6;break}if((c[e>>2]|0)==(c[c[g>>2]>>2]|0)){h=4;break}c[f>>2]=(c[f>>2]|0)+1}if((h|0)==4){c[d>>2]=c[g>>2];i=c[d>>2]|0;l=b;return i|0}else if((h|0)==6){c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}return 0}function Sj(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;switch(c[e>>2]|0){case 2:{c[d>>2]=1;break}case 3:{c[d>>2]=1;break}case 16:{c[d>>2]=20;break}case 301:{c[d>>2]=18;break}case 302:{c[d>>2]=18;break}default:c[d>>2]=c[e>>2]}l=b;return c[d>>2]|0}function Tj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[c[f>>2]>>2]=0;c[i>>2]=Uj(c[h>>2]|0,0,j,k)|0;do if(!(c[i>>2]|0))if(c[(c[j>>2]|0)+48>>2]|0){c[i>>2]=ub[c[(c[j>>2]|0)+48>>2]&63](c[f>>2]|0,c[g>>2]|0,c[k>>2]|0)|0;break}else{c[i>>2]=69;break}while(0);Rf(c[k>>2]|0);l=e;return c[i>>2]|0}function Uj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+32|0;h=f+28|0;i=f+24|0;j=f+20|0;k=f+16|0;n=f+12|0;o=f+8|0;p=f+4|0;q=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[c[j>>2]>>2]=0;if(c[k>>2]|0)c[c[k>>2]>>2]=0;c[n>>2]=Tf(c[h>>2]|0,c[i>>2]|0?37977:37989,0)|0;if(!((c[n>>2]|0)!=0|(c[i>>2]|0)!=0))c[n>>2]=Tf(c[h>>2]|0,37977,0)|0;if(!(c[n>>2]|0)){c[g>>2]=65;r=c[g>>2]|0;l=f;return r|0}c[o>>2]=bg(c[n>>2]|0)|0;Rf(c[n>>2]|0);c[n>>2]=c[o>>2];c[p>>2]=_f(c[n>>2]|0,0)|0;if(!(c[p>>2]|0)){Rf(c[n>>2]|0);c[g>>2]=65;r=c[g>>2]|0;l=f;return r|0}c[q>>2]=Pj(c[p>>2]|0)|0;vf(c[p>>2]|0);if(!(c[q>>2]|0)){Rf(c[n>>2]|0);c[g>>2]=4;r=c[g>>2]|0;l=f;return r|0}c[c[j>>2]>>2]=c[q>>2];q=c[n>>2]|0;if(c[k>>2]|0)c[c[k>>2]>>2]=q;else Rf(q);c[g>>2]=0;r=c[g>>2]|0;l=f;return r|0}function Vj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[c[f>>2]>>2]=0;c[i>>2]=Uj(c[h>>2]|0,1,j,k)|0;do if(!(c[i>>2]|0))if(c[(c[j>>2]|0)+52>>2]|0){c[i>>2]=ub[c[(c[j>>2]|0)+52>>2]&63](c[f>>2]|0,c[g>>2]|0,c[k>>2]|0)|0;break}else{c[i>>2]=69;break}while(0);Rf(c[k>>2]|0);l=e;return c[i>>2]|0}function Wj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[c[f>>2]>>2]=0;c[i>>2]=Uj(c[h>>2]|0,1,j,k)|0;do if(!(c[i>>2]|0))if(c[(c[j>>2]|0)+56>>2]|0){c[i>>2]=ub[c[(c[j>>2]|0)+56>>2]&63](c[f>>2]|0,c[g>>2]|0,c[k>>2]|0)|0;break}else{c[i>>2]=69;break}while(0);Rf(c[k>>2]|0);l=e;return c[i>>2]|0}function Xj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=Uj(c[h>>2]|0,0,j,k)|0;do if(!(c[i>>2]|0))if(c[(c[j>>2]|0)+60>>2]|0){c[i>>2]=ub[c[(c[j>>2]|0)+60>>2]&63](c[f>>2]|0,c[g>>2]|0,c[k>>2]|0)|0;break}else{c[i>>2]=69;break}while(0);Rf(c[k>>2]|0);l=e;return c[i>>2]|0}function Yj(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[d>>2]=a;c[e>>2]=Uj(c[d>>2]|0,1,f,g)|0;do if(!(c[e>>2]|0))if(c[(c[f>>2]|0)+44>>2]|0){c[e>>2]=yb[c[(c[f>>2]|0)+44>>2]&15](c[g>>2]|0)|0;break}else{c[e>>2]=69;break}while(0);Rf(c[g>>2]|0);l=b;return c[e>>2]|0}function Zj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+24|0;f=d+20|0;g=d+16|0;h=d+12|0;i=d+8|0;j=d+4|0;k=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=0;c[h>>2]=0;c[i>>2]=0;c[j>>2]=0;c[c[e>>2]>>2]=0;c[h>>2]=Tf(c[f>>2]|0,38e3,0)|0;do if(c[h>>2]|0){c[i>>2]=bg(c[h>>2]|0)|0;Rf(c[h>>2]|0);c[h>>2]=c[i>>2];c[i>>2]=0;if(!(c[h>>2]|0)){c[k>>2]=68;break}c[j>>2]=_f(c[h>>2]|0,0)|0;if(!(c[j>>2]|0)){c[k>>2]=65;break}c[g>>2]=Pj(c[j>>2]|0)|0;vf(c[j>>2]|0);c[j>>2]=0;if(!(c[g>>2]|0)){c[k>>2]=4;break}if(c[(c[g>>2]|0)+40>>2]|0){c[k>>2]=Db[c[(c[g>>2]|0)+40>>2]&7](c[h>>2]|0,c[e>>2]|0)|0;break}else{c[k>>2]=69;break}}else c[k>>2]=65;while(0);Rf(c[h>>2]|0);vf(c[j>>2]|0);Rf(c[i>>2]|0);l=d;return c[k>>2]|0}function _j(){return 0}function $j(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+16|0;h=f+12|0;i=f+8|0;j=f+4|0;k=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[g>>2]=Sj(c[g>>2]|0)|0;c[k>>2]=Rj(c[g>>2]|0)|0;if((c[k>>2]|0?(a[(c[k>>2]|0)+4>>0]&1|0)==0:0)?c[(c[k>>2]|0)+68>>2]|0:0){c[j>>2]=ub[c[(c[k>>2]|0)+68>>2]&63](c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0;n=c[j>>2]|0;o=ak(n)|0;l=f;return o|0}c[j>>2]=4;if(!(c[i>>2]|0)){n=c[j>>2]|0;o=ak(n)|0;l=f;return o|0}h=c[i>>2]|0;i=c[g>>2]|0;if(c[k>>2]|0?!(a[(c[k>>2]|0)+4>>0]&1|0):0)p=38046;else p=c[k>>2]|0?38007:38026;Eb[h&1](47252,i,38068,p);n=c[j>>2]|0;o=ak(n)|0;l=f;return o|0}function ak(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=bk(1,c[d>>2]|0)|0;l=b;return a|0}function bk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function ck(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];f=tk(c[i>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return f|0}function dk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];if(c[(c[i>>2]|0)+496>>2]|0)Ab[c[(c[i>>2]|0)+496>>2]&3]();f=ub[c[(c[i>>2]|0)+488>>2]&63](c[i>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return f|0}function ek(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];nk(c[i>>2]|0);if(c[(c[i>>2]|0)+500>>2]|0)Ab[c[(c[i>>2]|0)+500>>2]&3]();f=ub[c[(c[i>>2]|0)+492>>2]&63](c[i>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return f|0}function fk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;switch(c[f>>2]|0){case 7:{c[i>>2]=gk(c[g>>2]|0,c[h>>2]|0)|0;break}case 8:{c[i>>2]=hk(c[g>>2]|0,c[h>>2]|0)|0;break}case 9:{c[i>>2]=ik(c[g>>2]|0,c[h>>2]|0)|0;break}default:c[i>>2]=12}l=e;return c[i>>2]|0}function gk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=47242;c[i>>2]=lk()|0;do if(!(c[i>>2]|0)){if(c[f>>2]|0){c[h>>2]=38334;c[i>>2]=mk(2)|0;if(c[i>>2]|0)break;c[h>>2]=38338;c[i>>2]=mk(5)|0;if(c[i>>2]|0)break}c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}while(0);if(c[g>>2]|0)Eb[c[g>>2]&1](38079,7,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;j=c[e>>2]|0;l=d;return j|0}function hk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+8|0;g=d+4|0;h=d;c[d+12>>2]=a;c[f>>2]=b;c[g>>2]=47242;c[h>>2]=kk()|0;if(!(c[h>>2]|0)){c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}if(c[f>>2]|0)Eb[c[f>>2]&1](38079,8,c[g>>2]|0,c[h>>2]|0);c[e>>2]=50;i=c[e>>2]|0;l=d;return i|0}function ik(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+8|0;g=d+4|0;h=d;c[d+12>>2]=a;c[f>>2]=b;c[g>>2]=47242;c[h>>2]=jk()|0;if(!(c[h>>2]|0)){c[e>>2]=0;i=c[e>>2]|0;l=d;return i|0}if(c[f>>2]|0)Eb[c[f>>2]&1](38079,9,c[g>>2]|0,c[h>>2]|0);c[e>>2]=50;i=c[e>>2]|0;l=d;return i|0}function jk(){var a=0,b=0,d=0,e=0;a=l;l=l+528|0;if((l|0)>=(m|0))$(528);b=a+504|0;d=a;e=a+512|0;ck(d,38086,32)|0;dk(d,e,38118)|0;do if(!(Jv(e,38134,16)|0)){ek(d,e,e)|0;if(Jv(e,38118,16)|0){c[b>>2]=38182;break}else{c[b>>2]=0;break}}else c[b>>2]=38150;while(0);l=a;return c[b>>2]|0}function kk(){var a=0,b=0,d=0,e=0;a=l;l=l+528|0;if((l|0)>=(m|0))$(528);b=a+504|0;d=a;e=a+512|0;ck(d,38214,24)|0;dk(d,e,38238)|0;do if(!(Jv(e,38254,16)|0)){ek(d,e,e)|0;if(Jv(e,38238,16)|0){c[b>>2]=38302;break}else{c[b>>2]=0;break}}else c[b>>2]=38270;while(0);l=a;return c[b>>2]|0}function lk(){var a=0,b=0,d=0,e=0;a=l;l=l+528|0;if((l|0)>=(m|0))$(528);b=a+504|0;d=a;e=a+512|0;ck(d,38455,16)|0;dk(d,e,38471)|0;do if(!(Jv(e,38487,16)|0)){ek(d,e,e)|0;if(Jv(e,38471,16)|0){c[b>>2]=38535;break}else{c[b>>2]=0;break}}else c[b>>2]=38503;while(0);l=a;return c[b>>2]|0}function mk(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;b=l;l=l+48|0;if((l|0)>=(m|0))$(48);d=b+24|0;e=b+20|0;f=b+32|0;g=b+16|0;h=b+12|0;i=b+8|0;j=b+4|0;k=b;c[e>>2]=a;c[j>>2]=0;c[k>>2]=0;c[h>>2]=0;while(1){if((c[h>>2]|0)>>>0>=2)break;if((c[4636+((c[h>>2]|0)*164|0)>>2]|0)==(c[e>>2]|0))break;c[h>>2]=(c[h>>2]|0)+1}if((c[h>>2]|0)==2){Bh(c[j>>2]|0);Bh(c[k>>2]|0);c[d>>2]=38342;n=c[d>>2]|0;l=b;return n|0}c[g>>2]=wh(j,7,c[4636+((c[h>>2]|0)*164|0)>>2]|0,0)|0;if(c[g>>2]|0){Bh(c[j>>2]|0);Bh(c[k>>2]|0);c[d>>2]=38369;n=c[d>>2]|0;l=b;return n|0}c[g>>2]=wh(k,7,c[4636+((c[h>>2]|0)*164|0)>>2]|0,0)|0;e=c[j>>2]|0;if(c[g>>2]|0){Bh(e);Bh(c[k>>2]|0);c[d>>2]=38369;n=c[d>>2]|0;l=b;return n|0}c[g>>2]=Jh(e,4636+((c[h>>2]|0)*164|0)+4|0,16)|0;if(!(c[g>>2]|0))c[g>>2]=Jh(c[k>>2]|0,4636+((c[h>>2]|0)*164|0)+4|0,16)|0;e=c[j>>2]|0;if(c[g>>2]|0){Bh(e);Bh(c[k>>2]|0);c[d>>2]=38374;n=c[d>>2]|0;l=b;return n|0}c[g>>2]=Lh(e,4636+((c[h>>2]|0)*164|0)+20|0,16)|0;if(!(c[g>>2]|0))c[g>>2]=Lh(c[k>>2]|0,4636+((c[h>>2]|0)*164|0)+20|0,16)|0;if(c[g>>2]|0){Bh(c[j>>2]|0);Bh(c[k>>2]|0);c[d>>2]=38382;n=c[d>>2]|0;l=b;return n|0}c[i>>2]=0;while(1){o=c[j>>2]|0;if((c[i>>2]|0)>>>0>=4){p=30;break}c[g>>2]=Ch(o,f,16,4636+((c[h>>2]|0)*164|0)+36+(c[i>>2]<<5)|0,16)|0;if(c[g>>2]|0){p=22;break}if(Jv(f,4636+((c[h>>2]|0)*164|0)+36+(c[i>>2]<<5)+16|0,16)|0){p=24;break}c[g>>2]=Gh(c[k>>2]|0,f,16,4636+((c[h>>2]|0)*164|0)+36+(c[i>>2]<<5)+16|0,16)|0;if(c[g>>2]|0){p=26;break}if(Jv(f,4636+((c[h>>2]|0)*164|0)+36+(c[i>>2]<<5)|0,16)|0){p=28;break}c[i>>2]=(c[i>>2]|0)+1}if((p|0)==22){Bh(c[j>>2]|0);Bh(c[k>>2]|0);c[d>>2]=38389;n=c[d>>2]|0;l=b;return n|0}else if((p|0)==24){Bh(c[j>>2]|0);Bh(c[k>>2]|0);c[d>>2]=38405;n=c[d>>2]|0;l=b;return n|0}else if((p|0)==26){Bh(c[j>>2]|0);Bh(c[k>>2]|0);c[d>>2]=38422;n=c[d>>2]|0;l=b;return n|0}else if((p|0)==28){Bh(c[j>>2]|0);Bh(c[k>>2]|0);c[d>>2]=38438;n=c[d>>2]|0;l=b;return n|0}else if((p|0)==30){Bh(o);Bh(c[k>>2]|0);c[d>>2]=0;n=c[d>>2]|0;l=b;return n|0}return 0}function nk(b){b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;if(a[(c[e>>2]|0)+484>>0]&1|0){l=d;return}ok(c[e>>2]|0);b=(c[e>>2]|0)+484|0;a[b>>0]=a[b>>0]&-2|1;l=d;return}function ok(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=b+20|0;f=b+16|0;g=b+12|0;h=b+8|0;i=b+4|0;j=b;c[e>>2]=a;c[g>>2]=4965;pk();qk();c[(c[e>>2]|0)+240>>2]=c[c[e>>2]>>2];c[(c[e>>2]|0)+240+4>>2]=c[(c[e>>2]|0)+4>>2];c[(c[e>>2]|0)+240+8>>2]=c[(c[e>>2]|0)+8>>2];c[(c[e>>2]|0)+240+12>>2]=c[(c[e>>2]|0)+12>>2];c[f>>2]=1;while(1){k=(c[e>>2]|0)+(c[f>>2]<<4)|0;if((c[f>>2]|0)>=(c[(c[e>>2]|0)+480>>2]|0))break;c[h>>2]=k;c[i>>2]=(c[e>>2]|0)+240+(c[f>>2]<<4);c[j>>2]=c[c[h>>2]>>2];a=rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>0&255)<<2)>>0]|0)<<2)>>2]|0,0)|0;n=a^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>8&255)<<2)>>0]|0)<<2)>>2]|0,8)|0);a=n^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>16&255)<<2)>>0]|0)<<2)>>2]|0,16)|0);n=a^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>24&255)<<2)>>0]|0)<<2)>>2]|0,24)|0);c[c[i>>2]>>2]=n;c[j>>2]=c[(c[h>>2]|0)+4>>2];n=rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>0&255)<<2)>>0]|0)<<2)>>2]|0,0)|0;a=n^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>8&255)<<2)>>0]|0)<<2)>>2]|0,8)|0);n=a^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>16&255)<<2)>>0]|0)<<2)>>2]|0,16)|0);a=n^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>24&255)<<2)>>0]|0)<<2)>>2]|0,24)|0);c[(c[i>>2]|0)+4>>2]=a;c[j>>2]=c[(c[h>>2]|0)+8>>2];a=rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>0&255)<<2)>>0]|0)<<2)>>2]|0,0)|0;n=a^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>8&255)<<2)>>0]|0)<<2)>>2]|0,8)|0);a=n^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>16&255)<<2)>>0]|0)<<2)>>2]|0,16)|0);n=a^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>24&255)<<2)>>0]|0)<<2)>>2]|0,24)|0);c[(c[i>>2]|0)+8>>2]=n;c[j>>2]=c[(c[h>>2]|0)+12>>2];n=rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>0&255)<<2)>>0]|0)<<2)>>2]|0,0)|0;a=n^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>8&255)<<2)>>0]|0)<<2)>>2]|0,8)|0);n=a^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>16&255)<<2)>>0]|0)<<2)>>2]|0,16)|0);a=n^(rk(c[5988+((d[(c[g>>2]|0)+(((c[j>>2]|0)>>>24&255)<<2)>>0]|0)<<2)>>2]|0,24)|0);c[(c[i>>2]|0)+12>>2]=a;c[f>>2]=(c[f>>2]|0)+1}c[(c[e>>2]|0)+240+(c[f>>2]<<4)>>2]=c[k>>2];c[(c[e>>2]|0)+240+(c[f>>2]<<4)+4>>2]=c[(c[e>>2]|0)+(c[f>>2]<<4)+4>>2];c[(c[e>>2]|0)+240+(c[f>>2]<<4)+8>>2]=c[(c[e>>2]|0)+(c[f>>2]<<4)+8>>2];c[(c[e>>2]|0)+240+(c[f>>2]<<4)+12>>2]=c[(c[e>>2]|0)+(c[f>>2]<<4)+12>>2];l=b;return}function pk(){sk(4964,1024);return}function qk(){sk(5988,1280);return}function rk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return c[e>>2]<<(c[f>>2]&31)|(c[e>>2]|0)>>>(32-(c[f>>2]|0)&31)|0}function sk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[d+8>>2]=a;c[e>>2]=b;c[f>>2]=0;while(1){if((c[f>>2]|0)>>>0>=(c[e>>2]|0)>>>0)break;c[f>>2]=(c[f>>2]|0)+256}l=d;return}function tk(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;g=l;l=l+144|0;if((l|0)>=(m|0))$(144);h=g+72|0;i=g+132|0;j=g+128|0;k=g+124|0;n=g+120|0;o=g+116|0;p=g+112|0;q=g+108|0;r=g+104|0;s=g+100|0;t=g+96|0;u=g+92|0;v=g+88|0;w=g+8|0;x=g+84|0;y=g+80|0;z=g+136|0;A=g;B=g+76|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[t>>2]=0;f=(Wg()|0)!=0;if(!(f|(c[17738]|0)!=0)?(c[17738]=1,c[17739]=uk()|0,c[17739]|0):0){c[h>>2]=c[17739];Ve(43492,h)}if(c[17739]|0){c[i>>2]=50;C=c[i>>2]|0;l=g;return C|0}do if((c[n>>2]|0)==16){c[o>>2]=10;c[u>>2]=4}else{if((c[n>>2]|0)==24){c[o>>2]=12;c[u>>2]=6;break}if((c[n>>2]|0)==32){c[o>>2]=14;c[u>>2]=8;break}c[i>>2]=44;C=c[i>>2]|0;l=g;return C|0}while(0);c[(c[j>>2]|0)+480>>2]=c[o>>2];h=(c[j>>2]|0)+484|0;a[h>>0]=a[h>>0]&-2;c[(c[j>>2]|0)+488>>2]=29;c[(c[j>>2]|0)+492>>2]=30;c[(c[j>>2]|0)+496>>2]=1;c[(c[j>>2]|0)+500>>2]=2;c[v>>2]=4965;pk();c[p>>2]=0;while(1){if((c[p>>2]|0)>>>0>=(c[n>>2]|0)>>>0)break;a[w+(c[p>>2]>>2<<2)+(c[p>>2]&3)>>0]=a[(c[k>>2]|0)+(c[p>>2]|0)>>0]|0;c[p>>2]=(c[p>>2]|0)+1}c[q>>2]=(c[u>>2]|0)-1;while(1){if((c[q>>2]|0)<0)break;c[w+32+(c[q>>2]<<2)>>2]=c[w+(c[q>>2]<<2)>>2];c[q>>2]=(c[q>>2]|0)+-1}c[r>>2]=0;c[s>>2]=0;c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[u>>2]|0))break;if((c[r>>2]|0)>=((c[o>>2]|0)+1|0))break;while(1){if(!((c[q>>2]|0)<(c[u>>2]|0)?(c[s>>2]|0)<4:0))break;c[(c[j>>2]|0)+(c[r>>2]<<4)+(c[s>>2]<<2)>>2]=c[w+32+(c[q>>2]<<2)>>2];c[q>>2]=(c[q>>2]|0)+1;c[s>>2]=(c[s>>2]|0)+1}if((c[s>>2]|0)!=4)continue;c[r>>2]=(c[r>>2]|0)+1;c[s>>2]=0}a:while(1){if((c[r>>2]|0)>=((c[o>>2]|0)+1|0))break;p=w+32|0;a[p>>0]=(d[p>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+((c[u>>2]|0)-1<<2)+1>>0]|0)<<2)>>0]|0);p=w+32+1|0;a[p>>0]=(d[p>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+((c[u>>2]|0)-1<<2)+2>>0]|0)<<2)>>0]|0);p=w+32+2|0;a[p>>0]=(d[p>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+((c[u>>2]|0)-1<<2)+3>>0]|0)<<2)>>0]|0);p=w+32+3|0;a[p>>0]=(d[p>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+((c[u>>2]|0)-1<<2)>>0]|0)<<2)>>0]|0);p=c[t>>2]|0;c[t>>2]=p+1;k=w+32|0;a[k>>0]=(d[k>>0]|0)^c[7268+(p<<2)>>2];p=(c[u>>2]|0)!=8;c[q>>2]=1;b:do if(p)while(1){if((c[q>>2]|0)>=(c[u>>2]|0))break b;k=w+32+(c[q>>2]<<2)|0;c[k>>2]=c[k>>2]^c[w+32+((c[q>>2]|0)-1<<2)>>2];c[q>>2]=(c[q>>2]|0)+1}else{while(1){if((c[q>>2]|0)>=((c[u>>2]|0)/2|0|0))break;k=w+32+(c[q>>2]<<2)|0;c[k>>2]=c[k>>2]^c[w+32+((c[q>>2]|0)-1<<2)>>2];c[q>>2]=(c[q>>2]|0)+1}k=w+32+(((c[u>>2]|0)/2|0)<<2)|0;a[k>>0]=(d[k>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+(((c[u>>2]|0)/2|0)-1<<2)>>0]|0)<<2)>>0]|0);k=w+32+(((c[u>>2]|0)/2|0)<<2)+1|0;a[k>>0]=(d[k>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+(((c[u>>2]|0)/2|0)-1<<2)+1>>0]|0)<<2)>>0]|0);k=w+32+(((c[u>>2]|0)/2|0)<<2)+2|0;a[k>>0]=(d[k>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+(((c[u>>2]|0)/2|0)-1<<2)+2>>0]|0)<<2)>>0]|0);k=w+32+(((c[u>>2]|0)/2|0)<<2)+3|0;a[k>>0]=(d[k>>0]|0)^(d[(c[v>>2]|0)+((d[w+32+(((c[u>>2]|0)/2|0)-1<<2)+3>>0]|0)<<2)>>0]|0);c[q>>2]=((c[u>>2]|0)/2|0)+1;while(1){if((c[q>>2]|0)>=(c[u>>2]|0))break b;k=w+32+(c[q>>2]<<2)|0;c[k>>2]=c[k>>2]^c[w+32+((c[q>>2]|0)-1<<2)>>2];c[q>>2]=(c[q>>2]|0)+1}}while(0);c[q>>2]=0;while(1){if((c[q>>2]|0)>=(c[u>>2]|0))continue a;if((c[r>>2]|0)>=((c[o>>2]|0)+1|0))continue a;while(1){if(!((c[q>>2]|0)<(c[u>>2]|0)?(c[s>>2]|0)<4:0))break;c[(c[j>>2]|0)+(c[r>>2]<<4)+(c[s>>2]<<2)>>2]=c[w+32+(c[q>>2]<<2)>>2];c[q>>2]=(c[q>>2]|0)+1;c[s>>2]=(c[s>>2]|0)+1}if((c[s>>2]|0)!=4)continue;c[r>>2]=(c[r>>2]|0)+1;c[s>>2]=0}}c[x>>2]=w;c[y>>2]=64;a[z>>0]=0;w=A;c[w>>2]=d[z>>0];c[w+4>>2]=0;while(1){if(!(c[x>>2]&7|0?(c[y>>2]|0)!=0:0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}if((c[y>>2]|0)>>>0>=8){w=A;s=gx(c[w>>2]|0,c[w+4>>2]|0,16843009,16843009)|0;w=A;c[w>>2]=s;c[w+4>>2]=D;do{c[B>>2]=c[x>>2];w=A;s=c[w+4>>2]|0;r=c[B>>2]|0;c[r>>2]=c[w>>2];c[r+4>>2]=s;c[y>>2]=(c[y>>2]|0)-8;c[x>>2]=(c[x>>2]|0)+8}while((c[y>>2]|0)>>>0>=8)}while(1){if(!(c[y>>2]|0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}c[i>>2]=0;C=c[i>>2]|0;l=g;return C|0}function uk(){var a=0,b=0,d=0,e=0,f=0,g=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a+4|0;d=a;e=lk()|0;c[d>>2]=e;do if((!(e|0)?(f=kk()|0,c[d>>2]=f,!(f|0)):0)?(f=jk()|0,c[d>>2]=f,!(f|0)):0){f=Bk()|0;c[d>>2]=f;if(f|0){c[b>>2]=c[d>>2];break}f=Ck()|0;c[d>>2]=f;if(f|0){c[b>>2]=c[d>>2];break}else{c[d>>2]=Dk()|0;c[b>>2]=c[d>>2];break}}else g=4;while(0);if((g|0)==4)c[b>>2]=c[d>>2];l=a;return c[b>>2]|0}function vk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=Ak(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function wk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;d=xk(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;l=e;return d|0}function xk(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+64|0;if((l|0)>=(m|0))$(64);g=f+48|0;h=f+44|0;i=f+40|0;j=f+36|0;k=f+32|0;n=f+16|0;o=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=e;c[j>>2]=c[(c[g>>2]|0)+480>>2];c[o>>2]=yk(c[i>>2]|0)|0;c[o+4>>2]=yk((c[i>>2]|0)+4|0)|0;c[o+8>>2]=yk((c[i>>2]|0)+8|0)|0;c[o+12>>2]=yk((c[i>>2]|0)+12|0)|0;c[n>>2]=c[o>>2]^c[(c[g>>2]|0)+240+(c[j>>2]<<4)>>2];c[n+4>>2]=c[o+4>>2]^c[(c[g>>2]|0)+240+(c[j>>2]<<4)+4>>2];c[n+8>>2]=c[o+8>>2]^c[(c[g>>2]|0)+240+(c[j>>2]<<4)+8>>2];c[n+12>>2]=c[o+12>>2]^c[(c[g>>2]|0)+240+(c[j>>2]<<4)+12>>2];c[k>>2]=(c[j>>2]|0)-1;while(1){j=(c[k>>2]|0)>1;c[o>>2]=rk(c[5988+(((c[n>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;c[o+4>>2]=rk(c[5988+(((c[n>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[o+8>>2]=rk(c[5988+(((c[n>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[o+12>>2]=rk(c[5988+(((c[n>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;if(!j)break;c[n>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)>>2]^c[o>>2];j=rk(c[5988+(((c[n+4>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;i=o+4|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+4>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;i=o+8|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+4>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;i=o+12|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+4>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[n>>2]=c[n>>2]^j;c[n+4>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)+4>>2]^c[o+4>>2];j=rk(c[5988+(((c[n+8>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;i=o+8|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+8>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;i=o+12|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+8>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[n>>2]=c[n>>2]^j;j=rk(c[5988+(((c[n+8>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;i=n+4|0;c[i>>2]=c[i>>2]^j;c[n+8>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)+8>>2]^c[o+8>>2];j=rk(c[5988+(((c[n+12>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;i=o+12|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+12>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[n>>2]=c[n>>2]^j;j=rk(c[5988+(((c[n+12>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;i=n+4|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+12>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;i=n+8|0;c[i>>2]=c[i>>2]^j;c[n+12>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)+12>>2]^c[o+12>>2];c[k>>2]=(c[k>>2]|0)+-1;c[o>>2]=rk(c[5988+(((c[n>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;c[o+4>>2]=rk(c[5988+(((c[n>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[o+8>>2]=rk(c[5988+(((c[n>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[o+12>>2]=rk(c[5988+(((c[n>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[n>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)>>2]^c[o>>2];j=rk(c[5988+(((c[n+4>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;i=o+4|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+4>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;i=o+8|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+4>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;i=o+12|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+4>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[n>>2]=c[n>>2]^j;c[n+4>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)+4>>2]^c[o+4>>2];j=rk(c[5988+(((c[n+8>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;i=o+8|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+8>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;i=o+12|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+8>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[n>>2]=c[n>>2]^j;j=rk(c[5988+(((c[n+8>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;i=n+4|0;c[i>>2]=c[i>>2]^j;c[n+8>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)+8>>2]^c[o+8>>2];j=rk(c[5988+(((c[n+12>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;i=o+12|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+12>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[n>>2]=c[n>>2]^j;j=rk(c[5988+(((c[n+12>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;i=n+4|0;c[i>>2]=c[i>>2]^j;j=rk(c[5988+(((c[n+12>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;i=n+8|0;c[i>>2]=c[i>>2]^j;c[n+12>>2]=c[(c[g>>2]|0)+240+(c[k>>2]<<4)+12>>2]^c[o+12>>2];c[k>>2]=(c[k>>2]|0)+-1}c[n>>2]=c[(c[g>>2]|0)+240+16>>2]^c[o>>2];k=rk(c[5988+(((c[n+4>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;j=o+4|0;c[j>>2]=c[j>>2]^k;k=rk(c[5988+(((c[n+4>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;j=o+8|0;c[j>>2]=c[j>>2]^k;k=rk(c[5988+(((c[n+4>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;j=o+12|0;c[j>>2]=c[j>>2]^k;k=rk(c[5988+(((c[n+4>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[n>>2]=c[n>>2]^k;c[n+4>>2]=c[(c[g>>2]|0)+240+16+4>>2]^c[o+4>>2];k=rk(c[5988+(((c[n+8>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;j=o+8|0;c[j>>2]=c[j>>2]^k;k=rk(c[5988+(((c[n+8>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;j=o+12|0;c[j>>2]=c[j>>2]^k;k=rk(c[5988+(((c[n+8>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[n>>2]=c[n>>2]^k;k=rk(c[5988+(((c[n+8>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;j=n+4|0;c[j>>2]=c[j>>2]^k;c[n+8>>2]=c[(c[g>>2]|0)+240+16+8>>2]^c[o+8>>2];k=rk(c[5988+(((c[n+12>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;j=o+12|0;c[j>>2]=c[j>>2]^k;k=rk(c[5988+(((c[n+12>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[n>>2]=c[n>>2]^k;k=rk(c[5988+(((c[n+12>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;j=n+4|0;c[j>>2]=c[j>>2]^k;k=rk(c[5988+(((c[n+12>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;j=n+8|0;c[j>>2]=c[j>>2]^k;c[n+12>>2]=c[(c[g>>2]|0)+240+16+12>>2]^c[o+12>>2];c[o>>2]=(d[7012+((c[n>>2]|0)>>>0&255)>>0]|0)<<0;c[o+4>>2]=(d[7012+((c[n>>2]|0)>>>8&255)>>0]|0)<<8;c[o+8>>2]=(d[7012+((c[n>>2]|0)>>>16&255)>>0]|0)<<16;c[o+12>>2]=(d[7012+((c[n>>2]|0)>>>24&255)>>0]|0)<<24;c[n>>2]=c[o>>2]^c[(c[g>>2]|0)+240>>2];k=o+4|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+4>>2]|0)>>>0&255)>>0]|0)<<0;k=o+8|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+4>>2]|0)>>>8&255)>>0]|0)<<8;k=o+12|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+4>>2]|0)>>>16&255)>>0]|0)<<16;c[n>>2]=c[n>>2]^(d[7012+((c[n+4>>2]|0)>>>24&255)>>0]|0)<<24;c[n+4>>2]=c[o+4>>2]^c[(c[g>>2]|0)+240+4>>2];k=o+8|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+8>>2]|0)>>>0&255)>>0]|0)<<0;k=o+12|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+8>>2]|0)>>>8&255)>>0]|0)<<8;c[n>>2]=c[n>>2]^(d[7012+((c[n+8>>2]|0)>>>16&255)>>0]|0)<<16;k=n+4|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+8>>2]|0)>>>24&255)>>0]|0)<<24;c[n+8>>2]=c[o+8>>2]^c[(c[g>>2]|0)+240+8>>2];k=o+12|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+12>>2]|0)>>>0&255)>>0]|0)<<0;c[n>>2]=c[n>>2]^(d[7012+((c[n+12>>2]|0)>>>8&255)>>0]|0)<<8;k=n+4|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+12>>2]|0)>>>16&255)>>0]|0)<<16;k=n+8|0;c[k>>2]=c[k>>2]^(d[7012+((c[n+12>>2]|0)>>>24&255)>>0]|0)<<24;c[n+12>>2]=c[o+12>>2]^c[(c[g>>2]|0)+240+12>>2];zk(c[h>>2]|0,c[n>>2]|0);zk((c[h>>2]|0)+4|0,c[n+4>>2]|0);zk((c[h>>2]|0)+8|0,c[n+8>>2]|0);zk((c[h>>2]|0)+12|0,c[n+12>>2]|0);l=f;return 64}function yk(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];l=b;return (d[(c[f>>2]|0)+3>>0]|0)<<24|(d[(c[f>>2]|0)+2>>0]|0)<<16|(d[(c[f>>2]|0)+1>>0]|0)<<8|(d[c[f>>2]>>0]|0)|0}function zk(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];a[(c[h>>2]|0)+3>>0]=(c[g>>2]|0)>>>24;a[(c[h>>2]|0)+2>>0]=(c[g>>2]|0)>>>16;a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)>>>8;a[c[h>>2]>>0]=c[g>>2];l=e;return}function Ak(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;f=l;l=l+64|0;if((l|0)>=(m|0))$(64);g=f+52|0;h=f+48|0;i=f+44|0;j=f+40|0;k=f+36|0;n=f+32|0;o=f+16|0;p=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=e;c[j>>2]=4965;c[k>>2]=c[(c[g>>2]|0)+480>>2];c[p>>2]=yk(c[i>>2]|0)|0;c[p+4>>2]=yk((c[i>>2]|0)+4|0)|0;c[p+8>>2]=yk((c[i>>2]|0)+8|0)|0;c[p+12>>2]=yk((c[i>>2]|0)+12|0)|0;c[o>>2]=c[p>>2]^c[c[g>>2]>>2];c[o+4>>2]=c[p+4>>2]^c[(c[g>>2]|0)+4>>2];c[o+8>>2]=c[p+8>>2]^c[(c[g>>2]|0)+8>>2];c[o+12>>2]=c[p+12>>2]^c[(c[g>>2]|0)+12>>2];c[p>>2]=rk(c[4964+(((c[o>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;c[p+12>>2]=rk(c[4964+(((c[o>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[p+8>>2]=rk(c[4964+(((c[o>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[p+4>>2]=rk(c[4964+(((c[o>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[o>>2]=c[(c[g>>2]|0)+16>>2]^c[p>>2];i=rk(c[4964+(((c[o+4>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[o>>2]=c[o>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;e=p+8|0;c[e>>2]=c[e>>2]^i;c[o+4>>2]=c[(c[g>>2]|0)+16+4>>2]^c[p+4>>2];i=rk(c[4964+(((c[o+8>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+8|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;e=o+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[o>>2]=c[o>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;c[o+8>>2]=c[(c[g>>2]|0)+16+8>>2]^c[p+8>>2];i=rk(c[4964+(((c[o+12>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;e=o+8|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;e=o+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[o>>2]=c[o>>2]^i;c[o+12>>2]=c[(c[g>>2]|0)+16+12>>2]^c[p+12>>2];c[n>>2]=2;while(1){q=(c[o>>2]|0)>>>0&255;if((c[n>>2]|0)>=(c[k>>2]|0))break;c[p>>2]=rk(c[4964+(q<<2)>>2]|0,0)|0;c[p+12>>2]=rk(c[4964+(((c[o>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[p+8>>2]=rk(c[4964+(((c[o>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[p+4>>2]=rk(c[4964+(((c[o>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[o>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)>>2]^c[p>>2];i=rk(c[4964+(((c[o+4>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[o>>2]=c[o>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;e=p+8|0;c[e>>2]=c[e>>2]^i;c[o+4>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+4>>2]^c[p+4>>2];i=rk(c[4964+(((c[o+8>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+8|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;e=o+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[o>>2]=c[o>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;c[o+8>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+8>>2]^c[p+8>>2];i=rk(c[4964+(((c[o+12>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;e=o+8|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;e=o+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[o>>2]=c[o>>2]^i;c[o+12>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+12>>2]^c[p+12>>2];c[n>>2]=(c[n>>2]|0)+1;c[p>>2]=rk(c[4964+(((c[o>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;c[p+12>>2]=rk(c[4964+(((c[o>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[p+8>>2]=rk(c[4964+(((c[o>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[p+4>>2]=rk(c[4964+(((c[o>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[o>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)>>2]^c[p>>2];i=rk(c[4964+(((c[o+4>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;c[o>>2]=c[o>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+4>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;e=p+8|0;c[e>>2]=c[e>>2]^i;c[o+4>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+4>>2]^c[p+4>>2];i=rk(c[4964+(((c[o+8>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+8|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;e=o+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;c[o>>2]=c[o>>2]^i;i=rk(c[4964+(((c[o+8>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;c[o+8>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+8>>2]^c[p+8>>2];i=rk(c[4964+(((c[o+12>>2]|0)>>>0&255)<<2)>>2]|0,0)|0;e=p+12|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>8&255)<<2)>>2]|0,8)|0;e=o+8|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>16&255)<<2)>>2]|0,16)|0;e=o+4|0;c[e>>2]=c[e>>2]^i;i=rk(c[4964+(((c[o+12>>2]|0)>>>24&255)<<2)>>2]|0,24)|0;c[o>>2]=c[o>>2]^i;c[o+12>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+12>>2]^c[p+12>>2];c[n>>2]=(c[n>>2]|0)+1}c[p>>2]=(d[(c[j>>2]|0)+(q<<2)>>0]|0)<<0;c[p+12>>2]=(d[(c[j>>2]|0)+(((c[o>>2]|0)>>>8&255)<<2)>>0]|0)<<8;c[p+8>>2]=(d[(c[j>>2]|0)+(((c[o>>2]|0)>>>16&255)<<2)>>0]|0)<<16;c[p+4>>2]=(d[(c[j>>2]|0)+(((c[o>>2]|0)>>>24&255)<<2)>>0]|0)<<24;c[o>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)>>2]^c[p>>2];q=p+4|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+4>>2]|0)>>>0&255)<<2)>>0]|0)<<0;c[o>>2]=c[o>>2]^(d[(c[j>>2]|0)+(((c[o+4>>2]|0)>>>8&255)<<2)>>0]|0)<<8;q=p+12|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+4>>2]|0)>>>16&255)<<2)>>0]|0)<<16;q=p+8|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+4>>2]|0)>>>24&255)<<2)>>0]|0)<<24;c[o+4>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+4>>2]^c[p+4>>2];q=p+8|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+8>>2]|0)>>>0&255)<<2)>>0]|0)<<0;q=o+4|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+8>>2]|0)>>>8&255)<<2)>>0]|0)<<8;c[o>>2]=c[o>>2]^(d[(c[j>>2]|0)+(((c[o+8>>2]|0)>>>16&255)<<2)>>0]|0)<<16;q=p+12|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+8>>2]|0)>>>24&255)<<2)>>0]|0)<<24;c[o+8>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+8>>2]^c[p+8>>2];q=p+12|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+12>>2]|0)>>>0&255)<<2)>>0]|0)<<0;q=o+8|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+12>>2]|0)>>>8&255)<<2)>>0]|0)<<8;q=o+4|0;c[q>>2]=c[q>>2]^(d[(c[j>>2]|0)+(((c[o+12>>2]|0)>>>16&255)<<2)>>0]|0)<<16;c[o>>2]=c[o>>2]^(d[(c[j>>2]|0)+(((c[o+12>>2]|0)>>>24&255)<<2)>>0]|0)<<24;c[o+12>>2]=c[(c[g>>2]|0)+(c[n>>2]<<4)+12>>2]^c[p+12>>2];zk(c[h>>2]|0,c[o>>2]|0);zk((c[h>>2]|0)+4|0,c[o+4>>2]|0);zk((c[h>>2]|0)+8|0,c[o+8>>2]|0);zk((c[h>>2]|0)+12|0,c[o+12>>2]|0);l=f;return 64}function Bk(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[a+8>>2]=9;c[a+4>>2]=16;c[a>>2]=504;b=wr(38075,1,2,4,9,16,504)|0;l=a;return b|0}function Ck(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[a+8>>2]=10;c[a+4>>2]=16;c[a>>2]=504;b=sr(38075,1,2,3,10,16,504)|0;l=a;return b|0}function Dk(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[a+8>>2]=10;c[a+4>>2]=16;c[a>>2]=504;b=ur(38075,1,2,2,10,16,504)|0;l=a;return b|0}function Ek(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;n=g+20|0;o=g+16|0;p=g+12|0;q=g+8|0;r=g+4|0;s=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=c[h>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[r>>2]=0;if(c[(c[o>>2]|0)+496>>2]|0)Ab[c[(c[o>>2]|0)+496>>2]&3]();c[s>>2]=c[(c[o>>2]|0)+488>>2];while(1){if(!(c[n>>2]|0))break;c[r>>2]=ub[c[s>>2]&63](c[o>>2]|0,c[i>>2]|0,c[i>>2]|0)|0;Fk(c[p>>2]|0,c[i>>2]|0,c[q>>2]|0,16);c[p>>2]=(c[p>>2]|0)+16;c[q>>2]=(c[q>>2]|0)+16;c[n>>2]=(c[n>>2]|0)+-1}if(!(c[r>>2]|0)){l=g;return}bf((c[r>>2]|0)+16|0);cf();l=g;return}function Fk(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;Gk(c[g>>2]|0,c[i>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}function Gk(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+24|0;u=i+60|0;v=i+20|0;w=i+16|0;x=i+12|0;y=i+8|0;z=i+4|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[k>>2];c[t>>2]=c[o>>2];c[i>>2]=3;if(!((c[t>>2]|c[s>>2]|c[q>>2]|c[r>>2])&3)){c[v>>2]=c[q>>2];c[y>>2]=c[s>>2];c[w>>2]=c[r>>2];c[x>>2]=c[t>>2];while(1){if((c[p>>2]|0)>>>0<4)break;o=c[x>>2]|0;c[x>>2]=o+4;c[z>>2]=c[o>>2];o=c[c[w>>2]>>2]|0;k=c[y>>2]|0;c[y>>2]=k+4;n=o^c[k>>2];k=c[v>>2]|0;c[v>>2]=k+4;c[k>>2]=n;n=c[z>>2]|0;k=c[w>>2]|0;c[w>>2]=k+4;c[k>>2]=n;c[p>>2]=(c[p>>2]|0)-4}c[q>>2]=c[v>>2];c[s>>2]=c[y>>2];c[r>>2]=c[w>>2];c[t>>2]=c[x>>2]}while(1){if(!(c[p>>2]|0))break;x=c[t>>2]|0;c[t>>2]=x+1;a[u>>0]=a[x>>0]|0;x=d[c[r>>2]>>0]|0;w=c[s>>2]|0;c[s>>2]=w+1;y=(x^(d[w>>0]|0))&255;w=c[q>>2]|0;c[q>>2]=w+1;a[w>>0]=y;y=a[u>>0]|0;w=c[r>>2]|0;c[r>>2]=w+1;a[w>>0]=y;c[p>>2]=(c[p>>2]|0)+-1}l=i;return}function Hk(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;i=l;l=l+80|0;if((l|0)>=(m|0))$(80);j=i+72|0;k=i+68|0;n=i+64|0;o=i+60|0;p=i+56|0;q=i+52|0;r=i+48|0;s=i+44|0;t=i+40|0;u=i;v=i+36|0;w=i+32|0;x=i+28|0;y=i+76|0;z=i+16|0;A=i+24|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[o>>2];c[t>>2]=0;nk(c[q>>2]|0);if(c[(c[q>>2]|0)+500>>2]|0)Ab[c[(c[q>>2]|0)+500>>2]&3]();c[v>>2]=c[(c[q>>2]|0)+492>>2];while(1){if(!(c[p>>2]|0))break;c[t>>2]=ub[c[v>>2]&63](c[q>>2]|0,u,c[s>>2]|0)|0;Gk(c[r>>2]|0,u,c[k>>2]|0,c[s>>2]|0,16);c[s>>2]=(c[s>>2]|0)+16;c[r>>2]=(c[r>>2]|0)+16;c[p>>2]=(c[p>>2]|0)+-1}c[w>>2]=u;c[x>>2]=16;a[y>>0]=0;u=z;c[u>>2]=d[y>>0];c[u+4>>2]=0;while(1){if(!(c[w>>2]&7|0?(c[x>>2]|0)!=0:0))break;a[c[w>>2]>>0]=a[y>>0]|0;c[w>>2]=(c[w>>2]|0)+1;c[x>>2]=(c[x>>2]|0)+-1}if((c[x>>2]|0)>>>0>=8){u=z;p=gx(c[u>>2]|0,c[u+4>>2]|0,16843009,16843009)|0;u=z;c[u>>2]=p;c[u+4>>2]=D;do{c[A>>2]=c[w>>2];u=z;p=c[u+4>>2]|0;r=c[A>>2]|0;c[r>>2]=c[u>>2];c[r+4>>2]=p;c[x>>2]=(c[x>>2]|0)-8;c[w>>2]=(c[w>>2]|0)+8}while((c[x>>2]|0)>>>0>=8)}while(1){if(!(c[x>>2]|0))break;a[c[w>>2]>>0]=a[y>>0]|0;c[w>>2]=(c[w>>2]|0)+1;c[x>>2]=(c[x>>2]|0)+-1}if(!(c[t>>2]|0)){l=i;return}bf((c[t>>2]|0)+16|0);cf();l=i;return}function Ik(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;i=l;l=l+96|0;if((l|0)>=(m|0))$(96);j=i+76|0;k=i+72|0;n=i+68|0;o=i+64|0;p=i+60|0;q=i+56|0;r=i+52|0;s=i+48|0;t=i+44|0;u=i+40|0;v=i;w=i+36|0;x=i+32|0;y=i+28|0;z=i+80|0;A=i+16|0;B=i+24|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[o>>2];c[t>>2]=0;if(c[(c[q>>2]|0)+496>>2]|0)Ab[c[(c[q>>2]|0)+496>>2]&3]();c[w>>2]=c[(c[q>>2]|0)+488>>2];while(1){if(!(c[p>>2]|0))break;c[t>>2]=ub[c[w>>2]&63](c[q>>2]|0,v,c[k>>2]|0)|0;Jk(c[r>>2]|0,v,c[s>>2]|0,16);c[r>>2]=(c[r>>2]|0)+16;c[s>>2]=(c[s>>2]|0)+16;c[u>>2]=16;while(1){if((c[u>>2]|0)<=0)break;o=(c[k>>2]|0)+((c[u>>2]|0)-1)|0;a[o>>0]=(a[o>>0]|0)+1<<24>>24;if(a[(c[k>>2]|0)+((c[u>>2]|0)-1)>>0]|0)break;c[u>>2]=(c[u>>2]|0)+-1}c[p>>2]=(c[p>>2]|0)+-1}c[x>>2]=v;c[y>>2]=16;a[z>>0]=0;v=A;c[v>>2]=d[z>>0];c[v+4>>2]=0;while(1){if(!(c[x>>2]&7|0?(c[y>>2]|0)!=0:0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}if((c[y>>2]|0)>>>0>=8){v=A;p=gx(c[v>>2]|0,c[v+4>>2]|0,16843009,16843009)|0;v=A;c[v>>2]=p;c[v+4>>2]=D;do{c[B>>2]=c[x>>2];v=A;p=c[v+4>>2]|0;u=c[B>>2]|0;c[u>>2]=c[v>>2];c[u+4>>2]=p;c[y>>2]=(c[y>>2]|0)-8;c[x>>2]=(c[x>>2]|0)+8}while((c[y>>2]|0)>>>0>=8)}while(1){if(!(c[y>>2]|0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}if(!(c[t>>2]|0)){l=i;return}bf((c[t>>2]|0)+16|0);cf();l=i;return}function Jk(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function Kk(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;n=g+20|0;o=g+16|0;p=g+12|0;q=g+8|0;r=g+4|0;s=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=c[h>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[r>>2]=0;if(c[(c[o>>2]|0)+496>>2]|0)Ab[c[(c[o>>2]|0)+496>>2]&3]();c[s>>2]=c[(c[o>>2]|0)+488>>2];while(1){if(!(c[n>>2]|0))break;c[r>>2]=ub[c[s>>2]&63](c[o>>2]|0,c[i>>2]|0,c[i>>2]|0)|0;Lk(c[p>>2]|0,c[i>>2]|0,c[q>>2]|0,16);c[p>>2]=(c[p>>2]|0)+16;c[q>>2]=(c[q>>2]|0)+16;c[n>>2]=(c[n>>2]|0)+-1}if(!(c[r>>2]|0)){l=g;return}bf((c[r>>2]|0)+16|0);cf();l=g;return}function Lk(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[q>>2]|c[o>>2]|c[p>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[t>>2]|0;c[t>>2]=k+4;j=c[k>>2]|0;k=c[s>>2]|0;c[s>>2]=k+4;i=c[k>>2]^j;c[k>>2]=i;k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[q>>2]|0;c[q>>2]=t+1;s=d[t>>0]|0;t=c[p>>2]|0;c[p>>2]=t+1;r=((d[t>>0]|0)^s)&255;a[t>>0]=r;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function Mk(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+44|0;j=h+40|0;k=h+36|0;n=h+32|0;o=h+28|0;p=h+24|0;q=h+20|0;r=h+16|0;s=h+12|0;t=h+8|0;u=h+4|0;v=h;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=c[i>>2];c[r>>2]=c[k>>2];c[s>>2]=c[n>>2];c[u>>2]=0;if(c[(c[q>>2]|0)+496>>2]|0)Ab[c[(c[q>>2]|0)+496>>2]&3]();c[v>>2]=c[(c[q>>2]|0)+488>>2];c[t>>2]=c[j>>2];while(1){if(!(c[o>>2]|0))break;Jk(c[r>>2]|0,c[s>>2]|0,c[t>>2]|0,16);c[u>>2]=ub[c[v>>2]&63](c[q>>2]|0,c[r>>2]|0,c[r>>2]|0)|0;c[t>>2]=c[r>>2];c[s>>2]=(c[s>>2]|0)+16;if(!(c[p>>2]|0))c[r>>2]=(c[r>>2]|0)+16;c[o>>2]=(c[o>>2]|0)+-1}if((c[t>>2]|0)!=(c[j>>2]|0))Nk(c[j>>2]|0,c[t>>2]|0,16);if(!(c[u>>2]|0)){l=h;return}bf((c[u>>2]|0)+16|0);cf();l=h;return}function Nk(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+8|0;o=f+4|0;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;c[j>>2]=c[g>>2];c[k>>2]=c[h>>2];c[f>>2]=3;if(!((c[j>>2]|c[k>>2])&3)){c[n>>2]=c[j>>2];c[o>>2]=c[k>>2];while(1){if((c[i>>2]|0)>>>0<4)break;h=c[o>>2]|0;c[o>>2]=h+4;g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;c[i>>2]=(c[i>>2]|0)-4}c[j>>2]=c[n>>2];c[k>>2]=c[o>>2]}while(1){if(!(c[i>>2]|0))break;o=c[k>>2]|0;c[k>>2]=o+1;n=a[o>>0]|0;o=c[j>>2]|0;c[j>>2]=o+1;a[o>>0]=n;c[i>>2]=(c[i>>2]|0)+-1}l=f;return}function Ok(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;g=l;l=l+112|0;if((l|0)>=(m|0))$(112);h=g+104|0;i=g+100|0;j=g+96|0;k=g+92|0;n=g+88|0;o=g+84|0;p=g+80|0;q=g+76|0;r=g+72|0;s=g+16|0;t=g+68|0;u=g+40|0;v=g+64|0;w=g+60|0;x=g;y=g+56|0;z=g+32|0;A=g+52|0;B=g+48|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=(c[h>>2]|0)+496;c[p>>2]=c[i>>2];c[q>>2]=c[j>>2];c[r>>2]=0;j=c[o>>2]|0;if(c[n>>2]|0){if(c[j+496>>2]|0)Ab[c[(c[o>>2]|0)+496>>2]&3]()}else{nk(j);if(c[(c[o>>2]|0)+500>>2]|0)Ab[c[(c[o>>2]|0)+500>>2]&3]()}j=c[o>>2]|0;a:do if(c[n>>2]|0){c[t>>2]=c[j+488>>2];while(1){if(!(c[k>>2]|0))break a;i=(c[h>>2]|0)+128+336|0;f=i;e=Ww(c[f>>2]|0,c[f+4>>2]|0,1,0)|0;f=D;d=i;c[d>>2]=e;c[d+4>>2]=f;d=u;c[d>>2]=e;c[d+4>>2]=f;f=u;c[v>>2]=Pk(c[f>>2]|0,c[f+4>>2]|0)|0;if((c[v>>2]|0)>>>0<16)c[w>>2]=(c[h>>2]|0)+128+32+(c[v>>2]<<4);else{f=u;c[w>>2]=Uq(c[h>>2]|0,s,c[f>>2]|0,c[f+4>>2]|0)|0}Qk((c[h>>2]|0)+64|0,c[w>>2]|0,16);Nk(s,c[q>>2]|0,16);Qk((c[h>>2]|0)+80|0,s,16);Qk(s,(c[h>>2]|0)+64|0,16);c[r>>2]=ub[c[t>>2]&63](c[o>>2]|0,s,s)|0;Qk(s,(c[h>>2]|0)+64|0,16);Nk(c[p>>2]|0,s,16);c[q>>2]=(c[q>>2]|0)+16;c[p>>2]=(c[p>>2]|0)+16;c[k>>2]=(c[k>>2]|0)+-1}}else{c[y>>2]=c[j+492>>2];while(1){if(!(c[k>>2]|0))break a;f=(c[h>>2]|0)+128+336|0;d=f;e=Ww(c[d>>2]|0,c[d+4>>2]|0,1,0)|0;d=D;i=f;c[i>>2]=e;c[i+4>>2]=d;i=z;c[i>>2]=e;c[i+4>>2]=d;d=z;c[A>>2]=Pk(c[d>>2]|0,c[d+4>>2]|0)|0;if((c[A>>2]|0)>>>0<16)c[B>>2]=(c[h>>2]|0)+128+32+(c[A>>2]<<4);else{d=z;c[B>>2]=Uq(c[h>>2]|0,x,c[d>>2]|0,c[d+4>>2]|0)|0}Qk((c[h>>2]|0)+64|0,c[B>>2]|0,16);Nk(x,c[q>>2]|0,16);Qk(x,(c[h>>2]|0)+64|0,16);c[r>>2]=ub[c[y>>2]&63](c[o>>2]|0,x,x)|0;Qk(x,(c[h>>2]|0)+64|0,16);Qk((c[h>>2]|0)+80|0,x,16);Nk(c[p>>2]|0,x,16);c[q>>2]=(c[q>>2]|0)+16;c[p>>2]=(c[p>>2]|0)+16;c[k>>2]=(c[k>>2]|0)+-1}}while(0);if(!(c[r>>2]|0)){l=g;return}bf((c[r>>2]|0)+16|0);cf();l=g;return}function Pk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d;g=f;c[g>>2]=a;c[g+4>>2]=b;b=f;g=c[b+4>>2]|0;if((c[f>>2]|0)!=0|0!=0){c[e>>2]=Rk(c[b>>2]|0)|0;h=c[e>>2]|0;l=d;return h|0}else{c[e>>2]=32+(Rk(g)|0);h=c[e>>2]|0;l=d;return h|0}return 0}function Qk(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+28|0;i=g+24|0;j=g+20|0;k=g+16|0;n=g+12|0;o=g+8|0;p=g+4|0;c[h>>2]=b;c[i>>2]=e;c[j>>2]=f;c[k>>2]=c[h>>2];c[n>>2]=c[i>>2];c[g>>2]=3;if(!((c[k>>2]|c[n>>2])&3)){c[o>>2]=c[k>>2];c[p>>2]=c[n>>2];while(1){if((c[j>>2]|0)>>>0<4)break;i=c[p>>2]|0;c[p>>2]=i+4;h=c[i>>2]|0;i=c[o>>2]|0;c[o>>2]=i+4;c[i>>2]=c[i>>2]^h;c[j>>2]=(c[j>>2]|0)-4}c[k>>2]=c[o>>2];c[n>>2]=c[p>>2]}while(1){if(!(c[j>>2]|0))break;p=c[n>>2]|0;c[n>>2]=p+1;o=d[p>>0]|0;p=c[k>>2]|0;c[k>>2]=p+1;a[p>>0]=(d[p>>0]|0)^o;c[j>>2]=(c[j>>2]|0)+-1}l=g;return}function Rk(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=(c[d>>2]|0)!=0;e=Xw(c[d>>2]|0)|0;l=b;return (a?e:32)|0}function Sk(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;g=l;l=l+96|0;if((l|0)>=(m|0))$(96);h=g+76|0;i=g+72|0;j=g+68|0;k=g+64|0;n=g+60|0;o=g+56|0;p=g;q=g+52|0;r=g+24|0;s=g+48|0;t=g+44|0;u=g+40|0;v=g+36|0;w=g+80|0;x=g+16|0;y=g+32|0;c[h>>2]=b;c[i>>2]=e;c[j>>2]=f;c[k>>2]=(c[h>>2]|0)+496;c[n>>2]=c[i>>2];c[o>>2]=0;if(c[(c[k>>2]|0)+496>>2]|0)Ab[c[(c[k>>2]|0)+496>>2]&3]();c[q>>2]=c[(c[k>>2]|0)+488>>2];while(1){if(!(c[j>>2]|0))break;i=(c[h>>2]|0)+128+344|0;f=i;e=Ww(c[f>>2]|0,c[f+4>>2]|0,1,0)|0;f=D;b=i;c[b>>2]=e;c[b+4>>2]=f;b=r;c[b>>2]=e;c[b+4>>2]=f;f=r;c[s>>2]=Pk(c[f>>2]|0,c[f+4>>2]|0)|0;if((c[s>>2]|0)>>>0<16)c[t>>2]=(c[h>>2]|0)+128+32+(c[s>>2]<<4);else{f=r;c[t>>2]=Uq(c[h>>2]|0,p,c[f>>2]|0,c[f+4>>2]|0)|0}Qk((c[h>>2]|0)+128+304|0,c[t>>2]|0,16);Jk(p,(c[h>>2]|0)+128+304|0,c[n>>2]|0,16);c[o>>2]=ub[c[q>>2]&63](c[k>>2]|0,p,p)|0;Qk((c[h>>2]|0)+128+320|0,p,16);c[n>>2]=(c[n>>2]|0)+16;c[j>>2]=(c[j>>2]|0)+-1}c[u>>2]=p;c[v>>2]=16;a[w>>0]=0;p=x;c[p>>2]=d[w>>0];c[p+4>>2]=0;while(1){if(!(c[u>>2]&7|0?(c[v>>2]|0)!=0:0))break;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}if((c[v>>2]|0)>>>0>=8){p=x;j=gx(c[p>>2]|0,c[p+4>>2]|0,16843009,16843009)|0;p=x;c[p>>2]=j;c[p+4>>2]=D;do{c[y>>2]=c[u>>2];p=x;j=c[p+4>>2]|0;n=c[y>>2]|0;c[n>>2]=c[p>>2];c[n+4>>2]=j;c[v>>2]=(c[v>>2]|0)-8;c[u>>2]=(c[u>>2]|0)+8}while((c[v>>2]|0)>>>0>=8)}while(1){if(!(c[v>>2]|0))break;a[c[u>>2]>>0]=a[w>>0]|0;c[u>>2]=(c[u>>2]|0)+1;c[v>>2]=(c[v>>2]|0)+-1}if(!(c[o>>2]|0)){l=g;return}bf((c[o>>2]|0)+16|0);cf();l=g;return}function Tk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d;c[e>>2]=a;c[d+4>>2]=b;c[f>>2]=c[e>>2];c[(c[f>>2]|0)+160>>2]=1732584193;c[(c[f>>2]|0)+164>>2]=-271733879;c[(c[f>>2]|0)+168>>2]=-1732584194;c[(c[f>>2]|0)+172>>2]=271733878;c[(c[f>>2]|0)+176>>2]=-1009589776;e=(c[f>>2]|0)+128|0;c[e>>2]=0;c[e+4>>2]=0;e=(c[f>>2]|0)+136|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[f>>2]|0)+144>>2]=0;c[(c[f>>2]|0)+148>>2]=64;c[(c[f>>2]|0)+152>>2]=31;l=d;return}function Uk(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+28|0;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;k=d+4|0;n=d;c[e>>2]=b;c[f>>2]=c[e>>2];Nr(c[f>>2]|0,0,0);c[g>>2]=c[(c[f>>2]|0)+128>>2];c[h>>2]=c[(c[f>>2]|0)+128+4>>2];c[j>>2]=c[g>>2]<<6;c[i>>2]=c[h>>2]<<6|(c[g>>2]|0)>>>26;c[g>>2]=c[j>>2];h=(c[j>>2]|0)+(c[(c[f>>2]|0)+144>>2]|0)|0;c[j>>2]=h;if(h>>>0<(c[g>>2]|0)>>>0)c[i>>2]=(c[i>>2]|0)+1;c[g>>2]=c[j>>2];c[j>>2]=c[j>>2]<<3;c[i>>2]=c[i>>2]<<3;c[i>>2]=c[i>>2]|(c[g>>2]|0)>>>29;g=(c[(c[f>>2]|0)+144>>2]|0)<56;h=(c[f>>2]|0)+144|0;e=c[h>>2]|0;c[h>>2]=e+1;a[(c[f>>2]|0)+e>>0]=-128;a:do if(g)while(1){if((c[(c[f>>2]|0)+144>>2]|0)>=56)break a;e=(c[f>>2]|0)+144|0;h=c[e>>2]|0;c[e>>2]=h+1;a[(c[f>>2]|0)+h>>0]=0}else{while(1){o=c[f>>2]|0;if((c[(c[f>>2]|0)+144>>2]|0)>=64)break;h=o+144|0;e=c[h>>2]|0;c[h>>2]=e+1;a[(c[f>>2]|0)+e>>0]=0}Nr(o,0,0);e=c[f>>2]|0;h=e+56|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(h|0))}while(0);Wk((c[f>>2]|0)+56|0,c[j>>2]|0);Wk((c[f>>2]|0)+60|0,c[i>>2]|0);c[n>>2]=Xk(c[f>>2]|0,c[f>>2]|0,1)|0;bf(c[n>>2]|0);cf();c[k>>2]=c[f>>2];Wk(c[k>>2]|0,c[(c[f>>2]|0)+160>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Wk(c[k>>2]|0,c[(c[f>>2]|0)+164>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Wk(c[k>>2]|0,c[(c[f>>2]|0)+168>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Wk(c[k>>2]|0,c[(c[f>>2]|0)+172>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Wk(c[k>>2]|0,c[(c[f>>2]|0)+176>>2]|0);c[k>>2]=(c[k>>2]|0)+4;l=d;return}function Vk(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];l=b;return c[e>>2]|0}function Wk(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];a[(c[h>>2]|0)+3>>0]=(c[g>>2]|0)>>>24;a[(c[h>>2]|0)+2>>0]=(c[g>>2]|0)>>>16;a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)>>>8;a[c[h>>2]>>0]=c[g>>2];l=e;return}function Xk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;do{c[i>>2]=Yk(c[f>>2]|0,c[g>>2]|0)|0;c[g>>2]=(c[g>>2]|0)+64;d=(c[h>>2]|0)+-1|0;c[h>>2]=d}while((d|0)!=0);l=e;return c[i>>2]|0}function Yk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=l;l=l+128|0;if((l|0)>=(m|0))$(128);e=d+120|0;f=d+116|0;g=d+112|0;h=d+108|0;i=d+104|0;j=d+100|0;k=d+96|0;n=d+92|0;o=d+88|0;p=d+84|0;q=d+80|0;r=d+76|0;s=d+72|0;t=d+8|0;u=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[e>>2];c[u>>2]=0;while(1){if((c[u>>2]|0)>=16)break;e=Zk((c[f>>2]|0)+(c[u>>2]<<2)|0)|0;c[t+(c[u>>2]<<2)>>2]=e;c[u>>2]=(c[u>>2]|0)+1}u=c[(c[g>>2]|0)+160>>2]|0;c[i>>2]=u;c[h>>2]=u;u=c[(c[g>>2]|0)+164>>2]|0;c[k>>2]=u;c[j>>2]=u;u=c[(c[g>>2]|0)+168>>2]|0;c[o>>2]=u;c[n>>2]=u;u=c[(c[g>>2]|0)+172>>2]|0;c[q>>2]=u;c[p>>2]=u;u=c[(c[g>>2]|0)+176>>2]|0;c[s>>2]=u;c[r>>2]=u;c[h>>2]=(c[h>>2]|0)+((c[j>>2]^c[n>>2]^c[p>>2])+0+(c[t>>2]|0));u=_k(c[h>>2]|0,11)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]^(c[o>>2]|~c[q>>2]))+1352829926+(c[t+20>>2]|0));u=_k(c[i>>2]|0,8)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]^c[j>>2]^c[n>>2])+0+(c[t+4>>2]|0));u=_k(c[r>>2]|0,14)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]^(c[k>>2]|~c[o>>2]))+1352829926+(c[t+56>>2]|0));u=_k(c[s>>2]|0,9)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]^c[h>>2]^c[j>>2])+0+(c[t+8>>2]|0));u=_k(c[p>>2]|0,15)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]^(c[i>>2]|~c[k>>2]))+1352829926+(c[t+28>>2]|0));u=_k(c[q>>2]|0,9)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]^c[r>>2]^c[h>>2])+0+(c[t+12>>2]|0));u=_k(c[n>>2]|0,12)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]^(c[s>>2]|~c[i>>2]))+1352829926+(c[t>>2]|0));u=_k(c[o>>2]|0,11)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]^c[p>>2]^c[r>>2])+0+(c[t+16>>2]|0));u=_k(c[j>>2]|0,5)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]^(c[q>>2]|~c[s>>2]))+1352829926+(c[t+36>>2]|0));u=_k(c[k>>2]|0,13)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]^c[n>>2]^c[p>>2])+0+(c[t+20>>2]|0));u=_k(c[h>>2]|0,8)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]^(c[o>>2]|~c[q>>2]))+1352829926+(c[t+8>>2]|0));u=_k(c[i>>2]|0,15)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]^c[j>>2]^c[n>>2])+0+(c[t+24>>2]|0));u=_k(c[r>>2]|0,7)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]^(c[k>>2]|~c[o>>2]))+1352829926+(c[t+44>>2]|0));u=_k(c[s>>2]|0,15)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]^c[h>>2]^c[j>>2])+0+(c[t+28>>2]|0));u=_k(c[p>>2]|0,9)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]^(c[i>>2]|~c[k>>2]))+1352829926+(c[t+16>>2]|0));u=_k(c[q>>2]|0,5)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]^c[r>>2]^c[h>>2])+0+(c[t+32>>2]|0));u=_k(c[n>>2]|0,11)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]^(c[s>>2]|~c[i>>2]))+1352829926+(c[t+52>>2]|0));u=_k(c[o>>2]|0,7)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]^c[p>>2]^c[r>>2])+0+(c[t+36>>2]|0));u=_k(c[j>>2]|0,13)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]^(c[q>>2]|~c[s>>2]))+1352829926+(c[t+24>>2]|0));u=_k(c[k>>2]|0,7)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]^c[n>>2]^c[p>>2])+0+(c[t+40>>2]|0));u=_k(c[h>>2]|0,14)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]^(c[o>>2]|~c[q>>2]))+1352829926+(c[t+60>>2]|0));u=_k(c[i>>2]|0,8)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]^c[j>>2]^c[n>>2])+0+(c[t+44>>2]|0));u=_k(c[r>>2]|0,15)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]^(c[k>>2]|~c[o>>2]))+1352829926+(c[t+32>>2]|0));u=_k(c[s>>2]|0,11)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]^c[h>>2]^c[j>>2])+0+(c[t+48>>2]|0));u=_k(c[p>>2]|0,6)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]^(c[i>>2]|~c[k>>2]))+1352829926+(c[t+4>>2]|0));u=_k(c[q>>2]|0,14)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]^c[r>>2]^c[h>>2])+0+(c[t+52>>2]|0));u=_k(c[n>>2]|0,7)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]^(c[s>>2]|~c[i>>2]))+1352829926+(c[t+40>>2]|0));u=_k(c[o>>2]|0,14)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]^c[p>>2]^c[r>>2])+0+(c[t+56>>2]|0));u=_k(c[j>>2]|0,9)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]^(c[q>>2]|~c[s>>2]))+1352829926+(c[t+12>>2]|0));u=_k(c[k>>2]|0,12)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]^c[n>>2]^c[p>>2])+0+(c[t+60>>2]|0));u=_k(c[h>>2]|0,8)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]^(c[o>>2]|~c[q>>2]))+1352829926+(c[t+48>>2]|0));u=_k(c[i>>2]|0,6)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]&c[j>>2]|~c[h>>2]&c[n>>2])+1518500249+(c[t+28>>2]|0));u=_k(c[r>>2]|0,7)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]&c[o>>2]|c[k>>2]&~c[o>>2])+1548603684+(c[t+24>>2]|0));u=_k(c[s>>2]|0,9)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]&c[h>>2]|~c[r>>2]&c[j>>2])+1518500249+(c[t+16>>2]|0));u=_k(c[p>>2]|0,6)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]&c[k>>2]|c[i>>2]&~c[k>>2])+1548603684+(c[t+44>>2]|0));u=_k(c[q>>2]|0,13)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]&c[r>>2]|~c[p>>2]&c[h>>2])+1518500249+(c[t+52>>2]|0));u=_k(c[n>>2]|0,8)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]&c[i>>2]|c[s>>2]&~c[i>>2])+1548603684+(c[t+12>>2]|0));u=_k(c[o>>2]|0,15)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]&c[p>>2]|~c[n>>2]&c[r>>2])+1518500249+(c[t+4>>2]|0));u=_k(c[j>>2]|0,13)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]&c[s>>2]|c[q>>2]&~c[s>>2])+1548603684+(c[t+28>>2]|0));u=_k(c[k>>2]|0,7)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]&c[n>>2]|~c[j>>2]&c[p>>2])+1518500249+(c[t+40>>2]|0));u=_k(c[h>>2]|0,11)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]&c[q>>2]|c[o>>2]&~c[q>>2])+1548603684+(c[t>>2]|0));u=_k(c[i>>2]|0,12)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]&c[j>>2]|~c[h>>2]&c[n>>2])+1518500249+(c[t+24>>2]|0));u=_k(c[r>>2]|0,9)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]&c[o>>2]|c[k>>2]&~c[o>>2])+1548603684+(c[t+52>>2]|0));u=_k(c[s>>2]|0,8)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]&c[h>>2]|~c[r>>2]&c[j>>2])+1518500249+(c[t+60>>2]|0));u=_k(c[p>>2]|0,7)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]&c[k>>2]|c[i>>2]&~c[k>>2])+1548603684+(c[t+20>>2]|0));u=_k(c[q>>2]|0,9)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]&c[r>>2]|~c[p>>2]&c[h>>2])+1518500249+(c[t+12>>2]|0));u=_k(c[n>>2]|0,15)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]&c[i>>2]|c[s>>2]&~c[i>>2])+1548603684+(c[t+40>>2]|0));u=_k(c[o>>2]|0,11)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]&c[p>>2]|~c[n>>2]&c[r>>2])+1518500249+(c[t+48>>2]|0));u=_k(c[j>>2]|0,7)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]&c[s>>2]|c[q>>2]&~c[s>>2])+1548603684+(c[t+56>>2]|0));u=_k(c[k>>2]|0,7)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]&c[n>>2]|~c[j>>2]&c[p>>2])+1518500249+(c[t>>2]|0));u=_k(c[h>>2]|0,12)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]&c[q>>2]|c[o>>2]&~c[q>>2])+1548603684+(c[t+60>>2]|0));u=_k(c[i>>2]|0,7)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]&c[j>>2]|~c[h>>2]&c[n>>2])+1518500249+(c[t+36>>2]|0));u=_k(c[r>>2]|0,15)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]&c[o>>2]|c[k>>2]&~c[o>>2])+1548603684+(c[t+32>>2]|0));u=_k(c[s>>2]|0,12)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]&c[h>>2]|~c[r>>2]&c[j>>2])+1518500249+(c[t+20>>2]|0));u=_k(c[p>>2]|0,9)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]&c[k>>2]|c[i>>2]&~c[k>>2])+1548603684+(c[t+48>>2]|0));u=_k(c[q>>2]|0,7)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]&c[r>>2]|~c[p>>2]&c[h>>2])+1518500249+(c[t+8>>2]|0));u=_k(c[n>>2]|0,11)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]&c[i>>2]|c[s>>2]&~c[i>>2])+1548603684+(c[t+16>>2]|0));u=_k(c[o>>2]|0,6)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]&c[p>>2]|~c[n>>2]&c[r>>2])+1518500249+(c[t+56>>2]|0));u=_k(c[j>>2]|0,7)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]&c[s>>2]|c[q>>2]&~c[s>>2])+1548603684+(c[t+36>>2]|0));u=_k(c[k>>2]|0,15)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]&c[n>>2]|~c[j>>2]&c[p>>2])+1518500249+(c[t+44>>2]|0));u=_k(c[h>>2]|0,13)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]&c[q>>2]|c[o>>2]&~c[q>>2])+1548603684+(c[t+4>>2]|0));u=_k(c[i>>2]|0,13)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]&c[j>>2]|~c[h>>2]&c[n>>2])+1518500249+(c[t+32>>2]|0));u=_k(c[r>>2]|0,12)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]&c[o>>2]|c[k>>2]&~c[o>>2])+1548603684+(c[t+8>>2]|0));u=_k(c[s>>2]|0,11)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+(((c[r>>2]|~c[h>>2])^c[j>>2])+1859775393+(c[t+12>>2]|0));u=_k(c[p>>2]|0,11)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+(((c[s>>2]|~c[i>>2])^c[k>>2])+1836072691+(c[t+60>>2]|0));u=_k(c[q>>2]|0,9)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+(((c[p>>2]|~c[r>>2])^c[h>>2])+1859775393+(c[t+40>>2]|0));u=_k(c[n>>2]|0,13)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+(((c[q>>2]|~c[s>>2])^c[i>>2])+1836072691+(c[t+20>>2]|0));u=_k(c[o>>2]|0,7)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+(((c[n>>2]|~c[p>>2])^c[r>>2])+1859775393+(c[t+56>>2]|0));u=_k(c[j>>2]|0,6)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+(((c[o>>2]|~c[q>>2])^c[s>>2])+1836072691+(c[t+4>>2]|0));u=_k(c[k>>2]|0,15)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+(((c[j>>2]|~c[n>>2])^c[p>>2])+1859775393+(c[t+16>>2]|0));u=_k(c[h>>2]|0,7)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+(((c[k>>2]|~c[o>>2])^c[q>>2])+1836072691+(c[t+12>>2]|0));u=_k(c[i>>2]|0,11)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+(((c[h>>2]|~c[j>>2])^c[n>>2])+1859775393+(c[t+36>>2]|0));u=_k(c[r>>2]|0,14)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+(((c[i>>2]|~c[k>>2])^c[o>>2])+1836072691+(c[t+28>>2]|0));u=_k(c[s>>2]|0,8)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+(((c[r>>2]|~c[h>>2])^c[j>>2])+1859775393+(c[t+60>>2]|0));u=_k(c[p>>2]|0,9)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+(((c[s>>2]|~c[i>>2])^c[k>>2])+1836072691+(c[t+56>>2]|0));u=_k(c[q>>2]|0,6)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+(((c[p>>2]|~c[r>>2])^c[h>>2])+1859775393+(c[t+32>>2]|0));u=_k(c[n>>2]|0,13)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+(((c[q>>2]|~c[s>>2])^c[i>>2])+1836072691+(c[t+24>>2]|0));u=_k(c[o>>2]|0,6)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+(((c[n>>2]|~c[p>>2])^c[r>>2])+1859775393+(c[t+4>>2]|0));u=_k(c[j>>2]|0,15)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+(((c[o>>2]|~c[q>>2])^c[s>>2])+1836072691+(c[t+36>>2]|0));u=_k(c[k>>2]|0,14)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+(((c[j>>2]|~c[n>>2])^c[p>>2])+1859775393+(c[t+8>>2]|0));u=_k(c[h>>2]|0,14)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+(((c[k>>2]|~c[o>>2])^c[q>>2])+1836072691+(c[t+44>>2]|0));u=_k(c[i>>2]|0,12)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+(((c[h>>2]|~c[j>>2])^c[n>>2])+1859775393+(c[t+28>>2]|0));u=_k(c[r>>2]|0,8)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+(((c[i>>2]|~c[k>>2])^c[o>>2])+1836072691+(c[t+32>>2]|0));u=_k(c[s>>2]|0,13)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+(((c[r>>2]|~c[h>>2])^c[j>>2])+1859775393+(c[t>>2]|0));u=_k(c[p>>2]|0,13)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+(((c[s>>2]|~c[i>>2])^c[k>>2])+1836072691+(c[t+48>>2]|0));u=_k(c[q>>2]|0,5)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+(((c[p>>2]|~c[r>>2])^c[h>>2])+1859775393+(c[t+24>>2]|0));u=_k(c[n>>2]|0,6)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+(((c[q>>2]|~c[s>>2])^c[i>>2])+1836072691+(c[t+8>>2]|0));u=_k(c[o>>2]|0,14)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+(((c[n>>2]|~c[p>>2])^c[r>>2])+1859775393+(c[t+52>>2]|0));u=_k(c[j>>2]|0,5)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+(((c[o>>2]|~c[q>>2])^c[s>>2])+1836072691+(c[t+40>>2]|0));u=_k(c[k>>2]|0,13)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+(((c[j>>2]|~c[n>>2])^c[p>>2])+1859775393+(c[t+44>>2]|0));u=_k(c[h>>2]|0,12)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+(((c[k>>2]|~c[o>>2])^c[q>>2])+1836072691+(c[t>>2]|0));u=_k(c[i>>2]|0,13)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+(((c[h>>2]|~c[j>>2])^c[n>>2])+1859775393+(c[t+20>>2]|0));u=_k(c[r>>2]|0,7)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+(((c[i>>2]|~c[k>>2])^c[o>>2])+1836072691+(c[t+16>>2]|0));u=_k(c[s>>2]|0,7)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+(((c[r>>2]|~c[h>>2])^c[j>>2])+1859775393+(c[t+48>>2]|0));u=_k(c[p>>2]|0,5)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+(((c[s>>2]|~c[i>>2])^c[k>>2])+1836072691+(c[t+52>>2]|0));u=_k(c[q>>2]|0,5)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]&c[h>>2]|c[r>>2]&~c[h>>2])+-1894007588+(c[t+4>>2]|0));u=_k(c[n>>2]|0,11)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]&c[s>>2]|~c[q>>2]&c[i>>2])+2053994217+(c[t+32>>2]|0));u=_k(c[o>>2]|0,15)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]&c[r>>2]|c[p>>2]&~c[r>>2])+-1894007588+(c[t+36>>2]|0));u=_k(c[j>>2]|0,12)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]&c[q>>2]|~c[o>>2]&c[s>>2])+2053994217+(c[t+24>>2]|0));u=_k(c[k>>2]|0,5)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]&c[p>>2]|c[n>>2]&~c[p>>2])+-1894007588+(c[t+44>>2]|0));u=_k(c[h>>2]|0,14)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]&c[o>>2]|~c[k>>2]&c[q>>2])+2053994217+(c[t+16>>2]|0));u=_k(c[i>>2]|0,8)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]&c[n>>2]|c[j>>2]&~c[n>>2])+-1894007588+(c[t+40>>2]|0));u=_k(c[r>>2]|0,15)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]&c[k>>2]|~c[i>>2]&c[o>>2])+2053994217+(c[t+4>>2]|0));u=_k(c[s>>2]|0,11)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]&c[j>>2]|c[h>>2]&~c[j>>2])+-1894007588+(c[t>>2]|0));u=_k(c[p>>2]|0,14)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]&c[i>>2]|~c[s>>2]&c[k>>2])+2053994217+(c[t+12>>2]|0));u=_k(c[q>>2]|0,14)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]&c[h>>2]|c[r>>2]&~c[h>>2])+-1894007588+(c[t+32>>2]|0));u=_k(c[n>>2]|0,15)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]&c[s>>2]|~c[q>>2]&c[i>>2])+2053994217+(c[t+44>>2]|0));u=_k(c[o>>2]|0,14)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]&c[r>>2]|c[p>>2]&~c[r>>2])+-1894007588+(c[t+48>>2]|0));u=_k(c[j>>2]|0,9)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]&c[q>>2]|~c[o>>2]&c[s>>2])+2053994217+(c[t+60>>2]|0));u=_k(c[k>>2]|0,6)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]&c[p>>2]|c[n>>2]&~c[p>>2])+-1894007588+(c[t+16>>2]|0));u=_k(c[h>>2]|0,8)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]&c[o>>2]|~c[k>>2]&c[q>>2])+2053994217+(c[t>>2]|0));u=_k(c[i>>2]|0,14)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]&c[n>>2]|c[j>>2]&~c[n>>2])+-1894007588+(c[t+52>>2]|0));u=_k(c[r>>2]|0,9)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]&c[k>>2]|~c[i>>2]&c[o>>2])+2053994217+(c[t+20>>2]|0));u=_k(c[s>>2]|0,6)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]&c[j>>2]|c[h>>2]&~c[j>>2])+-1894007588+(c[t+12>>2]|0));u=_k(c[p>>2]|0,14)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]&c[i>>2]|~c[s>>2]&c[k>>2])+2053994217+(c[t+48>>2]|0));u=_k(c[q>>2]|0,9)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]&c[h>>2]|c[r>>2]&~c[h>>2])+-1894007588+(c[t+28>>2]|0));u=_k(c[n>>2]|0,5)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]&c[s>>2]|~c[q>>2]&c[i>>2])+2053994217+(c[t+8>>2]|0));u=_k(c[o>>2]|0,12)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]&c[r>>2]|c[p>>2]&~c[r>>2])+-1894007588+(c[t+60>>2]|0));u=_k(c[j>>2]|0,6)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]&c[q>>2]|~c[o>>2]&c[s>>2])+2053994217+(c[t+52>>2]|0));u=_k(c[k>>2]|0,9)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]&c[p>>2]|c[n>>2]&~c[p>>2])+-1894007588+(c[t+56>>2]|0));u=_k(c[h>>2]|0,8)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]&c[o>>2]|~c[k>>2]&c[q>>2])+2053994217+(c[t+36>>2]|0));u=_k(c[i>>2]|0,12)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]&c[n>>2]|c[j>>2]&~c[n>>2])+-1894007588+(c[t+20>>2]|0));u=_k(c[r>>2]|0,6)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]&c[k>>2]|~c[i>>2]&c[o>>2])+2053994217+(c[t+28>>2]|0));u=_k(c[s>>2]|0,5)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]&c[j>>2]|c[h>>2]&~c[j>>2])+-1894007588+(c[t+24>>2]|0));u=_k(c[p>>2]|0,5)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]&c[i>>2]|~c[s>>2]&c[k>>2])+2053994217+(c[t+40>>2]|0));u=_k(c[q>>2]|0,15)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]&c[h>>2]|c[r>>2]&~c[h>>2])+-1894007588+(c[t+8>>2]|0));u=_k(c[n>>2]|0,12)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]&c[s>>2]|~c[q>>2]&c[i>>2])+2053994217+(c[t+56>>2]|0));u=_k(c[o>>2]|0,8)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]^(c[p>>2]|~c[r>>2]))+-1454113458+(c[t+16>>2]|0));u=_k(c[j>>2]|0,9)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]^c[q>>2]^c[s>>2])+0+(c[t+48>>2]|0));u=_k(c[k>>2]|0,8)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]^(c[n>>2]|~c[p>>2]))+-1454113458+(c[t>>2]|0));u=_k(c[h>>2]|0,15)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]^c[o>>2]^c[q>>2])+0+(c[t+60>>2]|0));u=_k(c[i>>2]|0,5)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]^(c[j>>2]|~c[n>>2]))+-1454113458+(c[t+20>>2]|0));u=_k(c[r>>2]|0,5)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]^c[k>>2]^c[o>>2])+0+(c[t+40>>2]|0));u=_k(c[s>>2]|0,12)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]^(c[h>>2]|~c[j>>2]))+-1454113458+(c[t+36>>2]|0));u=_k(c[p>>2]|0,11)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]^c[i>>2]^c[k>>2])+0+(c[t+16>>2]|0));u=_k(c[q>>2]|0,9)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]^(c[r>>2]|~c[h>>2]))+-1454113458+(c[t+28>>2]|0));u=_k(c[n>>2]|0,6)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]^c[s>>2]^c[i>>2])+0+(c[t+4>>2]|0));u=_k(c[o>>2]|0,12)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]^(c[p>>2]|~c[r>>2]))+-1454113458+(c[t+48>>2]|0));u=_k(c[j>>2]|0,8)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]^c[q>>2]^c[s>>2])+0+(c[t+20>>2]|0));u=_k(c[k>>2]|0,5)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]^(c[n>>2]|~c[p>>2]))+-1454113458+(c[t+8>>2]|0));u=_k(c[h>>2]|0,13)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]^c[o>>2]^c[q>>2])+0+(c[t+32>>2]|0));u=_k(c[i>>2]|0,14)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]^(c[j>>2]|~c[n>>2]))+-1454113458+(c[t+40>>2]|0));u=_k(c[r>>2]|0,12)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]^c[k>>2]^c[o>>2])+0+(c[t+28>>2]|0));u=_k(c[s>>2]|0,6)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]^(c[h>>2]|~c[j>>2]))+-1454113458+(c[t+56>>2]|0));u=_k(c[p>>2]|0,5)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]^c[i>>2]^c[k>>2])+0+(c[t+24>>2]|0));u=_k(c[q>>2]|0,8)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]^(c[r>>2]|~c[h>>2]))+-1454113458+(c[t+4>>2]|0));u=_k(c[n>>2]|0,12)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]^c[s>>2]^c[i>>2])+0+(c[t+8>>2]|0));u=_k(c[o>>2]|0,13)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]^(c[p>>2]|~c[r>>2]))+-1454113458+(c[t+12>>2]|0));u=_k(c[j>>2]|0,13)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]^c[q>>2]^c[s>>2])+0+(c[t+52>>2]|0));u=_k(c[k>>2]|0,6)|0;c[k>>2]=u+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[h>>2]=(c[h>>2]|0)+((c[j>>2]^(c[n>>2]|~c[p>>2]))+-1454113458+(c[t+32>>2]|0));u=_k(c[h>>2]|0,14)|0;c[h>>2]=u+(c[r>>2]|0);c[n>>2]=_k(c[n>>2]|0,10)|0;c[i>>2]=(c[i>>2]|0)+((c[k>>2]^c[o>>2]^c[q>>2])+0+(c[t+56>>2]|0));u=_k(c[i>>2]|0,5)|0;c[i>>2]=u+(c[s>>2]|0);c[o>>2]=_k(c[o>>2]|0,10)|0;c[r>>2]=(c[r>>2]|0)+((c[h>>2]^(c[j>>2]|~c[n>>2]))+-1454113458+(c[t+44>>2]|0));u=_k(c[r>>2]|0,11)|0;c[r>>2]=u+(c[p>>2]|0);c[j>>2]=_k(c[j>>2]|0,10)|0;c[s>>2]=(c[s>>2]|0)+((c[i>>2]^c[k>>2]^c[o>>2])+0+(c[t>>2]|0));u=_k(c[s>>2]|0,15)|0;c[s>>2]=u+(c[q>>2]|0);c[k>>2]=_k(c[k>>2]|0,10)|0;c[p>>2]=(c[p>>2]|0)+((c[r>>2]^(c[h>>2]|~c[j>>2]))+-1454113458+(c[t+24>>2]|0));u=_k(c[p>>2]|0,8)|0;c[p>>2]=u+(c[n>>2]|0);c[h>>2]=_k(c[h>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[s>>2]^c[i>>2]^c[k>>2])+0+(c[t+12>>2]|0));u=_k(c[q>>2]|0,13)|0;c[q>>2]=u+(c[o>>2]|0);c[i>>2]=_k(c[i>>2]|0,10)|0;c[n>>2]=(c[n>>2]|0)+((c[p>>2]^(c[r>>2]|~c[h>>2]))+-1454113458+(c[t+60>>2]|0));u=_k(c[n>>2]|0,5)|0;c[n>>2]=u+(c[j>>2]|0);c[r>>2]=_k(c[r>>2]|0,10)|0;c[o>>2]=(c[o>>2]|0)+((c[q>>2]^c[s>>2]^c[i>>2])+0+(c[t+36>>2]|0));u=_k(c[o>>2]|0,11)|0;c[o>>2]=u+(c[k>>2]|0);c[s>>2]=_k(c[s>>2]|0,10)|0;c[j>>2]=(c[j>>2]|0)+((c[n>>2]^(c[p>>2]|~c[r>>2]))+-1454113458+(c[t+52>>2]|0));u=_k(c[j>>2]|0,6)|0;c[j>>2]=u+(c[h>>2]|0);c[p>>2]=_k(c[p>>2]|0,10)|0;c[k>>2]=(c[k>>2]|0)+((c[o>>2]^c[q>>2]^c[s>>2])+0+(c[t+44>>2]|0));t=_k(c[k>>2]|0,11)|0;c[k>>2]=t+(c[i>>2]|0);c[q>>2]=_k(c[q>>2]|0,10)|0;c[q>>2]=(c[q>>2]|0)+((c[n>>2]|0)+(c[(c[g>>2]|0)+164>>2]|0));c[(c[g>>2]|0)+164>>2]=(c[(c[g>>2]|0)+168>>2]|0)+(c[p>>2]|0)+(c[s>>2]|0);c[(c[g>>2]|0)+168>>2]=(c[(c[g>>2]|0)+172>>2]|0)+(c[r>>2]|0)+(c[i>>2]|0);c[(c[g>>2]|0)+172>>2]=(c[(c[g>>2]|0)+176>>2]|0)+(c[h>>2]|0)+(c[k>>2]|0);c[(c[g>>2]|0)+176>>2]=(c[(c[g>>2]|0)+160>>2]|0)+(c[j>>2]|0)+(c[o>>2]|0);c[(c[g>>2]|0)+160>>2]=c[q>>2];l=d;return 124}function Zk(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];l=b;return (d[(c[f>>2]|0)+3>>0]|0)<<24|(d[(c[f>>2]|0)+2>>0]|0)<<16|(d[(c[f>>2]|0)+1>>0]|0)<<8|(d[c[f>>2]>>0]|0)|0}function _k(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return c[e>>2]<<(c[f>>2]&31)|(c[e>>2]|0)>>>(32-(c[f>>2]|0)&31)|0}function $k(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Tk(c[d>>2]|0,0);l=b;return}function al(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[f>>2];Xk(c[e>>2]|0,c[f>>2]|0,1)|0;c[c[g>>2]>>2]=c[(c[e>>2]|0)+160>>2];c[(c[g>>2]|0)+4>>2]=c[(c[e>>2]|0)+164>>2];c[(c[g>>2]|0)+8>>2]=c[(c[e>>2]|0)+168>>2];c[(c[g>>2]|0)+12>>2]=c[(c[e>>2]|0)+172>>2];c[(c[g>>2]|0)+16>>2]=c[(c[e>>2]|0)+176>>2];l=d;return}function bl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+208|0;if((l|0)>=(m|0))$(208);g=f+192|0;h=f+188|0;i=f+184|0;j=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;$k(j);Nr(j,c[h>>2]|0,c[i>>2]|0);Uk(j);i=c[g>>2]|0;g=j;j=i+20|0;do{a[i>>0]=a[g>>0]|0;i=i+1|0;g=g+1|0}while((i|0)<(j|0));l=f;return}function cl(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;i=l;l=l+80|0;if((l|0)>=(m|0))$(80);j=i+64|0;k=i+60|0;n=i+56|0;o=i+52|0;p=i+48|0;q=i+44|0;r=i+40|0;s=i+36|0;t=i+32|0;u=i+28|0;v=i+24|0;w=i+20|0;x=i+16|0;y=i+12|0;z=i+8|0;A=i+4|0;B=i;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=0;c[t>>2]=0;c[u>>2]=(((c[n>>2]|0)+7|0)>>>0)/8|0;if(!(c[u>>2]|0?((c[p>>2]|0)+7|0)>>>0<=(c[u>>2]|0)>>>0:0)){c[j>>2]=66;C=c[j>>2]|0;l=i;return C|0}n=sf(c[u>>2]|0)|0;c[t>>2]=n;if(!n){c[j>>2]=Et()|0;C=c[j>>2]|0;l=i;return C|0}c[w>>2]=0;n=c[w>>2]|0;c[w>>2]=n+1;a[(c[t>>2]|0)+n>>0]=0;n=c[w>>2]|0;c[w>>2]=n+1;a[(c[t>>2]|0)+n>>0]=2;c[v>>2]=(c[u>>2]|0)-3-(c[p>>2]|0);if((c[v>>2]|0)<=0)Se(38982,38988,95,39001);do if(c[q>>2]|0){if((c[r>>2]|0)!=(c[v>>2]|0)){vf(c[t>>2]|0);c[j>>2]=45;C=c[j>>2]|0;l=i;return C|0}c[y>>2]=0;while(1){if((c[y>>2]|0)>>>0>=(c[r>>2]|0)>>>0){D=15;break}if(!(a[(c[q>>2]|0)+(c[y>>2]|0)>>0]|0))break;c[y>>2]=(c[y>>2]|0)+1}if((D|0)==15){_w((c[t>>2]|0)+(c[w>>2]|0)|0,c[q>>2]|0,c[r>>2]|0)|0;c[w>>2]=(c[w>>2]|0)+(c[r>>2]|0);break}vf(c[t>>2]|0);c[j>>2]=45;C=c[j>>2]|0;l=i;return C|0}else{c[x>>2]=hn(c[v>>2]|0,1)|0;while(1){c[A>>2]=0;c[z>>2]=0;while(1){if((c[z>>2]|0)>=(c[v>>2]|0))break;if(!(a[(c[x>>2]|0)+(c[z>>2]|0)>>0]|0))c[A>>2]=(c[A>>2]|0)+1;c[z>>2]=(c[z>>2]|0)+1}if(!(c[A>>2]|0))break;c[A>>2]=(c[A>>2]|0)+(((c[A>>2]|0)/128|0)+3);c[B>>2]=hn(c[A>>2]|0,1)|0;c[z>>2]=0;while(1){if(!((c[z>>2]|0)<(c[v>>2]|0)?(c[A>>2]|0)!=0:0))break;if(!(a[(c[x>>2]|0)+(c[z>>2]|0)>>0]|0)){n=(c[A>>2]|0)+-1|0;c[A>>2]=n;a[(c[x>>2]|0)+(c[z>>2]|0)>>0]=a[(c[B>>2]|0)+n>>0]|0}if(!(a[(c[x>>2]|0)+(c[z>>2]|0)>>0]|0))continue;c[z>>2]=(c[z>>2]|0)+1}vf(c[B>>2]|0)}_w((c[t>>2]|0)+(c[w>>2]|0)|0,c[x>>2]|0,c[v>>2]|0)|0;c[w>>2]=(c[w>>2]|0)+(c[v>>2]|0);vf(c[x>>2]|0)}while(0);x=c[w>>2]|0;c[w>>2]=x+1;a[(c[t>>2]|0)+x>>0]=0;_w((c[t>>2]|0)+(c[w>>2]|0)|0,c[o>>2]|0,c[p>>2]|0)|0;c[w>>2]=(c[w>>2]|0)+(c[p>>2]|0);if((c[w>>2]|0)!=(c[u>>2]|0))Se(39032,38988,153,39001);c[s>>2]=Zo(c[k>>2]|0,5,c[t>>2]|0,c[w>>2]|0,u)|0;if((c[s>>2]|0)==0?Ff(1)|0:0)af(39044,c[c[k>>2]>>2]|0);vf(c[t>>2]|0);c[j>>2]=c[s>>2];C=c[j>>2]|0;l=i;return C|0}function dl(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+32|0;j=h+28|0;k=h+24|0;n=h+20|0;o=h+16|0;p=h+12|0;q=h+8|0;r=h+4|0;s=h;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[q>>2]=0;c[r>>2]=(((c[n>>2]|0)+7|0)>>>0)/8|0;c[c[j>>2]>>2]=0;n=sf(c[r>>2]|0)|0;c[q>>2]=n;if(!n){c[i>>2]=Et()|0;t=c[i>>2]|0;l=h;return t|0}c[p>>2]=bp(5,c[q>>2]|0,c[r>>2]|0,s,c[o>>2]|0)|0;if(c[p>>2]|0){vf(c[q>>2]|0);c[i>>2]=el(c[p>>2]|0)|0;t=c[i>>2]|0;l=h;return t|0}c[r>>2]=c[s>>2];if((c[r>>2]|0)>>>0<4){vf(c[q>>2]|0);c[i>>2]=155;t=c[i>>2]|0;l=h;return t|0}c[s>>2]=0;if(!(a[c[q>>2]>>0]|0))c[s>>2]=(c[s>>2]|0)+1;p=c[s>>2]|0;c[s>>2]=p+1;if((d[(c[q>>2]|0)+p>>0]|0)!=2){vf(c[q>>2]|0);c[i>>2]=155;t=c[i>>2]|0;l=h;return t|0}while(1){if((c[s>>2]|0)>>>0>=(c[r>>2]|0)>>>0)break;if(!(d[(c[q>>2]|0)+(c[s>>2]|0)>>0]|0))break;c[s>>2]=(c[s>>2]|0)+1}if(((c[s>>2]|0)+1|0)>>>0>=(c[r>>2]|0)>>>0){vf(c[q>>2]|0);c[i>>2]=155;t=c[i>>2]|0;l=h;return t|0}c[s>>2]=(c[s>>2]|0)+1;$w(c[q>>2]|0,(c[q>>2]|0)+(c[s>>2]|0)|0,(c[r>>2]|0)-(c[s>>2]|0)|0)|0;c[c[j>>2]>>2]=c[q>>2];c[c[k>>2]>>2]=(c[r>>2]|0)-(c[s>>2]|0);if(Ff(1)|0)_e(39077,c[c[j>>2]>>2]|0,c[c[k>>2]>>2]|0);c[i>>2]=0;t=c[i>>2]|0;l=h;return t|0}function el(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=fl(c[d>>2]|0)|0;l=b;return a|0}function fl(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return c[d>>2]&65535|0}function gl(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;h=l;l=l+160|0;if((l|0)>=(m|0))$(160);i=h+48|0;j=h+44|0;k=h+40|0;n=h+36|0;o=h+32|0;p=h+28|0;q=h+24|0;r=h+52|0;s=h+20|0;t=h+16|0;u=h+12|0;v=h+8|0;w=h+4|0;x=h;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=0;c[s>>2]=0;c[t>>2]=(((c[k>>2]|0)+7|0)>>>0)/8|0;c[w>>2]=100;c[x>>2]=oj(c[p>>2]|0)|0;if(pj(c[p>>2]|0,10,r,w)|0){c[i>>2]=69;y=c[i>>2]|0;l=h;return y|0}if((c[o>>2]|0)!=(c[x>>2]|0)){c[i>>2]=70;y=c[i>>2]|0;l=h;return y|0}if(c[x>>2]|0?((c[x>>2]|0)+(c[w>>2]|0)+4|0)>>>0<=(c[t>>2]|0)>>>0:0){x=pf(c[t>>2]|0)|0;c[s>>2]=x;if(!x){c[i>>2]=Et()|0;y=c[i>>2]|0;l=h;return y|0}c[v>>2]=0;x=c[v>>2]|0;c[v>>2]=x+1;a[(c[s>>2]|0)+x>>0]=0;x=c[v>>2]|0;c[v>>2]=x+1;a[(c[s>>2]|0)+x>>0]=1;c[u>>2]=(c[t>>2]|0)-(c[o>>2]|0)-(c[w>>2]|0)-3;if((c[u>>2]|0)<=1)Se(39131,38988,303,39137);Uw((c[s>>2]|0)+(c[v>>2]|0)|0,-1,c[u>>2]|0)|0;c[v>>2]=(c[v>>2]|0)+(c[u>>2]|0);u=c[v>>2]|0;c[v>>2]=u+1;a[(c[s>>2]|0)+u>>0]=0;_w((c[s>>2]|0)+(c[v>>2]|0)|0,r|0,c[w>>2]|0)|0;c[v>>2]=(c[v>>2]|0)+(c[w>>2]|0);_w((c[s>>2]|0)+(c[v>>2]|0)|0,c[n>>2]|0,c[o>>2]|0)|0;c[v>>2]=(c[v>>2]|0)+(c[o>>2]|0);if((c[v>>2]|0)!=(c[t>>2]|0))Se(39032,38988,311,39137);c[q>>2]=Zo(c[j>>2]|0,5,c[s>>2]|0,c[v>>2]|0,t)|0;if((c[q>>2]|0)==0?Ff(1)|0:0)af(39168,c[c[j>>2]>>2]|0);vf(c[s>>2]|0);c[i>>2]=c[q>>2];y=c[i>>2]|0;l=h;return y|0}c[i>>2]=66;y=c[i>>2]|0;l=h;return y|0}function hl(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+40|0;i=g+36|0;j=g+32|0;k=g+28|0;n=g+24|0;o=g+20|0;p=g+16|0;q=g+12|0;r=g+8|0;s=g+4|0;t=g;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=0;c[q>>2]=0;c[r>>2]=(((c[j>>2]|0)+7|0)>>>0)/8|0;if(c[n>>2]|0?((c[n>>2]|0)+4|0)>>>0<=(c[r>>2]|0)>>>0:0){j=pf(c[r>>2]|0)|0;c[q>>2]=j;if(!j){c[h>>2]=Et()|0;u=c[h>>2]|0;l=g;return u|0}c[t>>2]=0;j=c[t>>2]|0;c[t>>2]=j+1;a[(c[q>>2]|0)+j>>0]=0;j=c[t>>2]|0;c[t>>2]=j+1;a[(c[q>>2]|0)+j>>0]=1;c[s>>2]=(c[r>>2]|0)-(c[n>>2]|0)-3;if((c[s>>2]|0)<=1)Se(39131,38988,368,39201);Uw((c[q>>2]|0)+(c[t>>2]|0)|0,-1,c[s>>2]|0)|0;c[t>>2]=(c[t>>2]|0)+(c[s>>2]|0);s=c[t>>2]|0;c[t>>2]=s+1;a[(c[q>>2]|0)+s>>0]=0;_w((c[q>>2]|0)+(c[t>>2]|0)|0,c[k>>2]|0,c[n>>2]|0)|0;c[t>>2]=(c[t>>2]|0)+(c[n>>2]|0);if((c[t>>2]|0)!=(c[r>>2]|0))Se(39032,38988,374,39201);c[p>>2]=Zo(c[i>>2]|0,5,c[q>>2]|0,c[t>>2]|0,r)|0;if(!(c[p>>2]|0)){if(Ff(1)|0)af(39168,c[c[i>>2]>>2]|0)}else c[o>>2]=el(c[p>>2]|0)|0;vf(c[q>>2]|0);c[h>>2]=c[o>>2];u=c[h>>2]|0;l=g;return u|0}c[h>>2]=66;u=c[h>>2]|0;l=g;return u|0}function il(b,e,f,g,h,i,j,k,n){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;o=l;l=l+80|0;if((l|0)>=(m|0))$(80);p=o+68|0;q=o+64|0;r=o+60|0;s=o+56|0;t=o+52|0;u=o+48|0;v=o+44|0;w=o+40|0;x=o+36|0;y=o+32|0;z=o+28|0;A=o+24|0;B=o+20|0;C=o+16|0;D=o+12|0;E=o+8|0;F=o+4|0;G=o;c[q>>2]=b;c[r>>2]=e;c[s>>2]=f;c[t>>2]=g;c[u>>2]=h;c[v>>2]=i;c[w>>2]=j;c[x>>2]=k;c[y>>2]=n;c[z>>2]=0;c[A>>2]=0;c[B>>2]=(((c[r>>2]|0)+7|0)>>>0)/8|0;c[c[q>>2]>>2]=0;if(!((c[v>>2]|0)!=0&(c[w>>2]|0)!=0)){c[v>>2]=72319;c[w>>2]=0}c[D>>2]=oj(c[s>>2]|0)|0;if(!(c[B>>2]|0?(c[u>>2]|0)>>>0<=((c[B>>2]|0)-(c[D>>2]<<1)-2|0)>>>0:0)){c[p>>2]=66;H=c[p>>2]|0;l=o;return H|0}c[A>>2]=xf(1,c[B>>2]|0)|0;if(!(c[A>>2]|0)){c[p>>2]=Et()|0;H=c[p>>2]|0;l=o;return H|0}hj(c[s>>2]|0,(c[A>>2]|0)+1+(c[D>>2]|0)|0,c[v>>2]|0,c[w>>2]|0);c[E>>2]=(c[B>>2]|0)-(c[u>>2]|0)-1;a[(c[A>>2]|0)+(c[E>>2]|0)>>0]=1;_w((c[A>>2]|0)+(c[E>>2]|0)+1|0,c[t>>2]|0,c[u>>2]|0)|0;do if(c[x>>2]|0){u=c[A>>2]|0;if((c[y>>2]|0)==(c[D>>2]|0)){_w(u+1|0,c[x>>2]|0,c[D>>2]|0)|0;break}vf(u);c[p>>2]=45;H=c[p>>2]|0;l=o;return H|0}else jn((c[A>>2]|0)+1|0,c[D>>2]|0,1);while(0);c[F>>2]=sf((c[B>>2]|0)-(c[D>>2]|0)-1|0)|0;if(!(c[F>>2]|0)){c[z>>2]=Et()|0;vf(c[A>>2]|0);c[p>>2]=c[z>>2];H=c[p>>2]|0;l=o;return H|0}c[z>>2]=jl(c[F>>2]|0,(c[B>>2]|0)-(c[D>>2]|0)-1|0,(c[A>>2]|0)+1|0,c[D>>2]|0,c[s>>2]|0)|0;if(c[z>>2]|0){vf(c[F>>2]|0);vf(c[A>>2]|0);c[p>>2]=c[z>>2];H=c[p>>2]|0;l=o;return H|0}c[E>>2]=1+(c[D>>2]|0);c[C>>2]=c[F>>2];while(1){if((c[E>>2]|0)>>>0>=(c[B>>2]|0)>>>0)break;x=c[C>>2]|0;c[C>>2]=x+1;y=(c[A>>2]|0)+(c[E>>2]|0)|0;a[y>>0]=(d[y>>0]|0)^(d[x>>0]|0);c[E>>2]=(c[E>>2]|0)+1}vf(c[F>>2]|0);c[G>>2]=sf(c[D>>2]|0)|0;if(!(c[G>>2]|0)){c[z>>2]=Et()|0;vf(c[A>>2]|0);c[p>>2]=c[z>>2];H=c[p>>2]|0;l=o;return H|0}c[z>>2]=jl(c[G>>2]|0,c[D>>2]|0,(c[A>>2]|0)+1+(c[D>>2]|0)|0,(c[B>>2]|0)-(c[D>>2]|0)-1|0,c[s>>2]|0)|0;if(c[z>>2]|0){vf(c[G>>2]|0);vf(c[A>>2]|0);c[p>>2]=c[z>>2];H=c[p>>2]|0;l=o;return H|0}c[E>>2]=1;c[C>>2]=c[G>>2];while(1){if((c[E>>2]|0)>>>0>=(1+(c[D>>2]|0)|0)>>>0)break;s=c[C>>2]|0;c[C>>2]=s+1;F=(c[A>>2]|0)+(c[E>>2]|0)|0;a[F>>0]=(d[F>>0]|0)^(d[s>>0]|0);c[E>>2]=(c[E>>2]|0)+1}vf(c[G>>2]|0);c[z>>2]=Zo(c[q>>2]|0,5,c[A>>2]|0,c[B>>2]|0,0)|0;if((c[z>>2]|0)==0?Ff(1)|0:0)af(39236,c[c[q>>2]>>2]|0);vf(c[A>>2]|0);c[p>>2]=c[z>>2];H=c[p>>2]|0;l=o;return H|0}function jl(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;h=l;l=l+64|0;if((l|0)>=(m|0))$(64);i=h+48|0;j=h+44|0;k=h+40|0;n=h+36|0;o=h+32|0;p=h+28|0;q=h+24|0;r=h+20|0;s=h+16|0;t=h+12|0;u=h+8|0;v=h+4|0;w=h+52|0;x=h;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[v>>2]=Si(u,c[p>>2]|0,0)|0;if(c[v>>2]|0){c[i>>2]=c[v>>2];y=c[i>>2]|0;l=h;return y|0}c[q>>2]=oj(c[p>>2]|0)|0;c[r>>2]=0;c[t>>2]=0;while(1){if((c[r>>2]|0)>>>0>=(c[k>>2]|0)>>>0)break;if(c[t>>2]|0)Zi(c[u>>2]|0);a[w>>0]=c[t>>2]>>24;a[w+1>>0]=c[t>>2]>>16;a[w+2>>0]=c[t>>2]>>8;a[w+3>>0]=c[t>>2];c[t>>2]=(c[t>>2]|0)+1;$i(c[u>>2]|0,c[n>>2]|0,c[o>>2]|0);$i(c[u>>2]|0,w,4);c[x>>2]=lj(c[u>>2]|0,0)|0;if(((c[k>>2]|0)-(c[r>>2]|0)|0)>>>0<(c[q>>2]|0)>>>0)z=(c[k>>2]|0)-(c[r>>2]|0)|0;else z=c[q>>2]|0;c[s>>2]=z;_w((c[j>>2]|0)+(c[r>>2]|0)|0,c[x>>2]|0,c[s>>2]|0)|0;c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0)}_i(c[u>>2]|0);c[i>>2]=0;y=c[i>>2]|0;l=h;return y|0}function kl(b,e,f,g,h,i,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;k=l;l=l+96|0;if((l|0)>=(m|0))$(96);n=k+80|0;o=k+76|0;p=k+72|0;q=k+68|0;r=k+64|0;s=k+60|0;t=k+56|0;u=k+52|0;v=k+48|0;w=k+44|0;x=k+40|0;y=k+36|0;z=k+32|0;A=k+28|0;B=k+24|0;C=k+20|0;D=k+16|0;E=k+12|0;F=k+8|0;G=k+4|0;H=k;c[o>>2]=b;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=h;c[t>>2]=i;c[u>>2]=j;c[w>>2]=0;c[z>>2]=0;c[B>>2]=0;c[F>>2]=(((c[q>>2]|0)+7|0)>>>0)/8|0;c[G>>2]=0;c[c[o>>2]>>2]=0;if(!((c[t>>2]|0)!=0&(c[u>>2]|0)!=0)){c[t>>2]=72319;c[u>>2]=0}c[D>>2]=oj(c[r>>2]|0)|0;c[B>>2]=pf(c[D>>2]|0)|0;if(!(c[B>>2]|0)){c[n>>2]=Et()|0;I=c[n>>2]|0;l=k;return I|0}hj(c[r>>2]|0,c[B>>2]|0,c[t>>2]|0,c[u>>2]|0);c[v>>2]=ll(w,0,c[s>>2]|0,c[F>>2]|0)|0;if(c[v>>2]|0){vf(c[B>>2]|0);c[n>>2]=155;I=c[n>>2]|0;l=k;return I|0}c[C>>2]=c[F>>2];if((c[C>>2]|0)>>>0<((c[D>>2]<<1)+2|0)>>>0){vf(c[w>>2]|0);vf(c[B>>2]|0);c[n>>2]=155;I=c[n>>2]|0;l=k;return I|0}c[z>>2]=sf((c[C>>2]|0)-1|0)|0;if(!(c[z>>2]|0)){c[v>>2]=Et()|0;vf(c[w>>2]|0);vf(c[B>>2]|0);c[n>>2]=c[v>>2];I=c[n>>2]|0;l=k;return I|0}c[A>>2]=(c[z>>2]|0)+(c[D>>2]|0);c[x>>2]=(c[w>>2]|0)+1;c[y>>2]=(c[w>>2]|0)+1+(c[D>>2]|0);c[E>>2]=(c[C>>2]|0)-1-(c[D>>2]|0);if(jl(c[z>>2]|0,c[D>>2]|0,c[y>>2]|0,c[E>>2]|0,c[r>>2]|0)|0)c[G>>2]=1;c[H>>2]=0;while(1){if((c[H>>2]|0)>>>0>=(c[D>>2]|0)>>>0)break;C=(c[z>>2]|0)+(c[H>>2]|0)|0;a[C>>0]=d[C>>0]^d[(c[x>>2]|0)+(c[H>>2]|0)>>0];c[H>>2]=(c[H>>2]|0)+1}if(jl(c[A>>2]|0,c[E>>2]|0,c[z>>2]|0,c[D>>2]|0,c[r>>2]|0)|0)c[G>>2]=1;c[H>>2]=0;while(1){if((c[H>>2]|0)>>>0>=(c[E>>2]|0)>>>0)break;r=(c[A>>2]|0)+(c[H>>2]|0)|0;a[r>>0]=d[r>>0]^d[(c[y>>2]|0)+(c[H>>2]|0)>>0];c[H>>2]=(c[H>>2]|0)+1}if(Jv(c[B>>2]|0,c[A>>2]|0,c[D>>2]|0)|0)c[G>>2]=1;c[H>>2]=c[D>>2];while(1){if((c[H>>2]|0)>>>0>=(c[E>>2]|0)>>>0)break;if((d[(c[A>>2]|0)+(c[H>>2]|0)>>0]|0)==1)break;c[H>>2]=(c[H>>2]|0)+1}if((c[H>>2]|0)==(c[E>>2]|0))c[G>>2]=1;if(a[c[w>>2]>>0]|0)c[G>>2]=1;vf(c[B>>2]|0);vf(c[w>>2]|0);if(c[G>>2]|0){vf(c[z>>2]|0);c[n>>2]=155;I=c[n>>2]|0;l=k;return I|0}c[H>>2]=(c[H>>2]|0)+1;$w(c[z>>2]|0,(c[A>>2]|0)+(c[H>>2]|0)|0,(c[E>>2]|0)-(c[H>>2]|0)|0)|0;c[c[o>>2]>>2]=c[z>>2];c[c[p>>2]>>2]=(c[E>>2]|0)-(c[H>>2]|0);c[z>>2]=0;if(Ff(1)|0)_e(39254,c[c[o>>2]>>2]|0,c[c[p>>2]>>2]|0);c[n>>2]=0;I=c[n>>2]|0;l=k;return I|0}function ll(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;e=dp(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;l=f;return e|0}function ml(b,e,f,g,h,i,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;n=l;l=l+128|0;if((l|0)>=(m|0))$(128);o=n+116|0;p=n+112|0;q=n+108|0;r=n+104|0;s=n+100|0;t=n+96|0;u=n+92|0;v=n+88|0;w=n+84|0;x=n+80|0;y=n+76|0;z=n+72|0;A=n+68|0;B=n+64|0;C=n+60|0;E=n+56|0;F=n+52|0;G=n+48|0;H=n+44|0;I=n+40|0;J=n+36|0;K=n+32|0;L=n+121|0;M=n+8|0;N=n+28|0;O=n+24|0;P=n+20|0;Q=n+120|0;R=n;S=n+16|0;c[o>>2]=b;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=h;c[t>>2]=i;c[u>>2]=j;c[v>>2]=k;c[w>>2]=0;c[y>>2]=0;c[z>>2]=(((c[p>>2]|0)+7|0)>>>0)/8|0;c[B>>2]=0;c[x>>2]=oj(c[q>>2]|0)|0;if(!(c[x>>2]|0))Se(39293,38988,800,39298);c[C>>2]=8+(c[x>>2]|0)+(c[t>>2]|0)+((c[z>>2]|0)-(c[x>>2]|0)-1);c[B>>2]=pf(c[C>>2]|0)|0;a:do if(c[B>>2]|0){c[E>>2]=(c[B>>2]|0)+8;c[F>>2]=(c[E>>2]|0)+(c[x>>2]|0);c[G>>2]=(c[F>>2]|0)+(c[t>>2]|0);if((c[s>>2]|0)!=(c[x>>2]|0)){c[w>>2]=139;break}_w(c[E>>2]|0,c[r>>2]|0,c[x>>2]|0)|0;if((c[z>>2]|0)>>>0<((c[x>>2]|0)+(c[t>>2]|0)+2|0)>>>0){c[w>>2]=66;break}c[y>>2]=pf(c[z>>2]|0)|0;if(!(c[y>>2]|0)){c[w>>2]=Et()|0;break}c[A>>2]=(c[y>>2]|0)+(c[z>>2]|0)+-1+(0-(c[x>>2]|0));do if(c[t>>2]|0){if(!(c[u>>2]|0)){jn(c[F>>2]|0,c[t>>2]|0,1);break}if((c[v>>2]|0)!=(c[t>>2]|0)){c[w>>2]=45;break a}else{_w(c[F>>2]|0,c[u>>2]|0,c[t>>2]|0)|0;break}}while(0);k=c[B>>2]|0;a[k>>0]=0;a[k+1>>0]=0;a[k+2>>0]=0;a[k+3>>0]=0;a[k+4>>0]=0;a[k+5>>0]=0;a[k+6>>0]=0;a[k+7>>0]=0;hj(c[q>>2]|0,c[A>>2]|0,c[B>>2]|0,8+(c[x>>2]|0)+(c[t>>2]|0)|0);c[H>>2]=(c[y>>2]|0)+(c[z>>2]|0)+-1+(0-(c[x>>2]|0))+(0-(c[t>>2]|0))+-1;Uw(c[y>>2]|0,0,(c[H>>2]|0)-(c[y>>2]|0)|0)|0;k=c[H>>2]|0;c[H>>2]=k+1;a[k>>0]=1;_w(c[H>>2]|0,c[F>>2]|0,c[t>>2]|0)|0;jl(c[G>>2]|0,(c[z>>2]|0)-(c[x>>2]|0)-1|0,c[A>>2]|0,c[x>>2]|0,c[q>>2]|0)|0;c[I>>2]=0;c[H>>2]=c[G>>2];while(1){if((c[I>>2]|0)>>>0>=((c[z>>2]|0)-(c[x>>2]|0)-1|0)>>>0)break;k=(c[y>>2]|0)+(c[I>>2]|0)|0;a[k>>0]=(d[k>>0]|0)^(d[c[H>>2]>>0]|0);c[I>>2]=(c[I>>2]|0)+1;c[H>>2]=(c[H>>2]|0)+1}k=c[y>>2]|0;a[k>>0]=(d[k>>0]|0)&255>>(c[z>>2]<<3)-(c[p>>2]|0);a[(c[y>>2]|0)+((c[z>>2]|0)-1)>>0]=-68;c[w>>2]=Zo(c[o>>2]|0,5,c[y>>2]|0,c[z>>2]|0,0)|0;if((c[w>>2]|0)==0?Ff(1)|0:0)af(39319,c[c[o>>2]>>2]|0)}else c[w>>2]=Et()|0;while(0);if(c[y>>2]|0){c[J>>2]=c[y>>2];c[K>>2]=c[z>>2];a[L>>0]=0;z=M;c[z>>2]=d[L>>0];c[z+4>>2]=0;while(1){if(!(c[J>>2]&7|0?(c[K>>2]|0)!=0:0))break;a[c[J>>2]>>0]=a[L>>0]|0;c[J>>2]=(c[J>>2]|0)+1;c[K>>2]=(c[K>>2]|0)+-1}if((c[K>>2]|0)>>>0>=8){z=M;o=gx(c[z>>2]|0,c[z+4>>2]|0,16843009,16843009)|0;z=M;c[z>>2]=o;c[z+4>>2]=D;do{c[N>>2]=c[J>>2];z=M;o=c[z+4>>2]|0;p=c[N>>2]|0;c[p>>2]=c[z>>2];c[p+4>>2]=o;c[K>>2]=(c[K>>2]|0)-8;c[J>>2]=(c[J>>2]|0)+8}while((c[K>>2]|0)>>>0>=8)}while(1){if(!(c[K>>2]|0))break;a[c[J>>2]>>0]=a[L>>0]|0;c[J>>2]=(c[J>>2]|0)+1;c[K>>2]=(c[K>>2]|0)+-1}vf(c[y>>2]|0)}if(!(c[B>>2]|0)){T=c[w>>2]|0;l=n;return T|0}c[O>>2]=c[B>>2];c[P>>2]=c[C>>2];a[Q>>0]=0;C=R;c[C>>2]=d[Q>>0];c[C+4>>2]=0;while(1){if(!(c[O>>2]&7|0?(c[P>>2]|0)!=0:0))break;a[c[O>>2]>>0]=a[Q>>0]|0;c[O>>2]=(c[O>>2]|0)+1;c[P>>2]=(c[P>>2]|0)+-1}if((c[P>>2]|0)>>>0>=8){C=R;y=gx(c[C>>2]|0,c[C+4>>2]|0,16843009,16843009)|0;C=R;c[C>>2]=y;c[C+4>>2]=D;do{c[S>>2]=c[O>>2];C=R;y=c[C+4>>2]|0;K=c[S>>2]|0;c[K>>2]=c[C>>2];c[K+4>>2]=y;c[P>>2]=(c[P>>2]|0)-8;c[O>>2]=(c[O>>2]|0)+8}while((c[P>>2]|0)>>>0>=8)}while(1){if(!(c[P>>2]|0))break;a[c[O>>2]>>0]=a[Q>>0]|0;c[O>>2]=(c[O>>2]|0)+1;c[P>>2]=(c[P>>2]|0)+-1}vf(c[B>>2]|0);T=c[w>>2]|0;l=n;return T|0}function nl(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;i=l;l=l+112|0;if((l|0)>=(m|0))$(112);j=i+104|0;k=i+100|0;n=i+96|0;o=i+92|0;p=i+88|0;q=i+84|0;r=i+80|0;s=i+76|0;t=i+72|0;u=i+68|0;v=i+64|0;w=i+60|0;x=i+56|0;y=i+52|0;z=i+48|0;A=i+44|0;B=i+40|0;C=i+36|0;E=i+32|0;F=i+109|0;G=i+8|0;H=i+28|0;I=i+24|0;J=i+20|0;K=i+108|0;L=i;M=i+16|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=0;c[s>>2]=0;c[t>>2]=(((c[n>>2]|0)+7|0)>>>0)/8|0;c[w>>2]=0;c[r>>2]=oj(c[o>>2]|0)|0;if(!(c[r>>2]|0))Se(39293,38988,926,39336);c[x>>2]=8+(c[r>>2]|0)+(c[p>>2]|0);if((c[x>>2]|0)>>>0<((c[t>>2]|0)-(c[r>>2]|0)-1|0)>>>0)c[x>>2]=(c[t>>2]|0)-(c[r>>2]|0)-1;c[x>>2]=(c[x>>2]|0)+(c[r>>2]|0);c[w>>2]=pf(c[x>>2]|0)|0;do if(c[w>>2]|0){c[y>>2]=c[w>>2];c[z>>2]=(c[w>>2]|0)+(c[x>>2]|0)+(0-(c[r>>2]|0));c[q>>2]=ll(0,c[z>>2]|0,c[j>>2]|0,c[r>>2]|0)|0;if((c[q>>2]|0)==0?(c[q>>2]=ll(s,0,c[k>>2]|0,c[t>>2]|0)|0,(c[q>>2]|0)==0):0){if((c[t>>2]|0)>>>0<((c[r>>2]|0)+(c[p>>2]|0)+2|0)>>>0){c[q>>2]=66;break}if((d[(c[s>>2]|0)+((c[t>>2]|0)-1)>>0]|0)!=188){c[q>>2]=8;break}c[v>>2]=(c[s>>2]|0)+(c[t>>2]|0)+-1+(0-(c[r>>2]|0));if(d[c[s>>2]>>0]&~(255>>(c[t>>2]<<3)-(c[n>>2]|0))|0){c[q>>2]=8;break}jl(c[y>>2]|0,(c[t>>2]|0)-(c[r>>2]|0)-1|0,c[v>>2]|0,c[r>>2]|0,c[o>>2]|0)|0;c[B>>2]=0;c[A>>2]=c[y>>2];while(1){if((c[B>>2]|0)>>>0>=((c[t>>2]|0)-(c[r>>2]|0)-1|0)>>>0)break;h=(c[s>>2]|0)+(c[B>>2]|0)|0;a[h>>0]=d[h>>0]^d[c[A>>2]>>0];c[B>>2]=(c[B>>2]|0)+1;c[A>>2]=(c[A>>2]|0)+1}h=c[s>>2]|0;a[h>>0]=d[h>>0]&255>>(c[t>>2]<<3)-(c[n>>2]|0);c[B>>2]=0;while(1){if((c[B>>2]|0)>>>0>=((c[t>>2]|0)-(c[r>>2]|0)-(c[p>>2]|0)-2|0)>>>0)break;if(!((a[(c[s>>2]|0)+(c[B>>2]|0)>>0]|0)!=0^1))break;c[B>>2]=(c[B>>2]|0)+1}if((c[B>>2]|0)==((c[t>>2]|0)-(c[r>>2]|0)-(c[p>>2]|0)-2|0)?(h=c[B>>2]|0,c[B>>2]=h+1,(d[(c[s>>2]|0)+h>>0]|0)==1):0){c[u>>2]=(c[s>>2]|0)+(c[B>>2]|0);h=c[w>>2]|0;a[h>>0]=0;a[h+1>>0]=0;a[h+2>>0]=0;a[h+3>>0]=0;a[h+4>>0]=0;a[h+5>>0]=0;a[h+6>>0]=0;a[h+7>>0]=0;_w((c[w>>2]|0)+8|0,c[z>>2]|0,c[r>>2]|0)|0;_w((c[w>>2]|0)+8+(c[r>>2]|0)|0,c[u>>2]|0,c[p>>2]|0)|0;hj(c[o>>2]|0,c[w>>2]|0,c[w>>2]|0,8+(c[r>>2]|0)+(c[p>>2]|0)|0);h=(Jv(c[v>>2]|0,c[w>>2]|0,c[r>>2]|0)|0)!=0;c[q>>2]=h?8:0;break}c[q>>2]=8}}else c[q>>2]=Et()|0;while(0);if(c[s>>2]|0){c[C>>2]=c[s>>2];c[E>>2]=c[t>>2];a[F>>0]=0;t=G;c[t>>2]=d[F>>0];c[t+4>>2]=0;while(1){if(!(c[C>>2]&7|0?(c[E>>2]|0)!=0:0))break;a[c[C>>2]>>0]=a[F>>0]|0;c[C>>2]=(c[C>>2]|0)+1;c[E>>2]=(c[E>>2]|0)+-1}if((c[E>>2]|0)>>>0>=8){t=G;r=gx(c[t>>2]|0,c[t+4>>2]|0,16843009,16843009)|0;t=G;c[t>>2]=r;c[t+4>>2]=D;do{c[H>>2]=c[C>>2];t=G;r=c[t+4>>2]|0;v=c[H>>2]|0;c[v>>2]=c[t>>2];c[v+4>>2]=r;c[E>>2]=(c[E>>2]|0)-8;c[C>>2]=(c[C>>2]|0)+8}while((c[E>>2]|0)>>>0>=8)}while(1){if(!(c[E>>2]|0))break;a[c[C>>2]>>0]=a[F>>0]|0;c[C>>2]=(c[C>>2]|0)+1;c[E>>2]=(c[E>>2]|0)+-1}vf(c[s>>2]|0)}if(!(c[w>>2]|0)){N=c[q>>2]|0;l=i;return N|0}c[I>>2]=c[w>>2];c[J>>2]=c[x>>2];a[K>>0]=0;x=L;c[x>>2]=d[K>>0];c[x+4>>2]=0;while(1){if(!(c[I>>2]&7|0?(c[J>>2]|0)!=0:0))break;a[c[I>>2]>>0]=a[K>>0]|0;c[I>>2]=(c[I>>2]|0)+1;c[J>>2]=(c[J>>2]|0)+-1}if((c[J>>2]|0)>>>0>=8){x=L;s=gx(c[x>>2]|0,c[x+4>>2]|0,16843009,16843009)|0;x=L;c[x>>2]=s;c[x+4>>2]=D;do{c[M>>2]=c[I>>2];x=L;s=c[x+4>>2]|0;E=c[M>>2]|0;c[E>>2]=c[x>>2];c[E+4>>2]=s;c[J>>2]=(c[J>>2]|0)-8;c[I>>2]=(c[I>>2]|0)+8}while((c[J>>2]|0)>>>0>=8)}while(1){if(!(c[J>>2]|0))break;a[c[I>>2]>>0]=a[K>>0]|0;c[I>>2]=(c[I>>2]|0)+1;c[J>>2]=(c[J>>2]|0)+-1}vf(c[w>>2]|0);N=c[q>>2]|0;l=i;return N|0}function ol(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=l;l=l+112|0;if((l|0)>=(m|0))$(112);e=d;f=d+100|0;g=d+96|0;h=d+92|0;i=d+88|0;j=d+84|0;k=d+80|0;n=d+56|0;o=d+52|0;p=d+48|0;q=d+44|0;r=d+40|0;s=d+36|0;c[g>>2]=a;c[h>>2]=b;c[p>>2]=0;c[r>>2]=0;c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;c[n+12>>2]=0;c[n+16>>2]=0;c[n+20>>2]=0;c[i>>2]=Gj(c[g>>2]|0,j)|0;if(c[i>>2]|0){c[f>>2]=c[i>>2];t=c[f>>2]|0;l=d;return t|0}c[i>>2]=Hj(c[g>>2]|0,k)|0;if(c[i>>2]|0){c[f>>2]=c[i>>2];t=c[f>>2]|0;l=d;return t|0}c[q>>2]=Tf(c[g>>2]|0,47178,0)|0;if(c[q>>2]|0?(c[i>>2]=Fj(c[q>>2]|0,p,0)|0,Rf(c[q>>2]|0),c[i>>2]|0):0){c[f>>2]=c[i>>2];t=c[f>>2]|0;l=d;return t|0}if(c[g>>2]|0)u=Tf(c[g>>2]|0,41795,0)|0;else u=0;c[o>>2]=u;if((c[o>>2]|0)==0?(c[q>>2]=Tf(c[g>>2]|0,41808,0)|0,c[q>>2]|0):0){c[p>>2]=c[p>>2]|64;Rf(c[q>>2]|0)}if((!(c[o>>2]|0)?!(c[p>>2]&64|0):0)?!(Wg()|0):0){if((c[p>>2]&32|0)==0?(c[q>>2]=Tf(c[g>>2]|0,48942,0)|0,c[q>>2]|0):0){c[p>>2]=c[p>>2]|32;Rf(c[q>>2]|0)}c[i>>2]=Il(n,c[j>>2]|0,c[k>>2]|0,((c[p>>2]&32|0)!=0^1^1)&1)|0}else v=16;if((v|0)==16?(c[i>>2]=Hl(n,c[j>>2]|0,c[k>>2]|0,c[o>>2]|0,s)|0,Rf(c[o>>2]|0),(c[i>>2]|0)==0&(c[s>>2]|0)!=0):0)c[i>>2]=Sf(r,41817,0,1)|0;if(!(c[i>>2]|0)){s=c[h>>2]|0;h=c[n+4>>2]|0;o=c[n>>2]|0;k=c[n+4>>2]|0;j=c[n+8>>2]|0;v=c[n+12>>2]|0;p=c[n+16>>2]|0;q=c[n+20>>2]|0;g=c[r>>2]|0;c[e>>2]=c[n>>2];c[e+4>>2]=h;c[e+8>>2]=o;c[e+12>>2]=k;c[e+16>>2]=j;c[e+20>>2]=v;c[e+24>>2]=p;c[e+28>>2]=q;c[e+32>>2]=g;c[i>>2]=cg(s,0,41846,e)|0}Dp(c[n>>2]|0);Dp(c[n+4>>2]|0);Dp(c[n+12>>2]|0);Dp(c[n+16>>2]|0);Dp(c[n+8>>2]|0);Dp(c[n+20>>2]|0);Rf(c[r>>2]|0);c[f>>2]=c[i>>2];t=c[f>>2]|0;l=d;return t|0}function pl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+80|0;if((l|0)>=(m|0))$(80);d=b+32|0;e=b;f=b+68|0;g=b+64|0;h=b+40|0;c[f>>2]=a;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;c[h+20>>2]=0;a=c[f>>2]|0;c[e>>2]=h;c[e+4>>2]=h+4;c[e+8>>2]=h+8;c[e+12>>2]=h+12;c[e+16>>2]=h+16;c[e+20>>2]=h+20;c[e+24>>2]=0;c[g>>2]=lg(a,0,39364,e)|0;if((c[g>>2]|0)==0?(Gl(h)|0)==0:0)c[g>>2]=7;Tp(c[h>>2]|0);Tp(c[h+4>>2]|0);Tp(c[h+8>>2]|0);Tp(c[h+12>>2]|0);Tp(c[h+16>>2]|0);Tp(c[h+20>>2]|0);if(!(Ff(1)|0)){i=c[g>>2]|0;l=b;return i|0}c[d>>2]=Bt(c[g>>2]|0)|0;Ye(41773,d);i=c[g>>2]|0;l=b;return i|0}function ql(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=l;l=l+128|0;if((l|0)>=(m|0))$(128);f=e+32|0;g=e+24|0;h=e+16|0;i=e;j=e+116|0;k=e+112|0;n=e+108|0;o=e+104|0;p=e+64|0;q=e+56|0;r=e+48|0;s=e+44|0;t=e+40|0;u=e+36|0;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[q>>2]=0;c[r>>2]=0;c[r+4>>2]=0;c[s>>2]=0;Lj(p,0,ul(c[n>>2]|0)|0);c[o>>2]=Nj(c[k>>2]|0,q,p)|0;do if(!(c[o>>2]|0)){if(Ff(1)|0)af(41643,c[q>>2]|0);if(c[q>>2]|0?c[(c[q>>2]|0)+12>>2]&4|0:0){c[o>>2]=79;break}k=c[n>>2]|0;c[i>>2]=r;c[i+4>>2]=r+4;c[i+8>>2]=0;c[o>>2]=lg(k,0,39361,i)|0;if(!(c[o>>2]|0)){if(Ff(1)|0){af(41660,c[r>>2]|0);af(41677,c[r+4>>2]|0)}c[s>>2]=Rp(0)|0;El(c[s>>2]|0,c[q>>2]|0,r);if(Ff(1)|0)af(41694,c[s>>2]|0);if(!(c[p+12>>2]&4)){k=c[j>>2]|0;c[g>>2]=c[s>>2];c[o>>2]=cg(k,0,41731,g)|0;break}c[u>>2]=(((lo(c[r>>2]|0)|0)+7|0)>>>0)/8|0;c[o>>2]=dp(t,0,c[s>>2]|0,c[u>>2]|0)|0;if(!(c[o>>2]|0)){k=c[j>>2]|0;d=c[t>>2]|0;c[h>>2]=c[u>>2];c[h+4>>2]=d;c[o>>2]=cg(k,0,41711,h)|0;vf(c[t>>2]|0)}}}while(0);Tp(c[s>>2]|0);Tp(c[r>>2]|0);Tp(c[r+4>>2]|0);Tp(c[q>>2]|0);Mj(p);if(!(Ff(1)|0)){v=c[o>>2]|0;l=e;return v|0}c[f>>2]=Bt(c[o>>2]|0)|0;Ye(41751,f);v=c[o>>2]|0;l=e;return v|0}function rl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;e=l;l=l+192|0;if((l|0)>=(m|0))$(192);f=e+64|0;g=e+56|0;h=e+48|0;i=e+40|0;j=e+8|0;k=e;n=e+180|0;o=e+176|0;p=e+172|0;q=e+168|0;r=e+128|0;s=e+124|0;t=e+120|0;u=e+96|0;v=e+88|0;w=e+84|0;x=e+80|0;y=e+76|0;z=e+72|0;A=e+68|0;c[n>>2]=a;c[o>>2]=b;c[p>>2]=d;c[s>>2]=0;c[t>>2]=0;c[u>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;c[u+12>>2]=0;c[u+16>>2]=0;c[u+20>>2]=0;c[v>>2]=0;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;c[A>>2]=0;Lj(r,1,ul(c[p>>2]|0)|0);c[q>>2]=Jj(c[o>>2]|0,7768,s,r)|0;a:do if((c[q>>2]|0)==0?(o=c[s>>2]|0,c[k>>2]=t,c[k+4>>2]=0,c[q>>2]=lg(o,0,39371,k)|0,(c[q>>2]|0)==0):0){if(Ff(1)|0)af(41471,c[t>>2]|0);if(c[t>>2]|0?c[(c[t>>2]|0)+12>>2]&4|0:0){c[q>>2]=79;break}o=c[p>>2]|0;c[j>>2]=u;c[j+4>>2]=u+4;c[j+8>>2]=u+8;c[j+12>>2]=u+12;c[j+16>>2]=u+16;c[j+20>>2]=u+20;c[j+24>>2]=0;c[q>>2]=lg(o,0,41288,j)|0;if(!(c[q>>2]|0)){if(Ff(1)|0?(af(41488,c[u>>2]|0),af(41505,c[u+4>>2]|0),(Wg()|0)==0):0){af(41522,c[u+8>>2]|0);af(41539,c[u+12>>2]|0);af(41556,c[u+16>>2]|0);af(41573,c[u+20>>2]|0)}ko(c[t>>2]|0);xo(c[t>>2]|0,c[t>>2]|0,c[u>>2]|0);c[v>>2]=Sp(c[r+4>>2]|0)|0;if(c[r+12>>2]&1|0)Fl(c[v>>2]|0,c[t>>2]|0,u);else{c[w>>2]=Sp(c[r+4>>2]|0)|0;c[x>>2]=Sp(c[r+4>>2]|0)|0;c[y>>2]=Sp(c[r+4>>2]|0)|0;do{Up(c[w>>2]|0,c[r+4>>2]|0,0);Mo(c[w>>2]|0,c[w>>2]|0,c[u>>2]|0)}while((Lo(c[x>>2]|0,c[w>>2]|0,c[u>>2]|0)|0)!=0^1);So(c[y>>2]|0,c[w>>2]|0,c[u+4>>2]|0,c[u>>2]|0);Ro(c[y>>2]|0,c[y>>2]|0,c[t>>2]|0,c[u>>2]|0);Fl(c[v>>2]|0,c[y>>2]|0,u);Tp(c[y>>2]|0);c[y>>2]=0;Ro(c[v>>2]|0,c[v>>2]|0,c[x>>2]|0,c[u>>2]|0);Tp(c[w>>2]|0);c[w>>2]=0;Tp(c[x>>2]|0);c[x>>2]=0}if(Ff(1)|0)af(41590,c[v>>2]|0);switch(c[r+8>>2]|0){case 1:{c[q>>2]=dl(z,A,c[r+4>>2]|0,c[v>>2]|0)|0;Dp(c[v>>2]|0);c[v>>2]=0;if(c[q>>2]|0)break a;o=c[n>>2]|0;d=c[z>>2]|0;c[i>>2]=c[A>>2];c[i+4>>2]=d;c[q>>2]=cg(o,0,41607,i)|0;break a;break}case 3:{c[q>>2]=kl(z,A,c[r+4>>2]|0,c[r+16>>2]|0,c[v>>2]|0,c[r+20>>2]|0,c[r+24>>2]|0)|0;Dp(c[v>>2]|0);c[v>>2]=0;if(c[q>>2]|0)break a;o=c[n>>2]|0;d=c[z>>2]|0;c[h>>2]=c[A>>2];c[h+4>>2]=d;c[q>>2]=cg(o,0,41607,h)|0;break a;break}default:{o=c[n>>2]|0;d=c[r+12>>2]&8|0?41618:48090;c[g>>2]=c[v>>2];c[q>>2]=cg(o,0,d,g)|0;break a}}}}while(0);vf(c[z>>2]|0);Tp(c[v>>2]|0);Tp(c[u>>2]|0);Tp(c[u+4>>2]|0);Tp(c[u+8>>2]|0);Tp(c[u+12>>2]|0);Tp(c[u+16>>2]|0);Tp(c[u+20>>2]|0);Tp(c[t>>2]|0);Tp(c[w>>2]|0);Tp(c[x>>2]|0);Tp(c[y>>2]|0);Rf(c[s>>2]|0);Mj(r);if(!(Ff(1)|0)){B=c[q>>2]|0;l=e;return B|0}c[f>>2]=Bt(c[q>>2]|0)|0;Ye(41621,f);B=c[q>>2]|0;l=e;return B|0}function sl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=l;l=l+160|0;if((l|0)>=(m|0))$(160);f=e+48|0;g=e+40|0;h=e+32|0;i=e;j=e+148|0;k=e+144|0;n=e+140|0;o=e+136|0;p=e+96|0;q=e+88|0;r=e+64|0;s=e+60|0;t=e+56|0;u=e+52|0;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[q>>2]=0;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;c[r+12>>2]=0;c[r+16>>2]=0;c[r+20>>2]=0;c[s>>2]=0;Lj(p,2,ul(c[n>>2]|0)|0);c[o>>2]=Nj(c[k>>2]|0,q,p)|0;do if(!(c[o>>2]|0)){if(Ff(1)|0)af(41272,c[q>>2]|0);if(c[q>>2]|0?c[(c[q>>2]|0)+12>>2]&4|0:0){c[o>>2]=79;break}k=c[n>>2]|0;c[i>>2]=r;c[i+4>>2]=r+4;c[i+8>>2]=r+8;c[i+12>>2]=r+12;c[i+16>>2]=r+16;c[i+20>>2]=r+20;c[i+24>>2]=0;c[o>>2]=lg(k,0,41288,i)|0;if(!(c[o>>2]|0)){if(Ff(1)|0?(af(41298,c[r>>2]|0),af(41314,c[r+4>>2]|0),(Wg()|0)==0):0){af(41330,c[r+8>>2]|0);af(41346,c[r+12>>2]|0);af(41362,c[r+16>>2]|0);af(41378,c[r+20>>2]|0)}c[s>>2]=Rp(0)|0;Fl(c[s>>2]|0,c[q>>2]|0,r);if(Ff(1)|0)af(41394,c[s>>2]|0);if(!(c[p+12>>2]&4)){k=c[j>>2]|0;c[g>>2]=c[s>>2];c[o>>2]=cg(k,0,41430,g)|0;break}c[u>>2]=(((lo(c[r>>2]|0)|0)+7|0)>>>0)/8|0;c[o>>2]=dp(t,0,c[s>>2]|0,c[u>>2]|0)|0;if(!(c[o>>2]|0)){k=c[j>>2]|0;d=c[t>>2]|0;c[h>>2]=c[u>>2];c[h+4>>2]=d;c[o>>2]=cg(k,0,41410,h)|0;vf(c[t>>2]|0)}}}while(0);Tp(c[s>>2]|0);Tp(c[r>>2]|0);Tp(c[r+4>>2]|0);Tp(c[r+8>>2]|0);Tp(c[r+12>>2]|0);Tp(c[r+16>>2]|0);Tp(c[r+20>>2]|0);Tp(c[q>>2]|0);Mj(p);if(!(Ff(1)|0)){v=c[o>>2]|0;l=e;return v|0}c[f>>2]=Bt(c[o>>2]|0)|0;Ye(41450,f);v=c[o>>2]|0;l=e;return v|0}function tl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=l;l=l+112|0;if((l|0)>=(m|0))$(112);f=e+24|0;g=e+8|0;h=e;i=e+108|0;j=e+104|0;k=e+100|0;n=e+96|0;o=e+56|0;p=e+48|0;q=e+44|0;r=e+40|0;s=e+32|0;t=e+28|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[p>>2]=0;c[q>>2]=0;c[r>>2]=0;c[s>>2]=0;c[s+4>>2]=0;c[t>>2]=0;Lj(o,3,ul(c[k>>2]|0)|0);c[n>>2]=Nj(c[j>>2]|0,r,o)|0;do if(!(c[n>>2]|0)){if(Ff(1)|0)af(41171,c[r>>2]|0);if(c[r>>2]|0?c[(c[r>>2]|0)+12>>2]&4|0:0){c[n>>2]=79;break}c[n>>2]=Ij(c[i>>2]|0,7768,p,0)|0;if((c[n>>2]|0)==0?(j=c[p>>2]|0,c[h>>2]=q,c[h+4>>2]=0,c[n>>2]=lg(j,0,39373,h)|0,(c[n>>2]|0)==0):0){if(Ff(1)|0)af(41187,c[q>>2]|0);j=c[k>>2]|0;c[g>>2]=s;c[g+4>>2]=s+4;c[g+8>>2]=0;c[n>>2]=lg(j,0,39361,g)|0;if(!(c[n>>2]|0)){if(Ff(1)|0){af(41203,c[s>>2]|0);af(41219,c[s+4>>2]|0)}c[t>>2]=Rp(0)|0;El(c[t>>2]|0,c[q>>2]|0,s);if(Ff(1)|0)af(41235,c[t>>2]|0);if(c[o+32>>2]|0){c[n>>2]=Db[c[o+32>>2]&7](o,c[t>>2]|0)|0;break}else{j=(wo(c[t>>2]|0,c[r>>2]|0)|0)!=0;c[n>>2]=j?8:0;break}}}}while(0);Tp(c[t>>2]|0);Tp(c[s>>2]|0);Tp(c[s+4>>2]|0);Tp(c[r>>2]|0);Tp(c[q>>2]|0);Rf(c[p>>2]|0);Mj(o);if(!(Ff(1)|0)){u=c[n>>2]|0;l=e;return u|0}if(c[n>>2]|0)v=Bt(c[n>>2]|0)|0;else v=47493;c[f>>2]=v;Ye(41251,f);u=c[n>>2]|0;l=e;return u|0}function ul(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+16|0;e=b+12|0;f=b+8|0;g=b+4|0;h=b;c[e>>2]=a;c[f>>2]=Tf(c[e>>2]|0,39375,1)|0;if(!(c[f>>2]|0)){c[d>>2]=0;i=c[d>>2]|0;l=b;return i|0}c[g>>2]=$f(c[f>>2]|0,1,5)|0;Rf(c[f>>2]|0);if(c[g>>2]|0)j=lo(c[g>>2]|0)|0;else j=0;c[h>>2]=j;Tp(c[g>>2]|0);c[d>>2]=c[h>>2];i=c[d>>2]|0;l=b;return i|0}function vl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+4|0;h=e;c[f>>2]=a;c[e+8>>2]=b;c[g>>2]=d;if((c[f>>2]|0)==1){c[h>>2]=xl(c[g>>2]|0)|0;i=c[h>>2]|0;l=e;return i|0}else{c[h>>2]=4;i=c[h>>2]|0;l=e;return i|0}return 0}function wl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=Tf(c[g>>2]|0,39375,1)|0;if(!(c[h>>2]|0)){c[e>>2]=68;k=c[e>>2]|0;l=d;return k|0}c[i>>2]=Xf(c[h>>2]|0,1,j)|0;if(c[i>>2]|0){$i(c[f>>2]|0,c[i>>2]|0,c[j>>2]|0);Rf(c[h>>2]|0);c[e>>2]=0;k=c[e>>2]|0;l=d;return k|0}else{Rf(c[h>>2]|0);c[e>>2]=68;k=c[e>>2]|0;l=d;return k|0}return 0}function xl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+24|0;e=b+20|0;f=b+16|0;g=b+12|0;h=b+8|0;i=b+4|0;j=b;c[e>>2]=a;c[i>>2]=0;c[j>>2]=0;c[f>>2]=39377;c[h>>2]=eg(i,0,39385,hv(39385)|0)|0;if(!(c[h>>2]|0))c[h>>2]=eg(j,0,40415,hv(40415)|0)|0;do if(!(c[h>>2]|0)){c[f>>2]=40732;c[h>>2]=Yj(c[i>>2]|0)|0;if(c[h>>2]|0){c[g>>2]=yl(c[h>>2]|0)|0;break}c[f>>2]=40748;c[g>>2]=zl(c[j>>2]|0,c[i>>2]|0)|0;if((c[g>>2]|0)==0?(c[f>>2]=40753,c[g>>2]=Al(c[j>>2]|0,c[i>>2]|0)|0,(c[g>>2]|0)==0):0){Rf(c[j>>2]|0);Rf(c[i>>2]|0);c[d>>2]=0;k=c[d>>2]|0;l=b;return k|0}}else c[g>>2]=yl(c[h>>2]|0)|0;while(0);Rf(c[j>>2]|0);Rf(c[i>>2]|0);if(c[e>>2]|0)Eb[c[e>>2]&1](47252,1,c[f>>2]|0,c[g>>2]|0);c[d>>2]=50;k=c[d>>2]|0;l=b;return k|0}function yl(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Bt(c[d>>2]|0)|0;l=b;return a|0}function zl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+24|0;f=d+20|0;g=d+16|0;h=d+12|0;i=d+8|0;j=d+4|0;k=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=0;c[i>>2]=0;c[j>>2]=0;c[k>>2]=0;c[h>>2]=eg(i,0,40963,hv(40963)|0)|0;if(!(c[h>>2]|0))c[h>>2]=eg(j,0,41039,hv(41039)|0)|0;do if(!(c[h>>2]|0)){c[h>>2]=Wj(k,c[i>>2]|0,c[f>>2]|0)|0;if(c[h>>2]|0){c[g>>2]=41115;break}c[h>>2]=Xj(c[k>>2]|0,c[i>>2]|0,c[e>>2]|0)|0;if(c[h>>2]|0){c[g>>2]=41130;break}c[h>>2]=Xj(c[k>>2]|0,c[j>>2]|0,c[e>>2]|0)|0;if((Cl(c[h>>2]|0)|0)!=8)c[g>>2]=41144}else c[g>>2]=40791;while(0);Rf(c[k>>2]|0);Rf(c[j>>2]|0);Rf(c[i>>2]|0);l=d;return c[g>>2]|0}function Al(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;d=l;l=l+64|0;if((l|0)>=(m|0))$(64);e=d;f=d+48|0;g=d+44|0;h=d+40|0;i=d+36|0;j=d+28|0;k=d+24|0;n=d+20|0;o=d+16|0;p=d+12|0;q=d+8|0;r=d+4|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=0;c[d+32>>2]=1e3;c[j>>2]=0;c[k>>2]=0;c[n>>2]=0;c[o>>2]=0;c[p>>2]=0;c[q>>2]=0;c[r>>2]=0;c[j>>2]=Rp(1e3)|0;Up(c[j>>2]|0,1e3,0);c[e>>2]=c[j>>2];c[i>>2]=cg(k,0,40761,e)|0;do if(!(c[i>>2]|0)){c[i>>2]=Tj(n,c[k>>2]|0,c[f>>2]|0)|0;if(c[i>>2]|0){c[h>>2]=40814;break}c[o>>2]=Bl(c[n>>2]|0)|0;if(!(c[o>>2]|0)){c[h>>2]=40829;break}if(!(wo(c[j>>2]|0,c[o>>2]|0)|0)){c[h>>2]=40862;break}c[i>>2]=Vj(p,c[n>>2]|0,c[g>>2]|0)|0;if(c[i>>2]|0){c[h>>2]=40891;break}c[r>>2]=Tf(c[p>>2]|0,40906,0)|0;if(c[r>>2]|0)c[q>>2]=$f(c[r>>2]|0,1,5)|0;else c[q>>2]=$f(c[p>>2]|0,0,5)|0;if(!(c[q>>2]|0)){c[h>>2]=40912;break}if(wo(c[j>>2]|0,c[q>>2]|0)|0)c[h>>2]=40942}else c[h>>2]=40791;while(0);Rf(c[r>>2]|0);Tp(c[q>>2]|0);Rf(c[p>>2]|0);Tp(c[o>>2]|0);Rf(c[n>>2]|0);Rf(c[k>>2]|0);Tp(c[j>>2]|0);l=d;return c[h>>2]|0}function Bl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+20|0;e=b+16|0;f=b+12|0;g=b+8|0;h=b+4|0;i=b;c[e>>2]=a;c[f>>2]=Tf(c[e>>2]|0,40951,0)|0;if(!(c[f>>2]|0)){c[d>>2]=0;j=c[d>>2]|0;l=b;return j|0}c[g>>2]=Tf(c[f>>2]|0,40959,0)|0;Rf(c[f>>2]|0);if(!(c[g>>2]|0)){c[d>>2]=0;j=c[d>>2]|0;l=b;return j|0}c[h>>2]=Tf(c[g>>2]|0,39371,0)|0;Rf(c[g>>2]|0);if(c[h>>2]|0){c[i>>2]=$f(c[h>>2]|0,1,0)|0;Rf(c[h>>2]|0);c[d>>2]=c[i>>2];j=c[d>>2]|0;l=b;return j|0}else{c[d>>2]=0;j=c[d>>2]|0;l=b;return j|0}return 0}function Cl(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Dl(c[d>>2]|0)|0;l=b;return a|0}function Dl(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return c[d>>2]&65535|0}function El(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if((c[f>>2]|0)==(c[g>>2]|0)){c[i>>2]=vp(c[(c[g>>2]|0)+4>>2]<<1)|0;So(c[i>>2]|0,c[g>>2]|0,c[(c[h>>2]|0)+4>>2]|0,c[c[h>>2]>>2]|0);Kp(c[f>>2]|0,c[i>>2]|0)|0;Dp(c[i>>2]|0);l=e;return}else{So(c[f>>2]|0,c[g>>2]|0,c[(c[h>>2]|0)+4>>2]|0,c[c[h>>2]>>2]|0);l=e;return}}function Fl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;ko(c[g>>2]|0);if((c[(c[h>>2]|0)+12>>2]|0?c[(c[h>>2]|0)+16>>2]|0:0)?c[(c[h>>2]|0)+20>>2]|0:0){c[i>>2]=xp((c[(c[c[h>>2]>>2]|0)+4>>2]|0)+1|0)|0;c[j>>2]=xp((c[(c[c[h>>2]>>2]|0)+4>>2]|0)+1|0)|0;c[k>>2]=xp((c[(c[c[h>>2]>>2]|0)+4>>2]|0)+1|0)|0;go(c[k>>2]|0,c[(c[h>>2]|0)+12>>2]|0,1);xo(c[k>>2]|0,c[(c[h>>2]|0)+8>>2]|0,c[k>>2]|0);So(c[i>>2]|0,c[g>>2]|0,c[k>>2]|0,c[(c[h>>2]|0)+12>>2]|0);go(c[k>>2]|0,c[(c[h>>2]|0)+16>>2]|0,1);xo(c[k>>2]|0,c[(c[h>>2]|0)+8>>2]|0,c[k>>2]|0);So(c[j>>2]|0,c[g>>2]|0,c[k>>2]|0,c[(c[h>>2]|0)+16>>2]|0);ho(c[k>>2]|0,c[j>>2]|0,c[i>>2]|0);if(c[(c[k>>2]|0)+8>>2]|0)fo(c[k>>2]|0,c[k>>2]|0,c[(c[h>>2]|0)+16>>2]|0);Ro(c[k>>2]|0,c[(c[h>>2]|0)+20>>2]|0,c[k>>2]|0,c[(c[h>>2]|0)+16>>2]|0);Qo(c[k>>2]|0,c[k>>2]|0,c[(c[h>>2]|0)+12>>2]|0);fo(c[f>>2]|0,c[i>>2]|0,c[k>>2]|0);Dp(c[k>>2]|0);Dp(c[i>>2]|0);Dp(c[j>>2]|0);l=e;return}So(c[f>>2]|0,c[g>>2]|0,c[(c[h>>2]|0)+8>>2]|0,c[c[h>>2]>>2]|0);l=e;return}function Gl(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[f>>2]=vp(c[(c[(c[d>>2]|0)+12>>2]|0)+4>>2]<<1)|0;Qo(c[f>>2]|0,c[(c[d>>2]|0)+12>>2]|0,c[(c[d>>2]|0)+16>>2]|0);c[e>>2]=wo(c[f>>2]|0,c[c[d>>2]>>2]|0)|0;Dp(c[f>>2]|0);l=b;return ((c[e>>2]|0)!=0^1)&1|0}function Hl(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;g=l;l=l+176|0;if((l|0)>=(m|0))$(176);h=g;i=g+164|0;j=g+160|0;k=g+156|0;n=g+152|0;o=g+148|0;p=g+144|0;q=g+140|0;r=g+136|0;s=g+132|0;t=g+128|0;u=g+124|0;v=g+120|0;w=g+116|0;x=g+112|0;y=g+108|0;z=g+104|0;A=g+100|0;B=g+96|0;C=g+92|0;D=g+88|0;E=g+84|0;F=g+80|0;G=g+76|0;H=g+72|0;I=g+16|0;J=g+8|0;K=g+4|0;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[c[p>>2]>>2]=0;if((c[n>>2]|0)==1)c[n>>2]=65537;if((c[k>>2]|0)>>>0>=1024?(((c[k>>2]|0)>>>0)%256|0|0)==0:0){if((c[n>>2]|0)>>>0<3){c[i>>2]=55;L=c[i>>2]|0;l=g;return L|0}if(!(c[n>>2]&1)){c[i>>2]=55;L=c[i>>2]|0;l=g;return L|0}c[B>>2]=0;c[C>>2]=0;c[D>>2]=0;c[E>>2]=0;c[F>>2]=0;c[G>>2]=0;if(c[o>>2]|0){f=I;e=f+56|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(e|0));c[I>>2]=42052;c[I+8>>2]=42056;c[I+16>>2]=42060;c[I+24>>2]=42063;c[I+32>>2]=42067;c[I+40>>2]=42071;c[I+4>>2]=B;c[I+8+4>>2]=C;c[I+16+4>>2]=D;c[I+24+4>>2]=E;c[I+32+4>>2]=F;c[I+40+4>>2]=G;c[J>>2]=0;while(1){if(!(c[I+(c[J>>2]<<3)>>2]|0))break;c[K>>2]=Tf(c[o>>2]|0,c[I+(c[J>>2]<<3)>>2]|0,0)|0;if(c[K>>2]|0){f=$f(c[K>>2]|0,1,5)|0;c[c[I+(c[J>>2]<<3)+4>>2]>>2]=f;Rf(c[K>>2]|0)}c[J>>2]=(c[J>>2]|0)+1}c[J>>2]=0;while(1){if(!(c[I+(c[J>>2]<<3)>>2]|0))break;if(!(c[c[I+(c[J>>2]<<3)+4>>2]>>2]|0))break;c[J>>2]=(c[J>>2]|0)+1}if(c[I+(c[J>>2]<<3)>>2]|0){c[J>>2]=0;while(1){if(!(c[I+(c[J>>2]<<3)>>2]|0))break;Tp(c[c[I+(c[J>>2]<<3)+4>>2]>>2]|0);c[J>>2]=(c[J>>2]|0)+1}c[i>>2]=128;L=c[i>>2]|0;l=g;return L|0}}else{c[D>>2]=Ll(((c[k>>2]|0)>>>0)/2|0)|0;c[H>>2]=Sp(((c[k>>2]|0)>>>0)/2|0)|0;do{Tp(c[G>>2]|0);c[G>>2]=Ll(((c[k>>2]|0)>>>0)/2|0)|0;ho(c[H>>2]|0,c[D>>2]|0,c[G>>2]|0);J=lo(c[H>>2]|0)|0}while(J>>>0<=((((c[k>>2]|0)>>>0)/2|0)-100|0)>>>0);Tp(c[H>>2]|0);c[B>>2]=Ml()|0;c[C>>2]=Ml()|0;c[E>>2]=Ml()|0;c[F>>2]=Ml()|0}c[s>>2]=up(c[n>>2]|0)|0;c[q>>2]=Dj(c[D>>2]|0,c[B>>2]|0,c[C>>2]|0,c[s>>2]|0,0,0)|0;c[r>>2]=Dj(c[G>>2]|0,c[E>>2]|0,c[F>>2]|0,c[s>>2]|0,0,0)|0;Tp(c[D>>2]|0);c[D>>2]=0;Tp(c[B>>2]|0);c[B>>2]=0;Tp(c[C>>2]|0);c[C>>2]=0;Tp(c[G>>2]|0);c[G>>2]=0;Tp(c[E>>2]|0);c[E>>2]=0;Tp(c[F>>2]|0);c[F>>2]=0;F=c[q>>2]|0;if(!((c[q>>2]|0)!=0&(c[r>>2]|0)!=0)){Tp(F);Tp(c[r>>2]|0);Tp(c[s>>2]|0);c[i>>2]=21;L=c[i>>2]|0;l=g;return L|0}if((wo(F,c[r>>2]|0)|0)>0){Pp(c[q>>2]|0,c[r>>2]|0);c[c[p>>2]>>2]=1}c[t>>2]=Rp(c[k>>2]|0)|0;Qo(c[t>>2]|0,c[q>>2]|0,c[r>>2]|0);c[w>>2]=Sp(((c[k>>2]|0)>>>0)/2|0)|0;c[x>>2]=Sp(((c[k>>2]|0)>>>0)/2|0)|0;c[y>>2]=Sp(c[k>>2]|0)|0;go(c[w>>2]|0,c[q>>2]|0,1);go(c[x>>2]|0,c[r>>2]|0,1);Qo(c[y>>2]|0,c[w>>2]|0,c[x>>2]|0);c[A>>2]=Sp(c[k>>2]|0)|0;if(!(Fo(c[A>>2]|0,c[s>>2]|0,c[y>>2]|0)|0))Se(42074,41941,541,42108);Fo(c[A>>2]|0,c[w>>2]|0,c[x>>2]|0)|0;c[z>>2]=c[w>>2];c[w>>2]=0;Tp(c[x>>2]|0);c[x>>2]=0;Bo(c[z>>2]|0,c[y>>2]|0,c[A>>2]|0);Tp(c[y>>2]|0);c[y>>2]=0;c[u>>2]=c[A>>2];c[A>>2]=0;Lo(c[u>>2]|0,c[s>>2]|0,c[z>>2]|0)|0;c[v>>2]=c[z>>2];c[z>>2]=0;Lo(c[v>>2]|0,c[q>>2]|0,c[r>>2]|0)|0;if(Ff(1)|0){if(c[c[p>>2]>>2]|0)Ye(42122,h);af(45756,c[q>>2]|0);af(42143,c[r>>2]|0);af(42147,c[t>>2]|0);af(42151,c[s>>2]|0);af(42155,c[u>>2]|0);af(42159,c[v>>2]|0)}c[c[j>>2]>>2]=c[t>>2];c[(c[j>>2]|0)+4>>2]=c[s>>2];c[(c[j>>2]|0)+12>>2]=c[q>>2];c[(c[j>>2]|0)+16>>2]=c[r>>2];c[(c[j>>2]|0)+8>>2]=c[u>>2];c[(c[j>>2]|0)+20>>2]=c[v>>2];if(Kl(c[j>>2]|0,(c[k>>2]|0)-64|0)|0){Tp(c[c[j>>2]>>2]|0);c[c[j>>2]>>2]=0;Tp(c[(c[j>>2]|0)+4>>2]|0);c[(c[j>>2]|0)+4>>2]=0;Tp(c[(c[j>>2]|0)+12>>2]|0);c[(c[j>>2]|0)+12>>2]=0;Tp(c[(c[j>>2]|0)+16>>2]|0);c[(c[j>>2]|0)+16>>2]=0;Tp(c[(c[j>>2]|0)+8>>2]|0);c[(c[j>>2]|0)+8>>2]=0;Tp(c[(c[j>>2]|0)+20>>2]|0);c[(c[j>>2]|0)+20>>2]=0;dh(41941,586,42108,0,42014);c[i>>2]=50;L=c[i>>2]|0;l=g;return L|0}else{c[i>>2]=0;L=c[i>>2]|0;l=g;return L|0}}c[i>>2]=55;L=c[i>>2]|0;l=g;return L|0}function Il(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;f=l;l=l+80|0;if((l|0)>=(m|0))$(80);g=f+64|0;h=f+60|0;i=f+56|0;j=f+52|0;k=f+48|0;n=f+44|0;o=f+40|0;p=f+36|0;q=f+32|0;r=f+28|0;s=f+24|0;t=f+20|0;u=f+16|0;v=f+12|0;w=f+8|0;x=f+4|0;y=f;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if(Wg()|0){if((c[i>>2]|0)>>>0<1024){c[g>>2]=55;z=c[g>>2]|0;l=f;return z|0}if(c[k>>2]|0){c[g>>2]=55;z=c[g>>2]|0;l=f;return z|0}}c[y>>2]=c[k>>2]|0?1:2;if(c[i>>2]&1|0)c[i>>2]=(c[i>>2]|0)+1;if((c[j>>2]|0)==1)c[j>>2]=65537;c[u>>2]=vp(1)|0;if(c[j>>2]|0){c[j>>2]=c[j>>2]|1;Op(c[u>>2]|0,c[j>>2]|0)|0}else Op(c[u>>2]|0,41)|0;c[t>>2]=Rp(c[i>>2]|0)|0;c[o>>2]=0;c[n>>2]=0;do{if(c[n>>2]|0)Tp(c[n>>2]|0);if(c[o>>2]|0)Tp(c[o>>2]|0);k=((c[i>>2]|0)>>>0)/2|0;e=c[y>>2]|0;if(c[j>>2]|0){c[n>>2]=yj(k,e,6,c[u>>2]|0)|0;c[o>>2]=yj(((c[i>>2]|0)>>>0)/2|0,c[y>>2]|0,6,c[u>>2]|0)|0}else{c[n>>2]=yj(k,e,0,0)|0;c[o>>2]=yj(((c[i>>2]|0)>>>0)/2|0,c[y>>2]|0,0,0)|0}if((wo(c[n>>2]|0,c[o>>2]|0)|0)>0)Pp(c[n>>2]|0,c[o>>2]|0);Qo(c[t>>2]|0,c[n>>2]|0,c[o>>2]|0);e=lo(c[t>>2]|0)|0}while((e|0)!=(c[i>>2]|0));c[r>>2]=xp(c[(c[n>>2]|0)+4>>2]|0)|0;c[s>>2]=xp(c[(c[n>>2]|0)+4>>2]|0)|0;c[v>>2]=Sp(c[i>>2]|0)|0;c[w>>2]=Sp(c[i>>2]|0)|0;c[x>>2]=Sp(c[i>>2]|0)|0;go(c[r>>2]|0,c[n>>2]|0,1);go(c[s>>2]|0,c[o>>2]|0,1);Qo(c[v>>2]|0,c[r>>2]|0,c[s>>2]|0);Fo(c[w>>2]|0,c[r>>2]|0,c[s>>2]|0)|0;Bo(c[x>>2]|0,c[v>>2]|0,c[w>>2]|0);while(1){if(!((Fo(c[r>>2]|0,c[u>>2]|0,c[v>>2]|0)|0)!=0^1))break;if(c[j>>2]|0){A=27;break}eo(c[u>>2]|0,c[u>>2]|0,2)}if((A|0)==27)Re(41941,287,41947);c[p>>2]=Sp(c[i>>2]|0)|0;Lo(c[p>>2]|0,c[u>>2]|0,c[x>>2]|0)|0;c[q>>2]=Sp(c[i>>2]|0)|0;Lo(c[q>>2]|0,c[n>>2]|0,c[o>>2]|0)|0;if(Ff(1)|0){af(41960,c[n>>2]|0);af(41966,c[o>>2]|0);af(41972,c[v>>2]|0);af(41978,c[w>>2]|0);af(41984,c[x>>2]|0);af(41990,c[t>>2]|0);af(41996,c[u>>2]|0);af(42002,c[p>>2]|0);af(42008,c[q>>2]|0)}Tp(c[r>>2]|0);Tp(c[s>>2]|0);Tp(c[v>>2]|0);Tp(c[x>>2]|0);Tp(c[w>>2]|0);c[c[h>>2]>>2]=c[t>>2];c[(c[h>>2]|0)+4>>2]=c[u>>2];c[(c[h>>2]|0)+12>>2]=c[n>>2];c[(c[h>>2]|0)+16>>2]=c[o>>2];c[(c[h>>2]|0)+8>>2]=c[p>>2];c[(c[h>>2]|0)+20>>2]=c[q>>2];if(Kl(c[h>>2]|0,(c[i>>2]|0)-64|0)|0){Tp(c[c[h>>2]>>2]|0);c[c[h>>2]>>2]=0;Tp(c[(c[h>>2]|0)+4>>2]|0);c[(c[h>>2]|0)+4>>2]=0;Tp(c[(c[h>>2]|0)+12>>2]|0);c[(c[h>>2]|0)+12>>2]=0;Tp(c[(c[h>>2]|0)+16>>2]|0);c[(c[h>>2]|0)+16>>2]=0;Tp(c[(c[h>>2]|0)+8>>2]|0);c[(c[h>>2]|0)+8>>2]=0;Tp(c[(c[h>>2]|0)+20>>2]|0);c[(c[h>>2]|0)+20>>2]=0;dh(41941,334,41947,0,42014);c[g>>2]=50;z=c[g>>2]|0;l=f;return z|0}else{c[g>>2]=0;z=c[g>>2]|0;l=f;return z|0}return 0}function Jl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[e>>2];go(c[f>>2]|0,c[f>>2]|0,1);c[h>>2]=Lp(c[f>>2]|0)|0;c[i>>2]=((Fo(c[h>>2]|0,c[g>>2]|0,c[f>>2]|0)|0)!=0^1)&1;Tp(c[h>>2]|0);eo(c[f>>2]|0,c[f>>2]|0,1);l=d;return c[i>>2]|0}function Kl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+32|0;f=d+28|0;g=d+24|0;h=d+16|0;i=d+12|0;j=d+8|0;k=d+4|0;n=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=-1;c[i>>2]=Rp(c[f>>2]|0)|0;c[j>>2]=Rp(c[f>>2]|0)|0;c[k>>2]=Rp(c[f>>2]|0)|0;c[n>>2]=Rp(c[f>>2]|0)|0;c[h>>2]=c[c[e>>2]>>2];c[h+4>>2]=c[(c[e>>2]|0)+4>>2];Up(c[i>>2]|0,c[f>>2]|0,0);El(c[j>>2]|0,c[i>>2]|0,h);if(((wo(c[j>>2]|0,c[i>>2]|0)|0?(Fl(c[k>>2]|0,c[j>>2]|0,c[e>>2]|0),(wo(c[k>>2]|0,c[i>>2]|0)|0)==0):0)?(Up(c[i>>2]|0,c[f>>2]|0,0),Fl(c[n>>2]|0,c[i>>2]|0,c[e>>2]|0),El(c[k>>2]|0,c[n>>2]|0,h),(wo(c[k>>2]|0,c[i>>2]|0)|0)==0):0)?(eo(c[n>>2]|0,c[n>>2]|0,1),El(c[k>>2]|0,c[n>>2]|0,h),wo(c[k>>2]|0,c[i>>2]|0)|0):0)c[g>>2]=0;Tp(c[n>>2]|0);Tp(c[k>>2]|0);Tp(c[j>>2]|0);Tp(c[i>>2]|0);l=d;return c[g>>2]|0}function Ll(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=Sp(c[d>>2]|0)|0;Up(c[e>>2]|0,c[d>>2]|0,2);oo(c[e>>2]|0,(c[d>>2]|0)-1|0);no(c[e>>2]|0,(c[d>>2]|0)-2|0);a=lo(c[e>>2]|0)|0;if((a|0)==(c[d>>2]|0)){l=b;return c[e>>2]|0}else Se(42214,41941,360,42250);return 0}function Ml(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;c[b>>2]=Sp(101)|0;Up(c[b>>2]|0,101,2);oo(c[b>>2]|0,100);if((lo(c[b>>2]|0)|0)==101){l=a;return c[b>>2]|0}else Se(42163,41941,375,42197);return 0}function Nl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+4|0;c[e>>2]=a;c[d+8>>2]=b;c[f>>2]=c[e>>2];c[d>>2]=pg()|0;c[(c[f>>2]|0)+160>>2]=1732584193;c[(c[f>>2]|0)+164>>2]=-271733879;c[(c[f>>2]|0)+168>>2]=-1732584194;c[(c[f>>2]|0)+172>>2]=271733878;c[(c[f>>2]|0)+176>>2]=-1009589776;e=(c[f>>2]|0)+128|0;c[e>>2]=0;c[e+4>>2]=0;e=(c[f>>2]|0)+136|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[f>>2]|0)+144>>2]=0;c[(c[f>>2]|0)+148>>2]=64;c[(c[f>>2]|0)+152>>2]=32;l=d;return} -function Ks(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f;h=f+12|0;i=f+8|0;j=f+4|0;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(!(c[h>>2]|0))Se(52740,51405,685,52763);if(!(c[j>>2]|0))Se(51625,51405,686,52763);Es(c[j>>2]|0);do if(!(c[(c[j>>2]|0)+4>>2]|0)){if((c[j>>2]|0)==(c[17790]|0)){e=Ls(1)|0;c[(c[j>>2]|0)+4>>2]=e}else{e=Ls(0)|0;c[(c[j>>2]|0)+4>>2]=e}if(c[(c[j>>2]|0)+4>>2]|0){e=_v()|0;c[(c[j>>2]|0)+60>>2]=e;break}else We(51687,g)}while(0);if(!((a[(c[j>>2]|0)+8>>0]<<7&255)<<24>>24>>7<<24>>24))Ms(c[j>>2]|0);e=c[(c[j>>2]|0)+60>>2]|0;if((e|0)==(_v()|0)?(e=c[(c[j>>2]|0)+64>>2]|0,(e|0)==(_v()|0)):0)if(Ns(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0)We(51687,g);else{Es(c[j>>2]|0);l=f;return}dh(51405,714,52763,0,51633);We(51687,g)}function Ls(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=l;l=l+64|0;if((l|0)>=(m|0))$(64);f=e+16|0;g=e+8|0;h=e+48|0;i=e+44|0;j=e+40|0;k=e+36|0;n=e+32|0;o=e+28|0;p=e+24|0;q=e+52|0;r=e;s=e+20|0;c[i>>2]=b;if(!(c[17793]|0))Se(51716,51405,596,52094);c[k>>2]=wh(j,7,1,1)|0;if(c[k>>2]|0){c[g>>2]=Ss(c[k>>2]|0)|0;Ve(52112,g);c[h>>2]=0;t=c[h>>2]|0;l=e;return t|0}if(c[i>>2]|0){c[n>>2]=zf(16)|0;Ks(c[n>>2]|0,16,c[17791]|0)}else c[n>>2]=Us(16)|0;c[k>>2]=Jh(c[j>>2]|0,c[n>>2]|0,16)|0;c[o>>2]=c[n>>2];c[p>>2]=16;a[q>>0]=0;i=r;c[i>>2]=d[q>>0];c[i+4>>2]=0;while(1){if(!(c[o>>2]&7|0?(c[p>>2]|0)!=0:0))break;a[c[o>>2]>>0]=a[q>>0]|0;c[o>>2]=(c[o>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+-1}if((c[p>>2]|0)>>>0>=8){i=r;g=gx(c[i>>2]|0,c[i+4>>2]|0,16843009,16843009)|0;i=r;c[i>>2]=g;c[i+4>>2]=D;do{c[s>>2]=c[o>>2];i=r;g=c[i+4>>2]|0;b=c[s>>2]|0;c[b>>2]=c[i>>2];c[b+4>>2]=g;c[p>>2]=(c[p>>2]|0)-8;c[o>>2]=(c[o>>2]|0)+8}while((c[p>>2]|0)>>>0>=8)}while(1){if(!(c[p>>2]|0))break;a[c[o>>2]>>0]=a[q>>0]|0;c[o>>2]=(c[o>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+-1}vf(c[n>>2]|0);if(c[k>>2]|0){c[f>>2]=Ss(c[k>>2]|0)|0;Ve(52155,f);Bh(c[j>>2]|0);c[h>>2]=0;t=c[h>>2]|0;l=e;return t|0}else{c[h>>2]=c[j>>2];t=c[h>>2]|0;l=e;return t|0}return 0}function Ms(b){b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;if(!(c[17793]|0))Se(51716,51405,658,51957);b=(c[e>>2]|0)+17|0;if((c[e>>2]|0)==(c[17790]|0)){Ks(b,16,c[17791]|0);f=(c[e>>2]|0)+8|0;a[f>>0]=a[f>>0]&-2|1;f=_v()|0;c[(c[e>>2]|0)+64>>2]=f;l=d;return}else{Ts(b,16);b=(c[e>>2]|0)+8|0;a[b>>0]=a[b>>0]&-2|1;b=_v()|0;c[(c[e>>2]|0)+64>>2]=b;l=d;return}}function Ns(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;g=l;l=l+80|0;if((l|0)>=(m|0))$(80);h=g+48|0;i=g+44|0;j=g+40|0;k=g+36|0;n=g+56|0;o=g+32|0;p=g+28|0;q=g+24|0;r=g+20|0;s=g+16|0;t=g+12|0;u=g+52|0;v=g;w=g+8|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;if(!(c[17793]|0))Se(51716,51405,444,51735);if(!(c[(c[k>>2]|0)+4>>2]|0))Se(51751,51405,445,51735);if(!((a[(c[k>>2]|0)+8>>0]<<7&255)<<24>>24>>7<<24>>24))Se(51770,51405,446,51735);if(!(c[17789]|0))Se(51789,51405,448,51735);c[o>>2]=c[17789];c[p>>2]=(c[17789]|0)+16;c[q>>2]=(c[17789]|0)+32;while(1){if(!(c[j>>2]|0)){x=33;break}if((c[(c[k>>2]|0)+52>>2]|0)==0?(c[(c[k>>2]|0)+12>>2]|0)>>>0>1e3:0){Ms(c[k>>2]|0);c[(c[k>>2]|0)+12>>2]=0}c[r>>2]=(c[j>>2]|0)>>>0<16?c[j>>2]|0:16;Os(n,16,c[k>>2]|0);Ps(c[q>>2]|0,n,(c[k>>2]|0)+17|0,c[(c[k>>2]|0)+4>>2]|0,c[o>>2]|0,c[p>>2]|0);f=(c[k>>2]|0)+12|0;c[f>>2]=(c[f>>2]|0)+1;if(!((((d[(c[k>>2]|0)+51>>0]|0|0?c[(c[k>>2]|0)+52>>2]|0:0)?(c[k>>2]|0)!=(c[17790]|0):0)?(c[k>>2]|0)!=(c[17791]|0):0)?(c[k>>2]|0)!=(c[17792]|0):0)){f=(c[k>>2]|0)+34|0;e=c[q>>2]|0;if(!((a[(c[k>>2]|0)+8>>0]<<6&255)<<24>>24>>7<<24>>24)){y=f;z=e;A=y+16|0;do{a[y>>0]=a[z>>0]|0;y=y+1|0;z=z+1|0}while((y|0)<(A|0));b=(c[k>>2]|0)+8|0;a[b>>0]=a[b>>0]&-3|2;continue}if(!(Jv(f,e,16)|0)){x=22;break}y=(c[k>>2]|0)+34|0;z=c[q>>2]|0;A=y+16|0;do{a[y>>0]=a[z>>0]|0;y=y+1|0;z=z+1|0}while((y|0)<(A|0))}_w(c[i>>2]|0,c[q>>2]|0,c[r>>2]|0)|0;c[s>>2]=c[q>>2];c[t>>2]=16;a[u>>0]=0;e=v;c[e>>2]=d[u>>0];c[e+4>>2]=0;while(1){if(!(c[s>>2]&7|0?(c[t>>2]|0)!=0:0))break;a[c[s>>2]>>0]=a[u>>0]|0;c[s>>2]=(c[s>>2]|0)+1;c[t>>2]=(c[t>>2]|0)+-1}if((c[t>>2]|0)>>>0>=8){e=v;f=gx(c[e>>2]|0,c[e+4>>2]|0,16843009,16843009)|0;e=v;c[e>>2]=f;c[e+4>>2]=D;do{c[w>>2]=c[s>>2];e=v;f=c[e+4>>2]|0;b=c[w>>2]|0;c[b>>2]=c[e>>2];c[b+4>>2]=f;c[t>>2]=(c[t>>2]|0)-8;c[s>>2]=(c[s>>2]|0)+8}while((c[t>>2]|0)>>>0>=8)}while(1){if(!(c[t>>2]|0))break;a[c[s>>2]>>0]=a[u>>0]|0;c[s>>2]=(c[s>>2]|0)+1;c[t>>2]=(c[t>>2]|0)+-1}c[i>>2]=(c[i>>2]|0)+(c[r>>2]|0);c[j>>2]=(c[j>>2]|0)-(c[r>>2]|0)}if((x|0)==22){dh(51405,502,51735,0,51819);c[h>>2]=-1;B=c[h>>2]|0;l=g;return B|0}else if((x|0)==33){c[h>>2]=0;B=c[h>>2]|0;l=g;return B|0}return 0}function Os(d,f,g){d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h;j=h+28|0;k=h+24|0;n=h+20|0;o=h+16|0;p=h+8|0;c[j>>2]=d;c[k>>2]=f;c[n>>2]=g;if((c[k>>2]|0)!=16)Se(51859,51405,273,51918);if(!(c[17793]|0))Se(51716,51405,274,51918);if(((c[(c[n>>2]|0)+52>>2]|0?(c[n>>2]|0)!=(c[17790]|0):0)?(c[n>>2]|0)!=(c[17791]|0):0)?(c[n>>2]|0)!=(c[17792]|0):0){k=c[j>>2]|0;g=c[(c[n>>2]|0)+52>>2]|0;f=k+16|0;do{a[k>>0]=a[g>>0]|0;k=k+1|0;g=g+1|0}while((k|0)<(f|0));a[(c[j>>2]|0)+12>>0]=(c[(c[n>>2]|0)+56>>2]|0)>>>24;a[(c[j>>2]|0)+13>>0]=(c[(c[n>>2]|0)+56>>2]|0)>>>16;a[(c[j>>2]|0)+14>>0]=(c[(c[n>>2]|0)+56>>2]|0)>>>8;a[(c[j>>2]|0)+15>>0]=c[(c[n>>2]|0)+56>>2];g=(c[n>>2]|0)+56|0;c[g>>2]=(c[g>>2]|0)+1;l=h;return}if(!(c[17795]|0)){c[17796]=_v()|0;c[17797]=qw()|0}if(lb(p|0,0)|0){c[i>>2]=Nu(c[(xu()|0)>>2]|0)|0;We(51930,i)}c[o>>2]=c[p+4>>2];c[o>>2]=c[o>>2]<<4;if((c[p>>2]|0)==(c[17795]|0)?(c[o>>2]|0)==(c[17798]|0):0){b[35902]=(b[35902]|0)+1<<16>>16;b[35902]=(e[35902]|0)&4095}else{b[35902]=0;c[17795]=c[p>>2];c[17798]=c[o>>2]}a[c[j>>2]>>0]=c[p>>2]>>24;a[(c[j>>2]|0)+1>>0]=c[p>>2]>>16;a[(c[j>>2]|0)+2>>0]=c[p>>2]>>8;a[(c[j>>2]|0)+3>>0]=c[p>>2];a[(c[j>>2]|0)+4>>0]=(c[o>>2]|0)>>>16;a[(c[j>>2]|0)+5>>0]=(c[o>>2]|0)>>>8;a[(c[j>>2]|0)+6>>0]=c[o>>2]&240|(e[35902]|0)>>8&15;a[(c[j>>2]|0)+7>>0]=e[35902]|0;a[(c[j>>2]|0)+8>>0]=(c[17796]|0)>>>24;a[(c[j>>2]|0)+9>>0]=(c[17796]|0)>>>16;a[(c[j>>2]|0)+10>>0]=(c[17796]|0)>>>8;a[(c[j>>2]|0)+11>>0]=c[17796];a[(c[j>>2]|0)+12>>0]=(c[17797]|0)>>>24;a[(c[j>>2]|0)+13>>0]=(c[17797]|0)>>>16;a[(c[j>>2]|0)+14>>0]=(c[17797]|0)>>>8;a[(c[j>>2]|0)+15>>0]=c[17797];j=(c[17797]|0)+1|0;c[17797]=j;if(j|0){l=h;return}c[17796]=(c[17796]|0)+1;l=h;return}function Ps(b,e,f,g,h,i){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;j=l;l=l+80|0;if((l|0)>=(m|0))$(80);k=j+60|0;n=j+56|0;o=j+52|0;p=j+48|0;q=j+44|0;r=j+40|0;s=j+36|0;t=j+32|0;u=j+65|0;v=j+8|0;w=j+28|0;x=j+24|0;y=j+20|0;z=j+64|0;A=j;B=j+16|0;c[k>>2]=b;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=h;c[r>>2]=i;Qs(c[p>>2]|0,c[q>>2]|0,c[n>>2]|0,16);Rs(c[r>>2]|0,c[q>>2]|0,c[o>>2]|0,16);Qs(c[p>>2]|0,c[k>>2]|0,c[r>>2]|0,16);Rs(c[r>>2]|0,c[k>>2]|0,c[q>>2]|0,16);Qs(c[p>>2]|0,c[o>>2]|0,c[r>>2]|0,16);c[s>>2]=c[q>>2];c[t>>2]=16;a[u>>0]=0;q=v;c[q>>2]=d[u>>0];c[q+4>>2]=0;while(1){if(!(c[s>>2]&7|0?(c[t>>2]|0)!=0:0))break;a[c[s>>2]>>0]=a[u>>0]|0;c[s>>2]=(c[s>>2]|0)+1;c[t>>2]=(c[t>>2]|0)+-1}if((c[t>>2]|0)>>>0>=8){q=v;o=gx(c[q>>2]|0,c[q+4>>2]|0,16843009,16843009)|0;q=v;c[q>>2]=o;c[q+4>>2]=D;do{c[w>>2]=c[s>>2];q=v;o=c[q+4>>2]|0;p=c[w>>2]|0;c[p>>2]=c[q>>2];c[p+4>>2]=o;c[t>>2]=(c[t>>2]|0)-8;c[s>>2]=(c[s>>2]|0)+8}while((c[t>>2]|0)>>>0>=8)}while(1){if(!(c[t>>2]|0))break;a[c[s>>2]>>0]=a[u>>0]|0;c[s>>2]=(c[s>>2]|0)+1;c[t>>2]=(c[t>>2]|0)+-1}c[x>>2]=c[r>>2];c[y>>2]=16;a[z>>0]=0;r=A;c[r>>2]=d[z>>0];c[r+4>>2]=0;while(1){if(!(c[x>>2]&7|0?(c[y>>2]|0)!=0:0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}if((c[y>>2]|0)>>>0>=8){r=A;t=gx(c[r>>2]|0,c[r+4>>2]|0,16843009,16843009)|0;r=A;c[r>>2]=t;c[r+4>>2]=D;do{c[B>>2]=c[x>>2];r=A;t=c[r+4>>2]|0;s=c[B>>2]|0;c[s>>2]=c[r>>2];c[s+4>>2]=t;c[y>>2]=(c[y>>2]|0)-8;c[x>>2]=(c[x>>2]|0)+8}while((c[y>>2]|0)>>>0>=8)}while(1){if(!(c[y>>2]|0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}l=j;return}function Qs(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;h=f+20|0;i=f+16|0;j=f+12|0;k=f+8|0;n=f+4|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;if((c[k>>2]|0)!=16)Se(51859,51405,386,51872);c[n>>2]=Ch(c[h>>2]|0,c[i>>2]|0,c[k>>2]|0,c[j>>2]|0,c[k>>2]|0)|0;if(c[n>>2]|0){c[g>>2]=Ss(c[n>>2]|0)|0;We(51884,g)}else{l=f;return}}function Rs(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);i=h+12|0;j=h+8|0;k=h+4|0;n=h;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;while(1){if(!(c[n>>2]|0))break;a[c[i>>2]>>0]=(d[c[j>>2]>>0]|0)^(d[c[k>>2]>>0]|0);c[n>>2]=(c[n>>2]|0)+-1;c[j>>2]=(c[j>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+1;c[i>>2]=(c[i>>2]|0)+1}l=h;return}function Ss(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Bt(c[d>>2]|0)|0;l=b;return a|0}function Ts(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+28|0;h=f+24|0;i=f+20|0;j=f+16|0;k=f+12|0;n=f+32|0;o=f;p=f+8|0;c[g>>2]=b;c[h>>2]=e;if(!(c[17793]|0))Se(51716,51405,642,51969);if((c[h>>2]|0)!=16)Se(51859,51405,643,51969);c[i>>2]=Us(16)|0;h=c[g>>2]|0;g=c[i>>2]|0;e=h+16|0;do{a[h>>0]=a[g>>0]|0;h=h+1|0;g=g+1|0}while((h|0)<(e|0));c[j>>2]=c[i>>2];c[k>>2]=16;a[n>>0]=0;g=o;c[g>>2]=d[n>>0];c[g+4>>2]=0;while(1){if(!(c[j>>2]&7|0?(c[k>>2]|0)!=0:0))break;a[c[j>>2]>>0]=a[n>>0]|0;c[j>>2]=(c[j>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+-1}if((c[k>>2]|0)>>>0>=8){g=o;h=gx(c[g>>2]|0,c[g+4>>2]|0,16843009,16843009)|0;g=o;c[g>>2]=h;c[g+4>>2]=D;do{c[p>>2]=c[j>>2];g=o;h=c[g+4>>2]|0;e=c[p>>2]|0;c[e>>2]=c[g>>2];c[e+4>>2]=h;c[k>>2]=(c[k>>2]|0)-8;c[j>>2]=(c[j>>2]|0)+8}while((c[k>>2]|0)>>>0>=8)}while(1){if(!(c[k>>2]|0))break;a[c[j>>2]>>0]=a[n>>0]|0;c[j>>2]=(c[j>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+-1}vf(c[i>>2]|0);l=f;return}function Us(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;e=b+12|0;f=b+8|0;g=b+4|0;c[e>>2]=a;if(c[17799]|0)Se(51988,51405,552,52012);c[17799]=Bf(c[e>>2]|0)|0;c[17800]=c[e>>2];c[17801]=0;c[g>>2]=nt(4,0,16,2)|0;if((c[g>>2]|0)<0){h=c[17799]|0;vf(h);c[17799]=0;We(52024,d)}if((c[17801]|0)!=(c[17800]|0)){h=c[17799]|0;vf(h);c[17799]=0;We(52024,d)}else{c[f>>2]=c[17799];c[17799]=0;l=b;return c[f>>2]|0}return 0}function Vs(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=g+12|0;i=g+8|0;j=g;c[h>>2]=b;c[i>>2]=e;c[g+4>>2]=f;c[j>>2]=c[h>>2];if(!(c[17793]|0))Se(51716,51405,531,52052);if(!(c[17799]|0))Se(52071,51405,532,52052);while(1){h=c[i>>2]|0;c[i>>2]=h+-1;if(!h){k=8;break}if((c[17801]|0)>>>0>=(c[17800]|0)>>>0){k=8;break}h=c[j>>2]|0;c[j>>2]=h+1;f=d[h>>0]|0;h=c[17801]|0;c[17801]=h+1;e=(c[17799]|0)+h|0;a[e>>0]=(d[e>>0]|0)^f}if((k|0)==8){l=g;return}}function Ws(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;As(1);Cs();Ks(c[e>>2]|0,c[f>>2]|0,c[17790]|0);Fs();l=d;return}function Xs(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;jn(b+8|0,8,1);c[e>>2]=Ys(c[d>>2]|0)|0;d=Zs(c[e>>2]|0)|0;l=b;return d|0}function Ys(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+20|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;n=e+24|0;c[f>>2]=b;c[k>>2]=0;if(!(c[17789]|0))Se(51789,51405,912,52187);c[i>>2]=Cf(1,68)|0;Ds(c[i>>2]|0);Cs();c[g>>2]=0;a:while(1){if((c[g>>2]|0)>>>0>=3)break;c[j>>2]=wh((c[i>>2]|0)+4|0,7,1,1)|0;if(c[j>>2]|0){o=6;break}c[j>>2]=Jh(c[(c[i>>2]|0)+4>>2]|0,52238+((c[g>>2]|0)*96|0)|0,16)|0;if(c[j>>2]|0){o=8;break}b=_v()|0;c[(c[i>>2]|0)+60>>2]=b;b=(c[i>>2]|0)+17|0;p=52238+((c[g>>2]|0)*96|0)+32|0;q=b+16|0;do{a[b>>0]=a[p>>0]|0;b=b+1|0;p=p+1|0}while((b|0)<(q|0));p=(c[i>>2]|0)+8|0;a[p>>0]=a[p>>0]&-2|1;p=_v()|0;c[(c[i>>2]|0)+64>>2]=p;c[(c[i>>2]|0)+52>>2]=52238+((c[g>>2]|0)*96|0)+16;c[(c[i>>2]|0)+56>>2]=(d[52238+((c[g>>2]|0)*96|0)+16+12>>0]|0)<<24|(d[52238+((c[g>>2]|0)*96|0)+16+13>>0]|0)<<16|(d[52238+((c[g>>2]|0)*96|0)+16+14>>0]|0)<<8|(d[52238+((c[g>>2]|0)*96|0)+16+15>>0]|0);c[h>>2]=0;while(1){if((c[h>>2]|0)>=3)break;if(Ns(n,16,c[i>>2]|0)|0){o=12;break a}if(Jv(n,52238+((c[g>>2]|0)*96|0)+48+(c[h>>2]<<4)|0,16)|0){o=14;break a}c[h>>2]=(c[h>>2]|0)+1}p=c[(c[i>>2]|0)+60>>2]|0;if((p|0)!=(_v()|0)){o=18;break}p=c[(c[i>>2]|0)+64>>2]|0;if((p|0)!=(_v()|0)){o=18;break}Bh(c[(c[i>>2]|0)+4>>2]|0);c[(c[i>>2]|0)+4>>2]=0;p=(c[i>>2]|0)+8|0;a[p>>0]=a[p>>0]&-2;Es(c[i>>2]|0);c[g>>2]=(c[g>>2]|0)+1}if((o|0)==6)c[k>>2]=52200;else if((o|0)==8)c[k>>2]=52526;else if((o|0)==12)c[k>>2]=52552;else if((o|0)==14)c[k>>2]=52583;else if((o|0)==18)c[k>>2]=52621;Fs();Bh(c[(c[i>>2]|0)+4>>2]|0);Es(c[i>>2]|0);vf(c[i>>2]|0);if(!((c[f>>2]|0)!=0&(c[k>>2]|0)!=0)){r=c[k>>2]|0;s=(r|0)!=0;t=s?50:0;l=e;return t|0}Eb[c[f>>2]&1](52643,0,52650,c[k>>2]|0);r=c[k>>2]|0;s=(r|0)!=0;t=s?50:0;l=e;return t|0}function Zs(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=_s(1,c[d>>2]|0)|0;l=b;return a|0}function _s(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;if(!(c[f>>2]|0)){g=0;l=d;return g|0}g=(c[e>>2]&127)<<24|c[f>>2]&65535;l=d;return g|0}function $s(b,e,f,g,h,i,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;n=l;l=l+48|0;if((l|0)>=(m|0))$(48);o=n+40|0;p=n+36|0;q=n+32|0;r=n+28|0;s=n+24|0;t=n+20|0;u=n+16|0;v=n+12|0;w=n+8|0;x=n+4|0;y=n;c[p>>2]=b;c[q>>2]=e;c[r>>2]=f;c[s>>2]=g;c[t>>2]=h;c[u>>2]=i;c[v>>2]=j;c[w>>2]=k;As(1);if((((((c[p>>2]|0)!=0&(c[r>>2]|0)!=0^1|(c[s>>2]|0)!=16)^1)&(c[t>>2]|0)!=0^1|(c[u>>2]|0)!=16)^1)&(c[v>>2]|0)!=0^1|(c[w>>2]|0)!=16){c[o>>2]=45;z=c[o>>2]|0;l=n;return z|0}c[y>>2]=wf(1,68+(c[w>>2]|0)|0)|0;if(!(c[y>>2]|0)){c[o>>2]=Et()|0;z=c[o>>2]|0;l=n;return z|0}Ds(c[y>>2]|0);c[x>>2]=wh((c[y>>2]|0)+4|0,7,1,1)|0;if((c[x>>2]|0)==0?(c[x>>2]=Jh(c[(c[y>>2]|0)+4>>2]|0,c[r>>2]|0,c[s>>2]|0)|0,(c[x>>2]|0)==0):0){s=_v()|0;c[(c[y>>2]|0)+60>>2]=s;_w((c[y>>2]|0)+17|0,c[t>>2]|0,c[u>>2]|0)|0;u=(c[y>>2]|0)+8|0;a[u>>0]=a[u>>0]&-2|1;u=_v()|0;c[(c[y>>2]|0)+64>>2]=u;_w((c[y>>2]|0)+68|0,c[v>>2]|0,c[w>>2]|0)|0;c[(c[y>>2]|0)+52>>2]=(c[y>>2]|0)+68;c[(c[y>>2]|0)+56>>2]=(d[(c[(c[y>>2]|0)+52>>2]|0)+12>>0]|0)<<24|(d[(c[(c[y>>2]|0)+52>>2]|0)+13>>0]|0)<<16|(d[(c[(c[y>>2]|0)+52>>2]|0)+14>>0]|0)<<8|(d[(c[(c[y>>2]|0)+52>>2]|0)+15>>0]|0);if(c[q>>2]&1|0)a[(c[y>>2]|0)+51>>0]=1;Es(c[y>>2]|0);c[x>>2]=0}q=c[y>>2]|0;if(c[x>>2]|0){Bh(c[q+4>>2]|0);vf(c[y>>2]|0);c[c[p>>2]>>2]=0}else c[c[p>>2]>>2]=q;c[o>>2]=c[x>>2];z=c[o>>2]|0;l=n;return z|0}function at(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=c[g>>2];if((c[j>>2]|0)!=0&(c[h>>2]|0)!=0^1|(c[i>>2]|0)!=16){c[f>>2]=45;k=c[f>>2]|0;l=e;return k|0}else{Cs();Ks(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);Fs();c[f>>2]=0;k=c[f>>2]|0;l=e;return k|0}return 0}function bt(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];if(!(c[e>>2]|0)){l=b;return}Bh(c[(c[e>>2]|0)+4>>2]|0);vf(c[e>>2]|0);l=b;return}function ct(a){a=a|0;var b=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[b>>2]=a;dt();l=b;return}function dt(){if(c[17802]|0)return;c[17802]=1;c[17803]=0;return}function et(){ft();nt(0,0,0,0)|0;gt();return}function ft(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[d>>2]=Ht(13108)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;We(52697,b)}else{c[17803]=1;l=a;return}}function gt(){var a=0,b=0,d=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;d=a+4|0;c[17803]=0;c[d>>2]=It(13108)|0;if(c[d>>2]|0){c[b>>2]=Bt(c[d>>2]|0)|0;We(52654,b)}else{l=a;return}}function ht(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;ct(1);if((c[h>>2]|0)!=2)c[h>>2]=1;ft();it(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);gt();l=e;return}function it(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(!(c[g>>2]|0))Se(52740,52747,144,52763);c[17804]=c[g>>2];c[17805]=c[h>>2];c[17806]=0;c[j>>2]=nt(5,0,c[h>>2]|0,c[i>>2]|0)|0;if((c[j>>2]|0)<0){k=c[j>>2]|0;c[f>>2]=k;We(52774,f)}if((c[17806]|0)!=(c[17805]|0)){k=c[j>>2]|0;c[f>>2]=k;We(52774,f)}else{l=e;return}}function jt(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f;c[g>>2]=b;c[h>>2]=d;c[f+4>>2]=e;c[i>>2]=c[g>>2];if(!(c[17803]|0))Se(52820,52747,124,52841);if(!(c[17804]|0))Se(52849,52747,125,52841);while(1){g=c[h>>2]|0;c[h>>2]=g+-1;if(!g){j=8;break}if((c[17806]|0)>>>0>=(c[17805]|0)>>>0){j=8;break}g=c[i>>2]|0;c[i>>2]=g+1;e=a[g>>0]|0;g=c[17806]|0;c[17806]=g+1;a[(c[17804]|0)+g>>0]=e}if((j|0)==8){l=f;return}}function kt(){return c[17807]|0}function lt(a,b){a=a|0;b=b|0;var d=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[d+4>>2]=a;c[d>>2]=b;l=d;return}function mt(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[d+8>>2]=a;c[d+4>>2]=b;c[e>>2]=0;l=d;return c[e>>2]|0}function nt(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;h=l;l=l+1024|0;if((l|0)>=(m|0))$(1024);i=h+24|0;j=h+16|0;k=h+8|0;n=h+236|0;o=h+232|0;p=h+228|0;q=h+224|0;r=h+220|0;s=h+216|0;t=h+212|0;u=h+248|0;v=h+208|0;w=h+204|0;x=h+200|0;y=h+196|0;z=h+192|0;A=h+64|0;B=h+56|0;C=h+52|0;E=h+48|0;F=h+44|0;G=h+40|0;H=h+36|0;I=h+32|0;J=h+240|0;K=h;L=h+28|0;c[o>>2]=b;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[w>>2]=c[q>>2];c[x>>2]=0;c[y>>2]=0;if(!(c[o>>2]|0)){if((c[3288]|0)!=-1){Kv(c[3288]|0)|0;c[3288]=-1}if((c[3289]|0)!=-1){Kv(c[3289]|0)|0;c[3289]=-1}c[n>>2]=0;M=c[n>>2]|0;l=h;return M|0}c[v>>2]=mt(c[o>>2]|0,c[p>>2]|0)|0;if((c[v>>2]|0)>>>0>(((c[q>>2]|0)>>>0)/2|0)>>>0)c[v>>2]=((c[q>>2]|0)>>>0)/2|0;if((c[q>>2]|0)>>>0>1)c[q>>2]=(c[q>>2]|0)-(c[v>>2]|0);if((c[r>>2]|0)>=2){if((c[3288]|0)==-1){c[3288]=ot(52864,(d[72318]|0)&1)|0;a[72318]=d[72318]|0|1}c[s>>2]=c[3288]}else{if((c[3289]|0)==-1){c[3289]=ot(52876,(d[72318]|0)&2)|0;a[72318]=d[72318]|0|2}c[s>>2]=c[3289]}c[z>>2]=0;while(1){if(!(c[q>>2]|0))break;if(!(!(c[y>>2]|0)?(c[x>>2]|0)==((c[w>>2]|0)-(c[q>>2]|0)|0):0)){c[x>>2]=(c[w>>2]|0)-(c[q>>2]|0);Wm(52889,88,c[x>>2]|0,c[w>>2]|0);c[y>>2]=1}if((c[s>>2]|0)<1024){c[F>>2]=A;c[E>>2]=32;while(1){if(!(c[E>>2]|0))break;r=c[F>>2]|0;c[F>>2]=r+4;c[r>>2]=0;c[E>>2]=(c[E>>2]|0)+-1}r=A+((((c[s>>2]|0)>>>0)/32|0)<<2)|0;c[r>>2]=c[r>>2]|1<<(((c[s>>2]|0)>>>0)%32|0);c[B>>2]=c[z>>2];c[B+4>>2]=c[z>>2]|0?0:1e5;r=dw((c[s>>2]|0)+1|0,A,0,0,B)|0;c[C>>2]=r;if(!r){c[y>>2]=1;c[z>>2]=3;continue}if((c[C>>2]|0)==-1){c[k>>2]=Nu(c[(xu()|0)>>2]|0)|0;Ve(52902,k);if(c[z>>2]|0)continue;c[z>>2]=1;continue}}do{c[G>>2]=(c[q>>2]|0)>>>0<768?c[q>>2]|0:768;c[t>>2]=fw(c[s>>2]|0,u,c[G>>2]|0)|0;if((c[t>>2]|0)>=0?(c[t>>2]|0)>>>0>(c[G>>2]|0)>>>0:0){c[j>>2]=c[t>>2];Ve(52922,j);c[t>>2]=c[G>>2]}if((c[t>>2]|0)!=-1)break}while((c[(xu()|0)>>2]|0)==4);if((c[t>>2]|0)==-1){N=38;break}zb[c[o>>2]&7](u,c[t>>2]|0,c[p>>2]|0);c[q>>2]=(c[q>>2]|0)-(c[t>>2]|0)}if((N|0)==38){c[i>>2]=Nu(c[(xu()|0)>>2]|0)|0;We(52960,i)}c[H>>2]=u;c[I>>2]=768;a[J>>0]=0;u=K;c[u>>2]=d[J>>0];c[u+4>>2]=0;while(1){if(!(c[H>>2]&7|0?(c[I>>2]|0)!=0:0))break;a[c[H>>2]>>0]=a[J>>0]|0;c[H>>2]=(c[H>>2]|0)+1;c[I>>2]=(c[I>>2]|0)+-1}if((c[I>>2]|0)>>>0>=8){u=K;i=gx(c[u>>2]|0,c[u+4>>2]|0,16843009,16843009)|0;u=K;c[u>>2]=i;c[u+4>>2]=D;do{c[L>>2]=c[H>>2];u=K;i=c[u+4>>2]|0;N=c[L>>2]|0;c[N>>2]=c[u>>2];c[N+4>>2]=i;c[I>>2]=(c[I>>2]|0)-8;c[H>>2]=(c[H>>2]|0)+8}while((c[I>>2]|0)>>>0>=8)}while(1){if(!(c[I>>2]|0))break;a[c[H>>2]>>0]=a[J>>0]|0;c[H>>2]=(c[H>>2]|0)+1;c[I>>2]=(c[I>>2]|0)+-1}if(c[y>>2]|0)Wm(52889,88,c[w>>2]|0,c[w>>2]|0);c[n>>2]=0;M=c[n>>2]|0;l=h;return M|0}function ot(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+16|0;f=d+8|0;g=d;h=d+40|0;i=d+36|0;j=d+32|0;k=d+24|0;c[h>>2]=a;c[i>>2]=b;if(c[i>>2]|0)Wm(52993,88,1,0);while(1){c[j>>2]=gw(c[h>>2]|0,0,g)|0;if(!((c[j>>2]|0)==-1&(c[i>>2]|0)!=0))break;c[k>>2]=5;c[k+4>>2]=0;Wm(53009,88,0,c[k>>2]|0);dw(0,0,0,0,k)|0}if((c[j>>2]|0)==-1){k=c[h>>2]|0;h=Nu(c[(xu()|0)>>2]|0)|0;c[f>>2]=k;c[f+4>>2]=h;We(53025,f)}if(!(pt(c[j>>2]|0)|0)){n=c[j>>2]|0;l=d;return n|0}f=c[j>>2]|0;h=Nu(c[(xu()|0)>>2]|0)|0;c[e>>2]=f;c[e+4>>2]=h;Ve(53044,e);n=c[j>>2]|0;l=d;return n|0}function pt(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+8|0;e=b;f=b+20|0;g=b+16|0;h=b+12|0;c[g>>2]=a;a=c[g>>2]|0;c[e>>2]=0;c[h>>2]=Lv(a,1,e)|0;e=c[h>>2]|0;if((c[h>>2]|0)<0){c[f>>2]=e;i=c[f>>2]|0;l=b;return i|0}else{c[h>>2]=e|1;e=c[g>>2]|0;c[d>>2]=c[h>>2];c[f>>2]=Lv(e,2,d)|0;i=c[f>>2]|0;l=b;return i|0}return 0}function qt(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;f=l;l=l+80|0;if((l|0)>=(m|0))$(80);g=f+72|0;h=f+68|0;i=f+64|0;j=f+60|0;k=f+56|0;n=f+52|0;o=f+48|0;p=f+44|0;q=f+40|0;r=f+36|0;s=f+32|0;t=f+28|0;u=f+24|0;v=f+20|0;w=f+16|0;x=f+12|0;y=f+8|0;z=f+4|0;A=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;c[n>>2]=0-(c[i>>2]|0);c[g>>2]=(c[g>>2]|0)+(0-(c[n>>2]|0)<<2);c[h>>2]=(c[h>>2]|0)+(0-(c[n>>2]|0)<<2);c[k>>2]=0;do{c[z>>2]=c[(c[h>>2]|0)+(c[n>>2]<<2)>>2];c[A>>2]=c[j>>2];c[v>>2]=c[z>>2]&65535;c[x>>2]=(c[z>>2]|0)>>>16;c[w>>2]=c[A>>2]&65535;c[y>>2]=(c[A>>2]|0)>>>16;c[r>>2]=S(c[v>>2]|0,c[w>>2]|0)|0;c[s>>2]=S(c[v>>2]|0,c[y>>2]|0)|0;c[t>>2]=S(c[x>>2]|0,c[w>>2]|0)|0;c[u>>2]=S(c[x>>2]|0,c[y>>2]|0)|0;c[s>>2]=(c[s>>2]|0)+((c[r>>2]|0)>>>16);c[s>>2]=(c[s>>2]|0)+(c[t>>2]|0);if((c[s>>2]|0)>>>0<(c[t>>2]|0)>>>0)c[u>>2]=(c[u>>2]|0)+65536;c[o>>2]=(c[u>>2]|0)+((c[s>>2]|0)>>>16);c[p>>2]=((c[s>>2]&65535)<<16)+(c[r>>2]&65535);c[p>>2]=(c[p>>2]|0)+(c[k>>2]|0);c[k>>2]=((c[p>>2]|0)>>>0<(c[k>>2]|0)>>>0?1:0)+(c[o>>2]|0);c[q>>2]=c[(c[g>>2]|0)+(c[n>>2]<<2)>>2];c[p>>2]=(c[q>>2]|0)+(c[p>>2]|0);c[k>>2]=(c[k>>2]|0)+((c[p>>2]|0)>>>0<(c[q>>2]|0)>>>0?1:0);c[(c[g>>2]|0)+(c[n>>2]<<2)>>2]=c[p>>2];i=(c[n>>2]|0)+1|0;c[n>>2]=i}while((i|0)!=0);l=f;return c[k>>2]|0}function rt(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+16|0;g=e+8|0;h=e;i=e+44|0;j=e+40|0;k=e+36|0;n=e+32|0;o=e+28|0;p=e+24|0;q=e+20|0;c[i>>2]=b;c[j>>2]=d;c[k>>2]=xp(c[(c[i>>2]|0)+4>>2]|0)|0;c[n>>2]=lo(c[i>>2]|0)|0;c[o>>2]=(((c[n>>2]|0)+7|0)>>>0)/8|0;c[p>>2]=0;if(Ff(1)|0){d=c[j>>2]|0;c[h>>2]=c[n>>2];c[h+4>>2]=d;Ye(53083,h)}while(1){if((c[p>>2]|0)==0|(c[n>>2]|0)>>>0<32){vf(c[p>>2]|0);c[p>>2]=hn(c[o>>2]|0,c[j>>2]|0)|0}else{c[q>>2]=hn(4,c[j>>2]|0)|0;h=c[p>>2]|0;d=c[q>>2]|0;a[h>>0]=a[d>>0]|0;a[h+1>>0]=a[d+1>>0]|0;a[h+2>>0]=a[d+2>>0]|0;a[h+3>>0]=a[d+3>>0]|0;vf(c[q>>2]|0)}Yo(c[k>>2]|0,c[p>>2]|0,c[o>>2]|0,0);d=(mo(c[k>>2]|0,(c[n>>2]|0)-1|0)|0)!=0;oo(c[k>>2]|0,(c[n>>2]|0)-1|0);if(!d)qo(c[k>>2]|0,(c[n>>2]|0)-1|0);if((wo(c[k>>2]|0,c[i>>2]|0)|0)>=0){if(!(Ff(1)|0))continue;Ye(53130,g);continue}if((vo(c[k>>2]|0,0)|0)>0)break;if(!(Ff(1)|0))continue;Ye(53152,f)}vf(c[p>>2]|0);l=e;return c[k>>2]|0}function st(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;j=l;l=l+80|0;if((l|0)>=(m|0))$(80);k=j+72|0;n=j+68|0;o=j+64|0;p=j+60|0;q=j+56|0;r=j+52|0;s=j+48|0;t=j+44|0;u=j+40|0;v=j+36|0;w=j+32|0;x=j+28|0;y=j+24|0;z=j+20|0;A=j+16|0;B=j+12|0;C=j+8|0;D=j+4|0;E=j;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=h;c[t>>2]=i;c[v>>2]=0;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;c[A>>2]=0;c[B>>2]=0;c[D>>2]=lo(c[o>>2]|0)|0;if(!((c[D>>2]|0)!=0&(c[q>>2]|0)!=0&(c[r>>2]|0)!=0)){c[k>>2]=32816;F=c[k>>2]|0;l=j;return F|0}i=oj(c[s>>2]|0)|0;if((i|0)!=(c[r>>2]|0)){c[k>>2]=5;F=c[k>>2]|0;l=j;return F|0}c[v>>2]=pf(c[r>>2]|0)|0;a:do if(c[v>>2]|0){c[E>>2]=0;while(1){if((c[E>>2]|0)>>>0>=(c[r>>2]|0)>>>0)break;a[(c[v>>2]|0)+(c[E>>2]|0)>>0]=1;c[E>>2]=(c[E>>2]|0)+1}c[w>>2]=wf(1,c[r>>2]|0)|0;if(!(c[w>>2]|0)){c[u>>2]=Et()|0;break}c[u>>2]=tt(x,c[p>>2]|0,(((c[D>>2]|0)+7|0)>>>0)/8|0)|0;if(((((((c[u>>2]|0)==0?(c[u>>2]=ut(y,c[q>>2]|0,c[r>>2]<<3,c[o>>2]|0,c[D>>2]|0)|0,(c[u>>2]|0)==0):0)?(c[u>>2]=Si(z,c[s>>2]|0,3)|0,(c[u>>2]|0)==0):0)?(c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0,(c[u>>2]|0)==0):0)?($i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0),$i(c[z>>2]|0,72319,1),$i(c[z>>2]|0,c[x>>2]|0,(((c[D>>2]|0)+7|0)>>>0)/8|0),$i(c[z>>2]|0,c[y>>2]|0,(((c[D>>2]|0)+7|0)>>>0)/8|0),i=c[w>>2]|0,h=lj(c[z>>2]|0,0)|0,_w(i|0,h|0,c[r>>2]|0)|0,c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0,(c[u>>2]|0)==0):0)?($i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0),h=c[v>>2]|0,i=lj(c[z>>2]|0,0)|0,_w(h|0,i|0,c[r>>2]|0)|0,c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0,(c[u>>2]|0)==0):0)?($i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0),$i(c[z>>2]|0,53172,1),$i(c[z>>2]|0,c[x>>2]|0,(((c[D>>2]|0)+7|0)>>>0)/8|0),$i(c[z>>2]|0,c[y>>2]|0,(((c[D>>2]|0)+7|0)>>>0)/8|0),i=c[w>>2]|0,h=lj(c[z>>2]|0,0)|0,_w(i|0,h|0,c[r>>2]|0)|0,c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0,(c[u>>2]|0)==0):0){$i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0);h=c[v>>2]|0;i=lj(c[z>>2]|0,0)|0;_w(h|0,i|0,c[r>>2]|0)|0;c[A>>2]=pf(((((c[D>>2]|0)+7|0)>>>0)/8|0)+(c[r>>2]|0)|0)|0;if(!(c[A>>2]|0)){c[u>>2]=Et()|0;break}while(1){c[C>>2]=0;while(1){if((c[C>>2]|0)>>>0>=(c[D>>2]|0)>>>0)break;c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0;if(c[u>>2]|0)break a;$i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0);i=c[v>>2]|0;h=lj(c[z>>2]|0,0)|0;_w(i|0,h|0,c[r>>2]|0)|0;_w((c[A>>2]|0)+((((c[C>>2]|0)+7|0)>>>0)/8|0)|0,c[v>>2]|0,c[r>>2]|0)|0;c[C>>2]=(c[C>>2]|0)+(c[r>>2]<<3)}Dp(c[B>>2]|0);c[B>>2]=0;c[u>>2]=Zo(B,5,c[A>>2]|0,(((c[C>>2]|0)+7|0)>>>0)/8|0,0)|0;if(c[u>>2]|0)break a;if((c[C>>2]|0)>>>0>(c[D>>2]|0)>>>0)so(c[B>>2]|0,c[B>>2]|0,(c[C>>2]|0)-(c[D>>2]|0)|0);if((wo(c[B>>2]|0,c[o>>2]|0)|0)<0?(vo(c[B>>2]|0,0)|0)>0:0){if(!(c[t>>2]|0))break a;c[t>>2]=(c[t>>2]|0)+-1;c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0;if(c[u>>2]|0)break a;$i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0);$i(c[z>>2]|0,72319,1);h=c[w>>2]|0;i=lj(c[z>>2]|0,0)|0;_w(h|0,i|0,c[r>>2]|0)|0;c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0;if(c[u>>2]|0)break a;$i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0);i=c[v>>2]|0;h=lj(c[z>>2]|0,0)|0;_w(i|0,h|0,c[r>>2]|0)|0;continue}c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0;if(c[u>>2]|0)break a;$i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0);$i(c[z>>2]|0,72319,1);h=c[w>>2]|0;i=lj(c[z>>2]|0,0)|0;_w(h|0,i|0,c[r>>2]|0)|0;c[u>>2]=fj(c[z>>2]|0,c[w>>2]|0,c[r>>2]|0)|0;if(c[u>>2]|0)break a;$i(c[z>>2]|0,c[v>>2]|0,c[r>>2]|0);i=c[v>>2]|0;h=lj(c[z>>2]|0,0)|0;_w(i|0,h|0,c[r>>2]|0)|0}}}else c[u>>2]=Et()|0;while(0);vf(c[A>>2]|0);_i(c[z>>2]|0);vf(c[y>>2]|0);vf(c[x>>2]|0);vf(c[w>>2]|0);vf(c[v>>2]|0);v=c[B>>2]|0;if(c[u>>2]|0)Dp(v);else c[c[n>>2]>>2]=v;c[k>>2]=c[u>>2];F=c[k>>2]|0;l=j;return F|0}function tt(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+32|0;g=e+28|0;h=e+24|0;i=e+20|0;j=e+16|0;k=e+12|0;n=e+8|0;o=e+4|0;p=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=bp(5,0,0,k,c[h>>2]|0)|0;if(c[j>>2]|0){c[f>>2]=c[j>>2];q=c[f>>2]|0;l=e;return q|0}if((c[k>>2]|0)>>>0>(c[i>>2]|0)>>>0){c[f>>2]=67;q=c[f>>2]|0;l=e;return q|0}if((c[k>>2]|0)>>>0<(c[i>>2]|0)>>>0)r=(c[i>>2]|0)-(c[k>>2]|0)|0;else r=0;c[n>>2]=r;c[o>>2]=(c[k>>2]|0)+(c[n>>2]|0);if(c[h>>2]|0?c[(c[h>>2]|0)+12>>2]&1|0:0)s=sf(c[o>>2]|0)|0;else s=pf(c[o>>2]|0)|0;c[p>>2]=s;if(!(c[p>>2]|0)){c[f>>2]=Et()|0;q=c[f>>2]|0;l=e;return q|0}if(c[n>>2]|0)Uw(c[p>>2]|0,0,c[n>>2]|0)|0;c[k>>2]=(c[k>>2]|0)+(c[n>>2]|0);c[j>>2]=bp(5,(c[p>>2]|0)+(c[n>>2]|0)|0,(c[k>>2]|0)-(c[n>>2]|0)|0,0,c[h>>2]|0)|0;h=c[p>>2]|0;if(c[j>>2]|0){vf(h);c[f>>2]=c[j>>2];q=c[f>>2]|0;l=e;return q|0}else{c[c[g>>2]>>2]=h;c[f>>2]=0;q=c[f>>2]|0;l=e;return q|0}return 0}function ut(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+28|0;i=g+24|0;j=g+20|0;k=g+16|0;n=g+12|0;o=g+8|0;p=g+4|0;q=g;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=Zo(q,5,c[j>>2]|0,(((c[k>>2]|0)+7|0)>>>0)/8|0,0)|0;if(c[p>>2]|0){c[h>>2]=c[p>>2];r=c[h>>2]|0;l=g;return r|0}if((c[k>>2]|0)>>>0>(c[o>>2]|0)>>>0)so(c[q>>2]|0,c[q>>2]|0,(c[k>>2]|0)-(c[o>>2]|0)|0);if((wo(c[q>>2]|0,c[n>>2]|0)|0)>=0)ho(c[q>>2]|0,c[q>>2]|0,c[n>>2]|0);c[p>>2]=tt(c[i>>2]|0,c[q>>2]|0,(((c[o>>2]|0)+7|0)>>>0)/8|0)|0;Dp(c[q>>2]|0);c[h>>2]=c[p>>2];r=c[h>>2]|0;l=g;return r|0}function vt(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+28|0;g=e+24|0;h=e+20|0;i=e+16|0;j=e+12|0;k=e+8|0;n=e+4|0;o=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=0;do if(c[g>>2]|0?c[(c[g>>2]|0)+12>>2]&4|0:0){c[k>>2]=Gp(c[g>>2]|0,n)|0;c[j>>2]=Zo(o,5,c[k>>2]|0,(((c[n>>2]|0)+7|0)>>>0)/8|0,0)|0;if(c[j>>2]|0){c[f>>2]=c[j>>2];p=c[f>>2]|0;l=e;return p|0}else{if((c[n>>2]|0)>>>0<=(c[i>>2]|0)>>>0)break;so(c[o>>2]|0,c[o>>2]|0,(c[n>>2]|0)-(c[i>>2]|0)|0);break}}else q=7;while(0);if((q|0)==7)c[o>>2]=c[g>>2];c[c[h>>2]>>2]=c[o>>2];c[f>>2]=c[j>>2];p=c[f>>2]|0;l=e;return p|0}function wt(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;h=l;l=l+96|0;if((l|0)>=(m|0))$(96);i=h;j=h+88|0;k=h+84|0;n=h+80|0;o=h+76|0;p=h+72|0;q=h+68|0;r=h+64|0;s=h+60|0;t=h+56|0;u=h+52|0;v=h+48|0;w=h+44|0;x=h+40|0;y=h+36|0;z=h+24|0;A=h+20|0;B=h+16|0;C=h+12|0;D=h+8|0;E=h+4|0;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=0;c[t>>2]=0;if(Ff(1)|0)af(53174,c[k>>2]|0);c[D>>2]=lo(c[(c[n>>2]|0)+32>>2]|0)|0;c[s>>2]=vt(c[k>>2]|0,A,c[D>>2]|0)|0;if(c[s>>2]|0){c[j>>2]=c[s>>2];F=c[j>>2]|0;l=h;return F|0}c[u>>2]=0;c[v>>2]=vp(0)|0;c[w>>2]=vp(0)|0;c[x>>2]=vp(0)|0;c[y>>2]=vp(0)|0;yn(z);c[E>>2]=En(c[c[n>>2]>>2]|0,c[(c[n>>2]|0)+4>>2]|0,0,c[(c[n>>2]|0)+8>>2]|0,c[(c[n>>2]|0)+12>>2]|0,c[(c[n>>2]|0)+16>>2]|0)|0;a:while(1){do{Dp(c[u>>2]|0);c[u>>2]=0;if((c[q>>2]&2|0)!=0&(c[r>>2]|0)!=0){if(!(c[k>>2]|0)){G=10;break a}if(!(c[(c[k>>2]|0)+12>>2]&4)){G=10;break a}c[B>>2]=Gp(c[k>>2]|0,C)|0;c[s>>2]=st(u,c[(c[n>>2]|0)+32>>2]|0,c[(c[n>>2]|0)+56>>2]|0,c[B>>2]|0,(((c[C>>2]|0)+7|0)>>>0)/8|0,c[r>>2]|0,c[t>>2]|0)|0;if(c[s>>2]|0)break a;c[t>>2]=(c[t>>2]|0)+1}else c[u>>2]=rt(c[(c[n>>2]|0)+32>>2]|0,1)|0;$n(z,c[u>>2]|0,(c[n>>2]|0)+20|0,c[E>>2]|0);if(tn(c[y>>2]|0,0,z,c[E>>2]|0)|0){G=15;break a}Mo(c[o>>2]|0,c[y>>2]|0,c[(c[n>>2]|0)+32>>2]|0)}while((vo(c[o>>2]|0,0)|0)!=0^1);Ro(c[v>>2]|0,c[(c[n>>2]|0)+56>>2]|0,c[o>>2]|0,c[(c[n>>2]|0)+32>>2]|0);io(c[w>>2]|0,c[A>>2]|0,c[v>>2]|0,c[(c[n>>2]|0)+32>>2]|0);Lo(c[x>>2]|0,c[u>>2]|0,c[(c[n>>2]|0)+32>>2]|0)|0;Ro(c[p>>2]|0,c[x>>2]|0,c[w>>2]|0,c[(c[n>>2]|0)+32>>2]|0);if(!((vo(c[p>>2]|0,0)|0)!=0^1)){G=20;break}}if((G|0)==10)c[s>>2]=70;else if((G|0)==15){if(Ff(1)|0)Ye(53251,i);c[s>>2]=8}else if((G|0)==20?Ff(1)|0:0){af(53192,c[o>>2]|0);af(53213,c[p>>2]|0)}In(c[E>>2]|0);An(z);Dp(c[y>>2]|0);Dp(c[x>>2]|0);Dp(c[w>>2]|0);Dp(c[v>>2]|0);Dp(c[u>>2]|0);if((c[A>>2]|0)!=(c[k>>2]|0))Dp(c[A>>2]|0);c[j>>2]=c[s>>2];F=c[j>>2]|0;l=h;return F|0}function xt(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;f=l;l=l+112|0;if((l|0)>=(m|0))$(112);g=f+8|0;h=f;i=f+96|0;j=f+92|0;k=f+88|0;n=f+84|0;o=f+80|0;p=f+76|0;q=f+72|0;r=f+68|0;s=f+64|0;t=f+60|0;u=f+56|0;v=f+44|0;w=f+32|0;x=f+20|0;y=f+16|0;z=f+12|0;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=0;if((vo(c[n>>2]|0,0)|0)>0?(wo(c[n>>2]|0,c[(c[k>>2]|0)+32>>2]|0)|0)<0:0){if((vo(c[o>>2]|0,0)|0)>0?(wo(c[o>>2]|0,c[(c[k>>2]|0)+32>>2]|0)|0)<0:0){c[z>>2]=lo(c[(c[k>>2]|0)+32>>2]|0)|0;c[p>>2]=vt(c[j>>2]|0,q,c[z>>2]|0)|0;if(c[p>>2]|0){c[i>>2]=c[p>>2];A=c[i>>2]|0;l=f;return A|0}c[r>>2]=vp(0)|0;c[s>>2]=vp(0)|0;c[t>>2]=vp(0)|0;c[u>>2]=vp(0)|0;yn(v);yn(w);yn(x);c[y>>2]=En(c[c[k>>2]>>2]|0,c[(c[k>>2]|0)+4>>2]|0,0,c[(c[k>>2]|0)+8>>2]|0,c[(c[k>>2]|0)+12>>2]|0,c[(c[k>>2]|0)+16>>2]|0)|0;Lo(c[r>>2]|0,c[o>>2]|0,c[(c[k>>2]|0)+32>>2]|0)|0;Ro(c[s>>2]|0,c[q>>2]|0,c[r>>2]|0,c[(c[k>>2]|0)+32>>2]|0);$n(w,c[s>>2]|0,(c[k>>2]|0)+20|0,c[y>>2]|0);Ro(c[t>>2]|0,c[n>>2]|0,c[r>>2]|0,c[(c[k>>2]|0)+32>>2]|0);$n(x,c[t>>2]|0,(c[k>>2]|0)+44|0,c[y>>2]|0);Vn(v,w,x,c[y>>2]|0);do if(vo(c[v+8>>2]|0,0)|0){if(tn(c[u>>2]|0,0,v,c[y>>2]|0)|0){if(Ff(1)|0)Ye(53357,g);c[p>>2]=8;break}Mo(c[u>>2]|0,c[u>>2]|0,c[(c[k>>2]|0)+32>>2]|0);if(wo(c[u>>2]|0,c[n>>2]|0)|0){if(Ff(1)|0){af(53403,c[u>>2]|0);af(53410,c[n>>2]|0);af(53417,c[o>>2]|0)}c[p>>2]=8}}else{if(Ff(1)|0)Ye(53335,h);c[p>>2]=8}while(0);In(c[y>>2]|0);An(x);An(w);An(v);Dp(c[u>>2]|0);Dp(c[t>>2]|0);Dp(c[s>>2]|0);Dp(c[r>>2]|0);if((c[q>>2]|0)!=(c[j>>2]|0))Dp(c[q>>2]|0);c[i>>2]=c[p>>2];A=c[i>>2]|0;l=f;return A|0}c[i>>2]=8;A=c[i>>2]|0;l=f;return A|0}c[i>>2]=8;A=c[i>>2]|0;l=f;return A|0}function yt(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;f=l;l=l+96|0;if((l|0)>=(m|0))$(96);g=f;h=f+80|0;i=f+76|0;j=f+72|0;k=f+68|0;n=f+64|0;o=f+60|0;p=f+56|0;q=f+52|0;r=f+48|0;s=f+44|0;t=f+40|0;u=f+36|0;v=f+24|0;w=f+20|0;x=f+16|0;y=f+12|0;z=f+8|0;A=f+4|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=0;if(Ff(1)|0)af(53234,c[i>>2]|0);c[z>>2]=lo(c[(c[j>>2]|0)+32>>2]|0)|0;do if(c[i>>2]|0?c[(c[i>>2]|0)+12>>2]&4|0:0){c[x>>2]=Gp(c[i>>2]|0,y)|0;c[o>>2]=Zo(w,5,c[x>>2]|0,(((c[y>>2]|0)+7|0)>>>0)/8|0,0)|0;if(c[o>>2]|0){c[h>>2]=c[o>>2];B=c[h>>2]|0;l=f;return B|0}else{if((c[y>>2]|0)>>>0<=(c[z>>2]|0)>>>0)break;so(c[w>>2]|0,c[w>>2]|0,(c[y>>2]|0)-(c[z>>2]|0)|0);break}}else C=9;while(0);if((C|0)==9)c[w>>2]=c[i>>2];c[p>>2]=0;c[q>>2]=vp(0)|0;c[r>>2]=vp(0)|0;c[s>>2]=vp(0)|0;c[u>>2]=vp(0)|0;c[t>>2]=vp(0)|0;yn(v);c[A>>2]=En(c[c[j>>2]>>2]|0,c[(c[j>>2]|0)+4>>2]|0,0,c[(c[j>>2]|0)+8>>2]|0,c[(c[j>>2]|0)+12>>2]|0,c[(c[j>>2]|0)+16>>2]|0)|0;Mo(c[u>>2]|0,c[i>>2]|0,c[(c[j>>2]|0)+32>>2]|0);if(!(vo(c[u>>2]|0,0)|0))Op(c[u>>2]|0,1)|0;a:while(1){do{Dp(c[p>>2]|0);c[p>>2]=rt(c[(c[j>>2]|0)+32>>2]|0,1)|0;$n(v,c[p>>2]|0,(c[j>>2]|0)+20|0,c[A>>2]|0);if(tn(c[t>>2]|0,0,v,c[A>>2]|0)|0){C=14;break a}Mo(c[k>>2]|0,c[t>>2]|0,c[(c[j>>2]|0)+32>>2]|0)}while((vo(c[k>>2]|0,0)|0)!=0^1);Ro(c[q>>2]|0,c[(c[j>>2]|0)+56>>2]|0,c[k>>2]|0,c[(c[j>>2]|0)+32>>2]|0);Ro(c[s>>2]|0,c[p>>2]|0,c[u>>2]|0,c[(c[j>>2]|0)+32>>2]|0);io(c[n>>2]|0,c[s>>2]|0,c[q>>2]|0,c[(c[j>>2]|0)+32>>2]|0);if(!((vo(c[n>>2]|0,0)|0)!=0^1)){C=19;break}}if((C|0)==14){if(Ff(1)|0)Ye(53251,g);c[o>>2]=8}else if((C|0)==19?Ff(1)|0:0){af(53295,c[k>>2]|0);af(53315,c[n>>2]|0)}In(c[A>>2]|0);An(v);Dp(c[t>>2]|0);Dp(c[u>>2]|0);Dp(c[s>>2]|0);Dp(c[r>>2]|0);Dp(c[q>>2]|0);Dp(c[p>>2]|0);if((c[w>>2]|0)!=(c[i>>2]|0))Dp(c[w>>2]|0);c[h>>2]=c[o>>2];B=c[h>>2]|0;l=f;return B|0}function zt(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;f=l;l=l+128|0;if((l|0)>=(m|0))$(128);g=f+24|0;h=f+16|0;i=f+8|0;j=f;k=f+116|0;n=f+112|0;o=f+108|0;p=f+104|0;q=f+100|0;r=f+96|0;s=f+92|0;t=f+88|0;u=f+84|0;v=f+80|0;w=f+76|0;x=f+72|0;y=f+68|0;z=f+56|0;A=f+44|0;B=f+32|0;C=f+28|0;c[n>>2]=a;c[o>>2]=b;c[p>>2]=d;c[q>>2]=e;c[r>>2]=0;if((vo(c[p>>2]|0,0)|0)>0?(wo(c[p>>2]|0,c[(c[o>>2]|0)+32>>2]|0)|0)<0:0){if((vo(c[q>>2]|0,0)|0)>0?(wo(c[q>>2]|0,c[(c[o>>2]|0)+32>>2]|0)|0)<0:0){c[t>>2]=vp(0)|0;c[s>>2]=vp(0)|0;c[u>>2]=vp(0)|0;c[v>>2]=vp(0)|0;c[w>>2]=vp(0)|0;c[x>>2]=vp(0)|0;c[y>>2]=vp(0)|0;yn(z);yn(A);yn(B);c[C>>2]=En(c[c[o>>2]>>2]|0,c[(c[o>>2]|0)+4>>2]|0,0,c[(c[o>>2]|0)+8>>2]|0,c[(c[o>>2]|0)+12>>2]|0,c[(c[o>>2]|0)+16>>2]|0)|0;Mo(c[s>>2]|0,c[n>>2]|0,c[(c[o>>2]|0)+32>>2]|0);if(!(vo(c[s>>2]|0,0)|0))Op(c[s>>2]|0,1)|0;Lo(c[w>>2]|0,c[s>>2]|0,c[(c[o>>2]|0)+32>>2]|0)|0;Ro(c[u>>2]|0,c[q>>2]|0,c[w>>2]|0,c[(c[o>>2]|0)+32>>2]|0);Ro(c[x>>2]|0,c[p>>2]|0,c[w>>2]|0,c[(c[o>>2]|0)+32>>2]|0);jo(c[v>>2]|0,c[y>>2]|0,c[x>>2]|0,c[(c[o>>2]|0)+32>>2]|0);$n(A,c[u>>2]|0,(c[o>>2]|0)+20|0,c[C>>2]|0);$n(B,c[v>>2]|0,(c[o>>2]|0)+44|0,c[C>>2]|0);Vn(z,A,B,c[C>>2]|0);do if(vo(c[z+8>>2]|0,0)|0){if(tn(c[t>>2]|0,0,z,c[C>>2]|0)|0){if(Ff(1)|0)Ye(53357,i);c[r>>2]=8;break}Mo(c[t>>2]|0,c[t>>2]|0,c[(c[o>>2]|0)+32>>2]|0);n=(wo(c[t>>2]|0,c[p>>2]|0)|0)!=0;e=(Ff(1)|0)!=0;if(!n){if(!e)break;Ye(53450,g);break}if(e){af(53403,c[t>>2]|0);af(53410,c[p>>2]|0);af(53417,c[q>>2]|0);Ye(53424,h)}c[r>>2]=8}else{if(Ff(1)|0)Ye(53335,j);c[r>>2]=8}while(0);In(c[C>>2]|0);An(B);An(A);An(z);Dp(c[y>>2]|0);Dp(c[x>>2]|0);Dp(c[w>>2]|0);Dp(c[v>>2]|0);Dp(c[u>>2]|0);Dp(c[t>>2]|0);Dp(c[s>>2]|0);c[k>>2]=c[r>>2];D=c[k>>2]|0;l=f;return D|0}c[k>>2]=8;D=c[k>>2]|0;l=f;return D|0}c[k>>2]=8;D=c[k>>2]|0;l=f;return D|0}function At(){return Pt()|0}function Bt(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=au(c[d>>2]|0)|0;l=b;return a|0}function Ct(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=eu(c[d>>2]|0)|0;l=b;return a|0}function Dt(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=du(c[d>>2]|0)|0;l=b;return a|0}function Et(){return fu()|0}function Ft(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Rt(c[d>>2]|0);l=b;return}function Gt(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Kt(c[d>>2]|0)|0;l=b;return a|0}function Ht(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Mt(c[d>>2]|0)|0;l=b;return a|0}function It(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Nt(c[d>>2]|0)|0;l=b;return a|0}function Jt(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Ot(c[d>>2]|0)|0;l=b;return a|0}function Kt(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=c[d>>2];if(c[c[e>>2]>>2]|0)c[e>>2]=Lt(c[d>>2]|0)|0;else c[c[e>>2]>>2]=1;c[f>>2]=ya((c[e>>2]|0)+4|0,0)|0;if(!(c[f>>2]|0)){g=c[f>>2]|0;l=b;return g|0}c[f>>2]=Ct(c[f>>2]|0)|0;g=c[f>>2]|0;l=b;return g|0}function Lt(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];if((c[c[e>>2]>>2]|0)!=1)Fa(53472,53492,114,53505);else{l=b;return c[e>>2]|0}return 0}function Mt(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=Lt(c[d>>2]|0)|0;c[f>>2]=Vw((c[e>>2]|0)+4|0)|0;if(!(c[f>>2]|0)){g=c[f>>2]|0;l=b;return g|0}c[f>>2]=Ct(c[f>>2]|0)|0;g=c[f>>2]|0;l=b;return g|0}function Nt(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=Lt(c[d>>2]|0)|0;c[f>>2]=dx((c[e>>2]|0)+4|0)|0;if(!(c[f>>2]|0)){g=c[f>>2]|0;l=b;return g|0}c[f>>2]=Ct(c[f>>2]|0)|0;g=c[f>>2]|0;l=b;return g|0}function Ot(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+64|0;if((l|0)>=(m|0))$(64);d=b+52|0;e=b+48|0;f=b+44|0;g=b;c[d>>2]=a;c[e>>2]=Lt(c[d>>2]|0)|0;c[f>>2]=Ya((c[e>>2]|0)+4|0)|0;if(c[f>>2]|0){c[f>>2]=Ct(c[f>>2]|0)|0;h=c[f>>2]|0;l=b;return h|0}else{e=g;a=e+44|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(a|0));c[g>>2]=1;e=c[d>>2]|0;d=g;a=e+44|0;do{c[e>>2]=c[d>>2];e=e+4|0;d=d+4|0}while((e|0)<(a|0));h=c[f>>2]|0;l=b;return h|0}return 0}function Pt(){Qt();return 0}function Qt(){St()|0;return}function Rt(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=c[d>>2]|0;c[(xu()|0)>>2]=a;l=b;return}function St(){if(c[17808]|0)return 0;c[17808]=1;nb(3)|0;return 0}function Tt(){Ut(0)|0;c[17809]=0;c[17810]=0;return}function Ut(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;if(c[d>>2]|0){Vt(c[d>>2]|0);c[e>>2]=Wt(c[d>>2]|0)|0;Xt(c[d>>2]|0);g=c[e>>2]|0;h=(g|0)!=0;i=h?-1:0;l=b;return i|0}c[e>>2]=0;Yt();c[f>>2]=c[17811];while(1){if(!(c[f>>2]|0))break;if(c[(c[f>>2]|0)+4>>2]|0){Vt(c[(c[f>>2]|0)+4>>2]|0);d=Wt(c[(c[f>>2]|0)+4>>2]|0)|0;c[e>>2]=c[e>>2]|d;Xt(c[(c[f>>2]|0)+4>>2]|0)}c[f>>2]=c[c[f>>2]>>2]}Zt();g=c[e>>2]|0;h=(g|0)!=0;i=h?-1:0;l=b;return i|0}function Vt(a){a=a|0;var b=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b;c[e>>2]=a;if((d[(c[(c[e>>2]|0)+36>>2]|0)+1140>>0]|0)>>>5&1|0){l=b;return}Mt((c[(c[e>>2]|0)+36>>2]|0)+1040|0)|0;l=b;return}function Wt(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;a=c[d>>2]|0;if((c[c[d>>2]>>2]|0)>>>16&1|0){c[e>>2]=_t(a)|0;f=c[e>>2]|0;l=b;return f|0}else{$t(a);c[e>>2]=0;f=c[e>>2]|0;l=b;return f|0}return 0}function Xt(a){a=a|0;var b=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b;c[e>>2]=a;if((d[(c[(c[e>>2]|0)+36>>2]|0)+1140>>0]|0)>>>5&1|0){l=b;return}Nt((c[(c[e>>2]|0)+36>>2]|0)+1040|0)|0;l=b;return}function Yt(){Mt(13160)|0;return}function Zt(){Nt(13160)|0;return}function _t(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+20|0;f=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;c[e>>2]=b;c[f>>2]=c[(c[(c[e>>2]|0)+36>>2]|0)+1108>>2];if(!((c[c[e>>2]>>2]|0)>>>16&1))Fa(53563,53544,1654,53585);do if(c[(c[e>>2]|0)+16>>2]|0){if(!(c[f>>2]|0)){c[g>>2]=95;break}c[i>>2]=0;c[g>>2]=0;do{if(((c[(c[e>>2]|0)+16>>2]|0)-(c[i>>2]|0)|0)<=0)break;if(!((c[g>>2]|0)!=0^1))break;c[j>>2]=ub[c[f>>2]&63](c[(c[(c[e>>2]|0)+36>>2]|0)+1084>>2]|0,(c[(c[e>>2]|0)+4>>2]|0)+(c[i>>2]|0)|0,(c[(c[e>>2]|0)+16>>2]|0)-(c[i>>2]|0)|0)|0;if((c[j>>2]|0)==-1){c[h>>2]=0;c[g>>2]=-1}else c[h>>2]=c[j>>2];c[i>>2]=(c[i>>2]|0)+(c[h>>2]|0)}while(!(c[g>>2]|0));b=(c[e>>2]|0)+20|0;c[b>>2]=(c[b>>2]|0)+(c[i>>2]|0);if((c[(c[e>>2]|0)+16>>2]|0)==(c[i>>2]|0)){b=(c[(c[e>>2]|0)+36>>2]|0)+1100|0;c[b>>2]=(c[b>>2]|0)+(c[(c[e>>2]|0)+16>>2]|0);c[(c[e>>2]|0)+16>>2]=0;c[(c[e>>2]|0)+20>>2]=0;ub[c[f>>2]&63](c[(c[(c[e>>2]|0)+36>>2]|0)+1084>>2]|0,0,0)|0}}else c[g>>2]=0;while(0);if(!(c[g>>2]|0)){k=c[g>>2]|0;l=d;return k|0}f=(c[(c[e>>2]|0)+36>>2]|0)+1136|0;a[f>>0]=a[f>>0]&-2|1;k=c[g>>2]|0;l=d;return k|0}function $t(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if((c[c[d>>2]>>2]|0)>>>16&1|0)Fa(53521,53544,1722,53554);else{c[(c[d>>2]|0)+12>>2]=0;c[(c[d>>2]|0)+16>>2]=0;c[(c[d>>2]|0)+32>>2]=0;l=b;return}}function au(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+12|0;e=b+8|0;f=b+4|0;g=b;c[e>>2]=a;c[f>>2]=bu(c[e>>2]|0)|0;do if(c[f>>2]&32768|0){c[g>>2]=Dt(c[f>>2]|0)|0;if(!(c[g>>2]|0)){c[f>>2]=16382;break}c[d>>2]=Nu(c[g>>2]|0)|0;h=c[d>>2]|0;l=b;return h|0}while(0);c[d>>2]=53594+(c[13204+((cu(c[f>>2]|0)|0)<<2)>>2]|0);h=c[d>>2]|0;l=b;return h|0}function bu(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;l=b;return c[d>>2]&65535|0}function cu(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=c[d>>2]|0;if((c[d>>2]|0)>=0&(c[d>>2]|0)<=213){e=a-0|0;l=b;return e|0}f=c[d>>2]|0;if((a|0)>=222&(c[d>>2]|0)<=254){e=f-8|0;l=b;return e|0}a=c[d>>2]|0;if((f|0)>=257&(c[d>>2]|0)<=271){e=a-10|0;l=b;return e|0}f=c[d>>2]|0;if((a|0)>=273&(c[d>>2]|0)<=281){e=f-11|0;l=b;return e|0}a=c[d>>2]|0;if((f|0)>=721&(c[d>>2]|0)<=729){e=a-450|0;l=b;return e|0}f=c[d>>2]|0;if((a|0)>=750&(c[d>>2]|0)<=752){e=f-470|0;l=b;return e|0}a=c[d>>2]|0;if((f|0)>=754&(c[d>>2]|0)<=782){e=a-471|0;l=b;return e|0}f=c[d>>2]|0;if((a|0)>=784&(c[d>>2]|0)<=789){e=f-472|0;l=b;return e|0}a=c[d>>2]|0;if((f|0)>=800&(c[d>>2]|0)<=804){e=a-482|0;l=b;return e|0}f=c[d>>2]|0;if((a|0)>=815&(c[d>>2]|0)<=822){e=f-492|0;l=b;return e|0}a=c[d>>2]|0;if((f|0)>=832&(c[d>>2]|0)<=839){e=a-501|0;l=b;return e|0}f=c[d>>2]|0;if((a|0)>=844&(c[d>>2]|0)<=844){e=f-505|0;l=b;return e|0}a=c[d>>2]|0;if((f|0)>=848&(c[d>>2]|0)<=848){e=a-508|0;l=b;return e|0}f=c[d>>2]|0;if((a|0)>=881&(c[d>>2]|0)<=891){e=f-540|0;l=b;return e|0}a=c[d>>2]|0;if((f|0)>=1024&(c[d>>2]|0)<=1039){e=a-672|0;l=b;return e|0}else{e=(a|0)>=16381&(c[d>>2]|0)<=16383?(c[d>>2]|0)-16013|0:371;l=b;return e|0}return 0}function du(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;do if(c[e>>2]&32768|0){c[e>>2]=c[e>>2]&-32769;if((c[e>>2]|0)>>>0<141){c[d>>2]=c[14692+(c[e>>2]<<2)>>2];break}else{c[d>>2]=0;break}}else c[d>>2]=0;while(0);l=b;return c[d>>2]|0}function eu(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;if(!(c[e>>2]|0)){c[d>>2]=0;g=c[d>>2]|0;l=b;return g|0}a=c[e>>2]|0;do if(!((c[e>>2]|0)>=1&(c[e>>2]|0)<=11)){h=c[e>>2]|0;if((a|0)>=11&(c[e>>2]|0)<=35){i=h-0|0;break}j=c[e>>2]|0;if((h|0)>=35&(c[e>>2]|0)<=40){i=j+1|0;break}h=c[e>>2]|0;if((j|0)>=42&(c[e>>2]|0)<=57){i=h-0|0;break}j=c[e>>2]|0;if((h|0)>=59&(c[e>>2]|0)<=95){i=j-1|0;break}else{i=(j|0)>=95&(c[e>>2]|0)<=125?(c[e>>2]|0)-0|0:-1;break}}else i=a-1|0;while(0);c[f>>2]=i;if((c[f>>2]|0)<0){c[d>>2]=16382;g=c[d>>2]|0;l=b;return g|0}else{c[d>>2]=32768|c[15256+(c[f>>2]<<2)>>2];g=c[d>>2]|0;l=b;return g|0}return 0}function fu(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a+8|0;d=a+4|0;e=a;c[d>>2]=c[(xu()|0)>>2];if(!(c[d>>2]|0)){c[b>>2]=16381;f=c[b>>2]|0;l=a;return f|0}g=c[d>>2]|0;do if(!((c[d>>2]|0)>=1&(c[d>>2]|0)<=11)){h=c[d>>2]|0;if((g|0)>=11&(c[d>>2]|0)<=35){i=h-0|0;break}j=c[d>>2]|0;if((h|0)>=35&(c[d>>2]|0)<=40){i=j+1|0;break}h=c[d>>2]|0;if((j|0)>=42&(c[d>>2]|0)<=57){i=h-0|0;break}j=c[d>>2]|0;if((h|0)>=59&(c[d>>2]|0)<=95){i=j-1|0;break}else{i=(j|0)>=95&(c[d>>2]|0)<=125?(c[d>>2]|0)-0|0:-1;break}}else i=g-1|0;while(0);c[e>>2]=i;if((c[e>>2]|0)<0){c[b>>2]=16382;f=c[b>>2]|0;l=a;return f|0}else{c[b>>2]=32768|c[15256+(c[e>>2]<<2)>>2];f=c[b>>2]|0;l=a;return f|0}return 0}function gu(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+4|0;g=e;c[f>>2]=b;c[g>>2]=d;d=c[g>>2]|0;b=Ad(c[d>>2]|0,c[d+4>>2]|0)|0;d=D;h=c[f>>2]|0;i=h;a[i>>0]=b;a[i+1>>0]=b>>8;a[i+2>>0]=b>>16;a[i+3>>0]=b>>24;b=h+4|0;a[b>>0]=d;a[b+1>>0]=d>>8;a[b+2>>0]=d>>16;a[b+3>>0]=d>>24;d=Iv(c[(c[g>>2]|0)+8>>2]|0)|0;b=(c[f>>2]|0)+8|0;a[b>>0]=d;a[b+1>>0]=d>>8;a[b+2>>0]=d>>16;a[b+3>>0]=d>>24;d=(c[f>>2]|0)+12|0;f=(c[g>>2]|0)+12|0;g=d+12|0;do{a[d>>0]=a[f>>0]|0;d=d+1|0;f=f+1|0}while((d|0)<(g|0));l=e;return}function hu(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+4|0;h=f;c[g>>2]=b;c[h>>2]=e;e=c[h>>2]|0;b=e;i=e+4|0;e=Bd(d[b>>0]|d[b+1>>0]<<8|d[b+2>>0]<<16|d[b+3>>0]<<24,d[i>>0]|d[i+1>>0]<<8|d[i+2>>0]<<16|d[i+3>>0]<<24)|0;i=c[g>>2]|0;c[i>>2]=e;c[i+4>>2]=D;i=(c[h>>2]|0)+8|0;e=Mv(d[i>>0]|d[i+1>>0]<<8|d[i+2>>0]<<16|d[i+3>>0]<<24)|0;c[(c[g>>2]|0)+8>>2]=e;e=(c[g>>2]|0)+12|0;g=(c[h>>2]|0)+12|0;h=e+12|0;do{a[e>>0]=a[g>>0]|0;e=e+1|0;g=g+1|0}while((e|0)<(h|0));l=f;return}function iu(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+8|0;g=d+4|0;h=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=hv(c[f>>2]|0)|0;if((c[h>>2]|0)>>>0>=12){c[e>>2]=-1;i=c[e>>2]|0;l=d;return i|0}else{b=c[g>>2]|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;_w((c[g>>2]|0)+12|0,c[f>>2]|0,c[h>>2]|0)|0;c[e>>2]=1;i=c[e>>2]|0;l=d;return i|0}return 0}function ju(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[f>>2]=a;c[g>>2]=b;do if(0!=(ku(c[f>>2]|0)|0)?0!=(ku(c[g>>2]|0)|0):0)if(!(sv((c[f>>2]|0)+12|0,(c[g>>2]|0)+12|0)|0)){c[e>>2]=1;break}else{c[e>>2]=0;break}else h=3;while(0);if((h|0)==3)c[e>>2]=-1;l=d;return c[e>>2]|0}function ku(b){b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;l=d;return 0!=(a[(c[e>>2]|0)+12>>0]|0)|0}function lu(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;d=l;l=l+96|0;if((l|0)>=(m|0))$(96);e=d+64|0;f=d+56|0;g=d+48|0;h=d+92|0;i=d+88|0;j=d+84|0;k=d+24|0;n=d;o=d+80|0;p=d+76|0;q=d+72|0;c[i>>2]=a;c[j>>2]=b;if(1!=(ju(c[i>>2]|0,c[j>>2]|0)|0)){c[o>>2]=349;if((c[3940]|0)==-1)c[3940]=$b(1,0,61609,61618,c[o>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3940]|0))_b();c[g>>2]=61609;c[g+4>>2]=349;cc(1,61747,g);_b()}g=c[i>>2]|0;c[k>>2]=c[g>>2];c[k+4>>2]=c[g+4>>2];c[k+8>>2]=c[g+8>>2];c[k+12>>2]=c[g+12>>2];c[k+16>>2]=c[g+16>>2];c[k+20>>2]=c[g+20>>2];g=c[j>>2]|0;c[n>>2]=c[g>>2];c[n+4>>2]=c[g+4>>2];c[n+8>>2]=c[g+8>>2];c[n+12>>2]=c[g+12>>2];c[n+16>>2]=c[g+16>>2];c[n+20>>2]=c[g+20>>2];if(-1==(mu(k)|0)){c[p>>2]=353;if((c[3941]|0)==-1)c[3941]=$b(1,0,61609,61618,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3941]|0))_b();c[f>>2]=61609;c[f+4>>2]=353;cc(1,61747,f);_b()}if(-1==(mu(n)|0)){c[q>>2]=355;if((c[3942]|0)==-1)c[3942]=$b(1,0,61609,61618,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3942]|0))_b();c[e>>2]=61609;c[e+4>>2]=355;cc(1,61747,e);_b()}e=k;q=n;if(!((c[e>>2]|0)==(c[q>>2]|0)?(c[e+4>>2]|0)==(c[q+4>>2]|0):0)){q=k;e=c[q+4>>2]|0;f=n;p=c[f+4>>2]|0;if(e>>>0

>>0|((e|0)==(p|0)?(c[q>>2]|0)>>>0<(c[f>>2]|0)>>>0:0)){c[h>>2]=-1;r=c[h>>2]|0;l=d;return r|0}else{c[h>>2]=1;r=c[h>>2]|0;l=d;return r|0}}if((c[k+8>>2]|0)>>>0<(c[n+8>>2]|0)>>>0){c[h>>2]=-1;r=c[h>>2]|0;l=d;return r|0}if((c[k+8>>2]|0)>>>0>(c[n+8>>2]|0)>>>0){c[h>>2]=1;r=c[h>>2]|0;l=d;return r|0}else{c[h>>2]=0;r=c[h>>2]|0;l=d;return r|0}return 0}function mu(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[e>>2]=a;if(1!=(ku(c[e>>2]|0)|0)){c[d>>2]=-1;g=c[d>>2]|0;l=b;return g|0}c[f>>2]=0;while(1){a=c[e>>2]|0;if((c[a>>2]|0)!=-1?1:(c[a+4>>2]|0)!=-1)h=(c[(c[e>>2]|0)+8>>2]|0)>>>0>=1e8;else h=0;a=(c[e>>2]|0)+8|0;i=c[a>>2]|0;if(!h)break;c[a>>2]=i-1e8;a=c[e>>2]|0;j=a;k=Ww(c[j>>2]|0,c[j+4>>2]|0,1,0)|0;j=a;c[j>>2]=k;c[j+4>>2]=D;c[f>>2]=1}if(i>>>0>=1e8){nu(c[e>>2]|0);c[d>>2]=-1;g=c[d>>2]|0;l=b;return g|0}else{c[d>>2]=c[f>>2];g=c[d>>2]|0;l=b;return g|0}return 0}function nu(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=c[d>>2]|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;l=b;return}function ou(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=l;l=l+112|0;if((l|0)>=(m|0))$(112);f=e+64|0;g=e+56|0;h=e+48|0;i=e+96|0;j=e+92|0;k=e+88|0;n=e+84|0;o=e+24|0;p=e;q=e+80|0;r=e+76|0;s=e+72|0;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;if(1!=(ju(c[k>>2]|0,c[n>>2]|0)|0)){nu(c[j>>2]|0);c[i>>2]=-1;t=c[i>>2]|0;l=e;return t|0}d=c[k>>2]|0;c[o>>2]=c[d>>2];c[o+4>>2]=c[d+4>>2];c[o+8>>2]=c[d+8>>2];c[o+12>>2]=c[d+12>>2];c[o+16>>2]=c[d+16>>2];c[o+20>>2]=c[d+20>>2];d=c[n>>2]|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];c[p+12>>2]=c[d+12>>2];c[p+16>>2]=c[d+16>>2];c[p+20>>2]=c[d+20>>2];if(-1!=(mu(o)|0)?-1!=(mu(p)|0):0){do if((c[o+8>>2]|0)>>>0<(c[p+8>>2]|0)>>>0){d=o;if(!(0==(c[d>>2]|0)?0==(c[d+4>>2]|0):0)){d=o+8|0;c[d>>2]=(c[d>>2]|0)+1e8;d=o;n=Ww(c[d>>2]|0,c[d+4>>2]|0,-1,-1)|0;d=o;c[d>>2]=n;c[d+4>>2]=D;break}nu(c[j>>2]|0);c[i>>2]=-1;t=c[i>>2]|0;l=e;return t|0}while(0);d=o;n=c[d+4>>2]|0;k=p;b=c[k+4>>2]|0;if(n>>>0>>0|((n|0)==(b|0)?(c[d>>2]|0)>>>0<(c[k>>2]|0)>>>0:0)){nu(c[j>>2]|0);c[i>>2]=-1;t=c[i>>2]|0;l=e;return t|0}if(1!=(iu(o+12|0,c[j>>2]|0)|0)){c[q>>2]=421;if((c[3943]|0)==-1)c[3943]=$b(1,0,61609,61635,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3943]|0))_b();c[h>>2]=61609;c[h+4>>2]=421;cc(1,61747,h);_b()}if((c[o+8>>2]|0)>>>0<(c[p+8>>2]|0)>>>0){c[r>>2]=422;if((c[3944]|0)==-1)c[3944]=$b(1,0,61609,61635,c[r>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3944]|0))_b();c[g>>2]=61609;c[g+4>>2]=422;cc(1,61747,g);_b()}c[(c[j>>2]|0)+8>>2]=(c[o+8>>2]|0)-(c[p+8>>2]|0);g=o;r=c[g+4>>2]|0;h=p;q=c[h+4>>2]|0;if(r>>>0>q>>>0|((r|0)==(q|0)?(c[g>>2]|0)>>>0>=(c[h>>2]|0)>>>0:0)){h=o;o=p;p=Tw(c[h>>2]|0,c[h+4>>2]|0,c[o>>2]|0,c[o+4>>2]|0)|0;o=c[j>>2]|0;c[o>>2]=p;c[o+4>>2]=D;if(0==(c[(c[j>>2]|0)+8>>2]|0)?(o=c[j>>2]|0,0==(c[o>>2]|0)?0==(c[o+4>>2]|0):0):0){c[i>>2]=0;t=c[i>>2]|0;l=e;return t|0}c[i>>2]=1;t=c[i>>2]|0;l=e;return t|0}c[s>>2]=424;if((c[3945]|0)==-1)c[3945]=$b(1,0,61609,61635,c[s>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3945]|0))_b();c[f>>2]=61609;c[f+4>>2]=424;cc(1,61747,f);_b()}nu(c[j>>2]|0);c[i>>2]=-1;t=c[i>>2]|0;l=e;return t|0}function pu(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+112|0;if((l|0)>=(m|0))$(112);f=e+72|0;g=e+96|0;h=e+92|0;i=e+88|0;j=e+84|0;k=e+48|0;n=e+24|0;o=e;p=e+80|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;if(1!=(ju(c[i>>2]|0,c[j>>2]|0)|0)){nu(c[h>>2]|0);c[g>>2]=-1;q=c[g>>2]|0;l=e;return q|0}d=c[i>>2]|0;c[k>>2]=c[d>>2];c[k+4>>2]=c[d+4>>2];c[k+8>>2]=c[d+8>>2];c[k+12>>2]=c[d+12>>2];c[k+16>>2]=c[d+16>>2];c[k+20>>2]=c[d+20>>2];d=c[j>>2]|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];c[n+12>>2]=c[d+12>>2];c[n+16>>2]=c[d+16>>2];c[n+20>>2]=c[d+20>>2];if(-1!=(mu(k)|0)?-1!=(mu(n)|0):0){if(1==(iu((c[i>>2]|0)+12|0,o)|0)){i=k;d=n;j=Ww(c[i>>2]|0,c[i+4>>2]|0,c[d>>2]|0,c[d+4>>2]|0)|0;d=o;c[d>>2]=j;c[d+4>>2]=D;d=o;j=c[d+4>>2]|0;i=k;b=c[i+4>>2]|0;if(j>>>0>>0|((j|0)==(b|0)?(c[d>>2]|0)>>>0<(c[i>>2]|0)>>>0:0)){nu(c[h>>2]|0);c[g>>2]=-1;q=c[g>>2]|0;l=e;return q|0}c[o+8>>2]=(c[k+8>>2]|0)+(c[n+8>>2]|0);n=-1==(mu(o)|0);k=c[h>>2]|0;if(n){nu(k);c[g>>2]=-1;q=c[g>>2]|0;l=e;return q|0}else{c[k>>2]=c[o>>2];c[k+4>>2]=c[o+4>>2];c[k+8>>2]=c[o+8>>2];c[k+12>>2]=c[o+12>>2];c[k+16>>2]=c[o+16>>2];c[k+20>>2]=c[o+20>>2];c[g>>2]=1;q=c[g>>2]|0;l=e;return q|0}}c[p>>2]=468;if((c[3946]|0)==-1)c[3946]=$b(1,0,61609,61657,c[p>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3946]|0))_b();c[f>>2]=61609;c[f+4>>2]=468;cc(1,61747,f);_b()}nu(c[h>>2]|0);c[g>>2]=-1;q=c[g>>2]|0;l=e;return q|0}function qu(){var a=0,b=0,d=0;a=l;l=l+32|0;if((l|0)>=(m|0))$(32);b=a+16|0;d=a+8|0;He(6,0);if(Gd(61674)|0){c[d>>2]=0;Hd(37,d)|0;c[b>>2]=0;Hd(38,b)|0;l=a;return}else{Fv(c[3977]|0,61680,a)|0;Aa()}}function ru(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;g=e+4|0;c[e+12>>2]=a;c[e+8>>2]=b;c[g>>2]=d;d=c[3977]|0;c[f>>2]=c[g>>2];Fv(d,61708,f)|0;Aa()}function su(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+16|0;i=g;j=g+44|0;k=g+40|0;n=g+36|0;o=g+32|0;p=g+28|0;q=g+24|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=Iv(c[k>>2]|0)|0;k=c[n>>2]|0;f=c[j>>2]|0;c[i>>2]=61775;c[i+4>>2]=21;c[i+8>>2]=0;c[i+12>>2]=0;if(1==(Mc(k,64,o,4,f,64,i)|0)){c[p>>2]=c[n>>2];n=c[p>>2]|0;a[n>>0]=(d[n>>0]|0)&127;n=c[p>>2]|0;a[n>>0]=d[n>>0]|0|64;n=(c[p>>2]|0)+31|0;a[n>>0]=(d[n>>0]|0)&248;l=g;return}c[q>>2]=197;if((c[3947]|0)==-1)c[3947]=$b(1,0,61738,61797,c[q>>2]|0)|0;if((ac()|0)>0){bc(-1,0);_b()}if(!(c[3947]|0))_b();c[h>>2]=61738;c[h+4>>2]=197;cc(1,61747,h);_b()}function tu(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=c[a+60>>2];a=wu(hb(6,d|0)|0)|0;l=b;return a|0}function uu(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+80|0;if((l|0)>=(m|0))$(80);g=f;c[b+36>>2]=25;if((c[b>>2]&64|0)==0?(c[g>>2]=c[b+60>>2],c[g+4>>2]=21505,c[g+8>>2]=f+12,bb(54,g|0)|0):0)a[b+75>>0]=-1;g=yu(b,d,e)|0;l=f;return g|0}function vu(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;g=e+20|0;c[f>>2]=c[a+60>>2];c[f+4>>2]=0;c[f+8>>2]=b;c[f+12>>2]=g;c[f+16>>2]=d;if((wu(ob(140,f|0)|0)|0)<0){c[g>>2]=-1;h=-1}else h=c[g>>2]|0;l=e;return h|0}function wu(a){a=a|0;var b=0;if(a>>>0>4294963200){c[(xu()|0)>>2]=0-a;b=-1}else b=a;return b|0}function xu(){var a=0;if(!(c[17812]|0))a=71292;else a=c[(kx()|0)+64>>2]|0;return a|0}function yu(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+16|0;g=e;h=e+32|0;i=a+28|0;j=c[i>>2]|0;c[h>>2]=j;k=a+20|0;n=(c[k>>2]|0)-j|0;c[h+4>>2]=n;c[h+8>>2]=b;c[h+12>>2]=d;b=a+60|0;j=a+44|0;o=2;p=n+d|0;n=h;while(1){if(!(c[17812]|0)){c[f>>2]=c[b>>2];c[f+4>>2]=n;c[f+8>>2]=o;q=wu(sb(146,f|0)|0)|0}else{Ca(6,a|0);c[g>>2]=c[b>>2];c[g+4>>2]=n;c[g+8>>2]=o;h=wu(sb(146,g|0)|0)|0;wa(0);q=h}if((p|0)==(q|0)){r=6;break}if((q|0)<0){r=8;break}h=p-q|0;s=c[n+4>>2]|0;if(q>>>0<=s>>>0)if((o|0)==2){c[i>>2]=(c[i>>2]|0)+q;t=q;u=2;v=n;w=s}else{t=q;u=o;v=n;w=s}else{x=c[j>>2]|0;c[i>>2]=x;c[k>>2]=x;t=q-s|0;u=o+-1|0;v=n+8|0;w=c[n+12>>2]|0}c[v>>2]=(c[v>>2]|0)+t;c[v+4>>2]=w-t;o=u;p=h;n=v}if((r|0)==6){v=c[j>>2]|0;c[a+16>>2]=v+(c[a+48>>2]|0);j=v;c[i>>2]=j;c[k>>2]=j;y=d}else if((r|0)==8){c[a+16>>2]=0;c[i>>2]=0;c[k>>2]=0;c[a>>2]=c[a>>2]|32;if((o|0)==2)y=0;else y=d-(c[n+4>>2]|0)|0}l=e;return y|0}function zu(a){a=a|0;if(!(c[a+68>>2]|0))Au(a);return}function Au(a){a=a|0;return}function Bu(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f+16|0;h=f;i=f+32|0;c[i>>2]=d;j=i+4|0;k=b+48|0;n=c[k>>2]|0;c[j>>2]=e-((n|0)!=0&1);o=b+44|0;c[i+8>>2]=c[o>>2];c[i+12>>2]=n;if(!(c[17812]|0)){c[g>>2]=c[b+60>>2];c[g+4>>2]=i;c[g+8>>2]=2;p=wu(rb(145,g|0)|0)|0}else{Ca(7,b|0);c[h>>2]=c[b+60>>2];c[h+4>>2]=i;c[h+8>>2]=2;i=wu(rb(145,h|0)|0)|0;wa(0);p=i}if((p|0)>=1){i=c[j>>2]|0;if(p>>>0>i>>>0){j=c[o>>2]|0;o=b+4|0;c[o>>2]=j;h=j;c[b+8>>2]=h+(p-i);if(!(c[k>>2]|0))q=e;else{c[o>>2]=h+1;a[d+(e+-1)>>0]=a[h>>0]|0;q=e}}else q=p}else{c[b>>2]=c[b>>2]|p&48^16;c[b+8>>2]=0;c[b+4>>2]=0;q=p}l=f;return q|0}function Cu(a){a=a|0;if(!(c[a+68>>2]|0))Au(a);return}function Du(a){a=a|0;return Eu(a)|0}function Eu(a){a=a|0;return ((a|0)==32|(a|0)==9)&1|0}function Fu(b,c){b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=a[b>>0]|0;e=a[c>>0]|0;if(d<<24>>24==0?1:d<<24>>24!=e<<24>>24){f=e;g=d}else{d=c;c=b;do{c=c+1|0;d=d+1|0;b=a[c>>0]|0;e=a[d>>0]|0}while(!(b<<24>>24==0?1:b<<24>>24!=e<<24>>24));f=e;g=b}return (g&255)-(f&255)|0}function Gu(a){a=a|0;var b=0;b=(Hu(a)|0)==0;return (b?a:a|32)|0}function Hu(a){a=a|0;return (a+-65|0)>>>0<26|0}function Iu(a){a=a|0;return Ku(a,0)|0}function Ju(a){a=a|0;return Ku(a,1)|0}function Ku(c,f){c=c|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;g=(f<<1)+-1|0;h=f+-1|0;a:do if((c+-43008|0)>>>0<22272|((c+-11776|0)>>>0<30784|((c+-1536|0)>>>0<2560|(Lu(c)|0)==0)))i=c;else{j=(f|0)!=0;if(j&(c+-4256|0)>>>0<46){if((c|0)>4293)switch(c|0){case 4295:case 4301:break;default:{i=c;break a}}i=c+7264|0;break}if((c+-11520|0)>>>0<38&(j^1)){if((c|0)>11557)switch(c|0){case 11559:case 11565:break;default:{i=c;break a}}i=c+-7264|0;break}else k=0;do{l=a[18910+(k<<2)+2>>0]|0;m=l<<24>>24;n=c-(e[18910+(k<<2)>>1]|0)|0;if((n-(m&h)|0)>>>0<(d[18910+(k<<2)+3>>0]|0)>>>0){o=13;break}k=k+1|0}while((k|0)!=61);if((o|0)==13)if(l<<24>>24==1){i=f+c-(n&1)|0;break}else{i=(S(m,g)|0)+c|0;break}j=1-f|0;p=b[18418+(j<<1)>>1]|0;b:do if(p<<16>>16){q=0;r=p;while(1){if((r&65535|0)==(c|0))break;s=q+1|0;r=b[18418+(s<<2)+(j<<1)>>1]|0;if(!(r<<16>>16))break b;else q=s}i=e[18418+(q<<2)+(f<<1)>>1]|0;break a}while(0);return ((c+-66600+(f*40|0)|0)>>>0<40?c+-40+(f*80|0)|0:c)|0}while(0);return i|0}function Lu(a){a=a|0;var b=0;if(a>>>0<131072)b=(d[61820+((d[61820+(a>>>8)>>0]|0)<<5|a>>>3&31)>>0]|0)>>>(a&7)&1;else b=a>>>0<196606&1;return b|0}function Mu(a){a=a|0;return (a+-97|0)>>>0<26|0}function Nu(b){b=b|0;var c=0,e=0,f=0,g=0,h=0,i=0;c=0;while(1){if((d[64796+c>>0]|0)==(b|0)){e=2;break}f=c+1|0;if((f|0)==87){g=64884;h=87;e=5;break}else c=f}if((e|0)==2)if(!c)i=64884;else{g=64884;h=c;e=5}if((e|0)==5)while(1){e=0;c=g;do{b=c;c=c+1|0}while((a[b>>0]|0)!=0);h=h+-1|0;if(!h){i=c;break}else{g=c;e=5}}return i|0}function Ou(a){a=a|0;var b=0;if(!a)b=0;else b=(Pu(16228,a)|0)!=0;return b&1|0}function Pu(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;if(!b)d=a+((Qu(a)|0)<<2)|0;else{e=a;while(1){f=c[e>>2]|0;if((f|0)==0|(f|0)==(b|0))break;else e=e+4|0}d=f|0?e:0}return d|0}function Qu(a){a=a|0;var b=0;b=a;while(1)if(!(c[b>>2]|0))break;else b=b+4|0;return b-a>>2|0}function Ru(a){a=a|0;return ((a+-48|0)>>>0<10|((a|32)+-97|0)>>>0<6)&1|0}function Su(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f;c[g>>2]=e;e=Tu(a,b,d,g)|0;l=f;return e|0}function Tu(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;g=l;l=l+128|0;if((l|0)>=(m|0))$(128);h=g+112|0;i=g;j=i;k=16316;n=j+112|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(n|0));if((d+-1|0)>>>0>2147483646)if(!d){o=h;p=1;q=4}else{c[(xu()|0)>>2]=75;r=-1}else{o=b;p=d;q=4}if((q|0)==4){q=-2-o|0;d=p>>>0>q>>>0?q:p;c[i+48>>2]=d;p=i+20|0;c[p>>2]=o;c[i+44>>2]=o;q=o+d|0;o=i+16|0;c[o>>2]=q;c[i+28>>2]=q;q=Uu(i,e,f)|0;if(!d)r=q;else{d=c[p>>2]|0;a[d+(((d|0)==(c[o>>2]|0))<<31>>31)>>0]=0;r=q}}l=g;return r|0}function Uu(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;f=l;l=l+224|0;if((l|0)>=(m|0))$(224);g=f+120|0;h=f+80|0;i=f;j=f+136|0;k=h;n=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(n|0));c[g>>2]=c[e>>2];if((Vu(0,d,g,i,h)|0)<0)o=-1;else{if((c[b+76>>2]|0)>-1)p=Wu(b)|0;else p=0;e=c[b>>2]|0;k=e&32;if((a[b+74>>0]|0)<1)c[b>>2]=e&-33;e=b+48|0;if(!(c[e>>2]|0)){n=b+44|0;q=c[n>>2]|0;c[n>>2]=j;r=b+28|0;c[r>>2]=j;s=b+20|0;c[s>>2]=j;c[e>>2]=80;t=b+16|0;c[t>>2]=j+80;j=Vu(b,d,g,i,h)|0;if(!q)u=j;else{ub[c[b+36>>2]&63](b,0,0)|0;v=(c[s>>2]|0)==0?-1:j;c[n>>2]=q;c[e>>2]=0;c[t>>2]=0;c[r>>2]=0;c[s>>2]=0;u=v}}else u=Vu(b,d,g,i,h)|0;h=c[b>>2]|0;c[b>>2]=h|k;if(p|0)Au(b);o=(h&32|0)==0?u:-1}l=f;return o|0}function Vu(e,f,g,i,k){e=e|0;f=f|0;g=g|0;i=i|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0.0,cb=0.0,db=0,eb=0,fb=0,gb=0,hb=0.0,ib=0,jb=0.0,kb=0,lb=0,mb=0,nb=0.0,ob=0,pb=0,qb=0,rb=0,sb=0.0,tb=0,ub=0,vb=0,wb=0,xb=0,yb=0,zb=0,Ab=0,Bb=0,Cb=0,Db=0,Eb=0,Fb=0,Gb=0,Hb=0,Ib=0,Jb=0,Kb=0,Lb=0,Mb=0,Nb=0,Ob=0,Pb=0,Qb=0.0,Rb=0.0,Sb=0.0,Tb=0,Ub=0,Vb=0,Wb=0,Xb=0,Yb=0,Zb=0,_b=0,$b=0,ac=0,bc=0,cc=0,dc=0,ec=0,fc=0,gc=0,hc=0,ic=0,jc=0,kc=0,lc=0,mc=0,nc=0,oc=0,pc=0,qc=0,rc=0,sc=0,tc=0,uc=0,vc=0,wc=0,xc=0;n=l;l=l+624|0;if((l|0)>=(m|0))$(624);o=n+24|0;p=n+16|0;q=n+588|0;r=n+576|0;s=n;t=n+536|0;u=n+8|0;v=n+528|0;w=(e|0)!=0;x=t+40|0;y=x;z=t+39|0;t=u+4|0;A=q;B=0-A|0;C=r+12|0;E=r+11|0;r=C;F=r-A|0;G=-2-A|0;H=r+2|0;I=o+288|0;J=q+9|0;K=J;L=q+8|0;M=0;N=0;O=0;P=f;a:while(1){do if((N|0)>-1)if((M|0)>(2147483647-N|0)){c[(xu()|0)>>2]=75;Q=-1;break}else{Q=M+N|0;break}else Q=N;while(0);f=a[P>>0]|0;if(!(f<<24>>24)){R=243;break}else{T=P;U=f}b:while(1){switch(U<<24>>24){case 37:{V=T;W=T;R=9;break b;break}case 0:{X=T;Y=T;break b;break}default:{}}f=T+1|0;T=f;U=a[f>>0]|0}c:do if((R|0)==9)while(1){R=0;if((a[W+1>>0]|0)!=37){X=V;Y=W;break c}f=V+1|0;Z=W+2|0;if((a[Z>>0]|0)==37){V=f;W=Z;R=9}else{X=f;Y=Z;break}}while(0);Z=X-P|0;if(w?(c[e>>2]&32|0)==0:0)Xu(P,Z,e)|0;if(Z|0){M=Z;N=Q;P=Y;continue}Z=Y+1|0;f=a[Z>>0]|0;_=(f<<24>>24)+-48|0;if(_>>>0<10){aa=(a[Y+2>>0]|0)==36;ba=aa?Y+3|0:Z;ca=aa?_:-1;da=aa?1:O;ea=a[ba>>0]|0;fa=ba}else{ca=-1;da=O;ea=f;fa=Z}Z=(ea<<24>>24)+-32|0;d:do if(Z>>>0<32){f=0;ba=Z;aa=ea;_=fa;while(1){if(!(1<>24)+-32|f;ka=_+1|0;la=a[ka>>0]|0;ba=(la<<24>>24)+-32|0;if(ba>>>0>=32){ga=ja;ha=la;ia=ka;break}else{f=ja;aa=la;_=ka}}}else{ga=0;ha=ea;ia=fa}while(0);do if(ha<<24>>24!=42){Z=(ha<<24>>24)+-48|0;if(Z>>>0<10){_=0;aa=ia;f=Z;do{_=(_*10|0)+f|0;aa=aa+1|0;ma=a[aa>>0]|0;f=(ma<<24>>24)+-48|0}while(f>>>0<10);if((_|0)<0){na=-1;break a}else{oa=_;pa=ga;qa=da;ra=aa;sa=ma}}else{oa=0;pa=ga;qa=da;ra=ia;sa=ha}}else{f=ia+1|0;Z=a[f>>0]|0;ba=(Z<<24>>24)+-48|0;if(ba>>>0<10?(a[ia+2>>0]|0)==36:0){c[k+(ba<<2)>>2]=10;ta=c[i+((a[f>>0]|0)+-48<<3)>>2]|0;ua=1;va=ia+3|0}else{if(da|0){na=-1;break a}if(!w){oa=0;pa=ga;qa=0;ra=f;sa=Z;break}Z=(c[g>>2]|0)+(4-1)&~(4-1);ba=c[Z>>2]|0;c[g>>2]=Z+4;ta=ba;ua=0;va=f}f=(ta|0)<0;oa=f?0-ta|0:ta;pa=f?ga|8192:ga;qa=ua;ra=va;sa=a[va>>0]|0}while(0);e:do if(sa<<24>>24==46){f=ra+1|0;ba=a[f>>0]|0;if(ba<<24>>24!=42){Z=(ba<<24>>24)+-48|0;if(Z>>>0<10){wa=0;xa=f;ya=Z}else{za=0;Aa=f;break}while(1){f=(wa*10|0)+ya|0;Z=xa+1|0;ya=(a[Z>>0]|0)+-48|0;if(ya>>>0>=10){za=f;Aa=Z;break e}else{wa=f;xa=Z}}}aa=ra+2|0;_=(a[aa>>0]|0)+-48|0;if(_>>>0<10?(a[ra+3>>0]|0)==36:0){c[k+(_<<2)>>2]=10;za=c[i+((a[aa>>0]|0)+-48<<3)>>2]|0;Aa=ra+4|0;break}if(qa|0){na=-1;break a}if(w){_=(c[g>>2]|0)+(4-1)&~(4-1);Z=c[_>>2]|0;c[g>>2]=_+4;za=Z;Aa=aa}else{za=0;Aa=aa}}else{za=-1;Aa=ra}while(0);aa=0;Z=Aa;while(1){_=(a[Z>>0]|0)+-65|0;if(_>>>0>57){na=-1;break a}Ba=Z+1|0;Ca=a[66688+(aa*58|0)+_>>0]|0;Da=Ca&255;if((Da+-1|0)>>>0<8){aa=Da;Z=Ba}else break}if(!(Ca<<24>>24)){na=-1;break}_=(ca|0)>-1;do if(Ca<<24>>24==19)if(_){na=-1;break a}else R=51;else{if(_){c[k+(ca<<2)>>2]=Da;f=i+(ca<<3)|0;ba=c[f+4>>2]|0;ka=s;c[ka>>2]=c[f>>2];c[ka+4>>2]=ba;R=51;break}if(!w){na=0;break a}Yu(s,Da,g)}while(0);if((R|0)==51?(R=0,!w):0){M=0;N=Q;O=qa;P=Ba;continue}_=a[Z>>0]|0;ba=(aa|0)!=0&(_&15|0)==3?_&-33:_;_=pa&-65537;ka=(pa&8192|0)==0?pa:_;f:do switch(ba|0){case 110:{switch((aa&255)<<24>>24){case 0:{c[c[s>>2]>>2]=Q;M=0;N=Q;O=qa;P=Ba;continue a;break}case 1:{c[c[s>>2]>>2]=Q;M=0;N=Q;O=qa;P=Ba;continue a;break}case 2:{f=c[s>>2]|0;c[f>>2]=Q;c[f+4>>2]=((Q|0)<0)<<31>>31;M=0;N=Q;O=qa;P=Ba;continue a;break}case 3:{b[c[s>>2]>>1]=Q;M=0;N=Q;O=qa;P=Ba;continue a;break}case 4:{a[c[s>>2]>>0]=Q;M=0;N=Q;O=qa;P=Ba;continue a;break}case 6:{c[c[s>>2]>>2]=Q;M=0;N=Q;O=qa;P=Ba;continue a;break}case 7:{f=c[s>>2]|0;c[f>>2]=Q;c[f+4>>2]=((Q|0)<0)<<31>>31;M=0;N=Q;O=qa;P=Ba;continue a;break}default:{M=0;N=Q;O=qa;P=Ba;continue a}}break}case 112:{Ea=120;Fa=za>>>0>8?za:8;Ga=ka|8;R=63;break}case 88:case 120:{Ea=ba;Fa=za;Ga=ka;R=63;break}case 111:{f=s;la=c[f>>2]|0;ja=c[f+4>>2]|0;if((la|0)==0&(ja|0)==0)Ha=x;else{f=x;Ia=la;la=ja;while(1){ja=f+-1|0;a[ja>>0]=Ia&7|48;Ia=cx(Ia|0,la|0,3)|0;la=D;if((Ia|0)==0&(la|0)==0){Ha=ja;break}else f=ja}}if(!(ka&8)){Ja=Ha;Ka=0;La=67168;Ma=za;Na=ka;R=76}else{f=y-Ha|0;Ja=Ha;Ka=0;La=67168;Ma=(za|0)>(f|0)?za:f+1|0;Na=ka;R=76}break}case 105:case 100:{f=s;la=c[f>>2]|0;Ia=c[f+4>>2]|0;if((Ia|0)<0){f=Tw(0,0,la|0,Ia|0)|0;ja=D;Oa=s;c[Oa>>2]=f;c[Oa+4>>2]=ja;Pa=1;Qa=67168;Ra=f;Sa=ja;R=75;break f}if(!(ka&2048)){ja=ka&1;Pa=ja;Qa=(ja|0)==0?67168:67170;Ra=la;Sa=Ia;R=75}else{Pa=1;Qa=67169;Ra=la;Sa=Ia;R=75}break}case 117:{Ia=s;Pa=0;Qa=67168;Ra=c[Ia>>2]|0;Sa=c[Ia+4>>2]|0;R=75;break}case 99:{a[z>>0]=c[s>>2];Ta=z;Ua=0;Va=67168;Wa=x;Xa=1;Ya=_;break}case 109:{Za=Nu(c[(xu()|0)>>2]|0)|0;R=81;break}case 115:{Ia=c[s>>2]|0;Za=Ia|0?Ia:67178;R=81;break}case 67:{c[u>>2]=c[s>>2];c[t>>2]=0;c[s>>2]=u;_a=-1;$a=u;R=85;break}case 83:{Ia=c[s>>2]|0;if(!za){$u(e,32,oa,0,ka);ab=0;R=96}else{_a=za;$a=Ia;R=85}break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{bb=+h[s>>3];c[p>>2]=0;h[j>>3]=bb;if((c[j+4>>2]|0)>=0){Ia=ka&1;if(!(ka&2048)){cb=bb;db=Ia;eb=(Ia|0)==0?67186:67191}else{cb=bb;db=1;eb=67188}}else{cb=-bb;db=1;eb=67185}h[j>>3]=cb;Ia=c[j+4>>2]&2146435072;do if(Ia>>>0<2146435072|(Ia|0)==2146435072&0<0){bb=+bv(cb,p)*2.0;la=bb!=0.0;if(la)c[p>>2]=(c[p>>2]|0)+-1;ja=ba|32;if((ja|0)==97){f=ba&32;Oa=(f|0)==0?eb:eb+9|0;fb=db|2;gb=12-za|0;do if(!(za>>>0>11|(gb|0)==0)){hb=8.0;ib=gb;do{ib=ib+-1|0;hb=hb*16.0}while((ib|0)!=0);if((a[Oa>>0]|0)==45){jb=-(hb+(-bb-hb));break}else{jb=bb+hb-hb;break}}else jb=bb;while(0);gb=c[p>>2]|0;ib=(gb|0)<0?0-gb|0:gb;kb=Zu(ib,((ib|0)<0)<<31>>31,C)|0;if((kb|0)==(C|0)){a[E>>0]=48;lb=E}else lb=kb;a[lb+-1>>0]=(gb>>31&2)+43;gb=lb+-2|0;a[gb>>0]=ba+15;kb=(za|0)<1;ib=(ka&8|0)==0;mb=q;nb=jb;while(1){ob=~~nb;pb=mb+1|0;a[mb>>0]=d[67152+ob>>0]|f;nb=(nb-+(ob|0))*16.0;do if((pb-A|0)==1){if(ib&(kb&nb==0.0)){qb=pb;break}a[pb>>0]=46;qb=mb+2|0}else qb=pb;while(0);if(!(nb!=0.0))break;else mb=qb}mb=qb;kb=gb;ib=(za|0)!=0&(G+mb|0)<(za|0)?H+za-kb|0:F-kb+mb|0;f=ib+fb|0;$u(e,32,oa,f,ka);if(!(c[e>>2]&32))Xu(Oa,fb,e)|0;$u(e,48,oa,f,ka^65536);pb=mb-A|0;if(!(c[e>>2]&32))Xu(q,pb,e)|0;mb=r-kb|0;$u(e,48,ib-(pb+mb)|0,0,0);if(!(c[e>>2]&32))Xu(gb,mb,e)|0;$u(e,32,oa,f,ka^8192);rb=(f|0)<(oa|0)?oa:f;break}f=(za|0)<0?6:za;if(la){mb=(c[p>>2]|0)+-28|0;c[p>>2]=mb;sb=bb*268435456.0;tb=mb}else{sb=bb;tb=c[p>>2]|0}mb=(tb|0)<0?o:I;pb=mb;nb=sb;do{ib=~~nb>>>0;c[pb>>2]=ib;pb=pb+4|0;nb=(nb-+(ib>>>0))*1.0e9}while(nb!=0.0);if((tb|0)>0){la=mb;gb=pb;fb=tb;while(1){Oa=(fb|0)>29?29:fb;ib=gb+-4|0;do if(ib>>>0>>0)ub=la;else{kb=ib;ob=0;do{vb=ix(c[kb>>2]|0,0,Oa|0)|0;wb=Ww(vb|0,D|0,ob|0,0)|0;vb=D;xb=jx(wb|0,vb|0,1e9,0)|0;c[kb>>2]=xb;ob=ex(wb|0,vb|0,1e9,0)|0;kb=kb+-4|0}while(kb>>>0>=la>>>0);if(!ob){ub=la;break}kb=la+-4|0;c[kb>>2]=ob;ub=kb}while(0);ib=gb;while(1){if(ib>>>0<=ub>>>0)break;kb=ib+-4|0;if(!(c[kb>>2]|0))ib=kb;else break}kb=(c[p>>2]|0)-Oa|0;c[p>>2]=kb;if((kb|0)>0){la=ub;gb=ib;fb=kb}else{yb=ub;zb=ib;Ab=kb;break}}}else{yb=mb;zb=pb;Ab=tb}if((Ab|0)<0){fb=((f+25|0)/9|0)+1|0;gb=(ja|0)==102;la=yb;kb=zb;vb=Ab;while(1){wb=0-vb|0;xb=(wb|0)>9?9:wb;do if(la>>>0>>0){wb=(1<>>xb;Cb=0;Db=la;do{Eb=c[Db>>2]|0;c[Db>>2]=(Eb>>>xb)+Cb;Cb=S(Eb&wb,Bb)|0;Db=Db+4|0}while(Db>>>0>>0);Db=(c[la>>2]|0)==0?la+4|0:la;if(!Cb){Fb=Db;Gb=kb;break}c[kb>>2]=Cb;Fb=Db;Gb=kb+4|0}else{Fb=(c[la>>2]|0)==0?la+4|0:la;Gb=kb}while(0);ib=gb?mb:Fb;Oa=(Gb-ib>>2|0)>(fb|0)?ib+(fb<<2)|0:Gb;vb=(c[p>>2]|0)+xb|0;c[p>>2]=vb;if((vb|0)>=0){Hb=Fb;Ib=Oa;break}else{la=Fb;kb=Oa}}}else{Hb=yb;Ib=zb}kb=mb;do if(Hb>>>0>>0){la=(kb-Hb>>2)*9|0;vb=c[Hb>>2]|0;if(vb>>>0<10){Jb=la;break}else{Kb=la;Lb=10}while(1){Lb=Lb*10|0;la=Kb+1|0;if(vb>>>0>>0){Jb=la;break}else Kb=la}}else Jb=0;while(0);vb=(ja|0)==103;xb=(f|0)!=0;la=f-((ja|0)!=102?Jb:0)+((xb&vb)<<31>>31)|0;if((la|0)<(((Ib-kb>>2)*9|0)+-9|0)){fb=la+9216|0;la=mb+4+(((fb|0)/9|0)+-1024<<2)|0;gb=((fb|0)%9|0)+1|0;if((gb|0)<9){fb=gb;gb=10;while(1){pb=gb*10|0;fb=fb+1|0;if((fb|0)==9){Mb=pb;break}else gb=pb}}else Mb=10;gb=c[la>>2]|0;fb=(gb>>>0)%(Mb>>>0)|0;ja=(la+4|0)==(Ib|0);do if(ja&(fb|0)==0){Nb=la;Ob=Jb;Pb=Hb}else{nb=(((gb>>>0)/(Mb>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;pb=(Mb|0)/2|0;if(fb>>>0>>0)Qb=.5;else Qb=ja&(fb|0)==(pb|0)?1.0:1.5;do if(!db){Rb=Qb;Sb=nb}else{if((a[eb>>0]|0)!=45){Rb=Qb;Sb=nb;break}Rb=-Qb;Sb=-nb}while(0);pb=gb-fb|0;c[la>>2]=pb;if(!(Sb+Rb!=Sb)){Nb=la;Ob=Jb;Pb=Hb;break}Oa=pb+Mb|0;c[la>>2]=Oa;if(Oa>>>0>999999999){Oa=la;pb=Hb;while(1){ib=Oa+-4|0;c[Oa>>2]=0;if(ib>>>0>>0){Db=pb+-4|0;c[Db>>2]=0;Tb=Db}else Tb=pb;Db=(c[ib>>2]|0)+1|0;c[ib>>2]=Db;if(Db>>>0>999999999){Oa=ib;pb=Tb}else{Ub=ib;Vb=Tb;break}}}else{Ub=la;Vb=Hb}pb=(kb-Vb>>2)*9|0;Oa=c[Vb>>2]|0;if(Oa>>>0<10){Nb=Ub;Ob=pb;Pb=Vb;break}else{Wb=pb;Xb=10}while(1){Xb=Xb*10|0;pb=Wb+1|0;if(Oa>>>0>>0){Nb=Ub;Ob=pb;Pb=Vb;break}else Wb=pb}}while(0);la=Nb+4|0;Yb=Ob;Zb=Ib>>>0>la>>>0?la:Ib;_b=Pb}else{Yb=Jb;Zb=Ib;_b=Hb}la=0-Yb|0;fb=Zb;while(1){if(fb>>>0<=_b>>>0){$b=0;break}gb=fb+-4|0;if(!(c[gb>>2]|0))fb=gb;else{$b=1;break}}do if(vb){gb=(xb&1^1)+f|0;if((gb|0)>(Yb|0)&(Yb|0)>-5){ac=ba+-1|0;bc=gb+-1-Yb|0}else{ac=ba+-2|0;bc=gb+-1|0}gb=ka&8;if(gb|0){cc=ac;dc=bc;ec=gb;break}do if($b){gb=c[fb+-4>>2]|0;if(!gb){fc=9;break}if(!((gb>>>0)%10|0)){gc=0;hc=10}else{fc=0;break}while(1){hc=hc*10|0;ja=gc+1|0;if((gb>>>0)%(hc>>>0)|0|0){fc=ja;break}else gc=ja}}else fc=9;while(0);gb=((fb-kb>>2)*9|0)+-9|0;if((ac|32|0)==102){Cb=gb-fc|0;ja=(Cb|0)<0?0:Cb;cc=ac;dc=(bc|0)<(ja|0)?bc:ja;ec=0;break}else{ja=gb+Yb-fc|0;gb=(ja|0)<0?0:ja;cc=ac;dc=(bc|0)<(gb|0)?bc:gb;ec=0;break}}else{cc=ba;dc=f;ec=ka&8}while(0);f=dc|ec;kb=(f|0)!=0&1;xb=(cc|32|0)==102;if(xb){ic=0;jc=(Yb|0)>0?Yb:0}else{vb=(Yb|0)<0?la:Yb;gb=Zu(vb,((vb|0)<0)<<31>>31,C)|0;if((r-gb|0)<2){vb=gb;while(1){ja=vb+-1|0;a[ja>>0]=48;if((r-ja|0)<2)vb=ja;else{kc=ja;break}}}else kc=gb;a[kc+-1>>0]=(Yb>>31&2)+43;vb=kc+-2|0;a[vb>>0]=cc;ic=vb;jc=r-vb|0}vb=db+1+dc+kb+jc|0;$u(e,32,oa,vb,ka);if(!(c[e>>2]&32))Xu(eb,db,e)|0;$u(e,48,oa,vb,ka^65536);do if(xb){la=_b>>>0>mb>>>0?mb:_b;ja=la;do{Cb=Zu(c[ja>>2]|0,0,J)|0;do if((ja|0)==(la|0)){if((Cb|0)!=(J|0)){lc=Cb;break}a[L>>0]=48;lc=L}else{if(Cb>>>0<=q>>>0){lc=Cb;break}Uw(q|0,48,Cb-A|0)|0;Oa=Cb;while(1){pb=Oa+-1|0;if(pb>>>0>q>>>0)Oa=pb;else{lc=pb;break}}}while(0);if(!(c[e>>2]&32))Xu(lc,K-lc|0,e)|0;ja=ja+4|0}while(ja>>>0<=mb>>>0);do if(f|0){if(c[e>>2]&32|0)break;Xu(67220,1,e)|0}while(0);if((dc|0)>0&ja>>>0>>0){la=dc;Cb=ja;while(1){Oa=Zu(c[Cb>>2]|0,0,J)|0;if(Oa>>>0>q>>>0){Uw(q|0,48,Oa-A|0)|0;pb=Oa;while(1){ib=pb+-1|0;if(ib>>>0>q>>>0)pb=ib;else{mc=ib;break}}}else mc=Oa;if(!(c[e>>2]&32))Xu(mc,(la|0)>9?9:la,e)|0;Cb=Cb+4|0;pb=la+-9|0;if(!((la|0)>9&Cb>>>0>>0)){nc=pb;break}else la=pb}}else nc=dc;$u(e,48,nc+9|0,9,0)}else{la=$b?fb:_b+4|0;if((dc|0)>-1){Cb=(ec|0)==0;ja=dc;pb=_b;while(1){ib=Zu(c[pb>>2]|0,0,J)|0;if((ib|0)==(J|0)){a[L>>0]=48;oc=L}else oc=ib;do if((pb|0)==(_b|0)){ib=oc+1|0;if(!(c[e>>2]&32))Xu(oc,1,e)|0;if(Cb&(ja|0)<1){pc=ib;break}if(c[e>>2]&32|0){pc=ib;break}Xu(67220,1,e)|0;pc=ib}else{if(oc>>>0<=q>>>0){pc=oc;break}Uw(q|0,48,oc+B|0)|0;ib=oc;while(1){Db=ib+-1|0;if(Db>>>0>q>>>0)ib=Db;else{pc=Db;break}}}while(0);Oa=K-pc|0;if(!(c[e>>2]&32))Xu(pc,(ja|0)>(Oa|0)?Oa:ja,e)|0;ib=ja-Oa|0;pb=pb+4|0;if(!(pb>>>0>>0&(ib|0)>-1)){qc=ib;break}else ja=ib}}else qc=dc;$u(e,48,qc+18|0,18,0);if(c[e>>2]&32|0)break;Xu(ic,r-ic|0,e)|0}while(0);$u(e,32,oa,vb,ka^8192);rb=(vb|0)<(oa|0)?oa:vb}else{fb=(ba&32|0)!=0;f=cb!=cb|0.0!=0.0;mb=f?0:db;xb=mb+3|0;$u(e,32,oa,xb,_);kb=c[e>>2]|0;if(!(kb&32)){Xu(eb,mb,e)|0;rc=c[e>>2]|0}else rc=kb;if(!(rc&32))Xu(f?(fb?67212:67216):fb?67204:67208,3,e)|0;$u(e,32,oa,xb,ka^8192);rb=(xb|0)<(oa|0)?oa:xb}while(0);M=rb;N=Q;O=qa;P=Ba;continue a;break}default:{Ta=P;Ua=0;Va=67168;Wa=x;Xa=za;Ya=ka}}while(0);g:do if((R|0)==63){R=0;ba=s;aa=c[ba>>2]|0;Z=c[ba+4>>2]|0;ba=Ea&32;if((aa|0)==0&(Z|0)==0){sc=x;tc=0;uc=0}else{Ia=x;xb=aa;aa=Z;do{Ia=Ia+-1|0;a[Ia>>0]=d[67152+(xb&15)>>0]|ba;xb=cx(xb|0,aa|0,4)|0;aa=D}while(!((xb|0)==0&(aa|0)==0));aa=s;sc=Ia;tc=c[aa>>2]|0;uc=c[aa+4>>2]|0}aa=(Ga&8|0)==0|(tc|0)==0&(uc|0)==0;Ja=sc;Ka=aa?0:2;La=aa?67168:67168+(Ea>>4)|0;Ma=Fa;Na=Ga;R=76}else if((R|0)==75){R=0;Ja=Zu(Ra,Sa,x)|0;Ka=Pa;La=Qa;Ma=za;Na=ka;R=76}else if((R|0)==81){R=0;aa=_u(Za,0,za)|0;xb=(aa|0)==0;Ta=Za;Ua=0;Va=67168;Wa=xb?Za+za|0:aa;Xa=xb?za:aa-Za|0;Ya=_}else if((R|0)==85){R=0;aa=$a;xb=0;ba=0;while(1){Z=c[aa>>2]|0;if(!Z){vc=xb;wc=ba;break}fb=av(v,Z)|0;if((fb|0)<0|fb>>>0>(_a-xb|0)>>>0){vc=xb;wc=fb;break}Z=fb+xb|0;if(_a>>>0>Z>>>0){aa=aa+4|0;xb=Z;ba=fb}else{vc=Z;wc=fb;break}}if((wc|0)<0){na=-1;break a}$u(e,32,oa,vc,ka);if(!vc){ab=0;R=96}else{ba=$a;xb=0;while(1){aa=c[ba>>2]|0;if(!aa){ab=vc;R=96;break g}Ia=av(v,aa)|0;xb=Ia+xb|0;if((xb|0)>(vc|0)){ab=vc;R=96;break g}if(!(c[e>>2]&32))Xu(v,Ia,e)|0;if(xb>>>0>=vc>>>0){ab=vc;R=96;break}else ba=ba+4|0}}}while(0);if((R|0)==96){R=0;$u(e,32,oa,ab,ka^8192);M=(oa|0)>(ab|0)?oa:ab;N=Q;O=qa;P=Ba;continue}if((R|0)==76){R=0;_=(Ma|0)>-1?Na&-65537:Na;ba=s;xb=(c[ba>>2]|0)!=0|(c[ba+4>>2]|0)!=0;if((Ma|0)!=0|xb){ba=(xb&1^1)+(y-Ja)|0;Ta=Ja;Ua=Ka;Va=La;Wa=x;Xa=(Ma|0)>(ba|0)?Ma:ba;Ya=_}else{Ta=x;Ua=Ka;Va=La;Wa=x;Xa=0;Ya=_}}_=Wa-Ta|0;ba=(Xa|0)<(_|0)?_:Xa;xb=ba+Ua|0;Ia=(oa|0)<(xb|0)?xb:oa;$u(e,32,Ia,xb,Ya);if(!(c[e>>2]&32))Xu(Va,Ua,e)|0;$u(e,48,Ia,xb,Ya^65536);$u(e,48,ba,_,0);if(!(c[e>>2]&32))Xu(Ta,_,e)|0;$u(e,32,Ia,xb,Ya^8192);M=Ia;N=Q;O=qa;P=Ba}h:do if((R|0)==243)if(!e)if(!O)na=0;else{Ba=1;while(1){P=c[k+(Ba<<2)>>2]|0;if(!P){xc=Ba;break}Yu(i+(Ba<<3)|0,P,g);Ba=Ba+1|0;if((Ba|0)>=10){na=1;break h}}while(1){if(c[k+(xc<<2)>>2]|0){na=-1;break h}xc=xc+1|0;if((xc|0)>=10){na=1;break}}}else na=Q;while(0);l=n;return na|0}function Wu(a){a=a|0;return 0}function Xu(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;f=e+16|0;g=c[f>>2]|0;if(!g)if(!(ev(e)|0)){h=c[f>>2]|0;i=5}else j=0;else{h=g;i=5}a:do if((i|0)==5){g=e+20|0;f=c[g>>2]|0;k=f;if((h-f|0)>>>0>>0){j=ub[c[e+36>>2]&63](e,b,d)|0;break}b:do if((a[e+75>>0]|0)>-1){f=d;while(1){if(!f){l=d;m=b;n=0;o=k;break b}p=f+-1|0;if((a[b+p>>0]|0)==10)break;else f=p}if((ub[c[e+36>>2]&63](e,b,f)|0)>>>0>>0){j=f;break a}l=d-f|0;m=b+f|0;n=f;o=c[g>>2]|0}else{l=d;m=b;n=0;o=k}while(0);_w(o|0,m|0,l|0)|0;c[g>>2]=(c[g>>2]|0)+l;j=n+l|0}while(0);return j|0}function Yu(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,i=0,j=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=f;break a;break}case 10:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a;break}case 11:{e=(c[d>>2]|0)+(4-1)&~(4-1);f=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=f;c[e+4>>2]=0;break a;break}case 12:{e=(c[d>>2]|0)+(8-1)&~(8-1);f=e;g=c[f>>2]|0;i=c[f+4>>2]|0;c[d>>2]=e+8;e=a;c[e>>2]=g;c[e+4>>2]=i;break a;break}case 13:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=(e&65535)<<16>>16;e=a;c[e>>2]=i;c[e+4>>2]=((i|0)<0)<<31>>31;break a;break}case 14:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=a;c[i>>2]=e&65535;c[i+4>>2]=0;break a;break}case 15:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=(e&255)<<24>>24;e=a;c[e>>2]=i;c[e+4>>2]=((i|0)<0)<<31>>31;break a;break}case 16:{i=(c[d>>2]|0)+(4-1)&~(4-1);e=c[i>>2]|0;c[d>>2]=i+4;i=a;c[i>>2]=e&255;c[i+4>>2]=0;break a;break}case 17:{i=(c[d>>2]|0)+(8-1)&~(8-1);j=+h[i>>3];c[d>>2]=i+8;h[a>>3]=j;break a;break}case 18:{i=(c[d>>2]|0)+(8-1)&~(8-1);j=+h[i>>3];c[d>>2]=i+8;h[a>>3]=j;break a;break}default:break a}while(0);while(0);return}function Zu(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(c>>>0>0|(c|0)==0&b>>>0>4294967295){e=d;f=b;g=c;while(1){c=jx(f|0,g|0,10,0)|0;e=e+-1|0;a[e>>0]=c|48;c=f;f=ex(f|0,g|0,10,0)|0;if(!(g>>>0>9|(g|0)==9&c>>>0>4294967295))break;else g=D}h=f;i=e}else{h=b;i=d}if(!h)j=i;else{d=h;h=i;while(1){i=h+-1|0;a[i>>0]=(d>>>0)%10|0|48;if(d>>>0<10){j=i;break}else{d=(d>>>0)/10|0;h=i}}}return j|0}function _u(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;f=d&255;g=(e|0)!=0;a:do if(g&(b&3|0)!=0){h=d&255;i=b;j=e;while(1){if((a[i>>0]|0)==h<<24>>24){k=i;l=j;m=6;break a}n=i+1|0;o=j+-1|0;p=(o|0)!=0;if(p&(n&3|0)!=0){i=n;j=o}else{q=n;r=o;s=p;m=5;break}}}else{q=b;r=e;s=g;m=5}while(0);if((m|0)==5)if(s){k=q;l=r;m=6}else{t=q;u=0}b:do if((m|0)==6){q=d&255;if((a[k>>0]|0)==q<<24>>24){t=k;u=l}else{r=S(f,16843009)|0;c:do if(l>>>0>3){s=k;g=l;while(1){e=c[s>>2]^r;if((e&-2139062144^-2139062144)&e+-16843009|0)break;e=s+4|0;b=g+-4|0;if(b>>>0>3){s=e;g=b}else{v=e;w=b;m=11;break c}}x=s;y=g}else{v=k;w=l;m=11}while(0);if((m|0)==11)if(!w){t=v;u=0;break}else{x=v;y=w}while(1){if((a[x>>0]|0)==q<<24>>24){t=x;u=y;break b}r=x+1|0;y=y+-1|0;if(!y){t=r;u=0;break}else x=r}}}while(0);return (u|0?t:0)|0}function $u(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;g=l;l=l+256|0;if((l|0)>=(m|0))$(256);h=g;do if((d|0)>(e|0)&(f&73728|0)==0){i=d-e|0;Uw(h|0,b|0,(i>>>0>256?256:i)|0)|0;j=c[a>>2]|0;k=(j&32|0)==0;if(i>>>0>255){n=d-e|0;o=i;p=j;j=k;while(1){if(j){Xu(h,256,a)|0;q=c[a>>2]|0}else q=p;o=o+-256|0;j=(q&32|0)==0;if(o>>>0<=255)break;else p=q}if(j)r=n&255;else break}else if(k)r=i;else break;Xu(h,r,a)|0}while(0);l=g;return}function av(a,b){a=a|0;b=b|0;var c=0;if(!a)c=0;else c=dv(a,b,0)|0;return c|0}function bv(a,b){a=+a;b=b|0;return +(+cv(a,b))}function cv(a,b){a=+a;b=b|0;var d=0,e=0,f=0,g=0.0,i=0.0,k=0,l=0.0;h[j>>3]=a;d=c[j>>2]|0;e=c[j+4>>2]|0;f=cx(d|0,e|0,52)|0;switch(f&2047){case 0:{if(a!=0.0){g=+cv(a*18446744073709551616.0,b);i=g;k=(c[b>>2]|0)+-64|0}else{i=a;k=0}c[b>>2]=k;l=i;break}case 2047:{l=a;break}default:{c[b>>2]=(f&2047)+-1022;c[j>>2]=d;c[j+4>>2]=e&-2146435073|1071644672;l=+h[j>>3]}}return +l}function dv(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;do if(b){if(d>>>0<128){a[b>>0]=d;f=1;break}if(d>>>0<2048){a[b>>0]=d>>>6|192;a[b+1>>0]=d&63|128;f=2;break}if(d>>>0<55296|(d&-8192|0)==57344){a[b>>0]=d>>>12|224;a[b+1>>0]=d>>>6&63|128;a[b+2>>0]=d&63|128;f=3;break}if((d+-65536|0)>>>0<1048576){a[b>>0]=d>>>18|240;a[b+1>>0]=d>>>12&63|128;a[b+2>>0]=d>>>6&63|128;a[b+3>>0]=d&63|128;f=4;break}else{c[(xu()|0)>>2]=84;f=-1;break}}else f=1;while(0);return f|0}function ev(b){b=b|0;var d=0,e=0,f=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;e=c[b>>2]|0;if(!(e&8)){c[b+8>>2]=0;c[b+4>>2]=0;d=c[b+44>>2]|0;c[b+28>>2]=d;c[b+20>>2]=d;c[b+16>>2]=d+(c[b+48>>2]|0);f=0}else{c[b>>2]=e|32;f=-1}return f|0}function fv(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;e=a+20|0;f=c[e>>2]|0;g=(c[a+16>>2]|0)-f|0;a=g>>>0>d>>>0?d:g;_w(f|0,b|0,a|0)|0;c[e>>2]=(c[e>>2]|0)+a;return d|0}function gv(a){a=a|0;var b=0;b=(Mu(a)|0)==0;return (b?a:a&95)|0}function hv(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=b;a:do if(!(d&3)){e=b;f=4}else{g=b;h=d;while(1){if(!(a[g>>0]|0)){i=h;break a}j=g+1|0;h=j;if(!(h&3)){e=j;f=4;break}else g=j}}while(0);if((f|0)==4){f=e;while(1){k=c[f>>2]|0;if(!((k&-2139062144^-2139062144)&k+-16843009))f=f+4|0;else break}if(!((k&255)<<24>>24))l=f;else{k=f;while(1){f=k+1|0;if(!(a[f>>0]|0)){l=f;break}else k=f}}i=l}return i-d|0}function iv(a){a=a|0;return ((a|0)==223|(Iu(a)|0)!=(a|0))&1|0}function jv(a){a=a|0;var b=0;if(a>>>0>=255)if((a+-57344|0)>>>0<8185|(a>>>0<8232|(a+-8234|0)>>>0<47062))b=1;else return ((a+-65532|0)>>>0>1048579|(a&65534|0)==65534)&1^1|0;else b=(a+1&127)>>>0>32&1;return b|0}function kv(a,b){a=a|0;b=b|0;var c=0;do switch(b|0){case 1:{c=lv(a)|0;break}case 2:{c=Lu(a)|0;break}case 3:{c=Du(a)|0;break}case 4:{c=mv(a)|0;break}case 5:{c=nv(a)|0;break}case 6:{c=ov(a)|0;break}case 7:{c=iv(a)|0;break}case 8:{c=jv(a)|0;break}case 9:{c=pv(a)|0;break}case 10:{c=Ou(a)|0;break}case 11:{c=qv(a)|0;break}case 12:{c=rv(a)|0;break}default:c=0}while(0);return c|0}function lv(a){a=a|0;var b=0;if(!(nv(a)|0))b=(Lu(a)|0)!=0;else b=1;return b&1|0}function mv(a){a=a|0;var b=0;if((a&-2|0)==8232|(a>>>0<32|(a+-127|0)>>>0<33))b=1;else b=(a+-65529|0)>>>0<3;return b&1|0}function nv(a){a=a|0;return (a+-48|0)>>>0<10|0}function ov(a){a=a|0;var b=0;if(!(Ou(a)|0))b=(jv(a)|0)!=0;else b=0;return b&1|0}function pv(a){a=a|0;var b=0;if(a>>>0<131072)b=(d[67222+((d[67222+(a>>>8)>>0]|0)<<5|a>>>3&31)>>0]|0)>>>(a&7)&1;else b=0;return b|0}function qv(a){a=a|0;return (Ju(a)|0)!=(a|0)|0}function rv(a){a=a|0;return ((a+-48|0)>>>0<10|((a|32)+-97|0)>>>0<6)&1|0}function sv(b,c){b=b|0;c=c|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=a[b>>0]|0;a:do if(!(e<<24>>24)){f=c;g=0}else{h=b;i=c;j=e&255;k=e;while(1){l=a[i>>0]|0;if(!(l<<24>>24)){f=i;g=k;break a}if(k<<24>>24!=l<<24>>24?(m=Gu(j)|0,(m|0)!=(Gu(l&255)|0)):0){f=i;g=k;break a}h=h+1|0;l=i+1|0;m=a[h>>0]|0;if(!(m<<24>>24)){f=l;g=0;break}else{i=l;j=m&255;k=m}}}while(0);e=Gu(g&255)|0;return e-(Gu(d[f>>0]|0)|0)|0}function tv(a,b){a=a|0;b=b|0;uv(a,b)|0;return a|0}function uv(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=d;a:do if(!((e^b)&3)){if(!(e&3)){f=d;g=b}else{h=d;i=b;while(1){j=a[h>>0]|0;a[i>>0]=j;if(!(j<<24>>24)){k=i;break a}j=h+1|0;l=i+1|0;if(!(j&3)){f=j;g=l;break}else{h=j;i=l}}}i=c[f>>2]|0;if(!((i&-2139062144^-2139062144)&i+-16843009)){h=g;l=f;j=i;while(1){i=l+4|0;m=h+4|0;c[h>>2]=j;j=c[i>>2]|0;if((j&-2139062144^-2139062144)&j+-16843009|0){n=i;o=m;break}else{h=m;l=i}}}else{n=f;o=g}p=n;q=o;r=8}else{p=d;q=b;r=8}while(0);if((r|0)==8){r=a[p>>0]|0;a[q>>0]=r;if(!(r<<24>>24))k=q;else{r=q;q=p;while(1){q=q+1|0;p=r+1|0;b=a[q>>0]|0;a[p>>0]=b;if(!(b<<24>>24)){k=p;break}else r=p}}}return k|0}function vv(a){a=a|0;return ((a|0)==32|(a+-9|0)>>>0<5)&1|0}function wv(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;d=xv(a,b,c,-1,0)|0;return d|0}function xv(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=l;l=l+112|0;if((l|0)>=(m|0))$(112);h=g;c[h>>2]=0;i=h+4|0;c[i>>2]=a;c[h+44>>2]=a;j=h+8|0;c[j>>2]=(a|0)<0?-1:a+2147483647|0;c[h+76>>2]=-1;yv(h,0);k=zv(h,d,1,e,f)|0;if(b|0)c[b>>2]=a+((c[i>>2]|0)+(c[h+108>>2]|0)-(c[j>>2]|0));l=g;return k|0}function yv(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;c[a+104>>2]=b;d=c[a+8>>2]|0;e=c[a+4>>2]|0;f=d-e|0;c[a+108>>2]=f;if((b|0)!=0&(f|0)>(b|0))c[a+100>>2]=e+b;else c[a+100>>2]=d;return}function zv(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0;a:do if(e>>>0>36){c[(xu()|0)>>2]=22;i=0;j=0}else{k=b+4|0;l=b+100|0;do{m=c[k>>2]|0;if(m>>>0<(c[l>>2]|0)>>>0){c[k>>2]=m+1;n=d[m>>0]|0}else n=Av(b)|0}while((vv(n)|0)!=0);b:do switch(n|0){case 43:case 45:{m=((n|0)==45)<<31>>31;o=c[k>>2]|0;if(o>>>0<(c[l>>2]|0)>>>0){c[k>>2]=o+1;p=m;q=d[o>>0]|0;break b}else{p=m;q=Av(b)|0;break b}break}default:{p=0;q=n}}while(0);m=(e|0)==0;do if((e|16|0)==16&(q|0)==48){o=c[k>>2]|0;if(o>>>0<(c[l>>2]|0)>>>0){c[k>>2]=o+1;r=d[o>>0]|0}else r=Av(b)|0;if((r|32|0)!=120)if(m){s=r;t=8;u=46;break}else{v=r;w=e;u=32;break}o=c[k>>2]|0;if(o>>>0<(c[l>>2]|0)>>>0){c[k>>2]=o+1;x=d[o>>0]|0}else x=Av(b)|0;if((d[70391+x>>0]|0)>15){o=(c[l>>2]|0)==0;if(!o)c[k>>2]=(c[k>>2]|0)+-1;if(!f){yv(b,0);i=0;j=0;break a}if(o){i=0;j=0;break a}c[k>>2]=(c[k>>2]|0)+-1;i=0;j=0;break a}else{s=x;t=16;u=46}}else{o=m?10:e;if((d[70391+q>>0]|0)>>>0>>0){v=q;w=o;u=32}else{if(c[l>>2]|0)c[k>>2]=(c[k>>2]|0)+-1;yv(b,0);c[(xu()|0)>>2]=22;i=0;j=0;break a}}while(0);if((u|0)==32)if((w|0)==10){m=v+-48|0;if(m>>>0<10){o=0;y=m;do{o=(o*10|0)+y|0;m=c[k>>2]|0;if(m>>>0<(c[l>>2]|0)>>>0){c[k>>2]=m+1;z=d[m>>0]|0}else z=Av(b)|0;y=z+-48|0}while(y>>>0<10&o>>>0<429496729);A=z;B=o;C=0}else{A=v;B=0;C=0}y=A+-48|0;if(y>>>0<10){m=A;E=B;F=C;G=y;while(1){y=gx(E|0,F|0,10,0)|0;H=D;I=((G|0)<0)<<31>>31;J=~I;if(H>>>0>J>>>0|(H|0)==(J|0)&y>>>0>~G>>>0){K=m;L=G;M=E;N=F;break}J=Ww(y|0,H|0,G|0,I|0)|0;I=D;H=c[k>>2]|0;if(H>>>0<(c[l>>2]|0)>>>0){c[k>>2]=H+1;O=d[H>>0]|0}else O=Av(b)|0;H=O+-48|0;if(H>>>0<10&(I>>>0<429496729|(I|0)==429496729&J>>>0<2576980378)){m=O;E=J;F=I;G=H}else{K=O;L=H;M=J;N=I;break}}if(L>>>0>9){P=p;Q=N;R=M}else{T=10;U=K;V=M;W=N;u=72}}else{P=p;Q=C;R=B}}else{s=v;t=w;u=46}c:do if((u|0)==46){if(!(t+-1&t)){G=a[70647+((t*23|0)>>>5&7)>>0]|0;F=a[70391+s>>0]|0;E=F&255;if(E>>>0>>0){m=0;o=E;do{m=o|m<>2]|0;if(E>>>0<(c[l>>2]|0)>>>0){c[k>>2]=E+1;X=d[E>>0]|0}else X=Av(b)|0;Y=a[70391+X>>0]|0;o=Y&255}while(m>>>0<134217728&o>>>0>>0);Z=X;_=Y;$=0;aa=m}else{Z=s;_=F;$=0;aa=0}o=cx(-1,-1,G|0)|0;E=D;if((_&255)>>>0>=t>>>0|($>>>0>E>>>0|($|0)==(E|0)&aa>>>0>o>>>0)){T=t;U=Z;V=aa;W=$;u=72;break}else{ba=aa;ca=$;da=_}while(1){I=ix(ba|0,ca|0,G|0)|0;J=D;H=da&255|I;I=c[k>>2]|0;if(I>>>0<(c[l>>2]|0)>>>0){c[k>>2]=I+1;ea=d[I>>0]|0}else ea=Av(b)|0;da=a[70391+ea>>0]|0;if((da&255)>>>0>=t>>>0|(J>>>0>E>>>0|(J|0)==(E|0)&H>>>0>o>>>0)){T=t;U=ea;V=H;W=J;u=72;break c}else{ba=H;ca=J}}}o=a[70391+s>>0]|0;E=o&255;if(E>>>0>>0){G=0;F=E;do{G=F+(S(G,t)|0)|0;E=c[k>>2]|0;if(E>>>0<(c[l>>2]|0)>>>0){c[k>>2]=E+1;fa=d[E>>0]|0}else fa=Av(b)|0;ga=a[70391+fa>>0]|0;F=ga&255}while(G>>>0<119304647&F>>>0>>0);ha=fa;ia=ga;ja=G;ka=0}else{ha=s;ia=o;ja=0;ka=0}if((ia&255)>>>0>>0){F=ex(-1,-1,t|0,0)|0;E=D;m=ha;J=ka;H=ja;I=ia;while(1){if(J>>>0>E>>>0|(J|0)==(E|0)&H>>>0>F>>>0){T=t;U=m;V=H;W=J;u=72;break c}y=gx(H|0,J|0,t|0,0)|0;la=D;ma=I&255;if(la>>>0>4294967295|(la|0)==-1&y>>>0>~ma>>>0){T=t;U=m;V=H;W=J;u=72;break c}na=Ww(ma|0,0,y|0,la|0)|0;la=D;y=c[k>>2]|0;if(y>>>0<(c[l>>2]|0)>>>0){c[k>>2]=y+1;oa=d[y>>0]|0}else oa=Av(b)|0;I=a[70391+oa>>0]|0;if((I&255)>>>0>=t>>>0){T=t;U=oa;V=na;W=la;u=72;break}else{m=oa;J=la;H=na}}}else{T=t;U=ha;V=ja;W=ka;u=72}}while(0);if((u|0)==72)if((d[70391+U>>0]|0)>>>0>>0){do{H=c[k>>2]|0;if(H>>>0<(c[l>>2]|0)>>>0){c[k>>2]=H+1;pa=d[H>>0]|0}else pa=Av(b)|0}while((d[70391+pa>>0]|0)>>>0>>0);c[(xu()|0)>>2]=34;P=(g&1|0)==0&0==0?p:0;Q=h;R=g}else{P=p;Q=W;R=V}if(c[l>>2]|0)c[k>>2]=(c[k>>2]|0)+-1;if(!(Q>>>0>>0|(Q|0)==(h|0)&R>>>0>>0)){if(!((g&1|0)!=0|0!=0|(P|0)!=0)){c[(xu()|0)>>2]=34;H=Ww(g|0,h|0,-1,-1)|0;i=D;j=H;break}if(Q>>>0>h>>>0|(Q|0)==(h|0)&R>>>0>g>>>0){c[(xu()|0)>>2]=34;i=h;j=g;break}}H=((P|0)<0)<<31>>31;J=Tw(R^P|0,Q^H|0,P|0,H|0)|0;i=D;j=J}while(0);D=i;return j|0}function Av(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=b+104|0;f=c[e>>2]|0;if((f|0)!=0?(c[b+108>>2]|0)>=(f|0):0)g=4;else{f=Bv(b)|0;if((f|0)>=0){h=c[e>>2]|0;e=c[b+8>>2]|0;if(h){i=c[b+4>>2]|0;j=h-(c[b+108>>2]|0)|0;h=e;if((e-i|0)<(j|0)){k=h;g=9}else{c[b+100>>2]=i+(j+-1);l=h}}else{k=e;g=9}if((g|0)==9){c[b+100>>2]=e;l=k}k=b+4|0;if(!l)m=c[k>>2]|0;else{e=c[k>>2]|0;k=b+108|0;c[k>>2]=l+1-e+(c[k>>2]|0);m=e}e=m+-1|0;if((d[e>>0]|0|0)==(f|0))n=f;else{a[e>>0]=f;n=f}}else g=4}if((g|0)==4){c[b+100>>2]=0;n=-1}return n|0}function Bv(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b;if((c[a+8>>2]|0)==0?(Cv(a)|0)!=0:0)f=-1;else if((ub[c[a+32>>2]&63](a,e,1)|0)==1)f=d[e>>0]|0;else f=-1;l=b;return f|0}function Cv(b){b=b|0;var d=0,e=0,f=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;e=b+20|0;d=b+44|0;if((c[e>>2]|0)>>>0>(c[d>>2]|0)>>>0)ub[c[b+36>>2]&63](b,0,0)|0;c[b+16>>2]=0;c[b+28>>2]=0;c[e>>2]=0;e=c[b>>2]|0;if(e&20)if(!(e&4))f=-1;else{c[b>>2]=e|32;f=-1}else{e=c[d>>2]|0;c[b+8>>2]=e;c[b+4>>2]=e;f=0}return f|0}function Dv(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=d;d=Ev(a,b,f)|0;l=e;return d|0}function Ev(a,b,c){a=a|0;b=b|0;c=c|0;return Tu(a,2147483647,b,c)|0}function Fv(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=d;d=Uu(a,b,f)|0;l=e;return d|0}function Gv(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;if((c[f+76>>2]|0)>-1)g=Wu(f)|0;else g=0;h=e+-1|0;if((e|0)<2){e=f+74|0;i=a[e>>0]|0;a[e>>0]=i+255|i;if(g|0)Au(f);if(!h){a[b>>0]=0;j=b}else j=0}else{a:do if(h){i=f+4|0;e=f+8|0;k=h;l=b;while(1){m=c[i>>2]|0;n=m;o=(c[e>>2]|0)-n|0;p=_u(m,10,o)|0;q=(p|0)==0;r=q?o:1-n+p|0;p=r>>>0>>0?r:k;_w(l|0,m|0,p|0)|0;m=(c[i>>2]|0)+p|0;c[i>>2]=m;s=l+p|0;r=k-p|0;if(!(q&(r|0)!=0)){t=s;u=17;break a}if(m>>>0>=(c[e>>2]|0)>>>0){q=Bv(f)|0;if((q|0)<0)break;else v=q}else{c[i>>2]=m+1;v=d[m>>0]|0}k=r+-1|0;r=s+1|0;a[s>>0]=v;if(!((k|0)!=0&(v&255|0)!=10)){t=r;u=17;break a}else l=r}if((s|0)!=(b|0)?(c[f>>2]&16|0)!=0:0){t=s;u=17}else w=0}else{t=b;u=17}while(0);if((u|0)==17)if(!b)w=0;else{a[t>>0]=0;w=b}if(!g)j=w;else{Au(f);j=w}}return j|0}function Hv(b,c,e){b=b|0;c=c|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;if(!e)f=0;else{g=a[b>>0]|0;a:do if(!(g<<24>>24)){h=c;i=0}else{j=b;k=e;l=c;m=g;while(1){k=k+-1|0;n=a[l>>0]|0;if(!(m<<24>>24==n<<24>>24&((k|0)!=0&n<<24>>24!=0))){h=l;i=m;break a}j=j+1|0;n=l+1|0;m=a[j>>0]|0;if(!(m<<24>>24)){h=n;i=0;break}else l=n}}while(0);f=(i&255)-(d[h>>0]|0)|0}return f|0}function Iv(a){a=a|0;return ax(a|0)|0}function Jv(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:do if(!d)e=0;else{f=b;g=d;h=c;while(1){i=a[f>>0]|0;j=a[h>>0]|0;if(i<<24>>24!=j<<24>>24)break;g=g+-1|0;if(!g){e=0;break a}else{f=f+1|0;h=h+1|0}}e=(i&255)-(j&255)|0}while(0);return e|0}function Kv(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=hb(6,d|0)|0;d=wu((a|0)==-4?-115:a)|0;l=b;return d|0}function Lv(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;e=l;l=l+192|0;if((l|0)>=(m|0))$(192);f=e+152|0;g=e+136|0;h=e+120|0;i=e+104|0;j=e+96|0;k=e+80|0;n=e+64|0;o=e+48|0;p=e+32|0;q=e+16|0;r=e;s=e+176|0;t=e+168|0;c[s>>2]=d;d=(c[s>>2]|0)+(4-1)&~(4-1);u=c[d>>2]|0;c[s>>2]=d+4;d=(b|0)==4?u|32768:u;a:do switch(b|0){case 14:{c[r>>2]=a;c[r+4>>2]=14;c[r+8>>2]=d;v=wu(xa(221,r|0)|0)|0;break}case 9:{c[q>>2]=a;c[q+4>>2]=16;c[q+8>>2]=t;u=xa(221,q|0)|0;switch(u|0){case -22:{c[p>>2]=a;c[p+4>>2]=9;c[p+8>>2]=d;w=xa(221,p|0)|0;break}case 0:{s=c[t+4>>2]|0;w=(c[t>>2]|0)==2?0-s|0:s;break}default:w=wu(u)|0}v=w;break}case 1030:{c[o>>2]=a;c[o+4>>2]=1030;c[o+8>>2]=d;u=xa(221,o|0)|0;if((u|0)!=-22){if((u|0)>-1){c[n>>2]=u;c[n+4>>2]=2;c[n+8>>2]=1;xa(221,n|0)|0}v=wu(u)|0;break a}c[k>>2]=a;c[k+4>>2]=1030;c[k+8>>2]=0;u=xa(221,k|0)|0;if((u|0)==-22){c[i>>2]=a;c[i+4>>2]=0;c[i+8>>2]=d;s=xa(221,i|0)|0;if((s|0)>-1){c[h>>2]=s;c[h+4>>2]=2;c[h+8>>2]=1;xa(221,h|0)|0}v=wu(s)|0;break a}else{if((u|0)>-1){c[j>>2]=u;hb(6,j|0)|0}v=wu(-22)|0;break a}break}default:if((b+-12|0)>>>0<5){c[g>>2]=a;c[g+4>>2]=b;c[g+8>>2]=d;v=wu(xa(221,g|0)|0)|0;break a}else{c[f>>2]=a;c[f+4>>2]=b;c[f+8>>2]=d;v=wu(xa(221,f|0)|0)|0;break a}}while(0);l=e;return v|0}function Mv(a){a=a|0;return ax(a|0)|0}function Nv(a,b,c){a=a|0;b=b|0;c=c|0;Ov(a,b,c)|0;return a|0}function Ov(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;f=d;do if(!((f^b)&3)){g=(e|0)!=0;a:do if(g&(f&3|0)!=0){h=e;i=d;j=b;while(1){k=a[i>>0]|0;a[j>>0]=k;if(!(k<<24>>24)){l=h;m=i;n=j;break a}k=h+-1|0;o=i+1|0;p=j+1|0;q=(k|0)!=0;if(q&(o&3|0)!=0){h=k;i=o;j=p}else{r=k;s=o;t=p;u=q;v=5;break}}}else{r=e;s=d;t=b;u=g;v=5}while(0);if((v|0)==5)if(u){l=r;m=s;n=t}else{w=t;x=0;break}if(!(a[m>>0]|0)){w=n;x=l}else{b:do if(l>>>0>3){g=n;j=m;i=l;while(1){h=c[j>>2]|0;if((h&-2139062144^-2139062144)&h+-16843009|0){y=j;z=g;A=i;break b}c[g>>2]=h;h=i+-4|0;q=j+4|0;p=g+4|0;if(h>>>0>3){g=p;j=q;i=h}else{y=q;z=p;A=h;break}}}else{y=m;z=n;A=l}while(0);B=y;C=z;D=A;v=11}}else{B=d;C=b;D=e;v=11}while(0);c:do if((v|0)==11)if(!D){w=C;x=0}else{e=B;b=C;d=D;while(1){A=a[e>>0]|0;a[b>>0]=A;if(!(A<<24>>24)){w=b;x=d;break c}d=d+-1|0;A=b+1|0;if(!d){w=A;x=0;break}else{e=e+1|0;b=A}}}while(0);Uw(w|0,0,x|0)|0;return w|0}function Pv(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e;if(_u(70656,a[d>>0]|0,4)|0){h=Tv(d)|0|32768;c[g>>2]=b;c[g+4>>2]=h;c[g+8>>2]=438;h=wu(ib(5,g|0)|0)|0;if((h|0)>=0){g=Uv(h,d)|0;if(!g){c[f>>2]=h;hb(6,f|0)|0;i=0}else i=g}else i=0}else{c[(xu()|0)>>2]=22;i=0}l=e;return i|0}function Qv(a){a=a|0;var b=0,d=0,e=0,f=0;b=(c[a>>2]&1|0)!=0;if(!b){gb(71276);d=c[a+52>>2]|0;e=a+56|0;if(d|0)c[d+56>>2]=c[e>>2];f=c[e>>2]|0;if(f|0)c[f+52>>2]=d;if((c[17818]|0)==(a|0))c[17818]=f;cb(71276)}f=Rv(a)|0;d=yb[c[a+12>>2]&15](a)|0|f;f=c[a+92>>2]|0;if(f|0)Lw(f);if(!b)Lw(a);return d|0}function Rv(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;do if(a){if((c[a+76>>2]|0)<=-1){b=Sv(a)|0;break}d=(Wu(a)|0)==0;e=Sv(a)|0;if(d)b=e;else{Au(a);b=e}}else{if(!(c[3976]|0))f=0;else f=Rv(c[3976]|0)|0;gb(71276);e=c[17818]|0;if(!e)g=f;else{d=e;e=f;while(1){if((c[d+76>>2]|0)>-1)h=Wu(d)|0;else h=0;if((c[d+20>>2]|0)>>>0>(c[d+28>>2]|0)>>>0)i=Sv(d)|0|e;else i=e;if(h|0)Au(d);d=c[d+56>>2]|0;if(!d){g=i;break}else e=i}}cb(71276);b=g}while(0);return b|0}function Sv(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;b=a+20|0;d=a+28|0;if((c[b>>2]|0)>>>0>(c[d>>2]|0)>>>0?(ub[c[a+36>>2]&63](a,0,0)|0,(c[b>>2]|0)==0):0)e=-1;else{f=a+4|0;g=c[f>>2]|0;h=a+8|0;i=c[h>>2]|0;if(g>>>0>>0)ub[c[a+40>>2]&63](a,g-i|0,1)|0;c[a+16>>2]=0;c[d>>2]=0;c[b>>2]=0;c[h>>2]=0;c[f>>2]=0;e=0}return e|0}function Tv(b){b=b|0;var c=0,d=0,e=0,f=0;c=(Vv(b,43)|0)==0;d=a[b>>0]|0;e=c?d<<24>>24!=114&1:2;c=(Vv(b,120)|0)==0;f=c?e:e|128;e=(Vv(b,101)|0)==0;b=e?f:f|524288;f=d<<24>>24==114?b:b|64;b=d<<24>>24==119?f|512:f;return (d<<24>>24==97?b|1024:b)|0}function Uv(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;e=l;l=l+112|0;if((l|0)>=(m|0))$(112);f=e+40|0;g=e+24|0;h=e+16|0;i=e;j=e+52|0;k=a[d>>0]|0;if(_u(70656,k<<24>>24,4)|0){n=Kw(1144)|0;if(!n)o=0;else{p=n;q=p+112|0;do{c[p>>2]=0;p=p+4|0}while((p|0)<(q|0));if(!(Vv(d,43)|0))c[n>>2]=k<<24>>24==114?8:4;if(!(Vv(d,101)|0))r=k;else{c[i>>2]=b;c[i+4>>2]=2;c[i+8>>2]=1;xa(221,i|0)|0;r=a[d>>0]|0}if(r<<24>>24==97){c[h>>2]=b;c[h+4>>2]=3;r=xa(221,h|0)|0;if(!(r&1024)){c[g>>2]=b;c[g+4>>2]=4;c[g+8>>2]=r|1024;xa(221,g|0)|0}g=c[n>>2]|128;c[n>>2]=g;s=g}else s=c[n>>2]|0;c[n+60>>2]=b;c[n+44>>2]=n+120;c[n+48>>2]=1024;g=n+75|0;a[g>>0]=-1;if((s&8|0)==0?(c[f>>2]=b,c[f+4>>2]=21505,c[f+8>>2]=j,(bb(54,f|0)|0)==0):0)a[g>>0]=10;c[n+32>>2]=35;c[n+36>>2]=25;c[n+40>>2]=24;c[n+12>>2]=10;if(!(c[17813]|0))c[n+76>>2]=-1;gb(71276);g=c[17818]|0;c[n+56>>2]=g;if(g|0)c[g+52>>2]=n;c[17818]=n;cb(71276);o=n}}else{c[(xu()|0)>>2]=22;o=0}l=e;return o|0}function Vv(b,c){b=b|0;c=c|0;var d=0;d=Wv(b,c)|0;return ((a[d>>0]|0)==(c&255)<<24>>24?d:0)|0}function Wv(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=d&255;a:do if(!e)f=b+(hv(b)|0)|0;else{if(!(b&3))g=b;else{h=d&255;i=b;while(1){j=a[i>>0]|0;if(j<<24>>24==0?1:j<<24>>24==h<<24>>24){f=i;break a}j=i+1|0;if(!(j&3)){g=j;break}else i=j}}i=S(e,16843009)|0;h=c[g>>2]|0;b:do if(!((h&-2139062144^-2139062144)&h+-16843009)){j=g;k=h;while(1){l=k^i;if((l&-2139062144^-2139062144)&l+-16843009|0){m=j;break b}l=j+4|0;k=c[l>>2]|0;if((k&-2139062144^-2139062144)&k+-16843009|0){m=l;break}else j=l}}else m=g;while(0);i=d&255;h=m;while(1){j=a[h>>0]|0;if(j<<24>>24==0?1:j<<24>>24==i<<24>>24){f=h;break}else h=h+1|0}}while(0);return f|0}function Xv(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=g;a:do if(!e)i=0;else{do if(f|0){j=(b|0)==0?h:b;k=a[e>>0]|0;n=k&255;if(k<<24>>24>-1){c[j>>2]=n;i=k<<24>>24!=0&1;break a}k=n+-194|0;if(k>>>0<=50){n=e+1|0;o=c[16024+(k<<2)>>2]|0;if(f>>>0<4?o&-2147483648>>>((f*6|0)+-6|0)|0:0)break;k=d[n>>0]|0;n=k>>>3;if((n+-16|n+(o>>26))>>>0<=7){n=k+-128|o<<6;if((n|0)>=0){c[j>>2]=n;i=2;break a}o=(d[e+2>>0]|0)+-128|0;if(o>>>0<=63){k=o|n<<6;if((k|0)>=0){c[j>>2]=k;i=3;break a}n=(d[e+3>>0]|0)+-128|0;if(n>>>0<=63){c[j>>2]=n|k<<6;i=4;break a}}}}}while(0);c[(xu()|0)>>2]=84;i=-1}while(0);l=g;return i|0}function Yv(a,b){a=a|0;b=b|0;return (Zv(a,hv(a)|0,1,b)|0)+-1|0}function Zv(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=S(d,b)|0;if((c[e+76>>2]|0)>-1){g=(Wu(e)|0)==0;h=Xu(a,f,e)|0;if(g)i=h;else{Au(e);i=h}}else i=Xu(a,f,e)|0;if((i|0)==(f|0))j=d;else j=(i>>>0)/(b>>>0)|0;return j|0}function _v(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=Da(20,a|0)|0;l=a;return b|0}function $v(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=a;c[e+4>>2]=b;b=wu(ab(33,e|0)|0)|0;l=d;return b|0}function aw(a){a=a|0;var b=0,d=0,e=0;if((c[a+76>>2]|0)>-1){b=(Wu(a)|0)==0;d=(c[a>>2]|0)>>>4&1;if(b)e=d;else e=d}else e=(c[a>>2]|0)>>>4&1;return e|0}function bw(b,c){b=b|0;c=c|0;var d=0,e=0,f=0;d=b;e=70660;f=d+15|0;do{a[d>>0]=a[e>>0]|0;d=d+1|0;e=e+1|0}while((d|0)<(f|0));if(!c){a[b+14>>0]=48;a[b+15>>0]=0}else{e=c;d=14;while(1){d=d+1|0;if(e>>>0<10)break;else e=(e>>>0)/10|0}a[b+d>>0]=0;e=c;c=d;while(1){c=c+-1|0;a[b+c>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}}return}function cw(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+40|0;f=d+8|0;g=d;c[g>>2]=a;c[g+4>>2]=b;h=Na(197,g|0)|0;if((h|0)==-9?(c[f>>2]=a,c[f+4>>2]=1,(xa(221,f|0)|0)>=0):0){bw(f,a);c[e>>2]=f;c[e+4>>2]=b;i=wu(Oa(195,e|0)|0)|0}else i=wu(h)|0;l=d;return i|0}function dw(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g;c[h>>2]=a;c[h+4>>2]=b;c[h+8>>2]=d;c[h+12>>2]=e;c[h+16>>2]=f;f=wu(qb(142,h|0)|0)|0;l=g;return f|0}function ew(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=a;c[f+4>>2]=b;c[f+8>>2]=d;d=wu(jb(4,f|0)|0)|0;l=e;return d|0}function fw(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=a;c[f+4>>2]=b;c[f+8>>2]=d;d=wu(eb(3,f|0)|0)|0;l=e;return d|0}function gw(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;g=e+16|0;c[g>>2]=d;d=(c[g>>2]|0)+(4-1)&~(4-1);h=c[d>>2]|0;c[g>>2]=d+4;c[f>>2]=a;c[f+4>>2]=b|32768;c[f+8>>2]=h;h=wu(ib(5,f|0)|0)|0;l=e;return h|0}function hw(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;c[g>>2]=b;c[g+4>>2]=d;c[g+8>>2]=e;c[g+12>>2]=a;e=g+16|0;c[e>>2]=0;d=g+20|0;c[d>>2]=0;switch(a|0){case 208:case 203:case 213:{c[e>>2]=1;break}default:{}}jw(8,g);g=c[d>>2]|0;if(!g)h=0;else{c[(xu()|0)>>2]=g;h=-1}l=f;return h|0}function iw(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;b=l;l=l+32|0;if((l|0)>=(m|0))$(32);d=b+16|0;e=b;f=a+20|0;do if(!(c[f>>2]|0)){if((c[a+16>>2]|0?(g=c[a>>2]|0,(g|0)>-1):0)?(g|0)!=(kw()|0):0){c[d>>2]=c[178];c[d+4>>2]=c[179];c[d+8>>2]=c[180];c[d+12>>2]=c[181];lw(6,e)|0;g=mw(6,d)|0;c[f>>2]=0-g;if(!((g|0)!=0?(c[17816]|0)!=0:0)){c[f>>2]=1;mw(6,e)|0}break}c[f>>2]=1}while(0);l=b;return}function jw(a,b){a=a|0;b=b|0;wb[a&15](b);return}function kw(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=Qa(199,a|0)|0;l=a;return b|0}function lw(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;g=d+24|0;c[f>>2]=0;c[f+4>>2]=a;c[f+8>>2]=0;c[f+12>>2]=b;h=wu(fb(340,f|0)|0)|0;if(!h){f=b;if((c[f>>2]|0)==-1?(c[f+4>>2]|0)==-1:0){f=b;c[f>>2]=-1;c[f+4>>2]=-1}f=b+8|0;i=f;if((c[i>>2]|0)==-1?(c[i+4>>2]|0)==-1:0){i=f;c[i>>2]=-1;c[i+4>>2]=-1;j=0}else j=0}else if((c[(xu()|0)>>2]|0)==38){c[e>>2]=a;c[e+4>>2]=g;if((wu(Ma(191,e|0)|0)|0)>=0){e=c[g>>2]|0;a=(e|0)==-1;i=b;c[i>>2]=a?-1:e;c[i+4>>2]=a?-1:0;i=c[g+4>>2]|0;g=(i|0)==-1;e=b+8|0;f=e;c[f>>2]=g?-1:i;c[f+4>>2]=g?-1:0;if(a){a=b;c[a>>2]=-1;c[a+4>>2]=-1}if(g){g=e;c[g>>2]=-1;c[g+4>>2]=-1;j=0}else j=0}else j=-1}else j=h;l=d;return j|0}function mw(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d;g=d+24|0;c[f>>2]=0;c[f+4>>2]=a;c[f+8>>2]=b;c[f+12>>2]=0;h=fb(340,f|0)|0;if((h|0)==-38){f=b;i=c[f>>2]|0;j=c[f+4>>2]|0;f=j>>>0<0|(j|0)==0&i>>>0<4294967295;j=f?i:-1;c[g>>2]=j;j=b+8|0;b=c[j>>2]|0;i=c[j+4>>2]|0;j=i>>>0<0|(i|0)==0&b>>>0<4294967295;i=j?b:-1;c[g+4>>2]=i;c[e>>2]=a;c[e+4>>2]=g;k=Xa(75,e|0)|0}else k=h;l=d;return k|0}function nw(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=mb(201,a|0)|0;l=a;return b|0}function ow(a){a=a|0;return hw(213,a,0,0)|0}function pw(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=a;c[e+4>>2]=0;c[e+8>>2]=b;c[e+12>>2]=((b|0)<0)<<31>>31;b=wu(Pa(194,e|0)|0)|0;l=d;return b|0}function qw(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=za(64,a|0)|0;l=a;return b|0}function rw(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h;do if((g&4095|0)==0&(((g|0)<0)<<31>>31&-4096|0)==0){if(b>>>0>2147483646){c[(xu()|0)>>2]=12;j=-1;break}k=(e&16|0)!=0;if(k)tw(-1);c[i>>2]=a;c[i+4>>2]=b;c[i+8>>2]=d;c[i+12>>2]=e;c[i+16>>2]=f;c[i+20>>2]=g>>12;n=wu(La(192,i|0)|0)|0;if(k){sw();j=n}else j=n}else{c[(xu()|0)>>2]=22;j=-1}while(0);l=h;return j|0}function sw(){return}function tw(a){a=a|0;return}function uw(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;tw(-1);c[e>>2]=a;c[e+4>>2]=b;b=wu(Wa(91,e|0)|0)|0;sw();l=d;return b|0}function vw(a){a=a|0;var b=0;b=70712;c[b>>2]=a+-1;c[b+4>>2]=0;return}function ww(){var a=0,b=0,d=0;a=70712;b=gx(c[a>>2]|0,c[a+4>>2]|0,1284865837,1481765933)|0;a=Ww(b|0,D|0,1,0)|0;b=D;d=70712;c[d>>2]=a;c[d+4>>2]=b;d=cx(a|0,b|0,33)|0;return d|0}function xw(a){a=a|0;gb(71296);yw(a);cb(71296);return}function yw(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=c[4107]|0;if(!b)c[c[4108]>>2]=a;else{c[4109]=(b|0)==31|(b|0)==7?3:1;c[17826]=0;if((b|0)>0){d=c[4108]|0;e=0;f=a;a=0;do{g=gx(f|0,a|0,1284865837,1481765933)|0;f=Ww(g|0,D|0,1,0)|0;a=D;c[d+(e<<2)>>2]=a;e=e+1|0}while((e|0)<(b|0));h=d}else h=c[4108]|0;c[h>>2]=c[h>>2]|1}return}function zw(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0;gb(71296);a=c[4107]|0;if(!a){b=c[4108]|0;d=(S(c[b>>2]|0,1103515245)|0)+12345&2147483647;c[b>>2]=d;e=d}else{d=c[17826]|0;b=c[4108]|0;f=c[4109]|0;g=b+(f<<2)|0;h=(c[g>>2]|0)+(c[b+(d<<2)>>2]|0)|0;c[g>>2]=h;g=f+1|0;c[4109]=(g|0)==(a|0)?0:g;g=d+1|0;c[17826]=(g|0)==(a|0)?0:g;e=h>>>1}cb(71296);return e|0}function Aw(b){b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;c=b;while(1){d=a[c>>0]|0;e=d<<24>>24;f=c+1|0;if(!(vv(e)|0))break;else c=f}switch(e|0){case 45:{g=1;h=5;break}case 43:{g=0;h=5;break}default:{i=0;j=c;k=d}}if((h|0)==5){i=g;j=f;k=a[f>>0]|0}f=(k<<24>>24)+-48|0;if(f>>>0<10){k=0;g=j;j=f;while(1){g=g+1|0;f=(k*10|0)-j|0;j=(a[g>>0]|0)+-48|0;if(j>>>0>=10){l=f;break}else k=f}}else l=0;return (i|0?l:0-l|0)|0}function Bw(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=a;c[e+4>>2]=b;b=wu(_a(77,e|0)|0)|0;l=d;return b|0}function Cw(a){a=a|0;return (a+-48|0)>>>0<10|0}function Dw(a,b){a=a|0;b=b|0;var d=0;if(!a)d=Mw(1,24)|0;else{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;d=b}return d|0}function Ew(a){a=a|0;var b=0,d=0;b=c[a>>2]|0;if(b|0){d=b;do{Lw(c[d>>2]|0);b=d;d=c[d+4>>2]|0;Lw(b)}while((d|0)!=0)}Lw(a);return}function Fw(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=a+16|0;a:do if(!(c[g>>2]|0)){h=a+12|0;i=c[h>>2]|0;do if(i>>>0>>0){if(b|0)if(!d){c[g>>2]=1;j=0;break a}else{k=a+8|0;c[k>>2]=d;c[h>>2]=1024;l=k;m=d;n=d;o=1024;break}k=f<<3;p=k>>>0>1024?k:1024;k=Kw(8)|0;if(!k){c[g>>2]=1;j=0;break a}q=Kw(p)|0;c[k>>2]=q;r=q;if(!q){Lw(k);c[g>>2]=1;j=0;break a}c[k+4>>2]=0;s=a+4|0;t=c[s>>2]|0;if(t|0)c[t+4>>2]=k;if(!(c[a>>2]|0))c[a>>2]=k;c[s>>2]=k;k=a+8|0;c[k>>2]=r;c[h>>2]=p;l=k;m=r;n=q;o=p}else{p=a+8|0;q=c[p>>2]|0;l=p;m=q;n=q;o=i}while(0);i=m+f&3;q=((i|0)==0?0:4-i|0)+f|0;c[l>>2]=n+q;c[h>>2]=o-q;if(!e)j=n;else{Uw(n|0,0,q|0)|0;j=n}}else j=0;while(0);return j|0}function Gw(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,pb=0,qb=0,rb=0,sb=0,tb=0,ub=0,vb=0,wb=0,xb=0,yb=0,zb=0,Ab=0,Bb=0,Cb=0,Db=0,Eb=0,Fb=0,Gb=0,Hb=0,Ib=0,Jb=0,Kb=0,Lb=0,Mb=0,Nb=0,Ob=0,Pb=0,Qb=0,Rb=0,Sb=0,Tb=0,Ub=0,Vb=0,Wb=0,Xb=0,Yb=0,Zb=0,_b=0,$b=0,ac=0,bc=0,cc=0,dc=0,ec=0,fc=0,gc=0,hc=0,ic=0,jc=0,kc=0,lc=0,mc=0,nc=0,oc=0,pc=0,qc=0,rc=0,sc=0,tc=0,uc=0,vc=0,wc=0,xc=0,yc=0,zc=0,Ac=0,Bc=0,Cc=0,Dc=0,Ec=0,Fc=0,Gc=0,Hc=0,Ic=0,Jc=0,Kc=0,Lc=0,Mc=0,Nc=0,Oc=0,Pc=0,Qc=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=g;i=c[a+4>>2]|0;a=i+56|0;j=(c[a>>2]&8|0)==0?d:0;d=i+40|0;k=c[d>>2]|0;if((k|0)>0&(j|0)!=0){n=Kw(k<<2)|0;if(!n)o=12;else{p=n;q=3}}else{p=0;q=3}if((q|0)==3){if(!(c[i+60>>2]|0)){c[h>>2]=0;n=f&1;k=f&2;r=c[a>>2]&4;if(!p)s=0;else s=c[d>>2]|0;t=s<<2;u=c[i+52>>2]|0;v=u<<3;w=v+8|0;x=t+12+v+(w+(S(t,u)|0)<<1)|0;y=Kw(x)|0;if(!y){z=12;A=0}else{Uw(y|0,0,x|0)|0;x=y+t|0;B=x&3;C=x+((B|0)==0?0:4-B|0)|0;B=C+w|0;x=B&3;D=B+((x|0)==0?0:4-x|0)|0;x=D+w|0;w=x&3;B=x+((w|0)==0?0:4-w|0)|0;w=B+v|0;v=w&3;if((u|0)>0){x=w+((v|0)==0?0:4-v|0)|0;v=0;while(1){c[D+(v<<3)+4>>2]=x;w=x+t|0;c[C+(v<<3)+4>>2]=w;v=v+1|0;if((v|0)==(u|0)){E=0;break}else x=w+t|0}do{c[B+(E<<3)>>2]=-1;E=E+1|0}while((E|0)!=(u|0))}u=Xv(h,b,4)|0;if((u|0)<1)if((u|0)<0){F=1;G=0}else{H=1;q=201}else{H=u;q=201}a:do if((q|0)==201){u=i+8|0;E=(r|0)!=0;x=(s|0)>0;v=i+12|0;w=i+44|0;I=i+32|0;J=i+36|0;K=(s|0)==0;L=(n|0)==0;M=(s|0)<1;N=0;O=b+H|0;P=0;Q=0;R=-1;T=C;U=H;V=y;W=C;X=D;while(1){if((R|0)<0){Y=c[u>>2]|0;Z=Y+8|0;b:do if(!(c[Z>>2]|0)){_=Q;aa=R;ba=T}else{ca=(P|0)!=0;da=(N|0)==95;ea=(P|0)==0;fa=E&(N|0)==10;ga=L&(P|0)<1;ha=Y;ia=Q;ja=R;ka=T;la=Z;while(1){ma=ha;na=la;c:while(1){oa=ma+12|0;if((c[B+(c[oa>>2]<<3)>>2]|0)>=(P|0)){pa=ka;qa=ia;ra=ja;break}sa=ma+20|0;ta=c[sa>>2]|0;if(!ta){q=236;break}d:do if(fa|(ga|(ta&1|0)==0)){if(ta&2|0?(ua=c[h>>2]|0,!((ua|k|0)==0|E&(ua|0)==10)):0)break;do if(ta&16|0){if(da)break d;if(lv(N)|0)break d;ua=c[h>>2]|0;if((ua|0)==95)break;if(!(lv(ua)|0))break d}while(0);ua=c[sa>>2]|0;if(!(ua&32))va=ua;else{if(da){ua=c[h>>2]|0;if((ua|0)==95)break;else wa=ua}else{ua=(lv(N)|0)==0;xa=c[h>>2]|0;if(ua|(xa|0)==95)break;else wa=xa}if(lv(wa)|0)break;va=c[sa>>2]|0}xa=c[h>>2]|0;do if((xa|0)!=0&(ca&(va&64|0)!=0)){if(da){ya=xa;za=1}else{ua=(lv(N)|0)!=0;ya=c[h>>2]|0;za=ua}if((ya|0)==95)if(za)break d;else break;else if(za^(lv(ya)|0)!=0)break;else break d}while(0);if(!(c[sa>>2]&128)){q=236;break c}xa=c[h>>2]|0;if(ea|(xa|0)==0)break;if(da){Aa=xa;Ba=1}else{xa=(lv(N)|0)!=0;Aa=c[h>>2]|0;Ba=xa}if((Aa|0)==95)if(Ba){q=236;break c}else break;else if(Ba^(lv(Aa)|0)!=0)break;else{q=236;break c}}while(0);sa=ma+40|0;if(!(c[sa>>2]|0)){_=ia;aa=ja;ba=ka;break b}else{ma=ma+32|0;na=sa}}if((q|0)==236){q=0;c[ka>>2]=c[na>>2];if(x)Uw(c[ka+4>>2]|0,-1,t|0)|0;sa=c[ma+16>>2]|0;do if(sa|0){ta=c[sa>>2]|0;if((ta|0)<=-1)break;xa=ka+4|0;ua=sa;Ca=ta;do{if((Ca|0)<(s|0))c[(c[xa>>2]|0)+(Ca<<2)>>2]=P;ua=ua+4|0;Ca=c[ua>>2]|0}while((Ca|0)>-1)}while(0);sa=(c[ka>>2]|0)!=(c[v>>2]|0);if(M|sa){Da=sa?ia:1;Ea=sa?ja:P;Fa=ka+4|0}else{sa=ka+4|0;na=c[sa>>2]|0;Ca=0;do{c[p+(Ca<<2)>>2]=c[na+(Ca<<2)>>2];Ca=Ca+1|0}while((Ca|0)!=(s|0));Da=1;Ea=P;Fa=sa}sa=c[oa>>2]|0;c[B+(sa<<3)>>2]=P;c[B+(sa<<3)+4>>2]=Fa;pa=ka+8|0;qa=Da;ra=Ea}la=ma+40|0;if(!(c[la>>2]|0)){_=qa;aa=ra;ba=pa;break}else{ha=ma+32|0;ia=qa;ja=ra;ka=pa}}}while(0);c[ba>>2]=0;Z=c[h>>2]|0;if(!Z){Ga=aa;break}else{Ha=_;Ia=aa;Ja=Z}}else{if(K){Ga=R;break}Z=c[h>>2]|0;if((T|0)!=(W|0)&(Z|0)!=0){Ha=Q;Ia=R;Ja=Z}else{Ga=R;break}}Z=P+U|0;Y=Xv(h,O,4)|0;if((Y|0)<1)if((Y|0)<0){F=1;G=0;break a}else Ka=1;else Ka=Y;Y=O+Ka|0;if((Ha|0)!=0&(c[w>>2]|0)!=0){if(!(c[W>>2]|0))La=X;else{ka=c[J>>2]|0;ja=c[ka>>2]|0;ia=(ja|0)>-1;ha=W;la=X;while(1){da=ha+4|0;e:do if(ia){ea=0;ca=ja;do{ga=c[ka+((ea|1)<<2)>>2]|0;if((ca|0)>=(s|0)){Ma=la;break e}Na=c[da>>2]|0;if((c[Na+(ga<<2)>>2]|0)==(c[p+(ga<<2)>>2]|0)?(c[Na+(ca<<2)>>2]|0)<(c[p+(ca<<2)>>2]|0):0){Ma=la;break e}ea=ea+2|0;ca=c[ka+(ea<<2)>>2]|0}while((ca|0)>-1);Oa=da;Pa=Na;q=265}else{Oa=da;Pa=c[da>>2]|0;q=265}while(0);if((q|0)==265){q=0;c[la>>2]=c[ha>>2];da=la+4|0;ca=c[da>>2]|0;c[da>>2]=Pa;c[Oa>>2]=ca;Ma=la+8|0}ha=ha+8|0;if(!(c[ha>>2]|0)){La=Ma;break}else la=Ma}}c[La>>2]=0;Qa=W;Ra=X;Sa=0}else{Qa=X;Ra=W;Sa=Ha}la=c[Ra>>2]|0;if(!la){Ta=V;Ua=Ia;Va=Qa;Wa=Sa}else{ha=(Z|0)!=0;ka=(Ja|0)==95;ja=(Z|0)==0;ia=E&(Ja|0)==10;ca=L&(Z|0)<1;da=Ra;ea=V;ma=Ia;ga=Qa;fa=Sa;sa=la;while(1){la=sa+8|0;if(!(c[la>>2]|0)){Xa=ea;Ya=ma;Za=ga;_a=fa}else{Ca=da+4|0;na=sa;ua=ma;xa=ga;ta=fa;$a=ea;ab=la;while(1){f:do if((c[na>>2]|0)>>>0>Ja>>>0){bb=ta;cb=$a;db=xa;eb=ua}else{if((c[na+4>>2]|0)>>>0>>0){bb=ta;cb=$a;db=xa;eb=ua;break}la=na+20|0;fb=c[la>>2]|0;do if(fb|0){if(!(ia|(ca|(fb&1|0)==0))){bb=ta;cb=$a;db=xa;eb=ua;break f}if(fb&2|0?(gb=c[h>>2]|0,!((gb|k|0)==0|E&(gb|0)==10)):0){bb=ta;cb=$a;db=xa;eb=ua;break f}do if(fb&16|0){if(ka){bb=ta;cb=$a;db=xa;eb=ua;break f}if(lv(Ja)|0){bb=ta;cb=$a;db=xa;eb=ua;break f}gb=c[h>>2]|0;if((gb|0)==95)break;if(!(lv(gb)|0)){bb=ta;cb=$a;db=xa;eb=ua;break f}}while(0);gb=c[la>>2]|0;if(!(gb&32))hb=gb;else{if(ka){gb=c[h>>2]|0;if((gb|0)==95){bb=ta;cb=$a;db=xa;eb=ua;break f}else ib=gb}else{gb=(lv(Ja)|0)==0;jb=c[h>>2]|0;if(gb|(jb|0)==95){bb=ta;cb=$a;db=xa;eb=ua;break f}else ib=jb}if(lv(ib)|0){bb=ta;cb=$a;db=xa;eb=ua;break f}hb=c[la>>2]|0}jb=c[h>>2]|0;do if((jb|0)!=0&(ha&(hb&64|0)!=0)){if(ka){kb=jb;lb=1}else{gb=(lv(Ja)|0)!=0;kb=c[h>>2]|0;lb=gb}if((kb|0)==95)if(lb){bb=ta;cb=$a;db=xa;eb=ua;break f}else break;else if(lb^(lv(kb)|0)!=0)break;else{bb=ta;cb=$a;db=xa;eb=ua;break f}}while(0);do if(c[la>>2]&128|0){jb=c[h>>2]|0;if(ja|(jb|0)==0){bb=ta;cb=$a;db=xa;eb=ua;break f}if(ka){mb=jb;nb=1}else{jb=(lv(Ja)|0)!=0;mb=c[h>>2]|0;nb=jb}if((mb|0)==95)if(nb)break;else{bb=ta;cb=$a;db=xa;eb=ua;break f}else if(nb^(lv(mb)|0)!=0){bb=ta;cb=$a;db=xa;eb=ua;break f}else break}while(0);jb=c[la>>2]|0;do if(!(jb&4))ob=jb;else{if(c[a>>2]&2|0){ob=jb;break}if(!(kv(Ja,c[na+24>>2]|0)|0)){bb=ta;cb=$a;db=xa;eb=ua;break f}ob=c[la>>2]|0}while(0);do if(ob&4|0){if(!(c[a>>2]&2))break;jb=Ju(Ja)|0;gb=na+24|0;if(kv(jb,c[gb>>2]|0)|0)break;jb=Iu(Ja)|0;if(!(kv(jb,c[gb>>2]|0)|0)){bb=ta;cb=$a;db=xa;eb=ua;break f}}while(0);if(!(c[la>>2]&8))break;if(Jw(c[na+28>>2]|0,Ja,c[a>>2]&2)|0){bb=ta;cb=$a;db=xa;eb=ua;break f}}while(0);if(x){la=c[Ca>>2]|0;fb=0;do{c[$a+(fb<<2)>>2]=c[la+(fb<<2)>>2];fb=fb+1|0}while((fb|0)!=(s|0))}fb=c[na+16>>2]|0;do if(fb|0){la=c[fb>>2]|0;if((la|0)>-1){pb=fb;qb=la}else break;do{if((qb|0)<(s|0))c[$a+(qb<<2)>>2]=Z;pb=pb+4|0;qb=c[pb>>2]|0}while((qb|0)>-1)}while(0);fb=c[na+12>>2]|0;la=B+(fb<<3)|0;if((c[la>>2]|0)>=(Z|0)){gb=c[B+(fb<<3)+4>>2]|0;jb=c[gb>>2]|0;if(!(Hw(s,c[I>>2]|0,$a,jb)|0)){bb=ta;cb=$a;db=xa;eb=ua;break}c[gb>>2]=$a;if((c[ab>>2]|0)!=(c[v>>2]|0)){bb=ta;cb=jb;db=xa;eb=ua;break}if(x)rb=0;else{bb=1;cb=jb;db=xa;eb=Z;break}while(1){c[p+(rb<<2)>>2]=c[$a+(rb<<2)>>2];rb=rb+1|0;if((rb|0)==(s|0)){bb=1;cb=jb;db=xa;eb=Z;break f}}}jb=c[ab>>2]|0;c[xa>>2]=jb;gb=xa+4|0;sb=c[gb>>2]|0;c[gb>>2]=$a;c[la>>2]=Z;c[B+(fb<<3)+4>>2]=gb;do if((jb|0)==(c[v>>2]|0)){if((ua|0)==-1)if(x)tb=0;else{ub=Z;vb=1;break}else{if(!x){ub=ua;vb=ta;break}if((c[$a>>2]|0)>(c[p>>2]|0)){ub=ua;vb=ta;break}else tb=0}do{c[p+(tb<<2)>>2]=c[$a+(tb<<2)>>2];tb=tb+1|0}while((tb|0)<(s|0));ub=Z;vb=1}else{ub=ua;vb=ta}while(0);bb=vb;cb=sb;db=xa+8|0;eb=ub}while(0);ab=na+40|0;if(!(c[ab>>2]|0)){Xa=cb;Ya=eb;Za=db;_a=bb;break}else{na=na+32|0;ua=eb;xa=db;ta=bb;$a=cb}}}da=da+8|0;sa=c[da>>2]|0;if(!sa){Ta=Xa;Ua=Ya;Va=Za;Wa=_a;break}else{ea=Xa;ma=Ya;ga=Za;fa=_a}}}c[Va>>2]=0;N=Ja;O=Y;P=Z;Q=Wa;R=Ua;T=Va;U=Ka;V=Ta;W=Qa;X=Ra}F=Ga>>>31;G=Ga}while(0);Lw(y);z=F;A=G}wb=z;xb=A}else{c[h>>2]=0;A=f&1;z=f&2;f=c[a>>2]&4;G=Dw(0,0)|0;g:do if(G){F=Fw(G,0,0,0,32)|0;if(!F){Ew(G);yb=0;zb=12;break}c[F+24>>2]=0;c[F+28>>2]=0;y=c[d>>2]|0;if(y){Ga=Kw(y<<2)|0;if(!Ga){Ab=0;Bb=0;Cb=0;Db=Ga;Eb=12}else{Fb=Ga;q=9}}else{Fb=0;q=9}h:do if((q|0)==9){Ga=c[i+28>>2]|0;if(Ga){Ra=Kw(Ga<<3)|0;if(!Ra){Ab=0;Bb=Ra;Cb=0;Db=Fb;Eb=12;break}else Gb=Ra}else Gb=0;Ra=i+52|0;Ga=c[Ra>>2]|0;if(Ga){Qa=Kw(Ga<<2)|0;if(!Qa){Ab=0;Bb=Gb;Cb=Qa;Db=Fb;Eb=12;break}else Hb=Qa}else Hb=0;Qa=i+8|0;Ga=i+12|0;Ta=(p|0)==0;Ka=(p|0)!=0;Va=i+32|0;Ua=(f|0)!=0;Wa=(Fb|0)==0;Ja=(Gb|0)==0;_a=(Hb|0)==0;Za=(A|0)==0;Ya=b;Xa=1;cb=-1;bb=-1;db=F;eb=y;i:while(1){if((eb|0)>0){ub=0;vb=eb;while(1){c[Fb+(ub<<2)>>2]=-1;if(Ta)Ib=vb;else{c[p+(ub<<2)>>2]=-1;Ib=c[d>>2]|0}ub=ub+1|0;if((ub|0)>=(Ib|0))break;else vb=Ib}}vb=c[Ra>>2]|0;if((vb|0)>0)Uw(Hb|0,0,vb<<2|0)|0;vb=c[h>>2]|0;ub=Xa+cb|0;s=Xv(h,Ya,4)|0;if((s|0)<1)if((s|0)<0){Ab=0;Bb=Gb;Cb=Hb;Db=Fb;Eb=1;break h}else Jb=1;else Jb=s;s=Ya+Jb|0;tb=c[h>>2]|0;B=c[Qa>>2]|0;rb=B+8|0;if(c[rb>>2]|0){qb=(ub|0)!=0;pb=(vb|0)==95;ob=(ub|0)==0;mb=Ua&(vb|0)==10;nb=Za&(ub|0)<1;kb=B;B=0;lb=0;hb=db;ib=rb;while(1){rb=kb+20|0;k=c[rb>>2]|0;j:do if(k){if(!(mb|(nb|(k&1|0)==0))){Kb=B;Lb=lb;Mb=hb;break}if(k&2|0?(Sa=c[h>>2]|0,!((Sa|z|0)==0|Ua&(Sa|0)==10)):0){Kb=B;Lb=lb;Mb=hb;break}do if(k&16|0){if(pb){Kb=B;Lb=lb;Mb=hb;break j}if(lv(vb)|0){Kb=B;Lb=lb;Mb=hb;break j}Sa=c[h>>2]|0;if((Sa|0)==95)break;if(!(lv(Sa)|0)){Kb=B;Lb=lb;Mb=hb;break j}}while(0);sb=c[rb>>2]|0;if(!(sb&32))Nb=sb;else{if(pb){sb=c[h>>2]|0;if((sb|0)==95){Kb=B;Lb=lb;Mb=hb;break}else Ob=sb}else{sb=(lv(vb)|0)==0;Sa=c[h>>2]|0;if(sb|(Sa|0)==95){Kb=B;Lb=lb;Mb=hb;break}else Ob=Sa}if(lv(Ob)|0){Kb=B;Lb=lb;Mb=hb;break}Nb=c[rb>>2]|0}Sa=c[h>>2]|0;do if((Sa|0)!=0&(qb&(Nb&64|0)!=0)){if(pb){Pb=Sa;Qb=1}else{sb=(lv(vb)|0)!=0;Pb=c[h>>2]|0;Qb=sb}if((Pb|0)==95)if(Qb){Kb=B;Lb=lb;Mb=hb;break j}else break;else if(Qb^(lv(Pb)|0)!=0)break;else{Kb=B;Lb=lb;Mb=hb;break j}}while(0);if(!(c[rb>>2]&128)){q=52;break}Sa=c[h>>2]|0;if(ob|(Sa|0)==0){Kb=B;Lb=lb;Mb=hb;break}if(pb){Rb=Sa;Sb=1}else{Sa=(lv(vb)|0)!=0;Rb=c[h>>2]|0;Sb=Sa}if((Rb|0)==95)if(Sb){q=52;break}else{Kb=B;Lb=lb;Mb=hb;break}else if(Sb^(lv(Rb)|0)!=0){Kb=B;Lb=lb;Mb=hb;break}else{q=52;break}}else q=52;while(0);do if((q|0)==52){q=0;if(!lb){Kb=c[kb+16>>2]|0;Lb=c[ib>>2]|0;Mb=hb;break}rb=hb+28|0;k=c[rb>>2]|0;if(!k){Sa=Fw(G,0,0,0,32)|0;if(!Sa){q=56;break i}c[Sa+24>>2]=hb;c[Sa+28>>2]=0;sb=Fw(G,0,0,0,c[d>>2]<<2)|0;c[Sa+20>>2]=sb;if(!sb){q=63;break i}c[rb>>2]=Sa;Tb=Sa}else Tb=k;c[Tb>>2]=ub;c[Tb+4>>2]=s;c[Tb+8>>2]=c[ib>>2];c[Tb+12>>2]=c[kb+12>>2];c[Tb+16>>2]=c[h>>2];if((c[d>>2]|0)>0){k=c[Tb+20>>2]|0;Sa=0;do{c[k+(Sa<<2)>>2]=c[Fb+(Sa<<2)>>2];Sa=Sa+1|0}while((Sa|0)<(c[d>>2]|0))}Sa=c[kb+16>>2]|0;if(!Sa){Kb=B;Lb=lb;Mb=Tb;break}k=c[Sa>>2]|0;if((k|0)<=-1){Kb=B;Lb=lb;Mb=Tb;break}rb=c[Tb+20>>2]|0;sb=Sa;Sa=k;do{sb=sb+4|0;c[rb+(Sa<<2)>>2]=ub;Sa=c[sb>>2]|0}while((Sa|0)>-1);Kb=B;Lb=lb;Mb=Tb}while(0);ib=kb+40|0;if(!(c[ib>>2]|0))break;else{kb=kb+32|0;B=Kb;lb=Lb;hb=Mb}}if(Kb){hb=c[Kb>>2]|0;if((hb|0)>-1){lb=Kb;B=hb;while(1){c[Fb+(B<<2)>>2]=ub;hb=lb+4|0;B=c[hb>>2]|0;if((B|0)<=-1){Ub=hb;break}else lb=hb}}else Ub=Kb}else Ub=0;if(!Lb){Vb=Mb;Wb=bb;Xb=vb;Yb=ub;Zb=0;_b=s;$b=Jb;ac=Ub;q=174}else{bc=vb;cc=ub;dc=s;ec=bb;fc=Jb;gc=Lb;hc=Ub;ic=Mb;q=82}}else{Vb=db;Wb=bb;Xb=vb;Yb=ub;Zb=0;_b=s;$b=Jb;ac=0;q=174}k:while(1){l:do if((q|0)==82){q=0;if((gc|0)==(c[Ga>>2]|0)){if((ec|0)>=(cc|0)){if(!(Ka&(ec|0)==(cc|0))){Vb=ic;Wb=ec;Xb=bc;Yb=cc;Zb=gc;_b=dc;$b=fc;ac=hc;q=174;continue k}if(!(Hw(c[d>>2]|0,c[Va>>2]|0,Fb,p)|0)){Vb=ic;Wb=ec;Xb=bc;Yb=ec;Zb=gc;_b=dc;$b=fc;ac=hc;q=174;continue k}}if(Ta){Vb=ic;Wb=cc;Xb=bc;Yb=cc;Zb=gc;_b=dc;$b=fc;ac=hc;q=174;continue k}if((c[d>>2]|0)>0)jc=0;else{Vb=ic;Wb=cc;Xb=bc;Yb=cc;Zb=gc;_b=dc;$b=fc;ac=hc;q=174;continue k}while(1){c[p+(jc<<2)>>2]=c[Fb+(jc<<2)>>2];lb=jc+1|0;if((lb|0)<(c[d>>2]|0))jc=lb;else{Vb=ic;Wb=cc;Xb=bc;Yb=cc;Zb=gc;_b=dc;$b=fc;ac=hc;q=174;continue k}}}lb=gc+8|0;do if(!(c[lb>>2]|0))q=98;else{if(!(c[gc+20>>2]&256)){q=98;break}B=c[gc+24>>2]|0;Iw(B+1|0,Gb,c[a>>2]&-9,i,Fb,cc);hb=c[Gb+(B<<3)>>2]|0;kb=(c[Gb+(B<<3)+4>>2]|0)-hb|0;do if(!(Hv(b+hb|0,dc+-1|0,kb)|0)){B=(kb|0)==0;ib=B&1;pb=Hb+(c[gc+12>>2]<<2)|0;if(B?c[pb>>2]|0:0){kc=bc;lc=cc;mc=dc;nc=25;oc=fc;break}c[pb>>2]=ib;ib=kb+-1|0;pb=dc+ib|0;B=c[h>>2]|0;ob=cc+fc+ib|0;ib=Xv(h,pb,4)|0;if((ib|0)<1)if((ib|0)<0){kc=B;lc=ob;mc=pb;nc=2;oc=ib;break}else pc=1;else pc=ib;kc=B;lc=ob;mc=pb+pc|0;nc=0;oc=pc}else{kc=bc;lc=cc;mc=dc;nc=25;oc=fc}while(0);switch(nc&31){case 25:{Vb=ic;Wb=ec;Xb=kc;Yb=lc;Zb=gc;_b=mc;$b=oc;ac=hc;q=174;continue k;break}case 0:{qc=kc;rc=lc;sc=mc;tc=oc;break}default:{uc=hc;vc=ic;wc=ec;xc=kc;yc=lc;zc=nc;Ac=gc;Bc=mc;Cc=oc;break l}}}while(0);if((q|0)==98){q=0;kb=c[h>>2]|0;if(!kb){Vb=ic;Wb=ec;Xb=bc;Yb=cc;Zb=gc;_b=dc;$b=fc;ac=hc;q=174;continue k}hb=cc+fc|0;pb=Xv(h,dc,4)|0;if((pb|0)<1)if((pb|0)<0){uc=hc;vc=ic;wc=ec;xc=kb;yc=hb;zc=2;Ac=gc;Bc=dc;Cc=pb;break}else Dc=1;else Dc=pb;qc=kb;rc=hb;sc=dc+Dc|0;tc=Dc}if(!(c[lb>>2]|0)){Vb=ic;Wb=ec;Xb=qc;Yb=rc;Zb=gc;_b=sc;$b=tc;ac=hc;q=174;continue k}hb=(rc|0)!=0;kb=(qc|0)==95;pb=(rc|0)==0;ob=Ua&(qc|0)==10;B=Za&(rc|0)<1;ib=0;qb=gc;nb=hc;mb=ic;Sa=lb;m:while(1){n:do if((c[qb>>2]|0)>>>0>qc>>>0){Ec=mb;Fc=ib;Gc=nb}else{if((c[qb+4>>2]|0)>>>0>>0){Ec=mb;Fc=ib;Gc=nb;break}sb=qb+20|0;rb=c[sb>>2]|0;do if(rb|0){if(!(ob|(B|(rb&1|0)==0))){Ec=mb;Fc=ib;Gc=nb;break n}if(rb&2|0?(k=c[h>>2]|0,!((k|z|0)==0|Ua&(k|0)==10)):0){Ec=mb;Fc=ib;Gc=nb;break n}do if(rb&16|0){if(kb){Ec=mb;Fc=ib;Gc=nb;break n}if(lv(qc)|0){Ec=mb;Fc=ib;Gc=nb;break n}k=c[h>>2]|0;if((k|0)==95)break;if(!(lv(k)|0)){Ec=mb;Fc=ib;Gc=nb;break n}}while(0);k=c[sb>>2]|0;if(!(k&32))Hc=k;else{if(kb){k=c[h>>2]|0;if((k|0)==95){Ec=mb;Fc=ib;Gc=nb;break n}else Ic=k}else{k=(lv(qc)|0)==0;Ia=c[h>>2]|0;if(k|(Ia|0)==95){Ec=mb;Fc=ib;Gc=nb;break n}else Ic=Ia}if(lv(Ic)|0){Ec=mb;Fc=ib;Gc=nb;break n}Hc=c[sb>>2]|0}Ia=c[h>>2]|0;do if((Ia|0)!=0&(hb&(Hc&64|0)!=0)){if(kb){Jc=Ia;Kc=1}else{k=(lv(qc)|0)!=0;Jc=c[h>>2]|0;Kc=k}if((Jc|0)==95)if(Kc){Ec=mb;Fc=ib;Gc=nb;break n}else break;else if(Kc^(lv(Jc)|0)!=0)break;else{Ec=mb;Fc=ib;Gc=nb;break n}}while(0);do if(c[sb>>2]&128|0){Ia=c[h>>2]|0;if(pb|(Ia|0)==0){Ec=mb;Fc=ib;Gc=nb;break n}if(kb){Lc=Ia;Mc=1}else{Ia=(lv(qc)|0)!=0;Lc=c[h>>2]|0;Mc=Ia}if((Lc|0)==95)if(Mc)break;else{Ec=mb;Fc=ib;Gc=nb;break n}else if(Mc^(lv(Lc)|0)!=0){Ec=mb;Fc=ib;Gc=nb;break n}else break}while(0);Ia=c[sb>>2]|0;do if(!(Ia&4))Nc=Ia;else{if(c[a>>2]&2|0){Nc=Ia;break}if(!(kv(qc,c[qb+24>>2]|0)|0)){Ec=mb;Fc=ib;Gc=nb;break n}Nc=c[sb>>2]|0}while(0);do if(Nc&4|0){if(!(c[a>>2]&2))break;Ia=Ju(qc)|0;k=qb+24|0;if(kv(Ia,c[k>>2]|0)|0)break;Ia=Iu(qc)|0;if(!(kv(Ia,c[k>>2]|0)|0)){Ec=mb;Fc=ib;Gc=nb;break n}}while(0);if(!(c[sb>>2]&8))break;if(Jw(c[qb+28>>2]|0,qc,c[a>>2]&2)|0){Ec=mb;Fc=ib;Gc=nb;break n}}while(0);if(!ib){Ec=mb;Fc=c[Sa>>2]|0;Gc=c[qb+16>>2]|0;break}sb=mb+28|0;rb=c[sb>>2]|0;if(!rb){k=Fw(G,0,0,0,32)|0;if(!k){q=148;break m}c[k+24>>2]=mb;c[k+28>>2]=0;Ia=Fw(G,0,0,0,c[d>>2]<<2)|0;c[k+20>>2]=Ia;if(!Ia){q=155;break m}c[sb>>2]=k;Oc=k}else Oc=rb;c[Oc>>2]=rc;c[Oc+4>>2]=sc;c[Oc+8>>2]=c[Sa>>2];c[Oc+12>>2]=c[qb+12>>2];c[Oc+16>>2]=c[h>>2];if((c[d>>2]|0)>0){rb=c[Oc+20>>2]|0;k=0;do{c[rb+(k<<2)>>2]=c[Fb+(k<<2)>>2];k=k+1|0}while((k|0)<(c[d>>2]|0))}k=c[qb+16>>2]|0;if(!k){Ec=Oc;Fc=ib;Gc=nb;break}rb=c[k>>2]|0;if((rb|0)<=-1){Ec=Oc;Fc=ib;Gc=nb;break}sb=c[Oc+20>>2]|0;Ia=k;k=rb;do{c[sb+(k<<2)>>2]=rc;Ia=Ia+4|0;k=c[Ia>>2]|0}while((k|0)>-1);Ec=Oc;Fc=ib;Gc=nb}while(0);Sa=qb+40|0;if(!(c[Sa>>2]|0)){q=170;break}else{ib=Fc;qb=qb+32|0;nb=Gc;mb=Ec}}if((q|0)==148){q=0;Ew(G);if(!Wa)Lw(Fb);if(!Ja)Lw(Gb);if(_a){uc=nb;vc=mb;wc=ec;xc=qc;yc=rc;zc=1;Ac=gc;Bc=sc;Cc=tc;break}Lw(Hb);uc=nb;vc=mb;wc=ec;xc=qc;yc=rc;zc=1;Ac=gc;Bc=sc;Cc=tc;break}else if((q|0)==155){q=0;Ew(G);if(!Wa)Lw(Fb);if(!Ja)Lw(Gb);if(_a){uc=nb;vc=mb;wc=ec;xc=qc;yc=rc;zc=1;Ac=gc;Bc=sc;Cc=tc;break}Lw(Hb);uc=nb;vc=mb;wc=ec;xc=qc;yc=rc;zc=1;Ac=gc;Bc=sc;Cc=tc;break}else if((q|0)==170){q=0;if(!Fc){Vb=Ec;Wb=ec;Xb=qc;Yb=rc;Zb=gc;_b=sc;$b=tc;ac=Gc;q=174;continue k}if(!Gc){uc=0;vc=Ec;wc=ec;xc=qc;yc=rc;zc=0;Ac=Fc;Bc=sc;Cc=tc;break}qb=c[Gc>>2]|0;if((qb|0)>-1){Pc=Gc;Qc=qb}else{uc=Gc;vc=Ec;wc=ec;xc=qc;yc=rc;zc=0;Ac=Fc;Bc=sc;Cc=tc;break}while(1){qb=Pc+4|0;c[Fb+(Qc<<2)>>2]=rc;Qc=c[qb>>2]|0;if((Qc|0)<=-1){uc=qb;vc=Ec;wc=ec;xc=qc;yc=rc;zc=0;Ac=Fc;Bc=sc;Cc=tc;break}else Pc=qb}}}else if((q|0)==174){q=0;mb=c[Vb+24>>2]|0;if(!mb){if((Wb|0)>-1|(c[h>>2]|0)==0){uc=ac;vc=Vb;wc=Wb;xc=Xb;yc=Yb;zc=27;Ac=Zb;Bc=_b;Cc=$b;break}c[h>>2]=tb;uc=ac;vc=Vb;wc=Wb;xc=Xb;yc=Yb;zc=3;Ac=Zb;Bc=s;Cc=$b;break}nb=c[Vb+8>>2]|0;if(c[nb+20>>2]&256|0)c[Hb+(c[Vb+12>>2]<<2)>>2]=0;qb=c[Vb>>2]|0;ib=c[Vb+4>>2]|0;c[h>>2]=c[Vb+16>>2];Sa=c[d>>2]|0;if((Sa|0)<=0){uc=ac;vc=mb;wc=Wb;xc=Xb;yc=qb;zc=0;Ac=nb;Bc=ib;Cc=$b;break}kb=c[Vb+20>>2]|0;pb=0;do{c[Fb+(pb<<2)>>2]=c[kb+(pb<<2)>>2];pb=pb+1|0}while((pb|0)!=(Sa|0));uc=ac;vc=mb;wc=Wb;xc=Xb;yc=qb;zc=0;Ac=nb;Bc=ib;Cc=$b}while(0);switch(zc|0){case 2:{Ab=0;Bb=Gb;Cb=Hb;Db=Fb;Eb=1;break h;break}case 27:{q=184;break i;break}case 0:{bc=xc;cc=yc;dc=Bc;ec=wc;fc=Cc;gc=Ac;hc=uc;ic=vc;q=82;break}case 3:{break k;break}default:{yb=0;zb=12;break g}}}Ya=Bc;Xa=Cc;cb=ub;bb=wc;db=vc;eb=c[d>>2]|0}if((q|0)==56){Ew(G);if(!Wa)Lw(Fb);if(!Ja)Lw(Gb);if(_a){yb=0;zb=12;break g}Lw(Hb);yb=0;zb=12;break g}else if((q|0)==63){Ew(G);if(!Wa)Lw(Fb);if(!Ja)Lw(Gb);if(_a){yb=0;zb=12;break g}Lw(Hb);yb=0;zb=12;break g}else if((q|0)==184){Ab=wc;Bb=Gb;Cb=Hb;Db=Fb;Eb=wc>>>31;break}}while(0);Ew(G);if(Db|0)Lw(Db);if(Bb|0)Lw(Bb);if(!Cb){yb=Ab;zb=Eb}else{Lw(Cb);yb=Ab;zb=Eb}}else{yb=0;zb=12}while(0);wb=zb;xb=yb}if(!wb)Iw(j,e,c[a>>2]|0,i,p,xb);if(!p)o=wb;else{Lw(p);o=wb}}l=g;return o|0}function Hw(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;a:do if((a|0)>0){f=0;while(1){g=c[d+(f<<2)>>2]|0;h=c[e+(f<<2)>>2]|0;if(!(c[b+(f<<2)>>2]|0)){if((g|0)<(h|0)){i=1;break a}if((g|0)>(h|0)){i=0;break a}}else{if((g|0)>(h|0)){i=1;break a}if((g|0)<(h|0)){i=0;break a}}f=f+1|0;if((f|0)>=(a|0)){i=0;break}}}else i=0;while(0);return i|0}function Iw(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;if((d&8|0)==0&(g|0)>-1){d=c[e+16>>2]|0;h=e+28|0;i=c[h>>2]|0;j=(a|0)!=0;if(j&(i|0)!=0){k=e+48|0;e=0;do{l=c[d+(e*12|0)>>2]|0;if((l|0)==(c[k>>2]|0))m=g;else m=c[f+(l<<2)>>2]|0;l=b+(e<<3)|0;c[l>>2]=m;n=c[d+(e*12|0)+4>>2]|0;if((n|0)==(c[k>>2]|0))o=g;else o=c[f+(n<<2)>>2]|0;n=b+(e<<3)+4|0;c[n>>2]=o;if((m|0)==-1|(o|0)==-1){c[n>>2]=-1;c[l>>2]=-1}e=e+1|0;l=c[h>>2]|0}while(e>>>0>>0&e>>>0>>0);p=l}else p=i;if(j&(p|0)!=0){j=0;while(1){i=b+(j<<3)+4|0;e=c[d+(j*12|0)+8>>2]|0;if(e|0?(h=c[e>>2]|0,(h|0)>-1):0){o=b+(j<<3)|0;m=0;f=h;h=c[o>>2]|0;while(1){if((h|0)>=(c[b+(f<<3)>>2]|0)?(c[i>>2]|0)<=(c[b+(f<<3)+4>>2]|0):0)q=h;else{c[i>>2]=-1;c[o>>2]=-1;q=-1}m=m+1|0;f=c[e+(m<<2)>>2]|0;if((f|0)<=-1)break;else h=q}}h=j+1|0;if(h>>>0>>0&h>>>0

>>0)j=h;else{r=h;break}}}else r=0}else r=0;if(r>>>0>>0)Uw(b+(r<<3)|0,-1,a-r<<3|0)|0;return}function Jw(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=c[a>>2]|0;a:do if(!e)f=0;else{g=(d|0)==0;h=a;i=e;while(1){if(g){if(kv(b,i)|0){f=1;break a}}else{j=Iu(b)|0;if(kv(j,c[h>>2]|0)|0){f=1;break a}j=Ju(b)|0;if(kv(j,c[h>>2]|0)|0){f=1;break a}}h=h+4|0;i=c[h>>2]|0;if(!i){f=0;break}}}while(0);return f|0} -function Ol(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+28|0;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;k=d+4|0;n=d;c[e>>2]=b;c[f>>2]=c[e>>2];Nr(c[f>>2]|0,0,0);c[g>>2]=c[(c[f>>2]|0)+128>>2];c[h>>2]=c[(c[f>>2]|0)+128+4>>2];c[j>>2]=c[g>>2]<<6;c[i>>2]=c[h>>2]<<6|(c[g>>2]|0)>>>26;c[g>>2]=c[j>>2];h=(c[j>>2]|0)+(c[(c[f>>2]|0)+144>>2]|0)|0;c[j>>2]=h;if(h>>>0<(c[g>>2]|0)>>>0)c[i>>2]=(c[i>>2]|0)+1;c[g>>2]=c[j>>2];c[j>>2]=c[j>>2]<<3;c[i>>2]=c[i>>2]<<3;c[i>>2]=c[i>>2]|(c[g>>2]|0)>>>29;g=(c[(c[f>>2]|0)+144>>2]|0)<56;h=(c[f>>2]|0)+144|0;e=c[h>>2]|0;c[h>>2]=e+1;a[(c[f>>2]|0)+e>>0]=-128;a:do if(g)while(1){if((c[(c[f>>2]|0)+144>>2]|0)>=56)break a;e=(c[f>>2]|0)+144|0;h=c[e>>2]|0;c[e>>2]=h+1;a[(c[f>>2]|0)+h>>0]=0}else{while(1){o=c[f>>2]|0;if((c[(c[f>>2]|0)+144>>2]|0)>=64)break;h=o+144|0;e=c[h>>2]|0;c[h>>2]=e+1;a[(c[f>>2]|0)+e>>0]=0}Nr(o,0,0);e=c[f>>2]|0;h=e+56|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(h|0))}while(0);Sl((c[f>>2]|0)+56|0,c[i>>2]|0);Sl((c[f>>2]|0)+60|0,c[j>>2]|0);c[n>>2]=Tl(c[f>>2]|0,c[f>>2]|0,1)|0;bf(c[n>>2]|0);cf();c[k>>2]=c[f>>2];Sl(c[k>>2]|0,c[(c[f>>2]|0)+160>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Sl(c[k>>2]|0,c[(c[f>>2]|0)+164>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Sl(c[k>>2]|0,c[(c[f>>2]|0)+168>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Sl(c[k>>2]|0,c[(c[f>>2]|0)+172>>2]|0);c[k>>2]=(c[k>>2]|0)+4;Sl(c[k>>2]|0,c[(c[f>>2]|0)+176>>2]|0);c[k>>2]=(c[k>>2]|0)+4;l=d;return}function Pl(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];l=b;return c[e>>2]|0}function Ql(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if((c[f>>2]|0)==2){c[i>>2]=Rl(c[g>>2]|0,c[h>>2]|0)|0;j=c[i>>2]|0;l=e;return j|0}else{c[i>>2]=5;j=c[i>>2]|0;l=e;return j|0}return 0}function Rl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=42861;c[i>>2]=Mr(2,0,42874,3,42324,20)|0;do if(!(c[i>>2]|0)){if(c[f>>2]|0){c[h>>2]=42943;c[i>>2]=Mr(2,0,42531,56,42345,20)|0;if(c[i>>2]|0)break;c[h>>2]=43133;c[i>>2]=Mr(2,1,0,0,42366,20)|0;if(c[i>>2]|0)break}c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}while(0);if(c[g>>2]|0)Eb[c[g>>2]&1](43214,2,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;j=c[e>>2]|0;l=d;return j|0}function Sl(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];a[c[h>>2]>>0]=(c[g>>2]|0)>>>24;a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)>>>16;a[(c[h>>2]|0)+2>>0]=(c[g>>2]|0)>>>8;a[(c[h>>2]|0)+3>>0]=c[g>>2];l=e;return}function Tl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];do{c[j>>2]=Ul(c[i>>2]|0,c[g>>2]|0)|0;c[g>>2]=(c[g>>2]|0)+64;f=(c[h>>2]|0)+-1|0;c[h>>2]=f}while((f|0)!=0);l=e;return c[j>>2]|0}function Ul(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;d=l;l=l+112|0;if((l|0)>=(m|0))$(112);e=d+100|0;f=d+96|0;g=d+92|0;h=d+88|0;i=d+84|0;j=d+80|0;k=d+76|0;n=d+72|0;o=d+68|0;p=d+64|0;q=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[e>>2];c[h>>2]=c[f>>2];c[i>>2]=c[(c[g>>2]|0)+160>>2];c[j>>2]=c[(c[g>>2]|0)+164>>2];c[k>>2]=c[(c[g>>2]|0)+168>>2];c[n>>2]=c[(c[g>>2]|0)+172>>2];c[o>>2]=c[(c[g>>2]|0)+176>>2];f=Vl(c[i>>2]|0,5)|0;e=f+(c[n>>2]^c[j>>2]&(c[k>>2]^c[n>>2]))+1518500249|0;f=Wl(c[h>>2]|0)|0;c[q>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[k>>2]^c[i>>2]&(c[j>>2]^c[k>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+4|0)|0;c[q+4>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[j>>2]^c[o>>2]&(c[i>>2]^c[j>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+8|0)|0;c[q+8>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[i>>2]^c[n>>2]&(c[o>>2]^c[i>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+12|0)|0;c[q+12>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[o>>2]^c[k>>2]&(c[n>>2]^c[o>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+16|0)|0;c[q+16>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[n>>2]^c[j>>2]&(c[k>>2]^c[n>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+20|0)|0;c[q+20>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[k>>2]^c[i>>2]&(c[j>>2]^c[k>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+24|0)|0;c[q+24>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[j>>2]^c[o>>2]&(c[i>>2]^c[j>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+28|0)|0;c[q+28>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[i>>2]^c[n>>2]&(c[o>>2]^c[i>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+32|0)|0;c[q+32>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[o>>2]^c[k>>2]&(c[n>>2]^c[o>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+36|0)|0;c[q+36>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[n>>2]^c[j>>2]&(c[k>>2]^c[n>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+40|0)|0;c[q+40>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[k>>2]^c[i>>2]&(c[j>>2]^c[k>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+44|0)|0;c[q+44>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[j>>2]^c[o>>2]&(c[i>>2]^c[j>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+48|0)|0;c[q+48>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[i>>2]^c[n>>2]&(c[o>>2]^c[i>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+52|0)|0;c[q+52>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[o>>2]^c[k>>2]&(c[n>>2]^c[o>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+56|0)|0;c[q+56>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[n>>2]^c[j>>2]&(c[k>>2]^c[n>>2]))+1518500249|0;f=Wl((c[h>>2]|0)+60|0)|0;c[q+60>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[k>>2]^c[i>>2]&(c[j>>2]^c[k>>2]))+1518500249|0;c[p>>2]=c[q>>2]^c[q+8>>2]^c[q+32>>2]^c[q+52>>2];f=Vl(c[p>>2]|0,1)|0;c[q>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[j>>2]^c[o>>2]&(c[i>>2]^c[j>>2]))+1518500249|0;c[p>>2]=c[q+4>>2]^c[q+12>>2]^c[q+36>>2]^c[q+56>>2];f=Vl(c[p>>2]|0,1)|0;c[q+4>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[i>>2]^c[n>>2]&(c[o>>2]^c[i>>2]))+1518500249|0;c[p>>2]=c[q+8>>2]^c[q+16>>2]^c[q+40>>2]^c[q+60>>2];f=Vl(c[p>>2]|0,1)|0;c[q+8>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[o>>2]^c[k>>2]&(c[n>>2]^c[o>>2]))+1518500249|0;c[p>>2]=c[q+12>>2]^c[q+20>>2]^c[q+44>>2]^c[q>>2];f=Vl(c[p>>2]|0,1)|0;c[q+12>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+1859775393|0;c[p>>2]=c[q+16>>2]^c[q+24>>2]^c[q+48>>2]^c[q+4>>2];f=Vl(c[p>>2]|0,1)|0;c[q+16>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+1859775393|0;c[p>>2]=c[q+20>>2]^c[q+28>>2]^c[q+52>>2]^c[q+8>>2];f=Vl(c[p>>2]|0,1)|0;c[q+20>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+1859775393|0;c[p>>2]=c[q+24>>2]^c[q+32>>2]^c[q+56>>2]^c[q+12>>2];f=Vl(c[p>>2]|0,1)|0;c[q+24>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+1859775393|0;c[p>>2]=c[q+28>>2]^c[q+36>>2]^c[q+60>>2]^c[q+16>>2];f=Vl(c[p>>2]|0,1)|0;c[q+28>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+1859775393|0;c[p>>2]=c[q+32>>2]^c[q+40>>2]^c[q>>2]^c[q+20>>2];f=Vl(c[p>>2]|0,1)|0;c[q+32>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+1859775393|0;c[p>>2]=c[q+36>>2]^c[q+44>>2]^c[q+4>>2]^c[q+24>>2];f=Vl(c[p>>2]|0,1)|0;c[q+36>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+1859775393|0;c[p>>2]=c[q+40>>2]^c[q+48>>2]^c[q+8>>2]^c[q+28>>2];f=Vl(c[p>>2]|0,1)|0;c[q+40>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+1859775393|0;c[p>>2]=c[q+44>>2]^c[q+52>>2]^c[q+12>>2]^c[q+32>>2];f=Vl(c[p>>2]|0,1)|0;c[q+44>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+1859775393|0;c[p>>2]=c[q+48>>2]^c[q+56>>2]^c[q+16>>2]^c[q+36>>2];f=Vl(c[p>>2]|0,1)|0;c[q+48>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+1859775393|0;c[p>>2]=c[q+52>>2]^c[q+60>>2]^c[q+20>>2]^c[q+40>>2];f=Vl(c[p>>2]|0,1)|0;c[q+52>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+1859775393|0;c[p>>2]=c[q+56>>2]^c[q>>2]^c[q+24>>2]^c[q+44>>2];f=Vl(c[p>>2]|0,1)|0;c[q+56>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+1859775393|0;c[p>>2]=c[q+60>>2]^c[q+4>>2]^c[q+28>>2]^c[q+48>>2];f=Vl(c[p>>2]|0,1)|0;c[q+60>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+1859775393|0;c[p>>2]=c[q>>2]^c[q+8>>2]^c[q+32>>2]^c[q+52>>2];f=Vl(c[p>>2]|0,1)|0;c[q>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+1859775393|0;c[p>>2]=c[q+4>>2]^c[q+12>>2]^c[q+36>>2]^c[q+56>>2];f=Vl(c[p>>2]|0,1)|0;c[q+4>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+1859775393|0;c[p>>2]=c[q+8>>2]^c[q+16>>2]^c[q+40>>2]^c[q+60>>2];f=Vl(c[p>>2]|0,1)|0;c[q+8>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+1859775393|0;c[p>>2]=c[q+12>>2]^c[q+20>>2]^c[q+44>>2]^c[q>>2];f=Vl(c[p>>2]|0,1)|0;c[q+12>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+1859775393|0;c[p>>2]=c[q+16>>2]^c[q+24>>2]^c[q+48>>2]^c[q+4>>2];f=Vl(c[p>>2]|0,1)|0;c[q+16>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+1859775393|0;c[p>>2]=c[q+20>>2]^c[q+28>>2]^c[q+52>>2]^c[q+8>>2];f=Vl(c[p>>2]|0,1)|0;c[q+20>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+1859775393|0;c[p>>2]=c[q+24>>2]^c[q+32>>2]^c[q+56>>2]^c[q+12>>2];f=Vl(c[p>>2]|0,1)|0;c[q+24>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+1859775393|0;c[p>>2]=c[q+28>>2]^c[q+36>>2]^c[q+60>>2]^c[q+16>>2];f=Vl(c[p>>2]|0,1)|0;c[q+28>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]&c[k>>2]|c[n>>2]&(c[j>>2]|c[k>>2]))+-1894007588|0;c[p>>2]=c[q+32>>2]^c[q+40>>2]^c[q>>2]^c[q+20>>2];f=Vl(c[p>>2]|0,1)|0;c[q+32>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]&c[j>>2]|c[k>>2]&(c[i>>2]|c[j>>2]))+-1894007588|0;c[p>>2]=c[q+36>>2]^c[q+44>>2]^c[q+4>>2]^c[q+24>>2];f=Vl(c[p>>2]|0,1)|0;c[q+36>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]&c[i>>2]|c[j>>2]&(c[o>>2]|c[i>>2]))+-1894007588|0;c[p>>2]=c[q+40>>2]^c[q+48>>2]^c[q+8>>2]^c[q+28>>2];f=Vl(c[p>>2]|0,1)|0;c[q+40>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]&c[o>>2]|c[i>>2]&(c[n>>2]|c[o>>2]))+-1894007588|0;c[p>>2]=c[q+44>>2]^c[q+52>>2]^c[q+12>>2]^c[q+32>>2];f=Vl(c[p>>2]|0,1)|0;c[q+44>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]&c[n>>2]|c[o>>2]&(c[k>>2]|c[n>>2]))+-1894007588|0;c[p>>2]=c[q+48>>2]^c[q+56>>2]^c[q+16>>2]^c[q+36>>2];f=Vl(c[p>>2]|0,1)|0;c[q+48>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]&c[k>>2]|c[n>>2]&(c[j>>2]|c[k>>2]))+-1894007588|0;c[p>>2]=c[q+52>>2]^c[q+60>>2]^c[q+20>>2]^c[q+40>>2];f=Vl(c[p>>2]|0,1)|0;c[q+52>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]&c[j>>2]|c[k>>2]&(c[i>>2]|c[j>>2]))+-1894007588|0;c[p>>2]=c[q+56>>2]^c[q>>2]^c[q+24>>2]^c[q+44>>2];f=Vl(c[p>>2]|0,1)|0;c[q+56>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]&c[i>>2]|c[j>>2]&(c[o>>2]|c[i>>2]))+-1894007588|0;c[p>>2]=c[q+60>>2]^c[q+4>>2]^c[q+28>>2]^c[q+48>>2];f=Vl(c[p>>2]|0,1)|0;c[q+60>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]&c[o>>2]|c[i>>2]&(c[n>>2]|c[o>>2]))+-1894007588|0;c[p>>2]=c[q>>2]^c[q+8>>2]^c[q+32>>2]^c[q+52>>2];f=Vl(c[p>>2]|0,1)|0;c[q>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]&c[n>>2]|c[o>>2]&(c[k>>2]|c[n>>2]))+-1894007588|0;c[p>>2]=c[q+4>>2]^c[q+12>>2]^c[q+36>>2]^c[q+56>>2];f=Vl(c[p>>2]|0,1)|0;c[q+4>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]&c[k>>2]|c[n>>2]&(c[j>>2]|c[k>>2]))+-1894007588|0;c[p>>2]=c[q+8>>2]^c[q+16>>2]^c[q+40>>2]^c[q+60>>2];f=Vl(c[p>>2]|0,1)|0;c[q+8>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]&c[j>>2]|c[k>>2]&(c[i>>2]|c[j>>2]))+-1894007588|0;c[p>>2]=c[q+12>>2]^c[q+20>>2]^c[q+44>>2]^c[q>>2];f=Vl(c[p>>2]|0,1)|0;c[q+12>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]&c[i>>2]|c[j>>2]&(c[o>>2]|c[i>>2]))+-1894007588|0;c[p>>2]=c[q+16>>2]^c[q+24>>2]^c[q+48>>2]^c[q+4>>2];f=Vl(c[p>>2]|0,1)|0;c[q+16>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]&c[o>>2]|c[i>>2]&(c[n>>2]|c[o>>2]))+-1894007588|0;c[p>>2]=c[q+20>>2]^c[q+28>>2]^c[q+52>>2]^c[q+8>>2];f=Vl(c[p>>2]|0,1)|0;c[q+20>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]&c[n>>2]|c[o>>2]&(c[k>>2]|c[n>>2]))+-1894007588|0;c[p>>2]=c[q+24>>2]^c[q+32>>2]^c[q+56>>2]^c[q+12>>2];f=Vl(c[p>>2]|0,1)|0;c[q+24>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]&c[k>>2]|c[n>>2]&(c[j>>2]|c[k>>2]))+-1894007588|0;c[p>>2]=c[q+28>>2]^c[q+36>>2]^c[q+60>>2]^c[q+16>>2];f=Vl(c[p>>2]|0,1)|0;c[q+28>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]&c[j>>2]|c[k>>2]&(c[i>>2]|c[j>>2]))+-1894007588|0;c[p>>2]=c[q+32>>2]^c[q+40>>2]^c[q>>2]^c[q+20>>2];f=Vl(c[p>>2]|0,1)|0;c[q+32>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]&c[i>>2]|c[j>>2]&(c[o>>2]|c[i>>2]))+-1894007588|0;c[p>>2]=c[q+36>>2]^c[q+44>>2]^c[q+4>>2]^c[q+24>>2];f=Vl(c[p>>2]|0,1)|0;c[q+36>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]&c[o>>2]|c[i>>2]&(c[n>>2]|c[o>>2]))+-1894007588|0;c[p>>2]=c[q+40>>2]^c[q+48>>2]^c[q+8>>2]^c[q+28>>2];f=Vl(c[p>>2]|0,1)|0;c[q+40>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]&c[n>>2]|c[o>>2]&(c[k>>2]|c[n>>2]))+-1894007588|0;c[p>>2]=c[q+44>>2]^c[q+52>>2]^c[q+12>>2]^c[q+32>>2];f=Vl(c[p>>2]|0,1)|0;c[q+44>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+-899497514|0;c[p>>2]=c[q+48>>2]^c[q+56>>2]^c[q+16>>2]^c[q+36>>2];f=Vl(c[p>>2]|0,1)|0;c[q+48>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+-899497514|0;c[p>>2]=c[q+52>>2]^c[q+60>>2]^c[q+20>>2]^c[q+40>>2];f=Vl(c[p>>2]|0,1)|0;c[q+52>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+-899497514|0;c[p>>2]=c[q+56>>2]^c[q>>2]^c[q+24>>2]^c[q+44>>2];f=Vl(c[p>>2]|0,1)|0;c[q+56>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+-899497514|0;c[p>>2]=c[q+60>>2]^c[q+4>>2]^c[q+28>>2]^c[q+48>>2];f=Vl(c[p>>2]|0,1)|0;c[q+60>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+-899497514|0;c[p>>2]=c[q>>2]^c[q+8>>2]^c[q+32>>2]^c[q+52>>2];f=Vl(c[p>>2]|0,1)|0;c[q>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+-899497514|0;c[p>>2]=c[q+4>>2]^c[q+12>>2]^c[q+36>>2]^c[q+56>>2];f=Vl(c[p>>2]|0,1)|0;c[q+4>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+-899497514|0;c[p>>2]=c[q+8>>2]^c[q+16>>2]^c[q+40>>2]^c[q+60>>2];f=Vl(c[p>>2]|0,1)|0;c[q+8>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+-899497514|0;c[p>>2]=c[q+12>>2]^c[q+20>>2]^c[q+44>>2]^c[q>>2];f=Vl(c[p>>2]|0,1)|0;c[q+12>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+-899497514|0;c[p>>2]=c[q+16>>2]^c[q+24>>2]^c[q+48>>2]^c[q+4>>2];f=Vl(c[p>>2]|0,1)|0;c[q+16>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+-899497514|0;c[p>>2]=c[q+20>>2]^c[q+28>>2]^c[q+52>>2]^c[q+8>>2];f=Vl(c[p>>2]|0,1)|0;c[q+20>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+-899497514|0;c[p>>2]=c[q+24>>2]^c[q+32>>2]^c[q+56>>2]^c[q+12>>2];f=Vl(c[p>>2]|0,1)|0;c[q+24>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+-899497514|0;c[p>>2]=c[q+28>>2]^c[q+36>>2]^c[q+60>>2]^c[q+16>>2];f=Vl(c[p>>2]|0,1)|0;c[q+28>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+-899497514|0;c[p>>2]=c[q+32>>2]^c[q+40>>2]^c[q>>2]^c[q+20>>2];f=Vl(c[p>>2]|0,1)|0;c[q+32>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+-899497514|0;c[p>>2]=c[q+36>>2]^c[q+44>>2]^c[q+4>>2]^c[q+24>>2];f=Vl(c[p>>2]|0,1)|0;c[q+36>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+-899497514|0;c[p>>2]=c[q+40>>2]^c[q+48>>2]^c[q+8>>2]^c[q+28>>2];f=Vl(c[p>>2]|0,1)|0;c[q+40>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=Vl(c[i>>2]|0,5)|0;e=f+(c[j>>2]^c[k>>2]^c[n>>2])+-899497514|0;c[p>>2]=c[q+44>>2]^c[q+52>>2]^c[q+12>>2]^c[q+32>>2];f=Vl(c[p>>2]|0,1)|0;c[q+44>>2]=f;c[o>>2]=(c[o>>2]|0)+(e+f);c[j>>2]=Vl(c[j>>2]|0,30)|0;f=Vl(c[o>>2]|0,5)|0;e=f+(c[i>>2]^c[j>>2]^c[k>>2])+-899497514|0;c[p>>2]=c[q+48>>2]^c[q+56>>2]^c[q+16>>2]^c[q+36>>2];f=Vl(c[p>>2]|0,1)|0;c[q+48>>2]=f;c[n>>2]=(c[n>>2]|0)+(e+f);c[i>>2]=Vl(c[i>>2]|0,30)|0;f=Vl(c[n>>2]|0,5)|0;e=f+(c[o>>2]^c[i>>2]^c[j>>2])+-899497514|0;c[p>>2]=c[q+52>>2]^c[q+60>>2]^c[q+20>>2]^c[q+40>>2];f=Vl(c[p>>2]|0,1)|0;c[q+52>>2]=f;c[k>>2]=(c[k>>2]|0)+(e+f);c[o>>2]=Vl(c[o>>2]|0,30)|0;f=Vl(c[k>>2]|0,5)|0;e=f+(c[n>>2]^c[o>>2]^c[i>>2])+-899497514|0;c[p>>2]=c[q+56>>2]^c[q>>2]^c[q+24>>2]^c[q+44>>2];f=Vl(c[p>>2]|0,1)|0;c[q+56>>2]=f;c[j>>2]=(c[j>>2]|0)+(e+f);c[n>>2]=Vl(c[n>>2]|0,30)|0;f=Vl(c[j>>2]|0,5)|0;e=f+(c[k>>2]^c[n>>2]^c[o>>2])+-899497514|0;c[p>>2]=c[q+60>>2]^c[q+4>>2]^c[q+28>>2]^c[q+48>>2];f=Vl(c[p>>2]|0,1)|0;c[q+60>>2]=f;c[i>>2]=(c[i>>2]|0)+(e+f);c[k>>2]=Vl(c[k>>2]|0,30)|0;f=(c[g>>2]|0)+160|0;c[f>>2]=(c[f>>2]|0)+(c[i>>2]|0);i=(c[g>>2]|0)+164|0;c[i>>2]=(c[i>>2]|0)+(c[j>>2]|0);j=(c[g>>2]|0)+168|0;c[j>>2]=(c[j>>2]|0)+(c[k>>2]|0);k=(c[g>>2]|0)+172|0;c[k>>2]=(c[k>>2]|0)+(c[n>>2]|0);n=(c[g>>2]|0)+176|0;c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);l=d;return 104}function Vl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return c[e>>2]<<(c[f>>2]&31)|(c[e>>2]|0)>>>(32-(c[f>>2]|0)&31)|0}function Wl(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];l=b;return (d[c[f>>2]>>0]|0)<<24|(d[(c[f>>2]|0)+1>>0]|0)<<16|(d[(c[f>>2]|0)+2>>0]|0)<<8|(d[(c[f>>2]|0)+3>>0]|0)|0}function Xl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+208|0;if((l|0)>=(m|0))$(208);g=f+192|0;h=f+188|0;i=f+184|0;j=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;Nl(j,0);Nr(j,c[h>>2]|0,c[i>>2]|0);Ol(j);i=c[g>>2]|0;g=j;j=i+20|0;do{a[i>>0]=a[g>>0]|0;i=i+1|0;g=g+1|0}while((i|0)<(j|0));l=f;return}function Yl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+208|0;if((l|0)>=(m|0))$(208);g=f+192|0;h=f+188|0;i=f+184|0;j=f;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;Nl(j,0);while(1){if((c[i>>2]|0)<=0)break;Nr(j,(c[(c[h>>2]|0)+12>>2]|0)+(c[(c[h>>2]|0)+4>>2]|0)|0,c[(c[h>>2]|0)+8>>2]|0);c[h>>2]=(c[h>>2]|0)+16;c[i>>2]=(c[i>>2]|0)+-1}Ol(j);i=c[g>>2]|0;g=j;j=i+20|0;do{a[i>>0]=a[g>>0]|0;i=i+1|0;g=g+1|0}while((i|0)<(j|0));l=f;return}function Zl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+4|0;c[e>>2]=a;c[d+8>>2]=b;c[f>>2]=c[e>>2];c[d>>2]=pg()|0;c[(c[f>>2]|0)+160>>2]=-1056596264;c[(c[f>>2]|0)+164>>2]=914150663;c[(c[f>>2]|0)+168>>2]=812702999;c[(c[f>>2]|0)+172>>2]=-150054599;c[(c[f>>2]|0)+176>>2]=-4191439;c[(c[f>>2]|0)+180>>2]=1750603025;c[(c[f>>2]|0)+184>>2]=1694076839;c[(c[f>>2]|0)+188>>2]=-1090891868;e=(c[f>>2]|0)+128|0;c[e>>2]=0;c[e+4>>2]=0;e=(c[f>>2]|0)+136|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[f>>2]|0)+144>>2]=0;c[(c[f>>2]|0)+148>>2]=64;c[(c[f>>2]|0)+152>>2]=33;l=d;return}function _l(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+28|0;f=d+24|0;g=d+20|0;h=d+16|0;i=d+12|0;j=d+8|0;k=d+4|0;n=d;c[e>>2]=b;c[f>>2]=c[e>>2];Nr(c[f>>2]|0,0,0);c[g>>2]=c[(c[f>>2]|0)+128>>2];c[h>>2]=c[(c[f>>2]|0)+128+4>>2];c[j>>2]=c[g>>2]<<6;c[i>>2]=c[h>>2]<<6|(c[g>>2]|0)>>>26;c[g>>2]=c[j>>2];h=(c[j>>2]|0)+(c[(c[f>>2]|0)+144>>2]|0)|0;c[j>>2]=h;if(h>>>0<(c[g>>2]|0)>>>0)c[i>>2]=(c[i>>2]|0)+1;c[g>>2]=c[j>>2];c[j>>2]=c[j>>2]<<3;c[i>>2]=c[i>>2]<<3;c[i>>2]=c[i>>2]|(c[g>>2]|0)>>>29;g=(c[(c[f>>2]|0)+144>>2]|0)<56;h=(c[f>>2]|0)+144|0;e=c[h>>2]|0;c[h>>2]=e+1;a[(c[f>>2]|0)+e>>0]=-128;a:do if(g)while(1){if((c[(c[f>>2]|0)+144>>2]|0)>=56)break a;e=(c[f>>2]|0)+144|0;h=c[e>>2]|0;c[e>>2]=h+1;a[(c[f>>2]|0)+h>>0]=0}else{while(1){o=c[f>>2]|0;if((c[(c[f>>2]|0)+144>>2]|0)>=64)break;h=o+144|0;e=c[h>>2]|0;c[h>>2]=e+1;a[(c[f>>2]|0)+e>>0]=0}Nr(o,0,0);e=c[f>>2]|0;h=e+56|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(h|0))}while(0);dm((c[f>>2]|0)+56|0,c[i>>2]|0);dm((c[f>>2]|0)+60|0,c[j>>2]|0);c[n>>2]=em(c[f>>2]|0,c[f>>2]|0,1)|0;bf(c[n>>2]|0);cf();c[k>>2]=c[f>>2];dm(c[k>>2]|0,c[(c[f>>2]|0)+160>>2]|0);c[k>>2]=(c[k>>2]|0)+4;dm(c[k>>2]|0,c[(c[f>>2]|0)+164>>2]|0);c[k>>2]=(c[k>>2]|0)+4;dm(c[k>>2]|0,c[(c[f>>2]|0)+168>>2]|0);c[k>>2]=(c[k>>2]|0)+4;dm(c[k>>2]|0,c[(c[f>>2]|0)+172>>2]|0);c[k>>2]=(c[k>>2]|0)+4;dm(c[k>>2]|0,c[(c[f>>2]|0)+176>>2]|0);c[k>>2]=(c[k>>2]|0)+4;dm(c[k>>2]|0,c[(c[f>>2]|0)+180>>2]|0);c[k>>2]=(c[k>>2]|0)+4;dm(c[k>>2]|0,c[(c[f>>2]|0)+184>>2]|0);c[k>>2]=(c[k>>2]|0)+4;dm(c[k>>2]|0,c[(c[f>>2]|0)+188>>2]|0);c[k>>2]=(c[k>>2]|0)+4;l=d;return}function $l(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];l=b;return c[e>>2]|0}function am(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;switch(c[f>>2]|0){case 11:{c[i>>2]=bm(c[g>>2]|0,c[h>>2]|0)|0;break}case 8:{c[i>>2]=cm(c[g>>2]|0,c[h>>2]|0)|0;break}default:c[i>>2]=5}l=e;return c[i>>2]|0}function bm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=42861;c[i>>2]=Mr(11,0,42874,3,42654,28)|0;do if(!(c[i>>2]|0)){if(c[f>>2]|0){c[h>>2]=42943;c[i>>2]=Mr(11,0,42531,56,42683,28)|0;if(c[i>>2]|0)break;c[h>>2]=43133;c[i>>2]=Mr(11,1,0,0,42712,28)|0;if(c[i>>2]|0)break}c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}while(0);if(c[g>>2]|0)Eb[c[g>>2]&1](43214,11,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;j=c[e>>2]|0;l=d;return j|0}function cm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=42861;c[i>>2]=Mr(8,0,42874,3,42498,32)|0;do if(!(c[i>>2]|0)){if(c[f>>2]|0){c[h>>2]=42943;c[i>>2]=Mr(8,0,42531,56,42588,32)|0;if(c[i>>2]|0)break;c[h>>2]=43133;c[i>>2]=Mr(8,1,0,0,42621,32)|0;if(c[i>>2]|0)break}c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}while(0);if(c[g>>2]|0)Eb[c[g>>2]&1](43214,8,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;j=c[e>>2]|0;l=d;return j|0}function dm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];a[c[h>>2]>>0]=(c[g>>2]|0)>>>24;a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)>>>16;a[(c[h>>2]|0)+2>>0]=(c[g>>2]|0)>>>8;a[(c[h>>2]|0)+3>>0]=c[g>>2];l=e;return}function em(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];do{c[j>>2]=fm(c[i>>2]|0,c[g>>2]|0)|0;c[g>>2]=(c[g>>2]|0)+64;f=(c[h>>2]|0)+-1|0;c[h>>2]=f}while((f|0)!=0);l=e;return c[j>>2]|0}function fm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=l;l=l+320|0;if((l|0)>=(m|0))$(320);e=d+312|0;f=d+308|0;g=d+304|0;h=d+300|0;i=d+296|0;j=d+292|0;k=d+288|0;n=d+284|0;o=d+280|0;p=d+276|0;q=d+272|0;r=d+268|0;s=d+264|0;t=d+8|0;u=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=c[e>>2];c[h>>2]=c[(c[g>>2]|0)+160>>2];c[i>>2]=c[(c[g>>2]|0)+164>>2];c[j>>2]=c[(c[g>>2]|0)+168>>2];c[k>>2]=c[(c[g>>2]|0)+172>>2];c[n>>2]=c[(c[g>>2]|0)+176>>2];c[o>>2]=c[(c[g>>2]|0)+180>>2];c[p>>2]=c[(c[g>>2]|0)+184>>2];c[q>>2]=c[(c[g>>2]|0)+188>>2];c[u>>2]=0;while(1){if((c[u>>2]|0)>=16)break;e=gm((c[f>>2]|0)+(c[u>>2]<<2)|0)|0;c[t+(c[u>>2]<<2)>>2]=e;c[u>>2]=(c[u>>2]|0)+1}while(1){if((c[u>>2]|0)>=64)break;f=hm(c[t+((c[u>>2]|0)-2<<2)>>2]|0,17)|0;e=f^(hm(c[t+((c[u>>2]|0)-2<<2)>>2]|0,19)|0);f=(e^(c[t+((c[u>>2]|0)-2<<2)>>2]|0)>>>10)+(c[t+((c[u>>2]|0)-7<<2)>>2]|0)|0;e=hm(c[t+((c[u>>2]|0)-15<<2)>>2]|0,7)|0;b=e^(hm(c[t+((c[u>>2]|0)-15<<2)>>2]|0,18)|0);c[t+(c[u>>2]<<2)>>2]=f+(b^(c[t+((c[u>>2]|0)-15<<2)>>2]|0)>>>3)+(c[t+((c[u>>2]|0)-16<<2)>>2]|0);c[u>>2]=(c[u>>2]|0)+1}c[u>>2]=0;while(1){if((c[u>>2]|0)>=64)break;b=c[q>>2]|0;f=b+(im(c[n>>2]|0)|0)|0;b=f+(jm(c[n>>2]|0,c[o>>2]|0,c[p>>2]|0)|0)|0;c[r>>2]=b+(c[7920+(c[u>>2]<<2)>>2]|0)+(c[t+(c[u>>2]<<2)>>2]|0);b=km(c[h>>2]|0)|0;c[s>>2]=b+(lm(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0);c[k>>2]=(c[k>>2]|0)+(c[r>>2]|0);c[q>>2]=(c[r>>2]|0)+(c[s>>2]|0);b=c[p>>2]|0;f=b+(im(c[k>>2]|0)|0)|0;b=f+(jm(c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0)|0;c[r>>2]=b+(c[7920+((c[u>>2]|0)+1<<2)>>2]|0)+(c[t+((c[u>>2]|0)+1<<2)>>2]|0);b=km(c[q>>2]|0)|0;c[s>>2]=b+(lm(c[q>>2]|0,c[h>>2]|0,c[i>>2]|0)|0);c[j>>2]=(c[j>>2]|0)+(c[r>>2]|0);c[p>>2]=(c[r>>2]|0)+(c[s>>2]|0);b=c[o>>2]|0;f=b+(im(c[j>>2]|0)|0)|0;b=f+(jm(c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0)|0;c[r>>2]=b+(c[7920+((c[u>>2]|0)+2<<2)>>2]|0)+(c[t+((c[u>>2]|0)+2<<2)>>2]|0);b=km(c[p>>2]|0)|0;c[s>>2]=b+(lm(c[p>>2]|0,c[q>>2]|0,c[h>>2]|0)|0);c[i>>2]=(c[i>>2]|0)+(c[r>>2]|0);c[o>>2]=(c[r>>2]|0)+(c[s>>2]|0);b=c[n>>2]|0;f=b+(im(c[i>>2]|0)|0)|0;b=f+(jm(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0)|0)|0;c[r>>2]=b+(c[7920+((c[u>>2]|0)+3<<2)>>2]|0)+(c[t+((c[u>>2]|0)+3<<2)>>2]|0);b=km(c[o>>2]|0)|0;c[s>>2]=b+(lm(c[o>>2]|0,c[p>>2]|0,c[q>>2]|0)|0);c[h>>2]=(c[h>>2]|0)+(c[r>>2]|0);c[n>>2]=(c[r>>2]|0)+(c[s>>2]|0);b=c[k>>2]|0;f=b+(im(c[h>>2]|0)|0)|0;b=f+(jm(c[h>>2]|0,c[i>>2]|0,c[j>>2]|0)|0)|0;c[r>>2]=b+(c[7920+((c[u>>2]|0)+4<<2)>>2]|0)+(c[t+((c[u>>2]|0)+4<<2)>>2]|0);b=km(c[n>>2]|0)|0;c[s>>2]=b+(lm(c[n>>2]|0,c[o>>2]|0,c[p>>2]|0)|0);c[q>>2]=(c[q>>2]|0)+(c[r>>2]|0);c[k>>2]=(c[r>>2]|0)+(c[s>>2]|0);b=c[j>>2]|0;f=b+(im(c[q>>2]|0)|0)|0;b=f+(jm(c[q>>2]|0,c[h>>2]|0,c[i>>2]|0)|0)|0;c[r>>2]=b+(c[7920+((c[u>>2]|0)+5<<2)>>2]|0)+(c[t+((c[u>>2]|0)+5<<2)>>2]|0);b=km(c[k>>2]|0)|0;c[s>>2]=b+(lm(c[k>>2]|0,c[n>>2]|0,c[o>>2]|0)|0);c[p>>2]=(c[p>>2]|0)+(c[r>>2]|0);c[j>>2]=(c[r>>2]|0)+(c[s>>2]|0);b=c[i>>2]|0;f=b+(im(c[p>>2]|0)|0)|0;b=f+(jm(c[p>>2]|0,c[q>>2]|0,c[h>>2]|0)|0)|0;c[r>>2]=b+(c[7920+((c[u>>2]|0)+6<<2)>>2]|0)+(c[t+((c[u>>2]|0)+6<<2)>>2]|0);b=km(c[j>>2]|0)|0;c[s>>2]=b+(lm(c[j>>2]|0,c[k>>2]|0,c[n>>2]|0)|0);c[o>>2]=(c[o>>2]|0)+(c[r>>2]|0);c[i>>2]=(c[r>>2]|0)+(c[s>>2]|0);b=c[h>>2]|0;f=b+(im(c[o>>2]|0)|0)|0;b=f+(jm(c[o>>2]|0,c[p>>2]|0,c[q>>2]|0)|0)|0;c[r>>2]=b+(c[7920+((c[u>>2]|0)+7<<2)>>2]|0)+(c[t+((c[u>>2]|0)+7<<2)>>2]|0);b=km(c[i>>2]|0)|0;c[s>>2]=b+(lm(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0)|0);c[n>>2]=(c[n>>2]|0)+(c[r>>2]|0);c[h>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[u>>2]=(c[u>>2]|0)+8}u=(c[g>>2]|0)+160|0;c[u>>2]=(c[u>>2]|0)+(c[h>>2]|0);h=(c[g>>2]|0)+164|0;c[h>>2]=(c[h>>2]|0)+(c[i>>2]|0);i=(c[g>>2]|0)+168|0;c[i>>2]=(c[i>>2]|0)+(c[j>>2]|0);j=(c[g>>2]|0)+172|0;c[j>>2]=(c[j>>2]|0)+(c[k>>2]|0);k=(c[g>>2]|0)+176|0;c[k>>2]=(c[k>>2]|0)+(c[n>>2]|0);n=(c[g>>2]|0)+180|0;c[n>>2]=(c[n>>2]|0)+(c[o>>2]|0);o=(c[g>>2]|0)+184|0;c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);p=(c[g>>2]|0)+188|0;c[p>>2]=(c[p>>2]|0)+(c[q>>2]|0);l=d;return 328}function gm(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];l=b;return (d[c[f>>2]>>0]|0)<<24|(d[(c[f>>2]|0)+1>>0]|0)<<16|(d[(c[f>>2]|0)+2>>0]|0)<<8|(d[(c[f>>2]|0)+3>>0]|0)|0}function hm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;l=d;return (c[e>>2]|0)>>>(c[f>>2]&31)|c[e>>2]<<(32-(c[f>>2]|0)&31)|0}function im(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=hm(c[d>>2]|0,6)|0;e=a^(hm(c[d>>2]|0,11)|0);a=e^(hm(c[d>>2]|0,25)|0);l=b;return a|0}function jm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;l=e;return c[h>>2]^c[f>>2]&(c[g>>2]^c[h>>2])|0}function km(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=hm(c[d>>2]|0,2)|0;e=a^(hm(c[d>>2]|0,13)|0);a=e^(hm(c[d>>2]|0,22)|0);l=b;return a|0}function lm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;l=e;return c[f>>2]&c[g>>2]|c[h>>2]&(c[f>>2]|c[g>>2])|0}function mm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+12|0;f=d+4|0;c[e>>2]=a;c[d+8>>2]=b;c[f>>2]=c[e>>2];c[d>>2]=pg()|0;c[(c[f>>2]|0)+160>>2]=1779033703;c[(c[f>>2]|0)+164>>2]=-1150833019;c[(c[f>>2]|0)+168>>2]=1013904242;c[(c[f>>2]|0)+172>>2]=-1521486534;c[(c[f>>2]|0)+176>>2]=1359893119;c[(c[f>>2]|0)+180>>2]=-1694144372;c[(c[f>>2]|0)+184>>2]=528734635;c[(c[f>>2]|0)+188>>2]=1541459225;e=(c[f>>2]|0)+128|0;c[e>>2]=0;c[e+4>>2]=0;e=(c[f>>2]|0)+136|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[f>>2]|0)+144>>2]=0;c[(c[f>>2]|0)+148>>2]=64;c[(c[f>>2]|0)+152>>2]=33;l=d;return}function nm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+8|0;g=d+4|0;c[e>>2]=a;c[d+12>>2]=b;c[f>>2]=c[e>>2];c[g>>2]=(c[f>>2]|0)+160;c[d>>2]=pg()|0;e=c[g>>2]|0;c[e>>2]=-205731576;c[e+4>>2]=1779033703;e=(c[g>>2]|0)+8|0;c[e>>2]=-2067093701;c[e+4>>2]=-1150833019;e=(c[g>>2]|0)+16|0;c[e>>2]=-23791573;c[e+4>>2]=1013904242;e=(c[g>>2]|0)+24|0;c[e>>2]=1595750129;c[e+4>>2]=-1521486534;e=(c[g>>2]|0)+32|0;c[e>>2]=-1377402159;c[e+4>>2]=1359893119;e=(c[g>>2]|0)+40|0;c[e>>2]=725511199;c[e+4>>2]=-1694144372;e=(c[g>>2]|0)+48|0;c[e>>2]=-79577749;c[e+4>>2]=528734635;e=(c[g>>2]|0)+56|0;c[e>>2]=327033209;c[e+4>>2]=1541459225;e=(c[f>>2]|0)+128|0;c[e>>2]=0;c[e+4>>2]=0;e=(c[f>>2]|0)+136|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[f>>2]|0)+144>>2]=0;c[(c[f>>2]|0)+148>>2]=128;c[(c[f>>2]|0)+152>>2]=34;l=d;return}function om(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;d=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=d+44|0;f=d+40|0;g=d+36|0;h=d+24|0;i=d+16|0;j=d+8|0;k=d;n=d+32|0;c[e>>2]=b;c[f>>2]=c[e>>2];Nr(c[e>>2]|0,0,0);b=(c[f>>2]|0)+128|0;o=c[b+4>>2]|0;p=h;c[p>>2]=c[b>>2];c[p+4>>2]=o;o=(c[f>>2]|0)+136|0;p=c[o+4>>2]|0;b=i;c[b>>2]=c[o>>2];c[b+4>>2]=p;p=h;b=ix(c[p>>2]|0,c[p+4>>2]|0,7)|0;p=k;c[p>>2]=b;c[p+4>>2]=D;p=i;i=ix(c[p>>2]|0,c[p+4>>2]|0,7)|0;p=D;b=h;o=cx(c[b>>2]|0,c[b+4>>2]|0,57)|0;b=j;c[b>>2]=i|o;c[b+4>>2]=p|D;p=k;b=c[p+4>>2]|0;o=h;c[o>>2]=c[p>>2];c[o+4>>2]=b;b=c[(c[f>>2]|0)+144>>2]|0;o=k;p=Ww(c[o>>2]|0,c[o+4>>2]|0,b|0,((b|0)<0)<<31>>31|0)|0;b=D;o=k;c[o>>2]=p;c[o+4>>2]=b;o=h;i=c[o+4>>2]|0;if(b>>>0>>0|((b|0)==(i|0)?p>>>0<(c[o>>2]|0)>>>0:0)){o=j;p=Ww(c[o>>2]|0,c[o+4>>2]|0,1,0)|0;o=j;c[o>>2]=p;c[o+4>>2]=D}o=k;p=c[o+4>>2]|0;i=h;c[i>>2]=c[o>>2];c[i+4>>2]=p;p=k;i=ix(c[p>>2]|0,c[p+4>>2]|0,3)|0;p=k;c[p>>2]=i;c[p+4>>2]=D;p=j;i=ix(c[p>>2]|0,c[p+4>>2]|0,3)|0;p=j;c[p>>2]=i;c[p+4>>2]=D;p=h;h=cx(c[p>>2]|0,c[p+4>>2]|0,61)|0;p=j;i=c[p+4>>2]|D;o=j;c[o>>2]=c[p>>2]|h;c[o+4>>2]=i;i=(c[(c[f>>2]|0)+144>>2]|0)<112;o=(c[f>>2]|0)+144|0;h=c[o>>2]|0;c[o>>2]=h+1;a[(c[f>>2]|0)+h>>0]=-128;a:do if(i)while(1){if((c[(c[f>>2]|0)+144>>2]|0)>=112)break a;h=(c[f>>2]|0)+144|0;o=c[h>>2]|0;c[h>>2]=o+1;a[(c[f>>2]|0)+o>>0]=0}else{while(1){if((c[(c[f>>2]|0)+144>>2]|0)>=128)break;o=(c[f>>2]|0)+144|0;h=c[o>>2]|0;c[o>>2]=h+1;a[(c[f>>2]|0)+h>>0]=0}Nr(c[e>>2]|0,0,0);h=c[f>>2]|0;o=h+112|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(o|0))}while(0);e=j;tm((c[f>>2]|0)+112|0,c[e>>2]|0,c[e+4>>2]|0);e=k;tm((c[f>>2]|0)+120|0,c[e>>2]|0,c[e+4>>2]|0);c[g>>2]=um(c[f>>2]|0,c[f>>2]|0,1)|0;bf(c[g>>2]|0);cf();c[n>>2]=c[f>>2];g=(c[f>>2]|0)+160|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;g=(c[f>>2]|0)+160+8|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;g=(c[f>>2]|0)+160+16|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;g=(c[f>>2]|0)+160+24|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;g=(c[f>>2]|0)+160+32|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;g=(c[f>>2]|0)+160+40|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;g=(c[f>>2]|0)+160+48|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;g=(c[f>>2]|0)+160+56|0;tm(c[n>>2]|0,c[g>>2]|0,c[g+4>>2]|0);c[n>>2]=(c[n>>2]|0)+8;l=d;return}function pm(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[d>>2]=a;c[e>>2]=c[d>>2];l=b;return c[e>>2]|0}function qm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;switch(c[f>>2]|0){case 9:{c[i>>2]=rm(c[g>>2]|0,c[h>>2]|0)|0;break}case 10:{c[i>>2]=sm(c[g>>2]|0,c[h>>2]|0)|0;break}default:c[i>>2]=5}l=e;return c[i>>2]|0}function rm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=42861;c[i>>2]=Mr(9,0,42874,3,43221,48)|0;do if(!(c[i>>2]|0)){if(c[f>>2]|0){c[h>>2]=42943;c[i>>2]=Mr(9,0,42955,112,43270,48)|0;if(c[i>>2]|0)break;c[h>>2]=43133;c[i>>2]=Mr(9,1,0,0,43319,48)|0;if(c[i>>2]|0)break}c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}while(0);if(c[g>>2]|0)Eb[c[g>>2]&1](43214,9,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;j=c[e>>2]|0;l=d;return j|0}function sm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+12|0;g=d+8|0;h=d+4|0;i=d;c[f>>2]=a;c[g>>2]=b;c[h>>2]=42861;c[i>>2]=Mr(10,0,42874,3,42878,64)|0;do if(!(c[i>>2]|0)){if(c[f>>2]|0){c[h>>2]=42943;c[i>>2]=Mr(10,0,42955,112,43068,64)|0;if(c[i>>2]|0)break;c[h>>2]=43133;c[i>>2]=Mr(10,1,0,0,43149,64)|0;if(c[i>>2]|0)break}c[e>>2]=0;j=c[e>>2]|0;l=d;return j|0}while(0);if(c[g>>2]|0)Eb[c[g>>2]&1](43214,10,c[h>>2]|0,c[i>>2]|0);c[e>>2]=50;j=c[e>>2]|0;l=d;return j|0}function tm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f;i=f+8|0;c[g>>2]=b;b=h;c[b>>2]=d;c[b+4>>2]=e;c[i>>2]=c[g>>2];g=h;e=cx(c[g>>2]|0,c[g+4>>2]|0,56)|0;a[c[i>>2]>>0]=e;e=h;g=cx(c[e>>2]|0,c[e+4>>2]|0,48)|0;a[(c[i>>2]|0)+1>>0]=g;g=h;e=cx(c[g>>2]|0,c[g+4>>2]|0,40)|0;a[(c[i>>2]|0)+2>>0]=e;a[(c[i>>2]|0)+3>>0]=c[h+4>>2];e=h;g=cx(c[e>>2]|0,c[e+4>>2]|0,24)|0;a[(c[i>>2]|0)+4>>0]=g;g=h;e=cx(c[g>>2]|0,c[g+4>>2]|0,16)|0;a[(c[i>>2]|0)+5>>0]=e;e=h;g=cx(c[e>>2]|0,c[e+4>>2]|0,8)|0;a[(c[i>>2]|0)+6>>0]=g;a[(c[i>>2]|0)+7>>0]=c[h>>2];l=f;return}function um(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];do{c[j>>2]=(vm((c[i>>2]|0)+160|0,c[g>>2]|0)|0)+12;c[g>>2]=(c[g>>2]|0)+128;f=(c[h>>2]|0)+-1|0;c[h>>2]=f}while((f|0)!=0);l=e;return c[j>>2]|0}function vm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;d=l;l=l+240|0;if((l|0)>=(m|0))$(240);e=d+232|0;f=d+228|0;g=d+216|0;h=d+208|0;i=d+200|0;j=d+192|0;k=d+184|0;n=d+176|0;o=d+168|0;p=d+160|0;q=d+32|0;r=d+224|0;s=d+24|0;t=d+16|0;u=d+8|0;v=d;c[e>>2]=a;c[f>>2]=b;b=c[e>>2]|0;a=c[b+4>>2]|0;w=g;c[w>>2]=c[b>>2];c[w+4>>2]=a;a=(c[e>>2]|0)+8|0;w=c[a+4>>2]|0;b=h;c[b>>2]=c[a>>2];c[b+4>>2]=w;w=(c[e>>2]|0)+16|0;b=c[w+4>>2]|0;a=i;c[a>>2]=c[w>>2];c[a+4>>2]=b;b=(c[e>>2]|0)+24|0;a=c[b+4>>2]|0;w=j;c[w>>2]=c[b>>2];c[w+4>>2]=a;a=(c[e>>2]|0)+32|0;w=c[a+4>>2]|0;b=k;c[b>>2]=c[a>>2];c[b+4>>2]=w;w=(c[e>>2]|0)+40|0;b=c[w+4>>2]|0;a=n;c[a>>2]=c[w>>2];c[a+4>>2]=b;b=(c[e>>2]|0)+48|0;a=c[b+4>>2]|0;w=o;c[w>>2]=c[b>>2];c[w+4>>2]=a;a=(c[e>>2]|0)+56|0;w=c[a+4>>2]|0;b=p;c[b>>2]=c[a>>2];c[b+4>>2]=w;c[r>>2]=0;while(1){if((c[r>>2]|0)>=16)break;w=wm((c[f>>2]|0)+(c[r>>2]<<3)|0)|0;b=q+(c[r>>2]<<3)|0;c[b>>2]=w;c[b+4>>2]=D;c[r>>2]=(c[r>>2]|0)+1}c[r>>2]=0;while(1){if((c[r>>2]|0)>=64)break;f=p;b=c[f>>2]|0;w=c[f+4>>2]|0;f=k;a=xm(c[f>>2]|0,c[f+4>>2]|0)|0;f=Ww(b|0,w|0,a|0,D|0)|0;a=D;w=k;b=n;x=o;y=ym(c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=Ww(f|0,a|0,y|0,D|0)|0;y=72+(c[r>>2]<<3)|0;a=Ww(x|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=q;x=Ww(a|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=s;c[y>>2]=x;c[y+4>>2]=D;y=q+112|0;x=zm(c[y>>2]|0,c[y+4>>2]|0,19,0)|0;y=D;a=q+112|0;f=zm(c[a>>2]|0,c[a+4>>2]|0,61,0)|0;a=y^D;y=q+112|0;b=cx(c[y>>2]|0,c[y+4>>2]|0,6)|0;y=q+72|0;w=Ww(x^f^b|0,a^D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=D;a=q+8|0;b=zm(c[a>>2]|0,c[a+4>>2]|0,1,0)|0;a=D;f=q+8|0;x=zm(c[f>>2]|0,c[f+4>>2]|0,8,0)|0;f=a^D;a=q+8|0;z=cx(c[a>>2]|0,c[a+4>>2]|0,7)|0;a=Ww(w|0,y|0,b^x^z|0,f^D|0)|0;f=q;z=Ww(c[f>>2]|0,c[f+4>>2]|0,a|0,D|0)|0;a=q;c[a>>2]=z;c[a+4>>2]=D;a=g;z=Am(c[a>>2]|0,c[a+4>>2]|0)|0;a=D;f=g;x=h;b=i;y=Bm(c[f>>2]|0,c[f+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(z|0,a|0,y|0,D|0)|0;y=t;c[y>>2]=b;c[y+4>>2]=D;y=s;b=j;a=Ww(c[b>>2]|0,c[b+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=j;c[y>>2]=a;c[y+4>>2]=D;y=s;a=t;b=Ww(c[y>>2]|0,c[y+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=p;c[a>>2]=b;c[a+4>>2]=D;a=o;b=c[a>>2]|0;y=c[a+4>>2]|0;a=j;z=xm(c[a>>2]|0,c[a+4>>2]|0)|0;a=Ww(b|0,y|0,z|0,D|0)|0;z=D;y=j;b=k;x=n;f=ym(c[y>>2]|0,c[y+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=Ww(a|0,z|0,f|0,D|0)|0;f=72+((c[r>>2]|0)+1<<3)|0;z=Ww(x|0,D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=q+8|0;x=Ww(z|0,D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=s;c[f>>2]=x;c[f+4>>2]=D;f=q+120|0;x=zm(c[f>>2]|0,c[f+4>>2]|0,19,0)|0;f=D;z=q+120|0;a=zm(c[z>>2]|0,c[z+4>>2]|0,61,0)|0;z=f^D;f=q+120|0;b=cx(c[f>>2]|0,c[f+4>>2]|0,6)|0;f=q+80|0;y=Ww(x^a^b|0,z^D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=D;z=q+16|0;b=zm(c[z>>2]|0,c[z+4>>2]|0,1,0)|0;z=D;a=q+16|0;x=zm(c[a>>2]|0,c[a+4>>2]|0,8,0)|0;a=z^D;z=q+16|0;w=cx(c[z>>2]|0,c[z+4>>2]|0,7)|0;z=Ww(y|0,f|0,b^x^w|0,a^D|0)|0;a=q+8|0;w=a;x=Ww(c[w>>2]|0,c[w+4>>2]|0,z|0,D|0)|0;z=a;c[z>>2]=x;c[z+4>>2]=D;z=p;x=Am(c[z>>2]|0,c[z+4>>2]|0)|0;z=D;a=p;w=g;b=h;f=Bm(c[a>>2]|0,c[a+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(x|0,z|0,f|0,D|0)|0;f=t;c[f>>2]=b;c[f+4>>2]=D;f=s;b=i;z=Ww(c[b>>2]|0,c[b+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=i;c[f>>2]=z;c[f+4>>2]=D;f=s;z=t;b=Ww(c[f>>2]|0,c[f+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=o;c[z>>2]=b;c[z+4>>2]=D;z=n;b=c[z>>2]|0;f=c[z+4>>2]|0;z=i;x=xm(c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(b|0,f|0,x|0,D|0)|0;x=D;f=i;b=j;w=k;a=ym(c[f>>2]|0,c[f+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=Ww(z|0,x|0,a|0,D|0)|0;a=72+((c[r>>2]|0)+2<<3)|0;x=Ww(w|0,D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=q+16|0;w=Ww(x|0,D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=s;c[a>>2]=w;c[a+4>>2]=D;a=q;w=zm(c[a>>2]|0,c[a+4>>2]|0,19,0)|0;a=D;x=q;z=zm(c[x>>2]|0,c[x+4>>2]|0,61,0)|0;x=a^D;a=q;b=cx(c[a>>2]|0,c[a+4>>2]|0,6)|0;a=q+88|0;f=Ww(w^z^b|0,x^D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=D;x=q+24|0;b=zm(c[x>>2]|0,c[x+4>>2]|0,1,0)|0;x=D;z=q+24|0;w=zm(c[z>>2]|0,c[z+4>>2]|0,8,0)|0;z=x^D;x=q+24|0;y=cx(c[x>>2]|0,c[x+4>>2]|0,7)|0;x=Ww(f|0,a|0,b^w^y|0,z^D|0)|0;z=q+16|0;y=z;w=Ww(c[y>>2]|0,c[y+4>>2]|0,x|0,D|0)|0;x=z;c[x>>2]=w;c[x+4>>2]=D;x=o;w=Am(c[x>>2]|0,c[x+4>>2]|0)|0;x=D;z=o;y=p;b=g;a=Bm(c[z>>2]|0,c[z+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(w|0,x|0,a|0,D|0)|0;a=t;c[a>>2]=b;c[a+4>>2]=D;a=s;b=h;x=Ww(c[b>>2]|0,c[b+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=h;c[a>>2]=x;c[a+4>>2]=D;a=s;x=t;b=Ww(c[a>>2]|0,c[a+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=n;c[x>>2]=b;c[x+4>>2]=D;x=k;b=c[x>>2]|0;a=c[x+4>>2]|0;x=h;w=xm(c[x>>2]|0,c[x+4>>2]|0)|0;x=Ww(b|0,a|0,w|0,D|0)|0;w=D;a=h;b=i;y=j;z=ym(c[a>>2]|0,c[a+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(x|0,w|0,z|0,D|0)|0;z=72+((c[r>>2]|0)+3<<3)|0;w=Ww(y|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=q+24|0;y=Ww(w|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=s;c[z>>2]=y;c[z+4>>2]=D;z=q+8|0;y=zm(c[z>>2]|0,c[z+4>>2]|0,19,0)|0;z=D;w=q+8|0;x=zm(c[w>>2]|0,c[w+4>>2]|0,61,0)|0;w=z^D;z=q+8|0;b=cx(c[z>>2]|0,c[z+4>>2]|0,6)|0;z=q+96|0;a=Ww(y^x^b|0,w^D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=D;w=q+32|0;b=zm(c[w>>2]|0,c[w+4>>2]|0,1,0)|0;w=D;x=q+32|0;y=zm(c[x>>2]|0,c[x+4>>2]|0,8,0)|0;x=w^D;w=q+32|0;f=cx(c[w>>2]|0,c[w+4>>2]|0,7)|0;w=Ww(a|0,z|0,b^y^f|0,x^D|0)|0;x=q+24|0;f=x;y=Ww(c[f>>2]|0,c[f+4>>2]|0,w|0,D|0)|0;w=x;c[w>>2]=y;c[w+4>>2]=D;w=n;y=Am(c[w>>2]|0,c[w+4>>2]|0)|0;w=D;x=n;f=o;b=p;z=Bm(c[x>>2]|0,c[x+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(y|0,w|0,z|0,D|0)|0;z=t;c[z>>2]=b;c[z+4>>2]=D;z=s;b=g;w=Ww(c[b>>2]|0,c[b+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=g;c[z>>2]=w;c[z+4>>2]=D;z=s;w=t;b=Ww(c[z>>2]|0,c[z+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=k;c[w>>2]=b;c[w+4>>2]=D;w=j;b=c[w>>2]|0;z=c[w+4>>2]|0;w=g;y=xm(c[w>>2]|0,c[w+4>>2]|0)|0;w=Ww(b|0,z|0,y|0,D|0)|0;y=D;z=g;b=h;f=i;x=ym(c[z>>2]|0,c[z+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=Ww(w|0,y|0,x|0,D|0)|0;x=72+((c[r>>2]|0)+4<<3)|0;y=Ww(f|0,D|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=q+32|0;f=Ww(y|0,D|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=s;c[x>>2]=f;c[x+4>>2]=D;x=q+16|0;f=zm(c[x>>2]|0,c[x+4>>2]|0,19,0)|0;x=D;y=q+16|0;w=zm(c[y>>2]|0,c[y+4>>2]|0,61,0)|0;y=x^D;x=q+16|0;b=cx(c[x>>2]|0,c[x+4>>2]|0,6)|0;x=q+104|0;z=Ww(f^w^b|0,y^D|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=D;y=q+40|0;b=zm(c[y>>2]|0,c[y+4>>2]|0,1,0)|0;y=D;w=q+40|0;f=zm(c[w>>2]|0,c[w+4>>2]|0,8,0)|0;w=y^D;y=q+40|0;a=cx(c[y>>2]|0,c[y+4>>2]|0,7)|0;y=Ww(z|0,x|0,b^f^a|0,w^D|0)|0;w=q+32|0;a=w;f=Ww(c[a>>2]|0,c[a+4>>2]|0,y|0,D|0)|0;y=w;c[y>>2]=f;c[y+4>>2]=D;y=k;f=Am(c[y>>2]|0,c[y+4>>2]|0)|0;y=D;w=k;a=n;b=o;x=Bm(c[w>>2]|0,c[w+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(f|0,y|0,x|0,D|0)|0;x=t;c[x>>2]=b;c[x+4>>2]=D;x=s;b=p;y=Ww(c[b>>2]|0,c[b+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=p;c[x>>2]=y;c[x+4>>2]=D;x=s;y=t;b=Ww(c[x>>2]|0,c[x+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=j;c[y>>2]=b;c[y+4>>2]=D;y=i;b=c[y>>2]|0;x=c[y+4>>2]|0;y=p;f=xm(c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(b|0,x|0,f|0,D|0)|0;f=D;x=p;b=g;a=h;w=ym(c[x>>2]|0,c[x+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=Ww(y|0,f|0,w|0,D|0)|0;w=72+((c[r>>2]|0)+5<<3)|0;f=Ww(a|0,D|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=q+40|0;a=Ww(f|0,D|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=s;c[w>>2]=a;c[w+4>>2]=D;w=q+24|0;a=zm(c[w>>2]|0,c[w+4>>2]|0,19,0)|0;w=D;f=q+24|0;y=zm(c[f>>2]|0,c[f+4>>2]|0,61,0)|0;f=w^D;w=q+24|0;b=cx(c[w>>2]|0,c[w+4>>2]|0,6)|0;w=q+112|0;x=Ww(a^y^b|0,f^D|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=D;f=q+48|0;b=zm(c[f>>2]|0,c[f+4>>2]|0,1,0)|0;f=D;y=q+48|0;a=zm(c[y>>2]|0,c[y+4>>2]|0,8,0)|0;y=f^D;f=q+48|0;z=cx(c[f>>2]|0,c[f+4>>2]|0,7)|0;f=Ww(x|0,w|0,b^a^z|0,y^D|0)|0;y=q+40|0;z=y;a=Ww(c[z>>2]|0,c[z+4>>2]|0,f|0,D|0)|0;f=y;c[f>>2]=a;c[f+4>>2]=D;f=j;a=Am(c[f>>2]|0,c[f+4>>2]|0)|0;f=D;y=j;z=k;b=n;w=Bm(c[y>>2]|0,c[y+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(a|0,f|0,w|0,D|0)|0;w=t;c[w>>2]=b;c[w+4>>2]=D;w=s;b=o;f=Ww(c[b>>2]|0,c[b+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=o;c[w>>2]=f;c[w+4>>2]=D;w=s;f=t;b=Ww(c[w>>2]|0,c[w+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=i;c[f>>2]=b;c[f+4>>2]=D;f=h;b=c[f>>2]|0;w=c[f+4>>2]|0;f=o;a=xm(c[f>>2]|0,c[f+4>>2]|0)|0;f=Ww(b|0,w|0,a|0,D|0)|0;a=D;w=o;b=p;z=g;y=ym(c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(f|0,a|0,y|0,D|0)|0;y=72+((c[r>>2]|0)+6<<3)|0;a=Ww(z|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=q+48|0;z=Ww(a|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=s;c[y>>2]=z;c[y+4>>2]=D;y=q+32|0;z=zm(c[y>>2]|0,c[y+4>>2]|0,19,0)|0;y=D;a=q+32|0;f=zm(c[a>>2]|0,c[a+4>>2]|0,61,0)|0;a=y^D;y=q+32|0;b=cx(c[y>>2]|0,c[y+4>>2]|0,6)|0;y=q+120|0;w=Ww(z^f^b|0,a^D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=D;a=q+56|0;b=zm(c[a>>2]|0,c[a+4>>2]|0,1,0)|0;a=D;f=q+56|0;z=zm(c[f>>2]|0,c[f+4>>2]|0,8,0)|0;f=a^D;a=q+56|0;x=cx(c[a>>2]|0,c[a+4>>2]|0,7)|0;a=Ww(w|0,y|0,b^z^x|0,f^D|0)|0;f=q+48|0;x=f;z=Ww(c[x>>2]|0,c[x+4>>2]|0,a|0,D|0)|0;a=f;c[a>>2]=z;c[a+4>>2]=D;a=i;z=Am(c[a>>2]|0,c[a+4>>2]|0)|0;a=D;f=i;x=j;b=k;y=Bm(c[f>>2]|0,c[f+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(z|0,a|0,y|0,D|0)|0;y=t;c[y>>2]=b;c[y+4>>2]=D;y=s;b=n;a=Ww(c[b>>2]|0,c[b+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=n;c[y>>2]=a;c[y+4>>2]=D;y=s;a=t;b=Ww(c[y>>2]|0,c[y+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=h;c[a>>2]=b;c[a+4>>2]=D;a=g;b=c[a>>2]|0;y=c[a+4>>2]|0;a=n;z=xm(c[a>>2]|0,c[a+4>>2]|0)|0;a=Ww(b|0,y|0,z|0,D|0)|0;z=D;y=n;b=o;x=p;f=ym(c[y>>2]|0,c[y+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=Ww(a|0,z|0,f|0,D|0)|0;f=72+((c[r>>2]|0)+7<<3)|0;z=Ww(x|0,D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=q+56|0;x=Ww(z|0,D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=s;c[f>>2]=x;c[f+4>>2]=D;f=q+40|0;x=zm(c[f>>2]|0,c[f+4>>2]|0,19,0)|0;f=D;z=q+40|0;a=zm(c[z>>2]|0,c[z+4>>2]|0,61,0)|0;z=f^D;f=q+40|0;b=cx(c[f>>2]|0,c[f+4>>2]|0,6)|0;f=q;y=Ww(x^a^b|0,z^D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=D;z=q+64|0;b=zm(c[z>>2]|0,c[z+4>>2]|0,1,0)|0;z=D;a=q+64|0;x=zm(c[a>>2]|0,c[a+4>>2]|0,8,0)|0;a=z^D;z=q+64|0;w=cx(c[z>>2]|0,c[z+4>>2]|0,7)|0;z=Ww(y|0,f|0,b^x^w|0,a^D|0)|0;a=q+56|0;w=a;x=Ww(c[w>>2]|0,c[w+4>>2]|0,z|0,D|0)|0;z=a;c[z>>2]=x;c[z+4>>2]=D;z=h;x=Am(c[z>>2]|0,c[z+4>>2]|0)|0;z=D;a=h;w=i;b=j;f=Bm(c[a>>2]|0,c[a+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(x|0,z|0,f|0,D|0)|0;f=t;c[f>>2]=b;c[f+4>>2]=D;f=s;b=k;z=Ww(c[b>>2]|0,c[b+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=k;c[f>>2]=z;c[f+4>>2]=D;f=s;z=t;b=Ww(c[f>>2]|0,c[f+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=g;c[z>>2]=b;c[z+4>>2]=D;z=p;b=c[z>>2]|0;f=c[z+4>>2]|0;z=k;x=xm(c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(b|0,f|0,x|0,D|0)|0;x=D;f=k;b=n;w=o;a=ym(c[f>>2]|0,c[f+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=Ww(z|0,x|0,a|0,D|0)|0;a=72+((c[r>>2]|0)+8<<3)|0;x=Ww(w|0,D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=q+64|0;w=Ww(x|0,D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=s;c[a>>2]=w;c[a+4>>2]=D;a=q+48|0;w=zm(c[a>>2]|0,c[a+4>>2]|0,19,0)|0;a=D;x=q+48|0;z=zm(c[x>>2]|0,c[x+4>>2]|0,61,0)|0;x=a^D;a=q+48|0;b=cx(c[a>>2]|0,c[a+4>>2]|0,6)|0;a=q+8|0;f=Ww(w^z^b|0,x^D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=D;x=q+72|0;b=zm(c[x>>2]|0,c[x+4>>2]|0,1,0)|0;x=D;z=q+72|0;w=zm(c[z>>2]|0,c[z+4>>2]|0,8,0)|0;z=x^D;x=q+72|0;y=cx(c[x>>2]|0,c[x+4>>2]|0,7)|0;x=Ww(f|0,a|0,b^w^y|0,z^D|0)|0;z=q+64|0;y=z;w=Ww(c[y>>2]|0,c[y+4>>2]|0,x|0,D|0)|0;x=z;c[x>>2]=w;c[x+4>>2]=D;x=g;w=Am(c[x>>2]|0,c[x+4>>2]|0)|0;x=D;z=g;y=h;b=i;a=Bm(c[z>>2]|0,c[z+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(w|0,x|0,a|0,D|0)|0;a=t;c[a>>2]=b;c[a+4>>2]=D;a=s;b=j;x=Ww(c[b>>2]|0,c[b+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=j;c[a>>2]=x;c[a+4>>2]=D;a=s;x=t;b=Ww(c[a>>2]|0,c[a+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=p;c[x>>2]=b;c[x+4>>2]=D;x=o;b=c[x>>2]|0;a=c[x+4>>2]|0;x=j;w=xm(c[x>>2]|0,c[x+4>>2]|0)|0;x=Ww(b|0,a|0,w|0,D|0)|0;w=D;a=j;b=k;y=n;z=ym(c[a>>2]|0,c[a+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(x|0,w|0,z|0,D|0)|0;z=72+((c[r>>2]|0)+9<<3)|0;w=Ww(y|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=q+72|0;y=Ww(w|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=s;c[z>>2]=y;c[z+4>>2]=D;z=q+56|0;y=zm(c[z>>2]|0,c[z+4>>2]|0,19,0)|0;z=D;w=q+56|0;x=zm(c[w>>2]|0,c[w+4>>2]|0,61,0)|0;w=z^D;z=q+56|0;b=cx(c[z>>2]|0,c[z+4>>2]|0,6)|0;z=q+16|0;a=Ww(y^x^b|0,w^D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=D;w=q+80|0;b=zm(c[w>>2]|0,c[w+4>>2]|0,1,0)|0;w=D;x=q+80|0;y=zm(c[x>>2]|0,c[x+4>>2]|0,8,0)|0;x=w^D;w=q+80|0;f=cx(c[w>>2]|0,c[w+4>>2]|0,7)|0;w=Ww(a|0,z|0,b^y^f|0,x^D|0)|0;x=q+72|0;f=x;y=Ww(c[f>>2]|0,c[f+4>>2]|0,w|0,D|0)|0;w=x;c[w>>2]=y;c[w+4>>2]=D;w=p;y=Am(c[w>>2]|0,c[w+4>>2]|0)|0;w=D;x=p;f=g;b=h;z=Bm(c[x>>2]|0,c[x+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(y|0,w|0,z|0,D|0)|0;z=t;c[z>>2]=b;c[z+4>>2]=D;z=s;b=i;w=Ww(c[b>>2]|0,c[b+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=i;c[z>>2]=w;c[z+4>>2]=D;z=s;w=t;b=Ww(c[z>>2]|0,c[z+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=o;c[w>>2]=b;c[w+4>>2]=D;w=n;b=c[w>>2]|0;z=c[w+4>>2]|0;w=i;y=xm(c[w>>2]|0,c[w+4>>2]|0)|0;w=Ww(b|0,z|0,y|0,D|0)|0;y=D;z=i;b=j;f=k;x=ym(c[z>>2]|0,c[z+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=Ww(w|0,y|0,x|0,D|0)|0;x=72+((c[r>>2]|0)+10<<3)|0;y=Ww(f|0,D|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=q+80|0;f=Ww(y|0,D|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=s;c[x>>2]=f;c[x+4>>2]=D;x=q+64|0;f=zm(c[x>>2]|0,c[x+4>>2]|0,19,0)|0;x=D;y=q+64|0;w=zm(c[y>>2]|0,c[y+4>>2]|0,61,0)|0;y=x^D;x=q+64|0;b=cx(c[x>>2]|0,c[x+4>>2]|0,6)|0;x=q+24|0;z=Ww(f^w^b|0,y^D|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=D;y=q+88|0;b=zm(c[y>>2]|0,c[y+4>>2]|0,1,0)|0;y=D;w=q+88|0;f=zm(c[w>>2]|0,c[w+4>>2]|0,8,0)|0;w=y^D;y=q+88|0;a=cx(c[y>>2]|0,c[y+4>>2]|0,7)|0;y=Ww(z|0,x|0,b^f^a|0,w^D|0)|0;w=q+80|0;a=w;f=Ww(c[a>>2]|0,c[a+4>>2]|0,y|0,D|0)|0;y=w;c[y>>2]=f;c[y+4>>2]=D;y=o;f=Am(c[y>>2]|0,c[y+4>>2]|0)|0;y=D;w=o;a=p;b=g;x=Bm(c[w>>2]|0,c[w+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(f|0,y|0,x|0,D|0)|0;x=t;c[x>>2]=b;c[x+4>>2]=D;x=s;b=h;y=Ww(c[b>>2]|0,c[b+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=h;c[x>>2]=y;c[x+4>>2]=D;x=s;y=t;b=Ww(c[x>>2]|0,c[x+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=n;c[y>>2]=b;c[y+4>>2]=D;y=k;b=c[y>>2]|0;x=c[y+4>>2]|0;y=h;f=xm(c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(b|0,x|0,f|0,D|0)|0;f=D;x=h;b=i;a=j;w=ym(c[x>>2]|0,c[x+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=Ww(y|0,f|0,w|0,D|0)|0;w=72+((c[r>>2]|0)+11<<3)|0;f=Ww(a|0,D|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=q+88|0;a=Ww(f|0,D|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=s;c[w>>2]=a;c[w+4>>2]=D;w=q+72|0;a=zm(c[w>>2]|0,c[w+4>>2]|0,19,0)|0;w=D;f=q+72|0;y=zm(c[f>>2]|0,c[f+4>>2]|0,61,0)|0;f=w^D;w=q+72|0;b=cx(c[w>>2]|0,c[w+4>>2]|0,6)|0;w=q+32|0;x=Ww(a^y^b|0,f^D|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=D;f=q+96|0;b=zm(c[f>>2]|0,c[f+4>>2]|0,1,0)|0;f=D;y=q+96|0;a=zm(c[y>>2]|0,c[y+4>>2]|0,8,0)|0;y=f^D;f=q+96|0;z=cx(c[f>>2]|0,c[f+4>>2]|0,7)|0;f=Ww(x|0,w|0,b^a^z|0,y^D|0)|0;y=q+88|0;z=y;a=Ww(c[z>>2]|0,c[z+4>>2]|0,f|0,D|0)|0;f=y;c[f>>2]=a;c[f+4>>2]=D;f=n;a=Am(c[f>>2]|0,c[f+4>>2]|0)|0;f=D;y=n;z=o;b=p;w=Bm(c[y>>2]|0,c[y+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(a|0,f|0,w|0,D|0)|0;w=t;c[w>>2]=b;c[w+4>>2]=D;w=s;b=g;f=Ww(c[b>>2]|0,c[b+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=g;c[w>>2]=f;c[w+4>>2]=D;w=s;f=t;b=Ww(c[w>>2]|0,c[w+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=k;c[f>>2]=b;c[f+4>>2]=D;f=j;b=c[f>>2]|0;w=c[f+4>>2]|0;f=g;a=xm(c[f>>2]|0,c[f+4>>2]|0)|0;f=Ww(b|0,w|0,a|0,D|0)|0;a=D;w=g;b=h;z=i;y=ym(c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(f|0,a|0,y|0,D|0)|0;y=72+((c[r>>2]|0)+12<<3)|0;a=Ww(z|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=q+96|0;z=Ww(a|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=s;c[y>>2]=z;c[y+4>>2]=D;y=q+80|0;z=zm(c[y>>2]|0,c[y+4>>2]|0,19,0)|0;y=D;a=q+80|0;f=zm(c[a>>2]|0,c[a+4>>2]|0,61,0)|0;a=y^D;y=q+80|0;b=cx(c[y>>2]|0,c[y+4>>2]|0,6)|0;y=q+40|0;w=Ww(z^f^b|0,a^D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=D;a=q+104|0;b=zm(c[a>>2]|0,c[a+4>>2]|0,1,0)|0;a=D;f=q+104|0;z=zm(c[f>>2]|0,c[f+4>>2]|0,8,0)|0;f=a^D;a=q+104|0;x=cx(c[a>>2]|0,c[a+4>>2]|0,7)|0;a=Ww(w|0,y|0,b^z^x|0,f^D|0)|0;f=q+96|0;x=f;z=Ww(c[x>>2]|0,c[x+4>>2]|0,a|0,D|0)|0;a=f;c[a>>2]=z;c[a+4>>2]=D;a=k;z=Am(c[a>>2]|0,c[a+4>>2]|0)|0;a=D;f=k;x=n;b=o;y=Bm(c[f>>2]|0,c[f+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(z|0,a|0,y|0,D|0)|0;y=t;c[y>>2]=b;c[y+4>>2]=D;y=s;b=p;a=Ww(c[b>>2]|0,c[b+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=p;c[y>>2]=a;c[y+4>>2]=D;y=s;a=t;b=Ww(c[y>>2]|0,c[y+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=j;c[a>>2]=b;c[a+4>>2]=D;a=i;b=c[a>>2]|0;y=c[a+4>>2]|0;a=p;z=xm(c[a>>2]|0,c[a+4>>2]|0)|0;a=Ww(b|0,y|0,z|0,D|0)|0;z=D;y=p;b=g;x=h;f=ym(c[y>>2]|0,c[y+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=Ww(a|0,z|0,f|0,D|0)|0;f=72+((c[r>>2]|0)+13<<3)|0;z=Ww(x|0,D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=q+104|0;x=Ww(z|0,D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=s;c[f>>2]=x;c[f+4>>2]=D;f=q+88|0;x=zm(c[f>>2]|0,c[f+4>>2]|0,19,0)|0;f=D;z=q+88|0;a=zm(c[z>>2]|0,c[z+4>>2]|0,61,0)|0;z=f^D;f=q+88|0;b=cx(c[f>>2]|0,c[f+4>>2]|0,6)|0;f=q+48|0;y=Ww(x^a^b|0,z^D|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=D;z=q+112|0;b=zm(c[z>>2]|0,c[z+4>>2]|0,1,0)|0;z=D;a=q+112|0;x=zm(c[a>>2]|0,c[a+4>>2]|0,8,0)|0;a=z^D;z=q+112|0;w=cx(c[z>>2]|0,c[z+4>>2]|0,7)|0;z=Ww(y|0,f|0,b^x^w|0,a^D|0)|0;a=q+104|0;w=a;x=Ww(c[w>>2]|0,c[w+4>>2]|0,z|0,D|0)|0;z=a;c[z>>2]=x;c[z+4>>2]=D;z=j;x=Am(c[z>>2]|0,c[z+4>>2]|0)|0;z=D;a=j;w=k;b=n;f=Bm(c[a>>2]|0,c[a+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(x|0,z|0,f|0,D|0)|0;f=t;c[f>>2]=b;c[f+4>>2]=D;f=s;b=o;z=Ww(c[b>>2]|0,c[b+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0)|0;f=o;c[f>>2]=z;c[f+4>>2]=D;f=s;z=t;b=Ww(c[f>>2]|0,c[f+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=i;c[z>>2]=b;c[z+4>>2]=D;z=h;b=c[z>>2]|0;f=c[z+4>>2]|0;z=o;x=xm(c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(b|0,f|0,x|0,D|0)|0;x=D;f=o;b=p;w=g;a=ym(c[f>>2]|0,c[f+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=Ww(z|0,x|0,a|0,D|0)|0;a=72+((c[r>>2]|0)+14<<3)|0;x=Ww(w|0,D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=q+112|0;w=Ww(x|0,D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=s;c[a>>2]=w;c[a+4>>2]=D;a=q+96|0;w=zm(c[a>>2]|0,c[a+4>>2]|0,19,0)|0;a=D;x=q+96|0;z=zm(c[x>>2]|0,c[x+4>>2]|0,61,0)|0;x=a^D;a=q+96|0;b=cx(c[a>>2]|0,c[a+4>>2]|0,6)|0;a=q+56|0;f=Ww(w^z^b|0,x^D|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=D;x=q+120|0;b=zm(c[x>>2]|0,c[x+4>>2]|0,1,0)|0;x=D;z=q+120|0;w=zm(c[z>>2]|0,c[z+4>>2]|0,8,0)|0;z=x^D;x=q+120|0;y=cx(c[x>>2]|0,c[x+4>>2]|0,7)|0;x=Ww(f|0,a|0,b^w^y|0,z^D|0)|0;z=q+112|0;y=z;w=Ww(c[y>>2]|0,c[y+4>>2]|0,x|0,D|0)|0;x=z;c[x>>2]=w;c[x+4>>2]=D;x=i;w=Am(c[x>>2]|0,c[x+4>>2]|0)|0;x=D;z=i;y=j;b=k;a=Bm(c[z>>2]|0,c[z+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(w|0,x|0,a|0,D|0)|0;a=t;c[a>>2]=b;c[a+4>>2]=D;a=s;b=n;x=Ww(c[b>>2]|0,c[b+4>>2]|0,c[a>>2]|0,c[a+4>>2]|0)|0;a=n;c[a>>2]=x;c[a+4>>2]=D;a=s;x=t;b=Ww(c[a>>2]|0,c[a+4>>2]|0,c[x>>2]|0,c[x+4>>2]|0)|0;x=h;c[x>>2]=b;c[x+4>>2]=D;x=g;b=c[x>>2]|0;a=c[x+4>>2]|0;x=n;w=xm(c[x>>2]|0,c[x+4>>2]|0)|0;x=Ww(b|0,a|0,w|0,D|0)|0;w=D;a=n;b=o;y=p;z=ym(c[a>>2]|0,c[a+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(x|0,w|0,z|0,D|0)|0;z=72+((c[r>>2]|0)+15<<3)|0;w=Ww(y|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=q+120|0;y=Ww(w|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=s;c[z>>2]=y;c[z+4>>2]=D;z=q+104|0;y=zm(c[z>>2]|0,c[z+4>>2]|0,19,0)|0;z=D;w=q+104|0;x=zm(c[w>>2]|0,c[w+4>>2]|0,61,0)|0;w=z^D;z=q+104|0;b=cx(c[z>>2]|0,c[z+4>>2]|0,6)|0;z=q+64|0;a=Ww(y^x^b|0,w^D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=D;w=q;b=zm(c[w>>2]|0,c[w+4>>2]|0,1,0)|0;w=D;x=q;y=zm(c[x>>2]|0,c[x+4>>2]|0,8,0)|0;x=w^D;w=q;f=cx(c[w>>2]|0,c[w+4>>2]|0,7)|0;w=Ww(a|0,z|0,b^y^f|0,x^D|0)|0;x=q+120|0;f=x;y=Ww(c[f>>2]|0,c[f+4>>2]|0,w|0,D|0)|0;w=x;c[w>>2]=y;c[w+4>>2]=D;w=h;y=Am(c[w>>2]|0,c[w+4>>2]|0)|0;w=D;x=h;f=i;b=j;z=Bm(c[x>>2]|0,c[x+4>>2]|0,c[f>>2]|0,c[f+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(y|0,w|0,z|0,D|0)|0;z=t;c[z>>2]=b;c[z+4>>2]=D;z=s;b=k;w=Ww(c[b>>2]|0,c[b+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=k;c[z>>2]=w;c[z+4>>2]=D;z=s;w=t;b=Ww(c[z>>2]|0,c[z+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=g;c[w>>2]=b;c[w+4>>2]=D;c[r>>2]=(c[r>>2]|0)+16}while(1){if((c[r>>2]|0)>=80)break;t=p;s=c[t>>2]|0;w=c[t+4>>2]|0;t=k;b=xm(c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(s|0,w|0,b|0,D|0)|0;b=D;w=k;s=n;z=o;y=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(t|0,b|0,y|0,D|0)|0;y=72+(c[r>>2]<<3)|0;b=Ww(z|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=q;z=Ww(b|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=u;c[y>>2]=z;c[y+4>>2]=D;y=g;z=Am(c[y>>2]|0,c[y+4>>2]|0)|0;y=D;b=g;t=h;s=i;w=Bm(c[b>>2]|0,c[b+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(z|0,y|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=j;y=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=j;c[w>>2]=y;c[w+4>>2]=D;w=u;y=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=p;c[y>>2]=s;c[y+4>>2]=D;y=o;s=c[y>>2]|0;w=c[y+4>>2]|0;y=j;z=xm(c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(s|0,w|0,z|0,D|0)|0;z=D;w=j;s=k;t=n;b=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(y|0,z|0,b|0,D|0)|0;b=72+((c[r>>2]|0)+1<<3)|0;z=Ww(t|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=q+8|0;t=Ww(z|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=u;c[b>>2]=t;c[b+4>>2]=D;b=p;t=Am(c[b>>2]|0,c[b+4>>2]|0)|0;b=D;z=p;y=g;s=h;w=Bm(c[z>>2]|0,c[z+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(t|0,b|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=i;b=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=i;c[w>>2]=b;c[w+4>>2]=D;w=u;b=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=o;c[b>>2]=s;c[b+4>>2]=D;b=n;s=c[b>>2]|0;w=c[b+4>>2]|0;b=i;t=xm(c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(s|0,w|0,t|0,D|0)|0;t=D;w=i;s=j;y=k;z=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(b|0,t|0,z|0,D|0)|0;z=72+((c[r>>2]|0)+2<<3)|0;t=Ww(y|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=q+16|0;y=Ww(t|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=u;c[z>>2]=y;c[z+4>>2]=D;z=o;y=Am(c[z>>2]|0,c[z+4>>2]|0)|0;z=D;t=o;b=p;s=g;w=Bm(c[t>>2]|0,c[t+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(y|0,z|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=h;z=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=h;c[w>>2]=z;c[w+4>>2]=D;w=u;z=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=n;c[z>>2]=s;c[z+4>>2]=D;z=k;s=c[z>>2]|0;w=c[z+4>>2]|0;z=h;y=xm(c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(s|0,w|0,y|0,D|0)|0;y=D;w=h;s=i;b=j;t=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(z|0,y|0,t|0,D|0)|0;t=72+((c[r>>2]|0)+3<<3)|0;y=Ww(b|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=q+24|0;b=Ww(y|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=u;c[t>>2]=b;c[t+4>>2]=D;t=n;b=Am(c[t>>2]|0,c[t+4>>2]|0)|0;t=D;y=n;z=o;s=p;w=Bm(c[y>>2]|0,c[y+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(b|0,t|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=g;t=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=g;c[w>>2]=t;c[w+4>>2]=D;w=u;t=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=k;c[t>>2]=s;c[t+4>>2]=D;t=j;s=c[t>>2]|0;w=c[t+4>>2]|0;t=g;b=xm(c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(s|0,w|0,b|0,D|0)|0;b=D;w=g;s=h;z=i;y=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(t|0,b|0,y|0,D|0)|0;y=72+((c[r>>2]|0)+4<<3)|0;b=Ww(z|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=q+32|0;z=Ww(b|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=u;c[y>>2]=z;c[y+4>>2]=D;y=k;z=Am(c[y>>2]|0,c[y+4>>2]|0)|0;y=D;b=k;t=n;s=o;w=Bm(c[b>>2]|0,c[b+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(z|0,y|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=p;y=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=p;c[w>>2]=y;c[w+4>>2]=D;w=u;y=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=j;c[y>>2]=s;c[y+4>>2]=D;y=i;s=c[y>>2]|0;w=c[y+4>>2]|0;y=p;z=xm(c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(s|0,w|0,z|0,D|0)|0;z=D;w=p;s=g;t=h;b=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(y|0,z|0,b|0,D|0)|0;b=72+((c[r>>2]|0)+5<<3)|0;z=Ww(t|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=q+40|0;t=Ww(z|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=u;c[b>>2]=t;c[b+4>>2]=D;b=j;t=Am(c[b>>2]|0,c[b+4>>2]|0)|0;b=D;z=j;y=k;s=n;w=Bm(c[z>>2]|0,c[z+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(t|0,b|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=o;b=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=o;c[w>>2]=b;c[w+4>>2]=D;w=u;b=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=i;c[b>>2]=s;c[b+4>>2]=D;b=h;s=c[b>>2]|0;w=c[b+4>>2]|0;b=o;t=xm(c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(s|0,w|0,t|0,D|0)|0;t=D;w=o;s=p;y=g;z=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(b|0,t|0,z|0,D|0)|0;z=72+((c[r>>2]|0)+6<<3)|0;t=Ww(y|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=q+48|0;y=Ww(t|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=u;c[z>>2]=y;c[z+4>>2]=D;z=i;y=Am(c[z>>2]|0,c[z+4>>2]|0)|0;z=D;t=i;b=j;s=k;w=Bm(c[t>>2]|0,c[t+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(y|0,z|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=n;z=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=n;c[w>>2]=z;c[w+4>>2]=D;w=u;z=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=h;c[z>>2]=s;c[z+4>>2]=D;z=g;s=c[z>>2]|0;w=c[z+4>>2]|0;z=n;y=xm(c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(s|0,w|0,y|0,D|0)|0;y=D;w=n;s=o;b=p;t=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(z|0,y|0,t|0,D|0)|0;t=72+((c[r>>2]|0)+7<<3)|0;y=Ww(b|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=q+56|0;b=Ww(y|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=u;c[t>>2]=b;c[t+4>>2]=D;t=h;b=Am(c[t>>2]|0,c[t+4>>2]|0)|0;t=D;y=h;z=i;s=j;w=Bm(c[y>>2]|0,c[y+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(b|0,t|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=k;t=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=k;c[w>>2]=t;c[w+4>>2]=D;w=u;t=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=g;c[t>>2]=s;c[t+4>>2]=D;t=p;s=c[t>>2]|0;w=c[t+4>>2]|0;t=k;b=xm(c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(s|0,w|0,b|0,D|0)|0;b=D;w=k;s=n;z=o;y=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(t|0,b|0,y|0,D|0)|0;y=72+((c[r>>2]|0)+8<<3)|0;b=Ww(z|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=q+64|0;z=Ww(b|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=u;c[y>>2]=z;c[y+4>>2]=D;y=g;z=Am(c[y>>2]|0,c[y+4>>2]|0)|0;y=D;b=g;t=h;s=i;w=Bm(c[b>>2]|0,c[b+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(z|0,y|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=j;y=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=j;c[w>>2]=y;c[w+4>>2]=D;w=u;y=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=p;c[y>>2]=s;c[y+4>>2]=D;y=o;s=c[y>>2]|0;w=c[y+4>>2]|0;y=j;z=xm(c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(s|0,w|0,z|0,D|0)|0;z=D;w=j;s=k;t=n;b=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(y|0,z|0,b|0,D|0)|0;b=72+((c[r>>2]|0)+9<<3)|0;z=Ww(t|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=q+72|0;t=Ww(z|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=u;c[b>>2]=t;c[b+4>>2]=D;b=p;t=Am(c[b>>2]|0,c[b+4>>2]|0)|0;b=D;z=p;y=g;s=h;w=Bm(c[z>>2]|0,c[z+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(t|0,b|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=i;b=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=i;c[w>>2]=b;c[w+4>>2]=D;w=u;b=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=o;c[b>>2]=s;c[b+4>>2]=D;b=n;s=c[b>>2]|0;w=c[b+4>>2]|0;b=i;t=xm(c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(s|0,w|0,t|0,D|0)|0;t=D;w=i;s=j;y=k;z=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(b|0,t|0,z|0,D|0)|0;z=72+((c[r>>2]|0)+10<<3)|0;t=Ww(y|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=q+80|0;y=Ww(t|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=u;c[z>>2]=y;c[z+4>>2]=D;z=o;y=Am(c[z>>2]|0,c[z+4>>2]|0)|0;z=D;t=o;b=p;s=g;w=Bm(c[t>>2]|0,c[t+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(y|0,z|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=h;z=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=h;c[w>>2]=z;c[w+4>>2]=D;w=u;z=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=n;c[z>>2]=s;c[z+4>>2]=D;z=k;s=c[z>>2]|0;w=c[z+4>>2]|0;z=h;y=xm(c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(s|0,w|0,y|0,D|0)|0;y=D;w=h;s=i;b=j;t=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(z|0,y|0,t|0,D|0)|0;t=72+((c[r>>2]|0)+11<<3)|0;y=Ww(b|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=q+88|0;b=Ww(y|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=u;c[t>>2]=b;c[t+4>>2]=D;t=n;b=Am(c[t>>2]|0,c[t+4>>2]|0)|0;t=D;y=n;z=o;s=p;w=Bm(c[y>>2]|0,c[y+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(b|0,t|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=g;t=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=g;c[w>>2]=t;c[w+4>>2]=D;w=u;t=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=k;c[t>>2]=s;c[t+4>>2]=D;t=j;s=c[t>>2]|0;w=c[t+4>>2]|0;t=g;b=xm(c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(s|0,w|0,b|0,D|0)|0;b=D;w=g;s=h;z=i;y=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(t|0,b|0,y|0,D|0)|0;y=72+((c[r>>2]|0)+12<<3)|0;b=Ww(z|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=q+96|0;z=Ww(b|0,D|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=u;c[y>>2]=z;c[y+4>>2]=D;y=k;z=Am(c[y>>2]|0,c[y+4>>2]|0)|0;y=D;b=k;t=n;s=o;w=Bm(c[b>>2]|0,c[b+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(z|0,y|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=p;y=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=p;c[w>>2]=y;c[w+4>>2]=D;w=u;y=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=j;c[y>>2]=s;c[y+4>>2]=D;y=i;s=c[y>>2]|0;w=c[y+4>>2]|0;y=p;z=xm(c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(s|0,w|0,z|0,D|0)|0;z=D;w=p;s=g;t=h;b=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=Ww(y|0,z|0,b|0,D|0)|0;b=72+((c[r>>2]|0)+13<<3)|0;z=Ww(t|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=q+104|0;t=Ww(z|0,D|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=u;c[b>>2]=t;c[b+4>>2]=D;b=j;t=Am(c[b>>2]|0,c[b+4>>2]|0)|0;b=D;z=j;y=k;s=n;w=Bm(c[z>>2]|0,c[z+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(t|0,b|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=o;b=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=o;c[w>>2]=b;c[w+4>>2]=D;w=u;b=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=i;c[b>>2]=s;c[b+4>>2]=D;b=h;s=c[b>>2]|0;w=c[b+4>>2]|0;b=o;t=xm(c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(s|0,w|0,t|0,D|0)|0;t=D;w=o;s=p;y=g;z=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[y>>2]|0,c[y+4>>2]|0)|0;y=Ww(b|0,t|0,z|0,D|0)|0;z=72+((c[r>>2]|0)+14<<3)|0;t=Ww(y|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=q+112|0;y=Ww(t|0,D|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=u;c[z>>2]=y;c[z+4>>2]=D;z=i;y=Am(c[z>>2]|0,c[z+4>>2]|0)|0;z=D;t=i;b=j;s=k;w=Bm(c[t>>2]|0,c[t+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(y|0,z|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=n;z=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=n;c[w>>2]=z;c[w+4>>2]=D;w=u;z=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0)|0;z=h;c[z>>2]=s;c[z+4>>2]=D;z=g;s=c[z>>2]|0;w=c[z+4>>2]|0;z=n;y=xm(c[z>>2]|0,c[z+4>>2]|0)|0;z=Ww(s|0,w|0,y|0,D|0)|0;y=D;w=n;s=o;b=p;t=ym(c[w>>2]|0,c[w+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0,c[b>>2]|0,c[b+4>>2]|0)|0;b=Ww(z|0,y|0,t|0,D|0)|0;t=72+((c[r>>2]|0)+15<<3)|0;y=Ww(b|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=q+120|0;b=Ww(y|0,D|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=u;c[t>>2]=b;c[t+4>>2]=D;t=h;b=Am(c[t>>2]|0,c[t+4>>2]|0)|0;t=D;y=h;z=i;s=j;w=Bm(c[y>>2]|0,c[y+4>>2]|0,c[z>>2]|0,c[z+4>>2]|0,c[s>>2]|0,c[s+4>>2]|0)|0;s=Ww(b|0,t|0,w|0,D|0)|0;w=v;c[w>>2]=s;c[w+4>>2]=D;w=u;s=k;t=Ww(c[s>>2]|0,c[s+4>>2]|0,c[w>>2]|0,c[w+4>>2]|0)|0;w=k;c[w>>2]=t;c[w+4>>2]=D;w=u;t=v;s=Ww(c[w>>2]|0,c[w+4>>2]|0,c[t>>2]|0,c[t+4>>2]|0)|0;t=g;c[t>>2]=s;c[t+4>>2]=D;c[r>>2]=(c[r>>2]|0)+16}r=g;g=c[e>>2]|0;v=g;u=Ww(c[v>>2]|0,c[v+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=g;c[r>>2]=u;c[r+4>>2]=D;r=h;h=(c[e>>2]|0)+8|0;u=h;g=Ww(c[u>>2]|0,c[u+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=h;c[r>>2]=g;c[r+4>>2]=D;r=i;i=(c[e>>2]|0)+16|0;g=i;h=Ww(c[g>>2]|0,c[g+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=i;c[r>>2]=h;c[r+4>>2]=D;r=j;j=(c[e>>2]|0)+24|0;h=j;i=Ww(c[h>>2]|0,c[h+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=j;c[r>>2]=i;c[r+4>>2]=D;r=k;k=(c[e>>2]|0)+32|0;i=k;j=Ww(c[i>>2]|0,c[i+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=k;c[r>>2]=j;c[r+4>>2]=D;r=n;n=(c[e>>2]|0)+40|0;j=n;k=Ww(c[j>>2]|0,c[j+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=n;c[r>>2]=k;c[r+4>>2]=D;r=o;o=(c[e>>2]|0)+48|0;k=o;n=Ww(c[k>>2]|0,c[k+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=o;c[r>>2]=n;c[r+4>>2]=D;r=p;p=(c[e>>2]|0)+56|0;e=p;n=Ww(c[e>>2]|0,c[e+4>>2]|0,c[r>>2]|0,c[r+4>>2]|0)|0;r=p;c[r>>2]=n;c[r+4>>2]=D;l=d;return 208}function wm(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];e=ix(d[c[f>>2]>>0]|0|0,0,56)|0;a=D;g=ix(d[(c[f>>2]|0)+1>>0]|0|0,0,48)|0;h=a|D;a=ix(d[(c[f>>2]|0)+2>>0]|0|0,0,40)|0;i=h|D|(d[(c[f>>2]|0)+3>>0]|0);h=ix(d[(c[f>>2]|0)+4>>0]|0|0,0,24)|0;j=i|D;i=ix(d[(c[f>>2]|0)+5>>0]|0|0,0,16)|0;k=j|D;j=ix(d[(c[f>>2]|0)+6>>0]|0|0,0,8)|0;D=k|D;l=b;return e|g|a|h|i|j|(d[(c[f>>2]|0)+7>>0]|0)|0}function xm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;f=e;c[f>>2]=a;c[f+4>>2]=b;b=e;f=zm(c[b>>2]|0,c[b+4>>2]|0,14,0)|0;b=D;a=e;g=zm(c[a>>2]|0,c[a+4>>2]|0,18,0)|0;a=b^D;b=e;e=zm(c[b>>2]|0,c[b+4>>2]|0,41,0)|0;D=a^D;l=d;return f^g^e|0}function ym(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+16|0;j=h+8|0;k=h;n=i;c[n>>2]=a;c[n+4>>2]=b;b=j;c[b>>2]=d;c[b+4>>2]=e;e=k;c[e>>2]=f;c[e+4>>2]=g;g=i;e=j;j=i;i=k;D=c[g+4>>2]&c[e+4>>2]^~c[j+4>>2]&c[i+4>>2];l=h;return c[g>>2]&c[e>>2]^~c[j>>2]&c[i>>2]|0}function zm(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+8|0;h=f;i=g;c[i>>2]=a;c[i+4>>2]=b;b=h;c[b>>2]=d;c[b+4>>2]=e;e=g;b=cx(c[e>>2]|0,c[e+4>>2]|0,c[h>>2]|0)|0;e=D;d=g;g=c[d>>2]|0;i=c[d+4>>2]|0;d=h;h=Tw(64,0,c[d>>2]|0,c[d+4>>2]|0)|0;d=ix(g|0,i|0,h|0)|0;D=e|D;l=f;return b|d|0}function Am(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;f=e;c[f>>2]=a;c[f+4>>2]=b;b=e;f=zm(c[b>>2]|0,c[b+4>>2]|0,28,0)|0;b=D;a=e;g=zm(c[a>>2]|0,c[a+4>>2]|0,34,0)|0;a=b^D;b=e;e=zm(c[b>>2]|0,c[b+4>>2]|0,39,0)|0;D=a^D;l=d;return f^g^e|0}function Bm(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+16|0;j=h+8|0;k=h;n=i;c[n>>2]=a;c[n+4>>2]=b;b=j;c[b>>2]=d;c[b+4>>2]=e;e=k;c[e>>2]=f;c[e+4>>2]=g;g=i;e=j;f=i;i=k;b=j;j=k;D=c[g+4>>2]&c[e+4>>2]^c[f+4>>2]&c[i+4>>2]^c[b+4>>2]&c[j+4>>2];l=h;return c[g>>2]&c[e>>2]^c[f>>2]&c[i>>2]^c[b>>2]&c[j>>2]|0}function Cm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d+16|0;f=d+8|0;g=d+4|0;c[e>>2]=a;c[d+12>>2]=b;c[f>>2]=c[e>>2];c[g>>2]=(c[f>>2]|0)+160;c[d>>2]=pg()|0;e=c[g>>2]|0;c[e>>2]=-1056596264;c[e+4>>2]=-876896931;e=(c[g>>2]|0)+8|0;c[e>>2]=914150663;c[e+4>>2]=1654270250;e=(c[g>>2]|0)+16|0;c[e>>2]=812702999;c[e+4>>2]=-1856437926;e=(c[g>>2]|0)+24|0;c[e>>2]=-150054599;c[e+4>>2]=355462360;e=(c[g>>2]|0)+32|0;c[e>>2]=-4191439;c[e+4>>2]=1731405415;e=(c[g>>2]|0)+40|0;c[e>>2]=1750603025;c[e+4>>2]=-1900787065;e=(c[g>>2]|0)+48|0;c[e>>2]=1694076839;c[e+4>>2]=-619958771;e=(c[g>>2]|0)+56|0;c[e>>2]=-1090891868;c[e+4>>2]=1203062813;e=(c[f>>2]|0)+128|0;c[e>>2]=0;c[e+4>>2]=0;e=(c[f>>2]|0)+136|0;c[e>>2]=0;c[e+4>>2]=0;c[(c[f>>2]|0)+144>>2]=0;c[(c[f>>2]|0)+148>>2]=128;c[(c[f>>2]|0)+152>>2]=34;l=d;return}function Dm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e+16|0;g=e+12|0;h=e+8|0;i=e+4|0;j=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];c[j>>2]=Km(c[i>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;bf(47);cf();l=e;return c[j>>2]|0}function Em(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];Jm(c[i>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return 36}function Fm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=c[f>>2];Gm(c[i>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return 36}function Gm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+32|0;g=e+28|0;h=e+24|0;i=e+20|0;j=e+16|0;k=e+12|0;n=e+8|0;o=e+4|0;p=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[k>>2]=Hm(c[h>>2]|0)|0;c[k>>2]=c[k>>2]^c[(c[f>>2]|0)+4096+16>>2];c[n>>2]=Hm((c[h>>2]|0)+4|0)|0;c[n>>2]=c[n>>2]^c[(c[f>>2]|0)+4096+20>>2];c[i>>2]=Hm((c[h>>2]|0)+8|0)|0;c[i>>2]=c[i>>2]^c[(c[f>>2]|0)+4096+24>>2];c[j>>2]=Hm((c[h>>2]|0)+12|0)|0;c[j>>2]=c[j>>2]^c[(c[f>>2]|0)+4096+28>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+124>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+120>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+116>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+112>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+108>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+104>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+100>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+96>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+92>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+88>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+84>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+80>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+76>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+72>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+68>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+64>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+60>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+56>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+52>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+48>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+44>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+40>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+36>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+32>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+28>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+24>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+20>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+16>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[j>>2]=c[j>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+12>>2]|0);c[j>>2]=((c[j>>2]|0)>>>1)+(c[j>>2]<<31);c[i>>2]=(c[i>>2]<<1)+((c[i>>2]|0)>>>31);c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+8>>2]|0);c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+(c[o>>2]|0);c[n>>2]=c[n>>2]^(c[p>>2]|0)+(c[(c[f>>2]|0)+4128+4>>2]|0);c[n>>2]=((c[n>>2]|0)>>>1)+(c[n>>2]<<31);c[k>>2]=(c[k>>2]<<1)+((c[k>>2]|0)>>>31);c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128>>2]|0);c[i>>2]=c[i>>2]^c[(c[f>>2]|0)+4096>>2];Im(c[g>>2]|0,c[i>>2]|0);c[j>>2]=c[j>>2]^c[(c[f>>2]|0)+4096+4>>2];Im((c[g>>2]|0)+4|0,c[j>>2]|0);c[k>>2]=c[k>>2]^c[(c[f>>2]|0)+4096+8>>2];Im((c[g>>2]|0)+8|0,c[k>>2]|0);c[n>>2]=c[n>>2]^c[(c[f>>2]|0)+4096+12>>2];Im((c[g>>2]|0)+12|0,c[n>>2]|0);l=e;return}function Hm(a){a=a|0;var b=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=b+4|0;f=b;c[e>>2]=a;c[f>>2]=c[e>>2];l=b;return (d[(c[f>>2]|0)+3>>0]|0)<<24|(d[(c[f>>2]|0)+2>>0]|0)<<16|(d[(c[f>>2]|0)+1>>0]|0)<<8|(d[c[f>>2]>>0]|0)|0}function Im(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[f>>2];a[(c[h>>2]|0)+3>>0]=(c[g>>2]|0)>>>24;a[(c[h>>2]|0)+2>>0]=(c[g>>2]|0)>>>16;a[(c[h>>2]|0)+1>>0]=(c[g>>2]|0)>>>8;a[c[h>>2]>>0]=c[g>>2];l=e;return}function Jm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+32|0;g=e+28|0;h=e+24|0;i=e+20|0;j=e+16|0;k=e+12|0;n=e+8|0;o=e+4|0;p=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=Hm(c[h>>2]|0)|0;c[i>>2]=c[i>>2]^c[(c[f>>2]|0)+4096>>2];c[j>>2]=Hm((c[h>>2]|0)+4|0)|0;c[j>>2]=c[j>>2]^c[(c[f>>2]|0)+4096+4>>2];c[k>>2]=Hm((c[h>>2]|0)+8|0)|0;c[k>>2]=c[k>>2]^c[(c[f>>2]|0)+4096+8>>2];c[n>>2]=Hm((c[h>>2]|0)+12|0)|0;c[n>>2]=c[n>>2]^c[(c[f>>2]|0)+4096+12>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+4>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+12>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+8>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+20>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+16>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+28>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+24>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+36>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+32>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+44>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+40>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+52>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+48>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+60>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+56>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+68>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+64>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+76>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+72>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+84>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+80>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+92>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+88>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+100>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+96>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+108>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+104>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[i>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[i>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[i>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[i>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[j>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[j>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[j>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[j>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+116>>2]|0));c[k>>2]=c[k>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+112>>2]|0);c[k>>2]=((c[k>>2]|0)>>>1)+(c[k>>2]<<31);c[n>>2]=(c[n>>2]<<1)+((c[n>>2]|0)>>>31)^c[p>>2];c[o>>2]=c[(c[f>>2]|0)+((c[k>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+1024+(((c[k>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[k>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+3072+((c[k>>2]|0)>>>24<<2)>>2];c[p>>2]=c[(c[f>>2]|0)+1024+((c[n>>2]&255)<<2)>>2]^c[(c[f>>2]|0)+2048+(((c[n>>2]|0)>>>8&255)<<2)>>2]^c[(c[f>>2]|0)+3072+(((c[n>>2]|0)>>>16&255)<<2)>>2]^c[(c[f>>2]|0)+((c[n>>2]|0)>>>24<<2)>>2];c[o>>2]=(c[o>>2]|0)+(c[p>>2]|0);c[p>>2]=(c[p>>2]|0)+((c[o>>2]|0)+(c[(c[f>>2]|0)+4128+124>>2]|0));c[i>>2]=c[i>>2]^(c[o>>2]|0)+(c[(c[f>>2]|0)+4128+120>>2]|0);c[i>>2]=((c[i>>2]|0)>>>1)+(c[i>>2]<<31);c[j>>2]=(c[j>>2]<<1)+((c[j>>2]|0)>>>31)^c[p>>2];c[k>>2]=c[k>>2]^c[(c[f>>2]|0)+4096+16>>2];Im(c[g>>2]|0,c[k>>2]|0);c[n>>2]=c[n>>2]^c[(c[f>>2]|0)+4096+20>>2];Im((c[g>>2]|0)+4|0,c[n>>2]|0);c[i>>2]=c[i>>2]^c[(c[f>>2]|0)+4096+24>>2];Im((c[g>>2]|0)+8|0,c[i>>2]|0);c[j>>2]=c[j>>2]^c[(c[f>>2]|0)+4096+28>>2];Im((c[g>>2]|0)+12|0,c[j>>2]|0);l=e;return} -function Km(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0;g=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=g;i=g+36|0;j=g+32|0;k=g+28|0;n=g+24|0;o=g+20|0;p=g+16|0;q=g+12|0;r=g+8|0;s=g+4|0;t=g+56|0;u=g+55|0;v=g+54|0;w=g+53|0;x=g+52|0;y=g+51|0;z=g+50|0;A=g+49|0;B=g+48|0;C=g+47|0;D=g+46|0;E=g+45|0;F=g+44|0;G=g+43|0;H=g+42|0;I=g+41|0;J=g+40|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;a[t>>0]=0;a[u>>0]=0;a[v>>0]=0;a[w>>0]=0;a[x>>0]=0;a[y>>0]=0;a[z>>0]=0;a[A>>0]=0;a[B>>0]=0;a[C>>0]=0;a[D>>0]=0;a[E>>0]=0;a[F>>0]=0;a[G>>0]=0;a[H>>0]=0;a[I>>0]=0;if(((c[n>>2]|0)-16|16|0)!=16){c[i>>2]=44;K=c[i>>2]|0;l=g;return K|0}if((c[17740]|0)==0?(c[17740]=1,c[17741]=Lm()|0,c[17741]|0):0){c[h>>2]=c[17741];Ve(43492,h)}if(c[17741]|0){c[i>>2]=50;K=c[i>>2]|0;l=g;return K|0}if(a[c[k>>2]>>0]|0){a[J>>0]=a[43496+((d[c[k>>2]>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+0)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+1)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+45)>>0]}if(a[(c[k>>2]|0)+1>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+1>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+164)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+68)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+138)>>0]}if(a[(c[k>>2]|0)+2>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+2>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+138)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+213)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+191)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+209)>>0]}if(a[(c[k>>2]|0)+3>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+3>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+209)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+127)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+61)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+153)>>0]}if(a[(c[k>>2]|0)+4>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+4>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+153)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+70)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+102)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+150)>>0]}if(a[(c[k>>2]|0)+5>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+5>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+150)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+60)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+91)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+237)>>0]}if(a[(c[k>>2]|0)+6>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+6>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+237)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+55)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+79)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+224)>>0]}if(a[(c[k>>2]|0)+7>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+7>>0]|0)-1)>>0]|0;a[t>>0]=d[t>>0]^d[43751+((d[J>>0]|0)+224)>>0];a[u>>0]=d[u>>0]^d[43751+((d[J>>0]|0)+208)>>0];a[v>>0]=d[v>>0]^d[43751+((d[J>>0]|0)+140)>>0];a[w>>0]=d[w>>0]^d[43751+((d[J>>0]|0)+23)>>0]}if(a[(c[k>>2]|0)+8>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+8>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+0)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+1)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+45)>>0]}if(a[(c[k>>2]|0)+9>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+9>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+164)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+68)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+138)>>0]}if(a[(c[k>>2]|0)+10>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+10>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+138)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+213)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+191)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+209)>>0]}if(a[(c[k>>2]|0)+11>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+11>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+209)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+127)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+61)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+153)>>0]}if(a[(c[k>>2]|0)+12>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+12>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+153)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+70)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+102)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+150)>>0]}if(a[(c[k>>2]|0)+13>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+13>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+150)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+60)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+91)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+237)>>0]}if(a[(c[k>>2]|0)+14>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+14>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+237)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+55)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+79)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+224)>>0]}if(a[(c[k>>2]|0)+15>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+15>>0]|0)-1)>>0]|0;a[x>>0]=d[x>>0]^d[43751+((d[J>>0]|0)+224)>>0];a[y>>0]=d[y>>0]^d[43751+((d[J>>0]|0)+208)>>0];a[z>>0]=d[z>>0]^d[43751+((d[J>>0]|0)+140)>>0];a[A>>0]=d[A>>0]^d[43751+((d[J>>0]|0)+23)>>0]}if((c[n>>2]|0)==32){if(a[(c[k>>2]|0)+16>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+16>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+0)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+1)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+45)>>0]}if(a[(c[k>>2]|0)+17>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+17>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+164)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+68)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+138)>>0]}if(a[(c[k>>2]|0)+18>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+18>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+138)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+213)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+191)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+209)>>0]}if(a[(c[k>>2]|0)+19>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+19>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+209)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+127)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+61)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+153)>>0]}if(a[(c[k>>2]|0)+20>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+20>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+153)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+70)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+102)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+150)>>0]}if(a[(c[k>>2]|0)+21>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+21>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+150)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+60)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+91)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+237)>>0]}if(a[(c[k>>2]|0)+22>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+22>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+237)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+55)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+79)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+224)>>0]}if(a[(c[k>>2]|0)+23>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+23>>0]|0)-1)>>0]|0;a[B>>0]=d[B>>0]^d[43751+((d[J>>0]|0)+224)>>0];a[C>>0]=d[C>>0]^d[43751+((d[J>>0]|0)+208)>>0];a[D>>0]=d[D>>0]^d[43751+((d[J>>0]|0)+140)>>0];a[E>>0]=d[E>>0]^d[43751+((d[J>>0]|0)+23)>>0]}if(a[(c[k>>2]|0)+24>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+24>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+0)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+1)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+45)>>0]}if(a[(c[k>>2]|0)+25>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+25>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+45)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+164)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+68)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+138)>>0]}if(a[(c[k>>2]|0)+26>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+26>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+138)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+213)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+191)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+209)>>0]}if(a[(c[k>>2]|0)+27>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+27>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+209)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+127)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+61)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+153)>>0]}if(a[(c[k>>2]|0)+28>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+28>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+153)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+70)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+102)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+150)>>0]}if(a[(c[k>>2]|0)+29>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+29>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+150)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+60)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+91)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+237)>>0]}if(a[(c[k>>2]|0)+30>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+30>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+237)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+55)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+79)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+224)>>0]}if(a[(c[k>>2]|0)+31>>0]|0){a[J>>0]=a[43496+((d[(c[k>>2]|0)+31>>0]|0)-1)>>0]|0;a[F>>0]=d[F>>0]^d[43751+((d[J>>0]|0)+224)>>0];a[G>>0]=d[G>>0]^d[43751+((d[J>>0]|0)+208)>>0];a[H>>0]=d[H>>0]^d[43751+((d[J>>0]|0)+140)>>0];a[I>>0]=d[I>>0]^d[43751+((d[J>>0]|0)+23)>>0]}c[p>>2]=0;c[o>>2]=0;c[q>>2]=1;while(1){if((c[o>>2]|0)>=256)break;c[(c[j>>2]|0)+(c[o>>2]<<2)>>2]=c[8432+((d[45011+(d[45011+(d[44755+(d[44243+(c[q>>2]|0)>>0]^d[t>>0])>>0]^d[x>>0])>>0]^d[B>>0])>>0]^d[F>>0])<<2)>>2];c[(c[j>>2]|0)+1024+(c[o>>2]<<2)>>2]=c[9456+((d[45011+(d[44755+(d[44755+(d[44243+(c[p>>2]|0)>>0]^d[u>>0])>>0]^d[y>>0])>>0]^d[C>>0])>>0]^d[G>>0])<<2)>>2];c[(c[j>>2]|0)+2048+(c[o>>2]<<2)>>2]=c[10480+((d[44755+(d[45011+(d[45011+(d[44243+(c[p>>2]|0)>>0]^d[v>>0])>>0]^d[z>>0])>>0]^d[D>>0])>>0]^d[H>>0])<<2)>>2];c[(c[j>>2]|0)+3072+(c[o>>2]<<2)>>2]=c[11504+((d[44755+(d[44755+(d[45011+(d[44243+(c[q>>2]|0)>>0]^d[w>>0])>>0]^d[A>>0])>>0]^d[E>>0])>>0]^d[I>>0])<<2)>>2];c[o>>2]=(c[o>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+2;c[q>>2]=(c[q>>2]|0)+2}c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(117^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(169^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(169^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(117^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(243^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(103^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(103^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(243^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096>>2]=c[r>>2];c[(c[j>>2]|0)+4096+4>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(198^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(179^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(179^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(198^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(244^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(232^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(232^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(244^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096+8>>2]=c[r>>2];c[(c[j>>2]|0)+4096+12>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(219^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(4^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(4^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(219^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(123^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(253^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(253^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(123^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096+16>>2]=c[r>>2];c[(c[j>>2]|0)+4096+20>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(251^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(163^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(163^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(251^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(200^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(118^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(118^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(200^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096+24>>2]=c[r>>2];c[(c[j>>2]|0)+4096+28>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(74^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(154^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(154^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(74^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(211^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(146^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(146^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(211^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128>>2]=c[r>>2];c[(c[j>>2]|0)+4128+4>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(230^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(128^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(128^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(230^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(107^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(120^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(120^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(107^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+8>>2]=c[r>>2];c[(c[j>>2]|0)+4128+12>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(69^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(228^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(228^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(69^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(125^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(221^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(221^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(125^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+16>>2]=c[r>>2];c[(c[j>>2]|0)+4128+20>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(232^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(209^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(209^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(232^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(75^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(56^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(56^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(75^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+24>>2]=c[r>>2];c[(c[j>>2]|0)+4128+28>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(214^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(13^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(13^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(214^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(50^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(198^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(198^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(50^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+32>>2]=c[r>>2];c[(c[j>>2]|0)+4128+36>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(216^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(53^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(53^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(216^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(253^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(152^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(152^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(253^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+40>>2]=c[r>>2];c[(c[j>>2]|0)+4128+44>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(55^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(24^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(24^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(55^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(113^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(247^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(247^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(113^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+48>>2]=c[r>>2];c[(c[j>>2]|0)+4128+52>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(241^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(236^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(236^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(241^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(225^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(108^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(108^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(225^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+56>>2]=c[r>>2];c[(c[j>>2]|0)+4128+60>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(48^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(67^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(67^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(48^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(15^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(117^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(117^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(15^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+64>>2]=c[r>>2];c[(c[j>>2]|0)+4128+68>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(248^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(55^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(55^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(248^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(27^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(38^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(38^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(27^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+72>>2]=c[r>>2];c[(c[j>>2]|0)+4128+76>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(135^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(250^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(250^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(135^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(250^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(19^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(19^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(250^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+80>>2]=c[r>>2];c[(c[j>>2]|0)+4128+84>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(6^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(148^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(148^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(6^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(63^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(72^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(72^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(63^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+88>>2]=c[r>>2];c[(c[j>>2]|0)+4128+92>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(94^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(242^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(242^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(94^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(186^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(208^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(208^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(186^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+96>>2]=c[r>>2];c[(c[j>>2]|0)+4128+100>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(174^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(139^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(139^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(174^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(91^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(48^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(48^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(91^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+104>>2]=c[r>>2];c[(c[j>>2]|0)+4128+108>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(138^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(132^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(132^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(138^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(0^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(84^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(84^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(0^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+112>>2]=c[r>>2];c[(c[j>>2]|0)+4128+116>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(d[45011+(d[44755+(188^d[(c[k>>2]|0)+24>>0])>>0]^d[(c[k>>2]|0)+16>>0])>>0]^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(223^d[(c[k>>2]|0)+25>>0])>>0]^d[(c[k>>2]|0)+17>>0])>>0]^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(223^d[(c[k>>2]|0)+26>>0])>>0]^d[(c[k>>2]|0)+18>>0])>>0]^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(188^d[(c[k>>2]|0)+27>>0])>>0]^d[(c[k>>2]|0)+19>>0])>>0]^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(d[45011+(d[44755+(157^d[(c[k>>2]|0)+28>>0])>>0]^d[(c[k>>2]|0)+20>>0])>>0]^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(d[44755+(d[44755+(35^d[(c[k>>2]|0)+29>>0])>>0]^d[(c[k>>2]|0)+21>>0])>>0]^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(d[45011+(d[45011+(35^d[(c[k>>2]|0)+30>>0])>>0]^d[(c[k>>2]|0)+22>>0])>>0]^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(d[44755+(d[45011+(157^d[(c[k>>2]|0)+31>>0])>>0]^d[(c[k>>2]|0)+23>>0])>>0]^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+120>>2]=c[r>>2];c[(c[j>>2]|0)+4128+124>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23)}else{c[p>>2]=0;c[o>>2]=0;c[q>>2]=1;while(1){if((c[o>>2]|0)>=256)break;c[(c[j>>2]|0)+(c[o>>2]<<2)>>2]=c[8432+((d[45011+(d[44243+(c[p>>2]|0)>>0]^d[t>>0])>>0]^d[x>>0])<<2)>>2];c[(c[j>>2]|0)+1024+(c[o>>2]<<2)>>2]=c[9456+((d[45011+(d[44243+(c[q>>2]|0)>>0]^d[u>>0])>>0]^d[y>>0])<<2)>>2];c[(c[j>>2]|0)+2048+(c[o>>2]<<2)>>2]=c[10480+((d[44755+(d[44243+(c[p>>2]|0)>>0]^d[v>>0])>>0]^d[z>>0])<<2)>>2];c[(c[j>>2]|0)+3072+(c[o>>2]<<2)>>2]=c[11504+((d[44755+(d[44243+(c[q>>2]|0)>>0]^d[w>>0])>>0]^d[A>>0])<<2)>>2];c[o>>2]=(c[o>>2]|0)+1;c[p>>2]=(c[p>>2]|0)+2;c[q>>2]=(c[q>>2]|0)+2}c[r>>2]=c[8432+((d[45011+(169^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(117^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(169^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(117^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(103^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(243^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(103^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(243^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096>>2]=c[r>>2];c[(c[j>>2]|0)+4096+4>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(179^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(198^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(179^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(198^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(232^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(244^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(232^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(244^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096+8>>2]=c[r>>2];c[(c[j>>2]|0)+4096+12>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(4^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(219^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(4^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(219^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(253^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(123^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(253^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(123^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096+16>>2]=c[r>>2];c[(c[j>>2]|0)+4096+20>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(163^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(251^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(163^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(251^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(118^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(200^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(118^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(200^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4096+24>>2]=c[r>>2];c[(c[j>>2]|0)+4096+28>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(154^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(74^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(154^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(74^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(146^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(211^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(146^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(211^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128>>2]=c[r>>2];c[(c[j>>2]|0)+4128+4>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(128^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(230^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(128^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(230^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(120^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(107^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(120^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(107^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+8>>2]=c[r>>2];c[(c[j>>2]|0)+4128+12>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(228^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(69^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(228^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(69^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(221^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(125^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(221^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(125^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+16>>2]=c[r>>2];c[(c[j>>2]|0)+4128+20>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(209^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(232^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(209^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(232^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(56^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(75^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(56^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(75^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+24>>2]=c[r>>2];c[(c[j>>2]|0)+4128+28>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(13^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(214^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(13^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(214^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(198^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(50^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(198^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(50^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+32>>2]=c[r>>2];c[(c[j>>2]|0)+4128+36>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(53^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(216^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(53^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(216^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(152^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(253^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(152^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(253^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+40>>2]=c[r>>2];c[(c[j>>2]|0)+4128+44>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(24^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(55^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(24^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(55^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(247^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(113^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(247^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(113^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+48>>2]=c[r>>2];c[(c[j>>2]|0)+4128+52>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(236^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(241^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(236^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(241^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(108^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(225^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(108^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(225^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+56>>2]=c[r>>2];c[(c[j>>2]|0)+4128+60>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(67^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(48^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(67^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(48^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(117^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(15^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(117^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(15^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+64>>2]=c[r>>2];c[(c[j>>2]|0)+4128+68>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(55^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(248^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(55^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(248^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(38^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(27^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(38^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(27^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+72>>2]=c[r>>2];c[(c[j>>2]|0)+4128+76>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(250^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(135^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(250^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(135^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(19^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(250^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(19^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(250^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+80>>2]=c[r>>2];c[(c[j>>2]|0)+4128+84>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(148^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(6^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(148^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(6^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(72^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(63^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(72^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(63^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+88>>2]=c[r>>2];c[(c[j>>2]|0)+4128+92>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(242^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(94^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(242^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(94^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(208^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(186^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(208^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(186^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+96>>2]=c[r>>2];c[(c[j>>2]|0)+4128+100>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(139^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(174^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(139^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(174^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(48^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(91^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(48^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(91^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+104>>2]=c[r>>2];c[(c[j>>2]|0)+4128+108>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(132^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(138^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(132^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(138^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(84^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(0^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(84^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(0^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+112>>2]=c[r>>2];c[(c[j>>2]|0)+4128+116>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23);c[r>>2]=c[8432+((d[45011+(223^d[(c[k>>2]|0)+8>>0])>>0]^d[c[k>>2]>>0])<<2)>>2]^c[9456+((d[45011+(188^d[(c[k>>2]|0)+9>>0])>>0]^d[(c[k>>2]|0)+1>>0])<<2)>>2]^c[10480+((d[44755+(223^d[(c[k>>2]|0)+10>>0])>>0]^d[(c[k>>2]|0)+2>>0])<<2)>>2]^c[11504+((d[44755+(188^d[(c[k>>2]|0)+11>>0])>>0]^d[(c[k>>2]|0)+3>>0])<<2)>>2];c[s>>2]=c[8432+((d[45011+(35^d[(c[k>>2]|0)+12>>0])>>0]^d[(c[k>>2]|0)+4>>0])<<2)>>2]^c[9456+((d[45011+(157^d[(c[k>>2]|0)+13>>0])>>0]^d[(c[k>>2]|0)+5>>0])<<2)>>2]^c[10480+((d[44755+(35^d[(c[k>>2]|0)+14>>0])>>0]^d[(c[k>>2]|0)+6>>0])<<2)>>2]^c[11504+((d[44755+(157^d[(c[k>>2]|0)+15>>0])>>0]^d[(c[k>>2]|0)+7>>0])<<2)>>2];c[s>>2]=(c[s>>2]<<8)+((c[s>>2]|0)>>>24);c[r>>2]=(c[r>>2]|0)+(c[s>>2]|0);c[s>>2]=(c[s>>2]|0)+(c[r>>2]|0);c[(c[j>>2]|0)+4128+120>>2]=c[r>>2];c[(c[j>>2]|0)+4128+124>>2]=(c[s>>2]<<9)+((c[s>>2]|0)>>>23)}c[i>>2]=0;K=c[i>>2]|0;l=g;return K|0}function Lm(){var a=0,b=0,d=0,e=0,f=0,g=0;a=l;l=l+4288|0;if((l|0)>=(m|0))$(4288);b=a+4264|0;d=a+8|0;e=a+4272|0;f=a;Dm(d,45267,16)|0;Em(d,e,45283)|0;do if(!(Jv(e,45299,16)|0)){Fm(d,e,e)|0;if(Jv(e,45283,16)|0){c[b>>2]=45351;break}Dm(d,45387,32)|0;Em(d,e,45419)|0;if(Jv(e,45435,16)|0){c[b>>2]=45451;break}Fm(d,e,e)|0;if(Jv(e,45419,16)|0){c[b>>2]=45487;break}g=Mm()|0;c[f>>2]=g;if(g|0){c[b>>2]=c[f>>2];break}g=Nm()|0;c[f>>2]=g;if(g|0){c[b>>2]=c[f>>2];break}g=Om()|0;c[f>>2]=g;if(g|0){c[b>>2]=c[f>>2];break}else{c[b>>2]=0;break}}else c[b>>2]=45315;while(0);l=a;return c[b>>2]|0}function Mm(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[a+8>>2]=4;c[a+4>>2]=16;c[a>>2]=4256;b=wr(43484,13,14,8,4,16,4256)|0;l=a;return b|0}function Nm(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[a+8>>2]=5;c[a+4>>2]=16;c[a>>2]=4256;b=sr(43484,13,14,6,5,16,4256)|0;l=a;return b|0}function Om(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[a+8>>2]=5;c[a+4>>2]=16;c[a>>2]=4256;b=ur(43484,13,14,7,5,16,4256)|0;l=a;return b|0}function Pm(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=g+36|0;i=g+32|0;j=g+28|0;k=g+24|0;n=g+20|0;o=g+16|0;p=g+12|0;q=g+8|0;r=g+4|0;s=g;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;c[n>>2]=f;c[o>>2]=c[h>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[s>>2]=0;while(1){if(!(c[n>>2]|0))break;c[r>>2]=Em(c[o>>2]|0,c[i>>2]|0,c[i>>2]|0)|0;if((c[r>>2]|0)>>>0>(c[s>>2]|0)>>>0)c[s>>2]=c[r>>2];Qm(c[p>>2]|0,c[i>>2]|0,c[q>>2]|0,16);c[p>>2]=(c[p>>2]|0)+16;c[q>>2]=(c[q>>2]|0)+16;c[n>>2]=(c[n>>2]|0)+-1}bf(c[s>>2]|0);cf();l=g;return}function Qm(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;Rm(c[g>>2]|0,c[i>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}function Rm(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+24|0;u=i+60|0;v=i+20|0;w=i+16|0;x=i+12|0;y=i+8|0;z=i+4|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[k>>2];c[t>>2]=c[o>>2];c[i>>2]=3;if(!((c[t>>2]|c[s>>2]|c[q>>2]|c[r>>2])&3)){c[v>>2]=c[q>>2];c[y>>2]=c[s>>2];c[w>>2]=c[r>>2];c[x>>2]=c[t>>2];while(1){if((c[p>>2]|0)>>>0<4)break;o=c[x>>2]|0;c[x>>2]=o+4;c[z>>2]=c[o>>2];o=c[c[w>>2]>>2]|0;k=c[y>>2]|0;c[y>>2]=k+4;n=o^c[k>>2];k=c[v>>2]|0;c[v>>2]=k+4;c[k>>2]=n;n=c[z>>2]|0;k=c[w>>2]|0;c[w>>2]=k+4;c[k>>2]=n;c[p>>2]=(c[p>>2]|0)-4}c[q>>2]=c[v>>2];c[s>>2]=c[y>>2];c[r>>2]=c[w>>2];c[t>>2]=c[x>>2]}while(1){if(!(c[p>>2]|0))break;x=c[t>>2]|0;c[t>>2]=x+1;a[u>>0]=a[x>>0]|0;x=d[c[r>>2]>>0]|0;w=c[s>>2]|0;c[s>>2]=w+1;y=(x^(d[w>>0]|0))&255;w=c[q>>2]|0;c[q>>2]=w+1;a[w>>0]=y;y=a[u>>0]|0;w=c[r>>2]|0;c[r>>2]=w+1;a[w>>0]=y;c[p>>2]=(c[p>>2]|0)+-1}l=i;return}function Sm(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;i=l;l=l+80|0;if((l|0)>=(m|0))$(80);j=i+56|0;k=i+52|0;n=i+48|0;o=i+44|0;p=i+40|0;q=i+36|0;r=i+32|0;s=i+28|0;t=i+64|0;u=i+24|0;v=i+20|0;w=i+16|0;x=i+12|0;y=i+60|0;z=i;A=i+8|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[o>>2];c[v>>2]=0;while(1){if(!(c[p>>2]|0))break;c[u>>2]=Fm(c[q>>2]|0,t,c[s>>2]|0)|0;if((c[u>>2]|0)>>>0>(c[v>>2]|0)>>>0)c[v>>2]=c[u>>2];Rm(c[r>>2]|0,t,c[k>>2]|0,c[s>>2]|0,16);c[s>>2]=(c[s>>2]|0)+16;c[r>>2]=(c[r>>2]|0)+16;c[p>>2]=(c[p>>2]|0)+-1}c[w>>2]=t;c[x>>2]=16;a[y>>0]=0;t=z;c[t>>2]=d[y>>0];c[t+4>>2]=0;while(1){if(!(c[w>>2]&7|0?(c[x>>2]|0)!=0:0))break;a[c[w>>2]>>0]=a[y>>0]|0;c[w>>2]=(c[w>>2]|0)+1;c[x>>2]=(c[x>>2]|0)+-1}if((c[x>>2]|0)>>>0>=8){t=z;p=gx(c[t>>2]|0,c[t+4>>2]|0,16843009,16843009)|0;t=z;c[t>>2]=p;c[t+4>>2]=D;do{c[A>>2]=c[w>>2];t=z;p=c[t+4>>2]|0;r=c[A>>2]|0;c[r>>2]=c[t>>2];c[r+4>>2]=p;c[x>>2]=(c[x>>2]|0)-8;c[w>>2]=(c[w>>2]|0)+8}while((c[x>>2]|0)>>>0>=8)}while(1){if(!(c[x>>2]|0))break;a[c[w>>2]>>0]=a[y>>0]|0;c[w>>2]=(c[w>>2]|0)+1;c[x>>2]=(c[x>>2]|0)+-1}bf(c[v>>2]|0);cf();l=i;return}function Tm(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;i=l;l=l+96|0;if((l|0)>=(m|0))$(96);j=i+60|0;k=i+56|0;n=i+52|0;o=i+48|0;p=i+44|0;q=i+40|0;r=i+36|0;s=i+32|0;t=i+72|0;u=i+28|0;v=i+24|0;w=i+20|0;x=i+16|0;y=i+12|0;z=i+64|0;A=i;B=i+8|0;c[j>>2]=b;c[k>>2]=e;c[n>>2]=f;c[o>>2]=g;c[p>>2]=h;c[q>>2]=c[j>>2];c[r>>2]=c[n>>2];c[s>>2]=c[o>>2];c[v>>2]=0;while(1){if(!(c[p>>2]|0))break;c[u>>2]=Em(c[q>>2]|0,t,c[k>>2]|0)|0;if((c[u>>2]|0)>>>0>(c[v>>2]|0)>>>0)c[v>>2]=c[u>>2];Um(c[r>>2]|0,t,c[s>>2]|0,16);c[r>>2]=(c[r>>2]|0)+16;c[s>>2]=(c[s>>2]|0)+16;c[w>>2]=16;while(1){if((c[w>>2]|0)<=0)break;o=(c[k>>2]|0)+((c[w>>2]|0)-1)|0;a[o>>0]=(a[o>>0]|0)+1<<24>>24;if(a[(c[k>>2]|0)+((c[w>>2]|0)-1)>>0]|0)break;c[w>>2]=(c[w>>2]|0)+-1}c[p>>2]=(c[p>>2]|0)+-1}c[x>>2]=t;c[y>>2]=16;a[z>>0]=0;t=A;c[t>>2]=d[z>>0];c[t+4>>2]=0;while(1){if(!(c[x>>2]&7|0?(c[y>>2]|0)!=0:0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}if((c[y>>2]|0)>>>0>=8){t=A;p=gx(c[t>>2]|0,c[t+4>>2]|0,16843009,16843009)|0;t=A;c[t>>2]=p;c[t+4>>2]=D;do{c[B>>2]=c[x>>2];t=A;p=c[t+4>>2]|0;w=c[B>>2]|0;c[w>>2]=c[t>>2];c[w+4>>2]=p;c[y>>2]=(c[y>>2]|0)-8;c[x>>2]=(c[x>>2]|0)+8}while((c[y>>2]|0)>>>0>=8)}while(1){if(!(c[y>>2]|0))break;a[c[x>>2]>>0]=a[z>>0]|0;c[x>>2]=(c[x>>2]|0)+1;c[y>>2]=(c[y>>2]|0)+-1}bf(c[v>>2]|0);cf();l=i;return}function Um(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=h+40|0;j=h+36|0;k=h+32|0;n=h+28|0;o=h+24|0;p=h+20|0;q=h+16|0;r=h+12|0;s=h+8|0;t=h+4|0;c[i>>2]=b;c[j>>2]=e;c[k>>2]=f;c[n>>2]=g;c[o>>2]=c[i>>2];c[p>>2]=c[j>>2];c[q>>2]=c[k>>2];c[h>>2]=3;if(!((c[o>>2]|c[p>>2]|c[q>>2])&3)){c[r>>2]=c[o>>2];c[s>>2]=c[p>>2];c[t>>2]=c[q>>2];while(1){if((c[n>>2]|0)>>>0<4)break;k=c[s>>2]|0;c[s>>2]=k+4;j=c[k>>2]|0;k=c[t>>2]|0;c[t>>2]=k+4;i=j^c[k>>2];k=c[r>>2]|0;c[r>>2]=k+4;c[k>>2]=i;c[n>>2]=(c[n>>2]|0)-4}c[o>>2]=c[r>>2];c[p>>2]=c[s>>2];c[q>>2]=c[t>>2]}while(1){if(!(c[n>>2]|0))break;t=c[p>>2]|0;c[p>>2]=t+1;s=d[t>>0]|0;t=c[q>>2]|0;c[q>>2]=t+1;r=(s^(d[t>>0]|0))&255;t=c[o>>2]|0;c[o>>2]=t+1;a[t>>0]=r;c[n>>2]=(c[n>>2]|0)+-1}l=h;return}function Vm(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;c[17742]=c[e>>2];c[17743]=c[f>>2];l=d;return}function Wm(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(!(c[17742]|0)){l=f;return}vb[c[17742]&15](c[17743]|0,c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}function Xm(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;do if(c[d>>2]|0){if((c[d>>2]|0)==1){c[17745]=1;break}if(!(c[17744]|0)){if((c[d>>2]|0)==2){c[17746]=1;break}if((c[d>>2]|0)==3)c[17747]=1}}else c[17744]=1;while(0);l=b;return}function Ym(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(Wg()|0){As(c[d>>2]|0);l=b;return}if(c[17745]|0){$r(c[d>>2]|0);l=b;return}if(c[17746]|0){As(c[d>>2]|0);l=b;return}a=c[d>>2]|0;if(c[17747]|0){ct(a);l=b;return}else{$r(a);l=b;return}}function Zm(){if(Wg()|0){Gs();return}if(c[17745]|0){js();return}if(c[17746]|0){Gs();return}if(c[17747]|0){et();return}else{js();return}}function _m(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;if(!(c[e>>2]|0)?Wg()|0:0)c[d>>2]=2;else f=4;do if((f|0)==4){if(c[17745]|0){c[d>>2]=1;break}if(c[17746]|0){c[d>>2]=2;break}if(c[17747]|0){c[d>>2]=3;break}else{c[d>>2]=1;break}}while(0);l=b;return c[d>>2]|0}function $m(){if(Wg()|0){Hs();return}else{ks();return}}function an(){if(Wg()|0)return;ls();return}function bn(){if(Wg()|0)return;ms();return}function cn(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(Wg()|0){l=b;return}ns(c[d>>2]|0);l=b;return}function dn(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;if(Wg()|0)c[d>>2]=0;else c[d>>2]=os(c[e>>2]|0)|0;l=b;return c[d>>2]|0}function en(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;if(Wg()|0)c[b>>2]=Is()|0;else c[b>>2]=ps()|0;l=a;return c[b>>2]|0}function fn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=zf(c[e>>2]|0)|0;gn(c[g>>2]|0,c[e>>2]|0,c[f>>2]|0);l=d;return c[g>>2]|0}function gn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(Wg()|0){Js(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}if(c[17745]|0){qs(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}if(c[17746]|0){Js(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}d=c[f>>2]|0;f=c[g>>2]|0;g=c[h>>2]|0;if(c[17747]|0){ht(d,f,g);l=e;return}else{qs(d,f,g);l=e;return}}function hn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+8|0;f=d+4|0;g=d;c[e>>2]=a;c[f>>2]=b;c[g>>2]=Bf(c[e>>2]|0)|0;gn(c[g>>2]|0,c[e>>2]|0,c[f>>2]|0);l=d;return c[g>>2]|0}function jn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;gn(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function kn(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(Wg()|0){l=b;return}if(c[17745]|0){xs(c[d>>2]|0);l=b;return}if((c[17746]|0)!=0|(c[17747]|0)!=0){l=b;return}xs(c[d>>2]|0);l=b;return}function ln(){if(Wg()|0)return;if(c[17745]|0){ys();return}if((c[17746]|0)!=0|(c[17747]|0)!=0)return;ys();return}function mn(){if(Wg()|0)return;if(c[17745]|0){zs();return}if((c[17746]|0)!=0|(c[17747]|0)!=0)return;zs();return}function nn(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=e+8|0;g=e;h=e+40|0;i=e+36|0;j=e+32|0;k=e+28|0;n=e+24|0;o=e+20|0;p=e+16|0;q=e+12|0;c[h>>2]=b;c[i>>2]=d;if(Wg()|0){Ws(c[h>>2]|0,c[i>>2]|0);l=e;return}Ym(1);c[o>>2]=Ht(12592)|0;if(c[o>>2]|0){c[g>>2]=Bt(c[o>>2]|0)|0;We(45534,g)}c[j>>2]=_v()|0;if(c[17748]|0){if((c[17749]|0)!=(c[j>>2]|0)){gn(72243,8,0);c[17749]=c[j>>2]}}else{c[p>>2]=kb(0)|0;c[q>>2]=c[j>>2];c[17749]=c[j>>2];c[k>>2]=72223;j=c[k>>2]|0;a[j>>0]=a[q>>0]|0;a[j+1>>0]=a[q+1>>0]|0;a[j+2>>0]=a[q+2>>0]|0;a[j+3>>0]=a[q+3>>0]|0;c[k>>2]=(c[k>>2]|0)+4;q=c[k>>2]|0;a[q>>0]=a[p>>0]|0;a[q+1>>0]=a[p+1>>0]|0;a[q+2>>0]=a[p+2>>0]|0;a[q+3>>0]=a[p+3>>0]|0;jn(72243,8,0);c[17748]=1}c[k>>2]=c[h>>2];while(1){if((c[i>>2]|0)>>>0<=0)break;Xl(72223,72223,28);c[n>>2]=(c[i>>2]|0)>>>0>20?20:c[i>>2]|0;_w(c[k>>2]|0,72223,c[n>>2]|0)|0;c[i>>2]=(c[i>>2]|0)-(c[n>>2]|0);c[k>>2]=(c[k>>2]|0)+(c[n>>2]|0)}c[o>>2]=It(12592)|0;if(c[o>>2]|0){c[f>>2]=Bt(c[o>>2]|0)|0;We(45579,f)}else{l=e;return}}function on(a){a=a|0;var b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+4|0;e=b;c[e>>2]=a;if(Wg()|0)c[d>>2]=Xs(c[e>>2]|0)|0;else c[d>>2]=0;l=b;return c[d>>2]|0}function pn(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;j=l;l=l+48|0;if((l|0)>=(m|0))$(48);k=j+32|0;n=j+28|0;o=j+24|0;p=j+20|0;q=j+16|0;r=j+12|0;s=j+8|0;t=j+4|0;u=j;c[n>>2]=a;c[o>>2]=b;c[p>>2]=d;c[q>>2]=e;c[r>>2]=f;c[s>>2]=g;c[t>>2]=h;c[u>>2]=i;if(Wg()|0){c[k>>2]=$s(c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0,c[r>>2]|0,c[s>>2]|0,c[t>>2]|0,c[u>>2]|0)|0;v=c[k>>2]|0;l=j;return v|0}else{c[k>>2]=60;v=c[k>>2]|0;l=j;return v|0}return 0}function qn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;if(Wg()|0){c[f>>2]=at(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0;j=c[f>>2]|0;l=e;return j|0}else{c[f>>2]=60;j=c[f>>2]|0;l=e;return j|0}return 0}function rn(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(!(Wg()|0)){l=b;return}bt(c[d>>2]|0);l=b;return}function sn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;f=l;l=l+144|0;if((l|0)>=(m|0))$(144);g=f+8|0;h=f;i=f+28|0;j=f+24|0;k=f+20|0;n=f+16|0;o=f+12|0;p=f+32|0;c[i>>2]=b;c[j>>2]=d;c[k>>2]=e;e=c[i>>2]|0;if(!(c[j>>2]|0)){c[h>>2]=e;Su(p,99,45624,h)|0;af(p,0);l=f;return}c[g>>2]=e;Su(p,99,45629,g)|0;if(c[k>>2]|0){c[n>>2]=Rp(0)|0;c[o>>2]=Rp(0)|0}if(c[k>>2]|0?!(tn(c[n>>2]|0,c[o>>2]|0,c[j>>2]|0,c[k>>2]|0)|0):0){a[p+((hv(p)|0)-1)>>0]=120;af(p,c[n>>2]|0);a[p+((hv(p)|0)-1)>>0]=121;af(p,c[o>>2]|0)}else{af(p,c[c[j>>2]>>2]|0);a[p+((hv(p)|0)-1)>>0]=89;af(p,c[(c[j>>2]|0)+4>>2]|0);a[p+((hv(p)|0)-1)>>0]=90;af(p,c[(c[j>>2]|0)+8>>2]|0)}if(!(c[k>>2]|0)){l=f;return}Tp(c[n>>2]|0);Tp(c[o>>2]|0);l=f;return}function tn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;f=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=f;h=f+40|0;i=f+36|0;j=f+32|0;k=f+28|0;n=f+24|0;o=f+20|0;p=f+16|0;q=f+12|0;r=f+8|0;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;if(!(vo(c[(c[k>>2]|0)+8>>2]|0,0)|0)){c[h>>2]=-1;s=c[h>>2]|0;l=f;return s|0}switch(c[c[n>>2]>>2]|0){case 0:{c[o>>2]=Rp(0)|0;c[p>>2]=Rp(0)|0;un(c[o>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[n>>2]|0);vn(c[p>>2]|0,c[o>>2]|0,c[o>>2]|0,c[n>>2]|0);if(c[i>>2]|0)vn(c[i>>2]|0,c[c[k>>2]>>2]|0,c[p>>2]|0,c[n>>2]|0);if(c[j>>2]|0){c[q>>2]=Rp(0)|0;vn(c[q>>2]|0,c[p>>2]|0,c[o>>2]|0,c[n>>2]|0);vn(c[j>>2]|0,c[(c[k>>2]|0)+4>>2]|0,c[q>>2]|0,c[n>>2]|0);Dp(c[q>>2]|0)}Dp(c[p>>2]|0);Dp(c[o>>2]|0);c[h>>2]=0;s=c[h>>2]|0;l=f;return s|0}case 1:{if(c[i>>2]|0)Kp(c[i>>2]|0,c[c[k>>2]>>2]|0)|0;if(c[j>>2]|0){c[g>>2]=45683;c[g+4>>2]=45707;We(45634,g)}c[h>>2]=0;s=c[h>>2]|0;l=f;return s|0}case 2:{c[r>>2]=Rp(0)|0;un(c[r>>2]|0,c[(c[k>>2]|0)+8>>2]|0,c[n>>2]|0);if(c[i>>2]|0)vn(c[i>>2]|0,c[c[k>>2]>>2]|0,c[r>>2]|0,c[n>>2]|0);if(c[j>>2]|0)vn(c[j>>2]|0,c[(c[k>>2]|0)+4>>2]|0,c[r>>2]|0,c[n>>2]|0);Tp(c[r>>2]|0);c[h>>2]=0;s=c[h>>2]|0;l=f;return s|0}default:{c[h>>2]=-1;s=c[h>>2]|0;l=f;return s|0}}return 0}function un(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(Lo(c[f>>2]|0,c[g>>2]|0,c[(c[h>>2]|0)+16>>2]|0)|0){l=e;return}Ve(45718,e);af(45752,c[g>>2]|0);af(45756,c[(c[h>>2]|0)+16>>2]|0);l=e;return}function vn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;Qo(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);wn(c[g>>2]|0,c[j>>2]|0);l=f;return}function wn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=a;c[f>>2]=b;b=c[e>>2]|0;a=c[e>>2]|0;e=c[f>>2]|0;if(c[(c[f>>2]|0)+48+12>>2]|0){Po(b,a,c[e+48+12>>2]|0);l=d;return}else{Mo(b,a,c[e+16>>2]|0);l=d;return}}function xn(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[b+4>>2]=a;c[d>>2]=zf(12)|0;yn(c[d>>2]|0);l=b;return c[d>>2]|0}function yn(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;a=Rp(0)|0;c[c[d>>2]>>2]=a;a=Rp(0)|0;c[(c[d>>2]|0)+4>>2]=a;a=Rp(0)|0;c[(c[d>>2]|0)+8>>2]=a;l=b;return}function zn(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(!(c[d>>2]|0)){l=b;return}An(c[d>>2]|0);vf(c[d>>2]|0);l=b;return}function An(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Dp(c[c[d>>2]>>2]|0);c[c[d>>2]>>2]=0;Dp(c[(c[d>>2]|0)+4>>2]|0);c[(c[d>>2]|0)+4>>2]=0;Dp(c[(c[d>>2]|0)+8>>2]|0);c[(c[d>>2]|0)+8>>2]=0;l=b;return}function Bn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(!(c[g>>2]|0))c[g>>2]=xn(0)|0;e=c[c[g>>2]>>2]|0;if(c[h>>2]|0)Kp(e,c[h>>2]|0)|0;else Bp(e);e=c[(c[g>>2]|0)+4>>2]|0;if(c[i>>2]|0)Kp(e,c[i>>2]|0)|0;else Bp(e);e=c[(c[g>>2]|0)+8>>2]|0;if(c[j>>2]|0){Kp(e,c[j>>2]|0)|0;k=c[g>>2]|0;l=f;return k|0}else{Bp(e);k=c[g>>2]|0;l=f;return k|0}return 0}function Cn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(!(c[g>>2]|0))c[g>>2]=xn(0)|0;e=c[c[g>>2]>>2]|0;if(c[h>>2]|0)Mp(e,c[h>>2]|0);else Bp(e);e=c[(c[g>>2]|0)+4>>2]|0;if(c[i>>2]|0)Mp(e,c[i>>2]|0);else Bp(e);e=c[(c[g>>2]|0)+8>>2]|0;if(c[j>>2]|0){Mp(e,c[j>>2]|0);k=c[g>>2]|0;l=f;return k|0}else{Bp(e);k=c[g>>2]|0;l=f;return k|0}return 0}function Dn(b){b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;b=(c[e>>2]|0)+48|0;a[b>>0]=a[b>>0]&-2;b=(c[e>>2]|0)+48|0;a[b>>0]=a[b>>0]&-3;l=d;return}function En(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=h+24|0;j=h+20|0;k=h+16|0;n=h+12|0;o=h+8|0;p=h+4|0;q=h;c[i>>2]=a;c[j>>2]=b;c[k>>2]=d;c[n>>2]=e;c[o>>2]=f;c[p>>2]=g;c[q>>2]=Cf(1,108)|0;Fn(c[q>>2]|0,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0);l=h;return c[q>>2]|0}function Fn(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=i+28|0;k=i+24|0;n=i+20|0;o=i+16|0;p=i+12|0;q=i+8|0;r=i+4|0;s=i;c[j>>2]=a;c[k>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;do if(!(c[17750]|0))if($a(45760)|0){c[17750]=1;break}else{c[17750]=-1;break}while(0);c[c[j>>2]>>2]=c[k>>2];c[(c[j>>2]|0)+4>>2]=c[n>>2];c[(c[j>>2]|0)+8>>2]=c[o>>2];if((c[n>>2]|0)==1)c[(c[j>>2]|0)+12>>2]=256;else{n=lo(c[p>>2]|0)|0;c[(c[j>>2]|0)+12>>2]=n}n=Ip(c[p>>2]|0)|0;c[(c[j>>2]|0)+16>>2]=n;n=Ip(c[q>>2]|0)|0;c[(c[j>>2]|0)+20>>2]=n;n=Ip(c[r>>2]|0)|0;c[(c[j>>2]|0)+24>>2]=n;if((c[17750]|0)>0)t=No(c[(c[j>>2]|0)+16>>2]|0,0)|0;else t=0;c[(c[j>>2]|0)+48+12>>2]=t;Dn(c[j>>2]|0);c[s>>2]=0;while(1){if((c[s>>2]|0)>>>0>=11)break;t=Lp(c[(c[j>>2]|0)+16>>2]|0)|0;c[(c[j>>2]|0)+48+16+(c[s>>2]<<2)>>2]=t;c[s>>2]=(c[s>>2]|0)+1}l=i;return}function Gn(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);j=i+36|0;k=i+32|0;n=i+28|0;o=i+24|0;p=i+20|0;q=i+16|0;r=i+12|0;s=i+8|0;t=i+4|0;u=i;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[q>>2]=f;c[r>>2]=g;c[s>>2]=h;c[c[k>>2]>>2]=0;if(!((c[q>>2]|0)!=0&(c[r>>2]|0)!=0)){c[j>>2]=32816;v=c[j>>2]|0;l=i;return v|0}c[t>>2]=qh(1,108,5)|0;if(c[t>>2]|0){c[u>>2]=rh(c[t>>2]|0,1)|0;Fn(c[u>>2]|0,c[n>>2]|0,c[o>>2]|0,c[p>>2]|0,c[q>>2]|0,c[r>>2]|0,c[s>>2]|0);c[c[k>>2]>>2]=c[t>>2];c[j>>2]=0;v=c[j>>2]|0;l=i;return v|0}else{c[j>>2]=Et()|0;v=c[j>>2]|0;l=i;return v|0}return 0}function Hn(a){a=a|0;var b=0,d=0,e=0,f=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b+8|0;e=b+4|0;f=b;c[d>>2]=a;c[e>>2]=c[d>>2];Oo(c[(c[e>>2]|0)+48+12>>2]|0);Dp(c[(c[e>>2]|0)+16>>2]|0);Dp(c[(c[e>>2]|0)+20>>2]|0);Dp(c[(c[e>>2]|0)+24>>2]|0);zn(c[(c[e>>2]|0)+28>>2]|0);Dp(c[(c[e>>2]|0)+32>>2]|0);Dp(c[(c[e>>2]|0)+36>>2]|0);zn(c[(c[e>>2]|0)+40>>2]|0);Dp(c[(c[e>>2]|0)+44>>2]|0);Dp(c[(c[e>>2]|0)+48+8>>2]|0);c[f>>2]=0;while(1){if((c[f>>2]|0)>>>0>=11)break;Dp(c[(c[e>>2]|0)+48+16+(c[f>>2]<<2)>>2]|0);c[f>>2]=(c[f>>2]|0)+1}l=b;return}function In(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;if(!(c[d>>2]|0)){l=b;return}Hn(c[d>>2]|0);vf(c[d>>2]|0);l=b;return}function Jn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e+4|0;i=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=rh(c[g>>2]|0,1)|0;g=_h(c[f>>2]|0,c[i>>2]|0,c[h>>2]|0)|0;l=e;return g|0}function Kn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+12|0;g=e+8|0;h=e;c[f>>2]=a;c[g>>2]=b;c[e+4>>2]=d;c[h>>2]=rh(c[g>>2]|0,1)|0;g=$h(c[f>>2]|0,c[h>>2]|0)|0;l=e;return g|0}function Ln(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;switch(c[c[h>>2]>>2]|0){case 0:{Mn(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}case 1:{Nn(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}case 2:{On(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}default:{l=e;return}}}function Mn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(vo(c[(c[g>>2]|0)+4>>2]|0,0)|0?vo(c[(c[g>>2]|0)+8>>2]|0,0)|0:0){d=(Tn(c[h>>2]|0)|0)!=0;b=(c[h>>2]|0)+48+16|0;if(d){Qn(c[b>>2]|0,c[(c[g>>2]|0)+8>>2]|0,c[h>>2]|0);Sn(c[(c[h>>2]|0)+48+16+12>>2]|0,c[c[g>>2]>>2]|0,c[(c[h>>2]|0)+48+16>>2]|0,c[h>>2]|0);d=c[(c[h>>2]|0)+48+16+12>>2]|0;a=c[(c[h>>2]|0)+48+16+12>>2]|0;i=Wp(3)|0;vn(d,a,i,c[h>>2]|0);Pn(c[(c[h>>2]|0)+48+16+4>>2]|0,c[c[g>>2]>>2]|0,c[(c[h>>2]|0)+48+16>>2]|0,c[h>>2]|0);vn(c[(c[h>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+48+16+4>>2]|0,c[h>>2]|0)}else{Qn(c[b+12>>2]|0,c[c[g>>2]>>2]|0,c[h>>2]|0);b=c[(c[h>>2]|0)+48+16+12>>2]|0;i=c[(c[h>>2]|0)+48+16+12>>2]|0;a=Wp(3)|0;vn(b,i,a,c[h>>2]|0);a=c[(c[h>>2]|0)+48+16>>2]|0;i=c[(c[g>>2]|0)+8>>2]|0;b=Wp(4)|0;Un(a,i,b,c[h>>2]|0);vn(c[(c[h>>2]|0)+48+16>>2]|0,c[(c[h>>2]|0)+48+16>>2]|0,c[(c[h>>2]|0)+20>>2]|0,c[h>>2]|0);Pn(c[(c[h>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+48+16>>2]|0,c[h>>2]|0)}vn(c[(c[f>>2]|0)+8>>2]|0,c[(c[g>>2]|0)+4>>2]|0,c[(c[g>>2]|0)+8>>2]|0,c[h>>2]|0);Rn(c[(c[f>>2]|0)+8>>2]|0,c[(c[f>>2]|0)+8>>2]|0,c[h>>2]|0);Qn(c[(c[h>>2]|0)+48+16+4>>2]|0,c[(c[g>>2]|0)+4>>2]|0,c[h>>2]|0);vn(c[(c[h>>2]|0)+48+16+16>>2]|0,c[(c[h>>2]|0)+48+16+4>>2]|0,c[c[g>>2]>>2]|0,c[h>>2]|0);g=c[(c[h>>2]|0)+48+16+16>>2]|0;b=c[(c[h>>2]|0)+48+16+16>>2]|0;i=Wp(4)|0;vn(g,b,i,c[h>>2]|0);Qn(c[c[f>>2]>>2]|0,c[(c[h>>2]|0)+48+16+12>>2]|0,c[h>>2]|0);Rn(c[(c[h>>2]|0)+48+16>>2]|0,c[(c[h>>2]|0)+48+16+16>>2]|0,c[h>>2]|0);Sn(c[c[f>>2]>>2]|0,c[c[f>>2]>>2]|0,c[(c[h>>2]|0)+48+16>>2]|0,c[h>>2]|0);Qn(c[(c[h>>2]|0)+48+16+4>>2]|0,c[(c[h>>2]|0)+48+16+4>>2]|0,c[h>>2]|0);i=c[(c[h>>2]|0)+48+16+20>>2]|0;b=c[(c[h>>2]|0)+48+16+4>>2]|0;g=Wp(5)|0;vn(i,b,g,c[h>>2]|0);Sn(c[(c[f>>2]|0)+4>>2]|0,c[(c[h>>2]|0)+48+16+16>>2]|0,c[c[f>>2]>>2]|0,c[h>>2]|0);vn(c[(c[f>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0,c[(c[h>>2]|0)+48+16+12>>2]|0,c[h>>2]|0);Sn(c[(c[f>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0,c[(c[h>>2]|0)+48+16+20>>2]|0,c[h>>2]|0);l=e;return}Op(c[c[f>>2]>>2]|0,1)|0;Op(c[(c[f>>2]|0)+4>>2]|0,1)|0;Op(c[(c[f>>2]|0)+8>>2]|0,0)|0;l=e;return}function Nn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=e;c[e+16>>2]=a;c[e+12>>2]=b;c[e+8>>2]=d;c[f>>2]=45801;c[f+4>>2]=45707;We(45775,f)}function On(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;Pn(c[(c[h>>2]|0)+48+16>>2]|0,c[c[g>>2]>>2]|0,c[(c[g>>2]|0)+4>>2]|0,c[h>>2]|0);Qn(c[(c[h>>2]|0)+48+16>>2]|0,c[(c[h>>2]|0)+48+16>>2]|0,c[h>>2]|0);Qn(c[(c[h>>2]|0)+48+16+4>>2]|0,c[c[g>>2]>>2]|0,c[h>>2]|0);Qn(c[(c[h>>2]|0)+48+16+8>>2]|0,c[(c[g>>2]|0)+4>>2]|0,c[h>>2]|0);d=c[(c[h>>2]|0)+48+16+12>>2]|0;b=c[h>>2]|0;if((c[(c[h>>2]|0)+4>>2]|0)==1){Kp(d,c[b+48+16+4>>2]|0)|0;Jp(c[(c[h>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+48+16+12>>2]|0)}else vn(d,c[b+20>>2]|0,c[(c[h>>2]|0)+48+16+4>>2]|0,c[h>>2]|0);Pn(c[(c[h>>2]|0)+48+16+16>>2]|0,c[(c[h>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+48+16+8>>2]|0,c[h>>2]|0);Qn(c[(c[h>>2]|0)+48+16+20>>2]|0,c[(c[g>>2]|0)+8>>2]|0,c[h>>2]|0);Rn(c[(c[h>>2]|0)+48+16+24>>2]|0,c[(c[h>>2]|0)+48+16+20>>2]|0,c[h>>2]|0);Sn(c[(c[h>>2]|0)+48+16+24>>2]|0,c[(c[h>>2]|0)+48+16+16>>2]|0,c[(c[h>>2]|0)+48+16+24>>2]|0,c[h>>2]|0);Sn(c[c[f>>2]>>2]|0,c[(c[h>>2]|0)+48+16>>2]|0,c[(c[h>>2]|0)+48+16+4>>2]|0,c[h>>2]|0);Sn(c[c[f>>2]>>2]|0,c[c[f>>2]>>2]|0,c[(c[h>>2]|0)+48+16+8>>2]|0,c[h>>2]|0);vn(c[c[f>>2]>>2]|0,c[c[f>>2]>>2]|0,c[(c[h>>2]|0)+48+16+24>>2]|0,c[h>>2]|0);Sn(c[(c[f>>2]|0)+4>>2]|0,c[(c[h>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+48+16+8>>2]|0,c[h>>2]|0);vn(c[(c[f>>2]|0)+4>>2]|0,c[(c[f>>2]|0)+4>>2]|0,c[(c[h>>2]|0)+48+16+16>>2]|0,c[h>>2]|0);vn(c[(c[f>>2]|0)+8>>2]|0,c[(c[h>>2]|0)+48+16+16>>2]|0,c[(c[h>>2]|0)+48+16+24>>2]|0,c[h>>2]|0);l=e;return}function Pn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;fo(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);wn(c[g>>2]|0,c[j>>2]|0);l=f;return}function Qn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;vn(c[f>>2]|0,c[g>>2]|0,c[g>>2]|0,c[h>>2]|0);l=e;return}function Rn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e+8|0;g=e+4|0;h=e;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;uo(c[f>>2]|0,c[g>>2]|0,1);wn(c[f>>2]|0,c[h>>2]|0);l=e;return}function Sn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[f>>2]=e;ho(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);l=f;return}function Tn(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d+4|0;f=d;c[e>>2]=b;if(a[(c[e>>2]|0)+48>>0]&1|0){g=c[e>>2]|0;h=g+48|0;i=h+4|0;j=c[i>>2]|0;l=d;return j|0}b=(c[e>>2]|0)+48|0;a[b>>0]=a[b>>0]&-2|1;c[f>>2]=Lp(c[(c[e>>2]|0)+16>>2]|0)|0;go(c[f>>2]|0,c[(c[e>>2]|0)+16>>2]|0,3);b=((wo(c[(c[e>>2]|0)+20>>2]|0,c[f>>2]|0)|0)!=0^1)&1;c[(c[e>>2]|0)+48+4>>2]=b;Dp(c[f>>2]|0);g=c[e>>2]|0;h=g+48|0;i=h+4|0;j=c[i>>2]|0;l=d;return j|0}function Un(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;So(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[(c[j>>2]|0)+16>>2]|0);l=f;return}function Vn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f+12|0;h=f+8|0;i=f+4|0;j=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;switch(c[c[j>>2]>>2]|0){case 0:{Wn(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}case 1:{Xn(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}case 2:{Yn(c[g>>2]|0,c[h>>2]|0,c[i>>2]|0,c[j>>2]|0);l=f;return}default:{l=f;return}}}function Wn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f+20|0;h=f+16|0;i=f+12|0;j=f+8|0;k=f+4|0;n=f;c[g>>2]=a;c[h>>2]=b;c[i>>2]=d;c[j>>2]=e;if(((wo(c[c[h>>2]>>2]|0,c[c[i>>2]>>2]|0)|0)==0?(wo(c[(c[h>>2]|0)+4>>2]|0,c[(c[i>>2]|0)+4>>2]|0)|0)==0:0)?(wo(c[(c[h>>2]|0)+8>>2]|0,c[(c[i>>2]|0)+8>>2]|0)|0)==0:0){Ln(c[g>>2]|0,c[h>>2]|0,c[j>>2]|0);l=f;return}if(!(vo(c[(c[h>>2]|0)+8>>2]|0,0)|0)){Kp(c[c[g>>2]>>2]|0,c[c[i>>2]>>2]|0)|0;Kp(c[(c[g>>2]|0)+4>>2]|0,c[(c[i>>2]|0)+4>>2]|0)|0;Kp(c[(c[g>>2]|0)+8>>2]|0,c[(c[i>>2]|0)+8>>2]|0)|0;l=f;return}if(!(vo(c[(c[i>>2]|0)+8>>2]|0,0)|0)){Kp(c[c[g>>2]>>2]|0,c[c[h>>2]>>2]|0)|0;Kp(c[(c[g>>2]|0)+4>>2]|0,c[(c[h>>2]|0)+4>>2]|0)|0;Kp(c[(c[g>>2]|0)+8>>2]|0,c[(c[h>>2]|0)+8>>2]|0)|0;l=f;return}c[k>>2]=((vo(c[(c[h>>2]|0)+8>>2]|0,1)|0)!=0^1)&1;c[n>>2]=((vo(c[(c[i>>2]|0)+8>>2]|0,1)|0)!=0^1)&1;e=c[(c[j>>2]|0)+48+16>>2]|0;if(c[n>>2]|0)Kp(e,c[c[h>>2]>>2]|0)|0;else{Qn(e,c[(c[i>>2]|0)+8>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16>>2]|0,c[(c[j>>2]|0)+48+16>>2]|0,c[c[h>>2]>>2]|0,c[j>>2]|0)}e=c[(c[j>>2]|0)+48+16+4>>2]|0;if(c[k>>2]|0)Kp(e,c[c[i>>2]>>2]|0)|0;else{Qn(e,c[(c[h>>2]|0)+8>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+4>>2]|0,c[(c[j>>2]|0)+48+16+4>>2]|0,c[c[i>>2]>>2]|0,c[j>>2]|0)}Sn(c[(c[j>>2]|0)+48+16+8>>2]|0,c[(c[j>>2]|0)+48+16>>2]|0,c[(c[j>>2]|0)+48+16+4>>2]|0,c[j>>2]|0);e=c[(c[j>>2]|0)+48+16+12>>2]|0;k=c[(c[i>>2]|0)+8>>2]|0;n=Wp(3)|0;Un(e,k,n,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+12>>2]|0,c[(c[j>>2]|0)+48+16+12>>2]|0,c[(c[h>>2]|0)+4>>2]|0,c[j>>2]|0);n=c[(c[j>>2]|0)+48+16+16>>2]|0;k=c[(c[h>>2]|0)+8>>2]|0;e=Wp(3)|0;Un(n,k,e,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+16>>2]|0,c[(c[j>>2]|0)+48+16+16>>2]|0,c[(c[i>>2]|0)+4>>2]|0,c[j>>2]|0);Sn(c[(c[j>>2]|0)+48+16+20>>2]|0,c[(c[j>>2]|0)+48+16+12>>2]|0,c[(c[j>>2]|0)+48+16+16>>2]|0,c[j>>2]|0);e=(vo(c[(c[j>>2]|0)+48+16+8>>2]|0,0)|0)!=0;k=(c[j>>2]|0)+48+16|0;if(e){Pn(c[k+24>>2]|0,c[(c[j>>2]|0)+48+16>>2]|0,c[(c[j>>2]|0)+48+16+4>>2]|0,c[j>>2]|0);Pn(c[(c[j>>2]|0)+48+16+28>>2]|0,c[(c[j>>2]|0)+48+16+12>>2]|0,c[(c[j>>2]|0)+48+16+16>>2]|0,c[j>>2]|0);vn(c[(c[g>>2]|0)+8>>2]|0,c[(c[h>>2]|0)+8>>2]|0,c[(c[i>>2]|0)+8>>2]|0,c[j>>2]|0);vn(c[(c[g>>2]|0)+8>>2]|0,c[(c[g>>2]|0)+8>>2]|0,c[(c[j>>2]|0)+48+16+8>>2]|0,c[j>>2]|0);Qn(c[(c[j>>2]|0)+48+16+36>>2]|0,c[(c[j>>2]|0)+48+16+20>>2]|0,c[j>>2]|0);Qn(c[(c[j>>2]|0)+48+16+40>>2]|0,c[(c[j>>2]|0)+48+16+8>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+40>>2]|0,c[(c[j>>2]|0)+48+16+40>>2]|0,c[(c[j>>2]|0)+48+16+24>>2]|0,c[j>>2]|0);Sn(c[c[g>>2]>>2]|0,c[(c[j>>2]|0)+48+16+36>>2]|0,c[(c[j>>2]|0)+48+16+40>>2]|0,c[j>>2]|0);Rn(c[(c[j>>2]|0)+48+16+36>>2]|0,c[c[g>>2]>>2]|0,c[j>>2]|0);Sn(c[(c[j>>2]|0)+48+16+32>>2]|0,c[(c[j>>2]|0)+48+16+40>>2]|0,c[(c[j>>2]|0)+48+16+36>>2]|0,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+32>>2]|0,c[(c[j>>2]|0)+48+16+32>>2]|0,c[(c[j>>2]|0)+48+16+20>>2]|0,c[j>>2]|0);i=c[(c[j>>2]|0)+48+16+36>>2]|0;e=c[(c[j>>2]|0)+48+16+8>>2]|0;n=Wp(3)|0;Un(i,e,n,c[j>>2]|0);vn(c[(c[j>>2]|0)+48+16+36>>2]|0,c[(c[j>>2]|0)+48+16+36>>2]|0,c[(c[j>>2]|0)+48+16+28>>2]|0,c[j>>2]|0);Sn(c[(c[g>>2]|0)+4>>2]|0,c[(c[j>>2]|0)+48+16+32>>2]|0,c[(c[j>>2]|0)+48+16+36>>2]|0,c[j>>2]|0);n=c[(c[g>>2]|0)+4>>2]|0;e=c[(c[g>>2]|0)+4>>2]|0;i=Zn(c[j>>2]|0)|0;vn(n,e,i,c[j>>2]|0);l=f;return}i=(vo(c[k+20>>2]|0,0)|0)!=0;k=c[g>>2]|0;if(i){Op(c[k>>2]|0,1)|0;Op(c[(c[g>>2]|0)+4>>2]|0,1)|0;Op(c[(c[g>>2]|0)+8>>2]|0,0)|0;l=f;return}else{Ln(k,c[h>>2]|0,c[j>>2]|0);l=f;return}}function Xn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;c[f+20>>2]=a;c[f+16>>2]=b;c[f+12>>2]=d;c[f+8>>2]=e;c[g>>2]=45824;c[g+4>>2]=45707;We(45775,g)} -function Kw(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Ba=0,Ca=0,Da=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;do if(a>>>0<245){e=a>>>0<11?16:a+11&-8;f=e>>>3;g=c[17827]|0;h=g>>>f;if(h&3|0){i=(h&1^1)+f|0;j=71348+(i<<1<<2)|0;k=j+8|0;n=c[k>>2]|0;o=n+8|0;p=c[o>>2]|0;do if((j|0)!=(p|0)){if(p>>>0<(c[17831]|0)>>>0)Aa();q=p+12|0;if((c[q>>2]|0)==(n|0)){c[q>>2]=j;c[k>>2]=p;break}else Aa()}else c[17827]=g&~(1<>2]=p|3;k=n+p+4|0;c[k>>2]=c[k>>2]|1;r=o;l=b;return r|0}k=c[17829]|0;if(e>>>0>k>>>0){if(h|0){p=2<>>12&16;q=p>>>j;p=q>>>5&8;s=q>>>p;q=s>>>2&4;t=s>>>q;s=t>>>1&2;u=t>>>s;t=u>>>1&1;v=(p|j|q|s|t)+(u>>>t)|0;t=71348+(v<<1<<2)|0;u=t+8|0;s=c[u>>2]|0;q=s+8|0;j=c[q>>2]|0;do if((t|0)!=(j|0)){if(j>>>0<(c[17831]|0)>>>0)Aa();p=j+12|0;if((c[p>>2]|0)==(s|0)){c[p>>2]=t;c[u>>2]=j;w=g;break}else Aa()}else{p=g&~(1<>2]=e|3;u=s+e|0;c[u+4>>2]=j|1;c[u+j>>2]=j;if(k|0){t=c[17832]|0;f=k>>>3;h=71348+(f<<1<<2)|0;o=1<>2]|0;if(n>>>0<(c[17831]|0)>>>0)Aa();else{x=n;y=f}}else{c[17827]=w|o;x=h;y=h+8|0}c[y>>2]=t;c[x+12>>2]=t;c[t+8>>2]=x;c[t+12>>2]=h}c[17829]=j;c[17832]=u;r=q;l=b;return r|0}u=c[17828]|0;if(u){j=(u&0-u)+-1|0;h=j>>>12&16;t=j>>>h;j=t>>>5&8;o=t>>>j;t=o>>>2&4;f=o>>>t;o=f>>>1&2;n=f>>>o;f=n>>>1&1;i=c[71612+((j|h|t|o|f)+(n>>>f)<<2)>>2]|0;f=i;n=i;o=(c[i+4>>2]&-8)-e|0;while(1){i=c[f+16>>2]|0;if(!i){t=c[f+20>>2]|0;if(!t)break;else z=t}else z=i;i=(c[z+4>>2]&-8)-e|0;t=i>>>0>>0;f=z;n=t?z:n;o=t?i:o}f=c[17831]|0;if(n>>>0>>0)Aa();q=n+e|0;if(n>>>0>=q>>>0)Aa();s=c[n+24>>2]|0;v=c[n+12>>2]|0;do if((v|0)==(n|0)){i=n+20|0;t=c[i>>2]|0;if(!t){h=n+16|0;j=c[h>>2]|0;if(!j){A=0;break}else{B=j;C=h}}else{B=t;C=i}while(1){i=B+20|0;t=c[i>>2]|0;if(t|0){B=t;C=i;continue}i=B+16|0;t=c[i>>2]|0;if(!t)break;else{B=t;C=i}}if(C>>>0>>0)Aa();else{c[C>>2]=0;A=B;break}}else{i=c[n+8>>2]|0;if(i>>>0>>0)Aa();t=i+12|0;if((c[t>>2]|0)!=(n|0))Aa();h=v+8|0;if((c[h>>2]|0)==(n|0)){c[t>>2]=v;c[h>>2]=i;A=v;break}else Aa()}while(0);do if(s|0){v=c[n+28>>2]|0;f=71612+(v<<2)|0;if((n|0)==(c[f>>2]|0)){c[f>>2]=A;if(!A){c[17828]=u&~(1<>>0<(c[17831]|0)>>>0)Aa();v=s+16|0;if((c[v>>2]|0)==(n|0))c[v>>2]=A;else c[s+20>>2]=A;if(!A)break}v=c[17831]|0;if(A>>>0>>0)Aa();c[A+24>>2]=s;f=c[n+16>>2]|0;do if(f|0)if(f>>>0>>0)Aa();else{c[A+16>>2]=f;c[f+24>>2]=A;break}while(0);f=c[n+20>>2]|0;if(f|0)if(f>>>0<(c[17831]|0)>>>0)Aa();else{c[A+20>>2]=f;c[f+24>>2]=A;break}}while(0);if(o>>>0<16){s=o+e|0;c[n+4>>2]=s|3;u=n+s+4|0;c[u>>2]=c[u>>2]|1}else{c[n+4>>2]=e|3;c[q+4>>2]=o|1;c[q+o>>2]=o;if(k|0){u=c[17832]|0;s=k>>>3;f=71348+(s<<1<<2)|0;v=1<>2]|0;if(i>>>0<(c[17831]|0)>>>0)Aa();else{D=i;E=s}}else{c[17827]=g|v;D=f;E=f+8|0}c[E>>2]=u;c[D+12>>2]=u;c[u+8>>2]=D;c[u+12>>2]=f}c[17829]=o;c[17832]=q}r=n+8|0;l=b;return r|0}else F=e}else F=e}else if(a>>>0<=4294967231){f=a+11|0;u=f&-8;v=c[17828]|0;if(v){s=0-u|0;i=f>>>8;if(i)if(u>>>0>16777215)G=31;else{f=(i+1048320|0)>>>16&8;h=i<>>16&4;t=h<>>16&2;j=14-(i|f|h)+(t<>>15)|0;G=u>>>(j+7|0)&1|j<<1}else G=0;j=c[71612+(G<<2)>>2]|0;a:do if(!j){H=0;I=0;J=s;K=86}else{h=0;t=s;f=j;i=u<<((G|0)==31?0:25-(G>>>1)|0);p=0;while(1){L=(c[f+4>>2]&-8)-u|0;if(L>>>0>>0)if(!L){M=f;N=0;O=f;K=90;break a}else{P=f;Q=L}else{P=h;Q=t}L=c[f+20>>2]|0;f=c[f+16+(i>>>31<<2)>>2]|0;R=(L|0)==0|(L|0)==(f|0)?p:L;L=(f|0)==0;if(L){H=R;I=P;J=Q;K=86;break}else{h=P;t=Q;i=i<<(L&1^1);p=R}}}while(0);if((K|0)==86){if((H|0)==0&(I|0)==0){j=2<>>12&16;e=j>>>s;j=e>>>5&8;n=e>>>j;e=n>>>2&4;q=n>>>e;n=q>>>1&2;o=q>>>n;q=o>>>1&1;S=c[71612+((j|s|e|n|q)+(o>>>q)<<2)>>2]|0}else S=H;if(!S){T=I;U=J}else{M=I;N=J;O=S;K=90}}if((K|0)==90)while(1){K=0;q=(c[O+4>>2]&-8)-u|0;o=q>>>0>>0;n=o?q:N;q=o?O:M;o=c[O+16>>2]|0;if(o|0){M=q;N=n;O=o;K=90;continue}O=c[O+20>>2]|0;if(!O){T=q;U=n;break}else{M=q;N=n;K=90}}if((T|0)!=0?U>>>0<((c[17829]|0)-u|0)>>>0:0){n=c[17831]|0;if(T>>>0>>0)Aa();q=T+u|0;if(T>>>0>=q>>>0)Aa();o=c[T+24>>2]|0;e=c[T+12>>2]|0;do if((e|0)==(T|0)){s=T+20|0;j=c[s>>2]|0;if(!j){g=T+16|0;k=c[g>>2]|0;if(!k){V=0;break}else{W=k;X=g}}else{W=j;X=s}while(1){s=W+20|0;j=c[s>>2]|0;if(j|0){W=j;X=s;continue}s=W+16|0;j=c[s>>2]|0;if(!j)break;else{W=j;X=s}}if(X>>>0>>0)Aa();else{c[X>>2]=0;V=W;break}}else{s=c[T+8>>2]|0;if(s>>>0>>0)Aa();j=s+12|0;if((c[j>>2]|0)!=(T|0))Aa();g=e+8|0;if((c[g>>2]|0)==(T|0)){c[j>>2]=e;c[g>>2]=s;V=e;break}else Aa()}while(0);do if(o){e=c[T+28>>2]|0;n=71612+(e<<2)|0;if((T|0)==(c[n>>2]|0)){c[n>>2]=V;if(!V){n=v&~(1<>>0<(c[17831]|0)>>>0)Aa();n=o+16|0;if((c[n>>2]|0)==(T|0))c[n>>2]=V;else c[o+20>>2]=V;if(!V){Y=v;break}}n=c[17831]|0;if(V>>>0>>0)Aa();c[V+24>>2]=o;e=c[T+16>>2]|0;do if(e|0)if(e>>>0>>0)Aa();else{c[V+16>>2]=e;c[e+24>>2]=V;break}while(0);e=c[T+20>>2]|0;if(e)if(e>>>0<(c[17831]|0)>>>0)Aa();else{c[V+20>>2]=e;c[e+24>>2]=V;Y=v;break}else Y=v}else Y=v;while(0);do if(U>>>0>=16){c[T+4>>2]=u|3;c[q+4>>2]=U|1;c[q+U>>2]=U;v=U>>>3;if(U>>>0<256){o=71348+(v<<1<<2)|0;e=c[17827]|0;n=1<>2]|0;if(s>>>0<(c[17831]|0)>>>0)Aa();else{Z=s;_=v}}else{c[17827]=e|n;Z=o;_=o+8|0}c[_>>2]=q;c[Z+12>>2]=q;c[q+8>>2]=Z;c[q+12>>2]=o;break}o=U>>>8;if(o)if(U>>>0>16777215)aa=31;else{n=(o+1048320|0)>>>16&8;e=o<>>16&4;v=e<>>16&2;s=14-(o|n|e)+(v<>>15)|0;aa=U>>>(s+7|0)&1|s<<1}else aa=0;s=71612+(aa<<2)|0;c[q+28>>2]=aa;e=q+16|0;c[e+4>>2]=0;c[e>>2]=0;e=1<>2]=q;c[q+24>>2]=s;c[q+12>>2]=q;c[q+8>>2]=q;break}e=U<<((aa|0)==31?0:25-(aa>>>1)|0);v=c[s>>2]|0;while(1){if((c[v+4>>2]&-8|0)==(U|0)){K=148;break}ba=v+16+(e>>>31<<2)|0;s=c[ba>>2]|0;if(!s){K=145;break}else{e=e<<1;v=s}}if((K|0)==145)if(ba>>>0<(c[17831]|0)>>>0)Aa();else{c[ba>>2]=q;c[q+24>>2]=v;c[q+12>>2]=q;c[q+8>>2]=q;break}else if((K|0)==148){e=v+8|0;s=c[e>>2]|0;n=c[17831]|0;if(s>>>0>=n>>>0&v>>>0>=n>>>0){c[s+12>>2]=q;c[e>>2]=q;c[q+8>>2]=s;c[q+12>>2]=v;c[q+24>>2]=0;break}else Aa()}}else{s=U+u|0;c[T+4>>2]=s|3;e=T+s+4|0;c[e>>2]=c[e>>2]|1}while(0);r=T+8|0;l=b;return r|0}else F=u}else F=u}else F=-1;while(0);T=c[17829]|0;if(T>>>0>=F>>>0){U=T-F|0;ba=c[17832]|0;if(U>>>0>15){aa=ba+F|0;c[17832]=aa;c[17829]=U;c[aa+4>>2]=U|1;c[aa+U>>2]=U;c[ba+4>>2]=F|3}else{c[17829]=0;c[17832]=0;c[ba+4>>2]=T|3;U=ba+T+4|0;c[U>>2]=c[U>>2]|1}r=ba+8|0;l=b;return r|0}ba=c[17830]|0;if(ba>>>0>F>>>0){U=ba-F|0;c[17830]=U;T=c[17833]|0;aa=T+F|0;c[17833]=aa;c[aa+4>>2]=U|1;c[T+4>>2]=F|3;r=T+8|0;l=b;return r|0}if(!(c[17945]|0)){c[17947]=4096;c[17946]=4096;c[17948]=-1;c[17949]=-1;c[17950]=0;c[17938]=0;T=d&-16^1431655768;c[d>>2]=T;c[17945]=T;ca=4096}else ca=c[17947]|0;T=F+48|0;d=F+47|0;U=ca+d|0;aa=0-ca|0;ca=U&aa;if(ca>>>0<=F>>>0){r=0;l=b;return r|0}Y=c[17937]|0;if(Y|0?(Z=c[17935]|0,_=Z+ca|0,_>>>0<=Z>>>0|_>>>0>Y>>>0):0){r=0;l=b;return r|0}b:do if(!(c[17938]&4)){Y=c[17833]|0;c:do if(Y){_=71756;while(1){Z=c[_>>2]|0;if(Z>>>0<=Y>>>0?(da=_+4|0,(Z+(c[da>>2]|0)|0)>>>0>Y>>>0):0)break;Z=c[_+8>>2]|0;if(!Z){K=172;break c}else _=Z}v=U-ba&aa;if(v>>>0<2147483647){Z=hx(v|0)|0;if((Z|0)==((c[_>>2]|0)+(c[da>>2]|0)|0)){if((Z|0)!=(-1|0)){ea=v;fa=Z;K=190;break b}}else{ga=Z;ha=v;K=180}}}else K=172;while(0);do if(((K|0)==172?(Y=hx(0)|0,(Y|0)!=(-1|0)):0)?(u=Y,v=c[17946]|0,Z=v+-1|0,V=((Z&u|0)==0?0:(Z+u&0-v)-u|0)+ca|0,u=c[17935]|0,v=V+u|0,V>>>0>F>>>0&V>>>0<2147483647):0){Z=c[17937]|0;if(Z|0?v>>>0<=u>>>0|v>>>0>Z>>>0:0)break;Z=hx(V|0)|0;if((Z|0)==(Y|0)){ea=V;fa=Y;K=190;break b}else{ga=Z;ha=V;K=180}}while(0);d:do if((K|0)==180){V=0-ha|0;do if(T>>>0>ha>>>0&(ha>>>0<2147483647&(ga|0)!=(-1|0))?(Z=c[17947]|0,Y=d-ha+Z&0-Z,Y>>>0<2147483647):0)if((hx(Y|0)|0)==(-1|0)){hx(V|0)|0;break d}else{ia=Y+ha|0;break}else ia=ha;while(0);if((ga|0)!=(-1|0)){ea=ia;fa=ga;K=190;break b}}while(0);c[17938]=c[17938]|4;K=187}else K=187;while(0);if((((K|0)==187?ca>>>0<2147483647:0)?(ga=hx(ca|0)|0,ca=hx(0)|0,ga>>>0>>0&((ga|0)!=(-1|0)&(ca|0)!=(-1|0))):0)?(ia=ca-ga|0,ia>>>0>(F+40|0)>>>0):0){ea=ia;fa=ga;K=190}if((K|0)==190){ga=(c[17935]|0)+ea|0;c[17935]=ga;if(ga>>>0>(c[17936]|0)>>>0)c[17936]=ga;ga=c[17833]|0;do if(ga){ia=71756;while(1){ja=c[ia>>2]|0;ka=ia+4|0;la=c[ka>>2]|0;if((fa|0)==(ja+la|0)){K=200;break}ca=c[ia+8>>2]|0;if(!ca)break;else ia=ca}if(((K|0)==200?(c[ia+12>>2]&8|0)==0:0)?ga>>>0>>0&ga>>>0>=ja>>>0:0){c[ka>>2]=la+ea;ca=ga+8|0;ha=(ca&7|0)==0?0:0-ca&7;ca=ga+ha|0;d=ea-ha+(c[17830]|0)|0;c[17833]=ca;c[17830]=d;c[ca+4>>2]=d|1;c[ca+d+4>>2]=40;c[17834]=c[17949];break}d=c[17831]|0;if(fa>>>0>>0){c[17831]=fa;ma=fa}else ma=d;d=fa+ea|0;ca=71756;while(1){if((c[ca>>2]|0)==(d|0)){K=208;break}ha=c[ca+8>>2]|0;if(!ha){na=71756;break}else ca=ha}if((K|0)==208)if(!(c[ca+12>>2]&8)){c[ca>>2]=fa;ia=ca+4|0;c[ia>>2]=(c[ia>>2]|0)+ea;ia=fa+8|0;ha=fa+((ia&7|0)==0?0:0-ia&7)|0;ia=d+8|0;T=d+((ia&7|0)==0?0:0-ia&7)|0;ia=ha+F|0;da=T-ha-F|0;c[ha+4>>2]=F|3;do if((T|0)!=(ga|0)){if((T|0)==(c[17832]|0)){aa=(c[17829]|0)+da|0;c[17829]=aa;c[17832]=ia;c[ia+4>>2]=aa|1;c[ia+aa>>2]=aa;break}aa=c[T+4>>2]|0;if((aa&3|0)==1){ba=aa&-8;U=aa>>>3;e:do if(aa>>>0>=256){V=c[T+24>>2]|0;_=c[T+12>>2]|0;do if((_|0)==(T|0)){Y=T+16|0;Z=Y+4|0;v=c[Z>>2]|0;if(!v){u=c[Y>>2]|0;if(!u){oa=0;break}else{pa=u;qa=Y}}else{pa=v;qa=Z}while(1){Z=pa+20|0;v=c[Z>>2]|0;if(v|0){pa=v;qa=Z;continue}Z=pa+16|0;v=c[Z>>2]|0;if(!v)break;else{pa=v;qa=Z}}if(qa>>>0>>0)Aa();else{c[qa>>2]=0;oa=pa;break}}else{Z=c[T+8>>2]|0;if(Z>>>0>>0)Aa();v=Z+12|0;if((c[v>>2]|0)!=(T|0))Aa();Y=_+8|0;if((c[Y>>2]|0)==(T|0)){c[v>>2]=_;c[Y>>2]=Z;oa=_;break}else Aa()}while(0);if(!V)break;_=c[T+28>>2]|0;Z=71612+(_<<2)|0;do if((T|0)!=(c[Z>>2]|0)){if(V>>>0<(c[17831]|0)>>>0)Aa();Y=V+16|0;if((c[Y>>2]|0)==(T|0))c[Y>>2]=oa;else c[V+20>>2]=oa;if(!oa)break e}else{c[Z>>2]=oa;if(oa|0)break;c[17828]=c[17828]&~(1<<_);break e}while(0);_=c[17831]|0;if(oa>>>0<_>>>0)Aa();c[oa+24>>2]=V;Z=T+16|0;Y=c[Z>>2]|0;do if(Y|0)if(Y>>>0<_>>>0)Aa();else{c[oa+16>>2]=Y;c[Y+24>>2]=oa;break}while(0);Y=c[Z+4>>2]|0;if(!Y)break;if(Y>>>0<(c[17831]|0)>>>0)Aa();else{c[oa+20>>2]=Y;c[Y+24>>2]=oa;break}}else{Y=c[T+8>>2]|0;_=c[T+12>>2]|0;V=71348+(U<<1<<2)|0;do if((Y|0)!=(V|0)){if(Y>>>0>>0)Aa();if((c[Y+12>>2]|0)==(T|0))break;Aa()}while(0);if((_|0)==(Y|0)){c[17827]=c[17827]&~(1<>>0>>0)Aa();Z=_+8|0;if((c[Z>>2]|0)==(T|0)){ra=Z;break}Aa()}while(0);c[Y+12>>2]=_;c[ra>>2]=Y}while(0);sa=T+ba|0;ta=ba+da|0}else{sa=T;ta=da}U=sa+4|0;c[U>>2]=c[U>>2]&-2;c[ia+4>>2]=ta|1;c[ia+ta>>2]=ta;U=ta>>>3;if(ta>>>0<256){aa=71348+(U<<1<<2)|0;V=c[17827]|0;Z=1<>2]|0;if(v>>>0>=(c[17831]|0)>>>0){ua=v;va=U;break}Aa()}while(0);c[va>>2]=ia;c[ua+12>>2]=ia;c[ia+8>>2]=ua;c[ia+12>>2]=aa;break}Z=ta>>>8;do if(!Z)wa=0;else{if(ta>>>0>16777215){wa=31;break}V=(Z+1048320|0)>>>16&8;ba=Z<>>16&4;v=ba<>>16&2;u=14-(U|V|ba)+(v<>>15)|0;wa=ta>>>(u+7|0)&1|u<<1}while(0);Z=71612+(wa<<2)|0;c[ia+28>>2]=wa;aa=ia+16|0;c[aa+4>>2]=0;c[aa>>2]=0;aa=c[17828]|0;u=1<>2]=ia;c[ia+24>>2]=Z;c[ia+12>>2]=ia;c[ia+8>>2]=ia;break}u=ta<<((wa|0)==31?0:25-(wa>>>1)|0);aa=c[Z>>2]|0;while(1){if((c[aa+4>>2]&-8|0)==(ta|0)){K=278;break}xa=aa+16+(u>>>31<<2)|0;Z=c[xa>>2]|0;if(!Z){K=275;break}else{u=u<<1;aa=Z}}if((K|0)==275)if(xa>>>0<(c[17831]|0)>>>0)Aa();else{c[xa>>2]=ia;c[ia+24>>2]=aa;c[ia+12>>2]=ia;c[ia+8>>2]=ia;break}else if((K|0)==278){u=aa+8|0;Z=c[u>>2]|0;ba=c[17831]|0;if(Z>>>0>=ba>>>0&aa>>>0>=ba>>>0){c[Z+12>>2]=ia;c[u>>2]=ia;c[ia+8>>2]=Z;c[ia+12>>2]=aa;c[ia+24>>2]=0;break}else Aa()}}else{Z=(c[17830]|0)+da|0;c[17830]=Z;c[17833]=ia;c[ia+4>>2]=Z|1}while(0);r=ha+8|0;l=b;return r|0}else na=71756;while(1){ia=c[na>>2]|0;if(ia>>>0<=ga>>>0?(ya=ia+(c[na+4>>2]|0)|0,ya>>>0>ga>>>0):0)break;na=c[na+8>>2]|0}ha=ya+-47|0;ia=ha+8|0;da=ha+((ia&7|0)==0?0:0-ia&7)|0;ia=ga+16|0;ha=da>>>0>>0?ga:da;da=ha+8|0;T=fa+8|0;d=(T&7|0)==0?0:0-T&7;T=fa+d|0;ca=ea+-40-d|0;c[17833]=T;c[17830]=ca;c[T+4>>2]=ca|1;c[T+ca+4>>2]=40;c[17834]=c[17949];ca=ha+4|0;c[ca>>2]=27;c[da>>2]=c[17939];c[da+4>>2]=c[17940];c[da+8>>2]=c[17941];c[da+12>>2]=c[17942];c[17939]=fa;c[17940]=ea;c[17942]=0;c[17941]=da;da=ha+24|0;do{da=da+4|0;c[da>>2]=7}while((da+4|0)>>>0>>0);if((ha|0)!=(ga|0)){da=ha-ga|0;c[ca>>2]=c[ca>>2]&-2;c[ga+4>>2]=da|1;c[ha>>2]=da;T=da>>>3;if(da>>>0<256){d=71348+(T<<1<<2)|0;Z=c[17827]|0;u=1<>2]|0;if(ba>>>0<(c[17831]|0)>>>0)Aa();else{za=ba;Ba=T}}else{c[17827]=Z|u;za=d;Ba=d+8|0}c[Ba>>2]=ga;c[za+12>>2]=ga;c[ga+8>>2]=za;c[ga+12>>2]=d;break}d=da>>>8;if(d)if(da>>>0>16777215)Ca=31;else{u=(d+1048320|0)>>>16&8;Z=d<>>16&4;T=Z<>>16&2;ba=14-(d|u|Z)+(T<>>15)|0;Ca=da>>>(ba+7|0)&1|ba<<1}else Ca=0;ba=71612+(Ca<<2)|0;c[ga+28>>2]=Ca;c[ga+20>>2]=0;c[ia>>2]=0;Z=c[17828]|0;T=1<>2]=ga;c[ga+24>>2]=ba;c[ga+12>>2]=ga;c[ga+8>>2]=ga;break}T=da<<((Ca|0)==31?0:25-(Ca>>>1)|0);Z=c[ba>>2]|0;while(1){if((c[Z+4>>2]&-8|0)==(da|0)){K=304;break}Da=Z+16+(T>>>31<<2)|0;ba=c[Da>>2]|0;if(!ba){K=301;break}else{T=T<<1;Z=ba}}if((K|0)==301)if(Da>>>0<(c[17831]|0)>>>0)Aa();else{c[Da>>2]=ga;c[ga+24>>2]=Z;c[ga+12>>2]=ga;c[ga+8>>2]=ga;break}else if((K|0)==304){T=Z+8|0;da=c[T>>2]|0;ia=c[17831]|0;if(da>>>0>=ia>>>0&Z>>>0>=ia>>>0){c[da+12>>2]=ga;c[T>>2]=ga;c[ga+8>>2]=da;c[ga+12>>2]=Z;c[ga+24>>2]=0;break}else Aa()}}}else{da=c[17831]|0;if((da|0)==0|fa>>>0>>0)c[17831]=fa;c[17939]=fa;c[17940]=ea;c[17942]=0;c[17836]=c[17945];c[17835]=-1;da=0;do{T=71348+(da<<1<<2)|0;c[T+12>>2]=T;c[T+8>>2]=T;da=da+1|0}while((da|0)!=32);da=fa+8|0;Z=(da&7|0)==0?0:0-da&7;da=fa+Z|0;T=ea+-40-Z|0;c[17833]=da;c[17830]=T;c[da+4>>2]=T|1;c[da+T+4>>2]=40;c[17834]=c[17949]}while(0);ea=c[17830]|0;if(ea>>>0>F>>>0){fa=ea-F|0;c[17830]=fa;ea=c[17833]|0;ga=ea+F|0;c[17833]=ga;c[ga+4>>2]=fa|1;c[ea+4>>2]=F|3;r=ea+8|0;l=b;return r|0}}c[(xu()|0)>>2]=12;r=0;l=b;return r|0}function Lw(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;if(!a)return;b=a+-8|0;d=c[17831]|0;if(b>>>0>>0)Aa();e=c[a+-4>>2]|0;a=e&3;if((a|0)==1)Aa();f=e&-8;g=b+f|0;do if(!(e&1)){h=c[b>>2]|0;if(!a)return;i=b+(0-h)|0;j=h+f|0;if(i>>>0>>0)Aa();if((i|0)==(c[17832]|0)){k=g+4|0;l=c[k>>2]|0;if((l&3|0)!=3){m=i;n=j;break}c[17829]=j;c[k>>2]=l&-2;c[i+4>>2]=j|1;c[i+j>>2]=j;return}l=h>>>3;if(h>>>0<256){h=c[i+8>>2]|0;k=c[i+12>>2]|0;o=71348+(l<<1<<2)|0;if((h|0)!=(o|0)){if(h>>>0>>0)Aa();if((c[h+12>>2]|0)!=(i|0))Aa()}if((k|0)==(h|0)){c[17827]=c[17827]&~(1<>>0>>0)Aa();o=k+8|0;if((c[o>>2]|0)==(i|0))p=o;else Aa()}else p=k+8|0;c[h+12>>2]=k;c[p>>2]=h;m=i;n=j;break}h=c[i+24>>2]|0;k=c[i+12>>2]|0;do if((k|0)==(i|0)){o=i+16|0;l=o+4|0;q=c[l>>2]|0;if(!q){r=c[o>>2]|0;if(!r){s=0;break}else{t=r;u=o}}else{t=q;u=l}while(1){l=t+20|0;q=c[l>>2]|0;if(q|0){t=q;u=l;continue}l=t+16|0;q=c[l>>2]|0;if(!q)break;else{t=q;u=l}}if(u>>>0>>0)Aa();else{c[u>>2]=0;s=t;break}}else{l=c[i+8>>2]|0;if(l>>>0>>0)Aa();q=l+12|0;if((c[q>>2]|0)!=(i|0))Aa();o=k+8|0;if((c[o>>2]|0)==(i|0)){c[q>>2]=k;c[o>>2]=l;s=k;break}else Aa()}while(0);if(h){k=c[i+28>>2]|0;l=71612+(k<<2)|0;if((i|0)==(c[l>>2]|0)){c[l>>2]=s;if(!s){c[17828]=c[17828]&~(1<>>0<(c[17831]|0)>>>0)Aa();k=h+16|0;if((c[k>>2]|0)==(i|0))c[k>>2]=s;else c[h+20>>2]=s;if(!s){m=i;n=j;break}}k=c[17831]|0;if(s>>>0>>0)Aa();c[s+24>>2]=h;l=i+16|0;o=c[l>>2]|0;do if(o|0)if(o>>>0>>0)Aa();else{c[s+16>>2]=o;c[o+24>>2]=s;break}while(0);o=c[l+4>>2]|0;if(o)if(o>>>0<(c[17831]|0)>>>0)Aa();else{c[s+20>>2]=o;c[o+24>>2]=s;m=i;n=j;break}else{m=i;n=j}}else{m=i;n=j}}else{m=b;n=f}while(0);if(m>>>0>=g>>>0)Aa();f=g+4|0;b=c[f>>2]|0;if(!(b&1))Aa();if(!(b&2)){if((g|0)==(c[17833]|0)){s=(c[17830]|0)+n|0;c[17830]=s;c[17833]=m;c[m+4>>2]=s|1;if((m|0)!=(c[17832]|0))return;c[17832]=0;c[17829]=0;return}if((g|0)==(c[17832]|0)){s=(c[17829]|0)+n|0;c[17829]=s;c[17832]=m;c[m+4>>2]=s|1;c[m+s>>2]=s;return}s=(b&-8)+n|0;d=b>>>3;do if(b>>>0>=256){t=c[g+24>>2]|0;u=c[g+12>>2]|0;do if((u|0)==(g|0)){p=g+16|0;a=p+4|0;e=c[a>>2]|0;if(!e){o=c[p>>2]|0;if(!o){v=0;break}else{w=o;x=p}}else{w=e;x=a}while(1){a=w+20|0;e=c[a>>2]|0;if(e|0){w=e;x=a;continue}a=w+16|0;e=c[a>>2]|0;if(!e)break;else{w=e;x=a}}if(x>>>0<(c[17831]|0)>>>0)Aa();else{c[x>>2]=0;v=w;break}}else{a=c[g+8>>2]|0;if(a>>>0<(c[17831]|0)>>>0)Aa();e=a+12|0;if((c[e>>2]|0)!=(g|0))Aa();p=u+8|0;if((c[p>>2]|0)==(g|0)){c[e>>2]=u;c[p>>2]=a;v=u;break}else Aa()}while(0);if(t|0){u=c[g+28>>2]|0;j=71612+(u<<2)|0;if((g|0)==(c[j>>2]|0)){c[j>>2]=v;if(!v){c[17828]=c[17828]&~(1<>>0<(c[17831]|0)>>>0)Aa();u=t+16|0;if((c[u>>2]|0)==(g|0))c[u>>2]=v;else c[t+20>>2]=v;if(!v)break}u=c[17831]|0;if(v>>>0>>0)Aa();c[v+24>>2]=t;j=g+16|0;i=c[j>>2]|0;do if(i|0)if(i>>>0>>0)Aa();else{c[v+16>>2]=i;c[i+24>>2]=v;break}while(0);i=c[j+4>>2]|0;if(i|0)if(i>>>0<(c[17831]|0)>>>0)Aa();else{c[v+20>>2]=i;c[i+24>>2]=v;break}}}else{i=c[g+8>>2]|0;u=c[g+12>>2]|0;t=71348+(d<<1<<2)|0;if((i|0)!=(t|0)){if(i>>>0<(c[17831]|0)>>>0)Aa();if((c[i+12>>2]|0)!=(g|0))Aa()}if((u|0)==(i|0)){c[17827]=c[17827]&~(1<>>0<(c[17831]|0)>>>0)Aa();t=u+8|0;if((c[t>>2]|0)==(g|0))y=t;else Aa()}else y=u+8|0;c[i+12>>2]=u;c[y>>2]=i}while(0);c[m+4>>2]=s|1;c[m+s>>2]=s;if((m|0)==(c[17832]|0)){c[17829]=s;return}else z=s}else{c[f>>2]=b&-2;c[m+4>>2]=n|1;c[m+n>>2]=n;z=n}n=z>>>3;if(z>>>0<256){b=71348+(n<<1<<2)|0;f=c[17827]|0;s=1<>2]|0;if(y>>>0<(c[17831]|0)>>>0)Aa();else{A=y;B=n}}else{c[17827]=f|s;A=b;B=b+8|0}c[B>>2]=m;c[A+12>>2]=m;c[m+8>>2]=A;c[m+12>>2]=b;return}b=z>>>8;if(b)if(z>>>0>16777215)C=31;else{A=(b+1048320|0)>>>16&8;B=b<>>16&4;s=B<>>16&2;f=14-(b|A|B)+(s<>>15)|0;C=z>>>(f+7|0)&1|f<<1}else C=0;f=71612+(C<<2)|0;c[m+28>>2]=C;c[m+20>>2]=0;c[m+16>>2]=0;B=c[17828]|0;s=1<>>1)|0);b=c[f>>2]|0;while(1){if((c[b+4>>2]&-8|0)==(z|0)){D=130;break}E=b+16+(A>>>31<<2)|0;n=c[E>>2]|0;if(!n){D=127;break}else{A=A<<1;b=n}}if((D|0)==127)if(E>>>0<(c[17831]|0)>>>0)Aa();else{c[E>>2]=m;c[m+24>>2]=b;c[m+12>>2]=m;c[m+8>>2]=m;break}else if((D|0)==130){A=b+8|0;j=c[A>>2]|0;n=c[17831]|0;if(j>>>0>=n>>>0&b>>>0>=n>>>0){c[j+12>>2]=m;c[A>>2]=m;c[m+8>>2]=j;c[m+12>>2]=b;c[m+24>>2]=0;break}else Aa()}}else{c[17828]=B|s;c[f>>2]=m;c[m+24>>2]=f;c[m+12>>2]=m;c[m+8>>2]=m}while(0);m=(c[17835]|0)+-1|0;c[17835]=m;if(!m)F=71764;else return;while(1){m=c[F>>2]|0;if(!m)break;else F=m+8|0}c[17835]=-1;return}function Mw(a,b){a=a|0;b=b|0;var d=0,e=0;if(a){d=S(b,a)|0;if((b|a)>>>0>65535)e=((d>>>0)/(a>>>0)|0|0)==(b|0)?d:-1;else e=d}else e=0;d=Kw(e)|0;if(!d)return d|0;if(!(c[d+-4>>2]&3))return d|0;Uw(d|0,0,e|0)|0;return d|0}function Nw(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;if(!a){d=Kw(b)|0;return d|0}if(b>>>0>4294967231){c[(xu()|0)>>2]=12;d=0;return d|0}e=Ow(a+-8|0,b>>>0<11?16:b+11&-8)|0;if(e|0){d=e+8|0;return d|0}e=Kw(b)|0;if(!e){d=0;return d|0}f=c[a+-4>>2]|0;g=(f&-8)-((f&3|0)==0?8:4)|0;_w(e|0,a|0,(g>>>0>>0?g:b)|0)|0;Lw(a);d=e;return d|0}function Ow(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=a+4|0;e=c[d>>2]|0;f=e&-8;g=a+f|0;h=c[17831]|0;i=e&3;if(!((i|0)!=1&a>>>0>=h>>>0&a>>>0>>0))Aa();j=c[g+4>>2]|0;if(!(j&1))Aa();if(!i){if(b>>>0<256){k=0;return k|0}if(f>>>0>=(b+4|0)>>>0?(f-b|0)>>>0<=c[17947]<<1>>>0:0){k=a;return k|0}k=0;return k|0}if(f>>>0>=b>>>0){i=f-b|0;if(i>>>0<=15){k=a;return k|0}l=a+b|0;c[d>>2]=e&1|b|2;c[l+4>>2]=i|3;m=l+i+4|0;c[m>>2]=c[m>>2]|1;Pw(l,i);k=a;return k|0}if((g|0)==(c[17833]|0)){i=(c[17830]|0)+f|0;if(i>>>0<=b>>>0){k=0;return k|0}l=i-b|0;i=a+b|0;c[d>>2]=e&1|b|2;c[i+4>>2]=l|1;c[17833]=i;c[17830]=l;k=a;return k|0}if((g|0)==(c[17832]|0)){l=(c[17829]|0)+f|0;if(l>>>0>>0){k=0;return k|0}i=l-b|0;if(i>>>0>15){m=a+b|0;n=m+i|0;c[d>>2]=e&1|b|2;c[m+4>>2]=i|1;c[n>>2]=i;o=n+4|0;c[o>>2]=c[o>>2]&-2;p=m;q=i}else{c[d>>2]=e&1|l|2;i=a+l+4|0;c[i>>2]=c[i>>2]|1;p=0;q=0}c[17829]=q;c[17832]=p;k=a;return k|0}if(j&2|0){k=0;return k|0}p=(j&-8)+f|0;if(p>>>0>>0){k=0;return k|0}f=p-b|0;q=j>>>3;do if(j>>>0>=256){i=c[g+24>>2]|0;l=c[g+12>>2]|0;do if((l|0)==(g|0)){m=g+16|0;o=m+4|0;n=c[o>>2]|0;if(!n){r=c[m>>2]|0;if(!r){s=0;break}else{t=r;u=m}}else{t=n;u=o}while(1){o=t+20|0;n=c[o>>2]|0;if(n|0){t=n;u=o;continue}o=t+16|0;n=c[o>>2]|0;if(!n)break;else{t=n;u=o}}if(u>>>0>>0)Aa();else{c[u>>2]=0;s=t;break}}else{o=c[g+8>>2]|0;if(o>>>0>>0)Aa();n=o+12|0;if((c[n>>2]|0)!=(g|0))Aa();m=l+8|0;if((c[m>>2]|0)==(g|0)){c[n>>2]=l;c[m>>2]=o;s=l;break}else Aa()}while(0);if(i|0){l=c[g+28>>2]|0;o=71612+(l<<2)|0;if((g|0)==(c[o>>2]|0)){c[o>>2]=s;if(!s){c[17828]=c[17828]&~(1<>>0<(c[17831]|0)>>>0)Aa();l=i+16|0;if((c[l>>2]|0)==(g|0))c[l>>2]=s;else c[i+20>>2]=s;if(!s)break}l=c[17831]|0;if(s>>>0>>0)Aa();c[s+24>>2]=i;o=g+16|0;m=c[o>>2]|0;do if(m|0)if(m>>>0>>0)Aa();else{c[s+16>>2]=m;c[m+24>>2]=s;break}while(0);m=c[o+4>>2]|0;if(m|0)if(m>>>0<(c[17831]|0)>>>0)Aa();else{c[s+20>>2]=m;c[m+24>>2]=s;break}}}else{m=c[g+8>>2]|0;l=c[g+12>>2]|0;i=71348+(q<<1<<2)|0;if((m|0)!=(i|0)){if(m>>>0>>0)Aa();if((c[m+12>>2]|0)!=(g|0))Aa()}if((l|0)==(m|0)){c[17827]=c[17827]&~(1<>>0>>0)Aa();i=l+8|0;if((c[i>>2]|0)==(g|0))v=i;else Aa()}else v=l+8|0;c[m+12>>2]=l;c[v>>2]=m}while(0);if(f>>>0<16){c[d>>2]=p|e&1|2;v=a+p+4|0;c[v>>2]=c[v>>2]|1;k=a;return k|0}else{v=a+b|0;c[d>>2]=e&1|b|2;c[v+4>>2]=f|3;b=v+f+4|0;c[b>>2]=c[b>>2]|1;Pw(v,f);k=a;return k|0}return 0}function Pw(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=a+b|0;e=c[a+4>>2]|0;do if(!(e&1)){f=c[a>>2]|0;if(!(e&3))return;g=a+(0-f)|0;h=f+b|0;i=c[17831]|0;if(g>>>0>>0)Aa();if((g|0)==(c[17832]|0)){j=d+4|0;k=c[j>>2]|0;if((k&3|0)!=3){l=g;m=h;break}c[17829]=h;c[j>>2]=k&-2;c[g+4>>2]=h|1;c[g+h>>2]=h;return}k=f>>>3;if(f>>>0<256){f=c[g+8>>2]|0;j=c[g+12>>2]|0;n=71348+(k<<1<<2)|0;if((f|0)!=(n|0)){if(f>>>0>>0)Aa();if((c[f+12>>2]|0)!=(g|0))Aa()}if((j|0)==(f|0)){c[17827]=c[17827]&~(1<>>0>>0)Aa();n=j+8|0;if((c[n>>2]|0)==(g|0))o=n;else Aa()}else o=j+8|0;c[f+12>>2]=j;c[o>>2]=f;l=g;m=h;break}f=c[g+24>>2]|0;j=c[g+12>>2]|0;do if((j|0)==(g|0)){n=g+16|0;k=n+4|0;p=c[k>>2]|0;if(!p){q=c[n>>2]|0;if(!q){r=0;break}else{s=q;t=n}}else{s=p;t=k}while(1){k=s+20|0;p=c[k>>2]|0;if(p|0){s=p;t=k;continue}k=s+16|0;p=c[k>>2]|0;if(!p)break;else{s=p;t=k}}if(t>>>0>>0)Aa();else{c[t>>2]=0;r=s;break}}else{k=c[g+8>>2]|0;if(k>>>0>>0)Aa();p=k+12|0;if((c[p>>2]|0)!=(g|0))Aa();n=j+8|0;if((c[n>>2]|0)==(g|0)){c[p>>2]=j;c[n>>2]=k;r=j;break}else Aa()}while(0);if(f){j=c[g+28>>2]|0;i=71612+(j<<2)|0;if((g|0)==(c[i>>2]|0)){c[i>>2]=r;if(!r){c[17828]=c[17828]&~(1<>>0<(c[17831]|0)>>>0)Aa();j=f+16|0;if((c[j>>2]|0)==(g|0))c[j>>2]=r;else c[f+20>>2]=r;if(!r){l=g;m=h;break}}j=c[17831]|0;if(r>>>0>>0)Aa();c[r+24>>2]=f;i=g+16|0;k=c[i>>2]|0;do if(k|0)if(k>>>0>>0)Aa();else{c[r+16>>2]=k;c[k+24>>2]=r;break}while(0);k=c[i+4>>2]|0;if(k)if(k>>>0<(c[17831]|0)>>>0)Aa();else{c[r+20>>2]=k;c[k+24>>2]=r;l=g;m=h;break}else{l=g;m=h}}else{l=g;m=h}}else{l=a;m=b}while(0);b=c[17831]|0;if(d>>>0>>0)Aa();a=d+4|0;r=c[a>>2]|0;if(!(r&2)){if((d|0)==(c[17833]|0)){s=(c[17830]|0)+m|0;c[17830]=s;c[17833]=l;c[l+4>>2]=s|1;if((l|0)!=(c[17832]|0))return;c[17832]=0;c[17829]=0;return}if((d|0)==(c[17832]|0)){s=(c[17829]|0)+m|0;c[17829]=s;c[17832]=l;c[l+4>>2]=s|1;c[l+s>>2]=s;return}s=(r&-8)+m|0;t=r>>>3;do if(r>>>0>=256){o=c[d+24>>2]|0;e=c[d+12>>2]|0;do if((e|0)==(d|0)){k=d+16|0;j=k+4|0;f=c[j>>2]|0;if(!f){n=c[k>>2]|0;if(!n){u=0;break}else{v=n;w=k}}else{v=f;w=j}while(1){j=v+20|0;f=c[j>>2]|0;if(f|0){v=f;w=j;continue}j=v+16|0;f=c[j>>2]|0;if(!f)break;else{v=f;w=j}}if(w>>>0>>0)Aa();else{c[w>>2]=0;u=v;break}}else{j=c[d+8>>2]|0;if(j>>>0>>0)Aa();f=j+12|0;if((c[f>>2]|0)!=(d|0))Aa();k=e+8|0;if((c[k>>2]|0)==(d|0)){c[f>>2]=e;c[k>>2]=j;u=e;break}else Aa()}while(0);if(o|0){e=c[d+28>>2]|0;h=71612+(e<<2)|0;if((d|0)==(c[h>>2]|0)){c[h>>2]=u;if(!u){c[17828]=c[17828]&~(1<>>0<(c[17831]|0)>>>0)Aa();e=o+16|0;if((c[e>>2]|0)==(d|0))c[e>>2]=u;else c[o+20>>2]=u;if(!u)break}e=c[17831]|0;if(u>>>0>>0)Aa();c[u+24>>2]=o;h=d+16|0;g=c[h>>2]|0;do if(g|0)if(g>>>0>>0)Aa();else{c[u+16>>2]=g;c[g+24>>2]=u;break}while(0);g=c[h+4>>2]|0;if(g|0)if(g>>>0<(c[17831]|0)>>>0)Aa();else{c[u+20>>2]=g;c[g+24>>2]=u;break}}}else{g=c[d+8>>2]|0;e=c[d+12>>2]|0;o=71348+(t<<1<<2)|0;if((g|0)!=(o|0)){if(g>>>0>>0)Aa();if((c[g+12>>2]|0)!=(d|0))Aa()}if((e|0)==(g|0)){c[17827]=c[17827]&~(1<>>0>>0)Aa();o=e+8|0;if((c[o>>2]|0)==(d|0))x=o;else Aa()}else x=e+8|0;c[g+12>>2]=e;c[x>>2]=g}while(0);c[l+4>>2]=s|1;c[l+s>>2]=s;if((l|0)==(c[17832]|0)){c[17829]=s;return}else y=s}else{c[a>>2]=r&-2;c[l+4>>2]=m|1;c[l+m>>2]=m;y=m}m=y>>>3;if(y>>>0<256){r=71348+(m<<1<<2)|0;a=c[17827]|0;s=1<>2]|0;if(x>>>0<(c[17831]|0)>>>0)Aa();else{z=x;A=m}}else{c[17827]=a|s;z=r;A=r+8|0}c[A>>2]=l;c[z+12>>2]=l;c[l+8>>2]=z;c[l+12>>2]=r;return}r=y>>>8;if(r)if(y>>>0>16777215)B=31;else{z=(r+1048320|0)>>>16&8;A=r<>>16&4;s=A<>>16&2;a=14-(r|z|A)+(s<>>15)|0;B=y>>>(a+7|0)&1|a<<1}else B=0;a=71612+(B<<2)|0;c[l+28>>2]=B;c[l+20>>2]=0;c[l+16>>2]=0;A=c[17828]|0;s=1<>2]=l;c[l+24>>2]=a;c[l+12>>2]=l;c[l+8>>2]=l;return}s=y<<((B|0)==31?0:25-(B>>>1)|0);B=c[a>>2]|0;while(1){if((c[B+4>>2]&-8|0)==(y|0)){C=127;break}D=B+16+(s>>>31<<2)|0;a=c[D>>2]|0;if(!a){C=124;break}else{s=s<<1;B=a}}if((C|0)==124){if(D>>>0<(c[17831]|0)>>>0)Aa();c[D>>2]=l;c[l+24>>2]=B;c[l+12>>2]=l;c[l+8>>2]=l;return}else if((C|0)==127){C=B+8|0;D=c[C>>2]|0;s=c[17831]|0;if(!(D>>>0>=s>>>0&B>>>0>=s>>>0))Aa();c[D+12>>2]=l;c[C>>2]=l;c[l+8>>2]=D;c[l+12>>2]=B;c[l+24>>2]=0;return}}function Qw(a,b){a=a|0;b=b|0;var c=0;if(a>>>0<9){c=Kw(b)|0;return c|0}else{c=Rw(a,b)|0;return c|0}return 0}function Rw(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;d=a>>>0<16?16:a;if(!(d+-1&d))e=d;else{a=16;while(1)if(a>>>0>>0)a=a<<1;else{e=a;break}}if((-64-e|0)>>>0<=b>>>0){c[(xu()|0)>>2]=12;f=0;return f|0}a=b>>>0<11?16:b+11&-8;b=Kw(a+12+e|0)|0;if(!b){f=0;return f|0}d=b+-8|0;do if(b&e+-1){g=(b+e+-1&0-e)+-8|0;h=d;i=(g-h|0)>>>0>15?g:g+e|0;g=i-h|0;h=b+-4|0;j=c[h>>2]|0;k=(j&-8)-g|0;if(!(j&3)){c[i>>2]=(c[d>>2]|0)+g;c[i+4>>2]=k;l=i;break}else{j=i+4|0;c[j>>2]=k|c[j>>2]&1|2;m=i+k+4|0;c[m>>2]=c[m>>2]|1;c[h>>2]=g|c[h>>2]&1|2;c[j>>2]=c[j>>2]|1;Pw(d,g);l=i;break}}else l=d;while(0);d=l+4|0;b=c[d>>2]|0;if(b&3|0?(e=b&-8,e>>>0>(a+16|0)>>>0):0){i=e-a|0;e=l+a|0;c[d>>2]=a|b&1|2;c[e+4>>2]=i|3;b=e+i+4|0;c[b>>2]=c[b>>2]|1;Pw(e,i)}f=l+8|0;return f|0}function Sw(){}function Tw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=b-d>>>0;e=b-d-(c>>>0>a>>>0|0)>>>0;return (D=e,a-c>>>0|0)|0}function Uw(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;if((e|0)>=20){d=d&255;g=b&3;h=d|d<<8|d<<16|d<<24;i=f&~3;if(g){g=b+4-g|0;while((b|0)<(g|0)){a[b>>0]=d;b=b+1|0}}while((b|0)<(i|0)){c[b>>2]=h;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return b-e|0}function Vw(a){a=a|0;return 0}function Ww(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=a+c>>>0;return (D=b+d+(e>>>0>>0|0)>>>0,e|0)|0}function Xw(b){b=b|0;var c=0;c=a[n+(b&255)>>0]|0;if((c|0)<8)return c|0;c=a[n+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[n+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (a[n+(b>>>24)>>0]|0)+24|0}function Yw(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0;g=a;h=b;i=h;j=d;k=e;l=k;if(!i){m=(f|0)!=0;if(!l){if(m){c[f>>2]=(g>>>0)%(j>>>0);c[f+4>>2]=0}n=0;o=(g>>>0)/(j>>>0)>>>0;return (D=n,o)|0}else{if(!m){n=0;o=0;return (D=n,o)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;o=0;return (D=n,o)|0}}m=(l|0)==0;do if(j){if(!m){p=(V(l|0)|0)-(V(i|0)|0)|0;if(p>>>0<=31){q=p+1|0;r=31-p|0;s=p-31>>31;t=q;u=g>>>(q>>>0)&s|i<>>(q>>>0)&s;w=0;x=g<>2]=a|0;c[f+4>>2]=h|b&0;n=0;o=0;return (D=n,o)|0}r=j-1|0;if(r&j|0){s=(V(j|0)|0)+33-(V(i|0)|0)|0;q=64-s|0;p=32-s|0;y=p>>31;z=s-32|0;A=z>>31;t=s;u=p-1>>31&i>>>(z>>>0)|(i<>>(s>>>0))&A;v=A&i>>>(s>>>0);w=g<>>(z>>>0))&y|g<>31;break}if(f|0){c[f>>2]=r&g;c[f+4>>2]=0}if((j|0)==1){n=h|b&0;o=a|0|0;return (D=n,o)|0}else{r=Xw(j|0)|0;n=i>>>(r>>>0)|0;o=i<<32-r|g>>>(r>>>0)|0;return (D=n,o)|0}}else{if(m){if(f|0){c[f>>2]=(i>>>0)%(j>>>0);c[f+4>>2]=0}n=0;o=(i>>>0)/(j>>>0)>>>0;return (D=n,o)|0}if(!g){if(f|0){c[f>>2]=0;c[f+4>>2]=(i>>>0)%(l>>>0)}n=0;o=(i>>>0)/(l>>>0)>>>0;return (D=n,o)|0}r=l-1|0;if(!(r&l)){if(f|0){c[f>>2]=a|0;c[f+4>>2]=r&i|b&0}n=0;o=i>>>((Xw(l|0)|0)>>>0);return (D=n,o)|0}r=(V(l|0)|0)-(V(i|0)|0)|0;if(r>>>0<=30){s=r+1|0;p=31-r|0;t=s;u=i<>>(s>>>0);v=i>>>(s>>>0);w=0;x=g<>2]=a|0;c[f+4>>2]=h|b&0;n=0;o=0;return (D=n,o)|0}while(0);if(!t){B=x;C=w;E=v;F=u;G=0;H=0}else{b=d|0|0;d=k|e&0;e=Ww(b|0,d|0,-1,-1)|0;k=D;h=x;x=w;w=v;v=u;u=t;t=0;do{a=h;h=x>>>31|h<<1;x=t|x<<1;g=v<<1|a>>>31|0;a=v>>>31|w<<1|0;Tw(e|0,k|0,g|0,a|0)|0;i=D;l=i>>31|((i|0)<0?-1:0)<<1;t=l&1;v=Tw(g|0,a|0,l&b|0,(((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1)&d|0)|0;w=D;u=u-1|0}while((u|0)!=0);B=h;C=x;E=w;F=v;G=0;H=t}t=C;C=0;if(f|0){c[f>>2]=F;c[f+4>>2]=E}n=(t|0)>>>31|(B|C)<<1|(C<<1|t>>>31)&0|G;o=(t<<1|0>>>31)&-2|H;return (D=n,o)|0}function Zw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=b>>31|((b|0)<0?-1:0)<<1;f=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;g=d>>31|((d|0)<0?-1:0)<<1;h=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;i=Tw(e^a|0,f^b|0,e|0,f|0)|0;b=D;a=g^e;e=h^f;return Tw((Yw(i,b,Tw(g^c|0,h^d|0,g|0,h|0)|0,D,0)|0)^a|0,D^e|0,a|0,e|0)|0}function _w(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;if((e|0)>=4096)return Va(b|0,d|0,e|0)|0;f=b|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}while((e|0)>=4){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0;e=e-4|0}}while((e|0)>0){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}return f|0}function $w(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else _w(b,c,d)|0;return b|0}function ax(a){a=a|0;return (a&255)<<24|(a>>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function bx(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>c;return a>>>c|(b&(1<>c-32|0}function cx(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>>c;return a>>>c|(b&(1<>>c-32|0}function dx(a){a=a|0;return 0}function ex(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Yw(a,b,c,d,0)|0}function fx(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=a&65535;d=b&65535;e=S(d,c)|0;f=a>>>16;a=(e>>>16)+(S(d,f)|0)|0;d=b>>>16;b=S(d,c)|0;return (D=(a>>>16)+(S(d,f)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|e&65535|0)|0}function gx(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;a=c;c=fx(e,a)|0;f=D;return (D=(S(b,a)|0)+(S(d,e)|0)+f|f&0,c|0|0)|0}function hx(a){a=a|0;var b=0,d=0;a=a+15&-16|0;b=c[i>>2]|0;d=b+a|0;if((a|0)>0&(d|0)<(b|0)|(d|0)<0){_()|0;Ka(12);return -1}c[i>>2]=d;if((d|0)>(Z()|0)?(Y()|0)==0:0){Ka(12);c[i>>2]=b;return -1}return b|0}function ix(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b<>>32-c;return a<>2]|0,c[g>>2]|0)|0}function kx(){return 0}function lx(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,m=0;f=l;l=l+16|0;g=f|0;h=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;j=e>>31|((e|0)<0?-1:0)<<1;k=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;m=Tw(h^a|0,i^b|0,h|0,i|0)|0;b=D;Yw(m,b,Tw(j^d|0,k^e|0,j|0,k|0)|0,D,g)|0;k=Tw(c[g>>2]^h|0,c[g+4>>2]^i|0,h|0,i|0)|0;i=D;l=f;return (D=i,k)|0}function mx(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ub[a&63](b|0,c|0,d|0)|0}function nx(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;vb[a&15](b|0,c|0,d|0,e|0,f|0)}function ox(a,b){a=a|0;b=b|0;wb[a&15](b|0)}function px(a,b,c){a=a|0;b=b|0;c=c|0;xb[a&7](b|0,c|0)}function qx(a,b){a=a|0;b=b|0;return yb[a&15](b|0)|0}function rx(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;zb[a&7](b|0,c|0,d|0)}function sx(a){a=a|0;Ab[a&3]()}function tx(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Bb[a&7](b|0,c|0,d|0,e|0)|0}function ux(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;Cb[a&1](b|0,c|0,d|0,e|0,f|0,g|0)}function vx(a,b,c){a=a|0;b=b|0;c=c|0;return Db[a&7](b|0,c|0)|0}function wx(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;Eb[a&1](b|0,c|0,d|0,e|0)}function xx(a,b,c){a=a|0;b=b|0;c=c|0;aa(0);return 0}function yx(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ba(1)}function zx(a){a=a|0;ca(2)}function Ax(a,b){a=a|0;b=b|0;da(3)}function Bx(a){a=a|0;ea(4);return 0}function Cx(a,b,c){a=a|0;b=b|0;c=c|0;fa(5)}function Dx(){ga(6)}function Ex(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ha(7);return 0}function Fx(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ia(8)}function Gx(a,b){a=a|0;b=b|0;ja(9);return 0}function Hx(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(10)} +function Ab(a){a=a|0;var b=0;b=l;l=l+a|0;l=l+15&-16;if((l|0)>=(m|0))$(a|0);return b|0}function Bb(){return l|0}function Cb(a){a=a|0;l=a}function Db(a,b){a=a|0;b=b|0;l=a;m=b}function Eb(a,b){a=a|0;b=b|0;if(!o){o=a;p=b}}function Fb(a){a=a|0;D=a}function Gb(){return D|0}function Hb(a){a=a|0;var b=0;b=Pb(32,19010,38)|0;jc(a,b);return b|0}function Ib(a){a=a|0;var b=0;b=Pb(32,19010,56)|0;hc(a,b);return b|0}function Jb(a){a=a|0;var b=0;b=Pb(32,19010,73)|0;lc(a,b);return b|0}function Kb(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0;f=d+8|0;e=Pb(f,19010,87)|0;cr(e+8|0,c|0,d|0)|0;c=Xp(b)|0;d=e+4|0;a[d>>0]=c;a[d+1>>0]=c>>8;a[d+2>>0]=c>>16;a[d+3>>0]=c>>24;d=Xp(f)|0;a[e>>0]=d;a[e+1>>0]=d>>8;a[e+2>>0]=d>>16;a[e+3>>0]=d>>24;return e|0}function Lb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=g;if((no(e,f)|0)!=1){f=0;l=g;return f|0}e=f;c[e>>2]=a;c[e+4>>2]=b;c[f+8>>2]=d;e=Pb(24,19010,117)|0;c[e>>2]=c[f>>2];c[e+4>>2]=c[f+4>>2];c[e+8>>2]=c[f+8>>2];c[e+12>>2]=c[f+12>>2];c[e+16>>2]=c[f+16>>2];c[e+20>>2]=c[f+20>>2];f=e;l=g;return f|0}function Mb(a){a=a|0;D=c[a+4>>2]|0;return c[a>>2]|0}function Nb(a){a=a|0;return c[a+8>>2]|0}function Ob(a){a=a|0;return a+12|0}function Pb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+64|0;if((l|0)>=(m|0))$(64);p=q+24|0;o=q+8|0;n=q;e=q+56|0;f=q+52|0;g=q+48|0;h=q+44|0;i=q+40|0;j=q+36|0;k=q+32|0;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;if((c[e>>2]|0)>>>0>41943040){c[i>>2]=74;if((c[178]|0)==-1)c[178]=Wb(1,0,19017,19037,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[178]|0))Vb();i=c[g>>2]|0;c[n>>2]=c[f>>2];c[n+4>>2]=i;Zb(1,61295,n);Vb()}c[h>>2]=Qb(c[e>>2]|0,c[f>>2]|0,c[g>>2]|0)|0;if(c[h>>2]|0){l=q;return c[h>>2]|0}c[j>>2]=81;if((c[179]|0)==-1)c[179]=Wb(1,20980,19017,19037,c[j>>2]|0)|0;if((Xb()|0)<=0){if(c[179]|0){q=dp(c[(zo()|0)>>2]|0)|0;c[o>>2]=19053;c[o+4>>2]=19017;c[o+8>>2]=81;c[o+12>>2]=q;cc(1,20980,20531,o)}}else Yb(-1,0);c[k>>2]=82;if((c[180]|0)==-1)c[180]=Wb(1,0,19017,19037,c[k>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[180]|0))Vb();c[p>>2]=19017;c[p+4>>2]=82;Zb(1,61295,p);Vb();return 0}function Qb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=h+16|0;f=h+12|0;g=h;c[f>>2]=a;c[h+8>>2]=b;c[h+4>>2]=d;c[g>>2]=Oq(c[f>>2]|0)|0;if(!(c[g>>2]|0)){c[e>>2]=0;g=c[e>>2]|0;l=h;return g|0}else{Yq(c[g>>2]|0,0,c[f>>2]|0)|0;c[e>>2]=c[g>>2];g=c[e>>2]|0;l=h;return g|0}return 0}function Rb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=j;e=j+20|0;f=j+16|0;g=j+12|0;h=j+8|0;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;if(c[e>>2]|0){Pq(c[e>>2]|0);l=j;return}c[h>>2]=311;if((c[181]|0)==-1)c[181]=Wb(1,0,19017,19060,c[h>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[181]|0))Vb();j=c[g>>2]|0;c[i>>2]=c[f>>2];c[i+4>>2]=j;Zb(1,61295,i);Vb()}function Sb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=i;o=i+44|0;j=i+40|0;n=i+36|0;f=i+32|0;k=i+16|0;g=i+8|0;c[o>>2]=a;c[j>>2]=b;c[n>>2]=d;c[k>>2]=e;c[f>>2]=mp(c[o>>2]|0,c[j>>2]|0,c[n>>2]|0,k)|0;if((c[f>>2]|0)>>>0<(c[j>>2]|0)>>>0){l=i;return c[f>>2]|0}c[g>>2]=506;if((c[182]|0)==-1)c[182]=Wb(1,0,19017,19074,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[182]|0))Vb();c[h>>2]=19017;c[h+4>>2]=506;Zb(1,61295,h);Vb();return 0}function Tb(){c[17562]=c[3935];return}function Ub(){return}function Vb(){za()}function Wb(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+48|0;if((l|0)>=(m|0))$(48);r=s+32|0;k=s+28|0;n=s+24|0;o=s+20|0;p=s+16|0;g=s+12|0;h=s+8|0;i=s+4|0;j=s;c[k>>2]=a;c[n>>2]=b;c[o>>2]=d;c[p>>2]=e;c[g>>2]=f;if(!(c[n>>2]|0))c[n>>2]=c[17563];if((c[17564]|0)>=0&0==(c[17565]|0)){c[r>>2]=(c[k>>2]|0)<=(c[17564]|0)&1;r=c[r>>2]|0;l=s;return r|0}c[j>>2]=(c[17564]|0)>=0&1;c[i>>2]=0;while(1){if((c[i>>2]|0)>=(c[17566]|0))break;c[h>>2]=(c[17567]|0)+((c[i>>2]|0)*112|0);if(!(c[j>>2]|0?!(c[(c[h>>2]|0)+108>>2]|0):0))q=9;if((((((q|0)==9?(q=0,(c[g>>2]|0)>=(c[(c[h>>2]|0)+96>>2]|0)):0)?(c[g>>2]|0)<=(c[(c[h>>2]|0)+100>>2]|0):0)?0==(Kq(c[h>>2]|0,c[n>>2]|0,0,0,0)|0):0)?0==(Kq((c[h>>2]|0)+32|0,c[o>>2]|0,0,0,0)|0):0)?0==(Kq((c[h>>2]|0)+64|0,c[p>>2]|0,0,0,0)|0):0){q=14;break}c[i>>2]=(c[i>>2]|0)+1}if((q|0)==14){c[r>>2]=(c[k>>2]|0)<=(c[(c[h>>2]|0)+104>>2]|0)&1;r=c[r>>2]|0;l=s;return r|0}a=c[k>>2]|0;if((c[17564]|0)>=0){c[r>>2]=(a|0)<=(c[17564]|0)&1;r=c[r>>2]|0;l=s;return r|0}else{c[r>>2]=(a|0)<=4&1;r=c[r>>2]|0;l=s;return r|0}return 0}function Xb(){return c[17572]|0}function Yb(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=i;d=i+20|0;e=i+16|0;f=i+12|0;g=i+8|0;c[d>>2]=a;c[e>>2]=b;if(c[d>>2]|0){c[17572]=(c[17572]|0)+(c[d>>2]|0);l=i;return}c[f>>2]=0==(c[17572]|0)&1;c[17572]=0;if((c[e>>2]|0)==0|(c[f>>2]|0)!=0){l=i;return}c[g>>2]=906;if((c[184]|0)==-1)c[184]=Wb(1,0,19090,19268,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);l=i;return}if(!(c[184]|0)){l=i;return}c[h>>2]=19090;c[h+4>>2]=906;Zb(1,61295,h);l=i;return}function Zb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=e+20|0;g=e+16|0;f=e;c[h>>2]=a;c[g>>2]=b;c[f>>2]=d;_b(c[h>>2]|0,c[17568]|0,c[g>>2]|0,f);l=e;return}function _b(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;A=l;l=l+240|0;if((l|0)>=(m|0))$(240);y=A+40|0;z=A+32|0;h=A+24|0;s=A+108|0;t=A+104|0;u=A+100|0;v=A+96|0;w=A+176|0;x=A+112|0;j=A+92|0;k=A+88|0;B=A+72|0;g=A+68|0;n=A+64|0;i=A+16|0;o=A+56|0;p=A+8|0;q=A+48|0;r=A;c[s>>2]=b;c[t>>2]=d;c[u>>2]=e;c[v>>2]=f;c[B>>2]=c[c[v>>2]>>2];c[k>>2]=(mp(0,0,c[u>>2]|0,B)|0)+1;if(!(c[k>>2]|0)){c[g>>2]=952;if((c[183]|0)==-1)c[183]=Wb(1,0,19090,19113,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[183]|0))Vb();c[h>>2]=19090;c[h+4>>2]=952;Zb(1,61295,h);Vb()}b=w;d=b+64|0;do{a[b>>0]=0;b=b+1|0}while((b|0)<(d|0));b=c[k>>2]|0;c[n>>2]=Va()|0;g=l;l=l+((1*b|0)+15&-16)|0;if((l|0)>=(m|0))$((1*b|0)+15&-16|0);gb(o|0,0)|0;h=qd()|0;B=i;c[B>>2]=h;c[B+4>>2]=D;B=i;h=c[B+4>>2]|0;B=(h|0)>0|(h|0)==0&(c[B>>2]|0)>>>0>0;h=i;h=br(c[h>>2]|0,c[h+4>>2]|0,1e3,0)|0;f=c[o>>2]|0;h=_q(f|0,((f|0)<0)<<31>>31|0,h|0,D|0)|0;c[o>>2]=h;do if(B){i=or(c[i>>2]|0,c[i+4>>2]|0,1e3,0)|0;i=kr(i|0,D|0,1e3,0)|0;B=o+4|0;h=c[B>>2]|0;i=_q(h|0,((h|0)<0)<<31>>31|0,i|0,D|0)|0;c[B>>2]=i;B=c[o+4>>2]|0;i=((B|0)<0)<<31>>31;if((i|0)>0|(i|0)==0&B>>>0>1e6){B=o+4|0;i=c[B>>2]|0;i=Xq(i|0,((i|0)<0)<<31>>31|0,1e6,0)|0;c[B>>2]=i;c[o>>2]=(c[o>>2]|0)+1}}else{h=c[o+4>>2]|0;e=((h|0)<0)<<31>>31;B=i;B=or(c[B>>2]|0,c[B+4>>2]|0,1e3,0)|0;B=Xq(0,0,B|0,D|0)|0;B=kr(B|0,D|0,1e3,0)|0;f=D;b=i;b=or(c[b>>2]|0,c[b+4>>2]|0,1e3,0)|0;b=kr(b|0,D|0,1e3,0)|0;d=D;if((e|0)>(f|0)|(e|0)==(f|0)&h>>>0>B>>>0){B=o+4|0;i=c[B>>2]|0;i=_q(i|0,((i|0)<0)<<31>>31|0,b|0,d|0)|0;c[B>>2]=i;break}else{i=_q(1e6,0,b|0,d|0)|0;B=o+4|0;h=c[B>>2]|0;i=_q(h|0,((h|0)<0)<<31>>31|0,i|0,D|0)|0;c[B>>2]=i;c[o>>2]=(c[o>>2]|0)+-1;break}}while(0);c[j>>2]=kb(o|0)|0;if(!(c[j>>2]|0))Mp(w,19119)|0;else{Pa(x|0,64,19135,c[j>>2]|0)|0;c[z>>2]=c[o+4>>2];lp(w,64,x,z)|0}mp(g,c[k>>2]|0,c[u>>2]|0,c[v>>2]|0)|0;B=70224;if(0!=(c[s>>2]&64|0)&(0!=(c[B>>2]|0)?1:0!=(c[B+4>>2]|0))?0==(Jo(g,71362,256)|0):0){c[17569]=(c[17569]|0)+1;c[y>>2]=c[17556];c[y+4>>2]=c[17557];z=ud(y)|0;B=p;c[B>>2]=z;c[B+4>>2]=D;B=p;z=c[B+4>>2]|0;if(z>>>0>10|(z|0)==10&(c[B>>2]|0)>>>0>250327040|(c[17569]|0)>>>0>1e3)$b(w);c[q>>2]=1;B=c[n>>2]|0;Ca(B|0);l=A;return}$b(w);Vp(71362,g,256)|0;c[17569]=0;c[17570]=c[s>>2];z=sd()|0;B=r;c[B>>2]=z;c[B+4>>2]=D;c[17556]=c[r>>2];c[17557]=c[r+4>>2];Vp(71618,c[t>>2]|0,32)|0;ac(c[s>>2]|0,c[t>>2]|0,w,g);c[q>>2]=0;B=c[n>>2]|0;Ca(B|0);l=A;return}function $b(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;o=l;l=l+640|0;if((l|0)>=(m|0))$(640);d=o+32|0;n=o+16|0;e=o+52|0;f=o+56|0;g=o+48|0;h=o+44|0;i=o+40|0;j=o+8|0;k=o;c[e>>2]=b;b=70224;if((0==(c[b>>2]|0)?0==(c[b+4>>2]|0):0)|0==(c[17569]|0)){l=o;return}c[g>>2]=0;c[h>>2]=No(71362,0,256)|0;if(c[h>>2]|0){if((c[h>>2]|0)!=71362)c[h>>2]=(c[h>>2]|0)+-1}else c[h>>2]=71617;if((a[c[h>>2]>>0]|0)==10){c[g>>2]=1;a[c[h>>2]>>0]=0};c[d>>2]=c[17556];c[d+4>>2]=c[17557];p=ud(d)|0;b=j;c[b>>2]=p;c[b+4>>2]=D;c[d>>2]=c[j>>2];c[d+4>>2]=c[j+4>>2];c[i>>2]=ld(d,1)|0;b=c[17569]|0;j=c[i>>2]|0;c[n>>2]=256;c[n+4>>2]=71362;c[n+8>>2]=b;c[n+12>>2]=j;lp(f,576,19219,n)|0;if((c[g>>2]|0)==1)a[c[h>>2]>>0]=10;ac(c[17570]|0,71618,c[e>>2]|0,f);n=sd()|0;p=k;c[p>>2]=n;c[p+4>>2]=D;c[17556]=c[k>>2];c[17557]=c[k+4>>2];c[17569]=0;l=o;return}function ac(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+48|0;if((l|0)>=(m|0))$(48);n=o+8|0;k=o;f=o+40|0;g=o+36|0;h=o+32|0;i=o+28|0;j=o+24|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;c[i>>2]=e;if(0!=(c[17562]|0)&0==(c[17571]|0)){a=c[17562]|0;if((c[f>>2]|0)==4){c[k>>2]=c[i>>2];Rp(a,19156,k)|0}else{b=c[h>>2]|0;d=c[g>>2]|0;e=bc(c[f>>2]|0)|0;k=c[i>>2]|0;c[n>>2]=b;c[n+4>>2]=d;c[n+8>>2]=e;c[n+12>>2]=k;Rp(a,19161,n)|0}$p(c[17562]|0)|0}c[j>>2]=c[17571];while(1){if(!(c[j>>2]|0))break;qb[c[(c[j>>2]|0)+4>>2]&15](c[(c[j>>2]|0)+8>>2]|0,c[f>>2]|0,c[g>>2]|0,c[h>>2]|0,c[i>>2]|0);c[j>>2]=c[c[j>>2]>>2]}l=o;return}function bc(a){a=a|0;var b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=e+4|0;d=e;c[d>>2]=a;do if((c[d>>2]&1|0)<=0){if((c[d>>2]&2|0)>0){c[b>>2]=19179;break}if((c[d>>2]&4|0)>0){c[b>>2]=19187;break}if((c[d>>2]&8|0)>0){c[b>>2]=19195;break}if((c[d>>2]&16|0)>0){c[b>>2]=19200;break}if(!(c[d>>2]&-65)){c[b>>2]=19206;break}else{c[b>>2]=19211;break}}else c[b>>2]=19173;while(0);l=e;return c[b>>2]|0}function cc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+176|0;if((l|0)>=(m|0))$(176);k=n;f=n+32|0;g=n+28|0;h=n+24|0;i=n+8|0;j=n+40|0;c[f>>2]=a;c[g>>2]=b;c[h>>2]=d;if(!(c[g>>2]|0))c[g>>2]=c[17563];c[i>>2]=e;g=c[g>>2]|0;e=qq()|0;c[k>>2]=g;c[k+4>>2]=e;Sb(j,128,19107,k)|0;_b(c[f>>2]|0,j,c[h>>2]|0,i);l=n;return}function dc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+64|0;if((l|0)>=(m|0))$(64);u=v+8|0;t=v;o=v+56|0;p=v+52|0;q=v+48|0;r=v+44|0;s=v+40|0;g=v+36|0;h=v+32|0;i=v+28|0;j=v+24|0;k=v+20|0;n=v+16|0;c[p>>2]=a;c[q>>2]=b;c[r>>2]=d;c[s>>2]=e;c[g>>2]=f;b=c[q>>2]|0;c[i>>2]=Va()|0;a=b;d=l;l=l+((1*a|0)+15&-16)|0;if((l|0)>=(m|0))$((1*a|0)+15&-16|0);if(1!=(ec(h,c[r>>2]|0,c[s>>2]|0)|0)){c[o>>2]=-1;c[j>>2]=1;u=c[i>>2]|0;Ca(u|0);u=c[o>>2]|0;l=v;return u|0}if(ee(c[h>>2]|0,d,c[q>>2]|0,c[p>>2]|0,c[q>>2]|0)|0){c[k>>2]=136;if((c[185]|0)==-1)c[185]=Wb(1,0,19284,19303,c[k>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[185]|0))Vb();c[t>>2]=19284;c[t+4>>2]=136;Zb(1,61295,t);Vb()}be(c[h>>2]|0);if(1!=(fc(h,c[r>>2]|0,c[s>>2]|0)|0)){c[o>>2]=-1;c[j>>2]=1;u=c[i>>2]|0;Ca(u|0);u=c[o>>2]|0;l=v;return u|0}if(!(ee(c[h>>2]|0,c[g>>2]|0,c[q>>2]|0,d,c[q>>2]|0)|0)){be(c[h>>2]|0);Yq(d|0,0,b|0)|0;c[o>>2]=c[q>>2];c[j>>2]=1;u=c[i>>2]|0;Ca(u|0);u=c[o>>2]|0;l=v;return u|0}c[n>>2]=140;if((c[186]|0)==-1)c[186]=Wb(1,0,19284,19303,c[n>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[186]|0))Vb();c[u>>2]=19284;c[u+4>>2]=140;Zb(1,61295,u);Vb();return 0}function ec(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+64|0;if((l|0)>=(m|0))$(64);p=q+16|0;o=q+8|0;n=q;e=q+48|0;f=q+44|0;g=q+40|0;h=q+36|0;i=q+32|0;j=q+28|0;k=q+24|0;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;if(ae(c[e>>2]|0,9,2,0)|0){c[i>>2]=68;if((c[190]|0)==-1)c[190]=Wb(1,0,19284,19356,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[190]|0))Vb();c[n>>2]=19284;c[n+4>>2]=68;Zb(1,61295,n);Vb()}c[h>>2]=ce(c[c[e>>2]>>2]|0,c[f>>2]|0,32)|0;if(0!=(c[h>>2]|0)?((c[h>>2]&255)<<24>>24|0)!=43:0){c[j>>2]=72;if((c[191]|0)==-1)c[191]=Wb(1,0,19284,19356,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[191]|0))Vb();c[o>>2]=19284;c[o+4>>2]=72;Zb(1,61295,o);Vb()}c[h>>2]=de(c[c[e>>2]>>2]|0,c[g>>2]|0,16)|0;if(!(c[h>>2]|0)){l=q;return 1}if(((c[h>>2]&255)<<24>>24|0)==43){l=q;return 1}c[k>>2]=76;if((c[192]|0)==-1)c[192]=Wb(1,0,19284,19356,c[k>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[192]|0))Vb();c[p>>2]=19284;c[p+4>>2]=76;Zb(1,61295,p);Vb();return 0}function fc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+64|0;if((l|0)>=(m|0))$(64);p=q+16|0;o=q+8|0;n=q;e=q+48|0;f=q+44|0;g=q+40|0;h=q+36|0;i=q+32|0;j=q+28|0;k=q+24|0;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;if(ae(c[e>>2]|0,10,2,0)|0){c[i>>2]=98;if((c[187]|0)==-1)c[187]=Wb(1,0,19284,19335,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[187]|0))Vb();c[n>>2]=19284;c[n+4>>2]=98;Zb(1,61295,n);Vb()}c[h>>2]=ce(c[c[e>>2]>>2]|0,(c[f>>2]|0)+32|0,32)|0;if(0!=(c[h>>2]|0)?((c[h>>2]&255)<<24>>24|0)!=43:0){c[j>>2]=102;if((c[188]|0)==-1)c[188]=Wb(1,0,19284,19335,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[188]|0))Vb();c[o>>2]=19284;c[o+4>>2]=102;Zb(1,61295,o);Vb()}c[h>>2]=de(c[c[e>>2]>>2]|0,(c[g>>2]|0)+16|0,16)|0;if(!(c[h>>2]|0)){l=q;return 1}if(((c[h>>2]&255)<<24>>24|0)==43){l=q;return 1}c[k>>2]=106;if((c[189]|0)==-1)c[189]=Wb(1,0,19284,19335,c[k>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[189]|0))Vb();c[p>>2]=19284;c[p+4>>2]=106;Zb(1,61295,p);Vb();return 0}function gc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+64|0;if((l|0)>=(m|0))$(64);u=v+8|0;t=v;o=v+56|0;p=v+52|0;q=v+48|0;r=v+44|0;s=v+40|0;g=v+36|0;h=v+32|0;i=v+28|0;j=v+24|0;k=v+20|0;n=v+16|0;c[p>>2]=a;c[q>>2]=b;c[r>>2]=d;c[s>>2]=e;c[g>>2]=f;b=c[q>>2]|0;c[i>>2]=Va()|0;a=b;d=l;l=l+((1*a|0)+15&-16)|0;if((l|0)>=(m|0))$((1*a|0)+15&-16|0);if(1!=(fc(h,c[r>>2]|0,c[s>>2]|0)|0)){c[o>>2]=-1;c[j>>2]=1;u=c[i>>2]|0;Ca(u|0);u=c[o>>2]|0;l=v;return u|0}if(fe(c[h>>2]|0,d,c[q>>2]|0,c[p>>2]|0,c[q>>2]|0)|0){c[k>>2]=172;if((c[193]|0)==-1)c[193]=Wb(1,0,19284,19373,c[k>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[193]|0))Vb();c[t>>2]=19284;c[t+4>>2]=172;Zb(1,61295,t);Vb()}be(c[h>>2]|0);if(1!=(ec(h,c[r>>2]|0,c[s>>2]|0)|0)){c[o>>2]=-1;c[j>>2]=1;u=c[i>>2]|0;Ca(u|0);u=c[o>>2]|0;l=v;return u|0}if(!(fe(c[h>>2]|0,c[g>>2]|0,c[q>>2]|0,d,c[q>>2]|0)|0)){be(c[h>>2]|0);Yq(d|0,0,b|0)|0;c[o>>2]=c[q>>2];c[j>>2]=1;u=c[i>>2]|0;Ca(u|0);u=c[o>>2]|0;l=v;return u|0}c[n>>2]=176;if((c[194]|0)==-1)c[194]=Wb(1,0,19284,19373,c[n>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[194]|0))Vb();c[u>>2]=19284;c[u+4>>2]=176;Zb(1,61295,u);Vb();return 0}function hc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+64|0;if((l|0)>=(m|0))$(64);o=p+16|0;n=p+8|0;k=p;q=p+52|0;d=p+48|0;e=p+44|0;f=p+40|0;g=p+36|0;h=p+32|0;i=p+28|0;j=p+24|0;c[q>>2]=a;c[d>>2]=b;c[e>>2]=ic(c[q>>2]|0)|0;if(!(c[e>>2]|0)){c[h>>2]=231;if((c[195]|0)==-1)c[195]=Wb(1,0,19405,19418,c[h>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[195]|0))Vb();c[k>>2]=19405;c[k+4>>2]=231;Zb(1,61295,k);Vb()}if(Sd(f,c[e>>2]|0,0)|0){c[i>>2]=232;if((c[196]|0)==-1)c[196]=Wb(1,0,19405,19418,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[196]|0))Vb();c[n>>2]=19405;c[n+4>>2]=232;Zb(1,61295,n);Vb()}Cd(c[e>>2]|0);c[g>>2]=Td(19453,c[f>>2]|0,0)|0;if(c[g>>2]|0){Jc(c[d>>2]|0,32,c[g>>2]|0);Id(c[g>>2]|0);ve(c[f>>2]|0);l=p;return}c[j>>2]=235;if((c[197]|0)==-1)c[197]=Wb(1,0,19405,19418,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[197]|0))Vb();c[o>>2]=19405;c[o+4>>2]=235;Zb(1,61295,o);Vb()}function ic(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=i+24|0;g=i+8|0;j=i;k=i+48|0;b=i+44|0;d=i+40|0;e=i+36|0;f=i+32|0;c[k>>2]=a;a=c[k>>2]|0;c[j>>2]=32;c[j+4>>2]=a;c[d>>2]=Bd(b,0,19461,j)|0;if(!(c[d>>2]|0)){l=i;return c[b>>2]|0}c[e>>2]=136;if((c[198]|0)==-1)c[198]=Wb(1,20980,19405,19503,c[e>>2]|0)|0;if((Xb()|0)<=0){if(c[198]|0){k=xd(c[d>>2]|0)|0;c[g>>2]=19528;c[g+4>>2]=19405;c[g+8>>2]=136;c[g+12>>2]=k;cc(1,20980,20531,g)}}else Yb(-1,0);c[f>>2]=137;if((c[199]|0)==-1)c[199]=Wb(1,0,19405,19503,c[f>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[199]|0))Vb();c[h>>2]=19405;c[h+4>>2]=137;Zb(1,61295,h);Vb();return 0}function jc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+64|0;if((l|0)>=(m|0))$(64);o=p+16|0;n=p+8|0;k=p;q=p+52|0;d=p+48|0;e=p+44|0;f=p+40|0;g=p+36|0;h=p+32|0;i=p+28|0;j=p+24|0;c[q>>2]=a;c[d>>2]=b;c[e>>2]=kc(c[q>>2]|0)|0;if(!(c[e>>2]|0)){c[h>>2]=257;if((c[200]|0)==-1)c[200]=Wb(1,0,19405,19544,c[h>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[200]|0))Vb();c[k>>2]=19405;c[k+4>>2]=257;Zb(1,61295,k);Vb()}if(Sd(f,c[e>>2]|0,0)|0){c[i>>2]=258;if((c[201]|0)==-1)c[201]=Wb(1,0,19405,19544,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[201]|0))Vb();c[n>>2]=19405;c[n+4>>2]=258;Zb(1,61295,n);Vb()}Cd(c[e>>2]|0);c[g>>2]=Td(19453,c[f>>2]|0,0)|0;if(c[g>>2]|0){Jc(c[d>>2]|0,32,c[g>>2]|0);Id(c[g>>2]|0);ve(c[f>>2]|0);l=p;return}c[j>>2]=261;if((c[202]|0)==-1)c[202]=Wb(1,0,19405,19544,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[202]|0))Vb();c[o>>2]=19405;c[o+4>>2]=261;Zb(1,61295,o);Vb()}function kc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=i+24|0;g=i+8|0;j=i;k=i+48|0;b=i+44|0;d=i+40|0;e=i+36|0;f=i+32|0;c[k>>2]=a;a=c[k>>2]|0;c[j>>2]=32;c[j+4>>2]=a;c[d>>2]=Bd(b,0,19579,j)|0;if(!(c[d>>2]|0)){l=i;return c[b>>2]|0}c[e>>2]=169;if((c[203]|0)==-1)c[203]=Wb(1,20980,19405,19634,c[e>>2]|0)|0;if((Xb()|0)<=0){if(c[203]|0){k=xd(c[d>>2]|0)|0;c[g>>2]=19528;c[g+4>>2]=19405;c[g+8>>2]=169;c[g+12>>2]=k;cc(1,20980,20531,g)}}else Yb(-1,0);c[f>>2]=170;if((c[204]|0)==-1)c[204]=Wb(1,0,19405,19634,c[f>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[204]|0))Vb();c[h>>2]=19405;c[h+4>>2]=170;Zb(1,61295,h);Vb();return 0}function lc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+64|0;if((l|0)>=(m|0))$(64);o=p+16|0;n=p+8|0;k=p;q=p+52|0;d=p+48|0;e=p+44|0;f=p+40|0;g=p+36|0;h=p+32|0;i=p+28|0;j=p+24|0;c[q>>2]=a;c[d>>2]=b;c[e>>2]=mc(c[q>>2]|0)|0;if(!(c[e>>2]|0)){c[h>>2]=283;if((c[205]|0)==-1)c[205]=Wb(1,0,19405,19659,c[h>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[205]|0))Vb();c[k>>2]=19405;c[k+4>>2]=283;Zb(1,61295,k);Vb()}if(Sd(f,c[e>>2]|0,0)|0){c[i>>2]=284;if((c[206]|0)==-1)c[206]=Wb(1,0,19405,19659,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[206]|0))Vb();c[n>>2]=19405;c[n+4>>2]=284;Zb(1,61295,n);Vb()}Cd(c[e>>2]|0);c[g>>2]=Td(19453,c[f>>2]|0,0)|0;if(c[g>>2]|0){Jc(c[d>>2]|0,32,c[g>>2]|0);Id(c[g>>2]|0);ve(c[f>>2]|0);l=p;return}c[j>>2]=287;if((c[207]|0)==-1)c[207]=Wb(1,0,19405,19659,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[207]|0))Vb();c[o>>2]=19405;c[o+4>>2]=287;Zb(1,61295,o);Vb()}function mc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=i+24|0;g=i+8|0;j=i;k=i+48|0;b=i+44|0;d=i+40|0;e=i+36|0;f=i+32|0;c[k>>2]=a;a=c[k>>2]|0;c[j>>2]=32;c[j+4>>2]=a;c[d>>2]=Bd(b,0,19461,j)|0;if(!(c[d>>2]|0)){l=i;return c[b>>2]|0}c[e>>2]=202;if((c[208]|0)==-1)c[208]=Wb(1,20980,19405,19694,c[e>>2]|0)|0;if((Xb()|0)<=0){if(c[208]|0){k=xd(c[d>>2]|0)|0;c[g>>2]=19528;c[g+4>>2]=19405;c[g+8>>2]=202;c[g+12>>2]=k;cc(1,20980,20531,g)}}else Yb(-1,0);c[f>>2]=203;if((c[209]|0)==-1)c[209]=Wb(1,0,19405,19694,c[f>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[209]|0))Vb();c[h>>2]=19405;c[h+4>>2]=203;Zb(1,61295,h);Vb();return 0}function nc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+96|0;if((l|0)>=(m|0))$(96);n=p+40|0;o=p+24|0;k=p+8|0;a=p+88|0;b=p+84|0;d=p+80|0;e=p+76|0;f=p+72|0;g=p+68|0;h=p+64|0;i=p+60|0;j=p+56|0;q=Bd(e,0,19719,p)|0;c[g>>2]=q;if(q){c[h>>2]=505;if((c[210]|0)==-1)c[210]=Wb(1,20980,19405,19774,c[h>>2]|0)|0;if((Xb()|0)<=0){if(c[210]|0){q=xd(c[g>>2]|0)|0;c[k>>2]=19528;c[k+4>>2]=19405;c[k+8>>2]=505;c[k+12>>2]=q;cc(1,20980,20531,k)}}else Yb(-1,0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}q=je(d,c[e>>2]|0)|0;c[g>>2]=q;if(q){c[i>>2]=510;if((c[211]|0)==-1)c[211]=Wb(1,20980,19405,19774,c[i>>2]|0)|0;if((Xb()|0)<=0){if(c[211]|0){q=xd(c[g>>2]|0)|0;c[o>>2]=19805;c[o+4>>2]=19405;c[o+8>>2]=510;c[o+12>>2]=q;cc(1,20980,20531,o)}}else Yb(-1,0);Cd(c[e>>2]|0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}Cd(c[e>>2]|0);q=oc(f,c[d>>2]|0,37667,35384)|0;c[g>>2]=q;if(!q){Cd(c[d>>2]|0);c[b>>2]=Pb(32,19405,530)|0;Jc(c[b>>2]|0,32,c[f>>2]|0);Id(c[f>>2]|0);c[a>>2]=c[b>>2];q=c[a>>2]|0;l=p;return q|0}c[j>>2]=525;if((c[212]|0)==-1)c[212]=Wb(1,20980,19405,19774,c[j>>2]|0)|0;if((Xb()|0)<=0){if(c[212]|0){q=xd(c[g>>2]|0)|0;c[n>>2]=19820;c[n+4>>2]=19405;c[n+8>>2]=525;c[n+12>>2]=q;cc(1,20980,20531,n)}}else Yb(-1,0);Cd(c[d>>2]|0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}function oc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;q=l;l=l+48|0;if((l|0)>=(m|0))$(48);n=q+36|0;o=q+32|0;s=q+28|0;r=q+24|0;g=q+20|0;p=q+16|0;h=q+12|0;i=q+8|0;j=q+4|0;k=q;c[o>>2]=b;c[s>>2]=d;c[r>>2]=e;c[g>>2]=f;c[p>>2]=Ed(c[s>>2]|0,c[r>>2]|0,0)|0;if(!(c[p>>2]|0)){c[n>>2]=1;s=c[n>>2]|0;l=q;return s|0}c[h>>2]=Fd(c[p>>2]|0)|0;Cd(c[p>>2]|0);c[p>>2]=c[h>>2];if(!(c[p>>2]|0)){c[n>>2]=2;s=c[n>>2]|0;l=q;return s|0}c[k>>2]=0;c[i>>2]=c[g>>2];while(1){d=c[p>>2]|0;if(!(a[c[i>>2]>>0]|0)){b=18;break}c[h>>2]=Ed(d,c[i>>2]|0,1)|0;if(!(c[h>>2]|0)){b=8;break}s=Gd(c[h>>2]|0,1,5)|0;c[(c[o>>2]|0)+(c[k>>2]<<2)>>2]=s;Cd(c[h>>2]|0);if(!(c[(c[o>>2]|0)+(c[k>>2]<<2)>>2]|0)){b=13;break}c[i>>2]=(c[i>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+1}if((b|0)==8){c[j>>2]=0;while(1){if((c[j>>2]|0)>>>0>=(c[k>>2]|0)>>>0)break;ye(c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]|0);c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]=0;c[j>>2]=(c[j>>2]|0)+1}Cd(c[p>>2]|0);c[n>>2]=3;s=c[n>>2]|0;l=q;return s|0}else if((b|0)==13){c[j>>2]=0;while(1){if((c[j>>2]|0)>>>0>=(c[k>>2]|0)>>>0)break;ye(c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]|0);c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]=0;c[j>>2]=(c[j>>2]|0)+1}Cd(c[p>>2]|0);c[n>>2]=4;s=c[n>>2]|0;l=q;return s|0}else if((b|0)==18){Cd(d);c[n>>2]=0;s=c[n>>2]|0;l=q;return s|0}return 0}function pc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+96|0;if((l|0)>=(m|0))$(96);n=p+40|0;o=p+24|0;k=p+8|0;a=p+88|0;b=p+84|0;d=p+80|0;e=p+76|0;f=p+72|0;g=p+68|0;h=p+64|0;i=p+60|0;j=p+56|0;q=Bd(e,0,19834,p)|0;c[g>>2]=q;if(q){c[h>>2]=555;if((c[213]|0)==-1)c[213]=Wb(1,20980,19405,19872,c[h>>2]|0)|0;if((Xb()|0)<=0){if(c[213]|0){q=xd(c[g>>2]|0)|0;c[k>>2]=19528;c[k+4>>2]=19405;c[k+8>>2]=555;c[k+12>>2]=q;cc(1,20980,20531,k)}}else Yb(-1,0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}q=je(d,c[e>>2]|0)|0;c[g>>2]=q;if(q){c[i>>2]=560;if((c[214]|0)==-1)c[214]=Wb(1,20980,19405,19872,c[i>>2]|0)|0;if((Xb()|0)<=0){if(c[214]|0){q=xd(c[g>>2]|0)|0;c[o>>2]=19805;c[o+4>>2]=19405;c[o+8>>2]=560;c[o+12>>2]=q;cc(1,20980,20531,o)}}else Yb(-1,0);Cd(c[e>>2]|0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}Cd(c[e>>2]|0);q=oc(f,c[d>>2]|0,37667,35384)|0;c[g>>2]=q;if(!q){Cd(c[d>>2]|0);c[b>>2]=Pb(32,19405,580)|0;Jc(c[b>>2]|0,32,c[f>>2]|0);Id(c[f>>2]|0);c[a>>2]=c[b>>2];q=c[a>>2]|0;l=p;return q|0}c[j>>2]=575;if((c[215]|0)==-1)c[215]=Wb(1,20980,19405,19872,c[j>>2]|0)|0;if((Xb()|0)<=0){if(c[215]|0){q=xd(c[g>>2]|0)|0;c[n>>2]=19820;c[n+4>>2]=19405;c[n+8>>2]=575;c[n+12>>2]=q;cc(1,20980,20531,n)}}else Yb(-1,0);Cd(c[d>>2]|0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}function qc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+96|0;if((l|0)>=(m|0))$(96);n=p+40|0;o=p+24|0;k=p+8|0;a=p+88|0;b=p+84|0;d=p+80|0;e=p+76|0;f=p+72|0;g=p+68|0;h=p+64|0;i=p+60|0;j=p+56|0;q=Bd(e,0,19903,p)|0;c[g>>2]=q;if(q){c[h>>2]=604;if((c[216]|0)==-1)c[216]=Wb(1,20980,19405,19947,c[h>>2]|0)|0;if((Xb()|0)<=0){if(c[216]|0){q=xd(c[g>>2]|0)|0;c[k>>2]=19528;c[k+4>>2]=19405;c[k+8>>2]=604;c[k+12>>2]=q;cc(1,20980,20531,k)}}else Yb(-1,0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}q=je(d,c[e>>2]|0)|0;c[g>>2]=q;if(q){c[i>>2]=609;if((c[217]|0)==-1)c[217]=Wb(1,20980,19405,19947,c[i>>2]|0)|0;if((Xb()|0)<=0){if(c[217]|0){q=xd(c[g>>2]|0)|0;c[o>>2]=19805;c[o+4>>2]=19405;c[o+8>>2]=609;c[o+12>>2]=q;cc(1,20980,20531,o)}}else Yb(-1,0);Cd(c[e>>2]|0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}Cd(c[e>>2]|0);q=oc(f,c[d>>2]|0,37667,35384)|0;c[g>>2]=q;if(!q){Cd(c[d>>2]|0);c[b>>2]=Pb(32,19405,629)|0;Jc(c[b>>2]|0,32,c[f>>2]|0);Id(c[f>>2]|0);c[a>>2]=c[b>>2];q=c[a>>2]|0;l=p;return q|0}c[j>>2]=624;if((c[218]|0)==-1)c[218]=Wb(1,20980,19405,19947,c[j>>2]|0)|0;if((Xb()|0)<=0){if(c[218]|0){q=xd(c[g>>2]|0)|0;c[n>>2]=19820;c[n+4>>2]=19405;c[n+8>>2]=624;c[n+12>>2]=q;cc(1,20980,20531,n)}}else Yb(-1,0);Cd(c[d>>2]|0);c[a>>2]=0;q=c[a>>2]|0;l=p;return q|0}function rc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;r=l;l=l+80|0;if((l|0)>=(m|0))$(80);q=r+16|0;p=r;i=r+68|0;t=r+64|0;s=r+60|0;j=r+56|0;k=r+52|0;n=r+48|0;o=r+44|0;e=r+40|0;f=r+32|0;g=r+28|0;h=r+24|0;c[t>>2]=a;c[s>>2]=b;c[j>>2]=d;c[k>>2]=kc(c[t>>2]|0)|0;c[o>>2]=sc(c[s>>2]|0)|0;d=ge(n,c[o>>2]|0,c[k>>2]|0)|0;c[e>>2]=d;if(d){c[g>>2]=807;if((c[219]|0)==-1)c[219]=Wb(2,20980,19405,19978,c[g>>2]|0)|0;if((Xb()|0)<=0){if(c[219]|0){t=xd(c[e>>2]|0)|0;c[p>>2]=19405;c[p+4>>2]=807;c[p+8>>2]=t;cc(2,20980,20003,p)}}else Yb(-1,0);Cd(c[o>>2]|0);Cd(c[k>>2]|0);c[i>>2]=-1;t=c[i>>2]|0;l=r;return t|0}Cd(c[k>>2]|0);Cd(c[o>>2]|0);t=oc(f,c[n>>2]|0,37529,46882)|0;c[e>>2]=t;if(!t){Cd(c[n>>2]|0);Jc(c[j>>2]|0,32,c[f>>2]|0);Jc((c[j>>2]|0)+32|0,32,c[f+4>>2]|0);Id(c[f>>2]|0);Id(c[f+4>>2]|0);c[i>>2]=1;t=c[i>>2]|0;l=r;return t|0}c[h>>2]=819;if((c[220]|0)==-1)c[220]=Wb(1,0,19405,19978,c[h>>2]|0)|0;if((Xb()|0)<=0){if(c[220]|0){c[q>>2]=19405;c[q+4>>2]=819;Zb(1,61295,q)}}else Yb(-1,0);Cd(c[n>>2]|0);c[i>>2]=-1;t=c[i>>2]|0;l=r;return t|0}function sc(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;i=l;l=l+128|0;if((l|0)>=(m|0))$(128);h=i+16|0;j=i;b=i+116|0;o=i+112|0;k=i+48|0;e=i+40|0;f=i+36|0;g=i+32|0;c[o>>2]=a;n=c[o>>2]|0;a=c[o>>2]|0;wc(n,Yp(d[a>>0]|d[a+1>>0]<<8|d[a+2>>0]<<16|d[a+3>>0]<<24)|0,k);c[j>>2]=37609;c[j+4>>2]=64;c[j+8>>2]=k;a=Bd(e,0,20038,j)|0;c[f>>2]=a;if(!a){c[b>>2]=c[e>>2];o=c[b>>2]|0;l=i;return o|0}c[g>>2]=698;if((c[221]|0)==-1)c[221]=Wb(1,20980,19405,20082,c[g>>2]|0)|0;if((Xb()|0)<=0){if(c[221]|0){o=xd(c[f>>2]|0)|0;c[h>>2]=19528;c[h+4>>2]=19405;c[h+8>>2]=698;c[h+12>>2]=o;cc(1,20980,20531,h)}}else Yb(-1,0);c[b>>2]=0;o=c[b>>2]|0;l=i;return o|0}function tc(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;w=l;l=l+96|0;if((l|0)>=(m|0))$(96);u=w+40|0;t=w+32|0;v=w+16|0;s=w;n=w+92|0;x=w+88|0;o=w+84|0;p=w+80|0;q=w+76|0;r=w+72|0;g=w+68|0;h=w+64|0;i=w+60|0;j=w+56|0;k=w+52|0;c[x>>2]=a;c[o>>2]=b;c[p>>2]=e;c[q>>2]=f;e=c[x>>2]|0;f=(c[o>>2]|0)+4|0;if((e|0)!=(Yp(d[f>>0]|d[f+1>>0]<<8|d[f+2>>0]<<16|d[f+3>>0]<<24)|0)){c[n>>2]=-1;x=c[n>>2]|0;l=w;return x|0}f=c[p>>2]|0;x=(c[p>>2]|0)+32|0;c[s>>2]=32;c[s+4>>2]=f;c[s+8>>2]=32;c[s+12>>2]=x;x=Bd(g,0,20141,s)|0;c[i>>2]=x;if(x){c[j>>2]=918;if((c[222]|0)==-1)c[222]=Wb(1,20980,19405,20170,c[j>>2]|0)|0;if((Xb()|0)<=0){if(c[222]|0){x=xd(c[i>>2]|0)|0;c[v>>2]=19528;c[v+4>>2]=19405;c[v+8>>2]=918;c[v+12>>2]=x;cc(1,20980,20531,v)}}else Yb(-1,0);c[n>>2]=-1;x=c[n>>2]|0;l=w;return x|0}c[r>>2]=sc(c[o>>2]|0)|0;x=c[q>>2]|0;c[t>>2]=32;c[t+4>>2]=x;x=Bd(h,0,20197,t)|0;c[i>>2]=x;if(x){Cd(c[r>>2]|0);Cd(c[g>>2]|0);c[n>>2]=-1;x=c[n>>2]|0;l=w;return x|0}c[i>>2]=he(c[g>>2]|0,c[r>>2]|0,c[h>>2]|0)|0;Cd(c[h>>2]|0);Cd(c[r>>2]|0);Cd(c[g>>2]|0);if(!(c[i>>2]|0)){c[n>>2]=1;x=c[n>>2]|0;l=w;return x|0}c[k>>2]=938;if((c[223]|0)==-1)c[223]=Wb(8,20980,19405,20170,c[k>>2]|0)|0;if((Xb()|0)<=0){if(c[223]|0){x=xd(c[i>>2]|0)|0;c[u>>2]=19405;c[u+4>>2]=938;c[u+8>>2]=x;cc(8,20980,20249,u)}}else Yb(-1,0);c[n>>2]=-1;x=c[n>>2]|0;l=w;return x|0}function uc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;z=l;l=l+144|0;if((l|0)>=(m|0))$(144);w=z+40|0;v=z+32|0;y=z+16|0;x=z+8|0;A=z;p=z+104|0;q=z+100|0;B=z+96|0;r=z+92|0;s=z+88|0;t=z+84|0;u=z+80|0;e=z+76|0;f=z+72|0;g=z+68|0;h=z+112|0;i=z+64|0;j=z+60|0;k=z+56|0;n=z+52|0;o=z+48|0;c[q>>2]=a;c[B>>2]=b;c[r>>2]=d;d=c[B>>2]|0;c[A>>2]=32;c[A+4>>2]=d;if(Bd(f,0,20102,A)|0){c[p>>2]=-1;B=c[p>>2]|0;l=z;return B|0}if(Sd(e,c[f>>2]|0,0)|0){c[j>>2]=972;if((c[224]|0)==-1)c[224]=Wb(1,0,19405,20299,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[224]|0))Vb();c[x>>2]=19405;c[x+4>>2]=972;Zb(1,61295,x);Vb()}Cd(c[f>>2]|0);c[t>>2]=Ud(46923,c[e>>2]|0,0)|0;Lc(u,c[q>>2]|0,32);c[s>>2]=Qd(0)|0;Wd(c[s>>2]|0,c[u>>2]|0,c[t>>2]|0,c[e>>2]|0);Rd(c[t>>2]|0);Id(c[u>>2]|0);c[g>>2]=Hd(256)|0;if(Vd(c[g>>2]|0,0,c[s>>2]|0,c[e>>2]|0)|0){c[k>>2]=989;if((c[225]|0)==-1)c[225]=Wb(1,20980,19405,20299,c[k>>2]|0)|0;if((Xb()|0)<=0){if(c[225]|0){B=xd(0)|0;c[y>>2]=20322;c[y+4>>2]=19405;c[y+8>>2]=989;c[y+12>>2]=B;cc(1,20980,20531,y)}}else Yb(-1,0);Rd(c[s>>2]|0);ve(c[e>>2]|0);c[p>>2]=-1;B=c[p>>2]|0;l=z;return B|0}Rd(c[s>>2]|0);ve(c[e>>2]|0);c[i>>2]=32;if($d(c[g>>2]|0,2)|0){c[n>>2]=998;if((c[226]|0)==-1)c[226]=Wb(1,0,19405,20299,c[n>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[226]|0))Vb();c[v>>2]=19405;c[v+4>>2]=998;Zb(1,61295,v);Vb()}if(!(Ld(1,h,c[i>>2]|0,i,c[g>>2]|0)|0)){wc(h,c[i>>2]|0,c[r>>2]|0);Id(c[g>>2]|0);c[p>>2]=1;B=c[p>>2]|0;l=z;return B|0}c[o>>2]=1005;if((c[227]|0)==-1)c[227]=Wb(1,0,19405,20299,c[o>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[227]|0))Vb();c[w>>2]=19405;c[w+4>>2]=1005;Zb(1,61295,w);Vb();return 0}function vc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;z=l;l=l+144|0;if((l|0)>=(m|0))$(144);w=z+40|0;v=z+32|0;y=z+16|0;x=z+8|0;A=z;p=z+104|0;q=z+100|0;B=z+96|0;r=z+92|0;s=z+88|0;t=z+84|0;u=z+80|0;e=z+76|0;f=z+72|0;g=z+68|0;h=z+112|0;i=z+64|0;j=z+60|0;k=z+56|0;n=z+52|0;o=z+48|0;c[q>>2]=a;c[B>>2]=b;c[r>>2]=d;d=c[B>>2]|0;c[A>>2]=32;c[A+4>>2]=d;if(Bd(f,0,20102,A)|0){c[p>>2]=-1;B=c[p>>2]|0;l=z;return B|0}if(Sd(e,c[f>>2]|0,0)|0){c[j>>2]=1403;if((c[228]|0)==-1)c[228]=Wb(1,0,19405,20340,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[228]|0))Vb();c[x>>2]=19405;c[x+4>>2]=1403;Zb(1,61295,x);Vb()}Cd(c[f>>2]|0);c[t>>2]=Ud(46923,c[e>>2]|0,0)|0;Lc(u,c[q>>2]|0,32);c[s>>2]=Qd(0)|0;Wd(c[s>>2]|0,c[u>>2]|0,c[t>>2]|0,c[e>>2]|0);Rd(c[t>>2]|0);Id(c[u>>2]|0);c[g>>2]=Hd(256)|0;if(Vd(c[g>>2]|0,0,c[s>>2]|0,c[e>>2]|0)|0){c[k>>2]=1420;if((c[229]|0)==-1)c[229]=Wb(1,20980,19405,20340,c[k>>2]|0)|0;if((Xb()|0)<=0){if(c[229]|0){B=xd(0)|0;c[y>>2]=20322;c[y+4>>2]=19405;c[y+8>>2]=1420;c[y+12>>2]=B;cc(1,20980,20531,y)}}else Yb(-1,0);Rd(c[s>>2]|0);ve(c[e>>2]|0);c[p>>2]=-1;B=c[p>>2]|0;l=z;return B|0}Rd(c[s>>2]|0);ve(c[e>>2]|0);c[i>>2]=32;if($d(c[g>>2]|0,2)|0){c[n>>2]=1429;if((c[230]|0)==-1)c[230]=Wb(1,0,19405,20340,c[n>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[230]|0))Vb();c[v>>2]=19405;c[v+4>>2]=1429;Zb(1,61295,v);Vb()}if(!(Ld(1,h,c[i>>2]|0,i,c[g>>2]|0)|0)){wc(h,c[i>>2]|0,c[r>>2]|0);Id(c[g>>2]|0);c[p>>2]=1;B=c[p>>2]|0;l=z;return B|0}c[o>>2]=1436;if((c[231]|0)==-1)c[231]=Wb(1,0,19405,20340,c[o>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[231]|0))Vb();c[w>>2]=19405;c[w+4>>2]=1436;Zb(1,61295,w);Vb();return 0}function wc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=e+8|0;f=e+4|0;h=e;c[g>>2]=a;c[f>>2]=b;c[h>>2]=d;pe(10,c[h>>2]|0,c[g>>2]|0,c[f>>2]|0);l=e;return}function xc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=g+8|0;e=g+4|0;f=g;c[d>>2]=a;c[e>>2]=b;c[f>>2]=15;while(1){if((c[f>>2]|0)<0)break;b=Nc(c[d>>2]|0,-1)|0;c[(c[e>>2]|0)+(c[f>>2]<<2)>>2]=b;c[f>>2]=(c[f>>2]|0)+-1}l=g;return}function yc(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e;a=e+12|0;b=e+8|0;c[a>>2]=Pb(4,20365,425)|0;if(!(ke(c[a>>2]|0,10,0)|0)){l=e;return c[a>>2]|0}c[b>>2]=429;if((c[232]|0)==-1)c[232]=Wb(1,0,20365,20379,c[b>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[232]|0))Vb();c[d>>2]=20365;c[d+4>>2]=429;Zb(1,61295,d);Vb();return 0}function zc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=e+8|0;g=e+4|0;f=e;c[h>>2]=a;c[g>>2]=b;c[f>>2]=d;ne(c[c[h>>2]>>2]|0,c[g>>2]|0,c[f>>2]|0);l=e;return}function Ac(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=j;i=j+20|0;e=j+16|0;h=j+12|0;f=j+8|0;c[i>>2]=b;c[e>>2]=d;c[h>>2]=oe(c[c[i>>2]>>2]|0,0)|0;if(c[h>>2]|0){if(!(c[e>>2]|0)){i=c[i>>2]|0;Bc(i);l=j;return}e=c[e>>2]|0;b=c[h>>2]|0;d=e+64|0;do{a[e>>0]=a[b>>0]|0;e=e+1|0;b=b+1|0}while((e|0)<(d|0));i=c[i>>2]|0;Bc(i);l=j;return}c[f>>2]=462;if((c[233]|0)==-1)c[233]=Wb(1,0,20365,20412,c[f>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[233]|0))Vb();c[g>>2]=20365;c[g+4>>2]=462;Zb(1,61295,g);Vb()}function Bc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;le(c[c[d>>2]>>2]|0);Rb(c[d>>2]|0,20365,480);l=b;return}function Cc(b,d,e,f,g,h,i,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0;U=l;l=l+144|0;if((l|0)>=(m|0))$(144);S=U+136|0;G=U+132|0;n=U+128|0;o=U+124|0;p=U+120|0;q=U+116|0;r=U+112|0;s=U+108|0;t=U+104|0;w=U+100|0;H=U+96|0;I=U+92|0;J=U+88|0;x=U+84|0;K=U+80|0;L=U+76|0;M=U+72|0;F=U+68|0;N=U+64|0;O=U+60|0;y=U+56|0;z=U+40|0;P=U+36|0;u=U+32|0;v=U+28|0;Q=U+24|0;R=U+20|0;A=U+16|0;B=U+12|0;C=U+8|0;D=U+4|0;E=U;c[G>>2]=b;c[n>>2]=d;c[o>>2]=e;c[p>>2]=f;c[q>>2]=g;c[r>>2]=h;c[s>>2]=i;c[t>>2]=j;c[w>>2]=k;c[M>>2]=re(c[p>>2]|0)|0;c[F>>2]=re(c[o>>2]|0)|0;b=c[F>>2]|0;c[N>>2]=Va()|0;f=l;l=l+((1*b|0)+15&-16)|0;if((l|0)>=(m|0))$((1*b|0)+15&-16|0);if(!(c[M>>2]|0)){c[S>>2]=-1;c[P>>2]=1;T=c[N>>2]|0;Ca(T|0);T=c[S>>2]|0;l=U;return T|0}if(ke(H,c[o>>2]|0,2)|0){c[S>>2]=-1;c[P>>2]=1;T=c[N>>2]|0;Ca(T|0);T=c[S>>2]|0;l=U;return T|0}if(ke(I,c[p>>2]|0,2)|0){le(c[H>>2]|0);c[S>>2]=-1;c[P>>2]=1;T=c[N>>2]|0;Ca(T|0);T=c[S>>2]|0;l=U;return T|0}c[z>>2]=c[c[w>>2]>>2];c[y>>2]=0;while(1){o=(c[z>>2]|0)+(4-1)&~(4-1);p=c[o>>2]|0;c[z>>2]=o+4;c[u>>2]=p;if(!(c[u>>2]|0))break;o=(c[z>>2]|0)+(4-1)&~(4-1);p=c[o>>2]|0;c[z>>2]=o+4;c[v>>2]=p;c[y>>2]=(c[y>>2]|0)+(c[v>>2]|0)}Yq(c[G>>2]|0,0,c[n>>2]|0)|0;a:do if((Dc(c[H>>2]|0,c[q>>2]|0,c[r>>2]|0,c[s>>2]|0,c[t>>2]|0,f)|0)!=1)T=45;else{c[K>>2]=((c[n>>2]|0)>>>0)/((c[M>>2]|0)>>>0)|0;c[L>>2]=((c[n>>2]|0)>>>0)%((c[M>>2]|0)>>>0)|0;c[Q>>2]=(c[M>>2]|0)+(c[y>>2]|0)+1;b=c[Q>>2]|0;c[R>>2]=Va()|0;e=l;l=l+((1*b|0)+15&-16)|0;if((l|0)>=(m|0))$((1*b|0)+15&-16|0);c[B>>2]=e+(c[M>>2]|0);c[z>>2]=c[c[w>>2]>>2];while(1){v=(c[z>>2]|0)+(4-1)&~(4-1);w=c[v>>2]|0;c[z>>2]=v+4;c[C>>2]=w;w=c[C>>2]|0;c[A>>2]=w;if(!w)break;v=(c[z>>2]|0)+(4-1)&~(4-1);w=c[v>>2]|0;c[z>>2]=v+4;c[E>>2]=w;c[D>>2]=c[E>>2];if(c[D>>2]|0)cr(c[B>>2]|0,c[A>>2]|0,c[D>>2]|0)|0;c[B>>2]=(c[B>>2]|0)+(c[D>>2]|0)}do if((c[K>>2]|0)>>>0>0){a[e+(c[M>>2]|0)+(c[y>>2]|0)>>0]=1;c[J>>2]=Ec(c[I>>2]|0,f,c[F>>2]|0,e+(c[M>>2]|0)|0,(c[y>>2]|0)+1|0)|0;if(!(c[J>>2]|0)){c[P>>2]=4;break}if(c[M>>2]|0)cr(c[G>>2]|0,c[J>>2]|0,c[M>>2]|0)|0;c[G>>2]=(c[G>>2]|0)+(c[M>>2]|0);T=22}else T=22;while(0);do if((T|0)==22){c[x>>2]=1;while(1){if((c[x>>2]|0)>>>0>=(c[K>>2]|0)>>>0)break;if(c[M>>2]|0)cr(e|0,(c[G>>2]|0)+(0-(c[M>>2]|0))|0,c[M>>2]|0)|0;Yq(e+(c[M>>2]|0)+(c[y>>2]|0)|0,(c[x>>2]|0)+1&255|0,1)|0;me(c[I>>2]|0);c[J>>2]=Ec(c[I>>2]|0,f,c[F>>2]|0,e,c[Q>>2]|0)|0;if(!(c[J>>2]|0)){T=27;break}if(c[M>>2]|0)cr(c[G>>2]|0,c[J>>2]|0,c[M>>2]|0)|0;c[G>>2]=(c[G>>2]|0)+(c[M>>2]|0);c[x>>2]=(c[x>>2]|0)+1}if((T|0)==27){c[P>>2]=4;break}if((c[L>>2]|0)>>>0>0){if((c[K>>2]|0)>>>0>0){if(c[M>>2]|0)cr(e|0,(c[G>>2]|0)+(0-(c[M>>2]|0))|0,c[M>>2]|0)|0;c[x>>2]=(c[x>>2]|0)+1}Yq(e+(c[M>>2]|0)+(c[y>>2]|0)|0,c[x>>2]&255|0,1)|0;me(c[I>>2]|0);d=c[I>>2]|0;b=c[F>>2]|0;if((c[K>>2]|0)>>>0>0)c[J>>2]=Ec(d,f,b,e,c[Q>>2]|0)|0;else c[J>>2]=Ec(d,f,b,e+(c[M>>2]|0)|0,(c[Q>>2]|0)-(c[M>>2]|0)|0)|0;if(!(c[J>>2]|0)){c[P>>2]=4;break}if(c[L>>2]|0)cr(c[G>>2]|0,c[J>>2]|0,c[L>>2]|0)|0}c[O>>2]=1;c[P>>2]=22}while(0);Ca(c[R>>2]|0);switch(c[P>>2]|0){case 4:{T=45;break a}case 22:break a;default:{}}T=c[N>>2]|0;Ca(T|0);T=c[S>>2]|0;l=U;return T|0}while(0);if((T|0)==45)c[O>>2]=-1;le(c[H>>2]|0);le(c[I>>2]|0);c[S>>2]=c[O>>2];c[P>>2]=1;T=c[N>>2]|0;Ca(T|0);T=c[S>>2]|0;l=U;return T|0}function Dc(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;n=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=n+28|0;k=n+24|0;r=n+20|0;q=n+16|0;p=n+12|0;o=n+8|0;h=n+4|0;i=n;c[k>>2]=a;c[r>>2]=b;c[q>>2]=d;c[p>>2]=e;c[o>>2]=f;c[h>>2]=g;c[i>>2]=Ec(c[k>>2]|0,c[r>>2]|0,c[q>>2]|0,c[p>>2]|0,c[o>>2]|0)|0;if(!(c[i>>2]|0)){c[j>>2]=-1;r=c[j>>2]|0;l=n;return r|0}if(re(qe(c[k>>2]|0)|0)|0){q=c[h>>2]|0;r=c[i>>2]|0;cr(q|0,r|0,re(qe(c[k>>2]|0)|0)|0)|0}c[j>>2]=1;r=c[j>>2]|0;l=n;return r|0}function Ec(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g+16|0;n=g+12|0;k=g+8|0;j=g+4|0;i=g;c[h>>2]=a;c[n>>2]=b;c[k>>2]=d;c[j>>2]=e;c[i>>2]=f;se(c[h>>2]|0,c[n>>2]|0,c[k>>2]|0)|0;ne(c[h>>2]|0,c[j>>2]|0,c[i>>2]|0);f=oe(c[h>>2]|0,0)|0;l=g;return f|0}function Fc(a,b,d,e,f,g,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;k=l;l=l+64|0;if((l|0)>=(m|0))$(64);w=k+52|0;v=k+48|0;u=k+44|0;t=k+40|0;s=k+36|0;r=k+32|0;q=k+28|0;p=k+24|0;o=k+8|0;n=k;c[w>>2]=a;c[v>>2]=b;c[u>>2]=d;c[t>>2]=e;c[s>>2]=f;c[r>>2]=g;c[q>>2]=h;c[p>>2]=i;c[o>>2]=j;c[n>>2]=Cc(c[w>>2]|0,c[v>>2]|0,c[u>>2]|0,c[t>>2]|0,c[s>>2]|0,c[r>>2]|0,c[q>>2]|0,c[p>>2]|0,o)|0;l=k;return c[n>>2]|0}function Gc(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);r=i+24|0;q=i+20|0;p=i+16|0;o=i+12|0;n=i+8|0;k=i+4|0;j=i;c[r>>2]=a;c[q>>2]=b;c[p>>2]=d;c[o>>2]=e;c[n>>2]=f;c[k>>2]=g;c[j>>2]=h;h=Cc(c[r>>2]|0,c[q>>2]|0,10,8,c[p>>2]|0,c[o>>2]|0,c[n>>2]|0,c[k>>2]|0,c[j>>2]|0)|0;l=i;return h|0}function Hc(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);s=i+44|0;r=i+40|0;q=i+36|0;p=i+32|0;o=i+28|0;n=i+24|0;k=i+8|0;j=i;c[s>>2]=a;c[r>>2]=b;c[q>>2]=d;c[p>>2]=e;c[o>>2]=f;c[n>>2]=g;c[k>>2]=h;c[j>>2]=Gc(c[s>>2]|0,c[r>>2]|0,c[q>>2]|0,c[p>>2]|0,c[o>>2]|0,c[n>>2]|0,k)|0;l=i;return c[j>>2]|0}function Ic(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;E=l;l=l+112|0;if((l|0)>=(m|0))$(112);C=E+40|0;B=E+32|0;D=E+24|0;x=E;u=E+108|0;v=E+104|0;w=E+100|0;i=E+96|0;j=E+92|0;k=E+88|0;n=E+84|0;o=E+80|0;p=E+76|0;q=E+72|0;r=E+68|0;s=E+64|0;y=E+60|0;z=E+56|0;A=E+52|0;t=E+48|0;c[u>>2]=a;c[v>>2]=b;c[w>>2]=d;c[i>>2]=e;c[j>>2]=f;c[k>>2]=g;c[n>>2]=h;c[p>>2]=Xd(c[v>>2]|0)|0;c[r>>2]=0;while(1){b=((((c[p>>2]|0)-1|0)>>>0)/8|0)+1|0;c[s>>2]=Va()|0;a=b;d=l;l=l+((1*a|0)+15&-16)|0;if((l|0)>=(m|0))$((1*a|0)+15&-16|0);e=c[w>>2]|0;f=c[i>>2]|0;g=c[j>>2]|0;h=c[k>>2]|0;F=c[n>>2]|0;a=Fo(c[n>>2]|0)|0;c[x>>2]=F;c[x+4>>2]=a;c[x+8>>2]=r;c[x+12>>2]=4;c[x+16>>2]=0;c[x+20>>2]=0;c[o>>2]=Hc(d,b,e,f,g,h,x)|0;if(1!=(c[o>>2]|0)){a=3;break}c[o>>2]=Kd(c[u>>2]|0,5,d,b,q)|0;if(c[o>>2]|0){a=11;break}Zd(c[c[u>>2]>>2]|0,c[p>>2]|0);if(Yd(c[c[u>>2]>>2]|0,c[p>>2]|0)|0){a=19;break}c[r>>2]=(c[r>>2]|0)+1;if(0>(Jd(c[c[u>>2]>>2]|0,c[v>>2]|0)|0))c[t>>2]=3;else{Id(c[c[u>>2]>>2]|0);c[t>>2]=0}Ca(c[s>>2]|0);if((c[t>>2]|0)>>>0>=1){a=30;break}}if((a|0)==3){c[y>>2]=155;if((c[234]|0)==-1)c[234]=Wb(1,0,20446,20459,c[y>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[234]|0))Vb();c[D>>2]=20446;c[D+4>>2]=155;Zb(1,61295,D);Vb()}else if((a|0)==11){c[z>>2]=162;if((c[235]|0)==-1)c[235]=Wb(1,0,20446,20459,c[z>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[235]|0))Vb();c[B>>2]=20446;c[B+4>>2]=162;Zb(1,61295,B);Vb()}else if((a|0)==19){c[A>>2]=165;if((c[236]|0)==-1)c[236]=Wb(1,0,20446,20459,c[A>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[236]|0))Vb();c[C>>2]=20446;c[C+4>>2]=165;Zb(1,61295,C);Vb()}else if((a|0)==30){l=E;return}}function Jc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=l;l=l+80|0;if((l|0)>=(m|0))$(80);s=t+24|0;r=t+8|0;q=t;h=t+68|0;i=t+64|0;j=t+60|0;k=t+56|0;n=t+52|0;o=t+48|0;p=t+44|0;e=t+40|0;f=t+36|0;g=t+32|0;c[h>>2]=a;c[i>>2]=b;c[j>>2]=d;if($d(c[j>>2]|0,2)|0){c[p>>2]=_d(c[j>>2]|0,o)|0;if(c[p>>2]|0){c[k>>2]=(((c[o>>2]|0)+7|0)>>>0)/8|0;if((c[k>>2]|0)>>>0>(c[i>>2]|0)>>>0)c[k>>2]=c[i>>2];if(c[k>>2]|0)cr(c[h>>2]|0,c[p>>2]|0,c[k>>2]|0)|0;if((c[k>>2]|0)>>>0>=(c[i>>2]|0)>>>0){l=t;return}Yq((c[h>>2]|0)+(c[k>>2]|0)|0,0,(c[i>>2]|0)-(c[k>>2]|0)|0)|0;l=t;return}c[e>>2]=89;if((c[237]|0)==-1)c[237]=Wb(1,0,20485,20498,c[e>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[237]|0))Vb();c[q>>2]=20485;c[q+4>>2]=89;Zb(1,61295,q);Vb()}else{c[k>>2]=c[i>>2];q=Ld(5,c[h>>2]|0,c[k>>2]|0,k,c[j>>2]|0)|0;c[n>>2]=q;if(!q){Kc(c[h>>2]|0,c[k>>2]|0,c[i>>2]|0);l=t;return}c[f>>2]=110;if((c[238]|0)==-1)c[238]=Wb(1,20980,20485,20498,c[f>>2]|0)|0;if((Xb()|0)<=0){if(c[238]|0){t=xd(c[n>>2]|0)|0;c[r>>2]=20568;c[r+4>>2]=20485;c[r+8>>2]=110;c[r+12>>2]=t;cc(1,20980,20531,r)}}else Yb(-1,0);c[g>>2]=111;if((c[239]|0)==-1)c[239]=Wb(1,0,20485,20498,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[239]|0))Vb();c[s>>2]=20485;c[s+4>>2]=111;Zb(1,61295,s);Vb()}}function Kc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=i+12|0;f=i+8|0;g=i+4|0;h=i;c[e>>2]=a;c[f>>2]=b;c[g>>2]=d;c[h>>2]=c[e>>2];if((c[f>>2]|0)>>>0>=(c[g>>2]|0)>>>0){l=i;return}dr((c[h>>2]|0)+((c[g>>2]|0)-(c[f>>2]|0))|0,c[e>>2]|0,c[f>>2]|0)|0;Yq(c[e>>2]|0,0,(c[g>>2]|0)-(c[f>>2]|0)|0)|0;l=i;return}function Lc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;j=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=j+16|0;h=j;o=j+44|0;n=j+40|0;k=j+36|0;e=j+32|0;f=j+28|0;g=j+24|0;c[o>>2]=a;c[n>>2]=b;c[k>>2]=d;d=Kd(c[o>>2]|0,5,c[n>>2]|0,c[k>>2]|0,k)|0;c[e>>2]=d;if(!d){l=j;return}c[f>>2]=140;if((c[240]|0)==-1)c[240]=Wb(1,20980,20485,20583,c[f>>2]|0)|0;if((Xb()|0)<=0){if(c[240]|0){o=xd(c[e>>2]|0)|0;c[h>>2]=20615;c[h+4>>2]=20485;c[h+8>>2]=140;c[h+12>>2]=o;cc(1,20980,20531,h)}}else Yb(-1,0);c[g>>2]=141;if((c[241]|0)==-1)c[241]=Wb(1,0,20485,20583,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[241]|0))Vb();c[i>>2]=20485;c[i+4>>2]=141;Zb(1,61295,i);Vb()}function Mc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+80|0;if((l|0)>=(m|0))$(80);i=n+56|0;h=n+48|0;g=n+40|0;f=n+32|0;k=n+24|0;j=n+16|0;e=n+8|0;d=n;a=n+64|0;b=n+60|0;if(yd(20629)|0){c[j>>2]=0;j=zd(37,j)|0;c[a>>2]=j;if(j|0){j=c[3935]|0;e=xd(c[a>>2]|0)|0;c[k>>2]=20782;c[k+4>>2]=e;Rp(j,20743,k)|0}c[f>>2]=0;k=zd(44,f)|0;c[a>>2]=k;if(!k){c[h>>2]=0;zd(38,h)|0;c[i>>2]=0;zd(48,i)|0;j=fb(0)|0;k=Nc(2,-1)|0;k=j^k;Oc(k);l=n;return}j=c[3935]|0;k=xd(c[a>>2]|0)|0;c[g>>2]=20797;c[g+4>>2]=k;Rp(j,20743,g)|0;c[h>>2]=0;zd(38,h)|0;c[i>>2]=0;zd(48,i)|0;j=fb(0)|0;k=Nc(2,-1)|0;k=j^k;Oc(k);l=n;return}n=c[3935]|0;c[d>>2]=20629;Rp(n,20635,d)|0;c[b>>2]=286;if((c[242]|0)==-1)c[242]=Wb(1,0,20701,20717,c[b>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[242]|0))Vb();c[e>>2]=20701;c[e+4>>2]=286;Zb(1,61295,e);Vb()}function Nc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0.0;p=l;l=l+64|0;if((l|0)>=(m|0))$(64);o=p+16|0;n=p+8|0;k=p;d=p+48|0;e=p+44|0;f=p+40|0;g=p+36|0;h=p+32|0;i=p+28|0;j=p+24|0;c[e>>2]=a;c[f>>2]=b;if((c[f>>2]|0)>>>0<=0){c[i>>2]=157;if((c[243]|0)==-1)c[243]=Wb(1,0,20701,20817,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[243]|0))Vb();c[k>>2]=20701;c[k+4>>2]=157;Zb(1,61295,k);Vb()}switch(c[e>>2]|0){case 1:{o=c[17573]|0;c[17573]=o+1;if(!((o>>>0)%256|0)){c[n>>2]=0;zd(48,n)|0}c[h>>2]=-1-(4294967295%((c[f>>2]|0)>>>0)|0);do te(g,4,1);while((c[g>>2]|0)>>>0>=(c[h>>2]|0)>>>0);c[d>>2]=((c[g>>2]|0)>>>0)%((c[f>>2]|0)>>>0)|0;o=c[d>>2]|0;l=p;return o|0}case 2:{c[h>>2]=-1-(4294967295%((c[f>>2]|0)>>>0)|0);do ue(g,4);while((c[g>>2]|0)>>>0>=(c[h>>2]|0)>>>0);c[d>>2]=((c[g>>2]|0)>>>0)%((c[f>>2]|0)>>>0)|0;o=c[d>>2]|0;l=p;return o|0}case 0:{q=+((c[f>>2]|0)>>>0);c[g>>2]=~~(q*+Pc())>>>0;if((c[g>>2]|0)>>>0>=(c[f>>2]|0)>>>0)c[g>>2]=(c[f>>2]|0)-1;c[d>>2]=c[g>>2];o=c[d>>2]|0;l=p;return o|0}default:{c[j>>2]=189;if((c[244]|0)==-1)c[244]=Wb(1,0,20701,20817,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[244]|0))Vb();c[o>>2]=20701;c[o+4>>2]=189;Zb(1,61295,o);Vb()}}return 0}function Oc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Cq(c[d>>2]|0);l=b;return}function Pc(){return +(+(Eq()|0)/2147483647.0)}function Qc(){we(0,0);return}function Rc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;k=l;l=l+48|0;if((l|0)>=(m|0))$(48);j=k+16|0;i=k+8|0;h=k;n=k+36|0;e=k+32|0;f=k+28|0;g=k+24|0;c[n>>2]=a;c[e>>2]=b;c[f>>2]=d;switch(c[n>>2]|0){case 1:{n=c[17574]|0;c[17574]=n+1;if(!((n>>>0)%256|0)){c[h>>2]=0;zd(48,h)|0}te(c[e>>2]|0,c[f>>2]|0,1);l=k;return}case 2:{ue(c[e>>2]|0,c[f>>2]|0);l=k;return}case 0:{n=c[17574]|0;c[17574]=n+1;if(!((n>>>0)%256|0)){c[i>>2]=0;zd(48,i)|0}te(c[e>>2]|0,c[f>>2]|0,0);l=k;return}default:{c[g>>2]=135;if((c[245]|0)==-1)c[245]=Wb(1,0,20701,20842,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[245]|0))Vb();c[j>>2]=20701;c[j+4>>2]=135;Zb(1,61295,j);Vb()}}}function Sc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;j=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=j+16|0;h=j+8|0;k=j;n=j+44|0;b=j+40|0;d=j+36|0;e=j+32|0;f=j+28|0;g=j+24|0;c[n>>2]=a;c[k>>2]=c[n>>2];if(Bd(e,0,20869,k)|0){c[f>>2]=155;if((c[246]|0)==-1)c[246]=Wb(1,0,20893,20906,c[f>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[246]|0))Vb();c[h>>2]=20893;c[h+4>>2]=155;Zb(1,61295,h);Vb()}if(!(je(d,c[e>>2]|0)|0)){Cd(c[e>>2]|0);c[b>>2]=Pb(4,20893,164)|0;c[c[b>>2]>>2]=c[d>>2];l=j;return c[b>>2]|0}c[g>>2]=158;if((c[247]|0)==-1)c[247]=Wb(1,0,20893,20906,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[247]|0))Vb();c[i>>2]=20893;c[i+4>>2]=158;Zb(1,61295,i);Vb();return 0}function Tc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Cd(c[c[d>>2]>>2]|0);Rb(c[d>>2]|0,20893,179);l=b;return}function Uc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=i;j=i+24|0;d=i+20|0;e=i+16|0;f=i+12|0;g=i+8|0;c[j>>2]=a;c[d>>2]=b;c[e>>2]=Dd(c[c[j>>2]>>2]|0,0,0,0)|0;c[f>>2]=Pb(c[e>>2]|0,20893,202)|0;b=(c[e>>2]|0)-1|0;if((b|0)==(Dd(c[c[j>>2]>>2]|0,0,c[f>>2]|0,c[e>>2]|0)|0)){c[c[d>>2]>>2]=c[f>>2];l=i;return c[e>>2]|0}c[g>>2]=207;if((c[248]|0)==-1)c[248]=Wb(1,0,20893,20943,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[248]|0))Vb();c[h>>2]=20893;c[h+4>>2]=207;Zb(1,61295,h);Vb();return 0}function Vc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;j=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=j+8|0;h=j;d=j+32|0;n=j+28|0;k=j+24|0;e=j+20|0;f=j+16|0;g=j+12|0;c[n>>2]=a;c[k>>2]=b;c[e>>2]=Pb(4,20893,226)|0;if(Ad(c[e>>2]|0,c[n>>2]|0,c[k>>2]|0,0)|0){c[f>>2]=234;if((c[249]|0)==-1)c[249]=Wb(2,20980,20893,20985,c[f>>2]|0)|0;if((Xb()|0)<=0){if(c[249]|0)cc(2,20980,21022,h)}else Yb(-1,0);Rb(c[e>>2]|0,20893,235);c[d>>2]=0;n=c[d>>2]|0;l=j;return n|0}if(!(ie(c[c[e>>2]>>2]|0)|0)){c[d>>2]=c[e>>2];n=c[d>>2]|0;l=j;return n|0}c[g>>2]=241;if((c[250]|0)==-1)c[250]=Wb(2,20980,20893,20985,c[g>>2]|0)|0;if((Xb()|0)<=0){if(c[250]|0)cc(2,20980,21022,i)}else Yb(-1,0);Tc(c[e>>2]|0);c[d>>2]=0;n=c[d>>2]|0;l=j;return n|0}function Wc(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+64|0;if((l|0)>=(m|0))$(64);k=n+8|0;j=n;b=n+48|0;d=n+44|0;e=n+40|0;f=n+32|0;g=n+24|0;h=n+20|0;i=n+16|0;c[d>>2]=a;c[g>>2]=Xc(f,c[c[d>>2]>>2]|0,37679,39061)|0;if(c[g>>2]|0)c[g>>2]=Xc(f,c[c[d>>2]>>2]|0,37667,39061)|0;if(c[g>>2]|0)c[g>>2]=Xc(f,c[c[d>>2]>>2]|0,40693,39061)|0;if(!(c[g>>2]|0)){j=c[f+4>>2]|0;c[k>>2]=c[f>>2];c[k+4>>2]=j;c[g>>2]=Bd(h,0,21145,k)|0;Id(c[f>>2]|0);Id(c[f+4>>2]|0);c[e>>2]=Pb(4,20893,280)|0;c[c[e>>2]>>2]=c[h>>2];c[b>>2]=c[e>>2];k=c[b>>2]|0;l=n;return k|0}c[i>>2]=270;if((c[251]|0)==-1)c[251]=Wb(2,0,20893,21056,c[i>>2]|0)|0;if((Xb()|0)<=0){if(c[251]|0){c[j>>2]=20893;c[j+4>>2]=270;Zb(66,21097,j)}}else Yb(-1,0);c[b>>2]=0;k=c[b>>2]|0;l=n;return k|0}function Xc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;q=l;l=l+48|0;if((l|0)>=(m|0))$(48);n=q+36|0;o=q+32|0;s=q+28|0;r=q+24|0;g=q+20|0;p=q+16|0;h=q+12|0;i=q+8|0;j=q+4|0;k=q;c[o>>2]=b;c[s>>2]=d;c[r>>2]=e;c[g>>2]=f;f=Ed(c[s>>2]|0,c[r>>2]|0,0)|0;c[p>>2]=f;if(!f){c[n>>2]=1;s=c[n>>2]|0;l=q;return s|0}c[h>>2]=Fd(c[p>>2]|0)|0;Cd(c[p>>2]|0);c[p>>2]=c[h>>2];if(!(c[p>>2]|0)){c[n>>2]=2;s=c[n>>2]|0;l=q;return s|0}c[k>>2]=0;c[i>>2]=c[g>>2];while(1){d=c[p>>2]|0;if(!(a[c[i>>2]>>0]|0)){b=18;break}s=Ed(d,c[i>>2]|0,1)|0;c[h>>2]=s;if(!s){b=8;break}s=Gd(c[h>>2]|0,1,5)|0;c[(c[o>>2]|0)+(c[k>>2]<<2)>>2]=s;Cd(c[h>>2]|0);if(!(c[(c[o>>2]|0)+(c[k>>2]<<2)>>2]|0)){b=13;break}c[i>>2]=(c[i>>2]|0)+1;c[k>>2]=(c[k>>2]|0)+1}if((b|0)==8){c[j>>2]=0;while(1){if((c[j>>2]|0)>>>0>=(c[k>>2]|0)>>>0)break;ye(c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]|0);c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]=0;c[j>>2]=(c[j>>2]|0)+1}Cd(c[p>>2]|0);c[n>>2]=3;s=c[n>>2]|0;l=q;return s|0}else if((b|0)==13){c[j>>2]=0;while(1){if((c[j>>2]|0)>>>0>=(c[k>>2]|0)>>>0)break;ye(c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]|0);c[(c[o>>2]|0)+(c[j>>2]<<2)>>2]=0;c[j>>2]=(c[j>>2]|0)+1}Cd(c[p>>2]|0);c[n>>2]=4;s=c[n>>2]|0;l=q;return s|0}else if((b|0)==18){Cd(d);c[n>>2]=0;s=c[n>>2]|0;l=q;return s|0}return 0}function Yc(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Cd(c[c[d>>2]>>2]|0);Rb(c[d>>2]|0,20893,295);l=b;return}function Zc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=i;j=i+24|0;d=i+20|0;e=i+16|0;f=i+12|0;g=i+8|0;c[j>>2]=a;c[d>>2]=b;c[e>>2]=Dd(c[c[j>>2]>>2]|0,3,0,0)|0;c[f>>2]=Pb(c[e>>2]|0,20893,318)|0;b=(c[e>>2]|0)-1|0;if((b|0)==(Dd(c[c[j>>2]>>2]|0,3,c[f>>2]|0,c[e>>2]|0)|0)){c[c[d>>2]>>2]=c[f>>2];l=i;return c[e>>2]|0}c[g>>2]=323;if((c[252]|0)==-1)c[252]=Wb(1,0,20893,21175,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[252]|0))Vb();c[h>>2]=20893;c[h+4>>2]=323;Zb(1,61295,h);Vb();return 0}function _c(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;n=l;l=l+48|0;if((l|0)>=(m|0))$(48);k=n+8|0;j=n;d=n+44|0;p=n+40|0;o=n+36|0;e=n+32|0;f=n+28|0;g=n+24|0;h=n+20|0;i=n+16|0;c[p>>2]=a;c[o>>2]=b;c[e>>2]=Pb(4,20893,367)|0;if(Ad(c[e>>2]|0,c[p>>2]|0,c[o>>2]|0,0)|0){c[h>>2]=374;if((c[253]|0)==-1)c[253]=Wb(2,0,20893,21211,c[h>>2]|0)|0;if((Xb()|0)<=0){if(c[253]|0){c[j>>2]=20893;c[j+4>>2]=374;Zb(66,21097,j)}}else Yb(-1,0);Rb(c[e>>2]|0,20893,375);c[d>>2]=0;p=c[d>>2]|0;l=n;return p|0}c[g>>2]=Xc(f,c[c[e>>2]>>2]|0,37679,39075)|0;if(c[g>>2]|0)c[g>>2]=Xc(f,c[c[e>>2]>>2]|0,40693,39075)|0;if(!(c[g>>2]|0)){Id(c[f>>2]|0);c[d>>2]=c[e>>2];p=c[d>>2]|0;l=n;return p|0}c[i>>2]=385;if((c[254]|0)==-1)c[254]=Wb(1,0,20893,21211,c[i>>2]|0)|0;if((Xb()|0)<=0){if(c[254]|0){c[k>>2]=20893;c[k+4>>2]=385;Zb(1,61295,k)}}else Yb(-1,0);Cd(c[c[e>>2]>>2]|0);Rb(c[e>>2]|0,20893,387);c[d>>2]=0;p=c[d>>2]|0;l=n;return p|0}function $c(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=i;j=i+24|0;d=i+20|0;e=i+16|0;f=i+12|0;g=i+8|0;c[j>>2]=a;c[d>>2]=b;c[e>>2]=Dd(c[c[j>>2]>>2]|0,3,0,0)|0;c[f>>2]=Pb(c[e>>2]|0,20893,958)|0;b=(c[e>>2]|0)-1|0;if((b|0)==(Dd(c[c[j>>2]>>2]|0,3,c[f>>2]|0,c[e>>2]|0)|0)){c[c[d>>2]>>2]=c[f>>2];l=i;return c[e>>2]|0}c[g>>2]=963;if((c[255]|0)==-1)c[255]=Wb(1,0,20893,21247,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[255]|0))Vb();c[h>>2]=20893;c[h+4>>2]=963;Zb(1,61295,h);Vb();return 0}function ad(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=l;l=l+80|0;if((l|0)>=(m|0))$(80);x=y+8|0;w=y;r=y+76|0;s=y+72|0;t=y+68|0;u=y+64|0;v=y+60|0;g=y+56|0;h=y+52|0;i=y+48|0;j=y+40|0;k=y+32|0;n=y+28|0;o=y+24|0;p=y+20|0;q=y+16|0;c[s>>2]=a;c[t>>2]=b;c[u>>2]=d;c[v>>2]=e;c[g>>2]=f;if(!((c[v>>2]|0)!=0&(c[g>>2]|0)!=0)){c[p>>2]=738;if((c[256]|0)==-1)c[256]=Wb(1,0,20893,21282,c[p>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[256]|0))Vb();c[w>>2]=20893;c[w+4>>2]=738;Zb(1,61295,w);Vb()}c[o>>2]=Xc(j,c[c[u>>2]>>2]|0,37679,39061)|0;if(c[o>>2]|0)c[o>>2]=Xc(j,c[c[u>>2]>>2]|0,40693,39061)|0;if(!(c[o>>2]|0)){c[i>>2]=bd(c[u>>2]|0,c[s>>2]|0)|0;do if(c[i>>2]|0){c[h>>2]=cd(c[u>>2]|0,c[t>>2]|0)|0;if(!(c[h>>2]|0)){Id(c[i>>2]|0);break}c[k>>2]=Hd(0)|0;Nd(c[k>>2]|0,c[c[h>>2]>>2]|0,c[j+4>>2]|0,c[j>>2]|0);c[n>>2]=Hd(0)|0;Md(c[n>>2]|0,c[i>>2]|0,c[k>>2]|0,c[j>>2]|0);Id(c[i>>2]|0);Id(c[j>>2]|0);Id(c[j+4>>2]|0);Id(c[k>>2]|0);dd(c[h>>2]|0);x=ed(c[n>>2]|0,c[v>>2]|0)|0;c[c[g>>2]>>2]=x;Id(c[n>>2]|0);c[r>>2]=1;x=c[r>>2]|0;l=y;return x|0}while(0);Id(c[j>>2]|0);Id(c[j+4>>2]|0);c[c[v>>2]>>2]=0;c[c[g>>2]>>2]=0;c[r>>2]=0;x=c[r>>2]|0;l=y;return x|0}c[q>>2]=744;if((c[257]|0)==-1)c[257]=Wb(1,0,20893,21282,c[q>>2]|0)|0;if((Xb()|0)<=0){if(c[257]|0){c[x>>2]=20893;c[x+4>>2]=744;Zb(1,61295,x)}}else Yb(-1,0);c[c[v>>2]>>2]=0;c[c[g>>2]>>2]=0;c[r>>2]=0;x=c[r>>2]|0;l=y;return x|0}function bd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;r=l;l=l+64|0;if((l|0)>=(m|0))$(64);o=r+8|0;n=r;p=r+52|0;f=r+48|0;g=r+44|0;h=r+40|0;i=r+36|0;j=r+32|0;k=r+28|0;q=r+24|0;d=r+20|0;e=r+16|0;c[f>>2]=a;c[g>>2]=b;if(Xc(i,c[c[f>>2]>>2]|0,40693,39075)|0){c[d>>2]=689;if((c[262]|0)==-1)c[262]=Wb(1,0,20893,21400,c[d>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[262]|0))Vb();c[n>>2]=20893;c[n+4>>2]=689;Zb(1,61295,n);Vb()}if(!($d(c[i>>2]|0,2)|0)){c[k>>2]=Zc(c[f>>2]|0,j)|0;Ic(h,c[i>>2]|0,c[j>>2]|0,c[k>>2]|0,c[g>>2]|0,64,21421);Rb(c[j>>2]|0,20893,704);c[q>>2]=fd(c[h>>2]|0,c[i>>2]|0)|0;Id(c[i>>2]|0);a=c[h>>2]|0;if(c[q>>2]|0){c[p>>2]=a;q=c[p>>2]|0;l=r;return q|0}else{Id(a);c[p>>2]=0;q=c[p>>2]|0;l=r;return q|0}}c[e>>2]=691;if((c[263]|0)==-1)c[263]=Wb(1,0,20893,21400,c[e>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[263]|0))Vb();c[o>>2]=20893;c[o+4>>2]=691;Zb(1,61295,o);Vb();return 0}function cd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+64|0;if((l|0)>=(m|0))$(64);p=q+16|0;o=q+8|0;n=q;d=q+52|0;e=q+48|0;f=q+44|0;g=q+40|0;h=q+36|0;i=q+32|0;j=q+28|0;k=q+24|0;c[d>>2]=a;c[e>>2]=b;c[f>>2]=21332;c[g>>2]=Pb(4,20893,434)|0;if(!(c[g>>2]|0)){c[i>>2]=435;if((c[259]|0)==-1)c[259]=Wb(1,0,20893,21363,c[i>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[259]|0))Vb();c[n>>2]=20893;c[n+4>>2]=435;Zb(1,61295,n);Vb()}if(Xc(h,c[c[d>>2]>>2]|0,40693,39075)|0){c[j>>2]=438;if((c[260]|0)==-1)c[260]=Wb(1,0,20893,21363,c[j>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[260]|0))Vb();c[o>>2]=20893;c[o+4>>2]=438;Zb(1,61295,o);Vb()}if(!($d(c[h>>2]|0,2)|0)){k=c[g>>2]|0;n=c[h>>2]|0;o=c[f>>2]|0;p=Fo(c[f>>2]|0)|0;Ic(k,n,o,p,c[e>>2]|0,32,21387);if(fd(c[c[g>>2]>>2]|0,c[h>>2]|0)|0){p=c[h>>2]|0;Id(p);p=c[g>>2]|0;l=q;return p|0}Rb(c[g>>2]|0,20893,448);c[g>>2]=0;p=c[h>>2]|0;Id(p);p=c[g>>2]|0;l=q;return p|0}c[k>>2]=440;if((c[261]|0)==-1)c[261]=Wb(1,0,20893,21363,c[k>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[261]|0))Vb();c[p>>2]=20893;c[p+4>>2]=440;Zb(1,61295,p);Vb();return 0}function dd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Id(c[c[d>>2]>>2]|0);Rb(c[d>>2]|0,20893,631);l=b;return}function ed(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=i;j=i+28|0;d=i+24|0;e=i+20|0;f=i+16|0;g=i+8|0;c[j>>2]=a;c[d>>2]=b;Ld(5,0,0,e,c[j>>2]|0)|0;c[f>>2]=Pb(c[e>>2]|0,20893,655)|0;if(!(Ld(5,c[f>>2]|0,c[e>>2]|0,i+12|0,c[j>>2]|0)|0)){c[c[d>>2]>>2]=c[f>>2];l=i;return c[e>>2]|0}c[g>>2]=661;if((c[258]|0)==-1)c[258]=Wb(1,0,20893,21306,c[g>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[258]|0))Vb();c[h>>2]=20893;c[h+4>>2]=661;Zb(1,61295,h);Vb();return 0}function fd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=d+12|0;g=d+8|0;f=d+4|0;e=d;c[h>>2]=a;c[g>>2]=b;c[f>>2]=Hd(0)|0;c[e>>2]=Od(c[f>>2]|0,c[h>>2]|0,c[g>>2]|0)|0;Id(c[f>>2]|0);l=d;return c[e>>2]|0}function gd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=f+8|0;g=f;h=f+24|0;b=f+20|0;d=f+16|0;c[h>>2]=a;c[b>>2]=0;c[g>>2]=c[h>>2];if(!(Bd(b,0,21436,g)|0)){l=f;return c[b>>2]|0}c[d>>2]=806;if((c[264]|0)==-1)c[264]=Wb(1,0,20893,21466,c[d>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[264]|0))Vb();c[e>>2]=20893;c[e+4>>2]=806;Zb(1,61295,e);Vb();return 0}function hd(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=a;Cd(c[c[d>>2]>>2]|0);Rb(c[d>>2]|0,20893,936);l=b;return}function id(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;n=l;l=l+48|0;if((l|0)>=(m|0))$(48);k=n+8|0;j=n;d=n+44|0;p=n+40|0;o=n+36|0;e=n+32|0;f=n+28|0;g=n+24|0;h=n+20|0;i=n+16|0;c[p>>2]=a;c[o>>2]=b;c[e>>2]=Pb(4,20893,985)|0;if(Ad(c[e>>2]|0,c[p>>2]|0,c[o>>2]|0,0)|0){c[h>>2]=992;if((c[265]|0)==-1)c[265]=Wb(2,0,20893,21478,c[h>>2]|0)|0;if((Xb()|0)<=0){if(c[265]|0){c[j>>2]=20893;c[j+4>>2]=992;Zb(66,21097,j)}}else Yb(-1,0);Rb(c[e>>2]|0,20893,993);c[d>>2]=0;p=c[d>>2]|0;l=n;return p|0}c[f>>2]=Xc(g,c[c[e>>2]>>2]|0,37529,39073)|0;if(c[f>>2]|0)c[f>>2]=Xc(g,c[c[e>>2]>>2]|0,40693,39073)|0;if(!(c[f>>2]|0)){Id(c[g>>2]|0);c[d>>2]=c[e>>2];p=c[d>>2]|0;l=n;return p|0}c[i>>2]=1003;if((c[266]|0)==-1)c[266]=Wb(2,0,20893,21478,c[i>>2]|0)|0;if((Xb()|0)<=0){if(c[266]|0){c[k>>2]=20893;c[k+4>>2]=1003;Zb(66,21097,k)}}else Yb(-1,0);Cd(c[c[e>>2]>>2]|0);Rb(c[e>>2]|0,20893,1005);c[d>>2]=0;p=c[d>>2]|0;l=n;return p|0}function jd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=l;l=l+112|0;if((l|0)>=(m|0))$(112);z=C+40|0;y=C+32|0;x=C+24|0;B=C+16|0;A=C+8|0;w=C;p=C+108|0;q=C+104|0;r=C+100|0;s=C+96|0;t=C+92|0;u=C+88|0;v=C+84|0;e=C+80|0;f=C+76|0;g=C+72|0;h=C+68|0;i=C+64|0;j=C+60|0;k=C+56|0;n=C+52|0;o=C+48|0;c[q>>2]=a;c[r>>2]=b;c[s>>2]=d;c[g>>2]=Xc(u,c[c[s>>2]>>2]|0,37679,39075)|0;if(c[g>>2]|0)c[g>>2]=Xc(u,c[c[s>>2]>>2]|0,40693,39075)|0;if(c[g>>2]|0){c[i>>2]=1066;if((c[267]|0)==-1)c[267]=Wb(2,0,20893,21513,c[i>>2]|0)|0;if((Xb()|0)<=0){if(c[267]|0){c[w>>2]=20893;c[w+4>>2]=1066;Zb(66,21097,w)}}else Yb(-1,0);c[p>>2]=0;B=c[p>>2]|0;l=C;return B|0}c[g>>2]=Xc(v,c[c[q>>2]>>2]|0,37529,39073)|0;if(c[g>>2]|0)c[g>>2]=Xc(v,c[c[q>>2]>>2]|0,40693,39073)|0;if(c[g>>2]|0){Id(c[u>>2]|0);c[j>>2]=1075;if((c[268]|0)==-1)c[268]=Wb(2,0,20893,21513,c[j>>2]|0)|0;if((Xb()|0)<=0){if(c[268]|0){c[A>>2]=20893;c[A+4>>2]=1075;Zb(66,21097,A)}}else Yb(-1,0);c[p>>2]=0;B=c[p>>2]|0;l=C;return B|0}c[t>>2]=cd(c[s>>2]|0,c[r>>2]|0)|0;if(!(c[t>>2]|0)){c[k>>2]=1086;if((c[269]|0)==-1)c[269]=Wb(2,0,20893,21513,c[k>>2]|0)|0;if((Xb()|0)<=0){if(c[269]|0){c[B>>2]=20893;c[B+4>>2]=1086;Zb(66,21097,B)}}else Yb(-1,0);Id(c[u>>2]|0);Id(c[v>>2]|0);c[p>>2]=0;B=c[p>>2]|0;l=C;return B|0}c[e>>2]=Hd(0)|0;if(1!=(Pd(c[e>>2]|0,c[c[t>>2]>>2]|0,c[u>>2]|0)|0)){c[n>>2]=1100;if((c[270]|0)==-1)c[270]=Wb(2,0,20893,21513,c[n>>2]|0)|0;if((Xb()|0)<=0){if(c[270]|0){c[x>>2]=20893;c[x+4>>2]=1100;Zb(66,21097,x)}}else Yb(-1,0);Id(c[e>>2]|0);dd(c[t>>2]|0);Id(c[u>>2]|0);Id(c[v>>2]|0);c[p>>2]=0;B=c[p>>2]|0;l=C;return B|0}c[f>>2]=Hd(0)|0;Md(c[f>>2]|0,c[v>>2]|0,c[e>>2]|0,c[u>>2]|0);Id(c[u>>2]|0);Id(c[e>>2]|0);Id(c[v>>2]|0);dd(c[t>>2]|0);c[h>>2]=Pb(4,20893,1115)|0;B=c[h>>2]|0;c[y>>2]=c[f>>2];if(!(Bd(B,0,21539,y)|0)){Id(c[f>>2]|0);c[p>>2]=c[h>>2];B=c[p>>2]|0;l=C;return B|0}c[o>>2]=1120;if((c[271]|0)==-1)c[271]=Wb(1,0,20893,21513,c[o>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[271]|0))Vb();c[z>>2]=20893;c[z+4>>2]=1120;Zb(1,61295,z);Vb();return 0}function kd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;q=l;l=l+64|0;if((l|0)>=(m|0))$(64);p=q+8|0;o=q;g=q+52|0;r=q+48|0;h=q+44|0;i=q+40|0;j=q+36|0;k=q+32|0;n=q+28|0;e=q+24|0;f=q+20|0;c[r>>2]=a;c[h>>2]=b;c[i>>2]=d;c[k>>2]=bd(c[i>>2]|0,c[r>>2]|0)|0;if(!(c[k>>2]|0)){c[e>>2]=1146;if((c[272]|0)==-1)c[272]=Wb(2,0,20893,21562,c[e>>2]|0)|0;if((Xb()|0)<=0){if(c[272]|0){c[o>>2]=20893;c[o+4>>2]=1146;Zb(66,21097,o)}}else Yb(-1,0);c[g>>2]=0;r=c[g>>2]|0;l=q;return r|0}c[j>>2]=gd(c[k>>2]|0)|0;Id(c[k>>2]|0);c[n>>2]=he(c[c[h>>2]>>2]|0,c[j>>2]|0,c[c[i>>2]>>2]|0)|0;Cd(c[j>>2]|0);if(!(c[n>>2]|0)){c[g>>2]=1;r=c[g>>2]|0;l=q;return r|0}c[f>>2]=1169;if((c[273]|0)==-1)c[273]=Wb(2,20980,20893,21562,c[f>>2]|0)|0;if((Xb()|0)<=0){if(c[273]|0){r=xd(c[n>>2]|0)|0;c[p>>2]=20893;c[p+4>>2]=1168;c[p+8>>2]=r;cc(2,20980,21587,p)}}else Yb(-1,0);c[g>>2]=-1;r=c[g>>2]|0;l=q;return r|0}function ld(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;j=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=j+16|0;d=j+40|0;e=j+36|0;f=j+32|0;g=j+8|0;k=j;c[e>>2]=b;c[f>>2]=21675;o=a;b=c[o+4>>2]|0;n=g;c[n>>2]=c[o>>2];c[n+4>>2]=b;n=rd()|0;b=k;c[b>>2]=n;c[b+4>>2]=D;b=a;if((c[k>>2]|0)==(c[b>>2]|0)?(c[k+4>>2]|0)==(c[b+4>>2]|0):0){c[d>>2]=21653;o=c[d>>2]|0;l=j;return o|0}o=a;if(0==(c[o>>2]|0)?0==(c[o+4>>2]|0):0){c[d>>2]=21679;o=c[d>>2]|0;l=j;return o|0}o=g;n=c[o+4>>2]|0;if(!(!(1==(c[e>>2]|0)&(n>>>0>0|(n|0)==0&(c[o>>2]|0)>>>0>5e3))?(o=g,o=nr(c[o>>2]|0,c[o+4>>2]|0,1e3,0)|0,!(0==(o|0)&0==(D|0))):0))i=7;do if((i|0)==7){n=g;n=ir(c[n>>2]|0,c[n+4>>2]|0,1e3,0)|0;o=g;c[o>>2]=n;c[o+4>>2]=D;c[f>>2]=21661;o=g;n=c[o+4>>2]|0;if(!(1==(c[e>>2]|0)&(n>>>0>0|(n|0)==0&(c[o>>2]|0)>>>0>5e3))?(o=g,o=nr(c[o>>2]|0,c[o+4>>2]|0,1e3,0)|0,!(0==(o|0)&0==(D|0))):0)break;n=g;n=ir(c[n>>2]|0,c[n+4>>2]|0,1e3,0)|0;o=g;c[o>>2]=n;c[o+4>>2]=D;c[f>>2]=39073;o=g;n=c[o+4>>2]|0;if(!(1==(c[e>>2]|0)&(n>>>0>0|(n|0)==0&(c[o>>2]|0)>>>0>300))?(o=g,o=nr(c[o>>2]|0,c[o+4>>2]|0,60,0)|0,!(0==(o|0)&0==(D|0))):0)break;n=g;n=ir(c[n>>2]|0,c[n+4>>2]|0,60,0)|0;o=g;c[o>>2]=n;c[o+4>>2]=D;c[f>>2]=21664;o=g;n=c[o+4>>2]|0;if(!(1==(c[e>>2]|0)&(n>>>0>0|(n|0)==0&(c[o>>2]|0)>>>0>300))?(o=g,o=nr(c[o>>2]|0,c[o+4>>2]|0,60,0)|0,!(0==(o|0)&0==(D|0))):0)break;n=g;n=ir(c[n>>2]|0,c[n+4>>2]|0,60,0)|0;o=g;c[o>>2]=n;c[o+4>>2]=D;c[f>>2]=35382;o=g;n=c[o+4>>2]|0;if(!(1==(c[e>>2]|0)&(n>>>0>0|(n|0)==0&(c[o>>2]|0)>>>0>120))?(o=g,o=nr(c[o>>2]|0,c[o+4>>2]|0,24,0)|0,!(0==(o|0)&0==(D|0))):0)break;n=g;n=ir(c[n>>2]|0,c[n+4>>2]|0,24,0)|0;o=g;c[o>>2]=n;c[o+4>>2]=D;o=g;if(1==(c[o>>2]|0)?0==(c[o+4>>2]|0):0){c[f>>2]=21666;break}else{c[f>>2]=21670;break}}while(0);i=g;k=c[i+4>>2]|0;o=c[f>>2]|0;n=h;c[n>>2]=c[i>>2];c[n+4>>2]=k;c[h+8>>2]=o;Sb(71651,128,21645,h)|0;c[d>>2]=71651;o=c[d>>2]|0;l=j;return o|0}function md(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;A=l;l=l+96|0;if((l|0)>=(m|0))$(96);x=A+24|0;z=A+16|0;y=A+8|0;o=A;t=A+84|0;B=A+80|0;n=A+76|0;u=A+72|0;v=A+68|0;w=A+64|0;h=A+60|0;i=A+56|0;p=A+52|0;j=A+48|0;k=A+44|0;q=A+40|0;r=A+36|0;s=A+32|0;c[B>>2]=b;c[n>>2]=e;c[u>>2]=f;c[v>>2]=g;c[j>>2]=c[B>>2];if((c[v>>2]|0)>>>0<((((c[n>>2]<<3)+4|0)>>>0)/5|0)>>>0){c[k>>2]=883;if((c[274]|0)==-1)c[274]=Wb(1,0,21635,21684,c[k>>2]|0)|0;if((Xb()|0)<=0){if(c[274]|0){c[o>>2]=21635;c[o+4>>2]=883;Zb(1,61295,o)}}else Yb(-1,0);c[t>>2]=0;B=c[t>>2]|0;l=A;return B|0}c[p>>2]=0;c[w>>2]=0;c[h>>2]=0;c[i>>2]=0;while(1){if(!((c[h>>2]|0)>>>0<(c[n>>2]|0)>>>0?1:(c[p>>2]|0)>>>0>0)){b=32;break}if((c[p>>2]|0)>>>0<5?(c[h>>2]|0)>>>0<(c[n>>2]|0)>>>0:0){o=c[i>>2]<<8;B=c[h>>2]|0;c[h>>2]=B+1;c[i>>2]=o|(d[(c[j>>2]|0)+B>>0]|0);c[p>>2]=(c[p>>2]|0)+8}if((c[p>>2]|0)>>>0<5){c[i>>2]=c[i>>2]<<5-(c[p>>2]|0);if((c[p>>2]|0)!=((c[n>>2]<<3>>>0)%5|0|0)){b=15;break}c[p>>2]=5}if((c[w>>2]|0)>>>0>=(c[v>>2]|0)>>>0){b=24;break}o=a[(c[277]|0)+((c[i>>2]|0)>>>((c[p>>2]|0)-5|0)&31)>>0]|0;B=c[w>>2]|0;c[w>>2]=B+1;a[(c[u>>2]|0)+B>>0]=o;c[p>>2]=(c[p>>2]|0)-5}if((b|0)==15){c[q>>2]=900;if((c[275]|0)==-1)c[275]=Wb(1,0,21635,21684,c[q>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[275]|0))Vb();c[y>>2]=21635;c[y+4>>2]=900;Zb(1,61295,y);Vb()}else if((b|0)==24){c[r>>2]=905;if((c[276]|0)==-1)c[276]=Wb(1,0,21635,21684,c[r>>2]|0)|0;if((Xb()|0)<=0){if(c[276]|0){c[z>>2]=21635;c[z+4>>2]=905;Zb(1,61295,z)}}else Yb(-1,0);c[t>>2]=0;B=c[t>>2]|0;l=A;return B|0}else if((b|0)==32){if(!(c[p>>2]|0)){if((c[w>>2]|0)>>>0<(c[v>>2]|0)>>>0)a[(c[u>>2]|0)+(c[w>>2]|0)>>0]=0;c[t>>2]=(c[u>>2]|0)+(c[w>>2]|0);B=c[t>>2]|0;l=A;return B|0}c[s>>2]=911;if((c[278]|0)==-1)c[278]=Wb(1,0,21635,21684,c[s>>2]|0)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[278]|0))Vb();c[x>>2]=21635;c[x+4>>2]=911;Zb(1,61295,x);Vb()}return 0}function nd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;k=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=k+20|0;f=k+16|0;g=k+12|0;h=k+8|0;i=k+4|0;j=k;c[f>>2]=b;c[g>>2]=d;c[i>>2]=c[g>>2]<<3;if((((c[i>>2]|0)>>>0)%5|0)>>>0>0)c[i>>2]=(c[i>>2]|0)+(5-(((c[i>>2]|0)>>>0)%5|0));c[i>>2]=((c[i>>2]|0)>>>0)/5|0;c[h>>2]=Pb((c[i>>2]|0)+1|0,21635,939)|0;c[j>>2]=md(c[f>>2]|0,c[g>>2]|0,c[h>>2]|0,c[i>>2]|0)|0;if(!(c[j>>2]|0)){Rb(c[h>>2]|0,21635,943);c[e>>2]=0;j=c[e>>2]|0;l=k;return j|0}else{a[c[j>>2]>>0]=0;c[e>>2]=c[h>>2];j=c[e>>2]|0;l=k;return j|0}return 0}function od(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=l;l=l+64|0;if((l|0)>=(m|0))$(64);w=x;v=x+60|0;r=x+56|0;i=x+52|0;j=x+48|0;k=x+44|0;s=x+40|0;n=x+36|0;o=x+32|0;t=x+28|0;p=x+24|0;g=x+20|0;q=x+16|0;h=x+12|0;u=x+8|0;c[r>>2]=b;c[i>>2]=d;c[j>>2]=e;c[k>>2]=f;c[h>>2]=c[k>>2]<<3;if(!(c[i>>2]|0))if(!(c[k>>2]|0)){c[v>>2]=1;w=c[v>>2]|0;l=x;return w|0}else{c[v>>2]=-1;w=c[v>>2]|0;l=x;return w|0}c[q>>2]=c[j>>2];c[n>>2]=c[k>>2];c[s>>2]=c[i>>2];if((((c[h>>2]|0)>>>0)%5|0)>>>0>0){c[t>>2]=((c[h>>2]|0)>>>0)%5|0;c[g>>2]=5-(c[t>>2]|0);k=(c[s>>2]|0)+-1|0;c[s>>2]=k;k=pd(a[(c[r>>2]|0)+k>>0]|0)|0;c[p>>2]=k;c[o>>2]=k>>c[g>>2]}else{c[t>>2]=5;c[g>>2]=0;k=(c[s>>2]|0)+-1|0;c[s>>2]=k;k=pd(a[(c[r>>2]|0)+k>>0]|0)|0;c[p>>2]=k;c[o>>2]=k}if(((((c[h>>2]|0)+(c[g>>2]|0)|0)>>>0)/5|0|0)!=(c[i>>2]|0)){c[v>>2]=-1;w=c[v>>2]|0;l=x;return w|0}if(-1==(c[p>>2]|0)){c[v>>2]=-1;w=c[v>>2]|0;l=x;return w|0}while(1){d=c[s>>2]|0;if((c[n>>2]|0)>>>0<=0){b=25;break}if(!d){b=14;break}k=(c[s>>2]|0)+-1|0;c[s>>2]=k;k=pd(a[(c[r>>2]|0)+k>>0]|0)|0;c[p>>2]=k;c[o>>2]=k<>2]|c[o>>2];if(-1==(c[p>>2]|0)){b=22;break}c[t>>2]=(c[t>>2]|0)+5;if((c[t>>2]|0)>>>0<8)continue;j=c[o>>2]&255;k=(c[n>>2]|0)+-1|0;c[n>>2]=k;a[(c[q>>2]|0)+k>>0]=j;c[o>>2]=(c[o>>2]|0)>>>8;c[t>>2]=(c[t>>2]|0)-8}if((b|0)==14){c[u>>2]=1003;if((c[279]|0)==-1)c[279]=Wb(1,0,21635,21747,c[u>>2]|0)|0;if((Xb()|0)<=0){if(c[279]|0){c[w>>2]=21635;c[w+4>>2]=1003;Zb(1,61295,w)}}else Yb(-1,0);c[v>>2]=-1;w=c[v>>2]|0;l=x;return w|0}else if((b|0)==22){c[v>>2]=-1;w=c[v>>2]|0;l=x;return w|0}else if((b|0)==25)if(0!=(d|0)|0!=(c[t>>2]|0)){c[v>>2]=-1;w=c[v>>2]|0;l=x;return w|0}else{c[v>>2]=1;w=c[v>>2]|0;l=x;return w|0}return 0}function pd(b){b=b|0;var e=0,f=0,g=0,h=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=h+4|0;f=h+8|0;g=h;a[f>>0]=b;switch(d[f>>0]|0|0){case 111:case 79:{a[f>>0]=48;break}case 76:case 108:case 73:case 105:{a[f>>0]=49;break}case 85:case 117:{a[f>>0]=86;break}default:{}}if((d[f>>0]|0|0)>=48?(d[f>>0]|0|0)<=57:0){c[e>>2]=(d[f>>0]|0)-48;g=c[e>>2]|0;l=h;return g|0}if((d[f>>0]|0|0)>=97?(d[f>>0]|0|0)<=122:0)a[f>>0]=Bp(d[f>>0]|0)|0;c[g>>2]=0;if((d[f>>0]|0|0)>=65?(d[f>>0]|0|0)<=90:0){if(73<(d[f>>0]|0|0))c[g>>2]=(c[g>>2]|0)+1;if(76<(d[f>>0]|0|0))c[g>>2]=(c[g>>2]|0)+1;if(79<(d[f>>0]|0|0))c[g>>2]=(c[g>>2]|0)+1;if(85<(d[f>>0]|0|0))c[g>>2]=(c[g>>2]|0)+1;c[e>>2]=(d[f>>0]|0)-65+10-(c[g>>2]|0);g=c[e>>2]|0;l=h;return g|0}c[e>>2]=-1;g=c[e>>2]|0;l=h;return g|0}function qd(){var a=0;a=70232;D=c[a+4>>2]|0;return c[a>>2]|0}function rd(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;c[b>>2]=c[16];c[b+4>>2]=c[17];D=c[b+4>>2]|0;l=a;return c[b>>2]|0}function sd(){var a=0,b=0,d=0,e=0,f=0;a=l;l=l+32|0;if((l|0)>=(m|0))$(32);b=a+8|0;d=a;e=a+16|0;gb(e|0,0)|0;f=c[e>>2]|0;f=kr(f|0,((f|0)<0)<<31>>31|0,1e3,0)|0;f=kr(f|0,D|0,1e3,0)|0;e=c[e+4>>2]|0;e=_q(f|0,D|0,e|0,((e|0)<0)<<31>>31|0)|0;f=70232;f=_q(e|0,D|0,c[f>>2]|0,c[f+4>>2]|0)|0;e=d;c[e>>2]=f;c[e+4>>2]=D;c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];D=c[b+4>>2]|0;l=a;return c[b>>2]|0}function td(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;c[b>>2]=c[17560];c[b+4>>2]=c[17561];D=c[b+4>>2]|0;l=a;return c[b>>2]|0}function ud(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);b=f+24|0;d=f+16|0;e=f+8|0;h=f;g=sd()|0;j=h;c[j>>2]=g;c[j+4>>2]=D;c[d>>2]=c[h>>2];c[d+4>>2]=c[h+4>>2];h=a;j=c[h+4>>2]|0;g=d;i=c[g+4>>2]|0;if(j>>>0>i>>>0|((j|0)==(i|0)?(c[h>>2]|0)>>>0>(c[g>>2]|0)>>>0:0)){j=td()|0;i=b;c[i>>2]=j;c[i+4>>2]=D;i=b;j=i;j=c[j>>2]|0;i=i+4|0;i=c[i>>2]|0;D=i;l=f;return j|0}else{i=d;j=a;j=Xq(c[i>>2]|0,c[i+4>>2]|0,c[j>>2]|0,c[j+4>>2]|0)|0;i=e;c[i>>2]=j;c[i+4>>2]=D;c[b>>2]=c[e>>2];c[b+4>>2]=c[e+4>>2];i=b;j=i;j=c[j>>2]|0;i=i+4|0;i=c[i>>2]|0;D=i;l=f;return j|0}return 0}function vd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;f=e;c[f>>2]=a;c[f+4>>2]=b;b=Xp(c[e>>2]|0)|0;b=_q(0,b|0,Xp(c[e+4>>2]|0)|0,0)|0;l=d;return b|0}function wd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;f=e;c[f>>2]=a;c[f+4>>2]=b;b=Yp(c[e>>2]|0)|0;b=_q(0,b|0,Yp(c[e+4>>2]|0)|0,0)|0;l=d;return b|0}function xd(a){a=a|0;return Pn(a)|0}function yd(a){a=a|0;return Ye(a)|0}function zd(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=b;b=Ze(a,e)|0;l=d;return ((b|0)==0?0:b&65535|16777216)|0}function Ad(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=tf(a,b,c,d)|0;return ((d|0)==0?0:d&65535|16777216)|0}function Bd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f;c[g>>2]=e;e=Ef(a,b,d,g)|0;l=f;return ((e|0)==0?0:e&65535|16777216)|0}function Cd(a){a=a|0;sf(a);return}function Dd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Gf(a,b,c,d)|0}function Ed(a,b,c){a=a|0;b=b|0;c=c|0;return uf(a,b,c)|0}function Fd(a){a=a|0;return Cf(a)|0}function Gd(a,b,c){a=a|0;b=b|0;c=c|0;return Af(a,b,c)|0}function Hd(a){a=a|0;return Hl(a)|0}function Id(a){a=a|0;Jl(a);return}function Jd(a,b){a=a|0;b=b|0;return wk(a,b)|0}function Kd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;e=Sk(a,b,c,d,e)|0;return ((e|0)==0?0:e&65535|16777216)|0}function Ld(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;e=Tk(a,b,c,d,e)|0;return ((e|0)==0?0:e&65535|16777216)|0}function Md(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Lk(a,b,c,d);return}function Nd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Mk(a,b,c,d);return}function Od(a,b,c){a=a|0;b=b|0;c=c|0;return Ek(a,b,c)|0}function Pd(a,b,c){a=a|0;b=b|0;c=c|0;return Fk(a,b,c)|0}function Qd(a){a=a|0;return Oj(a)|0}function Rd(a){a=a|0;Qj(a);return}function Sd(a,b,c){a=a|0;b=b|0;c=c|0;c=Hg(a,b,c)|0;return ((c|0)==0?0:c&65535|16777216)|0}function Td(a,b,c){a=a|0;b=b|0;c=c|0;return Zj(a,b,c)|0}function Ud(a,b,c){a=a|0;b=b|0;c=c|0;return _j(a,b,c)|0}function Vd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Nj(a,b,c,sg(d,1)|0)|0}function Wd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ck(a,b,c,sg(d,1)|0);return}function Xd(a){a=a|0;return lk(a)|0}function Yd(a,b){a=a|0;b=b|0;return mk(a,b)|0}function Zd(a,b){a=a|0;b=b|0;pk(a,b);return}function _d(a,b){a=a|0;b=b|0;return wl(a,b)|0}function $d(a,b){a=a|0;b=b|0;return Ll(a,b)|0}function ae(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;if(!(We()|0)){c[a>>2]=0;e=16777392;return e|0}else{e=vg(a,b,d,e)|0;e=(e|0)==0?0:e&65535|16777216;return e|0}return 0}function be(a){a=a|0;xg(a);return}function ce(a,b,c){a=a|0;b=b|0;c=c|0;if(!(We()|0)){c=16777392;return c|0}c=Ag(a,b,c)|0;c=(c|0)==0?0:c&65535|536870912;return c|0}function de(a,b,c){a=a|0;b=b|0;c=c|0;if(!(We()|0)){c=16777392;return c|0}c=Bg(a,b,c)|0;c=(c|0)==0?0:c&65535|536870912;return c|0}function ee(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(We()|0){e=yg(a,b,c,d,e)|0;e=(e|0)==0?0:e&65535|16777216;return e|0}if(!b){e=16777392;return e|0}Yq(b|0,66,c|0)|0;e=16777392;return e|0}function fe(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(!(We()|0)){e=16777392;return e|0}e=zg(a,b,c,d,e)|0;e=(e|0)==0?0:e&65535|16777216;return e|0}function ge(a,b,d){a=a|0;b=b|0;d=d|0;if(!(We()|0)){c[a>>2]=0;d=16777392;return d|0}else{d=Sh(a,b,d)|0;d=(d|0)==0?0:d&65535|16777216;return d|0}return 0}function he(a,b,c){a=a|0;b=b|0;c=c|0;if(!(We()|0)){c=16777392;return c|0}c=Th(a,b,c)|0;c=(c|0)==0?0:c&65535|16777216;return c|0}function ie(a){a=a|0;if(!(We()|0)){a=16777392;return a|0}a=Uh(a)|0;a=(a|0)==0?0:a&65535|16777216;return a|0}function je(a,b){a=a|0;b=b|0;if(!(We()|0)){c[a>>2]=0;b=16777392;return b|0}else{b=Vh(a,b)|0;b=(b|0)==0?0:b&65535|16777216;return b|0}return 0}function ke(a,b,d){a=a|0;b=b|0;d=d|0;if(!(We()|0)){c[a>>2]=0;d=16777392;return d|0}else{d=eh(a,b,d)|0;d=(d|0)==0?0:d&65535|16777216;return d|0}return 0}function le(a){a=a|0;kh(a);return}function me(a){a=a|0;ih(a);return}function ne(a,b,c){a=a|0;b=b|0;c=c|0;if(!(We()|0))return;lh(a,b,c);return}function oe(a,b){a=a|0;b=b|0;return ph(a,b)|0}function pe(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(!(We()|0))kg(21777,1175,21790,0,21810);oh(a,b,c,d);return}function qe(a){a=a|0;if(!(We()|0)){kg(21777,1198,21842,0,21859);a=0;return a|0}else{a=rh(a)|0;return a|0}return 0}function re(a){a=a|0;return sh(a)|0}function se(a,b,c){a=a|0;b=b|0;c=c|0;if(!(We()|0)){c=16777392;return c|0}c=nh(a,b,c)|0;c=(c|0)==0?0:c&65535|16777216;return c|0}function te(a,b,c){a=a|0;b=b|0;c=c|0;if(!(We()|0)){kg(21777,1287,21889,1,21810);fg()}else{Dj(a,b,c);return}}function ue(a,b){a=a|0;b=b|0;if(!(We()|0)){kg(21777,1340,21904,1,21810);fg()}else{Hj(a,b);return}}function ve(a){a=a|0;tg(a);return}function we(a,b){a=a|0;b=b|0;of(a,b);return}function xe(a,b){a=a|0;b=b|0;Ae(a,b);return}function ye(a){a=a|0;cf(a);return}function ze(a){a=a|0;var b=0;b=c[17575]|0;if(!b){b=a;return b|0}b=tb[b&15](a)|0;return b|0}function Ae(a,b){a=a|0;b=b|0;c[17576]=b;c[17577]=a;return}function Be(a,b){a=a|0;b=b|0;if(!b)b=Pn(a)|0;if(c[17577]|0?(gg()|0)==0:0)ub[c[17577]&7](c[17576]|0,a,b);kg(21922,86,21929,1,b);Ce(21947);Ce(b);Ce(22378);bg();za()}function Ce(a){a=a|0;oq(2,a,Fo(a)|0)|0;return}function De(a){a=a|0;c[17580]=a;return}function Ee(a){a=a|0;return (c[17580]|0)>=(a|0)|0}function Fe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=g;e=c[17578]|0;if(!e){switch(a|0){case 30:case 20:case 10:case 0:break;case 40:{iq(21962,7,1,c[3935]|0)|0;break}case 50:{iq(21970,13,1,c[3935]|0)|0;break}case 100:{iq(21984,5,1,c[3935]|0)|0;break}default:{e=c[3935]|0;c[f>>2]=a;Rp(e,21990,f)|0}}np(c[3935]|0,b,d)|0}else zb[e&1](c[17579]|0,a,b,d);switch(a|0){case 40:case 50:{kg(21922,140,22015,1,22026);bg();za();break}default:{l=g;return}}}function Ge(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=d;Fe(a,b,f);l=e;return}function He(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[e>>2]=a;c[e+4>>2]=b;c[e+8>>2]=d;Ge(50,22056,e);za()}function Ie(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[f>>2]=a;c[f+4>>2]=b;c[f+8>>2]=d;c[f+12>>2]=e;Ge(50,22086,f);za()}function Je(a,b){a=a|0;b=b|0;var d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e;c[d>>2]=b;b=c[17578]|0;if(!b){np(c[3935]|0,a,d)|0;l=e;return}else{zb[b&1](c[17579]|0,10,a,d);l=e;return}}function Ke(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=f;c[e>>2]=d;a=c[17578]|0;if(!a){np(c[3935]|0,b,e)|0;l=f;return 0}else{zb[a&1](c[17579]|0,10,b,e);l=f;return 0}return 0}function Le(a,b){a=a|0;b=b|0;var d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e;c[d>>2]=b;b=c[17578]|0;if(!b){np(c[3935]|0,a,d)|0;l=e;return}else{zb[b&1](c[17579]|0,30,a,d);l=e;return}}function Me(a,b){a=a|0;b=b|0;var d=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[d>>2]=b;Fe(40,a,d);za()}function Ne(a,b){a=a|0;b=b|0;var d=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);c[d>>2]=b;Fe(50,a,d);za()}function Oe(a,b){a=a|0;b=b|0;var d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e;c[d>>2]=b;b=c[17578]|0;if(!b){b=c[3935]|0;iq(21984,5,1,b)|0;np(b,a,d)|0;l=e;return}else{zb[b&1](c[17579]|0,100,a,d);l=e;return}}function Pe(a,b){a=a|0;b=b|0;var d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e;if(!a){l=e;return}c[d>>2]=b;b=c[17578]|0;if(!b)np(c[3935]|0,a,d)|0;else zb[b&1](c[17579]|0,0,a,d);l=e;return}function Qe(a,b,c){a=a|0;b=b|0;c=c|0;Re(a,22120,b,c);return}function Re(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+80|0;if((l|0)>=(m|0))$(80);r=s+64|0;p=s+48|0;o=s+40|0;n=s+32|0;k=s+24|0;j=s+16|0;i=s+8|0;h=s;q=(b|0)!=0;if(q?(a[b>>0]|0)!=0:0){c[h>>2]=b;c[h+4>>2]=e;Oe(22122,h);if((f|0)!=0&((g|0)!=0&(a[e+1>>0]|0)==91)){Pe(22378,i);c[j>>2]=Fo(b)|0;c[j+4>>2]=71847;Oe(22128,j);i=1;e=22120}else i=1}else i=0;a:do if(g|0){h=g+-1|0;if(!i)while(1){c[k>>2]=d[f>>0];Pe(22134,k);if(!h)break a;else{f=f+1|0;h=h+-1|0}}else i=0;while(1){c[n>>2]=d[f>>0];Pe(22134,n);i=i+1|0;if((h|0)!=0&(i|0)==32){Pe(22139,o);k=Fo(b)|0;i=Fo(e)|0;c[p>>2]=k;c[p+4>>2]=71847;c[p+8>>2]=i;c[p+12>>2]=71847;Oe(22143,p);i=0}if(!h)break;else{f=f+1|0;h=h+-1|0}}}while(0);if(!q){l=s;return}Pe(22378,r);l=s;return}function Se(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;p=l;l=l+80|0;if((l|0)>=(m|0))$(80);n=p+32|0;o=p+24|0;g=p+16|0;j=p+8|0;i=p;h=p+44|0;k=p+40|0;e=p+36|0;f=p+48|0;if(!d){d=b|0?b:22120;if(a[d>>0]|0){c[i>>2]=d;c[i+4>>2]=22151;Oe(22122,i)}Pe(22378,j);l=p;return}if(c[d+12>>2]&4|0){o=wl(d,e)|0;c[g>>2]=c[e>>2];lp(f,30,22159,g)|0;Re(b|0?b:22120,f,o,((c[e>>2]|0)+7|0)>>>3);l=p;return}f=Ok(d,0,h,k)|0;if(!f){d=b|0?b:22120;if(a[d>>0]|0){c[o>>2]=d;c[o+4>>2]=22169;Oe(22122,o)}Pe(22378,n);l=p;return}e=c[h>>2]|0;d=c[k>>2]|0?22184:22186;if(!e)Re(b,d,71847,1);else Re(b,d,f,e);cf(f);l=p;return}function Te(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;i=l;d=b+63+((b|0)==0&1)&-64;e=d;b=l;l=l+((1*e|0)+15&-16)|0;if((l|0)>=(m|0))$((1*e|0)+15&-16|0);if((d|0)!=0&(b&7|0)!=0)do{a[b>>0]=0;b=b+1|0;d=d+-1|0}while((d|0)!=0&(b&7|0)!=0);if(d>>>0>=8){g=d+-8|0;h=g&-8;f=h+8|0;e=b;while(1){j=e;c[j>>2]=0;c[j+4>>2]=0;d=d+-8|0;if(d>>>0<=7)break;else e=e+8|0}b=b+f|0;d=g-h|0}if(!d){l=i;return}while(1){a[b>>0]=0;d=d+-1|0;if(!d)break;else b=b+1|0}l=i;return}function Ue(){return}function Ve(){Tn(33);Be(Qn(c[(zo()|0)>>2]|0)|0,22188)}function We(){if(!(c[17581]|0))Xe();return mg()|0}function Xe(){if(c[17581]|0)return;c[17581]=1;qj(0);dg(c[17582]|0);Mf();if((((((Cg()|0)==0?(vh()|0)==0:0)?(Wh()|0)==0:0)?(wh()|0)==0:0)?(Wf()|0)==0:0)?(jl()|0)==0:0)return;He(22203,123,22212)}function Ye(b){b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;if(!b){Xe();h=22224;return h|0}if((a[b>>0]|0)==1?(a[b+1>>0]|0)==1:0){h=Nl()|0;return h|0}Xe();c=a[b>>0]|0;if(c<<24>>24==48?((a[b+1>>0]|0)+-48|0)>>>0<10:0){h=0;return h|0}d=(c<<24>>24)+-48|0;if(d>>>0<10){e=0;do{e=(e*10|0)+d|0;b=b+1|0;c=a[b>>0]|0;d=(c<<24>>24)+-48|0}while(d>>>0<10);if((e|0)<0){h=0;return h|0}}else e=0;if(c<<24>>24!=46){h=0;return h|0}d=b+1|0;g=a[d>>0]|0;if(g<<24>>24==48?((a[b+2>>0]|0)+-48|0)>>>0<10:0){h=0;return h|0}c=(g<<24>>24)+-48|0;if(c>>>0<10){f=d;d=0;do{d=(d*10|0)+c|0;f=f+1|0;b=a[f>>0]|0;c=(b<<24>>24)+-48|0}while(c>>>0<10);if((d|0)<0){h=0;return h|0}else h=d}else{h=0;f=d;b=g}if(b<<24>>24!=46){h=0;return h|0}d=f+1|0;b=a[d>>0]|0;if(b<<24>>24==48?((a[f+2>>0]|0)+-48|0)>>>0<10:0){h=0;return h|0}c=(b<<24>>24)+-48|0;if(c>>>0<10){b=0;do{b=(b*10|0)+c|0;d=d+1|0;c=(a[d>>0]|0)+-48|0}while(c>>>0<10);if((b|0)<0){h=0;return h|0}}else b=0;if((e|0)<1){h=22224;return h|0}if((e|0)==1){if((h|0)<7){h=22224;return h|0}if((h|0)==7&(b|0)==0){h=22224;return h|0}}h=0;return h|0}function Ze(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+112|0;if((l|0)>=(m|0))$(112);r=s+88|0;p=s+80|0;o=s+72|0;n=s+64|0;h=s+48|0;g=s+24|0;f=s+16|0;e=s+8|0;d=s;j=s+96|0;do switch(a|0){case 31:{Nf();b=0;l=s;return b|0}case 44:{qj(0);wj();b=0;l=s;return b|0}case 51:{b=(zj()|0)!=0&1;l=s;return b|0}case 13:{uj();b=0;l=s;return b|0}case 14:{cg();b=0;l=s;return b|0}case 30:{Xe();Uf(0);b=0;l=s;return b|0}case 37:{Xe();c[17583]=1;b=0;l=s;return b|0}case 24:{Xe();q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;Uf(r);b=(Tf()|0)>>>2&1;l=s;return b|0}case 25:{Xe();bg();b=0;l=s;return b|0}case 27:{qj(0);Sf(Tf()|0|1);b=0;l=s;return b|0}case 28:{qj(0);Sf(Tf()|0|2);b=0;l=s;return b|0}case 29:{qj(0);Sf((Tf()|0)&-3);b=0;l=s;return b|0}case 22:{Xe();vj();b=0;l=s;return b|0}case 45:{qj(0);q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;Ej(r);b=0;l=s;return b|0}case 46:{qj(0);if(!(c[17581]|0))Xe();if(!(mg()|0)){b=0;l=s;return b|0}Fj();b=0;l=s;return b|0}case 19:{qj(0);q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;De(r);b=0;l=s;return b|0}case 20:{q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;c[17584]=c[17584]|r;b=0;l=s;return b|0}case 21:{q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;c[17584]=c[17584]&~r;b=0;l=s;return b|0}case 36:{Xe();b=0;l=s;return b|0}case 40:{b=c[17581]|0;l=s;return b|0}case 39:{b=c[17585]|0;l=s;return b|0}case 38:{if(c[17585]|0){b=0;l=s;return b|0}Xe();rj(0);c[17585]=1;if(!(c[17581]|0))Xe();mg()|0;b=0;l=s;return b|0}case 47:{qj(0);Xe();b=0;l=s;return b|0}case 48:{qj(0);rj(1);if(!(c[17581]|0))Xe();if(!(mg()|0)){b=0;l=s;return b|0}Gj();b=0;l=s;return b|0}case 52:{b=16777276;l=s;return b|0}case 49:{qj(0);q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;xj(r);b=0;l=s;return b|0}case 50:{qj(0);rj(1);q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;yj((r|0)!=0&1)|0;b=0;l=s;return b|0}case 70:{sj();b=0;l=s;return b|0}case 53:{i=(c[b>>2]|0)+(4-1)&~(4-1);k=c[i>>2]|0;c[b>>2]=i+4;qj(0);i=k|0?28:27;c[d>>2]=22224;pb[i&63](k,22238,d)|0;c[e>>2]=22264;pb[i&63](k,22251,e)|0;c[f>>2]=22289;pb[i&63](k,22276,f)|0;c[g>>2]=22310;pb[i&63](k,22297,g)|0;pb[i&63](k,22324,s+32|0)|0;pb[i&63](k,22340,s+40|0)|0;c[h>>2]=il()|0;pb[i&63](k,22352,h)|0;e=Kf()|0;pb[i&63](k,22365,s+56|0)|0;a=Lf(0,j)|0;if(a|0){d=0;do{if(c[j>>2]&e|0){c[n>>2]=a;pb[i&63](k,22374,n)|0}d=d+1|0;a=Lf(d,j)|0}while((a|0)!=0)}pb[i&63](k,22378,o)|0;b=(gg()|0)!=0;a=(hg()|0)!=0;c[p>>2]=b?121:110;c[p+4>>2]=a?121:110;pb[i&63](k,22380,p)|0;a=tj(0)|0;switch(a|0){case 1:{q=22423;break}case 2:{q=22418;break}case 3:{q=22411;break}default:He(22203,321,22398)}c[r>>2]=q;c[r+4>>2]=a;pb[i&63](k,22432,r)|0;b=0;l=s;return b|0}case 54:{qj(0);b=(pg()|0)!=0&1;l=s;return b|0}case 55:{if(!(gg()|0)){b=0;l=s;return b|0}b=lg()|0;b=(c[17583]|b|0)==0&1;l=s;return b|0}case 56:{qj(0);if(!(c[17581]|0)){c[17582]=1;b=0;l=s;return b|0}if(!(qg()|0)){b=mg()|0;b=(b|0)!=0;b=b&1;l=s;return b|0}ng(1)|0;b=mg()|0;b=(b|0)!=0;b=b&1;l=s;return b|0}case 57:{Xe();b=ng(1)|0;l=s;return b|0}case 58:{r=(c[b>>2]|0)+(4-1)&~(4-1);a=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);d=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);e=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);f=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);g=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);h=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);i=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);j=c[r>>2]|0;c[b>>2]=r+4;if(!(c[17581]|0))Xe();if(!(mg()|0)){b=176;l=s;return b|0}b=Jj(a,d,e,f,g,h,i,j)|0;l=s;return b|0}case 59:{r=(c[b>>2]|0)+(4-1)&~(4-1);a=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);d=c[r>>2]|0;c[b>>2]=r+4;r=(c[b>>2]|0)+(4-1)&~(4-1);e=c[r>>2]|0;c[b>>2]=r+4;if(!(c[17581]|0))Xe();if(!(mg()|0)){b=176;l=s;return b|0}b=Kj(a,d,e)|0;l=s;return b|0}case 60:{q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;Lj(r);b=0;l=s;return b|0}case 61:{q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;switch(r|0){case 30111:{b=Un(1120)|0;l=s;return b|0}case 30112:{b=Vn(1120)|0;l=s;return b|0}case 30113:{b=Wn(1120)|0;l=s;return b|0}case 30114:{b=Xn(1120)|0;l=s;return b|0}default:{b=61;l=s;return b|0}}}case 63:{q=(c[b>>2]|0)+(4-1)&~(4-1);r=c[q>>2]|0;c[b>>2]=q+4;b=Jf(r)|0;l=s;return b|0}case 64:{if(c[17581]|0){b=1;l=s;return b|0}qj(0);ig();b=0;l=s;return b|0}case 65:{r=(c[b>>2]|0)+(4-1)&~(4-1);a=c[r>>2]|0;c[b>>2]=r+4;if((a|0)<=0){b=0;l=s;return b|0}qj(a);b=0;l=s;return b|0}case 66:{r=(c[b>>2]|0)+(4-1)&~(4-1);a=c[r>>2]|0;c[b>>2]=r+4;if(!a){b=0;l=s;return b|0}c[a>>2]=tj(c[17581]^1)|0;b=0;l=s;return b|0}case 67:{qj(0);Sf(Tf()|0|8);b=0;l=s;return b|0}case 68:{qj(0);Sf(Tf()|0|16);b=0;l=s;return b|0}case 72:case 71:{b=69;l=s;return b|0}case 62:case 23:{b=0;l=s;return b|0}default:{qj(0);b=61;l=s;return b|0}}while(0);return 0}function _e(a){a=a|0;var b=0;b=c[17586]|0;if(!b)a=Of(a)|0;else a=tb[b&15](a)|0;if(a|0){b=a;return b|0}b=zo()|0;a=c[b>>2]|0;if(!a){Tn(12);a=c[b>>2]|0}Qn(a)|0;b=0;return b|0}function $e(a){a=a|0;var b=0,d=0;do if(c[17583]|0){if(hg()|0){c[17583]=0;d=5;break}if(c[17583]|0){b=c[17586]|0;if(!b){b=Of(a)|0;break}else{b=tb[b&15](a)|0;break}}else d=5}else d=5;while(0);do if((d|0)==5){b=c[17587]|0;if(!b){b=Pf(a)|0;break}else{b=tb[b&15](a)|0;break}}while(0);if(b|0){d=b;return d|0}a=zo()|0;b=c[a>>2]|0;if(!b){Tn(12);b=c[a>>2]|0}Qn(b)|0;d=0;return d|0}function af(a){a=a|0;var b=0;do if(c[17583]|0){if(hg()|0){c[17583]=0;break}if(c[17583]|0){b=0;return b|0}}while(0);b=c[17588]|0;if(!b){b=ag(a)|0;return b|0}else{b=tb[b&15](a)|0;return b|0}return 0}function bf(a,b){a=a|0;b=b|0;var d=0;if(!a){d=c[17586]|0;if(!d)d=Of(b)|0;else d=tb[d&15](b)|0;if(d|0){a=d;return a|0}b=zo()|0;d=c[b>>2]|0;if(!d){Tn(12);d=c[b>>2]|0}Qn(d)|0;a=0;return a|0}if(!b){d=c[(zo()|0)>>2]|0;b=c[17590]|0;if(!b)Rf(a);else rb[b&7](a);if(!d){a=0;return a|0}Tn(d);a=0;return a|0}d=c[17589]|0;if(!d)d=Qf(a,b)|0;else d=yb[d&7](a,b)|0;if(d|0){a=d;return a|0}if(c[(zo()|0)>>2]|0){a=0;return a|0}Tn(12);a=0;return a|0}function cf(a){a=a|0;var b=0,d=0;if(!a)return;b=c[(zo()|0)>>2]|0;d=c[17590]|0;if(!d)Rf(a);else rb[d&7](a);if(!b)return;Tn(b);return}function df(a,b){a=a|0;b=b|0;var d=0;d=S(b,a)|0;if(b|0?((d>>>0)/(b>>>0)|0|0)!=(a|0):0){Tn(12);d=0;return d|0}a=c[17586]|0;if(!a)a=Of(d)|0;else a=tb[a&15](d)|0;if(a|0){Yq(a|0,0,d|0)|0;d=a;return d|0}b=zo()|0;a=c[b>>2]|0;if(!a){Tn(12);a=c[b>>2]|0}Qn(a)|0;d=0;return d|0}function ef(a,b){a=a|0;b=b|0;var c=0;c=S(b,a)|0;if(b|0?((c>>>0)/(b>>>0)|0|0)!=(a|0):0){Tn(12);c=0;return c|0}a=$e(c)|0;if(!a){c=0;return c|0}Yq(a|0,0,c|0)|0;c=a;return c|0}function ff(a){a=a|0;var b=0,d=0,e=0,f=0;e=Fo(a)|0;do if(c[17583]|0){if(hg()|0){c[17583]=0;f=6;break}if(c[17583]|0){d=e+1|0;f=10}else f=6}else f=6;while(0);if((f|0)==6){b=c[17588]|0;if(!b)d=ag(a)|0;else d=tb[b&15](a)|0;b=e+1|0;if(d){b=$e(b)|0;if(!b){a=0;return a|0}}else{d=b;f=10}}if((f|0)==10){b=c[17586]|0;if(!b)b=Of(d)|0;else b=tb[b&15](d)|0;if(!b){d=zo()|0;b=c[d>>2]|0;if(!b){Tn(12);b=c[d>>2]|0}Qn(b)|0;a=0;return a|0}}Mp(b,a)|0;a=b;return a|0}function gf(a){a=a|0;var b=0,d=0,e=0;while(1){b=c[17586]|0;if(!b)b=Of(a)|0;else b=tb[b&15](a)|0;if(b|0){a=11;break}d=zo()|0;b=c[d>>2]|0;if(!b){Tn(12);b=c[d>>2]|0}Qn(b)|0;e=(gg()|0)==0;b=c[17591]|0;if(!(e&(b|0)!=0)){a=10;break}if(!(pb[b&63](c[17592]|0,a,0)|0)){a=10;break}}if((a|0)==10)Be(Qn(c[d>>2]|0)|0,0);else if((a|0)==11)return b|0;return 0}function hf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;while(1){d=bf(a,b)|0;if(d|0){g=13;break}f=(gg()|0)==0;e=c[17591]|0;if(!(f&(e|0)!=0)){g=12;break}f=c[17592]|0;do if(c[17583]|0)if(!(hg()|0))if(!(c[17583]|0)){g=8;break}else{d=0;break}else{c[17583]=0;g=8;break}else g=8;while(0);do if((g|0)==8){g=0;d=c[17588]|0;if(!d){d=ag(a)|0;break}else{d=tb[d&15](a)|0;break}}while(0);if(!(pb[e&63](f,b,d|0?3:2)|0)){g=12;break}}if((g|0)==12)Be(Qn(c[(zo()|0)>>2]|0)|0,0);else if((g|0)==13)return d|0;return 0}function jf(a){a=a|0;var b=0,d=0;while(1){d=$e(a)|0;if(d|0){b=6;break}d=(gg()|0)==0;b=c[17591]|0;if(!(d&(b|0)!=0)){b=5;break}if(!(pb[b&63](c[17592]|0,a,1)|0)){b=5;break}}if((b|0)==5){d=Qn(c[(zo()|0)>>2]|0)|0;Be(d,ze(22449)|0)}else if((b|0)==6)return d|0;return 0}function kf(a,b){a=a|0;b=b|0;var d=0;d=S(b,a)|0;if(b|0?((d>>>0)/(b>>>0)|0|0)!=(a|0):0){Tn(12);Be(Qn(c[(zo()|0)>>2]|0)|0,0)}b=gf(d)|0;Yq(b|0,0,d|0)|0;return b|0}function lf(a,b){a=a|0;b=b|0;var d=0;d=S(b,a)|0;if(b|0?((d>>>0)/(b>>>0)|0|0)!=(a|0):0){Tn(12);Be(Qn(c[(zo()|0)>>2]|0)|0,0)}b=jf(d)|0;Yq(b|0,0,d|0)|0;return b|0}function mf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;do{b=ff(a)|0;if(b|0){f=15;break}e=Fo(a)|0;do if(c[17583]|0)if(!(hg()|0))if(!(c[17583]|0)){f=7;break}else{b=0;break}else{c[17583]=0;f=7;break}else f=7;while(0);do if((f|0)==7){f=0;b=c[17588]|0;if(!b){b=ag(a)|0;break}else{b=tb[b&15](a)|0;break}}while(0);d=(b|0)!=0;g=(gg()|0)==0;b=c[17591]|0;if(!(g&(b|0)!=0))break}while((pb[b&63](c[17592]|0,e,d&1)|0)!=0);if((f|0)==15)return b|0;b=Qn(c[(zo()|0)>>2]|0)|0;if(!d){g=0;Be(b,g)}g=ze(22449)|0;Be(b,g);return 0}function nf(a){a=a|0;var b=0;b=(gg()|0)==0;return (b?c[17584]&a:0)|0}function of(a,b){a=a|0;b=b|0;xh(a,b);oj(a,b);return}function pf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;p=l;l=l+16|0;if((l|0)>=(m|0))$(16);o=(e|0)==0?p+4|0:e;n=(f|0)==0?p:f;c[n>>2]=0;c[o>>2]=0;a:do if(!b)e=0;else{if((a[b>>0]|0)!=40){c[n>>2]=204;e=0;break}k=d+-1|0;e=0;d=0;j=0;i=0;f=b;b=40;b:while(1){g=b&255;c:do if(j)if(b<<24>>24==58){b=d+j|0;if(k>>>0>>0){f=9;break b}d=b;h=0;b=i;f=f+j|0;break}else{if((b+-48&255)>=10){f=13;break b}h=(j*10|0)+-48+g|0;b=i;break}else switch(b<<24>>24){case 40:{if(i|0){f=16;break b}e=e+1|0;h=0;b=0;break c}case 41:{if(!e){f=19;break b}if(i|0){f=21;break b}e=e+-1|0;if(!e){f=23;break b}else{h=0;b=0;break c}}case 91:if(!i){h=0;b=f;break c}else{f=25;break b}case 93:if(!i){f=27;break b}else{h=0;b=0;break c}default:{if((b+-48&255)>=10){f=32;break b}if(b<<24>>24==48){f=30;break b}h=g+-48|0;b=i;break c}}while(0);g=f+1|0;d=d+1|0;if(k>>>0>>0){f=5;break}j=h;i=b;f=g;b=a[g>>0]|0}switch(f|0){case 5:{c[o>>2]=d;c[n>>2]=202;e=0;break a}case 9:{c[o>>2]=d;c[n>>2]=202;e=0;break a}case 13:{c[o>>2]=d;c[n>>2]=201;e=0;break a}case 16:{c[o>>2]=d;c[n>>2]=209;e=0;break a}case 19:{c[o>>2]=d;c[n>>2]=203;e=0;break a}case 21:{c[o>>2]=d;c[n>>2]=209;e=0;break a}case 23:{e=d+1|0;break a}case 25:{c[o>>2]=d;c[n>>2]=208;e=0;break a}case 27:{c[o>>2]=d;c[n>>2]=209;e=0;break a}case 30:{c[o>>2]=d;c[n>>2]=207;e=0;break a}case 32:switch(b<<24>>24){case 92:case 38:{c[o>>2]=d;c[n>>2]=210;e=0;break a}default:{c[o>>2]=d;c[n>>2]=205;e=0;break a}}}}while(0);l=p;return e|0}function qf(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);j=i;c[j>>2]=h;h=rf(a,b,d,e,f,g,j)|0;l=i;return h|0}function rf(b,e,f,g,h,i,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;T=l;l=l+64|0;if((l|0)>=(m|0))$(64);P=T+8|0;O=T;M=T+16|0;N=T+12|0;if(!b){S=45;l=T;return S|0}c[b>>2]=0;if(!f){S=45;l=T;return S|0}R=(e|0)==0?T+52|0:e;k=g+2|0;p=(g|0)==0;if(!p?(af(f)|0)!=0:0)e=$e(k)|0;else e=_e(k)|0;s=e;a:do if(!e){n=Qn(c[(zo()|0)>>2]|0)|0;c[R>>2]=0;o=s;S=283}else{b:do if(p){q=f;g=0;o=s;e=s;S=274}else{K=(h|0)!=0;L=(i|0)==0;q=f;J=g;A=0;y=0;x=0;r=0;B=0;C=0;D=0;E=0;F=0;G=0;g=0;p=s;e=s;c:while(1){w=(r|0)!=0;if(!(w|(x|0)==0))if(!(No(22485,a[q>>0]|0,71)|0)){u=q;v=u-x|0;h=p;t=e-p|0;do if((t+3+v|0)>>>0>=k>>>0){s=k+6+(v<<1)|0;if(s>>>0<=k>>>0){e=67;S=18;break c}h=bf(h,s)|0;if(!h){h=Qn(c[(zo()|0)>>2]|0)|0;if(!h)break;else{e=h;S=18;break c}}else{p=h;k=s;e=h+t|0;break}}while(0);H=e;I=H+1|0;a[H>>0]=1;S=v&65535;a[I>>0]=S;a[I+1>>0]=S>>8;H=H+3|0;cr(H|0,x|0,v|0)|0;I=0;H=H+v|0;S=20}else{z=y;h=q;w=J;r=0;t=G}else{I=x;H=e;S=20}d:do if((S|0)==20){S=0;if(y|0){e=a[q>>0]|0;if(F|0)switch(e<<24>>24|0){case 92:case 39:case 34:case 114:case 102:case 110:case 118:case 116:case 98:{F=0;z=y;x=I;h=q;w=J;t=G;e=H;break d}case 55:case 54:case 53:case 52:case 51:case 50:case 49:case 48:{if(J>>>0<=2){S=26;break c}if((a[q+1>>0]&-8)<<24>>24!=48){S=26;break c}e=q+2|0;if((a[e>>0]&-8)<<24>>24!=48){S=26;break c}F=0;z=y;x=I;h=e;w=J+-2|0;t=G;e=H;break d}case 120:{if(J>>>0<=2){S=33;break c}e=a[q+1>>0]|0;if((e+-48&255)>=10)switch(e<<24>>24){case 65:case 66:case 67:case 68:case 69:case 70:case 97:case 98:case 99:case 100:case 101:case 102:break;default:{S=33;break c}}h=q+2|0;e=a[h>>0]|0;if((e+-48&255)>=10)switch(e<<24>>24){case 65:case 66:case 67:case 68:case 69:case 70:case 97:case 98:case 99:case 100:case 101:case 102:break;default:{S=33;break c}}F=0;z=y;x=I;w=J+-2|0;t=G;e=H;break d}case 13:{h=q+1|0;w=(a[h>>0]|0)==10;F=0;z=y;x=I;h=w?h:q;w=(w<<31>>31)+J|0;t=G;e=H;break d}case 10:{h=q+1|0;w=(a[h>>0]|0)==13;F=0;z=y;x=I;h=w?h:q;w=(w<<31>>31)+J|0;t=G;e=H;break d}default:{S=37;break c}}if(e<<24>>24==92){F=1;z=y;x=I;h=q;w=J;t=G;e=H;break}if(e<<24>>24!=34){F=0;z=y;x=I;h=q;w=J;t=G;e=H;break}s=y+1|0;t=q;v=t-s|0;e=p;u=H-p|0;do if((v+3+u|0)>>>0>=k>>>0){h=(v<<1)+6+k|0;if(h>>>0<=k>>>0){e=67;S=81;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=81;break c}}else{p=e;k=h;e=e+u|0;break}}else e=H;while(0);x=e+1|0;a[e>>0]=1;a[x>>0]=0;a[x+1>>0]=0;e=e+3|0;y=e;e:do if(v){w=v;h=0;while(1){t=a[s>>0]|0;u=t&255;f:do if(!h){if(t<<24>>24==92){h=1;u=w;break}a[e>>0]=t;h=0;u=w;e=e+1|0}else do switch(t<<24>>24){case 98:{a[e>>0]=8;h=0;u=w;e=e+1|0;break f}case 116:{a[e>>0]=9;h=0;u=w;e=e+1|0;break f}case 118:{a[e>>0]=11;h=0;u=w;e=e+1|0;break f}case 110:{a[e>>0]=10;h=0;u=w;e=e+1|0;break f}case 102:{a[e>>0]=12;h=0;u=w;e=e+1|0;break f}case 114:{a[e>>0]=13;h=0;u=w;e=e+1|0;break f}case 34:{a[e>>0]=34;h=0;u=w;e=e+1|0;break f}case 39:{a[e>>0]=39;h=0;u=w;e=e+1|0;break f}case 92:{a[e>>0]=92;h=0;u=w;e=e+1|0;break f}case 13:{t=s+1|0;if(w>>>0<=1)break e;H=(a[t>>0]|0)==10;h=0;u=(H<<31>>31)+w|0;s=H?t:s;break f}case 10:{t=s+1|0;if(w>>>0<=1)break e;H=(a[t>>0]|0)==13;h=0;u=(H<<31>>31)+w|0;s=H?t:s;break f}case 120:{if(w>>>0<=2){h=0;u=w;break f}t=a[s+1>>0]|0;if((t+-48&255)>=10)switch(t<<24>>24){case 65:case 66:case 67:case 68:case 69:case 70:case 97:case 98:case 99:case 100:case 101:case 102:break;default:{h=0;u=w;break f}}v=s+2|0;u=a[v>>0]|0;if((u+-48&255)>=10)switch(u<<24>>24){case 65:case 66:case 67:case 68:case 69:case 70:case 97:case 98:case 99:case 100:case 101:case 102:break;default:{h=0;u=w;break f}}h=t&255;if((t&255)<58)s=h+-48|0;else s=h+10+((t&255)<71?-65:-97)|0;h=u&255;if((u&255)<58)h=h+-48|0;else h=h+10+((u&255)<71?-65:-97)|0;a[e>>0]=h+(s<<4);h=0;u=w+-2|0;e=e+1|0;s=v;break f}default:{if(!(w>>>0>2&(t&-8)<<24>>24==48)){h=0;u=w;break f}h=a[s+1>>0]|0;if((h&-8)<<24>>24!=48){h=0;u=w;break f}v=s+2|0;t=a[v>>0]|0;if((t&-8)<<24>>24!=48){h=0;u=w;break f}a[e>>0]=(u<<6)+80+((h&255)<<3)+(t&255);h=0;u=w+-2|0;e=e+1|0;s=v;break f}}while(0);while(0);w=u+-1|0;if(!w)break;else s=s+1|0}}while(0);F=e-y&65535;a[x>>0]=F;a[x+1>>0]=F>>8;F=0;z=0;x=I;h=q;w=J;t=G;break}if(w){e=a[q>>0]|0;h=e<<24>>24;if(kp(h)|0){E=E+1|0;z=0;x=I;h=q;w=J;t=G;e=H;break}if(e<<24>>24!=35)switch(h|0){case 10:case 13:case 12:case 11:case 9:case 32:{z=0;x=I;h=q;w=J;t=G;e=H;break d}default:{S=112;break c}}if(E&1|0){S=87;break c}t=(E|0)/2|0;e=p;s=H-p|0;do if((t+3+s|0)>>>0>=k>>>0){h=(t<<1)+6+k|0;if(h>>>0<=k>>>0){e=67;S=93;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=93;break c}}else{p=e;k=h;e=e+s|0;break}}else e=H;while(0);h=e+1|0;a[e>>0]=1;H=t&65535;a[h>>0]=H;a[h+1>>0]=H>>8;e=e+3|0;h=r+1|0;if(h>>>0>=q>>>0){z=0;x=I;h=q;w=J;r=0;t=G;break}while(1){s=r;r=h;g:while(1){h=a[r>>0]|0;switch(h<<24>>24|0){case 10:case 13:case 12:case 11:case 9:case 32:break;default:break g}h=r+1|0;if(h>>>0>>0){s=r;r=h}else{z=0;x=I;h=q;w=J;r=0;t=G;break d}}r=h&255;h=r+-48|0;do if(h>>>0>=10)if((r+-65|0)>>>0<6){h=r+-55|0;break}else{h=(r+-97|0)>>>0<6?r+-87|0:0;break}while(0);r=s+2|0;h:do if(r>>>0>>0){i:while(1){s=a[r>>0]|0;switch(s<<24>>24|0){case 10:case 13:case 12:case 11:case 9:case 32:break;default:break i}r=r+1|0;if(r>>>0>=q>>>0)break h}t=h<<4;s=s&255;h=s+-48|0;do if(h>>>0>=10)if((s+-65|0)>>>0<6){h=s+-55|0;break}else{h=(s+-97|0)>>>0<6?s+-87|0:0;break}while(0);h=h+t|0}while(0);H=e;e=H+1|0;a[H>>0]=h;h=r+1|0;if(h>>>0>=q>>>0){z=0;x=I;h=q;w=J;r=0;t=G;break d}}}if(B|0){B=(a[q>>0]|0)==124?0:B;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break}if(A|0){e=a[q>>0]|0;if((e+-48&255)<10){B=0;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break}switch(e<<24>>24){case 34:{A=0;B=0;F=0;z=q;x=I;h=q;w=J;r=0;t=G;e=H;break d}case 58:{s=Fq(A)|0;if(s>>>0>(J+-1|0)>>>0){S=119;break c}e=p;r=H-p|0;do if((r+3+s|0)>>>0>=k>>>0){h=k+6+(s<<1)|0;if(h>>>0<=k>>>0){e=67;S=125;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=125;break c}}else{p=e;k=h;e=e+r|0;break}}else e=H;while(0);A=e+1|0;a[e>>0]=1;B=s&65535;a[A>>0]=B;a[A+1>>0]=B>>8;e=e+3|0;cr(e|0,q+1|0,s|0)|0;A=0;B=0;z=0;x=I;h=q+s|0;w=J-s|0;r=0;t=G;e=e+s|0;break d}case 35:{A=0;B=0;E=0;z=0;x=I;h=q;w=J;r=q;t=G;e=H;break d}case 124:{A=0;B=q;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break d}default:{S=129;break c}}}h=a[q>>0]|0;if(!D)switch(h<<24>>24){case 34:{A=0;B=0;D=0;F=0;z=q;x=I;h=q;w=J;r=0;t=G;e=H;break d}case 40:{if(C|0){S=239;break c}e=p;r=H-p|0;do if((r+3|0)>>>0>=k>>>0){h=k+6|0;if(k>>>0>=4294967290){e=67;S=245;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=245;break c}}else{p=e;k=h;e=e+r|0;break}}else e=H;while(0);a[e>>0]=3;A=0;B=0;C=0;D=0;g=g+1|0;z=0;x=I;h=q;w=J;r=0;t=G;e=e+1|0;break d}case 41:{if(C|0){S=248;break c}e=p;r=H-p|0;do if((r+3|0)>>>0>=k>>>0){h=k+6|0;if(k>>>0>=4294967290){e=67;S=254;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=254;break c}}else{p=e;k=h;e=e+r|0;break}}else e=H;while(0);a[e>>0]=4;A=0;B=0;C=0;D=0;g=g+-1|0;z=0;x=I;h=q;w=J;r=0;t=G;e=e+1|0;break d}case 35:{A=0;B=0;D=0;E=0;z=0;x=I;h=q;w=J;r=q;t=G;e=H;break d}case 124:{A=0;B=q;D=0;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break d}case 91:if(!C){A=0;B=0;C=q;D=0;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break d}else{S=259;break c}case 93:if(!C){S=261;break c}else{A=0;B=0;C=0;D=0;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break d}default:{if((h+-48&255)<10)if(h<<24>>24==48){S=264;break c}else{A=q;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break d}e=h<<24>>24;if(No(22485,e,71)|0){A=0;B=0;D=0;z=0;x=q;h=q;w=J;r=0;t=G;e=H;break d}switch(e|0){case 10:case 13:case 12:case 11:case 9:case 32:{A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break d}default:{}}if(h<<24>>24==123){S=268;break c}if(No(22584,e,3)|0){S=270;break c}if(K&h<<24>>24==37){A=0;B=0;D=q;z=0;x=I;h=q;w=J;r=0;t=G;e=H;break d}else{S=272;break c}}}switch(h<<24>>24){case 77:case 109:{c[M>>2]=0;s=(a[q>>0]|0)==109?1:5;if(L){t=(c[j>>2]|0)+(4-1)&~(4-1);u=c[t>>2]|0;c[j>>2]=t+4;t=G}else{u=c[c[i+(G<<2)>>2]>>2]|0;t=G+1|0}if(!(Ll(u,2)|0)){if(Tk(s,0,0,M,u)|0){S=152;break c}e=c[M>>2]|0;h=p;r=H-p|0;do if((r+3+e|0)>>>0>=k>>>0){e=k+6+(e<<1)|0;if(e>>>0<=k>>>0){e=67;S=158;break c}h=bf(h,e)|0;if(!h){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=158;break c}}else{p=h;k=e;e=h+r|0;break}}else e=H;while(0);h=p;do if(!(af(h)|0)){if(!(Ll(u,1)|0))break;r=$e(k)|0;if(!r){S=163;break c}e=e-p|0;cr(r|0,h|0,e|0)|0;cf(p);p=r;e=r+e|0}while(0);H=e+1|0;a[e>>0]=1;G=c[M>>2]&65535;a[H>>0]=G;a[H+1>>0]=G>>8;e=e+3|0;if(Tk(s,e,c[M>>2]|0,M,u)|0){S=165;break c}e=e+(c[M>>2]|0)|0}else{s=wl(u,N)|0;e=((c[N>>2]|0)+7|0)>>>3;c[M>>2]=e;if((s|0)!=0&(e|0)!=0){h=p;r=H-p|0;do if((r+3+e|0)>>>0>=k>>>0){e=k+6+(e<<1)|0;if(e>>>0<=k>>>0){e=67;S=142;break c}h=bf(h,e)|0;if(!h){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=142;break c}}else{p=h;k=e;e=h+r|0;break}}else e=H;while(0);h=p;do if(!(af(h)|0)){if(!(Ll(u,1)|0))break;r=$e(k)|0;if(!r){S=147;break c}e=e-p|0;cr(r|0,h|0,e|0)|0;cf(p);p=r;e=r+e|0}while(0);H=e+1|0;a[e>>0]=1;G=c[M>>2]&65535;a[H>>0]=G;a[H+1>>0]=G>>8;e=e+3|0;cr(e|0,s|0,c[M>>2]|0)|0;e=e+(c[M>>2]|0)|0}else e=H}A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;break d}case 115:{if(L){t=(c[j>>2]|0)+(4-1)&~(4-1);s=c[t>>2]|0;c[j>>2]=t+4;t=G}else{s=c[c[i+(G<<2)>>2]>>2]|0;t=G+1|0}u=Fo(s)|0;e=p;r=H-p|0;do if((r+3+u|0)>>>0>=k>>>0){h=k+6+(u<<1)|0;if(h>>>0<=k>>>0){e=67;S=178;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=178;break c}}else{p=e;k=h;e=e+r|0;break}}else e=H;while(0);A=e+1|0;a[e>>0]=1;B=u&65535;a[A>>0]=B;a[A+1>>0]=B>>8;e=e+3|0;cr(e|0,s|0,u|0)|0;A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;e=e+u|0;break d}case 98:{if(L){u=(c[j>>2]|0)+(4-1)&~(4-1);v=c[u>>2]|0;c[j>>2]=u+4;u=(c[j>>2]|0)+(4-1)&~(4-1);t=c[u>>2]|0;c[j>>2]=u+4;u=G}else{t=c[c[i+(G+1<<2)>>2]>>2]|0;v=c[c[i+(G<<2)>>2]>>2]|0;u=G+2|0}e=p;r=H-p|0;do if((r+3+v|0)>>>0>=k>>>0){h=k+6+(v<<1)|0;if(h>>>0<=k>>>0){n=67;S=187;break c}s=bf(e,h)|0;if(!s){h=Qn(c[(zo()|0)>>2]|0)|0;if(!h){e=H;break}else{n=h;S=187;break c}}else{p=s;k=h;e=s+r|0;break}}else e=H;while(0);do if(v){h=p;if(af(h)|0)break;if(!(af(t)|0))break;r=$e(k)|0;if(!r){S=193;break c}e=e-p|0;cr(r|0,h|0,e|0)|0;cf(p);p=r;e=r+e|0}while(0);A=e+1|0;a[e>>0]=1;B=v&65535;a[A>>0]=B;a[A+1>>0]=B>>8;e=e+3|0;cr(e|0,t|0,v|0)|0;A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=u;e=e+v|0;break d}case 100:{if(L){t=(c[j>>2]|0)+(4-1)&~(4-1);e=c[t>>2]|0;c[j>>2]=t+4;t=G}else{e=c[c[i+(G<<2)>>2]>>2]|0;t=G+1|0}c[O>>2]=e;Pp(M,22578,O)|0;s=Fo(M)|0;e=p;r=H-p|0;do if((r+3+s|0)>>>0>=k>>>0){h=k+6+(s<<1)|0;if(h>>>0<=k>>>0){e=67;S=204;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=204;break c}}else{p=e;k=h;e=e+r|0;break}}else e=H;while(0);A=e+1|0;a[e>>0]=1;B=s&65535;a[A>>0]=B;a[A+1>>0]=B>>8;e=e+3|0;cr(e|0,M|0,s|0)|0;A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;e=e+s|0;break d}case 117:{if(L){t=(c[j>>2]|0)+(4-1)&~(4-1);e=c[t>>2]|0;c[j>>2]=t+4;t=G}else{e=c[c[i+(G<<2)>>2]>>2]|0;t=G+1|0}c[P>>2]=e;Pp(M,22581,P)|0;s=Fo(M)|0;e=p;r=H-p|0;do if((r+3+s|0)>>>0>=k>>>0){h=k+6+(s<<1)|0;if(h>>>0<=k>>>0){e=67;S=214;break c}e=bf(e,h)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=214;break c}}else{p=e;k=h;e=e+r|0;break}}else e=H;while(0);A=e+1|0;a[e>>0]=1;B=s&65535;a[A>>0]=B;a[A+1>>0]=B>>8;e=e+3|0;cr(e|0,M|0,s|0)|0;A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;e=e+s|0;break d}case 83:{if(L){y=(c[j>>2]|0)+(4-1)&~(4-1);w=c[y>>2]|0;c[j>>2]=y+4;y=G}else{w=c[c[i+(G<<2)>>2]>>2]|0;y=G+1|0}if(!w){A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=y;e=H;break d}e=a[w>>0]|0;if(!(e<<24>>24)){A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=y;e=H;break d}v=w;u=0;r=w;h=0;while(1){s=r;r=e;j:while(1){t=s+1|0;switch(r<<24>>24){case 3:{S=225;break j}case 4:{S=227;break j}case 1:{e=t+(((d[t>>0]|d[t+1>>0]<<8)&65535)+2)|0;break}default:e=t}r=a[e>>0]|0;if(!(r<<24>>24)){A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=y;e=H;break d}else s=e}if((S|0)==225){S=0;e=u+1|0;h=(u|0)==0?s-v|0:h}else if((S|0)==227){S=0;e=u+-1|0;if(!e)break}s=a[t>>0]|0;if(!(s<<24>>24)){A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=y;e=H;break d}else{u=e;r=t;e=s}}u=t-v|0;if(!u){A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=y;e=H;break d}e=p;s=H-p|0;do if((s+3+u|0)>>>0>=k>>>0){r=k+6+(u<<1)|0;if(r>>>0<=k>>>0){e=67;S=235;break c}e=bf(e,r)|0;if(!e){e=Qn(c[(zo()|0)>>2]|0)|0;if(!e){e=H;break}else{S=235;break c}}else{p=e;k=r;e=e+s|0;break}}else e=H;while(0);cr(e|0,w+h|0,u|0)|0;A=0;B=0;D=0;z=0;x=I;h=q;w=J;r=0;t=y;e=e+u|0;break d}default:{S=236;break c}}}while(0);q=h+1|0;J=w+-1|0;if(!J){o=p;S=274;break b}else{y=z;G=t}}switch(S|0){case 18:{c[R>>2]=u-f;o=p;break b}case 26:{c[R>>2]=q-f;e=206;o=p;break b}case 33:{c[R>>2]=q-f;e=206;o=p;break b}case 37:{c[R>>2]=q-f;e=206;o=p;break b}case 81:{c[R>>2]=t-f;o=p;break b}case 87:{c[R>>2]=q-f;e=212;o=p;break b}case 93:{c[R>>2]=q-f;o=p;break b}case 112:{c[R>>2]=q-f;e=211;o=p;break b}case 119:{c[R>>2]=q-f;e=202;o=p;break b}case 125:{c[R>>2]=q-f;o=p;break b}case 129:{c[R>>2]=q-f;e=201;o=p;break b}case 142:{c[R>>2]=q-f;o=p;S=150;break}case 147:{e=Qn(c[(zo()|0)>>2]|0)|0;o=p;S=150;break}case 152:{He(22556,1433,22563);break}case 158:{c[R>>2]=q-f;n=e;o=p;Q=k;break}case 163:{n=Qn(c[(zo()|0)>>2]|0)|0;o=p;Q=k;break}case 165:{He(22556,1460,22563);break}case 178:{c[R>>2]=q-f;o=p;break b}case 187:{c[R>>2]=q-f;g=p;break a}case 193:{n=Qn(c[(zo()|0)>>2]|0)|0;o=p;S=283;break a}case 204:{c[R>>2]=q-f;o=p;break b}case 214:{c[R>>2]=q-f;o=p;break b}case 235:{c[R>>2]=q-f;o=p;break b}case 236:{c[R>>2]=q-f;e=201;o=p;break b}case 239:{c[R>>2]=q-f;e=209;o=p;break b}case 245:{c[R>>2]=q-f;o=p;break b}case 248:{c[R>>2]=q-f;e=209;o=p;break b}case 254:{c[R>>2]=q-f;o=p;break b}case 259:{c[R>>2]=q-f;e=208;o=p;break b}case 261:{c[R>>2]=q-f;e=209;o=p;break b}case 264:{c[R>>2]=q-f;e=207;o=p;break b}case 268:{c[R>>2]=q-f;e=210;o=p;break b}case 270:{c[R>>2]=q-f;e=210;o=p;break b}case 272:{c[R>>2]=q-f;e=205;o=p;break b}}if((S|0)==150){n=e;Q=k}k=Q;S=283;break a}while(0);k:do if((S|0)==274){n=o;h=e-o|0;l:do if((h+3|0)>>>0>=k>>>0){p=k+6|0;do if(k>>>0<4294967290){n=bf(n,p)|0;if(!n){n=Qn(c[(zo()|0)>>2]|0)|0;if(!n)break l;else{e=n;break}}else{o=n;k=p;e=n+h|0;break l}}else e=67;while(0);c[R>>2]=q-f;break k}while(0);a[e>>0]=0;if(!g){k=o;e=o;S=295;break a}else e=203}while(0);n=e;g=o;e=o}while(0);if((S|0)==283){e=o;if(!n){k=o;S=295}else g=o}if((S|0)==295){m:do if(k){switch(a[e>>0]|0){case 0:{sf(e);e=0;break m}case 3:break;default:break m}if((a[e+1>>0]|0)==4){sf(e);e=0}}else e=0;while(0);c[b>>2]=e;S=0;l=T;return S|0}if(!e){S=n;l=T;return S|0}if(af(e)|0){if((k|0)!=0&(e&7|0)!=0)do{a[e>>0]=0;e=e+1|0;k=k+-1|0}while((k|0)!=0&(e&7|0)!=0);if(k>>>0>=8){p=k+-8|0;h=p&-8;q=h+8|0;o=e;while(1){S=o;c[S>>2]=0;c[S+4>>2]=0;k=k+-8|0;if(k>>>0<=7)break;else o=o+8|0}k=p-h|0;e=e+q|0}if(k|0)while(1){a[e>>0]=0;k=k+-1|0;if(!k)break;else e=e+1|0}}cf(g);S=n;l=T;return S|0}function sf(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!b)return;if(af(b)|0){f=a[b>>0]|0;if(!(f<<24>>24))e=b;else{e=b;do{g=e+1|0;if(f<<24>>24==1)e=e+3+((d[g>>0]|d[g+1>>0]<<8)&65535)|0;else e=g;f=a[e>>0]|0}while(f<<24>>24!=0)}j=b;e=e-j|0;if((e|0)!=0&(j&7|0)!=0){f=b;do{a[f>>0]=0;f=f+1|0;e=e+-1|0}while((e|0)!=0&(f&7|0)!=0)}else f=b;if(e>>>0>=8){i=e+-8|0;j=i&-8;h=j+8|0;g=f;while(1){k=g;c[k>>2]=0;c[k+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else g=g+8|0}f=f+h|0;e=i-j|0}if(e|0)while(1){a[f>>0]=0;e=e+-1|0;if(!e)break;else f=f+1|0}}cf(b);return}function tf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=i;g=i+8|0;h=i+4|0;do if((a|0)!=0?(c[a>>2]=0,(b|0)!=0&e>>>0<2):0){if(!(e|d)){d=pf(b,0,0,g)|0;if(!d){d=c[g>>2]|0;break}}else if((d|0)==0&(e|0)!=0)d=Fo(b)|0;d=qf(h,0,b,d,0,0,f)|0;c[g>>2]=d;if(!d){c[a>>2]=c[h>>2];d=0}}else d=45;while(0);l=i;return d|0}function uf(b,c,e){b=b|0;c=c|0;e=e|0;var f=0,g=0,h=0;if(!b){h=0;return h|0}if(!e)e=Fo(c)|0;g=b;a:while(1){f=a[g>>0]|0;switch(f<<24>>24){case 0:{e=0;h=26;break a}case 3:break;default:{b=g+1|0;if(f<<24>>24!=1){g=b;continue a}g=g+3+((d[b>>0]|d[b+1>>0]<<8)&65535)|0;continue a}}b=g+1|0;if((a[b>>0]|0)!=1){g=b;continue}b=g+2|0;f=g+4|0;b=(d[b>>0]|d[b+1>>0]<<8)&65535;if((b|0)==(e|0)?(Tp(f,c,e)|0)==0:0)break;g=f+b|0}if((h|0)==26)return e|0;b=1;f=f+e|0;b:do{e=f;c:while(1){switch(a[e>>0]|0){case 0:{h=15;break b}case 3:{h=13;break c}case 4:{h=14;break c}case 1:{e=e+1|0;e=e+(((d[e>>0]|d[e+1>>0]<<8)&65535)+2)+-1|0;break}default:{}}e=e+1|0}if((h|0)==13){h=0;b=b+1|0}else if((h|0)==14){h=0;b=b+-1|0}f=e+1|0}while((b|0)!=0);if((h|0)==15)He(22556,481,22587);e=f-g&65535;b=_e(e+1|0)|0;if(!b){h=0;return h|0}cr(b|0,g|0,e|0)|0;a[b+e>>0]=0;switch(a[b>>0]|0){case 0:{sf(b);h=0;return h|0}case 3:{if((a[b+1>>0]|0)!=4){h=b;return h|0}sf(b);h=0;return h|0}default:{h=b;return h|0}}return 0}function vf(b){b=b|0;var c=0,e=0,f=0,g=0;if(!b){g=0;return g|0}e=0;c=0;a:while(1){f=e;b:while(1){c:while(1){e=a[b>>0]|0;if(!(e<<24>>24))break a;b=b+1|0;switch(e<<24>>24){case 1:{g=7;break b}case 3:{g=8;break b}case 4:break c;default:{}}}f=f+-1|0}if((g|0)==7){e=f;b=b+(((d[b>>0]|d[b+1>>0]<<8)&65535)+2)|0;f=(f|0)==1&1}else if((g|0)==8){e=f+1|0;f=(f|0)==1&1}c=f+c|0}return c|0}function wf(b,c){b=b|0;c=c|0;var e=0,f=0,g=0;if(!b){g=0;return g|0}if((a[b>>0]|0)!=3){g=0;return g|0}a:do if((c|0)>0){e=0;b:while(1){c:while(1){d:while(1){f=b+1|0;switch(a[f>>0]|0){case 0:{b=0;break b}case 1:{g=9;break c}case 4:{g=11;break c}case 3:break d;default:b=f}}e=e+1|0;b=f}if((g|0)==9){b=b+2|0;b=b+(((d[b>>0]|d[b+1>>0]<<8)&65535)+2)+-1|0}else if((g|0)==11){e=e+-1|0;b=f}c=(((e|0)==0)<<31>>31)+c|0;if((c|0)<=0)break a}return b|0}while(0);f=b+1|0;e:do switch(a[f>>0]|0){case 1:{b=b+2|0;b=(d[b>>0]|d[b+1>>0]<<8)&65535;e=_e(b+6|0)|0;if(!e){g=0;return g|0}else{g=e+1|0;a[e>>0]=3;c=b+3|0;cr(g|0,f|0,c|0)|0;c=g+c|0;a[c>>0]=4;a[c+1>>0]=0;c=e;b=e;break e}}case 3:{c=1;b=f;f:while(1){g:while(1){e=b+1|0;switch(a[e>>0]|0){case 0:{g=18;break f}case 3:{g=16;break g}case 4:{g=17;break g}case 1:break;default:{b=e;continue g}}g=b+2|0;b=g+(((d[g>>0]|d[g+1>>0]<<8)&65535)+2)+-1|0}if((g|0)==16){g=0;c=c+1|0}else if((g|0)==17){g=0;c=c+-1|0}if(!c)break;else b=e}if((g|0)==18)He(22556,673,22609);b=b+2-f&65535;e=_e(b+1|0)|0;if(!e){g=0;return g|0}cr(e|0,f|0,b|0)|0;a[e+b>>0]=0;switch(a[e>>0]|0){case 3:{c=e;b=e;break e}case 0:break;default:{g=e;return g|0}}sf(e);g=0;return g|0}default:{g=0;return g|0}}while(0);if((a[c+1>>0]|0)!=4){g=b;return g|0}sf(b);g=0;return g|0}function xf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;c[f>>2]=0;if(!b){f=0;return f|0}g=a[b>>0]|0;if(g<<24>>24==3){b=b+1|0;h=a[b>>0]|0;g=h<<24>>24==1;a:do if((e|0)>0){i=0;b:while(1){c:do if(g){g=i;j=6}else{g=i;d:while(1){switch(h<<24>>24){case 0:{b=0;break b}case 4:break d;case 3:{g=g+1|0;break}default:{}}b=b+1|0;h=a[b>>0]|0;if(h<<24>>24==1){j=6;break c}}i=g+-1|0}while(0);if((j|0)==6){j=0;b=b+1|0;i=g;b=b+(((d[b>>0]|d[b+1>>0]<<8)&65535)+2)+-1|0}e=(((i|0)==0)<<31>>31)+e|0;b=b+1|0;h=a[b>>0]|0;g=h<<24>>24==1;if((e|0)<=0)break a}return b|0}while(0);if(!g){f=0;return f|0}}else if(!((e|0)==0&g<<24>>24==1)){f=0;return f|0}j=b+1|0;c[f>>2]=(d[j>>0]|d[j+1>>0]<<8)&65535;f=b+3|0;return f|0}function yf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;c[f>>2]=0;if(!b){f=0;return f|0}g=a[b>>0]|0;if(g<<24>>24==3){g=b+1|0;h=a[g>>0]|0;b=h<<24>>24==1;a:do if((e|0)>0){i=0;b:while(1){c:do if(b){b=i;j=6}else{b=i;d:while(1){switch(h<<24>>24){case 0:{b=0;break b}case 4:break d;case 3:{b=b+1|0;break}default:{}}g=g+1|0;h=a[g>>0]|0;if(h<<24>>24==1){j=6;break c}}i=b+-1|0}while(0);if((j|0)==6){j=0;g=g+1|0;i=b;g=g+(((d[g>>0]|d[g+1>>0]<<8)&65535)+2)+-1|0}e=(((i|0)==0)<<31>>31)+e|0;g=g+1|0;h=a[g>>0]|0;b=h<<24>>24==1;if((e|0)<=0)break a}return b|0}while(0);if(b)b=g;else{f=0;return f|0}}else if(!((e|0)==0&g<<24>>24==1)){f=0;return f|0}j=b+1|0;j=d[j>>0]|d[j+1>>0]<<8;g=j&65535;if(!(j<<16>>16)){f=0;return f|0}h=_e(g)|0;if(!h){f=0;return f|0}cr(h|0,b+3|0,g|0)|0;c[f>>2]=g;f=h;return f|0}function zf(b,c){b=b|0;c=c|0;var e=0,f=0,g=0,h=0;if(!b){h=0;return h|0}e=a[b>>0]|0;if(e<<24>>24==3){e=b+1|0;f=a[e>>0]|0;b=f<<24>>24==1;a:do if((c|0)>0){g=0;b:while(1){c:do if(b){b=g;h=6}else{b=g;d:while(1){switch(f<<24>>24){case 0:{b=0;break b}case 4:break d;case 3:{b=b+1|0;break}default:{}}e=e+1|0;f=a[e>>0]|0;if(f<<24>>24==1){h=6;break c}}g=b+-1|0}while(0);if((h|0)==6){h=0;e=e+1|0;g=b;e=e+(((d[e>>0]|d[e+1>>0]<<8)&65535)+2)+-1|0}c=(((g|0)==0)<<31>>31)+c|0;e=e+1|0;f=a[e>>0]|0;b=f<<24>>24==1;if((c|0)<=0)break a}return b|0}while(0);if(b)b=e;else{h=0;return h|0}}else if(!((c|0)==0&e<<24>>24==1)){h=0;return h|0}h=b+1|0;h=d[h>>0]|d[h+1>>0]<<8;e=h&65535;if(!(h<<16>>16)){h=0;return h|0}f=_e(e+1|0)|0;if(!f){h=0;return h|0}cr(f|0,b+3|0,e|0)|0;a[f+e>>0]=0;h=f;return h|0}function Af(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+16|0;if((l|0)>=(m|0))$(16);k=n;switch(f|0){case 8:{if(!b){k=0;l=n;return k|0}f=a[b>>0]|0;if(f<<24>>24==3){g=b+1|0;h=a[g>>0]|0;f=h<<24>>24==1;a:do if((e|0)>0){i=e;e=0;b:while(1){c:do if(f){f=e;j=7}else{f=e;d:while(1){switch(h<<24>>24){case 0:{b=0;break b}case 4:break d;case 3:{f=f+1|0;break}default:{}}g=g+1|0;h=a[g>>0]|0;if(h<<24>>24==1){j=7;break c}}e=f+-1|0}while(0);if((j|0)==7){j=0;g=g+1|0;e=f;g=g+(((d[g>>0]|d[g+1>>0]<<8)&65535)+2)+-1|0}i=(((e|0)==0)<<31>>31)+i|0;g=g+1|0;h=a[g>>0]|0;f=h<<24>>24==1;if((i|0)<=0)break a}l=n;return b|0}while(0);if(f)f=g;else{k=0;l=n;return k|0}}else if((e|0)==0&f<<24>>24==1)f=b;else{k=0;l=n;return k|0}j=f+1|0;j=d[j>>0]|d[j+1>>0]<<8;g=j&65535;if(!(j<<16>>16)){k=0;l=n;return k|0}h=_e(g)|0;if(!h){k=0;l=n;return k|0}cr(h|0,f+3|0,g|0)|0;if(!(af(b)|0))b=Hl(0)|0;else b=Il(0)|0;c[k>>2]=b;if(!b){cf(h);k=0;l=n;return k|0}else{ul(b,h,g<<3)|0;k=b;l=n;return k|0}}case 0:{i=1;break}default:i=f}if(!b){k=0;l=n;return k|0}f=a[b>>0]|0;if(f<<24>>24==3){b=b+1|0;g=a[b>>0]|0;f=g<<24>>24==1;e:do if((e|0)>0){h=0;f:while(1){g:do if(f){f=h;j=28}else{f=h;h:while(1){switch(g<<24>>24){case 0:{b=0;break f}case 4:break h;case 3:{f=f+1|0;break}default:{}}b=b+1|0;g=a[b>>0]|0;if(g<<24>>24==1){j=28;break g}}h=f+-1|0}while(0);if((j|0)==28){j=0;b=b+1|0;h=f;b=b+(((d[b>>0]|d[b+1>>0]<<8)&65535)+2)+-1|0}e=(((h|0)==0)<<31>>31)+e|0;b=b+1|0;g=a[b>>0]|0;f=g<<24>>24==1;if((e|0)<=0)break e}l=n;return b|0}while(0);if(!f){k=0;l=n;return k|0}}else if(!((e|0)==0&f<<24>>24==1)){k=0;l=n;return k|0}j=b+1|0;j=(Sk(k,i,b+3|0,(d[j>>0]|d[j+1>>0]<<8)&65535,0)|0)==0;k=j?c[k>>2]|0:0;l=n;return k|0}function Bf(b){b=b|0;var c=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(!b){l=0;return l|0}if((a[b>>0]|0)==3){c=1;i=0;f=-1}else{l=0;return l|0}a:while(1){b:while(1){c:while(1){e=b+1|0;switch(a[e>>0]|0){case 0:{k=0;l=19;break a}case 3:{l=8;break b}case 4:{l=10;break b}case 1:break c;default:b=e}}b=b+2|0;b=b+(((d[b>>0]|d[b+1>>0]<<8)&65535)+2)+-1|0;c=f+c|0;if((c|0)<=0){j=b;break a}}if((l|0)==8){l=0;g=c;h=i+1|0}else if((l|0)==10){l=0;h=i+-1|0;g=(((h|0)==0)<<31>>31)+c|0}if((g|0)>0){c=g;i=h;b=e;f=((h|0)==0)<<31>>31}else{j=e;break}}if((l|0)==19)return k|0;e=j+1|0;b=0;c=e;d:do{switch(a[c>>0]|0){case 0:{k=0;l=19;break d}case 1:{c=c+1|0;c=c+(((d[c>>0]|d[c+1>>0]<<8)&65535)+2)+-1|0;break}case 3:{b=b+1|0;break}case 4:{b=b+-1|0;break}default:{}}c=c+1|0}while((b|0)!=0);if((l|0)==19)return k|0;b=c-e&65535;c=_e(b+3|0)|0;if(!c){l=0;return l|0}l=c+1|0;a[c>>0]=3;cr(l|0,e|0,b|0)|0;k=l+b|0;a[k>>0]=4;a[k+1>>0]=0;if((a[l>>0]|0)!=4){l=c;return l|0}sf(c);l=0;return l|0}function Cf(a){a=a|0;var b=0;b=Bf(a)|0;a=wf(b,0)|0;sf(b);return a|0}function Df(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f;c[g>>2]=e;e=rf(a,b,d,Fo(d)|0,1,0,g)|0;l=f;return e|0}function Ef(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return rf(a,b,c,Fo(c)|0,1,0,d)|0}function Ff(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=qf(a,b,c,d,0,0,e)|0;l=e;return d|0}function Gf(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=l;l=l+48|0;if((l|0)>=(m|0))$(48);A=C+16|0;z=C+8|0;y=C;v=C+20|0;w=(e|0)==3;x=(f|0)!=0;B=(f|0)==0;u=(e|0)!=1;t=(e|0)==1;s=u^1;r=0;e=0;h=b|0?b:22624;a:while(1){b:while(1){switch(a[h>>0]|0){case 0:{b=79;break a}case 3:{b=4;break b}case 4:{b=13;break b}case 1:break;default:{b=78;break a}}b=h+1|0;b=d[b>>0]|d[b+1>>0]<<8;p=h+3|0;q=b&65535;if(w){o=b<<16>>16==0;c:do if(o){k=2;b=1}else{b=a[p>>0]|0;d:do if(b<<24>>24>=1){n=p;j=q;i=1;h=b;while(1){if((h&255)<32|(h+-127&255)<34?(No(22627,h&255,10)|0)==0:0)break d;if(i){if(!((h+-48&255)<10|((h&-33)+-65&255)<26)){k=(No(22637,h&255,9)|0)==0;i=k?0:i}}else i=0;k=n+1|0;h=j+-1|0;if(!h)break;n=k;j=h;h=a[k>>0]|0}if((b+-48&255)>9&(i|0)!=0){k=q;b=2;break c}else{j=2;h=q;k=p}while(1){e:do switch(b<<24>>24){case 92:case 39:case 34:case 13:case 12:case 10:case 11:case 9:case 8:{b=j+2|0;break}default:if((b&255)<32|(b+-127&255)<34){b=j+4|0;break e}else{b=j+1|0;break e}}while(0);h=h+-1|0;i=k+1|0;if(!h){k=b;b=1;break c}j=b;k=i;b=a[i>>0]|0}}while(0);k=(q<<1)+2|0;b=0}while(0);e=k+e|0;if(x){if(e>>>0>=g>>>0){e=0;b=87;break a}switch(b&3){case 1:{if(f|0){b=f+1|0;a[f>>0]=34;f:do if(!o){i=q;j=p;while(1){h=a[j>>0]|0;g:do switch(h<<24>>24){case 8:{a[b>>0]=92;a[b+1>>0]=98;b=b+2|0;break}case 9:{a[b>>0]=92;a[b+1>>0]=116;b=b+2|0;break}case 11:{a[b>>0]=92;a[b+1>>0]=118;b=b+2|0;break}case 10:{a[b>>0]=92;a[b+1>>0]=110;b=b+2|0;break}case 12:{a[b>>0]=92;a[b+1>>0]=102;b=b+2|0;break}case 13:{a[b>>0]=92;a[b+1>>0]=114;b=b+2|0;break}case 34:{a[b>>0]=92;a[b+1>>0]=34;b=b+2|0;break}case 39:{a[b>>0]=92;a[b+1>>0]=39;b=b+2|0;break}case 92:{a[b>>0]=92;a[b+1>>0]=92;b=b+2|0;break}default:if((h&255)<32|(h+-127&255)<34){c[y>>2]=h&255;Pp(b,22478,y)|0;b=b+4|0;break g}else{a[b>>0]=h;b=b+1|0;break g}}while(0);i=i+-1|0;if(!i)break f;else j=j+1|0}}while(0);a[b>>0]=34}break}case 2:{if(f|0)cr(f|0,p|0,q|0)|0;break}default:if(f|0){b=f+1|0;a[f>>0]=35;if(!o){i=q<<1;h=0;while(1){c[z>>2]=d[p+h>>0];Pp(b,22646,z)|0;h=h+1|0;if((h|0)==(q|0))break;else b=b+2|0}b=f+(i|1)|0}a[b>>0]=35}}f=f+k|0}if((a[p+q>>0]|0)!=4){e=e+1|0;if(x){if(e>>>0>=g>>>0){e=0;b=87;break a}a[f>>0]=32;f=f+1|0}}}else{c[A>>2]=q;Pp(v,22651,A)|0;e=q+e+(Fo(v)|0)|0;if(!B){if(e>>>0>=g>>>0){e=0;b=87;break a}f=Np(f,v)|0;cr(f|0,p|0,q|0)|0;f=f+q|0}}h=p+q|0}if((b|0)==4){h=h+1|0;if(u)e=r+e+((r|0)!=0&1)|0;e=e+1|0;if(!B){if(e>>>0>=g>>>0){e=0;b=87;break}if(!((r|0)==0|s)){b=f+1|0;a[f>>0]=10;if((r|0)>0){Yq(b|0,32,r|0)|0;f=b+r|0}else f=b}a[f>>0]=40;f=f+1|0}r=r+1|0;continue}else if((b|0)==13){h=h+1|0;b=e+1|0;if(x){if(b>>>0>=g>>>0){e=0;b=87;break}a[f>>0]=41;f=f+1|0}i=r+-1|0;if(t){r=i;e=b;continue}switch(a[h>>0]|0){case 0:case 3:{r=i;e=b;continue a}default:{}}e=e+2+i|0;if(!x){r=i;continue}if(e>>>0>=g>>>0){e=0;b=87;break}a[f>>0]=10;b=f+1|0;if((r|0)<=1){r=i;f=b;continue}Yq(b|0,32,i|0)|0;f=f+r|0;r=i;continue}}if((b|0)==78)He(22556,2008,22655);else if((b|0)==79){do if(t){if(B)b=86}else{e=e+1|0;if(!B)if(e>>>0>>0){a[f>>0]=10;f=f+1|0;break}else{g=0;l=C;return g|0}else b=86}while(0);if((b|0)==86){g=e+1|0;l=C;return g|0}if(e>>>0>=g>>>0){g=0;l=C;return g|0}a[f>>0]=0;g=e;l=C;return g|0}else if((b|0)==87){l=C;return e|0}return 0}function Hf(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=l;l=l+112|0;if((l|0)>=(m|0))$(112);u=y+80|0;w=y;x=y+84|0;h=x;i=h+20|0;do{a[h>>0]=0;h=h+1|0}while((h|0)<(i|0));j=a[f>>0]|0;do if(j<<24>>24){h=f;i=0;a:while(1){b:do switch(j<<24>>24){case 63:case 47:case 45:case 43:case 38:break;default:{switch(j<<24>>24|0){case 10:case 13:case 12:case 11:case 9:case 32:break b;default:{}}if(j<<24>>24==39){v=h+1|0;h=Ko(v,39)|0;if((h|0)==0|(h|0)==(v|0)){h=29;v=94;break a}}t=(c[g>>2]|0)+(4-1)&~(4-1);v=c[t>>2]|0;c[g>>2]=t+4;c[w+(i<<2)>>2]=v;if(!v){h=128;v=94;break a}i=i+1|0}}while(0);h=h+1|0;j=a[h>>0]|0;if(!(i>>>0<20&j<<24>>24!=0)){v=9;break}}if((v|0)==9){if(!(j<<24>>24))break;else h=183;l=y;return h|0}else if((v|0)==94){l=y;return h|0}}else i=0;while(0);s=(c[g>>2]|0)+(4-1)&~(4-1);t=c[s>>2]|0;c[g>>2]=s+4;if(t|0){x=45;l=y;return x|0}c:do if(!e){g=0;v=12}else{j=e;g=0;while(1){if(!(a[j>>0]|0)){v=12;break c}h=Ko(j,33)|0;if((h|0)==(j|0)){j=0;h=27;break c}h=(h|0)==0?0:h-j|0;e=uf(b,j,h)|0;if(!e){j=0;h=27;break c}sf(g);j=(h|0)==0?0:j+(h+1)|0;if(!j){b=e;g=e;v=12;break}else{b=e;g=e}}}while(0);d:do if((v|0)==12){t=43;i=0;e:while(1){h=a[f>>0]|0;f:do switch(h<<24>>24){case 0:break e;case 47:case 45:case 43:case 38:{j=h<<24>>24;h=f;break}default:{switch(h<<24>>24|0){case 10:case 13:case 12:case 11:case 9:case 32:{j=t;h=f;break f}default:{}}switch(h<<24>>24){case 63:{j=t;h=f;break f}case 39:{h=f+1|0;f=Ko(h,39)|0;if((f|0)==0|(f|0)==(h|0)){j=0;h=29;break d}j=uf(b,h,f-h|0)|0;break}default:j=uf(b,f,1)|0}do if(j){g:do switch(t|0){case 38:{h=c[w+(i<<2)>>2]|0;r=h+12|0;s=c[r>>2]|0;if(!s){c[h>>2]=0;if((a[j>>0]|0)!=3){v=58;break e}k=j+1|0;n=a[k>>0]|0;q=1;e=0;o=n<<24>>24==1;do{h:do if(o)v=49;else{i:while(1){switch(n<<24>>24){case 0:{v=58;break e}case 4:break i;case 3:{e=e+1|0;break}default:{}}k=k+1|0;n=a[k>>0]|0;if(n<<24>>24==1){v=49;break h}}e=e+-1|0;p=k}while(0);if((v|0)==49){v=0;p=k+1|0;p=p+(((d[p>>0]|d[p+1>>0]<<8)&65535)+2)+-1|0}q=(((e|0)==0)<<31>>31)+q|0;k=p+1|0;n=a[k>>0]|0;o=n<<24>>24==1}while((q|0)>0);if(!o){v=58;break e}s=p+2|0;s=d[s>>0]|d[s+1>>0]<<8;e=s&65535;if(!(s<<16>>16)){v=58;break e}k=_e(e)|0;if(!k){v=58;break e}cr(k|0,p+4|0,e|0)|0;c[h>>2]=e;c[r>>2]=k;c[h+8>>2]=e;c[h+4>>2]=0;a[x+i>>0]=2;break g}else{if((a[j>>0]|0)!=3){h=65;break d}k=j+1|0;n=a[k>>0]|0;q=1;e=0;o=n<<24>>24==1;do{j:do if(o)v=36;else{k:while(1){switch(n<<24>>24){case 0:{h=65;break d}case 4:break k;case 3:{e=e+1|0;break}default:{}}k=k+1|0;n=a[k>>0]|0;if(n<<24>>24==1){v=36;break j}}e=e+-1|0;p=k}while(0);if((v|0)==36){v=0;p=k+1|0;p=p+(((d[p>>0]|d[p+1>>0]<<8)&65535)+2)+-1|0}q=(((e|0)==0)<<31>>31)+q|0;k=p+1|0;n=a[k>>0]|0;o=n<<24>>24==1}while((q|0)>0);if(!o){h=65;break d}r=p+2|0;r=d[r>>0]|d[r+1>>0]<<8;e=r&65535;if(!(r<<16>>16)){h=65;break d}k=c[h+4>>2]|0;if((k+e|0)>>>0>(c[h>>2]|0)>>>0){h=200;break d}cr(s+k|0,p+4|0,e|0)|0;c[h+8>>2]=e;a[x+i>>0]=1;break g}}case 47:{s=Af(j,1,8)|0;h=c[w+(i<<2)>>2]|0;c[h>>2]=s;break}case 45:{l:do if((a[j>>0]|0)==3){e=j+1|0;o=a[e>>0]|0;p=1;h=0;n=o<<24>>24==1;do{m:do if(n)v=64;else{k=o;n:while(1){switch(k<<24>>24){case 0:{h=0;break l}case 4:break n;case 3:{h=h+1|0;break}default:{}}e=e+1|0;k=a[e>>0]|0;if(k<<24>>24==1){v=64;break m}}h=h+-1|0;k=e}while(0);if((v|0)==64){v=0;k=e+1|0;k=k+(((d[k>>0]|d[k+1>>0]<<8)&65535)+2)+-1|0}p=(((h|0)==0)<<31>>31)+p|0;e=k+1|0;o=a[e>>0]|0;n=o<<24>>24==1}while((p|0)>0);if(n){h=k+2|0;h=(Sk(u,1,k+4|0,(d[h>>0]|d[h+1>>0]<<8)&65535,0)|0)==0;h=h?c[u>>2]|0:0}else h=0}else h=0;while(0);s=c[w+(i<<2)>>2]|0;c[s>>2]=h;h=s;break}default:{o:do if((a[j>>0]|0)==3){e=j+1|0;o=a[e>>0]|0;p=1;h=0;n=o<<24>>24==1;do{p:do if(n)v=76;else{k=o;q:while(1){switch(k<<24>>24){case 0:{h=0;break o}case 4:break q;case 3:{h=h+1|0;break}default:{}}e=e+1|0;k=a[e>>0]|0;if(k<<24>>24==1){v=76;break p}}h=h+-1|0;k=e}while(0);if((v|0)==76){v=0;k=e+1|0;k=k+(((d[k>>0]|d[k+1>>0]<<8)&65535)+2)+-1|0}p=(((h|0)==0)<<31>>31)+p|0;e=k+1|0;o=a[e>>0]|0;n=o<<24>>24==1}while((p|0)>0);if(n){h=k+2|0;h=(Sk(u,5,k+4|0,(d[h>>0]|d[h+1>>0]<<8)&65535,0)|0)==0;h=h?c[u>>2]|0:0}else h=0}else h=0;while(0);s=c[w+(i<<2)>>2]|0;c[s>>2]=h;h=s}}while(0);sf(j);if(!(c[h>>2]|0)){j=0;h=65;break d}}else{if((a[f+1>>0]|0)!=63){j=0;h=68;break d}h=w+(i<<2)|0;if((t|0)!=38){c[c[h>>2]>>2]=0;break}h=c[h>>2]|0;if(!(c[h+12>>2]|0)){c[h>>2]=0;c[h+4>>2]=0}c[h+8>>2]=0}while(0);j=t;i=i+1|0;h=f}}while(0);t=j;f=h+1|0}if((v|0)==58){c[r>>2]=0;h=65;break}sf(g);x=0;l=y;return x|0}while(0);sf(g);sf(j);if(!i){x=h;l=y;return x|0}do{i=i+-1|0;j=w+(i<<2)|0;if(!(a[x+i>>0]|0)){v=c[j>>2]|0;Jl(c[v>>2]|0);c[v>>2]=0}else{v=c[j>>2]|0;cf(c[v+12>>2]|0);c[v>>2]=0;c[v+4>>2]=0;c[v+8>>2]=0;c[v+12>>2]=0}}while((i|0)!=0);l=y;return h|0}function If(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f;c[g>>2]=e;e=Hf(a,b,d,g)|0;l=f;return ((e|0)==0?0:e&65535|16777216)|0}function Jf(a){a=a|0;if(Go(22673,a)|0)if(Go(22685,a)|0)if(Go(22697,a)|0)if(Go(22709,a)|0)if(Go(22722,a)|0)if(Go(22732,a)|0)if(Go(22743,a)|0)if(Go(22755,a)|0)if(Go(22768,a)|0)if(Go(22780,a)|0)if(Go(22793,a)|0)if(Go(22803,a)|0)if(!(Go(22814,a)|0))a=12;else{a=88;return a|0}else a=11;else a=10;else a=9;else a=8;else a=7;else a=6;else a=5;else a=4;else a=3;else a=2;else a=1;else a=0;c[17593]=c[17593]|c[1164+(a<<3)>>2];a=0;return a|0}function Kf(){return 0}function Lf(a,b){a=a|0;b=b|0;if((a|0)<0|a>>>0>12){b=0;return b|0}if(b|0)c[b>>2]=c[1164+(a<<3)>>2];b=c[1164+(a<<3)+4>>2]|0;return b|0}function Mf(){var b=0,d=0,e=0,f=0,g=0,h=0;h=l;l=l+256|0;if((l|0)>=(m|0))$(256);f=h;if(gg()|0){l=h;return}g=aq(22823,23390)|0;if(g|0){if(Sp(f,256,g)|0)do{b=a[f>>0]|0;e=b<<24>>24;a:do if(!(e&128)){d=f;do{if(!(Lo(e)|0))break a;d=d+1|0;b=a[d>>0]|0;e=b<<24>>24}while(!(e&128|0))}else d=f;while(0);e=Ko(d,10)|0;if(e){a[e>>0]=0;b=a[d>>0]|0}b:do if(b<<24>>24){e=(Fo(d)|0)+-1|0;if((e|0)>0){b=d+e|0;do{e=a[b>>0]|0;if((e&128|0)==0?Lo(e)|0:0)a[b>>0]=0;b=b+-1|0}while(b>>>0>d>>>0);b=a[d>>0]|0}switch(b<<24>>24){case 35:case 0:break b;default:{}}do if(Go(22673,d)|0)if(Go(22685,d)|0)if(Go(22697,d)|0)if(Go(22709,d)|0)if(Go(22722,d)|0)if(Go(22732,d)|0)if(Go(22743,d)|0)if(Go(22755,d)|0){if(!(Go(22768,d)|0)){b=8;break}if(!(Go(22780,d)|0)){b=9;break}if(!(Go(22793,d)|0)){b=10;break}if(!(Go(22803,d)|0)){b=11;break}if(!(Go(22814,d)|0))b=12;else break b}else b=7;else b=6;else b=5;else b=4;else b=3;else b=2;else b=1;else b=0;while(0);c[17593]=c[17593]|c[1164+(b<<3)>>2]}while(0)}while((Sp(f,256,g)|0)!=0);kq(g)|0;bq(g)|0}l=h;return}function Nf(){c[17594]=1;return}function Of(b){b=b|0;var d=0;if(!b){Tn(22);d=0;return d|0}if(!(c[17594]|0)){d=Oq(b)|0;return d|0}d=Oq(b+5|0)|0;if(!d){d=0;return d|0}a[d>>0]=b;a[d+1>>0]=b>>>8;a[d+2>>0]=b>>>16;a[d+3>>0]=85;a[d+(b+4)>>0]=-86;d=d+4|0;return d|0} +function rm(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;t=c[b+12>>2]|0;s=c[t+36>>2]|0;t=c[t+20>>2]|0;if(e>>>0>>0){u=200;return u|0}u=b+112|0;e=c[u>>2]|0;if(e>>>0>=g>>>0){h=b+64+t+(0-e)|0;if(!((f|d|h)&3))if(g>>>0>3){l=g+-4|0;m=l&-4;o=m+4|0;n=f+o|0;i=h;j=d;k=g;while(1){c[j>>2]=c[f>>2]^c[i>>2];k=k+-4|0;if(k>>>0<=3)break;else{f=f+4|0;i=i+4|0;j=j+4|0}}i=l-m|0;f=n;h=h+o|0;d=d+o|0}else i=g;else i=g;if(i){e=i;while(1){a[d>>0]=a[f>>0]^a[h>>0];e=e+-1|0;if(!e)break;else{f=f+1|0;h=h+1|0;d=d+1|0}}e=c[u>>2]|0}c[u>>2]=e-g;u=0;return u|0}if(e){g=g-e|0;i=b+64+t+(0-e)|0;if(e>>>0>3&((f|d|i)&3|0)==0){n=e+-4|0;o=n&-4;p=o+4|0;j=f+p|0;h=f;k=i;l=d;m=e;while(1){c[l>>2]=c[h>>2]^c[k>>2];m=m+-4|0;if(m>>>0<=3)break;else{h=h+4|0;k=k+4|0;l=l+4|0}}k=n-o|0;if(k){i=i+p|0;h=d+p|0;e=k;q=18}}else{j=f;h=d;q=18}if((q|0)==18){while(1){a[h>>0]=a[j>>0]^a[i>>0];e=e+-1|0;if(!e)break;else{j=j+1|0;i=i+1|0;h=h+1|0;q=18}}e=c[u>>2]|0}c[u>>2]=0;d=d+e|0;f=f+e|0}a:do if(g>>>0>>0)e=0;else{q=b+496|0;r=b+64|0;m=r;l=t+-4|0;o=l&-4;n=o+4|0;p=r+n|0;o=l-o|0;if(t>>>0>3)e=0;else{l=(t|0)==0;e=0;while(1){p=pb[s&63](q,r,r)|0;e=p>>>0>e>>>0?p:e;if(!l){h=f;i=r;j=d;k=t;while(1){a[j>>0]=a[h>>0]^a[i>>0];k=k+-1|0;if(!k)break;else{h=h+1|0;i=i+1|0;j=j+1|0}}}d=d+t|0;f=f+t|0;g=g-t|0;if(g>>>0>>0)break a}}do{l=pb[s&63](q,r,r)|0;e=l>>>0>e>>>0?l:e;if(!((f|m|d)&3)){h=f+n|0;i=f;j=r;k=d;l=t;while(1){c[k>>2]=c[i>>2]^c[j>>2];l=l+-4|0;if(l>>>0<=3)break;else{i=i+4|0;j=j+4|0;k=k+4|0}}j=p;k=d+n|0;i=o}else{h=f;j=r;k=d;i=t}if(i|0)while(1){a[k>>0]=a[h>>0]^a[j>>0];i=i+-1|0;if(!i)break;else{h=h+1|0;j=j+1|0;k=k+1|0}}d=d+t|0;f=f+t|0;g=g-t|0}while(g>>>0>=t>>>0)}while(0);do if(g){h=b+64|0;s=pb[s&63](b+496|0,h,h)|0;e=s>>>0>e>>>0?s:e;c[u>>2]=t-g;if(((f|h|d)&3|0)==0&g>>>0>3){k=g+-4|0;l=k&-4;n=l+4|0;m=f+n|0;i=h;j=d;while(1){c[j>>2]=c[f>>2]^c[i>>2];g=g+-4|0;if(g>>>0<=3)break;else{f=f+4|0;i=i+4|0;j=j+4|0}}g=k-l|0;if(!g)break;else{f=m;h=h+n|0;d=d+n|0}}while(1){a[d>>0]=a[f>>0]^a[h>>0];g=g+-1|0;if(!g)break;else{f=f+1|0;h=h+1|0;d=d+1|0}}}while(0);if(!e){u=0;return u|0}Te(e+16|0);u=0;return u|0}function sm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;p=l;l=l+64|0;if((l|0)>=(m|0))$(64);g=p;if((d|0)==0&(e|0)!=12){o=45;l=p;return o|0}f=b+128|0;i=b+148|0;j=i;k=j+92|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(k|0));c[f>>2]=0;c[f+4>>2]=0;c[b+136>>2]=0;c[b+140>>2]=0;o=b+144|0;a[o>>0]=a[o>>0]&-4;o=b+56|0;a[o>>0]=a[o>>0]&-7;h=b+12|0;f=b+496|0;ub[c[(c[h>>2]|0)+60>>2]&7](f,d,e);j=g;k=j+64|0;do{a[j>>0]=0;j=j+1|0}while((j|0)<(k|0));zb[c[(c[h>>2]|0)+44>>2]&1](f,g,g,64);i=Lm(i,g,32)|0;if(g&7){f=64;do{a[g>>0]=0;g=g+1|0;f=f+-1|0}while((f|0)!=0&(g&7|0)!=0);if(f>>>0>=8)n=5}else{f=64;n=5}if((n|0)==5){h=f+-8|0;d=h&-8;e=d+8|0;b=g;while(1){n=b;c[n>>2]=0;c[n+4>>2]=0;f=f+-8|0;if(f>>>0<=7)break;else b=b+8|0}f=h-d|0;g=g+e|0}if(f|0)while(1){a[g>>0]=0;f=f+-1|0;if(!f)break;else g=g+1|0}if(i|0){o=i;l=p;return o|0}a[o>>0]=a[o>>0]|2;o=0;l=p;return o|0}function tm(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0;k=l;l=l+16|0;if((l|0)>=(m|0))$(16);i=k;if(e>>>0>>0){g=200;l=k;return g|0}h=a[b+56>>0]|0;if(h&4){g=156;l=k;return g|0}j=b+144|0;e=a[j>>0]|0;if(e&2){g=139;l=k;return g|0}do if(!(h&2)){e=i;c[e>>2]=0;c[e+4>>2]=0;e=sm(b,i,8)|0;if(!e){e=a[j>>0]|0;break}else{g=e;l=k;return g|0}}while(0);if(!(e&1)){h=c[b+128>>2]&15;if(h){Km(b+148|0,71811,16-h|0);e=a[j>>0]|0}e=e|1;a[j>>0]=e;h=b+136|0;c[h>>2]=0;c[b+140>>2]=0;i=0}else{i=b+136|0;h=i;i=c[i>>2]|0}i=i+g|0;c[h>>2]=i;if(i>>>0>>0?(h=b+140|0,i=(c[h>>2]|0)+1|0,c[h>>2]=i,(i|0)==0):0){a[j>>0]=e|2;g=139;l=k;return g|0}zb[c[(c[b+12>>2]|0)+44>>2]&1](b+496|0,d,f,g);Km(b+148|0,d,g);g=0;l=k;return g|0}function um(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0;k=l;l=l+16|0;if((l|0)>=(m|0))$(16);i=k;if(e>>>0>>0){g=200;l=k;return g|0}h=a[b+56>>0]|0;if(h&4){g=156;l=k;return g|0}j=b+144|0;e=a[j>>0]|0;if(e&2){g=139;l=k;return g|0}do if(!(h&2)){e=i;c[e>>2]=0;c[e+4>>2]=0;e=sm(b,i,8)|0;if(!e){e=a[j>>0]|0;break}else{g=e;l=k;return g|0}}while(0);if(!(e&1)){h=c[b+128>>2]&15;if(h){Km(b+148|0,71811,16-h|0);e=a[j>>0]|0}e=e|1;a[j>>0]=e;h=b+136|0;c[h>>2]=0;c[b+140>>2]=0;i=0}else{i=b+136|0;h=i;i=c[i>>2]|0}i=i+g|0;c[h>>2]=i;if(i>>>0>>0?(h=b+140|0,i=(c[h>>2]|0)+1|0,c[h>>2]=i,(i|0)==0):0){a[j>>0]=e|2;g=139;l=k;return g|0}Km(b+148|0,f,g);zb[c[(c[b+12>>2]|0)+48>>2]&1](b+496|0,d,f,g);g=0;l=k;return g|0}function vm(b){b=b|0;var d=0;d=b+128|0;c[d>>2]=0;c[d+4>>2]=0;c[b+136>>2]=0;c[b+140>>2]=0;d=b+144|0;a[d>>0]=a[d>>0]&-4;b=b+56|0;a[b>>0]=a[b>>0]&-7;return}function wm(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;b=i+15&-16;w=S(h,g)|0;x=df(1,(h<<1)+16+(w*3|0)+b|0)|0;if(!x){h=46734;return h|0}y=x+(0-x&15)|0;r=y+b|0;s=r+h|0;t=s+h|0;u=t+w|0;v=u+w|0;if(pb[d&63](y,16,16)|0){cf(x);h=46720;return h|0}Yq(r|0,78,h|0)|0;Yq(s|0,78,h|0)|0;if((h|0)>0){b=0;do{a[t+b>>0]=b;b=b+1|0}while((b|0)!=(h|0))}q=r;if(!((t|q|v)&3))if(h>>>0>3){l=h+-4|0;m=l&-4;n=m+4|0;i=t+n|0;b=t;d=r;j=v;k=h;while(1){c[j>>2]=c[b>>2]^c[d>>2];k=k+-4|0;if(k>>>0<=3)break;else{b=b+4|0;d=d+4|0;j=j+4|0}}b=l-m|0;j=r+n|0;d=v+n|0}else{b=h;i=t;j=r;d=v}else{i=t;j=r;d=v;b=h}if(b|0)while(1){a[d>>0]=a[i>>0]^a[j>>0];b=b+-1|0;if(!b)break;else{i=i+1|0;j=j+1|0;d=d+1|0}}pb[e&63](y,v,v)|0;cr(r|0,v|0,h|0)|0;qb[f&15](y,s,u,v,1);if(Tp(u,t,h)|0){cf(x);h=46671;return h|0}if(Tp(s,r,h)|0){cf(x);h=46671;return h|0}Yq(r|0,95,h|0)|0;Yq(s|0,95,h|0)|0;i=(w|0)>0;a:do if(i){b=0;do{a[t+b>>0]=b;b=b+1|0}while((b|0)!=(w|0));if(i){o=h+-4|0;n=o&-4;m=n+4|0;p=r+m|0;n=o-n|0;if(h>>>0>3)l=0;else{m=(h|0)==0;k=0;while(1){l=v+k|0;if(!m){b=t+k|0;i=r;d=l;j=h;while(1){a[d>>0]=a[b>>0]^a[i>>0];j=j+-1|0;if(!j)break;else{b=b+1|0;i=i+1|0;d=d+1|0}}}pb[e&63](y,l,l)|0;cr(r|0,l|0,h|0)|0;k=k+h|0;if((k|0)>=(w|0))break a}}do{o=v+l|0;b=t+l|0;if(!((o|q|b)&3)){k=b+m|0;i=r;d=o;j=h;while(1){c[d>>2]=c[b>>2]^c[i>>2];j=j+-4|0;if(j>>>0<=3)break;else{b=b+4|0;i=i+4|0;d=d+4|0}}b=k;d=p;j=o+m|0;i=n}else{d=r;j=o;i=h}if(i|0)while(1){a[j>>0]=a[b>>0]^a[d>>0];i=i+-1|0;if(!i)break;else{b=b+1|0;d=d+1|0;j=j+1|0}}pb[e&63](y,o,o)|0;cr(r|0,o|0,h|0)|0;l=l+h|0}while((l|0)<(w|0))}}while(0);qb[f&15](y,s,u,v,g);if(!(Tp(u,t,w)|0)){h=(Tp(s,r,h)|0)==0;cf(x);h=h?0:46671;return h|0}else{cf(x);h=46671;return h|0}return 0}function xm(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;b=i+15&-16;w=S(h,g)|0;x=df(1,(h<<1)+16+(w*3|0)+b|0)|0;if(!x){h=46734;return h|0}y=x+(0-x&15)|0;r=y+b|0;s=r+h|0;t=s+h|0;u=t+w|0;v=u+w|0;if(pb[d&63](y,32,16)|0){cf(x);h=46720;return h|0}Yq(r|0,-45,h|0)|0;Yq(s|0,-45,h|0)|0;if((h|0)>0){b=0;do{a[t+b>>0]=b;b=b+1|0}while((b|0)!=(h|0))}pb[e&63](y,v,r)|0;q=r;if(!((t|q|v)&3))if(h>>>0>3){l=h+-4|0;m=l&-4;n=m+4|0;j=v+n|0;b=t;i=v;d=r;k=h;while(1){p=c[i>>2]^c[b>>2];c[i>>2]=p;c[d>>2]=p;k=k+-4|0;if(k>>>0<=3)break;else{b=b+4|0;i=i+4|0;d=d+4|0}}b=l-m|0;d=t+n|0;i=r+n|0}else{b=h;d=t;j=v;i=r}else{d=t;j=v;i=r;b=h}if(b|0)while(1){p=a[j>>0]^a[d>>0];a[j>>0]=p;a[i>>0]=p;b=b+-1|0;if(!b)break;else{d=d+1|0;j=j+1|0;i=i+1|0}}qb[f&15](y,s,u,v,1);if(Tp(u,t,h)|0){cf(x);h=46760;return h|0}if(Tp(s,r,h)|0){cf(x);h=46760;return h|0}Yq(r|0,-26,h|0)|0;Yq(s|0,-26,h|0)|0;i=(w|0)>0;a:do if(i){b=0;do{a[t+b>>0]=b;b=b+1|0}while((b|0)!=(w|0));if(i){m=h+-4|0;o=m&-4;n=o+4|0;p=r+n|0;o=m-o|0;if(h>>>0>3)m=0;else{l=(h|0)==0;k=0;while(1){b=v+k|0;pb[e&63](y,b,r)|0;if(!l){j=t+k|0;i=r;d=h;while(1){q=a[b>>0]^a[j>>0];a[b>>0]=q;a[i>>0]=q;d=d+-1|0;if(!d)break;else{j=j+1|0;b=b+1|0;i=i+1|0}}}k=k+h|0;if((k|0)>=(w|0))break a}}do{d=v+m|0;pb[e&63](y,d,r)|0;b=t+m|0;if(!((d|q|b)&3)){l=b+n|0;i=d;j=r;k=h;while(1){z=c[i>>2]^c[b>>2];c[i>>2]=z;c[j>>2]=z;k=k+-4|0;if(k>>>0<=3)break;else{b=b+4|0;i=i+4|0;j=j+4|0}}b=l;d=d+n|0;j=p;i=o}else{j=r;i=h}if(i|0)while(1){z=a[d>>0]^a[b>>0];a[d>>0]=z;a[j>>0]=z;i=i+-1|0;if(!i)break;else{b=b+1|0;d=d+1|0;j=j+1|0}}m=m+h|0}while((m|0)<(w|0))}}while(0);qb[f&15](y,s,u,v,g);if(!(Tp(u,t,w)|0)){z=(Tp(s,r,h)|0)==0;cf(x);z=z?0:46760;return z|0}else{cf(x);z=46760;return z|0}return 0}function ym(b,c,e,f,g,h,i){b=b|0;c=c|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;b=i+15&-16;w=S(h,g)|0;y=df(1,(h<<1)+16+(w<<2)+b|0)|0;if(!y){h=46734;return h|0}x=y+(0-y&15)|0;r=x+b|0;s=r+h|0;t=s+h|0;u=t+w|0;v=u+w|0;j=v+w|0;if(pb[c&63](x,48,16)|0){cf(y);h=46720;return h|0}Yq(r|0,-1,h|0)|0;q=(h|0)>0;if(q){b=0;do{a[t+b>>0]=b;b=b+1|0}while((b|0)!=(h|0));pb[e&63](x,v,r)|0;if(q){b=0;do{p=v+b|0;a[p>>0]=a[p>>0]^a[t+b>>0];b=b+1|0}while((b|0)!=(h|0));b=h}else b=h}else{pb[e&63](x,v,r)|0;b=h}do{if((b|0)<=0)break;b=b+-1|0;o=r+b|0;p=(a[o>>0]|0)+1<<24>>24;a[o>>0]=p}while(!(p<<24>>24));Yq(s|0,-1,h|0)|0;qb[f&15](x,s,u,v,1);if(Tp(u,t,h)|0){cf(y);h=46809;return h|0}if(Tp(s,r,h)|0){cf(y);h=46809;return h|0}p=h+-4|0;Yq(r|0,87,p|0)|0;o=h+-1|0;n=r+o|0;a[n>>0]=1;l=h+-2|0;a[r+l>>0]=0;m=h+-3|0;a[r+m>>0]=0;a[r+p>>0]=0;Yq(s|0,87,p|0)|0;o=s+o|0;a[o>>0]=1;a[s+l>>0]=0;a[s+m>>0]=0;a[s+p>>0]=0;p=(w|0)>0;a:do if(p){b=0;do{m=b&255;a[t+b>>0]=m;a[u+b>>0]=m;b=b+1|0}while((b|0)!=(w|0));if(p){if(q)i=0;else{i=0;while(1){pb[e&63](x,v+i|0,r)|0;b=h;do{if((b|0)<=0)break;b=b+-1|0;l=r+b|0;m=(a[l>>0]|0)+1<<24>>24;a[l>>0]=m}while(!(m<<24>>24));i=i+h|0;if((i|0)>=(w|0))break a}}do{pb[e&63](x,v+i|0,r)|0;b=0;do{l=b+i|0;m=v+l|0;a[m>>0]=a[m>>0]^a[t+l>>0];b=b+1|0}while((b|0)!=(h|0));b=h;do{if((b|0)<=0)break;b=b+-1|0;l=r+b|0;m=(a[l>>0]|0)+1<<24>>24;a[l>>0]=m}while(!(m<<24>>24));i=i+h|0}while((i|0)<(w|0))}}while(0);qb[f&15](x,s,j,u,g);if(Tp(j,v,w)|0){cf(y);h=46809;return h|0}if(Tp(s,r,h)|0){cf(y);h=46809;return h|0}b:do if((g|0)>0){j=r+1|0;k=r+2|0;l=s+1|0;m=s+2|0;c=0;while(1){Yq(r|0,-1,h|0)|0;a[n>>0]=(d[n>>0]|0)-c;a[j>>0]=0;a[r>>0]=0;a[k>>0]=7;c:do if(p){b=0;do{a[t+b>>0]=b;b=b+1|0}while((b|0)!=(w|0));if(p){if(q)i=0;else{i=0;while(1){pb[e&63](x,v+i|0,r)|0;b=h;do{if((b|0)<=0)break;b=b+-1|0;A=r+b|0;z=(a[A>>0]|0)+1<<24>>24;a[A>>0]=z}while(!(z<<24>>24));i=i+h|0;if((i|0)>=(w|0))break c}}do{pb[e&63](x,v+i|0,r)|0;b=0;do{z=b+i|0;A=v+z|0;a[A>>0]=a[A>>0]^a[t+z>>0];b=b+1|0}while((b|0)!=(h|0));b=h;do{if((b|0)<=0)break;b=b+-1|0;z=r+b|0;A=(a[z>>0]|0)+1<<24>>24;a[z>>0]=A}while(!(A<<24>>24));i=i+h|0}while((i|0)<(w|0))}}while(0);Yq(s|0,-1,h|0)|0;a[o>>0]=(d[o>>0]|0)-c;a[l>>0]=0;a[s>>0]=0;a[m>>0]=7;qb[f&15](x,s,u,v,g);if(Tp(u,t,w)|0){b=49;break}c=c+1|0;if(Tp(s,r,h)|0){b=51;break}if((c|0)>=(g|0))break b}if((b|0)==49){cf(y);A=46809;return A|0}else if((b|0)==51){cf(y);A=46809;return A|0}}while(0);cf(y);A=0;return A|0}function zm(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0;ba=l;l=l+544|0;if((l|0)>=(m|0))$(544);L=ba+496|0;X=ba+248|0;V=ba+216|0;U=ba+136|0;R=ba+128|0;Q=ba+120|0;N=ba+112|0;J=ba+104|0;E=ba+96|0;D=ba+88|0;C=ba+80|0;z=ba+72|0;H=ba+64|0;G=ba+56|0;F=ba+48|0;A=ba+40|0;w=ba+32|0;x=ba+24|0;v=ba+16|0;j=ba+8|0;i=ba;M=ba+440|0;I=ba+428|0;B=ba+384|0;y=ba+372|0;o=ba+368|0;Z=ba+324|0;_=ba+264|0;aa=ba+260|0;Y=ba+256|0;W=ba+252|0;c[aa>>2]=0;c[Y>>2]=0;c[W>>2]=0;r=Z;s=r+44|0;do{c[r>>2]=0;r=r+4|0}while((r|0)<(s|0));r=_;s=r+60|0;do{c[r>>2]=0;r=r+4|0}while((r|0)<(s|0));f=Fh(b,o)|0;if(f|0){aa=f;l=ba;return aa|0}f=uf(b,46925,0)|0;if(f){g=zf(f,1)|0;sf(f);if(!g){aa=65;l=ba;return aa|0}}else g=0;f=uf(b,46885,0)|0;if((f|0)!=0?(h=Eh(f,W,0)|0,sf(f),(h|0)!=0):0){o=0;n=0;k=0;j=0;i=0;b=0;g=0;f=0}else S=6;do if((S|0)==6){f=uf(b,48632,0)|0;if(f|0){c[W>>2]=c[W>>2]|32;sf(f)}f=c[o>>2]|0;if(!((g|0)!=0|(f|0)!=0)){aa=68;l=ba;return aa|0}h=Eg(f,g,Z,o)|0;cf(g);if(!h){if(!(nf(1)|0)){i=Z+4|0;n=Z+8|0;g=Z+12|0;h=Z+16|0}else{u=Wg(c[Z>>2]|0)|0;g=Z+4|0;f=Xg(c[g>>2]|0)|0;c[i>>2]=u;c[i+4>>2]=f;Oe(48646,i);f=c[Z+40>>2]|0;if(f|0){c[j>>2]=f;Oe(48671,j)}n=Z+8|0;Se(48693,c[n>>2]|0);u=Z+12|0;Se(48709,c[u>>2]|0);h=Z+16|0;Se(48725,c[h>>2]|0);Se(48741,c[Z+32>>2]|0);Se(48757,c[Z+36>>2]|0);Mj(48773,Z+20|0,0);i=g;g=u}k=Uj(c[Z>>2]|0,c[i>>2]|0,0,c[n>>2]|0,c[g>>2]|0,c[h>>2]|0)|0;q=c[W>>2]|0;if(!(q&4096)){p=c[o>>2]|0;b=lk(c[n>>2]|0)|0;Pj(y);f=2-(q>>>5&1)|0;if((c[k+4>>2]|0)==1){t=_+56|0;c[t>>2]=Il(256)|0;u=Cj(32,f)|0;a[u>>0]=(d[u>>0]|0)&63|64;o=u+31|0;a[o>>0]=(d[o>>0]|0)&248;Rk(c[t>>2]|0,u,32,0);cf(u);u=t;o=Z+32|0;f=c[t>>2]|0}else{o=Z+32|0;f=Gn(c[o>>2]|0,f)|0;u=_+56|0;c[u>>2]=f}j=Z+20|0;ck(y,f,j,k);c[_>>2]=c[Z>>2];t=_+4|0;c[t>>2]=c[i>>2];c[_+8>>2]=yl(c[n>>2]|0)|0;c[_+12>>2]=yl(c[g>>2]|0)|0;c[_+16>>2]=yl(c[h>>2]|0)|0;h=_+20|0;Pj(h);Al(c[h>>2]|0,c[j>>2]|0)|0;Al(c[_+24>>2]|0,c[Z+24>>2]|0)|0;Al(c[_+28>>2]|0,c[Z+28>>2]|0)|0;c[_+32>>2]=yl(c[o>>2]|0)|0;c[_+36>>2]=yl(c[Z+36>>2]|0)|0;j=_+44|0;Pj(j);f=Hl(b)|0;g=Hl(b)|0;if(Nj(f,g,y,k)|0){c[v>>2]=48835;Me(48787,v)}do if((c[i>>2]|0)!=1){i=Hl(b)|0;b=c[n>>2]|0;if(!(c[Z>>2]|0))hk(i,b,g);else hk(i,b,f);if((wk(i,g)|0)>=0){tl(i);Al(c[j>>2]|0,c[y>>2]|0)|0;Al(c[_+48>>2]|0,c[y+4>>2]|0)|0;Al(c[_+52>>2]|0,c[y+8>>2]|0)|0;if(!(nf(1)|0))break;Oe(48877,w);break}if(!(c[Z>>2]|0)){tl(g);g=i}else{tl(f);f=i}w=c[u>>2]|0;hk(w,c[o>>2]|0,w);Sj(j,f,g,Ml(1)|0)|0;if(nf(1)|0)Oe(48837,x)}else{Al(c[j>>2]|0,c[y>>2]|0)|0;Al(c[_+48>>2]|0,c[y+4>>2]|0)|0;Al(c[_+52>>2]|0,c[y+8>>2]|0)|0}while(0);Rj(y);do if(!(q&16384)){q=p+-64|0;if((c[_>>2]|0)!=1){i=Hl(q)|0;j=Hl(q)|0;n=Hl(q)|0;o=Hl(q)|0;p=Hl(q)|0;if(nf(1)|0)Oe(48930,A);Pj(I);r=L;b=_;s=r+44|0;do{c[r>>2]=c[b>>2];r=r+4|0;b=b+4|0}while((r|0)<(s|0));Vg(B,L);r=M;b=B;s=r+44|0;do{c[r>>2]=c[b>>2];r=r+4|0;b=b+4|0}while((r|0)<(s|0));b=M+44|0;Pj(b);Al(c[b>>2]|0,c[_+44>>2]|0)|0;Al(c[M+48>>2]|0,c[_+48>>2]|0)|0;Al(c[M+52>>2]|0,c[_+52>>2]|0)|0;Kl(i,q,0);if(Kn(i,_,o,p,0,0)|0)Me(48944,F);if(Ln(i,M,o,p)|0)Me(48974,G);if(nf(1)|0)Oe(49012,H);Rj(b);Ug(M);Rj(I);tl(p);tl(o);tl(n);tl(j);tl(i);break}if(nf(1)|0)Oe(48930,z);Pj(I);r=L;b=_;s=r+44|0;do{c[r>>2]=c[b>>2];r=r+4|0;b=b+4|0}while((r|0)<(s|0));Vg(B,L);r=M;b=B;s=r+44|0;do{c[r>>2]=c[b>>2];r=r+4|0;b=b+4|0}while((r|0)<(s|0));o=M+44|0;Pj(o);Al(c[o>>2]|0,c[_+44>>2]|0)|0;Al(c[M+48>>2]|0,c[_+48>>2]|0)|0;Al(c[M+52>>2]|0,c[_+52>>2]|0)|0;if((c[t>>2]|0)==1){b=Hl(256)|0;H=Aj(32,0)|0;a[H>>0]=(d[H>>0]|0)&63|64;G=H+31|0;a[G>>0]=(d[G>>0]|0)&248;Rk(b,H,32,0);cf(H)}else{b=Hl(q)|0;Kl(b,q,0)}i=Uj(c[M>>2]|0,c[M+4>>2]|0,0,c[M+8>>2]|0,c[M+12>>2]|0,c[M+16>>2]|0)|0;j=Hl(0)|0;n=Hl(0)|0;ck(I,b,o,i);if((c[t>>2]|0)!=1)ck(I,c[i+36>>2]|0,I,i);if(Nj(j,0,I,i)|0)Me(49047,C);ck(I,b,M+20|0,i);ck(I,c[u>>2]|0,I,i);if((c[t>>2]|0)!=1)ck(I,c[i+36>>2]|0,I,i);if(Nj(n,0,I,i)|0)Me(49095,D);if(!(wk(j,n)|0)){tl(j);tl(n);Yj(i);Rj(o);Ug(M);Rj(I);tl(b);break}else Me(49144,E)}while(0)}else{h=Rg(_,Z,k,q)|0;if(h|0){o=0;n=0;j=0;i=0;b=0;g=0;f=0;break}g=0;f=0;h=_+20|0}s=Hl(0)|0;r=Hl(0)|0;if(Nj(s,r,h,k)|0){c[J>>2]=49163;Me(48787,J)}q=_+8|0;n=Yg(s,r,c[q>>2]|0)|0;do if((c[_+4>>2]|0)==1?(K=c[W>>2]|0,(K&2048|0)==0):0){h=Mg(_+44|0,k,s,r,K>>>10&1,L,M)|0;if(!h){b=Hl(0)|0;ul(b,c[L>>2]|0,c[M>>2]<<3)|0;break}aa=h;l=ba;return aa|0}else S=71;while(0);if((S|0)==71){if(!f){f=Hl(0)|0;g=Hl(0)|0;if(!(Nj(f,g,_+44|0,k)|0)){O=g;P=f}else{c[N>>2]=48835;Me(48787,N)}}else{O=g;P=f}b=Yg(P,O,c[q>>2]|0)|0;g=O;f=P}p=_+56|0;o=c[p>>2]|0;c[p>>2]=0;p=Z+40|0;h=c[p>>2]|0;if(h|0?(c[Q>>2]=h,T=Df(aa,0,49165,Q)|0,T|0):0){j=r;i=s;h=T;break}h=c[W>>2]|0;i=h&4608;if(i){h=Df(Y,0,(i|0)!=4608?(h&512|0?49176:49190):49204,R)|0;if(h|0){j=r;i=s;break}h=c[W>>2]|0}i=c[aa>>2]|0;j=c[Y>>2]|0;if((h&512|0)==0|(c[p>>2]|0)==0){c[V>>2]=i;c[V+4>>2]=j;c[V+8>>2]=b;c[V+12>>2]=i;c[V+16>>2]=j;c[V+20>>2]=b;c[V+24>>2]=o;h=Df(e,0,49360,V)|0}else{R=c[q>>2]|0;S=c[_+12>>2]|0;T=c[_+16>>2]|0;V=c[_+32>>2]|0;h=c[_+36>>2]|0;c[U>>2]=i;c[U+4>>2]=j;c[U+8>>2]=R;c[U+12>>2]=S;c[U+16>>2]=T;c[U+20>>2]=n;c[U+24>>2]=V;c[U+28>>2]=h;c[U+32>>2]=b;c[U+36>>2]=i;c[U+40>>2]=j;c[U+44>>2]=R;c[U+48>>2]=S;c[U+52>>2]=T;c[U+56>>2]=n;c[U+60>>2]=V;c[U+64>>2]=h;c[U+68>>2]=b;c[U+72>>2]=o;h=Df(e,0,49224,U)|0}if(!h)if((nf(1)|0)!=0?(Se(49436,c[q>>2]|0),Se(49452,c[_+12>>2]|0),Se(49468,c[_+16>>2]|0),Se(49484,n),Se(49500,c[_+32>>2]|0),Se(49516,c[_+36>>2]|0),Se(49532,b),Se(49548,o),(c[W>>2]&4096|0)!=0):0){Oe(49564,X);j=r;i=s;h=0}else{j=r;i=s;h=0}else{j=r;i=s}}else{o=0;n=0;k=0;j=0;i=0;b=0;g=0;f=0}}while(0);tl(o);tl(b);tl(n);Ug(_);Rj(_+44|0);tl(c[_+56>>2]|0);Ug(Z);tl(i);tl(j);tl(f);tl(g);Yj(k);sf(c[Y>>2]|0);sf(c[aa>>2]|0);aa=h;l=ba;return aa|0}function Am(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;I=l;l=l+240|0;if((l|0)>=(m|0))$(240);H=I+144|0;C=I+136|0;B=I+128|0;A=I+120|0;z=I+112|0;y=I+104|0;x=I+96|0;v=I+88|0;u=I+80|0;t=I+72|0;j=I+64|0;i=I+56|0;g=I+40|0;f=I;D=I+220|0;q=I+216|0;E=I+212|0;F=I+208|0;G=I+148|0;c[q>>2]=0;c[E>>2]=0;c[F>>2]=0;b=G;d=b+60|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(d|0));e=uf(a,46885,0)|0;if(e){b=Eh(e,q,0)|0;if(!b)if(!(c[q>>2]&512))k=5;else{c[f>>2]=G+8;c[f+4>>2]=G+12;c[f+8>>2]=G+16;c[f+12>>2]=E;c[f+16>>2]=G+32;c[f+20>>2]=G+36;c[f+24>>2]=F;c[f+28>>2]=G+56;c[f+32>>2]=0;b=If(a,0,47225,f)|0;k=6}else{f=0;d=0}}else k=5;if((k|0)==5){c[g>>2]=F;c[g+4>>2]=G+56;c[g+8>>2]=0;b=If(a,0,47244,g)|0;k=6}do if((k|0)==6)if(!b){sf(e);r=uf(a,46925,5)|0;if((r|0)!=0?(h=zf(r,1)|0,(h|0)!=0):0){b=Fg(h,G,G+4|0,G+8|0,G+12|0,G+16|0,E,G+32|0,G+36|0)|0;if(!b)k=h;else{H=b;l=I;return H|0}}else k=0;if(c[E>>2]|0?(n=G+20|0,Pj(n),n=_g(n,c[E>>2]|0)|0,n|0):0){f=0;e=r;d=k;b=n;break}if(!k){n=c[q>>2]|0;c[G>>2]=n>>>11&2;c[G+4>>2]=n>>>12&1}if(nf(1)|0){n=Wg(c[G>>2]|0)|0;b=Xg(c[G+4>>2]|0)|0;c[i>>2]=n;c[i+4>>2]=b;Oe(48153,i);b=c[G+40>>2]|0;if(b|0){c[j>>2]=b;Oe(48177,j)}b=G+8|0;Se(48198,c[b>>2]|0);Se(48214,c[G+12>>2]|0);Se(48230,c[G+16>>2]|0);Mj(48246,G+20|0,0);Se(48260,c[G+32>>2]|0);Se(48276,c[G+36>>2]|0);Se(48292,c[F>>2]|0);if(!(gg()|0))Se(48308,c[G+56>>2]|0)}else b=G+8|0;b=c[b>>2]|0;if(((((((b|0)!=0?(o=c[G+12>>2]|0,(o|0)!=0):0)?(p=c[G+16>>2]|0,(p|0)!=0):0)?(c[G+20>>2]|0)!=0:0)?(s=G+32|0,(c[s>>2]|0)!=0):0)?(c[G+36>>2]|0)!=0:0)?(w=G+56|0,(c[w>>2]|0)!=0):0){h=G+4|0;f=Uj(c[G>>2]|0,c[h>>2]|0,0,b,o,p)|0;if(c[F>>2]|0){i=G+44|0;Pj(i);b=c[F>>2]|0;if((c[f+4>>2]|0)==1)b=Pg(b,f,i,0,0)|0;else b=_g(i,b)|0;if(!b){d=c[q>>2]|0;Pj(D);a=Hl(0)|0;if((c[f>>2]|0)==1)g=0;else g=Hl(0)|0;e=G+20|0;a:do if(!(dk(e,f)|0)){if(!(nf(1)|0)){b=7;e=0;d=0;break}Oe(48324,t);b=7;e=0;d=0}else{if(!(vk(c[G+28>>2]|0,0)|0)){if(!(nf(1)|0)){b=7;e=0;d=0;break}Oe(48376,u);b=7;e=0;d=0;break}do if((c[h>>2]|0)!=1){ck(D,c[s>>2]|0,e,f);if(!(vk(c[D+8>>2]|0,0)|0))break;if(!(nf(1)|0)){b=7;e=0;d=0;break a}Oe(48421,v);b=7;e=0;d=0;break a}while(0);b=G+52|0;if(!(vk(c[b>>2]|0,0)|0)){if(!(nf(1)|0)){b=7;e=0;d=0;break}Oe(48468,x);b=7;e=0;d=0;break}if(!($g(D,f,e,c[w>>2]|0)|0)){if(!(nf(1)|0)){b=7;e=0;d=0;break}Oe(48514,y);b=7;e=0;d=0;break}if(Nj(a,g,D,f)|0){if(!(nf(1)|0)){b=7;e=0;d=0;break}Oe(48468,z);b=7;e=0;d=0;break}if(d&4096|0){b=0;e=0;d=0;break}if(!(vk(c[b>>2]|0,1)|0)){if(!(wk(a,c[i>>2]|0)|0)){if(g|0){b=0;e=0;d=0;break}if(!(wk(0,c[G+48>>2]|0)|0)){b=0;e=0;d=0;break}}if(!(nf(1)|0)){b=7;e=0;d=0;break}Oe(48551,A);b=7;e=0;d=0;break}d=Hl(0)|0;e=Hl(0)|0;if(Nj(d,e,i,f)|0){if(!(nf(1)|0)){b=7;break}Oe(48468,B);b=7;break}if((wk(a,d)|0)==0?(wk(g,e)|0)==0:0){b=0;break}if(!(nf(1)|0)){b=7;break}Oe(48551,C);b=7}while(0);tl(d);tl(a);tl(g);tl(e);Rj(D);e=r;d=k}else{e=r;d=k}}else{e=r;d=k;b=68}}else{f=0;e=r;d=k;b=68}}else{f=0;d=0}while(0);Yj(f);Jl(c[G+8>>2]|0);Jl(c[G+12>>2]|0);Jl(c[G+16>>2]|0);Jl(c[E>>2]|0);Rj(G+20|0);Jl(c[G+32>>2]|0);Jl(c[G+36>>2]|0);Jl(c[F>>2]|0);Rj(G+44|0);Jl(c[G+56>>2]|0);cf(d);sf(e);if(!(nf(1)|0)){H=b;l=I;return H|0}c[H>>2]=Pn(b)|0;Oe(48611,H);H=b;l=I;return H|0}function Bm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=l;l=l+192|0;if((l|0)>=(m|0))$(192);E=F+72|0;D=F+64|0;C=F+56|0;p=F+48|0;n=F+40|0;k=F+32|0;B=F;v=F+152|0;w=F+144|0;x=F+140|0;y=F+136|0;A=F+80|0;c[w>>2]=0;c[x>>2]=0;c[y>>2]=0;e=A;f=e+56|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(f|0));Jh(v,0,Fm(d)|0);b=Lh(b,y,v)|0;do if(!b){if(nf(1)|0)Se(47813,c[y>>2]|0);o=c[y>>2]|0;if(o|0?c[o+12>>2]&4|0:0){q=79;r=0;s=0;t=0;u=0;break}o=A+8|0;i=A+12|0;j=A+16|0;e=A+32|0;f=A+36|0;c[B>>2]=o;c[B+4>>2]=i;c[B+8>>2]=j;c[B+12>>2]=w;c[B+16>>2]=e;c[B+20>>2]=f;c[B+24>>2]=x;c[B+28>>2]=0;b=If(d,0,47830,B)|0;if(!b){if(c[w>>2]|0?(g=A+20|0,Pj(g),g=_g(g,c[w>>2]|0)|0,g|0):0){q=g;r=0;s=0;t=0;u=0;break}sf(0);b=uf(d,46925,5)|0;if((b|0)!=0?(h=zf(b,1)|0,(h|0)!=0):0){b=Eg(0,h,A,0)|0;if(b){E=b;l=F;return E|0}}else{c[A>>2]=0;c[A+4>>2]=0;h=0}if(nf(1)|0){g=Wg(c[A>>2]|0)|0;b=Xg(c[A+4>>2]|0)|0;c[k>>2]=g;c[k+4>>2]=b;Oe(47846,k);b=c[A+40>>2]|0;if(b|0){c[n>>2]=b;Oe(47871,n)}Se(47893,c[o>>2]|0);Se(47910,c[i>>2]|0);Se(47927,c[j>>2]|0);Mj(47944,A+20|0,0);Se(47959,c[e>>2]|0);Se(47976,c[f>>2]|0);Se(47993,c[x>>2]|0)}if((!((c[o>>2]|0)==0|(c[i>>2]|0)==0|(c[j>>2]|0)==0)?(z=A+20|0,!((c[z>>2]|0)==0|(c[e>>2]|0)==0)):0)?(c[f>>2]|0)!=0&(c[x>>2]|0)!=0:0){g=A+44|0;Pj(g);b=_g(g,c[x>>2]|0)|0;if(!b){e=Uj(c[A>>2]|0,c[A+4>>2]|0,0,c[o>>2]|0,c[i>>2]|0,c[j>>2]|0)|0;f=Hl(0)|0;d=Hl(0)|0;Pj(B);ck(B,c[y>>2]|0,g,e);if(Nj(f,d,B,e)|0)Me(48010,p);b=Yg(f,d,c[o>>2]|0)|0;ck(B,c[y>>2]|0,z,e);if(!(Nj(f,d,B,e)|0)){s=Yg(f,d,c[o>>2]|0)|0;tl(f);tl(d);Rj(B);c[D>>2]=b;c[D+4>>2]=s;q=Df(a,0,48105,D)|0;r=e;t=b;u=h;break}else Me(48058,C)}else{q=b;r=0;s=0;t=0;u=h}}else{q=68;r=0;s=0;t=0;u=h}}else{q=b;r=0;s=0;t=0;u=0}}else{q=b;r=0;s=0;t=0;u=0}while(0);Jl(c[A+8>>2]|0);Jl(c[A+12>>2]|0);Jl(c[A+16>>2]|0);Jl(c[w>>2]|0);Rj(A+20|0);Jl(c[A+32>>2]|0);Jl(c[A+36>>2]|0);Jl(c[x>>2]|0);Rj(A+44|0);Jl(c[y>>2]|0);Jl(t);Jl(s);cf(u);Yj(r);Kh(v);if(!(nf(1)|0)){E=q;l=F;return E|0}c[E>>2]=Pn(q)|0;Oe(48131,E);E=q;l=F;return E|0}function Cm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;B=l;l=l+224|0;if((l|0)>=(m|0))$(224);A=B+72|0;s=B+64|0;r=B+56|0;q=B+48|0;p=B+40|0;j=B+8|0;h=B;t=B+176|0;u=B+168|0;v=B+164|0;w=B+104|0;x=B+100|0;y=B+88|0;z=B+76|0;c[u>>2]=0;c[v>>2]=0;c[x>>2]=0;f=w;g=f+60|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));Pj(y);Pj(z);Jh(t,1,Fm(d)|0);b=Ih(b,12556,u,t)|0;do if(!b){b=c[u>>2]|0;c[h>>2]=v;c[h+4>>2]=0;b=If(b,0,47524,h)|0;if(!b){if(nf(1)|0)Se(47526,c[v>>2]|0);n=c[v>>2]|0;if(n|0?c[n+12>>2]&4|0:0){f=0;g=0;b=79;e=0;break}n=w+8|0;h=w+12|0;i=w+16|0;f=w+32|0;g=w+36|0;k=w+56|0;c[j>>2]=n;c[j+4>>2]=h;c[j+8>>2]=i;c[j+12>>2]=x;c[j+16>>2]=f;c[j+20>>2]=g;c[j+24>>2]=k;c[j+28>>2]=0;b=If(d,0,47543,j)|0;if(!b){if(c[x>>2]|0?(o=w+20|0,Pj(o),o=_g(o,c[x>>2]|0)|0,o|0):0){f=0;g=0;b=o;e=0;break}sf(c[u>>2]|0);b=uf(d,46925,5)|0;c[u>>2]=b;if((b|0)!=0?(e=zf(b,1)|0,(e|0)!=0):0){b=Eg(0,e,w,0)|0;if(b){A=b;l=B;return A|0}}else{c[w>>2]=0;c[w+4>>2]=0;e=0}if(nf(1)|0){o=Wg(c[w>>2]|0)|0;b=Xg(c[w+4>>2]|0)|0;c[p>>2]=o;c[p+4>>2]=b;Oe(47559,p);b=c[w+40>>2]|0;if(b|0){c[q>>2]=b;Oe(47584,q)}Se(47606,c[n>>2]|0);Se(47623,c[h>>2]|0);Se(47640,c[i>>2]|0);Mj(47657,w+20|0,0);Se(47672,c[f>>2]|0);Se(47689,c[g>>2]|0);if(!(gg()|0))Se(47706,c[k>>2]|0)}if(!((c[n>>2]|0)==0|(c[h>>2]|0)==0|(c[i>>2]|0)==0)?!((c[w+20>>2]|0)==0|(c[f>>2]|0)==0|(c[g>>2]|0)==0|(c[k>>2]|0)==0):0){b=_g(y,c[v>>2]|0)|0;if(b|0){Rj(y);A=b;l=B;return A|0}i=Uj(c[w>>2]|0,c[w+4>>2]|0,0,c[n>>2]|0,c[h>>2]|0,c[i>>2]|0)|0;ck(z,c[k>>2]|0,y,i);g=Hl(0)|0;h=Hl(0)|0;if(Nj(g,h,z,i)|0)Me(47723,r);f=Yg(g,h,c[n>>2]|0)|0;if(!f)b=Sn()|0;else b=0;tl(g);tl(h);if(nf(1)|0)Se(47763,f);if(!b){c[s>>2]=f;g=i;b=Df(a,0,47780,s)|0}else g=i}else{f=0;g=0;b=68}}else{f=0;g=0;e=0}}else{f=0;g=0;e=0}}else{f=0;g=0;e=0}while(0);Rj(z);Rj(y);Jl(f);Jl(c[w+8>>2]|0);Jl(c[w+12>>2]|0);Jl(c[w+16>>2]|0);Jl(c[x>>2]|0);Rj(w+20|0);Jl(c[w+32>>2]|0);Jl(c[w+36>>2]|0);Jl(c[w+56>>2]|0);Jl(c[v>>2]|0);cf(e);sf(c[u>>2]|0);Yj(g);Kh(t);if(!(nf(1)|0)){A=b;l=B;return A|0}c[A>>2]=Pn(b)|0;Oe(47791,A);A=b;l=B;return A|0}function Dm(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=l;l=l+224|0;if((l|0)>=(m|0))$(224);w=x+104|0;q=x+96|0;p=x+88|0;o=x+80|0;n=x+72|0;j=x+56|0;h=x+40|0;g=x;r=x+184|0;s=x+176|0;t=x+172|0;u=x+168|0;v=x+108|0;c[s>>2]=0;c[t>>2]=0;c[u>>2]=0;e=v;f=e+60|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(f|0));Jh(r,2,0);b=Lh(b,s,r)|0;do if(!b){if(nf(1)|0)Se(47209,c[s>>2]|0);e=r+12|0;if(!(c[e>>2]&512)){c[h>>2]=u;c[h+4>>2]=v+56;c[h+8>>2]=0;b=If(d,0,47244,h)|0}else{c[g>>2]=v+8;c[g+4>>2]=v+12;c[g+8>>2]=v+16;c[g+12>>2]=t;c[g+16>>2]=v+32;c[g+20>>2]=v+36;c[g+24>>2]=u;c[g+28>>2]=v+56;c[g+32>>2]=0;b=If(d,0,47225,g)|0}if(!b){if(c[t>>2]|0?(k=v+20|0,Pj(k),k=_g(k,c[t>>2]|0)|0,k|0):0){f=0;g=0;h=0;e=0;b=k;break}sf(0);h=uf(d,46925,5)|0;if((h|0)!=0?(i=zf(h,1)|0,(i|0)!=0):0){b=Eg(0,i,v,0)|0;if(b){w=b;l=x;return w|0}}else{i=c[e>>2]|0;c[v>>2]=i>>>11&2;c[v+4>>2]=i>>>12&1;i=0}if(nf(1)|0){d=Wg(c[v>>2]|0)|0;k=Xg(c[v+4>>2]|0)|0;b=c[e>>2]&4096|0?47019:71847;c[j>>2]=d;c[j+4>>2]=k;c[j+8>>2]=b;Oe(47250,j);b=c[v+40>>2]|0;if(b|0){c[n>>2]=b;Oe(47276,n)}b=v+8|0;Se(47297,c[b>>2]|0);Se(47313,c[v+12>>2]|0);Se(47329,c[v+16>>2]|0);Mj(47345,v+20|0,0);Se(47359,c[v+32>>2]|0);Se(47375,c[v+36>>2]|0);Se(47391,c[u>>2]|0);if(!(gg()|0))Se(47407,c[v+56>>2]|0)}else b=v+8|0;if(((((((c[b>>2]|0)!=0?(c[v+12>>2]|0)!=0:0)?(c[v+16>>2]|0)!=0:0)?(c[v+20>>2]|0)!=0:0)?(c[v+32>>2]|0)!=0:0)?(c[v+36>>2]|0)!=0:0)?(c[v+56>>2]|0)!=0:0){g=Hl(0)|0;f=Hl(0)|0;e=c[e>>2]|0;if(e&4096|0){b=Sg(c[s>>2]|0,v,g,f,c[r+16>>2]|0,c[u>>2]|0)|0;if(b|0){e=i;break}c[o>>2]=g;c[o+4>>2]=f;e=i;b=Df(a,0,47423,o)|0;break}b=c[s>>2]|0;if(!(e&8192)){b=Kn(b,v,g,f,e,c[r+16>>2]|0)|0;if(b|0){e=i;break}c[q>>2]=g;c[q+4>>2]=f;e=i;b=Df(a,0,47476,q)|0;break}else{b=Mn(b,v,g,f)|0;if(b|0){e=i;break}c[p>>2]=g;c[p+4>>2]=f;e=i;b=Df(a,0,47450,p)|0;break}}else{f=0;g=0;e=i;b=68}}else{f=0;g=0;h=0;e=0}}else{f=0;g=0;h=0;e=0}while(0);Jl(c[v+8>>2]|0);Jl(c[v+12>>2]|0);Jl(c[v+16>>2]|0);Jl(c[t>>2]|0);Rj(v+20|0);Jl(c[v+32>>2]|0);Jl(c[v+36>>2]|0);Jl(c[u>>2]|0);Rj(v+44|0);Jl(c[v+56>>2]|0);Jl(g);Jl(f);cf(e);Jl(c[s>>2]|0);sf(h);Kh(r);if(!(nf(1)|0)){w=b;l=x;return w|0}c[w>>2]=Pn(b)|0;Oe(47503,w);w=b;l=x;return w|0}function Em(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=l;l=l+224|0;if((l|0)>=(m|0))$(224);D=E+80|0;n=E+72|0;k=E+56|0;g=E+48|0;h=E+16|0;t=E;w=E+176|0;x=E+172|0;y=E+168|0;z=E+164|0;A=E+160|0;B=E+156|0;C=E+152|0;v=E+96|0;o=E+88|0;u=E+84|0;c[x>>2]=0;c[y>>2]=0;c[z>>2]=0;c[A>>2]=0;c[B>>2]=0;c[C>>2]=0;e=v;f=e+56|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(f|0));Jh(w,3,Fm(d)|0);e=Lh(b,C,w)|0;a:do if(!e){if(nf(1)|0)Se(46951,c[C>>2]|0);e=Hh(a,12556,x,o)|0;if(!e){a=c[x>>2]|0;e=c[o>>2]&4096|0?46967:46882;c[t>>2]=A;c[t+4>>2]=B;c[t+8>>2]=0;e=If(a,0,e,t)|0;if(!e){if(nf(1)|0){Se(46971,c[A>>2]|0);Se(46987,c[B>>2]|0)}b=c[w+12>>2]|0;if(!((c[o>>2]^b)&4096)){if(!(b&512)){c[g>>2]=z;c[g+4>>2]=0;e=If(d,0,46920,g)|0}else{e=v+32|0;c[h>>2]=v+8;c[h+4>>2]=v+12;c[h+8>>2]=v+16;c[h+12>>2]=y;c[h+16>>2]=e;c[h+20>>2]=e;c[h+24>>2]=z;c[h+28>>2]=0;e=If(d,0,47003,h)|0}if(!e){if(c[y>>2]|0?(i=v+20|0,Pj(i),i=_g(i,c[y>>2]|0)|0,i|0):0){f=0;e=i;break}sf(c[x>>2]|0);b=uf(d,46925,5)|0;c[x>>2]=b;if((b|0)!=0?(j=zf(b,1)|0,(j|0)!=0):0){b=Eg(0,j,v,0)|0;if(!b)a=j;else{D=b;l=E;return D|0}}else{a=c[o>>2]|0;c[v>>2]=a>>>11&2;c[v+4>>2]=a>>>12&1;a=0}if(!(nf(1)|0))f=v+8|0;else{i=Wg(c[v>>2]|0)|0;j=Xg(c[v+4>>2]|0)|0;b=c[o>>2]&4096|0?47019:71847;c[k>>2]=i;c[k+4>>2]=j;c[k+8>>2]=b;Oe(47026,k);b=c[v+40>>2]|0;if(b|0){c[n>>2]=b;Oe(47052,n)}f=v+8|0;Se(47073,c[f>>2]|0);Se(47089,c[v+12>>2]|0);Se(47105,c[v+16>>2]|0);Mj(47121,v+20|0,0);Se(47135,c[v+32>>2]|0);Se(47151,c[v+36>>2]|0);Se(47167,c[z>>2]|0)}if((((((c[f>>2]|0)!=0?(q=v+12|0,(c[q>>2]|0)!=0):0)?(r=v+16|0,(c[r>>2]|0)!=0):0)?(c[v+20>>2]|0)!=0:0)?(s=v+32|0,(c[s>>2]|0)!=0):0)?(p=c[z>>2]|0,(c[v+36>>2]|0)!=0&(p|0)!=0):0){e=c[o>>2]|0;if(e&4096|0){f=a;e=Tg(c[C>>2]|0,v,c[A>>2]|0,c[B>>2]|0,c[w+16>>2]|0,p)|0;break}b=v+44|0;Pj(b);if(e&8192|0){e=_g(b,c[z>>2]|0)|0;if(e|0){f=a;break}f=a;e=Nn(c[C>>2]|0,v,c[A>>2]|0,c[B>>2]|0)|0;break}if((c[v+4>>2]|0)==1){r=Uj(c[v>>2]|0,1,0,c[f>>2]|0,c[q>>2]|0,c[r>>2]|0)|0;e=Pg(c[z>>2]|0,r,b,0,0)|0;Yj(r)}else e=_g(b,c[z>>2]|0)|0;if(e|0){f=a;break}b=c[C>>2]|0;do if(b|0){if(!(c[b+12>>2]&4))break;e=lk(c[s>>2]|0)|0;b=wl(c[C>>2]|0,t)|0;b=Sk(u,5,b,((c[t>>2]|0)+7|0)>>>3,0)|0;if(!b){b=c[t>>2]|0;if(b>>>0>e>>>0){t=c[u>>2]|0;sk(t,t,b-e|0)}b=Ln(c[u>>2]|0,v,c[A>>2]|0,c[B>>2]|0)|0;Jl(c[u>>2]|0)}f=a;e=b;break a}while(0);f=a;e=Ln(b,v,c[A>>2]|0,c[B>>2]|0)|0}else{f=a;e=68}}else f=0}else{f=0;e=70}}else f=0}else f=0}else f=0;while(0);Jl(c[v+8>>2]|0);Jl(c[v+12>>2]|0);Jl(c[v+16>>2]|0);Jl(c[y>>2]|0);Rj(v+20|0);Jl(c[v+32>>2]|0);Jl(c[v+36>>2]|0);Jl(c[z>>2]|0);Rj(v+44|0);Jl(c[C>>2]|0);Jl(c[A>>2]|0);Jl(c[B>>2]|0);cf(f);sf(c[x>>2]|0);Kh(w);if(!(nf(1)|0)){D=e;l=E;return D|0}if(!e)b=47183;else b=Pn(e)|0;c[D>>2]=b;Oe(47188,D);D=e;l=E;return D|0}function Fm(a){a=a|0;var b=0,d=0,e=0,f=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=f;c[e>>2]=0;b=uf(a,46949,1)|0;if(!b){a=uf(a,46925,5)|0;if((a|0)!=0?(d=zf(a,1)|0,sf(a),(d|0)!=0):0){if(Eg(0,d,0,e)|0)c[e>>2]=0;cf(d);a=c[e>>2]|0}else a=0}else{a=Af(b,1,5)|0;sf(b);if(!a)a=0;else{d=lk(a)|0;c[e>>2]=d;Jl(a);a=d}}l=f;return a|0}function Gm(a,b,c){a=a|0;b=b|0;c=c|0;return ((a|0)==18?0:4)|0}function Hm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;G=l;l=l+176|0;if((l|0)>=(m|0))$(176);E=G+88|0;D=G+80|0;i=G+72|0;h=G+64|0;q=G+32|0;p=G;F=G+112|0;w=G+108|0;r=G+104|0;y=G+100|0;B=G+140|0;C=G+96|0;c[w>>2]=0;c[r>>2]=0;c[y>>2]=0;c[F>>2]=0;c[F+4>>2]=0;c[F+8>>2]=0;c[F+12>>2]=0;c[F+16>>2]=0;c[F+20>>2]=0;c[F+24>>2]=0;g=uf(d,46885,0)|0;do if(g){e=Eh(g,w,0)|0;if(!e){n=c[w>>2]|0;o=(n&4096|0)!=0;if(!(n&512)){e=F+24|0;if(!o){j=10;break}c[h>>2]=e;c[h+4>>2]=0;e=If(d,0,46920,h)|0;j=11;break}e=F+4|0;h=F+8|0;i=F+12|0;j=F+16|0;k=F+20|0;n=F+24|0;if(o){c[p>>2]=F;c[p+4>>2]=e;c[p+8>>2]=h;c[p+12>>2]=i;c[p+16>>2]=j;c[p+20>>2]=k;c[p+24>>2]=n;c[p+28>>2]=0;e=If(d,0,46891,p)|0;j=11;break}else{c[q>>2]=F;c[q+4>>2]=e;c[q+8>>2]=h;c[q+12>>2]=i;c[q+16>>2]=j;c[q+20>>2]=k;c[q+24>>2]=n;c[q+28>>2]=0;e=If(d,0,46906,q)|0;j=11;break}}else f=0}else{e=F+24|0;j=10}while(0);if((j|0)==10){c[i>>2]=e;c[i+4>>2]=0;e=If(d,0,46923,i)|0;j=11}a:do if((j|0)==11)if(!e){sf(g);g=uf(d,46925,5)|0;if((g|0)!=0?(f=zf(g,1)|0,(f|0)!=0):0){e=Fg(f,r,y,F,F+4|0,F+8|0,F+12|0,F+16|0,F+20|0)|0;if(!e)e=F;else break}else{f=c[w>>2]|0;c[r>>2]=f>>>11&2;c[y>>2]=f>>>12&1;f=0;e=F}e=c[e>>2]|0;if(((((((e|0)!=0?(kk(e),x=c[F+4>>2]|0,(x|0)!=0):0)?(kk(x),A=c[F+8>>2]|0,(A|0)!=0):0)?(kk(A),s=c[F+12>>2]|0,(s|0)!=0):0)?(kk(s),t=c[F+16>>2]|0,(t|0)!=0):0)?(kk(t),u=c[F+20>>2]|0,(u|0)!=0):0)?(kk(u),z=F+24|0,v=c[z>>2]|0,(v|0)!=0):0){kk(v);if(c[w>>2]&4096|0){if((c[y>>2]|0)!=1){e=69;break}e=Ng(c[z>>2]|0,256)|0;if(e|0)break}h=0;while(1){if((h|0)==5){h=6;continue}e=c[F+(h<<2)>>2]|0;if((e|0)!=0?(c[e+12>>2]&4|0)!=0:0){A=wl(e,C)|0;z=((c[C>>2]|0)+7|0)>>>3;c[C>>2]=z;c[D>>2]=a[46931+h>>0];c[D+4>>2]=z;lp(B,30,46938,D)|0;lh(b,B,Fo(B)|0);lh(b,A,c[C>>2]|0);lh(b,46947,1)}else{e=Ok(e,0,C,0)|0;if(!e)break;A=c[C>>2]|0;c[E>>2]=a[46931+h>>0];c[E+4>>2]=A;lp(B,30,46938,E)|0;lh(b,B,Fo(B)|0);lh(b,e,c[C>>2]|0);lh(b,46947,1);cf(e)}h=h+1|0;if((h|0)>=7){e=0;break a}}e=Sn()|0}else e=68}else f=0;while(0);cf(f);sf(g);Jl(c[F>>2]|0);Jl(c[F+4>>2]|0);Jl(c[F+8>>2]|0);Jl(c[F+12>>2]|0);Jl(c[F+16>>2]|0);Jl(c[F+20>>2]|0);Jl(c[F+24>>2]|0);l=G;return e|0}function Im(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0;k=l;l=l+1008|0;if((l|0)>=(m|0))$(1008);j=k;h=k+8|0;if((sh(a)|0)!=(g|0)){j=49658;l=k;return j|0}if(eh(j,a,0)|0){j=49699;l=k;return j|0}switch(b|0){case 0:{lh(c[j>>2]|0,d,e);i=8;break}case 1:{Yq(h|0,97,1e3)|0;b=0;do{lh(c[j>>2]|0,h,1e3);b=b+1|0}while((b|0)!=1e3);i=8;break}default:b=49641}if((i|0)==8){b=(Tp(ph(c[j>>2]|0,a)|0,f,g)|0)==0;b=b?0:49625}kh(c[j>>2]|0);j=b;l=k;return j|0}function Jm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=b+148|0;j=c[h>>2]|0;if(j>>>0>128)He(49719,112,49733);i=b+152|0;g=c[i>>2]|0;if(!g)return;k=b+144|0;f=c[k>>2]|0;if((f|0)==(j|0)){Te(pb[g&63](b,b,1)|0);c[k>>2]=0;l=b+128|0;f=l;f=_q(c[f>>2]|0,c[f+4>>2]|0,1,0)|0;g=D;c[l>>2]=f;c[l+4>>2]=g;if((f|0)==0&(g|0)==0){f=b+136|0;l=f;l=_q(c[l>>2]|0,c[l+4>>2]|0,1,0)|0;c[f>>2]=l;c[f+4>>2]=D;f=0}else f=0}if(!d)return;a:do if(f){b:do if(e|0){if(f>>>0>>0)do{l=a[d>>0]|0;c[k>>2]=f+1;a[b+f>>0]=l;e=e+-1|0;if(!e)break b;d=d+1|0;f=c[k>>2]|0}while(f>>>0>>0);g=c[h>>2]|0;if(g>>>0>128)He(49719,112,49733);h=c[i>>2]|0;if(!((f|0)==(g|0)&(h|0)!=0))break a;Te(pb[h&63](b,b,1)|0);c[k>>2]=0;g=b+128|0;h=g;h=_q(c[h>>2]|0,c[h+4>>2]|0,1,0)|0;l=D;c[g>>2]=h;c[g+4>>2]=l;if(!((h|0)==0&(l|0)==0))break a;l=b+136|0;h=l;h=_q(c[h>>2]|0,c[h+4>>2]|0,1,0)|0;c[l>>2]=h;c[l+4>>2]=D;break a}while(0);e=c[h>>2]|0;if(e>>>0>128)He(49719,112,49733);d=c[i>>2]|0;if(!d)return;if((c[k>>2]|0)!=(e|0))return;Te(pb[d&63](b,b,1)|0);c[k>>2]=0;j=b+128|0;k=j;k=_q(c[k>>2]|0,c[k+4>>2]|0,1,0)|0;l=D;c[j>>2]=k;c[j+4>>2]=l;if(!((k|0)==0&(l|0)==0))return;l=b+136|0;k=l;k=_q(c[k>>2]|0,c[k+4>>2]|0,1,0)|0;c[l>>2]=k;c[l+4>>2]=D;return}while(0);if(e>>>0>>0)f=0;else{l=(e>>>0)/(j>>>0)|0;f=pb[c[i>>2]&63](b,d,l)|0;c[k>>2]=0;i=b+128|0;g=i;g=_q(c[g>>2]|0,c[g+4>>2]|0,l|0,0)|0;h=D;m=b+136|0;n=m;n=_q((h>>>0<0|(h|0)==0&g>>>0>>0)&1|0,0,c[n>>2]|0,c[n+4>>2]|0)|0;c[m>>2]=n;c[m+4>>2]=D;c[i>>2]=g;c[i+4>>2]=h;l=S(l,j)|0;e=e-l|0;d=d+l|0}Te(f);if(!e)return;while(1){f=c[k>>2]|0;if(f>>>0>=j>>>0){d=29;break}n=a[d>>0]|0;c[k>>2]=f+1;a[b+f>>0]=n;e=e+-1|0;if(!e){d=29;break}else d=d+1|0}if((d|0)==29)return}function Km(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;q=b+3|0;q=q+(0-(q&3))|0;r=b+84|0;p=c[c[r>>2]>>2]|0;s=b+88|0;f=c[s>>2]|0;do if(f){o=p-f|0;o=o>>>0>e>>>0?e:o;g=b+68+f|0;if(!((g|d)&3))if(o>>>0>3){l=o+-4|0;m=l&-4;n=m+4|0;h=d+n|0;i=d;j=g;k=o;while(1){c[j>>2]=c[i>>2];k=k+-4|0;if(k>>>0<=3)break;else{i=i+4|0;j=j+4|0}}i=l-m|0;g=g+n|0}else{i=o;h=d}else{h=d;i=o}if(i){f=i;while(1){a[g>>0]=a[h>>0]|0;f=f+-1|0;if(!f)break;else{h=h+1|0;g=g+1|0}}f=c[s>>2]|0}n=f+o|0;c[s>>2]=n;if(n>>>0

>>0)return;else{g=pb[c[(c[r>>2]|0)+8>>2]&63](q,b+68|0,p)|0;c[s>>2]=0;d=d+o|0;f=e-o|0;break}}else{f=e;g=0}while(0);i=f&0-p;if(f>>>0

>>0){h=d;o=f;n=g}else{h=d+i|0;o=f-i|0;n=pb[c[(c[r>>2]|0)+8>>2]&63](q,d,i)|0}if(o|0){f=c[s>>2]|0;g=b+68+f|0;if(o>>>0>3&((g|h)&3|0)==0){j=o+-4|0;k=j&-4;m=k+4|0;l=h+m|0;i=g;d=o;while(1){c[i>>2]=c[h>>2];d=d+-4|0;if(d>>>0<=3)break;else{h=h+4|0;i=i+4|0}}i=j-k|0;if(i){h=l;g=g+m|0;f=i;t=20}}else{f=o;t=20}if((t|0)==20){while(1){a[g>>0]=a[h>>0]|0;f=f+-1|0;if(!f)break;else{h=h+1|0;g=g+1|0;t=20}}f=c[s>>2]|0}c[s>>2]=f+o}if(!n)return;Te(n);return}function Lm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;J=l;l=l+624|0;if((l|0)>=(m|0))$(624);H=J+96|0;C=J;o=J+228|0;D=J+136|0;E=J+592|0;F=J+336|0;G=J+320|0;g=J+104|0;if(!(c[17642]|0)){c[17642]=1;f=o;B=f+92|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(B|0));f=D;B=f+92|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(B|0));f=G;B=f+16|0;do{a[f>>0]=0;f=f+1|0}while((f|0)<(B|0));f=C;B=f+92|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(B|0));Lm(C,49754,32)|0;Km(C,49786,131);B=C+3|0;Te(wb[c[(c[C+84>>2]|0)+12>>2]&3](B+(0-(B&3))|0,C+68|0,c[C+88>>2]|0,G)|0);if(C&4){f=C;h=92;do{a[f>>0]=0;f=f+1|0;h=h+-1|0}while((h|0)!=0&(f&7|0)!=0);if(h>>>0>=8)I=5}else{f=C;h=92;I=5}if((I|0)==5){k=h+-8|0;n=k&-8;j=n+8|0;i=f;while(1){B=i;c[B>>2]=0;c[B+4>>2]=0;h=h+-8|0;if(h>>>0<=7)break;else i=i+8|0}f=f+j|0;h=k-n|0}if(h|0)while(1){a[f>>0]=0;h=h+-1|0;if(!h)break;else f=f+1|0}if(!(Tp(49917,G,16)|0)){f=G;B=f+16|0;do{a[f>>0]=0;f=f+1|0}while((f|0)<(B|0));Lm(o,49754,32)|0;Km(o,49786,32);Km(o,49818,64);Km(o,49882,16);Km(o,49898,8);Km(o,49906,4);Km(o,49910,2);Km(o,49912,1);Km(o,49913,1);Km(o,49914,1);Km(o,49915,1);Km(o,49916,1);B=o+3|0;Te(wb[c[(c[o+84>>2]|0)+12>>2]&3](B+(0-(B&3))|0,o+68|0,c[o+88>>2]|0,G)|0);if(!(Tp(49917,G,16)|0)){f=G;B=f+16|0;do{a[f>>0]=0;f=f+1|0}while((f|0)<(B|0));f=C;B=f+92|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(B|0));Lm(C,49933,32)|0;Km(C,49965,16);B=C+3|0;Te(wb[c[(c[C+84>>2]|0)+12>>2]&3](B+(0-(B&3))|0,C+68|0,c[C+88>>2]|0,G)|0);if(C&4){f=C;h=92;do{a[f>>0]=0;f=f+1|0;h=h+-1|0}while((h|0)!=0&(f&7|0)!=0);if(h>>>0>=8)I=15}else{f=C;h=92;I=15}if((I|0)==15){k=h+-8|0;n=k&-8;j=n+8|0;i=f;while(1){B=i;c[B>>2]=0;c[B+4>>2]=0;h=h+-8|0;if(h>>>0<=7)break;else i=i+8|0}f=f+j|0;h=k-n|0}if(h|0)while(1){a[f>>0]=0;h=h+-1|0;if(!h)break;else f=f+1|0}if(!(Tp(49981,G,16)|0)){Lm(D,49997,32)|0;h=C+3|0;h=h+(0-(h&3))|0;i=C+84|0;j=C+68|0;k=C+88|0;n=C+8|0;o=C+16|0;p=C+24|0;q=C+32|0;r=C+40|0;s=C+48|0;t=C+56|0;u=C+64|0;v=C+72|0;w=C+80|0;x=k+1|0;y=k+2|0;z=k+3|0;A=0;do{f=A&255;Yq(E|0,f|0,32)|0;if(A|0)Yq(F|0,f|0,A|0)|0;f=C;B=f+92|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(B|0));Lm(C,E,32)|0;Km(C,F,A);Te(wb[c[(c[i>>2]|0)+12>>2]&3](h,j,c[k>>2]|0,G)|0);B=C;c[B>>2]=0;c[B+4>>2]=0;B=n;c[B>>2]=0;c[B+4>>2]=0;B=o;c[B>>2]=0;c[B+4>>2]=0;B=p;c[B>>2]=0;c[B+4>>2]=0;B=q;c[B>>2]=0;c[B+4>>2]=0;B=r;c[B>>2]=0;c[B+4>>2]=0;B=s;c[B>>2]=0;c[B+4>>2]=0;B=t;c[B>>2]=0;c[B+4>>2]=0;B=u;c[B>>2]=0;c[B+4>>2]=0;B=v;c[B>>2]=0;c[B+4>>2]=0;B=w;c[B>>2]=0;c[B+4>>2]=0;a[k>>0]=0;a[x>>0]=0;a[y>>0]=0;a[z>>0]=0;Km(D,G,16);A=A+1|0}while((A|0)!=256);f=D+3|0;Te(wb[c[(c[D+84>>2]|0)+12>>2]&3](f+(0-(f&3))|0,D+68|0,c[D+88>>2]|0,G)|0);f=(Tp(50029,G,16)|0)==0;f=f?0:50045}else f=50117}else f=50093}else f=50069;c[17643]=f;if(f|0){c[H>>2]=f;Le(50141,H)}}if((e|0)!=32){I=44;l=J;return I|0}if(c[17643]|0){I=50;l=J;return I|0}f=b+84|0;c[f>>2]=12580;if(!(d&3)){c[g>>2]=c[d>>2];c[g+4>>2]=c[d+4>>2];c[g+8>>2]=c[d+8>>2];c[g+12>>2]=c[d+12>>2];c[g+16>>2]=c[d+16>>2];c[g+20>>2]=c[d+20>>2];c[g+24>>2]=c[d+24>>2];c[g+28>>2]=c[d+28>>2];f=12580}else{a[g>>0]=a[d>>0]|0;a[g+1>>0]=a[d+1>>0]|0;a[g+2>>0]=a[d+2>>0]|0;a[g+3>>0]=a[d+3>>0]|0;a[g+4>>0]=a[d+4>>0]|0;a[g+5>>0]=a[d+5>>0]|0;a[g+6>>0]=a[d+6>>0]|0;a[g+7>>0]=a[d+7>>0]|0;a[g+8>>0]=a[d+8>>0]|0;a[g+9>>0]=a[d+9>>0]|0;a[g+10>>0]=a[d+10>>0]|0;a[g+11>>0]=a[d+11>>0]|0;a[g+12>>0]=a[d+12>>0]|0;a[g+13>>0]=a[d+13>>0]|0;a[g+14>>0]=a[d+14>>0]|0;a[g+15>>0]=a[d+15>>0]|0;a[g+16>>0]=a[d+16>>0]|0;a[g+17>>0]=a[d+17>>0]|0;a[g+18>>0]=a[d+18>>0]|0;a[g+19>>0]=a[d+19>>0]|0;a[g+20>>0]=a[d+20>>0]|0;a[g+21>>0]=a[d+21>>0]|0;a[g+22>>0]=a[d+22>>0]|0;a[g+23>>0]=a[d+23>>0]|0;a[g+24>>0]=a[d+24>>0]|0;a[g+25>>0]=a[d+25>>0]|0;a[g+26>>0]=a[d+26>>0]|0;a[g+27>>0]=a[d+27>>0]|0;a[g+28>>0]=a[d+28>>0]|0;a[g+29>>0]=a[d+29>>0]|0;a[g+30>>0]=a[d+30>>0]|0;a[g+31>>0]=a[d+31>>0]|0;f=c[f>>2]|0}d=b+3|0;c[b+88>>2]=0;sb[c[f+4>>2]&7](d+(0-(d&3))|0,g);if(g&4){f=32;do{a[g>>0]=0;g=g+1|0;f=f+-1|0}while((f|0)!=0&(g&7|0)!=0);if(f>>>0>=8)I=36}else{f=32;I=36}if((I|0)==36){i=f+-8|0;j=i&-8;k=j+8|0;h=g;while(1){I=h;c[I>>2]=0;c[I+4>>2]=0;f=f+-8|0;if(f>>>0<=7)break;else h=h+8|0}f=i-j|0;g=g+k|0}if(!f){I=0;l=J;return I|0}while(1){a[g>>0]=0;f=f+-1|0;if(!f){f=0;break}else g=g+1|0}l=J;return f|0}function Mm(b,e){b=b|0;e=e|0;var f=0,g=0;f=e+3|0;c[b>>2]=(d[e+2>>0]|0)<<16|(d[f>>0]|0)<<24&50331648|(d[e+1>>0]|0)<<8|(d[e>>0]|0);g=e+6|0;c[b+4>>2]=((d[e+5>>0]|0)<<16|(d[g>>0]|0)<<24|(d[e+4>>0]|0)<<8|(d[f>>0]|0))>>>2&67108611;f=e+9|0;c[b+8>>2]=((d[e+8>>0]|0)<<16|(d[f>>0]|0)<<24|(d[e+7>>0]|0)<<8|(d[g>>0]|0))>>>4&67092735;c[b+12>>2]=((d[e+11>>0]|0)<<16|(d[e+12>>0]|0)<<24|(d[e+10>>0]|0)<<8|(d[f>>0]|0))>>>6&66076671;c[b+16>>2]=(d[e+14>>0]|0)<<8|(d[e+15>>0]|0)<<16&983040|(d[e+13>>0]|0);f=b+20|0;c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[f+12>>2]=0;c[f+16>>2]=0;c[b+40>>2]=(d[e+18>>0]|0)<<16|(d[e+19>>0]|0)<<24|(d[e+17>>0]|0)<<8|(d[e+16>>0]|0);c[b+44>>2]=(d[e+22>>0]|0)<<16|(d[e+23>>0]|0)<<24|(d[e+21>>0]|0)<<8|(d[e+20>>0]|0);c[b+48>>2]=(d[e+26>>0]|0)<<16|(d[e+27>>0]|0)<<24|(d[e+25>>0]|0)<<8|(d[e+24>>0]|0);c[b+52>>2]=(d[e+30>>0]|0)<<16|(d[e+31>>0]|0)<<24|(d[e+29>>0]|0)<<8|(d[e+28>>0]|0);a[b+56>>0]=0;return}function Nm(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0;t=a[b+56>>0]|0?0:16777216;u=c[b+4>>2]|0;m=c[b+8>>2]|0;n=c[b+12>>2]|0;o=c[b+16>>2]|0;v=b+20|0;k=c[v>>2]|0;w=b+24|0;j=c[w>>2]|0;x=b+28|0;i=c[x>>2]|0;y=b+32|0;h=c[y>>2]|0;z=b+36|0;g=c[z>>2]|0;if(f>>>0<=15){q=k;r=j;s=i;t=h;u=g;c[v>>2]=q;c[w>>2]=r;c[x>>2]=s;c[y>>2]=t;c[z>>2]=u;return 124}p=o*5|0;q=n*5|0;r=m*5|0;s=u*5|0;l=c[b>>2]|0;b=e;while(1){I=d[b+3>>0]|0;A=(d[b+2>>0]<<16|I<<24&50331648|d[b+1>>0]<<8|d[b>>0])+k|0;G=d[b+6>>0]|0;I=((G<<24|I|d[b+5>>0]<<16|d[b+4>>0]<<8)>>>2&67108863)+j|0;F=d[b+9>>0]|0;G=((d[b+8>>0]<<16|F<<24|d[b+7>>0]<<8|G)>>>4&67108863)+i|0;F=((d[b+11>>0]<<16|d[b+12>>0]<<24|d[b+10>>0]<<8|F)>>>6)+h|0;k=(d[b+15>>0]<<16|t|d[b+14>>0]<<8|d[b+13>>0])+g|0;j=kr(A|0,0,l|0,0)|0;i=D;e=kr(I|0,0,p|0,0)|0;i=_q(e|0,D|0,j|0,i|0)|0;j=D;e=kr(G|0,0,q|0,0)|0;e=_q(i|0,j|0,e|0,D|0)|0;j=D;i=kr(F|0,0,r|0,0)|0;i=_q(e|0,j|0,i|0,D|0)|0;j=D;e=kr(k|0,0,s|0,0)|0;e=_q(i|0,j|0,e|0,D|0)|0;j=D;i=kr(A|0,0,u|0,0)|0;h=D;E=kr(I|0,0,l|0,0)|0;h=_q(E|0,D|0,i|0,h|0)|0;i=D;E=kr(G|0,0,p|0,0)|0;E=_q(h|0,i|0,E|0,D|0)|0;i=D;h=kr(F|0,0,q|0,0)|0;h=_q(E|0,i|0,h|0,D|0)|0;i=D;E=kr(k|0,0,r|0,0)|0;E=_q(h|0,i|0,E|0,D|0)|0;i=D;h=kr(A|0,0,m|0,0)|0;g=D;C=kr(I|0,0,u|0,0)|0;g=_q(C|0,D|0,h|0,g|0)|0;h=D;C=kr(G|0,0,l|0,0)|0;C=_q(g|0,h|0,C|0,D|0)|0;h=D;g=kr(F|0,0,p|0,0)|0;g=_q(C|0,h|0,g|0,D|0)|0;h=D;C=kr(k|0,0,q|0,0)|0;C=_q(g|0,h|0,C|0,D|0)|0;h=D;g=kr(A|0,0,n|0,0)|0;H=D;B=kr(I|0,0,m|0,0)|0;H=_q(B|0,D|0,g|0,H|0)|0;g=D;B=kr(G|0,0,u|0,0)|0;B=_q(H|0,g|0,B|0,D|0)|0;g=D;H=kr(F|0,0,l|0,0)|0;H=_q(B|0,g|0,H|0,D|0)|0;g=D;B=kr(k|0,0,p|0,0)|0;B=_q(H|0,g|0,B|0,D|0)|0;g=D;A=kr(A|0,0,o|0,0)|0;H=D;I=kr(I|0,0,n|0,0)|0;H=_q(I|0,D|0,A|0,H|0)|0;A=D;G=kr(G|0,0,m|0,0)|0;G=_q(H|0,A|0,G|0,D|0)|0;A=D;F=kr(F|0,0,u|0,0)|0;F=_q(G|0,A|0,F|0,D|0)|0;A=D;k=kr(k|0,0,l|0,0)|0;k=_q(F|0,A|0,k|0,D|0)|0;A=D;j=gr(e|0,j|0,26)|0;j=_q(E|0,i|0,j|0,0)|0;i=gr(j|0,D|0,26)|0;i=_q(C|0,h|0,i|0,0)|0;h=gr(i|0,D|0,26)|0;i=i&67108863;h=_q(B|0,g|0,h|0,0)|0;g=gr(h|0,D|0,26)|0;h=h&67108863;g=_q(k|0,A|0,g|0,0)|0;A=gr(g|0,D|0,26)|0;g=g&67108863;A=A*5|0;k=A+e&67108863;j=((A+(e&67108863)|0)>>>26)+(j&67108863)|0;f=f+-16|0;if(f>>>0<=15)break;else b=b+16|0}c[v>>2]=k;c[w>>2]=j;c[x>>2]=i;c[y>>2]=h;c[z>>2]=g;return 124}function Om(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=i;if(!e)d=100;else{h=g;j=h+16|0;do{a[h>>0]=0;h=h+1|0}while((h|0)<(j|0));cr(g|0,d|0,e|0)|0;a[g+e>>0]=1;a[b+56>>0]=1;Nm(b,g,16)|0;d=224}j=c[b+24>>2]|0;t=(c[b+28>>2]|0)+(j>>>26)|0;h=t&67108863;r=(t>>>26)+(c[b+32>>2]|0)|0;q=r&67108863;k=(r>>>26)+(c[b+36>>2]|0)|0;g=((k>>>26)*5|0)+(c[b+20>>2]|0)|0;e=g&67108863;j=(g>>>26)+(j&67108863)|0;v=((e+5|0)>>>26)+j|0;u=v>>>26;s=(u+h|0)>>>26;o=(k|-67108864)+((s+q|0)>>>26)|0;p=(o>>>31)+-1|0;n=o>>31;j=v&67108863&p|n&j;h=u+t&67108863&p|n&h;q=s+r&67108863&p|n&q;e=_q(g+5&67108863&p|n&e|j<<26|0,0,c[b+40>>2]|0,0)|0;g=D;j=_q(j>>>6|h<<20|0,0,c[b+44>>2]|0,0)|0;g=_q(j|0,D|0,g|0,0)|0;j=D;h=_q(h>>>12|q<<14|0,0,c[b+48>>2]|0,0)|0;j=_q(h|0,D|0,j|0,0)|0;h=D;k=_q(q>>>18|(p&o|n&k)<<8|0,0,c[b+52>>2]|0,0)|0;h=_q(k|0,D|0,h|0,0)|0;a[f+3>>0]=e>>>24;a[f+2>>0]=e>>>16;a[f+1>>0]=e>>>8;a[f>>0]=e;a[f+7>>0]=g>>>24;a[f+6>>0]=g>>>16;a[f+5>>0]=g>>>8;a[f+4>>0]=g;a[f+11>>0]=j>>>24;a[f+10>>0]=j>>>16;a[f+9>>0]=j>>>8;a[f+8>>0]=j;a[f+15>>0]=h>>>24;a[f+14>>0]=h>>>16;a[f+13>>0]=h>>>8;a[f+12>>0]=h;h=b;j=h+56|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(j|0));l=i;return d|0}function Pm(a){a=a|0;if(a|0){Qm();return}if(c[17644]|0)return;c[17644]=1;return}function Qm(){var a=0,b=0,d=0,e=0,f=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=f+16|0;d=f+8|0;b=f;if(!(c[17644]|0))c[17644]=1;a=Vn(12596)|0;if(a|0){c[b>>2]=Pn(a)|0;Me(50172,b)}c[17645]=1;do if(!(c[17646]|0)){if(!(c[17647]|0))a=kf(1,664)|0;else a=lf(1,664)|0;c[17646]=a;if(!(c[17647]|0))a=kf(1,664)|0;else a=lf(1,664)|0;c[17648]=a;if(vq(52444,4)|0){b=ze(50209)|0;Me(b,d)}if(!(vq(52456,4)|0)){c[17649]=3;break}else{b=ze(50209)|0;Me(b,d)}}while(0);c[17645]=0;a=Wn(12596)|0;if(!a){l=f;return}else{c[e>>2]=Pn(a)|0;Me(50247,e)}}function Rm(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e+8|0;b=e;a=Vn(12596)|0;if(a|0){c[b>>2]=Pn(a)|0;Me(50172,b)}c[17645]=1;Dn(0,0,0,0)|0;c[17650]=0;c[17645]=0;a=Wn(12596)|0;if(!a){l=e;return}else{c[d>>2]=Pn(a)|0;Me(50247,d)}}function Sm(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;a=l;l=l+48|0;if((l|0)>=(m|0))$(48);b=a;p=c[17651]|0;o=c[17652]|0;n=c[17653]|0;k=c[17654]|0;j=c[17655]|0;i=c[17656]|0;h=c[17657]|0;g=c[17658]|0;f=c[17659]|0;e=c[17660]|0;d=(An()|0)!=0;c[b>>2]=600;c[b+4>>2]=p;c[b+8>>2]=o;c[b+12>>2]=n;c[b+16>>2]=k;c[b+20>>2]=j;c[b+24>>2]=i;c[b+28>>2]=h;c[b+32>>2]=g;c[b+36>>2]=f;c[b+40>>2]=e;c[b+44>>2]=d?50284:71847;Je(50300,b);l=a;return}function Tm(){c[17647]=1;return}function Um(){c[17661]=1;return}function Vm(a){a=a|0;return}function Wm(a){a=a|0;return 0}function Xm(){Qm();return c[17661]|0}function Ym(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+192|0;if((l|0)>=(m|0))$(192);j=o;k=b+600|0;if(!(c[17645]|0))Ie(50424,50439,615,50455);si(j);f=k;d=b+580|0;e=f+20|0;do{a[f>>0]=a[d>>0]|0;f=f+1|0;d=d+1|0}while((f|0)<(e|0));n=b+620|0;f=n;d=b;e=f+44|0;do{a[f>>0]=a[d>>0]|0;f=f+1|0;d=d+1|0}while((f|0)<(e|0));ti(j,k);f=b;d=k;e=f+20|0;do{a[f>>0]=a[d>>0]|0;f=f+1|0;d=d+1|0}while((f|0)<(e|0));if((c[17664]|0)!=0&(c[17646]|0)==(b|0)){a[b>>0]=a[b>>0]^a[71826];g=b+1|0;a[g>>0]=a[g>>0]^a[71827];g=b+2|0;a[g>>0]=a[g>>0]^a[71828];g=b+3|0;a[g>>0]=a[g>>0]^a[71829];g=b+4|0;a[g>>0]=a[g>>0]^a[71830];g=b+5|0;a[g>>0]=a[g>>0]^a[71831];g=b+6|0;a[g>>0]=a[g>>0]^a[71832];g=b+7|0;a[g>>0]=a[g>>0]^a[71833];g=b+8|0;a[g>>0]=a[g>>0]^a[71834];g=b+9|0;a[g>>0]=a[g>>0]^a[71835];g=b+10|0;a[g>>0]=a[g>>0]^a[71836];g=b+11|0;a[g>>0]=a[g>>0]^a[71837];g=b+12|0;a[g>>0]=a[g>>0]^a[71838];g=b+13|0;a[g>>0]=a[g>>0]^a[71839];g=b+14|0;a[g>>0]=a[g>>0]^a[71840];g=b+15|0;a[g>>0]=a[g>>0]^a[71841];g=b+16|0;a[g>>0]=a[g>>0]^a[71842];g=b+17|0;a[g>>0]=a[g>>0]^a[71843];g=b+18|0;a[g>>0]=a[g>>0]^a[71844];g=b+19|0;a[g>>0]=a[g>>0]^a[71845];g=1;h=0}else{g=1;h=0}do{f=k;d=b+h|0;e=f+20|0;do{a[f>>0]=a[d>>0]|0;f=f+1|0;d=d+1|0}while((f|0)<(e|0));f=h;h=h+20|0;i=b+h|0;d=f+40|0;if((f+104|0)<600){f=n;d=b+d|0;e=f+44|0;do{a[f>>0]=a[d>>0]|0;f=f+1|0;d=d+1|0}while((f|0)<(e|0))}else{e=20;while(1){d=(d|0)>599?0:d;a[k+e>>0]=a[b+d>>0]|0;e=e+1|0;if((e|0)==64)break;else d=d+1|0}}ti(j,k);f=i;d=k;e=f+20|0;do{a[f>>0]=a[d>>0]|0;f=f+1|0;d=d+1|0}while((f|0)<(e|0));g=g+1|0}while((g|0)!=30);if((c[17646]|0)!=(b|0)){Te(384);l=o;return}ui(71826,b,600);c[17664]=1;Te(384);l=o;return}function Zm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;N=l;l=l+832|0;if((l|0)>=(m|0))$(832);M=N+136|0;K=N+128|0;J=N+120|0;I=N+112|0;H=N+104|0;G=N+96|0;F=N+88|0;E=N+80|0;D=N+72|0;L=N+64|0;y=N+56|0;x=N+48|0;w=N+40|0;B=N+32|0;A=N+24|0;z=N+16|0;C=N+8|0;f=N;t=N+144|0;u=N+224|0;v=N+140|0;Qm();g=e>>>0>1&(c[17661]|0)!=0?1:e&3;e=Vn(12596)|0;if(e|0){c[f>>2]=Pn(e)|0;Me(50172,f)}c[17645]=1;if(g>>>0>1){c[17660]=(c[17660]|0)+d;c[17659]=(c[17659]|0)+1}else{c[17658]=(c[17658]|0)+d;c[17657]=(c[17657]|0)+1}a:do if(d|0){p=t+12|0;q=t+36|0;r=(g|0)!=2;o=(g|0)==2;n=d;k=d>>>0>600?600:d;b:while(1){j=b;i=k;while(1){c[v>>2]=qq()|0;if((c[3160]|0)==-1)c[3160]=c[v>>2];if((c[3160]|0)!=(c[v>>2]|0)){c[3160]=c[v>>2];d=c[3160]|0;if(!(c[17645]|0)){f=14;break b}c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;h=c[17662]|0;f=h+1|0;c[17662]=f;e=c[17646]|0;h=e+h|0;a[h>>0]=a[h>>0]^d&255;if(f>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0;f=c[17662]|0;e=c[17646]|0}g=f+1|0;c[17662]=g;h=e+f|0;a[h>>0]=a[h>>0]^d>>>8&255;if(g>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0;f=c[17662]|0;e=c[17646]|0}else f=g;h=f+1|0;c[17662]=h;g=e+f|0;a[g>>0]=a[g>>0]^d>>>16&255;if(h>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0}g=c[17662]|0;h=g+1|0;c[17662]=h;e=c[17646]|0;g=e+g|0;a[g>>0]=a[g>>0]^d>>>24&255;if(h>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=1}c[17663]=0}if(!(c[17645]|0)){f=19;break b}if(i>>>0>600){f=21;break b}c:do if(!(c[17650]|0)){e=c[17665]|0;d:do if(e|0){f=Bq(e,0,z)|0;if((f|0)==-1){e=zo()|0;if((c[e>>2]|0)==2){c[17666]=1;break}else{h=ze(50521)|0;g=c[17665]|0;d=dp(c[e>>2]|0)|0;c[A>>2]=g;c[A+4>>2]=d;Je(h,A);break}}if(_m(f,c[17665]|0,0)|0){Up(f)|0;break}if(mq(f,t)|0){h=ze(50542)|0;g=c[17665]|0;d=dp(c[(zo()|0)>>2]|0)|0;c[B>>2]=g;c[B+4>>2]=d;Je(h,B);Up(f)|0;break}if((c[p>>2]&61440|0)!=32768){h=ze(50563)|0;c[w>>2]=c[17665];Je(h,w);Up(f)|0;break}switch(c[q>>2]|0){case 0:{Je(ze(50601)|0,x);Up(f)|0;c[17666]=1;break d}case 600:{e:while(1){switch(pq(f,u,600)|0){case 600:break e;case -1:break;default:{f=38;break b}}e=zo()|0;if((c[e>>2]|0)!=4){f=40;break b}}Up(f)|0;if(!(c[17645]|0)){f=42;break b}c[17655]=(c[17655]|0)+600;c[17654]=(c[17654]|0)+1;e=u;g=599;while(1){O=a[e>>0]|0;d=c[17662]|0;h=d+1|0;c[17662]=h;f=c[17646]|0;d=f+d|0;a[d>>0]=a[d>>0]^O;if(h>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=(g|0)==0&1}if(!g)break;else{e=e+1|0;g=g+-1|0}}d=qq()|0;if(!(c[17645]|0)){f=48;break b}c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;O=c[17662]|0;e=O+1|0;c[17662]=e;f=c[17646]|0;O=f+O|0;a[O>>0]=a[O>>0]^d&255;if(e>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;e=c[17662]|0;f=c[17646]|0}g=e+1|0;c[17662]=g;O=f+e|0;a[O>>0]=a[O>>0]^d>>>8&255;if(g>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;g=c[17662]|0;e=c[17646]|0}else e=f;O=g+1|0;c[17662]=O;h=e+g|0;a[h>>0]=a[h>>0]^d>>>16&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0}h=c[17662]|0;O=h+1|0;c[17662]=O;e=c[17646]|0;h=e+h|0;a[h>>0]=a[h>>0]^d>>>24&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=1}d=fb(0)|0;if(!(c[17645]|0)){f=52;break b}c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;O=c[17662]|0;e=O+1|0;c[17662]=e;f=c[17646]|0;O=f+O|0;a[O>>0]=a[O>>0]^d&255;if(e>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;e=c[17662]|0;f=c[17646]|0}g=e+1|0;c[17662]=g;O=f+e|0;a[O>>0]=a[O>>0]^d>>>8&255;if(g>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;g=c[17662]|0;e=c[17646]|0}else e=f;O=g+1|0;c[17662]=O;h=e+g|0;a[h>>0]=a[h>>0]^d>>>16&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0}h=c[17662]|0;O=h+1|0;c[17662]=O;e=c[17646]|0;h=e+h|0;a[h>>0]=a[h>>0]^d>>>24&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=1}d=Qa()|0;if(!(c[17645]|0)){f=56;break b}c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;O=c[17662]|0;e=O+1|0;c[17662]=e;f=c[17646]|0;O=f+O|0;a[O>>0]=a[O>>0]^d&255;if(e>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;e=c[17662]|0;f=c[17646]|0}g=e+1|0;c[17662]=g;O=f+e|0;a[O>>0]=a[O>>0]^d>>>8&255;if(g>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;g=c[17662]|0;e=c[17646]|0}else e=f;O=g+1|0;c[17662]=O;h=e+g|0;a[h>>0]=a[h>>0]^d>>>16&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0}h=c[17662]|0;O=h+1|0;c[17662]=O;e=c[17646]|0;h=e+h|0;a[h>>0]=a[h>>0]^d>>>24&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=1}if(!(c[17649]|0)){f=60;break b}if((Dn(3,0,16,0)|0)<0){f=62;break b}c[17666]=1;c[17650]=1;break c}default:{Je(ze(50634)|0,y);Up(f)|0;break d}}}while(0)}while(0);if(!(r|(c[17667]|0)!=0)){c[17668]=0;e=i>>>0<16?16:i;if(!(c[17649]|0)){f=85;break b}if((Dn(3,4,e,2)|0)<0){f=87;break b}c[17668]=(c[17668]|0)+e;c[17667]=1}if(o?(s=c[17668]|0,s>>>0>>0):0){if((s|0)<0){c[17668]=0;e=0}else e=s;e=i-e|0;if(e>>>0>600){f=94;break b}if(!(c[17649]|0)){f=96;break b}if((Dn(3,4,e,2)|0)<0){f=98;break b}c[17668]=(c[17668]|0)+e}while(1){if(c[17650]|0)break;c[17652]=(c[17652]|0)+1;if(!(c[17649]|0)){f=102;break b}if((Dn(3,3,120,1)|0)<0){f=104;break b}}an();d=c[3160]|0;if(!(c[17645]|0)){f=106;break b}c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;O=c[17662]|0;e=O+1|0;c[17662]=e;f=c[17646]|0;O=f+O|0;a[O>>0]=a[O>>0]^d&255;if(e>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;e=c[17662]|0;f=c[17646]|0}g=e+1|0;c[17662]=g;O=f+e|0;a[O>>0]=a[O>>0]^d>>>8&255;if(g>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;g=c[17662]|0;e=c[17646]|0}else e=f;O=g+1|0;c[17662]=O;h=e+g|0;a[h>>0]=a[h>>0]^d>>>16&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0}h=c[17662]|0;O=h+1|0;c[17662]=O;e=c[17646]|0;h=e+h|0;a[h>>0]=a[h>>0]^d>>>24&255;if(O>>>0<=599){if(!(c[17663]|0)){Ym(e);c[17651]=(c[17651]|0)+1}}else{c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=1}d=c[17646]|0;e=c[17648]|0;f=d;g=0;while(1){c[e>>2]=(c[f>>2]|0)+-1515870811;g=g+1|0;if((g|0)==150)break;else{e=e+4|0;f=f+4|0}}Ym(d);c[17651]=(c[17651]|0)+1;Ym(c[17648]|0);c[17656]=(c[17656]|0)+1;e=i+-1|0;if(!i){h=j;i=e;e=c[17668]|0}else{g=c[17648]|0;h=c[17668]|0;f=j;d=c[17669]|0;while(1){O=d+1|0;a[f>>0]=a[g+d>>0]|0;d=O>>>0>599?0:O;if(!e)break;else{f=f+1|0;e=e+-1|0}}e=h-i|0;c[17669]=d;c[17668]=e;h=j+i|0;i=-1}if((e|0)<0)c[17668]=0;Yq(c[17648]|0,0,600)|0;O=qq()|0;if((O|0)==(c[v>>2]|0))break;d=qq()|0;if(!(c[17645]|0)){f=122;break b}c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;O=c[17662]|0;e=O+1|0;c[17662]=e;f=c[17646]|0;O=f+O|0;a[O>>0]=a[O>>0]^d&255;if(e>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;e=c[17662]|0;f=c[17646]|0}g=e+1|0;c[17662]=g;O=f+e|0;a[O>>0]=a[O>>0]^d>>>8&255;if(g>>>0>599){c[17662]=0;Ym(f);c[17651]=(c[17651]|0)+1;c[17663]=0;g=c[17662]|0;e=c[17646]|0}else e=f;O=g+1|0;c[17662]=O;j=e+g|0;a[j>>0]=a[j>>0]^d>>>16&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=0}j=c[17662]|0;O=j+1|0;c[17662]=O;e=c[17646]|0;j=e+j|0;a[j>>0]=a[j>>0]^d>>>24&255;if(O>>>0>599){c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=1}c[17663]=0;c[3160]=d;j=h}e=n-k|0;if(!e)break a;if(!(c[17645]|0)){f=9;break}else{b=b+k|0;n=e;k=e>>>0>600?600:e}}switch(f|0){case 9:{Ie(50424,50439,934,50464);break}case 14:{Ie(50424,50439,1074,50474);break}case 19:{Ie(50424,50439,953,50464);break}case 21:{Ne(50489,C);break}case 38:{J=zo()|0;O=ze(50688)|0;K=c[17665]|0;J=c[J>>2]|0;J=dp(J)|0;c[L>>2]=K;K=L+4|0;c[K>>2]=J;Me(O,L);break}case 40:{O=ze(50688)|0;K=c[17665]|0;J=c[e>>2]|0;J=dp(J)|0;c[L>>2]=K;K=L+4|0;c[K>>2]=J;Me(O,L);break}case 42:{Ie(50424,50439,1074,50474);break}case 48:{Ie(50424,50439,1074,50474);break}case 52:{Ie(50424,50439,1074,50474);break}case 56:{Ie(50424,50439,1074,50474);break}case 60:{Me(50709,D);break}case 62:{Me(50760,E);break}case 85:{Me(50709,F);break}case 87:{Me(50760,G);break}case 94:{He(50439,995,50464);break}case 96:{Me(50709,H);break}case 98:{Me(50760,I);break}case 102:{Me(50709,J);break}case 104:{Me(50760,K);break}case 106:{Ie(50424,50439,1074,50474);break}case 122:{Ie(50424,50439,1074,50474);break}}}while(0);c[17645]=0;e=Wn(12596)|0;if(!e){l=N;return}else{c[M>>2]=Pn(e)|0;Me(50247,M)}}function _m(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+64|0;if((l|0)>=(m|0))$(64);n=p+24|0;k=p+16|0;j=p+8|0;g=p;h=p+40|0;i=p+32|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;b[h>>1]=(e|0)!=0&1;b[h+2>>1]=0;c[g>>2]=h;if((jq(a,13,g)|0)!=-1){o=0;l=p;return o|0}f=zo()|0;g=i+4|0;e=0;a:while(1){switch(c[f>>2]|0){case 13:case 11:break;default:break a}if((e|0)>2){q=ze(50839)|0;c[k>>2]=d;Je(q,k)}c[i>>2]=e;c[g>>2]=25e4;nq(0,0,0,0,i)|0;c[n>>2]=h;if((jq(a,13,n)|0)==-1)e=((e|0)<10&1)+e|0;else{e=0;o=8;break}}if((o|0)==8){l=p;return e|0}q=ze(50818)|0;o=dp(c[f>>2]|0)|0;c[j>>2]=d;c[j+4>>2]=o;Je(q,j);q=-1;l=p;return q|0}function $m(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if(!(c[17645]|0))Ie(50424,50439,1074,50474);c[17655]=(c[17655]|0)+d;c[17654]=(c[17654]|0)+1;f=d+-1|0;if(!d)return;if(e>>>0<3){while(1){h=a[b>>0]|0;g=c[17662]|0;e=g+1|0;c[17662]=e;d=c[17646]|0;g=d+g|0;a[g>>0]=a[g>>0]^h;if(e>>>0>599){c[17662]=0;Ym(d);c[17651]=(c[17651]|0)+1;c[17663]=(f|0)==0&1}if(!f)break;else{b=b+1|0;f=f+-1|0}}return}else d=0;while(1){i=a[b>>0]|0;b=b+1|0;g=c[17662]|0;h=g+1|0;c[17662]=h;e=c[17646]|0;g=e+g|0;a[g>>0]=a[g>>0]^i;d=d+1|0;if(h>>>0>599){if(!(c[17650]|0)){i=(c[17670]|0)+d|0;c[17670]=i;if(i>>>0>599){c[17650]=1;d=0}else d=0}c[17662]=0;Ym(e);c[17651]=(c[17651]|0)+1;c[17663]=(f|0)==0&1}if(!f)break;else f=f+-1|0}return}function an(){var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;h=l;l=l+144|0;if((l|0)>=(m|0))$(144);g=h;if(!(c[17645]|0))Ie(50424,50439,1180,50798);c[17653]=(c[17653]|0)+1;if(gb(g|0,0)|0)He(50439,1198,50798);if(!(c[17645]|0))Ie(50424,50439,1074,50474);c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;e=a[g>>0]|0;f=c[17662]|0;b=f+1|0;c[17662]=b;d=c[17646]|0;f=d+f|0;a[f>>0]=a[f>>0]^e;if(b>>>0>599){c[17662]=0;Ym(d);c[17651]=(c[17651]|0)+1;c[17663]=0;b=c[17662]|0;d=c[17646]|0}i=a[g+1>>0]|0;e=b+1|0;c[17662]=e;f=d+b|0;a[f>>0]=a[f>>0]^i;if(e>>>0>599){c[17662]=0;Ym(d);c[17651]=(c[17651]|0)+1;c[17663]=0;e=c[17662]|0;b=c[17646]|0}else b=d;d=a[g+2>>0]|0;i=e+1|0;c[17662]=i;f=b+e|0;a[f>>0]=a[f>>0]^d;if(i>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0}e=a[g+3>>0]|0;f=c[17662]|0;i=f+1|0;c[17662]=i;b=c[17646]|0;f=b+f|0;a[f>>0]=a[f>>0]^e;if(i>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=1}if(!(c[17645]|0))Ie(50424,50439,1074,50474);f=g+4|0;c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;e=a[f>>0]|0;i=c[17662]|0;d=i+1|0;c[17662]=d;b=c[17646]|0;i=b+i|0;a[i>>0]=a[i>>0]^e;if(d>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0;d=c[17662]|0;b=c[17646]|0}j=a[f+1>>0]|0;e=d+1|0;c[17662]=e;i=b+d|0;a[i>>0]=a[i>>0]^j;if(e>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0;d=c[17662]|0;b=c[17646]|0}else d=e;e=a[f+2>>0]|0;j=d+1|0;c[17662]=j;i=b+d|0;a[i>>0]=a[i>>0]^e;if(j>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0}f=a[f+3>>0]|0;i=c[17662]|0;j=i+1|0;c[17662]=j;b=c[17646]|0;i=b+i|0;a[i>>0]=a[i>>0]^f;if(j>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=1}Gq(0,g)|0;if(!(c[17645]|0))Ie(50424,50439,1074,50474);c[17655]=(c[17655]|0)+136;c[17654]=(c[17654]|0)+1;b=g;e=135;while(1){f=a[b>>0]|0;i=c[17662]|0;j=i+1|0;c[17662]=j;d=c[17646]|0;i=d+i|0;a[i>>0]=a[i>>0]^f;if(j>>>0>599){c[17662]=0;Ym(d);c[17651]=(c[17651]|0)+1;c[17663]=(e|0)==0&1}if(!e)break;else{b=b+1|0;e=e+-1|0}}f=fb(0)|0;c[g>>2]=f;if(!(c[17645]|0))Ie(50424,50439,1074,50474);c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;j=c[17662]|0;d=j+1|0;c[17662]=d;b=c[17646]|0;j=b+j|0;a[j>>0]=a[j>>0]^f&255;if(d>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0;d=c[17662]|0;b=c[17646]|0}e=d+1|0;c[17662]=e;j=b+d|0;a[j>>0]=a[j>>0]^f>>>8&255;if(e>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0;d=c[17662]|0;b=c[17646]|0}else d=e;j=d+1|0;c[17662]=j;i=b+d|0;a[i>>0]=a[i>>0]^f>>>16&255;if(j>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0}f=a[g+3>>0]|0;i=c[17662]|0;j=i+1|0;c[17662]=j;b=c[17646]|0;i=b+i|0;a[i>>0]=a[i>>0]^f;if(j>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=1}f=Qa()|0;c[g>>2]=f;if(!(c[17645]|0))Ie(50424,50439,1074,50474);c[17655]=(c[17655]|0)+4;c[17654]=(c[17654]|0)+1;j=c[17662]|0;b=j+1|0;c[17662]=b;d=c[17646]|0;j=d+j|0;a[j>>0]=a[j>>0]^f&255;if(b>>>0>599){c[17662]=0;Ym(d);c[17651]=(c[17651]|0)+1;c[17663]=0;b=c[17662]|0;d=c[17646]|0}e=b+1|0;c[17662]=e;j=d+b|0;a[j>>0]=a[j>>0]^f>>>8&255;if(e>>>0>599){c[17662]=0;Ym(d);c[17651]=(c[17651]|0)+1;c[17663]=0;e=c[17662]|0;b=c[17646]|0}else b=d;j=e+1|0;c[17662]=j;i=b+e|0;a[i>>0]=a[i>>0]^f>>>16&255;if(j>>>0>599){c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=0}g=a[g+3>>0]|0;i=c[17662]|0;j=i+1|0;c[17662]=j;b=c[17646]|0;i=b+i|0;a[i>>0]=a[i>>0]^g;if(j>>>0<=599){l=h;return}c[17662]=0;Ym(b);c[17651]=(c[17651]|0)+1;c[17663]=1;l=h;return}function bn(a){a=a|0;if(!(c[17665]|0)){c[17665]=mf(a)|0;return}else He(50439,673,50868)}function cn(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+80|0;if((l|0)>=(m|0))$(80);p=q+72|0;n=q+64|0;k=q+56|0;j=q+48|0;i=q+40|0;h=q+32|0;g=q+24|0;f=q+16|0;d=q+8|0;b=q;if(!(c[17644]|0))c[17644]=1;a=Vn(12596)|0;if(a|0){c[b>>2]=Pn(a)|0;Me(50172,b)}c[17645]=1;e=c[17646]|0;if(!((c[17665]|0)!=0&(e|0)!=0&(c[17650]|0)!=0)){c[17645]=0;a=Wn(12596)|0;if(!a){l=q;return}else{c[d>>2]=Pn(a)|0;Me(50247,d)}}if(!(c[17666]|0)){c[17645]=0;a=Wn(12596)|0;if(a|0){c[f>>2]=Pn(a)|0;Me(50247,f)}Je(ze(50898)|0,g);l=q;return}a=e;b=c[17648]|0;d=0;while(1){c[b>>2]=(c[a>>2]|0)+-1515870811;d=d+1|0;if((d|0)==150)break;else{a=a+4|0;b=b+4|0}}Ym(e);c[17651]=(c[17651]|0)+1;Ym(c[17648]|0);c[17656]=(c[17656]|0)+1;b=c[17665]|0;c[h>>2]=384;b=Bq(b,65,h)|0;do if((b|0)!=-1){if(_m(b,c[17665]|0,1)|0){Up(b)|0;break}if(yq(b,0)|0){o=ze(50957)|0;k=c[17665]|0;n=dp(c[(zo()|0)>>2]|0)|0;c[j>>2]=k;c[j+4>>2]=n;Je(o,j);Up(b)|0;break}a:while(1){switch(oq(b,c[17648]|0,600)|0){case 600:break a;case -1:break;default:{o=21;break a}}a=zo()|0;if((c[a>>2]|0)!=4){o=23;break}}if((o|0)==21){a=zo()|0;o=23}if((o|0)==23){o=ze(50957)|0;i=c[17665]|0;j=dp(c[a>>2]|0)|0;c[k>>2]=i;c[k+4>>2]=j;Je(o,k)}if(Up(b)|0){o=ze(50979)|0;j=c[17665]|0;k=dp(c[(zo()|0)>>2]|0)|0;c[n>>2]=j;c[n+4>>2]=k;Je(o,n)}}else{o=ze(50934)|0;k=c[17665]|0;n=dp(c[(zo()|0)>>2]|0)|0;c[i>>2]=k;c[i+4>>2]=n;Je(o,i)}while(0);c[17645]=0;a=Wn(12596)|0;if(!a){l=q;return}else{c[p>>2]=Pn(a)|0;Me(50247,p)}}function dn(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e+8|0;b=e;if(!(c[17644]|0))c[17644]=1;a=Vn(12596)|0;if(a|0){c[b>>2]=Pn(a)|0;Me(50172,b)}c[17645]=1;if(c[17646]|0)an();c[17645]=0;a=Wn(12596)|0;if(!a){l=e;return}else{c[d>>2]=Pn(a)|0;Me(50247,d)}}function en(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;j=l;l=l+48|0;if((l|0)>=(m|0))$(48);i=j+32|0;h=j+24|0;g=j+16|0;f=j+8|0;d=j;if(!(c[17671]|0)){c[17671]=1;c[17672]=0}if(!b){l=j;return}b=Vn(12644)|0;if(b|0){c[d>>2]=Pn(b)|0;Me(51001,d)}c[17672]=1;if(c[17673]|0){b=c[17674]|0;if(c[b+52>>2]|0)Ie(51037,51065,767,51079);d=c[17675]|0;if(c[d+52>>2]|0)Ie(51104,51065,768,51079);e=c[17676]|0;if(c[e+52>>2]|0)Ie(51134,51065,769,51079);if((a[b>>0]|0)!=17){c[f>>2]=b;Me(51167,f)}if((a[b+16>>0]|0)!=42){c[f>>2]=b;Me(51167,f)}if((a[b+33>>0]|0)!=-119){c[f>>2]=b;Me(51167,f)}if((a[b+50>>0]|0)!=-4){c[f>>2]=b;Me(51167,f)}if((a[d>>0]|0)!=17){c[g>>2]=d;Me(51167,g)}if((a[d+16>>0]|0)!=42){c[g>>2]=d;Me(51167,g)}if((a[d+33>>0]|0)!=-119){c[g>>2]=d;Me(51167,g)}if((a[d+50>>0]|0)!=-4){c[g>>2]=d;Me(51167,g)}if((a[e>>0]|0)!=17){c[h>>2]=e;Me(51167,h)}if((a[e+16>>0]|0)!=42){c[h>>2]=e;Me(51167,h)}if((a[e+33>>0]|0)!=-119){c[h>>2]=e;Me(51167,h)}if((a[e+50>>0]|0)!=-4){c[h>>2]=e;Me(51167,h)}}else{c[17673]=jf(48)|0;h=kf(1,68)|0;c[17674]=h;a[h>>0]=17;a[h+16>>0]=42;a[h+33>>0]=-119;a[h+50>>0]=-4;h=lf(1,68)|0;c[17675]=h;a[h>>0]=17;a[h+16>>0]=42;a[h+33>>0]=-119;a[h+50>>0]=-4;h=lf(1,68)|0;c[17676]=h;a[h>>0]=17;a[h+16>>0]=42;a[h+33>>0]=-119;a[h+50>>0]=-4}c[17672]=0;b=Wn(12644)|0;if(!b){l=j;return}else{c[i>>2]=Pn(b)|0;Me(51213,i)}}function fn(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e+8|0;b=e;a=Vn(12644)|0;if(a|0){c[b>>2]=Pn(a)|0;Me(51001,b)}c[17672]=1;Dn(0,0,0,0)|0;c[17672]=0;a=Wn(12644)|0;if(!a){l=e;return}else{c[d>>2]=Pn(a)|0;Me(51213,d)}}function gn(){return}function hn(){return 0}function jn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=h+8|0;f=h;en(1);e=Vn(12644)|0;if(e|0){c[f>>2]=Pn(e)|0;Me(51001,f)}c[17672]=1;if((d|0)==2)kn(a,b,c[17676]|0);else kn(a,b,c[17675]|0);c[17672]=0;a=Wn(12644)|0;if(!a){l=h;return}else{c[g>>2]=Pn(a)|0;Me(51213,g)}}function kn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+32|0;if((l|0)>=(m|0))$(32);n=o+16|0;k=o+8|0;f=o;if(!b)Ie(52320,51065,685,52343);if(!e)Ie(51249,51065,686,52343);if((a[e>>0]|0)!=17){c[f>>2]=e;Me(51167,f)}j=e+16|0;if((a[j>>0]|0)!=42){c[f>>2]=e;Me(51167,f)}h=e+33|0;if((a[h>>0]|0)!=-119){c[f>>2]=e;Me(51167,f)}i=e+50|0;if((a[i>>0]|0)!=-4){c[f>>2]=e;Me(51167,f)}f=e+4|0;do if(!(c[f>>2]|0)){if((c[17674]|0)==(e|0))g=ln(1)|0;else g=ln(0)|0;c[f>>2]=g;if(!g)Me(51311,n);else{c[e+60>>2]=qq()|0;break}}while(0);if(!(a[e+8>>0]&1))mn(e);g=c[e+60>>2]|0;if((g|0)==(qq()|0)?(g=c[e+64>>2]|0,(g|0)==(qq()|0)):0){if(nn(b,d,e)|0)Me(51311,n);if((a[e>>0]|0)!=17){c[k>>2]=e;Me(51167,k)}if((a[j>>0]|0)!=42){c[k>>2]=e;Me(51167,k)}if((a[h>>0]|0)!=-119){c[k>>2]=e;Me(51167,k)}if((a[i>>0]|0)==-4){l=o;return}else{c[k>>2]=e;Me(51167,k)}}kg(51065,714,52343,0,51257);Me(51311,n)}function ln(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;o=l;l=l+16|0;if((l|0)>=(m|0))$(16);n=o+8|0;e=o;k=o+12|0;if(!(c[17672]|0))Ie(51340,51065,596,51674);d=vg(k,7,1,1)|0;if(d|0){c[e>>2]=Pn(d)|0;Le(51692,e);n=0;l=o;return n|0}if(!b)i=pn()|0;else{i=gf(16)|0;kn(i,16,c[17675]|0)}j=Ag(c[k>>2]|0,i,16)|0;if(i&7){b=16;d=i;do{a[d>>0]=0;d=d+1|0;b=b+-1|0}while((b|0)!=0&(d&7|0)!=0);if(b>>>0>=8)f=11}else{b=16;d=i;f=11}if((f|0)==11){f=b+-8|0;g=f&-8;h=g+8|0;e=d;while(1){p=e;c[p>>2]=0;c[p+4>>2]=0;b=b+-8|0;if(b>>>0<=7)break;else e=e+8|0}b=f-g|0;d=d+h|0}if(b|0)while(1){a[d>>0]=0;b=b+-1|0;if(!b)break;else d=d+1|0}cf(i);if(!j){p=c[k>>2]|0;l=o;return p|0}else{c[n>>2]=Pn(j)|0;Le(51735,n);xg(c[k>>2]|0);p=0;l=o;return p|0}return 0}function mn(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;if(!(c[17672]|0))Ie(51340,51065,658,51556);d=b+17|0;if((c[17674]|0)==(b|0)){kn(d,16,c[17675]|0);i=b+8|0;a[i>>0]=a[i>>0]|1;c[b+64>>2]=qq()|0;return}i=pn()|0;e=i;f=d+16|0;do{a[d>>0]=a[e>>0]|0;d=d+1|0;e=e+1|0}while((d|0)<(f|0));if(i&7){e=16;d=i;do{a[d>>0]=0;d=d+1|0;e=e+-1|0}while((e|0)!=0&(d&7|0)!=0);if(e>>>0>=8)g=8}else{d=i;e=16;g=8}if((g|0)==8){g=e+-8|0;h=g&-8;f=d;while(1){j=f;c[j>>2]=0;c[j+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else f=f+8|0}d=d+(h+8)|0;e=g-h|0}if(e|0)while(1){a[d>>0]=0;e=e+-1|0;if(!e)break;else d=d+1|0}cf(i);j=b+8|0;a[j>>0]=a[j>>0]|1;c[b+64>>2]=qq()|0;return}function nn(d,e,f){d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0;eb=l;l=l+64|0;if((l|0)>=(m|0))$(64);cb=eb+24|0;bb=eb+16|0;ab=eb+8|0;$a=eb;J=eb+32|0;U=eb+40|0;if(!(c[17672]|0))Ie(51340,51065,444,51359);ya=f+4|0;if(!(c[ya>>2]|0))Ie(51375,51065,445,51359);o=f+8|0;if(!(a[o>>0]&1))Ie(51394,51065,446,51359);u=c[17673]|0;if(!u)Ie(51413,51065,448,51359);v=u+16|0;w=u+32|0;if(!e){db=0;l=eb;return db|0}x=f+52|0;y=f+12|0;z=J+4|0;A=U+1|0;B=U+2|0;C=U+3|0;D=U+4|0;E=U+5|0;F=U+6|0;G=U+7|0;H=U+8|0;I=U+9|0;K=U+10|0;L=U+11|0;M=U+12|0;N=U+13|0;O=U+14|0;P=U+15|0;Q=f+17|0;R=u+1|0;S=f+18|0;T=u+17|0;V=u+2|0;W=f+19|0;X=u+18|0;Y=u+3|0;Z=f+20|0;_=u+19|0;aa=u+4|0;ba=f+21|0;ca=u+20|0;da=u+5|0;ea=f+22|0;fa=u+21|0;ga=u+6|0;ha=f+23|0;ia=u+22|0;ja=u+7|0;ka=f+24|0;la=u+23|0;ma=u+8|0;na=f+25|0;oa=u+24|0;pa=u+9|0;qa=f+26|0;ra=u+25|0;sa=u+10|0;ta=f+27|0;ua=u+26|0;va=u+11|0;wa=f+28|0;xa=u+27|0;za=u+12|0;Aa=f+29|0;Ba=u+28|0;Ca=u+13|0;Da=f+30|0;Ea=u+29|0;Fa=u+14|0;Ga=f+31|0;Ha=u+30|0;Ia=u+15|0;Ja=f+32|0;Ka=u+31|0;La=u+33|0;Ma=u+34|0;Na=u+35|0;Oa=u+36|0;Pa=u+37|0;Qa=u+38|0;Ra=u+39|0;Sa=u+40|0;Ta=u+41|0;Ua=u+42|0;Va=u+43|0;Wa=u+44|0;Xa=u+45|0;Ya=u+46|0;Za=u+47|0;_a=(u&7|0)==0;p=(v&7|0)==0;q=f+51|0;r=f+34|0;s=f+56|0;t=(w&7|0)==0;a:while(1){while(1){if((c[x>>2]|0)==0?(c[y>>2]|0)>>>0>1e3:0){mn(f);c[y>>2]=0}if(!(c[17672]|0)){db=16;break a}g=c[x>>2]|0;if((g|0)==0|(c[17674]|0)==(f|0)|(c[17675]|0)==(f|0)|(c[17676]|0)==(f|0)){if(!(c[17677]|0)){c[17678]=qq()|0;c[17679]=zq()|0}if(gb(J|0,0)|0){db=22;break a}g=c[z>>2]|0;h=g<<4;i=c[J>>2]|0;if((i|0)==(c[17677]|0)&(h|0)==(c[17680]|0)){j=(b[35680]|0)+1&4095;b[35680]=j}else{b[35680]=0;c[17677]=i;c[17680]=h;j=0}a[U>>0]=i>>>24;a[A>>0]=i>>>16;a[B>>0]=i>>>8;a[C>>0]=i;a[D>>0]=g>>>12;a[E>>0]=g>>>4;a[F>>0]=(j&65535)>>>8&15|h;a[G>>0]=j;g=c[17678]|0;a[H>>0]=g>>>24;a[I>>0]=g>>>16;a[K>>0]=g>>>8;a[L>>0]=g;n=c[17679]|0;a[M>>0]=n>>>24;a[N>>0]=n>>>16;a[O>>0]=n>>>8;a[P>>0]=n;n=n+1|0;c[17679]=n;if(!n)c[17678]=g+1}else{j=U;i=j+15|0;do{a[j>>0]=a[g>>0]|0;j=j+1|0;g=g+1|0}while((j|0)<(i|0));n=c[s>>2]|0;a[M>>0]=n>>>24;a[N>>0]=n>>>16;a[O>>0]=n>>>8;a[P>>0]=n;c[s>>2]=n+1}h=c[ya>>2]|0;g=yg(h,u,16,U,16)|0;if(g|0){db=30;break a}a[v>>0]=a[Q>>0]^a[u>>0];a[T>>0]=a[S>>0]^a[R>>0];a[X>>0]=a[W>>0]^a[V>>0];a[_>>0]=a[Z>>0]^a[Y>>0];a[ca>>0]=a[ba>>0]^a[aa>>0];a[fa>>0]=a[ea>>0]^a[da>>0];a[ia>>0]=a[ha>>0]^a[ga>>0];a[la>>0]=a[ka>>0]^a[ja>>0];a[oa>>0]=a[na>>0]^a[ma>>0];a[ra>>0]=a[qa>>0]^a[pa>>0];a[ua>>0]=a[ta>>0]^a[sa>>0];a[xa>>0]=a[wa>>0]^a[va>>0];a[Ba>>0]=a[Aa>>0]^a[za>>0];a[Ea>>0]=a[Da>>0]^a[Ca>>0];a[Ha>>0]=a[Ga>>0]^a[Fa>>0];a[Ka>>0]=a[Ja>>0]^a[Ia>>0];g=yg(h,w,16,v,16)|0;if(g|0){db=32;break a}a[v>>0]=a[u>>0]^a[w>>0];a[T>>0]=a[R>>0]^a[La>>0];a[X>>0]=a[V>>0]^a[Ma>>0];a[_>>0]=a[Y>>0]^a[Na>>0];a[ca>>0]=a[aa>>0]^a[Oa>>0];a[fa>>0]=a[da>>0]^a[Pa>>0];a[ia>>0]=a[ga>>0]^a[Qa>>0];a[la>>0]=a[ja>>0]^a[Ra>>0];a[oa>>0]=a[ma>>0]^a[Sa>>0];a[ra>>0]=a[pa>>0]^a[Ta>>0];a[ua>>0]=a[sa>>0]^a[Ua>>0];a[xa>>0]=a[va>>0]^a[Va>>0];a[Ba>>0]=a[za>>0]^a[Wa>>0];a[Ea>>0]=a[Ca>>0]^a[Xa>>0];a[Ha>>0]=a[Fa>>0]^a[Ya>>0];a[Ka>>0]=a[Ia>>0]^a[Za>>0];g=yg(h,Q,16,v,16)|0;if(g|0){db=35;break a}if(!_a){g=u;h=16;do{a[g>>0]=0;g=g+1|0;h=h+-1|0}while((h|0)!=0&(g&7|0)!=0);if(h>>>0>=8)db=38}else{g=u;h=16;db=38}if((db|0)==38){db=0;j=h+-8|0;k=j&-8;i=g;while(1){n=i;c[n>>2]=0;c[n+4>>2]=0;h=h+-8|0;if(h>>>0<=7)break;else i=i+8|0}g=g+(k+8)|0;h=j-k|0}if(h|0)while(1){a[g>>0]=0;h=h+-1|0;if(!h)break;else g=g+1|0}if(!p){g=16;h=v;do{a[h>>0]=0;h=h+1|0;g=g+-1|0}while((g|0)!=0&(h&7|0)!=0);if(g>>>0>=8)db=46}else{g=16;h=v;db=46}if((db|0)==46){db=0;j=g+-8|0;k=j&-8;i=h;while(1){n=i;c[n>>2]=0;c[n+4>>2]=0;g=g+-8|0;if(g>>>0<=7)break;else i=i+8|0}g=j-k|0;h=h+(k+8)|0}if(g|0)while(1){a[h>>0]=0;g=g+-1|0;if(!g)break;else h=h+1|0}c[y>>2]=(c[y>>2]|0)+1;if(a[q>>0]|0?!((c[x>>2]|0)==0|(c[17674]|0)==(f|0)|(c[17675]|0)==(f|0)|(c[17676]|0)==(f|0)):0){db=58;break}h=a[o>>0]|0;if(h&2){db=55;break}j=r;g=w;i=j+16|0;do{a[j>>0]=a[g>>0]|0;j=j+1|0;g=g+1|0}while((j|0)<(i|0));a[o>>0]=h|2}if((db|0)==55){db=0;if(!(Tp(r,w,16)|0)){db=56;break}h=e>>>0<16?e:16;j=r;g=w;i=j+16|0;do{a[j>>0]=a[g>>0]|0;j=j+1|0;g=g+1|0}while((j|0)<(i|0));n=h}else if((db|0)==58){db=0;n=e>>>0<16?e:16}cr(d|0,w|0,n|0)|0;if(!t){g=16;h=w;do{a[h>>0]=0;h=h+1|0;g=g+-1|0}while((g|0)!=0&(h&7|0)!=0);if(g>>>0>=8)db=62}else{g=16;h=w;db=62}if((db|0)==62){db=0;i=g+-8|0;j=i&-8;k=h+8|0;while(1){fb=h;c[fb>>2]=0;c[fb+4>>2]=0;g=g+-8|0;if(g>>>0<=7)break;else h=h+8|0}g=i-j|0;h=k+j|0}if(g|0)while(1){a[h>>0]=0;g=g+-1|0;if(!g)break;else h=h+1|0}e=e-n|0;if(!e){d=0;db=68;break}else d=d+n|0}if((db|0)==16)Ie(51340,51065,274,51443);else if((db|0)==22){c[$a>>2]=dp(c[(zo()|0)>>2]|0)|0;Me(51455,$a)}else if((db|0)==30){c[ab>>2]=on(g)|0;Me(51482,ab)}else if((db|0)==32){c[bb>>2]=on(g)|0;Me(51482,bb)}else if((db|0)==35){c[cb>>2]=on(g)|0;Me(51482,cb)}else if((db|0)==56){kg(51065,502,51359,0,51516);fb=-1;l=eb;return fb|0}else if((db|0)==68){l=eb;return d|0}return 0}function on(a){a=a|0;return Pn(a)|0}function pn(){var a=0,b=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);a=b;if(c[17681]|0)Ie(51568,51065,552,51592);c[17681]=jf(16)|0;c[17682]=16;c[17683]=0;if((Dn(4,0,16,2)|0)>=0?(c[17683]|0)==(c[17682]|0):0){a=c[17681]|0;c[17681]=0;l=b;return a|0}cf(c[17681]|0);c[17681]=0;Me(51604,a);return 0}function qn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if(!(c[17672]|0))Ie(51340,51065,531,51632);f=c[17681]|0;if(!f)Ie(51651,51065,532,51632);if(!d)return;g=c[17682]|0;e=d;d=c[17683]|0;while(1){e=e+-1|0;if(d>>>0>=g>>>0){e=9;break}i=a[b>>0]|0;h=d;d=d+1|0;c[17683]=d;h=f+h|0;a[h>>0]=a[h>>0]^i;if(!e){e=9;break}else b=b+1|0}if((e|0)==9)return}function rn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=g+8|0;e=g;en(1);d=Vn(12644)|0;if(d|0){c[e>>2]=Pn(d)|0;Me(51001,e)}c[17672]=1;kn(a,b,c[17674]|0);c[17672]=0;a=Wn(12644)|0;if(!a){l=g;return}else{c[f>>2]=Pn(a)|0;Me(51213,f)}}function sn(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=l;l=l+48|0;if((l|0)>=(m|0))$(48);y=z+24|0;x=z+16|0;s=z+8|0;f=z;q=z+32|0;Dj(q,8,1);if(!(c[17673]|0))Ie(51413,51065,912,51767);t=kf(1,68)|0;a[t>>0]=17;u=t+16|0;a[u>>0]=42;v=t+33|0;a[v>>0]=-119;w=t+50|0;a[w>>0]=-4;e=Vn(12644)|0;if(e|0){c[f>>2]=Pn(e)|0;Me(51001,f)}c[17672]=1;r=t+4|0;f=t+60|0;g=t+17|0;h=t+8|0;i=t+64|0;j=t+52|0;k=t+56|0;e=0;while(1){if(vg(r,7,1,1)|0){f=52137;e=18;break}if(Ag(c[r>>2]|0,51780+(e*96|0)|0,16)|0){f=52175;e=18;break}c[f>>2]=qq()|0;n=g;o=51780+(e*96|0)+32|0;p=n+16|0;do{a[n>>0]=a[o>>0]|0;n=n+1|0;o=o+1|0}while((n|0)<(p|0));a[h>>0]=a[h>>0]|1;c[i>>2]=qq()|0;c[j>>2]=51780+(e*96|0)+16;c[k>>2]=d[51780+(e*96|0)+29>>0]<<16|d[51780+(e*96|0)+28>>0]<<24|d[51780+(e*96|0)+30>>0]<<8|d[51780+(e*96|0)+31>>0];if(nn(q,16,t)|0){f=52068;e=18;break}if(Tp(q,51780+(e*96|0)+48|0,16)|0){f=52099;e=18;break}if(nn(q,16,t)|0){f=52068;e=18;break}if(Tp(q,51780+(e*96|0)+64|0,16)|0){f=52099;e=18;break}if(nn(q,16,t)|0){f=52068;e=18;break}if(Tp(q,51780+(e*96|0)+80|0,16)|0){f=52099;e=18;break}p=c[f>>2]|0;if((p|0)!=(qq()|0)){f=52201;e=18;break}p=c[i>>2]|0;if((p|0)!=(qq()|0)){f=52201;e=18;break}xg(c[r>>2]|0);c[r>>2]=0;a[h>>0]=a[h>>0]&-2;if((a[t>>0]|0)!=17){e=17;break}if((a[u>>0]|0)!=42){e=17;break}if((a[v>>0]|0)!=-119){e=17;break}e=e+1|0;if((a[w>>0]|0)!=-4){e=17;break}if(e>>>0>=3){f=0;e=18;break}}if((e|0)==17){c[s>>2]=t;Me(51167,s)}else if((e|0)==18){c[17672]=0;e=Wn(12644)|0;if(e|0){c[x>>2]=Pn(e)|0;Me(51213,x)}xg(c[r>>2]|0);if((a[t>>0]|0)!=17){c[y>>2]=t;Me(51167,y)}if((a[u>>0]|0)!=42){c[y>>2]=t;Me(51167,y)}if((a[v>>0]|0)!=-119){c[y>>2]=t;Me(51167,y)}if((a[w>>0]|0)!=-4){c[y>>2]=t;Me(51167,y)}cf(t);e=(f|0)!=0;if(!((b|0)!=0&e)){b=e?16777266:0;l=z;return b|0}zb[b&1](52223,0,52230,f);b=e?16777266:0;l=z;return b|0}return 0}function tn(b,e,f,g,h,i,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+16|0;if((l|0)>=(m|0))$(16);t=v;en(1);if((b|0)==0|(f|0)==0|(g|0)!=16|(h|0)==0|(i|0)!=16|(j|0)==0|(k|0)!=16){u=45;l=v;return u|0}r=df(1,84)|0;if(!r){u=Sn()|0;l=v;return u|0}a[r>>0]=17;o=r+16|0;a[o>>0]=42;p=r+33|0;a[p>>0]=-119;q=r+50|0;a[q>>0]=-4;i=r+4|0;g=vg(i,7,1,1)|0;if(!g){g=Ag(c[i>>2]|0,f,16)|0;if(!g){c[r+60>>2]=qq()|0;f=r+17|0;i=h;k=f+16|0;do{a[f>>0]=a[i>>0]|0;f=f+1|0;i=i+1|0}while((f|0)<(k|0));g=r+8|0;a[g>>0]=a[g>>0]|1;c[r+64>>2]=qq()|0;g=r+68|0;f=g;i=j;k=f+16|0;do{a[f>>0]=a[i>>0]|0;f=f+1|0;i=i+1|0}while((f|0)<(k|0));c[r+52>>2]=g;c[r+56>>2]=d[r+81>>0]<<16|d[r+80>>0]<<24|d[r+82>>0]<<8|d[r+83>>0];if(e&1|0)a[r+51>>0]=1;if((a[r>>0]|0)!=17){c[t>>2]=r;Me(51167,t)}if((a[o>>0]|0)!=42){c[t>>2]=r;Me(51167,t)}if((a[p>>0]|0)!=-119){c[t>>2]=r;Me(51167,t)}if((a[q>>0]|0)==-4){n=0;s=r}else{c[t>>2]=r;Me(51167,t)}}else{n=g;u=13}}else{n=g;u=13}if((u|0)==13){xg(c[i>>2]|0);cf(r);s=0}c[b>>2]=s;u=n;l=v;return u|0}function un(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=g+8|0;e=g;if((a|0)==0|(b|0)==0|(d|0)!=16){f=45;l=g;return f|0}d=Vn(12644)|0;if(d|0){c[e>>2]=Pn(d)|0;Me(51001,e)}c[17672]=1;kn(b,16,a);c[17672]=0;d=Wn(12644)|0;if(!d){f=0;l=g;return f|0}else{c[f>>2]=Pn(d)|0;Me(51213,f)}return 0}function vn(a){a=a|0;if(!a)return;xg(c[a+4>>2]|0);cf(a);return}function wn(a){a=a|0;if(c[17684]|0)return;c[17684]=1;c[17685]=0;return}function xn(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e+8|0;b=e;a=Vn(12688)|0;if(a|0){c[b>>2]=Pn(a)|0;Me(52234,b)}c[17685]=1;Dn(0,0,0,0)|0;c[17685]=0;a=Wn(12688)|0;if(!a){l=e;return}else{c[d>>2]=Pn(a)|0;Me(52277,d)}}function yn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;i=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=i+16|0;g=i+8|0;f=i;if(!(c[17684]|0)){c[17684]=1;c[17685]=0}e=Vn(12688)|0;if(e|0){c[f>>2]=Pn(e)|0;Me(52234,f)}c[17685]=1;if(!a)Ie(52320,52327,144,52343);c[17686]=a;c[17687]=b;c[17688]=0;a=Dn(5,0,b,(d|0)==2?2:1)|0;if((a|0)<0){c[g>>2]=a;Me(52354,g)}if((c[17688]|0)!=(c[17687]|0)){c[g>>2]=a;Me(52354,g)}c[17685]=0;a=Wn(12688)|0;if(!a){l=i;return}else{c[h>>2]=Pn(a)|0;Me(52277,h)}}function zn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if(!(c[17685]|0))Ie(52400,52327,124,52421);f=c[17686]|0;if(!f)Ie(52429,52327,125,52421);if(!d)return;g=c[17687]|0;e=d;d=c[17688]|0;while(1){e=e+-1|0;if(d>>>0>=g>>>0){e=9;break}i=a[b>>0]|0;h=d;d=d+1|0;c[17688]=d;a[f+h>>0]=i;if(!e){e=9;break}else b=b+1|0}if((e|0)==9)return}function An(){return c[17689]|0}function Bn(a,b){a=a|0;b=b|0;return}function Cn(a,b){a=a|0;b=b|0;return 0}function Dn(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=l;l=l+944|0;if((l|0)>=(m|0))$(944);C=F+24|0;r=F+16|0;B=F+8|0;A=F;h=F+168|0;y=F+40|0;z=F+32|0;if(!b){g=c[3183]|0;if((g|0)!=-1){Up(g)|0;c[3183]=-1}g=c[3184]|0;if((g|0)==-1){l=F;return 0}Up(g)|0;c[3184]=-1;l=F;return 0}k=Cn(b,e)|0;x=f>>>1;k=f-(f>>>0>1?(k>>>0>x>>>0?x:k):0)|0;if((g|0)>1){g=c[3183]|0;if((g|0)==-1){g=En(52444,(d[71846]|0)&1)|0;c[3183]=g;a[71846]=d[71846]|0|1}}else{g=c[3184]|0;if((g|0)==-1){g=En(52456,(d[71846]|0)&2)|0;c[3184]=g;a[71846]=d[71846]|0|2}}a:do if(!k)E=0;else{u=1<<(g&31);v=y+(g>>>5<<2)|0;w=z+4|0;x=g+1|0;if((g|0)<1024){i=0;j=0;s=0;t=k}else{n=0;o=0;q=k;b:while(1){k=f-q|0;if((n|0)==0&(o|0)==(k|0))n=0;else{pj(52469,88,k,f);n=1;o=k}p=q>>>0<768?q:768;while(1){k=pq(g,h,p)|0;if((k|0)>-1&k>>>0>p>>>0){c[r>>2]=k;Le(52502,r);k=p}if((k|0)!=-1)break;k=c[(zo()|0)>>2]|0;if((k|0)!=4)break b}ub[b&7](h,k,e);q=q-k|0;if(!q){E=n;break a}}r=dp(k)|0;c[C>>2]=r;Me(52540,C)}c:while(1){k=f-t|0;if((j|0)==0&(s|0)==(k|0)){j=0;o=s}else{pj(52469,88,k,f);j=1;o=k}k=y;n=k+128|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(n|0));c[v>>2]=c[v>>2]|u;c[z>>2]=i;k=(i|0)!=0;c[w>>2]=k?0:1e5;switch(nq(x,y,0,0,z)|0){case 0:{n=t;i=3;j=1;break}case -1:{c[A>>2]=dp(c[(zo()|0)>>2]|0)|0;Le(52482,A);n=t;i=k?i:1;break}default:{n=t>>>0<768?t:768;while(1){k=pq(g,h,n)|0;if((k|0)>-1&k>>>0>n>>>0){c[B>>2]=k;Le(52502,B);k=n}if((k|0)!=-1)break;k=c[(zo()|0)>>2]|0;if((k|0)!=4)break c}ub[b&7](h,k,e);n=t-k|0}}if(!n){E=j;break a}else{s=o;t=n}}B=dp(k)|0;c[C>>2]=B;Me(52540,C)}while(0);if(h&7){g=768;do{a[h>>0]=0;h=h+1|0;g=g+-1|0}while((g|0)!=0&(h&7|0)!=0);if(g>>>0>=8)D=36}else{g=768;D=36}if((D|0)==36){j=g+-8|0;k=j&-8;n=k+8|0;i=h;while(1){D=i;c[D>>2]=0;c[D+4>>2]=0;g=g+-8|0;if(g>>>0<=7)break;else i=i+8|0}g=j-k|0;h=h+n|0}if(g|0)while(1){a[h>>0]=0;g=g+-1|0;if(!g)break;else h=h+1|0}if(!E){l=F;return 0}pj(52469,88,f,f);l=F;return 0}function En(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+64|0;if((l|0)>=(m|0))$(64);n=o+48|0;k=o+40|0;j=o+32|0;g=o+24|0;i=o+16|0;h=o+8|0;e=o;f=(b|0)!=0;do if(f){pj(52573,88,1,0);b=Bq(a,0,h)|0;e=(b|0)==-1;if(f&e){b=h+4|0;do{c[h>>2]=5;c[b>>2]=0;pj(52589,88,0,5);nq(0,0,0,0,h)|0;d=Bq(a,0,i)|0}while((d|0)==-1)}else{if(!e){d=b;break}i=zo()|0;i=c[i>>2]|0;i=dp(i)|0;c[g>>2]=a;a=g+4|0;c[a>>2]=i;Me(52605,g)}}else{b=Bq(a,0,e)|0;if((b|0)==-1){i=zo()|0;i=c[i>>2]|0;i=dp(i)|0;c[g>>2]=a;a=g+4|0;c[a>>2]=i;Me(52605,g)}else d=b}while(0);c[j>>2]=0;b=jq(d,1,j)|0;if((b|0)>=0?(c[k>>2]=b|1,(jq(d,2,k)|0)==0):0){l=o;return d|0}k=dp(c[(zo()|0)>>2]|0)|0;c[n>>2]=d;c[n+4>>2]=k;Le(52624,n);l=o;return d|0}function Fn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=a+(d<<2)|0;f=b+(d<<2)|0;g=e&65535;e=e>>>16;b=0;a=0-d|0;do{m=c[f+(a<<2)>>2]|0;l=m&65535;m=m>>>16;k=S(l,g)|0;n=S(m,g)|0;m=S(m,e)|0;l=n+(S(l,e)|0)+(k>>>16)|0;k=(l<<16|k&65535)+b|0;d=h+(a<<2)|0;j=c[d>>2]|0;i=k+j|0;b=(l>>>0>>0?m+65536|0:m)+(l>>>16)+(k>>>0>>0&1)+(i>>>0>>0&1)|0;c[d>>2]=i;a=a+1|0}while((a|0)!=0);return b|0}function Gn(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+48|0;if((l|0)>=(m|0))$(48);k=q+32|0;j=q+24|0;i=q+16|0;h=q+8|0;f=q;p=nl(c[b+4>>2]|0)|0;g=lk(b)|0;o=(g+7|0)>>>3;if(nf(1)|0){c[f>>2]=g;c[f+4>>2]=e;Oe(52663,f)}n=g+-1|0;if(g>>>0<32){f=0;while(1){cf(f);f=Cj(o,e)|0;Rk(p,f,o,0);k=(mk(p,n)|0)==0;ok(p,n);if(k)qk(p,n);if((wk(p,b)|0)>=0){if(!(nf(1)|0))continue;Oe(52710,h);continue}if((vk(p,0)|0)>0)break;if(!(nf(1)|0))continue;Oe(52732,i)}cf(f);l=q;return p|0}else f=0;while(1){if(!f){cf(0);f=Cj(o,e)|0}else{i=Cj(4,e)|0;h=d[i>>0]|d[i+1>>0]<<8|d[i+2>>0]<<16|d[i+3>>0]<<24;a[f>>0]=h;a[f+1>>0]=h>>8;a[f+2>>0]=h>>16;a[f+3>>0]=h>>24;cf(i)}Rk(p,f,o,0);i=(mk(p,n)|0)==0;ok(p,n);if(i)qk(p,n);if((wk(p,b)|0)>=0){if(!(nf(1)|0))continue;Oe(52710,j);continue}if((vk(p,0)|0)>0)break;if(!(nf(1)|0))continue;Oe(52732,k)}cf(f);l=q;return p|0}function Hn(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=v+16|0;t=v+12|0;u=v+8|0;q=v+4|0;r=v;c[t>>2]=0;c[u>>2]=0;c[q>>2]=0;c[r>>2]=0;o=lk(b)|0;if(!((f|0)!=0&((e|0)!=0&(o|0)!=0))){a=32816;l=v;return a|0}if((sh(g)|0)!=(f|0)){a=5;l=v;return a|0}s=_e(f)|0;a:do if(s){Yq(s|0,1,f|0)|0;p=df(1,f)|0;if(!p){g=0;d=0;i=Sn()|0;break}k=(o+7|0)>>>3;i=In(t,d,k)|0;if(!i){n=f<<3;i=Sk(j,5,e,f&536870911,0)|0;if(i|0){g=0;d=p;break}if(n>>>0>o>>>0){e=c[j>>2]|0;sk(e,e,n-o|0)}if((wk(c[j>>2]|0,b)|0)>-1){e=c[j>>2]|0;hk(e,e,b)}i=In(u,c[j>>2]|0,k)|0;tl(c[j>>2]|0);if(!i){i=eh(q,g,3)|0;if(!i){i=nh(c[q>>2]|0,p,f)|0;if(!i){lh(c[q>>2]|0,s,f);lh(c[q>>2]|0,71847,1);d=c[t>>2]|0;lh(c[q>>2]|0,d,k);e=c[u>>2]|0;lh(c[q>>2]|0,e,k);cr(p|0,ph(c[q>>2]|0,0)|0,f|0)|0;i=nh(c[q>>2]|0,p,f)|0;if(!i){lh(c[q>>2]|0,s,f);cr(s|0,ph(c[q>>2]|0,0)|0,f|0)|0;i=nh(c[q>>2]|0,p,f)|0;if(!i){lh(c[q>>2]|0,s,f);lh(c[q>>2]|0,52752,1);lh(c[q>>2]|0,d,k);lh(c[q>>2]|0,e,k);cr(p|0,ph(c[q>>2]|0,0)|0,f|0)|0;i=nh(c[q>>2]|0,p,f)|0;if(!i){lh(c[q>>2]|0,s,f);cr(s|0,ph(c[q>>2]|0,0)|0,f|0)|0;g=_e(k+f|0)|0;if(!g){g=0;d=p;i=Sn()|0;break}else e=h;while(1){while(1){d=0;do{i=nh(c[q>>2]|0,p,f)|0;if(i|0){d=p;break a}lh(c[q>>2]|0,s,f);cr(s|0,ph(c[q>>2]|0,0)|0,f|0)|0;cr(g+(d>>>3)|0,s|0,f|0)|0;d=d+n|0}while(d>>>0>>0);tl(c[r>>2]|0);c[r>>2]=0;i=Sk(r,5,g,d>>>3,0)|0;if(i|0){d=p;break a}if(d>>>0>o>>>0){h=c[r>>2]|0;sk(h,h,d-o|0)}if((wk(c[r>>2]|0,b)|0)<0?(vk(c[r>>2]|0,0)|0)>0:0)break;i=nh(c[q>>2]|0,p,f)|0;if(i|0){d=p;break a}lh(c[q>>2]|0,s,f);lh(c[q>>2]|0,71847,1);cr(p|0,ph(c[q>>2]|0,0)|0,f|0)|0;i=nh(c[q>>2]|0,p,f)|0;if(i|0){d=p;break a}lh(c[q>>2]|0,s,f);cr(s|0,ph(c[q>>2]|0,0)|0,f|0)|0}if(!e){d=p;i=0;break a}i=nh(c[q>>2]|0,p,f)|0;if(i|0){d=p;break a}lh(c[q>>2]|0,s,f);lh(c[q>>2]|0,71847,1);cr(p|0,ph(c[q>>2]|0,0)|0,f|0)|0;i=nh(c[q>>2]|0,p,f)|0;if(i|0){d=p;break a}lh(c[q>>2]|0,s,f);cr(s|0,ph(c[q>>2]|0,0)|0,f|0)|0;e=e+-1|0}}else{g=0;d=p}}else{g=0;d=p}}else{g=0;d=p}}else{g=0;d=p}}else{g=0;d=p}}else{g=0;d=p}}else{g=0;d=p}}else{g=0;d=0;i=Sn()|0}while(0);cf(g);kh(c[q>>2]|0);cf(c[u>>2]|0);cf(c[t>>2]|0);cf(d);cf(s);d=c[r>>2]|0;if(!i){c[a>>2]=d;a=0;l=v;return a|0}else{tl(d);a=i;l=v;return a|0}return 0}function In(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=h;e=Tk(5,0,0,g,b)|0;if(e|0){a=e;l=h;return a|0}e=c[g>>2]|0;if(e>>>0>d>>>0){a=67;l=h;return a|0}f=e>>>0>>0?d-e|0:0;e=f+e|0;if((b|0)!=0?(c[b+12>>2]&1|0)!=0:0)d=$e(e)|0;else d=_e(e)|0;if(!d){a=Sn()|0;l=h;return a|0}if(f|0)Yq(d|0,0,f|0)|0;e=c[g>>2]|0;c[g>>2]=e+f;e=Tk(5,d+f|0,e,0,b)|0;if(!e){c[a>>2]=d;a=0;l=h;return a|0}else{cf(d);a=e;l=h;return a|0}return 0}function Jn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=g+4|0;f=g;if((a|0)!=0?(c[a+12>>2]&4|0)!=0:0){a=wl(a,e)|0;a=Sk(f,5,a,((c[e>>2]|0)+7|0)>>>3,0)|0;if(a|0){f=a;l=g;return f|0}a=c[e>>2]|0;if(a>>>0>d>>>0){e=c[f>>2]|0;sk(e,e,a-d|0)}}else c[f>>2]=a;c[b>>2]=c[f>>2];f=0;l=g;return f|0}function Kn(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;A=l;l=l+32|0;if((l|0)>=(m|0))$(32);v=A;w=A+24|0;x=A+12|0;y=A+8|0;u=A+4|0;if(nf(1)|0)Se(52754,a);o=b+32|0;h=Jn(a,y,lk(c[o>>2]|0)|0)|0;if(h|0){a=h;l=A;return a|0}c[w>>2]=0;p=ll(0)|0;q=ll(0)|0;r=ll(0)|0;s=ll(0)|0;Pj(x);t=Uj(c[b>>2]|0,c[b+4>>2]|0,0,c[b+8>>2]|0,c[b+12>>2]|0,c[b+16>>2]|0)|0;n=(f&2|0)!=0&(g|0)!=0;i=(a|0)==0;j=a+12|0;k=b+56|0;b=b+20|0;h=0;a:while(1){if(n)do{tl(c[w>>2]|0);c[w>>2]=0;if(i){f=70;break a}if(!(c[j>>2]&4)){f=70;break a}f=wl(a,u)|0;f=Hn(w,c[o>>2]|0,c[k>>2]|0,f,((c[u>>2]|0)+7|0)>>>3,g,h)|0;if(f|0)break a;h=h+1|0;ck(x,c[w>>2]|0,b,t);if(Nj(s,0,x,t)|0){z=12;break a}Gk(d,s,c[o>>2]|0)}while((vk(d,0)|0)==0);else do{tl(c[w>>2]|0);c[w>>2]=0;f=Gn(c[o>>2]|0,1)|0;c[w>>2]=f;ck(x,f,b,t);if(Nj(s,0,x,t)|0){z=12;break a}Gk(d,s,c[o>>2]|0)}while(!(vk(d,0)|0));Lk(p,c[k>>2]|0,d,c[o>>2]|0);ik(q,c[y>>2]|0,p,c[o>>2]|0);Fk(r,c[w>>2]|0,c[o>>2]|0)|0;Lk(e,r,q,c[o>>2]|0);if(vk(e,0)|0){z=16;break}}if((z|0)==12)if(!(nf(1)|0))f=8;else{Oe(52831,v);f=8}else if((z|0)==16)if(!(nf(1)|0))f=0;else{Se(52772,d);Se(52793,e);f=0}Yj(t);Rj(x);tl(s);tl(r);tl(q);tl(p);tl(c[w>>2]|0);h=c[y>>2]|0;if((h|0)==(a|0)){a=f;l=A;return a|0}tl(h);a=f;l=A;return a|0}function Ln(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=l;l=l+64|0;if((l|0)>=(m|0))$(64);o=t+8|0;n=t;p=t+48|0;q=t+36|0;r=t+24|0;s=t+12|0;if((vk(d,0)|0)<=0){a=8;l=t;return a|0}g=b+32|0;if((wk(d,c[g>>2]|0)|0)>=0){a=8;l=t;return a|0}if((vk(e,0)|0)<=0){a=8;l=t;return a|0}if((wk(e,c[g>>2]|0)|0)>=0){a=8;l=t;return a|0}f=Jn(a,p,lk(c[g>>2]|0)|0)|0;if(f|0){a=f;l=t;return a|0}f=ll(0)|0;h=ll(0)|0;i=ll(0)|0;j=ll(0)|0;Pj(q);Pj(r);Pj(s);k=Uj(c[b>>2]|0,c[b+4>>2]|0,0,c[b+8>>2]|0,c[b+12>>2]|0,c[b+16>>2]|0)|0;Fk(f,e,c[g>>2]|0)|0;Lk(h,c[p>>2]|0,f,c[g>>2]|0);ck(r,h,b+20|0,k);Lk(i,d,f,c[g>>2]|0);ck(s,i,b+44|0,k);ak(q,r,s,k);do if(!(vk(c[q+8>>2]|0,0)|0))if(!(nf(1)|0))b=8;else{Oe(52915,n);b=8}else{if(Nj(j,0,q,k)|0){if(!(nf(1)|0)){b=8;break}Oe(52937,o);b=8;break}Gk(j,j,c[g>>2]|0);if(wk(j,d)|0)if(!(nf(1)|0))b=8;else{Se(52983,j);Se(52990,d);Se(52997,e);b=8}else b=0}while(0);Yj(k);Rj(s);Rj(r);Rj(q);tl(j);tl(i);tl(h);tl(f);f=c[p>>2]|0;if((f|0)==(a|0)){a=b;l=t;return a|0}tl(f);a=b;l=t;return a|0}function Mn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+32|0;if((l|0)>=(m|0))$(32);s=v;t=v+12|0;u=v+8|0;g=v+4|0;if(nf(1)|0)Se(52814,a);r=b+32|0;h=lk(c[r>>2]|0)|0;if((a|0)!=0?(c[a+12>>2]&4|0)!=0:0){f=wl(a,g)|0;f=Sk(u,5,f,((c[g>>2]|0)+7|0)>>>3,0)|0;if(f|0){a=f;l=v;return a|0}f=c[g>>2]|0;if(f>>>0>h>>>0){q=c[u>>2]|0;sk(q,q,f-h|0)}}else c[u>>2]=a;j=ll(0)|0;k=ll(0)|0;n=ll(0)|0;o=ll(0)|0;p=ll(0)|0;Pj(t);q=Uj(c[b>>2]|0,c[b+4>>2]|0,0,c[b+8>>2]|0,c[b+12>>2]|0,c[b+16>>2]|0)|0;Gk(o,a,c[r>>2]|0);if(!(vk(o,0)|0))El(o,1)|0;i=b+20|0;g=b+56|0;f=0;a:while(1){h=f;do{tl(h);h=Gn(c[r>>2]|0,1)|0;ck(t,h,i,q);if(Nj(p,0,t,q)|0){f=14;break a}Gk(d,p,c[r>>2]|0)}while(!(vk(d,0)|0));Lk(j,c[g>>2]|0,d,c[r>>2]|0);Lk(n,h,o,c[r>>2]|0);ik(e,n,j,c[r>>2]|0);if(!(vk(e,0)|0))f=h;else{f=18;break}}if((f|0)==14)if(!(nf(1)|0))g=8;else{Oe(52831,s);g=8}else if((f|0)==18)if(!(nf(1)|0))g=0;else{Se(52875,d);Se(52895,e);g=0}Yj(q);Rj(t);tl(p);tl(o);tl(n);tl(k);tl(j);tl(h);f=c[u>>2]|0;if((f|0)==(a|0)){a=g;l=v;return a|0}tl(f);a=g;l=v;return a|0}function Nn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=l;l=l+64|0;if((l|0)>=(m|0))$(64);j=x+24|0;i=x+16|0;h=x+8|0;g=x;u=x+52|0;v=x+40|0;w=x+28|0;if((vk(d,0)|0)<=0){w=8;l=x;return w|0}f=b+32|0;if((wk(d,c[f>>2]|0)|0)>=0){w=8;l=x;return w|0}if((vk(e,0)|0)<=0){w=8;l=x;return w|0}if((wk(e,c[f>>2]|0)|0)>=0){w=8;l=x;return w|0}k=ll(0)|0;n=ll(0)|0;o=ll(0)|0;p=ll(0)|0;q=ll(0)|0;r=ll(0)|0;s=ll(0)|0;Pj(u);Pj(v);Pj(w);t=Uj(c[b>>2]|0,c[b+4>>2]|0,0,c[b+8>>2]|0,c[b+12>>2]|0,c[b+16>>2]|0)|0;Gk(n,a,c[f>>2]|0);if(!(vk(n,0)|0))El(n,1)|0;Fk(q,n,c[f>>2]|0)|0;Lk(o,e,q,c[f>>2]|0);Lk(r,d,q,c[f>>2]|0);jk(p,s,r,c[f>>2]|0);ck(v,o,b+20|0,t);ck(w,p,b+44|0,t);ak(u,v,w,t);do if(!(vk(c[u+8>>2]|0,0)|0))if(!(nf(1)|0))a=8;else{Oe(52915,g);a=8}else{if(Nj(k,0,u,t)|0){if(!(nf(1)|0)){a=8;break}Oe(52937,h);a=8;break}Gk(k,k,c[f>>2]|0);h=(wk(k,d)|0)==0;a=(nf(1)|0)!=0;if(h){if(!a){a=0;break}Oe(53030,j);a=0;break}else{if(!a){a=8;break}Se(52983,k);Se(52990,d);Se(52997,e);Oe(53004,i);a=8;break}}while(0);Yj(t);Rj(w);Rj(v);Rj(u);tl(s);tl(r);tl(q);tl(p);tl(o);tl(k);tl(n);w=a;l=x;return w|0}function On(){return ao()|0}function Pn(a){a=a|0;return ho(a)|0}function Qn(a){a=a|0;return jo(a)|0}function Rn(a){a=a|0;return io(a)|0}function Sn(){return ko()|0}function Tn(a){a=a|0;bo(a);return}function Un(a){a=a|0;return Yn(a)|0}function Vn(a){a=a|0;return Zn(a)|0}function Wn(a){a=a|0;return _n(a)|0}function Xn(a){a=a|0;return $n(a)|0}function Yn(a){a=a|0;switch(c[a>>2]|0){case 0:{c[a>>2]=1;break}case 1:break;default:Da(53052,53072,114,53085)}a=xa(a+4|0,0)|0;if(!a){a=0;return a|0}a=Qn(a)|0;return a|0}function Zn(a){a=a|0;if((c[a>>2]|0)!=1)Da(53052,53072,114,53085);a=Zq(a+4|0)|0;if(!a){a=0;return a|0}a=Qn(a)|0;return a|0}function _n(a){a=a|0;if((c[a>>2]|0)!=1)Da(53052,53072,114,53085);a=hr(a+4|0)|0;if(!a){a=0;return a|0}a=Qn(a)|0;return a|0}function $n(a){a=a|0;var b=0,d=0;if((c[a>>2]|0)!=1)Da(53052,53072,114,53085);b=a+4|0;d=Ua(b|0)|0;if(!d){c[a>>2]=1;a=b+40|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(a|0));d=0;return d|0}else{d=Qn(d)|0;return d|0}return 0}function ao(){co()|0;return 0}function bo(a){a=a|0;c[(zo()|0)>>2]=a;return}function co(){if(c[17690]|0)return 0;c[17690]=1;ib(3)|0;return 0}function eo(){fo(0)|0;c[17691]=0;c[17692]=0;return}function fo(b){b=b|0;var d=0,e=0,f=0,g=0;if(b|0){e=b+36|0;d=c[e>>2]|0;if(!(a[d+1140>>0]&32))Zn(d+1040|0)|0;if(!(c[b>>2]&65536)){c[b+12>>2]=0;c[b+16>>2]=0;c[b+32>>2]=0;b=0}else b=go(b)|0;d=c[e>>2]|0;if(a[d+1140>>0]&32){g=b;g=(g|0)!=0;g=g<<31>>31;return g|0}_n(d+1040|0)|0;g=b;g=(g|0)!=0;g=g<<31>>31;return g|0}Zn(12740)|0;b=c[17693]|0;if(!b)d=0;else{d=0;do{g=b+4|0;f=c[g>>2]|0;if(f){e=c[f+36>>2]|0;if(!(a[e+1140>>0]&32)){Zn(e+1040|0)|0;f=c[g>>2]|0}if(!(c[f>>2]&65536)){c[f+12>>2]=0;c[f+16>>2]=0;c[f+32>>2]=0;e=0}else{e=go(f)|0;f=c[g>>2]|0}d=e|d;e=c[f+36>>2]|0;if(!(a[e+1140>>0]&32))_n(e+1040|0)|0}b=c[b>>2]|0}while((b|0)!=0)}_n(12740)|0;g=d;g=(g|0)!=0;g=g<<31>>31;return g|0}function go(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;j=b+36|0;d=c[j>>2]|0;h=c[d+1108>>2]|0;if(!(c[b>>2]&65536))Da(53101,53123,1654,53133);i=b+16|0;e=c[i>>2]|0;if(!e){j=0;return j|0}do if(h){g=b+4|0;a:do if((e|0)>0){d=0;f=e;while(1){e=pb[h&63](c[(c[j>>2]|0)+1084>>2]|0,(c[g>>2]|0)+d|0,f)|0;f=(e|0)==-1;d=(f?0:e)+d|0;e=c[i>>2]|0;if(f){f=d;g=-1;break a}f=e-d|0;if((f|0)<=0){f=d;g=0;break}}}else{f=0;g=0}while(0);d=b+20|0;c[d>>2]=(c[d>>2]|0)+f;if((e|0)==(f|0)){b=c[j>>2]|0;f=b+1100|0;c[f>>2]=(c[f>>2]|0)+e;c[i>>2]=0;c[d>>2]=0;pb[h&63](c[b+1084>>2]|0,0,0)|0}if(!g){j=0;return j|0}else{e=-1;d=c[j>>2]|0;break}}else e=95;while(0);j=d+1136|0;a[j>>0]=a[j>>0]|1;j=e;return j|0}function ho(a){a=a|0;var b=0,d=0;b=a&65535;a:do if(!(a&32768)){if(b>>>0>=214){if((b+-222|0)>>>0<33){b=b+-8|0;break}if((b+-257|0)>>>0<15){b=b+-10|0;break}if((b+-273|0)>>>0<9){b=b+-11|0;break}if((b+-721|0)>>>0<9){b=b+-450|0;break}if((b+-750|0)>>>0<3){b=b+-470|0;break}if((b+-754|0)>>>0<29){b=b+-471|0;break}if((b+-784|0)>>>0<6){b=b+-472|0;break}if((b+-800|0)>>>0<5){b=b+-482|0;break}if((b+-815|0)>>>0<8){b=b+-492|0;break}if((a&65528|0)==832){b=b+-501|0;break}switch((a&65535)<<16>>16){case 844:{b=339;break a}case 848:{b=340;break a}default:{}}if((b+-881|0)>>>0<11){b=b+-540|0;break}if((a&65520|0)==1024)b=b+-672|0;else d=31}}else{b=Rn(b)|0;if(!b){b=16382;d=31}else{d=dp(b)|0;return d|0}}while(0);if((d|0)==31)b=(b+-16381|0)>>>0<3?b+-16013|0:371;d=53142+(c[12784+(b<<2)>>2]|0)|0;return d|0}function io(a){a=a|0;var b=0;if((a&32768|0)!=0?(b=a&-32769,b>>>0<141):0)a=c[14272+(b<<2)>>2]|0;else a=0;return a|0}function jo(a){a=a|0;var b=0;if(!a){a=0;return a|0}b=a+-1|0;do if(b>>>0>=11)if((a+-11|0)>>>0>=25){if((a+-35|0)>>>0<6){b=a+1|0;break}if((a+-42|0)>>>0>=16)if((a+-59|0)>>>0<37){if((b|0)<0)b=16382;else break;return b|0}else{if((a+-95|0)>>>0<31){b=a;break}else b=16382;return b|0}else b=a}else b=a;while(0);a=c[14836+(b<<2)>>2]|32768;return a|0}function ko(){var a=0,b=0;b=c[(zo()|0)>>2]|0;if(!b){b=16381;return b|0}a=b+-1|0;do if(a>>>0>=11)if((b+-11|0)>>>0>=25){if((b+-35|0)>>>0<6){a=b+1|0;break}if((b+-42|0)>>>0>=16)if((b+-59|0)>>>0<37){if((a|0)<0)a=16382;else break;return a|0}else{if((b+-95|0)>>>0<31){a=b;break}else a=16382;return a|0}else a=b}else a=b;while(0);b=c[14836+(a<<2)>>2]|32768;return b|0}function lo(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=d;h=vd(c[h>>2]|0,c[h+4>>2]|0)|0;e=D;f=b;g=f;a[g>>0]=h;a[g+1>>0]=h>>8;a[g+2>>0]=h>>16;a[g+3>>0]=h>>24;f=f+4|0;a[f>>0]=e;a[f+1>>0]=e>>8;a[f+2>>0]=e>>16;a[f+3>>0]=e>>24;f=Xp(c[d+8>>2]|0)|0;e=b+8|0;a[e>>0]=f;a[e+1>>0]=f>>8;a[e+2>>0]=f>>16;a[e+3>>0]=f>>24;e=b+12|0;b=d+12|0;d=e+12|0;do{a[e>>0]=a[b>>0]|0;e=e+1|0;b=b+1|0}while((e|0)<(d|0));return}function mo(b,e){b=b|0;e=e|0;var f=0,g=0;g=e;f=g;g=g+4|0;g=wd(d[f>>0]|d[f+1>>0]<<8|d[f+2>>0]<<16|d[f+3>>0]<<24,d[g>>0]|d[g+1>>0]<<8|d[g+2>>0]<<16|d[g+3>>0]<<24)|0;f=b;c[f>>2]=g;c[f+4>>2]=D;f=e+8|0;c[b+8>>2]=Yp(d[f>>0]|d[f+1>>0]<<8|d[f+2>>0]<<16|d[f+3>>0]<<24)|0;f=b+12|0;b=e+12|0;e=f+12|0;do{a[f>>0]=a[b>>0]|0;f=f+1|0;b=b+1|0}while((f|0)<(e|0));return}function no(a,b){a=a|0;b=b|0;var d=0;d=Fo(a)|0;if(d>>>0>11){d=-1;return d|0};c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;cr(b+12|0,a|0,d|0)|0;d=1;return d|0}function oo(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+32|0;if((l|0)>=(m|0))$(32);t=v+16|0;k=v+8|0;g=v;f=b+12|0;if((a[f>>0]|0?(e=d+12|0,a[e>>0]|0):0)?(Op(f,e)|0)==0:0){i=b;h=c[i>>2]|0;i=c[i+4>>2]|0;g=c[b+8>>2]|0;f=d;j=c[f>>2]|0;f=c[f+4>>2]|0;e=c[d+8>>2]|0;a:do if((h|0)==-1&(i|0)==-1)u=14;else{b=i;while(1){if(g>>>0<=99999999){o=g;p=h;r=b;break a}g=g+-1e8|0;h=_q(h|0,b|0,1,0)|0;b=D;if((h|0)==-1&(b|0)==-1){u=14;break}}}while(0);if((u|0)==14)if(g>>>0>99999999){if((c[3836]|0)==-1)c[3836]=Wb(1,0,61157,61166,353)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[3836]|0))Vb();c[k>>2]=61157;c[k+4>>2]=353;Zb(1,61295,k);Vb()}else{o=g;p=-1;r=-1}b:do if((j|0)==-1&(f|0)==-1)u=25;else{g=j;while(1){if(e>>>0<=99999999){n=e;q=g;s=f;break b}e=e+-1e8|0;g=_q(g|0,f|0,1,0)|0;f=D;if((g|0)==-1&(f|0)==-1){u=25;break}}}while(0);if((u|0)==25)if(e>>>0>99999999){if((c[3837]|0)==-1)c[3837]=Wb(1,0,61157,61166,355)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[3837]|0))Vb();c[t>>2]=61157;c[t+4>>2]=355;Zb(1,61295,t);Vb()}else{n=e;q=-1;s=-1}if(!((p|0)==(q|0)&(r|0)==(s|0))){u=r>>>0>>0|(r|0)==(s|0)&p>>>0>>0?-1:1;l=v;return u|0}if(o>>>0>>0){u=-1;l=v;return u|0}u=o>>>0>n>>>0&1;l=v;return u|0}if((c[3835]|0)==-1)c[3835]=Wb(1,0,61157,61166,349)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[3835]|0))Vb();c[g>>2]=61157;c[g+4>>2]=349;Zb(1,61295,g);Vb();return 0}function po(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;if(!(a[b+12>>0]|0)){b=-1;return b|0}h=b+8|0;e=b;g=c[e>>2]|0;e=c[e+4>>2]|0;f=c[h>>2]|0;a:do if((g|0)==-1&(e|0)==-1){e=0;d=f}else{d=0;while(1){if(f>>>0<=99999999)break;f=f+-1e8|0;c[h>>2]=f;g=_q(g|0,e|0,1,0)|0;e=D;d=b;c[d>>2]=g;c[d+4>>2]=e;if((g|0)==-1&(e|0)==-1){e=1;d=f;break a}else d=1}return d|0}while(0);if(d>>>0<=99999999){b=e;return b|0};c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;b=-1;return b|0}function qo(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+48|0;if((l|0)>=(m|0))$(48);r=s+32|0;q=s+24|0;o=s;g=d+12|0;if((a[g>>0]|0?(f=e+12|0,a[f>>0]|0):0)?(Op(g,f)|0)==0:0){c[o>>2]=c[d>>2];c[o+4>>2]=c[d+4>>2];c[o+8>>2]=c[d+8>>2];c[o+12>>2]=c[d+12>>2];c[o+16>>2]=c[d+16>>2];c[o+20>>2]=c[d+20>>2];d=e;i=c[d>>2]|0;d=c[d+4>>2]|0;f=c[e+8>>2]|0;n=o+12|0;do if(a[n>>0]|0){k=o+8|0;h=o;e=c[h>>2]|0;h=c[h+4>>2]|0;g=c[k>>2]|0;a:do if((e|0)==-1&(h|0)==-1)p=9;else while(1){if(g>>>0<=99999999)break a;g=g+-1e8|0;c[k>>2]=g;e=_q(e|0,h|0,1,0)|0;h=D;j=o;c[j>>2]=e;c[j+4>>2]=h;if((e|0)==-1&(h|0)==-1){p=9;break}}while(0);if((p|0)==9)if(g>>>0>99999999){c[o>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;c[o+12>>2]=0;c[o+16>>2]=0;c[o+20>>2]=0;break}else{e=-1;h=-1}b:do if((i|0)==-1&(d|0)==-1)p=14;else while(1){if(f>>>0<=99999999){j=d;break b}f=f+-1e8|0;i=_q(i|0,d|0,1,0)|0;d=D;if((i|0)==-1&(d|0)==-1){p=14;break}}while(0);if((p|0)==14)if(f>>>0>99999999)break;else{j=-1;i=-1}do if(g>>>0>>0){if(!((e|0)==0&(h|0)==0)){g=g+1e8|0;c[k>>2]=g;e=_q(e|0,h|0,-1,-1)|0;h=D;p=o;c[p>>2]=e;c[p+4>>2]=h;break};c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;r=-1;l=s;return r|0}while(0);if(h>>>0>>0|(h|0)==(j|0)&e>>>0>>0){c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;r=-1;l=s;return r|0}d=Fo(n)|0;if(d>>>0>11){if((c[3838]|0)==-1)c[3838]=Wb(1,0,61157,61183,421)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[3838]|0))Vb();c[q>>2]=61157;c[q+4>>2]=421;Zb(1,61295,q);Vb()};c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;cr(b+12|0,n|0,d|0)|0;if(g>>>0>=f>>>0){r=g-f|0;c[b+8>>2]=r;p=Xq(e|0,h|0,i|0,j|0)|0;q=D;c[b>>2]=p;c[b+4>>2]=q;r=(p|0)==0&(q|0)==0&(r|0)==0&1^1;l=s;return r|0}if((c[3839]|0)==-1)c[3839]=Wb(1,0,61157,61183,422)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[3839]|0))Vb();c[r>>2]=61157;c[r+4>>2]=422;Zb(1,61295,r);Vb()}while(0);c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;r=-1;l=s;return r|0};c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;r=-1;l=s;return r|0}function ro(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;r=l;l=l+32|0;if((l|0)>=(m|0))$(32);o=r;q=r+8|0;n=d+12|0;if((a[n>>0]|0?(f=e+12|0,a[f>>0]|0):0)?(Op(n,f)|0)==0:0){g=d;i=c[g>>2]|0;g=c[g+4>>2]|0;d=c[d+8>>2]|0;j=e;h=c[j>>2]|0;j=c[j+4>>2]|0;f=c[e+8>>2]|0;a:do if((i|0)==-1&(g|0)==-1)p=8;else{e=i;while(1){if(d>>>0<=99999999){k=d;i=e;p=9;break a}d=d+-1e8|0;e=_q(e|0,g|0,1,0)|0;g=D;if((e|0)==-1&(g|0)==-1){p=8;break}}}while(0);if((p|0)==8?d>>>0<=99999999:0){k=d;i=-1;g=-1;p=9}do if((p|0)==9){b:do if((h|0)==-1&(j|0)==-1)p=12;else{e=j;while(1){if(f>>>0<=99999999)break b;f=f+-1e8|0;h=_q(h|0,e|0,1,0)|0;e=D;if((h|0)==-1&(e|0)==-1){p=12;break}}}while(0);if((p|0)==12)if(f>>>0>99999999)break;else{h=-1;e=-1}d=Fo(n)|0;if(d>>>0>11){if((c[3840]|0)==-1)c[3840]=Wb(1,0,61157,61205,468)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[3840]|0))Vb();c[o>>2]=61157;c[o+4>>2]=468;Zb(1,61295,o);Vb()}Yq(q+d|0,0,12-d|0)|0;cr(q|0,n|0,d|0)|0;e=_q(h|0,e|0,i|0,g|0)|0;d=D;if(d>>>0>>0|(d|0)==(g|0)&e>>>0>>0){c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;b=-1;l=r;return b|0}f=f+k|0;do if(a[q>>0]|0){c:do if((e|0)==-1&(d|0)==-1)p=28;else while(1){if(f>>>0<=99999999)break c;f=f+-1e8|0;e=_q(e|0,d|0,1,0)|0;d=D;if((e|0)==-1&(d|0)==-1){p=28;break}}while(0);if((p|0)==28)if(f>>>0>99999999){c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;break}else{e=-1;d=-1}p=b;c[p>>2]=e;c[p+4>>2]=d;c[b+8>>2]=f;b=b+12|0;c[b>>2]=c[q>>2];c[b+4>>2]=c[q+4>>2];c[b+8>>2]=c[q+8>>2];b=1;l=r;return b|0}while(0);c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;b=-1;l=r;return b|0}while(0);c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;b=-1;l=r;return b|0};c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;b=-1;l=r;return b|0}function so(){var a=0,b=0,d=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=d+8|0;a=d;xe(6,0);if(!(yd(61222)|0)){iq(61228,27,1,c[3935]|0)|0;za()}else{c[a>>2]=0;zd(37,a)|0;c[b>>2]=0;zd(38,b)|0;l=d;return}}function to(a,b,d){a=a|0;b=b|0;d=d|0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=a;a=c[3935]|0;c[b>>2]=d;Rp(a,61256,b)|0;za()}function uo(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=h+16|0;i=h;j=h+24|0;c[j>>2]=Xp(e)|0;c[i>>2]=61323;c[i+4>>2]=21;c[i+8>>2]=0;c[i+12>>2]=0;if((Hc(f,64,j,4,b,64,i)|0)==1){a[f>>0]=(d[f>>0]|0)&63|64;j=f+31|0;a[j>>0]=(d[j>>0]|0)&248;l=h;return}if((c[3841]|0)==-1)c[3841]=Wb(1,0,61286,61345,197)|0;if((Xb()|0)>0){Yb(-1,0);Vb()}if(!(c[3841]|0))Vb();c[g>>2]=61286;c[g+4>>2]=197;Zb(1,61295,g);Vb()}function vo(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=Co(c[a+60>>2]|0)|0;a=yo(cb(6,d|0)|0)|0;l=b;return a|0}function wo(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=g;c[b+36>>2]=25;if((c[b>>2]&64|0)==0?(c[f>>2]=c[b+60>>2],c[f+4>>2]=21523,c[f+8>>2]=g+16,Za(54,f|0)|0):0)a[b+75>>0]=-1;f=Bo(b,d,e)|0;l=g;return f|0}function xo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;e=f+20|0;c[g>>2]=c[a+60>>2];c[g+4>>2]=0;c[g+8>>2]=b;c[g+12>>2]=e;c[g+16>>2]=d;if((yo(jb(140,g|0)|0)|0)<0){c[e>>2]=-1;a=-1}else a=c[e>>2]|0;l=f;return a|0}function yo(a){a=a|0;if(a>>>0>4294963200){c[(zo()|0)>>2]=0-a;a=-1}return a|0}function zo(){return (Ao()|0)+64|0}function Ao(){return 15492}function Bo(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;o=l;l=l+48|0;if((l|0)>=(m|0))$(48);k=o+16|0;g=o;f=o+32|0;i=a+28|0;e=c[i>>2]|0;c[f>>2]=e;j=a+20|0;e=(c[j>>2]|0)-e|0;c[f+4>>2]=e;c[f+8>>2]=b;c[f+12>>2]=d;e=e+d|0;h=a+60|0;c[g>>2]=c[h>>2];c[g+4>>2]=f;c[g+8>>2]=2;g=yo(nb(146,g|0)|0)|0;a:do if((e|0)!=(g|0)){b=2;while(1){if((g|0)<0)break;e=e-g|0;q=c[f+4>>2]|0;p=g>>>0>q>>>0;f=p?f+8|0:f;b=(p<<31>>31)+b|0;q=g-(p?q:0)|0;c[f>>2]=(c[f>>2]|0)+q;p=f+4|0;c[p>>2]=(c[p>>2]|0)-q;c[k>>2]=c[h>>2];c[k+4>>2]=f;c[k+8>>2]=b;g=yo(nb(146,k|0)|0)|0;if((e|0)==(g|0)){n=3;break a}}c[a+16>>2]=0;c[i>>2]=0;c[j>>2]=0;c[a>>2]=c[a>>2]|32;if((b|0)==2)d=0;else d=d-(c[f+4>>2]|0)|0}else n=3;while(0);if((n|0)==3){q=c[a+44>>2]|0;c[a+16>>2]=q+(c[a+48>>2]|0);c[i>>2]=q;c[j>>2]=q}l=o;return d|0}function Co(a){a=a|0;return a|0}function Do(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;k=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=k;i=k+16|0;c[i>>2]=d;g=i+4|0;j=b+48|0;n=c[j>>2]|0;c[g>>2]=e-((n|0)!=0&1);h=b+44|0;c[i+8>>2]=c[h>>2];c[i+12>>2]=n;c[f>>2]=c[b+60>>2];c[f+4>>2]=i;c[f+8>>2]=2;f=yo(mb(145,f|0)|0)|0;if((f|0)>=1){i=c[g>>2]|0;if(f>>>0>i>>>0){g=c[h>>2]|0;h=b+4|0;c[h>>2]=g;c[b+8>>2]=g+(f-i);if(!(c[j>>2]|0))f=e;else{c[h>>2]=g+1;a[d+(e+-1)>>0]=a[g>>0]|0;f=e}}}else c[b>>2]=c[b>>2]|f&48^16;l=k;return f|0}function Eo(){return 70776}function Fo(b){b=b|0;var d=0,e=0,f=0;f=b;a:do if(!(f&3))e=4;else{d=f;while(1){if(!(a[b>>0]|0)){b=d;break a}b=b+1|0;d=b;if(!(d&3)){e=4;break}}}while(0);if((e|0)==4){while(1){d=c[b>>2]|0;if(!((d&-2139062144^-2139062144)&d+-16843009))b=b+4|0;else break}if((d&255)<<24>>24)do b=b+1|0;while((a[b>>0]|0)!=0)}return b-f|0}function Go(b,c){b=b|0;c=c|0;var d=0,e=0;d=a[b>>0]|0;e=a[c>>0]|0;if(d<<24>>24==0?1:d<<24>>24!=e<<24>>24)b=e;else{do{b=b+1|0;c=c+1|0;d=a[b>>0]|0;e=a[c>>0]|0}while(!(d<<24>>24==0?1:d<<24>>24!=e<<24>>24));b=e}return (d&255)-(b&255)|0}function Ho(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;Vo();c[e>>2]=a;c[e+4>>2]=b;b=yo(Ta(91,e|0)|0)|0;l=d;return b|0}function Io(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;n=c[b+8>>2]|0;o=(c[b>>2]|0)==-1794895138;h=er(n|0)|0;h=o?n:h;n=c[b+12>>2]|0;f=er(n|0)|0;f=o?n:f;n=c[b+16>>2]|0;g=er(n|0)|0;g=o?n:g;a:do if((h>>>0>>2>>>0?(n=d-(h<<2)|0,f>>>0>>0&g>>>0>>0):0)?((g|f)&3|0)==0:0){n=f>>>2;m=g>>>2;l=0;while(1){i=h>>>1;j=l+i|0;k=j<<1;p=k+n|0;f=c[b+(p<<2)>>2]|0;g=er(f|0)|0;g=o?f:g;p=c[b+(p+1<<2)>>2]|0;f=er(p|0)|0;f=o?p:f;if(!(f>>>0>>0&g>>>0<(d-f|0)>>>0)){f=0;break a}if(a[b+(f+g)>>0]|0){f=0;break a}f=Go(e,b+f|0)|0;if(!f)break;if((h|0)==1){f=0;break a}p=(f|0)<0;l=p?l:j;h=p?i:h-i|0}p=k+m|0;f=c[b+(p<<2)>>2]|0;g=er(f|0)|0;g=o?f:g;p=c[b+(p+1<<2)>>2]|0;f=er(p|0)|0;f=o?p:f;if(f>>>0>>0&g>>>0<(d-f|0)>>>0)f=(a[b+(f+g)>>0]|0)==0?b+f|0:0;else f=0}else f=0;while(0);return f|0}function Jo(b,c,e){b=b|0;c=c|0;e=e|0;var f=0,g=0;if(!e)f=0;else{f=a[b>>0]|0;a:do if(!(f<<24>>24))f=0;else while(1){e=e+-1|0;g=a[c>>0]|0;if(!(f<<24>>24==g<<24>>24&((e|0)!=0&g<<24>>24!=0)))break a;b=b+1|0;c=c+1|0;f=a[b>>0]|0;if(!(f<<24>>24)){f=0;break}}while(0);f=(f&255)-(d[c>>0]|0)|0}return f|0}function Ko(b,c){b=b|0;c=c|0;b=Uo(b,c)|0;return ((a[b>>0]|0)==(c&255)<<24>>24?b:0)|0}function Lo(a){a=a|0;return ((a|0)==32|(a+-9|0)>>>0<5)&1|0}function Mo(a,b,c){a=a|0;b=b|0;c=c|0;c=Oo(a,b,c,-1,0)|0;return c|0}function No(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;h=d&255;f=(e|0)!=0;a:do if(f&(b&3|0)!=0){g=d&255;while(1){if((a[b>>0]|0)==g<<24>>24){i=6;break a}b=b+1|0;e=e+-1|0;f=(e|0)!=0;if(!(f&(b&3|0)!=0)){i=5;break}}}else i=5;while(0);if((i|0)==5)if(f)i=6;else e=0;b:do if((i|0)==6){g=d&255;if((a[b>>0]|0)!=g<<24>>24){f=S(h,16843009)|0;c:do if(e>>>0>3)while(1){h=c[b>>2]^f;if((h&-2139062144^-2139062144)&h+-16843009|0)break;b=b+4|0;e=e+-4|0;if(e>>>0<=3){i=11;break c}}else i=11;while(0);if((i|0)==11)if(!e){e=0;break}while(1){if((a[b>>0]|0)==g<<24>>24)break b;b=b+1|0;e=e+-1|0;if(!e){e=0;break}}}}while(0);return (e|0?b:0)|0}function Oo(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;j=l;l=l+128|0;if((l|0)>=(m|0))$(128);h=j;c[h>>2]=0;i=h+4|0;c[i>>2]=a;c[h+44>>2]=a;g=h+8|0;c[g>>2]=(a|0)<0?-1:a+2147483647|0;c[h+76>>2]=-1;Po(h,0);d=Qo(h,d,1,e,f)|0;if(b|0)c[b>>2]=a+((c[i>>2]|0)+(c[h+108>>2]|0)-(c[g>>2]|0));l=j;return d|0}function Po(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;c[a+104>>2]=b;d=c[a+8>>2]|0;e=c[a+4>>2]|0;f=d-e|0;c[a+108>>2]=f;if((b|0)!=0&(f|0)>(b|0))c[a+100>>2]=e+b;else c[a+100>>2]=d;return}function Qo(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;a:do if(e>>>0>36){c[(zo()|0)>>2]=22;h=0;g=0}else{r=b+4|0;q=b+100|0;do{i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=Ro(b)|0}while((Lo(i)|0)!=0);b:do switch(i|0){case 43:case 45:{i=((i|0)==45)<<31>>31;j=c[r>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[r>>2]=j+1;p=i;i=d[j>>0]|0;break b}else{p=i;i=Ro(b)|0;break b}}default:p=0}while(0);j=(e|0)==0;do if((e|16|0)==16&(i|0)==48){i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=Ro(b)|0;if((i|32|0)!=120)if(j){e=8;n=46;break}else{n=32;break}i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=Ro(b)|0;if((d[61369+i>>0]|0)>15){g=(c[q>>2]|0)==0;if(!g)c[r>>2]=(c[r>>2]|0)+-1;if(!f){Po(b,0);h=0;g=0;break a}if(g){h=0;g=0;break a}c[r>>2]=(c[r>>2]|0)+-1;h=0;g=0;break a}else{e=16;n=46}}else{e=j?10:e;if((d[61369+i>>0]|0)>>>0>>0)n=32;else{if(c[q>>2]|0)c[r>>2]=(c[r>>2]|0)+-1;Po(b,0);c[(zo()|0)>>2]=22;h=0;g=0;break a}}while(0);if((n|0)==32)if((e|0)==10){e=i+-48|0;if(e>>>0<10){i=0;j=e;do{i=(i*10|0)+j|0;e=c[r>>2]|0;if(e>>>0<(c[q>>2]|0)>>>0){c[r>>2]=e+1;e=d[e>>0]|0}else e=Ro(b)|0;j=e+-48|0}while(j>>>0<10&i>>>0<429496729);f=0}else{e=i;i=0;f=0}j=e+-48|0;if(j>>>0<10){m=j;while(1){j=kr(i|0,f|0,10,0)|0;k=D;l=((m|0)<0)<<31>>31;o=~l;if(k>>>0>o>>>0|(k|0)==(o|0)&j>>>0>~m>>>0){j=e;e=m;break}i=_q(j|0,k|0,m|0,l|0)|0;f=D;e=c[r>>2]|0;if(e>>>0<(c[q>>2]|0)>>>0){c[r>>2]=e+1;e=d[e>>0]|0}else e=Ro(b)|0;k=e+-48|0;if(k>>>0<10&(f>>>0<429496729|(f|0)==429496729&i>>>0<2576980378))m=k;else{j=e;e=k;break}}if(e>>>0>9){j=p;e=f}else{e=10;n=72}}else{j=p;e=f}}else n=46;c:do if((n|0)==46){if(!(e+-1&e)){n=a[61625+((e*23|0)>>>5&7)>>0]|0;f=a[61369+i>>0]|0;j=f&255;if(j>>>0>>0){i=0;k=j;do{i=k|i<>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[r>>2]=j+1;j=d[j>>0]|0}else j=Ro(b)|0;f=a[61369+j>>0]|0;k=f&255}while(i>>>0<134217728&k>>>0>>0);k=0}else{j=i;k=0;i=0}l=gr(-1,-1,n|0)|0;m=D;if((f&255)>>>0>=e>>>0|(k>>>0>m>>>0|(k|0)==(m|0)&i>>>0>l>>>0)){f=k;n=72;break}else j=k;while(1){i=mr(i|0,j|0,n|0)|0;k=D;i=f&255|i;j=c[r>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[r>>2]=j+1;j=d[j>>0]|0}else j=Ro(b)|0;f=a[61369+j>>0]|0;if((f&255)>>>0>=e>>>0|(k>>>0>m>>>0|(k|0)==(m|0)&i>>>0>l>>>0)){f=k;n=72;break c}else j=k}}f=a[61369+i>>0]|0;j=f&255;if(j>>>0>>0){i=0;k=j;do{i=k+(S(i,e)|0)|0;j=c[r>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[r>>2]=j+1;j=d[j>>0]|0}else j=Ro(b)|0;f=a[61369+j>>0]|0;k=f&255}while(i>>>0<119304647&k>>>0>>0);k=0}else{j=i;i=0;k=0}if((f&255)>>>0>>0){n=ir(-1,-1,e|0,0)|0;o=D;m=k;while(1){if(m>>>0>o>>>0|(m|0)==(o|0)&i>>>0>n>>>0){f=m;n=72;break c}k=kr(i|0,m|0,e|0,0)|0;l=D;f=f&255;if(l>>>0>4294967295|(l|0)==-1&k>>>0>~f>>>0){f=m;n=72;break c}i=_q(f|0,0,k|0,l|0)|0;k=D;j=c[r>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[r>>2]=j+1;j=d[j>>0]|0}else j=Ro(b)|0;f=a[61369+j>>0]|0;if((f&255)>>>0>=e>>>0){f=k;n=72;break}else m=k}}else{f=k;n=72}}while(0);if((n|0)==72)if((d[61369+j>>0]|0)>>>0>>0){do{i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=Ro(b)|0}while((d[61369+i>>0]|0)>>>0>>0);c[(zo()|0)>>2]=34;j=(g&1|0)==0&0==0?p:0;e=h;i=g}else{j=p;e=f}if(c[q>>2]|0)c[r>>2]=(c[r>>2]|0)+-1;if(!(e>>>0>>0|(e|0)==(h|0)&i>>>0>>0)){if(!((g&1|0)!=0|0!=0|(j|0)!=0)){c[(zo()|0)>>2]=34;g=_q(g|0,h|0,-1,-1)|0;h=D;break}if(e>>>0>h>>>0|(e|0)==(h|0)&i>>>0>g>>>0){c[(zo()|0)>>2]=34;break}}g=((j|0)<0)<<31>>31;g=Xq(i^j|0,e^g|0,j|0,g|0)|0;h=D}while(0);D=h;return g|0}function Ro(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0;f=b+104|0;i=c[f>>2]|0;if((i|0)!=0?(c[b+108>>2]|0)>=(i|0):0)j=4;else{e=So(b)|0;if((e|0)>=0){f=c[f>>2]|0;i=c[b+8>>2]|0;if(f){h=c[b+4>>2]|0;f=f-(c[b+108>>2]|0)|0;g=i;if((i-h|0)<(f|0))j=9;else c[b+100>>2]=h+(f+-1)}else{g=i;j=9}if((j|0)==9)c[b+100>>2]=i;f=b+4|0;if(!g)f=c[f>>2]|0;else{f=c[f>>2]|0;b=b+108|0;c[b>>2]=g+1-f+(c[b>>2]|0)}f=f+-1|0;if((d[f>>0]|0|0)!=(e|0))a[f>>0]=e}else j=4}if((j|0)==4){c[b+100>>2]=0;e=-1}return e|0}function So(a){a=a|0;var b=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=e;if((To(a)|0)==0?(pb[c[a+32>>2]&63](a,b,1)|0)==1:0)a=d[b>>0]|0;else a=-1;l=e;return a|0}function To(b){b=b|0;var d=0,e=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;d=b+20|0;e=b+28|0;if((c[d>>2]|0)>>>0>(c[e>>2]|0)>>>0)pb[c[b+36>>2]&63](b,0,0)|0;c[b+16>>2]=0;c[e>>2]=0;c[d>>2]=0;d=c[b>>2]|0;if(!(d&4)){e=(c[b+44>>2]|0)+(c[b+48>>2]|0)|0;c[b+8>>2]=e;c[b+4>>2]=e;d=d<<27>>31}else{c[b>>2]=d|32;d=-1}return d|0}function Uo(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;f=d&255;a:do if(!f)b=b+(Fo(b)|0)|0;else{if(b&3){e=d&255;do{g=a[b>>0]|0;if(g<<24>>24==0?1:g<<24>>24==e<<24>>24)break a;b=b+1|0}while((b&3|0)!=0)}f=S(f,16843009)|0;e=c[b>>2]|0;b:do if(!((e&-2139062144^-2139062144)&e+-16843009))do{g=e^f;if((g&-2139062144^-2139062144)&g+-16843009|0)break b;b=b+4|0;e=c[b>>2]|0}while(!((e&-2139062144^-2139062144)&e+-16843009|0));while(0);e=d&255;while(1){g=a[b>>0]|0;if(g<<24>>24==0?1:g<<24>>24==e<<24>>24)break;else b=b+1|0}}while(0);return b|0}function Vo(){return}function Wo(a){a=a|0;return Xo(a)|0}function Xo(a){a=a|0;return ((a|0)==32|(a|0)==9)&1|0}function Yo(a){a=a|0;var b=0;b=(Zo(a)|0)==0;return (b?a:a|32)|0}function Zo(a){a=a|0;return (a+-65|0)>>>0<26|0}function _o(a){a=a|0;return ap(a,0)|0}function $o(a){a=a|0;return ap(a,1)|0}function ap(c,f){c=c|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=(f<<1)+-1|0;l=f+-1|0;a:do if(!((c+-43008|0)>>>0<22272|((c+-11776|0)>>>0<30784|((c+-1536|0)>>>0<2560|(bp(c)|0)==0)))){g=(f|0)!=0;if(g&(c+-4256|0)>>>0<46){if((c|0)>4293)switch(c|0){case 4295:case 4301:break;default:break a}c=c+7264|0;break}if((c+-11520|0)>>>0<38&(g^1)){if((c|0)>11557)switch(c|0){case 11559:case 11565:break;default:break a}c=c+-7264|0;break}else g=0;do{i=a[18762+(g<<2)+2>>0]|0;j=i<<24>>24;h=c-(e[18762+(g<<2)>>1]|0)|0;if((h-(j&l)|0)>>>0<(d[18762+(g<<2)+3>>0]|0)>>>0){m=13;break}g=g+1|0}while((g|0)!=61);if((m|0)==13)if(i<<24>>24==1){c=f+c-(h&1)|0;break}else{c=(S(j,k)|0)+c|0;break}i=1-f|0;g=b[18274+(i<<1)>>1]|0;b:do if(g<<16>>16){h=0;while(1){if((g&65535|0)==(c|0))break;h=h+1|0;g=b[18274+(h<<2)+(i<<1)>>1]|0;if(!(g<<16>>16))break b}c=e[18274+(h<<2)+(f<<1)>>1]|0;break a}while(0);return ((c+-66600+(f*40|0)|0)>>>0<40?c+-40+(f*80|0)|0:c)|0}while(0);return c|0}function bp(a){a=a|0;if(a>>>0<131072)a=(d[61634+((d[61634+(a>>>8)>>0]|0)<<5|a>>>3&31)>>0]|0)>>>(a&7)&1;else a=a>>>0<196606&1;return a|0}function cp(a){a=a|0;return (a+-97|0)>>>0<26|0}function dp(a){a=a|0;return ep(a,c[(Ao()|0)+188>>2]|0)|0}function ep(b,e){b=b|0;e=e|0;var f=0,g=0;g=0;while(1){if((d[64610+g>>0]|0)==(b|0)){b=2;break}f=g+1|0;if((f|0)==87){f=64698;g=87;b=5;break}else g=f}if((b|0)==2)if(!g)f=64698;else{f=64698;b=5}if((b|0)==5)while(1){do{b=f;f=f+1|0}while((a[b>>0]|0)!=0);g=g+-1|0;if(!g)break;else b=5}return fp(f,c[e+20>>2]|0)|0}function fp(a,b){a=a|0;b=b|0;return gp(a,b)|0}function gp(a,b){a=a|0;b=b|0;if(!b)b=0;else b=Io(c[b>>2]|0,c[b+4>>2]|0,a)|0;return (b|0?b:a)|0}function hp(a){a=a|0;if(!a)a=0;else a=(ip(16072,a)|0)!=0;return a&1|0}function ip(a,b){a=a|0;b=b|0;var d=0;if(!b)a=a+((jp(a)|0)<<2)|0;else{while(1){d=c[a>>2]|0;if((d|0)==0|(d|0)==(b|0))break;else a=a+4|0}a=d|0?a:0}return a|0}function jp(a){a=a|0;var b=0;b=a;while(1)if(!(c[b>>2]|0))break;else b=b+4|0;return b-a>>2|0}function kp(a){a=a|0;return ((a+-48|0)>>>0<10|((a|32)+-97|0)>>>0<6)&1|0}function lp(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=f;c[g>>2]=e;e=mp(a,b,d,g)|0;l=f;return e|0}function mp(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+128|0;if((l|0)>=(m|0))$(128);g=o+124|0;n=o;h=n;i=16160;j=h+124|0;do{c[h>>2]=c[i>>2];h=h+4|0;i=i+4|0}while((h|0)<(j|0));if((d+-1|0)>>>0>2147483646)if(!d){b=g;d=1;k=4}else{c[(zo()|0)>>2]=75;d=-1}else k=4;if((k|0)==4){k=-2-b|0;k=d>>>0>k>>>0?k:d;c[n+48>>2]=k;g=n+20|0;c[g>>2]=b;c[n+44>>2]=b;d=b+k|0;b=n+16|0;c[b>>2]=d;c[n+28>>2]=d;d=np(n,e,f)|0;if(k){n=c[g>>2]|0;a[n+(((n|0)==(c[b>>2]|0))<<31>>31)>>0]=0}}l=o;return d|0}function np(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=l;l=l+224|0;if((l|0)>=(m|0))$(224);o=t+120|0;q=t+80|0;r=t;s=t+136|0;f=q;g=f+40|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));c[o>>2]=c[e>>2];if((op(0,d,o,r,q)|0)<0)e=-1;else{if((c[b+76>>2]|0)>-1)p=pp(b)|0;else p=0;e=c[b>>2]|0;n=e&32;if((a[b+74>>0]|0)<1)c[b>>2]=e&-33;f=b+48|0;if(!(c[f>>2]|0)){g=b+44|0;h=c[g>>2]|0;c[g>>2]=s;i=b+28|0;c[i>>2]=s;j=b+20|0;c[j>>2]=s;c[f>>2]=80;k=b+16|0;c[k>>2]=s+80;e=op(b,d,o,r,q)|0;if(h){pb[c[b+36>>2]&63](b,0,0)|0;e=(c[j>>2]|0)==0?-1:e;c[g>>2]=h;c[f>>2]=0;c[k>>2]=0;c[i>>2]=0;c[j>>2]=0}}else e=op(b,d,o,r,q)|0;f=c[b>>2]|0;c[b>>2]=f|n;if(p|0)qp(b);e=(f&32|0)==0?e:-1}l=t;return e|0} +function Pf(b){b=b|0;var d=0;if(!b){Tn(22);d=0;return d|0}if(!(c[17594]|0)){d=Xf(b)|0;return d|0}d=Xf(b+5|0)|0;if(!d){d=0;return d|0}a[d>>0]=b;a[d+1>>0]=b>>>8;a[d+2>>0]=b>>>16;a[d+3>>0]=-52;a[d+(b+4)>>0]=-86;d=d+4|0;return d|0}function Qf(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;j=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=j+8|0;f=j;if(!(c[17594]|0))if(!(ag(b)|0)){e=Rq(b,e)|0;l=j;return e|0}else{e=$f(b,e)|0;l=j;return e|0}if(!b){if(!e){Tn(22);e=0;l=j;return e|0}f=Oq(e+5|0)|0;if(!f){e=0;l=j;return e|0}a[f>>0]=e;a[f+1>>0]=e>>>8;a[f+2>>0]=e>>>16;a[f+3>>0]=85;a[f+(e+4)>>0]=-86;e=f+4|0;l=j;return e|0}h=a[b+-1>>0]|0;switch(h<<24>>24){case -52:case 85:break;default:{c[f>>2]=b;c[f+4>>2]=h&255;Me(22844,f)}}i=d[b+-3>>0]<<8|d[b+-4>>0]|d[b+-2>>0]<<16;if((a[b+i>>0]|0)!=-86){c[g>>2]=b;c[g+4>>2]=h&255;Me(22885,g)}if(i>>>0>=e>>>0){e=b;l=j;return e|0}f=(e|0)==0;do if(h<<24>>24==-52){if(f){Tn(22);e=0;l=j;return e|0}f=Xf(e+5|0)|0;if(!f){e=0;l=j;return e|0}else{a[f>>0]=e;a[f+1>>0]=e>>>8;a[f+2>>0]=e>>>16;a[f+3>>0]=-52;a[f+(e+4)>>0]=-86;break}}else{if(f){Tn(22);e=0;l=j;return e|0}f=Oq(e+5|0)|0;if(!f){e=0;l=j;return e|0}else{a[f>>0]=e;a[f+1>>0]=e>>>8;a[f+2>>0]=e>>>16;a[f+3>>0]=85;a[f+(e+4)>>0]=-86;break}}while(0);h=f+4|0;cr(h|0,b|0,i|0)|0;Yq(h+i|0,0,e-i|0)|0;Rf(b);e=h;l=j;return e|0}function Rf(b){b=b|0;var e=0,f=0,g=0,h=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=h+8|0;e=h;if(!b){l=h;return}if(!(c[17594]|0))if(!(ag(b)|0)){Pq(b);l=h;return}else{Zf(b);l=h;return}f=a[b+-1>>0]|0;switch(f<<24>>24){case -52:case 85:break;default:{c[e>>2]=b;c[e+4>>2]=f&255;Me(22844,e)}}e=b+-4|0;if((a[b+(d[b+-3>>0]<<8|d[e>>0]|d[b+-2>>0]<<16)>>0]|0)!=-86){c[g>>2]=b;c[g+4>>2]=f&255;Me(22885,g)}if(!(ag(b)|0)){Pq(e);l=h;return}else{Zf(e);l=h;return}}function Sf(a){a=a|0;Vn(1268)|0;c[17595]=a&1;c[17596]=a&2;c[17597]=a&8;c[17598]=a&16;Wn(1268)|0;return}function Tf(){var a=0;Vn(1268)|0;a=(c[17596]|0?2:0)|(c[17595]|0)!=0|(c[17597]|0?8:0)|(c[17598]|0?16:0);Wn(1268)|0;return a|0}function Uf(a){a=a|0;Vn(1268)|0;Vf(a);Wn(1268)|0;return}function Vf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=n+40|0;k=n+32|0;j=n+24|0;g=n+16|0;e=n+8|0;d=n;if(!a){c[17599]=1;b=uq()|0;if((b|0)==(wq()|0)){l=n;return}if(xq(b)|0)Me(22925,d);b=uq()|0;if((b|0)!=(wq()|0))Me(22925,d);if(!(xq(0)|0))Me(22925,d);else{l=n;return}}if(c[17600]|0){Le(23124,f);l=n;return}c[17601]=a>>>0<16384?16384:a;if(c[17599]|0)Ne(22948,e);f=Oa(30)|0;f=(f|0)>0?f:4096;f=(c[17601]|0)+-1+f&0-f;c[17601]=f;f=Aq(0,f,3,34,-1,0)|0;c[17602]=f;if((f|0)==(-1|0)){e=c[17601]|0;f=dp(c[(zo()|0)>>2]|0)|0;c[g>>2]=e;c[g+4>>2]=f;Je(22974,g)}else{c[17603]=1;c[17600]=1}do if(!(c[17600]|0)){a=c[17601]|0;b=Oq(a)|0;c[17602]=b;if(!b){c[j>>2]=a;Me(23022,j)}else{c[17600]=1;h=a;i=b;break}}else{h=c[17601]|0;i=c[17602]|0}while(0);c[i>>2]=h;c[i+4>>2]=0;if(c[17597]|0){l=n;return}Je(23062,k);l=n;return}function Wf(){return 0}function Xf(a){a=a|0;Vn(1268)|0;a=Yf(a)|0;Wn(1268)|0;return a|0}function Yf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=n;if((c[17600]|0)==0?(Vf(32768),(c[17600]|0)==0):0){Je(ze(23170)|0,b);Tn(12);k=0;l=n;return k|0}j=a+31&-32;i=c[17602]|0;k=i;h=(c[17601]|0)+k|0;b=i;a=k;do{if(a>>>0>=h>>>0)break;d=b+4|0;e=c[d>>2]|0;f=c[b>>2]|0;if(!((e&1|0)!=0|f>>>0>>0)){g=7;break}b=b+8+f|0;b=b>>>0>>0?0:b>>>0>>0?b:0;a=b}while(b>>>0>=i>>>0);if((g|0)==7){c[d>>2]=e|1;d=f-j|0;if(d>>>0>8){g=b+8+j|0;c[g>>2]=d+-8;c[g+4>>2]=0;c[b>>2]=j;if((i|0)==(g|0))e=0;else{e=i;while(1){d=e+8+(c[e>>2]|0)|0;d=d>>>0>>0?0:d>>>0>>0?d:0;if((d|0)==(g|0))break;else e=d}}d=c[g>>2]|0;f=g+8+d|0;f=f>>>0>>0?0:f>>>0>>0?f:0;if((e|0)!=0?(c[e+4>>2]&1|0)==0:0){d=d+8+(c[e>>2]|0)|0;c[e>>2]=d}else e=g;if((f|0)!=0?(c[f+4>>2]&1|0)==0:0)c[e>>2]=d+8+(c[f>>2]|0)}}if(a>>>0>=k>>>0?a>>>0<((c[17601]|0)+k|0)>>>0:0)if(!b)a=0;else{if(j|0){c[17604]=(c[17604]|0)+j;c[17605]=(c[17605]|0)+1}a=b+8|0}else{Tn(12);a=0}k=a;l=n;return k|0}function Zf(a){a=a|0;Vn(1268)|0;_f(a);Wn(1268)|0;return}function _f(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;if(!b)return;l=b+-8|0;k=c[l>>2]|0;j=(k|0)!=0&(b&7|0)!=0;if(j){e=b;d=k;do{a[e>>0]=-1;e=e+1|0;d=d+-1|0}while((d|0)!=0&(e&7|0)!=0)}else{e=b;d=k}if(d>>>0>=8){h=d+-8|0;i=h&-8;g=i+8|0;f=e;while(1){m=f;c[m>>2]=-1;c[m+4>>2]=-1;d=d+-8|0;if(d>>>0<=7)break;else f=f+8|0}e=e+g|0;d=h-i|0}if(d|0)while(1){a[e>>0]=-1;d=d+-1|0;if(!d)break;else e=e+1|0}if(j){e=b;d=k;do{a[e>>0]=-86;e=e+1|0;d=d+-1|0}while((d|0)!=0&(e&7|0)!=0)}else{e=b;d=k}if(d>>>0>=8){h=d+-8|0;i=h&-8;g=i+8|0;f=e;while(1){m=f;c[m>>2]=-1431655766;c[m+4>>2]=-1431655766;d=d+-8|0;if(d>>>0<=7)break;else f=f+8|0}e=e+g|0;d=h-i|0}if(d|0)while(1){a[e>>0]=-86;d=d+-1|0;if(!d)break;else e=e+1|0}if(j){e=k;d=b;do{a[d>>0]=85;d=d+1|0;e=e+-1|0}while((e|0)!=0&(d&7|0)!=0)}else{e=k;d=b}if(e>>>0>=8){g=e+-8|0;h=g&-8;i=h+8|0;f=d;while(1){m=f;c[m>>2]=1431655765;c[m+4>>2]=1431655765;e=e+-8|0;if(e>>>0<=7)break;else f=f+8|0}e=g-h|0;d=d+i|0}if(e|0)while(1){a[d>>0]=85;e=e+-1|0;if(!e)break;else d=d+1|0}if(j){e=k;d=b;do{a[d>>0]=0;d=d+1|0;e=e+-1|0}while((e|0)!=0&(d&7|0)!=0)}else{e=k;d=b}if(e>>>0>=8){g=e+-8|0;h=g&-8;i=h+8|0;f=d;while(1){m=f;c[m>>2]=0;c[m+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else f=f+8|0}e=g-h|0;d=d+i|0}if(e|0)while(1){a[d>>0]=0;e=e+-1|0;if(!e)break;else d=d+1|0}if(k|0){c[17604]=(c[17604]|0)-k;c[17605]=(c[17605]|0)+-1}g=b+-4|0;c[g>>2]=c[g>>2]&-2;g=c[17602]|0;h=g;if((g|0)==(l|0))e=0;else{d=(c[17601]|0)+h|0;e=g;while(1){f=e+8+(c[e>>2]|0)|0;f=f>>>0>>0?0:f>>>0>>0?f:0;if((f|0)==(l|0))break;else e=f}}d=c[l>>2]|0;f=b+d|0;if(f>>>0>>0)f=0;else f=f>>>0<((c[17601]|0)+h|0)>>>0?f:0;if((e|0)!=0?(c[e+4>>2]&1|0)==0:0){d=d+8+(c[e>>2]|0)|0;c[e>>2]=d}else e=l;if(!f)return;if(c[f+4>>2]&1|0)return;c[e>>2]=d+8+(c[f>>2]|0);return}function $f(a,b){a=a|0;b=b|0;var d=0,e=0;Vn(1268)|0;d=c[a+-8>>2]|0;if(d>>>0<=b>>>0){e=Yf(b)|0;if(!e)a=0;else{cr(e|0,a|0,d|0)|0;Yq(e+d|0,0,b-d|0)|0;_f(a);a=e}}Wn(1268)|0;return a|0}function ag(a){a=a|0;var b=0,d=0;if((c[17600]|0)!=0?(b=a,d=c[17602]|0,b>>>0>=d>>>0):0)a=b>>>0<((c[17601]|0)+d|0)>>>0;else a=0;return a&1|0}function bg(){var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!(c[17600]|0))return;b=c[17602]|0;d=c[17601]|0;if((d|0)!=0&(b&7|0)!=0){f=d;e=b;do{a[e>>0]=-1;e=e+1|0;f=f+-1|0}while((f|0)!=0&(e&7|0)!=0)}else{e=b;f=d}if(f>>>0>=8){i=f+-8|0;j=i&-8;h=j+8|0;g=e;while(1){k=g;c[k>>2]=-1;c[k+4>>2]=-1;f=f+-8|0;if(f>>>0<=7)break;else g=g+8|0}e=e+h|0;f=i-j|0}if(f){d=f;b=e;while(1){a[b>>0]=-1;d=d+-1|0;if(!d)break;else b=b+1|0}b=c[17602]|0;d=c[17601]|0}if((d|0)!=0&(b&7|0)!=0){e=b;f=d;do{a[e>>0]=-86;e=e+1|0;f=f+-1|0}while((f|0)!=0&(e&7|0)!=0)}else{e=b;f=d}if(f>>>0>=8){i=f+-8|0;j=i&-8;h=j+8|0;g=e;while(1){k=g;c[k>>2]=-1431655766;c[k+4>>2]=-1431655766;f=f+-8|0;if(f>>>0<=7)break;else g=g+8|0}e=e+h|0;f=i-j|0}if(f){d=e;b=f;while(1){a[d>>0]=-86;b=b+-1|0;if(!b)break;else d=d+1|0}b=c[17602]|0;d=c[17601]|0}if((d|0)!=0&(b&7|0)!=0)do{a[b>>0]=85;b=b+1|0;d=d+-1|0}while((d|0)!=0&(b&7|0)!=0);if(d>>>0>=8){f=d+-8|0;g=f&-8;h=g+8|0;e=b;while(1){k=e;c[k>>2]=1431655765;c[k+4>>2]=1431655765;d=d+-8|0;if(d>>>0<=7)break;else e=e+8|0}d=f-g|0;b=b+h|0}if(d|0)while(1){a[b>>0]=85;d=d+-1|0;if(!d)break;else b=b+1|0}b=c[17602]|0;d=c[17601]|0;if((d|0)!=0&(b&7|0)!=0)do{a[b>>0]=0;b=b+1|0;d=d+-1|0}while((d|0)!=0&(b&7|0)!=0);if(d>>>0>=8){f=d+-8|0;g=f&-8;h=g+8|0;e=b;while(1){k=e;c[k>>2]=0;c[k+4>>2]=0;d=d+-8|0;if(d>>>0<=7)break;else e=e+8|0}d=f-g|0;b=b+h|0}if(d|0)while(1){a[b>>0]=0;d=d+-1|0;if(!d)break;else b=b+1|0}if(c[17603]|0)Ho(c[17602]|0,c[17601]|0)|0;c[17602]=0;c[17600]=0;c[17601]=0;return}function cg(){var a=0,b=0,d=0,e=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);a=b;Vn(1268)|0;if(!(c[17600]|0)){Wn(1268)|0;l=b;return}e=c[17601]|0;d=c[17605]|0;c[a>>2]=c[17604];c[a+4>>2]=e;c[a+8>>2]=d;Je(23231,a);Wn(1268)|0;l=b;return}function dg(a){a=a|0;var b=0,d=0,e=0,f=0;f=l;l=l+272|0;if((l|0)>=(m|0))$(272);d=f+8|0;b=f;e=f+16|0;if(c[17606]|0)if((c[17607]|0)==1)Ie(23272,23278,114,23285);else{eg(5);fg()}c[17606]=1;a:do if(a){if(c[17607]|0)Ie(23312,23278,121,23285)}else{if(!(vq(23335,0)|0)){if(!(c[17607]|0))break;Ie(23312,23278,132,23285)}a=aq(23360,23390)|0;b:do if(!a){a=c[(zo()|0)>>2]|0;switch(a|0){case 2:case 13:break b;default:{}}if(!(vq(23392,0)|0)){e=dp(a)|0;c[b>>2]=23360;c[b+4>>2]=e;Je(23406,b);za()}}else{if(Sp(e,256,a)|0?Fq(e)|0:0){bq(a)|0;if(!(c[17607]|0))break a;else Ie(23312,23278,151,23285)}bq(a)|0}while(0);c[17607]=1;l=f;return}while(0);a=Un(1312)|0;if(a|0){c[d>>2]=Pn(a)|0;Je(23450,d);za()}a=aq(23335,23390)|0;if(a|0){if(Sp(e,256,a)|0?Fq(e)|0:0)c[17608]=1;bq(a)|0}eg(1);l=f;return}function eg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=i+24|0;f=i+16|0;e=i+8|0;d=i;b=Vn(1312)|0;if(b|0){c[d>>2]=Pn(b)|0;Je(23505,d);za()}d=c[17609]|0;switch(d|0){case 0:{b=a+-1|0;if(b>>>0<5?(25>>>(b&31)&1)!=0:0)b=14;else b=17;break}case 1:{b=a+-2|0;if(b>>>0<4?(13>>>(b&15)&1)!=0:0)b=14;else b=17;break}case 2:{if((a+-3|0)>>>0<3)b=14;else b=17;break}case 3:{b=a+-2|0;if(b>>>0<5?(29>>>(b&31)&1)!=0:0)b=14;else b=17;break}case 4:{b=a+-2|0;if(b>>>0<5?(29>>>(b&31)&1)!=0:0)b=14;else b=17;break}case 5:{if((a|0)==6)b=14;else b=17;break}default:b=17}if((b|0)==14){c[17609]=a;b=Wn(1312)|0;if(b|0){c[e>>2]=Pn(b)|0;Je(23560,e);za()}if(!(Ee(2)|0)){l=i;return}else g=1}else if((b|0)==17){b=Wn(1312)|0;if(!b)g=0;else{c[f>>2]=Pn(b)|0;Je(23560,f);za()}}switch(d|0){case 0:{d=23669;break}case 1:{d=23664;break}case 2:{d=23654;break}case 3:{d=23642;break}case 4:{d=23636;break}case 5:{d=23624;break}case 6:{d=23615;break}default:d=37665}switch(a|0){case 0:{b=23669;break}case 1:{b=23664;break}case 2:{b=23654;break}case 3:{b=23642;break}case 4:{b=23636;break}case 5:{b=23624;break}case 6:{b=23615;break}default:b=37665}c[h>>2]=d;c[h+4>>2]=b;c[h+8>>2]=g?23678:23686;Je(23693,h);if(g){l=i;return}else fg()}function fg(){$p(0)|0;za()}function gg(){return c[17607]^1|0}function hg(){return ((c[17607]|0)==1?0:c[17608]|0)|0}function ig(){c[17608]=1;return}function jg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);e=g+40|0;f=g+32|0;d=g+24|0;b=g;if((c[17607]|0)==1)Ie(23733,23278,295,23752);if(c[17608]|0){eg(4);c[b>>2]=71847;c[b+4>>2]=23278;c[b+8>>2]=300;c[b+12>>2]=23852;c[b+16>>2]=23752;c[b+20>>2]=a|0?a:23779;Je(23804,b);l=g;return}a=Vn(1312)|0;if(a|0){c[d>>2]=Pn(a)|0;Je(23505,d);za()}if(!(c[17610]|0)){c[17610]=1;a=Wn(1312)|0;if(!a){l=g;return}else{c[f>>2]=Pn(a)|0;Je(23560,f);za()}}else{a=Wn(1312)|0;if(!a){l=g;return}else{c[e>>2]=Pn(a)|0;Je(23560,e);za()}}}function kg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=h;if((c[17607]|0)==1){l=h;return}i=(e|0)!=0;eg(i?5:4);e=(d|0)!=0;c[g>>2]=i?23864:71847;c[g+4>>2]=a;c[g+8>>2]=b;c[g+12>>2]=e?23852:71847;c[g+16>>2]=e?d:71847;c[g+20>>2]=f|0?f:23779;Je(23804,g);l=h;return}function lg(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e+8|0;b=e;if((c[17607]|0)==1){d=0;l=e;return d|0}a=Vn(1312)|0;if(a|0){c[b>>2]=Pn(a)|0;Je(23505,b);za()}a=c[17610]|0;b=Wn(1312)|0;if(!b){d=a;l=e;return d|0}else{c[d>>2]=Pn(b)|0;Je(23560,d);za()}return 0}function mg(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=h+24|0;e=h+16|0;d=h+8|0;b=h;if((c[17607]|0)==1){g=1;l=h;return g|0}a=Vn(1312)|0;if(a|0){c[b>>2]=Pn(a)|0;Je(23505,b);za()}a=c[17609]|0;do if((a|0)==1){a=Wn(1312)|0;if(a|0){c[d>>2]=Pn(a)|0;Je(23560,d);za()}ng(0)|0;a=Vn(1312)|0;if(!a){f=c[17609]|0;break}else{c[e>>2]=Pn(a)|0;Je(23505,e);za()}}else f=a;while(0);a=Wn(1312)|0;if(!a){g=(f|0)==3&1;l=h;return g|0}else{c[g>>2]=Pn(a)|0;Je(23560,g);za()}return 0}function ng(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;if((c[17607]|0)!=1)eg(2);b=Dg(2,a,1)|0;g=(b|0)!=0;if(g)b=Pn(b)|0;else b=0;og(37899,2,0,b);f=Dg(7,a,1)|0;if(!f)b=0;else b=Pn(f)|0;og(37899,7,0,b);e=Dg(8,a,1)|0;if(!e)b=0;else b=Pn(e)|0;og(37899,8,0,b);b=Dg(9,a,1)|0;if(!b)d=0;else d=Pn(b)|0;og(37899,9,0,d);do if(!(f|g&1|e|b)){b=uh(2,a,1)|0;h=(b|0)!=0;if(h)b=Pn(b)|0;else b=0;og(42873,2,0,b);g=uh(11,a,1)|0;if(!g)b=0;else b=Pn(g)|0;og(42873,11,0,b);f=uh(8,a,1)|0;if(!f)b=0;else b=Pn(f)|0;og(42873,8,0,b);e=uh(9,a,1)|0;if(!e)b=0;else b=Pn(e)|0;og(42873,9,0,b);b=uh(10,a,1)|0;if(!b)d=0;else d=Pn(b)|0;og(42873,10,0,d);if(!(g|h&1|f|e|b)){b=ah(2,a,1)|0;h=(b|0)!=0;if(h)b=Pn(b)|0;else b=0;og(36051,2,0,b);g=ah(11,a,1)|0;if(!g)b=0;else b=Pn(g)|0;og(36051,11,0,b);f=ah(8,a,1)|0;if(!f)b=0;else b=Pn(f)|0;og(36051,8,0,b);e=ah(9,a,1)|0;if(!e)b=0;else b=Pn(e)|0;og(36051,9,0,b);b=ah(10,a,1)|0;if(!b)d=0;else d=Pn(b)|0;og(36051,10,0,d);if(!(g|h&1|f|e|b)){b=Ij(1)|0;if(b|0){og(52223,0,0,Pn(b)|0);d=50;b=4;break}og(52223,0,0,0);b=Xh(1,a,1)|0;e=(b|0)!=0;if(e)b=Pn(b)|0;else b=0;og(40871,1,0,b);b=Xh(17,a,1)|0;if(!b){og(40871,17,0,0);d=e?50:0;b=e?4:3;break}else{og(40871,17,0,Pn(b)|0);d=50;b=4;break}}else{d=50;b=4}}else{d=50;b=4}}else{d=50;b=4}while(0);if((c[17607]|0)==1)return d|0;eg(b);return d|0}function og(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;k=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=k;h=(e|0)!=0;if(!h?(Ee(2)|0)==0:0){l=k;return}f=Go(a,36051)|0;i=f|0?a:42873;f=(f|0)==0;g=f?23871:71847;do if(Go(a,37899)|0){if(!(Go(a,42873)|0)){a=dh(b)|0;break}if(f){a=dh(b)|0;break}if(!(Go(a,40871)|0))a=Oh(b)|0;else a=71847}else a=ug(b)|0;while(0);f=(d|0)!=0;c[j>>2]=i;c[j+4>>2]=g;c[j+8>>2]=a;c[j+12>>2]=b;c[j+16>>2]=h?e:23877;c[j+20>>2]=f?23882:71847;c[j+24>>2]=f?d:71847;c[j+28>>2]=f?46947:71847;Je(23885,j);l=k;return}function pg(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e+8|0;b=e;if((c[17607]|0)==1){d=1;l=e;return d|0}a=Vn(1312)|0;if(a|0){c[b>>2]=Pn(a)|0;Je(23505,b);za()}a=(c[17609]|0)==3&1;b=Wn(1312)|0;if(!b){d=a;l=e;return d|0}else{c[d>>2]=Pn(b)|0;Je(23560,d);za()}return 0}function qg(){var a=0,b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e+8|0;b=e;if((c[17607]|0)==1){d=1;l=e;return d|0}a=Vn(1312)|0;if(a|0){c[b>>2]=Pn(a)|0;Je(23505,b);za()}a=((c[17609]|0)+-3|0)>>>0<2&1;b=Wn(1312)|0;if(!b){d=a;l=e;return d|0}else{c[d>>2]=Pn(b)|0;Je(23560,d);za()}return 0}function rg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=g;if((b|0)!=1){c[f>>2]=b;Ne(23929,f)}b=df(1,(d>>>0<8?8:d)+8|0)|0;if(!b){e=0;l=g;return e|0};a[b>>0]=a[23975]|0;a[b+1>>0]=a[23976]|0;a[b+2>>0]=a[23977]|0;a[b+3>>0]=1;c[b+4>>2]=e;e=b;l=g;return e|0}function sg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=g+8|0;e=g;if(!b){c[e>>2]=b;Me(23979,e)}if(Tp(b,23975,3)|0){c[e>>2]=b;Me(23979,e)}e=a[b+3>>0]|0;if((e|0)==(d|0)){l=g;return b+8|0}else{c[f>>2]=d;c[f+4>>2]=b;c[f+8>>2]=e;Me(24027,f)}return 0}function tg(b){b=b|0;var d=0,e=0,f=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=f+8|0;d=f;if(!b){l=f;return}if(Tp(b,23975,3)|0){c[d>>2]=b;Me(24084,d)}d=a[b+3>>0]|0;if(d<<24>>24!=1){c[e>>2]=d<<24>>24;Me(24126,e)}d=c[b+4>>2]|0;if(d|0)rb[d&7](b+8|0);cf(b);l=f;return}function ug(a){a=a|0;if((c[1088]|0)!=(a|0))if((c[1806]|0)!=(a|0))if((c[1835]|0)!=(a|0))if((c[1987]|0)!=(a|0))if((c[3027]|0)==(a|0))a=12108;else{a=37665;return a|0}else a=7948;else a=7340;else a=7224;else a=4352;a=c[a+8>>2]|0;return a|0}function vg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=g;c[f>>2]=0;if((d|0)>65535){d=71;b=0}else{d=wg(f,b,d,e)|0;b=c[f>>2]|0}c[a>>2]=d|0?0:b;l=g;return d|0}function wg(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;j=f&1;Gj();if((c[1088]|0)!=(d|0))if((c[1806]|0)!=(d|0))if((c[1835]|0)!=(d|0))if((c[1987]|0)!=(d|0))if((c[3027]|0)==(d|0)){g=12108;i=6}else{h=12;k=0}else{g=7948;i=6}else{g=7340;i=6}else{g=7224;i=6}else{g=4352;i=6}if((i|0)==6){h=(a[g+4>>0]&1)==0?0:12;k=g}g=f>>>0>15&(h|0)==0?12:h;a:do if(!g){b:do if((e|0)>=6){if((e|0)<9){switch(e|0){case 7:case 6:{i=11;break b}case 8:break;default:{h=0;g=71;break a}}if(!(c[k+36>>2]|0)){h=0;g=71;break a}if((c[k+40>>2]|0)==0?1:(c[k+20>>2]|0)!=16){h=0;g=71;break a}else break}if((e|0)<11){switch(e|0){case 9:{i=11;break b}case 10:break;default:{h=0;g=71;break a}}if(!(c[k+44>>2]|0)){h=0;g=71;break a}if(!(c[k+48>>2]|0)){h=0;g=71;break a}if(!(c[k+60>>2]|0)){h=0;g=71;break a}if((c[k>>2]|0)==316)break;else{h=0;g=71;break a}}if((e|0)>=65537)switch(e|0){case 65537:{i=11;break b}default:{h=0;g=71;break a}}switch(e|0){case 11:break;default:{h=0;g=71;break a}}if(!(c[k+36>>2]|0)){h=0;g=71;break a}if(!(c[k+40>>2]|0)){h=0;g=71;break a}if((c[k+20>>2]|0)!=16){h=0;g=71;break a}}else switch(e|0){case 5:case 2:case 3:case 1:{i=11;break b}case 4:{if(!(c[k+44>>2]|0)){h=0;g=71;break a}if(!(c[k+48>>2]|0)){h=0;g=71;break a}else break b}case 0:{if(gg()|0){h=0;g=71;break a}if(!(nf(0)|0)){h=0;g=71;break a}else break b}default:{h=0;g=71;break a}}while(0);if((i|0)==11){if(!(c[k+36>>2]|0)){h=0;g=71;break}if(!(c[k+40>>2]|0)){h=0;g=71;break}}i=(c[k+28>>2]<<1)+511|0;g=(j|0)!=0;if(g)h=ef(1,i)|0;else h=df(1,i)|0;if(!h){g=Sn()|0;break}j=h&15;l=(j|0)==0;j=16-j|0;h=l?h:h+j|0;j=l?0:j;c[h>>2]=g?1183944770:604576100;c[h+4>>2]=i-j;c[h+8>>2]=j;c[h+12>>2]=k;c[h+16>>2]=d;c[h+48>>2]=e;c[h+52>>2]=f;switch(d|0){case 9:case 8:case 7:{c[h+20>>2]=1;c[h+24>>2]=2;c[h+28>>2]=1;c[h+32>>2]=3;c[h+36>>2]=4;c[h+40>>2]=5;c[h+44>>2]=2;break}case 303:case 10:{c[h+32>>2]=6;c[h+24>>2]=7;c[h+36>>2]=8;break}default:{}}if((e|0)==11){a[h+480>>0]=16;g=0}else g=0}else h=0;while(0);c[b>>2]=g|0?0:h;return ((g|0)==0?0:g&65535|536870912)|0}function xg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!b)return;d=c[b>>2]|0;a:do if((d|0)<1183944770){switch(d|0){case 604576100:break a;default:{}}Be(63,24175)}else{switch(d|0){case 1183944770:break a;default:{}}Be(63,24175)}while(0);c[b>>2]=0;j=c[b+8>>2]|0;d=c[b+4>>2]|0;if((d|0)!=0&(b&7|0)!=0){e=b;do{a[e>>0]=0;e=e+1|0;d=d+-1|0}while((d|0)!=0&(e&7|0)!=0)}else e=b;if(d>>>0>=8){h=d+-8|0;i=h&-8;g=i+8|0;f=e;while(1){k=f;c[k>>2]=0;c[k+4>>2]=0;d=d+-8|0;if(d>>>0<=7)break;else f=f+8|0}e=e+g|0;d=h-i|0}if(d|0)while(1){a[e>>0]=0;d=d+-1|0;if(!d)break;else e=e+1|0}cf(b+(0-j)|0);return}function yg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=n;k=(e|0)==0;i=k?d:f;f=k?b:e;e=c[a+48>>2]|0;a:do if((e|0)<6)switch(e|0){case 1:{k=c[a+12>>2]|0;j=c[k+36>>2]|0;k=c[k+20>>2]|0;if(i>>>0>d>>>0){g=200;break a}if((i>>>0)%(k>>>0)|0|0){g=139;break a}d=(i>>>0)/(k>>>0)|0;if(k>>>0>i>>>0){b=0;l=n;return b|0}i=a+496|0;h=0;e=b;g=0;while(1){b=pb[j&63](i,e,f)|0;h=b>>>0>h>>>0?b:h;g=g+1|0;if(g>>>0>=d>>>0)break;else{e=e+k|0;f=f+k|0}}if(!h){b=0;l=n;return b|0}Te(h+16|0);b=0;l=n;return b|0}case 3:{g=Wl(a,b,d,f,i)|0;break a}case 2:{g=am(a,b,d,f,i)|0;break a}case 5:{g=rm(a,b,d,f,i)|0;break a}case 4:{zb[c[(c[a+12>>2]|0)+44>>2]&1](a+496|0,b,f,i);b=0;l=n;return b|0}case 0:{if((gg()|0)==0?nf(0)|0:0){if((f|0)==(b|0)){b=0;l=n;return b|0}dr(b|0,f|0,i|0)|0;b=0;l=n;return b|0}kg(24224,875,24233,0,24248);g=71;break a}default:{c[h>>2]=e;Me(24270,h)}}else{if((e|0)<9)switch(e|0){case 6:{g=dm(a,b,d,f,i)|0;break a}case 7:{g=Ul(a,b,d,f,i)|0;break a}case 8:{g=_l(a,b,d,f,i)|0;break a}default:{c[h>>2]=e;Me(24270,h)}}if((e|0)<11)switch(e|0){case 9:{g=em(a,b,d,f,i)|0;break a}case 10:{g=tm(a,b,d,f,i)|0;break a}default:{c[h>>2]=e;Me(24270,h)}}if((e|0)>=65537){switch(e|0){case 65537:{g=71;break a}default:{}}c[h>>2]=e;Me(24270,h)}switch(e|0){case 11:{g=nm(a,b,d,f,i)|0;break a}default:{c[h>>2]=e;Me(24270,h)}}}while(0);if(!((b|0)!=0&(g|0)!=0)){b=g;l=n;return b|0}Yq(b|0,66,d|0)|0;b=g;l=n;return b|0}function zg(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=n;i=(e|0)==0;e=i?b:e;i=i?d:f;f=c[a+48>>2]|0;a:do if((f|0)<6)switch(f|0){case 1:{k=c[a+12>>2]|0;j=c[k+40>>2]|0;k=c[k+20>>2]|0;if(i>>>0>d>>>0){g=200;break a}if((i>>>0)%(k>>>0)|0|0){g=139;break a}d=(i>>>0)/(k>>>0)|0;if(k>>>0>i>>>0){g=0;break a}i=a+496|0;h=0;f=b;g=0;while(1){b=pb[j&63](i,f,e)|0;h=b>>>0>h>>>0?b:h;g=g+1|0;if(g>>>0>=d>>>0)break;else{f=f+k|0;e=e+k|0}}if(!h){g=0;break a}Te(h+16|0);g=0;break a}case 3:{g=Xl(a,b,d,e,i)|0;break a}case 2:{g=bm(a,b,d,e,i)|0;break a}case 5:{g=rm(a,b,d,e,i)|0;break a}case 4:{zb[c[(c[a+12>>2]|0)+48>>2]&1](a+496|0,b,e,i);g=0;break a}case 0:{if((gg()|0)==0?nf(0)|0:0){if((e|0)==(b|0)){g=0;break a}dr(b|0,e|0,i|0)|0;g=0;break a}kg(24224,992,24303,0,24248);g=71;break a}default:{c[h>>2]=f;Me(24318,h)}}else{if((f|0)<9)switch(f|0){case 6:{g=dm(a,b,d,e,i)|0;break a}case 7:{g=Vl(a,b,d,e,i)|0;break a}case 8:{g=$l(a,b,d,e,i)|0;break a}default:{c[h>>2]=f;Me(24318,h)}}if((f|0)<11)switch(f|0){case 9:{g=hm(a,b,d,e,i)|0;break a}case 10:{g=um(a,b,d,e,i)|0;break a}default:{c[h>>2]=f;Me(24318,h)}}if((f|0)>=65537){switch(f|0){case 65537:{g=71;break a}default:{}}c[h>>2]=f;Me(24318,h)}switch(f|0){case 11:{g=qm(a,b,d,e,i)|0;break a}default:{c[h>>2]=f;Me(24318,h)}}}while(0);l=n;return g|0}function Ag(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;f=b+12|0;g=b+496|0;e=pb[c[(c[f>>2]|0)+32>>2]&63](g,d,e)|0;if(e|0){b=b+56|0;a[b>>0]=a[b>>0]&-2;return e|0}d=c[(c[f>>2]|0)+28>>2]|0;cr(g+d|0,g|0,d|0)|0;d=b+56|0;a[d>>0]=a[d>>0]|1;d=c[b+48>>2]|0;if((d|0)<10){switch(d|0){case 9:break;default:return e|0}im(b);return e|0}if((d|0)<65537){switch(d|0){case 10:break;default:return e|0}vm(b);return e|0}else{switch(d|0){case 65537:break;default:return e|0}cm(b)|0;return e|0}return 0}function Bg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;k=l;l=l+16|0;if((l|0)>=(m|0))$(16);j=k;switch(c[b+48>>2]|0){case 8:{e=Yl(b,d,e)|0;l=k;return e|0}case 9:{e=fm(b,d,e)|0;l=k;return e|0}case 10:{e=sm(b,d,e)|0;l=k;return e|0}case 11:{e=mm(b,d,e)|0;l=k;return e|0}default:{i=b+12|0;g=c[i>>2]|0;f=c[g+60>>2]|0;if(f|0){ub[f&7](b+496|0,d,e);e=0;l=k;return e|0}h=b+64|0;f=g+20|0;Yq(h|0,0,c[f>>2]|0)|0;if(!d){e=b+56|0;a[e>>0]=a[e>>0]&-3}else{f=c[f>>2]|0;if((f|0)==(e|0))f=e;else{c[j>>2]=e;c[j+4>>2]=f;Je(24351,j);kg(24224,682,24394,0,24407);f=c[(c[i>>2]|0)+20>>2]|0}cr(h|0,d|0,(f>>>0>>0?f:e)|0)|0;e=b+56|0;a[e>>0]=a[e>>0]|2}c[b+112>>2]=0;e=0;l=k;return e|0}}return 0}function Cg(){return 0}function Dg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if((c[1088]|0)!=(b|0))if((c[1806]|0)!=(b|0))if((c[1835]|0)!=(b|0))if((c[1987]|0)!=(b|0))if((c[3027]|0)==(b|0)){f=12108;h=6}else{f=0;d=0;h=9}else{f=7948;h=6}else{f=7340;h=6}else{f=7224;h=6}else{f=4352;h=6}if((h|0)==6)if((a[f+4>>0]&1)==0?(g=c[f+52>>2]|0,(g|0)!=0):0)f=pb[g&63](b,d,e)|0;else{d=1;h=9}if((h|0)==9)if(!e)f=12;else{if(d?(a[f+4>>0]&1)==0:0)f=37736;else f=d?37697:37716;zb[e&1](37899,b,37758,f);f=12}return ((f|0)==0?0:f&65535|16777216)|0}function Eg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+64|0;if((l|0)>=(m|0))$(64);r=s+48|0;p=s+40|0;o=s+32|0;n=s+24|0;k=s+16|0;j=s+8|0;i=s;q=s+52|0;a:do if(!b)if((a|0)!=192){switch(a|0){case 224:case 256:{g=(a|0)==224?2:3;break a}default:{}}if((a|0)!=384)if((a|0)!=521)if((a|0)!=160)if((a|0)!=320)if((a|0)!=512)if((a|0)==511)g=17;else{d=188;l=s;return d|0}else g=12;else g=10;else g=6;else g=5;else g=4}else g=1;else{a=0;while(1){if(!(Go(b,c[1356+(a*48|0)>>2]|0)|0))break;a=a+1|0;if((a|0)==21){a=0;g=2412;h=5;break}}b:do if((h|0)==5){while(1){h=0;f=a+1|0;if(!(Go(b,c[2412+(a<<3)+4>>2]|0)|0))break;if((f|0)==36){a=188;h=47;break}else{a=f;g=2412+(f<<3)|0;h=5}}if((h|0)==47){l=s;return a|0}f=c[g>>2]|0;a=0;while(1){if(!(Go(f,c[1356+(a*48|0)>>2]|0)|0))break b;a=a+1|0;if((a|0)==21){a=188;break}}l=s;return a|0}while(0);if((a|0)<0){d=188;l=s;return d|0}else g=a}while(0);b=c[1356+(g*48|0)>>2]|0;if(!((g+-1|0)>>>0<5|(gg()|0)==0)){d=60;l=s;return d|0}if(e|0)c[e>>2]=c[1356+(g*48|0)+4>>2];if(!d){d=0;l=s;return d|0}c[d>>2]=c[1356+(g*48|0)+12>>2];c[d+4>>2]=c[1356+(g*48|0)+16>>2];a=d+8|0;do if(!(c[a>>2]|0)){f=Sk(q,4,c[1356+(g*48|0)+20>>2]|0,0,0)|0;if(!f){c[a>>2]=c[q>>2];break}else{c[i>>2]=Pn(f)|0;Me(35626,i)}}while(0);a=d+12|0;do if(!(c[a>>2]|0)){f=Sk(q,4,c[1356+(g*48|0)+24>>2]|0,0,0)|0;if(!f){c[a>>2]=c[q>>2];break}else{c[j>>2]=Pn(f)|0;Me(35626,j)}}while(0);a=d+16|0;do if(!(c[a>>2]|0)){f=Sk(q,4,c[1356+(g*48|0)+28>>2]|0,0,0)|0;if(!f){c[a>>2]=c[q>>2];break}else{c[k>>2]=Pn(f)|0;Me(35626,k)}}while(0);a=d+32|0;do if(!(c[a>>2]|0)){f=Sk(q,4,c[1356+(g*48|0)+32>>2]|0,0,0)|0;if(!f){c[a>>2]=c[q>>2];break}else{c[n>>2]=Pn(f)|0;Me(35626,n)}}while(0);a=d+36|0;do if(!(c[a>>2]|0)){f=Sk(q,4,c[1356+(g*48|0)+44>>2]|0,0,0)|0;if(!f){c[a>>2]=c[q>>2];break}else{c[o>>2]=Pn(f)|0;Me(35626,o)}}while(0);a=d+20|0;do if(!(c[a>>2]|0)){f=Sk(q,4,c[1356+(g*48|0)+36>>2]|0,0,0)|0;if(!f){c[a>>2]=c[q>>2];break}else{c[p>>2]=Pn(f)|0;Me(35626,p)}}while(0);f=d+24|0;do if(!(c[f>>2]|0)){a=Sk(q,4,c[1356+(g*48|0)+40>>2]|0,0,0)|0;if(!a){c[f>>2]=c[q>>2];break}else{c[r>>2]=Pn(a)|0;Me(35626,r)}}while(0);a=d+28|0;if(!(c[a>>2]|0))c[a>>2]=kl(1)|0;a=d+40|0;if(c[a>>2]|0){d=0;l=s;return d|0}c[a>>2]=b;d=0;l=s;return d|0}function Fg(b,d,e,f,g,h,i,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=l;l=l+48|0;if((l|0)>=(m|0))$(48);x=y+40|0;v=y+32|0;u=y+24|0;t=y+16|0;s=y+8|0;r=y;w=y+44|0;n=0;while(1){if(!(Go(b,c[1356+(n*48|0)>>2]|0)|0)){b=n;break}n=n+1|0;if((n|0)==21){n=0;p=2412;q=5;break}}a:do if((q|0)==5){while(1){q=0;o=n+1|0;if(!(Go(b,c[2412+(n<<3)+4>>2]|0)|0))break;if((o|0)==36){n=188;q=40;break}else{n=o;p=2412+(o<<3)|0;q=5}}if((q|0)==40){l=y;return n|0}o=c[p>>2]|0;n=0;while(1){if(!(Go(o,c[1356+(n*48|0)>>2]|0)|0)){b=n;break a}n=n+1|0;if((n|0)==21){n=188;break}}l=y;return n|0}while(0);if((b|0)<0){x=188;l=y;return x|0}do if(i|0){n=(c[1356+(b*48|0)+36>>2]|0)+2|0;p=Fo(n)|0;o=(c[1356+(b*48|0)+40>>2]|0)+2|0;p=_e(p+5+(Fo(o)|0)|0)|0;if(!p){x=Sn()|0;l=y;return x|0}a[p>>0]=a[35365]|0;a[p+1>>0]=a[35366]|0;a[p+2>>0]=a[35367]|0;a[p+3>>0]=a[35368]|0;a[p+4>>0]=a[35369]|0;Mp(Np(p+4|0,n)|0,o)|0;Jl(c[i>>2]|0);n=Sk(w,4,p,0,0)|0;if(!n){c[i>>2]=c[w>>2];cf(p);break}else{c[r>>2]=Pn(n)|0;Me(35626,r)}}while(0);if(d|0)c[d>>2]=c[1356+(b*48|0)+12>>2];if(e|0)c[e>>2]=c[1356+(b*48|0)+16>>2];do if(f|0){Jl(c[f>>2]|0);n=Sk(w,4,c[1356+(b*48|0)+20>>2]|0,0,0)|0;if(!n){c[f>>2]=c[w>>2];break}else{c[s>>2]=Pn(n)|0;Me(35626,s)}}while(0);do if(g|0){Jl(c[g>>2]|0);n=Sk(w,4,c[1356+(b*48|0)+24>>2]|0,0,0)|0;if(!n){c[g>>2]=c[w>>2];break}else{c[t>>2]=Pn(n)|0;Me(35626,t)}}while(0);do if(h|0){Jl(c[h>>2]|0);n=Sk(w,4,c[1356+(b*48|0)+28>>2]|0,0,0)|0;if(!n){c[h>>2]=c[w>>2];break}else{c[u>>2]=Pn(n)|0;Me(35626,u)}}while(0);do if(j|0){Jl(c[j>>2]|0);n=Sk(w,4,c[1356+(b*48|0)+32>>2]|0,0,0)|0;if(!n){c[j>>2]=c[w>>2];break}else{c[v>>2]=Pn(n)|0;Me(35626,v)}}while(0);if(!k){x=0;l=y;return x|0}Jl(c[k>>2]|0);n=Sk(w,4,c[1356+(b*48|0)+44>>2]|0,0,0)|0;if(n|0){c[x>>2]=Pn(n)|0;Me(35626,x)}c[k>>2]=c[w>>2];x=0;l=y;return x|0}function Gg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=l;l=l+144|0;if((l|0)>=(m|0))$(144);w=C+80|0;v=C+72|0;u=C+64|0;t=C+56|0;s=C+48|0;r=C+40|0;x=C+32|0;q=C;z=C+88|0;A=C+84|0;c[A>>2]=0;f=z;g=f+44|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));B=(d|0)!=0;if(B)c[d>>2]=0;if(!a){if(!((b|0)>-1&b>>>0<22)){d=0;l=C;return d|0}e=c[1356+(b*48|0)>>2]|0;if(!B){d=e;l=C;return d|0}c[d>>2]=c[1356+(b*48|0)+4>>2];d=e;l=C;return d|0}j=z+8|0;k=z+12|0;n=z+16|0;o=z+32|0;p=z+36|0;c[q>>2]=j;c[q+4>>2]=k;c[q+8>>2]=n;c[q+12>>2]=A;c[q+16>>2]=o;c[q+20>>2]=p;c[q+24>>2]=0;a:do switch(((If(a,0,35370,q)|0)&65535)<<16>>16){case 68:{e=uf(a,46925,5)|0;if((e|0)!=0?(h=zf(e,1)|0,sf(e),(h|0)!=0):0){e=0;while(1){f=c[1356+(e*48|0)>>2]|0;if(!(Go(h,f)|0)){b=e;break}e=e+1|0;if((e|0)==21){e=0;g=2412;i=13;break}}b:do if((i|0)==13){while(1){i=0;f=e+1|0;if(!(Go(h,c[2412+(e<<3)+4>>2]|0)|0)){i=14;break}if((f|0)==36)break;else{e=f;g=2412+(f<<3)|0;i=13}}if((i|0)==14){f=c[g>>2]|0;e=0;do{g=c[1356+(e*48|0)>>2]|0;if(!(Go(f,g)|0)){b=e;f=g;break b}e=e+1|0}while((e|0)!=21)}cf(h);d=0;l=C;return d|0}while(0);cf(h);e=(b|0)<0;if(e|B^1){d=e?0:f;l=C;return d|0}c[d>>2]=c[1356+(b*48|0)+4>>2];d=f;l=C;return d|0}else{y=0;e=0}break}case 0:{if(c[A>>2]|0?(i=z+20|0,Pj(i),_g(i,c[A>>2]|0)|0):0){y=0;e=0;break a}b=z+20|0;a=z+24|0;h=0;f=0;g=1356;while(1){tl(f);f=Sk(q,4,c[1356+(h*48|0)+20>>2]|0,0,0)|0;if(f|0){i=24;break}f=c[q>>2]|0;if(!(wk(f,c[j>>2]|0)|0)){tl(f);f=Sk(q,4,c[1356+(h*48|0)+24>>2]|0,0,0)|0;if(f|0){i=27;break}f=c[q>>2]|0;if(!(wk(f,c[k>>2]|0)|0)){tl(f);f=Sk(q,4,c[1356+(h*48|0)+28>>2]|0,0,0)|0;if(f|0){i=30;break}f=c[q>>2]|0;if(!(wk(f,c[n>>2]|0)|0)){tl(f);f=Sk(q,4,c[1356+(h*48|0)+32>>2]|0,0,0)|0;if(f|0){i=33;break}f=c[q>>2]|0;if(!(wk(f,c[o>>2]|0)|0)){tl(f);f=Sk(q,4,c[1356+(h*48|0)+44>>2]|0,0,0)|0;if(f|0){i=36;break}f=c[q>>2]|0;if(!(wk(f,c[p>>2]|0)|0)){tl(f);f=Sk(q,4,c[1356+(h*48|0)+36>>2]|0,0,0)|0;if(f|0){i=39;break}f=c[q>>2]|0;if(!(wk(f,c[b>>2]|0)|0)){tl(f);f=Sk(q,4,c[1356+(h*48|0)+40>>2]|0,0,0)|0;if(f|0){i=42;break}f=c[q>>2]|0;if(!(wk(f,c[a>>2]|0)|0)){i=44;break}}}}}}}g=h+1|0;if((g|0)==21){y=f;e=0;break a}else{h=g;g=1356+(g*48|0)|0}}if((i|0)==24){c[x>>2]=Pn(f)|0;Me(35626,x)}else if((i|0)==27){c[r>>2]=Pn(f)|0;Me(35626,r)}else if((i|0)==30){c[s>>2]=Pn(f)|0;Me(35626,s)}else if((i|0)==33){c[t>>2]=Pn(f)|0;Me(35626,t)}else if((i|0)==36){c[u>>2]=Pn(f)|0;Me(35626,u)}else if((i|0)==39){c[v>>2]=Pn(f)|0;Me(35626,v)}else if((i|0)==42){c[w>>2]=Pn(f)|0;Me(35626,w)}else if((i|0)==44){e=c[g>>2]|0;if(!B){y=f;break a}c[d>>2]=c[1356+(h*48|0)+4>>2];y=f;break a}break}default:{y=0;e=0}}while(0);Jl(y);Jl(c[j>>2]|0);Jl(c[k>>2]|0);Jl(c[n>>2]|0);Jl(c[A>>2]|0);Rj(z+20|0);Jl(c[o>>2]|0);Jl(c[p>>2]|0);d=e;l=C;return d|0}function Hg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;u=l;l=l+16|0;if((l|0)>=(m|0))$(16);r=u+12|0;s=u+8|0;t=u+4|0;p=u;c[r>>2]=0;c[s>>2]=0;c[t>>2]=0;c[p>>2]=0;c[a>>2]=0;q=(b|0)!=0;do if(q){f=uf(b,46885,0)|0;if(f|0?(e=Eh(f,p,0)|0,sf(f),e|0):0){j=0;i=0;h=0;g=0;f=0;break}k=uf(b,46925,5)|0;if(k|0?(c[p>>2]&512|0)==0:0){j=0;i=0;h=0;g=0;f=0;o=19;break}e=uf(b,46949,0)|0;if(e){n=Af(e,1,5)|0;f=n;sf(e);if(!n){e=65;j=0;i=0;h=0;g=0;break}}else f=0;e=uf(b,39071,0)|0;if(e){n=Af(e,1,5)|0;g=n;sf(e);if(!n){e=65;j=0;i=0;h=0;break}}else g=0;e=uf(b,35378,0)|0;if(e){n=Af(e,1,5)|0;h=n;sf(e);if(!n){e=65;j=0;i=0;break}}else h=0;e=Ig(s,b,35380,0)|0;if(!e){e=uf(b,39075,0)|0;if(e){n=Af(e,1,5)|0;i=n;sf(e);if(!n){e=65;j=0;break}}else i=0;e=uf(b,35382,0)|0;if(e){n=Af(e,1,5)|0;j=n;sf(e);if(!n)e=65;else o=17}else{j=0;o=17}}else{j=0;i=0}}else{k=0;j=0;i=0;h=0;g=0;f=0;o=17}while(0);if((o|0)==17){e=(k|0)!=0;if((d|0)!=0|e)if(e)o=19;else{k=0;o=20}else{k=0;d=0;n=f;o=37}}if((o|0)==19){e=zf(k,1)|0;sf(k);if(!e)e=65;else{k=e;o=20}}do if((o|0)==20){n=df(1,44)|0;if(!n){e=Sn()|0;cf(k);break}e=Eg(0,k|0?k:d,n,0)|0;cf(k);if(e|0){cf(n);break}d=c[n>>2]|0;k=c[n+4>>2]|0;if(!f){o=n+8|0;f=c[o>>2]|0;c[o>>2]=0}if(!g){o=n+12|0;g=c[o>>2]|0;c[o>>2]=0}if(!h){o=n+16|0;h=c[o>>2]|0;c[o>>2]=0}if(!(c[s>>2]|0)){v=n+20|0;e=n+24|0;o=n+28|0;c[s>>2]=Tj(0,c[v>>2]|0,c[e>>2]|0,c[o>>2]|0)|0;c[v>>2]=0;c[e>>2]=0;c[o>>2]=0}if(!i){v=n+32|0;i=c[v>>2]|0;c[v>>2]=0}if(!j){v=n+36|0;e=c[v>>2]|0;c[v>>2]=0}else e=j;Ug(n);cf(n);j=e;n=f;o=37}while(0);do if((o|0)==37){e=Wj(r,d,k,c[p>>2]|0,n,g,h)|0;if(!e){k=sg(c[r>>2]|0,1)|0;if(h|0){v=k+24|0;tl(c[v>>2]|0);c[v>>2]=h}e=c[s>>2]|0;if(e|0){c[k+28>>2]=e;c[s>>2]=0}if(i|0)c[k+32>>2]=i;if(j|0)c[k+36>>2]=j;if(q){e=Ig(t,b,46923,k)|0;if(e|0){j=0;i=0;h=0;f=n;break}f=uf(b,35384,0)|0;if(f){e=Af(f,1,5)|0;sf(f);if(!e){e=65;j=0;i=0;h=0;f=n;break}}else e=0}else e=0;f=c[t>>2]|0;if(f|0){c[k+40>>2]=f;c[t>>2]=0}if(e|0)c[k+44>>2]=e;c[a>>2]=c[r>>2];c[r>>2]=0;e=0;j=0;i=0;h=0;f=n}else f=n}while(0);tg(c[r>>2]|0);tl(f);tl(g);tl(h);Qj(c[s>>2]|0);tl(i);tl(j);Qj(c[t>>2]|0);tl(0);l=u;return e|0}function Ig(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;g=uf(d,e,0)|0;if(g){h=Af(g,1,8)|0;sf(g);if(!h){b=65;return b|0}g=Oj(0)|0;if((f|0)!=0?(c[f+4>>2]|0)==1:0)f=Pg(h,f,g,0,0)|0;else f=_g(g,h)|0;tl(h);if(f){Qj(g);b=f;return b|0}}else{j=_e((Fo(e)|0)+3|0)|0;if(!j){b=Sn()|0;return b|0}g=Np(j,e)|0;a[g>>0]=a[35386]|0;a[g+1>>0]=a[35387]|0;a[g+2>>0]=a[35388]|0;g=uf(d,j,0)|0;if(g){f=Af(g,1,5)|0;sf(g);if(!f){cf(j);b=65;return b|0}}else f=0;g=Np(j,e)|0;a[g>>0]=a[35389]|0;a[g+1>>0]=a[35390]|0;a[g+2>>0]=a[35391]|0;g=uf(d,j,0)|0;if(g){h=Af(g,1,5)|0;sf(g);if(!h){tl(f);cf(j);b=65;return b|0}else i=h}else i=0;h=Np(j,e)|0;a[h>>0]=a[35392]|0;a[h+1>>0]=a[35393]|0;a[h+2>>0]=a[35394]|0;h=uf(d,j,0)|0;if(h){g=Af(h,1,5)|0;sf(h);if(!g){tl(i);tl(f);cf(j);b=65;return b|0}}else g=El(0,1)|0;if((f|0)!=0&(i|0)!=0)g=Tj(0,f,i,g)|0;else{tl(f);tl(i);tl(g);g=0}cf(j)}if(!g){b=0;return b|0}c[b>>2]=g;b=0;return b|0}function Jg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;o=l;l=l+112|0;if((l|0)>=(m|0))$(112);j=o+8|0;h=o;b=o+108|0;i=o+64|0;k=o+36|0;n=o+32|0;d=i;e=d+44|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0));if(Eg(0,a,i,b)|0){n=0;l=o;return n|0}f=Hl(0)|0;g=Hl(0)|0;d=i+8|0;e=i+12|0;a=Uj(0,0,0,c[d>>2]|0,c[e>>2]|0,0)|0;b=i+20|0;if(Nj(f,g,b,a)|0)Me(35395,h);Yj(a);Rj(b);b=c[d>>2]|0;c[k>>2]=b;p=c[e>>2]|0;c[k+4>>2]=p;d=c[i+16>>2]|0;c[k+8>>2]=d;a=b;e=Yg(f,g,a)|0;c[k+12>>2]=e;h=c[i+32>>2]|0;c[k+16>>2]=h;i=c[i+36>>2]|0;c[k+20>>2]=i;c[k+24>>2]=0;tl(f);tl(g);c[j>>2]=a;c[j+4>>2]=p;c[j+8>>2]=d;c[j+12>>2]=e;c[j+16>>2]=h;c[j+20>>2]=i;if(Df(n,0,35444,j)|0)c[n>>2]=0;if(b|0){b=0;do{Jl(a);b=b+1|0;a=c[k+(b<<2)>>2]|0}while((a|0)!=0)}p=c[n>>2]|0;l=o;return p|0}function Kg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=l;l=l+16|0;if((l|0)>=(m|0))$(16);x=z+4|0;y=z;q=a[b>>0]|0;a:do if(q<<24>>24){if((Go(b,46949)|0)==0?(f=c[d+16>>2]|0,f|0):0){if(!(e|0?1:(c[f+12>>2]&32|0)==0))break;f=yl(f)|0;break}if((Go(b,39071)|0)==0?(n=c[d+20>>2]|0,n|0):0){if(!(e|0?1:(c[n+12>>2]&32|0)==0)){f=n;break}f=yl(n)|0;break}if((Go(b,35378)|0)==0?(o=c[d+24>>2]|0,o|0):0){if(!(e|0?1:(c[o+12>>2]&32|0)==0)){f=o;break}f=yl(o)|0;break}if((Go(b,39075)|0)==0?(p=c[d+32>>2]|0,p|0):0){if(!(e|0?1:(c[p+12>>2]&32|0)==0)){f=p;break}f=yl(p)|0;break}if((Go(b,35382)|0)==0?(r=c[d+36>>2]|0,r|0):0){if(!(e|0?1:(c[r+12>>2]&32|0)==0)){f=r;break}f=yl(r)|0;break}if((Go(b,35384)|0)==0?(s=c[d+44>>2]|0,s|0):0){if(!(e|0?1:(c[s+12>>2]&32|0)==0)){f=s;break}f=yl(s)|0;break}if(((Go(b,35492)|0)==0?(t=c[d+28>>2]|0,t|0):0)?(u=c[t>>2]|0,u|0):0){if(!(e|0?1:(c[u+12>>2]&32|0)==0)){f=u;break}f=yl(u)|0;break}if(((Go(b,35496)|0)==0?(v=c[d+28>>2]|0,v|0):0)?(w=c[v+4>>2]|0,w|0):0){if(!(e|0?1:(c[w+12>>2]&32|0)==0)){f=w;break}f=yl(w)|0;break}if(((Go(b,35500)|0)==0?(g=c[d+40>>2]|0,g|0):0)?(h=c[g>>2]|0,h|0):0){if(!(e|0?1:(c[h+12>>2]&32|0)==0)){f=h;break}f=yl(h)|0;break}if(((Go(b,35504)|0)==0?(i=c[d+40>>2]|0,i|0):0)?(j=c[i+4>>2]|0,j|0):0){y=c[(c[d+28>>2]|0)+4>>2]|0;if(y|0?!(e|0?1:(c[y+12>>2]&32|0)==0):0){f=j;break}f=yl(j)|0;break}if((Go(b,35380)|0)==0?(k=c[d+28>>2]|0,k|0):0){f=Zg(k,d)|0;break}if(q<<24>>24==113){h=b+1|0;g=a[h>>0]|0;switch(g<<24>>24){case 64:case 0:break;default:{f=0;break a}}i=d+40|0;f=c[i>>2]|0;if(!f){f=$g(0,d,0,0)|0;c[i>>2]=f;if(!f){f=0;break}g=a[h>>0]|0}if(g<<24>>24!=64){f=Zg(f,d)|0;break}if((Go(b+2|0,49614)|0)==0?(c[d>>2]|0)==2:0)if(!(Mg(f,d,0,0,0,x,y)|0)){f=ul(0,c[x>>2]|0,c[y>>2]<<3)|0;break}else{f=0;break}else f=0}else f=0}else f=0;while(0);l=z;return f|0}function Lg(a,b){a=a|0;b=b|0;var d=0;if((Go(a,35380)|0)==0?(d=c[b+28>>2]|0,d|0):0){b=Oj(0)|0;Al(c[b>>2]|0,c[d>>2]|0)|0;Al(c[b+4>>2]|0,c[d+4>>2]|0)|0;Al(c[b+8>>2]|0,c[d+8>>2]|0)|0;return b|0}if(Go(a,46923)|0){b=0;return b|0}d=b+40|0;a=c[d>>2]|0;if(!a){a=$g(0,b,0,0)|0;c[d>>2]=a;if(!a){b=0;return b|0}}b=Oj(0)|0;Al(c[b>>2]|0,c[a>>2]|0)|0;Al(c[b+4>>2]|0,c[a+4>>2]|0)|0;Al(c[b+8>>2]|0,c[a+8>>2]|0)|0;return b|0}function Mg(b,e,f,g,h,i,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+16|0;if((l|0)>=(m|0))$(16);k=s;o=s+4|0;r=(f|0)!=0;if(r)q=f;else q=Hl(0)|0;p=(g|0)!=0;if(p)n=g;else n=Hl(0)|0;if(!(Nj(q,n,b,e)|0)){b=(h|0)!=0;h=b&1;f=Qk(n,(c[e+12>>2]|0)>>>3,b<<31>>31,o,0)|0;if(!f)f=Sn()|0;else{e=(mk(q,0)|0)!=0;g=c[o>>2]|0;if(e&(g|0)!=0){e=f+(g+((b^1)<<31>>31))|0;a[e>>0]=d[e>>0]|0|128}if(b)a[f>>0]=64;c[i>>2]=f;c[j>>2]=(c[o>>2]|0)+h;f=0}}else{Le(35508,k);f=63}if(!r)tl(q);if(p){l=s;return f|0}tl(n);l=s;return f|0}function Ng(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+16|0;if((l|0)>=(m|0))$(16);j=o+12|0;i=o+8|0;k=o+4|0;n=o;if(!b){n=65;l=o;return n|0}if(!(c[b+12>>2]&4)){n=65;l=o;return n|0}f=wl(b,i)|0;if(!f){n=65;l=o;return n|0}h=(c[i>>2]|0)+7|0;g=h>>>3;c[i>>2]=g;if(h>>>0<16|(g&1|0)==0){n=0;l=o;return n|0}switch(a[f>>0]|0){case 4:{h=f+1|0;f=Sk(k,1,h,(g+-1|0)>>>1,0)|0;if(f|0){n=f;l=o;return n|0}f=((c[i>>2]|0)+-1|0)>>>1;f=Sk(n,1,h+f|0,f,0)|0;g=c[k>>2]|0;if(f|0){tl(g);n=f;l=o;return n|0}h=Qk(c[n>>2]|0,e>>>3,0,j,0)|0;if(!h){g=Sn()|0;f=0}else{e=(mk(g,0)|0)!=0;f=c[j>>2]|0;if(e&(f|0)!=0){f=h+(f+-1)|0;a[f>>0]=d[f>>0]|128;f=c[j>>2]|0}g=0;f=f<<3}tl(c[k>>2]|0);tl(c[n>>2]|0);if(g|0){n=g;l=o;return n|0}ul(b,h,f)|0;n=0;l=o;return n|0}case 64:{if(vl(b,f+1|0,(g<<3)+-8|0)|0){n=0;l=o;return n|0}n=Sn()|0;l=o;return n|0}default:{n=0;l=o;return n|0}}return 0}function Og(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+16|0;if((l|0)>=(m|0))$(16);p=q+8|0;g=q;n=q+12|0;if((c[e+4>>2]|0)!=1){d=69;l=q;return d|0}do if(!(c[17611]|0)){f=Sk(n,4,35561,0,0)|0;if(!f){c[17611]=c[n>>2];break}else{c[g>>2]=Pn(f)|0;Me(35626,g)}}while(0);if(!(c[17612]|0))c[17612]=El(0,7)|0;g=Hl(0)|0;h=Hl(0)|0;i=Hl(0)|0;j=Hl(0)|0;k=e+16|0;Lk(g,b,b,c[k>>2]|0);Lk(h,c[e+24>>2]|0,g,c[k>>2]|0);gk(g,g,1);ek(h,h,1);e=Ml(3)|0;Mk(i,h,e,c[k>>2]|0);Mk(j,h,c[17612]|0,c[k>>2]|0);Lk(j,j,g,c[k>>2]|0);Mk(j,j,c[17611]|0,c[k>>2]|0);Lk(j,j,g,c[k>>2]|0);Lk(a,j,i,c[k>>2]|0);Lk(j,a,a,c[k>>2]|0);Lk(j,j,h,c[k>>2]|0);zl(j,j);if(!(wk(j,g)|0)){f=c[17613]|0;do if(!f){f=Sk(n,4,35661,0,0)|0;if(!f){o=c[n>>2]|0;c[17613]=o;break}else{c[p>>2]=Pn(f)|0;Me(35626,p)}}else o=f;while(0);Lk(a,a,o,c[k>>2]|0);Lk(j,a,a,c[k>>2]|0);Lk(j,j,h,c[k>>2]|0);zl(j,j);f=(wk(j,g)|0)==0;f=f?65:0}else f=0;if((mk(a,0)|0)!=((d|0)!=0|0))hk(a,c[k>>2]|0,a);tl(j);tl(i);tl(h);tl(g);d=f;l=q;return d|0}function Pg(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;r=l;l=l+16|0;if((l|0)>=(m|0))$(16);k=r+12|0;q=r+8|0;n=r+4|0;o=r;if((b|0)!=0?(c[b+12>>2]&4|0)!=0:0){j=wl(b,q)|0;if(!j){f=65;l=r;return f|0}i=(c[q>>2]|0)+7|0;b=i>>>3;c[q>>2]=b;a:do if(!(i>>>0<16|(b&1|0)==0)){switch(a[j>>0]|0){case 4:break;case 64:{b=b+-1|0;c[q>>2]=b;j=j+1|0;break a}default:break a}i=j+1|0;b=Sk(n,1,i,(b+-1|0)>>>1,0)|0;b:do if(!b){b=((c[q>>2]|0)+-1|0)>>>1;b=Sk(o,1,i+b|0,b,0)|0;if(b|0){tl(c[n>>2]|0);break}do if(g|0){b=c[n>>2]|0;i=Qk(c[o>>2]|0,(c[e+12>>2]|0)>>>3,0,k,0)|0;if(!i){b=Sn()|0;if(!b)break;tl(c[n>>2]|0);tl(c[o>>2]|0);break b}e=(mk(b,0)|0)!=0;b=c[k>>2]|0;if(e&(b|0)!=0){b=i+(b+-1)|0;a[b>>0]=d[b>>0]|128;b=c[k>>2]|0}c[g>>2]=i;c[h>>2]=b}while(0);Cl(c[f>>2]|0,c[n>>2]|0);Cl(c[f+4>>2]|0,c[o>>2]|0);El(c[f+8>>2]|0,1)|0;b=0}while(0);f=b;l=r;return f|0}while(0);b=_e(b|0?b:1)|0;if(!b){f=Sn()|0;l=r;return f|0}i=c[q>>2]|0;cr(b|0,j|0,i|0)|0;k=i>>>1;if(k){n=i+-1|0;j=0;do{t=b+j|0;s=a[t>>0]|0;o=b+(n-j)|0;a[t>>0]=a[o>>0]|0;a[o>>0]=s;j=j+1|0}while((j|0)!=(k|0))}}else p=24;do if((p|0)==24){b=Ok(b,(c[e+12>>2]|0)>>>3,q,0)|0;if(b|0){i=c[q>>2]|0;break}t=Sn()|0;l=r;return t|0}while(0);if(!i){n=0;i=0}else{n=d[b>>0]|0;a[b>>0]=n&127;n=n>>>7;i=c[q>>2]|0}o=f+4|0;Rk(c[o>>2]|0,b,i,0);if(g){i=c[q>>2]|0;if((n|0)!=0&(i|0)!=0){a[b>>0]=d[b>>0]|128;i=c[q>>2]|0}k=i>>>1;if(k|0){j=i+-1|0;i=0;do{p=b+i|0;s=a[p>>0]|0;t=b+(j-i)|0;a[p>>0]=a[t>>0]|0;a[t>>0]=s;i=i+1|0}while((i|0)!=(k|0))}c[g>>2]=b;if(h|0)c[h>>2]=c[q>>2]}else cf(b);t=Og(c[f>>2]|0,c[o>>2]|0,n,e)|0;El(c[f+8>>2]|0,1)|0;l=r;return t|0}function Qg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=i+32|0;g=i;c[b>>2]=0;if(((c[e+12>>2]|0)+7&-8|0)!=256){b=63;l=i;return b|0}h=ef(2,32)|0;if(!h){b=Sn()|0;l=i;return b|0};c[g>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;c[g+20>>2]=0;c[g+24>>2]=0;c[g+28>>2]=0;d=Ok(d,0,f,0)|0;if(!d){cf(h);b=Sn()|0;l=i;return b|0}c[g+12>>2]=h;c[g+4>>2]=0;e=c[f>>2]|0;c[g+8>>2]=e>>>0<32?32-e|0:0;c[g+28>>2]=d;c[g+20>>2]=0;c[g+24>>2]=e;e=qh(10,0,h,g,2)|0;cf(d);if(!e){f=a[h>>0]|0;g=h+31|0;d=a[g>>0]|0;k=h+1|0;j=a[k>>0]|0;e=h+30|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;e=h+2|0;j=a[e>>0]|0;k=h+29|0;a[e>>0]=a[k>>0]|0;a[k>>0]=j;k=h+3|0;j=a[k>>0]|0;e=h+28|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;e=h+4|0;j=a[e>>0]|0;k=h+27|0;a[e>>0]=a[k>>0]|0;a[k>>0]=j;k=h+5|0;j=a[k>>0]|0;e=h+26|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;e=h+6|0;j=a[e>>0]|0;k=h+25|0;a[e>>0]=a[k>>0]|0;a[k>>0]=j;k=h+7|0;j=a[k>>0]|0;e=h+24|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;e=h+8|0;j=a[e>>0]|0;k=h+23|0;a[e>>0]=a[k>>0]|0;a[k>>0]=j;k=h+9|0;j=a[k>>0]|0;e=h+22|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;e=h+10|0;j=a[e>>0]|0;k=h+21|0;a[e>>0]=a[k>>0]|0;a[k>>0]=j;k=h+11|0;j=a[k>>0]|0;e=h+20|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;e=h+12|0;j=a[e>>0]|0;k=h+19|0;a[e>>0]=a[k>>0]|0;a[k>>0]=j;k=h+13|0;j=a[k>>0]|0;e=h+18|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;e=h+14|0;j=a[e>>0]|0;k=h+17|0;a[e>>0]=a[k>>0]|0;a[k>>0]=j;k=h+15|0;j=a[k>>0]|0;e=h+16|0;a[k>>0]=a[e>>0]|0;a[e>>0]=j;a[h>>0]=d&63|64;a[g>>0]=f&248;c[b>>2]=h;b=0;l=i;return b|0}else{cf(h);k=e;l=i;return k|0}return 0}function Rg(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;p=l;l=l+32|0;if((l|0)>=(m|0))$(32);j=p+16|0;h=p;Pj(j);c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;k=Il(0)|0;n=Hl(0)|0;o=Hl(0)|0;i=$e(64)|0;if(!i){e=Sn()|0;d=0;e=(e|0)==0?0:e&65535|16777216;Rj(j);Jl(k);Jl(n);Jl(o);cf(d);l=p;return e|0}g=Cj(32,2-(f>>>5&1)|0)|0;c[h+12>>2]=g;c[h+8>>2]=32;f=qh(10,0,i,h,1)|0;if(f|0){d=i;e=f;Rj(j);Jl(k);Jl(n);Jl(o);cf(d);l=p;return e|0}c[b+56>>2]=ul(0,g,256)|0;h=a[i>>0]|0;f=i+31|0;g=a[f>>0]|0;s=i+1|0;r=a[s>>0]|0;q=i+30|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;q=i+2|0;r=a[q>>0]|0;s=i+29|0;a[q>>0]=a[s>>0]|0;a[s>>0]=r;s=i+3|0;r=a[s>>0]|0;q=i+28|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;q=i+4|0;r=a[q>>0]|0;s=i+27|0;a[q>>0]=a[s>>0]|0;a[s>>0]=r;s=i+5|0;r=a[s>>0]|0;q=i+26|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;q=i+6|0;r=a[q>>0]|0;s=i+25|0;a[q>>0]=a[s>>0]|0;a[s>>0]=r;s=i+7|0;r=a[s>>0]|0;q=i+24|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;q=i+8|0;r=a[q>>0]|0;s=i+23|0;a[q>>0]=a[s>>0]|0;a[s>>0]=r;s=i+9|0;r=a[s>>0]|0;q=i+22|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;q=i+10|0;r=a[q>>0]|0;s=i+21|0;a[q>>0]=a[s>>0]|0;a[s>>0]=r;s=i+11|0;r=a[s>>0]|0;q=i+20|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;q=i+12|0;r=a[q>>0]|0;s=i+19|0;a[q>>0]=a[s>>0]|0;a[s>>0]=r;s=i+13|0;r=a[s>>0]|0;q=i+18|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;q=i+14|0;r=a[q>>0]|0;s=i+17|0;a[q>>0]=a[s>>0]|0;a[s>>0]=r;s=i+15|0;r=a[s>>0]|0;q=i+16|0;a[s>>0]=a[q>>0]|0;a[q>>0]=r;a[i>>0]=g&63|64;a[f>>0]=h&248;Rk(k,i,32,0);cf(i);f=d+20|0;ck(j,k,f,e);if(nf(1)|0)Mj(35726,j,e);c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=yl(c[d+8>>2]|0)|0;c[b+12>>2]=yl(c[d+12>>2]|0)|0;c[b+16>>2]=yl(c[d+16>>2]|0)|0;r=b+20|0;Pj(r);Al(c[r>>2]|0,c[f>>2]|0)|0;Al(c[b+24>>2]|0,c[d+24>>2]|0)|0;Al(c[b+28>>2]|0,c[d+28>>2]|0)|0;c[b+32>>2]=yl(c[d+32>>2]|0)|0;c[b+36>>2]=yl(c[d+36>>2]|0)|0;r=b+44|0;Pj(r);Al(c[r>>2]|0,c[j>>2]|0)|0;Al(c[b+48>>2]|0,c[j+4>>2]|0)|0;Al(c[b+52>>2]|0,c[j+8>>2]|0)|0;r=0;s=0;Rj(j);Jl(k);Jl(n);Jl(o);cf(r);l=p;return s|0}function Sg(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;G=l;l=l+112|0;if((l|0)>=(m|0))$(112);v=G+96|0;n=G+92|0;k=G+88|0;t=G+40|0;C=G+36|0;u=G+32|0;D=G+28|0;s=G+24|0;E=G+12|0;F=G;c[C>>2]=0;c[D>>2]=0;i=t;j=i+48|0;do{c[i>>2]=0;i=i+4|0}while((i|0)<(j|0));if(!b){F=79;l=G;return F|0}if(!(c[b+12>>2]&4)){F=79;l=G;return F|0}Pj(E);Pj(F);x=Il(0)|0;y=Hl(0)|0;z=Hl(0)|0;A=Hl(0)|0;B=Uj(c[d>>2]|0,c[d+4>>2]|0,0,c[d+8>>2]|0,c[d+12>>2]|0,c[d+16>>2]|0)|0;if(((c[B+12>>2]|0)+7&-8|0)!=256){F=63;l=G;return F|0}j=Qg(k,c[d+56>>2]|0,B)|0;w=c[k>>2]|0;do if(!j){Rk(x,w,32,0);i=w;if(!h){ck(F,x,d+20|0,B);j=Mg(F,B,y,z,0,D,s)|0;if(j|0){i=0;break}if(nf(1)|0)Qe(35747,c[D>>2]|0,c[s>>2]|0)}else{j=Pg(h,B,F,D,s)|0;if(j|0){i=0;break}if(nf(1)|0)Qe(35740,c[D>>2]|0,c[s>>2]|0);if(!(dk(F,B)|0)){j=195;i=0;break}}q=wl(b,n)|0;o=((c[n>>2]|0)+7|0)>>>3;if(nf(1)|0)Qe(35754,q,o);p=t+12|0;c[p>>2]=i;k=t+4|0;c[k>>2]=32;h=t+8|0;c[h>>2]=32;b=t+28|0;c[b>>2]=q;n=t+24|0;c[n>>2]=o;j=qh(g,0,w,t,2)|0;if(!j){i=0;do{H=w+i|0;j=a[H>>0]|0;r=w+(63-i)|0;a[H>>0]=a[r>>0]|0;a[r>>0]=j;i=i+1|0}while((i|0)!=32);if(nf(1)|0)Qe(52990,w,64);Rk(A,w,64,0);ck(E,A,d+20|0,B);if(nf(1)|0)Mj(35761,E,B);j=Mg(E,B,y,z,0,C,u)|0;if(j|0){i=c[C>>2]|0;break}if(!(nf(1)|0)){j=c[C>>2]|0;i=j;r=c[u>>2]|0}else{j=c[C>>2]|0;r=c[u>>2]|0;Qe(35766,j,r);i=j}c[p>>2]=j;c[k>>2]=0;c[h>>2]=r;c[b>>2]=c[D>>2];c[t+20>>2]=0;c[n>>2]=c[s>>2];c[t+44>>2]=q;c[t+36>>2]=0;c[t+40>>2]=o;j=qh(g,0,w,t,3)|0;if(!j){ul(e,i,r<<3)|0;c[C>>2]=0;i=0;do{t=w+i|0;e=a[t>>0]|0;H=w+(63-i)|0;a[t>>0]=a[H>>0]|0;a[H>>0]=e;i=i+1|0}while((i|0)!=32);if(nf(1)|0)Qe(35773,w,64);Rk(f,w,64,0);j=d+32|0;Lk(f,f,x,c[j>>2]|0);ik(f,f,A,c[j>>2]|0);j=Ok(f,32,v,0)|0;if(!j){j=Sn()|0;if(!j){j=0;i=r}else{i=0;break}}else{c[C>>2]=j;i=c[v>>2]|0;c[u>>2]=i}if(nf(1)|0)Qe(35780,j,i);ul(f,j,i<<3)|0;c[C>>2]=0;j=0;i=0}}else i=0}else i=0;while(0);Jl(x);Jl(y);Jl(z);Jl(A);cf(w);Yj(B);Rj(E);Rj(F);cf(c[D>>2]|0);cf(i);H=j;l=G;return H|0}function Tg(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=l;l=l+176|0;if((l|0)>=(m|0))$(176);n=y+100|0;w=y+88|0;x=y+84|0;j=y+80|0;t=y+76|0;p=y+72|0;k=y+104|0;i=y+24|0;u=y+12|0;v=y;c[x>>2]=0;c[t>>2]=0;if(!b){x=79;l=y;return x|0}if(!(e|0?(c[b+12>>2]&4|0)!=0:0)){x=79;l=y;return x|0}if(!(f|0?(c[e+12>>2]&4|0)!=0:0)){x=79;l=y;return x|0}if(!(c[f+12>>2]&4)){x=79;l=y;return x|0}if((g|0)!=10){x=5;l=y;return x|0}Pj(w);Pj(u);Pj(v);q=Hl(0)|0;r=Hl(0)|0;s=Uj(c[d>>2]|0,c[d+4>>2]|0,0,c[d+8>>2]|0,c[d+12>>2]|0,c[d+16>>2]|0)|0;if((c[s+12>>2]&-8|0)!=256){x=63;l=y;return x|0}g=Pg(h,s,w,x,j)|0;do if(!g)if(dk(w,s)|0){if(nf(1)|0)Qe(35747,c[x>>2]|0,c[j>>2]|0);if((c[j>>2]|0)==32){h=wl(b,n)|0;b=((c[n>>2]|0)+7|0)>>>3;if(nf(1)|0)Qe(35754,h,b);o=wl(e,n)|0;g=((c[n>>2]|0)+7|0)>>>3;if(nf(1)|0)Qe(52990,o,g);if((g|0)==32){c[i+12>>2]=o;c[i+4>>2]=0;c[i+8>>2]=32;c[i+28>>2]=c[x>>2];c[i+20>>2]=0;c[i+24>>2]=c[j>>2];c[i+44>>2]=h;c[i+36>>2]=0;c[i+40>>2]=b;g=qh(10,0,k,i,3)|0;if(!g){g=0;do{e=k+g|0;i=a[e>>0]|0;j=k+(63-g)|0;a[e>>0]=a[j>>0]|0;a[j>>0]=i;g=g+1|0}while((g|0)!=32);if(nf(1)|0)Qe(35773,k,64);Rk(q,k,64,0);i=xl(f,n)|0;b=(c[n>>2]|0)+7|0;h=b>>>3;b=b>>>4;if(b|0){e=h+-1|0;g=0;do{k=i+g|0;f=a[k>>0]|0;n=i+(e-g)|0;a[k>>0]=a[n>>0]|0;a[n>>0]=f;g=g+1|0}while((g|0)!=(b|0))}if(nf(1)|0)Qe(52997,i,h);Rk(r,i,h,0);cf(i);if((h|0)==32){ck(u,r,d+20|0,s);ck(v,q,w,s);g=c[v>>2]|0;zl(g,g);ak(u,u,v,s);g=Mg(u,s,r,q,0,t,p)|0;if(!g){if((c[p>>2]|0)!=32){g=8;break}g=(Tp(c[t>>2]|0,o,32)|0)==0;g=g?0:8}}else g=139}}else g=139}else g=139}else g=195;while(0);cf(c[x>>2]|0);cf(c[t>>2]|0);Yj(s);Jl(r);Jl(q);Rj(u);Rj(v);Rj(w);x=g;l=y;return x|0}function Ug(a){a=a|0;var b=0;b=a+8|0;tl(c[b>>2]|0);c[b>>2]=0;b=a+12|0;tl(c[b>>2]|0);c[b>>2]=0;b=a+16|0;tl(c[b>>2]|0);c[b>>2]=0;Rj(a+20|0);b=a+32|0;tl(c[b>>2]|0);c[b>>2]=0;a=a+36|0;tl(c[a>>2]|0);c[a>>2]=0;return}function Vg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;e=l;l=l+48|0;if((l|0)>=(m|0))$(48);d=e;c[d>>2]=c[b>>2];c[d+4>>2]=c[b+4>>2];c[d+40>>2]=c[b+40>>2];c[d+8>>2]=yl(c[b+8>>2]|0)|0;c[d+12>>2]=yl(c[b+12>>2]|0)|0;c[d+16>>2]=yl(c[b+16>>2]|0)|0;f=d+20|0;Pj(f);Al(c[f>>2]|0,c[b+20>>2]|0)|0;Al(c[d+24>>2]|0,c[b+24>>2]|0)|0;Al(c[d+28>>2]|0,c[b+28>>2]|0)|0;c[d+32>>2]=yl(c[b+32>>2]|0)|0;c[d+36>>2]=yl(c[b+36>>2]|0)|0;b=d;d=a+44|0;do{c[a>>2]=c[b>>2];a=a+4|0;b=b+4|0}while((a|0)<(d|0));l=e;return}function Wg(a){a=a|0;switch(a|0){case 0:{a=35795;break}case 1:{a=45456;break}case 2:{a=35787;break}default:a=37665}return a|0}function Xg(a){a=a|0;return ((a|0)==0?35815:(a|0)==1?35807:37665)|0}function Yg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+32|0;if((l|0)>=(m|0))$(32);p=q+16|0;k=q+8|0;g=q;h=q+24|0;o=q+20|0;i=((lk(e)|0)+7|0)>>>3;j=i<<1|1;n=gf(j)|0;a[n>>0]=4;f=n+1|0;e=Tk(5,f,i,h,b)|0;if(e|0){c[g>>2]=Pn(e)|0;Me(35824,g)}e=c[h>>2]|0;if(i>>>0>e>>>0){g=i-e|0;dr(f+g|0,f|0,e|0)|0;Yq(f|0,0,g|0)|0}b=f+i|0;e=Tk(5,b,i,h,d)|0;if(e|0){c[k>>2]=Pn(e)|0;Me(35824,k)}e=c[h>>2]|0;if(i>>>0>e>>>0){k=i-e|0;dr(b+k|0,b|0,e|0)|0;Yq(b|0,0,k|0)|0}e=Sk(o,5,n,j,0)|0;if(!e){cf(n);l=q;return c[o>>2]|0}else{c[p>>2]=Pn(e)|0;Me(35846,p)}return 0}function Zg(a,b){a=a|0;b=b|0;var d=0,e=0;d=Hl(0)|0;e=Hl(0)|0;if(!(Nj(d,e,a,b)|0))a=Yg(d,e,c[b+16>>2]|0)|0;else a=0;tl(d);tl(e);return a|0}function _g(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;k=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=k+12|0;i=k+8|0;j=k+4|0;e=k;do if((d|0)!=0?(c[d+12>>2]&4|0)!=0:0){d=wl(d,e)|0;if(d|0){e=((c[e>>2]|0)+7|0)>>>3;c[h>>2]=e;g=0;break}j=65;l=k;return j|0}else f=6;while(0);do if((f|0)==6){g=((lk(d)|0)+7|0)>>>3;c[h>>2]=g;e=gf(g)|0;d=Tk(5,e,g,h,d)|0;if(!d){d=e;g=e;e=c[h>>2]|0;break}cf(e);j=d;l=k;return j|0}while(0);if(!e){cf(g);j=65;l=k;return j|0}if((a[d>>0]|0)!=4){cf(g);j=69;l=k;return j|0}e=e+-1|0;if(e&1|0){cf(g);j=65;l=k;return j|0}e=e>>>1;c[h>>2]=e;d=d+1|0;e=Sk(i,5,d,e,0)|0;if(e|0){cf(g);j=e;l=k;return j|0}h=c[h>>2]|0;d=Sk(j,5,d+h|0,h,0)|0;cf(g);if(!d){Al(c[b>>2]|0,c[i>>2]|0)|0;Al(c[b+4>>2]|0,c[j>>2]|0)|0;El(c[b+8>>2]|0,1)|0;tl(c[i>>2]|0);tl(c[j>>2]|0);j=0;l=k;return j|0}else{tl(c[i>>2]|0);j=d;l=k;return j|0}return 0}function $g(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=h;if(!d)d=c[b+28>>2]|0;if(!e)e=c[b+44>>2]|0;if(!((d|0)!=0&(e|0)!=0)){b=0;l=h;return b|0}if(!(c[b+16>>2]|0)){b=0;l=h;return b|0}if(!(c[b+20>>2]|0)){b=0;l=h;return b|0}if((c[b>>2]|0)==2?(c[b+24>>2]|0)==0:0){b=0;l=h;return b|0}if((c[b+4>>2]|0)==1?c[b+8>>2]&4096|0:0){if(Qg(f,e,b)|0){b=0;l=h;return b|0}e=Il(0)|0;Rk(e,c[f>>2]|0,32,0);cf(c[f>>2]|0);if(!a){a=Oj(0)|0;if(!a)a=0;else g=15}else g=15;if((g|0)==15)ck(a,e,d,b);tl(e);b=a;l=h;return b|0}if(!a){a=Oj(0)|0;if(!a){b=0;l=h;return b|0}}ck(a,e,d,b);b=a;l=h;return b|0}function ah(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;n=l;l=l+128|0;if((l|0)>=(m|0))$(128);j=n;a:do if(th(b,8,0,0)|0)if(!e)b=5;else{zb[e&1](36051,b,37758,36151);b=5}else switch(b|0){case 2:{b=0;do{a[j+b>>0]=b;b=b+1|0}while((b|0)!=64);b=bh(2,35867,9,j,64,35877,20)|0;if(!b)if(d){a[j>>0]=48;a[j+1>>0]=49;a[j+2>>0]=50;a[j+3>>0]=51;a[j+4>>0]=52;a[j+5>>0]=53;a[j+6>>0]=54;a[j+7>>0]=55;a[j+8>>0]=56;a[j+9>>0]=57;a[j+10>>0]=58;a[j+11>>0]=59;a[j+12>>0]=60;a[j+13>>0]=61;a[j+14>>0]=62;a[j+15>>0]=63;a[j+16>>0]=64;a[j+17>>0]=65;a[j+18>>0]=66;a[j+19>>0]=67;b=bh(2,35898,9,j,20,35908,20)|0;if(!b){b=80;d=0;while(1){a[j+d>>0]=b;d=d+1|0;if((d|0)==100)break;else b=b+1|0}b=bh(2,35929,9,j,100,35939,20)|0;if(!b){b=112;d=0;while(1){a[j+d>>0]=b;d=d+1|0;if((d|0)==49)break;else b=b+1|0}b=bh(2,35960,9,j,49,35970,20)|0;if(!b)b=0;else{d=36036;k=12}}else{d=36021;k=12}}else{d=36006;k=12}}else b=0;else{d=35991;k=12}if((k|0)==12)if(!e)b=50;else{zb[e&1](36051,2,d,b);b=50}break a}case 11:{b=c[677]|0;if(!b){b=0;break a}b:do if(!d){j=c[678]|0;k=Fo(j)|0;d=c[679]|0;d=bh(11,j,k,d,Fo(d)|0,2720,28)|0;if(!d){b=0;break a}}else{f=0;while(1){j=c[2708+(f*40|0)+4>>2]|0;k=Fo(j)|0;d=c[2708+(f*40|0)+8>>2]|0;d=bh(11,j,k,d,Fo(d)|0,2708+(f*40|0)+12|0,28)|0;if(d|0)break b;f=f+1|0;b=c[2708+(f*40|0)>>2]|0;if(!b){b=0;break a}}}while(0);if(!e){b=50;break a}zb[e&1](36051,11,b,d);b=50;break a}case 8:{b=c[747]|0;if(!b){b=0;break a}c:do if(!d){h=c[748]|0;i=Fo(h)|0;d=c[749]|0;d=bh(8,h,i,d,Fo(d)|0,3e3,32)|0;if(!d){f=c[749]|0;f=Ol(f,Fo(f)|0)|0;if(f){d=c[748]|0;Pl(f,d,Fo(d)|0);d=Tl(f,j)|0;if(d)if((c[j>>2]|0)==32?(Tp(d,3e3,32)|0)==0:0){Rl(f);b=0;break a}else{d=f;k=36}else{d=f;k=33}}else d=36056}}else{i=0;while(1){g=2988+(i*44|0)+4|0;p=c[g>>2]|0;o=Fo(p)|0;f=2988+(i*44|0)+8|0;d=c[f>>2]|0;h=2988+(i*44|0)+12|0;d=bh(8,p,o,d,Fo(d)|0,h,32)|0;if(d|0)break c;d=c[f>>2]|0;d=Ol(d,Fo(d)|0)|0;if(!d){d=36056;break c}f=c[g>>2]|0;Pl(d,f,Fo(f)|0);f=Tl(d,j)|0;if(!f){k=33;break c}if((c[j>>2]|0)!=32){k=36;break c}if(Tp(f,h,32)|0){k=36;break c}Rl(d);i=i+1|0;b=c[2988+(i*44|0)>>2]|0;if(!b){b=0;break a}}}while(0);if((k|0)==33){Rl(d);d=36081}else if((k|0)==36){Rl(d);d=36111}if(!e){b=50;break a}zb[e&1](36051,8,b,d);b=50;break a}case 9:{b=c[824]|0;if(!b){b=0;break a}d:do if(!d){o=c[825]|0;p=Fo(o)|0;d=c[826]|0;d=bh(9,o,p,d,Fo(d)|0,3308,48)|0;if(!d){b=0;break a}}else{f=0;while(1){o=c[3296+(f*60|0)+4>>2]|0;p=Fo(o)|0;d=c[3296+(f*60|0)+8>>2]|0;d=bh(9,o,p,d,Fo(d)|0,3296+(f*60|0)+12|0,48)|0;if(d|0)break d;f=f+1|0;b=c[3296+(f*60|0)>>2]|0;if(!b){b=0;break a}}}while(0);if(!e){b=50;break a}zb[e&1](36051,9,b,d);b=50;break a}case 10:{b=c[929]|0;if(!b){b=0;break a}e:do if(!d){o=c[930]|0;p=Fo(o)|0;d=c[931]|0;d=bh(10,o,p,d,Fo(d)|0,3728,64)|0;if(!d){b=0;break a}}else{f=0;while(1){o=c[3716+(f*76|0)+4>>2]|0;p=Fo(o)|0;d=c[3716+(f*76|0)+8>>2]|0;d=bh(10,o,p,d,Fo(d)|0,3716+(f*76|0)+12|0,64)|0;if(d|0)break e;f=f+1|0;b=c[3716+(f*76|0)>>2]|0;if(!b){b=0;break a}}}while(0);if(!e){b=50;break a}zb[e&1](36051,10,b,d);b=50;break a}default:{b=5;break a}}while(0);l=n;return ((b|0)==0?0:b&65535|16777216)|0}function bh(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0;j=l;l=l+16|0;if((l|0)>=(m|0))$(16);i=j;do if((sh(a)|0)==(h|0))if(!(eh(i,a,2)|0)){f=(nh(c[i>>2]|0,e,f)|0)==0;e=c[i>>2]|0;if(!f){kh(e);e=36834;break}lh(e,b,d);e=ph(c[i>>2]|0,a)|0;if(!e){kh(c[i>>2]|0);e=36856;break}else{e=(Tp(e,g,h)|0)==0;kh(c[i>>2]|0);e=e?0:36819;break}}else e=49699;else e=36876;while(0);l=j;return e|0}function ch(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;if(!a){o=0;return o|0}if((Jo(a,36895,4)|0)!=0?(Jo(a,36900,4)|0)!=0:0)n=a;else n=a+4|0;f=c[1910]|0;a:do if((f|0)!=0?(g=c[f>>2]|0,(g|0)!=0):0){d=0;e=g;while(1){d=d+1|0;if(!(Op(n,e)|0)){m=7620;b=g;o=f;g=29;break a}e=c[f+(d<<2)>>2]|0;if(!e){g=9;break}}}else g=9;while(0);b:do if((g|0)==9){e=c[1944]|0;if(e|0?(h=c[e>>2]|0,h|0):0){d=0;f=h;do{d=d+1|0;if(!(Op(n,f)|0)){m=7756;b=h;o=e;g=29;break b}f=c[e+(d<<2)>>2]|0}while((f|0)!=0)}e=c[1929]|0;if(e|0?(i=c[e>>2]|0,i|0):0){d=0;f=i;do{d=d+1|0;if(!(Op(n,f)|0)){m=7696;b=i;o=e;g=29;break b}f=c[e+(d<<2)>>2]|0}while((f|0)!=0)}e=c[1960]|0;if(e|0?(j=c[e>>2]|0,j|0):0){d=0;f=j;do{d=d+1|0;if(!(Op(n,f)|0)){m=7820;b=j;o=e;g=29;break b}f=c[e+(d<<2)>>2]|0}while((f|0)!=0)}e=c[1976]|0;if(e|0?(k=c[e>>2]|0,k|0):0){d=0;f=k;do{d=d+1|0;if(!(Op(n,f)|0)){m=7884;b=k;o=e;g=29;break b}f=c[e+(d<<2)>>2]|0}while((f|0)!=0)}e=c[1869]|0;if(e|0?(l=c[e>>2]|0,l|0):0){d=0;f=l;do{d=d+1|0;if(!(Op(n,f)|0)){m=7456;b=l;o=e;g=29;break b}f=c[e+(d<<2)>>2]|0}while((f|0)!=0)}}while(0);c:do if((g|0)==29?b|0:0){d=0;while(1){d=d+1|0;if(!(Op(n,b)|0))break;b=c[o+(d<<2)>>2]|0;if(!b)break c}o=c[m>>2]|0;return o|0}while(0);if(Op(a,c[1907]|0)|0)if(Op(a,c[1941]|0)|0)if(Op(a,c[1926]|0)|0)if(Op(a,c[1957]|0)|0)if(Op(a,c[1973]|0)|0)if(!(Op(a,c[1866]|0)|0))b=7456;else{o=0;return o|0}else b=7884;else b=7820;else b=7696;else b=7756;else b=7620;o=c[b>>2]|0;return o|0}function dh(a){a=a|0;if((c[1905]|0)!=(a|0))if((c[1939]|0)!=(a|0))if((c[1924]|0)!=(a|0))if((c[1955]|0)!=(a|0))if((c[1971]|0)!=(a|0))if((c[1864]|0)==(a|0))a=7456;else{a=37665;return a|0}else a=7884;else a=7820;else a=7696;else a=7756;else a=7620;a=c[a+8>>2]|0;return a|0}function eh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=f;if(!(d&-260)){d=fh(e,b,d)|0;b=c[e>>2]|0}else{d=45;b=0}c[a>>2]=d|0?0:b;l=f;return d|0}function fh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=e&1;j=(g|0)!=0;k=(e&2|0)==0;g=(g<<9^512)+535&1552;h=g+28|0;if(j)l=$e(h)|0;else l=_e(h)|0;if((l|0)==0?(f=Qn(c[(zo()|0)>>2]|0)|0,f|0):0){n=f;return n|0}i=l+g|0;c[l>>2]=i;c[l+8>>2]=g+-15;c[l+4>>2]=0;g=i+4+4|0;c[g>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;c[i>>2]=j?378630161:285677921;c[i+4>>2]=h;a[i+12>>0]=e>>>6&4|e&1;if(!k){switch(d|0){case 10:case 9:{c[i+24>>2]=128;f=256;break}case 311:case 308:{c[i+24>>2]=32;f=64;break}default:{c[i+24>>2]=64;f=128}}k=$e(f)|0;c[i+20>>2]=k;if((k|0)==0?(m=Qn(c[(zo()|0)>>2]|0)|0,gh(l),m|0):0){n=m;return n|0}}Gj();if(d|0?(n=hh(c[l>>2]|0,d)|0,n|0):0){gh(l);return n|0}c[b>>2]=l;n=0;return n|0}function gh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0;k=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=k+16|0;i=k+8|0;j=k;if(!b){l=k;return}d=c[b>>2]|0;e=c[d+8>>2]|0;if(e){g=b+4|0;d=c[g>>2]|0;if(!d)d=e;else{f=b+12|0;if((iq(f,d,1,e)|0)!=1)He(36953,630,36958);d=c[b>>2]|0;e=c[d+16>>2]|0;if(e){do{d=c[g>>2]|0;if(!d)d=e+16|0;else{n=e+16|0;ub[c[(c[e>>2]|0)+32>>2]&7](n,f,d);d=n}ub[c[(c[e>>2]|0)+32>>2]&7](d,0,0);e=c[e+4>>2]|0}while((e|0)!=0);d=c[b>>2]|0}c[g>>2]=0;d=c[d+8>>2]|0}bq(d)|0;d=c[b>>2]|0;c[d+8>>2]=0;c[h>>2]=b;n=i;c[n>>2]=42;c[n+4>>2]=0;i=kr(c[h>>2]|0,0,c[i>>2]|0,c[i+4>>2]|0)|0;n=j;c[n>>2]=i;c[n+4>>2]=D}e=c[d+16>>2]|0;if(e){do{j=e;e=c[e+4>>2]|0;d=c[j+8>>2]|0;if((d|0)!=0&(j&7|0)!=0){f=j;do{a[f>>0]=0;f=f+1|0;d=d+-1|0}while((d|0)!=0&(f&7|0)!=0)}else f=j;if(d>>>0>=8){h=d+-8|0;i=h&-8;g=f+8|0;while(1){n=f;c[n>>2]=0;c[n+4>>2]=0;d=d+-8|0;if(d>>>0<=7)break;else f=f+8|0}f=g+i|0;d=h-i|0}if(d|0)while(1){a[f>>0]=0;d=d+-1|0;if(!d)break;else f=f+1|0}cf(j)}while((e|0)!=0);d=c[b>>2]|0}f=c[d+20>>2]|0;if(f){n=c[d+24>>2]|0;e=n<<1;if((n|0)!=0&(f&7|0)!=0){d=f;do{a[d>>0]=0;d=d+1|0;e=e+-1|0}while((e|0)!=0&(d&7|0)!=0)}else d=f;if(e>>>0>=8){g=e+-8|0;h=g&-8;i=h+8|0;f=d;while(1){n=f;c[n>>2]=0;c[n+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else f=f+8|0}e=g-h|0;d=d+i|0}if(e|0)while(1){a[d>>0]=0;e=e+-1|0;if(!e)break;else d=d+1|0}cf(c[(c[b>>2]|0)+20>>2]|0);d=c[b>>2]|0}d=c[d+4>>2]|0;if((d|0)!=0&(b&7|0)!=0){e=b;do{a[e>>0]=0;e=e+1|0;d=d+-1|0}while((d|0)!=0&(e&7|0)!=0)}else e=b;if(d>>>0>=8){g=d+-8|0;h=g&-8;i=h+8|0;f=e;while(1){n=f;c[n>>2]=0;c[n+4>>2]=0;d=d+-8|0;if(d>>>0<=7)break;else f=f+8|0}d=g-h|0;e=e+i|0}if(d|0)while(1){a[e>>0]=0;d=d+-1|0;if(!d)break;else e=e+1|0}cf(b);l=k;return}function hh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=i;h=b+16|0;e=c[h>>2]|0;a:do if(e|0){while(1){if((c[c[e>>2]>>2]|0)==(d|0)){e=0;break}e=c[e+4>>2]|0;if(!e)break a}l=i;return e|0}while(0);if((c[1905]|0)!=(d|0))if((c[1939]|0)!=(d|0))if((c[1924]|0)!=(d|0))if((c[1955]|0)!=(d|0))if((c[1971]|0)!=(d|0))if((c[1864]|0)==(d|0))g=7456;else{c[f>>2]=d;Oe(36905,f);h=5;l=i;return h|0}else g=7884;else g=7820;else g=7696;else g=7756;else g=7620;if(((d|0)==1?gg()|0:0)?(jg(36944),hg()|0):0){h=5;l=i;return h|0}d=(c[g+44>>2]|0)+16|0;f=b+12|0;if(!(a[f>>0]&1))e=_e(d)|0;else e=$e(d)|0;if(!e){h=Qn(c[(zo()|0)>>2]|0)|0;l=i;return h|0}else{c[e>>2]=g;c[e+4>>2]=c[h>>2];c[e+8>>2]=d;c[h>>2]=e;sb[c[g+28>>2]&7](e+16|0,(a[f>>0]&4)<<6);h=0;l=i;return h|0}return 0}function ih(b){b=b|0;var d=0,e=0,f=0;e=(c[b>>2]|0)+12|0;a[e>>0]=a[e>>0]&-3;c[b+4>>2]=0;e=c[b>>2]|0;d=c[e+16>>2]|0;if(!d)d=e;else{do{e=d+16|0;f=c[d>>2]|0;Yq(e|0,0,c[f+44>>2]|0)|0;sb[c[f+28>>2]&7](e,(a[(c[b>>2]|0)+12>>0]&4)<<6);d=c[d+4>>2]|0}while((d|0)!=0);d=c[b>>2]|0}e=c[d+20>>2]|0;if(!e)return;jh(b,e,c[d+24>>2]|0);return}function jh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=c[(c[a>>2]|0)+8>>2]|0;g=a+4|0;if(e|0){f=c[g>>2]|0;if(f|0?(iq(a+12|0,f,1,e)|0)!=1:0)He(36953,630,36958);if(d|0?(iq(b,d,1,c[(c[a>>2]|0)+8>>2]|0)|0)!=1:0)He(36953,632,36958)}e=c[(c[a>>2]|0)+16>>2]|0;if(!e){c[g>>2]=0;return}a=a+12|0;do{f=c[g>>2]|0;if(!f)f=e+16|0;else{h=e+16|0;ub[c[(c[e>>2]|0)+32>>2]&7](h,a,f);f=h}ub[c[(c[e>>2]|0)+32>>2]&7](f,b,d);e=c[e+4>>2]|0}while((e|0)!=0);c[g>>2]=0;return}function kh(a){a=a|0;gh(a);return}function lh(a,b,c){a=a|0;b=b|0;c=c|0;jh(a,b,c);return}function mh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+32|0;if((l|0)>=(m|0))$(32);r=v+16|0;n=v+8|0;k=v;o=v+20|0;g=c[b>>2]|0;if(a[g+12>>0]&2){l=v;return}j=b+4|0;i=c[j>>2]|0;if(i){h=c[g+8>>2]|0;do if(h)if((iq(b+12|0,i,1,h)|0)==1){f=c[b>>2]|0;break}else He(36953,630,36958);else f=g;while(0);g=c[f+16>>2]|0;if(g){h=b+12|0;do{f=c[j>>2]|0;if(!f)f=g+16|0;else{i=g+16|0;ub[c[(c[g>>2]|0)+32>>2]&7](i,h,f);f=i}ub[c[(c[g>>2]|0)+32>>2]&7](f,0,0);g=c[g+4>>2]|0}while((g|0)!=0);f=c[b>>2]|0}c[j>>2]=0;g=f}f=c[g+16>>2]|0;if(!f)f=g;else{do{rb[c[(c[f>>2]|0)+36>>2]&7](f+16|0);f=c[f+4>>2]|0}while((f|0)!=0);f=c[b>>2]|0}f=f+12|0;a[f>>0]=a[f>>0]|2;f=c[b>>2]|0;if(!(c[f+20>>2]|0)){l=v;return}f=c[f+16>>2]|0;if(!f)He(36953,816,37090);if(!(c[f+4>>2]|0))g=f;else{kg(36953,980,36967,0,36979);Le(37e3,k);g=c[(c[b>>2]|0)+16>>2]|0}h=c[c[f>>2]>>2]|0;f=(g|0)==0;do if(h){if(f)He(36953,816,37090);else e=g;while(1){f=c[e>>2]|0;if((c[f>>2]|0)==(h|0)){p=29;break}e=c[e+4>>2]|0;if(!e){p=31;break}}if((p|0)==29){s=tb[c[f+40>>2]&15](e+16|0)|0;q=0;u=h;break}else if((p|0)==31)He(36953,816,37090)}else{if(f)He(36953,816,37090);if(c[g+4>>2]|0)Oe(37051,n);s=tb[c[(c[g>>2]|0)+40>>2]&15](g+16|0)|0;q=1;u=0}while(0);if((c[1905]|0)!=(u|0))if((c[1939]|0)!=(u|0))if((c[1924]|0)!=(u|0))if((c[1955]|0)!=(u|0))if((c[1971]|0)!=(u|0))if((c[1864]|0)==(u|0)){e=7456;p=38}else h=0;else{e=7884;p=38}else{e=7820;p=38}else{e=7696;p=38}else{e=7756;p=38}else{e=7620;p=38}if((p|0)==38)h=c[e+24>>2]|0;e=a[(c[b>>2]|0)+12>>0]|0;e=fh(o,u,(e&4)<<6|e&1)|0;if(e|0)Be(e,0);g=c[o>>2]|0;f=c[b>>2]|0;e=c[f+24>>2]|0;jh(g,(c[f+20>>2]|0)+e|0,e);jh(g,s,h);mh(g);e=c[(c[g>>2]|0)+16>>2]|0;f=(e|0)==0;do if(!q){if(f)He(36953,816,37090);else d=e;while(1){e=c[d>>2]|0;if((c[e>>2]|0)==(u|0)){p=48;break}d=c[d+4>>2]|0;if(!d){p=50;break}}if((p|0)==48){t=tb[c[e+40>>2]&15](d+16|0)|0;break}else if((p|0)==50)He(36953,816,37090)}else{if(f)He(36953,816,37090);if(c[e+4>>2]|0)Oe(37051,r);t=tb[c[(c[e>>2]|0)+40>>2]&15](e+16|0)|0}while(0);cr(s|0,t|0,h|0)|0;gh(g);l=v;return}function nh(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=c[b>>2]|0;if(!(c[g+20>>2]|0)){b=70;l=o;return b|0}g=c[g+16>>2]|0;if(!g){b=5;l=o;return b|0}if(c[g+4>>2]|0){kg(36953,980,36967,0,36979);Le(37e3,o)}h=c[c[g>>2]>>2]|0;if(!h){b=5;l=o;return b|0}i=c[b>>2]|0;g=c[i+24>>2]|0;do if(g>>>0>>0){if((c[1905]|0)!=(h|0))if((c[1939]|0)!=(h|0))if((c[1924]|0)!=(h|0))if((c[1955]|0)!=(h|0))if((c[1971]|0)!=(h|0))if((c[1864]|0)==(h|0)){g=7456;n=13}else g=0;else{g=7884;n=13}else{g=7820;n=13}else{g=7696;n=13}else{g=7756;n=13}else{g=7620;n=13}if((n|0)==13)g=c[g+24>>2]|0;j=$e(g)|0;if(!j){g=Qn(c[(zo()|0)>>2]|0)|0;if(!g)break;l=o;return g|0}oh(h,j,e,f);if((c[1905]|0)!=(h|0))if((c[1939]|0)!=(h|0))if((c[1924]|0)!=(h|0))if((c[1955]|0)!=(h|0))if((c[1971]|0)!=(h|0))if((c[1864]|0)==(h|0))g=7456;else{g=c[b>>2]|0;e=j;k=j;j=0;i=g;g=c[g+24>>2]|0;n=24;break}else g=7884;else g=7820;else g=7696;else g=7756;else g=7620;h=c[g+24>>2]|0;i=c[b>>2]|0;g=c[i+24>>2]|0;if(h>>>0>g>>>0)Ie(37098,36953,716,37131);else{e=j;k=j;j=h;n=24}}else{k=0;j=f;n=24}while(0);if((n|0)==24){Yq(c[i+20>>2]|0,0,g<<1|0)|0;i=c[b>>2]|0;h=c[i+20>>2]|0;i=h+(c[i+24>>2]|0)|0;cr(h|0,e|0,j|0)|0;cr(i|0,e|0,j|0)|0;if((c[(c[b>>2]|0)+24>>2]|0)>0){g=0;do{n=h+g|0;a[n>>0]=(d[n>>0]|0)^54;n=i+g|0;a[n>>0]=(d[n>>0]|0)^92;g=g+1|0}while((g|0)<(c[(c[b>>2]|0)+24>>2]|0))}cf(k)}h=(c[b>>2]|0)+12|0;a[h>>0]=a[h>>0]&-3;c[b+4>>2]=0;h=c[b>>2]|0;g=c[h+16>>2]|0;if(!g)g=h;else{do{n=g+16|0;k=c[g>>2]|0;Yq(n|0,0,c[k+44>>2]|0)|0;sb[c[k+28>>2]&7](n,(a[(c[b>>2]|0)+12>>0]&4)<<6);g=c[g+4>>2]|0}while((g|0)!=0);g=c[b>>2]|0}h=c[g+20>>2]|0;if(!h){b=0;l=o;return b|0}jh(b,h,c[g+24>>2]|0);b=0;l=o;return b|0}function oh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+16|0;if((l|0)>=(m|0))$(16);j=o+8|0;i=o;h=o+12|0;a:do switch(a|0){case 2:{Vi(b,d,e);l=o;return}case 3:{if(gg()|0)break a;ui(b,d,e);l=o;return}default:if(((a|0)==1?(gg()|0)!=0:0)?(jg(36944),(hg()|0)!=0):0)fg()}while(0);g=fh(h,a,0)|0;if(g|0){g=Pn(g&65535|536870912)|0;c[i>>2]=a;c[i+4>>2]=g;Ne(37147,i)}i=c[h>>2]|0;jh(i,d,e);mh(i);g=c[(c[i>>2]|0)+16>>2]|0;h=(g|0)==0;do if(a){if(h)He(36953,816,37090);else f=g;while(1){g=c[f>>2]|0;if((c[g>>2]|0)==(a|0)){k=19;break}f=c[f+4>>2]|0;if(!f){k=21;break}}if((k|0)==19){n=tb[c[g+40>>2]&15](f+16|0)|0;break}else if((k|0)==21)He(36953,816,37090)}else{if(h)He(36953,816,37090);if(c[g+4>>2]|0)Oe(37051,j);n=tb[c[(c[g>>2]|0)+40>>2]&15](g+16|0)|0}while(0);if((c[1905]|0)!=(a|0))if((c[1939]|0)!=(a|0))if((c[1924]|0)!=(a|0))if((c[1955]|0)!=(a|0))if((c[1971]|0)!=(a|0))if((c[1864]|0)==(a|0)){f=7456;k=28}else f=0;else{f=7884;k=28}else{f=7820;k=28}else{f=7696;k=28}else{f=7756;k=28}else{f=7620;k=28}if((k|0)==28)f=c[f+24>>2]|0;cr(b|0,n|0,f|0)|0;gh(i);l=o;return}function ph(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=h;mh(a);a=c[(c[a>>2]|0)+16>>2]|0;d=(a|0)==0;if(!b){if(d)He(36953,816,37090);if(c[a+4>>2]|0)Oe(37051,e);g=tb[c[(c[a>>2]|0)+40>>2]&15](a+16|0)|0;l=h;return g|0}if(d)He(36953,816,37090);else f=a;while(1){a=c[f>>2]|0;if((c[a>>2]|0)==(b|0))break;d=c[f+4>>2]|0;if(!d){g=10;break}else f=d}if((g|0)==10)He(36953,816,37090);g=tb[c[a+40>>2]&15](f+16|0)|0;l=h;return g|0}function qh(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+16|0;if((l|0)>=(m|0))$(16);i=o;g=o+4|0;if(!((b&-3|0)==0&((e|0)!=0&(f|0)>-1))){d=45;l=o;return d|0}b=b&2;h=(b|0)!=0;if(h&(f|0)<1){d=45;l=o;return d|0}if(!((a|0)!=2|h)){Wi(d,e,f);d=0;l=o;return d|0}if(((a|0)==1?gg()|0:0)?(jg(36944),hg()|0):0)fg();b=fh(g,a,b)|0;a:do if(!b){g=c[g>>2]|0;do if(h){b=nh(g,(c[e+12>>2]|0)+(c[e+4>>2]|0)|0,c[e+8>>2]|0)|0;if(!b){f=f+-1|0;b=e+16|0;break}else{gh(g);break a}}else b=e;while(0);if(f|0)while(1){jh(g,(c[b+12>>2]|0)+(c[b+4>>2]|0)|0,c[b+8>>2]|0);f=f+-1|0;if(!f)break;else b=b+16|0}mh(g);b=c[(c[g>>2]|0)+16>>2]|0;f=(b|0)==0;do if(a){if(f)He(36953,816,37090);else j=b;while(1){b=c[j>>2]|0;if((c[b>>2]|0)==(a|0)){k=23;break}b=c[j+4>>2]|0;if(!b){k=25;break}else j=b}if((k|0)==23){n=tb[c[b+40>>2]&15](j+16|0)|0;break}else if((k|0)==25)He(36953,816,37090)}else{if(f)He(36953,816,37090);if(c[b+4>>2]|0)Oe(37051,i);n=tb[c[(c[b>>2]|0)+40>>2]&15](b+16|0)|0}while(0);if((c[1905]|0)!=(a|0))if((c[1939]|0)!=(a|0))if((c[1924]|0)!=(a|0))if((c[1955]|0)!=(a|0))if((c[1971]|0)!=(a|0))if((c[1864]|0)==(a|0)){b=7456;k=32}else b=0;else{b=7884;k=32}else{b=7820;k=32}else{b=7696;k=32}else{b=7756;k=32}else{b=7620;k=32}if((k|0)==32)b=c[b+24>>2]|0;cr(d|0,n|0,b|0)|0;gh(g);d=0;l=o;return d|0}while(0);d=b;l=o;return d|0}function rh(a){a=a|0;var b=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);a=c[(c[a>>2]|0)+16>>2]|0;if(!a){a=0;l=b;return a|0}if(c[a+4>>2]|0){kg(36953,980,36967,0,36979);Le(37e3,b)}a=c[c[a>>2]>>2]|0;l=b;return a|0}function sh(a){a=a|0;if((c[1905]|0)!=(a|0))if((c[1939]|0)!=(a|0))if((c[1924]|0)!=(a|0))if((c[1955]|0)!=(a|0))if((c[1971]|0)!=(a|0))if((c[1864]|0)==(a|0))a=7456;else{a=0;return a|0}else a=7884;else a=7820;else a=7696;else a=7756;else a=7620;a=c[a+24>>2]|0;return a|0}function th(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;k=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=k;switch(d|0){case 8:{if((e|0)!=0|(f|0)!=0){f=45;l=k;return f|0}if((c[1905]|0)!=(b|0))if((c[1939]|0)!=(b|0))if((c[1924]|0)!=(b|0))if((c[1955]|0)!=(b|0))if((c[1971]|0)!=(b|0)){if((c[1864]|0)==(b|0)){g=7456;j=9}}else{g=7884;j=9}else{g=7820;j=9}else{g=7696;j=9}else{g=7756;j=9}else{g=7620;j=9}if((j|0)==9?(a[g+4>>0]&1)==0:0){f=0;l=k;return f|0}f=5;l=k;return f|0}case 10:{d=(c[1905]|0)==(b|0);if(!d)if((c[1939]|0)!=(b|0))if((c[1924]|0)!=(b|0))if((c[1955]|0)!=(b|0))if((c[1971]|0)!=(b|0))if((c[1864]|0)==(b|0))g=7456;else{f=5;l=k;return f|0}else g=7884;else g=7820;else g=7696;else g=7756;else g=7620;if(a[g+4>>0]&1){f=5;l=k;return f|0}if(!d)if((c[1939]|0)!=(b|0))if((c[1924]|0)!=(b|0))if((c[1955]|0)!=(b|0))if((c[1971]|0)!=(b|0))if((c[1864]|0)==(b|0))i=7456;else{c[h>>2]=b;Ne(37183,h)}else i=7884;else i=7820;else i=7696;else i=7756;else i=7620;h=c[i+16>>2]|0;g=c[i+12>>2]|0;d=(e|0)!=0;if(d){if((c[f>>2]|0)>>>0>=h>>>0){cr(e|0,g|0,h|0)|0;c[f>>2]=h;f=0;l=k;return f|0}}else if(f|0){c[f>>2]=h;f=0;l=k;return f|0}f=d?66:45;l=k;return f|0}case 57:{if(!f)h=0;else h=c[f>>2]|0;if((c[1905]|0)!=(b|0))if((c[1939]|0)!=(b|0))if((c[1924]|0)!=(b|0))if((c[1955]|0)!=(b|0))if((c[1971]|0)!=(b|0))if((c[1864]|0)==(b|0)){d=7456;j=39}else g=69;else{d=7884;j=39}else{d=7820;j=39}else{d=7696;j=39}else{d=7756;j=39}else{d=7620;j=39}do if((j|0)==39){g=c[d+48>>2]|0;if(a[d+4>>0]&1){g=g|0?5:69;break}if(!g)g=69;else g=pb[g&63](b,h,0)|0}while(0);f=g&65535;l=k;return f|0}default:{f=61;l=k;return f|0}}return 0}function uh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;if((c[1905]|0)!=(b|0))if((c[1939]|0)!=(b|0))if((c[1924]|0)!=(b|0))if((c[1955]|0)!=(b|0))if((c[1971]|0)!=(b|0))if((c[1864]|0)==(b|0)){f=7456;i=7}else{d=0;g=0;f=69;i=11}else{f=7884;i=7}else{f=7820;i=7}else{f=7696;i=7}else{f=7756;i=7}else{f=7620;i=7}do if((i|0)==7){h=c[f+48>>2]|0;if(a[f+4>>0]&1){d=f;g=1;f=h|0?5:69;i=11;break}if(!h){d=f;g=1;f=69;i=11}else f=pb[h&63](b,d,e)|0}while(0);if((i|0)==11)if(e){if(g?(a[d+4>>0]&1)==0:0)d=37736;else d=g?37697:37716;zb[e&1](42873,b,37758,d)}return ((f|0)==0?0:f&65535|16777216)|0}function vh(){return 0}function wh(){return 0}function xh(a,b){a=a|0;b=b|0;c[17614]=a;c[17615]=b;return}function yh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;a=zh(a,1,b,d,e)|0;b=c[17614]|0;if(!b)return a|0;qb[b&15](c[17615]|0,37212,10,0,0);return a|0}function zh(a,b,d,f,g){a=a|0;b=b|0;d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=l;l=l+16|0;if((l|0)>=(m|0))$(16);C=E+8|0;h=E;B=E+12|0;if(a>>>0<16){c[h>>2]=16;Me(37221,h)}y=gf(2672)|0;z=kl(2)|0;A=kl(3)|0;r=(b|0)!=0;if(r)s=Il(a)|0;else s=Hl(a)|0;t=Bl(s)|0;u=Bl(s)|0;v=Bl(s)|0;c[B>>2]=0;w=a+-1|0;x=a+-2|0;p=w-b|0;q=(f|0)==0;a:while(1){Kl(s,a,d);ok(s,w);if(r)nk(s,x);nk(s,0);h=0;do{c[y+(h<<2)>>2]=Ak(0,s,e[16424+(h<<1)>>1]|0)|0;h=h+1|0}while((h|0)!=668);b:do if(q){h=0;o=0;while(1){n=0;j=3;while(1){k=y+(n<<2)|0;i=c[k>>2]|0;b=i+o|0;if(b>>>0>=j>>>0){do{i=i-j|0;b=i+o|0}while(b>>>0>=j>>>0);c[k>>2]=i}i=n+1|0;if(!b)break;if((i|0)==668){D=15;break}else{n=i;j=e[16424+(i<<1)>>1]|0}}if((D|0)==15){D=0;ek(v,s,o);c[B>>2]=(c[B>>2]|0)+1;gk(u,v,1);Mk(t,z,u,v);if((vk(t,1)|0)==0?Ah(v,5,B)|0:0)break;h=h+1|0;if((h|0)==10){h=c[17614]|0;if(!h)h=0;else{qb[h&15](c[17615]|0,37212,46,0,0);h=0}}}o=o+2|0;if(o>>>0>=2e4)break b}if(!(mk(v,p)|0))D=34;else{D=46;break a}}else{h=0;o=0;do{n=0;k=3;while(1){j=y+(n<<2)|0;i=c[j>>2]|0;b=i+o|0;if(b>>>0>=k>>>0){do{i=i-k|0;b=i+o|0}while(b>>>0>=k>>>0);c[j>>2]=i}i=n+1|0;if(!b)break;if((i|0)==668){D=31;break}else{n=i;k=e[16424+(i<<1)>>1]|0}}if((D|0)==31){D=0;ek(v,s,o);c[B>>2]=(c[B>>2]|0)+1;gk(u,v,1);Mk(t,z,u,v);if((vk(t,1)|0)==0?Ah(v,5,B)|0:0){if(!(mk(v,p)|0)){D=34;break b}if(!(yb[f&7](g,v)|0)){D=46;break a}b=c[17614]|0;if(b|0)qb[b&15](c[17615]|0,37212,47,0,0)}h=h+1|0;if((h|0)==10){h=c[17614]|0;if(!h)h=0;else{qb[h&15](c[17615]|0,37212,46,0,0);h=0}}}o=o+2|0}while(o>>>0<2e4)}while(0);if((D|0)==34){D=0;h=c[17614]|0;if(h|0)qb[h&15](c[17615]|0,37212,10,0,0);Oe(37268,C)}h=c[17614]|0;if(!h)continue;qb[h&15](c[17615]|0,37212,58,0,0)}if((D|0)==46){tl(z);tl(A);tl(t);tl(u);tl(s);cf(y);l=E;return v|0}return 0}function Ah(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;l=a+4|0;o=ll(c[l>>2]|0)|0;p=ll(c[l>>2]|0)|0;q=ll(c[l>>2]|0)|0;l=ll(c[l>>2]|0)|0;m=kl(2)|0;n=lk(a)|0;f=(b|0)<5?5:b;gk(l,a,1);g=yl(l)|0;h=Nk(g)|0;Ck(g,g,h);a:do if(f){i=n+-2|0;if(h>>>0<=1){b=0;while(1){c[d>>2]=(c[d>>2]|0)+1;if(b){Kl(o,n,0);e=(mk(o,i)|0)==0;ok(o,i);if(e)qk(o,i);if((wk(o,l)|0)>=0){b=24;break}if((vk(o,1)|0)<=0){b=24;break}}else El(o,2)|0;Mk(p,o,g,a);if((vk(p,1)|0?wk(p,l)|0:0)?wk(p,l)|0:0){j=0;break a}e=c[17614]|0;if(e|0)qb[e&15](c[17615]|0,37212,43,0,0);b=b+1|0;if(b>>>0>=f>>>0){j=1;break a}}if((b|0)==24)Ie(37298,37370,951,37381)}else k=0;while(1){c[d>>2]=(c[d>>2]|0)+1;if(k){Kl(o,n,0);e=(mk(o,i)|0)==0;ok(o,i);if(e)qk(o,i);if((wk(o,l)|0)>=0){b=24;break}if((vk(o,1)|0)<=0){b=24;break}}else El(o,2)|0;Mk(p,o,g,a);if(vk(p,1)|0?wk(p,l)|0:0){b=1;do{if(!(wk(p,l)|0))break;Mk(p,p,m,a);b=b+1|0;if(!(vk(p,1)|0)){j=0;break a}}while(b>>>0>>0);if(wk(p,l)|0){j=0;break a}}b=c[17614]|0;if(b|0)qb[b&15](c[17615]|0,37212,43,0,0);k=k+1|0;if(k>>>0>=f>>>0){j=1;break a}}if((b|0)==24)Ie(37298,37370,951,37381)}else j=1;while(0);tl(o);tl(p);tl(q);tl(l);tl(g);tl(m);return j|0}function Bh(a,b,d,f,g){a=a|0;b=b|0;d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+16|0;if((l|0)>=(m|0))$(16);k=o;c[k>>2]=0;h=0;i=3;while(1){j=h+1|0;if(Dk(a,i)|0){n=4;break}if((j|0)==668)break;else{h=j;i=e[16424+(j<<1)>>1]|0}}if((n|0)==4){n=(vk(a,i)|0)==0&1;l=o;return n|0}i=Bl(a)|0;j=Bl(a)|0;gk(j,a,1);Mk(i,b,j,a);tl(j);j=(vk(i,1)|0)==0;tl(i);if(!j){h=c[17614]|0;if(!h){n=0;l=o;return n|0}qb[h&15](c[17615]|0,37212,46,0,0);n=0;l=o;return n|0}h=(f|0)!=0;if(!(h?!(pb[f&63](g,2,a)|0):0))n=10;if((n|0)==10?Ah(a,d,k)|0:0){if(!h){n=1;l=o;return n|0}if(pb[f&63](g,1,a)|0){n=1;l=o;return n|0}}h=c[17614]|0;if(!h){n=0;l=o;return n|0}qb[h&15](c[17615]|0,37212,46,0,0);n=0;l=o;return n|0}function Ch(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0;if((e|0)==0|(a|0)!=0&(b|0)!=0&(d|0)!=0^1){g=0;return g|0}if(!(mk(e,0)|0)){g=0;return g|0}k=Dh(b)|0;i=Dh(d)|0;h=Bl(a)|0;Kk(h,k,i);b=Bl(k)|0;Fk(b,i,k)|0;Kk(b,b,i);j=Bl(i)|0;Fk(j,k,i)|0;Kk(j,j,k);hk(b,b,j);if(c[b+8>>2]|0)fk(b,b,h);jk(j,b,a,h);fk(j,j,a);tl(b);if((wk(j,a)|0)<0)fk(j,j,h);b=kl(2)|0;d=Bl(j)|0;gk(h,h,1);gk(j,j,1);while(1){a=Ek(d,e,j)|0;ek(j,j,1);if(!a){a=c[17614]|0;if(a|0)qb[a&15](c[17615]|0,37212,47,0,0)}else if(Bh(j,b,64,0,0)|0)break;fk(j,j,h)}tl(d);tl(b);tl(h);b=c[17614]|0;if(b|0)qb[b&15](c[17615]|0,37212,10,0,0);if(!f)tl(k);else c[f>>2]=k;if(!g){tl(i);g=j;return g|0}else{c[g>>2]=i;g=j;return g|0}return 0}function Dh(a){a=a|0;var b=0;b=kl(2)|0;a=yl(a)|0;nk(a,0);if(Bh(a,b,64,0,0)|0){tl(b);return a|0}do ek(a,a,2);while(!(Bh(a,b,64,0,0)|0));tl(b);return a|0}function Eh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+16|0;if((l|0)>=(m|0))$(16);n=o;if((a|0)!=0?(e=vf(a)|0,(e|0)>1):0){k=0;g=0;f=5;j=e;e=0;while(1){j=j+-1|0;i=xf(a,j,n)|0;a:do if(!i)h=k;else do switch(c[n>>2]|0){case 3:{h=(f|0)==5;if(h&(Tp(i,37390,3)|0)==0){h=k;g=g|4;f=4;break a}if(h&(Tp(i,37394,3)|0)==0){h=k;g=g|16;f=0;break a}else{h=k;e=(k|0)==0?72:e;break a}}case 4:{if(!(Tp(i,37398,4)|0)){h=k;g=g|1024;break a}if((f|0)==5&(Tp(i,37403,4)|0)==0){h=k;g=g|4;f=3;break a}if(!(Tp(i,49620,4)|0)){h=k;g=g|8192;f=0;break a}else{h=k;e=(k|0)==0?72:e;break a}}case 5:{if(!(Tp(i,49614,5)|0)){h=k;g=g|4096;f=0;break a}if((f|0)==5&(Tp(i,37408,5)|0)==0){h=k;g=g|4;f=1;break a}if(!(Tp(i,37414,5)|0)){h=k;g=g|512;break a}else{h=k;e=(k|0)==0?72:e;break a}}case 6:if(!(Tp(i,37420,6)|0)){h=k;g=g|2048;break a}else{h=k;e=(k|0)==0?72:e;break a}case 7:if(!(Tp(i,37427,7)|0)){h=k;g=g|2;break a}else{i=(k|0)!=0|(Tp(i,37435,7)|0)==0;h=k;e=i?e:72;break a}case 8:if(!(Tp(i,41515,8)|0)){h=k;g=g|64;break a}else{h=k;e=(k|0)==0?72:e;break a}case 9:if((f|0)==5&(Tp(i,37443,9)|0)==0){h=k;g=g|4;f=2;break a}else{h=k;e=(k|0)==0?72:e;break a}case 10:{if(!(Tp(i,37453,10)|0)){h=1;break a}if(!(Tp(i,37464,10)|0)){h=k;g=g|16384;break a}else{h=k;e=(k|0)==0?72:e;break a}}case 11:{if(!(Tp(i,37475,11)|0)){h=k;g=g|1;break a}if(!(Tp(i,37487,11)|0)){h=k;g=g|128;break a}else{h=k;e=(k|0)==0?72:e;break a}}case 13:{if(!(Tp(i,37499,13)|0)){h=k;g=g|256;break a}if(!(Tp(i,48632,13)|0)){h=k;g=g|32;break a}else{h=k;e=(k|0)==0?72:e;break a}}default:{h=k;e=(k|0)==0?72:e;break a}}while(0);while(0);if((j|0)<=1)break;else k=h}}else{g=0;f=5;e=0}if(b|0)c[b>>2]=g;if(!d){l=o;return e|0}c[d>>2]=f;l=o;return e|0}function Fh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=i+4|0;e=i;c[d>>2]=0;f=uf(b,37513,0)|0;if(!f){h=0;l=i;return h|0}g=xf(f,1,e)|0;b=c[e>>2]|0;if((g|0)==0|b>>>0>48){sf(f);h=65;l=i;return h|0}else{cr(h|0,g|0,b|0)|0;a[h+b>>0]=0;c[d>>2]=Mo(h,0,0)|0;sf(f);h=0;l=i;return h|0}return 0}function Gh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;i=l;l=l+64|0;if((l|0)>=(m|0))$(64);h=i+4|0;e=i;c[d>>2]=0;f=uf(b,37519,0)|0;if(!f){c[d>>2]=65537;h=0;l=i;return h|0}g=xf(f,1,e)|0;b=c[e>>2]|0;if((g|0)==0|b>>>0>48){sf(f);h=65;l=i;return h|0}else{cr(h|0,g|0,b|0)|0;a[h+b>>0]=0;c[d>>2]=Mo(h,0,0)|0;sf(f);h=0;l=i;return h|0}return 0}function Hh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;c[d>>2]=0;i=(e|0)!=0;if(i)c[e>>2]=0;j=uf(a,37529,0)|0;a:do if(j){a=wf(j,1)|0;if(a){f=zf(a,0)|0;if(f){if(!(Go(f,46885)|0)){sf(a);a=wf(j,2)|0;if(!a){g=65;a=0;break}cf(f);f=zf(a,0)|0;if(!f){g=65;f=0;break}}g=c[b>>2]|0;if(!g)g=70;else{h=0;while(1){h=h+1|0;if(!(Op(f,g)|0))break;g=c[b+(h<<2)>>2]|0;if(!g){g=70;break a}}if(i){if(!(Go(f,49614)|0))c[e>>2]=4096;if(!(Go(f,49620)|0))c[e>>2]=8192}c[d>>2]=a;g=0;a=0}}else{g=65;f=0}}else{g=68;f=0;a=0}}else{g=65;f=0;a=0}while(0);cf(f);sf(a);sf(j);return g|0}function Ih(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+16|0;if((l|0)>=(m|0))$(16);n=q+4|0;o=q;c[o>>2]=0;c[e>>2]=0;p=uf(b,40685,0)|0;a:do if(p){g=wf(p,1)|0;if(g){k=zf(g,0)|0;if(k){if(!(Go(k,46885)|0)){h=f+8|0;b=Eh(g,o,h)|0;if(b|0){h=k;break}b:do switch(c[h>>2]|0){case 4:{h=k;b=70;break a}case 3:{sf(g);g=uf(p,37537,0)|0;if(g|0){i=xf(g,1,n)|0;if(!i){h=k;b=68;break a}j=c[n>>2]|0;b=0;while(1){h=c[4248+(b<<3)>>2]|0;if((Fo(h)|0)==(j|0)?(Tp(h,i,j)|0)==0:0){h=13;break}b=b+1|0;if((b|0)==12){h=14;break}}do if((h|0)==13)b=c[4248+(b<<3)+4>>2]|0;else if((h|0)==14){b=_e(j+1|0)|0;if(!b){c[f+16>>2]=0;h=k;b=5;break a}else{cr(b|0,i|0,j|0)|0;a[b+j>>0]=0;j=ch(b)|0;cf(b);b=j;break}}while(0);c[f+16>>2]=b;if(!b){h=k;b=5;break a}}sf(g);g=uf(p,37547,0)|0;if(g){h=xf(g,1,n)|0;if(!h){h=k;b=68;break a}b=c[n>>2]|0;if(b){b=_e(b)|0;c[f+20>>2]=b;if(!b){b=Sn()|0;if(!b)break b;else{h=k;break a}}else{j=c[n>>2]|0;cr(b|0,h|0,j|0)|0;c[f+24>>2]=j;break b}}}else g=0;break}default:{}}while(0);sf(g);g=wf(p,2)|0;if(!g){h=k;g=0;b=68;break}else h=2;c:while(1){b=xf(g,0,n)|0;switch(c[n>>2]|0){case 9:{if(Tp(b,37537,9)|0)break c;break}case 5:{if(Tp(b,37547,5)|0)break c;break}case 15:{if(Tp(b,37553,15)|0)break c;break}default:break c}h=h+1|0;sf(g);g=wf(p,h)|0;if(!g){h=k;g=0;b=68;break a}}cf(k);b=zf(g,0)|0;if(!b){h=0;b=65;break}}else{c[o>>2]=8;b=k}h=c[d>>2]|0;if(!h){h=b;b=70}else{i=0;while(1){i=i+1|0;if(!(Op(b,h)|0))break;h=c[d+(i<<2)>>2]|0;if(!h){h=b;b=70;break a}}c[e>>2]=g;h=f+12|0;c[h>>2]=c[h>>2]|c[o>>2];h=b;g=0;b=0}}else{h=0;b=65}}else{h=0;g=0;b=68}}else{h=0;g=0;b=65}while(0);cf(h);sf(g);sf(p);l=q;return b|0}function Jh(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=b;c[a+4>>2]=d;c[a+8>>2]=5;c[a+12>>2]=0;c[a+16>>2]=2;c[a+20>>2]=0;c[a+24>>2]=0;c[a+28>>2]=20;c[a+32>>2]=0;c[a+36>>2]=0;return}function Kh(a){a=a|0;cf(c[a+20>>2]|0);return}function Lh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=l;l=l+16|0;if((l|0)>=(m|0))$(16);r=w+8|0;u=w+4|0;s=w;c[u>>2]=0;c[d>>2]=0;v=uf(b,37643,0)|0;if(!v){v=Af(b,0,0)|0;c[d>>2]=v;v=v|0?0:65;l=w;return v|0}b=uf(v,46885,0)|0;g=e+8|0;if(!b)b=0;else{t=(Eh(b,u,g)|0)!=0&1;sf(b);b=t}if((c[g>>2]|0)==5)c[g>>2]=0;t=uf(v,37648,0)|0;i=(t|0)!=0;if(!i){f=uf(v,40697,0)|0;if(!f){b=65;f=0}else{h=1;q=9}}else{f=0;h=0;q=9}a:do if((q|0)==9)if(!b){g=c[g>>2]|0;b=(g|0)==0;if(b){if(c[u>>2]&4096|0){b:do if(h?(p=uf(v,37537,0)|0,(p|0)!=0):0){i=xf(p,1,r)|0;c:do if(i){h=c[r>>2]|0;b=0;while(1){g=c[4248+(b<<3)>>2]|0;if((Fo(g)|0)==(h|0)?(Tp(g,i,h)|0)==0:0){q=19;break}b=b+1|0;if((b|0)==12){q=20;break}}do if((q|0)==19)b=c[4248+(b<<3)+4>>2]|0;else if((q|0)==20){b=_e(h+1|0)|0;if(!b){c[e+16>>2]=0;b=5;break c}else{cr(b|0,i|0,h|0)|0;a[b+h>>0]=0;r=ch(b)|0;cf(b);b=r;break}}while(0);c[e+16>>2]=b;if(!b)b=5;else{sf(p);b=yf(f,1,s)|0;if(!b){c[s>>2]=0;b=_e(1)|0;if(!b){b=Sn()|0;if(!b)b=0;else break b}}else{r=c[s>>2]|0;if(r<<3>>>0>>0){cf(b);b=67;break b}}c[d>>2]=ul(0,b,c[s>>2]<<3)|0;b=0;break b}}else b=68;while(0);sf(p)}else b=65;while(0);break}if(i&b?c[u>>2]&18|0:0){if((vf(t)|0)!=3){b=65;break}i=xf(t,1,r)|0;h=c[r>>2]|0;if(!((i|0)!=0&(h|0)!=0)){b=65;break}b=0;while(1){g=c[4248+(b<<3)>>2]|0;if((Fo(g)|0)==(h|0)?(Tp(g,i,h)|0)==0:0){q=40;break}b=b+1|0;if((b|0)==12){q=41;break}}do if((q|0)==40){b=c[4248+(b<<3)+4>>2]|0;q=44}else if((q|0)==41){b=_e(h+1|0)|0;if(!b){c[e+16>>2]=0;b=5;break}else{cr(b|0,i|0,h|0)|0;a[b+h>>0]=0;q=ch(b)|0;cf(b);b=q;q=44;break}}while(0);do if((q|0)==44){c[e+16>>2]=b;if(b){g=yf(t,2,s)|0;if(g){s=c[s>>2]|0;b=s<<3;if(b>>>0>>0){cf(g);b=67;break}else{c[d>>2]=ul(0,g,b)|0;b=0;break}}else b=65}else b=5}while(0);break}if(h&b){if(c[u>>2]&2|0){b=70;break}b=Af(f,1,5)|0;c[d>>2]=b;b=(b|0)==0?65:0;break}else b=0}else{b=(g|0)==1;if(h&b?(c[e>>2]|0)==0:0){i=xf(f,1,s)|0;d:do if((i|0)!=0&(c[s>>2]|0)!=0){h=uf(v,37553,0)|0;e:do if(!h){g=0;b=0}else{g=xf(h,1,r)|0;if(!g){sf(h);b=68;break d}b=c[r>>2]|0;do if(b){b=_e(b)|0;if(!b){b=Sn()|0;sf(h);if(!b){g=0;b=0;break e}else break d}else{r=c[r>>2]|0;cr(b|0,g|0,r|0)|0;g=r;break}}else{g=0;b=0}while(0);sf(h)}while(0);d=vi(d,c[e+4>>2]|0,i,c[s>>2]|0,b,g)|0;cf(b);b=d}else b=65;while(0);break}}if(i&b?(c[e>>2]&-2|0)==2:0){if((vf(t)|0)!=3){b=65;break}i=xf(t,1,r)|0;h=c[r>>2]|0;if(!((i|0)!=0&(h|0)!=0)){b=65;break}b=0;while(1){g=c[4248+(b<<3)>>2]|0;if((Fo(g)|0)==(h|0)?(Tp(g,i,h)|0)==0:0){q=74;break}b=b+1|0;if((b|0)==12){q=75;break}}do if((q|0)==74){b=c[4248+(b<<3)+4>>2]|0;q=78}else if((q|0)==75){b=_e(h+1|0)|0;if(!b){c[e+16>>2]=0;b=5;break}else{cr(b|0,i|0,h|0)|0;a[b+h>>0]=0;q=ch(b)|0;cf(b);b=q;q=78;break}}while(0);if((q|0)==78){h=e+16|0;c[h>>2]=b;if(b){g=xf(t,2,s)|0;b=c[s>>2]|0;if((g|0)!=0&(b|0)!=0)b=xi(d,c[e+4>>2]|0,g,b,c[h>>2]|0)|0;else b=65}else b=5}break}if(h&(g|0)==2?(c[e>>2]&-2|0)==2:0){if((vf(f)|0)==2?(j=xf(f,1,s)|0,k=c[s>>2]|0,(j|0)!=0&(k|0)!=0):0)b=yi(d,c[e+4>>2]|0,j,k)|0;else b=65;break}if(h&(g|0)==3?(c[e>>2]|0)==0:0){k=xf(f,1,s)|0;f:do if((k|0)!=0&(c[s>>2]|0)!=0){j=uf(v,37537,0)|0;g:do if(j|0){h=xf(j,1,r)|0;h:do if(h){i=c[r>>2]|0;b=0;while(1){g=c[4248+(b<<3)>>2]|0;if((Fo(g)|0)==(i|0)?(Tp(g,h,i)|0)==0:0){q=97;break}b=b+1|0;if((b|0)==12){q=98;break}}do if((q|0)==97)b=c[4248+(b<<3)+4>>2]|0;else if((q|0)==98){b=_e(i+1|0)|0;if(!b){c[e+16>>2]=0;b=5;break h}else{cr(b|0,h|0,i|0)|0;a[b+i>>0]=0;q=ch(b)|0;cf(b);b=q;break}}while(0);c[e+16>>2]=b;if(!b)b=5;else{sf(j);break g}}else b=68;while(0);sf(j);break f}while(0);h=uf(v,37547,0)|0;i:do if(h|0){g=xf(h,1,r)|0;if(!g){sf(h);b=68;break f}b=c[r>>2]|0;do if(b|0){b=_e(b)|0;c[e+20>>2]=b;if(!b){b=Sn()|0;sf(h);if(!b)break i;else break f}else{q=c[r>>2]|0;cr(b|0,g|0,q|0)|0;c[e+24>>2]=q;break}}while(0);sf(h)}while(0);h=uf(v,37553,0)|0;j:do if(!h){g=0;b=0}else{g=xf(h,1,r)|0;if(!g){sf(h);b=68;break f}b=c[r>>2]|0;do if(b){b=_e(b)|0;if(!b){b=Sn()|0;sf(h);if(!b){g=0;b=0;break j}else break f}else{r=c[r>>2]|0;cr(b|0,g|0,r|0)|0;g=r;break}}else{g=0;b=0}while(0);sf(h)}while(0);d=zi(d,c[e+4>>2]|0,c[e+16>>2]|0,k,c[s>>2]|0,c[e+20>>2]|0,c[e+24>>2]|0,b,g)|0;cf(b);b=d}else b=65;while(0);break}if(i&(g|0)==4){if((c[e>>2]|0)!=2){if((c[e>>2]|0)!=3){b=70;break}if((vf(t)|0)!=3){b=65;break}i=xf(t,1,r)|0;h=c[r>>2]|0;if((i|0)!=0&(h|0)!=0)b=0;else{b=65;break}while(1){g=c[4248+(b<<3)>>2]|0;if((Fo(g)|0)==(h|0)?(Tp(g,i,h)|0)==0:0){q=155;break}b=b+1|0;if((b|0)==12){q=156;break}}do if((q|0)==155)b=c[4248+(b<<3)+4>>2]|0;else if((q|0)==156){b=_e(h+1|0)|0;if(!b){c[e+16>>2]=0;b=5;break a}else{cr(b|0,i|0,h|0)|0;a[b+h>>0]=0;s=ch(b)|0;cf(b);b=s;break}}while(0);c[e+16>>2]=b;if(!b){b=5;break}b=Af(t,2,5)|0;c[d>>2]=b;c[e+32>>2]=5;c[e+36>>2]=c[d>>2];b=(b|0)==0?65:0;break}if((vf(t)|0)==3?(n=xf(t,1,r)|0,o=c[r>>2]|0,(n|0)!=0&(o|0)!=0):0){b=0;while(1){g=c[4248+(b<<3)>>2]|0;if((Fo(g)|0)==(o|0)?(Tp(g,n,o)|0)==0:0){q=130;break}b=b+1|0;if((b|0)==12){q=131;break}}do if((q|0)==130){b=c[4248+(b<<3)+4>>2]|0;q=134}else if((q|0)==131){b=_e(o+1|0)|0;if(!b){c[e+16>>2]=0;b=5;break}else{cr(b|0,n|0,o|0)|0;a[b+o>>0]=0;q=ch(b)|0;cf(b);b=q;q=134;break}}while(0);k:do if((q|0)==134){j=e+16|0;c[j>>2]=b;if(b){i=xf(t,2,s)|0;if((i|0)!=0&(c[s>>2]|0)!=0){b=uf(v,37653,0)|0;if(b|0){g=xf(b,1,r)|0;if(!g){b=68;break}c[e+28>>2]=Mo(g,0,10)|0;sf(b)}h=uf(v,37553,0)|0;l:do if(!h){g=0;b=0}else{g=xf(h,1,r)|0;if(!g){sf(h);b=68;break k}b=c[r>>2]|0;do if(b){b=_e(b)|0;if(!b){b=Sn()|0;sf(h);if(!b){g=0;b=0;break l}else break k}else{r=c[r>>2]|0;cr(b|0,g|0,r|0)|0;g=r;break}}else{g=0;b=0}while(0);sf(h)}while(0);d=Ci(d,(c[e+4>>2]|0)+-1|0,c[j>>2]|0,i,c[s>>2]|0,c[e+28>>2]|0,b,g)|0;cf(b);b=d}else b=65}else b=5}while(0)}else b=65}else b=70}else b=72;while(0);sf(v);sf(t);sf(f);if(!b){c[e+12>>2]=c[u>>2];v=0;l=w;return v|0}else{v=e+20|0;cf(c[v>>2]|0);c[v>>2]=0;v=b;l=w;return v|0}return 0}function Mh(a,b){a=a|0;b=b|0;return Di(c[a+36>>2]|0,b,(c[a+4>>2]|0)+-1|0,c[a+16>>2]|0,c[a+28>>2]|0)|0}function Nh(a){a=a|0;var b=0,d=0;if(!(Op(a,c[3121]|0)|0)){a=12472;return a|0}d=c[3122]|0;b=c[d>>2]|0;a:do if(b|0){while(1){d=d+4|0;if(!(Op(a,b)|0)){b=12472;break}b=c[d>>2]|0;if(!b)break a}return b|0}while(0);if(!(Op(a,c[1883]|0)|0)){a=7520;return a|0}b=c[1884]|0;d=c[b>>2]|0;if(!d){a=0;return a|0}while(1){b=b+4|0;if(!(Op(a,d)|0)){b=7520;d=6;break}d=c[b>>2]|0;if(!d){b=0;d=6;break}}if((d|0)==6)return b|0;return 0}function Oh(a){a=a|0;switch(a|0){case 3:case 2:{a=1;break}case 16:{a=20;break}case 301:{a=18;break}case 302:{a=18;break}default:{}}if((a|0)!=(c[3118]|0))if((a|0)==(c[1880]|0))a=7520;else{a=37665;return a|0}else a=12472;a=c[a+12>>2]|0;return a|0}function Ph(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=g+4|0;f=g;c[a>>2]=0;d=Qh(d,0,e,f)|0;if(!d){d=c[(c[e>>2]|0)+48>>2]|0;if(!d)d=69;else d=pb[d&63](a,b,c[f>>2]|0)|0}sf(c[f>>2]|0);l=g;return d|0}function Qh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;c[d>>2]=0;g=(e|0)!=0;if(g)c[e>>2]=0;f=(b|0)!=0;b=uf(a,f?37667:37679,0)|0;if(!(f|(b|0)!=0))b=uf(a,37667,0)|0;if(!b){g=65;return g|0}f=Cf(b)|0;sf(b);b=zf(f,0)|0;if(!b){sf(f);g=65;return g|0}a=Nh(b)|0;cf(b);if(!a){sf(f);g=4;return g|0}c[d>>2]=a;if(g){c[e>>2]=f;g=0;return g|0}else{sf(f);g=0;return g|0}return 0}function Rh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=g+4|0;f=g;c[a>>2]=0;d=Qh(d,1,e,f)|0;if(!d){d=c[(c[e>>2]|0)+52>>2]|0;if(!d)d=69;else d=pb[d&63](a,b,c[f>>2]|0)|0}sf(c[f>>2]|0);l=g;return d|0}function Sh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=g+4|0;f=g;c[a>>2]=0;d=Qh(d,1,e,f)|0;if(!d){d=c[(c[e>>2]|0)+56>>2]|0;if(!d)d=69;else d=pb[d&63](a,b,c[f>>2]|0)|0}sf(c[f>>2]|0);l=g;return d|0}function Th(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=g+4|0;f=g;d=Qh(d,0,e,f)|0;if(!d){d=c[(c[e>>2]|0)+60>>2]|0;if(!d)d=69;else d=pb[d&63](a,b,c[f>>2]|0)|0}sf(c[f>>2]|0);l=g;return d|0}function Uh(a){a=a|0;var b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=e+4|0;d=e;a=Qh(a,1,b,d)|0;if(!a){a=c[(c[b>>2]|0)+44>>2]|0;if(!a)a=69;else a=tb[a&15](c[d>>2]|0)|0}sf(c[d>>2]|0);l=e;return a|0}function Vh(a,b){a=a|0;b=b|0;var d=0,e=0;c[a>>2]=0;d=uf(b,37690,0)|0;if(d){b=Cf(d)|0;sf(d);if(b){d=zf(b,0)|0;if(d){e=Nh(d)|0;cf(d);if(e){d=c[e+40>>2]|0;if(!d)d=69;else d=yb[d&7](b,a)|0}else d=4}else d=65}else{d=68;b=0}}else{d=65;b=0}sf(b);cf(0);sf(0);return d|0}function Wh(){return 0}function Xh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;switch(b|0){case 3:case 2:{g=1;break}case 16:{g=20;break}case 301:{g=18;break}case 302:{g=18;break}default:g=b}if((g|0)!=(c[3118]|0))if((g|0)==(c[1880]|0)){b=7520;h=8}else{b=0;d=0;h=11}else{b=12472;h=8}if((h|0)==8)if((a[b+4>>0]&1)==0?(f=c[b+68>>2]|0,(f|0)!=0):0)b=pb[f&63](g,d,e)|0;else{d=1;h=11}if((h|0)==11)if(!e)b=4;else{if(d?(a[b+4>>0]&1)==0:0)b=37736;else b=d?37697:37716;zb[e&1](40871,g,37758,b);b=4}return ((b|0)==0?0:b&65535|16777216)|0}function Yh(a,b,c){a=a|0;b=b|0;c=c|0;return ai(a,b,c)|0}function Zh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=c[a+496>>2]|0;if(e|0)vb[e&3]();return pb[c[a+488>>2]&63](a,b,d)|0}function _h(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;bi(a);e=c[a+500>>2]|0;if(e|0)vb[e&3]();return pb[c[a+492>>2]&63](a,b,d)|0}function $h(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=l;l=l+528|0;if((l|0)>=(m|0))$(528);e=h;f=h+504|0;switch(a|0){case 7:{ai(e,37769,16)|0;a=c[e+496>>2]|0;if(a|0)vb[a&3]();pb[c[e+488>>2]&63](e,f,37785)|0;if(!(Tp(f,37801,16)|0)){bi(e);a=c[e+500>>2]|0;if(a|0)vb[a&3]();pb[c[e+492>>2]&63](e,f,f)|0;if(!(Tp(f,37785,16)|0)){if(!b){d=0;l=h;return d|0}a=ci(2)|0;if(!a){a=ci(5)|0;if(!a){d=0;l=h;return d|0}else b=37885}else b=37881}else{a=37817;g=8}}else{a=37849;g=8}if((g|0)==8)b=37889;if(!d){d=50;l=h;return d|0}zb[d&1](37899,7,b,a);d=50;l=h;return d|0}case 8:{ai(e,37906,24)|0;a=c[e+496>>2]|0;if(a|0)vb[a&3]();pb[c[e+488>>2]&63](e,f,37930)|0;if(!(Tp(f,37946,16)|0)){bi(e);a=c[e+500>>2]|0;if(a|0)vb[a&3]();pb[c[e+492>>2]&63](e,f,f)|0;if(!(Tp(f,37930,16)|0)){d=0;l=h;return d|0}else a=37962}else a=37994;if(!d){d=50;l=h;return d|0}zb[d&1](37899,8,37889,a);d=50;l=h;return d|0}case 9:{ai(e,38026,32)|0;a=c[e+496>>2]|0;if(a|0)vb[a&3]();pb[c[e+488>>2]&63](e,f,38058)|0;if(!(Tp(f,38074,16)|0)){bi(e);a=c[e+500>>2]|0;if(a|0)vb[a&3]();pb[c[e+492>>2]&63](e,f,f)|0;if(!(Tp(f,38058,16)|0)){d=0;l=h;return d|0}else a=38090}else a=38122;if(!d){d=50;l=h;return d|0}zb[d&1](37899,9,37889,a);d=50;l=h;return d|0}default:{d=12;l=h;return d|0}}return 0}function ai(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0;K=l;l=l+528|0;if((l|0)>=(m|0))$(528);j=K+504|0;J=K;h=K+512|0;I=gg()|0;a:do if(!(c[17616]|I)){c[17616]=1;ai(J,37769,16)|0;g=c[J+496>>2]|0;if(g|0)vb[g&3]();pb[c[J+488>>2]&63](J,h,37785)|0;do if(!(Tp(h,37801,16)|0)){bi(J);g=c[J+500>>2]|0;if(g|0)vb[g&3]();pb[c[J+492>>2]&63](J,h,h)|0;if(!(Tp(h,37785,16)|0)){ai(J,37906,24)|0;g=c[J+496>>2]|0;if(g|0)vb[g&3]();pb[c[J+488>>2]&63](J,h,37930)|0;if(!(Tp(h,37946,16)|0)){bi(J);g=c[J+500>>2]|0;if(g|0)vb[g&3]();pb[c[J+492>>2]&63](J,h,h)|0;if(!(Tp(h,37930,16)|0)){ai(J,38026,32)|0;g=c[J+496>>2]|0;if(g|0)vb[g&3]();pb[c[J+488>>2]&63](J,h,38058)|0;if(!(Tp(h,38074,16)|0)){bi(J);g=c[J+500>>2]|0;if(g|0)vb[g&3]();pb[c[J+492>>2]&63](J,h,h)|0;if(!(Tp(h,38058,16)|0)){g=ym(37765,1,2,4,9,16,504)|0;if(g|0){i=25;break}g=wm(37765,1,2,3,10,16,504)|0;if(g|0){i=25;break}g=xm(37765,1,2,2,10,16,504)|0;c[17617]=g;if(!g)break a;else break}else g=38090}else g=38122;i=25;break}else g=37962}else g=37994;i=25}else{g=37817;i=8}}else{g=37849;i=8}while(0);if((i|0)==8)i=25;if((i|0)==25)c[17617]=g;c[j>>2]=g;Le(43455,j);i=28}else i=28;while(0);if((i|0)==28?c[17617]|0:0){J=50;l=K;return J|0}switch(f|0){case 16:{h=10;I=4;break}case 24:{h=12;I=6;break}case 32:{h=14;I=8;break}default:{J=44;l=K;return J|0}}c[b+480>>2]=h;g=b+484|0;a[g>>0]=a[g>>0]&-2;c[b+488>>2]=29;c[b+492>>2]=30;c[b+496>>2]=1;c[b+500>>2]=2;g=0;do{a[(g&3)+(J+(g>>2<<2))>>0]=a[e+g>>0]|0;g=g+1|0}while((g|0)!=(f|0));j=I+-1|0;H=J+32|0;g=j;while(1){c[H+(g<<2)>>2]=c[J+(g<<2)>>2];if((g|0)>0)g=g+-1|0;else break}G=h|1;h=0;e=0;g=0;do{if((g|0)<(I|0)&(h|0)<4){E=g-I|0;F=h+-4|0;cr(b+((e<<4)+(h<<2))|0,H+(g<<2)|0,S(E>>>0>F>>>0?E:F,-4)|0)|0;do{g=g+1|0;h=h+1|0}while((g|0)<(I|0)&(h|0)<4)}i=(h|0)==4;e=(i&1)+e|0;h=i?0:h;i=(e|0)<(G|0)}while((g|0)<(I|0)&i);if(i){B=H+(j<<2)+1|0;C=H+(j<<2)+2|0;D=H+1|0;E=H+(j<<2)+3|0;F=H+2|0;o=H+(j<<2)|0;p=H+3|0;q=(I|0)==8;r=I>>>1;y=r+-1|0;s=H+(y<<2)|0;t=H+(r<<2)|0;u=H+(y<<2)+1|0;v=H+(r<<2)+1|0;w=H+(y<<2)+2|0;x=H+(r<<2)+2|0;y=H+(y<<2)+3|0;z=H+(r<<2)+3|0;k=r+1|0;A=k>>>0<8;n=H+(r<<2)|0;f=0;i=e;do{j=c[H>>2]|0;e=j&255^a[4801+((d[B>>0]|0)<<2)>>0];a[H>>0]=e;a[D>>0]=(j&65535)>>>8&255^a[4801+((d[C>>0]|0)<<2)>>0];a[F>>0]=j>>>16&255^a[4801+((d[E>>0]|0)<<2)>>0];a[p>>0]=j>>>24&255^a[4801+((d[o>>0]|0)<<2)>>0];a[H>>0]=e&255^c[7104+(f<<2)>>2];f=f+1|0;if(q){g=1;j=c[H>>2]|0;do{e=H+(g<<2)|0;j=c[e>>2]^j;c[e>>2]=j;g=g+1|0}while((g|0)<(r|0));a[t>>0]=a[t>>0]^a[4801+((d[s>>0]|0)<<2)>>0];a[v>>0]=a[v>>0]^a[4801+((d[u>>0]|0)<<2)>>0];a[x>>0]=a[x>>0]^a[4801+((d[w>>0]|0)<<2)>>0];a[z>>0]=a[z>>0]^a[4801+((d[y>>0]|0)<<2)>>0];if(A){g=k;j=c[n>>2]|0;do{e=H+(g<<2)|0;j=c[e>>2]^j;c[e>>2]=j;g=g+1|0}while((g|0)<8)}}else{g=1;j=c[H>>2]|0;do{e=H+(g<<2)|0;j=c[e>>2]^j;c[e>>2]=j;g=g+1|0}while((g|0)<(I|0))}if((i|0)<(G|0)){g=0;do{if((g|0)<(I|0)&(h|0)<4){j=g-I|0;e=h+-4|0;cr(b+((i<<4)+(h<<2))|0,H+(g<<2)|0,S(j>>>0>e>>>0?j:e,-4)|0)|0;do{g=g+1|0;h=h+1|0}while((g|0)<(I|0)&(h|0)<4)}e=(h|0)==4;i=(e&1)+i|0;h=e?0:h}while((g|0)<(I|0)&(i|0)<(G|0))}}while((i|0)<(G|0))}b=J;c[b>>2]=0;c[b+4>>2]=0;b=J+8|0;c[b>>2]=0;c[b+4>>2]=0;b=J+16|0;c[b>>2]=0;c[b+4>>2]=0;b=J+24|0;c[b>>2]=0;c[b+4>>2]=0;b=J+32|0;c[b>>2]=0;c[b+4>>2]=0;b=J+40|0;c[b>>2]=0;c[b+4>>2]=0;b=J+48|0;c[b>>2]=0;c[b+4>>2]=0;J=J+56|0;c[J>>2]=0;c[J+4>>2]=0;J=0;l=K;return J|0}function bi(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;h=b+484|0;if(a[h>>0]&1)return;i=b+240|0;c[i>>2]=c[b>>2];c[i+4>>2]=c[b+4>>2];c[b+248>>2]=c[b+8>>2];c[b+252>>2]=c[b+12>>2];g=b+480|0;e=b+16|0;if((c[g>>2]|0)>1){f=1;do{e=c[e>>2]|0;j=c[5824+((d[4801+(e>>>6&1020)>>0]|0)<<2)>>2]|0;k=c[5824+((d[4801+(e>>>14&1020)>>0]|0)<<2)>>2]|0;l=c[5824+((d[4801+(e>>>24<<2)>>0]|0)<<2)>>2]|0;c[i+(f<<4)>>2]=(j<<8|j>>>24)^c[5824+((d[4801+(e<<2&1020)>>0]|0)<<2)>>2]^(k<<16|k>>>16)^(l<<24|l>>>8);l=c[b+(f<<4)+4>>2]|0;k=c[5824+((d[4801+(l>>>6&1020)>>0]|0)<<2)>>2]|0;e=c[5824+((d[4801+(l>>>14&1020)>>0]|0)<<2)>>2]|0;j=c[5824+((d[4801+(l>>>24<<2)>>0]|0)<<2)>>2]|0;c[i+(f<<4)+4>>2]=(k<<8|k>>>24)^c[5824+((d[4801+(l<<2&1020)>>0]|0)<<2)>>2]^(e<<16|e>>>16)^(j<<24|j>>>8);j=c[b+(f<<4)+8>>2]|0;e=c[5824+((d[4801+(j>>>6&1020)>>0]|0)<<2)>>2]|0;l=c[5824+((d[4801+(j>>>14&1020)>>0]|0)<<2)>>2]|0;k=c[5824+((d[4801+(j>>>24<<2)>>0]|0)<<2)>>2]|0;c[i+(f<<4)+8>>2]=(e<<8|e>>>24)^c[5824+((d[4801+(j<<2&1020)>>0]|0)<<2)>>2]^(l<<16|l>>>16)^(k<<24|k>>>8);k=c[b+(f<<4)+12>>2]|0;l=c[5824+((d[4801+(k>>>6&1020)>>0]|0)<<2)>>2]|0;j=c[5824+((d[4801+(k>>>14&1020)>>0]|0)<<2)>>2]|0;e=c[5824+((d[4801+(k>>>24<<2)>>0]|0)<<2)>>2]|0;c[i+(f<<4)+12>>2]=(l<<8|l>>>24)^c[5824+((d[4801+(k<<2&1020)>>0]|0)<<2)>>2]^(j<<16|j>>>16)^(e<<24|e>>>8);f=f+1|0;e=b+(f<<4)|0}while((f|0)<(c[g>>2]|0))}else f=1;c[i+(f<<4)>>2]=c[e>>2];c[i+(f<<4)+4>>2]=c[b+(f<<4)+4>>2];c[i+(f<<4)+8>>2]=c[b+(f<<4)+8>>2];c[i+(f<<4)+12>>2]=c[b+(f<<4)+12>>2];a[h>>0]=a[h>>0]|1;return}function ci(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;h=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=h+8|0;f=h+4|0;g=h;c[f>>2]=0;c[g>>2]=0;if((a|0)!=2)if((a|0)==5)d=1;else{xg(0);xg(0);g=38154;l=h;return g|0}else d=0;a=c[4472+(d*164|0)>>2]|0;if(vg(f,7,a,0)|0){xg(c[f>>2]|0);xg(c[g>>2]|0);g=38181;l=h;return g|0}b=(vg(g,7,a,0)|0)==0;a=c[f>>2]|0;if(!b){xg(a);xg(c[g>>2]|0);g=38181;l=h;return g|0}b=4472+(d*164|0)+4|0;if(!(Ag(a,b,16)|0)){b=(Ag(c[g>>2]|0,b,16)|0)==0;a=c[f>>2]|0;if(b){b=4472+(d*164|0)+20|0;if((Bg(a,b,16)|0)==0?(Bg(c[g>>2]|0,b,16)|0)==0:0){a=4472+(d*164|0)+36|0;a:do if(!(yg(c[f>>2]|0,e,16,a,16)|0)){b=4472+(d*164|0)+52|0;b:do if(!(Tp(e,b,16)|0)){c:do if(!(zg(c[g>>2]|0,e,16,b,16)|0)){do if(!(Tp(e,a,16)|0)){a=4472+(d*164|0)+68|0;if(yg(c[f>>2]|0,e,16,a,16)|0)break a;b=4472+(d*164|0)+84|0;if(Tp(e,b,16)|0)break b;if(zg(c[g>>2]|0,e,16,b,16)|0)break c;if(Tp(e,a,16)|0)break;a=4472+(d*164|0)+100|0;if(yg(c[f>>2]|0,e,16,a,16)|0)break a;b=4472+(d*164|0)+116|0;if(Tp(e,b,16)|0)break b;if(zg(c[g>>2]|0,e,16,b,16)|0)break c;if(Tp(e,a,16)|0)break;b=4472+(d*164|0)+132|0;if(yg(c[f>>2]|0,e,16,b,16)|0)break a;a=4472+(d*164|0)+148|0;if(Tp(e,a,16)|0)break b;if(zg(c[g>>2]|0,e,16,a,16)|0)break c;if(Tp(e,b,16)|0)break;xg(c[f>>2]|0);xg(c[g>>2]|0);g=0;l=h;return g|0}while(0);xg(c[f>>2]|0);xg(c[g>>2]|0);g=38250;l=h;return g|0}while(0);xg(c[f>>2]|0);xg(c[g>>2]|0);g=38234;l=h;return g|0}while(0);xg(c[f>>2]|0);xg(c[g>>2]|0);g=38217;l=h;return g|0}while(0);xg(c[f>>2]|0);xg(c[g>>2]|0);g=38201;l=h;return g|0}xg(c[f>>2]|0);xg(c[g>>2]|0);g=38194;l=h;return g|0}}else a=c[f>>2]|0;xg(a);xg(c[g>>2]|0);g=38186;l=h;return g|0}function di(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;F=l;l=l+16|0;if((l|0)>=(m|0))$(16);E=F;h=c[b+496>>2]|0;if(h|0)vb[h&3]();j=c[b+488>>2]|0;if(!g){d=E;c[d>>2]=0;c[d+4>>2]=0;E=E+8|0;c[E>>2]=0;c[E+4>>2]=0;l=F;return}k=E+4|0;n=E+8|0;o=E+12|0;p=E+1|0;q=E+2|0;r=E+3|0;s=E+4|0;t=s+1|0;u=s+2|0;v=s+3|0;w=E+8|0;x=w+1|0;y=w+2|0;z=w+3|0;A=E+12|0;B=A+1|0;C=A+2|0;D=A+3|0;do{i=pb[j&63](b,E,d)|0;if(!((e|f)&3)){c[e>>2]=c[f>>2]^c[E>>2];c[e+4>>2]=c[f+4>>2]^c[k>>2];c[e+8>>2]=c[f+8>>2]^c[n>>2];c[e+12>>2]=c[f+12>>2]^c[o>>2]}else{a[e>>0]=a[f>>0]^a[E>>0];a[e+1>>0]=a[f+1>>0]^a[p>>0];a[e+2>>0]=a[f+2>>0]^a[q>>0];a[e+3>>0]=a[f+3>>0]^a[r>>0];a[e+4>>0]=a[f+4>>0]^a[s>>0];a[e+5>>0]=a[f+5>>0]^a[t>>0];a[e+6>>0]=a[f+6>>0]^a[u>>0];a[e+7>>0]=a[f+7>>0]^a[v>>0];a[e+8>>0]=a[f+8>>0]^a[w>>0];a[e+9>>0]=a[f+9>>0]^a[x>>0];a[e+10>>0]=a[f+10>>0]^a[y>>0];a[e+11>>0]=a[f+11>>0]^a[z>>0];a[e+12>>0]=a[f+12>>0]^a[A>>0];a[e+13>>0]=a[f+13>>0]^a[B>>0];a[e+14>>0]=a[f+14>>0]^a[C>>0];a[e+15>>0]=a[f+15>>0]^a[D>>0]}e=e+16|0;f=f+16|0;h=16;do{if((h|0)<=0)break;h=h+-1|0;H=d+h|0;G=(a[H>>0]|0)+1<<24>>24;a[H>>0]=G}while(!(G<<24>>24));g=g+-1|0}while((g|0)!=0);H=E;c[H>>2]=0;c[H+4>>2]=0;H=E+8|0;c[H>>2]=0;c[H+4>>2]=0;if(!i){l=F;return}Te(i+16|0);l=F;return}function ei(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;X=l;l=l+16|0;if((l|0)>=(m|0))$(16);W=X;bi(b);h=c[b+500>>2]|0;if(h|0)vb[h&3]();i=c[b+492>>2]|0;if(!g){d=W;c[d>>2]=0;c[d+4>>2]=0;W=W+8|0;c[W>>2]=0;c[W+4>>2]=0;l=X;return}j=d;k=W+4|0;n=d+4|0;o=W+8|0;p=d+8|0;q=W+12|0;r=d+12|0;s=W+1|0;t=d+1|0;u=W+2|0;v=d+2|0;w=W+3|0;x=d+3|0;y=W+4|0;z=d+4|0;A=W+5|0;B=d+5|0;C=W+6|0;D=d+6|0;E=W+7|0;F=d+7|0;G=W+8|0;H=d+8|0;I=W+9|0;J=d+9|0;K=W+10|0;L=d+10|0;M=W+11|0;N=d+11|0;O=W+12|0;P=d+12|0;Q=W+13|0;R=d+13|0;S=W+14|0;T=d+14|0;U=W+15|0;V=d+15|0;h=g;while(1){g=pb[i&63](b,W,f)|0;if(!((f|j|e)&3)){Y=c[f>>2]|0;c[e>>2]=c[W>>2]^c[d>>2];c[d>>2]=Y;Y=c[f+4>>2]|0;c[e+4>>2]=c[k>>2]^c[n>>2];c[n>>2]=Y;Y=c[f+8>>2]|0;c[e+8>>2]=c[o>>2]^c[p>>2];c[p>>2]=Y;Y=c[f+12>>2]|0;c[e+12>>2]=c[q>>2]^c[r>>2];c[r>>2]=Y}else{Y=a[f>>0]|0;a[e>>0]=a[W>>0]^a[d>>0];a[d>>0]=Y;Y=a[f+1>>0]|0;a[e+1>>0]=a[s>>0]^a[t>>0];a[t>>0]=Y;Y=a[f+2>>0]|0;a[e+2>>0]=a[u>>0]^a[v>>0];a[v>>0]=Y;Y=a[f+3>>0]|0;a[e+3>>0]=a[w>>0]^a[x>>0];a[x>>0]=Y;Y=a[f+4>>0]|0;a[e+4>>0]=a[y>>0]^a[z>>0];a[z>>0]=Y;Y=a[f+5>>0]|0;a[e+5>>0]=a[A>>0]^a[B>>0];a[B>>0]=Y;Y=a[f+6>>0]|0;a[e+6>>0]=a[C>>0]^a[D>>0];a[D>>0]=Y;Y=a[f+7>>0]|0;a[e+7>>0]=a[E>>0]^a[F>>0];a[F>>0]=Y;Y=a[f+8>>0]|0;a[e+8>>0]=a[G>>0]^a[H>>0];a[H>>0]=Y;Y=a[f+9>>0]|0;a[e+9>>0]=a[I>>0]^a[J>>0];a[J>>0]=Y;Y=a[f+10>>0]|0;a[e+10>>0]=a[K>>0]^a[L>>0];a[L>>0]=Y;Y=a[f+11>>0]|0;a[e+11>>0]=a[M>>0]^a[N>>0];a[N>>0]=Y;Y=a[f+12>>0]|0;a[e+12>>0]=a[O>>0]^a[P>>0];a[P>>0]=Y;Y=a[f+13>>0]|0;a[e+13>>0]=a[Q>>0]^a[R>>0];a[R>>0]=Y;Y=a[f+14>>0]|0;a[e+14>>0]=a[S>>0]^a[T>>0];a[T>>0]=Y;Y=a[f+15>>0]|0;a[e+15>>0]=a[U>>0]^a[V>>0];a[V>>0]=Y}h=h+-1|0;if(!h)break;else{e=e+16|0;f=f+16|0}}Y=W;c[Y>>2]=0;c[Y+4>>2]=0;Y=W+8|0;c[Y>>2]=0;c[Y+4>>2]=0;if(!g){l=X;return}Te(g+16|0);l=X;return}function fi(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;h=c[b+496>>2]|0;if(h|0)vb[h&3]();z=c[b+488>>2]|0;if(!g)return;j=d;k=d+4|0;l=d+8|0;m=d+12|0;n=d+1|0;o=d+2|0;p=d+3|0;q=d+5|0;r=d+6|0;s=d+7|0;t=d+9|0;u=d+10|0;v=d+11|0;w=d+13|0;x=d+14|0;y=d+15|0;i=f;h=g;while(1){f=pb[z&63](b,d,d)|0;if(!((e|j|i)&3)){g=c[i>>2]|0;c[e>>2]=c[d>>2]^g;c[d>>2]=g;g=c[i+4>>2]|0;c[e+4>>2]=c[k>>2]^g;c[k>>2]=g;g=c[i+8>>2]|0;c[e+8>>2]=c[l>>2]^g;c[l>>2]=g;g=c[i+12>>2]|0;c[e+12>>2]=c[m>>2]^g;c[m>>2]=g}else{g=a[i>>0]|0;a[e>>0]=a[d>>0]^g;a[d>>0]=g;g=a[i+1>>0]|0;a[e+1>>0]=a[n>>0]^g;a[n>>0]=g;g=a[i+2>>0]|0;a[e+2>>0]=a[o>>0]^g;a[o>>0]=g;g=a[i+3>>0]|0;a[e+3>>0]=a[p>>0]^g;a[p>>0]=g;g=a[i+4>>0]|0;a[e+4>>0]=a[k>>0]^g;a[k>>0]=g;g=a[i+5>>0]|0;a[e+5>>0]=a[q>>0]^g;a[q>>0]=g;g=a[i+6>>0]|0;a[e+6>>0]=a[r>>0]^g;a[r>>0]=g;g=a[i+7>>0]|0;a[e+7>>0]=a[s>>0]^g;a[s>>0]=g;g=a[i+8>>0]|0;a[e+8>>0]=a[l>>0]^g;a[l>>0]=g;g=a[i+9>>0]|0;a[e+9>>0]=a[t>>0]^g;a[t>>0]=g;g=a[i+10>>0]|0;a[e+10>>0]=a[u>>0]^g;a[u>>0]=g;g=a[i+11>>0]|0;a[e+11>>0]=a[v>>0]^g;a[v>>0]=g;g=a[i+12>>0]|0;a[e+12>>0]=a[m>>0]^g;a[m>>0]=g;g=a[i+13>>0]|0;a[e+13>>0]=a[w>>0]^g;a[w>>0]=g;g=a[i+14>>0]|0;a[e+14>>0]=a[x>>0]^g;a[x>>0]=g;g=a[i+15>>0]|0;a[e+15>>0]=a[y>>0]^g;a[y>>0]=g}h=h+-1|0;if(!h)break;else{i=i+16|0;e=e+16|0}}if(!f)return;Te(f+16|0);return}function gi(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;l=c[b+480>>2]|0;p=c[b>>2]^((d[f+2>>0]|0)<<16|(d[f+3>>0]|0)<<24|(d[f+1>>0]|0)<<8|(d[f>>0]|0));q=c[b+4>>2]^((d[f+6>>0]|0)<<16|(d[f+7>>0]|0)<<24|(d[f+5>>0]|0)<<8|(d[f+4>>0]|0));g=c[b+8>>2]^((d[f+10>>0]|0)<<16|(d[f+11>>0]|0)<<24|(d[f+9>>0]|0)<<8|(d[f+8>>0]|0));j=c[b+12>>2]^((d[f+14>>0]|0)<<16|(d[f+15>>0]|0)<<24|(d[f+13>>0]|0)<<8|(d[f+12>>0]|0));k=c[4800+((p>>>8&255)<<2)>>2]|0;s=c[4800+((p>>>16&255)<<2)>>2]|0;r=c[4800+(p>>>24<<2)>>2]|0;o=c[4800+((q>>>8&255)<<2)>>2]|0;m=c[4800+((q>>>16&255)<<2)>>2]|0;t=c[4800+(q>>>24<<2)>>2]|0;i=c[4800+((g>>>8&255)<<2)>>2]|0;n=c[4800+((g>>>16&255)<<2)>>2]|0;h=c[4800+(g>>>24<<2)>>2]|0;f=c[4800+((j>>>8&255)<<2)>>2]|0;f=(t<<24|t>>>8)^(s<<16|s>>>16)^c[4800+((g&255)<<2)>>2]^c[b+24>>2]^(f<<8|f>>>24);g=c[4800+((j>>>16&255)<<2)>>2]|0;g=(r<<24|r>>>8)^c[4800+((q&255)<<2)>>2]^c[b+20>>2]^(i<<8|i>>>24)^(g<<16|g>>>16);i=c[4800+(j>>>24<<2)>>2]|0;i=c[b+16>>2]^c[4800+((p&255)<<2)>>2]^(o<<8|o>>>24)^(n<<16|n>>>16)^(i<<24|i>>>8);j=(m<<16|m>>>16)^(k<<8|k>>>24)^(h<<24|h>>>8)^c[4800+((j&255)<<2)>>2]^c[b+28>>2];h=i&255;if((l|0)>2){k=2;do{t=c[4800+((i>>>8&255)<<2)>>2]|0;w=c[4800+((i>>>16&255)<<2)>>2]|0;m=c[4800+(i>>>24<<2)>>2]|0;x=c[4800+((g>>>8&255)<<2)>>2]|0;q=c[4800+((g>>>16&255)<<2)>>2]|0;p=c[4800+(g>>>24<<2)>>2]|0;u=c[4800+((f>>>8&255)<<2)>>2]|0;z=c[4800+((f>>>16&255)<<2)>>2]|0;s=c[4800+(f>>>24<<2)>>2]|0;y=c[4800+((j>>>8&255)<<2)>>2]|0;y=(p<<24|p>>>8)^(w<<16|w>>>16)^c[4800+((f&255)<<2)>>2]^c[b+(k<<4)+8>>2]^(y<<8|y>>>24);w=c[4800+((j>>>16&255)<<2)>>2]|0;w=(m<<24|m>>>8)^c[4800+((g&255)<<2)>>2]^c[b+(k<<4)+4>>2]^(u<<8|u>>>24)^(w<<16|w>>>16);u=c[4800+(j>>>24<<2)>>2]|0;u=c[b+(k<<4)>>2]^c[4800+(h<<2)>>2]^(x<<8|x>>>24)^(z<<16|z>>>16)^(u<<24|u>>>8);s=(q<<16|q>>>16)^(t<<8|t>>>24)^(s<<24|s>>>8)^c[4800+((j&255)<<2)>>2]^c[b+(k<<4)+12>>2];t=k|1;q=c[4800+((u>>>8&255)<<2)>>2]|0;z=c[4800+((u>>>16&255)<<2)>>2]|0;x=c[4800+(u>>>24<<2)>>2]|0;m=c[4800+((w>>>8&255)<<2)>>2]|0;p=c[4800+((w>>>16&255)<<2)>>2]|0;A=c[4800+(w>>>24<<2)>>2]|0;v=c[4800+((y>>>8&255)<<2)>>2]|0;n=c[4800+((y>>>16&255)<<2)>>2]|0;r=c[4800+(y>>>24<<2)>>2]|0;o=c[4800+((s>>>8&255)<<2)>>2]|0;f=(A<<24|A>>>8)^(z<<16|z>>>16)^c[4800+((y&255)<<2)>>2]^c[b+(t<<4)+8>>2]^(o<<8|o>>>24);o=c[4800+((s>>>16&255)<<2)>>2]|0;g=(x<<24|x>>>8)^c[4800+((w&255)<<2)>>2]^c[b+(t<<4)+4>>2]^(v<<8|v>>>24)^(o<<16|o>>>16);o=c[4800+(s>>>24<<2)>>2]|0;i=c[b+(t<<4)>>2]^c[4800+((u&255)<<2)>>2]^(m<<8|m>>>24)^(n<<16|n>>>16)^(o<<24|o>>>8);j=(p<<16|p>>>16)^(q<<8|q>>>24)^(r<<24|r>>>8)^c[4800+((s&255)<<2)>>2]^c[b+(t<<4)+12>>2];k=k+2|0;h=i&255}while((k|0)<(l|0));k=l+1&-2}else k=2;r=c[b+(k<<4)>>2]|0;u=r^(d[4801+(h<<2)>>0]|0);t=(d[4801+(g>>>6&1020)>>0]|0)<<8^r;v=c[b+(k<<4)+4>>2]|0;x=v^(d[4801+(g<<2&1020)>>0]|0|(d[4801+(i>>>24<<2)>>0]|0)<<24);w=(d[4801+(f>>>6&1020)>>0]|0)<<8^v;s=(d[4801+(f>>>14&1020)>>0]|0)<<16^r;z=c[b+(k<<4)+8>>2]^((d[4801+(g>>>24<<2)>>0]|0)<<24|(d[4801+(i>>>14&1020)>>0]|0)<<16|(d[4801+(f<<2&1020)>>0]|0));y=(d[4801+(j>>>6&1020)>>0]|0)<<8^z;v=(d[4801+(j>>>14&1020)>>0]|0)<<16^v;A=c[b+(k<<4)+12>>2]^((d[4801+(g>>>14&1020)>>0]|0)<<16|(d[4801+(i>>>6&1020)>>0]|0)<<8|(d[4801+(f>>>24<<2)>>0]|0)<<24|(d[4801+(j<<2&1020)>>0]|0));a[e+3>>0]=((d[4801+(j>>>24<<2)>>0]|0)<<24^r)>>>24;a[e+2>>0]=s>>>16;a[e+1>>0]=t>>>8;a[e>>0]=u;a[e+7>>0]=x>>>24;a[e+6>>0]=v>>>16;a[e+5>>0]=w>>>8;a[e+4>>0]=x;a[e+11>>0]=z>>>24;a[e+10>>0]=z>>>16;a[e+9>>0]=y>>>8;a[e+8>>0]=z;a[e+15>>0]=A>>>24;a[e+14>>0]=A>>>16;a[e+13>>0]=A>>>8;a[e+12>>0]=A;return 64}function hi(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;i=c[b+480>>2]|0;p=b+240|0;m=i;h=c[p+(i<<4)>>2]^((d[f+2>>0]|0)<<16|(d[f+3>>0]|0)<<24|(d[f+1>>0]|0)<<8|(d[f>>0]|0));n=c[p+(i<<4)+12>>2]^((d[f+14>>0]|0)<<16|(d[f+15>>0]|0)<<24|(d[f+13>>0]|0)<<8|(d[f+12>>0]|0));o=c[p+(i<<4)+4>>2]^((d[f+6>>0]|0)<<16|(d[f+7>>0]|0)<<24|(d[f+5>>0]|0)<<8|(d[f+4>>0]|0));i=c[p+(i<<4)+8>>2]^((d[f+10>>0]|0)<<16|(d[f+11>>0]|0)<<24|(d[f+9>>0]|0)<<8|(d[f+8>>0]|0));while(1){g=m+-1|0;k=c[5824+((h&255)<<2)>>2]|0;l=c[5824+((h>>>8&255)<<2)>>2]|0;l=l<<8|l>>>24;j=c[5824+((h>>>16&255)<<2)>>2]|0;j=j<<16|j>>>16;f=c[5824+(h>>>24<<2)>>2]|0;f=f<<24|f>>>8;if((g|0)<=1)break;w=c[5824+((o>>>8&255)<<2)>>2]|0;s=c[5824+((o>>>16&255)<<2)>>2]|0;z=c[5824+(o>>>24<<2)>>2]|0;u=c[5824+((i>>>8&255)<<2)>>2]|0;t=c[5824+((i>>>16&255)<<2)>>2]|0;x=c[5824+(i>>>24<<2)>>2]|0;A=c[5824+((n>>>8&255)<<2)>>2]|0;A=c[p+(g<<4)>>2]^k^(z<<24|z>>>8)^(t<<16|t>>>16)^(A<<8|A>>>24);t=c[5824+((n>>>16&255)<<2)>>2]|0;t=c[5824+((o&255)<<2)>>2]^l^c[p+(g<<4)+4>>2]^(x<<24|x>>>8)^(t<<16|t>>>16);k=c[5824+(n>>>24<<2)>>2]|0;j=(w<<8|w>>>24)^j^c[5824+((i&255)<<2)>>2]^c[p+(g<<4)+8>>2]^(k<<24|k>>>8);u=(s<<16|s>>>16)^f^(u<<8|u>>>24)^c[5824+((n&255)<<2)>>2]^c[p+(g<<4)+12>>2];k=m+-2|0;s=c[5824+((A>>>8&255)<<2)>>2]|0;g=c[5824+((A>>>16&255)<<2)>>2]|0;w=c[5824+(A>>>24<<2)>>2]|0;f=c[5824+((t>>>8&255)<<2)>>2]|0;x=c[5824+((t>>>16&255)<<2)>>2]|0;z=c[5824+(t>>>24<<2)>>2]|0;v=c[5824+((j>>>8&255)<<2)>>2]|0;y=c[5824+((j>>>16&255)<<2)>>2]|0;r=c[5824+(j>>>24<<2)>>2]|0;h=c[5824+((u>>>8&255)<<2)>>2]|0;q=c[5824+((u>>>16&255)<<2)>>2]|0;l=c[5824+(u>>>24<<2)>>2]|0;m=k;h=c[p+(k<<4)>>2]^c[5824+((A&255)<<2)>>2]^(z<<24|z>>>8)^(y<<16|y>>>16)^(h<<8|h>>>24);n=(x<<16|x>>>16)^(w<<24|w>>>8)^(v<<8|v>>>24)^c[5824+((u&255)<<2)>>2]^c[p+(k<<4)+12>>2];o=c[5824+((t&255)<<2)>>2]^(s<<8|s>>>24)^c[p+(k<<4)+4>>2]^(r<<24|r>>>8)^(q<<16|q>>>16);i=(f<<8|f>>>24)^(g<<16|g>>>16)^c[5824+((j&255)<<2)>>2]^c[p+(k<<4)+8>>2]^(l<<24|l>>>8)}u=c[5824+((o>>>8&255)<<2)>>2]|0;r=c[5824+((o>>>16&255)<<2)>>2]|0;x=c[5824+(o>>>24<<2)>>2]|0;A=c[5824+((i>>>8&255)<<2)>>2]|0;q=c[5824+((i>>>16&255)<<2)>>2]|0;w=c[5824+(i>>>24<<2)>>2]|0;m=c[5824+((n>>>8&255)<<2)>>2]|0;m=c[b+256>>2]^k^(x<<24|x>>>8)^(q<<16|q>>>16)^(m<<8|m>>>24);q=c[5824+((n>>>16&255)<<2)>>2]|0;q=c[5824+((o&255)<<2)>>2]^l^c[b+260>>2]^(w<<24|w>>>8)^(q<<16|q>>>16);o=c[5824+(n>>>24<<2)>>2]|0;o=(u<<8|u>>>24)^j^c[5824+((i&255)<<2)>>2]^c[b+264>>2]^(o<<24|o>>>8);A=(r<<16|r>>>16)^f^(A<<8|A>>>24)^c[5824+((n&255)<<2)>>2]^c[b+268>>2];r=c[p>>2]|0;u=r^(d[6848+(m&255)>>0]|0);w=c[p+4>>2]|0;x=w^(d[6848+(q&255)>>0]|0|(d[6848+(m>>>8&255)>>0]|0)<<8);s=(d[6848+(o>>>16&255)>>0]|0)<<16^r;v=(d[6848+(o>>>24)>>0]|0)<<24^w;z=c[b+248>>2]^((d[6848+(q>>>8&255)>>0]|0)<<8|(d[6848+(m>>>16&255)>>0]|0)<<16|(d[6848+(o&255)>>0]|0));t=(d[6848+(A>>>8&255)>>0]|0)<<8^r;w=(d[6848+(A>>>16&255)>>0]|0)<<16^w;y=(d[6848+(A>>>24)>>0]|0)<<24^z;A=c[b+252>>2]^((d[6848+(q>>>16&255)>>0]|0)<<16|(d[6848+(m>>>24)>>0]|0)<<24|(d[6848+(o>>>8&255)>>0]|0)<<8|(d[6848+(A&255)>>0]|0));a[e+3>>0]=((d[6848+(q>>>24)>>0]|0)<<24^r)>>>24;a[e+2>>0]=s>>>16;a[e+1>>0]=t>>>8;a[e>>0]=u;a[e+7>>0]=v>>>24;a[e+6>>0]=w>>>16;a[e+5>>0]=x>>>8;a[e+4>>0]=x;a[e+11>>0]=y>>>24;a[e+10>>0]=z>>>16;a[e+9>>0]=z>>>8;a[e+8>>0]=z;a[e+15>>0]=A>>>24;a[e+14>>0]=A>>>16;a[e+13>>0]=A>>>8;a[e+12>>0]=A;return 64}function ii(){return}function ji(){return}function ki(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;h=c[b+496>>2]|0;if(h|0)vb[h&3]();B=c[b+488>>2]|0;if(!g)return;i=d;j=d+4|0;k=d+8|0;l=d+12|0;m=d+1|0;n=d+2|0;o=d+3|0;p=d+4|0;q=d+5|0;r=d+6|0;s=d+7|0;t=d+8|0;u=d+9|0;v=d+10|0;w=d+11|0;x=d+12|0;y=d+13|0;z=d+14|0;A=d+15|0;h=g;while(1){g=pb[B&63](b,d,d)|0;if(!((e|i|f)&3)){C=c[d>>2]^c[f>>2];c[d>>2]=C;c[e>>2]=C;C=c[j>>2]^c[f+4>>2];c[j>>2]=C;c[e+4>>2]=C;C=c[k>>2]^c[f+8>>2];c[k>>2]=C;c[e+8>>2]=C;C=c[l>>2]^c[f+12>>2];c[l>>2]=C;c[e+12>>2]=C}else{C=a[d>>0]^a[f>>0];a[d>>0]=C;a[e>>0]=C;C=a[m>>0]^a[f+1>>0];a[m>>0]=C;a[e+1>>0]=C;C=a[n>>0]^a[f+2>>0];a[n>>0]=C;a[e+2>>0]=C;C=a[o>>0]^a[f+3>>0];a[o>>0]=C;a[e+3>>0]=C;C=a[p>>0]^a[f+4>>0];a[p>>0]=C;a[e+4>>0]=C;C=a[q>>0]^a[f+5>>0];a[q>>0]=C;a[e+5>>0]=C;C=a[r>>0]^a[f+6>>0];a[r>>0]=C;a[e+6>>0]=C;C=a[s>>0]^a[f+7>>0];a[s>>0]=C;a[e+7>>0]=C;C=a[t>>0]^a[f+8>>0];a[t>>0]=C;a[e+8>>0]=C;C=a[u>>0]^a[f+9>>0];a[u>>0]=C;a[e+9>>0]=C;C=a[v>>0]^a[f+10>>0];a[v>>0]=C;a[e+10>>0]=C;C=a[w>>0]^a[f+11>>0];a[w>>0]=C;a[e+11>>0]=C;C=a[x>>0]^a[f+12>>0];a[x>>0]=C;a[e+12>>0]=C;C=a[y>>0]^a[f+13>>0];a[y>>0]=C;a[e+13>>0]=C;C=a[z>>0]^a[f+14>>0];a[z>>0]=C;a[e+14>>0]=C;C=a[A>>0]^a[f+15>>0];a[A>>0]=C;a[e+15>>0]=C}h=h+-1|0;if(!h)break;else{f=f+16|0;e=e+16|0}}if(!g)return;Te(g+16|0);return}function li(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;i=c[b+496>>2]|0;if(i|0)vb[i&3]();C=c[b+488>>2]|0;if(!g)return;if(!h){k=(g<<4)+-16|0;i=d;j=e;h=g;while(1){if(!((f|j|i)&3)){c[j>>2]=c[i>>2]^c[f>>2];c[j+4>>2]=c[i+4>>2]^c[f+4>>2];c[j+8>>2]=c[i+8>>2]^c[f+8>>2];c[j+12>>2]=c[i+12>>2]^c[f+12>>2]}else{a[j>>0]=a[i>>0]^a[f>>0];a[j+1>>0]=a[i+1>>0]^a[f+1>>0];a[j+2>>0]=a[i+2>>0]^a[f+2>>0];a[j+3>>0]=a[i+3>>0]^a[f+3>>0];a[j+4>>0]=a[i+4>>0]^a[f+4>>0];a[j+5>>0]=a[i+5>>0]^a[f+5>>0];a[j+6>>0]=a[i+6>>0]^a[f+6>>0];a[j+7>>0]=a[i+7>>0]^a[f+7>>0];a[j+8>>0]=a[i+8>>0]^a[f+8>>0];a[j+9>>0]=a[i+9>>0]^a[f+9>>0];a[j+10>>0]=a[i+10>>0]^a[f+10>>0];a[j+11>>0]=a[i+11>>0]^a[f+11>>0];a[j+12>>0]=a[i+12>>0]^a[f+12>>0];a[j+13>>0]=a[i+13>>0]^a[f+13>>0];a[j+14>>0]=a[i+14>>0]^a[f+14>>0];a[j+15>>0]=a[i+15>>0]^a[f+15>>0]}i=pb[C&63](b,j,j)|0;h=h+-1|0;if(!h)break;else{i=j;f=f+16|0;j=j+16|0}}e=e+k|0}else{j=e;k=e+4|0;l=e+8|0;m=e+12|0;n=e+1|0;o=e+2|0;p=e+3|0;q=e+4|0;r=e+5|0;s=e+6|0;t=e+7|0;u=e+8|0;v=e+9|0;w=e+10|0;x=e+11|0;y=e+12|0;z=e+13|0;A=e+14|0;B=e+15|0;i=d;h=g;while(1){if(!((f|j|i)&3)){c[e>>2]=c[i>>2]^c[f>>2];c[k>>2]=c[i+4>>2]^c[f+4>>2];c[l>>2]=c[i+8>>2]^c[f+8>>2];c[m>>2]=c[i+12>>2]^c[f+12>>2]}else{a[e>>0]=a[i>>0]^a[f>>0];a[n>>0]=a[i+1>>0]^a[f+1>>0];a[o>>0]=a[i+2>>0]^a[f+2>>0];a[p>>0]=a[i+3>>0]^a[f+3>>0];a[q>>0]=a[i+4>>0]^a[f+4>>0];a[r>>0]=a[i+5>>0]^a[f+5>>0];a[s>>0]=a[i+6>>0]^a[f+6>>0];a[t>>0]=a[i+7>>0]^a[f+7>>0];a[u>>0]=a[i+8>>0]^a[f+8>>0];a[v>>0]=a[i+9>>0]^a[f+9>>0];a[w>>0]=a[i+10>>0]^a[f+10>>0];a[x>>0]=a[i+11>>0]^a[f+11>>0];a[y>>0]=a[i+12>>0]^a[f+12>>0];a[z>>0]=a[i+13>>0]^a[f+13>>0];a[A>>0]=a[i+14>>0]^a[f+14>>0];a[B>>0]=a[i+15>>0]^a[f+15>>0]}i=pb[C&63](b,e,e)|0;h=h+-1|0;if(!h)break;else{i=e;f=f+16|0}}}do if((e|0)!=(d|0))if(!((e|d)&3)){c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];break}else{a[d>>0]=a[e>>0]|0;a[d+1>>0]=a[e+1>>0]|0;a[d+2>>0]=a[e+2>>0]|0;a[d+3>>0]=a[e+3>>0]|0;a[d+4>>0]=a[e+4>>0]|0;a[d+5>>0]=a[e+5>>0]|0;a[d+6>>0]=a[e+6>>0]|0;a[d+7>>0]=a[e+7>>0]|0;a[d+8>>0]=a[e+8>>0]|0;a[d+9>>0]=a[e+9>>0]|0;a[d+10>>0]=a[e+10>>0]|0;a[d+11>>0]=a[e+11>>0]|0;a[d+12>>0]=a[e+12>>0]|0;a[d+13>>0]=a[e+13>>0]|0;a[d+14>>0]=a[e+14>>0]|0;a[d+15>>0]=a[e+15>>0]|0;break}while(0);if(!i)return;Te(i+16|0);return} +function Mk(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0;fa=l;l=l+208|0;if((l|0)>=(m|0))$(208);U=fa+136|0;T=fa+72|0;R=fa+40|0;H=fa+20|0;I=fa;v=c[e+4>>2]|0;V=c[f+4>>2]|0;r=V<<1;W=c[f+8>>2]|0;g=v<<5;if((g|0)<=512)if((g|0)<=256)if((g|0)>128)D=3;else D=(g|0)>64?2:1;else D=4;else D=5;u=c[e+12>>2]&1;S=(u|0)!=0;s=c[f+12>>2]&1;q=(s|0)!=0;if(!b)k=0;else k=(c[b+12>>2]&1|0)!=0;n=k&1;Z=a+16|0;g=c[Z>>2]|0;o=c[e+16>>2]|0;if(!V)Ve();if(!v){if((V|0)==1){ea=(c[c[f+16>>2]>>2]|0)!=1;c[a+4>>2]=ea&1;if(ea)G=13}else{c[a+4>>2]=1;G=13}if((G|0)==13){if((c[a>>2]|0)<1){ql(a,1);g=c[Z>>2]|0}c[g>>2]=1}c[a+8>>2]=0;l=fa;return}X=q?V:0;Y=ml(V,s)|0;f=c[f+16>>2]|0;Q=c[f+(V+-1<<2)>>2]|0;P=Q>>>0<65536?(Q>>>0<256?0:8):Q>>>0<16777216?16:24;P=32-(d[45555+(Q>>>P)>>0]|0)-P|0;Q=(P|0)!=0;if(!Q){if((V|0)>0){e=0;do{c[Y+(e<<2)>>2]=c[f+(e<<2)>>2];e=e+1|0}while((e|0)!=(V|0))}}else _k(Y,f,V,P)|0;i=c[b+4>>2]|0;p=c[b+8>>2]|0;a:do if((i|0)>(V|0)){j=i+1|0;h=k?j:0;j=ml(j,n)|0;if((i|0)>0){f=c[b+16>>2]|0;e=0;do{c[j+(e<<2)>>2]=c[f+(e<<2)>>2];e=e+1|0}while((e|0)!=(i|0))}Yk(j+(V<<2)|0,0,j,i,Y,V)|0;i=V;while(1){if((i|0)<=0){f=j;b=j;e=i;G=29;break a}e=i+-1|0;if(!(c[j+(e<<2)>>2]|0))i=e;else{f=j;b=j;G=31;break}}}else{f=c[b+16>>2]|0;b=0;h=0;e=i;G=29}while(0);if((G|0)==29)if(!e){c[a+4>>2]=0;c[a+8>>2]=0;_=0;aa=0;ba=0;ca=0;da=b;ea=h}else{i=e;G=31}do if((G|0)==31){if((g|0)==(f|0)){if(b|0)Ie(45811,45822,515,45832);b=k?i:0;f=ml(i,n)|0;if((i|0)>0){e=0;do{c[f+(e<<2)>>2]=c[g+(e<<2)>>2];e=e+1|0}while((e|0)!=(i|0));t=f;O=f;N=b}else{t=f;O=f;N=b}}else{t=f;O=b;N=h}if((g|0)==(o|0)){b=S?v:0;f=ml(v,u)|0;if((v|0)>0){e=0;do{c[f+(e<<2)>>2]=c[g+(e<<2)>>2];e=e+1|0}while((e|0)!=(v|0));z=f;M=f;L=b}else{z=f;M=f;L=b}}else{z=o;M=0;L=0}if((c[a>>2]|0)<(r|0)){ql(a,r);g=c[Z>>2]|0}J=r+2|0;K=q?J:0;J=ml(J,s)|0;c[R>>2]=0;c[R+4>>2]=0;c[R+8>>2]=0;c[R+12>>2]=0;c[R+16>>2]=0;c[R+20>>2]=0;c[R+24>>2]=0;F=(p|0)!=0&(c[z>>2]&1|0)!=0;if(D>>>0>1){if((i|0)<16)el(J,t,i,t,i)|0;else dl(J,t,i,t,i,R);e=i<<1;if((e|0)>(V|0)){Yk(J+(V<<2)|0,0,J,e,Y,V)|0;e=V}}else e=0;b=ml(i,u)|0;c[U>>2]=b;c[T>>2]=i;p=(i|0)>0;if(p){f=0;do{c[b+(f<<2)>>2]=c[t+(f<<2)>>2];f=f+1|0}while((f|0)!=(i|0))}q=D+-1|0;E=1<1){n=(e|0)<16;o=g+(V<<2)|0;k=1;h=i;f=i;do{if((e|0)<(f|0)){if(n)el(g,b,f,J,e)|0;else dl(g,b,f,J,e,R);f=f+e|0;if((f|0)>(V|0)){Yk(o,0,g,f,Y,V)|0;f=V}}else{if((f|0)<16)el(g,J,e,b,f)|0;else dl(g,J,e,b,f,R);f=f+e|0;if((f|0)>(V|0)){Yk(o,0,g,f,Y,V)|0;f=V}}b=ml(f,u)|0;c[U+(k<<2)>>2]=b;c[T+(k<<2)>>2]=f;h=(h|0)<(f|0)?f:h;if((f|0)>0){j=0;do{c[b+(j<<2)>>2]=c[g+(j<<2)>>2];j=j+1|0}while((j|0)!=(f|0))}k=k+1|0}while((k|0)!=(E|0));C=h}else C=i;B=ml(C,u)|0;if((C|0)>0)Yq(B|0,0,C<<2|0)|0;j=v+-1|0;if((D|0)!=1)if((V|0)>0){Yq(g|0,0,V<<2|0)|0;e=V}else e=V;else e=i;if(p){f=0;do{c[g+(f<<2)>>2]=c[t+(f<<2)>>2];f=f+1|0}while((f|0)!=(i|0))}b=c[z+(j<<2)>>2]|0;i=b>>>0<65536?(b>>>0<256?0:8):b>>>0<16777216?16:24;i=32-(d[45555+(b>>>i)>>0]|0)-i|0;y=32-D|0;A=(q|0)==31;q=H+4|0;r=I+4|0;s=I+8|0;t=H+8|0;u=I+12|0;v=H+12|0;w=H+16|0;x=I+16|0;b=b<>2]|0;if(!b){i=32;b=j}else{i=32;break}}}p=b>>>0<65536?(b>>>0<256?0:8):b>>>0<16777216?16:24;p=32-p-(d[45555+(b>>>p)>>0]|0)|0;b=b<>2]|0;i=n+y|0;k=j>>>i|b>>>y;b=j<>>y;b=b<>>0<65536?(n>>>0<256?0:8):n>>>0<16777216?16:24;f=(d[45555+(n>>>f)>>0]|0)+-1+f|0;n=k>>>f>>>1;j=p+D-f|0;if(!j)k=h;else while(1){if((e|0)<16)el(h,g,e,g,e)|0;else dl(h,g,e,g,e,R);e=e<<1;if((e|0)>(V|0)){Yk(h+(V<<2)|0,0,h,e,Y,V)|0;e=V}j=j+-1|0;if(!j){k=g;g=h;break}else{p=g;g=h;h=p}}do if(A){h=0;G=90}else{j=0;h=0;do{p=c[T+(j<<2)>>2]|0;c[q>>2]=p;c[H>>2]=p;c[r>>2]=p;c[I>>2]=p;c[s>>2]=0;c[t>>2]=0;c[u>>2]=0;c[v>>2]=0;c[w>>2]=B;c[x>>2]=c[U+(j<<2)>>2];ga=(j|0)==(n|0);Dl(H,I,ga&1)|0;h=(ga?p:0)|h;j=j+1|0}while((j|0)<(E|0));if((h|0)<16){G=90;break}dl(k,g,e,B,h,R)}while(0);if((G|0)==90){G=0;el(k,g,e,B,h)|0}e=h+e|0;if((e|0)<=(V|0)){h=g;g=k;j=o;continue}Yk(k+(V<<2)|0,0,k,e,Y,V)|0;h=g;g=k;j=o;e=V}if((G|0)==94){b=b>>>(32-n|0);if(!n){u=b;b=0;f=p}else{u=b&0-b;ga=u>>>0<65536?(u>>>0<256?0:8):u>>>0<16777216?16:24;ga=ga+-1+(d[45555+(u>>>ga)>>0]|0)|0;u=b>>>ga;b=ga;f=i+f-ga|0}}if(!f)t=h;else while(1){f=f+-1|0;if((e|0)<16)el(h,g,e,g,e)|0;else dl(h,g,e,g,e,R);e=e<<1;if((e|0)>(V|0)){Yk(h+(V<<2)|0,0,h,e,Y,V)|0;e=V}if(!f){t=g;g=h;break}else{ga=g;g=h;h=ga}}do if(u){do if(A){f=0;G=108}else{j=H+4|0;k=I+4|0;n=I+8|0;o=H+8|0;p=I+12|0;q=H+12|0;r=H+16|0;s=I+16|0;i=u>>>1;h=0;f=0;do{ga=c[T+(h<<2)>>2]|0;c[j>>2]=ga;c[H>>2]=ga;c[k>>2]=ga;c[I>>2]=ga;c[n>>2]=0;c[o>>2]=0;c[p>>2]=0;c[q>>2]=0;c[r>>2]=B;c[s>>2]=c[U+(h<<2)>>2];D=(h|0)==(i|0);Dl(H,I,D&1)|0;f=(D?ga:0)|f;h=h+1|0}while((h|0)<(E|0));if((f|0)<16){G=108;break}dl(t,g,e,B,f,R)}while(0);if((G|0)==108)el(t,g,e,B,f)|0;e=f+e|0;if((e|0)>(V|0)){Yk(t+(V<<2)|0,0,t,e,Y,V)|0;e=V}if(!b){g=t;break}else f=t;while(1){if((e|0)<16)el(g,f,e,f,e)|0;else dl(g,f,e,f,e,R);e=e<<1;if((e|0)>(V|0)){Yk(g+(V<<2)|0,0,g,e,Y,V)|0;e=V}b=b+-1|0;if(!b)break;else{ga=f;f=g;g=ga}}}while(0);b=c[Z>>2]|0;do if(Q){f=_k(b,g,e,P)|0;g=c[Z>>2]|0;if(!f)break;c[g+(e<<2)>>2]=f;e=e+1|0}else{if((b|0)==(g|0))break;if((e|0)>0)f=0;else{g=b;break}do{c[b+(f<<2)>>2]=c[g+(f<<2)>>2];f=f+1|0}while((f|0)!=(e|0));g=b}while(0);if((e|0)>=(V|0)){Yk(g+(V<<2)|0,0,g,e,Y,V)|0;e=V}if(Q)gl(g,g,e,P)|0;while(1){if((e|0)<=0)break;f=e+-1|0;if(!(c[g+(f<<2)>>2]|0))e=f;else break}fl(R);if(!A)if(S){f=0;do{ol(c[U+(f<<2)>>2]|0,c[T+(f<<2)>>2]|0);f=f+1|0}while((f|0)<(E|0))}else{f=0;do{ol(c[U+(f<<2)>>2]|0,0);f=f+1|0}while((f|0)<(E|0))}ol(B,S?C:0);c:do if(F&(e|0)!=0){if(Q)gl(Y,Y,V,P)|0;f=hl(g,Y,g,e)|0;b=V-e|0;d:do if(!b)e=V;else{T=g+(e<<2)|0;ga=Y+(e<<2)|0;e=ga+4|0;ga=c[ga>>2]|0;U=ga-f|0;f=T+4|0;c[T>>2]=U;if(U>>>0>ga>>>0)while(1){b=b+-1|0;if(!b){e=V;break d}i=e+4|0;ga=c[e>>2]|0;h=f+4|0;c[f>>2]=ga+-1;if(!ga){e=i;f=h}else{f=h;break}}else i=e;if((f|0)==(i|0)){e=V;break}h=b+-1|0;if((b|0)>1)e=0;else{e=V;break}do{c[f+(e<<2)>>2]=c[i+(e<<2)>>2];e=e+1|0}while((e|0)!=(h|0));e=V}while(0);while(1){if((e|0)<=0){f=W;break c}f=e+-1|0;if(!(c[g+(f<<2)>>2]|0))e=f;else{f=W;break}}}else f=0;while(0);if((c[Z>>2]|0)==(g|0)){c[a+4>>2]=e;c[a+8>>2]=f;_=J;aa=K;ba=M;ca=L;da=O;ea=N;break}else Ie(45847,45822,786,45832)}while(0);if(Y|0)ol(Y,X);if(da|0)ol(da,ea);if(ba|0)ol(ba,ca);if(!_){l=fa;return}ol(_,aa);l=fa;return}function Nk(a){a=a|0;var b=0,e=0,f=0,g=0,h=0;g=c[a+4>>2]|0;if(!g){h=0;return h|0}f=c[a+16>>2]|0;a=0;e=0;while(1){b=c[f+(e<<2)>>2]|0;if(b|0)break;a=a+32|0;e=e+1|0;if(e>>>0>=g>>>0){h=6;break}}if((h|0)==6)return a|0;g=b&0-b;h=g>>>0<65536?(g>>>0<256?0:8):g>>>0<16777216?16:24;h=a+-1+h+(d[45555+(g>>>h)>>0]|0)|0;return h|0}function Ok(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Pk(a,b,0,c,d,0)|0}function Pk(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0;if(g|0)c[g>>2]=c[b+8>>2];k=b+4|0;i=c[k>>2]|0;g=i<<2;c[f>>2]=g;g=(i|0)==0?1:g;i=(e|0)<0;j=0-e|0;g=(g>>>0>>0?d:g)+(i?j:e)|0;if((h|0)==0?(c[b+12>>2]&1|0)==0:0)l=_e(g)|0;else l=$e(g)|0;if(!l){f=0;return f|0}h=i?l+j|0:l;g=c[k>>2]|0;if((g|0)>0){i=b+16|0;e=h;while(1){b=g;g=g+-1|0;k=c[(c[i>>2]|0)+(g<<2)>>2]|0;a[e>>0]=k>>>24;a[e+1>>0]=k>>>16;a[e+2>>0]=k>>>8;a[e+3>>0]=k;if((b|0)<=1)break;else e=e+4|0}}g=c[f>>2]|0;if(d|0){i=g>>>1;if(i|0){j=g+-1|0;e=0;do{m=h+e|0;k=a[m>>0]|0;b=h+(j-e)|0;a[m>>0]=a[b>>0]|0;a[b>>0]=k;e=e+1|0}while((e|0)!=(i|0))}if(g>>>0>>0){Yq(h+g|0,0,d-g|0)|0;g=d}c[f>>2]=g;m=l;return m|0}if(!g){m=l;return m|0}else e=h;while(1){if(a[e>>0]|0)break;e=e+1|0;g=g+-1|0;c[f>>2]=g;if(!g){g=0;break}}if((e|0)==(h|0)){m=l;return m|0}dr(h|0,e|0,g|0)|0;m=l;return m|0}function Qk(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Pk(a,b,c,d,e,0)|0}function Rk(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;if(a|0?c[a+12>>2]&16|0:0){sl();return}n=(e+3|0)>>>2;if((c[a>>2]|0)<(n|0))ql(a,n);c[a+8>>2]=f;m=e+-1|0;g=b+m|0;if((m|0)>3){l=e+-5|0;f=l>>>2;m=f<<2;f=f+1|0;l=l-m|0;k=c[a+16>>2]|0;h=0;j=e;while(1){i=j+-4|0;c[k+(h<<2)>>2]=(d[b+(j+-2)>>0]|0)<<8|(d[g>>0]|0)|(d[b+(j+-3)>>0]|0)<<16|(d[b+i>>0]|0)<<24;h=h+1|0;if((h|0)==(f|0))break;else{g=b+(j+-5)|0;j=i}}h=b+l|0;e=e+-4-m|0}else{f=0;h=g}if((e|0)>0){g=h+-1|0;e=d[h>>0]|0;if(g>>>0>=b>>>0){e=(d[g>>0]|0)<<8|e;g=h+-2|0}if(g>>>0>=b>>>0){e=(d[g>>0]|0)<<16|e;g=g+-1|0}if(g>>>0>=b>>>0)e=(d[g>>0]|0)<<24|e;c[(c[a+16>>2]|0)+(f<<2)>>2]=e;f=f+1|0}c[a+4>>2]=f;if((f|0)==(n|0))return;else Ie(45860,45872,377,45883)}function Sk(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(!f)m=0;else m=(af(f)|0)!=0;j=(e|0)==3;o=j?0:g;switch(e|0){case 1:{e=(o+3|0)>>>2;if(m)k=nl(e)|0;else k=ll(e)|0;if(o|0?(Rk(k,f,o,0),f=a[f>>0]|0,l=k+8|0,c[l>>2]=(f&255)>>>7&255,f<<24>>24<0):0){g=lk(k)|0;if(!(c[k+12>>2]&16)){kk(k);i=c[k+16>>2]|0;j=c[k+4>>2]|0;if(j|0){e=0;do{f=i+(e<<2)|0;c[f>>2]=~c[f>>2];e=e+1|0}while((e|0)!=(j|0))}c[l>>2]=0;pk(k,g+-1|0)}else sl();ek(k,k,1);c[l>>2]=1}if(!b)tl(k);else{kk(k);c[b>>2]=k}if(!h){b=0;return b|0}c[h>>2]=o;b=0;return b|0}case 5:{e=(o+3|0)>>>2;if(m)e=nl(e)|0;else e=ll(e)|0;if(o|0)Rk(e,f,o,0);if(!b)tl(e);else{kk(e);c[b>>2]=e}if(!h){b=0;return b|0}c[h>>2]=o;b=0;return b|0}case 2:{a:do if(o>>>0>=2?(i=d[f>>0]<<8|d[f+1>>0],i>>>0<=16384):0){i=(i+7|0)>>>3;k=(i+3|0)>>>2;if(m)e=nl(k)|0;else e=ll(k)|0;c[e+4>>2]=k;c[e+8>>2]=0;if(!k)g=2;else{m=e+16|0;g=2;j=f+2|0;i=0-i&3;b:while(1){l=0;do{g=g+1|0;if(g>>>0>o>>>0)break b;f=j;j=j+1|0;l=d[f>>0]|l<<8;i=i+1|0}while((i|0)<4);f=k;k=k+-1|0;c[(c[m>>2]|0)+(k<<2)>>2]=l;if((f|0)<=1)break a;else i=0}tl(e);e=0}}else{e=0;g=0}while(0);if(h|0)c[h>>2]=g;g=(e|0)!=0;if(!((b|0)!=0&g))if(g){tl(e);e=0}else e=0;else{kk(e);c[b>>2]=e}b=e|0?0:65;return b|0}default:{if(j){if((o+-1|0)>>>0<3){b=66;return b|0}i=d[f+1>>0]<<16|d[f>>0]<<24|d[f+2>>0]<<8|d[f+3>>0];g=f+4|0;f=o+-4|0;if(o|0?(f|0)!=0&i>>>0>f>>>0:0){b=67;return b|0}l=i+4|0;e=(i+3|0)>>>2;if(m)k=nl(e)|0;else k=ll(e)|0;if(i|0?(Rk(k,g,i,0),f=a[g>>0]|0,n=k+8|0,c[n>>2]=(f&255)>>>7&255,f<<24>>24<0):0){g=lk(k)|0;if(!(c[k+12>>2]&16)){kk(k);i=c[k+16>>2]|0;j=c[k+4>>2]|0;if(j|0){e=0;do{f=i+(e<<2)|0;c[f>>2]=~c[f>>2];e=e+1|0}while((e|0)!=(j|0))}c[n>>2]=0;pk(k,g+-1|0)}else sl();ek(k,k,1);c[n>>2]=1}if(h|0)c[h>>2]=l;if(!b){tl(k);b=0;return b|0}else{kk(k);c[b>>2]=k;b=0;return b|0}}if(!((e|0)==4&(g|0)==0)){b=45;return b|0}if(m)p=nl(0)|0;else p=ll(0)|0;g=(a[f>>0]|0)==45;e=g?f+1|0:f;if((a[e>>0]|0)==48)e=(a[e+1>>0]|0)==120?e+2|0:e;k=Fo(e)|0;j=((k<<2)+7|0)>>>3;i=(j+3|0)>>>2;if((c[p>>2]|0)>>>0>>0)ql(p,i);c[p+4>>2]=i;c[p+8>>2]=g&1;c:do if(i|0){o=p+16|0;j=0-j&3;g=k&1;d:while(1){n=0;while(1){if(!g){g=a[e>>0]|0;if(!(g<<24>>24)){e=82;break d}else{k=g<<24>>24;g=e+1|0}}else{k=48;g=e}e=g+1|0;l=a[g>>0]|0;m=l<<24>>24;if(!(l<<24>>24)){e=84;break d}g=k+-48|0;do if(g>>>0>=10){if((k+-97|0)>>>0<6){g=k+-87|0;break}if((k+-65|0)>>>0>=6){e=90;break d}g=k+-55|0}while(0);k=g<<4;do if((l+-48&255)<10)g=m+-48|0;else{if((l+-97&255)<6){g=m+-87|0;break}if((l+-65&255)>=6){e=97;break d}g=m+-55|0}while(0);n=k|n<<8|g;j=j+1|0;if((j|0)>=4)break;else g=0}m=i;i=i+-1|0;c[(c[o>>2]|0)+(i<<2)>>2]=n;if((m|0)<=1)break c;else{j=0;g=0}}if((e|0)==82)rl(p);else if((e|0)==84)rl(p);else if((e|0)==90)rl(p);else if((e|0)==97)rl(p);tl(p);b=65;return b|0}while(0);if(!b)tl(p);else{kk(p);c[b>>2]=p}if(!h){b=0;return b|0}c[h>>2]=Fo(f)|0;b=0;return b|0}}return 0}function Tk(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;q=l;l=l+16|0;if((l|0)>=(m|0))$(16);i=lk(h)|0;p=(g|0)==0?q:g;if((c[h+8>>2]|0)!=0?(vk(h,0)|0)!=0:0)o=1;else o=0;c[p>>2]=0;switch(b|0){case 1:{i=h+4|0;j=c[i>>2]|0;b=j<<2;j=(j|0)==0;g=j?1:b;if(!(c[h+12>>2]&1))k=_e(g)|0;else k=$e(g)|0;if(!k){p=Sn()|0;l=q;return p|0}g=c[i>>2]|0;if((g|0)>0){h=h+16|0;i=k;while(1){r=g;g=g+-1|0;s=c[(c[h>>2]|0)+(g<<2)>>2]|0;a[i>>0]=s>>>24;a[i+1>>0]=s>>>16;a[i+2>>0]=s>>>8;a[i+3>>0]=s;if((r|0)<=1)break;else i=i+4|0}}if(!j){g=k;while(1){if(a[g>>0]|0)break;g=g+1|0;b=b+-1|0;if(!b){b=0;break}}if((g|0)==(k|0))i=b;else{dr(k|0,g|0,b|0)|0;i=b}}else i=0;do if(!o)if(!i)if(!e){g=0;break}else{b=0;g=0;n=26;break}else{g=(d[k>>0]|0)>>>7&255;b=g;n=23;break}else{Uk(k,i);g=a[k>>0]|0;b=g<<24>>24<0?0:2;g=(g&255)>>>7&255^1;n=23}while(0);do if((n|0)==23){g=g+i|0;i=(e|0)!=0;if(!(i&g>>>0>f>>>0))if(i){n=26;break}else break;cf(k);s=66;l=q;return s|0}while(0);if((n|0)==26){switch(b&3){case 1:{a[e>>0]=0;e=e+1|0;break}case 0:break;default:{a[e>>0]=-1;e=e+1|0}}cr(e|0,k|0,g-((b|0)!=0&1)|0)|0}cf(k);c[p>>2]=g;s=0;l=q;return s|0}case 5:{g=(i+7|0)>>>3;b=(e|0)!=0;if(b&g>>>0>f>>>0){s=66;l=q;return s|0}if(b){i=h+4|0;j=c[i>>2]|0;g=j<<2;j=(j|0)==0;b=j?1:g;if(!(c[h+12>>2]&1))k=_e(b)|0;else k=$e(b)|0;if(!k){s=Sn()|0;l=q;return s|0}b=c[i>>2]|0;if((b|0)>0){h=h+16|0;i=k;while(1){s=b;b=b+-1|0;r=c[(c[h>>2]|0)+(b<<2)>>2]|0;a[i>>0]=r>>>24;a[i+1>>0]=r>>>16;a[i+2>>0]=r>>>8;a[i+3>>0]=r;if((s|0)<=1)break;else i=i+4|0}}if(!j){b=k;while(1){if(a[b>>0]|0)break;b=b+1|0;g=g+-1|0;if(!g){g=0;break}}if((b|0)!=(k|0))dr(k|0,b|0,g|0)|0}else g=0;cr(e|0,k|0,g|0)|0;cf(k)}c[p>>2]=g;s=0;l=q;return s|0}case 2:{g=(i+7|0)>>>3;if(o|0){s=45;l=q;return s|0}b=(e|0)!=0;if(b&(g+2|0)>>>0>f>>>0){s=66;l=q;return s|0}if(b){a[e>>0]=i>>>8;a[e+1>>0]=i;i=h+4|0;j=c[i>>2]|0;g=j<<2;j=(j|0)==0;b=j?1:g;if(!(c[h+12>>2]&1))k=_e(b)|0;else k=$e(b)|0;if(!k){s=Sn()|0;l=q;return s|0}b=c[i>>2]|0;if((b|0)>0){h=h+16|0;i=k;while(1){s=b;b=b+-1|0;r=c[(c[h>>2]|0)+(b<<2)>>2]|0;a[i>>0]=r>>>24;a[i+1>>0]=r>>>16;a[i+2>>0]=r>>>8;a[i+3>>0]=r;if((s|0)<=1)break;else i=i+4|0}}if(!j){b=k;while(1){if(a[b>>0]|0)break;b=b+1|0;g=g+-1|0;if(!g){g=0;break}}if((b|0)!=(k|0))dr(k|0,b|0,g|0)|0}else g=0;cr(e+2|0,k|0,g|0)|0;cf(k)}c[p>>2]=g+2;s=0;l=q;return s|0}case 3:{i=h+4|0;j=c[i>>2]|0;b=j<<2;j=(j|0)==0;g=j?1:b;if(!(c[h+12>>2]&1))k=_e(g)|0;else k=$e(g)|0;if(!k){s=Sn()|0;l=q;return s|0}g=c[i>>2]|0;if((g|0)>0){h=h+16|0;i=k;while(1){s=g;g=g+-1|0;r=c[(c[h>>2]|0)+(g<<2)>>2]|0;a[i>>0]=r>>>24;a[i+1>>0]=r>>>16;a[i+2>>0]=r>>>8;a[i+3>>0]=r;if((s|0)<=1)break;else i=i+4|0}}if(!j){g=k;while(1){if(a[g>>0]|0)break;g=g+1|0;b=b+-1|0;if(!b){b=0;break}}if((g|0)==(k|0))g=b;else{dr(k|0,g|0,b|0)|0;g=b}}else g=0;if(!o)if(!g){h=0;b=0}else{b=(d[k>>0]|0)>>>7&255;h=b;b=b+g|0}else{Uk(k,g);b=a[k>>0]|0;h=b<<24>>24<0?0:2;b=((b&255)>>>7&255^1)+g|0}i=b+4|0;if(e|0){if(i>>>0>f>>>0){cf(k);s=66;l=q;return s|0}a[e>>0]=b>>>24;a[e+1>>0]=b>>>16;a[e+2>>0]=b>>>8;g=e+4|0;a[e+3>>0]=b;switch(h&3){case 1:{a[g>>0]=0;g=e+5|0;break}case 0:break;default:{a[g>>0]=-1;g=e+5|0}}cr(g|0,k|0,b-((h|0)!=0&1)|0)|0}cf(k);c[p>>2]=i;s=0;l=q;return s|0}case 4:{i=h+4|0;j=c[i>>2]|0;b=j<<2;j=(j|0)==0;g=j?1:b;if(!(c[h+12>>2]&1))k=_e(g)|0;else k=$e(g)|0;if(!k){s=Sn()|0;l=q;return s|0}g=c[i>>2]|0;if((g|0)>0){h=h+16|0;i=k;while(1){s=g;g=g+-1|0;r=c[(c[h>>2]|0)+(g<<2)>>2]|0;a[i>>0]=r>>>24;a[i+1>>0]=r>>>16;a[i+2>>0]=r>>>8;a[i+3>>0]=r;if((s|0)<=1)break;else i=i+4|0}}if(!j){g=k;while(1){if(a[g>>0]|0)break;g=g+1|0;b=b+-1|0;if(!b){b=0;break}}if((g|0)!=(k|0))dr(k|0,g|0,b|0)|0;if(b)if((a[k>>0]|0)<0){g=0;n=106}else{i=0;j=b;b=0}else{b=0;g=1;n=106}}else{b=0;g=1;n=106}if((n|0)==106){i=2;j=b;b=g}h=j<<1;g=(i+h|o)+1|0;if(e){if(g>>>0>f>>>0){cf(k);s=66;l=q;return s|0}if(!o)g=e;else{a[e>>0]=45;g=e+1|0}if(i){a[g>>0]=48;a[g+1>>0]=48;g=g+2|0}if(!b){b=0;i=g;while(1){f=a[k+b>>0]|0;s=f&255;r=s>>>4;a[i>>0]=(f&255)<160?r|48:r+55|0;s=s&15;a[i+1>>0]=s>>>0<10?s|48:s+55|0;b=b+1|0;if((b|0)==(j|0))break;else i=i+2|0}g=g+h|0}a[g>>0]=0;g=g+1-e|0}c[p>>2]=g;cf(k);s=0;l=q;return s|0}default:{s=45;l=q;return s|0}}return 0}function Uk(b,c){b=b|0;c=c|0;var e=0,f=0,g=0,h=0;while(1){e=c+-1|0;if((e|0)<=-1){h=21;break}g=b+e|0;f=a[g>>0]|0;if(!(f<<24>>24))c=e;else break}if((h|0)==21)return;e=f&255;do if(!(e&1)){if(e&2|0){a[g>>0]=e&252^254;break}if(e&4|0){a[g>>0]=e&248^252;break}if(e&8|0){a[g>>0]=e&240^248;break}if(e&16|0){a[g>>0]=e&224^240;break}if(e&32|0){a[g>>0]=e&192^224;break}if(!(e&64)){a[g>>0]=-128;break}else{a[g>>0]=e&128^192;break}}else a[g>>0]=(e|1)^254;while(0);c=c+-2|0;if((c|0)<=-1)return;while(1){h=b+c|0;a[h>>0]=(d[h>>0]|0)^255;if((c|0)>0)c=c+-1|0;else break}return}function Vk(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;i=(a|0)!=0;g=(b|0)!=0;if(!(i^g)){i=45;return i|0}if(i)c[a>>2]=0;f=lk(d)|0;if(c[d+8>>2]|0)vk(d,0)|0;h=(f+7|0)>>>3;if(h>>>0>e>>>0){i=67;return i|0}e=h>>>0>>0?e-h|0:0;f=e+h|0;if(!g){if(!(c[d+12>>2]&1))f=_e(f)|0;else f=$e(f)|0;if(!f){i=Sn()|0;return i|0}else b=f}if(e|0)Yq(b|0,0,e|0)|0;f=Tk(5,b+e|0,h,0,d)|0;if(f|0){cf(b);i=f;return i|0}if(!i){i=0;return i|0}c[a>>2]=b;i=0;return i|0}function Wk(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;g=b+(e<<2)|0;f=d+(e<<2)|0;a=a+(e<<2)|0;b=0-e|0;d=0;do{i=c[g+(b<<2)>>2]|0;h=(c[f+(b<<2)>>2]|0)+d|0;e=h+i|0;d=(e>>>0>>0&1)+(h>>>0>>0&1)|0;c[a+(b<<2)>>2]=e;b=b+1|0}while((b|0)!=0);return d|0}function Xk(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;if(!b){a=0;return a|0}k=e>>>0<65536?(e>>>0<256?0:8):e>>>0<16777216?16:24;k=(d[45555+(e>>>k)>>0]|0)+k|0;n=32-k|0;if(!n){g=b+-1|0;f=c[a+(g<<2)>>2]|0;n=f>>>0>>0;f=n?f:0;g=n?b+-2|0:g;if((g|0)<=-1){a=f;return a|0}j=e>>>16;k=e&65535;while(1){i=c[a+(g<<2)>>2]|0;h=S((f>>>0)/(j>>>0)|0,k)|0;f=((f>>>0)%(j>>>0)|0)<<16|i>>>16;b=f+e|0;if(f>>>0>>0)f=(b>>>0>=e>>>0&b>>>0>>0?e:0)+b|0;f=f-h|0;h=S((f>>>0)/(j>>>0)|0,k)|0;f=((f>>>0)%(j>>>0)|0)<<16|i&65535;b=f+e|0;if(f>>>0>>0)f=(b>>>0>=e>>>0&b>>>0>>0?e:0)+b|0;f=f-h|0;if((g|0)>0)g=g+-1|0;else break}return f|0}m=e<>2]|0;f=g>>>k;b=b+-2|0;l=m>>>16;e=m&65535;if((b|0)>-1)while(1){j=c[a+(b<<2)>>2]|0;h=S((f>>>0)/(l>>>0)|0,e)|0;i=j>>>k|g<>>16|((f>>>0)%(l>>>0)|0)<<16;g=f+m|0;if(f>>>0>>0)f=(g>>>0>=m>>>0&g>>>0>>0?m:0)+g|0;f=f-h|0;h=S((f>>>0)/(l>>>0)|0,e)|0;f=((f>>>0)%(l>>>0)|0)<<16|i&65535;g=f+m|0;if(f>>>0>>0)f=(g>>>0>=m>>>0&g>>>0>>0?m:0)+g|0;f=f-h|0;if((b|0)>0){b=b+-1|0;g=j}else{g=j;break}}b=S((f>>>0)/(l>>>0)|0,e)|0;h=g<>>0)%(l>>>0)|0)<<16|h>>>16;g=f+m|0;if(f>>>0>>0)f=(g>>>0>=m>>>0&g>>>0>>0?m:0)+g|0;f=f-b|0;b=S((f>>>0)/(l>>>0)|0,e)|0;f=((f>>>0)%(l>>>0)|0)<<16|h&65535;g=f+m|0;if(f>>>0>>0)f=(g>>>0>=m>>>0&g>>>0>>0?m:0)+g|0;a=(f-b|0)>>>n;return a|0}function Yk(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;switch(g|0){case 0:{Ve();break}case 1:{p=c[f>>2]|0;h=c[d+(e+-1<<2)>>2]|0;q=h>>>0

>>0;h=h-(q?0:p)|0;q=q&1^1;o=a+(b<<2)|0;i=e+-2|0;if((i|0)>-1){e=p>>>16;n=p&65535;while(1){j=(h>>>0)/(e>>>0)|0;k=S(j,n)|0;m=c[d+(i<<2)>>2]|0;h=m>>>16|((h>>>0)%(e>>>0)|0)<<16;if(h>>>0>>0){h=h+p|0;a=h>>>0>=p>>>0&h>>>0>>0;j=(a?-2:-1)+j|0;h=(a?p:0)+h|0}h=h-k|0;k=(h>>>0)/(e>>>0)|0;l=S(k,n)|0;h=m&65535|((h>>>0)%(e>>>0)|0)<<16;if(h>>>0>>0){h=h+p|0;a=h>>>0>=p>>>0&h>>>0>>0;k=(a?-2:-1)+k|0;h=(a?p:0)+h|0}h=h-l|0;c[o+(i<<2)>>2]=k|j<<16;if((i|0)>0)i=i+-1|0;else break}}e=o+(0-b<<2)|0;if((b|0)>0){n=p>>>16;o=p&65535;m=b;do{l=m;m=m+-1|0;i=(h>>>0)/(n>>>0)|0;j=S(i,o)|0;h=((h>>>0)%(n>>>0)|0)<<16;if(h>>>0>>0){h=h+p|0;b=h>>>0>=p>>>0&h>>>0>>0;i=(b?-2:-1)+i|0;h=(b?p:0)+h|0}h=h-j|0;j=(h>>>0)/(n>>>0)|0;k=S(j,o)|0;h=((h>>>0)%(n>>>0)|0)<<16;if(h>>>0>>0){h=h+p|0;b=h>>>0>=p>>>0&h>>>0>>0;j=(b?-2:-1)+j|0;h=(b?p:0)+h|0}h=h-k|0;c[e+(m<<2)>>2]=j|i<<16}while((l|0)>1)}c[d>>2]=h;b=q;return b|0}case 2:{j=d+(e+-2<<2)|0;w=c[f+4>>2]|0;u=c[f>>2]|0;v=0-u|0;i=c[j+4>>2]|0;h=c[j>>2]|0;if(i>>>0>=w>>>0?(k=h-u|0,!(i>>>0<=w>>>0&h>>>0>>0)):0){i=i-w+((k>>>0>h>>>0)<<31>>31)|0;h=k;t=1}else t=0;k=b+-3+e|0;if((k|0)>-1){s=u-((u|0)!=0&1)|0;p=w>>>16;q=w&65535;d=u&65535;r=u>>>16;while(1){if((k|0)<(b|0))c[j>>2]=0;else j=j+-4|0;if((i|0)==(w|0)){h=h+w|0;if(h>>>0>>0){i=c[j>>2]|0;f=i+u|0;c[a+(k<<2)>>2]=-1;i=h-u+(f>>>0>>0&1)|0;h=f}else{m=-1;l=s;i=v;o=34}}else{l=(i>>>0)/(p>>>0)|0;m=S(l,q)|0;i=((i>>>0)%(p>>>0)|0)<<16|h>>>16;if(i>>>0>>0){i=i+w|0;f=i>>>0>=w>>>0&i>>>0>>0;l=(f?-2:-1)+l|0;i=(f?w:0)+i|0}i=i-m|0;m=(i>>>0)/(p>>>0)|0;e=S(m,q)|0;i=((i>>>0)%(p>>>0)|0)<<16|h&65535;if(i>>>0>>0){i=i+w|0;f=i>>>0>=w>>>0&i>>>0>>0;h=(f?-2:-1)+m|0;i=(f?w:0)+i|0}else h=m;m=h|l<<16;g=h&65535;f=m>>>16;o=S(g,d)|0;g=S(g,r)|0;l=S(f,r)|0;f=(o>>>16)+g+(S(f,d)|0)|0;h=i-e|0;l=(f>>>0>>0?l+65536|0:l)+(f>>>16)|0;i=f<<16|o&65535;o=34}if((o|0)==34){o=0;n=c[j>>2]|0;while(1){if(l>>>0<=h>>>0?!(i>>>0>n>>>0&(l|0)==(h|0)):0)break;m=m+-1|0;e=i-u|0;l=l-(e>>>0>i>>>0&1)|0;h=h+w|0;if(h>>>0>>0){i=e;break}else i=e}c[a+(k<<2)>>2]=m;f=n-i|0;i=h-l+((f>>>0>n>>>0)<<31>>31)|0;h=f}if((k|0)>0)k=k+-1|0;else break}}c[j+4>>2]=i;c[j>>2]=h;b=t;return b|0}default:{m=d+(e-g<<2)|0;u=g+-1|0;v=c[f+(u<<2)>>2]|0;w=g+-2|0;x=c[f+(w<<2)>>2]|0;i=m+(u<<2)|0;j=c[i>>2]|0;a:do if(j>>>0>>0)h=0;else{b:do if(j>>>0<=v>>>0){h=u;do{if((h|0)<=0)break b;h=h+-1|0;k=c[m+(h<<2)>>2]|0;l=c[f+(h<<2)>>2]|0}while((k|0)==(l|0));if(k>>>0<=l>>>0){h=0;break a}}while(0);hl(m,m,f,g)|0;j=c[i>>2]|0;h=1}while(0);i=e+b-g|0;if((i|0)<=0){b=h;return b|0}q=v>>>16;d=v&65535;r=x&65535;s=x>>>16;t=(w|0)>-1;while(1){p=i;i=i+-1|0;if((p|0)>(b|0)){o=m+-4|0;n=c[o+(g<<2)>>2]|0}else{if(t){l=m+4|0;k=w;while(1){c[l+(k<<2)>>2]=c[m+(k<<2)>>2];if((k|0)>0)k=k+-1|0;else break}}c[m>>2]=0;n=j;o=m}c:do if((j|0)==(v|0))j=-1;else{k=(j>>>0)/(q>>>0)|0;l=S(k,d)|0;e=c[o+(u<<2)>>2]|0;j=e>>>16|((j>>>0)%(q>>>0)|0)<<16;if(j>>>0>>0){j=j+v|0;m=j>>>0>=v>>>0&j>>>0>>0;j=(m?v:0)+j|0;m=(m?-2:-1)+k|0}else m=k;k=j-l|0;j=(k>>>0)/(q>>>0)|0;l=S(j,d)|0;k=e&65535|((k>>>0)%(q>>>0)|0)<<16;if(k>>>0>>0){k=k+v|0;e=k>>>0>=v>>>0&k>>>0>>0;k=(e?v:0)+k|0;j=(e?-2:-1)+j|0}z=j|m<<16;A=j&65535;y=z>>>16;m=S(A,r)|0;A=S(A,s)|0;j=S(y,s)|0;y=(m>>>16)+A+(S(y,r)|0)|0;e=o+(w<<2)|0;k=k-l|0;l=(y>>>0>>0?j+65536|0:j)+(y>>>16)|0;j=z;m=y<<16|m&65535;while(1){if(l>>>0<=k>>>0){if((l|0)!=(k|0))break c;if(m>>>0<=(c[e>>2]|0)>>>0)break c}j=j+-1|0;k=k+v|0;if(k>>>0>>0)break c;l=l-(m>>>0>>0&1)|0;m=m-x|0}}while(0);if((n|0)!=(al(o,f,g,j)|0)){Wk(o,o,f,g)|0;j=j+-1|0}c[a+(i<<2)>>2]=j;if((p|0)<=1)break;else{m=o;j=c[o+(u<<2)>>2]|0}}return h|0}}return 0}function Zk(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if(!e){a=0;return a|0}n=f>>>0<65536?(f>>>0<256?0:8):f>>>0<16777216?16:24;n=(d[45555+(f>>>n)>>0]|0)+n|0;q=32-n|0;if(!q){h=e+-1|0;g=c[b+(h<<2)>>2]|0;if(g>>>0>>0){c[a+(h<<2)>>2]=0;h=e+-2|0}else g=0;if((h|0)<=-1){a=g;return a|0}l=f>>>16;m=f&65535;while(1){j=c[b+(h<<2)>>2]|0;e=(g>>>0)/(l>>>0)|0;i=S(e,m)|0;g=((g>>>0)%(l>>>0)|0)<<16|j>>>16;if(g>>>0>>0){g=g+f|0;k=g>>>0>=f>>>0&g>>>0>>0;g=(k?f:0)+g|0;k=(k?-2:-1)+e|0}else k=e;g=g-i|0;e=(g>>>0)/(l>>>0)|0;i=S(e,m)|0;g=((g>>>0)%(l>>>0)|0)<<16|j&65535;if(g>>>0>>0){g=g+f|0;q=g>>>0>=f>>>0&g>>>0>>0;g=(q?f:0)+g|0;e=(q?-2:-1)+e|0}g=g-i|0;c[a+(h<<2)>>2]=e|k<<16;if((h|0)>0)h=h+-1|0;else break}return g|0}p=f<>2]|0;g=i>>>n;h=e+-2|0;o=p>>>16;f=p&65535;if((h|0)>-1)while(1){m=c[b+(h<<2)>>2]|0;e=(g>>>0)/(o>>>0)|0;j=S(e,f)|0;k=m>>>n|i<>>16|((g>>>0)%(o>>>0)|0)<<16;if(g>>>0>>0){g=g+p|0;l=g>>>0>=p>>>0&g>>>0>>0;g=(l?p:0)+g|0;l=(l?-2:-1)+e|0}else l=e;g=g-j|0;e=(g>>>0)/(o>>>0)|0;i=S(e,f)|0;g=((g>>>0)%(o>>>0)|0)<<16|k&65535;if(g>>>0>>0){g=g+p|0;k=g>>>0>=p>>>0&g>>>0>>0;g=(k?p:0)+g|0;e=(k?-2:-1)+e|0}g=g-i|0;c[a+(h+1<<2)>>2]=e|l<<16;if((h|0)>0){h=h+-1|0;i=m}else{h=m;break}}else h=i;e=(g>>>0)/(o>>>0)|0;i=S(e,f)|0;h=h<>>0)%(o>>>0)|0)<<16|h>>>16;if(g>>>0>>0){g=g+p|0;j=g>>>0>=p>>>0&g>>>0>>0;g=(j?p:0)+g|0;j=(j?-2:-1)+e|0}else j=e;b=g-i|0;g=(b>>>0)/(o>>>0)|0;e=S(g,f)|0;h=((b>>>0)%(o>>>0)|0)<<16|h&65535;if(h>>>0>>0){h=h+p|0;b=h>>>0>=p>>>0&h>>>0>>0;h=(b?p:0)+h|0;g=(b?-2:-1)+g|0}c[a>>2]=g|j<<16;a=(h-e|0)>>>q;return a|0}function _k(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;h=a+4|0;g=32-e|0;f=c[b+(d+-1<<2)>>2]|0;i=f>>>g;a=d+-2|0;if((d|0)>1){d=f;while(1){f=c[b+(a<<2)>>2]|0;c[h+(a<<2)>>2]=f>>>g|d<0){d=f;a=a+-1|0}else{a=-1;break}}}c[h+(a<<2)>>2]=f<>>16;a=0;b=0-d|0;do{j=c[h+(b<<2)>>2]|0;i=j&65535;j=j>>>16;d=S(i,g)|0;k=S(j,g)|0;j=S(j,e)|0;i=k+(S(i,e)|0)+(d>>>16)|0;d=(i<<16|d&65535)+a|0;a=(i>>>0>>0?j+65536|0:j)+(i>>>16)+(d>>>0>>0&1)|0;c[f+(b<<2)>>2]=d;b=b+1|0}while((b|0)!=0);return a|0}function al(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=a+(d<<2)|0;f=b+(d<<2)|0;g=e&65535;e=e>>>16;b=0;a=0-d|0;do{m=c[f+(a<<2)>>2]|0;l=m&65535;m=m>>>16;k=S(l,g)|0;n=S(m,g)|0;m=S(m,e)|0;l=n+(S(l,e)|0)+(k>>>16)|0;k=(l<<16|k&65535)+b|0;d=h+(a<<2)|0;j=c[d>>2]|0;i=j-k|0;b=(l>>>0>>0?m+65536|0:m)+(l>>>16)+(k>>>0>>0&1)+(i>>>0>j>>>0&1)|0;c[d>>2]=i;a=a+1|0}while((a|0)!=0);return b|0}function bl(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=c[d>>2]|0;a:do if(f>>>0<2){g=(e|0)>0;if((f|0)==1){if(g){f=0;while(1){c[a+(f<<2)>>2]=c[b+(f<<2)>>2];f=f+1|0;if((f|0)==(e|0)){f=0;break a}}}}else if(g){Yq(a|0,0,e<<2|0)|0;f=0;break}c[a+(e<<2)>>2]=0;return}else f=$k(a,b,e,f)|0;while(0);c[a+(e<<2)>>2]=f;if((e|0)>1){h=1;g=a}else return;do{g=g+4|0;f=c[d+(h<<2)>>2]|0;if(f>>>0<2)if((f|0)==1)f=Wk(g,g,b,e)|0;else f=0;else f=Fn(g,b,e,f)|0;c[g+(e<<2)>>2]=f;h=h+1|0}while((h|0)!=(e|0));return}function cl(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;if(e&1|0){g=e+-1|0;if((e|0)<17)bl(a,b,d,g);else cl(a,b,d,g,f);f=a+(g<<2)|0;c[a+(g<<1<<2)>>2]=Fn(f,b,g,c[d+(g<<2)>>2]|0)|0;c[a+(g+e<<2)>>2]=Fn(f,d,e,c[b+(g<<2)>>2]|0)|0;return}o=e>>1;n=(o|0)<16;g=a+(e<<2)|0;j=b+(o<<2)|0;m=d+(o<<2)|0;if(n){bl(g,j,m,o);i=o}else{cl(g,j,m,o,f);i=o}while(1){if((i|0)<=0){i=12;break}i=i+-1|0;k=c[j+(i<<2)>>2]|0;l=c[b+(i<<2)>>2]|0;if((k|0)!=(l|0)){i=11;break}}if((i|0)==11)if(k>>>0>l>>>0)i=12;else{hl(a,b,j,o)|0;j=1}if((i|0)==12){hl(a,j,b,o)|0;j=0}i=o;while(1){if((i|0)<=0){i=18;break}i=i+-1|0;k=c[m+(i<<2)>>2]|0;l=c[d+(i<<2)>>2]|0;if((k|0)!=(l|0)){i=17;break}}if((i|0)==17)if(k>>>0>l>>>0)i=18;else{l=a+(o<<2)|0;hl(l,d,m,o)|0;k=j}if((i|0)==18){l=a+(o<<2)|0;hl(l,m,d,o)|0;k=j^1}if(n){bl(f,a,l,o);if((o|0)>0)i=23;else j=0}else{cl(f,a,l,o,f+(e<<2)|0);i=23}if((i|0)==23){j=a+(o<<2)|0;i=0;do{c[j+(i<<2)>>2]=c[g+(i<<2)>>2];i=i+1|0}while((i|0)!=(o|0));j=1}i=Wk(g,g,g+(o<<2)|0,o)|0;if(!k)i=(Wk(l,l,f,e)|0)+i|0;else i=i-(hl(l,l,f,e)|0)|0;if(n)bl(f,b,d,o);else cl(f,b,d,o,f+(e<<2)|0);i=(Wk(l,l,f,e)|0)+i|0;a:do if(i|0?(h=a+(o<<2)+(e<<2)|0,d=c[h>>2]|0,b=d+i|0,c[h>>2]=b,b>>>0>>0):0){i=o;do{h=h+4|0;i=i+-1|0;if(!i)break a;d=(c[h>>2]|0)+1|0;c[h>>2]=d}while(!(d|0))}while(0);if(j){h=0;do{c[a+(h<<2)>>2]=c[f+(h<<2)>>2];h=h+1|0}while((h|0)!=(o|0))}if(!(Wk(l,l,f+(o<<2)|0,o)|0))return;f=c[g>>2]|0;c[g>>2]=f+1;if((f|0)!=-1)return;while(1){g=g+4|0;e=e+-1|0;if(!e){i=41;break}f=(c[g>>2]|0)+1|0;c[g>>2]=f;if(f|0){i=41;break}}if((i|0)==41)return}function dl(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=g+4|0;h=c[x>>2]|0;if(h){if((c[g+12>>2]|0)<(f|0)){ol(h,c[g+8>>2]|0);w=4}}else w=4;if((w|0)==4){h=f<<1;c[g+8>>2]=h;if(!(af(b)|0))i=(af(e)|0)!=0;else i=1;h=ml(h,i&1)|0;c[x>>2]=h;c[g+12>>2]=f}k=(f|0)<16;if(k)bl(a,b,e,f);else cl(a,b,e,f,h);j=a+(f<<2)|0;i=b+(f<<2)|0;a=d-f|0;if((a|0)>=(f|0)){v=g+16|0;h=c[v>>2]|0;if(h){if((c[g+24>>2]|0)<(f|0)){ol(h,c[g+20>>2]|0);w=14}}else w=14;if((w|0)==14){h=f<<1;c[g+20>>2]=h;if(!(af(i)|0))b=(af(e)|0)!=0;else b=1;h=ml(h,b&1)|0;c[v>>2]=h;c[g+24>>2]=f}if(k){m=h;do{bl(m,i,e,f);r=Wk(j,j,c[v>>2]|0,f)|0;j=j+(f<<2)|0;m=c[v>>2]|0;u=m+(f<<2)|0;h=u+4|0;u=c[u>>2]|0;r=u+r|0;b=j+4|0;c[j>>2]=r;a:do if(r>>>0>>0){d=f;while(1){d=d+-1|0;if(!d)break a;k=h+4|0;u=(c[h>>2]|0)+1|0;l=b+4|0;c[b>>2]=u;if(!u){h=k;b=l}else{o=d;q=k;s=l;w=21;break}}}else{o=f;q=h;s=b;w=21}while(0);if(((w|0)==21?(w=0,(s|0)!=(q|0)):0)?(t=o+-1|0,(o|0)>1):0){h=0;do{c[s+(h<<2)>>2]=c[q+(h<<2)>>2];h=h+1|0}while((h|0)!=(t|0))}i=i+(f<<2)|0;a=a-f|0}while((a|0)>=(f|0))}else{m=h;do{cl(m,i,e,f,c[x>>2]|0);s=Wk(j,j,c[v>>2]|0,f)|0;j=j+(f<<2)|0;m=c[v>>2]|0;t=m+(f<<2)|0;h=t+4|0;t=c[t>>2]|0;s=t+s|0;b=j+4|0;c[j>>2]=s;b:do if(s>>>0>>0){d=f;while(1){d=d+-1|0;if(!d)break b;k=h+4|0;t=(c[h>>2]|0)+1|0;l=b+4|0;c[b>>2]=t;if(!t){h=k;b=l}else{n=d;p=k;r=l;w=28;break}}}else{n=f;p=h;r=b;w=28}while(0);if(((w|0)==28?(w=0,(r|0)!=(p|0)):0)?(u=n+-1|0,(n|0)>1):0){h=0;do{c[r+(h<<2)>>2]=c[p+(h<<2)>>2];h=h+1|0}while((h|0)!=(u|0))}i=i+(f<<2)|0;a=a-f|0}while((a|0)>=(f|0))}}if(!a)return;if((a|0)<16)el(c[x>>2]|0,e,f,i,a)|0;else{h=c[g>>2]|0;if(!h){h=kf(1,28)|0;c[g>>2]=h}dl(c[x>>2]|0,e,f,i,a,h)}i=Wk(j,j,c[x>>2]|0,f)|0;e=j+(f<<2)|0;x=(c[x>>2]|0)+(f<<2)|0;h=x+4|0;x=c[x>>2]|0;f=x+i|0;i=e+4|0;c[e>>2]=f;c:do if(f>>>0>>0){while(1){a=a+-1|0;if(!a)break;b=h+4|0;x=(c[h>>2]|0)+1|0;j=i+4|0;c[i>>2]=x;if(!x){h=b;i=j}else{i=j;break c}}return}else b=h;while(0);if((i|0)==(b|0))return;j=a+-1|0;if((a|0)>1)h=0;else return;do{c[i+(h<<2)>>2]=c[b+(h<<2)>>2];h=h+1|0}while((h|0)!=(j|0));return}function el(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;j=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=j;i=a+(d<<2)|0;if((f|0)>=16){c[g>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[g+16>>2]=0;c[g+20>>2]=0;c[g+24>>2]=0;dl(a,b,d,e,f,g);fl(g);f=c[i+(f<<2)+-4>>2]|0;l=j;return f|0}if(!f){f=0;l=j;return f|0}h=c[e>>2]|0;do if(h>>>0<2){g=(d|0)>0;if((h|0)==1){if(g)g=0;else{g=0;break}do{c[a+(g<<2)>>2]=c[b+(g<<2)>>2];g=g+1|0}while((g|0)!=(d|0));g=0}else{if(!g){g=0;break}Yq(a|0,0,d<<2|0)|0;g=0;break}}else g=$k(a,b,d,h)|0;while(0);c[i>>2]=g;if((f|0)>1)h=1;else{f=g;l=j;return f|0}do{a=a+4|0;g=c[e+(h<<2)>>2]|0;if(g>>>0<2)if((g|0)==1)g=Wk(a,a,b,d)|0;else g=0;else g=Fn(a,b,d,g)|0;c[a+(d<<2)>>2]=g;h=h+1|0}while((h|0)!=(f|0));l=j;return g|0}function fl(a){a=a|0;var b=0,d=0;b=c[a+16>>2]|0;if(b|0)ol(b,c[a+20>>2]|0);b=c[a+4>>2]|0;if(b|0)ol(b,c[a+8>>2]|0);b=c[a>>2]|0;if(!b)return;do{d=b;b=c[b>>2]|0;a=c[d+16>>2]|0;if(a|0)ol(a,c[d+20>>2]|0);a=c[d+4>>2]|0;if(a|0)ol(a,c[d+8>>2]|0);cf(d)}while((b|0)!=0);return}function gl(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;i=a+-4|0;h=32-e|0;a=c[b>>2]|0;j=a<1){f=a;g=1;while(1){a=c[b+(g<<2)>>2]|0;c[i+(g<<2)>>2]=a<>>e;g=g+1|0;if((g|0)==(d|0))break;else f=a}}else d=1;c[i+(d<<2)>>2]=a>>>e;return j|0}function hl(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;g=b+(e<<2)|0;f=d+(e<<2)|0;a=a+(e<<2)|0;b=0-e|0;d=0;do{i=c[g+(b<<2)>>2]|0;h=(c[f+(b<<2)>>2]|0)+d|0;e=i-h|0;d=(e>>>0>i>>>0&1)+(h>>>0>>0&1)|0;c[a+(b<<2)>>2]=e;b=b+1|0}while((b|0)!=0);return d|0}function il(){return 45905}function jl(){var a=0,b=0;a=gf(20)|0;b=gf(4)|0;c[a+16>>2]=b;c[a>>2]=1;c[b>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[17636]=a;c[a+12>>2]=48;a=gf(20)|0;b=gf(4)|0;c[a+16>>2]=b;c[a>>2]=1;c[b>>2]=1;c[a+4>>2]=1;c[a+8>>2]=0;c[17637]=a;c[a+12>>2]=48;a=gf(20)|0;b=gf(4)|0;c[a+16>>2]=b;c[a>>2]=1;c[b>>2]=2;c[a+4>>2]=1;c[a+8>>2]=0;c[17638]=a;c[a+12>>2]=48;a=gf(20)|0;b=gf(4)|0;c[a+16>>2]=b;c[a>>2]=1;c[b>>2]=3;c[a+4>>2]=1;c[a+8>>2]=0;c[17639]=a;c[a+12>>2]=48;a=gf(20)|0;b=gf(4)|0;c[a+16>>2]=b;c[a>>2]=1;c[b>>2]=4;c[a+4>>2]=1;c[a+8>>2]=0;c[17640]=a;c[a+12>>2]=48;a=gf(20)|0;b=gf(4)|0;c[a+16>>2]=b;c[a>>2]=1;c[b>>2]=8;c[a+4>>2]=1;c[a+8>>2]=0;c[17641]=a;c[a+12>>2]=48;return 0}function kl(a){a=a|0;var b=0,d=0;b=gf(20)|0;d=gf(4)|0;c[b+16>>2]=d;c[b>>2]=1;c[b+12>>2]=0;c[d>>2]=a;c[b+4>>2]=(a|0)!=0&1;c[b+8>>2]=0;return b|0}function ll(a){a=a|0;var b=0,d=0;b=gf(20)|0;if(!a)d=0;else d=gf(a<<2)|0;c[b+16>>2]=d;c[b>>2]=a;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;return b|0}function ml(a,b){a=a|0;b=b|0;var d=0;d=(a|0)!=0;a=d?a<<2:4;if(!b)a=gf(a)|0;else a=jf(a)|0;if(d)return a|0;c[a>>2]=0;return a|0}function nl(a){a=a|0;var b=0,d=0;b=gf(20)|0;if(!a)d=0;else d=jf(a<<2)|0;c[b+16>>2]=d;c[b>>2]=a;c[b+12>>2]=1;c[b+4>>2]=0;c[b+8>>2]=0;return b|0}function ol(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(!b)return;e=d<<2;if(e|0){if(!(b&7))d=b;else{d=b;do{a[d>>0]=0;d=d+1|0;e=e+-1|0}while((e|0)!=0&(d&7|0)!=0)}if(e>>>0>=8){h=e+-8|0;i=h&-8;g=i+8|0;f=d;while(1){j=f;c[j>>2]=0;c[j+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else f=f+8|0}d=d+g|0;e=h-i|0}if(e|0)while(1){a[d>>0]=0;e=e+-1|0;if(!e)break;else d=d+1|0}}cf(b);return}function pl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=b+16|0;l=c[k>>2]|0;if(!l){c[k>>2]=d;c[b>>2]=e;return}g=c[b>>2]<<2;if(g|0){if(!(l&7))f=l;else{f=l;do{a[f>>0]=0;f=f+1|0;g=g+-1|0}while((g|0)!=0&(f&7|0)!=0)}if(g>>>0>=8){i=g+-8|0;j=i&-8;h=f;while(1){m=h;c[m>>2]=0;c[m+4>>2]=0;g=g+-8|0;if(g>>>0<=7)break;else h=h+8|0}f=f+(j+8)|0;g=i-j|0}if(g|0)while(1){a[f>>0]=0;g=g+-1|0;if(!g)break;else f=f+1|0}}cf(l);c[k>>2]=d;c[b>>2]=e;return}function ql(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;e=c[a>>2]|0;if(e>>>0>=b>>>0){d=c[a+4>>2]|0;if(d>>>0>=e>>>0)return;e=c[a+16>>2]|0;do{c[e+(d<<2)>>2]=0;d=d+1|0}while(d>>>0<(c[a>>2]|0)>>>0);return}e=a+16|0;d=c[e>>2]|0;do if(!d)if(!(c[a+12>>2]&1)){c[e>>2]=kf(b,4)|0;break}else{c[e>>2]=lf(b,4)|0;break}else{g=b<<2;f=hf(d,g)|0;c[e>>2]=f;d=c[a>>2]|0;if(d>>>0>>0)Yq(f+(d<<2)|0,0,g-(d<<2)|0)|0}while(0);c[a>>2]=b;return}function rl(a){a=a|0;var b=0,d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e;b=a+12|0;if(a|0?c[b>>2]&16|0:0){Je(46049,d);l=e;return}c[a+4>>2]=0;c[b>>2]=0;l=e;return}function sl(){var a=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);Je(46049,a);l=a;return}function tl(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;n=l;l=l+16|0;if((l|0)>=(m|0))$(16);k=n;if(!b){l=n;return}i=b+12|0;d=c[i>>2]|0;if(d&32|0){l=n;return}j=c[b+16>>2]|0;if(!(d&4)){if(j|0){e=c[b>>2]<<2;if(e|0){if(!(j&7))d=j;else{d=j;do{a[d>>0]=0;d=d+1|0;e=e+-1|0}while((e|0)!=0&(d&7|0)!=0)}if(e>>>0>=8){g=e+-8|0;h=g&-8;f=d;while(1){o=f;c[o>>2]=0;c[o+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else f=f+8|0}d=d+(h+8)|0;e=g-h|0}if(e|0)while(1){a[d>>0]=0;e=e+-1|0;if(!e)break;else d=d+1|0}}cf(j)}}else cf(j);if(c[i>>2]&-3864|0)Ne(46093,k);cf(b);l=n;return}function ul(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;p=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=p;if(!b){b=gf(20)|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;if(!b){o=0;f=c[3]|0}else h=4}else h=4;if((h|0)==4){f=c[b+12>>2]|0;if(!(f&16))o=b;else{Je(46049,g);d=b;l=p;return d|0}}n=o+12|0;j=o+16|0;k=c[j>>2]|0;if(!(f&4)){if(k|0){f=c[o>>2]<<2;if(f|0){if(!(k&7))b=k;else{b=k;do{a[b>>0]=0;b=b+1|0;f=f+-1|0}while((f|0)!=0&(b&7|0)!=0)}if(f>>>0>=8){h=f+-8|0;i=h&-8;g=b;while(1){q=g;c[q>>2]=0;c[q+4>>2]=0;f=f+-8|0;if(f>>>0<=7)break;else g=g+8|0}b=b+(i+8)|0;f=h-i|0}if(f|0)while(1){a[b>>0]=0;f=f+-1|0;if(!f)break;else b=b+1|0}}cf(k)}}else cf(k);c[j>>2]=d;c[o>>2]=0;c[o+4>>2]=0;c[o+8>>2]=e;b=c[n>>2]&3840;c[n>>2]=b|4;if(!(af(d)|0)){q=o;l=p;return q|0}c[n>>2]=b|5;q=o;l=p;return q|0}function vl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=(c+7|0)>>>3;if(!(af(b)|0))e=_e(d)|0;else e=$e(d)|0;if(!e){e=0;return e|0}cr(e|0,b|0,d|0)|0;e=ul(a,e,c)|0;return e|0}function wl(a,b){a=a|0;b=b|0;var d=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);if(!(c[a+12>>2]&4))Ne(46125,d);if(b|0)c[b>>2]=c[a+8>>2];l=d;return c[a+16>>2]|0}function xl(a,b){a=a|0;b=b|0;var d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);if(!(c[a+12>>2]&4))Ne(46125,e);if(b){d=c[a+8>>2]|0;c[b>>2]=d;b=c[a+16>>2]|0;if(!b){d=0;l=e;return d|0}}else{d=0;b=c[a+16>>2]|0}a=(d+7|0)>>>3;if(!(af(b)|0))d=_e(a)|0;else d=$e(a)|0;if(!d){d=0;l=e;return d|0}cr(d|0,b|0,a|0)|0;l=e;return d|0}function yl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!a){a=0;return a|0}k=a+12|0;e=c[k>>2]|0;if(e&4|0){f=a+16|0;k=(af(c[f>>2]|0)|0)==0;d=a+8|0;b=((c[d>>2]|0)+7|0)/8|0;if(k)e=gf(b)|0;else e=jf(b)|0;b=c[f>>2]|0;if(!b)b=c[d>>2]|0;else{a=c[d>>2]|0;cr(e|0,b|0,(a+7|0)/8|0|0)|0;b=a}a=ul(0,e,b)|0;k=a+12|0;c[k>>2]=c[k>>2]&-49;return a|0}j=a+4|0;g=c[j>>2]|0;b=gf(20)|0;f=(g|0)==0;d=g<<2;if(!(e&1)){if(f)d=0;else d=gf(d)|0;c[b+16>>2]=d;c[b>>2]=g;e=b+4|0;c[e>>2]=0;g=b+8|0;c[g>>2]=0;h=b+12|0;c[h>>2]=0;i=d}else{if(f)d=0;else d=jf(d)|0;c[b+16>>2]=d;c[b>>2]=g;h=b+12|0;c[h>>2]=1;e=b+4|0;c[e>>2]=0;g=b+8|0;c[g>>2]=0;i=d}f=c[j>>2]|0;c[e>>2]=f;c[g>>2]=c[a+8>>2];c[h>>2]=c[k>>2]&-49;if((f|0)<=0){a=b;return a|0}e=c[a+16>>2]|0;d=0;do{c[i+(d<<2)>>2]=c[e+(d<<2)>>2];d=d+1|0}while((d|0)<(f|0));return b|0}function zl(a,b){a=a|0;b=b|0;var d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=e;if((a|0)==(b|0)){if(a|0?c[a+12>>2]&16|0:0){Je(46049,d);l=e;return}}else Al(a,b)|0;c[a+8>>2]=(c[b+8>>2]|0)==0&1;l=e;return}function Al(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;k=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=k;i=c[b+4>>2]|0;j=c[b+8>>2]|0;if(!a){a=gf(20)|0;if(!i)d=0;else d=gf(i<<2)|0;c[a+16>>2]=d;c[a>>2]=i;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0}h=a+12|0;f=c[h>>2]|0;if(f&16|0){Je(46049,e);l=k;return a|0}e=c[a>>2]|0;a:do if((e|0)<(i|0)){if(e>>>0>=i>>>0){d=c[a+4>>2]|0;if(d>>>0>=e>>>0)break;e=c[a+16>>2]|0;while(1){c[e+(d<<2)>>2]=0;d=d+1|0;if(d>>>0>=(c[a>>2]|0)>>>0)break a}}g=a+16|0;d=c[g>>2]|0;do if(!d)if(!(f&1)){c[g>>2]=kf(i,4)|0;break}else{c[g>>2]=lf(i,4)|0;break}else{f=i<<2;e=hf(d,f)|0;c[g>>2]=e;d=c[a>>2]|0;if(d>>>0>>0)Yq(e+(d<<2)|0,0,f-(d<<2)|0)|0}while(0);c[a>>2]=i}while(0);e=c[a+16>>2]|0;f=c[b+16>>2]|0;if((i|0)>0){d=0;do{c[e+(d<<2)>>2]=c[f+(d<<2)>>2];d=d+1|0}while((d|0)!=(i|0))}c[a+4>>2]=i;c[h>>2]=c[b+12>>2]&-49;c[a+8>>2]=j;l=k;return a|0}function Bl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;if(!a){g=0;return g|0}g=a+12|0;d=c[g>>2]|0;if(d&4|0){d=a+8|0;e=((c[d>>2]|0)+7|0)/8|0;a=a+16|0;if(!(af(c[a>>2]|0)|0))b=_e(e)|0;else b=$e(e)|0;cr(b|0,c[a>>2]|0,e|0)|0;g=ul(0,b,c[d>>2]|0)|0;return g|0}e=c[a+4>>2]|0;f=gf(20)|0;b=(e|0)==0;a=e<<2;if(!(d&1)){if(b)a=0;else a=gf(a)|0;c[f+16>>2]=a;c[f>>2]=e;a=f+4|0;c[a>>2]=0;b=f+8|0;c[b>>2]=0;d=f+12|0;c[d>>2]=0}else{if(b)a=0;else a=jf(a)|0;c[f+16>>2]=a;c[f>>2]=e;d=f+12|0;c[d>>2]=1;a=f+4|0;c[a>>2]=0;b=f+8|0;c[b>>2]=0}c[a>>2]=0;c[b>>2]=0;c[d>>2]=c[g>>2];g=f;return g|0}function Cl(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;q=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=q;if(b|0){p=b+12|0;if(c[p>>2]&16|0){Je(46049,e);l=q;return}k=d+16|0;n=c[k>>2]|0;o=c[d>>2]|0;i=b+16|0;j=c[i>>2]|0;if(j|0){f=c[b>>2]<<2;if(f|0){if(!(j&7))e=j;else{e=j;do{a[e>>0]=0;e=e+1|0;f=f+-1|0}while((f|0)!=0&(e&7|0)!=0)}if(f>>>0>=8){h=f+-8|0;g=e;while(1){r=g;c[r>>2]=0;c[r+4>>2]=0;f=f+-8|0;if(f>>>0<=7)break;else g=g+8|0}f=h&-8;e=e+(f+8)|0;f=h-f|0}if(f|0)while(1){a[e>>0]=0;f=f+-1|0;if(!f)break;else e=e+1|0}}cf(j)}c[i>>2]=n;c[b>>2]=o;r=d+4|0;c[b+4>>2]=c[r>>2];c[b+8>>2]=c[d+8>>2];c[p>>2]=c[d+12>>2];c[d>>2]=0;c[r>>2]=0;c[k>>2]=0}tl(d);l=q;return}function Dl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=c[b>>2]|0;e=(d|0)!=0;if((c[a>>2]|0)!=(g|0))Ne(46155,i);if((g|0)>0?(h=c[a+16>>2]|0,f=c[b+16>>2]|0,e):0){d=0;do{c[h+(d<<2)>>2]=c[f+(d<<2)>>2];d=d+1|0}while((d|0)!=(g|0))}h=a+4|0;g=c[h>>2]|0;c[h>>2]=(e?c[b+4>>2]^g:0)^g;h=a+8|0;g=c[h>>2]|0;c[h>>2]=(e?c[b+8>>2]^g:0)^g;l=i;return a|0}function El(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=f;if(!a){a=gf(20)|0;c[a+16>>2]=gf(4)|0;c[a>>2]=1;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;if(!a)a=0;else e=3}else e=3;if((e|0)==3)if(c[a+12>>2]&16){Je(46049,d);b=a;l=f;return b|0}e=c[a>>2]|0;a:do if((e|0)<1){if(e|0){d=c[a+4>>2]|0;if(d>>>0>=e>>>0)break;e=c[a+16>>2]|0;while(1){c[e+(d<<2)>>2]=0;d=d+1|0;if(d>>>0>=(c[a>>2]|0)>>>0)break a}}e=a+16|0;d=c[e>>2]|0;do if(!d)if(!(c[a+12>>2]&1)){c[e>>2]=kf(1,4)|0;break}else{c[e>>2]=lf(1,4)|0;break}else{d=hf(d,4)|0;c[e>>2]=d;if(!(c[a>>2]|0))c[d>>2]=0}while(0);c[a>>2]=1}while(0);c[c[a+16>>2]>>2]=b;c[a+4>>2]=(b|0)!=0&1;c[a+8>>2]=0;c[a+12>>2]=0;b=a;l=f;return b|0}function Fl(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+32|0;if((l|0)>=(m|0))$(32);e=d;c[e>>2]=c[a>>2];c[e+4>>2]=c[a+4>>2];c[e+8>>2]=c[a+8>>2];c[e+12>>2]=c[a+12>>2];c[e+16>>2]=c[a+16>>2];c[a>>2]=c[b>>2];c[a+4>>2]=c[b+4>>2];c[a+8>>2]=c[b+8>>2];c[a+12>>2]=c[b+12>>2];c[a+16>>2]=c[b+16>>2];c[b>>2]=c[e>>2];c[b+4>>2]=c[e+4>>2];c[b+8>>2]=c[e+8>>2];c[b+12>>2]=c[e+12>>2];c[b+16>>2]=c[e+16>>2];l=d;return}function Gl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=c[a>>2]|0;e=(d|0)!=0;if((g|0)!=(c[b>>2]|0))Ne(46186,i);if((g|0)>0?(h=c[a+16>>2]|0,f=c[b+16>>2]|0,e):0){d=0;do{n=h+(d<<2)|0;j=f+(d<<2)|0;o=c[j>>2]|0;k=o^c[n>>2];c[n>>2]=o;c[j>>2]=c[j>>2]^k;d=d+1|0}while((d|0)!=(g|0))}o=a+4|0;n=c[o>>2]|0;k=b+4|0;j=e?c[k>>2]^n:0;c[o>>2]=j^n;c[k>>2]=c[k>>2]^j;k=a+8|0;j=c[k>>2]|0;o=b+8|0;n=e?c[o>>2]^j:0;c[k>>2]=n^j;c[o>>2]=c[o>>2]^n;l=i;return}function Hl(a){a=a|0;var b=0,d=0;a=(a+31|0)>>>5;b=gf(20)|0;if(!a)d=0;else d=gf(a<<2)|0;c[b+16>>2]=d;c[b>>2]=a;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;return b|0}function Il(a){a=a|0;var b=0,d=0;a=(a+31|0)>>>5;b=gf(20)|0;if(!a)d=0;else d=jf(a<<2)|0;c[b+16>>2]=d;c[b>>2]=a;c[b+12>>2]=1;c[b+4>>2]=0;c[b+8>>2]=0;return b|0}function Jl(a){a=a|0;tl(a);return}function Kl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=g;f=(b+7|0)>>>3;b=(a|0)!=0;if(b?c[a+12>>2]&16|0:0){Je(46049,e);l=g;return}do if(!d){if(b?(c[a+12>>2]&1|0)!=0:0)b=jf(f)|0;else b=gf(f)|0;Hj(b,f)}else{if(b?c[a+12>>2]&1|0:0){b=Cj(f,d)|0;break}b=Aj(f,d)|0}while(0);Rk(a,b,f,0);cf(b);l=g;return}function Ll(a,b){a=a|0;b=b|0;var d=0,e=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);switch(b|0){case 1:{d=c[a+12>>2]&1;break}case 2:{d=(c[a+12>>2]|0)>>>2&1;break}case 4:{d=(c[a+12>>2]|0)>>>4&1;break}case 8:{d=(c[a+12>>2]|0)>>>5&1;break}case 2048:case 1024:case 512:case 256:{d=(c[a+12>>2]&b|0)!=0&1;break}default:Ne(46218,e)}l=e;return d|0}function Ml(a){a=a|0;var b=0,d=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=d;if((a|0)<0|a>>>0>6){c[b>>2]=a;Ne(46238,b)}a=c[70544+(a<<2)>>2]|0;if(!a)Ne(46269,d+8|0);else{l=d;return a|0}return 0}function Nl(){return 46300}function Ol(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0;o=l;l=l+64|0;if((l|0)>=(m|0))$(64);k=o;n=Oq(172)|0;if(!n){n=0;l=o;return n|0}c[n>>2]=1779033703;c[n+4>>2]=-1150833019;c[n+8>>2]=1013904242;c[n+12>>2]=-1521486534;c[n+16>>2]=1359893119;c[n+20>>2]=-1694144372;c[n+24>>2]=528734635;c[n+28>>2]=1541459225;c[n+32>>2]=0;c[n+36>>2]=0;i=n+40|0;a[i>>0]=0;if(!b){l=o;return n|0}g=k;h=g+64|0;do{a[g>>0]=0;g=g+1|0}while((g|0)<(h|0));j=n+105|0;g=j;h=g+64|0;do{a[g>>0]=0;g=g+1|0}while((g|0)<(h|0));do if(e>>>0<65){cr(k|0,b|0,e|0)|0;cr(j|0,b|0,e|0)|0;b=0}else{f=Oq(172)|0;if(f|0){c[f>>2]=1779033703;c[f+4>>2]=-1150833019;c[f+8>>2]=1013904242;c[f+12>>2]=-1521486534;c[f+16>>2]=1359893119;c[f+20>>2]=-1694144372;c[f+24>>2]=528734635;c[f+28>>2]=1541459225;c[f+32>>2]=0;c[f+36>>2]=0;a[f+40>>0]=0;Pl(f,b,e);Ql(f);b=f+41|0;g=k;e=b;h=g+32|0;do{a[g>>0]=a[e>>0]|0;g=g+1|0;e=e+1|0}while((g|0)<(h|0));g=j;e=b;h=g+32|0;do{a[g>>0]=a[e>>0]|0;g=g+1|0;e=e+1|0}while((g|0)<(h|0));Rl(f);b=0;break}Pq(n);n=0;l=o;return n|0}while(0);do{h=k+b|0;a[h>>0]=(d[h>>0]|0)^54;h=j+b|0;a[h>>0]=(d[h>>0]|0)^92;b=b+1|0}while((b|0)!=64);a[i>>0]=a[i>>0]|2;Pl(n,k,64);a[k>>0]=0;a[k+1>>0]=0;a[k+2>>0]=0;a[k+3>>0]=0;a[k+4>>0]=0;a[k+5>>0]=0;a[k+6>>0]=0;a[k+7>>0]=0;a[k+8>>0]=0;a[k+9>>0]=0;a[k+10>>0]=0;a[k+11>>0]=0;a[k+12>>0]=0;a[k+13>>0]=0;a[k+14>>0]=0;a[k+15>>0]=0;a[k+16>>0]=0;a[k+17>>0]=0;a[k+18>>0]=0;a[k+19>>0]=0;a[k+20>>0]=0;a[k+21>>0]=0;a[k+22>>0]=0;a[k+23>>0]=0;a[k+24>>0]=0;a[k+25>>0]=0;a[k+26>>0]=0;a[k+27>>0]=0;a[k+28>>0]=0;a[k+29>>0]=0;a[k+30>>0]=0;a[k+31>>0]=0;a[k+32>>0]=0;a[k+33>>0]=0;a[k+34>>0]=0;a[k+35>>0]=0;a[k+36>>0]=0;a[k+37>>0]=0;a[k+38>>0]=0;a[k+39>>0]=0;a[k+40>>0]=0;a[k+41>>0]=0;a[k+42>>0]=0;a[k+43>>0]=0;a[k+44>>0]=0;a[k+45>>0]=0;a[k+46>>0]=0;a[k+47>>0]=0;a[k+48>>0]=0;a[k+49>>0]=0;a[k+50>>0]=0;a[k+51>>0]=0;a[k+52>>0]=0;a[k+53>>0]=0;a[k+54>>0]=0;a[k+55>>0]=0;a[k+56>>0]=0;a[k+57>>0]=0;a[k+58>>0]=0;a[k+59>>0]=0;a[k+60>>0]=0;a[k+61>>0]=0;a[k+62>>0]=0;a[k+63>>0]=0;l=o;return n|0}function Pl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;g=b+40|0;if(a[g>>0]&1)return;k=b+36|0;f=c[k>>2]|0;if((f|0)==64){Sl(b,b+41|0);c[k>>2]=0;f=b+32|0;c[f>>2]=(c[f>>2]|0)+1;f=0}if(!d)return;a:do if(!f)f=0;else{b:do if(e|0){if((f|0)<64)do{j=a[d>>0]|0;c[k>>2]=f+1;a[b+41+f>>0]=j;e=e+-1|0;if(!e)break b;d=d+1|0;f=c[k>>2]|0}while((f|0)<64);if(!((f|0)==64&(a[g>>0]&1)==0))break a;Sl(b,b+41|0);c[k>>2]=0;f=b+32|0;c[f>>2]=(c[f>>2]|0)+1;f=0;break a}while(0);if(a[g>>0]&1)return;if((c[k>>2]|0)!=64)return;Sl(b,b+41|0);c[k>>2]=0;k=b+32|0;c[k>>2]=(c[k>>2]|0)+1;return}while(0);if(e>>>0>63){g=b+32|0;i=e+-64|0;j=i&-64;h=j+64|0;f=d;while(1){Sl(b,f);c[k>>2]=0;c[g>>2]=(c[g>>2]|0)+1;e=e+-64|0;if(e>>>0<=63)break;else f=f+64|0}d=d+h|0;e=i-j|0;f=0}if(!((e|0)!=0&(f|0)<64))return;while(1){j=a[d>>0]|0;c[k>>2]=f+1;a[b+41+f>>0]=j;e=e+-1|0;if(!e){f=22;break}f=c[k>>2]|0;if((f|0)>=64){f=22;break}else d=d+1|0}if((f|0)==22)return}function Ql(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;m=b+40|0;if(a[m>>0]&1)return;k=b+36|0;d=c[k>>2]|0;if((d|0)==64){Sl(b,b+41|0);c[k>>2]=0;f=b+32|0;e=(c[f>>2]|0)+1|0;c[f>>2]=e;d=0}else{e=b+32|0;f=e;e=c[e>>2]|0}g=e<<6;l=g+d|0;g=(l>>>0>>0&1)+(e>>>26)|0;h=l<<3;i=g<<3|l>>>29;c[k>>2]=d+1;j=b+41|0;a[b+41+d>>0]=-128;e=c[k>>2]|0;if((d|0)<56){if((e|0)<56){d=e;do{c[k>>2]=d+1;a[b+41+d>>0]=0;d=c[k>>2]|0}while((d|0)<56)}}else{if((e|0)<64){d=e;do{c[k>>2]=d+1;a[b+41+d>>0]=0;d=c[k>>2]|0}while((d|0)<64)}else d=e;if((d|0)==64&(a[m>>0]&1)==0){Sl(b,b+41|0);c[k>>2]=0;c[f>>2]=(c[f>>2]|0)+1}d=j;e=d+56|0;do{a[d>>0]=0;d=d+1|0}while((d|0)<(e|0))}a[b+97>>0]=0;a[b+98>>0]=0;a[b+99>>0]=g>>>5;a[b+100>>0]=i;a[b+101>>0]=l>>>21;a[b+102>>0]=l>>>13;a[b+103>>0]=l>>>5;a[b+104>>0]=h;Sl(b,j);l=c[b>>2]|0;a[j>>0]=l>>>24;a[b+42>>0]=l>>>16;a[b+43>>0]=l>>>8;a[b+44>>0]=l;l=c[b+4>>2]|0;a[b+45>>0]=l>>>24;a[b+46>>0]=l>>>16;a[b+47>>0]=l>>>8;a[b+48>>0]=l;l=c[b+8>>2]|0;a[b+49>>0]=l>>>24;a[b+50>>0]=l>>>16;a[b+51>>0]=l>>>8;a[b+52>>0]=l;l=c[b+12>>2]|0;a[b+53>>0]=l>>>24;a[b+54>>0]=l>>>16;a[b+55>>0]=l>>>8;a[b+56>>0]=l;l=c[b+16>>2]|0;a[b+57>>0]=l>>>24;a[b+58>>0]=l>>>16;a[b+59>>0]=l>>>8;a[b+60>>0]=l;l=c[b+20>>2]|0;a[b+61>>0]=l>>>24;a[b+62>>0]=l>>>16;a[b+63>>0]=l>>>8;a[b+64>>0]=l;l=c[b+24>>2]|0;a[b+65>>0]=l>>>24;a[b+66>>0]=l>>>16;a[b+67>>0]=l>>>8;a[b+68>>0]=l;l=c[b+28>>2]|0;a[b+69>>0]=l>>>24;a[b+70>>0]=l>>>16;a[b+71>>0]=l>>>8;a[b+72>>0]=l;a[m>>0]=a[m>>0]|1;return}function Rl(b){b=b|0;if(!b)return;if(a[b+40>>0]&2){a[b+105>>0]=0;a[b+106>>0]=0;a[b+107>>0]=0;a[b+108>>0]=0;a[b+109>>0]=0;a[b+110>>0]=0;a[b+111>>0]=0;a[b+112>>0]=0;a[b+113>>0]=0;a[b+114>>0]=0;a[b+115>>0]=0;a[b+116>>0]=0;a[b+117>>0]=0;a[b+118>>0]=0;a[b+119>>0]=0;a[b+120>>0]=0;a[b+121>>0]=0;a[b+122>>0]=0;a[b+123>>0]=0;a[b+124>>0]=0;a[b+125>>0]=0;a[b+126>>0]=0;a[b+127>>0]=0;a[b+128>>0]=0;a[b+129>>0]=0;a[b+130>>0]=0;a[b+131>>0]=0;a[b+132>>0]=0;a[b+133>>0]=0;a[b+134>>0]=0;a[b+135>>0]=0;a[b+136>>0]=0;a[b+137>>0]=0;a[b+138>>0]=0;a[b+139>>0]=0;a[b+140>>0]=0;a[b+141>>0]=0;a[b+142>>0]=0;a[b+143>>0]=0;a[b+144>>0]=0;a[b+145>>0]=0;a[b+146>>0]=0;a[b+147>>0]=0;a[b+148>>0]=0;a[b+149>>0]=0;a[b+150>>0]=0;a[b+151>>0]=0;a[b+152>>0]=0;a[b+153>>0]=0;a[b+154>>0]=0;a[b+155>>0]=0;a[b+156>>0]=0;a[b+157>>0]=0;a[b+158>>0]=0;a[b+159>>0]=0;a[b+160>>0]=0;a[b+161>>0]=0;a[b+162>>0]=0;a[b+163>>0]=0;a[b+164>>0]=0;a[b+165>>0]=0;a[b+166>>0]=0;a[b+167>>0]=0;a[b+168>>0]=0}Pq(b);return}function Sl(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;y=l;l=l+320|0;if((l|0)>=(m|0))$(320);e=y+256|0;u=y;j=c[b>>2]|0;v=b+4|0;f=c[v>>2]|0;w=b+8|0;h=c[w>>2]|0;x=b+12|0;p=c[x>>2]|0;q=b+16|0;i=c[q>>2]|0;r=b+20|0;k=c[r>>2]|0;s=b+24|0;o=c[s>>2]|0;t=b+28|0;n=c[t>>2]|0;a[e+3>>0]=a[d>>0]|0;a[e+2>>0]=a[d+1>>0]|0;a[e+1>>0]=a[d+2>>0]|0;a[e>>0]=a[d+3>>0]|0;g=e+4|0;a[g+3>>0]=a[d+4>>0]|0;a[g+2>>0]=a[d+5>>0]|0;a[g+1>>0]=a[d+6>>0]|0;a[g>>0]=a[d+7>>0]|0;g=e+8|0;a[g+3>>0]=a[d+8>>0]|0;a[g+2>>0]=a[d+9>>0]|0;a[g+1>>0]=a[d+10>>0]|0;a[g>>0]=a[d+11>>0]|0;g=e+12|0;a[g+3>>0]=a[d+12>>0]|0;a[g+2>>0]=a[d+13>>0]|0;a[g+1>>0]=a[d+14>>0]|0;a[g>>0]=a[d+15>>0]|0;g=e+16|0;a[g+3>>0]=a[d+16>>0]|0;a[g+2>>0]=a[d+17>>0]|0;a[g+1>>0]=a[d+18>>0]|0;a[g>>0]=a[d+19>>0]|0;g=e+20|0;a[g+3>>0]=a[d+20>>0]|0;a[g+2>>0]=a[d+21>>0]|0;a[g+1>>0]=a[d+22>>0]|0;a[g>>0]=a[d+23>>0]|0;g=e+24|0;a[g+3>>0]=a[d+24>>0]|0;a[g+2>>0]=a[d+25>>0]|0;a[g+1>>0]=a[d+26>>0]|0;a[g>>0]=a[d+27>>0]|0;g=e+28|0;a[g+3>>0]=a[d+28>>0]|0;a[g+2>>0]=a[d+29>>0]|0;a[g+1>>0]=a[d+30>>0]|0;a[g>>0]=a[d+31>>0]|0;g=e+32|0;a[g+3>>0]=a[d+32>>0]|0;a[g+2>>0]=a[d+33>>0]|0;a[g+1>>0]=a[d+34>>0]|0;a[g>>0]=a[d+35>>0]|0;g=e+36|0;a[g+3>>0]=a[d+36>>0]|0;a[g+2>>0]=a[d+37>>0]|0;a[g+1>>0]=a[d+38>>0]|0;a[g>>0]=a[d+39>>0]|0;g=e+40|0;a[g+3>>0]=a[d+40>>0]|0;a[g+2>>0]=a[d+41>>0]|0;a[g+1>>0]=a[d+42>>0]|0;a[g>>0]=a[d+43>>0]|0;g=e+44|0;a[g+3>>0]=a[d+44>>0]|0;a[g+2>>0]=a[d+45>>0]|0;a[g+1>>0]=a[d+46>>0]|0;a[g>>0]=a[d+47>>0]|0;g=e+48|0;a[g+3>>0]=a[d+48>>0]|0;a[g+2>>0]=a[d+49>>0]|0;a[g+1>>0]=a[d+50>>0]|0;a[g>>0]=a[d+51>>0]|0;g=e+52|0;a[g+3>>0]=a[d+52>>0]|0;a[g+2>>0]=a[d+53>>0]|0;a[g+1>>0]=a[d+54>>0]|0;a[g>>0]=a[d+55>>0]|0;g=e+56|0;a[g+3>>0]=a[d+56>>0]|0;a[g+2>>0]=a[d+57>>0]|0;a[g+1>>0]=a[d+58>>0]|0;a[g>>0]=a[d+59>>0]|0;g=e+60|0;a[g+3>>0]=a[d+60>>0]|0;a[g+2>>0]=a[d+61>>0]|0;a[g+1>>0]=a[d+62>>0]|0;a[g>>0]=a[d+63>>0]|0;d=u;g=d+64|0;do{c[d>>2]=c[e>>2];d=d+4|0;e=e+4|0}while((d|0)<(g|0));d=16;e=c[u>>2]|0;do{g=c[u+(d+-2<<2)>>2]|0;z=e;e=c[u+(d+-15<<2)>>2]|0;c[u+(d<<2)>>2]=z+(c[u+(d+-7<<2)>>2]|0)+((g<<13|g>>>19)^g>>>10^(g<<15|g>>>17))+((e<<14|e>>>18)^e>>>3^(e<<25|e>>>7));d=d+1|0}while((d|0)!=64);e=n;n=o;d=p;g=0;while(1){e=((i<<26|i>>>6)^(i<<21|i>>>11)^(i<<7|i>>>25))+e+((n^k)&i^n)+(c[12216+(g<<2)>>2]|0)+(c[u+(g<<2)>>2]|0)|0;d=e+d|0;e=((j<<30|j>>>2)^(j<<19|j>>>13)^(j<<10|j>>>22))+((j|f)&h|j&f)+e|0;g=g+1|0;if((g|0)==64)break;else{C=j;B=f;A=h;o=i;p=k;z=n;j=e;i=d;f=C;h=B;d=A;k=o;n=p;e=z}}c[b>>2]=(c[b>>2]|0)+e;c[v>>2]=(c[v>>2]|0)+j;c[w>>2]=(c[w>>2]|0)+f;c[x>>2]=(c[x>>2]|0)+h;c[q>>2]=(c[q>>2]|0)+d;c[r>>2]=(c[r>>2]|0)+i;c[s>>2]=(c[s>>2]|0)+k;c[t>>2]=(c[t>>2]|0)+n;l=y;return}function Tl(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;Ql(b);do if(a[b+40>>0]&2){e=Oq(172)|0;if(e|0){c[e>>2]=1779033703;c[e+4>>2]=-1150833019;c[e+8>>2]=1013904242;c[e+12>>2]=-1521486534;c[e+16>>2]=1359893119;c[e+20>>2]=-1694144372;c[e+24>>2]=528734635;c[e+28>>2]=1541459225;c[e+32>>2]=0;c[e+36>>2]=0;a[e+40>>0]=0;Pl(e,b+105|0,64);f=b+41|0;Pl(e,f,32);Ql(e);g=e+41|0;h=f+32|0;do{a[f>>0]=a[g>>0]|0;f=f+1|0;g=g+1|0}while((f|0)<(h|0));Rl(e);break}Pq(b);h=0;return h|0}while(0);if(d|0)c[d>>2]=32;h=b+41|0;return h|0}function Ul(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0;pa=l;l=l+16|0;if((l|0)>=(m|0))$(16);na=pa;oa=b+12|0;if((c[(c[oa>>2]|0)+20>>2]|0)!=16){oa=139;l=pa;return oa|0}if((h+8|0)>>>0>f>>>0){oa=200;l=pa;return oa|0}if(h&7|0){oa=45;l=pa;return oa|0}la=h>>>3;if(h>>>0<16){oa=45;l=pa;return oa|0}ma=b+80|0;if(!(a[b+56>>0]&2)){ka=e;ja=ka;a[ja>>0]=-1499027802;a[ja+1>>0]=-1499027802>>8;a[ja+2>>0]=-1499027802>>16;a[ja+3>>0]=-1499027802>>24;ka=ka+4|0;a[ka>>0]=-1499027802;a[ka+1>>0]=-1499027802>>8;a[ka+2>>0]=-1499027802>>16;a[ka+3>>0]=-1499027802>>24;ka=e}else{ja=b+64|0;ha=ja;ha=d[ha>>0]|d[ha+1>>0]<<8|d[ha+2>>0]<<16|d[ha+3>>0]<<24;ja=ja+4|0;ja=d[ja>>0]|d[ja+1>>0]<<8|d[ja+2>>0]<<16|d[ja+3>>0]<<24;ka=e;ia=ka;a[ia>>0]=ha;a[ia+1>>0]=ha>>8;a[ia+2>>0]=ha>>16;a[ia+3>>0]=ha>>24;ka=ka+4|0;a[ka>>0]=ja;a[ka+1>>0]=ja>>8;a[ka+2>>0]=ja>>16;a[ka+3>>0]=ja>>24;ka=e}dr(e+8|0,g|0,h|0)|0;ia=na;c[ia>>2]=0;c[ia+4>>2]=0;ia=(la|0)==0;ja=b+88|0;z=b+496|0;A=((ma|e)&3|0)==0;B=ma+4|0;C=na+4|0;D=e+4|0;E=ma+1|0;F=na+7|0;G=na+6|0;H=na+5|0;I=na+4|0;J=na+3|0;K=na+2|0;L=na+1|0;M=e+1|0;N=ma+2|0;O=e+2|0;P=ma+3|0;Q=e+3|0;R=ma+4|0;S=e+4|0;T=ma+5|0;U=na+5|0;V=e+5|0;W=ma+6|0;X=na+6|0;Y=e+6|0;Z=ma+7|0;_=na+7|0;aa=e+7|0;ba=na+7|0;ca=na+6|0;da=na+5|0;ea=na+4|0;fa=na+3|0;ga=na+2|0;ha=na+1|0;o=0;y=0;j=0;s=0;r=0;q=0;n=0;k=0;v=0;f=0;g=0;h=0;t=0;i=0;b=0;p=0;while(1){if(!ia)if(A){t=1;k=s;do{w=ka;x=w;x=d[x>>0]|d[x+1>>0]<<8|d[x+2>>0]<<16|d[x+3>>0]<<24;w=w+4|0;w=d[w>>0]|d[w+1>>0]<<8|d[w+2>>0]<<16|d[w+3>>0]<<24;n=ma;u=n;a[u>>0]=x;a[u+1>>0]=x>>8;a[u+2>>0]=x>>16;a[u+3>>0]=x>>24;n=n+4|0;a[n>>0]=w;a[n+1>>0]=w>>8;a[n+2>>0]=w>>16;a[n+3>>0]=w>>24;n=e+(t<<3)|0;w=n;u=w;u=d[u>>0]|d[u+1>>0]<<8|d[u+2>>0]<<16|d[u+3>>0]<<24;w=w+4|0;w=d[w>>0]|d[w+1>>0]<<8|d[w+2>>0]<<16|d[w+3>>0]<<24;x=ja;v=x;a[v>>0]=u;a[v+1>>0]=u>>8;a[v+2>>0]=u>>16;a[v+3>>0]=u>>24;x=x+4|0;a[x>>0]=w;a[x+1>>0]=w>>8;a[x+2>>0]=w>>16;a[x+3>>0]=w>>24;x=pb[c[(c[oa>>2]|0)+36>>2]&63](z,ma,ma)|0;o=x>>>0>o>>>0?x:o;p=p+1<<24>>24;a[ba>>0]=p;if(!(p<<24>>24)){b=q+1<<24>>24;a[ca>>0]=b;if(!(b<<24>>24)){b=r+1<<24>>24;a[da>>0]=b;if(!(b<<24>>24)){x=k+1<<24>>24;a[ea>>0]=x;if(!(x<<24>>24)){h=h+1<<24>>24;a[fa>>0]=h;if(!(h<<24>>24)){g=g+1<<24>>24;a[ga>>0]=g;if(!(g<<24>>24)){f=f+1<<24>>24;a[ha>>0]=f;if(!(f<<24>>24)){a[na>>0]=j+1<<24>>24;r=0;q=0;f=0;g=0;h=0;i=0;b=0}else{r=0;q=0;g=0;h=0;i=0;b=0}}else{r=0;q=0;h=0;i=0;b=0}}else{r=0;q=0;i=0;b=0}}else{r=0;q=0;i=0;b=0}}else{r=b;q=0;i=b;b=0}}else q=b}j=c[na>>2]|0;c[e>>2]=j^c[ma>>2];k=c[C>>2]|0;c[D>>2]=k^c[B>>2];w=ja;u=w;u=d[u>>0]|d[u+1>>0]<<8|d[u+2>>0]<<16|d[u+3>>0]<<24;w=w+4|0;w=d[w>>0]|d[w+1>>0]<<8|d[w+2>>0]<<16|d[w+3>>0]<<24;x=n;v=x;a[v>>0]=u;a[v+1>>0]=u>>8;a[v+2>>0]=u>>16;a[v+3>>0]=u>>24;x=x+4|0;a[x>>0]=w;a[x+1>>0]=w>>8;a[x+2>>0]=w>>16;a[x+3>>0]=w>>24;t=t+1|0;k=k&255;j=j&255}while(t>>>0<=la>>>0);x=j;s=k;u=k;w=j;v=j;t=k}else{w=1;while(1){qa=ka;x=qa;x=d[x>>0]|d[x+1>>0]<<8|d[x+2>>0]<<16|d[x+3>>0]<<24;qa=qa+4|0;qa=d[qa>>0]|d[qa+1>>0]<<8|d[qa+2>>0]<<16|d[qa+3>>0]<<24;u=ma;sa=u;a[sa>>0]=x;a[sa+1>>0]=x>>8;a[sa+2>>0]=x>>16;a[sa+3>>0]=x>>24;u=u+4|0;a[u>>0]=qa;a[u+1>>0]=qa>>8;a[u+2>>0]=qa>>16;a[u+3>>0]=qa>>24;u=e+(w<<3)|0;qa=u;sa=qa;sa=d[sa>>0]|d[sa+1>>0]<<8|d[sa+2>>0]<<16|d[sa+3>>0]<<24;qa=qa+4|0;qa=d[qa>>0]|d[qa+1>>0]<<8|d[qa+2>>0]<<16|d[qa+3>>0]<<24;x=ja;ra=x;a[ra>>0]=sa;a[ra+1>>0]=sa>>8;a[ra+2>>0]=sa>>16;a[ra+3>>0]=sa>>24;x=x+4|0;a[x>>0]=qa;a[x+1>>0]=qa>>8;a[x+2>>0]=qa>>16;a[x+3>>0]=qa>>24;x=pb[c[(c[oa>>2]|0)+36>>2]&63](z,ma,ma)|0;o=x>>>0>o>>>0?x:o;p=p+1<<24>>24;a[F>>0]=p;if(!(p<<24>>24)){b=b+1<<24>>24;a[G>>0]=b;if(!(b<<24>>24)){b=i+1<<24>>24;a[H>>0]=b;if(!(b<<24>>24)){b=t+1<<24>>24;a[I>>0]=b;if(!(b<<24>>24)){h=h+1<<24>>24;a[J>>0]=h;if(!(h<<24>>24)){g=g+1<<24>>24;a[K>>0]=g;if(!(g<<24>>24)){f=f+1<<24>>24;a[L>>0]=f;if(!(f<<24>>24)){j=v+1<<24>>24;a[na>>0]=j;k=j;f=0;g=0;h=0;n=0;s=0;r=0;q=0;i=0;b=0}else{g=0;h=0;n=0;s=0;r=0;q=0;i=0;b=0}}else{h=0;n=0;s=0;r=0;q=0;i=0;b=0}}else{n=0;s=0;r=0;q=0;i=0;b=0}}else{n=b;s=b;r=0;q=0;i=0;b=0}}else{r=b;q=0;i=b;b=0}}else q=b}a[e>>0]=k^a[ma>>0];a[M>>0]=f^a[E>>0];a[O>>0]=g^a[N>>0];a[Q>>0]=h^a[P>>0];a[S>>0]=n^a[R>>0];a[V>>0]=a[U>>0]^a[T>>0];a[Y>>0]=a[X>>0]^a[W>>0];a[aa>>0]=a[_>>0]^a[Z>>0];ra=ja;x=ra;x=d[x>>0]|d[x+1>>0]<<8|d[x+2>>0]<<16|d[x+3>>0]<<24;ra=ra+4|0;ra=d[ra>>0]|d[ra+1>>0]<<8|d[ra+2>>0]<<16|d[ra+3>>0]<<24;sa=u;qa=sa;a[qa>>0]=x;a[qa+1>>0]=x>>8;a[qa+2>>0]=x>>16;a[qa+3>>0]=x>>24;sa=sa+4|0;a[sa>>0]=ra;a[sa+1>>0]=ra>>8;a[sa+2>>0]=ra>>16;a[sa+3>>0]=ra>>24;w=w+1|0;if(w>>>0>la>>>0){x=j;u=n;w=k;v=k;t=n;break}else{t=n;v=k}}}else{x=j;u=n;w=k}y=y+1|0;if((y|0)==6)break;else{j=x;n=u;k=w}}if(!o){sa=0;l=pa;return sa|0}Te(o+16|0);sa=0;l=pa;return sa|0}function Vl(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0;la=l;l=l+16|0;if((l|0)>=(m|0))$(16);ja=la;ka=b+12|0;if((c[(c[ka>>2]|0)+20>>2]|0)!=16){ka=139;l=la;return ka|0}if((f+8|0)>>>0>>0){ka=200;l=la;return ka|0}if(h>>>0<24|(h&7|0)!=0){ka=45;l=la;return ka|0}ha=b+96|0;ia=b+80|0;p=g;B=p;B=d[B>>0]|d[B+1>>0]<<8|d[B+2>>0]<<16|d[B+3>>0]<<24;p=p+4|0;p=d[p>>0]|d[p+1>>0]<<8|d[p+2>>0]<<16|d[p+3>>0]<<24;A=ha;q=A;a[q>>0]=B;a[q+1>>0]=B>>8;a[q+2>>0]=B>>16;a[q+3>>0]=B>>24;A=A+4|0;a[A>>0]=p;a[A+1>>0]=p>>8;a[A+2>>0]=p>>16;a[A+3>>0]=p>>24;dr(e|0,g+8|0,h+-8|0)|0;A=(h>>>3)+-1|0;p=A*6|0;q=p&255;B=ja+7|0;a[B>>0]=q;o=p>>>8&255;C=ja+6|0;a[C>>0]=o;i=p>>>16&255;D=ja+5|0;a[D>>0]=i;p=p>>>24&255;E=ja+4|0;a[E>>0]=p;c[ja>>2]=0;F=(A|0)==0;G=((ha|ia)&3|0)==0;H=b+100|0;I=ia+4|0;J=b+88|0;K=b+496|0;L=ja+3|0;M=ja+2|0;N=ja+1|0;O=b+97|0;P=ia+1|0;Q=b+98|0;R=ia+2|0;S=b+99|0;T=ia+3|0;U=b+100|0;V=ia+4|0;W=b+101|0;X=ja+5|0;Y=ia+5|0;Z=b+102|0;_=ja+6|0;aa=ia+6|0;ba=b+103|0;ca=ja+7|0;da=ia+7|0;ea=ja+3|0;fa=ja+2|0;ga=ja+1|0;f=0;z=5;s=0;h=p;j=0;k=0;n=0;g=0;while(1){if(!F)if(G){x=A;g=q;q=o;p=i;s=j;t=k;u=n;while(1){h=c[ja>>2]|0;c[ia>>2]=h^c[ha>>2];y=c[E>>2]|0;c[I>>2]=y^c[H>>2];v=e+((x<<3)+-8)|0;w=v;n=w;n=d[n>>0]|d[n+1>>0]<<8|d[n+2>>0]<<16|d[n+3>>0]<<24;w=w+4|0;w=d[w>>0]|d[w+1>>0]<<8|d[w+2>>0]<<16|d[w+3>>0]<<24;r=J;o=r;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24;r=r+4|0;a[r>>0]=w;a[r+1>>0]=w>>8;a[r+2>>0]=w>>16;a[r+3>>0]=w>>24;r=pb[c[(c[ka>>2]|0)+40>>2]&63](K,ia,ia)|0;r=r>>>0>f>>>0?r:f;w=g+-1<<24>>24;a[B>>0]=w;h=h&255;f=y&255;if(!(g<<24>>24)){o=q+-1<<24>>24;a[C>>0]=o;if(!(q<<24>>24)){i=p+-1<<24>>24;a[D>>0]=i;if(!(p<<24>>24)){g=f+-1<<24>>24;a[E>>0]=g;if(!(f<<24>>24)){j=s+-1<<24>>24;a[L>>0]=j;if(!(s<<24>>24)){k=t+-1<<24>>24;a[M>>0]=k;if(!(t<<24>>24)){n=u+-1<<24>>24;a[N>>0]=n;if(!(u<<24>>24)){h=h+-1<<24>>24;a[ja>>0]=h;f=g}else f=g}else{f=g;n=u}}else{f=g;k=t;n=u}}else{f=g;j=s;k=t;n=u}}else{j=s;k=t;n=u}}else{i=p;j=s;k=t;n=u}}else{i=p;o=q;j=s;k=t;n=u}t=ia;s=t;s=d[s>>0]|d[s+1>>0]<<8|d[s+2>>0]<<16|d[s+3>>0]<<24;t=t+4|0;t=d[t>>0]|d[t+1>>0]<<8|d[t+2>>0]<<16|d[t+3>>0]<<24;u=ha;y=u;a[y>>0]=s;a[y+1>>0]=s>>8;a[y+2>>0]=s>>16;a[y+3>>0]=s>>24;u=u+4|0;a[u>>0]=t;a[u+1>>0]=t>>8;a[u+2>>0]=t>>16;a[u+3>>0]=t>>24;u=J;t=u;t=d[t>>0]|d[t+1>>0]<<8|d[t+2>>0]<<16|d[t+3>>0]<<24;u=u+4|0;u=d[u>>0]|d[u+1>>0]<<8|d[u+2>>0]<<16|d[u+3>>0]<<24;y=v;v=y;a[v>>0]=t;a[v+1>>0]=t>>8;a[v+2>>0]=t>>16;a[v+3>>0]=t>>24;y=y+4|0;a[y>>0]=u;a[y+1>>0]=u>>8;a[y+2>>0]=u>>16;a[y+3>>0]=u>>24;x=x+-1|0;if(!x){s=h;u=f;q=w;p=f;g=h;break}else{f=r;g=w;q=o;p=i;s=j;t=k;u=n}}}else{y=A;x=g;g=q;while(1){a[ia>>0]=x^a[ha>>0];a[P>>0]=n^a[O>>0];a[R>>0]=k^a[Q>>0];a[T>>0]=j^a[S>>0];a[V>>0]=p^a[U>>0];a[Y>>0]=a[X>>0]^a[W>>0];a[aa>>0]=a[_>>0]^a[Z>>0];a[da>>0]=a[ca>>0]^a[ba>>0];v=e+((y<<3)+-8)|0;w=v;r=w;r=d[r>>0]|d[r+1>>0]<<8|d[r+2>>0]<<16|d[r+3>>0]<<24;w=w+4|0;w=d[w>>0]|d[w+1>>0]<<8|d[w+2>>0]<<16|d[w+3>>0]<<24;u=J;t=u;a[t>>0]=r;a[t+1>>0]=r>>8;a[t+2>>0]=r>>16;a[t+3>>0]=r>>24;u=u+4|0;a[u>>0]=w;a[u+1>>0]=w>>8;a[u+2>>0]=w>>16;a[u+3>>0]=w>>24;u=pb[c[(c[ka>>2]|0)+40>>2]&63](K,ia,ia)|0;u=u>>>0>f>>>0?u:f;w=g+-1<<24>>24;a[B>>0]=w;if(!(g<<24>>24)){t=o+-1<<24>>24;a[C>>0]=t;if(!(o<<24>>24)){f=i+-1<<24>>24;a[D>>0]=f;if(!(i<<24>>24)){g=h+-1<<24>>24;a[E>>0]=g;if(!(h<<24>>24)){p=j+-1<<24>>24;a[ea>>0]=p;if(!(j<<24>>24)){q=k+-1<<24>>24;a[fa>>0]=q;if(!(k<<24>>24)){r=n+-1<<24>>24;a[ga>>0]=r;if(!(n<<24>>24)){x=s+-1<<24>>24;a[ja>>0]=x;s=x;h=g;i=f;o=t;t=g;j=p;k=q;n=r;g=x}else{h=g;i=f;o=t;t=g;j=p;k=q;n=r;g=x}}else{h=g;i=f;o=t;t=g;j=p;k=q;g=x}}else{h=g;i=f;o=t;t=g;j=p;g=x}}else{h=g;i=f;o=t;t=g;g=x}}else{i=f;o=t;t=p;g=x}}else{o=t;t=p;g=x}}else{t=p;g=x}q=ia;p=q;p=d[p>>0]|d[p+1>>0]<<8|d[p+2>>0]<<16|d[p+3>>0]<<24;q=q+4|0;q=d[q>>0]|d[q+1>>0]<<8|d[q+2>>0]<<16|d[q+3>>0]<<24;r=ha;x=r;a[x>>0]=p;a[x+1>>0]=p>>8;a[x+2>>0]=p>>16;a[x+3>>0]=p>>24;r=r+4|0;a[r>>0]=q;a[r+1>>0]=q>>8;a[r+2>>0]=q>>16;a[r+3>>0]=q>>24;r=J;q=r;q=d[q>>0]|d[q+1>>0]<<8|d[q+2>>0]<<16|d[q+3>>0]<<24;r=r+4|0;r=d[r>>0]|d[r+1>>0]<<8|d[r+2>>0]<<16|d[r+3>>0]<<24;x=v;v=x;a[v>>0]=q;a[v+1>>0]=q>>8;a[v+2>>0]=q>>16;a[v+3>>0]=q>>24;x=x+4|0;a[x>>0]=r;a[x+1>>0]=r>>8;a[x+2>>0]=r>>16;a[x+3>>0]=r>>24;y=y+-1|0;if(!y){r=u;u=h;q=w;p=t;break}else{f=u;x=g;p=t;g=w}}}else{r=f;u=h}if((z|0)>0){f=r;z=z+-1|0;h=u}else break}if(!(a[b+56>>0]&2))if(((((((a[ha>>0]|0)==-90?(a[b+97>>0]|0)==-90:0)?(a[b+98>>0]|0)==-90:0)?(a[b+99>>0]|0)==-90:0)?(a[H>>0]|0)==-90:0)?(a[b+101>>0]|0)==-90:0)?(a[b+102>>0]|0)==-90:0)f=(a[b+103>>0]|0)!=-90&1;else f=1;else f=Tp(ha,b+64|0,8)|0;if(r|0)Te(r+16|0);ka=f|0?10:0;l=la;return ka|0}function Wl(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=c[b+12>>2]|0;h=c[w+20>>2]|0;w=c[w+36>>2]|0;j=(g>>>0)/(h>>>0)|0;t=b+52|0;i=c[t>>2]|0;k=i&8;if((k|0?h:g)>>>0>e>>>0){w=200;return w|0}u=(g>>>0)%(h>>>0)|0;v=(u|0)==0;if(!v){e=i&4;if(h>>>0>=g>>>0|(e|0)==0){w=139;return w|0}}else e=i&4;s=h>>>0>>0;r=((v&(s&(e|0)!=0))<<31>>31)+j|0;e=c[b+28>>2]|0;if(!e){g=b+64|0;if(r){q=h+-4|0;p=q&-4;o=p+4|0;p=q-p|0;q=b+496|0;if(h>>>0>3){e=0;i=g;n=0;while(1){if(!((f|i|d)&3)){m=i+o|0;j=f;k=d;l=h;while(1){c[k>>2]=c[i>>2]^c[j>>2];l=l+-4|0;if(l>>>0<=3)break;else{i=i+4|0;j=j+4|0;k=k+4|0}}i=m;k=f+o|0;l=d+o|0;j=p}else{k=f;l=d;j=h}if(j|0)while(1){a[l>>0]=a[i>>0]^a[k>>0];j=j+-1|0;if(!j)break;else{i=i+1|0;k=k+1|0;l=l+1|0}}i=pb[w&63](q,d,d)|0;e=i>>>0>e>>>0?i:e;f=f+h|0;i=c[t>>2]|0;j=(i&8|0)==0?d+h|0:d;n=n+1|0;if(n>>>0>=r>>>0){p=j;o=f;break}else{i=d;d=j}}}else{n=(h|0)==0;e=0;i=g;m=0;while(1){if(!n){j=f;k=d;l=h;while(1){a[k>>0]=a[i>>0]^a[j>>0];l=l+-1|0;if(!l)break;else{i=i+1|0;j=j+1|0;k=k+1|0}}}k=pb[w&63](q,d,d)|0;e=k>>>0>e>>>0?k:e;k=f+h|0;i=c[t>>2]|0;j=(i&8|0)==0?d+h|0:d;m=m+1|0;if(m>>>0>=r>>>0){p=j;o=k;break}else{i=d;d=j;f=k}}}if((d|0)!=(g|0)){if(!((d|g)&3))if(h>>>0>3){l=h+-4|0;f=l&-4;n=f+4|0;m=d+n|0;j=g;k=h;while(1){c[j>>2]=c[d>>2];k=k+-4|0;if(k>>>0<=3)break;else{d=d+4|0;j=j+4|0}}j=l-f|0;d=m;g=g+n|0}else j=h;else j=h;if(j){i=j;while(1){a[g>>0]=a[d>>0]|0;i=i+-1|0;if(!i)break;else{d=d+1|0;g=g+1|0}}f=o;g=p;i=c[t>>2]|0}else{f=o;g=p}}else{f=o;g=p}}else{e=0;g=d}}else{xb[e&1](b+496|0,b+64|0,d,f,r,k);g=S(r,h)|0;i=c[t>>2]|0;e=0;f=f+g|0;g=(i&8|0)==0?d+g|0:d}if(s&(i&4|0)!=0){j=v?h:u;g=g+(0-h)|0;i=b+64|0;if(!j){j=0;d=i}else{l=j+64|0;d=0;k=i;while(1){u=a[f+d>>0]|0;v=g+d|0;a[g+(d+h)>>0]=a[v>>0]|0;a[v>>0]=a[k>>0]^u;d=d+1|0;if((d|0)==(j|0))break;else k=k+1|0}d=b+l|0}if(j>>>0>>0)while(1){a[g+j>>0]=a[d>>0]|0;j=j+1|0;if((j|0)==(h|0))break;else d=d+1|0}w=pb[w&63](b+496|0,g,g)|0;e=w>>>0>e>>>0?w:e;if(!((g|i)&3))if(h>>>0>3){j=h+-4|0;k=j&-4;f=k+4|0;l=g+f|0;d=i;while(1){c[d>>2]=c[g>>2];h=h+-4|0;if(h>>>0<=3)break;else{g=g+4|0;d=d+4|0}}h=j-k|0;g=l;i=i+f|0}if(h)while(1){a[i>>0]=a[g>>0]|0;h=h+-1|0;if(!h)break;else{g=g+1|0;i=i+1|0}}}if(!e){w=0;return w|0}Te(e+16|0);w=0;return w|0}function Xl(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=c[b+12>>2]|0;j=c[F+20>>2]|0;F=c[F+40>>2]|0;i=(g>>>0)/(j>>>0)|0;if(e>>>0>>0){b=200;return b|0}D=(g>>>0)%(j>>>0)|0;E=(D|0)==0;if(!E){if(j>>>0>=g>>>0){b=139;return b|0}e=b+52|0;h=c[e>>2]|0;if(!(h&4)){b=139;return b|0}else C=e}else{h=b+52|0;C=h;h=c[h>>2]|0}B=j>>>0>>0;if(B&(h&4|0)!=0){i=(E?-2:-1)+i|0;h=b+96|0;g=b+64|0;if(!((g|h)&3))if(j>>>0>3){k=j+-4|0;l=k&-4;n=l+4|0;m=g+n|0;e=j;while(1){c[h>>2]=c[g>>2];e=e+-4|0;if(e>>>0<=3)break;else{g=g+4|0;h=h+4|0}}e=k-l|0;g=m;h=b+96+n|0}else e=j;else e=j;if(e)while(1){a[h>>0]=a[g>>0]|0;e=e+-1|0;if(!e)break;else{g=g+1|0;h=h+1|0}}}e=c[b+32>>2]|0;do if(!e)if(!i){e=0;q=f}else{w=b+496|0;x=b+96|0;y=b+64|0;r=y|x;z=j+-4|0;t=z&-4;s=t+4|0;u=b+96+s|0;v=y+s|0;t=z-t|0;z=S(i,j)|0;A=f+z|0;if(j>>>0>3){e=0;p=d;q=0;o=f}else{q=(j|0)==0;e=0;o=d;p=0;h=f;while(1){f=pb[F&63](w,x,h)|0;e=f>>>0>e>>>0?f:e;if(!q){g=o;k=y;l=h;m=x;n=j;while(1){f=a[l>>0]|0;a[g>>0]=a[m>>0]^a[k>>0];a[k>>0]=f;n=n+-1|0;if(!n)break;else{g=g+1|0;k=k+1|0;l=l+1|0;m=m+1|0}}}p=p+1|0;if((p|0)==(i|0))break;else{o=o+j|0;h=h+j|0}}d=d+z|0;q=A;break}while(1){f=pb[F&63](w,x,o)|0;e=f>>>0>e>>>0?f:e;if(!((r|o|p)&3)){n=o+s|0;h=x;g=o;k=y;l=p;m=j;while(1){f=c[g>>2]|0;c[l>>2]=c[h>>2]^c[k>>2];c[k>>2]=f;m=m+-4|0;if(m>>>0<=3)break;else{h=h+4|0;g=g+4|0;k=k+4|0;l=l+4|0}}g=p+s|0;l=v;m=n;k=u;h=t}else{g=p;l=y;m=o;k=x;h=j}if(h|0)while(1){f=a[m>>0]|0;a[g>>0]=a[k>>0]^a[l>>0];a[l>>0]=f;h=h+-1|0;if(!h)break;else{g=g+1|0;l=l+1|0;m=m+1|0;k=k+1|0}}q=q+1|0;if((q|0)==(i|0))break;else{p=p+j|0;o=o+j|0}}d=d+z|0;q=A}else{qb[e&15](b+496|0,b+64|0,d,f,i);q=S(i,j)|0;e=0;d=d+q|0;q=f+q|0}while(0);if(B&(c[C>>2]&4|0)!=0){t=E?j:D;h=b+96|0;u=b+64|0;v=h;p=u;if(!((p|v)&3))if(j>>>0>3){m=j+-4|0;n=m&-4;o=n+4|0;i=u+o|0;g=u;k=h;l=j;while(1){c[k>>2]=c[g>>2];l=l+-4|0;if(l>>>0<=3)break;else{g=g+4|0;k=k+4|0}}g=m-n|0;k=b+96+o|0}else{g=j;i=u;k=h}else{i=u;k=h;g=j}if(g|0)while(1){a[k>>0]=a[i>>0]|0;g=g+-1|0;if(!g)break;else{i=i+1|0;k=k+1|0}}i=q+j|0;if(!((i|p)&3))if(t>>>0>3){l=t+-4|0;m=l&-4;o=m+4|0;n=i+o|0;g=u;k=t;while(1){c[g>>2]=c[i>>2];k=k+-4|0;if(k>>>0<=3)break;else{i=i+4|0;g=g+4|0}}g=l-m|0;i=n;k=u+o|0}else{g=t;k=u}else{k=u;g=t}if(g|0)while(1){a[k>>0]=a[i>>0]|0;g=g+-1|0;if(!g)break;else{i=i+1|0;k=k+1|0}}s=b+496|0;q=pb[F&63](s,d,q)|0;q=q>>>0>e>>>0?q:e;r=d;if(!((r|p)&3))if(t>>>0>3){l=t+-4|0;m=l&-4;n=m+4|0;g=d+n|0;e=u;i=d;k=t;while(1){c[i>>2]=c[e>>2]^c[i>>2];k=k+-4|0;if(k>>>0<=3)break;else{e=e+4|0;i=i+4|0}}l=l-m|0;e=u+n|0}else{l=t;e=u;g=d}else{e=u;g=d;l=t}if(l|0){k=g;i=g;g=l;while(1){a[i>>0]=a[e>>0]^a[k>>0];g=g+-1|0;if(!g)break;else{e=e+1|0;k=k+1|0;i=i+1|0}}}g=d+j|0;if(!((g|r)&3))if(t>>>0>3){m=t+-4|0;n=m&-4;o=n+4|0;i=d+o|0;e=d;k=g;l=t;while(1){c[k>>2]=c[e>>2];l=l+-4|0;if(l>>>0<=3)break;else{e=e+4|0;k=k+4|0}}e=m-n|0;g=g+o|0}else{e=t;i=d}else{i=d;e=t}if(e|0)while(1){a[g>>0]=a[i>>0]|0;e=e+-1|0;if(!e)break;else{i=i+1|0;g=g+1|0}}if(t>>>0>>0){e=t;do{a[u+e>>0]=a[d+e>>0]|0;e=e+1|0}while((e|0)!=(j|0))}e=pb[F&63](s,d,u)|0;e=e>>>0>q>>>0?e:q;if(!((r|v)&3))if(j>>>0>3){g=j+-4|0;i=g&-4;k=i+4|0;l=d+k|0;while(1){c[d>>2]=c[h>>2]^c[d>>2];j=j+-4|0;if(j>>>0<=3)break;else{h=h+4|0;d=d+4|0}}j=g-i|0;h=b+96+k|0;d=l}if(j){i=d;g=d;d=j;while(1){a[g>>0]=a[h>>0]^a[i>>0];d=d+-1|0;if(!d)break;else{h=h+1|0;i=i+1|0;g=g+1|0}}}}if(!e){b=0;return b|0}Te(e+16|0);b=0;return b|0}function Yl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;h=15-e|0;if(!d){k=45;return k|0}if((h+-2|0)>>>0>6){k=139;return k|0}Yq(b+128|0,0,368)|0;c[b+56>>2]=0;i=b+64|0;f=b+80|0;g=h+255&255;j=i;k=j+52|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(k|0));a[f>>0]=g;cr(f+1|0,d|0,e|0)|0;k=e+1|0;Yq(f+k|0,0,h|0)|0;a[i>>0]=g;cr(i+1|0,d|0,e|0)|0;Yq(i+k|0,0,h|0)|0;k=b+184|0;a[k>>0]=a[k>>0]|1;k=0;return k|0}function Zl(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0;wa=l;l=l+16|0;if((l|0)>=(m|0))$(16);sa=wa;ta=c[(c[b+12>>2]|0)+36>>2]|0;va=b+164|0;g=c[va>>2]|0;if(!e)if((f|0)!=0&(g|0)!=0)e=0;else{va=0;l=wa;return va|0}n=(f|0)==0;o=b+148|0;p=b+64|0;q=p;r=((q|o)&3|0)==0;s=p+4|0;t=b+152|0;u=b+72|0;v=b+156|0;w=b+76|0;x=b+160|0;y=b+496|0;z=b+28|0;A=(sa&7|0)==0;B=p+1|0;C=b+149|0;D=p+2|0;E=b+150|0;F=p+3|0;G=b+151|0;H=p+4|0;I=b+152|0;J=p+5|0;K=b+153|0;L=p+6|0;M=b+154|0;N=p+7|0;O=b+155|0;P=b+72|0;Q=b+156|0;R=b+73|0;S=b+157|0;T=b+74|0;U=b+158|0;V=b+75|0;W=b+159|0;X=b+76|0;Y=b+160|0;Z=b+77|0;_=b+161|0;aa=b+78|0;ba=b+162|0;ca=b+79|0;da=b+163|0;ea=p+1|0;fa=p+2|0;ga=p+3|0;ha=p+4|0;ia=p+5|0;ja=p+6|0;ka=p+7|0;la=b+72|0;ma=b+73|0;na=b+74|0;oa=b+75|0;pa=b+76|0;qa=b+77|0;ra=b+78|0;k=b+79|0;f=d;b=e;e=0;while(1){if((g|0)!=0|(b+g|0)>>>0<16){if(g>>>0<16&(b|0)!=0)while(1){d=f+1|0;h=g+1|0;a[o+g>>0]=a[f>>0]|0;g=b+-1|0;if(h>>>0<16&(g|0)!=0){b=g;g=h;f=d}else{f=d;b=g;g=h;break}}}else g=0;if(!b){if(n)break;if(g>>>0<16){Yq(o+g|0,0,16-g|0)|0;ua=12}else ua=12}else if(g)ua=12;if((ua|0)==12){ua=0;if(r){c[p>>2]=c[o>>2]^c[p>>2];c[s>>2]=c[t>>2]^c[s>>2];c[u>>2]=c[v>>2]^c[u>>2];c[w>>2]=c[x>>2]^c[w>>2]}else{a[p>>0]=a[o>>0]^a[p>>0];a[B>>0]=a[C>>0]^a[B>>0];a[D>>0]=a[E>>0]^a[D>>0];a[F>>0]=a[G>>0]^a[F>>0];a[H>>0]=a[I>>0]^a[H>>0];a[J>>0]=a[K>>0]^a[J>>0];a[L>>0]=a[M>>0]^a[L>>0];a[N>>0]=a[O>>0]^a[N>>0];a[P>>0]=a[Q>>0]^a[P>>0];a[R>>0]=a[S>>0]^a[R>>0];a[T>>0]=a[U>>0]^a[T>>0];a[V>>0]=a[W>>0]^a[V>>0];a[X>>0]=a[Y>>0]^a[X>>0];a[Z>>0]=a[_>>0]^a[Z>>0];a[aa>>0]=a[ba>>0]^a[aa>>0];a[ca>>0]=a[da>>0]^a[ca>>0]}j=pb[ta&63](y,p,p)|0;e=e>>>0>j>>>0?e:j}g=c[z>>2]|0;if(!g)if(b>>>0>15){d=b+-16|0;h=d&-16;g=f+16|0;while(1){if(!((f|q)&3)){c[p>>2]=c[f>>2]^c[p>>2];c[s>>2]=c[f+4>>2]^c[s>>2];c[u>>2]=c[f+8>>2]^c[u>>2];c[w>>2]=c[f+12>>2]^c[w>>2]}else{a[p>>0]=a[f>>0]^a[p>>0];a[ea>>0]=a[f+1>>0]^a[ea>>0];a[fa>>0]=a[f+2>>0]^a[fa>>0];a[ga>>0]=a[f+3>>0]^a[ga>>0];a[ha>>0]=a[f+4>>0]^a[ha>>0];a[ia>>0]=a[f+5>>0]^a[ia>>0];a[ja>>0]=a[f+6>>0]^a[ja>>0];a[ka>>0]=a[f+7>>0]^a[ka>>0];a[la>>0]=a[f+8>>0]^a[la>>0];a[ma>>0]=a[f+9>>0]^a[ma>>0];a[na>>0]=a[f+10>>0]^a[na>>0];a[oa>>0]=a[f+11>>0]^a[oa>>0];a[pa>>0]=a[f+12>>0]^a[pa>>0];a[qa>>0]=a[f+13>>0]^a[qa>>0];a[ra>>0]=a[f+14>>0]^a[ra>>0];a[k>>0]=a[f+15>>0]^a[k>>0]}j=pb[ta&63](y,p,p)|0;e=e>>>0>j>>>0?e:j;b=b+-16|0;if(b>>>0<=15)break;else f=f+16|0}f=g+h|0;g=d-h|0}else g=b;else{j=b>>>4;xb[g&1](y,p,sa,f,j,1);g=j<<4;j=f+g|0;g=b-g|0;if(!A){f=16;b=sa;do{a[b>>0]=0;b=b+1|0;f=f+-1|0}while((f|0)!=0&(b&7|0)!=0);if(f>>>0>=8)ua=22}else{f=16;b=sa;ua=22}if((ua|0)==22){ua=0;d=f+-8|0;h=d&-8;i=b+8|0;while(1){xa=b;c[xa>>2]=0;c[xa+4>>2]=0;f=f+-8|0;if(f>>>0<=7)break;else b=b+8|0}f=d-h|0;b=i+h|0}if(!f)f=j;else while(1){a[b>>0]=0;f=f+-1|0;if(!f){f=j;break}else b=b+1|0}}if(!g){g=0;break}else{b=g;g=0}}c[va>>2]=g;xa=(e|0)==0?0:e+16|0;l=wa;return xa|0}function _l(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;if(e>>>0>>0){g=200;return g|0}h=a[b+184>>0]|0;if(!(h&1)){g=156;return g|0}if((h&2)==0|(a[b+56>>0]&4)!=0){g=156;return g|0}j=b+136|0;if(!((c[j>>2]|0)==0&(c[j+4>>2]|0)==0)){g=156;return g|0}h=b+128|0;j=h;i=c[j>>2]|0;j=c[j+4>>2]|0;if(j>>>0<0|(j|0)==0&i>>>0>>0){g=139;return g|0}j=Xq(i|0,j|0,g|0,0)|0;c[h>>2]=j;c[h+4>>2]=D;h=Zl(b,f,g,0)|0;if(h|0)Te(h+20|0);g=dm(b,d,e,f,g)|0;return g|0}function $l(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;if(e>>>0>>0){g=200;return g|0}h=a[b+184>>0]|0;if(!(h&1)){g=156;return g|0}if((h&2)==0|(a[b+56>>0]&4)!=0){g=156;return g|0}i=b+136|0;if(!((c[i>>2]|0)==0&(c[i+4>>2]|0)==0)){g=156;return g|0}i=b+128|0;h=i;j=c[h+4>>2]|0;if(0>j>>>0|(0==(j|0)?g>>>0>(c[h>>2]|0)>>>0:0)){j=139;return j|0}h=dm(b,d,e,f,g)|0;if(h|0){j=h;return j|0}j=i;j=Xq(c[j>>2]|0,c[j+4>>2]|0,g|0,0)|0;h=i;c[h>>2]=j;c[h+4>>2]=D;h=Zl(b,d,g,0)|0;if(!h){j=0;return j|0}Te(h+20|0);j=0;return j|0}function am(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;u=c[b+12>>2]|0;t=c[u+36>>2]|0;u=c[u+20>>2]|0;s=u<<1;if(e>>>0>>0){v=200;return v|0}v=b+112|0;e=c[v>>2]|0;if(e>>>0>=g>>>0){h=b+64+u+(0-e)|0;if(!((f|d|h)&3))if(g>>>0>3){l=g+-4|0;m=l&-4;o=m+4|0;n=h+o|0;k=f;i=d;j=g;while(1){u=c[h>>2]^c[k>>2];c[h>>2]=u;c[i>>2]=u;j=j+-4|0;if(j>>>0<=3)break;else{k=k+4|0;h=h+4|0;i=i+4|0}}i=l-m|0;f=f+o|0;h=n;d=d+o|0}else i=g;else i=g;if(i){e=i;while(1){u=a[h>>0]^a[f>>0];a[h>>0]=u;a[d>>0]=u;e=e+-1|0;if(!e)break;else{f=f+1|0;h=h+1|0;d=d+1|0}}e=c[v>>2]|0}c[v>>2]=e-g;v=0;return v|0}if(e){g=g-e|0;i=b+64+u+(0-e)|0;if(e>>>0>3&((f|d|i)&3|0)==0){l=e+-4|0;m=l&-4;o=m+4|0;n=i+o|0;k=f;h=d;j=e;while(1){r=c[i>>2]^c[k>>2];c[i>>2]=r;c[h>>2]=r;j=j+-4|0;if(j>>>0<=3)break;else{k=k+4|0;i=i+4|0;h=h+4|0}}j=l-m|0;if(j){k=f+o|0;i=n;h=d+o|0;e=j;p=18}}else{k=f;h=d;p=18}if((p|0)==18){while(1){r=a[i>>0]^a[k>>0];a[i>>0]=r;a[h>>0]=r;e=e+-1|0;if(!e)break;else{k=k+1|0;i=i+1|0;h=h+1|0;p=18}}e=c[v>>2]|0}c[v>>2]=0;d=d+e|0;f=f+e|0}a:do if(g>>>0>>0)e=0;else{e=c[b+20>>2]|0;if(e|0){s=(g>>>0)/(u>>>0)|0;qb[e&15](b+496|0,b+64|0,d,f,s);s=S(s,u)|0;e=0;d=d+s|0;f=f+s|0;g=g-s|0;break}q=b+496|0;r=b+64|0;n=r;l=u+-4|0;m=l&-4;o=m+4|0;p=r+o|0;m=l-m|0;if(u>>>0>3)e=0;else{l=(u|0)==0;e=0;while(1){p=pb[t&63](q,r,r)|0;e=p>>>0>e>>>0?p:e;if(!l){h=f;i=r;j=d;k=u;while(1){p=a[i>>0]^a[h>>0];a[i>>0]=p;a[j>>0]=p;k=k+-1|0;if(!k)break;else{h=h+1|0;i=i+1|0;j=j+1|0}}}d=d+u|0;f=f+u|0;g=g-u|0;if(g>>>0>>0)break a}}do{l=pb[t&63](q,r,r)|0;e=l>>>0>e>>>0?l:e;if(!((f|n|d)&3)){h=f+o|0;i=f;j=r;k=d;l=u;while(1){w=c[j>>2]^c[i>>2];c[j>>2]=w;c[k>>2]=w;l=l+-4|0;if(l>>>0<=3)break;else{i=i+4|0;j=j+4|0;k=k+4|0}}j=p;k=d+o|0;i=m}else{h=f;j=r;k=d;i=u}if(i|0)while(1){w=a[j>>0]^a[h>>0];a[j>>0]=w;a[k>>0]=w;i=i+-1|0;if(!i)break;else{h=h+1|0;j=j+1|0;k=k+1|0}}d=d+u|0;f=f+u|0;g=g-u|0}while(g>>>0>=s>>>0)}while(0);if(g>>>0>=u>>>0){i=b+96|0;j=b+64|0;p=j;if(!((p|i)&3))if(u>>>0>3){m=u+-4|0;n=m&-4;o=n+4|0;k=j+o|0;l=j;h=u;while(1){c[i>>2]=c[l>>2];h=h+-4|0;if(h>>>0<=3)break;else{l=l+4|0;i=i+4|0}}h=m-n|0;i=b+96+o|0}else{h=u;k=j}else{k=j;h=u}if(h|0)while(1){a[i>>0]=a[k>>0]|0;h=h+-1|0;if(!h)break;else{k=k+1|0;i=i+1|0}}w=pb[t&63](b+496|0,j,j)|0;e=w>>>0>e>>>0?w:e;if(!((f|p|d)&3))if(u>>>0>3){l=u+-4|0;m=l&-4;o=m+4|0;n=j+o|0;k=f;h=d;i=u;while(1){w=c[j>>2]^c[k>>2];c[j>>2]=w;c[h>>2]=w;i=i+-4|0;if(i>>>0<=3)break;else{k=k+4|0;j=j+4|0;h=h+4|0}}h=l-m|0;k=f+o|0;j=n;i=d+o|0}else{h=u;k=f;i=d}else{k=f;i=d;h=u}if(h|0)while(1){w=a[j>>0]^a[k>>0];a[j>>0]=w;a[i>>0]=w;h=h+-1|0;if(!h)break;else{k=k+1|0;j=j+1|0;i=i+1|0}}d=d+u|0;f=f+u|0;g=g-u|0}if(g){j=b+96|0;h=b+64|0;p=h;if(!((p|j)&3))if(u>>>0>3){m=u+-4|0;n=m&-4;o=n+4|0;k=h+o|0;l=h;i=u;while(1){c[j>>2]=c[l>>2];i=i+-4|0;if(i>>>0<=3)break;else{l=l+4|0;j=j+4|0}}i=m-n|0;j=b+96+o|0}else{i=u;k=h}else{k=h;i=u}if(i|0)while(1){a[j>>0]=a[k>>0]|0;i=i+-1|0;if(!i)break;else{k=k+1|0;j=j+1|0}}w=pb[t&63](b+496|0,h,h)|0;e=w>>>0>e>>>0?w:e;c[v>>2]=u-g;if(!((f|p|d)&3))if(g>>>0>3){k=g+-4|0;l=k&-4;n=l+4|0;m=h+n|0;j=f;i=d;while(1){w=c[h>>2]^c[j>>2];c[h>>2]=w;c[i>>2]=w;g=g+-4|0;if(g>>>0<=3)break;else{j=j+4|0;h=h+4|0;i=i+4|0}}g=k-l|0;f=f+n|0;h=m;d=d+n|0}if(g)while(1){w=a[h>>0]^a[f>>0];a[h>>0]=w;a[d>>0]=w;g=g+-1|0;if(!g)break;else{f=f+1|0;h=h+1|0;d=d+1|0}}}if(!e){w=0;return w|0}Te(e+16|0);w=0;return w|0}function bm(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;t=c[b+12>>2]|0;s=c[t+36>>2]|0;t=c[t+20>>2]|0;r=t<<1;if(e>>>0>>0){u=200;return u|0}u=b+112|0;e=c[u>>2]|0;if(e>>>0>=g>>>0){h=b+64+t+(0-e)|0;if(!((f|d|h)&3))if(g>>>0>3){m=g+-4|0;n=m&-4;o=n+4|0;i=f;j=h;k=d;l=g;while(1){t=c[i>>2]|0;c[k>>2]=c[j>>2]^t;c[j>>2]=t;l=l+-4|0;if(l>>>0<=3)break;else{i=i+4|0;j=j+4|0;k=k+4|0}}i=m-n|0;f=f+o|0;h=h+o|0;d=d+o|0}else i=g;else i=g;if(i){e=i;while(1){t=a[f>>0]|0;a[d>>0]=t^a[h>>0];a[h>>0]=t;e=e+-1|0;if(!e)break;else{d=d+1|0;h=h+1|0;f=f+1|0}}e=c[u>>2]|0}c[u>>2]=e-g;u=0;return u|0}if(e){g=g-e|0;i=b+64+t+(0-e)|0;if(e>>>0>3&((f|d|i)&3|0)==0){m=e+-4|0;n=m&-4;o=n+4|0;h=f;j=i;k=d;l=e;while(1){q=c[h>>2]|0;c[k>>2]=c[j>>2]^q;c[j>>2]=q;l=l+-4|0;if(l>>>0<=3)break;else{h=h+4|0;j=j+4|0;k=k+4|0}}h=f+o|0;k=m-n|0;if(k){l=d+o|0;i=i+o|0;j=h;e=k;p=18}}else{l=d;j=f;h=f;p=18}if((p|0)==18){while(1){q=a[j>>0]|0;a[l>>0]=a[h>>0]^a[i>>0];a[i>>0]=q;e=e+-1|0;if(!e)break;else{l=l+1|0;i=i+1|0;j=j+1|0;h=h+1|0;p=18}}e=c[u>>2]|0}c[u>>2]=0;d=d+e|0;f=f+e|0}a:do if(g>>>0>>0)e=0;else{e=c[b+24>>2]|0;if(e|0){r=(g>>>0)/(t>>>0)|0;qb[e&15](b+496|0,b+64|0,d,f,r);r=S(r,t)|0;e=0;d=d+r|0;f=f+r|0;g=g-r|0;break}p=b+496|0;q=b+64|0;n=q;k=t+-4|0;m=k&-4;l=m+4|0;o=q+l|0;m=k-m|0;if(t>>>0>3)e=0;else{l=(t|0)==0;e=0;while(1){o=pb[s&63](p,q,q)|0;e=o>>>0>e>>>0?o:e;if(!l){h=d;i=q;j=f;k=t;while(1){o=a[j>>0]|0;a[h>>0]=o^a[i>>0];a[i>>0]=o;k=k+-1|0;if(!k)break;else{h=h+1|0;i=i+1|0;j=j+1|0}}}d=d+t|0;f=f+t|0;g=g-t|0;if(g>>>0>>0)break a}}do{k=pb[s&63](p,q,q)|0;e=k>>>0>e>>>0?k:e;if(!((f|n|d)&3)){h=f;i=q;j=d;k=t;while(1){v=c[h>>2]|0;c[j>>2]=c[i>>2]^v;c[i>>2]=v;k=k+-4|0;if(k>>>0<=3)break;else{h=h+4|0;i=i+4|0;j=j+4|0}}h=d+l|0;j=o;k=f+l|0;i=m}else{h=d;j=q;k=f;i=t}if(i|0)while(1){v=a[k>>0]|0;a[h>>0]=v^a[j>>0];a[j>>0]=v;i=i+-1|0;if(!i)break;else{h=h+1|0;j=j+1|0;k=k+1|0}}d=d+t|0;f=f+t|0;g=g-t|0}while(g>>>0>=r>>>0)}while(0);if(g>>>0>=t>>>0){i=b+96|0;k=b+64|0;p=k;if(!((p|i)&3))if(t>>>0>3){m=t+-4|0;n=m&-4;o=n+4|0;j=k+o|0;l=k;h=t;while(1){c[i>>2]=c[l>>2];h=h+-4|0;if(h>>>0<=3)break;else{l=l+4|0;i=i+4|0}}h=m-n|0;i=b+96+o|0}else{h=t;j=k}else{j=k;h=t}if(h|0)while(1){a[i>>0]=a[j>>0]|0;h=h+-1|0;if(!h)break;else{j=j+1|0;i=i+1|0}}v=pb[s&63](b+496|0,k,k)|0;e=v>>>0>e>>>0?v:e;if(!((f|p|d)&3))if(t>>>0>3){m=t+-4|0;n=m&-4;o=n+4|0;h=f;i=k;j=d;l=t;while(1){v=c[h>>2]|0;c[j>>2]=c[i>>2]^v;c[i>>2]=v;l=l+-4|0;if(l>>>0<=3)break;else{h=h+4|0;i=i+4|0;j=j+4|0}}i=m-n|0;j=f+o|0;k=k+o|0;h=d+o|0}else{i=t;j=f;h=d}else{h=d;j=f;i=t}if(i|0)while(1){v=a[j>>0]|0;a[h>>0]=v^a[k>>0];a[k>>0]=v;i=i+-1|0;if(!i)break;else{h=h+1|0;k=k+1|0;j=j+1|0}}d=d+t|0;f=f+t|0;g=g-t|0}if(g){j=b+96|0;h=b+64|0;p=h;if(!((p|j)&3))if(t>>>0>3){m=t+-4|0;n=m&-4;o=n+4|0;k=h+o|0;l=h;i=t;while(1){c[j>>2]=c[l>>2];i=i+-4|0;if(i>>>0<=3)break;else{l=l+4|0;j=j+4|0}}i=m-n|0;j=b+96+o|0}else{i=t;k=h}else{k=h;i=t}if(i|0)while(1){a[j>>0]=a[k>>0]|0;i=i+-1|0;if(!i)break;else{k=k+1|0;j=j+1|0}}v=pb[s&63](b+496|0,h,h)|0;e=v>>>0>e>>>0?v:e;c[u>>2]=t-g;if(!((f|p|d)&3))if(g>>>0>3){l=g+-4|0;m=l&-4;n=m+4|0;i=f;j=h;k=d;while(1){v=c[i>>2]|0;c[k>>2]=c[j>>2]^v;c[j>>2]=v;g=g+-4|0;if(g>>>0<=3)break;else{i=i+4|0;j=j+4|0;k=k+4|0}}g=l-m|0;f=f+n|0;h=h+n|0;d=d+n|0}if(g)while(1){v=a[f>>0]|0;a[d>>0]=v^a[h>>0];a[h>>0]=v;g=g+-1|0;if(!g)break;else{d=d+1|0;h=h+1|0;f=f+1|0}}}if(!e){v=0;return v|0}Te(e+16|0);v=0;return v|0}function cm(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;q=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=q;e=c[b+12>>2]|0;j=c[e+20>>2]|0;if(j>>>0>16)He(46529,113,46543);Yq(f|0,0,j|0)|0;p=pb[c[e+36>>2]&63](b+496|0,f,f)|0;g=j+-1|0;k=(j|0)==16?135:27;n=f+g|0;h=b+128|0;if((g|0)>-1){e=g;b=0;while(1){r=f+e|0;s=a[r>>0]|0;i=b;b=(s&255)>>>7;i=((s&255)<<1|i&255)&255;a[r>>0]=i;a[h+1+e>>0]=i;if((e|0)<=0)break;else e=e+-1|0}e=(d[n>>0]|0)^(b<<24>>24?k:0);b=e&255;a[h+1+g>>0]=b;b=(b&255)>>>7;e=e<<1&255;a[n>>0]=e;i=h+17+g|0;a[i>>0]=e;if((g|0)>0){e=j+-2|0;while(1){r=f+e|0;j=a[r>>0]|0;s=b;b=(j&255)>>>7;s=((j&255)<<1|s&255)&255;a[r>>0]=s;a[h+17+e>>0]=s;if((e|0)<=0)break;else e=e+-1|0}e=a[n>>0]|0}s=(e&255^(b<<24>>24?k:0))&255;a[n>>0]=s;a[i>>0]=s}else{s=a[n>>0]|0;a[h+1+g>>0]=s;a[h+17+g>>0]=s}if(f&4){e=16;do{a[f>>0]=0;f=f+1|0;e=e+-1|0}while((e|0)!=0&(f&7|0)!=0);if(e>>>0>=8)o=11}else{e=16;o=11}if((o|0)==11){g=e+-8|0;h=g&-8;b=f;while(1){s=b;c[s>>2]=0;c[s+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else b=b+8|0}e=g-h|0;f=f+(h+8)|0}if(e|0)while(1){a[f>>0]=0;e=e+-1|0;if(!e)break;else f=f+1|0}if(!p){l=q;return 0}Te(p+16|0);l=q;return 0}function dm(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;A=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=A;w=c[b+12>>2]|0;y=c[w+36>>2]|0;w=c[w+20>>2]|0;if(e>>>0>>0){z=200;l=A;return z|0}x=b+112|0;e=c[x>>2]|0;if(e){if(w>>>0<=e>>>0)Ie(46565,46587,53,46600);s=e>>>0>g>>>0?g:e;j=w-e+(b+96)|0;if(!((f|d|j)&3))if(s>>>0>3){o=s+-4|0;p=o&-4;r=p+4|0;q=j+r|0;i=f;k=d;n=s;while(1){c[k>>2]=c[j>>2]^c[i>>2];n=n+-4|0;if(n>>>0<=3)break;else{j=j+4|0;i=i+4|0;k=k+4|0}}n=o-p|0;j=q;k=f+r|0;i=d+r|0}else{n=s;k=f;i=d}else{k=f;i=d;n=s}if(n){e=n;while(1){a[i>>0]=a[j>>0]^a[k>>0];e=e+-1|0;if(!e)break;else{j=j+1|0;k=k+1|0;i=i+1|0}}e=c[x>>2]|0}c[x>>2]=e-s;d=d+s|0;f=f+s|0;g=g-s|0}e=(g>>>0)/(w>>>0)|0;if(w>>>0<=g>>>0?(t=c[b+36>>2]|0,u=S(e,w)|0,(t|0)!=0):0){qb[t&15](b+496|0,b+80|0,d,f,e);d=d+u|0;f=f+u|0;g=g-u|0}if(!g){z=0;l=A;return z|0}s=b+496|0;t=b+80|0;u=h;v=0;while(1){e=pb[y&63](s,h,t)|0;v=e>>>0>v>>>0?e:v;e=w;do{if((e|0)<=0)break;e=e+-1|0;q=t+e|0;r=(a[q>>0]|0)+1<<24>>24;a[q>>0]=r}while(!(r<<24>>24));r=w>>>0>>0?w:g;if(!((f|u|d)&3))if(r>>>0>3){o=r+-4|0;p=o&-4;q=p+4|0;i=h+q|0;e=h;j=f;k=d;n=r;while(1){c[k>>2]=c[e>>2]^c[j>>2];n=n+-4|0;if(n>>>0<=3)break;else{e=e+4|0;j=j+4|0;k=k+4|0}}e=o-p|0;k=f+q|0;j=d+q|0}else{e=r;i=h;k=f;j=d}else{i=h;k=f;j=d;e=r}if(e|0)while(1){a[j>>0]=a[i>>0]^a[k>>0];e=e+-1|0;if(!e)break;else{i=i+1|0;k=k+1|0;j=j+1|0}}g=g-r|0;if(!g)break;else{d=d+r|0;f=f+r|0}}e=w-r|0;c[x>>2]=e;do if(e|0){g=b+96+r|0;d=h+r|0;if(e>>>0>3&((d|g)&3|0)==0){i=e+-4|0;j=i&-4;n=j+4|0;k=d+n|0;f=g;while(1){c[f>>2]=c[d>>2];e=e+-4|0;if(e>>>0<=3)break;else{d=d+4|0;f=f+4|0}}e=i-j|0;if(!e)break;else{d=k;g=g+n|0}}while(1){a[g>>0]=a[d>>0]|0;e=e+-1|0;if(!e)break;else{d=d+1|0;g=g+1|0}}}while(0);if(u&7){e=16;do{a[h>>0]=0;h=h+1|0;e=e+-1|0}while((e|0)!=0&(h&7|0)!=0);if(e>>>0>=8)z=41}else{e=16;z=41}if((z|0)==41){d=e+-8|0;f=d&-8;i=f+8|0;g=h;while(1){z=g;c[z>>2]=0;c[z+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else g=g+8|0}e=d-f|0;h=h+i|0}if(e|0)while(1){a[h>>0]=0;e=e+-1|0;if(!e)break;else h=h+1|0}if(!v){z=0;l=A;return z|0}Te(v+16|0);z=0;l=A;return z|0}function em(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0;if((c[(c[b+12>>2]|0)+20>>2]|0)!=16){g=12;return g|0}if(e>>>0>>0){g=200;return g|0}m=b+128|0;l=b+196|0;h=a[l>>0]|0;if(h&4){g=139;return g|0}i=a[b+56>>0]|0;if((i&4|h&1)<<24>>24){g=156;return g|0}if(!(i&2)){fm(b,71779,16)|0;h=a[l>>0]|0}if(h&8){g=156;return g|0}if(!(h&2)){gm(b,m,0,0,1);h=a[l>>0]|2;a[l>>0]=h}j=b+172|0;k=(c[j>>2]|0)+g|0;c[j>>2]=k;j=b+176|0;i=c[j>>2]|0;if(k>>>0>>0){i=i+1|0;c[j>>2]=i}if(i>>>0<=15?(i|0)!=15|k>>>0<4294967265:0){h=dm(b,d,e,f,g)|0;if(h|0){g=h;return g|0}gm(b,m,d,g,0);g=0;return g|0}a[l>>0]=h|4;g=139;return g|0}function fm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;n=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=n;g=n+8|0;k=b+56|0;a[k>>0]=a[k>>0]&-7;h=b+196|0;a[h>>0]=a[h>>0]&-9;o=(gg()|0)==0;f=a[h>>0]|0;if(!o){f=f|8;a[h>>0]=f}p=b+128|0;o=b+164|0;c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;c[p+12>>2]=0;c[o>>2]=0;c[o+4>>2]=0;c[o+8>>2]=0;c[o+12>>2]=0;a[h>>0]=f&-8;switch(e|0){case 12:{f=b+80|0;e=f;g=d;h=e+12|0;do{a[e>>0]=a[g>>0]|0;e=e+1|0;g=g+1|0}while((e|0)<(h|0));a[b+94>>0]=0;a[b+93>>0]=0;g=b+92|0;a[g>>0]=0;a[b+95>>0]=1;break}case 0:{p=139;l=n;return p|0}default:{f=i;c[f>>2]=0;c[f+4>>2]=0;f=b+80|0;c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[f+12>>2]=0;c[i>>2]=e;gm(b,f,d,e,1);c[g+12>>2]=er(e<<3|0)|0;c[g+8>>2]=er(e>>>29|0)|0;c[g+4>>2]=0;c[g>>2]=0;gm(b,f,g,16,1);p=i;c[p>>2]=0;c[p+4>>2]=0;if(g&4){h=16;do{a[g>>0]=0;g=g+1|0;h=h+-1|0}while((h|0)!=0&(g&7|0)!=0);if(h>>>0>=8)j=7}else{h=16;j=7}if((j|0)==7){i=h+-8|0;d=i&-8;e=g;while(1){p=e;c[p>>2]=0;c[p+4>>2]=0;h=h+-8|0;if(h>>>0<=7)break;else e=e+8|0}h=i-d|0;g=g+(d+8)|0}if(h|0)while(1){a[g>>0]=0;h=h+-1|0;if(!h)break;else g=g+1|0}g=b+92|0}}pb[c[(c[b+12>>2]|0)+36>>2]&63](b+496|0,b+180|0,f)|0;c[g>>2]=er((er(c[g>>2]|0)|0)+1|0)|0;c[b+112>>2]=0;a[k>>0]=a[k>>0]&-7|2;p=0;l=n;return p|0}function gm(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;v=b+160|0;h=c[v>>2]|0;w=c[b+224>>2]|0;if(!f)if((g|0)!=0&(h|0)!=0)f=0;else return;s=b+144|0;a:do if(!g){g=0;p=h;b:while(1){if((p|0)!=0|(f+p|0)>>>0<16){q=16-p|0;q=q>>>0>>0?q:f;i=b+144+p|0;if(!((e|i)&3))if(q>>>0>3){m=q+-4|0;n=m&-4;o=n+4|0;j=e+o|0;h=e;k=i;l=q;while(1){c[k>>2]=c[h>>2];l=l+-4|0;if(l>>>0<=3)break;else{h=h+4|0;k=k+4|0}}h=m-n|0;i=i+o|0}else{h=q;j=e}else{j=e;h=q}if(h|0)while(1){a[i>>0]=a[j>>0]|0;h=h+-1|0;if(!h)break;else{j=j+1|0;i=i+1|0}}j=e+q|0;i=f-q|0;f=q+p|0}else{j=e;i=f;f=0}if(!i){t=g;u=f;break a}switch(f|0){case 0:break;case 16:{g=wb[w&3](b,d,s,1)|0;break}default:break b}e=i>>>4;h=e<<4;if(!e){e=j;f=i;p=0;continue}f=i-h|0;g=wb[w&3](b,d,j,e)|0;if(!f){t=g;u=0;break a}else{e=j+h|0;p=0}}Ie(46625,46645,499,46658)}else{q=0;o=h;c:while(1){if((o|0)!=0|(f+o|0)>>>0<16){p=16-o|0;p=p>>>0>>0?p:f;h=b+144+o|0;if(!((e|h)&3))if(p>>>0>3){l=p+-4|0;m=l&-4;n=m+4|0;i=e+n|0;g=e;j=h;k=p;while(1){c[j>>2]=c[g>>2];k=k+-4|0;if(k>>>0<=3)break;else{g=g+4|0;j=j+4|0}}g=l-m|0;h=h+n|0}else{g=p;i=e}else{i=e;g=p}if(g|0)while(1){a[h>>0]=a[i>>0]|0;g=g+-1|0;if(!g)break;else{i=i+1|0;h=h+1|0}}i=e+p|0;f=f-p|0;g=p+o|0}else{i=e;g=0}if((f|0)==0&g>>>0<16){Yq(b+144+g|0,0,16-g|0)|0;r=33}else switch(g|0){case 0:{g=q;break}case 16:{r=33;break}default:break c}if((r|0)==33){r=0;g=wb[w&3](b,d,s,1)|0}e=f>>>4;h=e<<4;if(!e)e=i;else{g=wb[w&3](b,d,i,e)|0;e=i+h|0;f=f-h|0}if(!f){t=g;u=0;break a}else{q=g;o=0}}Ie(46625,46645,499,46658)}while(0);c[v>>2]=u;if(!t)return;Te(t);return}function hm(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0;if((c[(c[b+12>>2]|0)+20>>2]|0)!=16){g=12;return g|0}if(e>>>0>>0){g=200;return g|0}l=b+128|0;m=b+196|0;h=a[m>>0]|0;if(h&4){g=139;return g|0}i=a[b+56>>0]|0;if((i&4|h&1)<<24>>24){g=156;return g|0}if(!(i&2)){fm(b,71795,16)|0;h=a[m>>0]|0}if(!(h&2)){gm(b,l,0,0,1);h=a[m>>0]|2;a[m>>0]=h}j=b+172|0;k=(c[j>>2]|0)+g|0;c[j>>2]=k;j=b+176|0;i=c[j>>2]|0;if(k>>>0>>0){i=i+1|0;c[j>>2]=i}if(i>>>0<=15?(i|0)!=15|k>>>0<4294967265:0){gm(b,l,f,g,0);g=dm(b,d,e,f,g)|0;return g|0}a[m>>0]=h|4;g=139;return g|0}function im(a){a=a|0;var b=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;r=a+208|0;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;c[r+12>>2]=0;pb[c[(c[a+12>>2]|0)+36>>2]&63](a+496|0,r,r)|0;c[a+224>>2]=2;l=a+228|0;c[l>>2]=0;c[l+4>>2]=0;c[l+8>>2]=0;c[l+12>>2]=0;l=d[r+3>>0]|0;s=(d[r+1>>0]|0)<<16|(d[r>>0]|0)<<24|(d[r+2>>0]|0)<<8|l;e=a+356|0;c[e>>2]=s;j=d[r+7>>0]|0;r=(d[r+5>>0]|0)<<16|(d[r+4>>0]|0)<<24|(d[r+6>>0]|0)<<8|j;f=a+360|0;c[f>>2]=r;p=d[a+219>>0]|0;q=(d[a+217>>0]|0)<<16|(d[a+216>>0]|0)<<24|(d[a+218>>0]|0)<<8|p;g=a+364|0;c[g>>2]=q;n=d[a+223>>0]|0;t=(d[a+221>>0]|0)<<16|(d[a+220>>0]|0)<<24|(d[a+222>>0]|0)<<8|n;h=a+368|0;c[h>>2]=t;i=a+304|0;t=t>>>1;p=t|p<<31;c[i>>2]=p;q=q>>>1;j=q|j<<31;c[a+300>>2]=j;r=r>>>1;l=r|l<<31;c[a+296>>2]=l;s=s>>>1;n=(n&1|0?-520093696:0)^s;c[a+292>>2]=n;x=p>>>1;q=x|q<<31;c[a+272>>2]=q;u=j>>>1;r=u|r<<31;c[a+268>>2]=r;v=l>>>1;s=v|s<<31;c[a+264>>2]=s;w=n>>>1;t=(t&1|0?-520093696:0)^w;c[a+260>>2]=t;u=q>>>1|u<<31;c[a+256>>2]=u;v=r>>>1|v<<31;c[a+252>>2]=v;w=w<<31|s>>>1;c[a+248>>2]=w;x=(x&1|0?-520093696:0)^t>>>1;c[a+244>>2]=x;o=x^t;c[a+276>>2]=o;m=w^s;c[a+280>>2]=m;k=v^r;c[a+284>>2]=k;b=u^q;c[a+288>>2]=b;c[a+308>>2]=x^n;c[a+312>>2]=w^l;c[a+316>>2]=v^j;c[a+320>>2]=u^p;c[a+324>>2]=t^n;c[a+328>>2]=s^l;c[a+332>>2]=r^j;c[a+336>>2]=q^p;c[a+340>>2]=o^n;c[a+344>>2]=m^l;c[a+348>>2]=k^j;c[a+352>>2]=c[i>>2]^b;b=1;do{w=b<<2;x=w+32|0;c[a+228+(x<<2)>>2]=c[a+228+(w<<2)>>2]^c[e>>2];c[a+228+((x|1)<<2)>>2]=c[a+228+((w|1)<<2)>>2]^c[f>>2];c[a+228+((x|2)<<2)>>2]=c[a+228+((w|2)<<2)>>2]^c[g>>2];c[a+228+((x|3)<<2)>>2]=c[a+228+((w|3)<<2)>>2]^c[h>>2];b=b+1|0}while((b|0)!=8);return}function jm(b,f,g,h){b=b|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0;Z=l;l=l+16|0;if((l|0)>=(m|0))$(16);U=Z;if(!h){Y=0;X=(Y|0)!=0;X=X?20:0;Y=X+Y|0;l=Z;return Y|0}V=f;W=f+4|0;X=U+4|0;Y=f+8|0;t=U+8|0;u=f+12|0;v=U+12|0;w=f+1|0;x=f+2|0;y=f+3|0;z=f+5|0;A=f+6|0;B=f+7|0;C=f+9|0;D=f+10|0;E=f+11|0;F=f+13|0;G=f+14|0;H=f+15|0;I=U+1|0;J=U+2|0;K=U+3|0;L=U+5|0;M=U+6|0;N=U+7|0;O=U+9|0;P=U+10|0;Q=U+11|0;R=U+13|0;S=U+14|0;T=U+15|0;while(1){if(!((g|V)&3)){c[U>>2]=c[g>>2]^c[f>>2];c[X>>2]=c[g+4>>2]^c[W>>2];c[t>>2]=c[g+8>>2]^c[Y>>2];j=c[g+12>>2]^c[u>>2];c[v>>2]=j;i=j>>>24&255;j=j>>>16&255}else{a[U>>0]=a[g>>0]^a[f>>0];a[I>>0]=a[g+1>>0]^a[w>>0];a[J>>0]=a[g+2>>0]^a[x>>0];a[K>>0]=a[g+3>>0]^a[y>>0];a[X>>0]=a[g+4>>0]^a[W>>0];a[L>>0]=a[g+5>>0]^a[z>>0];a[M>>0]=a[g+6>>0]^a[A>>0];a[N>>0]=a[g+7>>0]^a[B>>0];a[t>>0]=a[g+8>>0]^a[Y>>0];a[O>>0]=a[g+9>>0]^a[C>>0];a[P>>0]=a[g+10>>0]^a[D>>0];a[Q>>0]=a[g+11>>0]^a[E>>0];a[v>>0]=a[g+12>>0]^a[u>>0];a[R>>0]=a[g+13>>0]^a[F>>0];j=a[g+14>>0]^a[G>>0];a[S>>0]=j;i=a[g+15>>0]^a[H>>0];a[T>>0]=i}i=i&255;n=b+228+((i<<2&60)<<2)|0;i=b+228+(i>>>4<<2<<2)|0;r=c[n>>2]|0;k=c[n+12>>2]|0;q=c[n+4>>2]|0;n=c[n+8>>2]|0;s=14;j=j&255;o=c[i>>2]^r>>>4^(e[17762+((k<<4&240)<<1)>>1]|0)<<16;p=(n>>>4|q<<28)^c[i+8>>2];k=(n<<28|k>>>4)^c[i+12>>2];i=(q>>>4|r<<28)^c[i+4>>2];while(1){ba=b+228+((j<<2&60)<<2)|0;aa=b+228+(j>>>4<<2<<2)|0;r=c[ba>>2]|0;_=c[ba+12>>2]|0;j=c[aa>>2]^o>>>8^(e[17762+((k&255)<<1)>>1]|0)<<16^r>>>4;q=(e[17762+((_<<4&240)<<1)>>1]|0)<<16^j;n=c[ba+4>>2]|0;r=c[aa+4>>2]^(i>>>8|o<<24)^(n>>>4|r<<28);o=c[ba+8>>2]|0;n=c[aa+8>>2]^(p>>>8|i<<24)^(o>>>4|n<<28);i=c[aa+12>>2]^(k>>>8|p<<24)^(o<<28|_>>>4);if(!s)break;j=s+-1|0;s=j;j=d[U+j>>0]|0;o=q;p=n;k=i;i=r}a[f>>0]=q>>>24;a[w>>0]=q>>>16;a[x>>0]=j>>>8;a[y>>0]=j;a[W>>0]=r>>>24;a[z>>0]=r>>>16;a[A>>0]=r>>>8;a[B>>0]=r;a[Y>>0]=n>>>24;a[C>>0]=n>>>16;a[D>>0]=n>>>8;a[E>>0]=n;a[u>>0]=i>>>24;a[F>>0]=i>>>16;a[G>>0]=i>>>8;a[H>>0]=i;h=h+-1|0;if(!h){g=76;break}else g=g+16|0}ba=(g|0)!=0;ba=ba?20:0;ba=ba+g|0;l=Z;return ba|0}function km(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;if((e|0)==0&0==0)g=($q(f|0)|0)+32|0;else g=$q(e|0)|0;e=b+160|0;if((g|0)<16){b=e+(g<<4)|0;return b|0}f=e+240|0;do if((f|0)!=(d|0))if(!((f|d)&3)){c[d>>2]=c[f>>2];c[d+4>>2]=c[e+244>>2];c[d+8>>2]=c[e+248>>2];c[d+12>>2]=c[e+252>>2];break}else{a[d>>0]=a[f>>0]|0;a[d+1>>0]=a[f+1>>0]|0;a[d+2>>0]=a[f+2>>0]|0;a[d+3>>0]=a[f+3>>0]|0;a[d+4>>0]=a[e+244>>0]|0;a[d+5>>0]=a[f+5>>0]|0;a[d+6>>0]=a[f+6>>0]|0;a[d+7>>0]=a[f+7>>0]|0;a[d+8>>0]=a[e+248>>0]|0;a[d+9>>0]=a[f+9>>0]|0;a[d+10>>0]=a[f+10>>0]|0;a[d+11>>0]=a[f+11>>0]|0;a[d+12>>0]=a[e+252>>0]|0;a[d+13>>0]=a[f+13>>0]|0;a[d+14>>0]=a[f+14>>0]|0;a[d+15>>0]=a[f+15>>0]|0;break}while(0);lm(d);e=g+-16|0;if(!e){b=d;return b|0}do{lm(d);e=e+-1|0}while((e|0)!=0);return d|0}function lm(b){b=b|0;var c=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0;B=mr(d[b>>0]|0|0,0,56)|0;e=D;R=b+1|0;U=mr(d[R>>0]|0|0,0,48)|0;U=U|B;T=D|e;O=b+2|0;Q=mr(d[O>>0]|0|0,0,40)|0;Q=U|Q;S=T|D;L=b+3|0;P=S|(d[L>>0]|0);I=b+4|0;N=mr(d[I>>0]|0|0,0,24)|0;N=Q|N;M=P|D;G=b+5|0;K=mr(d[G>>0]|0|0,0,16)|0;K=N|K;J=M|D;C=b+6|0;H=mr(d[C>>0]|0|0,0,8)|0;H=K|H;E=J|D;z=b+7|0;F=H|(d[z>>0]|0);w=b+8|0;A=d[w>>0]|0;y=mr(A|0,0,56)|0;x=D;u=b+9|0;r=mr(d[u>>0]|0|0,0,48)|0;y=r|y;x=D|x;r=b+10|0;t=mr(d[r>>0]|0|0,0,40)|0;t=y|t;v=x|D;o=b+11|0;s=v|(d[o>>0]|0);l=b+12|0;q=mr(d[l>>0]|0|0,0,24)|0;q=t|q;p=s|D;j=b+13|0;n=mr(d[j>>0]|0|0,0,16)|0;n=q|n;m=p|D;g=b+14|0;k=mr(d[g>>0]|0|0,0,8)|0;k=n|k;h=m|D;c=b+15|0;i=k|(d[c>>0]|0);e=fr(B|0,e|0,63)|0;B=mr(F|0,E|0,1)|0;f=D;A=gr(A|0,0,7)|0;f=mr(i|0,h|0,1)|0;T=gr(U|0,T|0,55)|0;a[b>>0]=T;b=gr(Q|0,S|0,47)|0;a[R>>0]=b;b=gr(Q|0,P|0,39)|0;a[O>>0]=b;b=gr(N|0,M|0,31)|0;a[L>>0]=b;b=gr(K|0,J|0,23)|0;a[I>>0]=b;b=gr(H|0,E|0,15)|0;a[G>>0]=b;b=gr(F|0,E|0,7)|0;a[C>>0]=b;a[z>>0]=B|A;b=gr(y|0,x|0,55)|0;a[w>>0]=b;b=gr(t|0,v|0,47)|0;a[u>>0]=b;b=gr(t|0,s|0,39)|0;a[r>>0]=b;b=gr(q|0,p|0,31)|0;a[o>>0]=b;b=gr(n|0,m|0,23)|0;a[l>>0]=b;b=gr(k|0,h|0,15)|0;a[j>>0]=b;b=gr(i|0,h|0,7)|0;a[g>>0]=b;a[c>>0]=f^e&135;return}function mm(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=z+24|0;h=z;w=b+56|0;if(!(a[w>>0]&1)){y=156;l=z;return y|0}x=b+128|0;s=b+480|0;switch(a[s>>0]|0){case 16:case 12:case 8:break;default:{y=59;l=z;return y|0}}u=b+12|0;i=c[u>>2]|0;if((c[i+20>>2]|0)!=16){y=12;l=z;return y|0}if(!e){y=45;l=z;return y|0}if((f&-8|0)!=8){y=139;l=z;return y|0};c[g>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;v=b+496|0;t=pb[c[i+36>>2]&63](v,x,g)|0;i=b+144|0;j=i;if(!((x|j)&3)){c[i>>2]=c[x>>2];c[b+148>>2]=c[x+4>>2];c[b+152>>2]=c[b+136>>2];c[b+156>>2]=c[b+140>>2]}else{a[i>>0]=a[x>>0]|0;a[b+145>>0]=a[x+1>>0]|0;a[b+146>>0]=a[x+2>>0]|0;a[b+147>>0]=a[x+3>>0]|0;a[b+148>>0]=a[x+4>>0]|0;a[b+149>>0]=a[x+5>>0]|0;a[b+150>>0]=a[x+6>>0]|0;a[b+151>>0]=a[x+7>>0]|0;a[b+152>>0]=a[b+136>>0]|0;a[b+153>>0]=a[b+137>>0]|0;a[b+154>>0]=a[b+138>>0]|0;a[b+155>>0]=a[b+139>>0]|0;a[b+156>>0]=a[b+140>>0]|0;a[b+157>>0]=a[b+141>>0]|0;a[b+158>>0]=a[b+142>>0]|0;a[b+159>>0]=a[b+143>>0]|0}lm(i);o=b+160|0;if(!((j|o)&3)){c[o>>2]=c[i>>2];c[o+4>>2]=c[b+148>>2];c[o+8>>2]=c[b+152>>2];c[o+12>>2]=c[b+156>>2]}else{a[o>>0]=a[i>>0]|0;a[o+1>>0]=a[b+145>>0]|0;a[o+2>>0]=a[b+146>>0]|0;a[o+3>>0]=a[b+147>>0]|0;a[o+4>>0]=a[b+148>>0]|0;a[o+5>>0]=a[b+149>>0]|0;a[o+6>>0]=a[b+150>>0]|0;a[o+7>>0]=a[b+151>>0]|0;a[o+8>>0]=a[b+152>>0]|0;a[o+9>>0]=a[b+153>>0]|0;a[o+10>>0]=a[b+154>>0]|0;a[o+11>>0]=a[b+155>>0]|0;a[o+12>>0]=a[b+156>>0]|0;a[o+13>>0]=a[b+157>>0]|0;a[o+14>>0]=a[b+158>>0]|0;a[o+15>>0]=a[b+159>>0]|0}lm(o);i=1;do{j=o+(i<<4)|0;k=i+-1|0;n=o+(k<<4)|0;if(!((n|j)&3)){c[j>>2]=c[n>>2];c[o+(i<<4)+4>>2]=c[o+(k<<4)+4>>2];c[o+(i<<4)+8>>2]=c[o+(k<<4)+8>>2];c[o+(i<<4)+12>>2]=c[o+(k<<4)+12>>2]}else{a[j>>0]=a[n>>0]|0;a[o+(i<<4)+1>>0]=a[o+(k<<4)+1>>0]|0;a[o+(i<<4)+2>>0]=a[o+(k<<4)+2>>0]|0;a[o+(i<<4)+3>>0]=a[o+(k<<4)+3>>0]|0;a[o+(i<<4)+4>>0]=a[o+(k<<4)+4>>0]|0;a[o+(i<<4)+5>>0]=a[o+(k<<4)+5>>0]|0;a[o+(i<<4)+6>>0]=a[o+(k<<4)+6>>0]|0;a[o+(i<<4)+7>>0]=a[o+(k<<4)+7>>0]|0;a[o+(i<<4)+8>>0]=a[o+(k<<4)+8>>0]|0;a[o+(i<<4)+9>>0]=a[o+(k<<4)+9>>0]|0;a[o+(i<<4)+10>>0]=a[o+(k<<4)+10>>0]|0;a[o+(i<<4)+11>>0]=a[o+(k<<4)+11>>0]|0;a[o+(i<<4)+12>>0]=a[o+(k<<4)+12>>0]|0;a[o+(i<<4)+13>>0]=a[o+(k<<4)+13>>0]|0;a[o+(i<<4)+14>>0]=a[o+(k<<4)+14>>0]|0;a[o+(i<<4)+15>>0]=a[o+(k<<4)+15>>0]|0}lm(j);i=i+1|0}while((i|0)!=16);r=16-f|0;Yq(g|0,0,r|0)|0;j=g+r|0;if(!((j|e)&3))if(f>>>0>3){n=f+-4|0;o=n&-4;q=o+4|0;p=e+q|0;k=j;i=f;while(1){c[k>>2]=c[e>>2];i=i+-4|0;if(i>>>0<=3)break;else{e=e+4|0;k=k+4|0}}i=n-o|0;e=p;j=j+q|0}else i=f;else i=f;if(i|0)while(1){a[j>>0]=a[e>>0]|0;i=i+-1|0;if(!i)break;else{e=e+1|0;j=j+1|0}}a[g>>0]=d[s>>0]<<4;p=g+(r+-1)|0;a[p>>0]=d[p>>0]|1;p=g+15|0;k=d[p>>0]|0;a[p>>0]=k&192;p=pb[c[(c[u>>2]|0)+36>>2]&63](v,g,g)|0;p=p>>>0>t>>>0?p:t;o=h;n=g;i=c[g>>2]|0;c[h>>2]=i;c[h+4>>2]=c[g+4>>2];c[h+8>>2]=c[g+8>>2];c[h+12>>2]=c[g+12>>2];j=h+16|0;e=g+1|0;if(!(e&3)){c[j>>2]=c[e>>2]^c[g>>2];c[h+20>>2]=c[g+5>>2]^c[g+4>>2]}else{v=a[e>>0]|0;a[j>>0]=v^i&255;u=a[g+2>>0]|0;a[h+17>>0]=u^v;v=a[g+3>>0]|0;a[h+18>>0]=v^u;u=a[g+4>>0]|0;a[h+19>>0]=u^v;v=a[g+5>>0]|0;a[h+20>>0]=v^u;u=a[g+6>>0]|0;a[h+21>>0]=u^v;v=a[g+7>>0]|0;a[h+22>>0]=v^u;a[h+23>>0]=a[g+8>>0]^v}j=b+64|0;e=h+(k>>>3&7)|0;i=k&7;if(!i){a[j>>0]=a[e>>0]|0;a[j+1>>0]=a[e+1>>0]|0;a[j+2>>0]=a[e+2>>0]|0;a[j+3>>0]=a[e+3>>0]|0;a[j+4>>0]=a[e+4>>0]|0;a[j+5>>0]=a[e+5>>0]|0;a[j+6>>0]=a[e+6>>0]|0;a[j+7>>0]=a[e+7>>0]|0;a[b+72>>0]=a[e+8>>0]|0;a[b+73>>0]=a[e+9>>0]|0;a[b+74>>0]=a[e+10>>0]|0;a[b+75>>0]=a[e+11>>0]|0;a[b+76>>0]=a[e+12>>0]|0;a[b+77>>0]=a[e+13>>0]|0;a[b+78>>0]=a[e+14>>0]|0;a[b+79>>0]=a[e+15>>0]|0}else{u=8-i|0;v=a[e+1>>0]|0;a[j>>0]=(v&255)>>>u|d[e>>0]<>0]|0;a[j+1>>0]=(t&255)>>>u|(v&255)<>0]|0;a[j+2>>0]=(v&255)>>>u|(t&255)<>0]|0;a[j+3>>0]=(t&255)>>>u|(v&255)<>0]|0;a[j+4>>0]=(v&255)>>>u|(t&255)<>0]|0;a[j+5>>0]=(t&255)>>>u|(v&255)<>0]|0;a[j+6>>0]=(v&255)>>>u|(t&255)<>0]|0;a[j+7>>0]=(t&255)>>>u|(v&255)<>0]|0;a[b+72>>0]=(v&255)>>>u|(t&255)<>0]|0;a[b+73>>0]=(t&255)>>>u|(v&255)<>0]|0;a[b+74>>0]=(v&255)>>>u|(t&255)<>0]|0;a[b+75>>0]=(t&255)>>>u|(v&255)<>0]|0;a[b+76>>0]=(v&255)>>>u|(t&255)<>0]|0;a[b+77>>0]=(t&255)>>>u|(v&255)<>0]|0;a[b+78>>0]=(v&255)>>>u|(t&255)<>0]=(d[e+16>>0]|0)>>>u|(v&255)<>0]&-15|2;e=b+80|0;k=e+36|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(k|0));c[i>>2]=0;c[i+4>>2]=0;c[i+8>>2]=0;c[i+12>>2]=0;c[i+16>>2]=0;c[i+20>>2]=0;c[i+24>>2]=0;c[i+28>>2]=0;a[w>>0]=j;w=b+464|0;x=x+353|0;c[w>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;c[w+12>>2]=0;a[x>>0]=a[x>>0]&-4;if(n&4){i=16;do{a[g>>0]=0;g=g+1|0;i=i+-1|0}while((i|0)!=0&(g&7|0)!=0);if(i>>>0>=8)y=34}else{i=16;y=34}if((y|0)==34){e=i+-8|0;k=e&-8;n=k+8|0;j=g;while(1){x=j;c[x>>2]=0;c[x+4>>2]=0;i=i+-8|0;if(i>>>0<=7)break;else j=j+8|0}i=e-k|0;g=g+n|0}if(i|0)while(1){a[g>>0]=0;i=i+-1|0;if(!i)break;else g=g+1|0}if(o&4){g=24;do{a[h>>0]=0;h=h+1|0;g=g+-1|0}while((g|0)!=0&(h&7|0)!=0);if(g>>>0>=8)y=42}else{g=24;y=42}if((y|0)==42){j=g+-8|0;e=j&-8;k=e+8|0;i=h;while(1){y=i;c[y>>2]=0;c[y+4>>2]=0;g=g+-8|0;if(g>>>0<=7)break;else i=i+8|0}g=j-e|0;h=h+k|0}if(g|0)while(1){a[h>>0]=0;g=g+-1|0;if(!g)break;else h=h+1|0}if(!p){y=0;l=z;return y|0}Te(p+16|0);y=0;l=z;return y|0}function nm(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return om(a,1,b,c,d,e)|0}function om(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0;Da=l;l=l+32|0;if((l|0)>=(m|0))$(32);za=Da+16|0;j=Da;va=h>>>4;Aa=b+56|0;i=a[Aa>>0]|0;if(!(i&2)){Ca=156;l=Da;return Ca|0}xa=b+128|0;Ba=xa+353|0;if(a[Ba>>0]&1){Ca=156;l=Da;return Ca|0}Ca=b+12|0;k=c[Ca>>2]|0;if((c[k+20>>2]|0)!=16){Ca=12;l=Da;return Ca|0}if(f>>>0>>0){Ca=200;l=Da;return Ca|0}if(!((h&15|0)==0|(i&8)!=0)){Ca=139;l=Da;return Ca|0}do if(va){i=c[b+40>>2]|0;wa=va<<4;if(i|0){qb[i&15](b,e,g,va,d);i=0;h=h-wa|0;g=g+wa|0;e=e+wa|0;break}ua=(d|0)!=0;p=c[(ua?k+36|0:k+40|0)>>2]|0;if(ua)pm(b+80|0,g,va);if(h>>>0>15){q=b+464|0;r=b+64|0;s=r;t=r+4|0;u=b+72|0;v=b+76|0;w=b+496|0;x=h+-16|0;sa=x&-16;ta=sa+16|0;sa=x-sa|0;x=b+72|0;y=r+4|0;z=b+76|0;A=r+1|0;B=r+2|0;C=r+3|0;E=r+4|0;F=r+5|0;G=r+6|0;H=r+7|0;I=b+72|0;J=b+73|0;K=b+74|0;L=b+75|0;M=b+76|0;N=b+77|0;O=b+78|0;P=b+79|0;Q=r+1|0;R=r+2|0;S=r+3|0;T=r+4|0;U=r+5|0;V=r+6|0;W=r+7|0;X=b+72|0;Y=b+73|0;Z=b+74|0;_=b+75|0;aa=b+76|0;ba=b+77|0;ca=b+78|0;da=b+79|0;ea=r+1|0;fa=r+2|0;ga=r+3|0;ha=r+4|0;ia=r+5|0;ja=r+6|0;ka=r+7|0;la=b+72|0;ma=b+73|0;na=b+74|0;oa=b+75|0;pa=b+76|0;qa=b+77|0;ra=b+78|0;o=b+79|0;i=0;k=g;n=e;while(1){Ea=q;Ea=_q(c[Ea>>2]|0,c[Ea+4>>2]|0,1,0)|0;f=D;Fa=q;c[Fa>>2]=Ea;c[Fa+4>>2]=f;f=km(b,za,Ea,f)|0;if(!((f|s)&3)){c[r>>2]=c[r>>2]^c[f>>2];c[t>>2]=c[t>>2]^c[f+4>>2];c[u>>2]=c[u>>2]^c[f+8>>2];c[v>>2]=c[v>>2]^c[f+12>>2]}else{a[r>>0]=a[r>>0]^a[f>>0];a[ea>>0]=a[ea>>0]^a[f+1>>0];a[fa>>0]=a[fa>>0]^a[f+2>>0];a[ga>>0]=a[ga>>0]^a[f+3>>0];a[ha>>0]=a[ha>>0]^a[f+4>>0];a[ia>>0]=a[ia>>0]^a[f+5>>0];a[ja>>0]=a[ja>>0]^a[f+6>>0];a[ka>>0]=a[ka>>0]^a[f+7>>0];a[la>>0]=a[la>>0]^a[f+8>>0];a[ma>>0]=a[ma>>0]^a[f+9>>0];a[na>>0]=a[na>>0]^a[f+10>>0];a[oa>>0]=a[oa>>0]^a[f+11>>0];a[pa>>0]=a[pa>>0]^a[f+12>>0];a[qa>>0]=a[qa>>0]^a[f+13>>0];a[ra>>0]=a[ra>>0]^a[f+14>>0];a[o>>0]=a[o>>0]^a[f+15>>0]}f=n|s;if(!((f|k)&3)){c[n>>2]=c[k>>2]^c[r>>2];c[n+4>>2]=c[k+4>>2]^c[y>>2];c[n+8>>2]=c[k+8>>2]^c[x>>2];c[n+12>>2]=c[k+12>>2]^c[z>>2]}else{a[n>>0]=a[k>>0]^a[r>>0];a[n+1>>0]=a[k+1>>0]^a[Q>>0];a[n+2>>0]=a[k+2>>0]^a[R>>0];a[n+3>>0]=a[k+3>>0]^a[S>>0];a[n+4>>0]=a[k+4>>0]^a[T>>0];a[n+5>>0]=a[k+5>>0]^a[U>>0];a[n+6>>0]=a[k+6>>0]^a[V>>0];a[n+7>>0]=a[k+7>>0]^a[W>>0];a[n+8>>0]=a[k+8>>0]^a[X>>0];a[n+9>>0]=a[k+9>>0]^a[Y>>0];a[n+10>>0]=a[k+10>>0]^a[Z>>0];a[n+11>>0]=a[k+11>>0]^a[_>>0];a[n+12>>0]=a[k+12>>0]^a[aa>>0];a[n+13>>0]=a[k+13>>0]^a[ba>>0];a[n+14>>0]=a[k+14>>0]^a[ca>>0];a[n+15>>0]=a[k+15>>0]^a[da>>0]}Fa=pb[p&63](w,n,n)|0;i=Fa>>>0>i>>>0?Fa:i;if(!(f&3)){Fa=n+4|0;c[n>>2]=c[n>>2]^c[r>>2];Ea=n+8|0;c[Fa>>2]=c[Fa>>2]^c[t>>2];Fa=n+12|0;c[Ea>>2]=c[Ea>>2]^c[u>>2];c[Fa>>2]=c[Fa>>2]^c[v>>2]}else{Fa=n+1|0;a[n>>0]=a[n>>0]^a[r>>0];Ea=n+2|0;a[Fa>>0]=a[Fa>>0]^a[A>>0];Fa=n+3|0;a[Ea>>0]=a[Ea>>0]^a[B>>0];Ea=n+4|0;a[Fa>>0]=a[Fa>>0]^a[C>>0];Fa=n+5|0;a[Ea>>0]=a[Ea>>0]^a[E>>0];Ea=n+6|0;a[Fa>>0]=a[Fa>>0]^a[F>>0];Fa=n+7|0;a[Ea>>0]=a[Ea>>0]^a[G>>0];Ea=n+8|0;a[Fa>>0]=a[Fa>>0]^a[H>>0];Fa=n+9|0;a[Ea>>0]=a[Ea>>0]^a[I>>0];Ea=n+10|0;a[Fa>>0]=a[Fa>>0]^a[J>>0];Fa=n+11|0;a[Ea>>0]=a[Ea>>0]^a[K>>0];Ea=n+12|0;a[Fa>>0]=a[Fa>>0]^a[L>>0];Fa=n+13|0;a[Ea>>0]=a[Ea>>0]^a[M>>0];Ea=n+14|0;a[Fa>>0]=a[Fa>>0]^a[N>>0];Fa=n+15|0;a[Ea>>0]=a[Ea>>0]^a[O>>0];a[Fa>>0]=a[Fa>>0]^a[P>>0]}h=h+-16|0;if(h>>>0<=15)break;else{k=k+16|0;n=n+16|0}}h=sa;g=g+ta|0;e=e+ta|0}else i=0;if(!ua)pm(b+80|0,e+(0-wa)|0,va)}else i=0;while(0);if(h){f=b+64|0;if(!((xa|f)&3)){Fa=f+4|0;c[f>>2]=c[f>>2]^c[xa>>2];Ea=b+72|0;c[Fa>>2]=c[Fa>>2]^c[xa+4>>2];Fa=b+76|0;c[Ea>>2]=c[Ea>>2]^c[b+136>>2];c[Fa>>2]=c[Fa>>2]^c[b+140>>2]}else{Fa=f+1|0;a[f>>0]=a[f>>0]^a[xa>>0];Ea=f+2|0;a[Fa>>0]=a[Fa>>0]^a[xa+1>>0];Fa=f+3|0;a[Ea>>0]=a[Ea>>0]^a[xa+2>>0];Ea=f+4|0;a[Fa>>0]=a[Fa>>0]^a[xa+3>>0];Fa=f+5|0;a[Ea>>0]=a[Ea>>0]^a[xa+4>>0];Ea=f+6|0;a[Fa>>0]=a[Fa>>0]^a[xa+5>>0];Fa=f+7|0;a[Ea>>0]=a[Ea>>0]^a[xa+6>>0];Ea=b+72|0;a[Fa>>0]=a[Fa>>0]^a[xa+7>>0];Fa=b+73|0;a[Ea>>0]=a[Ea>>0]^a[b+136>>0];Ea=b+74|0;a[Fa>>0]=a[Fa>>0]^a[b+137>>0];Fa=b+75|0;a[Ea>>0]=a[Ea>>0]^a[b+138>>0];Ea=b+76|0;a[Fa>>0]=a[Fa>>0]^a[b+139>>0];Fa=b+77|0;a[Ea>>0]=a[Ea>>0]^a[b+140>>0];Ea=b+78|0;a[Fa>>0]=a[Fa>>0]^a[b+141>>0];Fa=b+79|0;a[Ea>>0]=a[Ea>>0]^a[b+142>>0];a[Fa>>0]=a[Fa>>0]^a[b+143>>0]}Fa=pb[c[(c[Ca>>2]|0)+36>>2]&63](b+496|0,j,f)|0;i=Fa>>>0>i>>>0?Fa:i;do if(!d){p=c[j>>2]|0;c[za>>2]=p;r=c[j+4>>2]|0;c[za+4>>2]=r;c[za+8>>2]=c[j+8>>2];c[za+12>>2]=c[j+12>>2];do if(!(g&3)){if(h>>>0<=3){k=za;f=h;ya=55;break}n=h+-4|0;o=n&-4;s=o+4|0;q=g+s|0;f=za;k=h;while(1){c[f>>2]=c[g>>2];k=k+-4|0;if(k>>>0<=3)break;else{g=g+4|0;f=f+4|0}}f=n-o|0;if(!f){g=p;f=r}else{g=q;k=za+s|0;ya=55}}else{k=za;f=h;ya=55}while(0);if((ya|0)==55){while(1){a[k>>0]=a[g>>0]|0;f=f+-1|0;if(!f)break;else{g=g+1|0;k=k+1|0;ya=55}}g=c[j>>2]|0;f=c[j+4>>2]|0}r=za+4|0;c[za>>2]=c[za>>2]^g;q=za+8|0;c[r>>2]=c[r>>2]^f;p=za+12|0;c[q>>2]=c[q>>2]^c[j+8>>2];c[p>>2]=c[p>>2]^c[j+12>>2];a[za+h>>0]=-128;if(!(e&3))if(h>>>0>3){k=h+-4|0;n=k&-4;o=n+4|0;g=za+o|0;j=za;f=e;while(1){c[f>>2]=c[j>>2];h=h+-4|0;if(h>>>0<=3)break;else{j=j+4|0;f=f+4|0}}h=k-n|0;e=e+o|0}else g=za;else g=za;if(h|0)while(1){a[e>>0]=a[g>>0]|0;h=h+-1|0;if(!h)break;else{g=g+1|0;e=e+1|0}}h=b+80|0;if(!(h&3)){Fa=h+4|0;c[h>>2]=c[h>>2]^c[za>>2];Ea=b+88|0;c[Fa>>2]=c[Fa>>2]^c[r>>2];Fa=b+92|0;c[Ea>>2]=c[Ea>>2]^c[q>>2];c[Fa>>2]=c[Fa>>2]^c[p>>2];break}else{Fa=h+1|0;a[h>>0]=a[h>>0]^a[za>>0];Ea=h+2|0;a[Fa>>0]=a[Fa>>0]^a[za+1>>0];Fa=h+3|0;a[Ea>>0]=a[Ea>>0]^a[za+2>>0];Ea=h+4|0;a[Fa>>0]=a[Fa>>0]^a[za+3>>0];Fa=h+5|0;a[Ea>>0]=a[Ea>>0]^a[za+4>>0];Ea=h+6|0;a[Fa>>0]=a[Fa>>0]^a[za+5>>0];Fa=h+7|0;a[Ea>>0]=a[Ea>>0]^a[za+6>>0];Ea=b+88|0;a[Fa>>0]=a[Fa>>0]^a[za+7>>0];Fa=b+89|0;a[Ea>>0]=a[Ea>>0]^a[za+8>>0];Ea=b+90|0;a[Fa>>0]=a[Fa>>0]^a[za+9>>0];Fa=b+91|0;a[Ea>>0]=a[Ea>>0]^a[za+10>>0];Ea=b+92|0;a[Fa>>0]=a[Fa>>0]^a[za+11>>0];Fa=b+93|0;a[Ea>>0]=a[Ea>>0]^a[za+12>>0];Ea=b+94|0;a[Fa>>0]=a[Fa>>0]^a[za+13>>0];Fa=b+95|0;a[Ea>>0]=a[Ea>>0]^a[za+14>>0];a[Fa>>0]=a[Fa>>0]^a[za+15>>0];break}}else{s=g;do if(!(s&3)){if(h>>>0<=3){n=g;k=za;f=h;ya=37;break}p=h+-4|0;q=p&-4;r=q+4|0;n=g+r|0;f=g;k=za;o=h;while(1){c[k>>2]=c[f>>2];o=o+-4|0;if(o>>>0<=3)break;else{f=f+4|0;k=k+4|0}}f=p-q|0;if(f|0){k=za+r|0;ya=37}}else{n=g;k=za;f=h;ya=37}while(0);if((ya|0)==37)while(1){a[k>>0]=a[n>>0]|0;f=f+-1|0;if(!f)break;else{n=n+1|0;k=k+1|0;ya=37}}f=za+h|0;Yq(f|0,0,16-h|0)|0;a[f>>0]=-128;f=b+80|0;if(!(f&3)){Fa=f+4|0;c[f>>2]=c[f>>2]^c[za>>2];Ea=b+88|0;c[Fa>>2]=c[Fa>>2]^c[za+4>>2];Fa=b+92|0;c[Ea>>2]=c[Ea>>2]^c[za+8>>2];c[Fa>>2]=c[Fa>>2]^c[za+12>>2]}else{Fa=f+1|0;a[f>>0]=a[f>>0]^a[za>>0];Ea=f+2|0;a[Fa>>0]=a[Fa>>0]^a[za+1>>0];Fa=f+3|0;a[Ea>>0]=a[Ea>>0]^a[za+2>>0];Ea=f+4|0;a[Fa>>0]=a[Fa>>0]^a[za+3>>0];Fa=f+5|0;a[Ea>>0]=a[Ea>>0]^a[za+4>>0];Ea=f+6|0;a[Fa>>0]=a[Fa>>0]^a[za+5>>0];Fa=f+7|0;a[Ea>>0]=a[Ea>>0]^a[za+6>>0];Ea=b+88|0;a[Fa>>0]=a[Fa>>0]^a[za+7>>0];Fa=b+89|0;a[Ea>>0]=a[Ea>>0]^a[za+8>>0];Ea=b+90|0;a[Fa>>0]=a[Fa>>0]^a[za+9>>0];Fa=b+91|0;a[Ea>>0]=a[Ea>>0]^a[za+10>>0];Ea=b+92|0;a[Fa>>0]=a[Fa>>0]^a[za+11>>0];Fa=b+93|0;a[Ea>>0]=a[Ea>>0]^a[za+12>>0];Ea=b+94|0;a[Fa>>0]=a[Fa>>0]^a[za+13>>0];Fa=b+95|0;a[Ea>>0]=a[Ea>>0]^a[za+14>>0];a[Fa>>0]=a[Fa>>0]^a[za+15>>0]}if(!((s|e)&3))if(h>>>0>3){n=h+-4|0;o=n&-4;q=o+4|0;p=j+q|0;f=g;k=e;while(1){c[k>>2]=c[j>>2]^c[f>>2];h=h+-4|0;if(h>>>0<=3)break;else{j=j+4|0;f=f+4|0;k=k+4|0}}h=n-o|0;j=p;g=g+q|0;e=e+q|0}if(h|0)while(1){a[e>>0]=a[j>>0]^a[g>>0];h=h+-1|0;if(!h)break;else{j=j+1|0;g=g+1|0;e=e+1|0}}}while(0)}if(a[Aa>>0]&8){g=b+416|0;h=b+80|0;e=b+64|0;j=g;if(!((h|j|e)&3)){c[g>>2]=c[e>>2]^c[h>>2];c[b+420>>2]=c[e+4>>2]^c[h+4>>2];c[b+424>>2]=c[b+72>>2]^c[b+88>>2];c[b+428>>2]=c[b+76>>2]^c[b+92>>2]}else{a[g>>0]=a[e>>0]^a[h>>0];a[g+1>>0]=a[e+1>>0]^a[h+1>>0];a[g+2>>0]=a[e+2>>0]^a[h+2>>0];Fa=b+420|0;a[g+3>>0]=a[e+3>>0]^a[h+3>>0];a[Fa>>0]=a[e+4>>0]^a[h+4>>0];a[Fa+1>>0]=a[e+5>>0]^a[h+5>>0];a[Fa+2>>0]=a[e+6>>0]^a[h+6>>0];Ea=b+424|0;a[Fa+3>>0]=a[e+7>>0]^a[h+7>>0];a[Ea>>0]=a[b+72>>0]^a[b+88>>0];a[Ea+1>>0]=a[b+73>>0]^a[b+89>>0];a[Ea+2>>0]=a[b+74>>0]^a[b+90>>0];Fa=b+428|0;a[Ea+3>>0]=a[b+75>>0]^a[b+91>>0];a[Fa>>0]=a[b+76>>0]^a[b+92>>0];a[Fa+1>>0]=a[b+77>>0]^a[b+93>>0];a[Fa+2>>0]=a[b+78>>0]^a[b+94>>0];a[Fa+3>>0]=a[b+79>>0]^a[b+95>>0]}h=b+144|0;if(!((h|j)&3)){Fa=b+420|0;c[g>>2]=c[g>>2]^c[h>>2];Ea=b+424|0;c[Fa>>2]=c[Fa>>2]^c[b+148>>2];Fa=b+428|0;c[Ea>>2]=c[Ea>>2]^c[b+152>>2];c[Fa>>2]=c[Fa>>2]^c[b+156>>2]}else{Fa=g+1|0;a[g>>0]=a[g>>0]^a[h>>0];Ea=g+2|0;a[Fa>>0]=a[Fa>>0]^a[b+145>>0];Fa=g+3|0;a[Ea>>0]=a[Ea>>0]^a[b+146>>0];Ea=b+420|0;a[Fa>>0]=a[Fa>>0]^a[b+147>>0];Fa=Ea+1|0;a[Ea>>0]=a[Ea>>0]^a[b+148>>0];Aa=Ea+2|0;a[Fa>>0]=a[Fa>>0]^a[b+149>>0];Ea=Ea+3|0;a[Aa>>0]=a[Aa>>0]^a[b+150>>0];Aa=b+424|0;a[Ea>>0]=a[Ea>>0]^a[b+151>>0];Ea=Aa+1|0;a[Aa>>0]=a[Aa>>0]^a[b+152>>0];Fa=Aa+2|0;a[Ea>>0]=a[Ea>>0]^a[b+153>>0];Aa=Aa+3|0;a[Fa>>0]=a[Fa>>0]^a[b+154>>0];Fa=b+428|0;a[Aa>>0]=a[Aa>>0]^a[b+155>>0];Aa=Fa+1|0;a[Fa>>0]=a[Fa>>0]^a[b+156>>0];Ea=Fa+2|0;a[Aa>>0]=a[Aa>>0]^a[b+157>>0];Fa=Fa+3|0;a[Ea>>0]=a[Ea>>0]^a[b+158>>0];a[Fa>>0]=a[Fa>>0]^a[b+159>>0]}Fa=pb[c[(c[Ca>>2]|0)+36>>2]&63](b+496|0,g,g)|0;a[Ba>>0]=a[Ba>>0]|1;i=Fa>>>0>i>>>0?Fa:i}if(!i){Fa=0;l=Da;return Fa|0}Te(i+16|0);Fa=0;l=Da;return Fa|0}function pm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;if(!e)return;s=b;t=b+4|0;u=b+8|0;v=b+12|0;w=b+1|0;x=b+2|0;f=b+3|0;g=b+4|0;h=b+5|0;i=b+6|0;j=b+7|0;k=b+8|0;l=b+9|0;m=b+10|0;n=b+11|0;o=b+12|0;p=b+13|0;q=b+14|0;r=b+15|0;while(1){if(!((d|s)&3)){c[b>>2]=c[b>>2]^c[d>>2];c[t>>2]=c[t>>2]^c[d+4>>2];c[u>>2]=c[u>>2]^c[d+8>>2];c[v>>2]=c[v>>2]^c[d+12>>2]}else{a[b>>0]=a[b>>0]^a[d>>0];a[w>>0]=a[w>>0]^a[d+1>>0];a[x>>0]=a[x>>0]^a[d+2>>0];a[f>>0]=a[f>>0]^a[d+3>>0];a[g>>0]=a[g>>0]^a[d+4>>0];a[h>>0]=a[h>>0]^a[d+5>>0];a[i>>0]=a[i>>0]^a[d+6>>0];a[j>>0]=a[j>>0]^a[d+7>>0];a[k>>0]=a[k>>0]^a[d+8>>0];a[l>>0]=a[l>>0]^a[d+9>>0];a[m>>0]=a[m>>0]^a[d+10>>0];a[n>>0]=a[n>>0]^a[d+11>>0];a[o>>0]=a[o>>0]^a[d+12>>0];a[p>>0]=a[p>>0]^a[d+13>>0];a[q>>0]=a[q>>0]^a[d+14>>0];a[r>>0]=a[r>>0]^a[d+15>>0]}e=e+-1|0;if(!e)break;else d=d+16|0}return}function qm(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return om(a,0,b,c,d,e)|0} +function mi(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,qb=0,rb=0,sb=0,tb=0,ub=0,wb=0,xb=0,yb=0,zb=0,Ab=0,Bb=0,Cb=0,Db=0,Eb=0,Fb=0,Gb=0;Gb=l;l=l+16|0;if((l|0)>=(m|0))$(16);Eb=Gb;Fb=b+496|0;if(!g){bi(Fb);g=c[Fb+500>>2]|0;if(g|0)vb[g&3]();i=c[Fb+492>>2]|0;if(!f)g=0;else{j=b+464|0;k=b+64|0;n=k;o=k+4|0;p=b+72|0;q=b+76|0;r=Eb+4|0;s=Eb+8|0;t=Eb+12|0;u=(n&3|0)==0;v=b+80|0;w=(v&3|0)==0;x=v+4|0;y=b+88|0;z=b+92|0;A=b+160|0;B=Eb+1|0;C=Eb+2|0;E=Eb+3|0;F=Eb+4|0;G=F+1|0;H=F+2|0;I=F+3|0;J=Eb+8|0;K=J+1|0;L=J+2|0;M=J+3|0;N=Eb+12|0;O=N+1|0;P=N+2|0;Q=N+3|0;R=Eb+1|0;S=v+1|0;T=Eb+2|0;U=v+2|0;V=Eb+3|0;W=v+3|0;X=Eb+4|0;Y=v+4|0;Z=X+1|0;_=v+5|0;aa=X+2|0;ba=v+6|0;ca=X+3|0;da=v+7|0;ea=Eb+8|0;fa=b+88|0;ga=ea+1|0;ha=b+89|0;ia=ea+2|0;ja=b+90|0;ka=ea+3|0;la=b+91|0;ma=Eb+12|0;na=b+92|0;oa=ma+1|0;pa=b+93|0;qa=ma+2|0;ra=b+94|0;sa=ma+3|0;ta=b+95|0;ua=k+1|0;va=Eb+1|0;wa=k+2|0;xa=Eb+2|0;ya=k+3|0;za=Eb+3|0;Aa=k+4|0;Ba=Eb+4|0;Ca=k+5|0;Da=Ba+1|0;Ea=k+6|0;Fa=Ba+2|0;Ga=k+7|0;Ha=Ba+3|0;Ia=b+72|0;Ja=Eb+8|0;Ka=b+73|0;La=Ja+1|0;Ma=b+74|0;Na=Ja+2|0;Oa=b+75|0;Pa=Ja+3|0;Qa=b+76|0;Ra=Eb+12|0;Sa=b+77|0;Ta=Ra+1|0;Ua=b+78|0;Va=Ra+2|0;Wa=b+79|0;Xa=Ra+3|0;Ya=Eb+1|0;Za=Eb+2|0;_a=Eb+3|0;$a=Eb+4|0;ab=$a+1|0;bb=$a+2|0;cb=$a+3|0;db=Eb+8|0;eb=db+1|0;fb=db+2|0;gb=db+3|0;hb=Eb+12|0;ib=hb+1|0;jb=hb+2|0;kb=hb+3|0;lb=k+1|0;mb=k+2|0;nb=k+3|0;ob=k+4|0;qb=k+5|0;rb=k+6|0;sb=k+7|0;tb=b+72|0;ub=b+73|0;wb=b+74|0;xb=b+75|0;yb=b+76|0;zb=b+77|0;Ab=b+78|0;Bb=b+79|0;while(1){g=j;g=_q(c[g>>2]|0,c[g+4>>2]|0,1,0)|0;h=D;Cb=j;c[Cb>>2]=g;c[Cb+4>>2]=h;if(!((g|0)==0&0==0)?(Db=$q(g|0)|0,Db>>>0<16):0)g=A+(Db<<4)|0;else g=km(b,Eb,g,h)|0;if(!((g|n)&3)){c[k>>2]=c[k>>2]^c[g>>2];c[o>>2]=c[o>>2]^c[g+4>>2];c[p>>2]=c[p>>2]^c[g+8>>2];c[q>>2]=c[q>>2]^c[g+12>>2]}else{a[k>>0]=a[k>>0]^a[g>>0];a[lb>>0]=a[lb>>0]^a[g+1>>0];a[mb>>0]=a[mb>>0]^a[g+2>>0];a[nb>>0]=a[nb>>0]^a[g+3>>0];a[ob>>0]=a[ob>>0]^a[g+4>>0];a[qb>>0]=a[qb>>0]^a[g+5>>0];a[rb>>0]=a[rb>>0]^a[g+6>>0];a[sb>>0]=a[sb>>0]^a[g+7>>0];a[tb>>0]=a[tb>>0]^a[g+8>>0];a[ub>>0]=a[ub>>0]^a[g+9>>0];a[wb>>0]=a[wb>>0]^a[g+10>>0];a[xb>>0]=a[xb>>0]^a[g+11>>0];a[yb>>0]=a[yb>>0]^a[g+12>>0];a[zb>>0]=a[zb>>0]^a[g+13>>0];a[Ab>>0]=a[Ab>>0]^a[g+14>>0];a[Bb>>0]=a[Bb>>0]^a[g+15>>0]}if(!(e&3)){c[Eb>>2]=c[e>>2];c[r>>2]=c[e+4>>2];c[s>>2]=c[e+8>>2];c[t>>2]=c[e+12>>2]}else{a[Eb>>0]=a[e>>0]|0;a[Ya>>0]=a[e+1>>0]|0;a[Za>>0]=a[e+2>>0]|0;a[_a>>0]=a[e+3>>0]|0;a[$a>>0]=a[e+4>>0]|0;a[ab>>0]=a[e+5>>0]|0;a[bb>>0]=a[e+6>>0]|0;a[cb>>0]=a[e+7>>0]|0;a[db>>0]=a[e+8>>0]|0;a[eb>>0]=a[e+9>>0]|0;a[fb>>0]=a[e+10>>0]|0;a[gb>>0]=a[e+11>>0]|0;a[hb>>0]=a[e+12>>0]|0;a[ib>>0]=a[e+13>>0]|0;a[jb>>0]=a[e+14>>0]|0;a[kb>>0]=a[e+15>>0]|0}if(u){c[Eb>>2]=c[Eb>>2]^c[k>>2];c[r>>2]=c[r>>2]^c[o>>2];c[s>>2]=c[s>>2]^c[p>>2];c[t>>2]=c[t>>2]^c[q>>2];g=pb[i&63](Fb,Eb,Eb)|0;c[Eb>>2]=c[Eb>>2]^c[k>>2];c[r>>2]=c[r>>2]^c[o>>2];c[s>>2]=c[s>>2]^c[p>>2];c[t>>2]=c[t>>2]^c[q>>2]}else{a[Eb>>0]=a[Eb>>0]^a[k>>0];a[va>>0]=a[va>>0]^a[ua>>0];a[xa>>0]=a[xa>>0]^a[wa>>0];a[za>>0]=a[za>>0]^a[ya>>0];a[Ba>>0]=a[Ba>>0]^a[Aa>>0];a[Da>>0]=a[Da>>0]^a[Ca>>0];a[Fa>>0]=a[Fa>>0]^a[Ea>>0];a[Ha>>0]=a[Ha>>0]^a[Ga>>0];a[Ja>>0]=a[Ja>>0]^a[Ia>>0];a[La>>0]=a[La>>0]^a[Ka>>0];a[Na>>0]=a[Na>>0]^a[Ma>>0];a[Pa>>0]=a[Pa>>0]^a[Oa>>0];a[Ra>>0]=a[Ra>>0]^a[Qa>>0];a[Ta>>0]=a[Ta>>0]^a[Sa>>0];a[Va>>0]=a[Va>>0]^a[Ua>>0];a[Xa>>0]=a[Xa>>0]^a[Wa>>0];g=pb[i&63](Fb,Eb,Eb)|0;a[Eb>>0]=a[Eb>>0]^a[k>>0];a[va>>0]=a[va>>0]^a[ua>>0];a[xa>>0]=a[xa>>0]^a[wa>>0];a[za>>0]=a[za>>0]^a[ya>>0];a[Ba>>0]=a[Ba>>0]^a[Aa>>0];a[Da>>0]=a[Da>>0]^a[Ca>>0];a[Fa>>0]=a[Fa>>0]^a[Ea>>0];a[Ha>>0]=a[Ha>>0]^a[Ga>>0];a[Ja>>0]=a[Ja>>0]^a[Ia>>0];a[La>>0]=a[La>>0]^a[Ka>>0];a[Na>>0]=a[Na>>0]^a[Ma>>0];a[Pa>>0]=a[Pa>>0]^a[Oa>>0];a[Ra>>0]=a[Ra>>0]^a[Qa>>0];a[Ta>>0]=a[Ta>>0]^a[Sa>>0];a[Va>>0]=a[Va>>0]^a[Ua>>0];a[Xa>>0]=a[Xa>>0]^a[Wa>>0]}if(w){h=c[Eb>>2]|0;c[v>>2]=c[v>>2]^h;c[x>>2]=c[x>>2]^c[r>>2];c[y>>2]=c[y>>2]^c[s>>2];c[z>>2]=c[z>>2]^c[t>>2];h=h&255}else{h=a[Eb>>0]|0;a[v>>0]=a[v>>0]^h;a[S>>0]=a[S>>0]^a[R>>0];a[U>>0]=a[U>>0]^a[T>>0];a[W>>0]=a[W>>0]^a[V>>0];a[Y>>0]=a[Y>>0]^a[X>>0];a[_>>0]=a[_>>0]^a[Z>>0];a[ba>>0]=a[ba>>0]^a[aa>>0];a[da>>0]=a[da>>0]^a[ca>>0];a[fa>>0]=a[fa>>0]^a[ea>>0];a[ha>>0]=a[ha>>0]^a[ga>>0];a[ja>>0]=a[ja>>0]^a[ia>>0];a[la>>0]=a[la>>0]^a[ka>>0];a[na>>0]=a[na>>0]^a[ma>>0];a[pa>>0]=a[pa>>0]^a[oa>>0];a[ra>>0]=a[ra>>0]^a[qa>>0];a[ta>>0]=a[ta>>0]^a[sa>>0]}if(!(d&3)){c[d>>2]=c[Eb>>2];c[d+4>>2]=c[r>>2];c[d+8>>2]=c[s>>2];c[d+12>>2]=c[t>>2]}else{a[d>>0]=h;a[d+1>>0]=a[B>>0]|0;a[d+2>>0]=a[C>>0]|0;a[d+3>>0]=a[E>>0]|0;a[d+4>>0]=a[F>>0]|0;a[d+5>>0]=a[G>>0]|0;a[d+6>>0]=a[H>>0]|0;a[d+7>>0]=a[I>>0]|0;a[d+8>>0]=a[J>>0]|0;a[d+9>>0]=a[K>>0]|0;a[d+10>>0]=a[L>>0]|0;a[d+11>>0]=a[M>>0]|0;a[d+12>>0]=a[N>>0]|0;a[d+13>>0]=a[O>>0]|0;a[d+14>>0]=a[P>>0]|0;a[d+15>>0]=a[Q>>0]|0}f=f+-1|0;if(!f)break;else{d=d+16|0;e=e+16|0}}}}else{g=c[Fb+496>>2]|0;if(g|0)vb[g&3]();_=c[Fb+488>>2]|0;if(!f)g=0;else{aa=b+464|0;ba=b+64|0;ca=ba;da=ba+4|0;ea=b+72|0;fa=b+76|0;ga=Eb+4|0;ha=Eb+8|0;ia=Eb+12|0;ja=b+80|0;ka=(ja&3|0)==0;la=ja+4|0;ma=b+88|0;na=b+92|0;oa=(ca&3|0)==0;pa=b+160|0;qa=Eb+1|0;ra=Eb+2|0;sa=Eb+3|0;ta=Eb+4|0;ua=ta+1|0;va=ta+2|0;wa=ta+3|0;xa=Eb+8|0;ya=xa+1|0;za=xa+2|0;Aa=xa+3|0;Ba=Eb+12|0;Ca=Ba+1|0;Da=Ba+2|0;Ea=Ba+3|0;Fa=ba+1|0;Ga=Eb+1|0;Ha=ba+2|0;Ia=Eb+2|0;Ja=ba+3|0;Ka=Eb+3|0;La=ba+4|0;Ma=Eb+4|0;Na=ba+5|0;Oa=Ma+1|0;Pa=ba+6|0;Qa=Ma+2|0;Ra=ba+7|0;Sa=Ma+3|0;Ta=b+72|0;Ua=Eb+8|0;Va=b+73|0;Wa=Ua+1|0;Xa=b+74|0;Ya=Ua+2|0;Za=b+75|0;_a=Ua+3|0;$a=b+76|0;ab=Eb+12|0;bb=b+77|0;cb=ab+1|0;db=b+78|0;eb=ab+2|0;fb=b+79|0;gb=ab+3|0;hb=Eb+1|0;ib=ja+1|0;jb=Eb+2|0;kb=ja+2|0;lb=Eb+3|0;mb=ja+3|0;nb=Eb+4|0;ob=ja+4|0;qb=nb+1|0;rb=ja+5|0;sb=nb+2|0;tb=ja+6|0;ub=nb+3|0;wb=ja+7|0;xb=Eb+8|0;yb=b+88|0;zb=xb+1|0;Ab=b+89|0;Bb=xb+2|0;i=b+90|0;j=xb+3|0;k=b+91|0;n=Eb+12|0;o=b+92|0;p=n+1|0;q=b+93|0;r=n+2|0;s=b+94|0;t=n+3|0;u=b+95|0;v=Eb+1|0;w=Eb+2|0;x=Eb+3|0;y=Eb+4|0;z=y+1|0;A=y+2|0;B=y+3|0;C=Eb+8|0;E=C+1|0;F=C+2|0;G=C+3|0;H=Eb+12|0;I=H+1|0;J=H+2|0;K=H+3|0;L=ba+1|0;M=ba+2|0;N=ba+3|0;O=ba+4|0;P=ba+5|0;Q=ba+6|0;R=ba+7|0;S=b+72|0;T=b+73|0;U=b+74|0;V=b+75|0;W=b+76|0;X=b+77|0;Y=b+78|0;Z=b+79|0;while(1){g=aa;g=_q(c[g>>2]|0,c[g+4>>2]|0,1,0)|0;h=D;Db=aa;c[Db>>2]=g;c[Db+4>>2]=h;if(!((g|0)==0&0==0)?(Cb=$q(g|0)|0,Cb>>>0<16):0)g=pa+(Cb<<4)|0;else g=km(b,Eb,g,h)|0;if(!((g|ca)&3)){c[ba>>2]=c[ba>>2]^c[g>>2];c[da>>2]=c[da>>2]^c[g+4>>2];c[ea>>2]=c[ea>>2]^c[g+8>>2];c[fa>>2]=c[fa>>2]^c[g+12>>2]}else{a[ba>>0]=a[ba>>0]^a[g>>0];a[L>>0]=a[L>>0]^a[g+1>>0];a[M>>0]=a[M>>0]^a[g+2>>0];a[N>>0]=a[N>>0]^a[g+3>>0];a[O>>0]=a[O>>0]^a[g+4>>0];a[P>>0]=a[P>>0]^a[g+5>>0];a[Q>>0]=a[Q>>0]^a[g+6>>0];a[R>>0]=a[R>>0]^a[g+7>>0];a[S>>0]=a[S>>0]^a[g+8>>0];a[T>>0]=a[T>>0]^a[g+9>>0];a[U>>0]=a[U>>0]^a[g+10>>0];a[V>>0]=a[V>>0]^a[g+11>>0];a[W>>0]=a[W>>0]^a[g+12>>0];a[X>>0]=a[X>>0]^a[g+13>>0];a[Y>>0]=a[Y>>0]^a[g+14>>0];a[Z>>0]=a[Z>>0]^a[g+15>>0]}if(!(e&3)){c[Eb>>2]=c[e>>2];c[ga>>2]=c[e+4>>2];c[ha>>2]=c[e+8>>2];c[ia>>2]=c[e+12>>2]}else{a[Eb>>0]=a[e>>0]|0;a[v>>0]=a[e+1>>0]|0;a[w>>0]=a[e+2>>0]|0;a[x>>0]=a[e+3>>0]|0;a[y>>0]=a[e+4>>0]|0;a[z>>0]=a[e+5>>0]|0;a[A>>0]=a[e+6>>0]|0;a[B>>0]=a[e+7>>0]|0;a[C>>0]=a[e+8>>0]|0;a[E>>0]=a[e+9>>0]|0;a[F>>0]=a[e+10>>0]|0;a[G>>0]=a[e+11>>0]|0;a[H>>0]=a[e+12>>0]|0;a[I>>0]=a[e+13>>0]|0;a[J>>0]=a[e+14>>0]|0;a[K>>0]=a[e+15>>0]|0}if(ka){g=c[Eb>>2]|0;c[ja>>2]=c[ja>>2]^g;c[la>>2]=c[la>>2]^c[ga>>2];c[ma>>2]=c[ma>>2]^c[ha>>2];c[na>>2]=c[na>>2]^c[ia>>2];g=g&255}else{g=a[Eb>>0]|0;a[ja>>0]=a[ja>>0]^g;a[ib>>0]=a[ib>>0]^a[hb>>0];a[kb>>0]=a[kb>>0]^a[jb>>0];a[mb>>0]=a[mb>>0]^a[lb>>0];a[ob>>0]=a[ob>>0]^a[nb>>0];a[rb>>0]=a[rb>>0]^a[qb>>0];a[tb>>0]=a[tb>>0]^a[sb>>0];a[wb>>0]=a[wb>>0]^a[ub>>0];a[yb>>0]=a[yb>>0]^a[xb>>0];a[Ab>>0]=a[Ab>>0]^a[zb>>0];a[i>>0]=a[i>>0]^a[Bb>>0];a[k>>0]=a[k>>0]^a[j>>0];a[o>>0]=a[o>>0]^a[n>>0];a[q>>0]=a[q>>0]^a[p>>0];a[s>>0]=a[s>>0]^a[r>>0];a[u>>0]=a[u>>0]^a[t>>0]}if(oa){c[Eb>>2]=c[Eb>>2]^c[ba>>2];c[ga>>2]=c[ga>>2]^c[da>>2];c[ha>>2]=c[ha>>2]^c[ea>>2];c[ia>>2]=c[ia>>2]^c[fa>>2];g=pb[_&63](Fb,Eb,Eb)|0;c[Eb>>2]=c[Eb>>2]^c[ba>>2];c[ga>>2]=c[ga>>2]^c[da>>2];c[ha>>2]=c[ha>>2]^c[ea>>2];c[ia>>2]=c[ia>>2]^c[fa>>2]}else{a[Eb>>0]=g^a[ba>>0];a[Ga>>0]=a[Ga>>0]^a[Fa>>0];a[Ia>>0]=a[Ia>>0]^a[Ha>>0];a[Ka>>0]=a[Ka>>0]^a[Ja>>0];a[Ma>>0]=a[Ma>>0]^a[La>>0];a[Oa>>0]=a[Oa>>0]^a[Na>>0];a[Qa>>0]=a[Qa>>0]^a[Pa>>0];a[Sa>>0]=a[Sa>>0]^a[Ra>>0];a[Ua>>0]=a[Ua>>0]^a[Ta>>0];a[Wa>>0]=a[Wa>>0]^a[Va>>0];a[Ya>>0]=a[Ya>>0]^a[Xa>>0];a[_a>>0]=a[_a>>0]^a[Za>>0];a[ab>>0]=a[ab>>0]^a[$a>>0];a[cb>>0]=a[cb>>0]^a[bb>>0];a[eb>>0]=a[eb>>0]^a[db>>0];a[gb>>0]=a[gb>>0]^a[fb>>0];g=pb[_&63](Fb,Eb,Eb)|0;a[Eb>>0]=a[Eb>>0]^a[ba>>0];a[Ga>>0]=a[Ga>>0]^a[Fa>>0];a[Ia>>0]=a[Ia>>0]^a[Ha>>0];a[Ka>>0]=a[Ka>>0]^a[Ja>>0];a[Ma>>0]=a[Ma>>0]^a[La>>0];a[Oa>>0]=a[Oa>>0]^a[Na>>0];a[Qa>>0]=a[Qa>>0]^a[Pa>>0];a[Sa>>0]=a[Sa>>0]^a[Ra>>0];a[Ua>>0]=a[Ua>>0]^a[Ta>>0];a[Wa>>0]=a[Wa>>0]^a[Va>>0];a[Ya>>0]=a[Ya>>0]^a[Xa>>0];a[_a>>0]=a[_a>>0]^a[Za>>0];a[ab>>0]=a[ab>>0]^a[$a>>0];a[cb>>0]=a[cb>>0]^a[bb>>0];a[eb>>0]=a[eb>>0]^a[db>>0];a[gb>>0]=a[gb>>0]^a[fb>>0]}if(!(d&3)){c[d>>2]=c[Eb>>2];c[d+4>>2]=c[ga>>2];c[d+8>>2]=c[ha>>2];c[d+12>>2]=c[ia>>2]}else{a[d>>0]=a[Eb>>0]|0;a[d+1>>0]=a[qa>>0]|0;a[d+2>>0]=a[ra>>0]|0;a[d+3>>0]=a[sa>>0]|0;a[d+4>>0]=a[ta>>0]|0;a[d+5>>0]=a[ua>>0]|0;a[d+6>>0]=a[va>>0]|0;a[d+7>>0]=a[wa>>0]|0;a[d+8>>0]=a[xa>>0]|0;a[d+9>>0]=a[ya>>0]|0;a[d+10>>0]=a[za>>0]|0;a[d+11>>0]=a[Aa>>0]|0;a[d+12>>0]=a[Ba>>0]|0;a[d+13>>0]=a[Ca>>0]|0;a[d+14>>0]=a[Da>>0]|0;a[d+15>>0]=a[Ea>>0]|0}f=f+-1|0;if(!f)break;else{d=d+16|0;e=e+16|0}}}}if(!g){l=Gb;return}Te(g+16|0);l=Gb;return}function ni(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0;Za=l;l=l+16|0;if((l|0)>=(m|0))$(16);Xa=Za;Ya=b+496|0;f=c[Ya+496>>2]|0;if(f|0)vb[f&3]();La=c[Ya+488>>2]|0;if(!e){Ya=Xa;c[Ya>>2]=0;c[Ya+4>>2]=0;Ya=Xa+8|0;c[Ya>>2]=0;c[Ya+4>>2]=0;l=Za;return}v=b+472|0;w=b+432|0;x=w;y=b+436|0;z=b+440|0;A=b+444|0;B=Xa+4|0;C=Xa+8|0;E=Xa+12|0;F=b+448|0;G=(F&3|0)==0;H=b+452|0;I=b+456|0;J=b+460|0;K=b+160|0;L=Xa+1|0;M=F+1|0;N=Xa+2|0;O=F+2|0;P=Xa+3|0;Q=F+3|0;R=Xa+4|0;S=b+452|0;T=R+1|0;U=S+1|0;V=R+2|0;W=S+2|0;X=R+3|0;Y=S+3|0;Z=Xa+8|0;_=b+456|0;aa=Z+1|0;ba=_+1|0;ca=Z+2|0;da=_+2|0;ea=Z+3|0;fa=_+3|0;ga=Xa+12|0;ha=b+460|0;ia=ga+1|0;ja=ha+1|0;ka=ga+2|0;la=ha+2|0;ma=ga+3|0;na=ha+3|0;oa=w+1|0;pa=Xa+1|0;qa=w+2|0;ra=Xa+2|0;sa=w+3|0;ta=Xa+3|0;ua=b+436|0;va=Xa+4|0;wa=ua+1|0;xa=va+1|0;ya=ua+2|0;za=va+2|0;Aa=ua+3|0;Ba=va+3|0;Ca=b+440|0;Da=Xa+8|0;Ea=Ca+1|0;Fa=Da+1|0;Ga=Ca+2|0;Ha=Da+2|0;Ia=Ca+3|0;Ja=Da+3|0;Ka=b+444|0;Ma=Xa+12|0;Na=Ka+1|0;Oa=Ma+1|0;Pa=Ka+2|0;Qa=Ma+2|0;Ra=Ka+3|0;Sa=Ma+3|0;Ta=w+1|0;Ua=w+2|0;Va=w+3|0;h=b+436|0;i=h+1|0;j=h+2|0;k=h+3|0;n=b+440|0;o=n+1|0;p=n+2|0;q=n+3|0;r=b+444|0;s=r+1|0;t=r+2|0;u=r+3|0;g=e;while(1){f=v;f=_q(c[f>>2]|0,c[f+4>>2]|0,1,0)|0;e=D;_a=v;c[_a>>2]=f;c[_a+4>>2]=e;if(!((f|0)==0&0==0)?(Wa=$q(f|0)|0,Wa>>>0<16):0)f=K+(Wa<<4)|0;else f=km(b,Xa,f,e)|0;if(!((f|x)&3)){c[w>>2]=c[w>>2]^c[f>>2];c[y>>2]=c[y>>2]^c[f+4>>2];c[z>>2]=c[z>>2]^c[f+8>>2];c[A>>2]=c[A>>2]^c[f+12>>2]}else{a[w>>0]=a[w>>0]^a[f>>0];a[Ta>>0]=a[Ta>>0]^a[f+1>>0];a[Ua>>0]=a[Ua>>0]^a[f+2>>0];a[Va>>0]=a[Va>>0]^a[f+3>>0];a[h>>0]=a[h>>0]^a[f+4>>0];a[i>>0]=a[i>>0]^a[f+5>>0];a[j>>0]=a[j>>0]^a[f+6>>0];a[k>>0]=a[k>>0]^a[f+7>>0];a[n>>0]=a[n>>0]^a[f+8>>0];a[o>>0]=a[o>>0]^a[f+9>>0];a[p>>0]=a[p>>0]^a[f+10>>0];a[q>>0]=a[q>>0]^a[f+11>>0];a[r>>0]=a[r>>0]^a[f+12>>0];a[s>>0]=a[s>>0]^a[f+13>>0];a[t>>0]=a[t>>0]^a[f+14>>0];a[u>>0]=a[u>>0]^a[f+15>>0]}if(!((d|x)&3)){c[Xa>>2]=c[d>>2]^c[w>>2];c[B>>2]=c[d+4>>2]^c[y>>2];c[C>>2]=c[d+8>>2]^c[z>>2];c[E>>2]=c[d+12>>2]^c[A>>2]}else{a[Xa>>0]=a[d>>0]^a[w>>0];a[pa>>0]=a[d+1>>0]^a[oa>>0];a[ra>>0]=a[d+2>>0]^a[qa>>0];a[ta>>0]=a[d+3>>0]^a[sa>>0];a[va>>0]=a[d+4>>0]^a[ua>>0];a[xa>>0]=a[d+5>>0]^a[wa>>0];a[za>>0]=a[d+6>>0]^a[ya>>0];a[Ba>>0]=a[d+7>>0]^a[Aa>>0];a[Da>>0]=a[d+8>>0]^a[Ca>>0];a[Fa>>0]=a[d+9>>0]^a[Ea>>0];a[Ha>>0]=a[d+10>>0]^a[Ga>>0];a[Ja>>0]=a[d+11>>0]^a[Ia>>0];a[Ma>>0]=a[d+12>>0]^a[Ka>>0];a[Oa>>0]=a[d+13>>0]^a[Na>>0];a[Qa>>0]=a[d+14>>0]^a[Pa>>0];a[Sa>>0]=a[d+15>>0]^a[Ra>>0]}f=pb[La&63](Ya,Xa,Xa)|0;if(G){c[F>>2]=c[F>>2]^c[Xa>>2];c[H>>2]=c[H>>2]^c[B>>2];c[I>>2]=c[I>>2]^c[C>>2];c[J>>2]=c[J>>2]^c[E>>2]}else{a[F>>0]=a[F>>0]^a[Xa>>0];a[M>>0]=a[M>>0]^a[L>>0];a[O>>0]=a[O>>0]^a[N>>0];a[Q>>0]=a[Q>>0]^a[P>>0];a[S>>0]=a[S>>0]^a[R>>0];a[U>>0]=a[U>>0]^a[T>>0];a[W>>0]=a[W>>0]^a[V>>0];a[Y>>0]=a[Y>>0]^a[X>>0];a[_>>0]=a[_>>0]^a[Z>>0];a[ba>>0]=a[ba>>0]^a[aa>>0];a[da>>0]=a[da>>0]^a[ca>>0];a[fa>>0]=a[fa>>0]^a[ea>>0];a[ha>>0]=a[ha>>0]^a[ga>>0];a[ja>>0]=a[ja>>0]^a[ia>>0];a[la>>0]=a[la>>0]^a[ka>>0];a[na>>0]=a[na>>0]^a[ma>>0]}g=g+-1|0;if(!g)break;else d=d+16|0}_a=Xa;c[_a>>2]=0;c[_a+4>>2]=0;_a=Xa+8|0;c[_a>>2]=0;c[_a+4>>2]=0;if(!f){l=Za;return}Te(f+16|0);l=Za;return}function oi(a,b){a=a|0;b=b|0;c[a+160>>2]=1732584193;c[a+164>>2]=-271733879;c[a+168>>2]=-1732584194;c[a+172>>2]=271733878;c[a+176>>2]=-1009589776;b=a+128|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[a+148>>2]=64;c[a+152>>2]=31;return}function pi(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;Jm(b,0,0);h=b+128|0;f=c[h>>2]|0;i=f<<6;h=gr(f|0,c[h+4>>2]|0,26)|0;e=b+144|0;j=c[e>>2]|0;g=i+j|0;f=(g>>>0>>0&1)+(h&536870848|f>>>26)|0;h=g<<3;i=f<<3|g>>>29;c[e>>2]=j+1;a[b+j>>0]=-128;d=c[e>>2]|0;if((j|0)<56){if((d|0)<56)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<56)}else{if((d|0)<64)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<64);Jm(b,0,0);d=b;e=d+56|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0))}a[b+59>>0]=g>>>21;a[b+58>>0]=g>>>13;a[b+57>>0]=g>>>5;a[b+56>>0]=h;a[b+63>>0]=f>>>21;a[b+62>>0]=f>>>13;a[b+61>>0]=f>>>5;a[b+60>>0]=i;ri(b,b,1)|0;Te(124);j=c[b+160>>2]|0;a[b+3>>0]=j>>>24;a[b+2>>0]=j>>>16;a[b+1>>0]=j>>>8;a[b>>0]=j;j=c[b+164>>2]|0;a[b+7>>0]=j>>>24;a[b+6>>0]=j>>>16;a[b+5>>0]=j>>>8;a[b+4>>0]=j;j=c[b+168>>2]|0;a[b+11>>0]=j>>>24;a[b+10>>0]=j>>>16;a[b+9>>0]=j>>>8;a[b+8>>0]=j;j=c[b+172>>2]|0;a[b+15>>0]=j>>>24;a[b+14>>0]=j>>>16;a[b+13>>0]=j>>>8;a[b+12>>0]=j;j=c[b+176>>2]|0;a[b+19>>0]=j>>>24;a[b+18>>0]=j>>>16;a[b+17>>0]=j>>>8;a[b+16>>0]=j;return}function qi(a){a=a|0;return a|0}function ri(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0;C=l;l=l+64|0;if((l|0)>=(m|0))$(64);x=C;y=a+160|0;z=a+164|0;A=a+168|0;B=a+172|0;v=a+176|0;w=x+20|0;f=x+4|0;g=x+56|0;h=x+8|0;i=x+28|0;j=x+12|0;k=x+16|0;n=x+36|0;o=x+24|0;p=x+44|0;q=x+32|0;r=x+52|0;s=x+40|0;t=x+60|0;u=x+48|0;while(1){a=0;do{D=b+(a<<2)|0;c[x+(a<<2)>>2]=(d[D+2>>0]|0)<<16|(d[D+3>>0]|0)<<24|(d[D+1>>0]|0)<<8|(d[D>>0]|0);a=a+1|0}while((a|0)!=16);V=c[y>>2]|0;a=c[z>>2]|0;M=c[A>>2]|0;ca=c[B>>2]|0;Z=c[v>>2]|0;N=c[x>>2]|0;H=(M^a^ca)+V+N|0;H=(H<<11|H>>>21)+Z|0;X=M<<10|M>>>22;O=c[w>>2]|0;V=V+1352829926+((M|~ca)^a)+O|0;V=(V<<8|V>>>24)+Z|0;Y=c[f>>2]|0;K=Y+Z+(X^a^H)|0;K=(K<<14|K>>>18)+ca|0;aa=a<<10|a>>>22;J=c[g>>2]|0;Z=Z+1352829926+J+(V^(a|~X))|0;Z=(Z<<9|Z>>>23)+ca|0;Q=c[h>>2]|0;da=Q+ca+(H^aa^K)|0;da=(da<<15|da>>>17)+X|0;H=H<<10|H>>>22;U=c[i>>2]|0;ca=ca+1352829926+U+(Z^(V|~aa))|0;ca=(ca<<9|ca>>>23)+X|0;V=V<<10|V>>>22;E=c[j>>2]|0;D=E+X+(K^H^da)|0;D=(D<<12|D>>>20)+aa|0;K=K<<10|K>>>22;X=X+1352829926+N+(ca^(Z|~V))|0;X=(X<<11|X>>>21)+aa|0;Z=Z<<10|Z>>>22;S=c[k>>2]|0;F=S+aa+(da^K^D)|0;F=(F<<5|F>>>27)+H|0;da=da<<10|da>>>22;G=c[n>>2]|0;aa=aa+1352829926+G+(X^(ca|~Z))|0;aa=(aa<<13|aa>>>19)+V|0;ca=ca<<10|ca>>>22;H=H+O+(D^da^F)|0;H=(H<<8|H>>>24)+K|0;D=D<<10|D>>>22;V=Q+1352829926+V+(aa^(X|~ca))|0;V=(V<<15|V>>>17)+Z|0;X=X<<10|X>>>22;T=c[o>>2]|0;K=K+T+(F^D^H)|0;K=(K<<7|K>>>25)+da|0;F=F<<10|F>>>22;I=c[p>>2]|0;Z=I+1352829926+Z+(V^(aa|~X))|0;Z=(Z<<15|Z>>>17)+ca|0;aa=aa<<10|aa>>>22;da=da+U+(H^F^K)|0;da=(da<<9|da>>>23)+D|0;H=H<<10|H>>>22;ca=S+1352829926+ca+(Z^(V|~aa))|0;ca=(ca<<5|ca>>>27)+X|0;V=V<<10|V>>>22;W=c[q>>2]|0;D=D+W+(K^H^da)|0;D=(D<<11|D>>>21)+F|0;K=K<<10|K>>>22;P=c[r>>2]|0;X=P+1352829926+X+(ca^(Z|~V))|0;X=(X<<7|X>>>25)+aa|0;Z=Z<<10|Z>>>22;F=F+G+(da^K^D)|0;F=(F<<13|F>>>19)+H|0;da=da<<10|da>>>22;aa=T+1352829926+aa+(X^(ca|~Z))|0;aa=(aa<<7|aa>>>25)+V|0;ca=ca<<10|ca>>>22;_=c[s>>2]|0;H=H+_+(D^da^F)|0;H=(H<<14|H>>>18)+K|0;D=D<<10|D>>>22;R=c[t>>2]|0;V=R+1352829926+V+(aa^(X|~ca))|0;V=(V<<8|V>>>24)+Z|0;X=X<<10|X>>>22;K=K+I+(F^D^H)|0;K=(K<<15|K>>>17)+da|0;F=F<<10|F>>>22;Z=W+1352829926+Z+(V^(aa|~X))|0;Z=(Z<<11|Z>>>21)+ca|0;aa=aa<<10|aa>>>22;ba=c[u>>2]|0;da=da+ba+(H^F^K)|0;da=(da<<6|da>>>26)+D|0;H=H<<10|H>>>22;ca=Y+1352829926+ca+(Z^(V|~aa))|0;ca=(ca<<14|ca>>>18)+X|0;V=V<<10|V>>>22;D=D+P+(K^H^da)|0;D=(D<<7|D>>>25)+F|0;K=K<<10|K>>>22;X=_+1352829926+X+(ca^(Z|~V))|0;X=(X<<14|X>>>18)+aa|0;Z=Z<<10|Z>>>22;F=F+J+(da^K^D)|0;F=(F<<9|F>>>23)+H|0;da=da<<10|da>>>22;aa=E+1352829926+aa+(X^(ca|~Z))|0;aa=(aa<<12|aa>>>20)+V|0;ca=ca<<10|ca>>>22;H=H+R+(D^da^F)|0;H=(H<<8|H>>>24)+K|0;D=D<<10|D>>>22;V=ba+1352829926+V+(aa^(X|~ca))|0;V=(V<<6|V>>>26)+Z|0;X=X<<10|X>>>22;K=U+1518500249+K+(H&F|D&~H)|0;K=(K<<7|K>>>25)+da|0;F=F<<10|F>>>22;Z=T+1548603684+Z+(V&X|aa&~X)|0;Z=(Z<<9|Z>>>23)+ca|0;aa=aa<<10|aa>>>22;da=S+1518500249+da+(K&H|F&~K)|0;da=(da<<6|da>>>26)+D|0;H=H<<10|H>>>22;ca=I+1548603684+ca+(Z&aa|V&~aa)|0;ca=(ca<<13|ca>>>19)+X|0;V=V<<10|V>>>22;D=P+1518500249+D+(da&K|H&~da)|0;D=(D<<8|D>>>24)+F|0;K=K<<10|K>>>22;X=E+1548603684+X+(ca&V|Z&~V)|0;X=(X<<15|X>>>17)+aa|0;Z=Z<<10|Z>>>22;F=Y+1518500249+F+(D&da|K&~D)|0;F=(F<<13|F>>>19)+H|0;da=da<<10|da>>>22;aa=U+1548603684+aa+(X&Z|ca&~Z)|0;aa=(aa<<7|aa>>>25)+V|0;ca=ca<<10|ca>>>22;H=_+1518500249+H+(F&D|da&~F)|0;H=(H<<11|H>>>21)+K|0;D=D<<10|D>>>22;V=N+1548603684+V+(aa&ca|X&~ca)|0;V=(V<<12|V>>>20)+Z|0;X=X<<10|X>>>22;K=T+1518500249+K+(H&F|D&~H)|0;K=(K<<9|K>>>23)+da|0;F=F<<10|F>>>22;Z=P+1548603684+Z+(V&X|aa&~X)|0;Z=(Z<<8|Z>>>24)+ca|0;aa=aa<<10|aa>>>22;da=R+1518500249+da+(K&H|F&~K)|0;da=(da<<7|da>>>25)+D|0;H=H<<10|H>>>22;ca=O+1548603684+ca+(Z&aa|V&~aa)|0;ca=(ca<<9|ca>>>23)+X|0;V=V<<10|V>>>22;D=E+1518500249+D+(da&K|H&~da)|0;D=(D<<15|D>>>17)+F|0;K=K<<10|K>>>22;X=_+1548603684+X+(ca&V|Z&~V)|0;X=(X<<11|X>>>21)+aa|0;Z=Z<<10|Z>>>22;F=ba+1518500249+F+(D&da|K&~D)|0;F=(F<<7|F>>>25)+H|0;da=da<<10|da>>>22;aa=J+1548603684+aa+(X&Z|ca&~Z)|0;aa=(aa<<7|aa>>>25)+V|0;ca=ca<<10|ca>>>22;H=N+1518500249+H+(F&D|da&~F)|0;H=(H<<12|H>>>20)+K|0;D=D<<10|D>>>22;V=R+1548603684+V+(aa&ca|X&~ca)|0;V=(V<<7|V>>>25)+Z|0;X=X<<10|X>>>22;K=G+1518500249+K+(H&F|D&~H)|0;K=(K<<15|K>>>17)+da|0;F=F<<10|F>>>22;Z=W+1548603684+Z+(V&X|aa&~X)|0;Z=(Z<<12|Z>>>20)+ca|0;aa=aa<<10|aa>>>22;da=O+1518500249+da+(K&H|F&~K)|0;da=(da<<9|da>>>23)+D|0;H=H<<10|H>>>22;ca=ba+1548603684+ca+(Z&aa|V&~aa)|0;ca=(ca<<7|ca>>>25)+X|0;V=V<<10|V>>>22;D=Q+1518500249+D+(da&K|H&~da)|0;D=(D<<11|D>>>21)+F|0;K=K<<10|K>>>22;X=S+1548603684+X+(ca&V|Z&~V)|0;X=(X<<6|X>>>26)+aa|0;Z=Z<<10|Z>>>22;F=J+1518500249+F+(D&da|K&~D)|0;F=(F<<7|F>>>25)+H|0;da=da<<10|da>>>22;aa=G+1548603684+aa+(X&Z|ca&~Z)|0;aa=(aa<<15|aa>>>17)+V|0;ca=ca<<10|ca>>>22;H=I+1518500249+H+(F&D|da&~F)|0;H=(H<<13|H>>>19)+K|0;D=D<<10|D>>>22;V=Y+1548603684+V+(aa&ca|X&~ca)|0;V=(V<<13|V>>>19)+Z|0;X=X<<10|X>>>22;L=~H;K=W+1518500249+K+(H&F|D&L)|0;K=(K<<12|K>>>20)+da|0;F=F<<10|F>>>22;Z=Q+1548603684+Z+(V&X|aa&~X)|0;Z=(Z<<11|Z>>>21)+ca|0;aa=aa<<10|aa>>>22;L=E+1859775393+da+((K|L)^F)|0;L=(L<<11|L>>>21)+D|0;H=H<<10|H>>>22;ca=R+1836072691+ca+((Z|~V)^aa)|0;ca=(ca<<9|ca>>>23)+X|0;V=V<<10|V>>>22;D=_+1859775393+D+((L|~K)^H)|0;D=(D<<13|D>>>19)+F|0;K=K<<10|K>>>22;X=O+1836072691+X+((ca|~Z)^V)|0;X=(X<<7|X>>>25)+aa|0;Z=Z<<10|Z>>>22;F=J+1859775393+F+((D|~L)^K)|0;F=(F<<6|F>>>26)+H|0;L=L<<10|L>>>22;aa=Y+1836072691+aa+((X|~ca)^Z)|0;aa=(aa<<15|aa>>>17)+V|0;ca=ca<<10|ca>>>22;H=S+1859775393+H+((F|~D)^L)|0;H=(H<<7|H>>>25)+K|0;D=D<<10|D>>>22;V=E+1836072691+V+((aa|~X)^ca)|0;V=(V<<11|V>>>21)+Z|0;X=X<<10|X>>>22;K=G+1859775393+K+((H|~F)^D)|0;K=(K<<14|K>>>18)+L|0;F=F<<10|F>>>22;Z=U+1836072691+Z+((V|~aa)^X)|0;Z=(Z<<8|Z>>>24)+ca|0;aa=aa<<10|aa>>>22;L=R+1859775393+L+((K|~H)^F)|0;L=(L<<9|L>>>23)+D|0;H=H<<10|H>>>22;ca=J+1836072691+ca+((Z|~V)^aa)|0;ca=(ca<<6|ca>>>26)+X|0;V=V<<10|V>>>22;D=W+1859775393+D+((L|~K)^H)|0;D=(D<<13|D>>>19)+F|0;K=K<<10|K>>>22;X=T+1836072691+X+((ca|~Z)^V)|0;X=(X<<6|X>>>26)+aa|0;Z=Z<<10|Z>>>22;F=Y+1859775393+F+((D|~L)^K)|0;F=(F<<15|F>>>17)+H|0;L=L<<10|L>>>22;aa=G+1836072691+aa+((X|~ca)^Z)|0;aa=(aa<<14|aa>>>18)+V|0;ca=ca<<10|ca>>>22;H=Q+1859775393+H+((F|~D)^L)|0;H=(H<<14|H>>>18)+K|0;D=D<<10|D>>>22;V=I+1836072691+V+((aa|~X)^ca)|0;V=(V<<12|V>>>20)+Z|0;X=X<<10|X>>>22;K=U+1859775393+K+((H|~F)^D)|0;K=(K<<8|K>>>24)+L|0;F=F<<10|F>>>22;Z=W+1836072691+Z+((V|~aa)^X)|0;Z=(Z<<13|Z>>>19)+ca|0;aa=aa<<10|aa>>>22;L=N+1859775393+L+((K|~H)^F)|0;L=(L<<13|L>>>19)+D|0;H=H<<10|H>>>22;ca=ba+1836072691+ca+((Z|~V)^aa)|0;ca=(ca<<5|ca>>>27)+X|0;V=V<<10|V>>>22;D=T+1859775393+D+((L|~K)^H)|0;D=(D<<6|D>>>26)+F|0;K=K<<10|K>>>22;X=Q+1836072691+X+((ca|~Z)^V)|0;X=(X<<14|X>>>18)+aa|0;Z=Z<<10|Z>>>22;F=P+1859775393+F+((D|~L)^K)|0;F=(F<<5|F>>>27)+H|0;L=L<<10|L>>>22;aa=_+1836072691+aa+((X|~ca)^Z)|0;aa=(aa<<13|aa>>>19)+V|0;ca=ca<<10|ca>>>22;H=I+1859775393+H+((F|~D)^L)|0;H=(H<<12|H>>>20)+K|0;D=D<<10|D>>>22;V=N+1836072691+V+((aa|~X)^ca)|0;V=(V<<13|V>>>19)+Z|0;X=X<<10|X>>>22;K=O+1859775393+K+((H|~F)^D)|0;K=(K<<7|K>>>25)+L|0;F=F<<10|F>>>22;Z=S+1836072691+Z+((V|~aa)^X)|0;Z=(Z<<7|Z>>>25)+ca|0;aa=aa<<10|aa>>>22;L=ba+1859775393+L+((K|~H)^F)|0;L=(L<<5|L>>>27)+D|0;H=H<<10|H>>>22;ca=P+1836072691+ca+((Z|~V)^aa)|0;ca=(ca<<5|ca>>>27)+X|0;V=V<<10|V>>>22;D=Y+-1894007588+D+(L&H|K&~H)|0;D=(D<<11|D>>>21)+F|0;K=K<<10|K>>>22;X=W+2053994217+X+(ca&Z|V&~ca)|0;X=(X<<15|X>>>17)+aa|0;Z=Z<<10|Z>>>22;F=G+-1894007588+F+(D&K|L&~K)|0;F=(F<<12|F>>>20)+H|0;L=L<<10|L>>>22;aa=T+2053994217+aa+(X&ca|Z&~X)|0;aa=(aa<<5|aa>>>27)+V|0;ca=ca<<10|ca>>>22;H=I+-1894007588+H+(F&L|D&~L)|0;H=(H<<14|H>>>18)+K|0;D=D<<10|D>>>22;V=S+2053994217+V+(aa&X|ca&~aa)|0;V=(V<<8|V>>>24)+Z|0;X=X<<10|X>>>22;K=_+-1894007588+K+(H&D|F&~D)|0;K=(K<<15|K>>>17)+L|0;F=F<<10|F>>>22;Z=Y+2053994217+Z+(V&aa|X&~V)|0;Z=(Z<<11|Z>>>21)+ca|0;aa=aa<<10|aa>>>22;L=N+-1894007588+L+(K&F|H&~F)|0;L=(L<<14|L>>>18)+D|0;H=H<<10|H>>>22;ca=E+2053994217+ca+(Z&V|aa&~Z)|0;ca=(ca<<14|ca>>>18)+X|0;V=V<<10|V>>>22;D=W+-1894007588+D+(L&H|K&~H)|0;D=(D<<15|D>>>17)+F|0;K=K<<10|K>>>22;X=I+2053994217+X+(ca&Z|V&~ca)|0;X=(X<<14|X>>>18)+aa|0;Z=Z<<10|Z>>>22;F=ba+-1894007588+F+(D&K|L&~K)|0;F=(F<<9|F>>>23)+H|0;L=L<<10|L>>>22;aa=R+2053994217+aa+(X&ca|Z&~X)|0;aa=(aa<<6|aa>>>26)+V|0;ca=ca<<10|ca>>>22;H=S+-1894007588+H+(F&L|D&~L)|0;H=(H<<8|H>>>24)+K|0;D=D<<10|D>>>22;V=N+2053994217+V+(aa&X|ca&~aa)|0;V=(V<<14|V>>>18)+Z|0;X=X<<10|X>>>22;K=P+-1894007588+K+(H&D|F&~D)|0;K=(K<<9|K>>>23)+L|0;F=F<<10|F>>>22;Z=O+2053994217+Z+(V&aa|X&~V)|0;Z=(Z<<6|Z>>>26)+ca|0;aa=aa<<10|aa>>>22;L=E+-1894007588+L+(K&F|H&~F)|0;L=(L<<14|L>>>18)+D|0;H=H<<10|H>>>22;ca=ba+2053994217+ca+(Z&V|aa&~Z)|0;ca=(ca<<9|ca>>>23)+X|0;V=V<<10|V>>>22;D=U+-1894007588+D+(L&H|K&~H)|0;D=(D<<5|D>>>27)+F|0;K=K<<10|K>>>22;X=Q+2053994217+X+(ca&Z|V&~ca)|0;X=(X<<12|X>>>20)+aa|0;Z=Z<<10|Z>>>22;F=R+-1894007588+F+(D&K|L&~K)|0;F=(F<<6|F>>>26)+H|0;L=L<<10|L>>>22;aa=P+2053994217+aa+(X&ca|Z&~X)|0;aa=(aa<<9|aa>>>23)+V|0;ca=ca<<10|ca>>>22;H=J+-1894007588+H+(F&L|D&~L)|0;H=(H<<8|H>>>24)+K|0;D=D<<10|D>>>22;V=G+2053994217+V+(aa&X|ca&~aa)|0;V=(V<<12|V>>>20)+Z|0;X=X<<10|X>>>22;K=O+-1894007588+K+(H&D|F&~D)|0;K=(K<<6|K>>>26)+L|0;F=F<<10|F>>>22;Z=U+2053994217+Z+(V&aa|X&~V)|0;Z=(Z<<5|Z>>>27)+ca|0;aa=aa<<10|aa>>>22;L=T+-1894007588+L+(K&F|H&~F)|0;L=(L<<5|L>>>27)+D|0;H=H<<10|H>>>22;ca=_+2053994217+ca+(Z&V|aa&~Z)|0;ca=(ca<<15|ca>>>17)+X|0;V=V<<10|V>>>22;D=Q+-1894007588+D+(L&H|K&~H)|0;D=(D<<12|D>>>20)+F|0;K=K<<10|K>>>22;X=J+2053994217+X+(ca&Z|V&~ca)|0;X=(X<<8|X>>>24)+aa|0;Z=Z<<10|Z>>>22;F=S+-1454113458+F+(D^(L|~K))|0;F=(F<<9|F>>>23)+H|0;L=L<<10|L>>>22;aa=aa+ba+(ca^Z^X)|0;aa=(aa<<8|aa>>>24)+V|0;ca=ca<<10|ca>>>22;H=N+-1454113458+H+(F^(D|~L))|0;H=(H<<15|H>>>17)+K|0;D=D<<10|D>>>22;V=V+R+(X^ca^aa)|0;V=(V<<5|V>>>27)+Z|0;X=X<<10|X>>>22;K=O+-1454113458+K+(H^(F|~D))|0;K=(K<<5|K>>>27)+L|0;F=F<<10|F>>>22;Z=Z+_+(aa^X^V)|0;Z=(Z<<12|Z>>>20)+ca|0;aa=aa<<10|aa>>>22;L=G+-1454113458+L+(K^(H|~F))|0;L=(L<<11|L>>>21)+D|0;H=H<<10|H>>>22;S=ca+S+(V^aa^Z)|0;S=(S<<9|S>>>23)+X|0;V=V<<10|V>>>22;D=U+-1454113458+D+(L^(K|~H))|0;D=(D<<6|D>>>26)+F|0;K=K<<10|K>>>22;X=X+Y+(Z^V^S)|0;X=(X<<12|X>>>20)+aa|0;Z=Z<<10|Z>>>22;F=ba+-1454113458+F+(D^(L|~K))|0;F=(F<<8|F>>>24)+H|0;L=L<<10|L>>>22;O=aa+O+(S^Z^X)|0;O=(O<<5|O>>>27)+V|0;S=S<<10|S>>>22;H=Q+-1454113458+H+(F^(D|~L))|0;H=(H<<13|H>>>19)+K|0;D=D<<10|D>>>22;V=V+W+(X^S^O)|0;V=(V<<14|V>>>18)+Z|0;X=X<<10|X>>>22;K=_+-1454113458+K+(H^(F|~D))|0;K=(K<<12|K>>>20)+L|0;F=F<<10|F>>>22;U=Z+U+(O^X^V)|0;U=(U<<6|U>>>26)+S|0;O=O<<10|O>>>22;L=J+-1454113458+L+(K^(H|~F))|0;L=(L<<5|L>>>27)+D|0;H=H<<10|H>>>22;S=S+T+(V^O^U)|0;S=(S<<8|S>>>24)+X|0;V=V<<10|V>>>22;D=Y+-1454113458+D+(L^(K|~H))|0;D=(D<<12|D>>>20)+F|0;K=K<<10|K>>>22;Q=X+Q+(U^V^S)|0;Q=(Q<<13|Q>>>19)+O|0;U=U<<10|U>>>22;F=E+-1454113458+F+(D^(L|~K))|0;F=(F<<13|F>>>19)+H|0;L=L<<10|L>>>22;O=O+P+(S^U^Q)|0;O=(O<<6|O>>>26)+V|0;S=S<<10|S>>>22;H=W+-1454113458+H+(F^(D|~L))|0;H=(H<<14|H>>>18)+K|0;D=D<<10|D>>>22;J=V+J+(Q^S^O)|0;J=(J<<5|J>>>27)+U|0;Q=Q<<10|Q>>>22;K=I+-1454113458+K+(H^(F|~D))|0;K=(K<<11|K>>>21)+L|0;F=F<<10|F>>>22;N=U+N+(O^Q^J)|0;N=(N<<15|N>>>17)+S|0;O=O<<10|O>>>22;L=T+-1454113458+L+(K^(H|~F))|0;L=(L<<8|L>>>24)+D|0;H=H<<10|H>>>22;E=S+E+(J^O^N)|0;E=(E<<13|E>>>19)+Q|0;J=J<<10|J>>>22;D=R+-1454113458+D+(L^(K|~H))|0;D=(D<<5|D>>>27)+F|0;K=K<<10|K>>>22;G=Q+G+(N^J^E)|0;G=(G<<11|G>>>21)+O|0;N=N<<10|N>>>22;F=P+-1454113458+F+(D^(L|~K))|0;I=O+I+(E^N^G)|0;c[z>>2]=N+M+(L<<10|L>>>22);c[A>>2]=J+(c[B>>2]|0)+K;c[B>>2]=H+(c[v>>2]|0)+J+(I<<11|I>>>21);c[v>>2]=H+(c[y>>2]|0)+G+(F<<6|F>>>26);c[y>>2]=(E<<10|E>>>22)+a+D;e=e+-1|0;if(!e)break;else b=b+64|0}l=C;return 124}function si(a){a=a|0;var b=0;c[a+160>>2]=1732584193;c[a+164>>2]=-271733879;c[a+168>>2]=-1732584194;c[a+172>>2]=271733878;c[a+176>>2]=-1009589776;b=a+128|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[a+148>>2]=64;c[a+152>>2]=31;return}function ti(a,b){a=a|0;b=b|0;ri(a,b,1)|0;c[b>>2]=c[a+160>>2];c[b+4>>2]=c[a+164>>2];c[b+8>>2]=c[a+168>>2];c[b+12>>2]=c[a+172>>2];c[b+16>>2]=c[a+176>>2];return}function ui(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=l;l=l+192|0;if((l|0)>=(m|0))$(192);g=f;c[g+160>>2]=1732584193;c[g+164>>2]=-271733879;c[g+168>>2]=-1732584194;c[g+172>>2]=271733878;c[g+176>>2]=-1009589776;h=g+128|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;c[g+148>>2]=64;c[g+152>>2]=31;Jm(g,d,e);pi(g);d=g;e=b+20|0;do{a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}while((b|0)<(e|0));l=f;return}function vi(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+16|0;if((l|0)>=(m|0))$(16);r=s;p=(d+7|0)>>>3;c[r>>2]=p;if(!((p|0)!=0&(f+7|0)>>>0<=p>>>0)){b=66;l=s;return b|0}q=$e(p)|0;if(!q){b=Sn()|0;l=s;return b|0}a[q>>0]=0;a[q+1>>0]=2;d=-3-f+p|0;if((d|0)<=0)Ie(38682,38688,95,38701);if(!g){o=Cj(d,1)|0;while(1){g=0;h=0;do{g=((a[o+h>>0]|0)==0&1)+g|0;h=h+1|0}while((h|0)!=(d|0));if(!g)break;g=g+3+((g|0)/128|0)|0;n=Cj(g,1)|0;if(g|0){k=0;do{i=o+k|0;h=a[i>>0]|0;j=g+-1|0;if(!(h<<24>>24)){h=a[n+j>>0]|0;a[i>>0]=h;g=j}k=(h<<24>>24!=0&1)+k|0}while((k|0)<(d|0)&(g|0)!=0)}cf(n)}cr(q+2|0,o|0,d|0)|0;cf(o)}else{if((d|0)!=(h|0)){cf(q);b=45;l=s;return b|0}a:do if(h|0){d=0;while(1){if(!(a[g+d>>0]|0))break;d=d+1|0;if(d>>>0>=h>>>0)break a}cf(q);b=45;l=s;return b|0}while(0);cr(q+2|0,g|0,h|0)|0;d=h}o=d+3|0;a[q+(d+2)>>0]=0;cr(q+o|0,e|0,f|0)|0;if((o+f|0)!=(p|0))Ie(38732,38688,153,38701);d=Sk(b,5,q,p,r)|0;if((d|0)==0?nf(1)|0:0)Se(38744,c[b>>2]|0);cf(q);b=d;l=s;return b|0}function wi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;i=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=i;e=(e+7|0)>>>3;c[b>>2]=0;g=$e(e)|0;if(!g){h=Sn()|0;l=i;return h|0}e=Tk(5,g,e,h,f)|0;if(e|0){cf(g);h=e&65535;l=i;return h|0}f=c[h>>2]|0;if(f>>>0<4){cf(g);h=155;l=i;return h|0}j=(a[g>>0]|0)==0;e=j?2:1;c[h>>2]=e;if((a[g+(j&1)>>0]|0)!=2){cf(g);j=155;l=i;return j|0}a:do if(e>>>0>>0)do{if(!(a[g+e>>0]|0))break a;e=e+1|0;c[h>>2]=e}while(e>>>0>>0);while(0);e=e+1|0;if(f>>>0<=e>>>0){cf(g);j=155;l=i;return j|0}c[h>>2]=e;j=f-e|0;dr(g|0,g+e|0,j|0)|0;c[b>>2]=g;c[d>>2]=j;if(!(nf(1)|0)){j=0;l=i;return j|0}Qe(38777,c[b>>2]|0,c[d>>2]|0);j=0;l=i;return j|0}function xi(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0;p=l;l=l+112|0;if((l|0)>=(m|0))$(112);n=p+8|0;o=p+4|0;h=p;k=(d+7|0)>>>3;c[o>>2]=k;c[h>>2]=100;d=sh(g)|0;if(th(g,10,n,h)|0){b=69;l=p;return b|0}if((d|0)!=(f|0)){b=70;l=p;return b|0}if(!f){b=66;l=p;return b|0}if((f+4+(c[h>>2]|0)|0)>>>0>k>>>0){b=66;l=p;return b|0}j=_e(k)|0;if(!j){b=Sn()|0;l=p;return b|0}a[j>>0]=0;a[j+1>>0]=1;i=k-f|0;d=c[h>>2]|0;g=i-d|0;h=g+-3|0;if((h|0)<=1)Ie(38831,38688,303,38837);Yq(j+2|0,-1,h|0)|0;a[j+(g+-1)>>0]=0;cr(j+g|0,n|0,d|0)|0;cr(j+i|0,e|0,f|0)|0;d=Sk(b,5,j,k,o)|0;if((d|0)==0?nf(1)|0:0)Se(38868,c[b>>2]|0);cf(j);b=d;l=p;return b|0}function yi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;k=l;l=l+16|0;if((l|0)>=(m|0))$(16);i=k;h=(d+7|0)>>>3;c[i>>2]=h;if((f|0)==0|(f+4|0)>>>0>h>>>0){j=66;l=k;return j|0}j=_e(h)|0;if(!j){j=Sn()|0;l=k;return j|0}a[j>>0]=0;a[j+1>>0]=1;d=h-f|0;g=d+-3|0;if((g|0)<=1)Ie(38831,38688,368,38901);Yq(j+2|0,-1,g|0)|0;a[j+(d+-1)>>0]=0;cr(j+d|0,e|0,f|0)|0;d=Sk(b,5,j,h,i)|0;if(!d)if(!(nf(1)|0))d=0;else{Se(38868,c[b>>2]|0);d=0}else d=d&65535;cf(j);j=d;l=k;return j|0}function zi(b,d,e,f,g,h,i,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0;o=(d+7|0)>>>3;c[b>>2]=0;d=(h|0)!=0&(i|0)!=0;m=sh(e)|0;if(!(o|0?(o+-2-(m<<1)|0)>>>0>=g>>>0:0)){b=66;return b|0}p=ef(1,o)|0;if(!p){b=Sn()|0;return b|0}l=p+1|0;n=l+m|0;oh(e,n,d?h:71847,d?i:0);i=p+(o+-1-g)|0;a[i>>0]=1;cr(i+1|0,f|0,g|0)|0;do if(!j)Dj(l,m,1);else{if((m|0)==(k|0)){cr(l|0,j|0,k|0)|0;break}cf(p);b=45;return b|0}while(0);h=o-m+-1|0;g=$e(h)|0;if(!g){b=Sn()|0;cf(p);return b|0}d=Ai(g,h,l,m,e)|0;if(d|0){cf(g);cf(p);b=d;return b|0}i=m+1|0;if(i>>>0>>0){d=i;f=g;while(1){l=p+d|0;a[l>>0]=a[l>>0]^a[f>>0];d=d+1|0;if((d|0)==(o|0))break;else f=f+1|0}}cf(g);g=$e(m)|0;if(!g){b=Sn()|0;cf(p);return b|0}d=Ai(g,m,n,h,e)|0;if(d|0){cf(g);cf(p);b=d;return b|0}if(i>>>0>1){d=1;f=g;while(1){e=p+d|0;a[e>>0]=a[e>>0]^a[f>>0];d=d+1|0;if((d|0)==(i|0))break;else f=f+1|0}}cf(g);d=Sk(b,5,p,o,0)|0;if((d|0)==0?nf(1)|0:0)Se(38936,c[b>>2]|0);cf(p);b=d;return b|0}function Ai(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;q=l;l=l+16|0;if((l|0)>=(m|0))$(16);o=q;p=q+4|0;h=eh(o,g,0)|0;if(h|0){p=h;l=q;return p|0}n=sh(g)|0;if(d|0){i=p+1|0;j=p+2|0;k=p+3|0;g=0;h=0;while(1){if(h|0)ih(c[o>>2]|0);a[p>>0]=h>>>24;a[i>>0]=h>>>16;a[j>>0]=h>>>8;a[k>>0]=h;lh(c[o>>2]|0,e,f);lh(c[o>>2]|0,p,4);s=ph(c[o>>2]|0,0)|0;r=d-g|0;r=r>>>0>>0?r:n;cr(b+g|0,s|0,r|0)|0;g=r+g|0;if(g>>>0>=d>>>0)break;else h=h+1|0}}kh(c[o>>2]|0);s=0;l=q;return s|0}function Bi(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;r=l;l=l+16|0;if((l|0)>=(m|0))$(16);q=r;c[q>>2]=0;j=(e+7|0)>>>3;c[b>>2]=0;k=(h|0)!=0&(i|0)!=0;e=sh(f)|0;p=_e(e)|0;if(!p){q=Sn()|0;l=r;return q|0}oh(f,p,k?h:71847,k?i:0);if(Vk(q,0,g,j)|0){cf(p);q=155;l=r;return q|0}if(j>>>0<((e<<1)+2|0)>>>0){cf(c[q>>2]|0);cf(p);q=155;l=r;return q|0}j=j+-1|0;n=$e(j)|0;if(!n){d=Sn()|0;cf(c[q>>2]|0);cf(p);q=d;l=r;return q|0}o=n+e|0;k=(c[q>>2]|0)+1|0;g=k+e|0;i=j-e|0;h=(Ai(n,e,g,i,f)|0)!=0&1;if(e|0){j=0;do{s=n+j|0;a[s>>0]=a[s>>0]^a[k+j>>0];j=j+1|0}while((j|0)!=(e|0))}k=Ai(o,i,n,e,f)|0;if(i|0){j=0;do{s=o+j|0;a[s>>0]=a[s>>0]^a[g+j>>0];j=j+1|0}while((j|0)!=(i|0))}j=Tp(p,o,e)|0;a:do if(e>>>0>>0)do{if((a[o+e>>0]|0)==1)break a;e=e+1|0}while(e>>>0>>0);while(0);s=(a[c[q>>2]>>0]|0)==0;cf(p);cf(c[q>>2]|0);if(!((k|h|j|0)==0&(e|0)!=(i|0)&s)){cf(n);s=155;l=r;return s|0}q=e+1|0;s=i-q|0;dr(n|0,o+q|0,s|0)|0;c[b>>2]=n;c[d>>2]=s;if(!(nf(1)|0)){s=0;l=r;return s|0}Qe(38954,c[b>>2]|0,c[d>>2]|0);s=0;l=r;return s|0}function Ci(b,e,f,g,h,i,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;n=(e+7|0)>>>3;l=sh(f)|0;if(!l)Ie(38993,38688,800,38998);q=i+8+l|0;t=n-l+-1|0;m=q+t|0;v=_e(m)|0;if(!v){v=Sn()|0;return v|0}p=v+8|0;r=p+l|0;o=r+i|0;do if((l|0)==(h|0)){cr(p|0,g|0,h|0)|0;if(n>>>0<(i+2+h|0)>>>0)o=66;else{u=_e(n)|0;if(!u){o=Sn()|0;break}p=u+n+-1+(0-h)|0;do if(i){if(!j){Dj(r,i,1);s=14;break}if((k|0)==(i|0)){cr(r|0,j|0,i|0)|0;s=14;break}else{o=45;l=u;break}}else s=14;while(0);if((s|0)==14){s=v;l=s;a[l>>0]=0;a[l+1>>0]=0;a[l+2>>0]=0;a[l+3>>0]=0;s=s+4|0;a[s>>0]=0;a[s+1>>0]=0;a[s+2>>0]=0;a[s+3>>0]=0;oh(f,p,v,q);s=p+(0-i)+-1|0;l=u;Yq(u|0,0,s-l|0)|0;a[s>>0]=1;cr(s+1|0,r|0,i|0)|0;Ai(o,t,p,h,f)|0;if(t|0){p=0;while(1){s=u+p|0;a[s>>0]=a[s>>0]^a[o>>0];p=p+1|0;if((p|0)==(t|0))break;else o=o+1|0}}a[u>>0]=(d[u>>0]|0)&255>>>((n<<3)-e|0);a[u+(n+-1)>>0]=-68;o=Sk(b,5,u,n,0)|0;if(!o)if(!(nf(1)|0))o=0;else{Se(39019,c[b>>2]|0);o=0}}if((n|0)!=0&(l&7|0)!=0){l=u;do{a[l>>0]=0;l=l+1|0;n=n+-1|0}while((n|0)!=0&(l&7|0)!=0)}else l=u;if(n>>>0>=8){g=n+-8|0;q=g&-8;j=q+8|0;p=l;while(1){b=p;c[b>>2]=0;c[b+4>>2]=0;n=n+-8|0;if(n>>>0<=7)break;else p=p+8|0}n=g-q|0;l=l+j|0}if(n|0)while(1){a[l>>0]=0;n=n+-1|0;if(!n)break;else l=l+1|0}cf(u)}}else o=139;while(0);if((m|0)!=0&(v&7|0)!=0){l=v;do{a[l>>0]=0;l=l+1|0;m=m+-1|0}while((m|0)!=0&(l&7|0)!=0)}else l=v;if(m>>>0>=8){p=m+-8|0;g=p&-8;q=g+8|0;n=l;while(1){u=n;c[u>>2]=0;c[u+4>>2]=0;m=m+-8|0;if(m>>>0<=7)break;else n=n+8|0}m=p-g|0;l=l+q|0}if(m|0)while(1){a[l>>0]=0;m=m+-1|0;if(!m)break;else l=l+1|0}cf(v);v=o;return v|0}function Di(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=l;l=l+16|0;if((l|0)>=(m|0))$(16);v=x;c[v>>2]=0;j=(f+7|0)>>>3;s=sh(g)|0;if(!s)Ie(38993,38688,926,39036);q=h+8+s|0;n=j-s|0;o=n+-1|0;i=(q>>>0>>0?o:q)+s|0;w=_e(i)|0;u=(w|0)!=0;if(u){k=0-s|0;r=w+i+k|0;b=Vk(0,r,b,s)|0;if(!b){b=Vk(v,0,e,j)|0;if(!b)if(j>>>0>=(h+2+s|0)>>>0){b=c[v>>2]|0;if((a[b+(j+-1)>>0]|0)==-68){p=b+j+-1+k|0;k=255>>>((j<<3)-f|0);if(!(d[b>>0]&~k)){Ai(w,o,p,s,g)|0;if(o|0){b=w;e=0;while(1){f=(c[v>>2]|0)+e|0;a[f>>0]=a[f>>0]^a[b>>0];e=e+1|0;if((e|0)==(o|0))break;else b=b+1|0}}f=c[v>>2]|0;a[f>>0]=d[f>>0]&k;k=n-h|0;f=k+-2|0;a:do if(!f)b=0;else{e=c[v>>2]|0;b=0;do{if(a[e+b>>0]|0)break a;b=b+1|0}while(b>>>0>>0)}while(0);if((b|0)==(f|0)){b=c[v>>2]|0;if((a[b+f>>0]|0)==1){t=w;o=t;a[o>>0]=0;a[o+1>>0]=0;a[o+2>>0]=0;a[o+3>>0]=0;t=t+4|0;a[t>>0]=0;a[t+1>>0]=0;a[t+2>>0]=0;a[t+3>>0]=0;t=w+8|0;cr(t|0,r|0,s|0)|0;cr(t+s|0,b+(k+-1)|0,h|0)|0;oh(g,w,w,q);b=(Tp(p,w,s)|0)!=0;b=b?8:0;t=19}else o=8}else{b=8;t=19}}else{b=8;t=19}}else o=8}else{b=66;t=19}else t=19}else t=19}else{b=Sn()|0;t=19}if((t|0)==19){o=b;b=c[v>>2]|0}if(b|0){if((j|0)!=0&(b&7|0)!=0)do{a[b>>0]=0;b=b+1|0;j=j+-1|0}while((j|0)!=0&(b&7|0)!=0);if(j>>>0>=8){k=j+-8|0;f=k&-8;n=f+8|0;e=b;while(1){t=e;c[t>>2]=0;c[t+4>>2]=0;j=j+-8|0;if(j>>>0<=7)break;else e=e+8|0}j=k-f|0;b=b+n|0}if(j|0)while(1){a[b>>0]=0;j=j+-1|0;if(!j)break;else b=b+1|0}cf(c[v>>2]|0)}if(!u){l=x;return o|0}if((i|0)!=0&(w&7|0)!=0){b=w;do{a[b>>0]=0;b=b+1|0;i=i+-1|0}while((i|0)!=0&(b&7|0)!=0)}else b=w;if(i>>>0>=8){e=i+-8|0;k=e&-8;f=k+8|0;j=b;while(1){v=j;c[v>>2]=0;c[v+4>>2]=0;i=i+-8|0;if(i>>>0<=7)break;else j=j+8|0}i=e-k|0;b=b+f|0}if(i|0)while(1){a[b>>0]=0;i=i+-1|0;if(!i)break;else b=b+1|0}cf(w);l=x;return o|0}function Ei(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=l;l=l+176|0;if((l|0)>=(m|0))$(176);C=F+8|0;A=F;s=F+164|0;t=F+160|0;u=F+156|0;v=F+152|0;w=F+148|0;x=F+144|0;n=F+88|0;i=F+84|0;k=F+80|0;D=F+56|0;j=F+48|0;E=F+44|0;c[j>>2]=0;c[E>>2]=0;c[D>>2]=0;c[D+4>>2]=0;c[D+8>>2]=0;c[D+12>>2]=0;c[D+16>>2]=0;c[D+20>>2]=0;e=Fh(a,i)|0;if(e|0){E=e;l=F;return E|0}e=Gh(a,k)|0;if(e|0){E=e;l=F;return E|0}e=uf(a,46885,0)|0;if(e|0?(f=Eh(e,j,0)|0,sf(e),f|0):0){E=f;l=F;return E|0}if((a|0)!=0?(g=uf(a,41502,0)|0,(g|0)!=0):0){z=g;B=11}else B=7;do if((B|0)==7){e=uf(a,41515,0)|0;if(e|0){c[j>>2]=c[j>>2]|64;sf(e)}if((c[j>>2]&64|0)==0?(gg()|0)==0:0){if((c[j>>2]&32|0)==0?(h=uf(a,48632,0)|0,h|0):0){c[j>>2]=c[j>>2]|32;sf(h)}e=c[i>>2]|0;f=c[k>>2]|0;d=(c[j>>2]|0)>>>5&1;if(gg()|0?!(e>>>0>1023&(d|0)==0):0){d=55;break}a=2-d|0;q=(e&1)+e|0;d=(f|0)==1?65537:f;p=ll(1)|0;if(!d){El(p,41)|0;g=Hl(q)|0;f=q>>>1;e=0;d=0;do{if(e|0)Jl(e);if(d|0)Jl(d);e=yh(f,a,0,0)|0;d=yh(f,a,0,0)|0;if((wk(e,d)|0)>0)Fl(e,d);Kk(g,e,d)}while((lk(g)|0)!=(q|0));f=0}else{El(p,d|1)|0;g=Hl(q)|0;f=q>>>1;e=0;d=0;do{if(e|0)Jl(e);if(d|0)Jl(d);e=yh(f,a,6,p)|0;d=yh(f,a,6,p)|0;if((wk(e,d)|0)>0)Fl(e,d);Kk(g,e,d)}while((lk(g)|0)!=(q|0));f=1}h=e+4|0;a=nl(c[h>>2]|0)|0;h=nl(c[h>>2]|0)|0;i=Il(q)|0;j=Il(q)|0;k=Il(q)|0;gk(a,e,1);gk(h,d,1);Kk(i,a,h);Ek(j,a,h)|0;Bk(k,i,j);if(!(Ek(a,p,i)|0))if(f)He(41560,287,41812);else do ek(p,p,2);while(!(Ek(a,p,i)|0));n=Il(q)|0;Fk(n,p,k)|0;o=Il(q)|0;Fk(o,e,d)|0;if(nf(1)|0){Se(41825,e);Se(41831,d);Se(41837,i);Se(41843,j);Se(41849,k);Se(41855,g);Se(41861,p);Se(41867,n);Se(41873,o)}Jl(a);Jl(h);Jl(i);Jl(k);Jl(j);c[D>>2]=g;h=D+4|0;c[h>>2]=p;g=D+12|0;c[g>>2]=e;f=D+16|0;c[f>>2]=d;a=D+8|0;c[a>>2]=n;d=D+20|0;c[d>>2]=o;if(!(Oi(D,q+-64|0)|0)){e=D;B=86}else{Jl(c[D>>2]|0);c[D>>2]=0;Jl(c[h>>2]|0);c[h>>2]=0;Jl(c[g>>2]|0);c[g>>2]=0;Jl(c[f>>2]|0);c[f>>2]=0;Jl(c[a>>2]|0);c[a>>2]=0;Jl(c[d>>2]|0);c[d>>2]=0;kg(41560,334,41812,0,41745);d=50}}else{z=0;B=11}}while(0);if((B|0)==11){y=c[i>>2]|0;k=c[k>>2]|0;k=(k|0)==1?65537:k;if(!(y>>>0<1024|(y&255|0)!=0|k>>>0<3|(k&1|0)==0)){c[s>>2]=0;c[t>>2]=0;c[u>>2]=0;c[v>>2]=0;c[w>>2]=0;c[x>>2]=0;a:do if(!z){e=y>>>1;f=Il(e)|0;Kl(f,e,2);g=e+-1|0;ok(f,g);a=e+-2|0;nk(f,a);if((lk(f)|0)!=(e|0))Ie(41524,41560,360,41566);c[u>>2]=f;h=Il(e)|0;i=e+-100|0;j=0;do{Jl(j);j=Il(e)|0;Kl(j,e,2);ok(j,g);nk(j,a);if((lk(j)|0)!=(e|0)){B=17;break}c[x>>2]=j;hk(h,f,j)}while((lk(h)|0)>>>0<=i>>>0);if((B|0)==17)Ie(41524,41560,360,41566);Jl(h);e=Il(101)|0;Kl(e,101,2);ok(e,100);if((lk(e)|0)!=101)Ie(41583,41560,375,41617);c[s>>2]=e;e=Il(101)|0;Kl(e,101,2);ok(e,100);if((lk(e)|0)!=101)Ie(41583,41560,375,41617);c[t>>2]=e;e=Il(101)|0;Kl(e,101,2);ok(e,100);if((lk(e)|0)!=101)Ie(41583,41560,375,41617);c[v>>2]=e;e=Il(101)|0;Kl(e,101,2);ok(e,100);if((lk(e)|0)==101){c[w>>2]=e;B=39;break}else Ie(41583,41560,375,41617)}else{d=n+4|0;e=d+12|0;f=e+40|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(f|0));c[n>>2]=41634;c[n+8>>2]=41638;c[n+16>>2]=41642;c[n+24>>2]=41645;c[n+32>>2]=41649;c[n+40>>2]=41653;c[d>>2]=s;c[n+12>>2]=t;c[n+20>>2]=u;c[n+28>>2]=v;c[n+36>>2]=w;c[n+44>>2]=x;e=0;d=41634;do{d=uf(z,d,0)|0;if(d|0){r=Af(d,1,5)|0;c[c[n+(e<<3)+4>>2]>>2]=r;sf(d)}e=e+1|0;d=c[n+(e<<3)>>2]|0}while((d|0)!=0);d=c[s>>2]|0;b:do if(d|0){e=1;do{if(!(c[c[n+(e<<3)+4>>2]>>2]|0))break b;e=e+1|0}while((c[n+(e<<3)>>2]|0)!=0);B=39;break a}while(0);Jl(d);d=1;do{Jl(c[c[n+(d<<3)+4>>2]>>2]|0);d=d+1|0}while((c[n+(d<<3)>>2]|0)!=0);q=0;r=0;p=0;o=0;d=128}while(0);if((B|0)==39){f=kl(k)|0;d=Ch(c[u>>2]|0,c[s>>2]|0,c[t>>2]|0,f,0,0)|0;e=Ch(c[x>>2]|0,c[v>>2]|0,c[w>>2]|0,f,0,0)|0;Jl(c[u>>2]|0);c[u>>2]=0;Jl(c[s>>2]|0);c[s>>2]=0;Jl(c[t>>2]|0);c[t>>2]=0;Jl(c[x>>2]|0);c[x>>2]=0;Jl(c[v>>2]|0);c[v>>2]=0;Jl(c[w>>2]|0);c[w>>2]=0;if((d|0)!=0&(e|0)!=0){q=d;r=e;p=f;o=1;d=128}else{Jl(d);Jl(e);Jl(f);q=d;r=e;p=f;o=0;d=21}}if(o){if((wk(q,r)|0)>0){Fl(q,r);e=1}else e=0;d=Hl(y)|0;Kk(d,q,r);f=y>>>1;j=Il(f)|0;f=Il(f)|0;g=Il(y)|0;gk(j,q,1);gk(f,r,1);Kk(g,j,f);i=Il(y)|0;if(!(Ek(i,p,g)|0))Ie(41656,41560,541,41690);Ek(i,j,f)|0;Jl(f);Bk(j,g,i);Jl(g);Fk(i,p,j)|0;Fk(j,q,r)|0;if(nf(1)|0){if(e|0)Oe(41704,A);Se(45379,q);Se(41725,r);Se(41729,d);Se(41733,p);Se(41737,i);Se(41741,j)}c[D>>2]=d;h=D+4|0;c[h>>2]=p;a=D+12|0;c[a>>2]=q;g=D+16|0;c[g>>2]=r;f=D+8|0;c[f>>2]=i;d=D+20|0;c[d>>2]=j;if(!(Oi(D,y+-64|0)|0))d=0;else{Jl(c[D>>2]|0);c[D>>2]=0;Jl(c[h>>2]|0);c[h>>2]=0;Jl(c[a>>2]|0);c[a>>2]=0;Jl(c[g>>2]|0);c[g>>2]=0;Jl(c[f>>2]|0);c[f>>2]=0;Jl(c[d>>2]|0);c[d>>2]=0;kg(41560,586,41690,0,41745);d=50}}else e=0}else{e=0;d=55}sf(z);if((e|0)!=0&(d|0)==0)d=tf(E,41783,0,1)|0;if(!d){h=D+4|0;a=D+8|0;g=D+12|0;f=D+16|0;d=D+20|0;e=D;B=86}}if((B|0)==86){w=c[e>>2]|0;x=c[h>>2]|0;y=c[a>>2]|0;z=c[g>>2]|0;A=c[f>>2]|0;B=c[d>>2]|0;d=c[E>>2]|0;c[C>>2]=w;c[C+4>>2]=x;c[C+8>>2]=w;c[C+12>>2]=x;c[C+16>>2]=y;c[C+20>>2]=z;c[C+24>>2]=A;c[C+28>>2]=B;c[C+32>>2]=d;d=Df(b,0,41879,C)|0}tl(c[D>>2]|0);tl(c[D+4>>2]|0);tl(c[D+12>>2]|0);tl(c[D+16>>2]|0);tl(c[D+8>>2]|0);tl(c[D+20>>2]|0);sf(c[E>>2]|0);E=d;l=F;return E|0}function Fi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;j=l;l=l+64|0;if((l|0)>=(m|0))$(64);i=j+32|0;k=j;b=j+40|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;d=b+4|0;e=b+8|0;f=b+12|0;g=b+16|0;h=b+20|0;c[k>>2]=b;c[k+4>>2]=d;c[k+8>>2]=e;c[k+12>>2]=f;c[k+16>>2]=g;c[k+20>>2]=h;c[k+24>>2]=0;a=If(a,0,39064,k)|0;if(!a){k=ll(c[(c[f>>2]|0)+4>>2]<<1)|0;Kk(k,c[f>>2]|0,c[g>>2]|0);a=wk(k,c[b>>2]|0)|0;tl(k);a=(a|0)==0?0:7}Jl(c[b>>2]|0);Jl(c[d>>2]|0);Jl(c[e>>2]|0);Jl(c[f>>2]|0);Jl(c[g>>2]|0);Jl(c[h>>2]|0);if(!(nf(1)|0)){l=j;return a|0}c[i>>2]=Pn(a)|0;Oe(41480,i);l=j;return a|0}function Gi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;p=l;l=l+96|0;if((l|0)>=(m|0))$(96);o=p+40|0;g=p+32|0;i=p+24|0;h=p+8|0;j=p+48|0;k=p+44|0;n=p;c[k>>2]=0;e=n;c[e>>2]=0;c[e+4>>2]=0;e=uf(d,39075,1)|0;if(!e)e=0;else{f=Af(e,1,5)|0;sf(e);if(!f)e=0;else e=lk(f)|0;Jl(f)}Jh(j,0,e);e=Lh(b,k,j)|0;do if(!e){if(nf(1)|0)Se(41350,c[k>>2]|0);b=c[k>>2]|0;if(b|0?c[b+12>>2]&4|0:0){f=0;e=79;break}f=n+4|0;c[h>>2]=n;c[h+4>>2]=f;c[h+8>>2]=0;e=If(d,0,39061,h)|0;if(!e){if(nf(1)|0){Se(41367,c[n>>2]|0);Se(41384,c[f>>2]|0)}b=Hl(0)|0;e=c[k>>2]|0;if((b|0)==(e|0)){d=ll(c[b+4>>2]<<1)|0;Mk(d,b,c[f>>2]|0,c[n>>2]|0);Al(b,d)|0;tl(d)}else Mk(b,e,c[f>>2]|0,c[n>>2]|0);if(nf(1)|0)Se(41401,b);if(!(c[j+12>>2]&4)){c[g>>2]=b;f=b;e=Df(a,0,41438,g)|0;break}f=((lk(c[n>>2]|0)|0)+7|0)>>>3;e=Vk(h,0,b,f)|0;if(!e){e=c[h>>2]|0;c[i>>2]=f;c[i+4>>2]=e;e=Df(a,0,41418,i)|0;cf(c[h>>2]|0)}f=b}else f=0}else f=0;while(0);Jl(f);Jl(c[n>>2]|0);Jl(c[n+4>>2]|0);Jl(c[k>>2]|0);Kh(j);if(!(nf(1)|0)){l=p;return e|0}c[o>>2]=Pn(e)|0;Oe(41458,o);l=p;return e|0}function Hi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=l;l=l+160|0;if((l|0)>=(m|0))$(160);v=w+64|0;k=w+56|0;p=w+48|0;o=w+40|0;j=w+8|0;g=w;q=w+112|0;r=w+108|0;s=w+104|0;t=w+80|0;u=w+72|0;n=w+68|0;c[r>>2]=0;c[s>>2]=0;c[t>>2]=0;c[t+4>>2]=0;c[t+8>>2]=0;c[t+12>>2]=0;c[t+16>>2]=0;c[t+20>>2]=0;c[u>>2]=0;c[n>>2]=0;e=uf(d,39075,1)|0;if(!e)e=0;else{f=Af(e,1,5)|0;sf(e);if(!f)e=0;else e=lk(f)|0;Jl(f)}Jh(q,1,e);e=Ih(b,7604,r,q)|0;a:do if(!e){e=c[r>>2]|0;c[g>>2]=s;c[g+4>>2]=0;e=If(e,0,39071,g)|0;if(!e){if(nf(1)|0)Se(41178,c[s>>2]|0);i=c[s>>2]|0;if(i|0?c[i+12>>2]&4|0:0){f=0;e=79;break}i=t+4|0;f=t+8|0;b=t+12|0;g=t+16|0;h=t+20|0;c[j>>2]=t;c[j+4>>2]=i;c[j+8>>2]=f;c[j+12>>2]=b;c[j+16>>2]=g;c[j+20>>2]=h;c[j+24>>2]=0;e=If(d,0,40995,j)|0;if(!e){if(nf(1)|0?(Se(41195,c[t>>2]|0),Se(41212,c[i>>2]|0),(gg()|0)==0):0){Se(41229,c[f>>2]|0);Se(41246,c[b>>2]|0);Se(41263,c[g>>2]|0);Se(41280,c[h>>2]|0)}kk(c[s>>2]|0);e=c[s>>2]|0;xk(e,e,c[t>>2]|0);e=q+4|0;f=Il(c[e>>2]|0)|0;b=q+12|0;if(!(c[b>>2]&1)){g=Il(c[e>>2]|0)|0;h=Il(c[e>>2]|0)|0;d=Il(c[e>>2]|0)|0;do{Kl(g,c[e>>2]|0,0);Gk(g,g,c[t>>2]|0)}while(!(Fk(h,g,c[t>>2]|0)|0));Mk(d,g,c[i>>2]|0,c[t>>2]|0);Lk(d,d,c[s>>2]|0,c[t>>2]|0);Ni(f,d,t);Jl(d);Lk(f,f,h,c[t>>2]|0);Jl(g);Jl(h)}else Ni(f,c[s>>2]|0,t);if(nf(1)|0)Se(41297,f);switch(c[q+8>>2]|0){case 1:{e=wi(u,n,c[e>>2]|0,f)|0;tl(f);if(e|0){f=0;break a}f=c[u>>2]|0;c[o>>2]=c[n>>2];c[o+4>>2]=f;f=0;e=Df(a,0,41314,o)|0;break a}case 3:{e=Bi(u,n,c[e>>2]|0,c[q+16>>2]|0,f,c[q+20>>2]|0,c[q+24>>2]|0)|0;tl(f);if(e|0){f=0;break a}f=c[u>>2]|0;c[p>>2]=c[n>>2];c[p+4>>2]=f;f=0;e=Df(a,0,41314,p)|0;break a}default:{e=c[b>>2]&8|0?41325:47780;c[k>>2]=f;e=Df(a,0,e,k)|0;break a}}}else f=0}else f=0}else f=0;while(0);cf(c[u>>2]|0);Jl(f);Jl(c[t>>2]|0);Jl(c[t+4>>2]|0);Jl(c[t+8>>2]|0);Jl(c[t+12>>2]|0);Jl(c[t+16>>2]|0);Jl(c[t+20>>2]|0);Jl(c[s>>2]|0);Jl(0);Jl(0);Jl(0);sf(c[r>>2]|0);Kh(q);if(!(nf(1)|0)){l=w;return e|0}c[v>>2]=Pn(e)|0;Oe(41328,v);l=w;return e|0}function Ii(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0;s=l;l=l+128|0;if((l|0)>=(m|0))$(128);r=s+48|0;j=s+40|0;n=s+32|0;k=s;o=s+88|0;p=s+80|0;q=s+56|0;c[p>>2]=0;c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;c[q+12>>2]=0;c[q+16>>2]=0;c[q+20>>2]=0;e=uf(d,39075,1)|0;if(!e)e=0;else{f=Af(e,1,5)|0;sf(e);if(!f)e=0;else e=lk(f)|0;Jl(f)}Jh(o,2,e);e=Lh(b,p,o)|0;do if(!e){if(nf(1)|0)Se(40979,c[p>>2]|0);i=c[p>>2]|0;if(i|0?c[i+12>>2]&4|0:0){f=0;e=79;break}f=q+4|0;b=q+8|0;g=q+12|0;h=q+16|0;i=q+20|0;c[k>>2]=q;c[k+4>>2]=f;c[k+8>>2]=b;c[k+12>>2]=g;c[k+16>>2]=h;c[k+20>>2]=i;c[k+24>>2]=0;e=If(d,0,40995,k)|0;if(!e){if(nf(1)|0?(Se(41005,c[q>>2]|0),Se(41021,c[f>>2]|0),(gg()|0)==0):0){Se(41037,c[b>>2]|0);Se(41053,c[g>>2]|0);Se(41069,c[h>>2]|0);Se(41085,c[i>>2]|0)}b=Hl(0)|0;Ni(b,c[p>>2]|0,q);if(nf(1)|0)Se(41101,b);if(!(c[o+12>>2]&4)){c[j>>2]=b;f=b;e=Df(a,0,41137,j)|0;break}f=((lk(c[q>>2]|0)|0)+7|0)>>>3;e=Vk(k,0,b,f)|0;if(!e){e=c[k>>2]|0;c[n>>2]=f;c[n+4>>2]=e;e=Df(a,0,41117,n)|0;cf(c[k>>2]|0)}f=b}else f=0}else f=0;while(0);Jl(f);Jl(c[q>>2]|0);Jl(c[q+4>>2]|0);Jl(c[q+8>>2]|0);Jl(c[q+12>>2]|0);Jl(c[q+16>>2]|0);Jl(c[q+20>>2]|0);Jl(c[p>>2]|0);Kh(o);if(!(nf(1)|0)){l=s;return e|0}c[r>>2]=Pn(e)|0;Oe(41157,r);l=s;return e|0}function Ji(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0;q=l;l=l+96|0;if((l|0)>=(m|0))$(96);p=q+32|0;h=q+16|0;g=q+8|0;i=q+48|0;j=q+44|0;k=q+40|0;n=q+36|0;o=q;c[j>>2]=0;c[k>>2]=0;c[n>>2]=0;e=o;c[e>>2]=0;c[e+4>>2]=0;e=uf(d,39075,1)|0;if(!e)e=0;else{f=Af(e,1,5)|0;sf(e);if(!f)e=0;else e=lk(f)|0;Jl(f)}Jh(i,3,e);f=Lh(b,n,i)|0;do if(!f){if(nf(1)|0)Se(40878,c[n>>2]|0);b=c[n>>2]|0;if(b|0?c[b+12>>2]&4|0:0){b=0;f=79;break}f=Hh(a,7604,j,0)|0;if(!f){f=c[j>>2]|0;c[g>>2]=k;c[g+4>>2]=0;f=If(f,0,39073,g)|0;if(!f){if(nf(1)|0)Se(40894,c[k>>2]|0);b=o+4|0;c[h>>2]=o;c[h+4>>2]=b;c[h+8>>2]=0;f=If(d,0,39061,h)|0;if(!f){if(nf(1)|0){Se(40910,c[o>>2]|0);Se(40926,c[b>>2]|0)}f=Hl(0)|0;e=c[k>>2]|0;if((f|0)==(e|0)){h=ll(c[f+4>>2]<<1)|0;Mk(h,f,c[b>>2]|0,c[o>>2]|0);Al(f,h)|0;tl(h)}else Mk(f,e,c[b>>2]|0,c[o>>2]|0);if(nf(1)|0)Se(40942,f);e=c[i+32>>2]|0;if(!e){h=(wk(f,c[n>>2]|0)|0)!=0;b=f;f=h?8:0;break}else{b=f;f=yb[e&7](i,f)|0;break}}else b=0}else b=0}else b=0}else b=0;while(0);Jl(b);Jl(c[o>>2]|0);Jl(c[o+4>>2]|0);Jl(c[n>>2]|0);Jl(c[k>>2]|0);sf(c[j>>2]|0);Kh(i);if(!(nf(1)|0)){l=q;return f|0}if(!f)e=47183;else e=Pn(f)|0;c[p>>2]=e;Oe(40958,p);l=q;return f|0}function Ki(a){a=a|0;var b=0;a=uf(a,39075,1)|0;if(!a){b=0;return b|0}b=Af(a,1,5)|0;sf(a);if(!b)a=0;else a=lk(b)|0;Jl(b);b=a;return b|0}function Li(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;q=l;l=l+32|0;if((l|0)>=(m|0))$(32);f=q;j=q+20|0;k=q+16|0;n=q+12|0;o=q+8|0;p=q+4|0;if((a|0)!=1){r=4;l=q;return r|0}c[o>>2]=0;c[p>>2]=0;b=Ff(o,0,39077,1029)|0;do if(!b){b=Ff(p,0,40107,316)|0;if(!b){b=Uh(c[o>>2]|0)|0;if(b|0){b=Pn(b)|0;a=40842;r=28;break}b=c[p>>2]|0;a=c[o>>2]|0;c[j>>2]=0;c[k>>2]=0;c[n>>2]=0;if((Ff(j,0,40424,75)|0)==0?(Ff(k,0,40500,75)|0)==0:0)if(!(Sh(n,c[j>>2]|0,a)|0))if(!(Th(c[n>>2]|0,c[j>>2]|0,b)|0)){b=((Th(c[n>>2]|0,c[k>>2]|0,b)|0)&65535|0)==8;b=b?0:40576}else b=40641;else b=40626;else b=40603;sf(c[n>>2]|0);sf(c[k>>2]|0);sf(c[j>>2]|0);if(!b){b=c[p>>2]|0;a=c[o>>2]|0;c[j>>2]=0;c[k>>2]=0;c[n>>2]=0;g=Hl(1e3)|0;Kl(g,1e3,0);c[f>>2]=g;if(!(Df(j,0,40655,f)|0))if(!(Ph(k,c[j>>2]|0,b)|0)){b=uf(c[k>>2]|0,40685,0)|0;if((((b|0)!=0?(h=uf(b,40693,0)|0,sf(b),(h|0)!=0):0)?(i=uf(h,39071,0)|0,sf(h),(i|0)!=0):0)?(e=Af(i,1,0)|0,sf(i),(e|0)!=0):0)if(wk(g,e)|0)if(!(Rh(n,c[k>>2]|0,a)|0)){b=uf(c[n>>2]|0,40697,0)|0;if(!b)a=Af(c[n>>2]|0,0,5)|0;else a=Af(b,1,5)|0;if(!a){f=b;b=40804;a=0}else{i=(wk(g,a)|0)==0;f=b;b=i?0:40703}}else{f=0;b=40789;a=0}else{f=0;b=40760;a=0}else{f=0;e=0;b=40727;a=0}}else{f=0;e=0;b=40712;a=0}else{f=0;e=0;b=40603;a=0}sf(f);Jl(a);sf(c[n>>2]|0);Jl(e);sf(c[k>>2]|0);sf(c[j>>2]|0);Jl(g);if(!b){sf(c[p>>2]|0);sf(c[o>>2]|0);b=0}else{a=40863;r=28}}else{a=40858;r=28}}else r=4}else r=4;while(0);if((r|0)==4){b=Pn(b)|0;a=40834;r=28}if((r|0)==28){sf(c[p>>2]|0);sf(c[o>>2]|0);if(!d)b=50;else{zb[d&1](40871,1,a,b);b=50}}r=b;l=q;return r|0}function Mi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=f;b=uf(b,39075,1)|0;do if(b){d=xf(b,1,e)|0;if(!d){sf(b);b=68;break}else{lh(a,d,c[e>>2]|0);sf(b);b=0;break}}else b=68;while(0);l=f;return b|0}function Ni(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;kk(b);h=d+12|0;if((c[h>>2]|0?(i=d+16|0,c[i>>2]|0):0)?(j=d+20|0,c[j>>2]|0):0){e=nl((c[(c[d>>2]|0)+4>>2]|0)+1|0)|0;f=nl((c[(c[d>>2]|0)+4>>2]|0)+1|0)|0;g=nl((c[(c[d>>2]|0)+4>>2]|0)+1|0)|0;gk(g,c[h>>2]|0,1);d=d+8|0;xk(g,c[d>>2]|0,g);Mk(e,b,g,c[h>>2]|0);gk(g,c[i>>2]|0,1);xk(g,c[d>>2]|0,g);Mk(f,b,g,c[i>>2]|0);hk(g,f,e);if(c[g+8>>2]|0)fk(g,g,c[i>>2]|0);Lk(g,c[j>>2]|0,g,c[i>>2]|0);Kk(g,g,c[h>>2]|0);fk(a,e,g);tl(g);tl(e);tl(f);return}Mk(a,b,c[d+8>>2]|0,c[d>>2]|0);return}function Oi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;f=Hl(b)|0;g=Hl(b)|0;h=Hl(b)|0;i=Hl(b)|0;d=c[a>>2]|0;e=c[a+4>>2]|0;Kl(f,b,0);if((g|0)==(f|0)){j=ll(c[f+4>>2]<<1)|0;Mk(j,f,e,d);Al(f,j)|0;tl(j)}else Mk(g,f,e,d);if((wk(g,f)|0)!=0?(Ni(h,g,a),(wk(h,f)|0)==0):0){Kl(f,b,0);Ni(i,f,a);a=(h|0)==(i|0);if(a){j=ll(c[h+4>>2]<<1)|0;Mk(j,h,e,d);Al(h,j)|0;tl(j)}else Mk(h,i,e,d);if(!(wk(h,f)|0)){ek(i,i,1);if(a){j=ll(c[h+4>>2]<<1)|0;Mk(j,h,e,d);Al(h,j)|0;tl(j)}else Mk(h,i,e,d);a=((wk(h,f)|0)==0)<<31>>31}else a=-1}else a=-1;Jl(i);Jl(h);Jl(g);Jl(f);return a|0}function Pi(a,b){a=a|0;b=b|0;var c=0;gk(b,b,1);c=Bl(b)|0;a=(Ek(c,a,b)|0)==0&1;Jl(c);ek(b,b,1);return a|0}function Qi(a,b){a=a|0;b=b|0;c[a+160>>2]=1732584193;c[a+164>>2]=-271733879;c[a+168>>2]=-1732584194;c[a+172>>2]=271733878;c[a+176>>2]=-1009589776;b=a+128|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[a+148>>2]=64;c[a+152>>2]=32;return}function Ri(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;Jm(b,0,0);h=b+128|0;f=c[h>>2]|0;i=f<<6;h=gr(f|0,c[h+4>>2]|0,26)|0;e=b+144|0;j=c[e>>2]|0;g=i+j|0;f=(g>>>0>>0&1)+(h&536870848|f>>>26)|0;h=g<<3;i=f<<3|g>>>29;c[e>>2]=j+1;a[b+j>>0]=-128;d=c[e>>2]|0;if((j|0)<56){if((d|0)<56)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<56)}else{if((d|0)<64)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<64);Jm(b,0,0);d=b;e=d+56|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0))}a[b+56>>0]=f>>>21;a[b+57>>0]=f>>>13;a[b+58>>0]=f>>>5;a[b+59>>0]=i;a[b+60>>0]=g>>>21;a[b+61>>0]=g>>>13;a[b+62>>0]=g>>>5;a[b+63>>0]=h;Ui(b,b,1)|0;Te(104);j=c[b+160>>2]|0;a[b>>0]=j>>>24;a[b+1>>0]=j>>>16;a[b+2>>0]=j>>>8;a[b+3>>0]=j;j=c[b+164>>2]|0;a[b+4>>0]=j>>>24;a[b+5>>0]=j>>>16;a[b+6>>0]=j>>>8;a[b+7>>0]=j;j=c[b+168>>2]|0;a[b+8>>0]=j>>>24;a[b+9>>0]=j>>>16;a[b+10>>0]=j>>>8;a[b+11>>0]=j;j=c[b+172>>2]|0;a[b+12>>0]=j>>>24;a[b+13>>0]=j>>>16;a[b+14>>0]=j>>>8;a[b+15>>0]=j;j=c[b+176>>2]|0;a[b+16>>0]=j>>>24;a[b+17>>0]=j>>>16;a[b+18>>0]=j>>>8;a[b+19>>0]=j;return}function Si(a){a=a|0;return a|0}function Ti(a,b,c){a=a|0;b=b|0;c=c|0;if((a|0)!=2){c=5;return c|0}a=Im(2,0,42568,3,42031,20)|0;if(!a){if(!b){c=0;return c|0}a=Im(2,0,42234,56,42052,20)|0;if(!a){a=Im(2,1,0,0,42073,20)|0;if(!a){c=0;return c|0}else b=42857}else b=42845}else b=42832;if(!c){c=50;return c|0}zb[c&1](42873,2,b,a);c=50;return c|0}function Ui(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;k=a+160|0;l=a+164|0;m=a+168|0;n=a+172|0;j=a+176|0;a=c[m>>2]|0;f=c[n>>2]|0;g=c[l>>2]|0;h=c[j>>2]|0;i=c[k>>2]|0;while(1){z=(d[b+1>>0]|0)<<16|(d[b>>0]|0)<<24|(d[b+2>>0]|0)<<8|(d[b+3>>0]|0);o=(i<<5|i>>>27)+1518500249+h+((f^a)&g^f)+z|0;r=g<<30|g>>>2;v=(d[b+5>>0]|0)<<16|(d[b+4>>0]|0)<<24|(d[b+6>>0]|0)<<8|(d[b+7>>0]|0);p=f+1518500249+((r^a)&i^a)+(o<<5|o>>>27)+v|0;s=i<<30|i>>>2;B=(d[b+9>>0]|0)<<16|(d[b+8>>0]|0)<<24|(d[b+10>>0]|0)<<8|(d[b+11>>0]|0);q=a+1518500249+(o&(r^s)^r)+(p<<5|p>>>27)+B|0;o=o<<30|o>>>2;G=(d[b+13>>0]|0)<<16|(d[b+12>>0]|0)<<24|(d[b+14>>0]|0)<<8|(d[b+15>>0]|0);r=r+1518500249+(p&(o^s)^s)+G+(q<<5|q>>>27)|0;p=p<<30|p>>>2;E=(d[b+17>>0]|0)<<16|(d[b+16>>0]|0)<<24|(d[b+18>>0]|0)<<8|(d[b+19>>0]|0);s=s+1518500249+(q&(p^o)^o)+E+(r<<5|r>>>27)|0;q=q<<30|q>>>2;C=(d[b+21>>0]|0)<<16|(d[b+20>>0]|0)<<24|(d[b+22>>0]|0)<<8|(d[b+23>>0]|0);o=o+1518500249+(r&(q^p)^p)+C+(s<<5|s>>>27)|0;r=r<<30|r>>>2;y=(d[b+25>>0]|0)<<16|(d[b+24>>0]|0)<<24|(d[b+26>>0]|0)<<8|(d[b+27>>0]|0);p=p+1518500249+(s&(r^q)^q)+y+(o<<5|o>>>27)|0;s=s<<30|s>>>2;u=(d[b+29>>0]|0)<<16|(d[b+28>>0]|0)<<24|(d[b+30>>0]|0)<<8|(d[b+31>>0]|0);q=q+1518500249+(o&(s^r)^r)+u+(p<<5|p>>>27)|0;o=o<<30|o>>>2;x=(d[b+33>>0]|0)<<16|(d[b+32>>0]|0)<<24|(d[b+34>>0]|0)<<8|(d[b+35>>0]|0);r=r+1518500249+(p&(o^s)^s)+x+(q<<5|q>>>27)|0;p=p<<30|p>>>2;t=(d[b+37>>0]|0)<<16|(d[b+36>>0]|0)<<24|(d[b+38>>0]|0)<<8|(d[b+39>>0]|0);s=s+1518500249+(q&(p^o)^o)+t+(r<<5|r>>>27)|0;q=q<<30|q>>>2;I=(d[b+41>>0]|0)<<16|(d[b+40>>0]|0)<<24|(d[b+42>>0]|0)<<8|(d[b+43>>0]|0);o=o+1518500249+(r&(q^p)^p)+I+(s<<5|s>>>27)|0;r=r<<30|r>>>2;H=(d[b+45>>0]|0)<<16|(d[b+44>>0]|0)<<24|(d[b+46>>0]|0)<<8|(d[b+47>>0]|0);p=p+1518500249+(s&(r^q)^q)+H+(o<<5|o>>>27)|0;s=s<<30|s>>>2;F=(d[b+49>>0]|0)<<16|(d[b+48>>0]|0)<<24|(d[b+50>>0]|0)<<8|(d[b+51>>0]|0);q=q+1518500249+(o&(s^r)^r)+F+(p<<5|p>>>27)|0;o=o<<30|o>>>2;D=(d[b+53>>0]|0)<<16|(d[b+52>>0]|0)<<24|(d[b+54>>0]|0)<<8|(d[b+55>>0]|0);r=r+1518500249+(p&(o^s)^s)+D+(q<<5|q>>>27)|0;p=p<<30|p>>>2;A=(d[b+57>>0]|0)<<16|(d[b+56>>0]|0)<<24|(d[b+58>>0]|0)<<8|(d[b+59>>0]|0);s=s+1518500249+(q&(p^o)^o)+A+(r<<5|r>>>27)|0;q=q<<30|q>>>2;w=(d[b+61>>0]|0)<<16|(d[b+60>>0]|0)<<24|(d[b+62>>0]|0)<<8|(d[b+63>>0]|0);o=o+1518500249+(r&(q^p)^p)+w+(s<<5|s>>>27)|0;r=r<<30|r>>>2;z=B^z^x^D;z=z<<1|z>>>31;p=p+1518500249+z+(s&(r^q)^q)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;v=G^v^t^A;v=v<<1|v>>>31;q=q+1518500249+v+(o&(s^r)^r)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;B=E^B^I^w;B=B<<1|B>>>31;r=r+1518500249+B+(p&(o^s)^s)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;G=C^G^H^z;G=G<<1|G>>>31;s=G+1518500249+s+(q&(p^o)^o)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;E=y^E^F^v;E=E<<1|E>>>31;o=E+1859775393+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;C=u^C^D^B;C=C<<1|C>>>31;p=C+1859775393+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;y=x^y^A^G;y=y<<1|y>>>31;q=y+1859775393+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;u=t^u^w^E;u=u<<1|u>>>31;r=u+1859775393+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;x=I^x^z^C;x=x<<1|x>>>31;s=x+1859775393+s+(p^o^q)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;t=H^t^v^y;t=t<<1|t>>>31;o=t+1859775393+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;I=F^I^B^u;I=I<<1|I>>>31;p=I+1859775393+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;H=D^H^G^x;H=H<<1|H>>>31;q=H+1859775393+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;F=A^F^E^t;F=F<<1|F>>>31;r=F+1859775393+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;D=w^D^C^I;D=D<<1|D>>>31;s=D+1859775393+s+(p^o^q)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;A=A^z^y^H;A=A<<1|A>>>31;o=A+1859775393+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;w=w^v^u^F;w=w<<1|w>>>31;p=w+1859775393+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;z=B^z^x^D;z=z<<1|z>>>31;q=z+1859775393+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;v=v^G^t^A;v=v<<1|v>>>31;r=v+1859775393+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;B=B^E^I^w;B=B<<1|B>>>31;s=B+1859775393+s+(p^o^q)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;G=C^G^H^z;G=G<<1|G>>>31;o=G+1859775393+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;E=E^y^F^v;E=E<<1|E>>>31;p=E+1859775393+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;C=C^u^D^B;C=C<<1|C>>>31;q=C+1859775393+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;y=x^y^A^G;y=y<<1|y>>>31;r=y+1859775393+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;u=u^t^w^E;u=u<<1|u>>>31;s=u+1859775393+s+(p^o^q)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;x=x^I^z^C;x=x<<1|x>>>31;o=x+-1894007588+o+((r|q)&p|r&q)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;t=H^t^v^y;t=t<<1|t>>>31;p=t+-1894007588+p+((s|r)&q|s&r)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;I=I^F^B^u;I=I<<1|I>>>31;q=I+-1894007588+q+((o|s)&r|o&s)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;H=H^D^G^x;H=H<<1|H>>>31;r=H+-1894007588+r+((p|o)&s|p&o)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;F=A^F^E^t;F=F<<1|F>>>31;s=F+-1894007588+s+((q|p)&o|q&p)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;D=D^w^C^I;D=D<<1|D>>>31;o=D+-1894007588+o+((r|q)&p|r&q)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;A=A^z^y^H;A=A<<1|A>>>31;p=A+-1894007588+p+((s|r)&q|s&r)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;w=v^w^u^F;w=w<<1|w>>>31;q=w+-1894007588+q+((o|s)&r|o&s)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;z=z^B^x^D;z=z<<1|z>>>31;r=z+-1894007588+r+((p|o)&s|p&o)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;v=v^G^t^A;v=v<<1|v>>>31;s=v+-1894007588+s+((q|p)&o|q&p)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;B=E^B^I^w;B=B<<1|B>>>31;o=B+-1894007588+o+((r|q)&p|r&q)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;G=G^C^H^z;G=G<<1|G>>>31;p=G+-1894007588+p+((s|r)&q|s&r)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;E=E^y^F^v;E=E<<1|E>>>31;q=E+-1894007588+q+((o|s)&r|o&s)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;C=u^C^D^B;C=C<<1|C>>>31;r=C+-1894007588+r+((p|o)&s|p&o)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;y=y^x^A^G;y=y<<1|y>>>31;s=y+-1894007588+s+((q|p)&o|q&p)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;u=u^t^w^E;u=u<<1|u>>>31;o=u+-1894007588+o+((r|q)&p|r&q)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;x=I^x^z^C;x=x<<1|x>>>31;p=x+-1894007588+p+((s|r)&q|s&r)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;t=t^H^v^y;t=t<<1|t>>>31;q=t+-1894007588+q+((o|s)&r|o&s)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;I=I^F^B^u;I=I<<1|I>>>31;r=I+-1894007588+r+((p|o)&s|p&o)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;H=D^H^G^x;H=H<<1|H>>>31;s=H+-1894007588+s+((q|p)&o|q&p)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;F=F^A^E^t;F=F<<1|F>>>31;o=F+-899497514+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;D=D^w^C^I;D=D<<1|D>>>31;p=D+-899497514+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;A=z^A^y^H;A=A<<1|A>>>31;q=A+-899497514+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;w=w^v^u^F;w=w<<1|w>>>31;r=w+-899497514+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;z=z^B^x^D;z=z<<1|z>>>31;s=z+-899497514+s+(p^o^q)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;v=G^v^t^A;v=v<<1|v>>>31;o=v+-899497514+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;B=B^E^I^w;B=B<<1|B>>>31;p=B+-899497514+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;G=G^C^H^z;G=G<<1|G>>>31;q=G+-899497514+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;E=y^E^F^v;E=E<<1|E>>>31;r=E+-899497514+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;C=C^u^D^B;C=C<<1|C>>>31;s=C+-899497514+s+(p^o^q)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;y=y^x^A^G;y=y<<1|y>>>31;o=y+-899497514+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;u=t^u^w^E;u=u<<1|u>>>31;p=u+-899497514+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;x=x^I^z^C;x=x<<1|x>>>31;q=x+-899497514+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;t=t^H^v^y;t=t<<1|t>>>31;r=t+-899497514+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;B=F^I^B^u;B=B<<1|B>>>31;s=B+-899497514+s+(p^o^q)+(r<<5|r>>>27)|0;q=q<<30|q>>>2;x=H^D^G^x;x=x<<1|x>>>31;o=x+-899497514+o+(q^p^r)+(s<<5|s>>>27)|0;r=r<<30|r>>>2;t=F^A^E^t;t=t<<1|t>>>31;p=t+-899497514+p+(r^q^s)+(o<<5|o>>>27)|0;s=s<<30|s>>>2;B=w^D^C^B;q=(B<<1|B>>>31)+-899497514+q+(s^r^o)+(p<<5|p>>>27)|0;o=o<<30|o>>>2;x=A^z^y^x;r=(x<<1|x>>>31)+-899497514+r+(o^s^p)+(q<<5|q>>>27)|0;p=p<<30|p>>>2;t=w^v^u^t;i=i+-899497514+(t<<1|t>>>31)+s+(p^o^q)+(r<<5|r>>>27)|0;c[k>>2]=i;g=r+(c[l>>2]|0)|0;c[l>>2]=g;a=(q<<30|q>>>2)+(c[m>>2]|0)|0;c[m>>2]=a;f=p+(c[n>>2]|0)|0;c[n>>2]=f;h=o+(c[j>>2]|0)|0;c[j>>2]=h;e=e+-1|0;if(!e)break;else b=b+64|0}return 104}function Vi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=l;l=l+192|0;if((l|0)>=(m|0))$(192);g=f;c[g+160>>2]=1732584193;c[g+164>>2]=-271733879;c[g+168>>2]=-1732584194;c[g+172>>2]=271733878;c[g+176>>2]=-1009589776;h=g+128|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;c[g+148>>2]=64;c[g+152>>2]=32;Jm(g,d,e);Ri(g);d=g;e=b+20|0;do{a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}while((b|0)<(e|0));l=f;return}function Wi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;g=l;l=l+192|0;if((l|0)>=(m|0))$(192);f=g;c[f+160>>2]=1732584193;c[f+164>>2]=-271733879;c[f+168>>2]=-1732584194;c[f+172>>2]=271733878;c[f+176>>2]=-1009589776;h=f+128|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[h+16>>2]=0;c[f+148>>2]=64;c[f+152>>2]=32;if((e|0)<=0){Ri(f);d=b;e=d+20|0;do{a[d>>0]=a[f>>0]|0;d=d+1|0;f=f+1|0}while((d|0)<(e|0));l=g;return}while(1){Jm(f,(c[d+12>>2]|0)+(c[d+4>>2]|0)|0,c[d+8>>2]|0);if((e|0)>1){d=d+16|0;e=e+-1|0}else break}Ri(f);d=b;e=d+20|0;do{a[d>>0]=a[f>>0]|0;d=d+1|0;f=f+1|0}while((d|0)<(e|0));l=g;return}function Xi(a,b){a=a|0;b=b|0;c[a+160>>2]=-1056596264;c[a+164>>2]=914150663;c[a+168>>2]=812702999;c[a+172>>2]=-150054599;c[a+176>>2]=-4191439;c[a+180>>2]=1750603025;c[a+184>>2]=1694076839;c[a+188>>2]=-1090891868;b=a+128|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[a+148>>2]=64;c[a+152>>2]=33;return}function Yi(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;Jm(b,0,0);h=b+128|0;f=c[h>>2]|0;i=f<<6;h=gr(f|0,c[h+4>>2]|0,26)|0;e=b+144|0;j=c[e>>2]|0;g=i+j|0;f=(g>>>0>>0&1)+(h&536870848|f>>>26)|0;h=g<<3;i=f<<3|g>>>29;c[e>>2]=j+1;a[b+j>>0]=-128;d=c[e>>2]|0;if((j|0)<56){if((d|0)<56)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<56)}else{if((d|0)<64)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<64);Jm(b,0,0);d=b;e=d+56|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0))}a[b+56>>0]=f>>>21;a[b+57>>0]=f>>>13;a[b+58>>0]=f>>>5;a[b+59>>0]=i;a[b+60>>0]=g>>>21;a[b+61>>0]=g>>>13;a[b+62>>0]=g>>>5;a[b+63>>0]=h;$i(b,b,1)|0;Te(328);j=c[b+160>>2]|0;a[b>>0]=j>>>24;a[b+1>>0]=j>>>16;a[b+2>>0]=j>>>8;a[b+3>>0]=j;j=c[b+164>>2]|0;a[b+4>>0]=j>>>24;a[b+5>>0]=j>>>16;a[b+6>>0]=j>>>8;a[b+7>>0]=j;j=c[b+168>>2]|0;a[b+8>>0]=j>>>24;a[b+9>>0]=j>>>16;a[b+10>>0]=j>>>8;a[b+11>>0]=j;j=c[b+172>>2]|0;a[b+12>>0]=j>>>24;a[b+13>>0]=j>>>16;a[b+14>>0]=j>>>8;a[b+15>>0]=j;j=c[b+176>>2]|0;a[b+16>>0]=j>>>24;a[b+17>>0]=j>>>16;a[b+18>>0]=j>>>8;a[b+19>>0]=j;j=c[b+180>>2]|0;a[b+20>>0]=j>>>24;a[b+21>>0]=j>>>16;a[b+22>>0]=j>>>8;a[b+23>>0]=j;j=c[b+184>>2]|0;a[b+24>>0]=j>>>24;a[b+25>>0]=j>>>16;a[b+26>>0]=j>>>8;a[b+27>>0]=j;j=c[b+188>>2]|0;a[b+28>>0]=j>>>24;a[b+29>>0]=j>>>16;a[b+30>>0]=j>>>8;a[b+31>>0]=j;return}function Zi(a){a=a|0;return a|0}function _i(a,b,c){a=a|0;b=b|0;c=c|0;switch(a|0){case 11:{a=Im(11,0,42568,3,42205,28)|0;if(!a){if(!b){c=0;return c|0}a=Im(11,0,42234,56,42291,28)|0;if(!a){a=Im(11,1,0,0,42320,28)|0;if(!a){c=0;return c|0}else b=42857}else b=42845}else b=42832;if(!c){c=50;return c|0}zb[c&1](42873,11,b,a);c=50;return c|0}case 8:{a=Im(8,0,42568,3,42349,32)|0;if(!a){if(!b){c=0;return c|0}a=Im(8,0,42234,56,42382,32)|0;if(!a){a=Im(8,1,0,0,42415,32)|0;if(!a){c=0;return c|0}else b=42857}else b=42845}else b=42832;if(!c){c=50;return c|0}zb[c&1](42873,8,b,a);c=50;return c|0}default:{c=5;return c|0}}return 0}function $i(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;z=l;l=l+256|0;if((l|0)>=(m|0))$(256);s=z;t=a+160|0;u=a+164|0;v=a+168|0;w=a+172|0;x=a+176|0;y=a+180|0;r=a+184|0;q=a+188|0;i=c[q>>2]|0;k=c[r>>2]|0;j=c[y>>2]|0;h=c[x>>2]|0;g=c[w>>2]|0;p=c[v>>2]|0;o=c[u>>2]|0;n=c[t>>2]|0;while(1){a=0;do{f=b+(a<<2)|0;c[s+(a<<2)>>2]=(d[f+1>>0]|0)<<16|(d[f>>0]|0)<<24|(d[f+2>>0]|0)<<8|(d[f+3>>0]|0);a=a+1|0}while((a|0)!=16);a=16;f=c[s>>2]|0;do{A=c[s+(a+-2<<2)>>2]|0;B=f;f=c[s+(a+-15<<2)>>2]|0;c[s+(a<<2)>>2]=(c[s+(a+-7<<2)>>2]|0)+B+((A>>>19|A<<13)^A>>>10^(A>>>17|A<<15))+((f>>>18|f<<14)^f>>>3^(f>>>7|f<<25));a=a+1|0}while((a|0)!=64);f=p;a=0;do{G=((j^k)&h^k)+i+(c[12216+(a<<2)>>2]|0)+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(c[s+(a<<2)>>2]|0)|0;H=G+g|0;G=(f&(o|n)|o&n)+((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+G|0;E=a|1;E=(c[12216+(E<<2)>>2]|0)+k+(c[s+(E<<2)>>2]|0)+(H&(h^j)^j)+((H>>>6|H<<26)^(H>>>11|H<<21)^(H>>>25|H<<7))|0;D=E+f|0;E=((G>>>2|G<<30)^(G>>>13|G<<19)^(G>>>22|G<<10))+((G|n)&o|G&n)+E|0;C=a|2;C=(c[12216+(C<<2)>>2]|0)+j+(c[s+(C<<2)>>2]|0)+(D&(H^h)^h)+((D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7))|0;p=C+o|0;C=((E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10))+((E|G)&n|E&G)+C|0;A=a|3;A=(c[12216+(A<<2)>>2]|0)+h+(c[s+(A<<2)>>2]|0)+(p&(D^H)^H)+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))|0;B=A+n|0;A=((C>>>2|C<<30)^(C>>>13|C<<19)^(C>>>22|C<<10))+((C|E)&G|C&E)+A|0;F=a|4;F=(c[12216+(F<<2)>>2]|0)+H+(c[s+(F<<2)>>2]|0)+(B&(p^D)^D)+((B>>>6|B<<26)^(B>>>11|B<<21)^(B>>>25|B<<7))|0;i=F+G|0;g=((A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10))+((A|C)&E|A&C)+F|0;F=a|5;D=(c[s+(F<<2)>>2]|0)+(c[12216+(F<<2)>>2]|0)+D+(i&(B^p)^p)+((i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7))|0;k=D+E|0;f=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+((g|A)&C|g&A)+D|0;D=a|6;p=(c[s+(D<<2)>>2]|0)+(c[12216+(D<<2)>>2]|0)+p+(k&(i^B)^B)+((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))|0;j=p+C|0;o=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+((f|g)&A|f&g)+p|0;p=a|7;B=(c[s+(p<<2)>>2]|0)+(c[12216+(p<<2)>>2]|0)+B+(j&(k^i)^i)+((j>>>6|j<<26)^(j>>>11|j<<21)^(j>>>25|j<<7))|0;h=B+A|0;n=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((o|f)&g|o&f)+B|0;a=a+8|0}while((a|0)<64);n=(c[t>>2]|0)+n|0;c[t>>2]=n;o=(c[u>>2]|0)+o|0;c[u>>2]=o;p=(c[v>>2]|0)+f|0;c[v>>2]=p;g=(c[w>>2]|0)+g|0;c[w>>2]=g;h=(c[x>>2]|0)+h|0;c[x>>2]=h;j=(c[y>>2]|0)+j|0;c[y>>2]=j;k=(c[r>>2]|0)+k|0;c[r>>2]=k;i=(c[q>>2]|0)+i|0;c[q>>2]=i;e=e+-1|0;if(!e)break;else b=b+64|0}l=z;return 328}function aj(a,b){a=a|0;b=b|0;c[a+160>>2]=1779033703;c[a+164>>2]=-1150833019;c[a+168>>2]=1013904242;c[a+172>>2]=-1521486534;c[a+176>>2]=1359893119;c[a+180>>2]=-1694144372;c[a+184>>2]=528734635;c[a+188>>2]=1541459225;b=a+128|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[a+148>>2]=64;c[a+152>>2]=33;return}function bj(a,b){a=a|0;b=b|0;b=a+160|0;c[b>>2]=-205731576;c[b+4>>2]=1779033703;b=a+168|0;c[b>>2]=-2067093701;c[b+4>>2]=-1150833019;b=a+176|0;c[b>>2]=-23791573;c[b+4>>2]=1013904242;b=a+184|0;c[b>>2]=1595750129;c[b+4>>2]=-1521486534;b=a+192|0;c[b>>2]=-1377402159;c[b+4>>2]=1359893119;b=a+200|0;c[b>>2]=725511199;c[b+4>>2]=-1694144372;b=a+208|0;c[b>>2]=-79577749;c[b+4>>2]=528734635;b=a+216|0;c[b>>2]=327033209;c[b+4>>2]=1541459225;b=a+128|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[a+148>>2]=128;c[a+152>>2]=34;return}function cj(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;Jm(b,0,0);i=b+128|0;e=c[i>>2]|0;i=c[i+4>>2]|0;j=b+136|0;h=c[j>>2]|0;j=c[j+4>>2]|0;m=mr(e|0,i|0,7)|0;d=D;j=mr(h|0,j|0,7)|0;h=D;i=gr(e|0,i|0,57)|0;h=h|D;e=b+144|0;l=c[e>>2]|0;f=_q(l|0,((l|0)<0)<<31>>31|0,m|0,d|0)|0;g=D;h=_q((g>>>0>>0|(g|0)==(d|0)&f>>>0>>0)&1|0,0,j|i|0,h|0)|0;i=D;j=mr(f|0,g|0,3)|0;m=mr(h|0,i|0,3)|0;d=D;k=gr(f|0,g|0,61)|0;k=m|k;c[e>>2]=l+1;a[b+l>>0]=-128;d=c[e>>2]|0;if((l|0)<112){if((d|0)<112)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<112)}else{if((d|0)<128)do{c[e>>2]=d+1;a[b+d>>0]=0;d=c[e>>2]|0}while((d|0)<128);Jm(b,0,0);d=b;e=d+112|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0))}m=gr(h|0,i|0,53)|0;a[b+112>>0]=m;m=gr(h|0,i|0,45)|0;a[b+113>>0]=m;m=gr(h|0,i|0,37)|0;a[b+114>>0]=m;m=gr(h|0,i|0,29)|0;a[b+115>>0]=m;m=gr(h|0,i|0,21)|0;a[b+116>>0]=m;m=gr(h|0,i|0,13)|0;a[b+117>>0]=m;m=gr(h|0,i|0,5)|0;a[b+118>>0]=m;a[b+119>>0]=k;m=gr(f|0,g|0,53)|0;a[b+120>>0]=m;m=gr(f|0,g|0,45)|0;a[b+121>>0]=m;m=gr(f|0,g|0,37)|0;a[b+122>>0]=m;m=gr(f|0,g|0,29)|0;a[b+123>>0]=m;m=gr(f|0,g|0,21)|0;a[b+124>>0]=m;m=gr(f|0,g|0,13)|0;a[b+125>>0]=m;m=gr(f|0,g|0,5)|0;a[b+126>>0]=m;a[b+127>>0]=j;fj(b,b,1)|0;Te(220);m=b+160|0;l=c[m>>2]|0;m=c[m+4>>2]|0;k=gr(l|0,m|0,56)|0;a[b>>0]=k;k=gr(l|0,m|0,48)|0;a[b+1>>0]=k;k=gr(l|0,m|0,40)|0;a[b+2>>0]=k;a[b+3>>0]=m;k=gr(l|0,m|0,24)|0;a[b+4>>0]=k;k=gr(l|0,m|0,16)|0;a[b+5>>0]=k;m=gr(l|0,m|0,8)|0;a[b+6>>0]=m;a[b+7>>0]=l;l=b+168|0;m=c[l>>2]|0;l=c[l+4>>2]|0;k=gr(m|0,l|0,56)|0;a[b+8>>0]=k;k=gr(m|0,l|0,48)|0;a[b+9>>0]=k;k=gr(m|0,l|0,40)|0;a[b+10>>0]=k;a[b+11>>0]=l;k=gr(m|0,l|0,24)|0;a[b+12>>0]=k;k=gr(m|0,l|0,16)|0;a[b+13>>0]=k;l=gr(m|0,l|0,8)|0;a[b+14>>0]=l;a[b+15>>0]=m;m=b+176|0;l=c[m>>2]|0;m=c[m+4>>2]|0;k=gr(l|0,m|0,56)|0;a[b+16>>0]=k;k=gr(l|0,m|0,48)|0;a[b+17>>0]=k;k=gr(l|0,m|0,40)|0;a[b+18>>0]=k;a[b+19>>0]=m;k=gr(l|0,m|0,24)|0;a[b+20>>0]=k;k=gr(l|0,m|0,16)|0;a[b+21>>0]=k;m=gr(l|0,m|0,8)|0;a[b+22>>0]=m;a[b+23>>0]=l;l=b+184|0;m=c[l>>2]|0;l=c[l+4>>2]|0;k=gr(m|0,l|0,56)|0;a[b+24>>0]=k;k=gr(m|0,l|0,48)|0;a[b+25>>0]=k;k=gr(m|0,l|0,40)|0;a[b+26>>0]=k;a[b+27>>0]=l;k=gr(m|0,l|0,24)|0;a[b+28>>0]=k;k=gr(m|0,l|0,16)|0;a[b+29>>0]=k;l=gr(m|0,l|0,8)|0;a[b+30>>0]=l;a[b+31>>0]=m;m=b+192|0;l=c[m>>2]|0;m=c[m+4>>2]|0;k=gr(l|0,m|0,56)|0;a[b+32>>0]=k;k=gr(l|0,m|0,48)|0;a[b+33>>0]=k;k=gr(l|0,m|0,40)|0;a[b+34>>0]=k;a[b+35>>0]=m;k=gr(l|0,m|0,24)|0;a[b+36>>0]=k;k=gr(l|0,m|0,16)|0;a[b+37>>0]=k;m=gr(l|0,m|0,8)|0;a[b+38>>0]=m;a[b+39>>0]=l;l=b+200|0;m=c[l>>2]|0;l=c[l+4>>2]|0;k=gr(m|0,l|0,56)|0;a[b+40>>0]=k;k=gr(m|0,l|0,48)|0;a[b+41>>0]=k;k=gr(m|0,l|0,40)|0;a[b+42>>0]=k;a[b+43>>0]=l;k=gr(m|0,l|0,24)|0;a[b+44>>0]=k;k=gr(m|0,l|0,16)|0;a[b+45>>0]=k;l=gr(m|0,l|0,8)|0;a[b+46>>0]=l;a[b+47>>0]=m;m=b+208|0;l=c[m>>2]|0;m=c[m+4>>2]|0;k=gr(l|0,m|0,56)|0;a[b+48>>0]=k;k=gr(l|0,m|0,48)|0;a[b+49>>0]=k;k=gr(l|0,m|0,40)|0;a[b+50>>0]=k;a[b+51>>0]=m;k=gr(l|0,m|0,24)|0;a[b+52>>0]=k;k=gr(l|0,m|0,16)|0;a[b+53>>0]=k;m=gr(l|0,m|0,8)|0;a[b+54>>0]=m;a[b+55>>0]=l;l=b+216|0;m=c[l>>2]|0;l=c[l+4>>2]|0;k=gr(m|0,l|0,56)|0;a[b+56>>0]=k;k=gr(m|0,l|0,48)|0;a[b+57>>0]=k;k=gr(m|0,l|0,40)|0;a[b+58>>0]=k;a[b+59>>0]=l;k=gr(m|0,l|0,24)|0;a[b+60>>0]=k;k=gr(m|0,l|0,16)|0;a[b+61>>0]=k;l=gr(m|0,l|0,8)|0;a[b+62>>0]=l;a[b+63>>0]=m;return}function dj(a){a=a|0;return a|0}function ej(a,b,c){a=a|0;b=b|0;c=c|0;switch(a|0){case 9:{a=Im(9,0,42568,3,42572,48)|0;if(!a){if(!b){c=0;return c|0}a=Im(9,0,42621,112,42734,48)|0;if(!a){a=Im(9,1,0,0,42783,48)|0;if(!a){c=0;return c|0}else b=42857}else b=42845}else b=42832;if(!c){c=50;return c|0}zb[c&1](42873,9,b,a);c=50;return c|0}case 10:{a=Im(10,0,42568,3,42880,64)|0;if(!a){if(!b){c=0;return c|0}a=Im(10,0,42621,112,42945,64)|0;if(!a){a=Im(10,1,0,0,43010,64)|0;if(!a){c=0;return c|0}else b=42857}else b=42845}else b=42832;if(!c){c=50;return c|0}zb[c&1](42873,10,b,a);c=50;return c|0}default:{c=5;return c|0}}return 0}function fj(a,b,e){a=a|0;b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0;Ba=l;l=l+128|0;if((l|0)>=(m|0))$(128);ua=Ba;va=a+160|0;wa=a+168|0;xa=a+176|0;ya=a+184|0;za=a+192|0;Aa=a+200|0;ta=a+208|0;da=a+216|0;ea=ua+112|0;fa=ua+72|0;ga=ua+8|0;ha=ua+120|0;ia=ua+80|0;ja=ua+16|0;ka=ua+88|0;la=ua+24|0;ma=ua+96|0;na=ua+32|0;oa=ua+104|0;pa=ua+40|0;qa=ua+48|0;ra=ua+56|0;sa=ua+64|0;q=va;t=wa;u=xa;w=ya;g=za;i=Aa;k=ta;o=da;n=c[o>>2]|0;o=c[o+4>>2]|0;j=c[k>>2]|0;k=c[k+4>>2]|0;h=c[i>>2]|0;i=c[i+4>>2]|0;f=c[g>>2]|0;g=c[g+4>>2]|0;v=c[w>>2]|0;w=c[w+4>>2]|0;s=c[u>>2]|0;u=c[u+4>>2]|0;r=c[t>>2]|0;t=c[t+4>>2]|0;p=c[q>>2]|0;q=c[q+4>>2]|0;while(1){a=0;do{aa=b+(a<<3)|0;W=mr(d[aa>>0]|0|0,0,56)|0;ba=D;V=mr(d[aa+1>>0]|0|0,0,48)|0;ba=D|ba;X=mr(d[aa+2>>0]|0|0,0,40)|0;ba=ba|D|(d[aa+3>>0]|0);Y=mr(d[aa+4>>0]|0|0,0,24)|0;ba=ba|D;Z=mr(d[aa+5>>0]|0|0,0,16)|0;ba=ba|D;_=mr(d[aa+6>>0]|0|0,0,8)|0;ca=ua+(a<<3)|0;c[ca>>2]=V|W|X|Y|Z|_|(d[aa+7>>0]|0);c[ca+4>>2]=ba|D;a=a+1|0}while((a|0)!=16);S=ua;U=ea;Y=fa;W=ga;x=ha;B=ia;z=ja;G=ka;E=la;K=ma;I=na;O=oa;M=pa;Q=qa;aa=ra;ca=sa;Z=0;_=c[aa>>2]|0;aa=c[aa+4>>2]|0;ba=c[ca>>2]|0;ca=c[ca+4>>2]|0;R=c[S>>2]|0;S=c[S+4>>2]|0;T=c[U>>2]|0;U=c[U+4>>2]|0;V=c[W>>2]|0;W=c[W+4>>2]|0;X=c[Y>>2]|0;Y=c[Y+4>>2]|0;a=c[x>>2]|0;x=c[x+4>>2]|0;y=c[z>>2]|0;z=c[z+4>>2]|0;A=c[B>>2]|0;B=c[B+4>>2]|0;C=c[E>>2]|0;E=c[E+4>>2]|0;F=c[G>>2]|0;G=c[G+4>>2]|0;H=c[I>>2]|0;I=c[I+4>>2]|0;J=c[K>>2]|0;K=c[K+4>>2]|0;L=c[M>>2]|0;M=c[M+4>>2]|0;N=c[O>>2]|0;O=c[O+4>>2]|0;P=c[Q>>2]|0;Q=c[Q+4>>2]|0;do{Ua=gr(f|0,g|0,14)|0;$a=D;ab=mr(f|0,g|0,50)|0;$a=D|$a;Ta=gr(f|0,g|0,18)|0;Va=D;Ga=mr(f|0,g|0,46)|0;Va=$a^(D|Va);$a=gr(f|0,g|0,41)|0;Na=D;Ra=mr(f|0,g|0,23)|0;Na=Va^(D|Na);Va=72+(Z<<3)|0;Fa=c[Va>>2]|0;Va=c[Va+4>>2]|0;Ya=_q(n|0,o|0,R|0,S|0)|0;Va=_q(Ya|0,D|0,Fa|0,Va|0)|0;Va=_q(Va|0,D|0,j&~f^f&h|0,k&~g^g&i|0)|0;Na=_q(Va|0,D|0,(ab|Ua)^(Ga|Ta)^(Ra|$a)|0,Na|0)|0;$a=D;Ra=gr(T|0,U|0,19)|0;Ta=D;Ga=mr(T|0,U|0,45)|0;Ta=D|Ta;Ua=gr(T|0,U|0,61)|0;ab=D;Va=mr(T|0,U|0,3)|0;ab=D|ab;Fa=gr(T|0,U|0,6)|0;Ta=ab^D^Ta;ab=gr(V|0,W|0,1)|0;Ya=D;Ha=mr(V|0,W|0,63)|0;Ya=D|Ya;cb=gr(V|0,W|0,8)|0;Qa=D;Ea=mr(V|0,W|0,56)|0;Qa=D|Qa;La=gr(V|0,W|0,7)|0;Ya=Qa^D^Ya;Qa=_q(R|0,S|0,X|0,Y|0)|0;Ya=_q(Qa|0,D|0,(Ea|cb)^La^(Ha|ab)|0,Ya|0)|0;R=_q(Ya|0,D|0,(Va|Ua)^Fa^(Ga|Ra)|0,Ta|0)|0;S=D;Ta=gr(p|0,q|0,28)|0;Ra=D;Ga=mr(p|0,q|0,36)|0;Ra=D|Ra;Fa=gr(p|0,q|0,34)|0;Ua=D;Va=mr(p|0,q|0,30)|0;Ua=Ra^(D|Ua);Ra=gr(p|0,q|0,39)|0;Ya=D;ab=mr(p|0,q|0,25)|0;Ya=_q((s^r)&p^s&r|0,(u^t)&q^u&t|0,(Ga|Ta)^(Va|Fa)^(ab|Ra)|0,Ua^(D|Ya)|0)|0;Ua=D;Ra=_q(Na|0,$a|0,v|0,w|0)|0;ab=D;$a=_q(Ya|0,Ua|0,Na|0,$a|0)|0;Na=D;Ua=gr(Ra|0,ab|0,14)|0;Ya=D;Fa=mr(Ra|0,ab|0,50)|0;Ya=D|Ya;Va=gr(Ra|0,ab|0,18)|0;Ta=D;Ga=mr(Ra|0,ab|0,46)|0;Ta=Ya^(D|Ta);Ya=gr(Ra|0,ab|0,41)|0;Ha=D;La=mr(Ra|0,ab|0,23)|0;Ha=Ta^(D|Ha);Ta=72+((Z|1)<<3)|0;cb=c[Ta>>2]|0;Ta=c[Ta+4>>2]|0;Ea=_q(j|0,k|0,V|0,W|0)|0;Ta=_q(Ea|0,D|0,cb|0,Ta|0)|0;Ta=_q(Ta|0,D|0,h&~Ra^Ra&f|0,i&~ab^ab&g|0)|0;Ha=_q(Ta|0,D|0,(Fa|Ua)^(Ga|Va)^(La|Ya)|0,Ha|0)|0;Ya=D;La=gr(a|0,x|0,19)|0;Va=D;Ga=mr(a|0,x|0,45)|0;Va=D|Va;Ua=gr(a|0,x|0,61)|0;Fa=D;Ta=mr(a|0,x|0,3)|0;Fa=D|Fa;cb=gr(a|0,x|0,6)|0;Va=Fa^D^Va;Fa=gr(y|0,z|0,1)|0;Ea=D;Qa=mr(y|0,z|0,63)|0;Ea=D|Ea;bb=gr(y|0,z|0,8)|0;Ia=D;_a=mr(y|0,z|0,56)|0;Ia=D|Ia;Wa=gr(y|0,z|0,7)|0;Ea=Ia^D^Ea;Ia=_q(V|0,W|0,A|0,B|0)|0;Ea=_q(Ia|0,D|0,(_a|bb)^Wa^(Qa|Fa)|0,Ea|0)|0;V=_q(Ea|0,D|0,(Ta|Ua)^cb^(Ga|La)|0,Va|0)|0;W=D;Va=gr($a|0,Na|0,28)|0;La=D;Ga=mr($a|0,Na|0,36)|0;La=D|La;cb=gr($a|0,Na|0,34)|0;Ua=D;Ta=mr($a|0,Na|0,30)|0;Ua=La^(D|Ua);La=gr($a|0,Na|0,39)|0;Ea=D;Fa=mr($a|0,Na|0,25)|0;Ea=_q((Ga|Va)^(Ta|cb)^(Fa|La)|0,Ua^(D|Ea)|0,$a&(r^p)^r&p|0,Na&(t^q)^t&q|0)|0;Ua=D;La=_q(Ha|0,Ya|0,s|0,u|0)|0;Fa=D;Ya=_q(Ea|0,Ua|0,Ha|0,Ya|0)|0;Ha=D;Ua=gr(La|0,Fa|0,14)|0;Ea=D;cb=mr(La|0,Fa|0,50)|0;Ea=D|Ea;Ta=gr(La|0,Fa|0,18)|0;Va=D;Ga=mr(La|0,Fa|0,46)|0;Va=Ea^(D|Va);Ea=gr(La|0,Fa|0,41)|0;Qa=D;Wa=mr(La|0,Fa|0,23)|0;Qa=Va^(D|Qa);Va=72+((Z|2)<<3)|0;bb=c[Va>>2]|0;Va=c[Va+4>>2]|0;_a=_q(h|0,i|0,y|0,z|0)|0;Va=_q(_a|0,D|0,bb|0,Va|0)|0;Va=_q(Va|0,D|0,f&~La^La&Ra|0,g&~Fa^Fa&ab|0)|0;Qa=_q(Va|0,D|0,(cb|Ua)^(Ga|Ta)^(Wa|Ea)|0,Qa|0)|0;Ea=D;Wa=gr(R|0,S|0,19)|0;Ta=D;Ga=mr(R|0,S|0,45)|0;Ta=D|Ta;Ua=gr(R|0,S|0,61)|0;cb=D;Va=mr(R|0,S|0,3)|0;cb=D|cb;bb=gr(R|0,S|0,6)|0;Ta=cb^D^Ta;cb=gr(C|0,E|0,1)|0;_a=D;Ia=mr(C|0,E|0,63)|0;_a=D|_a;Pa=gr(C|0,E|0,8)|0;Xa=D;Za=mr(C|0,E|0,56)|0;Xa=D|Xa;Sa=gr(C|0,E|0,7)|0;_a=Xa^D^_a;Xa=_q(y|0,z|0,F|0,G|0)|0;_a=_q(Xa|0,D|0,(Za|Pa)^Sa^(Ia|cb)|0,_a|0)|0;y=_q(_a|0,D|0,(Va|Ua)^bb^(Ga|Wa)|0,Ta|0)|0;z=D;Ta=gr(Ya|0,Ha|0,28)|0;Wa=D;Ga=mr(Ya|0,Ha|0,36)|0;Wa=D|Wa;bb=gr(Ya|0,Ha|0,34)|0;Ua=D;Va=mr(Ya|0,Ha|0,30)|0;Ua=Wa^(D|Ua);Wa=gr(Ya|0,Ha|0,39)|0;_a=D;cb=mr(Ya|0,Ha|0,25)|0;_a=_q((Ga|Ta)^(Va|bb)^(cb|Wa)|0,Ua^(D|_a)|0,Ya&($a^p)^$a&p|0,Ha&(Na^q)^Na&q|0)|0;Ua=D;Wa=_q(Qa|0,Ea|0,r|0,t|0)|0;cb=D;Ea=_q(_a|0,Ua|0,Qa|0,Ea|0)|0;Qa=D;Ua=gr(Wa|0,cb|0,14)|0;_a=D;bb=mr(Wa|0,cb|0,50)|0;_a=D|_a;Va=gr(Wa|0,cb|0,18)|0;Ta=D;Ga=mr(Wa|0,cb|0,46)|0;Ta=_a^(D|Ta);_a=gr(Wa|0,cb|0,41)|0;Ia=D;Sa=mr(Wa|0,cb|0,23)|0;Ia=Ta^(D|Ia);Ta=72+((Z|3)<<3)|0;Pa=c[Ta>>2]|0;Ta=c[Ta+4>>2]|0;Za=_q(f|0,g|0,C|0,E|0)|0;Ta=_q(Za|0,D|0,Pa|0,Ta|0)|0;Ta=_q(Ta|0,D|0,Ra&~Wa^Wa&La|0,ab&~cb^cb&Fa|0)|0;Ia=_q(Ta|0,D|0,(bb|Ua)^(Ga|Va)^(Sa|_a)|0,Ia|0)|0;_a=D;Sa=gr(V|0,W|0,19)|0;Va=D;Ga=mr(V|0,W|0,45)|0;Va=D|Va;Ua=gr(V|0,W|0,61)|0;bb=D;Ta=mr(V|0,W|0,3)|0;bb=D|bb;Pa=gr(V|0,W|0,6)|0;Va=bb^D^Va;bb=gr(H|0,I|0,1)|0;Za=D;Xa=mr(H|0,I|0,63)|0;Za=D|Za;Ca=gr(H|0,I|0,8)|0;Ja=D;Ka=mr(H|0,I|0,56)|0;Ja=D|Ja;Da=gr(H|0,I|0,7)|0;Za=Ja^D^Za;Ja=_q(C|0,E|0,J|0,K|0)|0;Za=_q(Ja|0,D|0,(Ka|Ca)^Da^(Xa|bb)|0,Za|0)|0;C=_q(Za|0,D|0,(Ta|Ua)^Pa^(Ga|Sa)|0,Va|0)|0;E=D;Va=gr(Ea|0,Qa|0,28)|0;Sa=D;Ga=mr(Ea|0,Qa|0,36)|0;Sa=D|Sa;Pa=gr(Ea|0,Qa|0,34)|0;Ua=D;Ta=mr(Ea|0,Qa|0,30)|0;Ua=Sa^(D|Ua);Sa=gr(Ea|0,Qa|0,39)|0;Za=D;bb=mr(Ea|0,Qa|0,25)|0;Za=_q((Ga|Va)^(Ta|Pa)^(bb|Sa)|0,Ua^(D|Za)|0,Ea&(Ya^$a)^Ya&$a|0,Qa&(Ha^Na)^Ha&Na|0)|0;Ua=D;Sa=_q(Ia|0,_a|0,p|0,q|0)|0;bb=D;_a=_q(Za|0,Ua|0,Ia|0,_a|0)|0;Ia=D;Ua=gr(Sa|0,bb|0,14)|0;Za=D;Pa=mr(Sa|0,bb|0,50)|0;Za=D|Za;Ta=gr(Sa|0,bb|0,18)|0;Va=D;Ga=mr(Sa|0,bb|0,46)|0;Va=Za^(D|Va);Za=gr(Sa|0,bb|0,41)|0;Xa=D;Da=mr(Sa|0,bb|0,23)|0;Xa=Va^(D|Xa);Va=72+((Z|4)<<3)|0;Va=_q(c[Va>>2]|0,c[Va+4>>2]|0,H|0,I|0)|0;ab=_q(Va|0,D|0,Ra|0,ab|0)|0;ab=_q(ab|0,D|0,La&~Sa^Sa&Wa|0,Fa&~bb^bb&cb|0)|0;Xa=_q(ab|0,D|0,(Pa|Ua)^(Ga|Ta)^(Da|Za)|0,Xa|0)|0;Za=D;Da=gr(y|0,z|0,19)|0;Ta=D;Ga=mr(y|0,z|0,45)|0;Ta=D|Ta;Ua=gr(y|0,z|0,61)|0;Pa=D;ab=mr(y|0,z|0,3)|0;Pa=D|Pa;Ra=gr(y|0,z|0,6)|0;Ta=Pa^D^Ta;Pa=gr(L|0,M|0,1)|0;Va=D;Ca=mr(L|0,M|0,63)|0;Va=D|Va;Ka=gr(L|0,M|0,8)|0;Ja=D;Ma=mr(L|0,M|0,56)|0;Ja=D|Ja;Oa=gr(L|0,M|0,7)|0;Va=Ja^D^Va;Ja=_q(H|0,I|0,N|0,O|0)|0;Va=_q(Ja|0,D|0,(Ma|Ka)^Oa^(Ca|Pa)|0,Va|0)|0;H=_q(Va|0,D|0,(ab|Ua)^Ra^(Ga|Da)|0,Ta|0)|0;I=D;Ta=gr(_a|0,Ia|0,28)|0;Da=D;Ga=mr(_a|0,Ia|0,36)|0;Da=D|Da;Ra=gr(_a|0,Ia|0,34)|0;Ua=D;ab=mr(_a|0,Ia|0,30)|0;Ua=Da^(D|Ua);Da=gr(_a|0,Ia|0,39)|0;Va=D;Pa=mr(_a|0,Ia|0,25)|0;Va=_q((Ga|Ta)^(ab|Ra)^(Pa|Da)|0,Ua^(D|Va)|0,_a&(Ea^Ya)^Ea&Ya|0,Ia&(Qa^Ha)^Qa&Ha|0)|0;Ua=D;Na=_q(Xa|0,Za|0,$a|0,Na|0)|0;$a=D;Za=_q(Va|0,Ua|0,Xa|0,Za|0)|0;Xa=D;Ua=gr(Na|0,$a|0,14)|0;Va=D;Da=mr(Na|0,$a|0,50)|0;Va=D|Va;Pa=gr(Na|0,$a|0,18)|0;Ra=D;ab=mr(Na|0,$a|0,46)|0;Ra=Va^(D|Ra);Va=gr(Na|0,$a|0,41)|0;Ta=D;Ga=mr(Na|0,$a|0,23)|0;Ta=Ra^(D|Ta);Ra=72+((Z|5)<<3)|0;Ra=_q(c[Ra>>2]|0,c[Ra+4>>2]|0,L|0,M|0)|0;Fa=_q(Ra|0,D|0,La|0,Fa|0)|0;Fa=_q(Fa|0,D|0,Wa&~Na^Na&Sa|0,cb&~$a^$a&bb|0)|0;Ta=_q(Fa|0,D|0,(Da|Ua)^(ab|Pa)^(Ga|Va)|0,Ta|0)|0;Va=D;Ga=gr(C|0,E|0,19)|0;Pa=D;ab=mr(C|0,E|0,45)|0;Pa=D|Pa;Ua=gr(C|0,E|0,61)|0;Da=D;Fa=mr(C|0,E|0,3)|0;Da=D|Da;La=gr(C|0,E|0,6)|0;Pa=Da^D^Pa;Da=gr(P|0,Q|0,1)|0;Ra=D;Ca=mr(P|0,Q|0,63)|0;Ra=D|Ra;Oa=gr(P|0,Q|0,8)|0;Ka=D;Ma=mr(P|0,Q|0,56)|0;Ka=D|Ka;Ja=gr(P|0,Q|0,7)|0;Ra=_q((Ma|Oa)^Ja^(Ca|Da)|0,Ka^D^Ra|0,L|0,M|0)|0;Ra=_q(Ra|0,D|0,T|0,U|0)|0;L=_q(Ra|0,D|0,(Fa|Ua)^La^(ab|Ga)|0,Pa|0)|0;M=D;Pa=gr(Za|0,Xa|0,28)|0;Ga=D;ab=mr(Za|0,Xa|0,36)|0;Ga=D|Ga;La=gr(Za|0,Xa|0,34)|0;Ua=D;Fa=mr(Za|0,Xa|0,30)|0;Ua=Ga^(D|Ua);Ga=gr(Za|0,Xa|0,39)|0;Ra=D;Ka=mr(Za|0,Xa|0,25)|0;Ra=_q((ab|Pa)^(Fa|La)^(Ka|Ga)|0,Ua^(D|Ra)|0,Za&(_a^Ea)^_a&Ea|0,Xa&(Ia^Qa)^Ia&Qa|0)|0;Ua=D;Ha=_q(Ta|0,Va|0,Ya|0,Ha|0)|0;Ya=D;Va=_q(Ra|0,Ua|0,Ta|0,Va|0)|0;Ta=D;Ua=gr(Ha|0,Ya|0,14)|0;Ra=D;Ga=mr(Ha|0,Ya|0,50)|0;Ra=D|Ra;Ka=gr(Ha|0,Ya|0,18)|0;La=D;Fa=mr(Ha|0,Ya|0,46)|0;La=Ra^(D|La);Ra=gr(Ha|0,Ya|0,41)|0;Pa=D;ab=mr(Ha|0,Ya|0,23)|0;Pa=La^(D|Pa);La=72+((Z|6)<<3)|0;La=_q(c[La>>2]|0,c[La+4>>2]|0,P|0,Q|0)|0;cb=_q(La|0,D|0,Wa|0,cb|0)|0;cb=_q(cb|0,D|0,Sa&~Ha^Ha&Na|0,bb&~Ya^Ya&$a|0)|0;Pa=_q(cb|0,D|0,(Ga|Ua)^(Fa|Ka)^(ab|Ra)|0,Pa|0)|0;Ra=D;ab=gr(H|0,I|0,19)|0;Ka=D;Fa=mr(H|0,I|0,45)|0;Ka=D|Ka;Ua=gr(H|0,I|0,61)|0;Ga=D;cb=mr(H|0,I|0,3)|0;Ga=D|Ga;Wa=gr(H|0,I|0,6)|0;Ka=Ga^D^Ka;Ga=gr(_|0,aa|0,1)|0;La=D;Da=mr(_|0,aa|0,63)|0;La=D|La;Ca=gr(_|0,aa|0,8)|0;Ja=D;Oa=mr(_|0,aa|0,56)|0;Ja=D|Ja;Ma=gr(_|0,aa|0,7)|0;La=_q((Oa|Ca)^Ma^(Da|Ga)|0,Ja^D^La|0,P|0,Q|0)|0;La=_q(La|0,D|0,a|0,x|0)|0;P=_q(La|0,D|0,(cb|Ua)^Wa^(Fa|ab)|0,Ka|0)|0;Q=D;Ka=gr(Va|0,Ta|0,28)|0;ab=D;Fa=mr(Va|0,Ta|0,36)|0;ab=D|ab;Wa=gr(Va|0,Ta|0,34)|0;Ua=D;cb=mr(Va|0,Ta|0,30)|0;Ua=ab^(D|Ua);ab=gr(Va|0,Ta|0,39)|0;La=D;Ja=mr(Va|0,Ta|0,25)|0;La=_q((Fa|Ka)^(cb|Wa)^(Ja|ab)|0,Ua^(D|La)|0,Va&(Za^_a)^Za&_a|0,Ta&(Xa^Ia)^Xa&Ia|0)|0;Ua=D;Qa=_q(Pa|0,Ra|0,Ea|0,Qa|0)|0;Ea=D;Ra=_q(La|0,Ua|0,Pa|0,Ra|0)|0;Pa=D;Ua=gr(Qa|0,Ea|0,14)|0;La=D;ab=mr(Qa|0,Ea|0,50)|0;La=D|La;Ja=gr(Qa|0,Ea|0,18)|0;Wa=D;cb=mr(Qa|0,Ea|0,46)|0;Wa=La^(D|Wa);La=gr(Qa|0,Ea|0,41)|0;Ka=D;Fa=mr(Qa|0,Ea|0,23)|0;Ka=Wa^(D|Ka);Wa=72+((Z|7)<<3)|0;Wa=_q(c[Wa>>2]|0,c[Wa+4>>2]|0,_|0,aa|0)|0;bb=_q(Wa|0,D|0,Sa|0,bb|0)|0;bb=_q(bb|0,D|0,Na&~Qa^Qa&Ha|0,$a&~Ea^Ea&Ya|0)|0;Ka=_q(bb|0,D|0,(ab|Ua)^(cb|Ja)^(Fa|La)|0,Ka|0)|0;La=D;Fa=gr(L|0,M|0,19)|0;Ja=D;cb=mr(L|0,M|0,45)|0;Ja=D|Ja;Ua=gr(L|0,M|0,61)|0;ab=D;bb=mr(L|0,M|0,3)|0;ab=D|ab;Sa=gr(L|0,M|0,6)|0;Ja=ab^D^Ja;ab=gr(ba|0,ca|0,1)|0;Wa=D;Ga=mr(ba|0,ca|0,63)|0;Wa=D|Wa;Da=gr(ba|0,ca|0,8)|0;Ma=D;Ca=mr(ba|0,ca|0,56)|0;Ma=D|Ma;Oa=gr(ba|0,ca|0,7)|0;Wa=_q((Ca|Da)^Oa^(Ga|ab)|0,Ma^D^Wa|0,_|0,aa|0)|0;Wa=_q(Wa|0,D|0,R|0,S|0)|0;_=_q(Wa|0,D|0,(bb|Ua)^Sa^(cb|Fa)|0,Ja|0)|0;aa=D;Ja=gr(Ra|0,Pa|0,28)|0;Fa=D;cb=mr(Ra|0,Pa|0,36)|0;Fa=D|Fa;Sa=gr(Ra|0,Pa|0,34)|0;Ua=D;bb=mr(Ra|0,Pa|0,30)|0;Ua=Fa^(D|Ua);Fa=gr(Ra|0,Pa|0,39)|0;Wa=D;Ma=mr(Ra|0,Pa|0,25)|0;Wa=_q((cb|Ja)^(bb|Sa)^(Ma|Fa)|0,Ua^(D|Wa)|0,Ra&(Va^Za)^Va&Za|0,Pa&(Ta^Xa)^Ta&Xa|0)|0;Ua=D;Ia=_q(Ka|0,La|0,_a|0,Ia|0)|0;_a=D;La=_q(Wa|0,Ua|0,Ka|0,La|0)|0;Ka=D;Ua=gr(Ia|0,_a|0,14)|0;Wa=D;Fa=mr(Ia|0,_a|0,50)|0;Wa=D|Wa;Ma=gr(Ia|0,_a|0,18)|0;Sa=D;bb=mr(Ia|0,_a|0,46)|0;Sa=Wa^(D|Sa);Wa=gr(Ia|0,_a|0,41)|0;Ja=D;cb=mr(Ia|0,_a|0,23)|0;Ja=Sa^(D|Ja);Sa=72+((Z|8)<<3)|0;Sa=_q(c[Sa>>2]|0,c[Sa+4>>2]|0,ba|0,ca|0)|0;$a=_q(Sa|0,D|0,Na|0,$a|0)|0;$a=_q($a|0,D|0,Ha&~Ia^Ia&Qa|0,Ya&~_a^_a&Ea|0)|0;Ja=_q($a|0,D|0,(Fa|Ua)^(bb|Ma)^(cb|Wa)|0,Ja|0)|0;Wa=D;cb=gr(P|0,Q|0,19)|0;Ma=D;bb=mr(P|0,Q|0,45)|0;Ma=D|Ma;Ua=gr(P|0,Q|0,61)|0;Fa=D;$a=mr(P|0,Q|0,3)|0;Fa=D|Fa;Na=gr(P|0,Q|0,6)|0;Ma=Fa^D^Ma;Fa=gr(X|0,Y|0,1)|0;Sa=D;ab=mr(X|0,Y|0,63)|0;Sa=D|Sa;Ga=gr(X|0,Y|0,8)|0;Oa=D;Da=mr(X|0,Y|0,56)|0;Oa=D|Oa;Ca=gr(X|0,Y|0,7)|0;Sa=Oa^D^Sa;Oa=_q(V|0,W|0,ba|0,ca|0)|0;Sa=_q(Oa|0,D|0,(Da|Ga)^Ca^(ab|Fa)|0,Sa|0)|0;ba=_q(Sa|0,D|0,($a|Ua)^Na^(bb|cb)|0,Ma|0)|0;ca=D;Ma=gr(La|0,Ka|0,28)|0;cb=D;bb=mr(La|0,Ka|0,36)|0;cb=D|cb;Na=gr(La|0,Ka|0,34)|0;Ua=D;$a=mr(La|0,Ka|0,30)|0;Ua=cb^(D|Ua);cb=gr(La|0,Ka|0,39)|0;Sa=D;Fa=mr(La|0,Ka|0,25)|0;Sa=_q((bb|Ma)^($a|Na)^(Fa|cb)|0,Ua^(D|Sa)|0,La&(Ra^Va)^Ra&Va|0,Ka&(Pa^Ta)^Pa&Ta|0)|0;Ua=D;Xa=_q(Ja|0,Wa|0,Za|0,Xa|0)|0;Za=D;Wa=_q(Sa|0,Ua|0,Ja|0,Wa|0)|0;Ja=D;Ua=gr(Xa|0,Za|0,14)|0;Sa=D;cb=mr(Xa|0,Za|0,50)|0;Sa=D|Sa;Fa=gr(Xa|0,Za|0,18)|0;Na=D;$a=mr(Xa|0,Za|0,46)|0;Na=Sa^(D|Na);Sa=gr(Xa|0,Za|0,41)|0;Ma=D;bb=mr(Xa|0,Za|0,23)|0;Ma=Na^(D|Ma);Na=72+((Z|9)<<3)|0;Na=_q(c[Na>>2]|0,c[Na+4>>2]|0,X|0,Y|0)|0;Ya=_q(Na|0,D|0,Ha|0,Ya|0)|0;Ya=_q(Ya|0,D|0,Qa&~Xa^Xa&Ia|0,Ea&~Za^Za&_a|0)|0;Ma=_q(Ya|0,D|0,(cb|Ua)^($a|Fa)^(bb|Sa)|0,Ma|0)|0;Sa=D;bb=gr(_|0,aa|0,19)|0;Fa=D;$a=mr(_|0,aa|0,45)|0;Fa=D|Fa;Ua=gr(_|0,aa|0,61)|0;cb=D;Ya=mr(_|0,aa|0,3)|0;cb=D|cb;Ha=gr(_|0,aa|0,6)|0;Fa=cb^D^Fa;cb=gr(A|0,B|0,1)|0;Na=D;ab=mr(A|0,B|0,63)|0;Na=D|Na;Ca=gr(A|0,B|0,8)|0;Ga=D;Da=mr(A|0,B|0,56)|0;Ga=D|Ga;Oa=gr(A|0,B|0,7)|0;Na=_q((Da|Ca)^Oa^(ab|cb)|0,Ga^D^Na|0,X|0,Y|0)|0;Na=_q(Na|0,D|0,y|0,z|0)|0;X=_q(Na|0,D|0,(Ya|Ua)^Ha^($a|bb)|0,Fa|0)|0;Y=D;Fa=gr(Wa|0,Ja|0,28)|0;bb=D;$a=mr(Wa|0,Ja|0,36)|0;bb=D|bb;Ha=gr(Wa|0,Ja|0,34)|0;Ua=D;Ya=mr(Wa|0,Ja|0,30)|0;Ua=bb^(D|Ua);bb=gr(Wa|0,Ja|0,39)|0;Na=D;Ga=mr(Wa|0,Ja|0,25)|0;Na=_q(($a|Fa)^(Ya|Ha)^(Ga|bb)|0,Ua^(D|Na)|0,Wa&(La^Ra)^La&Ra|0,Ja&(Ka^Pa)^Ka&Pa|0)|0;Ua=D;Ta=_q(Ma|0,Sa|0,Va|0,Ta|0)|0;Va=D;Sa=_q(Na|0,Ua|0,Ma|0,Sa|0)|0;Ma=D;Ua=gr(Ta|0,Va|0,14)|0;Na=D;bb=mr(Ta|0,Va|0,50)|0;Na=D|Na;Ga=gr(Ta|0,Va|0,18)|0;Ha=D;Ya=mr(Ta|0,Va|0,46)|0;Ha=Na^(D|Ha);Na=gr(Ta|0,Va|0,41)|0;Fa=D;$a=mr(Ta|0,Va|0,23)|0;Fa=Ha^(D|Fa);Ha=72+((Z|10)<<3)|0;Ha=_q(c[Ha>>2]|0,c[Ha+4>>2]|0,A|0,B|0)|0;Ea=_q(Ha|0,D|0,Qa|0,Ea|0)|0;Ea=_q(Ea|0,D|0,Ia&~Ta^Ta&Xa|0,_a&~Va^Va&Za|0)|0;Fa=_q(Ea|0,D|0,(bb|Ua)^(Ya|Ga)^($a|Na)|0,Fa|0)|0;Na=D;$a=gr(ba|0,ca|0,19)|0;Ga=D;Ya=mr(ba|0,ca|0,45)|0;Ga=D|Ga;Ua=gr(ba|0,ca|0,61)|0;bb=D;Ea=mr(ba|0,ca|0,3)|0;bb=D|bb;Qa=gr(ba|0,ca|0,6)|0;Ga=bb^D^Ga;bb=gr(F|0,G|0,1)|0;Ha=D;cb=mr(F|0,G|0,63)|0;Ha=D|Ha;ab=gr(F|0,G|0,8)|0;Oa=D;Ca=mr(F|0,G|0,56)|0;Oa=D|Oa;Da=gr(F|0,G|0,7)|0;Ha=_q((Ca|ab)^Da^(cb|bb)|0,Oa^D^Ha|0,A|0,B|0)|0;Ha=_q(Ha|0,D|0,C|0,E|0)|0;A=_q(Ha|0,D|0,(Ea|Ua)^Qa^(Ya|$a)|0,Ga|0)|0;B=D;Ga=gr(Sa|0,Ma|0,28)|0;$a=D;Ya=mr(Sa|0,Ma|0,36)|0;$a=D|$a;Qa=gr(Sa|0,Ma|0,34)|0;Ua=D;Ea=mr(Sa|0,Ma|0,30)|0;Ua=$a^(D|Ua);$a=gr(Sa|0,Ma|0,39)|0;Ha=D;Oa=mr(Sa|0,Ma|0,25)|0;Ha=_q((Ya|Ga)^(Ea|Qa)^(Oa|$a)|0,Ua^(D|Ha)|0,Sa&(Wa^La)^Wa&La|0,Ma&(Ja^Ka)^Ja&Ka|0)|0;Ua=D;Pa=_q(Fa|0,Na|0,Ra|0,Pa|0)|0;Ra=D;Na=_q(Ha|0,Ua|0,Fa|0,Na|0)|0;Fa=D;Ua=gr(Pa|0,Ra|0,14)|0;Ha=D;$a=mr(Pa|0,Ra|0,50)|0;Ha=D|Ha;Oa=gr(Pa|0,Ra|0,18)|0;Qa=D;Ea=mr(Pa|0,Ra|0,46)|0;Qa=Ha^(D|Qa);Ha=gr(Pa|0,Ra|0,41)|0;Ga=D;Ya=mr(Pa|0,Ra|0,23)|0;Ga=Qa^(D|Ga);Qa=72+((Z|11)<<3)|0;Qa=_q(c[Qa>>2]|0,c[Qa+4>>2]|0,F|0,G|0)|0;_a=_q(Qa|0,D|0,Ia|0,_a|0)|0;_a=_q(_a|0,D|0,Xa&~Pa^Pa&Ta|0,Za&~Ra^Ra&Va|0)|0;Ga=_q(_a|0,D|0,($a|Ua)^(Ea|Oa)^(Ya|Ha)|0,Ga|0)|0;Ha=D;Ya=gr(X|0,Y|0,19)|0;Oa=D;Ea=mr(X|0,Y|0,45)|0;Oa=D|Oa;Ua=gr(X|0,Y|0,61)|0;$a=D;_a=mr(X|0,Y|0,3)|0;$a=D|$a;Ia=gr(X|0,Y|0,6)|0;Oa=$a^D^Oa;$a=gr(J|0,K|0,1)|0;Qa=D;bb=mr(J|0,K|0,63)|0;Qa=D|Qa;cb=gr(J|0,K|0,8)|0;Da=D;ab=mr(J|0,K|0,56)|0;Da=D|Da;Ca=gr(J|0,K|0,7)|0;Qa=_q((ab|cb)^Ca^(bb|$a)|0,Da^D^Qa|0,F|0,G|0)|0;Qa=_q(Qa|0,D|0,H|0,I|0)|0;F=_q(Qa|0,D|0,(_a|Ua)^Ia^(Ea|Ya)|0,Oa|0)|0;G=D;Oa=gr(Na|0,Fa|0,28)|0;Ya=D;Ea=mr(Na|0,Fa|0,36)|0;Ya=D|Ya;Ia=gr(Na|0,Fa|0,34)|0;Ua=D;_a=mr(Na|0,Fa|0,30)|0;Ua=Ya^(D|Ua);Ya=gr(Na|0,Fa|0,39)|0;Qa=D;Da=mr(Na|0,Fa|0,25)|0;Qa=_q((Ea|Oa)^(_a|Ia)^(Da|Ya)|0,Ua^(D|Qa)|0,Na&(Sa^Wa)^Sa&Wa|0,Fa&(Ma^Ja)^Ma&Ja|0)|0;Ua=D;Ka=_q(Ga|0,Ha|0,La|0,Ka|0)|0;La=D;Ha=_q(Qa|0,Ua|0,Ga|0,Ha|0)|0;Ga=D;Ua=gr(Ka|0,La|0,14)|0;Qa=D;Ya=mr(Ka|0,La|0,50)|0;Qa=D|Qa;Da=gr(Ka|0,La|0,18)|0;Ia=D;_a=mr(Ka|0,La|0,46)|0;Ia=Qa^(D|Ia);Qa=gr(Ka|0,La|0,41)|0;Oa=D;Ea=mr(Ka|0,La|0,23)|0;Oa=Ia^(D|Oa);Ia=72+((Z|12)<<3)|0;Ia=_q(c[Ia>>2]|0,c[Ia+4>>2]|0,J|0,K|0)|0;Za=_q(Ia|0,D|0,Xa|0,Za|0)|0;Za=_q(Za|0,D|0,Ta&~Ka^Ka&Pa|0,Va&~La^La&Ra|0)|0;Oa=_q(Za|0,D|0,(Ya|Ua)^(_a|Da)^(Ea|Qa)|0,Oa|0)|0;Qa=D;Ea=gr(A|0,B|0,19)|0;Da=D;_a=mr(A|0,B|0,45)|0;Da=D|Da;Ua=gr(A|0,B|0,61)|0;Ya=D;Za=mr(A|0,B|0,3)|0;Ya=D|Ya;Xa=gr(A|0,B|0,6)|0;Da=Ya^D^Da;Ya=gr(N|0,O|0,1)|0;Ia=D;$a=mr(N|0,O|0,63)|0;Ia=D|Ia;bb=gr(N|0,O|0,8)|0;Ca=D;cb=mr(N|0,O|0,56)|0;Ca=D|Ca;ab=gr(N|0,O|0,7)|0;Ia=_q((cb|bb)^ab^($a|Ya)|0,Ca^D^Ia|0,J|0,K|0)|0;Ia=_q(Ia|0,D|0,L|0,M|0)|0;J=_q(Ia|0,D|0,(Za|Ua)^Xa^(_a|Ea)|0,Da|0)|0;K=D;Da=gr(Ha|0,Ga|0,28)|0;Ea=D;_a=mr(Ha|0,Ga|0,36)|0;Ea=D|Ea;Xa=gr(Ha|0,Ga|0,34)|0;Ua=D;Za=mr(Ha|0,Ga|0,30)|0;Ua=Ea^(D|Ua);Ea=gr(Ha|0,Ga|0,39)|0;Ia=D;Ca=mr(Ha|0,Ga|0,25)|0;Ia=_q((_a|Da)^(Za|Xa)^(Ca|Ea)|0,Ua^(D|Ia)|0,Ha&(Na^Sa)^Na&Sa|0,Ga&(Fa^Ma)^Fa&Ma|0)|0;Ua=D;n=_q(Oa|0,Qa|0,Wa|0,Ja|0)|0;o=D;v=_q(Ia|0,Ua|0,Oa|0,Qa|0)|0;w=D;Qa=gr(n|0,o|0,14)|0;Oa=D;Ua=mr(n|0,o|0,50)|0;Oa=D|Oa;Ia=gr(n|0,o|0,18)|0;Ja=D;Wa=mr(n|0,o|0,46)|0;Ja=Oa^(D|Ja);Oa=gr(n|0,o|0,41)|0;Ea=D;Ca=mr(n|0,o|0,23)|0;Ea=Ja^(D|Ea);Ja=72+((Z|13)<<3)|0;Ja=_q(c[Ja>>2]|0,c[Ja+4>>2]|0,N|0,O|0)|0;Va=_q(Ja|0,D|0,Ta|0,Va|0)|0;Va=_q(Va|0,D|0,Pa&~n^n&Ka|0,Ra&~o^o&La|0)|0;Ea=_q(Va|0,D|0,(Ua|Qa)^(Wa|Ia)^(Ca|Oa)|0,Ea|0)|0;Oa=D;Ca=gr(F|0,G|0,19)|0;Ia=D;Wa=mr(F|0,G|0,45)|0;Ia=D|Ia;Qa=gr(F|0,G|0,61)|0;Ua=D;Va=mr(F|0,G|0,3)|0;Ua=D|Ua;Ta=gr(F|0,G|0,6)|0;Ia=Ua^D^Ia;Ua=gr(T|0,U|0,1)|0;Ja=D;Xa=mr(T|0,U|0,63)|0;Ja=D|Ja;Za=gr(T|0,U|0,8)|0;Da=D;_a=mr(T|0,U|0,56)|0;Da=D|Da;Ya=gr(T|0,U|0,7)|0;Ja=_q((_a|Za)^Ya^(Xa|Ua)|0,Da^D^Ja|0,N|0,O|0)|0;Ja=_q(Ja|0,D|0,P|0,Q|0)|0;N=_q(Ja|0,D|0,(Va|Qa)^Ta^(Wa|Ca)|0,Ia|0)|0;O=D;Ia=gr(v|0,w|0,28)|0;Ca=D;Wa=mr(v|0,w|0,36)|0;Ca=D|Ca;Ta=gr(v|0,w|0,34)|0;Qa=D;Va=mr(v|0,w|0,30)|0;Qa=Ca^(D|Qa);Ca=gr(v|0,w|0,39)|0;Ja=D;Da=mr(v|0,w|0,25)|0;Ja=_q((Wa|Ia)^(Va|Ta)^(Da|Ca)|0,Qa^(D|Ja)|0,v&(Ha^Na)^Ha&Na|0,w&(Ga^Fa)^Ga&Fa|0)|0;Qa=D;j=_q(Ea|0,Oa|0,Sa|0,Ma|0)|0;k=D;s=_q(Ja|0,Qa|0,Ea|0,Oa|0)|0;u=D;Oa=gr(j|0,k|0,14)|0;Ea=D;Qa=mr(j|0,k|0,50)|0;Ea=D|Ea;Ja=gr(j|0,k|0,18)|0;Ma=D;Sa=mr(j|0,k|0,46)|0;Ma=Ea^(D|Ma);Ea=gr(j|0,k|0,41)|0;Ca=D;Da=mr(j|0,k|0,23)|0;Ca=Ma^(D|Ca);Ma=72+((Z|14)<<3)|0;Ma=_q(c[Ma>>2]|0,c[Ma+4>>2]|0,T|0,U|0)|0;Ra=_q(Ma|0,D|0,Pa|0,Ra|0)|0;Ra=_q(Ra|0,D|0,Ka&~j^j&n|0,La&~k^k&o|0)|0;Ca=_q(Ra|0,D|0,(Qa|Oa)^(Sa|Ja)^(Da|Ea)|0,Ca|0)|0;Ea=D;Da=gr(J|0,K|0,19)|0;Ja=D;Sa=mr(J|0,K|0,45)|0;Ja=D|Ja;Oa=gr(J|0,K|0,61)|0;Qa=D;Ra=mr(J|0,K|0,3)|0;Qa=D|Qa;Pa=gr(J|0,K|0,6)|0;Ja=Qa^D^Ja;Qa=gr(a|0,x|0,1)|0;Ma=D;Ta=mr(a|0,x|0,63)|0;Ma=D|Ma;Va=gr(a|0,x|0,8)|0;Ia=D;Wa=mr(a|0,x|0,56)|0;Ia=D|Ia;Ua=gr(a|0,x|0,7)|0;Ma=_q((Wa|Va)^Ua^(Ta|Qa)|0,Ia^D^Ma|0,T|0,U|0)|0;Ma=_q(Ma|0,D|0,_|0,aa|0)|0;T=_q(Ma|0,D|0,(Ra|Oa)^Pa^(Sa|Da)|0,Ja|0)|0;U=D;Ja=gr(s|0,u|0,28)|0;Da=D;Sa=mr(s|0,u|0,36)|0;Da=D|Da;Pa=gr(s|0,u|0,34)|0;Oa=D;Ra=mr(s|0,u|0,30)|0;Oa=Da^(D|Oa);Da=gr(s|0,u|0,39)|0;Ma=D;Ia=mr(s|0,u|0,25)|0;Ma=_q((Sa|Ja)^(Ra|Pa)^(Ia|Da)|0,Oa^(D|Ma)|0,s&(v^Ha)^v&Ha|0,u&(w^Ga)^w&Ga|0)|0;Oa=D;h=_q(Ca|0,Ea|0,Na|0,Fa|0)|0;i=D;r=_q(Ma|0,Oa|0,Ca|0,Ea|0)|0;t=D;Ea=gr(h|0,i|0,14)|0;Ca=D;Oa=mr(h|0,i|0,50)|0;Ca=D|Ca;Ma=gr(h|0,i|0,18)|0;Fa=D;Na=mr(h|0,i|0,46)|0;Fa=Ca^(D|Fa);Ca=gr(h|0,i|0,41)|0;Da=D;Ia=mr(h|0,i|0,23)|0;Da=Fa^(D|Da);Fa=72+((Z|15)<<3)|0;Fa=_q(c[Fa>>2]|0,c[Fa+4>>2]|0,a|0,x|0)|0;La=_q(Fa|0,D|0,Ka|0,La|0)|0;La=_q(La|0,D|0,n&~h^h&j|0,o&~i^i&k|0)|0;Da=_q(La|0,D|0,(Oa|Ea)^(Na|Ma)^(Ia|Ca)|0,Da|0)|0;Ca=D;Ia=gr(N|0,O|0,19)|0;Ma=D;Na=mr(N|0,O|0,45)|0;Ma=D|Ma;Ea=gr(N|0,O|0,61)|0;Oa=D;La=mr(N|0,O|0,3)|0;Oa=D|Oa;Ka=gr(N|0,O|0,6)|0;Ma=Oa^D^Ma;Oa=gr(R|0,S|0,1)|0;Fa=D;Pa=mr(R|0,S|0,63)|0;Fa=D|Fa;Ra=gr(R|0,S|0,8)|0;Ja=D;Sa=mr(R|0,S|0,56)|0;Ja=D|Ja;Qa=gr(R|0,S|0,7)|0;Fa=_q((Sa|Ra)^Qa^(Pa|Oa)|0,Ja^D^Fa|0,a|0,x|0)|0;Fa=_q(Fa|0,D|0,ba|0,ca|0)|0;a=_q(Fa|0,D|0,(La|Ea)^Ka^(Na|Ia)|0,Ma|0)|0;x=D;Ma=gr(r|0,t|0,28)|0;Ia=D;Na=mr(r|0,t|0,36)|0;Ia=D|Ia;Ka=gr(r|0,t|0,34)|0;Ea=D;La=mr(r|0,t|0,30)|0;Ea=Ia^(D|Ea);Ia=gr(r|0,t|0,39)|0;Fa=D;Ja=mr(r|0,t|0,25)|0;Fa=_q((Na|Ma)^(La|Ka)^(Ja|Ia)|0,Ea^(D|Fa)|0,r&(s^v)^s&v|0,t&(u^w)^u&w|0)|0;Ea=D;f=_q(Da|0,Ca|0,Ha|0,Ga|0)|0;g=D;p=_q(Fa|0,Ea|0,Da|0,Ca|0)|0;q=D;Z=Z+16|0}while((Z|0)<64);Za=ua;c[Za>>2]=R;c[Za+4>>2]=S;Za=ea;c[Za>>2]=T;c[Za+4>>2]=U;Za=fa;c[Za>>2]=X;c[Za+4>>2]=Y;Za=ga;c[Za>>2]=V;c[Za+4>>2]=W;Za=ha;c[Za>>2]=a;c[Za+4>>2]=x;Za=ia;c[Za>>2]=A;c[Za+4>>2]=B;Za=ja;c[Za>>2]=y;c[Za+4>>2]=z;Za=ka;c[Za>>2]=F;c[Za+4>>2]=G;Za=la;c[Za>>2]=C;c[Za+4>>2]=E;Za=ma;c[Za>>2]=J;c[Za+4>>2]=K;Za=na;c[Za>>2]=H;c[Za+4>>2]=I;Za=oa;c[Za>>2]=N;c[Za+4>>2]=O;Za=pa;c[Za>>2]=L;c[Za+4>>2]=M;Za=qa;c[Za>>2]=P;c[Za+4>>2]=Q;Za=ra;c[Za>>2]=_;c[Za+4>>2]=aa;Za=sa;c[Za>>2]=ba;c[Za+4>>2]=ca;Za=gr(f|0,g|0,14)|0;$a=D;_a=mr(f|0,g|0,50)|0;$a=D|$a;Xa=gr(f|0,g|0,18)|0;bb=D;ab=mr(f|0,g|0,46)|0;bb=$a^(D|bb);$a=gr(f|0,g|0,41)|0;cb=D;Ya=mr(f|0,g|0,23)|0;cb=bb^(D|cb);bb=_q(R|0,S|0,-366583396,-903397682)|0;n=_q(bb|0,D|0,n|0,o|0)|0;n=_q(n|0,D|0,j&~f^f&h|0,k&~g^g&i|0)|0;cb=_q(n|0,D|0,(_a|Za)^(ab|Xa)^(Ya|$a)|0,cb|0)|0;$a=D;n=gr(p|0,q|0,28)|0;Ya=D;Xa=mr(p|0,q|0,36)|0;Ya=D|Ya;ab=gr(p|0,q|0,34)|0;Za=D;o=mr(p|0,q|0,30)|0;Za=Ya^(D|Za);Ya=gr(p|0,q|0,39)|0;_a=D;bb=mr(p|0,q|0,25)|0;_a=_q((Xa|n)^(o|ab)^(bb|Ya)|0,Za^(D|_a)|0,p&(r^s)^r&s|0,q&(t^u)^t&u|0)|0;Za=D;Ya=_q(cb|0,$a|0,v|0,w|0)|0;bb=D;$a=_q(_a|0,Za|0,cb|0,$a|0)|0;cb=D;Za=gr(Ya|0,bb|0,14)|0;_a=D;ab=mr(Ya|0,bb|0,50)|0;_a=D|_a;w=gr(Ya|0,bb|0,18)|0;o=D;n=mr(Ya|0,bb|0,46)|0;o=_a^(D|o);_a=gr(Ya|0,bb|0,41)|0;v=D;Xa=mr(Ya|0,bb|0,23)|0;v=o^(D|v);o=_q(V|0,W|0,566280711,-779700025)|0;k=_q(o|0,D|0,j|0,k|0)|0;k=_q(k|0,D|0,h&~Ya^Ya&f|0,i&~bb^bb&g|0)|0;v=_q(k|0,D|0,(ab|Za)^(n|w)^(Xa|_a)|0,v|0)|0;_a=D;k=gr($a|0,cb|0,28)|0;Xa=D;w=mr($a|0,cb|0,36)|0;Xa=D|Xa;j=gr($a|0,cb|0,34)|0;n=D;Za=mr($a|0,cb|0,30)|0;n=Xa^(D|n);Xa=gr($a|0,cb|0,39)|0;ab=D;o=mr($a|0,cb|0,25)|0;ab=_q((w|k)^(Za|j)^(o|Xa)|0,n^(D|ab)|0,$a&(p^r)^p&r|0,cb&(q^t)^q&t|0)|0;n=D;Xa=_q(v|0,_a|0,s|0,u|0)|0;o=D;_a=_q(ab|0,n|0,v|0,_a|0)|0;v=D;n=gr(Xa|0,o|0,14)|0;ab=D;j=mr(Xa|0,o|0,50)|0;ab=D|ab;Za=gr(Xa|0,o|0,18)|0;k=D;u=mr(Xa|0,o|0,46)|0;k=ab^(D|k);ab=gr(Xa|0,o|0,41)|0;s=D;w=mr(Xa|0,o|0,23)|0;s=k^(D|s);k=_q(y|0,z|0,-840897762,-354779690)|0;i=_q(k|0,D|0,h|0,i|0)|0;i=_q(i|0,D|0,f&~Xa^Xa&Ya|0,g&~o^o&bb|0)|0;s=_q(i|0,D|0,(j|n)^(u|Za)^(w|ab)|0,s|0)|0;ab=D;w=gr(_a|0,v|0,28)|0;Za=D;u=mr(_a|0,v|0,36)|0;Za=D|Za;n=gr(_a|0,v|0,34)|0;j=D;i=mr(_a|0,v|0,30)|0;j=Za^(D|j);Za=gr(_a|0,v|0,39)|0;h=D;k=mr(_a|0,v|0,25)|0;h=_q((u|w)^(i|n)^(k|Za)|0,j^(D|h)|0,_a&($a^p)^$a&p|0,v&(cb^q)^cb&q|0)|0;j=D;Za=_q(s|0,ab|0,r|0,t|0)|0;k=D;ab=_q(h|0,j|0,s|0,ab|0)|0;s=D;j=gr(Za|0,k|0,14)|0;r=D;h=mr(Za|0,k|0,50)|0;r=D|r;n=gr(Za|0,k|0,18)|0;i=D;t=mr(Za|0,k|0,46)|0;i=r^(D|i);r=gr(Za|0,k|0,41)|0;w=D;u=mr(Za|0,k|0,23)|0;w=i^(D|w);i=_q(C|0,E|0,-294727304,-176337025)|0;g=_q(i|0,D|0,f|0,g|0)|0;g=_q(g|0,D|0,Ya&~Za^Za&Xa|0,bb&~k^k&o|0)|0;w=_q(g|0,D|0,(h|j)^(t|n)^(u|r)|0,w|0)|0;r=D;u=gr(ab|0,s|0,28)|0;n=D;t=mr(ab|0,s|0,36)|0;n=D|n;j=gr(ab|0,s|0,34)|0;g=D;h=mr(ab|0,s|0,30)|0;g=n^(D|g);n=gr(ab|0,s|0,39)|0;f=D;i=mr(ab|0,s|0,25)|0;f=_q((t|u)^(h|j)^(i|n)|0,g^(D|f)|0,ab&(_a^$a)^_a&$a|0,s&(v^cb)^v&cb|0)|0;g=D;n=_q(w|0,r|0,p|0,q|0)|0;i=D;r=_q(f|0,g|0,w|0,r|0)|0;w=D;g=gr(n|0,i|0,14)|0;p=D;f=mr(n|0,i|0,50)|0;p=D|p;j=gr(n|0,i|0,18)|0;h=D;q=mr(n|0,i|0,46)|0;h=p^(D|h);p=gr(n|0,i|0,41)|0;u=D;t=mr(n|0,i|0,23)|0;u=h^(D|u);h=_q(H|0,I|0,1914138554,116418474)|0;bb=_q(h|0,D|0,Ya|0,bb|0)|0;bb=_q(bb|0,D|0,Xa&~n^n&Za|0,o&~i^i&k|0)|0;u=_q(bb|0,D|0,(f|g)^(q|j)^(t|p)|0,u|0)|0;p=D;t=gr(r|0,w|0,28)|0;j=D;q=mr(r|0,w|0,36)|0;j=D|j;g=gr(r|0,w|0,34)|0;f=D;bb=mr(r|0,w|0,30)|0;f=j^(D|f);j=gr(r|0,w|0,39)|0;Ya=D;h=mr(r|0,w|0,25)|0;Ya=_q((q|t)^(bb|g)^(h|j)|0,f^(D|Ya)|0,r&(ab^_a)^ab&_a|0,w&(s^v)^s&v|0)|0;f=D;j=_q(u|0,p|0,$a|0,cb|0)|0;cb=D;p=_q(Ya|0,f|0,u|0,p|0)|0;u=D;f=gr(j|0,cb|0,14)|0;Ya=D;$a=mr(j|0,cb|0,50)|0;Ya=D|Ya;h=gr(j|0,cb|0,18)|0;g=D;bb=mr(j|0,cb|0,46)|0;g=Ya^(D|g);Ya=gr(j|0,cb|0,41)|0;t=D;q=mr(j|0,cb|0,23)|0;t=g^(D|t);g=_q(L|0,M|0,-1563912026,174292421)|0;o=_q(g|0,D|0,Xa|0,o|0)|0;o=_q(o|0,D|0,Za&~j^j&n|0,k&~cb^cb&i|0)|0;t=_q(o|0,D|0,($a|f)^(bb|h)^(q|Ya)|0,t|0)|0;Ya=D;q=gr(p|0,u|0,28)|0;h=D;bb=mr(p|0,u|0,36)|0;h=D|h;f=gr(p|0,u|0,34)|0;$a=D;o=mr(p|0,u|0,30)|0;$a=h^(D|$a);h=gr(p|0,u|0,39)|0;Xa=D;g=mr(p|0,u|0,25)|0;Xa=_q((bb|q)^(o|f)^(g|h)|0,$a^(D|Xa)|0,p&(r^ab)^r&ab|0,u&(w^s)^w&s|0)|0;$a=D;h=_q(t|0,Ya|0,_a|0,v|0)|0;v=D;Ya=_q(Xa|0,$a|0,t|0,Ya|0)|0;t=D;$a=gr(h|0,v|0,14)|0;Xa=D;_a=mr(h|0,v|0,50)|0;Xa=D|Xa;g=gr(h|0,v|0,18)|0;f=D;o=mr(h|0,v|0,46)|0;f=Xa^(D|f);Xa=gr(h|0,v|0,41)|0;q=D;bb=mr(h|0,v|0,23)|0;q=f^(D|q);f=_q(P|0,Q|0,-1090974290,289380356)|0;k=_q(f|0,D|0,Za|0,k|0)|0;k=_q(k|0,D|0,n&~h^h&j|0,i&~v^v&cb|0)|0;q=_q(k|0,D|0,(_a|$a)^(o|g)^(bb|Xa)|0,q|0)|0;Xa=D;bb=gr(Ya|0,t|0,28)|0;g=D;o=mr(Ya|0,t|0,36)|0;g=D|g;$a=gr(Ya|0,t|0,34)|0;_a=D;k=mr(Ya|0,t|0,30)|0;_a=g^(D|_a);g=gr(Ya|0,t|0,39)|0;Za=D;f=mr(Ya|0,t|0,25)|0;Za=_q((o|bb)^(k|$a)^(f|g)|0,_a^(D|Za)|0,Ya&(p^r)^p&r|0,t&(u^w)^u&w|0)|0;_a=D;g=_q(q|0,Xa|0,ab|0,s|0)|0;s=D;Xa=_q(Za|0,_a|0,q|0,Xa|0)|0;q=D;_a=gr(g|0,s|0,14)|0;Za=D;f=mr(g|0,s|0,50)|0;Za=D|Za;ab=gr(g|0,s|0,18)|0;$a=D;k=mr(g|0,s|0,46)|0;$a=Za^(D|$a);Za=gr(g|0,s|0,41)|0;bb=D;o=mr(g|0,s|0,23)|0;bb=$a^(D|bb);$a=_q(_|0,aa|0,320620315,460393269)|0;i=_q($a|0,D|0,n|0,i|0)|0;i=_q(i|0,D|0,j&~g^g&h|0,cb&~s^s&v|0)|0;bb=_q(i|0,D|0,(f|_a)^(k|ab)^(o|Za)|0,bb|0)|0;Za=D;o=gr(Xa|0,q|0,28)|0;ab=D;k=mr(Xa|0,q|0,36)|0;ab=D|ab;_a=gr(Xa|0,q|0,34)|0;f=D;i=mr(Xa|0,q|0,30)|0;f=ab^(D|f);ab=gr(Xa|0,q|0,39)|0;n=D;$a=mr(Xa|0,q|0,25)|0;n=_q((k|o)^(i|_a)^($a|ab)|0,f^(D|n)|0,Xa&(Ya^p)^Ya&p|0,q&(t^u)^t&u|0)|0;f=D;w=_q(bb|0,Za|0,r|0,w|0)|0;r=D;Za=_q(n|0,f|0,bb|0,Za|0)|0;bb=D;f=gr(w|0,r|0,14)|0;n=D;ab=mr(w|0,r|0,50)|0;n=D|n;$a=gr(w|0,r|0,18)|0;_a=D;i=mr(w|0,r|0,46)|0;_a=n^(D|_a);n=gr(w|0,r|0,41)|0;o=D;k=mr(w|0,r|0,23)|0;o=_a^(D|o);_a=_q(ba|0,ca|0,587496836,685471733)|0;cb=_q(_a|0,D|0,j|0,cb|0)|0;cb=_q(cb|0,D|0,h&~w^w&g|0,v&~r^r&s|0)|0;o=_q(cb|0,D|0,(ab|f)^(i|$a)^(k|n)|0,o|0)|0;n=D;k=gr(Za|0,bb|0,28)|0;$a=D;i=mr(Za|0,bb|0,36)|0;$a=D|$a;f=gr(Za|0,bb|0,34)|0;ab=D;cb=mr(Za|0,bb|0,30)|0;ab=$a^(D|ab);$a=gr(Za|0,bb|0,39)|0;j=D;_a=mr(Za|0,bb|0,25)|0;j=_q((i|k)^(cb|f)^(_a|$a)|0,ab^(D|j)|0,Za&(Xa^Ya)^Xa&Ya|0,bb&(q^t)^q&t|0)|0;ab=D;u=_q(o|0,n|0,p|0,u|0)|0;p=D;n=_q(j|0,ab|0,o|0,n|0)|0;o=D;ab=gr(u|0,p|0,14)|0;j=D;$a=mr(u|0,p|0,50)|0;j=D|j;_a=gr(u|0,p|0,18)|0;f=D;cb=mr(u|0,p|0,46)|0;f=j^(D|f);j=gr(u|0,p|0,41)|0;k=D;i=mr(u|0,p|0,23)|0;k=f^(D|k);f=_q(X|0,Y|0,1086792851,852142971)|0;v=_q(f|0,D|0,h|0,v|0)|0;v=_q(v|0,D|0,g&~u^u&w|0,s&~p^p&r|0)|0;k=_q(v|0,D|0,($a|ab)^(cb|_a)^(i|j)|0,k|0)|0;j=D;i=gr(n|0,o|0,28)|0;_a=D;cb=mr(n|0,o|0,36)|0;_a=D|_a;ab=gr(n|0,o|0,34)|0;$a=D;v=mr(n|0,o|0,30)|0;$a=_a^(D|$a);_a=gr(n|0,o|0,39)|0;h=D;f=mr(n|0,o|0,25)|0;h=_q((cb|i)^(v|ab)^(f|_a)|0,$a^(D|h)|0,n&(Za^Xa)^Za&Xa|0,o&(bb^q)^bb&q|0)|0;$a=D;t=_q(k|0,j|0,Ya|0,t|0)|0;Ya=D;j=_q(h|0,$a|0,k|0,j|0)|0;k=D;$a=gr(t|0,Ya|0,14)|0;h=D;_a=mr(t|0,Ya|0,50)|0;h=D|h;f=gr(t|0,Ya|0,18)|0;ab=D;v=mr(t|0,Ya|0,46)|0;ab=h^(D|ab);h=gr(t|0,Ya|0,41)|0;i=D;cb=mr(t|0,Ya|0,23)|0;i=ab^(D|i);ab=_q(A|0,B|0,365543100,1017036298)|0;s=_q(ab|0,D|0,g|0,s|0)|0;s=_q(s|0,D|0,w&~t^t&u|0,r&~Ya^Ya&p|0)|0;i=_q(s|0,D|0,(_a|$a)^(v|f)^(cb|h)|0,i|0)|0;h=D;cb=gr(j|0,k|0,28)|0;f=D;v=mr(j|0,k|0,36)|0;f=D|f;$a=gr(j|0,k|0,34)|0;_a=D;s=mr(j|0,k|0,30)|0;_a=f^(D|_a);f=gr(j|0,k|0,39)|0;g=D;ab=mr(j|0,k|0,25)|0;g=_q((v|cb)^(s|$a)^(ab|f)|0,_a^(D|g)|0,j&(n^Za)^n&Za|0,k&(o^bb)^o&bb|0)|0;_a=D;q=_q(i|0,h|0,Xa|0,q|0)|0;Xa=D;h=_q(g|0,_a|0,i|0,h|0)|0;i=D;_a=gr(q|0,Xa|0,14)|0;g=D;f=mr(q|0,Xa|0,50)|0;g=D|g;ab=gr(q|0,Xa|0,18)|0;$a=D;s=mr(q|0,Xa|0,46)|0;$a=g^(D|$a);g=gr(q|0,Xa|0,41)|0;cb=D;v=mr(q|0,Xa|0,23)|0;cb=$a^(D|cb);$a=_q(F|0,G|0,-1676669620,1126000580)|0;r=_q($a|0,D|0,w|0,r|0)|0;r=_q(r|0,D|0,u&~q^q&t|0,p&~Xa^Xa&Ya|0)|0;cb=_q(r|0,D|0,(f|_a)^(s|ab)^(v|g)|0,cb|0)|0;g=D;v=gr(h|0,i|0,28)|0;ab=D;s=mr(h|0,i|0,36)|0;ab=D|ab;_a=gr(h|0,i|0,34)|0;f=D;r=mr(h|0,i|0,30)|0;f=ab^(D|f);ab=gr(h|0,i|0,39)|0;w=D;$a=mr(h|0,i|0,25)|0;w=_q((s|v)^(r|_a)^($a|ab)|0,f^(D|w)|0,h&(j^n)^j&n|0,i&(k^o)^k&o|0)|0;f=D;bb=_q(cb|0,g|0,Za|0,bb|0)|0;Za=D;g=_q(w|0,f|0,cb|0,g|0)|0;cb=D;f=gr(bb|0,Za|0,14)|0;w=D;ab=mr(bb|0,Za|0,50)|0;w=D|w;$a=gr(bb|0,Za|0,18)|0;_a=D;r=mr(bb|0,Za|0,46)|0;_a=w^(D|_a);w=gr(bb|0,Za|0,41)|0;v=D;s=mr(bb|0,Za|0,23)|0;v=_a^(D|v);_a=_q(J|0,K|0,-885112138,1288033470)|0;p=_q(_a|0,D|0,u|0,p|0)|0;p=_q(p|0,D|0,t&~bb^bb&q|0,Ya&~Za^Za&Xa|0)|0;v=_q(p|0,D|0,(ab|f)^(r|$a)^(s|w)|0,v|0)|0;w=D;s=gr(g|0,cb|0,28)|0;$a=D;r=mr(g|0,cb|0,36)|0;$a=D|$a;f=gr(g|0,cb|0,34)|0;ab=D;p=mr(g|0,cb|0,30)|0;ab=$a^(D|ab);$a=gr(g|0,cb|0,39)|0;u=D;_a=mr(g|0,cb|0,25)|0;u=_q((r|s)^(p|f)^(_a|$a)|0,ab^(D|u)|0,g&(h^j)^h&j|0,cb&(i^k)^i&k|0)|0;ab=D;o=_q(v|0,w|0,n|0,o|0)|0;n=D;w=_q(u|0,ab|0,v|0,w|0)|0;v=D;ab=gr(o|0,n|0,14)|0;u=D;$a=mr(o|0,n|0,50)|0;u=D|u;_a=gr(o|0,n|0,18)|0;f=D;p=mr(o|0,n|0,46)|0;f=u^(D|f);u=gr(o|0,n|0,41)|0;s=D;r=mr(o|0,n|0,23)|0;s=f^(D|s);f=_q(N|0,O|0,-60457430,1501505948)|0;Ya=_q(f|0,D|0,t|0,Ya|0)|0;Ya=_q(Ya|0,D|0,q&~o^o&bb|0,Xa&~n^n&Za|0)|0;s=_q(Ya|0,D|0,($a|ab)^(p|_a)^(r|u)|0,s|0)|0;u=D;r=gr(w|0,v|0,28)|0;_a=D;p=mr(w|0,v|0,36)|0;_a=D|_a;ab=gr(w|0,v|0,34)|0;$a=D;Ya=mr(w|0,v|0,30)|0;$a=_a^(D|$a);_a=gr(w|0,v|0,39)|0;t=D;f=mr(w|0,v|0,25)|0;t=_q((p|r)^(Ya|ab)^(f|_a)|0,$a^(D|t)|0,w&(g^h)^g&h|0,v&(cb^i)^cb&i|0)|0;$a=D;k=_q(s|0,u|0,j|0,k|0)|0;j=D;u=_q(t|0,$a|0,s|0,u|0)|0;s=D;$a=gr(k|0,j|0,14)|0;t=D;_a=mr(k|0,j|0,50)|0;t=D|t;f=gr(k|0,j|0,18)|0;ab=D;Ya=mr(k|0,j|0,46)|0;ab=t^(D|ab);t=gr(k|0,j|0,41)|0;r=D;p=mr(k|0,j|0,23)|0;r=ab^(D|r);ab=_q(T|0,U|0,987167468,1607167915)|0;Xa=_q(ab|0,D|0,q|0,Xa|0)|0;Xa=_q(Xa|0,D|0,bb&~k^k&o|0,Za&~j^j&n|0)|0;r=_q(Xa|0,D|0,(_a|$a)^(Ya|f)^(p|t)|0,r|0)|0;t=D;p=gr(u|0,s|0,28)|0;f=D;Ya=mr(u|0,s|0,36)|0;f=D|f;$a=gr(u|0,s|0,34)|0;_a=D;Xa=mr(u|0,s|0,30)|0;_a=f^(D|_a);f=gr(u|0,s|0,39)|0;q=D;ab=mr(u|0,s|0,25)|0;q=_q((Ya|p)^(Xa|$a)^(ab|f)|0,_a^(D|q)|0,u&(w^g)^w&g|0,s&(v^cb)^v&cb|0)|0;_a=D;i=_q(r|0,t|0,h|0,i|0)|0;h=D;t=_q(q|0,_a|0,r|0,t|0)|0;r=D;_a=gr(i|0,h|0,14)|0;q=D;f=mr(i|0,h|0,50)|0;q=D|q;ab=gr(i|0,h|0,18)|0;$a=D;Xa=mr(i|0,h|0,46)|0;$a=q^(D|$a);q=gr(i|0,h|0,41)|0;p=D;Ya=mr(i|0,h|0,23)|0;p=$a^(D|p);$a=_q(a|0,x|0,1246189591,1816402316)|0;Za=_q($a|0,D|0,bb|0,Za|0)|0;Za=_q(Za|0,D|0,o&~i^i&k|0,n&~h^h&j|0)|0;p=_q(Za|0,D|0,(f|_a)^(Xa|ab)^(Ya|q)|0,p|0)|0;q=D;Ya=gr(t|0,r|0,28)|0;ab=D;Xa=mr(t|0,r|0,36)|0;ab=D|ab;_a=gr(t|0,r|0,34)|0;f=D;Za=mr(t|0,r|0,30)|0;f=ab^(D|f);ab=gr(t|0,r|0,39)|0;bb=D;$a=mr(t|0,r|0,25)|0;bb=_q((Xa|Ya)^(Za|_a)^($a|ab)|0,f^(D|bb)|0,t&(u^w)^u&w|0,r&(s^v)^s&v|0)|0;f=D;cb=_q(p|0,q|0,g|0,cb|0)|0;g=D;q=_q(bb|0,f|0,p|0,q|0)|0;p=va;p=_q(q|0,D|0,c[p>>2]|0,c[p+4>>2]|0)|0;q=D;f=va;c[f>>2]=p;c[f+4>>2]=q;f=wa;r=_q(c[f>>2]|0,c[f+4>>2]|0,t|0,r|0)|0;t=D;f=wa;c[f>>2]=r;c[f+4>>2]=t;f=xa;s=_q(c[f>>2]|0,c[f+4>>2]|0,u|0,s|0)|0;u=D;f=xa;c[f>>2]=s;c[f+4>>2]=u;f=ya;v=_q(c[f>>2]|0,c[f+4>>2]|0,w|0,v|0)|0;w=D;f=ya;c[f>>2]=v;c[f+4>>2]=w;f=za;f=_q(cb|0,g|0,c[f>>2]|0,c[f+4>>2]|0)|0;g=D;cb=za;c[cb>>2]=f;c[cb+4>>2]=g;cb=Aa;h=_q(c[cb>>2]|0,c[cb+4>>2]|0,i|0,h|0)|0;i=D;cb=Aa;c[cb>>2]=h;c[cb+4>>2]=i;cb=ta;j=_q(c[cb>>2]|0,c[cb+4>>2]|0,k|0,j|0)|0;k=D;cb=ta;c[cb>>2]=j;c[cb+4>>2]=k;cb=da;n=_q(c[cb>>2]|0,c[cb+4>>2]|0,o|0,n|0)|0;o=D;cb=da;c[cb>>2]=n;c[cb+4>>2]=o;e=e+-1|0;if(!e)break;else b=b+128|0}l=Ba;return 220}function gj(a,b){a=a|0;b=b|0;b=a+160|0;c[b>>2]=-1056596264;c[b+4>>2]=-876896931;b=a+168|0;c[b>>2]=914150663;c[b+4>>2]=1654270250;b=a+176|0;c[b>>2]=812702999;c[b+4>>2]=-1856437926;b=a+184|0;c[b>>2]=-150054599;c[b+4>>2]=355462360;b=a+192|0;c[b>>2]=-4191439;c[b+4>>2]=1731405415;b=a+200|0;c[b>>2]=1750603025;c[b+4>>2]=-1900787065;b=a+208|0;c[b>>2]=1694076839;c[b+4>>2]=-619958771;b=a+216|0;c[b>>2]=-1090891868;c[b+4>>2]=1203062813;b=a+128|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[a+148>>2]=128;c[a+152>>2]=34;return}function hj(a,b,c){a=a|0;b=b|0;c=c|0;c=kj(a,b,c)|0;Te(47);return c|0} +function ij(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;i=((d[f+2>>0]|0)<<16|(d[f+3>>0]|0)<<24|(d[f+1>>0]|0)<<8|(d[f>>0]|0))^c[b+4096>>2];g=((d[f+6>>0]|0)<<16|(d[f+7>>0]|0)<<24|(d[f+5>>0]|0)<<8|(d[f+4>>0]|0))^c[b+4100>>2];h=((d[f+14>>0]|0)<<16|(d[f+15>>0]|0)<<24|(d[f+13>>0]|0)<<8|(d[f+12>>0]|0))^c[b+4108>>2];k=c[b+2048+((g>>>8&255)<<2)>>2]^c[b+1024+((g&255)<<2)>>2]^c[b+3072+((g>>>16&255)<<2)>>2]^c[b+(g>>>24<<2)>>2];j=k+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;f=((d[f+10>>0]|0)<<16|(d[f+11>>0]|0)<<24|(d[f+9>>0]|0)<<8|(d[f+8>>0]|0))^c[b+4104>>2]^j+(c[b+4128>>2]|0);l=f>>>1;m=l|f<<31;h=k+(c[b+4132>>2]|0)+j^(h<<1|h>>>31);j=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];f=j+(c[b+1024+((f>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((f>>>17&255)<<2)>>2]^c[b+3072+(m>>>24<<2)>>2])|0;i=f+(c[b+4136>>2]|0)^i;l=i>>>1;k=l|i<<31;f=j+(c[b+4140>>2]|0)+f^(g<<1|g>>>31);g=c[b+2048+((f>>>8&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((f>>>16&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];i=g+(c[b+1024+((i>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((i>>>17&255)<<2)>>2]^c[b+3072+(k>>>24<<2)>>2])|0;m=i+(c[b+4144>>2]|0)^m;l=m>>>1;j=l|m<<31;h=g+(c[b+4148>>2]|0)+i^(h<<1|h>>>31);i=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];m=i+(c[b+1024+((m>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((m>>>17&255)<<2)>>2]^c[b+3072+(j>>>24<<2)>>2])|0;k=m+(c[b+4152>>2]|0)^k;l=k>>>1;g=l|k<<31;f=i+(c[b+4156>>2]|0)+m^(f<<1|f>>>31);m=c[b+2048+((f>>>8&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((f>>>16&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];k=m+(c[b+1024+((k>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((k>>>17&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;j=k+(c[b+4160>>2]|0)^j;l=j>>>1;i=l|j<<31;h=m+(c[b+4164>>2]|0)+k^(h<<1|h>>>31);k=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];j=k+(c[b+1024+((j>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((j>>>17&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;g=j+(c[b+4168>>2]|0)^g;l=g>>>1;m=l|g<<31;f=k+(c[b+4172>>2]|0)+j^(f<<1|f>>>31);j=c[b+2048+((f>>>8&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((f>>>16&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];g=j+(c[b+1024+((g>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((g>>>17&255)<<2)>>2]^c[b+3072+(m>>>24<<2)>>2])|0;i=g+(c[b+4176>>2]|0)^i;l=i>>>1;k=l|i<<31;h=j+(c[b+4180>>2]|0)+g^(h<<1|h>>>31);g=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];i=g+(c[b+1024+((i>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((i>>>17&255)<<2)>>2]^c[b+3072+(k>>>24<<2)>>2])|0;m=i+(c[b+4184>>2]|0)^m;l=m>>>1;j=l|m<<31;f=g+(c[b+4188>>2]|0)+i^(f<<1|f>>>31);i=c[b+2048+((f>>>8&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((f>>>16&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];m=i+(c[b+1024+((m>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((m>>>17&255)<<2)>>2]^c[b+3072+(j>>>24<<2)>>2])|0;k=m+(c[b+4192>>2]|0)^k;l=k>>>1;g=l|k<<31;h=i+(c[b+4196>>2]|0)+m^(h<<1|h>>>31);m=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];k=m+(c[b+1024+((k>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((k>>>17&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;j=k+(c[b+4200>>2]|0)^j;l=j>>>1;i=l|j<<31;f=m+(c[b+4204>>2]|0)+k^(f<<1|f>>>31);k=c[b+2048+((f>>>8&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((f>>>16&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];j=k+(c[b+1024+((j>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((j>>>17&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;g=j+(c[b+4208>>2]|0)^g;l=g>>>1;m=l|g<<31;h=k+(c[b+4212>>2]|0)+j^(h<<1|h>>>31);j=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];g=j+(c[b+1024+((g>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((g>>>17&255)<<2)>>2]^c[b+3072+(m>>>24<<2)>>2])|0;i=g+(c[b+4216>>2]|0)^i;l=i>>>1;k=l|i<<31;f=j+(c[b+4220>>2]|0)+g^(f<<1|f>>>31);g=c[b+2048+((f>>>8&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((f>>>16&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];i=g+(c[b+1024+((i>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((i>>>17&255)<<2)>>2]^c[b+3072+(k>>>24<<2)>>2])|0;m=i+(c[b+4224>>2]|0)^m;l=m>>>1;j=l|m<<31;h=g+(c[b+4228>>2]|0)+i^(h<<1|h>>>31);i=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];m=i+(c[b+1024+((m>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((m>>>17&255)<<2)>>2]^c[b+3072+(j>>>24<<2)>>2])|0;k=m+(c[b+4232>>2]|0)^k;l=k>>>1;g=l|k<<31;f=i+(c[b+4236>>2]|0)+m^(f<<1|f>>>31);m=c[b+2048+((f>>>8&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((f>>>16&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];k=m+(c[b+1024+((k>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((k>>>17&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;j=k+(c[b+4240>>2]|0)^j;l=j>>>1;i=l|j<<31;h=m+(c[b+4244>>2]|0)+k^(h<<1|h>>>31);k=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];j=k+(c[b+1024+((j>>>9&255)<<2)>>2]^c[b+((l&255)<<2)>>2]^c[b+2048+((j>>>17&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;g=j+(c[b+4248>>2]|0)^g;f=k+(c[b+4252>>2]|0)+j^(f<<1|f>>>31);i=c[b+4112>>2]^i;a[e+3>>0]=i>>>24;a[e+2>>0]=i>>>16;a[e+1>>0]=i>>>8;a[e>>0]=i;h=c[b+4116>>2]^h;a[e+7>>0]=h>>>24;a[e+6>>0]=h>>>16;a[e+5>>0]=h>>>8;a[e+4>>0]=h;g=c[b+4120>>2]^(g>>>1|g<<31);a[e+11>>0]=g>>>24;a[e+10>>0]=g>>>16;a[e+9>>0]=g>>>8;a[e+8>>0]=g;f=f^c[b+4124>>2];a[e+15>>0]=f>>>24;a[e+14>>0]=f>>>16;a[e+13>>0]=f>>>8;a[e+12>>0]=f;return 36}function jj(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;g=((d[f+2>>0]|0)<<16|(d[f+3>>0]|0)<<24|(d[f+1>>0]|0)<<8|(d[f>>0]|0))^c[b+4112>>2];h=((d[f+6>>0]|0)<<16|(d[f+7>>0]|0)<<24|(d[f+5>>0]|0)<<8|(d[f+4>>0]|0))^c[b+4116>>2];i=((d[f+10>>0]|0)<<16|(d[f+11>>0]|0)<<24|(d[f+9>>0]|0)<<8|(d[f+8>>0]|0))^c[b+4120>>2];k=c[b+2048+((h>>>8&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((h>>>16&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];j=k+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;f=((d[f+14>>0]|0)<<16|(d[f+15>>0]|0)<<24|(d[f+13>>0]|0)<<8|(d[f+12>>0]|0))^c[b+4124>>2]^(c[b+4252>>2]|0)+k+j;k=f>>>1;l=k|f<<31;i=j+(c[b+4248>>2]|0)^(i<<1|i>>>31);f=c[b+2048+((f>>>9&255)<<2)>>2]^c[b+1024+((k&255)<<2)>>2]^c[b+3072+((f>>>17&255)<<2)>>2]^c[b+(l>>>24<<2)>>2];k=f+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;h=(c[b+4244>>2]|0)+f+k^h;f=h>>>1;j=f|h<<31;g=k+(c[b+4240>>2]|0)^(g<<1|g>>>31);h=c[b+2048+((h>>>9&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((h>>>17&255)<<2)>>2]^c[b+(j>>>24<<2)>>2];f=h+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;l=(c[b+4236>>2]|0)+h+f^l;h=l>>>1;k=h|l<<31;i=f+(c[b+4232>>2]|0)^(i<<1|i>>>31);l=c[b+2048+((l>>>9&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((l>>>17&255)<<2)>>2]^c[b+(k>>>24<<2)>>2];h=l+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;j=(c[b+4228>>2]|0)+l+h^j;l=j>>>1;f=l|j<<31;g=h+(c[b+4224>>2]|0)^(g<<1|g>>>31);j=c[b+2048+((j>>>9&255)<<2)>>2]^c[b+1024+((l&255)<<2)>>2]^c[b+3072+((j>>>17&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];l=j+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;k=(c[b+4220>>2]|0)+j+l^k;j=k>>>1;h=j|k<<31;i=l+(c[b+4216>>2]|0)^(i<<1|i>>>31);k=c[b+2048+((k>>>9&255)<<2)>>2]^c[b+1024+((j&255)<<2)>>2]^c[b+3072+((k>>>17&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];j=k+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;f=(c[b+4212>>2]|0)+k+j^f;k=f>>>1;l=k|f<<31;g=j+(c[b+4208>>2]|0)^(g<<1|g>>>31);f=c[b+2048+((f>>>9&255)<<2)>>2]^c[b+1024+((k&255)<<2)>>2]^c[b+3072+((f>>>17&255)<<2)>>2]^c[b+(l>>>24<<2)>>2];k=f+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;h=(c[b+4204>>2]|0)+f+k^h;f=h>>>1;j=f|h<<31;i=k+(c[b+4200>>2]|0)^(i<<1|i>>>31);h=c[b+2048+((h>>>9&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((h>>>17&255)<<2)>>2]^c[b+(j>>>24<<2)>>2];f=h+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;l=(c[b+4196>>2]|0)+h+f^l;h=l>>>1;k=h|l<<31;g=f+(c[b+4192>>2]|0)^(g<<1|g>>>31);l=c[b+2048+((l>>>9&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((l>>>17&255)<<2)>>2]^c[b+(k>>>24<<2)>>2];h=l+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;j=(c[b+4188>>2]|0)+l+h^j;l=j>>>1;f=l|j<<31;i=h+(c[b+4184>>2]|0)^(i<<1|i>>>31);j=c[b+2048+((j>>>9&255)<<2)>>2]^c[b+1024+((l&255)<<2)>>2]^c[b+3072+((j>>>17&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];l=j+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;k=(c[b+4180>>2]|0)+j+l^k;j=k>>>1;h=j|k<<31;g=l+(c[b+4176>>2]|0)^(g<<1|g>>>31);k=c[b+2048+((k>>>9&255)<<2)>>2]^c[b+1024+((j&255)<<2)>>2]^c[b+3072+((k>>>17&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];j=k+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;f=(c[b+4172>>2]|0)+k+j^f;k=f>>>1;l=k|f<<31;i=j+(c[b+4168>>2]|0)^(i<<1|i>>>31);f=c[b+2048+((f>>>9&255)<<2)>>2]^c[b+1024+((k&255)<<2)>>2]^c[b+3072+((f>>>17&255)<<2)>>2]^c[b+(l>>>24<<2)>>2];k=f+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;h=(c[b+4164>>2]|0)+f+k^h;f=h>>>1;j=f|h<<31;g=k+(c[b+4160>>2]|0)^(g<<1|g>>>31);h=c[b+2048+((h>>>9&255)<<2)>>2]^c[b+1024+((f&255)<<2)>>2]^c[b+3072+((h>>>17&255)<<2)>>2]^c[b+(j>>>24<<2)>>2];f=h+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;l=(c[b+4156>>2]|0)+h+f^l;h=l>>>1;k=h|l<<31;i=f+(c[b+4152>>2]|0)^(i<<1|i>>>31);l=c[b+2048+((l>>>9&255)<<2)>>2]^c[b+1024+((h&255)<<2)>>2]^c[b+3072+((l>>>17&255)<<2)>>2]^c[b+(k>>>24<<2)>>2];h=l+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;j=(c[b+4148>>2]|0)+l+h^j;l=j>>>1;f=l|j<<31;g=h+(c[b+4144>>2]|0)^(g<<1|g>>>31);j=c[b+2048+((j>>>9&255)<<2)>>2]^c[b+1024+((l&255)<<2)>>2]^c[b+3072+((j>>>17&255)<<2)>>2]^c[b+(f>>>24<<2)>>2];l=j+(c[b+1024+((g>>>8&255)<<2)>>2]^c[b+((g&255)<<2)>>2]^c[b+2048+((g>>>16&255)<<2)>>2]^c[b+3072+(g>>>24<<2)>>2])|0;k=(c[b+4140>>2]|0)+j+l^k;j=k>>>1;h=j|k<<31;i=l+(c[b+4136>>2]|0)^(i<<1|i>>>31);k=c[b+2048+((k>>>9&255)<<2)>>2]^c[b+1024+((j&255)<<2)>>2]^c[b+3072+((k>>>17&255)<<2)>>2]^c[b+(h>>>24<<2)>>2];j=k+(c[b+1024+((i>>>8&255)<<2)>>2]^c[b+((i&255)<<2)>>2]^c[b+2048+((i>>>16&255)<<2)>>2]^c[b+3072+(i>>>24<<2)>>2])|0;f=(c[b+4132>>2]|0)+k+j^f;g=j+(c[b+4128>>2]|0)^(g<<1|g>>>31);i=c[b+4096>>2]^i;a[e+3>>0]=i>>>24;a[e+2>>0]=i>>>16;a[e+1>>0]=i>>>8;a[e>>0]=i;h=c[b+4100>>2]^h;a[e+7>>0]=h>>>24;a[e+6>>0]=h>>>16;a[e+5>>0]=h>>>8;a[e+4>>0]=h;g=g^c[b+4104>>2];a[e+11>>0]=g>>>24;a[e+10>>0]=g>>>16;a[e+9>>0]=g>>>8;a[e+8>>0]=g;f=c[b+4108>>2]^(f>>>1|f<<31);a[e+15>>0]=f>>>24;a[e+14>>0]=f>>>16;a[e+13>>0]=f>>>8;a[e+12>>0]=f;return 36}function kj(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0;ea=l;l=l+4288|0;if((l|0)>=(m|0))$(4288);i=ea;g=ea+8|0;h=ea+4264|0;if((f+-16|16|0)!=16){e=44;l=ea;return e|0}do if(!(c[17618]|0)){c[17618]=1;kj(g,43199,16)|0;Te(47);ij(g,h,43215)|0;if(!(Tp(h,43231,16)|0)){jj(g,h,h)|0;if(!(Tp(h,43215,16)|0)){kj(g,43247,32)|0;Te(47);ij(g,h,43279)|0;if(!(Tp(h,43295,16)|0)){jj(g,h,h)|0;if(!(Tp(h,43279,16)|0)){g=ym(43191,13,14,8,4,16,4256)|0;if(!g){g=wm(43191,13,14,6,5,16,4256)|0;if(!g){g=xm(43191,13,14,7,5,16,4256)|0;c[17619]=g;if(!g)break}else j=9}else j=9}else{g=43311;j=9}}else{g=43347;j=9}}else{g=43383;j=9}}else{g=43419;j=9}if((j|0)==9)c[17619]=g;c[i>>2]=g;Le(43455,i);j=12}else j=12;while(0);if((j|0)==12?c[17619]|0:0){e=50;l=ea;return e|0}g=a[e>>0]|0;if(!(g<<24>>24)){h=0;i=0;j=0}else{j=d[43459+((g&255)+-1)>>0]|0;h=a[43714+(j+1)>>0]|0;i=a[43714+(j+45)>>0]|0;j=a[43714+j>>0]|0}da=e+1|0;g=a[da>>0]|0;if(!(g<<24>>24))k=i;else{ca=d[43459+((g&255)+-1)>>0]|0;k=a[43714+(ca+138)>>0]^i;h=a[43714+(ca+68)>>0]^h;i=a[43714+(ca+164)>>0]^i;j=a[43714+(ca+45)>>0]^j}ca=e+2|0;g=a[ca>>0]|0;if(g<<24>>24){ba=d[43459+((g&255)+-1)>>0]|0;k=a[43714+(ba+209)>>0]^k;h=a[43714+(ba+191)>>0]^h;i=a[43714+(ba+213)>>0]^i;j=a[43714+(ba+138)>>0]^j}ba=e+3|0;g=a[ba>>0]|0;if(g<<24>>24){aa=d[43459+((g&255)+-1)>>0]|0;k=a[43714+(aa+153)>>0]^k;h=a[43714+(aa+61)>>0]^h;i=a[43714+(aa+127)>>0]^i;j=a[43714+(aa+209)>>0]^j}aa=e+4|0;g=a[aa>>0]|0;if(g<<24>>24){_=d[43459+((g&255)+-1)>>0]|0;k=a[43714+(_+150)>>0]^k;h=a[43714+(_+102)>>0]^h;i=a[43714+(_+70)>>0]^i;j=a[43714+(_+153)>>0]^j}_=e+5|0;g=a[_>>0]|0;if(g<<24>>24){Z=d[43459+((g&255)+-1)>>0]|0;k=a[43714+(Z+237)>>0]^k;h=a[43714+(Z+91)>>0]^h;i=a[43714+(Z+60)>>0]^i;j=a[43714+(Z+150)>>0]^j}Z=e+6|0;g=a[Z>>0]|0;if(g<<24>>24){Y=d[43459+((g&255)+-1)>>0]|0;k=a[43714+(Y+224)>>0]^k;h=a[43714+(Y+79)>>0]^h;i=a[43714+(Y+55)>>0]^i;j=a[43714+(Y+237)>>0]^j}Y=e+7|0;g=a[Y>>0]|0;if(g<<24>>24){X=d[43459+((g&255)+-1)>>0]|0;k=a[43714+(X+23)>>0]^k;h=a[43714+(X+140)>>0]^h;i=a[43714+(X+208)>>0]^i;j=a[43714+(X+224)>>0]^j}X=e+8|0;g=a[X>>0]|0;if(!(g<<24>>24)){n=0;o=0;p=0}else{p=d[43459+((g&255)+-1)>>0]|0;n=a[43714+(p+1)>>0]|0;o=a[43714+(p+45)>>0]|0;p=a[43714+p>>0]|0}W=e+9|0;g=a[W>>0]|0;if(!(g<<24>>24))q=o;else{V=d[43459+((g&255)+-1)>>0]|0;q=a[43714+(V+138)>>0]^o;n=a[43714+(V+68)>>0]^n;o=a[43714+(V+164)>>0]^o;p=a[43714+(V+45)>>0]^p}V=e+10|0;g=a[V>>0]|0;if(g<<24>>24){U=d[43459+((g&255)+-1)>>0]|0;q=a[43714+(U+209)>>0]^q;n=a[43714+(U+191)>>0]^n;o=a[43714+(U+213)>>0]^o;p=a[43714+(U+138)>>0]^p}U=e+11|0;g=a[U>>0]|0;if(g<<24>>24){T=d[43459+((g&255)+-1)>>0]|0;q=a[43714+(T+153)>>0]^q;n=a[43714+(T+61)>>0]^n;o=a[43714+(T+127)>>0]^o;p=a[43714+(T+209)>>0]^p}T=e+12|0;g=a[T>>0]|0;if(g<<24>>24){S=d[43459+((g&255)+-1)>>0]|0;q=a[43714+(S+150)>>0]^q;n=a[43714+(S+102)>>0]^n;o=a[43714+(S+70)>>0]^o;p=a[43714+(S+153)>>0]^p}S=e+13|0;g=a[S>>0]|0;if(g<<24>>24){R=d[43459+((g&255)+-1)>>0]|0;q=a[43714+(R+237)>>0]^q;n=a[43714+(R+91)>>0]^n;o=a[43714+(R+60)>>0]^o;p=a[43714+(R+150)>>0]^p}R=e+14|0;g=a[R>>0]|0;if(g<<24>>24){Q=d[43459+((g&255)+-1)>>0]|0;q=a[43714+(Q+224)>>0]^q;n=a[43714+(Q+79)>>0]^n;o=a[43714+(Q+55)>>0]^o;p=a[43714+(Q+237)>>0]^p}Q=e+15|0;g=a[Q>>0]|0;if(g<<24>>24){P=d[43459+((g&255)+-1)>>0]|0;q=a[43714+(P+23)>>0]^q;n=a[43714+(P+140)>>0]^n;o=a[43714+(P+208)>>0]^o;p=a[43714+(P+224)>>0]^p}if((f|0)!=32){g=1;f=0;r=0;while(1){O=a[44206+f>>0]|0;c[b+(r<<2)>>2]=c[8012+(((a[44974+((O^j)&255)>>0]^p)&255)<<2)>>2];P=a[44206+g>>0]|0;c[b+1024+(r<<2)>>2]=c[9036+(((a[44974+((P^i)&255)>>0]^o)&255)<<2)>>2];c[b+2048+(r<<2)>>2]=c[10060+(((a[44718+((O^h)&255)>>0]^n)&255)<<2)>>2];c[b+3072+(r<<2)>>2]=c[11084+(((a[44718+((P^k)&255)>>0]^q)&255)<<2)>>2];r=r+1|0;if((r|0)==256)break;else{g=g+2|0;f=f+2|0}}P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^243)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^103)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^103)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^243)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^117)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^169)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^169)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^117)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4096>>2]=O;c[b+4100>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^244)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^232)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^232)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^244)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^198)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^179)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^179)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^198)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4104>>2]=O;c[b+4108>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^123)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^253)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^253)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^123)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^219)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^4)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^4)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^219)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4112>>2]=O;c[b+4116>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^200)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^118)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^118)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^200)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^251)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^163)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^163)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^251)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4120>>2]=O;c[b+4124>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^211)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^146)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^146)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^211)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^74)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^154)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^154)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^74)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4128>>2]=O;c[b+4132>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^107)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^120)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^120)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^107)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^230)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^128)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^128)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^230)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4136>>2]=O;c[b+4140>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^125)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^221)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^221)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^125)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^69)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^228)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^228)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^69)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4144>>2]=O;c[b+4148>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^75)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^56)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^56)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^75)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^232)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^209)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^209)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^232)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4152>>2]=O;c[b+4156>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^50)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^198)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^198)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^50)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^214)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^13)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^13)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^214)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4160>>2]=O;c[b+4164>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^253)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^152)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^152)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^253)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^216)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^53)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^53)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^216)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4168>>2]=O;c[b+4172>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^113)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^247)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^247)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^113)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^55)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^24)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^24)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^55)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4176>>2]=O;c[b+4180>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^225)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^108)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^108)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^225)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^241)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^236)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^236)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^241)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4184>>2]=O;c[b+4188>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^15)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^117)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^117)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^15)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^48)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^67)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^67)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^48)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4192>>2]=O;c[b+4196>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^27)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^38)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^38)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^27)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^248)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^55)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^55)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^248)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4200>>2]=O;c[b+4204>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^250)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^19)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^19)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^250)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^135)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^250)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^250)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^135)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4208>>2]=O;c[b+4212>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^63)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^72)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^72)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^63)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^6)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^148)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^148)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^6)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4216>>2]=O;c[b+4220>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^186)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^208)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^208)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^186)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^94)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^242)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^242)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^94)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4224>>2]=O;c[b+4228>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^91)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^48)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^48)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^91)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^174)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^139)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^139)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^174)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4232>>2]=O;c[b+4236>>2]=P<<9|P>>>23;P=c[9036+(((a[_>>0]^a[44974+(d[S>>0]|0)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^84)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^84)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+(d[Q>>0]|0)>>0])&255)<<2)>>2];P=P<<8|P>>>24;O=P+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^138)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^132)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^132)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^138)>>0])&255)<<2)>>2])|0;P=O+P|0;c[b+4240>>2]=O;c[b+4244>>2]=P<<9|P>>>23;aa=c[9036+(((a[_>>0]^a[44974+((d[S>>0]|0)^157)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((d[T>>0]|0)^35)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((d[R>>0]|0)^35)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((d[Q>>0]|0)^157)>>0])&255)<<2)>>2];aa=aa<<8|aa>>>24;da=aa+(c[9036+(((a[da>>0]^a[44974+((d[W>>0]|0)^188)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((d[X>>0]|0)^223)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((d[V>>0]|0)^223)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((d[U>>0]|0)^188)>>0])&255)<<2)>>2])|0;e=da+aa|0;c[b+4248>>2]=da;c[b+4252>>2]=e<<9|e>>>23;e=0;l=ea;return e|0}P=e+16|0;g=a[P>>0]|0;if(!(g<<24>>24)){f=0;r=0;s=0}else{s=d[43459+((g&255)+-1)>>0]|0;f=a[43714+(s+1)>>0]|0;r=a[43714+(s+45)>>0]|0;s=a[43714+s>>0]|0}O=e+17|0;g=a[O>>0]|0;if(!(g<<24>>24))t=r;else{N=d[43459+((g&255)+-1)>>0]|0;t=a[43714+(N+138)>>0]^r;f=a[43714+(N+68)>>0]^f;r=a[43714+(N+164)>>0]^r;s=a[43714+(N+45)>>0]^s}N=e+18|0;g=a[N>>0]|0;if(g<<24>>24){M=d[43459+((g&255)+-1)>>0]|0;t=a[43714+(M+209)>>0]^t;f=a[43714+(M+191)>>0]^f;r=a[43714+(M+213)>>0]^r;s=a[43714+(M+138)>>0]^s}M=e+19|0;g=a[M>>0]|0;if(g<<24>>24){L=d[43459+((g&255)+-1)>>0]|0;t=a[43714+(L+153)>>0]^t;f=a[43714+(L+61)>>0]^f;r=a[43714+(L+127)>>0]^r;s=a[43714+(L+209)>>0]^s}L=e+20|0;g=a[L>>0]|0;if(g<<24>>24){K=d[43459+((g&255)+-1)>>0]|0;t=a[43714+(K+150)>>0]^t;f=a[43714+(K+102)>>0]^f;r=a[43714+(K+70)>>0]^r;s=a[43714+(K+153)>>0]^s}K=e+21|0;g=a[K>>0]|0;if(g<<24>>24){J=d[43459+((g&255)+-1)>>0]|0;t=a[43714+(J+237)>>0]^t;f=a[43714+(J+91)>>0]^f;r=a[43714+(J+60)>>0]^r;s=a[43714+(J+150)>>0]^s}J=e+22|0;g=a[J>>0]|0;if(g<<24>>24){I=d[43459+((g&255)+-1)>>0]|0;t=a[43714+(I+224)>>0]^t;f=a[43714+(I+79)>>0]^f;r=a[43714+(I+55)>>0]^r;s=a[43714+(I+237)>>0]^s}I=e+23|0;g=a[I>>0]|0;if(g<<24>>24){H=d[43459+((g&255)+-1)>>0]|0;t=a[43714+(H+23)>>0]^t;f=a[43714+(H+140)>>0]^f;r=a[43714+(H+208)>>0]^r;s=a[43714+(H+224)>>0]^s}H=e+24|0;g=a[H>>0]|0;if(!(g<<24>>24)){u=0;v=0;w=0}else{w=d[43459+((g&255)+-1)>>0]|0;u=a[43714+(w+1)>>0]|0;v=a[43714+(w+45)>>0]|0;w=a[43714+w>>0]|0}G=e+25|0;g=a[G>>0]|0;if(!(g<<24>>24))x=v;else{F=d[43459+((g&255)+-1)>>0]|0;x=a[43714+(F+138)>>0]^v;u=a[43714+(F+68)>>0]^u;v=a[43714+(F+164)>>0]^v;w=a[43714+(F+45)>>0]^w}F=e+26|0;g=a[F>>0]|0;if(g<<24>>24){E=d[43459+((g&255)+-1)>>0]|0;x=a[43714+(E+209)>>0]^x;u=a[43714+(E+191)>>0]^u;v=a[43714+(E+213)>>0]^v;w=a[43714+(E+138)>>0]^w}E=e+27|0;g=a[E>>0]|0;if(g<<24>>24){D=d[43459+((g&255)+-1)>>0]|0;x=a[43714+(D+153)>>0]^x;u=a[43714+(D+61)>>0]^u;v=a[43714+(D+127)>>0]^v;w=a[43714+(D+209)>>0]^w}D=e+28|0;g=a[D>>0]|0;if(g<<24>>24){C=d[43459+((g&255)+-1)>>0]|0;x=a[43714+(C+150)>>0]^x;u=a[43714+(C+102)>>0]^u;v=a[43714+(C+70)>>0]^v;w=a[43714+(C+153)>>0]^w}C=e+29|0;g=a[C>>0]|0;if(g<<24>>24){B=d[43459+((g&255)+-1)>>0]|0;x=a[43714+(B+237)>>0]^x;u=a[43714+(B+91)>>0]^u;v=a[43714+(B+60)>>0]^v;w=a[43714+(B+150)>>0]^w}B=e+30|0;g=a[B>>0]|0;if(g<<24>>24){A=d[43459+((g&255)+-1)>>0]|0;x=a[43714+(A+224)>>0]^x;u=a[43714+(A+79)>>0]^u;v=a[43714+(A+55)>>0]^v;w=a[43714+(A+237)>>0]^w}A=e+31|0;g=a[A>>0]|0;if(g<<24>>24){z=d[43459+((g&255)+-1)>>0]|0;x=a[43714+(z+23)>>0]^x;u=a[43714+(z+140)>>0]^u;v=a[43714+(z+208)>>0]^v;w=a[43714+(z+224)>>0]^w}g=1;y=0;z=0;while(1){fa=a[44206+g>>0]|0;c[b+(z<<2)>>2]=c[8012+(((a[44974+((a[44974+((a[44718+((fa^j)&255)>>0]^p)&255)>>0]^s)&255)>>0]^w)&255)<<2)>>2];ga=a[44206+y>>0]|0;c[b+1024+(z<<2)>>2]=c[9036+(((a[44974+((a[44718+((a[44718+((ga^i)&255)>>0]^o)&255)>>0]^r)&255)>>0]^v)&255)<<2)>>2];c[b+2048+(z<<2)>>2]=c[10060+(((a[44718+((a[44974+((a[44974+((ga^h)&255)>>0]^n)&255)>>0]^f)&255)>>0]^u)&255)<<2)>>2];c[b+3072+(z<<2)>>2]=c[11084+(((a[44718+((a[44718+((a[44974+((fa^k)&255)>>0]^q)&255)>>0]^t)&255)>>0]^x)&255)<<2)>>2];z=z+1|0;if((z|0)==256)break;else{g=g+2|0;y=y+2|0}}ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^103)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^243)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^103)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^243)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^169)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^117)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^169)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^117)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4096>>2]=fa;c[b+4100>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^232)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^244)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^232)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^244)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^179)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^198)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^179)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^198)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4104>>2]=fa;c[b+4108>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^253)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^123)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^253)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^123)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^4)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^219)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^4)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^219)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4112>>2]=fa;c[b+4116>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^118)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^200)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^118)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^200)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^163)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^251)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^163)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^251)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4120>>2]=fa;c[b+4124>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^146)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^211)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^146)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^211)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^154)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^74)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^154)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^74)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4128>>2]=fa;c[b+4132>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^120)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^107)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^120)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^107)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^128)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^230)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^128)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^230)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4136>>2]=fa;c[b+4140>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^221)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^125)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^221)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^125)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^228)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^69)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^228)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^69)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4144>>2]=fa;c[b+4148>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^56)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^75)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^56)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^75)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^209)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^232)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^209)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^232)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4152>>2]=fa;c[b+4156>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^198)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^50)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^198)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^50)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^13)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^214)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^13)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^214)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4160>>2]=fa;c[b+4164>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^152)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^253)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^152)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^253)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^53)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^216)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^53)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^216)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4168>>2]=fa;c[b+4172>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^247)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^113)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^247)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^113)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^24)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^55)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^24)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^55)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4176>>2]=fa;c[b+4180>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^108)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^225)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^108)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^225)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^236)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^241)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^236)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^241)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4184>>2]=fa;c[b+4188>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^117)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^15)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^117)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^15)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^67)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^48)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^67)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^48)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4192>>2]=fa;c[b+4196>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^38)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^27)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^38)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^27)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^55)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^248)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^55)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^248)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4200>>2]=fa;c[b+4204>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^19)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^250)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^19)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^250)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^250)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^135)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^250)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^135)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4208>>2]=fa;c[b+4212>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^72)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^63)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^72)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^63)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^148)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^6)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^148)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^6)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4216>>2]=fa;c[b+4220>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^208)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^186)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^208)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^186)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^242)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^94)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^242)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^94)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4224>>2]=fa;c[b+4228>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^48)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^91)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^48)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^91)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^139)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^174)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^139)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^174)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4232>>2]=fa;c[b+4236>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^84)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+(d[D>>0]|0)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^84)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+(d[A>>0]|0)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^132)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^138)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^132)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^138)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4240>>2]=fa;c[b+4244>>2]=ga<<9|ga>>>23;ga=c[9036+(((a[_>>0]^a[44974+((a[S>>0]^a[44718+((a[K>>0]^a[44718+((d[C>>0]|0)^35)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[aa>>0]^a[44974+((a[T>>0]^a[44974+((a[L>>0]^a[44718+((d[D>>0]|0)^157)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[Z>>0]^a[44718+((a[R>>0]^a[44974+((a[J>>0]^a[44974+((d[B>>0]|0)^35)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[Y>>0]^a[44718+((a[Q>>0]^a[44718+((a[I>>0]^a[44974+((d[A>>0]|0)^157)>>0])&255)>>0])&255)>>0])&255)<<2)>>2];ga=ga<<8|ga>>>24;fa=ga+(c[9036+(((a[da>>0]^a[44974+((a[W>>0]^a[44718+((a[O>>0]^a[44718+((d[G>>0]|0)^223)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[8012+(((a[e>>0]^a[44974+((a[X>>0]^a[44974+((a[P>>0]^a[44718+((d[H>>0]|0)^188)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[10060+(((a[ca>>0]^a[44718+((a[V>>0]^a[44974+((a[N>>0]^a[44974+((d[F>>0]|0)^223)>>0])&255)>>0])&255)>>0])&255)<<2)>>2]^c[11084+(((a[ba>>0]^a[44718+((a[U>>0]^a[44718+((a[M>>0]^a[44974+((d[E>>0]|0)^188)>>0])&255)>>0])&255)>>0])&255)<<2)>>2])|0;ga=fa+ga|0;c[b+4248>>2]=fa;c[b+4252>>2]=ga<<9|ga>>>23;ga=0;l=ea;return ga|0}function lj(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;F=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=F;if(!g)j=0;else{B=h+4|0;C=h+8|0;D=h+12|0;k=h+1|0;n=h+2|0;o=h+3|0;p=h+4|0;q=h+5|0;r=h+6|0;s=h+7|0;t=h+8|0;u=h+9|0;v=h+10|0;w=h+11|0;x=h+12|0;y=h+13|0;z=h+14|0;A=h+15|0;j=0;i=f;do{ij(b,h,d)|0;j=j>>>0<36?36:j;if(!((e|i)&3)){c[e>>2]=c[i>>2]^c[h>>2];c[e+4>>2]=c[i+4>>2]^c[B>>2];c[e+8>>2]=c[i+8>>2]^c[C>>2];c[e+12>>2]=c[i+12>>2]^c[D>>2]}else{a[e>>0]=a[i>>0]^a[h>>0];a[e+1>>0]=a[i+1>>0]^a[k>>0];a[e+2>>0]=a[i+2>>0]^a[n>>0];a[e+3>>0]=a[i+3>>0]^a[o>>0];a[e+4>>0]=a[i+4>>0]^a[p>>0];a[e+5>>0]=a[i+5>>0]^a[q>>0];a[e+6>>0]=a[i+6>>0]^a[r>>0];a[e+7>>0]=a[i+7>>0]^a[s>>0];a[e+8>>0]=a[i+8>>0]^a[t>>0];a[e+9>>0]=a[i+9>>0]^a[u>>0];a[e+10>>0]=a[i+10>>0]^a[v>>0];a[e+11>>0]=a[i+11>>0]^a[w>>0];a[e+12>>0]=a[i+12>>0]^a[x>>0];a[e+13>>0]=a[i+13>>0]^a[y>>0];a[e+14>>0]=a[i+14>>0]^a[z>>0];a[e+15>>0]=a[i+15>>0]^a[A>>0]}e=e+16|0;i=i+16|0;f=16;do{if((f|0)<=0)break;f=f+-1|0;H=d+f|0;G=(a[H>>0]|0)+1<<24>>24;a[H>>0]=G}while(!(G<<24>>24));g=g+-1|0}while((g|0)!=0)}if(h&4){e=16;do{a[h>>0]=0;h=h+1|0;e=e+-1|0}while((e|0)!=0&(h&7|0)!=0);if(e>>>0>=8)E=13}else{e=16;E=13}if((E|0)==13){g=e+-8|0;i=g&-8;b=i+8|0;f=h;while(1){H=f;c[H>>2]=0;c[H+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else f=f+8|0}e=g-i|0;h=h+b|0}if(!e){Te(j);l=F;return}while(1){a[h>>0]=0;e=e+-1|0;if(!e)break;else h=h+1|0}Te(j);l=F;return}function mj(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;X=l;l=l+16|0;if((l|0)>=(m|0))$(16);h=X;if(!g)i=0;else{T=d;U=h+4|0;V=d+4|0;j=h+8|0;k=d+8|0;n=h+12|0;o=d+12|0;p=h+1|0;q=d+1|0;r=h+2|0;s=d+2|0;t=h+3|0;u=d+3|0;v=h+4|0;w=d+4|0;x=h+5|0;y=d+5|0;z=h+6|0;A=d+6|0;B=h+7|0;C=d+7|0;D=h+8|0;E=d+8|0;F=h+9|0;G=d+9|0;H=h+10|0;I=d+10|0;J=h+11|0;K=d+11|0;L=h+12|0;M=d+12|0;N=h+13|0;O=d+13|0;P=h+14|0;Q=d+14|0;R=h+15|0;S=d+15|0;i=0;while(1){jj(b,h,f)|0;i=i>>>0<36?36:i;if(!((f|T|e)&3)){Y=c[f>>2]|0;c[e>>2]=c[h>>2]^c[d>>2];c[d>>2]=Y;Y=c[f+4>>2]|0;c[e+4>>2]=c[U>>2]^c[V>>2];c[V>>2]=Y;Y=c[f+8>>2]|0;c[e+8>>2]=c[j>>2]^c[k>>2];c[k>>2]=Y;Y=c[f+12>>2]|0;c[e+12>>2]=c[n>>2]^c[o>>2];c[o>>2]=Y}else{Y=a[f>>0]|0;a[e>>0]=a[h>>0]^a[d>>0];a[d>>0]=Y;Y=a[f+1>>0]|0;a[e+1>>0]=a[p>>0]^a[q>>0];a[q>>0]=Y;Y=a[f+2>>0]|0;a[e+2>>0]=a[r>>0]^a[s>>0];a[s>>0]=Y;Y=a[f+3>>0]|0;a[e+3>>0]=a[t>>0]^a[u>>0];a[u>>0]=Y;Y=a[f+4>>0]|0;a[e+4>>0]=a[v>>0]^a[w>>0];a[w>>0]=Y;Y=a[f+5>>0]|0;a[e+5>>0]=a[x>>0]^a[y>>0];a[y>>0]=Y;Y=a[f+6>>0]|0;a[e+6>>0]=a[z>>0]^a[A>>0];a[A>>0]=Y;Y=a[f+7>>0]|0;a[e+7>>0]=a[B>>0]^a[C>>0];a[C>>0]=Y;Y=a[f+8>>0]|0;a[e+8>>0]=a[D>>0]^a[E>>0];a[E>>0]=Y;Y=a[f+9>>0]|0;a[e+9>>0]=a[F>>0]^a[G>>0];a[G>>0]=Y;Y=a[f+10>>0]|0;a[e+10>>0]=a[H>>0]^a[I>>0];a[I>>0]=Y;Y=a[f+11>>0]|0;a[e+11>>0]=a[J>>0]^a[K>>0];a[K>>0]=Y;Y=a[f+12>>0]|0;a[e+12>>0]=a[L>>0]^a[M>>0];a[M>>0]=Y;Y=a[f+13>>0]|0;a[e+13>>0]=a[N>>0]^a[O>>0];a[O>>0]=Y;Y=a[f+14>>0]|0;a[e+14>>0]=a[P>>0]^a[Q>>0];a[Q>>0]=Y;Y=a[f+15>>0]|0;a[e+15>>0]=a[R>>0]^a[S>>0];a[S>>0]=Y}g=g+-1|0;if(!g)break;else{e=e+16|0;f=f+16|0}}}if(h&4){e=16;do{a[h>>0]=0;h=h+1|0;e=e+-1|0}while((e|0)!=0&(h&7|0)!=0);if(e>>>0>=8)W=10}else{e=16;W=10}if((W|0)==10){f=e+-8|0;b=f&-8;d=b+8|0;g=h;while(1){Y=g;c[Y>>2]=0;c[Y+4>>2]=0;e=e+-8|0;if(e>>>0<=7)break;else g=g+8|0}e=f-b|0;h=h+d|0}if(!e){Te(i);l=X;return}while(1){a[h>>0]=0;e=e+-1|0;if(!e)break;else h=h+1|0}Te(i);l=X;return}function nj(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;if(!g){x=0;Te(x);return}u=d;v=d+4|0;w=d+8|0;x=d+12|0;i=d+1|0;j=d+2|0;k=d+3|0;l=d+5|0;m=d+6|0;n=d+7|0;o=d+9|0;p=d+10|0;q=d+11|0;r=d+13|0;s=d+14|0;t=d+15|0;h=g;g=0;while(1){ij(b,d,d)|0;g=g>>>0<36?36:g;if(!((e|u|f)&3)){y=c[f>>2]|0;c[e>>2]=c[d>>2]^y;c[d>>2]=y;y=c[f+4>>2]|0;c[e+4>>2]=c[v>>2]^y;c[v>>2]=y;y=c[f+8>>2]|0;c[e+8>>2]=c[w>>2]^y;c[w>>2]=y;y=c[f+12>>2]|0;c[e+12>>2]=c[x>>2]^y;c[x>>2]=y}else{y=a[f>>0]|0;a[e>>0]=a[d>>0]^y;a[d>>0]=y;y=a[f+1>>0]|0;a[e+1>>0]=a[i>>0]^y;a[i>>0]=y;y=a[f+2>>0]|0;a[e+2>>0]=a[j>>0]^y;a[j>>0]=y;y=a[f+3>>0]|0;a[e+3>>0]=a[k>>0]^y;a[k>>0]=y;y=a[f+4>>0]|0;a[e+4>>0]=a[v>>0]^y;a[v>>0]=y;y=a[f+5>>0]|0;a[e+5>>0]=a[l>>0]^y;a[l>>0]=y;y=a[f+6>>0]|0;a[e+6>>0]=a[m>>0]^y;a[m>>0]=y;y=a[f+7>>0]|0;a[e+7>>0]=a[n>>0]^y;a[n>>0]=y;y=a[f+8>>0]|0;a[e+8>>0]=a[w>>0]^y;a[w>>0]=y;y=a[f+9>>0]|0;a[e+9>>0]=a[o>>0]^y;a[o>>0]=y;y=a[f+10>>0]|0;a[e+10>>0]=a[p>>0]^y;a[p>>0]=y;y=a[f+11>>0]|0;a[e+11>>0]=a[q>>0]^y;a[q>>0]=y;y=a[f+12>>0]|0;a[e+12>>0]=a[x>>0]^y;a[x>>0]=y;y=a[f+13>>0]|0;a[e+13>>0]=a[r>>0]^y;a[r>>0]=y;y=a[f+14>>0]|0;a[e+14>>0]=a[s>>0]^y;a[s>>0]=y;y=a[f+15>>0]|0;a[e+15>>0]=a[t>>0]^y;a[t>>0]=y}h=h+-1|0;if(!h)break;else{f=f+16|0;e=e+16|0}}Te(g);return}function oj(a,b){a=a|0;b=b|0;c[17620]=a;c[17621]=b;return}function pj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[17620]|0;if(!f)return;qb[f&15](c[17621]|0,a,b,d,e);return}function qj(a){a=a|0;a:do switch(a|0){case 0:{c[17622]=1;break}case 1:{c[17623]=1;break}default:if(!(c[17622]|0))switch(a|0){case 2:{c[17624]=1;break a}case 3:{c[17625]=1;break a}default:break a}}while(0);return}function rj(a){a=a|0;if(gg()|0){en(a);return}if(c[17623]|0){Pm(a);return}if(c[17624]|0){en(a);return}if(!(c[17625]|0)){Pm(a);return}else{wn(a);return}}function sj(){if(gg()|0){fn();return}if(c[17623]|0){Rm();return}if(c[17624]|0){fn();return}if(!(c[17625]|0)){Rm();return}else{xn();return}}function tj(a){a=a|0;if((a|0)==0?(gg()|0)!=0:0)a=2;else if(!(c[17623]|0))if(!(c[17624]|0))a=(c[17625]|0)==0?1:3;else a=2;else a=1;return a|0}function uj(){if(!(gg()|0)){Sm();return}else return}function vj(){if(gg()|0)return;Tm();return}function wj(){if(gg()|0)return;Um();return}function xj(a){a=a|0;if(gg()|0)return;return}function yj(a){a=a|0;if(gg()|0){a=0;return a|0}a=Wm(a)|0;return a|0}function zj(){var a=0;if(!(gg()|0)){a=Xm()|0;return a|0}else{a=hn()|0;return a|0}return 0}function Aj(a,b){a=a|0;b=b|0;var c=0;c=gf(a)|0;Bj(c,a,b);return c|0}function Bj(a,b,d){a=a|0;b=b|0;d=d|0;if(gg()|0){jn(a,b,d);return}if(c[17623]|0){Zm(a,b,d);return}if(c[17624]|0){jn(a,b,d);return}if(!(c[17625]|0)){Zm(a,b,d);return}else{yn(a,b,d);return}}function Cj(a,b){a=a|0;b=b|0;var c=0;c=jf(a)|0;Bj(c,a,b);return c|0}function Dj(a,b,c){a=a|0;b=b|0;c=c|0;Bj(a,b,c);return}function Ej(a){a=a|0;if(gg()|0)return;if(c[17623]|0){bn(a);return}if(c[17625]|c[17624]|0)return;bn(a);return}function Fj(){if(gg()|0)return;if(c[17623]|0){cn();return}if(c[17625]|c[17624]|0)return;cn();return}function Gj(){if(gg()|0)return;if(c[17623]|0){dn();return}if(c[17625]|c[17624]|0)return;dn();return}function Hj(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;h=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=h+8|0;f=h;e=h+12|0;if(gg()|0){rn(a,b);l=h;return}do if(!(gg()|0)){if(c[17623]|0){Pm(1);break}if(c[17624]|0){en(1);break}if(!(c[17625]|0)){Pm(1);break}else{wn(1);break}}else en(1);while(0);d=Vn(12172)|0;if(d|0){c[f>>2]=Pn(d)|0;Me(45241,f)}c[e>>2]=qq()|0;if(c[17626]|0){if((c[17627]|0)!=(c[e>>2]|0)){Bj(70532,8,0);c[17627]=c[e>>2]}}else{f=fb(0)|0;d=c[e>>2]|0;c[17627]=c[e>>2];c[17628]=d;c[17629]=f;Bj(70532,8,0);c[17626]=1}if(b|0)while(1){Vi(70512,70512,28);d=b>>>0>20?20:b;cr(a|0,70512,d|0)|0;b=b-d|0;if(!b)break;else a=a+d|0}b=Wn(12172)|0;if(!b){l=h;return}else{c[g>>2]=Pn(b)|0;Me(45286,g)}}function Ij(a){a=a|0;if(!(gg()|0)){a=0;return a|0}a=sn(a)|0;return a|0}function Jj(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;if(!(gg()|0)){h=60;return h|0}h=tn(a,b,c,d,e,f,g,h)|0;return h|0}function Kj(a,b,c){a=a|0;b=b|0;c=c|0;if(!(gg()|0)){c=60;return c|0}c=un(a,b,c)|0;return c|0}function Lj(a){a=a|0;if(!(gg()|0))return;vn(a);return}function Mj(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;j=l;l=l+112|0;if((l|0)>=(m|0))$(112);g=j+8|0;f=j;h=j+12|0;if(!d){c[f>>2]=b;lp(h,99,45331,f)|0;Se(h,0);l=j;return}c[g>>2]=b;lp(h,99,45336,g)|0;g=(e|0)!=0;if(g){f=Hl(0)|0;b=Hl(0)|0;if(!(Nj(f,b,d,e)|0)){a[h+((Fo(h)|0)+-1)>>0]=120;Se(h,f);a[h+((Fo(h)|0)+-1)>>0]=121;Se(h,b)}else i=6}else{f=0;b=0;i=6}if((i|0)==6){Se(h,c[d>>2]|0);a[h+((Fo(h)|0)+-1)>>0]=89;Se(h,c[d+4>>2]|0);a[h+((Fo(h)|0)+-1)>>0]=90;Se(h,c[d+8>>2]|0);if(!g){l=j;return}}Jl(f);Jl(b);l=j;return}function Nj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0;n=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=n+16|0;f=n+8|0;g=d+8|0;if(!(vk(c[g>>2]|0,0)|0)){b=-1;l=n;return b|0}switch(c[e>>2]|0){case 0:{k=Hl(0)|0;j=Hl(0)|0;f=c[g>>2]|0;i=e+16|0;if(!(Fk(k,f,c[i>>2]|0)|0)){Le(45341,n);Se(45375,f);Se(45379,c[i>>2]|0)}Kk(j,k,k);h=e+60|0;f=c[h>>2]|0;if(!f)Gk(j,j,c[i>>2]|0);else Jk(j,j,f);do if(a|0){Kk(a,c[d>>2]|0,j);f=c[h>>2]|0;if(!f){Gk(a,a,c[i>>2]|0);break}else{Jk(a,a,f);break}}while(0);if(b|0){g=Hl(0)|0;Kk(g,j,k);f=c[h>>2]|0;if(!f)Gk(g,g,c[i>>2]|0);else Jk(g,g,f);Kk(b,c[d+4>>2]|0,g);f=c[h>>2]|0;if(!f)Gk(b,b,c[i>>2]|0);else Jk(b,b,f);tl(g)}tl(j);tl(k);b=0;l=n;return b|0}case 1:{if(a|0)Al(a,c[d>>2]|0)|0;if(!b){b=0;l=n;return b|0}else{c[f>>2]=45432;c[f+4>>2]=45456;Me(45383,f)}break}case 2:{i=Hl(0)|0;f=c[g>>2]|0;g=e+16|0;if(!(Fk(i,f,c[g>>2]|0)|0)){Le(45341,h);Se(45375,f);Se(45379,c[g>>2]|0)}do if(a|0){Kk(a,c[d>>2]|0,i);f=c[e+60>>2]|0;if(!f){Gk(a,a,c[g>>2]|0);break}else{Jk(a,a,f);break}}while(0);do if(b|0){Kk(b,c[d+4>>2]|0,i);f=c[e+60>>2]|0;if(!f){Gk(b,b,c[g>>2]|0);break}else{Jk(b,b,f);break}}while(0);Jl(i);b=0;l=n;return b|0}default:{b=-1;l=n;return b|0}}return 0}function Oj(a){a=a|0;a=gf(12)|0;c[a>>2]=Hl(0)|0;c[a+4>>2]=Hl(0)|0;c[a+8>>2]=Hl(0)|0;return a|0}function Pj(a){a=a|0;c[a>>2]=Hl(0)|0;c[a+4>>2]=Hl(0)|0;c[a+8>>2]=Hl(0)|0;return}function Qj(a){a=a|0;var b=0;if(!a)return;tl(c[a>>2]|0);c[a>>2]=0;b=a+4|0;tl(c[b>>2]|0);c[b>>2]=0;b=a+8|0;tl(c[b>>2]|0);c[b>>2]=0;cf(a);return}function Rj(a){a=a|0;var b=0;tl(c[a>>2]|0);c[a>>2]=0;b=a+4|0;tl(c[b>>2]|0);c[b>>2]=0;a=a+8|0;tl(c[a>>2]|0);c[a>>2]=0;return}function Sj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;if(!a){f=gf(12)|0;c[f>>2]=Hl(0)|0;c[f+4>>2]=Hl(0)|0;c[f+8>>2]=Hl(0)|0}else f=a;a=c[f>>2]|0;if(!b)rl(a);else Al(a,b)|0;a=c[f+4>>2]|0;if(!d)rl(a);else Al(a,d)|0;a=c[f+8>>2]|0;if(!e){rl(a);return f|0}else{Al(a,e)|0;return f|0}return 0}function Tj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;if(!a){f=gf(12)|0;c[f>>2]=Hl(0)|0;c[f+4>>2]=Hl(0)|0;c[f+8>>2]=Hl(0)|0}else f=a;a=c[f>>2]|0;if(!b)rl(a);else Cl(a,b);a=c[f+4>>2]|0;if(!d)rl(a);else Cl(a,d);a=c[f+8>>2]|0;if(!e){rl(a);return f|0}else{Cl(a,e);return f|0}return 0}function Uj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0;g=kf(1,108)|0;Vj(g,a,b,c,d,e,f);return g|0}function Vj(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;do if(!(c[17635]|0))if(!(Xa(45467)|0)){c[17635]=-1;break}else{c[17635]=1;break}while(0);c[b>>2]=d;c[b+4>>2]=e;c[b+8>>2]=f;if((e|0)==1)d=256;else d=lk(g)|0;c[b+12>>2]=d;e=b+16|0;c[e>>2]=yl(g)|0;c[b+20>>2]=yl(h)|0;c[b+24>>2]=yl(i)|0;if((c[17635]|0)>0)d=Hk(c[e>>2]|0,0)|0;else d=0;c[b+60>>2]=d;i=b+48|0;a[i>>0]=a[i>>0]&-4;c[b+64>>2]=Bl(c[e>>2]|0)|0;c[b+68>>2]=Bl(c[e>>2]|0)|0;c[b+72>>2]=Bl(c[e>>2]|0)|0;c[b+76>>2]=Bl(c[e>>2]|0)|0;c[b+80>>2]=Bl(c[e>>2]|0)|0;c[b+84>>2]=Bl(c[e>>2]|0)|0;c[b+88>>2]=Bl(c[e>>2]|0)|0;c[b+92>>2]=Bl(c[e>>2]|0)|0;c[b+96>>2]=Bl(c[e>>2]|0)|0;c[b+100>>2]=Bl(c[e>>2]|0)|0;c[b+104>>2]=Bl(c[e>>2]|0)|0;return}function Wj(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0;c[a>>2]=0;if(!((f|0)!=0&(g|0)!=0)){i=32816;return i|0}i=rg(1,108,5)|0;if(!i){i=Sn()|0;return i|0}else{Vj(sg(i,1)|0,b,d,e,f,g,h);c[a>>2]=i;i=0;return i|0}return 0}function Xj(a){a=a|0;var b=0,d=0;Ik(c[a+60>>2]|0);tl(c[a+16>>2]|0);tl(c[a+20>>2]|0);tl(c[a+24>>2]|0);b=c[a+28>>2]|0;if(b|0){tl(c[b>>2]|0);c[b>>2]=0;d=b+4|0;tl(c[d>>2]|0);c[d>>2]=0;d=b+8|0;tl(c[d>>2]|0);c[d>>2]=0;cf(b)}tl(c[a+32>>2]|0);tl(c[a+36>>2]|0);b=c[a+40>>2]|0;if(b|0){tl(c[b>>2]|0);c[b>>2]=0;d=b+4|0;tl(c[d>>2]|0);c[d>>2]=0;d=b+8|0;tl(c[d>>2]|0);c[d>>2]=0;cf(b)}tl(c[a+44>>2]|0);tl(c[a+56>>2]|0);tl(c[a+64>>2]|0);tl(c[a+68>>2]|0);tl(c[a+72>>2]|0);tl(c[a+76>>2]|0);tl(c[a+80>>2]|0);tl(c[a+84>>2]|0);tl(c[a+88>>2]|0);tl(c[a+92>>2]|0);tl(c[a+96>>2]|0);tl(c[a+100>>2]|0);tl(c[a+104>>2]|0);return}function Yj(a){a=a|0;if(!a)return;Xj(a);cf(a);return}function Zj(a,b,c){a=a|0;b=b|0;c=c|0;return Kg(a,sg(b,1)|0,c)|0}function _j(a,b,c){a=a|0;b=b|0;c=c|0;return Lg(a,sg(b,1)|0)|0}function $j(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0;r=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=r;switch(c[e>>2]|0){case 0:{n=d+4|0;if(vk(c[n>>2]|0,0)|0?(k=d+8|0,vk(c[k>>2]|0,0)|0):0){f=e+48|0;g=a[f>>0]|0;if(!(g&1)){a[f>>0]=g|1;f=e+16|0;q=Bl(c[f>>2]|0)|0;gk(q,c[f>>2]|0,3);f=e+52|0;c[f>>2]=(wk(c[e+20>>2]|0,q)|0)==0&1;tl(q)}else f=e+52|0;o=e+64|0;do if(!(c[f>>2]|0)){i=e+76|0;f=c[i>>2]|0;j=c[d>>2]|0;Kk(f,j,j);j=e+60|0;g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);f=c[i>>2]|0;Kk(f,f,Ml(3)|0);g=c[j>>2]|0;if(!g){h=e+16|0;Gk(f,f,c[h>>2]|0)}else{Jk(f,f,g);h=e+16|0}q=c[o>>2]|0;g=c[k>>2]|0;f=Ml(4)|0;Mk(q,g,f,c[h>>2]|0);f=c[o>>2]|0;Kk(f,f,c[e+20>>2]|0);g=c[j>>2]|0;if(!g)Gk(f,f,c[h>>2]|0);else Jk(f,f,g);f=c[i>>2]|0;fk(f,f,c[o>>2]|0);g=c[j>>2]|0;if(!g){Gk(f,f,c[h>>2]|0);break}else{Jk(f,f,g);break}}else{f=c[o>>2]|0;j=c[k>>2]|0;Kk(f,j,j);j=e+60|0;g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);i=e+76|0;hk(c[i>>2]|0,c[d>>2]|0,c[o>>2]|0);f=c[i>>2]|0;Kk(f,f,Ml(3)|0);g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);h=e+68|0;f=c[h>>2]|0;fk(f,c[d>>2]|0,c[o>>2]|0);g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);g=c[i>>2]|0;Kk(g,g,c[h>>2]|0);f=c[j>>2]|0;if(!f){Gk(g,g,c[e+16>>2]|0);break}else{Jk(g,g,f);break}}while(0);g=b+8|0;h=c[g>>2]|0;Kk(h,c[n>>2]|0,c[k>>2]|0);f=c[j>>2]|0;if(!f)Gk(h,h,c[e+16>>2]|0);else Jk(h,h,f);f=c[g>>2]|0;uk(f,f,1);g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);h=e+68|0;g=c[h>>2]|0;f=c[n>>2]|0;Kk(g,f,f);f=c[j>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);n=e+80|0;g=c[n>>2]|0;Kk(g,c[h>>2]|0,c[d>>2]|0);f=c[j>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);f=c[n>>2]|0;Kk(f,f,Ml(4)|0);g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);f=c[b>>2]|0;k=e+76|0;g=c[k>>2]|0;Kk(f,g,g);g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);f=c[o>>2]|0;uk(f,c[n>>2]|0,1);g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);f=c[b>>2]|0;hk(f,f,c[o>>2]|0);f=c[h>>2]|0;Kk(f,f,f);g=c[j>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);i=e+84|0;g=c[i>>2]|0;f=c[h>>2]|0;Kk(g,f,Ml(5)|0);f=c[j>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);h=b+4|0;hk(c[h>>2]|0,c[n>>2]|0,c[b>>2]|0);g=c[h>>2]|0;Kk(g,g,c[k>>2]|0);f=c[j>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);e=c[h>>2]|0;hk(e,e,c[i>>2]|0);l=r;return}El(c[b>>2]|0,1)|0;El(c[b+4>>2]|0,1)|0;El(c[b+8>>2]|0,0)|0;l=r;return}case 1:{c[f>>2]=45508;c[f+4>>2]=45456;Me(45482,f);break}case 2:{p=e+64|0;f=c[p>>2]|0;h=d+4|0;fk(f,c[d>>2]|0,c[h>>2]|0);q=e+60|0;g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);f=c[p>>2]|0;Kk(f,f,f);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);n=e+68|0;f=c[n>>2]|0;g=c[d>>2]|0;Kk(f,g,g);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);o=e+72|0;g=c[o>>2]|0;f=c[h>>2]|0;Kk(g,f,f);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);j=e+76|0;f=c[j>>2]|0;do if((c[e+4>>2]|0)!=1){Kk(f,c[e+20>>2]|0,c[n>>2]|0);g=c[q>>2]|0;if(!g){Gk(f,f,c[e+16>>2]|0);break}else{Jk(f,f,g);break}}else{Al(f,c[n>>2]|0)|0;k=c[j>>2]|0;zl(k,k)}while(0);k=e+80|0;f=c[k>>2]|0;fk(f,c[j>>2]|0,c[o>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);h=e+84|0;g=c[h>>2]|0;f=c[d+8>>2]|0;Kk(g,f,f);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);i=e+88|0;g=c[i>>2]|0;uk(g,c[h>>2]|0,1);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);f=c[i>>2]|0;hk(f,c[k>>2]|0,f);hk(c[b>>2]|0,c[p>>2]|0,c[n>>2]|0);f=c[b>>2]|0;hk(f,f,c[o>>2]|0);f=c[b>>2]|0;Kk(f,f,c[i>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);f=b+4|0;hk(c[f>>2]|0,c[j>>2]|0,c[o>>2]|0);f=c[f>>2]|0;Kk(f,f,c[k>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);g=c[b+8>>2]|0;Kk(g,c[k>>2]|0,c[i>>2]|0);f=c[q>>2]|0;if(!f){Gk(g,g,c[e+16>>2]|0);l=r;return}else{Jk(g,g,f);l=r;return}}default:{l=r;return}}}function ak(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=v+8|0;u=v;switch(c[f>>2]|0){case 0:{if(((wk(c[d>>2]|0,c[e>>2]|0)|0)==0?(wk(c[d+4>>2]|0,c[e+4>>2]|0)|0)==0:0)?(wk(c[d+8>>2]|0,c[e+8>>2]|0)|0)==0:0){$j(b,d,f);l=v;return}p=d+8|0;if(!(vk(c[p>>2]|0,0)|0)){Al(c[b>>2]|0,c[e>>2]|0)|0;Al(c[b+4>>2]|0,c[e+4>>2]|0)|0;Al(c[b+8>>2]|0,c[e+8>>2]|0)|0;l=v;return}q=e+8|0;if(!(vk(c[q>>2]|0,0)|0)){Al(c[b>>2]|0,c[d>>2]|0)|0;Al(c[b+4>>2]|0,c[d+4>>2]|0)|0;Al(c[b+8>>2]|0,c[p>>2]|0)|0;l=v;return}j=(vk(c[p>>2]|0,1)|0)==0;t=(vk(c[q>>2]|0,1)|0)==0;n=f+64|0;g=c[n>>2]|0;do if(!t){i=c[q>>2]|0;Kk(g,i,i);i=f+60|0;h=c[i>>2]|0;if(!h)Gk(g,g,c[f+16>>2]|0);else Jk(g,g,h);h=c[n>>2]|0;Kk(h,h,c[d>>2]|0);g=c[i>>2]|0;if(!g){Gk(h,h,c[f+16>>2]|0);break}else{Jk(h,h,g);break}}else Al(g,c[d>>2]|0)|0;while(0);k=f+68|0;h=c[k>>2]|0;do if(!j){i=c[p>>2]|0;Kk(h,i,i);i=f+60|0;g=c[i>>2]|0;if(!g)Gk(h,h,c[f+16>>2]|0);else Jk(h,h,g);g=c[k>>2]|0;Kk(g,g,c[e>>2]|0);h=c[i>>2]|0;if(!h){Gk(g,g,c[f+16>>2]|0);s=i;break}else{Jk(g,g,h);s=i;break}}else{Al(h,c[e>>2]|0)|0;s=f+60|0}while(0);r=f+72|0;hk(c[r>>2]|0,c[n>>2]|0,c[k>>2]|0);j=f+76|0;h=c[j>>2]|0;g=c[q>>2]|0;t=f+16|0;Mk(h,g,Ml(3)|0,c[t>>2]|0);g=c[j>>2]|0;Kk(g,g,c[d+4>>2]|0);h=c[s>>2]|0;if(!h)Gk(g,g,c[t>>2]|0);else Jk(g,g,h);i=f+80|0;g=c[i>>2]|0;h=c[p>>2]|0;Mk(g,h,Ml(3)|0,c[t>>2]|0);h=c[i>>2]|0;Kk(h,h,c[e+4>>2]|0);g=c[s>>2]|0;if(!g)Gk(h,h,c[t>>2]|0);else Jk(h,h,g);o=f+84|0;hk(c[o>>2]|0,c[j>>2]|0,c[i>>2]|0);if(!(vk(c[r>>2]|0,0)|0))if(!(vk(c[o>>2]|0,0)|0)){$j(b,d,f);l=v;return}else{El(c[b>>2]|0,1)|0;El(c[b+4>>2]|0,1)|0;El(c[b+8>>2]|0,0)|0;l=v;return}e=f+88|0;h=c[e>>2]|0;fk(h,c[n>>2]|0,c[k>>2]|0);g=c[s>>2]|0;if(!g)Gk(h,h,c[t>>2]|0);else Jk(h,h,g);d=f+92|0;h=c[d>>2]|0;fk(h,c[j>>2]|0,c[i>>2]|0);g=c[s>>2]|0;if(!g)Gk(h,h,c[t>>2]|0);else Jk(h,h,g);h=b+8|0;i=c[h>>2]|0;Kk(i,c[p>>2]|0,c[q>>2]|0);g=c[s>>2]|0;if(!g)Gk(i,i,c[t>>2]|0);else Jk(i,i,g);g=c[h>>2]|0;Kk(g,g,c[r>>2]|0);h=c[s>>2]|0;if(!h)Gk(g,g,c[t>>2]|0);else Jk(g,g,h);k=f+100|0;g=c[k>>2]|0;h=c[o>>2]|0;Kk(g,h,h);h=c[s>>2]|0;if(!h)Gk(g,g,c[t>>2]|0);else Jk(g,g,h);j=f+104|0;g=c[j>>2]|0;h=c[r>>2]|0;Kk(g,h,h);h=c[s>>2]|0;if(!h)Gk(g,g,c[t>>2]|0);else Jk(g,g,h);h=c[j>>2]|0;Kk(h,h,c[e>>2]|0);g=c[s>>2]|0;if(!g)Gk(h,h,c[t>>2]|0);else Jk(h,h,g);hk(c[b>>2]|0,c[k>>2]|0,c[j>>2]|0);g=c[k>>2]|0;uk(g,c[b>>2]|0,1);h=c[s>>2]|0;if(!h)Gk(g,g,c[t>>2]|0);else Jk(g,g,h);i=f+96|0;hk(c[i>>2]|0,c[j>>2]|0,c[k>>2]|0);h=c[i>>2]|0;Kk(h,h,c[o>>2]|0);g=c[s>>2]|0;if(!g)Gk(h,h,c[t>>2]|0);else Jk(h,h,g);g=c[k>>2]|0;h=c[r>>2]|0;Mk(g,h,Ml(3)|0,c[t>>2]|0);h=c[k>>2]|0;Kk(h,h,c[d>>2]|0);g=c[s>>2]|0;if(!g)Gk(h,h,c[t>>2]|0);else Jk(h,h,g);j=b+4|0;hk(c[j>>2]|0,c[i>>2]|0,c[k>>2]|0);j=c[j>>2]|0;g=f+48|0;h=a[g>>0]|0;do if(!(h&2)){a[g>>0]=h|2;g=f+56|0;h=c[g>>2]|0;if(!h){h=ll(0)|0;c[g>>2]=h}i=Ml(2)|0;if(Fk(h,i,c[t>>2]|0)|0)break;Le(45341,u);Se(45375,i);Se(45379,c[t>>2]|0)}else g=f+56|0;while(0);Kk(j,j,c[g>>2]|0);g=c[s>>2]|0;if(!g){Gk(j,j,c[t>>2]|0);l=v;return}else{Jk(j,j,g);l=v;return}}case 1:{c[g>>2]=45531;c[g+4>>2]=45456;Me(45482,g);break}case 2:{bk(b,d,e,f);l=v;return}default:{l=v;return}}}function bk(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;p=e+64|0;g=c[p>>2]|0;Kk(g,c[b+8>>2]|0,c[d+8>>2]|0);q=e+60|0;f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);j=e+68|0;f=c[j>>2]|0;g=c[p>>2]|0;Kk(f,g,g);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);o=e+72|0;f=c[o>>2]|0;Kk(f,c[b>>2]|0,c[d>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);n=e+76|0;f=c[n>>2]|0;i=b+4|0;k=d+4|0;Kk(f,c[i>>2]|0,c[k>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);h=e+80|0;f=c[h>>2]|0;Kk(f,c[e+24>>2]|0,c[o>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);f=c[h>>2]|0;Kk(f,f,c[n>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);l=e+84|0;hk(c[l>>2]|0,c[j>>2]|0,c[h>>2]|0);m=e+88|0;g=c[m>>2]|0;fk(g,c[j>>2]|0,c[h>>2]|0);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);h=e+92|0;g=c[h>>2]|0;fk(g,c[b>>2]|0,c[i>>2]|0);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);g=c[a>>2]|0;fk(g,c[d>>2]|0,c[k>>2]|0);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);g=c[a>>2]|0;Kk(g,g,c[h>>2]|0);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);f=c[a>>2]|0;hk(f,f,c[o>>2]|0);f=c[a>>2]|0;hk(f,f,c[n>>2]|0);f=c[a>>2]|0;Kk(f,f,c[l>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);g=c[a>>2]|0;Kk(g,g,c[p>>2]|0);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);h=a+4|0;g=c[h>>2]|0;if((c[e+4>>2]|0)==1){Al(g,c[o>>2]|0)|0;o=c[h>>2]|0;zl(o,o);o=c[h>>2]|0;hk(o,c[n>>2]|0,o)}else{Kk(g,c[e+20>>2]|0,c[o>>2]|0);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);o=c[h>>2]|0;hk(o,c[n>>2]|0,o)}f=c[h>>2]|0;Kk(f,f,c[m>>2]|0);g=c[q>>2]|0;if(!g)Gk(f,f,c[e+16>>2]|0);else Jk(f,f,g);g=c[h>>2]|0;Kk(g,g,c[p>>2]|0);f=c[q>>2]|0;if(!f)Gk(g,g,c[e+16>>2]|0);else Jk(g,g,f);g=c[a+8>>2]|0;Kk(g,c[l>>2]|0,c[m>>2]|0);f=c[q>>2]|0;if(!f){Gk(g,g,c[e+16>>2]|0);return}else{Jk(g,g,f);return}}function ck(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;Q=l;l=l+96|0;if((l|0)>=(m|0))$(96);n=Q+24|0;k=Q+16|0;g=Q+8|0;N=Q;O=Q+76|0;P=Q+64|0;C=Q+52|0;o=Q+40|0;h=Q+28|0;switch(c[e>>2]|0){case 2:{f=lk(b)|0;El(c[a>>2]|0,0)|0;g=a+4|0;El(c[g>>2]|0,1)|0;h=a+8|0;El(c[h>>2]|0,1)|0;if(b|0?c[b+12>>2]&1|0:0){i=Hl(0)|0;c[o>>2]=i;j=Hl(0)|0;c[o+4>>2]=j;k=Hl(0)|0;c[o+8>>2]=k;f=f+-1|0;if((f|0)>-1)do{$j(a,a,e);ak(o,a,d,e);if(mk(b,f)|0){Al(c[a>>2]|0,i)|0;Al(c[g>>2]|0,j)|0;Al(c[h>>2]|0,k)|0}f=f+-1|0}while((f|0)>-1);tl(i);tl(j);tl(k);l=Q;return}f=f+-1|0;if((f|0)<=-1){l=Q;return}do{$j(a,a,e);if(mk(b,f)|0)ak(a,a,d,e);f=f+-1|0}while((f|0)>-1);l=Q;return}case 1:{t=lk(b)|0;x=Hl(0)|0;c[O>>2]=x;y=Hl(0)|0;z=O+4|0;c[z>>2]=y;A=Hl(0)|0;B=O+8|0;c[B>>2]=A;M=Hl(0)|0;C=Hl(0)|0;D=P+4|0;c[D>>2]=C;E=Hl(0)|0;F=P+8|0;c[F>>2]=E;G=Hl(0)|0;c[o>>2]=G;H=Hl(0)|0;c[o+4>>2]=H;I=Hl(0)|0;c[o+8>>2]=I;J=Hl(0)|0;c[h>>2]=J;K=Hl(0)|0;c[h+4>>2]=K;L=Hl(0)|0;c[h+8>>2]=L;El(x,1)|0;tl(M);M=yl(c[d>>2]|0)|0;c[P>>2]=M;El(E,1)|0;f=(((t<<1)+62|0)>>>5)+1|0;ql(x,f);ql(A,f);ql(M,f);ql(E,f);ql(G,f);ql(I,f);ql(J,f);ql(L,f);f=t+-1|0;if((f|0)>-1){u=e+60|0;v=e+16|0;w=e+20|0;r=P;s=O;p=h;while(1){q=mk(b,f)|0;Gl(c[s>>2]|0,c[r>>2]|0,q);n=s+8|0;i=r+8|0;Gl(c[n>>2]|0,c[i>>2]|0,q);k=c[d>>2]|0;g=c[p>>2]|0;fk(g,c[r>>2]|0,c[i>>2]|0);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);g=c[i>>2]|0;hk(g,c[r>>2]|0,g);g=c[o>>2]|0;fk(g,c[s>>2]|0,c[n>>2]|0);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);g=c[n>>2]|0;hk(g,c[s>>2]|0,g);g=c[r>>2]|0;Kk(g,c[n>>2]|0,c[p>>2]|0);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);h=c[i>>2]|0;Kk(h,c[o>>2]|0,h);g=c[u>>2]|0;if(!g)Gk(h,h,c[v>>2]|0);else Jk(h,h,g);g=c[s>>2]|0;h=c[o>>2]|0;Kk(g,h,h);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);g=c[n>>2]|0;Kk(g,g,g);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);g=c[p>>2]|0;fk(g,c[r>>2]|0,c[i>>2]|0);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);g=c[i>>2]|0;hk(g,c[r>>2]|0,g);g=c[o>>2]|0;Kk(g,c[s>>2]|0,c[n>>2]|0);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);g=c[n>>2]|0;hk(g,c[s>>2]|0,g);g=c[p>>2]|0;Kk(g,g,g);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);j=p+8|0;h=c[j>>2]|0;g=c[i>>2]|0;Kk(h,g,g);g=c[u>>2]|0;if(!g)Gk(h,h,c[v>>2]|0);else Jk(h,h,g);i=o+8|0;g=c[i>>2]|0;Kk(g,c[n>>2]|0,c[w>>2]|0);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);h=c[j>>2]|0;Kk(h,h,k);g=c[u>>2]|0;if(!g)Gk(h,h,c[v>>2]|0);else Jk(h,h,g);g=c[i>>2]|0;fk(g,c[s>>2]|0,g);h=c[u>>2]|0;if(!h)Gk(g,g,c[v>>2]|0);else Jk(g,g,h);h=c[i>>2]|0;Kk(h,h,c[n>>2]|0);g=c[u>>2]|0;if(!g)Gk(h,h,c[v>>2]|0);else Jk(h,h,g);Gl(c[o>>2]|0,c[p>>2]|0,q);Gl(c[i>>2]|0,c[j>>2]|0,q);f=f+-1|0;if((f|0)<=-1)break;else{n=p;q=s;p=r;s=o;r=n;o=q}}}rl(c[a+4>>2]|0);d=t&1;Gl(x,G,d);Gl(A,I,d);if(!(c[A+4>>2]|0)){El(c[a>>2]|0,1)|0;El(c[a+8>>2]|0,0)|0}else{h=Hl(0)|0;i=e+16|0;if(!(Fk(h,A,c[i>>2]|0)|0)){Le(45341,N);Se(45375,A);Se(45379,c[i>>2]|0)}g=c[a>>2]|0;Kk(g,x,h);f=c[e+60>>2]|0;if(!f)Gk(g,g,c[i>>2]|0);else Jk(g,g,f);El(c[a+8>>2]|0,1)|0;tl(h)}tl(x);c[O>>2]=0;tl(y);c[z>>2]=0;tl(A);c[B>>2]=0;tl(M);c[P>>2]=0;tl(C);c[D>>2]=0;tl(E);c[F>>2]=0;tl(G);tl(H);tl(I);tl(J);tl(K);tl(L);l=Q;return}default:{y=e+16|0;z=Bl(c[y>>2]|0)|0;A=Bl(c[y>>2]|0)|0;B=Bl(c[y>>2]|0)|0;x=yl(b)|0;o=yl(c[d+4>>2]|0)|0;f=x+8|0;if(c[f>>2]|0?(c[f>>2]=0,(Fk(o,o,c[y>>2]|0)|0)==0):0){Le(45341,g);Se(45375,o);Se(45379,c[y>>2]|0)}j=d+8|0;if(!(vk(c[j>>2]|0,1)|0)){Al(z,c[d>>2]|0)|0;Al(A,o)|0}else{h=Bl(c[y>>2]|0)|0;i=Bl(c[y>>2]|0)|0;g=c[j>>2]|0;Kk(h,g,g);g=e+60|0;f=c[g>>2]|0;if(!f)Gk(h,h,c[y>>2]|0);else Jk(h,h,f);Kk(i,c[j>>2]|0,h);f=c[g>>2]|0;if(!f)Gk(i,i,c[y>>2]|0);else Jk(i,i,f);if(!(Fk(h,h,c[y>>2]|0)|0)){Le(45341,k);Se(45375,h);Se(45379,c[y>>2]|0)}Kk(z,c[d>>2]|0,h);f=c[g>>2]|0;if(!f)Gk(z,z,c[y>>2]|0);else Jk(z,z,f);if(!(Fk(i,i,c[y>>2]|0)|0)){Le(45341,n);Se(45375,i);Se(45379,c[y>>2]|0)}Kk(A,o,i);f=c[g>>2]|0;if(!f)Gk(A,A,c[y>>2]|0);else Jk(A,A,f);tl(h);tl(i)}w=yl(Ml(1)|0)|0;Kk(B,x,Ml(3)|0);f=lk(B)|0;g=c[a>>2]|0;if(f>>>0<2){rl(g);rl(c[a+4>>2]|0);rl(c[a+8>>2]|0);f=0}else{Al(g,c[d>>2]|0)|0;Al(c[a+4>>2]|0,o)|0;Al(c[a+8>>2]|0,c[j>>2]|0)|0;f=f+-2|0}tl(o);c[O>>2]=z;g=O+4|0;c[g>>2]=A;h=O+8|0;c[h>>2]=w;i=Hl(0)|0;c[P>>2]=i;j=Hl(0)|0;k=P+4|0;c[k>>2]=j;n=Hl(0)|0;o=P+8|0;c[o>>2]=n;p=Hl(0)|0;c[C>>2]=p;q=Hl(0)|0;r=C+4|0;c[r>>2]=q;s=Hl(0)|0;t=C+8|0;c[t>>2]=s;if(f|0){u=a+4|0;v=a+8|0;do{$j(a,a,e);if((mk(B,f)|0)==1?(mk(x,f)|0)==0:0){Al(i,c[a>>2]|0)|0;Al(j,c[u>>2]|0)|0;Al(n,c[v>>2]|0)|0;ak(a,P,O,e)}if((mk(B,f)|0)==0?(mk(x,f)|0)==1:0){Al(i,c[a>>2]|0)|0;Al(j,c[u>>2]|0)|0;Al(n,c[v>>2]|0)|0;Al(p,z)|0;Al(q,A)|0;Al(s,w)|0;hk(q,c[y>>2]|0,q);ak(a,P,C,e)}f=f+-1|0}while((f|0)!=0)}tl(z);c[O>>2]=0;tl(A);c[g>>2]=0;tl(w);c[h>>2]=0;tl(i);c[P>>2]=0;tl(j);c[k>>2]=0;tl(n);c[o>>2]=0;tl(p);c[C>>2]=0;tl(q);c[r>>2]=0;tl(s);c[t>>2]=0;tl(B);tl(x);l=Q;return}}}function dk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;g=Hl(0)|0;h=Hl(0)|0;i=Hl(0)|0;switch(c[b>>2]|0){case 0:{f=Hl(0)|0;if(Nj(g,h,a,b)|0){i=0;return i|0}Kk(h,h,h);e=b+60|0;a=c[e>>2]|0;if(!a){d=b+16|0;Gk(h,h,c[d>>2]|0)}else{Jk(h,h,a);d=b+16|0}Mk(f,g,Ml(3)|0,c[d>>2]|0);Kk(i,c[b+20>>2]|0,g);a=c[e>>2]|0;if(!a)Gk(i,i,c[d>>2]|0);else Jk(i,i,a);fk(i,i,c[b+24>>2]|0);a=c[e>>2]|0;if(!a)Gk(i,i,c[d>>2]|0);else Jk(i,i,a);fk(i,i,f);a=c[e>>2]|0;if(!a)Gk(i,i,c[d>>2]|0);else Jk(i,i,a);a=(wk(h,i)|0)==0&1;Jl(f);break}case 1:{if(Nj(g,0,a,b)|0){i=0;return i|0}Kk(i,c[b+20>>2]|0,Ml(4)|0);d=b+60|0;a=c[d>>2]|0;if(!a)Gk(i,i,c[b+16>>2]|0);else Jk(i,i,a);fk(i,i,Ml(2)|0);a=c[d>>2]|0;if(!a)Gk(i,i,c[b+16>>2]|0);else Jk(i,i,a);Kk(i,i,g);a=c[d>>2]|0;if(!a)Gk(i,i,c[b+16>>2]|0);else Jk(i,i,a);Kk(h,g,g);a=c[d>>2]|0;if(!a)Gk(h,h,c[b+16>>2]|0);else Jk(h,h,a);fk(i,i,h);a=c[d>>2]|0;if(!a)Gk(i,i,c[b+16>>2]|0);else Jk(i,i,a);fk(i,i,Ml(1)|0);a=c[d>>2]|0;if(!a)Gk(i,i,c[b+16>>2]|0);else Jk(i,i,a);Kk(i,i,g);a=c[d>>2]|0;if(!a)Gk(i,i,c[b+16>>2]|0);else Jk(i,i,a);Kk(i,i,c[b+24>>2]|0);a=c[d>>2]|0;if(!a){a=b+16|0;Gk(i,i,c[a>>2]|0)}else{Jk(i,i,a);a=b+16|0}hk(h,c[a>>2]|0,Ml(1)|0);sk(h,h,1);Mk(i,i,h,c[a>>2]|0);a=vk(i,1)|0;break}case 2:{if(Nj(g,h,a,b)|0){i=0;return i|0}Kk(g,g,g);d=b+60|0;a=c[d>>2]|0;if(!a)Gk(g,g,c[b+16>>2]|0);else Jk(g,g,a);Kk(h,h,h);a=c[d>>2]|0;if(!a)Gk(h,h,c[b+16>>2]|0);else Jk(h,h,a);do if((c[b+4>>2]|0)!=1){Kk(i,c[b+20>>2]|0,g);a=c[d>>2]|0;if(!a){Gk(i,i,c[b+16>>2]|0);break}else{Jk(i,i,a);break}}else{Al(i,g)|0;zl(i,i)}while(0);fk(i,i,h);a=c[d>>2]|0;if(!a)Gk(i,i,c[b+16>>2]|0);else Jk(i,i,a);hk(i,i,Ml(1)|0);Kk(g,g,h);a=c[d>>2]|0;if(!a)Gk(g,g,c[b+16>>2]|0);else Jk(g,g,a);Kk(g,g,c[b+24>>2]|0);a=c[d>>2]|0;if(!a)Gk(g,g,c[b+16>>2]|0);else Jk(g,g,a);hk(i,i,g);a=(vk(i,0)|0)==0&1;break}default:a=0}Jl(i);Jl(g);Jl(h);i=a;return i|0}function ek(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;o=c[b+4>>2]|0;e=c[b+8>>2]|0;if((c[a>>2]|0)<=(o|0))ql(a,o+1|0);g=c[b+16>>2]|0;n=c[a+16>>2]|0;if(!o){c[n>>2]=d;m=(d|0)!=0&1;n=0;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}if(!e){f=g+4|0;k=c[g>>2]|0;j=k+d|0;e=n+4|0;c[n>>2]=j;a:do if(j>>>0>>0){b=o;while(1){b=b+-1|0;if(!b){b=1;break a}g=f+4|0;k=(c[f>>2]|0)+1|0;d=e+4|0;c[e>>2]=k;if(!k){f=g;e=d}else{f=g;e=d;m=9;break}}}else{b=o;m=9}while(0);if((m|0)==9)if((e|0)!=(f|0)?(l=b+-1|0,(b|0)>1):0){b=0;do{c[e+(b<<2)>>2]=c[f+(b<<2)>>2];b=b+1|0}while((b|0)!=(l|0));b=0}else b=0;c[n+(o<<2)>>2]=b;m=b+o|0;n=0;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}b=c[g>>2]|0;if((o|0)==1&b>>>0>>0){c[n>>2]=d-b;m=1;n=0;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}e=g+4|0;l=b-d|0;f=n+4|0;c[n>>2]=l;b:do if(l>>>0>b>>>0){b=o;while(1){b=b+-1|0;if(!b)break b;g=e+4|0;l=c[e>>2]|0;d=f+4|0;c[f>>2]=l+-1;if(!l){e=g;f=d}else{h=b;i=g;j=d;m=18;break}}}else{h=o;i=e;j=f;m=18}while(0);if(((m|0)==18?(j|0)!=(i|0):0)?(k=h+-1|0,(h|0)>1):0){b=0;do{c[j+(b<<2)>>2]=c[i+(b<<2)>>2];b=b+1|0}while((b|0)!=(k|0))}m=o-((c[n+(o+-1<<2)>>2]|0)==0&1)|0;n=1;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}function fk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=c[b+4>>2]|0;h=c[d+4>>2]|0;if((e|0)<(h|0)){g=c[d+8>>2]|0;f=c[b+8>>2]|0;if((c[a>>2]|0)>(h|0)){p=g;i=e;e=h;g=b;b=d}else{ql(a,h+1|0);p=g;i=e;e=h;g=b;b=d}}else{g=c[b+8>>2]|0;f=c[d+8>>2]|0;if((c[a>>2]|0)>(e|0)){p=g;i=h;g=d}else{ql(a,e+1|0);p=g;i=h;g=d}}d=c[b+16>>2]|0;g=c[g+16>>2]|0;o=c[a+16>>2]|0;if(!i){if((e|0)>0)b=0;else{n=e;o=a+4|0;c[o>>2]=n;a=a+8|0;c[a>>2]=p;return}do{c[o+(b<<2)>>2]=c[d+(b<<2)>>2];b=b+1|0}while((b|0)!=(e|0));b=p;p=a+4|0;c[p>>2]=e;a=a+8|0;c[a>>2]=b;return}if((p|0)==(f|0)){b=Wk(o,d,g,i)|0;h=e-i|0;a:do if(h){k=o+(i<<2)|0;m=d+(i<<2)|0;g=m+4|0;m=c[m>>2]|0;l=m+b|0;f=k+4|0;c[k>>2]=l;if(l>>>0>>0){b=h;while(1){b=b+-1|0;if(!b){b=1;break a}h=g+4|0;m=(c[g>>2]|0)+1|0;d=f+4|0;c[f>>2]=m;if(!m){g=h;f=d}else{g=h;f=d;break}}}else b=h;if((f|0)!=(g|0)?(n=b+-1|0,(b|0)>1):0){b=0;do{c[f+(b<<2)>>2]=c[g+(b<<2)>>2];b=b+1|0}while((b|0)!=(n|0));b=0}else b=0}while(0);c[o+(e<<2)>>2]=b;p=(p|0)!=0&1;n=b+e|0;o=a+4|0;c[o>>2]=n;a=a+8|0;c[a>>2]=p;return}if((e|0)!=(i|0)){b=hl(o,d,g,i)|0;h=e-i|0;b:do if(h){k=o+(i<<2)|0;n=d+(i<<2)|0;g=n+4|0;n=c[n>>2]|0;l=n-b|0;f=k+4|0;c[k>>2]=l;if(l>>>0>n>>>0){b=h;while(1){b=b+-1|0;if(!b)break b;h=g+4|0;n=c[g>>2]|0;d=f+4|0;c[f>>2]=n+-1;if(!n){g=h;f=d}else{g=h;f=d;break}}}else b=h;if((f|0)!=(g|0)?(m=b+-1|0,(b|0)>1):0){b=0;do{c[f+(b<<2)>>2]=c[g+(b<<2)>>2];b=b+1|0}while((b|0)!=(m|0))}}while(0);while(1){if((e|0)<=0){b=p;l=39;break}b=e+-1|0;if(!(c[o+(b<<2)>>2]|0))e=b;else{b=p;l=39;break}}if((l|0)==39){p=a+4|0;c[p>>2]=e;a=a+8|0;c[a>>2]=b;return}}else b=e;while(1){if((b|0)<=0)break;b=b+-1|0;j=c[d+(b<<2)>>2]|0;k=c[g+(b<<2)>>2]|0;if((j|0)!=(k|0)){l=22;break}}if((l|0)==22?j>>>0<=k>>>0:0){hl(o,g,d,e)|0;while(1){if((e|0)<=0)break;b=e+-1|0;if(!(c[o+(b<<2)>>2]|0))e=b;else break}p=(p|0)==0&1;n=e;o=a+4|0;c[o>>2]=n;a=a+8|0;c[a>>2]=p;return}hl(o,d,g,e)|0;while(1){if((e|0)<=0)break;b=e+-1|0;if(!(c[o+(b<<2)>>2]|0))e=b;else break}p=(p|0)!=0&1;n=e;o=a+4|0;c[o>>2]=n;a=a+8|0;c[a>>2]=p;return}function gk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;o=c[b+4>>2]|0;e=c[b+8>>2]|0;if((c[a>>2]|0)<=(o|0))ql(a,o+1|0);g=c[b+16>>2]|0;n=c[a+16>>2]|0;if(!o){c[n>>2]=d;m=(d|0)!=0&1;n=1;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}if(e|0){f=g+4|0;k=c[g>>2]|0;j=k+d|0;e=n+4|0;c[n>>2]=j;a:do if(j>>>0>>0){b=o;while(1){b=b+-1|0;if(!b){b=1;break a}g=f+4|0;k=(c[f>>2]|0)+1|0;d=e+4|0;c[e>>2]=k;if(!k){f=g;e=d}else{f=g;e=d;m=9;break}}}else{b=o;m=9}while(0);if((m|0)==9)if((e|0)!=(f|0)?(l=b+-1|0,(b|0)>1):0){b=0;do{c[e+(b<<2)>>2]=c[f+(b<<2)>>2];b=b+1|0}while((b|0)!=(l|0));b=0}else b=0;c[n+(o<<2)>>2]=b;m=b+o|0;n=0;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}b=c[g>>2]|0;if((o|0)==1&b>>>0>>0){c[n>>2]=d-b;m=1;n=1;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}e=g+4|0;l=b-d|0;f=n+4|0;c[n>>2]=l;b:do if(l>>>0>b>>>0){b=o;while(1){b=b+-1|0;if(!b)break b;g=e+4|0;l=c[e>>2]|0;d=f+4|0;c[f>>2]=l+-1;if(!l){e=g;f=d}else{h=b;i=g;j=d;m=18;break}}}else{h=o;i=e;j=f;m=18}while(0);if(((m|0)==18?(j|0)!=(i|0):0)?(k=h+-1|0,(h|0)>1):0){b=0;do{c[j+(b<<2)>>2]=c[i+(b<<2)>>2];b=b+1|0}while((b|0)!=(k|0))}m=o-((c[n+(o+-1<<2)>>2]|0)==0&1)|0;n=0;o=a+4|0;c[o>>2]=m;o=a+8|0;c[o>>2]=n;return}function hk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;d=yl(d)|0;e=d+8|0;c[e>>2]=(c[e>>2]|0)==0&1;fk(a,b,d);tl(d);return}function ik(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;fk(a,b,c);Gk(a,a,d);return}function jk(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;d=yl(d)|0;f=d+8|0;c[f>>2]=(c[f>>2]|0)==0&1;fk(a,b,d);tl(d);Gk(a,a,e);return}function kk(a){a=a|0;var b=0,d=0,e=0;if(a|0?c[a+12>>2]&4|0:0)return;e=a+4|0;d=c[e>>2]|0;if(!d)return;b=c[a+16>>2]|0;a=d;while(1){a=a+-1|0;if(c[b+(a<<2)>>2]|0){a=7;break}c[e>>2]=a;if(!a){a=7;break}}if((a|0)==7)return}function lk(a){a=a|0;var b=0,e=0,f=0,g=0,h=0;if(a|0?c[a+12>>2]&4|0:0){h=c[a+8>>2]|0;return h|0}h=a+4|0;b=c[h>>2]|0;if(!b){h=0;return h|0}f=c[a+16>>2]|0;while(1){e=b+-1|0;if(c[f+(e<<2)>>2]|0)break;c[h>>2]=e;if(!e){b=0;g=11;break}else b=e}if((g|0)==11)return b|0;b=c[(c[a+16>>2]|0)+(b+-1<<2)>>2]|0;if(!b)b=32;else{g=b>>>0<65536?(b>>>0<256?0:8):b>>>0<16777216?16:24;b=32-g-(d[45555+(b>>>g)>>0]|0)|0}h=(c[h>>2]<<5)-b|0;return h|0}function mk(a,b){a=a|0;b=b|0;var d=0;d=b>>>5;if(d>>>0>=(c[a+4>>2]|0)>>>0){d=0;return d|0}d=(c[(c[a+16>>2]|0)+(d<<2)>>2]&1<<(b&31)|0)!=0&1;return d|0}function nk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;if(a|0?c[a+12>>2]&16|0:0){sl();return}g=b>>>5;e=b&31;f=a+4|0;b=c[f>>2]|0;if(g>>>0>=b>>>0){if(b>>>0<(c[a>>2]|0)>>>0){d=c[a+16>>2]|0;do{c[d+(b<<2)>>2]=0;b=b+1|0}while(b>>>0<(c[a>>2]|0)>>>0)}d=g+1|0;ql(a,d);c[f>>2]=d}g=(c[a+16>>2]|0)+(g<<2)|0;c[g>>2]=c[g>>2]|1<>2]&16|0:0){sl();return}g=b>>>5;e=b&31;f=a+4|0;b=c[f>>2]|0;if(g>>>0>=b>>>0){if(b>>>0<(c[a>>2]|0)>>>0){d=c[a+16>>2]|0;do{c[d+(b<<2)>>2]=0;b=b+1|0}while(b>>>0<(c[a>>2]|0)>>>0)}d=g+1|0;ql(a,d);c[f>>2]=d}a=(c[a+16>>2]|0)+(g<<2)|0;d=c[a>>2]|1<>2]=d;b=e+1|0;if(b>>>0<32){do{d=d&~(1<>2]=d}c[f>>2]=g+1;return}function pk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;if(a|0?c[a+12>>2]&16|0:0){sl();return}e=b>>>5;f=a+4|0;if(e>>>0>=(c[f>>2]|0)>>>0)return;d=(c[a+16>>2]|0)+(e<<2)|0;a=b&31;b=c[d>>2]|0;do{b=b&~(1<>2]=b;c[f>>2]=e+1;return}function qk(a,b){a=a|0;b=b|0;var d=0;if(a|0?c[a+12>>2]&16|0:0){sl();return}d=b>>>5;if(d>>>0>=(c[a+4>>2]|0)>>>0)return;d=(c[a+16>>2]|0)+(d<<2)|0;c[d>>2]=c[d>>2]&~(1<<(b&31));return}function rk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;e=c[a+16>>2]|0;f=a+4|0;d=c[f>>2]|0;if(a|0?c[a+12>>2]&16|0:0){sl();return}if(d>>>0<=b>>>0){c[f>>2]=0;return}a=d-b|0;if(!a)a=0;else{d=0;do{c[e+(d<<2)>>2]=c[e+(d+b<<2)>>2];d=d+1|0}while((d|0)!=(a|0))}c[e+(a<<2)>>2]=0;c[f>>2]=(c[f>>2]|0)-b;return}function sk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;h=d>>>5;i=d&31;if(a|0?c[a+12>>2]&16|0:0){sl();return}a:do if((a|0)==(b|0)){f=a+4|0;d=c[f>>2]|0;if(h>>>0>=d>>>0){c[f>>2]=0;return}if(h){e=c[a+16>>2]|0;d=0;do{c[e+(d<<2)>>2]=c[e+(d+h<<2)>>2];d=d+1|0}while(d>>>0<((c[f>>2]|0)-h|0)>>>0);c[e+(d<<2)>>2]=0;d=(c[f>>2]|0)-h|0;c[f>>2]=d}if((i|0)!=0&(d|0)!=0){h=c[a+16>>2]|0;gl(h,h,d,i)|0}}else{g=b+4|0;e=c[g>>2]|0;c[a+8>>2]=c[b+8>>2];d=(c[a>>2]|0)<(e|0);if(!h){if(d)ql(a,e);f=a+4|0;c[f>>2]=e;if(!e)break;if(i|0){gl(c[a+16>>2]|0,c[b+16>>2]|0,e,i)|0;break}e=c[b+16>>2]|0;b=c[a+16>>2]|0;d=0;while(1){c[b+(d<<2)>>2]=c[e+(d<<2)>>2];d=d+1|0;if(d>>>0>=(c[f>>2]|0)>>>0)break a}}if(d)ql(a,e);f=a+4|0;c[f>>2]=e;if(!(c[g>>2]|0))d=0;else{e=c[b+16>>2]|0;b=c[a+16>>2]|0;d=0;do{c[b+(d<<2)>>2]=c[e+(d<<2)>>2];d=d+1|0}while(d>>>0<(c[g>>2]|0)>>>0)}c[f>>2]=d;if(h>>>0>=d>>>0){c[f>>2]=0;return}e=c[a+16>>2]|0;d=0;do{c[e+(d<<2)>>2]=c[e+(d+h<<2)>>2];d=d+1|0}while(d>>>0<((c[f>>2]|0)-h|0)>>>0);c[e+(d<<2)>>2]=0;d=(c[f>>2]|0)-h|0;c[f>>2]=d;if((i|0)!=0&(d|0)!=0)gl(e,e,d,i)|0}while(0);d=c[f>>2]|0;if((d|0)<=0)return;b=c[a+16>>2]|0;while(1){e=d;d=d+-1|0;if(c[b+(d<<2)>>2]|0){d=36;break}c[f>>2]=d;if((e|0)<=1){d=36;break}}if((d|0)==36)return}function tk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=a+4|0;d=c[f>>2]|0;if(!((b|0)!=0&(d|0)!=0))return;e=d+b|0;if((c[a>>2]|0)>>>0>>0)ql(a,e);a=c[a+16>>2]|0;if((d|0)>0)do{e=d;d=d+-1|0;c[a+(d+b<<2)>>2]=c[a+(d<<2)>>2]}while((e|0)>1);Yq(a|0,0,b<<2|0)|0;c[f>>2]=(c[f>>2]|0)+b;return}function uk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;k=d>>>5;j=d&31;if(a|0?c[a+12>>2]&16|0:0){sl();return}e=(a|0)!=(b|0);i=(d|0)!=0;if(!(e|i))return;if(e){g=c[b+4>>2]|0;h=c[b+8>>2]|0;d=k+1+g|0;if((c[a>>2]|0)>>>0>>0)ql(a,d);e=c[a+16>>2]|0;f=c[b+16>>2]|0;if(g|0){d=0;do{c[e+(d<<2)>>2]=c[f+(d<<2)>>2];d=d+1|0}while((d|0)!=(g|0))}c[a+4>>2]=g;c[a+12>>2]=c[b+12>>2];c[a+8>>2]=h}do if(!((k|0)==0|(j|0)!=0)){g=a+4|0;d=c[g>>2]|0;if(d){e=d+k|0;if((c[a>>2]|0)>>>0>>0)ql(a,e);e=c[a+16>>2]|0;if((d|0)>0)do{j=d;d=d+-1|0;c[e+(d+k<<2)>>2]=c[e+(d<<2)>>2]}while((j|0)>1);Yq(e|0,0,k<<2|0)|0;c[g>>2]=(c[g>>2]|0)+k}}else{if(!i){g=a+4|0;break}f=k+1|0;g=a+4|0;d=c[g>>2]|0;if(d|0){e=d+f|0;if((c[a>>2]|0)>>>0>>0)ql(a,e);e=c[a+16>>2]|0;if((d|0)>0)do{b=d;d=d+-1|0;c[e+(b+k<<2)>>2]=c[e+(d<<2)>>2]}while((b|0)>1);Yq(e|0,0,f<<2|0)|0;c[g>>2]=(c[g>>2]|0)+f}sk(a,a,32-j|0)}while(0);d=c[g>>2]|0;if((d|0)<=0)return;f=c[a+16>>2]|0;while(1){e=d;d=d+-1|0;if(c[f+(d<<2)>>2]|0){d=31;break}c[g>>2]=d;if((e|0)<=1){d=31;break}}if((d|0)==31)return}function vk(a,b){a=a|0;b=b|0;var d=0;kk(a);d=c[a+4>>2]|0;if(!d){b=((b|0)!=0)<<31>>31;return b|0}if(c[a+8>>2]|0){b=-1;return b|0}if((d|0)!=1){b=1;return b|0}a=c[c[a+16>>2]>>2]|0;if(a>>>0>b>>>0){b=1;return b|0}b=(a>>>0>>0)<<31>>31;return b|0}function wk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;e=(a|0)!=0;if(e?(d=c[a+12>>2]|0,(d&4|0)!=0):0)j=7;else j=3;do if((j|0)==3){if(b|0?(f=c[b+12>>2]|0,f&4|0):0){if(!e){g=f;j=12;break}d=c[a+12>>2]|0;j=7;break}kk(a);kk(b);d=c[a+4>>2]|0;g=c[b+4>>2]|0;i=c[a+8>>2]|0;h=(i|0)==0;e=c[b+8>>2]|0;f=(e|0)==0;if(h)if(f)e=0;else{j=1;return j|0}else if(f){j=-1;return j|0}do if((d|0)!=(g|0)){e=(e|0)==0;if(h){if(!e)break;j=d-g|0;return j|0}else{if(e)break;j=g+d|0;return j|0}}while(0);if(!d){j=0;return j|0}h=c[a+16>>2]|0;g=c[b+16>>2]|0;do{if((d|0)<=0){d=0;j=31;break}d=d+-1|0;e=c[h+(d<<2)>>2]|0;f=c[g+(d<<2)>>2]|0}while((e|0)==(f|0));if((j|0)==31)return d|0;j=e>>>0<=f>>>0^(i|0)!=0?-1:1;return j|0}while(0);do if((j|0)==7){d=(d&4|0)==0;if(d){if(!((b|0)!=0&d))break;g=c[b+12>>2]|0;j=12;break}if(!b){j=-1;return j|0}if(!(c[b+12>>2]&4)){j=-1;return j|0}}while(0);if((j|0)==12?g&4|0:0){j=1;return j|0}d=c[a+8>>2]|0;e=c[b+8>>2]|0;if(!(d|e)){j=0;return j|0}if((d|0)<(e|0)){j=-1;return j|0}if((d|0)>(e|0)){j=1;return j|0}j=Tp(c[a+16>>2]|0,c[b+16>>2]|0,(d+7|0)/8|0)|0;return j|0}function xk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=c[d+8>>2]|0;if((a|0)==(d|0)){d=yl(d)|0;e=d}else e=0;yk(0,a,b,d);if((f|0)!=0^(c[b+8>>2]|0)!=0?c[a+4>>2]|0:0)fk(a,a,d);if(!e)return;tl(e);return}function yk(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=l;l=l+48|0;if((l|0)>=(m|0))$(48);w=y+20|0;x=y;i=e+4|0;s=c[i>>2]|0;h=c[f+4>>2]|0;g=e+8|0;v=c[g>>2]|0;t=c[f+8>>2]^v;n=s+1|0;ql(b,n);j=n-h|0;if((j|0)<1){if((e|0)!=(b|0)?(c[b+4>>2]=c[i>>2],c[b+8>>2]=c[g>>2],(s|0)>0):0){i=c[e+16>>2]|0;h=c[b+16>>2]|0;g=0;do{c[h+(g<<2)>>2]=c[i+(g<<2)>>2];g=g+1|0}while((g|0)!=(s|0))}if(!a){l=y;return}c[a+4>>2]=0;c[a+8>>2]=0;l=y;return}r=(a|0)!=0;if(r)ql(a,j);e=c[e+16>>2]|0;k=c[f+16>>2]|0;u=c[b+16>>2]|0;if((h|0)==1){if(r){x=c[a+16>>2]|0;g=Zk(x,e,s,c[k>>2]|0)|0;c[a+4>>2]=j-((c[x+(j+-1<<2)>>2]|0)==0&1);c[a+8>>2]=t}else g=Xk(e,s,c[k>>2]|0)|0;c[u>>2]=g;c[b+4>>2]=(g|0)!=0&1;c[b+8>>2]=v;l=y;return}if(r){g=c[a+16>>2]|0;if((g|0)==(e|0)){c[x>>2]=s;i=ml(s,c[a+12>>2]&1)|0;c[w>>2]=i;if((s|0)>0){g=0;do{c[i+(g<<2)>>2]=c[e+(g<<2)>>2];g=g+1|0}while((g|0)!=(s|0));o=e;g=1}else{o=e;g=1}}else{i=e;o=g;g=0}}else{i=e;o=u+(h<<2)|0;g=0}q=c[k+(h+-1<<2)>>2]|0;p=q>>>0<65536?(q>>>0<256?0:8):q>>>0<16777216?16:24;p=32-(d[45555+(q>>>p)>>0]|0)-p|0;q=(p|0)!=0;if(q){c[x+(g<<2)>>2]=h;if(!f)e=0;else e=(c[f+12>>2]&1|0)!=0;j=ml(h,e&1)|0;e=g+1|0;c[w+(g<<2)>>2]=j;_k(j,k,h,p)|0;g=_k(u,i,s,p)|0;if(!g){i=s;g=e}else{c[u+(s<<2)>>2]=g;i=n;g=e}}else{if((k|0)==(u|0)|r&(k|0)==(o|0)){c[x+(g<<2)>>2]=h;if(!f)e=0;else e=(c[f+12>>2]&1|0)!=0;j=ml(h,e&1)|0;e=g+1|0;c[w+(g<<2)>>2]=j;if((h|0)>0){g=0;do{c[j+(g<<2)>>2]=c[k+(g<<2)>>2];g=g+1|0}while((g|0)!=(h|0));g=e}else g=e}else j=k;if((u|0)!=(i|0)&(s|0)>0){e=0;do{c[u+(e<<2)>>2]=c[i+(e<<2)>>2];e=e+1|0}while((e|0)!=(s|0));i=s}else i=s}e=Yk(o,0,u,i,j,h)|0;if(r){i=i-h|0;if(e){c[o+(i<<2)>>2]=e;i=i+1|0}c[a+4>>2]=i;c[a+8>>2]=t}while(1){if((h|0)<=0)break;i=h+-1|0;if(!(c[u+(i<<2)>>2]|0))h=i;else break}if(q&(h|0)!=0){gl(u,u,h,p)|0;h=h-((c[u+(h+-1<<2)>>2]|0)==0&1)|0}c[b+4>>2]=h;c[b+8>>2]=v;if(!g){l=y;return}do{g=g+-1|0;ol(c[w+(g<<2)>>2]|0,c[x+(g<<2)>>2]|0)}while((g|0)!=0);l=y;return}function zk(a,b,c){a=a|0;b=b|0;c=c|0;yk(0,a,b,c);return}function Ak(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=Xk(c[b+16>>2]|0,c[b+4>>2]|0,d)|0;if(!e)b=0;else b=(c[b+8>>2]|0)==0?e:d-e|0;if(!a)return b|0;c[c[a+16>>2]>>2]=b;c[a+4>>2]=(b|0)!=0&1;return b|0}function Bk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;f=ll(c[a+4>>2]|0)|0;g=c[d+8>>2]|0;if((a|0)==(d|0)|(f|0)==(d|0)){d=yl(d)|0;e=d}else e=0;yk(a,f,b,d);if((g|0)!=(c[b+8>>2]|0)?c[f+4>>2]|0:0){gk(a,a,1);fk(f,f,d)}if(!e){tl(f);return}tl(e);tl(f);return}function Ck(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=c[b+4>>2]|0;g=d>>>5;e=h-g|0;if((h|0)<=(g|0)){c[a+4>>2]=0;return}if((c[a>>2]|0)<(e|0))ql(a,e);h=c[a+16>>2]|0;f=c[b+16>>2]|0;b=d&31;if(!b){if((e|0)>0){f=f+(g<<2)|0;b=0;do{c[h+(b<<2)>>2]=c[f+(b<<2)>>2];b=b+1|0}while((b|0)!=(e|0))}}else{gl(h,f+(g<<2)|0,e,b)|0;e=e-((c[h+(e+-1<<2)>>2]|0)==0&1)|0}c[a+4>>2]=e;return}function Dk(a,b){a=a|0;b=b|0;return (Xk(c[a+16>>2]|0,c[a+4>>2]|0,b)|0)==0|0}function Ek(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=yl(b)|0;b=yl(d)|0;c[e+8>>2]=0;c[b+8>>2]=0;if(vk(b,0)|0)do{xk(a,e,b);Al(e,b)|0;Al(b,a)|0}while((vk(b,0)|0)!=0);Al(a,e)|0;tl(e);tl(b);return (vk(a,1)|0)==0|0}function Fk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if(!(vk(b,0)|0)){a=0;return a|0}if(!(vk(d,1)|0)){a=0;return a|0}q=yl(b)|0;p=yl(d)|0;a:do if(!(mk(q,0)|0))do{if(mk(p,0)|0)break a;sk(q,q,1);sk(p,p,1)}while(!(mk(q,0)|0));while(0);l=mk(p,0)|0;k=kl(1)|0;l=(l|0)!=0;if(l)i=0;else i=kl(0)|0;m=yl(q)|0;n=yl(p)|0;if(l)j=0;else{j=ll(c[q+4>>2]|0)|0;hk(j,k,q)}o=yl(p)|0;if(!(mk(q,0)|0)){b=kl(1)|0;if(l)d=0;else d=kl(0)|0;f=yl(q)|0;g=17}else{b=kl(0)|0;if(l)d=0;else{d=kl(1)|0;c[d+8>>2]=1}h=yl(p)|0;f=h+8|0;c[f>>2]=(c[f>>2]|0)==0&1}while(1){if((g|0)==17){g=0;e=(mk(b,0)|0)!=0;if(l){if(e)fk(b,b,p);sk(b,b,1);sk(f,f,1);h=f;continue}if(!(!e?!(mk(d,0)|0):0)){fk(b,b,p);hk(d,d,q)}sk(b,b,1);sk(d,d,1);sk(f,f,1);h=f}if(!(mk(h,0)|0)){f=h;g=17;continue}e=h+8|0;if(!(c[e>>2]|0)){Al(k,b)|0;if(!l)Al(i,d)|0;Al(m,h)|0}else{hk(n,p,b);f=q+8|0;g=c[f>>2]|0;c[f>>2]=(g|0)==0&1;if(!l)hk(j,q,d);c[f>>2]=g;g=c[e>>2]|0;c[e>>2]=(g|0)==0&1;Al(o,h)|0;c[e>>2]=g}hk(b,k,n);if(!l)hk(d,i,j);hk(h,m,o);if(c[b+8>>2]|0?(fk(b,b,p),!l):0)hk(d,d,q);if(!(vk(h,0)|0))break;else{f=h;g=17}}Al(a,k)|0;tl(k);tl(n);tl(b);if(!l){tl(i);tl(j);tl(d)}tl(m);tl(o);tl(h);tl(q);tl(p);a=1;return a|0}function Gk(a,b,c){a=a|0;b=b|0;c=c|0;xk(a,b,c);return}function Hk(a,b){a=a|0;b=b|0;var d=0,e=0;kk(a);d=kf(1,28)|0;if(!b)c[d>>2]=a;else{c[d>>2]=yl(a)|0;c[d+4>>2]=1}b=c[a+4>>2]|0;c[d+8>>2]=b;e=ll(b+1|0)|0;El(e,1)|0;b=b<<1;tk(e,b);Bk(e,e,a);c[d+12>>2]=e;b=b|1;c[d+16>>2]=ll(b)|0;c[d+20>>2]=ll(b)|0;return d|0}function Ik(a){a=a|0;var b=0;if(!a)return;tl(c[a+12>>2]|0);tl(c[a+16>>2]|0);tl(c[a+20>>2]|0);b=c[a+24>>2]|0;if(b|0)tl(b);if(c[a+4>>2]|0)tl(c[a>>2]|0);cf(a);return}function Jk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;l=c[d>>2]|0;i=c[d+8>>2]|0;e=c[d+12>>2]|0;g=c[d+16>>2]|0;f=c[d+20>>2]|0;kk(b);if((c[b+4>>2]|0)>(i<<1|0)){xk(a,b,l);return}j=b+8|0;k=c[j>>2]|0;c[j>>2]=0;Al(f,b)|0;rk(f,i+-1|0);Kk(f,f,e);h=i+1|0;rk(f,h);Al(g,b)|0;e=g+4|0;if((c[e>>2]|0)>(h|0))c[e>>2]=h;Kk(f,f,l);e=f+4|0;if((c[e>>2]|0)>(h|0))c[e>>2]=h;hk(a,g,f);if(c[a+8>>2]|0){b=d+24|0;e=c[b>>2]|0;if(!e){e=ll(i+2|0)|0;c[b>>2]=e;El(e,1)|0;tk(c[b>>2]|0,h);e=c[b>>2]|0}fk(a,a,e)}if((wk(a,l)|0)>-1)do hk(a,a,l);while((wk(a,l)|0)>-1);c[j>>2]=k;return}function Kk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;k=c[b+4>>2]|0;l=c[d+4>>2]|0;h=(k|0)<(l|0);p=h?b:d;i=h?d:b;m=h?l:k;g=c[i+12>>2]&1;l=h?k:l;k=c[i+16>>2]|0;h=c[p+12>>2]&1;f=c[p+16>>2]|0;p=c[i+8>>2]^c[p+8>>2];i=a+16|0;e=c[i>>2]|0;n=m+l|0;if((a|0)!=0?(c[a+12>>2]&1|0)!=0:0)o=7;else o=3;do if((o|0)==3){if(!(c[b+12>>2]&1)){if(!d){o=7;break}if(!(c[d+12>>2]&1)){o=7;break}}h=0;j=0;g=2;e=ml(n,1)|0;b=k}while(0);a:do if((o|0)==7){b=(e|0)==(k|0);if((c[a>>2]|0)<(n|0))if(b|(e|0)==(f|0)){h=0;j=0;g=1;e=ml(n,c[a+12>>2]&1)|0;b=k;break}else{ql(a,n);h=0;j=0;g=0;e=c[i>>2]|0;b=k;break}if(b){b=ml(m,g)|0;f=(k|0)==(f|0)?b:f;if((m|0)>0)e=0;else{h=m;j=b;g=0;e=k;break}while(1){c[b+(e<<2)>>2]=c[k+(e<<2)>>2];e=e+1|0;if((e|0)>=(m|0)){h=m;j=b;g=0;e=k;break a}}}if((e|0)==(f|0)){d=ml(l,h)|0;if((l|0)>0){e=0;do{c[d+(e<<2)>>2]=c[f+(e<<2)>>2];e=e+1|0}while((e|0)!=(l|0));h=l;j=d;g=0;e=f;b=k;f=d}else{h=l;j=d;g=0;e=f;b=k;f=d}}else{h=0;j=0;g=0;b=k}}while(0);if(!l)d=0;else d=n-((el(e,b,m,f,l)|0)==0&1)|0;switch(g&3){case 0:break;case 2:{b=ml(d,0)|0;if((d|0)>0){f=0;do{c[b+(f<<2)>>2]=c[e+(f<<2)>>2];f=f+1|0}while((f|0)!=(d|0))}ol(e,0);e=b;o=23;break}default:o=23}if((o|0)==23)pl(a,e,d);c[a+4>>2]=d;c[a+8>>2]=p;if(!j)return;ol(j,h);return}function Lk(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Kk(a,b,c);zk(a,a,d);return} +function op(e,f,g,i,k){e=e|0;f=f|0;g=g|0;i=i|0;k=k|0;var n=0,o=0,p=0,q=0,r=0.0,s=0,t=0,u=0,v=0,w=0.0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0;la=l;l=l+624|0;if((l|0)>=(m|0))$(624);ha=la+24|0;ia=la+16|0;ja=la+588|0;Z=la+576|0;ka=la;U=la+536|0;O=la+8|0;P=la+528|0;Q=(e|0)!=0;R=U+40|0;T=R;U=U+39|0;V=O+4|0;W=ja;X=0-W|0;Y=Z+12|0;Z=Z+11|0;_=Y;aa=_-W|0;ba=-2-W|0;ca=_+2|0;da=ha+288|0;ea=ja+9|0;fa=ea;ga=ja+8|0;o=0;n=0;t=0;a:while(1){do if((n|0)>-1)if((o|0)>(2147483647-n|0)){c[(zo()|0)>>2]=75;n=-1;break}else{n=o+n|0;break}while(0);o=a[f>>0]|0;if(!(o<<24>>24)){N=243;break}else p=f;b:while(1){switch(o<<24>>24){case 37:{o=p;N=9;break b}case 0:{o=p;break b}default:{}}o=p+1|0;p=o;o=a[o>>0]|0}c:do if((N|0)==9)while(1){N=0;if((a[p+1>>0]|0)!=37)break c;o=o+1|0;p=p+2|0;if((a[p>>0]|0)==37)N=9;else break}while(0);o=o-f|0;if(Q?(c[e>>2]&32|0)==0:0)rp(f,o,e)|0;if(o|0){f=p;continue}s=p+1|0;q=a[s>>0]|0;o=(q<<24>>24)+-48|0;if(o>>>0<10){v=(a[p+2>>0]|0)==36;s=v?p+3|0:s;x=v?o:-1;v=v?1:t;o=a[s>>0]|0}else{x=-1;v=t;o=q}p=(o<<24>>24)+-32|0;d:do if(p>>>0<32){q=0;do{if(!(1<>24)+-32|q;s=s+1|0;o=a[s>>0]|0;p=(o<<24>>24)+-32|0}while(p>>>0<32)}else q=0;while(0);do if(o<<24>>24!=42){p=(o<<24>>24)+-48|0;if(p>>>0<10){t=0;do{t=(t*10|0)+p|0;s=s+1|0;o=a[s>>0]|0;p=(o<<24>>24)+-48|0}while(p>>>0<10);if((t|0)<0){n=-1;break a}else M=v}else{t=0;M=v}}else{u=s+1|0;o=a[u>>0]|0;p=(o<<24>>24)+-48|0;if(p>>>0<10?(a[s+2>>0]|0)==36:0){c[k+(p<<2)>>2]=10;o=c[i+((a[u>>0]|0)+-48<<3)>>2]|0;p=1;u=s+3|0}else{if(v|0){n=-1;break a}if(!Q){t=0;M=0;s=u;break}p=(c[g>>2]|0)+(4-1)&~(4-1);o=c[p>>2]|0;c[g>>2]=p+4;p=0}M=(o|0)<0;t=M?0-o|0:o;q=M?q|8192:q;M=p;s=u;o=a[u>>0]|0}while(0);e:do if(o<<24>>24==46){o=s+1|0;p=a[o>>0]|0;if(p<<24>>24!=42){s=(p<<24>>24)+-48|0;if(s>>>0<10)p=0;else{y=0;break}while(1){p=(p*10|0)+s|0;o=o+1|0;s=(a[o>>0]|0)+-48|0;if(s>>>0>=10){y=p;break e}}}o=s+2|0;p=(a[o>>0]|0)+-48|0;if(p>>>0<10?(a[s+3>>0]|0)==36:0){c[k+(p<<2)>>2]=10;y=c[i+((a[o>>0]|0)+-48<<3)>>2]|0;o=s+4|0;break}if(M|0){n=-1;break a}if(Q){L=(c[g>>2]|0)+(4-1)&~(4-1);y=c[L>>2]|0;c[g>>2]=L+4}else y=0}else{y=-1;o=s}while(0);v=0;while(1){p=(a[o>>0]|0)+-65|0;if(p>>>0>57){n=-1;break a}L=o+1|0;p=a[66502+(v*58|0)+p>>0]|0;s=p&255;if((s+-1|0)>>>0<8){v=s;o=L}else break}if(!(p<<24>>24)){n=-1;break}u=(x|0)>-1;do if(p<<24>>24==19)if(u){n=-1;break a}else N=51;else{if(u){c[k+(x<<2)>>2]=s;J=i+(x<<3)|0;K=c[J+4>>2]|0;N=ka;c[N>>2]=c[J>>2];c[N+4>>2]=K;N=51;break}if(!Q){n=0;break a}sp(ka,s,g)}while(0);if((N|0)==51?(N=0,!Q):0){o=0;t=M;f=L;continue}G=a[o>>0]|0;G=(v|0)!=0&(G&15|0)==3?G&-33:G;u=q&-65537;K=(q&8192|0)==0?q:u;f:do switch(G|0){case 110:switch((v&255)<<24>>24){case 0:{c[c[ka>>2]>>2]=n;o=0;t=M;f=L;continue a}case 1:{c[c[ka>>2]>>2]=n;o=0;t=M;f=L;continue a}case 2:{o=c[ka>>2]|0;c[o>>2]=n;c[o+4>>2]=((n|0)<0)<<31>>31;o=0;t=M;f=L;continue a}case 3:{b[c[ka>>2]>>1]=n;o=0;t=M;f=L;continue a}case 4:{a[c[ka>>2]>>0]=n;o=0;t=M;f=L;continue a}case 6:{c[c[ka>>2]>>2]=n;o=0;t=M;f=L;continue a}case 7:{o=c[ka>>2]|0;c[o>>2]=n;c[o+4>>2]=((n|0)<0)<<31>>31;o=0;t=M;f=L;continue a}default:{o=0;t=M;f=L;continue a}}case 112:{u=120;v=y>>>0>8?y:8;o=K|8;N=63;break}case 88:case 120:{u=G;v=y;o=K;N=63;break}case 111:{p=ka;o=c[p>>2]|0;p=c[p+4>>2]|0;if((o|0)==0&(p|0)==0)f=R;else{f=R;do{f=f+-1|0;a[f>>0]=o&7|48;o=gr(o|0,p|0,3)|0;p=D}while(!((o|0)==0&(p|0)==0))}if(!(K&8)){p=0;q=66982;s=y;o=K;N=76}else{s=T-f|0;p=0;q=66982;s=(y|0)>(s|0)?y:s+1|0;o=K;N=76}break}case 105:case 100:{f=ka;o=c[f>>2]|0;f=c[f+4>>2]|0;if((f|0)<0){o=Xq(0,0,o|0,f|0)|0;f=D;p=ka;c[p>>2]=o;c[p+4>>2]=f;p=1;q=66982;N=75;break f}if(!(K&2048)){q=K&1;p=q;q=(q|0)==0?66982:66984;N=75}else{p=1;q=66983;N=75}break}case 117:{f=ka;p=0;q=66982;o=c[f>>2]|0;f=c[f+4>>2]|0;N=75;break}case 99:{a[U>>0]=c[ka>>2];f=U;x=0;v=66982;p=R;o=1;break}case 109:{o=dp(c[(zo()|0)>>2]|0)|0;N=81;break}case 115:{o=c[ka>>2]|0;o=o|0?o:66992;N=81;break}case 67:{c[O>>2]=c[ka>>2];c[V>>2]=0;c[ka>>2]=O;u=-1;p=O;N=85;break}case 83:{o=c[ka>>2]|0;if(!y){up(e,32,t,0,K);o=0;N=96}else{u=y;p=o;N=85}break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{r=+h[ka>>3];c[ia>>2]=0;h[j>>3]=r;if((c[j+4>>2]|0)>=0){o=K&1;if(!(K&2048)){J=o;I=(o|0)==0?67e3:67005}else{J=1;I=67002}}else{r=-r;J=1;I=66999}h[j>>3]=r;H=c[j+4>>2]&2146435072;do if(H>>>0<2146435072|(H|0)==2146435072&0<0){w=+wp(r,ia)*2.0;f=w!=0.0;if(f)c[ia>>2]=(c[ia>>2]|0)+-1;A=G|32;if((A|0)==97){s=G&32;x=(s|0)==0?I:I+9|0;v=J|2;o=12-y|0;do if(!(y>>>0>11|(o|0)==0)){r=8.0;do{o=o+-1|0;r=r*16.0}while((o|0)!=0);if((a[x>>0]|0)==45){r=-(r+(-w-r));break}else{r=w+r-r;break}}else r=w;while(0);f=c[ia>>2]|0;o=(f|0)<0?0-f|0:f;o=tp(o,((o|0)<0)<<31>>31,Y)|0;if((o|0)==(Y|0)){a[Z>>0]=48;o=Z}a[o+-1>>0]=(f>>31&2)+43;u=o+-2|0;a[u>>0]=G+15;q=(y|0)<1;p=(K&8|0)==0;o=ja;do{J=~~r;f=o+1|0;a[o>>0]=d[66966+J>>0]|s;r=(r-+(J|0))*16.0;do if((f-W|0)==1){if(p&(q&r==0.0)){o=f;break}a[f>>0]=46;o=o+2|0}else o=f;while(0)}while(r!=0.0);q=u;p=(y|0)!=0&(ba+o|0)<(y|0)?ca+y-q|0:aa-q+o|0;s=p+v|0;up(e,32,t,s,K);if(!(c[e>>2]&32))rp(x,v,e)|0;up(e,48,t,s,K^65536);f=o-W|0;if(!(c[e>>2]&32))rp(ja,f,e)|0;o=_-q|0;up(e,48,p-(f+o)|0,0,0);if(!(c[e>>2]&32))rp(u,o,e)|0;up(e,32,t,s,K^8192);o=(s|0)<(t|0)?t:s;break}o=(y|0)<0?6:y;if(f){f=(c[ia>>2]|0)+-28|0;c[ia>>2]=f;r=w*268435456.0}else{r=w;f=c[ia>>2]|0}H=(f|0)<0?ha:da;p=H;do{F=~~r>>>0;c[p>>2]=F;p=p+4|0;r=(r-+(F>>>0))*1.0e9}while(r!=0.0);if((f|0)>0){q=H;u=p;while(1){s=(f|0)>29?29:f;f=u+-4|0;do if(f>>>0>=q>>>0){p=0;do{E=mr(c[f>>2]|0,0,s|0)|0;E=_q(E|0,D|0,p|0,0)|0;F=D;C=nr(E|0,F|0,1e9,0)|0;c[f>>2]=C;p=ir(E|0,F|0,1e9,0)|0;f=f+-4|0}while(f>>>0>=q>>>0);if(!p)break;q=q+-4|0;c[q>>2]=p}while(0);p=u;while(1){if(p>>>0<=q>>>0)break;f=p+-4|0;if(!(c[f>>2]|0))p=f;else break}f=(c[ia>>2]|0)-s|0;c[ia>>2]=f;if((f|0)>0)u=p;else break}}else q=H;if((f|0)<0){y=((o+25|0)/9|0)+1|0;z=(A|0)==102;do{x=0-f|0;x=(x|0)>9?9:x;do if(q>>>0

>>0){s=(1<>>x;v=0;f=q;do{F=c[f>>2]|0;c[f>>2]=(F>>>x)+v;v=S(F&s,u)|0;f=f+4|0}while(f>>>0

>>0);f=(c[q>>2]|0)==0?q+4|0:q;if(!v){q=f;f=p;break}c[p>>2]=v;q=f;f=p+4|0}else{q=(c[q>>2]|0)==0?q+4|0:q;f=p}while(0);p=z?H:q;p=(f-p>>2|0)>(y|0)?p+(y<<2)|0:f;f=(c[ia>>2]|0)+x|0;c[ia>>2]=f}while((f|0)<0)}F=H;do if(q>>>0

>>0){f=(F-q>>2)*9|0;u=c[q>>2]|0;if(u>>>0<10)break;else s=10;do{s=s*10|0;f=f+1|0}while(u>>>0>=s>>>0)}else f=0;while(0);B=(A|0)==103;C=(o|0)!=0;s=o-((A|0)!=102?f:0)+((C&B)<<31>>31)|0;if((s|0)<(((p-F>>2)*9|0)+-9|0)){s=s+9216|0;v=H+4+(((s|0)/9|0)+-1024<<2)|0;s=((s|0)%9|0)+1|0;if((s|0)<9){u=10;do{u=u*10|0;s=s+1|0}while((s|0)!=9)}else u=10;y=c[v>>2]|0;z=(y>>>0)%(u>>>0)|0;s=(v+4|0)==(p|0);do if(s&(z|0)==0)s=v;else{w=(((y>>>0)/(u>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;x=(u|0)/2|0;if(z>>>0>>0)r=.5;else r=s&(z|0)==(x|0)?1.0:1.5;do if(J){if((a[I>>0]|0)!=45)break;r=-r;w=-w}while(0);s=y-z|0;c[v>>2]=s;if(!(w+r!=w)){s=v;break}E=s+u|0;c[v>>2]=E;if(E>>>0>999999999){s=v;while(1){f=s+-4|0;c[s>>2]=0;if(f>>>0>>0){q=q+-4|0;c[q>>2]=0}E=(c[f>>2]|0)+1|0;c[f>>2]=E;if(E>>>0>999999999)s=f;else{v=f;break}}}f=(F-q>>2)*9|0;u=c[q>>2]|0;if(u>>>0<10){s=v;break}else s=10;do{s=s*10|0;f=f+1|0}while(u>>>0>=s>>>0);s=v}while(0);E=s+4|0;p=p>>>0>E>>>0?E:p}z=0-f|0;E=p;while(1){if(E>>>0<=q>>>0){A=0;break}p=E+-4|0;if(!(c[p>>2]|0))E=p;else{A=1;break}}do if(B){o=(C&1^1)+o|0;if((o|0)>(f|0)&(f|0)>-5){v=G+-1|0;o=o+-1-f|0}else{v=G+-2|0;o=o+-1|0}p=K&8;if(p|0){x=p;break}do if(A){u=c[E+-4>>2]|0;if(!u){s=9;break}if(!((u>>>0)%10|0)){s=0;p=10}else{s=0;break}do{p=p*10|0;s=s+1|0}while(!((u>>>0)%(p>>>0)|0|0))}else s=9;while(0);p=((E-F>>2)*9|0)+-9|0;if((v|32|0)==102){x=p-s|0;x=(x|0)<0?0:x;o=(o|0)<(x|0)?o:x;x=0;break}else{x=p+f-s|0;x=(x|0)<0?0:x;o=(o|0)<(x|0)?o:x;x=0;break}}else{v=G;x=K&8}while(0);y=o|x;s=(y|0)!=0&1;u=(v|32|0)==102;if(u){z=0;f=(f|0)>0?f:0}else{p=(f|0)<0?z:f;p=tp(p,((p|0)<0)<<31>>31,Y)|0;if((_-p|0)<2)do{p=p+-1|0;a[p>>0]=48}while((_-p|0)<2);a[p+-1>>0]=(f>>31&2)+43;f=p+-2|0;a[f>>0]=v;z=f;f=_-f|0}B=J+1+o+s+f|0;up(e,32,t,B,K);if(!(c[e>>2]&32))rp(I,J,e)|0;up(e,48,t,B,K^65536);do if(u){q=q>>>0>H>>>0?H:q;p=q;do{f=tp(c[p>>2]|0,0,ea)|0;do if((p|0)==(q|0)){if((f|0)!=(ea|0))break;a[ga>>0]=48;f=ga}else{if(f>>>0<=ja>>>0)break;Yq(ja|0,48,f-W|0)|0;do f=f+-1|0;while(f>>>0>ja>>>0)}while(0);if(!(c[e>>2]&32))rp(f,fa-f|0,e)|0;p=p+4|0}while(p>>>0<=H>>>0);do if(y|0){if(c[e>>2]&32|0)break;rp(67034,1,e)|0}while(0);if((o|0)>0&p>>>0>>0)while(1){f=tp(c[p>>2]|0,0,ea)|0;if(f>>>0>ja>>>0){Yq(ja|0,48,f-W|0)|0;do f=f+-1|0;while(f>>>0>ja>>>0)}if(!(c[e>>2]&32))rp(f,(o|0)>9?9:o,e)|0;p=p+4|0;f=o+-9|0;if(!((o|0)>9&p>>>0>>0)){o=f;break}else o=f}up(e,48,o+9|0,9,0)}else{v=A?E:q+4|0;if((o|0)>-1){u=(x|0)==0;s=q;do{f=tp(c[s>>2]|0,0,ea)|0;if((f|0)==(ea|0)){a[ga>>0]=48;f=ga}do if((s|0)==(q|0)){p=f+1|0;if(!(c[e>>2]&32))rp(f,1,e)|0;if(u&(o|0)<1){f=p;break}if(c[e>>2]&32|0){f=p;break}rp(67034,1,e)|0;f=p}else{if(f>>>0<=ja>>>0)break;Yq(ja|0,48,f+X|0)|0;do f=f+-1|0;while(f>>>0>ja>>>0)}while(0);p=fa-f|0;if(!(c[e>>2]&32))rp(f,(o|0)>(p|0)?p:o,e)|0;o=o-p|0;s=s+4|0}while(s>>>0>>0&(o|0)>-1)}up(e,48,o+18|0,18,0);if(c[e>>2]&32|0)break;rp(z,_-z|0,e)|0}while(0);up(e,32,t,B,K^8192);o=(B|0)<(t|0)?t:B}else{f=(G&32|0)!=0;p=J+3|0;up(e,32,t,p,u);o=c[e>>2]|0;if(!(o&32)){rp(I,J,e)|0;o=c[e>>2]|0}if(!(o&32))rp(r!=r|0.0!=0.0?(f?67026:67030):f?67018:67022,3,e)|0;up(e,32,t,p,K^8192);o=(p|0)<(t|0)?t:p}while(0);t=M;f=L;continue a}default:{x=0;v=66982;p=R;o=y;u=K}}while(0);g:do if((N|0)==63){q=ka;p=c[q>>2]|0;q=c[q+4>>2]|0;s=u&32;if((p|0)==0&(q|0)==0){f=R;p=0;q=0}else{f=R;do{f=f+-1|0;a[f>>0]=d[66966+(p&15)>>0]|s;p=gr(p|0,q|0,4)|0;q=D}while(!((p|0)==0&(q|0)==0));q=ka;p=c[q>>2]|0;q=c[q+4>>2]|0}q=(o&8|0)==0|(p|0)==0&(q|0)==0;p=q?0:2;q=q?66982:66982+(u>>4)|0;s=v;N=76}else if((N|0)==75){f=tp(o,f,R)|0;s=y;o=K;N=76}else if((N|0)==81){N=0;K=No(o,0,y)|0;J=(K|0)==0;f=o;x=0;v=66982;p=J?o+y|0:K;o=J?y:K-o|0}else if((N|0)==85){N=0;s=p;o=0;f=0;while(1){q=c[s>>2]|0;if(!q)break;f=vp(P,q)|0;if((f|0)<0|f>>>0>(u-o|0)>>>0)break;o=f+o|0;if(u>>>0>o>>>0)s=s+4|0;else break}if((f|0)<0){n=-1;break a}up(e,32,t,o,K);if(!o){o=0;N=96}else{q=0;while(1){f=c[p>>2]|0;if(!f){N=96;break g}f=vp(P,f)|0;q=f+q|0;if((q|0)>(o|0)){N=96;break g}if(!(c[e>>2]&32))rp(P,f,e)|0;if(q>>>0>=o>>>0){N=96;break}else p=p+4|0}}}while(0);if((N|0)==96){N=0;up(e,32,t,o,K^8192);o=(t|0)>(o|0)?t:o;t=M;f=L;continue}if((N|0)==76){N=0;u=(s|0)>-1?o&-65537:o;o=ka;o=(c[o>>2]|0)!=0|(c[o+4>>2]|0)!=0;if((s|0)!=0|o){o=(o&1^1)+(T-f)|0;x=p;v=q;p=R;o=(s|0)>(o|0)?s:o}else{f=R;x=p;v=q;p=R;o=0}}s=p-f|0;p=(o|0)<(s|0)?s:o;q=p+x|0;o=(t|0)<(q|0)?q:t;up(e,32,o,q,u);if(!(c[e>>2]&32))rp(v,x,e)|0;up(e,48,o,q,u^65536);up(e,48,p,s,0);if(!(c[e>>2]&32))rp(f,s,e)|0;up(e,32,o,q,u^8192);t=M;f=L}h:do if((N|0)==243)if(!e)if(!t)n=0;else{n=1;while(1){o=c[k+(n<<2)>>2]|0;if(!o)break;sp(i+(n<<3)|0,o,g);n=n+1|0;if((n|0)>=10){n=1;break h}}while(1){if(c[k+(n<<2)>>2]|0){n=-1;break h}n=n+1|0;if((n|0)>=10){n=1;break}}}while(0);l=la;return n|0}function pp(a){a=a|0;return 0}function qp(a){a=a|0;return}function rp(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=e+16|0;g=c[f>>2]|0;if(!g)if(!(zp(e)|0)){g=c[f>>2]|0;h=5}else f=0;else h=5;a:do if((h|0)==5){j=e+20|0;i=c[j>>2]|0;f=i;if((g-i|0)>>>0>>0){f=pb[c[e+36>>2]&63](e,b,d)|0;break}b:do if((a[e+75>>0]|0)>-1){i=d;while(1){if(!i){h=0;g=b;break b}g=i+-1|0;if((a[b+g>>0]|0)==10)break;else i=g}f=pb[c[e+36>>2]&63](e,b,i)|0;if(f>>>0>>0)break a;h=i;g=b+i|0;d=d-i|0;f=c[j>>2]|0}else{h=0;g=b}while(0);cr(f|0,g|0,d|0)|0;c[j>>2]=(c[j>>2]|0)+d;f=h+d|0}while(0);return f|0}function sp(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=b;break a}case 10:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=b;c[e+4>>2]=((b|0)<0)<<31>>31;break a}case 11:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=b;c[e+4>>2]=0;break a}case 12:{e=(c[d>>2]|0)+(8-1)&~(8-1);b=e;f=c[b>>2]|0;b=c[b+4>>2]|0;c[d>>2]=e+8;e=a;c[e>>2]=f;c[e+4>>2]=b;break a}case 13:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;e=(e&65535)<<16>>16;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a}case 14:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e&65535;c[f+4>>2]=0;break a}case 15:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;e=(e&255)<<24>>24;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a}case 16:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e&255;c[f+4>>2]=0;break a}case 17:{f=(c[d>>2]|0)+(8-1)&~(8-1);g=+h[f>>3];c[d>>2]=f+8;h[a>>3]=g;break a}case 18:{f=(c[d>>2]|0)+(8-1)&~(8-1);g=+h[f>>3];c[d>>2]=f+8;h[a>>3]=g;break a}default:break a}while(0);while(0);return}function tp(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if(c>>>0>0|(c|0)==0&b>>>0>4294967295){while(1){e=nr(b|0,c|0,10,0)|0;d=d+-1|0;a[d>>0]=e|48;e=b;b=ir(b|0,c|0,10,0)|0;if(!(c>>>0>9|(c|0)==9&e>>>0>4294967295))break;else c=D}c=b}else c=b;if(c)while(1){d=d+-1|0;a[d>>0]=(c>>>0)%10|0|48;if(c>>>0<10)break;else c=(c>>>0)/10|0}return d|0}function up(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;i=l;l=l+256|0;if((l|0)>=(m|0))$(256);h=i;do if((d|0)>(e|0)&(f&73728|0)==0){f=d-e|0;Yq(h|0,b|0,(f>>>0>256?256:f)|0)|0;b=c[a>>2]|0;g=(b&32|0)==0;if(f>>>0>255){d=d-e|0;do{if(g){rp(h,256,a)|0;b=c[a>>2]|0}f=f+-256|0;g=(b&32|0)==0}while(f>>>0>255);if(g)f=d&255;else break}else if(!g)break;rp(h,f,a)|0}while(0);l=i;return}function vp(a,b){a=a|0;b=b|0;if(!a)a=0;else a=yp(a,b,0)|0;return a|0}function wp(a,b){a=+a;b=b|0;return +(+xp(a,b))}function xp(a,b){a=+a;b=b|0;var d=0,e=0,f=0;h[j>>3]=a;d=c[j>>2]|0;e=c[j+4>>2]|0;f=gr(d|0,e|0,52)|0;switch(f&2047){case 0:{if(a!=0.0){a=+xp(a*18446744073709551616.0,b);d=(c[b>>2]|0)+-64|0}else d=0;c[b>>2]=d;break}case 2047:break;default:{c[b>>2]=(f&2047)+-1022;c[j>>2]=d;c[j+4>>2]=e&-2146435073|1071644672;a=+h[j>>3]}}return +a}function yp(b,d,e){b=b|0;d=d|0;e=e|0;do if(b){if(d>>>0<128){a[b>>0]=d;b=1;break}if(!(c[c[(Ao()|0)+188>>2]>>2]|0))if((d&-128|0)==57216){a[b>>0]=d;b=1;break}else{c[(zo()|0)>>2]=84;b=-1;break}if(d>>>0<2048){a[b>>0]=d>>>6|192;a[b+1>>0]=d&63|128;b=2;break}if(d>>>0<55296|(d&-8192|0)==57344){a[b>>0]=d>>>12|224;a[b+1>>0]=d>>>6&63|128;a[b+2>>0]=d&63|128;b=3;break}if((d+-65536|0)>>>0<1048576){a[b>>0]=d>>>18|240;a[b+1>>0]=d>>>12&63|128;a[b+2>>0]=d>>>6&63|128;a[b+3>>0]=d&63|128;b=4;break}else{c[(zo()|0)>>2]=84;b=-1;break}}else b=1;while(0);return b|0}function zp(b){b=b|0;var d=0,e=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;d=c[b>>2]|0;if(!(d&8)){c[b+8>>2]=0;c[b+4>>2]=0;e=c[b+44>>2]|0;c[b+28>>2]=e;c[b+20>>2]=e;c[b+16>>2]=e+(c[b+48>>2]|0);b=0}else{c[b>>2]=d|32;b=-1}return b|0}function Ap(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=a+20|0;f=c[e>>2]|0;a=(c[a+16>>2]|0)-f|0;a=a>>>0>d>>>0?d:a;cr(f|0,b|0,a|0)|0;c[e>>2]=(c[e>>2]|0)+a;return d|0}function Bp(a){a=a|0;var b=0;b=(cp(a)|0)==0;return (b?a:a&95)|0}function Cp(a){a=a|0;return (_o(a)|0)!=(a|0)|0}function Dp(a){a=a|0;if(a>>>0>=255)if((a+-57344|0)>>>0<8185|(a>>>0<8232|(a+-8234|0)>>>0<47062))a=1;else return ((a+-65532|0)>>>0>1048579|(a&65534|0)==65534)&1^1|0;else a=(a+1&127)>>>0>32&1;return a|0}function Ep(a,b){a=a|0;b=b|0;do switch(b|0){case 1:{a=Fp(a)|0;break}case 2:{a=bp(a)|0;break}case 3:{a=Wo(a)|0;break}case 4:{a=Gp(a)|0;break}case 5:{a=Hp(a)|0;break}case 6:{a=Ip(a)|0;break}case 7:{a=Cp(a)|0;break}case 8:{a=Dp(a)|0;break}case 9:{a=Jp(a)|0;break}case 10:{a=hp(a)|0;break}case 11:{a=Kp(a)|0;break}case 12:{a=Lp(a)|0;break}default:a=0}while(0);return a|0}function Fp(a){a=a|0;if(!(Hp(a)|0))a=(bp(a)|0)!=0;else a=1;return a&1|0}function Gp(a){a=a|0;if((a&-2|0)==8232|(a>>>0<32|(a+-127|0)>>>0<33))a=1;else a=(a+-65529|0)>>>0<3;return a&1|0}function Hp(a){a=a|0;return (a+-48|0)>>>0<10|0}function Ip(a){a=a|0;if(!(hp(a)|0))a=(Dp(a)|0)!=0;else a=0;return a&1|0}function Jp(a){a=a|0;if(a>>>0<131072)a=(d[67036+((d[67036+(a>>>8)>>0]|0)<<5|a>>>3&31)>>0]|0)>>>(a&7)&1;else a=0;return a|0}function Kp(a){a=a|0;return ($o(a)|0)!=(a|0)|0}function Lp(a){a=a|0;return ((a+-48|0)>>>0<10|((a|32)+-97|0)>>>0<6)&1|0}function Mp(a,b){a=a|0;b=b|0;Np(a,b)|0;return a|0}function Np(b,d){b=b|0;d=d|0;var e=0,f=0;e=d;a:do if(!((e^b)&3)){if(e&3)do{e=a[d>>0]|0;a[b>>0]=e;if(!(e<<24>>24))break a;d=d+1|0;b=b+1|0}while((d&3|0)!=0);e=c[d>>2]|0;if(!((e&-2139062144^-2139062144)&e+-16843009)){f=b;while(1){d=d+4|0;b=f+4|0;c[f>>2]=e;e=c[d>>2]|0;if((e&-2139062144^-2139062144)&e+-16843009|0)break;else f=b}}f=8}else f=8;while(0);if((f|0)==8){f=a[d>>0]|0;a[b>>0]=f;if(f<<24>>24)do{d=d+1|0;b=b+1|0;f=a[d>>0]|0;a[b>>0]=f}while(f<<24>>24!=0)}return b|0}function Op(b,c){b=b|0;c=c|0;var e=0,f=0,g=0;e=a[b>>0]|0;a:do if(!(e<<24>>24))e=0;else{g=e&255;while(1){f=a[c>>0]|0;if(!(f<<24>>24))break a;if(e<<24>>24!=f<<24>>24?(g=Yo(g)|0,(g|0)!=(Yo(f&255)|0)):0)break a;b=b+1|0;c=c+1|0;e=a[b>>0]|0;if(!(e<<24>>24)){e=0;break}else g=e&255}}while(0);g=Yo(e&255)|0;return g-(Yo(d[c>>0]|0)|0)|0}function Pp(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=d;d=Qp(a,b,f)|0;l=e;return d|0}function Qp(a,b,c){a=a|0;b=b|0;c=c|0;return mp(a,2147483647,b,c)|0}function Rp(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=d;d=np(a,b,f)|0;l=e;return d|0}function Sp(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if((c[f+76>>2]|0)>-1)m=pp(f)|0;else m=0;g=e+-1|0;if((e|0)<2){n=f+74|0;l=a[n>>0]|0;a[n>>0]=l+255|l;if(m|0)qp(f);if(!g)a[b>>0]=0;else b=0}else{a:do if(g){k=f+4|0;l=f+8|0;e=b;while(1){h=c[k>>2]|0;o=h;p=(c[l>>2]|0)-o|0;i=No(h,10,p)|0;j=(i|0)==0;i=j?p:1-o+i|0;i=i>>>0>>0?i:g;cr(e|0,h|0,i|0)|0;h=(c[k>>2]|0)+i|0;c[k>>2]=h;e=e+i|0;i=g-i|0;if(!(j&(i|0)!=0)){n=17;break a}if(h>>>0>=(c[l>>2]|0)>>>0){g=So(f)|0;if((g|0)<0)break;else j=g}else{c[k>>2]=h+1;j=d[h>>0]|0}g=i+-1|0;h=e+1|0;a[e>>0]=j;if(!((g|0)!=0&(j&255|0)!=10)){e=h;n=17;break a}else e=h}if((e|0)!=(b|0)?(c[f>>2]&16|0)!=0:0)n=17;else b=0}else{e=b;n=17}while(0);if((n|0)==17)if(!b)b=0;else a[e>>0]=0;if(m)qp(f)}return b|0}function Tp(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0;a:do if(!d)b=0;else{while(1){e=a[b>>0]|0;f=a[c>>0]|0;if(e<<24>>24!=f<<24>>24)break;d=d+-1|0;if(!d){b=0;break a}else{b=b+1|0;c=c+1|0}}b=(e&255)-(f&255)|0}while(0);return b|0}function Up(a){a=a|0;var b=0,d=0;b=l;l=l+16|0;if((l|0)>=(m|0))$(16);d=b;c[d>>2]=Co(a)|0;a=cb(6,d|0)|0;a=yo((a|0)==-4?0:a)|0;l=b;return a|0}function Vp(a,b,c){a=a|0;b=b|0;c=c|0;Wp(a,b,c)|0;return a|0}function Wp(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;g=d;do if(!((g^b)&3)){f=(e|0)!=0;a:do if(f&(g&3|0)!=0)while(1){g=a[d>>0]|0;a[b>>0]=g;if(!(g<<24>>24))break a;e=e+-1|0;d=d+1|0;b=b+1|0;f=(e|0)!=0;if(!(f&(d&3|0)!=0)){h=5;break}}else h=5;while(0);if((h|0)==5)if(!f){e=0;break}if(a[d>>0]|0){b:do if(e>>>0>3){f=d;while(1){d=c[f>>2]|0;if((d&-2139062144^-2139062144)&d+-16843009|0){d=f;break b}c[b>>2]=d;e=e+-4|0;d=f+4|0;b=b+4|0;if(e>>>0>3)f=d;else break}}while(0);h=11}}else h=11;while(0);c:do if((h|0)==11)if(!e)e=0;else while(1){h=a[d>>0]|0;a[b>>0]=h;if(!(h<<24>>24))break c;e=e+-1|0;b=b+1|0;if(!e){e=0;break}else d=d+1|0}while(0);Yq(b|0,0,e|0)|0;return b|0}function Xp(a){a=a|0;return er(a|0)|0}function Yp(a){a=a|0;return er(a|0)|0}function Zp(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;j=l;l=l+16|0;if((l|0)>=(m|0))$(16);g=j;a:do if(!e)b=0;else{do if(f|0){i=(b|0)==0?g:b;b=a[e>>0]|0;if(b<<24>>24>-1){c[i>>2]=b&255;b=b<<24>>24!=0&1;break a}h=(c[c[(Ao()|0)+188>>2]>>2]|0)==0;b=a[e>>0]|0;if(h){c[i>>2]=b<<24>>24&57343;b=1;break a}b=(b&255)+-194|0;if(b>>>0<=50){g=e+1|0;h=c[15868+(b<<2)>>2]|0;if(f>>>0<4?h&-2147483648>>>((f*6|0)+-6|0)|0:0)break;b=d[g>>0]|0;f=b>>>3;if((f+-16|f+(h>>26))>>>0<=7){b=b+-128|h<<6;if((b|0)>=0){c[i>>2]=b;b=2;break a}g=(d[e+2>>0]|0)+-128|0;if(g>>>0<=63){g=g|b<<6;if((g|0)>=0){c[i>>2]=g;b=3;break a}b=(d[e+3>>0]|0)+-128|0;if(b>>>0<=63){c[i>>2]=b|g<<6;b=4;break a}}}}}while(0);c[(zo()|0)>>2]=84;b=-1}while(0);l=j;return b|0}function _p(b){b=b|0;var c=0,d=0,e=0;d=(Ko(b,43)|0)==0;c=a[b>>0]|0;d=d?c<<24>>24!=114&1:2;e=(Ko(b,120)|0)==0;d=e?d:d|128;b=(Ko(b,101)|0)==0;b=b?d:d|524288;b=c<<24>>24==114?b:b|64;b=c<<24>>24==119?b|512:b;return (c<<24>>24==97?b|1024:b)|0}function $p(a){a=a|0;var b=0,d=0;do if(a){if((c[a+76>>2]|0)<=-1){b=hq(a)|0;break}d=(pp(a)|0)==0;b=hq(a)|0;if(!d)qp(a)}else{if(!(c[3934]|0))b=0;else b=$p(c[3934]|0)|0;a=c[(dq()|0)>>2]|0;if(a)do{if((c[a+76>>2]|0)>-1)d=pp(a)|0;else d=0;if((c[a+20>>2]|0)>>>0>(c[a+28>>2]|0)>>>0)b=hq(a)|0|b;if(d|0)qp(a);a=c[a+56>>2]|0}while((a|0)!=0);eq()}while(0);return b|0}function aq(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;i=l;l=l+48|0;if((l|0)>=(m|0))$(48);h=i+32|0;g=i+16|0;e=i;if(No(70204,a[d>>0]|0,4)|0){f=_p(d)|0;c[e>>2]=b;c[e+4>>2]=f|32768;c[e+8>>2]=438;e=yo(db(5,e|0)|0)|0;if((e|0)>=0){if(f&524288|0){c[g>>2]=e;c[g+4>>2]=2;c[g+8>>2]=1;wa(221,g|0)|0}b=fq(e,d)|0;if(!b){c[h>>2]=e;cb(6,h|0)|0;b=0}}else b=0}else{c[(zo()|0)>>2]=22;b=0}l=i;return b|0}function bq(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;if((c[a+76>>2]|0)>-1)f=pp(a)|0;else f=0;cq(a);g=(c[a>>2]&1|0)!=0;if(!g){e=dq()|0;d=c[a+52>>2]|0;b=a+56|0;if(d|0)c[d+56>>2]=c[b>>2];b=c[b>>2]|0;if(b|0)c[b+52>>2]=d;if((c[e>>2]|0)==(a|0))c[e>>2]=b;eq()}b=$p(a)|0;b=tb[c[a+12>>2]&15](a)|0|b;d=c[a+92>>2]|0;if(d|0)Pq(d);if(g){if(f|0)qp(a)}else Pq(a);return b|0}function cq(a){a=a|0;var b=0,d=0;do if(c[a+68>>2]|0){b=c[a+116>>2]|0;d=b;a=a+112|0;if(b|0)c[b+112>>2]=c[a>>2];a=c[a>>2]|0;if(!a){c[(Ao()|0)+232>>2]=d;break}else{c[a+116>>2]=d;break}}while(0);return}function dq(){bb(70840);return 70848}function eq(){_a(70840);return}function fq(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0;p=l;l=l+64|0;if((l|0)>=(m|0))$(64);o=p+40|0;j=p+24|0;i=p+16|0;f=p;k=p+56|0;e=a[d>>0]|0;if(No(70204,e<<24>>24,4)|0){n=Oq(1156)|0;if(!n)e=0;else{g=n;h=g+124|0;do{c[g>>2]=0;g=g+4|0}while((g|0)<(h|0));if(!(Ko(d,43)|0))c[n>>2]=e<<24>>24==114?8:4;if(Ko(d,101)|0){c[f>>2]=b;c[f+4>>2]=2;c[f+8>>2]=1;wa(221,f|0)|0;e=a[d>>0]|0}if(e<<24>>24==97){c[i>>2]=b;c[i+4>>2]=3;e=wa(221,i|0)|0;if(!(e&1024)){c[j>>2]=b;c[j+4>>2]=4;c[j+8>>2]=e|1024;wa(221,j|0)|0}d=c[n>>2]|128;c[n>>2]=d}else d=c[n>>2]|0;c[n+60>>2]=b;c[n+44>>2]=n+132;c[n+48>>2]=1024;e=n+75|0;a[e>>0]=-1;if((d&8|0)==0?(c[o>>2]=b,c[o+4>>2]=21523,c[o+8>>2]=k,(Za(54,o|0)|0)==0):0)a[e>>0]=10;c[n+32>>2]=35;c[n+36>>2]=25;c[n+40>>2]=24;c[n+12>>2]=10;if(!(c[17695]|0))c[n+76>>2]=-1;e=gq(n)|0}}else{c[(zo()|0)>>2]=22;e=0}l=p;return e|0}function gq(a){a=a|0;var b=0,d=0;b=dq()|0;c[a+56>>2]=c[b>>2];d=c[b>>2]|0;if(d|0)c[d+52>>2]=a;c[b>>2]=a;eq();return a|0}function hq(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=a+20|0;h=a+28|0;if((c[b>>2]|0)>>>0>(c[h>>2]|0)>>>0?(pb[c[a+36>>2]&63](a,0,0)|0,(c[b>>2]|0)==0):0)a=-1;else{d=a+4|0;e=c[d>>2]|0;f=a+8|0;g=c[f>>2]|0;if(e>>>0>>0)pb[c[a+40>>2]&63](a,e-g|0,1)|0;c[a+16>>2]=0;c[h>>2]=0;c[b>>2]=0;c[f>>2]=0;c[d>>2]=0;a=0}return a|0}function iq(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=S(d,b)|0;d=(b|0)==0?0:d;if((c[e+76>>2]|0)>-1){g=(pp(e)|0)==0;a=rp(a,f,e)|0;if(!g)qp(e)}else a=rp(a,f,e)|0;if((a|0)!=(f|0))d=(a>>>0)/(b>>>0)|0;return d|0}function jq(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;t=l;l=l+192|0;if((l|0)>=(m|0))$(192);i=t+152|0;h=t+136|0;s=t+120|0;r=t+104|0;q=t+96|0;n=t+80|0;k=t+64|0;f=t+48|0;o=t+32|0;g=t+16|0;e=t;u=t+176|0;j=t+168|0;c[u>>2]=d;d=(c[u>>2]|0)+(4-1)&~(4-1);p=c[d>>2]|0;c[u>>2]=d+4;p=(b|0)==4?p|32768:p;a:do switch(b|0){case 14:{c[e>>2]=a;c[e+4>>2]=14;c[e+8>>2]=p;d=yo(wa(221,e|0)|0)|0;break}case 9:{c[g>>2]=a;c[g+4>>2]=16;c[g+8>>2]=j;d=wa(221,g|0)|0;switch(d|0){case -22:{c[o>>2]=a;c[o+4>>2]=9;c[o+8>>2]=p;d=wa(221,o|0)|0;break}case 0:{d=c[j+4>>2]|0;d=(c[j>>2]|0)==2?0-d|0:d;break}default:d=yo(d)|0}break}case 1030:{c[f>>2]=a;c[f+4>>2]=1030;c[f+8>>2]=p;d=wa(221,f|0)|0;if((d|0)!=-22){if((d|0)>-1){c[k>>2]=d;c[k+4>>2]=2;c[k+8>>2]=1;wa(221,k|0)|0}d=yo(d)|0;break a}c[n>>2]=a;c[n+4>>2]=1030;c[n+8>>2]=0;d=wa(221,n|0)|0;if((d|0)==-22){c[r>>2]=a;c[r+4>>2]=0;c[r+8>>2]=p;d=wa(221,r|0)|0;if((d|0)>-1){c[s>>2]=d;c[s+4>>2]=2;c[s+8>>2]=1;wa(221,s|0)|0}d=yo(d)|0;break a}else{if((d|0)>-1){c[q>>2]=d;cb(6,q|0)|0}d=yo(-22)|0;break a}}case 15:case 16:case 12:case 13:{c[h>>2]=a;c[h+4>>2]=b;c[h+8>>2]=p;d=yo(wa(221,h|0)|0)|0;break}default:{c[i>>2]=a;c[i+4>>2]=b;c[i+8>>2]=p;d=yo(wa(221,i|0)|0)|0}}while(0);l=t;return d|0}function kq(a){a=a|0;var b=0;if((c[a+76>>2]|0)>-1){b=(pp(a)|0)==0;a=(c[a>>2]|0)>>>4&1}else a=(c[a>>2]|0)>>>4&1;return a|0}function lq(b,c){b=b|0;c=c|0;var d=0,e=0,f=0;d=b;e=70208;f=d+15|0;do{a[d>>0]=a[e>>0]|0;d=d+1|0;e=e+1|0}while((d|0)<(f|0));if(!c){a[b+14>>0]=48;a[b+15>>0]=0}else{e=c;d=14;while(1){d=d+1|0;if(e>>>0<10)break;else e=(e>>>0)/10|0}a[b+d>>0]=0;while(1){d=d+-1|0;a[b+d>>0]=(c>>>0)%10|0|48;if(c>>>0<10)break;else c=(c>>>0)/10|0}}return}function mq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;g=l;l=l+48|0;if((l|0)>=(m|0))$(48);f=g+40|0;e=g+8|0;d=g;c[d>>2]=a;c[d+4>>2]=b;d=Ka(197,d|0)|0;if((d|0)==-9?(c[e>>2]=a,c[e+4>>2]=1,(wa(221,e|0)|0)>=0):0){lq(e,a);c[f>>2]=e;c[f+4>>2]=b;b=yo(La(195,f|0)|0)|0}else b=yo(d)|0;l=g;return b|0}function nq(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=l;l=l+32|0;if((l|0)>=(m|0))$(32);h=g;c[h>>2]=a;c[h+4>>2]=b;c[h+8>>2]=d;c[h+12>>2]=e;c[h+16>>2]=f;f=yo(lb(142,h|0)|0)|0;l=g;return f|0}function oq(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=a;c[f+4>>2]=b;c[f+8>>2]=d;d=yo(eb(4,f|0)|0)|0;l=e;return d|0}function pq(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=l;l=l+16|0;if((l|0)>=(m|0))$(16);f=e;c[f>>2]=a;c[f+4>>2]=b;c[f+8>>2]=d;d=yo(ab(3,f|0)|0)|0;l=e;return d|0}function qq(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=Ba(20,a|0)|0;l=a;return b|0}function rq(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=l;l=l+32|0;if((l|0)>=(m|0))$(32);g=f;c[g>>2]=b;c[g+4>>2]=d;c[g+8>>2]=e;c[g+12>>2]=a;a=g+16|0;c[a>>2]=-1;tq(6,g);a=c[a>>2]|0;if(a)if((a|0)>0){c[(zo()|0)>>2]=a;a=-1}else a=-1;else a=0;l=f;return a|0}function sq(a){a=a|0;a=a+16|0;if((c[a>>2]|0)<=0)c[a>>2]=1;return}function tq(a,b){a=a|0;b=b|0;rb[a&7](b);return}function uq(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=Na(199,a|0)|0;l=a;return b|0}function vq(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=a;c[e+4>>2]=b;b=yo(Ya(33,e|0)|0)|0;l=d;return b|0}function wq(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=hb(201,a|0)|0;l=a;return b|0}function xq(a){a=a|0;return rq(213,a,0,0)|0}function yq(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=a;c[e+4>>2]=0;c[e+8>>2]=b;c[e+12>>2]=((b|0)<0)<<31>>31;b=yo(Ma(194,e|0)|0)|0;l=d;return b|0}function zq(){var a=0,b=0;a=l;l=l+16|0;if((l|0)>=(m|0))$(16);b=ya(64,a|0)|0;l=a;return b|0}function Aq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;j=l;l=l+32|0;if((l|0)>=(m|0))$(32);i=j;h=((g|0)<0)<<31>>31;do if((g&4095|0)==0&(h&-4096|0)==0){if(b>>>0>2147483646){c[(zo()|0)>>2]=12;a=-1;break}if(e&16|0)Vo();h=gr(g|0,h|0,12)|0;c[i>>2]=a;c[i+4>>2]=b;c[i+8>>2]=d;c[i+12>>2]=e;c[i+16>>2]=f;c[i+20>>2]=h;a=yo(Ja(192,i|0)|0)|0}else{c[(zo()|0)>>2]=22;a=-1}while(0);l=j;return a|0}function Bq(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;h=l;l=l+48|0;if((l|0)>=(m|0))$(48);g=h+16|0;f=h;e=h+32|0;if(!(b&4194368))e=0;else{c[e>>2]=d;i=(c[e>>2]|0)+(4-1)&~(4-1);d=c[i>>2]|0;c[e>>2]=i+4;e=d}c[f>>2]=a;c[f+4>>2]=b|32768;c[f+8>>2]=e;e=db(5,f|0)|0;if(!((b&524288|0)==0|(e|0)<0)){c[g>>2]=e;c[g+4>>2]=2;c[g+8>>2]=1;wa(221,g|0)|0}i=yo(e)|0;l=h;return i|0}function Cq(a){a=a|0;bb(70852);Dq(a);_a(70852);return}function Dq(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;f=c[4071]|0;if(!f)c[c[4072]>>2]=a;else{c[4073]=(f|0)==31|(f|0)==7?3:1;c[17715]=0;if((f|0)>0){b=c[4072]|0;e=0;d=0;do{g=kr(a|0,d|0,1284865837,1481765933)|0;a=_q(g|0,D|0,1,0)|0;d=D;c[b+(e<<2)>>2]=d;e=e+1|0}while((e|0)<(f|0))}else b=c[4072]|0;c[b>>2]=c[b>>2]|1}return}function Eq(){var a=0,b=0,d=0,e=0,f=0;bb(70852);a=c[4071]|0;if(!a){b=c[4072]|0;a=(S(c[b>>2]|0,1103515245)|0)+12345&2147483647;c[b>>2]=a}else{d=c[17715]|0;b=c[4072]|0;e=c[4073]|0;f=b+(e<<2)|0;b=(c[f>>2]|0)+(c[b+(d<<2)>>2]|0)|0;c[f>>2]=b;e=e+1|0;c[4073]=(e|0)==(a|0)?0:e;d=d+1|0;c[17715]=(d|0)==(a|0)?0:d;a=b>>>1}_a(70852);return a|0}function Fq(b){b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;while(1){e=a[b>>0]|0;c=e<<24>>24;f=b+1|0;if(!(Lo(c)|0))break;else b=f}switch(c|0){case 45:{b=1;g=5;break}case 43:{b=0;g=5;break}default:{h=0;d=b;b=e}}if((g|0)==5){h=b;d=f;b=a[f>>0]|0}c=(b<<24>>24)+-48|0;if(c>>>0<10){b=0;do{d=d+1|0;b=(b*10|0)-c|0;c=(a[d>>0]|0)+-48|0}while(c>>>0<10)}else b=0;return (h|0?b:0-b|0)|0}function Gq(a,b){a=a|0;b=b|0;var d=0,e=0;d=l;l=l+16|0;if((l|0)>=(m|0))$(16);e=d;c[e>>2]=a;c[e+4>>2]=b;b=yo(Wa(77,e|0)|0)|0;l=d;return b|0}function Hq(a,b){a=a|0;b=b|0;if(!a)b=Qq(1,24)|0;else{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0}return b|0}function Iq(a){a=a|0;var b=0,d=0;b=c[a>>2]|0;if(b|0)do{Pq(c[b>>2]|0);d=b;b=c[b+4>>2]|0;Pq(d)}while((b|0)!=0);Pq(a);return}function Jq(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;h=a+16|0;a:do if(!(c[h>>2]|0)){k=a+12|0;g=c[k>>2]|0;do if(g>>>0>>0){if(b|0)if(!d){c[h>>2]=1;b=0;break a}else{i=a+8|0;c[i>>2]=d;c[k>>2]=1024;h=d;b=d;g=1024;break}g=f<<3;g=g>>>0>1024?g:1024;i=Oq(8)|0;if(!i){c[h>>2]=1;b=0;break a}b=Oq(g)|0;c[i>>2]=b;j=b;if(!b){Pq(i);c[h>>2]=1;b=0;break a}c[i+4>>2]=0;d=a+4|0;h=c[d>>2]|0;if(h|0)c[h+4>>2]=i;if(!(c[a>>2]|0))c[a>>2]=i;c[d>>2]=i;i=a+8|0;c[i>>2]=j;c[k>>2]=g;h=j}else{i=a+8|0;b=c[i>>2]|0;h=b}while(0);d=h+f&3;d=((d|0)==0?0:4-d|0)+f|0;c[i>>2]=b+d;c[k>>2]=g-d;if(e)Yq(b|0,0,d|0)|0}else b=0;while(0);return b|0}function Kq(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0;Z=l;l=l+16|0;if((l|0)>=(m|0))$(16);U=Z;X=c[a+4>>2]|0;Y=X+56|0;W=(c[Y>>2]&8|0)==0?d:0;R=X+40|0;a=c[R>>2]|0;if((a|0)>0&(W|0)!=0){a=Oq(a<<2)|0;if(!a)a=12;else{V=a;T=3}}else{V=0;T=3}if((T|0)==3){if(!(c[X+60>>2]|0)){c[U>>2]=0;i=f&1;Q=f&2;h=c[Y>>2]&4;if(!V)O=0;else O=c[R>>2]|0;P=O<<2;g=c[X+52>>2]|0;f=g<<3;d=f+8|0;a=P+12+f+(d+(S(P,g)|0)<<1)|0;R=Oq(a)|0;if(!R){a=12;d=0}else{Yq(R|0,0,a|0)|0;a=R+P|0;j=a&3;j=a+((j|0)==0?0:4-j|0)|0;a=j+d|0;k=a&3;k=a+((k|0)==0?0:4-k|0)|0;a=k+d|0;N=a&3;N=a+((N|0)==0?0:4-N|0)|0;a=N+f|0;d=a&3;if((g|0)>0){a=a+((d|0)==0?0:4-d|0)|0;d=0;while(1){c[k+(d<<3)+4>>2]=a;a=a+P|0;c[j+(d<<3)+4>>2]=a;d=d+1|0;if((d|0)==(g|0)){a=0;break}else a=a+P|0}do{c[N+(a<<3)>>2]=-1;a=a+1|0}while((a|0)!=(g|0))}a=Zp(U,b,4)|0;if((a|0)<1)if((a|0)<0){a=1;d=0}else{a=1;T=201}else T=201;a:do if((T|0)==201){M=X+8|0;F=(h|0)!=0;G=(O|0)>0;H=X+12|0;I=X+44|0;J=X+32|0;K=X+36|0;L=(O|0)==0;E=(i|0)==0;D=(O|0)<1;g=0;w=b+a|0;v=0;h=0;d=-1;f=j;B=R;z=j;x=k;while(1){if((d|0)<0){i=c[M>>2]|0;j=i+8|0;b:do if(c[j>>2]|0){q=(v|0)!=0;r=(g|0)==95;s=(v|0)==0;u=F&(g|0)==10;t=E&(v|0)<1;while(1){c:while(1){p=i+12|0;if((c[N+(c[p>>2]<<3)>>2]|0)>=(v|0))break;o=i+20|0;k=c[o>>2]|0;if(!k){T=236;break}d:do if(u|(t|(k&1|0)==0)){if(k&2|0?(b=c[U>>2]|0,!((b|Q|0)==0|F&(b|0)==10)):0)break;do if(k&16|0){if(r)break d;if(Fp(g)|0)break d;k=c[U>>2]|0;if((k|0)==95)break;if(!(Fp(k)|0))break d}while(0);k=c[o>>2]|0;if(k&32){if(r){k=c[U>>2]|0;if((k|0)==95)break}else{b=(Fp(g)|0)==0;k=c[U>>2]|0;if(b|(k|0)==95)break}if(Fp(k)|0)break;k=c[o>>2]|0}n=c[U>>2]|0;do if((n|0)!=0&(q&(k&64|0)!=0)){if(r)k=1;else{k=(Fp(g)|0)!=0;n=c[U>>2]|0}if((n|0)==95)if(k)break d;else break;else if(k^(Fp(n)|0)!=0)break;else break d}while(0);if(!(c[o>>2]&128)){T=236;break c}k=c[U>>2]|0;if(s|(k|0)==0)break;if(r)n=1;else{n=(Fp(g)|0)!=0;k=c[U>>2]|0}if((k|0)==95)if(n){T=236;break c}else break;else if(n^(Fp(k)|0)!=0)break;else{T=236;break c}}while(0);j=i+40|0;if(!(c[j>>2]|0))break b;else i=i+32|0}if((T|0)==236){T=0;c[f>>2]=c[j>>2];if(G)Yq(c[f+4>>2]|0,-1,P|0)|0;j=c[i+16>>2]|0;do if(j|0){k=c[j>>2]|0;if((k|0)<=-1)break;n=f+4|0;do{if((k|0)<(O|0))c[(c[n>>2]|0)+(k<<2)>>2]=v;j=j+4|0;k=c[j>>2]|0}while((k|0)>-1)}while(0);j=(c[f>>2]|0)!=(c[H>>2]|0);if(D|j){h=j?h:1;d=j?d:v;j=f+4|0}else{j=f+4|0;h=c[j>>2]|0;d=0;do{c[V+(d<<2)>>2]=c[h+(d<<2)>>2];d=d+1|0}while((d|0)!=(O|0));h=1;d=v}b=c[p>>2]|0;c[N+(b<<3)>>2]=v;c[N+(b<<3)+4>>2]=j;f=f+8|0}j=i+40|0;if(!(c[j>>2]|0))break;else i=i+32|0}}while(0);c[f>>2]=0;f=c[U>>2]|0;if(!f)break;else g=f}else{if(L)break;g=c[U>>2]|0;if(!((f|0)!=(z|0)&(g|0)!=0))break}C=v+a|0;a=Zp(U,w,4)|0;if((a|0)<1)if((a|0)<0){a=1;d=0;break a}else a=1;A=w+a|0;if((h|0)!=0&(c[I>>2]|0)!=0){if(!(c[z>>2]|0))f=x;else{p=c[K>>2]|0;q=c[p>>2]|0;r=(q|0)>-1;o=z;f=x;do{n=o+4|0;e:do if(r){i=0;k=q;do{j=c[p+((i|1)<<2)>>2]|0;if((k|0)>=(O|0))break e;h=c[n>>2]|0;if((c[h+(j<<2)>>2]|0)==(c[V+(j<<2)>>2]|0)?(c[h+(k<<2)>>2]|0)<(c[V+(k<<2)>>2]|0):0)break e;i=i+2|0;k=c[p+(i<<2)>>2]|0}while((k|0)>-1);i=n;T=265}else{i=n;h=c[n>>2]|0;T=265}while(0);if((T|0)==265){T=0;c[f>>2]=c[o>>2];y=f+4|0;b=c[y>>2]|0;c[y>>2]=h;c[i>>2]=b;f=f+8|0}o=o+8|0}while((c[o>>2]|0)!=0)}c[f>>2]=0;y=z;h=0}else{y=x;x=z}i=c[x>>2]|0;if(!i){i=B;f=y}else{s=(C|0)!=0;t=(g|0)==95;u=(C|0)==0;w=F&(g|0)==10;v=E&(C|0)<1;r=x;j=B;f=y;while(1){k=i+8|0;if(c[k>>2]|0){q=r+4|0;p=j;o=k;while(1){f:do if((c[i>>2]|0)>>>0>g>>>0)j=p;else{if((c[i+4>>2]|0)>>>0>>0){j=p;break}n=i+20|0;j=c[n>>2]|0;do if(j|0){if(!(w|(v|(j&1|0)==0))){j=p;break f}if(j&2|0?(b=c[U>>2]|0,!((b|Q|0)==0|F&(b|0)==10)):0){j=p;break f}do if(j&16|0){if(t){j=p;break f}if(Fp(g)|0){j=p;break f}j=c[U>>2]|0;if((j|0)==95)break;if(!(Fp(j)|0)){j=p;break f}}while(0);j=c[n>>2]|0;if(j&32){if(t){j=c[U>>2]|0;if((j|0)==95){j=p;break f}}else{b=(Fp(g)|0)==0;j=c[U>>2]|0;if(b|(j|0)==95){j=p;break f}}if(Fp(j)|0){j=p;break f}j=c[n>>2]|0}k=c[U>>2]|0;do if((k|0)!=0&(s&(j&64|0)!=0)){if(t)j=1;else{j=(Fp(g)|0)!=0;k=c[U>>2]|0}if((k|0)==95)if(j){j=p;break f}else break;else if(j^(Fp(k)|0)!=0)break;else{j=p;break f}}while(0);do if(c[n>>2]&128|0){j=c[U>>2]|0;if(u|(j|0)==0){j=p;break f}if(t)k=1;else{k=(Fp(g)|0)!=0;j=c[U>>2]|0}if((j|0)==95)if(k)break;else{j=p;break f}else if(k^(Fp(j)|0)!=0){j=p;break f}else break}while(0);j=c[n>>2]|0;do if(j&4){if(c[Y>>2]&2|0)break;if(!(Ep(g,c[i+24>>2]|0)|0)){j=p;break f}j=c[n>>2]|0}while(0);do if(j&4|0){if(!(c[Y>>2]&2))break;b=$o(g)|0;j=i+24|0;if(Ep(b,c[j>>2]|0)|0)break;b=_o(g)|0;if(!(Ep(b,c[j>>2]|0)|0)){j=p;break f}}while(0);if(!(c[n>>2]&8))break;if(Nq(c[i+28>>2]|0,g,c[Y>>2]&2)|0){j=p;break f}}while(0);if(G){k=c[q>>2]|0;j=0;do{c[p+(j<<2)>>2]=c[k+(j<<2)>>2];j=j+1|0}while((j|0)!=(O|0))}j=c[i+16>>2]|0;do if(j|0){k=c[j>>2]|0;if((k|0)<=-1)break;do{if((k|0)<(O|0))c[p+(k<<2)>>2]=C;j=j+4|0;k=c[j>>2]|0}while((k|0)>-1)}while(0);j=c[i+12>>2]|0;k=N+(j<<3)|0;if((c[k>>2]|0)>=(C|0)){j=c[N+(j<<3)+4>>2]|0;k=c[j>>2]|0;if(!(Lq(O,c[J>>2]|0,p,k)|0)){j=p;break}c[j>>2]=p;if((c[o>>2]|0)!=(c[H>>2]|0)){j=k;break}if(G)d=0;else{h=1;j=k;d=C;break}while(1){c[V+(d<<2)>>2]=c[p+(d<<2)>>2];d=d+1|0;if((d|0)==(O|0)){h=1;j=k;d=C;break f}}}b=c[o>>2]|0;c[f>>2]=b;B=f+4|0;n=c[B>>2]|0;c[B>>2]=p;c[k>>2]=C;c[N+(j<<3)+4>>2]=B;do if((b|0)==(c[H>>2]|0)){if((d|0)==-1)if(G)d=0;else{d=C;h=1;break}else{if(!G)break;if((c[p>>2]|0)>(c[V>>2]|0))break;else d=0}do{c[V+(d<<2)>>2]=c[p+(d<<2)>>2];d=d+1|0}while((d|0)<(O|0));d=C;h=1}while(0);j=n;f=f+8|0}while(0);o=i+40|0;if(!(c[o>>2]|0))break;else{i=i+32|0;p=j}}}r=r+8|0;i=c[r>>2]|0;if(!i){i=j;break}}}c[f>>2]=0;w=A;v=C;B=i;z=y}a=d>>>31}while(0);Pq(R)}}else{c[U>>2]=0;i=f&1;P=f&2;d=c[Y>>2]&4;Q=Hq(0,0)|0;g:do if(Q){j=Jq(Q,0,0,0,32)|0;if(!j){Iq(Q);d=0;a=12;break}c[j+24>>2]=0;c[j+28>>2]=0;k=c[R>>2]|0;if(k){f=Oq(k<<2)|0;if(!f){d=0;h=0;g=0;a=12}else T=9}else{f=0;T=9}h:do if((T|0)==9){a=c[X+28>>2]|0;if(a){h=Oq(a<<3)|0;if(!h){d=0;g=0;a=12;break}}else h=0;O=X+52|0;a=c[O>>2]|0;if(a){g=Oq(a<<2)|0;if(!g){d=0;a=12;break}}else g=0;J=X+8|0;K=X+12|0;L=(V|0)==0;M=(V|0)!=0;N=X+32|0;F=(d|0)!=0;G=(f|0)==0;H=(h|0)==0;I=(g|0)==0;E=(i|0)==0;o=b;n=1;i=-1;s=-1;a=k;i:while(1){if((a|0)>0){d=0;do{c[f+(d<<2)>>2]=-1;if(!L){c[V+(d<<2)>>2]=-1;a=c[R>>2]|0}d=d+1|0}while((d|0)<(a|0))}a=c[O>>2]|0;if((a|0)>0)Yq(g|0,0,a<<2|0)|0;k=c[U>>2]|0;D=n+i|0;a=Zp(U,o,4)|0;if((a|0)<1)if((a|0)<0){d=0;a=1;break h}else a=1;B=o+a|0;C=c[U>>2]|0;d=c[J>>2]|0;i=d+8|0;if(c[i>>2]|0){t=(D|0)!=0;u=(k|0)==95;v=(D|0)==0;x=F&(k|0)==10;w=E&(D|0)<1;r=d;d=0;q=0;p=i;while(1){o=r+20|0;i=c[o>>2]|0;j:do if(i){if(!(x|(w|(i&1|0)==0))){n=q;break}if(i&2|0?(A=c[U>>2]|0,!((A|P|0)==0|F&(A|0)==10)):0){n=q;break}do if(i&16|0){if(u){n=q;break j}if(Fp(k)|0){n=q;break j}i=c[U>>2]|0;if((i|0)==95)break;if(!(Fp(i)|0)){n=q;break j}}while(0);i=c[o>>2]|0;if(i&32){if(u){i=c[U>>2]|0;if((i|0)==95){n=q;break}}else{A=(Fp(k)|0)==0;i=c[U>>2]|0;if(A|(i|0)==95){n=q;break}}if(Fp(i)|0){n=q;break}i=c[o>>2]|0}n=c[U>>2]|0;do if((n|0)!=0&(t&(i&64|0)!=0)){if(u)i=1;else{i=(Fp(k)|0)!=0;n=c[U>>2]|0}if((n|0)==95)if(i){n=q;break j}else break;else if(i^(Fp(n)|0)!=0)break;else{n=q;break j}}while(0);if(!(c[o>>2]&128)){T=52;break}i=c[U>>2]|0;if(v|(i|0)==0){n=q;break}if(u)n=1;else{n=(Fp(k)|0)!=0;i=c[U>>2]|0}if((i|0)==95)if(n){T=52;break}else{n=q;break}else if(n^(Fp(i)|0)!=0){n=q;break}else{T=52;break}}else T=52;while(0);do if((T|0)==52){T=0;if(!q){d=c[r+16>>2]|0;n=c[p>>2]|0;break}n=j+28|0;i=c[n>>2]|0;if(!i){i=Jq(Q,0,0,0,32)|0;if(!i){T=56;break i}c[i+24>>2]=j;c[i+28>>2]=0;A=Jq(Q,0,0,0,c[R>>2]<<2)|0;c[i+20>>2]=A;if(!A){T=63;break i}c[n>>2]=i;j=i}else j=i;c[j>>2]=D;c[j+4>>2]=B;c[j+8>>2]=c[p>>2];c[j+12>>2]=c[r+12>>2];c[j+16>>2]=c[U>>2];if((c[R>>2]|0)>0){n=c[j+20>>2]|0;i=0;do{c[n+(i<<2)>>2]=c[f+(i<<2)>>2];i=i+1|0}while((i|0)<(c[R>>2]|0))}i=c[r+16>>2]|0;if(!i){n=q;break}n=c[i>>2]|0;if((n|0)<=-1){n=q;break}o=c[j+20>>2]|0;do{i=i+4|0;c[o+(n<<2)>>2]=D;n=c[i>>2]|0}while((n|0)>-1);n=q}while(0);p=r+40|0;if(!(c[p>>2]|0))break;else{r=r+32|0;q=n}}if(d){i=c[d>>2]|0;if((i|0)>-1)do{c[f+(i<<2)>>2]=D;d=d+4|0;i=c[d>>2]|0}while((i|0)>-1)}else d=0;if(!n){i=D;q=0;n=B;T=174}else{o=k;p=D;t=B;A=s;z=n;T=82}}else{i=D;q=0;n=B;d=0;T=174}k:while(1){l:do if((T|0)==82){T=0;if((z|0)==(c[K>>2]|0)){if((A|0)>=(p|0)){if(!(M&(A|0)==(p|0))){s=A;k=o;i=p;q=z;n=t;T=174;continue k}if(!(Lq(c[R>>2]|0,c[N>>2]|0,f,V)|0)){s=A;k=o;i=A;q=z;n=t;T=174;continue k}}if(L){s=p;k=o;i=p;q=z;n=t;T=174;continue k}if((c[R>>2]|0)>0)i=0;else{s=p;k=o;i=p;q=z;n=t;T=174;continue k}while(1){c[V+(i<<2)>>2]=c[f+(i<<2)>>2];i=i+1|0;if((i|0)>=(c[R>>2]|0)){s=p;k=o;i=p;q=z;n=t;T=174;continue k}}}r=z+8|0;do if(!(c[r>>2]|0))T=98;else{if(!(c[z+20>>2]&256)){T=98;break}k=c[z+24>>2]|0;Mq(k+1|0,h,c[Y>>2]&-9,X,f,p);y=c[h+(k<<3)>>2]|0;k=(c[h+(k<<3)+4>>2]|0)-y|0;do if(!(Jo(b+y|0,t+-1|0,k)|0)){y=(k|0)==0;i=y&1;n=g+(c[z+12>>2]<<2)|0;if(y?c[n>>2]|0:0){k=o;i=p;n=t;o=25;break}c[n>>2]=i;i=k+-1|0;n=t+i|0;k=c[U>>2]|0;i=p+a+i|0;a=Zp(U,n,4)|0;if((a|0)<1)if((a|0)<0){o=2;break}else a=1;n=n+a|0;o=0}else{k=o;i=p;n=t;o=25}while(0);switch(o&31){case 25:{s=A;q=z;T=174;continue k}case 0:{y=i;break}default:{s=A;q=z;break l}}}while(0);if((T|0)==98){T=0;k=c[U>>2]|0;if(!k){s=A;k=o;i=p;q=z;n=t;T=174;continue k}i=p+a|0;a=Zp(U,t,4)|0;if((a|0)<1)if((a|0)<0){s=A;o=2;q=z;n=t;break}else a=1;y=i;n=t+a|0}if(!(c[r>>2]|0)){s=A;i=y;q=z;T=174;continue k}t=(y|0)!=0;u=(k|0)==95;v=(y|0)==0;x=F&(k|0)==10;w=E&(y|0)<1;q=0;s=z;m:while(1){n:do if((c[s>>2]|0)>>>0<=k>>>0){if((c[s+4>>2]|0)>>>0>>0)break;p=s+20|0;i=c[p>>2]|0;do if(i|0){if(!(x|(w|(i&1|0)==0)))break n;if(i&2|0?(T=c[U>>2]|0,!((T|P|0)==0|F&(T|0)==10)):0)break n;do if(i&16|0){if(u)break n;if(Fp(k)|0)break n;i=c[U>>2]|0;if((i|0)==95)break;if(!(Fp(i)|0))break n}while(0);i=c[p>>2]|0;if(i&32){if(u){i=c[U>>2]|0;if((i|0)==95)break n}else{T=(Fp(k)|0)==0;i=c[U>>2]|0;if(T|(i|0)==95)break n}if(Fp(i)|0)break n;i=c[p>>2]|0}o=c[U>>2]|0;do if((o|0)!=0&(t&(i&64|0)!=0)){if(u)i=1;else{i=(Fp(k)|0)!=0;o=c[U>>2]|0}if((o|0)==95)if(i)break n;else break;else if(i^(Fp(o)|0)!=0)break;else break n}while(0);do if(c[p>>2]&128|0){i=c[U>>2]|0;if(v|(i|0)==0)break n;if(u)o=1;else{o=(Fp(k)|0)!=0;i=c[U>>2]|0}if((i|0)==95)if(o)break;else break n;else if(o^(Fp(i)|0)!=0)break n;else break}while(0);i=c[p>>2]|0;do if(i&4){if(c[Y>>2]&2|0)break;if(!(Ep(k,c[s+24>>2]|0)|0))break n;i=c[p>>2]|0}while(0);do if(i&4|0){if(!(c[Y>>2]&2))break;T=$o(k)|0;i=s+24|0;if(Ep(T,c[i>>2]|0)|0)break;T=_o(k)|0;if(!(Ep(T,c[i>>2]|0)|0))break n}while(0);if(!(c[p>>2]&8))break;if(Nq(c[s+28>>2]|0,k,c[Y>>2]&2)|0)break n}while(0);if(!q){q=c[r>>2]|0;d=c[s+16>>2]|0;break}o=j+28|0;i=c[o>>2]|0;if(!i){i=Jq(Q,0,0,0,32)|0;if(!i){T=148;break m}c[i+24>>2]=j;c[i+28>>2]=0;T=Jq(Q,0,0,0,c[R>>2]<<2)|0;c[i+20>>2]=T;if(!T){T=155;break m}c[o>>2]=i;j=i}else j=i;c[j>>2]=y;c[j+4>>2]=n;c[j+8>>2]=c[r>>2];c[j+12>>2]=c[s+12>>2];c[j+16>>2]=c[U>>2];if((c[R>>2]|0)>0){o=c[j+20>>2]|0;i=0;do{c[o+(i<<2)>>2]=c[f+(i<<2)>>2];i=i+1|0}while((i|0)<(c[R>>2]|0))}i=c[s+16>>2]|0;if(!i)break;o=c[i>>2]|0;if((o|0)<=-1)break;p=c[j+20>>2]|0;do{c[p+(o<<2)>>2]=y;i=i+4|0;o=c[i>>2]|0}while((o|0)>-1)}while(0);r=s+40|0;if(!(c[r>>2]|0)){T=170;break}else s=s+32|0}if((T|0)==148){T=0;Iq(Q);if(!G)Pq(f);if(!H)Pq(h);if(I){s=A;i=y;o=1;q=z;break}Pq(g);s=A;i=y;o=1;q=z;break}else if((T|0)==155){T=0;Iq(Q);if(!G)Pq(f);if(!H)Pq(h);if(I){s=A;i=y;o=1;q=z;break}Pq(g);s=A;i=y;o=1;q=z;break}else if((T|0)==170){T=0;if(!q){s=A;i=y;q=z;T=174;continue k}if(!d){d=0;s=A;i=y;o=0;break}i=c[d>>2]|0;if((i|0)<=-1){s=A;i=y;o=0;break}do{d=d+4|0;c[f+(i<<2)>>2]=y;i=c[d>>2]|0}while((i|0)>-1);s=A;i=y;o=0}}else if((T|0)==174){T=0;o=c[j+24>>2]|0;if(!o){if((s|0)>-1|(c[U>>2]|0)==0){o=27;break}c[U>>2]=C;o=3;n=B;break}q=c[j+8>>2]|0;if(c[q+20>>2]&256|0)c[g+(c[j+12>>2]<<2)>>2]=0;p=c[j>>2]|0;r=c[j+4>>2]|0;c[U>>2]=c[j+16>>2];n=c[R>>2]|0;if((n|0)<=0){j=o;i=p;o=0;n=r;break}j=c[j+20>>2]|0;i=0;do{c[f+(i<<2)>>2]=c[j+(i<<2)>>2];i=i+1|0}while((i|0)!=(n|0));j=o;i=p;o=0;n=r}while(0);switch(o|0){case 2:{d=0;a=1;break h}case 27:{T=184;break i}case 0:{o=k;p=i;t=n;A=s;z=q;T=82;break}case 3:break k;default:{d=0;a=12;break g}}}o=n;n=a;i=D;a=c[R>>2]|0}if((T|0)==56){Iq(Q);if(!G)Pq(f);if(!H)Pq(h);if(I){d=0;a=12;break g}Pq(g);d=0;a=12;break g}else if((T|0)==63){Iq(Q);if(!G)Pq(f);if(!H)Pq(h);if(I){d=0;a=12;break g}Pq(g);d=0;a=12;break g}else if((T|0)==184){d=s;a=s>>>31;break}}while(0);Iq(Q);if(f|0)Pq(f);if(h|0)Pq(h);if(g)Pq(g)}else{d=0;a=12}while(0)}if(!a)Mq(W,e,c[Y>>2]|0,X,V,d);if(V)Pq(V)}l=Z;return a|0}function Lq(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;a:do if((a|0)>0){f=0;while(1){h=c[d+(f<<2)>>2]|0;g=c[e+(f<<2)>>2]|0;if(!(c[b+(f<<2)>>2]|0)){if((h|0)<(g|0)){f=1;break a}if((h|0)>(g|0)){f=0;break a}}else{if((h|0)>(g|0)){f=1;break a}if((h|0)<(g|0)){f=0;break a}}f=f+1|0;if((f|0)>=(a|0)){f=0;break}}}else f=0;while(0);return f|0}function Mq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;if((d&8|0)==0&(g|0)>-1){n=c[e+16>>2]|0;l=e+28|0;d=c[l>>2]|0;m=(a|0)!=0;if(m&(d|0)!=0){k=e+48|0;j=0;do{d=c[n+(j*12|0)>>2]|0;if((d|0)==(c[k>>2]|0))i=g;else i=c[f+(d<<2)>>2]|0;h=b+(j<<3)|0;c[h>>2]=i;d=c[n+(j*12|0)+4>>2]|0;if((d|0)==(c[k>>2]|0))e=g;else e=c[f+(d<<2)>>2]|0;d=b+(j<<3)+4|0;c[d>>2]=e;if((i|0)==-1|(e|0)==-1){c[d>>2]=-1;c[h>>2]=-1}j=j+1|0;d=c[l>>2]|0}while(j>>>0>>0&j>>>0>>0);f=d}else f=d;if(m&(f|0)!=0){d=0;do{i=b+(d<<3)+4|0;j=c[n+(d*12|0)+8>>2]|0;if(j|0?(o=c[j>>2]|0,(o|0)>-1):0){k=b+(d<<3)|0;h=0;l=o;e=c[k>>2]|0;do{if(!((e|0)>=(c[b+(l<<3)>>2]|0)?(c[i>>2]|0)<=(c[b+(l<<3)+4>>2]|0):0)){c[i>>2]=-1;c[k>>2]=-1;e=-1}h=h+1|0;l=c[j+(h<<2)>>2]|0}while((l|0)>-1)}d=d+1|0}while(d>>>0>>0&d>>>0>>0)}else d=0}else d=0;if(d>>>0>>0)Yq(b+(d<<3)|0,-1,a-d<<3|0)|0;return}function Nq(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=c[a>>2]|0;a:do if(!e)d=0;else{f=(d|0)==0;d=e;while(1){if(f){if(Ep(b,d)|0){d=1;break a}}else{e=_o(b)|0;if(Ep(e,c[a>>2]|0)|0){d=1;break a}e=$o(b)|0;if(Ep(e,c[a>>2]|0)|0){d=1;break a}}a=a+4|0;d=c[a>>2]|0;if(!d){d=0;break}}}while(0);return d|0}function Oq(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;M=l;l=l+16|0;if((l|0)>=(m|0))$(16);q=M;do if(a>>>0<245){p=a>>>0<11?16:a+11&-8;a=p>>>3;u=c[17716]|0;d=u>>>a;if(d&3|0){a=(d&1^1)+a|0;d=70904+(a<<1<<2)|0;e=d+8|0;f=c[e>>2]|0;g=f+8|0;h=c[g>>2]|0;do if((d|0)!=(h|0)){if(h>>>0<(c[17720]|0)>>>0)za();b=h+12|0;if((c[b>>2]|0)==(f|0)){c[b>>2]=d;c[e>>2]=h;break}else za()}else c[17716]=u&~(1<>2]=L|3;L=f+L+4|0;c[L>>2]=c[L>>2]|1;L=g;l=M;return L|0}t=c[17718]|0;if(p>>>0>t>>>0){if(d|0){i=2<>>12&16;a=a>>>i;e=a>>>5&8;a=a>>>e;g=a>>>2&4;a=a>>>g;d=a>>>1&2;a=a>>>d;b=a>>>1&1;b=(e|i|g|d|b)+(a>>>b)|0;a=70904+(b<<1<<2)|0;d=a+8|0;g=c[d>>2]|0;i=g+8|0;e=c[i>>2]|0;do if((a|0)!=(e|0)){if(e>>>0<(c[17720]|0)>>>0)za();f=e+12|0;if((c[f>>2]|0)==(g|0)){c[f>>2]=a;c[d>>2]=e;j=u;break}else za()}else{j=u&~(1<>2]=p|3;e=g+p|0;c[e+4>>2]=h|1;c[e+h>>2]=h;if(t|0){f=c[17721]|0;b=t>>>3;d=70904+(b<<1<<2)|0;b=1<>2]|0;if(a>>>0<(c[17720]|0)>>>0)za();else{k=a;n=b}}else{c[17716]=j|b;k=d;n=d+8|0}c[n>>2]=f;c[k+12>>2]=f;c[f+8>>2]=k;c[f+12>>2]=d}c[17718]=h;c[17721]=e;L=i;l=M;return L|0}k=c[17717]|0;if(k){a=(k&0-k)+-1|0;K=a>>>12&16;a=a>>>K;J=a>>>5&8;a=a>>>J;L=a>>>2&4;a=a>>>L;i=a>>>1&2;a=a>>>i;j=a>>>1&1;j=c[71168+((J|K|L|i|j)+(a>>>j)<<2)>>2]|0;a=j;i=j;j=(c[j+4>>2]&-8)-p|0;while(1){b=c[a+16>>2]|0;if(!b){b=c[a+20>>2]|0;if(!b)break}L=(c[b+4>>2]&-8)-p|0;K=L>>>0>>0;a=b;i=K?b:i;j=K?L:j}f=c[17720]|0;if(i>>>0>>0)za();h=i+p|0;if(i>>>0>=h>>>0)za();g=c[i+24>>2]|0;d=c[i+12>>2]|0;do if((d|0)==(i|0)){a=i+20|0;b=c[a>>2]|0;if(!b){a=i+16|0;b=c[a>>2]|0;if(!b){o=0;break}}while(1){d=b+20|0;e=c[d>>2]|0;if(e|0){b=e;a=d;continue}d=b+16|0;e=c[d>>2]|0;if(!e)break;else{b=e;a=d}}if(a>>>0>>0)za();else{c[a>>2]=0;o=b;break}}else{e=c[i+8>>2]|0;if(e>>>0>>0)za();b=e+12|0;if((c[b>>2]|0)!=(i|0))za();a=d+8|0;if((c[a>>2]|0)==(i|0)){c[b>>2]=d;c[a>>2]=e;o=d;break}else za()}while(0);do if(g|0){b=c[i+28>>2]|0;a=71168+(b<<2)|0;if((i|0)==(c[a>>2]|0)){c[a>>2]=o;if(!o){c[17717]=k&~(1<>>0<(c[17720]|0)>>>0)za();b=g+16|0;if((c[b>>2]|0)==(i|0))c[b>>2]=o;else c[g+20>>2]=o;if(!o)break}a=c[17720]|0;if(o>>>0>>0)za();c[o+24>>2]=g;b=c[i+16>>2]|0;do if(b|0)if(b>>>0>>0)za();else{c[o+16>>2]=b;c[b+24>>2]=o;break}while(0);b=c[i+20>>2]|0;if(b|0)if(b>>>0<(c[17720]|0)>>>0)za();else{c[o+20>>2]=b;c[b+24>>2]=o;break}}while(0);if(j>>>0<16){L=j+p|0;c[i+4>>2]=L|3;L=i+L+4|0;c[L>>2]=c[L>>2]|1}else{c[i+4>>2]=p|3;c[h+4>>2]=j|1;c[h+j>>2]=j;if(t|0){e=c[17721]|0;b=t>>>3;d=70904+(b<<1<<2)|0;b=1<>2]|0;if(a>>>0<(c[17720]|0)>>>0)za();else{r=a;s=b}}else{c[17716]=u|b;r=d;s=d+8|0}c[s>>2]=e;c[r+12>>2]=e;c[e+8>>2]=r;c[e+12>>2]=d}c[17718]=j;c[17721]=h}L=i+8|0;l=M;return L|0}}}else if(a>>>0<=4294967231){a=a+11|0;p=a&-8;k=c[17717]|0;if(k){e=0-p|0;a=a>>>8;if(a)if(p>>>0>16777215)j=31;else{s=(a+1048320|0)>>>16&8;E=a<>>16&4;E=E<>>16&2;j=14-(r|s|j)+(E<>>15)|0;j=p>>>(j+7|0)&1|j<<1}else j=0;a=c[71168+(j<<2)>>2]|0;a:do if(!a){d=0;f=0;E=86}else{f=0;i=a;h=p<<((j|0)==31?0:25-(j>>>1)|0);d=0;while(1){a=(c[i+4>>2]&-8)-p|0;if(a>>>0>>0)if(!a){a=i;e=0;d=i;E=90;break a}else{f=i;e=a}a=c[i+20>>2]|0;i=c[i+16+(h>>>31<<2)>>2]|0;d=(a|0)==0|(a|0)==(i|0)?d:a;a=(i|0)==0;if(a){E=86;break}else h=h<<(a&1^1)}}while(0);if((E|0)==86){if((d|0)==0&(f|0)==0){a=2<>>12&16;s=s>>>n;j=s>>>5&8;s=s>>>j;o=s>>>2&4;s=s>>>o;r=s>>>1&2;s=s>>>r;d=s>>>1&1;d=c[71168+((j|n|o|r|d)+(s>>>d)<<2)>>2]|0}if(!d){j=f;i=e}else{a=f;E=90}}if((E|0)==90)while(1){E=0;s=(c[d+4>>2]&-8)-p|0;f=s>>>0>>0;e=f?s:e;a=f?d:a;f=c[d+16>>2]|0;if(f|0){d=f;E=90;continue}d=c[d+20>>2]|0;if(!d){j=a;i=e;break}else E=90}if((j|0)!=0?i>>>0<((c[17718]|0)-p|0)>>>0:0){f=c[17720]|0;if(j>>>0>>0)za();h=j+p|0;if(j>>>0>=h>>>0)za();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do if((d|0)==(j|0)){a=j+20|0;b=c[a>>2]|0;if(!b){a=j+16|0;b=c[a>>2]|0;if(!b){t=0;break}}while(1){d=b+20|0;e=c[d>>2]|0;if(e|0){b=e;a=d;continue}d=b+16|0;e=c[d>>2]|0;if(!e)break;else{b=e;a=d}}if(a>>>0>>0)za();else{c[a>>2]=0;t=b;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)za();b=e+12|0;if((c[b>>2]|0)!=(j|0))za();a=d+8|0;if((c[a>>2]|0)==(j|0)){c[b>>2]=d;c[a>>2]=e;t=d;break}else za()}while(0);do if(g){b=c[j+28>>2]|0;a=71168+(b<<2)|0;if((j|0)==(c[a>>2]|0)){c[a>>2]=t;if(!t){u=k&~(1<>>0<(c[17720]|0)>>>0)za();b=g+16|0;if((c[b>>2]|0)==(j|0))c[b>>2]=t;else c[g+20>>2]=t;if(!t){u=k;break}}a=c[17720]|0;if(t>>>0>>0)za();c[t+24>>2]=g;b=c[j+16>>2]|0;do if(b|0)if(b>>>0>>0)za();else{c[t+16>>2]=b;c[b+24>>2]=t;break}while(0);b=c[j+20>>2]|0;if(b)if(b>>>0<(c[17720]|0)>>>0)za();else{c[t+20>>2]=b;c[b+24>>2]=t;u=k;break}else u=k}else u=k;while(0);do if(i>>>0>=16){c[j+4>>2]=p|3;c[h+4>>2]=i|1;c[h+i>>2]=i;b=i>>>3;if(i>>>0<256){d=70904+(b<<1<<2)|0;a=c[17716]|0;b=1<>2]|0;if(a>>>0<(c[17720]|0)>>>0)za();else{C=a;D=b}}else{c[17716]=a|b;C=d;D=d+8|0}c[D>>2]=h;c[C+12>>2]=h;c[h+8>>2]=C;c[h+12>>2]=d;break}b=i>>>8;if(b)if(i>>>0>16777215)b=31;else{K=(b+1048320|0)>>>16&8;L=b<>>16&4;L=L<>>16&2;b=14-(J|K|b)+(L<>>15)|0;b=i>>>(b+7|0)&1|b<<1}else b=0;d=71168+(b<<2)|0;c[h+28>>2]=b;a=h+16|0;c[a+4>>2]=0;c[a>>2]=0;a=1<>2]=h;c[h+24>>2]=d;c[h+12>>2]=h;c[h+8>>2]=h;break}a=i<<((b|0)==31?0:25-(b>>>1)|0);e=c[d>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(i|0)){E=148;break}d=e+16+(a>>>31<<2)|0;b=c[d>>2]|0;if(!b){E=145;break}else{a=a<<1;e=b}}if((E|0)==145)if(d>>>0<(c[17720]|0)>>>0)za();else{c[d>>2]=h;c[h+24>>2]=e;c[h+12>>2]=h;c[h+8>>2]=h;break}else if((E|0)==148){b=e+8|0;a=c[b>>2]|0;L=c[17720]|0;if(a>>>0>=L>>>0&e>>>0>=L>>>0){c[a+12>>2]=h;c[b>>2]=h;c[h+8>>2]=a;c[h+12>>2]=e;c[h+24>>2]=0;break}else za()}}else{L=i+p|0;c[j+4>>2]=L|3;L=j+L+4|0;c[L>>2]=c[L>>2]|1}while(0);L=j+8|0;l=M;return L|0}}}else p=-1;while(0);d=c[17718]|0;if(d>>>0>=p>>>0){b=d-p|0;a=c[17721]|0;if(b>>>0>15){L=a+p|0;c[17721]=L;c[17718]=b;c[L+4>>2]=b|1;c[L+b>>2]=b;c[a+4>>2]=p|3}else{c[17718]=0;c[17721]=0;c[a+4>>2]=d|3;L=a+d+4|0;c[L>>2]=c[L>>2]|1}L=a+8|0;l=M;return L|0}i=c[17719]|0;if(i>>>0>p>>>0){J=i-p|0;c[17719]=J;L=c[17722]|0;K=L+p|0;c[17722]=K;c[K+4>>2]=J|1;c[L+4>>2]=p|3;L=L+8|0;l=M;return L|0}if(!(c[17834]|0)){c[17836]=4096;c[17835]=4096;c[17837]=-1;c[17838]=-1;c[17839]=0;c[17827]=0;a=q&-16^1431655768;c[q>>2]=a;c[17834]=a;a=4096}else a=c[17836]|0;j=p+48|0;k=p+47|0;h=a+k|0;f=0-a|0;n=h&f;if(n>>>0<=p>>>0){L=0;l=M;return L|0}a=c[17826]|0;if(a|0?(C=c[17824]|0,D=C+n|0,D>>>0<=C>>>0|D>>>0>a>>>0):0){L=0;l=M;return L|0}b:do if(!(c[17827]&4)){d=c[17722]|0;c:do if(d){e=71312;while(1){a=c[e>>2]|0;if(a>>>0<=d>>>0?(v=e+4|0,(a+(c[v>>2]|0)|0)>>>0>d>>>0):0)break;a=c[e+8>>2]|0;if(!a){E=172;break c}else e=a}d=h-i&f;if(d>>>0<2147483647){a=lr(d|0)|0;if((a|0)==((c[e>>2]|0)+(c[v>>2]|0)|0)){if((a|0)!=(-1|0)){h=d;g=a;E=190;break b}}else{b=d;E=180}}}else E=172;while(0);do if(((E|0)==172?(g=lr(0)|0,(g|0)!=(-1|0)):0)?(b=g,w=c[17835]|0,x=w+-1|0,b=((x&b|0)==0?0:(x+b&0-w)-b|0)+n|0,w=c[17824]|0,x=b+w|0,b>>>0>p>>>0&b>>>0<2147483647):0){D=c[17826]|0;if(D|0?x>>>0<=w>>>0|x>>>0>D>>>0:0)break;a=lr(b|0)|0;if((a|0)==(g|0)){h=b;E=190;break b}else E=180}while(0);d:do if((E|0)==180){d=0-b|0;do if(j>>>0>b>>>0&(b>>>0<2147483647&(a|0)!=(-1|0))?(y=c[17836]|0,y=k-b+y&0-y,y>>>0<2147483647):0)if((lr(y|0)|0)==(-1|0)){lr(d|0)|0;break d}else{b=y+b|0;break}while(0);if((a|0)!=(-1|0)){h=b;g=a;E=190;break b}}while(0);c[17827]=c[17827]|4;E=187}else E=187;while(0);if((((E|0)==187?n>>>0<2147483647:0)?(B=lr(n|0)|0,z=lr(0)|0,B>>>0>>0&((B|0)!=(-1|0)&(z|0)!=(-1|0))):0)?(A=z-B|0,A>>>0>(p+40|0)>>>0):0){h=A;g=B;E=190}if((E|0)==190){b=(c[17824]|0)+h|0;c[17824]=b;if(b>>>0>(c[17825]|0)>>>0)c[17825]=b;k=c[17722]|0;do if(k){b=71312;while(1){a=c[b>>2]|0;d=b+4|0;e=c[d>>2]|0;if((g|0)==(a+e|0)){E=200;break}f=c[b+8>>2]|0;if(!f)break;else b=f}if(((E|0)==200?(c[b+12>>2]&8|0)==0:0)?k>>>0>>0&k>>>0>=a>>>0:0){c[d>>2]=e+h;L=k+8|0;L=(L&7|0)==0?0:0-L&7;K=k+L|0;L=h-L+(c[17719]|0)|0;c[17722]=K;c[17719]=L;c[K+4>>2]=L|1;c[K+L+4>>2]=40;c[17723]=c[17838];break}b=c[17720]|0;if(g>>>0>>0){c[17720]=g;i=g}else i=b;a=g+h|0;b=71312;while(1){if((c[b>>2]|0)==(a|0)){E=208;break}b=c[b+8>>2]|0;if(!b){a=71312;break}}if((E|0)==208)if(!(c[b+12>>2]&8)){c[b>>2]=g;o=b+4|0;c[o>>2]=(c[o>>2]|0)+h;o=g+8|0;o=g+((o&7|0)==0?0:0-o&7)|0;b=a+8|0;b=a+((b&7|0)==0?0:0-b&7)|0;n=o+p|0;j=b-o-p|0;c[o+4>>2]=p|3;do if((b|0)!=(k|0)){if((b|0)==(c[17721]|0)){L=(c[17718]|0)+j|0;c[17718]=L;c[17721]=n;c[n+4>>2]=L|1;c[n+L>>2]=L;break}a=c[b+4>>2]|0;if((a&3|0)==1){h=a&-8;f=a>>>3;e:do if(a>>>0>=256){g=c[b+24>>2]|0;e=c[b+12>>2]|0;do if((e|0)==(b|0)){e=b+16|0;d=e+4|0;a=c[d>>2]|0;if(!a){a=c[e>>2]|0;if(!a){J=0;break}else d=e}while(1){e=a+20|0;f=c[e>>2]|0;if(f|0){a=f;d=e;continue}e=a+16|0;f=c[e>>2]|0;if(!f)break;else{a=f;d=e}}if(d>>>0>>0)za();else{c[d>>2]=0;J=a;break}}else{f=c[b+8>>2]|0;if(f>>>0>>0)za();a=f+12|0;if((c[a>>2]|0)!=(b|0))za();d=e+8|0;if((c[d>>2]|0)==(b|0)){c[a>>2]=e;c[d>>2]=f;J=e;break}else za()}while(0);if(!g)break;a=c[b+28>>2]|0;d=71168+(a<<2)|0;do if((b|0)!=(c[d>>2]|0)){if(g>>>0<(c[17720]|0)>>>0)za();a=g+16|0;if((c[a>>2]|0)==(b|0))c[a>>2]=J;else c[g+20>>2]=J;if(!J)break e}else{c[d>>2]=J;if(J|0)break;c[17717]=c[17717]&~(1<>>0>>0)za();c[J+24>>2]=g;a=b+16|0;d=c[a>>2]|0;do if(d|0)if(d>>>0>>0)za();else{c[J+16>>2]=d;c[d+24>>2]=J;break}while(0);a=c[a+4>>2]|0;if(!a)break;if(a>>>0<(c[17720]|0)>>>0)za();else{c[J+20>>2]=a;c[a+24>>2]=J;break}}else{d=c[b+8>>2]|0;e=c[b+12>>2]|0;a=70904+(f<<1<<2)|0;do if((d|0)!=(a|0)){if(d>>>0>>0)za();if((c[d+12>>2]|0)==(b|0))break;za()}while(0);if((e|0)==(d|0)){c[17716]=c[17716]&~(1<>>0>>0)za();a=e+8|0;if((c[a>>2]|0)==(b|0)){G=a;break}za()}while(0);c[d+12>>2]=e;c[G>>2]=d}while(0);b=b+h|0;f=h+j|0}else f=j;b=b+4|0;c[b>>2]=c[b>>2]&-2;c[n+4>>2]=f|1;c[n+f>>2]=f;b=f>>>3;if(f>>>0<256){d=70904+(b<<1<<2)|0;a=c[17716]|0;b=1<>2]|0;if(a>>>0>=(c[17720]|0)>>>0){K=a;L=b;break}za()}while(0);c[L>>2]=n;c[K+12>>2]=n;c[n+8>>2]=K;c[n+12>>2]=d;break}b=f>>>8;do if(!b)b=0;else{if(f>>>0>16777215){b=31;break}K=(b+1048320|0)>>>16&8;L=b<>>16&4;L=L<>>16&2;b=14-(J|K|b)+(L<>>15)|0;b=f>>>(b+7|0)&1|b<<1}while(0);e=71168+(b<<2)|0;c[n+28>>2]=b;a=n+16|0;c[a+4>>2]=0;c[a>>2]=0;a=c[17717]|0;d=1<>2]=n;c[n+24>>2]=e;c[n+12>>2]=n;c[n+8>>2]=n;break}a=f<<((b|0)==31?0:25-(b>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(f|0)){E=278;break}d=e+16+(a>>>31<<2)|0;b=c[d>>2]|0;if(!b){E=275;break}else{a=a<<1;e=b}}if((E|0)==275)if(d>>>0<(c[17720]|0)>>>0)za();else{c[d>>2]=n;c[n+24>>2]=e;c[n+12>>2]=n;c[n+8>>2]=n;break}else if((E|0)==278){b=e+8|0;a=c[b>>2]|0;L=c[17720]|0;if(a>>>0>=L>>>0&e>>>0>=L>>>0){c[a+12>>2]=n;c[b>>2]=n;c[n+8>>2]=a;c[n+12>>2]=e;c[n+24>>2]=0;break}else za()}}else{L=(c[17719]|0)+j|0;c[17719]=L;c[17722]=n;c[n+4>>2]=L|1}while(0);L=o+8|0;l=M;return L|0}else a=71312;while(1){b=c[a>>2]|0;if(b>>>0<=k>>>0?(F=b+(c[a+4>>2]|0)|0,F>>>0>k>>>0):0)break;a=c[a+8>>2]|0}f=F+-47|0;a=f+8|0;a=f+((a&7|0)==0?0:0-a&7)|0;f=k+16|0;a=a>>>0>>0?k:a;b=a+8|0;d=g+8|0;d=(d&7|0)==0?0:0-d&7;L=g+d|0;d=h+-40-d|0;c[17722]=L;c[17719]=d;c[L+4>>2]=d|1;c[L+d+4>>2]=40;c[17723]=c[17838];d=a+4|0;c[d>>2]=27;c[b>>2]=c[17828];c[b+4>>2]=c[17829];c[b+8>>2]=c[17830];c[b+12>>2]=c[17831];c[17828]=g;c[17829]=h;c[17831]=0;c[17830]=b;b=a+24|0;do{b=b+4|0;c[b>>2]=7}while((b+4|0)>>>0>>0);if((a|0)!=(k|0)){g=a-k|0;c[d>>2]=c[d>>2]&-2;c[k+4>>2]=g|1;c[a>>2]=g;b=g>>>3;if(g>>>0<256){d=70904+(b<<1<<2)|0;a=c[17716]|0;b=1<>2]|0;if(a>>>0<(c[17720]|0)>>>0)za();else{H=a;I=b}}else{c[17716]=a|b;H=d;I=d+8|0}c[I>>2]=k;c[H+12>>2]=k;c[k+8>>2]=H;c[k+12>>2]=d;break}b=g>>>8;if(b)if(g>>>0>16777215)d=31;else{K=(b+1048320|0)>>>16&8;L=b<>>16&4;L=L<>>16&2;d=14-(J|K|d)+(L<>>15)|0;d=g>>>(d+7|0)&1|d<<1}else d=0;e=71168+(d<<2)|0;c[k+28>>2]=d;c[k+20>>2]=0;c[f>>2]=0;b=c[17717]|0;a=1<>2]=k;c[k+24>>2]=e;c[k+12>>2]=k;c[k+8>>2]=k;break}a=g<<((d|0)==31?0:25-(d>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(g|0)){E=304;break}d=e+16+(a>>>31<<2)|0;b=c[d>>2]|0;if(!b){E=301;break}else{a=a<<1;e=b}}if((E|0)==301)if(d>>>0<(c[17720]|0)>>>0)za();else{c[d>>2]=k;c[k+24>>2]=e;c[k+12>>2]=k;c[k+8>>2]=k;break}else if((E|0)==304){b=e+8|0;a=c[b>>2]|0;L=c[17720]|0;if(a>>>0>=L>>>0&e>>>0>=L>>>0){c[a+12>>2]=k;c[b>>2]=k;c[k+8>>2]=a;c[k+12>>2]=e;c[k+24>>2]=0;break}else za()}}}else{L=c[17720]|0;if((L|0)==0|g>>>0>>0)c[17720]=g;c[17828]=g;c[17829]=h;c[17831]=0;c[17725]=c[17834];c[17724]=-1;b=0;do{L=70904+(b<<1<<2)|0;c[L+12>>2]=L;c[L+8>>2]=L;b=b+1|0}while((b|0)!=32);L=g+8|0;L=(L&7|0)==0?0:0-L&7;K=g+L|0;L=h+-40-L|0;c[17722]=K;c[17719]=L;c[K+4>>2]=L|1;c[K+L+4>>2]=40;c[17723]=c[17838]}while(0);b=c[17719]|0;if(b>>>0>p>>>0){J=b-p|0;c[17719]=J;L=c[17722]|0;K=L+p|0;c[17722]=K;c[K+4>>2]=J|1;c[L+4>>2]=p|3;L=L+8|0;l=M;return L|0}}c[(zo()|0)>>2]=12;L=0;l=M;return L|0}function Pq(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if(!a)return;d=a+-8|0;h=c[17720]|0;if(d>>>0>>0)za();a=c[a+-4>>2]|0;b=a&3;if((b|0)==1)za();e=a&-8;n=d+e|0;do if(!(a&1)){a=c[d>>2]|0;if(!b)return;k=d+(0-a)|0;j=a+e|0;if(k>>>0>>0)za();if((k|0)==(c[17721]|0)){a=n+4|0;b=c[a>>2]|0;if((b&3|0)!=3){q=k;f=j;break}c[17718]=j;c[a>>2]=b&-2;c[k+4>>2]=j|1;c[k+j>>2]=j;return}e=a>>>3;if(a>>>0<256){b=c[k+8>>2]|0;d=c[k+12>>2]|0;a=70904+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0>>0)za();if((c[b+12>>2]|0)!=(k|0))za()}if((d|0)==(b|0)){c[17716]=c[17716]&~(1<>>0>>0)za();a=d+8|0;if((c[a>>2]|0)==(k|0))g=a;else za()}else g=d+8|0;c[b+12>>2]=d;c[g>>2]=b;q=k;f=j;break}g=c[k+24>>2]|0;d=c[k+12>>2]|0;do if((d|0)==(k|0)){d=k+16|0;b=d+4|0;a=c[b>>2]|0;if(!a){a=c[d>>2]|0;if(!a){i=0;break}else b=d}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)za();else{c[b>>2]=0;i=a;break}}else{e=c[k+8>>2]|0;if(e>>>0>>0)za();a=e+12|0;if((c[a>>2]|0)!=(k|0))za();b=d+8|0;if((c[b>>2]|0)==(k|0)){c[a>>2]=d;c[b>>2]=e;i=d;break}else za()}while(0);if(g){a=c[k+28>>2]|0;b=71168+(a<<2)|0;if((k|0)==(c[b>>2]|0)){c[b>>2]=i;if(!i){c[17717]=c[17717]&~(1<>>0<(c[17720]|0)>>>0)za();a=g+16|0;if((c[a>>2]|0)==(k|0))c[a>>2]=i;else c[g+20>>2]=i;if(!i){q=k;f=j;break}}d=c[17720]|0;if(i>>>0>>0)za();c[i+24>>2]=g;a=k+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)za();else{c[i+16>>2]=b;c[b+24>>2]=i;break}while(0);a=c[a+4>>2]|0;if(a)if(a>>>0<(c[17720]|0)>>>0)za();else{c[i+20>>2]=a;c[a+24>>2]=i;q=k;f=j;break}else{q=k;f=j}}else{q=k;f=j}}else{q=d;f=e}while(0);if(q>>>0>=n>>>0)za();a=n+4|0;b=c[a>>2]|0;if(!(b&1))za();if(!(b&2)){if((n|0)==(c[17722]|0)){p=(c[17719]|0)+f|0;c[17719]=p;c[17722]=q;c[q+4>>2]=p|1;if((q|0)!=(c[17721]|0))return;c[17721]=0;c[17718]=0;return}if((n|0)==(c[17721]|0)){p=(c[17718]|0)+f|0;c[17718]=p;c[17721]=q;c[q+4>>2]=p|1;c[q+p>>2]=p;return}f=(b&-8)+f|0;e=b>>>3;do if(b>>>0>=256){g=c[n+24>>2]|0;a=c[n+12>>2]|0;do if((a|0)==(n|0)){d=n+16|0;b=d+4|0;a=c[b>>2]|0;if(!a){a=c[d>>2]|0;if(!a){m=0;break}else b=d}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0<(c[17720]|0)>>>0)za();else{c[b>>2]=0;m=a;break}}else{b=c[n+8>>2]|0;if(b>>>0<(c[17720]|0)>>>0)za();d=b+12|0;if((c[d>>2]|0)!=(n|0))za();e=a+8|0;if((c[e>>2]|0)==(n|0)){c[d>>2]=a;c[e>>2]=b;m=a;break}else za()}while(0);if(g|0){a=c[n+28>>2]|0;b=71168+(a<<2)|0;if((n|0)==(c[b>>2]|0)){c[b>>2]=m;if(!m){c[17717]=c[17717]&~(1<>>0<(c[17720]|0)>>>0)za();a=g+16|0;if((c[a>>2]|0)==(n|0))c[a>>2]=m;else c[g+20>>2]=m;if(!m)break}d=c[17720]|0;if(m>>>0>>0)za();c[m+24>>2]=g;a=n+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)za();else{c[m+16>>2]=b;c[b+24>>2]=m;break}while(0);a=c[a+4>>2]|0;if(a|0)if(a>>>0<(c[17720]|0)>>>0)za();else{c[m+20>>2]=a;c[a+24>>2]=m;break}}}else{b=c[n+8>>2]|0;d=c[n+12>>2]|0;a=70904+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0<(c[17720]|0)>>>0)za();if((c[b+12>>2]|0)!=(n|0))za()}if((d|0)==(b|0)){c[17716]=c[17716]&~(1<>>0<(c[17720]|0)>>>0)za();a=d+8|0;if((c[a>>2]|0)==(n|0))l=a;else za()}else l=d+8|0;c[b+12>>2]=d;c[l>>2]=b}while(0);c[q+4>>2]=f|1;c[q+f>>2]=f;if((q|0)==(c[17721]|0)){c[17718]=f;return}}else{c[a>>2]=b&-2;c[q+4>>2]=f|1;c[q+f>>2]=f}a=f>>>3;if(f>>>0<256){d=70904+(a<<1<<2)|0;b=c[17716]|0;a=1<>2]|0;if(b>>>0<(c[17720]|0)>>>0)za();else{o=b;p=a}}else{c[17716]=b|a;o=d;p=d+8|0}c[p>>2]=q;c[o+12>>2]=q;c[q+8>>2]=o;c[q+12>>2]=d;return}a=f>>>8;if(a)if(f>>>0>16777215)a=31;else{o=(a+1048320|0)>>>16&8;p=a<>>16&4;p=p<>>16&2;a=14-(n|o|a)+(p<>>15)|0;a=f>>>(a+7|0)&1|a<<1}else a=0;e=71168+(a<<2)|0;c[q+28>>2]=a;c[q+20>>2]=0;c[q+16>>2]=0;b=c[17717]|0;d=1<>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(f|0)){a=130;break}d=e+16+(b>>>31<<2)|0;a=c[d>>2]|0;if(!a){a=127;break}else{b=b<<1;e=a}}if((a|0)==127)if(d>>>0<(c[17720]|0)>>>0)za();else{c[d>>2]=q;c[q+24>>2]=e;c[q+12>>2]=q;c[q+8>>2]=q;break}else if((a|0)==130){a=e+8|0;b=c[a>>2]|0;p=c[17720]|0;if(b>>>0>=p>>>0&e>>>0>=p>>>0){c[b+12>>2]=q;c[a>>2]=q;c[q+8>>2]=b;c[q+12>>2]=e;c[q+24>>2]=0;break}else za()}}else{c[17717]=b|d;c[e>>2]=q;c[q+24>>2]=e;c[q+12>>2]=q;c[q+8>>2]=q}while(0);q=(c[17724]|0)+-1|0;c[17724]=q;if(!q)a=71320;else return;while(1){a=c[a>>2]|0;if(!a)break;else a=a+8|0}c[17724]=-1;return}function Qq(a,b){a=a|0;b=b|0;var d=0;if(a){d=S(b,a)|0;if((b|a)>>>0>65535)d=((d>>>0)/(a>>>0)|0|0)==(b|0)?d:-1}else d=0;a=Oq(d)|0;if(!a)return a|0;if(!(c[a+-4>>2]&3))return a|0;Yq(a|0,0,d|0)|0;return a|0}function Rq(a,b){a=a|0;b=b|0;var d=0,e=0;if(!a){b=Oq(b)|0;return b|0}if(b>>>0>4294967231){c[(zo()|0)>>2]=12;b=0;return b|0}d=Sq(a+-8|0,b>>>0<11?16:b+11&-8)|0;if(d|0){b=d+8|0;return b|0}d=Oq(b)|0;if(!d){b=0;return b|0}e=c[a+-4>>2]|0;e=(e&-8)-((e&3|0)==0?8:4)|0;cr(d|0,a|0,(e>>>0>>0?e:b)|0)|0;Pq(a);b=d;return b|0}function Sq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;n=a+4|0;o=c[n>>2]|0;d=o&-8;k=a+d|0;i=c[17720]|0;e=o&3;if(!((e|0)!=1&a>>>0>=i>>>0&a>>>0>>0))za();f=c[k+4>>2]|0;if(!(f&1))za();if(!e){if(b>>>0<256){a=0;return a|0}if(d>>>0>=(b+4|0)>>>0?(d-b|0)>>>0<=c[17836]<<1>>>0:0)return a|0;a=0;return a|0}if(d>>>0>=b>>>0){d=d-b|0;if(d>>>0<=15)return a|0;m=a+b|0;c[n>>2]=o&1|b|2;c[m+4>>2]=d|3;o=m+d+4|0;c[o>>2]=c[o>>2]|1;Tq(m,d);return a|0}if((k|0)==(c[17722]|0)){d=(c[17719]|0)+d|0;if(d>>>0<=b>>>0){a=0;return a|0}m=d-b|0;l=a+b|0;c[n>>2]=o&1|b|2;c[l+4>>2]=m|1;c[17722]=l;c[17719]=m;return a|0}if((k|0)==(c[17721]|0)){e=(c[17718]|0)+d|0;if(e>>>0>>0){a=0;return a|0}d=e-b|0;if(d>>>0>15){e=a+b|0;m=e+d|0;c[n>>2]=o&1|b|2;c[e+4>>2]=d|1;c[m>>2]=d;o=m+4|0;c[o>>2]=c[o>>2]&-2}else{c[n>>2]=o&1|e|2;e=a+e+4|0;c[e>>2]=c[e>>2]|1;e=0;d=0}c[17718]=d;c[17721]=e;return a|0}if(f&2|0){a=0;return a|0}l=(f&-8)+d|0;if(l>>>0>>0){a=0;return a|0}m=l-b|0;g=f>>>3;do if(f>>>0>=256){h=c[k+24>>2]|0;f=c[k+12>>2]|0;do if((f|0)==(k|0)){f=k+16|0;e=f+4|0;d=c[e>>2]|0;if(!d){d=c[f>>2]|0;if(!d){j=0;break}else e=f}while(1){f=d+20|0;g=c[f>>2]|0;if(g|0){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)za();else{c[e>>2]=0;j=d;break}}else{g=c[k+8>>2]|0;if(g>>>0>>0)za();d=g+12|0;if((c[d>>2]|0)!=(k|0))za();e=f+8|0;if((c[e>>2]|0)==(k|0)){c[d>>2]=f;c[e>>2]=g;j=f;break}else za()}while(0);if(h|0){d=c[k+28>>2]|0;e=71168+(d<<2)|0;if((k|0)==(c[e>>2]|0)){c[e>>2]=j;if(!j){c[17717]=c[17717]&~(1<>>0<(c[17720]|0)>>>0)za();d=h+16|0;if((c[d>>2]|0)==(k|0))c[d>>2]=j;else c[h+20>>2]=j;if(!j)break}f=c[17720]|0;if(j>>>0>>0)za();c[j+24>>2]=h;d=k+16|0;e=c[d>>2]|0;do if(e|0)if(e>>>0>>0)za();else{c[j+16>>2]=e;c[e+24>>2]=j;break}while(0);d=c[d+4>>2]|0;if(d|0)if(d>>>0<(c[17720]|0)>>>0)za();else{c[j+20>>2]=d;c[d+24>>2]=j;break}}}else{e=c[k+8>>2]|0;f=c[k+12>>2]|0;d=70904+(g<<1<<2)|0;if((e|0)!=(d|0)){if(e>>>0>>0)za();if((c[e+12>>2]|0)!=(k|0))za()}if((f|0)==(e|0)){c[17716]=c[17716]&~(1<>>0>>0)za();d=f+8|0;if((c[d>>2]|0)==(k|0))h=d;else za()}else h=f+8|0;c[e+12>>2]=f;c[h>>2]=e}while(0);if(m>>>0<16){c[n>>2]=l|o&1|2;o=a+l+4|0;c[o>>2]=c[o>>2]|1;return a|0}else{l=a+b|0;c[n>>2]=o&1|b|2;c[l+4>>2]=m|3;o=l+m+4|0;c[o>>2]=c[o>>2]|1;Tq(l,m);return a|0}return 0}function Tq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;o=a+b|0;d=c[a+4>>2]|0;do if(!(d&1)){g=c[a>>2]|0;if(!(d&3))return;l=a+(0-g)|0;k=g+b|0;i=c[17720]|0;if(l>>>0>>0)za();if((l|0)==(c[17721]|0)){a=o+4|0;d=c[a>>2]|0;if((d&3|0)!=3){r=l;f=k;break}c[17718]=k;c[a>>2]=d&-2;c[l+4>>2]=k|1;c[l+k>>2]=k;return}e=g>>>3;if(g>>>0<256){d=c[l+8>>2]|0;b=c[l+12>>2]|0;a=70904+(e<<1<<2)|0;if((d|0)!=(a|0)){if(d>>>0>>0)za();if((c[d+12>>2]|0)!=(l|0))za()}if((b|0)==(d|0)){c[17716]=c[17716]&~(1<>>0>>0)za();a=b+8|0;if((c[a>>2]|0)==(l|0))h=a;else za()}else h=b+8|0;c[d+12>>2]=b;c[h>>2]=d;r=l;f=k;break}g=c[l+24>>2]|0;b=c[l+12>>2]|0;do if((b|0)==(l|0)){b=l+16|0;d=b+4|0;a=c[d>>2]|0;if(!a){a=c[b>>2]|0;if(!a){j=0;break}else d=b}while(1){b=a+20|0;e=c[b>>2]|0;if(e|0){a=e;d=b;continue}b=a+16|0;e=c[b>>2]|0;if(!e)break;else{a=e;d=b}}if(d>>>0>>0)za();else{c[d>>2]=0;j=a;break}}else{e=c[l+8>>2]|0;if(e>>>0>>0)za();a=e+12|0;if((c[a>>2]|0)!=(l|0))za();d=b+8|0;if((c[d>>2]|0)==(l|0)){c[a>>2]=b;c[d>>2]=e;j=b;break}else za()}while(0);if(g){a=c[l+28>>2]|0;d=71168+(a<<2)|0;if((l|0)==(c[d>>2]|0)){c[d>>2]=j;if(!j){c[17717]=c[17717]&~(1<>>0<(c[17720]|0)>>>0)za();a=g+16|0;if((c[a>>2]|0)==(l|0))c[a>>2]=j;else c[g+20>>2]=j;if(!j){r=l;f=k;break}}b=c[17720]|0;if(j>>>0>>0)za();c[j+24>>2]=g;a=l+16|0;d=c[a>>2]|0;do if(d|0)if(d>>>0>>0)za();else{c[j+16>>2]=d;c[d+24>>2]=j;break}while(0);a=c[a+4>>2]|0;if(a)if(a>>>0<(c[17720]|0)>>>0)za();else{c[j+20>>2]=a;c[a+24>>2]=j;r=l;f=k;break}else{r=l;f=k}}else{r=l;f=k}}else{r=a;f=b}while(0);h=c[17720]|0;if(o>>>0>>0)za();a=o+4|0;d=c[a>>2]|0;if(!(d&2)){if((o|0)==(c[17722]|0)){q=(c[17719]|0)+f|0;c[17719]=q;c[17722]=r;c[r+4>>2]=q|1;if((r|0)!=(c[17721]|0))return;c[17721]=0;c[17718]=0;return}if((o|0)==(c[17721]|0)){q=(c[17718]|0)+f|0;c[17718]=q;c[17721]=r;c[r+4>>2]=q|1;c[r+q>>2]=q;return}f=(d&-8)+f|0;e=d>>>3;do if(d>>>0>=256){g=c[o+24>>2]|0;b=c[o+12>>2]|0;do if((b|0)==(o|0)){b=o+16|0;d=b+4|0;a=c[d>>2]|0;if(!a){a=c[b>>2]|0;if(!a){n=0;break}else d=b}while(1){b=a+20|0;e=c[b>>2]|0;if(e|0){a=e;d=b;continue}b=a+16|0;e=c[b>>2]|0;if(!e)break;else{a=e;d=b}}if(d>>>0>>0)za();else{c[d>>2]=0;n=a;break}}else{e=c[o+8>>2]|0;if(e>>>0>>0)za();a=e+12|0;if((c[a>>2]|0)!=(o|0))za();d=b+8|0;if((c[d>>2]|0)==(o|0)){c[a>>2]=b;c[d>>2]=e;n=b;break}else za()}while(0);if(g|0){a=c[o+28>>2]|0;d=71168+(a<<2)|0;if((o|0)==(c[d>>2]|0)){c[d>>2]=n;if(!n){c[17717]=c[17717]&~(1<>>0<(c[17720]|0)>>>0)za();a=g+16|0;if((c[a>>2]|0)==(o|0))c[a>>2]=n;else c[g+20>>2]=n;if(!n)break}b=c[17720]|0;if(n>>>0>>0)za();c[n+24>>2]=g;a=o+16|0;d=c[a>>2]|0;do if(d|0)if(d>>>0>>0)za();else{c[n+16>>2]=d;c[d+24>>2]=n;break}while(0);a=c[a+4>>2]|0;if(a|0)if(a>>>0<(c[17720]|0)>>>0)za();else{c[n+20>>2]=a;c[a+24>>2]=n;break}}}else{d=c[o+8>>2]|0;b=c[o+12>>2]|0;a=70904+(e<<1<<2)|0;if((d|0)!=(a|0)){if(d>>>0>>0)za();if((c[d+12>>2]|0)!=(o|0))za()}if((b|0)==(d|0)){c[17716]=c[17716]&~(1<>>0>>0)za();a=b+8|0;if((c[a>>2]|0)==(o|0))m=a;else za()}else m=b+8|0;c[d+12>>2]=b;c[m>>2]=d}while(0);c[r+4>>2]=f|1;c[r+f>>2]=f;if((r|0)==(c[17721]|0)){c[17718]=f;return}}else{c[a>>2]=d&-2;c[r+4>>2]=f|1;c[r+f>>2]=f}a=f>>>3;if(f>>>0<256){b=70904+(a<<1<<2)|0;d=c[17716]|0;a=1<>2]|0;if(d>>>0<(c[17720]|0)>>>0)za();else{p=d;q=a}}else{c[17716]=d|a;p=b;q=b+8|0}c[q>>2]=r;c[p+12>>2]=r;c[r+8>>2]=p;c[r+12>>2]=b;return}a=f>>>8;if(a)if(f>>>0>16777215)a=31;else{p=(a+1048320|0)>>>16&8;q=a<>>16&4;q=q<>>16&2;a=14-(o|p|a)+(q<>>15)|0;a=f>>>(a+7|0)&1|a<<1}else a=0;e=71168+(a<<2)|0;c[r+28>>2]=a;c[r+20>>2]=0;c[r+16>>2]=0;d=c[17717]|0;b=1<>2]=r;c[r+24>>2]=e;c[r+12>>2]=r;c[r+8>>2]=r;return}d=f<<((a|0)==31?0:25-(a>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(f|0)){a=127;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){a=124;break}else{d=d<<1;e=a}}if((a|0)==124){if(b>>>0<(c[17720]|0)>>>0)za();c[b>>2]=r;c[r+24>>2]=e;c[r+12>>2]=r;c[r+8>>2]=r;return}else if((a|0)==127){a=e+8|0;d=c[a>>2]|0;q=c[17720]|0;if(!(d>>>0>=q>>>0&e>>>0>=q>>>0))za();c[d+12>>2]=r;c[a>>2]=r;c[r+8>>2]=d;c[r+12>>2]=e;c[r+24>>2]=0;return}}function Uq(a,b){a=a|0;b=b|0;if(a>>>0<9){b=Oq(b)|0;return b|0}else{b=Vq(a,b)|0;return b|0}return 0}function Vq(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;a=a>>>0<16?16:a;if(a+-1&a){d=16;while(1)if(d>>>0>>0)d=d<<1;else{a=d;break}}if((-64-a|0)>>>0<=b>>>0){c[(zo()|0)>>2]=12;h=0;return h|0}g=b>>>0<11?16:b+11&-8;d=Oq(g+12+a|0)|0;if(!d){h=0;return h|0}f=d+-8|0;do if(d&a+-1){i=(d+a+-1&0-a)+-8|0;e=f;a=(i-e|0)>>>0>15?i:i+a|0;e=a-e|0;d=d+-4|0;i=c[d>>2]|0;b=(i&-8)-e|0;if(!(i&3)){c[a>>2]=(c[f>>2]|0)+e;c[a+4>>2]=b;break}else{i=a+4|0;c[i>>2]=b|c[i>>2]&1|2;b=a+b+4|0;c[b>>2]=c[b>>2]|1;c[d>>2]=e|c[d>>2]&1|2;c[i>>2]=c[i>>2]|1;Tq(f,e);break}}else a=f;while(0);d=a+4|0;b=c[d>>2]|0;if(b&3|0?(h=b&-8,h>>>0>(g+16|0)>>>0):0){i=h-g|0;h=a+g|0;c[d>>2]=g|b&1|2;c[h+4>>2]=i|3;g=h+i+4|0;c[g>>2]=c[g>>2]|1;Tq(h,i)}i=a+8|0;return i|0}function Wq(){}function Xq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return (D=d,a-c>>>0|0)|0}function Yq(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;h=b+e|0;d=d&255;if((e|0)>=67){while(b&3){a[b>>0]=d;b=b+1|0}f=h&-4|0;g=f-64|0;i=d|d<<8|d<<16|d<<24;while((b|0)<=(g|0)){c[b>>2]=i;c[b+4>>2]=i;c[b+8>>2]=i;c[b+12>>2]=i;c[b+16>>2]=i;c[b+20>>2]=i;c[b+24>>2]=i;c[b+28>>2]=i;c[b+32>>2]=i;c[b+36>>2]=i;c[b+40>>2]=i;c[b+44>>2]=i;c[b+48>>2]=i;c[b+52>>2]=i;c[b+56>>2]=i;c[b+60>>2]=i;b=b+64|0}while((b|0)<(f|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(h|0)){a[b>>0]=d;b=b+1|0}return h-e|0}function Zq(a){a=a|0;return 0}function _q(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;c=a+c>>>0;return (D=b+d+(c>>>0>>0|0)>>>0,c|0)|0}function $q(b){b=b|0;var c=0;c=a[n+(b&255)>>0]|0;if((c|0)<8)return c|0;c=a[n+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[n+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (a[n+(b>>>24)>>0]|0)+24|0}function ar(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=a;j=b;k=j;h=d;n=e;i=n;if(!k){g=(f|0)!=0;if(!i){if(g){c[f>>2]=(l>>>0)%(h>>>0);c[f+4>>2]=0}n=0;f=(l>>>0)/(h>>>0)>>>0;return (D=n,f)|0}else{if(!g){n=0;f=0;return (D=n,f)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;f=0;return (D=n,f)|0}}g=(i|0)==0;do if(h){if(!g){g=(V(i|0)|0)-(V(k|0)|0)|0;if(g>>>0<=31){m=g+1|0;i=31-g|0;b=g-31>>31;h=m;a=l>>>(m>>>0)&b|k<>>(m>>>0)&b;g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;n=0;f=0;return (D=n,f)|0}g=h-1|0;if(g&h|0){i=(V(h|0)|0)+33-(V(k|0)|0)|0;p=64-i|0;m=32-i|0;j=m>>31;o=i-32|0;b=o>>31;h=i;a=m-1>>31&k>>>(o>>>0)|(k<>>(i>>>0))&b;b=b&k>>>(i>>>0);g=l<>>(o>>>0))&j|l<>31;break}if(f|0){c[f>>2]=g&l;c[f+4>>2]=0}if((h|0)==1){o=j|b&0;p=a|0|0;return (D=o,p)|0}else{p=$q(h|0)|0;o=k>>>(p>>>0)|0;p=k<<32-p|l>>>(p>>>0)|0;return (D=o,p)|0}}else{if(g){if(f|0){c[f>>2]=(k>>>0)%(h>>>0);c[f+4>>2]=0}o=0;p=(k>>>0)/(h>>>0)>>>0;return (D=o,p)|0}if(!l){if(f|0){c[f>>2]=0;c[f+4>>2]=(k>>>0)%(i>>>0)}o=0;p=(k>>>0)/(i>>>0)>>>0;return (D=o,p)|0}g=i-1|0;if(!(g&i)){if(f|0){c[f>>2]=a|0;c[f+4>>2]=g&k|b&0}o=0;p=k>>>(($q(i|0)|0)>>>0);return (D=o,p)|0}g=(V(i|0)|0)-(V(k|0)|0)|0;if(g>>>0<=30){b=g+1|0;i=31-g|0;h=b;a=k<>>(b>>>0);b=k>>>(b>>>0);g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;o=0;p=0;return (D=o,p)|0}while(0);if(!h){k=i;j=0;i=0}else{m=d|0|0;l=n|e&0;k=_q(m|0,l|0,-1,-1)|0;d=D;j=i;i=0;do{e=j;j=g>>>31|j<<1;g=i|g<<1;e=a<<1|e>>>31|0;n=a>>>31|b<<1|0;Xq(k|0,d|0,e|0,n|0)|0;p=D;o=p>>31|((p|0)<0?-1:0)<<1;i=o&1;a=Xq(e|0,n|0,o&m|0,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&l|0)|0;b=D;h=h-1|0}while((h|0)!=0);k=j;j=0}h=0;if(f|0){c[f>>2]=a;c[f+4>>2]=b}o=(g|0)>>>31|(k|h)<<1|(h<<1|g>>>31)&0|j;p=(g<<1|0>>>31)&-2|i;return (D=o,p)|0}function br(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=Xq(j^a|0,i^b|0,j|0,i|0)|0;g=D;a=f^j;b=e^i;return Xq((ar(h,g,Xq(f^c|0,e^d|0,f|0,e|0)|0,D,0)|0)^a|0,D^b|0,a|0,b|0)|0}function cr(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if((e|0)>=8192)return Sa(b|0,d|0,e|0)|0;h=b|0;g=b+e|0;if((b&3)==(d&3)){while(b&3){if(!e)return h|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}e=g&-4|0;f=e-64|0;while((b|0)<=(f|0)){c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=c[d+8>>2];c[b+12>>2]=c[d+12>>2];c[b+16>>2]=c[d+16>>2];c[b+20>>2]=c[d+20>>2];c[b+24>>2]=c[d+24>>2];c[b+28>>2]=c[d+28>>2];c[b+32>>2]=c[d+32>>2];c[b+36>>2]=c[d+36>>2];c[b+40>>2]=c[d+40>>2];c[b+44>>2]=c[d+44>>2];c[b+48>>2]=c[d+48>>2];c[b+52>>2]=c[d+52>>2];c[b+56>>2]=c[d+56>>2];c[b+60>>2]=c[d+60>>2];b=b+64|0;d=d+64|0}while((b|0)<(e|0)){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0}}else{e=g-4|0;while((b|0)<(e|0)){a[b>>0]=a[d>>0]|0;a[b+1>>0]=a[d+1>>0]|0;a[b+2>>0]=a[d+2>>0]|0;a[b+3>>0]=a[d+3>>0]|0;b=b+4|0;d=d+4|0}}while((b|0)<(g|0)){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0}return h|0}function dr(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else cr(b,c,d)|0;return b|0}function er(a){a=a|0;return (a&255)<<24|(a>>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function fr(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>c;return a>>>c|(b&(1<>c-32|0}function gr(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>>c;return a>>>c|(b&(1<>>c-32|0}function hr(a){a=a|0;return 0}function ir(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ar(a,b,c,d,0)|0}function jr(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;e=b&65535;c=S(e,f)|0;d=a>>>16;a=(c>>>16)+(S(e,d)|0)|0;e=b>>>16;b=S(e,f)|0;return (D=(a>>>16)+(S(e,d)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|c&65535|0)|0}function kr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;c=jr(e,f)|0;a=D;return (D=(S(b,f)|0)+(S(d,e)|0)+a|a&0,c|0|0)|0}function lr(a){a=a|0;var b=0,d=0;d=a+15&-16|0;b=c[i>>2]|0;a=b+d|0;if((d|0)>0&(a|0)<(b|0)|(a|0)<0){_()|0;Ia(12);return -1}c[i>>2]=a;if((a|0)>(Z()|0)?(Y()|0)==0:0){Ia(12);c[i>>2]=b;return -1}return b|0}function mr(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b<>>32-c;return a<>2]|0,c[f>>2]|0)|0}function or(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=l;l=l+16|0;i=f|0;h=b>>31|((b|0)<0?-1:0)<<1;g=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;k=e>>31|((e|0)<0?-1:0)<<1;j=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;a=Xq(h^a|0,g^b|0,h|0,g|0)|0;b=D;ar(a,b,Xq(k^d|0,j^e|0,k|0,j|0)|0,D,i)|0;e=Xq(c[i>>2]^h|0,c[i+4>>2]^g|0,h|0,g|0)|0;d=D;l=f;return (D=d,e)|0}function pr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return pb[a&63](b|0,c|0,d|0)|0}function qr(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;qb[a&15](b|0,c|0,d|0,e|0,f|0)}function rr(a,b){a=a|0;b=b|0;rb[a&7](b|0)}function sr(a,b,c){a=a|0;b=b|0;c=c|0;sb[a&7](b|0,c|0)}function tr(a,b){a=a|0;b=b|0;return tb[a&15](b|0)|0}function ur(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ub[a&7](b|0,c|0,d|0)}function vr(a){a=a|0;vb[a&3]()}function wr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return wb[a&3](b|0,c|0,d|0,e|0)|0}function xr(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;xb[a&1](b|0,c|0,d|0,e|0,f|0,g|0)}function yr(a,b,c){a=a|0;b=b|0;c=c|0;return yb[a&7](b|0,c|0)|0}function zr(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;zb[a&1](b|0,c|0,d|0,e|0)}function Ar(a,b,c){a=a|0;b=b|0;c=c|0;aa(0);return 0}function Br(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ba(1)}function Cr(a){a=a|0;ca(2)}function Dr(a,b){a=a|0;b=b|0;da(3)}function Er(a){a=a|0;ea(4);return 0}function Fr(a,b,c){a=a|0;b=b|0;c=c|0;fa(5)}function Gr(){ga(6)}function Hr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ha(7);return 0}function Ir(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ia(8)}function Jr(a,b){a=a|0;b=b|0;ja(9);return 0}function Kr(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ka(10)} // EMSCRIPTEN_END_FUNCS -var ub=[xx,ck,dk,ek,fk,ql,rl,sl,tl,vl,Ql,am,qm,Dm,Em,Fm,zr,Ar,Br,Cr,Er,Uh,Wr,uu,vu,yu,fv,Ue,Fv,vk,wk,Xk,Tl,em,um,Bu,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx];var vb=[yx,Kk,Ek,Hk,Ik,Ok,Sm,Pm,Tm,yx,yx,yx,yx,yx,yx,yx];var wb=[zx,Uk,Ol,_l,om,Hn,zu,Cu,iw,zx,zx,zx,zx,zx,zx,zx];var xb=[Ax,Tk,Nl,Zl,mm,nm,Cm,Vr];var yb=[Bx,Vk,pl,ul,Pl,$l,pm,yr,Dr,Zh,tu,Bx,Bx,Bx,Bx,Bx];var zb=[Cx,Nr,Sk,hs,Vs,jt,ru,Cx];var Ab=[Dx,pk,qk,Tt];var Bb=[Ex,Xr,Nq,es,nt,Ex,Ex,Ex];var Cb=[Fx,Mk];var Db=[Gx,ol,wl,xr,Fr,Oj,Jl,Gx];var Eb=[Hx,nh];return{_GNUNET_CRYPTO_rsa_signature_encode:ed,_GNUNET_CRYPTO_rsa_private_key_free:Yc,_GNUNET_CRYPTO_rsa_verify:pd,_bitshift64Shl:ix,_GNUNET_CRYPTO_hash_context_start:Dc,_bitshift64Lshr:cx,_TALER_setup_fresh_coin:su,_GNUNET_STRINGS_string_to_data:td,_GNUNET_CRYPTO_rsa_private_key_get_public:$c,_memset:Uw,_GNUNET_CRYPTO_eddsa_verify:yc,_TALER_amount_normalize:mu,_GNUNET_CRYPTO_hash_context_finish:Fc,_GNUNET_CRYPTO_symmetric_encrypt:ic,_TALER_WR_get_fraction:Sb,_GNUNET_CRYPTO_hash_context_read:Ec,_TALER_amount_cmp:lu,_GNUNET_CRYPTO_rsa_blind:fd,_TALER_WR_get_currency:Tb,_GNUNET_CRYPTO_random_block:Wc,_fflush:Rv,_GNUNET_CRYPTO_hash_create_random:Cc,_GNUNET_CRYPTO_rsa_unblind:od,_bitshift64Ashr:bx,_TALER_WRALL_get_amount:Qb,_sbrk:hx,_GNUNET_CRYPTO_eddsa_key_create:vc,_TALER_WRALL_eddsa_public_key_from_private:Mb,_llvm_bswap_i32:ax,___muldi3:gx,_GNUNET_CRYPTO_ecc_ecdh:zc,_memalign:Qw,_GNUNET_CRYPTO_rsa_private_key_decode:_c,_GNUNET_CRYPTO_symmetric_decrypt:lc,_GNUNET_CRYPTO_rsa_signature_free:md,___divdi3:Zw,_TALER_amount_ntoh:hu,_pthread_self:kx,_GNUNET_CRYPTO_ecdhe_key_create:sc,_TALER_amount_subtract:ou,___udivmoddi4:Yw,_GNUNET_CRYPTO_rsa_private_key_create:Xc,_i64Add:Ww,_GNUNET_CRYPTO_ecdhe_key_get_public:qc,_TALER_WRALL_purpose_create:Pb,_GNUNET_CRYPTO_ecdh_eddsa:Ac,_pthread_mutex_unlock:dx,_GNUNET_CRYPTO_rsa_public_key_free:bd,_GNUNET_CRYPTO_kdf:Mc,_GNUNET_CRYPTO_eddsa_sign:wc,_TALER_amount_hton:gu,_i64Subtract:Tw,_pthread_mutex_lock:Vw,_GNUNET_CRYPTO_rsa_private_key_encode:Zc,_GNUNET_CRYPTO_eddsa_key_get_public:oc,___udivdi3:ex,_TALER_amount_add:pu,___errno_location:xu,___muldsi3:fx,_TALER_WR_get_value:Rb,_TALER_WRALL_ecdhe_public_key_from_private:Ob,_free:Lw,_GNUNET_STRINGS_data_to_string_alloc:sd,_GNUNET_CRYPTO_hash_context_abort:Gc,_memmove:$w,_llvm_cttz_i32:Xw,_malloc:Kw,_memcpy:_w,_TALER_amount_get_zero:iu,_GNUNET_CRYPTO_hkdf:Kc,_GNUNET_CRYPTO_rsa_public_key_decode:dd,_GNUNET_CRYPTO_ecdsa_key_create:uc,_TALER_WRALL_ecdsa_public_key_from_private:Nb,_GNUNET_CRYPTO_rsa_public_key_encode:cd,___remdi3:lx,_GNUNET_CRYPTO_hash:Bc,_GNUNET_CRYPTO_rsa_signature_decode:nd,___uremdi3:jx,_GNUNET_util_cl_init:Yb,_GNUNET_CRYPTO_random_init:Rc,_gpg_err_init:At,_TALER_gcrypt_init:qu,runPostSets:Sw,stackAlloc:Fb,stackSave:Gb,stackRestore:Hb,establishStackSpace:Ib,setThrew:Jb,setTempRet0:Kb,getTempRet0:Lb,dynCall_iiii:mx,dynCall_viiiii:nx,dynCall_vi:ox,dynCall_vii:px,dynCall_ii:qx,dynCall_viii:rx,dynCall_v:sx,dynCall_iiiii:tx,dynCall_viiiiii:ux,dynCall_iii:vx,dynCall_viiii:wx}}) +var pb=[Ar,Yh,Zh,_h,$h,Gi,Hi,Ii,Ji,Li,Ti,_i,ej,hj,ij,jj,Bm,Cm,Dm,Em,Gm,Gg,Nm,wo,xo,Bo,Ap,Ke,Rp,gi,hi,ri,Ui,$i,fj,Do,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar,Ar];var qb=[Br,ki,fi,ei,di,mi,mj,nj,lj,Br,Br,Br,Br,Br,Br,Br];var rb=[Cr,pi,Ri,Yi,cj,Xj,sq,Cr];var sb=[Dr,oi,Qi,Xi,aj,bj,gj,Mm];var tb=[Er,qi,Fi,Ki,Si,Zi,dj,Am,Fm,Jg,vo,Er,Er,Er,Er,Er];var ub=[Fr,Jm,ni,$m,qn,zn,to,Fr];var vb=[Gr,ii,ji,eo];var wb=[Hr,Om,jm,Dn];var xb=[Ir,li];var yb=[Jr,Ei,Mi,zm,Hm,Mh,Pi,Jr];var zb=[Kr,og];return{_GNUNET_CRYPTO_rsa_signature_encode:$c,_GNUNET_CRYPTO_rsa_private_key_free:Tc,_GNUNET_CRYPTO_rsa_verify:kd,_bitshift64Shl:mr,_GNUNET_CRYPTO_hash_context_start:yc,_bitshift64Lshr:gr,_TALER_setup_fresh_coin:uo,_GNUNET_STRINGS_string_to_data:od,_GNUNET_CRYPTO_rsa_private_key_get_public:Wc,_memset:Yq,_GNUNET_CRYPTO_eddsa_verify:tc,_TALER_amount_normalize:po,_GNUNET_CRYPTO_hash_context_finish:Ac,_GNUNET_CRYPTO_symmetric_encrypt:dc,_TALER_WR_get_fraction:Nb,_GNUNET_CRYPTO_hash_context_read:zc,_TALER_amount_cmp:oo,_GNUNET_CRYPTO_rsa_blind:ad,_TALER_WR_get_currency:Ob,_GNUNET_CRYPTO_random_block:Rc,_fflush:$p,_GNUNET_CRYPTO_hash_create_random:xc,_GNUNET_CRYPTO_rsa_unblind:jd,_bitshift64Ashr:fr,_TALER_WRALL_get_amount:Lb,_sbrk:lr,_GNUNET_CRYPTO_eddsa_key_create:qc,_TALER_WRALL_eddsa_public_key_from_private:Hb,_llvm_bswap_i32:er,___muldi3:kr,_GNUNET_CRYPTO_ecc_ecdh:uc,_memalign:Uq,_GNUNET_CRYPTO_rsa_private_key_decode:Vc,_GNUNET_CRYPTO_symmetric_decrypt:gc,_GNUNET_CRYPTO_rsa_signature_free:hd,___divdi3:br,_TALER_amount_ntoh:mo,_llvm_cttz_i32:$q,_GNUNET_CRYPTO_ecdhe_key_create:nc,_TALER_amount_subtract:qo,___udivmoddi4:ar,_GNUNET_CRYPTO_rsa_private_key_create:Sc,_i64Add:_q,_GNUNET_CRYPTO_ecdhe_key_get_public:lc,_TALER_WRALL_purpose_create:Kb,_GNUNET_CRYPTO_ecdh_eddsa:vc,_pthread_mutex_unlock:hr,_GNUNET_CRYPTO_rsa_public_key_free:Yc,_GNUNET_CRYPTO_kdf:Hc,_emscripten_get_global_libc:Eo,_GNUNET_CRYPTO_eddsa_sign:rc,_TALER_amount_hton:lo,_i64Subtract:Xq,_pthread_mutex_lock:Zq,_GNUNET_CRYPTO_rsa_private_key_encode:Uc,_GNUNET_CRYPTO_eddsa_key_get_public:jc,___udivdi3:ir,_TALER_amount_add:ro,___errno_location:zo,___muldsi3:jr,_TALER_WR_get_value:Mb,_TALER_WRALL_ecdhe_public_key_from_private:Jb,_free:Pq,_GNUNET_STRINGS_data_to_string_alloc:nd,_GNUNET_CRYPTO_hash_context_abort:Bc,_memmove:dr,_malloc:Oq,_memcpy:cr,_TALER_amount_get_zero:no,_GNUNET_CRYPTO_hkdf:Fc,_GNUNET_CRYPTO_rsa_public_key_decode:_c,_GNUNET_CRYPTO_ecdsa_key_create:pc,_TALER_WRALL_ecdsa_public_key_from_private:Ib,_GNUNET_CRYPTO_rsa_public_key_encode:Zc,___remdi3:or,_GNUNET_CRYPTO_hash:wc,_GNUNET_CRYPTO_rsa_signature_decode:id,___uremdi3:nr,_GNUNET_util_cl_init:Tb,_GNUNET_CRYPTO_random_init:Mc,_gpg_err_init:On,_TALER_gcrypt_init:so,runPostSets:Wq,stackAlloc:Ab,stackSave:Bb,stackRestore:Cb,establishStackSpace:Db,setTempRet0:Fb,getTempRet0:Gb,setThrew:Eb,stackAlloc:Ab,stackSave:Bb,stackRestore:Cb,establishStackSpace:Db,setThrew:Eb,setTempRet0:Fb,getTempRet0:Gb,dynCall_iiii:pr,dynCall_viiiii:qr,dynCall_vi:rr,dynCall_vii:sr,dynCall_ii:tr,dynCall_viii:ur,dynCall_v:vr,dynCall_iiiii:wr,dynCall_viiiiii:xr,dynCall_iii:yr,dynCall_viiii:zr}}) // EMSCRIPTEN_END_ASM -(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var real__GNUNET_CRYPTO_rsa_signature_encode=asm["_GNUNET_CRYPTO_rsa_signature_encode"];asm["_GNUNET_CRYPTO_rsa_signature_encode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_signature_encode.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_verify=asm["_GNUNET_CRYPTO_rsa_verify"];asm["_GNUNET_CRYPTO_rsa_verify"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_verify.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_start=asm["_GNUNET_CRYPTO_hash_context_start"];asm["_GNUNET_CRYPTO_hash_context_start"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_start.apply(null,arguments)});var real____uremdi3=asm["___uremdi3"];asm["___uremdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____uremdi3.apply(null,arguments)});var real__TALER_setup_fresh_coin=asm["_TALER_setup_fresh_coin"];asm["_TALER_setup_fresh_coin"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_setup_fresh_coin.apply(null,arguments)});var real__GNUNET_STRINGS_string_to_data=asm["_GNUNET_STRINGS_string_to_data"];asm["_GNUNET_STRINGS_string_to_data"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_STRINGS_string_to_data.apply(null,arguments)});var real__i64Subtract=asm["_i64Subtract"];asm["_i64Subtract"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__i64Subtract.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_get_public=asm["_GNUNET_CRYPTO_rsa_private_key_get_public"];asm["_GNUNET_CRYPTO_rsa_private_key_get_public"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_get_public.apply(null,arguments)});var real__TALER_WRALL_get_amount=asm["_TALER_WRALL_get_amount"];asm["_TALER_WRALL_get_amount"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_get_amount.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_verify=asm["_GNUNET_CRYPTO_eddsa_verify"];asm["_GNUNET_CRYPTO_eddsa_verify"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_verify.apply(null,arguments)});var real__GNUNET_util_cl_init=asm["_GNUNET_util_cl_init"];asm["_GNUNET_util_cl_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_util_cl_init.apply(null,arguments)});var real__TALER_amount_normalize=asm["_TALER_amount_normalize"];asm["_TALER_amount_normalize"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_normalize.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_finish=asm["_GNUNET_CRYPTO_hash_context_finish"];asm["_GNUNET_CRYPTO_hash_context_finish"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_finish.apply(null,arguments)});var real__bitshift64Lshr=asm["_bitshift64Lshr"];asm["_bitshift64Lshr"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__bitshift64Lshr.apply(null,arguments)});var real__TALER_WR_get_fraction=asm["_TALER_WR_get_fraction"];asm["_TALER_WR_get_fraction"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WR_get_fraction.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_read=asm["_GNUNET_CRYPTO_hash_context_read"];asm["_GNUNET_CRYPTO_hash_context_read"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_read.apply(null,arguments)});var real__TALER_amount_cmp=asm["_TALER_amount_cmp"];asm["_TALER_amount_cmp"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_cmp.apply(null,arguments)});var real__bitshift64Shl=asm["_bitshift64Shl"];asm["_bitshift64Shl"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__bitshift64Shl.apply(null,arguments)});var real__TALER_WR_get_currency=asm["_TALER_WR_get_currency"];asm["_TALER_WR_get_currency"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WR_get_currency.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_free=asm["_GNUNET_CRYPTO_rsa_private_key_free"];asm["_GNUNET_CRYPTO_rsa_private_key_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_free.apply(null,arguments)});var real__fflush=asm["_fflush"];asm["_fflush"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__fflush.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_create_random=asm["_GNUNET_CRYPTO_hash_create_random"];asm["_GNUNET_CRYPTO_hash_create_random"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_create_random.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_unblind=asm["_GNUNET_CRYPTO_rsa_unblind"];asm["_GNUNET_CRYPTO_rsa_unblind"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_unblind.apply(null,arguments)});var real__bitshift64Ashr=asm["_bitshift64Ashr"];asm["_bitshift64Ashr"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__bitshift64Ashr.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_create=asm["_GNUNET_CRYPTO_rsa_private_key_create"];asm["_GNUNET_CRYPTO_rsa_private_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_create.apply(null,arguments)});var real__sbrk=asm["_sbrk"];asm["_sbrk"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__sbrk.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_key_create=asm["_GNUNET_CRYPTO_eddsa_key_create"];asm["_GNUNET_CRYPTO_eddsa_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_key_create.apply(null,arguments)});var real__TALER_WRALL_eddsa_public_key_from_private=asm["_TALER_WRALL_eddsa_public_key_from_private"];asm["_TALER_WRALL_eddsa_public_key_from_private"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_eddsa_public_key_from_private.apply(null,arguments)});var real____errno_location=asm["___errno_location"];asm["___errno_location"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____errno_location.apply(null,arguments)});var real____muldi3=asm["___muldi3"];asm["___muldi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____muldi3.apply(null,arguments)});var real__GNUNET_CRYPTO_ecc_ecdh=asm["_GNUNET_CRYPTO_ecc_ecdh"];asm["_GNUNET_CRYPTO_ecc_ecdh"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecc_ecdh.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_public_key_decode=asm["_GNUNET_CRYPTO_rsa_public_key_decode"];asm["_GNUNET_CRYPTO_rsa_public_key_decode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_public_key_decode.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_decode=asm["_GNUNET_CRYPTO_rsa_private_key_decode"];asm["_GNUNET_CRYPTO_rsa_private_key_decode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_decode.apply(null,arguments)});var real__GNUNET_CRYPTO_symmetric_encrypt=asm["_GNUNET_CRYPTO_symmetric_encrypt"];asm["_GNUNET_CRYPTO_symmetric_encrypt"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_symmetric_encrypt.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdhe_key_get_public=asm["_GNUNET_CRYPTO_ecdhe_key_get_public"];asm["_GNUNET_CRYPTO_ecdhe_key_get_public"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdhe_key_get_public.apply(null,arguments)});var real____divdi3=asm["___divdi3"];asm["___divdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____divdi3.apply(null,arguments)});var real__TALER_amount_ntoh=asm["_TALER_amount_ntoh"];asm["_TALER_amount_ntoh"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_ntoh.apply(null,arguments)});var real__llvm_cttz_i32=asm["_llvm_cttz_i32"];asm["_llvm_cttz_i32"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__llvm_cttz_i32.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdhe_key_create=asm["_GNUNET_CRYPTO_ecdhe_key_create"];asm["_GNUNET_CRYPTO_ecdhe_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdhe_key_create.apply(null,arguments)});var real__TALER_amount_subtract=asm["_TALER_amount_subtract"];asm["_TALER_amount_subtract"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_subtract.apply(null,arguments)});var real____udivmoddi4=asm["___udivmoddi4"];asm["___udivmoddi4"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____udivmoddi4.apply(null,arguments)});var real__GNUNET_CRYPTO_random_block=asm["_GNUNET_CRYPTO_random_block"];asm["_GNUNET_CRYPTO_random_block"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_random_block.apply(null,arguments)});var real__i64Add=asm["_i64Add"];asm["_i64Add"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__i64Add.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_signature_free=asm["_GNUNET_CRYPTO_rsa_signature_free"];asm["_GNUNET_CRYPTO_rsa_signature_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_signature_free.apply(null,arguments)});var real__pthread_self=asm["_pthread_self"];asm["_pthread_self"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__pthread_self.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdh_eddsa=asm["_GNUNET_CRYPTO_ecdh_eddsa"];asm["_GNUNET_CRYPTO_ecdh_eddsa"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdh_eddsa.apply(null,arguments)});var real__pthread_mutex_unlock=asm["_pthread_mutex_unlock"];asm["_pthread_mutex_unlock"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__pthread_mutex_unlock.apply(null,arguments)});var real__TALER_WRALL_purpose_create=asm["_TALER_WRALL_purpose_create"];asm["_TALER_WRALL_purpose_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_purpose_create.apply(null,arguments)});var real__gpg_err_init=asm["_gpg_err_init"];asm["_gpg_err_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__gpg_err_init.apply(null,arguments)});var real__GNUNET_CRYPTO_kdf=asm["_GNUNET_CRYPTO_kdf"];asm["_GNUNET_CRYPTO_kdf"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_kdf.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_sign=asm["_GNUNET_CRYPTO_eddsa_sign"];asm["_GNUNET_CRYPTO_eddsa_sign"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_sign.apply(null,arguments)});var real__TALER_amount_hton=asm["_TALER_amount_hton"];asm["_TALER_amount_hton"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_hton.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_public_key_free=asm["_GNUNET_CRYPTO_rsa_public_key_free"];asm["_GNUNET_CRYPTO_rsa_public_key_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_public_key_free.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_encode=asm["_GNUNET_CRYPTO_rsa_private_key_encode"];asm["_GNUNET_CRYPTO_rsa_private_key_encode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_encode.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_key_get_public=asm["_GNUNET_CRYPTO_eddsa_key_get_public"];asm["_GNUNET_CRYPTO_eddsa_key_get_public"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_key_get_public.apply(null,arguments)});var real____udivdi3=asm["___udivdi3"];asm["___udivdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____udivdi3.apply(null,arguments)});var real__llvm_bswap_i32=asm["_llvm_bswap_i32"];asm["_llvm_bswap_i32"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__llvm_bswap_i32.apply(null,arguments)});var real____muldsi3=asm["___muldsi3"];asm["___muldsi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____muldsi3.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_blind=asm["_GNUNET_CRYPTO_rsa_blind"];asm["_GNUNET_CRYPTO_rsa_blind"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_blind.apply(null,arguments)});var real__TALER_amount_add=asm["_TALER_amount_add"];asm["_TALER_amount_add"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_add.apply(null,arguments)});var real__free=asm["_free"];asm["_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__free.apply(null,arguments)});var real__TALER_gcrypt_init=asm["_TALER_gcrypt_init"];asm["_TALER_gcrypt_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_gcrypt_init.apply(null,arguments)});var real__GNUNET_STRINGS_data_to_string_alloc=asm["_GNUNET_STRINGS_data_to_string_alloc"];asm["_GNUNET_STRINGS_data_to_string_alloc"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_STRINGS_data_to_string_alloc.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_abort=asm["_GNUNET_CRYPTO_hash_context_abort"];asm["_GNUNET_CRYPTO_hash_context_abort"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_abort.apply(null,arguments)});var real__GNUNET_CRYPTO_symmetric_decrypt=asm["_GNUNET_CRYPTO_symmetric_decrypt"];asm["_GNUNET_CRYPTO_symmetric_decrypt"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_symmetric_decrypt.apply(null,arguments)});var real__GNUNET_CRYPTO_random_init=asm["_GNUNET_CRYPTO_random_init"];asm["_GNUNET_CRYPTO_random_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_random_init.apply(null,arguments)});var real__TALER_amount_get_zero=asm["_TALER_amount_get_zero"];asm["_TALER_amount_get_zero"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_get_zero.apply(null,arguments)});var real__malloc=asm["_malloc"];asm["_malloc"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__malloc.apply(null,arguments)});var real__pthread_mutex_lock=asm["_pthread_mutex_lock"];asm["_pthread_mutex_lock"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__pthread_mutex_lock.apply(null,arguments)});var real__GNUNET_CRYPTO_hkdf=asm["_GNUNET_CRYPTO_hkdf"];asm["_GNUNET_CRYPTO_hkdf"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hkdf.apply(null,arguments)});var real__memalign=asm["_memalign"];asm["_memalign"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__memalign.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdsa_key_create=asm["_GNUNET_CRYPTO_ecdsa_key_create"];asm["_GNUNET_CRYPTO_ecdsa_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdsa_key_create.apply(null,arguments)});var real__TALER_WRALL_ecdsa_public_key_from_private=asm["_TALER_WRALL_ecdsa_public_key_from_private"];asm["_TALER_WRALL_ecdsa_public_key_from_private"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_ecdsa_public_key_from_private.apply(null,arguments)});var real__memmove=asm["_memmove"];asm["_memmove"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__memmove.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_public_key_encode=asm["_GNUNET_CRYPTO_rsa_public_key_encode"];asm["_GNUNET_CRYPTO_rsa_public_key_encode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_public_key_encode.apply(null,arguments)});var real____remdi3=asm["___remdi3"];asm["___remdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____remdi3.apply(null,arguments)});var real__GNUNET_CRYPTO_hash=asm["_GNUNET_CRYPTO_hash"];asm["_GNUNET_CRYPTO_hash"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash.apply(null,arguments)});var real__TALER_WR_get_value=asm["_TALER_WR_get_value"];asm["_TALER_WR_get_value"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WR_get_value.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_signature_decode=asm["_GNUNET_CRYPTO_rsa_signature_decode"];asm["_GNUNET_CRYPTO_rsa_signature_decode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_signature_decode.apply(null,arguments)});var real__TALER_WRALL_ecdhe_public_key_from_private=asm["_TALER_WRALL_ecdhe_public_key_from_private"];asm["_TALER_WRALL_ecdhe_public_key_from_private"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_ecdhe_public_key_from_private.apply(null,arguments)});var _GNUNET_CRYPTO_rsa_signature_encode=Module["_GNUNET_CRYPTO_rsa_signature_encode"]=asm["_GNUNET_CRYPTO_rsa_signature_encode"];var _GNUNET_CRYPTO_rsa_verify=Module["_GNUNET_CRYPTO_rsa_verify"]=asm["_GNUNET_CRYPTO_rsa_verify"];var _GNUNET_CRYPTO_hash_context_start=Module["_GNUNET_CRYPTO_hash_context_start"]=asm["_GNUNET_CRYPTO_hash_context_start"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var _TALER_setup_fresh_coin=Module["_TALER_setup_fresh_coin"]=asm["_TALER_setup_fresh_coin"];var _GNUNET_STRINGS_string_to_data=Module["_GNUNET_STRINGS_string_to_data"]=asm["_GNUNET_STRINGS_string_to_data"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _GNUNET_CRYPTO_rsa_private_key_get_public=Module["_GNUNET_CRYPTO_rsa_private_key_get_public"]=asm["_GNUNET_CRYPTO_rsa_private_key_get_public"];var _TALER_WRALL_get_amount=Module["_TALER_WRALL_get_amount"]=asm["_TALER_WRALL_get_amount"];var _GNUNET_CRYPTO_eddsa_verify=Module["_GNUNET_CRYPTO_eddsa_verify"]=asm["_GNUNET_CRYPTO_eddsa_verify"];var _GNUNET_util_cl_init=Module["_GNUNET_util_cl_init"]=asm["_GNUNET_util_cl_init"];var _TALER_amount_normalize=Module["_TALER_amount_normalize"]=asm["_TALER_amount_normalize"];var _GNUNET_CRYPTO_hash_context_finish=Module["_GNUNET_CRYPTO_hash_context_finish"]=asm["_GNUNET_CRYPTO_hash_context_finish"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _TALER_WR_get_fraction=Module["_TALER_WR_get_fraction"]=asm["_TALER_WR_get_fraction"];var _GNUNET_CRYPTO_hash_context_read=Module["_GNUNET_CRYPTO_hash_context_read"]=asm["_GNUNET_CRYPTO_hash_context_read"];var _TALER_amount_cmp=Module["_TALER_amount_cmp"]=asm["_TALER_amount_cmp"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _TALER_WR_get_currency=Module["_TALER_WR_get_currency"]=asm["_TALER_WR_get_currency"];var _GNUNET_CRYPTO_rsa_private_key_free=Module["_GNUNET_CRYPTO_rsa_private_key_free"]=asm["_GNUNET_CRYPTO_rsa_private_key_free"];var _fflush=Module["_fflush"]=asm["_fflush"];var _GNUNET_CRYPTO_hash_create_random=Module["_GNUNET_CRYPTO_hash_create_random"]=asm["_GNUNET_CRYPTO_hash_create_random"];var _GNUNET_CRYPTO_rsa_unblind=Module["_GNUNET_CRYPTO_rsa_unblind"]=asm["_GNUNET_CRYPTO_rsa_unblind"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _memset=Module["_memset"]=asm["_memset"];var _GNUNET_CRYPTO_rsa_private_key_create=Module["_GNUNET_CRYPTO_rsa_private_key_create"]=asm["_GNUNET_CRYPTO_rsa_private_key_create"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _GNUNET_CRYPTO_eddsa_key_create=Module["_GNUNET_CRYPTO_eddsa_key_create"]=asm["_GNUNET_CRYPTO_eddsa_key_create"];var _TALER_WRALL_eddsa_public_key_from_private=Module["_TALER_WRALL_eddsa_public_key_from_private"]=asm["_TALER_WRALL_eddsa_public_key_from_private"];var ___errno_location=Module["___errno_location"]=asm["___errno_location"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var _GNUNET_CRYPTO_ecc_ecdh=Module["_GNUNET_CRYPTO_ecc_ecdh"]=asm["_GNUNET_CRYPTO_ecc_ecdh"];var _GNUNET_CRYPTO_rsa_public_key_decode=Module["_GNUNET_CRYPTO_rsa_public_key_decode"]=asm["_GNUNET_CRYPTO_rsa_public_key_decode"];var _GNUNET_CRYPTO_rsa_private_key_decode=Module["_GNUNET_CRYPTO_rsa_private_key_decode"]=asm["_GNUNET_CRYPTO_rsa_private_key_decode"];var _GNUNET_CRYPTO_symmetric_encrypt=Module["_GNUNET_CRYPTO_symmetric_encrypt"]=asm["_GNUNET_CRYPTO_symmetric_encrypt"];var _GNUNET_CRYPTO_ecdhe_key_get_public=Module["_GNUNET_CRYPTO_ecdhe_key_get_public"]=asm["_GNUNET_CRYPTO_ecdhe_key_get_public"];var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var _TALER_amount_ntoh=Module["_TALER_amount_ntoh"]=asm["_TALER_amount_ntoh"];var _llvm_cttz_i32=Module["_llvm_cttz_i32"]=asm["_llvm_cttz_i32"];var _GNUNET_CRYPTO_ecdhe_key_create=Module["_GNUNET_CRYPTO_ecdhe_key_create"]=asm["_GNUNET_CRYPTO_ecdhe_key_create"];var _TALER_amount_subtract=Module["_TALER_amount_subtract"]=asm["_TALER_amount_subtract"];var ___udivmoddi4=Module["___udivmoddi4"]=asm["___udivmoddi4"];var _GNUNET_CRYPTO_random_block=Module["_GNUNET_CRYPTO_random_block"]=asm["_GNUNET_CRYPTO_random_block"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _GNUNET_CRYPTO_rsa_signature_free=Module["_GNUNET_CRYPTO_rsa_signature_free"]=asm["_GNUNET_CRYPTO_rsa_signature_free"];var _pthread_self=Module["_pthread_self"]=asm["_pthread_self"];var _GNUNET_CRYPTO_ecdh_eddsa=Module["_GNUNET_CRYPTO_ecdh_eddsa"]=asm["_GNUNET_CRYPTO_ecdh_eddsa"];var _pthread_mutex_unlock=Module["_pthread_mutex_unlock"]=asm["_pthread_mutex_unlock"];var _TALER_WRALL_purpose_create=Module["_TALER_WRALL_purpose_create"]=asm["_TALER_WRALL_purpose_create"];var _gpg_err_init=Module["_gpg_err_init"]=asm["_gpg_err_init"];var _GNUNET_CRYPTO_kdf=Module["_GNUNET_CRYPTO_kdf"]=asm["_GNUNET_CRYPTO_kdf"];var _GNUNET_CRYPTO_eddsa_sign=Module["_GNUNET_CRYPTO_eddsa_sign"]=asm["_GNUNET_CRYPTO_eddsa_sign"];var _TALER_amount_hton=Module["_TALER_amount_hton"]=asm["_TALER_amount_hton"];var _GNUNET_CRYPTO_rsa_public_key_free=Module["_GNUNET_CRYPTO_rsa_public_key_free"]=asm["_GNUNET_CRYPTO_rsa_public_key_free"];var _GNUNET_CRYPTO_rsa_private_key_encode=Module["_GNUNET_CRYPTO_rsa_private_key_encode"]=asm["_GNUNET_CRYPTO_rsa_private_key_encode"];var _GNUNET_CRYPTO_eddsa_key_get_public=Module["_GNUNET_CRYPTO_eddsa_key_get_public"]=asm["_GNUNET_CRYPTO_eddsa_key_get_public"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var _llvm_bswap_i32=Module["_llvm_bswap_i32"]=asm["_llvm_bswap_i32"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var ___muldsi3=Module["___muldsi3"]=asm["___muldsi3"];var _GNUNET_CRYPTO_rsa_blind=Module["_GNUNET_CRYPTO_rsa_blind"]=asm["_GNUNET_CRYPTO_rsa_blind"];var _TALER_amount_add=Module["_TALER_amount_add"]=asm["_TALER_amount_add"];var _free=Module["_free"]=asm["_free"];var _TALER_gcrypt_init=Module["_TALER_gcrypt_init"]=asm["_TALER_gcrypt_init"];var _GNUNET_STRINGS_data_to_string_alloc=Module["_GNUNET_STRINGS_data_to_string_alloc"]=asm["_GNUNET_STRINGS_data_to_string_alloc"];var _GNUNET_CRYPTO_hash_context_abort=Module["_GNUNET_CRYPTO_hash_context_abort"]=asm["_GNUNET_CRYPTO_hash_context_abort"];var _GNUNET_CRYPTO_symmetric_decrypt=Module["_GNUNET_CRYPTO_symmetric_decrypt"]=asm["_GNUNET_CRYPTO_symmetric_decrypt"];var _GNUNET_CRYPTO_random_init=Module["_GNUNET_CRYPTO_random_init"]=asm["_GNUNET_CRYPTO_random_init"];var _TALER_amount_get_zero=Module["_TALER_amount_get_zero"]=asm["_TALER_amount_get_zero"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _pthread_mutex_lock=Module["_pthread_mutex_lock"]=asm["_pthread_mutex_lock"];var _GNUNET_CRYPTO_hkdf=Module["_GNUNET_CRYPTO_hkdf"]=asm["_GNUNET_CRYPTO_hkdf"];var _memalign=Module["_memalign"]=asm["_memalign"];var _GNUNET_CRYPTO_ecdsa_key_create=Module["_GNUNET_CRYPTO_ecdsa_key_create"]=asm["_GNUNET_CRYPTO_ecdsa_key_create"];var _TALER_WRALL_ecdsa_public_key_from_private=Module["_TALER_WRALL_ecdsa_public_key_from_private"]=asm["_TALER_WRALL_ecdsa_public_key_from_private"];var _memmove=Module["_memmove"]=asm["_memmove"];var _GNUNET_CRYPTO_rsa_public_key_encode=Module["_GNUNET_CRYPTO_rsa_public_key_encode"]=asm["_GNUNET_CRYPTO_rsa_public_key_encode"];var ___remdi3=Module["___remdi3"]=asm["___remdi3"];var _GNUNET_CRYPTO_hash=Module["_GNUNET_CRYPTO_hash"]=asm["_GNUNET_CRYPTO_hash"];var _TALER_WR_get_value=Module["_TALER_WR_get_value"]=asm["_TALER_WR_get_value"];var _GNUNET_CRYPTO_rsa_signature_decode=Module["_GNUNET_CRYPTO_rsa_signature_decode"]=asm["_GNUNET_CRYPTO_rsa_signature_decode"];var _TALER_WRALL_ecdhe_public_key_from_private=Module["_TALER_WRALL_ecdhe_public_key_from_private"]=asm["_TALER_WRALL_ecdhe_public_key_from_private"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];Runtime.stackAlloc=asm["stackAlloc"];Runtime.stackSave=asm["stackSave"];Runtime.stackRestore=asm["stackRestore"];Runtime.establishStackSpace=asm["establishStackSpace"];Runtime.setTempRet0=asm["setTempRet0"];Runtime.getTempRet0=asm["getTempRet0"];function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){assert(runDependencies==0,"cannot call main when async dependencies remain! (listen on __ATMAIN__)");assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){Module.printErr("run() called, but dependencies remain, so not running");return}writeStackCookie();preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(ENVIRONMENT_IS_WEB&&preloadStartTime!==null){Module.printErr("pre-main prep time: "+(Date.now()-preloadStartTime)+" ms")}if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}checkStackCookie()}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){Module.printErr("exit("+status+") implicitly called by end of main(), but noExitRuntime, so not exiting the runtime (you can use emscripten_force_exit, if you want to force a true shutdown)");return}if(Module["noExitRuntime"]){Module.printErr("exit("+status+") called, but noExitRuntime, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)")}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}else if(ENVIRONMENT_IS_SHELL&&typeof quit==="function"){quit(status)}throw new ExitStatus(status)}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach((function(decorator){output=decorator(output,what)}))}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"]){shouldRunNow=false}run() +(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var real__bitshift64Lshr=asm["_bitshift64Lshr"];asm["_bitshift64Lshr"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__bitshift64Lshr.apply(null,arguments)});var real__bitshift64Ashr=asm["_bitshift64Ashr"];asm["_bitshift64Ashr"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__bitshift64Ashr.apply(null,arguments)});var real__sbrk=asm["_sbrk"];asm["_sbrk"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__sbrk.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_key_create=asm["_GNUNET_CRYPTO_eddsa_key_create"];asm["_GNUNET_CRYPTO_eddsa_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_key_create.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_decode=asm["_GNUNET_CRYPTO_rsa_private_key_decode"];asm["_GNUNET_CRYPTO_rsa_private_key_decode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_decode.apply(null,arguments)});var real____udivmoddi4=asm["___udivmoddi4"];asm["___udivmoddi4"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____udivmoddi4.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdh_eddsa=asm["_GNUNET_CRYPTO_ecdh_eddsa"];asm["_GNUNET_CRYPTO_ecdh_eddsa"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdh_eddsa.apply(null,arguments)});var real__emscripten_get_global_libc=asm["_emscripten_get_global_libc"];asm["_emscripten_get_global_libc"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__emscripten_get_global_libc.apply(null,arguments)});var real__TALER_amount_hton=asm["_TALER_amount_hton"];asm["_TALER_amount_hton"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_hton.apply(null,arguments)});var real_stackSave=asm["stackSave"];asm["stackSave"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real_stackSave.apply(null,arguments)});var real__gpg_err_init=asm["_gpg_err_init"];asm["_gpg_err_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__gpg_err_init.apply(null,arguments)});var real__free=asm["_free"];asm["_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__free.apply(null,arguments)});var real__memalign=asm["_memalign"];asm["_memalign"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__memalign.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdsa_key_create=asm["_GNUNET_CRYPTO_ecdsa_key_create"];asm["_GNUNET_CRYPTO_ecdsa_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdsa_key_create.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_start=asm["_GNUNET_CRYPTO_hash_context_start"];asm["_GNUNET_CRYPTO_hash_context_start"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_start.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_get_public=asm["_GNUNET_CRYPTO_rsa_private_key_get_public"];asm["_GNUNET_CRYPTO_rsa_private_key_get_public"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_get_public.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_verify=asm["_GNUNET_CRYPTO_eddsa_verify"];asm["_GNUNET_CRYPTO_eddsa_verify"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_verify.apply(null,arguments)});var real_setThrew=asm["setThrew"];asm["setThrew"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real_setThrew.apply(null,arguments)});var real__GNUNET_CRYPTO_symmetric_encrypt=asm["_GNUNET_CRYPTO_symmetric_encrypt"];asm["_GNUNET_CRYPTO_symmetric_encrypt"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_symmetric_encrypt.apply(null,arguments)});var real__TALER_WR_get_fraction=asm["_TALER_WR_get_fraction"];asm["_TALER_WR_get_fraction"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WR_get_fraction.apply(null,arguments)});var real__TALER_amount_cmp=asm["_TALER_amount_cmp"];asm["_TALER_amount_cmp"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_cmp.apply(null,arguments)});var real__llvm_cttz_i32=asm["_llvm_cttz_i32"];asm["_llvm_cttz_i32"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__llvm_cttz_i32.apply(null,arguments)});var real_stackAlloc=asm["stackAlloc"];asm["stackAlloc"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real_stackAlloc.apply(null,arguments)});var real__GNUNET_CRYPTO_kdf=asm["_GNUNET_CRYPTO_kdf"];asm["_GNUNET_CRYPTO_kdf"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_kdf.apply(null,arguments)});var real____divdi3=asm["___divdi3"];asm["___divdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____divdi3.apply(null,arguments)});var real__TALER_amount_ntoh=asm["_TALER_amount_ntoh"];asm["_TALER_amount_ntoh"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_ntoh.apply(null,arguments)});var real_getTempRet0=asm["getTempRet0"];asm["getTempRet0"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real_getTempRet0.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_public_key_free=asm["_GNUNET_CRYPTO_rsa_public_key_free"];asm["_GNUNET_CRYPTO_rsa_public_key_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_public_key_free.apply(null,arguments)});var real__GNUNET_CRYPTO_hkdf=asm["_GNUNET_CRYPTO_hkdf"];asm["_GNUNET_CRYPTO_hkdf"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hkdf.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_key_get_public=asm["_GNUNET_CRYPTO_eddsa_key_get_public"];asm["_GNUNET_CRYPTO_eddsa_key_get_public"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_key_get_public.apply(null,arguments)});var real__llvm_bswap_i32=asm["_llvm_bswap_i32"];asm["_llvm_bswap_i32"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__llvm_bswap_i32.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_create=asm["_GNUNET_CRYPTO_rsa_private_key_create"];asm["_GNUNET_CRYPTO_rsa_private_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_create.apply(null,arguments)});var real__TALER_gcrypt_init=asm["_TALER_gcrypt_init"];asm["_TALER_gcrypt_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_gcrypt_init.apply(null,arguments)});var real_establishStackSpace=asm["establishStackSpace"];asm["establishStackSpace"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real_establishStackSpace.apply(null,arguments)});var real__pthread_mutex_lock=asm["_pthread_mutex_lock"];asm["_pthread_mutex_lock"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__pthread_mutex_lock.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_public_key_decode=asm["_GNUNET_CRYPTO_rsa_public_key_decode"];asm["_GNUNET_CRYPTO_rsa_public_key_decode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_public_key_decode.apply(null,arguments)});var real__TALER_WRALL_ecdsa_public_key_from_private=asm["_TALER_WRALL_ecdsa_public_key_from_private"];asm["_TALER_WRALL_ecdsa_public_key_from_private"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_ecdsa_public_key_from_private.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_signature_encode=asm["_GNUNET_CRYPTO_rsa_signature_encode"];asm["_GNUNET_CRYPTO_rsa_signature_encode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_signature_encode.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_verify=asm["_GNUNET_CRYPTO_rsa_verify"];asm["_GNUNET_CRYPTO_rsa_verify"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_verify.apply(null,arguments)});var real__GNUNET_STRINGS_string_to_data=asm["_GNUNET_STRINGS_string_to_data"];asm["_GNUNET_STRINGS_string_to_data"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_STRINGS_string_to_data.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_finish=asm["_GNUNET_CRYPTO_hash_context_finish"];asm["_GNUNET_CRYPTO_hash_context_finish"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_finish.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_unblind=asm["_GNUNET_CRYPTO_rsa_unblind"];asm["_GNUNET_CRYPTO_rsa_unblind"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_unblind.apply(null,arguments)});var real__TALER_WR_get_currency=asm["_TALER_WR_get_currency"];asm["_TALER_WR_get_currency"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WR_get_currency.apply(null,arguments)});var real__GNUNET_CRYPTO_random_block=asm["_GNUNET_CRYPTO_random_block"];asm["_GNUNET_CRYPTO_random_block"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_random_block.apply(null,arguments)});var real__TALER_WRALL_get_amount=asm["_TALER_WRALL_get_amount"];asm["_TALER_WRALL_get_amount"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_get_amount.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_encode=asm["_GNUNET_CRYPTO_rsa_private_key_encode"];asm["_GNUNET_CRYPTO_rsa_private_key_encode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_encode.apply(null,arguments)});var real__GNUNET_CRYPTO_symmetric_decrypt=asm["_GNUNET_CRYPTO_symmetric_decrypt"];asm["_GNUNET_CRYPTO_symmetric_decrypt"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_symmetric_decrypt.apply(null,arguments)});var real__i64Subtract=asm["_i64Subtract"];asm["_i64Subtract"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__i64Subtract.apply(null,arguments)});var real_setTempRet0=asm["setTempRet0"];asm["setTempRet0"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real_setTempRet0.apply(null,arguments)});var real__TALER_WR_get_value=asm["_TALER_WR_get_value"];asm["_TALER_WR_get_value"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WR_get_value.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdhe_key_get_public=asm["_GNUNET_CRYPTO_ecdhe_key_get_public"];asm["_GNUNET_CRYPTO_ecdhe_key_get_public"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdhe_key_get_public.apply(null,arguments)});var real__GNUNET_util_cl_init=asm["_GNUNET_util_cl_init"];asm["_GNUNET_util_cl_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_util_cl_init.apply(null,arguments)});var real____remdi3=asm["___remdi3"];asm["___remdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____remdi3.apply(null,arguments)});var real____muldsi3=asm["___muldsi3"];asm["___muldsi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____muldsi3.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_blind=asm["_GNUNET_CRYPTO_rsa_blind"];asm["_GNUNET_CRYPTO_rsa_blind"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_blind.apply(null,arguments)});var real__GNUNET_STRINGS_data_to_string_alloc=asm["_GNUNET_STRINGS_data_to_string_alloc"];asm["_GNUNET_STRINGS_data_to_string_alloc"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_STRINGS_data_to_string_alloc.apply(null,arguments)});var real__malloc=asm["_malloc"];asm["_malloc"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__malloc.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_signature_decode=asm["_GNUNET_CRYPTO_rsa_signature_decode"];asm["_GNUNET_CRYPTO_rsa_signature_decode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_signature_decode.apply(null,arguments)});var real__TALER_setup_fresh_coin=asm["_TALER_setup_fresh_coin"];asm["_TALER_setup_fresh_coin"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_setup_fresh_coin.apply(null,arguments)});var real__GNUNET_CRYPTO_ecdhe_key_create=asm["_GNUNET_CRYPTO_ecdhe_key_create"];asm["_GNUNET_CRYPTO_ecdhe_key_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecdhe_key_create.apply(null,arguments)});var real____udivdi3=asm["___udivdi3"];asm["___udivdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____udivdi3.apply(null,arguments)});var real__TALER_amount_normalize=asm["_TALER_amount_normalize"];asm["_TALER_amount_normalize"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_normalize.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_read=asm["_GNUNET_CRYPTO_hash_context_read"];asm["_GNUNET_CRYPTO_hash_context_read"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_read.apply(null,arguments)});var real__bitshift64Shl=asm["_bitshift64Shl"];asm["_bitshift64Shl"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__bitshift64Shl.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_private_key_free=asm["_GNUNET_CRYPTO_rsa_private_key_free"];asm["_GNUNET_CRYPTO_rsa_private_key_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_private_key_free.apply(null,arguments)});var real__fflush=asm["_fflush"];asm["_fflush"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__fflush.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_create_random=asm["_GNUNET_CRYPTO_hash_create_random"];asm["_GNUNET_CRYPTO_hash_create_random"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_create_random.apply(null,arguments)});var real__TALER_WRALL_eddsa_public_key_from_private=asm["_TALER_WRALL_eddsa_public_key_from_private"];asm["_TALER_WRALL_eddsa_public_key_from_private"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_eddsa_public_key_from_private.apply(null,arguments)});var real____muldi3=asm["___muldi3"];asm["___muldi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____muldi3.apply(null,arguments)});var real__GNUNET_CRYPTO_ecc_ecdh=asm["_GNUNET_CRYPTO_ecc_ecdh"];asm["_GNUNET_CRYPTO_ecc_ecdh"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_ecc_ecdh.apply(null,arguments)});var real__TALER_amount_add=asm["_TALER_amount_add"];asm["_TALER_amount_add"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_add.apply(null,arguments)});var real____uremdi3=asm["___uremdi3"];asm["___uremdi3"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____uremdi3.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_signature_free=asm["_GNUNET_CRYPTO_rsa_signature_free"];asm["_GNUNET_CRYPTO_rsa_signature_free"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_signature_free.apply(null,arguments)});var real__TALER_amount_subtract=asm["_TALER_amount_subtract"];asm["_TALER_amount_subtract"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_subtract.apply(null,arguments)});var real__i64Add=asm["_i64Add"];asm["_i64Add"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__i64Add.apply(null,arguments)});var real__TALER_WRALL_purpose_create=asm["_TALER_WRALL_purpose_create"];asm["_TALER_WRALL_purpose_create"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_purpose_create.apply(null,arguments)});var real__pthread_mutex_unlock=asm["_pthread_mutex_unlock"];asm["_pthread_mutex_unlock"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__pthread_mutex_unlock.apply(null,arguments)});var real_stackRestore=asm["stackRestore"];asm["stackRestore"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real_stackRestore.apply(null,arguments)});var real__GNUNET_CRYPTO_eddsa_sign=asm["_GNUNET_CRYPTO_eddsa_sign"];asm["_GNUNET_CRYPTO_eddsa_sign"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_eddsa_sign.apply(null,arguments)});var real____errno_location=asm["___errno_location"];asm["___errno_location"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real____errno_location.apply(null,arguments)});var real__TALER_WRALL_ecdhe_public_key_from_private=asm["_TALER_WRALL_ecdhe_public_key_from_private"];asm["_TALER_WRALL_ecdhe_public_key_from_private"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_WRALL_ecdhe_public_key_from_private.apply(null,arguments)});var real__GNUNET_CRYPTO_hash_context_abort=asm["_GNUNET_CRYPTO_hash_context_abort"];asm["_GNUNET_CRYPTO_hash_context_abort"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash_context_abort.apply(null,arguments)});var real__memmove=asm["_memmove"];asm["_memmove"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__memmove.apply(null,arguments)});var real__GNUNET_CRYPTO_random_init=asm["_GNUNET_CRYPTO_random_init"];asm["_GNUNET_CRYPTO_random_init"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_random_init.apply(null,arguments)});var real__TALER_amount_get_zero=asm["_TALER_amount_get_zero"];asm["_TALER_amount_get_zero"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__TALER_amount_get_zero.apply(null,arguments)});var real__GNUNET_CRYPTO_rsa_public_key_encode=asm["_GNUNET_CRYPTO_rsa_public_key_encode"];asm["_GNUNET_CRYPTO_rsa_public_key_encode"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_rsa_public_key_encode.apply(null,arguments)});var real__GNUNET_CRYPTO_hash=asm["_GNUNET_CRYPTO_hash"];asm["_GNUNET_CRYPTO_hash"]=(function(){assert(runtimeInitialized,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)");assert(!runtimeExited,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");return real__GNUNET_CRYPTO_hash.apply(null,arguments)});var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var _GNUNET_CRYPTO_eddsa_key_create=Module["_GNUNET_CRYPTO_eddsa_key_create"]=asm["_GNUNET_CRYPTO_eddsa_key_create"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _GNUNET_CRYPTO_rsa_private_key_decode=Module["_GNUNET_CRYPTO_rsa_private_key_decode"]=asm["_GNUNET_CRYPTO_rsa_private_key_decode"];var ___udivmoddi4=Module["___udivmoddi4"]=asm["___udivmoddi4"];var _GNUNET_CRYPTO_ecdh_eddsa=Module["_GNUNET_CRYPTO_ecdh_eddsa"]=asm["_GNUNET_CRYPTO_ecdh_eddsa"];var _emscripten_get_global_libc=Module["_emscripten_get_global_libc"]=asm["_emscripten_get_global_libc"];var _TALER_amount_hton=Module["_TALER_amount_hton"]=asm["_TALER_amount_hton"];var stackSave=Module["stackSave"]=asm["stackSave"];var _gpg_err_init=Module["_gpg_err_init"]=asm["_gpg_err_init"];var _free=Module["_free"]=asm["_free"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var _memalign=Module["_memalign"]=asm["_memalign"];var _GNUNET_CRYPTO_ecdsa_key_create=Module["_GNUNET_CRYPTO_ecdsa_key_create"]=asm["_GNUNET_CRYPTO_ecdsa_key_create"];var _GNUNET_CRYPTO_hash_context_start=Module["_GNUNET_CRYPTO_hash_context_start"]=asm["_GNUNET_CRYPTO_hash_context_start"];var _GNUNET_CRYPTO_rsa_private_key_get_public=Module["_GNUNET_CRYPTO_rsa_private_key_get_public"]=asm["_GNUNET_CRYPTO_rsa_private_key_get_public"];var _GNUNET_CRYPTO_eddsa_verify=Module["_GNUNET_CRYPTO_eddsa_verify"]=asm["_GNUNET_CRYPTO_eddsa_verify"];var setThrew=Module["setThrew"]=asm["setThrew"];var _GNUNET_CRYPTO_symmetric_encrypt=Module["_GNUNET_CRYPTO_symmetric_encrypt"]=asm["_GNUNET_CRYPTO_symmetric_encrypt"];var _TALER_WR_get_fraction=Module["_TALER_WR_get_fraction"]=asm["_TALER_WR_get_fraction"];var _TALER_amount_cmp=Module["_TALER_amount_cmp"]=asm["_TALER_amount_cmp"];var _llvm_cttz_i32=Module["_llvm_cttz_i32"]=asm["_llvm_cttz_i32"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var _GNUNET_CRYPTO_kdf=Module["_GNUNET_CRYPTO_kdf"]=asm["_GNUNET_CRYPTO_kdf"];var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var _TALER_amount_ntoh=Module["_TALER_amount_ntoh"]=asm["_TALER_amount_ntoh"];var getTempRet0=Module["getTempRet0"]=asm["getTempRet0"];var _GNUNET_CRYPTO_rsa_public_key_free=Module["_GNUNET_CRYPTO_rsa_public_key_free"]=asm["_GNUNET_CRYPTO_rsa_public_key_free"];var _GNUNET_CRYPTO_hkdf=Module["_GNUNET_CRYPTO_hkdf"]=asm["_GNUNET_CRYPTO_hkdf"];var _GNUNET_CRYPTO_eddsa_key_get_public=Module["_GNUNET_CRYPTO_eddsa_key_get_public"]=asm["_GNUNET_CRYPTO_eddsa_key_get_public"];var _llvm_bswap_i32=Module["_llvm_bswap_i32"]=asm["_llvm_bswap_i32"];var _GNUNET_CRYPTO_rsa_private_key_create=Module["_GNUNET_CRYPTO_rsa_private_key_create"]=asm["_GNUNET_CRYPTO_rsa_private_key_create"];var _TALER_gcrypt_init=Module["_TALER_gcrypt_init"]=asm["_TALER_gcrypt_init"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var _pthread_mutex_lock=Module["_pthread_mutex_lock"]=asm["_pthread_mutex_lock"];var _GNUNET_CRYPTO_rsa_public_key_decode=Module["_GNUNET_CRYPTO_rsa_public_key_decode"]=asm["_GNUNET_CRYPTO_rsa_public_key_decode"];var _TALER_WRALL_ecdsa_public_key_from_private=Module["_TALER_WRALL_ecdsa_public_key_from_private"]=asm["_TALER_WRALL_ecdsa_public_key_from_private"];var _GNUNET_CRYPTO_rsa_signature_encode=Module["_GNUNET_CRYPTO_rsa_signature_encode"]=asm["_GNUNET_CRYPTO_rsa_signature_encode"];var _GNUNET_CRYPTO_rsa_verify=Module["_GNUNET_CRYPTO_rsa_verify"]=asm["_GNUNET_CRYPTO_rsa_verify"];var _GNUNET_STRINGS_string_to_data=Module["_GNUNET_STRINGS_string_to_data"]=asm["_GNUNET_STRINGS_string_to_data"];var _memset=Module["_memset"]=asm["_memset"];var _GNUNET_CRYPTO_hash_context_finish=Module["_GNUNET_CRYPTO_hash_context_finish"]=asm["_GNUNET_CRYPTO_hash_context_finish"];var _GNUNET_CRYPTO_rsa_unblind=Module["_GNUNET_CRYPTO_rsa_unblind"]=asm["_GNUNET_CRYPTO_rsa_unblind"];var _TALER_WR_get_currency=Module["_TALER_WR_get_currency"]=asm["_TALER_WR_get_currency"];var _GNUNET_CRYPTO_random_block=Module["_GNUNET_CRYPTO_random_block"]=asm["_GNUNET_CRYPTO_random_block"];var _TALER_WRALL_get_amount=Module["_TALER_WRALL_get_amount"]=asm["_TALER_WRALL_get_amount"];var _GNUNET_CRYPTO_rsa_private_key_encode=Module["_GNUNET_CRYPTO_rsa_private_key_encode"]=asm["_GNUNET_CRYPTO_rsa_private_key_encode"];var _GNUNET_CRYPTO_symmetric_decrypt=Module["_GNUNET_CRYPTO_symmetric_decrypt"]=asm["_GNUNET_CRYPTO_symmetric_decrypt"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var setTempRet0=Module["setTempRet0"]=asm["setTempRet0"];var _TALER_WR_get_value=Module["_TALER_WR_get_value"]=asm["_TALER_WR_get_value"];var _GNUNET_CRYPTO_ecdhe_key_get_public=Module["_GNUNET_CRYPTO_ecdhe_key_get_public"]=asm["_GNUNET_CRYPTO_ecdhe_key_get_public"];var _GNUNET_util_cl_init=Module["_GNUNET_util_cl_init"]=asm["_GNUNET_util_cl_init"];var ___remdi3=Module["___remdi3"]=asm["___remdi3"];var ___muldsi3=Module["___muldsi3"]=asm["___muldsi3"];var _GNUNET_CRYPTO_rsa_blind=Module["_GNUNET_CRYPTO_rsa_blind"]=asm["_GNUNET_CRYPTO_rsa_blind"];var _GNUNET_STRINGS_data_to_string_alloc=Module["_GNUNET_STRINGS_data_to_string_alloc"]=asm["_GNUNET_STRINGS_data_to_string_alloc"];var _malloc=Module["_malloc"]=asm["_malloc"];var _GNUNET_CRYPTO_rsa_signature_decode=Module["_GNUNET_CRYPTO_rsa_signature_decode"]=asm["_GNUNET_CRYPTO_rsa_signature_decode"];var _TALER_setup_fresh_coin=Module["_TALER_setup_fresh_coin"]=asm["_TALER_setup_fresh_coin"];var _GNUNET_CRYPTO_ecdhe_key_create=Module["_GNUNET_CRYPTO_ecdhe_key_create"]=asm["_GNUNET_CRYPTO_ecdhe_key_create"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var _TALER_amount_normalize=Module["_TALER_amount_normalize"]=asm["_TALER_amount_normalize"];var _GNUNET_CRYPTO_hash_context_read=Module["_GNUNET_CRYPTO_hash_context_read"]=asm["_GNUNET_CRYPTO_hash_context_read"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _GNUNET_CRYPTO_rsa_private_key_free=Module["_GNUNET_CRYPTO_rsa_private_key_free"]=asm["_GNUNET_CRYPTO_rsa_private_key_free"];var _fflush=Module["_fflush"]=asm["_fflush"];var _GNUNET_CRYPTO_hash_create_random=Module["_GNUNET_CRYPTO_hash_create_random"]=asm["_GNUNET_CRYPTO_hash_create_random"];var _TALER_WRALL_eddsa_public_key_from_private=Module["_TALER_WRALL_eddsa_public_key_from_private"]=asm["_TALER_WRALL_eddsa_public_key_from_private"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var _GNUNET_CRYPTO_ecc_ecdh=Module["_GNUNET_CRYPTO_ecc_ecdh"]=asm["_GNUNET_CRYPTO_ecc_ecdh"];var _TALER_amount_add=Module["_TALER_amount_add"]=asm["_TALER_amount_add"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var _GNUNET_CRYPTO_rsa_signature_free=Module["_GNUNET_CRYPTO_rsa_signature_free"]=asm["_GNUNET_CRYPTO_rsa_signature_free"];var _TALER_amount_subtract=Module["_TALER_amount_subtract"]=asm["_TALER_amount_subtract"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _TALER_WRALL_purpose_create=Module["_TALER_WRALL_purpose_create"]=asm["_TALER_WRALL_purpose_create"];var _pthread_mutex_unlock=Module["_pthread_mutex_unlock"]=asm["_pthread_mutex_unlock"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var _GNUNET_CRYPTO_eddsa_sign=Module["_GNUNET_CRYPTO_eddsa_sign"]=asm["_GNUNET_CRYPTO_eddsa_sign"];var ___errno_location=Module["___errno_location"]=asm["___errno_location"];var _TALER_WRALL_ecdhe_public_key_from_private=Module["_TALER_WRALL_ecdhe_public_key_from_private"]=asm["_TALER_WRALL_ecdhe_public_key_from_private"];var _GNUNET_CRYPTO_hash_context_abort=Module["_GNUNET_CRYPTO_hash_context_abort"]=asm["_GNUNET_CRYPTO_hash_context_abort"];var _memmove=Module["_memmove"]=asm["_memmove"];var _GNUNET_CRYPTO_random_init=Module["_GNUNET_CRYPTO_random_init"]=asm["_GNUNET_CRYPTO_random_init"];var _TALER_amount_get_zero=Module["_TALER_amount_get_zero"]=asm["_TALER_amount_get_zero"];var _GNUNET_CRYPTO_rsa_public_key_encode=Module["_GNUNET_CRYPTO_rsa_public_key_encode"]=asm["_GNUNET_CRYPTO_rsa_public_key_encode"];var _GNUNET_CRYPTO_hash=Module["_GNUNET_CRYPTO_hash"]=asm["_GNUNET_CRYPTO_hash"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];Runtime.stackAlloc=Module["stackAlloc"];Runtime.stackSave=Module["stackSave"];Runtime.stackRestore=Module["stackRestore"];Runtime.establishStackSpace=Module["establishStackSpace"];Runtime.setTempRet0=Module["setTempRet0"];Runtime.getTempRet0=Module["getTempRet0"];Module["asm"]=asm;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){assert(runDependencies==0,"cannot call main when async dependencies remain! (listen on __ATMAIN__)");assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){Module.printErr("run() called, but dependencies remain, so not running");return}writeStackCookie();preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(ENVIRONMENT_IS_WEB&&preloadStartTime!==null){Module.printErr("pre-main prep time: "+(Date.now()-preloadStartTime)+" ms")}if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}checkStackCookie()}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){Module.printErr("exit("+status+") implicitly called by end of main(), but noExitRuntime, so not exiting the runtime (you can use emscripten_force_exit, if you want to force a true shutdown)");return}if(Module["noExitRuntime"]){Module.printErr("exit("+status+") called, but noExitRuntime, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)")}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}else if(ENVIRONMENT_IS_SHELL&&typeof quit==="function"){quit(status)}throw new ExitStatus(status)}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach((function(decorator){output=decorator(output,what)}))}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"]){shouldRunNow=false}run() diff --git a/src/emscriptif-test.ts b/src/emscriptif-test.ts index cd99d0ed1..8b7a9eff4 100644 --- a/src/emscriptif-test.ts +++ b/src/emscriptif-test.ts @@ -1,4 +1,4 @@ -import {test, TestLib} from "testlib/talertest"; +import {test, TestLib} from "talertest"; import * as native from "./emscriptif"; test("string hashing", (t: TestLib) => { diff --git a/src/emscriptif.ts b/src/emscriptif.ts index aeb645c70..0b3f2ae71 100644 --- a/src/emscriptif.ts +++ b/src/emscriptif.ts @@ -15,7 +15,7 @@ */ import {AmountJson} from "./types"; -import Module, {EmscFunGen} from "src/emscripten/taler-emscripten-lib"; +import * as emscLib from "./emscripten/taler-emscripten-lib"; /** * Medium-level interface to emscripten-compiled modules used @@ -40,9 +40,9 @@ const GNUNET_SYSERR = -1; /** * Get an emscripten-compiled function. */ -const getEmsc: EmscFunGen = (name: string, ret: any, argTypes: any[]) => { +const getEmsc: emscLib.EmscFunGen = (name: string, ret: any, argTypes: any[]) => { return (...args: any[]) => { - return Module.ccall(name, ret, argTypes, args); + return emscLib.ccall(name, ret, argTypes, args); } }; @@ -51,7 +51,7 @@ const getEmsc: EmscFunGen = (name: string, ret: any, argTypes: any[]) => { * Wrapped emscripten functions that do not allocate any memory. */ const emsc = { - free: (ptr: number) => Module._free(ptr), + free: (ptr: number) => emscLib._free(ptr), get_value: getEmsc("TALER_WR_get_value", "number", ["number"]), @@ -193,7 +193,7 @@ const emscAlloc = { hash_context_start: getEmsc("GNUNET_CRYPTO_hash_context_start", "number", []), - malloc: (size: number) => Module._malloc(size), + malloc: (size: number) => emscLib._malloc(size), }; @@ -530,7 +530,7 @@ abstract class PackedArenaObject extends MallocArenaObject { toCrock(): string { var d = emscAlloc.data_to_string_alloc(this.nativePtr, this.size()); - var s = Module.Pointer_stringify(d); + var s = emscLib.Pointer_stringify(d); emsc.free(d); return s; } @@ -574,7 +574,7 @@ abstract class PackedArenaObject extends MallocArenaObject { hexdump() { let bytes: string[] = []; for (let i = 0; i < this.size(); i++) { - let b = Module.getValue(this.nativePtr + i, "i8"); + let b = emscLib.getValue(this.nativePtr + i, "i8"); b = (b + 256) % 256; bytes.push("0".concat(b.toString(16)).slice(-2)); } @@ -637,7 +637,7 @@ function encode(obj: T, encodeFn: any, arena?: Aren let ptr = emscAlloc.malloc(PTR_SIZE); let len = encodeFn(obj.nativePtr, ptr); let res = new ByteArray(len, undefined, arena); - res.nativePtr = Module.getValue(ptr, '*'); + res.nativePtr = emscLib.getValue(ptr, '*'); emsc.free(ptr); return res; } @@ -812,7 +812,7 @@ export class ByteArray extends PackedArenaObject { // UTF-8 bytes, including 0-terminator let terminatedByteLength = countUtf8Bytes(s) + 1; let hstr = emscAlloc.malloc(terminatedByteLength); - Module.stringToUTF8(s, hstr, terminatedByteLength); + emscLib.stringToUTF8(s, hstr, terminatedByteLength); return new ByteArray(terminatedByteLength - 1, hstr, a); } @@ -820,7 +820,7 @@ export class ByteArray extends PackedArenaObject { // UTF-8 bytes, including 0-terminator let terminatedByteLength = countUtf8Bytes(s) + 1; let hstr = emscAlloc.malloc(terminatedByteLength); - Module.stringToUTF8(s, hstr, terminatedByteLength); + emscLib.stringToUTF8(s, hstr, terminatedByteLength); return new ByteArray(terminatedByteLength, hstr, a); } @@ -829,7 +829,7 @@ export class ByteArray extends PackedArenaObject { // since we don't have a fixed size let byteLength = countUtf8Bytes(s); let hstr = emscAlloc.malloc(byteLength + 1); - Module.stringToUTF8(s, hstr, byteLength + 1); + emscLib.stringToUTF8(s, hstr, byteLength + 1); let decodedLen = Math.floor((byteLength * 5) / 8); let ba = new ByteArray(decodedLen, undefined, a); let res = emsc.string_to_data(hstr, byteLength, ba.nativePtr, decodedLen); @@ -1016,7 +1016,7 @@ export class AbsoluteTimeNbo extends PackedArenaObject { // XXX: This only works up to 54 bit numbers. function set64(p: number, n: number) { for (let i = 0; i < 8; ++i) { - Module.setValue(p + (7 - i), n & 0xFF, "i8"); + emscLib.setValue(p + (7 - i), n & 0xFF, "i8"); n = Math.floor(n / 256); } } @@ -1024,7 +1024,7 @@ function set64(p: number, n: number) { // XXX: This only works up to 54 bit numbers. function set32(p: number, n: number) { for (let i = 0; i < 4; ++i) { - Module.setValue(p + (3 - i), n & 0xFF, "i8"); + emscLib.setValue(p + (3 - i), n & 0xFF, "i8"); n = Math.floor(n / 256); } } @@ -1195,8 +1195,8 @@ export function rsaBlind(hashCode: HashCode, pkey.nativePtr, buf_ptr_out, buf_size_out); - let buf_ptr = Module.getValue(buf_ptr_out, '*'); - let buf_size = Module.getValue(buf_size_out, '*'); + let buf_ptr = emscLib.getValue(buf_ptr_out, '*'); + let buf_size = emscLib.getValue(buf_size_out, '*'); emsc.free(buf_ptr_out); emsc.free(buf_size_out); if (res != GNUNET_OK) { diff --git a/src/helpers-test.ts b/src/helpers-test.ts index 4aac5ebec..d252e9720 100644 --- a/src/helpers-test.ts +++ b/src/helpers-test.ts @@ -1,4 +1,4 @@ -import {test, TestLib} from "testlib/talertest"; +import {test, TestLib} from "talertest"; import * as helpers from "./helpers"; diff --git a/src/helpers.ts b/src/helpers.ts index d9b62aa22..7b9470271 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -21,10 +21,8 @@ * @author Florian Dold */ -/// - import {AmountJson, Amounts} from "./types"; -import URI = uri.URI; +import URI = require("urijs"); export function substituteFulfillmentUrl(url: string, vars: any) { url = url.replace("${H_contract}", vars.H_contract); @@ -45,7 +43,7 @@ export function amountToPretty(amount: AmountJson): string { * See http://api.taler.net/wallet.html#general */ export function canonicalizeBaseUrl(url: string) { - let x: URI = new URI(url); + let x = new URI(url); if (!x.protocol()) { x.protocol("https"); } diff --git a/src/http.ts b/src/http.ts index 1d22c4eb2..5e6580016 100644 --- a/src/http.ts +++ b/src/http.ts @@ -22,7 +22,6 @@ "use strict"; - export interface HttpResponse { status: number; responseText: string; @@ -31,31 +30,24 @@ export interface HttpResponse { export interface HttpRequestLibrary { req(method: string, - url: string | uri.URI, + url: string, options?: any): Promise; - get(url: string | uri.URI): Promise; + get(url: string): Promise; - postJson(url: string | uri.URI, body: any): Promise; + postJson(url: string, body: any): Promise; - postForm(url: string | uri.URI, form: any): Promise; + postForm(url: string, form: any): Promise; } export class BrowserHttpLib { req(method: string, - url: string|uri.URI, + url: string, options?: any): Promise { - let urlString: string; - if (url instanceof URI) { - urlString = url.href(); - } else if (typeof url === "string") { - urlString = url; - } - - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { let myRequest = new XMLHttpRequest(); - myRequest.open(method, urlString); + myRequest.open(method, url); if (options && options.req) { myRequest.send(options.req); } else { @@ -74,17 +66,17 @@ export class BrowserHttpLib { } - get(url: string|uri.URI) { + get(url: string) { return this.req("get", url); } - postJson(url: string|uri.URI, body: any) { + postJson(url: string, body: any) { return this.req("post", url, {req: JSON.stringify(body)}); } - postForm(url: string|uri.URI, form: any) { + postForm(url: string, form: any) { return this.req("post", url, {req: form}); } } diff --git a/src/i18n.tsx b/src/i18n.tsx index d03fd52ef..dcc678900 100644 --- a/src/i18n.tsx +++ b/src/i18n.tsx @@ -16,10 +16,12 @@ "use strict"; -import {default as Jed} from "src/vendor/jed"; -import {strings} from "src/i18n/strings"; +import * as jedLib from "jed"; +import {strings} from "./i18n/strings"; -console.log("jed:", Jed); +import * as React from "react"; + +console.log("jed:", jedLib); /** * Information about the last two i18n results, used by plural() @@ -35,7 +37,7 @@ try { console.warn("i18n default language not available"); } -let jed = new Jed(strings[lang]); +let jed = new jedLib.Jed(strings[lang]); class PluralNumber { diff --git a/src/logging.ts b/src/logging.ts index 788a7df55..d5d6debf4 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -198,7 +198,7 @@ const loggingDbVersion = 1; const logsStore: Store = new Store("logs"); export function openLoggingDb(): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const req = indexedDB.open("taler-logging", loggingDbVersion); req.onerror = (e) => { reject(e); diff --git a/src/moduleTrampoline.ts b/src/moduleTrampoline.ts deleted file mode 100644 index acbf2afcf..000000000 --- a/src/moduleTrampoline.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - This file is part of TALER - (C) 2016 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see - */ - - -/** - * Boilerplate to initialize the module system and call main() - * - * @author Florian Dold - */ - -"use strict"; - -if (typeof System === "undefined") { - throw Error("system loader not present (must be included before the" + - " trampoline"); -} - -System.config({ - defaultJSExtensions: true, - map: { - src: "/src/", - }, -}); - -let me = window.location.protocol - + "//" + window.location.host - + window.location.pathname.replace(/[.]html$/, ".js"); - -let domLoaded = false; - -document.addEventListener("DOMContentLoaded", function(event) { - domLoaded = true; -}); - -function execMain(m: any) { - if (m.main) { - console.log("executing module main"); - let res = m.main(); - } else { - console.warn("module does not export a main() function"); - } -} - -console.log("loading", me); - -System.import("src/logging").then((logging) => { - window.onerror = (m, source, lineno, colno, error) => { - logging.record("error", m + error, source || "(unknown)", undefined, lineno || 0, colno || 0); - }; - window.addEventListener('unhandledrejection', (evt: any) => { - logging.recordException("unhandled promise rejection", evt.reason); - }); - System.import(me).then((m) => { - if (domLoaded) { - execMain(m); - return; - } - document.addEventListener("DOMContentLoaded", function(event) { - execMain(m); - }); - }); -}) -.catch((e) => { - console.log("trampoline failed"); - console.error(e.stack); -}); - diff --git a/src/pages/add-auditor.html b/src/pages/add-auditor.html index 7966e211f..dce391ff4 100644 --- a/src/pages/add-auditor.html +++ b/src/pages/add-auditor.html @@ -2,39 +2,37 @@ - Taler Wallet: Add Auditor - - - - - - - - - - - - - - - - - - - -

- + + + Taler Wallet: Add Auditor + + + + + + + + + + + + + + + +
+ diff --git a/src/pages/add-auditor.tsx b/src/pages/add-auditor.tsx index 3ec21f509..db283eade 100644 --- a/src/pages/add-auditor.tsx +++ b/src/pages/add-auditor.tsx @@ -21,15 +21,27 @@ */ -import { ExchangeRecord, DenominationRecord } from "src/types"; -import { AuditorRecord, CurrencyRecord, ReserveRecord, CoinRecord, PreCoinRecord, Denomination } from "src/types"; -import { ImplicitStateComponent, StateHolder } from "src/components"; +import { + ExchangeRecord, + DenominationRecord, + AuditorRecord, + CurrencyRecord, + ReserveRecord, + CoinRecord, + PreCoinRecord, + Denomination +} from "../types"; +import { ImplicitStateComponent, StateHolder } from "../components"; import { getCurrencies, updateCurrency, -} from "src/wxApi"; -import { prettyAmount } from "src/renderHtml"; -import { getTalerStampDate } from "src/helpers"; +} from "../wxApi"; +import { prettyAmount } from "../renderHtml"; +import { getTalerStampDate } from "../helpers"; + +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import URI = require("urijs"); interface ConfirmAuditorProps { url: string; @@ -101,7 +113,7 @@ class ConfirmAuditor extends ImplicitStateComponent { } export function main() { - const walletPageUrl = URI(document.location.href); + const walletPageUrl = new URI(document.location.href); const query: any = JSON.parse((URI.parseQuery(walletPageUrl.query()) as any)["req"]); const url = query.url; const currency: string = query.currency; @@ -110,3 +122,5 @@ export function main() { const args = { url, currency, auditorPub, expirationStamp }; ReactDOM.render(, document.getElementById("container")!); } + +document.addEventListener("DOMContentLoaded", main); diff --git a/src/pages/auditors.html b/src/pages/auditors.html index 0a9740f03..7e01f4e1f 100644 --- a/src/pages/auditors.html +++ b/src/pages/auditors.html @@ -2,36 +2,33 @@ - Taler Wallet: Auditors + + Taler Wallet: Auditors - - + + - + - - - + + - - + - - - -
- + +
+ diff --git a/src/pages/auditors.tsx b/src/pages/auditors.tsx index 7cffec403..4aa922128 100644 --- a/src/pages/auditors.tsx +++ b/src/pages/auditors.tsx @@ -21,15 +21,25 @@ */ -import { ExchangeRecord, DenominationRecord } from "src/types"; -import { AuditorRecord, CurrencyRecord, ReserveRecord, CoinRecord, PreCoinRecord, Denomination } from "src/types"; -import { ImplicitStateComponent, StateHolder } from "src/components"; +import { + ExchangeRecord, + DenominationRecord, + AuditorRecord, + CurrencyRecord, + ReserveRecord, + CoinRecord, + PreCoinRecord, + Denomination +} from "../types"; +import { ImplicitStateComponent, StateHolder } from "../components"; import { getCurrencies, updateCurrency, -} from "src/wxApi"; -import { prettyAmount } from "src/renderHtml"; -import { getTalerStampDate } from "src/helpers"; +} from "../wxApi"; +import { prettyAmount } from "../renderHtml"; +import { getTalerStampDate } from "../helpers"; +import * as React from "react"; +import * as ReactDOM from "react-dom"; interface CurrencyListState { currencies?: CurrencyRecord[]; diff --git a/src/pages/confirm-contract.html b/src/pages/confirm-contract.html index c42479c29..52b68e627 100644 --- a/src/pages/confirm-contract.html +++ b/src/pages/confirm-contract.html @@ -2,6 +2,7 @@ + Taler Wallet: Confirm Reserve Creation @@ -9,12 +10,8 @@ - - - - - - + + - - - -
- + +
+ diff --git a/src/pages/logs.tsx b/src/pages/logs.tsx index 15bb3d270..716eebae6 100644 --- a/src/pages/logs.tsx +++ b/src/pages/logs.tsx @@ -20,7 +20,9 @@ * @author Florian Dold */ -import {LogEntry, getLogs} from "src/logging"; +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import {LogEntry, getLogs} from "../logging"; interface LogViewProps { log: LogEntry; diff --git a/src/pages/popup.css b/src/pages/popup.css new file mode 100644 index 000000000..675412c11 --- /dev/null +++ b/src/pages/popup.css @@ -0,0 +1,84 @@ + +/** + * @author Gabor X. Toth + * @author Marcello Stanisci + * @author Florian Dold + */ + +body { + min-height: 20em; + width: 30em; + margin: 0; + padding: 0; + max-height: 800px; + overflow: hidden; +} + +.nav { + background-color: #ddd; + padding: 0.5em 0; +} + +.nav a { + color: black; + padding: 0.5em; + text-decoration: none; +} + +.nav a.active { + background-color: white; + font-weight: bold; +} + + +.container { + overflow-y: scroll; + max-height: 400px; +} + +.abbrev { + text-decoration-style: dotted; +} + +#content { + padding: 1em; +} + + +#wallet-table .amount { + text-align: right; +} + +.hidden { + display: none; +} + +#transactions-table th, +#transactions-table td { + padding: 0.2em 0.5em; +} + +#reserve-create table { + width: 100%; +} + +#reserve-create table td.label { + width: 5em; +} + +#reserve-create table .input input[type="text"] { + width: 100%; +} + +.historyItem { + border: 1px solid black; + border-radius: 10px; + padding-left: 0.5em; + margin: 0.5em; +} + +.historyDate { + font-size: 90%; + margin: 0.3em; + color: slategray; +} diff --git a/src/pages/popup.html b/src/pages/popup.html new file mode 100644 index 000000000..7ff5cffaf --- /dev/null +++ b/src/pages/popup.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + +
+ + + diff --git a/src/pages/popup.tsx b/src/pages/popup.tsx new file mode 100644 index 000000000..c8d52b45c --- /dev/null +++ b/src/pages/popup.tsx @@ -0,0 +1,543 @@ +/* + This file is part of TALER + (C) 2016 GNUnet e.V. + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + */ + + +/** + * Popup shown to the user when they click + * the Taler browser action button. + * + * @author Florian Dold + */ + + +"use strict"; + +import {substituteFulfillmentUrl} from "../helpers"; +import BrowserClickedEvent = chrome.browserAction.BrowserClickedEvent; +import {HistoryRecord, HistoryLevel} from "../wallet"; +import { + AmountJson, WalletBalance, Amounts, + WalletBalanceEntry +} from "../types"; +import {abbrev, prettyAmount} from "../renderHtml"; +import * as i18n from "../i18n"; +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import URI = require("urijs"); + +function onUpdateNotification(f: () => void): () => void { + let port = chrome.runtime.connect({name: "notifications"}); + let listener = (msg: any, port: any) => { + f(); + }; + port.onMessage.addListener(listener); + return () => { + port.onMessage.removeListener(listener); + } +} + + +class Router extends React.Component { + static setRoute(s: string): void { + window.location.hash = s; + } + + static getRoute(): string { + // Omit the '#' at the beginning + return window.location.hash.substring(1); + } + + static onRoute(f: any): () => void { + Router.routeHandlers.push(f); + return () => { + let i = Router.routeHandlers.indexOf(f); + this.routeHandlers = this.routeHandlers.splice(i, 1); + } + } + + static routeHandlers: any[] = []; + + componentWillMount() { + console.log("router mounted"); + window.onhashchange = () => { + this.setState({}); + for (let f of Router.routeHandlers) { + f(); + } + } + } + + componentWillUnmount() { + console.log("router unmounted"); + } + + + render(): JSX.Element { + let route = window.location.hash.substring(1); + console.log("rendering route", route); + let defaultChild: React.ReactChild|null = null; + let foundChild: React.ReactChild|null = null; + React.Children.forEach(this.props.children, (child) => { + let childProps: any = (child as any).props; + if (!childProps) { + return; + } + if (childProps["default"]) { + defaultChild = child; + } + if (childProps["route"] == route) { + foundChild = child; + } + }) + let child: React.ReactChild | null = foundChild || defaultChild; + if (!child) { + throw Error("unknown route"); + } + Router.setRoute((child as any).props["route"]); + return
{child}
; + } +} + + +interface TabProps { + target: string; + children?: React.ReactNode; +} + +function Tab(props: TabProps) { + let cssClass = ""; + if (props.target == Router.getRoute()) { + cssClass = "active"; + } + let onClick = (e: React.MouseEvent) => { + Router.setRoute(props.target); + e.preventDefault(); + }; + return ( +
+ {props.children} + + ); +} + + +class WalletNavBar extends React.Component { + cancelSubscription: any; + + componentWillMount() { + this.cancelSubscription = Router.onRoute(() => { + this.setState({}); + }); + } + + componentWillUnmount() { + if (this.cancelSubscription) { + this.cancelSubscription(); + } + } + + render() { + console.log("rendering nav bar"); + return ( + ); + } +} + + +function ExtensionLink(props: any) { + let onClick = (e: React.MouseEvent) => { + chrome.tabs.create({ + "url": chrome.extension.getURL(props.target) + }); + e.preventDefault(); + }; + return ( + + {props.children} + ) +} + + +export function bigAmount(amount: AmountJson): JSX.Element { + let v = amount.value + amount.fraction / Amounts.fractionalBase; + return ( + + {v} + {" "} + {amount.currency} + + ); +} + +class WalletBalanceView extends React.Component { + balance: WalletBalance; + gotError = false; + canceler: (() => void) | undefined = undefined; + unmount = false; + + componentWillMount() { + this.canceler = onUpdateNotification(() => this.updateBalance()); + this.updateBalance(); + } + + componentWillUnmount() { + console.log("component WalletBalanceView will unmount"); + if (this.canceler) { + this.canceler(); + } + this.unmount = true; + } + + updateBalance() { + chrome.runtime.sendMessage({type: "balances"}, (resp) => { + if (this.unmount) { + return; + } + if (resp.error) { + this.gotError = true; + console.error("could not retrieve balances", resp); + this.setState({}); + return; + } + this.gotError = false; + console.log("got wallet", resp); + this.balance = resp; + this.setState({}); + }); + } + + renderEmpty(): JSX.Element { + let helpLink = ( + + {i18n.str`help`} + + ); + return ( +
+ + You have no balance to show. Need some + {" "}{helpLink}{" "} + getting started? + +
+ ); + } + + formatPending(entry: WalletBalanceEntry): JSX.Element { + let incoming: JSX.Element | undefined; + let payment: JSX.Element | undefined; + + console.log("available: ", entry.pendingIncoming ? prettyAmount(entry.available) : null); + console.log("incoming: ", entry.pendingIncoming ? prettyAmount(entry.pendingIncoming) : null); + + if (Amounts.isNonZero(entry.pendingIncoming)) { + incoming = ( + + + {"+"} + {prettyAmount(entry.pendingIncoming)} + + {" "} + incoming + + ); + } + + if (Amounts.isNonZero(entry.pendingPayment)) { + payment = ( + + + {prettyAmount(entry.pendingPayment)} + + {" "} + being spent + + ); + } + + let l = [incoming, payment].filter((x) => x !== undefined); + if (l.length == 0) { + return ; + } + + if (l.length == 1) { + return ({l}) + } + return ({l[0]}, {l[1]}); + + } + + render(): JSX.Element { + let wallet = this.balance; + if (this.gotError) { + return i18n.str`Error: could not retrieve balance information.`; + } + if (!wallet) { + return ; + } + console.log(wallet); + let listing = Object.keys(wallet).map((key) => { + let entry: WalletBalanceEntry = wallet[key]; + return ( +

+ {bigAmount(entry.available)} + {" "} + {this.formatPending(entry)} +

+ ); + }); + if (listing.length > 0) { + let link = chrome.extension.getURL("/src/pages/auditors.html"); + let linkElem = auditors; + return ( +
+ {listing} + {linkElem} +
+ ); + } + + return this.renderEmpty(); + } +} + + +function formatHistoryItem(historyItem: HistoryRecord) { + const d = historyItem.detail; + const t = historyItem.timestamp; + console.log("hist item", historyItem); + switch (historyItem.type) { + case "create-reserve": + return ( + + Bank requested reserve ({abbrev(d.reservePub)}) for {prettyAmount(d.requestedAmount)}. + + ); + case "confirm-reserve": { + // FIXME: eventually remove compat fix + let exchange = d.exchangeBaseUrl ? (new URI(d.exchangeBaseUrl)).host() : "??"; + let pub = abbrev(d.reservePub); + return ( + + Started to withdraw + {" "}{prettyAmount(d.requestedAmount)}{" "} + from {exchange} ({pub}). + + ); + } + case "offer-contract": { + let link = chrome.extension.getURL("view-contract.html"); + let linkElem = {abbrev(d.contractHash)}; + let merchantElem = {abbrev(d.merchantName, 15)}; + return ( + + Merchant {abbrev(d.merchantName, 15)} offered contract {abbrev(d.contractHash)}; + + ); + } + case "depleted-reserve": { + let exchange = d.exchangeBaseUrl ? (new URI(d.exchangeBaseUrl)).host() : "??"; + let amount = prettyAmount(d.requestedAmount); + let pub = abbrev(d.reservePub); + return ( + + Withdrew {amount} from {exchange} ({pub}). + + ); + } + case "pay": { + let url = substituteFulfillmentUrl(d.fulfillmentUrl, + {H_contract: d.contractHash}); + let merchantElem = {abbrev(d.merchantName, 15)}; + let fulfillmentLinkElem = view product; + return ( + + Paid {prettyAmount(d.amount)} to merchant {merchantElem}. ({fulfillmentLinkElem}) + + ); + } + default: + return (

{i18n.str`Unknown event (${historyItem.type})`}

); + } +} + + +class WalletHistory extends React.Component { + myHistory: any[]; + gotError = false; + unmounted = false; + + componentWillMount() { + this.update(); + onUpdateNotification(() => this.update()); + } + + componentWillUnmount() { + console.log("history component unmounted"); + this.unmounted = true; + } + + update() { + chrome.runtime.sendMessage({type: "get-history"}, (resp) => { + if (this.unmounted) { + return; + } + console.log("got history response"); + if (resp.error) { + this.gotError = true; + console.error("could not retrieve history", resp); + this.setState({}); + return; + } + this.gotError = false; + console.log("got history", resp.history); + this.myHistory = resp.history; + this.setState({}); + }); + } + + render(): JSX.Element { + console.log("rendering history"); + let history: HistoryRecord[] = this.myHistory; + if (this.gotError) { + return i18n.str`Error: could not retrieve event history`; + } + + if (!history) { + // We're not ready yet + return ; + } + + let subjectMemo: {[s: string]: boolean} = {}; + let listing: any[] = []; + for (let record of history.reverse()) { + if (record.subjectId && subjectMemo[record.subjectId]) { + continue; + } + if (record.level != undefined && record.level < HistoryLevel.User) { + continue; + } + subjectMemo[record.subjectId as string] = true; + + let item = ( +
+
+ {(new Date(record.timestamp)).toString()} +
+ {formatHistoryItem(record)} +
+ ); + + listing.push(item); + } + + if (listing.length > 0) { + return
{listing}
; + } + return

{i18n.str`Your wallet has no events recorded.`}

+ } + +} + + +function reload() { + try { + chrome.runtime.reload(); + window.close(); + } catch (e) { + // Functionality missing in firefox, ignore! + } +} + +function confirmReset() { + if (confirm("Do you want to IRREVOCABLY DESTROY everything inside your" + + " wallet and LOSE ALL YOUR COINS?")) { + chrome.runtime.sendMessage({type: "reset"}); + window.close(); + } +} + + +function WalletDebug(props: any) { + return (
+

Debug tools:

+ + + + +
+ + +
); +} + + +function openExtensionPage(page: string) { + return function() { + chrome.tabs.create({ + "url": chrome.extension.getURL(page) + }); + } +} + + +function openTab(page: string) { + return function() { + chrome.tabs.create({ + "url": page + }); + } +} + + +let el = ( +
+ +
+ + + + + +
+
+); + +document.addEventListener("DOMContentLoaded", () => { + ReactDOM.render(el, document.getElementById("content")!); +}) diff --git a/src/pages/show-db.html b/src/pages/show-db.html index 1cf11e4f6..215c726d9 100644 --- a/src/pages/show-db.html +++ b/src/pages/show-db.html @@ -1,12 +1,12 @@ - - + Taler Wallet: Reserve Created - + +

DB Dump

diff --git a/src/pages/tree.html b/src/pages/tree.html index 7ff4295a0..638c1484a 100644 --- a/src/pages/tree.html +++ b/src/pages/tree.html @@ -2,30 +2,27 @@ - Taler Wallet: Tree View + + Taler Wallet: Tree View - - + + - + - - - + + - - + - - - -
- + +
+ diff --git a/src/pages/tree.tsx b/src/pages/tree.tsx index 4909c189b..a465cff59 100644 --- a/src/pages/tree.tsx +++ b/src/pages/tree.tsx @@ -21,15 +21,24 @@ */ -import {ExchangeRecord, DenominationRecord, CoinStatus} from "src/types"; -import { ReserveRecord, CoinRecord, PreCoinRecord, Denomination } from "src/types"; -import { ImplicitStateComponent, StateHolder } from "src/components"; +import { + ExchangeRecord, + DenominationRecord, + CoinStatus, + ReserveRecord, + CoinRecord, + PreCoinRecord, + Denomination, +} from "../types"; +import { ImplicitStateComponent, StateHolder } from "../components"; import { getReserves, getExchanges, getCoins, getPreCoins, refresh, getDenoms -} from "src/wxApi"; -import { prettyAmount } from "src/renderHtml"; -import { getTalerStampDate } from "src/helpers"; +} from "../wxApi"; +import { prettyAmount } from "../renderHtml"; +import { getTalerStampDate } from "../helpers"; +import * as React from "react"; +import * as ReactDOM from "react-dom"; interface ReserveViewProps { reserve: ReserveRecord; @@ -423,3 +432,5 @@ class ExchangesList extends React.Component { export function main() { ReactDOM.render(, document.getElementById("container")!); } + +document.addEventListener("DOMContentLoaded", main); diff --git a/src/popup/popup.css b/src/popup/popup.css deleted file mode 100644 index 675412c11..000000000 --- a/src/popup/popup.css +++ /dev/null @@ -1,84 +0,0 @@ - -/** - * @author Gabor X. Toth - * @author Marcello Stanisci - * @author Florian Dold - */ - -body { - min-height: 20em; - width: 30em; - margin: 0; - padding: 0; - max-height: 800px; - overflow: hidden; -} - -.nav { - background-color: #ddd; - padding: 0.5em 0; -} - -.nav a { - color: black; - padding: 0.5em; - text-decoration: none; -} - -.nav a.active { - background-color: white; - font-weight: bold; -} - - -.container { - overflow-y: scroll; - max-height: 400px; -} - -.abbrev { - text-decoration-style: dotted; -} - -#content { - padding: 1em; -} - - -#wallet-table .amount { - text-align: right; -} - -.hidden { - display: none; -} - -#transactions-table th, -#transactions-table td { - padding: 0.2em 0.5em; -} - -#reserve-create table { - width: 100%; -} - -#reserve-create table td.label { - width: 5em; -} - -#reserve-create table .input input[type="text"] { - width: 100%; -} - -.historyItem { - border: 1px solid black; - border-radius: 10px; - padding-left: 0.5em; - margin: 0.5em; -} - -.historyDate { - font-size: 90%; - margin: 0.3em; - color: slategray; -} diff --git a/src/popup/popup.html b/src/popup/popup.html deleted file mode 100644 index a8b339b05..000000000 --- a/src/popup/popup.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - -
- - - diff --git a/src/popup/popup.tsx b/src/popup/popup.tsx deleted file mode 100644 index 424c38110..000000000 --- a/src/popup/popup.tsx +++ /dev/null @@ -1,540 +0,0 @@ -/* - This file is part of TALER - (C) 2016 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see - */ - - -/** - * Popup shown to the user when they click - * the Taler browser action button. - * - * @author Florian Dold - */ - - -"use strict"; - -import {substituteFulfillmentUrl} from "src/helpers"; -import BrowserClickedEvent = chrome.browserAction.BrowserClickedEvent; -import {HistoryRecord, HistoryLevel} from "src/wallet"; -import { - AmountJson, WalletBalance, Amounts, - WalletBalanceEntry -} from "src/types"; -import {abbrev, prettyAmount} from "src/renderHtml"; -import * as i18n from "src/i18n"; - -function onUpdateNotification(f: () => void): () => void { - let port = chrome.runtime.connect({name: "notifications"}); - let listener = (msg: any, port: any) => { - f(); - }; - port.onMessage.addListener(listener); - return () => { - port.onMessage.removeListener(listener); - } -} - - -class Router extends React.Component { - static setRoute(s: string): void { - window.location.hash = s; - } - - static getRoute(): string { - // Omit the '#' at the beginning - return window.location.hash.substring(1); - } - - static onRoute(f: any): () => void { - Router.routeHandlers.push(f); - return () => { - let i = Router.routeHandlers.indexOf(f); - this.routeHandlers = this.routeHandlers.splice(i, 1); - } - } - - static routeHandlers: any[] = []; - - componentWillMount() { - console.log("router mounted"); - window.onhashchange = () => { - this.setState({}); - for (let f of Router.routeHandlers) { - f(); - } - } - } - - componentWillUnmount() { - console.log("router unmounted"); - } - - - render(): JSX.Element { - let route = window.location.hash.substring(1); - console.log("rendering route", route); - let defaultChild: React.ReactChild|null = null; - let foundChild: React.ReactChild|null = null; - React.Children.forEach(this.props.children, (child) => { - let childProps: any = (child as any).props; - if (!childProps) { - return; - } - if (childProps["default"]) { - defaultChild = child; - } - if (childProps["route"] == route) { - foundChild = child; - } - }) - let child: React.ReactChild | null = foundChild || defaultChild; - if (!child) { - throw Error("unknown route"); - } - Router.setRoute((child as any).props["route"]); - return
{child}
; - } -} - -export function main() { - console.log("popup main"); - - let el = ( -
- -
- - - - - -
-
- ); - - ReactDOM.render(el, document.getElementById("content")!); -} - -interface TabProps { - target: string; - children?: React.ReactNode; -} - -function Tab(props: TabProps) { - let cssClass = ""; - if (props.target == Router.getRoute()) { - cssClass = "active"; - } - let onClick = (e: React.MouseEvent) => { - Router.setRoute(props.target); - e.preventDefault(); - }; - return ( - - {props.children} - - ); -} - - -class WalletNavBar extends React.Component { - cancelSubscription: any; - - componentWillMount() { - this.cancelSubscription = Router.onRoute(() => { - this.setState({}); - }); - } - - componentWillUnmount() { - if (this.cancelSubscription) { - this.cancelSubscription(); - } - } - - render() { - console.log("rendering nav bar"); - return ( - ); - } -} - - -function ExtensionLink(props: any) { - let onClick = (e: React.MouseEvent) => { - chrome.tabs.create({ - "url": chrome.extension.getURL(props.target) - }); - e.preventDefault(); - }; - return ( - - {props.children} - ) -} - - -export function bigAmount(amount: AmountJson): JSX.Element { - let v = amount.value + amount.fraction / Amounts.fractionalBase; - return ( - - {v} - {" "} - {amount.currency} - - ); -} - -class WalletBalanceView extends React.Component { - balance: WalletBalance; - gotError = false; - canceler: (() => void) | undefined = undefined; - unmount = false; - - componentWillMount() { - this.canceler = onUpdateNotification(() => this.updateBalance()); - this.updateBalance(); - } - - componentWillUnmount() { - console.log("component WalletBalanceView will unmount"); - if (this.canceler) { - this.canceler(); - } - this.unmount = true; - } - - updateBalance() { - chrome.runtime.sendMessage({type: "balances"}, (resp) => { - if (this.unmount) { - return; - } - if (resp.error) { - this.gotError = true; - console.error("could not retrieve balances", resp); - this.setState({}); - return; - } - this.gotError = false; - console.log("got wallet", resp); - this.balance = resp; - this.setState({}); - }); - } - - renderEmpty(): JSX.Element { - let helpLink = ( - - {i18n.str`help`} - - ); - return ( -
- - You have no balance to show. Need some - {" "}{helpLink}{" "} - getting started? - -
- ); - } - - formatPending(entry: WalletBalanceEntry): JSX.Element { - let incoming: JSX.Element | undefined; - let payment: JSX.Element | undefined; - - console.log("available: ", entry.pendingIncoming ? prettyAmount(entry.available) : null); - console.log("incoming: ", entry.pendingIncoming ? prettyAmount(entry.pendingIncoming) : null); - - if (Amounts.isNonZero(entry.pendingIncoming)) { - incoming = ( - - - {"+"} - {prettyAmount(entry.pendingIncoming)} - - {" "} - incoming - - ); - } - - if (Amounts.isNonZero(entry.pendingPayment)) { - payment = ( - - - {prettyAmount(entry.pendingPayment)} - - {" "} - being spent - - ); - } - - let l = [incoming, payment].filter((x) => x !== undefined); - if (l.length == 0) { - return ; - } - - if (l.length == 1) { - return ({l}) - } - return ({l[0]}, {l[1]}); - - } - - render(): JSX.Element { - let wallet = this.balance; - if (this.gotError) { - return i18n.str`Error: could not retrieve balance information.`; - } - if (!wallet) { - return ; - } - console.log(wallet); - let listing = Object.keys(wallet).map((key) => { - let entry: WalletBalanceEntry = wallet[key]; - return ( -

- {bigAmount(entry.available)} - {" "} - {this.formatPending(entry)} -

- ); - }); - if (listing.length > 0) { - let link = chrome.extension.getURL("/src/pages/auditors.html"); - let linkElem = auditors; - return ( -
- {listing} - {linkElem} -
- ); - } - - return this.renderEmpty(); - } -} - - -function formatHistoryItem(historyItem: HistoryRecord) { - const d = historyItem.detail; - const t = historyItem.timestamp; - console.log("hist item", historyItem); - switch (historyItem.type) { - case "create-reserve": - return ( - - Bank requested reserve ({abbrev(d.reservePub)}) for {prettyAmount(d.requestedAmount)}. - - ); - case "confirm-reserve": { - // FIXME: eventually remove compat fix - let exchange = d.exchangeBaseUrl ? URI(d.exchangeBaseUrl).host() : "??"; - let pub = abbrev(d.reservePub); - return ( - - Started to withdraw - {" "}{prettyAmount(d.requestedAmount)}{" "} - from {exchange} ({pub}). - - ); - } - case "offer-contract": { - let link = chrome.extension.getURL("view-contract.html"); - let linkElem = {abbrev(d.contractHash)}; - let merchantElem = {abbrev(d.merchantName, 15)}; - return ( - - Merchant {abbrev(d.merchantName, 15)} offered contract {abbrev(d.contractHash)}; - - ); - } - case "depleted-reserve": { - let exchange = d.exchangeBaseUrl ? URI(d.exchangeBaseUrl).host() : "??"; - let amount = prettyAmount(d.requestedAmount); - let pub = abbrev(d.reservePub); - return ( - - Withdrew {amount} from {exchange} ({pub}). - - ); - } - case "pay": { - let url = substituteFulfillmentUrl(d.fulfillmentUrl, - {H_contract: d.contractHash}); - let merchantElem = {abbrev(d.merchantName, 15)}; - let fulfillmentLinkElem = view product; - return ( - - Paid {prettyAmount(d.amount)} to merchant {merchantElem}. ({fulfillmentLinkElem}) - - ); - } - default: - return (

{i18n.str`Unknown event (${historyItem.type})`}

); - } -} - - -class WalletHistory extends React.Component { - myHistory: any[]; - gotError = false; - unmounted = false; - - componentWillMount() { - this.update(); - onUpdateNotification(() => this.update()); - } - - componentWillUnmount() { - console.log("history component unmounted"); - this.unmounted = true; - } - - update() { - chrome.runtime.sendMessage({type: "get-history"}, (resp) => { - if (this.unmounted) { - return; - } - console.log("got history response"); - if (resp.error) { - this.gotError = true; - console.error("could not retrieve history", resp); - this.setState({}); - return; - } - this.gotError = false; - console.log("got history", resp.history); - this.myHistory = resp.history; - this.setState({}); - }); - } - - render(): JSX.Element { - console.log("rendering history"); - let history: HistoryRecord[] = this.myHistory; - if (this.gotError) { - return i18n.str`Error: could not retrieve event history`; - } - - if (!history) { - // We're not ready yet - return ; - } - - let subjectMemo: {[s: string]: boolean} = {}; - let listing: any[] = []; - for (let record of history.reverse()) { - if (record.subjectId && subjectMemo[record.subjectId]) { - continue; - } - if (record.level != undefined && record.level < HistoryLevel.User) { - continue; - } - subjectMemo[record.subjectId as string] = true; - - let item = ( -
-
- {(new Date(record.timestamp)).toString()} -
- {formatHistoryItem(record)} -
- ); - - listing.push(item); - } - - if (listing.length > 0) { - return
{listing}
; - } - return

{i18n.str`Your wallet has no events recorded.`}

- } - -} - - -function reload() { - try { - chrome.runtime.reload(); - window.close(); - } catch (e) { - // Functionality missing in firefox, ignore! - } -} - -function confirmReset() { - if (confirm("Do you want to IRREVOCABLY DESTROY everything inside your" + - " wallet and LOSE ALL YOUR COINS?")) { - chrome.runtime.sendMessage({type: "reset"}); - window.close(); - } -} - - -function WalletDebug(props: any) { - return (
-

Debug tools:

- - - - -
- - -
); -} - - -function openExtensionPage(page: string) { - return function() { - chrome.tabs.create({ - "url": chrome.extension.getURL(page) - }); - } -} - - -function openTab(page: string) { - return function() { - chrome.tabs.create({ - "url": page - }); - } -} diff --git a/src/query.ts b/src/query.ts index 810088169..c593f061e 100644 --- a/src/query.ts +++ b/src/query.ts @@ -103,7 +103,7 @@ abstract class BaseQueryValue implements QueryValue { } cond(f: (x: T) => boolean, onTrue: (r: QueryRoot) => R, onFalse: (r: QueryRoot) => R): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this.subscribeOne((v, tx) => { if (f(v)) { onTrue(new QueryRoot(this.root.db)); @@ -163,7 +163,7 @@ export let AbortTransaction = Symbol("abort_transaction"); * Get an unresolved promise together with its extracted resolve / reject * function. */ -export function openPromise() { +export function openPromise(): any { let resolve: ((value?: T | PromiseLike) => void) | null = null; let reject: ((reason?: any) => void) | null = null; const promise = new Promise((res, rej) => { @@ -208,19 +208,19 @@ abstract class QueryStreamBase implements QueryStream, PromiseLike { indexJoin(index: Index, keyFn: (obj: T) => I): QueryStream> { this.root.addStoreAccess(index.storeName, false); - return new QueryStreamIndexJoin(this, index.storeName, index.indexName, keyFn); + return new QueryStreamIndexJoin(this, index.storeName, index.indexName, keyFn); } indexJoinLeft(index: Index, keyFn: (obj: T) => I): QueryStream> { this.root.addStoreAccess(index.storeName, false); - return new QueryStreamIndexJoinLeft(this, index.storeName, index.indexName, keyFn); + return new QueryStreamIndexJoinLeft(this, index.storeName, index.indexName, keyFn); } keyJoin(store: Store, keyFn: (obj: T) => I): QueryStream> { this.root.addStoreAccess(store.name, false); - return new QueryStreamKeyJoin(this, store.name, keyFn); + return new QueryStreamKeyJoin(this, store.name, keyFn); } filter(f: (x: any) => boolean): QueryStream { @@ -536,7 +536,7 @@ export class QueryRoot implements PromiseLike { this.checkFinished(); this.stores.add(store.name); this.scheduleFinish(); - return new IterQueryStream(this, store.name, {}); + return new IterQueryStream(this, store.name, {}); } count(store: Store): Promise { @@ -583,7 +583,7 @@ export class QueryRoot implements PromiseLike { this.checkFinished(); this.stores.add(index.storeName); this.scheduleFinish(); - return new IterQueryStream(this, index.storeName, { + return new IterQueryStream(this, index.storeName, { only, indexName: index.indexName }); @@ -714,7 +714,7 @@ export class QueryRoot implements PromiseLike { throw Error("key must not be undefined"); } - const {resolve, promise} = openPromise(); + const {resolve, promise} = openPromise(); const doGetIndexed = (tx: IDBTransaction) => { const req = tx.objectStore(index.storeName) diff --git a/src/renderHtml.tsx b/src/renderHtml.tsx index 79e101b17..1e6c5a8e1 100644 --- a/src/renderHtml.tsx +++ b/src/renderHtml.tsx @@ -22,7 +22,8 @@ import {AmountJson, Contract, Amounts} from "./types"; -import * as i18n from "src/i18n"; +import * as i18n from "./i18n"; +import * as React from "react"; export function prettyAmount(amount: AmountJson) { let v = amount.value + amount.fraction / Amounts.fractionalBase; diff --git a/src/types-test.ts b/src/types-test.ts index 7298728ff..32e07bd0f 100644 --- a/src/types-test.ts +++ b/src/types-test.ts @@ -1,4 +1,4 @@ -import {test, TestLib} from "testlib/talertest"; +import {test, TestLib} from "talertest"; import {Amounts} from "./types"; import * as types from "./types"; diff --git a/src/vendor/URI.js b/src/vendor/URI.js deleted file mode 100644 index c041b4304..000000000 --- a/src/vendor/URI.js +++ /dev/null @@ -1,2162 +0,0 @@ -/*! - * URI.js - Mutating URLs - * - * Version: 1.17.0 - * - * Author: Rodney Rehm - * Web: http://medialize.github.io/URI.js/ - * - * Licensed under - * MIT License http://www.opensource.org/licenses/mit-license - * GPL v3 http://opensource.org/licenses/GPL-3.0 - * - */ -(function (root, factory) { - 'use strict'; - // https://github.com/umdjs/umd/blob/master/returnExports.js - if (typeof exports === 'object') { - // Node - module.exports = factory(require('./punycode'), require('./IPv6'), require('./SecondLevelDomains')); - } else if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['./punycode', './IPv6', './SecondLevelDomains'], factory); - } else { - // Browser globals (root is window) - root.URI = factory(root.punycode, root.IPv6, root.SecondLevelDomains, root); - } -}(this, function (punycode, IPv6, SLD, root) { - 'use strict'; - /*global location, escape, unescape */ - // FIXME: v2.0.0 renamce non-camelCase properties to uppercase - /*jshint camelcase: false */ - - // save current URI variable, if any - var _URI = root && root.URI; - - function URI(url, base) { - var _urlSupplied = arguments.length >= 1; - var _baseSupplied = arguments.length >= 2; - - // Allow instantiation without the 'new' keyword - if (!(this instanceof URI)) { - if (_urlSupplied) { - if (_baseSupplied) { - return new URI(url, base); - } - - return new URI(url); - } - - return new URI(); - } - - if (url === undefined) { - if (_urlSupplied) { - throw new TypeError('undefined is not a valid argument for URI'); - } - - if (typeof location !== 'undefined') { - url = location.href + ''; - } else { - url = ''; - } - } - - this.href(url); - - // resolve to base according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#constructor - if (base !== undefined) { - return this.absoluteTo(base); - } - - return this; - } - - URI.version = '1.17.0'; - - var p = URI.prototype; - var hasOwn = Object.prototype.hasOwnProperty; - - function escapeRegEx(string) { - // https://github.com/medialize/URI.js/commit/85ac21783c11f8ccab06106dba9735a31a86924d#commitcomment-821963 - return string.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); - } - - function getType(value) { - // IE8 doesn't return [Object Undefined] but [Object Object] for undefined value - if (value === undefined) { - return 'Undefined'; - } - - return String(Object.prototype.toString.call(value)).slice(8, -1); - } - - function isArray(obj) { - return getType(obj) === 'Array'; - } - - function filterArrayValues(data, value) { - var lookup = {}; - var i, length; - - if (getType(value) === 'RegExp') { - lookup = null; - } else if (isArray(value)) { - for (i = 0, length = value.length; i < length; i++) { - lookup[value[i]] = true; - } - } else { - lookup[value] = true; - } - - for (i = 0, length = data.length; i < length; i++) { - /*jshint laxbreak: true */ - var _match = lookup && lookup[data[i]] !== undefined - || !lookup && value.test(data[i]); - /*jshint laxbreak: false */ - if (_match) { - data.splice(i, 1); - length--; - i--; - } - } - - return data; - } - - function arrayContains(list, value) { - var i, length; - - // value may be string, number, array, regexp - if (isArray(value)) { - // Note: this can be optimized to O(n) (instead of current O(m * n)) - for (i = 0, length = value.length; i < length; i++) { - if (!arrayContains(list, value[i])) { - return false; - } - } - - return true; - } - - var _type = getType(value); - for (i = 0, length = list.length; i < length; i++) { - if (_type === 'RegExp') { - if (typeof list[i] === 'string' && list[i].match(value)) { - return true; - } - } else if (list[i] === value) { - return true; - } - } - - return false; - } - - function arraysEqual(one, two) { - if (!isArray(one) || !isArray(two)) { - return false; - } - - // arrays can't be equal if they have different amount of content - if (one.length !== two.length) { - return false; - } - - one.sort(); - two.sort(); - - for (var i = 0, l = one.length; i < l; i++) { - if (one[i] !== two[i]) { - return false; - } - } - - return true; - } - - function trimSlashes(text) { - var trim_expression = /^\/+|\/+$/g; - return text.replace(trim_expression, ''); - } - - URI._parts = function() { - return { - protocol: null, - username: null, - password: null, - hostname: null, - urn: null, - port: null, - path: null, - query: null, - fragment: null, - // state - duplicateQueryParameters: URI.duplicateQueryParameters, - escapeQuerySpace: URI.escapeQuerySpace - }; - }; - // state: allow duplicate query parameters (a=1&a=1) - URI.duplicateQueryParameters = false; - // state: replaces + with %20 (space in query strings) - URI.escapeQuerySpace = true; - // static properties - URI.protocol_expression = /^[a-z][a-z0-9.+-]*$/i; - URI.idn_expression = /[^a-z0-9\.-]/i; - URI.punycode_expression = /(xn--)/i; - // well, 333.444.555.666 matches, but it sure ain't no IPv4 - do we care? - URI.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; - // credits to Rich Brown - // source: http://forums.intermapper.com/viewtopic.php?p=1096#1096 - // specification: http://www.ietf.org/rfc/rfc4291.txt - URI.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/; - // expression used is "gruber revised" (@gruber v2) determined to be the - // best solution in a regex-golf we did a couple of ages ago at - // * http://mathiasbynens.be/demo/url-regex - // * http://rodneyrehm.de/t/url-regex.html - URI.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“â€â€˜â€™]))/ig; - URI.findUri = { - // valid "scheme://" or "www." - start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi, - // everything up to the next whitespace - end: /[\s\r\n]|$/, - // trim trailing punctuation captured by end RegExp - trim: /[`!()\[\]{};:'".,<>?«»“â€â€žâ€˜â€™]+$/ - }; - // http://www.iana.org/assignments/uri-schemes.html - // http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports - URI.defaultPorts = { - http: '80', - https: '443', - ftp: '21', - gopher: '70', - ws: '80', - wss: '443' - }; - // allowed hostname characters according to RFC 3986 - // ALPHA DIGIT "-" "." "_" "~" "!" "$" "&" "'" "(" ")" "*" "+" "," ";" "=" %encoded - // I've never seen a (non-IDN) hostname other than: ALPHA DIGIT . - - URI.invalid_hostname_characters = /[^a-zA-Z0-9\.-]/; - // map DOM Elements to their URI attribute - URI.domAttributes = { - 'a': 'href', - 'blockquote': 'cite', - 'link': 'href', - 'base': 'href', - 'script': 'src', - 'form': 'action', - 'img': 'src', - 'area': 'href', - 'iframe': 'src', - 'embed': 'src', - 'source': 'src', - 'track': 'src', - 'input': 'src', // but only if type="image" - 'audio': 'src', - 'video': 'src' - }; - URI.getDomAttribute = function(node) { - if (!node || !node.nodeName) { - return undefined; - } - - var nodeName = node.nodeName.toLowerCase(); - // should only expose src for type="image" - if (nodeName === 'input' && node.type !== 'image') { - return undefined; - } - - return URI.domAttributes[nodeName]; - }; - - function escapeForDumbFirefox36(value) { - // https://github.com/medialize/URI.js/issues/91 - return escape(value); - } - - // encoding / decoding according to RFC3986 - function strictEncodeURIComponent(string) { - // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent - return encodeURIComponent(string) - .replace(/[!'()*]/g, escapeForDumbFirefox36) - .replace(/\*/g, '%2A'); - } - URI.encode = strictEncodeURIComponent; - URI.decode = decodeURIComponent; - URI.iso8859 = function() { - URI.encode = escape; - URI.decode = unescape; - }; - URI.unicode = function() { - URI.encode = strictEncodeURIComponent; - URI.decode = decodeURIComponent; - }; - URI.characters = { - pathname: { - encode: { - // RFC3986 2.1: For consistency, URI producers and normalizers should - // use uppercase hexadecimal digits for all percent-encodings. - expression: /%(24|26|2B|2C|3B|3D|3A|40)/ig, - map: { - // -._~!'()* - '%24': '$', - '%26': '&', - '%2B': '+', - '%2C': ',', - '%3B': ';', - '%3D': '=', - '%3A': ':', - '%40': '@' - } - }, - decode: { - expression: /[\/\?#]/g, - map: { - '/': '%2F', - '?': '%3F', - '#': '%23' - } - } - }, - reserved: { - encode: { - // RFC3986 2.1: For consistency, URI producers and normalizers should - // use uppercase hexadecimal digits for all percent-encodings. - expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig, - map: { - // gen-delims - '%3A': ':', - '%2F': '/', - '%3F': '?', - '%23': '#', - '%5B': '[', - '%5D': ']', - '%40': '@', - // sub-delims - '%21': '!', - '%24': '$', - '%26': '&', - '%27': '\'', - '%28': '(', - '%29': ')', - '%2A': '*', - '%2B': '+', - '%2C': ',', - '%3B': ';', - '%3D': '=' - } - } - }, - urnpath: { - // The characters under `encode` are the characters called out by RFC 2141 as being acceptable - // for usage in a URN. RFC2141 also calls out "-", ".", and "_" as acceptable characters, but - // these aren't encoded by encodeURIComponent, so we don't have to call them out here. Also - // note that the colon character is not featured in the encoding map; this is because URI.js - // gives the colons in URNs semantic meaning as the delimiters of path segements, and so it - // should not appear unencoded in a segment itself. - // See also the note above about RFC3986 and capitalalized hex digits. - encode: { - expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig, - map: { - '%21': '!', - '%24': '$', - '%27': '\'', - '%28': '(', - '%29': ')', - '%2A': '*', - '%2B': '+', - '%2C': ',', - '%3B': ';', - '%3D': '=', - '%40': '@' - } - }, - // These characters are the characters called out by RFC2141 as "reserved" characters that - // should never appear in a URN, plus the colon character (see note above). - decode: { - expression: /[\/\?#:]/g, - map: { - '/': '%2F', - '?': '%3F', - '#': '%23', - ':': '%3A' - } - } - } - }; - URI.encodeQuery = function(string, escapeQuerySpace) { - var escaped = URI.encode(string + ''); - if (escapeQuerySpace === undefined) { - escapeQuerySpace = URI.escapeQuerySpace; - } - - return escapeQuerySpace ? escaped.replace(/%20/g, '+') : escaped; - }; - URI.decodeQuery = function(string, escapeQuerySpace) { - string += ''; - if (escapeQuerySpace === undefined) { - escapeQuerySpace = URI.escapeQuerySpace; - } - - try { - return URI.decode(escapeQuerySpace ? string.replace(/\+/g, '%20') : string); - } catch(e) { - // we're not going to mess with weird encodings, - // give up and return the undecoded original string - // see https://github.com/medialize/URI.js/issues/87 - // see https://github.com/medialize/URI.js/issues/92 - return string; - } - }; - // generate encode/decode path functions - var _parts = {'encode':'encode', 'decode':'decode'}; - var _part; - var generateAccessor = function(_group, _part) { - return function(string) { - try { - return URI[_part](string + '').replace(URI.characters[_group][_part].expression, function(c) { - return URI.characters[_group][_part].map[c]; - }); - } catch (e) { - // we're not going to mess with weird encodings, - // give up and return the undecoded original string - // see https://github.com/medialize/URI.js/issues/87 - // see https://github.com/medialize/URI.js/issues/92 - return string; - } - }; - }; - - for (_part in _parts) { - URI[_part + 'PathSegment'] = generateAccessor('pathname', _parts[_part]); - URI[_part + 'UrnPathSegment'] = generateAccessor('urnpath', _parts[_part]); - } - - var generateSegmentedPathFunction = function(_sep, _codingFuncName, _innerCodingFuncName) { - return function(string) { - // Why pass in names of functions, rather than the function objects themselves? The - // definitions of some functions (but in particular, URI.decode) will occasionally change due - // to URI.js having ISO8859 and Unicode modes. Passing in the name and getting it will ensure - // that the functions we use here are "fresh". - var actualCodingFunc; - if (!_innerCodingFuncName) { - actualCodingFunc = URI[_codingFuncName]; - } else { - actualCodingFunc = function(string) { - return URI[_codingFuncName](URI[_innerCodingFuncName](string)); - }; - } - - var segments = (string + '').split(_sep); - - for (var i = 0, length = segments.length; i < length; i++) { - segments[i] = actualCodingFunc(segments[i]); - } - - return segments.join(_sep); - }; - }; - - // This takes place outside the above loop because we don't want, e.g., encodeUrnPath functions. - URI.decodePath = generateSegmentedPathFunction('/', 'decodePathSegment'); - URI.decodeUrnPath = generateSegmentedPathFunction(':', 'decodeUrnPathSegment'); - URI.recodePath = generateSegmentedPathFunction('/', 'encodePathSegment', 'decode'); - URI.recodeUrnPath = generateSegmentedPathFunction(':', 'encodeUrnPathSegment', 'decode'); - - URI.encodeReserved = generateAccessor('reserved', 'encode'); - - URI.parse = function(string, parts) { - var pos; - if (!parts) { - parts = {}; - } - // [protocol"://"[username[":"password]"@"]hostname[":"port]"/"?][path]["?"querystring]["#"fragment] - - // extract fragment - pos = string.indexOf('#'); - if (pos > -1) { - // escaping? - parts.fragment = string.substring(pos + 1) || null; - string = string.substring(0, pos); - } - - // extract query - pos = string.indexOf('?'); - if (pos > -1) { - // escaping? - parts.query = string.substring(pos + 1) || null; - string = string.substring(0, pos); - } - - // extract protocol - if (string.substring(0, 2) === '//') { - // relative-scheme - parts.protocol = null; - string = string.substring(2); - // extract "user:pass@host:port" - string = URI.parseAuthority(string, parts); - } else { - pos = string.indexOf(':'); - if (pos > -1) { - parts.protocol = string.substring(0, pos) || null; - if (parts.protocol && !parts.protocol.match(URI.protocol_expression)) { - // : may be within the path - parts.protocol = undefined; - } else if (string.substring(pos + 1, pos + 3) === '//') { - string = string.substring(pos + 3); - - // extract "user:pass@host:port" - string = URI.parseAuthority(string, parts); - } else { - string = string.substring(pos + 1); - parts.urn = true; - } - } - } - - // what's left must be the path - parts.path = string; - - // and we're done - return parts; - }; - URI.parseHost = function(string, parts) { - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://github.com/joyent/node/blob/386fd24f49b0e9d1a8a076592a404168faeecc34/lib/url.js#L115-L124 - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - // https://github.com/medialize/URI.js/pull/233 - string = string.replace(/\\/g, '/'); - - // extract host:port - var pos = string.indexOf('/'); - var bracketPos; - var t; - - if (pos === -1) { - pos = string.length; - } - - if (string.charAt(0) === '[') { - // IPv6 host - http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-04#section-6 - // I claim most client software breaks on IPv6 anyways. To simplify things, URI only accepts - // IPv6+port in the format [2001:db8::1]:80 (for the time being) - bracketPos = string.indexOf(']'); - parts.hostname = string.substring(1, bracketPos) || null; - parts.port = string.substring(bracketPos + 2, pos) || null; - if (parts.port === '/') { - parts.port = null; - } - } else { - var firstColon = string.indexOf(':'); - var firstSlash = string.indexOf('/'); - var nextColon = string.indexOf(':', firstColon + 1); - if (nextColon !== -1 && (firstSlash === -1 || nextColon < firstSlash)) { - // IPv6 host contains multiple colons - but no port - // this notation is actually not allowed by RFC 3986, but we're a liberal parser - parts.hostname = string.substring(0, pos) || null; - parts.port = null; - } else { - t = string.substring(0, pos).split(':'); - parts.hostname = t[0] || null; - parts.port = t[1] || null; - } - } - - if (parts.hostname && string.substring(pos).charAt(0) !== '/') { - pos++; - string = '/' + string; - } - - return string.substring(pos) || '/'; - }; - URI.parseAuthority = function(string, parts) { - string = URI.parseUserinfo(string, parts); - return URI.parseHost(string, parts); - }; - URI.parseUserinfo = function(string, parts) { - // extract username:password - var firstSlash = string.indexOf('/'); - var pos = string.lastIndexOf('@', firstSlash > -1 ? firstSlash : string.length - 1); - var t; - - // authority@ must come before /path - if (pos > -1 && (firstSlash === -1 || pos < firstSlash)) { - t = string.substring(0, pos).split(':'); - parts.username = t[0] ? URI.decode(t[0]) : null; - t.shift(); - parts.password = t[0] ? URI.decode(t.join(':')) : null; - string = string.substring(pos + 1); - } else { - parts.username = null; - parts.password = null; - } - - return string; - }; - URI.parseQuery = function(string, escapeQuerySpace) { - if (!string) { - return {}; - } - - // throw out the funky business - "?"[name"="value"&"]+ - string = string.replace(/&+/g, '&').replace(/^\?*&*|&+$/g, ''); - - if (!string) { - return {}; - } - - var items = {}; - var splits = string.split('&'); - var length = splits.length; - var v, name, value; - - for (var i = 0; i < length; i++) { - v = splits[i].split('='); - name = URI.decodeQuery(v.shift(), escapeQuerySpace); - // no "=" is null according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#collect-url-parameters - value = v.length ? URI.decodeQuery(v.join('='), escapeQuerySpace) : null; - - if (hasOwn.call(items, name)) { - if (typeof items[name] === 'string' || items[name] === null) { - items[name] = [items[name]]; - } - - items[name].push(value); - } else { - items[name] = value; - } - } - - return items; - }; - - URI.build = function(parts) { - var t = ''; - - if (parts.protocol) { - t += parts.protocol + ':'; - } - - if (!parts.urn && (t || parts.hostname)) { - t += '//'; - } - - t += (URI.buildAuthority(parts) || ''); - - if (typeof parts.path === 'string') { - if (parts.path.charAt(0) !== '/' && typeof parts.hostname === 'string') { - t += '/'; - } - - t += parts.path; - } - - if (typeof parts.query === 'string' && parts.query) { - t += '?' + parts.query; - } - - if (typeof parts.fragment === 'string' && parts.fragment) { - t += '#' + parts.fragment; - } - return t; - }; - URI.buildHost = function(parts) { - var t = ''; - - if (!parts.hostname) { - return ''; - } else if (URI.ip6_expression.test(parts.hostname)) { - t += '[' + parts.hostname + ']'; - } else { - t += parts.hostname; - } - - if (parts.port) { - t += ':' + parts.port; - } - - return t; - }; - URI.buildAuthority = function(parts) { - return URI.buildUserinfo(parts) + URI.buildHost(parts); - }; - URI.buildUserinfo = function(parts) { - var t = ''; - - if (parts.username) { - t += URI.encode(parts.username); - - if (parts.password) { - t += ':' + URI.encode(parts.password); - } - - t += '@'; - } - - return t; - }; - URI.buildQuery = function(data, duplicateQueryParameters, escapeQuerySpace) { - // according to http://tools.ietf.org/html/rfc3986 or http://labs.apache.org/webarch/uri/rfc/rfc3986.html - // being »-._~!$&'()*+,;=:@/?« %HEX and alnum are allowed - // the RFC explicitly states ?/foo being a valid use case, no mention of parameter syntax! - // URI.js treats the query string as being application/x-www-form-urlencoded - // see http://www.w3.org/TR/REC-html40/interact/forms.html#form-content-type - - var t = ''; - var unique, key, i, length; - for (key in data) { - if (hasOwn.call(data, key) && key) { - if (isArray(data[key])) { - unique = {}; - for (i = 0, length = data[key].length; i < length; i++) { - if (data[key][i] !== undefined && unique[data[key][i] + ''] === undefined) { - t += '&' + URI.buildQueryParameter(key, data[key][i], escapeQuerySpace); - if (duplicateQueryParameters !== true) { - unique[data[key][i] + ''] = true; - } - } - } - } else if (data[key] !== undefined) { - t += '&' + URI.buildQueryParameter(key, data[key], escapeQuerySpace); - } - } - } - - return t.substring(1); - }; - URI.buildQueryParameter = function(name, value, escapeQuerySpace) { - // http://www.w3.org/TR/REC-html40/interact/forms.html#form-content-type -- application/x-www-form-urlencoded - // don't append "=" for null values, according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#url-parameter-serialization - return URI.encodeQuery(name, escapeQuerySpace) + (value !== null ? '=' + URI.encodeQuery(value, escapeQuerySpace) : ''); - }; - - URI.addQuery = function(data, name, value) { - if (typeof name === 'object') { - for (var key in name) { - if (hasOwn.call(name, key)) { - URI.addQuery(data, key, name[key]); - } - } - } else if (typeof name === 'string') { - if (data[name] === undefined) { - data[name] = value; - return; - } else if (typeof data[name] === 'string') { - data[name] = [data[name]]; - } - - if (!isArray(value)) { - value = [value]; - } - - data[name] = (data[name] || []).concat(value); - } else { - throw new TypeError('URI.addQuery() accepts an object, string as the name parameter'); - } - }; - URI.removeQuery = function(data, name, value) { - var i, length, key; - - if (isArray(name)) { - for (i = 0, length = name.length; i < length; i++) { - data[name[i]] = undefined; - } - } else if (getType(name) === 'RegExp') { - for (key in data) { - if (name.test(key)) { - data[key] = undefined; - } - } - } else if (typeof name === 'object') { - for (key in name) { - if (hasOwn.call(name, key)) { - URI.removeQuery(data, key, name[key]); - } - } - } else if (typeof name === 'string') { - if (value !== undefined) { - if (getType(value) === 'RegExp') { - if (!isArray(data[name]) && value.test(data[name])) { - data[name] = undefined; - } else { - data[name] = filterArrayValues(data[name], value); - } - } else if (data[name] === String(value) && (!isArray(value) || value.length === 1)) { - data[name] = undefined; - } else if (isArray(data[name])) { - data[name] = filterArrayValues(data[name], value); - } - } else { - data[name] = undefined; - } - } else { - throw new TypeError('URI.removeQuery() accepts an object, string, RegExp as the first parameter'); - } - }; - URI.hasQuery = function(data, name, value, withinArray) { - if (typeof name === 'object') { - for (var key in name) { - if (hasOwn.call(name, key)) { - if (!URI.hasQuery(data, key, name[key])) { - return false; - } - } - } - - return true; - } else if (typeof name !== 'string') { - throw new TypeError('URI.hasQuery() accepts an object, string as the name parameter'); - } - - switch (getType(value)) { - case 'Undefined': - // true if exists (but may be empty) - return name in data; // data[name] !== undefined; - - case 'Boolean': - // true if exists and non-empty - var _booly = Boolean(isArray(data[name]) ? data[name].length : data[name]); - return value === _booly; - - case 'Function': - // allow complex comparison - return !!value(data[name], name, data); - - case 'Array': - if (!isArray(data[name])) { - return false; - } - - var op = withinArray ? arrayContains : arraysEqual; - return op(data[name], value); - - case 'RegExp': - if (!isArray(data[name])) { - return Boolean(data[name] && data[name].match(value)); - } - - if (!withinArray) { - return false; - } - - return arrayContains(data[name], value); - - case 'Number': - value = String(value); - /* falls through */ - case 'String': - if (!isArray(data[name])) { - return data[name] === value; - } - - if (!withinArray) { - return false; - } - - return arrayContains(data[name], value); - - default: - throw new TypeError('URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter'); - } - }; - - - URI.commonPath = function(one, two) { - var length = Math.min(one.length, two.length); - var pos; - - // find first non-matching character - for (pos = 0; pos < length; pos++) { - if (one.charAt(pos) !== two.charAt(pos)) { - pos--; - break; - } - } - - if (pos < 1) { - return one.charAt(0) === two.charAt(0) && one.charAt(0) === '/' ? '/' : ''; - } - - // revert to last / - if (one.charAt(pos) !== '/' || two.charAt(pos) !== '/') { - pos = one.substring(0, pos).lastIndexOf('/'); - } - - return one.substring(0, pos + 1); - }; - - URI.withinString = function(string, callback, options) { - options || (options = {}); - var _start = options.start || URI.findUri.start; - var _end = options.end || URI.findUri.end; - var _trim = options.trim || URI.findUri.trim; - var _attributeOpen = /[a-z0-9-]=["']?$/i; - - _start.lastIndex = 0; - while (true) { - var match = _start.exec(string); - if (!match) { - break; - } - - var start = match.index; - if (options.ignoreHtml) { - // attribut(e=["']?$) - var attributeOpen = string.slice(Math.max(start - 3, 0), start); - if (attributeOpen && _attributeOpen.test(attributeOpen)) { - continue; - } - } - - var end = start + string.slice(start).search(_end); - var slice = string.slice(start, end).replace(_trim, ''); - if (options.ignore && options.ignore.test(slice)) { - continue; - } - - end = start + slice.length; - var result = callback(slice, start, end, string); - string = string.slice(0, start) + result + string.slice(end); - _start.lastIndex = start + result.length; - } - - _start.lastIndex = 0; - return string; - }; - - URI.ensureValidHostname = function(v) { - // Theoretically URIs allow percent-encoding in Hostnames (according to RFC 3986) - // they are not part of DNS and therefore ignored by URI.js - - if (v.match(URI.invalid_hostname_characters)) { - // test punycode - if (!punycode) { - throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-] and Punycode.js is not available'); - } - - if (punycode.toASCII(v).match(URI.invalid_hostname_characters)) { - throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]'); - } - } - }; - - // noConflict - URI.noConflict = function(removeAll) { - if (removeAll) { - var unconflicted = { - URI: this.noConflict() - }; - - if (root.URITemplate && typeof root.URITemplate.noConflict === 'function') { - unconflicted.URITemplate = root.URITemplate.noConflict(); - } - - if (root.IPv6 && typeof root.IPv6.noConflict === 'function') { - unconflicted.IPv6 = root.IPv6.noConflict(); - } - - if (root.SecondLevelDomains && typeof root.SecondLevelDomains.noConflict === 'function') { - unconflicted.SecondLevelDomains = root.SecondLevelDomains.noConflict(); - } - - return unconflicted; - } else if (root.URI === this) { - root.URI = _URI; - } - - return this; - }; - - p.build = function(deferBuild) { - if (deferBuild === true) { - this._deferred_build = true; - } else if (deferBuild === undefined || this._deferred_build) { - this._string = URI.build(this._parts); - this._deferred_build = false; - } - - return this; - }; - - p.clone = function() { - return new URI(this); - }; - - p.valueOf = p.toString = function() { - return this.build(false)._string; - }; - - - function generateSimpleAccessor(_part){ - return function(v, build) { - if (v === undefined) { - return this._parts[_part] || ''; - } else { - this._parts[_part] = v || null; - this.build(!build); - return this; - } - }; - } - - function generatePrefixAccessor(_part, _key){ - return function(v, build) { - if (v === undefined) { - return this._parts[_part] || ''; - } else { - if (v !== null) { - v = v + ''; - if (v.charAt(0) === _key) { - v = v.substring(1); - } - } - - this._parts[_part] = v; - this.build(!build); - return this; - } - }; - } - - p.protocol = generateSimpleAccessor('protocol'); - p.username = generateSimpleAccessor('username'); - p.password = generateSimpleAccessor('password'); - p.hostname = generateSimpleAccessor('hostname'); - p.port = generateSimpleAccessor('port'); - p.query = generatePrefixAccessor('query', '?'); - p.fragment = generatePrefixAccessor('fragment', '#'); - - p.search = function(v, build) { - var t = this.query(v, build); - return typeof t === 'string' && t.length ? ('?' + t) : t; - }; - p.hash = function(v, build) { - var t = this.fragment(v, build); - return typeof t === 'string' && t.length ? ('#' + t) : t; - }; - - p.pathname = function(v, build) { - if (v === undefined || v === true) { - var res = this._parts.path || (this._parts.hostname ? '/' : ''); - return v ? (this._parts.urn ? URI.decodeUrnPath : URI.decodePath)(res) : res; - } else { - if (this._parts.urn) { - this._parts.path = v ? URI.recodeUrnPath(v) : ''; - } else { - this._parts.path = v ? URI.recodePath(v) : '/'; - } - this.build(!build); - return this; - } - }; - p.path = p.pathname; - p.href = function(href, build) { - var key; - - if (href === undefined) { - return this.toString(); - } - - this._string = ''; - this._parts = URI._parts(); - - var _URI = href instanceof URI; - var _object = typeof href === 'object' && (href.hostname || href.path || href.pathname); - if (href.nodeName) { - var attribute = URI.getDomAttribute(href); - href = href[attribute] || ''; - _object = false; - } - - // window.location is reported to be an object, but it's not the sort - // of object we're looking for: - // * location.protocol ends with a colon - // * location.query != object.search - // * location.hash != object.fragment - // simply serializing the unknown object should do the trick - // (for location, not for everything...) - if (!_URI && _object && href.pathname !== undefined) { - href = href.toString(); - } - - if (typeof href === 'string' || href instanceof String) { - this._parts = URI.parse(String(href), this._parts); - } else if (_URI || _object) { - var src = _URI ? href._parts : href; - for (key in src) { - if (hasOwn.call(this._parts, key)) { - this._parts[key] = src[key]; - } - } - } else { - throw new TypeError('invalid input'); - } - - this.build(!build); - return this; - }; - - // identification accessors - p.is = function(what) { - var ip = false; - var ip4 = false; - var ip6 = false; - var name = false; - var sld = false; - var idn = false; - var punycode = false; - var relative = !this._parts.urn; - - if (this._parts.hostname) { - relative = false; - ip4 = URI.ip4_expression.test(this._parts.hostname); - ip6 = URI.ip6_expression.test(this._parts.hostname); - ip = ip4 || ip6; - name = !ip; - sld = name && SLD && SLD.has(this._parts.hostname); - idn = name && URI.idn_expression.test(this._parts.hostname); - punycode = name && URI.punycode_expression.test(this._parts.hostname); - } - - switch (what.toLowerCase()) { - case 'relative': - return relative; - - case 'absolute': - return !relative; - - // hostname identification - case 'domain': - case 'name': - return name; - - case 'sld': - return sld; - - case 'ip': - return ip; - - case 'ip4': - case 'ipv4': - case 'inet4': - return ip4; - - case 'ip6': - case 'ipv6': - case 'inet6': - return ip6; - - case 'idn': - return idn; - - case 'url': - return !this._parts.urn; - - case 'urn': - return !!this._parts.urn; - - case 'punycode': - return punycode; - } - - return null; - }; - - // component specific input validation - var _protocol = p.protocol; - var _port = p.port; - var _hostname = p.hostname; - - p.protocol = function(v, build) { - if (v !== undefined) { - if (v) { - // accept trailing :// - v = v.replace(/:(\/\/)?$/, ''); - - if (!v.match(URI.protocol_expression)) { - throw new TypeError('Protocol "' + v + '" contains characters other than [A-Z0-9.+-] or doesn\'t start with [A-Z]'); - } - } - } - return _protocol.call(this, v, build); - }; - p.scheme = p.protocol; - p.port = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v !== undefined) { - if (v === 0) { - v = null; - } - - if (v) { - v += ''; - if (v.charAt(0) === ':') { - v = v.substring(1); - } - - if (v.match(/[^0-9]/)) { - throw new TypeError('Port "' + v + '" contains characters other than [0-9]'); - } - } - } - return _port.call(this, v, build); - }; - p.hostname = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v !== undefined) { - var x = {}; - var res = URI.parseHost(v, x); - if (res !== '/') { - throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]'); - } - - v = x.hostname; - } - return _hostname.call(this, v, build); - }; - - // compound accessors - p.origin = function(v, build) { - var parts; - - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v === undefined) { - var protocol = this.protocol(); - var authority = this.authority(); - if (!authority) return ''; - return (protocol ? protocol + '://' : '') + this.authority(); - } else { - var origin = URI(v); - this - .protocol(origin.protocol()) - .authority(origin.authority()) - .build(!build); - return this; - } - }; - p.host = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v === undefined) { - return this._parts.hostname ? URI.buildHost(this._parts) : ''; - } else { - var res = URI.parseHost(v, this._parts); - if (res !== '/') { - throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]'); - } - - this.build(!build); - return this; - } - }; - p.authority = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v === undefined) { - return this._parts.hostname ? URI.buildAuthority(this._parts) : ''; - } else { - var res = URI.parseAuthority(v, this._parts); - if (res !== '/') { - throw new TypeError('Hostname "' + v + '" contains characters other than [A-Z0-9.-]'); - } - - this.build(!build); - return this; - } - }; - p.userinfo = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v === undefined) { - if (!this._parts.username) { - return ''; - } - - var t = URI.buildUserinfo(this._parts); - return t.substring(0, t.length -1); - } else { - if (v[v.length-1] !== '@') { - v += '@'; - } - - URI.parseUserinfo(v, this._parts); - this.build(!build); - return this; - } - }; - p.resource = function(v, build) { - var parts; - - if (v === undefined) { - return this.path() + this.search() + this.hash(); - } - - parts = URI.parse(v); - this._parts.path = parts.path; - this._parts.query = parts.query; - this._parts.fragment = parts.fragment; - this.build(!build); - return this; - }; - - // fraction accessors - p.subdomain = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - // convenience, return "www" from "www.example.org" - if (v === undefined) { - if (!this._parts.hostname || this.is('IP')) { - return ''; - } - - // grab domain and add another segment - var end = this._parts.hostname.length - this.domain().length - 1; - return this._parts.hostname.substring(0, end) || ''; - } else { - var e = this._parts.hostname.length - this.domain().length; - var sub = this._parts.hostname.substring(0, e); - var replace = new RegExp('^' + escapeRegEx(sub)); - - if (v && v.charAt(v.length - 1) !== '.') { - v += '.'; - } - - if (v) { - URI.ensureValidHostname(v); - } - - this._parts.hostname = this._parts.hostname.replace(replace, v); - this.build(!build); - return this; - } - }; - p.domain = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (typeof v === 'boolean') { - build = v; - v = undefined; - } - - // convenience, return "example.org" from "www.example.org" - if (v === undefined) { - if (!this._parts.hostname || this.is('IP')) { - return ''; - } - - // if hostname consists of 1 or 2 segments, it must be the domain - var t = this._parts.hostname.match(/\./g); - if (t && t.length < 2) { - return this._parts.hostname; - } - - // grab tld and add another segment - var end = this._parts.hostname.length - this.tld(build).length - 1; - end = this._parts.hostname.lastIndexOf('.', end -1) + 1; - return this._parts.hostname.substring(end) || ''; - } else { - if (!v) { - throw new TypeError('cannot set domain empty'); - } - - URI.ensureValidHostname(v); - - if (!this._parts.hostname || this.is('IP')) { - this._parts.hostname = v; - } else { - var replace = new RegExp(escapeRegEx(this.domain()) + '$'); - this._parts.hostname = this._parts.hostname.replace(replace, v); - } - - this.build(!build); - return this; - } - }; - p.tld = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (typeof v === 'boolean') { - build = v; - v = undefined; - } - - // return "org" from "www.example.org" - if (v === undefined) { - if (!this._parts.hostname || this.is('IP')) { - return ''; - } - - var pos = this._parts.hostname.lastIndexOf('.'); - var tld = this._parts.hostname.substring(pos + 1); - - if (build !== true && SLD && SLD.list[tld.toLowerCase()]) { - return SLD.get(this._parts.hostname) || tld; - } - - return tld; - } else { - var replace; - - if (!v) { - throw new TypeError('cannot set TLD empty'); - } else if (v.match(/[^a-zA-Z0-9-]/)) { - if (SLD && SLD.is(v)) { - replace = new RegExp(escapeRegEx(this.tld()) + '$'); - this._parts.hostname = this._parts.hostname.replace(replace, v); - } else { - throw new TypeError('TLD "' + v + '" contains characters other than [A-Z0-9]'); - } - } else if (!this._parts.hostname || this.is('IP')) { - throw new ReferenceError('cannot set TLD on non-domain host'); - } else { - replace = new RegExp(escapeRegEx(this.tld()) + '$'); - this._parts.hostname = this._parts.hostname.replace(replace, v); - } - - this.build(!build); - return this; - } - }; - p.directory = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v === undefined || v === true) { - if (!this._parts.path && !this._parts.hostname) { - return ''; - } - - if (this._parts.path === '/') { - return '/'; - } - - var end = this._parts.path.length - this.filename().length - 1; - var res = this._parts.path.substring(0, end) || (this._parts.hostname ? '/' : ''); - - return v ? URI.decodePath(res) : res; - - } else { - var e = this._parts.path.length - this.filename().length; - var directory = this._parts.path.substring(0, e); - var replace = new RegExp('^' + escapeRegEx(directory)); - - // fully qualifier directories begin with a slash - if (!this.is('relative')) { - if (!v) { - v = '/'; - } - - if (v.charAt(0) !== '/') { - v = '/' + v; - } - } - - // directories always end with a slash - if (v && v.charAt(v.length - 1) !== '/') { - v += '/'; - } - - v = URI.recodePath(v); - this._parts.path = this._parts.path.replace(replace, v); - this.build(!build); - return this; - } - }; - p.filename = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v === undefined || v === true) { - if (!this._parts.path || this._parts.path === '/') { - return ''; - } - - var pos = this._parts.path.lastIndexOf('/'); - var res = this._parts.path.substring(pos+1); - - return v ? URI.decodePathSegment(res) : res; - } else { - var mutatedDirectory = false; - - if (v.charAt(0) === '/') { - v = v.substring(1); - } - - if (v.match(/\.?\//)) { - mutatedDirectory = true; - } - - var replace = new RegExp(escapeRegEx(this.filename()) + '$'); - v = URI.recodePath(v); - this._parts.path = this._parts.path.replace(replace, v); - - if (mutatedDirectory) { - this.normalizePath(build); - } else { - this.build(!build); - } - - return this; - } - }; - p.suffix = function(v, build) { - if (this._parts.urn) { - return v === undefined ? '' : this; - } - - if (v === undefined || v === true) { - if (!this._parts.path || this._parts.path === '/') { - return ''; - } - - var filename = this.filename(); - var pos = filename.lastIndexOf('.'); - var s, res; - - if (pos === -1) { - return ''; - } - - // suffix may only contain alnum characters (yup, I made this up.) - s = filename.substring(pos+1); - res = (/^[a-z0-9%]+$/i).test(s) ? s : ''; - return v ? URI.decodePathSegment(res) : res; - } else { - if (v.charAt(0) === '.') { - v = v.substring(1); - } - - var suffix = this.suffix(); - var replace; - - if (!suffix) { - if (!v) { - return this; - } - - this._parts.path += '.' + URI.recodePath(v); - } else if (!v) { - replace = new RegExp(escapeRegEx('.' + suffix) + '$'); - } else { - replace = new RegExp(escapeRegEx(suffix) + '$'); - } - - if (replace) { - v = URI.recodePath(v); - this._parts.path = this._parts.path.replace(replace, v); - } - - this.build(!build); - return this; - } - }; - p.segment = function(segment, v, build) { - var separator = this._parts.urn ? ':' : '/'; - var path = this.path(); - var absolute = path.substring(0, 1) === '/'; - var segments = path.split(separator); - - if (segment !== undefined && typeof segment !== 'number') { - build = v; - v = segment; - segment = undefined; - } - - if (segment !== undefined && typeof segment !== 'number') { - throw new Error('Bad segment "' + segment + '", must be 0-based integer'); - } - - if (absolute) { - segments.shift(); - } - - if (segment < 0) { - // allow negative indexes to address from the end - segment = Math.max(segments.length + segment, 0); - } - - if (v === undefined) { - /*jshint laxbreak: true */ - return segment === undefined - ? segments - : segments[segment]; - /*jshint laxbreak: false */ - } else if (segment === null || segments[segment] === undefined) { - if (isArray(v)) { - segments = []; - // collapse empty elements within array - for (var i=0, l=v.length; i < l; i++) { - if (!v[i].length && (!segments.length || !segments[segments.length -1].length)) { - continue; - } - - if (segments.length && !segments[segments.length -1].length) { - segments.pop(); - } - - segments.push(trimSlashes(v[i])); - } - } else if (v || typeof v === 'string') { - v = trimSlashes(v); - if (segments[segments.length -1] === '') { - // empty trailing elements have to be overwritten - // to prevent results such as /foo//bar - segments[segments.length -1] = v; - } else { - segments.push(v); - } - } - } else { - if (v) { - segments[segment] = trimSlashes(v); - } else { - segments.splice(segment, 1); - } - } - - if (absolute) { - segments.unshift(''); - } - - return this.path(segments.join(separator), build); - }; - p.segmentCoded = function(segment, v, build) { - var segments, i, l; - - if (typeof segment !== 'number') { - build = v; - v = segment; - segment = undefined; - } - - if (v === undefined) { - segments = this.segment(segment, v, build); - if (!isArray(segments)) { - segments = segments !== undefined ? URI.decode(segments) : undefined; - } else { - for (i = 0, l = segments.length; i < l; i++) { - segments[i] = URI.decode(segments[i]); - } - } - - return segments; - } - - if (!isArray(v)) { - v = (typeof v === 'string' || v instanceof String) ? URI.encode(v) : v; - } else { - for (i = 0, l = v.length; i < l; i++) { - v[i] = URI.encode(v[i]); - } - } - - return this.segment(segment, v, build); - }; - - // mutating query string - var q = p.query; - p.query = function(v, build) { - if (v === true) { - return URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); - } else if (typeof v === 'function') { - var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); - var result = v.call(this, data); - this._parts.query = URI.buildQuery(result || data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); - this.build(!build); - return this; - } else if (v !== undefined && typeof v !== 'string') { - this._parts.query = URI.buildQuery(v, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); - this.build(!build); - return this; - } else { - return q.call(this, v, build); - } - }; - p.setQuery = function(name, value, build) { - var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); - - if (typeof name === 'string' || name instanceof String) { - data[name] = value !== undefined ? value : null; - } else if (typeof name === 'object') { - for (var key in name) { - if (hasOwn.call(name, key)) { - data[key] = name[key]; - } - } - } else { - throw new TypeError('URI.addQuery() accepts an object, string as the name parameter'); - } - - this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); - if (typeof name !== 'string') { - build = value; - } - - this.build(!build); - return this; - }; - p.addQuery = function(name, value, build) { - var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); - URI.addQuery(data, name, value === undefined ? null : value); - this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); - if (typeof name !== 'string') { - build = value; - } - - this.build(!build); - return this; - }; - p.removeQuery = function(name, value, build) { - var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); - URI.removeQuery(data, name, value); - this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); - if (typeof name !== 'string') { - build = value; - } - - this.build(!build); - return this; - }; - p.hasQuery = function(name, value, withinArray) { - var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); - return URI.hasQuery(data, name, value, withinArray); - }; - p.setSearch = p.setQuery; - p.addSearch = p.addQuery; - p.removeSearch = p.removeQuery; - p.hasSearch = p.hasQuery; - - // sanitizing URLs - p.normalize = function() { - if (this._parts.urn) { - return this - .normalizeProtocol(false) - .normalizePath(false) - .normalizeQuery(false) - .normalizeFragment(false) - .build(); - } - - return this - .normalizeProtocol(false) - .normalizeHostname(false) - .normalizePort(false) - .normalizePath(false) - .normalizeQuery(false) - .normalizeFragment(false) - .build(); - }; - p.normalizeProtocol = function(build) { - if (typeof this._parts.protocol === 'string') { - this._parts.protocol = this._parts.protocol.toLowerCase(); - this.build(!build); - } - - return this; - }; - p.normalizeHostname = function(build) { - if (this._parts.hostname) { - if (this.is('IDN') && punycode) { - this._parts.hostname = punycode.toASCII(this._parts.hostname); - } else if (this.is('IPv6') && IPv6) { - this._parts.hostname = IPv6.best(this._parts.hostname); - } - - this._parts.hostname = this._parts.hostname.toLowerCase(); - this.build(!build); - } - - return this; - }; - p.normalizePort = function(build) { - // remove port of it's the protocol's default - if (typeof this._parts.protocol === 'string' && this._parts.port === URI.defaultPorts[this._parts.protocol]) { - this._parts.port = null; - this.build(!build); - } - - return this; - }; - p.normalizePath = function(build) { - var _path = this._parts.path; - if (!_path) { - return this; - } - - if (this._parts.urn) { - this._parts.path = URI.recodeUrnPath(this._parts.path); - this.build(!build); - return this; - } - - if (this._parts.path === '/') { - return this; - } - - _path = URI.recodePath(_path); - - var _was_relative; - var _leadingParents = ''; - var _parent, _pos; - - // handle relative paths - if (_path.charAt(0) !== '/') { - _was_relative = true; - _path = '/' + _path; - } - - // handle relative files (as opposed to directories) - if (_path.slice(-3) === '/..' || _path.slice(-2) === '/.') { - _path += '/'; - } - - // resolve simples - _path = _path - .replace(/(\/(\.\/)+)|(\/\.$)/g, '/') - .replace(/\/{2,}/g, '/'); - - // remember leading parents - if (_was_relative) { - _leadingParents = _path.substring(1).match(/^(\.\.\/)+/) || ''; - if (_leadingParents) { - _leadingParents = _leadingParents[0]; - } - } - - // resolve parents - while (true) { - _parent = _path.search(/\/\.\.(\/|$)/); - if (_parent === -1) { - // no more ../ to resolve - break; - } else if (_parent === 0) { - // top level cannot be relative, skip it - _path = _path.substring(3); - continue; - } - - _pos = _path.substring(0, _parent).lastIndexOf('/'); - if (_pos === -1) { - _pos = _parent; - } - _path = _path.substring(0, _pos) + _path.substring(_parent + 3); - } - - // revert to relative - if (_was_relative && this.is('relative')) { - _path = _leadingParents + _path.substring(1); - } - - this._parts.path = _path; - this.build(!build); - return this; - }; - p.normalizePathname = p.normalizePath; - p.normalizeQuery = function(build) { - if (typeof this._parts.query === 'string') { - if (!this._parts.query.length) { - this._parts.query = null; - } else { - this.query(URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace)); - } - - this.build(!build); - } - - return this; - }; - p.normalizeFragment = function(build) { - if (!this._parts.fragment) { - this._parts.fragment = null; - this.build(!build); - } - - return this; - }; - p.normalizeSearch = p.normalizeQuery; - p.normalizeHash = p.normalizeFragment; - - p.iso8859 = function() { - // expect unicode input, iso8859 output - var e = URI.encode; - var d = URI.decode; - - URI.encode = escape; - URI.decode = decodeURIComponent; - try { - this.normalize(); - } finally { - URI.encode = e; - URI.decode = d; - } - return this; - }; - - p.unicode = function() { - // expect iso8859 input, unicode output - var e = URI.encode; - var d = URI.decode; - - URI.encode = strictEncodeURIComponent; - URI.decode = unescape; - try { - this.normalize(); - } finally { - URI.encode = e; - URI.decode = d; - } - return this; - }; - - p.readable = function() { - var uri = this.clone(); - // removing username, password, because they shouldn't be displayed according to RFC 3986 - uri.username('').password('').normalize(); - var t = ''; - if (uri._parts.protocol) { - t += uri._parts.protocol + '://'; - } - - if (uri._parts.hostname) { - if (uri.is('punycode') && punycode) { - t += punycode.toUnicode(uri._parts.hostname); - if (uri._parts.port) { - t += ':' + uri._parts.port; - } - } else { - t += uri.host(); - } - } - - if (uri._parts.hostname && uri._parts.path && uri._parts.path.charAt(0) !== '/') { - t += '/'; - } - - t += uri.path(true); - if (uri._parts.query) { - var q = ''; - for (var i = 0, qp = uri._parts.query.split('&'), l = qp.length; i < l; i++) { - var kv = (qp[i] || '').split('='); - q += '&' + URI.decodeQuery(kv[0], this._parts.escapeQuerySpace) - .replace(/&/g, '%26'); - - if (kv[1] !== undefined) { - q += '=' + URI.decodeQuery(kv[1], this._parts.escapeQuerySpace) - .replace(/&/g, '%26'); - } - } - t += '?' + q.substring(1); - } - - t += URI.decodeQuery(uri.hash(), true); - return t; - }; - - // resolving relative and absolute URLs - p.absoluteTo = function(base) { - var resolved = this.clone(); - var properties = ['protocol', 'username', 'password', 'hostname', 'port']; - var basedir, i, p; - - if (this._parts.urn) { - throw new Error('URNs do not have any generally defined hierarchical components'); - } - - if (!(base instanceof URI)) { - base = new URI(base); - } - - if (!resolved._parts.protocol) { - resolved._parts.protocol = base._parts.protocol; - } - - if (this._parts.hostname) { - return resolved; - } - - for (i = 0; (p = properties[i]); i++) { - resolved._parts[p] = base._parts[p]; - } - - if (!resolved._parts.path) { - resolved._parts.path = base._parts.path; - if (!resolved._parts.query) { - resolved._parts.query = base._parts.query; - } - } else if (resolved._parts.path.substring(-2) === '..') { - resolved._parts.path += '/'; - } - - if (resolved.path().charAt(0) !== '/') { - basedir = base.directory(); - basedir = basedir ? basedir : base.path().indexOf('/') === 0 ? '/' : ''; - resolved._parts.path = (basedir ? (basedir + '/') : '') + resolved._parts.path; - resolved.normalizePath(); - } - - resolved.build(); - return resolved; - }; - p.relativeTo = function(base) { - var relative = this.clone().normalize(); - var relativeParts, baseParts, common, relativePath, basePath; - - if (relative._parts.urn) { - throw new Error('URNs do not have any generally defined hierarchical components'); - } - - base = new URI(base).normalize(); - relativeParts = relative._parts; - baseParts = base._parts; - relativePath = relative.path(); - basePath = base.path(); - - if (relativePath.charAt(0) !== '/') { - throw new Error('URI is already relative'); - } - - if (basePath.charAt(0) !== '/') { - throw new Error('Cannot calculate a URI relative to another relative URI'); - } - - if (relativeParts.protocol === baseParts.protocol) { - relativeParts.protocol = null; - } - - if (relativeParts.username !== baseParts.username || relativeParts.password !== baseParts.password) { - return relative.build(); - } - - if (relativeParts.protocol !== null || relativeParts.username !== null || relativeParts.password !== null) { - return relative.build(); - } - - if (relativeParts.hostname === baseParts.hostname && relativeParts.port === baseParts.port) { - relativeParts.hostname = null; - relativeParts.port = null; - } else { - return relative.build(); - } - - if (relativePath === basePath) { - relativeParts.path = ''; - return relative.build(); - } - - // determine common sub path - common = URI.commonPath(relativePath, basePath); - - // If the paths have nothing in common, return a relative URL with the absolute path. - if (!common) { - return relative.build(); - } - - var parents = baseParts.path - .substring(common.length) - .replace(/[^\/]*$/, '') - .replace(/.*?\//g, '../'); - - relativeParts.path = (parents + relativeParts.path.substring(common.length)) || './'; - - return relative.build(); - }; - - // comparing URIs - p.equals = function(uri) { - var one = this.clone(); - var two = new URI(uri); - var one_map = {}; - var two_map = {}; - var checked = {}; - var one_query, two_query, key; - - one.normalize(); - two.normalize(); - - // exact match - if (one.toString() === two.toString()) { - return true; - } - - // extract query string - one_query = one.query(); - two_query = two.query(); - one.query(''); - two.query(''); - - // definitely not equal if not even non-query parts match - if (one.toString() !== two.toString()) { - return false; - } - - // query parameters have the same length, even if they're permuted - if (one_query.length !== two_query.length) { - return false; - } - - one_map = URI.parseQuery(one_query, this._parts.escapeQuerySpace); - two_map = URI.parseQuery(two_query, this._parts.escapeQuerySpace); - - for (key in one_map) { - if (hasOwn.call(one_map, key)) { - if (!isArray(one_map[key])) { - if (one_map[key] !== two_map[key]) { - return false; - } - } else if (!arraysEqual(one_map[key], two_map[key])) { - return false; - } - - checked[key] = true; - } - } - - for (key in two_map) { - if (hasOwn.call(two_map, key)) { - if (!checked[key]) { - // two contains a parameter not present in one - return false; - } - } - } - - return true; - }; - - // state - p.duplicateQueryParameters = function(v) { - this._parts.duplicateQueryParameters = !!v; - return this; - }; - - p.escapeQuerySpace = function(v) { - this._parts.escapeQuerySpace = !!v; - return this; - }; - - return URI; -})); diff --git a/src/vendor/jed.d.ts b/src/vendor/jed.d.ts deleted file mode 100644 index 2e64cba08..000000000 --- a/src/vendor/jed.d.ts +++ /dev/null @@ -1,13 +0,0 @@ - -interface JedModule { - translate: any; - ngettext: any; -} - -interface JedConstructor { - new(s: any): JedModule; -} - -declare const Jed: JedConstructor; - -export default Jed; diff --git a/src/vendor/jed.js b/src/vendor/jed.js deleted file mode 120000 index 72ac5c3ec..000000000 --- a/src/vendor/jed.js +++ /dev/null @@ -1 +0,0 @@ -../../thirdparty/jed/jed.js \ No newline at end of file diff --git a/src/vendor/react-dom.dev.js b/src/vendor/react-dom.dev.js deleted file mode 100644 index 8e846a803..000000000 --- a/src/vendor/react-dom.dev.js +++ /dev/null @@ -1,18525 +0,0 @@ - /** - * ReactDOM v16.0.0-alpha - */ - -;(function(f) { - // CommonJS - if (typeof exports === "object" && typeof module !== "undefined") { - f(require('react')); - - // RequireJS - } else if (typeof define === "function" && define.amd) { - require(['react'], f); - - // - - - - - - diff --git a/testlib/talertest.ts b/testlib/talertest.ts deleted file mode 100644 index b28e2036c..000000000 --- a/testlib/talertest.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* - This file is part of TALER - (C) 2016 Inria - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see - */ - -/** - * - * @author Florian Dold - */ - -type TestFn = (t: TestLib) => void | Promise; - -interface Test { - name: string; - testFn: TestFn; -} - -export interface TestLib { - pass(msg?: string): void; - fail(msg?: string): void; - assert(v: any, msg?: string): void; - assertEqualsStrict(v1: any, v2: any, msg?: string): void; -} - -let tests: Test[] = []; -let testRunner: any; - - -/** - * Register a test case. - */ -export function test(name: string, testFn: TestFn) { - tests.push({name, testFn}); -} - - -/** - * Run all registered test case, producing a TAP stream. - */ -export async function run(statusCallback?: (m: string) => void) { - console.log(`1..${tests.length}`); - for (let i in tests) { - let t = tests[i]; - let passed = false; - let lastMsg: string|undefined = undefined; - let p = new Promise((resolve, reject) => { - let pass = (msg?: string) => { - if (passed) { - let e = Error("test passed twice"); - reject(e); - throw e; - } - passed = true; - lastMsg = msg; - resolve(); - }; - let fail = (msg?: string) => { - lastMsg = msg; - let e = Error("test failed"); - reject(e); - throw e; - }; - let assert = (v: any, msg?: string) => { - if (!v) { - lastMsg = msg; - reject(Error("test failed")); - return; - } - }; - let assertEqualsStrict = (v1: any, v2: any, msg?: string) => { - if (v1 !== v2) { - console.log(`# expected: ${v1}`); - console.log(`# actual: ${v2}`); - lastMsg = msg; - let e = Error("test failed"); - reject(e); - throw e; - } - }; - // Test might return a promise. If so, wait for it. - let r = t.testFn({pass,fail, assert, assertEqualsStrict}); - r.then(() => resolve(), (e) => reject(e)); - }); - - console.log(`# ${t.name}`); - statusCallback && statusCallback(`starting test ${t.name}`); - - if (!lastMsg) { - lastMsg = "-"; - } - - try { - await p; - if (!passed) { - throw Error("test did not call 'pass'"); - } - console.log(`ok ${Number(i) + 1} ${lastMsg || "-"}`); - statusCallback && statusCallback(`finished test ${t.name}`); - } catch (e) { - try { - console.error(e.stack); - } catch (e2) { - console.error(e); - } - console.log(`not ok ${Number(i) + 1} ${lastMsg || "-"}`); - statusCallback && statusCallback(`failed test ${t.name}`); - } - } -} diff --git a/thirdparty/README b/thirdparty/README deleted file mode 100644 index a095a34b8..000000000 --- a/thirdparty/README +++ /dev/null @@ -1,24 +0,0 @@ -We maintain copies of third-party repositories in this directory. -Preferably each subdirectory should be maintained via 'git subtree'. -The rest of the project references third party components either via -symlinks, or via the build system. - -The following third party modules are used: - -Directory: jed -Copyright: jQuery Foundation and other contributors, https://jquery.org/ -License: See jed/LICENSE -Description: gettext .po parser for JavaScript -Repository: https://github.com/SlexAxton/Jed/blob/master/LICENSE - -Directory: URI.js -Copyright: Rodney Rehm -License: The MIT License -Description: URL parsing and manipulation library for JavaScript -Repository: https://github.com/medialize/URI.js - -Directory: systemjs -Copyright: Guy Bedford -License: MIT License -Description: Universal module loader for JavaScript -Repository: https://github.com/systemjs/systemjs diff --git a/thirdparty/URI.js/.editorconfig b/thirdparty/URI.js/.editorconfig deleted file mode 100644 index 778c1485c..000000000 --- a/thirdparty/URI.js/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[**] -charset = utf-8 -end_of_line = lf -indent_size = 2 -indent_style = space -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/thirdparty/URI.js/.gitignore b/thirdparty/URI.js/.gitignore deleted file mode 100644 index 9daa8247d..000000000 --- a/thirdparty/URI.js/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -node_modules diff --git a/thirdparty/URI.js/.jshintrc b/thirdparty/URI.js/.jshintrc deleted file mode 100644 index 8327de8cb..000000000 --- a/thirdparty/URI.js/.jshintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "node": true, - "browser": false, - "esnext": false, - "bitwise": false, - "camelcase": true, - "curly": true, - "eqeqeq": true, - "immed": true, - "indent": 2, - "latedef": true, - "newcap": true, - "noarg": true, - "quotmark": "single", - "regexp": true, - "undef": true, - "unused": true, - "strict": true, - "trailing": true, - "smarttabs": true, - "expr": true, - "globals": { - "describe": false, - "it": false, - "before": false, - "beforeEach": false, - "after": false, - "afterEach": false, - "define": false - } -} \ No newline at end of file diff --git a/thirdparty/URI.js/CHANGELOG.md b/thirdparty/URI.js/CHANGELOG.md deleted file mode 100644 index 49cd3cc96..000000000 --- a/thirdparty/URI.js/CHANGELOG.md +++ /dev/null @@ -1,332 +0,0 @@ -# URI.js - Changelog # - -The release notes tracked in this document are also made available on the [releases page](https://github.com/medialize/URI.js/releases) - -### 1.18.2 (September 25th 2016) ### - -* fixing [`URI.withinString()`](http://medialize.github.io/URI.js/docs.html#static-withinString) to allow callback to return `undefined` or `string` - [Issue #303](https://github.com/medialize/URI.js/issues/303) -* fixing [`.absoluteTo()`](http://medialize.github.io/URI.js/docs.html#absoluteto) to properly resolve relative paths for fragment-only URLs - -### 1.18.1 (May 29th 2016) ### - -* fixing UMD wrapper of `jquery.URI.js` - [Issue #295](https://github.com/medialize/URI.js/issues/295) - -### 1.18.0 (April 30th 2016) ### - -* adding [`URI.joinPaths()`](http://medialize.github.io/URI.js/docs.html#static-joinPaths) to compose paths from directory tokens - [Issue #285](https://github.com/medialize/URI.js/issues/285) -* fixing [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) to allow `.` in variable names - [PR #287](https://github.com/medialize/URI.js/pull/287) -* fixing [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) to reject invalid literals - [PR #289](https://github.com/medialize/URI.js/pull/289) -* fixing [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) to reject prefix modifier on composite values - [PR #290](https://github.com/medialize/URI.js/pull/290) -* fixing [`URI.buildUserinfo()`](http://medialize.github.io/URI.js/docs.html#static-buildUserinfo) to properly serialize password-only values - [PR #293](https://github.com/medialize/URI.js/pull/293) - -### 1.17.1 (February 25th 2016) ### - -* fixing [`.normalizePath()`](http://medialize.github.io/URI.js/docs.html#normalize-path) to properly handle percent-encoded dot segments and leading dots in basename - [Issue #264](https://github.com/medialize/URI.js/issues/264), by [JordanMilne](https://github.com/JordanMilne) -* fixing [`.hasQuery()`](http://medialize.github.io/URI.js/docs.html#search-has) to accept `RegExp` for name argument - [Issue #274](https://github.com/medialize/URI.js/issues/274), [Issue #277](https://github.com/medialize/URI.js/issues/277) by [mbrodala](https://github.com/mbrodala) - -### 1.17.0 (November 13th 2015) ### - -* fixing [`URI.removeQuery()`](http://medialize.github.io/URI.js/docs.html#search-remove) to cast values to string before matching - [Issue #250](https://github.com/medialize/URI.js/pull/250), [Issue #252](https://github.com/medialize/URI.js/pull/252), by [ryanelian](https://github.com/ryanelian) and [Siltaar](https://github.com/Siltaar) -* fixing [`.segment()`](http://medialize.github.io/URI.js/docs.html#accessors-segment) to allow appending an empty element - [Issue #236](https://github.com/medialize/URI.js/issues/236), [Issue #253](https://github.com/medialize/URI.js/pull/253), by [orlando](https://github.com/orlando) -* adding [`.origin()`](http://medialize.github.io/URI.js/docs.html#accessors-origin) to get protocol and authority, counter-part to `.resource()` - [Issue #210](https://github.com/medialize/URI.js/issues/210), [Issue #263](https://github.com/medialize/URI.js/pull/263), by [justinmchase](https://github.com/justinmchase) - -### 1.16.1 (September 19th 2015) ### - -Package Management Cleanup - no changes to source code! - -* renaming package to "urijs", was "URIjs" (because npm decided to go lower-case at some point and maintaining capitals in your package name poses all sorts of stupid issues) -* removing [jam](http://jamjs.org/), [spm](http://spmjs.org/), `component.json` and `URI.jquery.json` as nobody cared that URI.js was stuck on 1.14 for a year - -### 1.16.0 (July 24th 2015) ### - -* **SECURITY** fixing [`URI.parseHost()`](http://medialize.github.io/URI.js/docs.html#static-parseHost) to rewrite `\` to `/` as Node and Browsers do - [Issue #233](https://github.com/medialize/URI.js/pull/233) -* fixing [`.host()`](http://medialize.github.io/URI.js/docs.html#accessors-host) and [`.authority()`](http://medialize.github.io/URI.js/docs.html#accessors-authority) to raise an error if they contain a path segment (extending [Issue #233](https://github.com/medialize/URI.js/pull/233)) - -### 1.15.2 (July 2nd 2015) ### - -* fixing [`URI.parseQuery()`](http://medialize.github.io/URI.js/docs.html#static-parseQuery) to accept `?foo&foo=bar` - [Issue #220](https://github.com/medialize/URI.js/issues/220) -* fixing [`.segmentCoded()`](http://medialize.github.io/URI.js/docs.html#accessors-segmentCoded) to encode (instead of decode) array input - [Issue #223](https://github.com/medialize/URI.js/issues/223) -* fixing [`.normalizePath()`](http://medialize.github.io/URI.js/docs.html#normalize-path) to properly resolve `/foo/..` to `/` - [Issue #224](https://github.com/medialize/URI.js/issues/224) -* fixing [`.relativeTo()`](http://medialize.github.io/URI.js/docs.html#relativeto) to resolve `/foo/` and `/foo/bar` to `./` instead of empty string - [Issue #226](https://github.com/medialize/URI.js/issues/226) -* fixing `bower.json`'s `"main": "src/URI.js"` - [Issue #227](https://github.com/medialize/URI.js/issues/227) - -### 1.15.1 (April 5th 2015) ### - -* fixing `URI()` to match behavior of `new URI()` (caused by [#196](https://github.com/medialize/URI.js/issues/196)) - [Issue #205](https://github.com/medialize/URI.js/issues/205) -* fixing [`URI.removeQuery()`](http://medialize.github.io/URI.js/docs.html#search-remove) to accept RegExp for name and value arguments - ([Issue #204](https://github.com/medialize/URI.js/issues/204), [peterwillis](https://github.com/peterwillis)) - -### 1.15.0 (April 1st 2015 - no joke, promise!) ### - -* fixing `URI(undefined)` to throw TypeError - ([Issue #189](https://github.com/medialize/URI.js/issues/189), [Issue #196](https://github.com/medialize/URI.js/issues/196), [eakron](https://github.com/eakron)) - *tiny backward-compatibility-break* -* fixing [`.absoluteTo()`](http://medialize.github.io/URI.js/docs.html#absoluteto) - ([Issue #200](https://github.com/medialize/URI.js/issues/200), [giltayar](https://github.com/giltayar)) -* fixing [`.pathname()`](http://medialize.github.io/URI.js/docs.html#accessors-pathname) to properly en/decode URN paths - ([Issue #201](https://github.com/medialize/URI.js/pull/201), [mlefoster](https://github.com/mlefoster)) -* fixing URI normalization to properly handle URN paths based on [RFC 2141](https://www.ietf.org/rfc/rfc2141.txt) syntax - ([Issue #201](https://github.com/medialize/URI.js/pull/201), [mlefoster](https://github.com/mlefoster)) - * fixing [`.normalize()`](http://medialize.github.io/URI.js/docs.html#normalize) and [`.normalizePath()`](http://medialize.github.io/URI.js/docs.html#normalize-path) to properly normalize URN paths - * adding `URI.encodeUrnPathSegment()` - * adding `URI.decodeUrnPathSegment()` - * adding `URI.decodeUrnPath()` - * adding `URI.recodeUrnPath()` - -### 1.14.2 (February 25th 2015) ### - -* fixing inclusion of LICENSE in packages - ([Issue #174](https://github.com/medialize/URI.js/issues/174)) -* fixing [`URI.parseHost()`](http://medialize.github.io/URI.js/docs.html#static-parseHost) to not interpret colon in path as IPv6 hostname - ([Issue #190](https://github.com/medialize/URI.js/issues/190)) -* adding meta data for [SPM](http://www.spmjs.io/) package manager - ([Issue #176](https://github.com/medialize/URI.js/issues/176)) -* adding license meta to `bower.json` - -### 1.14.1 (October 1st 2014) ### - -* fixing handling of String instances (not string primitives) - ([Issue #146](https://github.com/medialize/URI.js/issues/146)) -* fixing Firefox [`.watch()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch) interfering with `.parseQuery()` - ([Issue #169](https://github.com/medialize/URI.js/issues/169)) -* fixing [`addQuery()`](http://medialize.github.io/URI.js/docs.html#search-add) to not throw error on null value - ([Issue #171](https://github.com/medialize/URI.js/issues/171)) - -### 1.14.0 (September 8th 2014) ### - -* adding Hungarian second level domains - ([Issue #159](https://github.com/medialize/URI.js/issues/159)) -* adding `